mirror of
https://github.com/blendogames/thirtyflightsofloving.git
synced 2024-11-14 16:40:57 +00:00
Fixed firing player weapon while using spycam/remote turret in default Lazarus and missionpack DLLs.
Fixed Tactician Gunner's flechettes going thru player bbox at point blank. Made edict_t pointer arrays static in server, default Lazarus, and missionpack DLLs due to stack size concerns. Added contact grenade mode for special monster flag for gunners in default Lazarus and missionpack DLLs.
This commit is contained in:
parent
add4c7cc46
commit
608814c830
23 changed files with 329 additions and 490 deletions
|
@ -1103,7 +1103,7 @@ void FadeDieSink (edict_t *ent);
|
|||
void monster_fire_bullet (edict_t *self, vec3_t start, vec3_t dir, int damage, int kick, int hspread, int vspread, int flashtype);
|
||||
void monster_fire_shotgun (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int hspread, int vspread, int count, int flashtype);
|
||||
void monster_fire_blaster (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype, int effect, int color);
|
||||
void monster_fire_grenade (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int flashtype);
|
||||
void monster_fire_grenade (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int flashtype, qboolean contact);
|
||||
void monster_fire_rocket (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype, edict_t *homing_target);
|
||||
void monster_fire_railgun (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int flashtype);
|
||||
void monster_fire_bfg (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int kick, float damage_radius, int flashtype);
|
||||
|
|
|
@ -152,9 +152,9 @@ void monster_fire_blaster (edict_t *self, vec3_t start, vec3_t dir, int damage,
|
|||
gi.multicast (start, MULTICAST_PVS);
|
||||
}
|
||||
|
||||
void monster_fire_grenade (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int flashtype)
|
||||
void monster_fire_grenade (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int flashtype, qboolean contact)
|
||||
{
|
||||
fire_grenade (self, start, aimdir, damage, speed, 2.5, damage+40, false);
|
||||
fire_grenade (self, start, aimdir, damage, speed, 2.5, damage+40, contact);
|
||||
|
||||
gi.WriteByte (svc_muzzleflash2);
|
||||
gi.WriteShort (self - g_edicts);
|
||||
|
|
|
@ -3233,8 +3233,8 @@ void target_monitor_off (edict_t *self)
|
|||
self->target_ent->svflags &= ~SVF_NOCLIENT;
|
||||
}
|
||||
faker = player->client->camplayer;
|
||||
VectorCopy(faker->s.origin,player->s.origin);
|
||||
gi.TagFree(faker->client);
|
||||
VectorCopy (faker->s.origin, player->s.origin);
|
||||
gi.TagFree (faker->client);
|
||||
G_FreeEdict (faker);
|
||||
player->client->ps.pmove.origin[0] = player->s.origin[0]*8;
|
||||
player->client->ps.pmove.origin[1] = player->s.origin[1]*8;
|
||||
|
@ -3242,10 +3242,10 @@ void target_monitor_off (edict_t *self)
|
|||
for (i=0 ; i<3 ; i++)
|
||||
player->client->ps.pmove.delta_angles[i] =
|
||||
ANGLE2SHORT(player->client->org_viewangles[i] - player->client->resp.cmd_angles[i]);
|
||||
VectorCopy(player->client->org_viewangles, player->client->resp.cmd_angles);
|
||||
VectorCopy(player->client->org_viewangles, player->s.angles);
|
||||
VectorCopy(player->client->org_viewangles, player->client->ps.viewangles);
|
||||
VectorCopy(player->client->org_viewangles, player->client->v_angle);
|
||||
VectorCopy (player->client->org_viewangles, player->client->resp.cmd_angles);
|
||||
VectorCopy (player->client->org_viewangles, player->s.angles);
|
||||
VectorCopy (player->client->org_viewangles, player->client->ps.viewangles);
|
||||
VectorCopy (player->client->org_viewangles, player->client->v_angle);
|
||||
|
||||
player->client->ps.gunindex = gi.modelindex(player->client->pers.weapon->view_model);
|
||||
player->client->ps.pmove.pm_flags &= ~PMF_NO_PREDICTION;
|
||||
|
@ -3305,17 +3305,17 @@ void target_monitor_move (edict_t *self)
|
|||
return;
|
||||
}
|
||||
|
||||
AngleVectors(self->target_ent->s.angles,forward,NULL,NULL);
|
||||
VectorMA(self->target_ent->s.origin, -self->moveinfo.distance, forward, o);
|
||||
AngleVectors (self->target_ent->s.angles, forward, NULL, NULL);
|
||||
VectorMA (self->target_ent->s.origin, -self->moveinfo.distance, forward, o);
|
||||
|
||||
o[2] += self->viewheight;
|
||||
|
||||
VectorSubtract(o,self->s.origin,o);
|
||||
VectorMA(self->s.origin,0.2,o,o);
|
||||
VectorSubtract (o, self->s.origin, o);
|
||||
VectorMA (self->s.origin, 0.2, o, o);
|
||||
|
||||
trace = gi.trace(self->target_ent->s.origin, NULL, NULL, o, self, MASK_SOLID);
|
||||
VectorCopy(trace.endpos, goal);
|
||||
VectorMA(goal, 2, forward, goal);
|
||||
VectorCopy (trace.endpos, goal);
|
||||
VectorMA (goal, 2, forward, goal);
|
||||
|
||||
// pad for floors and ceilings
|
||||
VectorCopy(goal, o);
|
||||
|
@ -3353,12 +3353,12 @@ void use_target_monitor (edict_t *self, edict_t *other, edict_t *activator)
|
|||
if (self->child)
|
||||
{
|
||||
if (self->wait < 0)
|
||||
target_monitor_off(self);
|
||||
target_monitor_off (self);
|
||||
return;
|
||||
}
|
||||
|
||||
if (self->target)
|
||||
self->target_ent = G_Find(NULL,FOFS(targetname),self->target);
|
||||
self->target_ent = G_Find(NULL, FOFS(targetname), self->target);
|
||||
|
||||
// if this is a CHASE_CAM target_monitor and the target no longer
|
||||
// exists, remove this target_monitor and exit
|
||||
|
@ -3371,7 +3371,7 @@ void use_target_monitor (edict_t *self, edict_t *other, edict_t *activator)
|
|||
}
|
||||
}
|
||||
// save current viewangles
|
||||
VectorCopy(activator->client->v_angle,activator->client->org_viewangles);
|
||||
VectorCopy (activator->client->v_angle, activator->client->org_viewangles);
|
||||
|
||||
// create a fake player to stand in real player's position
|
||||
faker = activator->client->camplayer = G_Spawn();
|
||||
|
@ -3396,10 +3396,10 @@ void use_target_monitor (edict_t *self, edict_t *other, edict_t *activator)
|
|||
faker->light_level = activator->light_level;
|
||||
faker->think = faker_animate;
|
||||
faker->nextthink = level.time + FRAMETIME;
|
||||
VectorCopy(activator->mins,faker->mins);
|
||||
VectorCopy(activator->maxs,faker->maxs);
|
||||
VectorCopy (activator->mins, faker->mins);
|
||||
VectorCopy (activator->maxs, faker->maxs);
|
||||
// create a client so you can pick up items/be shot/etc while in camera
|
||||
cl = (gclient_t *) gi.TagMalloc(sizeof(gclient_t), TAG_LEVEL);
|
||||
cl = (gclient_t *)gi.TagMalloc(sizeof(gclient_t), TAG_LEVEL);
|
||||
faker->client = cl;
|
||||
faker->target_ent = activator;
|
||||
gi.linkentity (faker);
|
||||
|
@ -3407,12 +3407,12 @@ void use_target_monitor (edict_t *self, edict_t *other, edict_t *activator)
|
|||
if (self->target_ent && self->target_ent->inuse)
|
||||
{
|
||||
if (self->spawnflags & SF_MONITOR_EYEBALL)
|
||||
VectorCopy(self->target_ent->s.angles,activator->client->ps.viewangles);
|
||||
VectorCopy (self->target_ent->s.angles, activator->client->ps.viewangles);
|
||||
else
|
||||
{
|
||||
vec3_t dir;
|
||||
VectorSubtract(self->target_ent->s.origin,self->s.origin,dir);
|
||||
vectoangles(dir,activator->client->ps.viewangles);
|
||||
VectorSubtract (self->target_ent->s.origin, self->s.origin, dir);
|
||||
vectoangles (dir, activator->client->ps.viewangles);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -3441,17 +3441,18 @@ void use_target_monitor (edict_t *self, edict_t *other, edict_t *activator)
|
|||
else
|
||||
activator->client->pers.chasetoggle = 0;
|
||||
activator->clipmask = 0;
|
||||
VectorClear(activator->velocity);
|
||||
activator->client->ps.gunindex = 0;
|
||||
VectorClear (activator->velocity);
|
||||
activator->client->ps.gunindex = 0;
|
||||
activator->client->ps.pmove.pm_flags |= PMF_NO_PREDICTION;
|
||||
gi.linkentity(activator);
|
||||
|
||||
gi.unlinkentity(faker);
|
||||
KillBox(faker);
|
||||
KillBox (faker);
|
||||
gi.linkentity(faker);
|
||||
|
||||
// check to see if player is the enemy of any monster.
|
||||
for (i=maxclients->value+1, monster=g_edicts+i; i<globals.num_edicts; i++, monster++) {
|
||||
for (i=maxclients->value+1, monster=g_edicts+i; i<globals.num_edicts; i++, monster++)
|
||||
{
|
||||
if (!monster->inuse) continue;
|
||||
if (!(monster->svflags & SVF_MONSTER)) continue;
|
||||
if (monster->enemy == activator)
|
||||
|
@ -3463,7 +3464,7 @@ void use_target_monitor (edict_t *self, edict_t *other, edict_t *activator)
|
|||
if (monster->movetarget == activator)
|
||||
monster->movetarget = NULL;
|
||||
monster->monsterinfo.attack_finished = level.time + 1;
|
||||
FindTarget(monster);
|
||||
FindTarget (monster);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3485,7 +3486,7 @@ void use_target_monitor (edict_t *self, edict_t *other, edict_t *activator)
|
|||
self->viewheight = self->target_ent->viewheight;
|
||||
self->target_ent->svflags |= SVF_NOCLIENT;
|
||||
}
|
||||
VectorCopy(self->target_ent->s.origin,self->s.origin);
|
||||
VectorCopy (self->target_ent->s.origin, self->s.origin);
|
||||
self->think = target_monitor_move;
|
||||
self->think(self);
|
||||
}
|
||||
|
|
|
@ -664,11 +664,12 @@ void hurt_use (edict_t *self, edict_t *other, edict_t *activator)
|
|||
{
|
||||
if (self->solid == SOLID_NOT)
|
||||
{
|
||||
int i, num;
|
||||
edict_t *touch[MAX_EDICTS], *hurtme;
|
||||
int i, num;
|
||||
static edict_t *touch[MAX_EDICTS]; // Knightmare- made static due to stack size
|
||||
edict_t *hurtme;
|
||||
|
||||
self->solid = SOLID_TRIGGER;
|
||||
// Lazaurs: Add check for non-moving (i.e. idle monsters) within trigger_hurt
|
||||
// Lazarus: Add check for non-moving (i.e. idle monsters) within trigger_hurt
|
||||
// at first activation
|
||||
num = gi.BoxEdicts (self->absmin, self->absmax, touch, MAX_EDICTS, AREA_SOLID);
|
||||
for (i=0 ; i<num ; i++)
|
||||
|
@ -1164,8 +1165,9 @@ void SP_trigger_mass_bbox (edict_t *self)
|
|||
|
||||
void trigger_inside_think (edict_t *self)
|
||||
{
|
||||
int i, num;
|
||||
edict_t *touch[MAX_EDICTS], *hit;
|
||||
int i, num;
|
||||
static edict_t *touch[MAX_EDICTS]; // Knightmare- made static due to stack size
|
||||
edict_t *hit;
|
||||
|
||||
num = gi.BoxEdicts (self->absmin, self->absmax, touch, MAX_EDICTS, AREA_SOLID);
|
||||
for (i=0 ; i<num ; i++)
|
||||
|
@ -1283,10 +1285,11 @@ float weight_on_top(edict_t *ent)
|
|||
|
||||
void trigger_scales_think (edict_t *self)
|
||||
{
|
||||
float f, fx, fy;
|
||||
int i, num;
|
||||
int weight;
|
||||
edict_t *e, *touch[MAX_EDICTS], *hit;
|
||||
float f, fx, fy;
|
||||
int i, num;
|
||||
int weight;
|
||||
static edict_t *touch[MAX_EDICTS]; // Knightmare- made static due to stack size
|
||||
edict_t *e, *hit;
|
||||
|
||||
num = gi.BoxEdicts (self->absmin, self->absmax, touch, MAX_EDICTS, AREA_SOLID);
|
||||
weight = 0;
|
||||
|
|
|
@ -1113,7 +1113,7 @@ good_enemy:
|
|||
if (self->enemy->client)
|
||||
victim = self->enemy;
|
||||
}
|
||||
if (victim && self->sounds >= 0 && DotProduct(forward,dir) > 0.99)
|
||||
if ( victim && (self->sounds >= 0) && (DotProduct(forward, dir) > 0.99f) )
|
||||
{
|
||||
// never automatically fire a turret remotely controlled by
|
||||
// a player
|
||||
|
@ -1135,7 +1135,7 @@ good_enemy:
|
|||
turret_turn(self);
|
||||
return;
|
||||
}
|
||||
if (self->sounds == 5 || self->sounds == 6)
|
||||
if ( (self->sounds == 5) || (self->sounds == 6) )
|
||||
reaction_time = 0;
|
||||
else
|
||||
reaction_time = max(0., 0.5*(2-skill->value));
|
||||
|
@ -1146,7 +1146,7 @@ good_enemy:
|
|||
return;
|
||||
}
|
||||
self->monsterinfo.attack_finished = level.time + reaction_time;
|
||||
if (self->sounds != 5 && self->sounds != 6)
|
||||
if ( (self->sounds != 5) && (self->sounds != 6) )
|
||||
self->monsterinfo.attack_finished += self->wait;
|
||||
turret_breach_fire(self);
|
||||
if (skill->value > 0)
|
||||
|
@ -1709,14 +1709,14 @@ void turret_driver_think (edict_t *self)
|
|||
if (level.time < self->monsterinfo.attack_finished)
|
||||
return;
|
||||
|
||||
if (self->target_ent->sounds==5 || self->target_ent->sounds==6)
|
||||
reaction_time = 0.;
|
||||
if ( (self->target_ent->sounds == 5) || (self->target_ent->sounds == 6) )
|
||||
reaction_time = 0.0f;
|
||||
else
|
||||
reaction_time = max(0., (2-skill->value));
|
||||
reaction_time = max(0.0f, (2-skill->value));
|
||||
if ((level.time - self->monsterinfo.trail_time) < reaction_time)
|
||||
return;
|
||||
|
||||
if (self->target_ent->sounds==5 || self->target_ent->sounds==6)
|
||||
if ( (self->target_ent->sounds == 5) || (self->target_ent->sounds == 6) )
|
||||
self->monsterinfo.attack_finished = level.time + FRAMETIME;
|
||||
else
|
||||
self->monsterinfo.attack_finished = level.time + reaction_time + 1.0;
|
||||
|
|
|
@ -607,10 +607,11 @@ G_TouchTriggers
|
|||
|
||||
============
|
||||
*/
|
||||
void G_TouchTriggers (edict_t *ent)
|
||||
void G_TouchTriggers (edict_t *ent)
|
||||
{
|
||||
int i, num;
|
||||
edict_t *touch[MAX_EDICTS], *hit;
|
||||
int i, num;
|
||||
static edict_t *touch[MAX_EDICTS]; // Knightmare- made static due to stack size
|
||||
edict_t *hit;
|
||||
|
||||
// Lazarus: nothing touches anything if game is frozen
|
||||
if (level.freeze)
|
||||
|
@ -620,8 +621,7 @@ void G_TouchTriggers (edict_t *ent)
|
|||
if ((ent->client || (ent->svflags & SVF_MONSTER)) && (ent->health <= 0))
|
||||
return;
|
||||
|
||||
num = gi.BoxEdicts (ent->absmin, ent->absmax, touch
|
||||
, MAX_EDICTS, AREA_TRIGGERS);
|
||||
num = gi.BoxEdicts (ent->absmin, ent->absmax, touch, MAX_EDICTS, AREA_TRIGGERS);
|
||||
|
||||
// be careful, it is possible to have an entity in this
|
||||
// list removed before we get to it (killtriggered)
|
||||
|
@ -646,13 +646,13 @@ Call after linking a new trigger in during gameplay
|
|||
to force all entities it covers to immediately touch it
|
||||
============
|
||||
*/
|
||||
void G_TouchSolids (edict_t *ent)
|
||||
void G_TouchSolids (edict_t *ent)
|
||||
{
|
||||
int i, num;
|
||||
edict_t *touch[MAX_EDICTS], *hit;
|
||||
int i, num;
|
||||
static edict_t *touch[MAX_EDICTS]; // Knightmare- made static due to stack size
|
||||
edict_t *hit;
|
||||
|
||||
num = gi.BoxEdicts (ent->absmin, ent->absmax, touch
|
||||
, MAX_EDICTS, AREA_SOLID);
|
||||
num = gi.BoxEdicts (ent->absmin, ent->absmax, touch, MAX_EDICTS, AREA_SOLID);
|
||||
|
||||
// be careful, it is possible to have an entity in this
|
||||
// list removed before we get to it (killtriggered)
|
||||
|
@ -732,7 +732,7 @@ float SnapToEights(float x)
|
|||
|
||||
/* Lazarus - added functions */
|
||||
|
||||
void stuffcmd(edict_t *pent, char *pszCommand)
|
||||
void stuffcmd (edict_t *pent, char *pszCommand)
|
||||
{
|
||||
gi.WriteByte(svc_stufftext);
|
||||
gi.WriteString(pszCommand);
|
||||
|
@ -755,7 +755,7 @@ qboolean point_infront (edict_t *self, vec3_t point)
|
|||
return false;
|
||||
}
|
||||
|
||||
float AtLeast(float x, float dx)
|
||||
float AtLeast (float x, float dx)
|
||||
{
|
||||
float xx;
|
||||
|
||||
|
@ -766,14 +766,14 @@ float AtLeast(float x, float dx)
|
|||
|
||||
edict_t *LookingAt (edict_t *ent, int filter, vec3_t endpos, float *range)
|
||||
{
|
||||
edict_t *who;
|
||||
edict_t *trigger[MAX_EDICTS];
|
||||
edict_t *ignore;
|
||||
trace_t tr;
|
||||
vec_t r;
|
||||
vec3_t end, forward, start;
|
||||
vec3_t dir, entp, mins, maxs;
|
||||
int i, num;
|
||||
edict_t *who;
|
||||
static edict_t *trigger[MAX_EDICTS]; // Knightmare- made static due to stack size
|
||||
edict_t *ignore;
|
||||
trace_t tr;
|
||||
vec_t r;
|
||||
vec3_t end, forward, start;
|
||||
vec3_t dir, entp, mins, maxs;
|
||||
int i, num;
|
||||
|
||||
if (!ent->client)
|
||||
{
|
||||
|
|
|
@ -623,7 +623,7 @@ void GunnerGrenade (edict_t *self)
|
|||
VectorNormalize (aim);
|
||||
}
|
||||
|
||||
monster_fire_grenade (self, start, aim, 50, GRENADE_VELOCITY, flash_number);
|
||||
monster_fire_grenade (self, start, aim, 50, GRENADE_VELOCITY, flash_number, (self->spawnflags & SF_MONSTER_SPECIAL));
|
||||
}
|
||||
|
||||
mframe_t gunner_frames_attack_chain [] =
|
||||
|
@ -751,7 +751,7 @@ void gunner_jump (edict_t *self)
|
|||
self->monsterinfo.currentmove = &gunner_move_jump;
|
||||
}
|
||||
|
||||
/*QUAKED monster_gunner (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight
|
||||
/*QUAKED monster_gunner (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight GoodGuy NoGib ContactGrenades
|
||||
*/
|
||||
void SP_monster_gunner (edict_t *self)
|
||||
{
|
||||
|
|
147
game/p_client.c
147
game/p_client.c
|
@ -2528,7 +2528,7 @@ void ClientPushPushable(edict_t *ent)
|
|||
RemovePush(ent);
|
||||
}
|
||||
|
||||
void ClientSpycam(edict_t *ent)
|
||||
void ClientSpycam (edict_t *ent)
|
||||
{
|
||||
gclient_t *client = ent->client;
|
||||
edict_t *camera = ent->client->spycam;
|
||||
|
@ -2541,22 +2541,22 @@ void ClientSpycam(edict_t *ent)
|
|||
int i;
|
||||
|
||||
memset (&pm, 0, sizeof(pm));
|
||||
if (client->ucmd.sidemove && level.time > ent->last_move_time + 1)
|
||||
if ( client->ucmd.sidemove && (level.time > ent->last_move_time + 1) )
|
||||
{
|
||||
camera->flags &= ~FL_ROBOT;
|
||||
if (camera->viewer == ent)
|
||||
camera->viewer = NULL;
|
||||
if (client->ucmd.sidemove > 0)
|
||||
camera = G_FindNextCamera(camera,client->monitor);
|
||||
camera = G_FindNextCamera(camera, client->monitor);
|
||||
else
|
||||
camera = G_FindPrevCamera(camera,client->monitor);
|
||||
camera = G_FindPrevCamera(camera, client->monitor);
|
||||
|
||||
if (camera)
|
||||
{
|
||||
if (!camera->viewer)
|
||||
camera->viewer = ent;
|
||||
client->spycam = camera;
|
||||
VectorAdd(camera->s.origin,camera->move_origin,ent->s.origin);
|
||||
VectorAdd (camera->s.origin, camera->move_origin, ent->s.origin);
|
||||
if (camera->viewmessage)
|
||||
safe_centerprintf(ent,camera->viewmessage);
|
||||
ent->last_move_time = level.time;
|
||||
|
@ -2576,17 +2576,17 @@ void ClientSpycam(edict_t *ent)
|
|||
}
|
||||
}
|
||||
}
|
||||
if ((camera->svflags & SVF_MONSTER) && (camera->monsterinfo.aiflags & AI_ACTOR))
|
||||
if ( (camera->svflags & SVF_MONSTER) && (camera->monsterinfo.aiflags & AI_ACTOR) )
|
||||
is_actor = true;
|
||||
else
|
||||
is_actor = false;
|
||||
if (camera->enemy && (camera->enemy->deadflag || !camera->enemy->inuse))
|
||||
camera->enemy = NULL;
|
||||
AngleVectors(camera->s.angles,forward,left,up);
|
||||
AngleVectors (camera->s.angles, forward, left, up);
|
||||
|
||||
if (is_actor && !camera->enemy)
|
||||
{
|
||||
if ((abs(client->ucmd.forwardmove) > 199) && (camera->groundentity))
|
||||
if ( (abs(client->ucmd.forwardmove) > 199) && (camera->groundentity) )
|
||||
{
|
||||
// walk/run
|
||||
|
||||
|
@ -2597,21 +2597,21 @@ void ClientSpycam(edict_t *ent)
|
|||
thing = camera->vehicle;
|
||||
|
||||
VectorMA(camera->s.origin,WORLD_SIZE,forward,end); // was 8192
|
||||
tr = gi.trace(camera->s.origin,camera->mins,camera->maxs,end,camera,MASK_SOLID);
|
||||
tr = gi.trace(camera->s.origin, camera->mins, camera->maxs, end, camera, MASK_SOLID);
|
||||
if (client->ucmd.forwardmove < 0)
|
||||
{
|
||||
trace_t back;
|
||||
VectorMA(camera->s.origin,-WORLD_SIZE,forward,end); // was -8192
|
||||
back = gi.trace(camera->s.origin,camera->mins,camera->maxs,end,camera,MASK_SOLID);
|
||||
VectorSubtract(back.endpos,camera->s.origin,end);
|
||||
back = gi.trace(camera->s.origin, camera->mins, camera->maxs, end, camera, MASK_SOLID);
|
||||
VectorSubtract (back.endpos, camera->s.origin, end);
|
||||
dist = VectorLength(end);
|
||||
VectorCopy(tr.endpos,end);
|
||||
VectorCopy (tr.endpos, end);
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorSubtract(tr.endpos,camera->s.origin,end);
|
||||
VectorSubtract (tr.endpos, camera->s.origin, end);
|
||||
dist = VectorLength(end) - 8;
|
||||
VectorMA(camera->s.origin,dist,forward,end);
|
||||
VectorMA (camera->s.origin, dist, forward, end);
|
||||
}
|
||||
if (dist > 8)
|
||||
{
|
||||
|
@ -2620,7 +2620,7 @@ void ClientSpycam(edict_t *ent)
|
|||
thing->touch_debounce_time = level.time + 5.0;
|
||||
thing->target_ent = camera;
|
||||
VectorCopy(end,thing->s.origin);
|
||||
ED_CallSpawn(thing);
|
||||
ED_CallSpawn (thing);
|
||||
camera->monsterinfo.aiflags |= AI_CHASE_THING;
|
||||
camera->monsterinfo.aiflags &= ~(AI_CHICKEN | AI_STAND_GROUND);
|
||||
camera->monsterinfo.pausetime = 0;
|
||||
|
@ -2642,7 +2642,7 @@ void ClientSpycam(edict_t *ent)
|
|||
{
|
||||
camera->monsterinfo.aiflags &= ~AI_CHASE_THING;
|
||||
camera->movetarget = camera->goalentity = NULL;
|
||||
G_FreeEdict(thing);
|
||||
G_FreeEdict (thing);
|
||||
camera->vehicle = NULL;
|
||||
actor_stand(camera);
|
||||
}
|
||||
|
@ -2655,7 +2655,7 @@ void ClientSpycam(edict_t *ent)
|
|||
{
|
||||
camera->monsterinfo.aiflags &= ~AI_CHASE_THING;
|
||||
camera->movetarget = camera->goalentity = NULL;
|
||||
G_FreeEdict(thing);
|
||||
G_FreeEdict (thing);
|
||||
camera->vehicle = NULL;
|
||||
actor_stand(camera);
|
||||
}
|
||||
|
@ -2667,13 +2667,13 @@ void ClientSpycam(edict_t *ent)
|
|||
{
|
||||
// jump
|
||||
if (client->ucmd.forwardmove > 300)
|
||||
VectorScale(forward,400,camera->velocity);
|
||||
VectorScale (forward, 400, camera->velocity);
|
||||
else if (client->ucmd.forwardmove > 199)
|
||||
VectorScale(forward,200,camera->velocity);
|
||||
VectorScale (forward, 200, camera->velocity);
|
||||
else if (client->ucmd.forwardmove < -300)
|
||||
VectorScale(forward,-400,camera->velocity);
|
||||
VectorScale (forward, -400, camera->velocity);
|
||||
else if (client->ucmd.forwardmove < -199)
|
||||
VectorScale(forward,-200,camera->velocity);
|
||||
VectorScale (forward, -200, camera->velocity);
|
||||
camera->velocity[2] = 250;
|
||||
camera->monsterinfo.savemove = camera->monsterinfo.currentmove;
|
||||
actor_jump(camera);
|
||||
|
@ -2728,7 +2728,8 @@ void ClientSpycam(edict_t *ent)
|
|||
}
|
||||
|
||||
client->ps.pmove.pm_type = PM_FREEZE;
|
||||
if (camera->viewer == ent) {
|
||||
if (camera->viewer == ent)
|
||||
{
|
||||
if ( (client->old_owner_angles[0] != client->ucmd.angles[0]) ||
|
||||
(client->old_owner_angles[1] != client->ucmd.angles[1]) )
|
||||
{
|
||||
|
@ -2753,16 +2754,16 @@ void ClientSpycam(edict_t *ent)
|
|||
{
|
||||
vec3_t angles;
|
||||
vec3_t end, f;
|
||||
VectorSet(angles,0,camera->ideal_yaw,0);
|
||||
AngleVectors(angles,f,NULL,NULL);
|
||||
VectorMA(camera->s.origin,WORLD_SIZE,f,end); // was 8192
|
||||
tr = gi.trace(camera->s.origin,camera->mins,camera->maxs,end,camera,MASK_SOLID);
|
||||
VectorCopy(tr.endpos,camera->vehicle->s.origin);
|
||||
camera->vehicle->touch_debounce_time = level.time + 5.0;
|
||||
VectorSet (angles, 0, camera->ideal_yaw, 0);
|
||||
AngleVectors (angles, f, NULL, NULL);
|
||||
VectorMA (camera->s.origin, WORLD_SIZE, f, end); // was 8192
|
||||
tr = gi.trace(camera->s.origin, camera->mins, camera->maxs, end, camera, MASK_SOLID);
|
||||
VectorCopy (tr.endpos, camera->vehicle->s.origin);
|
||||
camera->vehicle->touch_debounce_time = level.time + 5.0f;
|
||||
gi.linkentity(camera->vehicle);
|
||||
}
|
||||
ai_turn(camera,0.);
|
||||
diff = SHORT2ANGLE(client->ucmd.angles[0]-client->old_owner_angles[0]);
|
||||
ai_turn (camera, 0.0f);
|
||||
diff = SHORT2ANGLE(client->ucmd.angles[0] - client->old_owner_angles[0]);
|
||||
if (diff < -180)
|
||||
diff += 360;
|
||||
if (diff > 180)
|
||||
|
@ -2773,12 +2774,17 @@ void ClientSpycam(edict_t *ent)
|
|||
}
|
||||
}
|
||||
}
|
||||
if ( client->ucmd.buttons & BUTTON_ATTACK && camera->sounds >= 0 ) {
|
||||
if (level.time >= camera->monsterinfo.attack_finished) {
|
||||
client->latched_buttons &= ~BUTTON_ATTACK;
|
||||
if (!Q_stricmp(camera->classname, "turret_breach"))
|
||||
if ( (client->ucmd.buttons & BUTTON_ATTACK) && (camera->sounds >= 0) )
|
||||
{
|
||||
// Knightmare- stop firing weapon when switching to turret
|
||||
client->latched_buttons &= ~BUTTONS_ATTACK;
|
||||
client->buttons &= ~BUTTONS_ATTACK;
|
||||
if (level.time >= camera->monsterinfo.attack_finished)
|
||||
{
|
||||
// client->latched_buttons &= ~BUTTONS_ATTACK;
|
||||
if ( !Q_stricmp(camera->classname, "turret_breach") || !Q_stricmp(camera->classname, "model_turret") )
|
||||
{
|
||||
if (camera->sounds==5 || camera->sounds==6)
|
||||
if ( (camera->sounds == 5) || (camera->sounds == 6) )
|
||||
camera->monsterinfo.attack_finished = level.time;
|
||||
else
|
||||
camera->monsterinfo.attack_finished = level.time + 1.0;
|
||||
|
@ -2790,15 +2796,15 @@ void ClientSpycam(edict_t *ent)
|
|||
if (!camera->enemy)
|
||||
{
|
||||
edict_t *target;
|
||||
target = LookingAt(ent,0,NULL,NULL);
|
||||
if (target && target->takedamage && (target != client->camplayer))
|
||||
target = LookingAt(ent, 0, NULL, NULL);
|
||||
if ( target && target->takedamage && (target != client->camplayer) )
|
||||
{
|
||||
if (camera->vehicle)
|
||||
{
|
||||
// Currently following "thing" - turn that off
|
||||
camera->monsterinfo.aiflags &= ~AI_CHASE_THING;
|
||||
camera->movetarget = camera->goalentity = NULL;
|
||||
G_FreeEdict(camera->vehicle);
|
||||
G_FreeEdict (camera->vehicle);
|
||||
camera->vehicle = NULL;
|
||||
}
|
||||
camera->enemy = target;
|
||||
|
@ -2813,15 +2819,20 @@ void ClientSpycam(edict_t *ent)
|
|||
}
|
||||
}
|
||||
}
|
||||
// Knightmare- stop firing weapon when switching to spycam
|
||||
else if ( (client->ucmd.buttons & BUTTON_ATTACK) && (camera->sounds < 0) ) {
|
||||
client->latched_buttons &= ~BUTTONS_ATTACK;
|
||||
client->buttons &= ~BUTTONS_ATTACK;
|
||||
}
|
||||
|
||||
if (client->zoomed) {
|
||||
camera->touch_debounce_time =
|
||||
max(camera->touch_debounce_time, level.time + 1.0);
|
||||
camera->touch_debounce_time = max(camera->touch_debounce_time, level.time + 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
VectorMA(camera->s.origin, camera->move_origin[0],forward,start);
|
||||
VectorMA(start, -camera->move_origin[1],left, start);
|
||||
VectorMA(start, camera->move_origin[2],up, start);
|
||||
VectorMA (camera->s.origin, camera->move_origin[0], forward, start);
|
||||
VectorMA (start, -camera->move_origin[1], left, start);
|
||||
VectorMA (start, camera->move_origin[2], up, start);
|
||||
|
||||
tr = gi.trace(camera->s.origin, NULL, NULL, start, camera, MASK_SOLID);
|
||||
if (tr.fraction < 1.0)
|
||||
|
@ -2831,8 +2842,8 @@ void ClientSpycam(edict_t *ent)
|
|||
if (dist < 0) dist = 0.;
|
||||
VectorMA(camera->s.origin,dist,dir,start);
|
||||
}
|
||||
VectorCopy(start,ent->s.origin);
|
||||
VectorCopy(camera->velocity,ent->velocity);
|
||||
VectorCopy (start, ent->s.origin);
|
||||
VectorCopy (camera->velocity, ent->velocity);
|
||||
|
||||
client->resp.cmd_angles[0] = SHORT2ANGLE(client->ucmd.angles[0]);
|
||||
client->resp.cmd_angles[1] = SHORT2ANGLE(client->ucmd.angles[1]);
|
||||
|
@ -2977,14 +2988,14 @@ void ClientThink (edict_t *ent, usercmd_t *ucmd)
|
|||
viewing = LookingAt(ent,0,intersect,&range);
|
||||
if (viewing && viewing->classname)
|
||||
{
|
||||
if (!Q_stricmp(viewing->classname,"crane_control") && range <= 100)
|
||||
if (!Q_stricmp(viewing->classname, "crane_control") && range <= 100)
|
||||
crane_control_action(viewing,ent,intersect);
|
||||
if (!Q_stricmp(viewing->classname,"target_lock_digit") && range <= 100)
|
||||
if (!Q_stricmp(viewing->classname, "target_lock_digit") && range <= 100)
|
||||
lock_digit_increment(viewing,ent);
|
||||
if (!Q_stricmp(viewing->classname,"func_trainbutton") && (viewing->spawnflags & 1) && range <= 64)
|
||||
if (!Q_stricmp(viewing->classname, "func_trainbutton") && (viewing->spawnflags & 1) && range <= 64)
|
||||
trainbutton_use(viewing,ent,ent);
|
||||
// Knightmare- different range for chasecam
|
||||
if (!Q_stricmp(viewing->classname,"func_monitor") && ((range <= 100) || (client->chasetoggle && range <= client->zoom + 160.00)) )
|
||||
if (!Q_stricmp(viewing->classname, "func_monitor") && ((range <= 100) || (client->chasetoggle && range <= client->zoom + 160.00)) )
|
||||
{
|
||||
use_camera(viewing,ent,ent);
|
||||
if (client->spycam && client->spycam->viewer == ent)
|
||||
|
@ -3071,23 +3082,23 @@ void ClientThink (edict_t *ent, usercmd_t *ucmd)
|
|||
return;
|
||||
}
|
||||
|
||||
if (ent->target_ent && !Q_stricmp(ent->target_ent->classname,"target_monitor"))
|
||||
if (ent->target_ent && !Q_stricmp(ent->target_ent->classname, "target_monitor"))
|
||||
{
|
||||
edict_t *monitor = ent->target_ent;
|
||||
if (monitor->target_ent && monitor->target_ent->inuse)
|
||||
{
|
||||
if (monitor->spawnflags & 2)
|
||||
VectorCopy(monitor->target_ent->s.angles,client->ps.viewangles);
|
||||
VectorCopy (monitor->target_ent->s.angles, client->ps.viewangles);
|
||||
else
|
||||
{
|
||||
vec3_t dir;
|
||||
VectorSubtract(monitor->target_ent->s.origin,monitor->s.origin,dir);
|
||||
vectoangles(dir,client->ps.viewangles);
|
||||
VectorSubtract (monitor->target_ent->s.origin, monitor->s.origin, dir);
|
||||
vectoangles (dir, client->ps.viewangles);
|
||||
}
|
||||
}
|
||||
else
|
||||
VectorCopy (monitor->s.angles, client->ps.viewangles);
|
||||
VectorCopy(monitor->s.origin,ent->s.origin);
|
||||
VectorCopy (monitor->s.origin, ent->s.origin);
|
||||
client->ps.pmove.pm_type = PM_FREEZE;
|
||||
return;
|
||||
}
|
||||
|
@ -3134,26 +3145,34 @@ void ClientThink (edict_t *ent, usercmd_t *ucmd)
|
|||
}
|
||||
|
||||
// ZOOM
|
||||
if (client->zooming) {
|
||||
if (client->zooming)
|
||||
{
|
||||
client->pers.hand = 2;
|
||||
if (client->zooming > 0) {
|
||||
if (client->zooming > 0)
|
||||
{
|
||||
if (client->ps.fov > 5) {
|
||||
client->ps.fov -= client->frame_zoomrate;
|
||||
if (client->ps.fov < 5)
|
||||
client->ps.fov = 5;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
client->ps.fov = 5;
|
||||
}
|
||||
client->zoomed = true;
|
||||
} else {
|
||||
if (client->ps.fov < client->original_fov) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (client->ps.fov < client->original_fov)
|
||||
{
|
||||
client->ps.fov += client->frame_zoomrate;
|
||||
if (client->ps.fov > client->original_fov) {
|
||||
client->ps.fov = client->original_fov;
|
||||
client->zoomed = false;
|
||||
} else
|
||||
}
|
||||
else
|
||||
client->zoomed = true;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
client->ps.fov = client->original_fov;
|
||||
client->zoomed = false;
|
||||
}
|
||||
|
@ -3173,12 +3192,12 @@ void ClientThink (edict_t *ent, usercmd_t *ucmd)
|
|||
ShiftItem(ent, client->shift_dir);
|
||||
|
||||
if (client->chase_target) {
|
||||
|
||||
client->resp.cmd_angles[0] = SHORT2ANGLE(ucmd->angles[0]);
|
||||
client->resp.cmd_angles[1] = SHORT2ANGLE(ucmd->angles[1]);
|
||||
client->resp.cmd_angles[2] = SHORT2ANGLE(ucmd->angles[2]);
|
||||
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
// set up for pmove
|
||||
memset (&pm, 0, sizeof(pm));
|
||||
|
|
12
game/p_hud.c
12
game/p_hud.c
|
@ -425,12 +425,12 @@ void Cmd_Help_f (edict_t *ent)
|
|||
//=======================================================================
|
||||
void WhatIsIt (edict_t *ent)
|
||||
{
|
||||
float range;
|
||||
int i, num;
|
||||
edict_t *touch[MAX_EDICTS];
|
||||
edict_t *who, *best;
|
||||
trace_t tr;
|
||||
vec3_t dir, end, entp, forward, mins, maxs, start, viewp;
|
||||
float range;
|
||||
int i, num;
|
||||
static edict_t *touch[MAX_EDICTS]; // Knightmare- made static due to stack size
|
||||
edict_t *who, *best;
|
||||
trace_t tr;
|
||||
vec3_t dir, end, entp, forward, mins, maxs, start, viewp;
|
||||
|
||||
/* Check for looking directly at a player or other non-trigger entity */
|
||||
VectorCopy(ent->s.origin, start);
|
||||
|
|
|
@ -501,17 +501,17 @@ void hintpath_stop (edict_t *self)
|
|||
// and the monster's enemy. if only one person is visible from the endpoints,
|
||||
// it will not go for it.
|
||||
// =============
|
||||
qboolean monsterlost_checkhint2 (edict_t *self);
|
||||
//qboolean monsterlost_checkhint2 (edict_t *self);
|
||||
|
||||
qboolean monsterlost_checkhint (edict_t *self)
|
||||
{
|
||||
edict_t *e, *monster_pathchain, *target_pathchain, *checkpoint;
|
||||
edict_t *closest;
|
||||
edict_t *e=NULL;
|
||||
edict_t *monster_pathchain=NULL, *target_pathchain=NULL, *checkpoint=NULL;
|
||||
edict_t *closest=NULL, *start=NULL, *destination=NULL;
|
||||
float closest_range = 1000000;
|
||||
edict_t *start, *destination;
|
||||
size_t field;
|
||||
int count1=0, count2=0, count3=0, count4=0, count5=0;
|
||||
float r;
|
||||
// size_t field;
|
||||
int count1=0, count2=0, count3=0, count4=0, count5=0;
|
||||
int i;
|
||||
qboolean hint_path_represented[MAX_HINT_CHAINS];
|
||||
|
||||
|
@ -529,8 +529,7 @@ qboolean monsterlost_checkhint (edict_t *self)
|
|||
return false;
|
||||
|
||||
monster_pathchain = NULL;
|
||||
|
||||
field = FOFS(classname);
|
||||
// field = FOFS(classname);
|
||||
|
||||
// find all the hint_paths.
|
||||
// FIXME - can we not do this every time?
|
||||
|
@ -547,7 +546,7 @@ qboolean monsterlost_checkhint (edict_t *self)
|
|||
checkpoint->monster_hint_chain = e;
|
||||
checkpoint = e;
|
||||
}
|
||||
else
|
||||
else // add first node
|
||||
{
|
||||
monster_pathchain = e;
|
||||
checkpoint = e;
|
||||
|
@ -825,6 +824,7 @@ qboolean monsterlost_checkhint (edict_t *self)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
qboolean monsterlost_checkhint2 (edict_t *self)
|
||||
{
|
||||
|
@ -852,7 +852,7 @@ qboolean monsterlost_checkhint2 (edict_t *self)
|
|||
// check visibility from this spot
|
||||
selfVisible = visible(e, self);
|
||||
playerVisible = visible(e, self->enemy);
|
||||
// gi.dprintf("checking endpoint at %s %d %d\n", vtos(e->s.origin),selfVisible,playerVisible);
|
||||
// gi.dprintf("checking endpoint at %s %d %d\n", vtos(e->s.origin),selfVisible,playerVisible);
|
||||
|
||||
// at least one of us is visible from this endpoint.
|
||||
// now check the other one if needed.
|
||||
|
@ -883,7 +883,7 @@ qboolean monsterlost_checkhint2 (edict_t *self)
|
|||
if (!goPoint && selfVisible)
|
||||
goPoint = e2;
|
||||
|
||||
// gi.dprintf("checking other endpoint at %s %d %d\n", vtos(e2->s.origin),selfVisible,playerVisible);
|
||||
// gi.dprintf("checking other endpoint at %s %d %d\n", vtos(e2->s.origin),selfVisible,playerVisible);
|
||||
}
|
||||
|
||||
// if both are visible from at least one endpoint,
|
||||
|
@ -910,6 +910,7 @@ qboolean monsterlost_checkhint2 (edict_t *self)
|
|||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
//
|
||||
// Path code
|
||||
//
|
||||
|
@ -919,7 +920,7 @@ qboolean monsterlost_checkhint2 (edict_t *self)
|
|||
// =============
|
||||
void hint_path_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
|
||||
{
|
||||
edict_t *e, *goal, *next;
|
||||
edict_t *e=NULL, *goal=NULL, *next=NULL;
|
||||
// int chain; // direction - (-1) = upstream, (1) = downstream, (0) = done
|
||||
qboolean goalFound = false;
|
||||
|
||||
|
@ -1327,9 +1328,10 @@ edict_t *SpawnBadArea (vec3_t mins, vec3_t maxs, float lifespan, edict_t *owner)
|
|||
// for bad area triggers and return them if they're touched.
|
||||
edict_t *CheckForBadArea (edict_t *ent)
|
||||
{
|
||||
int i, num;
|
||||
edict_t *touch[MAX_EDICTS], *hit;
|
||||
vec3_t mins, maxs;
|
||||
int i, num;
|
||||
static edict_t *touch[MAX_EDICTS]; // Knightmare- made static due to stack size
|
||||
edict_t *hit;
|
||||
vec3_t mins, maxs;
|
||||
|
||||
VectorAdd (ent->s.origin, ent->mins, mins);
|
||||
VectorAdd (ent->s.origin, ent->maxs, maxs);
|
||||
|
|
|
@ -73,6 +73,7 @@ void flechette_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t
|
|||
void fire_flechette (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, float damage_radius, int radius_damage)
|
||||
{
|
||||
edict_t *flechette;
|
||||
trace_t tr; // Knightmare added
|
||||
|
||||
VectorNormalize (dir);
|
||||
|
||||
|
@ -107,6 +108,14 @@ void fire_flechette (edict_t *self, vec3_t start, vec3_t dir, int damage, int sp
|
|||
|
||||
if (self->client)
|
||||
check_dodge (self, flechette->s.origin, dir, speed);
|
||||
|
||||
// Knightmare- added missing point-blank collision check
|
||||
tr = gi.trace (self->s.origin, NULL, NULL, flechette->s.origin, flechette, MASK_SHOT);
|
||||
if (tr.fraction < 1.0 && !(self->flags & FL_TURRET_OWNER))
|
||||
{
|
||||
VectorMA (flechette->s.origin, -10, dir, flechette->s.origin);
|
||||
flechette->touch (flechette, tr.ent, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
// SP_flechette should ONLY be used for flechettes that have changed
|
||||
|
@ -2070,10 +2079,11 @@ void tesla_zap (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf
|
|||
|
||||
void tesla_think_active (edict_t *self)
|
||||
{
|
||||
int i,num;
|
||||
edict_t *touch[MAX_EDICTS], *hit;
|
||||
vec3_t dir, start;
|
||||
trace_t tr;
|
||||
int i, num;
|
||||
static edict_t *touch[MAX_EDICTS]; // Knightmare- made static due to stack size
|
||||
edict_t *hit;
|
||||
vec3_t dir, start;
|
||||
trace_t tr;
|
||||
|
||||
if (level.time > self->air_finished)
|
||||
{
|
||||
|
|
|
@ -2431,8 +2431,8 @@ void target_monitor_off (edict_t *self)
|
|||
self->target_ent->svflags &= ~SVF_NOCLIENT;
|
||||
}
|
||||
faker = player->client->camplayer;
|
||||
VectorCopy(faker->s.origin,player->s.origin);
|
||||
gi.TagFree(faker->client);
|
||||
VectorCopy (faker->s.origin, player->s.origin);
|
||||
gi.TagFree (faker->client);
|
||||
G_FreeEdict (faker);
|
||||
player->client->ps.pmove.origin[0] = player->s.origin[0]*8;
|
||||
player->client->ps.pmove.origin[1] = player->s.origin[1]*8;
|
||||
|
@ -2440,10 +2440,10 @@ void target_monitor_off (edict_t *self)
|
|||
for (i=0 ; i<3 ; i++)
|
||||
player->client->ps.pmove.delta_angles[i] =
|
||||
ANGLE2SHORT(player->client->org_viewangles[i] - player->client->resp.cmd_angles[i]);
|
||||
VectorCopy(player->client->org_viewangles, player->client->resp.cmd_angles);
|
||||
VectorCopy(player->client->org_viewangles, player->s.angles);
|
||||
VectorCopy(player->client->org_viewangles, player->client->ps.viewangles);
|
||||
VectorCopy(player->client->org_viewangles, player->client->v_angle);
|
||||
VectorCopy (player->client->org_viewangles, player->client->resp.cmd_angles);
|
||||
VectorCopy (player->client->org_viewangles, player->s.angles);
|
||||
VectorCopy (player->client->org_viewangles, player->client->ps.viewangles);
|
||||
VectorCopy (player->client->org_viewangles, player->client->v_angle);
|
||||
|
||||
player->client->ps.gunindex = gi.modelindex(player->client->pers.weapon->view_model);
|
||||
player->client->ps.pmove.pm_flags &= ~PMF_NO_PREDICTION;
|
||||
|
@ -2503,17 +2503,17 @@ void target_monitor_move (edict_t *self)
|
|||
return;
|
||||
}
|
||||
|
||||
AngleVectors(self->target_ent->s.angles,forward,NULL,NULL);
|
||||
VectorMA(self->target_ent->s.origin, -self->moveinfo.distance, forward, o);
|
||||
AngleVectors (self->target_ent->s.angles, forward, NULL, NULL);
|
||||
VectorMA (self->target_ent->s.origin, -self->moveinfo.distance, forward, o);
|
||||
|
||||
o[2] += self->viewheight;
|
||||
|
||||
VectorSubtract(o,self->s.origin,o);
|
||||
VectorMA(self->s.origin,0.2,o,o);
|
||||
VectorSubtract (o, self->s.origin, o);
|
||||
VectorMA (self->s.origin, 0.2, o, o);
|
||||
|
||||
trace = gi.trace(self->target_ent->s.origin, NULL, NULL, o, self, MASK_SOLID);
|
||||
VectorCopy(trace.endpos, goal);
|
||||
VectorMA(goal, 2, forward, goal);
|
||||
VectorCopy (trace.endpos, goal);
|
||||
VectorMA (goal, 2, forward, goal);
|
||||
|
||||
// pad for floors and ceilings
|
||||
VectorCopy(goal, o);
|
||||
|
@ -2550,12 +2550,12 @@ void use_target_monitor (edict_t *self, edict_t *other, edict_t *activator)
|
|||
if (self->child)
|
||||
{
|
||||
if (self->wait < 0)
|
||||
target_monitor_off(self);
|
||||
target_monitor_off (self);
|
||||
return;
|
||||
}
|
||||
|
||||
if (self->target)
|
||||
self->target_ent = G_Find(NULL,FOFS(targetname),self->target);
|
||||
self->target_ent = G_Find(NULL, FOFS(targetname), self->target);
|
||||
|
||||
// if this is a CHASE_CAM target_monitor and the target no longer
|
||||
// exists, remove this target_monitor and exit
|
||||
|
@ -2568,7 +2568,7 @@ void use_target_monitor (edict_t *self, edict_t *other, edict_t *activator)
|
|||
}
|
||||
}
|
||||
// save current viewangles
|
||||
VectorCopy(activator->client->v_angle,activator->client->org_viewangles);
|
||||
VectorCopy (activator->client->v_angle, activator->client->org_viewangles);
|
||||
|
||||
// create a fake player to stand in real player's position
|
||||
faker = activator->client->camplayer = G_Spawn();
|
||||
|
@ -2593,8 +2593,8 @@ void use_target_monitor (edict_t *self, edict_t *other, edict_t *activator)
|
|||
faker->light_level = activator->light_level;
|
||||
faker->think = faker_animate;
|
||||
faker->nextthink = level.time + FRAMETIME;
|
||||
VectorCopy(activator->mins,faker->mins);
|
||||
VectorCopy(activator->maxs,faker->maxs);
|
||||
VectorCopy (activator->mins, faker->mins);
|
||||
VectorCopy (activator->maxs, faker->maxs);
|
||||
// create a client so you can pick up items/be shot/etc while in camera
|
||||
cl = (gclient_t *) gi.TagMalloc(sizeof(gclient_t), TAG_LEVEL);
|
||||
faker->client = cl;
|
||||
|
@ -2604,12 +2604,12 @@ void use_target_monitor (edict_t *self, edict_t *other, edict_t *activator)
|
|||
if (self->target_ent && self->target_ent->inuse)
|
||||
{
|
||||
if (self->spawnflags & SF_MONITOR_EYEBALL)
|
||||
VectorCopy(self->target_ent->s.angles,activator->client->ps.viewangles);
|
||||
VectorCopy (self->target_ent->s.angles, activator->client->ps.viewangles);
|
||||
else
|
||||
{
|
||||
vec3_t dir;
|
||||
VectorSubtract(self->target_ent->s.origin,self->s.origin,dir);
|
||||
vectoangles(dir,activator->client->ps.viewangles);
|
||||
VectorSubtract (self->target_ent->s.origin, self->s.origin, dir);
|
||||
vectoangles (dir, activator->client->ps.viewangles);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -2638,17 +2638,18 @@ void use_target_monitor (edict_t *self, edict_t *other, edict_t *activator)
|
|||
else
|
||||
activator->client->chasetoggle = 0;
|
||||
activator->clipmask = 0;
|
||||
VectorClear(activator->velocity);
|
||||
VectorClear (activator->velocity);
|
||||
activator->client->ps.gunindex = 0;
|
||||
activator->client->ps.pmove.pm_flags |= PMF_NO_PREDICTION;
|
||||
gi.linkentity(activator);
|
||||
gi.linkentity (activator);
|
||||
|
||||
gi.unlinkentity(faker);
|
||||
KillBox(faker);
|
||||
gi.linkentity(faker);
|
||||
|
||||
// check to see if player is the enemy of any monster.
|
||||
for (i=maxclients->value+1, monster=g_edicts+i; i<globals.num_edicts; i++, monster++) {
|
||||
for (i=maxclients->value+1, monster=g_edicts+i; i<globals.num_edicts; i++, monster++)
|
||||
{
|
||||
if (!monster->inuse) continue;
|
||||
if (!(monster->svflags & SVF_MONSTER)) continue;
|
||||
if (monster->enemy == activator)
|
||||
|
@ -2660,7 +2661,7 @@ void use_target_monitor (edict_t *self, edict_t *other, edict_t *activator)
|
|||
if (monster->movetarget == activator)
|
||||
monster->movetarget = NULL;
|
||||
monster->monsterinfo.attack_finished = level.time + 1;
|
||||
FindTarget(monster);
|
||||
FindTarget (monster);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2682,7 +2683,7 @@ void use_target_monitor (edict_t *self, edict_t *other, edict_t *activator)
|
|||
self->viewheight = self->target_ent->viewheight;
|
||||
self->target_ent->svflags |= SVF_NOCLIENT;
|
||||
}
|
||||
VectorCopy(self->target_ent->s.origin,self->s.origin);
|
||||
VectorCopy (self->target_ent->s.origin, self->s.origin);
|
||||
self->think = target_monitor_move;
|
||||
self->think(self);
|
||||
}
|
||||
|
|
|
@ -1260,8 +1260,9 @@ void SP_trigger_mass_bbox (edict_t *self)
|
|||
//=======================================================================================
|
||||
void trigger_inside_think (edict_t *self)
|
||||
{
|
||||
int i, num;
|
||||
edict_t *touch[MAX_EDICTS], *hit;
|
||||
int i, num;
|
||||
static edict_t *touch[MAX_EDICTS]; // Knightmare- made static due to stack size
|
||||
edict_t *hit;
|
||||
|
||||
num = gi.BoxEdicts (self->absmin, self->absmax, touch, MAX_EDICTS, AREA_SOLID);
|
||||
for (i=0 ; i<num ; i++)
|
||||
|
@ -1390,10 +1391,11 @@ float weight_on_top (edict_t *ent)
|
|||
|
||||
void trigger_scales_think (edict_t *self)
|
||||
{
|
||||
float f, fx, fy;
|
||||
int i, num;
|
||||
int weight;
|
||||
edict_t *e, *touch[MAX_EDICTS], *hit;
|
||||
float f, fx, fy;
|
||||
int i, num;
|
||||
int weight;
|
||||
static edict_t *touch[MAX_EDICTS]; // Knightmare- made static due to stack size
|
||||
edict_t *e, *hit;
|
||||
|
||||
num = gi.BoxEdicts (self->absmin, self->absmax, touch, MAX_EDICTS, AREA_SOLID);
|
||||
weight = 0;
|
||||
|
|
|
@ -1226,7 +1226,7 @@ good_enemy:
|
|||
if (self->enemy->client)
|
||||
victim = self->enemy;
|
||||
}
|
||||
if (victim && self->sounds >= 0 && DotProduct(forward,dir) > 0.99)
|
||||
if ( victim && self->sounds >= 0 && DotProduct(forward,dir) > 0.99f )
|
||||
{
|
||||
// never automatically fire a turret remotely controlled by
|
||||
// a player
|
||||
|
@ -1248,7 +1248,7 @@ good_enemy:
|
|||
turret_turn(self);
|
||||
return;
|
||||
}
|
||||
if (self->sounds == 5 || self->sounds == 6)
|
||||
if ( (self->sounds == 5) || (self->sounds == 6) )
|
||||
reaction_time = 0;
|
||||
else
|
||||
reaction_time = max(0., 0.5*(2-skill->value));
|
||||
|
@ -1259,7 +1259,7 @@ good_enemy:
|
|||
return;
|
||||
}
|
||||
self->monsterinfo.attack_finished = level.time + reaction_time;
|
||||
if (self->sounds != 5 && self->sounds != 6)
|
||||
if ( (self->sounds != 5) && (self->sounds != 6) )
|
||||
self->monsterinfo.attack_finished += self->wait;
|
||||
turret_breach_fire (self);
|
||||
if (skill->value > 0)
|
||||
|
@ -1668,7 +1668,7 @@ void SP_turret_breach (edict_t *self)
|
|||
st.maxpitch = 30;
|
||||
if (!st.maxyaw)
|
||||
st.maxyaw = 360;
|
||||
if (!self->wait && self->sounds != 5 && self->sounds != 6)
|
||||
if (!self->wait && (self->sounds != 5) && (self->sounds != 6) )
|
||||
self->wait = 1;
|
||||
if (self->health > 0)
|
||||
{
|
||||
|
|
|
@ -756,10 +756,11 @@ G_TouchTriggers
|
|||
|
||||
============
|
||||
*/
|
||||
void G_TouchTriggers (edict_t *ent)
|
||||
void G_TouchTriggers (edict_t *ent)
|
||||
{
|
||||
int i, num;
|
||||
edict_t *touch[MAX_EDICTS], *hit;
|
||||
int i, num;
|
||||
static edict_t *touch[MAX_EDICTS]; // Knightmare- made static due to stack size
|
||||
edict_t *hit;
|
||||
|
||||
// added stasis generator support
|
||||
// Lazarus: nothing touches anything if game is frozen
|
||||
|
@ -770,8 +771,7 @@ void G_TouchTriggers (edict_t *ent)
|
|||
if ((ent->client || (ent->svflags & SVF_MONSTER)) && (ent->health <= 0))
|
||||
return;
|
||||
|
||||
num = gi.BoxEdicts (ent->absmin, ent->absmax, touch
|
||||
, MAX_EDICTS, AREA_TRIGGERS);
|
||||
num = gi.BoxEdicts (ent->absmin, ent->absmax, touch, MAX_EDICTS, AREA_TRIGGERS);
|
||||
|
||||
// be careful, it is possible to have an entity in this
|
||||
// list removed before we get to it (killtriggered)
|
||||
|
@ -796,13 +796,13 @@ Call after linking a new trigger in during gameplay
|
|||
to force all entities it covers to immediately touch it
|
||||
============
|
||||
*/
|
||||
void G_TouchSolids (edict_t *ent)
|
||||
void G_TouchSolids (edict_t *ent)
|
||||
{
|
||||
int i, num;
|
||||
edict_t *touch[MAX_EDICTS], *hit;
|
||||
int i, num;
|
||||
static edict_t *touch[MAX_EDICTS]; // Knightmare- made static due to stack size
|
||||
edict_t *hit;
|
||||
|
||||
num = gi.BoxEdicts (ent->absmin, ent->absmax, touch
|
||||
, MAX_EDICTS, AREA_SOLID);
|
||||
num = gi.BoxEdicts (ent->absmin, ent->absmax, touch, MAX_EDICTS, AREA_SOLID);
|
||||
|
||||
// be careful, it is possible to have an entity in this
|
||||
// list removed before we get to it (killtriggered)
|
||||
|
@ -924,7 +924,7 @@ float SnapToEights(float x)
|
|||
|
||||
/* Lazarus - added functions */
|
||||
|
||||
void stuffcmd(edict_t *ent, char *s)
|
||||
void stuffcmd (edict_t *ent, char *s)
|
||||
{
|
||||
gi.WriteByte (11);
|
||||
gi.WriteString (s);
|
||||
|
@ -947,7 +947,7 @@ qboolean point_infront (edict_t *self, vec3_t point)
|
|||
return false;
|
||||
}
|
||||
|
||||
float AtLeast(float x, float dx)
|
||||
float AtLeast (float x, float dx)
|
||||
{
|
||||
float xx;
|
||||
|
||||
|
@ -956,16 +956,16 @@ float AtLeast(float x, float dx)
|
|||
return xx;
|
||||
}
|
||||
|
||||
edict_t *LookingAt(edict_t *ent, int filter, vec3_t endpos, float *range)
|
||||
edict_t *LookingAt (edict_t *ent, int filter, vec3_t endpos, float *range)
|
||||
{
|
||||
edict_t *who;
|
||||
edict_t *trigger[MAX_EDICTS];
|
||||
edict_t *ignore;
|
||||
trace_t tr;
|
||||
vec_t r;
|
||||
vec3_t end, forward, start;
|
||||
vec3_t dir, entp, mins, maxs;
|
||||
int i, num;
|
||||
edict_t *who;
|
||||
static edict_t *trigger[MAX_EDICTS]; // Knightmare- made static due to stack size
|
||||
edict_t *ignore;
|
||||
trace_t tr;
|
||||
vec_t r;
|
||||
vec3_t end, forward, start;
|
||||
vec3_t dir, entp, mins, maxs;
|
||||
int i, num;
|
||||
|
||||
if (!ent->client)
|
||||
{
|
||||
|
|
|
@ -1943,15 +1943,15 @@ typedef struct
|
|||
|
||||
void actor_files (void)
|
||||
{
|
||||
char path[256];
|
||||
char filename[256];
|
||||
int s_match, w_match[2];
|
||||
int i, j, k;
|
||||
int num_actors = 0;
|
||||
actorlist actors[MAX_EDICTS];
|
||||
cvar_t *basedir, *cddir, *gamedir;
|
||||
edict_t *e, *e0;
|
||||
FILE *f;
|
||||
char path[256];
|
||||
char filename[256];
|
||||
int s_match, w_match[2];
|
||||
int i, j, k;
|
||||
int num_actors = 0;
|
||||
static actorlist actors[MAX_EDICTS]; // Knightmare- made static due to stack size
|
||||
cvar_t *basedir, *cddir, *gamedir;
|
||||
edict_t *e, *e0;
|
||||
FILE *f;
|
||||
|
||||
if(deathmatch->value)
|
||||
return;
|
||||
|
@ -1960,7 +1960,7 @@ void actor_files (void)
|
|||
cddir = gi.cvar("cddir", "", 0);
|
||||
gamedir = gi.cvar("gamedir", "", 0);
|
||||
|
||||
memset(&actors,0,MAX_EDICTS*sizeof(actorlist));
|
||||
memset(&actors, 0, MAX_EDICTS*sizeof(actorlist));
|
||||
|
||||
for (i=game.maxclients+1; i<globals.num_edicts; i++)
|
||||
{
|
||||
|
|
|
@ -667,7 +667,7 @@ void SP_monster_boss5 (edict_t *self)
|
|||
{
|
||||
PatchMonsterModel("models/monsters/boss5/tris.md2");
|
||||
self->s.skinnum = self->style * 2;
|
||||
// self->style = 0; //clear for custom bloodtype flag
|
||||
// self->style = 0; // clear for custom bloodtype flag
|
||||
}
|
||||
|
||||
self->s.modelindex = gi.modelindex ("models/monsters/boss5/tris.md2");
|
||||
|
|
|
@ -858,7 +858,7 @@ void GunnerGrenade (edict_t *self)
|
|||
monster_fire_prox (self, start, aim, 90, 1, GRENADE_VELOCITY, 20, prox_timer, 192, flash_number);
|
||||
}
|
||||
else
|
||||
monster_fire_grenade (self, start, aim, 50, GRENADE_VELOCITY, flash_number, false);
|
||||
monster_fire_grenade (self, start, aim, 50, GRENADE_VELOCITY, flash_number, (self->spawnflags & SF_MONSTER_SPECIAL));
|
||||
}
|
||||
|
||||
mframe_t gunner_frames_attack_chain [] =
|
||||
|
@ -1331,7 +1331,7 @@ void gunner_sidestep (edict_t *self)
|
|||
}
|
||||
|
||||
|
||||
/*QUAKED monster_gunner (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight GoodGuy NoGib
|
||||
/*QUAKED monster_gunner (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight GoodGuy NoGib ContactGrenades
|
||||
*/
|
||||
/*QUAKED monster_gunner_tactician (1 .5 0) (-16 -16 -24) (16 16 32) Ambush Trigger_Spawn Sight GoodGuy NoGib
|
||||
*/
|
||||
|
|
|
@ -3199,7 +3199,7 @@ void ClientPushPushable(edict_t *ent)
|
|||
RemovePush(ent);
|
||||
}
|
||||
|
||||
void ClientSpycam(edict_t *ent)
|
||||
void ClientSpycam (edict_t *ent)
|
||||
{
|
||||
gclient_t *client = ent->client;
|
||||
edict_t *camera = ent->client->spycam;
|
||||
|
@ -3212,7 +3212,7 @@ void ClientSpycam(edict_t *ent)
|
|||
int i;
|
||||
|
||||
memset (&pm, 0, sizeof(pm));
|
||||
if (client->ucmd.sidemove && level.time > ent->last_move_time + 1)
|
||||
if ( client->ucmd.sidemove && (level.time > ent->last_move_time + 1) )
|
||||
{
|
||||
camera->flags &= ~FL_ROBOT;
|
||||
if (camera->viewer == ent)
|
||||
|
@ -3227,7 +3227,7 @@ void ClientSpycam(edict_t *ent)
|
|||
if (!camera->viewer)
|
||||
camera->viewer = ent;
|
||||
client->spycam = camera;
|
||||
VectorAdd(camera->s.origin,camera->move_origin,ent->s.origin);
|
||||
VectorAdd (camera->s.origin, camera->move_origin, ent->s.origin);
|
||||
if (camera->viewmessage)
|
||||
gi.centerprintf(ent,camera->viewmessage);
|
||||
ent->last_move_time = level.time;
|
||||
|
@ -3253,7 +3253,7 @@ void ClientSpycam(edict_t *ent)
|
|||
is_actor = false;
|
||||
if (camera->enemy && (camera->enemy->deadflag || !camera->enemy->inuse))
|
||||
camera->enemy = NULL;
|
||||
AngleVectors(camera->s.angles,forward,left,up);
|
||||
AngleVectors (camera->s.angles ,forward, left, up);
|
||||
|
||||
if (is_actor && !camera->enemy)
|
||||
{
|
||||
|
@ -3267,21 +3267,21 @@ void ClientSpycam(edict_t *ent)
|
|||
thing = camera->vehicle;
|
||||
|
||||
VectorMA(camera->s.origin, WORLD_SIZE, forward, end); // was 8192
|
||||
tr = gi.trace(camera->s.origin,camera->mins,camera->maxs,end,camera,MASK_SOLID);
|
||||
tr = gi.trace(camera->s.origin, camera->mins, camera->maxs, end, camera, MASK_SOLID);
|
||||
if (client->ucmd.forwardmove < 0)
|
||||
{
|
||||
trace_t back;
|
||||
VectorMA(camera->s.origin, -WORLD_SIZE, forward, end); // was -8192
|
||||
back = gi.trace(camera->s.origin,camera->mins,camera->maxs,end,camera,MASK_SOLID);
|
||||
back = gi.trace(camera->s.origin, camera->mins, camera->maxs, end, camera, MASK_SOLID);
|
||||
VectorSubtract(back.endpos,camera->s.origin,end);
|
||||
dist = VectorLength(end);
|
||||
VectorCopy(tr.endpos,end);
|
||||
VectorCopy (tr.endpos ,end);
|
||||
}
|
||||
else
|
||||
{
|
||||
VectorSubtract(tr.endpos,camera->s.origin,end);
|
||||
VectorSubtract (tr.endpos, camera->s.origin, end);
|
||||
dist = VectorLength(end) - 8;
|
||||
VectorMA(camera->s.origin,dist,forward,end);
|
||||
VectorMA (camera->s.origin, dist, forward, end);
|
||||
}
|
||||
if (dist > 8)
|
||||
{
|
||||
|
@ -3337,13 +3337,13 @@ void ClientSpycam(edict_t *ent)
|
|||
{
|
||||
// jump
|
||||
if (client->ucmd.forwardmove > 300)
|
||||
VectorScale(forward,400,camera->velocity);
|
||||
VectorScale (forward, 400, camera->velocity);
|
||||
else if (client->ucmd.forwardmove > 199)
|
||||
VectorScale(forward,200,camera->velocity);
|
||||
VectorScale (forward, 200, camera->velocity);
|
||||
else if (client->ucmd.forwardmove < -300)
|
||||
VectorScale(forward,-400,camera->velocity);
|
||||
VectorScale (forward, -400, camera->velocity);
|
||||
else if (client->ucmd.forwardmove < -199)
|
||||
VectorScale(forward,-200,camera->velocity);
|
||||
VectorScale (forward, -200, camera->velocity);
|
||||
camera->velocity[2] = 250;
|
||||
camera->monsterinfo.savemove = camera->monsterinfo.currentmove;
|
||||
actor_jump(camera);
|
||||
|
@ -3424,15 +3424,15 @@ void ClientSpycam(edict_t *ent)
|
|||
{
|
||||
vec3_t angles;
|
||||
vec3_t end, f;
|
||||
VectorSet(angles,0,camera->ideal_yaw,0);
|
||||
AngleVectors(angles,f,NULL,NULL);
|
||||
VectorMA(camera->s.origin, WORLD_SIZE, f, end); // was 8192
|
||||
tr = gi.trace(camera->s.origin,camera->mins,camera->maxs,end,camera,MASK_SOLID);
|
||||
VectorCopy(tr.endpos,camera->vehicle->s.origin);
|
||||
camera->vehicle->touch_debounce_time = level.time + 5.0;
|
||||
VectorSet (angles, 0, camera->ideal_yaw, 0);
|
||||
AngleVectors (angles, f, NULL, NULL);
|
||||
VectorMA (camera->s.origin, WORLD_SIZE, f, end); // was 8192
|
||||
tr = gi.trace(camera->s.origin, camera->mins, camera->maxs, end, camera, MASK_SOLID);
|
||||
VectorCopy (tr.endpos, camera->vehicle->s.origin);
|
||||
camera->vehicle->touch_debounce_time = level.time + 5.0f;
|
||||
gi.linkentity(camera->vehicle);
|
||||
}
|
||||
ai_turn(camera,0.);
|
||||
ai_turn (camera, 0.0f);
|
||||
diff = SHORT2ANGLE(client->ucmd.angles[0]-client->old_owner_angles[0]);
|
||||
if (diff < -180)
|
||||
diff += 360;
|
||||
|
@ -3444,18 +3444,21 @@ void ClientSpycam(edict_t *ent)
|
|||
}
|
||||
}
|
||||
}
|
||||
if ( client->ucmd.buttons & BUTTON_ATTACK && camera->sounds >= 0 )
|
||||
if ( (client->ucmd.buttons & BUTTON_ATTACK) && (camera->sounds >= 0) )
|
||||
{
|
||||
// Knightmare- stop firing weapon when switching to turret
|
||||
client->latched_buttons &= ~BUTTONS_ATTACK;
|
||||
client->buttons &= ~BUTTONS_ATTACK;
|
||||
if (level.time >= camera->monsterinfo.attack_finished)
|
||||
{
|
||||
client->latched_buttons &= ~BUTTON_ATTACK;
|
||||
if (!Q_stricmp(camera->classname,"turret_breach") || !Q_stricmp(camera->classname,"model_turret"))
|
||||
// client->latched_buttons &= ~BUTTONS_ATTACK;
|
||||
if ( !Q_stricmp(camera->classname, "turret_breach") || !Q_stricmp(camera->classname, "model_turret") )
|
||||
{
|
||||
if ( (camera->sounds == 5) || (camera->sounds == 6) )
|
||||
camera->monsterinfo.attack_finished = level.time;
|
||||
else
|
||||
camera->monsterinfo.attack_finished = level.time + 1.0;
|
||||
turret_breach_fire(camera);
|
||||
turret_breach_fire (camera);
|
||||
}
|
||||
else if (is_actor)
|
||||
{
|
||||
|
@ -3471,11 +3474,11 @@ void ClientSpycam(edict_t *ent)
|
|||
// Currently following "thing" - turn that off
|
||||
camera->monsterinfo.aiflags &= ~AI_CHASE_THING;
|
||||
camera->movetarget = camera->goalentity = NULL;
|
||||
G_FreeEdict(camera->vehicle);
|
||||
G_FreeEdict (camera->vehicle);
|
||||
camera->vehicle = NULL;
|
||||
}
|
||||
camera->enemy = target;
|
||||
actor_fire(camera);
|
||||
actor_fire (camera);
|
||||
camera->enemy = NULL;
|
||||
if (camera->monsterinfo.aiflags & AI_HOLD_FRAME)
|
||||
camera->monsterinfo.attack_finished = level.time + FRAMETIME;
|
||||
|
@ -3486,16 +3489,20 @@ void ClientSpycam(edict_t *ent)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (client->zoomed)
|
||||
{
|
||||
camera->touch_debounce_time =
|
||||
max(camera->touch_debounce_time, level.time + 1.0);
|
||||
// Knightmare- stop firing weapon when switching to spycam
|
||||
else if ( (client->ucmd.buttons & BUTTON_ATTACK) && (camera->sounds < 0) ) {
|
||||
client->latched_buttons &= ~BUTTONS_ATTACK;
|
||||
client->buttons &= ~BUTTONS_ATTACK;
|
||||
}
|
||||
|
||||
if (client->zoomed) {
|
||||
camera->touch_debounce_time = max(camera->touch_debounce_time, level.time + 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
VectorMA(camera->s.origin, camera->move_origin[0],forward,start);
|
||||
VectorMA(start, -camera->move_origin[1],left, start);
|
||||
VectorMA(start, camera->move_origin[2],up, start);
|
||||
VectorMA (camera->s.origin, camera->move_origin[0], forward, start);
|
||||
VectorMA (start, -camera->move_origin[1], left, start);
|
||||
VectorMA (start, camera->move_origin[2], up, start);
|
||||
|
||||
tr = gi.trace(camera->s.origin, NULL, NULL, start, camera, MASK_SOLID);
|
||||
if (tr.fraction < 1.0)
|
||||
|
@ -3505,8 +3512,8 @@ void ClientSpycam(edict_t *ent)
|
|||
if (dist < 0) dist = 0.;
|
||||
VectorMA(camera->s.origin,dist,dir,start);
|
||||
}
|
||||
VectorCopy(start,ent->s.origin);
|
||||
VectorCopy(camera->velocity,ent->velocity);
|
||||
VectorCopy (start, ent->s.origin);
|
||||
VectorCopy (camera->velocity, ent->velocity);
|
||||
|
||||
client->resp.cmd_angles[0] = SHORT2ANGLE(client->ucmd.angles[0]);
|
||||
client->resp.cmd_angles[1] = SHORT2ANGLE(client->ucmd.angles[1]);
|
||||
|
|
|
@ -406,12 +406,12 @@ void Cmd_Help_f (edict_t *ent)
|
|||
|
||||
void WhatIsIt (edict_t *ent)
|
||||
{
|
||||
float range;
|
||||
int i, num;
|
||||
edict_t *touch[MAX_EDICTS];
|
||||
edict_t *who, *best;
|
||||
trace_t tr;
|
||||
vec3_t dir, end, entp, forward, mins, maxs, start, viewp;
|
||||
float range;
|
||||
int i, num;
|
||||
static edict_t *touch[MAX_EDICTS]; // Knightmare- made static due to stack size
|
||||
edict_t *who, *best;
|
||||
trace_t tr;
|
||||
vec3_t dir, end, entp, forward, mins, maxs, start, viewp;
|
||||
|
||||
/* Check for looking directly at a player or other non-trigger entity */
|
||||
VectorCopy(ent->s.origin, start);
|
||||
|
|
|
@ -1027,9 +1027,9 @@ varargs versions of all text functions.
|
|||
FIXME: make this buffer size safe someday
|
||||
============
|
||||
*/
|
||||
char *va(char *format, ...)
|
||||
char *va (char *format, ...)
|
||||
{
|
||||
va_list argptr;
|
||||
va_list argptr;
|
||||
static char string[1024];
|
||||
|
||||
va_start (argptr, format);
|
||||
|
@ -1202,9 +1202,10 @@ int Q_strcasecmp (char *s1, char *s2)
|
|||
}
|
||||
|
||||
|
||||
static char bigbuffer[0x10000]; // Knightmare- moved here to avoid any potential stack issues
|
||||
void Com_sprintf (char *dest, size_t size, char *fmt, ...)
|
||||
{
|
||||
char bigbuffer[0x10000];
|
||||
// char bigbuffer[0x10000];
|
||||
int len;
|
||||
va_list argptr;
|
||||
|
||||
|
|
208
qcommon/qfiles.h
208
qcommon/qfiles.h
|
@ -651,211 +651,3 @@ typedef struct
|
|||
#define MAX_WORLD_COORD (65536)
|
||||
#define WORLD_SIZE (MAX_WORLD_COORD - MIN_WORLD_COORD)
|
||||
*/
|
||||
|
||||
|
||||
// Knightmare- new, enhanced Q2 BSP format
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
BSP42 file format
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
// Knightmare- new BSP version to tell other engines not to load these maps
|
||||
#define KMQUAKE2_BSPVERSION 42
|
||||
|
||||
// upper design bounds
|
||||
#define BSP42_MAX_MAP_MODELS 8192
|
||||
#define BSP42_MAX_MAP_BRUSHES 262144
|
||||
#define BSP42_MAX_MAP_ENTITIES 65536
|
||||
#define BSP42_MAX_MAP_ENTSTRING 0x800000
|
||||
#define BSP42_MAX_MAP_TEXINFO 262144
|
||||
|
||||
#define BSP42_MAX_MAP_AREAS 4096 // 256
|
||||
#define BSP42_MAX_MAP_AREAPORTALS 16384 // 1024
|
||||
#define BSP42_MAX_MAP_FOGS 4096
|
||||
#define BSP42_MAX_MAP_PLANES 2097152
|
||||
#define BSP42_MAX_MAP_NODES 2097152
|
||||
#define BSP42_MAX_MAP_BRUSHSIDES 2097152
|
||||
#define BSP42_MAX_MAP_LEAFS 2097152
|
||||
#define BSP42_MAX_MAP_VERTS 2097152
|
||||
#define BSP42_MAX_MAP_FACES 2097152
|
||||
#define BSP42_MAX_MAP_LEAFFACES 2097152
|
||||
#define BSP42_MAX_MAP_LEAFBRUSHES 2097152
|
||||
#define BSP42_MAX_MAP_PORTALS 2097152
|
||||
#define BSP42_MAX_MAP_EDGES 0x400000
|
||||
#define BSP42_MAX_MAP_SURFEDGES 0x800000
|
||||
#define BSP42_MAX_MAP_LIGHTING 0x8000000
|
||||
#define BSP42_MAX_MAP_LIGHTGRID 0x8000000
|
||||
#define BSP42_MAX_MAP_VISIBILITY 0x2000000
|
||||
|
||||
#define BSP42_MIN_WORLD_COORD (-131072)
|
||||
#define BSP42_MAX_WORLD_COORD (131072)
|
||||
#define BSP42_WORLD_SIZE (MAX_WORLD_COORD - MIN_WORLD_COORD)
|
||||
|
||||
//=============================================================================
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int fileofs, filelen;
|
||||
} bsp42_lump_t;
|
||||
|
||||
#define BSP42_LUMP_ENTITIES 0
|
||||
#define BSP42_LUMP_PLANES 1
|
||||
#define BSP42_LUMP_VERTEXES 2
|
||||
#define BSP42_LUMP_VISIBILITY 3
|
||||
#define BSP42_LUMP_NODES 4
|
||||
#define BSP42_LUMP_TEXINFO 5
|
||||
#define BSP42_LUMP_FACES 6
|
||||
#define BSP42_LUMP_LIGHTING 7
|
||||
#define BSP42_LUMP_LEAFS 8
|
||||
#define BSP42_LUMP_LEAFFACES 9
|
||||
#define BSP42_LUMP_LEAFBRUSHES 10
|
||||
#define BSP42_LUMP_EDGES 11
|
||||
#define BSP42_LUMP_SURFEDGES 12
|
||||
#define BSP42_LUMP_MODELS 13
|
||||
#define BSP42_LUMP_BRUSHES 14
|
||||
#define BSP42_LUMP_BRUSHSIDES 15
|
||||
#define BSP42_LUMP_POP 16
|
||||
#define BSP42_LUMP_AREAS 17
|
||||
#define BSP42_LUMP_AREAPORTALS 18
|
||||
#define BSP42_LUMP_PLANEPOLYS 19
|
||||
#define BSP42_LUMP_LIGHTGRID 20
|
||||
#define BSP42_LUMP_FOGS 21
|
||||
#define BSP42_HEADER_LUMPS 22
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int ident;
|
||||
int version;
|
||||
lump_t lumps[BSP42_HEADER_LUMPS];
|
||||
} bsp42_dheader_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float mins[3], maxs[3];
|
||||
float origin[3]; // for sounds or lights
|
||||
int headnode;
|
||||
int firstface, numfaces; // submodels just draw faces
|
||||
// without walking the bsp tree
|
||||
} bsp42_dmodel_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
float xyz[3];
|
||||
byte color[4]; // for vertex lighting and terrain
|
||||
} bsp42_dvertex_t;
|
||||
|
||||
// planes (x&~1) and (x&~1)+1 are always opposites
|
||||
typedef struct
|
||||
{
|
||||
float normal[3];
|
||||
float dist;
|
||||
int type; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate
|
||||
} bsp42_dplane_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int planenum;
|
||||
int children[2]; // negative numbers are -(leafs+1), not nodes
|
||||
int mins[3]; // for frustom culling
|
||||
int maxs[3];
|
||||
unsigned int firstface;
|
||||
unsigned int numfaces; // counting both sides
|
||||
} bsp42_dnode_t;
|
||||
|
||||
typedef struct bsp42_texinfo_s
|
||||
{
|
||||
float vecs[2][4]; // [s/t][xyz offset]
|
||||
int flags; // miptex flags + overrides
|
||||
int value; // light emission, etc
|
||||
vec3_t color; // face color (light, fog, etc.), from Daikatana's BSP format
|
||||
char texture[MAX_QPATH]; // texture name (textures/*.wal)
|
||||
int nexttexinfo; // for animations, -1 = end of chain
|
||||
} bsp42_texinfo_t;
|
||||
|
||||
// note that edge 0 is never used, because negative edge nums are used for
|
||||
// counterclockwise use of the edge in a face
|
||||
typedef struct
|
||||
{
|
||||
unsigned int v[2]; // vertex numbers
|
||||
} bsp42_dedge_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int planenum;
|
||||
int side;
|
||||
|
||||
int firstedge;
|
||||
int numedges;
|
||||
int texinfo;
|
||||
|
||||
// lighting info
|
||||
byte styles[MAXLIGHTMAPS];
|
||||
int lightofs; // start of [numstyles*surfsize] samples
|
||||
} bsp42_dface_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int contents; // OR of all brushes (not needed?)
|
||||
|
||||
int cluster;
|
||||
int area;
|
||||
|
||||
int mins[3]; // for frustum culling
|
||||
int maxs[3];
|
||||
|
||||
unsigned int firstleafface;
|
||||
unsigned int numleaffaces;
|
||||
|
||||
unsigned int firstleafbrush;
|
||||
unsigned int numleafbrushes;
|
||||
|
||||
int brushnum; // from Daikatana's BSP format
|
||||
} bsp42_dleaf_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int planenum; // facing out of the leaf
|
||||
int texinfo;
|
||||
} bsp42_dbrushside_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int firstside;
|
||||
int numsides;
|
||||
int contents;
|
||||
} bsp42_dbrush_t;
|
||||
|
||||
// Knightmare added (ripped from the Q3 tools source)
|
||||
typedef struct
|
||||
{
|
||||
char shader[MAX_QPATH];
|
||||
int brushNum;
|
||||
int visibleSide; // the brush side that ray tests need to clip against (-1 == none)
|
||||
} bsp42_dfog_t;
|
||||
|
||||
// the visibility lump consists of a header with a count, then
|
||||
// byte offsets for the PVS and PHS of each cluster, then the raw
|
||||
// compressed bit vectors
|
||||
typedef struct
|
||||
{
|
||||
int numclusters;
|
||||
int bitofs[8][2]; // bitofs[numclusters][2]
|
||||
} bsp42_dvis_t;
|
||||
|
||||
// each area has a list of portals that lead into other areas
|
||||
// when portals are closed, other areas may not be visible or
|
||||
// hearable even if the vis info says that it should be
|
||||
typedef struct
|
||||
{
|
||||
int portalnum;
|
||||
int otherarea;
|
||||
} bsp42_dareaportal_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int numareaportals;
|
||||
int firstareaportal;
|
||||
} bsp42_darea_t;
|
||||
|
|
|
@ -435,11 +435,12 @@ SV_PointContents
|
|||
*/
|
||||
int SV_PointContents (vec3_t p)
|
||||
{
|
||||
edict_t *touch[MAX_EDICTS], *hit;
|
||||
int i, num;
|
||||
int contents, c2;
|
||||
int headnode;
|
||||
float *angles;
|
||||
static edict_t *touch[MAX_EDICTS]; // Knightmare- made static due to stack size
|
||||
edict_t *hit;
|
||||
int i, num;
|
||||
int contents, c2;
|
||||
int headnode;
|
||||
float *angles;
|
||||
|
||||
// get base contents from world
|
||||
contents = CM_PointContents (p, sv.models[1]->headnode);
|
||||
|
@ -521,14 +522,14 @@ SV_ClipMoveToEntities
|
|||
*/
|
||||
void SV_ClipMoveToEntities ( moveclip_t *clip )
|
||||
{
|
||||
int i, num;
|
||||
edict_t *touchlist[MAX_EDICTS], *touch;
|
||||
trace_t trace;
|
||||
int headnode;
|
||||
float *angles;
|
||||
int i, num;
|
||||
static edict_t *touchlist[MAX_EDICTS]; // Knightmare- made static due to stack size
|
||||
edict_t *touch;
|
||||
trace_t trace;
|
||||
int headnode;
|
||||
float *angles;
|
||||
|
||||
num = SV_AreaEdicts (clip->boxmins, clip->boxmaxs, touchlist
|
||||
, MAX_EDICTS, AREA_SOLID);
|
||||
num = SV_AreaEdicts (clip->boxmins, clip->boxmaxs, touchlist, MAX_EDICTS, AREA_SOLID);
|
||||
|
||||
// be careful, it is possible to have an entity in this
|
||||
// list removed before we get to it (killtriggered)
|
||||
|
|
Loading…
Reference in a new issue