Compare commits

...

2 Commits

Author SHA1 Message Date
an a2b4ae8a15 clean up obituary code 2019-09-17 14:35:48 -04:00
an be812d4308 fix assign-function-types issues 2019-09-17 12:30:40 -04:00
12 changed files with 282 additions and 251 deletions

View File

@ -1,7 +1,7 @@
[flags] [flags]
ADJUST_VECTOR_FIELDS = true ADJUST_VECTOR_FIELDS = true
ARITHMETIC_EXCEPTIONS = true ARITHMETIC_EXCEPTIONS = true
ASSIGN_FUNCTION_TYPES = true ASSIGN_FUNCTION_TYPES = false
BAIL_ON_WERROR = true BAIL_ON_WERROR = true
CORRECT_LOGIC = true CORRECT_LOGIC = true
CORRECT_TERNARY = true CORRECT_TERNARY = true
@ -35,9 +35,8 @@
VARIADIC_ARGS = true VARIADIC_ARGS = true
[warnings] [warnings]
ALL = true ALL = true
ASSIGN_FUNCTION_TYPES = false USED_UNINITIALIZED = false
USED_UNINITIALIZED = false
[optimizations] [optimizations]
PEEPHOLE = true PEEPHOLE = true

View File

@ -19,19 +19,19 @@ source/triggers.qc
source/weapons.qc source/weapons.qc
source/world.qc source/world.qc
source/ogre.qc source/boss.qc
source/demon.qc source/demon.qc
source/shambler.qc source/dog.qc
source/knight.qc source/knight.qc
source/ogre.qc
source/shambler.qc
source/soldier.qc source/soldier.qc
source/wizard.qc source/wizard.qc
source/dog.qc
source/zombie.qc source/zombie.qc
source/boss.qc
source/tarbaby.qc
source/hknight.qc
source/fish.qc
source/shalrath.qc
source/enforcer.qc source/enforcer.qc
source/fish.qc
source/hknight.qc
source/oldone.qc source/oldone.qc
source/shalrath.qc
source/tarbaby.qc

View File

@ -369,10 +369,6 @@ void(float dist) ai_walk = {
movedist = dist; movedist = dist;
if(self.classname == "monster_dragon") {
movetogoal(dist);
return;
}
// check for noticing a player // check for noticing a player
if(FindTarget()) { if(FindTarget()) {
return; return;

View File

@ -1053,6 +1053,232 @@ void() ClientDisconnect = {
set_suicide_frame(); set_suicide_frame();
}; };
float(entity targ, entity attacker) obit_teledeath = {
attacker.owner.frags = attacker.owner.frags + 1;
bprint(" was telefragged by ");
bprint(attacker.owner.netname);
bprint("\n");
return TRUE;
};
float(entity targ, entity attacker) obit_teledeath2 = {
targ.frags = targ.frags - 1;
bprint("'s telefrag was deflected by satanic power\n");
return TRUE;
};
float(entity targ, entity attacker) obit_suicide = {
targ.frags = targ.frags - 1;
if(targ.weapon == IT_LIGHTNING && targ.waterlevel > 1) {
bprint(" discharges into the water.\n");
} else if(targ.weapon == IT_GRENADE_LAUNCHER) {
bprint(" tries to put the pin back in\n");
} else {
// FIXME
bprint(" becomes bored with life\n");
}
return TRUE;
};
float(entity targ, entity attacker) obit_teamkill = {
float rnum;
rnum = random();
attacker.frags = attacker.frags - 1;
if(rnum < 0.25) {
bprint(" mows down a teammate\n");
} else if(rnum < 0.50) {
// FIXME
bprint(" checks his glasses\n");
} else if(rnum < 0.75) {
bprint(" gets a frag for the other team\n");
} else {
bprint(" loses another friend\n");
}
return TRUE;
};
float(entity targ, entity attacker) obit_pkill = {
string deathstring, deathstring2;
attacker.frags = attacker.frags + 1;
switch(attacker.weapon) {
case IT_AXE:
deathstring = " was ax-murdered by ";
deathstring2 = "\n";
break;
case IT_SHOTGUN:
deathstring = " chewed on ";
deathstring2 = "'s boomstick\n";
break;
case IT_SUPER_SHOTGUN:
deathstring = " ate 2 loads of ";
deathstring2 = "'s buckshot\n";
break;
case IT_NAILGUN:
deathstring = " was nailed by ";
deathstring2 = "\n";
break;
case IT_SUPER_NAILGUN:
deathstring = " was punctured by ";
deathstring2 = "\n";
break;
case IT_GRENADE_LAUNCHER:
deathstring = " eats ";
deathstring2 = "'s pineapple\n";
if(targ.health < -40) {
deathstring = " was gibbed by ";
deathstring2 = "'s grenade\n";
}
break;
case IT_ROCKET_LAUNCHER:
deathstring = " rides ";
deathstring2 = "'s rocket\n";
if(targ.health < -40) {
deathstring = " was gibbed by ";
deathstring2 = "'s rocket\n" ;
}
break;
case IT_LIGHTNING:
deathstring = " accepts ";
if(attacker.waterlevel > 1) {
deathstring2 = "'s discharge\n";
} else {
// FIXME
deathstring2 = "'s shaft\n";
}
break;
}
bprint(targ.netname);
bprint(deathstring);
bprint(attacker.netname);
bprint(deathstring2);
return TRUE;
};
float(entity targ, entity attacker) obit_monster = {
switch(attacker.classname) {
case "monster_army":
bprint(" was shot by a Grunt\n"); break;
case "monster_demon1":
bprint(" was eviscerated by a Fiend\n"); break;
case "monster_dog":
bprint(" was mauled by a Rottweiler\n"); break;
case "monster_enforcer":
bprint(" was blasted by an Enforcer\n"); break;
case "monster_fish":
bprint(" was fed to the Rotfish\n"); break;
case "monster_hell_knight":
bprint(" was slain by a Death Knight\n"); break;
case "monster_knight":
bprint(" was slashed by a Knight\n"); break;
case "monster_ogre":
bprint(" was destroyed by an Ogre\n"); break;
case "monster_oldone":
bprint(" became one with Shub-Niggurath\n"); break;
case "monster_shalrath":
bprint(" was exploded by a Vore\n"); break;
case "monster_shambler":
bprint(" was smashed by a Shambler\n"); break;
case "monster_tarbaby":
bprint(" was slimed by a Spawn\n"); break;
case "monster_vomit":
bprint(" was vomited on by a Vomitus\n"); break;
case "monster_wizard":
bprint(" was scragged by a Scrag\n"); break;
case "monster_zombie":
bprint(" joins the Zombies\n"); break;
default:
return FALSE;
}
return TRUE;
};
float(entity targ, entity attacker) obit_falling = {
if(targ.deathtype == "falling") {
targ.deathtype = "";
// FIXME
bprint(" fell to his death\n");
return TRUE;
} else {
return FALSE;
}
}
float(entity targ, entity attacker) obit_water = {
switch(targ.watertype) {
case -3:
if(random() < 0.5) {
bprint(" sleeps with the fishes\n");
} else {
// FIXME
bprint(" sucks it down\n");
}
break;
case -4:
if(random() < 0.5) {
bprint(" gulped a load of slime\n");
} else {
bprint(" can't exist on slime alone\n");
}
break;
case -5:
if(targ.health < -15) {
bprint(" burst into flames\n");
} else if(random() < 0.5) {
bprint(" turned into hot slag\n");
} else {
bprint(" visits the Volcano God\n");
}
break;
default:
return FALSE;
}
return TRUE;
};
float(entity targ, entity attacker) obit_trap = {
switch(attacker.classname) {
case "explo_box":
bprint(" blew up\n"); break;
case "trap_shooter":
case "trap_spikeshooter":
bprint(" was spiked\n"); break;
case "fireball":
bprint(" ate a lavaball\n"); break;
case "trigger_changelevel":
bprint(" tried to leave\n"); break;
default:
return FALSE;
}
return TRUE;
};
float(entity targ, entity attacker) obit_worldkill = {
targ.frags = targ.frags - 1;
if(attacker.flags & FL_MONSTER) {
return obit_monster(targ, attacker);
} else if(attacker.solid == SOLID_BSP && attacker != world) {
bprint(" was squished\n");
return TRUE;
} else {
return obit_falling(targ, attacker) ||
obit_water(targ, attacker) ||
obit_trap(targ, attacker);
}
};
/* /*
=========== ===========
ClientObituary ClientObituary
@ -1061,220 +1287,37 @@ called when a player dies
============ ============
*/ */
void(entity targ, entity attacker) ClientObituary = { void(entity targ, entity attacker) ClientObituary = {
float rnum; float did_message;
string deathstring, deathstring2;
rnum = random();
if(targ.classname == "player") { if(targ.classname != "player") {
if(attacker.classname == "teledeath") { return;
bprint(targ.netname); }
bprint(" was telefragged by ");
bprint(attacker.owner.netname); bprint(targ.netname);
bprint("\n");
attacker.owner.frags = attacker.owner.frags + 1; switch(attacker.classname) {
return; case "teledeath":
} did_message = obit_teledeath(targ, attacker);
if(attacker.classname == "teledeath2") { break;
bprint("Satan's power deflects "); case "teledeath2":
bprint(targ.netname); did_message = obit_teledeath2(targ, attacker);
bprint("'s telefrag\n"); break;
targ.frags = targ.frags - 1; case "player":
return;
}
if(attacker.classname == "player") {
if(targ == attacker) { if(targ == attacker) {
// killed self did_message = obit_suicide(targ, attacker);
attacker.frags = attacker.frags - 1;
bprint(targ.netname);
if(targ.weapon == 64 && targ.waterlevel > 1) {
bprint(" discharges into the water.\n");
return;
}
if(targ.weapon == IT_GRENADE_LAUNCHER) {
bprint(" tries to put the pin back in\n");
} else {
bprint(" becomes bored with life\n");
}
return;
} else if(teamplay == 2 && SameTeam(targ, attacker)) { } else if(teamplay == 2 && SameTeam(targ, attacker)) {
if(rnum < 0.25) { did_message = obit_teamkill(targ, attacker);
deathstring = " mows down a teammate\n";
} else if(rnum < 0.50) {
deathstring = " checks his glasses\n";
} else if(rnum < 0.75) {
deathstring = " gets a frag for the other team\n";
} else {
deathstring = " loses another friend\n";
}
bprint(attacker.netname);
bprint(deathstring);
attacker.frags = attacker.frags - 1;
return;
} else { } else {
attacker.frags = attacker.frags + 1; did_message = obit_pkill(targ, attacker);
rnum = attacker.weapon;
if(rnum == IT_AXE) {
deathstring = " was ax-murdered by ";
deathstring2 = "\n";
}
if(rnum == IT_SHOTGUN) {
deathstring = " chewed on ";
deathstring2 = "'s boomstick\n";
}
if(rnum == IT_SUPER_SHOTGUN) {
deathstring = " ate 2 loads of ";
deathstring2 = "'s buckshot\n";
}
if(rnum == IT_NAILGUN) {
deathstring = " was nailed by ";
deathstring2 = "\n";
}
if(rnum == IT_SUPER_NAILGUN) {
deathstring = " was punctured by ";
deathstring2 = "\n";
}
if(rnum == IT_GRENADE_LAUNCHER) {
deathstring = " eats ";
deathstring2 = "'s pineapple\n";
if(targ.health < -40) {
deathstring = " was gibbed by ";
deathstring2 = "'s grenade\n";
}
}
if(rnum == IT_ROCKET_LAUNCHER) {
deathstring = " rides ";
deathstring2 = "'s rocket\n";
if(targ.health < -40) {
deathstring = " was gibbed by ";
deathstring2 = "'s rocket\n" ;
}
}
if(rnum == IT_LIGHTNING) {
deathstring = " accepts ";
if(attacker.waterlevel > 1) {
deathstring2 = "'s discharge\n";
} else {
deathstring2 = "'s shaft\n";
}
}
bprint(targ.netname);
bprint(deathstring);
bprint(attacker.netname);
bprint(deathstring2);
} }
return; break;
} else { default:
targ.frags = targ.frags - 1; did_message = obit_worldkill(targ, attacker);
bprint(targ.netname); break;
// killed by a montser? }
if(attacker.flags & FL_MONSTER) {
if(attacker.classname == "monster_army") { if(!did_message) {
bprint(" was shot by a Grunt\n"); // hell if I know; they're just dead!!!
} bprint(" died\n");
if(attacker.classname == "monster_demon1") {
bprint(" was eviscerated by a Fiend\n");
}
if(attacker.classname == "monster_dog") {
bprint(" was mauled by a Rottweiler\n");
}
if(attacker.classname == "monster_dragon") {
bprint(" was fried by a Dragon\n");
}
if(attacker.classname == "monster_enforcer") {
bprint(" was blasted by an Enforcer\n");
}
if(attacker.classname == "monster_fish") {
bprint(" was fed to the Rotfish\n");
}
if(attacker.classname == "monster_hell_knight") {
bprint(" was slain by a Death Knight\n");
}
if(attacker.classname == "monster_knight") {
bprint(" was slashed by a Knight\n");
}
if(attacker.classname == "monster_ogre") {
bprint(" was destroyed by an Ogre\n");
}
if(attacker.classname == "monster_oldone") {
bprint(" became one with Shub-Niggurath\n");
}
if(attacker.classname == "monster_shalrath") {
bprint(" was exploded by a Vore\n");
}
if(attacker.classname == "monster_shambler") {
bprint(" was smashed by a Shambler\n");
}
if(attacker.classname == "monster_tarbaby") {
bprint(" was slimed by a Spawn\n");
}
if(attacker.classname == "monster_vomit") {
bprint(" was vomited on by a Vomitus\n");
}
if(attacker.classname == "monster_wizard") {
bprint(" was scragged by a Scrag\n");
}
if(attacker.classname == "monster_zombie") {
bprint(" joins the Zombies\n");
}
return;
}
// tricks and traps
if(attacker.classname == "explo_box") {
bprint(" blew up\n");
return;
}
if(attacker.solid == SOLID_BSP && attacker != world) {
bprint(" was squished\n");
return;
}
if(attacker.classname == "trap_shooter" || attacker.classname == "trap_spikeshooter") {
bprint(" was spiked\n");
return;
}
if(attacker.classname == "fireball") {
bprint(" ate a lavaball\n");
return;
}
if(attacker.classname == "trigger_changelevel") {
bprint(" tried to leave\n");
return;
}
// in-water deaths
rnum = targ.watertype;
if(rnum == -3) {
if(random() < 0.5) {
bprint(" sleeps with the fishes\n");
} else {
bprint(" sucks it down\n");
}
return;
} else if(rnum == -4) {
if(random() < 0.5) {
bprint(" gulped a load of slime\n");
} else {
bprint(" can't exist on slime alone\n");
}
return;
} else if(rnum == -5) {
if(targ.health < -15) {
bprint(" burst into flames\n");
return;
}
if(random() < 0.5) {
bprint(" turned into hot slag\n");
} else {
bprint(" visits the Volcano God\n");
}
return;
}
// fell to their death?
if(targ.deathtype == "falling") {
targ.deathtype = "";
bprint(" fell to his death\n");
return;
}
// hell if I know; he's just dead!!!
bprint(" died\n");
}
} }
}; };

View File

@ -637,6 +637,7 @@ void() SUB_CalcMoveDone;
void() SUB_CalcAngleMoveDone; void() SUB_CalcAngleMoveDone;
void(void() thinkst) SUB_CheckRefire; void(void() thinkst) SUB_CheckRefire;
void() SUB_Null; void() SUB_Null;
void(entity attacker, float damage) SUB_PainNull;
void() SUB_UseTargets; void() SUB_UseTargets;
void() SUB_Remove; void() SUB_Remove;
@ -762,7 +763,7 @@ void() player_died1;
void() player_diee1; void() player_diee1;
void() player_light1; void() player_light1;
void() player_nail1; void() player_nail1;
void() player_pain; void(entity attacker, float damage) player_pain;
void() player_rocket1; void() player_rocket1;
void() player_run; void() player_run;
void() player_run; void() player_run;

View File

@ -188,7 +188,7 @@ void() dog_painb14 = [ $painb14, dog_painb15 ] {};
void() dog_painb15 = [ $painb15, dog_painb16 ] {}; void() dog_painb15 = [ $painb15, dog_painb16 ] {};
void() dog_painb16 = [ $painb16, dog_run1 ] {}; void() dog_painb16 = [ $painb16, dog_run1 ] {};
void() dog_pain = { void(entity attacker, float damage) dog_pain = {
sound(self, CHAN_VOICE, "dog/dpain1.wav", 1, ATTN_NORM); sound(self, CHAN_VOICE, "dog/dpain1.wav", 1, ATTN_NORM);
if(random() > 0.5) { if(random() > 0.5) {

View File

@ -534,7 +534,7 @@ void() fd_secret_use = {
SUB_UseTargets(); // fire all targets / killtargets SUB_UseTargets(); // fire all targets / killtargets
if(!(self.spawnflags & SECRET_NO_SHOOT)) { if(!(self.spawnflags & SECRET_NO_SHOOT)) {
self.th_pain = SUB_Null; self.th_pain = SUB_PainNull;
self.takedamage = DAMAGE_NO; self.takedamage = DAMAGE_NO;
} }
self.velocity = '0 0 0'; self.velocity = '0 0 0';
@ -569,6 +569,7 @@ void() fd_secret_use = {
SUB_CalcMove(self.dest1, self.speed, fd_secret_move1); SUB_CalcMove(self.dest1, self.speed, fd_secret_move1);
sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM); sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
}; };
void(entity attacker, float damage) fd_secret_pain = {fd_secret_use();};
// Wait after first movement... // Wait after first movement...
void() fd_secret_move1 = { void() fd_secret_move1 = {
@ -614,7 +615,7 @@ void() fd_secret_done = {
if(!self.targetname || self.spawnflags & SECRET_YES_SHOOT) { if(!self.targetname || self.spawnflags & SECRET_YES_SHOOT) {
self.health = 10000; self.health = 10000;
self.takedamage = DAMAGE_YES; self.takedamage = DAMAGE_YES;
self.th_pain = fd_secret_use; self.th_pain = fd_secret_pain;
} }
sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM); sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
}; };
@ -714,7 +715,7 @@ void() func_door_secret = {
if(!self.targetname || self.spawnflags & SECRET_YES_SHOOT) { if(!self.targetname || self.spawnflags & SECRET_YES_SHOOT) {
self.health = 10000; self.health = 10000;
self.takedamage = DAMAGE_YES; self.takedamage = DAMAGE_YES;
self.th_pain = fd_secret_use; self.th_pain = fd_secret_pain;
self.th_die = fd_secret_use; self.th_die = fd_secret_use;
} }
self.oldorigin = self.origin; self.oldorigin = self.origin;

View File

@ -220,7 +220,7 @@ void() finale_4 = {
//============================================================================ //============================================================================
void() nopain = { void(entity attacker, float damage) old_pain = {
self.health = 40000; self.health = 40000;
}; };
@ -251,7 +251,7 @@ void() monster_oldone = {
self.think = old_idle1; self.think = old_idle1;
self.nextthink = time + 0.1; self.nextthink = time + 0.1;
self.takedamage = DAMAGE_YES; self.takedamage = DAMAGE_YES;
self.th_pain = nopain; self.th_pain = old_pain;
self.th_die = finale_1; self.th_die = finale_1;
shub = self; shub = self;

View File

@ -317,7 +317,7 @@ void() player_axpain4 = [ $axpain4, player_axpain5 ] {};
void() player_axpain5 = [ $axpain5, player_axpain6 ] {}; void() player_axpain5 = [ $axpain5, player_axpain6 ] {};
void() player_axpain6 = [ $axpain6, player_run ] {}; void() player_axpain6 = [ $axpain6, player_run ] {};
void() player_pain = { void(entity attacker, float damage) player_pain = {
if(self.weaponframe) { if(self.weaponframe) {
return; return;
} }

View File

@ -83,7 +83,7 @@ void() shal_death5 = [ $death5, shal_death6 ] {};
void() shal_death6 = [ $death6, shal_death7 ] {}; void() shal_death6 = [ $death6, shal_death7 ] {};
void() shal_death7 = [ $death7, shal_death7 ] {}; void() shal_death7 = [ $death7, shal_death7 ] {};
void() shalrath_pain = { void(entity attacker, float damage) shalrath_pain = {
if(self.pain_finished > time) { if(self.pain_finished > time) {
return; return;
} }

View File

@ -1,7 +1,7 @@
// subs.qc: subroutines for think frames // subs.qc: subroutines for think frames
void() SUB_Null = {}; void() SUB_Null = {};
void(entity attacker, float damage) SUB_PainNull = {};
void() SUB_Remove = {remove(self);}; void() SUB_Remove = {remove(self);};
/* /*

View File

@ -1085,21 +1085,12 @@ void() ImpulseCommands = {
W_ChangeWeapon(); W_ChangeWeapon();
} }
if(self.impulse == 9) { switch(self.impulse) {
CheatCommand(); case 9: CheatCommand(); break;
} case 10: CycleWeaponCommand(); break;
if(self.impulse == 10) { case 11: ServerflagsCommand(); break;
CycleWeaponCommand(); case 12: CycleWeaponReverseCommand(); break;
} case 255: QuadCheat(); break;
if(self.impulse == 11) {
ServerflagsCommand();
}
if(self.impulse == 12) {
CycleWeaponReverseCommand();
}
if(self.impulse == 255) {
QuadCheat();
} }
self.impulse = 0; self.impulse = 0;