Merge pull request #83 from cawtds/feature/debug-menu-update

update debug menu
This commit is contained in:
cawtds
2025-05-30 20:09:48 +02:00
committed by GitHub
25 changed files with 14600 additions and 13843 deletions

View File

@@ -475,8 +475,10 @@ FONT_NORMAL = FC 06 02
FONT_NORMAL_COPY_2 = FC 06 03
FONT_MALE = FC 06 04
FONT_FEMALE = FC 06 05
FONT_NARROW = FC 06 07
FONT_SMALL_NARROW = FC 06 08
@ FONT_BRAILLE = FC 06 06 @ not implemented
@ FONT_BOLD = FC 06 07 @ not implemented
FONT_NARROW = FC 06 08
FONT_SMALL_NARROW = FC 06 09
FONT_NARROWER = FC 06 0A
FONT_SMALL_NARROWER = FC 06 0B
FONT_SHORT_NARROW = FC 06 0C

View File

@@ -23,7 +23,7 @@ LavenderTown_House2_EventScript_DontRateNickname::
end
LavenderTown_House2_EventScript_CheckCanRateMon::
specialvar VAR_RESULT, GetPartyMonSpecies
specialvar VAR_RESULT, ScriptGetPartyMonSpecies
goto_if_eq VAR_RESULT, SPECIES_EGG, LavenderTown_House2_EventScript_CantNicknameEgg
special BufferMonNickname
special IsMonOTIDNotPlayers

View File

@@ -51,7 +51,7 @@ PalletTown_RivalsHouse_EventScript_GroomMon::
lock
faceplayer
goto_if_ge VAR_0x8004, PARTY_SIZE, PalletTown_RivalsHouse_EventScript_DeclineGrooming
specialvar VAR_RESULT, GetPartyMonSpecies
specialvar VAR_RESULT, ScriptGetPartyMonSpecies
goto_if_eq VAR_RESULT, SPECIES_EGG, PalletTown_RivalsHouse_EventScript_CantGroomEgg
msgbox PalletTown_RivalsHouse_Text_LookingNiceInNoTime
closemessage

View File

@@ -106,10 +106,10 @@ Debug_EventScript_CheckEVs_End::
end
Debug_EventScript_Text_OffensiveEVs:
.string "ATK EVs: {STR_VAR_1}, SPATK EVs: {STR_VAR_2},\nSPEED EVs: {STR_VAR_3}$"
.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},\nSPDEF EVs: {STR_VAR_3}$"
.string "HP EVs: {STR_VAR_1}, DEF EVs: {STR_VAR_2}, SPDEF EVs: {STR_VAR_3}$"
Debug_EventScript_CheckIVs::
lockall
@@ -127,10 +127,10 @@ Debug_EventScript_CheckIVs_End::
end
Debug_EventScript_Text_OffensiveIVs:
.string "ATK IVs: {STR_VAR_1}, SPATK IVs: {STR_VAR_2},\nSPEED IVs: {STR_VAR_3}$"
.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},\nSPDEF IVs: {STR_VAR_3}$"
.string "HP IVs: {STR_VAR_1}, DEF IVs: {STR_VAR_2}, SPDEF IVs: {STR_VAR_3}$"
Debug_EventScript_Script_1::
release
@@ -209,7 +209,7 @@ Debug_HatchAnEgg::
special ChoosePartyMon
waitstate
goto_if_ge VAR_0x8004, PARTY_SIZE, Debug_HatchAnEgg_End
specialvar VAR_RESULT, GetPartyMonSpecies
specialvar VAR_RESULT, ScriptGetPartyMonSpecies
goto_if_ne VAR_RESULT, SPECIES_EGG, DebugScript_HatchAnEgg_CantForceHatch
special EggHatch
waitstate
@@ -264,7 +264,12 @@ Debug_ShowExpansionVersion::
end
Debug_ExpansionVersion:
.string "pokefirered {STR_VAR_1}$"
.string "pokefirered-expansion {STR_VAR_1}$"
Debug_EventScript_Steven_Multi::
call MossdeepCity_SpaceCenter_2F_EventScript_ChoosePartyForMultiBattle
release
end
Debug_BerryPestsDisabled::
msgbox DebugText_BerryPestsDisabled, MSGBOX_DEFAULT
@@ -304,7 +309,7 @@ Debug_EventScript_InflictStatus1_Single:
special ChoosePartyMon
waitstate
goto_if_ge VAR_0x8004, PARTY_SIZE, Debug_EventScript_InflictStatus1_Close
specialvar VAR_RESULT, GetPartyMonSpecies
specialvar VAR_RESULT, ScriptGetPartyMonSpecies
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
@@ -322,7 +327,7 @@ Debug_EventScript_InflictStatus1_Single:
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
case MULTI_B_PRESSED, Debug_EventScript_InflictStatus1_Close
releaseall
end
@@ -373,7 +378,7 @@ Debug_EventScript_InflictStatus1_Party:
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
case MULTI_B_PRESSED, Debug_EventScript_InflictStatus1_Close
releaseall
end
@@ -433,3 +438,231 @@ Debug_EventScript_InflictStatus1_Text_Freeze:
Debug_EventScript_InflictStatus1_Text_Frostbite:
.string "Frostbite$"
Debug_EventScript_EWRAMCounters::
callnative CheckEWRAMCounters
msgbox Debug_EventScript_EWRAMCounters_Text, MSGBOX_DEFAULT
release
end
Debug_EventScript_EWRAMCounters_Text::
.string "Follower Steps: {STR_VAR_1}.\n"
.string "Fishing Chain: {STR_VAR_2}.$"
Debug_EventScript_FontTest_Text_1::
.string "{FONT_SMALL_NARROWER}" @ Edit this to test your font
.string "Angel Adept Blind Bodice Clique\n"
.string "Coast Dunce Docile Enact Eosin\l"
.string "Furlong Focal Gnome Gondola Human\l"
.string "Hoist Inlet Iodine Justin Jocose\l"
.string "Knoll Koala Linden Loads Milliner\l"
.string "Modal Number Nodule Onset Oddball\l"
.string "Pneumo Poncho Quanta Qophs Rhone\l"
.string "Roman Snout Sodium Tundra Tocsin\l"
.string "Uncle Udder Vulcan Vocal Whale\l"
.string "Woman Xmas Xenon Yunnan Young\l"
.string "Zloty Zodiac.$"
Debug_EventScript_FontTest_Text_2::
.string "{FONT_SMALL_NARROWER}" @ Edit this to test your font
.string "Angel angel adept for the nuance loads\n"
.string "of the arena cocoa and quaalude. Blind\l"
.string "blind bodice for the submit oboe of the\l"
.string "club snob and abbot. Clique clique\l"
.string "coast for the pouch loco of the franc\l"
.string "assoc and accede. Dunce dunce docile\l"
.string "for the loudness mastodon of the\l"
.string "loud statehood and huddle.$"
Debug_EventScript_FontTest_Text_3::
.string "{FONT_SMALL_NARROWER}" @ Edit this to test your font
.string "Enact enact eosin for the quench coed\n"
.string "of the pique canoe and bleep. Furlong\l"
.string "furlong focal for the genuflect\l"
.string "profound of the motif aloof and offers.\l"
.string "Gnome gnome gondola for the impugn\l"
.string "logos of the unplug analog and smuggle.\l"
.string "Human human hoist for the buddhist\l"
.string "alcohol of the riyadh caliph and\l"
.string "bathhouse.$"
Debug_EventScript_FontTest_Text_4::
.string "{FONT_SMALL_NARROWER}" @ Edit this to test your font
.string "Inlet inlet iodine for the quince\n"
.string "champion of the ennui scampi and shiite.\l"
.string "Justin justin jocose for the djibouti\l"
.string "sojourn of the oranj raj and hajjis.\l"
.string "Knoll knoll koala for the banknote\l"
.string "lookout of the dybbuk outlook and\l"
.string "trekked. Linden linden loads for the\l"
.string "ulna monolog of the consul menthol and\l"
.string "shallot.$"
Debug_EventScript_FontTest_Text_5::
.string "{FONT_SMALL_NARROWER}" @ Edit this to test your font
.string "Milliner milliner modal for the alumna\n"
.string "solomon of the album custom and summon.\l"
.string "Number number nodule for the unmade\l"
.string "economic of the shotgun bison and\l"
.string "tunnel. Onset onset oddball for the\l"
.string "abandon podium of the antiquo tempo\l"
.string "and moonlit. Pneumo pneumo poncho for\l"
.string "the dauphin opossum of the holdup\l"
.string "bishop and supplies.$"
Debug_EventScript_FontTest_Text_6::
.string "{FONT_SMALL_NARROWER}" @ Edit this to test your font
.string "Quanta quanta qophs for the inquest\n"
.string "sheqel of the cinq coq and suqqu. Rhone\l"
.string "rhone roman for the burnt porous of the\l"
.string "lemur clamor and carrot. Snout snout\l"
.string "sodium for the ensnare bosom of the\l"
.string "genus pathos and missing. Tundra\l"
.string "tundra tocsin for the nutmeg isotope\l"
.string "of the peasant ingot and ottoman.$"
Debug_EventScript_FontTest_Text_7::
.string "{FONT_SMALL_NARROWER}" @ Edit this to test your font
.string "Uncle uncle udder for the dunes cloud\n"
.string "of the hindu thou and continuum. Vulcan\l"
.string "vulcan vocal for the alluvial ovoid of\l"
.string "the yugoslav chekhov and revved. Whale\l"
.string "whale woman for the meanwhile blowout\l"
.string "of the forepaw meadow and glowworm.\l"
.string "Xmas xmas xenon for the bauxite\l"
.string "doxology of the tableaux equinox and\l"
.string "exxon.$"
Debug_EventScript_FontTest_Text_8::
.string "{FONT_SMALL_NARROWER}" @ Edit this to test your font
.string "Yunnan yunnan young for the dynamo\n"
.string "coyote of the obloquy employ and\l"
.string "sayyid. Zloty zloty zodiac for the gizmo\l"
.string "ozone of the franz laissez and buzzing.$"
Debug_EventScript_FontTest_Text_9:: @ Special thanks to Nintendo for this nice pangram to test other glyphs
.string "{FONT_SMALL_NARROWER}" @ Edit this to test your font
.string "42 × 138 = 5796.\n"
.string "Mr Jock, TV quiz PhD: bags 20% fewer\l"
.string "lynx at a café; voilà, they're “worth”\l"
.string "♂1/♀1 = ¥1. That's 10 + 9 - 8 = 11\l"
.string "Nintendo GBA can connect to a Nintendo\l"
.string "GameCube console! He claimed-though I don't\l"
.string "believe him-to have done so in an eyes-shut\l"
.string "state…?$"
Debug_PrintFontTest::
msgbox Debug_EventScript_FontTest_Text_1, MSGBOX_DEFAULT
msgbox Debug_EventScript_FontTest_Text_2, MSGBOX_DEFAULT
msgbox Debug_EventScript_FontTest_Text_3, MSGBOX_DEFAULT
msgbox Debug_EventScript_FontTest_Text_4, MSGBOX_DEFAULT
msgbox Debug_EventScript_FontTest_Text_5, MSGBOX_DEFAULT
msgbox Debug_EventScript_FontTest_Text_6, MSGBOX_DEFAULT
msgbox Debug_EventScript_FontTest_Text_7, MSGBOX_DEFAULT
msgbox Debug_EventScript_FontTest_Text_8, MSGBOX_DEFAULT
msgbox Debug_EventScript_FontTest_Text_9, MSGBOX_DEFAULT
releaseall
end
Debug_EventScript_FontTest::
lockall
goto Debug_PrintFontTest
@ 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_TellTheTime::
callnative DebugMenu_CalculateTime
msgbox Debug_EventScript_TellTheTime_Text_0, MSGBOX_DEFAULT
waitmessage
closemessage
end
Debug_EventScript_PrintTimeOfDay::
callnative DebugMenu_CalculateTimeOfDay
msgbox DebugEventScript_PrintWeekday_Text_0, MSGBOX_DEFAULT
waitmessage
closemessage
end
Debug_EventScript_FakeRTCNotEnabled::
msgbox Debug_EventScript_FakeRTCNotEnabled_Text_0, MSGBOX_DEFAULT
waitmessage
closemessage
return
Debug_EventScript_FakeRTCNotEnabled_Text_0:
.string "You currently do not have Fake RTC\nenabled. Please enable it in include/\lconfig/overworld.h$"
Debug_EventScript_TellTheTime_Text_0:
.string "Time and date:\n"
.string "{STR_VAR_1}, {STR_VAR_2}:{STR_VAR_3}$"
DebugEventScript_PrintWeekday_Text_0:
.string "Time of day: {STR_VAR_1}$"
@ steven multibattle script
MossdeepCity_SpaceCenter_2F_EventScript_ChoosePartyForMultiBattle::
applymovement VAR_LAST_TALKED, Common_Movement_WalkInPlaceFasterDown
waitmovement 0
special SavePlayerParty
fadescreen FADE_TO_BLACK
special ChooseHalfPartyForBattle
waitstate
goto_if_ne VAR_RESULT, 0, MossdeepCity_SpaceCenter_2F_EventScript_DoStevenMultiBattle
special LoadPlayerParty
goto MossdeepCity_SpaceCenter_2F_EventScript_ReadyForBattlePrompt
MossdeepCity_SpaceCenter_2F_EventScript_DoStevenMultiBattle::
multi_2_vs_2 TRAINER_MAXIE_MOSSDEEP, MossdeepCity_SpaceCenter_2F_Text_JustWantToExpandLand, TRAINER_TABITHA_MOSSDEEP, MossdeepCity_SpaceCenter_Text_TabithaDefeat, PARTNER_STEVEN
switch VAR_RESULT
case 1, MossdeepCity_SpaceCenter_2F_EventScript_DefeatedMaxieTabitha
fadescreen FADE_TO_BLACK
special SetCB2WhiteOut
waitstate
MossdeepCity_SpaceCenter_2F_EventScript_DefeatedMaxieTabitha::
fadescreen FADE_FROM_BLACK
releaseall
end
MossdeepCity_SpaceCenter_2F_Text_JustWantToExpandLand:
.string "All I want…\n"
.string "I just want to expand the land mass…$"
MossdeepCity_SpaceCenter_2F_EventScript_ReadyForBattlePrompt::
applymovement VAR_LAST_TALKED, Common_Movement_FacePlayer
waitmovement 0
msgbox MossdeepCity_SpaceCenter_2F_Text_StevenAreYouReadyToBattle, MSGBOX_YESNO
goto_if_eq VAR_RESULT, YES, MossdeepCity_SpaceCenter_2F_EventScript_ChoosePartyForMultiBattle
msgbox MossdeepCity_SpaceCenter_2F_Text_StevenHurryGetReadyQuickly, MSGBOX_DEFAULT
closemessage
applymovement VAR_LAST_TALKED, Common_Movement_WalkInPlaceFasterDown
waitmovement 0
releaseall
end
MossdeepCity_SpaceCenter_2F_Text_StevenAreYouReadyToBattle:
.string "STEVEN: {PLAYER}{KUN}!\n"
.string "You're going to help me?\p"
.string "Let's go into battle together!\n"
.string "Are you ready?$"
MossdeepCity_SpaceCenter_2F_Text_StevenHurryGetReadyQuickly:
.string "STEVEN: Then, hurry!\n"
.string "Get ready quickly!$"
MossdeepCity_SpaceCenter_Text_TabithaDefeat:
.string "I'm with our leader…$"

View File

@@ -342,7 +342,7 @@ gSpecials::
def_special NullFieldSpecial
def_special NullFieldSpecial
def_special NullFieldSpecial
def_special GetPartyMonSpecies
def_special ScriptGetPartyMonSpecies
def_special IsSelectedMonEgg
def_special NullFieldSpecial
def_special NullFieldSpecial

View File

@@ -73,7 +73,7 @@
#define TRAINER_RS_PKMN_BREEDER_F 66
#define TRAINER_RS_PKMN_RANGER_M 67
#define TRAINER_RS_PKMN_RANGER_F 68
#define TRAINER_MAGMA_LEADER 69
#define TRAINER_MAXIE_MOSSDEEP 69
#define TRAINER_MAGMA_GRUNT_M 70
#define TRAINER_MAMGA_GRUNT_F 71
#define TRAINER_RS_LASS 72
@@ -84,7 +84,7 @@
#define TRAINER_RS_SIS_AND_BRO 77
#define TRAINER_AQUA_ADMIN_MATT 78
#define TRAINER_AQUA_ADMIN_SHELLY 79
#define TRAINER_MAGMA_ADMIN_TABITHA 80
#define TRAINER_TABITHA_MOSSDEEP 80
#define TRAINER_MAGMA_ADMIN_COURTNEY 81
#define TRAINER_LEADER_WATTSON 82
#define TRAINER_LEADER_FLANNERY 83

28
include/datetime.h Normal file
View File

@@ -0,0 +1,28 @@
#ifndef GUARD_DATETIME_H
#define GUARD_DATETIME_H
#include "global.h"
#include "siirtc.h"
struct DateTime
{
u16 year;
enum Month month;
u8 day;
enum Weekday dayOfWeek;
u8 hour;
u8 minute;
u8 second;
};
extern const struct DateTime gGen3Epoch;
void ConvertTimeToDateTime(struct DateTime *result, struct Time *timeSinceEpoch);
void DateTime_AddDays(struct DateTime *dateTime, u32 days);
void DateTime_AddHours(struct DateTime *dateTime, u32 hours);
void DateTime_AddMinutes(struct DateTime *dateTime, u32 minutes);
void DateTime_AddSeconds(struct DateTime *dateTime, u32 seconds);
void ConvertDateTimeToRtc(struct SiiRtcInfo *result, struct DateTime *dateTime);
void ConvertRtcToDateTime(struct DateTime *result, struct SiiRtcInfo *rtc);
#endif // GUARD_DATETIME_H

View File

@@ -3,8 +3,9 @@
void Debug_ShowMainMenu(void);
extern const u8 Debug_FlagsAndVarNotSetBattleConfigMessage[];
const u8 *GetWeatherName(u32 weatherId);
extern EWRAM_DATA bool8 gIsDebugBattle;
extern EWRAM_DATA u32 gDebugAIFlags;
extern EWRAM_DATA u64 gDebugAIFlags;
#endif // GUARD_DEBUG_H

View File

@@ -8,7 +8,11 @@ struct SiiRtcInfo* FakeRtc_GetCurrentTime(void);
void FakeRtc_GetRawInfo(struct SiiRtcInfo *rtc);
void FakeRtc_AdvanceTimeBy(u32 days, u32 hours, u32 minutes, u32 seconds);
void FakeRtc_ManuallySetTime(u32 day, u32 hour, u32 minute, u32 second);
void FakeRtc_ForwardTimeTo(u32 hour, u32 minute, u32 second);
void FakeRtc_TickTimeForward(void);
u32 FakeRtc_GetSecondsRatio(void);
void Script_PauseFakeRtc(void);
void Script_ResumeFakeRtc(void);
void Script_ToggleFakeRtc(void);
#endif // GUARD_FAKE_RTC_UTIL_H

View File

@@ -39,7 +39,7 @@ extern const struct Item gItemsInfo[];
extern struct BagPocket gBagPockets[];
void GetBerryCountString(u8 *dst, const u8 *berryName, u32 quantity);
void CopyItemName(u16 itemId, u8 *string);
u8 *CopyItemName(u16 itemId, u8 *string);
u8 *CopyItemNameHandlePlural(u16 itemId, u8 *string, u32 quantity);
bool8 IsBagPocketNonEmpty(u8 pocket);
bool8 CheckBagHasItem(u16 itemId, u16 count);

View File

@@ -4,6 +4,6 @@
#include "global.h"
void ShowMapNamePopup(bool32 palIntoFadedBuffer);
void DismissMapNamePopup(void);
void HideMapNamePopUpWindow(void);
#endif //GUARD_MAP_NAME_POPUP_H

View File

@@ -13,7 +13,7 @@
#define MINUTES_PER_HOUR 60
#define SECONDS_PER_MINUTE 60
enum
enum Weekday
{
WEEKDAY_SUN,
WEEKDAY_MON,
@@ -25,7 +25,7 @@ enum
WEEKDAY_COUNT,
};
enum
enum Month
{
MONTH_JAN = 1,
MONTH_FEB,
@@ -38,7 +38,8 @@ enum
MONTH_SEP,
MONTH_OCT,
MONTH_NOV,
MONTH_DEC
MONTH_DEC,
MONTH_COUNT = MONTH_DEC
};
struct SiiRtcInfo

View File

@@ -184,6 +184,7 @@ void DestroyTextCursorSprite(u8 spriteId);
u32 GetFontIdToFit(const u8 *string, u32 widestFontId, u32 letterSpacing, u32 widthPx);
u8 *PrependFontIdToFit(u8 *start, u8 *end, u32 fontId, u32 width);
u8 *WrapFontIdToFit(u8 *start, u8 *end, u32 fontId, u32 width);
// braille.c
u16 FontFunc_Braille(struct TextPrinter *textPrinter);

View File

@@ -1344,8 +1344,7 @@ static void CB2_HandleStartMultiPartnerBattle(void)
static void SetMultiPartnerMenuParty(u8 offset)
{
s32 i, j;
u8 *cur;
s32 i;
for (i = 0; i < MULTI_PARTY_SIZE; i++)
{

File diff suppressed because it is too large Load Diff

View File

@@ -890,18 +890,26 @@ Ekans
Level: 5
IVs: 12 HP / 12 Atk / 12 Def / 12 SpA / 12 SpD / 12 Spe
=== TRAINER_MAGMA_LEADER ===
Name: PH
=== TRAINER_MAXIE_MOSSDEEP ===
Name: MAXIE
Class: Magma Leader
Pic: Magma Leader Maxie
Gender: Male
Music: Magma
Double Battle: No
AI: Check Bad Move
AI: Basic Trainer
Ekans
Level: 5
IVs: 0 HP / 0 Atk / 0 Def / 0 SpA / 0 SpD / 0 Spe
Mightyena
Level: 42
IVs: 18 HP / 18 Atk / 18 Def / 18 SpA / 18 SpD / 18 Spe
Crobat
Level: 43
IVs: 18 HP / 18 Atk / 18 Def / 18 SpA / 18 SpD / 18 Spe
Camerupt
Level: 44
IVs: 18 HP / 18 Atk / 18 Def / 18 SpA / 18 SpD / 18 Spe
=== TRAINER_MAGMA_GRUNT_M ===
Name: PH
@@ -1037,7 +1045,7 @@ Ekans
Level: 5
IVs: 0 HP / 0 Atk / 0 Def / 0 SpA / 0 SpD / 0 Spe
=== TRAINER_MAGMA_ADMIN_TABITHA ===
=== TRAINER_TABITHA_MOSSDEEP ===
Name: TABITHA
Class: Magma Admin
Pic: Magma Admin M
@@ -1046,9 +1054,17 @@ Music: Magma
Double Battle: No
AI: Check Bad Move
Ekans
Level: 5
IVs: 0 HP / 0 Atk / 0 Def / 0 SpA / 0 SpD / 0 Spe
Camerupt
Level: 36
IVs: 12 HP / 12 Atk / 12 Def / 12 SpA / 12 SpD / 12 Spe
Mightyena
Level: 38
IVs: 12 HP / 12 Atk / 12 Def / 12 SpA / 12 SpD / 12 Spe
Golbat
Level: 40
IVs: 12 HP / 12 Atk / 12 Def / 12 SpA / 12 SpD / 12 Spe
=== TRAINER_MAGMA_ADMIN_COURTNEY ===
Name: COURTNEY

115
src/datetime.c Normal file
View File

@@ -0,0 +1,115 @@
#include "global.h"
#include "datetime.h"
#include "rtc.h"
const struct DateTime gGen3Epoch =
{
.year = 2000,
.month = MONTH_JAN,
.day = 1,
.dayOfWeek = WEEKDAY_SAT,
.hour = 0,
.minute = 0,
.second = 0,
};
void DateTime_AddDays(struct DateTime *dateTime, u32 days)
{
while (days > 0)
{
u32 remainingDaysInMonth = (sNumDaysInMonths[dateTime->month - 1] + (dateTime->month == MONTH_FEB && IsLeapYear(dateTime->year)) - dateTime->day);
if (days > remainingDaysInMonth)
{
dateTime->day = 1;
dateTime->month++;
if (dateTime->month > MONTH_DEC)
{
dateTime->month = MONTH_JAN;
dateTime->year++;
}
days -= (remainingDaysInMonth + 1);
dateTime->dayOfWeek = (dateTime->dayOfWeek + remainingDaysInMonth + 1) % WEEKDAY_COUNT;
}
else
{
dateTime->day += days;
dateTime->dayOfWeek = (dateTime->dayOfWeek + days) % WEEKDAY_COUNT;
days = 0;
}
}
}
void DateTime_AddHours(struct DateTime *dateTime, u32 hours)
{
u32 days = 0;
dateTime->hour += hours;
while (dateTime->hour >= HOURS_PER_DAY)
{
days++;
dateTime->hour -= HOURS_PER_DAY;
}
DateTime_AddDays(dateTime, days);
}
void DateTime_AddMinutes(struct DateTime *dateTime, u32 minutes)
{
u32 hours = 0;
dateTime->minute += minutes;
while(dateTime->minute >= MINUTES_PER_HOUR)
{
hours++;
dateTime->minute -= MINUTES_PER_HOUR;
}
DateTime_AddHours(dateTime, hours);
}
void DateTime_AddSeconds(struct DateTime *dateTime, u32 seconds)
{
u32 minutes = 0;
dateTime->second += seconds;
while(dateTime->second >= SECONDS_PER_MINUTE)
{
minutes++;
dateTime->second -= SECONDS_PER_MINUTE;
}
DateTime_AddMinutes(dateTime, minutes);
}
void ConvertDateTimeToRtc(struct SiiRtcInfo *result, struct DateTime *dateTime)
{
result->second = dateTime->second;
result->minute = dateTime->minute;
result->hour = dateTime->hour;
result->day = dateTime->day;
result->dayOfWeek = dateTime->dayOfWeek;
result->month = dateTime->month;
result->year = dateTime->year - gGen3Epoch.year;
}
void ConvertRtcToDateTime(struct DateTime *result, struct SiiRtcInfo *rtc)
{
result->second = rtc->second;
result->minute = rtc->minute;
result->hour = rtc->hour;
result->day = rtc->day;
result->dayOfWeek = rtc->dayOfWeek;
result->month = rtc->month;
result->year = gGen3Epoch.year + rtc->year;
}
void ConvertTimeToDateTime(struct DateTime *result, struct Time *timeSinceEpoch)
{
result = memcpy(result, &gGen3Epoch, sizeof(struct DateTime));
DateTime_AddSeconds(result, timeSinceEpoch->seconds);
DateTime_AddMinutes(result, timeSinceEpoch->minutes);
DateTime_AddHours(result, timeSinceEpoch->hours);
DateTime_AddDays(result, timeSinceEpoch->days);
}

File diff suppressed because it is too large Load Diff

View File

@@ -986,7 +986,7 @@ bool8 TryStartDexNavSearch(void)
if (FlagGet(DN_FLAG_SEARCHING) || (val & DEXNAV_MASK_SPECIES) == SPECIES_NONE)
return FALSE;
DismissMapNamePopup();
HideMapNamePopUpWindow();
ChangeBgY_ScreenOff(0, 0, 0);
taskId = CreateTask(Task_InitDexNavSearch, 0);
gTasks[taskId].tSpecies = val & DEXNAV_MASK_SPECIES;
@@ -2633,7 +2633,7 @@ bool8 TryFindHiddenPokemon(void)
gTasks[taskId].tSpecies = sDexNavSearchDataPtr->species;
gTasks[taskId].tEnvironment = sDexNavSearchDataPtr->environment;
gTasks[taskId].tRevealed = FALSE;
DismissMapNamePopup();
HideMapNamePopUpWindow();
ChangeBgY_ScreenOff(0, 0, 0);
return FALSE; // we dont actually want to enable the script context or the game will freeze
}

View File

@@ -2,18 +2,22 @@
#include "string_util.h"
#include "strings.h"
#include "text.h"
#include "datetime.h"
#include "rtc.h"
#include "fake_rtc.h"
#include "event_data.h"
#include "script.h"
static void FakeRtc_CalcTimeDifference(struct Time *result, struct SiiRtcInfo *t1, struct Time *t2);
void FakeRtc_Reset(void)
{
#if OW_USE_FAKE_RTC
memset(&gSaveBlock3Ptr->fakeRTC, 0, sizeof(gSaveBlock3Ptr->fakeRTC));
gSaveBlock3Ptr->fakeRTC.month = MONTH_JAN;
gSaveBlock3Ptr->fakeRTC.day = 1;
gSaveBlock3Ptr->fakeRTC.dayOfWeek = WEEKDAY_SAT;
gSaveBlock3Ptr->fakeRTC.year = 0; // offset by gGen3Epoch.year
gSaveBlock3Ptr->fakeRTC.month = gGen3Epoch.month;
gSaveBlock3Ptr->fakeRTC.day = gGen3Epoch.day;
gSaveBlock3Ptr->fakeRTC.dayOfWeek = gGen3Epoch.dayOfWeek;
#endif
}
@@ -46,69 +50,62 @@ void FakeRtc_TickTimeForward(void)
void FakeRtc_AdvanceTimeBy(u32 days, u32 hours, u32 minutes, u32 seconds)
{
struct DateTime dateTime;
struct SiiRtcInfo *rtc = FakeRtc_GetCurrentTime();
seconds += rtc->second;
minutes += rtc->minute;
hours += rtc->hour;
while(seconds >= SECONDS_PER_MINUTE)
{
minutes++;
seconds -= SECONDS_PER_MINUTE;
}
while(minutes >= MINUTES_PER_HOUR)
{
hours++;
minutes -= MINUTES_PER_HOUR;
}
while(hours >= HOURS_PER_DAY)
{
days++;
hours -= HOURS_PER_DAY;
}
rtc->second = seconds;
rtc->minute = minutes;
rtc->hour = hours;
while (days > 0)
{
u32 remainingDaysInMonth = (sNumDaysInMonths[rtc->month - 1] + (rtc->month == MONTH_FEB && IsLeapYear(rtc->year)) - rtc->day);
if (days > remainingDaysInMonth)
{
rtc->day = 1;
rtc->month++;
if (rtc->month > MONTH_DEC)
{
rtc->month = MONTH_JAN;
rtc->year++;
}
days -= (remainingDaysInMonth + 1);
rtc->dayOfWeek = (rtc->dayOfWeek + remainingDaysInMonth + 1) % WEEKDAY_COUNT;
}
else
{
rtc->day += days;
rtc->dayOfWeek = (rtc->dayOfWeek + days) % WEEKDAY_COUNT;
days = 0;
}
}
ConvertRtcToDateTime(&dateTime, rtc);
DateTime_AddSeconds(&dateTime, seconds);
DateTime_AddMinutes(&dateTime, minutes);
DateTime_AddHours(&dateTime, hours);
DateTime_AddDays(&dateTime, days);
ConvertDateTimeToRtc(rtc, &dateTime);
}
void FakeRtc_ForwardTimeTo(u32 hour, u32 minute, u32 second)
{
Script_PauseFakeRtc();
struct Time diff, target;
struct SiiRtcInfo *fakeRtc = FakeRtc_GetCurrentTime();
target.hours = hour;
target.minutes = minute;
target.seconds = second;
FakeRtc_CalcTimeDifference(&diff, fakeRtc, &target);
FakeRtc_AdvanceTimeBy(0, diff.hours, diff.minutes, diff.seconds);
Script_ResumeFakeRtc();
}
static void FakeRtc_CalcTimeDifference(struct Time *result, struct SiiRtcInfo *t1, struct Time *t2)
{
result->seconds = t2->seconds - t1->second;
result->minutes = t2->minutes - t1->minute;
result->hours = t2->hours - t1->hour;
result->days = t2->days - t1->day;
if (result->seconds < 0)
{
result->seconds += SECONDS_PER_MINUTE;
--result->minutes;
}
if (result->minutes < 0)
{
result->minutes += MINUTES_PER_HOUR;
--result->hours;
}
if (result->hours < 0)
{
result->hours += HOURS_PER_DAY;
--result->days;
}
}
void FakeRtc_ManuallySetTime(u32 day, u32 hour, u32 minute, u32 second)
{
FakeRtc_Reset();
FakeRtc_AdvanceTimeBy(day > 0 ? day - 1 : 0, hour, minute, second);
}
void AdvanceScript(void)
{
FakeRtc_AdvanceTimeBy(300, 0, 0, 0);
FakeRtc_AdvanceTimeBy(day, hour, minute, second);
}
u32 FakeRtc_GetSecondsRatio(void)

View File

@@ -570,7 +570,7 @@ u8 GetLeadMonIndex(void)
return 0;
}
u16 GetPartyMonSpecies(void)
u16 ScriptGetPartyMonSpecies(void)
{
return GetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_SPECIES_OR_EGG, NULL);
}

View File

@@ -62,9 +62,9 @@ void SetBagPocketsPointers(void)
gBagPockets[POCKET_BERRIES - 1].capacity = BAG_BERRIES_COUNT;
}
void CopyItemName(u16 itemId, u8 * dest)
u8 *CopyItemName(u16 itemId, u8 * dest)
{
StringCopy(dest, GetItemName(itemId));
return StringCopy(dest, GetItemName(itemId));
}
const u8 sText_s[] =_("s");

View File

@@ -2028,7 +2028,7 @@ bool8 UseRegisteredKeyItemOnField(void)
u8 taskId;
if (InUnionRoom() == TRUE)
return FALSE;
DismissMapNamePopup();
HideMapNamePopUpWindow();
ChangeBgY(0, 0, 0);
if (gSaveBlock1Ptr->registeredItem != ITEM_NONE)
{

View File

@@ -136,7 +136,7 @@ static void Task_MapNamePopup(u8 taskId)
SetGpuReg(REG_OFFSET_BG0VOFS, task->tPos);
}
void DismissMapNamePopup(void)
void HideMapNamePopUpWindow(void)
{
u8 taskId;
s16 *data;

View File

@@ -1426,7 +1426,7 @@ static void DoCB1_Overworld(u16 newKeys, u16 heldKeys)
if (gQuestLogPlaybackState == QL_PLAYBACK_STATE_RECORDING)
QL_RecordFieldInput(&gFieldInputRecord);
LockPlayerFieldControls();
DismissMapNamePopup();
HideMapNamePopUpWindow();
}
else
{
@@ -1451,7 +1451,7 @@ static void DoCB1_Overworld_QuestLogPlayback(void)
if (ProcessPlayerFieldInput(&fieldInput) == TRUE)
{
LockPlayerFieldControls();
DismissMapNamePopup();
HideMapNamePopUpWindow();
}
else
{