mirror of
https://github.com/blendogames/thirtyflightsofloving.git
synced 2025-03-11 03:11:29 +00:00
Fixed missing sounds for buttons, doors, plats, etc. in id/rogue/xatrix maps caused by custom sound code in Lazarus and missionpack DLLs.
Added custom sound support to func_door_secret2 in missionpack DLL. Changed missionpack DLL to use maptype_t enum in level_locals_t instead of constantly calling utility functions which contain multiple string compares.
This commit is contained in:
parent
90274a87dd
commit
ed34b3b8ed
17 changed files with 503 additions and 438 deletions
297
game/g_func.c
297
game/g_func.c
|
@ -57,26 +57,26 @@ void set_child_movement(edict_t *self)
|
|||
vec3_t delta_angles;
|
||||
qboolean is_monster;
|
||||
|
||||
if(!self->inuse)
|
||||
if (!self->inuse)
|
||||
return;
|
||||
|
||||
e = self->movewith_next;
|
||||
parent = self;
|
||||
while(e != NULL)
|
||||
while (e != NULL)
|
||||
{
|
||||
restart:
|
||||
if(!e->inuse) break;
|
||||
if (!e->inuse) break;
|
||||
|
||||
VectorSubtract(self->s.angles,e->parent_attach_angles,delta_angles);
|
||||
AngleVectors(delta_angles,forward,right,up);
|
||||
VectorNegate(right,right);
|
||||
|
||||
// remove gibbed monsters from the chain
|
||||
if(e->svflags & SVF_MONSTER) {
|
||||
if(e->health <= e->gib_health) {
|
||||
if (e->svflags & SVF_MONSTER) {
|
||||
if (e->health <= e->gib_health) {
|
||||
parent->movewith_next = e->movewith_next;
|
||||
e = e->movewith_next;
|
||||
if(e)
|
||||
if (e)
|
||||
goto restart;
|
||||
else
|
||||
break;
|
||||
|
@ -86,7 +86,7 @@ restart:
|
|||
is_monster = false;
|
||||
|
||||
// For all but func_button and func_door, move origin and match velocities
|
||||
if(Q_stricmp(e->classname,"func_door") && Q_stricmp(e->classname,"func_button")) {
|
||||
if (Q_stricmp(e->classname,"func_door") && Q_stricmp(e->classname,"func_button")) {
|
||||
|
||||
VectorMA(self->s.origin, e->movewith_offset[0], forward, e->s.origin);
|
||||
VectorMA(e->s.origin, e->movewith_offset[1], right, e->s.origin);
|
||||
|
@ -96,54 +96,54 @@ restart:
|
|||
|
||||
// If parent is spinning, add appropriate velocities
|
||||
VectorSubtract(e->s.origin,self->s.origin,offset);
|
||||
if(self->avelocity[PITCH] != 0) {
|
||||
if (self->avelocity[PITCH] != 0) {
|
||||
e->velocity[2] -= offset[0] * self->avelocity[PITCH] * M_PI / 180;
|
||||
e->velocity[0] += offset[2] * self->avelocity[PITCH] * M_PI / 180;
|
||||
}
|
||||
if(self->avelocity[YAW] != 0) {
|
||||
if (self->avelocity[YAW] != 0) {
|
||||
e->velocity[0] -= offset[1] * self->avelocity[YAW] * M_PI / 180.;
|
||||
e->velocity[1] += offset[0] * self->avelocity[YAW] * M_PI / 180.;
|
||||
}
|
||||
if(self->avelocity[ROLL] != 0) {
|
||||
if (self->avelocity[ROLL] != 0) {
|
||||
e->velocity[1] -= offset[2] * self->avelocity[ROLL] * M_PI / 180;
|
||||
e->velocity[2] += offset[1] * self->avelocity[ROLL] * M_PI / 180;
|
||||
}
|
||||
|
||||
VectorScale(self->avelocity,FRAMETIME,amove);
|
||||
if(self->turn_rider) {
|
||||
if (self->turn_rider) {
|
||||
// Match angular velocities
|
||||
if(!Q_stricmp(e->classname,"func_rotating")) {
|
||||
if (!Q_stricmp(e->classname,"func_rotating")) {
|
||||
float cr, sr;
|
||||
float cy, sy;
|
||||
cy = cos((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];
|
||||
} else if(e->movedir[1] > 0) {
|
||||
} else if (e->movedir[1] > 0) {
|
||||
e->s.angles[1] += amove[1];
|
||||
e->s.angles[2] = delta_angles[2]*cy;
|
||||
e->s.angles[0] = -delta_angles[2]*sy;
|
||||
} else if(e->movedir[2] > 0) {
|
||||
} else if (e->movedir[2] > 0) {
|
||||
e->s.angles[1] = delta_angles[0]*-sy;
|
||||
}
|
||||
}
|
||||
else if( !is_monster )
|
||||
else if ( !is_monster )
|
||||
{ // Not a monster/actor. We want monsters/actors to be able to turn on
|
||||
// their own.
|
||||
if( !e->do_not_rotate )
|
||||
if ( !e->do_not_rotate )
|
||||
{
|
||||
if(!Q_stricmp(e->classname,"turret_breach") || !Q_stricmp(e->classname,"turret_base") )
|
||||
if (!Q_stricmp(e->classname,"turret_breach") || !Q_stricmp(e->classname,"turret_base") )
|
||||
{
|
||||
VectorCopy(self->avelocity,e->avelocity);
|
||||
}
|
||||
else if(!Q_stricmp(e->classname,"func_door_rotating"))
|
||||
else if (!Q_stricmp(e->classname,"func_door_rotating"))
|
||||
{
|
||||
VectorCopy(self->avelocity,e->avelocity);
|
||||
VectorCopy(delta_angles,e->pos1);
|
||||
VectorMA (e->pos1, e->moveinfo.distance, e->movedir, e->pos2);
|
||||
if(e->moveinfo.state == STATE_TOP)
|
||||
if (e->moveinfo.state == STATE_TOP)
|
||||
VectorCopy (e->pos2, e->s.angles);
|
||||
else
|
||||
VectorCopy (e->pos1, e->s.angles);
|
||||
|
@ -152,14 +152,14 @@ restart:
|
|||
VectorCopy (e->s.origin, e->moveinfo.end_origin);
|
||||
VectorCopy (e->pos2, e->moveinfo.end_angles);
|
||||
}
|
||||
else if(e->solid == SOLID_BSP)
|
||||
else if (e->solid == SOLID_BSP)
|
||||
{
|
||||
// Brush models always start out with angles=0,0,0 (after
|
||||
// G_SetMoveDir). Use more accuracy here
|
||||
VectorCopy(self->avelocity,e->avelocity);
|
||||
VectorCopy(delta_angles,e->s.angles);
|
||||
}
|
||||
else if(e->movetype == MOVETYPE_NONE)
|
||||
else if (e->movetype == MOVETYPE_NONE)
|
||||
{
|
||||
VectorCopy(self->avelocity,e->avelocity);
|
||||
VectorCopy(delta_angles,e->s.angles);
|
||||
|
@ -177,7 +177,7 @@ restart:
|
|||
|
||||
// Special cases:
|
||||
// Func_door/func_button and trigger fields
|
||||
if( (!Q_stricmp(e->classname,"func_door" )) ||
|
||||
if ( (!Q_stricmp(e->classname,"func_door" )) ||
|
||||
(!Q_stricmp(e->classname,"func_button")) )
|
||||
{
|
||||
|
||||
|
@ -191,22 +191,22 @@ restart:
|
|||
VectorCopy(e->s.angles, e->moveinfo.start_angles);
|
||||
VectorCopy(e->pos2, e->moveinfo.end_origin);
|
||||
VectorCopy(e->s.angles, e->moveinfo.end_angles);
|
||||
if(e->moveinfo.state == STATE_BOTTOM || e->moveinfo.state == STATE_TOP) {
|
||||
if (e->moveinfo.state == STATE_BOTTOM || e->moveinfo.state == STATE_TOP) {
|
||||
// Velocities for door/button movement are handled in normal
|
||||
// movement routines
|
||||
VectorCopy(self->velocity,e->velocity);
|
||||
// Sanity insurance:
|
||||
if(e->moveinfo.state == STATE_BOTTOM)
|
||||
if (e->moveinfo.state == STATE_BOTTOM)
|
||||
VectorCopy(e->pos1, e->s.origin);
|
||||
else
|
||||
VectorCopy(e->pos2, e->s.origin);
|
||||
}
|
||||
}
|
||||
|
||||
if(amove[YAW])
|
||||
if (amove[YAW])
|
||||
{
|
||||
// Cross fingers here... move bounding boxes of doors and buttons
|
||||
if( (!Q_stricmp(e->classname,"func_door" )) ||
|
||||
if ( (!Q_stricmp(e->classname,"func_door" )) ||
|
||||
(!Q_stricmp(e->classname,"func_button")) ||
|
||||
(e->solid == SOLID_TRIGGER) )
|
||||
{
|
||||
|
@ -253,10 +253,10 @@ restart:
|
|||
|
||||
void movewith_update(edict_t *self)
|
||||
{
|
||||
if(self->moveinfo.state == STATE_BOTTOM) {
|
||||
if (self->moveinfo.state == STATE_BOTTOM) {
|
||||
VectorCopy(self->s.origin,self->pos1);
|
||||
VectorMA(self->pos1, self->moveinfo.distance, self->movedir, self->pos2);
|
||||
} else if(self->moveinfo.state == STATE_TOP) {
|
||||
} else if (self->moveinfo.state == STATE_TOP) {
|
||||
VectorCopy(self->s.origin,self->pos2);
|
||||
VectorMA(self->pos2, -self->moveinfo.distance, self->movedir, self->pos1);
|
||||
}
|
||||
|
@ -330,19 +330,19 @@ void train_spline (edict_t *self)
|
|||
train = self->enemy;
|
||||
if (!train || !train->inuse)
|
||||
return;
|
||||
//Knightmare- check for killtargeted path_corners
|
||||
// Knightmare- check for killtargeted path_corners
|
||||
if ((!train->from) || (!train->from->inuse) || (!train->to) || (!train->to->inuse))
|
||||
return;
|
||||
//Knightmare- check for removed spline flag- get da hell outta here
|
||||
// Knightmare- check for removed spline flag- get da hell outta here
|
||||
if ( !(train->spawnflags & TRAIN_SPLINE) )
|
||||
{
|
||||
self->think = train_children_think;
|
||||
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))
|
||||
{
|
||||
if(train->moveinfo.ratio >= 1.0) //Knightmare- don't keep moving at end of curve
|
||||
if (train->moveinfo.ratio >= 1.0) //Knightmare- don't keep moving at end of curve
|
||||
{
|
||||
VectorClear(self->avelocity);
|
||||
VectorClear(self->velocity);
|
||||
|
@ -359,15 +359,15 @@ void train_spline (edict_t *self)
|
|||
VectorScale(train->velocity,10,train->velocity);
|
||||
VectorSubtract(a,train->s.angles,train->avelocity);
|
||||
VectorScale(train->avelocity,10,train->avelocity);
|
||||
if(train->pitch_speed < 0)
|
||||
if (train->pitch_speed < 0)
|
||||
train->avelocity[PITCH] = 0;
|
||||
if(train->yaw_speed < 0)
|
||||
if (train->yaw_speed < 0)
|
||||
train->avelocity[YAW] = 0;
|
||||
gi.linkentity(train);
|
||||
train->moveinfo.ratio += train->moveinfo.speed * FRAMETIME / train->moveinfo.distance;
|
||||
if(train->movewith_next && (train->movewith_next->movewith_ent == train))
|
||||
if (train->movewith_next && (train->movewith_next->movewith_ent == train))
|
||||
set_child_movement(train);
|
||||
if(train->moveinfo.ratio >= 1.0)
|
||||
if (train->moveinfo.ratio >= 1.0)
|
||||
{
|
||||
train->moveinfo.endfunc = NULL;
|
||||
train->think = train_wait;
|
||||
|
@ -384,7 +384,7 @@ void check_reverse_rotation (edict_t *self, vec3_t point)
|
|||
vec_t rotation;
|
||||
vec_t cross;
|
||||
|
||||
if(!(self->flags & FL_REVERSIBLE))
|
||||
if (!(self->flags & FL_REVERSIBLE))
|
||||
return;
|
||||
|
||||
VectorSubtract(point,self->s.origin,vec);
|
||||
|
@ -392,12 +392,12 @@ void check_reverse_rotation (edict_t *self, vec3_t point)
|
|||
VectorNormalize(vec);
|
||||
VectorNormalize(vnext);
|
||||
|
||||
if(self->spawnflags & DOOR_X_AXIS)
|
||||
if (self->spawnflags & DOOR_X_AXIS)
|
||||
{
|
||||
rotation = self->moveinfo.distance * self->movedir[ROLL];
|
||||
cross = vec[1]*vnext[2] - vec[2]*vnext[1];
|
||||
}
|
||||
else if(self->spawnflags & DOOR_Y_AXIS)
|
||||
else if (self->spawnflags & DOOR_Y_AXIS)
|
||||
{
|
||||
rotation = self->moveinfo.distance * self->movedir[PITCH];
|
||||
cross = vec[2]*vnext[0] - vec[0]*vnext[2];
|
||||
|
@ -408,16 +408,16 @@ void check_reverse_rotation (edict_t *self, vec3_t point)
|
|||
cross = vec[0]*vnext[1] - vec[1]*vnext[0];
|
||||
}
|
||||
|
||||
if((self->spawnflags & 1) && (DotProduct(vec,vnext) < 0))
|
||||
if ((self->spawnflags & 1) && (DotProduct(vec,vnext) < 0))
|
||||
cross = -cross;
|
||||
|
||||
if( (cross < 0) && (rotation > 0) )
|
||||
if ( (cross < 0) && (rotation > 0) )
|
||||
{
|
||||
VectorNegate (self->movedir, self->movedir);
|
||||
VectorMA (self->pos1, self->moveinfo.distance, self->movedir, self->pos2);
|
||||
VectorCopy (self->pos2, self->moveinfo.end_angles);
|
||||
}
|
||||
else if((cross > 0) && (rotation < 0))
|
||||
else if ((cross > 0) && (rotation < 0))
|
||||
{
|
||||
VectorNegate (self->movedir, self->movedir);
|
||||
VectorMA (self->pos1, self->moveinfo.distance, self->movedir, self->pos2);
|
||||
|
@ -467,11 +467,11 @@ void check_reverse_rotation (edict_t *self, vec3_t point)
|
|||
void Move_Done (edict_t *ent)
|
||||
{
|
||||
VectorClear (ent->velocity);
|
||||
if(ent->movewith)
|
||||
if (ent->movewith)
|
||||
VectorCopy(ent->movewith_ent->velocity,ent->velocity);
|
||||
if(ent->moveinfo.endfunc)
|
||||
if (ent->moveinfo.endfunc)
|
||||
ent->moveinfo.endfunc (ent);
|
||||
if(ent->movewith_next && (ent->movewith_next->movewith_ent == ent))
|
||||
if (ent->movewith_next && (ent->movewith_next->movewith_ent == ent))
|
||||
set_child_movement(ent);
|
||||
}
|
||||
|
||||
|
@ -485,12 +485,12 @@ void Move_Final (edict_t *ent)
|
|||
|
||||
VectorScale (ent->moveinfo.dir, ent->moveinfo.remaining_distance / FRAMETIME, ent->velocity);
|
||||
|
||||
if(ent->movewith)
|
||||
if (ent->movewith)
|
||||
VectorAdd(ent->movewith_ent->velocity,ent->velocity,ent->velocity);
|
||||
|
||||
ent->think = Move_Done;
|
||||
ent->nextthink = level.time + FRAMETIME;
|
||||
if(ent->movewith_next && (ent->movewith_next->movewith_ent == ent))
|
||||
if (ent->movewith_next && (ent->movewith_next->movewith_ent == ent))
|
||||
set_child_movement(ent);
|
||||
}
|
||||
|
||||
|
@ -505,7 +505,7 @@ void Move_Begin (edict_t *ent)
|
|||
}
|
||||
VectorScale (ent->moveinfo.dir, ent->moveinfo.speed, ent->velocity);
|
||||
|
||||
if(ent->movewith)
|
||||
if (ent->movewith)
|
||||
{
|
||||
VectorAdd(ent->movewith_ent->velocity,ent->velocity,ent->velocity);
|
||||
ent->moveinfo.remaining_distance -= ent->moveinfo.speed * FRAMETIME;
|
||||
|
@ -537,7 +537,7 @@ void Move_Begin (edict_t *ent)
|
|||
vectoangles2(v,angles);
|
||||
ent->ideal_yaw = angles[YAW];
|
||||
ent->ideal_pitch = angles[PITCH];
|
||||
if(ent->ideal_pitch < 0) ent->ideal_pitch += 360;
|
||||
if (ent->ideal_pitch < 0) ent->ideal_pitch += 360;
|
||||
VectorClear(ent->movedir);
|
||||
ent->movedir[1] = 1.0;
|
||||
}
|
||||
|
@ -555,7 +555,7 @@ void Move_Begin (edict_t *ent)
|
|||
ent->think = Move_Final;
|
||||
}
|
||||
}
|
||||
if(ent->movewith_next && (ent->movewith_next->movewith_ent == ent))
|
||||
if (ent->movewith_next && (ent->movewith_next->movewith_ent == ent))
|
||||
set_child_movement(ent);
|
||||
}
|
||||
|
||||
|
@ -601,7 +601,7 @@ void Move_Calc (edict_t *ent, vec3_t dest, void(*func)(edict_t*))
|
|||
void AngleMove_Done (edict_t *ent)
|
||||
{
|
||||
VectorClear (ent->avelocity);
|
||||
if(ent->moveinfo.endfunc)
|
||||
if (ent->moveinfo.endfunc)
|
||||
ent->moveinfo.endfunc (ent);
|
||||
}
|
||||
|
||||
|
@ -802,12 +802,12 @@ void Think_AccelMove (edict_t *ent)
|
|||
}
|
||||
|
||||
VectorScale (ent->moveinfo.dir, ent->moveinfo.current_speed*10, ent->velocity);
|
||||
if(ent->movewith)
|
||||
if (ent->movewith)
|
||||
VectorAdd(ent->movewith_ent->velocity,ent->velocity,ent->velocity);
|
||||
ent->nextthink = level.time + FRAMETIME;
|
||||
ent->think = Think_AccelMove;
|
||||
|
||||
if(ent->movewith_next && (ent->movewith_next->movewith_ent == ent))
|
||||
if (ent->movewith_next && (ent->movewith_next->movewith_ent == ent))
|
||||
set_child_movement(ent);
|
||||
}
|
||||
|
||||
|
@ -1058,7 +1058,7 @@ void SP_func_plat (edict_t *ent)
|
|||
VectorCopy (ent->s.angles, ent->moveinfo.end_angles);
|
||||
ent->moveinfo.distance = ent->pos1[2] - ent->pos2[2]; // Knightmare- store distance
|
||||
|
||||
if (ent->sounds > 1 && ent->sounds < 100) // custom sounds
|
||||
if ( !IsIdMap() && (ent->sounds > 1) && (ent->sounds < 100) ) // custom sounds
|
||||
{
|
||||
ent->moveinfo.sound_start = gi.soundindex (va("plats/pt%02i_strt.wav", ent->sounds));
|
||||
ent->moveinfo.sound_middle = gi.soundindex (va("plats/pt%02i_mid.wav", ent->sounds));
|
||||
|
@ -1094,7 +1094,7 @@ void rotating_accel (edict_t *self)
|
|||
float current_speed;
|
||||
|
||||
current_speed = VectorLength (self->avelocity);
|
||||
if(current_speed >= (self->speed - self->accel)) // done
|
||||
if (current_speed >= (self->speed - self->accel)) // done
|
||||
{
|
||||
VectorScale (self->movedir, self->speed, self->avelocity);
|
||||
G_UseTargets (self, self);
|
||||
|
@ -1113,7 +1113,7 @@ void rotating_decel (edict_t *self)
|
|||
float current_speed;
|
||||
|
||||
current_speed = VectorLength (self->avelocity);
|
||||
if(current_speed <= self->decel) // done
|
||||
if (current_speed <= self->decel) // done
|
||||
{
|
||||
VectorClear (self->avelocity);
|
||||
G_UseTargets (self, self);
|
||||
|
@ -1236,7 +1236,7 @@ void SP_func_rotating (edict_t *ent)
|
|||
if (ent->spawnflags & 128)
|
||||
ent->s.effects |= EF_ANIM_ALLFAST;
|
||||
|
||||
if(ent->spawnflags & ROTATING_ACCEL) { // accel/decel
|
||||
if (ent->spawnflags & ROTATING_ACCEL) { // accel/decel
|
||||
if (ent->accel == 0) ent->accel = 1;
|
||||
else ent->accel = min(ent->accel, ent->speed);
|
||||
if (ent->decel == 0) ent->decel = 1;
|
||||
|
@ -1256,14 +1256,14 @@ void func_rotating_dh_init (edict_t *ent) {
|
|||
edict_t *new_origin;
|
||||
|
||||
new_origin = G_Find (NULL, FOFS(targetname), ent->pathtarget);
|
||||
if(new_origin)
|
||||
if (new_origin)
|
||||
VectorCopy(new_origin->s.origin,ent->s.origin);
|
||||
SP_func_rotating (ent);
|
||||
}
|
||||
|
||||
void SP_func_rotating_dh (edict_t *ent)
|
||||
{
|
||||
if( !ent->pathtarget ) {
|
||||
if ( !ent->pathtarget ) {
|
||||
SP_func_rotating(ent);
|
||||
return;
|
||||
}
|
||||
|
@ -1306,7 +1306,7 @@ void button_done (edict_t *self)
|
|||
|
||||
void button_return (edict_t *self)
|
||||
{
|
||||
if(self->movewith)
|
||||
if (self->movewith)
|
||||
movewith_update(self);
|
||||
|
||||
self->moveinfo.state = STATE_DOWN;
|
||||
|
@ -1339,7 +1339,7 @@ void button_fire (edict_t *self)
|
|||
if (self->moveinfo.state == STATE_UP || self->moveinfo.state == STATE_TOP)
|
||||
return;
|
||||
|
||||
if(self->movewith)
|
||||
if (self->movewith)
|
||||
movewith_update(self);
|
||||
self->moveinfo.state = STATE_UP;
|
||||
if (self->moveinfo.sound_start && !(self->flags & FL_TEAMSLAVE))
|
||||
|
@ -1362,7 +1362,7 @@ void button_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *s
|
|||
if (other->health <= 0)
|
||||
return;
|
||||
|
||||
if((self->spawnflags & 1) && (LookingAt(other,0,NULL,NULL) != self))
|
||||
if ((self->spawnflags & 1) && (LookingAt(other,0,NULL,NULL) != self))
|
||||
return;
|
||||
|
||||
self->activator = other;
|
||||
|
@ -1385,7 +1385,7 @@ void SP_func_button (edict_t *ent)
|
|||
|
||||
G_SetMovedir (ent->s.angles, ent->movedir);
|
||||
|
||||
if(ent->movewith) {
|
||||
if (ent->movewith) {
|
||||
ent->movetype = MOVETYPE_PUSH;
|
||||
ent->blocked = train_blocked;
|
||||
} else
|
||||
|
@ -1393,7 +1393,7 @@ void SP_func_button (edict_t *ent)
|
|||
ent->solid = SOLID_BSP;
|
||||
gi.setmodel (ent, ent->model);
|
||||
|
||||
if (ent->sounds > 1 && ent->sounds < 100) // custom sounds
|
||||
if ( !IsIdMap() && (ent->sounds > 1) && (ent->sounds < 100) ) // custom sounds
|
||||
ent->moveinfo.sound_start = gi.soundindex (va("switches/butn%02i.wav", ent->sounds));
|
||||
else if (ent->sounds != 1)
|
||||
ent->moveinfo.sound_start = gi.soundindex ("switches/butn2.wav");
|
||||
|
@ -1528,19 +1528,19 @@ void movewith_init (edict_t *ent)
|
|||
edict_t *e, *child;
|
||||
|
||||
// Unnamed entities can't be movewith parents
|
||||
if(!ent->targetname) return;
|
||||
if (!ent->targetname) return;
|
||||
|
||||
child = G_Find(NULL,FOFS(movewith),ent->targetname);
|
||||
e = ent;
|
||||
while(child)
|
||||
while (child)
|
||||
{
|
||||
child->movewith_ent = ent;
|
||||
// Copy parent's current angles to the child. They SHOULD be 0,0,0 at this point
|
||||
// for all currently supported parents, but ya never know.
|
||||
VectorCopy(ent->s.angles,child->parent_attach_angles);
|
||||
if(child->org_movetype < 0)
|
||||
if (child->org_movetype < 0)
|
||||
child->org_movetype = child->movetype;
|
||||
if(child->movetype != MOVETYPE_NONE)
|
||||
if (child->movetype != MOVETYPE_NONE)
|
||||
child->movetype = MOVETYPE_PUSH;
|
||||
VectorCopy(child->mins,child->org_mins);
|
||||
VectorCopy(child->maxs,child->org_maxs);
|
||||
|
@ -1553,7 +1553,7 @@ void movewith_init (edict_t *ent)
|
|||
|
||||
void SP_func_trainbutton (edict_t *ent)
|
||||
{
|
||||
if(!ent->movewith)
|
||||
if (!ent->movewith)
|
||||
{
|
||||
SP_func_button(ent);
|
||||
return;
|
||||
|
@ -1565,7 +1565,7 @@ void SP_func_trainbutton (edict_t *ent)
|
|||
ent->solid = SOLID_BSP;
|
||||
gi.setmodel (ent, ent->model);
|
||||
|
||||
if (ent->sounds > 1 && ent->sounds < 100) // custom sounds
|
||||
if ( (ent->sounds > 1) && (ent->sounds < 100) ) // custom sounds
|
||||
ent->moveinfo.sound_start = gi.soundindex (va("switches/butn%02i.wav", ent->sounds));
|
||||
else if (ent->sounds != 1)
|
||||
ent->moveinfo.sound_start = gi.soundindex ("switches/butn2.wav");
|
||||
|
@ -1637,7 +1637,7 @@ void swinging_door_reset (edict_t *self)
|
|||
{
|
||||
self->moveinfo.state = STATE_BOTTOM;
|
||||
self->health = self->max_health;
|
||||
if(self->die)
|
||||
if (self->die)
|
||||
self->takedamage = DAMAGE_YES;
|
||||
VectorCopy (self->pos2, self->pos1);
|
||||
VectorMA (self->s.angles, self->moveinfo.distance, self->movedir, self->pos2);
|
||||
|
@ -1660,10 +1660,10 @@ void door_hit_top (edict_t *self)
|
|||
self->s.sound = 0; // Knightmare- make sure this is always set to 0, lead mover or not!
|
||||
|
||||
self->moveinfo.state = STATE_TOP;
|
||||
if(self->flags & FL_REVOLVING)
|
||||
if (self->flags & FL_REVOLVING)
|
||||
{
|
||||
self->think = swinging_door_reset;
|
||||
if(self->moveinfo.wait > 0)
|
||||
if (self->moveinfo.wait > 0)
|
||||
self->nextthink = level.time + self->moveinfo.wait;
|
||||
else
|
||||
self->think(self);
|
||||
|
@ -1671,7 +1671,7 @@ void door_hit_top (edict_t *self)
|
|||
}
|
||||
if (self->spawnflags & DOOR_TOGGLE)
|
||||
{
|
||||
if(self->flags & FL_BOB)
|
||||
if (self->flags & FL_BOB)
|
||||
{
|
||||
self->think = bob_init;
|
||||
self->nextthink = level.time + FRAMETIME;
|
||||
|
@ -1683,7 +1683,7 @@ void door_hit_top (edict_t *self)
|
|||
self->think = door_go_down;
|
||||
self->nextthink = level.time + self->moveinfo.wait;
|
||||
}
|
||||
else if(self->flags & FL_BOB)
|
||||
else if (self->flags & FL_BOB)
|
||||
{
|
||||
self->think = bob_init;
|
||||
self->nextthink = level.time + FRAMETIME;
|
||||
|
@ -1704,7 +1704,7 @@ void door_hit_bottom (edict_t *self)
|
|||
self->moveinfo.state = STATE_BOTTOM;
|
||||
door_use_areaportals (self, false);
|
||||
|
||||
if(self->flags & FL_BOB)
|
||||
if (self->flags & FL_BOB)
|
||||
{
|
||||
self->think = bob_init;
|
||||
self->nextthink = level.time + FRAMETIME;
|
||||
|
@ -1730,7 +1730,7 @@ void door_go_down (edict_t *self)
|
|||
}
|
||||
|
||||
if (strcmp(self->classname, "func_door") == 0) {
|
||||
if(self->movewith)
|
||||
if (self->movewith)
|
||||
movewith_update(self);
|
||||
self->moveinfo.state = STATE_DOWN;
|
||||
Move_Calc (self, self->moveinfo.start_origin, door_hit_bottom);
|
||||
|
@ -1769,7 +1769,7 @@ void door_go_up (edict_t *self, edict_t *activator)
|
|||
#endif
|
||||
}
|
||||
if (strcmp(self->classname, "func_door") == 0) {
|
||||
if(self->movewith)
|
||||
if (self->movewith)
|
||||
movewith_update(self);
|
||||
self->moveinfo.state = STATE_UP;
|
||||
Move_Calc (self, self->moveinfo.end_origin, door_hit_top);
|
||||
|
@ -1893,7 +1893,7 @@ void Think_SpawnDoorTrigger (edict_t *ent)
|
|||
AddPointToBounds (other->absmax, mins, maxs);
|
||||
}
|
||||
|
||||
if(ent->movewith)
|
||||
if (ent->movewith)
|
||||
expand = 16;
|
||||
else
|
||||
expand = 60;
|
||||
|
@ -1914,12 +1914,12 @@ void Think_SpawnDoorTrigger (edict_t *ent)
|
|||
gi.linkentity (other);
|
||||
|
||||
// Lazarus movewith
|
||||
if(ent->movewith) {
|
||||
if (ent->movewith) {
|
||||
other->movewith = ent->movewith;
|
||||
VectorCopy(ent->s.origin,other->s.origin);
|
||||
VectorSubtract(other->mins,other->s.origin,other->mins);
|
||||
VectorSubtract(other->maxs,other->s.origin,other->maxs);
|
||||
if(ent->movewith_ent) {
|
||||
if (ent->movewith_ent) {
|
||||
// Uh-oh... movewith_init was already called.. no harm in calling it again
|
||||
movewith_init(ent->movewith_ent);
|
||||
}
|
||||
|
@ -2011,7 +2011,7 @@ void SP_func_door (edict_t *ent)
|
|||
|
||||
ent->class_id = ENTITY_FUNC_DOOR;
|
||||
|
||||
if (ent->sounds > 4 && ent->sounds < 100) // custom sounds
|
||||
if ( !IsIdMap() && (ent->sounds > 4) && (ent->sounds < 100) ) // custom sounds
|
||||
{
|
||||
ent->moveinfo.sound_start = gi.soundindex (va("doors/dr%02i_strt.wav", ent->sounds));
|
||||
ent->moveinfo.sound_middle = gi.soundindex (va("doors/dr%02i_mid.wav", ent->sounds));
|
||||
|
@ -2202,7 +2202,7 @@ void SP_func_door_rotating (edict_t *ent)
|
|||
if (!ent->dmg)
|
||||
ent->dmg = 2;
|
||||
|
||||
if (ent->sounds > 4 && ent->sounds < 100) // custom sounds
|
||||
if ( !IsIdMap() && (ent->sounds > 4) && (ent->sounds < 100) ) // custom sounds
|
||||
{
|
||||
ent->moveinfo.sound_start = gi.soundindex (va("doors/dr%02i_strt.wav", ent->sounds));
|
||||
ent->moveinfo.sound_middle = gi.soundindex (va("doors/dr%02i_mid.wav", ent->sounds));
|
||||
|
@ -2289,7 +2289,7 @@ void func_door_rot_dh_init (edict_t *ent) {
|
|||
edict_t *new_origin;
|
||||
|
||||
new_origin = G_Find (NULL, FOFS(targetname), ent->pathtarget);
|
||||
if(new_origin) {
|
||||
if (new_origin) {
|
||||
VectorCopy(new_origin->s.origin,ent->s.origin);
|
||||
VectorCopy (ent->s.origin, ent->moveinfo.start_origin);
|
||||
VectorCopy (ent->s.origin, ent->moveinfo.end_origin);
|
||||
|
@ -2305,7 +2305,7 @@ void func_door_rot_dh_init (edict_t *ent) {
|
|||
void SP_func_door_rot_dh (edict_t *ent)
|
||||
{
|
||||
SP_func_door_rotating(ent);
|
||||
if(!ent->pathtarget) return;
|
||||
if (!ent->pathtarget) return;
|
||||
|
||||
// Wait a few frames so that we're sure pathtarget has been parsed.
|
||||
ent->think = func_door_rot_dh_init;
|
||||
|
@ -2339,7 +2339,7 @@ void SP_func_water (edict_t *self)
|
|||
self->solid = SOLID_BSP;
|
||||
gi.setmodel (self, self->model);
|
||||
|
||||
if(self->spawnflags & 2)
|
||||
if (self->spawnflags & 2)
|
||||
{
|
||||
level.mud_puddles++;
|
||||
self->svflags |= SVF_MUD;
|
||||
|
@ -2418,20 +2418,21 @@ void train_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage
|
|||
{
|
||||
edict_t *e, *next;
|
||||
|
||||
if(self->deathtarget)
|
||||
if (self->deathtarget)
|
||||
{
|
||||
self->target = self->deathtarget;
|
||||
G_UseTargets (self, attacker);
|
||||
}
|
||||
e = self->movewith_next;
|
||||
while(e) {
|
||||
while (e)
|
||||
{
|
||||
next = e->movewith_next;
|
||||
e->nextthink = 0;
|
||||
if(e->takedamage)
|
||||
if (e->takedamage)
|
||||
T_Damage (e, self, self, vec3_origin, e->s.origin, vec3_origin, 100000, 1, DAMAGE_NO_PROTECTION, MOD_CRUSH);
|
||||
else if(e->die)
|
||||
else if (e->die)
|
||||
e->die(e,self,self,100000,e->s.origin);
|
||||
else if(e->solid == SOLID_NOT)
|
||||
else if (e->solid == SOLID_NOT)
|
||||
G_FreeEdict(e);
|
||||
else
|
||||
BecomeExplosion1 (e);
|
||||
|
@ -2490,7 +2491,7 @@ void train_wait (edict_t *self)
|
|||
// Lazarus: rotating trains
|
||||
if (self->target_ent)
|
||||
{
|
||||
if(self->target_ent->speed)
|
||||
if (self->target_ent->speed)
|
||||
{
|
||||
self->speed = self->target_ent->speed;
|
||||
self->moveinfo.speed = self->speed;
|
||||
|
@ -2523,7 +2524,7 @@ void train_wait (edict_t *self)
|
|||
{
|
||||
VectorClear(self->avelocity);
|
||||
VectorClear(self->velocity);
|
||||
if(self->movewith_next && (self->movewith_next->movewith_ent == self))
|
||||
if (self->movewith_next && (self->movewith_next->movewith_ent == self))
|
||||
set_child_movement(self);
|
||||
}
|
||||
|
||||
|
@ -2597,7 +2598,7 @@ void train_yaw (edict_t *self)
|
|||
if (!self || !self->enemy || !self->enemy->inuse)
|
||||
return;
|
||||
|
||||
if(self->enemy->spawnflags & TRAIN_ROTATE_CONSTANT)
|
||||
if (self->enemy->spawnflags & TRAIN_ROTATE_CONSTANT)
|
||||
{
|
||||
// The the train was changed from TRAIN_ROTATE to TRAIN_ROTATE_CONSTANT
|
||||
// by a target_change... get da hell outta here.
|
||||
|
@ -2629,7 +2630,7 @@ void train_yaw (edict_t *self)
|
|||
if ((cur_yaw == idl_yaw) && (cur_pitch == idl_pitch) && (cur_roll == idl_roll) )
|
||||
{
|
||||
self->nextthink = level.time + FRAMETIME;
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
@ -2808,7 +2809,7 @@ void train_yaw (edict_t *self)
|
|||
self->enemy->s.angles[ROLL] -= 360;
|
||||
}
|
||||
|
||||
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);
|
||||
self->nextthink = level.time + FRAMETIME;
|
||||
}
|
||||
|
@ -2854,7 +2855,7 @@ again:
|
|||
// Rroff: path_corners can control train speed
|
||||
// DHW: This shouldn't go here... we're one path_corner behind.
|
||||
// Set speed before train_next is called
|
||||
/*if(ent->speed)
|
||||
/*if (ent->speed)
|
||||
self->speed = ent->speed;
|
||||
self->moveinfo.speed = self->speed; */
|
||||
|
||||
|
@ -2874,7 +2875,7 @@ again:
|
|||
VectorCopy (self->s.origin, self->s.old_origin);
|
||||
self->s.event = EV_OTHER_TELEPORT;
|
||||
gi.linkentity (self);
|
||||
if(self->movewith_next && (self->movewith_next->movewith_ent == self))
|
||||
if (self->movewith_next && (self->movewith_next->movewith_ent == self))
|
||||
set_child_movement(self);
|
||||
goto again;
|
||||
}
|
||||
|
@ -2900,7 +2901,7 @@ again:
|
|||
VectorCopy (self->s.origin, self->moveinfo.start_origin);
|
||||
VectorCopy (dest, self->moveinfo.end_origin);
|
||||
|
||||
if(self->spawnflags & TRAIN_SPLINE)
|
||||
if (self->spawnflags & TRAIN_SPLINE)
|
||||
{
|
||||
float speed;
|
||||
int frames;
|
||||
|
@ -2912,7 +2913,7 @@ again:
|
|||
VectorSubtract(dest,self->s.origin,v);
|
||||
self->moveinfo.distance = VectorLength(v);
|
||||
frames = (int)(10 * self->moveinfo.distance/self->speed);
|
||||
if(frames < 1) frames = 1;
|
||||
if (frames < 1) frames = 1;
|
||||
speed = (10*self->moveinfo.distance)/(float)frames;
|
||||
self->moveinfo.speed = speed;
|
||||
self->moveinfo.accel = self->moveinfo.decel = self->moveinfo.speed;
|
||||
|
@ -2935,7 +2936,7 @@ again:
|
|||
vectoangles2(v,angles);
|
||||
self->ideal_yaw = angles[YAW];
|
||||
self->ideal_pitch = angles[PITCH];
|
||||
if(self->ideal_pitch < 0) self->ideal_pitch += 360;
|
||||
if (self->ideal_pitch < 0) self->ideal_pitch += 360;
|
||||
self->ideal_roll = ent->roll;
|
||||
|
||||
VectorClear(self->movedir);
|
||||
|
@ -2958,7 +2959,7 @@ again:
|
|||
// end Rroff
|
||||
|
||||
// Lazarus:
|
||||
if(self->spawnflags & TRAIN_ROTATE_CONSTANT)
|
||||
if (self->spawnflags & TRAIN_ROTATE_CONSTANT)
|
||||
{
|
||||
self->avelocity[PITCH] = self->pitch_speed;
|
||||
self->avelocity[YAW] = self->yaw_speed;
|
||||
|
@ -2995,7 +2996,7 @@ void train_resume (edict_t *self)
|
|||
Move_Calc (self, dest, train_wait);
|
||||
self->spawnflags |= TRAIN_START_ON;
|
||||
// Lazarus:
|
||||
if(self->spawnflags & TRAIN_ROTATE_CONSTANT)
|
||||
if (self->spawnflags & TRAIN_ROTATE_CONSTANT)
|
||||
{
|
||||
self->avelocity[PITCH] = self->pitch_speed;
|
||||
self->avelocity[YAW] = self->yaw_speed;
|
||||
|
@ -3022,16 +3023,16 @@ void func_train_find (edict_t *self)
|
|||
}
|
||||
|
||||
// Lazarus: trains can change speed at path_corners
|
||||
if(ent->speed) {
|
||||
if (ent->speed) {
|
||||
self->speed = ent->speed;
|
||||
self->moveinfo.speed = self->speed;
|
||||
self->moveinfo.accel = self->moveinfo.decel = self->moveinfo.speed;
|
||||
}
|
||||
if(ent->pitch_speed)
|
||||
if (ent->pitch_speed)
|
||||
self->pitch_speed = ent->pitch_speed;
|
||||
if(ent->yaw_speed)
|
||||
if (ent->yaw_speed)
|
||||
self->yaw_speed = ent->yaw_speed;
|
||||
if(ent->roll_speed)
|
||||
if (ent->roll_speed)
|
||||
self->roll_speed = ent->roll_speed;
|
||||
|
||||
// Lazarus: spline stuff
|
||||
|
@ -3047,7 +3048,7 @@ void func_train_find (edict_t *self)
|
|||
else
|
||||
VectorCopy(ent->s.origin, adjusted_pathpoint);
|
||||
|
||||
if( self->spawnflags & TRAIN_ROTATE )
|
||||
if ( self->spawnflags & TRAIN_ROTATE )
|
||||
ent->think = train_yaw;
|
||||
else if (self->spawnflags & TRAIN_SPLINE )
|
||||
ent->think = train_spline;
|
||||
|
@ -3110,7 +3111,7 @@ void train_use (edict_t *self, edict_t *other, edict_t *activator)
|
|||
{
|
||||
// Back up a step
|
||||
self->moveinfo.ratio -= self->moveinfo.speed * FRAMETIME / self->moveinfo.distance;
|
||||
if(self->moveinfo.ratio < 0.)
|
||||
if (self->moveinfo.ratio < 0.)
|
||||
self->moveinfo.ratio = 0.;
|
||||
}
|
||||
|
||||
|
@ -3127,7 +3128,7 @@ void SP_func_train (edict_t *self)
|
|||
|
||||
self->movetype = MOVETYPE_PUSH;
|
||||
|
||||
if( (self->spawnflags & (TRAIN_ROTATE | TRAIN_ROTATE_CONSTANT)) == (TRAIN_ROTATE | TRAIN_ROTATE_CONSTANT))
|
||||
if ( (self->spawnflags & (TRAIN_ROTATE | TRAIN_ROTATE_CONSTANT)) == (TRAIN_ROTATE | TRAIN_ROTATE_CONSTANT))
|
||||
{
|
||||
// gi.dprintf("%s has ROTATE and ROTATE_CONSTANT flags set.\n",
|
||||
// self->classname);
|
||||
|
@ -3210,7 +3211,7 @@ void SP_func_train (edict_t *self)
|
|||
|
||||
// Lazarus: make noise field work w/o origin brush
|
||||
// ver. 1.3 change - do this for ALL trains
|
||||
// if(st.noise && !VectorLength(self->s.origin) )
|
||||
// if (st.noise && !VectorLength(self->s.origin) )
|
||||
if (st.noise)
|
||||
{
|
||||
edict_t *speaker;
|
||||
|
@ -3227,7 +3228,7 @@ void SP_func_train (edict_t *self)
|
|||
speaker->nextthink = level.time + 2*FRAMETIME;
|
||||
speaker->spawnflags = 7; // owner must be moving to play
|
||||
self->speaker = speaker;
|
||||
if(VectorLength(self->s.origin))
|
||||
if (VectorLength(self->s.origin))
|
||||
VectorCopy(self->s.origin,speaker->s.origin);
|
||||
else {
|
||||
VectorAdd(self->absmin,self->absmax,speaker->s.origin);
|
||||
|
@ -3336,7 +3337,7 @@ void func_timer_use (edict_t *self, edict_t *other, edict_t *activator)
|
|||
if (self->nextthink)
|
||||
{
|
||||
self->count--;
|
||||
if(!self->count) {
|
||||
if (!self->count) {
|
||||
self->think = G_FreeEdict;
|
||||
self->nextthink = level.time + 1;
|
||||
} else {
|
||||
|
@ -3418,7 +3419,7 @@ void SP_func_conveyor (edict_t *self)
|
|||
// Lazarus changes:
|
||||
self->movetype = MOVETYPE_CONVEYOR;
|
||||
G_SetMovedir(self->s.angles,self->movedir);
|
||||
if(self->spawnflags & 1)
|
||||
if (self->spawnflags & 1)
|
||||
self->solid = SOLID_BSP;
|
||||
else {
|
||||
self->solid = SOLID_NOT;
|
||||
|
@ -3607,7 +3608,7 @@ void SP_func_door_secret (edict_t *ent)
|
|||
|
||||
ent->class_id = ENTITY_FUNC_DOOR_SECRET;
|
||||
|
||||
if (ent->sounds > 4 && ent->sounds < 100) // custom sounds
|
||||
if ( !IsIdMap() && (ent->sounds > 4) && (ent->sounds < 100) ) // custom sounds
|
||||
{
|
||||
ent->moveinfo.sound_start = gi.soundindex (va("doors/dr%02i_strt.wav", ent->sounds));
|
||||
ent->moveinfo.sound_middle = gi.soundindex (va("doors/dr%02i_mid.wav", ent->sounds));
|
||||
|
@ -3694,7 +3695,7 @@ void use_killbox (edict_t *self, edict_t *other, edict_t *activator)
|
|||
KillBox (self);
|
||||
|
||||
self->count--;
|
||||
if(!self->count) {
|
||||
if (!self->count) {
|
||||
self->think = G_FreeEdict;
|
||||
self->nextthink = level.time + 1;
|
||||
}
|
||||
|
@ -3819,10 +3820,10 @@ qboolean box_movestep (edict_t *ent, vec3_t move, qboolean relink)
|
|||
|
||||
void box_die (edict_t *self, edict_t *inflictor, edict_t *attacker, int damage, vec3_t point)
|
||||
{
|
||||
if(self->deathtarget)
|
||||
if (self->deathtarget)
|
||||
{
|
||||
self->target = self->deathtarget;
|
||||
if(self->activator)
|
||||
if (self->activator)
|
||||
G_UseTargets (self, self->activator);
|
||||
else
|
||||
G_UseTargets (self, attacker);
|
||||
|
@ -3876,9 +3877,9 @@ void box_water_friction(edict_t *ent)
|
|||
ent->nextthink = 0;
|
||||
return;
|
||||
}
|
||||
for(i=0; i<2; i++)
|
||||
for (i=0; i<2; i++)
|
||||
{
|
||||
if(ent->velocity[i] != 0)
|
||||
if (ent->velocity[i] != 0)
|
||||
{
|
||||
speed = fabs(ent->velocity[i]);
|
||||
control = speed < 100 ? 100 : speed;
|
||||
|
@ -3927,7 +3928,7 @@ void box_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *surf
|
|||
VectorSubtract(self->s.origin,other->s.origin,dir);
|
||||
VectorNormalize(dir);
|
||||
T_Damage (self, other, other, dir, self->s.origin, vec3_origin, damage, 0, 0, MOD_FALLING);
|
||||
if(self->health <= 0) return;
|
||||
if (self->health <= 0) return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4286,7 +4287,7 @@ void SP_func_bobbingwater(edict_t *self)
|
|||
self->solid = SOLID_BSP;
|
||||
gi.setmodel (self, self->model);
|
||||
|
||||
if(self->spawnflags & 2)
|
||||
if (self->spawnflags & 2)
|
||||
{
|
||||
level.mud_puddles++;
|
||||
self->svflags |= SVF_MUD;
|
||||
|
@ -4347,8 +4348,8 @@ void SP_func_bobbingwater(edict_t *self)
|
|||
self->classname = "func_door";
|
||||
self->flags |= FL_BOB;
|
||||
|
||||
if(!self->bob) self->bob = 16;
|
||||
if(!self->duration) self->duration = 8;
|
||||
if (!self->bob) self->bob = 16;
|
||||
if (!self->duration) self->duration = 8;
|
||||
self->think = bob_init;
|
||||
self->nextthink = level.time + FRAMETIME;
|
||||
gi.linkentity (self);
|
||||
|
@ -4376,18 +4377,18 @@ void pivot_touch(edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf
|
|||
vec3_t avelocity;
|
||||
vec3_t delta;
|
||||
|
||||
if(!other->mass) return; // other is weightless
|
||||
if(!other->groundentity) return; // other is in air
|
||||
if(other->groundentity != ent) return; // other is not standing on ent
|
||||
if (!other->mass) return; // other is weightless
|
||||
if (!other->groundentity) return; // other is in air
|
||||
if (other->groundentity != ent) return; // other is not standing on ent
|
||||
|
||||
VectorSubtract(ent->s.origin,other->s.origin,offset);
|
||||
offset[2] = 0.; // z offset is irrelevant
|
||||
VectorCopy(ent->avelocity,avelocity);
|
||||
if(ent->spawnflags & 1)
|
||||
if (ent->spawnflags & 1)
|
||||
{
|
||||
avelocity[PITCH] = -other->mass*offset[0]/400;
|
||||
// if(avelocity[PITCH] = ent->avelocity[PITCH]) return;
|
||||
if(offset[0] > 0)
|
||||
// if (avelocity[PITCH] = ent->avelocity[PITCH]) return;
|
||||
if (offset[0] > 0)
|
||||
ent->move_angles[PITCH] = ent->pos2[PITCH];
|
||||
else
|
||||
ent->move_angles[PITCH] = ent->pos1[PITCH];
|
||||
|
@ -4397,8 +4398,8 @@ void pivot_touch(edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf
|
|||
else
|
||||
{
|
||||
avelocity[ROLL] = other->mass*offset[1]/400;
|
||||
// if(avelocity[ROLL] = ent->avelocity[ROLL]) return;
|
||||
if(offset[1] > 0)
|
||||
// if (avelocity[ROLL] = ent->avelocity[ROLL]) return;
|
||||
if (offset[1] > 0)
|
||||
ent->move_angles[ROLL] = ent->pos1[ROLL];
|
||||
else
|
||||
ent->move_angles[ROLL] = ent->pos2[ROLL];
|
||||
|
@ -4406,7 +4407,7 @@ void pivot_touch(edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf
|
|||
time = delta[ROLL]/avelocity[ROLL];
|
||||
}
|
||||
gi.dprintf("time=%f, v=%f %f %f\n",time,avelocity[0],avelocity[1],avelocity[2]);
|
||||
if(time > 0)
|
||||
if (time > 0)
|
||||
{
|
||||
VectorCopy(avelocity,ent->avelocity);
|
||||
ent->think = pivot_stop;
|
||||
|
@ -4427,14 +4428,14 @@ void pivot_init (edict_t *ent)
|
|||
|
||||
VectorClear(ent->pos1);
|
||||
VectorClear(ent->pos2);
|
||||
if(ent->spawnflags & 1)
|
||||
if (ent->spawnflags & 1)
|
||||
{
|
||||
end[0] = start[0] = ent->absmin[0];
|
||||
end[1] = start[1] = (ent->absmin[1]+ent->absmax[1])/2;
|
||||
start[2] = ent->absmin[2];
|
||||
end[2] = ent->absmin[2] - (ent->s.origin[0]-ent->absmin[0]);
|
||||
tr=gi.trace(start,NULL,NULL,end,ent,MASK_SOLID);
|
||||
if(tr.fraction < 1.0)
|
||||
if (tr.fraction < 1.0)
|
||||
zmin = tr.endpos[2];
|
||||
else
|
||||
zmin = end[2];
|
||||
|
@ -4443,7 +4444,7 @@ void pivot_init (edict_t *ent)
|
|||
end[0] = start[0] = ent->absmax[0];
|
||||
end[2] = ent->absmin[2] - (ent->absmax[0]-ent->s.origin[0]);
|
||||
tr=gi.trace(start,NULL,NULL,end,ent,MASK_SOLID);
|
||||
if(tr.fraction < 1.0)
|
||||
if (tr.fraction < 1.0)
|
||||
zmin = tr.endpos[2];
|
||||
else
|
||||
zmin = end[2];
|
||||
|
@ -4459,7 +4460,7 @@ void pivot_init (edict_t *ent)
|
|||
start[2] = ent->absmin[2];
|
||||
end[2] = ent->absmin[2] - (ent->s.origin[1]-ent->absmin[1]);
|
||||
tr=gi.trace(start,NULL,NULL,end,ent,MASK_SOLID);
|
||||
if(tr.fraction < 1.0)
|
||||
if (tr.fraction < 1.0)
|
||||
zmin = tr.endpos[2];
|
||||
else
|
||||
zmin = end[2];
|
||||
|
@ -4468,7 +4469,7 @@ void pivot_init (edict_t *ent)
|
|||
end[1] = start[1] = ent->absmax[1];
|
||||
end[2] = ent->absmin[2] - (ent->absmax[1]-ent->s.origin[1]);
|
||||
tr=gi.trace(start,NULL,NULL,end,ent,MASK_SOLID);
|
||||
if(tr.fraction < 1.0)
|
||||
if (tr.fraction < 1.0)
|
||||
zmin = tr.endpos[2];
|
||||
else
|
||||
zmin = end[2];
|
||||
|
@ -4509,7 +4510,7 @@ void SP_func_pivot (edict_t *ent)
|
|||
|
||||
void force_wall_think(edict_t *self)
|
||||
{
|
||||
if(!self->wait)
|
||||
if (!self->wait)
|
||||
{
|
||||
gi.WriteByte (svc_temp_entity);
|
||||
gi.WriteByte (TE_FORCEWALL);
|
||||
|
@ -4535,7 +4536,7 @@ void func_force_wall_touch (edict_t *self, edict_t *other, cplane_t *plane, csur
|
|||
|
||||
void force_wall_use (edict_t *self, edict_t *other, edict_t *activator)
|
||||
{
|
||||
if(!self->wait)
|
||||
if (!self->wait)
|
||||
{
|
||||
self->wait = 1;
|
||||
self->think = NULL;
|
||||
|
@ -4545,7 +4546,7 @@ void force_wall_use (edict_t *self, edict_t *other, edict_t *activator)
|
|||
gi.linkentity( self );
|
||||
|
||||
self->count--;
|
||||
if(!self->count) {
|
||||
if (!self->count) {
|
||||
self->think = G_FreeEdict;
|
||||
self->nextthink = level.time + 1;
|
||||
}
|
||||
|
@ -4557,7 +4558,7 @@ void force_wall_use (edict_t *self, edict_t *other, edict_t *activator)
|
|||
self->think = force_wall_think;
|
||||
self->nextthink = level.time + 0.1;
|
||||
self->solid = SOLID_BSP;
|
||||
if(self->dmg)
|
||||
if (self->dmg)
|
||||
self->touch = func_force_wall_touch;
|
||||
KillBox(self); // Is this appropriate?
|
||||
gi.linkentity (self);
|
||||
|
@ -4584,7 +4585,7 @@ void SP_func_force_wall(edict_t *ent)
|
|||
|
||||
ent->pos1[2] = ent->absmax[2];
|
||||
ent->pos2[2] = ent->absmax[2];
|
||||
if(ent->size[0] > ent->size[1])
|
||||
if (ent->size[0] > ent->size[1])
|
||||
{
|
||||
ent->pos1[0] = ent->absmin[0];
|
||||
ent->pos2[0] = ent->absmax[0];
|
||||
|
@ -4599,15 +4600,15 @@ void SP_func_force_wall(edict_t *ent)
|
|||
ent->pos2[1] = ent->absmax[1];
|
||||
}
|
||||
|
||||
if(!ent->style)
|
||||
if (!ent->style)
|
||||
ent->style = 208;
|
||||
|
||||
ent->movetype = MOVETYPE_NONE;
|
||||
|
||||
if(ent->spawnflags & FWALL_START_ON)
|
||||
if (ent->spawnflags & FWALL_START_ON)
|
||||
{
|
||||
ent->solid = SOLID_BSP;
|
||||
if(ent->dmg)
|
||||
if (ent->dmg)
|
||||
ent->touch = func_force_wall_touch;
|
||||
ent->think = force_wall_think;
|
||||
ent->nextthink = level.time + FRAMETIME;
|
||||
|
@ -4707,7 +4708,7 @@ void func_door_swinging_init (edict_t *self)
|
|||
if (self->pathtarget)
|
||||
{
|
||||
new_origin = G_Find (NULL, FOFS(targetname), self->pathtarget);
|
||||
if(new_origin)
|
||||
if (new_origin)
|
||||
{
|
||||
VectorCopy (new_origin->s.origin,self->s.origin);
|
||||
VectorCopy (self->s.origin, self->moveinfo.start_origin);
|
||||
|
|
|
@ -1108,7 +1108,7 @@ qboolean M_CheckAttack (edict_t *self)
|
|||
if ((!(tr.ent->svflags & SVF_MONSTER)) && (!visible(self, self->enemy)))
|
||||
{ // Knightmare- disable blindfire for Zaero maps, as it causes undesired behavior in zdef4
|
||||
// if ((self->monsterinfo.blindfire) && (self->monsterinfo.blind_fire_delay <= 20.0))
|
||||
if ( !IsZaeroMap() && (self->monsterinfo.blindfire) && (self->monsterinfo.blind_fire_delay <= 20.0) )
|
||||
if ( (level.maptype != MAPTYPE_ZAERO) && (self->monsterinfo.blindfire) && (self->monsterinfo.blind_fire_delay <= 20.0) )
|
||||
{
|
||||
if (level.time < self->monsterinfo.attack_finished)
|
||||
{
|
||||
|
|
|
@ -161,7 +161,7 @@ void Killed (edict_t *targ, edict_t *inflictor, edict_t *attacker, int damage, v
|
|||
// if (!(targ->monsterinfo.aiflags & AI_GOOD_GUY) && !(targ->monsterinfo.aiflags & AI_DO_NOT_COUNT))
|
||||
// if ( !(targ->monsterinfo.aiflags & AI_GOOD_GUY) && !(targ->monsterinfo.monsterflags & MFL_DO_NOT_COUNT) )
|
||||
// Zaero- spawnflag 16 = do not count
|
||||
if ( !(targ->monsterinfo.aiflags & AI_GOOD_GUY) && !(targ->monsterinfo.monsterflags & MFL_DO_NOT_COUNT) && !(IsZaeroMap() && (targ->spawnflags & 16)) )
|
||||
if ( !(targ->monsterinfo.aiflags & AI_GOOD_GUY) && !(targ->monsterinfo.monsterflags & MFL_DO_NOT_COUNT) && !( (level.maptype == MAPTYPE_ZAERO) && (targ->spawnflags & 16) ) )
|
||||
{
|
||||
level.killed_monsters++;
|
||||
if (coop->value && attacker->client)
|
||||
|
@ -841,8 +841,8 @@ void M_ReactToDamage (edict_t *targ, edict_t *attacker, edict_t *inflictor)
|
|||
if ( ( (targ->flags & (FL_FLY|FL_SWIM)) == (attacker->flags & (FL_FLY|FL_SWIM)) ) &&
|
||||
(strcmp(targ->classname, attacker->classname) != 0) &&
|
||||
!(attacker->monsterinfo.aiflags & AI_IGNORE_SHOTS) &&
|
||||
!(targ->monsterinfo.aiflags & AI_IGNORE_SHOTS) &&
|
||||
!( IsZaeroMap() && attacker->mteam && targ->mteam && (strcmp(attacker->mteam, targ->mteam) == 0) ) // Zaero- added monster team field
|
||||
!(targ->monsterinfo.aiflags & AI_IGNORE_SHOTS) &&
|
||||
!( (level.maptype == MAPTYPE_ZAERO) && attacker->mteam && targ->mteam && (strcmp(attacker->mteam, targ->mteam) == 0) ) // Zaero- added monster team field
|
||||
)
|
||||
{
|
||||
if (targ->enemy && targ->enemy->client)
|
||||
|
|
|
@ -1050,7 +1050,7 @@ void SP_func_plat (edict_t *ent)
|
|||
VectorCopy (ent->s.angles, ent->moveinfo.end_angles);
|
||||
ent->moveinfo.distance = ent->pos1[2] - ent->pos2[2]; //Knightmare- store distance
|
||||
|
||||
if (ent->sounds > 1 && ent->sounds < 100) // custom sounds
|
||||
if ( (level.maptype == MAPTYPE_CUSTOM) && (ent->sounds > 1) && (ent->sounds < 100) ) // custom sounds
|
||||
{
|
||||
ent->moveinfo.sound_start = gi.soundindex (va("plats/pt%02i_strt.wav", ent->sounds));
|
||||
ent->moveinfo.sound_middle = gi.soundindex (va("plats/pt%02i_mid.wav", ent->sounds));
|
||||
|
@ -1506,7 +1506,7 @@ void SP_func_plat2 (edict_t *ent)
|
|||
VectorCopy (ent->s.angles, ent->moveinfo.end_angles);
|
||||
ent->moveinfo.distance = ent->pos1[2] - ent->pos2[2]; // Knightmare- store distance
|
||||
|
||||
if (ent->sounds > 1 && ent->sounds < 100) // custom sounds
|
||||
if ( (level.maptype == MAPTYPE_CUSTOM) && (ent->sounds > 1) && (ent->sounds < 100) ) // custom sounds
|
||||
{
|
||||
ent->moveinfo.sound_start = gi.soundindex (va("plats/pt%02i_strt.wav", ent->sounds));
|
||||
ent->moveinfo.sound_middle = gi.soundindex (va("plats/pt%02i_mid.wav", ent->sounds));
|
||||
|
@ -1847,7 +1847,7 @@ void SP_func_button (edict_t *ent)
|
|||
ent->solid = SOLID_BSP;
|
||||
gi.setmodel (ent, ent->model);
|
||||
|
||||
if (ent->sounds > 1 && ent->sounds < 100) // custom sounds
|
||||
if ( (level.maptype == MAPTYPE_CUSTOM) && (ent->sounds > 1) && (ent->sounds < 100) ) // custom sounds
|
||||
ent->moveinfo.sound_start = gi.soundindex (va("switches/butn%02i.wav", ent->sounds));
|
||||
else if (ent->sounds != 1)
|
||||
ent->moveinfo.sound_start = gi.soundindex ("switches/butn2.wav");
|
||||
|
@ -2023,7 +2023,7 @@ void SP_func_trainbutton (edict_t *ent)
|
|||
ent->solid = SOLID_BSP;
|
||||
gi.setmodel (ent, ent->model);
|
||||
|
||||
if (ent->sounds > 1 && ent->sounds < 100) // custom sounds
|
||||
if ( (ent->sounds > 1) && (ent->sounds < 100) ) // custom sounds
|
||||
ent->moveinfo.sound_start = gi.soundindex (va("switches/butn%02i.wav", ent->sounds));
|
||||
else if (ent->sounds != 1)
|
||||
ent->moveinfo.sound_start = gi.soundindex ("switches/butn2.wav");
|
||||
|
@ -2388,7 +2388,7 @@ void door_use (edict_t *self, edict_t *other, edict_t *activator)
|
|||
return;
|
||||
|
||||
// Knightmare- Zaero-specific door handling
|
||||
if ( IsZaeroMap() )
|
||||
if (level.maptype == MAPTYPE_ZAERO)
|
||||
{
|
||||
if (self->active & DOOR_ACTIVE_TOGGLE)
|
||||
{
|
||||
|
@ -2471,7 +2471,7 @@ void Touch_DoorTrigger (edict_t *self, edict_t *other, cplane_t *plane, csurface
|
|||
return;
|
||||
|
||||
// Zaero
|
||||
if ( IsZaeroMap() )
|
||||
if (level.maptype == MAPTYPE_ZAERO)
|
||||
{
|
||||
if ( (self->owner->active & DOOR_ACTIVE_TOGGLE) &&
|
||||
!(self->owner->active & DOOR_ACTIVE_ON) )
|
||||
|
@ -2482,7 +2482,7 @@ void Touch_DoorTrigger (edict_t *self, edict_t *other, cplane_t *plane, csurface
|
|||
self->touch_debounce_time = level.time + 1.0;
|
||||
|
||||
// Zaero
|
||||
if ( IsZaeroMap() ) {
|
||||
if (level.maptype == MAPTYPE_ZAERO) {
|
||||
door_openclose (self->owner, other, other);
|
||||
}
|
||||
else {
|
||||
|
@ -2644,8 +2644,8 @@ void door_touch (edict_t *self, edict_t *other, cplane_t *plane, csurface_t *sur
|
|||
if (!other->client)
|
||||
return;
|
||||
|
||||
// Zaero
|
||||
if ( IsZaeroMap() && (self->message == NULL) )
|
||||
// Zaero
|
||||
if ( (level.maptype == MAPTYPE_ZAERO) && (self->message == NULL) )
|
||||
return;
|
||||
|
||||
if (level.time < self->touch_debounce_time)
|
||||
|
@ -2663,7 +2663,7 @@ void SP_func_door (edict_t *ent)
|
|||
|
||||
ent->class_id = ENTITY_FUNC_DOOR;
|
||||
|
||||
if (ent->sounds > 4 && ent->sounds < 100) // custom sounds
|
||||
if ( (level.maptype == MAPTYPE_CUSTOM) && (ent->sounds > 4) && (ent->sounds < 100) ) // custom sounds
|
||||
{
|
||||
ent->moveinfo.sound_start = gi.soundindex (va("doors/dr%02i_strt.wav", ent->sounds));
|
||||
ent->moveinfo.sound_middle = gi.soundindex (va("doors/dr%02i_mid.wav", ent->sounds));
|
||||
|
@ -2805,7 +2805,7 @@ void SP_func_door (edict_t *ent)
|
|||
gi.linkentity (ent);
|
||||
|
||||
// Zaero
|
||||
if ( IsZaeroMap() )
|
||||
if (level.maptype == MAPTYPE_ZAERO)
|
||||
{ // toggle active
|
||||
if (!(ent->active & DOOR_ACTIVE_TOGGLE))
|
||||
ent->active = 0;
|
||||
|
@ -2816,7 +2816,7 @@ void SP_func_door (edict_t *ent)
|
|||
ent->nextthink = level.time + FRAMETIME;
|
||||
|
||||
// Zaero
|
||||
if ( IsZaeroMap() )
|
||||
if (level.maptype == MAPTYPE_ZAERO)
|
||||
{
|
||||
if ( (ent->health || ent->targetname) && !(ent->active & DOOR_ACTIVE_TOGGLE) )
|
||||
ent->think = Think_CalcMoveSpeed;
|
||||
|
@ -2934,7 +2934,7 @@ void SP_func_door_rotating (edict_t *ent)
|
|||
if (!ent->dmg)
|
||||
ent->dmg = 2;
|
||||
|
||||
if (ent->sounds > 4 && ent->sounds < 100) // custom sounds
|
||||
if ( (level.maptype == MAPTYPE_CUSTOM) && (ent->sounds > 4) && (ent->sounds < 100) ) // custom sounds
|
||||
{
|
||||
ent->moveinfo.sound_start = gi.soundindex (va("doors/dr%02i_strt.wav", ent->sounds));
|
||||
ent->moveinfo.sound_middle = gi.soundindex (va("doors/dr%02i_mid.wav", ent->sounds));
|
||||
|
@ -3894,8 +3894,8 @@ void train_wait (edict_t *self)
|
|||
}
|
||||
|
||||
// Lazarus: rotating trains
|
||||
if (self->target_ent && !(IsRogueMap()))
|
||||
{ //Knightmare- skip this for Rogue maps
|
||||
if ( self->target_ent && (level.maptype != MAPTYPE_ROGUE) ) // Knightmare- skip this for Rogue maps
|
||||
{
|
||||
// train speed changes are handled differently
|
||||
if (self->target_ent->speed)
|
||||
{
|
||||
|
@ -3943,7 +3943,7 @@ void train_wait (edict_t *self)
|
|||
else if (self->spawnflags & TRAIN_TOGGLE) // && wait < 0
|
||||
{
|
||||
// PMM - clear target_ent, let train_next get called when we get used
|
||||
if (IsRogueMap()) // Knightmare- only do this for Rogue maps
|
||||
if (level.maptype == MAPTYPE_ROGUE) // Knightmare- only do this for Rogue maps
|
||||
self->target_ent = NULL;
|
||||
else
|
||||
train_next (self);
|
||||
|
@ -4310,7 +4310,7 @@ again:
|
|||
// Set speed before train_next is called
|
||||
// Knightmare- this is only used for Rogue maps
|
||||
// train speed changes are handled differently
|
||||
if ((ent->speed) && IsRogueMap())
|
||||
if ( (ent->speed) && (level.maptype == MAPTYPE_ROGUE))
|
||||
{
|
||||
self->speed = ent->speed;
|
||||
self->moveinfo.speed = ent->speed;
|
||||
|
@ -4324,7 +4324,7 @@ again:
|
|||
self->moveinfo.decel = ent->speed;
|
||||
self->moveinfo.current_speed = 0;
|
||||
}
|
||||
//PGM
|
||||
// PGM
|
||||
|
||||
self->moveinfo.wait = ent->wait;
|
||||
self->target_ent = ent;
|
||||
|
@ -4402,7 +4402,7 @@ again:
|
|||
self->spawnflags |= TRAIN_START_ON;
|
||||
|
||||
//PGM
|
||||
if (self->team && IsRogueMap())
|
||||
if ( self->team && (level.maptype == MAPTYPE_ROGUE) )
|
||||
{
|
||||
edict_t *e;
|
||||
vec3_t dir, dst;
|
||||
|
@ -5193,7 +5193,7 @@ void SP_func_door_secret (edict_t *ent)
|
|||
|
||||
ent->class_id = ENTITY_FUNC_DOOR_SECRET;
|
||||
|
||||
if (ent->sounds > 4 && ent->sounds < 100) // custom sounds
|
||||
if ( (level.maptype == MAPTYPE_CUSTOM) && (ent->sounds > 4) && (ent->sounds < 100) ) // custom sounds
|
||||
{
|
||||
ent->moveinfo.sound_start = gi.soundindex (va("doors/dr%02i_strt.wav", ent->sounds));
|
||||
ent->moveinfo.sound_middle = gi.soundindex (va("doors/dr%02i_mid.wav", ent->sounds));
|
||||
|
|
|
@ -1648,6 +1648,7 @@ extern float PointDist ( vec3_t x , vec3_t y ) ;
|
|||
extern qboolean UseRegularGoodGuyFlag ( edict_t * monster ) ;
|
||||
extern qboolean UseSpecialGoodGuyFlag ( edict_t * monster ) ;
|
||||
extern qboolean CheckCoop_MapHacks ( edict_t * ent ) ;
|
||||
extern qboolean IsZaeroRailgunHackMap ( void ) ;
|
||||
extern qboolean IsZaeroMap ( void ) ;
|
||||
extern qboolean IsRogueMap ( void ) ;
|
||||
extern qboolean IsXatrixMap ( void ) ;
|
||||
|
@ -1904,7 +1905,7 @@ extern edict_t * CreateFlyMonster ( vec3_t origin , vec3_t angles , vec3_t mins
|
|||
extern edict_t * CreateMonster ( vec3_t origin , vec3_t angles , char * classname ) ;
|
||||
extern void SP_worldspawn ( edict_t * ent ) ;
|
||||
extern void SpawnEntities ( char * mapname , char * entities , char * spawnpoint ) ;
|
||||
extern void LoadTransitionEnts ( ) ;
|
||||
extern void LoadTransitionEnts ( void ) ;
|
||||
extern void G_FindTeams ( void ) ;
|
||||
extern void G_FixTeams ( void ) ;
|
||||
extern char * ED_ParseEdict ( char * data , edict_t * ent ) ;
|
||||
|
|
|
@ -1648,6 +1648,7 @@
|
|||
{"UseRegularGoodGuyFlag", (byte *)UseRegularGoodGuyFlag},
|
||||
{"UseSpecialGoodGuyFlag", (byte *)UseSpecialGoodGuyFlag},
|
||||
{"CheckCoop_MapHacks", (byte *)CheckCoop_MapHacks},
|
||||
{"IsZaeroRailgunHackMap", (byte *)IsZaeroRailgunHackMap},
|
||||
{"IsZaeroMap", (byte *)IsZaeroMap},
|
||||
{"IsRogueMap", (byte *)IsRogueMap},
|
||||
{"IsXatrixMap", (byte *)IsXatrixMap},
|
||||
|
|
|
@ -443,8 +443,6 @@ typedef struct gitem_s
|
|||
char *precaches; // string of all models, sounds, and images this item will use
|
||||
} gitem_t;
|
||||
|
||||
|
||||
|
||||
//
|
||||
// this structure is left intact through an entire game
|
||||
// it should be initialized at dll load time, and read/written to
|
||||
|
@ -477,7 +475,6 @@ typedef struct
|
|||
// Lazarus: number of entities moved between maps (not counting players)
|
||||
int transition_ents;
|
||||
|
||||
|
||||
// items
|
||||
int num_items;
|
||||
|
||||
|
@ -500,6 +497,15 @@ struct fog_s
|
|||
};
|
||||
typedef struct fog_s fog_t;
|
||||
|
||||
// Knightmare- map vendor for pack-specific code changes
|
||||
typedef enum
|
||||
{
|
||||
MAPTYPE_ID,
|
||||
MAPTYPE_XATRIX,
|
||||
MAPTYPE_ROGUE,
|
||||
MAPTYPE_ZAERO,
|
||||
MAPTYPE_CUSTOM
|
||||
} maptype_t;
|
||||
|
||||
//
|
||||
// this structure is cleared as each map is entered
|
||||
|
@ -571,7 +577,10 @@ typedef struct
|
|||
|
||||
// Zaero
|
||||
int fadeFrames;
|
||||
// end Zaero
|
||||
|
||||
// Knightmare- for map-specific logic switching
|
||||
maptype_t maptype; // map vendor for pack-specific code changes
|
||||
qboolean isZaeroRailgunHackMap; // railgun thru window hack for zdef4
|
||||
} level_locals_t;
|
||||
|
||||
|
||||
|
@ -1220,6 +1229,7 @@ qboolean IsIdMap (void); // Knightmare added
|
|||
qboolean IsXatrixMap (void); // Knightmare added
|
||||
qboolean IsRogueMap (void); // Knightmare added
|
||||
qboolean IsZaeroMap (void); // Knightmare added
|
||||
qboolean IsZaeroRailgunHackMap (void); // Knightmare added
|
||||
qboolean CheckCoop_MapHacks (edict_t *ent); // FS: Coop: Check if we have to modify some stuff for coop so we don't have to rely on distributing ent files
|
||||
qboolean UseSpecialGoodGuyFlag (edict_t *monster); // Knightmare added
|
||||
qboolean UseRegularGoodGuyFlag (edict_t *monster); // Knightmare added
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1076,7 +1076,7 @@ void monster_triggered_spawn (edict_t *self)
|
|||
// end Knightmare
|
||||
|
||||
// Zaero add
|
||||
/* if ( IsZaeroMap() ) {
|
||||
/* if (level.maptype == MAPTYPE_ZAERO) {
|
||||
self->s.event = EV_PLAYER_TELEPORT;
|
||||
MonsterPlayerKillBox (self);
|
||||
}*/
|
||||
|
@ -1225,7 +1225,7 @@ qboolean monster_start (edict_t *self)
|
|||
// if ( !(self->monsterinfo.aiflags & AI_GOOD_GUY) && !(self->monsterinfo.aiflags & AI_DO_NOT_COUNT) )
|
||||
// if ( !(self->monsterinfo.aiflags & AI_GOOD_GUY) && !(self->monsterinfo.monsterflags & MFL_DO_NOT_COUNT)/* && !(self->spawnflags & SF_MONSTER_TRIGGER_SPAWN*/ )
|
||||
// Zaero- spawnflag 16 = do not count
|
||||
if ( !(self->monsterinfo.aiflags & AI_GOOD_GUY) && !(self->monsterinfo.monsterflags & MFL_DO_NOT_COUNT) && !(IsZaeroMap() && (self->spawnflags & 16)) )
|
||||
if ( !(self->monsterinfo.aiflags & AI_GOOD_GUY) && !(self->monsterinfo.monsterflags & MFL_DO_NOT_COUNT) && !( (level.maptype == MAPTYPE_ZAERO) && (self->spawnflags & 16) ) )
|
||||
level.total_monsters++;
|
||||
|
||||
self->nextthink = level.time + FRAMETIME;
|
||||
|
|
|
@ -206,9 +206,18 @@ void SP_func_door_secret2 (edict_t *ent)
|
|||
|
||||
ent->class_id = ENTITY_FUNC_DOOR_SECRET2;
|
||||
|
||||
ent->moveinfo.sound_start = gi.soundindex ("doors/dr1_strt.wav");
|
||||
ent->moveinfo.sound_middle = gi.soundindex ("doors/dr1_mid.wav");
|
||||
ent->moveinfo.sound_end = gi.soundindex ("doors/dr1_end.wav");
|
||||
if ( (level.maptype == MAPTYPE_CUSTOM) && (ent->sounds > 4) && (ent->sounds < 100) ) // custom sounds
|
||||
{
|
||||
ent->moveinfo.sound_start = gi.soundindex (va("doors/dr%02i_strt.wav", ent->sounds));
|
||||
ent->moveinfo.sound_middle = gi.soundindex (va("doors/dr%02i_mid.wav", ent->sounds));
|
||||
ent->moveinfo.sound_end = gi.soundindex (va("doors/dr%02i_end.wav", ent->sounds));
|
||||
}
|
||||
else
|
||||
{
|
||||
ent->moveinfo.sound_start = gi.soundindex ("doors/dr1_strt.wav");
|
||||
ent->moveinfo.sound_middle = gi.soundindex ("doors/dr1_mid.wav");
|
||||
ent->moveinfo.sound_end = gi.soundindex ("doors/dr1_end.wav");
|
||||
}
|
||||
|
||||
if (!ent->dmg)
|
||||
ent->dmg = 2;
|
||||
|
|
|
@ -810,7 +810,7 @@ void ED_CallSpawn (edict_t *ent)
|
|||
// replace brains in Reckoning
|
||||
gamedir = gi.cvar("game", "", 0);
|
||||
if (gamedir->string && !Q_stricmp(gamedir->string, "xatrix")
|
||||
&& IsXatrixMap() && !strcmp(ent->classname, "monster_brain"))
|
||||
&& (level.maptype == MAPTYPE_XATRIX) && !strcmp(ent->classname, "monster_brain"))
|
||||
ent->classname = "monster_brain_beta";
|
||||
|
||||
// Knightmare- mission pack monster replacement
|
||||
|
@ -1426,7 +1426,7 @@ void G_FixTeams (void)
|
|||
continue;
|
||||
if (!strcmp(e->classname, "func_train"))
|
||||
{
|
||||
if(e->flags & FL_TEAMSLAVE)
|
||||
if (e->flags & FL_TEAMSLAVE)
|
||||
{
|
||||
chain = e;
|
||||
e->teammaster = e;
|
||||
|
@ -1506,11 +1506,11 @@ void G_FindTeams (void)
|
|||
|
||||
void trans_ent_filename (char *filename, size_t filenameSize);
|
||||
void ReadEdict (FILE *f, edict_t *ent);
|
||||
void LoadTransitionEnts()
|
||||
void LoadTransitionEnts (void)
|
||||
{
|
||||
if(developer->value)
|
||||
if (developer->value)
|
||||
gi.dprintf("==== LoadTransitionEnts ====\n");
|
||||
if(game.transition_ents)
|
||||
if (game.transition_ents)
|
||||
{
|
||||
char t_file[MAX_QPATH];
|
||||
int i, j;
|
||||
|
@ -1520,12 +1520,12 @@ void LoadTransitionEnts()
|
|||
edict_t *spawn;
|
||||
|
||||
VectorClear(v_spawn);
|
||||
if(strlen(game.spawnpoint))
|
||||
if (strlen(game.spawnpoint))
|
||||
{
|
||||
spawn = G_Find(NULL,FOFS(targetname),game.spawnpoint);
|
||||
while(spawn)
|
||||
while (spawn)
|
||||
{
|
||||
if(!Q_stricmp(spawn->classname,"info_player_start"))
|
||||
if (!Q_stricmp(spawn->classname,"info_player_start"))
|
||||
{
|
||||
VectorCopy(spawn->s.origin,v_spawn);
|
||||
break;
|
||||
|
@ -1535,25 +1535,25 @@ void LoadTransitionEnts()
|
|||
}
|
||||
trans_ent_filename (t_file, sizeof(t_file));
|
||||
f = fopen(t_file,"rb");
|
||||
if(!f)
|
||||
if (!f)
|
||||
gi.error("LoadTransitionEnts: Cannot open %s\n",t_file);
|
||||
else
|
||||
{
|
||||
for(i=0; i<game.transition_ents; i++)
|
||||
for (i=0; i<game.transition_ents; i++)
|
||||
{
|
||||
ent = G_Spawn();
|
||||
ReadEdict(f,ent);
|
||||
// Correction for monsters with health EXACTLY 0
|
||||
// If we don't do this, spawn function will bring
|
||||
// 'em back to life
|
||||
if(ent->svflags & SVF_MONSTER)
|
||||
if (ent->svflags & SVF_MONSTER)
|
||||
{
|
||||
if(!ent->health)
|
||||
if (!ent->health)
|
||||
{
|
||||
ent->health = -1;
|
||||
ent->deadflag = DEAD_DEAD;
|
||||
}
|
||||
else if(ent->deadflag == DEAD_DEAD)
|
||||
else if (ent->deadflag == DEAD_DEAD)
|
||||
{
|
||||
ent->health = min(ent->health,-1);
|
||||
}
|
||||
|
@ -1561,9 +1561,9 @@ void LoadTransitionEnts()
|
|||
VectorAdd(ent->s.origin,v_spawn,ent->s.origin);
|
||||
VectorCopy(ent->s.origin,ent->s.old_origin);
|
||||
ED_CallSpawn (ent);
|
||||
if(ent->owner_id)
|
||||
if (ent->owner_id)
|
||||
{
|
||||
if(ent->owner_id < 0)
|
||||
if (ent->owner_id < 0)
|
||||
{
|
||||
ent->owner = &g_edicts[-ent->owner_id];
|
||||
}
|
||||
|
@ -1572,9 +1572,9 @@ void LoadTransitionEnts()
|
|||
// We KNOW owners precede owned ents in the
|
||||
// list because of the way it was constructed
|
||||
ent->owner = NULL;
|
||||
for(j=game.maxclients+1; j<globals.num_edicts && !ent->owner; j++)
|
||||
for (j=game.maxclients+1; j<globals.num_edicts && !ent->owner; j++)
|
||||
{
|
||||
if(ent->owner_id == g_edicts[j].id)
|
||||
if (ent->owner_id == g_edicts[j].id)
|
||||
ent->owner = &g_edicts[j];
|
||||
}
|
||||
}
|
||||
|
@ -1641,9 +1641,35 @@ void SpawnEntities (char *mapname, char *entities, char *spawnpoint)
|
|||
ent = NULL;
|
||||
inhibit = 0;
|
||||
|
||||
// Knightmare- set maptype for pack-specific changes
|
||||
if ( IsIdMap() ) {
|
||||
level.maptype = MAPTYPE_ID;
|
||||
// gi.dprintf ("Maptype is Id.\n");
|
||||
}
|
||||
else if ( IsXatrixMap() ) {
|
||||
level.maptype = MAPTYPE_XATRIX;
|
||||
// gi.dprintf ("Maptype is Xatrix.\n");
|
||||
}
|
||||
else if ( IsRogueMap() ) {
|
||||
level.maptype = MAPTYPE_ROGUE;
|
||||
// gi.dprintf ("Maptype is Rogue.\n");
|
||||
}
|
||||
else if ( IsZaeroMap() ) {
|
||||
level.maptype = MAPTYPE_ZAERO;
|
||||
// gi.dprintf ("Maptype is Zaero.\n");
|
||||
}
|
||||
else {
|
||||
level.maptype = MAPTYPE_CUSTOM;
|
||||
// gi.dprintf ("Maptype is Custom.\n");
|
||||
}
|
||||
|
||||
// Also set railgun thru window hack for zdef4
|
||||
level.isZaeroRailgunHackMap = IsZaeroRailgunHackMap();
|
||||
// end Knightmare
|
||||
|
||||
// Knightmare- load the entity alias script file
|
||||
LoadAliasData();
|
||||
//gi.dprintf ("Size of alias data: %i\n", alias_data_size);
|
||||
// gi.dprintf ("Size of alias data: %i\n", alias_data_size);
|
||||
|
||||
// parse ents
|
||||
while (1)
|
||||
|
@ -1690,7 +1716,7 @@ void SpawnEntities (char *mapname, char *entities, char *spawnpoint)
|
|||
}
|
||||
else if ( coop->value )
|
||||
{
|
||||
if ( IsRogueMap() ) // Knightmare- this breaks non-Rogue maps in coop
|
||||
if (level.maptype == MAPTYPE_ROGUE) // Knightmare- this breaks non-Rogue maps in coop
|
||||
{
|
||||
if (ent->spawnflags & SPAWNFLAG_NOT_COOP)
|
||||
{
|
||||
|
@ -1804,9 +1830,9 @@ void SpawnEntities (char *mapname, char *entities, char *spawnpoint)
|
|||
PlayerTrail_Init ();
|
||||
|
||||
//ROGUE
|
||||
if(deathmatch->value)
|
||||
if (deathmatch->value)
|
||||
{
|
||||
if(randomrespawn && randomrespawn->value)
|
||||
if (randomrespawn && randomrespawn->value)
|
||||
PrecacheForRandomRespawn();
|
||||
}
|
||||
else
|
||||
|
@ -2409,7 +2435,7 @@ qboolean FindSpawnPoint (vec3_t startpoint, vec3_t mins, vec3_t maxs, vec3_t spa
|
|||
height = maxs[2] - mins[2];
|
||||
|
||||
tr = gi.trace (startpoint, mins, maxs, startpoint, NULL, MASK_MONSTERSOLID|CONTENTS_PLAYERCLIP);
|
||||
if((tr.startsolid || tr.allsolid) || (tr.ent != world))
|
||||
if ((tr.startsolid || tr.allsolid) || (tr.ent != world))
|
||||
{
|
||||
// if ( ((tr.ent->svflags & SVF_MONSTER) && (tr.ent->health <= 0)) ||
|
||||
// (tr.ent->svflags & SVF_DAMAGEABLE) )
|
||||
|
@ -2472,7 +2498,7 @@ qboolean CheckSpawnPoint (vec3_t origin, vec3_t mins, vec3_t maxs)
|
|||
}
|
||||
|
||||
tr = gi.trace (origin, mins, maxs, origin, NULL, MASK_MONSTERSOLID);
|
||||
if(tr.startsolid || tr.allsolid)
|
||||
if (tr.startsolid || tr.allsolid)
|
||||
{
|
||||
// if ((g_showlogic) && (g_showlogic->value))
|
||||
// gi.dprintf("createmonster in wall. removing\n");
|
||||
|
@ -2543,7 +2569,7 @@ qboolean CheckGroundSpawnPoint (vec3_t origin, vec3_t entMins, vec3_t entMaxs, f
|
|||
//
|
||||
#ifdef ROGUE_GRAVITY
|
||||
// FIXME - this will only handle 0,0,1 and 0,0,-1 gravity vectors
|
||||
if(gravity > 0)
|
||||
if (gravity > 0)
|
||||
start[2] = maxs[2] + 1;
|
||||
else
|
||||
start[2] = mins[2] - 1;
|
||||
|
@ -2579,7 +2605,7 @@ realcheck:
|
|||
mid = bottom = tr.endpos[2];
|
||||
|
||||
#ifdef ROGUE_GRAVITY
|
||||
if(gravity < 0)
|
||||
if (gravity < 0)
|
||||
{
|
||||
start[2] = mins[2];
|
||||
stop[2] = start[2] - STEPSIZE - STEPSIZE;
|
||||
|
@ -2614,7 +2640,7 @@ realcheck:
|
|||
//PGM
|
||||
#ifdef ROGUE_GRAVITY
|
||||
// FIXME - this will only handle 0,0,1 and 0,0,-1 gravity vectors
|
||||
if(gravity > 0)
|
||||
if (gravity > 0)
|
||||
{
|
||||
if (tr.fraction != 1.0 && tr.endpos[2] < bottom)
|
||||
bottom = tr.endpos[2];
|
||||
|
|
|
@ -452,7 +452,7 @@ void use_target_changelevel (edict_t *self, edict_t *other, edict_t *activator)
|
|||
|
||||
// Knightmare- some of id's stock Q2 maps have this spawnflag
|
||||
// set on their trigger_changelevels, so exclude those maps
|
||||
if ((self->spawnflags & 1) && !IsIdMap() && allow_clear_inventory->value)
|
||||
if ( (self->spawnflags & 1) && (level.maptype != MAPTYPE_ID) && (int)allow_clear_inventory->value )
|
||||
{
|
||||
int n;
|
||||
if(activator && activator->client)
|
||||
|
@ -478,7 +478,7 @@ void use_target_changelevel (edict_t *self, edict_t *other, edict_t *activator)
|
|||
game.transition_ents = 0;
|
||||
if(self->spawnflags & 2 && activator->client)
|
||||
{
|
||||
transition = G_Find(NULL,FOFS(classname),"trigger_transition");
|
||||
transition = G_Find(NULL,FOFS(classname), "trigger_transition");
|
||||
while(transition)
|
||||
{
|
||||
if(!Q_stricmp(transition->targetname,self->targetname))
|
||||
|
@ -488,7 +488,7 @@ void use_target_changelevel (edict_t *self, edict_t *other, edict_t *activator)
|
|||
gi.dprintf("Number of transition ents saved: %i\n", game.transition_ents);
|
||||
break;
|
||||
}
|
||||
transition = G_Find(transition,FOFS(classname),"trigger_transition");
|
||||
transition = G_Find(transition,FOFS(classname), "trigger_transition");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -258,7 +258,7 @@ void G_UseTargets (edict_t *ent, edict_t *activator)
|
|||
if ( !t->dmgteam || strcmp(t->dmgteam, "player") ) {
|
||||
// if ( !(t->monsterinfo.aiflags & AI_GOOD_GUY) )
|
||||
// Zaero- spawnflag 16 = do not count
|
||||
if ( !(t->monsterinfo.aiflags & AI_GOOD_GUY) && !(t->monsterinfo.monsterflags & MFL_DO_NOT_COUNT) && !(IsZaeroMap() && (t->spawnflags & 16)) )
|
||||
if ( !(t->monsterinfo.aiflags & AI_GOOD_GUY) && !(t->monsterinfo.monsterflags & MFL_DO_NOT_COUNT) && !( (level.maptype == MAPTYPE_ZAERO) && (t->spawnflags & 16) ) )
|
||||
level.total_monsters--;
|
||||
}
|
||||
}
|
||||
|
@ -1395,6 +1395,7 @@ qboolean IsXatrixMap (void)
|
|||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Knightmare added
|
||||
/*
|
||||
====================
|
||||
|
@ -1469,7 +1470,6 @@ qboolean IsRogueMap (void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
// Knightmare added
|
||||
/*
|
||||
====================
|
||||
|
@ -1513,6 +1513,24 @@ qboolean IsZaeroMap (void)
|
|||
}
|
||||
|
||||
|
||||
// Knightmare added
|
||||
/*
|
||||
====================
|
||||
IsZaeroRailgunHackMap
|
||||
|
||||
Checks if the current map is from the Zaero mission pack
|
||||
and needs to allow the player to shoot the railgun through
|
||||
windows to progress.
|
||||
====================
|
||||
*/
|
||||
qboolean IsZaeroRailgunHackMap (void)
|
||||
{
|
||||
if (Q_stricmp(level.mapname, "zdef4") == 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
====================
|
||||
CheckCoop_MapHacks
|
||||
|
@ -1526,7 +1544,7 @@ qboolean CheckCoop_MapHacks (edict_t *ent)
|
|||
if ( !coop->value || !ent )
|
||||
return false;
|
||||
|
||||
if ( IsXatrixMap() )
|
||||
if (level.maptype == MAPTYPE_XATRIX)
|
||||
{
|
||||
if ( !Q_stricmp(level.mapname, "xsewer1") ) // FS: Coop: Progress breaker hack in xsewer1.bsp
|
||||
{
|
||||
|
|
|
@ -1607,7 +1607,7 @@ void fire_rail (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick
|
|||
// Knightmare- changeable trail color
|
||||
//#ifdef KMQUAKE2_ENGINE_MOD
|
||||
#if defined (KMQUAKE2_ENGINE_MOD) || defined (Q2E_ENGINE_MOD)
|
||||
if (self->client && sk_rail_color->value == 2)
|
||||
if ( (self->client) && (sk_rail_color->value == 2) )
|
||||
tempevent = TE_RAILTRAIL2;
|
||||
else
|
||||
#endif
|
||||
|
@ -1618,8 +1618,8 @@ void fire_rail (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick
|
|||
ignore = self;
|
||||
water = false;
|
||||
|
||||
// Zaero- hack for zdef4 to shoot through window
|
||||
if ( self->client && (Q_stricmp(level.mapname, "zdef4") == 0) )
|
||||
// Zaero- hack for certain maps to shoot through windows
|
||||
if ( (self->client) && level.isZaeroRailgunHackMap )
|
||||
mask = MASK_SHOT_NO_WINDOW|CONTENTS_SLIME|CONTENTS_LAVA;
|
||||
else
|
||||
mask = MASK_SHOT|CONTENTS_SLIME|CONTENTS_LAVA;
|
||||
|
|
|
@ -373,7 +373,6 @@ void TankRocket (edict_t *self)
|
|||
|
||||
// pmm - blindfire check
|
||||
if (self->monsterinfo.aiflags & AI_MANUAL_STEERING)
|
||||
// if ( (self->monsterinfo.aiflags & AI_MANUAL_STEERING) && !IsZaeroMap() ) // Knightmare- no blind firing on Zaero maps, fix undesired airfield behavior
|
||||
blindfire = true;
|
||||
else
|
||||
blindfire = false;
|
||||
|
|
|
@ -1627,7 +1627,7 @@ void SelectStartWeapon (gclient_t *client, int style)
|
|||
client->pers.inventory[ITEM_INDEX(FindItem("No Weapon"))] = 1;
|
||||
|
||||
// Zaero
|
||||
if (!deathmatch->value && IsZaeroMap())
|
||||
if ( !deathmatch->value && (level.maptype == MAPTYPE_ZAERO) )
|
||||
{
|
||||
item = FindItem("Flare Gun");
|
||||
client->pers.inventory[ITEM_INDEX(item)] = 1;
|
||||
|
|
|
@ -108,7 +108,7 @@ __inline int Q_vsnprintf (char *Dest, size_t Count, const char *Format, va_list
|
|||
#else
|
||||
#define SAVEGAME_DLLNAME "Rogue + Xatrix + Lazarus integrated mod"
|
||||
#endif // CITADELMOD_FEATURES
|
||||
#define SAVEGAME_VERSION 4
|
||||
#define SAVEGAME_VERSION 5
|
||||
|
||||
// angle indexes
|
||||
#define PITCH 0 // up / down
|
||||
|
|
Loading…
Reference in a new issue