mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-04-17 23:51:00 +00:00
jabot: move ai flags to ai_handle_t
This commit is contained in:
parent
bb17105d53
commit
9a898f97c3
7 changed files with 38 additions and 26 deletions
|
@ -96,7 +96,7 @@ BOT_DMclass_Move(edict_t *self, usercmd_t *ucmd)
|
|||
}
|
||||
|
||||
// Ladder movement
|
||||
if( self->is_ladder )
|
||||
if( self->ai->is_ladder )
|
||||
{
|
||||
ucmd->forwardmove = 70;
|
||||
ucmd->upmove = 200;
|
||||
|
@ -105,7 +105,7 @@ BOT_DMclass_Move(edict_t *self, usercmd_t *ucmd)
|
|||
}
|
||||
|
||||
// Falling off ledge
|
||||
if(!self->groundentity && !self->is_step && !self->is_swim )
|
||||
if(!self->groundentity && !self->ai->is_step && !self->ai->is_swim )
|
||||
{
|
||||
AI_ChangeAngle(self);
|
||||
if (current_link_type == LINK_JUMPPAD ) {
|
||||
|
@ -153,7 +153,7 @@ BOT_DMclass_Move(edict_t *self, usercmd_t *ucmd)
|
|||
return;
|
||||
|
||||
// swimming
|
||||
if( self->is_swim )
|
||||
if( self->ai->is_swim )
|
||||
{
|
||||
// We need to be pointed up/down
|
||||
AI_ChangeAngle(self);
|
||||
|
@ -266,7 +266,7 @@ void BOT_DMclass_Wander(edict_t *self, usercmd_t *ucmd)
|
|||
|
||||
self->s.angles[YAW] += random() * 180 - 90;
|
||||
|
||||
if (!self->is_step)// if there is ground continue otherwise wait for next move
|
||||
if (!self->ai->is_step)// if there is ground continue otherwise wait for next move
|
||||
ucmd->forwardmove = 0; //0
|
||||
else if( AI_CanMove( self, BOT_MOVE_FORWARD))
|
||||
ucmd->forwardmove = 100;
|
||||
|
|
|
@ -61,7 +61,7 @@ void M_default_Move(edict_t *self, usercmd_t *ucmd)
|
|||
}
|
||||
|
||||
// Falling off ledge
|
||||
if(!self->groundentity && !self->is_step && !self->is_swim )
|
||||
if(!self->groundentity && !self->ai->is_step && !self->ai->is_swim )
|
||||
{
|
||||
AI_ChangeAngle(self);
|
||||
if (current_link_type == LINK_JUMPPAD ) {
|
||||
|
@ -78,7 +78,7 @@ void M_default_Move(edict_t *self, usercmd_t *ucmd)
|
|||
|
||||
|
||||
// swimming
|
||||
if( self->is_swim )
|
||||
if( self->ai->is_swim )
|
||||
{
|
||||
// We need to be pointed up/down
|
||||
AI_ChangeAngle(self);
|
||||
|
|
|
@ -334,9 +334,14 @@ AI_PathMap(void)
|
|||
{
|
||||
int closest_node;
|
||||
|
||||
if (!player.ent->ai)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//DROP WATER JUMP NODE (not limited by delayed updates)
|
||||
if (!player.ent->is_swim && player.last_node != -1
|
||||
&& player.ent->is_swim != player.ent->was_swim)
|
||||
if (!player.ent->ai->is_swim && player.last_node != -1
|
||||
&& player.ent->ai->is_swim != player.ent->ai->was_swim)
|
||||
{
|
||||
AI_WaterJumpNode();
|
||||
last_update = level.time + NODE_UPDATE_DELAY; // slow down updates a bit
|
||||
|
@ -370,13 +375,13 @@ AI_PathMap(void)
|
|||
return;
|
||||
|
||||
// Not on ground, and not in the water, so bail (deeper check by using a splitmodels function)
|
||||
if (!player.ent->is_step )
|
||||
if (!player.ent->ai->is_step )
|
||||
{
|
||||
if ( !player.ent->is_swim ){
|
||||
if ( !player.ent->ai->is_swim ){
|
||||
player.was_falling = true;
|
||||
return;
|
||||
}
|
||||
else if ( player.ent->is_swim )
|
||||
else if ( player.ent->ai->is_swim )
|
||||
player.was_falling = false;
|
||||
}
|
||||
|
||||
|
@ -420,7 +425,7 @@ AI_PathMap(void)
|
|||
if( closest_node == INVALID )
|
||||
{
|
||||
// Add nodes in the water as needed
|
||||
if( player.ent->is_swim )
|
||||
if( player.ent->ai->is_swim )
|
||||
closest_node = AI_AddNode( player.ent->s.origin, (NODEFLAGS_WATER|NODEFLAGS_FLOAT) );
|
||||
else
|
||||
closest_node = AI_AddNode( player.ent->s.origin, 0 );
|
||||
|
|
|
@ -362,24 +362,30 @@ void AI_PickShortRangeGoal(edict_t *self)
|
|||
void
|
||||
AI_CategorizePosition(edict_t *ent)
|
||||
{
|
||||
qboolean stepping = AI_IsStep(ent);
|
||||
qboolean stepping;
|
||||
|
||||
ent->was_swim = ent->is_swim;
|
||||
ent->was_step = ent->is_step;
|
||||
if (!ent || !ent->ai)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ent->is_ladder = AI_IsLadder(ent->s.origin, ent->s.angles,
|
||||
stepping = AI_IsStep(ent);
|
||||
ent->ai->was_swim = ent->ai->is_swim;
|
||||
ent->ai->was_step = ent->ai->is_step;
|
||||
|
||||
ent->ai->is_ladder = AI_IsLadder(ent->s.origin, ent->s.angles,
|
||||
ent->mins, ent->maxs, ent);
|
||||
|
||||
M_CatagorizePosition(ent);
|
||||
if (ent->waterlevel > 2 || (ent->waterlevel && !stepping))
|
||||
{
|
||||
ent->is_swim = true;
|
||||
ent->is_step = false;
|
||||
ent->ai->is_swim = true;
|
||||
ent->ai->is_step = false;
|
||||
return;
|
||||
}
|
||||
|
||||
ent->is_swim = false;
|
||||
ent->is_step = stepping;
|
||||
ent->ai->is_swim = false;
|
||||
ent->ai->is_step = stepping;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -232,7 +232,7 @@ qboolean AI_SpecialMove(edict_t *self, usercmd_t *ucmd)
|
|||
}
|
||||
}
|
||||
|
||||
if( self->ai->pers.moveTypesMask & LINK_CROUCH || self->is_swim )
|
||||
if( self->ai->pers.moveTypesMask & LINK_CROUCH || self->ai->is_swim )
|
||||
{
|
||||
//crouch box
|
||||
VectorCopy( self->s.origin, boxorigin );
|
||||
|
|
|
@ -95,6 +95,12 @@ typedef struct
|
|||
|
||||
int nearest_node_tries; /*for increasing radius of search with each try */
|
||||
|
||||
/* AI_CategorizePosition */
|
||||
qboolean is_swim;
|
||||
qboolean is_step;
|
||||
qboolean is_ladder;
|
||||
qboolean was_swim;
|
||||
qboolean was_step;
|
||||
} ai_handle_t;
|
||||
|
||||
/* ai_main.c */
|
||||
|
|
|
@ -1518,11 +1518,6 @@ struct edict_s
|
|||
int chasedist2;
|
||||
|
||||
ai_handle_t *ai; /* jabot */
|
||||
qboolean is_swim; //AI_CategorizePosition
|
||||
qboolean is_step;
|
||||
qboolean is_ladder;
|
||||
qboolean was_swim;
|
||||
qboolean was_step;
|
||||
};
|
||||
|
||||
#define SPHERE_DEFENDER 0x0001
|
||||
|
|
Loading…
Reference in a new issue