From 661307339e59880cda27cc242e4936daeed208c4 Mon Sep 17 00:00:00 2001 From: Alison Watson Date: Thu, 19 Sep 2019 10:16:20 -0400 Subject: [PATCH] move enums and constants around --- source/client.qc | 21 +++------ source/common.qc | 10 +--- source/defs.qc | 84 ++++++++++++++++++++++++++++++---- source/demon.qc | 2 +- source/doors.qc | 20 +------- source/enforcer.qc | 2 +- source/items.qc | 109 +++++-------------------------------------- source/misc.qc | 49 +++++++------------- source/ogre.qc | 10 ++-- source/oldone.qc | 2 +- source/plats.qc | 6 +-- source/player.qc | 2 +- source/shalrath.qc | 6 +-- source/shambler.qc | 2 +- source/subs.qc | 12 ++--- source/triggers.qc | 40 ++++------------ source/weapons.qc | 112 ++++++++++++++++++++++++--------------------- source/wizard.qc | 6 +-- source/zombie.qc | 12 ++--- 19 files changed, 214 insertions(+), 293 deletions(-) diff --git a/source/client.qc b/source/client.qc index 8db7259..6143d3b 100644 --- a/source/client.qc +++ b/source/client.qc @@ -233,7 +233,7 @@ void() execute_changelevel = { other = find(world, classname, "player"); while(other != world) { - other.view_ofs = '0 0 0'; + other.view_ofs = VEC_ORIGIN; other.angles = other.v_angle = pos.mangle; other.fixangle = TRUE; // turn this way immediately other.nextthink = time + 0.5; @@ -449,7 +449,7 @@ void() PutClientInServer = { setmodel(self, "progs/player.mdl"); modelindex_player = self.modelindex; - setsize(self, VEC_HULL_MIN, VEC_HULL_MAX); + setsize(self, '-16 -16 -24', '16 16 32'); self.view_ofs = '0 0 22'; @@ -593,7 +593,7 @@ void() PlayerDeathThink = { forward = vlen(self.velocity); forward = forward - 20; if(forward <= 0) { - self.velocity = '0 0 0'; + self.velocity = VEC_ORIGIN; } else { self.velocity = forward * normalize(self.velocity); } @@ -782,15 +782,12 @@ Called every frame before physics are run ================ */ void() PlayerPreThink = { - float mspeed, aspeed; - float r; - if(intermission_running) { IntermissionThink(); // otherwise a button could be missed between return; // the think tics } - if(self.view_ofs == '0 0 0') { + if(self.view_ofs == VEC_ORIGIN) { return; // intermission or finale } @@ -820,7 +817,7 @@ void() PlayerPreThink = { // teleporters can force a non-moving pause time if(time < self.pausetime) { - self.velocity = '0 0 0'; + self.velocity = VEC_ORIGIN; } if(time > self.attack_finished && self.currentammo == 0 && self.weapon != IT_AXE) { @@ -952,7 +949,6 @@ void() CheckPowerups = { self.radsuit_finished = 0; } } - }; /* @@ -963,11 +959,8 @@ Called every frame after physics are run ================ */ void() PlayerPostThink = { - float mspeed, aspeed; - float r; - - if(self.view_ofs == '0 0 0') { - return; // intermission or finale + if(self.view_ofs == VEC_ORIGIN) { + return; // intermission, finale or spectating } if(self.deadflag) { return; diff --git a/source/common.qc b/source/common.qc index 968b45f..2f55397 100644 --- a/source/common.qc +++ b/source/common.qc @@ -53,10 +53,7 @@ float(entity targ) visible = { return FALSE; // sight line crossed contents } - if(trace_fraction == 1) { - return TRUE; - } - return FALSE; + return trace_fraction == 1; }; // returns 1 if the entity is in front(in sight) of self @@ -68,10 +65,7 @@ float(entity targ) infront = { vec = normalize(targ.origin - self.origin); dot = vec * v_forward; - if(dot > 0.3) { - return TRUE; - } - return FALSE; + return dot > 0.3; }; // EOF diff --git a/source/defs.qc b/source/defs.qc index 29805e5..b8a3700 100644 --- a/source/defs.qc +++ b/source/defs.qc @@ -20,8 +20,8 @@ float deathmatch; float coop; float teamplay; -float serverflags; // propagated from level to level, used to -// keep track of completed episodes +// propagated from level to level, used to keep track of completed episodes +float serverflags; float total_secrets; float total_monsters; @@ -272,11 +272,15 @@ void(entity e) setspawnparms = #78; // constants -----------------------------------------------------------------| const vector VEC_ORIGIN = '0 0 0'; -const vector VEC_HULL_MIN = '-16 -16 -24'; -const vector VEC_HULL_MAX = '16 16 32'; -const vector VEC_HULL2_MIN = '-32 -32 -24'; -const vector VEC_HULL2_MAX = '32 32 64'; +const string WEPNAME_AXE = "Axe"; +const string WEPNAME_SHOTGUN = "Shotgun"; +const string WEPNAME_SUPER_SHOTGUN = "Double-barrelled Shotgun"; +const string WEPNAME_NAILGUN = "Nailgun"; +const string WEPNAME_SUPER_NAILGUN = "Super Nailgun"; +const string WEPNAME_GRENADE_LAUNCHER = "Grenade Launcher"; +const string WEPNAME_ROCKET_LAUNCHER = "Rocket Launcher"; +const string WEPNAME_LIGHTNING = "Thunderbolt"; enum { FALSE, @@ -302,8 +306,6 @@ enum { // edict.movetype values enum { MOVETYPE_NONE, // never moves - //MOVETYPE_ANGLENOCLIP, - //MOVETYPE_ANGLECLIP, MOVETYPE_WALK = 3, // players only MOVETYPE_STEP, // discrete, not real time unless fall MOVETYPE_FLY, @@ -489,6 +491,72 @@ enum { PRO_MAX, }; + +enum { + DOOR_START_OPEN = 1, + DOOR_DONT_LINK = 4, + DOOR_GOLD_KEY = 8, + DOOR_SILVER_KEY = 16, + DOOR_TOGGLE = 32, +}; + +enum { + SECRET_OPEN_ONCE = 1, // stays open + SECRET_1ST_LEFT = 2, // 1st move is left of arrow + SECRET_1ST_DOWN = 4, // 1st move is down from arrow + SECRET_NO_SHOOT = 8, // only opened by trigger + SECRET_YES_SHOOT = 16, // shootable even if targeted +}; + +enum { + COUNTER_NOMESSAGE = 1, +}; + +enum { + MULTIPLE_NOTOUCH = 1, +}; + +enum { + TELE_PLAYER_ONLY = 1, + TELE_SILENT = 2, +}; + +enum { + PUSH_ONCE = 1, +}; + +enum { + ZOMBIE_SPAWN_CRUCIFIED = 1, +}; + +enum { + PLAT_LOW_TRIGGER = 1, +}; + +enum { + LIGHT_START_OFF = 1, +}; + +enum { + SPIKESHOOTER_SUPER = 1, + SPIKESHOOTER_LASER = 2, +}; + +enum { + HEALTH_ROTTEN = 1, + HEALTH_MEGA = 2, +}; + +enum { + AMMO_BIG = 1, +}; + +enum { + WEAPON_SHOTGUN = 1, + WEAPON_ROCKET = 2, + WEAPON_SPIKES = 4, + WEAPON_BIG = 8, +}; #pragma noref 0 // globals -------------------------------------------------------------------| diff --git a/source/demon.qc b/source/demon.qc index 4a8222f..64b512f 100644 --- a/source/demon.qc +++ b/source/demon.qc @@ -189,7 +189,7 @@ void() monster_demon1 = { setmodel(self, "progs/demon.mdl"); - setsize(self, VEC_HULL2_MIN, VEC_HULL2_MAX); + setsize(self, '-32 -32 -24', '32 32 64'); self.health = 300; self.th_stand = demon1_stand1; diff --git a/source/doors.qc b/source/doors.qc index 91ede9f..d830f5d 100644 --- a/source/doors.qc +++ b/source/doors.qc @@ -1,13 +1,5 @@ // doors.qc: player-triggered moving brush entities -enum { - DOOR_START_OPEN = 1, - DOOR_DONT_LINK = 4, - DOOR_GOLD_KEY = 8, - DOOR_SILVER_KEY = 16, - DOOR_TOGGLE = 32, -}; - /* Doors are similar to buttons, but can spawn a fat trigger field around them @@ -492,14 +484,6 @@ SECRET DOORS ============================================================================= */ -enum { - SECRET_OPEN_ONCE = 1, // stays open - SECRET_1ST_LEFT = 2, // 1st move is left of arrow - SECRET_1ST_DOWN = 4, // 1st move is down from arrow - SECRET_NO_SHOOT = 8, // only opened by trigger - SECRET_YES_SHOOT = 16, // shootable even if targeted -}; - void() fd_secret_use = { float temp; @@ -518,7 +502,7 @@ void() fd_secret_use = { self.th_pain = SUB_PainNull; self.takedamage = DAMAGE_NO; } - self.velocity = '0 0 0'; + self.velocity = VEC_ORIGIN; // Make a sound, wait a little... @@ -682,7 +666,7 @@ void() func_door_secret = { // Magic formula... self.mangle = self.angles; - self.angles = '0 0 0'; + self.angles = VEC_ORIGIN; self.solid = SOLID_BSP; self.movetype = MOVETYPE_PUSH; self.classname = "door"; diff --git a/source/enforcer.qc b/source/enforcer.qc index 611fcc6..5107f0c 100644 --- a/source/enforcer.qc +++ b/source/enforcer.qc @@ -76,7 +76,7 @@ void(vector org, vector vec) LaunchLaser = { newmis.effects = EF_DIMLIGHT; setmodel(newmis, "progs/laser.mdl"); - setsize(newmis, '0 0 0', '0 0 0'); + setsize(newmis, VEC_ORIGIN, VEC_ORIGIN); setorigin(newmis, org); diff --git a/source/items.qc b/source/items.qc index e38ea7e..4692673 100644 --- a/source/items.qc +++ b/source/items.qc @@ -1,14 +1,5 @@ // items.qc: items the player can pick up -const string WEPNAME_AXE = "Axe"; -const string WEPNAME_SHOTGUN = "Shotgun"; -const string WEPNAME_SUPER_SHOTGUN = "Double-barrelled Shotgun"; -const string WEPNAME_NAILGUN = "Nailgun"; -const string WEPNAME_SUPER_NAILGUN = "Super Nailgun"; -const string WEPNAME_GRENADE_LAUNCHER = "Grenade Launcher"; -const string WEPNAME_ROCKET_LAUNCHER = "Rocket Launcher"; -const string WEPNAME_LIGHTNING = "Thunderbolt"; - string() Key1Name = { switch(world.worldtype) { case WORLD_MEDIEVAL: @@ -72,7 +63,7 @@ void() PlaceItem = { self.flags = FL_ITEM; // make extra wide self.solid = SOLID_TRIGGER; self.movetype = MOVETYPE_TOSS; - self.velocity = '0 0 0'; + self.velocity = VEC_ORIGIN; self.origin_z = self.origin_z + 6; oldz = self.origin_z; if(!droptofloor()) { @@ -133,22 +124,17 @@ rot you down to your maximum health limit, one point per second. */ -enum { - H_ROTTEN = 1, - H_MEGA = 2, -}; - void() item_health = { self.touch = health_touch; - if(self.spawnflags & H_ROTTEN) { + if(self.spawnflags & HEALTH_ROTTEN) { precache_model("maps/b_bh10.bsp"); precache_sound("items/r_item1.wav"); setmodel(self, "maps/b_bh10.bsp"); self.noise = "items/r_item1.wav"; self.healamount = 15; self.healtype = 0; - } else if(self.spawnflags & H_MEGA) { + } else if(self.spawnflags & HEALTH_MEGA) { precache_model("maps/b_bh100.bsp"); precache_sound("items/r_item2.wav"); setmodel(self, "maps/b_bh100.bsp"); @@ -163,7 +149,7 @@ void() item_health = { self.healamount = 25; self.healtype = 1; } - setsize(self, '0 0 0', '32 32 56'); + setsize(self, VEC_ORIGIN, '32 32 56'); StartItem(); }; @@ -680,20 +666,12 @@ void() ammo_touch = { SUB_UseTargets(); // fire all targets / killtargets }; - - - -enum { - WEAPON_BIG2 = 1, -}; - /*QUAKED item_shells(0 .5 .8) (0 0 0) (32 32 32) big */ - void() item_shells = { self.touch = ammo_touch; - if(self.spawnflags & WEAPON_BIG2) { + if(self.spawnflags & AMMO_BIG) { precache_model("maps/b_shell1.bsp"); setmodel(self, "maps/b_shell1.bsp"); self.aflag = 40; @@ -704,17 +682,16 @@ void() item_shells = { } self.weapon = 1; self.netname = "shells"; - setsize(self, '0 0 0', '32 32 56'); + setsize(self, VEC_ORIGIN, '32 32 56'); StartItem(); }; /*QUAKED item_spikes(0 .5 .8) (0 0 0) (32 32 32) big */ - void() item_spikes = { self.touch = ammo_touch; - if(self.spawnflags & WEAPON_BIG2) { + if(self.spawnflags & AMMO_BIG) { precache_model("maps/b_nail1.bsp"); setmodel(self, "maps/b_nail1.bsp"); self.aflag = 50; @@ -725,17 +702,16 @@ void() item_spikes = { } self.weapon = 2; self.netname = "nails"; - setsize(self, '0 0 0', '32 32 56'); + setsize(self, VEC_ORIGIN, '32 32 56'); StartItem(); }; /*QUAKED item_rockets(0 .5 .8) (0 0 0) (32 32 32) big */ - void() item_rockets = { self.touch = ammo_touch; - if(self.spawnflags & WEAPON_BIG2) { + if(self.spawnflags & AMMO_BIG) { precache_model("maps/b_rock1.bsp"); setmodel(self, "maps/b_rock1.bsp"); self.aflag = 10; @@ -746,7 +722,7 @@ void() item_rockets = { } self.weapon = 3; self.netname = "rockets"; - setsize(self, '0 0 0', '32 32 56'); + setsize(self, VEC_ORIGIN, '32 32 56'); StartItem(); }; @@ -757,7 +733,7 @@ void() item_rockets = { void() item_cells = { self.touch = ammo_touch; - if(self.spawnflags & WEAPON_BIG2) { + if(self.spawnflags & AMMO_BIG) { precache_model("maps/b_batt1.bsp"); setmodel(self, "maps/b_batt1.bsp"); self.aflag = 12; @@ -768,71 +744,10 @@ void() item_cells = { } self.weapon = 4; self.netname = "cells"; - setsize(self, '0 0 0', '32 32 56'); + setsize(self, VEC_ORIGIN, '32 32 56'); StartItem(); }; - -/*QUAKED item_weapon(0 .5 .8) (0 0 0) (32 32 32) shotgun rocket spikes big -DO NOT USE THIS!!!! IT WILL BE REMOVED! -*/ - -enum { - WEAPON_SHOTGUN = 1, - WEAPON_ROCKET = 2, - WEAPON_SPIKES = 4, - WEAPON_BIG = 8, -}; -void() item_weapon = { - self.touch = ammo_touch; - - if(self.spawnflags & WEAPON_SHOTGUN) { - if(self.spawnflags & WEAPON_BIG) { - precache_model("maps/b_shell1.bsp"); - setmodel(self, "maps/b_shell1.bsp"); - self.aflag = 40; - } else { - precache_model("maps/b_shell0.bsp"); - setmodel(self, "maps/b_shell0.bsp"); - self.aflag = 20; - } - self.weapon = 1; - self.netname = "shells"; - } - - if(self.spawnflags & WEAPON_SPIKES) { - if(self.spawnflags & WEAPON_BIG) { - precache_model("maps/b_nail1.bsp"); - setmodel(self, "maps/b_nail1.bsp"); - self.aflag = 40; - } else { - precache_model("maps/b_nail0.bsp"); - setmodel(self, "maps/b_nail0.bsp"); - self.aflag = 20; - } - self.weapon = 2; - self.netname = "spikes"; - } - - if(self.spawnflags & WEAPON_ROCKET) { - if(self.spawnflags & WEAPON_BIG) { - precache_model("maps/b_rock1.bsp"); - setmodel(self, "maps/b_rock1.bsp"); - self.aflag = 10; - } else { - precache_model("maps/b_rock0.bsp"); - setmodel(self, "maps/b_rock0.bsp"); - self.aflag = 5; - } - self.weapon = 3; - self.netname = "rockets"; - } - - setsize(self, '0 0 0', '32 32 56'); - StartItem(); -}; - - /* =============================================================================== diff --git a/source/misc.qc b/source/misc.qc index b26862e..1df3e3f 100644 --- a/source/misc.qc +++ b/source/misc.qc @@ -15,17 +15,13 @@ void() info_notnull = { //============================================================================ -enum { - START_OFF = 1, -}; - void() light_use = { - if(self.spawnflags & START_OFF) { + if(self.spawnflags & LIGHT_START_OFF) { lightstyle(self.style, "m"); - self.spawnflags = self.spawnflags - START_OFF; + self.spawnflags = self.spawnflags - LIGHT_START_OFF; } else { lightstyle(self.style, "a"); - self.spawnflags = self.spawnflags + START_OFF; + self.spawnflags = self.spawnflags + LIGHT_START_OFF; } }; @@ -44,7 +40,7 @@ void() light = { if(self.style >= 32) { self.use = light_use; - if(self.spawnflags & START_OFF) { + if(self.spawnflags & LIGHT_START_OFF) { lightstyle(self.style, "a"); } else { lightstyle(self.style, "m"); @@ -62,7 +58,7 @@ Makes steady fluorescent humming sound void() light_fluoro = { if(self.style >= 32) { self.use = light_use; - if(self.spawnflags & START_OFF) { + if(self.spawnflags & LIGHT_START_OFF) { lightstyle(self.style, "a"); } else { lightstyle(self.style, "m"); @@ -176,7 +172,7 @@ void() fire_fly = { fireball.velocity_z = self.speed + (random() * 200); fireball.classname = "fireball"; setmodel(fireball, "progs/lavaball.mdl"); - setsize(fireball, '0 0 0', '0 0 0'); + setsize(fireball, VEC_ORIGIN, VEC_ORIGIN); setorigin(fireball, self.origin); fireball.nextthink = time + 5; fireball.think = SUB_Remove; @@ -199,7 +195,7 @@ void() barrel_explode = { // did say self.owner T_RadiusDamage(self, self, 160, world); sound(self, CHAN_VOICE, "weapons/r_exp3.wav", 1, ATTN_NORM); - particle(self.origin, '0 0 0', 75, 255); + particle(self.origin, VEC_ORIGIN, 75, 255); self.origin_z = self.origin_z + 32; BecomeExplosion(); @@ -260,20 +256,15 @@ void() misc_explobox2 = { //============================================================================ -enum { - SPAWNFLAG_SUPERSPIKE = 1, - SPAWNFLAG_LASER = 2, -}; - void() spikeshooter_use = { - if(self.spawnflags & SPAWNFLAG_LASER) { + if(self.spawnflags & SPIKESHOOTER_LASER) { sound(self, CHAN_VOICE, "enforcer/enfire.wav", 1, ATTN_NORM); LaunchLaser(self.origin, self.movedir); } else { sound(self, CHAN_VOICE, "weapons/spike2.wav", 1, ATTN_NORM); launch_spike(self.origin, self.movedir); newmis.velocity = self.movedir * 500; - if(self.spawnflags & SPAWNFLAG_SUPERSPIKE) { + if(self.spawnflags & SPIKESHOOTER_SUPER) { newmis.touch = superspike_touch; } } @@ -293,7 +284,7 @@ Laser is only for REGISTERED. void() trap_spikeshooter = { SetMovedir(); self.use = spikeshooter_use; - if(self.spawnflags & SPAWNFLAG_LASER) { + if(self.spawnflags & SPIKESHOOTER_LASER) { precache_model2("progs/laser.mdl"); precache_sound2("enforcer/enfire.wav"); precache_sound2("enforcer/enfstop.wav"); @@ -442,9 +433,7 @@ void() bubble_bob = { Just for the debugging level. Don't use */ -void() viewthing = - -{ +void() viewthing = { self.movetype = MOVETYPE_NONE; self.solid = SOLID_NOT; precache_model("progs/player.mdl"); @@ -468,7 +457,7 @@ void() func_wall_use = { This is just a solid wall if not inhibitted */ void() func_wall = { - self.angles = '0 0 0'; + self.angles = VEC_ORIGIN; self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything self.solid = SOLID_BSP; self.use = func_wall_use; @@ -479,7 +468,7 @@ void() func_wall = { A simple entity that looks solid but lets you walk through it. */ void() func_illusionary = { - self.angles = '0 0 0'; + self.angles = VEC_ORIGIN; self.movetype = MOVETYPE_NONE; self.solid = SOLID_NOT; setmodel(self, self.model); @@ -489,14 +478,12 @@ void() func_illusionary = { /*QUAKED func_episodegate(0 .5 .8) ? E1 E2 E3 E4 This bmodel will appear if the episode has allready been completed, so players can't reenter it. */ -void() func_episodegate = - -{ +void() func_episodegate = { if(!(serverflags & self.spawnflags)) { return; // can still enter episode } - self.angles = '0 0 0'; + self.angles = VEC_ORIGIN; self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything self.solid = SOLID_BSP; self.use = func_wall_use; @@ -506,13 +493,11 @@ void() func_episodegate = /*QUAKED func_bossgate(0 .5 .8) ? This bmodel appears unless players have all of the episode sigils. */ -void() func_bossgate = - -{ +void() func_bossgate = { if((serverflags & 15) == 15) { return; // all episodes completed } - self.angles = '0 0 0'; + self.angles = VEC_ORIGIN; self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything self.solid = SOLID_BSP; self.use = func_wall_use; diff --git a/source/ogre.qc b/source/ogre.qc index 02eab89..fe543bc 100644 --- a/source/ogre.qc +++ b/source/ogre.qc @@ -53,7 +53,7 @@ void() OgreGrenadeExplode = { WriteCoord(MSG_BROADCAST, self.origin_y); WriteCoord(MSG_BROADCAST, self.origin_z); - self.velocity = '0 0 0'; + self.velocity = VEC_ORIGIN; self.touch = SUB_Null; setmodel(self, "progs/s_explod.spr"); self.solid = SOLID_NOT; @@ -69,8 +69,8 @@ void() OgreGrenadeTouch = { return; } sound(self, CHAN_VOICE, "weapons/bounce.wav", 1, ATTN_NORM); // bounce sound - if(self.velocity == '0 0 0') { - self.avelocity = '0 0 0'; + if(self.velocity == VEC_ORIGIN) { + self.avelocity = VEC_ORIGIN; } }; @@ -110,7 +110,7 @@ void() OgreFireGrenade = { missile.think = OgreGrenadeExplode; setmodel(missile, "progs/grenade.mdl"); - setsize(missile, '0 0 0', '0 0 0'); + setsize(missile, VEC_ORIGIN, VEC_ORIGIN); setorigin(missile, self.origin); }; @@ -422,7 +422,7 @@ void() monster_ogre = { setmodel(self, "progs/ogre.mdl"); - setsize(self, VEC_HULL2_MIN, VEC_HULL2_MAX); + setsize(self, '-32 -32 -24', '32 32 64'); self.health = 200; self.th_stand = ogre_stand1; diff --git a/source/oldone.qc b/source/oldone.qc index a4e62f0..3c64aec 100644 --- a/source/oldone.qc +++ b/source/oldone.qc @@ -116,7 +116,7 @@ void() finale_1 = { pl = find(world, classname, "player"); while(pl != world) { - pl.view_ofs = '0 0 0'; + pl.view_ofs = VEC_ORIGIN; pl.angles = other.v_angle = pos.mangle; pl.fixangle = TRUE; // turn this way immediately pl.map = self.map; diff --git a/source/plats.qc b/source/plats.qc index 75dd96c..ee346b4 100644 --- a/source/plats.qc +++ b/source/plats.qc @@ -1,9 +1,5 @@ // plats.qc: moving platforms -enum { - PLAT_LOW_TRIGGER = 1, -}; - void() plat_spawn_inside_trigger = { entity trigger; vector tmin, tmax; @@ -165,7 +161,7 @@ void() func_plat = { } self.mangle = self.angles; - self.angles = '0 0 0'; + self.angles = VEC_ORIGIN; self.classname = "plat"; self.solid = SOLID_BSP; diff --git a/source/player.qc b/source/player.qc index d74657c..aaf407d 100644 --- a/source/player.qc +++ b/source/player.qc @@ -436,7 +436,7 @@ void(string gibname, float dm) ThrowGib = { new = spawn(); new.origin = self.origin; setmodel(new, gibname); - setsize(new, '0 0 0', '0 0 0'); + setsize(new, VEC_ORIGIN, VEC_ORIGIN); new.velocity = VelocityForDamage(dm); new.movetype = MOVETYPE_BOUNCE; new.solid = SOLID_NOT; diff --git a/source/shalrath.qc b/source/shalrath.qc index e94e634..c8fced6 100644 --- a/source/shalrath.qc +++ b/source/shalrath.qc @@ -137,7 +137,7 @@ void() ShalMissile = { missile.movetype = MOVETYPE_FLYMISSILE; setmodel(missile, "progs/v_spike.mdl"); - setsize(missile, '0 0 0', '0 0 0'); + setsize(missile, VEC_ORIGIN, VEC_ORIGIN); missile.origin = self.origin + '0 0 10'; missile.velocity = dir * 400; @@ -182,7 +182,7 @@ void() ShalMissileTouch = { WriteCoord(MSG_BROADCAST, self.origin_y); WriteCoord(MSG_BROADCAST, self.origin_z); - self.velocity = '0 0 0'; + self.velocity = VEC_ORIGIN; self.touch = SUB_Null; setmodel(self, "progs/s_explod.spr"); self.solid = SOLID_NOT; @@ -213,7 +213,7 @@ void() monster_shalrath = { self.movetype = MOVETYPE_STEP; setmodel(self, "progs/shalrath.mdl"); - setsize(self, VEC_HULL2_MIN, VEC_HULL2_MAX); + setsize(self, '-32 -32 -24', '32 32 64'); self.health = 400; self.th_stand = shal_stand; diff --git a/source/shambler.qc b/source/shambler.qc index 7f72137..bb6a4c2 100644 --- a/source/shambler.qc +++ b/source/shambler.qc @@ -346,7 +346,7 @@ void() monster_shambler = { self.movetype = MOVETYPE_STEP; setmodel(self, "progs/shambler.mdl"); - setsize(self, VEC_HULL2_MIN, VEC_HULL2_MAX); + setsize(self, '-32 -32 -24', '32 32 64'); self.health = 600; self.th_stand = sham_stand1; diff --git a/source/subs.qc b/source/subs.qc index 27bd729..3ddf62c 100644 --- a/source/subs.qc +++ b/source/subs.qc @@ -18,7 +18,7 @@ void() SetMovedir = { self.movedir = v_forward; } - self.angles = '0 0 0'; + self.angles = VEC_ORIGIN; }; /* @@ -29,7 +29,7 @@ InitTrigger void() InitTrigger = { // trigger angles are used for one-way touches. An angle of 0 is assumed // to mean no restrictions, so use a yaw of 360 instead. - if(self.angles != '0 0 0') { + if(self.angles != VEC_ORIGIN) { SetMovedir(); } self.solid = SOLID_TRIGGER; @@ -69,7 +69,7 @@ void(vector tdest, float tspeed, void() func) SUB_CalcMove = { self.think = SUB_CalcMoveDone; if(tdest == self.origin) { - self.velocity = '0 0 0'; + self.velocity = VEC_ORIGIN; self.nextthink = self.ltime + 0.1; return; } @@ -84,7 +84,7 @@ void(vector tdest, float tspeed, void() func) SUB_CalcMove = { traveltime = len / tspeed; if(traveltime < 0.1) { - self.velocity = '0 0 0'; + self.velocity = VEC_ORIGIN; self.nextthink = self.ltime + 0.1; return; } @@ -103,7 +103,7 @@ After moving, set origin to exact final destination */ void() SUB_CalcMoveDone = { setorigin(self, self.finaldest); - self.velocity = '0 0 0'; + self.velocity = VEC_ORIGIN; self.nextthink = -1; if(self.think1) { self.think1(); @@ -163,7 +163,7 @@ After rotating, set angle to exact final angle */ void() SUB_CalcAngleMoveDone = { self.angles = self.finalangle; - self.avelocity = '0 0 0'; + self.avelocity = VEC_ORIGIN; self.nextthink = -1; if(self.think1) { self.think1(); diff --git a/source/triggers.qc b/source/triggers.qc index 6928c70..6d43ce1 100644 --- a/source/triggers.qc +++ b/source/triggers.qc @@ -6,14 +6,6 @@ void() trigger_reactivate = { //============================================================================= -enum { - SPAWNFLAG_NOMESSAGE = 1, -}; - -enum { - SPAWNFLAG_NOTOUCH = 1, -}; - // the wait time has passed, so set back up for another activation void() multi_wait = { if(self.max_health) { @@ -78,7 +70,7 @@ void() multi_touch = { } // if the trigger has an angles field, check player's facing direction - if(self.movedir != '0 0 0') { + if(self.movedir != VEC_ORIGIN) { makevectors(other.angles); if(v_forward * self.movedir < 0) { return; // not facing the right way @@ -122,7 +114,7 @@ void() trigger_multiple = { InitTrigger(); if(self.health) { - if(self.spawnflags & SPAWNFLAG_NOTOUCH) { + if(self.spawnflags & MULTIPLE_NOTOUCH) { objerror("health and notouch don't make sense\n"); } self.max_health = self.health; @@ -131,7 +123,7 @@ void() trigger_multiple = { self.solid = SOLID_BBOX; setorigin(self, self.origin); // make sure it links into the world } else { - if(!(self.spawnflags & SPAWNFLAG_NOTOUCH)) { + if(!(self.spawnflags & MULTIPLE_NOTOUCH)) { self.touch = multi_touch; } } @@ -199,8 +191,6 @@ void() trigger_secret = { //============================================================================= void() counter_use = { - string junk; - self.count = self.count - 1; if(self.count < 0) { return; @@ -208,7 +198,7 @@ void() counter_use = { if(self.count != 0) { if(activator.classname == "player" - && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0) { + && (self.spawnflags & COUNTER_NOMESSAGE) == 0) { if(self.count >= 4) { centerprint(activator, "There are more to go..."); } else if(self.count == 3) { @@ -222,8 +212,7 @@ void() counter_use = { return; } - if(activator.classname == "player" - && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0) { + if(activator.classname == "player" && (self.spawnflags & COUNTER_NOMESSAGE) == 0) { centerprint(activator, "Sequence completed!"); } self.enemy = activator; @@ -254,11 +243,6 @@ TELEPORT TRIGGERS ============================================================================== */ -enum { - PLAYER_ONLY = 1, - SILENT = 2, -}; - void() play_teleport = { float v; string tmpstr; @@ -324,7 +308,7 @@ void(vector org, entity death_owner) spawn_tdeath = { death.classname = "teledeath"; death.movetype = MOVETYPE_NONE; death.solid = SOLID_TRIGGER; - death.angles = '0 0 0'; + death.angles = VEC_ORIGIN; setsize(death, death_owner.mins - '1 1 1', death_owner.maxs + '1 1 1'); setorigin(death, org); death.touch = tdeath_touch; @@ -345,7 +329,7 @@ void() teleport_touch = { } } - if(self.spawnflags & PLAYER_ONLY) { + if(self.spawnflags & TELE_PLAYER_ONLY) { if(other.classname != "player") { return; } @@ -399,7 +383,7 @@ This is the destination marker for a teleporter. It should have a "targetname" f void() info_teleport_destination = { // this does nothing, just serves as a target spot self.mangle = self.angles; - self.angles = '0 0 0'; + self.angles = VEC_ORIGIN; self.model = ""; self.origin = self.origin + '0 0 27'; if(!self.targetname) { @@ -429,7 +413,7 @@ void() trigger_teleport = { } self.use = teleport_use; - if(!(self.spawnflags & SILENT)) { + if(!(self.spawnflags & TELE_SILENT)) { precache_sound("ambience/hum1.wav"); o = (self.mins + self.maxs) * 0.5; ambientsound(o, "ambience/hum1.wav", 0.5, ATTN_STATIC); @@ -532,10 +516,6 @@ void() trigger_hurt = { //============================================================================ -enum { - PUSH_ONCE = 1, -}; - void() trigger_push_touch = { if(other.classname == "grenade") { other.velocity = self.speed * self.movedir * 10; @@ -597,7 +577,7 @@ void() trigger_monsterjump = { if(!self.height) { self.height = 200; } - if(self.angles == '0 0 0') { + if(self.angles == VEC_ORIGIN) { self.angles = '0 360 0'; } InitTrigger(); diff --git a/source/weapons.qc b/source/weapons.qc index fc2b20e..cb00b31 100644 --- a/source/weapons.qc +++ b/source/weapons.qc @@ -36,7 +36,7 @@ void() W_FireAxe = { if(trace_ent.takedamage) { trace_ent.axhitme = 1; - SpawnBlood(org, '0 0 0', 20); + SpawnBlood(org, VEC_ORIGIN, 20); T_Damage(trace_ent, self, self, 20); } else { // hit wall @@ -88,7 +88,7 @@ void(vector org, vector vel) SpawnMeatSpray = { missile.think = SUB_Remove; setmodel(missile, "progs/zom_gib.mdl"); - setsize(missile, '0 0 0', '0 0 0'); + setsize(missile, VEC_ORIGIN, VEC_ORIGIN); setorigin(missile, org); }; @@ -277,7 +277,7 @@ void() s_explode6 = [5, SUB_Remove] {}; void() BecomeExplosion = { self.movetype = MOVETYPE_NONE; - self.velocity = '0 0 0'; + self.velocity = VEC_ORIGIN; self.touch = SUB_Null; setmodel(self, "progs/s_explod.spr"); self.solid = SOLID_NOT; @@ -356,7 +356,7 @@ void() W_FireRocket = { missile.think = SUB_Remove; setmodel(missile, "progs/missile.mdl"); - setsize(missile, '0 0 0', '0 0 0'); + setsize(missile, VEC_ORIGIN, VEC_ORIGIN); setorigin(missile, self.origin + v_forward * 8 + '0 0 16'); }; @@ -479,8 +479,8 @@ void() GrenadeTouch = { return; } sound(self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM); // bounce sound - if(self.velocity == '0 0 0') { - self.avelocity = '0 0 0'; + if(self.velocity == VEC_ORIGIN) { + self.avelocity = VEC_ORIGIN; } }; @@ -527,7 +527,7 @@ void() W_FireGrenade = { missile.think = GrenadeExplode; setmodel(missile, "progs/grenade.mdl"); - setsize(missile, '0 0 0', '0 0 0'); + setsize(missile, VEC_ORIGIN, VEC_ORIGIN); setorigin(missile, self.origin); }; @@ -679,51 +679,61 @@ PLAYER WEAPON USE void() W_SetCurrentAmmo = { player_run(); // get out of any weapon firing states - self.items = self.items - (self.items & (IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS)); + self.items &= ~(IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS); - if(self.weapon == IT_AXE) { - self.currentammo = 0; - self.weaponmodel = "progs/v_axe.mdl"; - self.weaponframe = 0; - } else if(self.weapon == IT_SHOTGUN) { - self.currentammo = self.ammo_shells; - self.weaponmodel = "progs/v_shot.mdl"; - self.weaponframe = 0; - self.items = self.items | IT_SHELLS; - } else if(self.weapon == IT_SUPER_SHOTGUN) { - self.currentammo = self.ammo_shells; - self.weaponmodel = "progs/v_shot2.mdl"; - self.weaponframe = 0; - self.items = self.items | IT_SHELLS; - } else if(self.weapon == IT_NAILGUN) { - self.currentammo = self.ammo_nails; - self.weaponmodel = "progs/v_nail.mdl"; - self.weaponframe = 0; - self.items = self.items | IT_NAILS; - } else if(self.weapon == IT_SUPER_NAILGUN) { - self.currentammo = self.ammo_nails; - self.weaponmodel = "progs/v_nail2.mdl"; - self.weaponframe = 0; - self.items = self.items | IT_NAILS; - } else if(self.weapon == IT_GRENADE_LAUNCHER) { - self.currentammo = self.ammo_rockets; - self.weaponmodel = "progs/v_rock.mdl"; - self.weaponframe = 0; - self.items = self.items | IT_ROCKETS; - } else if(self.weapon == IT_ROCKET_LAUNCHER) { - self.currentammo = self.ammo_rockets; - self.weaponmodel = "progs/v_rock2.mdl"; - self.weaponframe = 0; - self.items = self.items | IT_ROCKETS; - } else if(self.weapon == IT_LIGHTNING) { - self.currentammo = self.ammo_cells; - self.weaponmodel = "progs/v_light.mdl"; - self.weaponframe = 0; - self.items = self.items | IT_CELLS; - } else { - self.currentammo = 0; - self.weaponmodel = ""; - self.weaponframe = 0; + switch(self.weapon) { + case IT_AXE: + self.currentammo = 0; + self.weaponmodel = "progs/v_axe.mdl"; + self.weaponframe = 0; + break; + case IT_SHOTGUN: + self.currentammo = self.ammo_shells; + self.weaponmodel = "progs/v_shot.mdl"; + self.weaponframe = 0; + self.items |= IT_SHELLS; + break; + case IT_SUPER_SHOTGUN: + self.currentammo = self.ammo_shells; + self.weaponmodel = "progs/v_shot2.mdl"; + self.weaponframe = 0; + self.items |= IT_SHELLS; + break; + case IT_NAILGUN: + self.currentammo = self.ammo_nails; + self.weaponmodel = "progs/v_nail.mdl"; + self.weaponframe = 0; + self.items |= IT_NAILS; + break; + case IT_SUPER_NAILGUN: + self.currentammo = self.ammo_nails; + self.weaponmodel = "progs/v_nail2.mdl"; + self.weaponframe = 0; + self.items |= IT_NAILS; + break; + case IT_GRENADE_LAUNCHER: + self.currentammo = self.ammo_rockets; + self.weaponmodel = "progs/v_rock.mdl"; + self.weaponframe = 0; + self.items |= IT_ROCKETS; + break; + case IT_ROCKET_LAUNCHER: + self.currentammo = self.ammo_rockets; + self.weaponmodel = "progs/v_rock2.mdl"; + self.weaponframe = 0; + self.items |= IT_ROCKETS; + break; + case IT_LIGHTNING: + self.currentammo = self.ammo_cells; + self.weaponmodel = "progs/v_light.mdl"; + self.weaponframe = 0; + self.items |= IT_CELLS; + break; + default: + self.currentammo = 0; + self.weaponmodel = ""; + self.weaponframe = 0; + break; } }; diff --git a/source/wizard.qc b/source/wizard.qc index fe2e148..b9a68fb 100644 --- a/source/wizard.qc +++ b/source/wizard.qc @@ -62,7 +62,7 @@ void(entity missile, float mspeed, float accuracy) LaunchMissile = { missile.velocity = vec * mspeed; - missile.angles = '0 0 0'; + missile.angles = VEC_ORIGIN; missile.angles_y = vectoyaw(missile.velocity); // set missile duration @@ -196,7 +196,7 @@ void() Wiz_StartFast = { missile = spawn(); missile.owner = self; missile.nextthink = time + 0.6; - setsize(missile, '0 0 0', '0 0 0'); + setsize(missile, VEC_ORIGIN, VEC_ORIGIN); setorigin(missile, self.origin + '0 0 30' + v_forward * 14 + v_right * 14); missile.enemy = self.enemy; missile.nextthink = time + 0.8; @@ -206,7 +206,7 @@ void() Wiz_StartFast = { missile = spawn(); missile.owner = self; missile.nextthink = time + 1; - setsize(missile, '0 0 0', '0 0 0'); + setsize(missile, VEC_ORIGIN, VEC_ORIGIN); setorigin(missile, self.origin + '0 0 30' + v_forward * 14 + v_right * -14); missile.enemy = self.enemy; missile.nextthink = time + 0.3; diff --git a/source/zombie.qc b/source/zombie.qc index ce469ee..a780e69 100644 --- a/source/zombie.qc +++ b/source/zombie.qc @@ -45,10 +45,6 @@ $frame paine29 paine30 $frame cruc_1 cruc_2 cruc_3 cruc_4 cruc_5 cruc_6 -enum { - SPAWN_CRUCIFIED = 1, -}; - //============================================================================= void() zombie_stand1 = [ $stand1, zombie_stand2 ] {ai_stand();}; @@ -149,8 +145,8 @@ void() ZombieGrenadeTouch = { return; } sound(self, CHAN_WEAPON, "zombie/z_miss.wav", 1, ATTN_NORM); // bounce sound - self.velocity = '0 0 0'; - self.avelocity = '0 0 0'; + self.velocity = VEC_ORIGIN; + self.avelocity = VEC_ORIGIN; self.touch = SUB_Remove; }; @@ -190,7 +186,7 @@ void(vector st) ZombieFireGrenade = { missile.think = SUB_Remove; setmodel(missile, "progs/zom_gib.mdl"); - setsize(missile, '0 0 0', '0 0 0'); + setsize(missile, VEC_ORIGIN, VEC_ORIGIN); setorigin(missile, org); }; @@ -497,7 +493,7 @@ void() monster_zombie = { self.th_die = zombie_die; self.th_missile = zombie_missile; - if(self.spawnflags & SPAWN_CRUCIFIED) { + if(self.spawnflags & ZOMBIE_SPAWN_CRUCIFIED) { self.movetype = MOVETYPE_NONE; zombie_cruc1(); } else {