From 38594df7d0ef2aa7e549e28bcfd10862c600a815 Mon Sep 17 00:00:00 2001 From: Yanis42 <35189056+Yanis42@users.noreply.github.com> Date: Mon, 16 Jan 2023 17:31:32 +0100 Subject: [PATCH 1/6] work --- include/config/config_debug_controls.h | 291 ++++++++++++ include/config/config_debug_features.h | 6 +- include/config/config_safeguards.h | 2 +- include/macros.h | 4 + include/z64.h | 3 + include/z64pause.h | 2 +- src/boot/z_std_dma.c | 5 - src/code/db_camera.c | 438 +++++++++++------- src/code/flg_set.c | 22 +- src/code/game.c | 18 +- src/code/graph.c | 3 +- src/code/z_bgcheck.c | 2 +- src/code/z_camera.c | 73 +-- src/code/z_camera_data.inc.c | 2 +- src/code/z_debug.c | 87 ++-- src/code/z_demo.c | 58 +-- src/code/z_frame_advance.c | 7 +- src/code/z_kaleido_scope_call.c | 4 +- src/code/z_kaleido_setup.c | 12 +- src/code/z_kankyo.c | 34 +- src/code/z_lifemeter.c | 2 +- src/code/z_map_exp.c | 2 +- src/code/z_message_PAL.c | 6 +- src/code/z_parameter.c | 20 +- src/code/z_play.c | 42 +- src/code/z_sram.c | 6 +- .../actors/ovl_player_actor/z_player.c | 12 +- src/overlays/gamestates/ovl_select/z_select.c | 2 +- src/overlays/gamestates/ovl_select/z_select.h | 3 + .../misc/ovl_kaleido_scope/z_kaleido_item.c | 2 +- .../ovl_kaleido_scope/z_kaleido_scope_PAL.c | 11 +- 31 files changed, 817 insertions(+), 364 deletions(-) diff --git a/include/config/config_debug_controls.h b/include/config/config_debug_controls.h index 2bc4866e6b..9a86468548 100644 --- a/include/config/config_debug_controls.h +++ b/include/config/config_debug_controls.h @@ -69,4 +69,295 @@ // Frame advancing #define FA_CONTROL BTN_DUP +// ------------------------------------------- + +/**** [MAP SELECT CONTROLS] ****/ +// Controller port to use +#define MAP_SELECT_CONTORLLER_PORT CONTROLLER_PORT_1 + +// Set to true to use a button combo +#define MAP_SELECT_BTN_COMBO true +#define MAP_SELECT_BTN_HOLD_FOR_COMBO BTN_L | BTN_R + +// Opening the map select +#define MAP_SELECT_OPEN BTN_Z + +// ------------------------------------------- + +/**** [INVENTORY EDITOR CONTROLS] ****/ +// Controller port to use +#define INV_EDITOR_CONTORLLER_PORT CONTROLLER_PORT_1 + +// Set to true to use a button combo +#define INV_EDITOR_BTN_COMBO false +#define INV_EDITOR_BTN_HOLD_FOR_COMBO BTN_Z + +// Opening the inventory editor +#define INV_EDITOR_OPEN BTN_L + +// ------------------------------------------- + +/**** [EVENT EDITOR CONTROLS] ****/ +// Controller port to use +#define EVENT_EDITOR_CONTORLLER_PORT CONTROLLER_PORT_1 + +// Set to true to use a button combo +#define EVENT_EDITOR_BTN_COMBO true +#define EVENT_EDITOR_BTN_HOLD_FOR_COMBO BTN_L + +// Opening the event editor +#define EVENT_EDITOR_OPEN BTN_CDOWN + +// Closing the event editor +#define EVENT_EDITOR_CLOSE BTN_CLEFT + +// Next page +#define EVENT_EDITOR_NEXT BTN_R + +// Previous page +#define EVENT_EDITOR_PREV BTN_Z + +// Change bit value +#define EVENT_EDITOR_CHANGE_VAL BTN_A + +// Move to the bit on the left +#define EVENT_EDITOR_GO_LEFT BTN_DLEFT + +// Move to the bit on the right +#define EVENT_EDITOR_GO_RIGHT BTN_DRIGHT + +// ------------------------------------------- + +/**** [EVENT EDITOR CONTROLS] ****/ +// Controller port to use +#define REGS_EDITOR_CONTROLLER_PORT CONTROLLER_PORT_1 + +// Increment/Decrement by 10 +#define REGS_EDITOR_INCDEC_10 BTN_B + +// Increment/Decrement by 100 +#define REGS_EDITOR_INCDEC_100 BTN_A + +// Increment/Decrement by 1000 +#define REGS_EDITOR_INCDEC_1000 BTN_A | BTN_B + +#define REGS_EDITOR_REG_COMBO BTN_L, BTN_CUP // REG +#define REGS_EDITOR_SREG_COMBO BTN_L, BTN_CLEFT // SREG +#define REGS_EDITOR_OREG_COMBO BTN_L, BTN_CDOWN // OREG +#define REGS_EDITOR_PREG_COMBO BTN_L, BTN_A // PREG +#define REGS_EDITOR_QREG_COMBO BTN_R, BTN_CDOWN // QREG +#define REGS_EDITOR_MREG_COMBO BTN_L, BTN_CRIGHT // MREG +#define REGS_EDITOR_YREG_COMBO BTN_L, BTN_R // YREG +#define REGS_EDITOR_DREG_COMBO BTN_L, BTN_DLEFT // DREG +#define REGS_EDITOR_UREG_COMBO BTN_L, BTN_DRIGHT // UREG +#define REGS_EDITOR_IREG_COMBO BTN_L, BTN_DUP // IREG +#define REGS_EDITOR_ZREG_COMBO BTN_L, BTN_B // ZREG +#define REGS_EDITOR_CREG_COMBO BTN_L, BTN_Z // CREG +#define REGS_EDITOR_NREG_COMBO BTN_L, BTN_DDOWN // NREG +#define REGS_EDITOR_KREG_COMBO BTN_R, BTN_A // KREG +#define REGS_EDITOR_XREG_COMBO BTN_R, BTN_B // XREG +#define REGS_EDITOR_cREG_COMBO BTN_R, BTN_Z // cREG +#define REGS_EDITOR_sREG_COMBO BTN_R, BTN_L // sREG +#define REGS_EDITOR_iREG_COMBO BTN_R, BTN_CUP // iREG +#define REGS_EDITOR_WREG_COMBO BTN_R, BTN_CRIGHT // WREG +#define REGS_EDITOR_AREG_COMBO BTN_R, BTN_DLEFT // AREG +#define REGS_EDITOR_VREG_COMBO BTN_R, BTN_CLEFT // VREG +#define REGS_EDITOR_HREG_COMBO BTN_R, BTN_START // HREG +#define REGS_EDITOR_GREG_COMBO BTN_L, BTN_START // GREG +#define REGS_EDITOR_mREG_COMBO BTN_R, BTN_DRIGHT // mREG +#define REGS_EDITOR_nREG_COMBO BTN_R, BTN_DUP // nREG +#define REGS_EDITOR_BREG_COMBO BTN_START, BTN_R // BREG +#define REGS_EDITOR_dREG_COMBO BTN_START, BTN_A // dREG +#define REGS_EDITOR_kREG_COMBO BTN_START, BTN_B // kREG +#define REGS_EDITOR_bREG_COMBO BTN_START, BTN_CRIGHT // bREG + +// ------------------------------------------- + +/**** [ACTOR DEBUGGER CONTROLS] ****/ +// Controller port to use +#define ACTORDBG_CONTROLLER_PORT CONTROLLER_PORT_1 + +// Set to true to use a button combo +#define ACTORDBG_BTN_COMBO true +#define ACTORDBG_BTN_HOLD_FOR_COMBO BTN_R + +// Open/Close the actor debugger +#define ACTORDBG_TOGGLE BTN_L + +// Prints info in the IS64 console +#define ACTORDBG_PRINT_INFOS false + +// Increase/Decrease path index +#define ACTORDBG_DECR_PATH_IDX BTN_DLEFT +#define ACTORDBG_INCR_PATH_IDX BTN_DRIGHT + +// ------------------------------------------- + +/**** [MESSAGE DEBUGGER CONTROLS] ****/ +// Controller port to use +#define MSGDBG_CONTROLLER_PORT CONTROLLER_PORT_1 + +// Set to true to use a button combo +#define MSGDBG_BTN_COMBO true +#define MSGDBG_BTN_HOLD_FOR_COMBO BTN_L + +// Open/Close the actor debugger +#define MSGDBG_TOGGLE BTN_R + +#define MSGDBG_OPEN_TEXTBOX BTN_DDOWN + +// ------------------------------------------- + +/**** [CAMERA DEBUGGER CONTROLS] ****/ +// Controller port to use +#define CAMDBG_CONTROLLER_PORT CONTROLLER_PORT_1 +#define CAMDBG_CSCTRL_UNK_PORT CONTROLLER_PORT_2 + +// Set to true to play sounds in-game +#define CAMDBG_PLAY_SOUNDS false + +// Set to true to use a button combo +#define CAMDBG_BTN_COMBO true +#define CAMDBG_BTN_HOLD_FOR_COMBO BTN_R + +// Open/Close the camera debugger +#define CAMDBG_TOGGLE BTN_L + +// Play dungeon's target sound +#define CAMDBG_TESTER_PLAY_DUNGEON_TARGET_SOUND BTN_CUP + +// Play overworld's target sound +#define CAMDBG_TESTER_PLAY_OVERWORLD_TARGET_SOUND BTN_CDOWN + +// Controls for increasing and decreasing the camera setting for the camera tester (see ``Camera_DbgChangeMode``) +#define CAMDBG_TESTER_INCREASE_DISTANCE BTN_DRIGHT +#define CAMDBG_TESTER_DECREASE_SETTING BTN_DLEFT + +/* [COMMON CONTROLS] */ + +// Button to change the tool (camera debug tool, cutscene camera tool and cutscene control) +#define CAMDBG_CHANGE_TOOL BTN_Z + +// Increase/Decrease the "distance" value (locks the viewpoint pos) +#define CAMDBG_INCREASE_DISTANCE BTN_B | BTN_L +#define CAMDBG_DECREASE_DISTANCE BTN_A | BTN_L + +// Moving the point straigth forward or backward regardless of the viewpoint angle +#define CAMDBG_MOVE_BACKWARD BTN_DDOWN | BTN_L +#define CAMDBG_MOVE_FORWARD BTN_DUP | BTN_L + +// Moving the point forward or backward depending on the viewpoint angle +#define CAMDBG_VIEWPOINT_MOVE_BACKWARD BTN_B +#define CAMDBG_VIEWPOINT_MOVE_FORWARD BTN_A + +// Moving the point +#define CAMDBG_MOVE_UP BTN_DUP +#define CAMDBG_MOVE_DOWN BTN_DDOWN +#define CAMDBG_MOVE_RIGHT BTN_DRIGHT | BTN_L +#define CAMDBG_MOVE_RIGHT2 BTN_DRIGHT +#define CAMDBG_MOVE_LEFT BTN_DLEFT | BTN_L +#define CAMDBG_MOVE_LEFT2 BTN_DLEFT + +#define CAMDBG_UNK_B_L BTN_B | BTN_L +#define CAMDBG_UNK_A_L_2 BTN_A | BTN_L +#define CAMDBG_UNK_A_2 BTN_A +#define CAMDBG_UNK_B_2 BTN_A +#define CAMDBG_UNK_R_L BTN_R | BTN_L +#define CAMDBG_UNK_R BTN_R + +// Next menu +#define CAMDBG_NEXT_MENU BTN_CLEFT + +/* [CAMERA DEBUG TOOL] */ + +/* [CUTSCENE CAMERA TOOL] */ +// Button to play the cutscene +#define CAMDBG_CSTOOL_INIT_PLAYBACK BTN_CRIGHT +#define CAMDBG_CSTOOL_PLAYBACK BTN_CRIGHT + +// Related to playing back the cutscene +#define CAMDBG_CSTOOL_UNK_CRIGHT BTN_CRIGHT + +// Cuts the cutscene to the selected keyframe in edit mode +#define CAMDBG_CSTOOL_CUT_USE_COMBO true +#define CAMDBG_CSTOOL_CUT_BTNCOMBO_HOLD BTN_L +#define CAMDBG_CSTOOL_CUT BTN_R + +// *** Keyframe Edit Mode *** + +#define CAMDBG_CSTOOL_BTN_HOLD_FOR_COMBO BTN_L // used for printing the data and the pos data "copy" + +// Saves the currently edited keyframe +#define CAMDBG_CSTOOL_SAVE_EDITED_KEYFRAME BTN_R + +// "Copies" the data of the current keyframe to the next/previous one +// (in the code it just increase and decrease the keyframe index) +#define CAMDBG_CSTOOL_COPY_POSDATA_USE_COMBO true +#define CAMDBG_CSTOOL_COPY_POSDATA_PREV_KEYFRAME BTN_CUP +#define CAMDBG_CSTOOL_COPY_POSDATA_NEXT_KEYFRAME BTN_CDOWN + +// To choose the keyframe to edit +#define CAMDBG_CSTOOL_EDIT_PREV_KEYFRAME BTN_CUP +#define CAMDBG_CSTOOL_EDIT_NEXT_KEYFRAME BTN_CDOWN + +// *** Settings *** + +// Change the selected setting +#define CAMDBG_CSTOOL_SETTINGS_PREV BTN_DUP +#define CAMDBG_CSTOOL_SETTINGS_NEXT BTN_DDOWN + +// Increments or decrements the value of the selected setting +#define CAMDBG_CSTOOL_SETTINGS_DECR_VALUE BTN_DLEFT +#define CAMDBG_CSTOOL_SETTINGS_INCR_VALUE BTN_DRIGHT + +// Changes the value of the setting faster if held +#define CAMDBG_CSTOOL_SETTINGS_FASTER_CHANGE BTN_L + +// *** -------- *** + +// Dumps "spline" data on the IS64 console +#define CAMDBG_PRINT_DATA_USE_COMBO true +#define CAMDBG_PRINT_DATA BTN_CRIGHT + +/* [CUTSCENE CONTORL] */ + +// To choose the previous/next option +#define CAMDBG_CSCTRL_PREV_CHOICE BTN_DLEFT +#define CAMDBG_CSCTRL_NEXT_CHOICE BTN_DRIGHT + +// To change the current menu (export slots & Mempak menus) +#define CAMDBG_CSCTRL_PREV_MENU BTN_DUP +#define CAMDBG_CSCTRL_NEXT_MENU BTN_DDOWN + +// Changes the slot to use on the Mempak +#define CAMDBG_CSCTRL_PREV_MEMPAK_FILE BTN_DLEFT +#define CAMDBG_CSCTRL_NEXT_MEMPAK_FILE BTN_DRIGHT + +// To confirm a choice or going back to the previous menu +#define CAMDBG_CSCTRL_CONFIRM_CHOICE BTN_A +#define CAMDBG_CSCTRL_RETURN_TO_PREV_MENU BTN_B + +// To save or delete the cutscene on the selected slot +// WARNING: there's no confirmation if you want to delete the current export slot's data so be careful +#define CAMDBG_CSCTRL_SAVE_CS BTN_A +#define CAMDBG_CSCTRL_DELETE_CS BTN_B + +// cutscene playback from export slots +#define CAMDBG_CSCTRL_PLAY_PREV BTN_CUP +#define CAMDBG_CSCTRL_PLAY_NEXT BTN_CDOWN + +// load the cutscene data into the cs camera tool from the selected slot and deletes it +#define CAMDBG_CSCTRL_LOAD_CUR_SLOT BTN_R + +// Starts or stops the playback of the selected cutscene slot (if there's any data) +#define CAMDBG_CSCTRL_STOP_PLAYBACK BTN_CLEFT +#define CAMDBG_CSCTRL_START_PLAYBACK BTN_CRIGHT + +// Hold and use D-Pad Left/Right to change the location of the selected cutscene slot +#define CAMDBG_CSCTRL_HOLD_TO_CHANGE_SLOT BTN_L + +// Hold and press ``CAMDBG_CSCTRL_PRINT_BYTES`` to dump the bytes of the cutscene data (as a C array) +#define CAMDBG_CSCTRL_BTN_HOLD_FOR_COMBO BTN_L +#define CAMDBG_CSCTRL_PRINT_BYTES BTN_CLEFT + #endif diff --git a/include/config/config_debug_features.h b/include/config/config_debug_features.h index 6ed23715d8..6877054bc2 100644 --- a/include/config/config_debug_features.h +++ b/include/config/config_debug_features.h @@ -45,7 +45,7 @@ // #define ENABLE_FRAMERATE_OPTIONS /**** [MAP SELECT] ****/ -// #define ENABLE_MAP_SELECT +#define ENABLE_MAP_SELECT /**** [DEBUG FILE 1] ****/ #define ENABLE_DEBUG_SAVE @@ -79,13 +79,13 @@ // #define ENABLE_CAMERA_DEBUGGER /**** [AUDIO DEBUGGER] ****/ -// #define ENABLE_AUDIO_DEBUGGER +// #define ENABLE_AUDIO_DEBUGGER // TODO: controls /**** [ACTOR DEBUGGER] ****/ // #define ENABLE_ACTOR_DEBUGGER /**** [MESSAGES DEBUGGER] ****/ -// #define ENABLE_MSG_DEBUGGER +// #define ENABLE_MSG_DEBUGGER // TODO: a better debugger, for now use the regs editor to change the text id (YREG(79)) /**** [SPEEDMETER] ****/ // This looks like a profiler diff --git a/include/config/config_safeguards.h b/include/config/config_safeguards.h index 84e71e66f7..63a6b3cc0c 100644 --- a/include/config/config_safeguards.h +++ b/include/config/config_safeguards.h @@ -14,7 +14,7 @@ * config_debug.h */ #ifndef DEBUG_ROM - #define DISABLE_DEBUG_FEATURES + // #define DISABLE_DEBUG_FEATURES #undef DETERMINISTIC_BUILD #undef SKIP_N64_BOOT_LOGO #undef BOOT_TO_SCENE diff --git a/include/macros.h b/include/macros.h index fc0615266a..cbb9017cec 100644 --- a/include/macros.h +++ b/include/macros.h @@ -105,6 +105,10 @@ #define CHECK_BTN_ALL(state, combo) (~((state) | ~(combo)) == 0) #define CHECK_BTN_ANY(state, combo) (((state) & (combo)) != 0) +#define USE_BTN_COMBO(isUsingCombo, input, btnToHold) ((isUsingCombo) ? CHECK_BTN_ALL((input)->cur.button, (btnToHold)) : true) +#define CHECK_BTN_COMBO(isUsingCombo, input, btnToHold, btnsToPress) \ + USE_BTN_COMBO(isUsingCombo, input, btnToHold) && CHECK_BTN_ALL((input)->press.button, btnsToPress) + #define CHECK_FLAG_ALL(flags, mask) (((flags) & (mask)) == (mask)) diff --git a/include/z64.h b/include/z64.h index a81d595db7..548230801d 100644 --- a/include/z64.h +++ b/include/z64.h @@ -888,6 +888,9 @@ typedef struct PlayState { /* 0x1242B */ u8 viewpoint; // toggleable camera setting by shops or player. Is also equal to the bgCamIndex + 1 /* 0x1242C */ SceneTableEntry* loadedScene; /* 0x12430 */ char unk_12430[0xE8]; +#ifdef ENABLE_MSG_DEBUGGER + u8 enableMsgDbg; +#endif } PlayState; // size = 0x12518 typedef struct { diff --git a/include/z64pause.h b/include/z64pause.h index 7c355411e1..5781bf96b8 100644 --- a/include/z64pause.h +++ b/include/z64pause.h @@ -54,7 +54,7 @@ typedef struct { /* 0x01B8 */ OSMesgQueue loadQueue; /* 0x01D0 */ OSMesg loadMsg; /* 0x01D4 */ u16 state; -#if (defined ENABLE_INV_EDITOR && defined ENABLE_EVENT_EDITOR) +#if (defined ENABLE_INV_EDITOR || defined ENABLE_EVENT_EDITOR) /* 0x01D6 */ u16 debugState; #endif /* 0x01D8 */ Vec3f eye; diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index 3b6320b85a..faef6e1c25 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -534,11 +534,6 @@ void DmaMgr_Init(void) { sDmaMgrIsRomCompressed = true; } - osSyncPrintf( - "%3d %08x %08x %08x %08x %08x %c %s\n", idx, iter->vromStart, iter->vromEnd, iter->romStart, iter->romEnd, - (iter->romEnd != 0) ? iter->romEnd - iter->romStart : iter->vromEnd - iter->vromStart, - (((iter->romEnd != 0) ? iter->romEnd - iter->romStart : 0) > 0x10000) ? '*' : ' ', name ? *name : ""); - idx++; iter++; diff --git a/src/code/db_camera.c b/src/code/db_camera.c index 27b99e96b9..7a9cf7466d 100644 --- a/src/code/db_camera.c +++ b/src/code/db_camera.c @@ -4,81 +4,182 @@ #include "global.h" -#define DBCAM_CONTROLLER_PORT 2 +#define DBCAM_CONTROLLER_PORT CAMDBG_CONTROLLER_PORT static PlayState* sPlay; // TODO: cleanup these arrays and UB access -char* D_8012CEE0[] = { GFXP_KATAKANA "キ-フレ-ム" GFXP_HIRAGANA "ガ" }; -char* D_8012CEE4 = GFXP_HIRAGANA "タリマセン。"; -char* D_8012CEE8 = GFXP_HIRAGANA "サイセイデキマセン"; -char* D_8012CEEC = GFXP_HIRAGANA "サイセイシュウリョウ"; -char* D_8012CEF0 = GFXP_HIRAGANA "サイセイチュウ!"; - -char* D_8012CEF4 = "DEMO CAMERA TOOL"; -char* D_8012CEF8[] = { GFXP_HIRAGANA "モウハイリマセン", GFXP_HIRAGANA "トウロク テンメ", GFXP_HIRAGANA "ヘンコウ / " }; +// char* D_8012CEE0[] = { GFXP_KATAKANA "キ-フレ-ム" GFXP_HIRAGANA "ガ" }; +char* D_8012CEE0[] = { "keyframes" }; + +// char* D_8012CEE4 = GFXP_HIRAGANA "タリマセン。"; +char* D_8012CEE4 = "not enough"; + +// char* D_8012CEE8 = GFXP_HIRAGANA "サイセイデキマセン"; +char* D_8012CEE8 = "unable to play cutscene"; + +// char* D_8012CEEC = GFXP_HIRAGANA "サイセイシュウリョウ"; +char* D_8012CEEC = "playback complete"; + +// char* D_8012CEF0 = GFXP_HIRAGANA "サイセイチュウ!"; +char* D_8012CEF0 = "playing!"; + +// char* D_8012CEF4 = "DEMO CAMERA TOOL"; +char* D_8012CEF4 = "CUTSCENE CAMERA TOOL"; + +// char* D_8012CEF8[] = { GFXP_HIRAGANA "モウハイリマセン", GFXP_HIRAGANA "トウロク テンメ", GFXP_HIRAGANA "ヘンコウ / " }; +char* D_8012CEF8[] = { "no more", GFXP_HIRAGANA "トウロク テンメ", "edit / " }; +// edit as in "edit keyframe X", the other can be translated as "register" + char* D_8012CF04 = "> >"; char* D_8012CF08 = "< <"; char* D_8012CF0C = "< >"; -char* D_8012CF10 = GFXP_KATAKANA "*プレイヤ-*"; -char* D_8012CF14 = GFXP_KATAKANA "Eモ-ド" GFXP_HIRAGANA " ソウタイ"; -char* D_8012CF18[] = { GFXP_KATAKANA "Eモ-ド" GFXP_HIRAGANA "ゼッタイ", GFXP_HIRAGANA "ガメン" GFXP_KATAKANA " デモ", - GFXP_HIRAGANA "ガメン フツウ" }; -char* D_8012CF24[] = { GFXP_HIRAGANA "Pジカン MAX", GFXP_KATAKANA "リンク" GFXP_HIRAGANA " キオク", - GFXP_KATAKANA "リンク" GFXP_HIRAGANA " ムシ" }; -char* D_8012CF30 = GFXP_HIRAGANA "*ミテルイチ*"; -char* D_8012CF34 = GFXP_KATAKANA "*カメラ" GFXP_HIRAGANA "イチ*"; + +// char* D_8012CF10 = GFXP_KATAKANA "*プレイヤ-*"; +char* D_8012CF10 = "*Player*"; + +// char* D_8012CF14 = GFXP_KATAKANA "Eモ-ド" GFXP_HIRAGANA " ソウタイ"; +char* D_8012CF14 = "E-Mode Relative"; + +// char* D_8012CF18[] = { GFXP_KATAKANA "Eモ-ド" GFXP_HIRAGANA "ゼッタイ", GFXP_HIRAGANA "ガメン" GFXP_KATAKANA " デモ", +// GFXP_HIRAGANA "ガメン フツウ" }; +char* D_8012CF18[] = { "E-Mode Absolute", "cutscene screen", + "normal screen" }; + +// char* D_8012CF24[] = { GFXP_HIRAGANA "Pジカン MAX", GFXP_KATAKANA "リンク" GFXP_HIRAGANA " キオク", +// GFXP_KATAKANA "リンク" GFXP_HIRAGANA " ムシ" }; +// P-Time -> play time, the number of frames the cs will play +char* D_8012CF24[] = { "P-Time MAX", "Link" GFXP_HIRAGANA " キオク", + "Link" GFXP_HIRAGANA " ムシ" }; + +// char* D_8012CF30 = GFXP_HIRAGANA "*ミテルイチ*"; +char* D_8012CF30 = "*Viewpoint*"; + +// char* D_8012CF34 = GFXP_KATAKANA "*カメラ" GFXP_HIRAGANA "イチ*"; +char* D_8012CF34 = "Camera 1"; + char* D_8012CF38 = "DEBUG CAMERA"; -char* D_8012CF3C = GFXP_KATAKANA "センタ-/ロック"; -char* D_8012CF40 = GFXP_KATAKANA "センタ-/フリ-"; - -char* D_8012CF44 = "DEMO CONTROL"; -char* D_8012CF48 = GFXP_KATAKANA "メモリ" GFXP_HIRAGANA "ガタリマセン"; -char* D_8012CF4C = "p"; -char* D_8012CF50[] = { "e", "s", "l", "c" }; - -char* D_8012CF60[] = { GFXP_KATAKANA "メモリパック" }; // "Mempak" -char* D_8012CF64 = GFXP_KATAKANA "セーブ"; // "Save" -char* D_8012CF68 = GFXP_KATAKANA "ロード"; // "Load" -char* D_8012CF6C = GFXP_KATAKANA "クリア-"; // "Clear" -char* D_8012CF70 = GFXP_HIRAGANA "ヲヌカナイデネ"; - -char* D_8012CF74 = "FREE BYTE"; -char* D_8012CF78 = "NEED BYTE"; -char* D_8012CF7C = GFXP_KATAKANA "*メモリ-パック*"; -char* D_8012CF80 = GFXP_HIRAGANA "ヲミツケラレマセン"; -char* D_8012CF84 = GFXP_KATAKANA "ファイル " GFXP_HIRAGANA "ヲ"; -char* D_8012CF88[] = { GFXP_HIRAGANA "シテモイイデスカ?", GFXP_HIRAGANA "ゲンザイヘンシュウチュウノ", - GFXP_KATAKANA "ファイル" GFXP_HIRAGANA "ハハキサレマス" }; -char* D_8012CF94 = GFXP_HIRAGANA "ハイ"; -char* D_8012CF98 = GFXP_HIRAGANA "イイエ"; -char* D_8012CF9C[] = { GFXP_HIRAGANA "シテイマス", GFXP_HIRAGANA "ウワガキ" }; -char* D_8012CFA4 = GFXP_HIRAGANA "シマシタ"; + +// char* D_8012CF3C = GFXP_KATAKANA "センタ-/ロック"; +char* D_8012CF3C = "center/lock"; + +// char* D_8012CF40 = GFXP_KATAKANA "センタ-/フリ-"; +char* D_8012CF40 = "center/free"; + +// char* D_8012CF44 = "DEMO CONTROL"; +char* D_8012CF44 = "CUTSCENE CONTROL"; + +// char* D_8012CF48 = GFXP_KATAKANA "メモリ" GFXP_HIRAGANA "ガタリマセン"; +char* D_8012CF48 = "out of memory"; + +char* D_8012CF4C = "p"; // playing +char* D_8012CF50[] = { "e", "s", "l", "c" }; // export, save, load, clear + +// char* D_8012CF60[] = { GFXP_KATAKANA "メモリパック" }; // "Mempak" +char* D_8012CF60[] = { "Mempak" }; + +// char* D_8012CF64 = GFXP_KATAKANA "セーブ"; // "Save" +char* D_8012CF64 = "Save"; + +// char* D_8012CF68 = GFXP_KATAKANA "ロード"; // "Load" +char* D_8012CF68 = "Load"; + +// char* D_8012CF6C = GFXP_KATAKANA "クリア-"; // "Clear" +char* D_8012CF6C = "Clear"; + +// char* D_8012CF70 = GFXP_HIRAGANA "ヲヌカナイデネ"; +char* D_8012CF70 = "do not remove the"; + +char* D_8012CF74 = "FREE BYTES"; +char* D_8012CF78 = "NEED BYTES"; + +// char* D_8012CF7C = GFXP_KATAKANA "*メモリ-パック*"; +char* D_8012CF7C = "*Mempak*"; + +// char* D_8012CF80 = GFXP_HIRAGANA "ヲミツケラレマセン"; +char* D_8012CF80 = "not found"; + +// char* D_8012CF84 = GFXP_KATAKANA "ファイル " GFXP_HIRAGANA "ヲ"; +char* D_8012CF84 = "FILE" GFXP_HIRAGANA "ヲ"; // "File 1"? // ??? + +// char* D_8012CF88[] = { GFXP_HIRAGANA "シテモイイデスカ?", GFXP_HIRAGANA "ゲンザイヘンシュウチュウノ", +// GFXP_KATAKANA "ファイル" GFXP_HIRAGANA "ハハキサレマス" }; +char* D_8012CF88[] = { "Are you sure?", "The currently edited", "file will be deleted" }; + +// char* D_8012CF94 = GFXP_HIRAGANA "ハイ"; +// char* D_8012CF98 = GFXP_HIRAGANA "イイエ"; +char* D_8012CF94 = "Yes"; +char* D_8012CF98 = "No"; + +// char* D_8012CF9C[] = { GFXP_HIRAGANA "シテイマス", GFXP_HIRAGANA "ウワガキ" }; +char* D_8012CF9C[] = { "overwrite", "now" }; + +// char* D_8012CFA4 = GFXP_HIRAGANA "シマシタ"; +char* D_8012CFA4 = "Done"; + char* D_8012CFA8 = "USE BYTE"; -char* D_8012CFAC = GFXP_HIRAGANA "ニシッパイ"; - -char* D_8012CFB0 = GFXP_KATAKANA "Eモ-ド" GFXP_HIRAGANA " コテイ"; -char D_8012CFB4[] = GFXP_KATAKANA "フレ-ム "; -char D_8012CFC4[] = GFXP_KATAKANA "キ- / "; -char D_8012CFD0[] = GFXP_HIRAGANA "(センタ-テン)\0\0\0\0\0"; -char D_8012CFE4[] = GFXP_HIRAGANA "(ゲンテン)\0\0\0\0\0\0"; -char D_8012CFF8[] = GFXP_KATAKANA "(プレイヤ-)\0\0\0\0\0"; -char D_8012D00C[] = GFXP_HIRAGANA "(イチアワセ)\0\0\0\0\0\0"; -char D_8012D020[] = GFXP_HIRAGANA "(セッテイ)\0\0\0\0\0\0\0\0"; -char D_8012D034[] = GFXP_HIRAGANA "(キャッカン)\0\0\0\0\0\0"; -char D_8012D048[] = GFXP_KATAKANA "ポイントNo. \0\0\0"; -char D_8012D05C[] = GFXP_HIRAGANA "ガカク \0\0\0"; -char D_8012D070[] = GFXP_KATAKANA "Nフレ-ム \0\0\0\0"; -char D_8012D084[] = GFXP_HIRAGANA "Zカイテン \0\0\0"; -char D_8012D098[] = GFXP_KATAKANA "モ-ド \0\0\0\0"; -char D_8012D0AC[] = " R" GFXP_HIRAGANA "チュウシン \0\0\0"; - -char D_8012D0C0[] = GFXP_HIRAGANA "Pジカン \0\0"; -char D_8012D0D4[] = GFXP_HIRAGANA "キョリ \0"; -char D_8012D0E4[] = GFXP_HIRAGANA "Xカイテン \0\0"; -char D_8012D0F8[] = GFXP_HIRAGANA "Yカイテン \0\0"; - -#define ACTION_E 0 + +// char* D_8012CFAC = GFXP_HIRAGANA "ニシッパイ"; +char* D_8012CFAC = "failed to"; // ??? + +// char* D_8012CFB0 = GFXP_KATAKANA "Eモ-ド" GFXP_HIRAGANA " コテイ"; +char* D_8012CFB0 = "E-Mode Fixed"; + +// char D_8012CFB4[] = GFXP_KATAKANA "フレ-ム "; +char D_8012CFB4[] = "Frame "; + +// char D_8012CFC4[] = GFXP_KATAKANA "キ- / "; +char D_8012CFC4[] = "Key / "; // keyframe + +// char D_8012CFD0[] = GFXP_HIRAGANA "(センタ-テン)\0\0\0\0\0"; +char D_8012CFD0[] = "(Center 10)\0\0\0\0\0"; // ??? + +// char D_8012CFE4[] = GFXP_HIRAGANA "(ゲンテン)\0\0\0\0\0\0"; +char D_8012CFE4[] = "(Origin)\0\0\0\0\0\0"; + +// char D_8012CFF8[] = GFXP_KATAKANA "(プレイヤ-)\0\0\0\0\0"; +char D_8012CFF8[] = "(Player)\0\0\0\0\0"; + +// char D_8012D00C[] = GFXP_HIRAGANA "(イチアワセ)\0\0\0\0\0\0"; +char D_8012D00C[] = "(Alignment)\0\0\0\0\0\0"; + +// char D_8012D020[] = GFXP_HIRAGANA "(セッテイ)\0\0\0\0\0\0\0\0"; +char D_8012D020[] = "(Settings)\0\0\0\0\0\0\0\0"; + +// char D_8012D034[] = GFXP_HIRAGANA "(キャッカン)\0\0\0\0\0\0"; +char D_8012D034[] = "(Object)\0\0\0\0\0\0"; + +// char D_8012D048[] = GFXP_KATAKANA "ポイントNo. \0\0\0"; +char D_8012D048[] = "Point No. \0\0\0"; + +// char D_8012D05C[] = GFXP_HIRAGANA "ガカク \0\0\0"; +char D_8012D05C[] = "View Angle \0\0\0"; + +// char D_8012D070[] = GFXP_KATAKANA "Nフレ-ム \0\0\0\0"; +char D_8012D070[] = "N-Frame \0\0\0\0"; // framecount + +// char D_8012D084[] = GFXP_HIRAGANA "Zカイテン \0\0\0"; +char D_8012D084[] = "Z-Rot \0\0\0"; + +// char D_8012D098[] = GFXP_KATAKANA "モ-ド \0\0\0\0"; +char D_8012D098[] = "MODE \0\0\0\0"; + +// char D_8012D0AC[] = " R" GFXP_HIRAGANA "チュウシン \0\0\0"; +char D_8012D0AC[] = " R-Focus \0\0\0"; // ``チュウシン`` can also be translated as "center" + +// char D_8012D0C0[] = GFXP_HIRAGANA "Pジカン \0\0"; +char D_8012D0C0[] = "P-Time \0\0"; // play time, as in the number of frames the cutscene has been played + +// char D_8012D0D4[] = GFXP_HIRAGANA "キョリ \0"; +char D_8012D0D4[] = "distance \0"; + +// char D_8012D0E4[] = GFXP_HIRAGANA "Xカイテン \0\0"; +char D_8012D0E4[] = "X-Rot \0\0"; + +// char D_8012D0F8[] = GFXP_HIRAGANA "Yカイテン \0\0"; +char D_8012D0F8[] = "Y-Rot \0\0"; + +#define ACTION_E 0 // Export #define ACTION_SAVE 1 #define ACTION_LOAD 2 #define ACTION_CLEAR 3 @@ -96,7 +197,7 @@ s32 DbCamera_ClearCallback(char* c); s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam); static DbCamera* sDbCamPtr; -static s16 D_8016110C; +static s16 D_8016110C; // export cutscene slot index ('A' to 'O') static DbCameraAnim sDbCamAnim; Vec3f* DbCamera_AddVecGeoToVec3f(Vec3f* dest, Vec3f* a, VecGeo* geo) { @@ -349,7 +450,7 @@ s32 func_800B4370(DbCamera* dbCamera, s16 idx, Camera* cam) { void func_800B44E0(DbCamera* dbCamera, Camera* cam) { s32 i; - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_CRIGHT)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSTOOL_INIT_PLAYBACK)) { sDbCamAnim.keyframe = 0; sDbCamAnim.unk_0A = 1; sDbCamAnim.curFrame = 0.0f; @@ -600,7 +701,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { sp80 = &dbCamera->eye; sp7C = &dbCamera->at; - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_Z)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CHANGE_TOOL)) { dbCamera->unk_00++; dbCamera->unk_00 %= 3; dbCamera->unk_38 = 1; @@ -608,8 +709,10 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_40 = -1; dbCamera->sub.demoCtrlActionIdx = 0; sDbCamAnim.unk_0A = 0; - Audio_PlaySfxGeneral(NA_SE_SY_LOCK_ON, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, - &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + if (CAMDBG_PLAY_SOUNDS) { + Audio_PlaySfxGeneral(NA_SE_SY_LOCK_ON, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, + &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); + } } else if (dbCamera->unk_38 == -1) { dbCamera->unk_38 = 1; } else { @@ -681,6 +784,8 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 100; } + // osSyncPrintf("dbCamera->unk_38: %d\n", dbCamera->unk_38); + new_var2 = ((dbCamera->unk_44 * 0.15f) + 0.2f); temp_f2 = new_var2 * (sp104.r / 100.0f); if ((dbCamera->unk_38 != 0) || dbCamera->unk_3C) { @@ -691,7 +796,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } dbCamera->unk_3C = D_80161140; - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_B | BTN_L)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_UNK_B_L)) { sp104.r += temp_f2; if (sp104.r > 30000.0f) { @@ -705,7 +810,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } dbCamera->unk_40 = 7; - } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_B)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_UNK_B_2)) { spFC = sp104; spFC.r = temp_f2; if (!D_80161144) { @@ -722,7 +827,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 0xB; - } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_A | BTN_L)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_UNK_A_L_2)) { sp104.r -= temp_f2; if (sp104.r < 10.0f) { sp104.r = 10.0f; @@ -733,7 +838,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 8; - } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_A)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_UNK_A_2)) { spFC = sp104; spFC.r = -temp_f2; if (!D_80161144) { @@ -755,7 +860,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_40 = -1; } - } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_DDOWN | BTN_L)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_MOVE_BACKWARD)) { spFC = sp104; spFC.r = temp_f2; spFC.pitch = 0; @@ -773,7 +878,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 1; - } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_DUP | BTN_L)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_MOVE_FORWARD)) { spFC = sp104; spFC.r = -temp_f2; spFC.pitch = 0; @@ -790,7 +895,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 2; - } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_DUP)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_MOVE_UP)) { spFC = sp104; spFC.r = temp_f2; spFC.pitch = 0x3FFF; @@ -806,7 +911,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 3; - } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_DDOWN)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_MOVE_DOWN)) { spFC = sp104; spFC.r = temp_f2; spFC.pitch = -0x3FFF; @@ -822,8 +927,8 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 4; - } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, (BTN_DRIGHT | BTN_L)) || - CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_DRIGHT)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, (CAMDBG_MOVE_RIGHT)) || + CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_MOVE_RIGHT2)) { spFC = sp104; spFC.r = temp_f2; spFC.pitch = 0; @@ -840,8 +945,8 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 5; - } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, (BTN_DLEFT | BTN_L)) || - CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_DLEFT)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, (CAMDBG_MOVE_LEFT)) || + CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_MOVE_LEFT2)) { spFC = sp104; spFC.r = temp_f2; spFC.pitch = 0; @@ -858,7 +963,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 6; - } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_B | BTN_L)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_INCREASE_DISTANCE)) { sp104.r = sp104.r + temp_f2; if (sp104.r > 30000.0f) { sp104.r = 30000.0f; @@ -869,7 +974,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 7; - } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_B)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_VIEWPOINT_MOVE_BACKWARD)) { spFC = sp104; spFC.r = temp_f2; if (!D_80161144) { @@ -886,8 +991,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 0xB; - } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_A | BTN_L)) { - + } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_DECREASE_DISTANCE)) { sp104.r -= temp_f2; if (sp104.r < 10.0f) { sp104.r = 10.0f; @@ -898,7 +1002,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_44 = 0; } dbCamera->unk_40 = 8; - } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_A)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_VIEWPOINT_MOVE_FORWARD)) { spFC = sp104; spFC.r = -temp_f2; if (!D_80161144) { @@ -920,8 +1024,9 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_40 = -1; } - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_R)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_UNK_R)) { if (dbCamera->unk_00 == 0) { + // if using debug camera tool, reset position to the original cam pos dbCamera->sub.unk_104A = cam->inputDir; *sp7C = cam->at; *sp80 = cam->eye; @@ -929,19 +1034,21 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->unk_1C.z = 0.0f; dbCamera->unk_1C.y = 1.0f; } else if (dbCamera->sub.unk_08 == 2) { + // if using demo camera tool with object mode + // reset position like above or reset position to the current keyframe's if in edit mode Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); dbCamera->sub.unk_08 = 0; func_800B41DC(dbCamera, dbCamera->sub.unkIdx, cam); } else { - - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_R) && - CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_L)) { + if (CHECK_BTN_COMBO(CAMDBG_CSTOOL_CUT_USE_COMBO, + &sPlay->state.input[DBCAM_CONTROLLER_PORT], CAMDBG_CSTOOL_CUT_BTNCOMBO_HOLD, CAMDBG_CSTOOL_CUT)) { + // cuts the cutscene to the selected keyframe in edit mode Audio_PlaySfxGeneral(NA_SE_SY_CANCEL, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); dbCamera->sub.nPoints = dbCamera->sub.unkIdx + 1; func_800B4088(dbCamera, cam); - } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_R)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSTOOL_SAVE_EDITED_KEYFRAME)) { if (dbCamera->sub.unkIdx == 0x80) { Audio_PlaySfxGeneral(NA_SE_SY_ERROR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -980,7 +1087,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { DbCamera_CalcUpFromPitchYawRoll(&dbCamera->unk_1C, spF4.pitch, spF4.yaw, CAM_DEG_TO_BINANG(dbCamera->rollDegrees)); if (dbCamera->unk_00 == 1) { - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_CRIGHT)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_CSTOOL_UNK_CRIGHT)) { cam->inputDir = dbCamera->sub.unk_104A; new_var2 = OLib_Vec3fDist(&cam->at, &cam->eye); cam->at = *sp7C; @@ -992,14 +1099,15 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } if (dbCamera->unk_00 == 1) { + // demo camera tool OREG(0) = 8; 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)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_CSTOOL_PLAYBACK) && + !CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_CSTOOL_BTN_HOLD_FOR_COMBO)) { func_800B44E0(dbCamera, cam); } else { - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_CRIGHT) && - CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_L)) { + if (CHECK_BTN_COMBO(CAMDBG_PRINT_DATA_USE_COMBO, + &sPlay->state.input[DBCAM_CONTROLLER_PORT], CAMDBG_CSTOOL_BTN_HOLD_FOR_COMBO, CAMDBG_PRINT_DATA)) { Audio_PlaySfxGeneral(NA_SE_SY_GET_RUPY, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); osSyncPrintf("@@@\n@@@\n@@@/* *** spline point data ** start here *** */\n@@@\n"); @@ -1009,14 +1117,16 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { osSyncPrintf("@@@static short nFrames = %d;\n@@@\n", dbCamera->sub.nFrames); osSyncPrintf("@@@static short Mode = %d;\n@@@\n", dbCamera->sub.mode); osSyncPrintf("@@@\n@@@\n@@@/* *** spline point data ** finish! *** */\n@@@\n"); - } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_CLEFT)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_NEXT_MENU)) { Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); dbCamera->sub.unk_08 = (dbCamera->sub.unk_08 + 1) % 3; } - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_CUP) && - CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_L)) { + if (CHECK_BTN_COMBO(CAMDBG_CSTOOL_COPY_POSDATA_USE_COMBO, + &sPlay->state.input[DBCAM_CONTROLLER_PORT], CAMDBG_CSTOOL_BTN_HOLD_FOR_COMBO, CAMDBG_CSTOOL_COPY_POSDATA_PREV_KEYFRAME)) { + // decrements the keyframe index + // the side effect of this is having the current pos data on the previous keyframe Audio_PlaySfxGeneral(NA_SE_IT_SWORD_IMPACT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (dbCamera->sub.unkIdx > 0) { @@ -1025,7 +1135,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->sub.unkIdx = dbCamera->sub.nPoints - 1; } } else { - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_CUP)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSTOOL_EDIT_PREV_KEYFRAME)) { Audio_PlaySfxGeneral(NA_SE_IT_SWORD_IMPACT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (dbCamera->sub.unkIdx > 0) { @@ -1046,8 +1156,11 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } } } - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_L) && - CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_CDOWN)) { + + if (CHECK_BTN_COMBO(CAMDBG_CSTOOL_COPY_POSDATA_USE_COMBO, + &sPlay->state.input[DBCAM_CONTROLLER_PORT], CAMDBG_CSTOOL_BTN_HOLD_FOR_COMBO, CAMDBG_CSTOOL_COPY_POSDATA_NEXT_KEYFRAME)) { + // increments the keyframe index + // the side effect of this is having the current pos data on the next keyframe Audio_PlaySfxGeneral(NA_SE_IT_SWORD_IMPACT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (dbCamera->sub.unkIdx < (dbCamera->sub.nPoints - 1)) { @@ -1056,7 +1169,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->sub.unkIdx = 0; } } else { - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_CDOWN)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSTOOL_EDIT_NEXT_KEYFRAME)) { Audio_PlaySfxGeneral(NA_SE_IT_SWORD_IMPACT, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (dbCamera->sub.unkIdx < (dbCamera->sub.nPoints - 1)) { @@ -1129,7 +1242,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { break; case 1: dbCamera->unk_3C = true; - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_DUP)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSTOOL_SETTINGS_PREV)) { Audio_PlaySfxGeneral(NA_SE_SY_ATTENTION_ON, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (dbCamera->sub.unk_0A == 0) { @@ -1138,7 +1251,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->sub.unk_0A--; } } - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_DDOWN)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSTOOL_SETTINGS_NEXT)) { Audio_PlaySfxGeneral(NA_SE_SY_ATTENTION_ON, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (dbCamera->sub.unk_0A == 5) { @@ -1147,12 +1260,12 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->sub.unk_0A++; } } - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_DLEFT)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSTOOL_SETTINGS_DECR_VALUE)) { Audio_PlaySfxGeneral(NA_SE_SY_ATTENTION_ON, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); switch (dbCamera->sub.unk_0A) { case 1: - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_CSTOOL_SETTINGS_FASTER_CHANGE)) { dbCamera->sub.lookAt[dbCamera->sub.unkIdx].nextPointFrame -= 5; } else { dbCamera->sub.lookAt[dbCamera->sub.unkIdx].nextPointFrame--; @@ -1184,7 +1297,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->sub.unk_0C = false; break; case 2: - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_CSTOOL_SETTINGS_FASTER_CHANGE)) { dbCamera->sub.lookAt[dbCamera->sub.unkIdx].cameraRoll -= 5; dbCamera->roll = dbCamera->sub.lookAt[dbCamera->sub.unkIdx].cameraRoll; } else { @@ -1196,7 +1309,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } } - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_DLEFT)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_CSTOOL_SETTINGS_DECR_VALUE)) { if ((D_8012D10C++ % 5) == 0) { Audio_PlaySfxGeneral(NA_SE_SY_ATTENTION_ON, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -1204,7 +1317,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { switch (dbCamera->sub.unk_0A) { case 0: - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_CSTOOL_SETTINGS_FASTER_CHANGE)) { dbCamera->sub.lookAt[dbCamera->sub.unkIdx].viewAngle -= 1.0f; dbCamera->fov = dbCamera->sub.lookAt[dbCamera->sub.unkIdx].viewAngle; } else { @@ -1213,7 +1326,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } break; case 5: - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_CSTOOL_SETTINGS_FASTER_CHANGE)) { dbCamera->sub.nFrames -= 10; } else { dbCamera->sub.nFrames--; @@ -1235,13 +1348,13 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } } - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_DRIGHT)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSTOOL_SETTINGS_INCR_VALUE)) { Audio_PlaySfxGeneral(NA_SE_SY_ATTENTION_ON, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); switch (dbCamera->sub.unk_0A) { case 1: - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_CSTOOL_SETTINGS_FASTER_CHANGE)) { dbCamera->sub.lookAt[dbCamera->sub.unkIdx].nextPointFrame += 5; } else { dbCamera->sub.lookAt[dbCamera->sub.unkIdx].nextPointFrame++; @@ -1273,7 +1386,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { dbCamera->sub.unk_0C = true; break; case 2: - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_CSTOOL_SETTINGS_FASTER_CHANGE)) { dbCamera->sub.lookAt[dbCamera->sub.unkIdx].cameraRoll += 5; dbCamera->roll = dbCamera->sub.lookAt[dbCamera->sub.unkIdx].cameraRoll; } else { @@ -1284,7 +1397,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { break; } } - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_DRIGHT)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_CSTOOL_SETTINGS_INCR_VALUE)) { if ((D_8012D10C++ % 5) == 0) { Audio_PlaySfxGeneral(NA_SE_SY_ATTENTION_ON, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -1292,7 +1405,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { switch (dbCamera->sub.unk_0A) { case 0: - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_CSTOOL_SETTINGS_FASTER_CHANGE)) { dbCamera->sub.lookAt[dbCamera->sub.unkIdx].viewAngle += 1.0f; dbCamera->fov = dbCamera->sub.lookAt[dbCamera->sub.unkIdx].viewAngle; } else { @@ -1301,7 +1414,7 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } break; case 5: - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_CSTOOL_SETTINGS_FASTER_CHANGE)) { dbCamera->sub.nFrames += 10; } else { dbCamera->sub.nFrames++; @@ -1444,11 +1557,12 @@ void DbCamera_Update(DbCamera* dbCamera, Camera* cam) { } } } else { + // debug camera OREG(0) = 8; dbCamera->roll = 0; dbCamera->fov = 60.0f; - dbCamera->rollDegrees = dbCamera->roll * 1.40625f; - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_CLEFT)) { + dbCamera->rollDegrees = dbCamera->roll * 1.40625f; // dbCamera->roll * (45 / 32) + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_NEXT_MENU)) { Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); dbCamera->unk_78 = (dbCamera->unk_78 + 1) % 3; @@ -1524,6 +1638,7 @@ static char sLetters[26]; static char D_801612EA; static s32 sAllocSize; +// DbCamera_GetFirstAvailableCutsceneSlot s32 DbCamera_GetFirstAvailableLetter(void) { s32 i; @@ -1756,9 +1871,12 @@ void DbCamera_PrintAllCuts(Camera* cam) { osSyncPrintf("@@@\n@@@\n@@@/* ****** spline point data ** finish! ***** */\n@@@\n"); } -char D_8012D114[] = GFXP_KATAKANA "フレ-ム "; -char D_8012D128[] = GFXP_KATAKANA "ト-タル "; -char D_8012D13C[] = GFXP_KATAKANA "キ- / "; +// char D_8012D114[] = GFXP_KATAKANA "フレ-ム "; +char D_8012D114[] = "Frame "; +// char D_8012D128[] = GFXP_KATAKANA "ト-タル "; +char D_8012D128[] = "Total "; +// char D_8012D13C[] = GFXP_KATAKANA "キ- / "; +char D_8012D13C[] = "Key / "; s32 func_800B91B0(Camera* cam, DbCamera* dbCamera) { s32 pointCount; @@ -1881,8 +1999,8 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { case DEMO_CTRL_MENU(ACTION_LOAD, MENU_INFO): case DEMO_CTRL_MENU(ACTION_CLEAR, MENU_INFO): { if ((1 << sCurFileIdx) & sMempakFiles) { - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_DLEFT) || - CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_DRIGHT)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_PREV_CHOICE) || + CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_NEXT_CHOICE)) { Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); dbCamera->sub.demoCtrlToggleSwitch ^= 1; @@ -1900,7 +2018,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { 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 (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_CONFIRM_CHOICE)) { if (dbCamera->sub.demoCtrlToggleSwitch == 0) { Audio_PlaySfxGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -1925,7 +2043,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { "PRESS B BUTTON"); } } - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_B)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_RETURN_TO_PREV_MENU)) { Audio_PlaySfxGeneral(NA_SE_SY_CANCEL, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); dbCamera->sub.demoCtrlMenu = 0; @@ -1964,8 +2082,8 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { 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)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_CONFIRM_CHOICE) || + CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_RETURN_TO_PREV_MENU)) { Audio_PlaySfxGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (dbCamera->sub.demoCtrlMenu == DEMO_CTRL_MENU(ACTION_LOAD, MENU_SUCCESS)) { @@ -1990,8 +2108,8 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { 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)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_CONFIRM_CHOICE) || + CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_RETURN_TO_PREV_MENU)) { Audio_PlaySfxGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); dbCamera->sub.demoCtrlMenu -= 9; @@ -2027,7 +2145,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { sp74[i * 2 + 0] = '-'; sp74[i * 2 + 1] = '\0'; - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_DRIGHT)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_NEXT_MEMPAK_FILE)) { Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (sCurFileIdx >= 4) { @@ -2045,7 +2163,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { dbCamera->sub.demoCtrlActionIdx = ACTION_SAVE; } } - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_DLEFT)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_PREV_MEMPAK_FILE)) { Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (sCurFileIdx <= 0) { @@ -2090,24 +2208,24 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { 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)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_PREV_MENU)) { Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); dbCamera->sub.demoCtrlActionIdx = (dbCamera->sub.demoCtrlActionIdx - 1) % 4u; } - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_DDOWN)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_NEXT_MENU)) { Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); dbCamera->sub.demoCtrlActionIdx = (dbCamera->sub.demoCtrlActionIdx + 1) % 4u; } - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_A)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_CONFIRM_CHOICE)) { Audio_PlaySfxGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); dbCamera->sub.demoCtrlToggleSwitch = 0; dbCamera->sub.demoCtrlMenu = DEMO_CTRL_MENU(dbCamera->sub.demoCtrlActionIdx, MENU_INFO); } - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_B)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_RETURN_TO_PREV_MENU)) { Audio_PlaySfxGeneral(NA_SE_SY_CANCEL, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); dbCamera->sub.demoCtrlActionIdx = ACTION_E; @@ -2116,10 +2234,10 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { goto block_2; } else { 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)) { + DbCamera_ScreenTextColored(19, 26, DBCAMERA_TEXT_GOLD, D_8012CF80); // mempak not found + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_RETURN_TO_PREV_MENU) || + CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_PREV_MENU) || + CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_NEXT_MENU)) { Audio_PlaySfxGeneral(NA_SE_SY_CANCEL, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -2133,14 +2251,14 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { break; default: { - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_DUP)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_PREV_MENU)) { Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); dbCamera->sub.demoCtrlMenu = DEMO_CTRL_MENU(ACTION_E, MENU_INFO); dbCamera->sub.demoCtrlActionIdx = (dbCamera->sub.demoCtrlActionIdx - 1) % 4u; sCurFileIdx = 0; } - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_DDOWN)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_NEXT_MENU)) { Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); dbCamera->sub.demoCtrlMenu = DEMO_CTRL_MENU(ACTION_E, MENU_INFO); @@ -2154,7 +2272,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { 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 (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_PLAY_PREV)) { if (D_8016110C > 0) { D_8016110C--; } @@ -2162,7 +2280,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { sDbCamAnim.curFrame = 0.0f; sDbCamAnim.keyframe = 0; sDbCamAnim.unk_04 = 0; - } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_CDOWN)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_PLAY_NEXT)) { if (D_8016110C < 14) { D_8016110C++; } @@ -2170,7 +2288,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { sDbCamAnim.curFrame = 0.0f; sDbCamAnim.keyframe = 0; sDbCamAnim.unk_04 = 0; - } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_CLEFT)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_STOP_PLAYBACK)) { sDbCamAnim.unk_0A = 0; Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_NOTHING_ALT); Letterbox_SetSizeTarget(0); @@ -2190,7 +2308,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { return 2; } - if (CHECK_BTN_ALL(sPlay->state.input[1].press.button, BTN_CRIGHT)) { + if (CHECK_BTN_ALL(sPlay->state.input[CAMDBG_CSCTRL_UNK_PORT].press.button, CAMDBG_CSCTRL_START_PLAYBACK)) { gUseCutsceneCam = false; gSaveContext.cutsceneIndex = 0xFFFD; gSaveContext.cutsceneTrigger = 1; @@ -2204,7 +2322,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_L)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_HOLD_TO_CHANGE_SLOT)) { if (sp74[sCurFileIdx] == '?') { sLastFileIdx = -1; D_801612EA = '*'; @@ -2213,7 +2331,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { D_801612EA = sDbCameraCuts[idx1].letter; } if (1) {} - } else if (!CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_L)) { + } else if (!CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, CAMDBG_CSCTRL_HOLD_TO_CHANGE_SLOT)) { if (sLastFileIdx != -1) { switch (sp74[sCurFileIdx]) { case '?': @@ -2255,7 +2373,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { sLastFileIdx = -1; } - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_A)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_SAVE_CS)) { if (sp74[sCurFileIdx] == '?') { Audio_PlaySfxGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -2266,7 +2384,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { } } - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_B)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_DELETE_CS)) { if (sp74[sCurFileIdx] != '?' && sp74[sCurFileIdx] != '-') { Audio_PlaySfxGeneral(NA_SE_SY_CANCEL, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -2275,7 +2393,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { } } - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_R)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_LOAD_CUR_SLOT)) { if (sp74[sCurFileIdx] != '?' && sp74[sCurFileIdx] != '-') { Audio_PlaySfxGeneral(NA_SE_SY_DECIDE, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -2299,7 +2417,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { } } - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_DRIGHT)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_NEXT_CHOICE)) { Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (sCurFileIdx == 0x1E) { @@ -2308,22 +2426,22 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { sCurFileIdx++; } } - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_DLEFT)) { + if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_PREV_CHOICE)) { Audio_PlaySfxGeneral(NA_SE_SY_CURSOR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); sCurFileIdx = (sCurFileIdx == 0) ? 0x1E : sCurFileIdx - 1; } - if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_L) && - CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_CRIGHT)) { + if (CHECK_BTN_COMBO(CAMDBG_PRINT_DATA_USE_COMBO, + &sPlay->state.input[DBCAM_CONTROLLER_PORT], CAMDBG_CSCTRL_BTN_HOLD_FOR_COMBO, CAMDBG_PRINT_DATA)) { for (i = 0; i < ARRAY_COUNT(sDbCameraCuts) - 1; i++) { osSyncPrintf("###%2d:(%c) (%d %d) %d %d %d\n", i, sDbCameraCuts[i].letter, sDbCameraCuts[i].position, sDbCameraCuts[i].lookAt, sDbCameraCuts[i].nFrames, sDbCameraCuts[i].nPoints, sDbCameraCuts[i].mode); } DbCamera_PrintAllCuts(cam); - } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].cur.button, BTN_L) && - CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_CLEFT)) { + } else if (CHECK_BTN_COMBO(CAMDBG_PRINT_DATA_USE_COMBO, + &sPlay->state.input[DBCAM_CONTROLLER_PORT], CAMDBG_CSCTRL_BTN_HOLD_FOR_COMBO, CAMDBG_CSCTRL_PRINT_BYTES)) { Audio_PlaySfxGeneral(NA_SE_SY_GET_RUPY, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); for (i = 0; i < ARRAY_COUNT(sDbCameraCuts) - 1; i++) { @@ -2332,7 +2450,7 @@ s32 DbCamera_UpdateDemoControl(DbCamera* dbCamera, Camera* cam) { DbCamera_PrintCutBytes(&sDbCameraCuts[i]); } } - } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, BTN_CRIGHT)) { + } else if (CHECK_BTN_ALL(sPlay->state.input[DBCAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_START_PLAYBACK)) { sDbCamAnim.curFrame = 0.0f; sDbCamAnim.keyframe = 0; sDbCamAnim.unk_04 = 0.0f; diff --git a/src/code/flg_set.c b/src/code/flg_set.c index ff1722bb0a..f532bd5ce1 100644 --- a/src/code/flg_set.c +++ b/src/code/flg_set.c @@ -40,7 +40,7 @@ void FlagSet_Update(PlayState* play) { }; GraphicsContext* gfxCtx = play->state.gfxCtx; - Input* input = &play->state.input[0]; + Input* input = &play->state.input[EVENT_EDITOR_CONTORLLER_PORT]; Gfx* gfx; Gfx* polyOpa; @@ -79,35 +79,35 @@ void FlagSet_Update(PlayState* play) { } } - if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT)) { + if (CHECK_BTN_ALL(input->press.button, EVENT_EDITOR_GO_LEFT)) { timer = 10; curBit++; } - if (CHECK_BTN_ALL(input->press.button, BTN_DRIGHT)) { + if (CHECK_BTN_ALL(input->press.button, EVENT_EDITOR_GO_RIGHT)) { curBit--; timer = 10; } if (timer == 0) { - if (CHECK_BTN_ALL(input->cur.button, BTN_DLEFT)) { + if (CHECK_BTN_ALL(input->cur.button, EVENT_EDITOR_GO_LEFT)) { curBit++; timer = 2; } - if (CHECK_BTN_ALL(input->cur.button, BTN_DRIGHT)) { + if (CHECK_BTN_ALL(input->cur.button, EVENT_EDITOR_GO_RIGHT)) { curBit--; timer = 2; } } curBit %= 16; - if (CHECK_BTN_ALL(input->press.button, BTN_DUP)) { + if (CHECK_BTN_ALL(input->press.button, EVENT_EDITOR_PREV)) { entryIdx--; if (entryIdx < 0) { entryIdx = 0; } timer = 10; } - if (CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) { + if (CHECK_BTN_ALL(input->press.button, EVENT_EDITOR_NEXT)) { timer = 10; entryIdx++; if (!entries[entryIdx].value) { @@ -116,14 +116,14 @@ void FlagSet_Update(PlayState* play) { } if (timer == 0) { - if (CHECK_BTN_ALL(input->cur.button, BTN_DUP)) { + if (CHECK_BTN_ALL(input->cur.button, EVENT_EDITOR_PREV)) { entryIdx--; timer = 2; if (entryIdx < 0) { entryIdx = 0; } } - if (CHECK_BTN_ALL(input->cur.button, BTN_DDOWN)) { + if (CHECK_BTN_ALL(input->cur.button, EVENT_EDITOR_NEXT)) { timer = 2; entryIdx++; if (!entries[entryIdx].value) { @@ -132,7 +132,7 @@ void FlagSet_Update(PlayState* play) { } } - if (CHECK_BTN_ALL(input->press.button, BTN_A)) { + if (CHECK_BTN_ALL(input->press.button, EVENT_EDITOR_CHANGE_VAL)) { *entries[entryIdx].value ^= (1 << curBit); } @@ -148,7 +148,7 @@ void FlagSet_Update(PlayState* play) { POLY_OPA_DISP = gfx; } - if (CHECK_BTN_ALL(input->press.button, BTN_L)) { + if (CHECK_BTN_COMBO(EVENT_EDITOR_BTN_COMBO, input, EVENT_EDITOR_BTN_HOLD_FOR_COMBO, EVENT_EDITOR_CLOSE)) { play->pauseCtx.debugState = 0; } diff --git a/src/code/game.c b/src/code/game.c index 3cc37073e2..e7b33dd55e 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -91,9 +91,7 @@ void func_800C4344(GameState* gameState) { } #ifdef ENABLE_REG_EDITOR - if (gIsCtrlr2Valid) { - Regs_UpdateEditor(&gameState->input[1]); - } + Regs_UpdateEditor(&gameState->input[REGS_EDITOR_CONTROLLER_PORT]); #endif gDmaMgrVerbose = HREG(60); @@ -156,6 +154,11 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) { Gfx* newDList; Gfx* polyOpaP; +#ifdef ENABLE_AUDIO_DEBUGGER + s32 pad; + GfxPrint printer; +#endif + OPEN_DISPS(gfxCtx, "../game.c", 746); newDList = Graph_GfxPlusOne(polyOpaP = POLY_OPA_DISP); @@ -168,22 +171,15 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) { sLastButtonPressed = gameState->input[0].press.button | gameState->input[0].cur.button; #ifdef SHOW_INPUT_DISPLAY - if (R_DISABLE_INPUT_DISPLAY == 0) { - GameState_DrawInputDisplay(sLastButtonPressed, &newDList); - } + GameState_DrawInputDisplay(sLastButtonPressed, &newDList); #endif #ifdef ENABLE_AUDIO_DEBUGGER - if (R_ENABLE_AUDIO_DBG & 1) { - s32 pad; - GfxPrint printer; - GfxPrint_Init(&printer); GfxPrint_Open(&printer, newDList); AudioDebug_Draw(&printer); newDList = GfxPrint_Close(&printer); GfxPrint_Destroy(&printer); - } #endif #ifdef ENABLE_SPEEDMETER diff --git a/src/code/graph.c b/src/code/graph.c index 4980a15943..62e4665d43 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -416,8 +416,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { } #ifdef ENABLE_MAP_SELECT - if (gIsCtrlr2Valid && CHECK_BTN_ALL(gameState->input[0].press.button, BTN_Z) && - CHECK_BTN_ALL(gameState->input[0].cur.button, BTN_L | BTN_R)) { + if(CHECK_BTN_COMBO(MAP_SELECT_BTN_COMBO, &gameState->input[MAP_SELECT_CONTORLLER_PORT], MAP_SELECT_BTN_HOLD_FOR_COMBO, MAP_SELECT_OPEN)) { gSaveContext.gameMode = GAMEMODE_NORMAL; SET_NEXT_GAMESTATE(gameState, MapSelect_Init, MapSelectState); gameState->running = false; diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 31721b7601..6adc10da9f 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -3213,7 +3213,7 @@ f32 BgCheck_RaycastDownDyna(DynaRaycastDown* dynaRaycastDown) { dynaActor = DynaPoly_GetActor(dynaRaycastDown->colCtx, *dynaRaycastDown->bgId); if ((result != BGCHECK_Y_MIN) && (dynaActor != NULL) && (dynaRaycastDown->play != NULL)) { pauseState = dynaRaycastDown->play->pauseCtx.state != 0; -#if (defined ENABLE_INV_EDITOR && defined ENABLE_EVENT_EDITOR) +#if (defined ENABLE_INV_EDITOR || defined ENABLE_EVENT_EDITOR) if (pauseState == 0) { pauseState = dynaRaycastDown->play->pauseCtx.debugState != 0; } diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 3a238d88d4..88aee1b58f 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -7117,7 +7117,7 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, PlayState sCameraInterfaceField = CAM_INTERFACE_FIELD(CAM_LETTERBOX_IGNORE, CAM_HUD_VISIBILITY_IGNORE, 0); #ifdef ENABLE_CAMERA_DEBUGGER - sDbgModeIdx = -1; + sDbgModeIdx = 0; #endif D_8011D3F0 = 3; @@ -7259,7 +7259,7 @@ void Camera_PrintSettings(Camera* camera) { char sp48[8]; s32 i; - if ((OREG(0) & 1) && (camera->play->activeCamId == camera->camId) && !gDbgCamEnabled) { + if ((camera->play->activeCamId == camera->camId) && !gDbgCamEnabled) { for (i = 0; i < NUM_CAMS; i++) { if (camera->play->cameraPtrs[i] == NULL) { sp58[i] = '-'; @@ -7467,31 +7467,37 @@ s32 Camera_UpdateHotRoom(Camera* camera) { // doesn't seem to work properly s32 Camera_DbgChangeMode(Camera* camera) { s32 changeDir = 0; + Input* input = &D_8015BD7C->state.input[CAMDBG_CONTROLLER_PORT]; if (!gDbgCamEnabled && camera->play->activeCamId == CAM_ID_MAIN) { - if (CHECK_BTN_ALL(D_8015BD7C->state.input[2].press.button, BTN_CUP)) { + if (CHECK_BTN_COMBO(CAMDBG_BTN_COMBO, input, CAMDBG_BTN_HOLD_FOR_COMBO, CAMDBG_TESTER_PLAY_DUNGEON_TARGET_SOUND)) { osSyncPrintf("attention sound URGENCY\n"); func_80078884(NA_SE_SY_ATTENTION_URGENCY); } - if (CHECK_BTN_ALL(D_8015BD7C->state.input[2].press.button, BTN_CDOWN)) { + if (CHECK_BTN_COMBO(CAMDBG_BTN_COMBO, input, CAMDBG_BTN_HOLD_FOR_COMBO, CAMDBG_TESTER_PLAY_OVERWORLD_TARGET_SOUND)) { osSyncPrintf("attention sound NORMAL\n"); func_80078884(NA_SE_SY_ATTENTION_ON); } - if (CHECK_BTN_ALL(D_8015BD7C->state.input[2].press.button, BTN_CRIGHT)) { - changeDir = 1; + if (CHECK_BTN_COMBO(CAMDBG_BTN_COMBO, input, CAMDBG_BTN_HOLD_FOR_COMBO, CAMDBG_TESTER_INCREASE_DISTANCE)) { + sDbgModeIdx += 1; } - if (CHECK_BTN_ALL(D_8015BD7C->state.input[2].press.button, BTN_CLEFT)) { - changeDir = -1; + if (CHECK_BTN_COMBO(CAMDBG_BTN_COMBO, input, CAMDBG_BTN_HOLD_FOR_COMBO, CAMDBG_TESTER_DECREASE_SETTING)) { + sDbgModeIdx -= 1; } - if (changeDir != 0) { - sDbgModeIdx = (sDbgModeIdx + changeDir) % 6; - if (Camera_ChangeSetting(camera, D_8011DAFC[sDbgModeIdx]) > 0) { + + if (sDbgModeIdx > ARRAY_COUNT(D_8011DAFC) - 1) { + sDbgModeIdx = ARRAY_COUNT(D_8011DAFC) - 1; + } + + if (Camera_ChangeSetting(camera, D_8011DAFC[sDbgModeIdx]) > 0) { + if (R_DBG_CAM_UPDATE) { osSyncPrintf("camera: force change SET to %s!\n", sCameraSettingNames[D_8011DAFC[sDbgModeIdx]]); } + return true; } } - return true; + return false; } #endif @@ -7596,6 +7602,11 @@ Vec3s Camera_Update(Camera* camera) { PosRot curPlayerPosRot; ShakeInfo camShake; Player* player; + u8 changeBgCamCond; + +#ifdef ENABLE_CAMERA_DEBUGGER + s32 camDbgChangeSettings; +#endif player = camera->play->cameraPtrs[CAM_ID_MAIN]->player; @@ -7616,6 +7627,11 @@ Vec3s Camera_Update(Camera* camera) { sUpdateCameraDirection = false; +#ifdef ENABLE_CAMERA_DEBUGGER + Camera_PrintSettings(camera); + camDbgChangeSettings = Camera_DbgChangeMode(camera); +#endif + if (camera->player != NULL) { Actor_GetWorldPosShapeRot(&curPlayerPosRot, &camera->player->actor); camera->xzSpeed = playerXZSpeed = OLib_Vec3fDistXZ(&curPlayerPosRot.pos, &camera->playerPosRot.pos); @@ -7671,8 +7687,12 @@ Vec3s Camera_Update(Camera* camera) { } } - if (camera->nextBgCamIndex != -1 && (fabsf(curPlayerPosRot.pos.y - playerGroundY) < 2.0f) && - (!(camera->stateFlags & CAM_STATE_9) || (player->currentBoots == PLAYER_BOOTS_IRON))) { + changeBgCamCond = ((camera->nextBgCamIndex != -1) && (fabsf(curPlayerPosRot.pos.y - playerGroundY) < 2.0f) && + (!(camera->stateFlags & CAM_STATE_9) || (player->currentBoots == PLAYER_BOOTS_IRON))); +#ifdef ENABLE_CAMERA_DEBUGGER + changeBgCamCond = !camDbgChangeSettings && changeBgCamCond; +#endif + if (changeBgCamCond) { camera->bgId = camera->nextBgId; Camera_ChangeBgCamIndex(camera, camera->nextBgCamIndex); camera->nextBgCamIndex = -1; @@ -7680,11 +7700,6 @@ Vec3s Camera_Update(Camera* camera) { } } -#ifdef ENABLE_CAMERA_DEBUGGER - Camera_PrintSettings(camera); - Camera_DbgChangeMode(camera); -#endif - if (camera->status == CAM_STAT_WAIT) { #ifdef ENABLE_CAMERA_DEBUGGER if (R_DBG_CAM_UPDATE) { @@ -7734,23 +7749,23 @@ Vec3s Camera_Update(Camera* camera) { #ifdef ENABLE_CAMERA_DEBUGGER if (R_DBG_CAM_UPDATE) { osSyncPrintf("camera: shrink_and_bitem %x(%d)\n", sCameraInterfaceField, camera->play->transitionMode); - } - if (R_DBG_CAM_UPDATE) { osSyncPrintf("camera: engine (%s(%d) %s(%d) %s(%d)) ok!\n", &sCameraSettingNames[camera->setting], - camera->setting, &sCameraModeNames[camera->mode], camera->mode, - &sCameraFunctionNames[sCameraSettings[camera->setting].cameraModes[camera->mode].funcIdx], - sCameraSettings[camera->setting].cameraModes[camera->mode].funcIdx); + camera->setting, &sCameraModeNames[camera->mode], camera->mode, + &sCameraFunctionNames[sCameraSettings[camera->setting].cameraModes[camera->mode].funcIdx], + sCameraSettings[camera->setting].cameraModes[camera->mode].funcIdx); } // enable/disable debug cam - if (CHECK_BTN_ALL(D_8015BD7C->state.input[2].press.button, BTN_START)) { + if (CHECK_BTN_COMBO(CAMDBG_BTN_COMBO, &D_8015BD7C->state.input[CAMDBG_CONTROLLER_PORT], CAMDBG_BTN_HOLD_FOR_COMBO, CAMDBG_TOGGLE)) { gDbgCamEnabled ^= 1; if (gDbgCamEnabled) { DbgCamera_Enable(&D_8015BD80, camera); } else if (camera->play->csCtx.state != CS_STATE_IDLE) { Cutscene_StopManual(camera->play, &camera->play->csCtx); } + + osSyncPrintf("gDbgCamEnabled: %X\n", gDbgCamEnabled); } // Debug cam update @@ -7838,13 +7853,13 @@ Vec3s Camera_Update(Camera* camera) { #ifdef ENABLE_CAMERA_DEBUGGER if (R_DBG_CAM_UPDATE) { osSyncPrintf("camera: out (%f %f %f) (%f %f %f)\n", camera->at.x, camera->at.y, camera->at.z, camera->eye.x, - camera->eye.y, camera->eye.z); + camera->eye.y, camera->eye.z); osSyncPrintf("camera: dir (%f %d(%f) %d(%f)) (%f)\n", eyeAtAngle.r, eyeAtAngle.pitch, - CAM_BINANG_TO_DEG(eyeAtAngle.pitch), eyeAtAngle.yaw, CAM_BINANG_TO_DEG(eyeAtAngle.yaw), - camera->fov); + CAM_BINANG_TO_DEG(eyeAtAngle.pitch), eyeAtAngle.yaw, CAM_BINANG_TO_DEG(eyeAtAngle.yaw), + camera->fov); if (camera->player != NULL) { osSyncPrintf("camera: foot(%f %f %f) dist (%f)\n", curPlayerPosRot.pos.x, curPlayerPosRot.pos.y, - curPlayerPosRot.pos.z, camera->dist); + curPlayerPosRot.pos.z, camera->dist); } } #endif diff --git a/src/code/z_camera_data.inc.c b/src/code/z_camera_data.inc.c index 11e7d9621f..0b51240038 100644 --- a/src/code/z_camera_data.inc.c +++ b/src/code/z_camera_data.inc.c @@ -2558,7 +2558,7 @@ s32 sInitRegs = 1; #ifdef ENABLE_CAMERA_DEBUGGER s32 gDbgCamEnabled = 0; -s32 sDbgModeIdx = -1; +u8 sDbgModeIdx = 0; #endif s16 sNextUID = 0; diff --git a/src/code/z_debug.c b/src/code/z_debug.c index bbae1154f4..0fa9b8476d 100644 --- a/src/code/z_debug.c +++ b/src/code/z_debug.c @@ -38,36 +38,35 @@ Color_RGBA8 sDbCameraTextColors[] = { #ifdef ENABLE_REG_EDITOR InputCombo sRegGroupInputCombos[REG_GROUPS] = { - { BTN_L, BTN_CUP }, // REG - { BTN_L, BTN_CLEFT }, // SREG - { BTN_L, BTN_CDOWN }, // OREG - { BTN_L, BTN_A }, // PREG - { BTN_R, BTN_CDOWN }, // QREG - { BTN_L, BTN_CRIGHT }, // MREG - { BTN_L, BTN_R }, // YREG - { BTN_L, BTN_DLEFT }, // DREG - { BTN_L, BTN_DRIGHT }, // UREG - { BTN_L, BTN_DUP }, // IREG - { BTN_L, BTN_B }, // ZREG - { BTN_L, BTN_Z }, // CREG - { BTN_L, BTN_DDOWN }, // NREG - { BTN_R, BTN_A }, // KREG - { BTN_R, BTN_B }, // XREG - { BTN_R, BTN_Z }, // cREG - { BTN_R, BTN_L }, // sREG - { BTN_R, BTN_CUP }, // iREG - { BTN_R, BTN_CRIGHT }, // WREG - { BTN_R, BTN_DLEFT }, // AREG - { BTN_R, BTN_CLEFT }, // VREG - { BTN_R, BTN_START }, // HREG - { BTN_L, BTN_START }, // GREG - { BTN_R, BTN_DRIGHT }, // mREG - { BTN_R, BTN_DUP }, // nREG - { BTN_START, BTN_R }, // BREG - { BTN_START, BTN_A }, // dREG - { BTN_START, BTN_B }, // kREG - { BTN_START, BTN_CRIGHT }, // bREG - + { REGS_EDITOR_REG_COMBO }, // REG + { REGS_EDITOR_SREG_COMBO }, // SREG + { REGS_EDITOR_OREG_COMBO }, // OREG + { REGS_EDITOR_PREG_COMBO }, // PREG + { REGS_EDITOR_QREG_COMBO }, // QREG + { REGS_EDITOR_MREG_COMBO }, // MREG + { REGS_EDITOR_YREG_COMBO }, // YREG + { REGS_EDITOR_DREG_COMBO }, // DREG + { REGS_EDITOR_UREG_COMBO }, // UREG + { REGS_EDITOR_IREG_COMBO }, // IREG + { REGS_EDITOR_ZREG_COMBO }, // ZREG + { REGS_EDITOR_CREG_COMBO }, // CREG + { REGS_EDITOR_NREG_COMBO }, // NREG + { REGS_EDITOR_KREG_COMBO }, // KREG + { REGS_EDITOR_XREG_COMBO }, // XREG + { REGS_EDITOR_cREG_COMBO }, // cREG + { REGS_EDITOR_sREG_COMBO }, // sREG + { REGS_EDITOR_iREG_COMBO }, // iREG + { REGS_EDITOR_WREG_COMBO }, // WREG + { REGS_EDITOR_AREG_COMBO }, // AREG + { REGS_EDITOR_VREG_COMBO }, // VREG + { REGS_EDITOR_HREG_COMBO }, // HREG + { REGS_EDITOR_GREG_COMBO }, // GREG + { REGS_EDITOR_mREG_COMBO }, // mREG + { REGS_EDITOR_nREG_COMBO }, // nREG + { REGS_EDITOR_BREG_COMBO }, // BREG + { REGS_EDITOR_dREG_COMBO }, // dREG + { REGS_EDITOR_kREG_COMBO }, // kREG + { REGS_EDITOR_bREG_COMBO }, // bREG }; char sRegGroupChars[REG_GROUPS] = { @@ -181,6 +180,10 @@ void Regs_UpdateEditor(Input* input) { s32 increment; s32 i; + u16 incrementBy10; + u16 incrementBy100; + u16 incrementBy1000; + 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) || @@ -223,15 +226,19 @@ void Regs_UpdateEditor(Input* input) { gRegEditor->dPadInputPrev = dPadInputCur; } + incrementBy1000 = CHECK_BTN_ALL(input->cur.button, REGS_EDITOR_INCDEC_1000) + incrementBy100 = CHECK_BTN_ALL(input->cur.button, REGS_EDITOR_INCDEC_100) + incrementBy10 = CHECK_BTN_ALL(input->cur.button, REGS_EDITOR_INCDEC_10) + increment = - CHECK_BTN_ANY(dPadInputCur, BTN_DRIGHT) ? (CHECK_BTN_ALL(input->cur.button, BTN_A | BTN_B) ? 1000 - : CHECK_BTN_ALL(input->cur.button, BTN_A) ? 100 - : CHECK_BTN_ALL(input->cur.button, BTN_B) ? 10 - : 1) - : CHECK_BTN_ANY(dPadInputCur, BTN_DLEFT) ? (CHECK_BTN_ALL(input->cur.button, BTN_A | BTN_B) ? -1000 - : CHECK_BTN_ALL(input->cur.button, BTN_A) ? -100 - : CHECK_BTN_ALL(input->cur.button, BTN_B) ? -10 - : -1) + CHECK_BTN_ANY(dPadInputCur, BTN_DRIGHT) ? (incrementBy1000 ? 1000 + : incrementBy100 ? 100 + : incrementBy10 ? 10 + : 1) + : CHECK_BTN_ANY(dPadInputCur, BTN_DLEFT) ? (incrementBy1000 ? -1000 + : incrementBy100 ? -100 + : incrementBy10 ? -10 + : -1) : 0; gRegEditor->data[gRegEditor->regCur + pageDataStart] += increment; @@ -308,9 +315,7 @@ void Debug_DrawText(GraphicsContext* gfxCtx) { GfxPrint_Open(&printer, gfx); #ifdef ENABLE_CAMERA_DEBUGGER - if ((OREG(0) == 1) || (OREG(0) == 8)) { - DbCamera_DrawScreenText(&printer); - } + DbCamera_DrawScreenText(&printer); #endif #ifdef ENABLE_REG_EDITOR diff --git a/src/code/z_demo.c b/src/code/z_demo.c index e36697bff3..3899306a0d 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -181,17 +181,14 @@ void Cutscene_UpdateScripted(PlayState* play, CutsceneContext* csCtx) { #ifdef ENABLE_CS_CONTROL Input* input = &play->state.input[0]; - // if using button combo check for the input, else simply return true - u8 buttonCombo = CS_CTRL_USE_BTN_COMBO ? CHECK_BTN_ALL(input->cur.button, CS_CTRL_BTN_HOLD_FOR_COMBO) : true; - // if the scene layer is a cutscene one, we're not playing a cutscene // and we pressed D-Pad Up: restart the cutscene - u8 canStartCutscene = buttonCombo && (CHECK_BTN_ALL(input->press.button, CS_CTRL_RESTART_CONTROL) && - (csCtx->state == CS_STATE_IDLE) && IS_CUTSCENE_LAYER); + u8 canStartCutscene = (CHECK_BTN_COMBO(CS_CTRL_USE_BTN_COMBO, input, CS_CTRL_BTN_HOLD_FOR_COMBO, CS_CTRL_RESTART_CONTROL) && + (csCtx->state == CS_STATE_IDLE) && IS_CUTSCENE_LAYER); // restart the cutscene without using the camera points, // instead simply follow the player - if (buttonCombo && CHECK_BTN_ALL(input->press.button, CS_CTRL_RESTART_NO_CAMERA_CONTROL) && + if (CHECK_BTN_COMBO(CS_CTRL_USE_BTN_COMBO, input, CS_CTRL_BTN_HOLD_FOR_COMBO, CS_CTRL_RESTART_NO_CAMERA_CONTROL) && (csCtx->state == CS_STATE_IDLE) && IS_CUTSCENE_LAYER) { gUseCutsceneCam = false; gSaveContext.cutsceneIndex = 0xFFFD; @@ -572,12 +569,6 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti u8 runCmdDestination = false; #ifdef ENABLE_CS_CONTROL - Input* input = &play->state.input[CS_CTRL_CONTROLLER_PORT]; - - // if using button combo check for the input, else simply return true - u8 buttonCombo = CS_CTRL_USE_BTN_COMBO ? CHECK_BTN_ALL(input->cur.button, CS_CTRL_BTN_HOLD_FOR_COMBO) : true; - - // same thing for the "skip title screen cs" feature u8 skipTitleScreenCS = (gSaveContext.gameMode == GAMEMODE_TITLE_SCREEN) ? CS_CTRL_SKIP_TITLE_SCREEN : true; #endif @@ -600,11 +591,9 @@ void CutsceneCmd_Destination(PlayState* play, CutsceneContext* csCtx, CsCmdDesti runCmdDestination = ((csCtx->curFrame == cmd->startFrame) || titleDemoSkipped); #ifdef ENABLE_CS_CONTROL - runCmdDestination = - skipTitleScreenCS && - (runCmdDestination || - ((csCtx->curFrame > 20) && (buttonCombo && CHECK_BTN_ALL(input->press.button, CS_CTRL_RUN_DEST_CONTROL)) && - (gSaveContext.fileNum != 0xFEDC))); + runCmdDestination = skipTitleScreenCS && (runCmdDestination || ((csCtx->curFrame > 20) && + CHECK_BTN_COMBO(CS_CTRL_USE_BTN_COMBO, &play->state.input[CS_CTRL_CONTROLLER_PORT], CS_CTRL_BTN_HOLD_FOR_COMBO, CS_CTRL_RUN_DEST_CONTROL) && + (gSaveContext.fileNum != 0xFEDC))); #endif if (runCmdDestination) { @@ -1817,13 +1806,6 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) s32 csFrameCount; s16 j; -#ifdef ENABLE_CS_CONTROL - Input* input = &play->state.input[CS_CTRL_CONTROLLER_PORT]; - - // if using button combo check for the input, else simply return true - u8 buttonCombo = CS_CTRL_USE_BTN_COMBO ? CHECK_BTN_ALL(input->cur.button, CS_CTRL_BTN_HOLD_FOR_COMBO) : true; -#endif - MemCpy(&totalEntries, script, sizeof(totalEntries)); script += sizeof(totalEntries); @@ -1837,7 +1819,9 @@ void Cutscene_ProcessScript(PlayState* play, CutsceneContext* csCtx, u8* script) #ifdef ENABLE_CS_CONTROL // interrupt cutscene - if (buttonCombo && CHECK_BTN_ALL(input->press.button, CS_CTRL_STOP_CONTROL)) { + + if (CHECK_BTN_COMBO(CS_CTRL_USE_BTN_COMBO, &play->state.input[CS_CTRL_CONTROLLER_PORT], + CS_CTRL_BTN_HOLD_FOR_COMBO, CS_CTRL_STOP_CONTROL)) { csCtx->state = CS_STATE_STOP; return; } @@ -2257,19 +2241,17 @@ void CutsceneHandler_RunScript(PlayState* play, CutsceneContext* csCtx) { if (0) {} // Also necessary to match #ifdef SHOW_CS_INFOS - if (BREG(0) != 0) { - OPEN_DISPS(play->state.gfxCtx, "../z_demo.c", 4101); - - prevDisplayList = POLY_OPA_DISP; - displayList = Graph_GfxPlusOne(POLY_OPA_DISP); - gSPDisplayList(OVERLAY_DISP++, displayList); - Cutscene_DrawDebugInfo(play, &displayList, csCtx); - gSPEndDisplayList(displayList++); - Graph_BranchDlist(prevDisplayList, displayList); - POLY_OPA_DISP = displayList; - - CLOSE_DISPS(play->state.gfxCtx, "../z_demo.c", 4108); - } + OPEN_DISPS(play->state.gfxCtx, "../z_demo.c", 4101); + + prevDisplayList = POLY_OPA_DISP; + displayList = Graph_GfxPlusOne(POLY_OPA_DISP); + gSPDisplayList(OVERLAY_DISP++, displayList); + Cutscene_DrawDebugInfo(play, &displayList, csCtx); + gSPEndDisplayList(displayList++); + Graph_BranchDlist(prevDisplayList, displayList); + POLY_OPA_DISP = displayList; + + CLOSE_DISPS(play->state.gfxCtx, "../z_demo.c", 4108); #endif csCtx->curFrame++; diff --git a/src/code/z_frame_advance.c b/src/code/z_frame_advance.c index a77238c043..5568f044a1 100644 --- a/src/code/z_frame_advance.c +++ b/src/code/z_frame_advance.c @@ -19,14 +19,15 @@ void FrameAdvance_Init(FrameAdvanceContext* frameAdvCtx) { */ s32 FrameAdvance_Update(FrameAdvanceContext* frameAdvCtx, Input* input) { // if the macro is set to true check R input, else simply return true - u8 checkR = FA_USE_BTN_COMBO ? CHECK_BTN_ALL(input->cur.button, FA_BTN_HOLD_FOR_COMBO) : true; - if (checkR && CHECK_BTN_ALL(input->press.button, FA_PAUSE_CONTROL)) { + if (CHECK_BTN_COMBO(FA_USE_BTN_COMBO, input, FA_BTN_HOLD_FOR_COMBO, FA_PAUSE_CONTROL)) { frameAdvCtx->enabled = !frameAdvCtx->enabled; } + if (!frameAdvCtx->enabled || - ((checkR && CHECK_BTN_ALL(input->press.button, FA_CONTROL)) || (checkR && (++frameAdvCtx->timer >= 9)))) { + (CHECK_BTN_COMBO(FA_USE_BTN_COMBO, input, FA_BTN_HOLD_FOR_COMBO, FA_CONTROL) || + (USE_BTN_COMBO(FA_USE_BTN_COMBO, input, FA_BTN_HOLD_FOR_COMBO) && (++frameAdvCtx->timer >= 9)))) { frameAdvCtx->timer = 0; return true; } diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index 359a9dcab6..8680d1db36 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -56,7 +56,7 @@ void KaleidoScopeCall_Update(PlayState* play) { KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE]; PauseContext* pauseCtx = &play->pauseCtx; -#if (defined ENABLE_INV_EDITOR && defined ENABLE_EVENT_EDITOR) +#if (defined ENABLE_INV_EDITOR || defined ENABLE_EVENT_EDITOR) if ((pauseCtx->state != 0) || (pauseCtx->debugState != 0)) { #else if (pauseCtx->state != 0) { @@ -105,7 +105,7 @@ void KaleidoScopeCall_Update(PlayState* play) { if (gKaleidoMgrCurOvl == kaleidoScopeOvl) { sKaleidoScopeUpdateFunc(play); -#if (defined ENABLE_INV_EDITOR && defined ENABLE_EVENT_EDITOR) +#if (defined ENABLE_INV_EDITOR || defined ENABLE_EVENT_EDITOR) if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { #else if ((play->pauseCtx.state == 0)) { diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 5016b99c0a..8ae885cc42 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -12,6 +12,10 @@ void KaleidoSetup_Update(PlayState* play) { PauseContext* pauseCtx = &play->pauseCtx; Input* input = &play->state.input[0]; +#ifdef ENABLE_EVENT_EDITOR + Input* evEditorInput = &play->state.input[EVENT_EDITOR_CONTORLLER_PORT]; +#endif + u8 canUpdate = (play->gameOverCtx.state == GAMEOVER_INACTIVE && play->transitionTrigger == TRANS_TRIGGER_OFF && play->transitionMode == TRANS_MODE_OFF && gSaveContext.cutsceneIndex < 0xFFF0 && @@ -28,10 +32,8 @@ void KaleidoSetup_Update(PlayState* play) { if (canUpdate) { #ifdef ENABLE_EVENT_EDITOR - if (CHECK_BTN_ALL(input->cur.button, BTN_L) && CHECK_BTN_ALL(input->press.button, BTN_CUP)) { - if (BREG(0)) { - pauseCtx->debugState = 3; - } + if (CHECK_BTN_COMBO(EVENT_EDITOR_BTN_COMBO, evEditorInput, EVENT_EDITOR_BTN_HOLD_FOR_COMBO, EVENT_EDITOR_OPEN)) { + pauseCtx->debugState = 3; } else if (CHECK_BTN_ALL(input->press.button, BTN_START)) { #else if (CHECK_BTN_ALL(input->press.button, BTN_START)) { @@ -79,7 +81,7 @@ void KaleidoSetup_Init(PlayState* play) { u64 temp = 0; // Necessary to match pauseCtx->state = 0; -#if (defined ENABLE_INV_EDITOR && defined ENABLE_EVENT_EDITOR) +#if (defined ENABLE_INV_EDITOR || defined ENABLE_EVENT_EDITOR) pauseCtx->debugState = 0; #endif pauseCtx->alpha = 0; diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 5b08ddcfc4..1235cad74d 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -884,13 +884,18 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex EnvLightSettings* lightSettingsList = play->envCtx.lightSettingsList; s32 adjustment; +#ifdef SHOW_TIME_INFOS + Gfx* displayList; + Gfx* prevDisplayList; +#endif + if ((((void)0, gSaveContext.gameMode) != GAMEMODE_NORMAL) && (((void)0, gSaveContext.gameMode) != GAMEMODE_END_CREDITS)) { Rumble_ClearRequests(); } if (pauseCtx->state == 0) { -#if (defined ENABLE_INV_EDITOR && defined ENABLE_EVENT_EDITOR) +#if (defined ENABLE_INV_EDITOR || defined ENABLE_EVENT_EDITOR) if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { #else if ((play->pauseCtx.state == 0)) { @@ -961,22 +966,17 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex } #ifdef SHOW_TIME_INFOS - if (R_ENABLE_ARENA_DBG != 0 || CREG(2) != 0) { - Gfx* displayList; - Gfx* prevDisplayList; - - OPEN_DISPS(play->state.gfxCtx, "../z_kankyo.c", 1682); - - prevDisplayList = POLY_OPA_DISP; - displayList = Graph_GfxPlusOne(POLY_OPA_DISP); - gSPDisplayList(OVERLAY_DISP++, displayList); - Environment_PrintDebugInfo(play, &displayList); - gSPEndDisplayList(displayList++); - Graph_BranchDlist(prevDisplayList, displayList); - POLY_OPA_DISP = displayList; - if (1) {} - CLOSE_DISPS(play->state.gfxCtx, "../z_kankyo.c", 1690); - } + OPEN_DISPS(play->state.gfxCtx, "../z_kankyo.c", 1682); + + prevDisplayList = POLY_OPA_DISP; + displayList = Graph_GfxPlusOne(POLY_OPA_DISP); + gSPDisplayList(OVERLAY_DISP++, displayList); + Environment_PrintDebugInfo(play, &displayList); + gSPEndDisplayList(displayList++); + Graph_BranchDlist(prevDisplayList, displayList); + POLY_OPA_DISP = displayList; + if (1) {} + CLOSE_DISPS(play->state.gfxCtx, "../z_kankyo.c", 1690); #endif if ((envCtx->lightSettingOverride != LIGHT_SETTING_OVERRIDE_NONE) && diff --git a/src/code/z_lifemeter.c b/src/code/z_lifemeter.c index 82ccb97031..b36727cb86 100644 --- a/src/code/z_lifemeter.c +++ b/src/code/z_lifemeter.c @@ -512,7 +512,7 @@ void Health_UpdateBeatingHeart(PlayState* play) { canPlayLowHealthSFX = (!Player_InCsMode(play) && (play->pauseCtx.state == 0)); -#if (defined ENABLE_INV_EDITOR && defined ENABLE_EVENT_EDITOR) +#if (defined ENABLE_INV_EDITOR || defined ENABLE_EVENT_EDITOR) canPlayLowHealthSFX = canPlayLowHealthSFX && (play->pauseCtx.debugState == 0) && Health_IsCritical() && !Play_InCsMode(play); #else diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index 017bd98e81..c00adaeff9 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -523,7 +523,7 @@ void Map_Update(PlayState* play) { s16 floor; s16 i; -#if (defined ENABLE_INV_EDITOR && defined ENABLE_EVENT_EDITOR) +#if (defined ENABLE_INV_EDITOR || defined ENABLE_EVENT_EDITOR) if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { #else if (play->pauseCtx.state == 0) { diff --git a/src/code/z_message_PAL.c b/src/code/z_message_PAL.c index 0e3229546e..35788b8e7f 100644 --- a/src/code/z_message_PAL.c +++ b/src/code/z_message_PAL.c @@ -3016,7 +3016,7 @@ void Message_Draw(PlayState* play) { #ifdef ENABLE_MSG_DEBUGGER watchVar = gSaveContext.scarecrowLongSongSet; Message_DrawDebugVariableChanged(&watchVar, play->state.gfxCtx); - if (BREG(0) != 0 && play->msgCtx.textId != 0) { + if (play->enableMsgDbg && play->msgCtx.textId != 0) { plusOne = Graph_GfxPlusOne(polyOpaP = POLY_OPA_DISP); gSPDisplayList(OVERLAY_DISP++, plusOne); Message_DrawDebugText(play, &plusOne); @@ -3073,8 +3073,8 @@ void Message_Update(PlayState* play) { #endif #ifdef ENABLE_MSG_DEBUGGER - if (BREG(0) != 0) { - if (CHECK_BTN_ALL(input->press.button, BTN_DDOWN) && CHECK_BTN_ALL(input->cur.button, BTN_L)) { + if (play->enableMsgDbg) { + if (CHECK_BTN_COMBO(MSGDBG_BTN_COMBO, &play->state.input[MSGDBG_CONTROLLER_PORT], MSGDBG_BTN_HOLD_FOR_COMBO, MSGDBG_OPEN_TEXTBOX)) { osSyncPrintf("msgno=%d\n", D_80153D78); Message_StartTextbox(play, R_MESSAGE_DEBUGGER_TEXTID, NULL); D_80153D78 = (D_80153D78 + 1) % 10; diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index 2fec6da8fd..a59a0020b5 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -2548,7 +2548,7 @@ void Magic_Update(PlayState* play) { case MAGIC_STATE_CONSUME_LENS: // Slowly consume magic while lens is on if ((play->pauseCtx.state == 0) && -#if (defined ENABLE_INV_EDITOR && defined ENABLE_EVENT_EDITOR) +#if (defined ENABLE_INV_EDITOR || defined ENABLE_EVENT_EDITOR) (play->pauseCtx.debugState == 0) && #endif (msgCtx->msgMode == MSGMODE_NONE) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && @@ -2807,7 +2807,7 @@ void Interface_DrawItemButtons(PlayState* play) { G_TX_RENDERTILE, 0, 0, R_ITEM_BTN_DD(3) << 1, R_ITEM_BTN_DD(3) << 1); if ((pauseCtx->state < 8) || (pauseCtx->state >= 18)) { -#if (defined ENABLE_INV_EDITOR && defined ENABLE_EVENT_EDITOR) +#if (defined ENABLE_INV_EDITOR || defined ENABLE_EVENT_EDITOR) if ((play->pauseCtx.state != 0) || (play->pauseCtx.debugState != 0)) { #else if (play->pauseCtx.state != 0) { @@ -2840,7 +2840,7 @@ void Interface_DrawItemButtons(PlayState* play) { } if (interfaceCtx->naviCalling && (play->pauseCtx.state == 0) && -#if (defined ENABLE_INV_EDITOR && defined ENABLE_EVENT_EDITOR) +#if (defined ENABLE_INV_EDITOR || defined ENABLE_EVENT_EDITOR) (play->pauseCtx.debugState == 0) && #endif (play->csCtx.state == CS_STATE_IDLE)) { @@ -3146,7 +3146,7 @@ void Interface_Draw(PlayState* play) { gSPSegment(OVERLAY_DISP++, 0x08, interfaceCtx->iconItemSegment); gSPSegment(OVERLAY_DISP++, 0x0B, interfaceCtx->mapSegment); -#if (defined ENABLE_INV_EDITOR && defined ENABLE_EVENT_EDITOR) +#if (defined ENABLE_INV_EDITOR || defined ENABLE_EVENT_EDITOR) if (pauseCtx->debugState == 0) { #endif Interface_InitVertices(play); @@ -3437,7 +3437,7 @@ void Interface_Draw(PlayState* play) { Gfx_SetupDL_39Overlay(play->state.gfxCtx); -#if (defined ENABLE_INV_EDITOR && defined ENABLE_EVENT_EDITOR) +#if (defined ENABLE_INV_EDITOR || defined ENABLE_EVENT_EDITOR) if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { #else if (play->pauseCtx.state == 0) { @@ -3539,7 +3539,7 @@ void Interface_Draw(PlayState* play) { } if ((play->pauseCtx.state == 0) && -#if (defined ENABLE_INV_EDITOR && defined ENABLE_EVENT_EDITOR) +#if (defined ENABLE_INV_EDITOR || defined ENABLE_EVENT_EDITOR) (play->pauseCtx.debugState == 0) && #endif (play->gameOverCtx.state == GAMEOVER_INACTIVE) && (msgCtx->msgMode == MSGMODE_NONE) && @@ -3960,7 +3960,7 @@ void Interface_Draw(PlayState* play) { } } } -#if (defined ENABLE_INV_EDITOR && defined ENABLE_EVENT_EDITOR) +#if (defined ENABLE_INV_EDITOR || defined ENABLE_EVENT_EDITOR) } #endif @@ -3991,7 +3991,7 @@ void Interface_Update(PlayState* play) { u16 action; Input* debugInput = &play->state.input[2]; -#if (defined ENABLE_INV_EDITOR && defined ENABLE_EVENT_EDITOR) +#if (defined ENABLE_INV_EDITOR || defined ENABLE_EVENT_EDITOR) if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { #else if (play->pauseCtx.state == 0) { @@ -4148,7 +4148,7 @@ void Interface_Update(PlayState* play) { Health_UpdateMeter(play); if ((gSaveContext.timerState >= TIMER_STATE_ENV_HAZARD_MOVE) && (play->pauseCtx.state == 0) && -#if (defined ENABLE_INV_EDITOR && defined ENABLE_EVENT_EDITOR) +#if (defined ENABLE_INV_EDITOR || defined ENABLE_EVENT_EDITOR) (play->pauseCtx.debugState == 0) && #endif (msgCtx->msgMode == MSGMODE_NONE) && !(player->stateFlags2 & PLAYER_STATE2_24) && @@ -4238,7 +4238,7 @@ void Interface_Update(PlayState* play) { // Update Magic if ((play->pauseCtx.state == 0) && -#if (defined ENABLE_INV_EDITOR && defined ENABLE_EVENT_EDITOR) +#if (defined ENABLE_INV_EDITOR || defined ENABLE_EVENT_EDITOR) (play->pauseCtx.debugState == 0) && #endif (msgCtx->msgMode == MSGMODE_NONE) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && diff --git a/src/code/z_play.c b/src/code/z_play.c index 43e42577fc..5024579fb3 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -450,6 +450,10 @@ void Play_Init(GameState* thisx) { // Presumably the ROM was larger at a previous point in development when this debug feature was used. DmaMgr_DmaRomToRam(0x03FEB000, gDebugCutsceneScript, sizeof(sDebugCutsceneScriptBuf)); } + +#ifdef ENABLE_MSG_DEBUGGER + this->enableMsgDbg = false; +#endif } void Play_Update(PlayState* this) { @@ -858,7 +862,7 @@ void Play_Update(PlayState* this) { } PLAY_LOG(3551); -#if (defined ENABLE_INV_EDITOR && defined ENABLE_EVENT_EDITOR) +#if (defined ENABLE_INV_EDITOR || defined ENABLE_EVENT_EDITOR) sp80 = (this->pauseCtx.state != 0) || (this->pauseCtx.debugState != 0); #else sp80 = (this->pauseCtx.state != 0); @@ -939,7 +943,7 @@ void Play_Update(PlayState* this) { if (this->viewpoint != VIEWPOINT_NONE) { if (CHECK_BTN_ALL(input[0].press.button, BTN_CUP)) { -#if (defined ENABLE_INV_EDITOR && defined ENABLE_EVENT_EDITOR) +#if (defined ENABLE_INV_EDITOR || defined ENABLE_EVENT_EDITOR) if ((this->pauseCtx.state != 0) || (this->pauseCtx.debugState != 0)) { #else if (this->pauseCtx.state != 0) { @@ -967,7 +971,7 @@ void Play_Update(PlayState* this) { PLAY_LOG(3716); -#if (defined ENABLE_INV_EDITOR && defined ENABLE_EVENT_EDITOR) +#if (defined ENABLE_INV_EDITOR || defined ENABLE_EVENT_EDITOR) if ((this->pauseCtx.state != 0) || (this->pauseCtx.debugState != 0)) { #else if (this->pauseCtx.state != 0) { @@ -1037,10 +1041,40 @@ void Play_Update(PlayState* this) { PLAY_LOG(3816); Environment_Update(this, &this->envCtx, &this->lightCtx, &this->pauseCtx, &this->msgCtx, &this->gameOverCtx, this->state.gfxCtx); + +#ifdef ENABLE_ACTOR_DEBUGGER + if (CHECK_BTN_COMBO(ACTORDBG_BTN_COMBO, + &this->state.input[ACTORDBG_CONTROLLER_PORT], ACTORDBG_BTN_HOLD_FOR_COMBO, ACTORDBG_TOGGLE)) { + BREG(0) ^= 1; + } + + if (CHECK_BTN_COMBO(ACTORDBG_BTN_COMBO, + &this->state.input[ACTORDBG_CONTROLLER_PORT], ACTORDBG_BTN_HOLD_FOR_COMBO, ACTORDBG_DECR_PATH_IDX) && BREG(1) > 0) { + BREG(1)--; + } + + if (CHECK_BTN_COMBO(ACTORDBG_BTN_COMBO, + &this->state.input[ACTORDBG_CONTROLLER_PORT], ACTORDBG_BTN_HOLD_FOR_COMBO, ACTORDBG_INCR_PATH_IDX)) { + BREG(1)++; + } + + if (ACTORDBG_PRINT_INFOS) { + BREG(5) = 1; + } else { + BREG(5) = 0; + } +#endif + +#ifdef ENABLE_MSG_DEBUGGER + if (CHECK_BTN_COMBO(MSGDBG_BTN_COMBO, + &this->state.input[MSGDBG_CONTROLLER_PORT], MSGDBG_BTN_HOLD_FOR_COMBO, MSGDBG_OPEN_TEXTBOX)) { + this->enableMsgDbg ^= 1; + } +#endif } void Play_DrawOverlayElements(PlayState* this) { -#if (defined ENABLE_INV_EDITOR && defined ENABLE_EVENT_EDITOR) +#if (defined ENABLE_INV_EDITOR || defined ENABLE_EVENT_EDITOR) if ((this->pauseCtx.state != 0) || (this->pauseCtx.debugState != 0)) { #else if (this->pauseCtx.state != 0) { diff --git a/src/code/z_sram.c b/src/code/z_sram.c index ac77357120..ff7b580951 100644 --- a/src/code/z_sram.c +++ b/src/code/z_sram.c @@ -262,7 +262,7 @@ static SavePlayerData sDebugSavePlayerData = { }; static ItemEquips sDebugSaveEquips = { - { ITEM_SWORD_MASTER, ITEM_BOW, ITEM_BOMB, ITEM_OCARINA_FAIRY }, // buttonItems + { ITEM_NONE, ITEM_NONE, ITEM_NONE, ITEM_NONE }, // buttonItems { SLOT_BOW, SLOT_BOMB, SLOT_OCARINA }, // cButtonSlots // equipment (EQUIP_VALUE_SWORD_MASTER << (EQUIP_TYPE_SWORD * 4)) | (EQUIP_VALUE_SHIELD_HYLIAN << (EQUIP_TYPE_SHIELD * 4)) | @@ -371,10 +371,10 @@ void Sram_InitDebugSave(void) { SET_EVENTCHKINF(EVENTCHKINF_C4); if (LINK_AGE_IN_YEARS == YEARS_CHILD) { - gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KOKIRI; + gSaveContext.equips.buttonItems[0] = ITEM_NONE; Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_KOKIRI); if (gSaveContext.fileNum == 0xFF) { - gSaveContext.equips.buttonItems[1] = ITEM_SLINGSHOT; + gSaveContext.equips.buttonItems[1] = ITEM_NONE; gSaveContext.equips.cButtonSlots[0] = SLOT_SLINGSHOT; Inventory_ChangeEquipment(EQUIP_TYPE_SHIELD, EQUIP_VALUE_SHIELD_DEKU); } diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 7aa03829c8..64c06dc87e 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -10518,6 +10518,13 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { sControlInput = input; + if (IS_DAY) { + gSaveContext.dayTime -= gTimeSpeed; + } else { + // doubled to compensate for time moving twice as fast at night + gSaveContext.dayTime -= gTimeSpeed * 2; + } + if (this->unk_A86 < 0) { this->unk_A86++; if (this->unk_A86 == 0) { @@ -13218,12 +13225,9 @@ void func_8084FBF4(Player* this, PlayState* play) { #ifdef ENABLE_NO_CLIP // handles no clip mode, returns 0 when it's in no clip mode s32 func_8084FCAC(Player* this, PlayState* play) { - u8 buttonCombo; sControlInput = &play->state.input[NOCLIP_CONTROLLER_PORT]; - buttonCombo = NOCLIP_USE_BTN_COMBO ? CHECK_BTN_ALL(sControlInput->cur.button, NOCLIP_BTN_HOLD_FOR_COMBO) : true; - - if ((buttonCombo && CHECK_BTN_ALL(sControlInput->press.button, NOCLIP_TOGGLE_BTN))) { + if (CHECK_BTN_COMBO(NOCLIP_USE_BTN_COMBO, sControlInput, NOCLIP_BTN_HOLD_FOR_COMBO, NOCLIP_TOGGLE_BTN)) { isNoClipEnabled ^= 1; } diff --git a/src/overlays/gamestates/ovl_select/z_select.c b/src/overlays/gamestates/ovl_select/z_select.c index 0e2c7756e4..a1f16dd487 100644 --- a/src/overlays/gamestates/ovl_select/z_select.c +++ b/src/overlays/gamestates/ovl_select/z_select.c @@ -399,7 +399,7 @@ void MapSelect_LoadGame(MapSelectState* this, s32 entranceIndex) { osSyncPrintf("\n\n\nFILE_NO=%x\n\n\n", gSaveContext.fileNum); osSyncPrintf(VT_RST); if (gSaveContext.fileNum == 0xFF) { - Sram_InitDebugSave(); + Sram_InitNewSave(); // Set the fill target to be the saved magic amount gSaveContext.magicFillTarget = gSaveContext.magic; // Set `magicLevel` and `magic` to 0 so `magicCapacity` then `magic` grows from nothing diff --git a/src/overlays/gamestates/ovl_select/z_select.h b/src/overlays/gamestates/ovl_select/z_select.h index ac240034cf..ab2497e980 100644 --- a/src/overlays/gamestates/ovl_select/z_select.h +++ b/src/overlays/gamestates/ovl_select/z_select.h @@ -64,6 +64,9 @@ static const Color_RGBA8 sColors[] = { static SceneSelectEntry sScenes[] = { { "Title Screen", (void*)MapSelect_LoadTitle, 0 }, +#if ((defined BOOT_TO_SCENE) || (defined BOOT_TO_SCENE_NEW_GAME_ONLY)) + { "Boot To Scene", MapSelect_LoadGame, BOOT_ENTRANCE }, +#endif { "Hyrule Field", MapSelect_LoadGame, ENTR_HYRULE_FIELD_0 }, { "Kakariko Village", MapSelect_LoadGame, ENTR_KAKARIKO_VILLAGE_0 }, { "Graveyard", MapSelect_LoadGame, ENTR_GRAVEYARD_0 }, diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c index d82ef3c9d6..cc4507bd77 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c @@ -344,7 +344,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { index = cursorSlot * 4; // required to match? KaleidoScope_SetCursorVtx(pauseCtx, index, pauseCtx->itemVtx); -#if (defined ENABLE_INV_EDITOR && defined ENABLE_EVENT_EDITOR) +#if (defined ENABLE_INV_EDITOR || defined ENABLE_EVENT_EDITOR) if ((pauseCtx->debugState == 0) && (pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0)) { #else if ((pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0)) { diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index 50524e54ad..e70ffea0ed 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -393,9 +393,10 @@ void KaleidoScope_SwitchPage(PauseContext* pauseCtx, u8 pt) { Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_ALL); } -void KaleidoScope_HandlePageToggles(PauseContext* pauseCtx, Input* input) { +void KaleidoScope_HandlePageToggles(PauseContext* pauseCtx, Input* input, Input* invEditorInput) { #ifdef ENABLE_INV_EDITOR - if ((pauseCtx->debugState == 0) && CHECK_BTN_ALL(input->press.button, BTN_L)) { + if ((pauseCtx->debugState == 0) && + CHECK_BTN_COMBO(INV_EDITOR_BTN_COMBO, invEditorInput, INV_EDITOR_BTN_HOLD_FOR_COMBO, BTN_L)) { pauseCtx->debugState = 1; return; } @@ -2287,7 +2288,7 @@ void KaleidoScope_Draw(PlayState* play) { gSPSegment(POLY_OPA_DISP++, 0x0C, pauseCtx->iconItemAltSegment); gSPSegment(POLY_OPA_DISP++, 0x0D, pauseCtx->iconItemLangSegment); -#if (defined ENABLE_INV_EDITOR && defined ENABLE_EVENT_EDITOR) +#if (defined ENABLE_INV_EDITOR || defined ENABLE_EVENT_EDITOR) if (pauseCtx->debugState == 0) { #endif KaleidoScope_SetView(pauseCtx, pauseCtx->eye.x, pauseCtx->eye.y, pauseCtx->eye.z); @@ -2305,7 +2306,7 @@ void KaleidoScope_Draw(PlayState* play) { if (!((pauseCtx->state >= 8) && (pauseCtx->state <= 0x11))) { KaleidoScope_DrawInfoPanel(play); } -#if (defined ENABLE_INV_EDITOR && defined ENABLE_EVENT_EDITOR) +#if (defined ENABLE_INV_EDITOR || defined ENABLE_EVENT_EDITOR) } #endif @@ -2518,7 +2519,7 @@ void KaleidoScope_Update(PlayState* play) { pauseCtx->stickAdjX = input->rel.stick_x; pauseCtx->stickAdjY = input->rel.stick_y; KaleidoScope_UpdateCursorSize(play); - KaleidoScope_HandlePageToggles(pauseCtx, input); + KaleidoScope_HandlePageToggles(pauseCtx, input, &play->state.input[INV_EDITOR_CONTORLLER_PORT]); } else if ((pauseCtx->pageIndex == PAUSE_QUEST) && ((pauseCtx->unk_1E4 < 3) || (pauseCtx->unk_1E4 == 5))) { KaleidoScope_UpdateCursorSize(play); } From d87ecbe72b5d95d6726782fa48f30de7d4a54a8e Mon Sep 17 00:00:00 2001 From: Yanis42 <35189056+Yanis42@users.noreply.github.com> Date: Mon, 16 Jan 2023 17:45:48 +0100 Subject: [PATCH 2/6] post-merge fixes --- include/config/config_debug_features.h | 2 +- src/code/db_camera.c | 18 +++++++++--------- src/code/z_camera.c | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/config/config_debug_features.h b/include/config/config_debug_features.h index 6877054bc2..d91a5ed589 100644 --- a/include/config/config_debug_features.h +++ b/include/config/config_debug_features.h @@ -76,7 +76,7 @@ /**** [CAMERA DEBUGGER] ****/ // Includes a cutscene debugger/exporter -// #define ENABLE_CAMERA_DEBUGGER +#define ENABLE_CAMERA_DEBUGGER /**** [AUDIO DEBUGGER] ****/ // #define ENABLE_AUDIO_DEBUGGER // TODO: controls diff --git a/src/code/db_camera.c b/src/code/db_camera.c index 5e8df66201..0574cb1741 100644 --- a/src/code/db_camera.c +++ b/src/code/db_camera.c @@ -196,9 +196,9 @@ s32 DebugCamera_LoadCallback(char* c); s32 DebugCamera_ClearCallback(char* c); s32 DebugCamera_UpdateDemoControl(DebugCam* debugCam, Camera* cam); -static debugCam* sDbCamPtr; +static DebugCam* sDebugCamPtr; static s16 D_8016110C; // export cutscene slot index ('A' to 'O') -static debugCamAnim sDebugCamAnim; +static DebugCamAnim sDebugCamAnim; Vec3f* DebugCamera_AddVecGeoToVec3f(Vec3f* dest, Vec3f* a, VecGeo* geo) { Vec3f sum; @@ -1099,7 +1099,7 @@ void DebugCamera_Update(DebugCam* debugCam, Camera* cam) { if (debugCam->unk_00 == 1) { // demo camera tool OREG(0) = 8; - DebugCamera_ScreenTextColored(12, 5, DebugCamera_TEXT_YELLOW, D_8012CEF4); + DebugCamera_ScreenTextColored(12, 5, DEBUG_CAM_TEXT_YELLOW, D_8012CEF4); if (CHECK_BTN_ALL(sPlay->state.input[DEBUG_CAM_CONTROLLER_PORT].cur.button, CAMDBG_CSTOOL_PLAYBACK) && !CHECK_BTN_ALL(sPlay->state.input[DEBUG_CAM_CONTROLLER_PORT].cur.button, CAMDBG_CSTOOL_BTN_HOLD_FOR_COMBO)) { func_800B44E0(debugCam, cam); @@ -2234,8 +2234,8 @@ s32 DebugCamera_UpdateDemoControl(DebugCam* debugCam, Camera* cam) { } goto block_2; } else { - DebugCamera_ScreenTextColored(12, 26, DebugCamera_TEXT_GOLD, D_8012CF60[0]); - DebugCamera_ScreenTextColored(19, 26, DebugCamera_TEXT_GOLD, D_8012CF80); // mempak not found + DebugCamera_ScreenTextColored(12, 26, DEBUG_CAM_TEXT_GOLD, D_8012CF60[0]); + DebugCamera_ScreenTextColored(19, 26, DEBUG_CAM_TEXT_GOLD, D_8012CF80); // mempak not found if (CHECK_BTN_ALL(sPlay->state.input[DEBUG_CAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_RETURN_TO_PREV_MENU) || CHECK_BTN_ALL(sPlay->state.input[DEBUG_CAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_PREV_MENU) || CHECK_BTN_ALL(sPlay->state.input[DEBUG_CAM_CONTROLLER_PORT].press.button, CAMDBG_CSCTRL_NEXT_MENU)) { @@ -2435,10 +2435,10 @@ s32 DebugCamera_UpdateDemoControl(DebugCam* debugCam, Camera* cam) { if (CHECK_BTN_COMBO(CAMDBG_PRINT_DATA_USE_COMBO, &sPlay->state.input[DEBUG_CAM_CONTROLLER_PORT], CAMDBG_CSCTRL_BTN_HOLD_FOR_COMBO, CAMDBG_PRINT_DATA)) { - for (i = 0; i < ARRAY_COUNT(sdebugCamCuts) - 1; i++) { - osSyncPrintf("###%2d:(%c) (%d %d) %d %d %d\n", i, sdebugCamCuts[i].letter, - sdebugCamCuts[i].position, sdebugCamCuts[i].lookAt, sdebugCamCuts[i].nFrames, - sdebugCamCuts[i].nPoints, sdebugCamCuts[i].mode); + for (i = 0; i < ARRAY_COUNT(sDebugCamCuts) - 1; i++) { + osSyncPrintf("###%2d:(%c) (%d %d) %d %d %d\n", i, sDebugCamCuts[i].letter, + sDebugCamCuts[i].position, sDebugCamCuts[i].lookAt, sDebugCamCuts[i].nFrames, + sDebugCamCuts[i].nPoints, sDebugCamCuts[i].mode); } DebugCamera_PrintAllCuts(cam); } else if (CHECK_BTN_COMBO(CAMDBG_PRINT_DATA_USE_COMBO, diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 7ddd63c259..00f9ac0397 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -7493,7 +7493,7 @@ s32 Camera_DbgChangeMode(Camera* camera) { } if (Camera_ChangeSetting(camera, D_8011DAFC[sDbgModeIdx]) > 0) { - if (R_DBG_CAM_UPDATE) { + if (R_DEBUG_CAM_UPDATE) { osSyncPrintf("camera: force change SET to %s!\n", sCameraSettingNames[D_8011DAFC[sDbgModeIdx]]); } return true; @@ -7767,7 +7767,7 @@ Vec3s Camera_Update(Camera* camera) { Cutscene_StopManual(camera->play, &camera->play->csCtx); } - osSyncPrintf("gDbgCamEnabled: %X\n", gDbgCamEnabled); + osSyncPrintf("gDebugCamEnabled: %X\n", gDebugCamEnabled); } // Debug cam update From bc9db9bbdf715aa6a82531f765a0d9479f3a0580 Mon Sep 17 00:00:00 2001 From: Yanis42 <35189056+Yanis42@users.noreply.github.com> Date: Mon, 16 Jan 2023 19:48:58 +0100 Subject: [PATCH 3/6] reverted safeguard --- include/config/config_safeguards.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/config/config_safeguards.h b/include/config/config_safeguards.h index 63a6b3cc0c..84e71e66f7 100644 --- a/include/config/config_safeguards.h +++ b/include/config/config_safeguards.h @@ -14,7 +14,7 @@ * config_debug.h */ #ifndef DEBUG_ROM - // #define DISABLE_DEBUG_FEATURES + #define DISABLE_DEBUG_FEATURES #undef DETERMINISTIC_BUILD #undef SKIP_N64_BOOT_LOGO #undef BOOT_TO_SCENE From c6274132b2e0962d64769e218b542b5e11519c0c Mon Sep 17 00:00:00 2001 From: Yanis42 <35189056+Yanis42@users.noreply.github.com> Date: Sun, 22 Jan 2023 09:56:04 +0100 Subject: [PATCH 4/6] re-comment the camera toggle (whoops) --- include/config/config_debug_features.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/config/config_debug_features.h b/include/config/config_debug_features.h index d91a5ed589..6877054bc2 100644 --- a/include/config/config_debug_features.h +++ b/include/config/config_debug_features.h @@ -76,7 +76,7 @@ /**** [CAMERA DEBUGGER] ****/ // Includes a cutscene debugger/exporter -#define ENABLE_CAMERA_DEBUGGER +// #define ENABLE_CAMERA_DEBUGGER /**** [AUDIO DEBUGGER] ****/ // #define ENABLE_AUDIO_DEBUGGER // TODO: controls From 1bb57481b94f947087d659cc97f55054186ed846 Mon Sep 17 00:00:00 2001 From: Yanis42 <35189056+Yanis42@users.noreply.github.com> Date: Sun, 3 Sep 2023 15:56:14 +0200 Subject: [PATCH 5/6] contorller -> controller --- include/config/config_debug_controls.h | 6 +++--- src/code/flg_set.c | 2 +- src/code/graph.c | 2 +- src/code/z_kaleido_setup.c | 2 +- src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/config/config_debug_controls.h b/include/config/config_debug_controls.h index 9a86468548..4c1376eb47 100644 --- a/include/config/config_debug_controls.h +++ b/include/config/config_debug_controls.h @@ -73,7 +73,7 @@ /**** [MAP SELECT CONTROLS] ****/ // Controller port to use -#define MAP_SELECT_CONTORLLER_PORT CONTROLLER_PORT_1 +#define MAP_SELECT_CONTROLLER_PORT CONTROLLER_PORT_1 // Set to true to use a button combo #define MAP_SELECT_BTN_COMBO true @@ -86,7 +86,7 @@ /**** [INVENTORY EDITOR CONTROLS] ****/ // Controller port to use -#define INV_EDITOR_CONTORLLER_PORT CONTROLLER_PORT_1 +#define INV_EDITOR_CONTROLLER_PORT CONTROLLER_PORT_1 // Set to true to use a button combo #define INV_EDITOR_BTN_COMBO false @@ -99,7 +99,7 @@ /**** [EVENT EDITOR CONTROLS] ****/ // Controller port to use -#define EVENT_EDITOR_CONTORLLER_PORT CONTROLLER_PORT_1 +#define EVENT_EDITOR_CONTROLLER_PORT CONTROLLER_PORT_1 // Set to true to use a button combo #define EVENT_EDITOR_BTN_COMBO true diff --git a/src/code/flg_set.c b/src/code/flg_set.c index f532bd5ce1..f5021352db 100644 --- a/src/code/flg_set.c +++ b/src/code/flg_set.c @@ -40,7 +40,7 @@ void FlagSet_Update(PlayState* play) { }; GraphicsContext* gfxCtx = play->state.gfxCtx; - Input* input = &play->state.input[EVENT_EDITOR_CONTORLLER_PORT]; + Input* input = &play->state.input[EVENT_EDITOR_CONTROLLER_PORT]; Gfx* gfx; Gfx* polyOpa; diff --git a/src/code/graph.c b/src/code/graph.c index 4742f6d1e5..e4a2ad7d69 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -403,7 +403,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { } #ifdef ENABLE_MAP_SELECT - if(CHECK_BTN_COMBO(MAP_SELECT_BTN_COMBO, &gameState->input[MAP_SELECT_CONTORLLER_PORT], MAP_SELECT_BTN_HOLD_FOR_COMBO, MAP_SELECT_OPEN)) { + if(CHECK_BTN_COMBO(MAP_SELECT_BTN_COMBO, &gameState->input[MAP_SELECT_CONTROLLER_PORT], MAP_SELECT_BTN_HOLD_FOR_COMBO, MAP_SELECT_OPEN)) { gSaveContext.gameMode = GAMEMODE_NORMAL; SET_NEXT_GAMESTATE(gameState, MapSelect_Init, MapSelectState); gameState->running = false; diff --git a/src/code/z_kaleido_setup.c b/src/code/z_kaleido_setup.c index 8ae885cc42..df484df4ee 100644 --- a/src/code/z_kaleido_setup.c +++ b/src/code/z_kaleido_setup.c @@ -13,7 +13,7 @@ void KaleidoSetup_Update(PlayState* play) { Input* input = &play->state.input[0]; #ifdef ENABLE_EVENT_EDITOR - Input* evEditorInput = &play->state.input[EVENT_EDITOR_CONTORLLER_PORT]; + Input* evEditorInput = &play->state.input[EVENT_EDITOR_CONTROLLER_PORT]; #endif u8 canUpdate = diff --git a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index bdb85cab45..1b625ea0e8 100644 --- a/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -2519,7 +2519,7 @@ void KaleidoScope_Update(PlayState* play) { pauseCtx->stickAdjX = input->rel.stick_x; pauseCtx->stickAdjY = input->rel.stick_y; KaleidoScope_UpdateCursorSize(play); - KaleidoScope_HandlePageToggles(pauseCtx, input, &play->state.input[INV_EDITOR_CONTORLLER_PORT]); + KaleidoScope_HandlePageToggles(pauseCtx, input, &play->state.input[INV_EDITOR_CONTROLLER_PORT]); } else if ((pauseCtx->pageIndex == PAUSE_QUEST) && ((pauseCtx->unk_1E4 < 3) || (pauseCtx->unk_1E4 == 5))) { KaleidoScope_UpdateCursorSize(play); } From 6f06f8989f5e361a3a5cf68c754cbdcea804f91a Mon Sep 17 00:00:00 2001 From: Yanis42 <35189056+Yanis42@users.noreply.github.com> Date: Sun, 10 Sep 2023 14:43:13 +0200 Subject: [PATCH 6/6] fix compile issues --- src/code/z_debug.c | 6 +++--- src/overlays/actors/ovl_player_actor/z_player.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/code/z_debug.c b/src/code/z_debug.c index 2589b25013..90483fe7c7 100644 --- a/src/code/z_debug.c +++ b/src/code/z_debug.c @@ -226,9 +226,9 @@ void Regs_UpdateEditor(Input* input) { gRegEditor->dPadInputPrev = dPadInputCur; } - incrementBy1000 = CHECK_BTN_ALL(input->cur.button, REGS_EDITOR_INCDEC_1000) - incrementBy100 = CHECK_BTN_ALL(input->cur.button, REGS_EDITOR_INCDEC_100) - incrementBy10 = CHECK_BTN_ALL(input->cur.button, REGS_EDITOR_INCDEC_10) + incrementBy1000 = CHECK_BTN_ALL(input->cur.button, REGS_EDITOR_INCDEC_1000); + incrementBy100 = CHECK_BTN_ALL(input->cur.button, REGS_EDITOR_INCDEC_100); + incrementBy10 = CHECK_BTN_ALL(input->cur.button, REGS_EDITOR_INCDEC_10); increment = CHECK_BTN_ANY(dPadInputCur, BTN_DRIGHT) ? (incrementBy1000 ? 1000 diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 35cddc6c20..b26102a9d2 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -10558,10 +10558,10 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { sControlInput = input; if (IS_DAY) { - gSaveContext.dayTime -= gTimeSpeed; + gSaveContext.save.dayTime -= gTimeSpeed; } else { // doubled to compensate for time moving twice as fast at night - gSaveContext.dayTime -= gTimeSpeed * 2; + gSaveContext.save.dayTime -= gTimeSpeed * 2; } if (this->unk_A86 < 0) {