From 9d0ce06023d6e6d5ce37f1333b421d338f07edfa Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Thu, 31 Oct 2024 12:12:25 +0100 Subject: [PATCH] get rid of nonmatching fakematch sub_809542C --- src/code_8073CF0.c | 5 +---- src/code_8094F88.c | 15 ++------------- src/dungeon_ai_attack.c | 18 +++++++----------- 3 files changed, 10 insertions(+), 28 deletions(-) diff --git a/src/code_8073CF0.c b/src/code_8073CF0.c index fe5818d30..d287c0bdd 100644 --- a/src/code_8073CF0.c +++ b/src/code_8073CF0.c @@ -943,10 +943,7 @@ bool8 UseAttack(Entity *a0) EntityInfo *monInfo = GetEntInfo(mon); Unk_Entity_x184 *strPtr = &monInfo->unk184[monInfo->notMoving]; - #ifndef NONMATCHING - // Dummy needed to match, feel free to remove if you do not care about matching. - i++;i--; - #endif // NONMATCHING + ASM_MATCH_TRICK(i); if (monInfo->numMoveTiles != 0) { IncreaseEntityPixelPos(mon, strPtr->lastMoveIncrement.x, strPtr->lastMoveIncrement.y); if (--strPtr->walkAnimFramesLeft == 0) { diff --git a/src/code_8094F88.c b/src/code_8094F88.c index dc75b0cb6..830496891 100644 --- a/src/code_8094F88.c +++ b/src/code_8094F88.c @@ -272,21 +272,10 @@ s32 sub_8095400(u32 param_1) void sub_809542C(WonderMailSub *param_1) { - u32 seed; - -#ifndef NONMATCHING - register unkStruct_203B480 *preload asm("r2"); -#else - unkStruct_203B480 *preload; -#endif - - u8 buffer [20]; + u8 buffer[20]; gUnknown_203B480->mailType = 1; - preload = gUnknown_203B480; - seed = param_1->seed; - preload->unk4.dungeon = param_1->dungeon; - preload->unk4.seed = seed; + gUnknown_203B480->unk4 = *param_1; sub_8094D28(Rand32Bit()); gUnknown_203B480->unk10.unk10 = sub_8094E4C(); gUnknown_203B480->clientSpecies = GetPlayerPokemonStruct()->speciesNum; diff --git a/src/dungeon_ai_attack.c b/src/dungeon_ai_attack.c index 26b232f5b..a61aa48b6 100644 --- a/src/dungeon_ai_attack.c +++ b/src/dungeon_ai_attack.c @@ -771,21 +771,17 @@ bool8 IsAITargetEligible(s32 targetingFlags, Entity *user, Entity *target, Move s32 WeightMove(Entity *user, s32 targetingFlags, Entity *target, u32 moveType) { -#ifndef NONMATCHING - register EntityInfo *targetData asm("r4"); -#else EntityInfo *targetData; -#endif s32 targetingFlags2 = (s16) targetingFlags; u8 moveType2 = moveType; u8 weight = 1; - EntityInfo *targetData2; - targetData2 = targetData = GetEntInfo(target); - if (!targetData->isNotTeamMember || (targetingFlags2 & 0xF) != TARGETING_FLAG_TARGET_OTHER) - { + targetData = GetEntInfo(target); + if (!targetData->isNotTeamMember) return 1; - } - else if (IQSkillIsEnabled(user, IQ_EXP_GO_GETTER)) + if ((targetingFlags2 & 0xF) != TARGETING_FLAG_TARGET_OTHER) + return 1; + + if (IQSkillIsEnabled(user, IQ_EXP_GO_GETTER)) { // BUG: expYieldRankings has lower values as the Pokémon's experience yield increases. // This causes Exp. Go-Getter to prioritize Pokémon worth less experience @@ -794,7 +790,7 @@ s32 WeightMove(Entity *user, s32 targetingFlags, Entity *target, u32 moveType) } else if (IQSkillIsEnabled(user, IQ_EFFICIENCY_EXPERT)) { - weight = -12 - targetData2->HP; + weight = -12 - targetData->HP; if (weight == 0) { weight = 1;