More DISPLAY_WIDTH/HEIGHT constant usage

This commit is contained in:
GriffinR 2023-08-10 01:42:38 -04:00
parent 18319e8da3
commit d5d46bb438
15 changed files with 62 additions and 65 deletions

View File

@ -3578,13 +3578,13 @@ static void AnimFlyingParticle(struct Sprite *sprite)
{
sprite->data[4] = 0;
sprite->data[2] = gBattleAnimArgs[3];
sprite->x = 0xFFF0;
sprite->x = -16;
}
else
{
sprite->data[4] = 1;
sprite->data[2] = -gBattleAnimArgs[3];
sprite->x = 0x100;
sprite->x = DISPLAY_WIDTH + 16;
}
sprite->data[1] = gBattleAnimArgs[1];
@ -3623,7 +3623,7 @@ static void AnimFlyingParticle_Step(struct Sprite *sprite)
sprite->data[0] = (sprite->data[3] * a) & 0xFF;
if (!sprite->data[4])
{
if (sprite->x2 + sprite->x <= 0xF7)
if (sprite->x2 + sprite->x < DISPLAY_WIDTH + 8)
return;
}
else

View File

@ -3056,7 +3056,7 @@ static void AnimFlatterConfetti(struct Sprite *sprite)
if (sprite->data[2] == ANIM_ATTACKER)
sprite->x = -8;
else
sprite->x = 248;
sprite->x = DISPLAY_WIDTH + 8;
sprite->y = 104;
sprite->callback = AnimFlatterConfetti_Step;
@ -3414,8 +3414,8 @@ static void AnimTask_AcidArmor_Step(u8 taskId)
var0 *= 2;
while (var0 >= 0)
{
gScanlineEffectRegBuffers[0][var0] = bgX + 240;
gScanlineEffectRegBuffers[1][var0] = bgX + 240;
gScanlineEffectRegBuffers[0][var0] = bgX + DISPLAY_WIDTH;
gScanlineEffectRegBuffers[1][var0] = bgX + DISPLAY_WIDTH;
var0 -= 2;
}

View File

@ -481,10 +481,10 @@ static void SetDigScanlineEffect(u8 useBG1, s16 y, s16 endY)
y++;
}
while (y < 160)
while (y < DISPLAY_HEIGHT)
{
gScanlineEffectRegBuffers[0][y] = bgX + 240;
gScanlineEffectRegBuffers[1][y] = bgX + 240;
gScanlineEffectRegBuffers[0][y] = bgX + DISPLAY_WIDTH;
gScanlineEffectRegBuffers[1][y] = bgX + DISPLAY_WIDTH;
y++;
}

View File

@ -1305,11 +1305,11 @@ static void MovePoisonGasCloud(struct Sprite *sprite)
sprite->data[3] = sprite->y += sprite->y2;
sprite->data[4] = sprite->y + 4;
if (IsContest())
sprite->data[2] = -0x10;
sprite->data[2] = -16;
else if (GET_BATTLER_SIDE2(gBattleAnimTarget) != B_SIDE_PLAYER)
sprite->data[2] = 0x100;
sprite->data[2] = DISPLAY_WIDTH + 16;
else
sprite->data[2] = -0x10;
sprite->data[2] = -16;
sprite->data[7]++;
sprite->x2 = sprite->y2 = 0;

View File

@ -2117,7 +2117,7 @@ void AnimTask_SwapMonSpriteToFromSubstitute(u8 taskId)
gTasks[taskId].data[0] &= 0xFF;
x = gSprites[spriteId].x + gSprites[spriteId].x2 + 32;
if (x > 304)
if (x > DISPLAY_WIDTH + 64)
gTasks[taskId].data[10]++;
break;
case 1:

View File

@ -182,7 +182,7 @@ static void BattleIntroSlide1(u8 taskId)
if ((gBattle_WIN0V & 0xFF00) == 0x3000)
{
gTasks[taskId].tState++;
gTasks[taskId].data[2] = 240;
gTasks[taskId].data[2] = DISPLAY_WIDTH;
gTasks[taskId].data[3] = 32;
gIntroSlideFlags &= ~1;
}
@ -213,13 +213,13 @@ static void BattleIntroSlide1(u8 taskId)
gTasks[taskId].data[2] -= 2;
// Scanline settings have already been set in CB2_InitBattleInternal()
for (i = 0; i < 80; i++)
for (i = 0; i < DISPLAY_HEIGHT / 2; i++)
gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = gTasks[taskId].data[2];
for (; i < 160; i++)
for (; i < DISPLAY_HEIGHT; i++)
gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = -gTasks[taskId].data[2];
if (!gTasks[taskId].data[2])
if (gTasks[taskId].data[2] == 0)
{
gScanlineEffect.state = 3;
gTasks[taskId].tState++;
@ -290,7 +290,7 @@ static void BattleIntroSlide2(u8 taskId)
if ((gBattle_WIN0V & 0xFF00) == 0x3000)
{
gTasks[taskId].tState++;
gTasks[taskId].data[2] = 240;
gTasks[taskId].data[2] = DISPLAY_WIDTH;
gTasks[taskId].data[3] = 32;
gTasks[taskId].data[5] = 1;
gIntroSlideFlags &= ~1;
@ -322,13 +322,13 @@ static void BattleIntroSlide2(u8 taskId)
gTasks[taskId].data[2] -= 2;
// Scanline settings have already been set in CB2_InitBattleInternal()
for (i = 0; i < 80; i++)
for (i = 0; i < DISPLAY_HEIGHT / 2; i++)
gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = gTasks[taskId].data[2];
for (; i < 160; i++)
for (; i < DISPLAY_HEIGHT; i++)
gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = -gTasks[taskId].data[2];
if (!gTasks[taskId].data[2])
if (gTasks[taskId].data[2] == 0)
{
gScanlineEffect.state = 3;
gTasks[taskId].tState++;
@ -383,7 +383,7 @@ static void BattleIntroSlide3(u8 taskId)
if ((gBattle_WIN0V & 0xFF00) == 0x3000)
{
gTasks[taskId].tState++;
gTasks[taskId].data[2] = 240;
gTasks[taskId].data[2] = DISPLAY_WIDTH;
gTasks[taskId].data[3] = 32;
gTasks[taskId].data[5] = 1;
gIntroSlideFlags &= ~1;
@ -410,13 +410,13 @@ static void BattleIntroSlide3(u8 taskId)
gTasks[taskId].data[2] -= 2;
// Scanline settings have already been set in CB2_InitBattleInternal()
for (i = 0; i < 80; i++)
for (i = 0; i < DISPLAY_HEIGHT / 2; i++)
gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = gTasks[taskId].data[2];
for (; i < 160; i++)
for (; i < DISPLAY_HEIGHT; i++)
gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = -gTasks[taskId].data[2];
if (!gTasks[taskId].data[2])
if (gTasks[taskId].data[2] == 0)
{
gScanlineEffect.state = 3;
gTasks[taskId].tState++;
@ -479,7 +479,7 @@ static void BattleIntroSlideLink(u8 taskId)
if ((gBattle_WIN0V & 0xFF00) == 0x3000)
{
gTasks[taskId].tState++;
gTasks[taskId].data[2] = 240;
gTasks[taskId].data[2] = DISPLAY_WIDTH;
gTasks[taskId].data[3] = 32;
gIntroSlideFlags &= ~1;
}
@ -492,13 +492,13 @@ static void BattleIntroSlideLink(u8 taskId)
gTasks[taskId].data[2] -= 2;
// Scanline settings have already been set in CB2_InitBattleInternal()
for (i = 0; i < 80; i++)
for (i = 0; i < DISPLAY_HEIGHT / 2; i++)
gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = gTasks[taskId].data[2];
for (; i < 160; i++)
for (; i < DISPLAY_HEIGHT; i++)
gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer][i] = -gTasks[taskId].data[2];
if (!gTasks[taskId].data[2])
if (gTasks[taskId].data[2] == 0)
{
gScanlineEffect.state = 3;
gTasks[taskId].tState++;
@ -544,7 +544,7 @@ static void BattleIntroSlidePartner(u8 taskId)
if ((gBattle_WIN0V & 0xFF00) == 0x2000)
{
gTasks[taskId].tState++;
gTasks[taskId].data[2] = 240;
gTasks[taskId].data[2] = DISPLAY_WIDTH;
gIntroSlideFlags &= ~1;
}
break;
@ -557,7 +557,7 @@ static void BattleIntroSlidePartner(u8 taskId)
gBattle_BG1_X = gTasks[taskId].data[2];
gBattle_BG2_X = -gTasks[taskId].data[2];
if (!gTasks[taskId].data[2])
if (gTasks[taskId].data[2] == 0)
gTasks[taskId].tState++;
break;
case 4:

View File

@ -644,19 +644,16 @@ static void CB2_InitBattleInternal(void)
gBattle_WIN0V = WIN_RANGE(DISPLAY_HEIGHT / 2, DISPLAY_HEIGHT / 2 + 1);
ScanlineEffect_Clear();
i = 0;
while (i < 80)
for (i = 0; i < DISPLAY_HEIGHT / 2; i++)
{
gScanlineEffectRegBuffers[0][i] = 0xF0;
gScanlineEffectRegBuffers[1][i] = 0xF0;
i++;
}
while (i < 160)
for (; i < DISPLAY_HEIGHT; i++)
{
gScanlineEffectRegBuffers[0][i] = 0xFF10;
gScanlineEffectRegBuffers[1][i] = 0xFF10;
i++;
}
ScanlineEffect_SetParams(sIntroScanlineParams16Bit);

View File

@ -3109,10 +3109,10 @@ static void DrawBlenderCenter(struct BgAffineSrcData *dest)
{
struct BgAffineSrcData affineSrc;
affineSrc.texX = 0x7800;
affineSrc.texY = 0x5000;
affineSrc.scrX = 0x78 - sBerryBlender->bg_X;
affineSrc.scrY = 0x50 - sBerryBlender->bg_Y;
affineSrc.texX = (DISPLAY_WIDTH / 2) << 8;
affineSrc.texY = (DISPLAY_HEIGHT / 2) << 8;
affineSrc.scrX = DISPLAY_WIDTH / 2 - sBerryBlender->bg_X;
affineSrc.scrY = DISPLAY_HEIGHT / 2 - sBerryBlender->bg_Y;
affineSrc.sx = sBerryBlender->centerScale;
affineSrc.sy = sBerryBlender->centerScale;
affineSrc.alpha = sBerryBlender->arrowPos;

View File

@ -1370,7 +1370,7 @@ static void SpriteCB_Player(struct Sprite *sprite)
break;
case 4:
StartSpriteAnimIfDifferent(sprite, 0);
if (sprite->x > 120)
if (sprite->x > DISPLAY_WIDTH / 2)
sprite->x--;
break;
case 5:

View File

@ -2416,7 +2416,7 @@ static void TeleportWarpOutFieldEffect_SpinExit(struct Task *task)
{
sprite->subspriteMode = SUBSPRITES_IGNORE_PRIORITY;
}
if (task->data[4] >= 0xa8)
if (task->data[4] >= DISPLAY_HEIGHT + 8)
{
task->tState++;
TryFadeOutOldMapMusic();

View File

@ -1195,7 +1195,7 @@ static void Task_Scene1_Load(u8 taskId)
CpuCopy16(&gPlttBufferUnfaded[OBJ_PLTT_ID(0)], &gPlttBufferUnfaded[OBJ_PLTT_ID(11) + 4], PLTT_SIZEOF(16 - 4));
CpuCopy16(&gPlttBufferUnfaded[OBJ_PLTT_ID(0)], &gPlttBufferUnfaded[OBJ_PLTT_ID(10) + 5], PLTT_SIZEOF(16 - 5));
CpuCopy16(&gPlttBufferUnfaded[OBJ_PLTT_ID(0)], &gPlttBufferUnfaded[OBJ_PLTT_ID( 9) + 6], PLTT_SIZEOF(16 - 6));
CreateGameFreakLogoSprites(120, 80, 0);
CreateGameFreakLogoSprites(DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, 0);
gTasks[taskId].sBigDropSpriteId = CreateWaterDrop(236, -14, 0x200, 1, 0x78, FALSE);
gTasks[taskId].func = Task_Scene1_FadeIn;
}
@ -1722,7 +1722,7 @@ static void Task_Scene3_Load(u8 taskId)
gTasks[taskId].tZoomDiv = 0;
gTasks[taskId].tZoomDivSpeed = 0;
gTasks[taskId].data[3] = 0;
PanFadeAndZoomScreen(0x78, 0x50, 0, 0);
PanFadeAndZoomScreen(DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, 0, 0);
ResetSpriteData();
FreeAllSpritePalettes();
BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_WHITEALPHA);
@ -1746,7 +1746,7 @@ static void Task_Scene3_SpinPokeball(u8 taskId)
gTasks[taskId].func = Task_Scene3_WaitGroudon;
}
PanFadeAndZoomScreen(0x78, 0x50, SAFE_DIV(0x10000, gTasks[taskId].tZoomDiv), gTasks[taskId].tAlpha);
PanFadeAndZoomScreen(DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, SAFE_DIV(0x10000, gTasks[taskId].tZoomDiv), gTasks[taskId].tAlpha);
if (gIntroFrameCounter == TIMER_POKEBALL_FADE)
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_WHITEALPHA);
@ -1848,7 +1848,7 @@ static void Task_Scene3_StartGroudon(u8 taskId)
{
gTasks[taskId].tState = 0;
gTasks[taskId].func = Task_Scene3_Groudon;
ScanlineEffect_InitWave(0, 160, 4, 4, 1, SCANLINE_EFFECT_REG_BG1HOFS, FALSE);
ScanlineEffect_InitWave(0, DISPLAY_HEIGHT, 4, 4, 1, SCANLINE_EFFECT_REG_BG1HOFS, FALSE);
}
#define tScreenX data[1]
@ -2058,7 +2058,7 @@ static void Task_Scene3_LoadKyogre(u8 taskId)
gTasks[taskId].tDelay = 16;
gTasks[taskId].tZoom = 256;
PanFadeAndZoomScreen(gTasks[taskId].tScreenX, gTasks[taskId].tScreenY, gTasks[taskId].tZoom, 0);
ScanlineEffect_InitWave(0, 0xA0, 4, 4, 1, SCANLINE_EFFECT_REG_BG1VOFS, FALSE);
ScanlineEffect_InitWave(0, DISPLAY_HEIGHT, 4, 4, 1, SCANLINE_EFFECT_REG_BG1VOFS, FALSE);
}
static void Task_Scene3_Kyogre(u8 taskId)

View File

@ -3755,7 +3755,7 @@ static void Task_LoadSizeScreen(u8 taskId)
StringCopy(string, gText_SizeComparedTo);
StringAppend(string, gSaveBlock2Ptr->playerName);
PrintInfoScreenText(string, GetStringCenterAlignXOffset(FONT_NORMAL, string, 0xF0), 0x79);
PrintInfoScreenText(string, GetStringCenterAlignXOffset(FONT_NORMAL, string, DISPLAY_WIDTH), 121);
gMain.state++;
}
break;
@ -4072,14 +4072,14 @@ static void Task_ExitCaughtMonPage(u8 taskId)
static void SpriteCB_SlideCaughtMonToCenter(struct Sprite *sprite)
{
if (sprite->x < 0x78)
if (sprite->x < DISPLAY_WIDTH / 2)
sprite->x += 2;
if (sprite->x > 0x78)
if (sprite->x > DISPLAY_WIDTH / 2)
sprite->x -= 2;
if (sprite->y < 0x50)
if (sprite->y < DISPLAY_HEIGHT / 2)
sprite->y += 1;
if (sprite->y > 0x50)
if (sprite->y > DISPLAY_HEIGHT / 2)
sprite->y -= 1;
}
@ -4103,7 +4103,7 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry)
const u8 *description;
if (newEntry)
PrintInfoScreenText(gText_PokedexRegistration, GetStringCenterAlignXOffset(FONT_NORMAL, gText_PokedexRegistration, 0xF0), 0);
PrintInfoScreenText(gText_PokedexRegistration, GetStringCenterAlignXOffset(FONT_NORMAL, gText_PokedexRegistration, DISPLAY_WIDTH), 0);
if (value == 0)
value = NationalToHoennOrder(num);
else
@ -4142,7 +4142,7 @@ static void PrintMonInfo(u32 num, u32 value, u32 owned, u32 newEntry)
description = gPokedexEntries[num].description;
else
description = sExpandedPlaceholder_PokedexDescription;
PrintInfoScreenText(description, GetStringCenterAlignXOffset(FONT_NORMAL, description, 0xF0), 0x5F);
PrintInfoScreenText(description, GetStringCenterAlignXOffset(FONT_NORMAL, description, DISPLAY_WIDTH), 95);
}
static void PrintMonHeight(u16 height, u8 left, u8 top)

View File

@ -4672,9 +4672,9 @@ static void SpriteCB_DigitalDisplay_Reel(struct Sprite *sprite)
{
case 0:
sprite->x += 4;
if (sprite->x >= 0xd0)
if (sprite->x >= DISPLAY_WIDTH - 32)
{
sprite->x = 0xd0;
sprite->x = DISPLAY_WIDTH - 32;
sprite->sState++;
}
break;
@ -4684,7 +4684,7 @@ static void SpriteCB_DigitalDisplay_Reel(struct Sprite *sprite)
break;
case 2:
sprite->x += 4;
if (sprite->x >= 0x110)
if (sprite->x >= DISPLAY_WIDTH + 32)
sprite->sState++;
break;
case 3:
@ -4700,9 +4700,9 @@ static void SpriteCB_DigitalDisplay_Time(struct Sprite *sprite)
{
case 0:
sprite->x -= 4;
if (sprite->x <= 0xd0)
if (sprite->x <= DISPLAY_WIDTH - 32)
{
sprite->x = 0xd0;
sprite->x = DISPLAY_WIDTH - 32;
sprite->sState++;
}
break;
@ -4712,7 +4712,7 @@ static void SpriteCB_DigitalDisplay_Time(struct Sprite *sprite)
break;
case 2:
sprite->x -= 4;
if (sprite->x <= 0x90)
if (sprite->x <= 144)
sprite->sState++;
break;
case 3:
@ -4738,9 +4738,9 @@ static void SpriteCB_DigitalDisplay_ReelTimeNumber(struct Sprite *sprite)
break;
case 2:
sprite->x += 4;
if (sprite->x >= 0xd0)
if (sprite->x >= DISPLAY_WIDTH - 32)
{
sprite->x = 0xd0;
sprite->x = DISPLAY_WIDTH - 32;
sprite->sState++;
}
break;
@ -4750,7 +4750,7 @@ static void SpriteCB_DigitalDisplay_ReelTimeNumber(struct Sprite *sprite)
break;
case 4:
sprite->x += 4;
if (sprite->x >= 0xf8)
if (sprite->x >= DISPLAY_WIDTH + 8)
sprite->sState++;
break;
case 5:

View File

@ -584,7 +584,7 @@ void CB2_InitTitleScreen(void)
gMain.state = 4;
break;
case 4:
PanFadeAndZoomScreen(0x78, 0x50, 0x100, 0);
PanFadeAndZoomScreen(DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, 0x100, 0);
SetGpuReg(REG_OFFSET_BG2X_L, -29 * 256);
SetGpuReg(REG_OFFSET_BG2X_H, -1);
SetGpuReg(REG_OFFSET_BG2Y_L, -32 * 256);

View File

@ -118,7 +118,7 @@ const u8 gMiscBlank_Gfx[] = INCBIN_U8("graphics/interface/blank.4bpp");
u8 CreateInvisibleSpriteWithCallback(void (*callback)(struct Sprite *))
{
u8 sprite = CreateSprite(&sInvisibleSpriteTemplate, 248, 168, 14);
u8 sprite = CreateSprite(&sInvisibleSpriteTemplate, DISPLAY_WIDTH + 8, DISPLAY_HEIGHT + 8, 14);
gSprites[sprite].invisible = TRUE;
gSprites[sprite].callback = callback;
return sprite;