From f1c8b09b94b4de8d6fb622a44f134ca72e45d7be Mon Sep 17 00:00:00 2001 From: Alison Watson Date: Sun, 15 Sep 2019 19:27:45 -0400 Subject: [PATCH] remove unused stuff, more standards compliance --- gmqcc.ini | 2 ++ source/ai.qc | 61 ---------------------------------------------- source/defs.qc | 14 +++-------- source/doors.qc | 25 ++++++++++--------- source/items.qc | 20 +++++++++------ source/knight.qc | 2 +- source/misc.qc | 13 ++++++---- source/oldone.qc | 2 +- source/plats.qc | 5 +++- source/triggers.qc | 21 ++++++++++------ source/zombie.qc | 4 ++- 11 files changed, 62 insertions(+), 107 deletions(-) diff --git a/gmqcc.ini b/gmqcc.ini index e39736e..85d9c71 100644 --- a/gmqcc.ini +++ b/gmqcc.ini @@ -36,6 +36,8 @@ [warnings] ALL = true + ASSIGN_FUNCTION_TYPES = false + USED_UNINITIALIZED = false [optimizations] PEEPHOLE = true diff --git a/source/ai.qc b/source/ai.qc index 63bd86b..03f4670 100644 --- a/source/ai.qc +++ b/source/ai.qc @@ -31,11 +31,6 @@ walkmove(angle, speed) primitive is all or nothing */ -// -// globals -// -float current_yaw; - // // when a monster becomes angry at a player, that monster will be used // as the sight target the next frame so that monsters near that one @@ -211,62 +206,6 @@ float(entity targ) infront = { }; -//============================================================================ - -/* -=========== -ChangeYaw - -Turns towards self.ideal_yaw at self.yaw_speed -Sets the global variable current_yaw -Called every 0.1 sec by monsters -============ -*/ -/* - -void() ChangeYaw = -{ - local float ideal, move; - -//current_yaw = self.ideal_yaw; -// mod down the current angle - current_yaw = anglemod(self.angles_y ); - ideal = self.ideal_yaw; - - if(current_yaw == ideal) - return; - - move = ideal - current_yaw; - if(ideal > current_yaw) - { - if(move > 180) - move = move - 360; - } - else - { - if(move < -180) - move = move + 360; - } - - if(move > 0) - { - if(move > self.yaw_speed) - move = self.yaw_speed; - } - else - { - if(move < 0-self.yaw_speed ) - move = 0-self.yaw_speed; - } - - current_yaw = anglemod(current_yaw + move); - - self.angles_y = current_yaw; -}; - -*/ - - //============================================================================ void() HuntTarget = { diff --git a/source/defs.qc b/source/defs.qc index c0124e7..d0b7498 100644 --- a/source/defs.qc +++ b/source/defs.qc @@ -1,5 +1,6 @@ // system globals ------------------------------------------------------------| +#pragma noref 1 entity self; entity other; entity world; @@ -46,6 +47,7 @@ float trace_inopen; float trace_inwater; entity msg_entity; // destination of single entity writes +#pragma noref 0 // required prog functions void() main; // only for testing @@ -80,7 +82,7 @@ void end_sys_globals; // flag for structure dumping .float solid; .vector origin; -.vector oldorigin; +.vector oldorigin; // only used by secret door .vector velocity; .vector angles; .vector avelocity; @@ -185,8 +187,6 @@ void(vector ang) makevectors = #1; // sets v_forward, etc globals void(entity e, vector o) setorigin = #2; void(entity e, string m) setmodel = #3; // set movetype and solid first void(entity e, vector min, vector max) setsize = #4; -// #5 was removed -void() break = #6; float() random = #7; // returns 0 - 1 void(entity e, float chan, string samp, float vol, float atten) sound = #8; vector(vector v) normalize = #9; @@ -221,16 +221,13 @@ void() traceon = #29; // turns statment trace on void() traceoff = #30; void(entity e) eprint = #31; // prints an entire edict float(float yaw, float dist) walkmove = #32; // returns TRUE or FALSE -// #33 was removed float() droptofloor = #34; // TRUE if landed on floor void(float style, string value) lightstyle = #35; float(float v) rint = #36; // round to nearest int float(float v) floor = #37; // largest integer <= v float(float v) ceil = #38; // smallest integer >= v -// #39 was removed float(entity e) checkbottom = #40; // true if self is on ground float(vector v) pointcontents = #41; // returns a CONTENT_* -// #42 was removed float(float f) fabs = #43; vector(entity e, float speed) aim = #44; // returns the shooting vector float(string s) cvar = #45; // return cvar.value @@ -239,7 +236,6 @@ entity(entity e) nextent = #47; // for looping through all ents // start a particle effect void(vector o, vector d, float color, float count) particle = #48; void() ChangeYaw = #49; // turn towards self.ideal_yaw at self.yaw_speed -// #50 was removed vector(vector v) vectoangles = #51; // direct client message generation @@ -257,7 +253,6 @@ void(float step) movetogoal = #67; string(string s) precache_file = #68; // no effect except for -copy void(entity e) makestatic = #69; void(string s) changelevel = #70; -//#71 was removed void(string var, string val) cvar_set = #72; // sets cvar.value void(entity client, string s) centerprint = #73; // sprint, but in middle void(vector pos, string samp, float vol, float atten) ambientsound = #74; @@ -474,7 +469,6 @@ float movedist; float gameover; // set when a rule exits string string_null; // null string, nothing should be held here -float empty_float; entity newmis; // launch_spike sets this after spawning it @@ -549,8 +543,6 @@ float skill; .string mdl; .vector mangle; // angle at start -.vector oldorigin; // only used by secret door - .float t_length, t_width; // doors, etc diff --git a/source/doors.qc b/source/doors.qc index 1b2fc9c..a2dcc1f 100644 --- a/source/doors.qc +++ b/source/doors.qc @@ -1,9 +1,10 @@ - -const float DOOR_START_OPEN = 1; -const float DOOR_DONT_LINK = 4; -const float DOOR_GOLD_KEY = 8; -const float DOOR_SILVER_KEY = 16; -const float DOOR_TOGGLE = 32; +enum { + DOOR_START_OPEN = 1, + DOOR_DONT_LINK = 4, + DOOR_GOLD_KEY = 8, + DOOR_SILVER_KEY = 16, + DOOR_TOGGLE = 32, +}; /* @@ -531,11 +532,13 @@ void() fd_secret_move5; void() fd_secret_move6; void() fd_secret_done; -const float SECRET_OPEN_ONCE = 1; // stays open -const float SECRET_1ST_LEFT = 2; // 1st move is left of arrow -const float SECRET_1ST_DOWN = 4; // 1st move is down from arrow -const float SECRET_NO_SHOOT = 8; // only opened by trigger -const float SECRET_YES_SHOOT = 16; // shootable even if targeted +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 = { diff --git a/source/items.qc b/source/items.qc index 34a7ea4..f7e5ba2 100644 --- a/source/items.qc +++ b/source/items.qc @@ -101,8 +101,10 @@ rot you down to your maximum health limit, one point per second. */ -const float H_ROTTEN = 1; -const float H_MEGA = 2; +enum { + H_ROTTEN = 1, + H_MEGA = 2, +}; .float healamount, healtype; void() health_touch; void() item_megahealth_rot; @@ -666,7 +668,9 @@ void() ammo_touch = { -const float WEAPON_BIG2 = 1; +enum { + WEAPON_BIG2 = 1, +}; /*QUAKED item_shells(0 .5 .8) (0 0 0) (32 32 32) big */ @@ -758,10 +762,12 @@ void() item_cells = { DO NOT USE THIS!!!! IT WILL BE REMOVED! */ -const float WEAPON_SHOTGUN = 1; -const float WEAPON_ROCKET = 2; -const float WEAPON_SPIKES = 4; -const float WEAPON_BIG = 8; +enum { + WEAPON_SHOTGUN = 1, + WEAPON_ROCKET = 2, + WEAPON_SPIKES = 4, + WEAPON_BIG = 8, +}; void() item_weapon = { self.touch = ammo_touch; diff --git a/source/knight.qc b/source/knight.qc index 9fdd2bd..6588fd1 100644 --- a/source/knight.qc +++ b/source/knight.qc @@ -29,7 +29,7 @@ $frame painb10 painb11 //frame attack1 attack2 attack3 attack4 attack5 attack6 attack7 //frame attack8 attack9 attack10 attack11 -$frame attackb1 attackb1 attackb2 attackb3 attackb4 attackb5 +$frame attackb1 attackb2 attackb3 attackb4 attackb5 $frame attackb6 attackb7 attackb8 attackb9 attackb10 $frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9 diff --git a/source/misc.qc b/source/misc.qc index d09cd51..d0b6ae0 100644 --- a/source/misc.qc +++ b/source/misc.qc @@ -14,7 +14,9 @@ void() info_notnull = { //============================================================================ -const float START_OFF = 1; +enum { + START_OFF = 1, +}; void() light_use = { if(self.spawnflags & START_OFF) { @@ -155,13 +157,12 @@ Lava Balls void() fire_fly; void() fire_touch; void() misc_fireball = { - precache_model("progs/lavaball.mdl"); self.classname = "fireball"; self.nextthink = time + (random() * 5); self.think = fire_fly; if(!self.speed) { - self.speed == 1000; + self.speed = 1000; } }; @@ -269,8 +270,10 @@ void() misc_explobox2 = { //============================================================================ -const float SPAWNFLAG_SUPERSPIKE = 1; -const float SPAWNFLAG_LASER = 2; +enum { + SPAWNFLAG_SUPERSPIKE = 1, + SPAWNFLAG_LASER = 2, +}; void(vector org, vector vec) LaunchLaser; diff --git a/source/oldone.qc b/source/oldone.qc index a22835b..152f095 100644 --- a/source/oldone.qc +++ b/source/oldone.qc @@ -26,7 +26,7 @@ $frame old30 old31 old32 old33 old34 old35 old36 old37 old38 old39 $frame old40 old41 old42 old43 old44 old45 old46 $frame shake1 shake2 shake3 shake4 shake5 shake6 shake7 shake8 -$frame shake9 shake10 shake11 shake12 shake12 shake13 shake14 +$frame shake9 shake10 shake11 shake12 shake13 shake14 $frame shake15 shake16 shake17 shake18 shake19 shake20 //void() old_stand =[ $old1, old_stand ] {}; diff --git a/source/plats.qc b/source/plats.qc index 730c2d7..b5560a8 100644 --- a/source/plats.qc +++ b/source/plats.qc @@ -6,7 +6,10 @@ void() plat_trigger_use; void() plat_go_up; void() plat_go_down; void() plat_crush; -const float PLAT_LOW_TRIGGER = 1; + +enum { + PLAT_LOW_TRIGGER = 1, +}; void() plat_spawn_inside_trigger = { local entity trigger; diff --git a/source/triggers.qc b/source/triggers.qc index f4c99ca..ee2e3da 100644 --- a/source/triggers.qc +++ b/source/triggers.qc @@ -1,15 +1,14 @@ -entity stemp, otemp, s, old; - - void() trigger_reactivate = { self.solid = SOLID_TRIGGER; }; //============================================================================= -const float SPAWNFLAG_NOMESSAGE = 1; -const float SPAWNFLAG_NOTOUCH = 1; +enum { + SPAWNFLAG_NOMESSAGE = 1, + SPAWNFLAG_NOTOUCH = 1, +}; // the wait time has passed, so set back up for another activation void() multi_wait = { @@ -256,8 +255,10 @@ TELEPORT TRIGGERS ============================================================================== */ -const float PLAYER_ONLY = 1; -const float SILENT = 2; +enum { + PLAYER_ONLY = 1, + SILENT = 2, +}; void() play_teleport = { local float v; @@ -281,6 +282,8 @@ void() play_teleport = { }; void(vector org) spawn_tfog = { + local entity s; + s = spawn(); s.origin = org; s.nextthink = time + 0.2; @@ -533,7 +536,9 @@ void() trigger_hurt = { //============================================================================ -const float PUSH_ONCE = 1; +enum { + PUSH_ONCE = 1, +}; void() trigger_push_touch = { if(other.classname == "grenade") { diff --git a/source/zombie.qc b/source/zombie.qc index 5ab7c98..ddebe47 100644 --- a/source/zombie.qc +++ b/source/zombie.qc @@ -50,7 +50,9 @@ $frame paine29 paine30 $frame cruc_1 cruc_2 cruc_3 cruc_4 cruc_5 cruc_6 -const float SPAWN_CRUCIFIED = 1; +enum { + SPAWN_CRUCIFIED = 1, +}; //=============================================================================