summaryrefslogtreecommitdiff
path: root/src/code
diff options
context:
space:
mode:
authorDragorn421 <Dragorn421@users.noreply.github.com>2022-10-15 07:40:00 +0200
committerGitHub <noreply@github.com>2022-10-15 01:40:00 -0400
commitd1d946a197e9be2e1f6219f494502d060ffc6e44 (patch)
tree96a0a885abb48a8eac71c6efb5376da94ee99b96 /src/code
parentd624733bf9afc44afb273eac75145de8a7254939 (diff)
`GameInfo` -> `RegEditor` (#1354)
* -> `RegsContext* gRegsContext` * Name regs-related functions * Revert naming `GameState_UpdateRegs` * -> `gRegEditor` * `Regs_InitContext` -> `Regs_Init` * remove mistakenly added file
Diffstat (limited to 'src/code')
-rw-r--r--src/code/game.c2
-rw-r--r--src/code/main.c2
-rw-r--r--src/code/z_construct.c6
-rw-r--r--src/code/z_debug.c81
-rw-r--r--src/code/z_play.c2
5 files changed, 46 insertions, 47 deletions
diff --git a/src/code/game.c b/src/code/game.c
index 1138d815f..663ac65b1 100644
--- a/src/code/game.c
+++ b/src/code/game.c
@@ -84,7 +84,7 @@ void func_800C4344(GameState* gameState) {
}
if (gIsCtrlr2Valid) {
- func_8006390C(&gameState->input[1]);
+ Regs_UpdateEditor(&gameState->input[1]);
}
gDmaMgrVerbose = HREG(60);
diff --git a/src/code/main.c b/src/code/main.c
index c8d78ccca..e32ce6e6a 100644
--- a/src/code/main.c
+++ b/src/code/main.c
@@ -65,7 +65,7 @@ void Main(void* arg) {
}
osSyncPrintf("debug_InitArena(%08x, %08x)\n", debugHeapStart, debugHeapSize);
DebugArena_Init(debugHeapStart, debugHeapSize);
- func_800636C0();
+ Regs_Init();
R_ENABLE_ARENA_DBG = 0;
diff --git a/src/code/z_construct.c b/src/code/z_construct.c
index 9a40a3391..90a31872b 100644
--- a/src/code/z_construct.c
+++ b/src/code/z_construct.c
@@ -191,7 +191,7 @@ void Message_Init(PlayState* play) {
YREG(31) = 0;
}
-void func_80111070(void) {
+void Regs_InitDataImpl(void) {
YREG(8) = 10;
YREG(14) = 0;
R_SCENE_CAM_TYPE = SCENE_CAM_TYPE_DEFAULT;
@@ -602,6 +602,6 @@ void func_80111070(void) {
R_GAME_OVER_RUMBLE_DECREASE_RATE = -63;
}
-void func_80112098(PlayState* play) {
- func_80111070();
+void Regs_InitData(PlayState* play) {
+ Regs_InitDataImpl();
}
diff --git a/src/code/z_debug.c b/src/code/z_debug.c
index f654b0d69..ac4de7bf9 100644
--- a/src/code/z_debug.c
+++ b/src/code/z_debug.c
@@ -12,7 +12,7 @@ typedef struct {
u16 press;
} InputCombo; // size = 0x4
-GameInfo* gGameInfo;
+RegEditor* gRegEditor;
PrintTextBufferEntry sDebugPrintTextBuffer[22];
s16 sDebugPrintTextBufferNumUsed = 0;
@@ -92,18 +92,17 @@ char sRegGroupChars[REG_GROUPS] = {
'b', // bREG
};
-// Initialize GameInfo
-void func_800636C0(void) {
+void Regs_Init(void) {
s32 i;
- gGameInfo = SystemArena_MallocDebug(sizeof(GameInfo), "../z_debug.c", 260);
- gGameInfo->regPage = 0;
- gGameInfo->regGroup = 0;
- gGameInfo->regCur = 0;
- gGameInfo->dPadInputPrev = 0;
- gGameInfo->inputRepeatTimer = 0;
- for (i = 0; i < ARRAY_COUNT(gGameInfo->data); i++) {
- gGameInfo->data[i] = 0;
+ gRegEditor = SystemArena_MallocDebug(sizeof(RegEditor), "../z_debug.c", 260);
+ gRegEditor->regPage = 0;
+ gRegEditor->regGroup = 0;
+ gRegEditor->regCur = 0;
+ gRegEditor->dPadInputPrev = 0;
+ gRegEditor->inputRepeatTimer = 0;
+ for (i = 0; i < ARRAY_COUNT(gRegEditor->data); i++) {
+ gRegEditor->data[i] = 0;
}
}
@@ -154,9 +153,9 @@ void func_80063828(GfxPrint* printer) {
}
// Process inputs to control the reg editor
-void func_8006390C(Input* input) {
+void Regs_UpdateEditor(Input* input) {
s32 dPadInputCur;
- s32 pageDataStart = ((gGameInfo->regGroup * REG_PAGES) + gGameInfo->regPage - 1) * REGS_PER_PAGE;
+ s32 pageDataStart = ((gRegEditor->regGroup * REG_PAGES) + gRegEditor->regPage - 1) * REGS_PER_PAGE;
s32 increment;
s32 i;
@@ -173,16 +172,16 @@ void func_8006390C(Input* input) {
// If a combo corresponding to a reg group was found
if (i < REG_GROUPS) {
- if (i == gGameInfo->regGroup) {
+ if (i == gRegEditor->regGroup) {
// Same reg group as current, advance page index
- gGameInfo->regPage = (gGameInfo->regPage + 1) % (REG_PAGES + 1);
+ gRegEditor->regPage = (gRegEditor->regPage + 1) % (REG_PAGES + 1);
} else {
- gGameInfo->regGroup = i; // Switch current reg group
- gGameInfo->regPage = 0; // Disable reg editor
+ gRegEditor->regGroup = i; // Switch current reg group
+ gRegEditor->regPage = 0; // Disable reg editor
}
}
} else {
- switch (gGameInfo->regPage) {
+ switch (gRegEditor->regPage) {
case 1:
case 2:
case 3:
@@ -190,16 +189,16 @@ void func_8006390C(Input* input) {
case 5:
case 6:
- if (dPadInputCur == gGameInfo->dPadInputPrev) {
- gGameInfo->inputRepeatTimer--;
- if (gGameInfo->inputRepeatTimer < 0) {
- gGameInfo->inputRepeatTimer = 1;
+ if (dPadInputCur == gRegEditor->dPadInputPrev) {
+ gRegEditor->inputRepeatTimer--;
+ if (gRegEditor->inputRepeatTimer < 0) {
+ gRegEditor->inputRepeatTimer = 1;
} else {
- dPadInputCur ^= gGameInfo->dPadInputPrev;
+ dPadInputCur ^= gRegEditor->dPadInputPrev;
}
} else {
- gGameInfo->inputRepeatTimer = 16;
- gGameInfo->dPadInputPrev = dPadInputCur;
+ gRegEditor->inputRepeatTimer = 16;
+ gRegEditor->dPadInputPrev = dPadInputCur;
}
increment =
@@ -213,17 +212,17 @@ void func_8006390C(Input* input) {
: -1)
: 0;
- gGameInfo->data[gGameInfo->regCur + pageDataStart] += increment;
+ gRegEditor->data[gRegEditor->regCur + pageDataStart] += increment;
if (CHECK_BTN_ANY(dPadInputCur, BTN_DUP)) {
- gGameInfo->regCur--;
- if (gGameInfo->regCur < 0) {
- gGameInfo->regCur = REGS_PER_PAGE - 1;
+ gRegEditor->regCur--;
+ if (gRegEditor->regCur < 0) {
+ gRegEditor->regCur = REGS_PER_PAGE - 1;
}
} else if (CHECK_BTN_ANY(dPadInputCur, BTN_DDOWN)) {
- gGameInfo->regCur++;
- if (gGameInfo->regCur >= REGS_PER_PAGE) {
- gGameInfo->regCur = 0;
+ gRegEditor->regCur++;
+ if (gRegEditor->regCur >= REGS_PER_PAGE) {
+ gRegEditor->regCur = 0;
}
}
@@ -241,28 +240,28 @@ void func_8006390C(Input* input) {
}
// Draw the reg editor
-void func_80063C04(GfxPrint* printer) {
+void Regs_DrawEditor(GfxPrint* printer) {
s32 i;
- s32 pageStart = (gGameInfo->regPage - 1) * REGS_PER_PAGE;
- s32 pageDataStart = ((gGameInfo->regGroup * REG_PAGES) + gGameInfo->regPage - 1) * REGS_PER_PAGE;
+ s32 pageStart = (gRegEditor->regPage - 1) * REGS_PER_PAGE;
+ s32 pageDataStart = ((gRegEditor->regGroup * REG_PAGES) + gRegEditor->regPage - 1) * REGS_PER_PAGE;
s32 pad;
char regGroupName[3];
regGroupName[0] = 'R';
- regGroupName[1] = sRegGroupChars[gGameInfo->regGroup];
+ regGroupName[1] = sRegGroupChars[gRegEditor->regGroup];
regGroupName[2] = '\0';
GfxPrint_SetColor(printer, 0, 128, 128, 128);
for (i = 0; i < REGS_PER_PAGE; i++) {
- if (i == gGameInfo->regCur) {
+ if (i == gRegEditor->regCur) {
GfxPrint_SetColor(printer, 0, 255, 255, 255);
}
GfxPrint_SetPos(printer, 3, i + 5);
- GfxPrint_Printf(printer, "%s%02d%6d", regGroupName, pageStart + i, gGameInfo->data[i + pageDataStart]);
+ GfxPrint_Printf(printer, "%s%02d%6d", regGroupName, pageStart + i, gRegEditor->data[i + pageDataStart]);
- if (i == gGameInfo->regCur) {
+ if (i == gRegEditor->regCur) {
GfxPrint_SetColor(printer, 0, 128, 128, 128);
}
}
@@ -286,8 +285,8 @@ void func_80063D7C(GraphicsContext* gfxCtx) {
func_80063828(&printer);
}
- if (gGameInfo->regPage != 0) {
- func_80063C04(&printer);
+ if (gRegEditor->regPage != 0) {
+ Regs_DrawEditor(&printer);
}
sDebugPrintTextBufferNumUsed = 0;
diff --git a/src/code/z_play.c b/src/code/z_play.c
index 4002800d0..7d0fee621 100644
--- a/src/code/z_play.c
+++ b/src/code/z_play.c
@@ -256,7 +256,7 @@ void Play_Init(GameState* thisx) {
this->activeCamId = CAM_ID_MAIN;
func_8005AC48(&this->mainCamera, 0xFF);
Sram_Init(this, &this->sramCtx);
- func_80112098(this);
+ Regs_InitData(this);
Message_Init(this);
GameOver_Init(this);
SfxSource_InitAll(this);