mirror of
https://github.com/pret/pmd-red.git
synced 2026-08-17 06:16:39 -05:00
Decomped GetMoveTargetingFlagsForPokemon()
This commit is contained in:
@@ -2599,7 +2599,7 @@ _08053874:
|
||||
adds r0, r7, 0
|
||||
mov r1, r8
|
||||
movs r2, 0
|
||||
bl GetTargetingFlags
|
||||
bl GetMoveTargetingFlagsForPokemon
|
||||
movs r1, 0xF0
|
||||
ands r1, r0
|
||||
cmp r1, 0
|
||||
@@ -2897,7 +2897,7 @@ _08053AE8:
|
||||
adds r0, r7, 0
|
||||
mov r1, r8
|
||||
movs r2, 0
|
||||
bl GetTargetingFlags
|
||||
bl GetMoveTargetingFlagsForPokemon
|
||||
lsls r0, 16
|
||||
asrs r1, r0, 16
|
||||
ldr r0, _08053C88
|
||||
@@ -2958,7 +2958,7 @@ _08053B5C:
|
||||
adds r0, r7, 0
|
||||
mov r1, r8
|
||||
movs r2, 0
|
||||
bl GetTargetingFlags
|
||||
bl GetMoveTargetingFlagsForPokemon
|
||||
lsls r0, 16
|
||||
movs r1, 0xF0
|
||||
lsls r1, 12
|
||||
@@ -3310,7 +3310,7 @@ _08053E4A:
|
||||
adds r0, r7, 0
|
||||
mov r1, r8
|
||||
movs r2, 0
|
||||
bl GetTargetingFlags
|
||||
bl GetMoveTargetingFlagsForPokemon
|
||||
movs r1, 0xF
|
||||
ands r1, r0
|
||||
cmp r1, 0
|
||||
@@ -7112,7 +7112,7 @@ _08056068:
|
||||
adds r0, r5, 0
|
||||
adds r1, r7, 0
|
||||
movs r2, 0x1
|
||||
bl GetTargetingFlags
|
||||
bl GetMoveTargetingFlagsForPokemon
|
||||
movs r4, 0xF0
|
||||
adds r1, r4, 0
|
||||
ands r1, r0
|
||||
@@ -7124,7 +7124,7 @@ _08056084:
|
||||
adds r0, r5, 0
|
||||
adds r1, r7, 0
|
||||
movs r2, 0x1
|
||||
bl GetTargetingFlags
|
||||
bl GetMoveTargetingFlagsForPokemon
|
||||
adds r1, r4, 0
|
||||
ands r1, r0
|
||||
cmp r1, 0x80
|
||||
@@ -8349,7 +8349,7 @@ _08056A66:
|
||||
mov r0, r10
|
||||
ldr r1, [sp, 0x1C]
|
||||
movs r2, 0
|
||||
bl GetTargetingFlags
|
||||
bl GetMoveTargetingFlagsForPokemon
|
||||
adds r2, r0, 0
|
||||
lsls r2, 16
|
||||
asrs r2, 16
|
||||
@@ -8731,7 +8731,7 @@ _08056D44:
|
||||
adds r0, r5, 0
|
||||
mov r1, r8
|
||||
movs r2, 0
|
||||
bl GetTargetingFlags
|
||||
bl GetMoveTargetingFlagsForPokemon
|
||||
lsls r0, 16
|
||||
asrs r7, r0, 16
|
||||
movs r0, 0xF
|
||||
|
||||
12516
asm/code_807CABC.s
12516
asm/code_807CABC.s
File diff suppressed because it is too large
Load Diff
12493
asm/code_807CD9C.s
Normal file
12493
asm/code_807CD9C.s
Normal file
File diff suppressed because it is too large
Load Diff
@@ -52,17 +52,19 @@ enum TargetingFlag
|
||||
{
|
||||
TARGETING_FLAG_TARGET_OTHER = 0x0,
|
||||
TARGETING_FLAG_HEAL_TEAM = 0x1,
|
||||
TARGETING_FLAG_SWAP_POSITIONS = 0x2,
|
||||
TARGETING_FLAG_LONG_RANGE = 0x2,
|
||||
TARGETING_FLAG_BOOST_SELF = 0x3,
|
||||
TARGETING_FLAG_MULTI_TURN = 0x4,
|
||||
TARGETING_FLAG_ATTACK_ALL = 0x5,
|
||||
TARGETING_FLAG_BOOST_TEAM = 0x6,
|
||||
TARGETING_FLAG_DONT_USE = 0xF,
|
||||
TARGETING_FLAG_ITEM = 0xF,
|
||||
TARGETING_FLAG_TARGET_FRONTAL_CONE = 0x10,
|
||||
TARGETING_FLAG_TARGET_AROUND = 0x20,
|
||||
TARGETING_FLAG_TARGET_ROOM = 0x30,
|
||||
TARGETING_FLAG_TARGET_2_TILES_AHEAD = 0x40,
|
||||
TARGETING_FLAG_TARGET_LINE = 0x50,
|
||||
TARGETING_FLAG_TARGET_FLOOR = 0x60,
|
||||
TARGETING_FLAG_SELF_HEAL = 0x70,
|
||||
TARGETING_FLAG_TARGET_SELF = 0x70,
|
||||
TARGETING_FLAG_CUT_CORNERS = 0x80,
|
||||
TARGETING_FLAG_SET_TRAP = 0x100,
|
||||
TARGETING_FLAG_HEAL_HP = 0x200,
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
|
||||
// 0x92A88
|
||||
void InitPokemonMove(struct PokemonMove *move, u16 moveID);
|
||||
// 0x92AE0
|
||||
s16 GetMoveTargetingFlags(struct PokemonMove *move, u32 isAI);
|
||||
// 0x92B90
|
||||
u8 GetMoveWeight(struct PokemonMove *move);
|
||||
// 0x92BF4
|
||||
|
||||
10
include/targeting_flags.h
Normal file
10
include/targeting_flags.h
Normal file
@@ -0,0 +1,10 @@
|
||||
#ifndef GUARD_TARGETING_FLAGS_H
|
||||
#define GUARD_TARGETING_FLAGS_H
|
||||
|
||||
#include "constants/move.h"
|
||||
#include "dungeon_entity.h"
|
||||
|
||||
// 0x7CD64
|
||||
s16 GetMoveTargetingFlagsForPokemon(struct DungeonEntity *pokemon, struct PokemonMove *move, u32 isAI);
|
||||
|
||||
#endif
|
||||
@@ -237,6 +237,8 @@ SECTIONS {
|
||||
asm/code_807C4A0.o(.text);
|
||||
src/dungeon_ai_attack_1.o(.text);
|
||||
asm/code_807CABC.o(.text);
|
||||
src/targeting_flags.o(.text);
|
||||
asm/code_807CD9C.o(.text);
|
||||
src/dungeon_range.o(.text);
|
||||
asm/code_808333C.o(.text);
|
||||
src/dungeon_random.o(.text);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "position_util.h"
|
||||
#include "status_checks.h"
|
||||
#include "targeting.h"
|
||||
#include "targeting_flags.h"
|
||||
|
||||
#define REGULAR_ATTACK_INDEX 4
|
||||
|
||||
@@ -38,7 +39,6 @@ extern struct DungeonEntity *gPotentialTargets[NUM_DIRECTIONS];
|
||||
|
||||
extern bool8 IsMoveUsable(struct DungeonEntity*, s32, bool8);
|
||||
extern bool8 TargetRegularAttack(struct DungeonEntity*, u32*, bool8);
|
||||
extern s16 GetTargetingFlags(struct DungeonEntity*, struct PokemonMove*, bool8);
|
||||
extern bool8 CanUseWithStatusChecker(struct DungeonEntity*, struct PokemonMove*);
|
||||
extern bool8 CanAttackInFront(struct DungeonEntity*, s32);
|
||||
extern s32 WeightMoveIfUsable(s32, s32, struct DungeonEntity*, struct DungeonEntity*, struct PokemonMove*, bool8);
|
||||
@@ -346,7 +346,7 @@ s32 FindMoveTarget(struct MoveTargetResults *moveTargetResults, struct DungeonEn
|
||||
{
|
||||
gCanAttackInDirection[i] = FALSE;
|
||||
}
|
||||
targetingFlags = GetTargetingFlags(pokemon, move, TRUE);
|
||||
targetingFlags = GetMoveTargetingFlagsForPokemon(pokemon, move, TRUE);
|
||||
hasStatusChecker = HasIQSkill(pokemon, IQ_SKILL_STATUS_CHECKER);
|
||||
moveTargetResults->moveUsable = FALSE;
|
||||
if ((pokemonData->volatileStatus == VOLATILE_STATUS_TAUNTED && !GetMoveDealsDirectDamage(move)) ||
|
||||
@@ -477,7 +477,7 @@ s32 FindMoveTarget(struct MoveTargetResults *moveTargetResults, struct DungeonEn
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (rangeTargetingFlags == TARGETING_FLAG_SELF_HEAL)
|
||||
else if (rangeTargetingFlags == TARGETING_FLAG_TARGET_SELF)
|
||||
{
|
||||
numPotentialTargets = WeightMoveIfUsable(numPotentialTargets, targetingFlags, pokemon, pokemon, move, hasStatusChecker);
|
||||
}
|
||||
|
||||
@@ -158,9 +158,9 @@ void InitZeroedPPPokemonMove(struct PokemonMove *move, u16 moveID)
|
||||
move->PP = 0;
|
||||
}
|
||||
|
||||
s16 GetMoveTargetingFlags(struct PokemonMove *move, u32 r1)
|
||||
s16 GetMoveTargetingFlags(struct PokemonMove *move, u32 isAI)
|
||||
{
|
||||
return gMovesData[move->moveID].targetingFlags[r1];
|
||||
return gMovesData[move->moveID].targetingFlags[isAI];
|
||||
}
|
||||
|
||||
u8 GetMoveType(struct PokemonMove *move)
|
||||
|
||||
17
src/targeting_flags.c
Normal file
17
src/targeting_flags.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#include "global.h"
|
||||
#include "targeting_flags.h"
|
||||
|
||||
#include "constants/move_id.h"
|
||||
#include "constants/type.h"
|
||||
#include "moves.h"
|
||||
|
||||
extern bool8 HasType(struct DungeonEntity *pokemon, u8 type);
|
||||
|
||||
s16 GetMoveTargetingFlagsForPokemon(struct DungeonEntity *pokemon, struct PokemonMove *move, u32 isAI)
|
||||
{
|
||||
if (move->moveID == MOVE_CURSE && !isAI && !HasType(pokemon, TYPE_GHOST))
|
||||
{
|
||||
return TARGETING_FLAG_BOOST_SELF | TARGETING_FLAG_TARGET_SELF;
|
||||
}
|
||||
return GetMoveTargetingFlags(move, isAI);
|
||||
}
|
||||
Reference in New Issue
Block a user