From 62abcecc54ac810dc082e5e822be4796a5064ece Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 15 Apr 2021 02:04:01 -0400 Subject: [PATCH] More usage of DISPLAY constants --- src/battle_anim_effects_2.c | 11 +-- src/battle_anim_effects_3.c | 26 +++--- src/battle_anim_flying.c | 6 +- src/battle_anim_ghost.c | 12 +-- src/battle_anim_ground.c | 4 +- src/battle_anim_ice.c | 14 ++-- src/battle_anim_psychic.c | 2 +- src/battle_anim_rock.c | 4 +- src/battle_anim_throw.c | 2 +- src/battle_anim_water.c | 4 +- src/battle_controller_link_opponent.c | 4 +- src/battle_controller_link_partner.c | 2 +- src/battle_controller_opponent.c | 4 +- src/battle_controller_player.c | 6 +- src/battle_controller_player_partner.c | 2 +- src/battle_controller_recorded_opponent.c | 4 +- src/battle_controller_recorded_player.c | 2 +- src/battle_controller_safari.c | 2 +- src/battle_controller_wally.c | 4 +- src/battle_dome.c | 98 +++++++++++------------ src/battle_interface.c | 38 ++++----- src/battle_intro.c | 4 +- src/battle_main.c | 12 +-- src/battle_transition.c | 34 ++++---- src/cable_car.c | 2 +- src/confetti_util.c | 4 +- src/contest.c | 8 +- src/contest_util.c | 44 +++++----- src/evolution_graphics.c | 2 +- src/field_weather_effect.c | 4 +- src/hall_of_fame.c | 4 +- src/list_menu.c | 2 +- src/main_menu.c | 10 +-- src/mevent_801BAAC.c | 4 +- src/naming_screen.c | 2 +- src/option_menu.c | 2 +- src/pokedex.c | 22 ++--- src/pokedex_cry_screen.c | 2 +- src/pokemon_storage_system.c | 2 +- src/pokenav_menu_handler_2.c | 2 +- src/rayquaza_scene.c | 4 +- src/save_failed_screen.c | 2 +- src/starter_choose.c | 6 +- src/title_screen.c | 12 +-- src/trade.c | 12 +-- src/union_room_chat.c | 4 +- src/wallclock.c | 4 +- 47 files changed, 232 insertions(+), 229 deletions(-) diff --git a/src/battle_anim_effects_2.c b/src/battle_anim_effects_2.c index 3a04c8c46..58e2bae9f 100755 --- a/src/battle_anim_effects_2.c +++ b/src/battle_anim_effects_2.c @@ -3069,11 +3069,11 @@ static void AnimMagentaHeart(struct Sprite *sprite) void AnimTask_FakeOut(u8 taskId) { - u16 win0h = IsContest() ? 0x98 : 0xF0; + u16 win0h = IsContest() ? 152 : DISPLAY_WIDTH; u16 win0v = 0; gBattle_WIN0H = win0h; - gBattle_WIN0V = 0xA0; + gBattle_WIN0V = DISPLAY_HEIGHT; SetGpuReg(REG_OFFSET_WIN0H, gBattle_WIN0H); SetGpuReg(REG_OFFSET_WIN0V, gBattle_WIN0V); SetGpuReg(REG_OFFSET_WININ, 0x3F1F); @@ -3096,7 +3096,7 @@ static void AnimTask_FakeOut_Step1(u8 taskId) } else { - gBattle_WIN0H = gTasks[taskId].data[1] | (gTasks[taskId].data[0] << 8); + gBattle_WIN0H = WIN_RANGE(gTasks[taskId].data[0], gTasks[taskId].data[1]); } } @@ -3210,7 +3210,7 @@ void AnimParticleBurst(struct Sprite *sprite) static void AnimRedHeartRising(struct Sprite *sprite) { sprite->pos1.x = gBattleAnimArgs[0]; - sprite->pos1.y = 160; + sprite->pos1.y = DISPLAY_HEIGHT; sprite->data[0] = gBattleAnimArgs[2]; sprite->data[1] = gBattleAnimArgs[1]; sprite->callback = WaitAnimForDuration; @@ -3464,7 +3464,8 @@ static void AnimOrbitScatter_Step(struct Sprite *sprite) { sprite->pos2.x += sprite->data[0]; sprite->pos2.y += sprite->data[1]; - if (sprite->pos1.x + sprite->pos2.x + 16 > 272u || sprite->pos1.y + sprite->pos2.y > 160 || sprite->pos1.y + sprite->pos2.y < -16) + if (sprite->pos1.x + sprite->pos2.x + 16 > ((u32)DISPLAY_WIDTH + 32) + || sprite->pos1.y + sprite->pos2.y > DISPLAY_HEIGHT || sprite->pos1.y + sprite->pos2.y < -16) DestroyAnimSprite(sprite); } diff --git a/src/battle_anim_effects_3.c b/src/battle_anim_effects_3.c index 67452fe90..800431c6a 100755 --- a/src/battle_anim_effects_3.c +++ b/src/battle_anim_effects_3.c @@ -1509,7 +1509,7 @@ static void AnimLetterZ(struct Sprite *sprite) sprite->pos2.x = sprite->data[3] / 2; sprite->pos2.y = Sin(var0 & 0xFF, 5) + (sprite->data[4] / 2); - if ((u16)(sprite->pos1.x + sprite->pos2.x) > 240) + if ((u16)(sprite->pos1.x + sprite->pos2.x) > DISPLAY_WIDTH) DestroyAnimSprite(sprite); } @@ -1676,18 +1676,18 @@ void AnimTask_CreateSpotlight(u8 taskId) { if (IsContest()) { - SetGpuReg(REG_OFFSET_WININ, 0x1F3F); - gBattle_WIN1H = 0x98F0; - gBattle_WIN1V = 0x00A0; + SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ); + gBattle_WIN1H = WIN_RANGE(152, DISPLAY_WIDTH); + gBattle_WIN1V = WIN_RANGE(0, DISPLAY_HEIGHT); SetGpuReg(REG_OFFSET_WIN1H, gBattle_WIN0H); SetGpuReg(REG_OFFSET_WIN1V, gBattle_WIN0V); } else { SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR | WININ_WIN1_BG_ALL | WININ_WIN1_OBJ); - gBattle_WIN1H = 0x00F0; - gBattle_WIN1V = 0x78A0; - SetGpuReg(REG_OFFSET_WIN1H, 0x00F0); + gBattle_WIN1H = WIN_RANGE(0, DISPLAY_WIDTH); + gBattle_WIN1V = WIN_RANGE(120, DISPLAY_HEIGHT); + SetGpuReg(REG_OFFSET_WIN1H, gBattle_WIN1H); SetGpuReg(REG_OFFSET_WIN1V, gBattle_WIN1V); SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN1_ON); } @@ -1785,13 +1785,13 @@ void AnimTask_RapinSpinMonElevation(u8 taskId) { var3 = gBattle_BG1_X; task->data[8] = var3; - var4 = var3 + 240; + var4 = var3 + DISPLAY_WIDTH; } else { var3 = gBattle_BG2_X; task->data[8] = var3; - var4 = var3 + 240; + var4 = var3 + DISPLAY_WIDTH; } task->data[9] = var4; @@ -2807,7 +2807,7 @@ static void AnimSweetScentPetal(struct Sprite *sprite) } else { - sprite->pos1.x = 240; + sprite->pos1.x = DISPLAY_WIDTH; sprite->pos1.y = gBattleAnimArgs[0] - 30; } @@ -2824,7 +2824,7 @@ static void AnimSweetScentPetal_Step(struct Sprite *sprite) sprite->pos1.x += 5; sprite->pos1.y -= 1; - if (sprite->pos1.x > 240) + if (sprite->pos1.x > DISPLAY_WIDTH) DestroyAnimSprite(sprite); sprite->pos2.y = Sin(sprite->data[0] & 0xFF, 16); @@ -5049,7 +5049,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId) subpriority = gSprites[GetAnimBattlerSpriteId(ANIM_TARGET)].subpriority + 1; isBackPic = FALSE; - x = 272; + x = DISPLAY_WIDTH + 32; } else { @@ -5116,7 +5116,7 @@ void AnimTask_SnatchOpposingMonMove(u8 taskId) if (GetBattlerSide(gBattleAnimAttacker) == B_SIDE_PLAYER) gSprites[spriteId].pos2.x = -gSprites[spriteId].pos1.x - 32; else - gSprites[spriteId].pos2.x = 272 - gSprites[spriteId].pos1.x; + gSprites[spriteId].pos2.x = DISPLAY_WIDTH + 32 - gSprites[spriteId].pos1.x; gTasks[taskId].data[0]++; break; diff --git a/src/battle_anim_flying.c b/src/battle_anim_flying.c index 5955d203e..9e3e6c33e 100644 --- a/src/battle_anim_flying.c +++ b/src/battle_anim_flying.c @@ -496,7 +496,7 @@ static void AnimFlyBallAttack(struct Sprite *sprite) { if (GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) { - sprite->pos1.x = 272; + sprite->pos1.x = DISPLAY_WIDTH + 32; sprite->pos1.y = -32; StartSpriteAffineAnim(sprite, 1); } @@ -528,8 +528,8 @@ static void AnimFlyBallAttack_Step(struct Sprite *sprite) } if (sprite->pos1.x + sprite->pos2.x < -32 - || sprite->pos1.x + sprite->pos2.x > 272 - || sprite->pos1.y + sprite->pos2.y > 160) + || sprite->pos1.x + sprite->pos2.x > DISPLAY_WIDTH + 32 + || sprite->pos1.y + sprite->pos2.y > DISPLAY_HEIGHT) { gSprites[GetAnimBattlerSpriteId(ANIM_ATTACKER)].invisible = FALSE; DestroyAnimSprite(sprite); diff --git a/src/battle_anim_ghost.c b/src/battle_anim_ghost.c index 4b253a7ec..b52932b46 100644 --- a/src/battle_anim_ghost.c +++ b/src/battle_anim_ghost.c @@ -957,12 +957,12 @@ void AnimTask_CurseStretchingBlackBg(u8 taskId) else startX = 200; - gBattle_WIN0H = (startX << 8) | startX; + gBattle_WIN0H = WIN_RANGE(startX, startX); startY = 40; - gBattle_WIN0V = (startY << 8) | startY; + gBattle_WIN0V = WIN_RANGE(startY, startY); leftDistance = startX; - rightDistance = 240 - startX; + rightDistance = DISPLAY_WIDTH - startX; topDistance = startY; bottomDistance = 72; gTasks[taskId].data[1] = leftDistance; @@ -1001,7 +1001,7 @@ static void AnimTask_CurseStretchingBlackBg_Step1(u8 taskId) else { left = 0; - right = 240; + right = DISPLAY_WIDTH; top = 0; bottom = 112; selectedPalettes = GetBattleBgPalettesMask(1, 0, 0, 0, 0, 0, 0); @@ -1009,8 +1009,8 @@ static void AnimTask_CurseStretchingBlackBg_Step1(u8 taskId) gTasks[taskId].func = AnimTask_CurseStretchingBlackBg_Step2; } - gBattle_WIN0H = (left << 8) | right; - gBattle_WIN0V = (top << 8) | bottom; + gBattle_WIN0H = WIN_RANGE(left, right); + gBattle_WIN0V = WIN_RANGE(top, bottom); } static void AnimTask_CurseStretchingBlackBg_Step2(u8 taskId) diff --git a/src/battle_anim_ground.c b/src/battle_anim_ground.c index 6dc9c5815..aa089394e 100644 --- a/src/battle_anim_ground.c +++ b/src/battle_anim_ground.c @@ -353,7 +353,7 @@ static void AnimTask_DigBounceMovement(u8 taskId) else gBattle_BG2_Y = task->data[13] - task->data[5]; - gSprites[task->data[10]].pos2.x = 272 - gSprites[task->data[10]].pos1.x; + gSprites[task->data[10]].pos2.x = DISPLAY_WIDTH + 32 - gSprites[task->data[10]].pos1.x; task->data[0]++; } break; @@ -405,7 +405,7 @@ static void AnimTask_DigSetVisibleUnderground(u8 taskId) task->data[10] = GetAnimBattlerSpriteId(ANIM_ATTACKER); gSprites[task->data[10]].invisible = FALSE; gSprites[task->data[10]].pos2.x = 0; - gSprites[task->data[10]].pos2.y = 160 - gSprites[task->data[10]].pos1.y; + gSprites[task->data[10]].pos2.y = DISPLAY_HEIGHT - gSprites[task->data[10]].pos1.y; task->data[0]++; break; case 1: diff --git a/src/battle_anim_ice.c b/src/battle_anim_ice.c index b97ccf9cd..23b0f6c3b 100644 --- a/src/battle_anim_ice.c +++ b/src/battle_anim_ice.c @@ -696,8 +696,8 @@ static void AnimSwirlingSnowball(struct Sprite *sprite) sprite->data[0] = 1; AnimFastTranslateLinear(sprite); - if ((u32)(sprite->pos1.x + sprite->pos2.x + 16) > 272 - || sprite->pos1.y + sprite->pos2.y > 160 + if ((u32)(sprite->pos1.x + sprite->pos2.x + 16) > DISPLAY_WIDTH + 32 + || sprite->pos1.y + sprite->pos2.y > DISPLAY_HEIGHT || sprite->pos1.y + sprite->pos2.y < -16) break; } @@ -762,7 +762,7 @@ static void AnimSwirlingSnowball_End(struct Sprite *sprite) sprite->data[0] = 1; AnimFastTranslateLinear(sprite); - if ((u32)(sprite->pos1.x + sprite->pos2.x + 16) > 272 + if ((u32)(sprite->pos1.x + sprite->pos2.x + 16) > DISPLAY_WIDTH + 32 || sprite->pos1.y + sprite->pos2.y > 256 || sprite->pos1.y + sprite->pos2.y < -16) DestroyAnimSprite(sprite); @@ -816,8 +816,8 @@ static void AnimMoveParticleBeyondTarget(struct Sprite *sprite) { sprite->data[0] = 1; AnimFastTranslateLinear(sprite); - if ((u32)(sprite->pos1.x + sprite->pos2.x + 16) > 272 - || sprite->pos1.y + sprite->pos2.y > 160 + if ((u32)(sprite->pos1.x + sprite->pos2.x + 16) > DISPLAY_WIDTH + 32 + || sprite->pos1.y + sprite->pos2.y > DISPLAY_HEIGHT || sprite->pos1.y + sprite->pos2.y < -16) break; } @@ -846,8 +846,8 @@ static void AnimWiggleParticleTowardsTarget(struct Sprite *sprite) sprite->data[7] = (sprite->data[7] + sprite->data[6]) & 0xFF; if (sprite->data[0] == 1) { - if ((u32)(sprite->pos1.x + sprite->pos2.x + 16) > 272 - || sprite->pos1.y + sprite->pos2.y > 160 + if ((u32)(sprite->pos1.x + sprite->pos2.x + 16) > DISPLAY_WIDTH + 32 + || sprite->pos1.y + sprite->pos2.y > DISPLAY_HEIGHT || sprite->pos1.y + sprite->pos2.y < -16) DestroyAnimSprite(sprite); } diff --git a/src/battle_anim_psychic.c b/src/battle_anim_psychic.c index 2e7844f76..718fce396 100644 --- a/src/battle_anim_psychic.c +++ b/src/battle_anim_psychic.c @@ -737,7 +737,7 @@ static void AnimTask_Teleport_Step(u8 taskId) else { gSprites[task->data[0]].invisible = TRUE; - gSprites[task->data[0]].pos1.x = 272; + gSprites[task->data[0]].pos1.x = DISPLAY_WIDTH + 32; ResetSpriteRotScale(task->data[0]); DestroyAnimVisualTask(taskId); } diff --git a/src/battle_anim_rock.c b/src/battle_anim_rock.c index c2db62063..3e9eafb90 100644 --- a/src/battle_anim_rock.c +++ b/src/battle_anim_rock.c @@ -496,7 +496,7 @@ static void AnimFlyingSandCrescent(struct Sprite *sprite) { if (gBattleAnimArgs[3] != 0 && GetBattlerSide(gBattleAnimAttacker) != B_SIDE_PLAYER) { - sprite->pos1.x = 304; + sprite->pos1.x = DISPLAY_WIDTH + 64; gBattleAnimArgs[1] = -gBattleAnimArgs[1]; sprite->data[5] = 1; sprite->oam.matrixNum = ST_OAM_HFLIP; @@ -523,7 +523,7 @@ static void AnimFlyingSandCrescent(struct Sprite *sprite) if (sprite->data[5] == 0) { - if (sprite->pos1.x + sprite->pos2.x > 272) + if (sprite->pos1.x + sprite->pos2.x > DISPLAY_WIDTH + 32) { sprite->callback = DestroyAnimSprite; } diff --git a/src/battle_anim_throw.c b/src/battle_anim_throw.c index d36f6c3f9..f6a48cf69 100755 --- a/src/battle_anim_throw.c +++ b/src/battle_anim_throw.c @@ -1537,7 +1537,7 @@ static void SpriteCB_Ball_Block_Step(struct Sprite *sprite) sprite->sDy = (sprite->sDy + 0x800) & 0xFF; sprite->sDx = (sprite->sDx + 0x680) & 0xFF; - if (sprite->pos1.y + sprite->pos2.y > 160 + if (sprite->pos1.y + sprite->pos2.y > DISPLAY_HEIGHT || sprite->pos1.x + sprite->pos2.x < -8) { sprite->sFrame = 0; diff --git a/src/battle_anim_water.c b/src/battle_anim_water.c index 43849645e..d9cfeab9a 100644 --- a/src/battle_anim_water.c +++ b/src/battle_anim_water.c @@ -487,8 +487,8 @@ void AnimTask_CreateRaindrops(u8 taskId) gTasks[taskId].data[0]++; if (gTasks[taskId].data[0] % gTasks[taskId].data[2] == 1) { - x = Random2() % 240; - y = Random2() % 80; + x = Random2() % DISPLAY_WIDTH; + y = Random2() % (DISPLAY_HEIGHT / 2); CreateSprite(&gRainDropSpriteTemplate, x, y, 4); } if (gTasks[taskId].data[0] == gTasks[taskId].data[3]) diff --git a/src/battle_controller_link_opponent.c b/src/battle_controller_link_opponent.c index 179ae18e8..0f612f964 100644 --- a/src/battle_controller_link_opponent.c +++ b/src/battle_controller_link_opponent.c @@ -1134,7 +1134,7 @@ static void LinkOpponentHandleLoadMonSprite(void) GetBattlerSpriteDefault_Y(gActiveBattler), GetBattlerSpriteSubpriority(gActiveBattler)); - gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -DISPLAY_WIDTH; gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); @@ -1302,7 +1302,7 @@ static void LinkOpponentHandleDrawTrainerPic(void) (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 40, GetBattlerSpriteSubpriority(gActiveBattler)); - gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -DISPLAY_WIDTH; gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 2; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; diff --git a/src/battle_controller_link_partner.c b/src/battle_controller_link_partner.c index 2bb1cd914..9184f5ac9 100644 --- a/src/battle_controller_link_partner.c +++ b/src/battle_controller_link_partner.c @@ -1021,7 +1021,7 @@ static void LinkPartnerHandleLoadMonSprite(void) GetBattlerSpriteCoord(gActiveBattler, 2), GetBattlerSpriteDefault_Y(gActiveBattler), GetBattlerSpriteSubpriority(gActiveBattler)); - gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -DISPLAY_WIDTH; gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); diff --git a/src/battle_controller_opponent.c b/src/battle_controller_opponent.c index 2c181c14f..9fce5050e 100644 --- a/src/battle_controller_opponent.c +++ b/src/battle_controller_opponent.c @@ -1143,7 +1143,7 @@ static void OpponentHandleLoadMonSprite(void) GetBattlerSpriteDefault_Y(gActiveBattler), GetBattlerSpriteSubpriority(gActiveBattler)); - gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -DISPLAY_WIDTH; gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; gSprites[gBattlerSpriteIds[gActiveBattler]].data[2] = species; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; @@ -1310,7 +1310,7 @@ static void OpponentHandleDrawTrainerPic(void) (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 40, GetBattlerSpriteSubpriority(gActiveBattler)); - gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -DISPLAY_WIDTH; gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 2; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; diff --git a/src/battle_controller_player.c b/src/battle_controller_player.c index e7801d0e4..34fcb82f6 100644 --- a/src/battle_controller_player.c +++ b/src/battle_controller_player.c @@ -630,7 +630,7 @@ static u32 HandleMoveInputUnused(void) { PlaySE(SE_SELECT); gBattle_BG0_X = 0; - gBattle_BG0_Y = 0x140; + gBattle_BG0_Y = DISPLAY_HEIGHT * 2; var = 0xFF; } if (JOY_NEW(DPAD_LEFT) && gMoveSelectionCursor[gActiveBattler] & 1) @@ -2568,7 +2568,7 @@ static void HandleChooseActionAfterDma3(void) if (!IsDma3ManagerBusyWithBgCopy()) { gBattle_BG0_X = 0; - gBattle_BG0_Y = 160; + gBattle_BG0_Y = DISPLAY_HEIGHT; gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseAction; } } @@ -2610,7 +2610,7 @@ static void HandleChooseMoveAfterDma3(void) if (!IsDma3ManagerBusyWithBgCopy()) { gBattle_BG0_X = 0; - gBattle_BG0_Y = 320; + gBattle_BG0_Y = DISPLAY_HEIGHT * 2; gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseMove; } } diff --git a/src/battle_controller_player_partner.c b/src/battle_controller_player_partner.c index cc433a9b2..401ad311b 100644 --- a/src/battle_controller_player_partner.c +++ b/src/battle_controller_player_partner.c @@ -1205,7 +1205,7 @@ static void PlayerPartnerHandleLoadMonSprite(void) GetBattlerSpriteCoord(gActiveBattler, 2), GetBattlerSpriteDefault_Y(gActiveBattler), GetBattlerSpriteSubpriority(gActiveBattler)); - gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -DISPLAY_WIDTH; gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); diff --git a/src/battle_controller_recorded_opponent.c b/src/battle_controller_recorded_opponent.c index 663d71ec7..245e4bd30 100644 --- a/src/battle_controller_recorded_opponent.c +++ b/src/battle_controller_recorded_opponent.c @@ -1117,7 +1117,7 @@ static void RecordedOpponentHandleLoadMonSprite(void) GetBattlerSpriteDefault_Y(gActiveBattler), GetBattlerSpriteSubpriority(gActiveBattler)); - gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -DISPLAY_WIDTH; gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); @@ -1249,7 +1249,7 @@ static void RecordedOpponentHandleDrawTrainerPic(void) (8 - gTrainerFrontPicCoords[trainerPicId].size) * 4 + 40, GetBattlerSpriteSubpriority(gActiveBattler)); - gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -DISPLAY_WIDTH; gSprites[gBattlerSpriteIds[gActiveBattler]].sSpeedX = 2; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = IndexOfSpritePaletteTag(gTrainerFrontPicPaletteTable[trainerPicId].tag); gSprites[gBattlerSpriteIds[gActiveBattler]].oam.affineParam = trainerPicId; diff --git a/src/battle_controller_recorded_player.c b/src/battle_controller_recorded_player.c index aa4154a3f..73c23afc5 100644 --- a/src/battle_controller_recorded_player.c +++ b/src/battle_controller_recorded_player.c @@ -1098,7 +1098,7 @@ static void RecordedPlayerHandleLoadMonSprite(void) GetBattlerSpriteCoord(gActiveBattler, 2), GetBattlerSpriteDefault_Y(gActiveBattler), GetBattlerSpriteSubpriority(gActiveBattler)); - gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -240; + gSprites[gBattlerSpriteIds[gActiveBattler]].pos2.x = -DISPLAY_WIDTH; gSprites[gBattlerSpriteIds[gActiveBattler]].data[0] = gActiveBattler; gSprites[gBattlerSpriteIds[gActiveBattler]].oam.paletteNum = gActiveBattler; StartSpriteAnim(&gSprites[gBattlerSpriteIds[gActiveBattler]], gBattleMonForms[gActiveBattler]); diff --git a/src/battle_controller_safari.c b/src/battle_controller_safari.c index 0fdf32fb6..5d8b46ebd 100644 --- a/src/battle_controller_safari.c +++ b/src/battle_controller_safari.c @@ -442,7 +442,7 @@ static void HandleChooseActionAfterDma3(void) if (!IsDma3ManagerBusyWithBgCopy()) { gBattle_BG0_X = 0; - gBattle_BG0_Y = 160; + gBattle_BG0_Y = DISPLAY_HEIGHT; gBattlerControllerFuncs[gActiveBattler] = HandleInputChooseAction; } } diff --git a/src/battle_controller_wally.c b/src/battle_controller_wally.c index 0d1515213..b35ffa692 100644 --- a/src/battle_controller_wally.c +++ b/src/battle_controller_wally.c @@ -1195,7 +1195,7 @@ static void HandleChooseActionAfterDma3(void) if (!IsDma3ManagerBusyWithBgCopy()) { gBattle_BG0_X = 0; - gBattle_BG0_Y = 160; + gBattle_BG0_Y = DISPLAY_HEIGHT; gBattlerControllerFuncs[gActiveBattler] = WallyHandleActions; } } @@ -1233,7 +1233,7 @@ static void WallyHandleChooseMove(void) if (!IsDma3ManagerBusyWithBgCopy()) { gBattle_BG0_X = 0; - gBattle_BG0_Y = 0x140; + gBattle_BG0_Y = DISPLAY_HEIGHT * 2; gBattleStruct->wallyMovesState++; } break; diff --git a/src/battle_dome.c b/src/battle_dome.c index 4e6e6a652..a5cf168ef 100644 --- a/src/battle_dome.c +++ b/src/battle_dome.c @@ -2998,7 +2998,7 @@ static void Task_ShowTourneyInfoCard(u8 taskId) if (mode == INFOCARD_MATCH) gBattle_BG2_X = 0, gBattle_BG2_Y = 0; else - gBattle_BG2_X = 0, gBattle_BG2_Y = 160; + gBattle_BG2_X = 0, gBattle_BG2_Y = DISPLAY_HEIGHT; gTasks[taskId].tState++; break; @@ -3143,7 +3143,7 @@ static void SpriteCb_TrainerIconCardScrollLeft(struct Sprite *sprite) } else { - if (sprite->pos1.x >= 272) + if (sprite->pos1.x >= DISPLAY_WIDTH + 32) { sInfoCard->spriteIds[sprite->data[2]] = SPRITE_NONE; FreeAndDestroyTrainerPicSprite(sprite->data[3]); @@ -3156,7 +3156,7 @@ static void SpriteCb_TrainerIconCardScrollRight(struct Sprite *sprite) sprite->pos1.x -= 4; if (sprite->data[0] != 0) { - if (sprite->pos1.x <= 272) + if (sprite->pos1.x <= DISPLAY_WIDTH + 32) sprite->invisible = FALSE; if (++sprite->data[1] == 64) sprite->callback = SpriteCallbackDummy; @@ -3237,7 +3237,7 @@ static void SpriteCb_MonIconCardScrollLeft(struct Sprite *sprite) } else { - if (sprite->pos1.x >= 256) + if (sprite->pos1.x >= DISPLAY_WIDTH + 16) { sInfoCard->spriteIds[sprite->data[2]] = SPRITE_NONE; FreeAndDestroyMonIconSprite(sprite); @@ -3252,7 +3252,7 @@ static void SpriteCb_MonIconCardScrollRight(struct Sprite *sprite) sprite->pos1.x -= 4; if (sprite->data[0] != 0) { - if (sprite->pos1.x <= 256) + if (sprite->pos1.x <= DISPLAY_WIDTH + 16) sprite->invisible = FALSE; if (++sprite->data[1] == 64) sprite->callback = SpriteCb_MonIcon; @@ -3439,12 +3439,12 @@ static void Task_HandleInfoCardInput(u8 taskId) gBattle_BG0_X = 0; gBattle_BG0_Y = 0; gBattle_BG1_X = 0; - gBattle_BG1_Y = 160; + gBattle_BG1_Y = DISPLAY_HEIGHT; } else { gBattle_BG0_X = 0; - gBattle_BG0_Y = 160; + gBattle_BG0_Y = DISPLAY_HEIGHT; gBattle_BG1_X = 0; gBattle_BG1_Y = 0; } @@ -3454,13 +3454,13 @@ static void Task_HandleInfoCardInput(u8 taskId) if (sInfoCard->pos == 0) { gBattle_BG2_X = 0; - gBattle_BG2_Y = 320; + gBattle_BG2_Y = DISPLAY_HEIGHT * 2; trainerTourneyId = sTourneyTreeTrainerIds[gTasks[taskId2].data[1]]; DisplayTrainerInfoOnCard(gTasks[taskId].tUsingAlternateSlot | MOVE_CARD_UP, trainerTourneyId); } else { - gBattle_BG2_X = 256; + gBattle_BG2_X = DISPLAY_WIDTH + 16; gBattle_BG2_Y = 0; trainerTourneyId = sTourneyTreeTrainerIds[gTasks[taskId2].data[1]]; DisplayTrainerInfoOnCard(gTasks[taskId].tUsingAlternateSlot | MOVE_CARD_UP, trainerTourneyId); @@ -3474,7 +3474,7 @@ static void Task_HandleInfoCardInput(u8 taskId) matchNo = gTasks[taskId2].data[1] - 16; BufferDomeWinString(matchNo, sInfoCard->tournamentIds); gBattle_BG2_X = 0; - gBattle_BG2_Y = 320; + gBattle_BG2_Y = DISPLAY_HEIGHT * 2; trainerTourneyId = sInfoCard->tournamentIds[0]; DisplayTrainerInfoOnCard(gTasks[taskId].tUsingAlternateSlot | MOVE_CARD_UP, trainerTourneyId); } @@ -3483,14 +3483,14 @@ static void Task_HandleInfoCardInput(u8 taskId) matchNo = gTasks[taskId2].data[1] - 16; BufferDomeWinString(matchNo, sInfoCard->tournamentIds); gBattle_BG2_X = 0; - gBattle_BG2_Y = 320; + gBattle_BG2_Y = DISPLAY_HEIGHT * 2; trainerTourneyId = sInfoCard->tournamentIds[1]; DisplayTrainerInfoOnCard(gTasks[taskId].tUsingAlternateSlot | MOVE_CARD_UP, trainerTourneyId); } else { - gBattle_BG2_X = 256; - gBattle_BG2_Y = 160; + gBattle_BG2_X = DISPLAY_WIDTH + 16; + gBattle_BG2_Y = DISPLAY_HEIGHT; matchNo = gTasks[taskId2].data[1] - 16; DisplayMatchInfoOnCard(gTasks[taskId].tUsingAlternateSlot | MOVE_CARD_UP, matchNo); } @@ -3555,12 +3555,12 @@ static void Task_HandleInfoCardInput(u8 taskId) gBattle_BG0_X = 0; gBattle_BG0_Y = 0; gBattle_BG1_X = 0; - gBattle_BG1_Y = -160; + gBattle_BG1_Y = -DISPLAY_HEIGHT; } else { gBattle_BG0_X = 0; - gBattle_BG0_Y = -160; + gBattle_BG0_Y = -DISPLAY_HEIGHT; gBattle_BG1_X = 0; gBattle_BG1_Y = 0; } @@ -3570,7 +3570,7 @@ static void Task_HandleInfoCardInput(u8 taskId) if (sInfoCard->pos == 0) { gBattle_BG2_X = 0; - gBattle_BG2_Y = 160; + gBattle_BG2_Y = DISPLAY_HEIGHT; trainerTourneyId = sTourneyTreeTrainerIds[gTasks[taskId2].data[1]]; DisplayTrainerInfoOnCard(gTasks[taskId].tUsingAlternateSlot | MOVE_CARD_DOWN, trainerTourneyId); } @@ -3590,7 +3590,7 @@ static void Task_HandleInfoCardInput(u8 taskId) matchNo = gTasks[taskId2].data[1] - 16; BufferDomeWinString(matchNo, sInfoCard->tournamentIds); gBattle_BG2_X = 0; - gBattle_BG2_Y = 160; + gBattle_BG2_Y = DISPLAY_HEIGHT; trainerTourneyId = sInfoCard->tournamentIds[0]; DisplayTrainerInfoOnCard(gTasks[taskId].tUsingAlternateSlot | MOVE_CARD_DOWN, trainerTourneyId); } @@ -3599,13 +3599,13 @@ static void Task_HandleInfoCardInput(u8 taskId) matchNo = gTasks[taskId2].data[1] - 16; BufferDomeWinString(matchNo, sInfoCard->tournamentIds); gBattle_BG2_X = 0; - gBattle_BG2_Y = 160; + gBattle_BG2_Y = DISPLAY_HEIGHT; trainerTourneyId = sInfoCard->tournamentIds[1]; DisplayTrainerInfoOnCard(gTasks[taskId].tUsingAlternateSlot | MOVE_CARD_DOWN, trainerTourneyId); } else { - gBattle_BG2_X = 256; + gBattle_BG2_X = DISPLAY_WIDTH + 16; gBattle_BG2_Y = 0; matchNo = gTasks[taskId2].data[1] - 16; DisplayMatchInfoOnCard(gTasks[taskId].tUsingAlternateSlot | MOVE_CARD_DOWN, matchNo); @@ -3669,12 +3669,12 @@ static void Task_HandleInfoCardInput(u8 taskId) { gBattle_BG0_X = 0; gBattle_BG0_Y = 0; - gBattle_BG1_X = 256; + gBattle_BG1_X = DISPLAY_WIDTH + 16; gBattle_BG1_Y = 0; } else { - gBattle_BG0_X = 256; + gBattle_BG0_X = DISPLAY_WIDTH + 16; gBattle_BG0_Y = 0; gBattle_BG1_X = 0; gBattle_BG1_Y = 0; @@ -3682,14 +3682,14 @@ static void Task_HandleInfoCardInput(u8 taskId) if (sInfoCard->pos == 0) { - gBattle_BG2_X = 256; - gBattle_BG2_Y = 160; + gBattle_BG2_X = DISPLAY_WIDTH + 16; + gBattle_BG2_Y = DISPLAY_HEIGHT; trainerTourneyId = sTourneyTreeTrainerIds[gTasks[taskId2].data[1]]; DisplayTrainerInfoOnCard(gTasks[taskId].tUsingAlternateSlot | MOVE_CARD_LEFT, trainerTourneyId); } else { - gBattle_BG2_X = 256; + gBattle_BG2_X = DISPLAY_WIDTH + 16; gBattle_BG2_Y = 0; matchNo = sIdToMatchNumber[gTasks[taskId2].data[1]][sInfoCard->pos - 1]; DisplayMatchInfoOnCard(gTasks[taskId].tUsingAlternateSlot | MOVE_CARD_LEFT, matchNo); @@ -3752,12 +3752,12 @@ static void Task_HandleInfoCardInput(u8 taskId) { gBattle_BG0_X = 0; gBattle_BG0_Y = 0; - gBattle_BG1_X = 256; + gBattle_BG1_X = DISPLAY_WIDTH + 16; gBattle_BG1_Y = 0; } else { - gBattle_BG0_X = 256; + gBattle_BG0_X = DISPLAY_WIDTH + 16; gBattle_BG0_Y = 0; gBattle_BG1_X = 0; gBattle_BG1_Y = 0; @@ -3765,15 +3765,15 @@ static void Task_HandleInfoCardInput(u8 taskId) if (sInfoCard->pos == 0) { - gBattle_BG2_X = 256; - gBattle_BG2_Y = 160; + gBattle_BG2_X = DISPLAY_WIDTH + 16; + gBattle_BG2_Y = DISPLAY_HEIGHT; trainerTourneyId = sInfoCard->tournamentIds[0]; DisplayTrainerInfoOnCard(gTasks[taskId].tUsingAlternateSlot | MOVE_CARD_LEFT, trainerTourneyId); } else { gBattle_BG2_X = 0; - gBattle_BG2_Y = 160; + gBattle_BG2_Y = DISPLAY_HEIGHT; matchNo = gTasks[taskId2].data[1] - 16; DisplayMatchInfoOnCard(gTasks[taskId].tUsingAlternateSlot | MOVE_CARD_LEFT, matchNo); } @@ -3835,12 +3835,12 @@ static void Task_HandleInfoCardInput(u8 taskId) { gBattle_BG0_X = 0; gBattle_BG0_Y = 0; - gBattle_BG1_X = -256; + gBattle_BG1_X = -(DISPLAY_WIDTH + 16); gBattle_BG1_Y = 0; } else { - gBattle_BG0_X = -256; + gBattle_BG0_X = -(DISPLAY_WIDTH + 16); gBattle_BG0_Y = 0; gBattle_BG1_X = 0; gBattle_BG1_Y = 0; @@ -3849,7 +3849,7 @@ static void Task_HandleInfoCardInput(u8 taskId) if (sInfoCard->pos == 1) { gBattle_BG2_X = 0; - gBattle_BG2_Y = 160; + gBattle_BG2_Y = DISPLAY_HEIGHT; } else { @@ -3916,12 +3916,12 @@ static void Task_HandleInfoCardInput(u8 taskId) { gBattle_BG0_X = 0; gBattle_BG0_Y = 0; - gBattle_BG1_X = -256; + gBattle_BG1_X = -(DISPLAY_WIDTH + 16); gBattle_BG1_Y = 0; } else { - gBattle_BG0_X = -256; + gBattle_BG0_X = -(DISPLAY_WIDTH + 16); gBattle_BG0_Y = 0; gBattle_BG1_X = 0; gBattle_BG1_Y = 0; @@ -3929,15 +3929,15 @@ static void Task_HandleInfoCardInput(u8 taskId) if (sInfoCard->pos == 2) { - gBattle_BG2_X = 256; - gBattle_BG2_Y = 160; + gBattle_BG2_X = DISPLAY_WIDTH + 16; + gBattle_BG2_Y = DISPLAY_HEIGHT; trainerTourneyId = sInfoCard->tournamentIds[1]; DisplayTrainerInfoOnCard(gTasks[taskId].tUsingAlternateSlot | MOVE_CARD_RIGHT, trainerTourneyId); } else { gBattle_BG2_X = 0; - gBattle_BG2_Y = 160; + gBattle_BG2_Y = DISPLAY_HEIGHT; matchNo = gTasks[taskId2].data[1] - 16; DisplayMatchInfoOnCard(gTasks[taskId].tUsingAlternateSlot | MOVE_CARD_RIGHT, matchNo); } @@ -4248,13 +4248,13 @@ static void DisplayTrainerInfoOnCard(u8 flags, u8 trainerTourneyId) if (flags & CARD_ALTERNATE_SLOT) arrId = 2 * (FRONTIER_PARTY_SIZE + 1), windowId = 9, palSlot = 2; if (flags & MOVE_CARD_RIGHT) - x = 256; + x = DISPLAY_WIDTH + 16; if (flags & MOVE_CARD_DOWN) - y = 160; + y = DISPLAY_HEIGHT; if (flags & MOVE_CARD_LEFT) - x = -256; + x = -(DISPLAY_WIDTH + 16); if (flags & MOVE_CARD_UP) - y = -160; + y = -DISPLAY_HEIGHT; // Create trainer pic sprite if (trainerId == TRAINER_PLAYER) @@ -4709,13 +4709,13 @@ static void DisplayMatchInfoOnCard(u8 flags, u8 matchNo) if (flags & CARD_ALTERNATE_SLOT) arrId = 2 * (FRONTIER_PARTY_SIZE + 1), windowId = 9, palSlot = 2; if (flags & MOVE_CARD_RIGHT) - x = 256; + x = DISPLAY_WIDTH + 16; if (flags & MOVE_CARD_DOWN) - y = 160; + y = DISPLAY_HEIGHT; if (flags & MOVE_CARD_LEFT) - x = -256; + x = -(DISPLAY_WIDTH + 16); if (flags & MOVE_CARD_UP) - y = -160; + y = -DISPLAY_HEIGHT; // Copy trainers information to handy arrays. winStringId = BufferDomeWinString(matchNo, sInfoCard->tournamentIds); @@ -5285,10 +5285,10 @@ static void Task_ShowTourneyTree(u8 taskId) SetGpuReg(REG_OFFSET_BLDALPHA, 0); SetGpuReg(REG_OFFSET_BLDY, 0); SetGpuReg(REG_OFFSET_MOSAIC, 0); - SetGpuReg(REG_OFFSET_WIN0H, 0x5860); - SetGpuReg(REG_OFFSET_WIN0V, 0x9F); - SetGpuReg(REG_OFFSET_WIN1H, 0x9098); - SetGpuReg(REG_OFFSET_WIN1V, 0x9F); + SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(88, 96)); + SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(0, DISPLAY_HEIGHT - 1)); + SetGpuReg(REG_OFFSET_WIN1H, WIN_RANGE(144, 152)); + SetGpuReg(REG_OFFSET_WIN1V, WIN_RANGE(0, DISPLAY_HEIGHT - 1)); SetGpuReg(REG_OFFSET_WININ, 0); SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR); ResetPaletteFade(); diff --git a/src/battle_interface.c b/src/battle_interface.c index cccc0b971..5518fd21b 100644 --- a/src/battle_interface.c +++ b/src/battle_interface.c @@ -330,7 +330,7 @@ static const struct SpriteTemplate sHealthbarSpriteTemplates[MAX_BATTLERS_COUNT] static const struct Subsprite sUnknown_0832C220[] = { { - .x = 240, + .x = DISPLAY_WIDTH, .y = 0, .shape = SPRITE_SHAPE(64x32), .size = SPRITE_SIZE(64x32), @@ -346,7 +346,7 @@ static const struct Subsprite sUnknown_0832C220[] = .priority = 1 }, { - .x = 240, + .x = DISPLAY_WIDTH, .y = 32, .shape = SPRITE_SHAPE(32x8), .size = SPRITE_SIZE(32x8), @@ -374,7 +374,7 @@ static const struct Subsprite sUnknown_0832C220[] = static const struct Subsprite sUnknown_0832C234[] = { { - .x = 240, + .x = DISPLAY_WIDTH, .y = 0, .shape = SPRITE_SHAPE(64x32), .size = SPRITE_SIZE(64x32), @@ -390,7 +390,7 @@ static const struct Subsprite sUnknown_0832C234[] = .priority = 1 }, { - .x = 240, + .x = DISPLAY_WIDTH, .y = 32, .shape = SPRITE_SHAPE(32x8), .size = SPRITE_SIZE(32x8), @@ -418,7 +418,7 @@ static const struct Subsprite sUnknown_0832C234[] = static const struct Subsprite sUnknown_0832C248[] = { { - .x = 240, + .x = DISPLAY_WIDTH, .y = 0, .shape = SPRITE_SHAPE(64x32), .size = SPRITE_SIZE(64x32), @@ -438,7 +438,7 @@ static const struct Subsprite sUnknown_0832C248[] = static const struct Subsprite sUnknown_0832C250[] = { { - .x = 240, + .x = DISPLAY_WIDTH, .y = 0, .shape = SPRITE_SHAPE(64x32), .size = SPRITE_SIZE(64x32), @@ -458,7 +458,7 @@ static const struct Subsprite sUnknown_0832C250[] = static const struct Subsprite sUnknown_0832C258[] = { { - .x = 240, + .x = DISPLAY_WIDTH, .y = 0, .shape = SPRITE_SHAPE(32x8), .size = SPRITE_SIZE(32x8), @@ -478,7 +478,7 @@ static const struct Subsprite sUnknown_0832C258[] = static const struct Subsprite sUnknown_0832C260[] = { { - .x = 240, + .x = DISPLAY_WIDTH, .y = 0, .shape = SPRITE_SHAPE(32x8), .size = SPRITE_SIZE(32x8), @@ -494,7 +494,7 @@ static const struct Subsprite sUnknown_0832C260[] = .priority = 1 }, { - .x = 224, + .x = DISPLAY_WIDTH - 16, .y = 0, .shape = SPRITE_SHAPE(8x8), .size = SPRITE_SIZE(8x8), @@ -869,8 +869,8 @@ u8 CreateBattlerHealthboxSprites(u8 battlerId) { if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) { - healthboxLeftSpriteId = CreateSprite(&sHealthboxPlayerSpriteTemplates[0], 240, 160, 1); - healthboxRightSpriteId = CreateSpriteAtEnd(&sHealthboxPlayerSpriteTemplates[0], 240, 160, 1); + healthboxLeftSpriteId = CreateSprite(&sHealthboxPlayerSpriteTemplates[0], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); + healthboxRightSpriteId = CreateSpriteAtEnd(&sHealthboxPlayerSpriteTemplates[0], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); gSprites[healthboxLeftSpriteId].oam.shape = ST_OAM_SQUARE; @@ -879,8 +879,8 @@ u8 CreateBattlerHealthboxSprites(u8 battlerId) } else { - healthboxLeftSpriteId = CreateSprite(&sHealthboxOpponentSpriteTemplates[0], 240, 160, 1); - healthboxRightSpriteId = CreateSpriteAtEnd(&sHealthboxOpponentSpriteTemplates[0], 240, 160, 1); + healthboxLeftSpriteId = CreateSprite(&sHealthboxOpponentSpriteTemplates[0], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); + healthboxRightSpriteId = CreateSpriteAtEnd(&sHealthboxOpponentSpriteTemplates[0], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); gSprites[healthboxRightSpriteId].oam.tileNum += 32; @@ -895,8 +895,8 @@ u8 CreateBattlerHealthboxSprites(u8 battlerId) { if (GetBattlerSide(battlerId) == B_SIDE_PLAYER) { - healthboxLeftSpriteId = CreateSprite(&sHealthboxPlayerSpriteTemplates[GetBattlerPosition(battlerId) / 2], 240, 160, 1); - healthboxRightSpriteId = CreateSpriteAtEnd(&sHealthboxPlayerSpriteTemplates[GetBattlerPosition(battlerId) / 2], 240, 160, 1); + healthboxLeftSpriteId = CreateSprite(&sHealthboxPlayerSpriteTemplates[GetBattlerPosition(battlerId) / 2], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); + healthboxRightSpriteId = CreateSpriteAtEnd(&sHealthboxPlayerSpriteTemplates[GetBattlerPosition(battlerId) / 2], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); gSprites[healthboxLeftSpriteId].oam.affineParam = healthboxRightSpriteId; @@ -908,8 +908,8 @@ u8 CreateBattlerHealthboxSprites(u8 battlerId) } else { - healthboxLeftSpriteId = CreateSprite(&sHealthboxOpponentSpriteTemplates[GetBattlerPosition(battlerId) / 2], 240, 160, 1); - healthboxRightSpriteId = CreateSpriteAtEnd(&sHealthboxOpponentSpriteTemplates[GetBattlerPosition(battlerId) / 2], 240, 160, 1); + healthboxLeftSpriteId = CreateSprite(&sHealthboxOpponentSpriteTemplates[GetBattlerPosition(battlerId) / 2], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); + healthboxRightSpriteId = CreateSpriteAtEnd(&sHealthboxOpponentSpriteTemplates[GetBattlerPosition(battlerId) / 2], DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); gSprites[healthboxLeftSpriteId].oam.affineParam = healthboxRightSpriteId; @@ -946,8 +946,8 @@ u8 CreateSafariPlayerHealthboxSprites(void) { u8 healthboxLeftSpriteId, healthboxRightSpriteId; - healthboxLeftSpriteId = CreateSprite(&sHealthboxSafariSpriteTemplate, 240, 160, 1); - healthboxRightSpriteId = CreateSpriteAtEnd(&sHealthboxSafariSpriteTemplate, 240, 160, 1); + healthboxLeftSpriteId = CreateSprite(&sHealthboxSafariSpriteTemplate, DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); + healthboxRightSpriteId = CreateSpriteAtEnd(&sHealthboxSafariSpriteTemplate, DISPLAY_WIDTH, DISPLAY_HEIGHT, 1); gSprites[healthboxLeftSpriteId].oam.shape = ST_OAM_SQUARE; gSprites[healthboxRightSpriteId].oam.shape = ST_OAM_SQUARE; diff --git a/src/battle_intro.c b/src/battle_intro.c index c76e5bc31..0ea65dab1 100644 --- a/src/battle_intro.c +++ b/src/battle_intro.c @@ -532,8 +532,8 @@ static void BattleIntroSlidePartner(u8 taskId) SetGpuReg(REG_OFFSET_WININ, WININ_WIN1_BG1 | WININ_WIN1_BG2 | WININ_WIN1_BG3 | WININ_WIN1_OBJ | WININ_WIN1_CLR); SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR | WINOUT_WINOBJ_BG_ALL | WINOUT_WINOBJ_OBJ | WINOUT_WINOBJ_CLR); gBattle_BG0_Y = -48; - gBattle_BG1_X = 240; - gBattle_BG2_X = -240; + gBattle_BG1_X = DISPLAY_WIDTH; + gBattle_BG2_X = -DISPLAY_WIDTH; } break; case 2: diff --git a/src/battle_main.c b/src/battle_main.c index c30c92929..323053bdf 100644 --- a/src/battle_main.c +++ b/src/battle_main.c @@ -611,22 +611,22 @@ static void CB2_InitBattleInternal(void) CpuFill32(0, (void*)(VRAM), VRAM_SIZE); SetGpuReg(REG_OFFSET_MOSAIC, 0); - SetGpuReg(REG_OFFSET_WIN0H, 240); - SetGpuReg(REG_OFFSET_WIN0V, 0x5051); + SetGpuReg(REG_OFFSET_WIN0H, DISPLAY_WIDTH); + SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(DISPLAY_HEIGHT / 2, DISPLAY_HEIGHT / 2 + 1)); SetGpuReg(REG_OFFSET_WININ, 0); SetGpuReg(REG_OFFSET_WINOUT, 0); - gBattle_WIN0H = 240; + gBattle_WIN0H = DISPLAY_WIDTH; if (gBattleTypeFlags & BATTLE_TYPE_INGAME_PARTNER && gPartnerTrainerId != TRAINER_STEVEN_PARTNER) { - gBattle_WIN0V = 159; - gBattle_WIN1H = 240; + gBattle_WIN0V = DISPLAY_HEIGHT - 1; + gBattle_WIN1H = DISPLAY_WIDTH; gBattle_WIN1V = 32; } else { - gBattle_WIN0V = 0x5051; + gBattle_WIN0V = WIN_RANGE(DISPLAY_HEIGHT / 2, DISPLAY_HEIGHT / 2 + 1); ScanlineEffect_Clear(); i = 0; diff --git a/src/battle_transition.c b/src/battle_transition.c index d47b99c86..ed518eaf8 100644 --- a/src/battle_transition.c +++ b/src/battle_transition.c @@ -1252,8 +1252,8 @@ static void sub_814669C(struct Task *task) task->tData5 = 0x4000; sTransitionStructPtr->WININ = 63; sTransitionStructPtr->WINOUT = 0; - sTransitionStructPtr->WIN0H = 240; - sTransitionStructPtr->WIN0V = 160; + sTransitionStructPtr->WIN0H = DISPLAY_WIDTH; + sTransitionStructPtr->WIN0V = DISPLAY_HEIGHT; sTransitionStructPtr->BLDCNT = 0x3F41; sTransitionStructPtr->BLDALPHA = (task->tData1 << 8) | (task->tData2); @@ -1692,7 +1692,7 @@ static void sub_814713C(struct Sprite *sprite) } else { - if (sprite->pos1.x >= 0 && sprite->pos1.x <= 240) + if (sprite->pos1.x >= 0 && sprite->pos1.x <= DISPLAY_WIDTH) { s16 posX = sprite->pos1.x >> 3; s16 posY = sprite->pos1.y >> 3; @@ -1733,7 +1733,7 @@ static bool8 Phase2_Clockwise_BlackFade_Func1(struct Task *task) sTransitionStructPtr->WININ = 0; sTransitionStructPtr->WINOUT = 63; sTransitionStructPtr->WIN0H = -3855; - sTransitionStructPtr->WIN0V = 160; + sTransitionStructPtr->WIN0V = DISPLAY_HEIGHT; for (i = 0; i < 160; i++) { @@ -2001,8 +2001,8 @@ static bool8 Phase2_Wave_Func1(struct Task *task) sTransitionStructPtr->WININ = 63; sTransitionStructPtr->WINOUT = 0; - sTransitionStructPtr->WIN0H = 240; - sTransitionStructPtr->WIN0V = 160; + sTransitionStructPtr->WIN0H = DISPLAY_WIDTH; + sTransitionStructPtr->WIN0V = DISPLAY_HEIGHT; for (i = 0; i < 160; i++) { @@ -2113,7 +2113,7 @@ static bool8 Phase2_Mugshot_Func1(struct Task *task) task->tData3 = 239; sTransitionStructPtr->WININ = 63; sTransitionStructPtr->WINOUT = 62; - sTransitionStructPtr->WIN0V = 160; + sTransitionStructPtr->WIN0V = DISPLAY_HEIGHT; for (i = 0; i < 160; i++) { @@ -2253,7 +2253,7 @@ static bool8 Phase2_Mugshot_Func6(struct Task *task) DmaStop(0); memset(gScanlineEffectRegBuffers[0], 0, 0x140); memset(gScanlineEffectRegBuffers[1], 0, 0x140); - SetGpuReg(REG_OFFSET_WIN0H, 0xF0); + SetGpuReg(REG_OFFSET_WIN0H, DISPLAY_WIDTH); SetGpuReg(REG_OFFSET_BLDY, 0); task->tState++; task->tData3 = 0; @@ -2384,7 +2384,7 @@ static void Mugshots_CreateOpponentPlayerSprites(struct Task *task) sMugshotsOpponentCoords[mugshotId][0] - 32, sMugshotsOpponentCoords[mugshotId][1] + 42, 0, gDecompressionBuffer); - task->tPlayerSpriteId = CreateTrainerSprite(PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender), 272, 106, 0, gDecompressionBuffer); + task->tPlayerSpriteId = CreateTrainerSprite(PlayerGenderToFrontTrainerPicId(gSaveBlock2Ptr->playerGender), DISPLAY_WIDTH + 32, 106, 0, gDecompressionBuffer); opponentSprite = &gSprites[task->tOpponentSpriteId]; playerSprite = &gSprites[task->tPlayerSpriteId]; @@ -2507,7 +2507,7 @@ static bool8 Phase2_Slice_Func1(struct Task *task) task->tData3 = 1; sTransitionStructPtr->WININ = 63; sTransitionStructPtr->WINOUT = 0; - sTransitionStructPtr->WIN0V = 160; + sTransitionStructPtr->WIN0V = DISPLAY_HEIGHT; sTransitionStructPtr->VBlank_DMA = FALSE; for (i = 0; i < 160; i++) @@ -2608,7 +2608,7 @@ static bool8 Phase2_ShredSplit_Func1(struct Task *task) sTransitionStructPtr->WININ = 63; sTransitionStructPtr->WINOUT = 0; - sTransitionStructPtr->WIN0V = 160; + sTransitionStructPtr->WIN0V = DISPLAY_HEIGHT; for (i = 0; i < 0xA0; i++) { @@ -2780,8 +2780,8 @@ static bool8 Phase2_Blackhole_Func1(struct Task *task) sTransitionStructPtr->WININ = 0; sTransitionStructPtr->WINOUT = 63; - sTransitionStructPtr->WIN0H = 240; - sTransitionStructPtr->WIN0V = 160; + sTransitionStructPtr->WIN0H = DISPLAY_WIDTH; + sTransitionStructPtr->WIN0V = DISPLAY_HEIGHT; for (i = 0; i < 0xA0; i++) { @@ -3208,8 +3208,8 @@ static bool8 Phase2_Rayquaza_Func9(struct Task *task) sTransitionStructPtr->WININ = 0; sTransitionStructPtr->WINOUT = 63; - sTransitionStructPtr->WIN0H = 240; - sTransitionStructPtr->WIN0V = 160; + sTransitionStructPtr->WIN0H = DISPLAY_WIDTH; + sTransitionStructPtr->WIN0V = DISPLAY_HEIGHT; for (i = 0; i < 160; i++) { @@ -3259,7 +3259,7 @@ static bool8 Phase2_WhiteFade_Func1(struct Task *task) sTransitionStructPtr->BLDY = 0; sTransitionStructPtr->WININ = 0x1E; sTransitionStructPtr->WINOUT = 0x3F; - sTransitionStructPtr->WIN0V = 0xA0; + sTransitionStructPtr->WIN0V = DISPLAY_HEIGHT; for (i = 0; i < 160; i++) { @@ -3470,7 +3470,7 @@ static bool8 Phase2_Shards_Func1(struct Task *task) sTransitionStructPtr->WININ = 0x3F; sTransitionStructPtr->WINOUT = 0; - sTransitionStructPtr->WIN0V = 0xA0; + sTransitionStructPtr->WIN0V = DISPLAY_HEIGHT; for (i = 0; i < 160; i++) { diff --git a/src/cable_car.c b/src/cable_car.c index 56118161b..733d10436 100644 --- a/src/cable_car.c +++ b/src/cable_car.c @@ -684,7 +684,7 @@ static void SpriteCB_HikerGoingUp(struct Sprite *sprite) break; } - if (sprite->pos1.y > 160) + if (sprite->pos1.y > DISPLAY_HEIGHT) DestroySprite(sprite); } } diff --git a/src/confetti_util.c b/src/confetti_util.c index 3bda3ab53..bcf19f705 100644 --- a/src/confetti_util.c +++ b/src/confetti_util.c @@ -210,8 +210,8 @@ u8 ConfettiUtil_Remove(u8 id) return 0xFF; memset(&sWork->array[id], 0, sizeof(struct ConfettiUtil)); - sWork->array[id].oam.y = 160; - sWork->array[id].oam.x = 240; + sWork->array[id].oam.y = DISPLAY_HEIGHT; + sWork->array[id].oam.x = DISPLAY_WIDTH; sWork->array[id].dummied = TRUE; memcpy(&gMain.oamBuffer[id + 64], &gDummyOamData, sizeof(struct OamData)); return id; diff --git a/src/contest.c b/src/contest.c index f5326663f..246fc1e50 100644 --- a/src/contest.c +++ b/src/contest.c @@ -1393,7 +1393,7 @@ static void Task_RaiseCurtainAtStart(u8 taskId) break; case 1: *(s16*)&gBattle_BG1_Y += 7; - if ((s16)gBattle_BG1_Y <= 160) + if ((s16)gBattle_BG1_Y <= DISPLAY_HEIGHT) break; gTasks[taskId].data[0]++; break; @@ -1513,8 +1513,8 @@ static void Task_ShowMoveSelectScreen(u8 taskId) u8 i; u8 moveName[32]; - gBattle_BG0_Y = 160; - gBattle_BG2_Y = 160; + gBattle_BG0_Y = DISPLAY_HEIGHT; + gBattle_BG2_Y = DISPLAY_HEIGHT; for (i = 0; i < MAX_MON_MOVES; i++) { @@ -2681,7 +2681,7 @@ static void Task_WaitForOutOfTimeMsg(u8 taskId) { SetBgForCurtainDrop(); gBattle_BG1_X = 0; - gBattle_BG1_Y = 160; + gBattle_BG1_Y = DISPLAY_HEIGHT; PlaySE12WithPanning(SE_CONTEST_CURTAIN_FALL, 0); gTasks[taskId].data[0] = 0; gTasks[taskId].func = Task_DropCurtainAtAppealsEnd; diff --git a/src/contest_util.c b/src/contest_util.c index e5fd51db1..98854c4c6 100644 --- a/src/contest_util.c +++ b/src/contest_util.c @@ -521,8 +521,8 @@ static void CB2_StartShowContestResults(void) gPaletteFade.bufferTransferDisabled = FALSE; sContestResults->data->showResultsTaskId = CreateTask(Task_ShowContestResults, 5); SetMainCallback2(CB2_ShowContestResults); - gBattle_WIN1H = 0x00F0; - gBattle_WIN1V = 0x80A0; + gBattle_WIN1H = WIN_RANGE(0, DISPLAY_WIDTH); + gBattle_WIN1V = WIN_RANGE(128, DISPLAY_HEIGHT); CreateTask(Task_SlideContestResultsBg, 20); CalculateContestantsResultData(); if (gLinkContestFlags & LINK_CONTEST_FLAG_IS_WIRELESS) @@ -679,7 +679,7 @@ static void Task_AnnouncePreliminaryResults(u8 taskId) { CreateTask(Task_FlashStarsAndHearts, 20); x = DrawResultsTextWindow(gText_AnnouncingResults, sContestResults->data->slidingTextBoxSpriteId); - StartTextBoxSlideIn(x, 144, 120, 1088); + StartTextBoxSlideIn(x, DISPLAY_HEIGHT - 16, 120, 1088); gTasks[taskId].tState++; } else if (gTasks[taskId].tState == 1) @@ -702,7 +702,7 @@ static void Task_AnnouncePreliminaryResults(u8 taskId) else if (gTasks[taskId].tState == 3) { x = DrawResultsTextWindow(gText_PreliminaryResults, sContestResults->data->slidingTextBoxSpriteId); - StartTextBoxSlideIn(x, 144, -1, 1088); + StartTextBoxSlideIn(x, DISPLAY_HEIGHT - 16, -1, 1088); gTasks[taskId].tState++; } else if (gTasks[taskId].tState == 4) @@ -752,7 +752,7 @@ static void Task_AnnounceRound2Results(u8 taskId) { gTasks[taskId].tTimer = 0; x = DrawResultsTextWindow(gText_Round2Results, sContestResults->data->slidingTextBoxSpriteId); - StartTextBoxSlideIn(x, 144, -1, 1088); + StartTextBoxSlideIn(x, DISPLAY_HEIGHT - 16, -1, 1088); } } else if (sContestResults->data->slidingTextBoxState == SLIDING_TEXT_ARRIVED) @@ -841,7 +841,7 @@ static void Task_AnnounceWinner(u8 taskId) StringCopy(gStringVar2, gContestMons[i].nickname); StringExpandPlaceholders(winnerTextBuffer, gText_ContestantsMonWon); x = DrawResultsTextWindow(winnerTextBuffer, sContestResults->data->slidingTextBoxSpriteId); - StartTextBoxSlideIn(x, 144, -1, 1088); + StartTextBoxSlideIn(x, DISPLAY_HEIGHT - 16, -1, 1088); gTasks[taskId].tState++; } break; @@ -864,8 +864,8 @@ static void Task_ShowWinnerMonBanner(u8 taskId) switch (gTasks[taskId].tState) { case 0: - gBattle_WIN0H = 0x00F0; - gBattle_WIN0V = 0x5050; + gBattle_WIN0H = WIN_RANGE(0, DISPLAY_WIDTH); + gBattle_WIN0V = WIN_RANGE(DISPLAY_HEIGHT / 2, DISPLAY_HEIGHT / 2); GET_CONTEST_WINNER_ID(i); species = gContestMons[i].species; @@ -892,7 +892,7 @@ static void Task_ShowWinnerMonBanner(u8 taskId) LoadCompressedSpritePalette(pokePal); SetMultiuseSpriteTemplateToPokemon(species, B_POSITION_OPPONENT_LEFT); gMultiuseSpriteTemplate.paletteTag = pokePal->tag; - spriteId = CreateSprite(&gMultiuseSpriteTemplate, 272, 80, 10); + spriteId = CreateSprite(&gMultiuseSpriteTemplate, DISPLAY_WIDTH + 32, 80, 10); gSprites[spriteId].data[1] = species; gSprites[spriteId].oam.priority = 0; gSprites[spriteId].callback = SpriteCB_WinnerMonSlideIn; @@ -912,7 +912,7 @@ static void Task_ShowWinnerMonBanner(u8 taskId) gTasks[taskId].tCounter = 32; counter = gTasks[taskId].tCounter; - gBattle_WIN0V = ((80 - counter) << 8) | (80 + counter); + gBattle_WIN0V = WIN_RANGE(DISPLAY_HEIGHT / 2 - counter, DISPLAY_HEIGHT / 2 + counter); if (counter == 32) gTasks[taskId].tState++; } @@ -934,11 +934,11 @@ static void Task_ShowWinnerMonBanner(u8 taskId) { u8 top = (gBattle_WIN0V >> 8); top += 2; - if (top > 80) - top = 80; + if (top > DISPLAY_HEIGHT / 2) + top = DISPLAY_HEIGHT / 2; - gBattle_WIN0V = (top << 8) | (160 - top); - if (top == 80) + gBattle_WIN0V = WIN_RANGE(top, DISPLAY_HEIGHT - top); + if (top == DISPLAY_HEIGHT / 2) gTasks[taskId].tState++; } break; @@ -1205,7 +1205,7 @@ static s32 DrawResultsTextWindow(const u8 *text, u8 spriteId) } RemoveWindow(windowId); - return (240 - (strWidth + 2) * 8) / 2; + return (DISPLAY_WIDTH - (strWidth + 2) * 8) / 2; } static void LoadContestResultSprites(void) @@ -1221,7 +1221,7 @@ static void LoadContestResultSprites(void) LoadSpritePalette(&sUnknown_0858D850); for (i = 0; i < (int)ARRAY_COUNT(sUnknown_0858D810); i++) { - spriteIds[i] = CreateSprite(&template, 272, 144, 10); + spriteIds[i] = CreateSprite(&template, DISPLAY_WIDTH + 32, DISPLAY_HEIGHT - 16, 10); template.tileTag++; } @@ -1248,7 +1248,7 @@ static void LoadContestResultSprites(void) static void StartTextBoxSlideIn(s16 x, u16 y, u16 slideOutTimer, u16 slideIncrement) { struct Sprite *sprite = &gSprites[sContestResults->data->slidingTextBoxSpriteId]; - sprite->pos1.x = 272; + sprite->pos1.x = DISPLAY_WIDTH + 32; sprite->pos1.y = y; sprite->pos2.x = 0; sprite->pos2.y = 0; @@ -1275,8 +1275,8 @@ static void StartTextBoxSlideOut(u16 slideIncrement) static void EndTextBoxSlideOut(struct Sprite *sprite) { - sprite->pos1.x = 272; - sprite->pos1.y = 144; + sprite->pos1.x = DISPLAY_WIDTH + 32; + sprite->pos1.y = DISPLAY_HEIGHT - 16; sprite->pos2.y = 0; sprite->pos2.x = 0; sprite->callback = SpriteCallbackDummy; @@ -1353,8 +1353,8 @@ static void ShowLinkResultsTextBox(const u8 *text) gSprites[sprite->data[i]].invisible = FALSE; } - gBattle_WIN0H = 0x00F0; - gBattle_WIN0V = ((sprite->pos1.y - 16) << 8) | (sprite->pos1.y + 16); + gBattle_WIN0H = WIN_RANGE(0, DISPLAY_WIDTH); + gBattle_WIN0V = WIN_RANGE(sprite->pos1.y - 16, sprite->pos1.y + 16); SetGpuReg(REG_OFFSET_WININ, WININ_WIN1_BG_ALL | WININ_WIN1_OBJ | WININ_WIN1_CLR | WININ_WIN0_BG1 | WININ_WIN0_BG2 | WININ_WIN0_BG3 | WININ_WIN0_OBJ | WININ_WIN0_CLR); } @@ -1600,7 +1600,7 @@ static void Task_CreateConfetti(u8 taskId) gTasks[taskId].data[0] = 0; if (sContestResults->data->confettiCount < 40) { - u8 spriteId = CreateSprite(&sSpriteTemplate_Confetti, (Random() % 240) - 20, 44, 5); + u8 spriteId = CreateSprite(&sSpriteTemplate_Confetti, (Random() % DISPLAY_WIDTH) - 20, 44, 5); gSprites[spriteId].data[0] = Random() % 512; gSprites[spriteId].data[1] = (Random() % 24) + 16; gSprites[spriteId].data[2] = (Random() % 256) + 48; diff --git a/src/evolution_graphics.c b/src/evolution_graphics.c index a66a7a28d..2a3aaa9e8 100644 --- a/src/evolution_graphics.c +++ b/src/evolution_graphics.c @@ -55,7 +55,7 @@ static const struct SpritePalette sEvoSparkleSpritePals[] = static const struct OamData sOamData_EvoSparkle = { - .y = 160, + .y = DISPLAY_HEIGHT, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, .mosaic = 0, diff --git a/src/field_weather_effect.c b/src/field_weather_effect.c index 63043885d..90f867410 100644 --- a/src/field_weather_effect.c +++ b/src/field_weather_effect.c @@ -1537,8 +1537,8 @@ void Ash_InitAll(void) void Ash_Main(void) { gWeatherPtr->ashBaseSpritesX = gSpriteCoordOffsetX & 0x1FF; - while (gWeatherPtr->ashBaseSpritesX >= 240) - gWeatherPtr->ashBaseSpritesX -= 240; + while (gWeatherPtr->ashBaseSpritesX >= DISPLAY_WIDTH) + gWeatherPtr->ashBaseSpritesX -= DISPLAY_WIDTH; switch (gWeatherPtr->initStep) { diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index 037acd09c..3eb8d3f0a 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -1398,7 +1398,7 @@ static bool8 CreateHofConfettiSprite(void) u8 spriteID; struct Sprite* sprite; - s16 posX = Random() % 240; + s16 posX = Random() % DISPLAY_WIDTH; s16 posY = -(Random() % 8); spriteID = CreateSprite(&sSpriteTemplate_HofConfetti, posX, posY, 0); @@ -1505,7 +1505,7 @@ static void Task_DoDomeConfetti(u8 taskId) id = ConfettiUtil_AddNew(&sOamData_Confetti, TAG_CONFETTI, TAG_CONFETTI, - Random() % 240, + Random() % DISPLAY_WIDTH, -(Random() % 8), Random() % ARRAY_COUNT(sAnims_Confetti), id); diff --git a/src/list_menu.c b/src/list_menu.c index 79ea1fde0..9ac9b87ab 100644 --- a/src/list_menu.c +++ b/src/list_menu.c @@ -679,7 +679,7 @@ static u8 ListMenuAddCursorObject(struct ListMenu *list, u32 cursorKind) struct CursorStruct cursor; cursor.left = 0; - cursor.top = 160; + cursor.top = DISPLAY_HEIGHT; cursor.rowWidth = GetWindowAttribute(list->template.windowId, WINDOW_WIDTH) * 8 + 2; cursor.rowHeight = GetFontAttribute(list->template.fontId, FONTATTR_MAX_LETTER_HEIGHT) + 2; cursor.tileTag = 0x4000; diff --git a/src/main_menu.c b/src/main_menu.c index d2ec55d3e..38859b860 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -896,8 +896,8 @@ static bool8 HandleMainMenuInput(u8 taskId) { PlaySE(SE_SELECT); BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_WHITEALPHA); - SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(0, 240)); - SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(0, 160)); + SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(0, DISPLAY_WIDTH)); + SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(0, DISPLAY_HEIGHT)); gTasks[taskId].func = Task_HandleMainMenuBPressed; } else if ((JOY_NEW(DPAD_UP)) && tCurrItem > 0) @@ -1547,7 +1547,7 @@ static void Task_NewGameBirchSpeech_SlideOutOldGenderSprite(u8 taskId) spriteId = gTasks[taskId].tMaySpriteId; else spriteId = gTasks[taskId].tBrendanSpriteId; - gSprites[spriteId].pos1.x = 240; + gSprites[spriteId].pos1.x = DISPLAY_WIDTH; gSprites[spriteId].pos1.y = 60; gSprites[spriteId].invisible = FALSE; gTasks[taskId].tPlayerSpriteId = spriteId; @@ -2129,8 +2129,8 @@ static void CreateMainMenuErrorWindow(const u8* str) PutWindowTilemap(7); CopyWindowToVram(7, 2); DrawMainMenuWindowBorder(&sWindowTemplates_MainMenu[7], MAIN_MENU_BORDER_TILE); - SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(9, 231)); - SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(113, 159)); + SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(9, DISPLAY_WIDTH - 9)); + SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(113, DISPLAY_HEIGHT - 1)); } static void MainMenu_FormatSavegameText(void) diff --git a/src/mevent_801BAAC.c b/src/mevent_801BAAC.c index 2afb9ea70..a64f65e03 100644 --- a/src/mevent_801BAAC.c +++ b/src/mevent_801BAAC.c @@ -584,8 +584,8 @@ s32 FadeToWonderNewsMenu(void) ChangeBgY(1, 0, 0); ChangeBgY(2, 0, 0); ChangeBgY(3, 0, 0); - SetGpuReg(REG_OFFSET_WIN0H, 0xF0); - SetGpuReg(REG_OFFSET_WIN0V, 0x1A98); + SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(0, DISPLAY_WIDTH)); + SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(26, 152)); SetGpuReg(REG_OFFSET_WININ, 0x1F); SetGpuReg(REG_OFFSET_WINOUT, 0x1B); SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON); diff --git a/src/naming_screen.c b/src/naming_screen.c index b594fe106..3c8478e04 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -475,7 +475,7 @@ static void NamingScreen_Init(void) sNamingScreen->bgToHide = 1; sNamingScreen->template = sNamingScreenTemplates[sNamingScreen->templateNum]; sNamingScreen->currentPage = sNamingScreen->template->initialPage; - sNamingScreen->inputCharBaseXPos = (240 - sNamingScreen->template->maxChars * 8) / 2 + 6; + sNamingScreen->inputCharBaseXPos = (DISPLAY_WIDTH - sNamingScreen->template->maxChars * 8) / 2 + 6; if (sNamingScreen->templateNum == NAMING_SCREEN_WALDA) sNamingScreen->inputCharBaseXPos += 11; sNamingScreen->keyRepeatStartDelayCopy = gKeyRepeatStartDelay; diff --git a/src/option_menu.c b/src/option_menu.c index 936aff923..ec66e827a 100644 --- a/src/option_menu.c +++ b/src/option_menu.c @@ -381,7 +381,7 @@ static void Task_OptionMenuFadeOut(u8 taskId) static void HighlightOptionMenuItem(u8 index) { - SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(16, 224)); + SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(16, DISPLAY_WIDTH - 16)); SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(index * 16 + 40, index * 16 + 56)); } diff --git a/src/pokedex.c b/src/pokedex.c index 2d371f937..9386a8b33 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -305,7 +305,7 @@ static void ClearSearchParameterBoxText(void); static const struct OamData sOamData_ScrollBar = { - .y = 160, + .y = DISPLAY_HEIGHT, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, .mosaic = 0, @@ -322,7 +322,7 @@ static const struct OamData sOamData_ScrollBar = static const struct OamData sOamData_ScrollArrow = { - .y = 160, + .y = DISPLAY_HEIGHT, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, .mosaic = 0, @@ -339,7 +339,7 @@ static const struct OamData sOamData_ScrollArrow = static const struct OamData sOamData_InterfaceText = { - .y = 160, + .y = DISPLAY_HEIGHT, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, .mosaic = 0, @@ -356,7 +356,7 @@ static const struct OamData sOamData_InterfaceText = static const struct OamData sOamData_RotatingPokeBall = { - .y = 160, + .y = DISPLAY_HEIGHT, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_WINDOW, .mosaic = 0, @@ -373,7 +373,7 @@ static const struct OamData sOamData_RotatingPokeBall = static const struct OamData sOamData_SeenOwnText = { - .y = 160, + .y = DISPLAY_HEIGHT, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, .mosaic = 0, @@ -390,7 +390,7 @@ static const struct OamData sOamData_SeenOwnText = static const struct OamData sOamData_Dex8x16 = { - .y = 160, + .y = DISPLAY_HEIGHT, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, .mosaic = 0, @@ -2768,7 +2768,7 @@ static void CreateInterfaceSprites(u8 page) // Scroll arrows spriteId = CreateSprite(&sScrollArrowSpriteTemplate, 184, 4, 0); gSprites[spriteId].sIsDownArrow = FALSE; - spriteId = CreateSprite(&sScrollArrowSpriteTemplate, 184, 156, 0); + spriteId = CreateSprite(&sScrollArrowSpriteTemplate, 184, DISPLAY_HEIGHT - 4, 0); gSprites[spriteId].sIsDownArrow = TRUE; gSprites[spriteId].vFlip = TRUE; @@ -2779,20 +2779,20 @@ static void CreateInterfaceSprites(u8 page) spriteId = CreateSprite(&sInterfaceTextSpriteTemplate, 48, 120, 0); StartSpriteAnim(&gSprites[spriteId], 3); // Select button - spriteId = CreateSprite(&sInterfaceTextSpriteTemplate, 16, 144, 0); + spriteId = CreateSprite(&sInterfaceTextSpriteTemplate, 16, DISPLAY_HEIGHT - 16, 0); StartSpriteAnim(&gSprites[spriteId], 2); gSprites[spriteId].data[2] = 0x80; // Search text - spriteId = CreateSprite(&sInterfaceTextSpriteTemplate, 48, 144, 0); + spriteId = CreateSprite(&sInterfaceTextSpriteTemplate, 48, DISPLAY_HEIGHT - 16, 0); StartSpriteAnim(&gSprites[spriteId], 1); - spriteId = CreateSprite(&sRotatingPokeBallSpriteTemplate, 0, 80, 2); + spriteId = CreateSprite(&sRotatingPokeBallSpriteTemplate, 0, DISPLAY_HEIGHT / 2, 2); gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; gSprites[spriteId].oam.matrixNum = 30; gSprites[spriteId].data[0] = 30; gSprites[spriteId].data[1] = 0; - spriteId = CreateSprite(&sRotatingPokeBallSpriteTemplate, 0, 80, 2); + spriteId = CreateSprite(&sRotatingPokeBallSpriteTemplate, 0, DISPLAY_HEIGHT / 2, 2); gSprites[spriteId].oam.affineMode = ST_OAM_AFFINE_NORMAL; gSprites[spriteId].oam.matrixNum = 31; gSprites[spriteId].data[0] = 31; diff --git a/src/pokedex_cry_screen.c b/src/pokedex_cry_screen.c index 0a6f639ae..447ce7515 100644 --- a/src/pokedex_cry_screen.c +++ b/src/pokedex_cry_screen.c @@ -188,7 +188,7 @@ static const union AnimCmd *const sSpriteAnimTable_CryMeterNeedle[] = static const struct OamData sOamData_CryMeterNeedle = { - .y = 160, + .y = DISPLAY_HEIGHT, .affineMode = ST_OAM_AFFINE_NORMAL, .objMode = ST_OAM_OBJ_NORMAL, .bpp = ST_OAM_4BPP, diff --git a/src/pokemon_storage_system.c b/src/pokemon_storage_system.c index 0a35aa323..d3ec36c9e 100644 --- a/src/pokemon_storage_system.c +++ b/src/pokemon_storage_system.c @@ -4836,7 +4836,7 @@ static void CreatePartyMonsSprites(bool8 arg0) { for (i = 0; i < count; i++) { - sPSSData->partySprites[i]->pos1.y -= 160; + sPSSData->partySprites[i]->pos1.y -= DISPLAY_HEIGHT; sPSSData->partySprites[i]->invisible = TRUE; } } diff --git a/src/pokenav_menu_handler_2.c b/src/pokenav_menu_handler_2.c index eea8131a9..2ba83b23c 100644 --- a/src/pokenav_menu_handler_2.c +++ b/src/pokenav_menu_handler_2.c @@ -1223,7 +1223,7 @@ static void SetupPokenavMenuScanlineEffects(void) SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON); SetGpuRegBits(REG_OFFSET_WININ, 0x3F); SetGpuRegBits(REG_OFFSET_WINOUT, 0x1F); - SetGpuRegBits(REG_OFFSET_WIN0V, 0xA0); + SetGpuRegBits(REG_OFFSET_WIN0V, DISPLAY_HEIGHT); ScanlineEffect_Stop(); SetMenuOptionGlow(); ScanlineEffect_SetParams(sPokenavMainMenuScanlineEffectParams); diff --git a/src/rayquaza_scene.c b/src/rayquaza_scene.c index 101916f13..24e76e1c9 100644 --- a/src/rayquaza_scene.c +++ b/src/rayquaza_scene.c @@ -1860,7 +1860,7 @@ static void SpriteCB_DuoFight_Groudon(struct Sprite *sprite) static void DuoFight_SlideGroudonDown(struct Sprite *sprite) { s16 *data = sprite->data; - if (sprite->pos1.y <= 160) + if (sprite->pos1.y <= DISPLAY_HEIGHT) { sprite->pos1.y += 8; gSprites[sprite->sGroudonBodySpriteId].pos1.y += 8; @@ -1965,7 +1965,7 @@ static void SpriteCB_DuoFight_Kyogre(struct Sprite *sprite) static void DuoFight_SlideKyogreDown(struct Sprite *sprite) { s16 *data = sprite->data; - if (sprite->pos1.y <= 160) + if (sprite->pos1.y <= DISPLAY_HEIGHT) { sprite->pos1.y += 8; gSprites[sprite->data[0] >> 8].pos1.y += 8; diff --git a/src/save_failed_screen.c b/src/save_failed_screen.c index 529bb75e7..8f727310c 100644 --- a/src/save_failed_screen.c +++ b/src/save_failed_screen.c @@ -47,7 +47,7 @@ static EWRAM_DATA u8 sUnused2[4] = {0}; static const struct OamData sClockOamData = { - .y = 160, + .y = DISPLAY_HEIGHT, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, .mosaic = 0, diff --git a/src/starter_choose.c b/src/starter_choose.c index 4b582f839..92cb2d48c 100644 --- a/src/starter_choose.c +++ b/src/starter_choose.c @@ -157,7 +157,7 @@ static const u8 sTextColors[] = {TEXT_COLOR_TRANSPARENT, TEXT_COLOR_WHITE, TEXT_ static const struct OamData sOam_Hand = { - .y = 160, + .y = DISPLAY_HEIGHT, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, .mosaic = 0, @@ -174,7 +174,7 @@ static const struct OamData sOam_Hand = static const struct OamData sOam_Pokeball = { - .y = 160, + .y = DISPLAY_HEIGHT, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, .mosaic = 0, @@ -191,7 +191,7 @@ static const struct OamData sOam_Pokeball = static const struct OamData sOam_StarterCircle = { - .y = 160, + .y = DISPLAY_HEIGHT, .affineMode = ST_OAM_AFFINE_DOUBLE, .objMode = ST_OAM_OBJ_NORMAL, .mosaic = 0, diff --git a/src/title_screen.c b/src/title_screen.c index f2c609fec..9752cc611 100644 --- a/src/title_screen.c +++ b/src/title_screen.c @@ -105,7 +105,7 @@ const u16 gTitleScreenAlphaBlend[64] = static const struct OamData sVersionBannerLeftOamData = { - .y = 160, + .y = DISPLAY_HEIGHT, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, .mosaic = 0, @@ -122,7 +122,7 @@ static const struct OamData sVersionBannerLeftOamData = static const struct OamData sVersionBannerRightOamData = { - .y = 160, + .y = DISPLAY_HEIGHT, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, .mosaic = 0, @@ -193,7 +193,7 @@ static const struct CompressedSpriteSheet sSpriteSheet_EmeraldVersion[] = static const struct OamData sOamData_CopyrightBanner = { - .y = 160, + .y = DISPLAY_HEIGHT, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, .mosaic = 0, @@ -305,7 +305,7 @@ static const struct SpritePalette sSpritePalette_PressStart[] = static const struct OamData sPokemonLogoShineOamData = { - .y = 160, + .y = DISPLAY_HEIGHT, .affineMode = ST_OAM_AFFINE_OFF, .objMode = ST_OAM_OBJ_NORMAL, .mosaic = 0, @@ -430,7 +430,7 @@ static void CreateCopyrightBanner(s16 x, s16 y) static void SpriteCB_PokemonLogoShine(struct Sprite *sprite) { - if (sprite->pos1.x < 272) + if (sprite->pos1.x < DISPLAY_WIDTH + 32) { if (sprite->data[0]) // Flash background { @@ -473,7 +473,7 @@ static void SpriteCB_PokemonLogoShine(struct Sprite *sprite) static void SpriteCB_PokemonLogoShine2(struct Sprite *sprite) { - if (sprite->pos1.x < 272) + if (sprite->pos1.x < DISPLAY_WIDTH + 32) sprite->pos1.x += 8; else DestroySprite(sprite); diff --git a/src/trade.c b/src/trade.c index f423b20af..cb3db3c18 100644 --- a/src/trade.c +++ b/src/trade.c @@ -1318,8 +1318,8 @@ static void TradeMenuMoveCursor(u8 *cursorPosition, u8 direction) if (newPosition == (PARTY_SIZE * 2)) // CANCEL { StartSpriteAnim(&gSprites[sTradeMenuData->cursorSpriteIdx], 1); - gSprites[sTradeMenuData->cursorSpriteIdx].pos1.x = 224; - gSprites[sTradeMenuData->cursorSpriteIdx].pos1.y = 160; + gSprites[sTradeMenuData->cursorSpriteIdx].pos1.x = DISPLAY_WIDTH - 16; + gSprites[sTradeMenuData->cursorSpriteIdx].pos1.y = DISPLAY_HEIGHT; } else { @@ -3496,7 +3496,8 @@ static bool8 AnimateTradeSequenceCable(void) case 38: gSprites[sTradeData->pokePicSpriteIdxs[TRADE_PLAYER]].pos2.y -= 3; gSprites[sTradeData->pokePicSpriteIdxs[TRADE_PARTNER]].pos2.y += 3; - if (gSprites[sTradeData->pokePicSpriteIdxs[TRADE_PLAYER]].pos2.y < -160 && gSprites[sTradeData->pokePicSpriteIdxs[TRADE_PLAYER]].pos2.y >= -163) + if (gSprites[sTradeData->pokePicSpriteIdxs[TRADE_PLAYER]].pos2.y < -DISPLAY_HEIGHT + && gSprites[sTradeData->pokePicSpriteIdxs[TRADE_PLAYER]].pos2.y >= -DISPLAY_HEIGHT - 3) { PlaySE(SE_WARP_IN); } @@ -3994,7 +3995,8 @@ static bool8 AnimateTradeSequenceWireless(void) case 38: gSprites[sTradeData->pokePicSpriteIdxs[TRADE_PLAYER]].pos2.y -= 3; gSprites[sTradeData->pokePicSpriteIdxs[TRADE_PARTNER]].pos2.y += 3; - if (gSprites[sTradeData->pokePicSpriteIdxs[TRADE_PLAYER]].pos2.y < -160 && gSprites[sTradeData->pokePicSpriteIdxs[TRADE_PLAYER]].pos2.y >= -163) + if (gSprites[sTradeData->pokePicSpriteIdxs[TRADE_PLAYER]].pos2.y < -DISPLAY_HEIGHT + && gSprites[sTradeData->pokePicSpriteIdxs[TRADE_PLAYER]].pos2.y >= -DISPLAY_HEIGHT - 3) { PlaySE(SE_WARP_IN); } @@ -4833,7 +4835,7 @@ static void c3_0805465C(u8 taskId) { sTradeData->wirelessWinLeft = sTradeData->wirelessWinRight = 120; sTradeData->wirelessWinTop = 0; - sTradeData->wirelessWinBottom = 160; + sTradeData->wirelessWinBottom = DISPLAY_HEIGHT; SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON); SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_OBJ); SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG0 | diff --git a/src/union_room_chat.c b/src/union_room_chat.c index 3733abe1e..fb875bbb4 100755 --- a/src/union_room_chat.c +++ b/src/union_room_chat.c @@ -3011,8 +3011,8 @@ static void ResetGpuBgState(void) SetGpuReg(REG_OFFSET_BLDCNT, 0); ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_WIN1_ON | DISPCNT_OBJWIN_ON); SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON); - SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(64, 240)); - SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(0, 144)); + SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(64, DISPLAY_WIDTH)); + SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(0, DISPLAY_HEIGHT - 16)); SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG0 | WININ_WIN0_BG2 | WININ_WIN0_BG3 | WININ_WIN0_OBJ | WININ_WIN0_CLR); SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG_ALL | WINOUT_WIN01_OBJ | WINOUT_WIN01_CLR); diff --git a/src/wallclock.c b/src/wallclock.c index 4d1c1fd8f..70888ac5f 100644 --- a/src/wallclock.c +++ b/src/wallclock.c @@ -147,7 +147,7 @@ static const struct SpritePalette sSpritePalettes_Clock[] = static const struct OamData sOam_ClockHand = { - .y = 160, + .y = DISPLAY_HEIGHT, .shape = SPRITE_SHAPE(64x64), .size = SPRITE_SIZE(64x64), .priority = 1, @@ -199,7 +199,7 @@ static const struct SpriteTemplate sSpriteTemplate_HourHand = static const struct OamData sOam_PeriodIndicator = { - .y = 160, + .y = DISPLAY_HEIGHT, .shape = SPRITE_SHAPE(16x16), .size = SPRITE_SIZE(16x16), .priority = 3,