diff --git a/.gitignore b/.gitignore index f23d55d..0b39f99 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ config.cfg errors.txt progs.dat +progs.lno diff --git a/gmqcc.ini b/gmqcc.ini index 874b1d9..e39736e 100644 --- a/gmqcc.ini +++ b/gmqcc.ini @@ -1,2 +1,52 @@ [flags] -ASSIGN_FUNCTION_TYPES = true + ADJUST_VECTOR_FIELDS = true + ARITHMETIC_EXCEPTIONS = true + ASSIGN_FUNCTION_TYPES = true + BAIL_ON_WERROR = true + CORRECT_LOGIC = true + CORRECT_TERNARY = true + DARKPLACES_STRING_TABLE_BUG = true + DEFAULT_ERASEABLE = false + EMULATE_STATE = false + EXPRESSIONS_FOR_BUILTINS = false + FALSE_EMPTY_STRINGS = true + FTEPP = true + FTEPP_INDIRECT_EXPANSION = true + FTEPP_MATHDEFS = true + FTEPP_PREDEFS = true + INITIALIZED_NONCONSTANTS = false + LEGACY_VECTOR_MATHS = false + LNO = true + LOOP_LABELS = true + PERL_LOGIC = false + PERMISSIVE = false + RELAXED_SWITCH = false + RETURN_ASSIGNMENTS = false + SHORT_LOGIC = true + SINGLE_VECTOR_DEFS = false + SORT_OPERANDS = false + SPLIT_VECTOR_PARAMETERS = false + TRANSLATABLE_STRINGS = true + TRUE_EMPTY_STRINGS = false + TYPELESS_STORES = false + UNSAFE_VARARGS = false + UNTYPED_NIL = false + UTF8 = true + VARIADIC_ARGS = true + +[warnings] + ALL = true + +[optimizations] + PEEPHOLE = true + TAIL_RECURSION = true + OVERLAP_LOCALS = true + LOCAL_TEMPS = true + GLOBAL_TEMPS = true + STRIP_CONSTANT_NAMES = true + OVERLAP_STRINGS = true + CALL_STORES = true + VOID_RETURN = true + VECTOR_COMPONENTS = true + CONST_FOLD_DCE = true + CONST_FOLD = true diff --git a/source/ai.qc b/source/ai.qc index ba6c8d1..63bd86b 100644 --- a/source/ai.qc +++ b/source/ai.qc @@ -361,7 +361,7 @@ float() FindTarget = { if(sight_entity_time >= time - 0.1 && !(self.spawnflags & 3)) { client = sight_entity; if(client.enemy == self.enemy) { - return; + return FALSE; } } else { client = checkclient(); @@ -572,7 +572,7 @@ float() DogCheckAttack; float() CheckAnyAttack = { if(!enemy_vis) { - return; + return 0; } if(self.classname == "monster_army") { return SoldierCheckAttack(); diff --git a/source/defs.qc b/source/defs.qc index 6fa272d..c0124e7 100644 --- a/source/defs.qc +++ b/source/defs.qc @@ -1,29 +1,17 @@ +// system globals ------------------------------------------------------------| -/* -============================================================================== - - SOURCE FOR GLOBALVARS_T C STRUCTURE - -============================================================================== -*/ - -// -// system globals -// entity self; entity other; entity world; float time; float frametime; -float force_retouch; // force all entities to touch triggers -// next frame. this is needed because -// non-moving things don't normally scan -// for triggers, and when a trigger is -// created(like a teleport trigger), it -// needs to catch everything. -// decremented each frame, so set to 2 -// to guarantee everything is touched +/* force all entities to touch triggers next frame. this is needed because + * non-moving things don't normally scan for triggers, and when a trigger is + * created(like a teleport trigger), it needs to catch everything. decremented + * each frame, so set to 2 to guarantee everything is touched + */ +float force_retouch; string mapname; float deathmatch; @@ -39,14 +27,11 @@ float total_monsters; float found_secrets; // number of secrets found float killed_monsters; // number of monsters killed - // spawnparms are used to encode information about clients across server // level changes float parm1, parm2, parm3, parm4, parm5, parm6, parm7, parm8, parm9, parm10, parm11, parm12, parm13, parm14, parm15, parm16; -// // global variables set by built in functions -// vector v_forward, v_up, v_right; // set by makevectors() // set by traceline / tracebox @@ -62,9 +47,7 @@ float trace_inwater; entity msg_entity; // destination of single entity writes -// // required prog functions -// void() main; // only for testing void() StartFrame; @@ -77,38 +60,27 @@ void() ClientConnect; void() PutClientInServer; // call after setting the parm1... parms void() ClientDisconnect; -void() SetNewParms; // called when a client first connects to -// a server. sets parms so they can be -// saved off for restarts +/* called when a client first connects to a server. sets parms so they can be + * saved off for restarts + */ +void() SetNewParms; -void() SetChangeParms; // call to set parms for self so they can -// be saved for a level transition +// call to set parms for self so they can be saved for a level transition +void() SetChangeParms; - -//================================================ void end_sys_globals; // flag for structure dumping -//================================================ -/* -============================================================================== +// system fields -------------------------------------------------------------| - SOURCE FOR ENTVARS_T C STRUCTURE - -============================================================================== -*/ - -// -// system fields(*** = do not set in prog code, maintained by C code) -// -.float modelindex; // *** model index in the precached list -.vector absmin, absmax; // *** origin + mins / maxs +.float modelindex; // model index in the precached list +.vector absmin, absmax; // origin + mins / maxs .float ltime; // local time for entity .float movetype; .float solid; -.vector origin; // *** -.vector oldorigin; // *** +.vector origin; +.vector oldorigin; .vector velocity; .vector angles; .vector avelocity; @@ -149,7 +121,6 @@ void end_sys_globals; // flag for structure dumping .vector view_ofs; // add to origin to get eye point - .float button0; // fire .float button1; // use .float button2; // jump @@ -160,7 +131,6 @@ void end_sys_globals; // flag for structure dumping .vector v_angle; // view / targeting angle for players .float idealpitch; // calculated pitch angle for lookup up slopes - .string netname; .entity enemy; @@ -207,357 +177,9 @@ void end_sys_globals; // flag for structure dumping .string noise, noise1, noise2, noise3; // contains names of wavs to play -//================================================ void end_sys_fields; // flag for structure dumping -//================================================ -/* -============================================================================== - - VARS NOT REFERENCED BY C CODE - -============================================================================== -*/ - - -// -// constants -// - -float FALSE = 0; -float TRUE = 1; - -// edict.flags -float FL_FLY = 1; -float FL_SWIM = 2; -float FL_CLIENT = 8; // set for all client edicts -float FL_INWATER = 16; // for enter / leave water splash -float FL_MONSTER = 32; -float FL_GODMODE = 64; // player cheat -float FL_NOTARGET = 128; // player cheat -float FL_ITEM = 256; // extra wide size for bonus items -float FL_ONGROUND = 512; // standing on something -float FL_PARTIALGROUND = 1024; // not all corners are valid -float FL_WATERJUMP = 2048; // player jumping out of water -float FL_JUMPRELEASED = 4096; // for jump debouncing - -// edict.movetype values -float MOVETYPE_NONE = 0; // never moves -//float MOVETYPE_ANGLENOCLIP = 1; -//float MOVETYPE_ANGLECLIP = 2; -float MOVETYPE_WALK = 3; // players only -float MOVETYPE_STEP = 4; // discrete, not real time unless fall -float MOVETYPE_FLY = 5; -float MOVETYPE_TOSS = 6; // gravity -float MOVETYPE_PUSH = 7; // no clip to world, push and crush -float MOVETYPE_NOCLIP = 8; -float MOVETYPE_FLYMISSILE = 9; // fly with extra size against monsters -float MOVETYPE_BOUNCE = 10; -float MOVETYPE_BOUNCEMISSILE = 11; // bounce with extra size - -// edict.solid values -float SOLID_NOT = 0; // no interaction with other objects -float SOLID_TRIGGER = 1; // touch on edge, but not blocking -float SOLID_BBOX = 2; // touch on edge, block -float SOLID_SLIDEBOX = 3; // touch on edge, but not an onground -float SOLID_BSP = 4; // bsp clip, touch on edge, block - -// range values -float RANGE_MELEE = 0; -float RANGE_NEAR = 1; -float RANGE_MID = 2; -float RANGE_FAR = 3; - -// deadflag values - -float DEAD_NO = 0; -float DEAD_DYING = 1; -float DEAD_DEAD = 2; -float DEAD_RESPAWNABLE = 3; - -// takedamage values - -float DAMAGE_NO = 0; -float DAMAGE_YES = 1; -float DAMAGE_AIM = 2; - -// items -float IT_AXE = 4096; -float IT_SHOTGUN = 1; -float IT_SUPER_SHOTGUN = 2; -float IT_NAILGUN = 4; -float IT_SUPER_NAILGUN = 8; -float IT_GRENADE_LAUNCHER = 16; -float IT_ROCKET_LAUNCHER = 32; -float IT_LIGHTNING = 64; -float IT_EXTRA_WEAPON = 128; - -float IT_SHELLS = 256; -float IT_NAILS = 512; -float IT_ROCKETS = 1024; -float IT_CELLS = 2048; - -float IT_ARMOR1 = 8192; -float IT_ARMOR2 = 16384; -float IT_ARMOR3 = 32768; -float IT_SUPERHEALTH = 65536; - -float IT_KEY1 = 131072; -float IT_KEY2 = 262144; - -float IT_INVISIBILITY = 524288; -float IT_INVULNERABILITY = 1048576; -float IT_SUIT = 2097152; -float IT_QUAD = 4194304; - -// point content values - -float CONTENT_EMPTY = -1; -float CONTENT_SOLID = -2; -float CONTENT_WATER = -3; -float CONTENT_SLIME = -4; -float CONTENT_LAVA = -5; -float CONTENT_SKY = -6; - -float STATE_TOP = 0; -float STATE_BOTTOM = 1; -float STATE_UP = 2; -float STATE_DOWN = 3; - -vector VEC_ORIGIN = '0 0 0'; -vector VEC_HULL_MIN = '-16 -16 -24'; -vector VEC_HULL_MAX = '16 16 32'; - -vector VEC_HULL2_MIN = '-32 -32 -24'; -vector VEC_HULL2_MAX = '32 32 64'; - -// protocol bytes -float SVC_TEMPENTITY = 23; -float SVC_KILLEDMONSTER = 27; -float SVC_FOUNDSECRET = 28; -float SVC_INTERMISSION = 30; -float SVC_FINALE = 31; -float SVC_CDTRACK = 32; -float SVC_SELLSCREEN = 33; - - -float TE_SPIKE = 0; -float TE_SUPERSPIKE = 1; -float TE_GUNSHOT = 2; -float TE_EXPLOSION = 3; -float TE_TAREXPLOSION = 4; -float TE_LIGHTNING1 = 5; -float TE_LIGHTNING2 = 6; -float TE_WIZSPIKE = 7; -float TE_KNIGHTSPIKE = 8; -float TE_LIGHTNING3 = 9; -float TE_LAVASPLASH = 10; -float TE_TELEPORT = 11; - -// sound channels -// channel 0 never willingly overrides -// other channels(1-7) allways override a playing sound on that channel -float CHAN_AUTO = 0; -float CHAN_WEAPON = 1; -float CHAN_VOICE = 2; -float CHAN_ITEM = 3; -float CHAN_BODY = 4; - -float ATTN_NONE = 0; -float ATTN_NORM = 1; -float ATTN_IDLE = 2; -float ATTN_STATIC = 3; - -// update types - -float UPDATE_GENERAL = 0; -float UPDATE_STATIC = 1; -float UPDATE_BINARY = 2; -float UPDATE_TEMP = 3; - -// entity effects - -float EF_BRIGHTFIELD = 1; -float EF_MUZZLEFLASH = 2; -float EF_BRIGHTLIGHT = 4; -float EF_DIMLIGHT = 8; - - -// messages -float MSG_BROADCAST = 0; // unreliable to all -float MSG_ONE = 1; // reliable to one(msg_entity) -float MSG_ALL = 2; // reliable to all -float MSG_INIT = 3; // write to the init string - -//================================================ - -// -// globals -// -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 - -entity activator; // the entity that activated a trigger or brush - -entity damage_attacker; // set by T_Damage -float framecount; - -float skill; - -//================================================ - -// -// world fields(FIXME: make globals) -// -.string wad; -.string map; -.float worldtype; // 0=medieval 1=metal 2=base - -//================================================ - -.string killtarget; - -// -// quakeed fields -// -.float light_lev; // not used by game, but parsed by light util -.float style; - - -// -// monster ai -// -.void() th_stand; -.void() th_walk; -.void() th_run; -.void() th_missile; -.void() th_melee; -.void(entity attacker, float damage) th_pain; -.void() th_die; - -.entity oldenemy; // mad at this player before taking damage - -.float speed; - -.float lefty; - -.float search_time; -.float attack_state; - -float AS_STRAIGHT = 1; -float AS_SLIDING = 2; -float AS_MELEE = 3; -float AS_MISSILE = 4; - -// -// player only fields -// -.float walkframe; - -.float attack_finished; -.float pain_finished; - -.float invincible_finished; -.float invisible_finished; -.float super_damage_finished; -.float radsuit_finished; - -.float invincible_time, invincible_sound; -.float invisible_time, invisible_sound; -.float super_time, super_sound; -.float rad_time; -.float fly_sound; - -.float axhitme; - -.float show_hostile; // set to time+0.2 whenever a client fires a -// weapon or takes damage. Used to alert -// monsters that otherwise would let the player go -.float jump_flag; // player jump flag -.float swim_flag; // player swimming sound flag -.float air_finished; // when time > air_finished, start drowning -.float bubble_count; // keeps track of the number of bubbles -.string deathtype; // keeps track of how the player died - -// -// object stuff -// -.string mdl; -.vector mangle; // angle at start - -.vector oldorigin; // only used by secret door - -.float t_length, t_width; - - -// -// doors, etc -// -.vector dest, dest1, dest2; -.float wait; // time from firing to restarting -.float delay; // time from activation to firing -.entity trigger_field; // door's trigger entity -.string noise4; - -// -// monsters -// -.float pausetime; -.entity movetarget; - - -// -// doors -// -.float aflag; -.float dmg; // damage done by door when hit - -// -// misc -// -.float cnt; // misc flag - -// -// subs -// -.void() think1; -.vector finaldest, finalangle; - -// -// triggers -// -.float count; // for counting triggers - - -// -// plats / doors / buttons -// -.float lip; -.float state; -.vector pos1, pos2; // top and bottom positions -.float height; - -// -// sounds -// -.float waitmin, waitmax; -.float distance; -.float volume; - - - - -//=========================================================================== - - -// -// builtin functions -// +// builtin functions ---------------------------------------------------------| void(vector ang) makevectors = #1; // sets v_forward, etc globals void(entity e, vector o) setorigin = #2; @@ -568,18 +190,19 @@ 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; -void(string e) error = #10; -void(string e) objerror = #11; +[[noreturn]] void(string e) error = #10; +[[noreturn]] void(string e) objerror = #11; float(vector v) vlen = #12; float(vector v) vectoyaw = #13; entity() spawn = #14; void(entity e) remove = #15; -// sets trace_* globals -// nomonsters can be: -// An entity will also be ignored for testing if forent == test, -// forent->owner == test, or test->owner == forent -// a forent of world is ignored +/* sets trace_* globals + * nomonsters can be: + * An entity will also be ignored for testing if forent == test, + * forent->owner == test, or test->owner == forent + * a forent of world is ignored + */ void(vector v1, vector v2, float nomonsters, entity forent) traceline = #16; entity() checkclient = #17; // returns a client to look for @@ -599,7 +222,7 @@ 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(float yaw, float dist) droptofloor = #34; // TRUE if landed on floor +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 @@ -613,15 +236,13 @@ vector(entity e, float speed) aim = #44; // returns the shooting vector float(string s) cvar = #45; // return cvar.value void(string s) localcmd = #46; // put string into local que entity(entity e) nextent = #47; // for looping through all ents -void(vector o, vector d, float color, float count) particle = #48;// start a particle effect -void() ChangeYaw = #49; // turn towards self.ideal_yaw -// at self.yaw_speed +// 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 -// void(float to, float f) WriteByte = #52; void(float to, float f) WriteChar = #53; void(float to, float f) WriteShort = #54; @@ -631,46 +252,346 @@ void(float to, float f) WriteAngle = #57; void(float to, string s) WriteString = #58; void(float to, entity s) WriteEntity = #59; -// -// broadcast client message generation -// - -// void(float f) bWriteByte = #59; -// void(float f) bWriteChar = #60; -// void(float f) bWriteShort = #61; -// void(float f) bWriteLong = #62; -// void(float f) bWriteCoord = #63; -// void(float f) bWriteAngle = #64; -// void(string s) bWriteString = #65; -// void(entity e) bWriteEntity = #66; - 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; string(string s) precache_model2 = #75; // registered version only string(string s) precache_sound2 = #76; // registered version only string(string s) precache_file2 = #77; // registered version only -void(entity e) setspawnparms = #78; // set parm1... to the -// values at level start -// for coop respawn +// set parm1... to the values at level start for coop respawn +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'; + +enum { + FALSE, + TRUE +}; + +// edict.flags +enum { + FL_FLY = 1, + FL_SWIM = 2, + FL_CLIENT = 8, // set for all client edicts + FL_INWATER = 16, // for enter / leave water splash + FL_MONSTER = 32, + FL_GODMODE = 64, // player cheat + FL_NOTARGET = 128, // player cheat + FL_ITEM = 256, // extra wide size for bonus items + FL_ONGROUND = 512, // standing on something + FL_PARTIALGROUND = 1024, // not all corners are valid + FL_WATERJUMP = 2048, // player jumping out of water + FL_JUMPRELEASED = 4096, // for jump debouncing +}; + +// 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, + MOVETYPE_TOSS, // gravity + MOVETYPE_PUSH, // no clip to world, push and crush + MOVETYPE_NOCLIP, + MOVETYPE_FLYMISSILE, // fly with extra size against monsters + MOVETYPE_BOUNCE, + MOVETYPE_BOUNCEMISSILE, // bounce with extra size +}; + +// edict.solid values +enum { + SOLID_NOT, // no interaction with other objects + SOLID_TRIGGER, // touch on edge, but not blocking + SOLID_BBOX, // touch on edge, block + SOLID_SLIDEBOX, // touch on edge, but not an onground + SOLID_BSP, // bsp clip, touch on edge, block +}; + +// range values +enum { + RANGE_MELEE, + RANGE_NEAR, + RANGE_MID, + RANGE_FAR, +}; + +// deadflag values +enum { + DEAD_NO, + DEAD_DYING, + DEAD_DEAD, + DEAD_RESPAWNABLE, +}; + +// takedamage values +enum { + DAMAGE_NO, + DAMAGE_YES, + DAMAGE_AIM, +}; + +// items +enum { + IT_SHOTGUN = 1, + IT_SUPER_SHOTGUN = 2, + IT_NAILGUN = 4, + IT_SUPER_NAILGUN = 8, + IT_GRENADE_LAUNCHER = 16, + IT_ROCKET_LAUNCHER = 32, + IT_LIGHTNING = 64, + IT_EXTRA_WEAPON = 128, + IT_AXE = 4096, + + IT_SHELLS = 256, + IT_NAILS = 512, + IT_ROCKETS = 1024, + IT_CELLS = 2048, + + IT_ARMOR1 = 8192, + IT_ARMOR2 = 16384, + IT_ARMOR3 = 32768, + IT_SUPERHEALTH = 65536, + + IT_KEY1 = 131072, + IT_KEY2 = 262144, + + IT_INVISIBILITY = 524288, + IT_INVULNERABILITY = 1048576, + IT_SUIT = 2097152, + IT_QUAD = 4194304, +}; + +// point content values +enum { + CONTENT_SKY = -6, + CONTENT_LAVA, + CONTENT_SLIME, + CONTENT_WATER, + CONTENT_SOLID, + CONTENT_EMPTY, + + STATE_TOP, + STATE_BOTTOM, + STATE_UP, + STATE_DOWN, +}; + +// protocol bytes +enum { + SVC_TEMPENTITY = 23, + SVC_KILLEDMONSTER = 27, + SVC_FOUNDSECRET = 28, + SVC_INTERMISSION = 30, + SVC_FINALE = 31, + SVC_CDTRACK = 32, + SVC_SELLSCREEN = 33, +}; + +enum { + TE_SPIKE, + TE_SUPERSPIKE, + TE_GUNSHOT, + TE_EXPLOSION, + TE_TAREXPLOSION, + TE_LIGHTNING1, + TE_LIGHTNING2, + TE_WIZSPIKE, + TE_KNIGHTSPIKE, + TE_LIGHTNING3, + TE_LAVASPLASH, + TE_TELEPORT, +}; + +// sound channels +// channel 0 never willingly overrides +// other channels(1-7) allways override a playing sound on that channel +enum { + CHAN_AUTO, + CHAN_WEAPON, + CHAN_VOICE, + CHAN_ITEM, + CHAN_BODY, +}; + +enum { + ATTN_NONE, + ATTN_NORM, + ATTN_IDLE, + ATTN_STATIC, +}; + +// update types +enum { + UPDATE_GENERAL, + UPDATE_STATIC, + UPDATE_BINARY, + UPDATE_TEMP, +}; + +// entity effects +enum { + EF_BRIGHTFIELD = 1, + EF_MUZZLEFLASH = 2, + EF_BRIGHTLIGHT = 4, + EF_DIMLIGHT = 8, +}; + +// messages +enum { + MSG_BROADCAST, // unreliable to all + MSG_ONE, // reliable to one(msg_entity) + MSG_ALL, // reliable to all + MSG_INIT, // write to the init string +}; + +enum { + AS_STRAIGHT = 1, + AS_SLIDING, + AS_MELEE, + AS_MISSILE, +}; + +// globals -------------------------------------------------------------------| + +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 + +entity activator; // the entity that activated a trigger or brush + +entity damage_attacker; // set by T_Damage +float framecount; + +float skill; + +// fields --------------------------------------------------------------------| + +// world fields +.string wad; +.string map; +.float worldtype; // 0=medieval 1=metal 2=base + +.string killtarget; + +// quakeed fields +.float light_lev; // not used by game, but parsed by light util +.float style; + +// monster ai +.void() th_stand; +.void() th_walk; +.void() th_run; +.void() th_missile; +.void() th_melee; +.void(entity attacker, float damage) th_pain; +.void() th_die; + +.entity oldenemy; // mad at this player before taking damage + +.float speed; + +.float lefty; + +.float search_time; +.float attack_state; + +// player only fields +.float walkframe; + +.float attack_finished; +.float pain_finished; + +.float invincible_finished; +.float invisible_finished; +.float super_damage_finished; +.float radsuit_finished; + +.float invincible_time, invincible_sound; +.float invisible_time, invisible_sound; +.float super_time, super_sound; +.float rad_time; +.float fly_sound; + +.float axhitme; + +/* set to time+0.2 whenever a client fires a weapon or takes damage. Used to + * alert monsters that otherwise would let the player go + */ +.float show_hostile; +.float jump_flag; // player jump flag +.float swim_flag; // player swimming sound flag +.float air_finished; // when time > air_finished, start drowning +.float bubble_count; // keeps track of the number of bubbles +.string deathtype; // keeps track of how the player died + +// object stuff +.string mdl; +.vector mangle; // angle at start + +.vector oldorigin; // only used by secret door + +.float t_length, t_width; + +// doors, etc +.vector dest, dest1, dest2; +.float wait; // time from firing to restarting +.float delay; // time from activation to firing +.entity trigger_field; // door's trigger entity +.string noise4; + +// monsters +.float pausetime; +.entity movetarget; + +// doors +.float aflag; +.float dmg; // damage done by door when hit + +// misc +.float cnt; // misc flag + +// subs +.void() think1; +.vector finaldest, finalangle; + +// triggers +.float count; // for counting triggers + +// plats / doors / buttons +.float lip; +.float state; +.vector pos1, pos2; // top and bottom positions +.float height; + +// sounds +.float waitmin, waitmax; +.float distance; +.float volume; + +// functions -----------------------------------------------------------------| -// // subs.qc -// void(vector tdest, float tspeed, void() func) SUB_CalcMove; void(entity ent, vector tdest, float tspeed, void() func) SUB_CalcMoveEnt; void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove; @@ -680,14 +601,9 @@ void() SUB_Null; void() SUB_UseTargets; void() SUB_Remove; -// // combat.qc -// void(entity targ, entity inflictor, entity attacker, float damage) T_Damage; - - float(entity e, float healamount, float ignore) T_Heal; // health function - float(entity targ, entity inflictor) CanDamage; - +// EOF diff --git a/source/doors.qc b/source/doors.qc index c67ff4a..1b2fc9c 100644 --- a/source/doors.qc +++ b/source/doors.qc @@ -1,9 +1,9 @@ -float DOOR_START_OPEN = 1; -float DOOR_DONT_LINK = 4; -float DOOR_GOLD_KEY = 8; -float DOOR_SILVER_KEY = 16; -float DOOR_TOGGLE = 32; +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; /* @@ -531,11 +531,11 @@ void() fd_secret_move5; void() fd_secret_move6; void() fd_secret_done; -float SECRET_OPEN_ONCE = 1; // stays open -float SECRET_1ST_LEFT = 2; // 1st move is left of arrow -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 +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 void() fd_secret_use = { diff --git a/source/items.qc b/source/items.qc index 81caf90..34a7ea4 100644 --- a/source/items.qc +++ b/source/items.qc @@ -101,8 +101,8 @@ rot you down to your maximum health limit, one point per second. */ -float H_ROTTEN = 1; -float H_MEGA = 2; +const float H_ROTTEN = 1; +const float H_MEGA = 2; .float healamount, healtype; void() health_touch; void() item_megahealth_rot; @@ -387,7 +387,7 @@ void() weapon_touch = { return; } - // if the player was using his best weapon, change up to the new one if better + // if the player was using their best weapon, change up to the new one if better stemp = self; self = other; best = W_BestWeapon(); @@ -587,7 +587,7 @@ void() ammo_touch = { return; } - // if the player was using his best weapon, change up to the new one if better + // if the player was using their best weapon, change up to the new one if better stemp = self; self = other; best = W_BestWeapon(); @@ -666,7 +666,7 @@ void() ammo_touch = { -float WEAPON_BIG2 = 1; +const float WEAPON_BIG2 = 1; /*QUAKED item_shells(0 .5 .8) (0 0 0) (32 32 32) big */ @@ -758,10 +758,10 @@ void() item_cells = { DO NOT USE THIS!!!! IT WILL BE REMOVED! */ -float WEAPON_SHOTGUN = 1; -float WEAPON_ROCKET = 2; -float WEAPON_SPIKES = 4; -float WEAPON_BIG = 8; +const float WEAPON_SHOTGUN = 1; +const float WEAPON_ROCKET = 2; +const float WEAPON_SPIKES = 4; +const float WEAPON_BIG = 8; void() item_weapon = { self.touch = ammo_touch; diff --git a/source/misc.qc b/source/misc.qc index b6b4476..d09cd51 100644 --- a/source/misc.qc +++ b/source/misc.qc @@ -14,7 +14,7 @@ void() info_notnull = { //============================================================================ -float START_OFF = 1; +const float START_OFF = 1; void() light_use = { if(self.spawnflags & START_OFF) { @@ -269,8 +269,8 @@ void() misc_explobox2 = { //============================================================================ -float SPAWNFLAG_SUPERSPIKE = 1; -float SPAWNFLAG_LASER = 2; +const float SPAWNFLAG_SUPERSPIKE = 1; +const float SPAWNFLAG_LASER = 2; void(vector org, vector vec) LaunchLaser; @@ -500,14 +500,12 @@ void() func_wall = { /*QUAKED func_illusionary(0 .5 .8) ? A simple entity that looks solid but lets you walk through it. */ -void() func_illusionary = - -{ +void() func_illusionary = { self.angles = '0 0 0'; self.movetype = MOVETYPE_NONE; self.solid = SOLID_NOT; setmodel(self, self.model); - makestatic(); + makestatic(self); }; /*QUAKED func_episodegate(0 .5 .8) ? E1 E2 E3 E4 diff --git a/source/ogre.qc b/source/ogre.qc index a59a5a9..9fe993c 100644 --- a/source/ogre.qc +++ b/source/ogre.qc @@ -252,7 +252,7 @@ void() ogre_smash11 = [ $smash11, ogre_smash12 ] {ai_charge(2); chainsaw(0); self.nextthink = self.nextthink + random() * 0.2; }; // slight variation -void() ogre_smash12 = [ $smash12, ogre_smash13 ] {ai_charge();}; +void() ogre_smash12 = [ $smash12, ogre_smash13 ] {ai_charge(0);}; void() ogre_smash13 = [ $smash13, ogre_smash14 ] {ai_charge(4);}; void() ogre_smash14 = [ $smash14, ogre_run1 ] {ai_charge(12);}; diff --git a/source/plats.qc b/source/plats.qc index 2aaed56..730c2d7 100644 --- a/source/plats.qc +++ b/source/plats.qc @@ -6,7 +6,7 @@ void() plat_trigger_use; void() plat_go_up; void() plat_go_down; void() plat_crush; -float PLAT_LOW_TRIGGER = 1; +const float PLAT_LOW_TRIGGER = 1; void() plat_spawn_inside_trigger = { local entity trigger; diff --git a/source/subs.qc b/source/subs.qc index 906defb..01fd0e4 100644 --- a/source/subs.qc +++ b/source/subs.qc @@ -9,7 +9,7 @@ void() SUB_Remove = {remove(self);}; QuakeEd only writes a single float for angles(bad idea), so up and down are just constant angles. */ -vector() SetMovedir = { +void() SetMovedir = { if(self.angles == '0 -1 0') { self.movedir = '0 0 1'; } else if(self.angles == '0 -2 0') { diff --git a/source/triggers.qc b/source/triggers.qc index 4df5b7b..f4c99ca 100644 --- a/source/triggers.qc +++ b/source/triggers.qc @@ -8,8 +8,8 @@ void() trigger_reactivate = { //============================================================================= -float SPAWNFLAG_NOMESSAGE = 1; -float SPAWNFLAG_NOTOUCH = 1; +const float SPAWNFLAG_NOMESSAGE = 1; +const float SPAWNFLAG_NOTOUCH = 1; // the wait time has passed, so set back up for another activation void() multi_wait = { @@ -256,8 +256,8 @@ TELEPORT TRIGGERS ============================================================================== */ -float PLAYER_ONLY = 1; -float SILENT = 2; +const float PLAYER_ONLY = 1; +const float SILENT = 2; void() play_teleport = { local float v; @@ -533,7 +533,7 @@ void() trigger_hurt = { //============================================================================ -float PUSH_ONCE = 1; +const float PUSH_ONCE = 1; void() trigger_push_touch = { if(other.classname == "grenade") { diff --git a/source/weapons.qc b/source/weapons.qc index eb7870f..8c4a104 100644 --- a/source/weapons.qc +++ b/source/weapons.qc @@ -982,7 +982,7 @@ void() CycleWeaponCommand = { it = self.items; self.impulse = 0; - while(1) { + for(;;) { am = 0; if(self.weapon == IT_LIGHTNING) { self.weapon = IT_AXE; diff --git a/source/wizard.qc b/source/wizard.qc index 0f3058f..40475fe 100644 --- a/source/wizard.qc +++ b/source/wizard.qc @@ -157,7 +157,7 @@ float() WizardCheckAttack = { WizardAttackFinished ================= */ -float() WizardAttackFinished = { +void() WizardAttackFinished = { if(enemy_range >= RANGE_MID || !enemy_vis) { self.attack_state = AS_STRAIGHT; self.think = wiz_run1; diff --git a/source/zombie.qc b/source/zombie.qc index 1207700..5ab7c98 100644 --- a/source/zombie.qc +++ b/source/zombie.qc @@ -50,7 +50,7 @@ $frame paine29 paine30 $frame cruc_1 cruc_2 cruc_3 cruc_4 cruc_5 cruc_6 -float SPAWN_CRUCIFIED = 1; +const float SPAWN_CRUCIFIED = 1; //============================================================================= diff --git a/todo b/todo index b4e4216..8e5ccc7 100644 --- a/todo +++ b/todo @@ -1,9 +1,9 @@ core features: -all players keep starting weapons corpse pickups have keys custom pronouns distributed ammo +lives counting no friendly fire by default useful features: