mirror of
https://github.com/resetes12/pokeemerald
synced 2025-10-06 00:12:45 +02:00
Berry stuck (temporal?) fix
This commit is contained in:
@@ -4,5 +4,6 @@
|
||||
// TODO: time of day and seconds in a day defines
|
||||
|
||||
void DoTimeBasedEvents(void);
|
||||
void FastForwardTime(s16, s16);
|
||||
|
||||
#endif // GUARD_CLOCK_H
|
||||
|
14
src/clock.c
14
src/clock.c
@@ -84,3 +84,17 @@ void StartWallClock(void)
|
||||
SetMainCallback2(CB2_StartWallClock);
|
||||
gMain.savedCallback = ReturnFromStartWallClock;
|
||||
}
|
||||
|
||||
|
||||
void FastForwardTime(s16 daysToUpdateDay, s16 hoursToGrowBerries){
|
||||
// Runs the UpdatePerDay function as if daysToUpdateDay days have passed and grows the berries by hoursToGrowBerries
|
||||
s16 daysBerry = hoursToGrowBerries / 24;
|
||||
s8 hoursBerry = hoursToGrowBerries % 24;
|
||||
struct Time localTimeOffset;
|
||||
localTimeOffset.days = *GetVarPointer(VAR_DAYS) + daysToUpdateDay;
|
||||
UpdatePerDay(&localTimeOffset);
|
||||
localTimeOffset = gSaveBlock2Ptr->lastBerryTreeUpdate;
|
||||
localTimeOffset.days += daysBerry;
|
||||
localTimeOffset.hours += hoursBerry;
|
||||
UpdatePerMinute(&localTimeOffset);
|
||||
}
|
||||
|
@@ -890,6 +890,11 @@ static void Task_ViewClock_HandleInput(u8 taskId)
|
||||
ScheduleBgCopyTilemapToVram(2);
|
||||
gTasks[taskId].func = Task_SetClock_HandleInput;
|
||||
}
|
||||
if ((VarGet(VAR_DEBUG_OPTIONS) == 1) && (JOY_HELD(SELECT_BUTTON) && JOY_NEW(L_BUTTON)))
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
FastForwardTime(10, 4);
|
||||
}
|
||||
}
|
||||
|
||||
static void Task_ViewClock_FadeOut(u8 taskId)
|
||||
|
Reference in New Issue
Block a user