mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 03:34:15 +01:00
Merge pull request #1851 from GriffinRichards/doc-fldspc
Document remaining field_specials task data
This commit is contained in:
commit
c32fbf594a
@ -48,21 +48,24 @@ BirthIsland_Exterior_EventScript_Triangle::
|
||||
special DoDeoxysRockInteraction
|
||||
waitstate
|
||||
switch VAR_RESULT
|
||||
case 0, BirthIsland_Exterior_EventScript_NotSolved1
|
||||
case 1, BirthIsland_Exterior_EventScript_NotSolved2
|
||||
case 2, BirthIsland_Exterior_EventScript_Deoxys
|
||||
case 3, BirthIsland_Exterior_EventScript_NotSolved3
|
||||
case DEOXYS_ROCK_FAILED, BirthIsland_Exterior_EventScript_Failed
|
||||
case DEOXYS_ROCK_PROGRESSED, BirthIsland_Exterior_EventScript_Progressed
|
||||
case DEOXYS_ROCK_SOLVED, BirthIsland_Exterior_EventScript_Deoxys
|
||||
case DEOXYS_ROCK_COMPLETE, BirthIsland_Exterior_EventScript_Complete
|
||||
end
|
||||
|
||||
BirthIsland_Exterior_EventScript_NotSolved1::
|
||||
@ The actual rock triangle movement is handled by DoDeoxysRockInteraction.
|
||||
@ Unless the player has solved the puzzle and needs to encounter Deoxys,
|
||||
@ there's nothing else the script needs to do.
|
||||
BirthIsland_Exterior_EventScript_Failed::
|
||||
release
|
||||
end
|
||||
|
||||
BirthIsland_Exterior_EventScript_NotSolved2::
|
||||
BirthIsland_Exterior_EventScript_Progressed::
|
||||
release
|
||||
end
|
||||
|
||||
BirthIsland_Exterior_EventScript_NotSolved3::
|
||||
BirthIsland_Exterior_EventScript_Complete::
|
||||
release
|
||||
end
|
||||
|
||||
|
@ -38,7 +38,7 @@ PetalburgCity_OnFrame:
|
||||
PetalburgCity_EventScript_WallyTutorial::
|
||||
lockall
|
||||
special SavePlayerParty
|
||||
special PutZigzagoonInPlayerParty
|
||||
special LoadWallyZigzagoon
|
||||
applymovement LOCALID_WALLY, PetalburgCity_Movement_WallyTutorialWally
|
||||
applymovement OBJ_EVENT_ID_PLAYER, PetalburgCity_Movement_WallyTutorialPlayer
|
||||
waitmovement 0
|
||||
|
@ -311,7 +311,7 @@ gSpecials::
|
||||
def_special TryUpdateRusturfTunnelState
|
||||
def_special IsGrassTypeInParty
|
||||
def_special DoContestHallWarp
|
||||
def_special PutZigzagoonInPlayerParty
|
||||
def_special LoadWallyZigzagoon
|
||||
def_special IsStarterInParty
|
||||
def_special CopyCurSecretBaseOwnerName_StrVar1
|
||||
def_special ScriptCheckFreePokemonStorageSpace
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef GUARD_CONSTANTS_BATTLE_PYRAMID_H
|
||||
#define GUARD_CONSTANTS_BATTLE_PYRAMID_H
|
||||
|
||||
#define TOTAL_ROUNDS 20
|
||||
#define TOTAL_PYRAMID_ROUNDS 20
|
||||
#define PICKUP_ITEMS_PER_ROUND 10
|
||||
|
||||
#define HINT_EXIT_DIRECTION 0
|
||||
|
@ -80,4 +80,10 @@
|
||||
#define FANCOUNTER_FINISHED_CONTEST 2
|
||||
#define FANCOUNTER_USED_BATTLE_TOWER 3
|
||||
|
||||
// Return values for DoDeoxysRockInteraction
|
||||
#define DEOXYS_ROCK_FAILED 0
|
||||
#define DEOXYS_ROCK_PROGRESSED 1
|
||||
#define DEOXYS_ROCK_SOLVED 2
|
||||
#define DEOXYS_ROCK_COMPLETE 3
|
||||
|
||||
#endif // GUARD_CONSTANTS_FIELD_SPECIALS_H
|
||||
|
@ -284,7 +284,7 @@ static const u8 sFloorTemplateOffsets[FRONTIER_STAGES_PER_CHALLENGE] =
|
||||
0, 4, 9, 14, 19, 24, 29
|
||||
};
|
||||
|
||||
static const u16 sPickupItemsLvl50[TOTAL_ROUNDS][PICKUP_ITEMS_PER_ROUND] =
|
||||
static const u16 sPickupItemsLvl50[TOTAL_PYRAMID_ROUNDS][PICKUP_ITEMS_PER_ROUND] =
|
||||
{
|
||||
{ITEM_HYPER_POTION, ITEM_FLUFFY_TAIL, ITEM_CHERI_BERRY, ITEM_ETHER, ITEM_LUM_BERRY, ITEM_REVIVE, ITEM_BRIGHT_POWDER, ITEM_SHELL_BELL, ITEM_MAX_REVIVE, ITEM_SACRED_ASH},
|
||||
{ITEM_HYPER_POTION, ITEM_DIRE_HIT, ITEM_PECHA_BERRY, ITEM_ETHER, ITEM_LEPPA_BERRY, ITEM_REVIVE, ITEM_LEFTOVERS, ITEM_CHOICE_BAND, ITEM_FULL_RESTORE, ITEM_MAX_ELIXIR},
|
||||
@ -308,7 +308,7 @@ static const u16 sPickupItemsLvl50[TOTAL_ROUNDS][PICKUP_ITEMS_PER_ROUND] =
|
||||
{ITEM_HYPER_POTION, ITEM_X_DEFEND, ITEM_LUM_BERRY, ITEM_ETHER, ITEM_LEPPA_BERRY, ITEM_REVIVE, ITEM_QUICK_CLAW, ITEM_KINGS_ROCK, ITEM_FULL_RESTORE, ITEM_MAX_ELIXIR},
|
||||
};
|
||||
|
||||
static const u16 sPickupItemsLvlOpen[TOTAL_ROUNDS][PICKUP_ITEMS_PER_ROUND] =
|
||||
static const u16 sPickupItemsLvlOpen[TOTAL_PYRAMID_ROUNDS][PICKUP_ITEMS_PER_ROUND] =
|
||||
{
|
||||
{ITEM_HYPER_POTION, ITEM_FLUFFY_TAIL, ITEM_CHERI_BERRY, ITEM_ETHER, ITEM_LUM_BERRY, ITEM_REVIVE, ITEM_BRIGHT_POWDER, ITEM_SHELL_BELL, ITEM_MAX_REVIVE, ITEM_SACRED_ASH},
|
||||
{ITEM_HYPER_POTION, ITEM_DIRE_HIT, ITEM_PECHA_BERRY, ITEM_ETHER, ITEM_LEPPA_BERRY, ITEM_REVIVE, ITEM_LEFTOVERS, ITEM_CHOICE_BAND, ITEM_FULL_RESTORE, ITEM_MAX_ELIXIR},
|
||||
@ -977,10 +977,10 @@ static void SetPickupItem(void)
|
||||
u8 id;
|
||||
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
|
||||
u32 floor = gSaveBlock2Ptr->frontier.curChallengeBattleNum;
|
||||
u32 round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / FRONTIER_STAGES_PER_CHALLENGE) % TOTAL_ROUNDS;
|
||||
u32 round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / FRONTIER_STAGES_PER_CHALLENGE) % TOTAL_PYRAMID_ROUNDS;
|
||||
|
||||
if (round >= TOTAL_ROUNDS)
|
||||
round = TOTAL_ROUNDS - 1;
|
||||
if (round >= TOTAL_PYRAMID_ROUNDS)
|
||||
round = TOTAL_PYRAMID_ROUNDS - 1;
|
||||
|
||||
id = GetPyramidFloorTemplateId();
|
||||
itemIndex = (gSpecialVar_LastTalked - sPyramidFloorTemplates[id].numTrainers) - 1;
|
||||
@ -1345,10 +1345,10 @@ void GenerateBattlePyramidWildMon(void)
|
||||
const struct PyramidWildMon *wildMons;
|
||||
u32 id;
|
||||
u32 lvl = gSaveBlock2Ptr->frontier.lvlMode;
|
||||
u16 round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvl] / FRONTIER_STAGES_PER_CHALLENGE) % TOTAL_ROUNDS;
|
||||
u16 round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvl] / FRONTIER_STAGES_PER_CHALLENGE) % TOTAL_PYRAMID_ROUNDS;
|
||||
|
||||
if (round >= TOTAL_ROUNDS)
|
||||
round = TOTAL_ROUNDS - 1;
|
||||
if (round >= TOTAL_PYRAMID_ROUNDS)
|
||||
round = TOTAL_PYRAMID_ROUNDS - 1;
|
||||
|
||||
if (lvl != FRONTIER_LVL_50)
|
||||
wildMons = sOpenLevelWildMonPointers[round];
|
||||
@ -1961,8 +1961,8 @@ u16 GetBattlePyramidPickupItemId(void)
|
||||
u32 lvlMode = gSaveBlock2Ptr->frontier.lvlMode;
|
||||
int round = (gSaveBlock2Ptr->frontier.pyramidWinStreaks[lvlMode] / FRONTIER_STAGES_PER_CHALLENGE);
|
||||
|
||||
if (round >= TOTAL_ROUNDS)
|
||||
round = TOTAL_ROUNDS - 1;
|
||||
if (round >= TOTAL_PYRAMID_ROUNDS)
|
||||
round = TOTAL_PYRAMID_ROUNDS - 1;
|
||||
|
||||
rand = Random() % 100;
|
||||
|
||||
|
@ -1038,7 +1038,7 @@ static const struct PyramidWildMon sOpenLevelWildMons_Round20[] =
|
||||
}
|
||||
};
|
||||
|
||||
static const struct PyramidWildMon *const sOpenLevelWildMonPointers[TOTAL_ROUNDS] =
|
||||
static const struct PyramidWildMon *const sOpenLevelWildMonPointers[TOTAL_PYRAMID_ROUNDS] =
|
||||
{
|
||||
sOpenLevelWildMons_Round1,
|
||||
sOpenLevelWildMons_Round2,
|
||||
|
@ -3831,26 +3831,38 @@ static void SpriteCB_DeoxysRockFragment(struct Sprite *sprite)
|
||||
DestroySprite(sprite);
|
||||
}
|
||||
|
||||
// Task data for Task_MoveDeoxysRock
|
||||
#define tState data[0]
|
||||
#define tSpriteId data[1]
|
||||
#define tTargetX data[2]
|
||||
#define tTargetY data[3]
|
||||
#define tCurX data[4]
|
||||
#define tCurY data[5]
|
||||
#define tVelocityX data[6]
|
||||
#define tVelocityY data[7]
|
||||
#define tMoveSteps data[8]
|
||||
#define tObjEventId data[9]
|
||||
|
||||
bool8 FldEff_MoveDeoxysRock(struct Sprite *sprite)
|
||||
{
|
||||
u8 objectEventIdBuffer;
|
||||
if (!TryGetObjectEventIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2], &objectEventIdBuffer))
|
||||
u8 objectEventId;
|
||||
if (!TryGetObjectEventIdByLocalIdAndMap(gFieldEffectArguments[0], gFieldEffectArguments[1], gFieldEffectArguments[2], &objectEventId))
|
||||
{
|
||||
struct ObjectEvent *object;
|
||||
int xPos, yPos;
|
||||
u8 taskId;
|
||||
object = &gObjectEvents[objectEventIdBuffer];
|
||||
object = &gObjectEvents[objectEventId];
|
||||
xPos = object->currentCoords.x - MAP_OFFSET;
|
||||
yPos = object->currentCoords.y - MAP_OFFSET;
|
||||
xPos = (gFieldEffectArguments[3] - xPos) * 16;
|
||||
yPos = (gFieldEffectArguments[4] - yPos) * 16;
|
||||
ShiftObjectEventCoords(object, gFieldEffectArguments[3] + MAP_OFFSET, gFieldEffectArguments[4] + MAP_OFFSET);
|
||||
taskId = CreateTask(Task_MoveDeoxysRock, 80);
|
||||
gTasks[taskId].data[1] = object->spriteId;
|
||||
gTasks[taskId].data[2] = gSprites[object->spriteId].x + xPos;
|
||||
gTasks[taskId].data[3] = gSprites[object->spriteId].y + yPos;
|
||||
gTasks[taskId].data[8] = gFieldEffectArguments[5];
|
||||
gTasks[taskId].data[9] = objectEventIdBuffer;
|
||||
gTasks[taskId].tSpriteId = object->spriteId;
|
||||
gTasks[taskId].tTargetX = gSprites[object->spriteId].x + xPos;
|
||||
gTasks[taskId].tTargetY = gSprites[object->spriteId].y + yPos;
|
||||
gTasks[taskId].tMoveSteps = gFieldEffectArguments[5];
|
||||
gTasks[taskId].tObjEventId = objectEventId;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
@ -3858,29 +3870,30 @@ bool8 FldEff_MoveDeoxysRock(struct Sprite *sprite)
|
||||
static void Task_MoveDeoxysRock(u8 taskId)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
struct Sprite *sprite = &gSprites[data[1]];
|
||||
switch (data[0])
|
||||
struct Sprite *sprite = &gSprites[tSpriteId];
|
||||
switch (tState)
|
||||
{
|
||||
case 0:
|
||||
data[4] = sprite->x << 4;
|
||||
data[5] = sprite->y << 4;
|
||||
data[6] = SAFE_DIV(data[2] * 16 - data[4], data[8]);
|
||||
data[7] = SAFE_DIV(data[3] * 16 - data[5], data[8]);
|
||||
data[0]++;
|
||||
tCurX = sprite->x << 4;
|
||||
tCurY = sprite->y << 4;
|
||||
tVelocityX = SAFE_DIV(tTargetX * 16 - tCurX, tMoveSteps);
|
||||
tVelocityY = SAFE_DIV(tTargetY * 16 - tCurY, tMoveSteps);
|
||||
tState++;
|
||||
// fallthrough
|
||||
case 1:
|
||||
if (data[8] != 0)
|
||||
if (tMoveSteps != 0)
|
||||
{
|
||||
data[8]--;
|
||||
data[4] += data[6];
|
||||
data[5] += data[7];
|
||||
sprite->x = data[4] >> 4;
|
||||
sprite->y = data[5] >> 4;
|
||||
tMoveSteps--;
|
||||
tCurX += tVelocityX;
|
||||
tCurY += tVelocityY;
|
||||
sprite->x = tCurX >> 4;
|
||||
sprite->y = tCurY >> 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
struct ObjectEvent *object = &gObjectEvents[data[9]];
|
||||
sprite->x = data[2];
|
||||
sprite->y = data[3];
|
||||
struct ObjectEvent *object = &gObjectEvents[tObjEventId];
|
||||
sprite->x = tTargetX;
|
||||
sprite->y = tTargetY;
|
||||
ShiftStillObjectEventCoords(object);
|
||||
object->triggerGroundEffectsOnStop = TRUE;
|
||||
FieldEffectActiveListRemove(FLDEFF_MOVE_DEOXYS_ROCK);
|
||||
@ -3890,3 +3903,13 @@ static void Task_MoveDeoxysRock(u8 taskId)
|
||||
}
|
||||
}
|
||||
|
||||
#undef tState
|
||||
#undef tSpriteId
|
||||
#undef tTargetX
|
||||
#undef tTargetY
|
||||
#undef tCurX
|
||||
#undef tCurY
|
||||
#undef tVelocityX
|
||||
#undef tVelocityY
|
||||
#undef tMoveSteps
|
||||
#undef tObjEventId
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "wallclock.h"
|
||||
#include "window.h"
|
||||
#include "constants/battle_frontier.h"
|
||||
#include "constants/battle_pyramid.h"
|
||||
#include "constants/battle_tower.h"
|
||||
#include "constants/decorations.h"
|
||||
#include "constants/event_objects.h"
|
||||
@ -66,6 +67,15 @@
|
||||
#include "constants/metatile_labels.h"
|
||||
#include "palette.h"
|
||||
|
||||
#define TAG_ITEM_ICON 5500
|
||||
|
||||
#define GFXTAG_MULTICHOICE_SCROLL_ARROWS 2000
|
||||
#define PALTAG_MULTICHOICE_SCROLL_ARROWS 100
|
||||
|
||||
#define ELEVATOR_WINDOW_WIDTH 3
|
||||
#define ELEVATOR_WINDOW_HEIGHT 3
|
||||
#define ELEVATOR_LIGHT_STAGES 3
|
||||
|
||||
EWRAM_DATA bool8 gBikeCyclingChallenge = FALSE;
|
||||
EWRAM_DATA u8 gBikeCollisions = 0;
|
||||
static EWRAM_DATA u32 sBikeCyclingTimer = 0;
|
||||
@ -94,8 +104,8 @@ static void LoadLinkPartnerObjectEventSpritePalette(u8, u8, u8);
|
||||
static void Task_PetalburgGymSlideOpenRoomDoors(u8);
|
||||
static void PetalburgGymSetDoorMetatiles(u8, u16);
|
||||
static void Task_PCTurnOnEffect(u8);
|
||||
static void PCTurnOnEffect_0(struct Task *);
|
||||
static void PCTurnOnEffect_1(s16, s8, s8);
|
||||
static void PCTurnOnEffect(struct Task *);
|
||||
static void PCTurnOnEffect_SetMetatile(s16, s8, s8);
|
||||
static void PCTurnOffEffect(void);
|
||||
static void Task_LotteryCornerComputerEffect(u8);
|
||||
static void LotteryCornerComputerEffect(struct Task *);
|
||||
@ -966,34 +976,44 @@ void FieldShowRegionMap(void)
|
||||
SetMainCallback2(CB2_FieldShowRegionMap);
|
||||
}
|
||||
|
||||
// Task data for Task_PCTurnOnEffect and Task_LotteryCornerComputerEffect
|
||||
#define tPaused data[0] // Never set
|
||||
#define tTaskId data[1]
|
||||
#define tFlickerCount data[2]
|
||||
#define tTimer data[3]
|
||||
#define tIsScreenOn data[4]
|
||||
|
||||
// For this special, gSpecialVar_0x8004 is expected to be some PC_LOCATION_* value.
|
||||
void DoPCTurnOnEffect(void)
|
||||
{
|
||||
if (FuncIsActiveTask(Task_PCTurnOnEffect) != TRUE)
|
||||
{
|
||||
u8 taskId = CreateTask(Task_PCTurnOnEffect, 8);
|
||||
gTasks[taskId].data[0] = 0;
|
||||
gTasks[taskId].data[1] = taskId;
|
||||
gTasks[taskId].data[2] = 0;
|
||||
gTasks[taskId].data[3] = 0;
|
||||
gTasks[taskId].data[4] = 0;
|
||||
gTasks[taskId].tPaused = FALSE;
|
||||
gTasks[taskId].tTaskId = taskId;
|
||||
gTasks[taskId].tFlickerCount = 0;
|
||||
gTasks[taskId].tTimer = 0;
|
||||
gTasks[taskId].tIsScreenOn = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void Task_PCTurnOnEffect(u8 taskId)
|
||||
{
|
||||
struct Task *task = &gTasks[taskId];
|
||||
if (task->data[0] == 0)
|
||||
PCTurnOnEffect_0(task);
|
||||
if (!task->tPaused)
|
||||
PCTurnOnEffect(task);
|
||||
}
|
||||
|
||||
static void PCTurnOnEffect_0(struct Task *task)
|
||||
static void PCTurnOnEffect(struct Task *task)
|
||||
{
|
||||
u8 playerDirection;
|
||||
s8 dx = 0;
|
||||
s8 dy = 0;
|
||||
if (task->data[3] == 6)
|
||||
if (task->tTimer == 6)
|
||||
{
|
||||
task->data[3] = 0;
|
||||
task->tTimer = 0;
|
||||
|
||||
// Get where the PC should be, depending on where the player is looking.
|
||||
playerDirection = GetPlayerFacingDirection();
|
||||
switch (playerDirection)
|
||||
{
|
||||
@ -1010,39 +1030,47 @@ static void PCTurnOnEffect_0(struct Task *task)
|
||||
dy = -1;
|
||||
break;
|
||||
}
|
||||
PCTurnOnEffect_1(task->data[4], dx, dy);
|
||||
|
||||
// Update map
|
||||
PCTurnOnEffect_SetMetatile(task->tIsScreenOn, dx, dy);
|
||||
DrawWholeMapView();
|
||||
task->data[4] ^= 1;
|
||||
if ((++task->data[2]) == 5)
|
||||
DestroyTask(task->data[1]);
|
||||
|
||||
// Screen flickers 5 times. Odd number and starting with the
|
||||
// screen off means the animation ends with the screen on.
|
||||
task->tIsScreenOn ^= 1;
|
||||
if (++task->tFlickerCount == 5)
|
||||
DestroyTask(task->tTaskId);
|
||||
}
|
||||
task->data[3]++;
|
||||
task->tTimer++;
|
||||
}
|
||||
|
||||
static void PCTurnOnEffect_1(s16 isPcTurnedOn, s8 dx, s8 dy)
|
||||
static void PCTurnOnEffect_SetMetatile(s16 isScreenOn, s8 dx, s8 dy)
|
||||
{
|
||||
u16 tileId = 0;
|
||||
if (isPcTurnedOn)
|
||||
u16 metatileId = 0;
|
||||
if (isScreenOn)
|
||||
{
|
||||
// Screen is on, set it off
|
||||
if (gSpecialVar_0x8004 == PC_LOCATION_OTHER)
|
||||
tileId = METATILE_Building_PC_Off;
|
||||
metatileId = METATILE_Building_PC_Off;
|
||||
else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE)
|
||||
tileId = METATILE_BrendansMaysHouse_BrendanPC_Off;
|
||||
metatileId = METATILE_BrendansMaysHouse_BrendanPC_Off;
|
||||
else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE)
|
||||
tileId = METATILE_BrendansMaysHouse_MayPC_Off;
|
||||
metatileId = METATILE_BrendansMaysHouse_MayPC_Off;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Screen is off, set it on
|
||||
if (gSpecialVar_0x8004 == PC_LOCATION_OTHER)
|
||||
tileId = METATILE_Building_PC_On;
|
||||
metatileId = METATILE_Building_PC_On;
|
||||
else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE)
|
||||
tileId = METATILE_BrendansMaysHouse_BrendanPC_On;
|
||||
metatileId = METATILE_BrendansMaysHouse_BrendanPC_On;
|
||||
else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE)
|
||||
tileId = METATILE_BrendansMaysHouse_MayPC_On;
|
||||
metatileId = METATILE_BrendansMaysHouse_MayPC_On;
|
||||
}
|
||||
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, tileId | MAPGRID_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, metatileId | MAPGRID_COLLISION_MASK);
|
||||
}
|
||||
|
||||
// For this special, gSpecialVar_0x8004 is expected to be some PC_LOCATION_* value.
|
||||
void DoPCTurnOffEffect(void)
|
||||
{
|
||||
PCTurnOffEffect();
|
||||
@ -1052,7 +1080,9 @@ static void PCTurnOffEffect(void)
|
||||
{
|
||||
s8 dx = 0;
|
||||
s8 dy = 0;
|
||||
u16 tileId = 0;
|
||||
u16 metatileId = 0;
|
||||
|
||||
// Get where the PC should be, depending on where the player is looking.
|
||||
u8 playerDirection = GetPlayerFacingDirection();
|
||||
switch (playerDirection)
|
||||
{
|
||||
@ -1069,13 +1099,15 @@ static void PCTurnOffEffect(void)
|
||||
dy = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (gSpecialVar_0x8004 == PC_LOCATION_OTHER)
|
||||
tileId = METATILE_Building_PC_Off;
|
||||
metatileId = METATILE_Building_PC_Off;
|
||||
else if (gSpecialVar_0x8004 == PC_LOCATION_BRENDANS_HOUSE)
|
||||
tileId = METATILE_BrendansMaysHouse_BrendanPC_Off;
|
||||
metatileId = METATILE_BrendansMaysHouse_BrendanPC_Off;
|
||||
else if (gSpecialVar_0x8004 == PC_LOCATION_MAYS_HOUSE)
|
||||
tileId = METATILE_BrendansMaysHouse_MayPC_Off;
|
||||
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, tileId | MAPGRID_COLLISION_MASK);
|
||||
metatileId = METATILE_BrendansMaysHouse_MayPC_Off;
|
||||
|
||||
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + dx + MAP_OFFSET, gSaveBlock1Ptr->pos.y + dy + MAP_OFFSET, metatileId | MAPGRID_COLLISION_MASK);
|
||||
DrawWholeMapView();
|
||||
}
|
||||
|
||||
@ -1084,42 +1116,47 @@ void DoLotteryCornerComputerEffect(void)
|
||||
if (FuncIsActiveTask(Task_LotteryCornerComputerEffect) != TRUE)
|
||||
{
|
||||
u8 taskId = CreateTask(Task_LotteryCornerComputerEffect, 8);
|
||||
gTasks[taskId].data[0] = 0;
|
||||
gTasks[taskId].data[1] = taskId;
|
||||
gTasks[taskId].data[2] = 0;
|
||||
gTasks[taskId].data[3] = 0;
|
||||
gTasks[taskId].data[4] = 0;
|
||||
gTasks[taskId].tPaused = FALSE;
|
||||
gTasks[taskId].tTaskId = taskId;
|
||||
gTasks[taskId].tFlickerCount = 0;
|
||||
gTasks[taskId].tTimer = 0;
|
||||
gTasks[taskId].tIsScreenOn = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void Task_LotteryCornerComputerEffect(u8 taskId)
|
||||
{
|
||||
struct Task *task = &gTasks[taskId];
|
||||
if (task->data[0] == 0)
|
||||
if (!task->tPaused)
|
||||
LotteryCornerComputerEffect(task);
|
||||
}
|
||||
|
||||
static void LotteryCornerComputerEffect(struct Task *task)
|
||||
{
|
||||
if (task->data[3] == 6)
|
||||
if (task->tTimer == 6)
|
||||
{
|
||||
task->data[3] = 0;
|
||||
if (task->data[4] != 0)
|
||||
task->tTimer = 0;
|
||||
if (task->tIsScreenOn)
|
||||
{
|
||||
// Screen is on, set it off
|
||||
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Shop_Laptop1_Normal | MAPGRID_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Shop_Laptop2_Normal | MAPGRID_COLLISION_MASK);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Screen is off, set it on
|
||||
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 1 + MAP_OFFSET, METATILE_Shop_Laptop1_Flash | MAPGRID_COLLISION_MASK);
|
||||
MapGridSetMetatileIdAt(11 + MAP_OFFSET, 2 + MAP_OFFSET, METATILE_Shop_Laptop2_Flash | MAPGRID_COLLISION_MASK);
|
||||
}
|
||||
DrawWholeMapView();
|
||||
task->data[4] ^= 1;
|
||||
if ((++task->data[2]) == 5)
|
||||
DestroyTask(task->data[1]);
|
||||
|
||||
// Screen flickers 5 times. Odd number and starting with the
|
||||
// screen off means the animation ends with the screen on.
|
||||
task->tIsScreenOn ^= 1;
|
||||
if (++task->tFlickerCount == 5)
|
||||
DestroyTask(task->tTaskId);
|
||||
}
|
||||
task->data[3]++;
|
||||
task->tTimer++;
|
||||
}
|
||||
|
||||
void EndLotteryCornerComputerEffect(void)
|
||||
@ -1129,6 +1166,12 @@ void EndLotteryCornerComputerEffect(void)
|
||||
DrawWholeMapView();
|
||||
}
|
||||
|
||||
#undef tPaused
|
||||
#undef tTaskId
|
||||
#undef tFlickerCount
|
||||
#undef tTimer
|
||||
#undef tIsScreenOn
|
||||
|
||||
void SetTrickHouseNuggetFlag(void)
|
||||
{
|
||||
u16 *specVar = &gSpecialVar_0x8004;
|
||||
@ -1213,7 +1256,7 @@ void SpawnCameraObject(void)
|
||||
OBJ_EVENT_ID_CAMERA,
|
||||
gSaveBlock1Ptr->pos.x + MAP_OFFSET,
|
||||
gSaveBlock1Ptr->pos.y + MAP_OFFSET,
|
||||
3);
|
||||
3); // elevation
|
||||
gObjectEvents[obj].invisible = TRUE;
|
||||
CameraObjectSetFollowedSpriteId(gObjectEvents[obj].spriteId);
|
||||
}
|
||||
@ -1378,7 +1421,7 @@ void SetShoalItemFlag(u16 unused)
|
||||
FlagSet(FLAG_SYS_SHOAL_ITEM);
|
||||
}
|
||||
|
||||
void PutZigzagoonInPlayerParty(void)
|
||||
void LoadWallyZigzagoon(void)
|
||||
{
|
||||
u16 monData;
|
||||
CreateMon(&gPlayerParty[0], SPECIES_ZIGZAGOON, 7, USE_RANDOM_IVS, FALSE, 0, OT_ID_PLAYER_ID, 0);
|
||||
@ -1418,20 +1461,21 @@ bool8 IsPokerusInParty(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#define horizontalPan data[0]
|
||||
#define delayCounter data[1]
|
||||
#define numShakes data[2]
|
||||
#define delay data[3]
|
||||
#define verticalPan data[4]
|
||||
// Task data for Task_ShakeCamera
|
||||
#define tHorizontalPan data[0]
|
||||
#define tDelayCounter data[1]
|
||||
#define tNumShakes data[2]
|
||||
#define tDelay data[3]
|
||||
#define tVerticalPan data[4]
|
||||
|
||||
void ShakeCamera(void)
|
||||
{
|
||||
u8 taskId = CreateTask(Task_ShakeCamera, 9);
|
||||
gTasks[taskId].horizontalPan = gSpecialVar_0x8005;
|
||||
gTasks[taskId].delayCounter = 0;
|
||||
gTasks[taskId].numShakes = gSpecialVar_0x8006;
|
||||
gTasks[taskId].delay = gSpecialVar_0x8007;
|
||||
gTasks[taskId].verticalPan = gSpecialVar_0x8004;
|
||||
gTasks[taskId].tHorizontalPan = gSpecialVar_0x8005;
|
||||
gTasks[taskId].tDelayCounter = 0;
|
||||
gTasks[taskId].tNumShakes = gSpecialVar_0x8006;
|
||||
gTasks[taskId].tDelay = gSpecialVar_0x8007;
|
||||
gTasks[taskId].tVerticalPan = gSpecialVar_0x8004;
|
||||
SetCameraPanningCallback(NULL);
|
||||
PlaySE(SE_M_STRENGTH);
|
||||
}
|
||||
@ -1440,15 +1484,15 @@ static void Task_ShakeCamera(u8 taskId)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
|
||||
delayCounter++;
|
||||
if (delayCounter % delay == 0)
|
||||
tDelayCounter++;
|
||||
if (tDelayCounter % tDelay == 0)
|
||||
{
|
||||
delayCounter = 0;
|
||||
numShakes--;
|
||||
horizontalPan = -horizontalPan;
|
||||
verticalPan = -verticalPan;
|
||||
SetCameraPanning(horizontalPan, verticalPan);
|
||||
if (numShakes == 0)
|
||||
tDelayCounter = 0;
|
||||
tNumShakes--;
|
||||
tHorizontalPan = -tHorizontalPan;
|
||||
tVerticalPan = -tVerticalPan;
|
||||
SetCameraPanning(tHorizontalPan, tVerticalPan);
|
||||
if (tNumShakes == 0)
|
||||
{
|
||||
StopCameraShake(taskId);
|
||||
InstallCameraPanAheadCallback();
|
||||
@ -1462,11 +1506,11 @@ static void StopCameraShake(u8 taskId)
|
||||
ScriptContext_Enable();
|
||||
}
|
||||
|
||||
#undef horizontalPan
|
||||
#undef delayCounter
|
||||
#undef numShakes
|
||||
#undef delay
|
||||
#undef verticalPan
|
||||
#undef tHorizontalPan
|
||||
#undef tDelayCounter
|
||||
#undef tNumShakes
|
||||
#undef tDelay
|
||||
#undef tVerticalPan
|
||||
|
||||
bool8 FoundBlackGlasses(void)
|
||||
{
|
||||
@ -1491,7 +1535,8 @@ u8 GetLeadMonIndex(void)
|
||||
u8 partyCount = CalculatePlayerPartyCount();
|
||||
for (i = 0; i < partyCount; i++)
|
||||
{
|
||||
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != SPECIES_EGG && GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != 0)
|
||||
if (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != SPECIES_EGG
|
||||
&& GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2, NULL) != SPECIES_NONE)
|
||||
return i;
|
||||
}
|
||||
return 0;
|
||||
@ -1631,7 +1676,7 @@ void OffsetCameraForBattle(void)
|
||||
SetCameraPanning(8, 0);
|
||||
}
|
||||
|
||||
const struct WindowTemplate gElevatorFloor_WindowTemplate =
|
||||
static const struct WindowTemplate sWindowTemplate_ElevatorFloor =
|
||||
{
|
||||
.bg = 0,
|
||||
.tilemapLeft = 21,
|
||||
@ -1642,7 +1687,7 @@ const struct WindowTemplate gElevatorFloor_WindowTemplate =
|
||||
.baseBlock = 8,
|
||||
};
|
||||
|
||||
const u8 *const gDeptStoreFloorNames[] =
|
||||
static const u8 *const sDeptStoreFloorNames[] =
|
||||
{
|
||||
[DEPT_STORE_FLOORNUM_B4F] = gText_B4F,
|
||||
[DEPT_STORE_FLOORNUM_B3F] = gText_B3F,
|
||||
@ -1662,7 +1707,7 @@ const u8 *const gDeptStoreFloorNames[] =
|
||||
[DEPT_STORE_FLOORNUM_ROOFTOP] = gText_Rooftop
|
||||
};
|
||||
|
||||
static const u16 sElevatorWindowTiles_Ascending[][3] =
|
||||
static const u16 sElevatorWindowTiles_Ascending[ELEVATOR_WINDOW_HEIGHT][ELEVATOR_LIGHT_STAGES] =
|
||||
{
|
||||
{
|
||||
METATILE_BattleFrontier_Elevator_Top0,
|
||||
@ -1681,7 +1726,7 @@ static const u16 sElevatorWindowTiles_Ascending[][3] =
|
||||
},
|
||||
};
|
||||
|
||||
static const u16 sElevatorWindowTiles_Descending[][3] =
|
||||
static const u16 sElevatorWindowTiles_Descending[ELEVATOR_WINDOW_HEIGHT][ELEVATOR_LIGHT_STAGES] =
|
||||
{
|
||||
{
|
||||
METATILE_BattleFrontier_Elevator_Top0,
|
||||
@ -1765,53 +1810,66 @@ u16 GetDeptStoreDefaultFloorChoice(void)
|
||||
return sLilycoveDeptStore_DefaultFloorChoice;
|
||||
}
|
||||
|
||||
// Task data for Task_MoveElevator
|
||||
#define tTimer data[1]
|
||||
#define tMoveCounter data[2]
|
||||
#define tVerticalPan data[4]
|
||||
#define tTotalMoves data[5]
|
||||
#define tDescending data[6]
|
||||
|
||||
// The maximum considered difference between floors.
|
||||
// Elevator trips with a larger difference are treated the same
|
||||
// (i.e. traveling 9 floors and 200 floors would take the same amount of time).
|
||||
#define MAX_ELEVATOR_TRIP 9
|
||||
|
||||
// gSpecialVar_0x8005 here is expected to be the current floor number, and
|
||||
// gSpecialVar_0x8006 is expected to be the destination floor number.
|
||||
void MoveElevator(void)
|
||||
{
|
||||
static const u8 sElevatorTripLength[] = { 8, 16, 24, 32, 38, 46, 52, 56, 57 };
|
||||
static const u8 sElevatorTripLength[MAX_ELEVATOR_TRIP] = { 8, 16, 24, 32, 38, 46, 52, 56, 57 };
|
||||
|
||||
s16 *data = gTasks[CreateTask(Task_MoveElevator, 9)].data;
|
||||
u16 floorDelta;
|
||||
|
||||
data[1] = 0;
|
||||
data[2] = 0;
|
||||
data[4] = 1;
|
||||
tTimer = 0;
|
||||
tMoveCounter = 0;
|
||||
tVerticalPan = 1;
|
||||
|
||||
// descending
|
||||
if (gSpecialVar_0x8005 > gSpecialVar_0x8006)
|
||||
{
|
||||
floorDelta = gSpecialVar_0x8005 - gSpecialVar_0x8006;
|
||||
data[6] = TRUE;
|
||||
tDescending = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
floorDelta = gSpecialVar_0x8006 - gSpecialVar_0x8005;
|
||||
data[6] = FALSE;
|
||||
tDescending = FALSE;
|
||||
}
|
||||
|
||||
if (floorDelta > 8)
|
||||
floorDelta = 8;
|
||||
if (floorDelta > MAX_ELEVATOR_TRIP - 1)
|
||||
floorDelta = MAX_ELEVATOR_TRIP - 1;
|
||||
|
||||
data[5] = sElevatorTripLength[floorDelta];
|
||||
tTotalMoves = sElevatorTripLength[floorDelta];
|
||||
|
||||
SetCameraPanningCallback(NULL);
|
||||
MoveElevatorWindowLights(floorDelta, data[6]);
|
||||
MoveElevatorWindowLights(floorDelta, tDescending);
|
||||
PlaySE(SE_ELEVATOR);
|
||||
}
|
||||
|
||||
static void Task_MoveElevator(u8 taskId)
|
||||
{
|
||||
s16 *data = gTasks[taskId].data;
|
||||
data[1]++;
|
||||
if (data[1] % 3 == 0)
|
||||
tTimer++;
|
||||
if (tTimer % 3 == 0)
|
||||
{
|
||||
data[1] = 0;
|
||||
data[2]++;
|
||||
data[4] = -data[4];
|
||||
SetCameraPanning(0, data[4]);
|
||||
tTimer = 0;
|
||||
tMoveCounter++;
|
||||
tVerticalPan = -tVerticalPan;
|
||||
SetCameraPanning(0, tVerticalPan);
|
||||
|
||||
// arrived at floor
|
||||
if (data[2] == data[5])
|
||||
if (tMoveCounter == tTotalMoves)
|
||||
{
|
||||
// Arrived at floor
|
||||
PlaySE(SE_DING_DONG);
|
||||
DestroyTask(taskId);
|
||||
ScriptContext_Enable();
|
||||
@ -1820,18 +1878,24 @@ static void Task_MoveElevator(u8 taskId)
|
||||
}
|
||||
}
|
||||
|
||||
#undef tTimer
|
||||
#undef tMoveCounter
|
||||
#undef tVerticalPan
|
||||
#undef tTotalMoves
|
||||
#undef tDescending
|
||||
|
||||
void ShowDeptStoreElevatorFloorSelect(void)
|
||||
{
|
||||
int xPos;
|
||||
|
||||
sTutorMoveAndElevatorWindowId = AddWindow(&gElevatorFloor_WindowTemplate);
|
||||
sTutorMoveAndElevatorWindowId = AddWindow(&sWindowTemplate_ElevatorFloor);
|
||||
SetStandardWindowBorderStyle(sTutorMoveAndElevatorWindowId, FALSE);
|
||||
|
||||
xPos = GetStringCenterAlignXOffset(FONT_NORMAL, gText_ElevatorNowOn, 64);
|
||||
AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, FONT_NORMAL, gText_ElevatorNowOn, xPos, 1, TEXT_SKIP_DRAW, NULL);
|
||||
|
||||
xPos = GetStringCenterAlignXOffset(FONT_NORMAL, gDeptStoreFloorNames[gSpecialVar_0x8005], 64);
|
||||
AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, FONT_NORMAL, gDeptStoreFloorNames[gSpecialVar_0x8005], xPos, 17, TEXT_SKIP_DRAW, NULL);
|
||||
xPos = GetStringCenterAlignXOffset(FONT_NORMAL, sDeptStoreFloorNames[gSpecialVar_0x8005], 64);
|
||||
AddTextPrinterParameterized(sTutorMoveAndElevatorWindowId, FONT_NORMAL, sDeptStoreFloorNames[gSpecialVar_0x8005], xPos, 17, TEXT_SKIP_DRAW, NULL);
|
||||
|
||||
PutWindowTilemap(sTutorMoveAndElevatorWindowId);
|
||||
CopyWindowToVram(sTutorMoveAndElevatorWindowId, COPYWIN_FULL);
|
||||
@ -1843,17 +1907,23 @@ void CloseDeptStoreElevatorWindow(void)
|
||||
RemoveWindow(sTutorMoveAndElevatorWindowId);
|
||||
}
|
||||
|
||||
// Task data for Task_MoveElevatorWindowLights
|
||||
#define tMoveCounter data[0]
|
||||
#define tTimer data[1]
|
||||
#define tDescending data[2]
|
||||
#define tTotalMoves data[3]
|
||||
|
||||
static void MoveElevatorWindowLights(u16 floorDelta, bool8 descending)
|
||||
{
|
||||
static const u8 sElevatorLightCycles[] = { 3, 6, 9, 12, 15, 18, 21, 24, 27 };
|
||||
static const u8 sElevatorLightCycles[MAX_ELEVATOR_TRIP] = { 3, 6, 9, 12, 15, 18, 21, 24, 27 };
|
||||
|
||||
if (FuncIsActiveTask(Task_MoveElevatorWindowLights) != TRUE)
|
||||
{
|
||||
u8 taskId = CreateTask(Task_MoveElevatorWindowLights, 8);
|
||||
gTasks[taskId].data[0] = 0;
|
||||
gTasks[taskId].data[1] = 0;
|
||||
gTasks[taskId].data[2] = descending;
|
||||
gTasks[taskId].data[3] = sElevatorLightCycles[floorDelta];
|
||||
gTasks[taskId].tMoveCounter = 0;
|
||||
gTasks[taskId].tTimer = 0;
|
||||
gTasks[taskId].tDescending = descending;
|
||||
gTasks[taskId].tTotalMoves = sElevatorLightCycles[floorDelta];
|
||||
}
|
||||
}
|
||||
|
||||
@ -1862,36 +1932,41 @@ static void Task_MoveElevatorWindowLights(u8 taskId)
|
||||
u8 x, y;
|
||||
s16 *data = gTasks[taskId].data;
|
||||
|
||||
if (data[1] == 6)
|
||||
if (tTimer == 6)
|
||||
{
|
||||
data[0]++;
|
||||
tMoveCounter++;
|
||||
|
||||
// ascending
|
||||
if (data[2] == FALSE)
|
||||
if (!tDescending)
|
||||
{
|
||||
for (y = 0; y < 3; y++)
|
||||
// Ascending
|
||||
for (y = 0; y < ELEVATOR_WINDOW_HEIGHT; y++)
|
||||
{
|
||||
for (x = 0; x < 3; x++)
|
||||
MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Ascending[y][data[0] % 3] | MAPGRID_COLLISION_MASK);
|
||||
for (x = 0; x < ELEVATOR_WINDOW_WIDTH; x++)
|
||||
MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Ascending[y][tMoveCounter % ELEVATOR_LIGHT_STAGES] | MAPGRID_COLLISION_MASK);
|
||||
}
|
||||
}
|
||||
// descending
|
||||
else
|
||||
{
|
||||
for (y = 0; y < 3; y++)
|
||||
// Descending
|
||||
for (y = 0; y < ELEVATOR_WINDOW_HEIGHT; y++)
|
||||
{
|
||||
for (x = 0; x < 3; x++)
|
||||
MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Descending[y][data[0] % 3] | MAPGRID_COLLISION_MASK);
|
||||
for (x = 0; x < ELEVATOR_WINDOW_WIDTH; x++)
|
||||
MapGridSetMetatileIdAt(x + MAP_OFFSET + 1, y + MAP_OFFSET, sElevatorWindowTiles_Descending[y][tMoveCounter % ELEVATOR_LIGHT_STAGES] | MAPGRID_COLLISION_MASK);
|
||||
}
|
||||
}
|
||||
DrawWholeMapView();
|
||||
data[1] = 0;
|
||||
if (data[0] == data[3])
|
||||
tTimer = 0;
|
||||
if (tMoveCounter == tTotalMoves)
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
data[1]++;
|
||||
tTimer++;
|
||||
}
|
||||
|
||||
#undef tMoveCounter
|
||||
#undef tTimer
|
||||
#undef tDescending
|
||||
#undef tTotalMoves
|
||||
|
||||
void BufferVarsForIVRater(void)
|
||||
{
|
||||
u8 i;
|
||||
@ -1953,13 +2028,13 @@ bool8 UsedPokemonCenterWarp(void)
|
||||
MAP_EVER_GRANDE_CITY_POKEMON_LEAGUE_1F,
|
||||
MAP_BATTLE_FRONTIER_POKEMON_CENTER_1F,
|
||||
MAP_UNION_ROOM,
|
||||
0xFFFF
|
||||
MAP_UNDEFINED
|
||||
};
|
||||
|
||||
int i;
|
||||
u16 map = (gLastUsedWarp.mapGroup << 8) + gLastUsedWarp.mapNum;
|
||||
|
||||
for (i = 0; sPokemonCenters[i] != 0xFFFF; i++)
|
||||
for (i = 0; sPokemonCenters[i] != MAP_UNDEFINED; i++)
|
||||
{
|
||||
if (sPokemonCenters[i] == map)
|
||||
return TRUE;
|
||||
@ -2657,21 +2732,21 @@ static void ScrollableMultichoice_UpdateScrollArrows(u8 taskId)
|
||||
.secondY = 0,
|
||||
.fullyUpThreshold = 0,
|
||||
.fullyDownThreshold = 0,
|
||||
.tileTag = 2000,
|
||||
.palTag = 100,
|
||||
.tileTag = GFXTAG_MULTICHOICE_SCROLL_ARROWS,
|
||||
.palTag = PALTAG_MULTICHOICE_SCROLL_ARROWS,
|
||||
.palNum = 0
|
||||
};
|
||||
|
||||
struct Task *task = &gTasks[taskId];
|
||||
struct ScrollArrowsTemplate template = sScrollableMultichoice_ScrollArrowsTemplate;
|
||||
if (task->tMaxItemsOnScreen != task->data[1])
|
||||
if (task->tMaxItemsOnScreen != task->tNumItems)
|
||||
{
|
||||
template.firstX = (task->tWidth / 2) * 8 + 12 + (task->tLeft - 1) * 8;
|
||||
template.firstY = 8;
|
||||
template.secondX = (task->tWidth / 2) * 8 + 12 + (task->tLeft - 1) * 8;
|
||||
template.secondY = task->tHeight * 8 + 10;
|
||||
template.fullyUpThreshold = 0;
|
||||
template.fullyDownThreshold = task->data[1] - task->tMaxItemsOnScreen;
|
||||
template.fullyDownThreshold = task->tNumItems - task->tMaxItemsOnScreen;
|
||||
task->tScrollArrowId = AddScrollIndicatorArrowPair(&template, &sScrollableMultichoice_ScrollOffset);
|
||||
}
|
||||
}
|
||||
@ -2679,10 +2754,8 @@ static void ScrollableMultichoice_UpdateScrollArrows(u8 taskId)
|
||||
static void ScrollableMultichoice_RemoveScrollArrows(u8 taskId)
|
||||
{
|
||||
struct Task *task = &gTasks[taskId];
|
||||
if (task->tMaxItemsOnScreen != task->data[1])
|
||||
{
|
||||
if (task->tMaxItemsOnScreen != task->tNumItems)
|
||||
RemoveScrollIndicatorArrowPair(task->tScrollArrowId);
|
||||
}
|
||||
}
|
||||
|
||||
// Removed for Emerald (replaced by ShowScrollableMultichoice)
|
||||
@ -2906,8 +2979,6 @@ void CloseFrontierExchangeCornerItemIconWindow(void)
|
||||
RemoveWindow(sFrontierExchangeCorner_ItemIconWindowId);
|
||||
}
|
||||
|
||||
#define TAG_ITEM_ICON 5500
|
||||
|
||||
static void FillFrontierExchangeCornerWindowAndItemIcon(u16 menu, u16 selection)
|
||||
{
|
||||
#include "data/battle_frontier/battle_frontier_exchange_corner.h"
|
||||
@ -3188,12 +3259,14 @@ void ScrollableMultichoice_ClosePersistentMenu(void)
|
||||
#undef tListTaskId
|
||||
#undef tTaskId
|
||||
|
||||
#define DEOXYS_ROCK_LEVELS 11
|
||||
|
||||
void DoDeoxysRockInteraction(void)
|
||||
{
|
||||
CreateTask(Task_DeoxysRockInteraction, 8);
|
||||
}
|
||||
|
||||
static const u16 sDeoxysRockPalettes[][16] = {
|
||||
static const u16 sDeoxysRockPalettes[DEOXYS_ROCK_LEVELS][16] = {
|
||||
INCBIN_U16("graphics/field_effects/palettes/deoxys_rock_1.gbapal"),
|
||||
INCBIN_U16("graphics/field_effects/palettes/deoxys_rock_2.gbapal"),
|
||||
INCBIN_U16("graphics/field_effects/palettes/deoxys_rock_3.gbapal"),
|
||||
@ -3207,7 +3280,7 @@ static const u16 sDeoxysRockPalettes[][16] = {
|
||||
INCBIN_U16("graphics/field_effects/palettes/deoxys_rock_11.gbapal"),
|
||||
};
|
||||
|
||||
static const u8 sDeoxysRockCoords[][2] = {
|
||||
static const u8 sDeoxysRockCoords[DEOXYS_ROCK_LEVELS][2] = {
|
||||
{ 15, 12 },
|
||||
{ 11, 14 },
|
||||
{ 15, 8 },
|
||||
@ -3223,11 +3296,11 @@ static const u8 sDeoxysRockCoords[][2] = {
|
||||
|
||||
static void Task_DeoxysRockInteraction(u8 taskId)
|
||||
{
|
||||
static const u8 sStoneMaxStepCounts[] = { 4, 8, 8, 8, 4, 4, 4, 6, 3, 3 };
|
||||
static const u8 sStoneMaxStepCounts[DEOXYS_ROCK_LEVELS - 1] = { 4, 8, 8, 8, 4, 4, 4, 6, 3, 3 };
|
||||
|
||||
if (FlagGet(FLAG_DEOXYS_ROCK_COMPLETE) == TRUE)
|
||||
{
|
||||
gSpecialVar_Result = 3;
|
||||
gSpecialVar_Result = DEOXYS_ROCK_COMPLETE;
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
@ -3242,13 +3315,13 @@ static void Task_DeoxysRockInteraction(u8 taskId)
|
||||
// Player failed to take the shortest path to the stone, so it resets.
|
||||
ChangeDeoxysRockLevel(0);
|
||||
VarSet(VAR_DEOXYS_ROCK_LEVEL, 0);
|
||||
gSpecialVar_Result = 0;
|
||||
gSpecialVar_Result = DEOXYS_ROCK_FAILED;
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
else if (rockLevel == 10)
|
||||
else if (rockLevel == DEOXYS_ROCK_LEVELS - 1)
|
||||
{
|
||||
FlagSet(FLAG_DEOXYS_ROCK_COMPLETE);
|
||||
gSpecialVar_Result = 2;
|
||||
gSpecialVar_Result = DEOXYS_ROCK_SOLVED;
|
||||
ScriptContext_Enable();
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
@ -3257,7 +3330,7 @@ static void Task_DeoxysRockInteraction(u8 taskId)
|
||||
rockLevel++;
|
||||
ChangeDeoxysRockLevel(rockLevel);
|
||||
VarSet(VAR_DEOXYS_ROCK_LEVEL, rockLevel);
|
||||
gSpecialVar_Result = 1;
|
||||
gSpecialVar_Result = DEOXYS_ROCK_PROGRESSED;
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
@ -3270,9 +3343,9 @@ static void ChangeDeoxysRockLevel(u8 rockLevel)
|
||||
TryGetObjectEventIdByLocalIdAndMap(LOCALID_BIRTH_ISLAND_EXTERIOR_ROCK, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &objectEventId);
|
||||
|
||||
if (rockLevel == 0)
|
||||
PlaySE(SE_M_CONFUSE_RAY);
|
||||
PlaySE(SE_M_CONFUSE_RAY); // Failure sound
|
||||
else
|
||||
PlaySE(SE_RG_DEOXYS_MOVE);
|
||||
PlaySE(SE_RG_DEOXYS_MOVE); // Success sound
|
||||
|
||||
CreateTask(WaitForDeoxysRockMovement, 8);
|
||||
gFieldEffectArguments[0] = LOCALID_BIRTH_ISLAND_EXTERIOR_ROCK;
|
||||
@ -3281,6 +3354,8 @@ static void ChangeDeoxysRockLevel(u8 rockLevel)
|
||||
gFieldEffectArguments[3] = sDeoxysRockCoords[rockLevel][0];
|
||||
gFieldEffectArguments[4] = sDeoxysRockCoords[rockLevel][1];
|
||||
|
||||
// Set number of movement steps.
|
||||
// Resetting for failure is slow, successful movement is fast.
|
||||
if (rockLevel == 0)
|
||||
gFieldEffectArguments[5] = 60;
|
||||
else
|
||||
@ -3798,8 +3873,9 @@ static void Task_CloseBattlePikeCurtain(u8 taskId)
|
||||
|
||||
void GetBattlePyramidHint(void)
|
||||
{
|
||||
gSpecialVar_Result = gSpecialVar_0x8004 / 7;
|
||||
gSpecialVar_Result -= (gSpecialVar_Result / 20) * 20;
|
||||
// gSpecialVar_0x8004 here is expected to be the current Battle Pyramid win streak.
|
||||
gSpecialVar_Result = gSpecialVar_0x8004 / FRONTIER_STAGES_PER_CHALLENGE;
|
||||
gSpecialVar_Result -= (gSpecialVar_Result / TOTAL_PYRAMID_ROUNDS) * TOTAL_PYRAMID_ROUNDS;
|
||||
}
|
||||
|
||||
// Used to avoid a potential softlock if the player respawns on Dewford with no way off
|
||||
@ -3834,13 +3910,13 @@ bool8 InPokemonCenter(void)
|
||||
MAP_TRADE_CENTER,
|
||||
MAP_RECORD_CORNER,
|
||||
MAP_BATTLE_COLOSSEUM_4P,
|
||||
0xFFFF
|
||||
MAP_UNDEFINED
|
||||
};
|
||||
|
||||
int i;
|
||||
u16 map = (gSaveBlock1Ptr->location.mapGroup << 8) + gSaveBlock1Ptr->location.mapNum;
|
||||
|
||||
for (i = 0; sPokemonCenters[i] != 0xFFFF; i++)
|
||||
for (i = 0; sPokemonCenters[i] != MAP_UNDEFINED; i++)
|
||||
{
|
||||
if (sPokemonCenters[i] == map)
|
||||
return TRUE;
|
||||
|
Loading…
Reference in New Issue
Block a user