field screen review changes

This commit is contained in:
DizzyEggg 2018-12-09 12:16:01 +01:00
parent 4683cdc30c
commit c46499b05c
4 changed files with 32 additions and 32 deletions

View File

@ -1083,9 +1083,9 @@ static void sub_80B028C(u8 a1)
u16 color[1]; u16 color[1];
if (!a1) if (!a1)
color[0] = 0x1F; color[0] = RGB_RED;
else else
color[0] = 0x7C00; color[0] = RGB_BLUE;
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
{ {
@ -1113,7 +1113,7 @@ static bool8 sub_80B02C8(u16 a1)
} }
} }
SetGpuReg(REG_OFFSET_BLDALPHA, (hi << 8) | lo); SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(lo, hi));
if (lo == 0 && hi == 0x10) if (lo == 0 && hi == 0x10)
return TRUE; return TRUE;
@ -1135,9 +1135,9 @@ static void sub_80B0318(u8 taskId)
data[10] = REG_WINOUT; data[10] = REG_WINOUT;
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN1_ON); ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN1_ON);
SetGpuRegBits(REG_OFFSET_BLDCNT, gUnknown_82EC7CC[0]); SetGpuRegBits(REG_OFFSET_BLDCNT, gUnknown_82EC7CC[0]);
SetGpuReg(REG_OFFSET_BLDALPHA, 1804); SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(12, 7));
SetGpuReg(REG_OFFSET_WININ, 63); SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR);
SetGpuReg(REG_OFFSET_WINOUT, 30); SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ);
sub_8199C30(0, 0, 0, 0x1E, 0x14, 0xF); sub_8199C30(0, 0, 0, 0x1E, 0x14, 0xF);
schedule_bg_copy_tilemap_to_vram(0); schedule_bg_copy_tilemap_to_vram(0);
SetFlash2ScanlineEffectWindowBoundaries(&gScanlineEffectRegBuffers[0][0], data[2], data[3], 1); SetFlash2ScanlineEffectWindowBoundaries(&gScanlineEffectRegBuffers[0][0], data[2], data[3], 1);

View File

@ -75,7 +75,7 @@ IWRAM_DATA static const u8 *sPaletteGammaTypes;
// CONST // CONST
extern const u16 gUnknown_0854014C[][4096]; extern const u16 gUnknown_0854014C[][4096];
// This is a pointer to gWeatherPtr. All code in this file accesses gWeather directly, // This is a pointer to gWeather. All code in this file accesses gWeather directly,
// while code in other field weather files accesses gWeather through this pointer. // while code in other field weather files accesses gWeather through this pointer.
// This is likely the result of compiler optimization, since using the pointer in // This is likely the result of compiler optimization, since using the pointer in
// this file produces the same result as accessing gWeather directly. // this file produces the same result as accessing gWeather directly.
@ -266,11 +266,11 @@ static u8 None_Finish(void)
static void BuildGammaShiftTables(void) static void BuildGammaShiftTables(void)
{ {
u16 v0; u16 v0;
u8 (*v1)[32]; u8 (*gammaTable)[32];
u16 v2; u16 v2;
u16 v4; u16 v4;
u16 v5; u16 v5;
u16 v6; u16 gammaIndex;
u16 v9; u16 v9;
u32 v10; u32 v10;
u16 v11; u16 v11;
@ -280,9 +280,9 @@ static void BuildGammaShiftTables(void)
for (v0 = 0; v0 <= 1; v0++) for (v0 = 0; v0 <= 1; v0++)
{ {
if (v0 == 0) if (v0 == 0)
v1 = gWeatherPtr->gammaShifts; gammaTable = gWeatherPtr->gammaShifts;
else else
v1 = gWeatherPtr->altGammaShifts; gammaTable = gWeatherPtr->altGammaShifts;
for (v2 = 0; v2 < 32; v2++) for (v2 = 0; v2 < 32; v2++)
{ {
@ -291,10 +291,10 @@ static void BuildGammaShiftTables(void)
v5 = (v2 << 8) / 16; v5 = (v2 << 8) / 16;
else else
v5 = 0; v5 = 0;
for (v6 = 0; v6 <= 2; v6++) for (gammaIndex = 0; gammaIndex <= 2; gammaIndex++)
{ {
v4 = (v4 - v5); v4 = (v4 - v5);
v1[v6][v2] = v4 >> 8; gammaTable[gammaIndex][v2] = v4 >> 8;
} }
v9 = v4; v9 = v4;
v10 = 0x1f00 - v4; v10 = 0x1f00 - v4;
@ -305,25 +305,25 @@ static void BuildGammaShiftTables(void)
v11 = v10 >> 4; v11 = v10 >> 4;
if (v2 < 12) if (v2 < 12)
{ {
for (; v6 < 19; v6++) for (; gammaIndex < 19; gammaIndex++)
{ {
v4 += v11; v4 += v11;
dunno = v4 - v9; dunno = v4 - v9;
if (dunno > 0) if (dunno > 0)
v4 -= (dunno + ((u16)dunno >> 15)) >> 1; v4 -= (dunno + ((u16)dunno >> 15)) >> 1;
v1[v6][v2] = v4 >> 8; gammaTable[gammaIndex][v2] = v4 >> 8;
if (v1[v6][v2] > 0x1f) if (gammaTable[gammaIndex][v2] > 0x1f)
v1[v6][v2] = 0x1f; gammaTable[gammaIndex][v2] = 0x1f;
} }
} }
else else
{ {
for (; v6 < 19; v6++) for (; gammaIndex < 19; gammaIndex++)
{ {
v4 += v11; v4 += v11;
v1[v6][v2] = v4 >> 8; gammaTable[gammaIndex][v2] = v4 >> 8;
if (v1[v6][v2] > 0x1f) if (gammaTable[gammaIndex][v2] > 0x1f)
v1[v6][v2] = 0x1f; gammaTable[gammaIndex][v2] = 0x1f;
} }
} }
} }
@ -734,19 +734,19 @@ void FadeScreen(u8 mode, s8 delay)
switch (mode) switch (mode)
{ {
case FADE_FROM_BLACK: case FADE_FROM_BLACK:
fadeColor = 0; fadeColor = RGB_BLACK;
fadeOut = FALSE; fadeOut = FALSE;
break; break;
case FADE_FROM_WHITE: case FADE_FROM_WHITE:
fadeColor = 0xFFFF; fadeColor = RGB_WHITEALPHA;
fadeOut = FALSE; fadeOut = FALSE;
break; break;
case FADE_TO_BLACK: case FADE_TO_BLACK:
fadeColor = 0; fadeColor = RGB_BLACK;
fadeOut = TRUE; fadeOut = TRUE;
break; break;
case FADE_TO_WHITE: case FADE_TO_WHITE:
fadeColor = 0xFFFF; fadeColor = RGB_WHITEALPHA;
fadeOut = TRUE; fadeOut = TRUE;
break; break;
default: default:

View File

@ -182,7 +182,7 @@ void CreateCloudSprites(void)
{ {
u8 spriteId = CreateSprite(&sCloudSpriteTemplate, 0, 0, 0xFF); u8 spriteId = CreateSprite(&sCloudSpriteTemplate, 0, 0, 0xFF);
if (spriteId != 64) if (spriteId != MAX_SPRITES)
{ {
struct Sprite *sprite; struct Sprite *sprite;
@ -794,7 +794,7 @@ bool8 CreateRainSprite(void)
spriteNum = gWeatherPtr->rainSpriteCount; spriteNum = gWeatherPtr->rainSpriteCount;
spriteId = CreateSpriteAtEnd(&sRainSpriteTemplate, spriteId = CreateSpriteAtEnd(&sRainSpriteTemplate,
sRainSpriteCoords[spriteNum].x, sRainSpriteCoords[spriteNum].y, 78); sRainSpriteCoords[spriteNum].x, sRainSpriteCoords[spriteNum].y, 78);
if (spriteId != 64) if (spriteId != MAX_SPRITES)
{ {
gSprites[spriteId].data[5] = 0; gSprites[spriteId].data[5] = 0;
gSprites[spriteId].data[1] = spriteNum * 145; gSprites[spriteId].data[1] = spriteNum * 145;
@ -953,7 +953,7 @@ bool8 CreateSnowflakeSprite(void)
{ {
u8 spriteId = CreateSpriteAtEnd(&sSnowflakeSpriteTemplate, 0, 0, 78); u8 spriteId = CreateSpriteAtEnd(&sSnowflakeSpriteTemplate, 0, 0, 78);
if (spriteId == 64) if (spriteId == MAX_SPRITES)
return FALSE; return FALSE;
gSprites[spriteId].data[4] = gWeatherPtr->snowflakeSpriteCount; gSprites[spriteId].data[4] = gWeatherPtr->snowflakeSpriteCount;
sub_807EC40(&gSprites[spriteId]); sub_807EC40(&gSprites[spriteId]);
@ -1015,7 +1015,7 @@ void sub_807ED48(struct Sprite *sprite)
r3 = (sprite->pos1.x + sprite->centerToCornerVecX + gSpriteCoordOffsetX) & 0x1FF; r3 = (sprite->pos1.x + sprite->centerToCornerVecX + gSpriteCoordOffsetX) & 0x1FF;
if (r3 & 0x100) if (r3 & 0x100)
r3 = -0x100 | r3; // hmm... what is this? r3 |= -0x100; // hmm... what is this?
if (r3 < -3) if (r3 < -3)
sprite->pos1.x = 242 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX); sprite->pos1.x = 242 - (gSpriteCoordOffsetX + sprite->centerToCornerVecX);
else if (r3 > 242) else if (r3 > 242)
@ -2034,7 +2034,7 @@ void CreateSandstormSprites_2(void)
{ {
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)
{ {
u8 spriteId = CreateSpriteAtEnd(&sSandstormSpriteTemplate, i * 48 + 0x18, 0xD0, 1); u8 spriteId = CreateSpriteAtEnd(&sSandstormSpriteTemplate, i * 48 + 24, 208, 1);
if (spriteId != MAX_SPRITES) if (spriteId != MAX_SPRITES)
{ {