mirror of
https://github.com/pret/pmd-red.git
synced 2026-09-08 00:55:53 -05:00
dungeon action execution
This commit is contained in:
8
include/dungeon_action_execution.h
Normal file
8
include/dungeon_action_execution.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#ifndef GUARD_DUNGEON_ACTION_EXECUTION_H
|
||||
#define GUARD_DUNGEON_ACTION_EXECUTION_H
|
||||
|
||||
#include "structs/dungeon_entity.h"
|
||||
|
||||
bool8 ExecuteEntityDungeonAction(Entity *entity);
|
||||
|
||||
#endif
|
||||
@@ -5,6 +5,5 @@
|
||||
|
||||
bool8 TargetLeader(Entity *pokemon);
|
||||
Entity* GetLeaderIfVisible(Entity *pokemon);
|
||||
bool8 sub_8072CF4(Entity *entity);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -27,6 +27,8 @@ struct DungeonDialogueStruct
|
||||
const u8 *str;
|
||||
};
|
||||
|
||||
extern bool8 gUnknown_203B434;
|
||||
|
||||
void sub_80521D0(void);
|
||||
void sub_8052210(bool8 a0);
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@ SECTIONS {
|
||||
src/dungeon_8071B48.o(.text);
|
||||
src/dungeon_leveling.o(.text);
|
||||
src/dungeon_ai_leader.o(.text);
|
||||
src/dungeon_8072CF4.o(.text);
|
||||
src/dungeon_action_execution.o(.text);
|
||||
src/dungeon_ai_items.o(.text);
|
||||
src/dungeon_turn_effects.o(.text);
|
||||
src/code_8075708.o(.text);
|
||||
@@ -629,7 +629,7 @@ SECTIONS {
|
||||
src/dungeon_8071B48.o(.rodata);
|
||||
src/dungeon_leveling.o(.rodata);
|
||||
src/dungeon_ai_leader.o(.rodata);
|
||||
src/dungeon_8072CF4.o(.rodata);
|
||||
src/dungeon_action_execution.o(.rodata);
|
||||
src/dungeon_ai_items.o(.rodata);
|
||||
src/dungeon_turn_effects.o(.rodata);
|
||||
src/code_8075708.o(.rodata);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "global.h"
|
||||
#include "globaldata.h"
|
||||
#include "dungeon_action_execution.h"
|
||||
#include "dungeon_ai_leader.h"
|
||||
#include "dungeon_move_util.h"
|
||||
#include "dungeon_vram.h"
|
||||
@@ -35,12 +36,9 @@
|
||||
#include "dungeon_turn_effects.h"
|
||||
#include "dungeon_leveling.h"
|
||||
#include "dungeon_cutscene.h"
|
||||
#include "dungeon_move.h"
|
||||
#include "warp_target.h"
|
||||
|
||||
extern u8 gUnknown_202F221;
|
||||
extern u8 gUnknown_202F222;
|
||||
extern u8 gUnknown_203B434;
|
||||
|
||||
void sub_8075BA4(Entity *param_1, u8 param_2);
|
||||
void sub_804178C(u8 param_1);
|
||||
void nullsub_95(Entity *);
|
||||
@@ -48,15 +46,11 @@ extern void sub_80671A0(Entity *);
|
||||
extern void sub_8067110(Entity *);
|
||||
void HandleUseMoveAIAction(Entity *target);
|
||||
void sub_8041888(u8 param_1);
|
||||
void sub_807360C(void);
|
||||
void sub_805EFB4(Entity *, u8);
|
||||
void sub_8074FB0(Entity *, u8, DungeonPos *);
|
||||
|
||||
void HandlePlaceItemAction(Entity *);
|
||||
void HandlePickUpPlayerAction(Entity *);
|
||||
void sub_8066E14(Entity * );
|
||||
void sub_807348C(void);
|
||||
void sub_80732F0(void);
|
||||
void sub_8066BD4(Entity*);
|
||||
void HandleTalkFieldAction(Entity *);
|
||||
void HandleUseMovePlayerAction(Entity *);
|
||||
@@ -73,14 +67,16 @@ bool8 sub_804AE08(DungeonPos *pos);
|
||||
void HandlePickUpAIAction(Entity *pokemon);
|
||||
void HandleThrowItemAIAction(Entity *pokemon);
|
||||
void HandleEatAIAction(Entity *pokemon);
|
||||
u32 sub_8075818(Entity *entity);
|
||||
extern void MarkLastUsedMonMove(Entity *entity, Move *move);
|
||||
bool8 TryUseChosenMove(struct Entity *attacker, u32 r6, s32 itemId, u32 var_30, bool32 isLinkedMove, struct Move *move);
|
||||
u32 sub_8075818(Entity *entity);;
|
||||
|
||||
EWRAM_DATA u8 gUnknown_202F32C = 0;
|
||||
EWRAM_DATA u8 gUnknown_202F32D = 0;
|
||||
|
||||
bool8 sub_8072CF4(Entity *entity)
|
||||
static void HandleSleepTalk(void);
|
||||
static void HandleSnore(void);
|
||||
static void HandleFlashFire(void);
|
||||
|
||||
bool8 ExecuteEntityDungeonAction(Entity *entity)
|
||||
{
|
||||
bool8 bVar4;
|
||||
bool8 bVar5;
|
||||
@@ -92,7 +88,7 @@ bool8 sub_8072CF4(Entity *entity)
|
||||
DungeonPos pos1;
|
||||
|
||||
sub_804178C(1);
|
||||
gUnknown_203B434 = 1;
|
||||
gUnknown_203B434 = TRUE;
|
||||
info = GetEntInfo(entity);
|
||||
info->useHeldItem = FALSE;
|
||||
info->unkF3 = FALSE;
|
||||
@@ -316,10 +312,10 @@ bool8 sub_8072CF4(Entity *entity)
|
||||
LogMessageByIdWithPopupCheckUser(entity,gUnknown_80FD2CC);
|
||||
}
|
||||
}
|
||||
sub_807360C();
|
||||
HandleFlashFire();
|
||||
if (!sub_8044B84()) {
|
||||
sub_807348C();
|
||||
sub_80732F0();
|
||||
HandleSnore();
|
||||
HandleSleepTalk();
|
||||
if (!EntityIsValid(entity)) {
|
||||
return FALSE;
|
||||
}
|
||||
@@ -345,7 +341,7 @@ bool8 sub_8072CF4(Entity *entity)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void sub_80732F0(void)
|
||||
static void HandleSleepTalk(void)
|
||||
{
|
||||
s32 index;
|
||||
Entity *entity;
|
||||
@@ -425,7 +421,7 @@ _increase:
|
||||
}
|
||||
}
|
||||
|
||||
void sub_807348C(void)
|
||||
static void HandleSnore(void)
|
||||
{
|
||||
int index;
|
||||
s32 moveIndex;
|
||||
@@ -478,18 +474,14 @@ void sub_807348C(void)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_807360C(void)
|
||||
static void HandleFlashFire(void)
|
||||
{
|
||||
s32 index;
|
||||
Entity *entity;
|
||||
|
||||
for(index = 0; index < DUNGEON_MAX_POKEMON; index++)
|
||||
{
|
||||
entity = gDungeon->activePokemon[index];
|
||||
if(EntityIsValid(entity))
|
||||
{
|
||||
if(GetEntInfo(entity)->unk152 != 0)
|
||||
{
|
||||
for (index = 0; index < DUNGEON_MAX_POKEMON; index++) {
|
||||
Entity *entity = gDungeon->activePokemon[index];
|
||||
if (EntityIsValid(entity)) {
|
||||
if (GetEntInfo(entity)->unk152 != 0) {
|
||||
GetEntInfo(entity)->unk152 = 0;
|
||||
UpdateFlashFireBoost(entity, entity);
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "dungeon_vram.h"
|
||||
#include "dungeon_main.h"
|
||||
#include "constants/dungeon.h"
|
||||
#include "dungeon_ai_leader.h"
|
||||
#include "dungeon_action_execution.h"
|
||||
#include "dungeon_ai.h"
|
||||
#include "dungeon_range.h"
|
||||
#include "dungeon_misc.h"
|
||||
@@ -109,7 +109,7 @@ static bool8 RunLeaderTurn(bool8 param_1)
|
||||
gDungeon->noActionInProgress = FALSE;
|
||||
if (IsFloorOver())
|
||||
break;
|
||||
sub_8072CF4(entity);
|
||||
ExecuteEntityDungeonAction(entity);
|
||||
sub_8086AC0();
|
||||
TryForcedLoss(0);
|
||||
if (IsFloorOver())
|
||||
@@ -157,7 +157,7 @@ static void sub_8044454(void)
|
||||
if (EntityIsValid(entity)) {
|
||||
EnemyEvolution(entity);
|
||||
RunMonsterAI(entity, 0);
|
||||
sub_8072CF4(entity);
|
||||
ExecuteEntityDungeonAction(entity);
|
||||
sub_8086AC0();
|
||||
TryForcedLoss(0);
|
||||
entityInfo->flags = (entityInfo->flags & ~(MOVEMENT_FLAG_SWAPPING_PLACES_PETRIFIED_ALLY)) | MOVEMENT_FLAG_UNK_14;
|
||||
@@ -182,7 +182,7 @@ void sub_80444F4(Entity *pokemon)
|
||||
if ((EntityIsValid(entity)) && (pokemon != entity) && (entityInfo = GetEntInfo(entity), (entityInfo->flags & MOVEMENT_FLAG_SWAPPING_PLACES_PETRIFIED_ALLY))) {
|
||||
if (IsFloorOver()) break;
|
||||
RunMonsterAI(entity, 0);
|
||||
sub_8072CF4(entity);
|
||||
ExecuteEntityDungeonAction(entity);
|
||||
sub_8086AC0();
|
||||
TryForcedLoss(0);
|
||||
}
|
||||
@@ -233,7 +233,7 @@ static void sub_8044574(void)
|
||||
EnemyEvolution(teamMon);
|
||||
for (j = 0; j < 3; j++) {
|
||||
RunMonsterAI(teamMon, 0);
|
||||
if (IsFloorOver() || !sub_8072CF4(teamMon))
|
||||
if (IsFloorOver() || !ExecuteEntityDungeonAction(teamMon))
|
||||
break;
|
||||
sub_8086AC0();
|
||||
TryForcedLoss(0);
|
||||
@@ -290,7 +290,7 @@ static void sub_8044574(void)
|
||||
info->recalculateFollow = TRUE;
|
||||
info->aiAllySkip = FALSE;
|
||||
RunMonsterAI(entity,1);
|
||||
sub_8072CF4(entity);
|
||||
ExecuteEntityDungeonAction(entity);
|
||||
sub_8086AC0();
|
||||
TryForcedLoss(0);
|
||||
EntityIsValid(entity); // Does nothing
|
||||
@@ -349,7 +349,7 @@ static void sub_8044820(void)
|
||||
EnemyEvolution(entity);
|
||||
RunMonsterAI(entity, 0);
|
||||
if (IsFloorOver()) break;
|
||||
sub_8072CF4(entity);
|
||||
ExecuteEntityDungeonAction(entity);
|
||||
sub_8086AC0();
|
||||
TryForcedLoss(0);
|
||||
if (IsFloorOver()) break;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
static EWRAM_DATA Entity *sLastLogMsgEntity = NULL;
|
||||
static UNUSED EWRAM_DATA u8 sUnused = 0;
|
||||
static EWRAM_DATA SpriteOAM sUnknown_202F1F0 = {0};
|
||||
EWRAM_INIT u8 gUnknown_203B434 = 1;
|
||||
EWRAM_INIT bool8 gUnknown_203B434 = TRUE;
|
||||
|
||||
static bool8 sub_8052DC0(Entity *);
|
||||
static void DisplayMessageAddToLog(Entity *pokemon, const u8 *str, bool8 r2);
|
||||
@@ -45,7 +45,7 @@ void sub_80521D0(void)
|
||||
gDungeon->unk1BDD4.unk1C054[i] = 0;
|
||||
}
|
||||
sLastLogMsgEntity = NULL;
|
||||
gUnknown_203B434 = 1;
|
||||
gUnknown_203B434 = TRUE;
|
||||
sub_8052210(FALSE);
|
||||
}
|
||||
|
||||
@@ -143,11 +143,11 @@ void DisplayDungeonLoggableMessageTrue(Entity *pokemon, const u8 *str)
|
||||
static void DisplayMessageAddToLog(Entity *pokemon, const u8 *str, bool8 r2)
|
||||
{
|
||||
u8 txt[64];
|
||||
u32 r7;
|
||||
bool8 r7;
|
||||
bool32 r8, r9;
|
||||
|
||||
if (sLastLogMsgEntity != pokemon) {
|
||||
r7 = 1;
|
||||
r7 = TRUE;
|
||||
}
|
||||
else {
|
||||
r7 = gUnknown_203B434;
|
||||
@@ -155,7 +155,7 @@ static void DisplayMessageAddToLog(Entity *pokemon, const u8 *str, bool8 r2)
|
||||
|
||||
r8 = 1;
|
||||
sLastLogMsgEntity = pokemon;
|
||||
gUnknown_203B434 = 0;
|
||||
gUnknown_203B434 = FALSE;
|
||||
r9 = FALSE;
|
||||
while (1) {
|
||||
while (1) {
|
||||
|
||||
@@ -51,10 +51,6 @@ extern void sub_80429E8(Entity *r0);
|
||||
extern Entity *sub_804550C(s16 a);
|
||||
extern Entity *sub_80453AC(s16 id);
|
||||
extern void EntityUpdateStatusSprites(Entity *);
|
||||
extern Entity *sub_80696A8(Entity *a0);
|
||||
extern void sub_806A898(Entity *entity, bool8 r7, bool8 showRunAwayEffect);
|
||||
extern void sub_806A6E8(Entity *entity);
|
||||
void sub_806C264(s32 teamIndex, EntityInfo *entInfo);
|
||||
|
||||
static s32 CalcSpeciesHPAtLevel(s32 species, s32 level);
|
||||
static s32 CalcSpeciesAtkAtLevel(s32 species, s32 level, s32 categoryIndex);
|
||||
|
||||
@@ -53,7 +53,7 @@
|
||||
.include "src/dungeon_8067A80.o"
|
||||
.include "src/dungeon_logic.o"
|
||||
.include "src/dungeon_leveling.o"
|
||||
.include "src/dungeon_8072CF4.o"
|
||||
.include "src/dungeon_action_execution.o"
|
||||
.include "src/dungeon_ai_items.o"
|
||||
.include "src/code_8075708.o"
|
||||
.space 4
|
||||
|
||||
Reference in New Issue
Block a user