1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-25 09:45:02 +00:00

Document debug text drawing functions in z_debug.c (#1472)

* name functions and clean up some stuff

* clean up function call args and use enum, format

* slightly change comment

* review

* make things more debug cam oriented

* rename buffer

* regs update comment

* move enum
This commit is contained in:
fig02 2022-12-29 20:23:09 -05:00 committed by GitHub
parent 1f76649b04
commit 04641a6b69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 234 additions and 184 deletions

View file

@ -761,10 +761,10 @@ u8 CollisionCheck_GetSwordDamage(s32 dmgFlags);
void SaveContext_Init(void);
s32 func_800635D0(s32);
void Regs_Init(void);
void func_8006375C(s32 arg0, s32 arg1, const char* text);
void func_8006376C(u8 x, u8 y, u8 colorIndex, const char* text);
void DbCamera_ScreenText(u8 x, u8 y, const char* text);
void DbCamera_ScreenTextColored(u8 x, u8 y, u8 colorIndex, const char* text);
void Regs_UpdateEditor(Input* input);
void func_80063D7C(GraphicsContext* gfxCtx);
void Debug_DrawText(GraphicsContext* gfxCtx);
void DebugDisplay_Init(void);
DebugDispObject* DebugDisplay_AddObject(f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, f32 scaleX,
f32 scaleY, f32 scaleZ, u8 red, u8 green, u8 blue, u8 alpha, s16 type,

View file

@ -1675,4 +1675,15 @@ typedef struct {
/* 0x2C */ f32 fov;
} DbCameraAnim; // size = 0x30
typedef enum {
/* 0 */ DBCAMERA_TEXT_YELLOW,
/* 1 */ DBCAMERA_TEXT_PEACH,
/* 2 */ DBCAMERA_TEXT_BROWN,
/* 3 */ DBCAMERA_TEXT_ORANGE,
/* 4 */ DBCAMERA_TEXT_GOLD,
/* 5 */ DBCAMERA_TEXT_WHITE,
/* 6 */ DBCAMERA_TEXT_BLUE,
/* 7 */ DBCAMERA_TEXT_GREEN
} DbCameraTextColor;
#endif

View file

@ -364,9 +364,9 @@ void func_800B44E0(DbCamera* dbCamera, Camera* cam) {
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
sDbCamAnim.unk_0A = 0;
}
func_8006376C(0x11, 0x17, 3, D_8012CEE0[0]);
func_8006376C(0x12, 0x18, 3, D_8012CEE4);
func_8006376C(0x10, 0x1A, 1, D_8012CEE8);
DbCamera_ScreenTextColored(17, 23, DBCAMERA_TEXT_ORANGE, D_8012CEE0[0]);
DbCamera_ScreenTextColored(18, 24, DBCAMERA_TEXT_ORANGE, D_8012CEE4);
DbCamera_ScreenTextColored(16, 26, DBCAMERA_TEXT_PEACH, D_8012CEE8);
return;
}
@ -381,7 +381,7 @@ void func_800B44E0(DbCamera* dbCamera, Camera* cam) {
if (dbCamera->sub.nFrames > 0 && dbCamera->sub.nFrames < sDbCamAnim.unk_04) {
sDbCamAnim.unk_0A = 0;
func_8006376C(0xF, 0x1A, 1, D_8012CEEC);
DbCamera_ScreenTextColored(15, 26, DBCAMERA_TEXT_PEACH, D_8012CEEC);
}
if (dbCamera->sub.mode != 1) {
@ -397,18 +397,18 @@ void func_800B44E0(DbCamera* dbCamera, Camera* cam) {
dbCamera->rollDegrees = sDbCamAnim.roll * (360.0f / 256.0f);
DbCamera_SetTextValue(sDbCamAnim.unk_04, &D_8012CFB4[8], 4);
func_8006376C(0x10, 0x17, 3, D_8012CFB4);
DbCamera_ScreenTextColored(16, 23, DBCAMERA_TEXT_ORANGE, D_8012CFB4);
D_8012CFC4[5] = ((sDbCamAnim.keyframe + 1) / 10) + '0';
D_8012CFC4[6] = ((sDbCamAnim.keyframe + 1) % 10) + '0';
D_8012CFC4[8] = ((dbCamera->sub.nPoints - 5) / 10) + '0';
D_8012CFC4[9] = ((dbCamera->sub.nPoints - 5) % 10) + '0';
func_8006376C(0x10, 0x18, 3, D_8012CFC4);
func_8006376C(0x10, 0x1A, 1, D_8012CEF0);
DbCamera_ScreenTextColored(16, 24, DBCAMERA_TEXT_ORANGE, D_8012CFC4);
DbCamera_ScreenTextColored(16, 26, DBCAMERA_TEXT_PEACH, D_8012CEF0);
return;
}
sDbCamAnim.unk_0A = 0;
func_8006376C(0xF, 0x1A, 1, D_8012CEEC);
DbCamera_ScreenTextColored(15, 26, DBCAMERA_TEXT_PEACH, D_8012CEEC);
}
void DbCamera_PrintPoints(const char* name, s16 count, CutsceneCameraPoint* points) {
@ -989,7 +989,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
if (dbCamera->unk_00 == 1) {
OREG(0) = 8;
func_8006376C(0xC, 5, 0, D_8012CEF4);
DbCamera_ScreenTextColored(12, 5, DBCAMERA_TEXT_YELLOW, D_8012CEF4);
if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_CRIGHT) &&
!CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_L)) {
func_800B44E0(dbCamera, cam);
@ -1075,21 +1075,24 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
}
}
func_8006376C(0xA, 6, (dbCamera->sub.unk_08 == 0) ? 7 : 4, D_8012D00C);
func_8006376C(0x11, 6, (dbCamera->sub.unk_08 == 1) ? 7 : 4, D_8012D020);
func_8006376C(0x17, 6, (dbCamera->sub.unk_08 == 2) ? 7 : 4, D_8012D034);
DbCamera_ScreenTextColored(10, 6, (dbCamera->sub.unk_08 == 0) ? DBCAMERA_TEXT_GREEN : DBCAMERA_TEXT_GOLD,
D_8012D00C);
DbCamera_ScreenTextColored(17, 6, (dbCamera->sub.unk_08 == 1) ? DBCAMERA_TEXT_GREEN : DBCAMERA_TEXT_GOLD,
D_8012D020);
DbCamera_ScreenTextColored(23, 6, (dbCamera->sub.unk_08 == 2) ? DBCAMERA_TEXT_GREEN : DBCAMERA_TEXT_GOLD,
D_8012D034);
if (dbCamera->sub.unkIdx == 0x80) {
func_8006376C(0x10, 0x1A, 1, D_8012CEF8[0]);
DbCamera_ScreenTextColored(16, 26, DBCAMERA_TEXT_PEACH, D_8012CEF8[0]);
} else if (dbCamera->sub.unkIdx == (dbCamera->sub.nPoints - 1)) {
D_8012CEE0[7][10] = (dbCamera->sub.nPoints / 10) + '0';
D_8012CEE0[7][11] = (dbCamera->sub.nPoints % 10) + '0';
func_8006376C(0xF, 0x1A, 1, D_8012CEE0[7]);
DbCamera_ScreenTextColored(15, 26, DBCAMERA_TEXT_PEACH, D_8012CEE0[7]);
} else {
D_8012CEE0[8][10] = ((dbCamera->sub.unkIdx + 1) / 10) + '0';
D_8012CEE0[8][11] = ((dbCamera->sub.unkIdx + 1) % 10) + '0';
D_8012CEE0[8][13] = ((dbCamera->sub.nPoints - 1) / 10) + '0';
D_8012CEE0[8][14] = ((dbCamera->sub.nPoints - 1) % 10) + '0';
func_8006376C(0xF, 0x1A, 1, D_8012CEE0[8]);
DbCamera_ScreenTextColored(15, 26, DBCAMERA_TEXT_PEACH, D_8012CEE0[8]);
}
switch (dbCamera->sub.unk_08) {
@ -1099,25 +1102,25 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
case 0:
dbCamera->unk_3C = false;
if (dbCamera->sub.mode != 1) {
func_8006376C(0xD, 0x18, 3, !D_80161144 ? D_8012CF04 : D_8012CF08);
DbCamera_ScreenTextColored(13, 24, DBCAMERA_TEXT_ORANGE, !D_80161144 ? D_8012CF04 : D_8012CF08);
DbCamera_SetTextValue(CAM_BINANG_TO_DEG(sp104.pitch), &D_8012D0E4[11], 4);
func_8006376C(0xF, 0x17, 3, D_8012D0E4);
DbCamera_ScreenTextColored(15, 23, DBCAMERA_TEXT_ORANGE, D_8012D0E4);
DbCamera_SetTextValue(CAM_BINANG_TO_DEG(sp104.yaw), &D_8012D0F8[11], 4);
func_8006376C(0xF, 0x18, 3, D_8012D0F8);
DbCamera_ScreenTextColored(15, 24, DBCAMERA_TEXT_ORANGE, D_8012D0F8);
DbCamera_SetTextValue(sp104.r, &D_8012D0D4[8], 6);
func_8006376C(0xF, 0x19, 3, D_8012D0D4);
DbCamera_ScreenTextColored(15, 25, DBCAMERA_TEXT_ORANGE, D_8012D0D4);
} else {
func_8006376C(0xE, 0x18, 3, D_8012CF0C);
func_8006376C(0x10, 0x16, 3, D_8012CF10);
DbCamera_ScreenTextColored(14, 24, DBCAMERA_TEXT_ORANGE, D_8012CF0C);
DbCamera_ScreenTextColored(16, 22, DBCAMERA_TEXT_ORANGE, D_8012CF10);
sp110 = 'X';
DbCamera_SetTextValue(temp_s6->pos.x, &sp111, 7);
func_8006376C(0x10, 0x17, 3, &sp110);
DbCamera_ScreenTextColored(16, 23, DBCAMERA_TEXT_ORANGE, &sp110);
sp110 = 'Y';
DbCamera_SetTextValue(temp_s6->pos.y, &sp111, 7);
func_8006376C(0x10, 0x18, 3, &sp110);
DbCamera_ScreenTextColored(16, 24, DBCAMERA_TEXT_ORANGE, &sp110);
sp110 = 'Z';
DbCamera_SetTextValue(temp_s6->pos.z, &sp111, 7);
func_8006376C(0x10, 0x19, 3, &sp110);
DbCamera_ScreenTextColored(16, 25, DBCAMERA_TEXT_ORANGE, &sp110);
}
break;
case 1:
@ -1305,15 +1308,19 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
}
DbCamera_SetTextValue(dbCamera->sub.lookAt[dbCamera->sub.unkIdx].viewAngle, &D_8012D05C[10], 3);
func_8006376C(0x10, 0x14, (dbCamera->sub.unk_0A == 0) ? 7 : 4, D_8012D05C);
DbCamera_ScreenTextColored(
16, 20, (dbCamera->sub.unk_0A == 0) ? DBCAMERA_TEXT_GREEN : DBCAMERA_TEXT_GOLD, D_8012D05C);
DbCamera_SetTextValue(dbCamera->sub.lookAt[dbCamera->sub.unkIdx].nextPointFrame, &D_8012D070[9], 3);
func_8006376C(0x10, 0x15, (dbCamera->sub.unk_0A == 1) ? 7 : 4, D_8012D070);
DbCamera_ScreenTextColored(
16, 21, (dbCamera->sub.unk_0A == 1) ? DBCAMERA_TEXT_GREEN : DBCAMERA_TEXT_GOLD, D_8012D070);
DbCamera_SetTextValue(dbCamera->sub.lookAt[dbCamera->sub.unkIdx].cameraRoll, &D_8012D084[10], 3);
func_8006376C(0x10, 0x16, (dbCamera->sub.unk_0A == 2) ? 7 : 4, D_8012D084);
func_8006376C(0xF, 0x17, (dbCamera->sub.unk_0A == 3) ? 7 : 4,
(dbCamera->sub.mode == 1) ? D_8012CF14
: (dbCamera->sub.mode == 0) ? *D_8012CF18
: D_8012CFB0);
DbCamera_ScreenTextColored(
16, 22, (dbCamera->sub.unk_0A == 2) ? DBCAMERA_TEXT_GREEN : DBCAMERA_TEXT_GOLD, D_8012D084);
DbCamera_ScreenTextColored(15, 23,
(dbCamera->sub.unk_0A == 3) ? DBCAMERA_TEXT_GREEN : DBCAMERA_TEXT_GOLD,
(dbCamera->sub.mode == 1) ? D_8012CF14
: (dbCamera->sub.mode == 0) ? *D_8012CF18
: D_8012CFB0);
if (dbCamera->sub.unk_0C) {
D_8012D05C[80] = '>';
} else {
@ -1329,70 +1336,76 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
D_8012D05C[95] = '<';
}
D_8012D05C[96] = '\0';
func_8006376C(0xF, 0x18, (dbCamera->sub.unk_0A == 4) ? 7 : 4, D_8012D0AC);
DbCamera_ScreenTextColored(
15, 24, (dbCamera->sub.unk_0A == 4) ? DBCAMERA_TEXT_GREEN : DBCAMERA_TEXT_GOLD, D_8012D0AC);
DbCamera_SetTextValue(dbCamera->sub.nFrames, &D_8012D0C0[10], 5);
func_8006376C(0xF, 0x19, (dbCamera->sub.unk_0A == 5) ? 7 : 4,
(dbCamera->sub.nFrames == -1) ? *D_8012CF24 : D_8012D0C0);
DbCamera_ScreenTextColored(15, 25,
(dbCamera->sub.unk_0A == 5) ? DBCAMERA_TEXT_GREEN : DBCAMERA_TEXT_GOLD,
(dbCamera->sub.nFrames == -1) ? *D_8012CF24 : D_8012D0C0);
break;
}
if (dbCamera->sub.mode != 1) {
func_8006376C(3, 0x16,
((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && !D_80161144) ? 7
: !D_80161144 ? 4
: 3,
D_8012CF30);
DbCamera_ScreenTextColored(3, 22,
((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && !D_80161144)
? DBCAMERA_TEXT_GREEN
: !D_80161144 ? DBCAMERA_TEXT_GOLD
: DBCAMERA_TEXT_ORANGE,
D_8012CF30);
sp110 = 'X';
DbCamera_SetTextValue(dbCamera->at.x, &sp111, 6);
func_8006376C(3, 0x17, 2, &sp110);
DbCamera_ScreenTextColored(3, 23, DBCAMERA_TEXT_BROWN, &sp110);
sp110 = 'Y';
DbCamera_SetTextValue(dbCamera->at.y, &sp111, 6);
func_8006376C(3, 0x18, 2, &sp110);
DbCamera_ScreenTextColored(3, 24, DBCAMERA_TEXT_BROWN, &sp110);
sp110 = 'Z';
DbCamera_SetTextValue(dbCamera->at.z, &sp111, 6);
func_8006376C(3, 0x19, 2, &sp110);
func_8006376C(0x1E, 0x16,
((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && D_80161144) ? 7
: D_80161144 ? 4
: 3,
D_8012CF34);
DbCamera_ScreenTextColored(3, 25, DBCAMERA_TEXT_BROWN, &sp110);
DbCamera_ScreenTextColored(30, 22,
((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && D_80161144)
? DBCAMERA_TEXT_GREEN
: D_80161144 ? DBCAMERA_TEXT_GOLD
: DBCAMERA_TEXT_ORANGE,
D_8012CF34);
sp110 = 'X';
DbCamera_SetTextValue(dbCamera->eye.x, &sp111, 6);
func_8006376C(0x1E, 0x17, 2, &sp110);
DbCamera_ScreenTextColored(30, 23, DBCAMERA_TEXT_BROWN, &sp110);
sp110 = 'Y';
DbCamera_SetTextValue(dbCamera->eye.y, &sp111, 6);
func_8006376C(0x1E, 0x18, 2, &sp110);
DbCamera_ScreenTextColored(30, 24, DBCAMERA_TEXT_BROWN, &sp110);
sp110 = 'Z';
DbCamera_SetTextValue(dbCamera->eye.z, &sp111, 6);
func_8006376C(0x1E, 0x19, 2, &sp110);
DbCamera_ScreenTextColored(30, 25, DBCAMERA_TEXT_BROWN, &sp110);
} else {
if (D_8012CEE0[0]) {}
OLib_Vec3fDiffToVecGeo(&spFC, sp90, sp7C);
spFC.yaw -= cam->playerPosRot.rot.y;
func_8006376C(3, 0x16,
((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && !D_80161144) ? 7
: !D_80161144 ? 4
: 3,
D_8012CF30);
DbCamera_ScreenTextColored(3, 22,
((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && !D_80161144)
? DBCAMERA_TEXT_GREEN
: !D_80161144 ? DBCAMERA_TEXT_GOLD
: DBCAMERA_TEXT_ORANGE,
D_8012CF30);
DbCamera_SetTextValue(CAM_BINANG_TO_DEG(spFC.pitch), &D_8012D0E4[10], 4);
func_8006376C(3, 0x17, 3, D_8012D0E4);
DbCamera_ScreenTextColored(3, 23, DBCAMERA_TEXT_ORANGE, D_8012D0E4);
DbCamera_SetTextValue(CAM_BINANG_TO_DEG(spFC.yaw), &D_8012D0F8[10], 4);
func_8006376C(3, 0x18, 3, D_8012D0F8);
DbCamera_ScreenTextColored(3, 24, DBCAMERA_TEXT_ORANGE, D_8012D0F8);
DbCamera_SetTextValue(spFC.r, &D_8012D0D4[7], 6);
func_8006376C(3, 0x19, 3, D_8012D0D4);
DbCamera_ScreenTextColored(3, 25, DBCAMERA_TEXT_ORANGE, D_8012D0D4);
OLib_Vec3fDiffToVecGeo(&spFC, sp90, sp80);
spFC.yaw -= cam->playerPosRot.rot.y;
func_8006376C(0x1E, 0x16,
((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && D_80161144) ? 7
: D_80161144 ? 4
: 3,
D_8012CF34);
DbCamera_ScreenTextColored(30, 22,
((dbCamera->sub.unk_08 == 1) && (dbCamera->sub.unk_0A == 4) && D_80161144)
? DBCAMERA_TEXT_GREEN
: D_80161144 ? DBCAMERA_TEXT_GOLD
: DBCAMERA_TEXT_ORANGE,
D_8012CF34);
DbCamera_SetTextValue(CAM_BINANG_TO_DEG(spFC.pitch), &D_8012D0E4[10], 4);
func_8006376C(0x1C, 0x17, 3, D_8012D0E4);
DbCamera_ScreenTextColored(28, 23, DBCAMERA_TEXT_ORANGE, D_8012D0E4);
DbCamera_SetTextValue(CAM_BINANG_TO_DEG(spFC.yaw), &D_8012D0F8[10], 4);
func_8006376C(0x1C, 0x18, 3, D_8012D0F8);
DbCamera_ScreenTextColored(28, 24, DBCAMERA_TEXT_ORANGE, D_8012D0F8);
DbCamera_SetTextValue(spFC.r, &D_8012D0D4[7], 6);
func_8006376C(0x1C, 0x19, 3, D_8012D0D4);
DbCamera_ScreenTextColored(28, 25, DBCAMERA_TEXT_ORANGE, D_8012D0D4);
}
DebugDisplay_AddObject(dbCamera->at.x, dbCamera->at.y + 1.0f, dbCamera->at.z, 0, 0, 0, 0.02f, 2.0f, 0.02f,
@ -1438,41 +1451,44 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) {
dbCamera->unk_38 = -1;
}
func_8006376C(0xE, 5, 0, D_8012CF38);
func_8006376C(9, 6, (dbCamera->unk_78 == 0) ? 7 : 4, D_8012CFD0);
func_8006376C(0x11, 6, (dbCamera->unk_78 == 1) ? 7 : 4, D_8012CFE4);
func_8006376C(0x18, 6, (dbCamera->unk_78 == 2) ? 7 : 4, D_8012CFF8);
func_8006376C(3, 0x16, D_80161144 ? 3 : 4, D_8012CF30);
DbCamera_ScreenTextColored(14, 5, DBCAMERA_TEXT_YELLOW, D_8012CF38);
DbCamera_ScreenTextColored(9, 6, (dbCamera->unk_78 == 0) ? DBCAMERA_TEXT_GREEN : DBCAMERA_TEXT_GOLD,
D_8012CFD0);
DbCamera_ScreenTextColored(17, 6, (dbCamera->unk_78 == 1) ? DBCAMERA_TEXT_GREEN : DBCAMERA_TEXT_GOLD,
D_8012CFE4);
DbCamera_ScreenTextColored(24, 6, (dbCamera->unk_78 == 2) ? DBCAMERA_TEXT_GREEN : DBCAMERA_TEXT_GOLD,
D_8012CFF8);
DbCamera_ScreenTextColored(3, 22, D_80161144 ? DBCAMERA_TEXT_ORANGE : DBCAMERA_TEXT_GOLD, D_8012CF30);
sp110 = 'X';
DbCamera_SetTextValue(dbCamera->at.x, &sp111, 6);
func_8006376C(3, 0x17, 2, &sp110);
DbCamera_ScreenTextColored(3, 23, DBCAMERA_TEXT_BROWN, &sp110);
sp110 = 'Y';
DbCamera_SetTextValue(dbCamera->at.y, &sp111, 6);
func_8006376C(3, 0x18, 2, &sp110);
DbCamera_ScreenTextColored(3, 24, DBCAMERA_TEXT_BROWN, &sp110);
sp110 = 'Z';
DbCamera_SetTextValue(dbCamera->at.z, &sp111, 6);
func_8006376C(3, 0x19, 2, &sp110);
func_8006376C(0x1E, 0x16, D_80161144 ? 4 : 3, D_8012CF34);
DbCamera_ScreenTextColored(3, 25, DBCAMERA_TEXT_BROWN, &sp110);
DbCamera_ScreenTextColored(30, 22, D_80161144 ? DBCAMERA_TEXT_GOLD : DBCAMERA_TEXT_ORANGE, D_8012CF34);
sp110 = 'X';
DbCamera_SetTextValue(dbCamera->eye.x, &sp111, 6);
func_8006376C(0x1E, 0x17, 2, &sp110);
DbCamera_ScreenTextColored(30, 23, DBCAMERA_TEXT_BROWN, &sp110);
sp110 = 'Y';
DbCamera_SetTextValue(dbCamera->eye.y, &sp111, 6);
func_8006376C(0x1E, 0x18, 2, &sp110);
DbCamera_ScreenTextColored(30, 24, DBCAMERA_TEXT_BROWN, &sp110);
sp110 = 'Z';
DbCamera_SetTextValue(dbCamera->eye.z, &sp111, 6);
func_8006376C(0x1E, 0x19, 2, &sp110);
func_8006376C(0xD, 0x18, 3, !D_80161144 ? D_8012CF04 : D_8012CF08);
DbCamera_ScreenTextColored(30, 25, DBCAMERA_TEXT_BROWN, &sp110);
DbCamera_ScreenTextColored(13, 24, DBCAMERA_TEXT_ORANGE, !D_80161144 ? D_8012CF04 : D_8012CF08);
DbCamera_SetTextValue(CAM_BINANG_TO_DEG(sp104.pitch), &D_8012D0E4[11], 4);
func_8006376C(0xF, 0x17, 3, D_8012D0E4);
DbCamera_ScreenTextColored(15, 23, DBCAMERA_TEXT_ORANGE, D_8012D0E4);
DbCamera_SetTextValue(CAM_BINANG_TO_DEG(sp104.yaw), &D_8012D0F8[11], 4);
func_8006376C(0xF, 0x18, 3, D_8012D0F8);
DbCamera_ScreenTextColored(15, 24, DBCAMERA_TEXT_ORANGE, D_8012D0F8);
DbCamera_SetTextValue(sp104.r, &D_8012D0D4[8], 6);
func_8006376C(0xF, 0x19, 3, D_8012D0D4);
DbCamera_ScreenTextColored(15, 25, DBCAMERA_TEXT_ORANGE, D_8012D0D4);
if (dbCamera->unk_3C) {
func_8006376C(0x10, 0x1A, 1, D_8012CF3C);
DbCamera_ScreenTextColored(16, 26, DBCAMERA_TEXT_PEACH, D_8012CF3C);
} else {
func_8006376C(0x10, 0x1A, 1, D_8012CF40);
DbCamera_ScreenTextColored(16, 26, DBCAMERA_TEXT_PEACH, D_8012CF40);
}
D_8012D110++;
@ -1706,9 +1722,9 @@ void DbCamera_DrawSlotLetters(char* str, s16 y, s16 x, s32 colorIndex) {
}
str[0x14] = str[i * 2 + 1] = '\0';
func_8006376C(x, y, colorIndex, str);
DbCamera_ScreenTextColored(x, y, colorIndex, str);
str[0x14] = str[i * 2 + 0] = '-';
func_8006376C(x + 0x14, y, colorIndex, str + 0x14);
DbCamera_ScreenTextColored(20 + x, y, colorIndex, str + 0x14);
}
void DbCamera_PrintAllCuts(Camera* cam) {
@ -1766,11 +1782,11 @@ s32 func_800B91B0(Camera* cam, DbCamera* dbCamera) {
D_8012D13C[10] = ((sDbCameraCuts[D_8016110C].nPoints - 5) / 10) + '0';
D_8012D13C[11] = ((sDbCameraCuts[D_8016110C].nPoints - 5) % 10) + '0';
DbCamera_SetTextValue(sDbCamAnim.unk_04, &D_8012D114[10], 4);
func_8006376C(0xF, 0x16, 3, D_8012D114);
DbCamera_ScreenTextColored(15, 22, DBCAMERA_TEXT_ORANGE, D_8012D114);
DbCamera_SetTextValue(sDbCamAnim.unk_0C, &D_8012D128[10], 4);
func_8006376C(0xF, 0x17, 3, D_8012D128);
func_8006376C(0xF, 0x18, 3, D_8012D13C);
func_8006376C(0x10, 0x1A, 1, D_8012CEF0);
DbCamera_ScreenTextColored(15, 23, DBCAMERA_TEXT_ORANGE, D_8012D128);
DbCamera_ScreenTextColored(15, 24, DBCAMERA_TEXT_ORANGE, D_8012D13C);
DbCamera_ScreenTextColored(16, 26, DBCAMERA_TEXT_PEACH, D_8012CEF0);
sDbCamAnim.unk_04++;
sDbCamAnim.unk_0C++;
@ -1833,7 +1849,8 @@ void DbCamera_Reset(Camera* cam, DbCamera* dbCam) {
s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
static s32 sMempakFiles;
static u32 sDbCameraColors[] = {
4, 4, 4, 7, 4, 4,
DBCAMERA_TEXT_GOLD, DBCAMERA_TEXT_GOLD, DBCAMERA_TEXT_GOLD,
DBCAMERA_TEXT_GREEN, DBCAMERA_TEXT_GOLD, DBCAMERA_TEXT_GOLD,
};
static s32 sMempakFilesize = 0;
s32 i;
@ -1845,7 +1862,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
VecGeo sp5C;
s32 (*callbacks[])(char*) = { DbCamera_SaveCallback, DbCamera_LoadCallback, DbCamera_ClearCallback };
func_8006376C(0xE, 5, 0, D_8012CF44); // DEMO CONTROL
DbCamera_ScreenTextColored(14, 5, DBCAMERA_TEXT_YELLOW, D_8012CF44); // DEMO CONTROL
idx1 = sCurFileIdx >> 1;
idx2 = sLastFileIdx >> 1;
@ -1867,12 +1884,17 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
dbCamera->sub.demoCtrlToggleSwitch ^= 1;
}
D_8012CEE0[41][9] = MEMPAK_INDEX_TO_LETTER(sCurFileIdx);
func_8006376C(0xA, 7, 5, D_8012CEE0[41]);
func_8006376C(0x10, 7, 5, D_8012CF60[dbCamera->sub.demoCtrlActionIdx]);
func_8006376C(0x14, 7, 5, D_8012CF88[0]);
DbCamera_ScreenTextColored(10, 7, DBCAMERA_TEXT_WHITE, D_8012CEE0[41]);
DbCamera_ScreenTextColored(16, 7, DBCAMERA_TEXT_WHITE,
D_8012CF60[dbCamera->sub.demoCtrlActionIdx]);
DbCamera_ScreenTextColored(20, 7, DBCAMERA_TEXT_WHITE, D_8012CF88[0]);
func_8006376C(0x11, 8, dbCamera->sub.demoCtrlToggleSwitch ? 4 : 7, D_8012CF94);
func_8006376C(0x15, 8, dbCamera->sub.demoCtrlToggleSwitch ? 7 : 4, D_8012CF98);
DbCamera_ScreenTextColored(
17, 8, dbCamera->sub.demoCtrlToggleSwitch ? DBCAMERA_TEXT_GOLD : DBCAMERA_TEXT_GREEN,
D_8012CF94);
DbCamera_ScreenTextColored(
21, 8, dbCamera->sub.demoCtrlToggleSwitch ? DBCAMERA_TEXT_GREEN : DBCAMERA_TEXT_GOLD,
D_8012CF98);
if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_A)) {
if (dbCamera->sub.demoCtrlToggleSwitch == 0) {
@ -1891,9 +1913,12 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
} else {
dbCamera->sub.demoCtrlToggleSwitch ^= 1;
D_8012CF84[9] = MEMPAK_INDEX_TO_LETTER(sCurFileIdx);
func_8006376C(0xD, 7, 5, D_8012CF88[-1]); // todo: find something better
func_8006376C(0x12, 7, 5, D_8012CF80);
func_8006376C(0xD, 9, dbCamera->sub.demoCtrlToggleSwitch ? 1 : 6, "PRESS B BUTTON");
DbCamera_ScreenTextColored(13, 7, DBCAMERA_TEXT_WHITE,
D_8012CF88[-1]); // todo: find something better
DbCamera_ScreenTextColored(18, 7, DBCAMERA_TEXT_WHITE, D_8012CF80);
DbCamera_ScreenTextColored(
13, 9, dbCamera->sub.demoCtrlToggleSwitch ? DBCAMERA_TEXT_PEACH : DBCAMERA_TEXT_BLUE,
"PRESS B BUTTON");
}
}
if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_B)) {
@ -1909,9 +1934,9 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
case DEMO_CTRL_MENU(ACTION_LOAD, MENU_CALLBACK):
case DEMO_CTRL_MENU(ACTION_CLEAR, MENU_CALLBACK): {
D_8012CEE0[41][9] = MEMPAK_INDEX_TO_LETTER(sCurFileIdx);
func_8006376C(0xC, 7, 5, D_8012CEE0[41]);
func_8006376C(0x12, 7, 5, D_8012CF60[dbCamera->sub.demoCtrlActionIdx]);
func_8006376C(0x16, 7, 5, D_8012CF9C[0]);
DbCamera_ScreenTextColored(12, 7, DBCAMERA_TEXT_WHITE, D_8012CEE0[41]);
DbCamera_ScreenTextColored(18, 7, DBCAMERA_TEXT_WHITE, D_8012CF60[dbCamera->sub.demoCtrlActionIdx]);
DbCamera_ScreenTextColored(22, 7, DBCAMERA_TEXT_WHITE, D_8012CF9C[0]);
if (callbacks[dbCamera->sub.demoCtrlActionIdx - 1](&D_8012CF84[9])) {
dbCamera->sub.demoCtrlMenu++;
@ -1927,10 +1952,13 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
case DEMO_CTRL_MENU(ACTION_CLEAR, MENU_SUCCESS): {
dbCamera->sub.demoCtrlToggleSwitch ^= 1;
D_8012CEE0[41][9] = MEMPAK_INDEX_TO_LETTER(sCurFileIdx);
func_8006376C(0xD, 7, 5, D_8012CEE0[41]);
func_8006376C(0x13, 7, 5, D_8012CF60[dbCamera->sub.demoCtrlMenu / 100]);
func_8006376C(0x17, 7, 5, D_8012CFA4);
func_8006376C(0xD, 9, (dbCamera->sub.demoCtrlToggleSwitch != 0) ? 1 : 6, "PRESS B BUTTON");
DbCamera_ScreenTextColored(13, 7, DBCAMERA_TEXT_WHITE, D_8012CEE0[41]);
DbCamera_ScreenTextColored(19, 7, DBCAMERA_TEXT_WHITE,
D_8012CF60[dbCamera->sub.demoCtrlMenu / 100]);
DbCamera_ScreenTextColored(23, 7, DBCAMERA_TEXT_WHITE, D_8012CFA4);
DbCamera_ScreenTextColored(
13, 9, (dbCamera->sub.demoCtrlToggleSwitch != 0) ? DBCAMERA_TEXT_PEACH : DBCAMERA_TEXT_BLUE,
"PRESS B BUTTON");
if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_A) ||
CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_B)) {
@ -1950,10 +1978,13 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
case DEMO_CTRL_MENU(ACTION_CLEAR, MENU_ERROR): {
dbCamera->sub.demoCtrlToggleSwitch ^= 1;
D_8012CEE0[41][9] = MEMPAK_INDEX_TO_LETTER(sCurFileIdx);
func_8006376C(0xD, 7, 5, D_8012CEE0[(dbCamera->sub.demoCtrlMenu / 100) + 32]);
func_8006376C(0x11, 7, 5, D_8012CFAC);
func_8006376C(0x17, 7, 5, D_8012CFA4);
func_8006376C(0xD, 9, (dbCamera->sub.demoCtrlToggleSwitch != 0) ? 1 : 6, "PRESS B BUTTON");
DbCamera_ScreenTextColored(13, 7, DBCAMERA_TEXT_WHITE,
D_8012CEE0[(dbCamera->sub.demoCtrlMenu / 100) + 32]);
DbCamera_ScreenTextColored(17, 7, DBCAMERA_TEXT_WHITE, D_8012CFAC);
DbCamera_ScreenTextColored(23, 7, DBCAMERA_TEXT_WHITE, D_8012CFA4);
DbCamera_ScreenTextColored(
13, 9, (dbCamera->sub.demoCtrlToggleSwitch != 0) ? DBCAMERA_TEXT_PEACH : DBCAMERA_TEXT_BLUE,
"PRESS B BUTTON");
if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_A) ||
CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_B)) {
@ -2029,30 +2060,31 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
}
}
idx3 = dbCamera->sub.demoCtrlActionIdx;
func_8006376C(0xE, 7, 5, D_8012CF50[idx3]);
func_8006376C(0xF, 7, 4, sp74);
DbCamera_ScreenTextColored(14, 7, DBCAMERA_TEXT_WHITE, D_8012CF50[idx3]);
DbCamera_ScreenTextColored(15, 7, DBCAMERA_TEXT_GOLD, sp74);
func_8006376C((sCurFileIdx * 2) + 0x10, 7, 7, "_"); // cursor
DbCamera_ScreenTextColored(16 + (sCurFileIdx * 2), 7, DBCAMERA_TEXT_GREEN, "_"); // cursor
DbCamera_SetTextValue(DbCamera_GetMempakAllocSize(), sp74, 6);
func_8006376C(0xD, 9, 6, D_8012CF78); // NEED BYTE
func_8006376C(0x11, 9, 4, sp74);
DbCamera_ScreenTextColored(13, 9, DBCAMERA_TEXT_BLUE, D_8012CF78); // NEED BYTE
DbCamera_ScreenTextColored(17, 9, DBCAMERA_TEXT_GOLD, sp74);
DbCamera_SetTextValue(Mempak_GetFreeBytes(DBCAM_CONTROLLER_PORT), sp74, 6);
func_8006376C(0xD, 0xA, 6, D_8012CF74); // FREE BYTE
func_8006376C(0x11, 0xA, 4, sp74);
DbCamera_ScreenTextColored(13, 10, DBCAMERA_TEXT_BLUE, D_8012CF74); // FREE BYTE
DbCamera_ScreenTextColored(17, 10, DBCAMERA_TEXT_GOLD, sp74);
if (sMempakFilesize != 0) {
DbCamera_SetTextValue(sMempakFilesize, sp74, 6);
func_8006376C(0xD, 0xB, 7, D_8012CFA8);
func_8006376C(0x11, 0xB, 4, sp74);
DbCamera_ScreenTextColored(13, 11, DBCAMERA_TEXT_GREEN, D_8012CFA8);
DbCamera_ScreenTextColored(17, 11, DBCAMERA_TEXT_GOLD, sp74);
}
idx1 = (dbCamera->sub.demoCtrlActionIdx + 2);
func_8006376C(0xF, 0x16, 1, D_8012CF7C);
func_8006376C(0x12, 0x17, sDbCameraColors[idx1], D_8012CF64);
func_8006376C(0x12, 0x18, sDbCameraColors[idx1 - 1], D_8012CF68);
func_8006376C(0x12, 0x19, sDbCameraColors[idx1 - 2], D_8012CF6C);
func_8006376C(0xE, dbCamera->sub.demoCtrlActionIdx + 0x16, 7, D_8012CF0C); // current selection
func_8006376C(0xD, 0x1A, 5, D_8012CF60[0]);
func_8006376C(0x14, 0x1A, 5, D_8012CF70);
DbCamera_ScreenTextColored(15, 22, DBCAMERA_TEXT_PEACH, D_8012CF7C);
DbCamera_ScreenTextColored(18, 23, sDbCameraColors[idx1], D_8012CF64);
DbCamera_ScreenTextColored(18, 24, sDbCameraColors[idx1 - 1], D_8012CF68);
DbCamera_ScreenTextColored(18, 25, sDbCameraColors[idx1 - 2], D_8012CF6C);
DbCamera_ScreenTextColored(14, 22 + dbCamera->sub.demoCtrlActionIdx, DBCAMERA_TEXT_GREEN,
D_8012CF0C); // current selection
DbCamera_ScreenTextColored(13, 26, DBCAMERA_TEXT_WHITE, D_8012CF60[0]);
DbCamera_ScreenTextColored(20, 26, DBCAMERA_TEXT_WHITE, D_8012CF70);
if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_DUP)) {
Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
@ -2079,8 +2111,8 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
}
goto block_2;
} else {
func_8006376C(0xC, 0x1A, 4, D_8012CF60[0]);
func_8006376C(0x13, 0x1A, 4, D_8012CF80);
DbCamera_ScreenTextColored(12, 26, DBCAMERA_TEXT_GOLD, D_8012CF60[0]);
DbCamera_ScreenTextColored(19, 26, DBCAMERA_TEXT_GOLD, D_8012CF80);
if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_B) ||
CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_DUP) ||
CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_DDOWN)) {
@ -2112,11 +2144,11 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
sCurFileIdx = 0;
}
DbCamera_DrawSlotLetters(sp74, 7, 5, 4);
DbCamera_DrawSlotLetters(sp74, 7, 5, DBCAMERA_TEXT_GOLD);
if (sDbCamAnim.unk_0A != 0) {
func_8006376C(4, 7, 5, D_8012CF4C);
func_8006376C(D_8016110C * 2 + 6, 7, 7, ">");
DbCamera_ScreenTextColored(4, 7, DBCAMERA_TEXT_WHITE, D_8012CF4C);
DbCamera_ScreenTextColored(6 + (D_8016110C * 2), 7, DBCAMERA_TEXT_GREEN, ">");
if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_CUP)) {
if (D_8016110C > 0) {
@ -2225,7 +2257,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
sp74[sCurFileIdx] = DbCamera_InitCut(idx1, &dbCamera->sub);
if (sp74[sCurFileIdx] == '?') {
func_8006376C(0xF, 0x18, 7, D_8012CF48);
DbCamera_ScreenTextColored(15, 24, DBCAMERA_TEXT_GREEN, D_8012CF48);
}
}
}
@ -2309,15 +2341,15 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) {
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
}
func_8006376C(4, 7, 5, D_8012CF50[0]);
DbCamera_ScreenTextColored(4, 7, DBCAMERA_TEXT_WHITE, D_8012CF50[0]);
sp74[1] = 0;
if (sLastFileIdx != -1) {
sp74[0] = D_801612EA;
func_8006376C(sLastFileIdx + 5, 7, 2, sp74);
DbCamera_ScreenTextColored(5 + sLastFileIdx, 7, DBCAMERA_TEXT_BROWN, sp74);
} else {
sp74[0] = '_';
}
func_8006376C(sCurFileIdx + 5, 7, 7, sp74);
DbCamera_ScreenTextColored(5 + sCurFileIdx, 7, DBCAMERA_TEXT_GREEN, sp74);
break;
}

View file

@ -188,7 +188,7 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) {
CLOSE_DISPS(gfxCtx, "../game.c", 800);
func_80063D7C(gfxCtx);
Debug_DrawText(gfxCtx);
if (R_ENABLE_ARENA_DBG != 0) {
SpeedMeter_DrawTimeEntries(&D_801664D0, gfxCtx);

View file

@ -7278,15 +7278,16 @@ void Camera_PrintSettings(Camera* camera) {
sp48[i] = '\0';
sp48[camera->play->activeCamId] = 'a';
func_8006376C(3, 0x16, 5, sp58);
func_8006376C(3, 0x16, 1, sp48);
func_8006376C(3, 0x17, 5, "S:");
func_8006376C(5, 0x17, 4, sCameraSettingNames[camera->setting]);
func_8006376C(3, 0x18, 5, "M:");
func_8006376C(5, 0x18, 4, sCameraModeNames[camera->mode]);
func_8006376C(3, 0x19, 5, "F:");
func_8006376C(5, 0x19, 4,
sCameraFunctionNames[sCameraSettings[camera->setting].cameraModes[camera->mode].funcIdx]);
DbCamera_ScreenTextColored(3, 22, DBCAMERA_TEXT_WHITE, sp58);
DbCamera_ScreenTextColored(3, 22, DBCAMERA_TEXT_PEACH, sp48);
DbCamera_ScreenTextColored(3, 23, DBCAMERA_TEXT_WHITE, "S:");
DbCamera_ScreenTextColored(5, 23, DBCAMERA_TEXT_GOLD, sCameraSettingNames[camera->setting]);
DbCamera_ScreenTextColored(3, 24, DBCAMERA_TEXT_WHITE, "M:");
DbCamera_ScreenTextColored(5, 24, DBCAMERA_TEXT_GOLD, sCameraModeNames[camera->mode]);
DbCamera_ScreenTextColored(3, 25, DBCAMERA_TEXT_WHITE, "F:");
DbCamera_ScreenTextColored(
5, 25, DBCAMERA_TEXT_GOLD,
sCameraFunctionNames[sCameraSettings[camera->setting].cameraModes[camera->mode].funcIdx]);
i = 0;
if (camera->bgCamIndex < 0) {
@ -7310,8 +7311,8 @@ void Camera_PrintSettings(Camera* camera) {
sp50[i++] = ' ';
sp50[i++] = ' ';
sp50[i] = '\0';
func_8006376C(3, 26, 5, "I:");
func_8006376C(5, 26, 4, sp50);
DbCamera_ScreenTextColored(3, 26, DBCAMERA_TEXT_WHITE, "I:");
DbCamera_ScreenTextColored(5, 26, DBCAMERA_TEXT_GOLD, sp50);
}
}

View file

@ -5,7 +5,7 @@ typedef struct {
u8 y;
u8 colorIndex;
char text[21];
} PrintTextBufferEntry; // size = 0x18
} DbCameraTextBufferEntry; // size = 0x18
typedef struct {
u16 hold;
@ -14,17 +14,19 @@ typedef struct {
RegEditor* gRegEditor;
PrintTextBufferEntry sDebugPrintTextBuffer[22];
s16 sDebugPrintTextBufferNumUsed = 0;
Color_RGBA8 sDebugPrintTextColors[] = {
{ 255, 255, 32, 192 }, // 0
{ 255, 150, 128, 192 }, // 1
{ 128, 96, 0, 64 }, // 2
{ 192, 128, 16, 128 }, // 3
{ 255, 192, 32, 128 }, // 4
{ 230, 230, 220, 64 }, // 5
{ 128, 150, 255, 128 }, // 6
{ 128, 255, 32, 128 }, // 7
DbCameraTextBufferEntry sDbCameraTextBuffer[22];
s16 sDbCameraTextEntryCount = 0;
Color_RGBA8 sDbCameraTextColors[] = {
{ 255, 255, 32, 192 }, // DBCAMERA_TEXT_YELLOW
{ 255, 150, 128, 192 }, // DBCAMERA_TEXT_PEACH
{ 128, 96, 0, 64 }, // DBCAMERA_TEXT_BROWN
{ 192, 128, 16, 128 }, // DBCAMERA_TEXT_ORANGE
{ 255, 192, 32, 128 }, // DBCAMERA_TEXT_GOLD
{ 230, 230, 220, 64 }, // DBCAMERA_TEXT_WHITE
{ 128, 150, 255, 128 }, // DBCAMERA_TEXT_BLUE
{ 128, 255, 32, 128 }, // DBCAMERA_TEXT_GREEN
};
InputCombo sRegGroupInputCombos[REG_GROUPS] = {
@ -106,18 +108,16 @@ void Regs_Init(void) {
}
}
// Called when free movement is active.
void func_8006375C(s32 arg0, s32 arg1, const char* text) {
// Function is stubbed. Name is assumed by similarities in signature to `DbCamera_ScreenTextColored` and usage.
void DbCamera_ScreenText(u8 x, u8 y, const char* text) {
}
// Store text during Update, to be drawn later during Draw
void func_8006376C(u8 x, u8 y, u8 colorIndex, const char* text) {
PrintTextBufferEntry* entry;
void DbCamera_ScreenTextColored(u8 x, u8 y, u8 colorIndex, const char* text) {
DbCameraTextBufferEntry* entry = &sDbCameraTextBuffer[sDbCameraTextEntryCount];
char* textDest;
s16 charCount;
entry = &sDebugPrintTextBuffer[sDebugPrintTextBufferNumUsed];
if (sDebugPrintTextBufferNumUsed < ARRAY_COUNT(sDebugPrintTextBuffer)) {
if (sDbCameraTextEntryCount < ARRAY_COUNT(sDbCameraTextBuffer)) {
entry->x = x;
entry->y = y;
entry->colorIndex = colorIndex;
@ -125,34 +125,38 @@ void func_8006376C(u8 x, u8 y, u8 colorIndex, const char* text) {
// Copy text into the entry, truncating if needed
charCount = 0;
textDest = entry->text;
while ((*textDest++ = *text++) != '\0') {
if (charCount++ > (ARRAY_COUNT(entry->text) - 1)) {
break;
}
}
*textDest = '\0';
sDebugPrintTextBufferNumUsed++;
sDbCameraTextEntryCount++;
}
}
// Draw text previously stored by calls to `func_8006376C`
void func_80063828(GfxPrint* printer) {
void DbCamera_DrawScreenText(GfxPrint* printer) {
s32 i;
Color_RGBA8* color;
PrintTextBufferEntry* entry;
DbCameraTextBufferEntry* entry;
for (i = 0; i < sDebugPrintTextBufferNumUsed; i++) {
entry = &sDebugPrintTextBuffer[i];
for (i = 0; i < sDbCameraTextEntryCount; i++) {
entry = &sDbCameraTextBuffer[i];
color = &sDbCameraTextColors[entry->colorIndex];
color = &sDebugPrintTextColors[entry->colorIndex];
GfxPrint_SetColor(printer, color->r, color->g, color->b, color->a);
GfxPrint_SetPos(printer, entry->x, entry->y);
GfxPrint_Printf(printer, "%s", entry->text);
}
}
// Process inputs to control the reg editor
/**
* Updates the state of the Reg Editor according to user input.
* Also contains a controller rumble test that can be interfaced with via related REGs.
*/
void Regs_UpdateEditor(Input* input) {
s32 dPadInputCur;
s32 pageDataStart = ((gRegEditor->regGroup * REG_PAGES) + gRegEditor->regPage - 1) * REGS_PER_PAGE;
@ -160,6 +164,7 @@ void Regs_UpdateEditor(Input* input) {
s32 i;
dPadInputCur = input->cur.button & (BTN_DUP | BTN_DLEFT | BTN_DRIGHT | BTN_DDOWN);
if (CHECK_BTN_ALL(input->cur.button, BTN_L) || CHECK_BTN_ALL(input->cur.button, BTN_R) ||
CHECK_BTN_ALL(input->cur.button, BTN_START)) {
@ -188,7 +193,6 @@ void Regs_UpdateEditor(Input* input) {
case 4:
case 5:
case 6:
if (dPadInputCur == gRegEditor->dPadInputPrev) {
gRegEditor->inputRepeatTimer--;
if (gRegEditor->inputRepeatTimer < 0) {
@ -239,7 +243,6 @@ void Regs_UpdateEditor(Input* input) {
}
}
// Draw the reg editor
void Regs_DrawEditor(GfxPrint* printer) {
s32 i;
s32 pageStart = (gRegEditor->regPage - 1) * REGS_PER_PAGE;
@ -267,7 +270,10 @@ void Regs_DrawEditor(GfxPrint* printer) {
}
}
void func_80063D7C(GraphicsContext* gfxCtx) {
/**
* Draws the Reg Editor and Debug Camera text on screen
*/
void Debug_DrawText(GraphicsContext* gfxCtx) {
Gfx* gfx;
Gfx* opaStart;
GfxPrint printer;
@ -282,14 +288,14 @@ void func_80063D7C(GraphicsContext* gfxCtx) {
GfxPrint_Open(&printer, gfx);
if ((OREG(0) == 1) || (OREG(0) == 8)) {
func_80063828(&printer);
DbCamera_DrawScreenText(&printer);
}
if (gRegEditor->regPage != 0) {
Regs_DrawEditor(&printer);
}
sDebugPrintTextBufferNumUsed = 0;
sDbCameraTextEntryCount = 0;
gfx = GfxPrint_Close(&printer);
gSPEndDisplayList(gfx++);

View file

@ -13195,7 +13195,7 @@ s32 func_8084FCAC(Player* this, PlayState* play) {
speed = 20.0f;
}
func_8006375C(3, 2, "DEBUG MODE");
DbCamera_ScreenText(3, 2, "DEBUG MODE");
if (!CHECK_BTN_ALL(sControlInput->cur.button, BTN_L)) {
if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_B)) {