Document drought weather effect
This commit is contained in:
+11
-11
@@ -35,8 +35,8 @@ struct Weather
|
|||||||
u8 fadeScreenCounter;
|
u8 fadeScreenCounter;
|
||||||
bool8 readyForInit;
|
bool8 readyForInit;
|
||||||
u8 taskId;
|
u8 taskId;
|
||||||
u8 unknown_6CA;
|
u8 fade_in_active;
|
||||||
u8 unknown_6CB;
|
u8 fade_in_counter;
|
||||||
u16 initStep;
|
u16 initStep;
|
||||||
u16 finishStep;
|
u16 finishStep;
|
||||||
u8 currWeather;
|
u8 currWeather;
|
||||||
@@ -100,10 +100,10 @@ struct Weather
|
|||||||
u8 blendUpdateCounter;
|
u8 blendUpdateCounter;
|
||||||
u8 blendFrameCounter;
|
u8 blendFrameCounter;
|
||||||
u8 blendDelay;
|
u8 blendDelay;
|
||||||
s16 unknown_73C;
|
s16 droughtBrightnessStage;
|
||||||
s16 unknown_73E;
|
s16 droughtLastBrightnessStage;
|
||||||
s16 unknown_740;
|
s16 droughtTimer;
|
||||||
s16 unknown_742;
|
s16 droughtState;
|
||||||
u8 filler_744[0xD-4];
|
u8 filler_744[0xD-4];
|
||||||
s8 loadDroughtPalsIndex;
|
s8 loadDroughtPalsIndex;
|
||||||
u8 loadDroughtPalsOffset;
|
u8 loadDroughtPalsOffset;
|
||||||
@@ -123,7 +123,7 @@ void SlightlyDarkenPalsInWeather(u16 *, u16 *, u32);
|
|||||||
void PlayRainStoppingSoundEffect(void);
|
void PlayRainStoppingSoundEffect(void);
|
||||||
bool8 IsWeatherNotFadingIn(void);
|
bool8 IsWeatherNotFadingIn(void);
|
||||||
void SetWeatherScreenFadeOut(void);
|
void SetWeatherScreenFadeOut(void);
|
||||||
void sub_807B070(void);
|
void WeatherProcessingIdle(void);
|
||||||
u8 GetCurrentWeather(void);
|
u8 GetCurrentWeather(void);
|
||||||
void delay(u8, u8, u32);
|
void delay(u8, u8, u32);
|
||||||
void UpdateSpritePaletteWithWeather(u8 palIdx);
|
void UpdateSpritePaletteWithWeather(u8 palIdx);
|
||||||
@@ -138,11 +138,11 @@ bool8 Weather_UpdateBlend(void);
|
|||||||
void LoadCustomWeatherSpritePalette(const u16 *palette);
|
void LoadCustomWeatherSpritePalette(const u16 *palette);
|
||||||
void ResetDroughtWeatherPaletteLoading(void);
|
void ResetDroughtWeatherPaletteLoading(void);
|
||||||
bool8 LoadDroughtWeatherPalettes(void);
|
bool8 LoadDroughtWeatherPalettes(void);
|
||||||
void sub_807AC60(void);
|
void DroughtStateInit(void);
|
||||||
void sub_807AC98(void);
|
void DroughtStateRun(void);
|
||||||
void SetRainStrengthFromSoundEffect(u16 soundEffect);
|
void SetRainStrengthFromSoundEffect(u16 soundEffect);
|
||||||
void sub_807A790(s8 gammaIndex);
|
void WeatherShiftGammaIfPalStateIdle(s8 gammaIndex);
|
||||||
void sub_807A7C4(u8 gammaIndex, u8 gammaTargetIndex, u8 gammaStepDelay);
|
void WeatherBeginGammaFade(u8 gammaIndex, u8 gammaTargetIndex, u8 gammaStepDelay);
|
||||||
void ApplyWeatherGammaShiftToPal(u8 paletteIndex);
|
void ApplyWeatherGammaShiftToPal(u8 paletteIndex);
|
||||||
void StartWeather(void);
|
void StartWeather(void);
|
||||||
void ResumePausedWeather(void);
|
void ResumePausedWeather(void);
|
||||||
|
|||||||
+1
-1
@@ -4330,7 +4330,7 @@ extern const u32 gSubstituteDollPal[];
|
|||||||
// ice
|
// ice
|
||||||
extern const u8 gWeatherFogHorizontalTiles[];
|
extern const u8 gWeatherFogHorizontalTiles[];
|
||||||
extern const u32 gBattleAnimFogTilemap[];
|
extern const u32 gBattleAnimFogTilemap[];
|
||||||
extern const u16 gUnknown_83C2CE0[];
|
extern const u16 gDefaultWeatherSpritePalette[];
|
||||||
|
|
||||||
// party_menu
|
// party_menu
|
||||||
extern const u32 gPartyMenuPokeball_Gfx[];
|
extern const u32 gPartyMenuPokeball_Gfx[];
|
||||||
|
|||||||
+48
-45
@@ -43,7 +43,7 @@ struct WeatherCallbacks
|
|||||||
static EWRAM_DATA struct Weather sWeather = {};
|
static EWRAM_DATA struct Weather sWeather = {};
|
||||||
static EWRAM_DATA u8 sFieldEffectPaletteGammaTypes[32] = {};
|
static EWRAM_DATA u8 sFieldEffectPaletteGammaTypes[32] = {};
|
||||||
static EWRAM_DATA const u8 *sPaletteGammaTypes = NULL;
|
static EWRAM_DATA const u8 *sPaletteGammaTypes = NULL;
|
||||||
static EWRAM_DATA u16 gUnknown_20386A8 = 0;
|
static EWRAM_DATA u16 sDroughtFrameDelay = 0;
|
||||||
|
|
||||||
static void Task_WeatherMain(u8 taskId);
|
static void Task_WeatherMain(u8 taskId);
|
||||||
static void Task_WeatherInit(u8 taskId);
|
static void Task_WeatherInit(u8 taskId);
|
||||||
@@ -127,7 +127,7 @@ static const u8 sBasePaletteGammaTypes[32] = {
|
|||||||
GAMMA_NORMAL,
|
GAMMA_NORMAL,
|
||||||
};
|
};
|
||||||
|
|
||||||
const u16 gUnknown_83C2CE0[] = INCBIN_U16("graphics/field_effects/unk_83C2CE0.gbapal");
|
const u16 gDefaultWeatherSpritePalette[] = INCBIN_U16("graphics/field_effects/unk_83C2CE0.gbapal");
|
||||||
const u16 gCloudsWeatherPalette[] = INCBIN_U16("graphics/weather/cloud.gbapal");
|
const u16 gCloudsWeatherPalette[] = INCBIN_U16("graphics/weather/cloud.gbapal");
|
||||||
const u16 gSandstormWeatherPalette[] = INCBIN_U16("graphics/weather/sandstorm.gbapal");
|
const u16 gSandstormWeatherPalette[] = INCBIN_U16("graphics/weather/sandstorm.gbapal");
|
||||||
const u8 gWeatherFogDiagonalTiles[] = INCBIN_U8("graphics/weather/fog_diagonal.4bpp");
|
const u8 gWeatherFogDiagonalTiles[] = INCBIN_U8("graphics/weather/fog_diagonal.4bpp");
|
||||||
@@ -146,7 +146,7 @@ void StartWeather(void)
|
|||||||
if (!FuncIsActiveTask(Task_WeatherMain))
|
if (!FuncIsActiveTask(Task_WeatherMain))
|
||||||
{
|
{
|
||||||
u8 index = AllocSpritePalette(0x1200);
|
u8 index = AllocSpritePalette(0x1200);
|
||||||
CpuCopy32(gUnknown_83C2CE0, &gPlttBufferUnfaded[0x100 + index * 16], 32);
|
CpuCopy32(gDefaultWeatherSpritePalette, &gPlttBufferUnfaded[0x100 + index * 16], 32);
|
||||||
ApplyGlobalFieldPaletteTint(index);
|
ApplyGlobalFieldPaletteTint(index);
|
||||||
BuildGammaShiftTables();
|
BuildGammaShiftTables();
|
||||||
gWeatherPtr->altGammaSpritePalIndex = index;
|
gWeatherPtr->altGammaSpritePalIndex = index;
|
||||||
@@ -350,8 +350,8 @@ static void UpdateWeatherGammaShift(void)
|
|||||||
|
|
||||||
static void FadeInScreenWithWeather(void)
|
static void FadeInScreenWithWeather(void)
|
||||||
{
|
{
|
||||||
if (++gWeatherPtr->unknown_6CB > 1)
|
if (++gWeatherPtr->fade_in_counter > 1)
|
||||||
gWeatherPtr->unknown_6CA = 0;
|
gWeatherPtr->fade_in_active = 0;
|
||||||
|
|
||||||
switch (gWeatherPtr->currWeather)
|
switch (gWeatherPtr->currWeather)
|
||||||
{
|
{
|
||||||
@@ -692,7 +692,7 @@ static bool8 LightenSpritePaletteInFog(u8 paletteIndex)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_807A790(s8 gammaIndex)
|
void WeatherShiftGammaIfPalStateIdle(s8 gammaIndex)
|
||||||
{
|
{
|
||||||
if (gWeatherPtr->palProcessingState == WEATHER_PAL_STATE_IDLE)
|
if (gWeatherPtr->palProcessingState == WEATHER_PAL_STATE_IDLE)
|
||||||
{
|
{
|
||||||
@@ -701,7 +701,7 @@ void sub_807A790(s8 gammaIndex)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_807A7C4(u8 gammaIndex, u8 gammaTargetIndex, u8 gammaStepDelay)
|
void WeatherBeginGammaFade(u8 gammaIndex, u8 gammaTargetIndex, u8 gammaStepDelay)
|
||||||
{
|
{
|
||||||
if (gWeatherPtr->palProcessingState == WEATHER_PAL_STATE_IDLE)
|
if (gWeatherPtr->palProcessingState == WEATHER_PAL_STATE_IDLE)
|
||||||
{
|
{
|
||||||
@@ -710,7 +710,7 @@ void sub_807A7C4(u8 gammaIndex, u8 gammaTargetIndex, u8 gammaStepDelay)
|
|||||||
gWeatherPtr->gammaTargetIndex = gammaTargetIndex;
|
gWeatherPtr->gammaTargetIndex = gammaTargetIndex;
|
||||||
gWeatherPtr->gammaStepFrameCounter = 0;
|
gWeatherPtr->gammaStepFrameCounter = 0;
|
||||||
gWeatherPtr->gammaStepDelay = gammaStepDelay;
|
gWeatherPtr->gammaStepDelay = gammaStepDelay;
|
||||||
sub_807A790(gammaIndex);
|
WeatherShiftGammaIfPalStateIdle(gammaIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -761,7 +761,7 @@ void FadeScreen(u8 mode, s8 delay)
|
|||||||
if (fadeOut)
|
if (fadeOut)
|
||||||
{
|
{
|
||||||
if (useWeatherPal)
|
if (useWeatherPal)
|
||||||
CpuFastCopy(gPlttBufferFaded, gPlttBufferUnfaded, 0x400);
|
CpuFastCopy(gPlttBufferFaded, gPlttBufferUnfaded, PLTT_SIZE);
|
||||||
|
|
||||||
BeginNormalPaletteFade(0xFFFFFFFF, delay, 0, 16, fadeColor);
|
BeginNormalPaletteFade(0xFFFFFFFF, delay, 0, 16, fadeColor);
|
||||||
gWeatherPtr->palProcessingState = WEATHER_PAL_STATE_SCREEN_FADING_OUT;
|
gWeatherPtr->palProcessingState = WEATHER_PAL_STATE_SCREEN_FADING_OUT;
|
||||||
@@ -775,8 +775,8 @@ void FadeScreen(u8 mode, s8 delay)
|
|||||||
BeginNormalPaletteFade(0xFFFFFFFF, delay, 16, 0, fadeColor);
|
BeginNormalPaletteFade(0xFFFFFFFF, delay, 16, 0, fadeColor);
|
||||||
|
|
||||||
gWeatherPtr->palProcessingState = WEATHER_PAL_STATE_SCREEN_FADING_IN;
|
gWeatherPtr->palProcessingState = WEATHER_PAL_STATE_SCREEN_FADING_IN;
|
||||||
gWeatherPtr->unknown_6CA = 1;
|
gWeatherPtr->fade_in_active = 1;
|
||||||
gWeatherPtr->unknown_6CB = 0;
|
gWeatherPtr->fade_in_counter = 0;
|
||||||
Weather_SetBlendCoeffs(gWeatherPtr->currBlendEVA, gWeatherPtr->currBlendEVB);
|
Weather_SetBlendCoeffs(gWeatherPtr->currBlendEVA, gWeatherPtr->currBlendEVB);
|
||||||
gWeatherPtr->readyForInit = TRUE;
|
gWeatherPtr->readyForInit = TRUE;
|
||||||
}
|
}
|
||||||
@@ -843,8 +843,8 @@ void FadeSelectedPals(u8 mode, s8 delay, u32 selectedPalettes)
|
|||||||
BeginNormalPaletteFade(selectedPalettes, delay, 16, 0, fadeColor);
|
BeginNormalPaletteFade(selectedPalettes, delay, 16, 0, fadeColor);
|
||||||
|
|
||||||
gWeatherPtr->palProcessingState = WEATHER_PAL_STATE_SCREEN_FADING_IN;
|
gWeatherPtr->palProcessingState = WEATHER_PAL_STATE_SCREEN_FADING_IN;
|
||||||
gWeatherPtr->unknown_6CA = 1;
|
gWeatherPtr->fade_in_active = 1;
|
||||||
gWeatherPtr->unknown_6CB = 0;
|
gWeatherPtr->fade_in_counter = 0;
|
||||||
Weather_SetBlendCoeffs(gWeatherPtr->currBlendEVA, gWeatherPtr->currBlendEVB);
|
Weather_SetBlendCoeffs(gWeatherPtr->currBlendEVA, gWeatherPtr->currBlendEVB);
|
||||||
gWeatherPtr->readyForInit = TRUE;
|
gWeatherPtr->readyForInit = TRUE;
|
||||||
}
|
}
|
||||||
@@ -864,7 +864,7 @@ void UpdateSpritePaletteWithWeather(u8 spritePaletteIndex)
|
|||||||
switch (gWeatherPtr->palProcessingState)
|
switch (gWeatherPtr->palProcessingState)
|
||||||
{
|
{
|
||||||
case WEATHER_PAL_STATE_SCREEN_FADING_IN:
|
case WEATHER_PAL_STATE_SCREEN_FADING_IN:
|
||||||
if (gWeatherPtr->unknown_6CA != 0)
|
if (gWeatherPtr->fade_in_active != 0)
|
||||||
{
|
{
|
||||||
if (gWeatherPtr->currWeather == WEATHER_FOG_HORIZONTAL)
|
if (gWeatherPtr->currWeather == WEATHER_FOG_HORIZONTAL)
|
||||||
MarkFogSpritePalToLighten(paletteIndex);
|
MarkFogSpritePalToLighten(paletteIndex);
|
||||||
@@ -899,10 +899,10 @@ void ApplyWeatherGammaShiftToPal(u8 paletteIndex)
|
|||||||
ApplyGammaShift(paletteIndex, 1, gWeatherPtr->gammaIndex);
|
ApplyGammaShift(paletteIndex, 1, gWeatherPtr->gammaIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 sub_80ABF20(void)
|
static u8 IsWeatherFadingIn(void)
|
||||||
{
|
{
|
||||||
if (gWeatherPtr->palProcessingState == WEATHER_PAL_STATE_SCREEN_FADING_IN)
|
if (gWeatherPtr->palProcessingState == WEATHER_PAL_STATE_SCREEN_FADING_IN)
|
||||||
return gWeatherPtr->unknown_6CA;
|
return gWeatherPtr->fade_in_active;
|
||||||
else
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -937,51 +937,54 @@ bool8 LoadDroughtWeatherPalettes(void)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_807AC50(s8 gammaIndex)
|
static void SetDroughtGamma(s8 gammaIndex)
|
||||||
{
|
{
|
||||||
sub_807A790(-gammaIndex - 1);
|
WeatherShiftGammaIfPalStateIdle(-gammaIndex - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_807AC60(void)
|
void DroughtStateInit(void)
|
||||||
{
|
{
|
||||||
gWeatherPtr->unknown_73C = 0;
|
gWeatherPtr->droughtBrightnessStage = 0;
|
||||||
gWeatherPtr->unknown_740 = 0;
|
gWeatherPtr->droughtTimer = 0;
|
||||||
gWeatherPtr->unknown_742 = 0;
|
gWeatherPtr->droughtState = 0;
|
||||||
gWeatherPtr->unknown_73E = 0;
|
gWeatherPtr->droughtLastBrightnessStage = 0;
|
||||||
gUnknown_20386A8 = 5;
|
sDroughtFrameDelay = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_807AC98(void)
|
void DroughtStateRun(void)
|
||||||
{
|
{
|
||||||
switch (gWeatherPtr->unknown_742)
|
switch (gWeatherPtr->droughtState)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
if (++gWeatherPtr->unknown_740 > gUnknown_20386A8)
|
// Ramp up
|
||||||
|
if (++gWeatherPtr->droughtTimer > sDroughtFrameDelay)
|
||||||
{
|
{
|
||||||
gWeatherPtr->unknown_740 = 0;
|
gWeatherPtr->droughtTimer = 0;
|
||||||
sub_807AC50(gWeatherPtr->unknown_73C++);
|
SetDroughtGamma(gWeatherPtr->droughtBrightnessStage++);
|
||||||
if (gWeatherPtr->unknown_73C > 5)
|
if (gWeatherPtr->droughtBrightnessStage > 5)
|
||||||
{
|
{
|
||||||
gWeatherPtr->unknown_73E = gWeatherPtr->unknown_73C;
|
gWeatherPtr->droughtLastBrightnessStage = gWeatherPtr->droughtBrightnessStage;
|
||||||
gWeatherPtr->unknown_742 = 1;
|
gWeatherPtr->droughtState = 1;
|
||||||
gWeatherPtr->unknown_740 = 0x3C;
|
gWeatherPtr->droughtTimer = 60;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
gWeatherPtr->unknown_740 = (gWeatherPtr->unknown_740 + 3) & 0x7F;
|
// Oscillate
|
||||||
gWeatherPtr->unknown_73C = ((gSineTable[gWeatherPtr->unknown_740] - 1) >> 6) + 2;
|
gWeatherPtr->droughtTimer = (gWeatherPtr->droughtTimer + 3) & 0x7F;
|
||||||
if (gWeatherPtr->unknown_73C != gWeatherPtr->unknown_73E)
|
gWeatherPtr->droughtBrightnessStage = ((gSineTable[gWeatherPtr->droughtTimer] - 1) >> 6) + 2;
|
||||||
sub_807AC50(gWeatherPtr->unknown_73C);
|
if (gWeatherPtr->droughtBrightnessStage != gWeatherPtr->droughtLastBrightnessStage)
|
||||||
gWeatherPtr->unknown_73E = gWeatherPtr->unknown_73C;
|
SetDroughtGamma(gWeatherPtr->droughtBrightnessStage);
|
||||||
|
gWeatherPtr->droughtLastBrightnessStage = gWeatherPtr->droughtBrightnessStage;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (++gWeatherPtr->unknown_740 > gUnknown_20386A8)
|
// Ramp down
|
||||||
|
if (++gWeatherPtr->droughtTimer > sDroughtFrameDelay)
|
||||||
{
|
{
|
||||||
gWeatherPtr->unknown_740 = 0;
|
gWeatherPtr->droughtTimer = 0;
|
||||||
sub_807AC50(--gWeatherPtr->unknown_73C);
|
SetDroughtGamma(--gWeatherPtr->droughtBrightnessStage);
|
||||||
if (gWeatherPtr->unknown_73C == 3)
|
if (gWeatherPtr->droughtBrightnessStage == 3)
|
||||||
gWeatherPtr->unknown_742 = 0;
|
gWeatherPtr->droughtState = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1042,7 +1045,7 @@ bool8 Weather_UpdateBlend(void)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_807AF00(u8 a)
|
UNUSED static void Unused_SetWeather(u8 a)
|
||||||
{
|
{
|
||||||
switch (a)
|
switch (a)
|
||||||
{
|
{
|
||||||
@@ -1137,7 +1140,7 @@ void SetWeatherScreenFadeOut(void)
|
|||||||
gWeatherPtr->palProcessingState = WEATHER_PAL_STATE_SCREEN_FADING_OUT;
|
gWeatherPtr->palProcessingState = WEATHER_PAL_STATE_SCREEN_FADING_OUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_807B070(void)
|
void WeatherProcessingIdle(void)
|
||||||
{
|
{
|
||||||
gWeatherPtr->palProcessingState = WEATHER_PAL_STATE_IDLE;
|
gWeatherPtr->palProcessingState = WEATHER_PAL_STATE_IDLE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -239,19 +239,19 @@ void Drought_Main(void)
|
|||||||
gWeatherPtr->initStep++;
|
gWeatherPtr->initStep++;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
sub_807AC60();
|
DroughtStateInit();
|
||||||
gWeatherPtr->initStep++;
|
gWeatherPtr->initStep++;
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
sub_807AC98();
|
DroughtStateRun();
|
||||||
if (gWeatherPtr->unknown_73C == 6)
|
if (gWeatherPtr->droughtBrightnessStage == 6)
|
||||||
{
|
{
|
||||||
gWeatherPtr->weatherGfxLoaded = TRUE;
|
gWeatherPtr->weatherGfxLoaded = TRUE;
|
||||||
gWeatherPtr->initStep++;
|
gWeatherPtr->initStep++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sub_807AC98();
|
DroughtStateRun();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1064,7 +1064,7 @@ void Thunderstorm_Main(void)
|
|||||||
gWeatherPtr->initStep++;
|
gWeatherPtr->initStep++;
|
||||||
// fall through
|
// fall through
|
||||||
case 8:
|
case 8:
|
||||||
sub_807A790(19);
|
WeatherShiftGammaIfPalStateIdle(19);
|
||||||
if (gWeatherPtr->unknown_6EB == 0 && gWeatherPtr->unknown_6EC == 1)
|
if (gWeatherPtr->unknown_6EB == 0 && gWeatherPtr->unknown_6EC == 1)
|
||||||
SetThunderCounter(20);
|
SetThunderCounter(20);
|
||||||
|
|
||||||
@@ -1074,7 +1074,7 @@ void Thunderstorm_Main(void)
|
|||||||
case 9:
|
case 9:
|
||||||
if (--gWeatherPtr->unknown_6E6 == 0)
|
if (--gWeatherPtr->unknown_6E6 == 0)
|
||||||
{
|
{
|
||||||
sub_807A790(3);
|
WeatherShiftGammaIfPalStateIdle(3);
|
||||||
gWeatherPtr->unknown_6EA = 1;
|
gWeatherPtr->unknown_6EA = 1;
|
||||||
if (--gWeatherPtr->unknown_6EC != 0)
|
if (--gWeatherPtr->unknown_6EC != 0)
|
||||||
{
|
{
|
||||||
@@ -1103,7 +1103,7 @@ void Thunderstorm_Main(void)
|
|||||||
if (--gWeatherPtr->unknown_6E6 == 0)
|
if (--gWeatherPtr->unknown_6E6 == 0)
|
||||||
{
|
{
|
||||||
SetThunderCounter(100);
|
SetThunderCounter(100);
|
||||||
sub_807A790(19);
|
WeatherShiftGammaIfPalStateIdle(19);
|
||||||
gWeatherPtr->unknown_6E6 = (Random() & 0xF) + 30;
|
gWeatherPtr->unknown_6E6 = (Random() & 0xF) + 30;
|
||||||
gWeatherPtr->initStep++;
|
gWeatherPtr->initStep++;
|
||||||
}
|
}
|
||||||
@@ -1111,7 +1111,7 @@ void Thunderstorm_Main(void)
|
|||||||
case 13:
|
case 13:
|
||||||
if (--gWeatherPtr->unknown_6E6 == 0)
|
if (--gWeatherPtr->unknown_6E6 == 0)
|
||||||
{
|
{
|
||||||
sub_807A7C4(19, 3, 5);
|
WeatherBeginGammaFade(19, 3, 5);
|
||||||
gWeatherPtr->initStep++;
|
gWeatherPtr->initStep++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
#include "wild_encounter.h"
|
#include "wild_encounter.h"
|
||||||
#include "constants/songs.h"
|
#include "constants/songs.h"
|
||||||
|
|
||||||
static EWRAM_DATA u8 *gUnknown_203AAB0 = NULL;
|
static EWRAM_DATA u8 *sPlttBufferBak = NULL;
|
||||||
|
|
||||||
static void FieldCallback_SweetScent(void);
|
static void FieldCallback_SweetScent(void);
|
||||||
static void StartSweetScentFieldEffect(void);
|
static void StartSweetScentFieldEffect(void);
|
||||||
@@ -51,9 +51,9 @@ static void StartSweetScentFieldEffect(void)
|
|||||||
u8 taskId;
|
u8 taskId;
|
||||||
|
|
||||||
PlaySE(SE_M_SWEET_SCENT);
|
PlaySE(SE_M_SWEET_SCENT);
|
||||||
gUnknown_203AAB0 = (u8 *)Alloc(0x400);
|
sPlttBufferBak = (u8 *)Alloc(PLTT_SIZE);
|
||||||
CpuFastSet(gPlttBufferUnfaded, gUnknown_203AAB0, 0x100);
|
CpuFastCopy(gPlttBufferUnfaded, sPlttBufferBak, PLTT_SIZE);
|
||||||
CpuFastSet(gPlttBufferFaded, gPlttBufferUnfaded, 0x100);
|
CpuFastCopy(gPlttBufferFaded, gPlttBufferUnfaded, PLTT_SIZE);
|
||||||
BeginNormalPaletteFade(~(1 << (gSprites[GetPlayerAvatarObjectId()].oam.paletteNum + 16)), 4, 0, 8, RGB(31, 0, 0));
|
BeginNormalPaletteFade(~(1 << (gSprites[GetPlayerAvatarObjectId()].oam.paletteNum + 16)), 4, 0, 8, RGB(31, 0, 0));
|
||||||
taskId = CreateTask(TrySweetScentEncounter, 0);
|
taskId = CreateTask(TrySweetScentEncounter, 0);
|
||||||
gTasks[taskId].data[0] = 0;
|
gTasks[taskId].data[0] = 0;
|
||||||
@@ -71,7 +71,7 @@ static void TrySweetScentEncounter(u8 taskId)
|
|||||||
data[0] = 0;
|
data[0] = 0;
|
||||||
if (SweetScentWildEncounter() == TRUE)
|
if (SweetScentWildEncounter() == TRUE)
|
||||||
{
|
{
|
||||||
Free(gUnknown_203AAB0);
|
Free(sPlttBufferBak);
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -91,9 +91,9 @@ static void FailSweetScentEncounter(u8 taskId)
|
|||||||
{
|
{
|
||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
{
|
{
|
||||||
CpuFastSet(gUnknown_203AAB0, gPlttBufferUnfaded, 0x100);
|
CpuFastCopy(sPlttBufferBak, gPlttBufferUnfaded, PLTT_SIZE);
|
||||||
sub_807B070();
|
WeatherProcessingIdle();
|
||||||
Free(gUnknown_203AAB0);
|
Free(sPlttBufferBak);
|
||||||
ScriptContext1_SetupScript(EventScript_FailSweetScent);
|
ScriptContext1_SetupScript(EventScript_FailSweetScent);
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -944,7 +944,7 @@ void AnimTask_Haze1(u8 taskId)
|
|||||||
GetBattleAnimBg1Data(&animBg);
|
GetBattleAnimBg1Data(&animBg);
|
||||||
LoadBgTiles(animBg.bgId, gWeatherFogHorizontalTiles, 0x800, animBg.tilesOffset);
|
LoadBgTiles(animBg.bgId, gWeatherFogHorizontalTiles, 0x800, animBg.tilesOffset);
|
||||||
AnimLoadCompressedBgTilemap(animBg.bgId, gBattleAnimFogTilemap);
|
AnimLoadCompressedBgTilemap(animBg.bgId, gBattleAnimFogTilemap);
|
||||||
LoadPalette(&gUnknown_83C2CE0, animBg.paletteId * 16, 32);
|
LoadPalette(&gDefaultWeatherSpritePalette, animBg.paletteId * 16, 32);
|
||||||
if (IsContest())
|
if (IsContest())
|
||||||
sub_80730C0(animBg.paletteId, animBg.bgTilemap, 0, 0);
|
sub_80730C0(animBg.paletteId, animBg.bgTilemap, 0, 0);
|
||||||
gTasks[taskId].func = AnimTask_Haze2;
|
gTasks[taskId].func = AnimTask_Haze2;
|
||||||
@@ -1042,7 +1042,7 @@ void AnimTask_LoadMistTiles(u8 taskId)
|
|||||||
GetBattleAnimBg1Data(&animBg);
|
GetBattleAnimBg1Data(&animBg);
|
||||||
LoadBgTiles(animBg.bgId, gWeatherFogHorizontalTiles, 0x800, animBg.tilesOffset);
|
LoadBgTiles(animBg.bgId, gWeatherFogHorizontalTiles, 0x800, animBg.tilesOffset);
|
||||||
AnimLoadCompressedBgTilemap(animBg.bgId, gBattleAnimFogTilemap);
|
AnimLoadCompressedBgTilemap(animBg.bgId, gBattleAnimFogTilemap);
|
||||||
LoadPalette(&gUnknown_83C2CE0, animBg.paletteId * 16, 32);
|
LoadPalette(&gDefaultWeatherSpritePalette, animBg.paletteId * 16, 32);
|
||||||
if (IsContest())
|
if (IsContest())
|
||||||
sub_80730C0(animBg.paletteId, animBg.bgTilemap, 0, 0);
|
sub_80730C0(animBg.paletteId, animBg.bgTilemap, 0, 0);
|
||||||
gTasks[taskId].data[15] = -1;
|
gTasks[taskId].data[15] = -1;
|
||||||
|
|||||||
+5
-5
@@ -1283,7 +1283,7 @@ static void TeachyTvLoadMapTilesetToBuffer(struct Tileset *ts, u8 *dstBuffer, u1
|
|||||||
if (ts)
|
if (ts)
|
||||||
{
|
{
|
||||||
if (!ts->isCompressed)
|
if (!ts->isCompressed)
|
||||||
CpuFastSet(ts->tiles, dstBuffer, 8 * size);
|
CpuFastCopy(ts->tiles, dstBuffer, 0x20 * size);
|
||||||
else
|
else
|
||||||
LZDecompressWram(ts->tiles, dstBuffer);
|
LZDecompressWram(ts->tiles, dstBuffer);
|
||||||
}
|
}
|
||||||
@@ -1291,7 +1291,7 @@ static void TeachyTvLoadMapTilesetToBuffer(struct Tileset *ts, u8 *dstBuffer, u1
|
|||||||
|
|
||||||
static void TeachyTvPushBackNewMapPalIndexArrayEntry(const struct MapLayout *mStruct, u16 *buf1, u8 *palIndexArray, u16 mapEntry, u16 offset)
|
static void TeachyTvPushBackNewMapPalIndexArrayEntry(const struct MapLayout *mStruct, u16 *buf1, u8 *palIndexArray, u16 mapEntry, u16 offset)
|
||||||
{
|
{
|
||||||
u16 * metaTileEntryAddr = mapEntry <= 0x27F ? &((u16*)(mStruct->primaryTileset->metatiles))[8 * mapEntry] : &((u16*)(mStruct->secondaryTileset->metatiles))[8 * (mapEntry - 0x280)];
|
u16 * metaTileEntryAddr = mapEntry < 0x280 ? &((u16*)(mStruct->primaryTileset->metatiles))[8 * mapEntry] : &((u16*)(mStruct->secondaryTileset->metatiles))[8 * (mapEntry - 0x280)];
|
||||||
buf1[0] = (TeachyTvComputePalIndexArrayEntryByMetaTile(palIndexArray, metaTileEntryAddr[0]) << 12) + 4 * offset;
|
buf1[0] = (TeachyTvComputePalIndexArrayEntryByMetaTile(palIndexArray, metaTileEntryAddr[0]) << 12) + 4 * offset;
|
||||||
buf1[1] = (TeachyTvComputePalIndexArrayEntryByMetaTile(palIndexArray, metaTileEntryAddr[1]) << 12) + 4 * offset + 1;
|
buf1[1] = (TeachyTvComputePalIndexArrayEntryByMetaTile(palIndexArray, metaTileEntryAddr[1]) << 12) + 4 * offset + 1;
|
||||||
buf1[32] = (TeachyTvComputePalIndexArrayEntryByMetaTile(palIndexArray, metaTileEntryAddr[2]) << 12) + 4 * offset + 2;
|
buf1[32] = (TeachyTvComputePalIndexArrayEntryByMetaTile(palIndexArray, metaTileEntryAddr[2]) << 12) + 4 * offset + 2;
|
||||||
@@ -1316,7 +1316,7 @@ static void TeachyTvComputeSingleMapTileBlockFromTilesetAndMetaTiles(u8 *blockBu
|
|||||||
u8 i, j;
|
u8 i, j;
|
||||||
u8 * buffer = AllocZeroed(0x20);
|
u8 * buffer = AllocZeroed(0x20);
|
||||||
u8 * src = AllocZeroed(0x20);
|
u8 * src = AllocZeroed(0x20);
|
||||||
CpuFastSet(tileset, buffer, 8);
|
CpuFastCopy(tileset, buffer, 0x20);
|
||||||
if (metaTile & 1)
|
if (metaTile & 1)
|
||||||
{
|
{
|
||||||
for (i = 0; i < 8; ++i)
|
for (i = 0; i < 8; ++i)
|
||||||
@@ -1328,13 +1328,13 @@ static void TeachyTvComputeSingleMapTileBlockFromTilesetAndMetaTiles(u8 *blockBu
|
|||||||
src[(i << 2) + j] = ((value & 0xF) << 4) + ((value & 0xF0) >> 4);
|
src[(i << 2) + j] = ((value & 0xF) << 4) + ((value & 0xF0) >> 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CpuFastSet(src, buffer, 8);
|
CpuFastCopy(src, buffer, 0x20);
|
||||||
}
|
}
|
||||||
if (metaTile & 2)
|
if (metaTile & 2)
|
||||||
{
|
{
|
||||||
for (i = 0; i < 8; ++i)
|
for (i = 0; i < 8; ++i)
|
||||||
memcpy(&src[4 * i], &buffer[4 * (7 - i)], 4);
|
memcpy(&src[4 * i], &buffer[4 * (7 - i)], 4);
|
||||||
CpuFastSet(src, buffer, 8);
|
CpuFastCopy(src, buffer, 0x20);
|
||||||
}
|
}
|
||||||
for (i = 0; i < 32; ++i)
|
for (i = 0; i < 32; ++i)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user