mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-01-27 13:53:52 +01:00
Basic Battle Debug Menu is done
This commit is contained in:
parent
ee3d505b58
commit
626b80106e
@ -11,6 +11,7 @@
|
|||||||
#include "battle_gfx_sfx_util.h"
|
#include "battle_gfx_sfx_util.h"
|
||||||
#include "battle_util2.h"
|
#include "battle_util2.h"
|
||||||
#include "battle_bg.h"
|
#include "battle_bg.h"
|
||||||
|
#include "battle_debug.h"
|
||||||
|
|
||||||
#define GET_BATTLER_POSITION(battler) (gBattlerPositions[battler])
|
#define GET_BATTLER_POSITION(battler) (gBattlerPositions[battler])
|
||||||
#define GET_BATTLER_SIDE(battler) (GetBattlerPosition(battler) & BIT_SIDE)
|
#define GET_BATTLER_SIDE(battler) (GetBattlerPosition(battler) & BIT_SIDE)
|
||||||
@ -33,6 +34,7 @@
|
|||||||
#define B_ACTION_CANCEL_PARTNER 12 // when choosing an action
|
#define B_ACTION_CANCEL_PARTNER 12 // when choosing an action
|
||||||
#define B_ACTION_FINISHED 12 // when executing an action
|
#define B_ACTION_FINISHED 12 // when executing an action
|
||||||
#define B_ACTION_NOTHING_FAINTED 13 // when choosing an action
|
#define B_ACTION_NOTHING_FAINTED 13 // when choosing an action
|
||||||
|
#define B_ACTION_DEBUG 20
|
||||||
#define B_ACTION_NONE 0xFF
|
#define B_ACTION_NONE 0xFF
|
||||||
|
|
||||||
#define MAX_TRAINER_ITEMS 4
|
#define MAX_TRAINER_ITEMS 4
|
||||||
@ -545,6 +547,7 @@ struct BattleStruct
|
|||||||
u8 field_2A0;
|
u8 field_2A0;
|
||||||
u8 field_2A1;
|
u8 field_2A1;
|
||||||
u8 field_2A2;
|
u8 field_2A2;
|
||||||
|
u8 debugBattler;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GET_MOVE_TYPE(move, typeArg) \
|
#define GET_MOVE_TYPE(move, typeArg) \
|
||||||
|
@ -170,6 +170,7 @@ enum
|
|||||||
CONTROLLER_LINKSTANDBYMSG,
|
CONTROLLER_LINKSTANDBYMSG,
|
||||||
CONTROLLER_RESETACTIONMOVESELECTION,
|
CONTROLLER_RESETACTIONMOVESELECTION,
|
||||||
CONTROLLER_55,
|
CONTROLLER_55,
|
||||||
|
CONTROLLER_DEBUGMENU,
|
||||||
/*new controllers should go here*/
|
/*new controllers should go here*/
|
||||||
CONTROLLER_TERMINATOR_NOP,
|
CONTROLLER_TERMINATOR_NOP,
|
||||||
CONTROLLER_CMDS_COUNT
|
CONTROLLER_CMDS_COUNT
|
||||||
@ -240,6 +241,7 @@ void BtlController_EmitBattleAnimation(u8 bufferId, u8 animationId, u16 argument
|
|||||||
void BtlController_EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 arg2);
|
void BtlController_EmitLinkStandbyMsg(u8 bufferId, u8 arg1, bool32 arg2);
|
||||||
void BtlController_EmitResetActionMoveSelection(u8 bufferId, u8 caseId);
|
void BtlController_EmitResetActionMoveSelection(u8 bufferId, u8 caseId);
|
||||||
void BtlController_EmitCmd55(u8 bufferId, u8 battleOutcome);
|
void BtlController_EmitCmd55(u8 bufferId, u8 battleOutcome);
|
||||||
|
void BtlController_EmitDebugMenu(u8 bufferId);
|
||||||
|
|
||||||
// player controller
|
// player controller
|
||||||
void SetControllerToPlayer(void);
|
void SetControllerToPlayer(void);
|
||||||
|
8
include/battle_debug.h
Normal file
8
include/battle_debug.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#ifndef GUARD_BATTLE_DEBUG_H
|
||||||
|
#define GUARD_BATTLE_DEBUG_H
|
||||||
|
|
||||||
|
#define USE_BATTLE_DEBUG TRUE
|
||||||
|
|
||||||
|
extern void CB2_BattleDebugMenu(void);
|
||||||
|
|
||||||
|
#endif // GUARD_BATTLE_DEBUG_H
|
@ -10,4 +10,4 @@ u16 sub_818D8F0(u16 spriteId);
|
|||||||
u16 sub_818D938(u16 species, bool8 isFrontPic, u16 destX, u16 destY, u8 paletteSlot, u8 windowId);
|
u16 sub_818D938(u16 species, bool8 isFrontPic, u16 destX, u16 destY, u8 paletteSlot, u8 windowId);
|
||||||
u8 sub_818D97C(u8 a0, u8 a1);
|
u8 sub_818D97C(u8 a0, u8 a1);
|
||||||
|
|
||||||
#endif //GUARD_BATTLE_DOME_CARDS_H
|
#endif // GUARD_BATTLE_DOME_CARDS_H
|
||||||
|
@ -246,6 +246,11 @@ extern const u8 gText_BattleSwitchWhich2[];
|
|||||||
extern const u8 gText_BattleSwitchWhich3[];
|
extern const u8 gText_BattleSwitchWhich3[];
|
||||||
extern const u8 gText_BattleSwitchWhich4[];
|
extern const u8 gText_BattleSwitchWhich4[];
|
||||||
extern const u8 gText_BattleSwitchWhich5[];
|
extern const u8 gText_BattleSwitchWhich5[];
|
||||||
|
extern const u8 gText_Attack[];
|
||||||
|
extern const u8 gText_Defense[];
|
||||||
|
extern const u8 gText_SpAtk[];
|
||||||
|
extern const u8 gText_SpDef[];
|
||||||
|
extern const u8 gText_Speed[];
|
||||||
extern const u8 gText_SafariBalls[];
|
extern const u8 gText_SafariBalls[];
|
||||||
extern const u8 gText_SafariBallLeft[];
|
extern const u8 gText_SafariBallLeft[];
|
||||||
extern const u8 gText_Sleep[];
|
extern const u8 gText_Sleep[];
|
||||||
|
@ -137,8 +137,8 @@
|
|||||||
#define STATUS3_ON_AIR 0x40
|
#define STATUS3_ON_AIR 0x40
|
||||||
#define STATUS3_UNDERGROUND 0x80
|
#define STATUS3_UNDERGROUND 0x80
|
||||||
#define STATUS3_MINIMIZED 0x100
|
#define STATUS3_MINIMIZED 0x100
|
||||||
#define STATUS3_ROOTED 0x400
|
|
||||||
#define STATUS3_CHARGED_UP 0x200
|
#define STATUS3_CHARGED_UP 0x200
|
||||||
|
#define STATUS3_ROOTED 0x400
|
||||||
#define STATUS3_YAWN 0x1800 // two bits
|
#define STATUS3_YAWN 0x1800 // two bits
|
||||||
#define STATUS3_IMPRISONED_OTHERS 0x2000
|
#define STATUS3_IMPRISONED_OTHERS 0x2000
|
||||||
#define STATUS3_GRUDGE 0x4000
|
#define STATUS3_GRUDGE 0x4000
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
#ifndef GUARD_RESET_RTC_SCREEN_H
|
#ifndef GUARD_RESET_RTC_SCREEN_H
|
||||||
#define GUARD_RESET_RTC_SCREEN_H
|
#define GUARD_RESET_RTC_SCREEN_H
|
||||||
|
|
||||||
|
extern const struct SpritePalette gSpritePalette_RtcArrow;
|
||||||
|
extern const struct SpriteTemplate gSpriteTemplate_RtcArrow;
|
||||||
|
|
||||||
void CB2_InitResetRtcScreen(void);
|
void CB2_InitResetRtcScreen(void);
|
||||||
|
|
||||||
#endif // GUARD_RESET_RTC_SCREEN_H
|
#endif // GUARD_RESET_RTC_SCREEN_H
|
||||||
|
@ -268,6 +268,7 @@ SECTIONS {
|
|||||||
src/unk_transition.o(.text);
|
src/unk_transition.o(.text);
|
||||||
src/international_string_util.o(.text);
|
src/international_string_util.o(.text);
|
||||||
asm/international_string_util.o(.text);
|
asm/international_string_util.o(.text);
|
||||||
|
src/battle_debug.o(.text);
|
||||||
} =0
|
} =0
|
||||||
|
|
||||||
script_data :
|
script_data :
|
||||||
@ -541,6 +542,7 @@ SECTIONS {
|
|||||||
data/mystery_event_msg.o(.rodata);
|
data/mystery_event_msg.o(.rodata);
|
||||||
src/m4a_tables.o(.rodata);
|
src/m4a_tables.o(.rodata);
|
||||||
data/sound_data.o(.rodata);
|
data/sound_data.o(.rodata);
|
||||||
|
src/battle_debug.o(.rodata);
|
||||||
} =0
|
} =0
|
||||||
|
|
||||||
song_data :
|
song_data :
|
||||||
|
@ -107,6 +107,7 @@ static void PlayerHandleBattleAnimation(void);
|
|||||||
static void PlayerHandleLinkStandbyMsg(void);
|
static void PlayerHandleLinkStandbyMsg(void);
|
||||||
static void PlayerHandleResetActionMoveSelection(void);
|
static void PlayerHandleResetActionMoveSelection(void);
|
||||||
static void PlayerHandleCmd55(void);
|
static void PlayerHandleCmd55(void);
|
||||||
|
static void PlayerHandleBattleDebug(void);
|
||||||
static void nullsub_22(void);
|
static void nullsub_22(void);
|
||||||
|
|
||||||
static void PlayerBufferRunCommand(void);
|
static void PlayerBufferRunCommand(void);
|
||||||
@ -194,6 +195,7 @@ static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(void) =
|
|||||||
PlayerHandleLinkStandbyMsg,
|
PlayerHandleLinkStandbyMsg,
|
||||||
PlayerHandleResetActionMoveSelection,
|
PlayerHandleResetActionMoveSelection,
|
||||||
PlayerHandleCmd55,
|
PlayerHandleCmd55,
|
||||||
|
PlayerHandleBattleDebug,
|
||||||
nullsub_22
|
nullsub_22
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -343,6 +345,11 @@ static void HandleInputChooseAction(void)
|
|||||||
{
|
{
|
||||||
SwapHpBarsWithHpText();
|
SwapHpBarsWithHpText();
|
||||||
}
|
}
|
||||||
|
else if (USE_BATTLE_DEBUG && gMain.newKeys & SELECT_BUTTON)
|
||||||
|
{
|
||||||
|
BtlController_EmitTwoReturnValues(1, B_ACTION_DEBUG, 0);
|
||||||
|
PlayerBufferExecCompleted();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_80577F0(void) // unused
|
static void sub_80577F0(void) // unused
|
||||||
@ -3111,6 +3118,21 @@ static void PlayerHandleCmd55(void)
|
|||||||
gBattlerControllerFuncs[gActiveBattler] = sub_80587B0;
|
gBattlerControllerFuncs[gActiveBattler] = sub_80587B0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void WaitForDebug(void)
|
||||||
|
{
|
||||||
|
if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active)
|
||||||
|
{
|
||||||
|
PlayerBufferExecCompleted();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void PlayerHandleBattleDebug(void)
|
||||||
|
{
|
||||||
|
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
|
||||||
|
SetMainCallback2(CB2_BattleDebugMenu);
|
||||||
|
gBattlerControllerFuncs[gActiveBattler] = WaitForDebug;
|
||||||
|
}
|
||||||
|
|
||||||
static void nullsub_22(void)
|
static void nullsub_22(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -1520,3 +1520,9 @@ void BtlController_EmitCmd55(u8 bufferId, u8 battleOutcome)
|
|||||||
sBattleBuffersTransferData[5] = sBattleBuffersTransferData[4] = sub_81850DC(&sBattleBuffersTransferData[6]);
|
sBattleBuffersTransferData[5] = sBattleBuffersTransferData[4] = sub_81850DC(&sBattleBuffersTransferData[6]);
|
||||||
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sBattleBuffersTransferData[4] + 6);
|
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, sBattleBuffersTransferData[4] + 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BtlController_EmitDebugMenu(u8 bufferId)
|
||||||
|
{
|
||||||
|
sBattleBuffersTransferData[0] = CONTROLLER_DEBUGMENU;
|
||||||
|
PrepareBufferDataTransfer(bufferId, sBattleBuffersTransferData, 1);
|
||||||
|
}
|
||||||
|
1195
src/battle_debug.c
Normal file
1195
src/battle_debug.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -4323,6 +4323,10 @@ static void HandleTurnActionSelectionState(void)
|
|||||||
BtlController_EmitEndBounceEffect(0);
|
BtlController_EmitEndBounceEffect(0);
|
||||||
MarkBattlerForControllerExec(gActiveBattler);
|
MarkBattlerForControllerExec(gActiveBattler);
|
||||||
return;
|
return;
|
||||||
|
case B_ACTION_DEBUG:
|
||||||
|
BtlController_EmitDebugMenu(0);
|
||||||
|
MarkBattlerForControllerExec(gActiveBattler);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER
|
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER
|
||||||
@ -4462,6 +4466,9 @@ static void HandleTurnActionSelectionState(void)
|
|||||||
case B_ACTION_WALLY_THROW:
|
case B_ACTION_WALLY_THROW:
|
||||||
gBattleCommunication[gActiveBattler]++;
|
gBattleCommunication[gActiveBattler]++;
|
||||||
break;
|
break;
|
||||||
|
case B_ACTION_DEBUG:
|
||||||
|
gBattleCommunication[gActiveBattler] = STATE_BEFORE_ACTION_CHOSEN;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -440,7 +440,7 @@ static const u8 sText_ExclamationMark5[] = _("!");
|
|||||||
static const u8 sText_HP2[] = _("HP");
|
static const u8 sText_HP2[] = _("HP");
|
||||||
static const u8 sText_Attack2[] = _("ATTACK");
|
static const u8 sText_Attack2[] = _("ATTACK");
|
||||||
static const u8 sText_Defense2[] = _("DEFENSE");
|
static const u8 sText_Defense2[] = _("DEFENSE");
|
||||||
static const u8 sText_Speed[] = _("SPEED");
|
const u8 gText_Speed[] = _("SPEED");
|
||||||
static const u8 sText_SpAtk2[] = _("SP. ATK");
|
static const u8 sText_SpAtk2[] = _("SP. ATK");
|
||||||
static const u8 sText_SpDef2[] = _("SP. DEF");
|
static const u8 sText_SpDef2[] = _("SP. DEF");
|
||||||
static const u8 sText_Accuracy[] = _("accuracy");
|
static const u8 sText_Accuracy[] = _("accuracy");
|
||||||
@ -449,7 +449,7 @@ static const u8 sText_Evasiveness[] = _("evasiveness");
|
|||||||
const u8 * const gStatNamesTable[] =
|
const u8 * const gStatNamesTable[] =
|
||||||
{
|
{
|
||||||
sText_HP2, sText_Attack2, sText_Defense2,
|
sText_HP2, sText_Attack2, sText_Defense2,
|
||||||
sText_Speed, sText_SpAtk2, sText_SpDef2,
|
gText_Speed, sText_SpAtk2, sText_SpDef2,
|
||||||
sText_Accuracy, sText_Evasiveness
|
sText_Accuracy, sText_Evasiveness
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1184,16 +1184,16 @@ const u8 gText_BattleSwitchWhich3[] = _("{UP_ARROW}");
|
|||||||
const u8 gText_BattleSwitchWhich4[] = _("{ESCAPE 4}");
|
const u8 gText_BattleSwitchWhich4[] = _("{ESCAPE 4}");
|
||||||
const u8 gText_BattleSwitchWhich5[] = _("-");
|
const u8 gText_BattleSwitchWhich5[] = _("-");
|
||||||
|
|
||||||
static const u8 sText_HP[] = _("HP");
|
const u8 sText_HP[] = _("HP");
|
||||||
static const u8 sText_Attack[] = _("ATTACK");
|
const u8 gText_Attack[] = _("ATTACK");
|
||||||
static const u8 sText_Defense[] = _("DEFENSE");
|
const u8 gText_Defense[] = _("DEFENSE");
|
||||||
static const u8 sText_SpAtk[] = _("SP. ATK");
|
const u8 gText_SpAtk[] = _("SP. ATK");
|
||||||
static const u8 sText_SpDef[] = _("SP. DEF");
|
const u8 gText_SpDef[] = _("SP. DEF");
|
||||||
|
|
||||||
const u8 * const gStatNamesTable2[] =
|
const u8 * const gStatNamesTable2[] =
|
||||||
{
|
{
|
||||||
sText_HP, sText_SpAtk, sText_Attack,
|
sText_HP, gText_SpAtk, gText_Attack,
|
||||||
sText_SpDef, sText_Defense, sText_Speed
|
gText_SpDef, gText_Defense, gText_Speed
|
||||||
};
|
};
|
||||||
|
|
||||||
const u8 gText_SafariBalls[] = _("{HIGHLIGHT DARK_GREY}SAFARI BALLS");
|
const u8 gText_SafariBalls[] = _("{HIGHLIGHT DARK_GREY}SAFARI BALLS");
|
||||||
|
@ -128,7 +128,7 @@ static const struct SpriteFrameImage sSpriteImageTable_85104B4[] =
|
|||||||
obj_frame_tiles(sResetRtcScreen_RightArrowGfx)
|
obj_frame_tiles(sResetRtcScreen_RightArrowGfx)
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct SpritePalette sSpritePalette_Arrow =
|
const struct SpritePalette gSpritePalette_RtcArrow =
|
||||||
{
|
{
|
||||||
sResetRtcScreen_ArrowPal, 0x1000
|
sResetRtcScreen_ArrowPal, 0x1000
|
||||||
};
|
};
|
||||||
@ -158,7 +158,7 @@ static const union AnimCmd *const sSpriteAnimTable_85104E4[] =
|
|||||||
sSpriteAnim_85104DC,
|
sSpriteAnim_85104DC,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct SpriteTemplate sSpriteTemplate_85104F0 =
|
const struct SpriteTemplate gSpriteTemplate_RtcArrow =
|
||||||
{
|
{
|
||||||
.tileTag = 0xFFFF,
|
.tileTag = 0xFFFF,
|
||||||
.paletteTag = 0x1000,
|
.paletteTag = 0x1000,
|
||||||
@ -270,14 +270,14 @@ static void CreateCursor(u8 taskId)
|
|||||||
{
|
{
|
||||||
u32 spriteId;
|
u32 spriteId;
|
||||||
|
|
||||||
LoadSpritePalette(&sSpritePalette_Arrow);
|
LoadSpritePalette(&gSpritePalette_RtcArrow);
|
||||||
|
|
||||||
spriteId = CreateSpriteAtEnd(&sSpriteTemplate_85104F0, 53, 68, 0);
|
spriteId = CreateSpriteAtEnd(&gSpriteTemplate_RtcArrow, 53, 68, 0);
|
||||||
gSprites[spriteId].callback = SpriteCB_ResetRtcCursor0;
|
gSprites[spriteId].callback = SpriteCB_ResetRtcCursor0;
|
||||||
gSprites[spriteId].data[0] = taskId;
|
gSprites[spriteId].data[0] = taskId;
|
||||||
gSprites[spriteId].data[1] = -1;
|
gSprites[spriteId].data[1] = -1;
|
||||||
|
|
||||||
spriteId = CreateSpriteAtEnd(&sSpriteTemplate_85104F0, 53, 68, 0);
|
spriteId = CreateSpriteAtEnd(&gSpriteTemplate_RtcArrow, 53, 68, 0);
|
||||||
gSprites[spriteId].callback = SpriteCB_ResetRtcCursor1;
|
gSprites[spriteId].callback = SpriteCB_ResetRtcCursor1;
|
||||||
gSprites[spriteId].data[0] = taskId;
|
gSprites[spriteId].data[0] = taskId;
|
||||||
gSprites[spriteId].data[1] = -1;
|
gSprites[spriteId].data[1] = -1;
|
||||||
@ -285,7 +285,7 @@ static void CreateCursor(u8 taskId)
|
|||||||
|
|
||||||
static void FreeCursorPalette(void)
|
static void FreeCursorPalette(void)
|
||||||
{
|
{
|
||||||
FreeSpritePaletteByTag(sSpritePalette_Arrow.tag);
|
FreeSpritePaletteByTag(gSpritePalette_RtcArrow.tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void HideChooseTimeWindow(u8 windowId)
|
static void HideChooseTimeWindow(u8 windowId)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user