more cleanup and move more ram stuff

This commit is contained in:
Seth Barberee 2024-05-27 08:37:58 -07:00
parent 55f516ec5e
commit b2a0fe8422
23 changed files with 61 additions and 98 deletions

View File

@ -4,5 +4,7 @@
#include "structs/dungeon_entity.h"
bool8 HasHeldItem(Entity *pokemon, u8 id);
void sub_8046CE4(Item *item, s32 param_2);
void sub_8046D20(void);
#endif

View File

@ -10,5 +10,6 @@ typedef struct unkStruct_202F190
Tile *GetTile(s32 x, s32 y);
Tile *GetTileSafe(s32 x, s32 y);
void sub_804AC20(Position *pos);
#endif

View File

@ -16,5 +16,8 @@ Trap* GetTrapData_1(Entity *entity);
Item *GetItemData(Entity *entity);
struct Tile *GetTileAtEntitySafe(Entity *entity);
Item *GetItemData_1(Entity *entity);
void sub_804535C(Entity *entity, Position32 *pos);
void SetEntityPixelPos(Entity *entity, s32 x, s32 y);
void IncreaseEntityPixelPos(Entity *entity, s32 x, s32 y);
#endif

View File

@ -3,9 +3,13 @@
#include "structs/dungeon_entity.h"
typedef void (*DungeonCallback)(Entity *);
Entity *xxx_call_GetLeader(void);
Entity *GetPartnerEntity(void);
void sub_80854D4(void);
void sub_80855E4(DungeonCallback func);
void sub_808563C(DungeonCallback func);
Entity *GetEntityFromClientType(u8 entityType);
void sub_80856C8(Entity * pokemon, s32 x, s32 y);
void sub_80856E0(Entity * pokemon, s32 direction);

View File

@ -221,7 +221,7 @@ SECTIONS {
src/code_8048480.o(.text);
src/dungeon_ai_item_weight.o(.text);
src/dungeon_map_access.o(.text);
asm/code_80495E4.o(.text);
asm/dungeon_map_access.o(.text);
src/dungeon_map_access_1.o(.text);
src/tile_types.o(.text);
asm/code_804AFAC.o(.text);

View File

@ -111,4 +111,4 @@ void sub_800CD64(s32 r0, bool8 r1)
void SetBGOBJEnableFlags(u32 mask)
{
REG_DISPCNT = (REG_DISPCNT & 0xE0FF) | (~(mask << 8) & (DISPCNT_BG_ALL_ON | DISPCNT_OBJ_ON));
}
}

View File

@ -32,10 +32,11 @@ extern struct UnkBgStruct *gUnknown_203B0E4;
extern const u16 gUnknown_80D4144[8];
EWRAM_DATA u32 gUnknown_202DE1C;
EWRAM_DATA s16 gUnknown_202DE20;
EWRAM_DATA s16 gUnknown_202DE22;
EWRAM_DATA s16 gUnknown_202DE24;
EWRAM_DATA u32 gUnknown_202DE1C = {0};
EWRAM_DATA s16 gUnknown_202DE20 = {0};
EWRAM_DATA s16 gUnknown_202DE22 = {0};
EWRAM_DATA s16 gUnknown_202DE24 = {0};
void nullsub_8(u32);
extern void xxx_call_update_bg_vram(void);
@ -238,4 +239,4 @@ void sub_8011A04(void)
UNUSED static void sub_8011A2C(u32 a0)
{
gUnknown_202DE1C = a0;
}
}

View File

@ -1,6 +1,7 @@
#include "global.h"
#include "code_8045A00.h"
#include "constants/item.h"
#include "dungeon_items.h"
#include "dungeon_map_access.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
@ -15,9 +16,7 @@ extern struct unkStruct_8090F58 gUnknown_80F699C;
extern struct unkStruct_8090F58 gUnknown_80F69A8;
extern struct unkStruct_8090F58 gUnknown_80F6990;
extern bool8 IsNotSpecialItem(u8 id);
void sub_8045BF8(u8 *, Item *);
void sub_8046CE4(void *param_1,u32 param_2);
extern u32 sub_803D73C(u32);
void sub_80460F8(Position *, Item *, u32);

View File

@ -6,6 +6,7 @@
#include "constants/direction.h"
#include "constants/friend_area.h"
#include "constants/weather.h"
#include "dungeon_items.h"
#include "dungeon_leader.h"
#include "dungeon_map_access.h"
#include "dungeon_music.h"
@ -317,14 +318,10 @@ extern bool8 sub_800E9A8(s32);
extern void sub_800DC14(u32);
extern void sub_8086A3C(Entity *r0);
extern void sub_80854D4(void);
extern void sub_80855E4(void *);
extern void sub_8068FE0(Entity *, u32, u32);
extern void sub_803E708(u32, u32);
extern void sub_8086448(void);
extern void PlaySoundEffect(u32);
extern void IncreaseEntityPixelPos(Entity *, u32, u32);
extern void sub_8042B0C(Entity *);
extern void sub_803E708(u32, u32);
extern u8 sub_806FD18(Entity *);
@ -338,13 +335,12 @@ extern void SetupBossFightHP(Entity *, u32, u32);
extern void sub_803E9D0(void);
extern void DeoxysScreenFlash(void);
extern void sub_8085EB0();
extern void sub_808563C(void *);
void SetupDeoxysFightHP(Entity *r0);
void sub_808C550(void);
void sub_808C590(Entity *r0);
void SetupDeoxysFacingDirection(Entity *r0);
void sub_808C9B0();
void sub_808C9B0(Entity *);
void sub_808C8E0(Entity *param_1);
void sub_808C360(void);
void KyogreScreenFlash();
@ -352,7 +348,6 @@ void KyogreScreenFlash();
void sub_808C0CC();
void LugiaScreenFlash();
void LugiaScreenFlash2();
extern void sub_80861B8(Entity *, u32, u32);
void nullsub_99();
@ -364,10 +359,7 @@ extern void sub_8086A54(Entity *);
extern void sub_806BFC0(EntityInfo *, u32);
extern Entity *xxx_call_GetLeader(void);
extern void sub_808BBA8(Entity * );
extern void sub_80855E4(void *);
extern void sub_8041888(u32);
extern void sub_80861B8(Entity *, u32, u32);
extern void sub_803E708(u32, u32);
@ -387,7 +379,6 @@ extern u8 sub_80860A8(u32);
extern void sub_8049ED4();
extern void sub_8052D44(s16 *, Entity *, Entity *);
extern void sub_80421C0(Entity *, u32);
extern void sub_8046D20();
extern void sub_808B1CC(u8);
extern void sub_80464C8(Entity *, u32 *, Item *);
extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32);
@ -421,13 +412,11 @@ void sub_80891F0(void);
void sub_8089294(void);
void GroudonScreenFlash2(void);
extern u8 sub_8086AE4(u32);
extern u8 sub_8086AE4(s16);
extern void sub_8072008(Entity *, Entity *, s16, u32, u32);
extern void sub_8085374();
extern void sub_80856C8(Entity *, s32, s32);
extern void sub_8086A54(Entity *);
extern void sub_803F878(u32,s32);
@ -449,7 +438,7 @@ void ZapdosDropInEffect(Entity *param_1);
void ZapdosScreenFlash(int param_1);
extern s32 sub_8052C68(u32, const u8 *, const u8 *, u32);
extern void sub_80861A8(void);
extern void sub_80861A8(Entity *);
extern void sub_8045C28(Item *, u8 , u8 *);
extern void EnableJirachiWishWarpTile(void);
extern void sub_808BB3C(Position *);

View File

@ -5,6 +5,7 @@
#include "constants/status.h"
#include "constants/type.h"
#include "constants/weather.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
@ -41,7 +42,6 @@ extern bool8 sub_8045888(Entity *);
extern void sub_806A2BC(Entity *, u8);
extern void sub_804178C(u32);
extern void sub_803F508(Entity *);
extern void sub_804AC20(Position *);
extern void sub_803E46C(u32);
extern void sub_803E708(u32 r0, u32 r1);

View File

@ -6,6 +6,7 @@
#include "constants/type.h"
#include "dungeon_ai.h"
#include "dungeon_leader.h"
#include "dungeon_map_access.h"
#include "dungeon_pokemon_attributes.h"
#include "dungeon_util.h"
#include "move_util.h"
@ -22,8 +23,6 @@ extern void nullsub_93(Position *);
extern void sub_80522F4(Entity *, Entity *, u8 *);
extern void sub_806F370(Entity *pokemon, Entity *target, u32, u32, u8 *, u8 moveType, s32, u32, u32, u32);
extern void sub_80694C0(Entity *, s32, s32, u32);
extern void sub_804535C(Entity *, u32);
extern void sub_804AC20(Position *);
extern void sub_807EC28(bool8);
extern void sub_806A5B8(Entity *);
@ -95,8 +94,8 @@ void sub_807E254(Entity *pokemon,Entity *target)
nullsub_93(&targetPos);
sub_80694C0(pokemon,targetPos.x,targetPos.y,1);
sub_80694C0(target,pokemonPos.x,pokemonPos.y,1);
sub_804535C(pokemon,0x0);
sub_804535C(target,0x0);
sub_804535C(pokemon,NULL);
sub_804535C(target,NULL);
if (EntityExists(pokemon)) {
if (pokemon->info->isTeamLeader) {

View File

@ -3,6 +3,7 @@
#include "code_80869E4.h"
#include "constants/direction.h"
#include "structs/str_dungeon.h"
#include "dungeon_util.h"
#include "dungeon_util_1.h"
#include "random.h"
@ -27,12 +28,9 @@ extern void DisplayDungeonDialogue(const u8 *);
extern void sub_8085EB0(void);
extern void sub_803E748(void);
extern void sub_80855E4(void *);
extern s32 GetCameraXPos(void);
extern s32 GetCameraYPos(void);
extern void sub_803F878(u32, u32);
extern void IncreaseEntityPixelPos(Entity *, u32, u32);
extern void sub_804535C(Entity *, Position32 *);
extern void sub_8086A54(Entity *);
extern void sub_8086A3C(Entity *);
extern void PlaySoundEffect(u32);
@ -544,4 +542,4 @@ void sub_80869E4(Entity *a0, s32 a1, u8 a2, s8 a3)
"\tpop {r0}\n"
"\tbx r0");
}
#endif // NONMATCHING
#endif // NONMATCHING

View File

@ -17,14 +17,12 @@
extern u8 sub_8044B28(void);
extern u8 gUnknown_202E038[];
extern void sub_8085374();
extern void sub_80855E4(void *);
extern void sub_8068FE0(Entity *, u32, u32);
extern void DisplayDungeonDialogue(const u8 *);
extern void sub_803E708(u32, u32);
extern void sub_8086448(void);
extern void SkarmoryEntry(Entity *);
extern void sub_8086A54(Entity *);
extern void sub_808563C(void *);
extern void sub_8087144();
extern void sub_8072008(Entity *pokemon, Entity *r1, u32 r2, u8 r3, u32);
extern bool8 sub_8085B80(u8 *);

View File

@ -48,10 +48,10 @@ extern const u8 *const gUnknown_80FC718[];
extern u8 gUnknown_202DE58[];
extern u8 gAvailablePokemonNames[];
extern bool8 gCanAttackInDirection[NUM_DIRECTIONS];
extern s32 gPotentialAttackTargetWeights[NUM_DIRECTIONS];
extern u8 gPotentialAttackTargetDirections[NUM_DIRECTIONS];
extern Entity *gPotentialTargets[NUM_DIRECTIONS];
EWRAM_DATA bool8 gCanAttackInDirection[NUM_DIRECTIONS] = {0};
EWRAM_DATA u8 gPotentialAttackTargetDirections[NUM_DIRECTIONS] = {0};
EWRAM_DATA s32 gPotentialAttackTargetWeights[NUM_DIRECTIONS] = {0};
EWRAM_DATA Entity *gPotentialTargets[NUM_DIRECTIONS] = {0};
extern void sub_8055A00(Entity *, u8, u32, u32, u32);
extern void sub_806A9B4(Entity *, u8);

View File

@ -79,7 +79,6 @@ void HandlePickUpAIAction(Entity *pokemon);
void HandleThrowItemAIAction(Entity *pokemon);
void HandleEatAIAction(Entity *pokemon);
bool8 sub_8044B84(void);
void sub_8046D20(void);
extern void sub_8074094(Entity *);
extern void sub_8071DA4(Entity *);
extern void sub_807D148(Entity *pokemon, Entity *r1, u32 r2, Position *r3);

View File

@ -18,7 +18,6 @@ extern u8 *gUnknown_8105360[];
extern u8 *gUnknown_81053A8[];
extern u8 *gUnknown_8105434[];
extern u8 sub_8046D70(void);
extern s32 sub_8052B8C(u32, u8 *, u32);
extern void sub_80861A8(void);
extern void PrintFieldMessage(u32, u8 *, u32);
@ -30,7 +29,8 @@ extern void PlaySoundEffect(u32);
extern void sub_804178C(u32);
extern void sub_8040A84(void);
void MusicBoxCreation(void);
static void MusicBoxCreation(void);
static u8 sub_8046D70(void);
bool8 HasHeldItem(Entity *pokemon, u8 id)
{
@ -51,7 +51,7 @@ bool8 HasHeldItem(Entity *pokemon, u8 id)
return TRUE;
}
void sub_8046CE4(u8 *param_1,s32 param_2)
void sub_8046CE4(Item *item,s32 param_2)
{
s32 iVar1;
s32 iVar2;
@ -60,12 +60,12 @@ void sub_8046CE4(u8 *param_1,s32 param_2)
for(iVar2 = 0; iVar2 < 200; iVar2++)
{
if (gUnknown_810A3F0[iVar1] <= param_2) {
param_1[1] = iVar1;
item->quantity = iVar1;
return;
}
iVar1 = iVar1 / 2;
}
param_1[1] = 1;
item->quantity = 1;
}
void sub_8046D20(void)

View File

@ -20,13 +20,11 @@ extern u8 gUnknown_80F6A40[];
extern u8 gUnknown_8108EC0[];
extern const struct FileArchive gDungeonFileArchive;
// ewram
EWRAM_DATA OpenedFile *gDungeonPaletteFile = {0};
EWRAM_DATA unkStruct_202EE8C gUnknown_202EE8C[32] = {0};
EWRAM_DATA OpenedFile *gUnknown_202F18C = {0};
EWRAM_DATA unkStruct_202F190 gUnknown_202F190 = {0};
// ewram2
EWRAM_DATA_2 unkStruct_202F190 *gUnknown_203B430 = {0};
extern u8 sub_8043CE4(u32);

View File

@ -11,7 +11,6 @@
extern const u8 gUnknown_8107358[25];
extern void sub_804535C(Entity *, u32);
extern s32 GetCameraXPos(void);
extern s32 GetCameraYPos(void);
extern void sub_803F4A0(u32);
@ -24,7 +23,6 @@ extern void sub_80457DC(Entity *);
extern void sub_80861D4(Entity *, u32, s32 direction);
extern void sub_80694C0(Entity *, s32, s32, u32);
typedef void (*DungeonCallback)(Entity *);
Entity *xxx_call_GetLeader(void)
{
@ -167,7 +165,7 @@ Entity *GetEntityFromClientType(u8 entityType)
void sub_80856C8(Entity * pokemon, s32 x, s32 y)
{
sub_80694C0(pokemon, x, y, 1);
sub_804535C(pokemon,0);
sub_804535C(pokemon,NULL);
}
void sub_80856E0(Entity * pokemon, s32 direction)

View File

@ -187,19 +187,15 @@ extern u8 gUnknown_202F218;
extern u32 gUnknown_202F21C;
extern bool8 gUnknown_202F220;
extern void sub_804535C(Entity *, u32);
extern void sub_804AC20(Position *);
extern void sub_806A5B8(Entity *entity);
extern void sub_80694C0(Entity *, s32, s32, u32);
void sub_8075900(Entity *pokemon, u8 r1);
extern void sub_80943A0(void*, s32);
extern u8 sub_8044B28(void);
extern u8 sub_803F428(Position *pos);
extern void IncreaseEntityPixelPos(Entity *, u32, u32);
extern void sub_803E46C(u32);
extern void sub_807EC28(bool8);
extern void sub_806F370(Entity *r0, Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32);
extern void SetEntityPixelPos(Entity *, s32, s32);
extern void sub_804652C(Entity *, Entity *, Item *, u32, Position *);
extern void sub_806EAF4(Entity *, Entity *, u8, u32, u32, s32 *, u32, u16, u32);
extern void sub_8045C28(Item *, u8 , u8);
@ -3070,7 +3066,7 @@ _0805AA5E:
#else
Position *pos;
#endif
sub_804535C(target, 0);
sub_804535C(target, NULL);
pos = r9;
if (sub_80706A4(target, pos)) {
sub_807D148(pokemon,target,0,0);

View File

@ -6,21 +6,21 @@
#include "reg_control.h"
#include "sprite.h"
extern unkStruct_202D648 gUnknown_202D608[8];
extern unkStruct_202D648 gUnknown_202D648[8];
EWRAM_DATA unkStruct_202D648 gUnknown_202D608[8] = {0};
EWRAM_DATA unkStruct_202D648 gUnknown_202D648[8] = {0};
EWRAM_DATA bool8 gUnknown_203B099;
EWRAM_DATA bool8 gUnknown_203B09A;
EWRAM_DATA bool8 gUnknown_203B09B;
EWRAM_DATA u32 gUnknown_203B09C;
EWRAM_DATA u32 gUnknown_203B0A0;
EWRAM_DATA u32 gUnknown_203B0A4; // Written to but never read
EWRAM_DATA s16 gUnknown_203B0A8;
EWRAM_DATA s16 gUnknown_203B0AA;
EWRAM_DATA s16 gUnknown_203B0AC;
EWRAM_DATA s16 gUnknown_203B0AE;
EWRAM_DATA s16 gUnknown_203B0B0; // Written to but never read
EWRAM_DATA s16 gUnknown_203B0B2; // Written to but never read
EWRAM_DATA_2 bool8 gUnknown_203B099 = {0};
EWRAM_DATA_2 bool8 gUnknown_203B09A = {0};
EWRAM_DATA_2 bool8 gUnknown_203B09B = {0};
EWRAM_DATA_2 u32 gUnknown_203B09C = {0};
EWRAM_DATA_2 u32 gUnknown_203B0A0 = {0};
EWRAM_DATA_2 u32 gUnknown_203B0A4 = {0}; // Written to but never read
EWRAM_DATA_2 s16 gUnknown_203B0A8 = {0};
EWRAM_DATA_2 s16 gUnknown_203B0AA = {0};
EWRAM_DATA_2 s16 gUnknown_203B0AC = {0};
EWRAM_DATA_2 s16 gUnknown_203B0AE = {0};
EWRAM_DATA_2 s16 gUnknown_203B0B0 = {0}; // Written to but never read
EWRAM_DATA_2 s16 gUnknown_203B0B2 = {0}; // Written to but never read
static void UpdateBGControlRegisters(void);

View File

@ -12,6 +12,8 @@
#include "random.h"
#include "save.h"
EWRAM_DATA s32 gUnknown_202DE28 = {0};
EWRAM_DATA_2 u32 gUnknown_203B17C = {0};
EWRAM_DATA_2 char *gUnknown_203B180 = {0};
EWRAM_DATA_2 struct UnkStruct_203B184 *gUnknown_203B184 = {0};
@ -28,10 +30,6 @@ struct unk_struct
u32 padding[503];
};
extern s32 gUnknown_202DE28;
extern u32 *gUnknown_203B488;
ALIGNED(4) static const char debug_fill8[] = "pksdir0";
ALIGNED(4) const char sGameInternalVersion[] = _("POKE_DUNGEON__05");
@ -39,7 +37,6 @@ ALIGNED(4) static const char fill_save0[] = _("pksdir0");
ALIGNED(4) static const char fill_save1[] = _("pksdir0");
ALIGNED(4) static const char fill_save2[] = _("pksdir0");
extern bool8 sub_800DAB0(u16, u8*, s32);
extern bool8 sub_800DAB4(u16, u8*, s32);
extern bool8 sub_800DAB8(void);

View File

@ -122,12 +122,7 @@ gUnknown_202D2A0: /* 202D2A0 (sub_8009A1C - sub_8009BE4) */
.include "src/file_system.o"
.include "src/decompress.o"
.include "src/main.o"
gUnknown_202D608: /* 202D608 (sub_800B720 - VBlankIntr) */
.space 0x40
gUnknown_202D648: /* 202D648 (VBlankIntr - VCountIntr) */
.space 0x40
.include "src/reg_control.o"
.include "src/music.o"
.space 0x3
@ -182,17 +177,10 @@ gUnknown_202DE18: /* 202DE18 (sub_800F990 - sub_8010014) */
gUnknown_202DE19: /* 202DE19 (sub_800F990 - sub_8010014) */
.space 0x3
gUnknown_202DE1C: /* 202DE1C (sub_801180C - sub_8011A2C) */
.space 0x4
gUnknown_202DE20: /* 202DE20 (sub_801180C - PlayMenuSoundEffect) */
.space 0x2
gUnknown_202DE22: /* 202DE22 (sub_801180C - sub_8011A04) */
.space 0x2
gUnknown_202DE24: /* 202DE24 (sub_801180C - sub_8011860) */
.space 0x4
.include "src/code_80118A4.o"
.space 0x2
gUnknown_202DE28: /* 202DE28 (sub_8011C34 - sub_8011C40) */
.space 0x4
.include "src/save.o"
.align 4
/* gUnknown_202DE30[0] seems to be the s32 value to insert in place of "$d0" (ARG_VALUE_0) in strings */
@ -516,14 +504,7 @@ gUnknown_202F32D: /* 202F32D (sub_8072CF4 - UseAttack) */
gUnknown_202F378: /* 202F378 (sub_8074FB0 - UseAttack) */
.space 0x8
gCanAttackInDirection: /* 202F380 (AIConsiderMove - TryAddTargetToAITargetList) */
.space 0x8
gPotentialAttackTargetDirections: /* 202F388 (AIConsiderMove - TryAddTargetToAITargetList) */
.space 0x8
gPotentialAttackTargetWeights: /* 202F390 (AIConsiderMove - TryAddTargetToAITargetList) */
.space 0x20
gPotentialTargets: /* 202F3B0 (AIConsiderMove - TryAddTargetToAITargetList) */
.space 0x20
.include "src/dungeon_ai_attack.o"
gUnknown_202F3D0: /* 202F3D0 (sub_80867F4 - sub_8086854) */
.space 0x8