Some function mismatch warning fixes. Some minor quakeworld retrofits in doors and weapon code. Setsize called for explosion boxes. More cvars checked every frame.
This commit is contained in:
parent
4f7c1785b6
commit
de3f6e9c30
|
@ -667,14 +667,14 @@ Exit deathmatch games upon conditions
|
|||
*/
|
||||
void() CheckRules =
|
||||
{
|
||||
local float timelimit;
|
||||
local float fraglimit;
|
||||
//local float timelimit;
|
||||
//local float fraglimit;
|
||||
|
||||
if (gameover) // someone else quit the game already
|
||||
return;
|
||||
|
||||
timelimit = cvar("timelimit") * 60;
|
||||
fraglimit = cvar("fraglimit");
|
||||
//timelimit = cvar("timelimit") * 60;
|
||||
//fraglimit = cvar("fraglimit");
|
||||
|
||||
if (timelimit && time >= timelimit)
|
||||
{
|
||||
|
|
|
@ -83,6 +83,7 @@ void(entity targ, entity attacker) Killed =
|
|||
|
||||
self.takedamage = DAMAGE_NO;
|
||||
self.touch = SUB_Null;
|
||||
self.effects = 0;
|
||||
|
||||
monster_death_use();
|
||||
self.th_die ();
|
||||
|
@ -105,13 +106,13 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage=
|
|||
local entity oldself;
|
||||
local float save;
|
||||
local float take;
|
||||
local float bothcl; // [slipyx] is both targ and attacker a client?
|
||||
local float samecl; // [slipyx] is both targ and attacker same client?
|
||||
// [slipyx] is both targ and attacker a client? and the same client?
|
||||
local float bothcl, samecl;
|
||||
|
||||
if (!targ.takedamage)
|
||||
return;
|
||||
|
||||
// [slipyx] detect if both targ and attacker are clients if the same
|
||||
// [slipyx] detect if both targ and attacker are clients and if the same
|
||||
bothcl = ((targ.flags & FL_CLIENT) && (attacker.flags & FL_CLIENT));
|
||||
samecl = FALSE;
|
||||
if ( bothcl ) samecl = (targ == attacker);
|
||||
|
|
19
defs.qc
19
defs.qc
|
@ -406,9 +406,12 @@ entity activator; // the entity that activated a trigger or brush
|
|||
|
||||
entity damage_attacker; // set by T_Damage
|
||||
entity damage_inflictor;
|
||||
float framecount;
|
||||
|
||||
// vars updated each frame
|
||||
float framecount;
|
||||
float skill;
|
||||
float timelimit;
|
||||
float fraglimit;
|
||||
|
||||
//================================================
|
||||
|
||||
|
@ -458,6 +461,7 @@ float AS_MISSILE = 4;
|
|||
//
|
||||
// player only fields
|
||||
//
|
||||
.float voided;
|
||||
.float walkframe;
|
||||
|
||||
.float attack_finished;
|
||||
|
@ -691,12 +695,11 @@ float (entity e, float healamount, float ignore) T_Heal; // health function
|
|||
|
||||
float(entity targ, entity inflictor) CanDamage;
|
||||
|
||||
// unused (for now)
|
||||
void() unused = {
|
||||
parm10=0;parm11=0;parm12=0;parm13=0;parm14=0;parm15=0;parm16=0;
|
||||
trace_allsolid=0;trace_startsolid=0;trace_plane_dist=0;
|
||||
//msg_entity=world;
|
||||
self.waitmax=0;self.distance=0;self.volume=0;
|
||||
self.wad=string_null;self.light_lev=0;self.dest=VEC_ORIGIN;
|
||||
// unused globals (for now)
|
||||
void() _unused = {
|
||||
parm10=parm11=parm12=parm13=parm14=parm15=parm16=0;
|
||||
trace_allsolid=trace_startsolid=trace_plane_dist=0;
|
||||
msg_entity = world; self.waitmax = self.distance = self.volume = 0;
|
||||
self.wad = string_null; self.light_lev = 0; self.dest = VEC_ORIGIN;
|
||||
};
|
||||
|
||||
|
|
26
doors.qc
26
doors.qc
|
@ -26,12 +26,20 @@ THINK FUNCTIONS
|
|||
=============================================================================
|
||||
*/
|
||||
|
||||
// [slipyx] function mismatch warning fix
|
||||
void() fd_secret_use;
|
||||
void( entity attacker, float damage ) th_pain_null = {};
|
||||
void( entity attacker, float damage ) fd_secret_pain = {
|
||||
fd_secret_use();
|
||||
};
|
||||
|
||||
void() door_go_down;
|
||||
void() door_go_up;
|
||||
|
||||
void() door_blocked =
|
||||
{
|
||||
T_Damage (other, self, self, self.dmg);
|
||||
other.deathtype = "squish";
|
||||
T_Damage (other, self, self.goalentity, self.dmg);
|
||||
|
||||
// if a door has a negative wait, it would never come back if blocked,
|
||||
// so let it just squash the object to death real fast
|
||||
|
@ -136,6 +144,7 @@ void() door_fire =
|
|||
starte = self;
|
||||
do
|
||||
{
|
||||
self.goalentity = activator;
|
||||
door_go_up ();
|
||||
self = self.enemy;
|
||||
} while ( (self != starte) && (self != world) );
|
||||
|
@ -561,7 +570,7 @@ float SECRET_1ST_DOWN = 4; // 1st move is down from arrow
|
|||
float SECRET_NO_SHOOT = 8; // only opened by trigger
|
||||
float SECRET_YES_SHOOT = 16; // shootable even if targeted
|
||||
|
||||
void () fd_secret_use =
|
||||
void() fd_secret_use =
|
||||
{
|
||||
local float temp;
|
||||
|
||||
|
@ -574,10 +583,10 @@ void () fd_secret_use =
|
|||
self.message = string_null; // no more message
|
||||
|
||||
SUB_UseTargets(); // fire all targets / killtargets
|
||||
|
||||
|
||||
if (!(self.spawnflags & SECRET_NO_SHOOT))
|
||||
{
|
||||
self.th_pain = SUB_Null;
|
||||
self.th_pain = th_pain_null;
|
||||
self.takedamage = DAMAGE_NO;
|
||||
}
|
||||
self.velocity = '0 0 0';
|
||||
|
@ -664,7 +673,8 @@ void () fd_secret_done =
|
|||
{
|
||||
self.health = 10000;
|
||||
self.takedamage = DAMAGE_YES;
|
||||
self.th_pain = fd_secret_use;
|
||||
self.th_pain = fd_secret_pain;
|
||||
self.th_die = fd_secret_use;
|
||||
}
|
||||
sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
|
||||
};
|
||||
|
@ -674,6 +684,7 @@ void () secret_blocked =
|
|||
if (time < self.attack_finished)
|
||||
return;
|
||||
self.attack_finished = time + 0.5;
|
||||
other.deathtype = "squish";
|
||||
T_Damage (other, self, self, self.dmg);
|
||||
};
|
||||
|
||||
|
@ -768,10 +779,11 @@ void () func_door_secret =
|
|||
{
|
||||
self.health = 10000;
|
||||
self.takedamage = DAMAGE_YES;
|
||||
self.th_pain = fd_secret_use;
|
||||
self.th_die = fd_secret_use;
|
||||
self.th_pain = fd_secret_pain;
|
||||
//self.th_die = fd_secret_use;
|
||||
}
|
||||
self.oldorigin = self.origin;
|
||||
if (!self.wait)
|
||||
self.wait = 5; // 5 seconds before closing
|
||||
};
|
||||
|
||||
|
|
|
@ -415,7 +415,7 @@ void() monster_hell_knight =
|
|||
precache_sound ("hknight/hit.wav"); // used by C code, so don't sound2
|
||||
precache_sound2 ("hknight/slash1.wav");
|
||||
precache_sound2 ("hknight/idle.wav");
|
||||
precache_sound2 ("hknight/grunt.wav");
|
||||
//precache_sound2 ("hknight/grunt.wav");
|
||||
|
||||
precache_sound ("knight/sword1.wav");
|
||||
precache_sound ("knight/sword2.wav");
|
||||
|
|
2
misc.qc
2
misc.qc
|
@ -239,6 +239,7 @@ void() misc_explobox =
|
|||
self.movetype = MOVETYPE_NONE;
|
||||
precache_model ("maps/b_explob.bsp");
|
||||
setmodel (self, "maps/b_explob.bsp");
|
||||
setsize( self, '0 0 0', '32 32 64' );
|
||||
precache_sound ("weapons/r_exp3.wav");
|
||||
self.health = 20;
|
||||
self.th_die = barrel_explode;
|
||||
|
@ -271,6 +272,7 @@ void() misc_explobox2 =
|
|||
self.movetype = MOVETYPE_NONE;
|
||||
precache_model2 ("maps/b_exbox2.bsp");
|
||||
setmodel (self, "maps/b_exbox2.bsp");
|
||||
setsize( self, '0 0 0', '32 32 32' );
|
||||
precache_sound ("weapons/r_exp3.wav");
|
||||
self.health = 20;
|
||||
self.th_die = barrel_explode;
|
||||
|
|
|
@ -260,8 +260,8 @@ void() monster_oldone =
|
|||
precache_model2 ("progs/oldone.mdl");
|
||||
|
||||
precache_sound2 ("boss2/death.wav");
|
||||
precache_sound2 ("boss2/idle.wav");
|
||||
precache_sound2 ("boss2/sight.wav");
|
||||
//precache_sound2 ("boss2/idle.wav");
|
||||
//precache_sound2 ("boss2/sight.wav");
|
||||
precache_sound2 ("boss2/pop2.wav");
|
||||
|
||||
self.solid = SOLID_SLIDEBOX;
|
||||
|
|
2
plats.qc
2
plats.qc
|
@ -111,6 +111,7 @@ void() plat_crush =
|
|||
{
|
||||
//dprint ("plat_crush\n");
|
||||
|
||||
other.deathtype = "squish";
|
||||
T_Damage (other, self, self, 1);
|
||||
|
||||
if (self.state == STATE_UP)
|
||||
|
@ -223,6 +224,7 @@ void() train_blocked =
|
|||
if (time < self.attack_finished)
|
||||
return;
|
||||
self.attack_finished = time + 0.5;
|
||||
other.deathtype = "squish";
|
||||
T_Damage (other, self, self, self.dmg);
|
||||
};
|
||||
void() train_use =
|
||||
|
|
17
subs.qc
17
subs.qc
|
@ -89,12 +89,15 @@ local float len, traveltime;
|
|||
// divide by speed to get time to reach dest
|
||||
traveltime = len / tspeed;
|
||||
|
||||
if (traveltime < 0.1)
|
||||
// [slipyx] quakeworld method
|
||||
if ( traveltime < 0.03 )
|
||||
traveltime = 0.03;
|
||||
/*if (traveltime < 0.1)
|
||||
{
|
||||
self.velocity = '0 0 0';
|
||||
self.nextthink = self.ltime + 0.1;
|
||||
return;
|
||||
}
|
||||
}*/
|
||||
|
||||
// set nextthink to trigger a think when dest is reached
|
||||
self.nextthink = self.ltime + traveltime;
|
||||
|
@ -306,12 +309,10 @@ float (entity targ) visible;
|
|||
|
||||
void (void() thinkst) SUB_CheckRefire =
|
||||
{
|
||||
if (skill != 3)
|
||||
return;
|
||||
if (self.cnt == 1)
|
||||
return;
|
||||
if (!visible (self.enemy))
|
||||
return;
|
||||
if ( skill != 3 ) return;
|
||||
if ( self.cnt == 1 ) return;
|
||||
if ( !visible( self.enemy ) ) return;
|
||||
self.cnt = 1;
|
||||
self.think = thinkst;
|
||||
};
|
||||
|
||||
|
|
121
weapons.qc
121
weapons.qc
|
@ -189,9 +189,7 @@ void(entity hit, float damage) AddMultiDamage =
|
|||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
BULLETS
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
|
@ -333,6 +331,9 @@ void() T_MissileTouch =
|
|||
if (other == self.owner)
|
||||
return; // don't explode on owner
|
||||
|
||||
if ( self.voided ) return;
|
||||
self.voided = 1;
|
||||
|
||||
if (pointcontents(self.origin) == CONTENT_SKY)
|
||||
{
|
||||
remove(self);
|
||||
|
@ -343,6 +344,7 @@ void() T_MissileTouch =
|
|||
|
||||
if (other.health)
|
||||
{
|
||||
other.deathtype = "rocket";
|
||||
if (other.classname == "monster_shambler")
|
||||
damg = damg * 0.5; // mostly immune
|
||||
T_Damage (other, self, self.owner, damg );
|
||||
|
@ -373,7 +375,7 @@ W_FireRocket
|
|||
*/
|
||||
void() W_FireRocket =
|
||||
{
|
||||
local entity missile;//, mpuff;
|
||||
//local entity missile;//, mpuff;
|
||||
|
||||
self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
|
||||
|
||||
|
@ -381,35 +383,34 @@ void() W_FireRocket =
|
|||
|
||||
self.punchangle_x = -2;
|
||||
|
||||
missile = spawn ();
|
||||
missile.owner = self;
|
||||
missile.movetype = MOVETYPE_FLYMISSILE;
|
||||
missile.solid = SOLID_BBOX;
|
||||
missile.classname = "missile";
|
||||
|
||||
newmis = spawn ();
|
||||
newmis.owner = self;
|
||||
newmis.movetype = MOVETYPE_FLYMISSILE;
|
||||
newmis.solid = SOLID_BBOX;
|
||||
newmis.classname = "rocket";
|
||||
|
||||
// set missile speed
|
||||
|
||||
makevectors (self.v_angle);
|
||||
missile.velocity = aim(self, 1000);
|
||||
missile.velocity = missile.velocity * 1000;
|
||||
missile.angles = vectoangles(missile.velocity);
|
||||
newmis.velocity = aim(self, 1000);
|
||||
newmis.velocity = newmis.velocity * 1000;
|
||||
newmis.angles = vectoangles(newmis.velocity);
|
||||
|
||||
missile.touch = T_MissileTouch;
|
||||
|
||||
// set missile duration
|
||||
missile.nextthink = time + 5;
|
||||
missile.think = SUB_Remove;
|
||||
newmis.touch = T_MissileTouch;
|
||||
newmis.voided = 0;
|
||||
|
||||
setmodel (missile, "progs/missile.mdl");
|
||||
setsize (missile, '0 0 0', '0 0 0');
|
||||
setorigin (missile, self.origin + v_forward*8 + '0 0 16');
|
||||
// set missile duration
|
||||
newmis.nextthink = time + 5;
|
||||
newmis.think = SUB_Remove;
|
||||
|
||||
setmodel (newmis, "progs/missile.mdl");
|
||||
setsize (newmis, '0 0 0', '0 0 0');
|
||||
setorigin (newmis, self.origin + v_forward*8 + '0 0 16');
|
||||
};
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
LIGHTNING
|
||||
|
||||
===============================================================================
|
||||
*/
|
||||
|
||||
|
@ -516,6 +517,9 @@ void() W_FireLightning =
|
|||
|
||||
void() GrenadeExplode =
|
||||
{
|
||||
if ( self.voided ) return;
|
||||
self.voided = 1;
|
||||
|
||||
T_RadiusDamage (self, self.owner, 120, world);
|
||||
|
||||
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
|
||||
|
@ -548,7 +552,7 @@ W_FireGrenade
|
|||
*/
|
||||
void() W_FireGrenade =
|
||||
{
|
||||
local entity missile;//, mpuff;
|
||||
//local entity missile;//, mpuff;
|
||||
|
||||
self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
|
||||
|
||||
|
@ -556,38 +560,39 @@ void() W_FireGrenade =
|
|||
|
||||
self.punchangle_x = -2;
|
||||
|
||||
missile = spawn ();
|
||||
missile.owner = self;
|
||||
missile.movetype = MOVETYPE_BOUNCE;
|
||||
missile.solid = SOLID_BBOX;
|
||||
missile.classname = "grenade";
|
||||
newmis = spawn ();
|
||||
newmis.voided = 0;
|
||||
newmis.owner = self;
|
||||
newmis.movetype = MOVETYPE_BOUNCE;
|
||||
newmis.solid = SOLID_BBOX;
|
||||
newmis.classname = "grenade";
|
||||
|
||||
// set missile speed
|
||||
|
||||
makevectors (self.v_angle);
|
||||
|
||||
if (self.v_angle_x)
|
||||
missile.velocity = v_forward*600 + v_up * 200 + crandom()*v_right*10 + crandom()*v_up*10;
|
||||
newmis.velocity = v_forward*600 + v_up * 200 + crandom()*v_right*10 + crandom()*v_up*10;
|
||||
else
|
||||
{
|
||||
missile.velocity = aim(self, 10000);
|
||||
missile.velocity = missile.velocity * 600;
|
||||
missile.velocity_z = 200;
|
||||
newmis.velocity = aim(self, 10000);
|
||||
newmis.velocity = newmis.velocity * 600;
|
||||
newmis.velocity_z = 200;
|
||||
}
|
||||
|
||||
missile.avelocity = '300 300 300';
|
||||
newmis.avelocity = '300 300 300';
|
||||
|
||||
newmis.angles = vectoangles(newmis.velocity);
|
||||
|
||||
newmis.touch = GrenadeTouch;
|
||||
|
||||
missile.angles = vectoangles(missile.velocity);
|
||||
|
||||
missile.touch = GrenadeTouch;
|
||||
|
||||
// set missile duration
|
||||
missile.nextthink = time + 2.5;
|
||||
missile.think = GrenadeExplode;
|
||||
newmis.nextthink = time + 2.5;
|
||||
newmis.think = GrenadeExplode;
|
||||
|
||||
setmodel (missile, "progs/grenade.mdl");
|
||||
setsize (missile, '0 0 0', '0 0 0');
|
||||
setorigin (missile, self.origin);
|
||||
setmodel (newmis, "progs/grenade.mdl");
|
||||
setsize (newmis, '0 0 0', '0 0 0');
|
||||
setorigin (newmis, self.origin);
|
||||
};
|
||||
|
||||
|
||||
|
@ -607,6 +612,7 @@ Used for both the player and the ogre
|
|||
void(vector org, vector dir) launch_spike =
|
||||
{
|
||||
newmis = spawn ();
|
||||
newmis.voided = 0;
|
||||
newmis.owner = self;
|
||||
newmis.movetype = MOVETYPE_FLYMISSILE;
|
||||
newmis.solid = SOLID_BBOX;
|
||||
|
@ -676,6 +682,9 @@ void() spike_touch =
|
|||
if (other == self.owner)
|
||||
return;
|
||||
|
||||
if ( self.voided ) return;
|
||||
self.voided = 1;
|
||||
|
||||
if (other.solid == SOLID_TRIGGER)
|
||||
return; // trigger field, do nothing
|
||||
|
||||
|
@ -716,6 +725,9 @@ void() superspike_touch =
|
|||
if (other == self.owner)
|
||||
return;
|
||||
|
||||
if ( self.voided ) return;
|
||||
self.voided = 1;
|
||||
|
||||
if (other.solid == SOLID_TRIGGER)
|
||||
return; // trigger field, do nothing
|
||||
|
||||
|
@ -729,6 +741,7 @@ void() superspike_touch =
|
|||
if (other.takedamage)
|
||||
{
|
||||
spawn_touchblood (18);
|
||||
other.deathtype = "supernail";
|
||||
T_Damage (other, self, self.owner, 18);
|
||||
}
|
||||
else
|
||||
|
@ -830,13 +843,13 @@ float() W_BestWeapon =
|
|||
|
||||
if (self.waterlevel <= 1 && self.ammo_cells >= 1 && (it & IT_LIGHTNING) )
|
||||
return IT_LIGHTNING;
|
||||
if(self.ammo_nails >= 2 && (it & IT_SUPER_NAILGUN) )
|
||||
else if(self.ammo_nails >= 2 && (it & IT_SUPER_NAILGUN) )
|
||||
return IT_SUPER_NAILGUN;
|
||||
if(self.ammo_shells >= 2 && (it & IT_SUPER_SHOTGUN) )
|
||||
else if(self.ammo_shells >= 2 && (it & IT_SUPER_SHOTGUN) )
|
||||
return IT_SUPER_SHOTGUN;
|
||||
if(self.ammo_nails >= 1 && (it & IT_NAILGUN) )
|
||||
else if(self.ammo_nails >= 1 && (it & IT_NAILGUN) )
|
||||
return IT_NAILGUN;
|
||||
if(self.ammo_shells >= 1 && (it & IT_SHOTGUN) )
|
||||
else if(self.ammo_shells >= 1 && (it & IT_SHOTGUN) )
|
||||
return IT_SHOTGUN;
|
||||
return IT_AXE;
|
||||
};
|
||||
|
@ -885,6 +898,7 @@ void() W_Attack =
|
|||
|
||||
if (self.weapon == IT_AXE)
|
||||
{
|
||||
self.attack_finished = time + 0.5;
|
||||
sound (self, CHAN_WEAPON, "weapons/ax1.wav", 1, ATTN_NORM);
|
||||
r = random();
|
||||
if (r < 0.25)
|
||||
|
@ -895,19 +909,18 @@ void() W_Attack =
|
|||
player_axec1 ();
|
||||
else
|
||||
player_axed1 ();
|
||||
self.attack_finished = time + 0.5;
|
||||
}
|
||||
else if (self.weapon == IT_SHOTGUN)
|
||||
{
|
||||
player_shot1 ();
|
||||
W_FireShotgun ();
|
||||
self.attack_finished = time + 0.5;
|
||||
W_FireShotgun ();
|
||||
}
|
||||
else if (self.weapon == IT_SUPER_SHOTGUN)
|
||||
{
|
||||
player_shot1 ();
|
||||
W_FireSuperShotgun ();
|
||||
self.attack_finished = time + 0.7;
|
||||
W_FireSuperShotgun ();
|
||||
}
|
||||
else if (self.weapon == IT_NAILGUN)
|
||||
{
|
||||
|
@ -920,20 +933,20 @@ void() W_Attack =
|
|||
else if (self.weapon == IT_GRENADE_LAUNCHER)
|
||||
{
|
||||
player_rocket1();
|
||||
W_FireGrenade();
|
||||
self.attack_finished = time + 0.6;
|
||||
W_FireGrenade();
|
||||
}
|
||||
else if (self.weapon == IT_ROCKET_LAUNCHER)
|
||||
{
|
||||
player_rocket1();
|
||||
W_FireRocket();
|
||||
self.attack_finished = time + 0.8;
|
||||
W_FireRocket();
|
||||
}
|
||||
else if (self.weapon == IT_LIGHTNING)
|
||||
{
|
||||
player_light1();
|
||||
self.attack_finished = time + 0.1;
|
||||
sound (self, CHAN_AUTO, "weapons/lstart.wav", 1, ATTN_NORM);
|
||||
player_light1();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1114,8 +1127,8 @@ void() CycleWeaponCommand =
|
|||
if (self.ammo_cells < 1)
|
||||
am = 1;
|
||||
}
|
||||
|
||||
if ( (it & self.weapon) && am == 0)
|
||||
|
||||
if ( (self.items & self.weapon) && am == 0)
|
||||
{
|
||||
W_SetCurrentAmmo ();
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue