Guest User

Untitled

a guest
Jan 31st, 2016
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.85 KB | None | 0 0
  1. DEFS.QC
  2.  
  3. ///////
  4.  
  5.  
  6. /*
  7. ==============================================================================
  8.  
  9. SOURCE FOR GLOBALVARS_T C STRUCTURE
  10.  
  11. ==============================================================================
  12. */
  13.  
  14. //
  15. // system globals
  16. //
  17. entity self;
  18. entity other;
  19. entity world;
  20. float time;
  21. float frametime;
  22.  
  23. float force_retouch; // force all entities to touch triggers
  24. // next frame. this is needed because
  25. // non-moving things don't normally scan
  26. // for triggers, and when a trigger is
  27. // created (like a teleport trigger), it
  28. // needs to catch everything.
  29. // decremented each frame, so set to 2
  30. // to guarantee everything is touched
  31. string mapname;
  32.  
  33. float deathmatch;
  34. float coop;
  35. float teamplay;
  36.  
  37. float serverflags; // propagated from level to level, used to
  38. // keep track of completed episodes
  39.  
  40. float total_secrets;
  41. float total_monsters;
  42.  
  43. float found_secrets; // number of secrets found
  44. float killed_monsters; // number of monsters killed
  45.  
  46.  
  47. // spawnparms are used to encode information about clients across server
  48. // level changes
  49. float parm1, parm2, parm3, parm4, parm5, parm6, parm7, parm8, parm9, parm10, parm11, parm12, parm13, parm14, parm15, parm16;
  50.  
  51. //
  52. // global variables set by built in functions
  53. //
  54. vector v_forward, v_up, v_right; // set by makevectors()
  55.  
  56. // set by traceline / tracebox
  57. float trace_allsolid;
  58. float trace_startsolid;
  59. float trace_fraction;
  60. vector trace_endpos;
  61. vector trace_plane_normal;
  62. float trace_plane_dist;
  63. entity trace_ent;
  64. float trace_inopen;
  65. float trace_inwater;
  66.  
  67. entity msg_entity; // destination of single entity writes
  68.  
  69. //
  70. // required prog functions
  71. //
  72. void() main; // only for testing
  73.  
  74. void() StartFrame;
  75.  
  76. void() PlayerPreThink;
  77. void() PlayerPostThink;
  78.  
  79. void() ClientKill;
  80. void() ClientConnect;
  81. void() PutClientInServer; // call after setting the parm1... parms
  82. void() ClientDisconnect;
  83.  
  84. void() SetNewParms; // called when a client first connects to
  85. // a server. sets parms so they can be
  86. // saved off for restarts
  87.  
  88. void() SetChangeParms; // call to set parms for self so they can
  89. // be saved for a level transition
  90.  
  91.  
  92. //================================================
  93. void end_sys_globals; // flag for structure dumping
  94. //================================================
  95.  
  96. /*
  97. ==============================================================================
  98.  
  99. SOURCE FOR ENTVARS_T C STRUCTURE
  100.  
  101. ==============================================================================
  102. */
  103.  
  104. //
  105. // system fields (*** = do not set in prog code, maintained by C code)
  106. //
  107. .float modelindex; // *** model index in the precached list
  108. .vector absmin, absmax; // *** origin + mins / maxs
  109.  
  110. .float ltime; // local time for entity
  111. .float movetype;
  112. .float solid;
  113.  
  114. .vector origin; // ***
  115. .vector oldorigin; // ***
  116. .vector velocity;
  117. .vector angles;
  118. .vector avelocity;
  119.  
  120. .vector punchangle; // temp angle adjust from damage or recoil
  121.  
  122. .string classname; // spawn function
  123. .string model;
  124. .float frame;
  125. .float skin;
  126. .float effects;
  127.  
  128. .vector mins, maxs; // bounding box extents reletive to origin
  129. .vector size; // maxs - mins
  130.  
  131. .void() touch;
  132. .void() use;
  133. .void() think;
  134. .void() blocked; // for doors or plats, called when can't push other
  135.  
  136. .float nextthink;
  137. .entity groundentity;
  138.  
  139. // stats
  140. .float health;
  141. .float frags;
  142. .float weapon; // one of the IT_SHOTGUN, etc flags
  143. .string weaponmodel;
  144. .float weaponframe;
  145. .float currentammo;
  146. .float ammo_shells, ammo_nails, ammo_rockets, ammo_cells;
  147.  
  148. .float items; // bit flags
  149.  
  150. .float takedamage;
  151. .entity chain;
  152. .float deadflag;
  153.  
  154. .vector view_ofs; // add to origin to get eye point
  155.  
  156.  
  157. .float button0; // fire
  158. .float button1; // use
  159. .float button2; // jump
  160.  
  161. .float impulse; // weapon changes
  162.  
  163. .float fixangle;
  164. .vector v_angle; // view / targeting angle for players
  165. .float idealpitch; // calculated pitch angle for lookup up slopes
  166.  
  167.  
  168. .string netname;
  169.  
  170. .entity enemy;
  171.  
  172. .float flags;
  173.  
  174. .float colormap;
  175. .float team;
  176.  
  177. .float max_health; // players maximum health is stored here
  178.  
  179. .float teleport_time; // don't back up
  180.  
  181. .float armortype; // save this fraction of incoming damage
  182. .float armorvalue;
  183.  
  184. .float waterlevel; // 0 = not in, 1 = feet, 2 = wast, 3 = eyes
  185. .float watertype; // a contents value
  186.  
  187. .float ideal_yaw;
  188. .float yaw_speed;
  189.  
  190. .entity aiment;
  191.  
  192. .entity goalentity; // a movetarget or an enemy
  193.  
  194. .float spawnflags;
  195.  
  196. .string target;
  197. .string targetname;
  198.  
  199. // damage is accumulated through a frame. and sent as one single
  200. // message, so the super shotgun doesn't generate huge messages
  201. .float dmg_take;
  202. .float dmg_save;
  203. .entity dmg_inflictor;
  204.  
  205. .entity owner; // who launched a missile
  206. .vector movedir; // mostly for doors, but also used for waterjump
  207.  
  208. .string message; // trigger messages
  209.  
  210. .float sounds; // either a cd track number or sound number
  211.  
  212. .string noise, noise1, noise2, noise3; // contains names of wavs to play
  213.  
  214. //================================================
  215. void end_sys_fields; // flag for structure dumping
  216. //================================================
  217.  
  218. /*
  219. ==============================================================================
  220.  
  221. VARS NOT REFERENCED BY C CODE
  222.  
  223. ==============================================================================
  224. */
  225.  
  226.  
  227. //
  228. // constants
  229. //
  230.  
  231. float FALSE = 0;
  232. float TRUE = 1;
  233.  
  234. // edict.flags
  235. float FL_FLY = 1;
  236. float FL_SWIM = 2;
  237. float FL_CLIENT = 8; // set for all client edicts
  238. float FL_INWATER = 16; // for enter / leave water splash
  239. float FL_MONSTER = 32;
  240. float FL_GODMODE = 64; // player cheat
  241. float FL_NOTARGET = 128; // player cheat
  242. float FL_ITEM = 256; // extra wide size for bonus items
  243. float FL_ONGROUND = 512; // standing on something
  244. float FL_PARTIALGROUND = 1024; // not all corners are valid
  245. float FL_WATERJUMP = 2048; // player jumping out of water
  246. float FL_JUMPRELEASED = 4096; // for jump debouncing
  247.  
  248. // edict.movetype values
  249. float MOVETYPE_NONE = 0; // never moves
  250. //float MOVETYPE_ANGLENOCLIP = 1;
  251. //float MOVETYPE_ANGLECLIP = 2;
  252. float MOVETYPE_WALK = 3; // players only
  253. float MOVETYPE_STEP = 4; // discrete, not real time unless fall
  254. float MOVETYPE_FLY = 5;
  255. float MOVETYPE_TOSS = 6; // gravity
  256. float MOVETYPE_PUSH = 7; // no clip to world, push and crush
  257. float MOVETYPE_NOCLIP = 8;
  258. float MOVETYPE_FLYMISSILE = 9; // fly with extra size against monsters
  259. float MOVETYPE_BOUNCE = 10;
  260. float MOVETYPE_BOUNCEMISSILE = 11; // bounce with extra size
  261.  
  262. // edict.solid values
  263. float SOLID_NOT = 0; // no interaction with other objects
  264. float SOLID_TRIGGER = 1; // touch on edge, but not blocking
  265. float SOLID_BBOX = 2; // touch on edge, block
  266. float SOLID_SLIDEBOX = 3; // touch on edge, but not an onground
  267. float SOLID_BSP = 4; // bsp clip, touch on edge, block
  268.  
  269. // range values
  270. float RANGE_MELEE = 0;
  271. float RANGE_NEAR = 1;
  272. float RANGE_MID = 2;
  273. float RANGE_FAR = 3;
  274.  
  275. // deadflag values
  276.  
  277. float DEAD_NO = 0;
  278. float DEAD_DYING = 1;
  279. float DEAD_DEAD = 2;
  280. float DEAD_RESPAWNABLE = 3;
  281.  
  282. // takedamage values
  283.  
  284. float DAMAGE_NO = 0;
  285. float DAMAGE_YES = 1;
  286. float DAMAGE_AIM = 2;
  287.  
  288. // items
  289. float IT_AXE = 4096;
  290. float IT_SHOTGUN = 1;
  291. float IT_SUPER_SHOTGUN = 2;
  292. float IT_NAILGUN = 4;
  293. float IT_SUPER_NAILGUN = 8;
  294. float IT_GRENADE_LAUNCHER = 16;
  295. float IT_ROCKET_LAUNCHER = 32;
  296. float IT_LIGHTNING = 64;
  297. float IT_INFANTRY_GUN = 128;
  298. float IT_GATLING_GUN = 8388608; //128
  299. float IT_BFG9500 = 16777216;
  300.  
  301. float IT_SHELLS = 256;
  302. float IT_NAILS = 512;
  303. float IT_ROCKETS = 1024;
  304. float IT_CELLS = 2048;
  305.  
  306. float IT_ARMOR1 = 8192;
  307. float IT_ARMOR2 = 16384;
  308. float IT_ARMOR3 = 32768;
  309. float IT_SUPERHEALTH = 65536;
  310.  
  311. float IT_KEY1 = 131072;
  312. float IT_KEY2 = 262144;
  313.  
  314. float IT_INVISIBILITY = 524288;
  315. float IT_INVULNERABILITY = 1048576;
  316. float IT_SUIT = 2097152;
  317. float IT_QUAD = 4194304;
  318.  
  319. // point content values
  320.  
  321. float CONTENT_EMPTY = -1;
  322. float CONTENT_SOLID = -2;
  323. float CONTENT_WATER = -3;
  324. float CONTENT_SLIME = -4;
  325. float CONTENT_LAVA = -5;
  326. float CONTENT_SKY = -6;
  327.  
  328. float STATE_TOP = 0;
  329. float STATE_BOTTOM = 1;
  330. float STATE_UP = 2;
  331. float STATE_DOWN = 3;
  332.  
  333. vector VEC_ORIGIN = '0 0 0';
  334. vector VEC_HULL_MIN = '-16 -16 -24';
  335. vector VEC_HULL_MAX = '16 16 32';
  336.  
  337. vector VEC_HULL2_MIN = '-32 -32 -24';
  338. vector VEC_HULL2_MAX = '32 32 64';
  339.  
  340. // protocol bytes
  341. float SVC_TEMPENTITY = 23;
  342. float SVC_KILLEDMONSTER = 27;
  343. float SVC_FOUNDSECRET = 28;
  344. float SVC_INTERMISSION = 30;
  345. float SVC_FINALE = 31;
  346. float SVC_CDTRACK = 32;
  347. float SVC_SELLSCREEN = 33;
  348.  
  349.  
  350. float TE_SPIKE = 0;
  351. float TE_SUPERSPIKE = 1;
  352. float TE_GUNSHOT = 2;
  353. float TE_EXPLOSION = 3;
  354. float TE_TAREXPLOSION = 4;
  355. float TE_LIGHTNING1 = 5;
  356. float TE_LIGHTNING2 = 6;
  357. float TE_WIZSPIKE = 7;
  358. float TE_KNIGHTSPIKE = 8;
  359. float TE_LIGHTNING3 = 9;
  360. float TE_LAVASPLASH = 10;
  361. float TE_TELEPORT = 11;
  362. float TE_EXPLOSION2 = 12;
  363.  
  364. // sound channels
  365. // channel 0 never willingly overrides
  366. // other channels (1-7) allways override a playing sound on that channel
  367. float CHAN_AUTO = 0;
  368. float CHAN_WEAPON = 1;
  369. float CHAN_VOICE = 2;
  370. float CHAN_ITEM = 3;
  371. float CHAN_BODY = 4;
  372.  
  373. float ATTN_NONE = 0;
  374. float ATTN_NORM = 1;
  375. float ATTN_IDLE = 2;
  376. float ATTN_STATIC = 3;
  377.  
  378. // update types
  379.  
  380. float UPDATE_GENERAL = 0;
  381. float UPDATE_STATIC = 1;
  382. float UPDATE_BINARY = 2;
  383. float UPDATE_TEMP = 3;
  384.  
  385. // entity effects
  386.  
  387. float EF_BRIGHTFIELD = 1;
  388. float EF_MUZZLEFLASH = 2;
  389. float EF_BRIGHTLIGHT = 4;
  390. float EF_DIMLIGHT = 8;
  391.  
  392.  
  393. // messages
  394. float MSG_BROADCAST = 0; // unreliable to all
  395. float MSG_ONE = 1; // reliable to one (msg_entity)
  396. float MSG_ALL = 2; // reliable to all
  397. float MSG_INIT = 3; // write to the init string
  398.  
  399. //================================================
  400.  
  401. //
  402. // globals
  403. //
  404. float movedist;
  405. float gameover; // set when a rule exits
  406.  
  407. string string_null; // null string, nothing should be held here
  408. float empty_float;
  409.  
  410. entity newmis; // launch_spike sets this after spawning it
  411.  
  412. entity activator; // the entity that activated a trigger or brush
  413.  
  414. entity damage_attacker; // set by T_Damage
  415. float framecount;
  416.  
  417. float skill;
  418.  
  419. //================================================
  420.  
  421. //
  422. // world fields (FIXME: make globals)
  423. //
  424. .string wad;
  425. .string map;
  426. .float worldtype; // 0=medieval 1=metal 2=base
  427.  
  428. //================================================
  429.  
  430. .string killtarget;
  431.  
  432. //
  433. // quakeed fields
  434. //
  435. .float light_lev; // not used by game, but parsed by light util
  436. .float style;
  437.  
  438.  
  439. //
  440. // monster ai
  441. //
  442. .void() th_stand;
  443. .void() th_walk;
  444. .void() th_run;
  445. .void() th_missile;
  446. .void() th_melee;
  447. .void(entity attacker, float damage) th_pain;
  448. .void() th_die;
  449.  
  450. .entity oldenemy; // mad at this player before taking damage
  451.  
  452. .float speed;
  453.  
  454. .float lefty;
  455.  
  456. .float search_time;
  457. .float attack_state;
  458.  
  459. float AS_STRAIGHT = 1;
  460. float AS_SLIDING = 2;
  461. float AS_MELEE = 3;
  462. float AS_MISSILE = 4;
  463.  
  464. //
  465. // player only fields
  466. //
  467. .float walkframe;
  468.  
  469. .float attack_finished;
  470. .float pain_finished;
  471.  
  472. .float invincible_finished;
  473. .float invisible_finished;
  474. .float super_damage_finished;
  475. .float radsuit_finished;
  476.  
  477. .float invincible_time, invincible_sound;
  478. .float invisible_time, invisible_sound;
  479. .float super_time, super_sound;
  480. .float rad_time;
  481. .float fly_sound;
  482.  
  483. .float axhitme;
  484.  
  485. .float show_hostile; // set to time+0.2 whenever a client fires a
  486. // weapon or takes damage. Used to alert
  487. // monsters that otherwise would let the player go
  488. .float jump_flag; // player jump flag
  489. .float swim_flag; // player swimming sound flag
  490. .float air_finished; // when time > air_finished, start drowning
  491. .float bubble_count; // keeps track of the number of bubbles
  492. .string deathtype; // keeps track of how the player died
  493.  
  494. //
  495. // object stuff
  496. //
  497. .string mdl;
  498. .vector mangle; // angle at start
  499.  
  500. .vector oldorigin; // only used by secret door
  501.  
  502. .float t_length, t_width;
  503.  
  504.  
  505. //
  506. // doors, etc
  507. //
  508. .vector dest, dest1, dest2;
  509. .float wait; // time from firing to restarting
  510. .float delay; // time from activation to firing
  511. .entity trigger_field; // door's trigger entity
  512. .string noise4;
  513.  
  514. //
  515. // monsters
  516. //
  517. .float pausetime;
  518. .entity movetarget;
  519.  
  520.  
  521. //
  522. // doors
  523. //
  524. .float aflag;
  525. .float dmg; // damage done by door when hit
  526.  
  527. //
  528. // misc
  529. //
  530. .float cnt; // misc flag
  531.  
  532. //
  533. // subs
  534. //
  535. .void() think1;
  536. .vector finaldest, finalangle;
  537.  
  538. //
  539. // triggers
  540. //
  541. .float count; // for counting triggers
  542.  
  543.  
  544. //
  545. // plats / doors / buttons
  546. //
  547. .float lip;
  548. .float state;
  549. .vector pos1, pos2; // top and bottom positions
  550. .float height;
  551.  
  552. //
  553. // sounds
  554. //
  555. .float waitmin, waitmax;
  556. .float distance;
  557. .float volume;
  558.  
  559.  
  560.  
  561.  
  562. //===========================================================================
  563.  
  564.  
  565. //
  566. // builtin functions
  567. //
  568.  
  569. void(vector ang) makevectors = #1; // sets v_forward, etc globals
  570. void(entity e, vector o) setorigin = #2;
  571. void(entity e, string m) setmodel = #3; // set movetype and solid first
  572. void(entity e, vector min, vector max) setsize = #4;
  573. // #5 was removed
  574. void() break = #6;
  575. float() random = #7; // returns 0 - 1
  576. void(entity e, float chan, string samp, float vol, float atten) sound = #8;
  577. vector(vector v) normalize = #9;
  578. void(string e) error = #10;
  579. void(string e) objerror = #11;
  580. float(vector v) vlen = #12;
  581. float(vector v) vectoyaw = #13;
  582. entity() spawn = #14;
  583. void(entity e) remove = #15;
  584.  
  585. // sets trace_* globals
  586. // nomonsters can be:
  587. // An entity will also be ignored for testing if forent == test,
  588. // forent->owner == test, or test->owner == forent
  589. // a forent of world is ignored
  590. void(vector v1, vector v2, float nomonsters, entity forent) traceline = #16;
  591.  
  592. entity() checkclient = #17; // returns a client to look for
  593. entity(entity start, .string fld, string match) find = #18;
  594. string(string s) precache_sound = #19;
  595. string(string s) precache_model = #20;
  596. void(entity client, string s)stuffcmd = #21;
  597. entity(vector org, float rad) findradius = #22;
  598. void(string s) bprint = #23;
  599. void(entity client, string s) sprint = #24;
  600. void(string s) dprint = #25;
  601. string(float f) ftos = #26;
  602. string(vector v) vtos = #27;
  603. void() coredump = #28; // prints all edicts
  604. void() traceon = #29; // turns statment trace on
  605. void() traceoff = #30;
  606. void(entity e) eprint = #31; // prints an entire edict
  607. float(float yaw, float dist) walkmove = #32; // returns TRUE or FALSE
  608. // #33 was removed
  609. float(float yaw, float dist) droptofloor= #34; // TRUE if landed on floor
  610. void(float style, string value) lightstyle = #35;
  611. float(float v) rint = #36; // round to nearest int
  612. float(float v) floor = #37; // largest integer <= v
  613. float(float v) ceil = #38; // smallest integer >= v
  614. // #39 was removed
  615. float(entity e) checkbottom = #40; // true if self is on ground
  616. float(vector v) pointcontents = #41; // returns a CONTENT_*
  617. // #42 was removed
  618. float(float f) fabs = #43;
  619. vector(entity e, float speed) aim = #44; // returns the shooting vector
  620. float(string s) cvar = #45; // return cvar.value
  621. void(string s) localcmd = #46; // put string into local que
  622. entity(entity e) nextent = #47; // for looping through all ents
  623. void(vector o, vector d, float color, float count) particle = #48;// start a particle effect
  624. void() ChangeYaw = #49; // turn towards self.ideal_yaw
  625. // at self.yaw_speed
  626. // #50 was removed
  627. vector(vector v) vectoangles = #51;
  628.  
  629. //
  630. // direct client message generation
  631. //
  632. void(float to, float f) WriteByte = #52;
  633. void(float to, float f) WriteChar = #53;
  634. void(float to, float f) WriteShort = #54;
  635. void(float to, float f) WriteLong = #55;
  636. void(float to, float f) WriteCoord = #56;
  637. void(float to, float f) WriteAngle = #57;
  638. void(float to, string s) WriteString = #58;
  639. void(float to, entity s) WriteEntity = #59;
  640.  
  641. //
  642. // broadcast client message generation
  643. //
  644.  
  645. // void(float f) bWriteByte = #59;
  646. // void(float f) bWriteChar = #60;
  647. // void(float f) bWriteShort = #61;
  648. // void(float f) bWriteLong = #62;
  649. // void(float f) bWriteCoord = #63;
  650. // void(float f) bWriteAngle = #64;
  651. // void(string s) bWriteString = #65;
  652. // void(entity e) bWriteEntity = #66;
  653.  
  654. void(float step) movetogoal = #67;
  655.  
  656. string(string s) precache_file = #68; // no effect except for -copy
  657. void(entity e) makestatic = #69;
  658. void(string s) changelevel = #70;
  659.  
  660. //#71 was removed
  661.  
  662. void(string var, string val) cvar_set = #72; // sets cvar.value
  663.  
  664. void(entity client, string s) centerprint = #73; // sprint, but in middle
  665.  
  666. void(vector pos, string samp, float vol, float atten) ambientsound = #74;
  667.  
  668. string(string s) precache_model2 = #75; // registered version only
  669. string(string s) precache_sound2 = #76; // registered version only
  670. string(string s) precache_file2 = #77; // registered version only
  671.  
  672. void(entity e) setspawnparms = #78; // set parm1... to the
  673. // values at level start
  674. // for coop respawn
  675.  
  676. //============================================================================
  677.  
  678. //
  679. // subs.qc
  680. //
  681. void(vector tdest, float tspeed, void() func) SUB_CalcMove;
  682. void(entity ent, vector tdest, float tspeed, void() func) SUB_CalcMoveEnt;
  683. void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove;
  684. void() SUB_CalcMoveDone;
  685. void() SUB_CalcAngleMoveDone;
  686. void() SUB_Null;
  687. void() SUB_UseTargets;
  688. void() SUB_Remove;
  689.  
  690. //
  691. // combat.qc
  692. //
  693. void(entity targ, entity inflictor, entity attacker, float damage) T_Damage;
  694.  
  695.  
  696. float (entity e, float healamount, float ignore) T_Heal; // health function
  697.  
  698. float(entity targ, entity inflictor) CanDamage;
  699.  
  700. void(vector ang) makevectors2 = #79;
Add Comment
Please, Sign In to add comment