summaryrefslogtreecommitdiff
path: root/src/clock.c
diff options
context:
space:
mode:
authorProjectRevoTPP <projectrevotpp@hotmail.com>2017-08-12 01:26:29 -0400
committerProjectRevoTPP <projectrevotpp@hotmail.com>2017-08-12 01:26:29 -0400
commit1a8fe435e7deabf06029c8e50201136518e3af73 (patch)
tree9746f2f4f4901e81496465da485d0f5c8a647586 /src/clock.c
parentbb0cad7c072703f5a540e8c22c8e137267331f4d (diff)
split out src/ directory into categorized subdirectories.
Diffstat (limited to 'src/clock.c')
-rw-r--r--src/clock.c90
1 files changed, 0 insertions, 90 deletions
diff --git a/src/clock.c b/src/clock.c
deleted file mode 100644
index 1f2aac9fd..000000000
--- a/src/clock.c
+++ /dev/null
@@ -1,90 +0,0 @@
-#include "global.h"
-#include "clock.h"
-#include "berry.h"
-#include "dewford_trend.h"
-#include "event_data.h"
-#include "field_specials.h"
-#include "field_weather.h"
-#include "lottery_corner.h"
-#include "main.h"
-#include "rom4.h"
-#include "rtc.h"
-#include "time_events.h"
-#include "tv.h"
-#include "wallclock.h"
-
-static void InitTimeBasedEvents(void);
-static void UpdatePerDay(struct Time *time);
-static void UpdatePerMinute(struct Time *time);
-static void ReturnFromStartWallClock(void);
-
-static void InitTimeBasedEvents(void)
-{
- FlagSet(SYS_CLOCK_SET);
- RtcCalcLocalTime();
- gSaveBlock2.lastBerryTreeUpdate = gLocalTime;
- VarSet(VAR_DAYS, gLocalTime.days);
-}
-
-void DoTimeBasedEvents(void)
-{
- if (FlagGet(SYS_CLOCK_SET))
- {
- RtcCalcLocalTime();
- UpdatePerDay(&gLocalTime);
- UpdatePerMinute(&gLocalTime);
- }
-}
-
-static void UpdatePerDay(struct Time *time)
-{
- u16 *varPtr = GetVarPointer(VAR_DAYS);
- int days = *varPtr;
- u16 newDays;
-
- if (days != time->days && days <= time->days)
- {
- newDays = time->days - days;
- ClearUpperFlags();
- UpdateDewfordTrendPerDay(newDays);
- UpdateTVShowsPerDay(newDays);
- UpdateWeatherPerDay(newDays);
- UpdatePartyPokerusTime(newDays);
- UpdateMirageRnd(newDays);
- UpdateBirchState(newDays);
- SetShoalItemFlag(newDays);
- SetRandomLotteryNumber(newDays);
- *varPtr = time->days;
- }
-}
-
-static void UpdatePerMinute(struct Time *time)
-{
- struct Time newTime;
- s32 minutes;
-
- CalcTimeDifference(&newTime, &gSaveBlock2.lastBerryTreeUpdate, time);
- minutes = 1440 * newTime.days + 60 * newTime.hours + newTime.minutes;
-
- // there's no way to get the correct assembly other than with this nested if check. so dumb.
- if (minutes != 0)
- {
- if (minutes >= 0)
- {
- BerryTreeTimeUpdate(minutes);
- gSaveBlock2.lastBerryTreeUpdate = *time;
- }
- }
-}
-
-static void ReturnFromStartWallClock(void)
-{
- InitTimeBasedEvents();
- SetMainCallback2(c2_exit_to_overworld_1_continue_scripts_restart_music);
-}
-
-void StartWallClock(void)
-{
- SetMainCallback2(CB2_StartWallClock);
- gMain.savedCallback = ReturnFromStartWallClock;
-}