Compare commits
3 Commits
nightly-24
...
debug
Author | SHA1 | Date | |
---|---|---|---|
2b76b1d086 | |||
0aebf688a3 | |||
8980f61306 |
14
CREDITS.md
14
CREDITS.md
@ -20,6 +20,20 @@
|
||||
- @itsdarsh: keep being a legend.
|
||||
|
||||
|
||||
# more people
|
||||
|
||||
TheXaman
|
||||
ExpoSeed
|
||||
DizzyEggg
|
||||
Ketsuban
|
||||
Zeuturic
|
||||
ipatix
|
||||
paccy
|
||||
surskitty
|
||||
Lunos
|
||||
ShinyDragonHunter
|
||||
|
||||
|
||||
# Other awesome people:
|
||||
|
||||
Anyone and everyone I possibly forgot!
|
||||
|
5
Makefile
5
Makefile
@ -301,6 +301,11 @@ else
|
||||
$(C_BUILDDIR)/librfu_intr.o: CFLAGS := -mthumb-interwork -O2 -mabi=apcs-gnu -mtune=arm7tdmi -march=armv4t -fno-toplevel-reorder -Wno-pointer-to-int-cast
|
||||
endif
|
||||
|
||||
ifeq ($(DDEBUG), 1)
|
||||
override ASFLAGS += --defsym DEBUG=1
|
||||
override CPPFLAGS += -D DEBUG=1
|
||||
endif
|
||||
|
||||
ifeq ($(DINFO),1)
|
||||
override CFLAGS += -g
|
||||
endif
|
||||
|
8
include/debug.h
Normal file
8
include/debug.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef GUARD_DEBUG_H
|
||||
#define GUARD_DEBUG_H
|
||||
#if DEBUG
|
||||
|
||||
void Debug_ShowMainMenu(void);
|
||||
|
||||
#endif
|
||||
#endif // GUARD_DEBUG_H
|
@ -101,6 +101,7 @@ SECTIONS {
|
||||
src/random.o(.text);
|
||||
src/util.o(.text);
|
||||
src/daycare.o(.text);
|
||||
src/debug.o(.text);
|
||||
src/egg_hatch.o(.text);
|
||||
src/battle_interface.o(.text);
|
||||
src/battle_anim_smokescreen.o(.text);
|
||||
@ -486,6 +487,7 @@ SECTIONS {
|
||||
src/trig.o(.rodata);
|
||||
src/util.o(.rodata);
|
||||
src/daycare.o(.rodata);
|
||||
src/debug.o(.rodata);
|
||||
src/egg_hatch.o(.rodata);
|
||||
src/battle_gfx_sfx_util.o(.rodata);
|
||||
src/battle_interface.o(.rodata);
|
||||
|
206
src/debug.c
Normal file
206
src/debug.c
Normal file
@ -0,0 +1,206 @@
|
||||
#if DEBUG
|
||||
|
||||
#include "global.h"
|
||||
#include "battle.h"
|
||||
#include "coins.h"
|
||||
#include "credits.h"
|
||||
#include "data.h"
|
||||
#include "daycare.h"
|
||||
#include "event_data.h"
|
||||
#include "event_object_movement.h"
|
||||
#include "event_scripts.h"
|
||||
#include "field_message_box.h"
|
||||
#include "field_screen_effect.h"
|
||||
#include "international_string_util.h"
|
||||
#include "item.h"
|
||||
#include "item_icon.h"
|
||||
#include "list_menu.h"
|
||||
#include "m4a.h"
|
||||
#include "main.h"
|
||||
#include "main_menu.h"
|
||||
#include "malloc.h"
|
||||
#include "map_name_popup.h"
|
||||
#include "menu.h"
|
||||
#include "money.h"
|
||||
#include "naming_screen.h"
|
||||
#include "new_game.h"
|
||||
#include "overworld.h"
|
||||
#include "palette.h"
|
||||
#include "pokedex.h"
|
||||
#include "pokemon.h"
|
||||
#include "pokemon_icon.h"
|
||||
#include "pokemon_storage_system.h"
|
||||
#include "random.h"
|
||||
#include "region_map.h"
|
||||
#include "script.h"
|
||||
#include "script_pokemon_util.h"
|
||||
#include "sound.h"
|
||||
#include "strings.h"
|
||||
#include "string_util.h"
|
||||
#include "task.h"
|
||||
#include "pokemon_summary_screen.h"
|
||||
#include "constants/abilities.h"
|
||||
#include "constants/flags.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/map_groups.h"
|
||||
#include "constants/rgb.h"
|
||||
#include "constants/songs.h"
|
||||
#include "constants/species.h"
|
||||
|
||||
#define DEBUG_MAIN_MENU_HEIGHT 7
|
||||
#define DEBUG_MAIN_MENU_WIDTH 11
|
||||
|
||||
void Debug_ShowMainMenu(void);
|
||||
static void Debug_DestroyMainMenu(u8);
|
||||
static void DebugAction_HealParty(u8 taskId);
|
||||
static void DebugAction_Fly(u8 taskId);
|
||||
static void DebugAction_Cancel(u8);
|
||||
static void DebugTask_HandleMainMenuInput(u8);
|
||||
|
||||
enum {
|
||||
DEBUG_MENU_ITEM_HEAL_PARTY,
|
||||
DEBUG_MENU_ITEM_FLY,
|
||||
DEBUG_MENU_ITEM_CANCEL,
|
||||
};
|
||||
|
||||
static const u8 gDebugText_HealParty[] = _("Heal party");
|
||||
static const u8 gDebugText_Fly[] = _("Fly");
|
||||
static const u8 gDebugText_Cancel[] = _("Cancel");
|
||||
|
||||
static const struct ListMenuItem sDebugMenuItems[] =
|
||||
{
|
||||
[DEBUG_MENU_ITEM_HEAL_PARTY] = {gDebugText_HealParty, DEBUG_MENU_ITEM_HEAL_PARTY}
|
||||
[DEBUG_MENU_ITEM_FLY] = {gDebugText_Fly, DEBUG_MENU_ITEM_FLY}
|
||||
[DEBUG_MENU_ITEM_CANCEL] = {gDebugText_Cancel, DEBUG_MENU_ITEM_CANCEL}
|
||||
};
|
||||
|
||||
static void (*const sDebugMenuActions[])(u8) =
|
||||
{
|
||||
[DEBUG_MENU_ITEM_HEAL_PARTY] = DebugAction_HealParty
|
||||
[DEBUG_MENU_ITEM_FLY] = DebugAction_Fly
|
||||
[DEBUG_MENU_ITEM_CANCEL] = DebugAction_Cancel
|
||||
};
|
||||
|
||||
static const struct WindowTemplate sDebugMenuWindowTemplate =
|
||||
{
|
||||
.bg = 0,
|
||||
.tilemapLeft = 1,
|
||||
.tilemapTop = 1,
|
||||
.width = DEBUG_MAIN_MENU_WIDTH,
|
||||
.height = 2 * DEBUG_MAIN_MENU_HEIGHT,
|
||||
.paletteNum = 15,
|
||||
.baseBlock = 1,
|
||||
};
|
||||
|
||||
static const struct ListMenuTemplate sDebugMenuListTemplate =
|
||||
{
|
||||
.items = sDebugMenuItems,
|
||||
.moveCursorFunc = ListMenuDefaultCursorMoveFunc,
|
||||
.totalItems = ARRAY_COUNT(sDebugMenuItems),
|
||||
.maxShowed = DEBUG_MAIN_MENU_HEIGHT,
|
||||
.windowId = 0,
|
||||
.header_X = 0,
|
||||
.item_X = 8,
|
||||
.cursor_X = 0,
|
||||
.upText_Y = 1,
|
||||
.cursorPal = 2,
|
||||
.fillValue = 1,
|
||||
.cursorShadowPal = 3,
|
||||
.lettersSpacing = 1,
|
||||
.itemVerticalPadding = 0,
|
||||
.scrollMultiple = LIST_NO_MULTIPLE_SCROLL,
|
||||
.fontId = 1,
|
||||
.cursorKind = 0
|
||||
};
|
||||
|
||||
void Debug_ShowMainMenu(void) {
|
||||
struct ListMenuTemplate menuTemplate;
|
||||
u8 windowId;
|
||||
u8 menuTaskId;
|
||||
u8 inputTaskId;
|
||||
|
||||
// create window
|
||||
HideMapNamePopUpWindow();
|
||||
LoadMessageBoxAndBorderGfx();
|
||||
windowId = AddWindow(&sDebugMenuWindowTemplate);
|
||||
DrawStdWindowFrame(windowId, FALSE);
|
||||
|
||||
// create list menu
|
||||
menuTemplate = sDebugMenuListTemplate;
|
||||
menuTemplate.windowId = windowId;
|
||||
menuTaskId = ListMenuInit(&menuTemplate, 0, 0);
|
||||
|
||||
// draw everything
|
||||
CopyWindowToVram(windowId, 3);
|
||||
|
||||
// create input handler task
|
||||
inputTaskId = CreateTask(DebugTask_HandleMainMenuInput, 3);
|
||||
gTasks[inputTaskId].data[0] = menuTaskId;
|
||||
gTasks[inputTaskId].data[1] = windowId;
|
||||
}
|
||||
|
||||
static void Debug_DestroyMainMenu(u8 taskId)
|
||||
{
|
||||
DestroyListMenuTask(gTasks[taskId].data[0], NULL, NULL);
|
||||
ClearStdWindowAndFrame(gTasks[taskId].data[1], TRUE);
|
||||
RemoveWindow(gTasks[taskId].data[1]);
|
||||
DestroyTask(taskId);
|
||||
EnableBothScriptContexts();
|
||||
}
|
||||
|
||||
static void DebugTask_HandleMainMenuInput(u8 taskId)
|
||||
{
|
||||
void (*func)(u8);
|
||||
u32 input = ListMenu_ProcessInput(gTasks[taskId].data[0]);
|
||||
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
if ((func = sDebugMenuActions[input]) != NULL)
|
||||
func(taskId);
|
||||
}
|
||||
else if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
Debug_DestroyMainMenu(taskId);
|
||||
}
|
||||
}
|
||||
|
||||
static void DebugAction_Cancel(u8 taskId)
|
||||
{
|
||||
Debug_DestroyMainMenu(taskId);
|
||||
}
|
||||
|
||||
static void DebugAction_Fly(u8 taskId)
|
||||
{
|
||||
FlagSet(FLAG_VISITED_LITTLEROOT_TOWN);
|
||||
FlagSet(FLAG_VISITED_OLDALE_TOWN);
|
||||
FlagSet(FLAG_VISITED_DEWFORD_TOWN);
|
||||
FlagSet(FLAG_VISITED_LAVARIDGE_TOWN);
|
||||
FlagSet(FLAG_VISITED_FALLARBOR_TOWN);
|
||||
FlagSet(FLAG_VISITED_VERDANTURF_TOWN);
|
||||
FlagSet(FLAG_VISITED_PACIFIDLOG_TOWN);
|
||||
FlagSet(FLAG_VISITED_PETALBURG_CITY);
|
||||
FlagSet(FLAG_VISITED_SLATEPORT_CITY);
|
||||
FlagSet(FLAG_VISITED_MAUVILLE_CITY);
|
||||
FlagSet(FLAG_VISITED_RUSTBORO_CITY);
|
||||
FlagSet(FLAG_VISITED_FORTREE_CITY);
|
||||
FlagSet(FLAG_VISITED_LILYCOVE_CITY);
|
||||
FlagSet(FLAG_VISITED_MOSSDEEP_CITY);
|
||||
FlagSet(FLAG_VISITED_SOOTOPOLIS_CITY);
|
||||
FlagSet(FLAG_VISITED_EVER_GRANDE_CITY);
|
||||
FlagSet(FLAG_LANDMARK_POKEMON_LEAGUE);
|
||||
FlagSet(FLAG_LANDMARK_BATTLE_FRONTIER);
|
||||
Debug_DestroyMenu(taskId);
|
||||
SetMainCallback2(CB2_OpenFlyMap);
|
||||
}
|
||||
|
||||
static void DebugAction_Util_HealParty(u8 taskId)
|
||||
{
|
||||
PlaySE(SE_USE_ITEM);
|
||||
HealPlayerParty();
|
||||
EnableBothScriptContexts();
|
||||
Debug_DestroyMenu(taskId);
|
||||
}
|
||||
|
||||
#endif
|
@ -3,6 +3,7 @@
|
||||
#include "bike.h"
|
||||
#include "coord_event_weather.h"
|
||||
#include "daycare.h"
|
||||
#include "debug.h"
|
||||
#include "faraway_island.h"
|
||||
#include "event_data.h"
|
||||
#include "event_object_movement.h"
|
||||
@ -132,6 +133,14 @@ void FieldGetPlayerInput(struct FieldInput *input, u16 newKeys, u16 heldKeys)
|
||||
input->dpadDirection = DIR_WEST;
|
||||
else if (heldKeys & DPAD_RIGHT)
|
||||
input->dpadDirection = DIR_EAST;
|
||||
|
||||
#if DEBUG
|
||||
if ((heldKeys & R_BUTTON) && input->pressedStartButton)
|
||||
{
|
||||
input->input_field_1_2 = TRUE;
|
||||
input->pressedStartButton = FALSE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int ProcessPlayerFieldInput(struct FieldInput *input)
|
||||
@ -194,6 +203,15 @@ int ProcessPlayerFieldInput(struct FieldInput *input)
|
||||
if (input->pressedRButton && EnableAutoRun())
|
||||
return TRUE;
|
||||
|
||||
#if DEBUG
|
||||
if (input->input_field_1_2)
|
||||
{
|
||||
PlaySE(SE_WIN_OPEN);
|
||||
Debug_ShowMainMenu();
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user