diff options
author | GriffinR <griffin.richards@comcast.net> | 2019-11-20 22:55:44 -0500 |
---|---|---|
committer | GriffinR <griffin.richards@comcast.net> | 2019-11-20 22:55:44 -0500 |
commit | ec3e86f1d2f78bb9fece0956e246862cea3c07b9 (patch) | |
tree | fdeca5705cf68b2a355bba9fa90f9f3c16e3c69e /src/field_control_avatar.c | |
parent | 215bb31d67398386d3554d31f55dbe495e7f6b6f (diff) |
Standardize Event Object to Object Event
Diffstat (limited to 'src/field_control_avatar.c')
-rw-r--r-- | src/field_control_avatar.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c index 41b7a4dbf..2326ec101 100644 --- a/src/field_control_avatar.c +++ b/src/field_control_avatar.c @@ -38,14 +38,14 @@ static EWRAM_DATA u8 sWildEncounterImmunitySteps = 0; static EWRAM_DATA u16 sPreviousPlayerMetatileBehavior = 0; -u8 gSelectedEventObject; +u8 gSelectedObjectEvent; static void GetPlayerPosition(struct MapPosition *); static void GetInFrontOfPlayerPosition(struct MapPosition *); static u16 GetPlayerCurMetatileBehavior(int); static bool8 TryStartInteractionScript(struct MapPosition*, u16, u8); static const u8 *GetInteractionScript(struct MapPosition*, u8, u8); -static const u8 *GetInteractedEventObjectScript(struct MapPosition *, u8, u8); +static const u8 *GetInteractedObjectEventScript(struct MapPosition *, u8, u8); static const u8 *GetInteractedBackgroundEventScript(struct MapPosition *, u8, u8); static const u8 *GetInteractedMetatileScript(struct MapPosition *, u8, u8); static const u8 *GetInteractedWaterScript(struct MapPosition *, u8, u8); @@ -138,7 +138,7 @@ int ProcessPlayerFieldInput(struct FieldInput *input) u16 metatileBehavior; gSpecialVar_LastTalked = 0; - gSelectedEventObject = 0; + gSelectedObjectEvent = 0; playerDirection = GetPlayerFacingDirection(); GetPlayerPosition(&position); @@ -239,7 +239,7 @@ static bool8 TryStartInteractionScript(struct MapPosition *position, u16 metatil static const u8 *GetInteractionScript(struct MapPosition *position, u8 metatileBehavior, u8 direction) { - const u8 *script = GetInteractedEventObjectScript(position, metatileBehavior, direction); + const u8 *script = GetInteractedObjectEventScript(position, metatileBehavior, direction); if (script != NULL) return script; @@ -260,54 +260,54 @@ static const u8 *GetInteractionScript(struct MapPosition *position, u8 metatileB const u8 *GetInteractedLinkPlayerScript(struct MapPosition *position, u8 metatileBehavior, u8 direction) { - u8 eventObjectId; + u8 objectEventId; s32 i; if (!MetatileBehavior_IsCounter(MapGridGetMetatileBehaviorAt(position->x, position->y))) - eventObjectId = GetEventObjectIdByXYZ(position->x, position->y, position->height); + objectEventId = GetObjectEventIdByXYZ(position->x, position->y, position->height); else - eventObjectId = GetEventObjectIdByXYZ(position->x + gDirectionToVectors[direction].x, position->y + gDirectionToVectors[direction].y, position->height); + objectEventId = GetObjectEventIdByXYZ(position->x + gDirectionToVectors[direction].x, position->y + gDirectionToVectors[direction].y, position->height); - if (eventObjectId == EVENT_OBJECTS_COUNT || gEventObjects[eventObjectId].localId == EVENT_OBJ_ID_PLAYER) + if (objectEventId == EVENT_OBJECTS_COUNT || gObjectEvents[objectEventId].localId == EVENT_OBJ_ID_PLAYER) return NULL; for (i = 0; i < 4; i++) { - if (gLinkPlayerEventObjects[i].active == TRUE && gLinkPlayerEventObjects[i].eventObjId == eventObjectId) + if (gLinkPlayerObjectEvents[i].active == TRUE && gLinkPlayerObjectEvents[i].objEventId == objectEventId) return NULL; } - gSelectedEventObject = eventObjectId; - gSpecialVar_LastTalked = gEventObjects[eventObjectId].localId; + gSelectedObjectEvent = objectEventId; + gSpecialVar_LastTalked = gObjectEvents[objectEventId].localId; gSpecialVar_Facing = direction; - return GetEventObjectScriptPointerByEventObjectId(eventObjectId); + return GetObjectEventScriptPointerByObjectEventId(objectEventId); } -static const u8 *GetInteractedEventObjectScript(struct MapPosition *position, u8 metatileBehavior, u8 direction) +static const u8 *GetInteractedObjectEventScript(struct MapPosition *position, u8 metatileBehavior, u8 direction) { - u8 eventObjectId; + u8 objectEventId; const u8 *script; - eventObjectId = GetEventObjectIdByXYZ(position->x, position->y, position->height); - if (eventObjectId == EVENT_OBJECTS_COUNT || gEventObjects[eventObjectId].localId == EVENT_OBJ_ID_PLAYER) + objectEventId = GetObjectEventIdByXYZ(position->x, position->y, position->height); + if (objectEventId == EVENT_OBJECTS_COUNT || gObjectEvents[objectEventId].localId == EVENT_OBJ_ID_PLAYER) { if (MetatileBehavior_IsCounter(metatileBehavior) != TRUE) return NULL; - // Look for an event object on the other side of the counter. - eventObjectId = GetEventObjectIdByXYZ(position->x + gDirectionToVectors[direction].x, position->y + gDirectionToVectors[direction].y, position->height); - if (eventObjectId == EVENT_OBJECTS_COUNT || gEventObjects[eventObjectId].localId == EVENT_OBJ_ID_PLAYER) + // Look for an object event on the other side of the counter. + objectEventId = GetObjectEventIdByXYZ(position->x + gDirectionToVectors[direction].x, position->y + gDirectionToVectors[direction].y, position->height); + if (objectEventId == EVENT_OBJECTS_COUNT || gObjectEvents[objectEventId].localId == EVENT_OBJ_ID_PLAYER) return NULL; } - gSelectedEventObject = eventObjectId; - gSpecialVar_LastTalked = gEventObjects[eventObjectId].localId; + gSelectedObjectEvent = objectEventId; + gSpecialVar_LastTalked = gObjectEvents[objectEventId].localId; gSpecialVar_Facing = direction; if (InTrainerHill() == TRUE) script = GetTrainerHillTrainerScript(); else - script = GetEventObjectScriptPointerByEventObjectId(eventObjectId); + script = GetObjectEventScriptPointerByObjectEventId(objectEventId); script = GetRamScript(gSpecialVar_LastTalked, script); return script; @@ -982,14 +982,14 @@ u8 TrySetDiveWarp(void) return 0; } -const u8 *GetEventObjectScriptPointerPlayerFacing(void) +const u8 *GetObjectEventScriptPointerPlayerFacing(void) { u8 direction; struct MapPosition position; direction = GetPlayerMovementDirection(); GetInFrontOfPlayerPosition(&position); - return GetInteractedEventObjectScript(&position, MapGridGetMetatileBehaviorAt(position.x, position.y), direction); + return GetInteractedObjectEventScript(&position, MapGridGetMetatileBehaviorAt(position.x, position.y), direction); } int SetCableClubWarp(void) |