summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGriffinR <griffin.g.richards@gmail.com>2022-02-11 13:18:31 -0500
committerGriffinR <griffin.g.richards@gmail.com>2022-02-11 13:26:55 -0500
commit2598b285bb7383475c264c6bec391c676708bc8e (patch)
treedcce7deebadf4e3cc6d0bd35cadb7dd96469f7fe
parent91076d9408ecf7546cae522b014ead6f31f7a9dd (diff)
Add missing trainer type constant usage
-rw-r--r--data/maps/SeafoamIslands_1F/map.json4
-rw-r--r--data/maps/SeafoamIslands_B1F/map.json4
-rw-r--r--data/maps/SeafoamIslands_B2F/map.json4
-rw-r--r--data/maps/SeafoamIslands_B3F/map.json4
-rw-r--r--data/maps/VictoryRoad_3F/map.json2
-rw-r--r--include/event_object_movement.h2
-rw-r--r--src/event_object_movement.c13
-rw-r--r--src/field_control_avatar.c2
-rw-r--r--src/field_player_avatar.c3
-rw-r--r--src/trainer_see.c14
-rw-r--r--src/vs_seeker.c15
11 files changed, 31 insertions, 36 deletions
diff --git a/data/maps/SeafoamIslands_1F/map.json b/data/maps/SeafoamIslands_1F/map.json
index b85000671..8956609fb 100644
--- a/data/maps/SeafoamIslands_1F/map.json
+++ b/data/maps/SeafoamIslands_1F/map.json
@@ -23,7 +23,7 @@
"movement_type": "MOVEMENT_TYPE_FACE_DOWN",
"movement_range_x": 0,
"movement_range_y": 0,
- "trainer_type": "66",
+ "trainer_type": "FLAG_HIDE_SEAFOAM_B1F_BOULDER_1",
"trainer_sight_or_berry_tree_id": "0",
"script": "EventScript_StrengthBoulder",
"flag": "FLAG_HIDE_SEAFOAM_1F_BOULDER_1"
@@ -36,7 +36,7 @@
"movement_type": "MOVEMENT_TYPE_FACE_DOWN",
"movement_range_x": 0,
"movement_range_y": 0,
- "trainer_type": "67",
+ "trainer_type": "FLAG_HIDE_SEAFOAM_B1F_BOULDER_2",
"trainer_sight_or_berry_tree_id": "0",
"script": "EventScript_StrengthBoulder",
"flag": "FLAG_HIDE_SEAFOAM_1F_BOULDER_2"
diff --git a/data/maps/SeafoamIslands_B1F/map.json b/data/maps/SeafoamIslands_B1F/map.json
index 014da39a1..8e3cb2bb5 100644
--- a/data/maps/SeafoamIslands_B1F/map.json
+++ b/data/maps/SeafoamIslands_B1F/map.json
@@ -23,7 +23,7 @@
"movement_type": "MOVEMENT_TYPE_FACE_DOWN",
"movement_range_x": 0,
"movement_range_y": 0,
- "trainer_type": "68",
+ "trainer_type": "FLAG_HIDE_SEAFOAM_B2F_BOULDER_1",
"trainer_sight_or_berry_tree_id": "0",
"script": "EventScript_StrengthBoulder",
"flag": "FLAG_HIDE_SEAFOAM_B1F_BOULDER_1"
@@ -36,7 +36,7 @@
"movement_type": "MOVEMENT_TYPE_FACE_DOWN",
"movement_range_x": 0,
"movement_range_y": 0,
- "trainer_type": "69",
+ "trainer_type": "FLAG_HIDE_SEAFOAM_B2F_BOULDER_2",
"trainer_sight_or_berry_tree_id": "0",
"script": "EventScript_StrengthBoulder",
"flag": "FLAG_HIDE_SEAFOAM_B1F_BOULDER_2"
diff --git a/data/maps/SeafoamIslands_B2F/map.json b/data/maps/SeafoamIslands_B2F/map.json
index 5d770655f..e2b21a02f 100644
--- a/data/maps/SeafoamIslands_B2F/map.json
+++ b/data/maps/SeafoamIslands_B2F/map.json
@@ -23,7 +23,7 @@
"movement_type": "MOVEMENT_TYPE_FACE_DOWN",
"movement_range_x": 0,
"movement_range_y": 0,
- "trainer_type": "70",
+ "trainer_type": "FLAG_HIDE_SEAFOAM_B3F_BOULDER_1",
"trainer_sight_or_berry_tree_id": "0",
"script": "EventScript_StrengthBoulder",
"flag": "FLAG_HIDE_SEAFOAM_B2F_BOULDER_1"
@@ -36,7 +36,7 @@
"movement_type": "MOVEMENT_TYPE_FACE_DOWN",
"movement_range_x": 0,
"movement_range_y": 0,
- "trainer_type": "71",
+ "trainer_type": "FLAG_HIDE_SEAFOAM_B3F_BOULDER_2",
"trainer_sight_or_berry_tree_id": "0",
"script": "EventScript_StrengthBoulder",
"flag": "FLAG_HIDE_SEAFOAM_B2F_BOULDER_2"
diff --git a/data/maps/SeafoamIslands_B3F/map.json b/data/maps/SeafoamIslands_B3F/map.json
index 21f25cfba..07eec3472 100644
--- a/data/maps/SeafoamIslands_B3F/map.json
+++ b/data/maps/SeafoamIslands_B3F/map.json
@@ -49,7 +49,7 @@
"movement_type": "MOVEMENT_TYPE_FACE_DOWN",
"movement_range_x": 0,
"movement_range_y": 0,
- "trainer_type": "77",
+ "trainer_type": "FLAG_HIDE_SEAFOAM_B4F_BOULDER_2",
"trainer_sight_or_berry_tree_id": "0",
"script": "EventScript_StrengthBoulder",
"flag": "FLAG_HIDE_SEAFOAM_B3F_BOULDER_5"
@@ -88,7 +88,7 @@
"movement_type": "MOVEMENT_TYPE_FACE_DOWN",
"movement_range_x": 0,
"movement_range_y": 0,
- "trainer_type": "76",
+ "trainer_type": "FLAG_HIDE_SEAFOAM_B4F_BOULDER_1",
"trainer_sight_or_berry_tree_id": "0",
"script": "EventScript_StrengthBoulder",
"flag": "FLAG_HIDE_SEAFOAM_B3F_BOULDER_3"
diff --git a/data/maps/VictoryRoad_3F/map.json b/data/maps/VictoryRoad_3F/map.json
index c53d1d2cc..6f21bdd56 100644
--- a/data/maps/VictoryRoad_3F/map.json
+++ b/data/maps/VictoryRoad_3F/map.json
@@ -114,7 +114,7 @@
"movement_type": "MOVEMENT_TYPE_FACE_DOWN",
"movement_range_x": 0,
"movement_range_y": 0,
- "trainer_type": "88",
+ "trainer_type": "FLAG_HIDE_VICTORY_ROAD_2F_BOULDER",
"trainer_sight_or_berry_tree_id": "0",
"script": "EventScript_StrengthBoulder",
"flag": "FLAG_HIDE_VICTORY_ROAD_3F_BOULDER"
diff --git a/include/event_object_movement.h b/include/event_object_movement.h
index 46529bdfe..c53cb7d67 100644
--- a/include/event_object_movement.h
+++ b/include/event_object_movement.h
@@ -64,7 +64,7 @@ bool8 TryGetObjectEventIdByLocalIdAndMap(u8, u8, u8, u8 *);
u8 GetObjectEventIdByXY(s16, s16);
void SetObjectEventDirection(struct ObjectEvent *, u8);
void RemoveObjectEventByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup);
-u16 GetObjectEventFlagByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup);
+u16 GetBoulderRevealFlagByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup);
void LoadPlayerObjectReflectionPalette(u16, u8);
void LoadSpecialObjectReflectionPalette(u16, u8);
void TryMoveObjectEventToMapCoords(u8, u8, u8, s16, s16);
diff --git a/src/event_object_movement.c b/src/event_object_movement.c
index e1558f9f6..5897e7dc6 100644
--- a/src/event_object_movement.c
+++ b/src/event_object_movement.c
@@ -17,6 +17,7 @@
#include "trig.h"
#include "constants/event_object_movement.h"
#include "constants/event_objects.h"
+#include "constants/trainer_types.h"
static void MoveCoordsInDirection(u32, s16 *, s16 *, s16, s16);
static bool8 ObjectEventExecSingleMovementAction(struct ObjectEvent *, struct Sprite *);
@@ -1682,7 +1683,7 @@ int SpawnSpecialObjectEventParameterized(u8 graphicsId, u8 movementBehavior, u8
objectEventTemplate.movementType = movementBehavior;
objectEventTemplate.movementRangeX = 0;
objectEventTemplate.movementRangeY = 0;
- objectEventTemplate.trainerType = 0;
+ objectEventTemplate.trainerType = TRAINER_TYPE_NONE;
objectEventTemplate.trainerRange_berryTreeId = 0;
return SpawnSpecialObjectEvent(&objectEventTemplate);
}
@@ -2588,8 +2589,10 @@ u8 GetObjectTrainerTypeByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup)
return gObjectEvents[objectEventId].trainerType;
}
-u16 GetObjectEventFlagByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup)
+u16 GetBoulderRevealFlagByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup)
{
+ // Pushable boulder object events store the flag to reveal the boulder
+ // on the floor below in their trainer type field.
return GetObjectEventTemplateByLocalIdAndMap(localId, mapNum, mapGroup)->trainerType;
}
@@ -2824,13 +2827,9 @@ bool8 ObjectEventIsTrainerAndCloseToPlayer(struct ObjectEvent *objectEvent)
s16 maxY;
if (!TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_DASH))
- {
return FALSE;
- }
- if (objectEvent->trainerType != 1 && objectEvent->trainerType != 3)
- {
+ if (objectEvent->trainerType != TRAINER_TYPE_NORMAL && objectEvent->trainerType != TRAINER_TYPE_BURIED)
return FALSE;
- }
PlayerGetDestCoords(&playerX, &playerY);
objX = objectEvent->currentCoords.x;
objY = objectEvent->currentCoords.y;
diff --git a/src/field_control_avatar.c b/src/field_control_avatar.c
index ca5453d7d..8cab2d12b 100644
--- a/src/field_control_avatar.c
+++ b/src/field_control_avatar.c
@@ -1069,7 +1069,7 @@ void HandleBoulderFallThroughHole(struct ObjectEvent * object)
{
PlaySE(SE_FALL);
RemoveObjectEventByLocalIdAndMap(object->localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup);
- FlagClear(GetObjectEventFlagByLocalIdAndMap(object->localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup));
+ FlagClear(GetBoulderRevealFlagByLocalIdAndMap(object->localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup));
}
}
diff --git a/src/field_player_avatar.c b/src/field_player_avatar.c
index b242796d4..bafe7fd22 100644
--- a/src/field_player_avatar.c
+++ b/src/field_player_avatar.c
@@ -25,6 +25,7 @@
#include "constants/songs.h"
#include "constants/metatile_behaviors.h"
#include "constants/moves.h"
+#include "constants/trainer_types.h"
static EWRAM_DATA struct ObjectEvent * sPlayerObjectPtr = NULL;
static EWRAM_DATA u8 sTeleportSavedFacingDirection = DIR_NONE;
@@ -1295,7 +1296,7 @@ void InitPlayerAvatar(s16 x, s16 y, u8 direction, u8 gender)
playerObjEventTemplate.movementType = MOVEMENT_TYPE_PLAYER;
playerObjEventTemplate.movementRangeX = 0;
playerObjEventTemplate.movementRangeY = 0;
- playerObjEventTemplate.trainerType = 0;
+ playerObjEventTemplate.trainerType = TRAINER_TYPE_NONE;
playerObjEventTemplate.trainerRange_berryTreeId = 0;
playerObjEventTemplate.script = NULL;
playerObjEventTemplate.flagId = 0;
diff --git a/src/trainer_see.c b/src/trainer_see.c
index 904b8725c..d1c97e9af 100644
--- a/src/trainer_see.c
+++ b/src/trainer_see.c
@@ -10,6 +10,7 @@
#include "constants/battle_setup.h"
#include "constants/event_object_movement.h"
#include "constants/event_objects.h"
+#include "constants/trainer_types.h"
typedef u8 (*TrainerApproachFunc)(struct ObjectEvent *, s16, s16, s16);
typedef bool8 (*TrainerSeeFunc)(u8, struct Task *, struct ObjectEvent *);
@@ -93,12 +94,9 @@ bool8 CheckForTrainersWantingBattle(void)
for (i = 0; i < OBJECT_EVENTS_COUNT; i++)
{
if (gObjectEvents[i].active
- && (
- gObjectEvents[i].trainerType == 1
- || gObjectEvents[i].trainerType == 3
- )
- && CheckTrainer(i)
- )
+ && (gObjectEvents[i].trainerType == TRAINER_TYPE_NORMAL
+ || gObjectEvents[i].trainerType == TRAINER_TYPE_BURIED)
+ && CheckTrainer(i))
return TRUE;
}
return FALSE;
@@ -129,12 +127,12 @@ static u8 GetTrainerApproachDistance(struct ObjectEvent *trainerObj)
u8 approachDistance;
PlayerGetDestCoords(&x, &y);
- if (trainerObj->trainerType == 1) // can only see in one direction
+ if (trainerObj->trainerType == TRAINER_TYPE_NORMAL) // can only see in one direction
{
approachDistance = sDirectionalApproachDistanceFuncs[trainerObj->facingDirection - 1](trainerObj, trainerObj->trainerRange_berryTreeId, x, y);
return CheckPathBetweenTrainerAndPlayer(trainerObj, approachDistance, trainerObj->facingDirection);
}
- else // can see in all directions
+ else // TRAINER_TYPE_SEE_ALL_DIRECTIONS, TRAINER_TYPE_BURIED
{
for (i = 0; i < 4; i++)
{
diff --git a/src/vs_seeker.c b/src/vs_seeker.c
index 295976dd8..1fd93b82b 100644
--- a/src/vs_seeker.c
+++ b/src/vs_seeker.c
@@ -638,14 +638,11 @@ void VsSeekerResetObjectMovementAfterChargeComplete(void)
for (i = 0; i < gMapHeader.events->objectEventCount; i++)
{
- if ((
- templates[i].trainerType == TRAINER_TYPE_NORMAL
- || templates[i].trainerType == TRAINER_TYPE_BURIED
- ) && (
- templates[i].movementType == MOVEMENT_TYPE_VS_SEEKER_4D
- || templates[i].movementType == MOVEMENT_TYPE_VS_SEEKER_4E
- || templates[i].movementType == MOVEMENT_TYPE_VS_SEEKER_4F
- ))
+ if ((templates[i].trainerType == TRAINER_TYPE_NORMAL
+ || templates[i].trainerType == TRAINER_TYPE_BURIED)
+ && (templates[i].movementType == MOVEMENT_TYPE_VS_SEEKER_4D
+ || templates[i].movementType == MOVEMENT_TYPE_VS_SEEKER_4E
+ || templates[i].movementType == MOVEMENT_TYPE_VS_SEEKER_4F))
{
movementType = GetRandomFaceDirectionMovementType();
TryGetObjectEventIdByLocalIdAndMap(templates[i].localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, &objEventId);
@@ -808,7 +805,7 @@ static void GatherNearbyTrainerInfo(void)
for (objectEventIdx = 0; objectEventIdx < gMapHeader.events->objectEventCount; objectEventIdx++)
{
- if (templates[objectEventIdx].trainerType == 1 || templates[objectEventIdx].trainerType == 3)
+ if (templates[objectEventIdx].trainerType == TRAINER_TYPE_NORMAL || templates[objectEventIdx].trainerType == TRAINER_TYPE_BURIED)
{
sVsSeeker->trainerInfo[vsSeekerObjectIdx].script = templates[objectEventIdx].script;
sVsSeeker->trainerInfo[vsSeekerObjectIdx].trainerIdx = GetTrainerFlagFromScript(templates[objectEventIdx].script);