Remove unused variables

src/g_chase.c:10:9: warning: variable ‘oldgoal’ set but not used [-Wunused-but-set-variable]
src/g_crane.c:118:9: warning: variable ‘origin’ set but not used [-Wunused-but-set-variable]
src/g_crane.c:380:11: warning: variable ‘save’ set but not used [-Wunused-but-set-variable]
src/g_func.c:101:15: warning: variable ‘sr’ set but not used [-Wunused-but-set-variable]
src/g_func.c:101:11: warning: variable ‘cr’ set but not used [-Wunused-but-set-variable]
src/g_func.c:836:11: warning: variable ‘save’ set but not used [-Wunused-but-set-variable]
src/g_func.c:1942:11: warning: variable ‘save’ set but not used [-Wunused-but-set-variable]
src/g_func.c:2488:11: warning: variable ‘save’ set but not used [-Wunused-but-set-variable]
src/g_func.c:3487:11: warning: variable ‘save’ set but not used [-Wunused-but-set-variable]
src/g_func.c:3642:10: warning: variable ‘oldorg’ set but not used [-Wunused-but-set-variable]
src/g_func.c:3790:9: warning: variable ‘origin’ set but not used [-Wunused-but-set-variable]
src/g_misc.c:1251:9: warning: variable ‘save’ set but not used [-Wunused-but-set-variable]
src/g_newai.c:36:11: warning: variable ‘playerVisible’ set but not used [-Wunused-but-set-variable]
src/g_newai.c:482:28: warning: variable ‘count3’ set but not used [-Wunused-but-set-variable]
src/g_newai.c:481:8: warning: variable ‘field’ set but not used [-Wunused-but-set-variable]
src/g_newai.c:928:11: warning: variable ‘errors’ set but not used [-Wunused-but-set-variable]
src/g_phys.c:35:10: warning: variable ‘fall_time’ set but not used [-Wunused-but-set-variable]
src/g_phys.c:891:16: warning: variable ‘maxs’ set but not used [-Wunused-but-set-variable]
src/g_phys.c:891:10: warning: variable ‘mins’ set but not used [-Wunused-but-set-variable]
src/g_trigger.c:1423:12: warning: variable ‘what’ set but not used [-Wunused-but-set-variable]
src/g_trigger.c:1402:10: warning: variable ‘tr’ set but not used [-Wunused-but-set-variable]
src/g_tracktrain.c:1014:11: warning: variable ‘save’ set but not used [-Wunused-but-set-variable]
src/m_boss2.c:566:11: warning: variable ‘enemy_infront’ set but not used [-Wunused-but-set-variable]
src/m_boss32.c:596:8: warning: variable ‘range’ set but not used [-Wunused-but-set-variable]
src/m_boss32.c:738:11: warning: variable ‘enemy_infront’ set but not used [-Wunused-but-set-variable]
src/m_boss31.c:548:8: warning: variable ‘range’ set but not used [-Wunused-but-set-variable]
src/m_boss31.c:613:11: warning: variable ‘enemy_infront’ set but not used [-Wunused-but-set-variable]
src/p_hud.c:157:7: warning: variable ‘picnum’ set but not used [-Wunused-but-set-variable]
This commit is contained in:
Denis Pauk 2021-01-30 18:44:41 +02:00
parent 52e8de3cb5
commit 701b470ded
12 changed files with 267 additions and 339 deletions

View file

@ -7,7 +7,6 @@ void UpdateChaseCam(edict_t *ent)
vec3_t forward, right; vec3_t forward, right;
trace_t trace; trace_t trace;
int i; int i;
vec3_t oldgoal;
vec3_t angles; vec3_t angles;
// is our chase target gone? // is our chase target gone?
@ -25,7 +24,6 @@ void UpdateChaseCam(edict_t *ent)
targ = ent->client->chase_target; targ = ent->client->chase_target;
VectorCopy(targ->s.origin, ownerv); VectorCopy(targ->s.origin, ownerv);
VectorCopy(ent->s.origin, oldgoal);
ownerv[2] += targ->viewheight; ownerv[2] += targ->viewheight;

View file

@ -115,9 +115,6 @@ void Cargo_Stop (edict_t *ent)
void cargo_blocked (edict_t *cargo, edict_t *obstacle ) void cargo_blocked (edict_t *cargo, edict_t *obstacle )
{ {
vec3_t origin;
VectorAdd(obstacle->s.origin,obstacle->origin_offset,origin);
cargo->gravity = 1.0; cargo->gravity = 1.0;
cargo->movetype = MOVETYPE_PUSHABLE; cargo->movetype = MOVETYPE_PUSHABLE;
cargo->velocity[2] = 0; cargo->velocity[2] = 0;
@ -377,8 +374,6 @@ void Crane_blocked (edict_t *self, edict_t *other)
if (other) if (other)
{ {
// Lazarus: Some of our ents don't have origin near the model // Lazarus: Some of our ents don't have origin near the model
vec3_t save;
VectorCopy(other->s.origin,save);
VectorMA (other->absmin, 0.5, other->size, other->s.origin); VectorMA (other->absmin, 0.5, other->size, other->s.origin);
BecomeExplosion1 (other); BecomeExplosion1 (other);
} }
@ -413,7 +408,7 @@ void Crane_Move_Final (edict_t *ent)
return; return;
} }
} }
if (ent->moveinfo.remaining_distance == 0) if (ent->moveinfo.remaining_distance == 0)
{ {
Crane_Move_Done (ent); Crane_Move_Done (ent);
@ -631,7 +626,7 @@ void G_FindCraneParts()
// moving to play // moving to play
if(hook->speaker) if(hook->speaker)
hook->speaker->spawnflags = 1 - (control->spawnflags & 1); hook->speaker->spawnflags = 1 - (control->spawnflags & 1);
// Get offset from hook origin to hoist origin, so we can // Get offset from hook origin to hoist origin, so we can
// correct timing problems // correct timing problems
VectorSubtract(hook->s.origin,hoist->s.origin,hook->offset); VectorSubtract(hook->s.origin,hoist->s.origin,hook->offset);
@ -1116,7 +1111,7 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point)
beam->absmin[dir]; beam->absmin[dir];
cable->crane_control = control; cable->crane_control = control;
memcpy(&cable->moveinfo,&beam->moveinfo,sizeof(moveinfo_t)); memcpy(&cable->moveinfo,&beam->moveinfo,sizeof(moveinfo_t));
if(beam->crane_onboard_control) if(beam->crane_onboard_control)
{ {
beam->crane_onboard_control->crane_dir = dir; beam->crane_onboard_control->crane_dir = dir;
@ -1317,7 +1312,7 @@ void crane_control_action(edict_t *control, edict_t *activator, vec3_t point)
} }
void Use_Crane_Control (edict_t *ent, edict_t *other, edict_t *activator) void Use_Crane_Control (edict_t *ent, edict_t *other, edict_t *activator)
{ {
ent->spawnflags ^= 1; ent->spawnflags ^= 1;
if(ent->crane_hook->speaker) if(ent->crane_hook->speaker)
ent->crane_hook->speaker->spawnflags = 1 - (ent->spawnflags & 1); ent->crane_hook->speaker->spawnflags = 1 - (ent->spawnflags & 1);
@ -1523,7 +1518,7 @@ void crane_reset_use (edict_t *self, edict_t *other, edict_t *activator)
edict_t *crane; edict_t *crane;
edict_t *control, *beam, *cable, *cargo, *hoist, *hook; edict_t *control, *beam, *cable, *cargo, *hoist, *hook;
vec3_t bonk, v1, v2; vec3_t bonk, v1, v2;
crane = G_Find (NULL, FOFS(targetname), self->target); crane = G_Find (NULL, FOFS(targetname), self->target);
if(!crane) if(!crane)
@ -1542,7 +1537,7 @@ void crane_reset_use (edict_t *self, edict_t *other, edict_t *activator)
gi.centerprintf(activator,"No power\n"); gi.centerprintf(activator,"No power\n");
return; return;
} }
beam = control->crane_beam; beam = control->crane_beam;
hoist = control->crane_hoist; hoist = control->crane_hoist;
hook = control->crane_hook; hook = control->crane_hook;
@ -1650,7 +1645,7 @@ void crane_reset_use (edict_t *self, edict_t *other, edict_t *activator)
cable->crane_bonk = beam->crane_bonk + cable->absmin[dir] - beam->absmin[dir]; cable->crane_bonk = beam->crane_bonk + cable->absmin[dir] - beam->absmin[dir];
cable->crane_control = control; cable->crane_control = control;
memcpy(&cable->moveinfo,&beam->moveinfo,sizeof(moveinfo_t)); memcpy(&cable->moveinfo,&beam->moveinfo,sizeof(moveinfo_t));
if(beam->crane_onboard_control) if(beam->crane_onboard_control)
{ {
beam->crane_onboard_control->crane_dir = dir; beam->crane_onboard_control->crane_dir = dir;

View file

@ -98,12 +98,9 @@ restart:
if (self->turn_rider) { if (self->turn_rider) {
// Match angular velocities // Match angular velocities
if (!Q_stricmp(e->classname,"func_rotating")) { if (!Q_stricmp(e->classname,"func_rotating")) {
float cr, sr;
float cy, sy; float cy, sy;
cy = cos((e->s.angles[1]-delta_angles[1])*M_PI/180); cy = cos((e->s.angles[1]-delta_angles[1])*M_PI/180);
sy = sin((e->s.angles[1]-delta_angles[1])*M_PI/180); sy = sin((e->s.angles[1]-delta_angles[1])*M_PI/180);
cr = cos((e->s.angles[2]-delta_angles[2])*M_PI/180);
sr = sin((e->s.angles[2]-delta_angles[2])*M_PI/180);
if (e->movedir[0] > 0) { if (e->movedir[0] > 0) {
e->s.angles[1] = delta_angles[1]; e->s.angles[1] = delta_angles[1];
} else if (e->movedir[1] > 0) { } else if (e->movedir[1] > 0) {
@ -229,7 +226,7 @@ restart:
} }
} }
// FMOD // FMOD
if (!Q_stricmp(e->classname,"target_playback")) if (!Q_stricmp(e->classname,"target_playback"))
FMOD_UpdateSpeakerPos(e); FMOD_UpdateSpeakerPos(e);
@ -320,7 +317,7 @@ void train_spline (edict_t *self)
return; return;
if ( (train->from != train->to) && !train->moveinfo.is_blocked && (train->spawnflags & TRAIN_START_ON)) if ( (train->from != train->to) && !train->moveinfo.is_blocked && (train->spawnflags & TRAIN_START_ON))
{ {
spline_calc (train, train->from->s.origin, train->to->s.origin, spline_calc (train, train->from->s.origin, train->to->s.origin,
train->from->s.angles, train->to->s.angles, train->from->s.angles, train->to->s.angles,
train->moveinfo.ratio, p, a); train->moveinfo.ratio, p, a);
VectorSubtract(p,train->mins,p); VectorSubtract(p,train->mins,p);
@ -598,10 +595,10 @@ void AngleMove_Begin (edict_t *ent)
VectorSubtract (ent->moveinfo.end_angles, ent->s.angles, destdelta); VectorSubtract (ent->moveinfo.end_angles, ent->s.angles, destdelta);
else else
VectorSubtract (ent->moveinfo.start_angles, ent->s.angles, destdelta); VectorSubtract (ent->moveinfo.start_angles, ent->s.angles, destdelta);
// calculate length of vector // calculate length of vector
len = VectorLength (destdelta); len = VectorLength (destdelta);
// divide by speed to get time to reach dest // divide by speed to get time to reach dest
traveltime = len / ent->moveinfo.speed; traveltime = len / ent->moveinfo.speed;
@ -833,8 +830,6 @@ void plat_blocked (edict_t *self, edict_t *other)
if (other) if (other)
{ {
// Lazarus: Some of our ents don't have origin near the model // Lazarus: Some of our ents don't have origin near the model
vec3_t save;
VectorCopy(other->s.origin,save);
VectorMA (other->absmin, 0.5, other->size, other->s.origin); VectorMA (other->absmin, 0.5, other->size, other->s.origin);
BecomeExplosion1 (other); BecomeExplosion1 (other);
} }
@ -851,7 +846,7 @@ void plat_blocked (edict_t *self, edict_t *other)
void Use_Plat (edict_t *ent, edict_t *other, edict_t *activator) void Use_Plat (edict_t *ent, edict_t *other, edict_t *activator)
{ {
if (ent->think) if (ent->think)
return; // already down return; // already down
plat_go_down (ent); plat_go_down (ent);
@ -862,7 +857,7 @@ void Touch_Plat_Center (edict_t *ent, edict_t *other, cplane_t *plane, csurface_
{ {
if (!other->client) if (!other->client)
return; return;
if (other->health <= 0) if (other->health <= 0)
return; return;
@ -880,13 +875,13 @@ void plat_spawn_inside_trigger (edict_t *ent)
// //
// middle trigger // middle trigger
// //
trigger = G_Spawn(); trigger = G_Spawn();
trigger->touch = Touch_Plat_Center; trigger->touch = Touch_Plat_Center;
trigger->movetype = MOVETYPE_NONE; trigger->movetype = MOVETYPE_NONE;
trigger->solid = SOLID_TRIGGER; trigger->solid = SOLID_TRIGGER;
trigger->enemy = ent; trigger->enemy = ent;
tmin[0] = ent->mins[0] + 25; tmin[0] = ent->mins[0] + 25;
tmin[1] = ent->mins[1] + 25; tmin[1] = ent->mins[1] + 25;
tmin[2] = ent->mins[2]; tmin[2] = ent->mins[2];
@ -899,7 +894,7 @@ void plat_spawn_inside_trigger (edict_t *ent)
if (ent->spawnflags & PLAT_LOW_TRIGGER) if (ent->spawnflags & PLAT_LOW_TRIGGER)
tmax[2] = tmin[2] + 8; tmax[2] = tmin[2] + 8;
if (tmax[0] - tmin[0] <= 0) if (tmax[0] - tmin[0] <= 0)
{ {
tmin[0] = (ent->mins[0] + ent->maxs[0]) *0.5; tmin[0] = (ent->mins[0] + ent->maxs[0]) *0.5;
@ -910,7 +905,7 @@ void plat_spawn_inside_trigger (edict_t *ent)
tmin[1] = (ent->mins[1] + ent->maxs[1]) *0.5; tmin[1] = (ent->mins[1] + ent->maxs[1]) *0.5;
tmax[1] = tmin[1] + 1; tmax[1] = tmin[1] + 1;
} }
VectorCopy (tmin, trigger->mins); VectorCopy (tmin, trigger->mins);
VectorCopy (tmax, trigger->maxs); VectorCopy (tmax, trigger->maxs);
@ -942,7 +937,7 @@ Set "sounds" to one of the following:
void SP_func_plat (edict_t *ent) void SP_func_plat (edict_t *ent)
{ {
char soundname[64]; //CW char soundname[64]; //CW
VectorClear (ent->s.angles); VectorClear (ent->s.angles);
ent->solid = SOLID_BSP; ent->solid = SOLID_BSP;
ent->movetype = MOVETYPE_PUSH; ent->movetype = MOVETYPE_PUSH;
@ -981,7 +976,7 @@ void SP_func_plat (edict_t *ent)
ent->pos2[2] -= (ent->maxs[2] - ent->mins[2]) - st.lip; ent->pos2[2] -= (ent->maxs[2] - ent->mins[2]) - st.lip;
ent->use = Use_Plat; ent->use = Use_Plat;
plat_spawn_inside_trigger (ent); // the "start moving" trigger plat_spawn_inside_trigger (ent); // the "start moving" trigger
if (ent->targetname) if (ent->targetname)
{ {
@ -1074,7 +1069,7 @@ void rotating_blocked (edict_t *self, edict_t *other)
{ {
/* // Lazarus: This was added to do damage to pickup items, but may break /* // Lazarus: This was added to do damage to pickup items, but may break
// existing maps. // existing maps.
if (!(other->svflags & SVF_MONSTER) && (!other->client) ) { if (!(other->svflags & SVF_MONSTER) && (!other->client) ) {
// give it a chance to go away on it's own terms (like gibs) // give it a chance to go away on it's own terms (like gibs)
T_Damage (other, self, self, vec3_origin, other->s.origin, vec3_origin, 100000, 1, 0, MOD_CRUSH); T_Damage (other, self, self, vec3_origin, other->s.origin, vec3_origin, 100000, 1, 0, MOD_CRUSH);
@ -1377,7 +1372,7 @@ void SP_func_button (edict_t *ent)
if (ent->sounds != 1) if (ent->sounds != 1)
ent->moveinfo.sound_start = gi.soundindex ("switches/butn2.wav"); ent->moveinfo.sound_start = gi.soundindex ("switches/butn2.wav");
if (!ent->speed) if (!ent->speed)
ent->speed = 40; ent->speed = 40;
if (!ent->accel) if (!ent->accel)
@ -1427,7 +1422,7 @@ void SP_func_button (edict_t *ent)
//==================================================================== //====================================================================
// //
// SP_func_trainbutton is a button linked to a func_train with the // SP_func_trainbutton is a button linked to a func_train with the
// "movewith" key. The button itself does NOT move relative to the // "movewith" key. The button itself does NOT move relative to the
// train, but the effect can be simulated with animations and sounds // train, but the effect can be simulated with animations and sounds
// //
// Spawnflags 1 = can be activated by looking at it and pressing +attack // Spawnflags 1 = can be activated by looking at it and pressing +attack
@ -1714,7 +1709,7 @@ void door_go_down (edict_t *self)
self->takedamage = DAMAGE_YES; self->takedamage = DAMAGE_YES;
self->health = self->max_health; self->health = self->max_health;
} }
if (strcmp(self->classname, "func_door") == 0) { if (strcmp(self->classname, "func_door") == 0) {
if (self->movewith) if (self->movewith)
movewith_update(self); movewith_update(self);
@ -1745,7 +1740,7 @@ void door_go_up (edict_t *self, edict_t *activator)
if ((self->flags & FL_REVERSIBLE) && activator) if ((self->flags & FL_REVERSIBLE) && activator)
check_reverse_rotation(self,activator->s.origin); check_reverse_rotation(self,activator->s.origin);
if (!(self->flags & FL_TEAMSLAVE)) if (!(self->flags & FL_TEAMSLAVE))
{ {
if (self->moveinfo.sound_start) if (self->moveinfo.sound_start)
gi.sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_start, 1, ATTN_STATIC, 0); gi.sound (self, CHAN_NO_PHS_ADD+CHAN_VOICE, self->moveinfo.sound_start, 1, ATTN_STATIC, 0);
@ -1800,7 +1795,7 @@ void door_use (edict_t *self, edict_t *other, edict_t *activator)
return; return;
} }
} }
// trigger all paired doors // trigger all paired doors
for (ent = self ; ent ; ent = ent->teamchain) for (ent = self ; ent ; ent = ent->teamchain)
{ {
@ -1939,8 +1934,6 @@ void door_blocked (edict_t *self, edict_t *other)
if (other) if (other)
{ {
// Lazarus: Some of our ents don't have origin near the model // Lazarus: Some of our ents don't have origin near the model
vec3_t save;
VectorCopy(other->s.origin,save);
VectorMA (other->absmin, 0.5, other->size, other->s.origin); VectorMA (other->absmin, 0.5, other->size, other->s.origin);
BecomeExplosion1(other); BecomeExplosion1(other);
} }
@ -2034,7 +2027,7 @@ void SP_func_door (edict_t *ent)
{ {
vec3_t abs_movedir; vec3_t abs_movedir;
char soundname[64]; //CW char soundname[64]; //CW
//CW++ Setup customisable sounds. //CW++ Setup customisable sounds.
if (ent->sounds > 0) if (ent->sounds > 0)
{ {
@ -2054,7 +2047,7 @@ void SP_func_door (edict_t *ent)
ent->blocked = door_blocked; ent->blocked = door_blocked;
ent->use = door_use; ent->use = door_use;
if (!ent->speed) if (!ent->speed)
ent->speed = 100; ent->speed = 100;
if (deathmatch->value) if (deathmatch->value)
@ -2110,7 +2103,7 @@ void SP_func_door (edict_t *ent)
gi.soundindex ("misc/talk.wav"); gi.soundindex ("misc/talk.wav");
ent->touch = door_touch; ent->touch = door_touch;
} }
ent->moveinfo.speed = ent->speed; ent->moveinfo.speed = ent->speed;
ent->moveinfo.accel = ent->accel; ent->moveinfo.accel = ent->accel;
ent->moveinfo.decel = ent->decel; ent->moveinfo.decel = ent->decel;
@ -2281,7 +2274,7 @@ void SP_func_door_rotating (edict_t *ent)
ent->die = door_killed; ent->die = door_killed;
ent->max_health = ent->health; ent->max_health = ent->health;
} }
if (ent->targetname && ent->message) if (ent->targetname && ent->message)
{ {
gi.soundindex ("misc/talk.wav"); gi.soundindex ("misc/talk.wav");
@ -2485,8 +2478,6 @@ void train_blocked (edict_t *self, edict_t *other)
if (other) if (other)
{ {
// Lazarus: Some of our ents don't have origin near the model // Lazarus: Some of our ents don't have origin near the model
vec3_t save;
VectorCopy(other->s.origin,save);
VectorMA (other->absmin, 0.5, other->size, other->s.origin); VectorMA (other->absmin, 0.5, other->size, other->s.origin);
BecomeExplosion1 (other); BecomeExplosion1 (other);
} }
@ -2566,7 +2557,7 @@ void train_wait (edict_t *self)
{ {
train_next (self); train_next (self);
self->spawnflags &= ~TRAIN_START_ON; self->spawnflags &= ~TRAIN_START_ON;
VectorClear (self->velocity); VectorClear (self->velocity);
// Lazarus: turn off animation for stationary trains // Lazarus: turn off animation for stationary trains
self->s.effects &= ~(EF_ANIM_ALL | EF_ANIM_ALLFAST); self->s.effects &= ~(EF_ANIM_ALL | EF_ANIM_ALLFAST);
self->nextthink = 0; self->nextthink = 0;
@ -2583,7 +2574,7 @@ void train_wait (edict_t *self)
{ {
train_next (self); train_next (self);
} }
} }
// Rroff's rotating train stuff, with quite a few changes // Rroff's rotating train stuff, with quite a few changes
@ -2655,30 +2646,30 @@ void train_yaw (edict_t *self)
if (self->enemy->movewith_next && (self->enemy->movewith_next->movewith_ent == self->enemy)) if (self->enemy->movewith_next && (self->enemy->movewith_next->movewith_ent == self->enemy))
set_child_movement(self->enemy); set_child_movement(self->enemy);
return; return;
} }
if (cur_yaw != idl_yaw) { if (cur_yaw != idl_yaw) {
if (cur_yaw < idl_yaw) if (cur_yaw < idl_yaw)
{ {
Dist_1 = (idl_yaw - cur_yaw)*10; Dist_1 = (idl_yaw - cur_yaw)*10;
Dist_2 = ((360 - idl_yaw) + cur_yaw)*10; Dist_2 = ((360 - idl_yaw) + cur_yaw)*10;
if (Dist_1 < Dist_2) if (Dist_1 < Dist_2)
{ {
Distance = Dist_1; Distance = Dist_1;
if (Distance < yaw_vel) if (Distance < yaw_vel)
yaw_vel = Distance; yaw_vel = Distance;
self->enemy->avelocity[YAW] = yaw_vel; self->enemy->avelocity[YAW] = yaw_vel;
} }
else else
{ {
Distance = Dist_2; Distance = Dist_2;
if (Distance < yaw_vel) if (Distance < yaw_vel)
yaw_vel = Distance; yaw_vel = Distance;
self->enemy->avelocity[YAW] = -yaw_vel; self->enemy->avelocity[YAW] = -yaw_vel;
} }
} }
@ -2686,32 +2677,32 @@ void train_yaw (edict_t *self)
{ {
Dist_1 = (cur_yaw - idl_yaw)*10; Dist_1 = (cur_yaw - idl_yaw)*10;
Dist_2 = ((360 - cur_yaw) + idl_yaw)*10; Dist_2 = ((360 - cur_yaw) + idl_yaw)*10;
if (Dist_1 < Dist_2) if (Dist_1 < Dist_2)
{ {
Distance = Dist_1; Distance = Dist_1;
if (Distance < yaw_vel) if (Distance < yaw_vel)
yaw_vel = Distance; yaw_vel = Distance;
self->enemy->avelocity[YAW] = -yaw_vel; self->enemy->avelocity[YAW] = -yaw_vel;
} }
else else
{ {
Distance = Dist_2; Distance = Dist_2;
if (Distance < yaw_vel) if (Distance < yaw_vel)
yaw_vel = Distance; yaw_vel = Distance;
self->enemy->avelocity[YAW] = yaw_vel; self->enemy->avelocity[YAW] = yaw_vel;
} }
} }
// gi.dprintf ("train cy: %g iy: %g ys: %g\n", cur_yaw, idl_yaw, self->enemy->avelocity[1]); // gi.dprintf ("train cy: %g iy: %g ys: %g\n", cur_yaw, idl_yaw, self->enemy->avelocity[1]);
if (self->enemy->s.angles[YAW] < 0) if (self->enemy->s.angles[YAW] < 0)
self->enemy->s.angles[YAW] += 360; self->enemy->s.angles[YAW] += 360;
if (self->enemy->s.angles[YAW] >= 360) if (self->enemy->s.angles[YAW] >= 360)
self->enemy->s.angles[YAW] -= 360; self->enemy->s.angles[YAW] -= 360;
} }
@ -2722,23 +2713,23 @@ void train_yaw (edict_t *self)
{ {
Dist_1 = (idl_pitch - cur_pitch)*10; Dist_1 = (idl_pitch - cur_pitch)*10;
Dist_2 = ((360 - idl_pitch) + cur_pitch)*10; Dist_2 = ((360 - idl_pitch) + cur_pitch)*10;
if (Dist_1 < Dist_2) if (Dist_1 < Dist_2)
{ {
Distance = Dist_1; Distance = Dist_1;
if (Distance < pitch_vel) if (Distance < pitch_vel)
pitch_vel = Distance; pitch_vel = Distance;
self->enemy->avelocity[PITCH] = pitch_vel; self->enemy->avelocity[PITCH] = pitch_vel;
} }
else else
{ {
Distance = Dist_2; Distance = Dist_2;
if (Distance < pitch_vel) if (Distance < pitch_vel)
pitch_vel = Distance; pitch_vel = Distance;
self->enemy->avelocity[PITCH] = -pitch_vel; self->enemy->avelocity[PITCH] = -pitch_vel;
} }
} }
@ -2746,30 +2737,30 @@ void train_yaw (edict_t *self)
{ {
Dist_1 = (cur_pitch - idl_pitch)*10; Dist_1 = (cur_pitch - idl_pitch)*10;
Dist_2 = ((360 - cur_pitch) + idl_pitch)*10; Dist_2 = ((360 - cur_pitch) + idl_pitch)*10;
if (Dist_1 < Dist_2) if (Dist_1 < Dist_2)
{ {
Distance = Dist_1; Distance = Dist_1;
if (Distance < pitch_vel) if (Distance < pitch_vel)
pitch_vel = Distance; pitch_vel = Distance;
self->enemy->avelocity[PITCH] = -pitch_vel; self->enemy->avelocity[PITCH] = -pitch_vel;
} }
else else
{ {
Distance = Dist_2; Distance = Dist_2;
if (Distance < pitch_vel) if (Distance < pitch_vel)
pitch_vel = Distance; pitch_vel = Distance;
self->enemy->avelocity[PITCH] = pitch_vel; self->enemy->avelocity[PITCH] = pitch_vel;
} }
} }
if (self->enemy->s.angles[PITCH] < 0) if (self->enemy->s.angles[PITCH] < 0)
self->enemy->s.angles[PITCH] += 360; self->enemy->s.angles[PITCH] += 360;
if (self->enemy->s.angles[PITCH] >= 360) if (self->enemy->s.angles[PITCH] >= 360)
self->enemy->s.angles[PITCH] -= 360; self->enemy->s.angles[PITCH] -= 360;
} }
@ -2779,23 +2770,23 @@ void train_yaw (edict_t *self)
{ {
Dist_1 = (idl_roll - cur_roll)*10; Dist_1 = (idl_roll - cur_roll)*10;
Dist_2 = ((360 - idl_roll) + cur_roll)*10; Dist_2 = ((360 - idl_roll) + cur_roll)*10;
if (Dist_1 < Dist_2) if (Dist_1 < Dist_2)
{ {
Distance = Dist_1; Distance = Dist_1;
if (Distance < roll_vel) if (Distance < roll_vel)
roll_vel = Distance; roll_vel = Distance;
self->enemy->avelocity[ROLL] = roll_vel; self->enemy->avelocity[ROLL] = roll_vel;
} }
else else
{ {
Distance = Dist_2; Distance = Dist_2;
if (Distance < roll_vel) if (Distance < roll_vel)
roll_vel = Distance; roll_vel = Distance;
self->enemy->avelocity[ROLL] = -roll_vel; self->enemy->avelocity[ROLL] = -roll_vel;
} }
} }
@ -2803,30 +2794,30 @@ void train_yaw (edict_t *self)
{ {
Dist_1 = (cur_roll - idl_roll)*10; Dist_1 = (cur_roll - idl_roll)*10;
Dist_2 = ((360 - cur_roll) + idl_roll)*10; Dist_2 = ((360 - cur_roll) + idl_roll)*10;
if (Dist_1 < Dist_2) if (Dist_1 < Dist_2)
{ {
Distance = Dist_1; Distance = Dist_1;
if (Distance < roll_vel) if (Distance < roll_vel)
roll_vel = Distance; roll_vel = Distance;
self->enemy->avelocity[ROLL] = -roll_vel; self->enemy->avelocity[ROLL] = -roll_vel;
} }
else else
{ {
Distance = Dist_2; Distance = Dist_2;
if (Distance < roll_vel) if (Distance < roll_vel)
roll_vel = Distance; roll_vel = Distance;
self->enemy->avelocity[ROLL] = roll_vel; self->enemy->avelocity[ROLL] = roll_vel;
} }
} }
if (self->enemy->s.angles[ROLL] < 0) if (self->enemy->s.angles[ROLL] < 0)
self->enemy->s.angles[ROLL] += 360; self->enemy->s.angles[ROLL] += 360;
if (self->enemy->s.angles[ROLL] >= 360) if (self->enemy->s.angles[ROLL] >= 360)
self->enemy->s.angles[ROLL] -= 360; self->enemy->s.angles[ROLL] -= 360;
} }
@ -3484,8 +3475,6 @@ void door_secret_blocked (edict_t *self, edict_t *other)
if (other) if (other)
{ {
// Lazarus: Some of our ents don't have origin near the model // Lazarus: Some of our ents don't have origin near the model
vec3_t save;
VectorCopy(other->s.origin,save);
VectorMA (other->absmin, 0.5, other->size, other->s.origin); VectorMA (other->absmin, 0.5, other->size, other->s.origin);
BecomeExplosion1 (other); BecomeExplosion1 (other);
} }
@ -3566,7 +3555,7 @@ void SP_func_door_secret (edict_t *ent)
gi.soundindex ("misc/talk.wav"); gi.soundindex ("misc/talk.wav");
ent->touch = door_touch; ent->touch = door_touch;
} }
ent->classname = "func_door"; ent->classname = "func_door";
gi.linkentity (ent); gi.linkentity (ent);
@ -3605,7 +3594,7 @@ void SP_func_killbox (edict_t *ent)
// 2) Can be pushed off a ledge and damaged by falling // 2) Can be pushed off a ledge and damaged by falling
// 3) Default dmg = 0 (no fireball) and health = 0 (indestructible) // 3) Default dmg = 0 (no fireball) and health = 0 (indestructible)
// 4) Plays a sound when moving // 4) Plays a sound when moving
// //
// targetname - If triggered, pushable object self-destructs, throwing // targetname - If triggered, pushable object self-destructs, throwing
// debris chunks and (if dmg>0) exploding // debris chunks and (if dmg>0) exploding
// health - Damage sustained by object before it "dies". On death, // health - Damage sustained by object before it "dies". On death,
@ -3625,7 +3614,7 @@ void SP_func_killbox (edict_t *ent)
// 1 = tank/thud.wav // 1 = tank/thud.wav
// 2 = weapons/rg_hum.wav // 2 = weapons/rg_hum.wav
// 3 = weapons/rockfly.wav // 3 = weapons/rockfly.wav
// //
// SF=1 - Trigger spawn. Func_pushable is invisible and non-solid until triggered. // SF=1 - Trigger spawn. Func_pushable is invisible and non-solid until triggered.
// 2 - No knockback. Not moved by weapon fire (invulnerable func_pushables aren't // 2 - No knockback. Not moved by weapon fire (invulnerable func_pushables aren't
// affected by weapon fire in either case) // affected by weapon fire in either case)
@ -3639,15 +3628,14 @@ void SP_func_killbox (edict_t *ent)
// //
qboolean box_movestep (edict_t *ent, vec3_t move, qboolean relink) qboolean box_movestep (edict_t *ent, vec3_t move, qboolean relink)
{ {
vec3_t oldorg, neworg, end; vec3_t neworg, end;
trace_t trace; trace_t trace;
float stepsize; float stepsize;
vec3_t maxs, mins, origin; vec3_t maxs, mins, origin;
// try the move // try the move
VectorAdd (ent->s.origin, ent->origin_offset, origin); VectorAdd (ent->s.origin, ent->origin_offset, origin);
VectorCopy (origin, oldorg);
VectorAdd (origin, move, neworg); VectorAdd (origin, move, neworg);
VectorCopy (ent->size, maxs); VectorCopy (ent->size, maxs);
VectorScale (maxs, 0.5, maxs); VectorScale (maxs, 0.5, maxs);
@ -3735,12 +3723,12 @@ void box_use (edict_t *self, edict_t *other, edict_t *activator)
qboolean box_walkmove (edict_t *ent, float yaw, float dist) qboolean box_walkmove (edict_t *ent, float yaw, float dist)
{ {
vec3_t move; vec3_t move;
if (!ent->groundentity && !(ent->flags & (FL_FLY|FL_SWIM))) if (!ent->groundentity && !(ent->flags & (FL_FLY|FL_SWIM)))
return false; return false;
yaw = yaw*M_PI*2 / 360; yaw = yaw*M_PI*2 / 360;
move[0] = cos(yaw)*dist; move[0] = cos(yaw)*dist;
move[1] = sin(yaw)*dist; move[1] = sin(yaw)*dist;
move[2] = 0; move[2] = 0;
@ -3787,7 +3775,6 @@ void box_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf
float v11, v12, v21, v22; float v11, v12, v21, v22;
int axis; int axis;
vec3_t v1, v2, v; vec3_t v1, v2, v;
vec3_t origin;
edict_t *bottom, *top; edict_t *bottom, *top;
// if other is another func_pushable, AND self is in // if other is another func_pushable, AND self is in
@ -3818,13 +3805,13 @@ void box_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf
} }
if (self->waterlevel==0) return; if (self->waterlevel==0) return;
// 06/03/00 change: If either func_pushable is currently being moved // 06/03/00 change: If either func_pushable is currently being moved
// by crane, bail out. // by crane, bail out.
if (self->crane_control) return; if (self->crane_control) return;
if (other->crane_control) return; if (other->crane_control) return;
// Since func_pushables have a bounding box, impact will ALWAYS be on one of the // Since func_pushables have a bounding box, impact will ALWAYS be on one of the
// planes of the bounding box. The "plane" argument isn't always used, but since // planes of the bounding box. The "plane" argument isn't always used, but since
// all entities involved use a parallelepiped bounding box we can rely on offsets // all entities involved use a parallelepiped bounding box we can rely on offsets
// to centers to figure out which side the impact is on. // to centers to figure out which side the impact is on.
VectorAdd (self->absmax,self->absmin,v1); VectorAdd (self->absmax,self->absmin,v1);
@ -3846,8 +3833,8 @@ void box_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf
self->velocity[axis] = v12; self->velocity[axis] = v12;
other->velocity[axis] = v22; other->velocity[axis] = v22;
// Assuming frictionless surfaces, momentum of crate is conserved in // Assuming frictionless surfaces, momentum of crate is conserved in
// other two directions (so velocity doesn't change)... BUT we want // other two directions (so velocity doesn't change)... BUT we want
// to get the bottom crate out from underneath the other one, // to get the bottom crate out from underneath the other one,
// so we're gonna be a little "creative" // so we're gonna be a little "creative"
if (axis==2) { if (axis==2) {
@ -3891,7 +3878,6 @@ void box_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf
} }
// if other is a monster or a player and box is on other's head and moving down, // if other is a monster or a player and box is on other's head and moving down,
// do impact damage // do impact damage
VectorAdd(self->s.origin,self->origin_offset,origin);
if ( other->client || (other->svflags & SVF_MONSTER) ) if ( other->client || (other->svflags & SVF_MONSTER) )
{ {
VectorAdd (self->absmax,self->absmin,v1); VectorAdd (self->absmax,self->absmin,v1);
@ -3986,7 +3972,7 @@ void box_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf
// Give object a little nudge to give us some clearance // Give object a little nudge to give us some clearance
VectorSubtract (v1, other->s.origin, v); VectorSubtract (v1, other->s.origin, v);
box_walkmove (self, vectoyaw(v), 4); box_walkmove (self, vectoyaw(v), 4);
// Now get the offset from the player to the object, // Now get the offset from the player to the object,
// and preserve that offset in ClientThink by shifting // and preserve that offset in ClientThink by shifting
// object as needed. // object as needed.
VectorSubtract(other->s.origin,self->s.origin,self->offset); VectorSubtract(other->s.origin,self->s.origin,self->offset);
@ -4460,7 +4446,7 @@ void SP_func_force_wall(edict_t *ent)
if (!ent->speed) if (!ent->speed)
ent->speed = FRAMETIME; ent->speed = FRAMETIME;
//CW--- //CW---
// if (!ent->style) //CW: commented out to allow black particles // if (!ent->style) //CW: commented out to allow black particles
// ent->style = 208; // ent->style = 208;
@ -4519,7 +4505,7 @@ void swinging_door_killed (edict_t *self, edict_t *inflictor, edict_t *attacker,
return; return;
} }
} }
// trigger all paired doors // trigger all paired doors
for (ent = master ; ent ; ent = ent->teamchain) for (ent = master ; ent ; ent = ent->teamchain)
{ {
@ -4638,7 +4624,7 @@ void func_air_on(edict_t *self, edict_t *other, edict_t *activator)
} }
/*QUAKED func_air (0 .5 .8) ? StartOn /*QUAKED func_air (0 .5 .8) ? StartOn
Allows player to breathe when inside the trigger field, despite Allows player to breathe when inside the trigger field, despite
the environment they're currently in (eg. water). the environment they're currently in (eg. water).
If there is no targetname set, the trigger field is always active. If there is no targetname set, the trigger field is always active.
@ -4674,4 +4660,4 @@ void SP_func_air(edict_t *self)
self->touch = func_air_touch; self->touch = func_air_touch;
gi.linkentity(self); gi.linkentity(self);
} }
//CW--- //CW---

View file

@ -77,7 +77,7 @@ void VelocityForDamage (int damage, vec3_t v)
if (damage < 50) if (damage < 50)
VectorScale (v, 0.7, v); VectorScale (v, 0.7, v);
else else
VectorScale (v, 1.2, v); VectorScale (v, 1.2, v);
} }
@ -528,7 +528,7 @@ void path_corner_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface
if (other->movetarget != self) if (other->movetarget != self)
return; return;
if (other->enemy) if (other->enemy)
return; return;
@ -572,7 +572,7 @@ void path_corner_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface
} }
else else
{ {
if (!other->movetarget) if (!other->movetarget)
{ {
other->monsterinfo.pausetime = level.time + 100000000; other->monsterinfo.pausetime = level.time + 100000000;
@ -672,7 +672,7 @@ void point_combat_touch (edict_t *self, edict_t *other, cplane_t *plane, csurfac
else else
{ {
char *savetarget; char *savetarget;
savetarget = self->target; savetarget = self->target;
self->target = self->pathtarget; self->target = self->pathtarget;
if (other->enemy && other->enemy->client) if (other->enemy && other->enemy->client)
@ -1025,7 +1025,7 @@ void func_explosive_explode (edict_t *self)
if (!mass) if (!mass)
mass = 75; mass = 75;
// Lazarus: Use traditional debris for gib_type=0, but non-zero gib_type gives equal // Lazarus: Use traditional debris for gib_type=0, but non-zero gib_type gives equal
// weight to all models. // weight to all models.
if ( (self->gib_type > 0) && (self->gib_type < 10)) if ( (self->gib_type > 0) && (self->gib_type < 10))
@ -1079,7 +1079,7 @@ void func_explosive_explode (edict_t *self)
ThrowDebris (self, "models/objects/debris1/tris.md2", 1, chunkorigin, 0, 0); ThrowDebris (self, "models/objects/debris1/tris.md2", 1, chunkorigin, 0, 0);
} }
} }
// small chunks // small chunks
count = mass / 25; count = mass / 25;
if (count > 16) if (count > 16)
@ -1248,7 +1248,6 @@ void barrel_explode (edict_t *self)
{ {
vec3_t org; vec3_t org;
float spd; float spd;
vec3_t save;
vec3_t size; vec3_t size;
if (self->gib_type == GIB_BARREL) if (self->gib_type == GIB_BARREL)
@ -1256,7 +1255,6 @@ void barrel_explode (edict_t *self)
func_explosive_explode(self); func_explosive_explode(self);
return; return;
} }
VectorCopy (self->s.origin, save);
VectorMA (self->absmin, 0.5, self->size, self->s.origin); VectorMA (self->absmin, 0.5, self->size, self->s.origin);
T_RadiusDamage (self, self->activator, self->dmg, NULL, self->dmg+40, MOD_BARREL, -0.5); T_RadiusDamage (self, self->activator, self->dmg, NULL, self->dmg+40, MOD_BARREL, -0.5);
@ -1439,7 +1437,7 @@ void misc_blackhole_think (edict_t *self)
if (++self->s.frame < 19) if (++self->s.frame < 19)
self->nextthink = level.time + FRAMETIME; self->nextthink = level.time + FRAMETIME;
else else
{ {
self->s.frame = 0; self->s.frame = 0;
self->nextthink = level.time + FRAMETIME; self->nextthink = level.time + FRAMETIME;
} }
@ -1461,7 +1459,7 @@ void SP_misc_blackhole (edict_t *ent)
VectorSet (ent->maxs, 64, 64, 8); VectorSet (ent->maxs, 64, 64, 8);
ent->s.modelindex = gi.modelindex ("models/objects/black/tris.md2"); ent->s.modelindex = gi.modelindex ("models/objects/black/tris.md2");
// ent->s.renderfx = RF_TRANSLUCENT; // Lazarus: For some oddball reason if this is set // ent->s.renderfx = RF_TRANSLUCENT; // Lazarus: For some oddball reason if this is set
// here, blackhole generator will be // here, blackhole generator will be
// invisible. Rogue MP has the same problem. // invisible. Rogue MP has the same problem.
ent->use = misc_blackhole_use; ent->use = misc_blackhole_use;
ent->think = misc_blackhole_think; ent->think = misc_blackhole_think;
@ -1478,7 +1476,7 @@ void misc_eastertank_think (edict_t *self)
if (++self->s.frame < 293) if (++self->s.frame < 293)
self->nextthink = level.time + FRAMETIME; self->nextthink = level.time + FRAMETIME;
else else
{ {
self->s.frame = 254; self->s.frame = 254;
self->nextthink = level.time + FRAMETIME; self->nextthink = level.time + FRAMETIME;
} }
@ -1512,7 +1510,7 @@ void misc_easterchick_think (edict_t *self)
if (++self->s.frame < 247) if (++self->s.frame < 247)
self->nextthink = level.time + FRAMETIME; self->nextthink = level.time + FRAMETIME;
else else
{ {
self->s.frame = 208; self->s.frame = 208;
self->nextthink = level.time + FRAMETIME; self->nextthink = level.time + FRAMETIME;
} }
@ -1546,7 +1544,7 @@ void misc_easterchick2_think (edict_t *self)
if (++self->s.frame < 287) if (++self->s.frame < 287)
self->nextthink = level.time + FRAMETIME; self->nextthink = level.time + FRAMETIME;
else else
{ {
self->s.frame = 248; self->s.frame = 248;
self->nextthink = level.time + FRAMETIME; self->nextthink = level.time + FRAMETIME;
} }
@ -1836,7 +1834,7 @@ void SP_misc_viper (edict_t *ent)
} }
/*QUAKED misc_bigviper (1 .5 0) (-176 -120 -24) (176 120 72) /*QUAKED misc_bigviper (1 .5 0) (-176 -120 -24) (176 120 72)
This is a large stationary viper as seen in Paul's intro This is a large stationary viper as seen in Paul's intro
*/ */
void SP_misc_bigviper (edict_t *ent) void SP_misc_bigviper (edict_t *ent)
@ -1875,7 +1873,7 @@ void misc_viper_bomb_touch (edict_t *self, edict_t *other, cplane_t *plane, csur
if (level.num_reflectors) if (level.num_reflectors)
ReflectExplosion (TE_EXPLOSION2, self->s.origin); ReflectExplosion (TE_EXPLOSION2, self->s.origin);
self->svflags |= SVF_NOCLIENT; self->svflags |= SVF_NOCLIENT;
self->solid = SOLID_NOT; self->solid = SOLID_NOT;
self->use = misc_viper_bomb_use; self->use = misc_viper_bomb_use;
@ -2577,10 +2575,10 @@ void SP_func_clock_screen(edict_t *self)
base or splash effect base or splash effect
LANDMARK (=64) If set, player angles and speed are preserved LANDMARK (=64) If set, player angles and speed are preserved
misc_teleporter selects a random pick from up to 8 targets for a misc_teleporter selects a random pick from up to 8 targets for a
destination destination
trigger_transition with same name as teleporter can be used to trigger_transition with same name as teleporter can be used to
teleport multiple non-player entities teleport multiple non-player entities
================================================================== */ ================================================================== */
void teleport_transition_ents (edict_t *transition, edict_t *teleporter, edict_t *destination) void teleport_transition_ents (edict_t *transition, edict_t *teleporter, edict_t *destination)
@ -2635,7 +2633,7 @@ void teleport_transition_ents (edict_t *transition, edict_t *teleporter, edict_t
if (angles[YAW]) if (angles[YAW])
{ {
vec3_t spawn_offset; vec3_t spawn_offset;
VectorSubtract(ent->s.origin,start,spawn_offset); VectorSubtract(ent->s.origin,start,spawn_offset);
VectorCopy(spawn_offset,v); VectorCopy(spawn_offset,v);
G_ProjectSource (vec3_origin, v, forward, right, spawn_offset); G_ProjectSource (vec3_origin, v, forward, right, spawn_offset);
@ -2685,7 +2683,7 @@ void teleport_transition_ents (edict_t *transition, edict_t *teleporter, edict_t
if (angles[YAW]) if (angles[YAW])
{ {
vec3_t spawn_offset; vec3_t spawn_offset;
VectorSubtract(ent->s.origin,start,spawn_offset); VectorSubtract(ent->s.origin,start,spawn_offset);
VectorCopy(spawn_offset,v); VectorCopy(spawn_offset,v);
G_ProjectSource (vec3_origin, v, forward, right, spawn_offset); G_ProjectSource (vec3_origin, v, forward, right, spawn_offset);
@ -2703,7 +2701,7 @@ void teleport_transition_ents (edict_t *transition, edict_t *teleporter, edict_t
} }
} }
// G_PickDestination is identical to G_PickTarget, but w/o the // G_PickDestination is identical to G_PickTarget, but w/o the
// obnoxious error message. // obnoxious error message.
#define MAXCHOICES 8 #define MAXCHOICES 8
@ -2954,7 +2952,7 @@ void SP_misc_teleporter (edict_t *ent)
VectorSet (trig->mins, -8, -8, 8); VectorSet (trig->mins, -8, -8, 8);
VectorSet (trig->maxs, 8, 8, 24); VectorSet (trig->maxs, 8, 8, 24);
gi.linkentity (trig); gi.linkentity (trig);
} }
void trigger_teleporter_use (edict_t *self, edict_t *other, edict_t *activator) void trigger_teleporter_use (edict_t *self, edict_t *other, edict_t *activator)
@ -3124,7 +3122,7 @@ void fountain_animate(edict_t *self)
if (self->s.frame >= self->framenumbers) if (self->s.frame >= self->framenumbers)
self->s.frame = self->startframe; self->s.frame = self->startframe;
// Check if it's time to fade yet (self->wait would have been set in // Check if it's time to fade yet (self->wait would have been set in
// spawn_precipitation or drop_touch if so). // spawn_precipitation or drop_touch if so).
if (self->wait && (level.time >= self->wait)) if (self->wait && (level.time >= self->wait))
@ -3162,7 +3160,7 @@ void leaf_fade2(edict_t *self)
if (level.time >= self->wait) if (level.time >= self->wait)
self->wait = 0; //reset for next use with leaf_fade2 (remember, self->count is 1) self->wait = 0; //reset for next use with leaf_fade2 (remember, self->count is 1)
} }
//CW--- //CW---
} }
void leaf_fade(edict_t *self) void leaf_fade(edict_t *self)
@ -3191,8 +3189,8 @@ void leaf_fade(edict_t *self)
else else
self->think = leaf_fade; //reset from fountain_animate self->think = leaf_fade; //reset from fountain_animate
} }
//CW--- //CW---
gi.linkentity(self); gi.linkentity(self);
} }
@ -3364,7 +3362,7 @@ void target_precipitation_think (edict_t *self)
self->nextthink = level.time + FRAMETIME; self->nextthink = level.time + FRAMETIME;
// Don't start raining until player is in the game. The following // Don't start raining until player is in the game. The following
// takes care of both initial map load conditions and restored saved games. // takes care of both initial map load conditions and restored saved games.
// This is a gross abuse of groundentity_linkcount. Sue me. // This is a gross abuse of groundentity_linkcount. Sue me.
if (g_edicts[1].linkcount == self->groundentity_linkcount) if (g_edicts[1].linkcount == self->groundentity_linkcount)
@ -3405,9 +3403,9 @@ void target_precipitation_think (edict_t *self)
u = crandom() * (self->tright[0] - self->bleft[0])/2; u = crandom() * (self->tright[0] - self->bleft[0])/2;
v = crandom() * (self->tright[1] - self->bleft[1])/2; v = crandom() * (self->tright[1] - self->bleft[1])/2;
z = crandom() * (self->tright[2] - self->bleft[2])/2; z = crandom() * (self->tright[2] - self->bleft[2])/2;
VectorCopy(center, org); VectorCopy(center, org);
org[0] += u; org[0] += u;
org[1] += v; org[1] += v;
org[2] += z; org[2] += z;
@ -3508,7 +3506,7 @@ void SP_target_precipitation (edict_t *ent)
ent->spawnflags &= ~SF_WEATHER_SPLASH; ent->spawnflags &= ~SF_WEATHER_SPLASH;
ent->use = target_precipitation_use; ent->use = target_precipitation_use;
if (!ent->count) if (!ent->count)
ent->count = 1; ent->count = 1;
@ -3568,7 +3566,7 @@ void target_fountain_think (edict_t *self)
if (!(self->spawnflags & SF_WEATHER_FIRE_ONCE)) if (!(self->spawnflags & SF_WEATHER_FIRE_ONCE))
self->nextthink = level.time + FRAMETIME; self->nextthink = level.time + FRAMETIME;
// Don't start raining until player is in the game. The following // Don't start raining until player is in the game. The following
// takes care of both initial map load conditions and restored saved games. // takes care of both initial map load conditions and restored saved games.
// This is a gross abuse of groundentity_linkcount. Sue me. // This is a gross abuse of groundentity_linkcount. Sue me.
if (g_edicts[1].linkcount == self->groundentity_linkcount) if (g_edicts[1].linkcount == self->groundentity_linkcount)
@ -3611,9 +3609,9 @@ void target_fountain_think (edict_t *self)
u = crandom() * (self->tright[0] - self->bleft[0])/2; u = crandom() * (self->tright[0] - self->bleft[0])/2;
v = crandom() * (self->tright[1] - self->bleft[1])/2; v = crandom() * (self->tright[1] - self->bleft[1])/2;
z = crandom() * (self->tright[2] - self->bleft[2])/2; z = crandom() * (self->tright[2] - self->bleft[2])/2;
VectorCopy(center, org); VectorCopy(center, org);
org[0] += u; org[0] += u;
org[1] += v; org[1] += v;
org[2] += z; org[2] += z;
@ -3718,7 +3716,7 @@ void SP_target_fountain (edict_t *ent)
//CW--- //CW---
ent->use = target_fountain_use; ent->use = target_fountain_use;
if (!ent->count) if (!ent->count)
ent->count = 1; ent->count = 1;
@ -3812,7 +3810,7 @@ int PatchDeadSoldier ()
sprintf (infilename, "baseq2/%s", DEADSOLDIER_MODEL); sprintf (infilename, "baseq2/%s", DEADSOLDIER_MODEL);
if ( !(infile = fopen (infilename, "rb")) ) if ( !(infile = fopen (infilename, "rb")) )
{ {
// If file doesn't exist on user's hard disk, it must be in // If file doesn't exist on user's hard disk, it must be in
// pak0.pak // pak0.pak
pak_header_t pakheader; pak_header_t pakheader;
@ -3866,7 +3864,7 @@ int PatchDeadSoldier ()
else else
{ {
fread (&model, sizeof (dmdl_t), 1, infile); fread (&model, sizeof (dmdl_t), 1, infile);
datasize = model.ofs_end - model.ofs_skins; datasize = model.ofs_end - model.ofs_skins;
if ( !(data = malloc (datasize)) ) // make sure freed locally if ( !(data = malloc (datasize)) ) // make sure freed locally
{ {
@ -3874,13 +3872,13 @@ int PatchDeadSoldier ()
return 0; return 0;
} }
fread (data, sizeof (byte), datasize, infile); fread (data, sizeof (byte), datasize, infile);
fclose (infile); fclose (infile);
} }
// update model info // update model info
model.num_skins = NUM_SKINS; model.num_skins = NUM_SKINS;
// Already had 1 skin, so new offset doesn't include that one // Already had 1 skin, so new offset doesn't include that one
newoffset = (model.num_skins-1) * MAX_SKINNAME; newoffset = (model.num_skins-1) * MAX_SKINNAME;
model.ofs_st += newoffset; model.ofs_st += newoffset;
@ -3888,7 +3886,7 @@ int PatchDeadSoldier ()
model.ofs_frames += newoffset; model.ofs_frames += newoffset;
model.ofs_glcmds += newoffset; model.ofs_glcmds += newoffset;
model.ofs_end += newoffset; model.ofs_end += newoffset;
// save new model // save new model
sprintf (outfilename, "%s/models", gamedir->string); // make some dirs if needed sprintf (outfilename, "%s/models", gamedir->string); // make some dirs if needed
_mkdir (outfilename); _mkdir (outfilename);
@ -3902,7 +3900,7 @@ int PatchDeadSoldier ()
_mkdir (outfilename); _mkdir (outfilename);
sprintf (outfilename, "%s/%s", gamedir->string, DEADSOLDIER_MODEL); sprintf (outfilename, "%s/%s", gamedir->string, DEADSOLDIER_MODEL);
if ( !(outfile = fopen (outfilename, "wb")) ) if ( !(outfile = fopen (outfilename, "wb")) )
{ {
// file couldn't be created for some other reason // file couldn't be created for some other reason
@ -3910,12 +3908,12 @@ int PatchDeadSoldier ()
free (data); free (data);
return 0; return 0;
} }
fwrite (&model, sizeof (dmdl_t), 1, outfile); fwrite (&model, sizeof (dmdl_t), 1, outfile);
fwrite (skins, sizeof (char), model.num_skins*MAX_SKINNAME, outfile); fwrite (skins, sizeof (char), model.num_skins*MAX_SKINNAME, outfile);
data += MAX_SKINNAME; data += MAX_SKINNAME;
fwrite (data, sizeof (byte), datasize, outfile); fwrite (data, sizeof (byte), datasize, outfile);
fclose (outfile); fclose (outfile);
gi.dprintf ("PatchDeadSoldier: Saved %s\n", outfilename); gi.dprintf ("PatchDeadSoldier: Saved %s\n", outfilename);
free (data); free (data);

View file

@ -10,7 +10,7 @@
gi.WriteByte (TE_DEBUGTRAIL); gi.WriteByte (TE_DEBUGTRAIL);
gi.WritePosition (pt1); gi.WritePosition (pt1);
gi.WritePosition (pt2); gi.WritePosition (pt2);
gi.multicast (pt1, MULTICAST_PVS); gi.multicast (pt1, MULTICAST_PVS);
self->nextthink = level.time + 10; self->nextthink = level.time + 10;
*/ */
@ -33,8 +33,6 @@ qboolean parasite_drain_attack_ok (vec3_t start, vec3_t end);
// shotchance: 0-1, chance they'll take the shot if it's clear. // shotchance: 0-1, chance they'll take the shot if it's clear.
qboolean blocked_checkshot (edict_t *self, float shotChance) qboolean blocked_checkshot (edict_t *self, float shotChance)
{ {
qboolean playerVisible;
if(!self->enemy) if(!self->enemy)
return false; return false;
@ -73,16 +71,15 @@ qboolean blocked_checkshot (edict_t *self, float shotChance)
if (tr.ent != self->enemy) if (tr.ent != self->enemy)
{ {
self->monsterinfo.aiflags |= AI_BLOCKED; self->monsterinfo.aiflags |= AI_BLOCKED;
if(self->monsterinfo.attack) if(self->monsterinfo.attack)
self->monsterinfo.attack(self); self->monsterinfo.attack(self);
self->monsterinfo.aiflags &= ~AI_BLOCKED; self->monsterinfo.aiflags &= ~AI_BLOCKED;
return true; return true;
} }
} }
playerVisible = visible (self, self->enemy);
return false; return false;
} }
@ -149,7 +146,7 @@ qboolean blocked_checkplat (edict_t *self, float dist)
// if(g_showlogic && g_showlogic->value) // if(g_showlogic && g_showlogic->value)
// gi.dprintf("player above, and plat will raise. using!\n"); // gi.dprintf("player above, and plat will raise. using!\n");
plat->use (plat, self, self); plat->use (plat, self, self);
return true; return true;
} }
} }
else if(playerPosition == -1) else if(playerPosition == -1)
@ -478,8 +475,7 @@ qboolean monsterlost_checkhint (edict_t *self)
edict_t *closest; edict_t *closest;
float closest_range = 1000000; float closest_range = 1000000;
edict_t *start, *destination; edict_t *start, *destination;
int field; int count1=0, count2=0, count4=0, count5=0;
int count1=0, count2=0, count3=0, count4=0, count5=0;
float r; float r;
int i; int i;
qboolean hint_path_represented[MAX_HINT_CHAINS]; qboolean hint_path_represented[MAX_HINT_CHAINS];
@ -498,14 +494,12 @@ qboolean monsterlost_checkhint (edict_t *self)
if (self->monsterinfo.aiflags & AI_STAND_GROUND) if (self->monsterinfo.aiflags & AI_STAND_GROUND)
return false; return false;
if (!strcmp(self->classname, "monster_turret")) if (!strcmp(self->classname, "monster_turret"))
return false; return false;
monster_pathchain = NULL; monster_pathchain = NULL;
field = FOFS(classname);
// find all the hint_paths. // find all the hint_paths.
// FIXME - can we not do this every time? // FIXME - can we not do this every time?
for (i=0; i < num_hint_paths; i++) for (i=0; i < num_hint_paths; i++)
@ -529,7 +523,7 @@ qboolean monsterlost_checkhint (edict_t *self)
e = e->hint_chain; e = e->hint_chain;
} }
} }
// filter them by distance and visibility to the monster // filter them by distance and visibility to the monster
e = monster_pathchain; e = monster_pathchain;
checkpoint = NULL; checkpoint = NULL;
@ -617,7 +611,6 @@ qboolean monsterlost_checkhint (edict_t *self)
count1 = 0; count1 = 0;
count2 = 0; count2 = 0;
count3 = 0;
count4 = 0; count4 = 0;
count5 = 0; count5 = 0;
@ -705,14 +698,14 @@ qboolean monsterlost_checkhint (edict_t *self)
checkpoint = e; checkpoint = e;
e = e->target_hint_chain; e = e->target_hint_chain;
} }
// at this point we should have: // at this point we should have:
// monster_pathchain - a list of "monster valid" hint_path nodes linked together by monster_hint_chain // monster_pathchain - a list of "monster valid" hint_path nodes linked together by monster_hint_chain
// target_pathcain - a list of "target valid" hint_path nodes linked together by target_hint_chain. these // target_pathcain - a list of "target valid" hint_path nodes linked together by target_hint_chain. these
// are filtered such that only nodes which are on the same chain as "monster valid" nodes // are filtered such that only nodes which are on the same chain as "monster valid" nodes
// //
// Now, we figure out which "monster valid" node we want to use // Now, we figure out which "monster valid" node we want to use
// //
// To do this, we first off make sure we have some target nodes. If we don't, there are no valid hint_path nodes // To do this, we first off make sure we have some target nodes. If we don't, there are no valid hint_path nodes
// for us to take // for us to take
// //
@ -738,8 +731,8 @@ qboolean monsterlost_checkhint (edict_t *self)
hint_path_represented[e->hint_chain_id] = true; hint_path_represented[e->hint_chain_id] = true;
e = e->target_hint_chain; e = e->target_hint_chain;
} }
// traverse the monster_pathchain - if the hint_node isn't represented in the "target valid" chain list, // traverse the monster_pathchain - if the hint_node isn't represented in the "target valid" chain list,
// remove it // remove it
// if it is on the list, check it for range from the monster. If the range is the closest, keep it // if it is on the list, check it for range from the monster. If the range is the closest, keep it
// //
@ -788,7 +781,7 @@ qboolean monsterlost_checkhint (edict_t *self)
if (!closest) if (!closest)
return false; return false;
destination = closest; destination = closest;
self->monsterinfo.goal_hint = destination; self->monsterinfo.goal_hint = destination;
@ -810,7 +803,7 @@ void hint_path_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t
// int chain; // direction - (-1) = upstream, (1) = downstream, (0) = done // int chain; // direction - (-1) = upstream, (1) = downstream, (0) = done
qboolean goalFound = false; qboolean goalFound = false;
if(other->monsterinfo.aiflags & AI_MEDIC_PATROL) if(other->monsterinfo.aiflags & AI_MEDIC_PATROL)
{ {
if(other->movetarget == self) if(other->movetarget == self)
medic_NextPatrolPoint(other,self); medic_NextPatrolPoint(other,self);
@ -828,7 +821,7 @@ void hint_path_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t
if(other->movetarget == self) if(other->movetarget == self)
{ {
goal = other->monsterinfo.goal_hint; goal = other->monsterinfo.goal_hint;
// if the monster is where he wants to be // if the monster is where he wants to be
if (goal == self) if (goal == self)
{ {
@ -925,10 +918,9 @@ void InitHintPaths (void)
{ {
edict_t *e, *current; edict_t *e, *current;
int field, i, count2; int field, i, count2;
qboolean errors = false;
hint_paths_present = 0; hint_paths_present = 0;
// check all the hint_paths. // check all the hint_paths.
field = FOFS(classname); field = FOFS(classname);
e = G_Find(NULL, field, "hint_path"); e = G_Find(NULL, field, "hint_path");
@ -949,7 +941,6 @@ void InitHintPaths (void)
{ {
gi.dprintf ("Hint path at %s marked as endpoint with both target (%s) and targetname (%s)\n", gi.dprintf ("Hint path at %s marked as endpoint with both target (%s) and targetname (%s)\n",
vtos (e->s.origin), e->target, e->targetname); vtos (e->s.origin), e->target, e->targetname);
errors = true;
} }
else else
{ {
@ -974,22 +965,20 @@ void InitHintPaths (void)
e = G_Find(NULL, field, current->target); e = G_Find(NULL, field, current->target);
if (G_Find(e, field, current->target)) if (G_Find(e, field, current->target))
{ {
gi.dprintf ("\nForked hint path at %s detected for chain %d, target %s\n", gi.dprintf ("\nForked hint path at %s detected for chain %d, target %s\n",
vtos (current->s.origin), num_hint_paths, current->target); vtos (current->s.origin), num_hint_paths, current->target);
hint_path_start[i]->hint_chain = NULL; hint_path_start[i]->hint_chain = NULL;
count2 = 0; count2 = 0;
errors = true;
continue; continue;
} }
while (e) while (e)
{ {
if (e->hint_chain) if (e->hint_chain)
{ {
gi.dprintf ("\nCircular hint path at %s detected for chain %d, targetname %s\n", gi.dprintf ("\nCircular hint path at %s detected for chain %d, targetname %s\n",
vtos (e->s.origin), num_hint_paths, e->targetname); vtos (e->s.origin), num_hint_paths, e->targetname);
hint_path_start[i]->hint_chain = NULL; hint_path_start[i]->hint_chain = NULL;
count2 = 0; count2 = 0;
errors = true;
break; break;
} }
count2++; count2++;
@ -1001,7 +990,7 @@ void InitHintPaths (void)
e = G_Find(NULL, field, current->target); e = G_Find(NULL, field, current->target);
if (G_Find(e, field, current->target)) if (G_Find(e, field, current->target))
{ {
gi.dprintf ("\nForked hint path at %s detected for chain %d, target %s\n", gi.dprintf ("\nForked hint path at %s detected for chain %d, target %s\n",
vtos (current->s.origin), num_hint_paths, current->target); vtos (current->s.origin), num_hint_paths, current->target);
hint_path_start[i]->hint_chain = NULL; hint_path_start[i]->hint_chain = NULL;
count2 = 0; count2 = 0;
@ -1024,12 +1013,12 @@ qboolean inback (edict_t *self, edict_t *other)
vec3_t vec; vec3_t vec;
float dot; float dot;
vec3_t forward; vec3_t forward;
AngleVectors (self->s.angles, forward, NULL, NULL); AngleVectors (self->s.angles, forward, NULL, NULL);
VectorSubtract (other->s.origin, self->s.origin, vec); VectorSubtract (other->s.origin, self->s.origin, vec);
VectorNormalize (vec); VectorNormalize (vec);
dot = DotProduct (vec, forward); dot = DotProduct (vec, forward);
if (dot < -0.3) if (dot < -0.3)
return true; return true;
return false; return false;
@ -1038,7 +1027,7 @@ qboolean inback (edict_t *self, edict_t *other)
float realrange (edict_t *self, edict_t *other) float realrange (edict_t *self, edict_t *other)
{ {
vec3_t dir; vec3_t dir;
VectorSubtract (self->s.origin, other->s.origin, dir); VectorSubtract (self->s.origin, other->s.origin, dir);
return VectorLength(dir); return VectorLength(dir);
} }
@ -1069,7 +1058,7 @@ qboolean face_wall (edict_t *self)
// //
// Monster "Bad" Areas // Monster "Bad" Areas
// //
void badarea_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf) void badarea_touch (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf)
{ {
@ -1080,7 +1069,7 @@ edict_t *SpawnBadArea(vec3_t mins, vec3_t maxs, float lifespan, edict_t *owner)
{ {
edict_t *badarea; edict_t *badarea;
vec3_t origin; vec3_t origin;
VectorAdd(mins, maxs, origin); VectorAdd(mins, maxs, origin);
VectorScale(origin, 0.5, origin); VectorScale(origin, 0.5, origin);
@ -1139,7 +1128,7 @@ edict_t *CheckForBadArea(edict_t *ent)
return hit; return hit;
} }
} }
return NULL; return NULL;
} }
@ -1179,7 +1168,7 @@ void PredictAim (edict_t *target, vec3_t start, float bolt_speed, qboolean eye_h
VectorSubtract (vec, start, aimdir); VectorSubtract (vec, start, aimdir);
VectorNormalize (aimdir); VectorNormalize (aimdir);
} }
if (aimpoint) if (aimpoint)
{ {
VectorCopy (vec, aimpoint); VectorCopy (vec, aimpoint);
@ -1192,12 +1181,12 @@ qboolean below (edict_t *self, edict_t *other)
vec3_t vec; vec3_t vec;
float dot; float dot;
vec3_t down; vec3_t down;
VectorSubtract (other->s.origin, self->s.origin, vec); VectorSubtract (other->s.origin, self->s.origin, vec);
VectorNormalize (vec); VectorNormalize (vec);
VectorSet (down, 0, 0, -1); VectorSet (down, 0, 0, -1);
dot = DotProduct (vec, down); dot = DotProduct (vec, down);
if (dot > 0.95) // 18 degree arc below if (dot > 0.95) // 18 degree arc below
return true; return true;
return false; return false;
@ -1235,7 +1224,7 @@ void drawbbox (edict_t *self)
} }
} }
} }
for (i=0; i<= 3; i++) for (i=0; i<= 3; i++)
{ {
for (j=0; j<= 2; j++) for (j=0; j<= 2; j++)
@ -1244,7 +1233,7 @@ void drawbbox (edict_t *self)
gi.WriteByte (TE_DEBUGTRAIL); gi.WriteByte (TE_DEBUGTRAIL);
gi.WritePosition (pt[starts[i]]); gi.WritePosition (pt[starts[i]]);
gi.WritePosition (pt[lines[i][j]]); gi.WritePosition (pt[lines[i][j]]);
gi.multicast (pt[starts[i]], MULTICAST_ALL); gi.multicast (pt[starts[i]], MULTICAST_ALL);
} }
} }
@ -1256,7 +1245,7 @@ void drawbbox (edict_t *self)
gi.WriteByte (TE_DEBUGTRAIL); gi.WriteByte (TE_DEBUGTRAIL);
gi.WritePosition (self->s.origin); gi.WritePosition (self->s.origin);
gi.WritePosition (newbox); gi.WritePosition (newbox);
gi.multicast (self->s.origin, MULTICAST_PVS); gi.multicast (self->s.origin, MULTICAST_PVS);
VectorClear (newbox); VectorClear (newbox);
VectorMA (self->s.origin, 50, r, newbox); VectorMA (self->s.origin, 50, r, newbox);
@ -1264,7 +1253,7 @@ void drawbbox (edict_t *self)
gi.WriteByte (TE_DEBUGTRAIL); gi.WriteByte (TE_DEBUGTRAIL);
gi.WritePosition (self->s.origin); gi.WritePosition (self->s.origin);
gi.WritePosition (newbox); gi.WritePosition (newbox);
gi.multicast (self->s.origin, MULTICAST_PVS); gi.multicast (self->s.origin, MULTICAST_PVS);
VectorClear (newbox); VectorClear (newbox);
VectorMA (self->s.origin, 50, u, newbox); VectorMA (self->s.origin, 50, u, newbox);
@ -1272,7 +1261,7 @@ void drawbbox (edict_t *self)
gi.WriteByte (TE_DEBUGTRAIL); gi.WriteByte (TE_DEBUGTRAIL);
gi.WritePosition (self->s.origin); gi.WritePosition (self->s.origin);
gi.WritePosition (newbox); gi.WritePosition (newbox);
gi.multicast (self->s.origin, MULTICAST_PVS); gi.multicast (self->s.origin, MULTICAST_PVS);
VectorClear (newbox); VectorClear (newbox);
} }
@ -1333,7 +1322,7 @@ edict_t * PickCoopTarget (edict_t *self)
// get a number from 0 to (num_targets-1) // get a number from 0 to (num_targets-1)
targetID = (random() * (float)num_targets); targetID = (random() * (float)num_targets);
// just in case we got a 1.0 from random // just in case we got a 1.0 from random
if (targetID == num_targets) if (targetID == num_targets)
targetID--; targetID--;

View file

@ -10,7 +10,7 @@ edict_t *blocker;
pushmove objects do not obey gravity, and do not interact with each other or trigger fields, but block normal movement and push normal objects when they move. pushmove objects do not obey gravity, and do not interact with each other or trigger fields, but block normal movement and push normal objects when they move.
onground is set for toss objects when they come to a complete rest. it is set for steping or walking objects onground is set for toss objects when they come to a complete rest. it is set for steping or walking objects
doors, plats, etc are SOLID_BSP, and MOVETYPE_PUSH doors, plats, etc are SOLID_BSP, and MOVETYPE_PUSH
bonus items are SOLID_TRIGGER touch, and MOVETYPE_TOSS bonus items are SOLID_TRIGGER touch, and MOVETYPE_TOSS
@ -32,7 +32,7 @@ solid_edge items only clip against bsp models.
void other_FallingDamage (edict_t *ent) void other_FallingDamage (edict_t *ent)
{ {
float delta; float delta;
float fall_time, fall_value; float fall_value;
int damage; int damage;
vec3_t dir; vec3_t dir;
@ -69,8 +69,6 @@ void other_FallingDamage (edict_t *ent)
fall_value = delta * 0.5; fall_value = delta * 0.5;
if (fall_value > 40) fall_value = 40; if (fall_value > 40) fall_value = 40;
fall_time = level.time + FALL_TIME;
if (delta > MAX_SAFE_FALLDIST) //CW: reduced safe falling distance, and replaced hardcoded value if (delta > MAX_SAFE_FALLDIST) //CW: reduced safe falling distance, and replaced hardcoded value
{ {
ent->pain_debounce_time = level.time; // no normal pain sound ent->pain_debounce_time = level.time; // no normal pain sound
@ -128,7 +126,7 @@ edict_t *SV_TestEntityPosition (edict_t *ent)
else else
return world; return world;
} }
return NULL; return NULL;
} }
@ -180,7 +178,7 @@ qboolean SV_RunThink (edict_t *ent)
return true; return true;
if (thinktime > level.time + 0.001) if (thinktime > level.time + 0.001)
return true; return true;
ent->nextthink = 0; ent->nextthink = 0;
if (!ent->think) if (!ent->think)
gi.error ("NULL ent->think for %s",ent->classname); gi.error ("NULL ent->think for %s",ent->classname);
@ -205,7 +203,7 @@ void SV_Impact (edict_t *e1, trace_t *trace)
if (e1->touch && e1->solid != SOLID_NOT) if (e1->touch && e1->solid != SOLID_NOT)
e1->touch (e1, e2, &trace->plane, trace->surface); e1->touch (e1, e2, &trace->plane, trace->surface);
if (e2->touch && e2->solid != SOLID_NOT) if (e2->touch && e2->solid != SOLID_NOT)
e2->touch (e2, e1, NULL, NULL); e2->touch (e2, e1, NULL, NULL);
} }
@ -226,13 +224,13 @@ int ClipVelocity (vec3_t in, vec3_t normal, vec3_t out, float overbounce)
float backoff; float backoff;
float change; float change;
int i, blocked; int i, blocked;
blocked = 0; blocked = 0;
if (normal[2] > 0) if (normal[2] > 0)
blocked |= 1; // floor blocked |= 1; // floor
if (!normal[2]) if (!normal[2])
blocked |= 2; // step blocked |= 2; // step
backoff = DotProduct (in, normal) * overbounce; backoff = DotProduct (in, normal) * overbounce;
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
@ -276,12 +274,12 @@ int SV_FlyMove (edict_t *ent, float time, int mask)
retry: retry:
numbumps = 4; numbumps = 4;
blocked = 0; blocked = 0;
VectorCopy (ent->velocity, original_velocity); VectorCopy (ent->velocity, original_velocity);
VectorCopy (ent->velocity, primal_velocity); VectorCopy (ent->velocity, primal_velocity);
numplanes = 0; numplanes = 0;
time_left = time; time_left = time;
ent->groundentity = NULL; ent->groundentity = NULL;
@ -371,9 +369,9 @@ retry:
if (!ent->inuse) if (!ent->inuse)
break; // removed by the impact function break; // removed by the impact function
time_left -= time_left * trace.fraction; time_left -= time_left * trace.fraction;
// cliped to another plane // cliped to another plane
if (numplanes >= MAX_CLIP_PLANES) if (numplanes >= MAX_CLIP_PLANES)
{ // this shouldn't really happen { // this shouldn't really happen
@ -401,7 +399,7 @@ retry:
if (j == numplanes) if (j == numplanes)
break; break;
} }
if (i != numplanes) if (i != numplanes)
{ // go along this plane { // go along this plane
VectorCopy (new_velocity, ent->velocity); VectorCopy (new_velocity, ent->velocity);
@ -470,12 +468,12 @@ retry:
numbumps = 4; numbumps = 4;
ent->bounce_me = 0; ent->bounce_me = 0;
blocked = 0; blocked = 0;
VectorCopy (ent->velocity, original_velocity); VectorCopy (ent->velocity, original_velocity);
VectorCopy (ent->velocity, primal_velocity); VectorCopy (ent->velocity, primal_velocity);
numplanes = 0; numplanes = 0;
time_left = time; time_left = time;
VectorAdd(ent->s.origin,ent->origin_offset,origin); VectorAdd(ent->s.origin,ent->origin_offset,origin);
@ -622,7 +620,7 @@ retry:
if (j == numplanes) if (j == numplanes)
break; break;
} }
if (i != numplanes) if (i != numplanes)
{ // go along this plane { // go along this plane
VectorCopy (new_velocity, ent->velocity); VectorCopy (new_velocity, ent->velocity);
@ -706,7 +704,7 @@ trace_t SV_PushEntity (edict_t *ent, vec3_t push)
retry: retry:
trace = gi.trace (start, ent->mins, ent->maxs, end, ent, mask); trace = gi.trace (start, ent->mins, ent->maxs, end, ent, mask);
VectorCopy (trace.endpos, ent->s.origin); VectorCopy (trace.endpos, ent->s.origin);
gi.linkentity (ent); gi.linkentity (ent);
@ -754,7 +752,7 @@ retry:
G_TouchTriggers (ent); G_TouchTriggers (ent);
return trace; return trace;
} }
typedef struct typedef struct
@ -888,7 +886,6 @@ qboolean SV_Push (edict_t *pusher, vec3_t move, vec3_t amove)
{ {
int i, e; int i, e;
edict_t *check, *block; edict_t *check, *block;
vec3_t mins, maxs;
pushed_t *p; pushed_t *p;
vec3_t org, org2, org_check, forward, right, up; vec3_t org, org2, org_check, forward, right, up;
vec3_t move2={0,0,0}; vec3_t move2={0,0,0};
@ -910,13 +907,6 @@ qboolean SV_Push (edict_t *pusher, vec3_t move, vec3_t amove)
move[i] = 0.125 * (int)temp; move[i] = 0.125 * (int)temp;
} }
// find the bounding box
for (i=0 ; i<3 ; i++)
{
mins[i] = pusher->absmin[i] + move[i];
maxs[i] = pusher->absmax[i] + move[i];
}
// Lazarus: temp turn indicates whether riders // Lazarus: temp turn indicates whether riders
// should rotate with the pusher // should rotate with the pusher
if(pusher->turn_rider && turn_rider->value) if(pusher->turn_rider && turn_rider->value)
@ -1018,7 +1008,7 @@ qboolean SV_Push (edict_t *pusher, vec3_t move, vec3_t amove)
VectorCopy (check->s.angles, pushed_p->angles); VectorCopy (check->s.angles, pushed_p->angles);
pushed_p++; pushed_p++;
// try moving the contacted entity // try moving the contacted entity
VectorAdd (check->s.origin, move, check->s.origin); VectorAdd (check->s.origin, move, check->s.origin);
// Lazarus: if turn_rider is set, do it. We don't do this by default // Lazarus: if turn_rider is set, do it. We don't do this by default
// 'cause it can be a fairly drastic change in gameplay // 'cause it can be a fairly drastic change in gameplay
@ -1040,7 +1030,7 @@ qboolean SV_Push (edict_t *pusher, vec3_t move, vec3_t amove)
// PMF_NO_PREDICTION overrides .exe's client physics, which // PMF_NO_PREDICTION overrides .exe's client physics, which
// really doesn't like for us to change player angles. Note // really doesn't like for us to change player angles. Note
// that this isn't strictly necessary, since Lazarus 1.7 and // that this isn't strictly necessary, since Lazarus 1.7 and
// later automatically turn prediction off (in ClientThink) when // later automatically turn prediction off (in ClientThink) when
// player is riding a MOVETYPE_PUSH // player is riding a MOVETYPE_PUSH
check->client->ps.pmove.pm_flags |= PMF_NO_PREDICTION; check->client->ps.pmove.pm_flags |= PMF_NO_PREDICTION;
} }
@ -1081,7 +1071,7 @@ qboolean SV_Push (edict_t *pusher, vec3_t move, vec3_t amove)
tr = gi.trace(check->s.origin,vec3_origin,vec3_origin,org,check,MASK_SOLID); tr = gi.trace(check->s.origin,vec3_origin,vec3_origin,org,check,MASK_SOLID);
if(!tr.startsolid && tr.fraction < 1) if(!tr.startsolid && tr.fraction < 1)
check->s.origin[2] = tr.endpos[2] - check->mins[2] + fabs(tr.plane.normal[0])*check->size[0]/2 + fabs(tr.plane.normal[1])*check->size[1]/2; check->s.origin[2] = tr.endpos[2] - check->mins[2] + fabs(tr.plane.normal[0])*check->size[0]/2 + fabs(tr.plane.normal[1])*check->size[1]/2;
// Lazarus: func_tracktrain is a special case. Since we KNOW (if the map was // Lazarus: func_tracktrain is a special case. Since we KNOW (if the map was
// constructed properly) that "move_origin" is a safe position, we // constructed properly) that "move_origin" is a safe position, we
// can infer that there should be a safe (not embedded) position // can infer that there should be a safe (not embedded) position
@ -1089,7 +1079,7 @@ qboolean SV_Push (edict_t *pusher, vec3_t move, vec3_t amove)
if((pusher->flags & FL_TRACKTRAIN) && (check->client || (check->svflags & SVF_MONSTER))) if((pusher->flags & FL_TRACKTRAIN) && (check->client || (check->svflags & SVF_MONSTER)))
{ {
vec3_t f,l,u; vec3_t f,l,u;
AngleVectors(pusher->s.angles, f, l, u); AngleVectors(pusher->s.angles, f, l, u);
VectorScale(f,pusher->move_origin[0],f); VectorScale(f,pusher->move_origin[0],f);
VectorScale(l,-pusher->move_origin[1],l); VectorScale(l,-pusher->move_origin[1],l);
@ -1111,7 +1101,7 @@ qboolean SV_Push (edict_t *pusher, vec3_t move, vec3_t amove)
} }
} }
} }
// may have pushed them off an edge // may have pushed them off an edge
if (check->groundentity != pusher) if (check->groundentity != pusher)
check->groundentity = NULL; check->groundentity = NULL;
@ -1185,7 +1175,7 @@ qboolean SV_Push (edict_t *pusher, vec3_t move, vec3_t amove)
continue; continue;
} }
} }
// save off the obstacle so we can call the block function // save off the obstacle so we can call the block function
obstacle = check; obstacle = check;
@ -1353,7 +1343,7 @@ void SV_Physics_Noclip (edict_t *ent)
// regular thinking // regular thinking
if (!SV_RunThink (ent)) if (!SV_RunThink (ent))
return; return;
VectorMA (ent->s.angles, FRAMETIME, ent->avelocity, ent->s.angles); VectorMA (ent->s.angles, FRAMETIME, ent->avelocity, ent->s.angles);
VectorMA (ent->s.origin, FRAMETIME, ent->velocity, ent->s.origin); VectorMA (ent->s.origin, FRAMETIME, ent->velocity, ent->s.origin);
@ -1478,7 +1468,7 @@ void SV_Physics_Toss (edict_t *ent)
// stop if on ground // stop if on ground
if (trace.plane.normal[2] > 0.7) if (trace.plane.normal[2] > 0.7)
{ {
// if (ent->velocity[2] < 60 || ent->movetype != MOVETYPE_BOUNCE ) // if (ent->velocity[2] < 60 || ent->movetype != MOVETYPE_BOUNCE )
if (ent->velocity[2] < bounce_minv->value || (ent->movetype != MOVETYPE_BOUNCE) ) if (ent->velocity[2] < bounce_minv->value || (ent->movetype != MOVETYPE_BOUNCE) )
{ {
@ -1646,7 +1636,7 @@ void SV_Physics_Step (edict_t *ent)
ent->bob = min(2.0,300.0/ent->mass); ent->bob = min(2.0,300.0/ent->mass);
ent->duration = max(2.0,1.0 + ent->mass/100); ent->duration = max(2.0,1.0 + ent->mass/100);
// Figure out neutral bouyancy line for this entity // Figure out neutral bouyancy line for this entity
// This isn't entirely realistic, but helps gameplay: // This isn't entirely realistic, but helps gameplay:
// Arbitrary mass limit for func_pushable that can be pushed on // Arbitrary mass limit for func_pushable that can be pushed on
@ -1684,14 +1674,14 @@ void SV_Physics_Step (edict_t *ent)
} }
} }
} }
ground = ent->groundentity; ground = ent->groundentity;
SV_CheckVelocity (ent); SV_CheckVelocity (ent);
if (ground) if (ground)
wasonground = true; wasonground = true;
if (ent->avelocity[0] || ent->avelocity[1] || ent->avelocity[2]) if (ent->avelocity[0] || ent->avelocity[1] || ent->avelocity[2])
SV_AddRotationalFriction (ent); SV_AddRotationalFriction (ent);
@ -1721,7 +1711,7 @@ void SV_Physics_Step (edict_t *ent)
// friction for swimming monsters that have been given vertical velocity // friction for swimming monsters that have been given vertical velocity
if (ent->movetype != MOVETYPE_PUSHABLE) { if (ent->movetype != MOVETYPE_PUSHABLE) {
// Lazarus: This is id's swag at drag. It works mostly, but for submerged // Lazarus: This is id's swag at drag. It works mostly, but for submerged
// crates we can do better. // crates we can do better.
if ((ent->flags & FL_SWIM) && (ent->velocity[2] != 0)) { if ((ent->flags & FL_SWIM) && (ent->velocity[2] != 0)) {
speed = fabs(ent->velocity[2]); speed = fabs(ent->velocity[2]);
@ -1871,14 +1861,14 @@ void SV_Physics_Step (edict_t *ent)
speed = sqrt(vel[0]*vel[0] +vel[1]*vel[1]); speed = sqrt(vel[0]*vel[0] +vel[1]*vel[1]);
if (speed) { if (speed) {
friction = sv_friction; friction = sv_friction;
control = speed < sv_stopspeed ? sv_stopspeed : speed; control = speed < sv_stopspeed ? sv_stopspeed : speed;
newspeed = speed - FRAMETIME*control*friction; newspeed = speed - FRAMETIME*control*friction;
if (newspeed < 0) if (newspeed < 0)
newspeed = 0; newspeed = 0;
newspeed /= speed; newspeed /= speed;
vel[0] *= newspeed; vel[0] *= newspeed;
vel[1] *= newspeed; vel[1] *= newspeed;
} }
@ -2006,12 +1996,12 @@ int SV_VehicleMove (edict_t *ent, float time, int mask)
vec3_t origin; vec3_t origin;
numbumps = 4; numbumps = 4;
blocked = 0; blocked = 0;
VectorCopy (ent->velocity, original_velocity); VectorCopy (ent->velocity, original_velocity);
VectorCopy (ent->velocity, primal_velocity); VectorCopy (ent->velocity, primal_velocity);
numplanes = 0; numplanes = 0;
VectorCopy(ent->velocity,xy_velocity); VectorCopy(ent->velocity,xy_velocity);
xy_velocity[2] = 0; xy_velocity[2] = 0;
xy_speed = VectorLength(xy_velocity); xy_speed = VectorLength(xy_velocity);
@ -2045,7 +2035,7 @@ retry:
if (trace.allsolid) if (trace.allsolid)
{ {
// entity is trapped in another solid // entity is trapped in another solid
if(trace.ent && (trace.ent->svflags & SVF_MONSTER)) { if(trace.ent && (trace.ent->svflags & SVF_MONSTER)) {
// Monster stuck in vehicle. No matter how screwed up this is, // Monster stuck in vehicle. No matter how screwed up this is,
// we've gotta get him out of there. // we've gotta get him out of there.
@ -2068,7 +2058,7 @@ retry:
} }
else if(trace.ent->client && xy_speed > 0 ) else if(trace.ent->client && xy_speed > 0 )
{ {
// If player is relatively close to the vehicle move_origin, AND the // If player is relatively close to the vehicle move_origin, AND the
// vehicle is still moving, then most likely the player just disengaged // vehicle is still moving, then most likely the player just disengaged
// the vehicle and isn't really trapped. Move player along with // the vehicle and isn't really trapped. Move player along with
// vehicle // vehicle
@ -2372,7 +2362,7 @@ trace_t SV_DebrisEntity (edict_t *ent, vec3_t push)
if(speed1 <= 0) return trace; if(speed1 <= 0) return trace;
scale = (float)ent->mass/200.*speed1; scale = (float)ent->mass/200.*speed1;
VectorMA(trace.ent->velocity,scale,v1,trace.ent->velocity); VectorMA(trace.ent->velocity,scale,v1,trace.ent->velocity);
// Take a swag at it... // Take a swag at it...
if(speed1 > 100) { if(speed1 > 100) {
damage = (int)(ent->mass * speed1 / 5000.); damage = (int)(ent->mass * speed1 / 5000.);
@ -2391,7 +2381,7 @@ trace_t SV_DebrisEntity (edict_t *ent, vec3_t push)
} }
} }
return trace; return trace;
} }
/* /*
============= =============
@ -2443,10 +2433,10 @@ void SV_Physics_Debris (edict_t *ent)
ClipVelocity (ent->velocity, trace.plane.normal, ent->velocity, backoff); ClipVelocity (ent->velocity, trace.plane.normal, ent->velocity, backoff);
// stop if on ground // stop if on ground
// if (trace.plane.normal[2] > 0.7) Lazarus: This is too strict... rocks get hung // if (trace.plane.normal[2] > 0.7) Lazarus: This is too strict... rocks get hung
// up on sides of cliffs and spin in place // up on sides of cliffs and spin in place
if (trace.plane.normal[2] > 0.3) if (trace.plane.normal[2] > 0.3)
{ {
if (ent->velocity[2] < 60) if (ent->velocity[2] < 60)
{ {
ent->groundentity = trace.ent; ent->groundentity = trace.ent;
@ -2456,7 +2446,7 @@ void SV_Physics_Debris (edict_t *ent)
} }
} }
} }
// check for water transition // check for water transition
wasinwater = (ent->watertype & MASK_WATER); wasinwater = (ent->watertype & MASK_WATER);
ent->watertype = gi.pointcontents (ent->s.origin); ent->watertype = gi.pointcontents (ent->s.origin);
@ -2585,6 +2575,6 @@ void G_RunEntity (edict_t *ent)
SV_Physics_Conveyor(ent); SV_Physics_Conveyor(ent);
break; break;
default: default:
gi.error ("SV_Physics: bad movetype %i", (int)ent->movetype); gi.error ("SV_Physics: bad movetype %i", (int)ent->movetype);
} }
} }

View file

@ -56,7 +56,7 @@ float UTIL_ApproachAngle( float target, float value, float speed )
target = UTIL_AngleMod( target ); target = UTIL_AngleMod( target );
value = UTIL_AngleMod( target ); value = UTIL_AngleMod( target );
delta = target - value; delta = target - value;
// Speed is assumed to be positive // Speed is assumed to be positive
@ -72,7 +72,7 @@ float UTIL_ApproachAngle( float target, float value, float speed )
value += speed; value += speed;
else if ( delta < -speed ) else if ( delta < -speed )
value -= speed; value -= speed;
else else
value = target; value = target;
return value; return value;
@ -358,7 +358,7 @@ void SP_func_trackchange (edict_t *self)
/*===================================================================================== /*=====================================================================================
func_tracktrain func_tracktrain
target first path_track stop target first path_track stop
dmg damage applied to blocker dmg damage applied to blocker
@ -385,7 +385,7 @@ void tracktrain_drive (edict_t *train, edict_t *other )
VectorCopy(train->s.angles,angles); VectorCopy(train->s.angles,angles);
VectorNegate(angles,angles); VectorNegate(angles,angles);
AngleVectors(angles,f1,l1,u1); AngleVectors(angles,f1,l1,u1);
VectorSubtract(other->s.origin,train->s.origin,offset); VectorSubtract(other->s.origin,train->s.origin,offset);
VectorScale(f1, offset[0],f1); VectorScale(f1, offset[0],f1);
VectorScale(l1,-offset[1],l1); VectorScale(l1,-offset[1],l1);
@ -706,7 +706,7 @@ void tracktrain_think (edict_t *self)
speed = self->moveinfo.current_speed - self->moveinfo.decel/10; speed = self->moveinfo.current_speed - self->moveinfo.decel/10;
if(speed < self->moveinfo.next_speed) speed = self->moveinfo.next_speed; if(speed < self->moveinfo.next_speed) speed = self->moveinfo.next_speed;
} }
VectorSubtract(self->moveinfo.end_origin,self->s.origin,v); VectorSubtract(self->moveinfo.end_origin,self->s.origin,v);
distance = VectorLength(v); distance = VectorLength(v);
if(speed != 0) if(speed != 0)
@ -720,10 +720,10 @@ void tracktrain_think (edict_t *self)
time = 100000; time = 100000;
VectorNormalize(v); VectorNormalize(v);
VectorScale(v,fabs(speed),self->velocity); VectorScale(v,fabs(speed),self->velocity);
// gi.dprintf("distance to %s=%g, time=%g\n", // gi.dprintf("distance to %s=%g, time=%g\n",
// self->target_ent->targetname,distance,time); // self->target_ent->targetname,distance,time);
gi.linkentity(self); gi.linkentity(self);
} }
@ -787,7 +787,7 @@ void tracktrain_think (edict_t *self)
speed = self->moveinfo.current_speed - self->moveinfo.decel/10; speed = self->moveinfo.current_speed - self->moveinfo.decel/10;
if(speed < self->moveinfo.next_speed) speed = self->moveinfo.next_speed; if(speed < self->moveinfo.next_speed) speed = self->moveinfo.next_speed;
} }
if(speed != 0) if(speed != 0)
{ {
VectorSubtract(self->moveinfo.end_origin,self->s.origin,v); VectorSubtract(self->moveinfo.end_origin,self->s.origin,v);
@ -880,7 +880,7 @@ void tracktrain_think (edict_t *self)
if(speed < self->moveinfo.next_speed) speed = self->moveinfo.next_speed; if(speed < self->moveinfo.next_speed) speed = self->moveinfo.next_speed;
} }
if( speed != 0 ) if( speed != 0 )
{ {
VectorSubtract(self->moveinfo.end_origin,self->s.origin,v); VectorSubtract(self->moveinfo.end_origin,self->s.origin,v);
distance = VectorNormalize(v); distance = VectorNormalize(v);
@ -913,7 +913,7 @@ void tracktrain_think (edict_t *self)
VectorCopy(self->s.angles,angles); VectorCopy(self->s.angles,angles);
VectorNegate(angles,angles); VectorNegate(angles,angles);
AngleVectors(angles,f1,l1,u1); AngleVectors(angles,f1,l1,u1);
// find a player // find a player
for (i=1, ent=&g_edicts[1] ; i<=maxclients->value ; i++, ent++) { for (i=1, ent=&g_edicts[1] ; i<=maxclients->value ; i++, ent++) {
if (!ent->inuse) continue; if (!ent->inuse) continue;
@ -1011,8 +1011,6 @@ void tracktrain_blocked (edict_t *self, edict_t *other)
if (other) if (other)
{ {
// Some of our ents don't have origin near the model // Some of our ents don't have origin near the model
vec3_t save;
VectorCopy(other->s.origin,save);
VectorMA (other->absmin, 0.5, other->size, other->s.origin); VectorMA (other->absmin, 0.5, other->size, other->s.origin);
BecomeExplosion1 (other); BecomeExplosion1 (other);
} }
@ -1166,10 +1164,10 @@ edict_t *NextPathTrack(edict_t *train, edict_t *path)
if(DotProduct(forward,to_next) > 0) if(DotProduct(forward,to_next) > 0)
next = NULL; next = NULL;
} }
if(!next) if(!next)
{ {
// Find path_track whose target or target2 is set to // Find path_track whose target or target2 is set to
// the current path_track // the current path_track
edict_t *e; edict_t *e;
int i; int i;
@ -1228,11 +1226,11 @@ edict_t *NextPathTrack(edict_t *train, edict_t *path)
{ {
edict_t *next2; edict_t *next2;
float dot2; float dot2;
next2 = G_PickTarget (path->target2); next2 = G_PickTarget (path->target2);
if( next2 == path ) if( next2 == path )
next2 = NULL; next2 = NULL;
if(next2) if(next2)
{ {
VectorSubtract(next2->s.origin,path->s.origin,to_next); VectorSubtract(next2->s.origin,path->s.origin,to_next);
@ -1246,7 +1244,7 @@ edict_t *NextPathTrack(edict_t *train, edict_t *path)
next2 = NULL; next2 = NULL;
} }
} }
if((next && next2) && (dot2 < dot)) if((next && next2) && (dot2 < dot))
next = next2; next = next2;
} }
@ -1360,12 +1358,11 @@ edict_t *NextPathTrack(edict_t *train, edict_t *path)
void LookAhead( edict_t *train, vec3_t point, float dist ) void LookAhead( edict_t *train, vec3_t point, float dist )
{ {
float originalDist = dist;
float length; float length;
vec3_t v; vec3_t v;
edict_t *path; edict_t *path;
int n=0; int n=0;
path = train->target_ent; path = train->target_ent;
if(!path || dist < 0) if(!path || dist < 0)
return; return;
@ -1500,23 +1497,23 @@ void tracktrain_turn (edict_t *self)
{ {
Dist_1 = (idl_yaw - cur_yaw)*10; Dist_1 = (idl_yaw - cur_yaw)*10;
Dist_2 = ((360 - idl_yaw) + cur_yaw)*10; Dist_2 = ((360 - idl_yaw) + cur_yaw)*10;
if (Dist_1 < Dist_2) if (Dist_1 < Dist_2)
{ {
Distance = Dist_1; Distance = Dist_1;
if (Distance < yaw_vel) if (Distance < yaw_vel)
yaw_vel = Distance; yaw_vel = Distance;
new_speed = yaw_vel; new_speed = yaw_vel;
} }
else else
{ {
Distance = Dist_2; Distance = Dist_2;
if (Distance < yaw_vel) if (Distance < yaw_vel)
yaw_vel = Distance; yaw_vel = Distance;
new_speed = -yaw_vel; new_speed = -yaw_vel;
} }
} }
@ -1524,23 +1521,23 @@ void tracktrain_turn (edict_t *self)
{ {
Dist_1 = (cur_yaw - idl_yaw)*10; Dist_1 = (cur_yaw - idl_yaw)*10;
Dist_2 = ((360 - cur_yaw) + idl_yaw)*10; Dist_2 = ((360 - cur_yaw) + idl_yaw)*10;
if (Dist_1 < Dist_2) if (Dist_1 < Dist_2)
{ {
Distance = Dist_1; Distance = Dist_1;
if (Distance < yaw_vel) if (Distance < yaw_vel)
yaw_vel = Distance; yaw_vel = Distance;
new_speed = -yaw_vel; new_speed = -yaw_vel;
} }
else else
{ {
Distance = Dist_2; Distance = Dist_2;
if (Distance < yaw_vel) if (Distance < yaw_vel)
yaw_vel = Distance; yaw_vel = Distance;
new_speed = yaw_vel; new_speed = yaw_vel;
} }
} }
@ -1548,10 +1545,10 @@ void tracktrain_turn (edict_t *self)
// if(developer->value) // if(developer->value)
// gi.dprintf ("current yaw: %g ideal yaw: %g yaw speed: %g\n", cur_yaw, idl_yaw, self->enemy->avelocity[1]); // gi.dprintf ("current yaw: %g ideal yaw: %g yaw speed: %g\n", cur_yaw, idl_yaw, self->enemy->avelocity[1]);
if (train->s.angles[YAW] < 0) if (train->s.angles[YAW] < 0)
train->s.angles[YAW] += 360; train->s.angles[YAW] += 360;
if (train->s.angles[YAW] >= 360) if (train->s.angles[YAW] >= 360)
train->s.angles[YAW] -= 360; train->s.angles[YAW] -= 360;
} }
@ -1584,23 +1581,23 @@ void tracktrain_turn (edict_t *self)
{ {
Dist_1 = (idl_pitch - cur_pitch)*10; Dist_1 = (idl_pitch - cur_pitch)*10;
Dist_2 = ((360 - idl_pitch) + cur_pitch)*10; Dist_2 = ((360 - idl_pitch) + cur_pitch)*10;
if (Dist_1 < Dist_2) if (Dist_1 < Dist_2)
{ {
Distance = Dist_1; Distance = Dist_1;
if (Distance < pitch_vel) if (Distance < pitch_vel)
pitch_vel = Distance; pitch_vel = Distance;
new_speed = pitch_vel; new_speed = pitch_vel;
} }
else else
{ {
Distance = Dist_2; Distance = Dist_2;
if (Distance < pitch_vel) if (Distance < pitch_vel)
pitch_vel = Distance; pitch_vel = Distance;
new_speed = -pitch_vel; new_speed = -pitch_vel;
} }
} }
@ -1608,31 +1605,31 @@ void tracktrain_turn (edict_t *self)
{ {
Dist_1 = (cur_pitch - idl_pitch)*10; Dist_1 = (cur_pitch - idl_pitch)*10;
Dist_2 = ((360 - cur_pitch) + idl_pitch)*10; Dist_2 = ((360 - cur_pitch) + idl_pitch)*10;
if (Dist_1 < Dist_2) if (Dist_1 < Dist_2)
{ {
Distance = Dist_1; Distance = Dist_1;
if (Distance < pitch_vel) if (Distance < pitch_vel)
pitch_vel = Distance; pitch_vel = Distance;
new_speed = -pitch_vel; new_speed = -pitch_vel;
} }
else else
{ {
Distance = Dist_2; Distance = Dist_2;
if (Distance < pitch_vel) if (Distance < pitch_vel)
pitch_vel = Distance; pitch_vel = Distance;
new_speed = pitch_vel; new_speed = pitch_vel;
} }
} }
train->avelocity[PITCH] = new_speed; train->avelocity[PITCH] = new_speed;
if (train->s.angles[PITCH] < 0) if (train->s.angles[PITCH] < 0)
train->s.angles[PITCH] += 360; train->s.angles[PITCH] += 360;
if (train->s.angles[PITCH] >= 360) if (train->s.angles[PITCH] >= 360)
train->s.angles[PITCH] -= 360; train->s.angles[PITCH] -= 360;
} }
@ -1739,7 +1736,7 @@ void func_tracktrain_find (edict_t *self)
self->moveinfo.accel = self->moveinfo.decel = self->moveinfo.speed; self->moveinfo.accel = self->moveinfo.decel = self->moveinfo.speed;
self->moveinfo.next_speed = self->moveinfo.state * self->moveinfo.speed/3; self->moveinfo.next_speed = self->moveinfo.state * self->moveinfo.speed/3;
} }
self->target_ent = ent; self->target_ent = ent;
// Get angles to next path_track // Get angles to next path_track

View file

@ -73,7 +73,7 @@ void multi_trigger (edict_t *ent)
} }
//CW--- //CW---
if (ent->wait > 0) if (ent->wait > 0)
{ {
ent->think = multi_wait; ent->think = multi_wait;
ent->nextthink = level.time + ent->wait; ent->nextthink = level.time + ent->wait;
@ -177,7 +177,7 @@ void SP_trigger_multiple (edict_t *ent)
ent->noise_index = -1; ent->noise_index = -1;
} }
//CW--- //CW---
if (!ent->wait) if (!ent->wait)
ent->wait = 0.2; ent->wait = 0.2;
ent->touch = Touch_Multi; ent->touch = Touch_Multi;
@ -321,7 +321,7 @@ void SP_trigger_relay (edict_t *self)
self->noise_index = -1; self->noise_index = -1;
} }
//CW--- //CW---
if(!self->count) self->count = -1; if(!self->count) self->count = -1;
// end DWH // end DWH
@ -490,7 +490,7 @@ void trigger_counter_use(edict_t *self, edict_t *other, edict_t *activator)
G_FreeEdict(self); // DWH G_FreeEdict(self); // DWH
return; return;
} }
self->count--; self->count--;
if (self->count) if (self->count)
@ -502,7 +502,7 @@ void trigger_counter_use(edict_t *self, edict_t *other, edict_t *activator)
} }
return; return;
} }
if (! (self->spawnflags & 1)) if (! (self->spawnflags & 1))
{ {
gi.centerprintf(activator, "Sequence completed!"); gi.centerprintf(activator, "Sequence completed!");
@ -569,7 +569,7 @@ void trigger_push_touch (edict_t *self, edict_t *other, cplane_t *plane, csurfac
else if (other->movetype == MOVETYPE_PUSHABLE) else if (other->movetype == MOVETYPE_PUSHABLE)
{ {
vec3_t v; vec3_t v;
VectorScale (self->movedir, self->speed * 2000 / (float)(other->mass), v); VectorScale (self->movedir, self->speed * 2000 / (float)(other->mass), v);
VectorAdd(other->velocity,v,other->velocity); VectorAdd(other->velocity,v,other->velocity);
} }
else if (other->health > 0) else if (other->health > 0)
@ -660,7 +660,7 @@ void medibot_touch(edict_t *self, edict_t *other, cplane_t *plane, csurface_t *s
gi.sound (other, CHAN_AUTO, gi.soundindex ("misc/talk1.wav"), 1, ATTN_NORM, 0); gi.sound (other, CHAN_AUTO, gi.soundindex ("misc/talk1.wav"), 1, ATTN_NORM, 0);
self->message = NULL; self->message = NULL;
} }
if (self->target) if (self->target)
{ {
G_UseTargets(self, other); G_UseTargets(self, other);
@ -702,12 +702,12 @@ void SP_trigger_medibot(edict_t *self)
self->touch = medibot_touch; self->touch = medibot_touch;
self->noise_index = gi.soundindex("items/s_health.wav"); self->noise_index = gi.soundindex("items/s_health.wav");
if (!self->health) self->health = 1; if (!self->health) self->health = 1;
if (!self->count) self->count = 50; if (!self->count) self->count = 50;
if (self->spawnflags & SF_MEDI_START_OFF) if (self->spawnflags & SF_MEDI_START_OFF)
{ {
if (self->targetname == NULL) if (self->targetname == NULL)
{ {
gi.dprintf("trigger_medibot at %s flagged to start off but has no targetname (will start on)\n", vtos(self->s.origin)); gi.dprintf("trigger_medibot at %s flagged to start off but has no targetname (will start on)\n", vtos(self->s.origin));
self->solid = SOLID_TRIGGER; self->solid = SOLID_TRIGGER;
@ -822,7 +822,7 @@ void hurt_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *sur
{ {
// DWH - Original code would fail to play a sound for // DWH - Original code would fail to play a sound for
// SF=16 unless player just HAPPENED to hit // SF=16 unless player just HAPPENED to hit
// trigger_hurt at framenum = an integral number of // trigger_hurt at framenum = an integral number of
// full seconds. // full seconds.
if ( ((level.framenum % 10) == 0 ) || (self->spawnflags & SF_HURT_SLOW) ) if ( ((level.framenum % 10) == 0 ) || (self->spawnflags & SF_HURT_SLOW) )
gi.sound (other, CHAN_AUTO, self->noise_index, 1, ATTN_NORM, 0); gi.sound (other, CHAN_AUTO, self->noise_index, 1, ATTN_NORM, 0);
@ -949,10 +949,10 @@ void trigger_monsterjump_touch (edict_t *self, edict_t *other, cplane_t *plane,
// set XY even if not on ground, so the jump will clear lips // set XY even if not on ground, so the jump will clear lips
other->velocity[0] = self->movedir[0] * self->speed; other->velocity[0] = self->movedir[0] * self->speed;
other->velocity[1] = self->movedir[1] * self->speed; other->velocity[1] = self->movedir[1] * self->speed;
if (!other->groundentity) if (!other->groundentity)
return; return;
other->groundentity = NULL; other->groundentity = NULL;
other->velocity[2] = self->movedir[2]; other->velocity[2] = self->movedir[2];
} }
@ -1021,7 +1021,7 @@ void SP_tremor_trigger_multiple (edict_t *ent)
// DWH - should be silent // DWH - should be silent
// ent->noise_index = gi.soundindex ("misc/trigger1.wav"); // ent->noise_index = gi.soundindex ("misc/trigger1.wav");
ent->noise_index = -1; ent->noise_index = -1;
if (!ent->wait) if (!ent->wait)
ent->wait = 0.2; ent->wait = 0.2;
ent->touch = Touch_Multi; ent->touch = Touch_Multi;
@ -1116,7 +1116,7 @@ void trigger_inside_think (edict_t *self)
if (hit->absmax[1] > self->absmax[1]) continue; if (hit->absmax[1] > self->absmax[1]) continue;
if (hit->absmax[2] > self->absmax[2]) continue; if (hit->absmax[2] > self->absmax[2]) continue;
G_UseTargets (self, hit); G_UseTargets (self, hit);
if (self->wait > 0) if (self->wait > 0)
self->nextthink = level.time + self->wait; self->nextthink = level.time + self->wait;
else else
{ {
@ -1244,7 +1244,7 @@ void SP_trigger_scales (edict_t *self)
} }
//====================================================================================== //======================================================================================
// TRIGGER_BBOX - Exactly like a tremor_trigger_multiple, but uses bleft, tright fields // TRIGGER_BBOX - Exactly like a tremor_trigger_multiple, but uses bleft, tright fields
// to define extents of trigger field rather than a brush model. This // to define extents of trigger field rather than a brush model. This
// helps lower the total brush model count, which in turn helps head off // helps lower the total brush model count, which in turn helps head off
// Index Overflow errors. // Index Overflow errors.
//====================================================================================== //======================================================================================
@ -1346,7 +1346,7 @@ void SP_trigger_bbox (edict_t *ent)
ent->noise_index = gi.soundindex ("misc/talk.wav"); ent->noise_index = gi.soundindex ("misc/talk.wav");
else if (ent->sounds == 3) else if (ent->sounds == 3)
ent->noise_index = -1; ent->noise_index = -1;
if (!ent->wait) if (!ent->wait)
ent->wait = 0.2; ent->wait = 0.2;
@ -1399,7 +1399,6 @@ void SP_trigger_bbox (edict_t *ent)
void trigger_look_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf) void trigger_look_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf)
{ {
trace_t tr;
vec_t dist; vec_t dist;
vec3_t dir, forward, left, up, end, start; vec3_t dir, forward, left, up, end, start;
@ -1420,13 +1419,11 @@ void trigger_look_touch (edict_t *self, edict_t *other, cplane_t *plane, csurfac
// Then trigger only fires if looking at TARGET, not trigger bbox // Then trigger only fires if looking at TARGET, not trigger bbox
edict_t *target; edict_t *target;
int num_triggered=0; int num_triggered=0;
edict_t *what;
vec3_t endpos; vec3_t endpos;
target = G_Find(NULL,FOFS(targetname),self->target); target = G_Find(NULL,FOFS(targetname),self->target);
while(target && !num_triggered) while(target && !num_triggered)
{ {
what = LookingAt(other,0,endpos,NULL);
if(target->inuse && (LookingAt(other,0,NULL,NULL) == target)) if(target->inuse && (LookingAt(other,0,NULL,NULL) == target))
{ {
num_triggered++; num_triggered++;
@ -1462,14 +1459,12 @@ void trigger_look_touch (edict_t *self, edict_t *other, cplane_t *plane, csurfac
VectorSubtract(self->s.origin,start,dir); VectorSubtract(self->s.origin,start,dir);
dist = VectorLength(dir); dist = VectorLength(dir);
VectorMA(start,dist,forward,end); VectorMA(start,dist,forward,end);
tr = gi.trace(start,vec3_origin,vec3_origin,end,other,MASK_OPAQUE);
// See if we're looking at origin, within bleft, tright // See if we're looking at origin, within bleft, tright
// FIXME: The following is more or less accurate if the // FIXME: The following is more or less accurate if the
// bleft-tright box is roughly a cube. If it's considerably // bleft-tright box is roughly a cube. If it's considerably
// longer in one direction we'll get false misses. // longer in one direction we'll get false misses.
if(end[0] < self->s.origin[0] + self->bleft[0]) if(end[0] < self->s.origin[0] + self->bleft[0])
return; return;
if(end[1] < self->s.origin[1] + self->bleft[1]) if(end[1] < self->s.origin[1] + self->bleft[1])
@ -1482,12 +1477,12 @@ void trigger_look_touch (edict_t *self, edict_t *other, cplane_t *plane, csurfac
return; return;
if(end[2] > self->s.origin[2] + self->tright[2]) if(end[2] > self->s.origin[2] + self->tright[2])
return; return;
self->activator = other; self->activator = other;
G_UseTargets (self, other); G_UseTargets (self, other);
} }
if (self->wait > 0) if (self->wait > 0)
{ {
self->think = multi_wait; self->think = multi_wait;
self->nextthink = level.time + self->wait; self->nextthink = level.time + self->wait;
@ -1533,7 +1528,7 @@ void SP_trigger_look (edict_t *self)
self->noise_index = gi.soundindex ("misc/talk.wav"); self->noise_index = gi.soundindex ("misc/talk.wav");
else if (self->sounds == 3) else if (self->sounds == 3)
self->noise_index = -1; self->noise_index = -1;
if (!self->wait) if (!self->wait)
self->wait = 0.2; self->wait = 0.2;
@ -1683,7 +1678,7 @@ void WriteTransitionEdict (FILE *f, edict_t *changelevel, edict_t *ent)
vec3_t angles; vec3_t angles;
vec3_t forward, right, v; vec3_t forward, right, v;
vec3_t spawn_offset; vec3_t spawn_offset;
VectorSubtract(e.s.origin,changelevel->s.origin,spawn_offset); VectorSubtract(e.s.origin,changelevel->s.origin,spawn_offset);
angles[PITCH] = angles[ROLL] = 0.; angles[PITCH] = angles[ROLL] = 0.;
angles[YAW] = changelevel->s.angles[YAW]; angles[YAW] = changelevel->s.angles[YAW];

View file

@ -563,7 +563,6 @@ qboolean Boss2_CheckAttack (edict_t *self)
vec3_t temp; vec3_t temp;
float chance; float chance;
trace_t tr; trace_t tr;
qboolean enemy_infront;
int enemy_range; int enemy_range;
float enemy_yaw; float enemy_yaw;
@ -585,7 +584,6 @@ qboolean Boss2_CheckAttack (edict_t *self)
return false; return false;
} }
enemy_infront = infront(self, self->enemy);
enemy_range = range(self, self->enemy); enemy_range = range(self, self->enemy);
VectorSubtract (self->enemy->s.origin, self->s.origin, temp); VectorSubtract (self->enemy->s.origin, self->s.origin, temp);
enemy_yaw = vectoyaw(temp); enemy_yaw = vectoyaw(temp);

View file

@ -544,12 +544,6 @@ void jorg_firebullet (edict_t *self)
void jorg_attack(edict_t *self) void jorg_attack(edict_t *self)
{ {
vec3_t vec;
float range;
VectorSubtract (self->enemy->s.origin, self->s.origin, vec);
range = VectorLength (vec);
if (random() <= 0.75) if (random() <= 0.75)
{ {
gi.sound (self, CHAN_VOICE, sound_attack1, 1, ATTN_NORM,0); gi.sound (self, CHAN_VOICE, sound_attack1, 1, ATTN_NORM,0);
@ -610,7 +604,6 @@ qboolean Jorg_CheckAttack (edict_t *self)
vec3_t temp; vec3_t temp;
float chance; float chance;
trace_t tr; trace_t tr;
qboolean enemy_infront;
int enemy_range; int enemy_range;
float enemy_yaw; float enemy_yaw;
@ -629,7 +622,6 @@ qboolean Jorg_CheckAttack (edict_t *self)
return false; return false;
} }
enemy_infront = infront(self, self->enemy);
enemy_range = range(self, self->enemy); enemy_range = range(self, self->enemy);
VectorSubtract (self->enemy->s.origin, self->s.origin, temp); VectorSubtract (self->enemy->s.origin, self->s.origin, temp);
enemy_yaw = vectoyaw(temp); enemy_yaw = vectoyaw(temp);

View file

@ -592,16 +592,10 @@ void makron_sight(edict_t *self, edict_t *other)
void makron_attack(edict_t *self) void makron_attack(edict_t *self)
{ {
vec3_t vec;
float range;
float r; float r;
r = random(); r = random();
VectorSubtract (self->enemy->s.origin, self->s.origin, vec);
range = VectorLength (vec);
if (r <= 0.3) if (r <= 0.3)
self->monsterinfo.currentmove = &makron_move_attack3; self->monsterinfo.currentmove = &makron_move_attack3;
else if (r <= 0.6) else if (r <= 0.6)
@ -735,7 +729,6 @@ qboolean Makron_CheckAttack (edict_t *self)
vec3_t temp; vec3_t temp;
float chance; float chance;
trace_t tr; trace_t tr;
qboolean enemy_infront;
int enemy_range; int enemy_range;
float enemy_yaw; float enemy_yaw;
@ -754,7 +747,6 @@ qboolean Makron_CheckAttack (edict_t *self)
return false; return false;
} }
enemy_infront = infront(self, self->enemy);
enemy_range = range(self, self->enemy); enemy_range = range(self, self->enemy);
VectorSubtract (self->enemy->s.origin, self->s.origin, temp); VectorSubtract (self->enemy->s.origin, self->s.origin, temp);
enemy_yaw = vectoyaw(temp); enemy_yaw = vectoyaw(temp);

View file

@ -154,7 +154,6 @@ void DeathmatchScoreboardMessage (edict_t *ent, edict_t *killer)
int sorted[MAX_CLIENTS]; int sorted[MAX_CLIENTS];
int sortedscores[MAX_CLIENTS]; int sortedscores[MAX_CLIENTS];
int score, total; int score, total;
int picnum;
int x, y; int x, y;
gclient_t *cl; gclient_t *cl;
edict_t *cl_ent; edict_t *cl_ent;
@ -197,7 +196,6 @@ void DeathmatchScoreboardMessage (edict_t *ent, edict_t *killer)
cl = &game.clients[sorted[i]]; cl = &game.clients[sorted[i]];
cl_ent = g_edicts + 1 + sorted[i]; cl_ent = g_edicts + 1 + sorted[i];
picnum = gi.imageindex ("i_fixme");
x = (i>=6) ? 160 : 0; x = (i>=6) ? 160 : 0;
y = 32 + 32 * (i%6); y = 32 + 32 * (i%6);
@ -318,12 +316,12 @@ void HelpComputer (edict_t *ent)
"xv 0 yv 54 cstring2 \"%s\" " // help 1 "xv 0 yv 54 cstring2 \"%s\" " // help 1
"xv 0 yv 110 cstring2 \"%s\" " // help 2 "xv 0 yv 110 cstring2 \"%s\" " // help 2
"xv 50 yv 164 string2 \" kills goals secrets\" " "xv 50 yv 164 string2 \" kills goals secrets\" "
"xv 50 yv 172 string2 \"%3i/%3i %i/%i %i/%i\" ", "xv 50 yv 172 string2 \"%3i/%3i %i/%i %i/%i\" ",
sk, sk,
level.level_name, level.level_name,
game.helpmessage1, game.helpmessage1,
game.helpmessage2, game.helpmessage2,
level.killed_monsters, level.total_monsters, level.killed_monsters, level.total_monsters,
level.found_goals, level.total_goals, level.found_goals, level.total_goals,
level.found_secrets, level.total_secrets); level.found_secrets, level.total_secrets);
} }
@ -462,7 +460,7 @@ void G_SetStats (edict_t *ent)
ent->client->ps.stats[STAT_AMMO_ICON] = gi.imageindex (item->icon); ent->client->ps.stats[STAT_AMMO_ICON] = gi.imageindex (item->icon);
ent->client->ps.stats[STAT_AMMO] = ent->client->pers.inventory[ent->client->ammo_index]; ent->client->ps.stats[STAT_AMMO] = ent->client->pers.inventory[ent->client->ammo_index];
} }
// //
// armor // armor
// //
@ -682,7 +680,7 @@ void G_SetSpectatorStats (edict_t *ent)
cl->ps.stats[STAT_LAYOUTS] |= 2; cl->ps.stats[STAT_LAYOUTS] |= 2;
if (cl->chase_target && cl->chase_target->inuse) if (cl->chase_target && cl->chase_target->inuse)
cl->ps.stats[STAT_CHASE] = CS_PLAYERSKINS + cl->ps.stats[STAT_CHASE] = CS_PLAYERSKINS +
(cl->chase_target - g_edicts) - 1; (cl->chase_target - g_edicts) - 1;
else else
cl->ps.stats[STAT_CHASE] = 0; cl->ps.stats[STAT_CHASE] = 0;