Add missing trainer type constant usage
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
+6
-8
@@ -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++)
|
||||
{
|
||||
|
||||
+6
-9
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user