Merge pull request #50 from cawtds/debug_menu

Debug menu
This commit is contained in:
cawtds
2024-06-19 22:52:59 +02:00
committed by GitHub
79 changed files with 9650 additions and 66 deletions

1
.gitignore vendored
View File

@@ -61,3 +61,4 @@ prefabs.json
.vscode/*.*
*.js
*.sym
src/data/map_group_count.h

View File

@@ -307,7 +307,7 @@ mostlyclean: tidynonmodern tidymodern tidycheck
rm -f $(MID_SUBDIR)/*.s
find . \( -iname '*.1bpp' -o -iname '*.4bpp' -o -iname '*.8bpp' -o -iname '*.gbapal' -o -iname '*.lz' -o -iname '*.rl' -o -iname '*.latfont' -o -iname '*.hwjpnfont' -o -iname '*.fwjpnfont' \) -exec rm {} +
rm -f $(DATA_ASM_SUBDIR)/layouts/layouts.inc $(DATA_ASM_SUBDIR)/layouts/layouts_table.inc
rm -f $(DATA_ASM_SUBDIR)/maps/connections.inc $(DATA_ASM_SUBDIR)/maps/events.inc $(DATA_ASM_SUBDIR)/maps/groups.inc $(DATA_ASM_SUBDIR)/maps/headers.inc
rm -f $(DATA_ASM_SUBDIR)/maps/connections.inc $(DATA_ASM_SUBDIR)/maps/events.inc $(DATA_ASM_SUBDIR)/maps/groups.inc $(DATA_ASM_SUBDIR)/maps/headers.inc $(DATA_SRC_SUBDIR)/map_group_count.h
find $(DATA_ASM_SUBDIR)/maps \( -iname 'connections.inc' -o -iname 'events.inc' -o -iname 'header.inc' \) -exec rm {} +
rm -f $(AUTO_GEN_TARGETS)
@$(MAKE) clean -C libagbsyscall

View File

@@ -1679,6 +1679,38 @@
.2byte \quantity
.endm
.macro _dynmultichoice left:req, top:req, ignoreBPress:req, maxBeforeScroll:req, shouldSort:req, initialSelected:req, callbacks:req argv:vararg
.byte 0xe3
.2byte \left
.2byte \top
.byte \ignoreBPress
.byte \maxBeforeScroll
.byte \shouldSort
.2byte \initialSelected
.byte \callbacks
.byte (.Ldynmultichoice_\@_2 - .Ldynmultichoice_\@_1) / 4
.Ldynmultichoice_\@_1:
.4byte \argv
.Ldynmultichoice_\@_2:
.endm
@ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made.
@ Lists of options are provided in argv.
@ If ignoreBPress is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button.
.macro dynmultichoice left:req, top:req, ignoreBPress:req, maxBeforeScroll:req, initialSelected:req, callbacks:req argv:vararg
_dynmultichoice \left, \top, \ignoreBPress, \maxBeforeScroll, FALSE, \initialSelected, \callbacks, \argv
.endm
.macro dynmultipush name:req, id:req
.byte 0xe4
.4byte \name
.2byte \id
.endm
.macro dynmultistack left:req, top:req, ignoreBPress:req, maxBeforeScroll:req, shouldSort:req, initialSelected:req, callbacks:req
_dynmultichoice \left, \top, \ignoreBPress, \maxBeforeScroll, \shouldSort, \initialSelected, \callbacks, NULL
.endm
@ Supplementary
@@ -1934,3 +1966,55 @@
.2byte \slot
.endm
@ Sets VAR_RESULT to one of the arguments (via setorcopyvar).
.macro randomelement element:req, elements:vararg
.set _randomelement_n, 0
.irp el, \element, \elements
.set _randomelement_n, _randomelement_n + 1
.endr
random _randomelement_n
.set _randomelement_n, 0
.irp el, \element, \elements
goto_if_ne VAR_RESULT, _randomelement_n, 1f
setorcopyvar VAR_RESULT, \el
goto 2f
1:
.set _randomelement_n, _randomelement_n + 1
.endr
2:
.endm
@ Sets VAR_RESULT to TRUE with probability 'percent', and FALSE
@ with probability '100% - percent'.
.macro randompercentage percent:req
random 100
goto_if_lt VAR_RESULT, \percent, 1f
setvar VAR_RESULT, FALSE
goto 2f
1:
setvar VAR_RESULT, TRUE
2:
.endm
@ Inflicts \status1 to the Pokémon in \slot.
@ If \slot is greater or equal than PARTY_SIZE, the status is inflicted on each of the Player's Pokémon.
.macro setstatus1 status1:req, slot:req
callnative Script_SetStatus1
.2byte \status1
.2byte \slot
.endm
@ Sets VAR_RESULT to the Pokémon in \slot's Tera Type
.macro checkteratype slot:req
callnative CheckTeraType
.2byte \slot
.endm
@ Sets the Pokémon in \slot's Tera Type
.macro setteratype type:req, slot:req
callnative SetTeraType
.byte \type
.2byte \slot
.endm

View File

@@ -78,6 +78,7 @@ SUPER_RE = A0
'?' = AC
'.' = AD
'-' = AE
'_' = AE
'·' = AF
'…' = B0
'“' = B1

View File

@@ -1,3 +1,7 @@
.include "constants/gba_constants.inc"
.include "constants/misc_constants.inc"
.include "constants/version.inc"
@ .include "constants/version.inc"
.set FALSE, 0
.set TRUE, 1
.set NULL, 0

View File

@@ -1,6 +0,0 @@
.ifdef FIRERED
.equiv GAME_VERSION, 4
.else
.equiv GAME_VERSION, 5
.endif

View File

@@ -1,3 +1,4 @@
#include "config.h"
#include "constants/global.h"
#include "constants/flags.h"
#include "constants/event_objects.h"
@@ -41,8 +42,7 @@
#include "constants/mystery_gift.h"
.include "asm/macros.inc"
.include "asm/macros/event.inc"
.set FALSE, 0
.set TRUE, 1
.include "constants/constants.inc"
.section script_data, "aw", %progbits
@@ -807,6 +807,8 @@ gStdScriptsEnd::
.include "data/scripts/std_msgbox.inc"
.include "data/scripts/trainer_battle.inc"
.include "data/scripts/debug.inc"
@ Unused
Text_WouldYouLikeToMixRecords::

View File

@@ -247,14 +247,14 @@ CeladonCity_GameCorner_EventScript_SlotMachine::
msgbox CeladonCity_GameCorner_Text_SlotMachineWantToPlay, MSGBOX_YESNO
goto_if_eq VAR_RESULT, NO, CeladonCity_GameCorner_EventScript_DontPlaySlotMachine
setfieldeffectargument 0, OBJ_EVENT_ID_PLAYER
.ifdef BUGFIX
#ifdef BUGFIX
setfieldeffectargument 1, MAP_NUM(CELADON_CITY_GAME_CORNER)
setfieldeffectargument 2, MAP_GROUP(CELADON_CITY_GAME_CORNER)
.else
#else
@ Map num/group were provided in the wrong order
setfieldeffectargument 1, MAP_GROUP(CELADON_CITY_GAME_CORNER)
setfieldeffectargument 2, MAP_NUM(CELADON_CITY_GAME_CORNER)
.endif
#endif
dofieldeffect FLDEFF_SMILEY_FACE_ICON
waitfieldeffect FLDEFF_SMILEY_FACE_ICON
specialvar VAR_RESULT, GetRandomSlotMachineId

424
data/scripts/debug.inc Normal file
View File

@@ -0,0 +1,424 @@
.if DEBUG_OVERWORLD_MENU == TRUE
Debug_MessageEnd:
waitmessage
waitbuttonpress
releaseall
end
Debug_ShowFieldMessageStringVar4::
special ShowFieldMessageStringVar4
goto Debug_MessageEnd
Debug_CheatStart::
@ setflag FLAG_SYS_POKEMON_GET
@ setflag FLAG_RESCUED_BIRCH
@ setflag FLAG_HIDE_ROUTE_101_BIRCH_ZIGZAGOON_BATTLE
@ setflag FLAG_ADVENTURE_STARTED
@ clearflag FLAG_HIDE_LITTLEROOT_TOWN_BIRCHS_LAB_BIRCH
@ setflag FLAG_HIDE_ROUTE_101_BIRCH_STARTERS_BAG
@ setvar VAR_BIRCH_LAB_STATE, 2
@ setvar VAR_ROUTE101_STATE, 3
@ givemon SPECIES_TREECKO, 20, ITEM_NONE
@ givemon SPECIES_TORCHIC, 20, ITEM_NONE
@ givemon SPECIES_MUDKIP, 20, ITEM_NONE
@ setflag FLAG_SYS_POKEDEX_GET
@ special SetUnlockedPokedexFlags
@ setflag FLAG_RECEIVED_POKEDEX_FROM_BIRCH
@ setvar VAR_CABLE_CLUB_TUTORIAL_STATE, 2
@ setflag FLAG_SYS_NATIONAL_DEX
@ special EnableNationalPokedex
@ setflag FLAG_RECEIVED_RUNNING_SHOES
@ setflag FLAG_SYS_B_DASH
@ setvar VAR_LITTLEROOT_TOWN_STATE, 4 @ 4: Received Running Shoes
@ setvar VAR_LITTLEROOT_INTRO_STATE, 7 @ 7: Told to go meet rival
@ setvar VAR_LITTLEROOT_HOUSES_STATE_BRENDAN, 2 @ 2: Met Rival's Mom (and is corresponding gender)
@ setvar VAR_LITTLEROOT_HOUSES_STATE_MAY, 2 @ 2: Met Rival's Mom (and is corresponding gender)
@ setvar VAR_LITTLEROOT_RIVAL_STATE, 4 @ 4: Received Pokedex
@ setflag FLAG_RECEIVED_BIKE
@ additem ITEM_ACRO_BIKE
@ setvar VAR_BRINEY_HOUSE_STATE, 1
@ setvar VAR_ROUTE116_STATE, 2
@ setflag FLAG_HIDE_ROUTE_116_MR_BRINEY
@ setflag FLAG_BADGE01_GET
@ setflag FLAG_BADGE02_GET
@ setflag FLAG_BADGE03_GET
@ setflag FLAG_BADGE04_GET
@ setflag FLAG_BADGE05_GET
@ setflag FLAG_BADGE06_GET
@ setflag FLAG_BADGE07_GET
@ setflag FLAG_BADGE08_GET
@ setflag FLAG_VISITED_LITTLEROOT_TOWN
@ setflag FLAG_VISITED_OLDALE_TOWN
@ setflag FLAG_VISITED_DEWFORD_TOWN
@ setflag FLAG_VISITED_LAVARIDGE_TOWN
@ setflag FLAG_VISITED_FALLARBOR_TOWN
@ setflag FLAG_VISITED_VERDANTURF_TOWN
@ setflag FLAG_VISITED_PACIFIDLOG_TOWN
@ setflag FLAG_VISITED_PETALBURG_CITY
@ setflag FLAG_VISITED_SLATEPORT_CITY
@ setflag FLAG_VISITED_MAUVILLE_CITY
@ setflag FLAG_VISITED_RUSTBORO_CITY
@ setflag FLAG_VISITED_FORTREE_CITY
@ setflag FLAG_VISITED_LILYCOVE_CITY
@ setflag FLAG_VISITED_MOSSDEEP_CITY
@ setflag FLAG_VISITED_SOOTOPOLIS_CITY
@ setflag FLAG_VISITED_EVER_GRANDE_CITY
@ setflag FLAG_LANDMARK_POKEMON_LEAGUE
@ setflag FLAG_LANDMARK_BATTLE_FRONTIER
@ clearflag FLAG_HIDE_BRINEYS_HOUSE_MR_BRINEY
@ clearflag FLAG_HIDE_BRINEYS_HOUSE_PEEKO
@ release
end
Debug_FlagsNotSetOverworldConfigMessage::
message Debug_FlagsNotSetOverworldConfigMessage_Text
goto Debug_MessageEnd
Debug_FlagsNotSetOverworldConfigMessage_Text:
.string "Feature unavailable!\n"
.string "Please define a usable flag in:\l"
.string "'include/config/overworld.h'!$"
Debug_FlagsNotSetBattleConfigMessage::
message Debug_FlagsNotSetBattleConfigMessage_Text
goto Debug_MessageEnd
Debug_FlagsNotSetBattleConfigMessage_Text:
.string "Feature unavailable!\n"
.string "Please define a usable flag in:\l"
.string "'include/config/battle.h'!$"
Debug_BoxFilledMessage::
message Debug_BoxFilledMessage_Text
goto Debug_MessageEnd
Debug_BoxFilledMessage_Text:
.string "Storage boxes filled!$"
Debug_EventScript_CheckEVs::
lockall
getpartysize
goto_if_eq VAR_RESULT, 0, Debug_NoPokemon
special ChoosePartyMon
waitstate
goto_if_ge VAR_0x8004, PARTY_SIZE, Debug_EventScript_CheckEVs_End
callnative Script_GetChosenMonOffensiveEVs
msgbox Debug_EventScript_Text_OffensiveEVs, MSGBOX_DEFAULT
callnative Script_GetChosenMonDefensiveEVs
msgbox Debug_EventScript_Text_DefensiveEVs, MSGBOX_DEFAULT
Debug_EventScript_CheckEVs_End::
releaseall
end
Debug_EventScript_Text_OffensiveEVs:
.string "ATK EVs: {STR_VAR_1}, SPATK EVs: {STR_VAR_2}, SPEED EVs: {STR_VAR_3}$"
Debug_EventScript_Text_DefensiveEVs:
.string "HP EVs: {STR_VAR_1}, DEF EVs: {STR_VAR_2}, SPDEF EVs: {STR_VAR_3}$"
Debug_EventScript_CheckIVs::
lockall
getpartysize
goto_if_eq VAR_RESULT, 0, Debug_NoPokemon
special ChoosePartyMon
waitstate
goto_if_ge VAR_0x8004, PARTY_SIZE, Debug_EventScript_CheckIVs_End
callnative Script_GetChosenMonOffensiveIVs
msgbox Debug_EventScript_Text_OffensiveIVs, MSGBOX_DEFAULT
callnative Script_GetChosenMonDefensiveIVs
msgbox Debug_EventScript_Text_DefensiveIVs, MSGBOX_DEFAULT
Debug_EventScript_CheckIVs_End::
releaseall
end
Debug_EventScript_Text_OffensiveIVs:
.string "ATK IVs: {STR_VAR_1}, SPATK IVs: {STR_VAR_2}, SPEED IVs: {STR_VAR_3}$"
Debug_EventScript_Text_DefensiveIVs:
.string "HP IVs: {STR_VAR_1}, DEF IVs: {STR_VAR_2}, SPDEF IVs: {STR_VAR_3}$"
Debug_EventScript_Script_1::
release
end
Debug_EventScript_Script_2::
release
end
Debug_EventScript_Script_3::
release
end
Debug_EventScript_Script_4::
release
end
Debug_EventScript_Script_5::
release
end
Debug_EventScript_Script_6::
release
end
Debug_EventScript_Script_7::
release
end
Debug_EventScript_Script_8::
release
end
Debug_CheckSaveBlock::
callnative CheckSaveBlock1Size
msgbox Debug_SaveBlock1Size, MSGBOX_DEFAULT
callnative CheckSaveBlock2Size
msgbox Debug_SaveBlock2Size, MSGBOX_DEFAULT
@callnative CheckSaveBlock3Size
@msgbox Debug_SaveBlock3Size, MSGBOX_DEFAULT
callnative CheckPokemonStorageSize
msgbox Debug_PokemonStorageSize, MSGBOX_DEFAULT
release
end
Debug_SaveBlock1Size::
.string "SaveBlock1 size: {STR_VAR_1}b/{STR_VAR_2}b.\n"
.string "Free space: {STR_VAR_3}b.$"
Debug_SaveBlock2Size::
.string "SaveBlock2 size: {STR_VAR_1}b/{STR_VAR_2}b.\n"
.string "Free space: {STR_VAR_3}b.$"
Debug_SaveBlock3Size::
.string "SaveBlock3 size: {STR_VAR_1}b/{STR_VAR_2}b.\n"
.string "Free space: {STR_VAR_3}b.$"
Debug_PokemonStorageSize::
.string "{PKMN}Storage size: {STR_VAR_1}b/{STR_VAR_2}b.\n"
.string "Free space: {STR_VAR_3}b.$"
Debug_CheckROMSpace::
callnative CheckROMSize
msgbox Debug_ROMSize, MSGBOX_DEFAULT
release
end
Debug_ROMSize::
.string "ROM size: {STR_VAR_1}MB/32MB.\n"
.string "Free space: {STR_VAR_2}MB.$"
Debug_HatchAnEgg::
lockall
getpartysize
goto_if_eq VAR_RESULT, 0, Debug_NoPokemon
special ChoosePartyMon
waitstate
goto_if_ge VAR_0x8004, PARTY_SIZE, Debug_HatchAnEgg_End
specialvar VAR_RESULT, GetPartyMonSpecies
goto_if_ne VAR_RESULT, SPECIES_EGG, DebugScript_HatchAnEgg_CantForceHatch
special EggHatch
waitstate
Debug_HatchAnEgg_End::
releaseall
end
Debug_NoPokemon::
msgbox DebugScript_Text_EmptyParty, MSGBOX_DEFAULT
releaseall
end
DebugScript_HatchAnEgg_CantForceHatch::
msgbox DebugScript_HatchAnEgg_Text_NotAnEgg, MSGBOX_DEFAULT
releaseall
end
DebugScript_Text_EmptyParty::
.string "You have no Pokémon nor Eggs.$"
DebugScript_HatchAnEgg_Text_NotAnEgg::
.string "That's not a Pokémon Egg.$"
DebugScript_ZeroDaycareMons::
msgbox DebugText_DaycareNoPokemon, MSGBOX_DEFAULT
releaseall
end
DebugScript_OneDaycareMons::
msgbox DebugText_DaycareOnePokemon, MSGBOX_DEFAULT
releaseall
end
DebugScript_DaycareMonsNotCompatible::
msgbox DebugText_DaycarePokemonNotCompatible, MSGBOX_DEFAULT
releaseall
end
DebugText_DaycareNoPokemon:
.string "You have no Pokémon at Daycare.$"
DebugText_DaycareOnePokemon:
.string "You have only one Pokémon at Daycare.$"
DebugText_DaycarePokemonNotCompatible:
.string "Your Pokémon at Daycare can't\nhave babies together!$"
@Debug_ShowExpansionVersion::
@ callnative BufferExpansionVersion
@ msgbox Debug_ExpansionVersion, MSGBOX_DEFAULT
@ release
@ end
Debug_ExpansionVersion:
.string "pokeemerald-expansion {STR_VAR_1}$"
Debug_EventScript_InflictStatus1::
lockall
getpartysize
goto_if_eq VAR_RESULT, 0, Debug_NoPokemon
dynmultipush Debug_EventScript_InflictStatus1_Text_Single, 0
dynmultipush Debug_EventScript_InflictStatus1_Text_PartyWide, 1
dynmultipush Debug_EventScript_InflictStatus1_Text_Close, 2
dynmultistack 0, 0, FALSE, 3 FALSE, 0, NULL
switch VAR_RESULT
case 0, Debug_EventScript_InflictStatus1_Single
case 1, Debug_EventScript_InflictStatus1_Party
case 2, Debug_EventScript_InflictStatus1_Close
Debug_EventScript_InflictStatus1_Close:
releaseall
end
Debug_EventScript_InflictStatus1_Single:
special ChoosePartyMon
waitstate
goto_if_ge VAR_0x8004, PARTY_SIZE, Debug_EventScript_InflictStatus1_Close
specialvar VAR_RESULT, GetPartyMonSpecies
goto_if_eq VAR_RESULT, SPECIES_EGG, Debug_EventScript_InflictStatus1_Close
dynmultipush Debug_EventScript_InflictStatus1_Text_Poison, 0
dynmultipush Debug_EventScript_InflictStatus1_Text_Paralysis, 1
dynmultipush Debug_EventScript_InflictStatus1_Text_Sleep, 2
dynmultipush Debug_EventScript_InflictStatus1_Text_Burn, 3
dynmultipush Debug_EventScript_InflictStatus1_Text_Freeze, 4
dynmultipush Debug_EventScript_InflictStatus1_Text_Frostbite, 5
dynmultipush Debug_EventScript_InflictStatus1_Text_Close, 6
dynmultistack 0, 0, FALSE, 7, FALSE, 0, NULL
switch VAR_RESULT
case 0, Debug_EventScript_InflictStatus1_Single_Poison
case 1, Debug_EventScript_InflictStatus1_Single_Paralysis
case 2, Debug_EventScript_InflictStatus1_Single_Sleep
case 3, Debug_EventScript_InflictStatus1_Single_Burn
case 4, Debug_EventScript_InflictStatus1_Single_Freeze
case 5, Debug_EventScript_InflictStatus1_Single_Frostbite
case 6, Debug_EventScript_InflictStatus1_Close
case SCR_MENU_CANCEL, Debug_EventScript_InflictStatus1_Close
releaseall
end
Debug_EventScript_InflictStatus1_Single_Poison:
setstatus1 STATUS1_POISON, VAR_0x8004
releaseall
end
Debug_EventScript_InflictStatus1_Single_Paralysis:
setstatus1 STATUS1_PARALYSIS, VAR_0x8004
releaseall
end
Debug_EventScript_InflictStatus1_Single_Sleep:
setstatus1 STATUS1_SLEEP, VAR_0x8004
releaseall
end
Debug_EventScript_InflictStatus1_Single_Burn:
setstatus1 STATUS1_BURN, VAR_0x8004
releaseall
end
Debug_EventScript_InflictStatus1_Single_Freeze:
setstatus1 STATUS1_FREEZE, VAR_0x8004
releaseall
end
Debug_EventScript_InflictStatus1_Single_Frostbite:
setstatus1 STATUS1_FROSTBITE, VAR_0x8004
releaseall
end
Debug_EventScript_InflictStatus1_Party:
dynmultipush Debug_EventScript_InflictStatus1_Text_Poison, 0
dynmultipush Debug_EventScript_InflictStatus1_Text_Paralysis, 1
dynmultipush Debug_EventScript_InflictStatus1_Text_Sleep, 2
dynmultipush Debug_EventScript_InflictStatus1_Text_Burn, 3
dynmultipush Debug_EventScript_InflictStatus1_Text_Freeze, 4
dynmultipush Debug_EventScript_InflictStatus1_Text_Frostbite, 5
dynmultipush Debug_EventScript_InflictStatus1_Text_Close, 6
dynmultistack 0, 0, FALSE, 7, FALSE, 0, NULL
switch VAR_RESULT
case 0, Debug_EventScript_InflictStatus1_Party_Poison
case 1, Debug_EventScript_InflictStatus1_Party_Paralysis
case 2, Debug_EventScript_InflictStatus1_Party_Sleep
case 3, Debug_EventScript_InflictStatus1_Party_Burn
case 4, Debug_EventScript_InflictStatus1_Party_Freeze
case 5, Debug_EventScript_InflictStatus1_Party_Frostbite
case 6, Debug_EventScript_InflictStatus1_Close
case SCR_MENU_CANCEL, Debug_EventScript_InflictStatus1_Close
releaseall
end
Debug_EventScript_InflictStatus1_Party_Poison:
setstatus1 STATUS1_POISON, PARTY_SIZE
releaseall
end
Debug_EventScript_InflictStatus1_Party_Paralysis:
setstatus1 STATUS1_PARALYSIS, PARTY_SIZE
releaseall
end
Debug_EventScript_InflictStatus1_Party_Sleep:
setstatus1 STATUS1_SLEEP, PARTY_SIZE
releaseall
end
Debug_EventScript_InflictStatus1_Party_Burn:
setstatus1 STATUS1_BURN, PARTY_SIZE
releaseall
end
Debug_EventScript_InflictStatus1_Party_Freeze:
setstatus1 STATUS1_FREEZE, PARTY_SIZE
releaseall
end
Debug_EventScript_InflictStatus1_Party_Frostbite:
setstatus1 STATUS1_FROSTBITE, PARTY_SIZE
releaseall
end
Debug_EventScript_InflictStatus1_Text_Single:
.string "Single$"
Debug_EventScript_InflictStatus1_Text_PartyWide:
.string "Party-wide$"
Debug_EventScript_InflictStatus1_Text_Close:
.string "Close$"
Debug_EventScript_InflictStatus1_Text_Poison:
.string "Poison$"
Debug_EventScript_InflictStatus1_Text_Paralysis:
.string "Paralysis$"
Debug_EventScript_InflictStatus1_Text_Sleep:
.string "Sleep$"
Debug_EventScript_InflictStatus1_Text_Burn:
.string "Burn$"
Debug_EventScript_InflictStatus1_Text_Freeze:
.string "Freeze$"
Debug_EventScript_InflictStatus1_Text_Frostbite:
.string "Frostbite$"
.endif

View File

@@ -108,7 +108,7 @@ EventScript_ChooseWhichSpray::
waitmessage
callnative DrawSprayMenu
waitstate
compare VAR_RESULT, 127 @ TODO: MULTI_B_PRESSED
compare VAR_RESULT, SCR_MENU_CANCEL
goto_if_ne EventScript_ChooseWhichSpray_3
EventScript_ChooseWhichSpray_1:
closemessage

View File

@@ -12,7 +12,7 @@
#include "battle_util2.h"
#include "battle_bg.h"
#include "pokeball.h"
// #include "battle_debug.h"
#include "battle_debug.h"
#include "battle_dynamax.h"
#include "battle_terastal.h"
#include "random.h" // for rng_value_t
@@ -70,6 +70,7 @@
#define B_ACTION_FINISHED 12
#define B_ACTION_CANCEL_PARTNER 12 // when choosing an action
#define B_ACTION_NOTHING_FAINTED 13 // when choosing an action
#define B_ACTION_DEBUG 20
#define B_ACTION_NONE 0xFF

View File

@@ -3,6 +3,15 @@
#include "bg.h"
struct BattleBackground
{
const void *tileset;
const void *tilemap;
const void *entryTileset;
const void *entryTilemap;
const void *palette;
};
extern const struct BgTemplate gBattleBgTemplates[];
void InitBattleBgsVideo(void);

View File

@@ -198,6 +198,7 @@ enum
CONTROLLER_LINKSTANDBYMSG,
CONTROLLER_RESETACTIONMOVESELECTION,
CONTROLLER_ENDLINKBATTLE,
CONTROLLER_DEBUGMENU,
/*new controllers should go here*/
CONTROLLER_TERMINATOR_NOP,
CONTROLLER_CMDS_COUNT
@@ -258,6 +259,7 @@ void BtlController_EmitBattleAnimation(u32 battler, u32 bufferId, u8 animationId
void BtlController_EmitLinkStandbyMsg(u32 battler, u32 bufferId, u8 mode, bool32 record);
void BtlController_EmitResetActionMoveSelection(u32 battler, u32 bufferId, u8 caseId);
void BtlController_EmitEndLinkBattle(u32 battler, u32 bufferId, u8 battleOutcome);
void BtlController_EmitDebugMenu(u32 battler, u32 bufferId);
void BattleControllerComplete(u32 battler); // Can be used for all the controllers.
void BtlController_Empty(u32 battler); // Empty command, does nothing, only completes the execution.

6
include/battle_debug.h Normal file
View File

@@ -0,0 +1,6 @@
#ifndef GUARD_BATTLE_DEBUG_H
#define GUARD_BATTLE_DEBUG_H
void CB2_BattleDebugMenu(void);
#endif // GUARD_BATTLE_DEBUG_H

View File

@@ -36,5 +36,6 @@ void ShowTrainerCantBattleSpeech(void);
void PlayTrainerEncounterMusic(void);
const u8 *GetTrainerALoseText(void);
const u8 *GetTrainerWonSpeech(void);
void BattleSetup_StartTrainerBattle_Debug(void);
#endif // GUARD_BATTLE_SETUP_H

View File

@@ -33,6 +33,9 @@
#define LOG_HANDLER (LOG_HANDLER_MGBA_PRINT)
#endif // NDEBUG
// Uncomment to fix some identified minor bugs
#define BUGFIX
// Define the game version for use elsewhere
#if defined(FIRERED)
#define GAME_VERSION VERSION_FIRE_RED
@@ -44,14 +47,13 @@
#define CODE_ROOT "C:/WORK/POKeFRLG/Src/pm_lgfr_ose/source/"
#define ABSPATH(x) (CODE_ROOT x)
// Crashes may occur due to section reordering in the modern build,
// so we force BUGFIX here.
#ifndef BUGFIX
#define BUGFIX
#endif // BUGFIX
// Various undefined behavior bugs may or may not prevent compilation with
// newer compilers. So always fix them when using a modern compiler.
#if MODERN || defined(BUGFIX)
#ifndef UBFIX
#define UBFIX
#endif // UBFIX
#endif
#endif
// Generation constants used in configs to define behavior
#define GEN_1 0

View File

@@ -123,7 +123,7 @@
#define B_HEAL_BELL_SOUNDPROOF GEN_LATEST // In Gen5, Heal Bell affects all mons with Soundproof. In Gen6-8 it affects inactive mons, but not battlers. In Gen9 it always affects the user.
// Ability settings
#define B_EXPANDED_ABILITY_NAMES TRUE // If TRUE, ability names are increased from 12 characters to 16 characters.
#define B_EXPANDED_ABILITY_NAMES FALSE // If TRUE, ability names are increased from 12 characters to 16 characters.
#define B_ABILITY_WEATHER GEN_LATEST // In Gen6+, ability-induced weather lasts 5 turns. Before, it lasted until the battle ended or until it was changed by a move or a different weather-affecting ability.
#define B_GALE_WINGS GEN_LATEST // In Gen7+ requires full HP to trigger.
#define B_STANCE_CHANGE_FAIL GEN_LATEST // In Gen7+, Stance Change fails if the Pokémon is unable to use a move because of confusion, paralysis, etc. In Gen6, it doesn't.

View File

@@ -2,16 +2,16 @@
#define GUARD_CONFIG_DEBUG_H
// Overworld Debug
#define DEBUG_OVERWORLD_MENU TRUE // Enables an overworld debug menu to change flags, variables, giving pokemon and more, accessed by holding R and pressing START while in the overworld by default.
#define DEBUG_OVERWORLD_MENU FALSE // Enables an overworld debug menu to change flags, variables, giving pokemon and more, accessed by holding R and pressing START while in the overworld by default.
#define DEBUG_OVERWORLD_HELD_KEYS (R_BUTTON) // The keys required to be held to open the debug menu.
#define DEBUG_OVERWORLD_TRIGGER_EVENT pressedStartButton // The event that opens the menu when holding the key(s) defined in DEBUG_OVERWORLD_HELD_KEYS.
#define DEBUG_OVERWORLD_IN_MENU FALSE // Replaces the overworld debug menu button combination with a start menu entry (above Pokédex).
// Battle Debug Menu
#define DEBUG_BATTLE_MENU TRUE // If set to TRUE, enables a debug menu to use in battles by pressing the Select button.
#define DEBUG_BATTLE_MENU FALSE // If set to TRUE, enables a debug menu to use in battles by pressing the Select button.
#define DEBUG_AI_DELAY_TIMER FALSE // If set to TRUE, displays the number of frames it takes for the AI to choose a move. Replaces the "What will PKMN do" text. Useful for devs or anyone who modifies the AI code and wants to see if it doesn't take too long to run.
// Pokémon Debug
#define DEBUG_POKEMON_MENU TRUE // Enables a debug menu for pokemon sprites and icons, accessed by pressing SELECT in the summary screen.
#define DEBUG_POKEMON_SPRITE_VISUALIZER FALSE // Enables a debug menu for Pokémon sprites and icons, accessed by pressing Select in the summary screen.
#endif // GUARD_CONFIG_DEBUG_H

View File

@@ -2,9 +2,12 @@
#define GUARD_CONSTANTS_GLOBAL_H
#include "config/battle.h"
#include "config/debug.h"
#include "config/item.h"
// #include "config/level_caps.h"
#include "config/pokemon.h"
#include "config/overworld.h"
// Invalid Versions show as "----------" in Gen 4 and Gen 5's summary screen.
// In Gens 6 and 7, invalid versions instead show "a distant land" in the summary screen.
// In Gen 4 only, migrated Pokemon with Diamond, Pearl, or Platinum's ID show as "----------".

View File

@@ -0,0 +1,53 @@
#ifndef GUARD_CONSTANTS_POKEMON_SPRITE_VISUALIZER_H
#define GUARD_CONSTANTS_POKEMON_SPRITE_VISUALIZER_H
//Defines
#define VISUALIZER_MON_BACK_X 62
#define VISUALIZER_MON_BACK_Y 80
#define VISUALIZER_ICON_X 224
#define VISUALIZER_ICON_Y 144
#define VISUALIZER_FOLLOWER_X 176
#define VISUALIZER_FOLLOWER_Y 128
#define MODIFY_DIGITS_MAX 4
#define MODIFY_DIGITS_ARROW_X 129
#define MODIFY_DIGITS_ARROW1_Y 94
#define MODIFY_DIGITS_ARROW2_Y 113
#define OPTIONS_ARROW_1_X 4
#define OPTIONS_ARROW_2_X 236
#define OPTIONS_ARROW_Y 119
#define GENDER_MALE 0
#define GENDER_FEMALE 1
#define MON_PIC_BACK 0
#define MON_PIC_FRONT 1
//Sprite offset
#define MAX_Y_OFFSET 20
//Windows
#define WIN_NAME_NUMBERS 0
#define WIN_INSTRUCTIONS 1
#define WIN_BOTTOM_LEFT 2
#define WIN_BOTTOM_RIGHT 3
#define WIN_FOOTPRINT 4
#define WIN_END 5
//Battle backgrounds
#define MAP_BATTLE_SCENE_NORMAL 0
#define MAP_BATTLE_SCENE_GYM 1
#define MAP_BATTLE_SCENE_MAGMA 2
#define MAP_BATTLE_SCENE_AQUA 3
#define MAP_BATTLE_SCENE_SIDNEY 4
#define MAP_BATTLE_SCENE_PHOEBE 5
#define MAP_BATTLE_SCENE_GLACIA 6
#define MAP_BATTLE_SCENE_DRAKE 7
#define MAP_BATTLE_SCENE_FRONTIER 8
#define MAP_BATTLE_SCENE_LEADER 9
#define MAP_BATTLE_SCENE_WALLACE 10
#define MAP_BATTLE_SCENE_GROUDON 11
#define MAP_BATTLE_SCENE_KYOGRE 12
#define MAP_BATTLE_SCENE_RAYQUAZA 13
#endif // GUARD_CONSTANTS_POKEMON_SPRITE_VISUALIZER_H

View File

@@ -259,7 +259,10 @@
#define SE_DEOXYS_MOVE 253 // SE_RG_DEOMOV
#define SE_POKE_JUMP_SUCCESS 254 // SE_RG_EXCELLENT
#define SE_POKE_JUMP_FAILURE 255 // SE_RG_NAWAMISS
#define END_SE SE_POKE_JUMP_FAILURE
// Music kept from RS
#define START_MUS 256
#define MUS_HEAL 256 // MUS_ME_ASA
#define MUS_LEVEL_UP 257 // MUS_FANFA1
#define MUS_OBTAIN_ITEM 258 // MUS_FANFA4
@@ -352,6 +355,7 @@
#define MUS_TRAINER_TOWER 344 // MUS_RG_T_TOWER
#define MUS_SLOW_PALLET 345 // MUS_RG_SLOWMASARA
#define MUS_TEACHY_TV_MENU 346 // MUS_RG_TVNOIZE
#define END_MUS MUS_TEACHY_TV_MENU
#define MUS_NONE 0xFFFF

View File

@@ -19,4 +19,7 @@ extern bool8 gHasHallOfFameRecords;
#define CREDITSOVWLDEND \
{ CREDITSOVWLDCMD_END, CREDITSOVWLDCMD_END, CREDITSOVWLDCMD_END }
void DoCredits(void);
#endif //GUARD_CREDITS_H

View File

@@ -1,12 +1,13 @@
#ifndef GUARD_DAYCARE_H
#define GUARD_DAYCARE_H
#include "global.h"
#include "constants/daycare.h"
u8 *GetMonNick(struct Pokemon *mon, u8 *dest);
u8 *GetBoxMonNick(struct BoxPokemon *mon, u8 *dest);
u8 CountPokemonInDaycare(struct DayCare *daycare);
void InitDaycareMailRecordMixing(struct DayCare *daycare, struct RecordMixingDayCareMail *daycareMail);
s8 Daycare_FindEmptySpot(struct DayCare *daycare);
void StoreSelectedPokemonInDaycare(void);
u16 TakePokemonFromDaycare(void);
void GetDaycareCost(void);
@@ -19,6 +20,7 @@ bool8 DoEggActions_CheckHatch(void);
u16 GetSelectedMonNickAndSpecies(void);
void GetDaycareMonNicknames(void);
u8 GetDaycareState(void);
u8 GetDaycareCompatibilityScore(struct DayCare *daycare);
void SetDaycareCompatibilityString(void);
bool8 NameHasGenderSymbol(const u8 *name, u8 genderRatio);
void ShowDaycareLevelMenu(void);

10
include/debug.h Normal file
View File

@@ -0,0 +1,10 @@
#ifndef GUARD_DEBUG_H
#define GUARD_DEBUG_H
void Debug_ShowMainMenu(void);
extern const u8 Debug_FlagsAndVarNotSetBattleConfigMessage[];
extern EWRAM_DATA bool8 gIsDebugBattle;
extern EWRAM_DATA u32 gDebugAIFlags;
#endif // GUARD_DEBUG_H

View File

@@ -41,6 +41,7 @@ void EnableResetRTC(void);
bool32 CanResetRTC(void);
u16 *GetVarPointer(u16 id);
u16 VarGet(u16 id);
u16 VarGetIfExist(u16 id);
bool8 VarSet(u16 id, u16 value);
u8 VarGetObjectEventGraphicsId(u8 id);
u8 *GetFlagPointer(u16 id);

View File

@@ -100,6 +100,7 @@ u8 ListMenuInitInRect(const struct ListMenuTemplate *listMenuTemplate, const str
s32 ListMenu_ProcessInput(u8 listTaskId);
void DestroyListMenuTask(u8 listTaskId, u16 *cursorPos, u16 *itemsAbove);
void RedrawListMenu(u8 listTaskId);
void ListMenuGetCurrentItemArrayId(u8 listTaskId, u16 *arrayId);
void ListMenuGetScrollAndRow(u8 listTaskId, u16 *cursorPos, u16 *itemsAbove);
u16 ListMenuGetYCoordForPrintingArrowCursor(u8 listTaskId);
void ListMenuOverrideSetColors(u8 cursorPal, u8 fillValue, u8 cursorShadowPal);

View File

@@ -14,6 +14,7 @@ struct YesNoFuncTable
TaskFunc noFunc;
};
void ResetAllBgsCoordinates(void);
bool16 RunTextPrinters_CheckActive(u8 textPrinterId);
bool8 IsActiveOverworldLinkBusy(void);
bool8 MenuHelpers_ShouldWaitForLinkRecv(void);

View File

@@ -3,6 +3,8 @@
#include "global.h"
#define MAX_MONEY 999999
u32 GetMoney(u32 *moneyPtr);
void SetMoney(u32 *moneyPtr, u32 newValue);
bool8 IsEnoughMoney(u32 *moneyPtr, u32 cost);

View File

@@ -27,6 +27,7 @@ extern u8 gSelectedOrderFromParty[3];
extern u8 gBattlePartyCurrentOrder[PARTY_SIZE / 2];
extern void (*gItemUseCB)(u8, TaskFunc);
extern const struct SpriteTemplate gSpriteTemplate_StatusIcons;
void InitPartyMenu(u8 menuType, u8 layout, u8 partyAction, bool8 keepCursorPos, u8 messageId, TaskFunc task, MainCallback callback);
void AnimatePartySlot(u8 slot, u8 animNum);
@@ -43,6 +44,7 @@ u8 GetMonAilment(struct Pokemon *mon);
void DisplayPartyMenuStdMessage(u32 stringId);
void LoadHeldItemIcons(void);
void DrawHeldItemIconsForTrade(u8 *partyCounts, u8 *partySpriteIds, u8 whichParty);
void LoadPartyMenuAilmentGfx(void);
void SpriteCB_BounceConfirmCancelButton(u8 spriteId, u8 spriteId2, u8 animNum);
void CB2_SelectBagItemToGive(void);
void CB2_GiveHoldItem(void);

View File

@@ -804,6 +804,7 @@ void PlayBattleBGM(void);
void PlayMapChosenOrBattleBGM(u16 songId);
const u32 *GetMonFrontSpritePal(struct Pokemon *mon);
const u32 *GetMonSpritePalFromSpeciesAndPersonality(u16 species, bool32 isShiny, u32 personality);
const u32 *GetMonSpritePalFromSpecies(u16 species, bool32 isShiny, bool32 isFemale);
bool32 IsMoveHM(u16 move);
bool8 IsMonSpriteNotFlipped(u16 species);
s8 GetFlavorRelationByPersonality(u32 personality, u8 flavor);
@@ -834,6 +835,7 @@ bool32 DoesSpeciesHaveFormChangeMethod(u16 species, u16 method);
void TryToSetBattleFormChangeMoves(struct Pokemon *mon, u16 method);
bool8 IsMonPastEvolutionLevel(struct Pokemon *mon);
bool32 IsPersonalityFemale(u16 species, u32 personality);
bool32 SpeciesHasGenderDifferences(u16 species);
bool32 TryFormChange(u32 monId, u32 side, u16 method);
u16 ModifyStatByNature(u8 nature, u16 stat, u8 statIndex);
bool8 HealStatusConditions(struct Pokemon *mon, u32 healMask, u8 battleId);

View File

@@ -21,6 +21,7 @@ void SpriteCB_MonIcon(struct Sprite *);
u8 CreateMonIcon(u16 species, SpriteCallback callback, s16 x, s16 y, u8 subpriority, u32 personality);
u8 UpdateMonIconFrame(struct Sprite *sprite);
void LoadMonIconPalette(u16 iconId);
void LoadMonIconPalettePersonality(u16 species, u32 personality);
void FreeMonIconPalette(u16 iconId);
void SetPartyHPBarSprite(struct Sprite *sprite, u8 animNum);
u8 GetMonIconPaletteIndexFromSpecies(u16 species);

View File

@@ -0,0 +1,74 @@
#ifndef GUARD_POKEMON_SPRITE_VISUALIZER_H
#define GUARD_POKEMON_SPRITE_VISUALIZER_H
#include "constants/pokemon_sprite_visualizer.h"
//Structs
struct PokemonSpriteVisualizerModifyArrows
{
u8 arrowSpriteId[2];
u16 minValue;
u16 maxValue;
int currValue;
u8 currentDigit;
u8 maxDigits;
u8 charDigits[MODIFY_DIGITS_MAX];
void *modifiedValPtr;
u8 typeOfVal;
};
struct PokemonSpriteVisualizerOptionArrows
{
u8 arrowSpriteId[1];
u8 currentDigit;
};
struct PokemonSpriteVisualizerYPosModifiyArrows
{
u8 arrowSpriteId[1];
u8 currentDigit;
};
struct PokemonSpriteConstValues
{
u8 backPicCoords;
u8 frontPicCoords;
u8 frontElevation;
};
struct PokemonSpriteOffsets
{
s8 offset_back_picCoords;
s8 offset_front_picCoords;
s8 offset_front_elevation;
};
struct PokemonSpriteVisualizer
{
u16 currentmonId;
u8 currentmonWindowId;
u8 InstructionsWindowId;
u8 frontspriteId;
u8 backspriteId;
u8 iconspriteId;
u8 followerspriteId;
u8 frontShadowSpriteId;
bool8 isShiny;
bool8 isFemale;
struct PokemonSpriteVisualizerModifyArrows modifyArrows;
struct PokemonSpriteVisualizerOptionArrows optionArrows;
struct PokemonSpriteVisualizerYPosModifiyArrows yPosModifyArrows;
struct PokemonSpriteConstValues constSpriteValues;
struct PokemonSpriteOffsets offsetsSpriteValues;
u8 animIdBack;
u8 animIdFront;
u8 battleBgType;
u8 battleTerrain;
u8 currentSubmenu;
u8 submenuYpos[3];
};
void CB2_Pokemon_Sprite_Visualizer(void);
#endif // GUARD_POKEMON_SPRITE_VISUALIZER_H

View File

@@ -1,6 +1,9 @@
#ifndef GUARD_RESET_RTC_SCREEN_H
#define GUARD_RESET_RTC_SCREEN_H
extern const struct SpritePalette gSpritePalette_Arrow;
extern const struct SpriteTemplate gSpriteTemplate_Arrow;
void CB2_InitResetRtcScreen(void);
#endif // GUARD_RESET_RTC_SCREEN_H

View File

@@ -659,6 +659,7 @@ extern const u8 gStartMenuDesc_Option[];
extern const u8 gStartMenuDesc_Exit[];
extern const u8 gStartMenuDesc_Retire[];
extern const u8 gStartMenuDesc_Player[];
extern const u8 gStartMenuDesc_Debug[];
extern const u8 gText_SaveError_PleaseExchangeBackupMemory[];
extern const u8 gText_SavingDontTurnOffThePower2[];
extern const u8 gSaveStatName_Player[];
@@ -1603,4 +1604,11 @@ extern const u8 gText_NextFusionMon[];
extern const u8 gText_ExpShareOn[];
extern const u8 gText_ExpShareOff[];
// stats
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[];
#endif //GUARD_STRINGS_H

View File

@@ -3,6 +3,9 @@
#include "global.h"
extern u16 gWhichTrainerToFaceAfterBattle;
extern u8 gNoOfApproachingTrainers;
bool8 CheckForTrainersWantingBattle(void);
void MovementAction_RevealTrainer_RunTrainerSeeFuncList(struct ObjectEvent *var);
u8 FldEff_ExclamationMarkIcon1(void);

View File

@@ -18,6 +18,7 @@ $(MAPS_DIR)/groups.inc: $(MAPS_DIR)/map_groups.json
$(MAPS_DIR)/connections.inc: $(MAPS_DIR)/groups.inc ;
$(MAPS_DIR)/events.inc: $(MAPS_DIR)/connections.inc ;
$(MAPS_DIR)/headers.inc: $(MAPS_DIR)/events.inc ;
$(DATA_SRC_SUBDIR)/map_group_count.h: $(MAPS_DIR)/headers.inc ;
include/constants/map_groups.h: $(MAPS_DIR)/headers.inc ;
$(LAYOUTS_DIR)/layouts.inc: $(LAYOUTS_DIR)/layouts.json

View File

@@ -10,7 +10,7 @@
#include "battle_z_move.h"
#include "battle_terastal.h"
#include "data.h"
// #include "debug.h"
#include "debug.h"
#include "event_data.h"
#include "item.h"
#include "pokemon.h"

View File

@@ -28,7 +28,7 @@ static void AnimWeatherBallUp_Step(struct Sprite *sprite);
static EWRAM_DATA union AffineAnimCmd *sAnimTaskAffineAnim = NULL;
static const struct UCoords8 sBattlerCoords[][MAX_BATTLERS_COUNT] =
const struct UCoords8 sBattlerCoords[][MAX_BATTLERS_COUNT] =
{
{ // Single battle
{ 72, 80 },

View File

@@ -17,15 +17,6 @@
#define TAG_VS_LETTERS 10000
struct BattleBackground
{
const void *tileset;
const void *tilemap;
const void *entryTileset;
const void *entryTilemap;
const void *palette;
};
static u8 GetBattleTerrainOverride(void);
static const struct OamData sVsLetter_V_OamData = {
@@ -434,7 +425,8 @@ static const u32 sBattleTerrainPalette_Plain[] = INCBIN_U32("graphics/battle_ter
static const u32 sBattleTerrainTiles_Indoor[] = INCBIN_U32("graphics/battle_terrain/indoor/terrain.4bpp.lz");
static const u32 sBattleTerrainTilemap_Indoor[] = INCBIN_U32("graphics/battle_terrain/indoor/terrain.bin.lz");
static const struct BattleBackground sBattleTerrainTable[] = {
const struct BattleBackground sBattleTerrainTable[] =
{
[BATTLE_TERRAIN_GRASS] =
{
.tileset = sBattleTerrainTiles_Grass,

View File

@@ -88,6 +88,7 @@ static void (*const sLinkOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(u32 batt
[CONTROLLER_LINKSTANDBYMSG] = BtlController_Empty, // done
[CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty, // done
[CONTROLLER_ENDLINKBATTLE] = LinkOpponentHandleEndLinkBattle, // done
[CONTROLLER_DEBUGMENU] = BtlController_Empty,
[CONTROLLER_TERMINATOR_NOP] = BtlController_TerminatorNop // done
};

View File

@@ -86,6 +86,7 @@ static void (*const sLinkPartnerBufferCommands[CONTROLLER_CMDS_COUNT])(u32 battl
[CONTROLLER_LINKSTANDBYMSG] = BtlController_Empty, // done
[CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty, // done
[CONTROLLER_ENDLINKBATTLE] = LinkPartnerHandleEndLinkBattle, // done
[CONTROLLER_DEBUGMENU] = BtlController_Empty,
[CONTROLLER_TERMINATOR_NOP] = BtlController_TerminatorNop // done
};

View File

@@ -106,6 +106,7 @@ static void (*const sOakOldManBufferCommands[CONTROLLER_CMDS_COUNT])(u32 battler
[CONTROLLER_LINKSTANDBYMSG] = OakOldManHandleLinkStandbyMsg, // done
[CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty, // done
[CONTROLLER_ENDLINKBATTLE] = OakOldManHandleEndLinkBattle, // done
[CONTROLLER_DEBUGMENU] = BtlController_Empty,
[CONTROLLER_TERMINATOR_NOP] = BtlController_TerminatorNop, // done
};

View File

@@ -103,6 +103,7 @@ static void (*const sOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(u32 battler)
[CONTROLLER_LINKSTANDBYMSG] = BtlController_Empty, // done
[CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty, // done
[CONTROLLER_ENDLINKBATTLE] = OpponentHandleEndLinkBattle, // done
[CONTROLLER_DEBUGMENU] = BtlController_Empty,
[CONTROLLER_TERMINATOR_NOP] = BtlController_TerminatorNop // done
};

View File

@@ -59,6 +59,7 @@ static void PlayerHandleBattleAnimation(u32 battler);
static void PlayerHandleLinkStandbyMsg(u32 battler);
static void PlayerHandleResetActionMoveSelection(u32 battler);
static void PlayerHandleEndLinkBattle(u32 battler);
static void PlayerHandleBattleDebug(u32 battler);
static void PlayerBufferRunCommand(u32 battler);
static void HandleInputChooseTarget(u32 battler);
@@ -138,6 +139,7 @@ static void (*const sPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(u32 battler) =
[CONTROLLER_LINKSTANDBYMSG] = PlayerHandleLinkStandbyMsg, // done
[CONTROLLER_RESETACTIONMOVESELECTION] = PlayerHandleResetActionMoveSelection, // done
[CONTROLLER_ENDLINKBATTLE] = PlayerHandleEndLinkBattle, // done
[CONTROLLER_DEBUGMENU] = PlayerHandleBattleDebug,
[CONTROLLER_TERMINATOR_NOP] = BtlController_TerminatorNop, // done
};
@@ -270,6 +272,13 @@ static void HandleInputChooseAction(u32 battler)
{
SwapHpBarsWithHpText();
}
#if DEBUG_BATTLE_MENU == TRUE
else if (JOY_NEW(SELECT_BUTTON))
{
BtlController_EmitTwoReturnValues(battler, BUFFER_B, B_ACTION_DEBUG, 0);
PlayerBufferExecCompleted(battler);
}
#endif
}
static void HandleInputChooseTarget(u32 battler)
@@ -2066,3 +2075,18 @@ static void PlayerHandleEndLinkBattle(u32 battler)
PlayerBufferExecCompleted(battler);
gBattlerControllerFuncs[battler] = SetBattleEndCallbacks;
}
static void Controller_WaitForDebug(u32 battler)
{
if (gMain.callback2 == BattleMainCB2 && !gPaletteFade.active)
{
PlayerBufferExecCompleted(battler);
}
}
static void PlayerHandleBattleDebug(u32 battler)
{
BeginNormalPaletteFade(-1, 0, 0, 0x10, 0);
SetMainCallback2(CB2_BattleDebugMenu);
gBattlerControllerFuncs[battler] = Controller_WaitForDebug;
}

View File

@@ -130,6 +130,7 @@ static void (*const sPokedudeBufferCommands[CONTROLLER_CMDS_COUNT])(u32 battler)
[CONTROLLER_LINKSTANDBYMSG] = PokedudeHandleLinkStandbyMsg, // done
[CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty, // done
[CONTROLLER_ENDLINKBATTLE] = PokedudeHandleEndLinkBattle, // done
[CONTROLLER_DEBUGMENU] = BtlController_Empty,
[CONTROLLER_TERMINATOR_NOP] = BtlController_TerminatorNop, // done
};

View File

@@ -111,6 +111,7 @@ static void (*const sRecordedOpponentBufferCommands[CONTROLLER_CMDS_COUNT])(u32
[CONTROLLER_LINKSTANDBYMSG] = BtlController_Empty,
[CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty,
[CONTROLLER_ENDLINKBATTLE] = RecordedOpponentHandleEndLinkBattle,
[CONTROLLER_DEBUGMENU] = BtlController_Empty,
[CONTROLLER_TERMINATOR_NOP] = BtlController_TerminatorNop
};

View File

@@ -109,6 +109,7 @@ static void (*const sRecordedPlayerBufferCommands[CONTROLLER_CMDS_COUNT])(u32 ba
[CONTROLLER_LINKSTANDBYMSG] = BtlController_Empty,
[CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty,
[CONTROLLER_ENDLINKBATTLE] = RecordedPlayerHandleEndLinkBattle,
[CONTROLLER_DEBUGMENU] = BtlController_Empty,
[CONTROLLER_TERMINATOR_NOP] = BtlController_TerminatorNop
};

View File

@@ -89,6 +89,7 @@ static void (*const sSafariBufferCommands[CONTROLLER_CMDS_COUNT])(u32 battler) =
[CONTROLLER_LINKSTANDBYMSG] = BtlController_Empty, // done
[CONTROLLER_RESETACTIONMOVESELECTION] = BtlController_Empty, // done
[CONTROLLER_ENDLINKBATTLE] = SafariHandleEndLinkBattle, // done
[CONTROLLER_DEBUGMENU] = BtlController_Empty,
[CONTROLLER_TERMINATOR_NOP] = BtlController_TerminatorNop, // done
};

View File

@@ -1295,6 +1295,12 @@ void BtlController_EmitEndLinkBattle(u32 battler, u32 bufferId, u8 battleOutcome
PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 2);
}
void BtlController_EmitDebugMenu(u32 battler, u32 bufferId)
{
gBattleResources->transferBuffer[0] = CONTROLLER_DEBUGMENU;
PrepareBufferDataTransfer(battler, bufferId, gBattleResources->transferBuffer, 1);
}
// Standardized Controller functions
// Can be used for all the controllers.

2348
src/battle_debug.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -95,7 +95,7 @@ static const struct CompressedSpriteSheet sSpriteSheets_HealthBar[MAX_BATTLERS_C
},
};
static const struct SpritePalette sSpritePalettes_HealthBoxHealthBar[2] =
const struct SpritePalette sSpritePalettes_HealthBoxHealthBar[2] =
{
{
.data = gBattleInterface_Healthbox_Pal,

View File

@@ -1,6 +1,7 @@
#include "global.h"
#include "gflib.h"
#include "battle_anim.h"
#include "battle_debug.h"
#include "battle_interface.h"
#include "battle_message.h"
#include "battle_z_move.h"

View File

@@ -5,6 +5,7 @@
#include "battle_ai_util.h"
#include "battle_anim.h"
#include "battle_controllers.h"
#include "debug.h"
#include "battle_interface.h"
#include "battle_main.h"
#include "battle_message.h"
@@ -3469,6 +3470,10 @@ static void HandleTurnActionSelectionState(void)
BtlController_EmitEndBounceEffect(battler, BUFFER_A);
MarkBattlerForControllerExec(battler);
return;
case B_ACTION_DEBUG:
BtlController_EmitDebugMenu(battler, BUFFER_A);
MarkBattlerForControllerExec(battler);
break;
}
if (gBattleTypeFlags & BATTLE_TYPE_TRAINER
@@ -3611,6 +3616,9 @@ static void HandleTurnActionSelectionState(void)
case B_ACTION_OLDMAN_THROW:
gBattleCommunication[battler]++;
break;
case B_ACTION_DEBUG:
gBattleCommunication[battler] = STATE_BEFORE_ACTION_CHOSEN;
break;
}
}
break;

View File

@@ -22,6 +22,7 @@
#include "field_player_avatar.h"
#include "field_screen_effect.h"
#include "field_message_box.h"
#include "trainer_see.h"
#include "vs_seeker.h"
#include "battle.h"
#include "battle_transition.h"
@@ -82,6 +83,8 @@ static EWRAM_DATA u8 *sTrainerCannotBattleSpeech = NULL;
static EWRAM_DATA u8 *sTrainerBattleEndScript = NULL;
static EWRAM_DATA u8 *sTrainerABattleScriptRetAddr = NULL;
static EWRAM_DATA u16 sRivalBattleFlags = 0;
EWRAM_DATA static bool8 sShouldCheckTrainerBScript = FALSE;
EWRAM_DATA static u8 sNoOfPossibleTrainerRetScripts = 0;
// The first transition is used if the enemy pokemon are lower level than our pokemon.
// Otherwise, the second transition is used.
@@ -219,6 +222,46 @@ static void CreateBattleStartTask(u8 transition, u16 song) // song == 0 means de
PlayMapChosenOrBattleBGM(song);
}
static void Task_BattleStart_Debug(u8 taskId)
{
s16 *data = gTasks[taskId].data;
switch (tState)
{
case 0:
if (!FldEffPoison_IsActive()) // is poison not active?
{
HelpSystem_Disable();
BattleTransition_StartOnField(tTransition);
// ClearMirageTowerPulseBlendEffect();
tState++; // go to case 1.
}
break;
case 1:
if (IsBattleTransitionDone() == TRUE)
{
HelpSystem_Enable();
CleanupOverworldWindowsAndTilemaps();
SetMainCallback2(CB2_InitBattle);
RestartWildEncounterImmunitySteps();
ClearPoisonStepCounter();
DestroyTask(taskId);
}
break;
}
}
static void CreateBattleStartTask_Debug(u8 transition, u16 song)
{
u8 taskId = CreateTask(Task_BattleStart_Debug, 1);
gTasks[taskId].tTransition = transition;
PlayMapChosenOrBattleBGM(song);
}
#undef tState
#undef tTransition
static bool8 CheckSilphScopeInPokemonTower(u16 mapGroup, u16 mapNum)
{
if (mapGroup == MAP_GROUP(POKEMON_TOWER_1F)
@@ -845,6 +888,37 @@ void ClearTrainerFlag(u16 trainerId)
FlagClear(TRAINER_FLAGS_START + trainerId);
}
void BattleSetup_StartTrainerBattle(void)
{
if (gNoOfApproachingTrainers == 2)
gBattleTypeFlags = (BATTLE_TYPE_DOUBLE | BATTLE_TYPE_TWO_OPPONENTS | BATTLE_TYPE_TRAINER);
else
gBattleTypeFlags = (BATTLE_TYPE_TRAINER);
sNoOfPossibleTrainerRetScripts = gNoOfApproachingTrainers;
gNoOfApproachingTrainers = 0;
sShouldCheckTrainerBScript = FALSE;
gWhichTrainerToFaceAfterBattle = 0;
gMain.savedCallback = CB2_EndTrainerBattle;
DoTrainerBattle();
ScriptContext_Stop();
}
void BattleSetup_StartTrainerBattle_Debug(void)
{
sNoOfPossibleTrainerRetScripts = gNoOfApproachingTrainers;
gNoOfApproachingTrainers = 0;
sShouldCheckTrainerBScript = FALSE;
gWhichTrainerToFaceAfterBattle = 0;
gMain.savedCallback = CB2_EndTrainerBattle;
CreateBattleStartTask_Debug(GetWildBattleTransition(), 0);
ScriptContext_Stop();
}
void StartTrainerBattle(void)
{
gBattleTypeFlags = BATTLE_TYPE_TRAINER;

View File

@@ -30,7 +30,7 @@
#include "battle_anim.h"
#include "constants/battle_anim.h"
#include "constants/rgb.h"
// #include "battle_debug.h"
#include "battle_debug.h"
#include "data.h"
#include "pokemon_summary_screen.h"
#include "constants/songs.h"

View File

@@ -1,6 +1,5 @@
.include "constants/gba_constants.inc"
.include "constants/misc_constants.inc"
.include "constants/version.inc"
.syntax unified

View File

@@ -980,7 +980,7 @@ static const struct CompressedSpritePalette sSpritePalette_StatusIcons =
gStatusPal_Icons, 1202
};
static const struct SpriteTemplate sSpriteTemplate_StatusIcons =
const struct SpriteTemplate gSpriteTemplate_StatusIcons =
{
.tileTag = 1202,
.paletteTag = 1202,

View File

@@ -59,7 +59,6 @@ struct EggHatchData
// this file's functions
static void ClearDaycareMonMail(struct DayCareMail *mail);
static void SetInitialEggData(struct Pokemon *mon, u16 species, struct DayCare *daycare);
static u8 GetDaycareCompatibilityScore(struct DayCare *daycare);
static void DaycarePrintMonInfo(u8 windowId, u32 daycareSlotId, u8 y);
static u8 ModifyBreedingScoreForOvalCharm(u8 score);
static u8 GetEggMoves(struct Pokemon *pokemon, u16 *eggMoves);
@@ -433,13 +432,13 @@ void InitDaycareMailRecordMixing(struct DayCare *daycare, struct RecordMixingDay
daycareMail->numDaycareMons = numDaycareMons;
}
static s8 Daycare_FindEmptySpot(struct DayCare *daycare)
s8 Daycare_FindEmptySpot(struct DayCare *daycare)
{
u8 i;
for (i = 0; i < DAYCARE_MON_COUNT; i++)
{
if (GetBoxMonData(&daycare->mons[i].mon, MON_DATA_SPECIES) == 0)
if (GetBoxMonData(&daycare->mons[i].mon, MON_DATA_SPECIES) == SPECIES_NONE)
return i;
}
@@ -1524,7 +1523,7 @@ static bool8 EggGroupsOverlap(u16 *eggGroups1, u16 *eggGroups2)
return FALSE;
}
static u8 GetDaycareCompatibilityScore(struct DayCare *daycare)
u8 GetDaycareCompatibilityScore(struct DayCare *daycare)
{
u32 i;
u16 eggGroups[DAYCARE_MON_COUNT][EGG_GROUPS_PER_MON];

4450
src/debug.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -230,6 +230,14 @@ u16 VarGet(u16 idx)
return *ptr;
}
u16 VarGetIfExist(u16 id)
{
u16 *ptr = GetVarPointer(id);
if (!ptr)
return 65535;
return *ptr;
}
bool8 VarSet(u16 idx, u16 val)
{
u16 *ptr = GetVarPointer(idx);

View File

@@ -1,5 +1,6 @@
#include "global.h"
#include "gflib.h"
#include "debug.h"
#include "event_data.h"
#include "event_object_movement.h"
#include "field_camera.h"

View File

@@ -3,6 +3,7 @@
#include "bike.h"
#include "coord_event_weather.h"
#include "daycare.h"
#include "debug.h"
#include "event_data.h"
#include "event_object_movement.h"
#include "event_scripts.h"
@@ -295,6 +296,16 @@ int ProcessPlayerFieldInput(struct FieldInput *input)
return TRUE;
}
#if DEBUG_OVERWORLD_MENU == TRUE && DEBUG_OVERWORLD_IN_MENU == FALSE
if (input->input_field_1_2)
{
PlaySE(SE_WIN_OPEN);
FreezeObjectEvents();
Debug_ShowMainMenu();
return TRUE;
}
#endif
return FALSE;
}

View File

@@ -2,6 +2,7 @@
#include "gflib.h"
#include "quest_log.h"
#include "list_menu.h"
#include "debug.h"
#include "diploma.h"
#include "script.h"
#include "field_player_avatar.h"

View File

@@ -247,6 +247,14 @@ void RedrawListMenu(u8 listTaskId)
CopyWindowToVram(list->template.windowId, COPYWIN_GFX);
}
void ListMenuGetCurrentItemArrayId(u8 listTaskId, u16 *arrayId)
{
struct ListMenu *list = (void *) gTasks[listTaskId].data;
if (arrayId != NULL)
*arrayId = list->cursorPos + list->itemsAbove;
}
void ListMenuGetScrollAndRow(u8 listTaskId, u16 *cursorPos, u16 *itemsAbove)
{
struct ListMenu *list = (struct ListMenu *)gTasks[listTaskId].data;

View File

@@ -223,7 +223,7 @@ static void InitMainCallbacks(void)
static void CallCallbacks(void)
{
#if TESTING // test framework not working with help system
#if TESTING || DEBUG_BATTLE_MENU == TRUE // test framework not working with help system
if (!RunSaveFailedScreen())
#else
if (!RunSaveFailedScreen() && !RunHelpSystemCallback())

View File

@@ -149,13 +149,8 @@ void ResetVramOamAndBgCntRegs(void)
CpuFill16(0, (void *) PLTT, PLTT_SIZE);
}
void ResetAllBgsCoordinatesAndBgCntRegs(void)
void ResetAllBgsCoordinates(void)
{
SetGpuReg(REG_OFFSET_DISPCNT, 0);
SetGpuReg(REG_OFFSET_BG3CNT, 0);
SetGpuReg(REG_OFFSET_BG2CNT, 0);
SetGpuReg(REG_OFFSET_BG1CNT, 0);
SetGpuReg(REG_OFFSET_BG0CNT, 0);
ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0);
@@ -166,6 +161,16 @@ void ResetAllBgsCoordinatesAndBgCntRegs(void)
ChangeBgY(3, 0, 0);
}
void ResetAllBgsCoordinatesAndBgCntRegs(void)
{
SetGpuReg(REG_OFFSET_DISPCNT, 0);
SetGpuReg(REG_OFFSET_BG3CNT, 0);
SetGpuReg(REG_OFFSET_BG2CNT, 0);
SetGpuReg(REG_OFFSET_BG1CNT, 0);
SetGpuReg(REG_OFFSET_BG0CNT, 0);
ResetAllBgsCoordinates();
}
bool8 AdjustQuantityAccordingToDPadInput(s16 *quantity_p, u16 qmax)
{
s16 valBefore = (*quantity_p);

View File

@@ -2,11 +2,10 @@
#include "gflib.h"
#include "event_data.h"
#include "menu.h"
#include "money.h"
#include "text_window.h"
#include "strings.h"
#define MAX_MONEY 999999
EWRAM_DATA static u8 sMoneyBoxWindowId = 0;
u32 GetMoney(u32 *moneyPtr)

View File

@@ -194,7 +194,6 @@ static void LoadPartyMenuWindows(void);
static void InitPartyMenuBoxes(u8 layout);
static void LoadPartyMenuBoxes(u8 layout);
static void LoadPartyMenuPokeballGfx(void);
static void LoadPartyMenuAilmentGfx(void);
static bool8 RenderPartyMenuBoxes(void);
static void CreateCancelConfirmPokeballSprites(void);
static void CreateCancelConfirmWindows(bool8 chooseMultiple);
@@ -3040,7 +3039,7 @@ static void CreatePartyMonStatusSprite(struct Pokemon *mon, struct PartyMenuBox
{
if (GetMonData(mon, MON_DATA_SPECIES) != SPECIES_NONE)
{
menuBox->statusSpriteId = CreateSprite(&sSpriteTemplate_StatusIcons, menuBox->spriteCoords[4], menuBox->spriteCoords[5], 0);
menuBox->statusSpriteId = CreateSprite(&gSpriteTemplate_StatusIcons, menuBox->spriteCoords[4], menuBox->spriteCoords[5], 0);
SetPartyMonAilmentGfx(mon, menuBox);
}
}
@@ -3049,7 +3048,7 @@ static void CreatePartyMonStatusSpriteParameterized(u16 species, u8 status, stru
{
if (species != SPECIES_NONE)
{
menuBox->statusSpriteId = CreateSprite(&sSpriteTemplate_StatusIcons, menuBox->spriteCoords[4], menuBox->spriteCoords[5], 0);
menuBox->statusSpriteId = CreateSprite(&gSpriteTemplate_StatusIcons, menuBox->spriteCoords[4], menuBox->spriteCoords[5], 0);
UpdatePartyMonAilmentGfx(status, menuBox);
gSprites[menuBox->statusSpriteId].oam.priority = 0;
}
@@ -3075,7 +3074,7 @@ static void UpdatePartyMonAilmentGfx(u8 status, struct PartyMenuBox *menuBox)
}
}
static void LoadPartyMenuAilmentGfx(void)
void LoadPartyMenuAilmentGfx(void)
{
LoadCompressedSpriteSheet(&sSpriteSheet_StatusIcons);
LoadCompressedSpritePalette(&sSpritePalette_StatusIcons);

View File

@@ -5400,12 +5400,17 @@ const u32 *GetMonFrontSpritePal(struct Pokemon *mon)
}
const u32 *GetMonSpritePalFromSpeciesAndPersonality(u16 species, bool32 isShiny, u32 personality)
{
return GetMonSpritePalFromSpecies(species, isShiny, IsPersonalityFemale(species, personality));
}
const u32 *GetMonSpritePalFromSpecies(u16 species, bool32 isShiny, bool32 isFemale)
{
species = SanitizeSpeciesId(species);
if (isShiny)
{
if (gSpeciesInfo[species].shinyPaletteFemale != NULL && IsPersonalityFemale(species, personality))
if (gSpeciesInfo[species].shinyPaletteFemale != NULL && isFemale)
return gSpeciesInfo[species].shinyPaletteFemale;
else if (gSpeciesInfo[species].shinyPalette != NULL)
return gSpeciesInfo[species].shinyPalette;
@@ -5414,7 +5419,7 @@ const u32 *GetMonSpritePalFromSpeciesAndPersonality(u16 species, bool32 isShiny,
}
else
{
if (gSpeciesInfo[species].paletteFemale != NULL && IsPersonalityFemale(species, personality))
if (gSpeciesInfo[species].paletteFemale != NULL && isFemale)
return gSpeciesInfo[species].paletteFemale;
else if (gSpeciesInfo[species].palette != NULL)
return gSpeciesInfo[species].palette;
@@ -6214,6 +6219,18 @@ bool32 IsPersonalityFemale(u16 species, u32 personality)
return GetGenderFromSpeciesAndPersonality(species, personality) == MON_FEMALE;
}
bool32 SpeciesHasGenderDifferences(u16 species)
{
if (gSpeciesInfo[species].frontPicFemale != NULL
|| gSpeciesInfo[species].paletteFemale != NULL
|| gSpeciesInfo[species].backPicFemale != NULL
|| gSpeciesInfo[species].shinyPaletteFemale != NULL
|| gSpeciesInfo[species].iconSpriteFemale != NULL)
return TRUE;
return FALSE;
}
bool32 TryFormChange(u32 monId, u32 side, u16 method)
{
struct Pokemon *party = (side == B_SIDE_PLAYER) ? gPlayerParty : gEnemyParty;

View File

@@ -274,6 +274,18 @@ void LoadMonIconPalette(u16 species)
LoadSpritePalette(&gMonIconPaletteTable[palIndex]);
}
void LoadMonIconPalettePersonality(u16 species, u32 personality)
{
u8 palIndex;
species = SanitizeSpeciesId(species);
if (gSpeciesInfo[species].iconSpriteFemale != NULL && IsPersonalityFemale(species, personality))
palIndex = gSpeciesInfo[species].iconPalIndexFemale;
else
palIndex = gSpeciesInfo[species].iconPalIndex;
if (IndexOfSpritePaletteTag(gMonIconPaletteTable[palIndex].tag) == 0xFF)
LoadSpritePalette(&gMonIconPaletteTable[palIndex]);
}
void FreeMonIconPalettes(void)
{
u8 i;

File diff suppressed because it is too large Load Diff

View File

@@ -12,6 +12,7 @@
#include "new_menu_helpers.h"
#include "menu.h"
#include "constants/items.h"
#include "pokemon_sprite_visualizer.h"
#include "data.h"
#include "item.h"
#include "constants/party_menu.h"
@@ -1203,6 +1204,16 @@ static void Task_InputHandler_Info(u8 taskId)
{
sMonSummaryScreen->state3270 = PSS_STATE3270_ATEXIT_FADEOUT;
}
#if DEBUG_POKEMON_SPRITE_VISUALIZER == TRUE
else if (JOY_NEW(SELECT_BUTTON) && !gMain.inBattle)
{
sMonSummaryScreen->savedCallback = CB2_Pokemon_Sprite_Visualizer;
// StopPokemonAnimations();
PlaySE(SE_SELECT);
// CloseSummaryScreen(taskId);
sMonSummaryScreen->state3270 = PSS_STATE3270_ATEXIT_FADEOUT;
}
#endif
}
break;
case PSS_STATE3270_FLIPPAGES:

View File

@@ -436,3 +436,55 @@ void ReducePlayerPartyToThree(void)
CalculatePlayerPartyCount();
Free(party);
}
void Script_GetChosenMonOffensiveEVs(void)
{
ConvertIntToDecimalStringN(gStringVar1, GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_ATK_EV), STR_CONV_MODE_LEFT_ALIGN, 3);
ConvertIntToDecimalStringN(gStringVar2, GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPATK_EV), STR_CONV_MODE_LEFT_ALIGN, 3);
ConvertIntToDecimalStringN(gStringVar3, GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPEED_EV), STR_CONV_MODE_LEFT_ALIGN, 3);
}
void Script_GetChosenMonDefensiveEVs(void)
{
ConvertIntToDecimalStringN(gStringVar1, GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_HP_EV), STR_CONV_MODE_LEFT_ALIGN, 3);
ConvertIntToDecimalStringN(gStringVar2, GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_DEF_EV), STR_CONV_MODE_LEFT_ALIGN, 3);
ConvertIntToDecimalStringN(gStringVar3, GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPDEF_EV), STR_CONV_MODE_LEFT_ALIGN, 3);
}
void Script_GetChosenMonOffensiveIVs(void)
{
ConvertIntToDecimalStringN(gStringVar1, GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_ATK_IV), STR_CONV_MODE_LEFT_ALIGN, 3);
ConvertIntToDecimalStringN(gStringVar2, GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPATK_IV), STR_CONV_MODE_LEFT_ALIGN, 3);
ConvertIntToDecimalStringN(gStringVar3, GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPEED_IV), STR_CONV_MODE_LEFT_ALIGN, 3);
}
void Script_GetChosenMonDefensiveIVs(void)
{
ConvertIntToDecimalStringN(gStringVar1, GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_HP_IV), STR_CONV_MODE_LEFT_ALIGN, 3);
ConvertIntToDecimalStringN(gStringVar2, GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_DEF_IV), STR_CONV_MODE_LEFT_ALIGN, 3);
ConvertIntToDecimalStringN(gStringVar3, GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPDEF_IV), STR_CONV_MODE_LEFT_ALIGN, 3);
}
void Script_SetStatus1(struct ScriptContext *ctx)
{
u32 status1 = VarGet(ScriptReadHalfword(ctx));
u32 slot = VarGet(ScriptReadHalfword(ctx));
if (slot >= PARTY_SIZE)
{
u16 species;
for (slot = 0; slot < PARTY_SIZE; slot++)
{
species = GetMonData(&gPlayerParty[slot], MON_DATA_SPECIES);
if (species != SPECIES_NONE
&& species != SPECIES_EGG
&& GetMonData(&gPlayerParty[slot], MON_DATA_HP) != 0)
SetMonData(&gPlayerParty[slot], MON_DATA_STATUS, &status1);
}
}
else
{
SetMonData(&gPlayerParty[slot], MON_DATA_STATUS, &status1);
}
}

View File

@@ -1,5 +1,6 @@
#include "global.h"
#include "gflib.h"
#include "debug.h"
#include "scanline_effect.h"
#include "overworld.h"
#include "link.h"
@@ -49,6 +50,7 @@ enum StartMenuOption
STARTMENU_EXIT,
STARTMENU_RETIRE,
STARTMENU_PLAYER2,
STARTMENU_DEBUG,
MAX_STARTMENU_ITEMS
};
@@ -89,6 +91,7 @@ static bool8 StartMenuOptionCallback(void);
static bool8 StartMenuExitCallback(void);
static bool8 StartMenuSafariZoneRetireCallback(void);
static bool8 StartMenuLinkPlayerCallback(void);
static bool8 StartMenuDebugCallback(void);
static bool8 StartCB_Save1(void);
static bool8 StartCB_Save2(void);
static void StartMenu_PrepareForSave(void);
@@ -113,6 +116,9 @@ static void task50_after_link_battle_save(u8 taskId);
static void PrintSaveStats(void);
static void CloseSaveStatsWindow(void);
static void CloseStartMenu(void);
static void HideStartMenuDebug(void);
static const u8 sText_MenuDebug[] = _("DEBUG");
static const struct MenuAction sStartMenuActionTable[] = {
{ gText_MenuPokedex, {.u8_void = StartMenuPokedexCallback} },
@@ -123,7 +129,8 @@ static const struct MenuAction sStartMenuActionTable[] = {
{ gText_MenuOption, {.u8_void = StartMenuOptionCallback} },
{ gText_MenuExit, {.u8_void = StartMenuExitCallback} },
{ gText_MenuRetire, {.u8_void = StartMenuSafariZoneRetireCallback} },
{ gText_MenuPlayer, {.u8_void = StartMenuLinkPlayerCallback} }
{ gText_MenuPlayer, {.u8_void = StartMenuLinkPlayerCallback} },
[STARTMENU_DEBUG] = {sText_MenuDebug, {.u8_void = StartMenuDebugCallback}},
};
static const struct WindowTemplate sTimeWindowTemplate = {
@@ -133,7 +140,7 @@ static const struct WindowTemplate sTimeWindowTemplate = {
.width = 10,
.height = 4,
.paletteNum = 15,
.baseBlock = 0x198
.baseBlock = 0x1A8
};
static const struct WindowTemplate sTimeSafariWindowTemplate = {
@@ -165,7 +172,8 @@ static const u8 *const sStartMenuDescPointers[] = {
gStartMenuDesc_Option,
gStartMenuDesc_Exit,
gStartMenuDesc_Retire,
gStartMenuDesc_Player
gStartMenuDesc_Player,
gStartMenuDesc_Debug,
};
static const struct BgTemplate sBGTemplates_AfterLinkSaveMessage[] = {
@@ -226,6 +234,9 @@ static void AppendToStartMenuItems(u8 newEntry)
static void SetUpStartMenu_NormalField(void)
{
#if DEBUG_OVERWORLD_MENU == TRUE
AppendToStartMenuItems(STARTMENU_DEBUG);
#endif
if (FlagGet(FLAG_SYS_POKEDEX_GET) == TRUE)
AppendToStartMenuItems(STARTMENU_POKEDEX);
if (FlagGet(FLAG_SYS_POKEMON_GET) == TRUE)
@@ -394,7 +405,9 @@ static s8 DoDrawStartMenu(void)
sStartMenuCursorPos = Menu_InitCursor(GetStartMenuWindowId(), FONT_NORMAL, 0, 0, 15, sNumStartMenuItems, sStartMenuCursorPos);
if (!MenuHelpers_IsLinkActive() && InUnionRoom() != TRUE && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_HELP)
{
#if DEBUG_OVERWORLD_MENU != TRUE
DrawHelpMessageWindowWithText(sStartMenuDescPointers[sStartMenuOrder[sStartMenuCursorPos]]);
#endif
}
CopyWindowToVram(GetStartMenuWindowId(), COPYWIN_MAP);
return TRUE;
@@ -478,7 +491,9 @@ static bool8 StartCB_HandleInput(void)
sStartMenuCursorPos = Menu_MoveCursor(-1);
if (!MenuHelpers_IsLinkActive() && InUnionRoom() != TRUE && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_HELP)
{
#if DEBUG_OVERWORLD_MENU != TRUE
PrintTextOnHelpMessageWindow(sStartMenuDescPointers[sStartMenuOrder[sStartMenuCursorPos]], 2);
#endif
}
}
if (JOY_NEW(DPAD_DOWN))
@@ -487,7 +502,9 @@ static bool8 StartCB_HandleInput(void)
sStartMenuCursorPos = Menu_MoveCursor(+1);
if (!MenuHelpers_IsLinkActive() && InUnionRoom() != TRUE && gSaveBlock2Ptr->optionsButtonMode == OPTIONS_BUTTON_MODE_HELP)
{
#if DEBUG_OVERWORLD_MENU != TRUE
PrintTextOnHelpMessageWindow(sStartMenuDescPointers[sStartMenuOrder[sStartMenuCursorPos]], 2);
#endif
}
}
if (JOY_NEW(A_BUTTON))
@@ -502,7 +519,9 @@ static bool8 StartCB_HandleInput(void)
if (JOY_NEW(B_BUTTON | START_BUTTON))
{
DestroySafariZoneStatsWindow();
#if DEBUG_OVERWORLD_MENU != TRUE
DestroyHelpMessageWindow_();
#endif
CloseStartMenu();
return TRUE;
}
@@ -513,6 +532,7 @@ static void StartMenu_FadeScreenIfLeavingOverworld(void)
{
if (sStartMenuCallback != StartMenuSaveCallback
&& sStartMenuCallback != StartMenuExitCallback
&& sStartMenuCallback != StartMenuDebugCallback
&& sStartMenuCallback != StartMenuSafariZoneRetireCallback)
{
StopPokemonLeagueLightingEffectTask();
@@ -603,20 +623,43 @@ static bool8 StartMenuOptionCallback(void)
static bool8 StartMenuExitCallback(void)
{
DestroySafariZoneStatsWindow();
#if DEBUG_OVERWORLD_MENU != TRUE
DestroyHelpMessageWindow_();
#endif
CloseStartMenu();
return TRUE;
}
static bool8 StartMenuDebugCallback(void)
{
DestroySafariZoneStatsWindow();
HideStartMenuDebug(); // Hide start menu without enabling movement
#if DEBUG_OVERWORLD_MENU == TRUE
FreezeObjectEvents();
Debug_ShowMainMenu();
#endif
return TRUE;
}
static bool8 StartMenuSafariZoneRetireCallback(void)
{
DestroySafariZoneStatsWindow();
#if DEBUG_OVERWORLD_MENU != TRUE
DestroyHelpMessageWindow_();
#endif
CloseStartMenu();
SafariZoneRetirePrompt();
return TRUE;
}
static void HideStartMenuDebug(void)
{
PlaySE(SE_SELECT);
ClearStdWindowAndFrame(GetStartMenuWindowId(), TRUE);
RemoveStartMenuWindow();
}
static bool8 StartMenuLinkPlayerCallback(void)
{
@@ -775,7 +818,9 @@ static u8 SaveDialogCB_PrintAskSaveText(void)
{
ClearStdWindowAndFrame(GetStartMenuWindowId(), FALSE);
RemoveStartMenuWindow();
#if DEBUG_OVERWORLD_MENU != TRUE
DestroyHelpMessageWindow(0);
#endif
PrintSaveStats();
PrintSaveTextWithFollowupFunc(gText_WouldYouLikeToSaveTheGame, SaveDialogCB_AskSavePrintYesNoMenu);
return SAVECB_RETURN_CONTINUE;

View File

@@ -915,6 +915,7 @@ const u8 gStartMenuDesc_Save[] = _("Save your game with a complete record\nof yo
const u8 gStartMenuDesc_Option[] = _("Adjust various game settings such as text\nspeed, game rules, etc.");
const u8 gStartMenuDesc_Exit[] = _("Close this MENU window.");
const u8 gStartMenuDesc_Retire[] = _("Retire from the SAFARI GAME and return to\nthe registration counter.");
const u8 gStartMenuDesc_Debug[] = _("Debug Menu.");
#include "data/text/quest_log.h"
@@ -1377,3 +1378,10 @@ const u8 gText_NextFusionMon[] = _("Choose {PKMN} to fuse with.");
const u8 gText_ExpShareOn[] = _("The Exp. Share has been turned on.{PAUSE_UNTIL_PRESS}");
const u8 gText_ExpShareOff[] = _("The Exp. Share has been turned off.{PAUSE_UNTIL_PRESS}");
// stats
const u8 gText_Attack[] = _("ATTACK");
const u8 gText_Defense[] = _("DEFENSE");
const u8 gText_Speed[] = _("SPEED");
const u8 gText_SpAtk[] = _("SP. ATK");
const u8 gText_SpDef[] = _("SP. DEF");

View File

@@ -43,6 +43,10 @@ static void Task_DestroyTrainerApproachTask(u8 taskId);
static void SpriteCB_TrainerIcons(struct Sprite *sprite);
static void SetIconSpriteData(struct Sprite *sprite, u16 fldEffId, u8 spriteAnimNum);
// IWRAM common
u16 gWhichTrainerToFaceAfterBattle;
u8 gNoOfApproachingTrainers;
static const u16 sGfx_Emoticons[] = INCBIN_U16("graphics/misc/emoticons.4bpp");
// u8 func(struct ObjectEvent * trainerObj, s16 range, s16 x, s16 y)

View File

@@ -1,5 +1,6 @@
#include "global.h"
#include "random.h"
#include "battle_debug.h"
#include "wild_encounter.h"
#include "event_data.h"
#include "fieldmap.h"

View File

@@ -451,6 +451,7 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) {
char dir_separator = file_dir.back();
ostringstream text;
ostringstream mapCountText;
text << "#ifndef GUARD_CONSTANTS_MAP_GROUPS_H\n"
<< "#define GUARD_CONSTANTS_MAP_GROUPS_H\n\n";
@@ -458,6 +459,7 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) {
text << "//\n// DO NOT MODIFY THIS FILE! It is auto-generated from data/maps/map_groups.json\n//\n\n";
int group_num = 0;
vector<int> map_count_vec; //DEBUG
for (auto &group : groups_data["group_order"].array_items()) {
string groupName = json_to_string(group);
@@ -465,6 +467,8 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) {
vector<string> map_ids;
size_t max_length = 0;
int map_count = 0; //DEBUG
for (auto &map_name : groups_data[groupName].array_items()) {
string map_filepath = file_dir + json_to_string(map_name) + dir_separator + "map.json";
string err_str;
@@ -475,6 +479,7 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) {
map_ids.push_back(id);
if (id.length() > max_length)
max_length = id.length();
map_count++; //DEBUG
}
int map_id_num = 0;
@@ -485,11 +490,20 @@ string generate_map_constants_text(string groups_filepath, Json groups_data) {
text << "\n";
group_num++;
map_count_vec.push_back(map_count); //DEBUG
}
text << "#define MAP_GROUPS_COUNT " << group_num << "\n\n";
text << "#endif // GUARD_CONSTANTS_MAP_GROUPS_H\n";
char s = file_dir.back();
mapCountText << "static const u8 MAP_GROUP_COUNT[] = {"; //DEBUG
for(int i=0; i<group_num; i++){ //DEBUG
mapCountText << map_count_vec[i] << ", "; //DEBUG
} //DEBUG
mapCountText << "0};\n"; //DEBUG
write_text_file(file_dir + ".." + s + ".." + s + "src" + s + "data" + s + "map_group_count.h", mapCountText.str());
return text.str();
}

View File

@@ -321,10 +321,10 @@ int ExtractData(const std::unique_ptr<unsigned char[]>& buffer, int offset, int
void CFile::TryConvertIncbin()
{
std::string idents[6] = { "INCBIN_S8", "INCBIN_U8", "INCBIN_S16", "INCBIN_U16", "INCBIN_S32", "INCBIN_U32" };
std::string idents[8] = { "INCBIN_S8", "INCBIN_U8", "INCBIN_S16", "INCBIN_U16", "INCBIN_S32", "INCBIN_U32", "DUMMY_PLACEHOLDER", "INCBIN_COMP"};
int incbinType = -1;
for (int i = 0; i < 6; i++)
for (int i = 0; i < 8; i++)
{
if (CheckIdentifier(idents[i]))
{
@@ -337,6 +337,8 @@ void CFile::TryConvertIncbin()
return;
int size = 1 << (incbinType / 2);
if (size > 4)
size = 4;
bool isSigned = ((incbinType % 2) == 0);
long oldPos = m_pos;
@@ -389,6 +391,10 @@ void CFile::TryConvertIncbin()
std::string path(&m_buffer[startPos], m_pos - startPos);
// INCBIN_COMP; include *compressed* version of file
if (incbinType == 7)
path = path.append(".lz");
m_pos++;
int fileSize;