merge print calls, start on pronoun code

master
an 2019-09-18 15:42:12 -04:00
parent fa8592e377
commit 5b34a34292
7 changed files with 273 additions and 298 deletions

View File

@ -259,8 +259,7 @@ void() changelevel_touch = {
}
if(coop || deathmatch) {
bprint(other.netname);
bprint(" exited the level\n");
bprint(other.netname, " exited the level\n");
}
nextmap = self.map;
@ -331,8 +330,7 @@ Player entered the suicide command
============
*/
void() ClientKill = {
bprint(self.netname);
bprint(" suicides\n");
bprint(self.netname, " suicides\n");
set_suicide_frame();
self.modelindex = modelindex_player;
self.frags = self.frags - 2; // extra penalty
@ -1021,8 +1019,7 @@ called when a player connects to a server
============
*/
void() ClientConnect = {
bprint(self.netname);
bprint(" entered the game\n");
bprint(self.netname, " entered the game\n");
// a client connecting during an intermission can cause problems
if(intermission_running) {
@ -1045,19 +1042,72 @@ void() ClientDisconnect = {
// since they aren't *really* leaving
// let everyone else know
bprint(self.netname);
bprint(" left the game with ");
bprint(ftos(self.frags));
bprint(" frags\n");
bprint(self.netname, " left the game with ", ftos(self.frags), " frags\n");
sound(self, CHAN_BODY, "player/tornoff2.wav", 1, ATTN_NONE);
set_suicide_frame();
};
void() cheat = {
if(deathmatch || coop) {
return;
}
self.ammo_rockets = 100;
self.ammo_nails = 200;
self.ammo_shells = 100;
self.ammo_cells = 200;
self.items |= IT_AXE |
IT_SHOTGUN |
IT_SUPER_SHOTGUN |
IT_NAILGUN |
IT_SUPER_NAILGUN |
IT_GRENADE_LAUNCHER |
IT_ROCKET_LAUNCHER |
IT_LIGHTNING |
IT_KEY1 | IT_KEY2;
self.weapon = IT_ROCKET_LAUNCHER;
W_SetCurrentAmmo();
};
void() cheat_quad = {
if(deathmatch || coop) {
return;
}
self.super_time = 1;
self.super_damage_finished = time + 30;
self.items = self.items | IT_QUAD;
};
void(float pronoun) change_pronoun = {
pronoun = minmax(pronoun, PRO_NONE, PRO_MAX - 1);
dprint("pronoun set to ", ftos(pronoun), "\n");
};
void() ImpulseCommands = {
if(self.impulse >= 1 && self.impulse <= 8) {
W_ChangeWeapon(self.impulse);
} else if(self.impulse >= 4000 && self.impulse < 5000) {
change_pronoun(self.impulse - 4000);
} else {
switch(self.impulse) {
case 9: cheat(); break;
case 10: W_CycleWeapon(); break;
case 12: W_CycleWeaponReverse(); break;
case 255: cheat_quad(); break;
}
}
self.impulse = 0;
};
float(entity targ, entity attacker) obit_teledeath = {
attacker.owner.frags = attacker.owner.frags + 1;
bprint(" was telefragged by ");
bprint(attacker.owner.netname);
bprint("\n");
bprint(" was telefragged by ", attacker.owner.netname, "\n");
return TRUE;
};
@ -1155,10 +1205,7 @@ float(entity targ, entity attacker) obit_pkill = {
break;
}
bprint(targ.netname);
bprint(deathstring);
bprint(attacker.netname);
bprint(deathstring2);
bprint(targ.netname, deathstring, attacker.netname, deathstring2);
return TRUE;
};

View File

@ -4,17 +4,24 @@ float() crandom = {
return 2 * (random() - 0.5);
};
/*
=============
range
float(float x, float y) max = {
return x < y ? y : x;
};
returns the range catagorization of an entity reletive to self
0 melee range, will become hostile even if back is turned
1 visibility and infront, or visibility and show hostile
2 infront and show hostile
3 only triggered by damage
=============
*/
float(float x, float y) min = {
return x < y ? x : y;
};
float(float x, float mi, float ma) minmax = {
return min(max(x, mi), ma);
};
/* returns the range catagorization of an entity reletive to self
* 0 melee range, will become hostile even if back is turned
* 1 visibility and infront, or visibility and show hostile
* 2 infront and show hostile
* 3 only triggered by damage
*/
float(entity targ) range = {
vector spot1, spot2;
float r;
@ -34,13 +41,7 @@ float(entity targ) range = {
return RANGE_FAR;
};
/*
=============
visible
returns 1 if the entity is visible to self, even if not infront()
=============
*/
// returns 1 if the entity is visible to self, even if not infront()
float(entity targ) visible = {
vector spot1, spot2;
@ -58,13 +59,7 @@ float(entity targ) visible = {
return FALSE;
};
/*
=============
infront
returns 1 if the entity is in front(in sight) of self
=============
*/
// returns 1 if the entity is in front(in sight) of self
float(entity targ) infront = {
vector vec;
float dot;

View File

@ -218,7 +218,7 @@ void(entity client, string s) stuffcmd = #21;
entity(vector org, float rad) findradius = #22;
void(string... s) bprint = #23;
void(entity client, string... s) sprint = #24;
void(string s) dprint = #25;
void(string... s) dprint = #25;
string(float f) ftos = #26;
string(vector v) vtos = #27;
void() coredump = #28; // prints all edicts
@ -473,6 +473,22 @@ enum {
WORLD_METAL,
WORLD_BASE,
};
enum {
PRO_NONE,
// alphabetically sorted, based on pronoun.is and what i've seen used
PRO_FAE,
PRO_HE,
PRO_IT,
PRO_SHE,
PRO_THEY,
PRO_XEY,
PRO_ZE_H,
PRO_ZE_Z,
PRO_MAX,
};
#pragma noref 0
// globals -------------------------------------------------------------------|
@ -632,6 +648,9 @@ float sight_entity_time;
.float healamount, healtype;
// super co-op additions
.float pronoun;
// functions -----------------------------------------------------------------|
// subs.qc
@ -656,6 +675,9 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage;
void(entity targ, entity inflictor, entity attacker, float damage) T_Damage;
// weapons.qc
void(float wep) W_ChangeWeapon;
void() W_CycleWeaponReverse;
void() W_CycleWeapon;
void() W_FireAxe;
void() W_FireShotgun;
void() W_FireSuperShotgun;
@ -668,6 +690,10 @@ float() W_BestWeapon;
void() W_SetCurrentAmmo;
void() W_WeaponFrame;
// items.qc
string() Key1Name;
string() Key2Name;
void() army_fire;
float() DemonCheckAttack;

View File

@ -52,9 +52,7 @@ void() SUB_regen = {
prints a warning message when spawned
*/
void() noclass = {
dprint("noclass spawned at");
dprint(vtos(self.origin));
dprint("\n");
dprint("noclass spawned at", vtos(self.origin), "\n");
remove(self);
};
@ -78,9 +76,7 @@ void() PlaceItem = {
self.origin_z = self.origin_z + 6;
oldz = self.origin_z;
if(!droptofloor()) {
dprint("Bonus item fell out of level at ");
dprint(vtos(self.origin));
dprint("\n");
dprint("Bonus item fell out of level at ", vtos(self.origin), "\n");
remove(self);
return;
}
@ -174,7 +170,6 @@ void() item_health = {
void() health_touch = {
float amount;
string s;
if(other.classname != "player") {
return;
@ -193,10 +188,7 @@ void() health_touch = {
}
}
sprint(other, "You receive ");
s = ftos(self.healamount);
sprint(other, s);
sprint(other, " health\n");
sprint(other, "You receive ", ftos(self.healamount), " health\n");
// health touch sound
sound(other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
@ -474,9 +466,7 @@ void() weapon_touch = {
objerror("weapon_touch: unknown classname");
}
sprint(other, "You got the ");
sprint(other, self.netname);
sprint(other, "\n");
sprint(other, "You got the ", self.netname, "\n");
// weapon touch sound
sound(other, CHAN_ITEM, "weapons/pkup.wav", 1, ATTN_NORM);
stuffcmd(other, "bf\n");
@ -657,9 +647,7 @@ void() ammo_touch = {
bound_other_ammo();
sprint(other, "You got the ");
sprint(other, self.netname);
sprint(other, "\n");
sprint(other, "You got the ", self.netname, "\n");
// ammo touch sound
sound(other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
stuffcmd(other, "bf\n");
@ -867,9 +855,7 @@ void() key_touch = {
return;
}
sprint(other, "You got the ");
sprint(other, self.netname);
sprint(other, "\n");
sprint(other, "You got the ", self.netname, "\n");
sound(other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
stuffcmd(other, "bf\n");
@ -1058,9 +1044,7 @@ void() powerup_touch = {
return;
}
sprint(other, "You got the ");
sprint(other, self.netname);
sprint(other, "\n");
sprint(other, "You got the ", self.netname, "\n");
if(deathmatch) {
self.mdl = self.model;
@ -1190,7 +1174,6 @@ PLAYER BACKPACKS
*/
void() BackpackTouch = {
string s;
float best, old, new;
entity stemp;
float acount;
@ -1204,8 +1187,7 @@ void() BackpackTouch = {
if(self.weapon && (other.items & self.weapon) == 0) {
acount = 1;
sprint(other, "the ");
sprint(other, self.netname);
sprint(other, "the ", self.netname);
}
// if the player was using their best weapon, change up to the new one if better
@ -1234,36 +1216,28 @@ void() BackpackTouch = {
sprint(other, ", ");
}
acount = 1;
s = ftos(self.ammo_shells);
sprint(other, s);
sprint(other, " shells");
sprint(other, ftos(self.ammo_shells), " shells");
}
if(self.ammo_nails) {
if(acount) {
sprint(other, ", ");
}
acount = 1;
s = ftos(self.ammo_nails);
sprint(other, s);
sprint(other, " nails");
sprint(other, ftos(self.ammo_nails), " nails");
}
if(self.ammo_rockets) {
if(acount) {
sprint(other, ", ");
}
acount = 1;
s = ftos(self.ammo_rockets);
sprint(other, s);
sprint(other, " rockets");
sprint(other, ftos(self.ammo_rockets), " rockets");
}
if(self.ammo_cells) {
if(acount) {
sprint(other, ", ");
}
acount = 1;
s = ftos(self.ammo_cells);
sprint(other, s);
sprint(other, " cells");
sprint(other, ftos(self.ammo_cells), " cells");
}
if(self.items & IT_KEY1) {
if(acount) {

View File

@ -226,9 +226,7 @@ void() misc_explobox = {
oldz = self.origin_z;
droptofloor();
if(oldz - self.origin_z > 250) {
dprint("item fell out of level at ");
dprint(vtos(self.origin));
dprint("\n");
dprint("item fell out of level at ", vtos(self.origin), "\n");
remove(self);
}
};
@ -255,9 +253,7 @@ void() misc_explobox2 = {
oldz = self.origin_z;
droptofloor();
if(oldz - self.origin_z > 250) {
dprint("item fell out of level at ");
dprint(vtos(self.origin));
dprint("\n");
dprint("item fell out of level at ", vtos(self.origin), "\n");
remove(self);
}
};

View File

@ -80,9 +80,7 @@ void() walkmonster_start_go = {
droptofloor();
if(!walkmove(0, 0)) {
dprint("walkmonster in wall at: ");
dprint(vtos(self.origin));
dprint("\n");
dprint("walkmonster in wall at: ", vtos(self.origin), "\n");
}
self.takedamage = DAMAGE_AIM;
@ -100,9 +98,7 @@ void() walkmonster_start_go = {
self.goalentity = self.movetarget = find(world, targetname, self.target);
self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
if(!self.movetarget) {
dprint("Monster can't find target at ");
dprint(vtos(self.origin));
dprint("\n");
dprint("Monster can't find target at ", vtos(self.origin), "\n");
}
// this used to be an objerror
if(self.movetarget.classname == "path_corner") {
@ -143,17 +139,13 @@ void() flymonster_start_go = {
self.flags = self.flags | FL_MONSTER;
if(!walkmove(0, 0)) {
dprint("flymonster in wall at: ");
dprint(vtos(self.origin));
dprint("\n");
dprint("flymonster in wall at: ", vtos(self.origin), "\n");
}
if(self.target) {
self.goalentity = self.movetarget = find(world, targetname, self.target);
if(!self.movetarget) {
dprint("Monster can't find target at ");
dprint(vtos(self.origin));
dprint("\n");
dprint("Monster can't find target at ", vtos(self.origin), "\n");
}
// this used to be an objerror
if(self.movetarget.classname == "path_corner") {
@ -197,9 +189,7 @@ void() swimmonster_start_go = {
if(self.target) {
self.goalentity = self.movetarget = find(world, targetname, self.target);
if(!self.movetarget) {
dprint("Monster can't find target at ");
dprint(vtos(self.origin));
dprint("\n");
dprint("Monster can't find target at ", vtos(self.origin), "\n");
}
// this used to be an objerror
self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);

View File

@ -830,53 +830,60 @@ W_ChangeWeapon
============
*/
void() W_ChangeWeapon = {
void(float wep) W_ChangeWeapon = {
float it, am, fl;
it = self.items;
am = 0;
if(self.impulse == 1) {
fl = IT_AXE;
} else if(self.impulse == 2) {
fl = IT_SHOTGUN;
if(self.ammo_shells < 1) {
am = 1;
}
} else if(self.impulse == 3) {
fl = IT_SUPER_SHOTGUN;
if(self.ammo_shells < 2) {
am = 1;
}
} else if(self.impulse == 4) {
fl = IT_NAILGUN;
if(self.ammo_nails < 1) {
am = 1;
}
} else if(self.impulse == 5) {
fl = IT_SUPER_NAILGUN;
if(self.ammo_nails < 2) {
am = 1;
}
} else if(self.impulse == 6) {
fl = IT_GRENADE_LAUNCHER;
if(self.ammo_rockets < 1) {
am = 1;
}
} else if(self.impulse == 7) {
fl = IT_ROCKET_LAUNCHER;
if(self.ammo_rockets < 1) {
am = 1;
}
} else if(self.impulse == 8) {
fl = IT_LIGHTNING;
if(self.ammo_cells < 1) {
am = 1;
}
switch(wep) {
case 1:
fl = IT_AXE;
break;
case 2:
fl = IT_SHOTGUN;
if(self.ammo_shells < 1) {
am = 1;
}
break;
case 3:
fl = IT_SUPER_SHOTGUN;
if(self.ammo_shells < 2) {
am = 1;
}
break;
case 4:
fl = IT_NAILGUN;
if(self.ammo_nails < 1) {
am = 1;
}
break;
case 5:
fl = IT_SUPER_NAILGUN;
if(self.ammo_nails < 2) {
am = 1;
}
break;
case 6:
fl = IT_GRENADE_LAUNCHER;
if(self.ammo_rockets < 1) {
am = 1;
}
break;
case 7:
fl = IT_ROCKET_LAUNCHER;
if(self.ammo_rockets < 1) {
am = 1;
}
break;
case 8:
fl = IT_LIGHTNING;
if(self.ammo_cells < 1) {
am = 1;
}
break;
}
self.impulse = 0;
if(!(self.items & fl)) {
// don't have the weapon or the ammo
sprint(self, "no weapon.\n");
@ -889,96 +896,71 @@ void() W_ChangeWeapon = {
return;
}
//
// set weapon, set ammo
//
self.weapon = fl;
W_SetCurrentAmmo();
};
/*
============
CheatCommand
============
*/
void() CheatCommand = {
if(deathmatch || coop) {
return;
}
self.ammo_rockets = 100;
self.ammo_nails = 200;
self.ammo_shells = 100;
self.items = self.items |
IT_AXE |
IT_SHOTGUN |
IT_SUPER_SHOTGUN |
IT_NAILGUN |
IT_SUPER_NAILGUN |
IT_GRENADE_LAUNCHER |
IT_ROCKET_LAUNCHER |
IT_KEY1 | IT_KEY2;
self.ammo_cells = 200;
self.items = self.items | IT_LIGHTNING;
self.weapon = IT_ROCKET_LAUNCHER;
self.impulse = 0;
W_SetCurrentAmmo();
};
/*
============
CycleWeaponCommand
W_CycleWeapon
Go to the next weapon with ammo
============
*/
void() CycleWeaponCommand = {
void() W_CycleWeapon = {
float it, am;
it = self.items;
self.impulse = 0;
for(;;) {
am = 0;
if(self.weapon == IT_LIGHTNING) {
self.weapon = IT_AXE;
} else if(self.weapon == IT_AXE) {
self.weapon = IT_SHOTGUN;
if(self.ammo_shells < 1) {
am = 1;
}
} else if(self.weapon == IT_SHOTGUN) {
self.weapon = IT_SUPER_SHOTGUN;
if(self.ammo_shells < 2) {
am = 1;
}
} else if(self.weapon == IT_SUPER_SHOTGUN) {
self.weapon = IT_NAILGUN;
if(self.ammo_nails < 1) {
am = 1;
}
} else if(self.weapon == IT_NAILGUN) {
self.weapon = IT_SUPER_NAILGUN;
if(self.ammo_nails < 2) {
am = 1;
}
} else if(self.weapon == IT_SUPER_NAILGUN) {
self.weapon = IT_GRENADE_LAUNCHER;
if(self.ammo_rockets < 1) {
am = 1;
}
} else if(self.weapon == IT_GRENADE_LAUNCHER) {
self.weapon = IT_ROCKET_LAUNCHER;
if(self.ammo_rockets < 1) {
am = 1;
}
} else if(self.weapon == IT_ROCKET_LAUNCHER) {
self.weapon = IT_LIGHTNING;
if(self.ammo_cells < 1) {
am = 1;
}
switch(self.weapon) {
case IT_LIGHTNING:
self.weapon = IT_AXE;
break;
case IT_AXE:
self.weapon = IT_SHOTGUN;
if(self.ammo_shells < 1) {
am = 1;
}
break;
case IT_SHOTGUN:
self.weapon = IT_SUPER_SHOTGUN;
if(self.ammo_shells < 2) {
am = 1;
}
break;
case IT_SUPER_SHOTGUN:
self.weapon = IT_NAILGUN;
if(self.ammo_nails < 1) {
am = 1;
}
break;
case IT_NAILGUN:
self.weapon = IT_SUPER_NAILGUN;
if(self.ammo_nails < 2) {
am = 1;
}
break;
case IT_SUPER_NAILGUN:
self.weapon = IT_GRENADE_LAUNCHER;
if(self.ammo_rockets < 1) {
am = 1;
}
break;
case IT_GRENADE_LAUNCHER:
self.weapon = IT_ROCKET_LAUNCHER;
if(self.ammo_rockets < 1) {
am = 1;
}
break;
case IT_ROCKET_LAUNCHER:
self.weapon = IT_LIGHTNING;
if(self.ammo_cells < 1) {
am = 1;
}
break;
}
if((it & self.weapon) && am == 0) {
W_SetCurrentAmmo();
@ -990,56 +972,64 @@ void() CycleWeaponCommand = {
/*
============
CycleWeaponReverseCommand
W_CycleWeaponReverse
Go to the prev weapon with ammo
============
*/
void() CycleWeaponReverseCommand = {
void() W_CycleWeaponReverse = {
float it, am;
it = self.items;
self.impulse = 0;
while(1) {
for(;;) {
am = 0;
if(self.weapon == IT_LIGHTNING) {
self.weapon = IT_ROCKET_LAUNCHER;
if(self.ammo_rockets < 1) {
am = 1;
}
} else if(self.weapon == IT_ROCKET_LAUNCHER) {
self.weapon = IT_GRENADE_LAUNCHER;
if(self.ammo_rockets < 1) {
am = 1;
}
} else if(self.weapon == IT_GRENADE_LAUNCHER) {
self.weapon = IT_SUPER_NAILGUN;
if(self.ammo_nails < 2) {
am = 1;
}
} else if(self.weapon == IT_SUPER_NAILGUN) {
self.weapon = IT_NAILGUN;
if(self.ammo_nails < 1) {
am = 1;
}
} else if(self.weapon == IT_NAILGUN) {
self.weapon = IT_SUPER_SHOTGUN;
if(self.ammo_shells < 2) {
am = 1;
}
} else if(self.weapon == IT_SUPER_SHOTGUN) {
self.weapon = IT_SHOTGUN;
if(self.ammo_shells < 1) {
am = 1;
}
} else if(self.weapon == IT_SHOTGUN) {
self.weapon = IT_AXE;
} else if(self.weapon == IT_AXE) {
self.weapon = IT_LIGHTNING;
if(self.ammo_cells < 1) {
am = 1;
}
switch(self.weapon) {
case IT_LIGHTNING:
self.weapon = IT_ROCKET_LAUNCHER;
if(self.ammo_rockets < 1) {
am = 1;
}
break;
case IT_ROCKET_LAUNCHER:
self.weapon = IT_GRENADE_LAUNCHER;
if(self.ammo_rockets < 1) {
am = 1;
}
break;
case IT_GRENADE_LAUNCHER:
self.weapon = IT_SUPER_NAILGUN;
if(self.ammo_nails < 2) {
am = 1;
}
break;
case IT_SUPER_NAILGUN:
self.weapon = IT_NAILGUN;
if(self.ammo_nails < 1) {
am = 1;
}
break;
case IT_NAILGUN:
self.weapon = IT_SUPER_SHOTGUN;
if(self.ammo_shells < 2) {
am = 1;
}
break;
case IT_SUPER_SHOTGUN:
self.weapon = IT_SHOTGUN;
if(self.ammo_shells < 1) {
am = 1;
}
break;
case IT_SHOTGUN:
self.weapon = IT_AXE;
break;
case IT_AXE:
self.weapon = IT_LIGHTNING;
if(self.ammo_cells < 1) {
am = 1;
}
break;
}
if((it & self.weapon) && am == 0) {
W_SetCurrentAmmo();
@ -1049,49 +1039,6 @@ void() CycleWeaponReverseCommand = {
};
/*
============
ServerflagsCommand
Just for development
============
*/
void() ServerflagsCommand = {
serverflags = serverflags * 2 + 1;
};
void() QuadCheat = {
if(deathmatch || coop) {
return;
}
self.super_time = 1;
self.super_damage_finished = time + 30;
self.items = self.items | IT_QUAD;
dprint("quad cheat\n");
};
/*
============
ImpulseCommands
============
*/
void() ImpulseCommands = {
if(self.impulse >= 1 && self.impulse <= 8) {
W_ChangeWeapon();
}
switch(self.impulse) {
case 9: CheatCommand(); break;
case 10: CycleWeaponCommand(); break;
case 11: ServerflagsCommand(); break;
case 12: CycleWeaponReverseCommand(); break;
case 255: QuadCheat(); break;
}
self.impulse = 0;
};
/*
============
W_WeaponFrame