Skip to content

Commit

Permalink
new debug menu (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
bates64 authored Jan 29, 2024
2 parents 7a8627b + 2cae9e1 commit 295f704
Show file tree
Hide file tree
Showing 22 changed files with 2,137 additions and 281 deletions.
2 changes: 1 addition & 1 deletion include/enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -3603,7 +3603,7 @@ enum BattleStatusFlags2 {
BS_FLAGS2_PARTNER_TURN_USED = 0x00000004, // set after partner has used their action for this turn
BS_FLAGS2_OVERRIDE_INACTIVE_PLAYER = 0x00000008, // override inactive player animations and effects
BS_FLAGS2_OVERRIDE_INACTIVE_PARTNER = 0x00000010, // override inactive partner animations and effects
BS_FLAGS2_CANT_FLEE = 0x00000020,
BS_FLAGS2_CAN_FLEE = 0x00000020,
BS_FLAGS2_PEACH_BATTLE = 0x00000040,
BS_FLAGS2_STORED_TURBO_CHARGE_TURN = 0x00000100, // prevents turbo charge turns from decrementing on begin player turn
BS_FLAGS2_DOING_JUMP_TUTORIAL = 0x00000200,
Expand Down
2 changes: 1 addition & 1 deletion include/npc.h
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ typedef struct EncounterStatus {
/* 0x00D */ char unk_0D;
/* 0x00E */ s16 coinsEarned; /* valid after battle */
/* 0x010 */ s8 instigatorValue;
/* 0x011 */ s8 allowFleeing;
/* 0x011 */ s8 forbidFleeing;
/* 0x012 */ s8 scriptedBattle; ///< battle started by StartBattle but not by encounter
/* 0x013 */ s8 dropWhackaBump;
/* 0x014 */ s32 songID;
Expand Down
1 change: 1 addition & 0 deletions include/variables.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ extern s32 gDefeatedBattleSubstate;
extern s32 gBattleSubState;
extern s32 gDefeatedBattleState;
extern s32 gCurrentBattleID;
extern s32 gCurrentStageID;
extern s32 D_800DC4E0;
extern struct Battle* gOverrideBattlePtr;

Expand Down
1 change: 1 addition & 0 deletions src/7B440.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include "common.h"
#include "dx/debug_menu.h"

SHIFT_BSS s32 PeachDisguiseNpcIndex;
SHIFT_BSS Entity* TweesterTouchingPartner;
Expand Down
11 changes: 8 additions & 3 deletions src/battle/btl_states_actions.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "battle/battle.h"
#include "model.h"
#include "game_modes.h"
#include "dx/debug_menu.h"

extern StageListRow* gCurrentStagePtr;

Expand Down Expand Up @@ -219,6 +220,10 @@ void btl_state_update_normal_start(void) {
battleStatus->curStage = stage;
switch (gBattleSubState) {
case BTL_SUBSTATE_NORMAL_START_INIT:
#if DX_DEBUG_MENU
dx_debug_set_battle_info(gCurrentBattleID << 16 | (gCurrentStageID & 0xFFFF), stage->shape);
#endif

BattleEnemiesCreated = battle->formationSize;
set_screen_overlay_params_back(OVERLAY_NONE, -1.0f);
compressedAsset = load_asset_by_name(stage->shape, &size);
Expand Down Expand Up @@ -273,9 +278,9 @@ void btl_state_update_normal_start(void) {
battleStatus->jumpCharge = 0;
battleStatus->unk_98 = 0;
battleStatus->hpDrainCount = 0;
gBattleStatus.flags2 |= BS_FLAGS2_CANT_FLEE;
if (currentEncounter->allowFleeing) {
gBattleStatus.flags2 &= ~BS_FLAGS2_CANT_FLEE;
gBattleStatus.flags2 |= BS_FLAGS2_CAN_FLEE;
if (currentEncounter->forbidFleeing) {
gBattleStatus.flags2 &= ~BS_FLAGS2_CAN_FLEE;
}
battleStatus->endBattleFadeOutRate = 10;
battleStatus->waitForState = BATTLE_STATE_0;
Expand Down
2 changes: 1 addition & 1 deletion src/battle/btl_states_menus.c
Original file line number Diff line number Diff line change
Expand Up @@ -3405,7 +3405,7 @@ void btl_state_update_player_menu(void) {
D_802AD690[entryIdx] = 1;
D_802AD658[entryIdx] = BattleMenu_LeftJustMessages[BTL_MENU_TYPE_RUN_AWAY];
D_802AD6C0[entryIdx] = MSG_Menus_Action_RunAway;
if (!(gBattleStatus.flags2 & BS_FLAGS2_CANT_FLEE)) {
if (!(gBattleStatus.flags2 & BS_FLAGS2_CAN_FLEE)) {
D_802AD640[entryIdx] = battle_menu_FleeHudScripts.disabled;
D_802AD690[entryIdx] = 0;
D_802AD6A8[entryIdx] = 1;
Expand Down
10 changes: 10 additions & 0 deletions src/cam_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "hud_element.h"
#include "camera.h"
#include "dx/profiling.h"
#include "dx/debug_menu.h"

void render_models(void);
void execute_render_tasks(void);
Expand Down Expand Up @@ -205,7 +206,13 @@ void render_frame(s32 isSecondPass) {
}
if (!(camera->flags & CAMERA_FLAG_RENDER_MODELS)) {
GFX_PROFILER_START(PROFILER_TIME_SUB_GFX_MODELS);
#if DX_DEBUG_MENU
if (!dx_debug_should_hide_models()) {
render_models();
}
#else
render_models();
#endif
GFX_PROFILER_COMPLETE(PROFILER_TIME_SUB_GFX_MODELS);
}
GFX_PROFILER_START(PROFILER_TIME_SUB_GFX_PLAYER);
Expand All @@ -218,6 +225,9 @@ void render_frame(s32 isSecondPass) {
render_effects_world();
GFX_PROFILER_SWITCH(PROFILER_TIME_SUB_GFX_EFFECTS, PROFILER_TIME_SUB_GFX_RENDER_TASKS);
execute_render_tasks();
#if DX_DEBUG_MENU
dx_debug_draw_collision();
#endif
GFX_PROFILER_SWITCH(PROFILER_TIME_SUB_GFX_RENDER_TASKS, PROFILER_TIME_SUB_GFX_HUD_ELEMENTS);
render_transformed_hud_elements();
} else {
Expand Down
4 changes: 4 additions & 0 deletions src/dx/config.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#ifndef DX
#define DX

/// Version string that appears on the file select menu.
/// Comment out this definition to prevent it from being shown.
#define DX_MOD_VERSION_STRING "New Mod 1.0.0"

/// Enables the debug menu.
#define DX_DEBUG_MENU 1

Expand Down
Loading

0 comments on commit 295f704

Please sign in to comment.