From 7034f59c14fd6fad2634e9b35b405e2b33f75646 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Thu, 21 Nov 2019 00:14:40 -0500 Subject: [PATCH] Rename EventObj to ObjEvent --- .../MauvilleCity_PokemonCenter_1F/scripts.inc | 2 +- data/specials.inc | 2 +- include/battle_setup.h | 4 +- include/frontier_util.h | 4 +- include/mauville_old_man.h | 2 +- include/overworld.h | 8 +- src/battle_pike.c | 2 +- src/battle_setup.c | 12 +- src/battle_tower.c | 2 +- src/bike.c | 116 +++++++------- src/event_object_movement.c | 6 +- src/field_player_avatar.c | 150 +++++++++--------- src/field_specials.c | 2 +- src/fldeff_misc.c | 14 +- src/frontier_util.c | 14 +- src/mauville_old_man.c | 6 +- src/overworld.c | 94 +++++------ src/scrcmd.c | 4 +- src/script_movement.c | 16 +- 19 files changed, 230 insertions(+), 230 deletions(-) diff --git a/data/maps/MauvilleCity_PokemonCenter_1F/scripts.inc b/data/maps/MauvilleCity_PokemonCenter_1F/scripts.inc index f37f362e2..ee13ffcfd 100644 --- a/data/maps/MauvilleCity_PokemonCenter_1F/scripts.inc +++ b/data/maps/MauvilleCity_PokemonCenter_1F/scripts.inc @@ -10,7 +10,7 @@ MauvilleCity_PokemonCenter_1F_OnTransition: @ 8210E66 end MauvilleCity_PokemonCenter_1F_EventScript_SetMauvilleOldManGfx:: @ 8210E74 - special ScrSpecial_SetMauvilleOldManEventObjGfx + special ScrSpecial_SetMauvilleOldManObjEventGfx end @ VAR_0x800B is the Nurse's object event id diff --git a/data/specials.inc b/data/specials.inc index 40e6296ac..3f8368566 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -115,7 +115,7 @@ gSpecials:: @ 81DBA64 def_special ScrSpecial_SetHipsterSpokenFlag def_special ScrSpecial_HipsterTeachWord def_special ScrSpecial_PlayBardSong - def_special ScrSpecial_SetMauvilleOldManEventObjGfx + def_special ScrSpecial_SetMauvilleOldManObjEventGfx def_special ScrSpecial_GenerateGiddyLine def_special ScrSpecial_GiddyShouldTellAnotherTale def_special ScrSpecial_StorytellerGetFreeStorySlot diff --git a/include/battle_setup.h b/include/battle_setup.h index 984c820bb..08fa60155 100644 --- a/include/battle_setup.h +++ b/include/battle_setup.h @@ -34,8 +34,8 @@ void ChooseStarter(void); void ResetTrainerOpponentIds(void); void SetMapVarsToTrainer(void); const u8 *BattleSetup_ConfigureTrainerBattle(const u8 *data); -void ConfigureAndSetUpOneTrainerBattle(u8 trainerEventObjId, const u8 *trainerScript); -void ConfigureTwoTrainersBattle(u8 trainerEventObjId, const u8 *trainerScript); +void ConfigureAndSetUpOneTrainerBattle(u8 trainerObjEventId, const u8 *trainerScript); +void ConfigureTwoTrainersBattle(u8 trainerObjEventId, const u8 *trainerScript); void SetUpTwoTrainersBattle(void); bool32 GetTrainerFlagFromScriptPointer(const u8 *data); void SetUpTrainerMovement(void); diff --git a/include/frontier_util.h b/include/frontier_util.h index 627b5bef5..273c4cc20 100644 --- a/include/frontier_util.h +++ b/include/frontier_util.h @@ -16,10 +16,10 @@ u8 GetFrontierBrainTrainerPicIndex(void); u8 GetFrontierBrainTrainerClass(void); void CopyFrontierBrainTrainerName(u8 *dst); bool8 IsFrontierBrainFemale(void); -void SetFrontierBrainEventObjGfx_2(void); +void SetFrontierBrainObjEventGfx_2(void); void CreateFrontierBrainPokemon(void); u16 GetFrontierBrainMonSpecies(u8 monId); -void SetFrontierBrainEventObjGfx(u8 facility); +void SetFrontierBrainObjEventGfx(u8 facility); u16 GetFrontierBrainMonMove(u8 monId, u8 moveSlotId); u8 GetFrontierBrainMonNature(u8 monId); u8 GetFrontierBrainMonEvs(u8 monId, u8 evStatId); diff --git a/include/mauville_old_man.h b/include/mauville_old_man.h index 3845ac290..29c66a992 100644 --- a/include/mauville_old_man.h +++ b/include/mauville_old_man.h @@ -5,7 +5,7 @@ extern struct BardSong gBardSong; void SetMauvilleOldMan(void); u8 GetCurrentMauvilleOldMan(void); -void ScrSpecial_SetMauvilleOldManEventObjGfx(void); +void ScrSpecial_SetMauvilleOldManObjEventGfx(void); u8 sub_81201C8(void); void sub_8120B70(OldMan *dest); void sub_8120670(void); diff --git a/include/overworld.h b/include/overworld.h index dced95007..0e3c7e006 100644 --- a/include/overworld.h +++ b/include/overworld.h @@ -63,10 +63,10 @@ void IncrementGameStat(u8 index); u32 GetGameStat(u8 index); void SetGameStat(u8 index, u32 value); void ApplyNewEncryptionKeyToGameStats(u32 newKey); -void LoadEventObjTemplatesFromHeader(void); -void LoadSaveblockEventObjScripts(void); -void Overworld_SetEventObjTemplateCoords(u8 localId, s16 x, s16 y); -void Overworld_SetEventObjTemplateMovementType(u8 localId, u8 movementType); +void LoadObjEventTemplatesFromHeader(void); +void LoadSaveblockObjEventScripts(void); +void Overworld_SetObjEventTemplateCoords(u8 localId, s16 x, s16 y); +void Overworld_SetObjEventTemplateMovementType(u8 localId, u8 movementType); const struct MapLayout *GetMapLayout(void); void ApplyCurrentWarp(void); struct MapHeader const *const Overworld_GetMapHeaderByGroupAndId(u16 mapGroup, u16 mapNum); diff --git a/src/battle_pike.c b/src/battle_pike.c index 9b45c7b11..730063b88 100644 --- a/src/battle_pike.c +++ b/src/battle_pike.c @@ -601,7 +601,7 @@ static void SetupRoomObjectEvents(void) setObjGfx1 = FALSE; break; case PIKE_ROOM_BRAIN: - SetFrontierBrainEventObjGfx(FRONTIER_FACILITY_PIKE); + SetFrontierBrainObjEventGfx(FRONTIER_FACILITY_PIKE); objGfx2 = OBJ_EVENT_GFX_LINK_RECEPTIONIST; setObjGfx1 = FALSE; setObjGfx2 = TRUE; diff --git a/src/battle_setup.c b/src/battle_setup.c index c63d38e70..ea4e807c7 100644 --- a/src/battle_setup.c +++ b/src/battle_setup.c @@ -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; - gSpecialVar_LastTalked = gObjectEvents[trainerEventObjId].localId; + gSelectedObjectEvent = trainerObjEventId; + gSpecialVar_LastTalked = gObjectEvents[trainerObjEventId].localId; BattleSetup_ConfigureTrainerBattle(trainerScript + 1); ScriptContext1_SetupScript(EventScript_271354); ScriptContext2_Enable(); } -void ConfigureTwoTrainersBattle(u8 trainerEventObjId, const u8 *trainerScript) +void ConfigureTwoTrainersBattle(u8 trainerObjEventId, const u8 *trainerScript) { - gSelectedObjectEvent = trainerEventObjId; - gSpecialVar_LastTalked = gObjectEvents[trainerEventObjId].localId; + gSelectedObjectEvent = trainerObjEventId; + gSpecialVar_LastTalked = gObjectEvents[trainerObjEventId].localId; BattleSetup_ConfigureTrainerBattle(trainerScript + 1); } diff --git a/src/battle_tower.c b/src/battle_tower.c index 1f1220e22..199588571 100644 --- a/src/battle_tower.c +++ b/src/battle_tower.c @@ -1414,7 +1414,7 @@ void SetBattleFacilityTrainerGfxId(u16 trainerId, u8 tempVarId) } else if (trainerId == TRAINER_FRONTIER_BRAIN) { - SetFrontierBrainEventObjGfx_2(); + SetFrontierBrainObjEventGfx_2(); return; } else if (trainerId < TRAINER_RECORD_MIXING_FRIEND) diff --git a/src/bike.c b/src/bike.c index 0000ff181..b265a31bb 100644 --- a/src/bike.c +++ b/src/bike.c @@ -186,31 +186,31 @@ static void MachBikeTransition_FaceDirection(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); Bike_SetBikeStill(); } else { - MachBikeTransition_FaceDirection(playerEventObj->facingDirection); + MachBikeTransition_FaceDirection(playerObjEvent->facingDirection); } } static void MachBikeTransition_TrySpeedUp(u8 direction) { - struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId]; + struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; 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. if (gPlayerAvatar.bikeSpeed) - MachBikeTransition_TrySlowDown(playerEventObj->movementDirection); + MachBikeTransition_TrySlowDown(playerObjEvent->movementDirection); else - MachBikeTransition_FaceDirection(playerEventObj->movementDirection); + MachBikeTransition_FaceDirection(playerObjEvent->movementDirection); } else { @@ -366,10 +366,10 @@ static u8 AcroBikeHandleInputTurning(u8 *newDirection, u16 newKeys, u16 heldKeys static u8 AcroBikeHandleInputWheelieStanding(u8 *newDirection, u16 newKeys, u16 heldKeys) { u8 direction; - struct ObjectEvent *playerEventObj; + struct ObjectEvent *playerObjEvent; direction = GetPlayerMovementDirection(); - playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId]; + playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; gPlayerAvatar.runningState = NOT_MOVING; if (heldKeys & B_BUTTON) @@ -378,7 +378,7 @@ static u8 AcroBikeHandleInputWheelieStanding(u8 *newDirection, u16 newKeys, u16 { // B button was released. gPlayerAvatar.bikeFrameCounter = 0; - if (!MetatileBehavior_IsBumpySlope(playerEventObj->currentMetatileBehavior)) + if (!MetatileBehavior_IsBumpySlope(playerObjEvent->currentMetatileBehavior)) { // Go back to normal on flat ground *newDirection = direction; @@ -413,15 +413,15 @@ static u8 AcroBikeHandleInputWheelieStanding(u8 *newDirection, u16 newKeys, u16 static u8 AcroBikeHandleInputBunnyHop(u8 *newDirection, u16 newKeys, u16 heldKeys) { u8 direction; - struct ObjectEvent *playerEventObj; + struct ObjectEvent *playerObjEvent; direction = GetPlayerMovementDirection(); - playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId]; + playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; if (!(heldKeys & B_BUTTON)) { // B button was released 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. 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) { u8 direction; - struct ObjectEvent *playerEventObj; + struct ObjectEvent *playerObjEvent; direction = GetPlayerFacingDirection(); - playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId]; + playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; if (!(heldKeys & B_BUTTON)) { // we were moving on a wheelie, but we let go while moving. reset bike still status 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 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) { - struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId]; + struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; - playerEventObj->facingDirectionLocked = 0; - SetObjectEventDirection(playerEventObj, playerEventObj->facingDirection); + playerObjEvent->facingDirectionLocked = 0; + SetObjectEventDirection(playerObjEvent, playerObjEvent->facingDirection); gPlayerAvatar.acroBikeState = ACRO_STATE_NORMAL; return CheckMovementInputAcroBike(ptr, newKeys, heldKeys); } @@ -535,21 +535,21 @@ static void AcroBikeTransition_FaceDirection(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) - direction = playerEventObj->movementDirection; + if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == 0) + direction = playerObjEvent->movementDirection; PlayerFaceDirection(direction); } static void AcroBikeTransition_Moving(u8 direction) { 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; } collision = GetBikeCollision(direction); @@ -570,48 +570,48 @@ static void AcroBikeTransition_Moving(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) - direction = playerEventObj->movementDirection; + if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == 0) + direction = playerObjEvent->movementDirection; PlayerStartWheelie(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) - direction = playerEventObj->movementDirection; + if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == 0) + direction = playerObjEvent->movementDirection; PlayerEndWheelie(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) - direction = playerEventObj->movementDirection; + if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == 0) + direction = playerObjEvent->movementDirection; PlayerIdleWheelie(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) - direction = playerEventObj->movementDirection; + if (CanBikeFaceDirOnMetatile(direction, playerObjEvent->currentMetatileBehavior) == 0) + direction = playerObjEvent->movementDirection; PlayerStandingHoppingWheelie(direction); } static void AcroBikeTransition_WheelieHoppingMoving(u8 direction) { 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; } collision = GetBikeCollision(direction); @@ -641,7 +641,7 @@ static void AcroBikeTransition_WheelieHoppingMoving(u8 direction) static void AcroBikeTransition_SideJump(u8 direction) { u8 collision; - struct ObjectEvent *playerEventObj; + struct ObjectEvent *playerObjEvent; collision = GetBikeCollision(direction); if (collision) @@ -659,9 +659,9 @@ static void AcroBikeTransition_SideJump(u8 direction) return; } } - playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId]; + playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; PlaySE(SE_JITE_PYOKO); - playerEventObj->facingDirectionLocked = 1; + playerObjEvent->facingDirectionLocked = 1; PlayerSetAnimId(GetJumpMovementAction(direction), 2); } @@ -673,11 +673,11 @@ static void AcroBikeTransition_TurnJump(u8 direction) static void AcroBikeTransition_WheelieMoving(u8 direction) { 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; } collision = GetBikeCollision(direction); @@ -693,7 +693,7 @@ static void AcroBikeTransition_WheelieMoving(u8 direction) } else if (collision < COLLISION_STOP_SURFING) { - if (MetatileBehavior_IsBumpySlope(playerEventObj->currentMetatileBehavior)) + if (MetatileBehavior_IsBumpySlope(playerObjEvent->currentMetatileBehavior)) PlayerIdleWheelie(direction); else sub_808B980(direction); //hit wall? @@ -707,11 +707,11 @@ static void AcroBikeTransition_WheelieMoving(u8 direction) static void AcroBikeTransition_WheelieRisingMoving(u8 direction) { 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; } collision = GetBikeCollision(direction); @@ -727,7 +727,7 @@ static void AcroBikeTransition_WheelieRisingMoving(u8 direction) } else if (collision < COLLISION_STOP_SURFING) { - if (MetatileBehavior_IsBumpySlope(playerEventObj->currentMetatileBehavior)) + if (MetatileBehavior_IsBumpySlope(playerObjEvent->currentMetatileBehavior)) PlayerIdleWheelie(direction); else sub_808B980(direction); //hit wall? @@ -741,11 +741,11 @@ static void AcroBikeTransition_WheelieRisingMoving(u8 direction) static void AcroBikeTransition_WheelieLoweringMoving(u8 direction) { 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; } collision = GetBikeCollision(direction); @@ -868,12 +868,12 @@ static u8 Bike_DPadToDirection(u16 heldKeys) static u8 GetBikeCollision(u8 direction) { u8 metatitleBehavior; - struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId]; - s16 x = playerEventObj->currentCoords.x; - s16 y = playerEventObj->currentCoords.y; + struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; + s16 x = playerObjEvent->currentCoords.x; + s16 y = playerObjEvent->currentCoords.y; MoveCoords(direction, &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) diff --git a/src/event_object_movement.c b/src/event_object_movement.c index e32af3e1e..86999f265 100644 --- a/src/event_object_movement.c +++ b/src/event_object_movement.c @@ -69,7 +69,7 @@ static bool8 IsCoordOutsideObjectEventMovementRange(struct ObjectEvent *, s16, s static bool8 IsMetatileDirectionallyImpassable(struct ObjectEvent *, s16, s16, u8); static bool8 DoesObjectCollideWithObjectAt(struct ObjectEvent *, s16, s16); 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 GetGroundEffectFlags_Reflection(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) { sub_8096530(objectEvent, sprite); - UpdateEventObjSpriteVisibility(objectEvent, sprite); + UpdateObjEventSpriteVisibility(objectEvent, 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; if (objectEvent->invisible || objectEvent->offScreen) diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c index d553dfb05..9e23f2a34 100644 --- a/src/field_player_avatar.c +++ b/src/field_player_avatar.c @@ -321,15 +321,15 @@ static u8 ObjectEventCB2_NoMovement2(void) 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) { 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(); 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 r6 = direction; r6++; r6--; - if (ObjectEventIsMovementOverridden(playerEventObj) - && !ObjectEventClearHeldMovementIfFinished(playerEventObj)) + if (ObjectEventIsMovementOverridden(playerObjEvent) + && !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 (direction == DIR_NONE) @@ -357,15 +357,15 @@ static bool8 TryInterruptObjectEventSpecialAnim(struct ObjectEvent *playerEventO return TRUE; } - if (playerEventObj->movementDirection != r5) + if (playerObjEvent->movementDirection != r5) { - ObjectEventClearHeldMovement(playerEventObj); + ObjectEventClearHeldMovement(playerObjEvent); return FALSE; } if (!sub_808B028(r6)) { - ObjectEventClearHeldMovement(playerEventObj); + ObjectEventClearHeldMovement(playerObjEvent); return FALSE; } } @@ -425,11 +425,11 @@ static bool8 ForcedMovement_None(void) { if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_6) { - struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId]; + struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; - playerEventObj->facingDirectionLocked = 0; - playerEventObj->enableAnim = 1; - SetObjectEventDirection(playerEventObj, playerEventObj->facingDirection); + playerObjEvent->facingDirectionLocked = 0; + playerObjEvent->enableAnim = 1; + SetObjectEventDirection(playerObjEvent, playerObjEvent->facingDirection); gPlayerAvatar.flags &= ~PLAYER_AVATAR_FLAG_6; } return FALSE; @@ -467,10 +467,10 @@ static u8 DoForcedMovement(u8 direction, void (*b)(u8)) static u8 DoForcedMovementInCurrentDirection(void (*a)(u8)) { - struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId]; + struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; - playerEventObj->disableAnim = 1; - return DoForcedMovement(playerEventObj->movementDirection, a); + playerObjEvent->disableAnim = 1; + return DoForcedMovement(playerObjEvent->movementDirection, a); } static bool8 ForcedMovement_Slip(void) @@ -520,10 +520,10 @@ static bool8 ForcedMovement_PushedEastByCurrent(void) u8 ForcedMovement_Slide(u8 direction, void (*b)(u8)) { - struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId]; + struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; - playerEventObj->disableAnim = 1; - playerEventObj->facingDirectionLocked = 1; + playerObjEvent->disableAnim = 1; + playerObjEvent->facingDirectionLocked = 1; return DoForcedMovement(direction, b); } @@ -561,12 +561,12 @@ static bool8 ForcedMovement_0xBC(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); - playerEventObj->facingDirectionLocked = 1; + playerObjEvent->facingDirectionLocked = 1; return DoForcedMovement(1, PlayerGoSpeed2); } else @@ -657,23 +657,23 @@ static void PlayerNotOnBikeMoving(u8 direction, u16 heldKeys) static u8 CheckForPlayerAvatarCollision(u8 direction) { s16 x, y; - struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId]; + struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; - x = playerEventObj->currentCoords.x; - y = playerEventObj->currentCoords.y; + x = playerObjEvent->currentCoords.x; + y = playerObjEvent->currentCoords.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) { s16 x, y; - struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId]; + struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; - x = playerEventObj->currentCoords.x; - y = playerEventObj->currentCoords.y; + x = playerObjEvent->currentCoords.x; + y = playerObjEvent->currentCoords.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) @@ -1208,10 +1208,10 @@ void sub_808BCE8(void) void sub_808BCF4(void) { - struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId]; + struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; - npc_clear_strange_bits(playerEventObj); - SetObjectEventDirection(playerEventObj, playerEventObj->facingDirection); + npc_clear_strange_bits(playerObjEvent); + SetObjectEventDirection(playerObjEvent, playerObjEvent->facingDirection); if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE)) { Bike_HandleBumpySlopeJump(); @@ -1307,12 +1307,12 @@ bool8 IsPlayerSurfingNorth(void) bool8 IsPlayerFacingSurfableFishableWater(void) { - struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId]; - s16 x = playerEventObj->currentCoords.x; - s16 y = playerEventObj->currentCoords.y; + struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; + s16 x = playerObjEvent->currentCoords.x; + s16 y = playerObjEvent->currentCoords.y; - MoveCoords(playerEventObj->facingDirection, &x, &y); - if (GetCollisionAtCoords(playerEventObj, x, y, playerEventObj->facingDirection) == COLLISION_ELEVATION_MISMATCH + MoveCoords(playerObjEvent->facingDirection, &x, &y); + if (GetCollisionAtCoords(playerObjEvent, x, y, playerObjEvent->facingDirection) == COLLISION_ELEVATION_MISMATCH && PlayerGetZCoord() == 3 && MetatileBehavior_IsSurfableFishableWater(MapGridGetMetatileBehaviorAt(x, y))) return TRUE; @@ -1366,23 +1366,23 @@ void SetPlayerAvatarExtraStateTransition(u8 graphicsId, u8 b) void InitPlayerAvatar(s16 x, s16 y, u8 direction, u8 gender) { - struct ObjectEventTemplate playerEventObjTemplate; + struct ObjectEventTemplate playerObjEventTemplate; u8 objectEventId; struct ObjectEvent *objectEvent; - playerEventObjTemplate.localId = OBJ_EVENT_ID_PLAYER; - playerEventObjTemplate.graphicsId = GetPlayerAvatarGraphicsIdByStateIdAndGender(PLAYER_AVATAR_STATE_NORMAL, gender); - playerEventObjTemplate.x = x - 7; - playerEventObjTemplate.y = y - 7; - playerEventObjTemplate.elevation = 0; - playerEventObjTemplate.movementType = MOVEMENT_TYPE_PLAYER; - playerEventObjTemplate.movementRangeX = 0; - playerEventObjTemplate.movementRangeY = 0; - playerEventObjTemplate.trainerType = 0; - playerEventObjTemplate.trainerRange_berryTreeId = 0; - playerEventObjTemplate.script = NULL; - playerEventObjTemplate.flagId = 0; - objectEventId = SpawnSpecialObjectEvent(&playerEventObjTemplate); + playerObjEventTemplate.localId = OBJ_EVENT_ID_PLAYER; + playerObjEventTemplate.graphicsId = GetPlayerAvatarGraphicsIdByStateIdAndGender(PLAYER_AVATAR_STATE_NORMAL, gender); + playerObjEventTemplate.x = x - 7; + playerObjEventTemplate.y = y - 7; + playerObjEventTemplate.elevation = 0; + playerObjEventTemplate.movementType = MOVEMENT_TYPE_PLAYER; + playerObjEventTemplate.movementRangeX = 0; + playerObjEventTemplate.movementRangeY = 0; + playerObjEventTemplate.trainerType = 0; + playerObjEventTemplate.trainerRange_berryTreeId = 0; + playerObjEventTemplate.script = NULL; + playerObjEventTemplate.flagId = 0; + objectEventId = SpawnSpecialObjectEvent(&playerObjEventTemplate); objectEvent = &gObjectEvents[objectEventId]; objectEvent->isPlayer = 1; objectEvent->warpArrowSpriteId = CreateWarpArrowSprite(); @@ -1642,29 +1642,29 @@ static void CreateStopSurfingTask(u8 direction) 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; } - sub_81555AC(playerEventObj->fieldEffectSpriteId, 2); - ObjectEventSetHeldMovement(playerEventObj, GetJumpSpecialMovementAction((u8)gTasks[taskId].data[0])); + sub_81555AC(playerObjEvent->fieldEffectSpriteId, 2); + ObjectEventSetHeldMovement(playerObjEvent, GetJumpSpecialMovementAction((u8)gTasks[taskId].data[0])); gTasks[taskId].func = Task_WaitStopSurfing; } 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)); - ObjectEventSetHeldMovement(playerEventObj, GetFaceDirectionMovementAction(playerEventObj->facingDirection)); + ObjectEventSetGraphicsId(playerObjEvent, GetPlayerAvatarGraphicsIdByStateId(PLAYER_AVATAR_STATE_NORMAL)); + ObjectEventSetHeldMovement(playerObjEvent, GetFaceDirectionMovementAction(playerObjEvent->facingDirection)); gPlayerAvatar.preventStep = FALSE; ScriptContext2_Disable(); - DestroySprite(&gSprites[playerEventObj->fieldEffectSpriteId]); + DestroySprite(&gSprites[playerObjEvent->fieldEffectSpriteId]); DestroyTask(taskId); } } @@ -1729,17 +1729,17 @@ static bool8 Fishing1(struct Task *task) static bool8 Fishing2(struct Task *task) { - struct ObjectEvent *playerEventObj; + struct ObjectEvent *playerObjEvent; const s16 arr1[] = {1, 1, 1}; const s16 arr2[] = {1, 3, 6}; task->tRoundsPlayed = 0; task->tMinRoundsRequired = arr1[task->tFishingRod] + (Random() % arr2[task->tFishingRod]); task->tPlayerGfxId = gObjectEvents[gPlayerAvatar.objectEventId].graphicsId; - playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId]; - ObjectEventClearHeldMovementIfActive(playerEventObj); - playerEventObj->enableAnim = 1; - sub_808C15C(playerEventObj->facingDirection); + playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; + ObjectEventClearHeldMovementIfActive(playerObjEvent); + playerObjEvent->enableAnim = 1; + sub_808C15C(playerObjEvent->facingDirection); task->tStep++; return FALSE; } @@ -1928,10 +1928,10 @@ static bool8 Fishing11(struct Task *task) { if (!IsTextPrinterActive(0)) { - struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId]; + struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; - ObjectEventSetGraphicsId(playerEventObj, task->tPlayerGfxId); - ObjectEventTurn(playerEventObj, playerEventObj->movementDirection); + ObjectEventSetGraphicsId(playerObjEvent, task->tPlayerGfxId); + ObjectEventTurn(playerObjEvent, playerObjEvent->movementDirection); if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING) sub_8155604(gObjectEvents[gPlayerAvatar.objectEventId].fieldEffectSpriteId, 0, 0); gSprites[gPlayerAvatar.spriteId].pos2.x = 0; @@ -1988,10 +1988,10 @@ static bool8 Fishing15(struct Task *task) AlignFishingAnimationFrames(); if (gSprites[gPlayerAvatar.spriteId].animEnded) { - struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId]; + struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; - ObjectEventSetGraphicsId(playerEventObj, task->tPlayerGfxId); - ObjectEventTurn(playerEventObj, playerEventObj->movementDirection); + ObjectEventSetGraphicsId(playerObjEvent, task->tPlayerGfxId); + ObjectEventTurn(playerObjEvent, playerObjEvent->movementDirection); if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_SURFING) sub_8155604(gObjectEvents[gPlayerAvatar.objectEventId].fieldEffectSpriteId, 0, 0); gSprites[gPlayerAvatar.spriteId].pos2.x = 0; diff --git a/src/field_specials.c b/src/field_specials.c index f83190613..319004add 100644 --- a/src/field_specials.c +++ b/src/field_specials.c @@ -3455,7 +3455,7 @@ static void ChangeDeoxysRockLevel(u8 rockLevel) gFieldEffectArguments[5] = 5; 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) diff --git a/src/fldeff_misc.c b/src/fldeff_misc.c index 8bb10685e..a1f8d14fa 100644 --- a/src/fldeff_misc.c +++ b/src/fldeff_misc.c @@ -1229,27 +1229,27 @@ static void Task_WateringBerryTreeAnim_0(u8 taskId) static void Task_WateringBerryTreeAnim_1(u8 taskId) { - struct ObjectEvent *playerEventObj = &gObjectEvents[gPlayerAvatar.objectEventId]; + struct ObjectEvent *playerObjEvent = &gObjectEvents[gPlayerAvatar.objectEventId]; - if (!ObjectEventIsMovementOverridden(playerEventObj) - || ObjectEventClearHeldMovementIfFinished(playerEventObj)) + if (!ObjectEventIsMovementOverridden(playerObjEvent) + || ObjectEventClearHeldMovementIfFinished(playerObjEvent)) { sub_808C228(GetPlayerFacingDirection()); - ObjectEventSetHeldMovement(playerEventObj, GetWalkInPlaceNormalMovementAction(GetPlayerFacingDirection())); + ObjectEventSetHeldMovement(playerObjEvent, GetWalkInPlaceNormalMovementAction(GetPlayerFacingDirection())); gTasks[taskId].func = Task_WateringBerryTreeAnim_2; } } 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]++; if (value < 10) - ObjectEventSetHeldMovement(playerEventObj, GetWalkInPlaceNormalMovementAction(GetPlayerFacingDirection())); + ObjectEventSetHeldMovement(playerObjEvent, GetWalkInPlaceNormalMovementAction(GetPlayerFacingDirection())); else gTasks[taskId].func = Task_WateringBerryTreeAnim_3; diff --git a/src/frontier_util.c b/src/frontier_util.c index e102c139a..a29714a32 100644 --- a/src/frontier_util.c +++ b/src/frontier_util.c @@ -663,7 +663,7 @@ static const struct WindowTemplate gUnknown_08611C84 = }; // 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_DOME] = {OBJ_EVENT_GFX_TUCKER, FALSE}, @@ -2201,7 +2201,7 @@ static void sub_81A447C(void) static void SetFacilityBrainObjectEvent(void) { - SetFrontierBrainEventObjGfx(VarGet(VAR_FRONTIER_FACILITY)); + SetFrontierBrainObjEventGfx(VarGet(VAR_FRONTIER_FACILITY)); } // Battle Frontier Ranking Hall records. @@ -2460,13 +2460,13 @@ void CopyFrontierBrainTrainerName(u8 *dst) bool8 IsFrontierBrainFemale(void) { 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); - VarSet(VAR_OBJ_GFX_ID_0, sFacilityToBrainEventObjGfx[facility][0]); + VarSet(VAR_OBJ_GFX_ID_0, sFacilityToBrainObjEventGfx[facility][0]); } #define FRONTIER_BRAIN_OTID 61226 @@ -2766,10 +2766,10 @@ u16 GetFrontierBrainMonSpecies(u8 monId) return sFrontierBrainsMons[facility][symbol][monId].species; } -void SetFrontierBrainEventObjGfx(u8 facility) +void SetFrontierBrainObjEventGfx(u8 facility) { 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) diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index 9ebd1236d..8fea7c098 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -137,7 +137,7 @@ void SetMauvilleOldMan(void) SetupGiddy(); break; } - ScrSpecial_SetMauvilleOldManEventObjGfx(); + ScrSpecial_SetMauvilleOldManObjEventGfx(); } u8 GetCurrentMauvilleOldMan(void) @@ -407,7 +407,7 @@ void ResetMauvilleOldManFlag(void) case MAUVILLE_MAN_GIDDY: break; } - ScrSpecial_SetMauvilleOldManEventObjGfx(); + ScrSpecial_SetMauvilleOldManObjEventGfx(); } @@ -674,7 +674,7 @@ static void Task_BardSong(u8 taskId) RunTextPrintersAndIsPrinter0Active(); } -void ScrSpecial_SetMauvilleOldManEventObjGfx(void) +void ScrSpecial_SetMauvilleOldManObjEventGfx(void) { VarSet(VAR_OBJ_GFX_ID_0, OBJ_EVENT_GFX_BARD); } diff --git a/src/overworld.c b/src/overworld.c index a3a1ba22e..fb1f1f977 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -141,7 +141,7 @@ static void ResetAllTradingStates(void); static void UpdateHeldKeyCode(u16); static void UpdateAllLinkPlayers(u16*, s32); 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 GetLinkPlayerCoords(u8 linkPlayerId, u16 *x, u16 *y); static u8 GetLinkPlayerFacingDirection(u8 linkPlayerId); @@ -157,7 +157,7 @@ static void sub_808780C(u8 linkPlayerId); static u8 GetSpriteForLinkedPlayer(u8 linkPlayerId); static void sub_8087584(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 u16 GetDirectionForEventScript(const u8 *script); static void sub_8087510(void); @@ -493,7 +493,7 @@ void ApplyNewEncryptionKeyToGameStats(u32 newKey) ApplyNewEncryptionKeyToWord(&gSaveBlock1Ptr->gameStats[i], newKey); } -void LoadEventObjTemplatesFromHeader(void) +void LoadObjEventTemplatesFromHeader(void) { // Clear map object templates CpuFill32(0, gSaveBlock1Ptr->objectEventTemplates, sizeof(gSaveBlock1Ptr->objectEventTemplates)); @@ -504,7 +504,7 @@ void LoadEventObjTemplatesFromHeader(void) gMapHeader.events->objectEventCount * sizeof(struct ObjectEventTemplate)); } -void LoadSaveblockEventObjScripts(void) +void LoadSaveblockObjEventScripts(void) { struct ObjectEventTemplate *mapHeaderObjTemplates = gMapHeader.events->objectEvents; struct ObjectEventTemplate *savObjTemplates = gSaveBlock1Ptr->objectEventTemplates; @@ -514,7 +514,7 @@ void LoadSaveblockEventObjScripts(void) 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; 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; @@ -814,7 +814,7 @@ void LoadMapFromCameraTransition(u8 mapGroup, u8 mapNum) ApplyCurrentWarp(); LoadCurrentMapData(); - LoadEventObjTemplatesFromHeader(); + LoadObjEventTemplatesFromHeader(); TrySetMapSaveWarpStatus(); ClearTempFieldEventData(); ResetCyclingRoadChallengeData(); @@ -857,7 +857,7 @@ static void mli0_load_map(u32 a1) else if (InTrainerHill()) LoadTrainerHillObjectEventTemplates(); else - LoadEventObjTemplatesFromHeader(); + LoadObjEventTemplatesFromHeader(); } isOutdoors = IsMapTypeOutdoors(gMapHeader.mapType); @@ -1725,7 +1725,7 @@ void CB2_ContinueSavedGame(void) else if (trainerHillMapId != 0 && trainerHillMapId != TRAINER_HILL_ENTRANCE) LoadTrainerHillFloorObjectEventScripts(); else - LoadSaveblockEventObjScripts(); + LoadSaveblockObjEventScripts(); UnfreezeObjectEvents(); DoTimeBasedEvents(); @@ -2918,9 +2918,9 @@ static u32 GetLinkSendQueueLength(void) 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) @@ -2936,16 +2936,16 @@ static void ZeroObjectEvent(struct ObjectEvent *objEvent) static void SpawnLinkPlayerObjectEvent(u8 linkPlayerId, s16 x, s16 y, u8 a4) { u8 objEventId = GetFirstInactiveObjectEventId(); - struct LinkPlayerObjectEvent *linkPlayerEventObj = &gLinkPlayerObjectEvents[linkPlayerId]; + struct LinkPlayerObjectEvent *linkPlayerObjEvent = &gLinkPlayerObjectEvents[linkPlayerId]; struct ObjectEvent *objEvent = &gObjectEvents[objEventId]; - ZeroLinkPlayerObjectEvent(linkPlayerEventObj); + ZeroLinkPlayerObjectEvent(linkPlayerObjEvent); ZeroObjectEvent(objEvent); - linkPlayerEventObj->active = 1; - linkPlayerEventObj->linkPlayerId = linkPlayerId; - linkPlayerEventObj->objEventId = objEventId; - linkPlayerEventObj->movementMode = MOVEMENT_MODE_FREE; + linkPlayerObjEvent->active = 1; + linkPlayerObjEvent->linkPlayerId = linkPlayerId; + linkPlayerObjEvent->objEventId = objEventId; + linkPlayerObjEvent->movementMode = MOVEMENT_MODE_FREE; objEvent->active = 1; objEvent->singleMovementActive = a4; @@ -2978,12 +2978,12 @@ static void sub_80877DC(u8 linkPlayerId, u8 a2) static void sub_808780C(u8 linkPlayerId) { - struct LinkPlayerObjectEvent *linkPlayerEventObj = &gLinkPlayerObjectEvents[linkPlayerId]; - u8 objEventId = linkPlayerEventObj->objEventId; + struct LinkPlayerObjectEvent *linkPlayerObjEvent = &gLinkPlayerObjectEvents[linkPlayerId]; + u8 objEventId = linkPlayerObjEvent->objEventId; struct ObjectEvent *objEvent = &gObjectEvents[objEventId]; if (objEvent->spriteId != MAX_SPRITES) DestroySprite(&gSprites[objEvent->spriteId]); - linkPlayerEventObj->active = 0; + linkPlayerObjEvent->active = 0; objEvent->active = 0; } @@ -3042,11 +3042,11 @@ static u8 GetLinkPlayerIdAt(s16 x, s16 y) static void SetPlayerFacingDirection(u8 linkPlayerId, u8 facing) { - struct LinkPlayerObjectEvent *linkPlayerEventObj = &gLinkPlayerObjectEvents[linkPlayerId]; - u8 objEventId = linkPlayerEventObj->objEventId; + struct LinkPlayerObjectEvent *linkPlayerObjEvent = &gLinkPlayerObjectEvents[linkPlayerId]; + u8 objEventId = linkPlayerObjEvent->objEventId; struct ObjectEvent *objEvent = &gObjectEvents[objEventId]; - if (linkPlayerEventObj->active) + if (linkPlayerObjEvent->active) { 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. // 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. #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; } // 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; } -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; objEvent->range.as_byte = FlipVerticalAndClearForced(a3, objEvent->range.as_byte); 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; } @@ -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); return FALSE; } // 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--; - linkPlayerEventObj->movementMode = MOVEMENT_MODE_FROZEN; + linkPlayerObjEvent->movementMode = MOVEMENT_MODE_FROZEN; MoveCoords(objEvent->range.as_byte, &objEvent->initialCoords.x, &objEvent->initialCoords.y); if (!objEvent->directionSequenceIndex) { 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; } -static u8 LinkPlayerDetectCollision(u8 selfEventObjId, u8 a2, s16 x, s16 y) +static u8 LinkPlayerDetectCollision(u8 selfObjEventId, u8 a2, s16 x, s16 y) { u8 i; for (i = 0; i < 16; i++) { - if (i != selfEventObjId) + if (i != selfObjEventId) { if ((gObjectEvents[i].currentCoords.x == x && gObjectEvents[i].currentCoords.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) { - struct LinkPlayerObjectEvent *linkPlayerEventObj = &gLinkPlayerObjectEvents[linkPlayerId]; - u8 objEventId = linkPlayerEventObj->objEventId; + struct LinkPlayerObjectEvent *linkPlayerObjEvent = &gLinkPlayerObjectEvents[linkPlayerId]; + u8 objEventId = linkPlayerObjEvent->objEventId; struct ObjectEvent *objEvent = &gObjectEvents[objEventId]; struct Sprite *sprite; - if (linkPlayerEventObj->active) + if (linkPlayerObjEvent->active) { switch (gameVersion) { @@ -3205,14 +3205,14 @@ static void CreateLinkPlayerSprite(u8 linkPlayerId, u8 gameVersion) static void SpriteCB_LinkPlayer(struct Sprite *sprite) { - struct LinkPlayerObjectEvent *linkPlayerEventObj = &gLinkPlayerObjectEvents[sprite->data[0]]; - struct ObjectEvent *objEvent = &gObjectEvents[linkPlayerEventObj->objEventId]; + struct LinkPlayerObjectEvent *linkPlayerObjEvent = &gLinkPlayerObjectEvents[sprite->data[0]]; + struct ObjectEvent *objEvent = &gObjectEvents[linkPlayerObjEvent->objEventId]; sprite->pos1.x = objEvent->initialCoords.x; sprite->pos1.y = objEvent->initialCoords.y; SetObjectSubpriorityByZCoord(objEvent->previousElevation, sprite, 1); 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)); else StartSpriteAnimIfDifferent(sprite, GetMoveDirectionAnimNum(objEvent->range.as_byte)); diff --git a/src/scrcmd.c b/src/scrcmd.c index f164891fe..07a68a553 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -1100,7 +1100,7 @@ bool8 ScrCmd_setobjectxyperm(struct ScriptContext *ctx) u16 x = VarGet(ScriptReadHalfword(ctx)); u16 y = VarGet(ScriptReadHalfword(ctx)); - Overworld_SetEventObjTemplateCoords(localId, x, y); + Overworld_SetObjEventTemplateCoords(localId, x, y); return FALSE; } @@ -1177,7 +1177,7 @@ bool8 ScrCmd_setobjectmovementtype(struct ScriptContext *ctx) u16 localId = VarGet(ScriptReadHalfword(ctx)); u8 movementType = ScriptReadByte(ctx); - Overworld_SetEventObjTemplateMovementType(localId, movementType); + Overworld_SetObjEventTemplateMovementType(localId, movementType); return FALSE; } diff --git a/src/script_movement.c b/src/script_movement.c index 292b1230c..d7addb2b7 100644 --- a/src/script_movement.c +++ b/src/script_movement.c @@ -118,12 +118,12 @@ static u8 GetMovementScriptIdFromObjectEventId(u8 taskId, u8 objEventId) return OBJECT_EVENTS_COUNT; } -static void LoadObjectEventIdPtrFromMovementScript(u8 taskId, u8 moveScrId, u8 **pEventObjId) +static void LoadObjectEventIdPtrFromMovementScript(u8 taskId, u8 moveScrId, u8 **pObjEventId) { u8 i; - *pEventObjId = (u8 *)&gTasks[taskId].data[1]; - for (i = 0; i < moveScrId; i++, (*pEventObjId)++) + *pObjEventId = (u8 *)&gTasks[taskId].data[1]; + 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) { - u8 *pEventObjId; + u8 *pObjEventId; u8 i; - pEventObjId = (u8 *)&gTasks[taskId].data[1]; - for (i = 0; i < OBJECT_EVENTS_COUNT; i++, pEventObjId++) + pObjEventId = (u8 *)&gTasks[taskId].data[1]; + for (i = 0; i < OBJECT_EVENTS_COUNT; i++, pObjEventId++) { - if (*pEventObjId != 0xFF) - UnfreezeObjectEvent(&gObjectEvents[*pEventObjId]); + if (*pObjEventId != 0xFF) + UnfreezeObjectEvent(&gObjectEvents[*pObjEventId]); } }