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