mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-26 19:54:21 +01:00
More trainer type usage
This commit is contained in:
parent
8d9e39e6d1
commit
cb5b8da77b
@ -35,7 +35,7 @@
|
||||
"movement_type": "MOVEMENT_TYPE_FACE_DOWN",
|
||||
"movement_range_x": 0,
|
||||
"movement_range_y": 0,
|
||||
"trainer_type": "3",
|
||||
"trainer_type": "TRAINER_TYPE_BURIED",
|
||||
"trainer_sight_or_berry_tree_id": "1",
|
||||
"script": "LavaridgeTown_Gym_1F_EventScript_Cole",
|
||||
"flag": "0"
|
||||
@ -48,7 +48,7 @@
|
||||
"movement_type": "MOVEMENT_TYPE_FACE_DOWN",
|
||||
"movement_range_x": 0,
|
||||
"movement_range_y": 0,
|
||||
"trainer_type": "3",
|
||||
"trainer_type": "TRAINER_TYPE_BURIED",
|
||||
"trainer_sight_or_berry_tree_id": "1",
|
||||
"script": "LavaridgeTown_Gym_1F_EventScript_Gerald",
|
||||
"flag": "0"
|
||||
@ -61,7 +61,7 @@
|
||||
"movement_type": "MOVEMENT_TYPE_FACE_DOWN",
|
||||
"movement_range_x": 0,
|
||||
"movement_range_y": 0,
|
||||
"trainer_type": "3",
|
||||
"trainer_type": "TRAINER_TYPE_BURIED",
|
||||
"trainer_sight_or_berry_tree_id": "1",
|
||||
"script": "LavaridgeTown_Gym_1F_EventScript_Axle",
|
||||
"flag": "0"
|
||||
@ -74,7 +74,7 @@
|
||||
"movement_type": "MOVEMENT_TYPE_FACE_DOWN",
|
||||
"movement_range_x": 0,
|
||||
"movement_range_y": 0,
|
||||
"trainer_type": "3",
|
||||
"trainer_type": "TRAINER_TYPE_BURIED",
|
||||
"trainer_sight_or_berry_tree_id": "1",
|
||||
"script": "LavaridgeTown_Gym_1F_EventScript_Danielle",
|
||||
"flag": "0"
|
||||
|
@ -22,7 +22,7 @@
|
||||
"movement_type": "MOVEMENT_TYPE_FACE_DOWN",
|
||||
"movement_range_x": 1,
|
||||
"movement_range_y": 1,
|
||||
"trainer_type": "3",
|
||||
"trainer_type": "TRAINER_TYPE_BURIED",
|
||||
"trainer_sight_or_berry_tree_id": "1",
|
||||
"script": "LavaridgeTown_Gym_B1F_EventScript_Jace",
|
||||
"flag": "0"
|
||||
@ -35,7 +35,7 @@
|
||||
"movement_type": "MOVEMENT_TYPE_FACE_DOWN",
|
||||
"movement_range_x": 1,
|
||||
"movement_range_y": 1,
|
||||
"trainer_type": "3",
|
||||
"trainer_type": "TRAINER_TYPE_BURIED",
|
||||
"trainer_sight_or_berry_tree_id": "1",
|
||||
"script": "LavaridgeTown_Gym_B1F_EventScript_Keegan",
|
||||
"flag": "0"
|
||||
@ -48,7 +48,7 @@
|
||||
"movement_type": "MOVEMENT_TYPE_FACE_DOWN",
|
||||
"movement_range_x": 1,
|
||||
"movement_range_y": 1,
|
||||
"trainer_type": "3",
|
||||
"trainer_type": "TRAINER_TYPE_BURIED",
|
||||
"trainer_sight_or_berry_tree_id": "1",
|
||||
"script": "LavaridgeTown_Gym_B1F_EventScript_Jeff",
|
||||
"flag": "0"
|
||||
@ -61,7 +61,7 @@
|
||||
"movement_type": "MOVEMENT_TYPE_FACE_DOWN",
|
||||
"movement_range_x": 1,
|
||||
"movement_range_y": 1,
|
||||
"trainer_type": "3",
|
||||
"trainer_type": "TRAINER_TYPE_BURIED",
|
||||
"trainer_sight_or_berry_tree_id": "1",
|
||||
"script": "LavaridgeTown_Gym_B1F_EventScript_Eli",
|
||||
"flag": "0"
|
||||
|
@ -129,7 +129,7 @@
|
||||
"movement_type": "MOVEMENT_TYPE_HIDDEN",
|
||||
"movement_range_x": 0,
|
||||
"movement_range_y": 0,
|
||||
"trainer_type": "3",
|
||||
"trainer_type": "TRAINER_TYPE_BURIED",
|
||||
"trainer_sight_or_berry_tree_id": "1",
|
||||
"script": "Route113_EventScript_Lao",
|
||||
"flag": "0"
|
||||
@ -142,7 +142,7 @@
|
||||
"movement_type": "MOVEMENT_TYPE_HIDDEN",
|
||||
"movement_range_x": 0,
|
||||
"movement_range_y": 0,
|
||||
"trainer_type": "3",
|
||||
"trainer_type": "TRAINER_TYPE_BURIED",
|
||||
"trainer_sight_or_berry_tree_id": "1",
|
||||
"script": "Route113_EventScript_Lung",
|
||||
"flag": "0"
|
||||
|
@ -4,5 +4,6 @@
|
||||
#define TRAINER_TYPE_NONE 0
|
||||
#define TRAINER_TYPE_NORMAL 1
|
||||
#define TRAINER_TYPE_SEE_ALL_DIRECTIONS 2
|
||||
#define TRAINER_TYPE_BURIED 3
|
||||
|
||||
#endif // GUARD_CONSTANTS_TRAINER_TYPES_H
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "constants/field_effects.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/mauville_old_man.h"
|
||||
#include "constants/trainer_types.h"
|
||||
|
||||
// this file was known as evobjmv.c in Game Freak's original source
|
||||
|
||||
@ -1454,7 +1455,7 @@ u8 SpawnSpecialObjectEventParameterized(u8 graphicsId, u8 movementBehavior, u8 l
|
||||
objectEventTemplate.movementType = movementBehavior;
|
||||
objectEventTemplate.movementRangeX = 0;
|
||||
objectEventTemplate.movementRangeY = 0;
|
||||
objectEventTemplate.trainerType = 0;
|
||||
objectEventTemplate.trainerType = TRAINER_TYPE_NONE;
|
||||
objectEventTemplate.trainerRange_berryTreeId = 0;
|
||||
return SpawnSpecialObjectEvent(&objectEventTemplate);
|
||||
}
|
||||
@ -2344,7 +2345,8 @@ static u16 GetObjectEventFlagIdByObjectEventId(u8 objectEventId)
|
||||
return GetObjectEventFlagIdByLocalIdAndMap(gObjectEvents[objectEventId].localId, gObjectEvents[objectEventId].mapNum, gObjectEvents[objectEventId].mapGroup);
|
||||
}
|
||||
|
||||
u8 sub_808F080(u8 localId, u8 mapNum, u8 mapGroup)
|
||||
// Unused
|
||||
static u8 GetObjectTrainerTypeByLocalIdAndMap(u8 localId, u8 mapNum, u8 mapGroup)
|
||||
{
|
||||
u8 objectEventId;
|
||||
|
||||
@ -2355,7 +2357,8 @@ u8 sub_808F080(u8 localId, u8 mapNum, u8 mapGroup)
|
||||
return gObjectEvents[objectEventId].trainerType;
|
||||
}
|
||||
|
||||
u8 sub_808F0BC(u8 objectEventId)
|
||||
// Unused
|
||||
static u8 GetObjectTrainerTypeByObjectEventId(u8 objectEventId)
|
||||
{
|
||||
return gObjectEvents[objectEventId].trainerType;
|
||||
}
|
||||
@ -2604,7 +2607,7 @@ bool8 ObjectEventIsTrainerAndCloseToPlayer(struct ObjectEvent *objectEvent)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (objectEvent->trainerType != 1 && objectEvent->trainerType != 3)
|
||||
if (objectEvent->trainerType != TRAINER_TYPE_NORMAL && objectEvent->trainerType != TRAINER_TYPE_BURIED)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "constants/moves.h"
|
||||
#include "constants/songs.h"
|
||||
#include "constants/species.h"
|
||||
#include "constants/trainer_types.h"
|
||||
|
||||
static EWRAM_DATA u8 gUnknown_0203734C = 0;
|
||||
EWRAM_DATA struct ObjectEvent gObjectEvents[OBJECT_EVENTS_COUNT] = {};
|
||||
@ -1378,7 +1379,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;
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "constants/trainers.h"
|
||||
#include "constants/easy_chat.h"
|
||||
#include "constants/trainer_hill.h"
|
||||
#include "constants/trainer_types.h"
|
||||
|
||||
#define HILL_TAG_NORMAL 0
|
||||
#define HILL_TAG_VARIETY 1
|
||||
@ -258,7 +259,7 @@ static const struct ObjectEventTemplate sTrainerObjectEventTemplate =
|
||||
.movementType = MOVEMENT_TYPE_LOOK_AROUND,
|
||||
.movementRangeX = 1,
|
||||
.movementRangeY = 1,
|
||||
.trainerType = 1,
|
||||
.trainerType = TRAINER_TYPE_NORMAL,
|
||||
};
|
||||
|
||||
static const u32 sNextFloorMapNum[NUM_TRAINER_HILL_FLOORS] =
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "constants/event_objects.h"
|
||||
#include "constants/event_object_movement.h"
|
||||
#include "constants/field_effects.h"
|
||||
#include "constants/trainer_types.h"
|
||||
|
||||
// this file's functions
|
||||
static u8 CheckTrainer(u8 objectEventId);
|
||||
@ -181,18 +182,18 @@ bool8 CheckForTrainersWantingBattle(void)
|
||||
|
||||
for (i = 0; i < OBJECT_EVENTS_COUNT; i++)
|
||||
{
|
||||
u8 retVal;
|
||||
u8 numTrainers;
|
||||
|
||||
if (!gObjectEvents[i].active)
|
||||
continue;
|
||||
if (gObjectEvents[i].trainerType != 1 && gObjectEvents[i].trainerType != 3)
|
||||
if (gObjectEvents[i].trainerType != TRAINER_TYPE_NORMAL && gObjectEvents[i].trainerType != TRAINER_TYPE_BURIED)
|
||||
continue;
|
||||
|
||||
retVal = CheckTrainer(i);
|
||||
if (retVal == 2)
|
||||
break; // two trainers have been found
|
||||
numTrainers = CheckTrainer(i);
|
||||
if (numTrainers == 2)
|
||||
break;
|
||||
|
||||
if (retVal == 0) // no trainers
|
||||
if (numTrainers == 0)
|
||||
continue;
|
||||
|
||||
if (gNoOfApproachingTrainers > 1)
|
||||
@ -289,14 +290,14 @@ 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++)
|
||||
for (i = 0; i < ARRAY_COUNT(sDirectionalApproachDistanceFuncs); i++)
|
||||
{
|
||||
approachDistance = sDirectionalApproachDistanceFuncs[i](trainerObj, trainerObj->trainerRange_berryTreeId, x, y);
|
||||
if (CheckPathBetweenTrainerAndPlayer(trainerObj, approachDistance, i + 1)) // directions are 1-4 instead of 0-3. south north west east
|
||||
|
Loading…
Reference in New Issue
Block a user