summaryrefslogtreecommitdiff
path: root/src/field_control_avatar.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/field_control_avatar.c')
-rw-r--r--src/field_control_avatar.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c
index 852fa2e1b..004d72614 100644
--- a/src/field_control_avatar.c
+++ b/src/field_control_avatar.c
@@ -28,7 +28,7 @@
#include "trainer_see.h"
#include "trainer_hill.h"
#include "wild_encounter.h"
-#include "constants/bg_event_constants.h"
+#include "constants/event_bg.h"
#include "constants/event_objects.h"
#include "constants/field_poison.h"
#include "constants/map_types.h"
@@ -39,14 +39,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);
@@ -139,7 +139,7 @@ int ProcessPlayerFieldInput(struct FieldInput *input)
u16 metatileBehavior;
gSpecialVar_LastTalked = 0;
- gSelectedEventObject = 0;
+ gSelectedObjectEvent = 0;
playerDirection = GetPlayerFacingDirection();
GetPlayerPosition(&position);
@@ -240,7 +240,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;
@@ -261,54 +261,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 == OBJECT_EVENTS_COUNT || gObjectEvents[objectEventId].localId == OBJ_EVENT_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 == OBJECT_EVENTS_COUNT || gObjectEvents[objectEventId].localId == OBJ_EVENT_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 == OBJECT_EVENTS_COUNT || gObjectEvents[objectEventId].localId == OBJ_EVENT_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;
@@ -983,14 +983,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)