fix battle setup conflicts

This commit is contained in:
DizzyEggg
2017-12-17 20:26:13 +01:00
46 changed files with 1365 additions and 1826 deletions

View File

@@ -2444,7 +2444,7 @@ static void CB2_HandleBlenderEndGame(void)
sBerryBlenderData->gameEndState++;
break;
case 10:
switch (sub_8198C58())
switch (ProcessMenuInputNoWrap_())
{
case 1:
case -1:

View File

@@ -88,7 +88,7 @@ static void Task_DoClearSaveDataScreenYesNo(u8 taskId)
static void Task_ClearSaveDataScreenYesNoChoice(u8 taskId)
{
switch(sub_8198C58())
switch(ProcessMenuInputNoWrap_())
{
case 0:
FillWindowPixelBuffer(0, 17);

93
src/clock.c Normal file
View File

@@ -0,0 +1,93 @@
#include "global.h"
#include "rom6.h"
#include "event_data.h"
#include "rtc.h"
#include "lottery_corner.h"
#include "dewford_trend.h"
#include "tv.h"
#include "field_screen.h"
#include "berry.h"
#include "main.h"
#include "overworld.h"
#include "wallclock.h"
// static types
// static declarations
static void UpdatePerDay(struct Time *localTime);
static void UpdatePerMinute(struct Time *localTime);
// rodata
// text
static void InitTimeBasedEvents(void)
{
FlagSet(FLAG_SYS_CLOCK_SET);
RtcCalcLocalTime();
gSaveBlock2Ptr->lastBerryTreeUpdate = gLocalTime;
VarSet(VAR_DAYS, gLocalTime.days);
}
void DoTimeBasedEvents(void)
{
if (FlagGet(FLAG_SYS_CLOCK_SET) && !sub_813B9C0())
{
RtcCalcLocalTime();
UpdatePerDay(&gLocalTime);
UpdatePerMinute(&gLocalTime);
}
}
static void UpdatePerDay(struct Time *localTime)
{
u16 *days = GetVarPointer(VAR_DAYS);
u16 daysSince;
if (*days != localTime->days && *days <= localTime->days)
{
daysSince = localTime->days - *days;
ClearUpperFlags();
UpdateDewfordTrendPerDay(daysSince);
UpdateTVShowsPerDay(daysSince);
UpdateWeatherPerDay(daysSince);
UpdatePartyPokerusTime(daysSince);
UpdateMirageRnd(daysSince);
UpdateBirchState(daysSince);
UpdateFrontierManiac(daysSince);
UpdateFrontierGambler(daysSince);
SetShoalItemFlag(daysSince);
SetRandomLotteryNumber(daysSince);
*days = localTime->days;
}
}
static void UpdatePerMinute(struct Time *localTime)
{
struct Time difference;
int minutes;
CalcTimeDifference(&difference, &gSaveBlock2Ptr->lastBerryTreeUpdate, localTime);
minutes = 24 * 60 * difference.days + 60 * difference.hours + difference.minutes;
if (minutes != 0)
{
if (minutes >= 0)
{
BerryTreeTimeUpdate(minutes);
gSaveBlock2Ptr->lastBerryTreeUpdate = *localTime;
}
}
}
static void ReturnFromStartWallClock(void)
{
InitTimeBasedEvents();
SetMainCallback2(c2_exit_to_overworld_1_continue_scripts_restart_music);
}
void StartWallClock(void)
{
SetMainCallback2(Cb2_StartWallClock);
gMain.savedCallback = ReturnFromStartWallClock;
}

View File

@@ -58,7 +58,7 @@ extern const u8 gText_HatchedFromEgg[];
extern const u8 gText_NickHatchPrompt[];
extern u8 sav1_map_get_name(void);
extern s8 sub_8198C58(void);
extern s8 ProcessMenuInputNoWrap_(void);
extern void TVShowConvertInternationalString(u8* str1, u8* str2, u8);
extern void sub_806A068(u16, u8);
extern void fade_screen(u8, u8);
@@ -669,7 +669,7 @@ static void CB2_EggHatch_1(void)
}
break;
case 10:
switch (sub_8198C58())
switch (ProcessMenuInputNoWrap_())
{
case 0:
GetMonNick(&gPlayerParty[sEggHatchData->eggPartyID], gStringVar3);

View File

@@ -1168,7 +1168,7 @@ static void Task_TradeEvolutionScene(u8 taskID)
}
break;
case 4:
switch (sub_8198C58())
switch (ProcessMenuInputNoWrap_())
{
case 0:
sEvoCursorPos = 0;

View File

@@ -265,7 +265,7 @@ static void Task_StarterChoose5(u8 taskId)
{
u8 spriteId;
switch (sub_8198C58())
switch (ProcessMenuInputNoWrap_())
{
case 0: // YES
// Return the starter choice and exit.

View File

@@ -1793,7 +1793,7 @@ void EndMassOutbreak(void)
gSaveBlock1Ptr->outbreakDaysLeft = 0;
}
void sub_80ED888(u16 days)
void UpdateTVShowsPerDay(u16 days)
{
sub_80ED8B4(days);

1057
src/wallclock.c Normal file

File diff suppressed because it is too large Load Diff