Rename EventObj to ObjEvent
This commit is contained in:
@@ -10,7 +10,7 @@ MauvilleCity_PokemonCenter_1F_OnTransition: @ 8210E66
|
|||||||
end
|
end
|
||||||
|
|
||||||
MauvilleCity_PokemonCenter_1F_EventScript_SetMauvilleOldManGfx:: @ 8210E74
|
MauvilleCity_PokemonCenter_1F_EventScript_SetMauvilleOldManGfx:: @ 8210E74
|
||||||
special ScrSpecial_SetMauvilleOldManEventObjGfx
|
special ScrSpecial_SetMauvilleOldManObjEventGfx
|
||||||
end
|
end
|
||||||
|
|
||||||
@ VAR_0x800B is the Nurse's object event id
|
@ VAR_0x800B is the Nurse's object event id
|
||||||
|
|||||||
+1
-1
@@ -115,7 +115,7 @@ gSpecials:: @ 81DBA64
|
|||||||
def_special ScrSpecial_SetHipsterSpokenFlag
|
def_special ScrSpecial_SetHipsterSpokenFlag
|
||||||
def_special ScrSpecial_HipsterTeachWord
|
def_special ScrSpecial_HipsterTeachWord
|
||||||
def_special ScrSpecial_PlayBardSong
|
def_special ScrSpecial_PlayBardSong
|
||||||
def_special ScrSpecial_SetMauvilleOldManEventObjGfx
|
def_special ScrSpecial_SetMauvilleOldManObjEventGfx
|
||||||
def_special ScrSpecial_GenerateGiddyLine
|
def_special ScrSpecial_GenerateGiddyLine
|
||||||
def_special ScrSpecial_GiddyShouldTellAnotherTale
|
def_special ScrSpecial_GiddyShouldTellAnotherTale
|
||||||
def_special ScrSpecial_StorytellerGetFreeStorySlot
|
def_special ScrSpecial_StorytellerGetFreeStorySlot
|
||||||
|
|||||||
@@ -34,8 +34,8 @@ void ChooseStarter(void);
|
|||||||
void ResetTrainerOpponentIds(void);
|
void ResetTrainerOpponentIds(void);
|
||||||
void SetMapVarsToTrainer(void);
|
void SetMapVarsToTrainer(void);
|
||||||
const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data);
|
const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data);
|
||||||
void ConfigureAndSetUpOneTrainerBattle(u8 trainerEventObjId, const u8 *trainerScript);
|
void ConfigureAndSetUpOneTrainerBattle(u8 trainerObjEventId, const u8 *trainerScript);
|
||||||
void ConfigureTwoTrainersBattle(u8 trainerEventObjId, const u8 *trainerScript);
|
void ConfigureTwoTrainersBattle(u8 trainerObjEventId, const u8 *trainerScript);
|
||||||
void SetUpTwoTrainersBattle(void);
|
void SetUpTwoTrainersBattle(void);
|
||||||
bool32 GetTrainerFlagFromScriptPointer(const u8 *data);
|
bool32 GetTrainerFlagFromScriptPointer(const u8 *data);
|
||||||
void SetUpTrainerMovement(void);
|
void SetUpTrainerMovement(void);
|
||||||
|
|||||||
@@ -16,10 +16,10 @@ u8 GetFrontierBrainTrainerPicIndex(void);
|
|||||||
u8 GetFrontierBrainTrainerClass(void);
|
u8 GetFrontierBrainTrainerClass(void);
|
||||||
void CopyFrontierBrainTrainerName(u8 *dst);
|
void CopyFrontierBrainTrainerName(u8 *dst);
|
||||||
bool8 IsFrontierBrainFemale(void);
|
bool8 IsFrontierBrainFemale(void);
|
||||||
void SetFrontierBrainEventObjGfx_2(void);
|
void SetFrontierBrainObjEventGfx_2(void);
|
||||||
void CreateFrontierBrainPokemon(void);
|
void CreateFrontierBrainPokemon(void);
|
||||||
u16 GetFrontierBrainMonSpecies(u8 monId);
|
u16 GetFrontierBrainMonSpecies(u8 monId);
|
||||||
void SetFrontierBrainEventObjGfx(u8 facility);
|
void SetFrontierBrainObjEventGfx(u8 facility);
|
||||||
u16 GetFrontierBrainMonMove(u8 monId, u8 moveSlotId);
|
u16 GetFrontierBrainMonMove(u8 monId, u8 moveSlotId);
|
||||||
u8 GetFrontierBrainMonNature(u8 monId);
|
u8 GetFrontierBrainMonNature(u8 monId);
|
||||||
u8 GetFrontierBrainMonEvs(u8 monId, u8 evStatId);
|
u8 GetFrontierBrainMonEvs(u8 monId, u8 evStatId);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ extern struct BardSong gBardSong;
|
|||||||
|
|
||||||
void SetMauvilleOldMan(void);
|
void SetMauvilleOldMan(void);
|
||||||
u8 GetCurrentMauvilleOldMan(void);
|
u8 GetCurrentMauvilleOldMan(void);
|
||||||
void ScrSpecial_SetMauvilleOldManEventObjGfx(void);
|
void ScrSpecial_SetMauvilleOldManObjEventGfx(void);
|
||||||
u8 sub_81201C8(void);
|
u8 sub_81201C8(void);
|
||||||
void sub_8120B70(OldMan *dest);
|
void sub_8120B70(OldMan *dest);
|
||||||
void sub_8120670(void);
|
void sub_8120670(void);
|
||||||
|
|||||||
+4
-4
@@ -63,10 +63,10 @@ void IncrementGameStat(u8 index);
|
|||||||
u32 GetGameStat(u8 index);
|
u32 GetGameStat(u8 index);
|
||||||
void SetGameStat(u8 index, u32 value);
|
void SetGameStat(u8 index, u32 value);
|
||||||
void ApplyNewEncryptionKeyToGameStats(u32 newKey);
|
void ApplyNewEncryptionKeyToGameStats(u32 newKey);
|
||||||
void LoadEventObjTemplatesFromHeader(void);
|
void LoadObjEventTemplatesFromHeader(void);
|
||||||
void LoadSaveblockEventObjScripts(void);
|
void LoadSaveblockObjEventScripts(void);
|
||||||
void Overworld_SetEventObjTemplateCoords(u8 localId, s16 x, s16 y);
|
void Overworld_SetObjEventTemplateCoords(u8 localId, s16 x, s16 y);
|
||||||
void Overworld_SetEventObjTemplateMovementType(u8 localId, u8 movementType);
|
void Overworld_SetObjEventTemplateMovementType(u8 localId, u8 movementType);
|
||||||
const struct MapLayout *GetMapLayout(void);
|
const struct MapLayout *GetMapLayout(void);
|
||||||
void ApplyCurrentWarp(void);
|
void ApplyCurrentWarp(void);
|
||||||
struct MapHeader const *const Overworld_GetMapHeaderByGroupAndId(u16 mapGroup, u16 mapNum);
|
struct MapHeader const *const Overworld_GetMapHeaderByGroupAndId(u16 mapGroup, u16 mapNum);
|
||||||
|
|||||||
+1
-1
@@ -601,7 +601,7 @@ static void SetupRoomObjectEvents(void)
|
|||||||
setObjGfx1 = FALSE;
|
setObjGfx1 = FALSE;
|
||||||
break;
|
break;
|
||||||
case PIKE_ROOM_BRAIN:
|
case PIKE_ROOM_BRAIN:
|
||||||
SetFrontierBrainEventObjGfx(FRONTIER_FACILITY_PIKE);
|
SetFrontierBrainObjEventGfx(FRONTIER_FACILITY_PIKE);
|
||||||
objGfx2 = OBJ_EVENT_GFX_LINK_RECEPTIONIST;
|
objGfx2 = OBJ_EVENT_GFX_LINK_RECEPTIONIST;
|
||||||
setObjGfx1 = FALSE;
|
setObjGfx1 = FALSE;
|
||||||
setObjGfx2 = TRUE;
|
setObjGfx2 = TRUE;
|
||||||
|
|||||||
+6
-6
@@ -1168,19 +1168,19 @@ const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureAndSetUpOneTrainerBattle(u8 trainerEventObjId, const u8 *trainerScript)
|
void ConfigureAndSetUpOneTrainerBattle(u8 trainerObjEventId, const u8 *trainerScript)
|
||||||
{
|
{
|
||||||
gSelectedObjectEvent = trainerEventObjId;
|
gSelectedObjectEvent = trainerObjEventId;
|
||||||
gSpecialVar_LastTalked = gObjectEvents[trainerEventObjId].localId;
|
gSpecialVar_LastTalked = gObjectEvents[trainerObjEventId].localId;
|
||||||
BattleSetup_ConfigureTrainerBattle(trainerScript + 1);
|
BattleSetup_ConfigureTrainerBattle(trainerScript + 1);
|
||||||
ScriptContext1_SetupScript(EventScript_271354);
|
ScriptContext1_SetupScript(EventScript_271354);
|
||||||
ScriptContext2_Enable();
|
ScriptContext2_Enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureTwoTrainersBattle(u8 trainerEventObjId, const u8 *trainerScript)
|
void ConfigureTwoTrainersBattle(u8 trainerObjEventId, const u8 *trainerScript)
|
||||||
{
|
{
|
||||||
gSelectedObjectEvent = trainerEventObjId;
|
gSelectedObjectEvent = trainerObjEventId;
|
||||||
gSpecialVar_LastTalked = gObjectEvents[trainerEventObjId].localId;
|
gSpecialVar_LastTalked = gObjectEvents[trainerObjEventId].localId;
|
||||||
BattleSetup_ConfigureTrainerBattle(trainerScript + 1);
|
BattleSetup_ConfigureTrainerBattle(trainerScript + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1414,7 +1414,7 @@ void SetBattleFacilityTrainerGfxId(u16 trainerId, u8 tempVarId)
|
|||||||
}
|
}
|
||||||
else if (trainerId == TRAINER_FRONTIER_BRAIN)
|
else if (trainerId == TRAINER_FRONTIER_BRAIN)
|
||||||
{
|
{
|
||||||
SetFrontierBrainEventObjGfx_2();
|
SetFrontierBrainObjEventGfx_2();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
else if (trainerId < TRAINER_RECORD_MIXING_FRIEND)
|
||||||
|
|||||||
+58
-58
@@ -186,31 +186,31 @@ static void MachBikeTransition_FaceDirection(u8 direction)
|
|||||||
|
|
||||||
static void MachBikeTransition_TurnDirection(u8 direction)
|
static void MachBikeTransition_TurnDirection(u8 direction)
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
if (CanBikeFaceDirOnMetatile(direction, playerEventObj->currentMetatileBehavior))
|
if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior))
|
||||||
{
|
{
|
||||||
PlayerTurnInPlace(direction);
|
PlayerTurnInPlace(direction);
|
||||||
Bike_SetBikeStill();
|
Bike_SetBikeStill();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MachBikeTransition_FaceDirection(playerEventObj->facingDirection);
|
MachBikeTransition_FaceDirection(playerObjEvent->facingDirection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MachBikeTransition_TrySpeedUp(u8 direction)
|
static void MachBikeTransition_TrySpeedUp(u8 direction)
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
u8 collision;
|
u8 collision;
|
||||||
|
|
||||||
if (CanBikeFaceDirOnMetatile(direction, playerEventObj->currentMetatileBehavior) == FALSE)
|
if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == FALSE)
|
||||||
{
|
{
|
||||||
// we cannot go forward, so either slow down or, if we are stopped, idle face direction.
|
// we cannot go forward, so either slow down or, if we are stopped, idle face direction.
|
||||||
if (gPlayerAvatar.bikeSpeed)
|
if (gPlayerAvatar.bikeSpeed)
|
||||||
MachBikeTransition_TrySlowDown(playerEventObj->movementDirection);
|
MachBikeTransition_TrySlowDown(playerObjEvent->movementDirection);
|
||||||
else
|
else
|
||||||
MachBikeTransition_FaceDirection(playerEventObj->movementDirection);
|
MachBikeTransition_FaceDirection(playerObjEvent->movementDirection);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -366,10 +366,10 @@ static u8 AcroBikeHandleInputTurning(u8 *newDirection, u16 newKeys, u16 heldKeys
|
|||||||
static u8 AcroBikeHandleInputWheelieStanding(u8 *newDirection, u16 newKeys, u16 heldKeys)
|
static u8 AcroBikeHandleInputWheelieStanding(u8 *newDirection, u16 newKeys, u16 heldKeys)
|
||||||
{
|
{
|
||||||
u8 direction;
|
u8 direction;
|
||||||
struct ObjectEvent *playerEventObj;
|
struct ObjectEvent *playerObjEvent;
|
||||||
|
|
||||||
direction = GetPlayerMovementDirection();
|
direction = GetPlayerMovementDirection();
|
||||||
playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
gPlayerAvatar.runningState = NOT_MOVING;
|
gPlayerAvatar.runningState = NOT_MOVING;
|
||||||
|
|
||||||
if (heldKeys & B_BUTTON)
|
if (heldKeys & B_BUTTON)
|
||||||
@@ -378,7 +378,7 @@ static u8 AcroBikeHandleInputWheelieStanding(u8 *newDirection, u16 newKeys, u16
|
|||||||
{
|
{
|
||||||
// B button was released.
|
// B button was released.
|
||||||
gPlayerAvatar.bikeFrameCounter = 0;
|
gPlayerAvatar.bikeFrameCounter = 0;
|
||||||
if (!MetatileBehavior_IsBumpySlope(playerEventObj->currentMetatileBehavior))
|
if (!MetatileBehavior_IsBumpySlope(playerObjEvent->currentMetatileBehavior))
|
||||||
{
|
{
|
||||||
// Go back to normal on flat ground
|
// Go back to normal on flat ground
|
||||||
*newDirection = direction;
|
*newDirection = direction;
|
||||||
@@ -413,15 +413,15 @@ static u8 AcroBikeHandleInputWheelieStanding(u8 *newDirection, u16 newKeys, u16
|
|||||||
static u8 AcroBikeHandleInputBunnyHop(u8 *newDirection, u16 newKeys, u16 heldKeys)
|
static u8 AcroBikeHandleInputBunnyHop(u8 *newDirection, u16 newKeys, u16 heldKeys)
|
||||||
{
|
{
|
||||||
u8 direction;
|
u8 direction;
|
||||||
struct ObjectEvent *playerEventObj;
|
struct ObjectEvent *playerObjEvent;
|
||||||
|
|
||||||
direction = GetPlayerMovementDirection();
|
direction = GetPlayerMovementDirection();
|
||||||
playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
if (!(heldKeys & B_BUTTON))
|
if (!(heldKeys & B_BUTTON))
|
||||||
{
|
{
|
||||||
// B button was released
|
// B button was released
|
||||||
Bike_SetBikeStill();
|
Bike_SetBikeStill();
|
||||||
if (MetatileBehavior_IsBumpySlope(playerEventObj->currentMetatileBehavior))
|
if (MetatileBehavior_IsBumpySlope(playerObjEvent->currentMetatileBehavior))
|
||||||
{
|
{
|
||||||
// even though B was released, dont undo the wheelie on the bumpy slope.
|
// even though B was released, dont undo the wheelie on the bumpy slope.
|
||||||
gPlayerAvatar.acroBikeState = ACRO_STATE_WHEELIE_STANDING;
|
gPlayerAvatar.acroBikeState = ACRO_STATE_WHEELIE_STANDING;
|
||||||
@@ -460,15 +460,15 @@ static u8 AcroBikeHandleInputBunnyHop(u8 *newDirection, u16 newKeys, u16 heldKey
|
|||||||
static u8 AcroBikeHandleInputWheelieMoving(u8 *newDirection, u16 newKeys, u16 heldKeys)
|
static u8 AcroBikeHandleInputWheelieMoving(u8 *newDirection, u16 newKeys, u16 heldKeys)
|
||||||
{
|
{
|
||||||
u8 direction;
|
u8 direction;
|
||||||
struct ObjectEvent *playerEventObj;
|
struct ObjectEvent *playerObjEvent;
|
||||||
|
|
||||||
direction = GetPlayerFacingDirection();
|
direction = GetPlayerFacingDirection();
|
||||||
playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
if (!(heldKeys & B_BUTTON))
|
if (!(heldKeys & B_BUTTON))
|
||||||
{
|
{
|
||||||
// we were moving on a wheelie, but we let go while moving. reset bike still status
|
// we were moving on a wheelie, but we let go while moving. reset bike still status
|
||||||
Bike_SetBikeStill();
|
Bike_SetBikeStill();
|
||||||
if (!MetatileBehavior_IsBumpySlope(playerEventObj->currentMetatileBehavior))
|
if (!MetatileBehavior_IsBumpySlope(playerObjEvent->currentMetatileBehavior))
|
||||||
{
|
{
|
||||||
// we let go of B and arent on a bumpy slope, set state to normal because now we need to handle this
|
// we let go of B and arent on a bumpy slope, set state to normal because now we need to handle this
|
||||||
gPlayerAvatar.acroBikeState = ACRO_STATE_NORMAL;
|
gPlayerAvatar.acroBikeState = ACRO_STATE_NORMAL;
|
||||||
@@ -514,10 +514,10 @@ static u8 AcroBikeHandleInputWheelieMoving(u8 *newDirection, u16 newKeys, u16 he
|
|||||||
|
|
||||||
static u8 AcroBikeHandleInputSidewaysJump(u8 *ptr, u16 newKeys, u16 heldKeys)
|
static u8 AcroBikeHandleInputSidewaysJump(u8 *ptr, u16 newKeys, u16 heldKeys)
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
playerEventObj->facingDirectionLocked = 0;
|
playerObjEvent->facingDirectionLocked = 0;
|
||||||
SetObjectEventDirection(playerEventObj, playerEventObj->facingDirection);
|
SetObjectEventDirection(playerObjEvent, playerObjEvent->facingDirection);
|
||||||
gPlayerAvatar.acroBikeState = ACRO_STATE_NORMAL;
|
gPlayerAvatar.acroBikeState = ACRO_STATE_NORMAL;
|
||||||
return CheckMovementInputAcroBike(ptr, newKeys, heldKeys);
|
return CheckMovementInputAcroBike(ptr, newKeys, heldKeys);
|
||||||
}
|
}
|
||||||
@@ -535,21 +535,21 @@ static void AcroBikeTransition_FaceDirection(u8 direction)
|
|||||||
|
|
||||||
static void AcroBikeTransition_TurnDirection(u8 direction)
|
static void AcroBikeTransition_TurnDirection(u8 direction)
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
if (CanBikeFaceDirOnMetatile(direction, playerEventObj->currentMetatileBehavior) == 0)
|
if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == 0)
|
||||||
direction = playerEventObj->movementDirection;
|
direction = playerObjEvent->movementDirection;
|
||||||
PlayerFaceDirection(direction);
|
PlayerFaceDirection(direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AcroBikeTransition_Moving(u8 direction)
|
static void AcroBikeTransition_Moving(u8 direction)
|
||||||
{
|
{
|
||||||
u8 collision;
|
u8 collision;
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
if (CanBikeFaceDirOnMetatile(direction, playerEventObj->currentMetatileBehavior) == 0)
|
if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == 0)
|
||||||
{
|
{
|
||||||
AcroBikeTransition_FaceDirection(playerEventObj->movementDirection);
|
AcroBikeTransition_FaceDirection(playerObjEvent->movementDirection);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
collision = GetBikeCollision(direction);
|
collision = GetBikeCollision(direction);
|
||||||
@@ -570,48 +570,48 @@ static void AcroBikeTransition_Moving(u8 direction)
|
|||||||
|
|
||||||
static void AcroBikeTransition_NormalToWheelie(u8 direction)
|
static void AcroBikeTransition_NormalToWheelie(u8 direction)
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
if (CanBikeFaceDirOnMetatile(direction, playerEventObj->currentMetatileBehavior) == 0)
|
if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == 0)
|
||||||
direction = playerEventObj->movementDirection;
|
direction = playerObjEvent->movementDirection;
|
||||||
PlayerStartWheelie(direction);
|
PlayerStartWheelie(direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AcroBikeTransition_WheelieToNormal(u8 direction)
|
static void AcroBikeTransition_WheelieToNormal(u8 direction)
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
if (CanBikeFaceDirOnMetatile(direction, playerEventObj->currentMetatileBehavior) == 0)
|
if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == 0)
|
||||||
direction = playerEventObj->movementDirection;
|
direction = playerObjEvent->movementDirection;
|
||||||
PlayerEndWheelie(direction);
|
PlayerEndWheelie(direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AcroBikeTransition_WheelieIdle(u8 direction)
|
static void AcroBikeTransition_WheelieIdle(u8 direction)
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
if (CanBikeFaceDirOnMetatile(direction, playerEventObj->currentMetatileBehavior) == 0)
|
if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == 0)
|
||||||
direction = playerEventObj->movementDirection;
|
direction = playerObjEvent->movementDirection;
|
||||||
PlayerIdleWheelie(direction);
|
PlayerIdleWheelie(direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AcroBikeTransition_WheelieHoppingStanding(u8 direction)
|
static void AcroBikeTransition_WheelieHoppingStanding(u8 direction)
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
if (CanBikeFaceDirOnMetatile(direction, playerEventObj->currentMetatileBehavior) == 0)
|
if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == 0)
|
||||||
direction = playerEventObj->movementDirection;
|
direction = playerObjEvent->movementDirection;
|
||||||
PlayerStandingHoppingWheelie(direction);
|
PlayerStandingHoppingWheelie(direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AcroBikeTransition_WheelieHoppingMoving(u8 direction)
|
static void AcroBikeTransition_WheelieHoppingMoving(u8 direction)
|
||||||
{
|
{
|
||||||
u8 collision;
|
u8 collision;
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
if (CanBikeFaceDirOnMetatile(direction, playerEventObj->currentMetatileBehavior) == 0)
|
if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == 0)
|
||||||
{
|
{
|
||||||
AcroBikeTransition_WheelieHoppingStanding(playerEventObj->movementDirection);
|
AcroBikeTransition_WheelieHoppingStanding(playerObjEvent->movementDirection);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
collision = GetBikeCollision(direction);
|
collision = GetBikeCollision(direction);
|
||||||
@@ -641,7 +641,7 @@ static void AcroBikeTransition_WheelieHoppingMoving(u8 direction)
|
|||||||
static void AcroBikeTransition_SideJump(u8 direction)
|
static void AcroBikeTransition_SideJump(u8 direction)
|
||||||
{
|
{
|
||||||
u8 collision;
|
u8 collision;
|
||||||
struct ObjectEvent *playerEventObj;
|
struct ObjectEvent *playerObjEvent;
|
||||||
|
|
||||||
collision = GetBikeCollision(direction);
|
collision = GetBikeCollision(direction);
|
||||||
if (collision)
|
if (collision)
|
||||||
@@ -659,9 +659,9 @@ static void AcroBikeTransition_SideJump(u8 direction)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
PlaySE(SE_JITE_PYOKO);
|
PlaySE(SE_JITE_PYOKO);
|
||||||
playerEventObj->facingDirectionLocked = 1;
|
playerObjEvent->facingDirectionLocked = 1;
|
||||||
PlayerSetAnimId(GetJumpMovementAction(direction), 2);
|
PlayerSetAnimId(GetJumpMovementAction(direction), 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -673,11 +673,11 @@ static void AcroBikeTransition_TurnJump(u8 direction)
|
|||||||
static void AcroBikeTransition_WheelieMoving(u8 direction)
|
static void AcroBikeTransition_WheelieMoving(u8 direction)
|
||||||
{
|
{
|
||||||
u8 collision;
|
u8 collision;
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
if (CanBikeFaceDirOnMetatile(direction, playerEventObj->currentMetatileBehavior) == 0)
|
if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == 0)
|
||||||
{
|
{
|
||||||
PlayerIdleWheelie(playerEventObj->movementDirection);
|
PlayerIdleWheelie(playerObjEvent->movementDirection);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
collision = GetBikeCollision(direction);
|
collision = GetBikeCollision(direction);
|
||||||
@@ -693,7 +693,7 @@ static void AcroBikeTransition_WheelieMoving(u8 direction)
|
|||||||
}
|
}
|
||||||
else if (collision < COLLISION_STOP_SURFING)
|
else if (collision < COLLISION_STOP_SURFING)
|
||||||
{
|
{
|
||||||
if (MetatileBehavior_IsBumpySlope(playerEventObj->currentMetatileBehavior))
|
if (MetatileBehavior_IsBumpySlope(playerObjEvent->currentMetatileBehavior))
|
||||||
PlayerIdleWheelie(direction);
|
PlayerIdleWheelie(direction);
|
||||||
else
|
else
|
||||||
sub_808B980(direction); //hit wall?
|
sub_808B980(direction); //hit wall?
|
||||||
@@ -707,11 +707,11 @@ static void AcroBikeTransition_WheelieMoving(u8 direction)
|
|||||||
static void AcroBikeTransition_WheelieRisingMoving(u8 direction)
|
static void AcroBikeTransition_WheelieRisingMoving(u8 direction)
|
||||||
{
|
{
|
||||||
u8 collision;
|
u8 collision;
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
if (CanBikeFaceDirOnMetatile(direction, playerEventObj->currentMetatileBehavior) == 0)
|
if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == 0)
|
||||||
{
|
{
|
||||||
PlayerStartWheelie(playerEventObj->movementDirection);
|
PlayerStartWheelie(playerObjEvent->movementDirection);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
collision = GetBikeCollision(direction);
|
collision = GetBikeCollision(direction);
|
||||||
@@ -727,7 +727,7 @@ static void AcroBikeTransition_WheelieRisingMoving(u8 direction)
|
|||||||
}
|
}
|
||||||
else if (collision < COLLISION_STOP_SURFING)
|
else if (collision < COLLISION_STOP_SURFING)
|
||||||
{
|
{
|
||||||
if (MetatileBehavior_IsBumpySlope(playerEventObj->currentMetatileBehavior))
|
if (MetatileBehavior_IsBumpySlope(playerObjEvent->currentMetatileBehavior))
|
||||||
PlayerIdleWheelie(direction);
|
PlayerIdleWheelie(direction);
|
||||||
else
|
else
|
||||||
sub_808B980(direction); //hit wall?
|
sub_808B980(direction); //hit wall?
|
||||||
@@ -741,11 +741,11 @@ static void AcroBikeTransition_WheelieRisingMoving(u8 direction)
|
|||||||
static void AcroBikeTransition_WheelieLoweringMoving(u8 direction)
|
static void AcroBikeTransition_WheelieLoweringMoving(u8 direction)
|
||||||
{
|
{
|
||||||
u8 collision;
|
u8 collision;
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
if (CanBikeFaceDirOnMetatile(direction, playerEventObj->currentMetatileBehavior) == 0)
|
if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == 0)
|
||||||
{
|
{
|
||||||
PlayerEndWheelie(playerEventObj->movementDirection);
|
PlayerEndWheelie(playerObjEvent->movementDirection);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
collision = GetBikeCollision(direction);
|
collision = GetBikeCollision(direction);
|
||||||
@@ -868,12 +868,12 @@ static u8 Bike_DPadToDirection(u16 heldKeys)
|
|||||||
static u8 GetBikeCollision(u8 direction)
|
static u8 GetBikeCollision(u8 direction)
|
||||||
{
|
{
|
||||||
u8 metatitleBehavior;
|
u8 metatitleBehavior;
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
s16 x = playerEventObj->currentCoords.x;
|
s16 x = playerObjEvent->currentCoords.x;
|
||||||
s16 y = playerEventObj->currentCoords.y;
|
s16 y = playerObjEvent->currentCoords.y;
|
||||||
MoveCoords(direction, &x, &y);
|
MoveCoords(direction, &x, &y);
|
||||||
metatitleBehavior = MapGridGetMetatileBehaviorAt(x, y);
|
metatitleBehavior = MapGridGetMetatileBehaviorAt(x, y);
|
||||||
return GetBikeCollisionAt(playerEventObj, x, y, direction, metatitleBehavior);
|
return GetBikeCollisionAt(playerObjEvent, x, y, direction, metatitleBehavior);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 GetBikeCollisionAt(struct ObjectEvent *objectEvent, s16 x, s16 y, u8 direction, u8 metatitleBehavior)
|
static u8 GetBikeCollisionAt(struct ObjectEvent *objectEvent, s16 x, s16 y, u8 direction, u8 metatitleBehavior)
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ static bool8 IsCoordOutsideObjectEventMovementRange(struct ObjectEvent *, s16, s
|
|||||||
static bool8 IsMetatileDirectionallyImpassable(struct ObjectEvent *, s16, s16, u8);
|
static bool8 IsMetatileDirectionallyImpassable(struct ObjectEvent *, s16, s16, u8);
|
||||||
static bool8 DoesObjectCollideWithObjectAt(struct ObjectEvent *, s16, s16);
|
static bool8 DoesObjectCollideWithObjectAt(struct ObjectEvent *, s16, s16);
|
||||||
static void sub_8096530(struct ObjectEvent *, struct Sprite *);
|
static void sub_8096530(struct ObjectEvent *, struct Sprite *);
|
||||||
static void UpdateEventObjSpriteVisibility(struct ObjectEvent *, struct Sprite *);
|
static void UpdateObjEventSpriteVisibility(struct ObjectEvent *, struct Sprite *);
|
||||||
static void ObjectEventUpdateMetatileBehaviors(struct ObjectEvent*);
|
static void ObjectEventUpdateMetatileBehaviors(struct ObjectEvent*);
|
||||||
static void GetGroundEffectFlags_Reflection(struct ObjectEvent*, u32*);
|
static void GetGroundEffectFlags_Reflection(struct ObjectEvent*, u32*);
|
||||||
static void GetGroundEffectFlags_TallGrassOnSpawn(struct ObjectEvent*, u32*);
|
static void GetGroundEffectFlags_TallGrassOnSpawn(struct ObjectEvent*, u32*);
|
||||||
@@ -7559,7 +7559,7 @@ static void TryEnableObjectEventAnim(struct ObjectEvent *objectEvent, struct Spr
|
|||||||
static void UpdateObjectEventVisibility(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
static void UpdateObjectEventVisibility(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
sub_8096530(objectEvent, sprite);
|
sub_8096530(objectEvent, sprite);
|
||||||
UpdateEventObjSpriteVisibility(objectEvent, sprite);
|
UpdateObjEventSpriteVisibility(objectEvent, sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_8096530(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
static void sub_8096530(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||||
@@ -7594,7 +7594,7 @@ static void sub_8096530(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UpdateEventObjSpriteVisibility(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
static void UpdateObjEventSpriteVisibility(struct ObjectEvent *objectEvent, struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
sprite->invisible = FALSE;
|
sprite->invisible = FALSE;
|
||||||
if (objectEvent->invisible || objectEvent->offScreen)
|
if (objectEvent->invisible || objectEvent->offScreen)
|
||||||
|
|||||||
+75
-75
@@ -321,15 +321,15 @@ static u8 ObjectEventCB2_NoMovement2(void)
|
|||||||
|
|
||||||
void player_step(u8 direction, u16 newKeys, u16 heldKeys)
|
void player_step(u8 direction, u16 newKeys, u16 heldKeys)
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
sub_808C280(playerEventObj);
|
sub_808C280(playerObjEvent);
|
||||||
if (gPlayerAvatar.preventStep == FALSE)
|
if (gPlayerAvatar.preventStep == FALSE)
|
||||||
{
|
{
|
||||||
Bike_TryAcroBikeHistoryUpdate(newKeys, heldKeys);
|
Bike_TryAcroBikeHistoryUpdate(newKeys, heldKeys);
|
||||||
if (TryInterruptObjectEventSpecialAnim(playerEventObj, direction) == 0)
|
if (TryInterruptObjectEventSpecialAnim(playerObjEvent, direction) == 0)
|
||||||
{
|
{
|
||||||
npc_clear_strange_bits(playerEventObj);
|
npc_clear_strange_bits(playerObjEvent);
|
||||||
DoPlayerAvatarTransition();
|
DoPlayerAvatarTransition();
|
||||||
if (TryDoMetatileBehaviorForcedMovement() == 0)
|
if (TryDoMetatileBehaviorForcedMovement() == 0)
|
||||||
{
|
{
|
||||||
@@ -340,16 +340,16 @@ void player_step(u8 direction, u16 newKeys, u16 heldKeys)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool8 TryInterruptObjectEventSpecialAnim(struct ObjectEvent *playerEventObj, u8 direction)
|
static bool8 TryInterruptObjectEventSpecialAnim(struct ObjectEvent *playerObjEvent, u8 direction)
|
||||||
{
|
{
|
||||||
u8 r5 = direction;
|
u8 r5 = direction;
|
||||||
u8 r6 = direction;
|
u8 r6 = direction;
|
||||||
r6++; r6--;
|
r6++; r6--;
|
||||||
|
|
||||||
if (ObjectEventIsMovementOverridden(playerEventObj)
|
if (ObjectEventIsMovementOverridden(playerObjEvent)
|
||||||
&& !ObjectEventClearHeldMovementIfFinished(playerEventObj))
|
&& !ObjectEventClearHeldMovementIfFinished(playerObjEvent))
|
||||||
{
|
{
|
||||||
u8 heldMovementActionId = ObjectEventGetHeldMovementActionId(playerEventObj);
|
u8 heldMovementActionId = ObjectEventGetHeldMovementActionId(playerObjEvent);
|
||||||
if (heldMovementActionId > MOVEMENT_ACTION_WALK_FAST_RIGHT && heldMovementActionId < MOVEMENT_ACTION_WALK_IN_PLACE_NORMAL_DOWN)
|
if (heldMovementActionId > MOVEMENT_ACTION_WALK_FAST_RIGHT && heldMovementActionId < MOVEMENT_ACTION_WALK_IN_PLACE_NORMAL_DOWN)
|
||||||
{
|
{
|
||||||
if (direction == DIR_NONE)
|
if (direction == DIR_NONE)
|
||||||
@@ -357,15 +357,15 @@ static bool8 TryInterruptObjectEventSpecialAnim(struct ObjectEvent *playerEventO
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (playerEventObj->movementDirection != r5)
|
if (playerObjEvent->movementDirection != r5)
|
||||||
{
|
{
|
||||||
ObjectEventClearHeldMovement(playerEventObj);
|
ObjectEventClearHeldMovement(playerObjEvent);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!sub_808B028(r6))
|
if (!sub_808B028(r6))
|
||||||
{
|
{
|
||||||
ObjectEventClearHeldMovement(playerEventObj);
|
ObjectEventClearHeldMovement(playerObjEvent);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -425,11 +425,11 @@ static bool8 ForcedMovement_None(void)
|
|||||||
{
|
{
|
||||||
if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_6)
|
if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_6)
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
playerEventObj->facingDirectionLocked = 0;
|
playerObjEvent->facingDirectionLocked = 0;
|
||||||
playerEventObj->enableAnim = 1;
|
playerObjEvent->enableAnim = 1;
|
||||||
SetObjectEventDirection(playerEventObj, playerEventObj->facingDirection);
|
SetObjectEventDirection(playerObjEvent, playerObjEvent->facingDirection);
|
||||||
gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_6;
|
gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_6;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -467,10 +467,10 @@ static u8 DoForcedMovement(u8 direction, void (*b)(u8))
|
|||||||
|
|
||||||
static u8 DoForcedMovementInCurrentDirection(void (*a)(u8))
|
static u8 DoForcedMovementInCurrentDirection(void (*a)(u8))
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
playerEventObj->disableAnim = 1;
|
playerObjEvent->disableAnim = 1;
|
||||||
return DoForcedMovement(playerEventObj->movementDirection, a);
|
return DoForcedMovement(playerObjEvent->movementDirection, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool8 ForcedMovement_Slip(void)
|
static bool8 ForcedMovement_Slip(void)
|
||||||
@@ -520,10 +520,10 @@ static bool8 ForcedMovement_PushedEastByCurrent(void)
|
|||||||
|
|
||||||
u8 ForcedMovement_Slide(u8 direction, void (*b)(u8))
|
u8 ForcedMovement_Slide(u8 direction, void (*b)(u8))
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
playerEventObj->disableAnim = 1;
|
playerObjEvent->disableAnim = 1;
|
||||||
playerEventObj->facingDirectionLocked = 1;
|
playerObjEvent->facingDirectionLocked = 1;
|
||||||
return DoForcedMovement(direction, b);
|
return DoForcedMovement(direction, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -561,12 +561,12 @@ static bool8 ForcedMovement_0xBC(void)
|
|||||||
|
|
||||||
static bool8 ForcedMovement_MuddySlope(void)
|
static bool8 ForcedMovement_MuddySlope(void)
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
if (playerEventObj->movementDirection != DIR_NORTH || GetPlayerSpeed() <= 3)
|
if (playerObjEvent->movementDirection != DIR_NORTH || GetPlayerSpeed() <= 3)
|
||||||
{
|
{
|
||||||
Bike_UpdateBikeCounterSpeed(0);
|
Bike_UpdateBikeCounterSpeed(0);
|
||||||
playerEventObj->facingDirectionLocked = 1;
|
playerObjEvent->facingDirectionLocked = 1;
|
||||||
return DoForcedMovement(1, PlayerGoSpeed2);
|
return DoForcedMovement(1, PlayerGoSpeed2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -657,23 +657,23 @@ static void PlayerNotOnBikeMoving(u8 direction, u16 heldKeys)
|
|||||||
static u8 CheckForPlayerAvatarCollision(u8 direction)
|
static u8 CheckForPlayerAvatarCollision(u8 direction)
|
||||||
{
|
{
|
||||||
s16 x, y;
|
s16 x, y;
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
x = playerEventObj->currentCoords.x;
|
x = playerObjEvent->currentCoords.x;
|
||||||
y = playerEventObj->currentCoords.y;
|
y = playerObjEvent->currentCoords.y;
|
||||||
MoveCoords(direction, &x, &y);
|
MoveCoords(direction, &x, &y);
|
||||||
return CheckForObjectEventCollision(playerEventObj, x, y, direction, MapGridGetMetatileBehaviorAt(x, y));
|
return CheckForObjectEventCollision(playerObjEvent, x, y, direction, MapGridGetMetatileBehaviorAt(x, y));
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 sub_808B028(u8 direction)
|
static u8 sub_808B028(u8 direction)
|
||||||
{
|
{
|
||||||
s16 x, y;
|
s16 x, y;
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
x = playerEventObj->currentCoords.x;
|
x = playerObjEvent->currentCoords.x;
|
||||||
y = playerEventObj->currentCoords.y;
|
y = playerObjEvent->currentCoords.y;
|
||||||
MoveCoords(direction, &x, &y);
|
MoveCoords(direction, &x, &y);
|
||||||
return sub_808B164(playerEventObj, x, y, direction, MapGridGetMetatileBehaviorAt(x, y));
|
return sub_808B164(playerObjEvent, x, y, direction, MapGridGetMetatileBehaviorAt(x, y));
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 CheckForObjectEventCollision(struct ObjectEvent *objectEvent, s16 x, s16 y, u8 direction, u8 metatileBehavior)
|
u8 CheckForObjectEventCollision(struct ObjectEvent *objectEvent, s16 x, s16 y, u8 direction, u8 metatileBehavior)
|
||||||
@@ -1208,10 +1208,10 @@ void sub_808BCE8(void)
|
|||||||
|
|
||||||
void sub_808BCF4(void)
|
void sub_808BCF4(void)
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
npc_clear_strange_bits(playerEventObj);
|
npc_clear_strange_bits(playerObjEvent);
|
||||||
SetObjectEventDirection(playerEventObj, playerEventObj->facingDirection);
|
SetObjectEventDirection(playerObjEvent, playerObjEvent->facingDirection);
|
||||||
if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE))
|
if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE))
|
||||||
{
|
{
|
||||||
Bike_HandleBumpySlopeJump();
|
Bike_HandleBumpySlopeJump();
|
||||||
@@ -1307,12 +1307,12 @@ bool8 IsPlayerSurfingNorth(void)
|
|||||||
|
|
||||||
bool8 IsPlayerFacingSurfableFishableWater(void)
|
bool8 IsPlayerFacingSurfableFishableWater(void)
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
s16 x = playerEventObj->currentCoords.x;
|
s16 x = playerObjEvent->currentCoords.x;
|
||||||
s16 y = playerEventObj->currentCoords.y;
|
s16 y = playerObjEvent->currentCoords.y;
|
||||||
|
|
||||||
MoveCoords(playerEventObj->facingDirection, &x, &y);
|
MoveCoords(playerObjEvent->facingDirection, &x, &y);
|
||||||
if (GetCollisionAtCoords(playerEventObj, x, y, playerEventObj->facingDirection) == COLLISION_ELEVATION_MISMATCH
|
if (GetCollisionAtCoords(playerObjEvent, x, y, playerObjEvent->facingDirection) == COLLISION_ELEVATION_MISMATCH
|
||||||
&& PlayerGetZCoord() == 3
|
&& PlayerGetZCoord() == 3
|
||||||
&& MetatileBehavior_IsSurfableFishableWater(MapGridGetMetatileBehaviorAt(x, y)))
|
&& MetatileBehavior_IsSurfableFishableWater(MapGridGetMetatileBehaviorAt(x, y)))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -1366,23 +1366,23 @@ void SetPlayerAvatarExtraStateTransition(u8 graphicsId, u8 b)
|
|||||||
|
|
||||||
void InitPlayerAvatar(s16 x, s16 y, u8 direction, u8 gender)
|
void InitPlayerAvatar(s16 x, s16 y, u8 direction, u8 gender)
|
||||||
{
|
{
|
||||||
struct ObjectEventTemplate playerEventObjTemplate;
|
struct ObjectEventTemplate playerObjEventTemplate;
|
||||||
u8 objectEventId;
|
u8 objectEventId;
|
||||||
struct ObjectEvent *objectEvent;
|
struct ObjectEvent *objectEvent;
|
||||||
|
|
||||||
playerEventObjTemplate.localId = OBJ_EVENT_ID_PLAYER;
|
playerObjEventTemplate.localId = OBJ_EVENT_ID_PLAYER;
|
||||||
playerEventObjTemplate.graphicsId = GetPlayerAvatarGraphicsIdByStateIdAndGender(PLAYER_AVATAR_STATE_NORMAL, gender);
|
playerObjEventTemplate.graphicsId = GetPlayerAvatarGraphicsIdByStateIdAndGender(PLAYER_AVATAR_STATE_NORMAL, gender);
|
||||||
playerEventObjTemplate.x = x - 7;
|
playerObjEventTemplate.x = x - 7;
|
||||||
playerEventObjTemplate.y = y - 7;
|
playerObjEventTemplate.y = y - 7;
|
||||||
playerEventObjTemplate.elevation = 0;
|
playerObjEventTemplate.elevation = 0;
|
||||||
playerEventObjTemplate.movementType = MOVEMENT_TYPE_PLAYER;
|
playerObjEventTemplate.movementType = MOVEMENT_TYPE_PLAYER;
|
||||||
playerEventObjTemplate.movementRangeX = 0;
|
playerObjEventTemplate.movementRangeX = 0;
|
||||||
playerEventObjTemplate.movementRangeY = 0;
|
playerObjEventTemplate.movementRangeY = 0;
|
||||||
playerEventObjTemplate.trainerType = 0;
|
playerObjEventTemplate.trainerType = 0;
|
||||||
playerEventObjTemplate.trainerRange_berryTreeId = 0;
|
playerObjEventTemplate.trainerRange_berryTreeId = 0;
|
||||||
playerEventObjTemplate.script = NULL;
|
playerObjEventTemplate.script = NULL;
|
||||||
playerEventObjTemplate.flagId = 0;
|
playerObjEventTemplate.flagId = 0;
|
||||||
objectEventId = SpawnSpecialObjectEvent(&playerEventObjTemplate);
|
objectEventId = SpawnSpecialObjectEvent(&playerObjEventTemplate);
|
||||||
objectEvent = &gObjectEvents[objectEventId];
|
objectEvent = &gObjectEvents[objectEventId];
|
||||||
objectEvent->isPlayer = 1;
|
objectEvent->isPlayer = 1;
|
||||||
objectEvent->warpArrowSpriteId = CreateWarpArrowSprite();
|
objectEvent->warpArrowSpriteId = CreateWarpArrowSprite();
|
||||||
@@ -1642,29 +1642,29 @@ static void CreateStopSurfingTask(u8 direction)
|
|||||||
|
|
||||||
static void Task_StopSurfingInit(u8 taskId)
|
static void Task_StopSurfingInit(u8 taskId)
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
if (ObjectEventIsMovementOverridden(playerEventObj))
|
if (ObjectEventIsMovementOverridden(playerObjEvent))
|
||||||
{
|
{
|
||||||
if (!ObjectEventClearHeldMovementIfFinished(playerEventObj))
|
if (!ObjectEventClearHeldMovementIfFinished(playerObjEvent))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sub_81555AC(playerEventObj->fieldEffectSpriteId, 2);
|
sub_81555AC(playerObjEvent->fieldEffectSpriteId, 2);
|
||||||
ObjectEventSetHeldMovement(playerEventObj, GetJumpSpecialMovementAction((u8)gTasks[taskId].data[0]));
|
ObjectEventSetHeldMovement(playerObjEvent, GetJumpSpecialMovementAction((u8)gTasks[taskId].data[0]));
|
||||||
gTasks[taskId].func = Task_WaitStopSurfing;
|
gTasks[taskId].func = Task_WaitStopSurfing;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Task_WaitStopSurfing(u8 taskId)
|
static void Task_WaitStopSurfing(u8 taskId)
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
if (ObjectEventClearHeldMovementIfFinished(playerEventObj))
|
if (ObjectEventClearHeldMovementIfFinished(playerObjEvent))
|
||||||
{
|
{
|
||||||
ObjectEventSetGraphicsId(playerEventObj, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_NORMAL));
|
ObjectEventSetGraphicsId(playerObjEvent, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_NORMAL));
|
||||||
ObjectEventSetHeldMovement(playerEventObj, GetFaceDirectionMovementAction(playerEventObj->facingDirection));
|
ObjectEventSetHeldMovement(playerObjEvent, GetFaceDirectionMovementAction(playerObjEvent->facingDirection));
|
||||||
gPlayerAvatar.preventStep = FALSE;
|
gPlayerAvatar.preventStep = FALSE;
|
||||||
ScriptContext2_Disable();
|
ScriptContext2_Disable();
|
||||||
DestroySprite(&gSprites[playerEventObj->fieldEffectSpriteId]);
|
DestroySprite(&gSprites[playerObjEvent->fieldEffectSpriteId]);
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1729,17 +1729,17 @@ static bool8 Fishing1(struct Task *task)
|
|||||||
|
|
||||||
static bool8 Fishing2(struct Task *task)
|
static bool8 Fishing2(struct Task *task)
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerEventObj;
|
struct ObjectEvent *playerObjEvent;
|
||||||
const s16 arr1[] = {1, 1, 1};
|
const s16 arr1[] = {1, 1, 1};
|
||||||
const s16 arr2[] = {1, 3, 6};
|
const s16 arr2[] = {1, 3, 6};
|
||||||
|
|
||||||
task->tRoundsPlayed = 0;
|
task->tRoundsPlayed = 0;
|
||||||
task->tMinRoundsRequired = arr1[task->tFishingRod] + (Random() % arr2[task->tFishingRod]);
|
task->tMinRoundsRequired = arr1[task->tFishingRod] + (Random() % arr2[task->tFishingRod]);
|
||||||
task->tPlayerGfxId = gObjectEvents[gPlayerAvatar.objectEventId].graphicsId;
|
task->tPlayerGfxId = gObjectEvents[gPlayerAvatar.objectEventId].graphicsId;
|
||||||
playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
ObjectEventClearHeldMovementIfActive(playerEventObj);
|
ObjectEventClearHeldMovementIfActive(playerObjEvent);
|
||||||
playerEventObj->enableAnim = 1;
|
playerObjEvent->enableAnim = 1;
|
||||||
sub_808C15C(playerEventObj->facingDirection);
|
sub_808C15C(playerObjEvent->facingDirection);
|
||||||
task->tStep++;
|
task->tStep++;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -1928,10 +1928,10 @@ static bool8 Fishing11(struct Task *task)
|
|||||||
{
|
{
|
||||||
if (!IsTextPrinterActive(0))
|
if (!IsTextPrinterActive(0))
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
ObjectEventSetGraphicsId(playerEventObj, task->tPlayerGfxId);
|
ObjectEventSetGraphicsId(playerObjEvent, task->tPlayerGfxId);
|
||||||
ObjectEventTurn(playerEventObj, playerEventObj->movementDirection);
|
ObjectEventTurn(playerObjEvent, playerObjEvent->movementDirection);
|
||||||
if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING)
|
if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING)
|
||||||
sub_8155604(gObjectEvents[gPlayerAvatar.objectEventId].fieldEffectSpriteId, 0, 0);
|
sub_8155604(gObjectEvents[gPlayerAvatar.objectEventId].fieldEffectSpriteId, 0, 0);
|
||||||
gSprites[gPlayerAvatar.spriteId].pos2.x = 0;
|
gSprites[gPlayerAvatar.spriteId].pos2.x = 0;
|
||||||
@@ -1988,10 +1988,10 @@ static bool8 Fishing15(struct Task *task)
|
|||||||
AlignFishingAnimationFrames();
|
AlignFishingAnimationFrames();
|
||||||
if (gSprites[gPlayerAvatar.spriteId].animEnded)
|
if (gSprites[gPlayerAvatar.spriteId].animEnded)
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
ObjectEventSetGraphicsId(playerEventObj, task->tPlayerGfxId);
|
ObjectEventSetGraphicsId(playerObjEvent, task->tPlayerGfxId);
|
||||||
ObjectEventTurn(playerEventObj, playerEventObj->movementDirection);
|
ObjectEventTurn(playerObjEvent, playerObjEvent->movementDirection);
|
||||||
if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING)
|
if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING)
|
||||||
sub_8155604(gObjectEvents[gPlayerAvatar.objectEventId].fieldEffectSpriteId, 0, 0);
|
sub_8155604(gObjectEvents[gPlayerAvatar.objectEventId].fieldEffectSpriteId, 0, 0);
|
||||||
gSprites[gPlayerAvatar.spriteId].pos2.x = 0;
|
gSprites[gPlayerAvatar.spriteId].pos2.x = 0;
|
||||||
|
|||||||
@@ -3455,7 +3455,7 @@ static void ChangeDeoxysRockLevel(u8 rockLevel)
|
|||||||
gFieldEffectArguments[5] = 5;
|
gFieldEffectArguments[5] = 5;
|
||||||
|
|
||||||
FieldEffectStart(FLDEFF_MOVE_DEOXYS_ROCK);
|
FieldEffectStart(FLDEFF_MOVE_DEOXYS_ROCK);
|
||||||
Overworld_SetEventObjTemplateCoords(1, sDeoxysRockCoords[rockLevel][0], sDeoxysRockCoords[rockLevel][1]);
|
Overworld_SetObjEventTemplateCoords(1, sDeoxysRockCoords[rockLevel][0], sDeoxysRockCoords[rockLevel][1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void WaitForDeoxysRockMovement(u8 taskId)
|
static void WaitForDeoxysRockMovement(u8 taskId)
|
||||||
|
|||||||
+7
-7
@@ -1229,27 +1229,27 @@ static void Task_WateringBerryTreeAnim_0(u8 taskId)
|
|||||||
|
|
||||||
static void Task_WateringBerryTreeAnim_1(u8 taskId)
|
static void Task_WateringBerryTreeAnim_1(u8 taskId)
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
if (!ObjectEventIsMovementOverridden(playerEventObj)
|
if (!ObjectEventIsMovementOverridden(playerObjEvent)
|
||||||
|| ObjectEventClearHeldMovementIfFinished(playerEventObj))
|
|| ObjectEventClearHeldMovementIfFinished(playerObjEvent))
|
||||||
{
|
{
|
||||||
sub_808C228(GetPlayerFacingDirection());
|
sub_808C228(GetPlayerFacingDirection());
|
||||||
ObjectEventSetHeldMovement(playerEventObj, GetWalkInPlaceNormalMovementAction(GetPlayerFacingDirection()));
|
ObjectEventSetHeldMovement(playerObjEvent, GetWalkInPlaceNormalMovementAction(GetPlayerFacingDirection()));
|
||||||
gTasks[taskId].func = Task_WateringBerryTreeAnim_2;
|
gTasks[taskId].func = Task_WateringBerryTreeAnim_2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Task_WateringBerryTreeAnim_2(u8 taskId)
|
static void Task_WateringBerryTreeAnim_2(u8 taskId)
|
||||||
{
|
{
|
||||||
struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
if (ObjectEventClearHeldMovementIfFinished(playerEventObj))
|
if (ObjectEventClearHeldMovementIfFinished(playerObjEvent))
|
||||||
{
|
{
|
||||||
s16 value = gTasks[taskId].data[1]++;
|
s16 value = gTasks[taskId].data[1]++;
|
||||||
|
|
||||||
if (value < 10)
|
if (value < 10)
|
||||||
ObjectEventSetHeldMovement(playerEventObj, GetWalkInPlaceNormalMovementAction(GetPlayerFacingDirection()));
|
ObjectEventSetHeldMovement(playerObjEvent, GetWalkInPlaceNormalMovementAction(GetPlayerFacingDirection()));
|
||||||
|
|
||||||
else
|
else
|
||||||
gTasks[taskId].func = Task_WateringBerryTreeAnim_3;
|
gTasks[taskId].func = Task_WateringBerryTreeAnim_3;
|
||||||
|
|||||||
+7
-7
@@ -663,7 +663,7 @@ static const struct WindowTemplate gUnknown_08611C84 =
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Second field - whether the character is female.
|
// Second field - whether the character is female.
|
||||||
static const u8 sFacilityToBrainEventObjGfx[][2] =
|
static const u8 sFacilityToBrainObjEventGfx[][2] =
|
||||||
{
|
{
|
||||||
[FRONTIER_FACILITY_TOWER] = {OBJ_EVENT_GFX_ANABEL, TRUE},
|
[FRONTIER_FACILITY_TOWER] = {OBJ_EVENT_GFX_ANABEL, TRUE},
|
||||||
[FRONTIER_FACILITY_DOME] = {OBJ_EVENT_GFX_TUCKER, FALSE},
|
[FRONTIER_FACILITY_DOME] = {OBJ_EVENT_GFX_TUCKER, FALSE},
|
||||||
@@ -2201,7 +2201,7 @@ static void sub_81A447C(void)
|
|||||||
|
|
||||||
static void SetFacilityBrainObjectEvent(void)
|
static void SetFacilityBrainObjectEvent(void)
|
||||||
{
|
{
|
||||||
SetFrontierBrainEventObjGfx(VarGet(VAR_FRONTIER_FACILITY));
|
SetFrontierBrainObjEventGfx(VarGet(VAR_FRONTIER_FACILITY));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Battle Frontier Ranking Hall records.
|
// Battle Frontier Ranking Hall records.
|
||||||
@@ -2460,13 +2460,13 @@ void CopyFrontierBrainTrainerName(u8 *dst)
|
|||||||
bool8 IsFrontierBrainFemale(void)
|
bool8 IsFrontierBrainFemale(void)
|
||||||
{
|
{
|
||||||
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
|
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
|
||||||
return sFacilityToBrainEventObjGfx[facility][1];
|
return sFacilityToBrainObjEventGfx[facility][1];
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetFrontierBrainEventObjGfx_2(void)
|
void SetFrontierBrainObjEventGfx_2(void)
|
||||||
{
|
{
|
||||||
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
|
s32 facility = VarGet(VAR_FRONTIER_FACILITY);
|
||||||
VarSet(VAR_OBJ_GFX_ID_0, sFacilityToBrainEventObjGfx[facility][0]);
|
VarSet(VAR_OBJ_GFX_ID_0, sFacilityToBrainObjEventGfx[facility][0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define FRONTIER_BRAIN_OTID 61226
|
#define FRONTIER_BRAIN_OTID 61226
|
||||||
@@ -2766,10 +2766,10 @@ u16 GetFrontierBrainMonSpecies(u8 monId)
|
|||||||
return sFrontierBrainsMons[facility][symbol][monId].species;
|
return sFrontierBrainsMons[facility][symbol][monId].species;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetFrontierBrainEventObjGfx(u8 facility)
|
void SetFrontierBrainObjEventGfx(u8 facility)
|
||||||
{
|
{
|
||||||
gTrainerBattleOpponent_A = TRAINER_FRONTIER_BRAIN;
|
gTrainerBattleOpponent_A = TRAINER_FRONTIER_BRAIN;
|
||||||
VarSet(VAR_OBJ_GFX_ID_0, sFacilityToBrainEventObjGfx[facility][0]);
|
VarSet(VAR_OBJ_GFX_ID_0, sFacilityToBrainObjEventGfx[facility][0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
u16 GetFrontierBrainMonMove(u8 monId, u8 moveSlotId)
|
u16 GetFrontierBrainMonMove(u8 monId, u8 moveSlotId)
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ void SetMauvilleOldMan(void)
|
|||||||
SetupGiddy();
|
SetupGiddy();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ScrSpecial_SetMauvilleOldManEventObjGfx();
|
ScrSpecial_SetMauvilleOldManObjEventGfx();
|
||||||
}
|
}
|
||||||
|
|
||||||
u8 GetCurrentMauvilleOldMan(void)
|
u8 GetCurrentMauvilleOldMan(void)
|
||||||
@@ -407,7 +407,7 @@ void ResetMauvilleOldManFlag(void)
|
|||||||
case MAUVILLE_MAN_GIDDY:
|
case MAUVILLE_MAN_GIDDY:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ScrSpecial_SetMauvilleOldManEventObjGfx();
|
ScrSpecial_SetMauvilleOldManObjEventGfx();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -674,7 +674,7 @@ static void Task_BardSong(u8 taskId)
|
|||||||
RunTextPrintersAndIsPrinter0Active();
|
RunTextPrintersAndIsPrinter0Active();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScrSpecial_SetMauvilleOldManEventObjGfx(void)
|
void ScrSpecial_SetMauvilleOldManObjEventGfx(void)
|
||||||
{
|
{
|
||||||
VarSet(VAR_OBJ_GFX_ID_0, OBJ_EVENT_GFX_BARD);
|
VarSet(VAR_OBJ_GFX_ID_0, OBJ_EVENT_GFX_BARD);
|
||||||
}
|
}
|
||||||
|
|||||||
+47
-47
@@ -141,7 +141,7 @@ static void ResetAllTradingStates(void);
|
|||||||
static void UpdateHeldKeyCode(u16);
|
static void UpdateHeldKeyCode(u16);
|
||||||
static void UpdateAllLinkPlayers(u16*, s32);
|
static void UpdateAllLinkPlayers(u16*, s32);
|
||||||
static u8 FlipVerticalAndClearForced(u8 a1, u8 a2);
|
static u8 FlipVerticalAndClearForced(u8 a1, u8 a2);
|
||||||
static u8 LinkPlayerDetectCollision(u8 selfEventObjId, u8 a2, s16 x, s16 y);
|
static u8 LinkPlayerDetectCollision(u8 selfObjEventId, u8 a2, s16 x, s16 y);
|
||||||
static void CreateLinkPlayerSprite(u8 linkPlayerId, u8 gameVersion);
|
static void CreateLinkPlayerSprite(u8 linkPlayerId, u8 gameVersion);
|
||||||
static void GetLinkPlayerCoords(u8 linkPlayerId, u16 *x, u16 *y);
|
static void GetLinkPlayerCoords(u8 linkPlayerId, u16 *x, u16 *y);
|
||||||
static u8 GetLinkPlayerFacingDirection(u8 linkPlayerId);
|
static u8 GetLinkPlayerFacingDirection(u8 linkPlayerId);
|
||||||
@@ -157,7 +157,7 @@ static void sub_808780C(u8 linkPlayerId);
|
|||||||
static u8 GetSpriteForLinkedPlayer(u8 linkPlayerId);
|
static u8 GetSpriteForLinkedPlayer(u8 linkPlayerId);
|
||||||
static void sub_8087584(void);
|
static void sub_8087584(void);
|
||||||
static u32 GetLinkSendQueueLength(void);
|
static u32 GetLinkSendQueueLength(void);
|
||||||
static void ZeroLinkPlayerObjectEvent(struct LinkPlayerObjectEvent *linkPlayerEventObj);
|
static void ZeroLinkPlayerObjectEvent(struct LinkPlayerObjectEvent *linkPlayerObjEvent);
|
||||||
static const u8 *TryInteractWithPlayer(struct TradeRoomPlayer *a1);
|
static const u8 *TryInteractWithPlayer(struct TradeRoomPlayer *a1);
|
||||||
static u16 GetDirectionForEventScript(const u8 *script);
|
static u16 GetDirectionForEventScript(const u8 *script);
|
||||||
static void sub_8087510(void);
|
static void sub_8087510(void);
|
||||||
@@ -493,7 +493,7 @@ void ApplyNewEncryptionKeyToGameStats(u32 newKey)
|
|||||||
ApplyNewEncryptionKeyToWord(&gSaveBlock1Ptr->gameStats[i], newKey);
|
ApplyNewEncryptionKeyToWord(&gSaveBlock1Ptr->gameStats[i], newKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadEventObjTemplatesFromHeader(void)
|
void LoadObjEventTemplatesFromHeader(void)
|
||||||
{
|
{
|
||||||
// Clear map object templates
|
// Clear map object templates
|
||||||
CpuFill32(0, gSaveBlock1Ptr->objectEventTemplates, sizeof(gSaveBlock1Ptr->objectEventTemplates));
|
CpuFill32(0, gSaveBlock1Ptr->objectEventTemplates, sizeof(gSaveBlock1Ptr->objectEventTemplates));
|
||||||
@@ -504,7 +504,7 @@ void LoadEventObjTemplatesFromHeader(void)
|
|||||||
gMapHeader.events->objectEventCount * sizeof(struct ObjectEventTemplate));
|
gMapHeader.events->objectEventCount * sizeof(struct ObjectEventTemplate));
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadSaveblockEventObjScripts(void)
|
void LoadSaveblockObjEventScripts(void)
|
||||||
{
|
{
|
||||||
struct ObjectEventTemplate *mapHeaderObjTemplates = gMapHeader.events->objectEvents;
|
struct ObjectEventTemplate *mapHeaderObjTemplates = gMapHeader.events->objectEvents;
|
||||||
struct ObjectEventTemplate *savObjTemplates = gSaveBlock1Ptr->objectEventTemplates;
|
struct ObjectEventTemplate *savObjTemplates = gSaveBlock1Ptr->objectEventTemplates;
|
||||||
@@ -514,7 +514,7 @@ void LoadSaveblockEventObjScripts(void)
|
|||||||
savObjTemplates[i].script = mapHeaderObjTemplates[i].script;
|
savObjTemplates[i].script = mapHeaderObjTemplates[i].script;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Overworld_SetEventObjTemplateCoords(u8 localId, s16 x, s16 y)
|
void Overworld_SetObjEventTemplateCoords(u8 localId, s16 x, s16 y)
|
||||||
{
|
{
|
||||||
s32 i;
|
s32 i;
|
||||||
struct ObjectEventTemplate *savObjTemplates = gSaveBlock1Ptr->objectEventTemplates;
|
struct ObjectEventTemplate *savObjTemplates = gSaveBlock1Ptr->objectEventTemplates;
|
||||||
@@ -531,7 +531,7 @@ void Overworld_SetEventObjTemplateCoords(u8 localId, s16 x, s16 y)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Overworld_SetEventObjTemplateMovementType(u8 localId, u8 movementType)
|
void Overworld_SetObjEventTemplateMovementType(u8 localId, u8 movementType)
|
||||||
{
|
{
|
||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
@@ -814,7 +814,7 @@ void LoadMapFromCameraTransition(u8 mapGroup, u8 mapNum)
|
|||||||
|
|
||||||
ApplyCurrentWarp();
|
ApplyCurrentWarp();
|
||||||
LoadCurrentMapData();
|
LoadCurrentMapData();
|
||||||
LoadEventObjTemplatesFromHeader();
|
LoadObjEventTemplatesFromHeader();
|
||||||
TrySetMapSaveWarpStatus();
|
TrySetMapSaveWarpStatus();
|
||||||
ClearTempFieldEventData();
|
ClearTempFieldEventData();
|
||||||
ResetCyclingRoadChallengeData();
|
ResetCyclingRoadChallengeData();
|
||||||
@@ -857,7 +857,7 @@ static void mli0_load_map(u32 a1)
|
|||||||
else if (InTrainerHill())
|
else if (InTrainerHill())
|
||||||
LoadTrainerHillObjectEventTemplates();
|
LoadTrainerHillObjectEventTemplates();
|
||||||
else
|
else
|
||||||
LoadEventObjTemplatesFromHeader();
|
LoadObjEventTemplatesFromHeader();
|
||||||
}
|
}
|
||||||
|
|
||||||
isOutdoors = IsMapTypeOutdoors(gMapHeader.mapType);
|
isOutdoors = IsMapTypeOutdoors(gMapHeader.mapType);
|
||||||
@@ -1725,7 +1725,7 @@ void CB2_ContinueSavedGame(void)
|
|||||||
else if (trainerHillMapId != 0 && trainerHillMapId != TRAINER_HILL_ENTRANCE)
|
else if (trainerHillMapId != 0 && trainerHillMapId != TRAINER_HILL_ENTRANCE)
|
||||||
LoadTrainerHillFloorObjectEventScripts();
|
LoadTrainerHillFloorObjectEventScripts();
|
||||||
else
|
else
|
||||||
LoadSaveblockEventObjScripts();
|
LoadSaveblockObjEventScripts();
|
||||||
|
|
||||||
UnfreezeObjectEvents();
|
UnfreezeObjectEvents();
|
||||||
DoTimeBasedEvents();
|
DoTimeBasedEvents();
|
||||||
@@ -2918,9 +2918,9 @@ static u32 GetLinkSendQueueLength(void)
|
|||||||
return gLink.sendQueue.count;
|
return gLink.sendQueue.count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ZeroLinkPlayerObjectEvent(struct LinkPlayerObjectEvent *linkPlayerEventObj)
|
static void ZeroLinkPlayerObjectEvent(struct LinkPlayerObjectEvent *linkPlayerObjEvent)
|
||||||
{
|
{
|
||||||
memset(linkPlayerEventObj, 0, sizeof(struct LinkPlayerObjectEvent));
|
memset(linkPlayerObjEvent, 0, sizeof(struct LinkPlayerObjectEvent));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClearLinkPlayerObjectEvents(void)
|
void ClearLinkPlayerObjectEvents(void)
|
||||||
@@ -2936,16 +2936,16 @@ static void ZeroObjectEvent(struct ObjectEvent *objEvent)
|
|||||||
static void SpawnLinkPlayerObjectEvent(u8 linkPlayerId, s16 x, s16 y, u8 a4)
|
static void SpawnLinkPlayerObjectEvent(u8 linkPlayerId, s16 x, s16 y, u8 a4)
|
||||||
{
|
{
|
||||||
u8 objEventId = GetFirstInactiveObjectEventId();
|
u8 objEventId = GetFirstInactiveObjectEventId();
|
||||||
struct LinkPlayerObjectEvent *linkPlayerEventObj = &gLinkPlayerObjectEvents[linkPlayerId];
|
struct LinkPlayerObjectEvent *linkPlayerObjEvent = &gLinkPlayerObjectEvents[linkPlayerId];
|
||||||
struct ObjectEvent *objEvent = &gObjectEvents[objEventId];
|
struct ObjectEvent *objEvent = &gObjectEvents[objEventId];
|
||||||
|
|
||||||
ZeroLinkPlayerObjectEvent(linkPlayerEventObj);
|
ZeroLinkPlayerObjectEvent(linkPlayerObjEvent);
|
||||||
ZeroObjectEvent(objEvent);
|
ZeroObjectEvent(objEvent);
|
||||||
|
|
||||||
linkPlayerEventObj->active = 1;
|
linkPlayerObjEvent->active = 1;
|
||||||
linkPlayerEventObj->linkPlayerId = linkPlayerId;
|
linkPlayerObjEvent->linkPlayerId = linkPlayerId;
|
||||||
linkPlayerEventObj->objEventId = objEventId;
|
linkPlayerObjEvent->objEventId = objEventId;
|
||||||
linkPlayerEventObj->movementMode = MOVEMENT_MODE_FREE;
|
linkPlayerObjEvent->movementMode = MOVEMENT_MODE_FREE;
|
||||||
|
|
||||||
objEvent->active = 1;
|
objEvent->active = 1;
|
||||||
objEvent->singleMovementActive = a4;
|
objEvent->singleMovementActive = a4;
|
||||||
@@ -2978,12 +2978,12 @@ static void sub_80877DC(u8 linkPlayerId, u8 a2)
|
|||||||
|
|
||||||
static void sub_808780C(u8 linkPlayerId)
|
static void sub_808780C(u8 linkPlayerId)
|
||||||
{
|
{
|
||||||
struct LinkPlayerObjectEvent *linkPlayerEventObj = &gLinkPlayerObjectEvents[linkPlayerId];
|
struct LinkPlayerObjectEvent *linkPlayerObjEvent = &gLinkPlayerObjectEvents[linkPlayerId];
|
||||||
u8 objEventId = linkPlayerEventObj->objEventId;
|
u8 objEventId = linkPlayerObjEvent->objEventId;
|
||||||
struct ObjectEvent *objEvent = &gObjectEvents[objEventId];
|
struct ObjectEvent *objEvent = &gObjectEvents[objEventId];
|
||||||
if (objEvent->spriteId != MAX_SPRITES)
|
if (objEvent->spriteId != MAX_SPRITES)
|
||||||
DestroySprite(&gSprites[objEvent->spriteId]);
|
DestroySprite(&gSprites[objEvent->spriteId]);
|
||||||
linkPlayerEventObj->active = 0;
|
linkPlayerObjEvent->active = 0;
|
||||||
objEvent->active = 0;
|
objEvent->active = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3042,11 +3042,11 @@ static u8 GetLinkPlayerIdAt(s16 x, s16 y)
|
|||||||
|
|
||||||
static void SetPlayerFacingDirection(u8 linkPlayerId, u8 facing)
|
static void SetPlayerFacingDirection(u8 linkPlayerId, u8 facing)
|
||||||
{
|
{
|
||||||
struct LinkPlayerObjectEvent *linkPlayerEventObj = &gLinkPlayerObjectEvents[linkPlayerId];
|
struct LinkPlayerObjectEvent *linkPlayerObjEvent = &gLinkPlayerObjectEvents[linkPlayerId];
|
||||||
u8 objEventId = linkPlayerEventObj->objEventId;
|
u8 objEventId = linkPlayerObjEvent->objEventId;
|
||||||
struct ObjectEvent *objEvent = &gObjectEvents[objEventId];
|
struct ObjectEvent *objEvent = &gObjectEvents[objEventId];
|
||||||
|
|
||||||
if (linkPlayerEventObj->active)
|
if (linkPlayerObjEvent->active)
|
||||||
{
|
{
|
||||||
if (facing > FACING_FORCED_RIGHT)
|
if (facing > FACING_FORCED_RIGHT)
|
||||||
{
|
{
|
||||||
@@ -3056,9 +3056,9 @@ static void SetPlayerFacingDirection(u8 linkPlayerId, u8 facing)
|
|||||||
{
|
{
|
||||||
// This is a hack to split this code onto two separate lines, without declaring a local variable.
|
// This is a hack to split this code onto two separate lines, without declaring a local variable.
|
||||||
// C++ style inline variables would be nice here.
|
// C++ style inline variables would be nice here.
|
||||||
#define TEMP gLinkPlayerMovementModes[linkPlayerEventObj->movementMode](linkPlayerEventObj, objEvent, facing)
|
#define TEMP gLinkPlayerMovementModes[linkPlayerObjEvent->movementMode](linkPlayerObjEvent, objEvent, facing)
|
||||||
|
|
||||||
gMovementStatusHandler[TEMP](linkPlayerEventObj, objEvent);
|
gMovementStatusHandler[TEMP](linkPlayerObjEvent, objEvent);
|
||||||
|
|
||||||
// Clean up the hack.
|
// Clean up the hack.
|
||||||
#undef TEMP
|
#undef TEMP
|
||||||
@@ -3067,35 +3067,35 @@ static void SetPlayerFacingDirection(u8 linkPlayerId, u8 facing)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static u8 MovementEventModeCB_Normal(struct LinkPlayerObjectEvent *linkPlayerEventObj, struct ObjectEvent *objEvent, u8 a3)
|
static u8 MovementEventModeCB_Normal(struct LinkPlayerObjectEvent *linkPlayerObjEvent, struct ObjectEvent *objEvent, u8 a3)
|
||||||
{
|
{
|
||||||
return gLinkPlayerFacingHandlers[a3](linkPlayerEventObj, objEvent, a3);
|
return gLinkPlayerFacingHandlers[a3](linkPlayerObjEvent, objEvent, a3);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 MovementEventModeCB_Ignored(struct LinkPlayerObjectEvent *linkPlayerEventObj, struct ObjectEvent *objEvent, u8 a3)
|
static u8 MovementEventModeCB_Ignored(struct LinkPlayerObjectEvent *linkPlayerObjEvent, struct ObjectEvent *objEvent, u8 a3)
|
||||||
{
|
{
|
||||||
return FACING_UP;
|
return FACING_UP;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Duplicate Function
|
// Duplicate Function
|
||||||
static u8 MovementEventModeCB_Normal_2(struct LinkPlayerObjectEvent *linkPlayerEventObj, struct ObjectEvent *objEvent, u8 a3)
|
static u8 MovementEventModeCB_Normal_2(struct LinkPlayerObjectEvent *linkPlayerObjEvent, struct ObjectEvent *objEvent, u8 a3)
|
||||||
{
|
{
|
||||||
return gLinkPlayerFacingHandlers[a3](linkPlayerEventObj, objEvent, a3);
|
return gLinkPlayerFacingHandlers[a3](linkPlayerObjEvent, objEvent, a3);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool8 FacingHandler_DoNothing(struct LinkPlayerObjectEvent *linkPlayerEventObj, struct ObjectEvent *objEvent, u8 a3)
|
static bool8 FacingHandler_DoNothing(struct LinkPlayerObjectEvent *linkPlayerObjEvent, struct ObjectEvent *objEvent, u8 a3)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool8 FacingHandler_DpadMovement(struct LinkPlayerObjectEvent *linkPlayerEventObj, struct ObjectEvent *objEvent, u8 a3)
|
static bool8 FacingHandler_DpadMovement(struct LinkPlayerObjectEvent *linkPlayerObjEvent, struct ObjectEvent *objEvent, u8 a3)
|
||||||
{
|
{
|
||||||
s16 x, y;
|
s16 x, y;
|
||||||
|
|
||||||
objEvent->range.as_byte = FlipVerticalAndClearForced(a3, objEvent->range.as_byte);
|
objEvent->range.as_byte = FlipVerticalAndClearForced(a3, objEvent->range.as_byte);
|
||||||
ObjectEventMoveDestCoords(objEvent, objEvent->range.as_byte, &x, &y);
|
ObjectEventMoveDestCoords(objEvent, objEvent->range.as_byte, &x, &y);
|
||||||
|
|
||||||
if (LinkPlayerDetectCollision(linkPlayerEventObj->objEventId, objEvent->range.as_byte, x, y))
|
if (LinkPlayerDetectCollision(linkPlayerObjEvent->objEventId, objEvent->range.as_byte, x, y))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -3108,27 +3108,27 @@ static bool8 FacingHandler_DpadMovement(struct LinkPlayerObjectEvent *linkPlayer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool8 FacingHandler_ForcedFacingChange(struct LinkPlayerObjectEvent *linkPlayerEventObj, struct ObjectEvent *objEvent, u8 a3)
|
static bool8 FacingHandler_ForcedFacingChange(struct LinkPlayerObjectEvent *linkPlayerObjEvent, struct ObjectEvent *objEvent, u8 a3)
|
||||||
{
|
{
|
||||||
objEvent->range.as_byte = FlipVerticalAndClearForced(a3, objEvent->range.as_byte);
|
objEvent->range.as_byte = FlipVerticalAndClearForced(a3, objEvent->range.as_byte);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is called every time a free movement happens. Most of the time it's a No-Op.
|
// This is called every time a free movement happens. Most of the time it's a No-Op.
|
||||||
static void MovementStatusHandler_EnterFreeMode(struct LinkPlayerObjectEvent *linkPlayerEventObj, struct ObjectEvent *objEvent)
|
static void MovementStatusHandler_EnterFreeMode(struct LinkPlayerObjectEvent *linkPlayerObjEvent, struct ObjectEvent *objEvent)
|
||||||
{
|
{
|
||||||
linkPlayerEventObj->movementMode = MOVEMENT_MODE_FREE;
|
linkPlayerObjEvent->movementMode = MOVEMENT_MODE_FREE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void MovementStatusHandler_TryAdvanceScript(struct LinkPlayerObjectEvent *linkPlayerEventObj, struct ObjectEvent *objEvent)
|
static void MovementStatusHandler_TryAdvanceScript(struct LinkPlayerObjectEvent *linkPlayerObjEvent, struct ObjectEvent *objEvent)
|
||||||
{
|
{
|
||||||
objEvent->directionSequenceIndex--;
|
objEvent->directionSequenceIndex--;
|
||||||
linkPlayerEventObj->movementMode = MOVEMENT_MODE_FROZEN;
|
linkPlayerObjEvent->movementMode = MOVEMENT_MODE_FROZEN;
|
||||||
MoveCoords(objEvent->range.as_byte, &objEvent->initialCoords.x, &objEvent->initialCoords.y);
|
MoveCoords(objEvent->range.as_byte, &objEvent->initialCoords.x, &objEvent->initialCoords.y);
|
||||||
if (!objEvent->directionSequenceIndex)
|
if (!objEvent->directionSequenceIndex)
|
||||||
{
|
{
|
||||||
ShiftStillObjectEventCoords(objEvent);
|
ShiftStillObjectEventCoords(objEvent);
|
||||||
linkPlayerEventObj->movementMode = MOVEMENT_MODE_SCRIPTED;
|
linkPlayerObjEvent->movementMode = MOVEMENT_MODE_SCRIPTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3155,12 +3155,12 @@ static u8 FlipVerticalAndClearForced(u8 newFacing, u8 oldFacing)
|
|||||||
return oldFacing;
|
return oldFacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 LinkPlayerDetectCollision(u8 selfEventObjId, u8 a2, s16 x, s16 y)
|
static u8 LinkPlayerDetectCollision(u8 selfObjEventId, u8 a2, s16 x, s16 y)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
{
|
{
|
||||||
if (i != selfEventObjId)
|
if (i != selfObjEventId)
|
||||||
{
|
{
|
||||||
if ((gObjectEvents[i].currentCoords.x == x && gObjectEvents[i].currentCoords.y == y)
|
if ((gObjectEvents[i].currentCoords.x == x && gObjectEvents[i].currentCoords.y == y)
|
||||||
|| (gObjectEvents[i].previousCoords.x == x && gObjectEvents[i].previousCoords.y == y))
|
|| (gObjectEvents[i].previousCoords.x == x && gObjectEvents[i].previousCoords.y == y))
|
||||||
@@ -3174,12 +3174,12 @@ static u8 LinkPlayerDetectCollision(u8 selfEventObjId, u8 a2, s16 x, s16 y)
|
|||||||
|
|
||||||
static void CreateLinkPlayerSprite(u8 linkPlayerId, u8 gameVersion)
|
static void CreateLinkPlayerSprite(u8 linkPlayerId, u8 gameVersion)
|
||||||
{
|
{
|
||||||
struct LinkPlayerObjectEvent *linkPlayerEventObj = &gLinkPlayerObjectEvents[linkPlayerId];
|
struct LinkPlayerObjectEvent *linkPlayerObjEvent = &gLinkPlayerObjectEvents[linkPlayerId];
|
||||||
u8 objEventId = linkPlayerEventObj->objEventId;
|
u8 objEventId = linkPlayerObjEvent->objEventId;
|
||||||
struct ObjectEvent *objEvent = &gObjectEvents[objEventId];
|
struct ObjectEvent *objEvent = &gObjectEvents[objEventId];
|
||||||
struct Sprite *sprite;
|
struct Sprite *sprite;
|
||||||
|
|
||||||
if (linkPlayerEventObj->active)
|
if (linkPlayerObjEvent->active)
|
||||||
{
|
{
|
||||||
switch (gameVersion)
|
switch (gameVersion)
|
||||||
{
|
{
|
||||||
@@ -3205,14 +3205,14 @@ static void CreateLinkPlayerSprite(u8 linkPlayerId, u8 gameVersion)
|
|||||||
|
|
||||||
static void SpriteCB_LinkPlayer(struct Sprite *sprite)
|
static void SpriteCB_LinkPlayer(struct Sprite *sprite)
|
||||||
{
|
{
|
||||||
struct LinkPlayerObjectEvent *linkPlayerEventObj = &gLinkPlayerObjectEvents[sprite->data[0]];
|
struct LinkPlayerObjectEvent *linkPlayerObjEvent = &gLinkPlayerObjectEvents[sprite->data[0]];
|
||||||
struct ObjectEvent *objEvent = &gObjectEvents[linkPlayerEventObj->objEventId];
|
struct ObjectEvent *objEvent = &gObjectEvents[linkPlayerObjEvent->objEventId];
|
||||||
sprite->pos1.x = objEvent->initialCoords.x;
|
sprite->pos1.x = objEvent->initialCoords.x;
|
||||||
sprite->pos1.y = objEvent->initialCoords.y;
|
sprite->pos1.y = objEvent->initialCoords.y;
|
||||||
SetObjectSubpriorityByZCoord(objEvent->previousElevation, sprite, 1);
|
SetObjectSubpriorityByZCoord(objEvent->previousElevation, sprite, 1);
|
||||||
sprite->oam.priority = ZCoordToPriority(objEvent->previousElevation);
|
sprite->oam.priority = ZCoordToPriority(objEvent->previousElevation);
|
||||||
|
|
||||||
if (!linkPlayerEventObj->movementMode != MOVEMENT_MODE_FREE)
|
if (!linkPlayerObjEvent->movementMode != MOVEMENT_MODE_FREE)
|
||||||
StartSpriteAnim(sprite, GetFaceDirectionAnimNum(objEvent->range.as_byte));
|
StartSpriteAnim(sprite, GetFaceDirectionAnimNum(objEvent->range.as_byte));
|
||||||
else
|
else
|
||||||
StartSpriteAnimIfDifferent(sprite, GetMoveDirectionAnimNum(objEvent->range.as_byte));
|
StartSpriteAnimIfDifferent(sprite, GetMoveDirectionAnimNum(objEvent->range.as_byte));
|
||||||
|
|||||||
+2
-2
@@ -1100,7 +1100,7 @@ bool8 ScrCmd_setobjectxyperm(struct ScriptContext *ctx)
|
|||||||
u16 x = VarGet(ScriptReadHalfword(ctx));
|
u16 x = VarGet(ScriptReadHalfword(ctx));
|
||||||
u16 y = VarGet(ScriptReadHalfword(ctx));
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
||||||
|
|
||||||
Overworld_SetEventObjTemplateCoords(localId, x, y);
|
Overworld_SetObjEventTemplateCoords(localId, x, y);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1177,7 +1177,7 @@ bool8 ScrCmd_setobjectmovementtype(struct ScriptContext *ctx)
|
|||||||
u16 localId = VarGet(ScriptReadHalfword(ctx));
|
u16 localId = VarGet(ScriptReadHalfword(ctx));
|
||||||
u8 movementType = ScriptReadByte(ctx);
|
u8 movementType = ScriptReadByte(ctx);
|
||||||
|
|
||||||
Overworld_SetEventObjTemplateMovementType(localId, movementType);
|
Overworld_SetObjEventTemplateMovementType(localId, movementType);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,12 +118,12 @@ static u8 GetMovementScriptIdFromObjectEventId(u8 taskId, u8 objEventId)
|
|||||||
return OBJECT_EVENTS_COUNT;
|
return OBJECT_EVENTS_COUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LoadObjectEventIdPtrFromMovementScript(u8 taskId, u8 moveScrId, u8 **pEventObjId)
|
static void LoadObjectEventIdPtrFromMovementScript(u8 taskId, u8 moveScrId, u8 **pObjEventId)
|
||||||
{
|
{
|
||||||
u8 i;
|
u8 i;
|
||||||
|
|
||||||
*pEventObjId = (u8 *)&gTasks[taskId].data[1];
|
*pObjEventId = (u8 *)&gTasks[taskId].data[1];
|
||||||
for (i = 0; i < moveScrId; i++, (*pEventObjId)++)
|
for (i = 0; i < moveScrId; i++, (*pObjEventId)++)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,14 +184,14 @@ static void ScriptMovement_AddNewMovement(u8 taskId, u8 moveScrId, u8 objEventId
|
|||||||
|
|
||||||
static void ScriptMovement_UnfreezeActiveObjects(u8 taskId)
|
static void ScriptMovement_UnfreezeActiveObjects(u8 taskId)
|
||||||
{
|
{
|
||||||
u8 *pEventObjId;
|
u8 *pObjEventId;
|
||||||
u8 i;
|
u8 i;
|
||||||
|
|
||||||
pEventObjId = (u8 *)&gTasks[taskId].data[1];
|
pObjEventId = (u8 *)&gTasks[taskId].data[1];
|
||||||
for (i = 0; i < OBJECT_EVENTS_COUNT; i++, pEventObjId++)
|
for (i = 0; i < OBJECT_EVENTS_COUNT; i++, pObjEventId++)
|
||||||
{
|
{
|
||||||
if (*pEventObjId != 0xFF)
|
if (*pObjEventId != 0xFF)
|
||||||
UnfreezeObjectEvent(&gObjectEvents[*pEventObjId]);
|
UnfreezeObjectEvent(&gObjectEvents[*pObjEventId]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user