Standardize Event Object to Object Event

This commit is contained in:
GriffinR
2019-11-20 22:55:44 -05:00
parent 215bb31d67
commit ec3e86f1d2
606 changed files with 10080 additions and 10080 deletions
+24 -24
View File
@@ -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)