Add OW_FLAG_PAUSE_TIME, pausefakertc, resumefakertc and togglefakertc (#4954)

* First concept

* Fixed config file and added static assert

* Reset debug scripts

* Cleaned up overworld config

* Renamed new Rtc pausing functions per https://github.com/rh-hideout/pokeemerald-expansion/pull/4954\#discussion_r1675393121

* Added tabs instead of spaces per https://github.com/rh-hideout/pokeemerald-expansion/pull/4954\#discussion_r1676791279

* Update include/config/overworld.h

---------

Co-authored-by: Bassoonian <iasperbassoonian@gmail.com>
This commit is contained in:
psf 2024-07-13 11:44:27 -07:00 committed by GitHub
parent d224db43c8
commit 3e03419bdb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 47 additions and 11 deletions

View file

@ -1055,7 +1055,7 @@
.endm
@ creates a mon for a given party and slot
@ otherwise
@ otherwise
.macro createmon side:req, slot:req, species:req, level:req, item, ball, nature, abilityNum, gender, hpEv, atkEv, defEv, speedEv, spAtkEv, spDefEv, hpIv, atkIv, defIv, speedIv, spAtkIv, spDefIv, move1, move2, move3, move4, isShiny, ggMaxFactor, teraType
callnative ScrCmd_createmon
.byte \side @ 0 - player, 1 - opponent
@ -2094,7 +2094,7 @@
setvar VAR_0x8006, \item
special CreateEnemyEventMon
.endm
.macro setdynamicaifunc func:req
callnative ScriptSetDynamicAiFunc
.4byte \func
@ -2300,9 +2300,24 @@
.byte \sourceId
.byte \targetId
.endm
@ set the wild double battle flag
@ can be used in conjunection with createmon to set up a wild battle with 2 player mons vs. 1 enemy mon
.macro setwilddoubleflag
callnative ScriptSetDoubleBattleFlag
.endm
@ When OW_USE_FAKE_RTC and OW_FLAG_PAUSE_TIME is assigned, this macro will stop the flow of time.
.macro pausefakertc
callnative Script_PauseFakeRtc
.endm
@ When OW_USE_FAKE_RTC and OW_FLAG_PAUSE_TIME is assigned, this macro will resume the flow of time.
.macro resumefakertc
callnative Script_ResumeFakeRtc
.endm
@ When OW_USE_FAKE_RTC and OW_FLAG_PAUSE_TIME is assigned, this macro will resume the flow of time if paused, and stop the flow of time otherwise.
.macro togglefakertc
callnative Script_ToggleFakeRtc
.endm

View file

@ -58,9 +58,18 @@
#define OW_STORM_DRAIN GEN_LATEST // In Gen8+, if a Pokémon with Storm Drain is leading the party, there is a 50% chance to encounter a Water-type Pokémon.
#define OW_FLASH_FIRE GEN_LATEST // In Gen8+, if a Pokémon with Flash Fire is leading the party, there is a 50% chance to encounter a Fire-type Pokémon.
// These generational defines only make a distinction for OW_ALTERED_TIME_RATIO
#define GEN_8_PLA GEN_LATEST + 2
//Time
#define OW_TIMES_OF_DAY GEN_LATEST // Different generations have the times of day change at different times.
#define OW_USE_FAKE_RTC TRUE // When TRUE, seconds on the in-game clock will only advance once every 60 playTimeVBlanks (every 60 frames).
#define OW_ALTERED_TIME_RATIO GEN_LATEST // In GEN_8_PLA, the time in game moves forward 60 seconds for every second in the RTC. In GEN_9, it is 20 seconds. This has no effect if OW_USE_FAKE_RTC is FALSE.
// Overworld flags
// To use the following features in scripting, replace the 0s with the flag ID you're assigning it to.
// Eg: Replace with FLAG_UNUSED_0x264 so you can use that flag to toggle the feature.
#define OW_FLAG_PAUSE_TIME 0 // If this flag is set and OW_USE_FAKE_RTC is enabled, seconds on the in-game clock will not advance.
#define OW_FLAG_NO_ENCOUNTER 0 // If this flag is set, wild encounters will be disabled.
#define OW_FLAG_NO_TRAINER_SEE 0 // If this flag is set, trainers will not battle the player unless they're talked to.
#define OW_FLAG_NO_COLLISION 0 // If this flag is set, the player will be able to walk over tiles with collision. Mainly intended for debugging purposes.
@ -85,14 +94,6 @@
#define OW_POPUP_BW_TIME_MODE OW_POPUP_BW_TIME_NONE // Determines what type of time is shown.
#define OW_POPUP_BW_ALPHA_BLEND FALSE // Enables alpha blending/transparency for the pop-ups. Mainly intended to be used with the black color option.
// These generational defines only make a distinction for OW_ALTERED_TIME_RATIO
#define GEN_8_PLA GEN_LATEST + 2
//Time
#define OW_TIMES_OF_DAY GEN_LATEST // Different generations have the times of day change at different times.
#define OW_USE_FAKE_RTC FALSE // When TRUE, seconds on the in-clock will only advance once every 60 playTimeVBlanks (every 60 frames).
#define OW_ALTERED_TIME_RATIO GEN_LATEST // In GEN_8_PLA, the time in game moves forward 60 seconds for every second in the RTC. In GEN_9, it is 20 seconds. This has no effect if OW_USE_FAKE_RTC is FALSE.
// Pokémon Center
#define OW_IGNORE_EGGS_ON_HEAL GEN_LATEST // In Gen 4+, the nurse in the Pokémon Center does not heal Eggs on healing machine.

View file

@ -4,6 +4,7 @@
#include "text.h"
#include "rtc.h"
#include "fake_rtc.h"
#include "event_data.h"
struct Time *FakeRtc_GetCurrentTime(void)
{
@ -28,6 +29,9 @@ void FakeRtc_TickTimeForward(void)
if (!OW_USE_FAKE_RTC)
return;
if (FlagGet(OW_FLAG_PAUSE_TIME))
return;
FakeRtc_AdvanceTimeBy(0, 0, FakeRtc_GetSecondsRatio());
}
@ -82,3 +86,19 @@ u32 FakeRtc_GetSecondsRatio(void)
1;
}
STATIC_ASSERT((OW_FLAG_PAUSE_TIME == 0 || OW_USE_FAKE_RTC == TRUE), FakeRtcMustBeTrueToPauseTime);
void Script_PauseFakeRtc(void)
{
FlagSet(OW_FLAG_PAUSE_TIME);
}
void Script_ResumeFakeRtc(void)
{
FlagClear(OW_FLAG_PAUSE_TIME);
}
void Script_ToggleFakeRtc(void)
{
FlagToggle(OW_FLAG_PAUSE_TIME);
}