wip: update game_status struct

Non-matching right now, I probably made an alignment/sizing error somewhere - proofreading would be appreciated.
This commit is contained in:
Alex Bates 2020-08-14 05:08:55 +01:00
parent afc0415a2c
commit 78d23805e0
6 changed files with 82 additions and 52 deletions

View File

@ -5,19 +5,33 @@
#include "types.h"
typedef struct {
/* 0x000 */ s16 unk_00;
/* 0x002 */ s16 unk_02;
/* 0x004 */ char unk_04[0x44];
/* 0x000 */ u32 currentButtons;
/* 0x004 */ u32 altCurrentButtons; /* used for battle when flag 80000 set */
/* 0x008 */ char unk_08[4];
/* 0x010 */ u32 pressedButtons; /* 1 for the frame button begins to be held */
/* 0x014 */ u32 altPressedButtons; /* used for battle when flag 80000 set */
/* 0x018 */ char unk_18[4];
/* 0x020 */ u32 heldButtons; /* 1 every 4th frame during hold */
/* 0x024 */ u32 altHeldButtons; /* used for battle when flag 80000 set */
/* 0x028 */ char unk_28[4];
/* 0x030 */ u32 prevButtons; /* from previous frame */
/* 0x034 */ char unk_34[8];
/* 0x040 */ u8 stickX; /* with deadzone */
/* 0x041 */ u8 altStickX; /* used for battle when flag 80000 set */
/* 0x042 */ char unk_42[2];
/* 0x044 */ u8 stickY; /* with deadzone */
/* 0x045 */ u8 altStickY; /* used for battle when flag 80000 set */
/* 0x046 */ char unk_46[2];
/* 0x048 */ u16 unk_48[4];
/* 0x050 */ u16 unk_50[4];
/* 0x058 */ char unk_58[0x10];
/* 0x068 */ u16 demoButtonInput;
/* 0x06A */ s8 demoStickX;
/* 0x06B */ s8 demoStickY;
/* 0x06C */ char unk_6C[0x4];
/* 0x070 */ s8 unk_70;
/* 0x071 */ s8 demoState;
/* 0x072 */ s8 unk_72;
/* 0x06C */ u32* mainScriptID;
/* 0x070 */ u8 isBattle;
/* 0x071 */ u8 demoState; /* 0 = not demo, 1 = map demo, 2 = demo transition */
/* 0x072 */ u8 nextDemoScene;
/* 0x073 */ char unk_73[2];
/* 0x075 */ s8 unk_75;
/* 0x076 */ char unk_76[3];
@ -25,42 +39,58 @@ typedef struct {
/* 0x07A */ s8 musicEnabled;
/* 0x07B */ char unk_7B;
/* 0x07C */ s8 unk_7C;
/* 0x07D */ char unk_7D[4];
/* 0x07D */ char unk_7D;
/* 0x07E */ u8 peachFlags; /* 1 = peach, 2 = transformed, 4 = has umbrella */
/* 0x07F */ u8 peachDisguise; /* 1 = koopatrol, 2 = hammer bros, 3 = clubba */
/* 0x080 */ char unk_80;
/* 0x081 */ s8 unk_81;
/* 0x082 */ s8 unk_82;
/* 0x083 */ s8 unk_83;
/* 0x084 */ char unk_84[2];
/* 0x086 */ s16 unk_86;
/* 0x088 */ s16 unk_88;
/* 0x08A */ s16 unk_8A;
/* 0x086 */ s16 areaID;
/* 0x088 */ s16 prevArea;
/* 0x089 */ char unk_89;
/* 0x08A */ u8 changedArea;
/* 0x08C */ s16 mapID;
/* 0x08E */ char unk_8E[0x1A];
/* 0x08E */ s16 entryID;
/* 0x090 */ char unk_90[3];
/* 0x094 */ f32 exitAngle;
/* 0x098 */ f32 playerPos[3];
/* 0x0A4 */ f32 playerYaw;
/* 0x0A8 */ s8 unk_A8;
/* 0x0A9 */ char unk_A9;
/* 0x0AA */ s8 unk_AA;
/* 0x0AB */ char unk_AB[1];
/* 0x0AC */ s8 unk_AC;
/* 0x0AD */ char unk_AD[0x09];
/* 0x0AC */ u8 loadMenuState;
/* 0x0AD */ u8 menuCounter;
/* 0x0AE */ char unk_AE[0x08];
/* 0x0B6 */ s16 boot_alpha;
/* 0x0B8 */ s16 boot_blue;
/* 0x0BA */ s16 boot_green;
/* 0x0BC */ s16 boot_red;
/* 0x0BE */ char unk_BE[0x76];
/* 0x134 */ u16 unk_134;
/* 0x136 */ char unk_136[0x6];
/* 0x0BE */ char unk_BE[0x6A];
/* 0x128 */ f32 playerTraceNormal[3];
/* 0x134 */ u16 frameCounter;
/* 0x136 */ s32 nextRNG;
/* 0x13A */ char unk_136[0x2];
/* 0x13C */ s16 unk_13C;
/* 0x13E */ char unk_13E[0xA];
/* 0x148 */ s16 unk_148;
/* 0x14A */ s16 unk_14A;
/* 0x14C */ s16 unk_14C;
/* 0x14E */ s16 unk_14E;
/* 0x150 */ s16 unk_150;
/* 0x152 */ char unk_152[2];
/* 0x154 */ s32 unk_154;
/* 0x158 */ s32 unk_158;
/* 0x13E */ char unk_13E[0x2];
/* 0x140 */ UNK_PTR shopItemData;
/* 0x144 */ UNK_PTR mapShop;
/* 0x148 */ s16 backgroundFlags;
/* 0x14A */ s16 backgroundMinW;
/* 0x14C */ s16 backgroundMinH;
/* 0x14E */ s16 backgroundMaxW;
/* 0x150 */ s16 backgroundMaxH;
/* 0x152 */ u16 backgroundXOffset;
/* 0x154 */ UNK_PTR backgroundRaster;
/* 0x158 */ UNK_PTR backgroundPalette;
/* 0x15C */ s16 unk_15C;
/* 0x15E */ char unk_15E[0xA];
/* 0x168 */ s32 unk_168;
/* 0x160 */ s16 savedPos[3];
/* 0x166 */ s8 saveSlot;
/* 0x167 */ u8 loadType; /* 0 = from map, 1 = from main menu */
/* 0x168 */ s32 saveCount;
} game_status;
typedef enum eItemEntityState {

View File

@ -16,7 +16,7 @@ INCLUDE_ASM(code_111f0_len_860, func_80035EEC);
void func_800360FC(void) {
game_status* gameStatus = *gGameStatusPtr;
if (gameStatus->unk_AC == 2) {
if (gameStatus->loadMenuState == 2) {
func_800E973C();
}
}
@ -28,11 +28,11 @@ void func_80036130(void) {
D_800A0942 = 0x14;
D_800A0944 = 0x00;
if (gameStatus->unk_88 != gameStatus->unk_86) {
gameStatus->unk_8A = 0x01;
gameStatus->unk_88 = gameStatus->unk_86;
if (gameStatus->prevArea != gameStatus->areaID) {
gameStatus->changedArea = 1;
gameStatus->prevArea = gameStatus->areaID;
} else {
gameStatus->unk_8A = 0;
gameStatus->changedArea = 0;
}
}

View File

@ -35,7 +35,7 @@ s32 func_8002ACDC(void) {
}
s32 heap_malloc(s32 size) {
if ((*gGameStatusPtr)->unk_70 == 0) {
if ((*gGameStatusPtr)->isBattle == 0) {
return general_heap_malloc(size);
} else {
return _heap_malloc(&D_803DA800, size);
@ -43,7 +43,7 @@ s32 heap_malloc(s32 size) {
}
s32 heap_free(s32 size) {
if ((*gGameStatusPtr)->unk_70 != 0) {
if ((*gGameStatusPtr)->isBattle != 0) {
return _heap_free(&D_803DA800, size);
} else {
return general_heap_free(size);

View File

@ -283,7 +283,7 @@ void coin_counter_draw_content(UNK_TYPE arg0, s32 posX, s32 posY) {
ui_status* uiStatus = &gUIStatus;
s32 iconIndex;
if ((gPlayerData.coins != uiStatus->displayCoins) && (((*gGameStatusPtr)->unk_134 % 3) == 0)) {
if ((gPlayerData.coins != uiStatus->displayCoins) && (((*gGameStatusPtr)->frameCounter % 3) == 0)) {
play_sound(0x211);
}
@ -521,7 +521,7 @@ void status_menu_start_blinking_hp(void) {
ui_status* uiStatus = &gUIStatus;
ui_status* uiStatus2 = &gUIStatus;
if (gameStatus->unk_70 == 0) {
if (gameStatus->isBattle == 0) {
uiStatus->hpBlinkTimer = 120;
}
@ -546,7 +546,7 @@ void status_menu_start_blinking_fp(void) {
ui_status* uiStatus = &gUIStatus;
ui_status* uiStatus2 = &gUIStatus;
if (gameStatus->unk_70 == 0) {
if (gameStatus->isBattle == 0) {
uiStatus->fpBlinkTimer = 120;
}
@ -570,7 +570,7 @@ void status_menu_start_blinking_coins(void) {
ui_status* uiStatus = &gUIStatus;
ui_status* uiStatus2 = &gUIStatus;
if (gameStatus->unk_70 == 0) {
if (gameStatus->isBattle == 0) {
uiStatus->coinsBlinkTimer = 120;
}

View File

@ -9,7 +9,7 @@ INCLUDE_ASM(code_dbd70_len_700, clear_trigger_data);
//INCLUDE_ASM(code_dbd70_len_700, init_trigger_list);
void init_trigger_list(void) {
if ((*gGameStatusPtr)->unk_70 == 0) {
if ((*gGameStatusPtr)->isBattle == 0) {
*gCurrentTriggerListPtr = gTriggerList1;
} else {
*gCurrentTriggerListPtr = gTriggerList2;

View File

@ -27,29 +27,29 @@ void func_80145DF8(void) {
D_8014F12F = 0;
gameStatus->unk_15C = 0xB4;
gameStatus->unk_148 &= 0xF0;
gameStatus->backgroundFlags &= 0xF0;
}
void read_background_size(bg_header *bg) {
game_status* gameStatus = *gGameStatusPtr;
gameStatus->unk_14E = bg->width;
gameStatus->unk_150 = bg->height;
gameStatus->unk_14A = bg->startX;
gameStatus->unk_14C = bg->startY;
gameStatus->unk_154 = bg->palette;
gameStatus->unk_158 = bg->raster;
gameStatus->unk_148 |= 1;
gameStatus->backgroundMaxW = bg->width;
gameStatus->backgroundMaxH = bg->height;
gameStatus->backgroundMinW = bg->startX;
gameStatus->backgroundMinH = bg->startY;
gameStatus->backgroundPalette = bg->palette;
gameStatus->backgroundRaster = bg->raster;
gameStatus->backgroundFlags |= 1;
}
void set_background_size(s16 startX, s16 startY, s16 sizeX, s16 sizeY) {
game_status* gameStatus = *gGameStatusPtr;
gameStatus->unk_148 &= ~1;
gameStatus->unk_14E = startX;
gameStatus->unk_150 = startY;
gameStatus->unk_14A = sizeX;
gameStatus->unk_14C = sizeY;
gameStatus->backgroundFlags &= ~1;
gameStatus->backgroundMinW = startX;
gameStatus->backgroundMinH = startY;
gameStatus->backgroundMaxW = sizeX;
gameStatus->backgroundMaxH = sizeY;
}
u16 func_80145E98(s32 arg0, s32 arg1, s32 arg2) {