Git Repos / fte_dogmode / commit 3527413
Commit: 35274130796675826bed4e6886dd3ace90e2933c
Parent: 6145cef338e80661c33fcb346a730b988dfb7295
Author: Cameron Vanderzanden, 2025-03-30 19:29
Committer: Cameron Vanderzanden, 2025-03-30 19:29
Commit Message
Big commit. Entity networking, etc. I've been delaying this commit for months but it needs to be pushed regardles of its state. There's a lot in here that has changed. Most entities are now networked to CSQC. The protocol is roughly like 999 but incompatible. There are still entities that need to be updated (some in misc, some lights, etc). Monsters, func, items, and a few triggers are networked in this way. Related to above entities are now interpolated and updated in CSQC. It's not perfect; it's as good as I know how to make it right now. There are bound to be some oversights or tracking errors etc. . Weapon handling (switching, impulse code, etc) has been rewritten. Impulses 1-8 now select 'inventory slots' that can contain a variety of things, not just weapons. Selecting an empty slot switches to a different mode where you won't interact with map objects (touch functions won't be called) and you can press a grab button to grab items you're aiming at. In this way you can pick up and carry with you health boxes, ammo boxes, powerups, and so on. Items carried in this way will persist through level transitions. This is achieved by networking a value that represents information about the item (an index into array that contains model, viewmodel, name, and other details). Partial support for MachineGames Dimension Of The Machine has been implemented. Much of it works but currently func_toss is missing (breakables in general are on the list of features to be revised). Other entities are no doubt missing as well. This is all being committed in an incomplete state. I'm uploading because I really need a backup somewhere. And this is good enough to upload at the moment (just don't gib the player). There are no doubt features and bugs present in this commit that I have forgotten. CEV.
Change List
Diff autoexec.cfg
diff --git a/autoexec.cfg b/autoexec.cfg
index 06356e5..caee44a 100644
--- a/autoexec.cfg
+++ b/autoexec.cfg
@@ -13,9 +13,11 @@ seta cl_backspeed 320
seta pm_airstep 1
// enable wall jumps
seta pm_walljump 1
-// transmit large coords from server to client
+// send float coords
seta sv_bigcoords 1
// save in FTE format
seta sv_savefmt 1
//
+seta sv_gameplayfix_setmodelrealbox 1
+//
seta v_gunkick 1
Return to the top of this page or return to the overview of this repo.
Diff progs/a_mdls/m_cells1.mdl
diff --git a/progs/a_mdls/m_cells1.mdl b/progs/a_mdls/m_cells1.mdl
new file mode 100644
index 0000000..49428a8
Binary files /dev/null and b/progs/a_mdls/m_cells1.mdl differ
Return to the top of this page or return to the overview of this repo.
Diff progs/a_mdls/m_cells2.mdl
diff --git a/progs/a_mdls/m_cells2.mdl b/progs/a_mdls/m_cells2.mdl
new file mode 100644
index 0000000..a28bbbe
Binary files /dev/null and b/progs/a_mdls/m_cells2.mdl differ
Return to the top of this page or return to the overview of this repo.
Diff progs/a_mdls/m_nails1.mdl
diff --git a/progs/a_mdls/m_nails1.mdl b/progs/a_mdls/m_nails1.mdl
new file mode 100644
index 0000000..2a7471c
Binary files /dev/null and b/progs/a_mdls/m_nails1.mdl differ
Return to the top of this page or return to the overview of this repo.
Diff progs/a_mdls/m_nails2.mdl
diff --git a/progs/a_mdls/m_nails2.mdl b/progs/a_mdls/m_nails2.mdl
new file mode 100644
index 0000000..82298f0
Binary files /dev/null and b/progs/a_mdls/m_nails2.mdl differ
Return to the top of this page or return to the overview of this repo.
Diff progs/a_mdls/m_rock1.mdl
diff --git a/progs/a_mdls/m_rock1.mdl b/progs/a_mdls/m_rock1.mdl
new file mode 100644
index 0000000..53c6cb1
Binary files /dev/null and b/progs/a_mdls/m_rock1.mdl differ
Return to the top of this page or return to the overview of this repo.
Diff progs/a_mdls/m_rock2.mdl
diff --git a/progs/a_mdls/m_rock2.mdl b/progs/a_mdls/m_rock2.mdl
new file mode 100644
index 0000000..ee07395
Binary files /dev/null and b/progs/a_mdls/m_rock2.mdl differ
Return to the top of this page or return to the overview of this repo.
Diff progs/a_mdls/m_shell1.mdl
diff --git a/progs/a_mdls/m_shell1.mdl b/progs/a_mdls/m_shell1.mdl
new file mode 100644
index 0000000..855f070
Binary files /dev/null and b/progs/a_mdls/m_shell1.mdl differ
Return to the top of this page or return to the overview of this repo.
Diff progs/a_mdls/m_shell2.mdl
diff --git a/progs/a_mdls/m_shell2.mdl b/progs/a_mdls/m_shell2.mdl
new file mode 100644
index 0000000..047e6d3
Binary files /dev/null and b/progs/a_mdls/m_shell2.mdl differ
Return to the top of this page or return to the overview of this repo.
Diff progs/ammo/m_cells1.mdl
diff --git a/progs/ammo/m_cells1.mdl b/progs/ammo/m_cells1.mdl
deleted file mode 100644
index 49428a8..0000000
Binary files a/progs/ammo/m_cells1.mdl and /dev/null differ
Return to the top of this page or return to the overview of this repo.
Diff progs/ammo/m_cells2.mdl
diff --git a/progs/ammo/m_cells2.mdl b/progs/ammo/m_cells2.mdl
deleted file mode 100644
index a28bbbe..0000000
Binary files a/progs/ammo/m_cells2.mdl and /dev/null differ
Return to the top of this page or return to the overview of this repo.
Diff progs/ammo/m_nails1.mdl
diff --git a/progs/ammo/m_nails1.mdl b/progs/ammo/m_nails1.mdl
deleted file mode 100644
index 2a7471c..0000000
Binary files a/progs/ammo/m_nails1.mdl and /dev/null differ
Return to the top of this page or return to the overview of this repo.
Diff progs/ammo/m_nails2.mdl
diff --git a/progs/ammo/m_nails2.mdl b/progs/ammo/m_nails2.mdl
deleted file mode 100644
index 82298f0..0000000
Binary files a/progs/ammo/m_nails2.mdl and /dev/null differ
Return to the top of this page or return to the overview of this repo.
Diff progs/ammo/m_rock1.mdl
diff --git a/progs/ammo/m_rock1.mdl b/progs/ammo/m_rock1.mdl
deleted file mode 100644
index 53c6cb1..0000000
Binary files a/progs/ammo/m_rock1.mdl and /dev/null differ
Return to the top of this page or return to the overview of this repo.
Diff progs/ammo/m_rock2.mdl
diff --git a/progs/ammo/m_rock2.mdl b/progs/ammo/m_rock2.mdl
deleted file mode 100644
index ee07395..0000000
Binary files a/progs/ammo/m_rock2.mdl and /dev/null differ
Return to the top of this page or return to the overview of this repo.
Diff progs/ammo/m_shell1.mdl
diff --git a/progs/ammo/m_shell1.mdl b/progs/ammo/m_shell1.mdl
deleted file mode 100644
index 855f070..0000000
Binary files a/progs/ammo/m_shell1.mdl and /dev/null differ
Return to the top of this page or return to the overview of this repo.
Diff progs/ammo/m_shell2.mdl
diff --git a/progs/ammo/m_shell2.mdl b/progs/ammo/m_shell2.mdl
deleted file mode 100644
index 047e6d3..0000000
Binary files a/progs/ammo/m_shell2.mdl and /dev/null differ
Return to the top of this page or return to the overview of this repo.
Diff progs/h_mdls/m_h100.mdl
diff --git a/progs/h_mdls/m_h100.mdl b/progs/h_mdls/m_h100.mdl
new file mode 100644
index 0000000..6966039
Binary files /dev/null and b/progs/h_mdls/m_h100.mdl differ
Return to the top of this page or return to the overview of this repo.
Diff progs/h_mdls/m_h15.mdl
diff --git a/progs/h_mdls/m_h15.mdl b/progs/h_mdls/m_h15.mdl
new file mode 100644
index 0000000..a2c901c
Binary files /dev/null and b/progs/h_mdls/m_h15.mdl differ
Return to the top of this page or return to the overview of this repo.
Diff progs/h_mdls/m_h25.mdl
diff --git a/progs/h_mdls/m_h25.mdl b/progs/h_mdls/m_h25.mdl
new file mode 100644
index 0000000..47f4ff0
Binary files /dev/null and b/progs/h_mdls/m_h25.mdl differ
Return to the top of this page or return to the overview of this repo.
Diff progs/h_mdls/pd_vial.mdl
diff --git a/progs/h_mdls/pd_vial.mdl b/progs/h_mdls/pd_vial.mdl
new file mode 100644
index 0000000..6ab464f
Binary files /dev/null and b/progs/h_mdls/pd_vial.mdl differ
Return to the top of this page or return to the overview of this repo.
Diff progs/health/m_h100.mdl
diff --git a/progs/health/m_h100.mdl b/progs/health/m_h100.mdl
deleted file mode 100644
index 6966039..0000000
Binary files a/progs/health/m_h100.mdl and /dev/null differ
Return to the top of this page or return to the overview of this repo.
Diff progs/health/m_h15.mdl
diff --git a/progs/health/m_h15.mdl b/progs/health/m_h15.mdl
deleted file mode 100644
index a2c901c..0000000
Binary files a/progs/health/m_h15.mdl and /dev/null differ
Return to the top of this page or return to the overview of this repo.
Diff progs/health/m_h25.mdl
diff --git a/progs/health/m_h25.mdl b/progs/health/m_h25.mdl
deleted file mode 100644
index 47f4ff0..0000000
Binary files a/progs/health/m_h25.mdl and /dev/null differ
Return to the top of this page or return to the overview of this repo.
Diff progs/health/pd_vial.mdl
diff --git a/progs/health/pd_vial.mdl b/progs/health/pd_vial.mdl
deleted file mode 100644
index 6ab464f..0000000
Binary files a/progs/health/pd_vial.mdl and /dev/null differ
Return to the top of this page or return to the overview of this repo.
Diff qc/base_entities.qc
diff --git a/qc/base_entities.qc b/qc/base_entities.qc
index 34a68f0..7930eeb 100644
--- a/qc/base_entities.qc
+++ b/qc/base_entities.qc
@@ -7,23 +7,150 @@
//======================================================================
#if defined(CSQC) || defined(SSQC)
-const float STATE_ACTIVE = 0; // .estate field values
-const float STATE_INACTIVE = 1;
-const float STATE_INVISIBLE = 8;
+//----------------------------------------------------------------------
+// global spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_NOT_ON_EASY = 256, // this + next 3 are engine built-ins
+ SPAWNFLAG_NOT_ON_NORMAL = 512,
+ SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ SPAWNFLAG_NOT_IN_COOP = 4096, // Not in Coop
+ SPAWNFLAG_NOT_IN_SP = 8192, // Not in Single Player
+ SPAWNFLAG_NOT_IN_TEAMPLAY = 16384, // Not in Teamplay
+ SPAWNFLAG_NOT_ON_SKILL2 = 32768,// Not on Hard Only
+ SPAWNFLAG_NOT_ON_SKILL3 = 65536,// Not on Nightmare Only
+ SPAWNFLAG_CENTERPRINTALL = 131072 // print to all clients
+} base_entity_spawnflags;
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+// common entity netflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ // first byte of netflags
+ NETFLAG_BASE_ENTITY_EXTRA1, // read an additional byte of netflags
+ NETFLAG_BASE_ENTITY_ORIGIN_X, // .origin has changed
+ NETFLAG_BASE_ENTITY_ORIGIN_Y,
+ NETFLAG_BASE_ENTITY_ORIGIN_Z,
+ NETFLAG_BASE_ENTITY_ANGLES_Y, // .angles_y has changed
+ NETFLAG_BASE_ENTITY_RESERVED1, // reserved
+ NETFLAG_BASE_ENTITY_FRAME, // .frame has changed
+ NETFLAG_BASE_ENTITY_SKIN, // .skin has changed
+ // second byte of netflags
+ NETFLAG_BASE_ENTITY_ANGLES_X, // .angles_x has changed
+ NETFLAG_BASE_ENTITY_ANGLES_Z, // .angles_z has changed
+ NETFLAG_BASE_ENTITY_MODEL, // model has changed
+ NETFLAG_BASE_ENTITY_SIZE, // .mins and/or .maxs have changed
+ NETFLAG_BASE_ENTITY_SOLID, // .solid and/or .movetype
+ NETFLAG_BASE_ENTITY_WEAPON, // .weapon has changed
+ NETFLAG_BASE_ENTITY_RESERVED2, // reserved
+ NETFLAG_BASE_ENTITY_ALPHA // .alpha has changed
+} base_entity_netflags;
+
+// this bit & higher require EXTRA1 to be set -- CEV
+const float NETFLAG_BASE_ENTITY_HIGH1 = NETFLAG_BASE_ENTITY_ANGLES_X;
+
+// OR together the angles bits for convenience -- CEV
+const float NETFLAG_BASE_ENTITY_ANGLES = NETFLAG_BASE_ENTITY_ANGLES_X |
+ NETFLAG_BASE_ENTITY_ANGLES_Y | NETFLAG_BASE_ENTITY_ANGLES_Z;
+
+// OR together the origin bits for convenience -- CEV
+const float NETFLAG_BASE_ENTITY_ORIGIN = NETFLAG_BASE_ENTITY_ORIGIN_X |
+ NETFLAG_BASE_ENTITY_ORIGIN_Y | NETFLAG_BASE_ENTITY_ORIGIN_Z;
+
+// all known netflag bits -- CEV
+const float NETFLAG_BASE_ENTITY_FULLSEND = NETFLAG_BASE_ENTITY_EXTRA1 |
+ NETFLAG_BASE_ENTITY_ORIGIN_X | NETFLAG_BASE_ENTITY_ORIGIN_Y |
+ NETFLAG_BASE_ENTITY_ORIGIN_Z | NETFLAG_BASE_ENTITY_ANGLES_Y |
+ NETFLAG_BASE_ENTITY_RESERVED1 | NETFLAG_BASE_ENTITY_FRAME |
+ NETFLAG_BASE_ENTITY_SKIN |
+ NETFLAG_BASE_ENTITY_ANGLES_X | NETFLAG_BASE_ENTITY_ANGLES_Z |
+ NETFLAG_BASE_ENTITY_MODEL | NETFLAG_BASE_ENTITY_SIZE |
+ NETFLAG_BASE_ENTITY_SOLID | NETFLAG_BASE_ENTITY_WEAPON |
+ NETFLAG_BASE_ENTITY_RESERVED2 | NETFLAG_BASE_ENTITY_ALPHA;
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+typedef enum
+{
+ STATE_ACTIVE = 0, // .estate field values
+ STATE_INACTIVE = 1,
+ STATE_INVISIBLE = 8
+} base_entity_estates;
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+// identifies an entity as member of a linked list -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ QUE_TYPE_ACTOR, // moving actors (on the client)
+ QUE_TYPE_BODY, // the id1 bodyque
+ QUE_TYPE_CORPSE, // corpses
+ QUE_TYPE_DEBRIS // debris and gibs
+} base_entity_queflags;
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ DIMENSION_FLAG1,
+ DIMENSION_FLAG2,
+ DIMENSION_FLAG3,
+ DIMENSION_FLAG4,
+ DIMENSION_FLAG5,
+ DIMENSION_FLAG6,
+ DIMENSION_FLAG7,
+ DIMENSION_FLAG8
+} base_entity_dimensionflags;
#endif
//======================================================================
// globals
//======================================================================
+#ifdef CSQC
+float servertime;
+#endif
+
#ifdef SSQC
entity activator; // entity that activated trigger/brush
entity damage_attacker; // set by T_Damage
-// string lastnameused; // targetname last used to trigger
+
+// Additional spawn parms, following the same parmN theme.
+float parm17, parm18; /* parm19, parm20, parm21, parm22, parm23, parm24,
+ parm25, parm26, parm27, parm28, parm29, parm30, parm31, parm32; */
+#endif
+
+//----------------------------------------------------------------------
+// linked lists -- CEV
+//----------------------------------------------------------------------
+#ifdef CSQC
+entity actorque_head; // moving actors -- CEV
+#endif
+#ifdef SSQC
+entity corpseque_head; // monster corpses -- CEV
+entity debrisque_head; // debris from breakables -- CEV
+float corpseque_count; // count of corpses queued -- CEV
+float debrisque_count; // count of debris -- CEV
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+// Set by the engine before calls to spawn functions, and is most easily
+// parsed with the tokenize builtin. This allows you to handle halflife's
+// multiple-fields-with-the-same-name (or target-specific fields).
+// comment from fteextensions.qc -- CEV
+__unused var string __fullspawndata;
#endif
#if defined(CSQC) || defined(SSQC)
-// int trace_endcontentsi; // TODO CEV fteextensions.qc
float trace_surfaceflagsf; // float form is deprecated
#endif
@@ -41,19 +168,29 @@ float trace_surfaceflagsf; // float form is deprecated
.float count; // for counting triggers
.float damage_mod; // dumptruck_ds
.float delay; // time from activation to firing
+.float dimension_hit; // FTEQW
+.float dimension_solid; //
.float distance;
.float dmg; // damage done by door when hit
.float height;
.float gravity; // from custdefs.qc by way of Hipnotic
.float is_waiting; // wait until activated before trigger?
+.float inventory1; // inventory slots 1 through 8 -- CEV
+.float inventory2; //
+.float inventory3; //
+.float inventory4; //
+.float inventory5; //
+.float inventory6; //
+.float inventory7; //
+.float inventory8; //
.float lefty; // used by monsters and func_bob
-.float light_lev; // not used ingame, parsed by light util
+.float modelflags; // used to overwrite model flags -- CEV
+.float queflag; // linked list flag -- CEV
.float scale; // resizes model. 1=normal, 2=double
.float speed;
.float speed2;
.float state; // plats / doors / buttons
.float style, style2;
-.float sveffects; // engine clobbers .effects -- CEV
.float t_length, t_width; // func_, monster face, player LG, etc
.float wait; // time from firing to restarting
.float waitmin; // sounds (removed: waitmax)
@@ -64,22 +201,9 @@ float trace_surfaceflagsf; // float form is deprecated
.float prevstate; // previous entity state
.void() olduse; // previous use function
-/*
-.int hitcontentsmaski; // FTE surface impact mask
-*/
-
-.string mdl; // object stuff
+.string mdl; // hold original model for switching
.string message2; // func_laser & trigger_heal
.string noise4; // noise & noise1-3 defined in entvars_t
-.string origmodel; // switchables brushes (added by bmFbr)
-
-.vector mangle; // angle at start
-.vector neworigin; // prediction, hipnotic rotation
-.vector pos1; // used by some func_ classes
-.vector pos2;
-
-.entity oldenemy; // mad at this ent before taking damage
-.entity trigger_field; // TODO CEV: cutscene, door, shambler
// variables for enhanced triggering from Custents -- dumptruck_ds
// .string target // defined in entvars_t -- CEV
@@ -94,6 +218,20 @@ float trace_surfaceflagsf; // float form is deprecated
.string killtarget2; // second target to kill
.string pain_target; // dumptruck_ds
+.vector dest; // MG1
+.vector dest2; // MG1
+.vector mangle; // angle at start
+.vector neworigin; // prediction, hipnotic rotation
+.vector pos1; // used by func classes & to hold orig
+.vector pos2; // mins & maxes -- CEV
+
+.entity oldenemy; // mad at this ent before taking damage
+.entity que_next; // linked lists -- CEV
+.entity trigger_field; // TODO CEV: cutscene, door, shambler
+#endif
+
+#ifdef SSQC
+.void() tick; // MG1 frametick system -- CEV
.void(entity src, float amount) th_pain;
.void(vector dir) destroy; // th_die
#endif
@@ -111,13 +249,29 @@ float trace_surfaceflagsf; // float form is deprecated
.float SendFlags;
#endif
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+// entity networking / prediction; based on Nuclide and CSQCTest -- CEV
+//----------------------------------------------------------------------
+.vector origin_net; // last origin sent/received
+.vector origin_prev; // previous origin received
+.vector angles_net; // last angles sent/received
+.vector angles_prev; // previous angles received
+.float frame_net; // last .frame sent/received
#ifdef CSQC
-.vector origin_net; // entity networking / prediction;
-.vector velocity_net; // based on the implementation in
-.vector angles_net; // Nuclide -- CEV
-.float flags_net;
-.float pm_flags_net;
-.float pm_timer_net;
+.vector velocity_net; // for player prediction -- CEV
+.float origin_prev_stime;
+.float origin_prev_time; // timestamp of previous origin receipt
+.float origin_net_stime;
+.float origin_net_time; // timestamp of most recent origin
+.float angles_prev_stime;
+.float angles_prev_time; // timestamp of previous angles receipt
+.float angles_net_stime;
+.float angles_net_time; // timestamp of most recent angles
+.float flags_net; // last .flags received
+.float pm_flags_net; // last .pm_flags received
+.float pm_timer_net; // last .pm_timer received
+#endif
#endif
//======================================================================
@@ -126,12 +280,58 @@ float trace_surfaceflagsf; // float form is deprecated
// base entity
#ifdef CSQC
+// BASE_ENTITY_NETFLAGS2(fl) // read netflags2 built by macro below
+// BASE_ENTITY_READALPHA(fl) // Read macros for often-used fields
+// BASE_ENTITY_READANGLES(flP, flY, flR)
+// BASE_ENTITY_READCLASSTYPE()
+// BASE_ENTITY_READFRAME(fl)
+// BASE_ENTITY_READMODEL(fl)
+// BASE_ENTITY_READORIGIN(flX, flY, flZ)
+// BASE_ENTITY_READSIZE(fl)
+// BASE_ENTITY_READSKIN(fl)
+// BASE_ENTITY_READSOLID(fl)
+// BASE_ENTITY_READWEAPON(fl)
+float(float isnew) base_entity_netreceive;
+#endif
+#ifdef SSQC
+// BASE_ENTITY_NETFLAGS1(fl) // flag building macros
+// BASE_ENTITY_NETFLAGS2(fl)
+// BASE_ENTITY_NETFLAGS_EXTRA(fl1, fl2) // netflag hacks
+// BASE_ENTITY_NETFLAGS_FRAMEHACK(fl)
+// BASE_ENTITY_NETFLAGS_ANGLESHACK(flP, flY, flR)
+// BASE_ENTITY_NETFLAGS_ORIGINHACK(flX, flY, flZ)
+// BASE_ENTITY_WRITEALPHA(fl) // Write macros for often-used fields
+// BASE_ENTITY_WRITEANGLES(flP, flY, flR)
+// BASE_ENTITY_WRITECLASSTYPE()
+// BASE_ENTITY_WRITEFRAME(fl)
+// BASE_ENTITY_WRITEMODEL(fl)
+// BASE_ENTITY_WRITEORIGIN(flX, flY, flZ)
+// BASE_ENTITY_WRITESIZE(fl)
+// BASE_ENTITY_WRITESKIN(fl)
+// BASE_ENTITY_WRITESOLID(fl)
+// BASE_ENTITY_WRITEWEAPON(fl)
+float(entity to, float netflags) base_entity_netsend_null;
+float(entity to, float netflags) base_entity_netsend;
+#endif
+#ifdef CSQC
float() base_entity_parsemapdata;
+// BASE_ENTITY_LERP_ANGLES(ent, nvec, pvec, ctime, ntime, ptime)
+// BASE_ENTITY_LERP_ORIGIN(ent, nvec, pvec, ctime, ntime, ptime)
#endif
#if defined(CSQC) || defined(SSQC)
+// BASE_ENTITY_WEAPONLOOKUP(ent)
void(entity e) base_entity_aligntoground;
void(entity e, entity p, float maxspeed) base_entity_push;
void(entity e) base_entity_positioncontents;
+void(entity e) base_entity_remove;
+#endif
+#ifdef SSQC
+void() base_entity_movetype_push;
+void(entity e) base_entity_boundammo;
+#endif
+#if defined(CSQC) || defined(SSQC)
+entity(entity e, float fl) base_entity_que_add;
+void(entity e, float fl) base_entity_que_rem;
#endif
#ifdef SSQC
float(entity src, entity dest) can_damage;
@@ -160,7 +360,7 @@ void(string matchstring, .string matchfield) sub_usetarget;
#endif
// base_tempentity
-#ifdef SSQC
+#if defined(CSQC) || defined(SSQC)
void(entity e) base_tempentity_init;
strip void() base_tempentity;
#endif
@@ -176,9 +376,15 @@ strip void() temp_delayed_targets;
// base_mapentity
#if defined(CSQC) || defined(SSQC)
void(entity e) sub_setmovedir;
+#endif
#ifdef SSQC
void() sub_useandforgettargets;
#endif
+#ifdef SSQC
+void(void(string key, string value) init_field_fn)
+ base_mapentity_init_spawndata;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) base_mapentity_init;
strip void() base_mapentity;
#endif
@@ -194,6 +400,585 @@ void() noclass;
// class base_entity: entity
// {
//==============================================================
+ // Generic entity networking -- Client
+ //==============================================================
+
+#ifdef CSQC
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_NETFLAGS2(fl) \
+ /* { */ \
+ if (netflags2 & (fl >> 8)) \
+ { \
+ netflags |= fl; \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_READALPHA(fl) \
+ /* { */ \
+ if (netflags & fl) \
+ { \
+ self.alpha = ReadFloat (); \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_READCLASSTYPE() \
+ /* { */ \
+ self.classtype = ReadByte (); \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_READANGLES(flP, flY, flR) \
+ /* { */ \
+ if (netflags & flP || netflags & flY || netflags & flR) \
+ { \
+ if (isnew) \
+ { \
+ if (netflags & flP) \
+ self.angles.x = ReadAngle (); \
+ if (netflags & flY) \
+ self.angles.y = ReadAngle (); \
+ if (netflags & flR) \
+ self.angles.z = ReadAngle (); \
+ self.angles_prev = self.angles; \
+ self.angles_net = self.angles; \
+ self.angles_prev_time = time; \
+ self.angles_net_time = self.angles_prev_time; \
+ self.angles_prev_stime = servertime; \
+ self.angles_net_stime = servertime; \
+ } \
+ else \
+ { \
+ local vector newangles; \
+ if (netflags & flP) \
+ newangles.x = ReadAngle (); \
+ else \
+ newangles.x = self.angles_net.x; \
+ if (netflags & flY) \
+ newangles.y = ReadAngle (); \
+ else \
+ newangles.y = self.angles_net.y; \
+ if (netflags & flR) \
+ newangles.z = ReadAngle (); \
+ else \
+ newangles.z = self.angles_net.z; \
+ if (newangles != self.angles_net) \
+ { \
+ self.angles_prev = self.angles_net; \
+ self.angles_prev_time = \
+ self.angles_net_time; \
+ self.angles_prev_stime = \
+ self.angles_net_stime; \
+ self.angles_net = newangles; \
+ self.angles_net_time = time; \
+ self.angles_net_stime = servertime; \
+ } \
+ } \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_READFRAME(fl) \
+ /* { */ \
+ if (netflags & fl) \
+ { \
+ self.frame_net = ReadByte (); \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_READMODEL(fl) \
+ /* { */ \
+ if (netflags & fl) \
+ { \
+ self.modelindex = ReadShort (); \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_READORIGIN(flX, flY, flZ) \
+ /* { */ \
+ if (netflags & flX || netflags & flY || netflags & flZ) \
+ { \
+ if (isnew) \
+ { \
+ if (netflags & flX) \
+ self.origin.x = ReadCoord (); \
+ if (netflags & flY) \
+ self.origin.y = ReadCoord (); \
+ if (netflags & flZ) \
+ self.origin.z = ReadCoord (); \
+ self.origin_prev = self.origin; \
+ self.origin_net = self.origin; \
+ self.origin_prev_time = time; \
+ self.origin_net_time = self.origin_prev_time; \
+ self.origin_prev_stime = servertime; \
+ self.origin_net_stime = servertime; \
+ setorigin (self, self.origin); \
+ } \
+ else \
+ { \
+ local vector neworigin; \
+ if (netflags & flX) \
+ neworigin.x = ReadCoord (); \
+ else \
+ neworigin.x = self.origin_net.x; \
+ if (netflags & flY) \
+ neworigin.y = ReadCoord (); \
+ else \
+ neworigin.y = self.origin_net.y; \
+ if (netflags & flZ) \
+ neworigin.z = ReadCoord (); \
+ else \
+ neworigin.z = self.origin_net.z; \
+ if (neworigin != self.origin_net) \
+ { \
+ self.origin_prev = self.origin_net; \
+ self.origin_prev_time = \
+ self.origin_net_time; \
+ self.origin_prev_stime = \
+ self.origin_net_stime; \
+ self.origin_net = neworigin; \
+ self.origin_net_time = time; \
+ self.origin_net_stime = servertime; \
+ } \
+ } \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_READSIZE(fl) \
+ /* { */ \
+ if (netflags & fl) \
+ { \
+ self.mins.x = ReadCoord (); \
+ self.mins.y = ReadCoord (); \
+ self.mins.z = ReadCoord (); \
+ self.maxs.x = ReadCoord (); \
+ self.maxs.y = ReadCoord (); \
+ self.maxs.z = ReadCoord (); \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_READSKIN(fl) \
+ /* { */ \
+ if (netflags & fl) \
+ { \
+ self.skin = ReadByte (); \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_READSOLID(fl) \
+ /* { */ \
+ if (netflags & fl) \
+ { \
+ self.solid = ReadByte (); \
+ self.movetype = ReadByte (); \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_READWEAPON(fl) \
+ /* { */ \
+ if (netflags & fl) \
+ { \
+ self.weapon = ReadByte (); \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ float(float isnew) base_entity_netreceive =
+ {
+ local float netflags = ReadByte ();
+
+ if (netflags & NETFLAG_BASE_ENTITY_EXTRA1)
+ {
+ local float netflags2 = ReadByte ();
+ BASE_ENTITY_NETFLAGS2 (NETFLAG_BASE_ENTITY_ANGLES_X)
+ BASE_ENTITY_NETFLAGS2 (NETFLAG_BASE_ENTITY_ANGLES_Z)
+ BASE_ENTITY_NETFLAGS2 (NETFLAG_BASE_ENTITY_MODEL)
+ BASE_ENTITY_NETFLAGS2 (NETFLAG_BASE_ENTITY_SIZE)
+ BASE_ENTITY_NETFLAGS2 (NETFLAG_BASE_ENTITY_SOLID)
+ BASE_ENTITY_NETFLAGS2 (NETFLAG_BASE_ENTITY_WEAPON)
+ BASE_ENTITY_NETFLAGS2 (NETFLAG_BASE_ENTITY_RESERVED2)
+ BASE_ENTITY_NETFLAGS2 (NETFLAG_BASE_ENTITY_ALPHA)
+ }
+
+ BASE_ENTITY_READORIGIN (NETFLAG_BASE_ENTITY_ORIGIN_X,
+ NETFLAG_BASE_ENTITY_ORIGIN_Y,
+ NETFLAG_BASE_ENTITY_ORIGIN_Z)
+ BASE_ENTITY_READANGLES (NETFLAG_BASE_ENTITY_ANGLES_X,
+ NETFLAG_BASE_ENTITY_ANGLES_Y,
+ NETFLAG_BASE_ENTITY_ANGLES_Z)
+ BASE_ENTITY_READFRAME (NETFLAG_BASE_ENTITY_FRAME)
+ BASE_ENTITY_READSKIN (NETFLAG_BASE_ENTITY_SKIN)
+ BASE_ENTITY_READMODEL (NETFLAG_BASE_ENTITY_MODEL)
+ BASE_ENTITY_READSIZE (NETFLAG_BASE_ENTITY_SIZE)
+ BASE_ENTITY_READSOLID (NETFLAG_BASE_ENTITY_SOLID)
+ BASE_ENTITY_READWEAPON (NETFLAG_BASE_ENTITY_WEAPON)
+ BASE_ENTITY_READALPHA (NETFLAG_BASE_ENTITY_ALPHA)
+
+ return netflags;
+ };
+#endif
+
+ //==============================================================
+ // Generic entity networking -- Server
+ //==============================================================
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_NETFLAGS1(fl) \
+ /* { */ \
+ if (netflags & fl) \
+ { \
+ netflags1 |= fl; \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_NETFLAGS2(fl) \
+ /* { */ \
+ if (netflags & fl) \
+ { \
+ netflags2 |= fl >> 8; \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_NETFLAGS_EXTRA(flH, flEXTRA) \
+ /* { */ \
+ if (netflags >= flH) \
+ { \
+ if (!(netflags & flEXTRA)) \
+ netflags |= flEXTRA; \
+ } \
+ else \
+ { \
+ if (netflags & flEXTRA) \
+ netflags &= ~flEXTRA; \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_NETFLAGS_FRAMEHACK(fl) \
+ /* { */ \
+ if (!(netflags & fl)) \
+ { \
+ if (self.frame_net != self.frame) \
+ { \
+ netflags |= fl; \
+ } \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_NETFLAGS_ANGLESHACK(flP, flY, flR) \
+ /* { */ \
+ if (netflags & flP) \
+ { \
+ if (self.angles_net.x == self.angles.x) \
+ { \
+ netflags &= ~flP; \
+ } \
+ } \
+ else \
+ { \
+ if (self.angles_net.x != self.angles.x) \
+ { \
+ netflags |= flP; \
+ } \
+ } \
+ if (netflags & flY) \
+ { \
+ if (self.angles_net.y == self.angles.y) \
+ { \
+ netflags &= ~flY; \
+ } \
+ } \
+ else \
+ { \
+ if (self.angles_net.y != self.angles.y) \
+ { \
+ netflags |= flY; \
+ } \
+ } \
+ if (netflags & flR) \
+ { \
+ if (self.angles_net.z == self.angles.z) \
+ { \
+ netflags &= ~flR; \
+ } \
+ } \
+ else \
+ { \
+ if (self.angles_net.z != self.angles.z) \
+ { \
+ netflags |= flR; \
+ } \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_NETFLAGS_ORIGINHACK(flX, flY, flZ) \
+ /* { */ \
+ if (netflags & flX) \
+ { \
+ if (self.origin_net.x == self.origin.x) \
+ { \
+ netflags &= ~flX; \
+ } \
+ } \
+ else \
+ { \
+ if (self.origin_net.x != self.origin.x) \
+ { \
+ netflags |= flX; \
+ } \
+ } \
+ if (netflags & flY) \
+ { \
+ if (self.origin_net.y == self.origin.y) \
+ { \
+ netflags &= ~flY; \
+ } \
+ } \
+ else \
+ { \
+ if (self.origin_net.y != self.origin.y) \
+ { \
+ netflags |= flY; \
+ } \
+ } \
+ if (netflags & flZ) \
+ { \
+ if (self.origin_net.z == self.origin.z) \
+ { \
+ netflags &= ~flZ; \
+ } \
+ } \
+ else \
+ { \
+ if (self.origin_net.z != self.origin.z) \
+ { \
+ netflags |= flZ; \
+ } \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_WRITEALPHA(fl) \
+ /* { */ \
+ if (netflags & fl) \
+ { \
+ WriteFloat (MSG_ENTITY, self.alpha); \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_WRITEANGLES(flP, flY, flR) \
+ /* { */ \
+ if (netflags & flP) \
+ { \
+ WriteAngle (MSG_ENTITY, self.angles.x); \
+ self.angles_net.x = self.angles.x; \
+ } \
+ if (netflags & flY) \
+ { \
+ WriteAngle (MSG_ENTITY, self.angles.y); \
+ self.angles_net.y = self.angles.y; \
+ } \
+ if (netflags & flR) \
+ { \
+ WriteAngle (MSG_ENTITY, self.angles.z); \
+ self.angles_net.z = self.angles.z; \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_WRITECLASSTYPE() \
+ /* { */ \
+ WriteByte (MSG_ENTITY, self.classtype); \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_WRITEFRAME(fl) \
+ /* { */ \
+ if (netflags & fl) \
+ { \
+ WriteByte (MSG_ENTITY, self.frame); \
+ self.frame_net = self.frame; \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_WRITEMODEL(fl) \
+ /* { */ \
+ if (netflags & fl) \
+ { \
+ WriteShort (MSG_ENTITY, self.modelindex); \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_WRITEORIGIN(flX, flY, flZ) \
+ /* { */ \
+ if (netflags & flX) \
+ { \
+ WriteCoord (MSG_ENTITY, self.origin.x); \
+ self.origin_net.x = self.origin.x; \
+ } \
+ if (netflags & flY) \
+ { \
+ WriteCoord (MSG_ENTITY, self.origin.y); \
+ self.origin_net.y = self.origin.y; \
+ } \
+ if (netflags & flZ) \
+ { \
+ WriteCoord (MSG_ENTITY, self.origin.z); \
+ self.origin_net.z = self.origin.z; \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_WRITESIZE(fl) \
+ /* { */ \
+ if (netflags & fl) \
+ { \
+ WriteCoord (MSG_ENTITY, self.mins.x); \
+ WriteCoord (MSG_ENTITY, self.mins.y); \
+ WriteCoord (MSG_ENTITY, self.mins.z); \
+ WriteCoord (MSG_ENTITY, self.maxs.x); \
+ WriteCoord (MSG_ENTITY, self.maxs.y); \
+ WriteCoord (MSG_ENTITY, self.maxs.z); \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_WRITESKIN(fl) \
+ /* { */ \
+ if (netflags & fl) \
+ { \
+ WriteByte (MSG_ENTITY, self.skin); \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_WRITESOLID(fl) \
+ /* { */ \
+ if (netflags & fl) \
+ { \
+ WriteByte (MSG_ENTITY, self.solid); \
+ WriteByte (MSG_ENTITY, self.movetype); \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_WRITEWEAPON(fl) \
+ /* { */ \
+ if (netflags & fl) \
+ { \
+ WriteByte (MSG_ENTITY, self.weapon); \
+ } \
+ /* } */
+
+
+ //--------------------------------------------------------------
+ float(entity to, float netflags) base_entity_netsend_null =
+ {
+ // this is to suppress the engine sending an entity -- CEV
+ return FALSE;
+ };
+
+ //--------------------------------------------------------------
+ float(entity to, float netflags) base_entity_netsend =
+ {
+ BASE_ENTITY_WRITECLASSTYPE ()
+
+ // restrict to known flags -- CEV
+ if (netflags > NETFLAG_BASE_ENTITY_FULLSEND)
+ netflags = NETFLAG_BASE_ENTITY_FULLSEND;
+
+ // split netflags into bytes -- CEV
+ local float netflags1 = 0;
+ local float netflags2 = 0;
+
+ // a couple of hacks for ORIGIN, ANGLES, and FRAME to ensure
+ // they're transmitted to the client if they've changed -- CEV
+ if (netflags != NETFLAG_BASE_ENTITY_FULLSEND)
+ {
+ // rewrite origin flags -- CEV
+ BASE_ENTITY_NETFLAGS_ORIGINHACK (
+ NETFLAG_BASE_ENTITY_ORIGIN_X,
+ NETFLAG_BASE_ENTITY_ORIGIN_Y,
+ NETFLAG_BASE_ENTITY_ORIGIN_Z)
+
+ // rewrite angles flags -- CEV
+ BASE_ENTITY_NETFLAGS_ANGLESHACK (
+ NETFLAG_BASE_ENTITY_ANGLES_X,
+ NETFLAG_BASE_ENTITY_ANGLES_Y,
+ NETFLAG_BASE_ENTITY_ANGLES_Z)
+
+ // rewrite frame flag -- CEV
+ BASE_ENTITY_NETFLAGS_FRAMEHACK (
+ NETFLAG_BASE_ENTITY_FRAME)
+ }
+
+ // make sure EXTRA1 is set if needed -- CEV
+ BASE_ENTITY_NETFLAGS_EXTRA (NETFLAG_BASE_ENTITY_HIGH1,
+ NETFLAG_BASE_ENTITY_EXTRA1)
+
+ BASE_ENTITY_NETFLAGS1 (NETFLAG_BASE_ENTITY_EXTRA1)
+ BASE_ENTITY_NETFLAGS1 (NETFLAG_BASE_ENTITY_ORIGIN_X)
+ BASE_ENTITY_NETFLAGS1 (NETFLAG_BASE_ENTITY_ORIGIN_Y)
+ BASE_ENTITY_NETFLAGS1 (NETFLAG_BASE_ENTITY_ORIGIN_Z)
+ BASE_ENTITY_NETFLAGS1 (NETFLAG_BASE_ENTITY_ANGLES_Y)
+ BASE_ENTITY_NETFLAGS1 (NETFLAG_BASE_ENTITY_RESERVED1)
+ BASE_ENTITY_NETFLAGS1 (NETFLAG_BASE_ENTITY_FRAME)
+ BASE_ENTITY_NETFLAGS1 (NETFLAG_BASE_ENTITY_SKIN)
+
+ // write first byte of netflags -- CEV
+ WriteByte (MSG_ENTITY, netflags1);
+
+ // build second netflags byte if needed -- CEV
+ if (netflags & NETFLAG_BASE_ENTITY_EXTRA1)
+ {
+ BASE_ENTITY_NETFLAGS2 (NETFLAG_BASE_ENTITY_ANGLES_X)
+ BASE_ENTITY_NETFLAGS2 (NETFLAG_BASE_ENTITY_ANGLES_Z)
+ BASE_ENTITY_NETFLAGS2 (NETFLAG_BASE_ENTITY_MODEL)
+ BASE_ENTITY_NETFLAGS2 (NETFLAG_BASE_ENTITY_SIZE)
+ BASE_ENTITY_NETFLAGS2 (NETFLAG_BASE_ENTITY_SOLID)
+ BASE_ENTITY_NETFLAGS2 (NETFLAG_BASE_ENTITY_WEAPON)
+ BASE_ENTITY_NETFLAGS2 (NETFLAG_BASE_ENTITY_RESERVED2)
+ BASE_ENTITY_NETFLAGS2 (NETFLAG_BASE_ENTITY_ALPHA)
+
+ // write second byte -- CEV
+ WriteByte (MSG_ENTITY, netflags2);
+ }
+
+ // write entity data -- see base_entities.qc for macros -- CEV
+ BASE_ENTITY_WRITEORIGIN (NETFLAG_BASE_ENTITY_ORIGIN_X,
+ NETFLAG_BASE_ENTITY_ORIGIN_Y,
+ NETFLAG_BASE_ENTITY_ORIGIN_Z)
+ BASE_ENTITY_WRITEANGLES (NETFLAG_BASE_ENTITY_ANGLES_X,
+ NETFLAG_BASE_ENTITY_ANGLES_Y,
+ NETFLAG_BASE_ENTITY_ANGLES_Z)
+ BASE_ENTITY_WRITEFRAME (NETFLAG_BASE_ENTITY_FRAME)
+ BASE_ENTITY_WRITESKIN (NETFLAG_BASE_ENTITY_SKIN)
+ BASE_ENTITY_WRITEMODEL (NETFLAG_BASE_ENTITY_MODEL)
+ BASE_ENTITY_WRITESIZE (NETFLAG_BASE_ENTITY_SIZE)
+ BASE_ENTITY_WRITESOLID (NETFLAG_BASE_ENTITY_SOLID)
+ BASE_ENTITY_WRITEWEAPON (NETFLAG_BASE_ENTITY_WEAPON)
+ BASE_ENTITY_WRITEALPHA (NETFLAG_BASE_ENTITY_ALPHA)
+
+ return TRUE;
+ };
+#endif
+
+ //==============================================================
// Misc Functions
//==============================================================
@@ -286,6 +1071,12 @@ void() noclass;
case "fog_density":
e.fog_density = stof (value);
break;
+ case "target":
+ e.target = value;
+ break;
+ case "targetname":
+ e.targetname = value;
+ break;
}
}
@@ -293,10 +1084,88 @@ void() noclass;
remove (e);
return FALSE;
};
+
+ //--------------------------------------------------------------
+ // angle interpolation macro -- suitable for predraw -- CEV
+ // args: entity, _net vector, _prev vector, time, _net_time, _prev_time
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_LERP_ANGLES(ent, nvec, pvec, ctime, ntime, ptime) \
+ /* { */ \
+ if (ntime != ctime && (ntime - ptime)) \
+ { \
+ local float af2 = (ctime - ntime) / (ntime - ptime); \
+ af2 = bound (0, af2, 1); \
+ local float ang; \
+ /* correctly wrap angles when interpolating. this is
+ * the same logic used in Ironwail 0.7.0; see
+ * Quake/cl_main.c line 547 -- CEV */ \
+ for (float angi = 0; angi < 3; angi++) \
+ { \
+ ang = nvec[angi] - pvec[angi]; \
+ if (ang > 180) \
+ ang -= 360; \
+ else if (ang < -180) \
+ ang += 360; \
+ ent.angles[angi] = pvec[angi] + ang * af2; \
+ } \
+ }
+ /* } */
+
+ //--------------------------------------------------------------
+ // origin interpolation macro -- suitable for predraw -- CEV
+ // args: entity, _net vector, _prev vector, time, _net_time, _prev_time
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_LERP_ORIGIN(ent, nvec, pvec, ctime, ntime, ptime) \
+ /* { */ \
+ local float of2 = ntime - ptime; \
+ if (ntime != ctime && (of2)) \
+ { \
+ /* of2 (lerp fraction) code from Ironwail 0.7.0,
+ * file cl_main.c function CL_LerpPoint -- CEV */ \
+ if (of2 > 0.1) \
+ { \
+ /* dropped packet, or start of demo
+ * (above comment from Ironwail) -- CEV */ \
+ /* this seems to smooth out some jerky motion,
+ * noticeable with monster_wizard -- CEV */ \
+ ptime = ntime - 0.1; \
+ of2 = 0.1; \
+ } \
+ of2 = (ctime - ntime) / of2; \
+ /* the engine (Ironwail at least) sometimes adjusts
+ * the client's time global while bounding the lerp
+ * fraction; let's not do that here in QC -- CEV */ \
+ of2 = bound (0, of2, 1); \
+ ent.origin = pvec + (nvec - pvec) * of2; \
+ /*
+ dprint (sprintf("BASE_ENTITY_LERP_ORIGIN: " \
+ "t - n %g, n - p %g, of2 %g\n", \
+ ctime - ntime, ntime - ptime, of2)); \
+ */ \
+ setorigin (ent, ent.origin); \
+ } \
+ /* } */
#endif
#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
+ #define BASE_ENTITY_WEAPONLOOKUP(ent) \
+ /* { */ \
+ local float item_index = 0; \
+ switch (ent.weapon) \
+ { \
+ case 1: item_index = ent.inventory1; break; \
+ case 2: item_index = ent.inventory2; break; \
+ case 3: item_index = ent.inventory3; break; \
+ case 4: item_index = ent.inventory4; break; \
+ case 5: item_index = ent.inventory5; break; \
+ case 6: item_index = ent.inventory6; break; \
+ case 7: item_index = ent.inventory7; break; \
+ case 8: item_index = ent.inventory8; break; \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
// Align an entity to the ground plane. Code by Spike, found here:
// https://forums.insideqc.com/viewtopic.php?f=2&t=5585#p55093
//--------------------------------------------------------------
@@ -314,6 +1183,16 @@ void() noclass;
(v_forward * trace_plane_normal) * trace_plane_normal;
e.angles = vectoangles (coplanar, trace_plane_normal);
// e.angles = vectoangles (coplanar);
+
+ #ifdef SSQC
+ if (e.SendEntity)
+ {
+ if (e.classtype == CT_PLAYER)
+ e.SendFlags |= NETFLAG_PLAYER_ANGLES;
+ else
+ e.SendFlags |= NETFLAG_BASE_ENTITY_ANGLES;
+ }
+ #endif
};
//--------------------------------------------------------------
@@ -450,6 +1329,380 @@ void() noclass;
}
#endif
};
+
+ //--------------------------------------------------------------
+ // wrapper for remove() that safely pulls entities out of any
+ // queues they might be in before calling the real remove -- CEV
+ //--------------------------------------------------------------
+ void(entity e) base_entity_remove =
+ {
+ if (e)
+ {
+ if (e.queflag)
+ base_entity_que_rem (e, e.queflag);
+
+ if (e.classgroup & CG_FRAMETICK)
+ e.classgroup &= ~CG_FRAMETICK;
+
+ remove (e);
+ }
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ // .customphysics for MOVETYPE_PUSH entities that set SendFlags
+ // on the moving entity and any moved entities -- CEV
+ //--------------------------------------------------------------
+ void() base_entity_movetype_push =
+ {
+ local float mt = server_deltatime;
+ local float oldltime = self.ltime;
+
+ if (self.nextthink < self.ltime + mt)
+ mt = max (0, self.nextthink - self.ltime);
+
+ if (mt) {
+ if (self.velocity == '0 0 0' && self.avelocity == '0 0 0')
+ {
+ self.ltime += mt;
+ }
+ else
+ {
+ local vector oldmin = self.absmin;
+ local vector oldmax = self.absmax;
+
+ // pushing entities is hard; let the engine do it -- CEV
+ if (pushmove(self, self.velocity * mt,
+ self.avelocity * mt))
+ {
+ self.ltime += mt;
+
+ // flag any nearby ents to transmit origin to
+ // CSQC; findradius options from Xonotic -- CEV
+ local entity e = findradius(
+ (oldmin + oldmax) * 0.5,
+ vlen(oldmin - oldmax) * 0.5);
+
+ for (; e; e = e.chain)
+ {
+ switch (e.movetype)
+ {
+ case MOVETYPE_NONE:
+ case MOVETYPE_PUSH:
+ case MOVETYPE_NOCLIP:
+ continue;
+ }
+
+ if (e.origin == e.origin_net)
+ continue;
+
+ // defines so I don't run off the
+ // right side of my screen -- CEV
+ #define FL1 NETFLAG_BASE_ENTITY_ORIGIN
+ #define FL2 NETFLAG_PLAYER_ORIGIN
+
+ switch (e.SendEntity)
+ {
+ case base_entity_netsend:
+ e.SendFlags |= FL1;
+ break;
+ case player_netsend:
+ e.SendFlags |= FL2;
+ break;
+ default:
+ continue;
+ break;
+ }
+
+ #undef FL1
+ #undef FL2
+
+ #if 0
+ dprint (sprintf("base_entity_movetype_"
+ "push: %s found %s, time %g\n",
+ self.classname, e.classname,
+ time));
+ #endif
+ }
+ }
+
+ if (self.origin != self.origin_net)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
+ } }
+
+ if (self.nextthink > oldltime)
+ {
+ if (self.nextthink <= self.ltime)
+ {
+ self.nextthink = 0;
+ if (self.think)
+ self.think ();
+ }
+ }
+ };
+
+ //--------------------------------------------------------------
+ void(entity e) base_entity_boundammo =
+ {
+ // these constants are defined in items/ammo.qc -- CEV
+ if (e.ammo_shells > AMMO_SHELLS_MAX)
+ e.ammo_shells = AMMO_SHELLS_MAX;
+ if (e.ammo_nails > AMMO_NAILS_MAX)
+ e.ammo_nails = AMMO_NAILS_MAX;
+ if (e.ammo_rockets > AMMO_ROCKETS_MAX)
+ e.ammo_rockets = AMMO_ROCKETS_MAX;
+ if (e.ammo_cells > AMMO_CELLS_MAX)
+ e.ammo_cells = AMMO_CELLS_MAX;
+ };
+#endif
+
+ //==============================================================
+ // Linked List Handling
+ //==============================================================
+
+#if defined(CSQC) || defined(SSQC)
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_QUE_DEBUG
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_QUE_ADD_DEBUGPRINT() \
+ { \
+ newcount = *que_count; \
+ dprint (sprintf("base_entity_que_add: " \
+ "added %s, type %g, new count %g\n", \
+ add.classname, fl, newcount)); \
+ }
+
+ //--------------------------------------------------------------
+ // base_entity_que_add
+ // arguments are: entity to add & type of list to add it to -- CEV
+ // returns an entity if one was removed from the queue -- CEV
+ //
+ // this is based on the linked list (actor list) management code
+ // in the Wrath Aeon Of Ruin multiplayer codebase by Reki -- CEV
+ //--------------------------------------------------------------
+ entity(entity add, float fl) base_entity_que_add =
+ {
+ local entity ret = __NULL__;
+ if (add.queflag)
+ {
+ // already in a queue -- CEV
+ if (add.queflag != fl)
+ dprint (sprintf("base_entity_que_add: %s "
+ "ent is a member of another list "
+ "(queflag %g, type %g)!\n",
+ add.classname, add.queflag, fl));
+ return ret;
+ }
+
+ add.queflag = fl;
+
+ local entity h = world;
+ local entity g;
+ local entity *que_head = __NULL__;
+ local float *que_count = __NULL__;
+ local float que_count_max = 0;
+
+ #ifdef BASE_ENTITY_QUE_DEBUG
+ local float newcount = 0;
+ #endif
+
+ switch (fl)
+ {
+ #ifdef CSQC
+ case QUE_TYPE_ACTOR:
+ que_head = &actorque_head;
+ break;
+ #endif
+ #ifdef SSQC
+ case QUE_TYPE_BODY:
+ que_head = &bodyque_head;
+ break;
+ case QUE_TYPE_CORPSE:
+ que_head = &corpseque_head;
+ que_count = &corpseque_count;
+ break;
+ case QUE_TYPE_DEBRIS:
+ que_head = &debrisque_head;
+ que_count = &debrisque_count;
+ que_count_max = DEBRISQUE_COUNT_MAX;
+ break;
+ #endif
+ default:
+ dprint (sprintf("base_entity_que_add: "
+ "unknown que type %g, class %s\n",
+ fl, add.classname));
+ return ret;
+ }
+
+ for (g = *que_head; g; h = g, g = g.que_next)
+ {
+ if (g == add)
+ // found a duplicate -- CEV
+ return ret;
+ }
+
+ if (h == world)
+ {
+ // we're the first, so we are the list -- CEV
+ *que_head = add;
+
+ // increment a count if we have one -- CEV
+ if (que_count)
+ {
+ *que_count = *que_count + 1;
+ #ifdef BASE_ENTITY_QUE_DEBUG
+ BASE_ENTITY_QUE_ADD_DEBUGPRINT ()
+ #endif
+ }
+
+ return ret;
+ }
+
+ // queue size limiter -- CEV
+ if (que_count)
+ {
+ if (que_count_max)
+ {
+ // store the queue head, then shift the head
+ // to its next, then return the stored entity
+ // -- CEV
+ if (*que_count >= que_count_max)
+ {
+ ret = *que_head;
+ *que_head = ret.que_next;
+ ret.que_next = world;
+ }
+ else
+ {
+ // increment global counter -- CEV
+ *que_count = *que_count + 1;
+ }
+ }
+ else
+ {
+ // increment global counter -- CEV
+ *que_count = *que_count + 1;
+ }
+ }
+
+ #ifdef BASE_ENTITY_QUE_DEBUG
+ if (que_count)
+ {
+ BASE_ENTITY_QUE_ADD_DEBUGPRINT ()
+ }
+ #endif
+
+ h.que_next = add;
+ return ret;
+ };
+
+ //--------------------------------------------------------------
+ #undef BASE_ENTITY_QUE_ADD_DEBUGPRINT
+
+ //--------------------------------------------------------------
+ #define BASE_ENTITY_QUE_REM_DEBUGPRINT() \
+ { \
+ newcount = *que_count; \
+ dprint (sprintf("base_entity_que_rem: " \
+ "removed %s, type %g, new count %g\n", \
+ rem.classname, fl, newcount)); \
+ }
+
+
+ //--------------------------------------------------------------
+ void(entity rem, float fl) base_entity_que_rem =
+ {
+ if (!(rem.queflag))
+ // not a member of a list -- CEV
+ return;
+
+ rem.queflag = 0;
+
+ local entity *que_head = __NULL__;
+ local float *que_count = __NULL__;
+
+ #ifdef BASE_ENTITY_QUE_DEBUG
+ local float newcount = 0;
+ #endif
+
+ switch (fl)
+ {
+ #ifdef CSQC
+ case QUE_TYPE_ACTOR:
+ que_head = &actorque_head;
+ break;
+ #endif
+ #ifdef SSQC
+ case QUE_TYPE_BODY:
+ que_head = &bodyque_head;
+ break;
+ case QUE_TYPE_CORPSE:
+ que_head = &corpseque_head;
+ que_count = &corpseque_count;
+ break;
+ case QUE_TYPE_DEBRIS:
+ que_head = &debrisque_head;
+ que_count = &debrisque_count;
+ break;
+ #endif
+ default:
+ dprint (sprintf("base_entity_que_rem: "
+ "unknown que type %g, class %s\n",
+ fl, rem.classname));
+ return;
+ }
+
+ if (rem == *que_head)
+ {
+ local entity head1 = *que_head;
+ *que_head = head1.que_next;
+
+ // set the removed entity's que_next to 0 -- CEV
+ rem.que_next = world;
+
+ if (que_count)
+ {
+ *que_count = *que_count - 1;
+
+ #ifdef BASE_ENTITY_QUE_DEBUG
+ BASE_ENTITY_QUE_REM_DEBUGPRINT ()
+ #endif
+ }
+
+ return;
+ }
+
+ local entity h = world;
+ local entity g;
+
+ for (g = *que_head; g; h = g, g = g.que_next)
+ {
+
+ if (g != rem)
+ continue;
+
+ h.que_next = rem.que_next;
+
+ // set the removed entity's que_next to 0 -- CEV
+ rem.que_next = world;
+
+ if (que_count)
+ {
+ *que_count = *que_count - 1;
+
+ #ifdef BASE_ENTITY_QUE_DEBUG
+ BASE_ENTITY_QUE_REM_DEBUGPRINT ()
+ #endif
+ }
+
+ return;
+ }
+ };
+
+ //--------------------------------------------------------------
+ #undef BASE_ENTITY_QUE_REM_DEBUGPRINT
#endif
//==============================================================
@@ -518,6 +1771,13 @@ void() noclass;
self.movetype == MOVETYPE_BOUNCE)
{
// doors, triggers, missiles, etc
+ // yoder add, 27/09/202 to let the SUB_UseTargets work
+ if (self.classtype == CT_MISC_EXPLOBOX ||
+ self.classtype == CT_MISC_EXPLOBOX2)
+ {
+ self.enemy = attacker;
+ }
+
if (self.th_die)
{
self.th_die ();
@@ -549,7 +1809,7 @@ void() noclass;
self.touch = sub_null;
if (self.classgroup & CG_MONSTER)
- sub_death_use ();
+ base_monster_use_death ();
if (self.th_die)
self.th_die ();
@@ -735,14 +1995,12 @@ void() noclass;
// some func_breakables ignore monster damage -- johnfitz
// dded from Rubicon2 combat.qc -- dumptruck_ds
- if (targ.classtype == CT_FUNC_BREAKABLE)
+ if (targ.classtype == CT_FUNC_BREAKABLE) {
+ if (targ.spawnflags & SPAWNFLAG_BASE_BREAKABLE_NO_MONSTERS) {
+ if (attacker.flags & FL_MONSTER)
{
- if (targ.spawnflags & BREAKABLE_NO_MONSTERS &&
- attacker.flags & FL_MONSTER)
- {
- return;
- }
- }
+ return;
+ } } }
// johnfitz
// used by buttons and triggers to set activator for
@@ -751,7 +2009,10 @@ void() noclass;
// check for quad damage powerup on the attacker
if (attacker.super_damage_finished > time)
+ {
+ dprint ("QUAD\n");
damage = damage * 4;
+ }
// damage mod for monsters -- dumptruck_ds
if (attacker.damage_mod)
@@ -764,7 +2025,8 @@ void() noclass;
targ.classgroup & CG_CORPSE))
{
// let even weak explosions gib zombies and corpses
- damage = damage * 3;
+ dprint ("t_damage2: damage boost for zombie gib\n");
+ damage = damage * 4;
}
// don't deplete armor if drowning/burning, or
@@ -944,7 +2206,7 @@ void() noclass;
&& (self.style == attacker.style)) ||
// infight if different models
(mode > 0 &&
- self.mdl_body != attacker.mdl_body) ||
+ self.model != attacker.model) ||
// infight if different skin
(mode > 1 &&
self.skin != attacker.skin) ||
@@ -998,7 +2260,7 @@ void() noclass;
//--------------------------------------------------------------
void() sub_remove =
{
- remove (self);
+ base_entity_remove (self);
};
//--------------------------------------------------------------
@@ -1006,7 +2268,7 @@ void() noclass;
{
if (self.alpha <= 0)
{
- remove (self);
+ base_entity_remove (self);
}
else
{
@@ -1025,9 +2287,12 @@ void() noclass;
return;
local entity stemp = self;
+ local entity otemp = other;
+ other = self;
self = doas;
f ();
self = stemp;
+ other = otemp;
};
//--------------------------------------------------------------
@@ -1055,11 +2320,10 @@ void() noclass;
if (toucher.classtype != CT_PLAYER)
return FALSE;
- #ifdef SSQC
if (toucher.health <= 0)
return FALSE;
- #endif
+ // from Copper -- dumptruck_ds
if (toucher.movetype == MOVETYPE_NOCLIP)
return FALSE;
@@ -1090,7 +2354,7 @@ void() noclass;
// print the message
if (self.message != "" && !(self.flags & FL_NOCENTERPRINT))
{
- if (self.spawnflags & TRIGGER_CENTERPRINTALL)
+ if (self.spawnflags & SPAWNFLAG_CENTERPRINTALL)
{
t = findfloat (world, classtype, CT_PLAYER);
while (t)
@@ -1179,7 +2443,7 @@ void() noclass;
if (t.switchshadstyle)
lightstyle (t.switchshadstyle, "m");
if (t)
- remove (t);
+ base_entity_remove (t);
t = find (t, matchfield, matchstring);
}
};
@@ -1204,7 +2468,6 @@ void() noclass;
{
if (self.use)
{
- // lastnameused = matchstring;
self.use ();
}
}
@@ -1217,7 +2480,7 @@ void() noclass;
#endif
// };
-#ifdef SSQC
+#if defined(CSQC) || defined(SSQC)
//----------------------------------------------------------------------
// base_tempentity -- QC generated temporary entities
//----------------------------------------------------------------------
@@ -1292,7 +2555,6 @@ void() noclass;
// };
#endif
-#if defined(CSQC) || defined(SSQC)
//----------------------------------------------------------------------
// base_mapentity -- spawnable mapper-placeable entities
//----------------------------------------------------------------------
@@ -1302,6 +2564,7 @@ void() noclass;
// Subs
//==============================================================
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) sub_setmovedir =
{
@@ -1323,6 +2586,7 @@ void() noclass;
e.angles = '0 0 0';
};
+#endif
#ifdef SSQC
//--------------------------------------------------------------
@@ -1345,10 +2609,42 @@ void() noclass;
// Initialization
//==============================================================
+#ifdef SSQC
+ //--------------------------------------------------------------
+ // base_mapentity_init_spawndata
+ //
+ // loop over __fullspawndata running func for each key/value pair.
+ //
+ // __fullspawndata contains an entity's fields as set in the map
+ // file in a format suitable for reading with tokenize () -- CEV
+ //
+ // if running on the client you need a different offset in the
+ // for loop (i = 1 on server, i = 0 on client) -- CEV
+ //--------------------------------------------------------------
+ void(void(string key, string value) init_field_fn)
+ base_mapentity_init_spawndata =
+ {
+ if (init_field_fn != __NULL__) {
+ if (__fullspawndata != __NULL__ && __fullspawndata != "")
+ {
+ for (float i = 1; i < (tokenize(__fullspawndata) - 1);
+ i += 2)
+ {
+ init_field_fn (argv(i), argv(i + 1));
+ }
+ __fullspawndata = "";
+ } }
+ };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) base_mapentity_init =
{
e.classgroup |= CG_MAPENTITY;
+ // TODO CEV placeholder
+ e.dimension_hit = DIMENSION_FLAG1;
+ e.dimension_solid = DIMENSION_FLAG1;
};
//--------------------------------------------------------------
@@ -1356,8 +2652,8 @@ void() noclass;
{
base_mapentity_init (self);
};
-// };
#endif
+// };
#ifdef SSQC
/*QUAKED noclass (0 0 0) (-8 -8 -8) (8 8 8)
Return to the top of this page or return to the overview of this repo.
Diff qc/base_func.qc
diff --git a/qc/base_func.qc b/qc/base_func.qc
index e75564a..616a968 100644
--- a/qc/base_func.qc
+++ b/qc/base_func.qc
@@ -7,36 +7,27 @@
//======================================================================
#if defined(CSQC) || defined(SSQC)
-const float FUNC_STATE_TOP = 0; // button, door, elevator states
-const float FUNC_STATE_BOTTOM = 1;
-const float FUNC_STATE_UP = 2;
-const float FUNC_STATE_DOWN = 3;
-#endif
-
-#if defined(CSQC) || defined(SSQC)
-const float BASE_FUNC_NET_ORIGIN = 1<<0;// origin has changed
-const float BASE_FUNC_NET_SIZE = 1<<1; // size (mins, maxs) has changed
-const float BASE_FUNC_NET_VELOCITY = 1<<2; // velocity has changed
-const float BASE_FUNC_NET_MODEL = 1<<3; // model has changed
-const float BASE_FUNC_NET_SPEED = 1<<4; // speed has changed
+//----------------------------------------------------------------------
+// func_ entity states, used for buttons & doors & plats -- CEV
+//----------------------------------------------------------------------
+typedef enum
+{
+ FUNC_STATE_TOP = 0,
+ FUNC_STATE_BOTTOM = 1,
+ FUNC_STATE_UP = 2,
+ FUNC_STATE_DOWN = 3
+} base_func_states;
#endif
//======================================================================
// fields
//======================================================================
-#ifdef CSQC
-.float movetime; // timestamp this func started moving
-.vector origin_start;
-#endif
-
-#if defined(CSQC) || defined(SSQC)
-.void() think1; // called by calcmove_done
-.vector finaldest, finalangle;
-#endif
-
#ifdef SSQC
.float lip; //
+.vector finaldest, finalangle;
+
+.void() think1; // called by calcmove_done
#endif
//======================================================================
@@ -45,15 +36,15 @@ const float BASE_FUNC_NET_SPEED = 1<<4; // speed has changed
// base_func
#ifdef CSQC
-void(float isnew, float netflags) base_func_netreceive_read;
-float() base_func_predraw_solidpush;
+// BASE_FUNC_NETRECEIVE(initfn)
+float() base_func_predraw;
#endif
#ifdef SSQC
-float(entity to, float netflags) base_func_netsend;
+void() base_func_neteval;
#endif
#ifdef SSQC
-void() sub_calcmove_done_think;
-void(entity e, vector tdest, float tspeed, void() newthink) sub_calcmove;
+void() base_func_calcmove_done;
+void(entity e, vector tdest, float tspeed, void() newthink) base_func_calcmove;
void() sub_calcanglemovecontroller_done;
void(entity e, vector destangle, float tspeed, void() func, entity c)
sub_calcanglemovecontroller;
@@ -76,136 +67,81 @@ strip void() base_func;
#ifdef CSQC
//--------------------------------------------------------------
- // returns a FUNC_STATE to be handled by the func's netreceive
- //--------------------------------------------------------------
- void(float isnew, float netflags) base_func_netreceive_read =
- {
- if (netflags & BASE_FUNC_NET_MODEL)
- self.modelindex = ReadFloat ();
-
- if (netflags & BASE_FUNC_NET_ORIGIN)
- {
- self.origin_x = ReadCoord ();
- self.origin_y = ReadCoord ();
- self.origin_z = ReadCoord ();
- }
-
- if (netflags & BASE_FUNC_NET_VELOCITY)
- {
- self.velocity_x = ReadCoord ();
- self.velocity_y = ReadCoord ();
- self.velocity_z = ReadCoord ();
- }
-
- if (netflags & BASE_FUNC_NET_SIZE)
- {
- self.mins_x = ReadCoord ();
- self.mins_y = ReadCoord ();
- self.mins_z = ReadCoord ();
- self.maxs_x = ReadCoord ();
- self.maxs_y = ReadCoord ();
- self.maxs_z = ReadCoord ();
- }
-
- if (netflags & BASE_FUNC_NET_SPEED)
- self.speed = ReadFloat ();
- };
+ #define BASE_FUNC_NETRECEIVE(initfn) \
+ /* { */ \
+ local float netflags = base_entity_netreceive (isnew); \
+ if (NETFLAG_BASE_ENTITY_FRAME) \
+ self.frame = self.frame_net; \
+ if (isnew && !(self.predraw)) \
+ { \
+ initfn (self); \
+ } \
+ else \
+ { \
+ if (netflags & NETFLAG_BASE_ENTITY_MODEL) { \
+ if (self.modelindex) \
+ { \
+ setmodelindex (self, self.modelindex); \
+ } } \
+ if (netflags & NETFLAG_BASE_ENTITY_SIZE) \
+ { \
+ setsize (self, self.mins, self.maxs); \
+ } \
+ /*
+ else if (netflags & NETFLAG_BASE_ENTITY_SOLID) \
+ { \
+ if (self.solid) \
+ setsize (self, self.mins, self.maxs); \
+ else \
+ setsize (self, '0 0 0', '0 0 0'); \
+ if (!(netflags & NETFLAG_BASE_ENTITY_ORIGIN)) \
+ setorigin (self, self.origin); \
+ } \
+ */ \
+ if (netflags & NETFLAG_BASE_ENTITY_ORIGIN) \
+ setorigin (self, self.origin); \
+ } \
+ /* } */
//--------------------------------------------------------------
- // manually move SOLID_BSP MOVETYPE_PUSH entities based on their
- // velocity and the timestamp of the last related server message.
- // interpolates and kinda- sorta- predicts the move. (hopefully.)
- // does not play well in (simulated) high ping environments.
- //
- // this took a really long time to figure out. -- CEV
- //--------------------------------------------------------------
- float() base_func_predraw_solidpush =
+ float() base_func_predraw =
{
- if (self.movetime)
- {
- // calculate new origin from the last origin
- // the server sent us, the rate we're moving,
- // and the timestamp of that server message.
- // this only works with entities that maintain
- // a constant velocity while moving -- CEV
- self.neworigin = self.origin_start + self.velocity *
- (time - self.movetime);
-
- // must be careful to handle speed = 0 -- CEV
- local float f;
- if (self.speed)
- f = bound (0, frametime * (self.speed*0.2), 1);
- else
- f = bound (0, frametime * 30, 1);
-
- // final origin is an interpolation of neworigin
- // above and the previous calculated origin -- CEV
- self.origin = self.oldorigin +
- ((self.neworigin - self.oldorigin) * f);
-
- // save off oldorigin -- CEV
- self.oldorigin = self.origin;
+ // func_ entities are (I hope) not changing frame often
+ // enough to need interpolation -- CEV
- /*
- dprint (sprintf("base_func_predraw_solidpush: "
- "entity %g, time %g, frametime %g, "
- "lerpfrac %g\n",
- self.entnum, time, frametime, f));
- */
+ // interpolate angles -- see base_entities.qc -- CEV
+ BASE_ENTITY_LERP_ANGLES (self,
+ self.angles_net, self.angles_prev, time,
+ self.angles_net_time, self.angles_prev_time)
- addentity (self);
+ // interpolate origin -- see base_entities.qc -- CEV
+ BASE_ENTITY_LERP_ORIGIN (self,
+ self.origin_net, self.origin_prev, time,
+ self.origin_net_time, self.origin_prev_time)
- // rewind to the last origin sent by the server
- // for collision detection -- CEV
- setorigin (self, self.origin_net);
- }
- else
- {
- addentity (self);
- }
+ // draw this entity -- CEV
+ addentity (self);
+ // rewind to last sent server position -- CEV
+ setorigin (self, self.origin_net);
+
+ // go to next without auto-drawing this entity -- CEV
return PREDRAW_NEXT;
};
#endif
#ifdef SSQC
//--------------------------------------------------------------
- float(entity to, float netflags) base_func_netsend =
+ // flag moving func_ entities to transmit origin -- CEV
+ //--------------------------------------------------------------
+ void() base_func_neteval =
{
- WriteShort (MSG_ENTITY, self.classtype);
- WriteFloat (MSG_ENTITY, netflags);
-
- if (netflags & BASE_FUNC_NET_MODEL)
- WriteFloat (MSG_ENTITY, self.modelindex);
-
- if (netflags & BASE_FUNC_NET_ORIGIN)
- {
- WriteCoord (MSG_ENTITY, self.origin_x);
- WriteCoord (MSG_ENTITY, self.origin_y);
- WriteCoord (MSG_ENTITY, self.origin_z);
- }
-
- if (netflags & BASE_FUNC_NET_VELOCITY)
+ if (!(self.SendFlags & NETFLAG_BASE_ENTITY_ORIGIN)) {
+ if (self.origin != self.origin_net)
{
- WriteCoord (MSG_ENTITY, self.velocity_x);
- WriteCoord (MSG_ENTITY, self.velocity_y);
- WriteCoord (MSG_ENTITY, self.velocity_z);
- }
-
- if (netflags & BASE_FUNC_NET_SIZE)
- {
- WriteCoord (MSG_ENTITY, self.mins_x);
- WriteCoord (MSG_ENTITY, self.mins_y);
- WriteCoord (MSG_ENTITY, self.mins_z);
- WriteCoord (MSG_ENTITY, self.maxs_x);
- WriteCoord (MSG_ENTITY, self.maxs_y);
- WriteCoord (MSG_ENTITY, self.maxs_z);
- }
-
- if (netflags & BASE_FUNC_NET_SPEED)
- WriteFloat (MSG_ENTITY, self.speed);
-
- return TRUE;
+ // flag this entity to transmit origin -- CEV
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
+ } }
};
#endif
@@ -215,12 +151,21 @@ strip void() base_func;
#ifdef SSQC
//--------------------------------------------------------------
- void() sub_calcmove_done_think =
+ void() base_func_calcmove_done =
{
setorigin (self, self.finaldest);
self.velocity = '0 0 0';
self.nextthink = -1;
+ #if 0
+ dprint (sprintf("base_func_calcmove_done: %s completed "
+ "at %g\n", self.classname, time));
+ #endif
+
+ // don't need custom physics anymore -- CEV
+ if (self.customphysics == base_entity_movetype_push)
+ self.customphysics = __NULL__;
+
if (self.think1)
self.think1 ();
};
@@ -229,24 +174,32 @@ strip void() base_func;
// SUB_CalcMove
//--------------------------------------------------------------
void(entity e, vector tdest, float tspeed, void() newthink)
- sub_calcmove =
+ base_func_calcmove =
{
local vector vdestdelta;
local float len, traveltime, localtime;
if (!tspeed)
- objerror ("sub_calcmove: No speed is defined!");
+ objerror ("base_func_calcmove: No speed is defined!");
if (e.movetype == MOVETYPE_PUSH)
- localtime = self.ltime;
+ {
+ localtime = e.ltime;
+
+ // use a custom movetype_push that will update
+ // SendFlags on this and nearby entities -- CEV
+ e.customphysics = base_entity_movetype_push;
+ }
else
+ {
localtime = time;
+ }
e.think1 = newthink;
e.finaldest = tdest;
- e.think = sub_calcmove_done_think;
+ e.think = base_func_calcmove_done;
- if (tdest == self.origin)
+ if (tdest == e.origin)
{
e.velocity = '0 0 0';
e.nextthink = localtime + 0.1;
@@ -254,7 +207,7 @@ strip void() base_func;
}
// set destdelta to the vector needed to move
- vdestdelta = tdest - self.origin;
+ vdestdelta = tdest - e.origin;
// calculate length of vector
len = vlen (vdestdelta);
@@ -346,9 +299,6 @@ strip void() base_func;
{
base_mapentity_init (e);
e.classgroup |= CG_FUNC;
-
- // TODO CEV
- e.flags |= FL_LAGGEDMOVE;
};
#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/base_gore.qc
diff --git a/qc/base_gore.qc b/qc/base_gore.qc
deleted file mode 100644
index 5e559df..0000000
--- a/qc/base_gore.qc
+++ /dev/null
@@ -1,584 +0,0 @@
-//==============================================================================
-// base_gore.qc -- corpses, gibs, heads. the meaty bits. -- CEV
-//==============================================================================
-
-//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-// Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds
-//
-// deadstuff version 1.0 - tony collen - manero@canweb.net -
-// EfNet IRC #QuakeEd or #Trinity
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-
-//======================================================================
-// constants
-//======================================================================
-
-#ifdef SSQC
-const float GIB_SOLID = 1; // spawnflags: solid
-const float GIB_DYNAMIC = 2; // non-static, moveable gibs
-
-const float CORPSE_HEALTH = 30; // static corpse health
-
-const vector GIB_1_MINS = '-3.57 -8.06 -3.34';
-const vector GIB_1_MAXS = '3.69 8.31 30';
-const vector GIB_2_MINS = '-12.68 -14.83 -6.19';
-const vector GIB_2_MAXS = '13.53 14.57 30';
-const vector GIB_3_MINS = '-18.95 -15.92 -3.13';
-const vector GIB_3_MAXS = '13.17 15.66 30';
-#endif
-
-//======================================================================
-// forward declarations
-//======================================================================
-
-#ifdef SSQC
-void(vector org, vector vel, float damage) spawn_blood;
-void(float damage) spawn_touchblood;
-void(vector org, vector vel) spawn_chunk;
-entity(vector org, vector vel) spawn_meatspray;
-vector(vector dir, float dmg) velocity_for_damage;
-#endif
-
-#ifdef SSQC
-// base_corpse
-void(entity e, float corpse_health) become_base_corpse;
-void(entity e) base_corpse_init;
-strip void() base_corpse;
-#endif
-
-#ifdef SSQC
-// base_gib
-void() base_gib_touch;
-entity(entity src, vector org, vector vel, float sflags, .string gibfield,
- void(entity) initfn) spawn_base_gib;
-void(entity e) base_gib_init;
-strip void() base_gib;
-#endif
-
-#ifdef SSQC
-// gib_misc_1
-void(entity src, vector dir, float dmg) throw_gib_1;
-entity(entity src, vector org, vector vel, float sflags) spawn_gib_misc_1;
-void(entity e) gib_misc_1_init;
-void() gib_misc_1;
-#endif
-
-#ifdef SSQC
-// gib_misc_2
-void(entity src, vector dir, float dmg) throw_gib_2;
-entity(entity src, vector org, vector vel, float sflags) spawn_gib_misc_2;
-void(entity e) gib_misc_2_init;
-void() gib_misc_2;
-#endif
-
-#ifdef SSQC
-// gib_misc_3
-void(entity src, vector dir, float dmg) throw_gib_3;
-entity(entity src, vector org, vector vel, float sflags) spawn_gib_misc_3;
-void(entity e) gib_misc_3_init;
-void() gib_misc_3;
-#endif
-
-#ifdef SSQC
-// base_gib_head
-void(entity e, vector dir, float dmg, void(entity e) initfn)
- base_gib_head_throw;
-void(entity e) base_gib_head_init;
-strip void() base_gib_head;
-#endif
-
-//------------------------------------------------------------------------------
-
-#ifdef SSQC
-//----------------------------------------------------------------------
-// SpawnBlood
-//----------------------------------------------------------------------
-void(vector org, vector vel, float damage) spawn_blood =
-{
- particle (org, vel * 0.1, 73, damage * 2);
-};
-
-//----------------------------------------------------------------------
-// spawn_touchblood
-//----------------------------------------------------------------------
-void(float damage) spawn_touchblood =
-{
- // wall_velocity
- local vector vel;
-
- vel = normalize (self.velocity);
- vel = normalize (vel + v_up * (random() - 0.5) +
- v_right * (random() - 0.5));
- // TODO CEV when was the last time a trace was called?
- vel = vel + 2 * trace_plane_normal;
- vel = (vel * 200) * 0.2;
-
- spawn_blood (self.origin + vel * 0.01, vel, damage);
-};
-
-//----------------------------------------------------------------------
-// SpawnChunk
-//----------------------------------------------------------------------
-void(vector org, vector vel) spawn_chunk =
-{
- particle (org, vel * 0.02, 0, 10);
-};
-
-//----------------------------------------------------------------------
-// SpawnMeatSpray
-//----------------------------------------------------------------------
-entity(vector org, vector vel) spawn_meatspray =
-{
- // reusing the "zombiechunk" projectile -- CEV
- local entity e = spawn_projectile_zombiechunk (self, org, vel);
- // override some defaults, notably solid and force damage to 0 -- CEV
- e.solid = SOLID_NOT;
- e.direct_damage = 0;
- e.velocity_z += 250 + 50 * random ();
- e.nextthink = time + 1;
- return e;
-};
-
-//----------------------------------------------------------------------
-vector(vector dir, float dmg) velocity_for_damage =
-{
- // local vector startdir = dir;
- local vector v;
-
- // next three lines original id1 behavior -- CEV
- v_x = 100 * crandom ();
- v_y = 100 * crandom ();
- v_z = 200 + 100 * random ();
- // damage response scaling from Alkaline, presumably by bmFbr -- CEV
- v *= max (1, min(10, dmg * dmg / 5000));
-
- if (dir != '0 0 0')
- {
- // directional gib behavior from Alkaline (which appears to
- // be by bmFbr according to the commit log, see Alkaline
- // commit 083f87c18a2d2be645ba197c1f23fc6533afca81).
- // dir is set by killed () and is already normalized -- CEV
- dir *= bound (10, dmg * dmg / 22, 800);
- dir_x *= 2.5;
- dir_y *= 2.5;
- dir_z *= 0.7;
- v += dir;
- }
-
- // velocity limiting code again from Alkaline and written by bmFbr.
- // I'm leaning on Alkaline here and above because the implementation
- // I came up with was way worse. -- CEV
- local float vspeed = vlen (v);
- if (vspeed > 500)
- v *= 500 / vspeed;
- v_z = min (500, v_z);
-
- // dprint (sprintf("velocity_for_damage: damage is %g, startdir is %v, "
- // "v is %v\n", dmg, startdir, v));
-
- return v;
-};
-#endif
-
-#ifdef SSQC
-//----------------------------------------------------------------------
-// Corpse base class, used for both converting dead monsters into corpses
-// and for DeadStuff mod mapper-placeable corpses -- CEV
-//----------------------------------------------------------------------
-// class base_corpse: base_mapentity
-// {
- //--------------------------------------------------------------
- // Convert an entity into a shootable corpse. Call at the end of
- // a monster's death think. Uses FTE's SOLID_CORPSE. Inspired by
- // / based on Kryten's gibbable corpse tutorial found at
- // https://www.insideqc.com/qctut/qctut-33.shtml -- CEV
- //--------------------------------------------------------------
- void(entity e, float corpse_health) become_base_corpse =
- {
- e.classgroup |= CG_CORPSE;
-
- // set up trigger interaction
- e.flags &= ~FL_MONSTER;
- if (corpse_health)
- e.health = corpse_health;
- else
- e.health = CORPSE_HEALTH;
- // e.movetype = MOVETYPE_STEP;
- e.solid = SOLID_CORPSE;
- e.takedamage = DAMAGE_YES;
-
- // clear targets
- e.killtarget = e.killtarget2 = __NULL__;
- e.pain_target = __NULL__;
- e.target = e.target2 = e.target3 = e.target4 = __NULL__;
-
- // clear everything but destroy
- // leave e.destroy alone, the existing destroy will handle it
- e.th_pain = sub_nullpain;
- // leave e.think alone so e's animation can finish
- e.touch = sub_null;
- e.use = sub_null;
-
- // clear monster think functions
- e.th_melee = sub_null;
- e.th_missile = sub_null;
- e.th_run = sub_null;
- e.th_stand = sub_null;
- e.th_turret = sub_null;
- e.th_walk = sub_null;
- };
-
- //--------------------------------------------------------------
- void(entity e) base_corpse_init =
- {
- base_mapentity_init (e);
- e.classgroup |= CG_CORPSE;
-
- if (e.spawnflags & GIB_SOLID)
- e.solid = SOLID_BBOX;
- else
- e.solid = SOLID_NOT;
- };
-
- //--------------------------------------------------------------
- strip void() base_corpse =
- {
- base_corpse_init (self);
- };
-// };
-#endif
-
-#ifdef SSQC
-//----------------------------------------------------------------------
-// class base_gib: base_mapentity
-// {
- //--------------------------------------------------------------
- // Inspired by Ivana Gibson's kickable gibs [1] and similar
- // functions found in other mods (Scarlet, etc) -- CEV
- // [1]: https://www.insideqc.com/qctut/lesson-52.shtml
- //--------------------------------------------------------------
- void() base_gib_touch =
- {
- // only run if the object has come to rest -- CEV
- if (self.velocity)
- return;
-
- // only run if touched by a player or monster -- CEV
- if (other.classtype != CT_PLAYER && !(other.flags & FL_MONSTER))
- return;
-
- // only run if other is moving fast enough to disturb
- // stationary objects -- CEV
- if (other.classtype == CT_PLAYER && other.speed < 200)
- return;
-
- // push self horizontally according to other's direction and
- // speed, maximum of 160ups -- CEV
- base_entity_push (self, other, PM_MAXSPEED * 0.5);
-
- if (self.avelocity_y == 0)
- // a little spin, as a treat. Rotating in the other
- // axes seem to cause gibs to move into the floor -- CEV
- self.avelocity_y = 100 * crandom ();
- };
-
- //--------------------------------------------------------------
- entity(entity src, vector org, vector vel, float sflags,
- .string gibfield, void(entity) initfn) spawn_base_gib =
- {
- local entity e = spawn ();
- e.owner = src;
- e.spawnflags = sflags;
- e.origin = org;
- e.velocity = vel;
- if (src.gibfield && src.gibfield != "")
- e.gibfield = src.gibfield;
- initfn (e);
- return e;
- };
-
- //--------------------------------------------------------------
- void(entity e) base_gib_init =
- {
- if (!(e.flags & FL_CLIENT))
- base_mapentity_init (e);
-
- e.classgroup |= CG_CORPSE;
-
- // if we're converting an existing entity and it has a destroy
- // function make sure that destroy func is sub_null -- CEV
- if (e.destroy)
- e.destroy = sub_nulldestroy;
-
- if (e.spawnflags & GIB_SOLID)
- {
- e.solid = SOLID_BBOX;
- }
- else if (e.spawnflags & GIB_DYNAMIC)
- {
- e.movetype = MOVETYPE_BOUNCE;
- e.takedamage = DAMAGE_NO;
- e.solid = SOLID_TRIGGER;
- e.touch = base_gib_touch;
- if (e.flags & FL_CLIENT)
- e.flags = e.flags - (e.flags & FL_ONGROUND);
- else
- e.flags = 0;
- }
- else
- {
- e.solid = SOLID_NOT;
- }
- };
-
- strip void() base_gib =
- {
- base_gib_init (self);
- };
-// };
-#endif
-
-#ifdef SSQC
-/*QUAKED gib_misc_1 (0 0.5 0.8) (-8 -8 -8) (8 8 8) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/gib1.mdl");
-}*/
-//----------------------------------------------------------------------
-// class gib_misc_1: base_gib
-// {
- //--------------------------------------------------------------
- // 'self' in this context is the thing being gibbed -- CEV
- //--------------------------------------------------------------
- void(entity src, vector dir, float dmg) throw_gib_1 =
- {
- local entity e = spawn_gib_misc_1 (src, src.origin + '0 0 24',
- velocity_for_damage(dir, dmg), GIB_DYNAMIC);
- e.avelocity_x = random() * 600;
- e.avelocity_y = random() * 600;
- e.avelocity_z = random() * 600;
- e.alpha = 1.0;
- e.think = sub_remove_fade;
- e.ltime = time;
- e.nextthink = time + 10 + random() * 10;
- };
-
- //--------------------------------------------------------------
- entity(entity src, vector org, vector vel, float sflags)
- spawn_gib_misc_1 =
- {
- return spawn_base_gib (src, org, vel, sflags, mdl_gib2,
- gib_misc_1_init);
- };
-
-
- //--------------------------------------------------------------
- void(entity e) gib_misc_1_init =
- {
- e.classname = "gib_misc_1";
- e.classtype = CT_GORE_GIB1;
-
- // this will set e.solid
- base_gib_init (e);
-
- if (e.mdl_gib1 != "")
- {
- precache_model (e.mdl_gib1);
- setmodel (e, e.mdl_gib1);
- }
- else
- {
- precache_model ("progs/gib1.mdl");
- setmodel (e, "progs/gib1.mdl");
- if (e.solid == SOLID_BBOX || e.solid == SOLID_TRIGGER)
- setsize (e, GIB_1_MINS, GIB_1_MAXS);
- }
-
- e.frame = 0;
- };
-
- //--------------------------------------------------------------
- void() gib_misc_1 =
- {
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- gib_misc_1_init (self);
- };
-// };
-#endif
-
-#ifdef SSQC
-/*QUAKED gib_misc_2 (0 0.5 0.8) (-8 -8 -8) (8 8 8) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/gib2.mdl");
-}*/
-//----------------------------------------------------------------------
-// class gib_misc_2: base_gib
-// {
- //--------------------------------------------------------------
- // 'self' in this context is the thing being gibbed -- CEV
- //--------------------------------------------------------------
- void(entity src, vector dir, float dmg) throw_gib_2 =
- {
- local entity e = spawn_gib_misc_2 (src, src.origin + '0 0 24',
- velocity_for_damage(dir, dmg), GIB_DYNAMIC);
- e.avelocity_x = random() * 600;
- e.avelocity_y = random() * 600;
- e.avelocity_z = random() * 600;
- e.alpha = 1.0;
- e.think = sub_remove_fade;
- e.ltime = time;
- e.nextthink = time + 10 + random() * 10;
- };
-
- //--------------------------------------------------------------
- entity(entity src, vector org, vector vel, float sflags)
- spawn_gib_misc_2 =
- {
- return spawn_base_gib (src, org, vel, sflags, mdl_gib2,
- gib_misc_2_init);
- };
-
- //--------------------------------------------------------------
- void(entity e) gib_misc_2_init =
- {
- e.classname = "gib_misc_2";
- e.classtype = CT_GORE_GIB2;
-
- // this will set e.solid
- base_gib_init (e);
-
- if (e.mdl_gib2 != "")
- {
- precache_model (e.mdl_gib2);
- setmodel (e, e.mdl_gib2);
- }
- else
- {
- precache_model ("progs/gib2.mdl");
- setmodel (e, "progs/gib2.mdl");
- if (e.solid == SOLID_BBOX || e.solid == SOLID_TRIGGER)
- setsize (e, GIB_2_MINS, GIB_2_MAXS);
- }
-
- e.frame = 0;
- };
-
- //--------------------------------------------------------------
- void() gib_misc_2 =
- {
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- gib_misc_2_init (self);
- };
-// };
-#endif
-
-#ifdef SSQC
-/*QUAKED gib_misc_3 (0 0.5 0.8) (-8 -8 -8) (8 8 8) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/gib3.mdl");
-}*/
-//----------------------------------------------------------------------
-// class gib_misc_3: base_gib
-// {
- //--------------------------------------------------------------
- // 'self' in this context is the thing being gibbed -- CEV
- //--------------------------------------------------------------
- void(entity src, vector dir, float dmg) throw_gib_3 =
- {
- local entity e = spawn_gib_misc_3 (src, src.origin + '0 0 24',
- velocity_for_damage(dir, dmg), GIB_DYNAMIC);
- e.avelocity_x = random() * 600;
- e.avelocity_y = random() * 600;
- e.avelocity_z = random() * 600;
- e.alpha = 1.0;
- e.think = sub_remove_fade;
- e.ltime = time;
- e.nextthink = time + 10 + random() * 10;
- };
-
- //--------------------------------------------------------------
- entity(entity src, vector org, vector vel, float sflags)
- spawn_gib_misc_3 =
- {
- return spawn_base_gib (src, org, vel, sflags, mdl_gib3,
- gib_misc_3_init);
- };
-
- //--------------------------------------------------------------
- void(entity e) gib_misc_3_init =
- {
- e.classname = "gib_misc_3";
- e.classtype = CT_GORE_GIB3;
-
- // this will set e.solid
- base_gib_init (e);
-
- if (e.mdl_gib3 != "")
- {
- precache_model (e.mdl_gib3);
- setmodel (e, e.mdl_gib3);
- }
- else
- {
- precache_model ("progs/gib3.mdl");
- setmodel (e, "progs/gib3.mdl");
- if (e.solid == SOLID_BBOX || e.solid == SOLID_TRIGGER)
- setsize (e, GIB_3_MINS, GIB_3_MAXS);
- }
-
- e.frame = 0;
- };
-
- //--------------------------------------------------------------
- void() gib_misc_3 =
- {
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- gib_misc_3_init (self);
- };
-// };
-#endif
-
-#ifdef SSQC
-//----------------------------------------------------------------------
-// class base_gib_head: base_gib
-// {
- //--------------------------------------------------------------
- // ThrowHead
- //--------------------------------------------------------------
- void(entity e, vector dir, float dmg, void(entity e) initfn)
- base_gib_head_throw =
- {
- e.skin = e.skin_head;
- e.nextthink = -1;
- e.spawnflags = GIB_DYNAMIC;
- e.view_ofs = '0 0 8';
-
- e.origin_z = e.origin_z - 24;
- e.avelocity = crandom() * '0 600 0';
- e.velocity = velocity_for_damage (dir, dmg);
-
- if (initfn)
- initfn (e);
- };
-
- //--------------------------------------------------------------
- void(entity e) base_gib_head_init =
- {
- base_gib_init (e);
- };
-
- //--------------------------------------------------------------
- strip void() base_gib_head =
- {
- base_gib_head_init (self);
- };
-// };
-#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/base_item.qc
diff --git a/qc/base_item.qc b/qc/base_item.qc
index d85ecc7..6919253 100644
--- a/qc/base_item.qc
+++ b/qc/base_item.qc
@@ -7,37 +7,42 @@
//======================================================================
#ifdef SSQC
-const float ITEM_SPAWNSILENT = 32; // item spawnflags
-const float ITEM_SPAWNED = 64;
-const float ITEM_SUSPENDED = 128;
-const float ITEM_RESPAWNDM = 16384;
-const float ITEM_DONTDROP = 8388608;
+//----------------------------------------------------------------------
+// base item spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_ITEM_SPAWNSILENT = 32,// item won't make sound when spawning
+ SPAWNFLAG_ITEM_SPAWNED = 64,
+ SPAWNFLAG_ITEM_SUSPENDED = 128,
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+ SPAWNFLAG_ITEM_RESPAWN = 2097152,// respawn
+ SPAWNFLAG_ITEM_THROWN = 4194304, // item was thrown
+ SPAWNFLAG_ITEM_DONTDROP = 8388608 // last flag! don't drop to the ground
+} base_item_spawnflags;
+#endif
+#ifdef SSQC
const float ITEM_ALPHA_WAITSPAWN = 0.00001; // alpha values (respawn feedback)
const float ITEM_ALPHA_NEARSPAWN = 0.2;
const float ITEM_ALPHA_OPAQUE = 1.0;
-const string ITEM_SOUND_SPAWN = "items/respawn.ogg";
+const string ITEM_SOUND_SPAWN = "cev/items/respawn.ogg";
#endif
//======================================================================
// fields
//======================================================================
-// Supa, Quoth respawning items support
-//
-// Respawn item like in DM if 'ritem' TRUE, override respawn time
-// with 'respawndelay' if set, inc 'cnt' with each respawn and if
-// 'respawncount' is set we'll remove the item if cnt > respawncount
-// remember that SUB_Regen is already set on every item that can
-// respawn, all we need to do is give a nextthink time in order
-// to trigger it
-
#ifdef SSQC
-.float ritem; // legacy SP item respawn flag
-.float respawndelay; // legacy SP respawn delay
-.float respawncount; // legacy SP respawn limit
-
.vector particles_offset;
#endif
@@ -45,15 +50,36 @@ const string ITEM_SOUND_SPAWN = "items/respawn.ogg";
// forward declarations
//======================================================================
+// base_item
+#ifdef CSQC
+// BASE_ITEM_NETRECEIVE(initfn)
+float() base_item_predraw;
+#endif
+#ifdef SSQC
+void() base_item_neteval;
+#endif
#ifdef SSQC
+// BASE_ITEM_INVENTORY_ADD(from, to)
+// BASE_ITEM_INVENTORY_REMOVE(holder)
+// BASE_ITEM_PICKUPMESSAGE(p, i, chan)
+// BASE_ITEM_CHECKREMOVE(bic_item, sp_wait, dm_wait)
+// BASE_ITEM_THROW_ROTATION(ent, item)
void(entity actor) base_item_drop_stuff;
+float() base_item_touch_projectile;
float(entity item, float delay_sp, float delay_dm) base_item_check_respawn;
void() base_item_think_respawn;
void() base_item_think_nearspawn;
void() base_item_think_rhull;
+void() base_item_think_throwgroundcheck;
void() base_item_think_place;
void() base_item_use_delayspawn;
+// BASE_ITEM_PREINIT(func)
+void(string key, string value) base_item_init_field;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) base_item_init;
+#endif
+#ifdef SSQC
strip void() base_item;
#endif
@@ -62,7 +88,214 @@ strip void() base_item;
//----------------------------------------------------------------------
// class base_item: base_mapentity
// {
+ //==============================================================
+ // Generic item networking -- CEV
+ //==============================================================
+
+#ifdef CSQC
+ //--------------------------------------------------------------
+ #define BASE_ITEM_NETRECEIVE(initfn) \
+ /* { */ \
+ local float netflags = base_entity_netreceive (isnew); \
+ if (NETFLAG_BASE_ENTITY_FRAME) \
+ { \
+ self.frame = self.frame_net; \
+ } \
+ if (isnew && !(self.predraw)) \
+ { \
+ initfn (self); \
+ } \
+ else \
+ { \
+ if (netflags & NETFLAG_BASE_ENTITY_MODEL) \
+ { \
+ setmodelindex (self, self.modelindex); \
+ } \
+ if (netflags & NETFLAG_BASE_ENTITY_SOLID) \
+ { \
+ if (self.solid) \
+ { \
+ if (self.pos1 || self.pos2) \
+ setsize (self, self.pos1, \
+ self.pos2); \
+ else \
+ setsize (self, self.mins, \
+ self.maxs); \
+ } \
+ else \
+ { \
+ setsize (self, '0 0 0', '0 0 0'); \
+ } \
+ } \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ float() base_item_predraw =
+ {
+ // skip invisible entities -- CEV
+ if (!self.modelindex)
+ return PREDRAW_NEXT;
+
+ if (self.modelflags & MF_ROTATE)
+ {
+ // this item is flagged to automatically rotate -- CEV
+ // rotation formula from Nuclide -- CEV
+ self.angles.y += frametime * 120.0f;
+ // wrap angles -- CEV
+ if (self.angles.y > 180)
+ self.angles.y -= 360;
+ else if (self.angles.y < -180)
+ self.angles.y += 360;
+ }
+ else
+ {
+ // interpolate angles -- see base_entities.qc -- CEV
+ BASE_ENTITY_LERP_ANGLES (self,
+ self.angles_net, self.angles_prev, time,
+ self.angles_net_time, self.angles_prev_time)
+ }
+
+ // interpolate origin -- see base_entities.qc -- CEV
+ BASE_ENTITY_LERP_ORIGIN (self,
+ self.origin_net, self.origin_prev, time,
+ self.origin_net_time, self.origin_prev_time)
+
+ // draw this entity -- CEV
+ addentity (self);
+
+ setorigin (self, self.origin_net);
+
+ // go to next without auto-drawing this entity -- CEV
+ return PREDRAW_NEXT;
+ };
+#endif
+
#ifdef SSQC
+ //--------------------------------------------------------------
+ void() base_item_neteval =
+ {
+ if (!(self.SendFlags & NETFLAG_BASE_ENTITY_ORIGIN))
+ {
+ if (self.origin != self.origin_net)
+ {
+ // client needs updated origin -- CEV
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
+ }
+ }
+
+ if (!(self.SendFlags & NETFLAG_BASE_ENTITY_ANGLES))
+ {
+ if (self.angles != self.angles_net)
+ {
+ // client needs updated angles -- CEV
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ANGLES;
+ }
+ }
+ };
+#endif
+
+ //==============================================================
+ // Macros
+ //==============================================================
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ #define BASE_ITEM_INVENTORY_ADD(from, to) \
+ /* { */ \
+ switch (to.weapon) \
+ { \
+ case 1: to.inventory1 = from.weapon; break; \
+ case 2: to.inventory2 = from.weapon; break; \
+ case 3: to.inventory3 = from.weapon; break; \
+ case 4: to.inventory4 = from.weapon; break; \
+ case 5: to.inventory5 = from.weapon; break; \
+ case 6: to.inventory6 = from.weapon; break; \
+ case 7: to.inventory7 = from.weapon; break; \
+ case 8: to.inventory8 = from.weapon; break; \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ITEM_INVENTORY_REMOVE(holder) \
+ /* { */ \
+ switch (holder.weapon) \
+ { \
+ case 1: holder.inventory1 = ITEM_SEQ_HANDS; break; \
+ case 2: holder.inventory2 = ITEM_SEQ_HANDS; break; \
+ case 3: holder.inventory3 = ITEM_SEQ_HANDS; break; \
+ case 4: holder.inventory4 = ITEM_SEQ_HANDS; break; \
+ case 5: holder.inventory5 = ITEM_SEQ_HANDS; break; \
+ case 6: holder.inventory6 = ITEM_SEQ_HANDS; break; \
+ case 7: holder.inventory7 = ITEM_SEQ_HANDS; break; \
+ case 8: holder.inventory8 = ITEM_SEQ_HANDS; break; \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define BASE_ITEM_PICKUPMESSAGE(p, i, chan) \
+ /* { */ \
+ /* item touch message */ \
+ sprint (p, sprintf("%s got the %s!\n", p.netname, i.name)); \
+ /* item touch sound */ \
+ sound (p, chan, i.pickup_sound, i.pickup_vol, ATTN_NORM); \
+ /* item touch screenflash */ \
+ stuffcmd (p, "bf\n"); \
+ /* } */
+
+ //--------------------------------------------------------------
+ // check if we need to respawn the item; remove if not -- CEV
+ //--------------------------------------------------------------
+ #define BASE_ITEM_CHECKREMOVE(bic_item, sp_wait, dm_wait) \
+ /* { */ \
+ /* make sure the item exists before proceeding -- CEV */ \
+ if (bic_item) \
+ { \
+ bic_item.model = __NULL__; \
+ bic_item.solid = SOLID_NOT; \
+ setmodel (bic_item, bic_item.model); \
+ bic_item.SendFlags |= NETFLAG_BASE_ENTITY_MODEL | \
+ NETFLAG_BASE_ENTITY_SOLID; \
+ /* Supa, SP respawning items support */ \
+ if (bic_item.spawnflags & SPAWNFLAG_ITEM_THROWN) \
+ { \
+ /* remove thrown items after pickup -- CEV */ \
+ bic_item.touch = sub_null; \
+ bic_item.think = sub_remove; \
+ bic_item.nextthink = time + 0.2; \
+ } \
+ else if (base_item_check_respawn(bic_item, \
+ sp_wait, dm_wait)) \
+ { \
+ /* clear to remove this item -- CEV */ \
+ bic_item.touch = sub_null; \
+ bic_item.think = sub_remove; \
+ bic_item.nextthink = time + 0.2; \
+ } \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ // set up rotation for thrown items -- CEV
+ //--------------------------------------------------------------
+ #define BASE_ITEM_THROW_ROTATION(ent, item) \
+ /* { */ \
+ if (ent.spawnflags & SPAWNFLAG_ITEM_THROWN && ent.owner) \
+ { \
+ local float ay; \
+ /* TODO CEV simplify this */ \
+ ay = ent.owner.angles.y + item.view_angles_offset.y; \
+ ay = ay - 360.0f * rint(ay / 360.0f); \
+ ay = ay - 180.0f * rint(ay / 180.0f); \
+ ay = ay - 90.0f * rint(ay / 90.0f); \
+ ent.angles.y = ay; \
+ if (ent.angles.y > 0) \
+ ent.avelocity_y = -60; \
+ else \
+ ent.avelocity_y = 60; \
+ } \
+ /* } */
+
//==============================================================
// Static Helper Functions
//==============================================================
@@ -88,46 +321,46 @@ strip void() base_item;
// drop nothing
break;
case 1:
- item_key1_drop (self);
+ item_key1_drop (actor);
break;
case 2:
- item_key2_drop (self);
+ item_key2_drop (actor);
break;
case 3:
- item_health_vial_drop (self);
+ item_health_vial_drop (actor);
break;
case 4:
- item_armor_shard_drop (self);
+ item_armor_shard_drop (actor);
break;
case 5:
- item_health_vial_drop (self);
- item_armor_shard_drop (self);
+ item_health_vial_drop (actor);
+ item_armor_shard_drop (actor);
break;
case 6:
local float rand_drop = rint(random() * 3);
if (rand_drop == 1)
{
- item_armor_shard_drop (self);
- item_health_vial_drop (self);
- item_health_vial_drop (self);
+ item_armor_shard_drop (actor);
+ item_health_vial_drop (actor);
+ item_health_vial_drop (actor);
}
else if (rand_drop == 2)
{
- item_armor_shard_drop (self);
- item_armor_shard_drop (self);
- item_health_vial_drop (self);
+ item_armor_shard_drop (actor);
+ item_armor_shard_drop (actor);
+ item_health_vial_drop (actor);
}
else if (rand_drop == 0)
{
- item_armor_shard_drop (self);
- item_armor_shard_drop (self);
- item_armor_shard_drop (self);
+ item_armor_shard_drop (actor);
+ item_armor_shard_drop (actor);
+ item_armor_shard_drop (actor);
}
else
{
- item_health_vial_drop (self);
- item_health_vial_drop (self);
- item_health_vial_drop (self);
+ item_health_vial_drop (actor);
+ item_health_vial_drop (actor);
+ item_health_vial_drop (actor);
}
break;
default:
@@ -137,6 +370,75 @@ strip void() base_item;
}
};
+ //--------------------------------------------------------------
+ float() base_item_touch_projectile =
+ {
+ if (self.spawnflags & SPAWNFLAG_ITEM_THROWN) {
+ if (!(self.flags & FL_ONGROUND)) {
+ if (self.solid == SOLID_SLIDEBOX)
+ {
+ // this is a thrown item that's currently SOLID_SLIDEBOX
+ // (and so probably airborne). do some typical
+ // projectile checks -- CEV
+ local float pc = pointcontents (self.origin);
+ if (pc == CONTENT_SKY)
+ {
+ dprint (sprintf("base_item_touch_projectile: "
+ "%s in the sky!\n",
+ self.classname));
+ base_entity_remove (self);
+ return TRUE;
+ }
+ else if (pc == CONTENT_SOLID)
+ {
+ dprint (sprintf("base_item_touch_projectile: "
+ "%s within a solid!\n",
+ self.classname));
+ base_entity_remove (self);
+ return TRUE;
+ }
+
+ if (other.solid == SOLID_BSP)
+ {
+ dprint (sprintf("base_item_touch_projectile: "
+ "hit %s, vel %v!\n",
+ other.classname, self.velocity));
+
+ if (other.classtype == CT_WORLD) {
+ if (self.velocity_z < 0)
+ {
+ base_entity_aligntoground (self);
+ } }
+
+ if (self.flags & FL_ONGROUND)
+ self.velocity = '0 0 0';
+ else
+ self.velocity = [
+ self.velocity_x * 0.5,
+ self.velocity_y * 0.5,
+ self.velocity_z];
+ }
+
+ if (other != self.owner) {
+ if (!(self.flags & FL_ONGROUND)) {
+ if (other.takedamage) {
+ if (time >= self.attack_finished) {
+ if (self.dmg)
+ {
+ // we're airbone for sure and hit something
+ // that takes damage. do the thing. -- CEV
+ self.attack_finished = time + 0.5;
+ spawn_touchblood (self.dmg);
+ t_damage2 (other, self, self.owner, self.dmg);
+ } } } } }
+
+ // skip all other checks if we're still solid
+ // at this point -- CEV
+ return TRUE;
+ } } }
+ return FALSE;
+ };
+
//==============================================================
// Subs
//==============================================================
@@ -153,53 +455,60 @@ strip void() base_item;
if (delay_dm > 5.0)
{
item.alpha = ITEM_ALPHA_WAITSPAWN;
+ item.SendFlags |= NETFLAG_BASE_ENTITY_ALPHA;
item.think = base_item_think_nearspawn;
item.nextthink = time + delay_dm - 5.0;
}
else
{
item.alpha = ITEM_ALPHA_NEARSPAWN;
+ item.SendFlags |= NETFLAG_BASE_ENTITY_ALPHA;
item.nextthink = time + delay_dm;
}
item.nextthink = time + delay_dm;
setmodel (item, item.mdl);
- return TRUE;
+ return FALSE;
}
if (deathmatch)
{
dprint (sprintf("base_item_check_respawn: unhandled "
"deathmatch state %f\n", deathmatch));
- return FALSE;
+ return TRUE;
}
// Supa, SP respawning items support
- // respawn item if true, otherwise abort
- if (!item.ritem)
- return FALSE;
+ // respawn item if flagged, otherwise abort
+ if (!(item.spawnflags & SPAWNFLAG_ITEM_RESPAWN) ||
+ item.wait == -1)
+ {
+ return TRUE;
+ }
// inc before check to account for zero indexing
item.cnt = item.cnt + 1;
// limited respawns
- if (item.respawncount && item.respawncount < item.cnt)
- return FALSE;
+ if (item.count && item.count < item.cnt)
+ return TRUE;
// okay, we're clear to set up a respawn
- if (item.respawndelay)
+ if (item.wait)
{
// custom respawn delay
- if (item.respawndelay > 5.0)
+ if (item.wait > 5.0)
{
item.alpha = ITEM_ALPHA_WAITSPAWN;
+ item.SendFlags |= NETFLAG_BASE_ENTITY_ALPHA;
item.think = base_item_think_nearspawn;
- item.nextthink = time + item.respawndelay - 5.0;
+ item.nextthink = time + item.wait - 5.0;
}
else
{
item.alpha = ITEM_ALPHA_NEARSPAWN;
- item.nextthink = time + item.respawndelay;
+ item.SendFlags |= NETFLAG_BASE_ENTITY_ALPHA;
+ item.nextthink = time + item.wait;
}
}
else
@@ -207,18 +516,20 @@ strip void() base_item;
if (delay_sp > 5.0)
{
item.alpha = ITEM_ALPHA_WAITSPAWN;
+ item.SendFlags |= NETFLAG_BASE_ENTITY_ALPHA;
item.think = base_item_think_nearspawn;
item.nextthink = time + delay_sp - 5.0;
}
else
{
item.alpha = ITEM_ALPHA_NEARSPAWN;
+ item.SendFlags |= NETFLAG_BASE_ENTITY_ALPHA;
item.nextthink = time + delay_sp;
}
}
setmodel (item, item.mdl);
- return TRUE;
+ return FALSE;
};
//==============================================================
@@ -233,20 +544,25 @@ strip void() base_item;
// restore original model
self.model = self.mdl;
self.alpha = ITEM_ALPHA_OPAQUE;
+ setmodel (self, self.model);
// allow it to be touched again
self.solid = SOLID_TRIGGER;
+ self.flags |= FL_FINDABLE_NONSOLID;
+
+ // guarantee size -- CEV
+ if (self.pos1 || self.pos2)
+ setsize (self, self.pos1, self.pos2);
+
+ // relink -- CEV
+ setorigin (self, self.origin);
// new respawning effects -- CEV
sound (self, CHAN_VOICE, ITEM_SOUND_SPAWN, VOL_HIGH, ATTN_NORM);
- setorigin (self, self.origin);
- /*
- dprint (sprintf("base_item_think_respawn: pos1 %v pos2 %v\n",
- self.pos1, self.pos2));
- */
- if (self.pos1 || self.pos2)
- setsize (self, self.pos1, self.pos2);
+ // make sure the client knows -- CEV
+ self.SendFlags |= NETFLAG_BASE_ENTITY_MODEL |
+ NETFLAG_BASE_ENTITY_SOLID | NETFLAG_BASE_ENTITY_ALPHA;
};
//--------------------------------------------------------------
@@ -254,6 +570,7 @@ strip void() base_item;
{
// bump alpha when 5s remain -- CEV
self.alpha = ITEM_ALPHA_NEARSPAWN;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ALPHA;
self.think = base_item_think_respawn;
self.nextthink = time + 5.0;
};
@@ -273,6 +590,66 @@ strip void() base_item;
self.movetype = MOVETYPE_NONE;
self.velocity = '0 0 0';
+ self.SendFlags |= NETFLAG_BASE_ENTITY_SOLID;
+ };
+
+ //--------------------------------------------------------------
+ void() base_item_think_throwgroundcheck =
+ {
+ if (self.flags & FL_ONGROUND)
+ {
+ // yaw to 0 (so the bbox will fit the item) -- CEV
+ if (!(self.classgroup & CG_CORPSE))
+ if (self.angles_y)
+ self.angles_y = 0;
+
+ // return to original size -- CEV
+ if (self.pos1 || self.pos2)
+ setsize (self, self.pos1, self.pos2);
+
+ // remove from frametick que if needed -- CEV
+ if (self.classgroup & CG_FRAMETICK)
+ self.classgroup &= ~CG_FRAMETICK;
+
+ // stop moving, thinking, & return to non-solid -- CEV
+ self.velocity = '0 0 0';
+ self.avelocity = '0 0 0';
+ self.solid = SOLID_TRIGGER;
+ self.think = sub_null;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_SOLID |
+ NETFLAG_BASE_ENTITY_ANGLES;
+ }
+ else
+ {
+ /*
+ dprint (sprintf("base_item_think_throwgroundcheck: "
+ "angles %v\n", self.angles));
+ */
+
+ // manage rotation towards center -- CEV
+ if (self.angles_y)
+ {
+ if (self.avelocity_y > 0)
+ {
+ if (self.angles_y > 0)
+ {
+ self.angles_y = 0;
+ self.avelocity_y = 0;
+ }
+ }
+ else
+ {
+ if (self.angles_y < 0)
+ {
+ self.angles_y = 0;
+ self.avelocity_y = 0;
+ }
+ }
+ }
+
+ self.nextthink = time + 0.1;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ANGLES;
+ }
};
//--------------------------------------------------------------
@@ -280,31 +657,61 @@ strip void() base_item;
//--------------------------------------------------------------
void() base_item_think_place =
{
- self.alpha = ITEM_ALPHA_OPAQUE;
- self.solid = SOLID_TRIGGER;
- self.velocity = '0 0 0';
- self.think = base_item_think_respawn;
+ // we want to be visible -- CEV
+ if (!(self.alpha))
+ self.alpha = ITEM_ALPHA_OPAQUE;
+
+ // so findradius can find it -- CEV
+ self.flags |= FL_FINDABLE_NONSOLID;
// make extra wide
- self.flags = FL_ITEM;
+ self.flags |= FL_ITEM;
// so it can be restored on respawn
self.mdl = self.model;
+ if (!(self.spawnflags & SPAWNFLAG_ITEM_THROWN))
+ {
+ self.velocity = '0 0 0';
+ self.think = base_item_think_respawn;
+ }
+
+ // guarantee size -- CEV
if (!self.pos1 && !self.pos2)
{
self.pos1 = '0 0 0';
self.pos2 = '32 32 56';
}
- setsize (self, self.pos1, self.pos2);
- if (self.spawnflags & ITEM_SUSPENDED)
+ if (self.spawnflags & SPAWNFLAG_ITEM_THROWN)
+ {
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_TOSS;
+ setsize (self, self.pos1, self.pos2);
+ setorigin (self, self.origin);
+
+ // add to frametick queue -- CEV
+ self.tick = base_item_neteval;
+ self.classgroup |= CG_FRAMETICK;
+
+ // check for ground once per 0.1 -- CEV
+ self.think = base_item_think_throwgroundcheck;
+ self.nextthink = time + 0.1;
+ }
+ else if (self.spawnflags & SPAWNFLAG_ITEM_SUSPENDED)
{
// ijed Don't drop spawnflag
+ dprint (sprintf("base_item_think_place: spawned "
+ "suspended item %s at %v\n",
+ self.classname, self.origin));
+ setsize (self, self.pos1, self.pos2);
+ self.solid = SOLID_TRIGGER;
self.movetype = MOVETYPE_FLY;
}
else
{
+ setsize (self, self.pos1, self.pos2);
+
// The following hack for item_health was inherited
// from the RMQ code, and was here when the
// func_mapjamx maps were created. It would have been
@@ -331,9 +738,10 @@ strip void() base_item;
}
}
+ self.solid = SOLID_TRIGGER;
self.movetype = MOVETYPE_TOSS;
- if (!(self.spawnflags & ITEM_DONTDROP))
+ if (!(self.spawnflags & SPAWNFLAG_ITEM_DONTDROP))
{
setorigin (self, self.origin + '0 0 6');
@@ -344,13 +752,19 @@ strip void() base_item;
"level at %v\n",
self.classname, self.origin));
// TODO CEV
- // remove (self);
+ // base_entity_remove (self);
return;
}
+
+ // TODO CEV
+ // base_entity_aligntoground (self);
}
+
+ self.tick = base_item_neteval;
+ // self.classgroup |= CG_FRAMETICK;
}
- if (self.spawnflags & ITEM_SPAWNED)
+ if (self.spawnflags & SPAWNFLAG_ITEM_SPAWNED)
{
// SPAWNED, gb
self.pos1 = self.mins;
@@ -358,12 +772,16 @@ strip void() base_item;
self.model = "";
self.solid = SOLID_NOT;
+ self.flags &= ~FL_FINDABLE_NONSOLID;
- if (self.spawnflags & ITEM_DONTDROP)
+ if (self.spawnflags & SPAWNFLAG_ITEM_DONTDROP)
self.movetype = MOVETYPE_NONE;
self.use = base_item_use_delayspawn;
}
+
+ self.SendEntity = base_entity_netsend;
+ self.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
};
//--------------------------------------------------------------
@@ -374,16 +792,15 @@ strip void() base_item;
void() base_item_use_delayspawn =
{
self.solid = SOLID_TRIGGER;
+ self.flags |= FL_FINDABLE_NONSOLID;
setmodel (self, self.mdl);
setsize (self, self.pos1, self.pos2);
- if (!(self.spawnflags & ITEM_SPAWNSILENT))
+ if (!(self.spawnflags & SPAWNFLAG_ITEM_SPAWNSILENT))
// SILENT, gb
- // sound (self, CHAN_VOICE, "items/itembk2.wav",
- // VOL_HIGH, ATTN_NORM);
spawn_tfog (self.origin + self.particles_offset);
- if (self.spawnflags & ITEM_SUSPENDED)
+ if (self.spawnflags & SPAWNFLAG_ITEM_SUSPENDED)
self.movetype = MOVETYPE_FLY;
else
self.movetype = MOVETYPE_TOSS;
@@ -396,20 +813,105 @@ strip void() base_item;
//==============================================================
//--------------------------------------------------------------
+ // pre-initialization macro. remap spawnflags for known releases,
+ // check spawnflags to inhibit spawn, then loop over spawndata
+ // if necessary -- CEV
+ //--------------------------------------------------------------
+ #define BASE_ITEM_PREINIT(func) \
+ /* { */ \
+ if (known_release == KNOWN_RELEASE_QUAKE3 || \
+ known_release == KNOWN_RELEASE_CPMA || \
+ known_release == KNOWN_RELEASE_QUAKELIVE) \
+ { \
+ /* remap flags for Q3 -- CEV */ \
+ compat_quake3_item_spawnflags (); \
+ } \
+ else if (known_release == KNOWN_RELEASE_COPPER) \
+ { \
+ /* remap flags for Copper -- CEV */ \
+ compat_copper_item_spawnflags (); \
+ } \
+ /* call func (if it's valid) to remap fields -- CEV */ \
+ /* run before inhibit in case it alters spawnflags -- CEV */ \
+ base_mapentity_init_spawndata (func); \
+ /* new spawnflags for all entities -- iw */ \
+ if (SUB_Inhibit()) \
+ return; \
+ /* } */
+
+ //--------------------------------------------------------------
+ void(string key, string value) base_item_init_field =
+ {
+ if (known_release == KNOWN_RELEASE_QUAKE3 ||
+ known_release == KNOWN_RELEASE_CPMA ||
+ known_release == KNOWN_RELEASE_QUAKELIVE)
+ {
+ compat_quake3_entity_init_field (key, value);
+ }
+
+ switch (key)
+ {
+ // remap Quoth (and pd3) item respawning fields to
+ // count, wait, and a spawnflag -- CEV
+ case "respawncount":
+ // count limits number of respawns -- CEV
+ if (!self.count)
+ self.count = stof (value);
+ break;
+ case "respawndelay":
+ // wait is respawn delay -- CEV
+ if (!self.wait)
+ self.wait = stof (value);
+ break;
+ case "ritem":
+ // set SPAWNFLAG_ITEM_RESPAWN -- CEV
+ local float ritem = stof (value);
+ if (ritem)
+ self.spawnflags |=
+ SPAWNFLAG_ITEM_RESPAWN;
+ break;
+ }
+ };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+ //--------------------------------------------------------------
void(entity e) base_item_init =
{
base_mapentity_init (e);
e.classgroup |= CG_ITEM;
+ #ifdef CSQC
+ setsize (e, e.pos1, e.pos2);
+ setorigin (e, e.origin);
+ // let the server run physics (toss) for items -- CEV
+ e.movetype = MOVETYPE_NONE;
+ e.drawmask = DRAWMASK_NORMAL;
+ e.predraw = base_item_predraw;
+ #endif
+
+ #ifdef SSQC
//------------------------------------------------------
// StartItem -- Sets the clipping size and plants the
// object on the floor
//------------------------------------------------------
- e.think = base_item_think_place;
- // items start after other solids || was 0.2 -- dumptruck_ds
- e.nextthink = time + 0.3;
+ if (e.spawnflags & SPAWNFLAG_ITEM_THROWN)
+ {
+ // call immediately for thrown items -- CEV
+ sub_runvoidas (e, base_item_think_place);
+ }
+ else
+ {
+ e.think = base_item_think_place;
+ // items start after other solids
+ // was 0.2 -- dumptruck_ds
+ e.nextthink = time + 0.3;
+ }
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
strip void() base_item =
{
Return to the top of this page or return to the overview of this repo.
Diff qc/base_monster.qc
diff --git a/qc/base_monster.qc b/qc/base_monster.qc
index 867f6c8..c289869 100644
--- a/qc/base_monster.qc
+++ b/qc/base_monster.qc
@@ -7,21 +7,83 @@
//======================================================================
#ifdef SSQC
-const float NO_SIGHT_SOUND = 32; // spawnflags
-const float PASSIVE_UNTIL_ATTACKED = 64;
-const float PASSIVE_ALWAYS = 128;
-const float I_AM_TURRET = 262144; // dumptruck_ds
-
-const float AS_STRAIGHT = 1; // values for attack_state field
-const float AS_SLIDING = 2;
-const float AS_MELEE = 3;
-const float AS_MISSILE = 4;
-const float AS_TURRET = 5;
-
-const float RANGE_MELEE = 0; // range values; see ai_range ()
-const float RANGE_NEAR = 1;
-const float RANGE_MID = 2;
-const float RANGE_FAR = 3;
+//----------------------------------------------------------------------
+// base monster spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_MONSTER_TELEWAIT = 8, // teleport-wait enemy
+ SPAWNFLAG_MONSTER_BERSERK = 16, // was .berserk -- CEV
+ SPAWNFLAG_MONSTER_NO_SIGHT_SOUND = 32, // no alert sound
+ SPAWNFLAG_MONSTER_PASSIVE_UNTIL_ATTACKED = 64,
+ SPAWNFLAG_MONSTER_PASSIVE_ALWAYS = 128,
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024, // base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_IN_COOP = 4096, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_IN_SP = 8192, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_IN_TEAMPLAY = 16384, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072, // see base_entities.qc -- CEV
+ SPAWNFLAG_MONSTER_SILENT = 262144, // suppress the teleport-in sound
+ SPAWNFLAG_MONSTER_TURRET = 524288, // dumptruck_ds
+ SPAWNFLAG_MONSTER_SPAWNED = 1048576, // MG1 SPAWNED flag
+ SPAWNFLAG_MONSTER_ANGRY = 2097152, // monster spawns in angry -- CEV
+ SPAWNFLAG_MONSTER_WAITWALK = 4194304 // MG1 WAITWALK flag
+} base_monster_spawnflags;
+#endif
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// base_corpse spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_CORPSE_SOLID = 1, // spawnflags: solid
+ SPAWNFLAG_CORPSE_DYNAMIC = 2 // non-static, moveable corpse
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} base_corpse_spawnflags;
+#endif
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// values for attack_state field
+//----------------------------------------------------------------------
+typedef enum
+{
+ AS_STRAIGHT = 1,
+ AS_SLIDING = 2,
+ AS_MELEE = 3,
+ AS_MISSILE = 4,
+ AS_TURRET = 5
+} base_monster_attack_states;
+#endif
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// range values; see ai_range ()
+//----------------------------------------------------------------------
+typedef enum
+{
+ RANGE_MELEE = 0,
+ RANGE_NEAR = 1,
+ RANGE_MID = 2,
+ RANGE_FAR = 3
+} base_monster_ai_ranges;
+#endif
+
+#ifdef SSQC
+const float CORPSE_HEALTH = 30; // static corpse health -- CEV
#endif
//======================================================================
@@ -57,7 +119,6 @@ entity sight_entity; // was in ai.qc
.float pausetime;
.float search_time;
.float sight_trigger; // dumptruck_ds
-.float spawn_angry; // dumptruck_ds
.float swim_time; // monster swimming sound flag
.float touch_time;
#endif
@@ -68,14 +129,6 @@ entity sight_entity; // was in ai.qc
#endif
#ifdef SSQC
-.string tele_model; // Preach's new fields -- dumptruck_ds
-.vector tele_mins; // TODO CEV
-.vector tele_maxs;
-.float tele_solid;
-.float tele_movetype;
-#endif
-
-#ifdef SSQC
.void() th_stand; // the typical th_ monster functions
.void() th_walk;
.void() th_run;
@@ -96,8 +149,14 @@ entity sight_entity; // was in ai.qc
#ifdef SSQC
void(float n) monster_update_total;
+#endif
-// base_monster // generic projectile firing
+// base_monster
+#ifdef CSQC
+// BASE_MONSTER_NETRECEIVE(initfn, newmins, newmaxs)
+float() base_monster_predraw;
+#endif
+#ifdef SSQC
void(vector org, float projspeed) base_monster_fire_flak;
void(vector org, float direct, float splash, float elevation)
base_monster_fire_grenade;
@@ -144,38 +203,41 @@ void(float normal) sub_attackfinished; // monster subs
void(void() nextfunc) sub_checkrefire;
float(.string fld) sub_fieldistargeted;
float() sub_istargeted;
-void() sub_death_use;
void() sub_pain_use;
-void() base_monster_think_teleport_go; // monster interaction
+void() base_monster_think_teleport_start; // monster interaction
+#endif
+#if defined(CSQC) || defined(SSQC)
void() base_monster_touch;
-void() base_monster_use_teledelay;
+#endif
+#ifdef SSQC
void() base_monster_use_angry;
-entity(vector org, vector ang, float sflags, float yaw, float angry,
+void() base_monster_use_beginwalk;
+void() base_monster_use_death;
+void() base_monster_use_teledelay;
+entity(vector org, vector ang, float sflags, float yaw,
void(entity e) initfn) spawn_base_monster;
-void() base_monster_init_teleport_check;// monster initialization
+// BASE_MONSTER_PREINIT(func) // monster initialization
+void(string key, string value) base_monster_init_field;
+void() base_monster_init_teleport_check;
float(entity e, void() start_fn) base_monster_init_teleport;
+void() base_monster_init_start;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) base_monster_init;
+#endif
+#ifdef SSQC
strip void() base_monster;
+#endif
-// base_flymonster
-void() base_flymonster_think_start;
-void(entity e) base_flymonster_init;
-strip void() base_flymonster;
-
-// base_swimmonster
-void() base_swimmonster_think_start;
-void(entity e) base_swimmonster_init;
-strip void() base_swimmonster;
-
-// base_walkmonster
-void() base_walkmonster_think_start;
-void(entity e) base_walkmonster_init;
-strip void() base_walkmonster;
+#ifdef SSQC
+// base_corpse
+void(entity e, float corpse_health) become_base_corpse;
+void(entity e) base_corpse_init;
+strip void() base_corpse;
#endif
//------------------------------------------------------------------------------
-#ifdef SSQC
//======================================================================
// .enemy
// Will be world if not currently angry at anyone.
@@ -202,6 +264,7 @@ strip void() base_walkmonster;
// walkmove(angle, speed) primitive is all or nothing
//======================================================================
+#ifdef SSQC
//----------------------------------------------------------------------
// monster_update_total
//
@@ -219,14 +282,96 @@ void(float n) monster_update_total =
};
#endif
-#ifdef SSQC
//----------------------------------------------------------------------
// class base_monster: base_mapentity
// {
//==============================================================
+ // Generic monster networking -- CEV
+ //==============================================================
+
+#ifdef CSQC
+ //--------------------------------------------------------------
+ #define BASE_MONSTER_NETRECEIVE(initfn, newmins, newmaxs) \
+ /* { */ \
+ local float netflags = base_entity_netreceive (isnew); \
+ if (isnew && !(self.predraw)) \
+ { \
+ initfn (self); \
+ } \
+ else \
+ { \
+ if (netflags & NETFLAG_BASE_ENTITY_MODEL) { \
+ if (self.modelindex) \
+ { \
+ setmodelindex (self, self.modelindex); \
+ if (self.solid) \
+ setsize (self, newmins, newmaxs); \
+ /*
+ else \
+ setsize (self, '0 0 0', '0 0 0'); */ \
+ } } \
+ if (netflags & NETFLAG_BASE_ENTITY_SOLID) \
+ { \
+ if (self.solid) \
+ setsize (self, newmins, newmaxs); \
+ else \
+ setsize (self, '0 0 0', '0 0 0'); \
+ } \
+ } \
+ if (self.frame_net != self.frame || isnew) \
+ { \
+ self.frame2 = self.frame; \
+ self.lerptime = time; \
+ self.frame = self.frame_net; \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ float() base_monster_predraw =
+ {
+ // a hack - don't interpolate frame for nonsolid (dead)
+ // monsters when in intermission - monsters are set
+ // nonsolid based on their frame in their individual
+ // netreceive functions -- CEV
+ if (intermission == FALSE || self.solid)
+ {
+ // interpolate frame
+ if (self.lerptime)
+ self.lerpfrac = 1 - (time - self.lerptime) * 10;
+ }
+
+ // interpolate angles -- see base_entities.qc -- CEV
+ BASE_ENTITY_LERP_ANGLES (self,
+ self.angles_net, self.angles_prev, time,
+ self.angles_net_time, self.angles_prev_time)
+
+ // interpolate origin -- see base_entities.qc -- CEV
+ BASE_ENTITY_LERP_ORIGIN (self,
+ self.origin_net, self.origin_prev, time,
+ self.origin_net_time, self.origin_prev_time)
+
+ // draw muzzleflash if needed -- CEV
+ if (self.effects & EF_MUZZLEFLASH)
+ {
+ self.effects &= ~EF_MUZZLEFLASH;
+ makevectors ([0, self.angles_y, 0]);
+ pointparticles (particleeffectnum("te_muzzleflash"),
+ self.origin, v_forward, 1);
+ }
+
+ // draw this entity -- CEV
+ addentity (self);
+
+ // go to next without auto-drawing this entity -- CEV
+ return PREDRAW_NEXT;
+ };
+#endif
+
+ //==============================================================
// Generic Monster Weapon Firing
//==============================================================
+#ifdef SSQC
//--------------------------------------------------------------
// BDW_OgreFireFlak
//--------------------------------------------------------------
@@ -317,7 +462,7 @@ void(float n) monster_update_total =
self.proj_speed_mod : 1), world_maxvelocity);
spawn_projectile_hknightspell (self, org, dir, off);
- sound_attack (self, CHAN_WEAPON, "hknight/attack1.wav",
+ sound (self, CHAN_WEAPON, "hknight/attack1.wav",
VOL_HIGH, ATTN_NORM);
};
@@ -327,7 +472,7 @@ void(float n) monster_update_total =
void(vector org, vector dir) base_monster_fire_laser =
{
self.effects = self.effects | EF_MUZZLEFLASH;
- sound_attack (self, CHAN_WEAPON, "enforcer/enfire.wav",
+ sound (self, CHAN_WEAPON, "enforcer/enfire.wav",
VOL_HIGH, ATTN_NORM);
dir = normalize (dir);
@@ -374,7 +519,7 @@ void(float n) monster_update_total =
float projspeed) base_monster_fire_rocket =
{
self.effects = self.effects | EF_MUZZLEFLASH;
- sound_attack (self, CHAN_WEAPON, "weapons/sgun1.wav",
+ sound (self, CHAN_WEAPON, "weapons/sgun1.wav",
VOL_HIGH, ATTN_NORM);
dir = normalize (dir);
@@ -426,7 +571,7 @@ void(float n) monster_update_total =
local float basespeed;
self.effects = self.effects | EF_MUZZLEFLASH;
- sound_misc (self, CHAN_WEAPON, "shalrath/attack2.wav",
+ sound (self, CHAN_WEAPON, "shalrath/attack2.wav",
VOL_HIGH, ATTN_NORM);
dir = normalize (dir);
@@ -472,7 +617,7 @@ void(float n) monster_update_total =
{
local vector vel = '0 0 0';
- sound_attack (self, CHAN_WEAPON, "zombie/z_shot1.wav",
+ sound (self, CHAN_WEAPON, "zombie/z_shot1.wav",
VOL_HIGH, ATTN_NORM);
// set missile speed
@@ -505,8 +650,8 @@ void(float n) monster_update_total =
//==============================================================
//--------------------------------------------------------------
- // Damage the monster according to the liquid type it's in
- // based on AD code & id1 player/client watermove -- CEV
+ // Damage the monster according to the liquid type it's in.
+ // Based on AD code & id1 player/client watermove -- CEV
//--------------------------------------------------------------
void() base_monster_liquiddamage =
{
@@ -514,13 +659,14 @@ void(float n) monster_update_total =
return;
if (self.contype == CONTENT_WATER &&
+ self.conlevel > WATERLEVEL_WAIST &&
self.air_finished < time)
{
if (self.classtype == CT_MONSTER_ZOMBIE)
// zombies can't drown
return;
- // monsters can drown
+ // other monsters can drown
if (self.pain_finished < time)
{
self.deathtype = "drowning";
@@ -606,7 +752,7 @@ void(float n) monster_update_total =
// call to knight_attack
// dumptruck_ds
- if (self.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_TURRET)
{
// dprint ("CheckAttack...\n");
if (self.classtype == CT_MONSTER_ENFORCER)
@@ -652,7 +798,8 @@ void(float n) monster_update_total =
traceline (spot1, spot2, FALSE, self);
- if ((self.spawnflags & I_AM_TURRET) && (trace_ent != targ))
+ if ((self.spawnflags & SPAWNFLAG_MONSTER_TURRET) &&
+ (trace_ent != targ))
{
// dprint ("trace_ent...\n");
self.attack_state = AS_TURRET;
@@ -816,9 +963,10 @@ void(float n) monster_update_total =
// wake up other monsters
self.show_hostile = time + 1;
- if !(self.spawnflags & NO_SIGHT_SOUND ||
- self.spawnflags & PASSIVE_ALWAYS ||
- self.spawnflags & PASSIVE_UNTIL_ATTACKED)
+ if !(self.spawnflags & SPAWNFLAG_MONSTER_NO_SIGHT_SOUND ||
+ self.spawnflags & SPAWNFLAG_MONSTER_PASSIVE_ALWAYS ||
+ self.spawnflags &
+ SPAWNFLAG_MONSTER_PASSIVE_UNTIL_ATTACKED)
{
if (self.sightsound)
self.sightsound ();
@@ -879,8 +1027,9 @@ void(float n) monster_update_total =
return FALSE;
}
- if ((self.spawnflags & PASSIVE_UNTIL_ATTACKED) ||
- (self.spawnflags & PASSIVE_ALWAYS))
+ if ((self.spawnflags &
+ SPAWNFLAG_MONSTER_PASSIVE_UNTIL_ATTACKED) ||
+ (self.spawnflags & SPAWNFLAG_MONSTER_PASSIVE_ALWAYS))
{
return FALSE;
}
@@ -952,6 +1101,7 @@ void(float n) monster_update_total =
{
self.ideal_yaw = vectoyaw (self.enemy.origin - self.origin);
changeyaw ();
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ANGLES;
};
//--------------------------------------------------------------
@@ -972,6 +1122,10 @@ void(float n) monster_update_total =
{
// dprint ("ai_forward\n");
walkmove (self.angles_y, dist);
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN_X |
+ NETFLAG_BASE_ENTITY_ORIGIN_Y |
+ NETFLAG_BASE_ENTITY_ORIGIN_Z |
+ NETFLAG_BASE_ENTITY_ANGLES;
};
//--------------------------------------------------------------
@@ -979,6 +1133,10 @@ void(float n) monster_update_total =
{
// dprint ("ai_back\n");
walkmove ((self.angles_y + 180), dist);
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN_X |
+ NETFLAG_BASE_ENTITY_ORIGIN_Y |
+ NETFLAG_BASE_ENTITY_ORIGIN_Z |
+ NETFLAG_BASE_ENTITY_ANGLES;
};
//--------------------------------------------------------------
@@ -1004,6 +1162,10 @@ void(float n) monster_update_total =
{
// dprint ("ai_painforward\n");
walkmove (self.ideal_yaw, dist);
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN_X |
+ NETFLAG_BASE_ENTITY_ORIGIN_Y |
+ NETFLAG_BASE_ENTITY_ORIGIN_Z |
+ NETFLAG_BASE_ENTITY_ANGLES;
};
//--------------------------------------------------------------
@@ -1011,6 +1173,8 @@ void(float n) monster_update_total =
//--------------------------------------------------------------
void(float dist) ai_walk =
{
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
+
if (self.health < 1)
return;
@@ -1026,17 +1190,15 @@ void(float n) monster_update_total =
movedist = dist;
- if (self.classname == "monster_dragon")
- {
- movetogoal (dist);
- return;
- }
-
// check for noticing a player
if (ai_findtarget())
return;
movetogoal (dist);
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN_X |
+ NETFLAG_BASE_ENTITY_ORIGIN_Y |
+ NETFLAG_BASE_ENTITY_ORIGIN_Z |
+ NETFLAG_BASE_ENTITY_ANGLES;
};
//--------------------------------------------------------------
@@ -1045,6 +1207,12 @@ void(float n) monster_update_total =
//--------------------------------------------------------------
void() ai_stand =
{
+ // instead of setting the FRAME netflag here let individual
+ // monster think functions take care of it -- CEV
+ // TODO CEV
+ if (!(self.SendFlags & NETFLAG_BASE_ENTITY_FRAME))
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
+
if (self.health < 1)
return;
@@ -1066,6 +1234,7 @@ void(float n) monster_update_total =
self.th_walk ();
return;
}
+
// change angle slightly -- TODO CEV this comment was
// in PD3 source but had no associated code
};
@@ -1079,6 +1248,7 @@ void(float n) monster_update_total =
return;
changeyaw ();
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ANGLES;
};
//--------------------------------------------------------------
@@ -1095,6 +1265,11 @@ void(float n) monster_update_total =
self.th_melee ();
self.attack_state = AS_STRAIGHT;
}
+
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN_X |
+ NETFLAG_BASE_ENTITY_ORIGIN_Y |
+ NETFLAG_BASE_ENTITY_ORIGIN_Z |
+ NETFLAG_BASE_ENTITY_ANGLES;
};
//--------------------------------------------------------------
@@ -1104,22 +1279,22 @@ void(float n) monster_update_total =
void() ai_run_missile =
{
self.ideal_yaw = enemy_yaw;
- // dprint ("ai_run_missile GO\n");
changeyaw ();
+
if (ai_facing_ideal())
{
- if (self.spawnflags & I_AM_TURRET)
- {
+ if (self.spawnflags & SPAWNFLAG_MONSTER_TURRET)
self.th_turret ();
- // dprint ("th_turret...\n");
- }
else
- {
self.th_missile ();
- // dprint ("th_missile\n");
- }
+
self.attack_state = AS_STRAIGHT;
}
+
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN_X |
+ NETFLAG_BASE_ENTITY_ORIGIN_Y |
+ NETFLAG_BASE_ENTITY_ORIGIN_Z |
+ NETFLAG_BASE_ENTITY_ANGLES;
};
//--------------------------------------------------------------
@@ -1138,11 +1313,21 @@ void(float n) monster_update_total =
ofs = -90;
if (walkmove(self.ideal_yaw + ofs, movedist))
+ {
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN_X |
+ NETFLAG_BASE_ENTITY_ORIGIN_Y |
+ NETFLAG_BASE_ENTITY_ORIGIN_Z |
+ NETFLAG_BASE_ENTITY_ANGLES;
return;
+ }
self.lefty = 1 - self.lefty;
walkmove (self.ideal_yaw - ofs, movedist);
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN_X |
+ NETFLAG_BASE_ENTITY_ORIGIN_Y |
+ NETFLAG_BASE_ENTITY_ORIGIN_Z |
+ NETFLAG_BASE_ENTITY_ANGLES;
};
//--------------------------------------------------------------
@@ -1170,7 +1355,7 @@ void(float n) monster_update_total =
if ((self.enemy.health <= 0) ||
(self.enemy.solid == SOLID_NOT) ||
(self.enemy.solid == SOLID_CORPSE) ||
- (self.spawnflags & PASSIVE_ALWAYS))
+ (self.spawnflags & SPAWNFLAG_MONSTER_PASSIVE_ALWAYS))
{
self.enemy = world;
// FIXME: look all around for other targets
@@ -1181,12 +1366,18 @@ void(float n) monster_update_total =
}
else
{
- if (self.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_TURRET)
+ {
self.th_stand ();
+ }
else if (self.movetarget)
+ {
self.th_walk ();
+ }
else
+ {
self.th_stand ();
+ }
return;
}
}
@@ -1210,24 +1401,17 @@ void(float n) monster_update_total =
enemy_range = ai_range (self.enemy);
enemy_yaw = vectoyaw (self.enemy.origin - self.origin);
- if (self.spawnflags & I_AM_TURRET)
- {
+ if (self.spawnflags & SPAWNFLAG_MONSTER_TURRET)
ai_face ();
- }
- // if ((self.attack_state == AS_MISSILE) ||
- // !(self.spawnflags & I_AM_TURRET))
if (self.attack_state == AS_MISSILE)
{
- // dprint ("ai_run_missile... from ai_run\n");
ai_run_missile ();
return;
}
- // if ((self.attack_state == AS_MELEE) ||
- // !(self.spawnflags & I_AM_TURRET))
+
if (self.attack_state == AS_MELEE)
{
- // dprint ("ai_run_melee\n");
ai_run_melee ();
return;
}
@@ -1236,13 +1420,12 @@ void(float n) monster_update_total =
// beginning an attack
return;
- // if ((self.attack_state == AS_SLIDING) ||
- // !(self.spawnflags & I_AM_TURRET))
if (self.attack_state == AS_SLIDING)
{
ai_run_slide ();
return;
}
+
// part of monster face from TheSolipsist
// urged to change positions
if (time < self.t_length)
@@ -1251,14 +1434,28 @@ void(float n) monster_update_total =
changeyaw ();
if (walkmove(self.ideal_yaw, dist))
+ {
+ self.SendFlags |=
+ NETFLAG_BASE_ENTITY_ORIGIN_X |
+ NETFLAG_BASE_ENTITY_ORIGIN_Y |
+ NETFLAG_BASE_ENTITY_ORIGIN_Z |
+ NETFLAG_BASE_ENTITY_ANGLES;
return;
+ }
// dodge left
self.ideal_yaw += 30;
changeyaw ();
if (walkmove(self.ideal_yaw, dist))
+ {
+ self.SendFlags |=
+ NETFLAG_BASE_ENTITY_ORIGIN_X |
+ NETFLAG_BASE_ENTITY_ORIGIN_Y |
+ NETFLAG_BASE_ENTITY_ORIGIN_Z |
+ NETFLAG_BASE_ENTITY_ANGLES;
return;
+ }
// dodge right
self.ideal_yaw -= 60;
@@ -1266,21 +1463,38 @@ void(float n) monster_update_total =
changeyaw ();
if (walkmove(self.ideal_yaw, dist))
+ {
+ self.SendFlags |=
+ NETFLAG_BASE_ENTITY_ORIGIN_X |
+ NETFLAG_BASE_ENTITY_ORIGIN_Y |
+ NETFLAG_BASE_ENTITY_ORIGIN_Z |
+ NETFLAG_BASE_ENTITY_ANGLES;
return;
+ }
// give up
self.ideal_yaw += 30;
changeyaw();
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN_X |
+ NETFLAG_BASE_ENTITY_ORIGIN_Y |
+ NETFLAG_BASE_ENTITY_ORIGIN_Z |
+ NETFLAG_BASE_ENTITY_ANGLES;
// lose patience
self.touch_time = self.touch_time - 0.1;
return;
}
- if !(self.spawnflags & I_AM_TURRET)
+ if (!(self.spawnflags & SPAWNFLAG_MONSTER_TURRET))
+ {
// keeps monster from moving to player - dumptruck_ds
// head straight in -- done in C code...
movetogoal (dist);
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN_X |
+ NETFLAG_BASE_ENTITY_ORIGIN_Y |
+ NETFLAG_BASE_ENTITY_ORIGIN_Z |
+ NETFLAG_BASE_ENTITY_ANGLES;
+ }
};
//--------------------------------------------------------------
@@ -1292,6 +1506,10 @@ void(float n) monster_update_total =
ai_face ();
// done in C code...
movetogoal (dist);
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN_X |
+ NETFLAG_BASE_ENTITY_ORIGIN_Y |
+ NETFLAG_BASE_ENTITY_ORIGIN_Z |
+ NETFLAG_BASE_ENTITY_ANGLES;
};
//--------------------------------------------------------------
@@ -1309,6 +1527,10 @@ void(float n) monster_update_total =
heading = vectoyaw (dtemp - self.origin);
walkmove (heading, 20);
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN_X |
+ NETFLAG_BASE_ENTITY_ORIGIN_Y |
+ NETFLAG_BASE_ENTITY_ORIGIN_Z |
+ NETFLAG_BASE_ENTITY_ANGLES;
};
//--------------------------------------------------------------
@@ -1450,31 +1672,6 @@ void(float n) monster_update_total =
};
//--------------------------------------------------------------
- // monster_death_use
- //
- // When a mosnter dies, it fires all of its targets with the
- // current enemy as activator.
- //--------------------------------------------------------------
- void() sub_death_use =
- {
- // fall to ground
- if (self.flags & FL_FLY)
- self.flags = self.flags - FL_FLY;
- if (self.flags & FL_SWIM)
- self.flags = self.flags - FL_SWIM;
-
- if (!self.target)
- return;
-
- if (self.infight_activator)
- activator = self.infight_activator;
- else
- activator = self.enemy;
-
- sub_usetargets ();
- };
-
- //--------------------------------------------------------------
// monster_pain_use -- dumptruck_ds
//
// When a monster reaches pain_threshold, it fires all of its
@@ -1503,37 +1700,37 @@ void(float n) monster_update_total =
//==============================================================
//--------------------------------------------------------------
- void() base_monster_think_teleport_go =
+ void() base_monster_think_teleport_start =
{
- self.solid = self.tele_solid;
- self.movetype = self.tele_movetype;
- setmodel (self, self.tele_model);
- setsize (self, self.tele_mins, self.tele_maxs);
-
- // ensure touch and use are set; think1 might override -- CEV
- self.touch = base_monster_touch;
- self.use = base_monster_use_angry;
-
// fix for cumulative delays for counters etc. -- dumptruck_ds
self.delay = 0;
- self.think1 ();
+ // run the stored think -- must set model, size, etc -- CEV
+ if (self.think1)
+ self.think1 ();
- // override the random delay some go functions apply
+ // override the random delay the start function applies
self.nextthink = time + 0.1;
- // TODO CEV what is this bracket doing here?
+
+ if (!(self.spawnflags & SPAWNFLAG_MONSTER_SPAWNED)) {
+ if (!(self.spawnflags & SPAWNFLAG_MONSTER_SILENT))
{
- if !(self.spawnflags & SPAWN_SILENTLY)
- {
- // dumptruck_ds: if wait value is > 0
- // spawn silently or use a spawnflag
- if (self.wait == 0)
- spawn_tfog (self.origin);
- spawn_tdeath (self.origin, self);
- }
+ // dumptruck_ds: if wait value is > 0 spawn silently
+ if (self.wait == 0)
+ spawn_tfog (self.origin);
+ spawn_tdeath (self.origin, self);
+ } }
+
+ if (!(self.SendEntity))
+ {
+ // make sure monster is sent to CSQC -- CEV
+ self.SendEntity = base_entity_netsend;
+ self.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
}
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
// monster_touch -- was in monsters.qc -- CEV
//--------------------------------------------------------------
@@ -1565,29 +1762,14 @@ void(float n) monster_update_total =
// you can add other stuff like pushable players/monsters here
// will do Kryten, thanks for the tip -- CEV
- base_entity_push (self, other, PM_MAXSPEED);
+ // base_entity_push (self, other, PM_MAXSPEED);
// 1998-09-16 Sliding/not-jumping on monsters/boxes/players
// fix by Maddes/Kryten end
};
+#endif
- //--------------------------------------------------------------
- // monster_teleport_delay
- //--------------------------------------------------------------
- void() base_monster_use_teledelay =
- {
- // new from Qmaster func coding help thread
- self.think = base_monster_think_teleport_go;
- if (self.delay == -1)
- {
- // if delay is set to -1 random delay
- // from 0.1 to 1 second - dumptruck_ds
- self.nextthink = time + 0.1 + random();
- return;
- }
- self.nextthink = time + 0.1 + self.delay;
- };
-
+#ifdef SSQC
//--------------------------------------------------------------
// monster_use -- Using a monster makes it angry at the activator
//--------------------------------------------------------------
@@ -1603,8 +1785,7 @@ void(float n) monster_update_total =
return;
if (activator.movetype == MOVETYPE_NOCLIP)
// Copper -- dumptruck_ds
- return FALSE;
-
+ return;
if (activator.classtype != CT_PLAYER)
return;
@@ -1615,12 +1796,64 @@ void(float n) monster_update_total =
self.nextthink = time + 0.1;
};
+ //--------------------------------------------------------------
+ // WAITWALK functionality from MG1 -- CEV
+ //--------------------------------------------------------------
+ void() base_monster_use_beginwalk =
+ {
+ self.use = base_monster_use_angry;
+ self.pausetime = 0;
+ self.th_walk ();
+ };
+
+ //--------------------------------------------------------------
+ // monster_teleport_delay
+ //--------------------------------------------------------------
+ void() base_monster_use_teledelay =
+ {
+ // new from Qmaster func coding help thread
+ self.think = base_monster_think_teleport_start;
+ if (self.delay == -1)
+ {
+ // if delay is set to -1 random delay
+ // from 0.1 to 1 second - dumptruck_ds
+ self.nextthink = time + 0.1 + random();
+ return;
+ }
+ self.nextthink = time + 0.1 + self.delay;
+ };
+
+ //--------------------------------------------------------------
+ // monster_death_use
+ //
+ // When a monster dies, it fires all of its targets with the
+ // current enemy as activator.
+ //--------------------------------------------------------------
+ void() base_monster_use_death =
+ {
+ // fall to ground
+ if (self.flags & FL_FLY)
+ self.flags &= ~FL_FLY;
+ if (self.flags & FL_SWIM)
+ self.flags &= ~FL_SWIM;
+
+ if (!self.target)
+ return;
+
+ if (self.infight_activator)
+ activator = self.infight_activator;
+ else
+ activator = self.enemy;
+
+ sub_usetargets ();
+ };
+
//==============================================================
// Initialization
//==============================================================
//--------------------------------------------------------------
- entity(vector org, vector ang, float sflags, float yaw, float angry,
+ entity(vector org, vector ang, float sflags, float yaw,
void(entity e) initfn) spawn_base_monster =
{
local entity e = spawn ();
@@ -1628,7 +1861,6 @@ void(float n) monster_update_total =
e.origin = org;
e.angles = ang;
e.yaw_speed = yaw;
- e.spawn_angry = angry;
setorigin (e, e.origin);
if (initfn)
initfn (e);
@@ -1636,6 +1868,42 @@ void(float n) monster_update_total =
};
//--------------------------------------------------------------
+ #define BASE_MONSTER_PREINIT(func) \
+ /* { */ \
+ /* remap flags for Dimension Of The Machine -- CEV */ \
+ if (known_release == KNOWN_RELEASE_MG1) \
+ { \
+ compat_mg1_monster_spawnflags (); \
+ } \
+ /* call func (if it's valid) to remap fields -- CEV */ \
+ /* run before inhibit in case it alters spawnflags -- CEV */ \
+ base_mapentity_init_spawndata (func); \
+ /* new spawnflags for all entities -- iw */ \
+ if (SUB_Inhibit()) \
+ return; \
+ /* } */
+
+ //--------------------------------------------------------------
+ void(string key, string value) base_monster_init_field =
+ {
+ switch (key)
+ {
+ case "berserk":
+ local float zerk = stof (value);
+ if (zerk)
+ self.spawnflags |=
+ SPAWNFLAG_MONSTER_BERSERK;
+ break;
+ case "spawn_angry":
+ local float angry = stof (value);
+ if (angry)
+ self.spawnflags |=
+ SPAWNFLAG_MONSTER_ANGRY;
+ break;
+ }
+ };
+
+ //--------------------------------------------------------------
// monster_teleport_check
//
// This detects and eliminates a common map bug: a trigger-spawned
@@ -1652,7 +1920,7 @@ void(float n) monster_update_total =
"WARNING: removed untargeted trigger-spawned "
"%s at %v\n", self.classname, self.origin));
- remove (self);
+ base_entity_remove (self);
return;
}
@@ -1667,16 +1935,9 @@ void(float n) monster_update_total =
//--------------------------------------------------------------
float(entity e, void() start_fn) base_monster_init_teleport =
{
- if(!(e.spawnflags & 8))
+ if(!(e.spawnflags & SPAWNFLAG_MONSTER_TELEWAIT))
return FALSE;
- // PREACH: This monster is to be teleported in, so hide it
- e.tele_model = e.model;
- e.tele_mins = e.mins;
- e.tele_maxs = e.maxs;
- e.tele_solid = e.solid;
- e.tele_movetype = e.movetype;
-
e.model = "";
e.modelindex = 0;
e.solid = SOLID_NOT;
@@ -1692,64 +1953,103 @@ void(float n) monster_update_total =
};
//--------------------------------------------------------------
- void(entity e) base_monster_init =
+ void() base_monster_init_start =
{
- e.classgroup |= CG_MONSTER;
- e.touch = base_monster_touch;
- e.use = base_monster_use_angry;
- base_mapentity_init (e);
- };
+ #if 0
+ dprint (sprintf("base_monster_init_start: "
+ "initializing %s at %v\n",
+ self.classname, self.origin));
+ #endif
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+ self.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+
+ if (self.mdl != __NULL__ && self.mdl != "")
+ setmodel (self, self.mdl);
+ else
+ setmodel (self, self.model);
- //--------------------------------------------------------------
- strip void() base_monster =
- {
- base_monster_init (self);
- };
-// };
-#endif
+ if (self.pos1 || self.pos2)
+ setsize (self, self.pos1, self.pos2);
+ else
+ setsize (self, self.mins, self.maxs);
-#ifdef SSQC
-//----------------------------------------------------------------------
-// class base_flymonster: base_monster
-// {
- //==============================================================
- // Interaction
- //==============================================================
+ self.flags |= FL_MONSTER;
- //--------------------------------------------------------------
- // flymonster_start_go
- //--------------------------------------------------------------
- void() base_flymonster_think_start =
- {
+ if (!(self.classgroup & CG_MONSTER_FLY) &&
+ !(self.classgroup & CG_MONSTER_SWIM))
+ {
+ // Preach's "check" here
+ if (!(self.spawnflags & SPAWNFLAG_MONSTER_TELEWAIT))
+ {
+ // raise off floor a bit
+ self.origin_z += 1;
+ droptofloor ();
+ }
+ }
+ else
+ {
+ if (self.classgroup & CG_MONSTER_FLY)
+ self.flags |= FL_FLY;
+ if (self.classgroup & CG_MONSTER_SWIM)
+ self.flags |= FL_SWIM;
+ }
+
+ if (!walkmove(0,0))
+ {
+ dprint (sprintf("base_monster_init_start: %s in wall "
+ "at %v, target = '%s', targetname = '%s'\n",
+ self.classname, self.origin,
+ self.target, self.targetname));
+ }
+
+ if (self.spawnflags & SPAWNFLAG_MONSTER_SPAWNED)
+ {
+ // dumptruck_ds: if wait value is > 0 spawn silently
+ if (self.wait == 0)
+ spawn_tfog (self.origin);
+ spawn_tdeath (self.origin, self);
+ }
+
+ self.contentstransition = base_monster_contentstransition;
self.takedamage = DAMAGE_AIM;
+ self.touch = base_monster_touch;
+ self.use = base_monster_use_angry;
+ self.view_ofs = '0 0 25';
self.ideal_yaw = self.angles * '0 1 0';
if (!self.yaw_speed)
- self.yaw_speed = 10;
- self.view_ofs = '0 0 25';
- self.use = base_monster_use_angry;
-
- self.flags |= FL_FLY;
- self.flags |= FL_MONSTER;
-
- if (!walkmove(0, 0))
- dprint (sprintf("base_flymonster_think_start: "
- "monster in wall at %v\n", self.origin));
+ self.yaw_speed = 20;
- if (self.target != "")
+ if (self.target != __NULL__ && self.target != "")
{
- self.goalentity = self.movetarget = find (world,
- targetname, self.target);
+ self.goalentity = find (world, targetname, self.target);
+ self.movetarget = self.goalentity;
+ if (self.goalentity)
+ self.ideal_yaw = vectoyaw (
+ self.goalentity.origin - self.origin);
// this used to be an objerror
if (!self.movetarget)
- dprint (sprintf("base_flymonster_think_start: "
- "monster at %v can't find target\n",
- self.origin));
+ {
+ dprint (sprintf("base_monster_init_start: "
+ "%s at %v can't find target\n",
+ self.classname, self.origin));
+ }
if (self.movetarget.classtype == CT_PATH_CORNER)
{
- self.th_walk ();
+ if (self.spawnflags&SPAWNFLAG_MONSTER_WAITWALK)
+ {
+ self.pausetime = 99999999;
+ self.th_stand ();
+ self.use = base_monster_use_beginwalk;
+ }
+ else
+ {
+ self.th_walk ();
+ }
}
else
{
@@ -1763,329 +2063,191 @@ void(float n) monster_update_total =
self.th_stand ();
}
- // 1998-08-14 Monsters sometimes don't move fix by Lord Sméagol
- self.nextthink = time + 0.1 + random() * 0.5;
-
- // dumptruck_ds -- using spawn_angry set to 1 in order to spawn
- // in "angry" monsters
- // if ((this.spawnflags & 8) && this.spawn_angry == 1)
- // {
- // monster_use ();
- // }
-
- // dumptruck_ds -- this is Shamblernaut's method
- local entity pl;
-
- pl = findfloat (world, classtype, CT_PLAYER);
-
- if (self.spawn_angry == 1)
+ if (known_release == KNOWN_RELEASE_MG1)
{
- activator = pl;
- base_monster_use_angry ();
+ if (self.spawnflags & SPAWNFLAG_MONSTER_SPAWNED &&
+ self.spawnflags & SPAWNFLAG_MONSTER_ANGRY)
+ {
+ // this is Shamblernaut's method -- dumptruck_ds
+ local entity pl;
+ pl = findfloat (world, classtype, CT_PLAYER);
+ activator = pl;
+ base_monster_use_angry ();
+ }
+ else
+ {
+ self.nextthink = time + 0.1 + random() * 0.5;
+ }
}
- };
-
- //==============================================================
- // Initialization
- //==============================================================
-
- //--------------------------------------------------------------
- // flymonster_start
- //--------------------------------------------------------------
- void(entity e) base_flymonster_init =
- {
- if (cvar("nomonsters"))
+ else
{
- remove (e);
- return;
+ // spread think times so they don't all happen at once
+ // 1998-08-14 Monsters sometimes do not move fix
+ // by Lord Sméagol start
+ self.nextthink = time + 0.1 + random() * 0.5;
+ // 1998-08-14 Monsters sometimes do not move fixx
+ // by Lord Sméagol end
+
+ // anger the monster if requested -- CEV
+ if (self.spawnflags & SPAWNFLAG_MONSTER_ANGRY)
+ {
+ // this is Shamblernaut's method -- dumptruck_ds
+ local entity pl2;
+ pl2 = findfloat (world, classtype, CT_PLAYER);
+ activator = pl2;
+ base_monster_use_angry ();
+ }
}
- base_monster_init (e);
- e.classgroup |= CG_MONSTER_FLY;
-
- // Preach's tutorial
- if (base_monster_init_teleport(e, base_flymonster_think_start))
- return;
-
- // 1998-08-14 Monsters sometimes don't move fix by Lord Sméagol
- e.flags |= FL_FLY;
-
- total_monsters = total_monsters + 1;
- e.think = base_flymonster_think_start;
- // spread think times so they don't all happen at same time
- // 1998-08-14 Monsters sometimes don't move fix by
- // Lord Sméagol start
- // e.nextthink = e.nextthink + random() * 0.5;
- e.nextthink = time + 0.1 + random() * 0.5;
- // 1998-08-14 Monsters sometimes don't move fix by
- // Lord Sméagol end
+ // all monsters get transmitted to CSQC -- CEV
+ self.SendEntity = base_entity_netsend;
+ self.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
};
-
- //--------------------------------------------------------------
- strip void() base_flymonster =
- {
- base_flymonster_init (self);
- };
-// };
#endif
-#ifdef SSQC
-//----------------------------------------------------------------------
-// class base_swimmonster: base_monster
-// {
- //==============================================================
- // Interaction
- //==============================================================
-
- //--------------------------------------------------------------
- // swimmonster_start_go
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
- void() base_swimmonster_think_start =
+ void(entity e) base_monster_init =
{
- if (deathmatch)
+ #ifdef SSQC
+ // Preach's tutorial
+ if (autocvar(nomonsters, 0))
{
- remove (self);
+ remove (e);
return;
}
+ #endif
- self.takedamage = DAMAGE_AIM;
-
- self.ideal_yaw = self.angles * '0 1 0';
- if (!self.yaw_speed)
- self.yaw_speed = 10;
- self.view_ofs = '0 0 10';
- self.use = base_monster_use_angry;
-
- self.flags |= FL_SWIM;
- self.flags |= FL_MONSTER;
+ e.classgroup |= CG_MONSTER;
+ base_mapentity_init (e);
- if (self.target != "")
- {
- self.goalentity = self.movetarget = find (world,
- targetname, self.target);
+ #ifdef CSQC
+ // set touch immediately -- CEV
+ e.touch = base_monster_touch;
- // this used to be an objerror
- if (!self.movetarget)
- dprint (sprintf("base_swimmonster_think_start: "
- "monster at %v can't find target\n",
- self.origin));
+ // set fly/swim flags on the client -- CEV
+ if (e.classgroup & CG_MONSTER_FLY)
+ e.flags |= FL_FLY;
+ if (e.classgroup & CG_MONSTER_SWIM)
+ e.flags |= FL_SWIM;
- self.ideal_yaw = vectoyaw (
- self.goalentity.origin - self.origin);
- self.th_walk ();
- }
- else
- {
- self.pausetime = 99999999;
- self.th_stand ();
- }
+ // if we have an origin set it -- CEV
+ if (e.origin)
+ setorigin (e, e.origin);
- // spread think times so they don't all happen at same time
- // 1998-08-14 Monsters sometimes do not move fix
- // by Lord Sméagol start
- // self.nextthink = self.nextthink + random()*0.5;
- self.nextthink = time + 0.1 + random() * 0.5;
- // 1998-08-14 Monsters sometimes do not move fix
- // by Lord Sméagol end
+ // generic flags & masks for the client side -- CEV
+ e.drawmask = DRAWMASK_NORMAL;
+ e.flags |= FL_MONSTER;
+ e.movetype = MOVETYPE_NONE;
+ e.solid = SOLID_SLIDEBOX;
- // dumptruck_ds -- using spawn_angry set to 1 in order to
- // spawn in "angry" monsters
- // if ((self.spawnflags & 8) && self.spawn_angry == 1)
- // {
- // monster_use ();
- // }
+ // generic monster predraw (interpolates angles, origin, and
+ // frames). See above. -- CEV
+ e.predraw = base_monster_predraw;
+ #endif
- // dumptruck_ds -- this is Shamblernaut's method
- local entity pl;
+ #ifdef SSQC
+ // Preach's tutorial
+ if (base_monster_init_teleport(e, base_monster_init_start))
+ // this monster is setup to teleport in; exit early
+ return;
- pl = findfloat (world, classtype, CT_PLAYER);
+ total_monsters += 1;
- if (self.spawn_angry == 1)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_SPAWNED)
{
- activator = pl;
- base_monster_use_angry ();
+ // this monster will initialize when used -- CEV
+ e.use = base_monster_init_start;
}
- };
-
- //==============================================================
- // Initialization
- //==============================================================
-
- //--------------------------------------------------------------
- // swimmonster_start
- //--------------------------------------------------------------
- void(entity e) base_swimmonster_init =
- {
- if (cvar("nomonsters"))
+ else
{
- remove (e);
- return;
+ // normal start -- CEV
+ e.think = base_monster_init_start;
+ e.nextthink = time + 0.1 + random() * 0.5;
}
-
- base_monster_init (e);
- e.classgroup |= CG_MONSTER_SWIM;
-
- // 1998-08-14 Monsters sometimes don't move fix by Lord Sméagol
- e.flags = e.flags | FL_SWIM;
-
- // Preach's tutorial
- if (base_monster_init_teleport(e, base_swimmonster_think_start))
- return;
-
- total_monsters = total_monsters + 1;
- e.think = base_swimmonster_think_start;
- // spread think times so they don't all happen at same time
- // 1998-08-14 Monsters sometimes do not move fix
- // by Lord Sméagol start
- // e.nextthink = e.nextthink + random() * 0.5;
- e.nextthink = time + 0.1 + random() * 0.5;
- // 1998-08-14 Monsters sometimes do not move fix
- // by Lord Sméagol end
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
- strip void() base_swimmonster =
+ strip void() base_monster =
{
- base_swimmonster_init (self);
+ base_monster_init (self);
};
-// };
#endif
+// };
#ifdef SSQC
//----------------------------------------------------------------------
-// class base_walkmonster: base_monster
+// Corpse base class, used for both converting dead monsters into corpses
+// and for DeadStuff mod mapper-placeable corpses -- CEV
+//----------------------------------------------------------------------
+// class base_corpse: base_mapentity
// {
- //==============================================================
- // Interaction
- //==============================================================
-
//--------------------------------------------------------------
- // walkmonster_start_go
+ // Convert an entity into a shootable corpse. Call at the end of
+ // a monster's death think. Uses FTE's SOLID_CORPSE. Inspired by
+ // / based on Kryten's gibbable corpse tutorial found at
+ // https://www.insideqc.com/qctut/qctut-33.shtml -- CEV
//--------------------------------------------------------------
- void() base_walkmonster_think_start =
+ void(entity e, float corpse_health) become_base_corpse =
{
- // raise off floor a bit
- self.origin_z = self.origin_z + 1;
+ e.classgroup |= CG_CORPSE;
- // Preach's "check" here
- // if(time <= 0.5)
- if(!(self.spawnflags & 8))
- {
- droptofloor ();
- if !(self.spawnflags & I_AM_TURRET)
- {
- // fixes an incorrect dprint
- // -- dumptruck_ds
- if (!walkmove(0, 0))
- dprint (sprintf("\n\n%s "
- "in wall at: %v\n\n",
- self.classname, self.origin));
- }
- }
+ // set up trigger interaction
+ if (e.flags & FL_MONSTER)
+ e.flags &= ~FL_MONSTER;
- self.takedamage = DAMAGE_AIM;
- self.ideal_yaw = self.angles * '0 1 0';
- if (!self.yaw_speed)
- self.yaw_speed = 20;
- self.view_ofs = '0 0 25';
- self.use = base_monster_use_angry;
- self.flags |= FL_MONSTER;
-
- if (self.target != "")
- {
- self.goalentity = self.movetarget = find (
- world, targetname, self.target);
- self.ideal_yaw = vectoyaw (
- self.goalentity.origin - self.origin);
-
- // this used to be an objerror
- if (!self.movetarget)
- dprint (sprintf("base_walkmonster_think: "
- "monster at %v can't find target\n",
- self.origin));
-
- if (self.movetarget.classtype == CT_PATH_CORNER)
- {
- self.th_walk ();
- }
- else
- {
- self.pausetime = 99999999;
- self.th_stand ();
- }
- }
+ // re-set the monster/corpse's health -- CEV
+ if (corpse_health)
+ e.health = corpse_health;
else
- {
- self.pausetime = 99999999;
- self.th_stand ();
- }
-
- // spread think times so they don't all happen at once
- // 1998-08-14 Monsters sometimes do not move fix
- // by Lord Sméagol start
- // self.nextthink = self.nextthink + random() * 0.5;
- self.nextthink = time + 0.1 + random() * 0.5;
- // 1998-08-14 Monsters sometimes do not move fixx
- // by Lord Sméagol end
- // dumptruck_ds -- using spawn_angry set to 1 in
- // order to spawn in "angry" monsters
- // if ((self.spawnflags & 8) && self.spawn_angry == 1)
- // {
- // monster_use ();
- // }
-
- // dumptruck_ds -- this is Shamblernaut's method
- local entity pl;
-
- pl = findfloat (world, classtype, CT_PLAYER);
-
- if (self.spawn_angry == 1)
- {
- activator = pl;
- base_monster_use_angry ();
- }
+ e.health = CORPSE_HEALTH;
+
+ // e.movetype = MOVETYPE_STEP;
+ e.movetype = MOVETYPE_TOSS;
+ e.solid = SOLID_CORPSE;
+ e.takedamage = DAMAGE_YES;
+
+ // clear targets
+ e.killtarget = e.killtarget2 = __NULL__;
+ e.pain_target = __NULL__;
+ e.target = e.target2 = e.target3 = e.target4 = __NULL__;
+
+ // clear everything but destroy and think
+ // leave e.destroy alone, the existing destroy will handle it
+ e.th_pain = sub_nullpain;
+ // leave e.think alone so e's animation can finish
+ e.touch = sub_null;
+ e.use = sub_null;
+
+ // clear monster think functions
+ e.th_melee = sub_null;
+ e.th_missile = sub_null;
+ e.th_run = sub_null;
+ e.th_stand = sub_null;
+ e.th_turret = sub_null;
+ e.th_walk = sub_null;
};
- //==============================================================
- // Initialization
- //==============================================================
-
- //--------------------------------------------------------------
- // walkmonster_start
//--------------------------------------------------------------
- void(entity e) base_walkmonster_init =
+ void(entity e) base_corpse_init =
{
- // Preach's tutorial
- if (cvar("nomonsters"))
- {
- remove (e);
- return;
- }
-
- base_monster_init (e);
-
- // Preach's tutorial
- if (base_monster_init_teleport(e, base_walkmonster_think_start))
- return;
+ base_mapentity_init (e);
+ e.classgroup |= CG_CORPSE;
- // delay drop to floor to make sure all doors have been spawned
- // spread think times so they don't all happen at same time
-
- total_monsters = total_monsters + 1;
- e.contentstransition = base_monster_contentstransition;
- e.think = base_walkmonster_think_start;
- // 1998-08-14 Monsters sometimes do not move fix
- // by Lord Sméagol start
- // e.nextthink = e.nextthink + random() * 0.5;
- e.nextthink = time + 0.1 + random() * 0.5;
- // 1998-08-14 Monsters sometimes do not move fix
- // by Lord Sméagol end
+ if (e.spawnflags & SPAWNFLAG_CORPSE_SOLID)
+ e.solid = SOLID_BBOX;
+ else
+ e.solid = SOLID_NOT;
};
//--------------------------------------------------------------
- strip void() base_walkmonster =
+ strip void() base_corpse =
{
- base_walkmonster_init (self);
+ base_corpse_init (self);
};
// };
#endif
+
Return to the top of this page or return to the overview of this repo.
Diff qc/base_proj.qc
diff --git a/qc/base_proj.qc b/qc/base_proj.qc
index d8474ab..f47cecf 100644
--- a/qc/base_proj.qc
+++ b/qc/base_proj.qc
@@ -30,7 +30,7 @@ see the files in projectiles/ for examples -- CEV
//======================================================================
#ifdef SSQC
-enum
+typedef enum
{
EXPLOSION_THINK_1, // explosion frame/think tracking
EXPLOSION_THINK_2,
@@ -39,13 +39,13 @@ enum
EXPLOSION_THINK_5,
EXPLOSION_THINK_6,
EXPLOSION_THINK_REMOVE
-};
+} base_explosion_states;
-enumflags
+typedef enumflags
{
PROJECTILE_EXPLOSIVE, // .aflag projectile options
PROJECTILE_DESTROYED
-};
+} base_projectile_flags;
const float BP_BOUNCE_BACKOFF = 1.5; // MOVETYPE_BOUNCE clipvel mult; id1 1.5
const float BP_BOUNCE_MIN_ZVEL = 60; // MOVETYPE_BOUNCE stop if _z less than
@@ -231,29 +231,16 @@ strip void() base_projectile_qcphys;
void(entity p) write_projectile_impact =
{
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
- if (p.snd_hit != __NULL__ && p.snd_hit != "")
- {
- // dumptruck_ds
- sound (p, CHAN_WEAPON, p.snd_hit,
- VOL_HIGH, ATTN_STATIC);
- WriteByte (MSG_BROADCAST, TE_GUNSHOT);
- }
- else if (p.classtype == CT_PROJECTILE_BULLET)
- {
+
+ if (p.classtype == CT_PROJECTILE_BULLET)
WriteByte (MSG_BROADCAST, TE_GUNSHOT);
- }
else if (p.classtype == CT_PROJECTILE_WIZARDMISSILE)
- {
WriteByte (MSG_BROADCAST, TE_WIZSPIKE);
- }
else if (p.classtype == CT_PROJECTILE_HKNIGHT)
- {
WriteByte (MSG_BROADCAST, TE_KNIGHTSPIKE);
- }
else
- {
WriteByte (MSG_BROADCAST, TE_SPIKE);
- }
+
WriteCoord (MSG_BROADCAST, p.origin_x);
WriteCoord (MSG_BROADCAST, p.origin_y);
WriteCoord (MSG_BROADCAST, p.origin_z);
Return to the top of this page or return to the overview of this repo.
Diff qc/base_trigger.qc
diff --git a/qc/base_trigger.qc b/qc/base_trigger.qc
index cbf2199..d1a521b 100644
--- a/qc/base_trigger.qc
+++ b/qc/base_trigger.qc
@@ -7,13 +7,15 @@
//======================================================================
#if defined(CSQC) || defined(SSQC)
-const float BASE_TRIGGER_NET_ORIGIN = 1<<0; // origin has changed
-const float BASE_TRIGGER_NET_SIZE = 1<<1; // size (mins, maxs) has changed
-const float BASE_TRIGGER_NET_STATE = 1<<2; // state has changed
-const float BASE_TRIGGER_NET_ESTATE = 1<<3; // estate has changed
-const float BASE_TRIGGER_NET_MOVEDIR = 1<<4; // movedir has changed
-const float BASE_TRIGGER_NET_SPEED = 1<<5; // speed has changed
-const float BASE_TRIGGER_NET_ANGLES = 1<<6; // angle has changed
+//----------------------------------------------------------------------
+// base_trigger netflags -- CEV
+// STATE needed for endwaiting & needs to be the same in child classes -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ NETFLAG_BASE_TRIGGER_STATE,
+ NETFLAG_BASE_TRIGGER_ESTATE
+} base_trigger_netflags;
#endif
//======================================================================
@@ -49,6 +51,10 @@ strip void() base_trigger;
if (e.is_waiting <= 0)
return;
+ if (known_release == KNOWN_RELEASE_MG1)
+ // MG1 compat -- CEV
+ return;
+
// store current use to swap later
e.olduse = e.use;
e.use = sub_endwaiting;
@@ -59,7 +65,7 @@ strip void() base_trigger;
e.classname, e.targetname, e.target));
if (e.SendEntity)
- e.SendFlags |= BASE_TRIGGER_NET_ESTATE;
+ e.SendFlags |= NETFLAG_BASE_TRIGGER_ESTATE;
};
//--------------------------------------------------------------
@@ -77,7 +83,7 @@ strip void() base_trigger;
self.is_waiting = -1;
if (self.SendEntity)
- self.SendFlags |= BASE_TRIGGER_NET_ESTATE;
+ self.SendFlags |= NETFLAG_BASE_TRIGGER_ESTATE;
};
#endif
@@ -115,17 +121,15 @@ strip void() base_trigger;
e.classgroup |= CG_TRIGGER;
+ e.solid = SOLID_TRIGGER;
+
#ifdef SSQC
- // 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.
+ // 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 (e.angles != '0 0 0')
sub_setmovedir (e);
- #endif
- e.solid = SOLID_TRIGGER;
-
- #ifdef SSQC
// set size and link into world
setmodel (e, e.model);
e.movetype = MOVETYPE_NONE;
Return to the top of this page or return to the overview of this repo.
Diff qc/cl_entry.qc
diff --git a/qc/cl_entry.qc b/qc/cl_entry.qc
index 05fc34b..5eb98b3 100644
--- a/qc/cl_entry.qc
+++ b/qc/cl_entry.qc
@@ -7,11 +7,7 @@
//======================================================================
#ifdef CSQC
-float nocsqc; // CSQC State (0=on, 1=off)
-float sitems; // CSQC copy of .items
-float sitems2; // CSQC copy of .items2 (or serverflags)
-float sweapon; // CSQC copy of .weapon
-float shealth; // CSQC copy of .health
+float skill;
float painfinishtime; // Track player damage for hud face
@@ -30,17 +26,18 @@ float sb_showscores; // Show lower tab scores
// sent to the server. frame==clientcommandframe is still being generated
// and can still change.
float clientcommandframe;
+
// This is the input-frame that was last acknowledged by the server.
// Input frames greater than this should be applied to the player's entity.
float servercommandframe;
-// Reports which ssqc entnum was hit when a csqc traceline impacts an
-// ssqc-based brush entity.
-float trace_networkentity;
+// track the command frame last processed by pmove -- CEV
+float pmovecommandframe;
-entity view_pl; // handle to the local player entity
-entity viewentity; // camera -- CEV
-vector view_origin; // origin for viewentity -- CEV
+entity view_player; // handle to the local player entity
+float view_player_commandframe; //
+entity view_entity; // camera -- CEV
+vector view_origin; // origin for view_entity -- CEV
vector view_angles; // +x=DOWN
__used var float physics_mode = 2; // 0 = not run, 1 = DP, 2 = movetypes
@@ -62,20 +59,13 @@ __used var float physics_mode = 2; // 0 = not run, 1 = DP, 2 = movetypes
.float frame1time; // absolute time into anim/framegroup
.float frame2; // alt frame visible when lerpfrac is 1
.float frame2time; // absolute time into anim/group frame2
-.float oldframe;
.float lerpfrac; // if 0 use frame1, if 1 use frame2,
.float lerptime; // mix together for values between
-.string oldskin;
-
// Called by addentities after the filter and before the entity is actually
// drawn. Do your interpolation and animation in here. Should return one of
// the PREDRAW_* constants.
.float() predraw;
-
-.void(entity e) preframe; // called before setting up view
-.void(entity e) postframe; // called after renderscene
-.void() removefunc; // called when ent removed on the server
#endif
//======================================================================
@@ -83,7 +73,7 @@ __used var float physics_mode = 2; // 0 = not run, 1 = DP, 2 = movetypes
//======================================================================
#ifdef CSQC
-void(float eid, vector start, vector end) CL_TE_Lightning2;
+void() CL_TE_Lightning2;
#endif
#ifdef CSQC
@@ -93,11 +83,11 @@ float(string cmd) CSQC_ConsoleCommand;
float(float save, float take, vector dir) CSQC_Parse_Damage;
void() CSQC_Parse_Event;
// void(string printmsg, float printlvl) CSQC_Parse_Print;
-void(entity ent) CSQC_DrawViewModel;
+void() CSQC_DrawViewModel;
void(float vwidth, float vheight, float notmenu) CSQC_UpdateView;
-float() CSQC_Parse_TempEntity;
void(float isnew) CSQC_Ent_Update;
void() CSQC_Ent_Remove;
+void() CSQC_WorldLoaded;
void(float apilevel, string enginename, float engineversion) CSQC_Init;
__wrap float(string str) CSQC_ConsoleCommand;
#endif
@@ -122,31 +112,20 @@ void() SetChangeParms = sub_null;
#ifdef CSQC
//----------------------------------------------------------------------
-void(float eid, vector start, vector end) CL_TE_Lightning2 =
+void() CL_TE_Lightning2 =
{
- // TODO CEV
- local vector org;
- local float isknown = getentity (eid, GE_ACTIVE);
+ local vector start, end;
- if (isknown)
- {
- org = getentity (eid, GE_ORIGIN);
- dprint (sprintf("CL_TE_Lightning2: known; "
- "pos %v, end %v, eid %g, org %v\n",
- start, end, eid, org));
- te_lightning2 (world, start, end);
- }
- else
- {
- if (deathmatch == 0)
- org = view_pl.origin;
- else
- org = '999 999 999';
- dprint (sprintf("CL_TE_Lightning2: unknown; "
- "pos %v, end %v, eid %g, org %v\n",
- start, end, eid, org));
- te_lightning2 (world, start, end);
- }
+ start_x = ReadCoord ();
+ start_y = ReadCoord ();
+ start_z = ReadCoord ();
+ end_x = ReadCoord ();
+ end_y = ReadCoord ();
+ end_z = ReadCoord ();
+
+ // TODO CEV
+ dprint (sprintf("CL_TE_Lightning2: time %g\n", time));
+ te_lightning2 (view_player, start, end);
};
#endif
@@ -252,13 +231,16 @@ void() CSQC_Parse_Event =
switch (event)
{
case EVENT_INTERMISSION:
- intermission = ReadFloat ();
+ intermission = ReadByte ();
return;
case EVENT_CSHIFT_FADE:
- csf_fade_netreceive (view_pl);
+ csf_fade_netreceive (view_player);
return;
case EVENT_CSHIFT_SET:
- csf_set_netreceive (view_pl);
+ csf_set_netreceive (view_player);
+ return;
+ case EVENT_LIGHTNING2:
+ CL_TE_Lightning2 ();
return;
default:
dprint ("CSQC_Parse_Event: received unknown event "
@@ -283,35 +265,119 @@ void(string printmsg, float printlvl) CSQC_Parse_Print =
//----------------------------------------------------------------------
// TODO CEV
//----------------------------------------------------------------------
-void(entity ent) CSQC_DrawViewModel =
+void() CSQC_DrawViewModel =
{
- local float newframe, newmodel;
+ // don't draw viewmodel when the player is climbing -- CEV
+ if (view_player.pm_flags & PMF_CLIMB)
+ return;
+
+ // don't draw viewmodel when climbing a ladder -- CEV
+ if (view_player.pm_flags & PMF_ONLADDER)
+ return;
- newframe = getstatf (STAT_WEAPONFRAME);
- newmodel = getstatf (STAT_WEAPONMODELI);
+ local float newframe = view_player.weaponframe;
- if (newmodel != ent.modelindex)
+ local float view_entity_item_index = 0;
+ switch (view_entity.weapon)
+ {
+ case 1: view_entity_item_index = view_entity.inventory1; break;
+ case 2: view_entity_item_index = view_entity.inventory2; break;
+ case 3: view_entity_item_index = view_entity.inventory3; break;
+ case 4: view_entity_item_index = view_entity.inventory4; break;
+ case 5: view_entity_item_index = view_entity.inventory5; break;
+ case 6: view_entity_item_index = view_entity.inventory6; break;
+ case 7: view_entity_item_index = view_entity.inventory7; break;
+ case 8: view_entity_item_index = view_entity.inventory8; break;
+ }
+
+ local float view_player_item_index = 0;
+ switch (view_player.weapon)
+ {
+ case 1: view_player_item_index = view_player.inventory1; break;
+ case 2: view_player_item_index = view_player.inventory2; break;
+ case 3: view_player_item_index = view_player.inventory3; break;
+ case 4: view_player_item_index = view_player.inventory4; break;
+ case 5: view_player_item_index = view_player.inventory5; break;
+ case 6: view_player_item_index = view_player.inventory6; break;
+ case 7: view_player_item_index = view_player.inventory7; break;
+ case 8: view_player_item_index = view_player.inventory8; break;
+ }
+
+ local item_info_t item = item_info[view_player_item_index];
+
+ if (view_player.weapon != view_entity.weapon ||
+ view_player_item_index != view_entity_item_index)
{
// changed entirely
- ent.modelindex = newmodel;
- ent.frame2 = ent.frame = newframe;
- ent.lerptime = time;
+ view_entity.weapon = view_player.weapon;
+ switch (view_player.weapon)
+ {
+ case 1: view_entity.inventory1 = view_player.inventory1;
+ break;
+ case 2: view_entity.inventory2 = view_player.inventory2;
+ break;
+ case 3: view_entity.inventory3 = view_player.inventory3;
+ break;
+ case 4: view_entity.inventory4 = view_player.inventory4;
+ break;
+ case 5: view_entity.inventory5 = view_player.inventory5;
+ break;
+ case 6: view_entity.inventory6 = view_player.inventory6;
+ break;
+ case 7: view_entity.inventory7 = view_player.inventory7;
+ break;
+ case 8: view_entity.inventory8 = view_player.inventory8;
+ break;
+ }
+
+ #if 0
+ dprint (sprintf("CSQC_DrawViewModel: .weapon %g, "
+ "index %g, frame %g, viewmodel %s\n",
+ view_player.weapon, view_player_item_index,
+ newframe, item.view_model));
+ #endif
+
+ // need to grab skin from item.option for armor -- CEV
+ if (view_player_item_index >= ITEM_SEQ_ARMOR_GREEN &&
+ view_player_item_index <= ITEM_SEQ_ARMOR_SHARD)
+ {
+ view_entity.skin = item.option;
+ }
+ else if (view_entity.skin)
+ {
+ view_entity.skin = 0;
+ }
+
+ view_entity.frame2 = view_entity.frame = newframe;
+ view_entity.lerptime = time;
+ setmodel (view_entity, item.view_model);
}
- else if (newframe != ent.frame)
+ else if (newframe != view_entity.frame)
{
- ent.frame2 = ent.frame;
- ent.frame = newframe;
- ent.lerptime = time;
+ view_entity.frame2 = view_entity.frame;
+ view_entity.frame = newframe;
+ view_entity.lerptime = time;
}
- ent.lerpfrac = 1 - (time - ent.lerptime) * 10;
+ view_entity.lerpfrac = 1 - (time - view_entity.lerptime) * 10;
// apply user's configured viewmodel offset -- CEV
- ent.origin = [0 + autocvar(cl_gunx, 0), 0 + autocvar(cl_guny, 0),
- 0 + autocvar(cl_gunz, 0)];
- ent.angles = '0 0 0';
-
- addentity (ent);
+ // TODO CEV this has gotta be slow
+ view_entity.origin = [
+ item.view_origin_offset.x + autocvar(cl_gunx, 0),
+ item.view_origin_offset.y + autocvar(cl_guny, 0),
+ item.view_origin_offset.z + autocvar(cl_gunz, 0)];
+ view_entity.angles = [
+ item.view_angles_offset.x + autocvar(cl_gunanglex, 0),
+ item.view_angles_offset.y + autocvar(cl_gunangley, 0),
+ item.view_angles_offset.z + autocvar(gl_gunanglez, 0)];
+
+ if (view_player.items & IT_INVISIBILITY)
+ view_entity.alpha = 0.5f;
+ else if (view_entity.alpha == 0.5f)
+ view_entity.alpha = 1.0f;
+
+ addentity (view_entity);
};
//----------------------------------------------------------------------
@@ -319,28 +385,24 @@ void(float vwidth, float vheight, float notmenu) CSQC_UpdateView =
{
local vector ssize = [vwidth, vheight, 0];
- // Is the CSQC functionality enabled/disabled?
- nocsqc = cvar ("cl_nocsqc");
-
clearscene ();
setproperty (VF_MIN, '0 0');
setproperty (VF_SIZE, ssize);
+ setproperty (VF_DRAWENGINESBAR, FALSE);
- // If hud is disabled, draw engine hud instead
- setproperty (VF_DRAWENGINESBAR, nocsqc);
-
- if (view_pl)
+ if (view_player)
{
- player_prediction_preframe (view_pl);
+ view_player.renderflags |= RF_EXTERNALMODEL;
+ addentities (DRAWMASK_ENGINE | DRAWMASK_NORMAL);
// read our smoothed & predicted view origin
setproperty (VF_ORIGIN, view_origin);
+ makevectors (view_angles);
+
if (intermission)
{
- makevectors (view_angles);
-
// camera wobble
view_angles_x += autocvar(v_ipitch_level, 0.3) *
sin(time * autocvar(v_ipitch_cycle, 1));
@@ -355,28 +417,18 @@ void(float vwidth, float vheight, float notmenu) CSQC_UpdateView =
}
else
{
- // view_angle adjustments performed in
- // player_prediction_preframe -- CEV
+ // view_angle adjustments done in player_predraw -- CEV
+ setproperty (VF_DRAWCROSSHAIR, TRUE);
setproperty (VF_ANGLES, view_angles);
-
- // v_forward et al should still match the makevectors
- // call in player_prediction_preframe -- CEV
SetListener (view_origin, v_forward, v_right, v_up);
- // draw view model when not invisible
- if (!(sitems & IT_INVISIBILITY))
+ // draw view model when not invisible & when alive
+ if (view_player.health > 0)
{
- setproperty (VF_VIEWENTITY, viewentity.entnum);
- CSQC_DrawViewModel (viewentity);
+ setproperty (VF_VIEWENTITY, view_player.entnum);
+ CSQC_DrawViewModel ();
}
-
- setproperty (VF_DRAWCROSSHAIR, TRUE);
}
-
- addentities (DRAWMASK_ENGINE | DRAWMASK_NORMAL);
- renderscene ();
-
- player_prediction_postframe (view_pl);
}
else
{
@@ -392,34 +444,19 @@ void(float vwidth, float vheight, float notmenu) CSQC_UpdateView =
addentities (DRAWMASK_ENGINE | DRAWMASK_VIEWMODEL |
DRAWMASK_NORMAL);
}
- renderscene ();
}
+ renderscene ();
+
#if 0
local entity t = world;
while ((t = nextent(t)))
{
- dprint (sprintf("CSQC_UpdateView: found %s, model %s\n",
- t.classname, modelnameforindex(t.modelindex)));
+ dprint (sprintf("CSQC_UpdateView: found %s num %g, model %s\n",
+ t.classname, t.entnum, modelnameforindex(t.modelindex)));
}
#endif
- #if 0
- local float count = getentity (0, -1);
- local float i;
- for (i = 0; i < count; i++)
- {
- if (getentity(i, GE_ACTIVE))
- dprint (sprintf("CSQC_UpdateView: CSQC ent num %g, "
- "origin %v\n",
- i, getentity (i, GE_ORIGIN)));
- }
- #endif
-
- // Revert back to using engine HUD?
- if (nocsqc > 0)
- return;
-
// Used on intermission screen later
if (!intermission)
intermission_time = time;
@@ -436,71 +473,85 @@ void(float vwidth, float vheight, float notmenu) CSQC_UpdateView =
};
//----------------------------------------------------------------------
-// Handle SVC_TEMPENTITY data from the server -- CEV
-//
-// Based on code by PrimalLove found at:
-// https://forums.insideqc.com/viewtopic.php?p=55772#p55772
-//----------------------------------------------------------------------
-float() CSQC_Parse_TempEntity =
-{
- local float teid = ReadByte ();
-
- switch (teid)
- {
- case TE_LIGHTNING2:
- local float eid = ReadEntityNum ();
- local vector lgpos, lgend;
- lgpos_x = ReadCoord ();
- lgpos_y = ReadCoord ();
- lgpos_z = ReadCoord ();
- lgend_x = ReadCoord ();
- lgend_y = ReadCoord ();
- lgend_z = ReadCoord ();
-
- // TODO CEV fix FTE particle effect te_lightning2
- CL_TE_Lightning2 (eid, lgpos, lgend);
-
- return TRUE;
- default:
- return FALSE;
- }
-
- return FALSE;
-};
-
-//----------------------------------------------------------------------
// Handle incoming MSG_ENTITY data from the server
// Entities are networked in this way either because they need movement
// prediction or they can affect movement prediction -- CEV
//----------------------------------------------------------------------
void(float isnew) CSQC_Ent_Update =
{
- local float type = ReadShort ();
+ local float ctype = ReadByte ();
- if (self.classtype && self.classtype != type)
+ if (self.classtype && self.classtype != ctype)
{
- if (self.classtype != type)
+ if (self.classtype != ctype)
{
dprint (sprintf("CSQC_Ent_Update: classtype "
- "mismatch, calling removefunc for entity "
- "of type %s\n", self.classname));
+ "mismatch, cleaning up etype %g num %g\n",
+ ctype, self.entnum));
+
+ // TODO CEV
+ if (view_player == self)
+ view_player = world;
+
+ setmodel (self, "");
+ self.predraw = __NULL__;
+
+ if (self.queflag)
+ base_entity_que_rem (self, self.queflag);
- if (self.removefunc)
- self.removefunc ();
isnew = TRUE;
- self.classtype = type;
+ self.classtype = ctype;
}
}
else
{
- self.classtype = type;
+ self.classtype = ctype;
}
switch (self.classtype)
{
+ case CT_PLAYER:
+ player_netreceive (isnew);
+ return;
+ case CT_FUNC_BOB:
+ case CT_MISC_BOB:
+ base_func_bob_netreceive (isnew);
+ return;
+ case CT_FUNC_BOSSGATE:
+ func_bossgate_netreceive (isnew);
+ return;
+ case CT_FUNC_BUTTON:
+ func_button_netreceive (isnew);
+ return;
case CT_FUNC_DOOR:
func_door_netreceive (isnew);
return;
+ case CT_FUNC_DOOR_SECRET:
+ func_door_secret_netreceive (isnew);
+ return;
+ case CT_FUNC_ELVTR_BUTTON:
+ func_elvtr_button_netreceive (isnew);
+ return;
+ case CT_FUNC_EPISODEGATE:
+ func_episodegate_netreceive (isnew);
+ return;
+ case CT_FUNC_EXPLOBOX:
+ func_explobox_netreceive (isnew);
+ return;
+ case CT_FUNC_FALL:
+ func_fall_netreceive (isnew);
+ return;
+ case CT_FUNC_FALL2:
+ func_fall2_netreceive (isnew);
+ return;
+ #if 0
+ case CT_FUNC_ILLUSIONARY:
+ func_illusionary_netreceive (isnew);
+ return;
+ #endif
+ case CT_FUNC_LASER:
+ func_laser_netreceive (isnew);
+ return;
case CT_FUNC_MOVEWALL:
func_movewall_netreceive (isnew);
return;
@@ -510,12 +561,157 @@ void(float isnew) CSQC_Ent_Update =
case CT_FUNC_PLAT:
func_plat_netreceive (isnew);
return;
+ case CT_FUNC_ROTATE_DOOR:
+ func_rotate_door_netreceive (isnew);
+ return;
+ case CT_FUNC_ROTATE_ENTITY:
+ func_rotate_entity_netreceive (isnew);
+ return;
+ case CT_FUNC_ROTATE_TRAIN:
+ func_rotate_train_netreceive (isnew);
+ return;
+ case CT_FUNC_TOGGLEVISIBLEWALL:
+ func_togglevisiblewall_netreceive (isnew);
+ return;
case CT_FUNC_TOGGLEWALL:
func_togglewall_netreceive (isnew);
return;
case CT_FUNC_TRAIN:
func_train_netreceive (isnew);
return;
+ case CT_FUNC_WALL:
+ func_wall_netreceive (isnew);
+ return;
+ case CT_ITEM_AMMO_CELLS:
+ item_cells_netreceive (isnew);
+ return;
+ case CT_ITEM_AMMO_ROCKETS:
+ item_rockets_netreceive (isnew);
+ return;
+ case CT_ITEM_AMMO_SHELLS:
+ item_shells_netreceive (isnew);
+ return;
+ case CT_ITEM_AMMO_SPIKES:
+ item_spikes_netreceive (isnew);
+ return;
+ case CT_ITEM_ARMOR_GREEN:
+ item_armor1_netreceive (isnew);
+ return;
+ case CT_ITEM_ARMOR_YELLOW:
+ item_armor2_netreceive (isnew);
+ return;
+ case CT_ITEM_ARMOR_RED:
+ item_armorInv_netreceive (isnew);
+ return;
+ case CT_ITEM_ARMOR_SHARD:
+ item_armor_shard_netreceive (isnew);
+ return;
+ case CT_ITEM_AXE:
+ weapon_axe_netreceive (isnew);
+ return;
+ case CT_ITEM_BACKPACK:
+ item_backpack_netreceive (isnew);
+ return;
+ case CT_ITEM_ENVIROSUIT:
+ item_artifact_envirosuit_netreceive (isnew);
+ return;
+ case CT_ITEM_GIB1:
+ base_item_gib_netreceive (isnew, item_gib1_init);
+ return;
+ case CT_ITEM_GIB2:
+ base_item_gib_netreceive (isnew, item_gib2_init);
+ return;
+ case CT_ITEM_GIB3:
+ base_item_gib_netreceive (isnew, item_gib3_init);
+ return;
+ case CT_ITEM_GRENADE_LAUNCHER:
+ weapon_grenadelauncher_netreceive (isnew);
+ return;
+ case CT_ITEM_HEAD_ARMY:
+ base_item_gib_netreceive (isnew, item_head_army_init);
+ return;
+ case CT_ITEM_HEAD_DEMON:
+ base_item_gib_netreceive (isnew, item_head_demon_init);
+ return;
+ case CT_ITEM_HEAD_DOG:
+ base_item_gib_netreceive (isnew, item_head_dog_init);
+ return;
+ case CT_ITEM_HEAD_ENFORCER:
+ base_item_gib_netreceive (isnew,
+ item_head_enforcer_init);
+ return;
+ case CT_ITEM_HEAD_HELLKNIGHT:
+ base_item_gib_netreceive (isnew,
+ item_head_hell_knight_init);
+ return;
+ case CT_ITEM_HEAD_KNIGHT:
+ base_item_gib_netreceive (isnew, item_head_knight_init);
+ return;
+ case CT_ITEM_HEAD_OGRE:
+ base_item_gib_netreceive (isnew, item_head_ogre_init);
+ return;
+ case CT_ITEM_HEAD_PLAYER:
+ base_item_gib_netreceive (isnew, item_head_player_init);
+ return;
+ case CT_ITEM_HEAD_SHALRATH:
+ base_item_gib_netreceive (isnew,
+ item_head_shalrath_init);
+ return;
+ case CT_ITEM_HEAD_SHAMBLER:
+ base_item_gib_netreceive (isnew,
+ item_head_shambler_init);
+ return;
+ case CT_ITEM_HEAD_WIZARD:
+ base_item_gib_netreceive (isnew, item_head_wizard_init);
+ return;
+ case CT_ITEM_HEAD_ZOMBIE:
+ base_item_gib_netreceive (isnew, item_head_zombie_init);
+ return;
+ case CT_ITEM_HEALTH:
+ item_health_netreceive (isnew);
+ return;
+ case CT_ITEM_HEALTH_VIAL:
+ item_health_vial_netreceive (isnew);
+ return;
+ case CT_ITEM_INVISIBILITY:
+ item_artifact_invisibility_netreceive (isnew);
+ return;
+ case CT_ITEM_INVULNERABILITY:
+ item_artifact_invulnerability_netreceive (isnew);
+ return;
+ case CT_ITEM_KEY1:
+ item_key1_netreceive (isnew);
+ return;
+ case CT_ITEM_KEY2:
+ item_key2_netreceive (isnew);
+ return;
+ case CT_ITEM_KEY_CUSTOM:
+ item_key_custom_netreceive (isnew);
+ return;
+ case CT_ITEM_LIGHTNING_GUN:
+ weapon_lightning_netreceive (isnew);
+ return;
+ case CT_ITEM_NAILGUN:
+ weapon_nailgun_netreceive (isnew);
+ return;
+ case CT_ITEM_QUAD:
+ item_artifact_super_damage_netreceive (isnew);
+ return;
+ case CT_ITEM_ROCKET_LAUNCHER:
+ weapon_rocketlauncher_netreceive (isnew);
+ return;
+ case CT_ITEM_RUNE:
+ item_sigil_netreceive (isnew);
+ return;
+ case CT_ITEM_SHOTGUN:
+ weapon_shotgun_netreceive (isnew);
+ return;
+ case CT_ITEM_SUPER_NAILGUN:
+ weapon_supernailgun_netreceive (isnew);
+ return;
+ case CT_ITEM_SUPER_SHOTGUN:
+ weapon_supershotgun_netreceive (isnew);
+ return;
case CT_MISC_EXPLOBOX:
case CT_MISC_EXPLOBOX2:
base_explobox_netreceive (isnew);
@@ -523,8 +719,62 @@ void(float isnew) CSQC_Ent_Update =
case CT_MISC_MODEL:
base_misc_model_netreceive (isnew);
return;
- case CT_PLAYER:
- player_netreceive (isnew);
+ case CT_MISC_ROTATE_OBJECT:
+ rotate_object_netreceive (isnew);
+ return;
+ case CT_MISC_ROTATE_OBJECT_CONTINUOUSLY:
+ rotate_object_continuously_netreceive (isnew);
+ return;
+ case CT_MONSTER_BOSS_CHTHON:
+ monster_boss_netreceive (isnew);
+ return;
+ case CT_MONSTER_BOSS_CHTHON2:
+ monster_boss2_netreceive (isnew);
+ return;
+ case CT_MONSTER_BOSS_OLDONE:
+ monster_oldone_netreceive (isnew);
+ return;
+ case CT_MONSTER_BOSS_OLDONE2:
+ monster_oldone2_netreceive (isnew);
+ return;
+ case CT_MONSTER_DEATHKNIGHT:
+ monster_hell_knight_netreceive (isnew);
+ return;
+ case CT_MONSTER_DOG:
+ monster_dog_netreceive (isnew);
+ return;
+ case CT_MONSTER_ENFORCER:
+ monster_enforcer_netreceive (isnew);
+ return;
+ case CT_MONSTER_FIEND:
+ monster_demon1_netreceive (isnew);
+ return;
+ case CT_MONSTER_FISH:
+ monster_fish_netreceive (isnew);
+ return;
+ case CT_MONSTER_GRUNT:
+ monster_army_netreceive (isnew);
+ return;
+ case CT_MONSTER_KNIGHT:
+ monster_knight_netreceive (isnew);
+ return;
+ case CT_MONSTER_OGRE:
+ monster_ogre_netreceive (isnew);
+ return;
+ case CT_MONSTER_OGRE_MARKSMAN:
+ monster_ogre_marksman_netreceive (isnew);
+ return;
+ case CT_MONSTER_SCRAG:
+ monster_wizard_netreceive (isnew);
+ return;
+ case CT_MONSTER_SHAMBLER:
+ monster_shambler_netreceive (isnew);
+ return;
+ case CT_MONSTER_VORE:
+ monster_shalrath_netreceive (isnew);
+ return;
+ case CT_MONSTER_ZOMBIE:
+ monster_zombie_netreceive (isnew);
return;
case CT_TRIGGER_LADDER:
trigger_ladder_netreceive (isnew);
@@ -536,6 +786,13 @@ void(float isnew) CSQC_Ent_Update =
case CT_TRIGGER_SETGRAVITY:
trigger_setgravity_netreceive (isnew);
return;
+ case CT_TRIGGER_TELEPORT:
+ trigger_teleport_netreceive (isnew);
+ return;
+ default:
+ dprint (sprintf("CSQC_Ent_Update: received unknown "
+ "classtype %f!\n", self.classtype));
+ return;
}
};
@@ -544,9 +801,15 @@ void(float isnew) CSQC_Ent_Update =
//----------------------------------------------------------------------
void() CSQC_Ent_Remove =
{
- if (self.removefunc)
- self.removefunc ();
- remove (self);
+ /*
+ if (view_player == self)
+ view_player = world;
+ */
+
+ setmodel (self, "");
+ self.predraw = __NULL__;
+
+ base_entity_remove (self);
};
//----------------------------------------------------------------------
@@ -590,13 +853,6 @@ void(float apilevel, string enginename, float engineversion) CSQC_Init =
{
local float i, wadonly;
- // Is the CSQC functionality enabled/disabled?
- nocsqc = cvar ("cl_nocsqc");
-
- // Revert back to using engine HUD?
- if (nocsqc > 0)
- return;
-
// precache from gfx.wad ONLY!?!
wadonly = TRUE;
@@ -639,19 +895,6 @@ void(float apilevel, string enginename, float engineversion) CSQC_Init =
precache_pic(strcat(wpnflash[4], wpnnames[i]), wadonly);
}
}
-
- // TODO CEV
- // precache_model ("progs/player.mdl");
-
- // spawn the view entity now -- CEV
- if (!viewentity)
- {
- viewentity = spawn ();
- viewentity.classname = "viewentity";
- viewentity.renderflags = RF_DEPTHHACK | RF_NOSHADOW |
- RF_VIEWMODEL;
- viewentity.think = sub_null;
- }
};
//----------------------------------------------------------------------
Return to the top of this page or return to the overview of this repo.
Diff qc/cl_hud.qc
diff --git a/qc/cl_hud.qc b/qc/cl_hud.qc
index 79075ce..075bc6f 100644
--- a/qc/cl_hud.qc
+++ b/qc/cl_hud.qc
@@ -321,21 +321,21 @@ void(vector pos) Hud_DrawFace =
local float hpframe;
// Start with InvRing as it has two states
- if (sitems & IT_INVISIBILITY)
+ if (view_player.items & IT_INVISIBILITY)
{
- if (sitems & IT_INVULNERABILITY)
+ if (view_player.items & IT_INVULNERABILITY)
// InvRing + Pentagram!?! WTF!?! SandyP E4 design!
face = facetab[10];
else
// Just InvRing only
face = facetab[12];
}
- else if (sitems & IT_QUAD)
+ else if (view_player.items & IT_QUAD)
{
// Quad only
face = facetab[11];
}
- else if (sitems & IT_INVULNERABILITY)
+ else if (view_player.items & IT_INVULNERABILITY)
{
// Pentagram only
face = facetab[13];
@@ -344,7 +344,7 @@ void(vector pos) Hud_DrawFace =
{
// Regular face
// Work out face based on HP (100/80/60/40/20)
- hpframe = floor (shealth / 20);
+ hpframe = floor (view_player.health / 20);
// Check for negative and upper (MegaHP) limits
if (hpframe < 0)
@@ -383,10 +383,13 @@ static void(float num, vector pos) Hud_DrawWeapon =
if (flash >= 10)
{
// Work out if this weapon is currently selected
- if (sweapon == (1 << num))
+ // TODO CEV
+ /*
+ if (view_player.weapon == (1 << num))
prefix = wpnselect[1];
// Default is no highlight
else
+ */
prefix = wpnselect[0];
}
else
@@ -428,7 +431,7 @@ void (vector pos, vector virtsize) Hud_DrawSBar =
drawpic (pos, backgrd[0], HUDSIZE_320, HUDRGB_DEF, baralpha, 0);
// Deal with Pentagram first, its a simple test/update
- if (sitems & IT_INVULNERABILITY)
+ if (view_player.items & IT_INVULNERABILITY)
{
// Make sure 666 is in 24 pixel giant red numbers!
Hud_DrawNoFont24 (pos + [24, 0], 666, 666);
@@ -438,39 +441,80 @@ void (vector pos, vector virtsize) Hud_DrawSBar =
else
{
// Show armour type/quantity active
- Hud_DrawNoFont24 (pos + '24 0 0', getstatf(STAT_ARMOR), 25);
+ Hud_DrawNoFont24 (pos + '24 0 0', view_player.armorvalue, 25);
// Only 3 armour types (green/yellow/red)
- if (sitems & IT_ARMOR1)
+ if (view_player.items & IT_ARMOR1)
drawpic (pos, sbitems[4], HUDSIZE_24, HUDRGB_DEF,
hudalpha, 0);
- else if (sitems & IT_ARMOR2)
+ else if (view_player.items & IT_ARMOR2)
drawpic (pos, sbitems[5], HUDSIZE_24, HUDRGB_DEF,
hudalpha, 0);
- else if (sitems & IT_ARMOR3)
+ else if (view_player.items & IT_ARMOR3)
drawpic (pos, sbitems[6], HUDSIZE_24, HUDRGB_DEF,
hudalpha, 0);
}
// Draw face + HP value
Hud_DrawFace (pos + [112, 0]);
- Hud_DrawNoFont24 (pos + [136, 0], shealth, 25);
+ Hud_DrawNoFont24 (pos + [136, 0], view_player.health, 25);
// Only update ammo type/quantity if not using axe!
- if (sweapon != IT_AXE)
+ // TODO CEV
+ BASE_ENTITY_WEAPONLOOKUP (view_player)
+ if (item_index != ITEM_SEQ_AXE)
{
- Hud_DrawNoFont24 (pos + [248, 0], getstatf(STAT_AMMO), 10);
- if (sitems & IT_SHELLS)
- drawpic (pos + [224, 0], sbitems[0], HUDSIZE_24,
- HUDRGB_DEF, hudalpha, 0);
- else if (sitems & IT_NAILS)
- drawpic (pos + [224, 0], sbitems[1], HUDSIZE_24,
- HUDRGB_DEF, hudalpha, 0);
- else if (sitems & IT_ROCKETS)
- drawpic (pos + [224, 0], sbitems[2], HUDSIZE_24,
- HUDRGB_DEF, hudalpha, 0);
- else if (sitems & IT_CELLS)
- drawpic (pos + [224, 0], sbitems[3], HUDSIZE_24,
- HUDRGB_DEF, hudalpha, 0);
+ switch (item_index)
+ {
+ // id1 weapons
+ case ITEM_SEQ_SHOTGUN:
+ case ITEM_SEQ_SUPERSHOTGUN:
+ Hud_DrawNoFont24 (pos + [248, 0],
+ view_player.ammo_shells, 10);
+ drawpic (pos + [224, 0], sbitems[0], HUDSIZE_24,
+ HUDRGB_DEF, hudalpha, 0);
+ break;
+ case ITEM_SEQ_NAILGUN:
+ case ITEM_SEQ_SUPERNAILGUN:
+ Hud_DrawNoFont24 (pos + [248, 0],
+ view_player.ammo_nails, 10);
+ drawpic (pos + [224, 0], sbitems[1], HUDSIZE_24,
+ HUDRGB_DEF, hudalpha, 0);
+ break;
+ case ITEM_SEQ_GRENADELAUNCHER:
+ case ITEM_SEQ_ROCKETLAUNCHER:
+ Hud_DrawNoFont24 (pos + [248, 0],
+ view_player.ammo_rockets, 10);
+ drawpic (pos + [224, 0], sbitems[2], HUDSIZE_24,
+ HUDRGB_DEF, hudalpha, 0);
+ break;
+ case ITEM_SEQ_LIGHTNINGGUN:
+ Hud_DrawNoFont24 (pos + [248, 0],
+ view_player.ammo_cells, 10);
+ drawpic (pos + [224, 0], sbitems[3], HUDSIZE_24,
+ HUDRGB_DEF, hudalpha, 0);
+ break;
+ // id1 ammo
+ case ITEM_SEQ_AMMO_SHELLS_SMALL:
+ case ITEM_SEQ_AMMO_SHELLS_LARGE:
+ drawpic (pos + [224, 0], sbitems[0], HUDSIZE_24,
+ HUDRGB_DEF, hudalpha, 0);
+ break;
+ case ITEM_SEQ_AMMO_NAILS_SMALL:
+ case ITEM_SEQ_AMMO_NAILS_LARGE:
+ drawpic (pos + [224, 0], sbitems[1], HUDSIZE_24,
+ HUDRGB_DEF, hudalpha, 0);
+ break;
+ case ITEM_SEQ_AMMO_ROCKETS_SMALL:
+ case ITEM_SEQ_AMMO_ROCKETS_LARGE:
+ drawpic (pos + [224, 0], sbitems[2], HUDSIZE_24,
+ HUDRGB_DEF, hudalpha, 0);
+ break;
+ case ITEM_SEQ_AMMO_CELLS_SMALL:
+ case ITEM_SEQ_AMMO_CELLS_LARGE:
+ drawpic (pos + [224, 0], sbitems[3], HUDSIZE_24,
+ HUDRGB_DEF, hudalpha, 0);
+ break;
+ }
}
};
@@ -486,62 +530,66 @@ void (vector pos, vector br) Hud_DrawIBar =
drawpic (pos, backgrd[1], HUDSIZE_320, HUDRGB_DEF, baralpha, 0);
// Always draw ammo scores
- Hud_DrawNoFont8 (pos + [10, 0], getstatf(STAT_SHELLS), 3,
+ // TODO CEV
+ Hud_DrawNoFont8 (pos + [10, 0], view_player.ammo_shells, 3,
FALSE, HUDFONT_YELLOW);
- Hud_DrawNoFont8 (pos + [58, 0], getstatf(STAT_NAILS), 3,
+ Hud_DrawNoFont8 (pos + [58, 0], view_player.ammo_nails, 3,
FALSE, HUDFONT_YELLOW);
- Hud_DrawNoFont8 (pos + [106, 0], getstatf(STAT_ROCKETS), 3,
+ Hud_DrawNoFont8 (pos + [106, 0], view_player.ammo_rockets, 3,
FALSE, HUDFONT_YELLOW);
- Hud_DrawNoFont8 (pos + [154, 0], getstatf(STAT_CELLS), 3,
+ Hud_DrawNoFont8 (pos + [154, 0], view_player.ammo_cells, 3,
FALSE, HUDFONT_YELLOW);
// Draw weapons and highlight current one
- if (sitems & IT_SHOTGUN)
+ // TODO CEV
+ /*
+ if (view_player.items & IT_SHOTGUN)
Hud_DrawWeapon (0, pos + [24 * 0, 8]);
- if (sitems & IT_SUPER_SHOTGUN)
+ if (view_player.items & IT_SUPER_SHOTGUN)
Hud_DrawWeapon (1, pos + [24 * 1, 8]);
- if (sitems & IT_NAILGUN)
+ if (view_player.items & IT_NAILGUN)
Hud_DrawWeapon (2, pos + [24 * 2, 8]);
- if (sitems & IT_SUPER_NAILGUN)
+ if (view_player.items & IT_SUPER_NAILGUN)
Hud_DrawWeapon (3, pos + [24 * 3, 8]);
- if (sitems & IT_GRENADE_LAUNCHER)
+ if (view_player.items & IT_GRENADE_LAUNCHER)
Hud_DrawWeapon (4, pos + [24 * 4, 8]);
- if (sitems & IT_ROCKET_LAUNCHER)
+ if (view_player.items & IT_ROCKET_LAUNCHER)
Hud_DrawWeapon (5, pos + [24 * 5, 8]);
- if (sitems & IT_LIGHTNING)
+ if (view_player.items & IT_LIGHTNING)
Hud_DrawWeapon (6, pos + [24 * 6, 8]);
+ */
// Draw inventory items
- if (sitems & IT_KEY1)
+ if (view_player.items & IT_KEY1)
drawpic (pos + [192, 8], ibitems[0], HUDSIZE_16, HUDRGB_DEF,
hudalpha, 0);
- if (sitems & IT_KEY2)
+ if (view_player.items & IT_KEY2)
drawpic (pos + [208, 8], ibitems[1], HUDSIZE_16, HUDRGB_DEF,
hudalpha, 0);
- if (sitems & IT_INVISIBILITY)
+ if (view_player.items & IT_INVISIBILITY)
drawpic (pos + [224, 8], ibitems[2], HUDSIZE_16, HUDRGB_DEF,
hudalpha, 0);
- if (sitems & IT_INVULNERABILITY)
+ if (view_player.items & IT_INVULNERABILITY)
drawpic (pos + [240, 8], ibitems[3], HUDSIZE_16, HUDRGB_DEF,
hudalpha, 0);
- if (sitems & IT_SUIT)
+ if (view_player.items & IT_SUIT)
drawpic (pos + [256, 8], ibitems[4], HUDSIZE_16, HUDRGB_DEF,
hudalpha, 0);
- if (sitems & IT_QUAD)
+ if (view_player.items & IT_QUAD)
drawpic (pos + [272, 8], ibitems[5], HUDSIZE_16, HUDRGB_DEF,
hudalpha, 0);
// Draw Runes (special size + location)
- if (sitems2 & SERVERFLAGS_RUNE1)
+ if (view_player.items & IT_RUNE1)
drawpic (pos + [288, 8], ibrunes[0], HUDSIZE_816, HUDRGB_DEF,
hudalpha, 0);
- if (sitems2 & SERVERFLAGS_RUNE2)
+ if (view_player.items & IT_RUNE2)
drawpic (pos + [296, 8], ibrunes[1], HUDSIZE_816, HUDRGB_DEF,
hudalpha, 0);
- if (sitems2 & SERVERFLAGS_RUNE3)
+ if (view_player.items & IT_RUNE3)
drawpic (pos + [304, 8], ibrunes[2], HUDSIZE_816, HUDRGB_DEF,
hudalpha, 0);
- if (sitems2 & SERVERFLAGS_RUNE4)
+ if (view_player.items & IT_RUNE4)
drawpic (pos + [312, 8], ibrunes[3], HUDSIZE_816, HUDRGB_DEF,
hudalpha, 0);
@@ -918,7 +966,8 @@ void(vector pos) Hud_InputMonitor =
//----------------------------------------------------------------------
void(vector pos) Hud_Speedometer =
{
- Hud_DrawNoFont8 (pos, floor(view_pl.speed), 4, FALSE, HUDFONT_WHITE);
+ Hud_DrawNoFont8 (pos, floor(view_player.speed), 4, FALSE,
+ HUDFONT_WHITE);
};
//----------------------------------------------------------------------
@@ -930,24 +979,10 @@ void(vector virtsize, float showscores) CSQC_DrawHud =
local float oitems, hudviewsize, i;
// Save previous HUD versions for flash function
- oitems = sitems;
-
- //------------------------------------------------------------------
- // All variables have to be specially setup and passed between
- // progs and csprogs as they are not connected in VM space
- // By default CSQC has 30 (most commonly used) parameters setup
- // Unfortunately some of them need to be converted (bitswapped)
- // to make them readable again (I blame spike for this mess)
- // The downside to this bitswapping mess is that the serverflags
- // is not passed to CSQC completely, only the first 4bits (runes)
- //------------------------------------------------------------------
- sitems = getstatf (STAT_ITEMS, 0, 23);
- sitems2 = getstatf (STAT_ITEMS, 23, 9);
- sweapon = getstatf (STAT_ACTIVEWEAPON);
- shealth = getstatf (STAT_HEALTH);
+ oitems = view_player.items;
// Don't show HUD, intermission or dead
- if (intermission || shealth <= 0)
+ if (intermission || view_player.health <= 0)
return;
//--------------------------------------------------------------
@@ -965,15 +1000,18 @@ void(vector virtsize, float showscores) CSQC_DrawHud =
if (numclientseats <= 1)
{
// Player alive and inventory changd?
- if (shealth && sitems != oitems)
+ if (view_player.health && view_player.items != oitems)
{
// Go through all weapon flash counters
for (i = 0; i < WPN_ICONS; i++)
{
// Found weapon and its new?
- if ((sitems & (1<<i)) && !(oitems & (1<<i)))
+ if ((view_player.items & (1<<i)) &&
+ !(oitems & (1<<i)))
+ {
// Reset timer
flashtime[i] = time;
+ }
}
}
}
@@ -993,7 +1031,7 @@ void(vector virtsize, float showscores) CSQC_DrawHud =
if (hudviewsize < 130)
{
// Override scoreboard - check if no player health
- if (shealth <= 0)
+ if (view_player.health <= 0)
showscores = TRUE;
// Find out mid point of screen
@@ -1007,9 +1045,9 @@ void(vector virtsize, float showscores) CSQC_DrawHud =
pos_speedo_x = virtsize_x / 2.0;
pos_speedo_y = virtsize_y / 2.0;
pos_speedo_z = 0;
- if (view_pl.speed > 999)
+ if (view_player.speed > 999)
Hud_Speedometer (pos_speedo - [16, -8]);
- else if (view_pl.speed > 99)
+ else if (view_player.speed > 99)
Hud_Speedometer (pos_speedo - [20, -8]);
else
Hud_Speedometer (pos_speedo - [24, -8]);
@@ -1036,13 +1074,11 @@ void(vector virtsize, float showscores) CSQC_DrawHud =
//----------------------------------------------------------------------
void(vector virtsize, float showscores) CSQC_DrawScores =
{
- shealth = getstatf (STAT_HEALTH);
-
- if (intermission || showscores || shealth <= 0)
+ if (intermission || showscores || view_player.health <= 0)
{
if (deathmatch)
Hud_DMScoreboard ('0 0 0', virtsize);
- else if (intermission)
+ else if (intermission == 1)
Hud_Intermission ('0 0 0', virtsize);
}
};
Return to the top of this page or return to the overview of this repo.
Diff qc/cl_progs.src
diff --git a/qc/cl_progs.src b/qc/cl_progs.src
index f430765..fe882c2 100644
--- a/qc/cl_progs.src
+++ b/qc/cl_progs.src
@@ -15,6 +15,7 @@ defs_fields.qc // id1 entvars_t
defs_builtins.qc // curated builtins list
defs_const.qc // program-wide constants
defs_ctypes.qc // global class list
+defs_items.qc // global item definitions
//----------------------------------------------------------------------
// utility & helper functions
@@ -26,6 +27,7 @@ math.qc // Code by Joshua Skelton + misc
//----------------------------------------------------------------------
base_entities.qc //
base_func.qc //
+base_item.qc //
base_monster.qc //
base_trigger.qc // trigger initialization & helper functions
world.qc //
@@ -41,18 +43,72 @@ cl_entry.qc // modified AD CSQC (originally by Sock)
//----------------------------------------------------------------------
// CSQC networked entities
//----------------------------------------------------------------------
+
+// func entities
+// func/shadow.qc // not networked -- CEV
+func/wall.qc //
+func/bob.qc // PD3 & MG1 func_bob
+func/bossgate.qc // was misc.qc -- CEV
+// func/breakable.qc // selections from Rubicon2 QC
+func/button.qc // id1 buttons
+// func/counter.qc // not networked -- CEV
func/door.qc // id1 doors
+func/door_secret.qc // was doors.qc -- CEV
+func/elvtr_button.qc // Rogue elevator code (pmack)
+func/episodegate.qc // was misc.qc -- CEV
+func/explobox.qc // selections from Rubicon2 QC
+func/fall.qc // Renny's original version
+func/fall2.qc // Renny's improved version.
+func/illusionary.qc // id1 illusionary
+func/laser.qc // selections from Rubicon2 QC
+// func/monster_spawner.qc // not networked -- CEV
func/new_plat.qc // rogue plats
+// func/particlefield.qc // FIXME networked by the engine -- CEV
func/plat.qc // id1 platforms
func/rotate.qc // hipnotic rotation (needed for func_movewall)
+func/togglevisiblewall.qc // pd3 togglevisiblewall
func/togglewall.qc // hipnotic togglewalls
func/train.qc // id1 trains
+
+// item entities
+items/ammo.qc // id1 ammo
+items/armor.qc // id1 armor & pd3 shards
+items/backpacks.qc // id1 & pd3 backpacks
+items/gore.qc // id1 gibs & heads
+items/health.qc // id1 & pd3 health
+items/keys.qc // id1 & pd3 keys
+items/powerups.qc // id1 powerups
+items/runes.qc // id1 & MG1 runes
+items/weapons.qc // id1 weapons
+
+// misc entities
misc/explobox.qc // id1 explosive boxes are solid
misc/model.qc // networked because misc_model can be solid
misc/modeltrain.qc // networked because modeltrain can be solid
+
+// monster entities
monsters/playerclient.qc // player entities, client prediction
+monsters/boss.qc // id1 chthon
+monsters/boss2.qc // pd3 chthon
+monsters/demon.qc // id1 demon (fiend)
+monsters/dog.qc // id1 dog monster
+monsters/enforcer.qc // id1 enforcer monster
+monsters/fish.qc // id1 fish
+monsters/hknight.qc // id1 hell knight / death knight
+monsters/knight.qc // id1 knight
+monsters/ogre.qc // id1 ogre
+monsters/oldone.qc // id1 shub
+monsters/oldone2.qc // pd3 shub
+monsters/shalrath.qc // id1 shalrath / vore
+monsters/shambler.qc // id1 shambler
+monsters/soldier.qc // id1 soldier monster
+monsters/wizard.qc // id1 wizard / scragg
+monsters/zombie.qc // id1 zombie
+
+// trigger entities
triggers/fog.qc // world fog
triggers/ladder.qc // rubicon ladders
triggers/push.qc // id1 push brushes
triggers/setgravity.qc // hipnotic setgravity
+triggers/teleport.qc // id1 teleporters (with pd3 & other additions)
#endlist
Return to the top of this page or return to the overview of this repo.
Diff qc/compat/copper.qc
diff --git a/qc/compat/copper.qc b/qc/compat/copper.qc
new file mode 100644
index 0000000..40f4821
--- /dev/null
+++ b/qc/compat/copper.qc
@@ -0,0 +1,30 @@
+//==============================================================================
+// very loose support for mods built on Copper -- CEV
+//==============================================================================
+
+//======================================================================
+// forward declarations
+//======================================================================
+
+#ifdef SSQC
+void() compat_copper_item_spawnflags; // process item spawnflags
+#endif
+
+//------------------------------------------------------------------------------
+
+//======================================================================
+// spawnflag & entity field handling -- CEV
+//======================================================================
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+void() compat_copper_item_spawnflags =
+{
+ // spawnflag 4 is SUSPENDED in copper -- CEV
+ if (self.spawnflags & 4)
+ {
+ self.spawnflags &= ~4;
+ self.spawnflags |= SPAWNFLAG_ITEM_SUSPENDED;
+ }
+};
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/compat/id1.qc
diff --git a/qc/compat/id1.qc b/qc/compat/id1.qc
index 9cdd56a..8df7650 100644
--- a/qc/compat/id1.qc
+++ b/qc/compat/id1.qc
@@ -20,6 +20,7 @@ float(string tex) id1_surface_type; // material type for texture name
void() boss_awake; // support for jam6_scampie
void() boss_missile1;
void() SUB_regen;
+void() SUB_UseTargets;
void() plat_hit_bottom;
void() train_wait;
void() enforcer_fire;
@@ -130,18 +131,88 @@ float(string tex) id1_surface_type =
void() boss_awake = { monster_boss_use (); };
void() boss_missile1 = { boss_atk1 (); };
void() SUB_regen = { base_item_think_respawn (); };
+void() SUB_UseTargets = { sub_usetargets (); };
void() plat_hit_bottom = { func_plat_hit_bottom (); };
void() train_wait = { base_func_train_wait (); };
void() enforcer_fire = { monster_enforcer_attack (); };
-void() walkmonster_start_go = { base_walkmonster_think_start (); };
//----------------------------------------------------------------------
-void() walkmonster_start =
+void() walkmonster_start_go =
{
- base_monster_init (self);
- self.think = base_walkmonster_think_start;
+ // Preach's tutorial
+ if (autocvar(nomonsters, 0))
+ {
+ remove (self);
+ return;
+ }
+
+ self.origin_z += 1;
+ droptofloor ();
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+ self.flags |= FL_MONSTER;
+ self.takedamage = DAMAGE_AIM;
+ self.touch = base_monster_touch;
+ self.use = base_monster_use_angry;
+ self.view_ofs = '0 0 25';
+
+ self.ideal_yaw = self.angles * '0 1 0';
+
+ if (!self.yaw_speed)
+ self.yaw_speed = 20;
+
+ if (self.target != __NULL__ && self.target != "")
+ {
+ self.goalentity = find (world, targetname, self.target);
+ self.movetarget = self.goalentity;
+ self.ideal_yaw = vectoyaw (self.goalentity.origin-self.origin);
+
+ if (!self.movetarget)
+ {
+ dprint (sprintf("walkmonster_start_go: monster %s at "
+ "%v cannot find its target!\n",
+ self.classname, self.origin));
+ }
+
+ if (self.movetarget.classtype == CT_PATH_CORNER)
+ {
+ self.th_walk ();
+ }
+ else
+ {
+ self.pausetime = 99999999;
+ self.th_stand ();
+ }
+ }
+ else
+ {
+ self.pausetime = 99999999;
+ self.th_stand ();
+ }
+
self.nextthink = self.nextthink + random() * 0.5;
+};
+
+//----------------------------------------------------------------------
+void() walkmonster_start =
+{
+ // don't call base_monster_init, do it directly here -- CEV
+ // base_monster_init (self);
+
+ // Preach's tutorial
+ if (autocvar(nomonsters, 0))
+ {
+ remove (self);
+ return;
+ }
+
+ self.classgroup |= CG_MONSTER;
+ base_mapentity_init (self);
+
total_monsters = total_monsters + 1;
+ self.think = walkmonster_start_go;
+ self.nextthink = self.nextthink + random() * 0.5;
};
//----------------------------------------------------------------------
Return to the top of this page or return to the overview of this repo.
Diff qc/compat/mg1.qc
diff --git a/qc/compat/mg1.qc b/qc/compat/mg1.qc
new file mode 100644
index 0000000..4e63592
--- /dev/null
+++ b/qc/compat/mg1.qc
@@ -0,0 +1,342 @@
+//==============================================================================
+// KNOWN_RELEASE_MG1 compatibility - Machine Games "Dimension Of The Machine"
+//==============================================================================
+
+//======================================================================
+// constants
+//======================================================================
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// misc_corpse_seq -- matches misc_corpse_poses from MG1 -- CEV
+//----------------------------------------------------------------------
+typedef enum
+{
+ MISC_CORPSE_SEQ_DEMON_1, // Monster corpses
+ MISC_CORPSE_SEQ_DOG_1,
+ MISC_CORPSE_SEQ_DOG_2,
+ MISC_CORPSE_SEQ_ENFORCER_1,
+ MISC_CORPSE_SEQ_ENFORCER_2,
+ MISC_CORPSE_SEQ_FISH_1,
+ MISC_CORPSE_SEQ_HKNIGHT_1,
+ MISC_CORPSE_SEQ_HKNIGHT_2,
+ MISC_CORPSE_SEQ_KNIGHT_1,
+ MISC_CORPSE_SEQ_KNIGHT_2,
+ MISC_CORPSE_SEQ_OGRE_1,
+ MISC_CORPSE_SEQ_OGRE_2,
+ MISC_CORPSE_SEQ_SHALRATH_1,
+ MISC_CORPSE_SEQ_SHAMBLER_1,
+ MISC_CORPSE_SEQ_SOLDIER_1,
+ MISC_CORPSE_SEQ_SOLDIER_2,
+ MISC_CORPSE_SEQ_WIZARD_1,
+ MISC_CORPSE_SEQ_PLAYER_1, // Player corpse
+ MISC_CORPSE_SEQ_PLAYER_2,
+ MISC_CORPSE_SEQ_PLAYER_3,
+ MISC_CORPSE_SEQ_PLAYER_4,
+ MISC_CORPSE_SEQ_PLAYER_5,
+ MISC_CORPSE_SEQ_PLAYER_6,
+ MISC_CORPSE_SEQ_DEMON_HEAD, // Heads
+ MISC_CORPSE_SEQ_DOG_HEAD,
+ MISC_CORPSE_SEQ_SOLDIER_HEAD, // "h_guard"
+ MISC_CORPSE_SEQ_HKNIGHT_HEAD,
+ MISC_CORPSE_SEQ_KNIGHT_HEAD,
+ MISC_CORPSE_SEQ_ENFORCER_HEAD, // "h_mega"
+ MISC_CORPSE_SEQ_OGRE_HEAD,
+ MISC_CORPSE_SEQ_PLAYER_HEAD,
+ MISC_CORPSE_SEQ_SHALRATH_HEAD,
+ MISC_CORPSE_SEQ_SHAMBLER_HEAD,
+ MISC_CORPSE_SEQ_WIZARD_HEAD,
+ MISC_CORPSE_SEQ_ZOMBIE_HEAD,
+ MISC_CORPSE_SEQ_GIB_1, // Gibs
+ MISC_CORPSE_SEQ_GIB_2,
+ MISC_CORPSE_SEQ_GIB_3
+} misc_corpse_seq;
+#endif
+
+//======================================================================
+// forward declarations
+//======================================================================
+
+#ifdef SSQC
+void() compat_mg1_monster_spawnflags;
+#endif
+
+#ifdef SSQC
+// info_player_start_hub
+void(entity e) info_player_start_hub_init;
+void() info_player_start_hub;
+#endif
+
+#ifdef SSQC
+// trigger_activate_coop_spawns
+void() trigger_activate_coop_spawns;
+#endif
+
+#ifdef SSQC
+// func_explode
+void() func_explode;
+#endif
+
+#ifdef SSQC
+// misc_corpse
+void() misc_corpse;
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+void() compat_mg1_monster_spawnflags =
+{
+ local float startflags = self.spawnflags;
+
+ // spawnflag 4 is SPAWNED in MG1; entity waits to be used -- CEV
+ if (startflags & 4)
+ {
+ self.spawnflags &= ~4;
+ self.spawnflags |= SPAWNFLAG_MONSTER_SPAWNED;
+ }
+
+ // spawnflag 8 is ANGRY in MG1 -- CEV
+ if (startflags & 8)
+ {
+ self.spawnflags &= ~8;
+ self.spawnflags |= SPAWNFLAG_MONSTER_ANGRY;
+ }
+
+ // spawnflag 16 is TFOG in MG1 -- CEV
+ if (startflags & 16)
+ {
+ self.spawnflags &= ~16;
+ self.wait = 0;
+ }
+ else
+ {
+ self.wait = 1;
+ }
+
+ // spawnflag 32 is ATTACK_FRIEND in MG1 -- CEV
+ if (startflags & 32)
+ {
+ self.spawnflags &= ~32;
+ // TODO CEV
+ }
+
+ // whatever spawnflag 64 in MG1 is it's incompatible -- CEV
+ if (startflags & 64)
+ {
+ self.spawnflags &= ~64;
+ // TODO CEV
+ }
+
+ // spawnflag 4096 is WAITWALK in MG1 -- CEV
+ if (startflags & 4096)
+ {
+ self.spawnflags &= ~4096;
+ self.spawnflags |= SPAWNFLAG_MONSTER_WAITWALK;
+ }
+};
+#endif
+
+#ifdef SSQC
+/*QUAKED info_player_start_hub (1 0 0) (-16 -16 -24) (16 16 24)
+Only used on start map for the return point from an episode.
+*/
+//----------------------------------------------------------------------
+// class info_player_start_hub: base_mapentity
+// {
+ //--------------------------------------------------------------
+ void(entity e) info_player_start_hub_init =
+ {
+ base_mapentity_init (e);
+ e.classname = "info_player_start_hub";
+ e.classtype = CT_INFO_PLAYER_START_HUB;
+ };
+
+ //--------------------------------------------------------------
+ void() info_player_start_hub =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ info_player_start_hub_init (self);
+ };
+// };
+#endif
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// class trigger_activate_coop_spawns: entity
+// {
+ //--------------------------------------------------------------
+ void() trigger_activate_coop_spawns =
+ {
+ remove (self);
+ };
+// };
+#endif
+
+#ifdef SSQC
+/*QUAKED func_explode (0 .5 .8) (0 0 0) (32 32 64)
+Custom exploding box
+*/
+//----------------------------------------------------------------------
+// class func_explode: base_func
+// {
+ //--------------------------------------------------------------
+ void() func_explode =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ func_explobox_init (self);
+ };
+// }
+#endif
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// class misc_corpse: base_misc_model
+// {
+ //--------------------------------------------------------------
+ void() misc_corpse =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ switch (self.style)
+ {
+ case MISC_CORPSE_SEQ_DEMON_1:
+ monster_dead_demon_init (self);
+ break;
+ case MISC_CORPSE_SEQ_DOG_1:
+ self.spawnflags |= 2;
+ monster_dead_dog_init (self);
+ break;
+ case MISC_CORPSE_SEQ_DOG_2:
+ self.spawnflags |= 4;
+ monster_dead_dog_init (self);
+ break;
+ case MISC_CORPSE_SEQ_ENFORCER_1:
+ monster_dead_enforcer_init (self);
+ break;
+ case MISC_CORPSE_SEQ_ENFORCER_2:
+ self.spawnflags |= 2;
+ monster_dead_enforcer_init (self);
+ break;
+ case MISC_CORPSE_SEQ_FISH_1:
+ monster_dead_fish_init (self);
+ break;
+ case MISC_CORPSE_SEQ_HKNIGHT_1:
+ monster_dead_hell_knight_init (self);
+ break;
+ case MISC_CORPSE_SEQ_HKNIGHT_2:
+ self.spawnflags |= 2;
+ monster_dead_hell_knight_init (self);
+ break;
+ case MISC_CORPSE_SEQ_KNIGHT_1:
+ self.spawnflags |= 2;
+ monster_dead_knight_init (self);
+ break;
+ case MISC_CORPSE_SEQ_KNIGHT_2:
+ monster_dead_knight_init (self);
+ break;
+ case MISC_CORPSE_SEQ_OGRE_1:
+ self.spawnflags |= 2;
+ monster_dead_ogre_init (self);
+ break;
+ case MISC_CORPSE_SEQ_OGRE_2:
+ monster_dead_ogre_init (self);
+ break;
+ case MISC_CORPSE_SEQ_SHALRATH_1:
+ monster_dead_shalrath_init (self);
+ break;
+ case MISC_CORPSE_SEQ_SHAMBLER_1:
+ monster_dead_shambler_init (self);
+ break;
+ case MISC_CORPSE_SEQ_SOLDIER_1:
+ self.spawnflags |= 2;
+ monster_dead_army_init (self);
+ break;
+ case MISC_CORPSE_SEQ_SOLDIER_2:
+ monster_dead_army_init (self);
+ break;
+ case MISC_CORPSE_SEQ_WIZARD_1:
+ monster_dead_wizard_init (self);
+ break;
+ case MISC_CORPSE_SEQ_PLAYER_1:
+ player_dead_axe ();
+ break;
+ case MISC_CORPSE_SEQ_PLAYER_2:
+ // TODO CEV
+ // misc_corpse_init (self);
+ break;
+ case MISC_CORPSE_SEQ_PLAYER_3:
+ // TODO CEV
+ // misc_corpse_init (self);
+ break;
+ case MISC_CORPSE_SEQ_PLAYER_4:
+ // TODO CEV
+ // misc_corpse_init (self);
+ break;
+ case MISC_CORPSE_SEQ_PLAYER_5:
+ // TODO CEV
+ // misc_corpse_init (self);
+ break;
+ case MISC_CORPSE_SEQ_PLAYER_6:
+ player_dead_on_side ();
+ break;
+ case MISC_CORPSE_SEQ_DEMON_HEAD:
+ item_head_demon_init (self);
+ break;
+ case MISC_CORPSE_SEQ_DOG_HEAD:
+ item_head_dog_init (self);
+ break;
+ case MISC_CORPSE_SEQ_SOLDIER_HEAD:
+ item_head_army_init (self);
+ break;
+ case MISC_CORPSE_SEQ_HKNIGHT_HEAD:
+ item_head_hell_knight_init (self);
+ break;
+ case MISC_CORPSE_SEQ_KNIGHT_HEAD:
+ item_head_knight_init (self);
+ break;
+ case MISC_CORPSE_SEQ_ENFORCER_HEAD:
+ item_head_enforcer_init (self);
+ break;
+ case MISC_CORPSE_SEQ_OGRE_HEAD:
+ item_head_ogre_init (self);
+ break;
+ case MISC_CORPSE_SEQ_PLAYER_HEAD:
+ item_head_player_init (self);
+ break;
+ case MISC_CORPSE_SEQ_SHALRATH_HEAD:
+ item_head_shalrath_init (self);
+ break;
+ case MISC_CORPSE_SEQ_SHAMBLER_HEAD:
+ item_head_shambler_init (self);
+ break;
+ case MISC_CORPSE_SEQ_WIZARD_HEAD:
+ item_head_wizard_init (self);
+ break;
+ case MISC_CORPSE_SEQ_ZOMBIE_HEAD:
+ item_head_zombie_init (self);
+ break;
+ case MISC_CORPSE_SEQ_GIB_1:
+ item_gib1_init (self);
+ break;
+ case MISC_CORPSE_SEQ_GIB_2:
+ item_gib2_init (self);
+ break;
+ case MISC_CORPSE_SEQ_GIB_3:
+ item_gib3_init (self);
+ break;
+ default:
+ objerror ("misc_corpse with invalid style");
+ }
+ };
+// };
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/compat/quake3.qc
diff --git a/qc/compat/quake3.qc b/qc/compat/quake3.qc
index 943e1c6..a25e0ed 100644
--- a/qc/compat/quake3.qc
+++ b/qc/compat/quake3.qc
@@ -2,20 +2,117 @@
// Quake 3 compatibility entrypoints / functions
//==============================================================================
+//======================================================================
+// forward declarations
+//======================================================================
+
+#ifdef SSQC
+void() compat_quake3_item_spawnflags; // rewrite entity spawnflags -- CEV
+void(string key, string value) compat_quake3_entity_init_field;
+#endif
+
+#ifdef SSQC
+void() spawnfunc_item_quad; // quake3 powerups
+void() spawnfunc_item_enviro;
+#endif
+#ifdef SSQC
+void() spawnfunc_item_armor_jacket; // quake3 armor
+void() spawnfunc_item_armor_combat;
+void() spawnfunc_item_armor_body;
+#endif
+#ifdef SSQC
+void() spawnfunc_item_health_mega; // quake3 health items
+void() spawnfunc_item_health_small;
+#endif
+#ifdef SSQC
+void() spawnfunc_ammo_cells; // quake3 ammo items
+void() spawnfunc_ammo_grenades;
+void() spawnfunc_ammo_lightning;
+void() spawnfunc_ammo_rockets;
+void() spawnfunc_ammo_shells;
+void() spawnfunc_weapon_plasmagun;
+#endif
+#ifdef SSQC
+void() spawnfunc_target_push; // quake3 push targets
+void() spawnfunc_target_position;
+#endif
+#ifdef SSQC
+void() spawnfunc_misc_teleport_dest; // quake3 teleport destinations
+void() spawnfunc_misc_teleporter_dest;
+void() spawnfunc_misc_teleporter_destination;
+void() spawnfunc_target_teleporter;
+#endif
+
+//------------------------------------------------------------------------------
+
+//======================================================================
+// spawnflag & entity field handling -- CEV
+//======================================================================
+
#ifdef SSQC
//----------------------------------------------------------------------
-void() spawnfunc_item_quad =
+void() compat_quake3_item_spawnflags =
{
- item_artifact_super_damage ();
+ // spawnflag 1 is SUSPENDED in Quake3 -- CEV
+ if (self.spawnflags & 1)
+ {
+ // remap flags for compatibility -- CEV
+ self.spawnflags &= ~1;
+ self.spawnflags |= SPAWNFLAG_ITEM_SUSPENDED;
+ }
+};
+
+//----------------------------------------------------------------------
+void(string key, string value) compat_quake3_entity_init_field =
+{
+ switch (key)
+ {
+ case "notfree":
+ case "NotFree":
+ case "NOTFREE":
+ local float notfree = stof (value);
+ if (notfree && !teamplay)
+ self.spawnflags |= SPAWNFLAG_NOT_IN_DEATHMATCH;
+ break;
+ case "notsingle":
+ case "NotSingle":
+ case "NOTSINGLE":
+ local float notsingle = stof (value);
+ if (notsingle)
+ self.spawnflags |= SPAWNFLAG_NOT_IN_SP;
+ break;
+ case "notteam":
+ case "NotTeam":
+ case "NOTTEAM":
+ // TODO CEV
+ local float notteam = stof (value);
+ if (notteam && teamplay)
+ self.spawnflags |= SPAWNFLAG_NOT_IN_TEAMPLAY;
+ break;
+ }
};
#endif
//======================================================================
-// Quake 3 armor item support -- CEV
+// loose entity spawn functions -- CEV
//======================================================================
#ifdef SSQC
//----------------------------------------------------------------------
+void() spawnfunc_item_quad =
+{
+ item_artifact_super_damage ();
+};
+
+//----------------------------------------------------------------------
+void() spawnfunc_item_enviro =
+{
+ item_artifact_envirosuit ();
+};
+#endif
+
+#ifdef SSQC
+//----------------------------------------------------------------------
// Green Armor
//----------------------------------------------------------------------
void() spawnfunc_item_armor_jacket =
@@ -40,28 +137,50 @@ void() spawnfunc_item_armor_body =
};
#endif
-//======================================================================
+//----------------------------------------------------------------------
// Quake 3 health item support -- CEV
-//======================================================================
+//----------------------------------------------------------------------
#ifdef SSQC
//----------------------------------------------------------------------
void() spawnfunc_item_health_mega =
{
+ // remap flags for Q3 -- CEV
+ if (known_release == KNOWN_RELEASE_QUAKE3 ||
+ known_release == KNOWN_RELEASE_CPMA ||
+ known_release == KNOWN_RELEASE_QUAKELIVE)
+ {
+ compat_quake3_item_spawnflags ();
+ }
+
+ // remap fields
+ base_mapentity_init_spawndata (base_item_health_init_field);
+
// new spawnflags for all entities -- iw
- if (SUB_Inhibit ())
+ if (SUB_Inhibit())
return;
self.classname = "item_health";
- self.spawnflags |= 2;
+ self.spawnflags |= SPAWNFLAG_ITEM_HEALTH_MEGA;
item_health_init (self);
};
//----------------------------------------------------------------------
void() spawnfunc_item_health_small =
{
+ // remap flags for Q3 -- CEV
+ if (known_release == KNOWN_RELEASE_QUAKE3 ||
+ known_release == KNOWN_RELEASE_CPMA ||
+ known_release == KNOWN_RELEASE_QUAKELIVE)
+ {
+ compat_quake3_item_spawnflags ();
+ }
+
+ // remap fields
+ base_mapentity_init_spawndata (base_item_health_init_field);
+
// new spawnflags for all entities -- iw
- if (SUB_Inhibit ())
+ if (SUB_Inhibit())
return;
self.classname = "item_health_vial";
@@ -69,9 +188,9 @@ void() spawnfunc_item_health_small =
};
#endif
-//======================================================================
+//----------------------------------------------------------------------
// Quake 3 ammo & weapons -- CEV
-//======================================================================
+//----------------------------------------------------------------------
#ifdef SSQC
//----------------------------------------------------------------------
@@ -116,9 +235,9 @@ void() spawnfunc_weapon_plasmagun =
};
#endif
-//======================================================================
+//----------------------------------------------------------------------
// Quake 3 push target entities -- CEV
-//======================================================================
+//----------------------------------------------------------------------
#ifdef SSQC
//----------------------------------------------------------------------
@@ -144,9 +263,9 @@ void() spawnfunc_target_position =
};
#endif
-//======================================================================
+//----------------------------------------------------------------------
// Quake 3 Teleporter targets -- CEV
-//======================================================================
+//----------------------------------------------------------------------
#ifdef SSQC
//----------------------------------------------------------------------
Return to the top of this page or return to the overview of this repo.
Diff qc/cshift.qc
diff --git a/qc/cshift.qc b/qc/cshift.qc
index c9de79c..086d7f2 100644
--- a/qc/cshift.qc
+++ b/qc/cshift.qc
@@ -117,38 +117,38 @@ void(vector ssize) csf_draw =
{
// the logic from csf_controller_think will work fine here on
// the client-side -- CEV
- if (view_pl.csf_finished > time)
+ if (view_player.csf_finished > time)
{
- if (view_pl.csf_density != view_pl.csf_density_cur)
+ if (view_player.csf_density != view_player.csf_density_cur)
{
local float density, fraction;
local vector color;
// wat
- fraction = 1 - (view_pl.csf_finished - time) /
- view_pl.csf_speed;
+ fraction = 1 - (view_player.csf_finished - time) /
+ view_player.csf_speed;
- density = lerp_hermite (view_pl.csf_density_cur,
- view_pl.csf_density, fraction);
- color = lerp_vector_hermite (view_pl.csf_color_cur,
- view_pl.csf_color, fraction);
+ density = lerp_hermite (view_player.csf_density_cur,
+ view_player.csf_density, fraction);
+ color = lerp_vector_hermite (view_player.csf_color_cur,
+ view_player.csf_color, fraction);
- view_pl.csf_density_cur = density;
- view_pl.csf_color_cur = color;
+ view_player.csf_density_cur = density;
+ view_player.csf_color_cur = color;
}
}
else
{
- if (view_pl.csf_density_cur != view_pl.csf_density)
- view_pl.csf_density_cur = view_pl.csf_density;
- if (view_pl.csf_color_cur != view_pl.csf_color)
- view_pl.csf_color_cur = view_pl.csf_color;
+ if (view_player.csf_density_cur != view_player.csf_density)
+ view_player.csf_density_cur = view_player.csf_density;
+ if (view_player.csf_color_cur != view_player.csf_color)
+ view_player.csf_color_cur = view_player.csf_color;
}
- if (view_pl.csf_density_cur > 0)
+ if (view_player.csf_density_cur > 0)
// draw a rectangle starting at 0,0 of size ssize of color
// csf_color_cur of alpha csf_density_cur / 256.0 -- CEV
- drawfill ([0, 0], ssize, view_pl.csf_color_cur,
- view_pl.csf_density_cur / 256, 0);
+ drawfill ([0, 0], ssize, view_player.csf_color_cur,
+ view_player.csf_density_cur / 256, 0);
};
#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/custom_mdls.qc
diff --git a/qc/custom_mdls.qc b/qc/custom_mdls.qc
deleted file mode 100644
index ef1da80..0000000
--- a/qc/custom_mdls.qc
+++ /dev/null
@@ -1,168 +0,0 @@
-//==============================================================================
-// MAPPER-SETTABLE CUSTOM MODELS FOR MONSTERS
-//==============================================================================
-
-//======================================================================
-// fields -- custom models -- dumptruck_ds
-//======================================================================
-
-#ifdef SSQC
-.string mdl_head;
-.string mdl_body;
-.string mdl_proj; // projectile
-.string mdl_exproj; // explosive projectile
-.float skin_head;
-.float skin_proj; // projectile
-.float skin_exproj; // explosive projectile
-.string mdl_gib1;
-.string mdl_gib2;
-.string mdl_gib3;
-
-.vector mdlsz; // additions by bmFbr for custom bbox
-.vector centeroffset;
-#endif
-
-//======================================================================
-// forward declarations
-//======================================================================
-
-#ifdef SSQC
-void(entity e, .string mdl_field, string default_file) precache_model_custom;
-void(entity e, string default_file) precache_head_model;
-void(entity e, string default_file) precache_body_model;
-void(entity e, string default_file) precache_proj_model;
-void(entity e, string default_file) precache_gib1;
-void(entity e, string default_file) precache_gib2;
-void(entity e, string default_file) precache_gib3;
-void(entity e, .string mdl_field, string default_file) precache_model2_custom;
-void(entity e, string default_file) precache_head_model2;
-void(entity e, string default_file) precache_body_model2;
-void(entity e, string default_file) precache_proj_model2;
-void(entity e, string default_file) precache_exproj_model2;
-void(entity e, .string mdl_field, string default_file) model_custom;
-void(entity e, string default_file) body_model;
-// void(entity e, string default_file) head_model;
-void(entity e, string default_file) proj_model;
-#endif
-
-//------------------------------------------------------------------------------
-
-#ifdef SSQC
-//----------------------------------------------------------------------
-// precache_model_custom
-//----------------------------------------------------------------------
-void(entity e, .string mdl_field, string default_file) precache_model_custom =
-{
- if (e.mdl_field != "")
- precache_model (e.mdl_field);
- else
- precache_model (default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_head_model =
-{
- precache_model_custom (e, mdl_head, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_body_model =
-{
- precache_model_custom (e, mdl_body, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_proj_model =
-{
- precache_model_custom (e, mdl_proj, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_gib1 =
-{
- precache_model_custom (e, mdl_gib1, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_gib2 =
-{
- precache_model_custom (e, mdl_gib2, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_gib3 =
-{
- precache_model_custom (e, mdl_gib3, default_file);
-};
-
-//----------------------------------------------------------------------
-// precache_model2_custom
-//----------------------------------------------------------------------
-void(entity e, .string mdl_field, string default_file) precache_model2_custom =
-{
- if (e.mdl_field != "")
- precache_model2 (e.mdl_field);
- else
- precache_model2 (default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_head_model2 =
-{
- precache_model2_custom (e, mdl_head, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_body_model2 =
-{
- precache_model2_custom (e, mdl_body, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_proj_model2 =
-{
- precache_model2_custom (e, mdl_proj, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_exproj_model2 =
-{
- precache_model2_custom (e, mdl_exproj, default_file);
-};
-
-//----------------------------------------------------------------------
-// model_custom
-//----------------------------------------------------------------------
-void(entity e, .string mdl_field, string default_file) model_custom =
-{
- if (e.mdl_field != "")
- {
- setmodel (e, e.mdl_field);
- // dprint ("CUSTOM MODEL LOADED\n");
- }
- else
- {
- setmodel (e, default_file);
- }
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) body_model =
-{
- model_custom (e, mdl_body, default_file);
-};
-
-/*
-//----------------------------------------------------------------------
-void(entity e, string default_file) head_model =
-{
- model_custom (e, mdl_head, default_file);
-};
-*/
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) proj_model =
-{
- model_custom (e, mdl_proj, default_file);
-};
-#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/custom_snd.qc
diff --git a/qc/custom_snd.qc b/qc/custom_snd.qc
deleted file mode 100644
index e5c95aa..0000000
--- a/qc/custom_snd.qc
+++ /dev/null
@@ -1,342 +0,0 @@
-//==============================================================================
-// MAPPER-SETTABLE CUSTOM SOUND EFFECTS FOR MONSTERS
-//==============================================================================
-
-/*
-========================================================================
-This file was created for progs_dump by Ian "iw" Walshaw, January 2020.
-
-TODO: iw to add descriptive comments to this file.
-========================================================================
-*/
-
-//======================================================================
-// fields -- Custom Monster Sounds -- dumptruck_ds
-//======================================================================
-
-#ifdef SSQC
-.string snd_death;
-.string snd_pain;
-.string snd_sight;
-.string snd_attack;
-.string snd_hit;
-.string snd_idle;
-.string snd_land;
-.string snd_move;
-.string snd_misc;
-.string snd_misc1;
-.string snd_misc2;
-.string snd_misc3;
-#endif
-
-//======================================================================
-// forward declarations
-//======================================================================
-
-#ifdef SSQC
-void(entity e, .string snd_field, string default_file) precache_sound_custom;
-void(entity e, string default_file) precache_sound_attack;
-void(entity e, string default_file) precache_sound_death;
-void(entity e, string default_file) precache_sound_hit;
-void(entity e, string default_file) precache_sound_idle;
-void(entity e, string default_file) precache_sound_land;
-void(entity e, string default_file) precache_sound_misc;
-void(entity e, string default_file) precache_sound_misc1;
-void(entity e, string default_file) precache_sound_misc2;
-void(entity e, string default_file) precache_sound_misc3;
-void(entity e, string default_file) precache_sound_move;
-void(entity e, string default_file) precache_sound_pain;
-void(entity e, string default_file) precache_sound_sight;
-void(entity e, .string snd_field, string default_file) precache_sound2_custom;
-void(entity e, string default_file) precache_sound2_attack;
-void(entity e, string default_file) precache_sound2_death;
-void(entity e, string default_file) precache_sound2_hit;
-void(entity e, string default_file) precache_sound2_idle;
-void(entity e, string default_file) precache_sound2_land;
-void(entity e, string default_file) precache_sound2_misc;
-void(entity e, string default_file) precache_sound2_misc1;
-void(entity e, string default_file) precache_sound2_misc2;
-void(entity e, string default_file) precache_sound2_misc3;
-void(entity e, string default_file) precache_sound2_move;
-void(entity e, string default_file) precache_sound2_pain;
-void(entity e, string default_file) precache_sound2_sight;
-void(.string f, entity e, float c, string d, float v, float att) sound_custom;
-void(entity e, float chan, string def, float vol, float atten) sound_attack;
-void(entity e, float chan, string def, float vol, float atten) sound_death;
-void(entity e, float chan, string def, float vol, float atten) sound_hit;
-void(entity e, float chan, string def, float vol, float atten) sound_idle;
-void(entity e, float chan, string def, float vol, float atten) sound_land;
-void(entity e, float chan, string def, float vol, float atten) sound_misc;
-void(entity e, float chan, string def, float vol, float atten) sound_misc1;
-void(entity e, float chan, string def, float vol, float atten) sound_misc2;
-void(entity e, float chan, string def, float vol, float atten) sound_misc3;
-void(entity e, float chan, string def, float vol, float atten) sound_move;
-void(entity e, float chan, string def, float vol, float atten) sound_pain;
-void(entity e, float chan, string def, float vol, float atten) sound_sight;
-#endif
-
-//------------------------------------------------------------------------------
-
-#ifdef SSQC
-//----------------------------------------------------------------------
-// precache_sound_custom
-//----------------------------------------------------------------------
-void(entity e, .string snd_field, string default_file) precache_sound_custom =
-{
- if (e.snd_field != "")
- precache_sound (e.snd_field);
- else
- precache_sound (default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_sound_attack =
-{
- precache_sound_custom (e, snd_attack, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_sound_death =
-{
- precache_sound_custom (e, snd_death, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_sound_hit =
-{
- precache_sound_custom (e, snd_hit, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_sound_idle =
-{
- precache_sound_custom (e, snd_idle, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_sound_land =
-{
- precache_sound_custom (e, snd_land, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_sound_misc =
-{
- precache_sound_custom (e, snd_misc, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_sound_misc1 =
-{
- precache_sound_custom (e, snd_misc1, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_sound_misc2 =
-{
- precache_sound_custom (e, snd_misc2, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_sound_misc3 =
-{
- precache_sound_custom (e, snd_misc3, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_sound_move =
-{
- precache_sound_custom (e, snd_move, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_sound_pain =
-{
- precache_sound_custom (e, snd_pain, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_sound_sight =
-{
- precache_sound_custom (e, snd_sight, default_file);
-};
-
-//----------------------------------------------------------------------
-// precache_sound2_custom
-//----------------------------------------------------------------------
-void(entity e, .string snd_field, string default_file) precache_sound2_custom =
-{
- if (e.snd_field != "")
- precache_sound2 (e.snd_field);
- else
- precache_sound2 (default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_sound2_attack =
-{
- precache_sound2_custom (e, snd_attack, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_sound2_death =
-{
- precache_sound2_custom (e, snd_death, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_sound2_hit =
-{
- precache_sound2_custom (e, snd_hit, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_sound2_idle =
-{
- precache_sound2_custom (e, snd_idle, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_sound2_land =
-{
- precache_sound2_custom (e, snd_land, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_sound2_misc =
-{
- precache_sound2_custom (e, snd_misc, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_sound2_misc1 =
-{
- precache_sound2_custom (e, snd_misc1, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_sound2_misc2 =
-{
- precache_sound2_custom (e, snd_misc2, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_sound2_misc3 =
-{
- precache_sound2_custom (e, snd_misc3, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_sound2_move =
-{
- precache_sound2_custom (e, snd_move, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_sound2_pain =
-{
- precache_sound2_custom (e, snd_pain, default_file);
-};
-
-//----------------------------------------------------------------------
-void(entity e, string default_file) precache_sound2_sight =
-{
- precache_sound2_custom (e, snd_sight, default_file);
-};
-
-//----------------------------------------------------------------------
-// sound_custom
-//----------------------------------------------------------------------
-void(.string snd_field, entity e, float chan, string default_file,
- float vol, float atten) sound_custom =
-{
- if (e.snd_field != "")
- sound (e, chan, e.snd_field, vol, atten);
- else
- sound (e, chan, default_file, vol, atten);
-};
-
-//----------------------------------------------------------------------
-void(entity e, float chan, string default_file, float vol, float atten)
- sound_attack =
-{
- sound_custom (snd_attack, e, chan, default_file, vol, atten);
-};
-
-//----------------------------------------------------------------------
-void(entity e, float chan, string default_file, float vol, float atten)
- sound_death =
-{
- sound_custom (snd_death, e, chan, default_file, vol, atten);
-};
-
-//----------------------------------------------------------------------
-void(entity e, float chan, string default_file, float vol, float atten)
- sound_hit =
-{
- sound_custom (snd_hit, e, chan, default_file, vol, atten);
-};
-
-//----------------------------------------------------------------------
-void(entity e, float chan, string default_file, float vol, float atten)
- sound_idle =
-{
- sound_custom (snd_idle, e, chan, default_file, vol, atten);
-};
-
-//----------------------------------------------------------------------
-void(entity e, float chan, string default_file, float vol, float atten)
- sound_land =
-{
- sound_custom (snd_land, e, chan, default_file, vol, atten);
-};
-
-//----------------------------------------------------------------------
-void(entity e, float chan, string default_file, float vol, float atten)
- sound_misc =
-{
- sound_custom (snd_misc, e, chan, default_file, vol, atten);
-};
-
-//----------------------------------------------------------------------
-void(entity e, float chan, string default_file, float vol, float atten)
- sound_misc1 =
-{
- sound_custom (snd_misc1, e, chan, default_file, vol, atten);
-};
-
-//----------------------------------------------------------------------
-void(entity e, float chan, string default_file, float vol, float atten)
- sound_misc2 =
-{
- sound_custom (snd_misc2, e, chan, default_file, vol, atten);
-};
-
-//----------------------------------------------------------------------
-void(entity e, float chan, string default_file, float vol, float atten)
- sound_misc3 =
-{
- sound_custom (snd_misc3, e, chan, default_file, vol, atten);
-};
-
-//----------------------------------------------------------------------
-void(entity e, float chan, string default_file, float vol, float atten)
- sound_move =
-{
- sound_custom (snd_move, e, chan, default_file, vol, atten);
-};
-
-//----------------------------------------------------------------------
-void(entity e, float chan, string default_file, float vol, float atten)
- sound_pain =
-{
- sound_custom (snd_pain, e, chan, default_file, vol, atten);
-};
-
-//----------------------------------------------------------------------
-void(entity e, float chan, string default_file, float vol, float atten)
- sound_sight =
-{
- sound_custom (snd_sight, e, chan, default_file, vol, atten);
-};
-#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/cutscene.qc
diff --git a/qc/cutscene.qc b/qc/cutscene.qc
index 3299cce..bdbe71d 100644
--- a/qc/cutscene.qc
+++ b/qc/cutscene.qc
@@ -9,7 +9,7 @@
//======================================================================
float cutscene; // Set to TRUE during a cutscene.
-float mindex_inviso; // Invisible (null sprite)
+float modelindex_invisible; // Invisible (null sprite)
//======================================================================
// fields
Return to the top of this page or return to the overview of this repo.
Diff qc/defs_builtins.qc
diff --git a/qc/defs_builtins.qc b/qc/defs_builtins.qc
index 30a0093..6d0e31e 100644
--- a/qc/defs_builtins.qc
+++ b/qc/defs_builtins.qc
@@ -303,7 +303,7 @@ void(entity e) makestatic = #69;
// argument will be passed to the next map in the 'startspot' global, and
// the next map will be loaded from archived state if it was previously
// visited. If not specified, all archived map states will be purged.
-void(string s) changelevel = #70;
+void(string s, optional string newmapstartspot) changelevel = #70;
#endif
// #71 was removed
@@ -458,6 +458,15 @@ string(string s, ...) strzone = #118;
void(string s) strunzone = #119;
#endif
+#if defined(CSQC) || defined(SSQC)
+// Part of EXT_CSQC -- copied from fteextensions.qc -- CEV
+// Acts as an alternative to:
+// precache_model(foo);setmodel(bar, foo); return bar.modelindex;
+// If queryonly is set and the model was not previously precached, the
+// builtin will return 0 without needlessly precaching the model.
+float(string modelname, optional float queryonly) getmodelindex = #200;
+#endif
+
#ifdef CSQC
// Part of FTE_STRINGS -- copied from fteextensions.qc -- CEV
// Retrieves the character value at offset 'index'.
@@ -482,14 +491,12 @@ string(float ccase, float redalpha, float redchars, string str, ...)
#endif
#ifdef SSQC
-// Specifies what data to use in order to send various stats, in a
-// client-specific way.
-// 'num' should be a value between 32 and 127, other values are reserved.
-// 'type' must be set to one of the EV_* constants, one of EV_FLOAT,
-// EV_STRING, EV_INTEGER, EV_ENTITY.
-// fld must be a reference to the field used, each player will be sent
-// only their own copy of these fields.
-void(float num, float type, .__variant fld) clientstat = #232;
+// Part of FTE_ISBACKBUFFERED -- copied from fteextensions.qc -- CEV
+// Returns if the given player's network buffer will take multiple
+// network frames in order to clear. If this builtin returns non-zero,
+// you should delay or reduce the amount of reliable (and also
+// unreliable) data that you are sending to that client.
+float(entity player) isbackbuffered = #234;
#endif
#if defined(CSQC) || defined(SSQC)
@@ -643,7 +650,9 @@ float(float stnum, optional float firstbit, optional float bitcount)
// Older engines may use 4 consecutive integer stats, with a limit of 15
// chars (yes, really. 15.), but FTE Quake uses a separate namespace for
// string stats and has a much higher length limit.
+/*
string(float stnum) getstats = #332;
+*/
// copied from fteextension.qc -- CEV
// Sets a model by precache index instead of by name. Otherwise identical
@@ -799,6 +808,9 @@ void(entity e, string s) clientcommand = #440;
float(string s) tokenize = #441;
string(float n) argv = #442;
+// Part of DP_QC_FINDFLAGS -- copied from fteextensions.qc -- CEV
+entity(entity start, .float fld, float match) findflags = #449;
+
// Part of DP_QC_EDICT_NUM -- copied from fteextensions.qc -- CEV
entity(float entnum) edict_num = #459;
@@ -853,3 +865,15 @@ float(string key, optional float assumevalue)
#if defined(CSQC) || defined(SSQC)
float(entity pusher, vector move, vector amove) pushmove = #0:pushmove;
#endif
+
+#if defined(SCQC) || defined(SSQC)
+// copied from fteextensions.qc -- CEV
+// Finds all entities linked with a bbox within a distance of the 'org'
+// specified, returning the list as a temp-array (world signifies the end).
+// Unlike findradius, sv_gameplayfix_blowupfallenzombies is ignored (use
+// FL_FINDABLE_NONSOLID instead), while sv_gameplayfix_findradiusdistancetobox
+// and dpcompat_findradiusarealinks are force-enabled. The resulting buffer
+// will automatically be cleaned up by the engine and does not need to be freed.
+entity*(vector org, float rad, __out int foundcount, int sort=0)
+ findradius_list = #0:findradius_list;
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/defs_const.qc
diff --git a/qc/defs_const.qc b/qc/defs_const.qc
index 0cc80e2..da170e8 100644
--- a/qc/defs_const.qc
+++ b/qc/defs_const.qc
@@ -2,180 +2,300 @@
// Global Program Constants
//==============================================================================
-#pragma target FTE
-
//======================================================================
// constants
//======================================================================
+#if defined(CSQC) || defined(SSQC)
// inspired by Copper
const string version = "\n\"Dog\" mode for FTE\nversion 0.1b";
-const float FALSE = 0; //
+const float FALSE = 0;
const float TRUE = 1;
const float NEGATIVE = -1;
-
const float M_PI = 3.14159265358979323846; // matches value in gcc v2 math.h
-
-const float FL_FLY = 1; // standard id1 .flags follow
-const float FL_SWIM = 2;
-const float FL_CLIENT = 8; // set for all client edicts
-const float FL_INWATER = 16; // for enter / leave water splash
-const float FL_MONSTER = 32;
-const float FL_GODMODE = 64; // player cheat
-const float FL_NOTARGET = 128; // player cheat
-const float FL_ITEM = 256; // extra wide size for bonus items
-const float FL_ONGROUND = 512; // standing on something
-const float FL_PARTIALGROUND = 1024; // not all corners are valid
-const float FL_WATERJUMP = 2048; // player jumping out of water
-const float FL_JUMPRELEASED = 4096; // for jump debouncing
-const float FL_NOSELECT = 8192; // ignored by entity selector
-const float FL_NOCENTERPRINT = 65536; // don't centerprint entity's message
- // field when its targets are used
-const float FL_LAGGEDMOVE = 65536; // Enables anti-lag on rockets etc.
-
-const float MOVETYPE_NONE = 0; // .movetype values; never moves
-// const float MOVETYPE_ANGLENOCLIP = 1;
-// const float MOVETYPE_ANGLECLIP = 2;
-const float MOVETYPE_WALK = 3; // players only
-const float MOVETYPE_STEP = 4; // discrete, not real time unless fall
-const float MOVETYPE_FLY = 5;
-const float MOVETYPE_TOSS = 6; // gravity
-const float MOVETYPE_PUSH = 7; // no clip to world, push and crush
-const float MOVETYPE_NOCLIP = 8;
-const float MOVETYPE_FLYMISSILE = 9; // fly with extra size against monsters
-const float MOVETYPE_BOUNCE = 10; // standard bounce
-const float MOVETYPE_BOUNCEMISSILE = 11;// bounce with extra size
-
-const float SOLID_NOT = 0; // .solid values; no interaction
-const float SOLID_TRIGGER = 1; // touch on edge, but not blocking
-const float SOLID_BBOX = 2; // touch on edge, block
-const float SOLID_SLIDEBOX = 3; // touch on edge, but not an onground
-const float SOLID_BSP = 4; // bsp clip, touch on edge, block
-// Non-solid to SOLID_SLIDEBOX or other SOLID_CORPSE entities. For hitscan
-// weapons to hit corpses, change the player's .solid value to
-// SOLID_BBOX or so, perform the traceline, then revert the player's
-// .solid value.
-const float SOLID_CORPSE = 5;
-
-// the following block from fteextensions.qc was originally ifdef CSQC;
-// I've removed that check because these are just constants -- CEV
-const float STAT_HEALTH = 0; // Player's health.
-// This is the modelindex of the current viewmodel (renamed from the
-// original name 'STAT_WEAPON' due to confusions).
-const float STAT_WEAPONMODELI = 2;
-const float STAT_AMMO = 3; // player.currentammo
-const float STAT_ARMOR = 4;
-const float STAT_WEAPONFRAME = 5;
-const float STAT_SHELLS = 6;
-const float STAT_NAILS = 7;
-const float STAT_ROCKETS = 8;
-const float STAT_CELLS = 9;
-const float STAT_ACTIVEWEAPON = 10; // player.weapon
-const float STAT_TOTALSECRETS = 11;
-const float STAT_TOTALMONSTERS = 12; // required by Hipnotic code
-const float STAT_FOUNDSECRETS = 13;
-const float STAT_KILLEDMONSTERS = 14;
-// self.items | (self.items2<<23).
-// In order to decode this stat properly, you need to use
-// getstatbits(STAT_ITEMS,0,23) to read self.items, and
-// getstatbits(STAT_ITEMS,23,11) to read self.items2 or
-// getstatbits(STAT_ITEMS,28,4) to read the visible part
-// of serverflags, whichever is applicable.
-const float STAT_ITEMS = 15;
-const float STAT_VIEWHEIGHT = 16; // player.view_ofs_z
-// This stat contains the number of the entity in the server's .view2 field.
-const float STAT_VIEW2 = 20;
-// Scales fov and sensitiity. Part of DP_VIEWZOOM.
-const float STAT_VIEWZOOM = 21;
-const float STAT_IDEALPITCH = 25;
-const float STAT_PUNCHANGLE_X = 26;
-const float STAT_PUNCHANGLE_Y = 27;
-const float STAT_PUNCHANGLE_Z = 28;
-// Custom user stats start here (lower values are reserved for engine use).
-// const float STAT_USER = 32;
-const float STAT_PLAYERSPEED = 33; // player's horizontal speed -- CEV
-
-const float IT_AXE = 4096; // .items flag values
-const float IT_SHOTGUN = 1; // this is pretty much maxed out at
-const float IT_SUPER_SHOTGUN = 2; // 23 values already -- CEV
-const float IT_NAILGUN = 4;
-const float IT_SUPER_NAILGUN = 8;
-const float IT_GRENADE_LAUNCHER = 16;
-const float IT_ROCKET_LAUNCHER = 32;
-const float IT_LIGHTNING = 64;
-const float IT_EXTRA_WEAPON = 128;
-const float IT_SHELLS = 256;
-const float IT_NAILS = 512;
-const float IT_ROCKETS = 1024;
-const float IT_CELLS = 2048;
-const float IT_ARMOR1 = 8192;
-const float IT_ARMOR2 = 16384;
-const float IT_ARMOR3 = 32768;
-const float IT_SUPERHEALTH = 65536;
-const float IT_KEY1 = 131072;
-const float IT_KEY2 = 262144;
-const float IT_INVISIBILITY = 524288;
-const float IT_INVULNERABILITY = 1048576;
-const float IT_SUIT = 2097152;
-const float IT_QUAD = 4194304;
-
-const float SERVERFLAGS_RUNE1 = 32; //
-const float SERVERFLAGS_RUNE2 = 64; //
-const float SERVERFLAGS_RUNE3 = 128; //
-const float SERVERFLAGS_RUNE4 = 256; //
+const float M_DEG2RAD = 0.01745329251994329576;
+const float M_RAD2DEG = 57.29577951308232087679;
const vector VEC_ORIGIN = '0 0 0'; // origin & null vector value
-
const vector VEC_HULL_MIN = '-16 -16 -24';
const vector VEC_HULL_MAX = '16 16 32'; // Quake standard HULL1
const vector VEC_HULL_SIZE = '32 32 56';
const vector VEC_HULL2_MIN = '-32 -32 -24';
const vector VEC_HULL2_MAX = '32 32 64';// Quake standard HULL2
const vector VEC_HULL2_SIZE = '64 64 88';
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+// input button mapping -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ INPUT_BUTTON0, // attack 1
+ // INPUT_BUTTON1, // not supported by the network protocol
+ INPUT_BUTTON2, // jump
+ INPUT_BUTTON3, //
+ INPUT_BUTTON4, //
+ INPUT_BUTTON5, //
+ INPUT_BUTTON6, // grab
+ INPUT_BUTTON7, // walk
+ INPUT_BUTTON8 // crouch
+} input_button_flags;
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+// entity .flags
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ FL_FLY = 1, // standard id1 .flags
+ 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
+ FL_NOSELECT = 8192, // ignored by entity selector
+ FL_FINDABLE_NONSOLID = 16384, // entity discoverable w/findradius
+ FL_UNUSED1 = 32768, // unused flag -- CEV
+ FL_LAGGEDMOVE = 65536, // FTE SSQC: enables anti-lag
+ FL_NOCENTERPRINT, // don't centerprint when targets used
+ FL_MUZZLEFLASH, // EF_MUZZLEFLASH replacement -- CEV
+ FL_DIMLIGHT, // EF_DIMLIGHT replacement -- CEV
+ FL_UNUSED2, // unused flags -- CEV
+ FL_UNUSED3,
+ FL_UNUSED4,
+ FL_THROW_HELD // holding grab (23rd flag) -- CEV
+} entity_flags;
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+// entity .modelflags
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ MF_ROCKET = 1,
+ MF_GRENADE = 2,
+ MF_GIB = 4, // Regular blood trail
+ MF_ROTATE = 8,
+ MF_TRACER = 16, // AKA: green scrag trail
+ MF_ZOMGIB = 32, // Dark blood trail
+ MF_TRACER2 = 64, // AKA: hellknight projectile trail
+ MF_TRACER3 = 128 // AKA: purple vore trail
+} entity_modelflags;
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+// entity movetypes
+//----------------------------------------------------------------------
+typedef enum
+{
+ MOVETYPE_NONE, // NONE never moves
+ // MOVETYPE_ANGLENOCLIP = 1,
+ // MOVETYPE_ANGLECLIP = 2,
+ 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, // standard bounce
+ MOVETYPE_BOUNCEMISSILE // bounce with extra size
+} entity_movetypes;
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+// entity .solid types
+//----------------------------------------------------------------------
+typedef enum
+{
+ SOLID_NOT = 0, // no interaction (nonsolid)
+ SOLID_TRIGGER = 1, // touch on edge, but not blocking
+ SOLID_BBOX = 2, // touch on edge, block
+ SOLID_SLIDEBOX = 3, // touch on edge, but not an onground
+ SOLID_BSP = 4, // bsp clip, touch on edge, block
+ SOLID_CORPSE = 5 // Nonsolid to SLIDEBOX or other CORPSE
+} entity_solidtypes;
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+// entity .items flags
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ IT_RUNE1, // .items flag values
+ IT_RUNE2, // note that weapons are not included
+ IT_RUNE3, // RUNE1-RUNE4 are id1 standard sigils
+ IT_RUNE4,
+ IT_RUNE5, // RUNE5-RUNE6 are mg1 additional sigils
+ IT_RUNE6,
+ // IT_UNUSED = 64, // two unused flags
+ // IT_UNUSED = 128,
+ // IT_SHELLS = 256, // id1 standard ammo flags (unused)
+ // IT_NAILS = 512,
+ // IT_ROCKETS = 1024,
+ // IT_CELLS = 2048,
+ // IT_UNUSED = 4096, // another unused flag
+ IT_ARMOR1 = 8192, // id1 armors
+ IT_ARMOR2 = 16384,
+ IT_ARMOR3 = 32768,
+ IT_SUPERHEALTH = 65536, // megahealth
+ IT_KEY1 = 131072, // id1 keys
+ IT_KEY2 = 262144,
+ IT_INVISIBILITY = 524288, // id1 ring
+ IT_INVULNERABILITY = 1048576, // id1 pent
+ IT_SUIT = 2097152, // id1 environment suit
+ IT_QUAD = 4194304 // id1 quad damage; 22nd flag
+} entity_item_flags;
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+// entity .effects flags
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ EF_BRIGHTFIELD = 1,
+ EF_MUZZLEFLASH = 2,
+ EF_BRIGHTLIGHT = 4,
+ EF_DIMLIGHT = 8
+} entity_effects_flags;
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+// entity_point_contenttypes -- values returned by pointcontents ()
+//----------------------------------------------------------------------
+typedef enum
+{
+ CONTENT_EMPTY = -1, // in the open
+ CONTENT_SOLID = -2, // in a solid
+ CONTENT_WATER = -3, // point in water
+ CONTENT_SLIME = -4, // in slime
+ CONTENT_LAVA = -5, // lava
+ CONTENT_SKY = -6 // in sky - oh no!
+} entity_pointcontent_types;
+#endif
- // common protocol bytes
-const float SVC_UPDATESTAT = 3; // required by Hipnotic code
-const float SVC_SETVIEWPORT = 5; // Camera Hip. Drake devkit dumptruck_ds
-const float SVC_SETVIEWANGLES = 10; // Camera Hip. Drake devkit dumptruck_ds
-const float SVC_TEMPENTITY = 23;
-const float SVC_KILLEDMONSTER = 27;
-const float SVC_FOUNDSECRET = 28;
-const float SVC_INTERMISSION = 30;
-const float SVC_FINALE = 31;
-const float SVC_CDTRACK = 32;
-const float SVC_SELLSCREEN = 33;
-const float SVC_CUTSCENE = 34; // Hipnotic Drake devkit -- dumptruck_ds
-const float SVC_CGAMEPACKET = 83; // FTE CSQC_Parse_Event -- CEV
-
-const float TE_SPIKE = 0; // temporary entity protocol bytes
-const float TE_SUPERSPIKE = 1;
-const float TE_GUNSHOT = 2;
-const float TE_EXPLOSION = 3;
-const float TE_TAREXPLOSION = 4;
-const float TE_LIGHTNING1 = 5;
-const float TE_LIGHTNING2 = 6;
-const float TE_WIZSPIKE = 7;
-const float TE_KNIGHTSPIKE = 8;
-const float TE_LIGHTNING3 = 9;
-const float TE_LAVASPLASH = 10;
-const float TE_TELEPORT = 11;
-const float TE_EXPLOSION2 = 12; // from doe -- dumptruck_ds
-
-const float ATTN_NONE = 0; // sound attenuation; no attenuation
-const float ATTN_NORM = 1; // standard attenuation
-const float ATTN_IDLE = 2; // extra attenuation
-const float ATTN_FEET = 2;
-const float ATTN_STATIC = 3; // even more attn. (good for torches)
-
-const float CHAN_AUTO = 0; // sound channels; 0 never overrides
-const float CHAN_WEAPON = 1; //
-const float CHAN_VOICE = 2; //
-const float CHAN_ITEM = 3;
-const float CHAN_BODY = 4;
-const float CHAN_FEET = 5; // dedicated channel for steps -- CEV
-const float CHAN_SLIDE = 6; //
+#ifdef SSQC
+//----------------------------------------------------------------------
+// entity .deadflag values
+//----------------------------------------------------------------------
+typedef enum
+{
+ DEAD_NO = 0,
+ DEAD_DYING = 1,
+ DEAD_DEAD = 2,
+ DEAD_RESPAWNABLE = 3
+} entity_deadflag_types;
+#endif
+#ifdef SSQC
+//----------------------------------------------------------------------
+// entity .takedamage values
+//----------------------------------------------------------------------
+typedef enum
+{
+ DAMAGE_NO = 0,
+ DAMAGE_YES = 1,
+ DAMAGE_AIM = 2
+} entity_takedamage_types;
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+// surface types (used for footstep sounds); see world_surface_type -- CEV
+//----------------------------------------------------------------------
+typedef enum
+{
+ SURFACE_UNKNOWN,
+ SURFACE_DIRT,
+ SURFACE_GRASS,
+ SURFACE_METAL,
+ SURFACE_STONE, // the default type (in most cases)
+ SURFACE_WOOD,
+ SURFACE_WATER,
+ SURFACE_WADING
+} world_surface_types;
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+// q3surfaceflags - valid for trace_surfaceflagsf -- CEV
+// the following definitions are copied from dpextensions.qc -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ Q3SURFACEFLAG_NODAMAGE = 1,
+ Q3SURFACEFLAG_SLICK = 2, // low friction surface
+ Q3SURFACEFLAG_SKY = 4, // sky surface (also NOIMPACT & NOMARKS)
+ Q3SURFACEFLAG_LADDER = 8, // climbable surface
+ Q3SURFACEFLAG_NOIMPACT = 16, // projectiles should remove themselves
+ Q3SURFACEFLAG_NOMARKS = 32, // projectiles should not leave marks
+ Q3SURFACEFLAG_FLESH = 64, // projectiles should do a fleshy effect
+ Q3SURFACEFLAG_NODRAW = 128, // compiler hint (not important to qc)
+ // Q3SURFACEFLAG_HINT = 256, // compiler hint (not important to qc)
+ // Q3SURFACEFLAG_SKIP = 512, // compiler hint (not important to qc)
+ // Q3SURFACEFLAG_NOLIGHTMAP = 1024, // compiler hint (not important)
+ // Q3SURFACEFLAG_POINTLIGHT = 2048, // compiler hint (not important)
+ Q3SURFACEFLAG_METALSTEPS = 4096,// surface should make metal step sounds
+ Q3SURFACEFLAG_NOSTEPS = 8192, // surface should not make step sounds
+ Q3SURFACEFLAG_NONSOLID = 16384 // compiler hint (not important to qc)
+} world_q3surfaceflags;
+#endif
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// sound channels
+//----------------------------------------------------------------------
+typedef enum
+{
+ CHAN_AUTO = 0, // 0 never overrides
+ CHAN_WEAPON = 1, // dedicated weapon sounds
+ CHAN_VOICE, // player/monster voice
+ CHAN_ITEM, // misc item sounds
+ CHAN_ITEM_AMMO, // ammo sounds
+ CHAN_ITEM_ARMOR, // armor sounds
+ CHAN_ITEM_HEALTH, // health sounds
+ CHAN_ITEM_POWERUP, // powerup sounds
+ CHAN_ITEM_WEAPON, // weapon sounds
+ CHAN_ITEM_WEAPON_ROCKETS, // rocket launcher sounds
+ CHAN_BODY, //
+ CHAN_FEET, // dedicated channel for steps -- CEV
+ CHAN_SLIDE // dedicated channel for sliding -- CEV
+} sound_channels;
+#endif
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// sound attenuation values
+//----------------------------------------------------------------------
+typedef enum
+{
+ ATTN_NONE = 0, // sound attenuation; no attenuation
+ ATTN_NORM = 1, // standard attenuation
+ ATTN_IDLE = 2, // extra attenuation
+ ATTN_FEET = 2,
+ ATTN_STATIC = 3 // even more attn. (good for torches)
+} sound_attenuation_types;
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+// sound volume presets -- CEV
+//----------------------------------------------------------------------
const float VOL_MAX = 1.0; // sound volume: maximum
const float VOL_HIGH = 0.9; // sound volume: high
const float VOL_MHI = 0.7; // sound volume: medium-high
@@ -183,191 +303,309 @@ const float VOL_MID = 0.5; // sound volume: middle
const float VOL_LOW = 0.25; // low volume; ambient sounds
const float VOL_MIN = 0.1; // minimal volume
const float VOL_SILENT = 0.0; // silent
+#endif
-const float EF_BRIGHTFIELD = 1; // entity .effects values
-const float EF_MUZZLEFLASH = 2;
-const float EF_BRIGHTLIGHT = 4;
-const float EF_DIMLIGHT = 8;
-
-const float MSG_BROADCAST = 0; // net message dest.; unreliable to all
-const float MSG_ONE = 1; // reliable to one (msg_entity)
-const float MSG_ALL = 2; // reliable to all
-const float MSG_INIT = 3; // write to the init string
-// The byte(s) will be written into the multicast buffer for more
-// selective sending. Messages sent this way will never be split across
-// packets, and using this for csqc-only messages will not break protocol
-// translation.
-const float MSG_MULTICAST = 4;
-const float MSG_ENTITY = 5; // used only in 'SendEntity' functions
-
-const float MULTICAST_ALL = 0; // unreliable to all players
-const float MULTICAST_PHS = 1; // unreliable to players that can hear
-const float MULTICAST_PVS = 2; // unreliable to players that can see
-const float MULTICAST_ONE = 6; // unreliable to msg_entity global
-const float MULTICAST_ALL_R = 3; // reliable to all players
-const float MULTICAST_PHS_R = 4; // reliable to players that can hear
-const float MULTICAST_PVS_R = 5; // reliable to players that can see
-const float MULTICAST_ONE_R = 7; // reliable to msg_entity global
-
-const float TRIGGER_CENTERPRINTALL = 1048576; // program-wide spawnflags
-const float SPAWN_SILENTLY = 2097152;
-
-const float MOVE_NORMAL = 0; // trace flags;
-const float MOVE_NOMONSTERS = 1; // ignore all non-solid_bsp entities
-const float MOVE_MISSILE = 2; // bbox of +/- 15 against FL_MONSTER
-const float MOVE_HITMODEL = 4; // impact mesh instead of bbox
-const float MOVE_TRIGGERS = 16; // impact only triggers
-const float MOVE_EVERYTHING = 32; // solids & triggers & non-solid ents
-const float MOVE_LAGGED = 64; // antilag based on player's latency
-
-const float DEAD_NO = 0; // .deadflag values
-const float DEAD_DYING = 1;
-const float DEAD_DEAD = 2;
-const float DEAD_RESPAWNABLE = 3;
-
-const float DAMAGE_NO = 0; // .takedamage values
-const float DAMAGE_YES = 1;
-const float DAMAGE_AIM = 2;
-
-const float EV_VOID = 0; // variable types
-const float EV_STRING = 1;
-const float EV_FLOAT = 2;
-const float EV_VECTOR = 3;
-const float EV_ENTITY = 4;
-const float EV_FIELD = 5;
-const float EV_FUNCTION = 6;
-const float EV_POINTER = 7;
-const float EV_INTEGER = 8;
-
-const float INPUT_BUTTON0 = 1<<0; // attack 1
-// const float INPUT_BUTTON1 = 0; // not supported by the network protocol
-const float INPUT_BUTTON2 = 1<<1; // jump
-const float INPUT_BUTTON3 = 1<<2; //
-const float INPUT_BUTTON4 = 1<<3; //
-const float INPUT_BUTTON5 = 1<<4; //
-const float INPUT_BUTTON6 = 1<<5; //
-const float INPUT_BUTTON7 = 1<<6; //
-const float INPUT_BUTTON8 = 1<<7; // crouch
-
-enum
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+// soundflags (some of these are only valid on client or server) -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
{
- EVENT_INTERMISSION, // SVC_CGAMEPACKET flags
- EVENT_CSHIFT_FADE, // csf_fade
- EVENT_CSHIFT_SET // csf_set
-};
+ SOUNDFLAG_RELIABLE = 1, // SSQC: sent reliably, no PHS
+ SOUNDFLAG_FORCELOOP = 2, // CSQC & SSQC: sound will restart
+ // The different audio channels are played at the same volume
+ // regardless of which way the player is facing, without needing
+ // to use 0 attenuation.
+ SOUNDFLAG_NOSPACIALISE = 4, // CSQC
+ SOUNDFLAG_ABSVOLUME = 16, // CSQC: vol isn't scaled by vol cvar
+ SOUNDFLAG_NOREVERB = 32, // CSQC & SSQC: disable reverb
+ SOUNDFLAG_FOLLOW = 64, // CSQC & SSQC: update to follow emitter
+ SOUNDFLAG_UNICAST = 256, // SSQC: heard only by msg_entity ent
+ SOUNDFLAG_SENDVELOCITY = 512 // SSQC: vel will be sent (for doppler)
+} sound_flags;
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+// traceline / tracebox flags
+//----------------------------------------------------------------------
+typedef enum
+{
+ MOVE_NORMAL = 0, // traceline / tracebox flags;
+ MOVE_NOMONSTERS = 1, // ignore all non-solid_bsp entities
+ MOVE_MISSILE = 2, // bbox of +/- 15 against FL_MONSTER
+ MOVE_WORLDONLY = 3, //
+ MOVE_HITMODEL = 4, // impact mesh instead of bbox
+ MOVE_TRIGGERS = 16, // impact only triggers
+ MOVE_EVERYTHING = 32, // solids & triggers & non-solid ents
+ MOVE_LAGGED = 64 // antilag based on player's latency
+} trace_moveflags;
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+// rtlight flags
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ PFLAGS_NOSHADOW = 1, // rtlights will not cast shadows
+ PFLAGS_CORONA = 2 // enable coronas on associated rtlights
+} rtlight_flags;
+#endif
#ifdef SSQC
-// The sound will be sent reliably, and without regard to phs.
-const float SOUNDFLAG_RELIABLE = 1;
+//----------------------------------------------------------------------
+// common protocol bytes
+//----------------------------------------------------------------------
+typedef enum
+{
+ SVC_UPDATESTAT = 3, // required by Hipnotic code
+ SVC_SETVIEWPORT = 5, // Camera Hip. Drake devkit dumptruck_ds
+ SVC_SETVIEWANGLES = 10, // Camera Hip. Drake devkit dumptruck_ds
+ SVC_TEMPENTITY = 23,
+ SVC_KILLEDMONSTER = 27,
+ SVC_FOUNDSECRET = 28,
+ SVC_INTERMISSION = 30,
+ SVC_FINALE = 31,
+ SVC_CDTRACK = 32,
+ SVC_SELLSCREEN = 33,
+ SVC_CUTSCENE = 34, // Hipnotic Drake devkit -- dumptruck_ds
+ SVC_CGAMEPACKET = 83 // FTE CSQC_Parse_Event -- CEV
+} game_protocolbytes;
#endif
-#ifdef CSQC
-// The sample's volume is not scaled by the volume cvar. Use with caution
-const float SOUNDFLAG_ABSVOLUME = 16;
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// temporary entity protocol bytes
+//----------------------------------------------------------------------
+typedef enum
+{
+ TE_SPIKE = 0,
+ TE_SUPERSPIKE = 1,
+ TE_GUNSHOT = 2,
+ TE_EXPLOSION = 3,
+ TE_TAREXPLOSION = 4,
+ TE_LIGHTNING1 = 5,
+ TE_LIGHTNING2 = 6,
+ TE_WIZSPIKE = 7,
+ TE_KNIGHTSPIKE = 8,
+ TE_LIGHTNING3 = 9,
+ TE_LAVASPLASH = 10,
+ TE_TELEPORT = 11,
+ TE_EXPLOSION2 = 12 // from doe -- dumptruck_ds
+} game_tempentity_protocolbytes;
#endif
+
#if defined(CSQC) || defined(SSQC)
-// The sound will restart once it reaches the end of the sample.
-const float SOUNDFLAG_FORCELOOP = 2;
+//----------------------------------------------------------------------
+// stat types; valid for getstatf(...), some server messages
+//----------------------------------------------------------------------
+typedef enum
+{
+ STAT_HEALTH = 0, // player's health
+ STAT_WEAPONMODELI = 2, // modelindex of current viewmodel
+ STAT_AMMO = 3, // player.currentammo
+ STAT_ARMOR = 4,
+ STAT_WEAPONFRAME = 5,
+ STAT_SHELLS = 6,
+ STAT_NAILS = 7,
+ STAT_ROCKETS = 8,
+ STAT_CELLS = 9,
+ STAT_ACTIVEWEAPON = 10, // player.weapon
+ STAT_TOTALSECRETS = 11,
+ STAT_TOTALMONSTERS = 12, // required by Hipnotic code
+ STAT_FOUNDSECRETS = 13,
+ STAT_KILLEDMONSTERS = 14,
+ STAT_ITEMS = 15, // self.items | (self.items2<<23)
+ STAT_VIEWHEIGHT = 16, // player.view_ofs_z
+ STAT_VIEW2 = 20, // num of ents in server's .view2 field
+ STAT_VIEWZOOM = 21, // scales fov and sens. See DP_VIEWZOOM
+ STAT_IDEALPITCH = 25,
+ STAT_PUNCHANGLE_X = 26,
+ STAT_PUNCHANGLE_Y = 27,
+ STAT_PUNCHANGLE_Z = 28
+} game_stats;
#endif
-#ifdef CSQC
-// The different audio channels are played at the same volume regardless of
-// which way the player is facing, without needing to use 0 attenuation.
-const float SOUNDFLAG_NOSPACIALISE = 4;
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// server message destinations
+//----------------------------------------------------------------------
+typedef enum
+{
+ MSG_BROADCAST = 0, // unreliable to all
+ MSG_ONE = 1, // reliable to one (msg_entity)
+ MSG_ALL = 2, // reliable to all
+ MSG_INIT = 3, // write to the init string
+ // The byte(s) will be written into the multicast buffer for more
+ // selective sending. Messages sent this way will never be split
+ // across packets, and using this for csqc-only messages will not
+ // break protocol translation.
+ MSG_MULTICAST = 4,
+ MSG_ENTITY = 5 // used only in 'SendEntity' functions
+} game_server_messagedest;
+#endif
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// server message multicast sets. valid for argument 2 of multicast -- CEV
+//----------------------------------------------------------------------
+typedef enum
+{
+ MULTICAST_ALL = 0, // unreliable to all players
+ MULTICAST_PHS = 1, // unreliable to players that can hear
+ MULTICAST_PVS = 2, // unreliable to players that can see
+ MULTICAST_ALL_R = 3, // reliable to all players
+ MULTICAST_PHS_R = 4, // reliable to players that can hear
+ MULTICAST_PVS_R = 5, // reliable to players that can see
+ MULTICAST_ONE = 6, // unreliable to msg_entity global
+ MULTICAST_ONE_R = 7 // reliable to msg_entity global
+} game_server_multicastsets;
#endif
+
#if defined(CSQC) || defined(SSQC)
-// Disables the use of underwater/reverb effects on this sound effect.
-const float SOUNDFLAG_NOREVERB = 32;
-// The sound's origin will updated to follow the emitting entity.
-const float SOUNDFLAG_FOLLOW = 64;
+//----------------------------------------------------------------------
+// valid for MSG_MULTICAST SVC_CGAMEPACKET, see CSQC_Parse_Event -- CEV
+//----------------------------------------------------------------------
+typedef enum
+{
+ EVENT_INTERMISSION, // intermission changed on the server
+ EVENT_CSHIFT_FADE, // csf_fade
+ EVENT_CSHIFT_SET, // csf_set
+ EVENT_LIGHTNING2 // TE_LIGHTNING2
+} game_multicast_events;
#endif
-#ifdef SSQC
-// The sound will be heard only by the player specified by msg_entity.
-const float SOUNDFLAG_UNICAST = 256;
-// The entity's current velocity will be sent to the client, only useful
-// if doppler is enabled.
-const float SOUNDFLAG_SENDVELOCITY = 512;
+
+#ifdef CSQC
+//----------------------------------------------------------------------
+// game client properties - valid for getproperty, setproperty -- CEV
+//----------------------------------------------------------------------
+typedef enum
+{
+ VF_MIN = 1, // top-left of the 3d viewport
+ VF_SIZE = 4, // width+height of the 3d viewport
+ VF_ORIGIN = 11, // origin of the view (not the player)
+ VF_ORIGIN_X = 12,
+ VF_ORIGIN_Y = 13,
+ VF_ORIGIN_Z = 14,
+ VF_ANGLES = 15, // angles the view will be drawn at
+ VF_ANGLES_X = 16,
+ VF_ANGLES_Y = 17,
+ VF_ANGLES_Z = 18,
+ VF_DRAWWORLD = 19, // boolean; draw world?
+ VF_DRAWENGINESBAR = 20, // boolean; draw engine statusbar?
+ VF_DRAWCROSSHAIR = 21, // boolean; draw engine crosshair?
+ VF_CL_VIEWANGLES = 33,
+ VF_CL_VIEWANGLES_X = 34,
+ VF_CL_VIEWANGLES_Y = 35,
+ VF_CL_VIEWANGLES_Z = 36,
+ // VF_VIEWENTITY -- Changes the RF_EXTERNALMODEL flag on entities to
+ // match the new selection, and removes entities flaged with
+ // RF_VIEWENTITY. Requires cunning use of .entnum and typically
+ // requires calling addentities(MASK_VIEWMODEL) too.
+ VF_VIEWENTITY = 206
+} game_client_properties;
#endif
#ifdef CSQC
//----------------------------------------------------------------------
-// Valid as a return value from the predraw function. Returning this will
-// simply move on to the next entity without the autoadd behaviour, so can
-// be used for particle/invisible/special entites, or entities that were
-// explicitly drawn with addentity.
-//----------------------------------------------------------------------
-const float PREDRAW_NEXT = 1;
-
-//----------------------------------------------------------------------
-// These constants are only used in CSQC_UpdateView
-//----------------------------------------------------------------------
-const float DRAWMASK_NONE = 0;
-const float DRAWMASK_ENGINE = 1;
-const float DRAWMASK_VIEWMODEL = 2;
-const float DRAWMASK_NORMAL = 4;
-
-// Valid as a return value from the predraw function. Returning this will
-// cause the engine to automatically invoke addentity(self) for you.
-const float PREDRAW_AUTOADD = 0;
-
-// Valid as a return value from the predraw function. Returning this will
-// simply move on to the next entity without the autoadd behaviour, so can
-// be used for particle/invisible/special entites, or entities that were
-// explicitly drawn with addentity.
-const float PREDRAW_NEXT = 1;
-
-//----------------------------------------------------------------------
-const float VF_MIN = 1;
-const float VF_SIZE = 4;
-const float VF_ORIGIN = 11;
-const float VF_ORIGIN_X = 12;
-const float VF_ORIGIN_Y = 13;
-const float VF_ORIGIN_Z = 14;
-const float VF_ANGLES = 15;
-const float VF_ANGLES_X = 16;
-const float VF_ANGLES_Y = 17;
-const float VF_ANGLES_Z = 18;
-const float VF_DRAWWORLD = 19;
-const float VF_DRAWENGINESBAR = 20;
-const float VF_DRAWCROSSHAIR = 21;
-const float VF_CL_VIEWANGLES = 33;
-const float VF_CL_VIEWANGLES_X = 34;
-const float VF_CL_VIEWANGLES_Y = 35;
-const float VF_CL_VIEWANGLES_Z = 36;
-const float VF_VIEWENTITY = 206;
-
-enumflags
+// drawmask flags; these constants are only used in CSQC_UpdateView -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
{
- RF_VIEWMODEL,
- RF_EXTERNALMODEL,
- RF_DEPTHHACK,
- RF_ADDITIVE,
- RF_USEAXIS,
- RF_NOSHADOW
-};
+ DRAWMASK_NONE = 0,
+ DRAWMASK_ENGINE = 1,
+ DRAWMASK_VIEWMODEL = 2,
+ DRAWMASK_NORMAL = 4
+} game_client_drawflags;
#endif
-#if defined(CSQC) || defined(SSQC)
-// Associated RT lights attached will not cast shadows, making them
-// significantly faster to draw.
-const float PFLAGS_NOSHADOW = 1;
-// Enables support of coronas on the associated rtlights.
-const float PFLAGS_CORONA = 2;
+#ifdef CSQC
+//----------------------------------------------------------------------
+// return values from the predraw function -- CEV
+//----------------------------------------------------------------------
+typedef enum
+{
+ // Returning this will cause the engine to automatically invoke
+ // addentity(self) for you.
+ PREDRAW_AUTOADD = 0,
+ // Returning this will simply move on to the next entity without
+ // the autoadd behaviour, so can be used for particle/invisible/special
+ // entites, or entities that were explicitly drawn with addentity.
+ PREDRAW_NEXT = 1
+} game_client_predrawflags;
#endif
-#if defined(CSQC) || defined(SSQC)
-enum
+#ifdef CSQC
+//----------------------------------------------------------------------
+// clientside entity renderflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
{
- SURFACE_UNKNOWN, // surface types -- CEV
- SURFACE_DIRT,
- SURFACE_GRASS,
- SURFACE_METAL,
- SURFACE_STONE, // the default type (in most cases)
- SURFACE_WOOD,
- SURFACE_WATER,
- SURFACE_WADING
-};
+ RF_VIEWMODEL = 1, // the entity is a view model
+ RF_EXTERNALMODEL = 2, // visible in mirrors but not otherwise
+ // Hacks the depth values such that the entity uses depth values as
+ // if it were closer to the screen. This is useful when combined with
+ // viewmodels to avoid weapons poking in to walls.
+ RF_DEPTHHACK,
+ RF_ADDITIVE, // additive blend instead of normal
+ // The entity will be oriented according to the current
+ // v_forward+v_right+v_up vector values instead of the entity's
+ // .angles field.
+ RF_USEAXIS,
+ RF_NOSHADOW // entity will not cast shadows
+} game_client_renderflags;
+#endif
+
+#ifdef CSQC
+//----------------------------------------------------------------------
+// fieldnum arguments valid for getentity -- CEV
+//----------------------------------------------------------------------
+typedef enum
+{
+ GE_MAXENTS = -1, // max num of valid entities
+ GE_ACTIVE = 0, // is this entity known to the client?
+ GE_ORIGIN = 1, // interpolated .origin
+ GE_FORWARD = 2, // interpolated forward vector
+ GE_RIGHT = 3, // entity's right vector
+ GE_UP = 4, // entity's up vector
+ GE_SCALE = 5, // .scale
+ GE_ORIGINANDVECTORS = 6, // interpolated .origin + v_forward etc
+ GE_ALPHA = 7, // entity .alpha
+ GE_COLORMOD = 8, // colormod vector
+ GE_PANTSCOLOR = 9, // entity's lower color (from .colormap)
+ GE_SHIRTCOLOR = 10, // entity's upper color (from .colormap)
+ GE_SKIN = 11, // entity's .skin index
+ GE_MINS = 12, // entity's .min vector
+ GE_MAXS = 13, // entity's .max vector
+ GE_ABSMIN = 14, // entity's .absmin vector
+ GE_ABSMAX = 15, // entity's .absmax vector
+ GE_MODELINDEX = 200, // guess entity's .modelindex float
+ GE_MODELINDEX2 = 201, // guess entity's .vw_index float
+ GE_EFFECTS = 202, // guess entity's .effects float
+ GE_FRAME = 203, // guess entity's .frame float
+ GE_ANGLES = 204, // guess entity's .angles vector
+ GE_FATNESS = 205, // guess entity's .fatness float
+ GE_DRAWFLAGS = 206, // guess entity's .drawflags float
+ GE_ABSLIGHT = 207, // guess entity's .abslight float
+ GE_GLOWMOD = 208, // guess entity's .glowmod vector
+ GE_GLOWSIZE = 209, // guess entity's .glowside float
+ GE_GLOWCOLOUR = 210, // guess entity's .glowcolor float
+ GE_RTSTYLE = 211, // guess entity's .style float
+ GE_RTPFLAGS = 212, // guess entity's .pflags float
+ GE_RTCOLOUR = 213, // guess entity's .color vector
+ GE_RTRADIUS = 214, // guess entity's .light_lev float
+ GE_TAGENTITY = 215, // guess entity's .tag_entity float
+ GE_TAGINDEX = 216, // guess entity's .tag_index float
+ GE_GRAVITYDIR = 217, // guess entity's .gravitydir vector
+ GE_TRAILEFFECTNUM = 218 // guess entity's .traileffectnum float
+} game_client_entityfieldnums;
#endif
#ifdef CSQC
+//----------------------------------------------------------------------
+// arguments for serverkey, serverkeyfloat, etc. -- CEV
+//----------------------------------------------------------------------
// The address of the server we connected to
const string SERVERKEY_IP = "ip";
// The hostname that was last passed to the connect command
@@ -399,164 +637,3 @@ const string SERVERKEY_PROTOCOL = "protocol";
// The number of player/spectator slots allocated on the server.
const string SERVERKEY_MAXPLAYERS = "maxplayers";
#endif
-
-#ifdef CSQC
-// Valid for getentity, ignores the entity argument. Returns the maximum
-// number of entities which may be valid, to avoid having to poll 65k
-// when only 100 are used.
-const float GE_MAXENTS = -1;
-// Valid for getentity. Returns whether this entity is known to the client
-// or not.
-const float GE_ACTIVE = 0;
-// Valid for getentity. Returns the interpolated .origin.
-const float GE_ORIGIN = 1;
-// Valid for getentity. Returns the interpolated forward vector.
-const float GE_FORWARD = 2;
-// Valid for getentity. Returns the entity's right vector.
-const float GE_RIGHT = 3;
-// Valid for getentity. Returns the entity's up vector.
-const float GE_UP = 4;
-// Valid for getentity. Returns the entity .scale.
-const float GE_SCALE = 5;
-// Valid for getentity. Returns interpolated .origin, but also sets
-// v_forward, v_right, and v_up accordingly. Use vectoangles(v_forward,v_up)
-// to determine the angles.
-const float GE_ORIGINANDVECTORS = 6;
-// Valid for getentity. Returns the entity alpha.
-const float GE_ALPHA = 7;
-// Valid for getentity. Returns the colormod vector.
-const float GE_COLORMOD = 8;
-// Valid for getentity. Returns the entity's lower color (from .colormap),
-// as a palette range value.
-const float GE_PANTSCOLOR = 9;
-// Valid for getentity. Returns the entity's lower color (from .colormap),
-// as a palette range value.
-const float GE_SHIRTCOLOR = 10;
-// Valid for getentity. Returns the entity's .skin index.
-const float GE_SKIN = 11;
-// Valid for getentity. Guesses the entity's .min vector.
-const float GE_MINS = 12;
-// Valid for getentity. Guesses the entity's .max vector.
-const float GE_MAXS = 13;
-// Valid for getentity. Guesses the entity's .absmin vector.
-const float GE_ABSMIN = 14;
-// Valid for getentity. Guesses the entity's .absmax vector.
-const float GE_ABSMAX = 15;
-// Valid for getentity. Guesses the entity's .modelindex float.
-const float GE_MODELINDEX = 200;
-// Valid for getentity. Guesses the entity's .vw_index float.
-const float GE_MODELINDEX2 = 201;
-// Valid for getentity. Guesses the entity's .effects float.
-const float GE_EFFECTS = 202;
-// Valid for getentity. Guesses the entity's .frame float.
-const float GE_FRAME = 203;
-// Valid for getentity. Guesses the entity's .angles vector.
-const float GE_ANGLES = 204;
-// Valid for getentity. Guesses the entity's .fatness float.
-const float GE_FATNESS = 205;
-// Valid for getentity. Guesses the entity's .drawflags float.
-const float GE_DRAWFLAGS = 206;
-// Valid for getentity. Guesses the entity's .abslight float.
-const float GE_ABSLIGHT = 207;
-// Valid for getentity. Guesses the entity's .glowmod vector.
-const float GE_GLOWMOD = 208;
-// Valid for getentity. Guesses the entity's .glowsize float.
-const float GE_GLOWSIZE = 209;
-// Valid for getentity. Guesses the entity's .glowcolor float.
-const float GE_GLOWCOLOUR = 210;
-// Valid for getentity. Guesses the entity's .style float.
-const float GE_RTSTYLE = 211;
-// Valid for getentity. Guesses the entity's .pflags float.
-const float GE_RTPFLAGS = 212;
-// Valid for getentity. Guesses the entity's .color vector.
-const float GE_RTCOLOUR = 213;
-// Valid for getentity. Guesses the entity's .light_lev float.
-const float GE_RTRADIUS = 214;
-// Valid for getentity. Guesses the entity's .tag_entity float.
-const float GE_TAGENTITY = 215;
-// Valid for getentity. Guesses the entity's .tag_index float.
-const float GE_TAGINDEX = 216;
-// Valid for getentity. Guesses the entity's .gravitydir vector.
-const float GE_GRAVITYDIR = 217;
-// Valid for getentity. Guesses the entity's .traileffectnum float.
-const float GE_TRAILEFFECTNUM = 218;
-#endif
-
-#ifdef CSQC
-const float RSES_NOLERP = 1;
-const float RSES_NOROTATE = 2;
-const float RSES_NOTRAILS = 4;
-const float RSES_NOLIGHTS = 8;
-#endif
-
-#if defined(CSQC) || defined(SSQC)
-// values returned by pointcontents ()
-const float CONTENT_EMPTY = -1;
-const float CONTENT_SOLID = -2;
-const float CONTENT_WATER = -3;
-const float CONTENT_SLIME = -4;
-const float CONTENT_LAVA = -5;
-const float CONTENT_SKY = -6;
-
-// trace_endcontentsi values
-const int CONTENTBIT_NONE = 0x00000000i;
-const int CONTENTBIT_SOLID = 0x00000001i;
-const int CONTENTBIT_LAVA = 0x00000008i;
-const int CONTENTBIT_SLIME = 0x00000010i;
-const int CONTENTBIT_WATER = 0x00000020i;
-// Content bit used for .skin=CONTENT_LADDER entities.
-const int CONTENTBIT_FTELADDER = 0x00004000i;
-const int CONTENTBIT_PLAYERCLIP = 0x00010000i;
-const int CONTENTBIT_MONSTERCLIP = 0x00020000i;
-// Content bit for collisions against SOLID_BBOX/SOLID_SLIDEBOX entities.
-const int CONTENTBIT_BODY = 0x02000000i;
-// Content bit that indicates collisions against SOLID_CORPSE entities.
-const int CONTENTBIT_CORPSE = 0x04000000i;
-// Content bit specific to q2bsp (conflicts with q3bsp contents so use with
-// caution).
-const int CONTENTBIT_Q2LADDER = 0x20000000i;
-// Content bit somewhat specific to q1bsp (aliases to NODROP in q3bsp),
-// but you should probably check surfaceflags&SURF_SKY as well for q2+q3bsp too.
-const int CONTENTBIT_SKY = 0x80000000i;
-// Bits that traceline would normally consider solid */
-const int CONTENTBITS_POINTSOLID = CONTENTBIT_SOLID | 0x00000002i |
- CONTENTBIT_BODY;
-// Bits that tracebox would normally consider solid
-const int CONTENTBITS_BOXSOLID = CONTENTBIT_SOLID|0x00000002i |
- CONTENTBIT_BODY | CONTENTBIT_PLAYERCLIP;
-const int CONTENTBITS_FLUID = CONTENTBIT_WATER | CONTENTBIT_SLIME |
- CONTENTBIT_LAVA | CONTENTBIT_SKY;
-#endif
-
-#if defined(CSQC) || defined(SSQC)
-// the following definitions are copied from dpextensions.qc -- CEV
-const float Q3SURFACEFLAG_NODAMAGE = 1;
-// low friction surface
-const float Q3SURFACEFLAG_SLICK = 2;
-// sky surface (also has NOIMPACT and NOMARKS set)
-const float Q3SURFACEFLAG_SKY = 4;
-// climbable surface
-const float Q3SURFACEFLAG_LADDER = 8;
-// projectiles should remove themselves on impact (this is set on sky)
-const float Q3SURFACEFLAG_NOIMPACT = 16;
-// projectiles should not leave marks, such as decals (this is set on sky)
-const float Q3SURFACEFLAG_NOMARKS = 32;
-// projectiles should do a fleshy effect (blood?) on impact
-const float Q3SURFACEFLAG_FLESH = 64;
-// compiler hint (not important to qc)
-const float Q3SURFACEFLAG_NODRAW = 128;
-// compiler hint (not important to qc)
-// const float Q3SURFACEFLAG_HINT = 256;
-// compiler hint (not important to qc)
-// const float Q3SURFACEFLAG_SKIP = 512;
-// compiler hint (not important to qc)
-// const float Q3SURFACEFLAG_NOLIGHTMAP = 1024;
-// compiler hint (not important to qc)
-// const float Q3SURFACEFLAG_POINTLIGHT = 2048;
-// walking on this surface should make metal step sounds
-const float Q3SURFACEFLAG_METALSTEPS = 4096;
-// walking on this surface should not make footstep sounds
-const float Q3SURFACEFLAG_NOSTEPS = 8192;
-// compiler hint (not important to qc)
-const float Q3SURFACEFLAG_NONSOLID = 16384;
-#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/defs_ctypes.qc
diff --git a/qc/defs_ctypes.qc b/qc/defs_ctypes.qc
index 6eb81a6..2a7fee4 100644
--- a/qc/defs_ctypes.qc
+++ b/qc/defs_ctypes.qc
@@ -19,35 +19,25 @@
// classtype list; shared by client & server
//----------------------------------------------------------------------
#if defined(CSQC) || defined(SSQC)
-enum
+typedef enum
{
CT_WORLD, // world entity
+
+ //--------------------------------------------------------------
+ // these entities may be networked to the client -- CEV
+ // current count: 35 -- CEV
+ //--------------------------------------------------------------
+
CT_PLAYER, // player (client)
- // info
- CT_INFO_FOCAL_POINT, // cutscenes
- CT_INFO_INTERMISSION, // id1, end-of-map camera position
- CT_INFO_INTERMISSIONTEXT, // pd3? intermission text ent
- CT_INFO_MONSTER_SPAWNPOINT, // pd3 monster spawnpoint
- CT_INFO_MOVIE_CAMERA, // cutscenes
- CT_INFO_NOTNULL, // id1?
- CT_INFO_NULL, // id1?
- CT_INFO_PLAYER_START, // id1 player start
- CT_INFO_PLAYER_START2, // id1 player start2
- CT_INFO_PLAYER_COOP, // id1 player coop start
- CT_INFO_PLAYER_DEATHMATCH, // id1 player deathmatch start
- CT_INFO_ROTATE, // Hipnotic info_rotate
- CT_INFO_TELEPORT_CHANGEDEST, // Qmaster teleporter changedest
- CT_INFO_TELEPORT_DESTINATION, // id1 teleporters
- CT_INFO_TELEPORT_RANDOM, // teleporters
- CT_INFO_TESTPLAYERSTART, // test player start
+ // misc. entities that are (or might be) networked to the client -- CEV
+ // classtype is sent as a byte so keep these within the first 255 -- CEV
// func
- CT_FUNC_BOB, // RennyC func_bob
CT_FUNC_BOSSGATE, // id1 func_bossgate
CT_FUNC_BREAKABLE, // AD with mod. by Qmaster, iw, and d_ds
+ CT_FUNC_BOB, // RennyC func_bob
CT_FUNC_BUTTON, // id1 / pd3 func_button
- CT_FUNC_COUNTER, // Hipnotic func_counter
CT_FUNC_DOOR, // id1 doors
CT_FUNC_DOOR_SECRET, // id1 secret door
CT_FUNC_ELVTR_BUTTON, // Rogue elevator buttons
@@ -55,54 +45,23 @@ enum
CT_FUNC_EXPLOBOX, // id1 func_explobox
CT_FUNC_FALL, // RennyC func_fall
CT_FUNC_FALL2, // RennyC & whirledtsar func_fall2
- CT_FUNC_ILLUSIONARY, // id1 func_illusionary
CT_FUNC_LASER, // Rubicon2 func_laser
- CT_FUNC_MONSTER_SPAWNER, // progs_dump monster spawner
CT_FUNC_MOVEWALL, // Hipnotic rotation
CT_FUNC_NEW_PLAT, // Rogue / PD3 new_plat
- CT_FUNC_ONCOUNT, // Hipnotic func_oncount
- CT_FUNC_PARTICLEFIELD, // Hipnotic particle field
CT_FUNC_PLAT, // id1 plats / lifts
CT_FUNC_ROTATE_DOOR, // Hipnotic rotation
CT_FUNC_ROTATE_ENTITY, // Hipnotic rotation
CT_FUNC_ROTATE_TRAIN, // Hipnotic rotation
- CT_FUNC_SHADOW, // pd3 func_shadow
CT_FUNC_TOGGLEVISIBLEWALL, // pd3(?) togglevisiblewall
CT_FUNC_TOGGLEWALL, // Hipnotic func_togglewall
CT_FUNC_TRAIN, // id1 train
CT_FUNC_WALL, // func_wall
- // corpses, gibs
- CT_GORE_HEAD, //
- CT_GORE_HEAD_ARMY, // deadstuff
- CT_GORE_HEAD_DEMON, // deadstuff
- CT_GORE_HEAD_DOG, // deadstuff
- CT_GORE_HEAD_ENFORCER, // deadstuff
- CT_GORE_HEAD_HELL_KNIGHT, // deadstuff
- CT_GORE_HEAD_KNIGHT, // deadstuff
- CT_GORE_HEAD_OGRE, // deadstuff
- CT_GORE_HEAD_PLAYER, // deadstuff
- CT_GORE_HEAD_SHALRATH, // deadstuff
- CT_GORE_HEAD_SHAMBLER, // deadstuff
- CT_GORE_HEAD_WIZARD, // deadstuff
- CT_GORE_HEAD_ZOMBIE, // deadstuff
- CT_GORE_GIB1, // id1
- CT_GORE_GIB2, // id1
- CT_GORE_GIB3, // id1
-
- // hazards
- CT_HAZARD_LTRAIL_START, // DOE lightning trail
- CT_HAZARD_LTRAIL_RELAY, // DOE lightning trail
- CT_HAZARD_LTRAIL_END, // DOE lightning trail
- CT_HAZARD_SHOOTER, // trap_shooter
- CT_HAZARD_SPIKESHOOTER, // trap_spikeshooter
- CT_HAZARD_SWITCHED_SHOOTER, // trap_switched_shooter
-
// items
CT_ITEM_AMMO_CELLS, // id1 item_cells
- CT_ITEM_AMMO_SPIKES, // id1 item_spikes (nails)
CT_ITEM_AMMO_ROCKETS, // id1 item_rockets
CT_ITEM_AMMO_SHELLS, // id1 item_shells
+ CT_ITEM_AMMO_SPIKES, // id1 item_spikes (nails)
CT_ITEM_ARMOR_GREEN, // id1 armor1 Green Armor
CT_ITEM_ARMOR_YELLOW, // id1 armor2 Yellow Armor
CT_ITEM_ARMOR_RED, // id1 armorInv Red Armor
@@ -110,7 +69,22 @@ enum
CT_ITEM_AXE, // id1 weapon axe
CT_ITEM_BACKPACK, // id1 backpacks
CT_ITEM_ENVIROSUIT, // id1 powerup environment suit
+ CT_ITEM_GIB1, // id1 standard gibs
+ CT_ITEM_GIB2, // ^^^^^
+ CT_ITEM_GIB3, // ^^^^^
CT_ITEM_GRENADE_LAUNCHER, // id1 weapon grenade launcher
+ CT_ITEM_HEAD_ARMY, // deadstuff
+ CT_ITEM_HEAD_DEMON, // deadstuff
+ CT_ITEM_HEAD_DOG, // deadstuff
+ CT_ITEM_HEAD_ENFORCER, // deadstuff
+ CT_ITEM_HEAD_HELLKNIGHT, // deadstuff
+ CT_ITEM_HEAD_KNIGHT, // deadstuff
+ CT_ITEM_HEAD_OGRE, // deadstuff
+ CT_ITEM_HEAD_PLAYER, // deadstuff
+ CT_ITEM_HEAD_SHALRATH, // deadstuff
+ CT_ITEM_HEAD_SHAMBLER, // deadstuff
+ CT_ITEM_HEAD_WIZARD, // deadstuff
+ CT_ITEM_HEAD_ZOMBIE, // deadstuff
CT_ITEM_HEALTH, // id1 health
CT_ITEM_HEALTH_VIAL, // pd3 health vial (5hp bubble)
CT_ITEM_INVISIBILITY, // id1 powerup ring of shadows
@@ -127,9 +101,105 @@ enum
CT_ITEM_SUPER_NAILGUN, // id1 weapon super nailgun (SNG)
CT_ITEM_SUPER_SHOTGUN, // id1 weapon super shotgun (SSG)
+ // misc
+ CT_MISC_BOB, // RennyC func_bob
+ CT_MISC_EXPLOBOX, // id1 misc_explobox
+ CT_MISC_EXPLOBOX2, // id1 misc_explobox2
+ CT_MISC_MODEL, // misc_model -- Joshua Skelton
+ CT_MISC_MODELTRAIN, //
+ CT_MISC_ROTATE_OBJECT, // Hipnotic rotation
+ CT_MISC_ROTATE_OBJECT_CONTINUOUSLY, // mg1 rotation
+
+ // monsters
+ CT_MONSTER_BOSS_CHTHON, // id1 chthon
+ CT_MONSTER_BOSS_CHTHON2, // pd3 killable chthon
+ CT_MONSTER_BOSS_OLDONE, // id1 shub
+ CT_MONSTER_BOSS_OLDONE2, // pd3 killable shub
+ CT_MONSTER_DEATHKNIGHT, // id1 hell knight / death knight
+ CT_MONSTER_DOG, // id1 dog / pupper
+ CT_MONSTER_ENFORCER, // id1 enforcer
+ CT_MONSTER_FIEND, // id1 demon1 / fiend / jumpy friend
+ CT_MONSTER_FISH, // id1 fishies
+ CT_MONSTER_GRUNT, // id1 army / grunt / soldier
+ CT_MONSTER_KNIGHT, // id1 knights
+ CT_MONSTER_OGRE, // id1 ogres
+ CT_MONSTER_OGRE_MARKSMAN, // id1 ogre marksman
+ CT_MONSTER_SCRAG, // id1 wizard / scrag
+ CT_MONSTER_SHAMBLER, // id1 shambler
+ CT_MONSTER_VORE, // id1 shalrath / vore
+ CT_MONSTER_ZOMBIE, // id1 zombie
+
+ // projectiles
+ CT_PROJECTILE_BOLT, // QC tribolt bolts
+ CT_PROJECTILE_BULLET, // id1 shotgun pellets
+ CT_PROJECTILE_FIREBALL, // created by misc_fireball
+ CT_PROJECTILE_FLAK, // pd3 flak projectile
+ CT_PROJECTILE_GRENADE, // id1 grenade projectile
+ CT_PROJECTILE_HKNIGHT, // id1 hell / death knight magic
+ CT_PROJECTILE_LASERBEAM, // id1 laser projectile
+ CT_PROJECTILE_LAVABALL, // id1 lava balls (chthon projectile)
+ CT_PROJECTILE_MINIGRENADE, // DOE mini grenades
+ CT_PROJECTILE_MULTIGRENADE, // DOE multi grenades (spawns the mini)
+ CT_PROJECTILE_ROCKET, // id1 rocket projectile
+ CT_PROJECTILE_SPIKE, // id1 nail/spike projectile
+ CT_PROJECTILE_VOREBALL, // id1 vore projectile
+ CT_PROJECTILE_WIZARDMISSILE, // id1 Wizard (Scrag) missile
+ CT_PROJECTILE_ZOMBIECHUNK, // id1 zombie gib projectile
+
+ // trigger
+ CT_TRIGGER_LADDER, // rubicon2 ladders
+ CT_TRIGGER_PUSH, // id1 push/wind brush
+ CT_TRIGGER_PUSH_CUSTOM, // pd3 push custom
+ CT_TRIGGER_SETGRAVITY, // Hipnotic gravity trigger
+ CT_TRIGGER_TELEPORT, // id1 teleporters
+
+ //--------------------------------------------------------------
+ // entity types past 255 aren't networked to client - for ents
+ // that aren't visible and don't effect player movement -- CEV
+ //--------------------------------------------------------------
+
+ // func
+ CT_FUNC_COUNTER = 256, // Hipnotic func_counter
+ CT_FUNC_ILLUSIONARY, // id1 func_illusionary
+ CT_FUNC_MONSTER_SPAWNER, // pd3 monster spawner
+ CT_FUNC_ONCOUNT, // Hipnotic func_oncount
+ CT_FUNC_PARTICLEFIELD, // Hipnotic particle field
+ CT_FUNC_SHADOW, // pd3 func_shadow
+
+ // hazards
+ CT_HAZARD_LTRAIL_START, // DOE lightning trail
+ CT_HAZARD_LTRAIL_RELAY, // DOE lightning trail
+ CT_HAZARD_LTRAIL_END, // DOE lightning trail
+ CT_HAZARD_SHOOTER, // trap_shooter
+ CT_HAZARD_SPIKESHOOTER, // trap_spikeshooter
+ CT_HAZARD_SWITCHED_SHOOTER, // trap_switched_shooter
+
+ // info
+ CT_INFO_FOCAL_POINT, // cutscenes
+ CT_INFO_FOG, // mg1 fog
+ CT_INFO_INTERMISSION, // id1, end-of-map camera position
+ CT_INFO_INTERMISSIONTEXT, // pd3? intermission text ent
+ CT_INFO_MONSTER_SPAWNPOINT, // pd3 monster spawnpoint
+ CT_INFO_MOVIE_CAMERA, // cutscenes
+ CT_INFO_NOTNULL, // id1?
+ CT_INFO_NULL, // id1?
+ CT_INFO_PLAYER_START, // id1 player start
+ CT_INFO_PLAYER_START2, // id1 player start2
+ CT_INFO_PLAYER_START_HUB, // mg1 hub player stat
+ CT_INFO_PLAYER_COOP, // id1 player coop start
+ CT_INFO_PLAYER_DEATHMATCH, // id1 player deathmatch start
+ CT_INFO_ROTATE, // Hipnotic info_rotate
+ CT_INFO_ROTATE_AXIS, // mg1 rotation (removed when found)
+ CT_INFO_TELEPORT_CHANGEDEST, // Qmaster teleporter changedest
+ CT_INFO_TELEPORT_DESTINATION, // id1 teleporters
+ CT_INFO_TELEPORT_RANDOM, // teleporters
+ CT_INFO_TESTPLAYERSTART, // test player start
+
// lights
CT_LIGHT, // id1 light
CT_LIGHT_CANDLE, // light_candle
+ CT_LIGHT_DYNAMIC, // mg1 dynamic light entities
+ CT_LIGHT_FLAME_GAS, // mg1 flame_gas
CT_LIGHT_FLAME_LARGE_YELLOW, // id1
CT_LIGHT_FLAME_SMALL_YELLOW, // id1
CT_LIGHT_FLAME_SMALL_WHITE, // id1
@@ -146,6 +216,7 @@ enum
CT_MISC_AMBIENT_DRONE, // drone sound
CT_MISC_AMBIENT_FBUZZ, // fluoro buzz
CT_MISC_AMBIENT_GENERAL, // Rubicon Rumble devkit ambient_general
+ CT_MISC_AMBIENT_GENERIC, // mg1 ambient_generic
CT_MISC_AMBIENT_FIRE, // ambient fire sound
CT_MISC_AMBIENT_LBUZZ, // light buzz
CT_MISC_AMBIENT_SUCKWIND, // suck wind
@@ -154,19 +225,18 @@ enum
CT_MISC_AMBIENT_THUNDER, // Zerstorer ambient thunder
CT_MISC_AMBIENT_WATER1, // ambient water 1
CT_MISC_AMBIENT_WIND2, // ambient wind 2
- CT_MISC_BOB, // RennyC func_bob
CT_MISC_EVENTLIGHTNING, // id1 event_lightning (Chthon)
- CT_MISC_EXPLOBOX, // id1 misc_explobox
- CT_MISC_EXPLOBOX2, // id1 misc_explobox2
CT_MISC_FIREBALL, // id1 misc_fireball
- CT_MISC_INFIGHT, // progs_dump 3 misc_infight
- CT_MISC_MODEL, // misc_model -- Joshua Skelton
+ CT_MISC_INFIGHT, // pd3 misc_infight
CT_MISC_MODELCANDLE, // model_candle
- CT_MISC_MODELTRAIN, //
CT_MISC_NOISEMAKER, // pd3 some kind of testing ent?
CT_MISC_PARTICLES, // Rubicon2 misc_splash
CT_MISC_PARTICLESPRAY, // custents misc_particlespray
+ CT_MISC_PARTICLE_EMBERS, // mg1 particle_embers
+ CT_MISC_PARTICLE_EMBERS_TALL, // mg1 particle_embers_tall
CT_MISC_PARTICLE_STREAM, // Zerstorer misc_particle_stream
+ CT_MISC_PARTICLE_TELE, // mg1 particle_tele
+ CT_MISC_PARTICLE_TELE_FOUNTAIN, // mg1 particle_tele_fountain
CT_MISC_PLAY_BFIELD, // pd3 play
CT_MISC_PLAY_BRLIGHT, // pd3 play
CT_MISC_PLAY_DIMLIGHT, // pd3 play
@@ -176,93 +246,55 @@ enum
CT_MISC_PLAY_MFLASH, // pd3 play muzzleflash
CT_MISC_PLAY_SOUND, // pd3 play_sound
CT_MISC_PLAY_SOUND_TRIGGERED, // pd3 play_sound
- CT_MISC_ROTATE_OBJECT, // Hipnotic rotation
+ CT_MISC_RUNE_INDICATOR, // mg1 rune indicator
CT_MISC_SHADOWCONTROLLER, // pd3 shadows
CT_MISC_SPARKS, // misc_sparks
CT_MISC_VIEWTHING, // id1?
CT_MISC_TELE_FOG, // pd3 play
CT_MISC_TELEPORTTRAIN, // id1 teleport train
- // monsters
- CT_MONSTER_BOSS_CHTHON, // id1 chthon
- CT_MONSTER_BOSS_CHTHON2, // pd3 killable chthon
- CT_MONSTER_BOSS_OLDONE, // id1 shub
- CT_MONSTER_BOSS_OLDONE2, // pd3 killable shub
- CT_MONSTER_DEATHKNIGHT, // id1 hell knight / death knight
- CT_MONSTER_DOG, // id1 dog / pupper
- CT_MONSTER_ENFORCER, // id1 enforcer
- CT_MONSTER_FIEND, // id1 demon1 / fiend / jumpy friend
- CT_MONSTER_FISH, // id1 fishies
- CT_MONSTER_GRUNT, // id1 army / grunt / soldier
- CT_MONSTER_KNIGHT, // id1 knights
- CT_MONSTER_OGRE, // id1 ogres
- CT_MONSTER_OGRE_MARKSMAN, // id1 ogre marksman
- CT_MONSTER_SCRAG, // id1 wizard / scrag
- CT_MONSTER_SHAMBLER, // id1 shambler
- CT_MONSTER_VORE, // id1 shalrath / vore
- CT_MONSTER_ZOMBIE, // id1 zombie
-
// paths
CT_PATH_CORNER, // id1 path_corner
CT_PATH_ROTATE, // Hipnotic rotation
- // projectiles
- CT_PROJECTILE_BOLT, // QC tribolt bolts
- CT_PROJECTILE_BULLET, // id1 shotgun pellets
- CT_PROJECTILE_FIREBALL, // created by misc_fireball
- CT_PROJECTILE_FLAK, // pd3 flak projectile
- CT_PROJECTILE_GRENADE, // id1 grenade projectile
- CT_PROJECTILE_HKNIGHT, // id1 hell / death knight magic
- CT_PROJECTILE_LASERBEAM, // id1 laser projectile
- CT_PROJECTILE_LAVABALL, // id1 lava balls (chthon projectile)
- CT_PROJECTILE_MINIGRENADE, // DOE mini grenades
- CT_PROJECTILE_MULTIGRENADE, // DOE multi grenades (spawns the mini)
- CT_PROJECTILE_ROCKET, // id1 rocket projectile
- CT_PROJECTILE_SPIKE, // id1 nail/spike projectile
- CT_PROJECTILE_VOREBALL, // id1 vore projectile
- CT_PROJECTILE_WIZARDMISSILE, // id1 Wizard (Scrag) missile
- CT_PROJECTILE_ZOMBIECHUNK, // id1 zombie gib projectile
-
// targets
CT_TARGET_AUTOSAVE, // target_autosave from copper
CT_TARGET_FOGBLEND, // fog
CT_TARGET_SETCOUNT, //
CT_TARGET_SETSTATE, //
- CT_TARGET_TEXTSTORY, // progs_dump textstory
- CT_TARGET_TEXTSTORY_HELPER, // textstory helper subclass
+ CT_TARGET_TEXTSTORY, // pd3 textstory
+ CT_TARGET_TEXTSTORY_HELPER, // pd3 textstory helper subclass
// triggers
CT_TRIGGER_CAMERA, // cutscenes
CT_TRIGGER_CAMERA_POINT, // cutscenes
- CT_TRIGGER_CDTRACK, // progs_dump 3 cd track trigger
+ CT_TRIGGER_CDTRACK, // pd3 cd track trigger
CT_TRIGGER_CHANGELEVEL, // id1 change level trigger
CT_TRIGGER_CHANGEMUSIC, // jleww via changemusic.rar
CT_TRIGGER_CHANGETARGET, // change an entity's target field
CT_TRIGGER_COUNTER, // id1 trigger_counter
CT_TRIGGER_CVARSET, // was in cutscene.qc; from Drake?
- CT_TRIGGER_EVERYTHING, // progs_dump 3; unknown prior source
+ CT_TRIGGER_EVERYTHING, // pd3; unknown prior source
+ CT_TRIGGER_EXPLOSION, // mg1 trigger_explosion
CT_TRIGGER_FILTER, //
CT_TRIGGER_FOG, // fog
CT_TRIGGER_FOGBLEND, // fog
+ CT_TRIGGER_FOGTRANSITION, // mg1 fog
CT_TRIGGER_HEAL, // custents trigger_heal by TGR
CT_TRIGGER_HURT, // Hipnotic trigger_hurt
- CT_TRIGGER_LADDER, // rubicon2 ladders
CT_TRIGGER_LOOK, // trigger_onlookat by NullPointPaladin
- CT_TRIGGER_MONSTERFACE, // progs_dump 3 monsterface
+ CT_TRIGGER_MONSTERFACE, // pd3 monsterface
CT_TRIGGER_MONSTERJUMP, // id1 trigger_monsterjump
CT_TRIGGER_MULTIPLE, // id1 trigger_multiple
CT_TRIGGER_ONCE, // id1 trigger_once
CT_TRIGGER_ONLYREGISTERED, // id1 registered content trigger
- CT_TRIGGER_PUSH, // id1 push/wind brush
- CT_TRIGGER_PUSH_CUSTOM, // progs_dump push custom
CT_TRIGGER_RELAY, // id1 trigger_relay
CT_TRIGGER_SECRET, // id1 secret trigger
- CT_TRIGGER_SETGRAVITY, // Hipnotic gravity trigger
CT_TRIGGER_SETSKILL, // id1 setskill trigger
+ CT_TRIGGER_SCREENSHAKE, // mg1 screen shake trigger
CT_TRIGGER_SHAKE, // ground-shake trigger
CT_TRIGGER_TAKE_WEAPON, // take_weapon
- CT_TRIGGER_TELEPORT, // id1 teleporters
- CT_TRIGGER_TEXTSTORY, // progs_dump textstory
+ CT_TRIGGER_TEXTSTORY, // pd3 textstory
CT_TRIGGER_USEKEY, // originally based on Hipnotic code
CT_TRIGGER_VOID, // necros' trigger_void, modified
@@ -270,19 +302,19 @@ enum
CT_TEMP_ANIM_CONTROLLER, // animation controller
CT_TEMP_BUBBLES, // air bubble
CT_TEMP_DELAYEDUSE, // delayed sub_usetargets
- CT_TEMP_DOOR_TRIGGER, // id1 doors
+ CT_TEMP_DOOR_TRIGGER, // id1 door trigger field
CT_TEMP_EXPLOSION, // id1 explosions (BecomeExplosion)
CT_TEMP_FALL2_HELPER, // RennyC & whirledtsar fall2
CT_TEMP_FOG_CONTROLLER, // pd3 fog
CT_TEMP_KEYDEF, // pd3 custom key definition
CT_TEMP_LASER_HELPER, // Rubicon2 func_laser
- CT_TEMP_NEWPLAT_TRIGGER, // pd3 newplats
- CT_TEMP_PLAT_TRIGGER, // id1 plats
+ CT_TEMP_NEWPLAT_TRIGGER, // pd3 newplat trigger field
+ CT_TEMP_PLAT_TRIGGER, // id1 plat trigger field
CT_TEMP_ROTATE_CONTROLLER, // rotation controller
CT_TEMP_SHAMBLER_FIELD, // id1 shambler field
CT_TEMP_SPARK, // misc_sparks
CT_TEMP_WIZARDSPELL // id1 wizard spell (spawns missiles)
-};
+} entity_types;
#endif
//----------------------------------------------------------------------
@@ -291,7 +323,7 @@ enum
// current count: 17 -- CEV
//----------------------------------------------------------------------
#if defined(CSQC) || defined(SSQC)
-enumflags
+typedef enumflags
{
CG_TEMPENTITY, // temporary entities
CG_MAPENTITY, // mapper-placeable entities
@@ -309,6 +341,12 @@ enumflags
CG_MONSTER_FLY, //
CG_MONSTER_SWIM, //
CG_PROJECTILE, // missiles & projectiles
- CG_TRIGGER // trigger_*
-};
+ CG_TRIGGER, // trigger_*
+ CG_UNUSED1, // unused classgroup flags
+ CG_UNUSED2,
+ CG_UNUSED3,
+ CG_UNUSED4,
+ CG_UNUSED5,
+ CG_FRAMETICK // inspired by the MG1 frametick system
+} entity_groups;
#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/defs_items.qc
diff --git a/qc/defs_items.qc b/qc/defs_items.qc
new file mode 100644
index 0000000..97cffeb
--- /dev/null
+++ b/qc/defs_items.qc
@@ -0,0 +1,327 @@
+//==============================================================================
+// defs_items.qc
+//==============================================================================
+
+//======================================================================
+// constants
+//======================================================================
+
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+// item_seq -- indexes into the item_info array below
+//----------------------------------------------------------------------
+typedef enum
+{
+ ITEM_SEQ_HANDS, // empty hands
+ ITEM_SEQ_AXE, // id1 weapons
+ ITEM_SEQ_SHOTGUN,
+ ITEM_SEQ_SUPERSHOTGUN,
+ ITEM_SEQ_NAILGUN,
+ ITEM_SEQ_SUPERNAILGUN,
+ ITEM_SEQ_GRENADELAUNCHER,
+ ITEM_SEQ_ROCKETLAUNCHER,
+ ITEM_SEQ_LIGHTNINGGUN,
+ ITEM_SEQ_AMMO_SHELLS_SMALL, // id1 ammo packs
+ ITEM_SEQ_AMMO_SHELLS_LARGE,
+ ITEM_SEQ_AMMO_NAILS_SMALL,
+ ITEM_SEQ_AMMO_NAILS_LARGE,
+ ITEM_SEQ_AMMO_ROCKETS_SMALL,
+ ITEM_SEQ_AMMO_ROCKETS_LARGE,
+ ITEM_SEQ_AMMO_CELLS_SMALL,
+ ITEM_SEQ_AMMO_CELLS_LARGE,
+ ITEM_SEQ_ARMOR_GREEN, // id1 armor
+ ITEM_SEQ_ARMOR_YELLOW,
+ ITEM_SEQ_ARMOR_RED,
+ ITEM_SEQ_ARMOR_SHARD, // pd3 armor shards
+ ITEM_SEQ_BACKPACK, // id1 backpack
+ ITEM_SEQ_PD3BACKPACK, // pd3 backpack
+ ITEM_SEQ_HEALTH_ROTTEN, // id1 healthpacks
+ ITEM_SEQ_HEALTH,
+ ITEM_SEQ_HEALTH_MEGA,
+ ITEM_SEQ_HEALTH_VIAL, // pd3 health vials
+ ITEM_SEQ_KEY_SILVER_MEDIEVAL, // id1 keys
+ ITEM_SEQ_KEY_SILVER_METAL,
+ ITEM_SEQ_KEY_SILVER_BASE,
+ ITEM_SEQ_KEY_GOLD_MEDIEVAL,
+ ITEM_SEQ_KEY_GOLD_METAL,
+ ITEM_SEQ_KEY_GOLD_BASE,
+ ITEM_SEQ_RUNE1, // id1 runes
+ ITEM_SEQ_RUNE2,
+ ITEM_SEQ_RUNE3,
+ ITEM_SEQ_RUNE4,
+ ITEM_SEQ_MGRUNE1, // mg1 runes
+ ITEM_SEQ_MGRUNE2,
+ ITEM_SEQ_MGRUNE3,
+ ITEM_SEQ_MGRUNE4,
+ ITEM_SEQ_MGRUNE5,
+ ITEM_SEQ_MGRUNE6,
+ ITEM_SEQ_ARTIFACT_ENVIROSUIT, // id1 artifacts / powerups
+ ITEM_SEQ_ARTIFACT_INVISIBILITY,
+ ITEM_SEQ_ARTIFACT_INVULNERABILITY,
+ ITEM_SEQ_ARTIFACT_QUAD,
+ ITEM_SEQ_GIB1, // id1 gibs
+ ITEM_SEQ_GIB2,
+ ITEM_SEQ_GIB3,
+ ITEM_SEQ_HEAD_ARMY, // id1 monster heads
+ ITEM_SEQ_HEAD_DEMON,
+ ITEM_SEQ_HEAD_DOG,
+ ITEM_SEQ_HEAD_ENFORCER,
+ ITEM_SEQ_HEAD_HELLKNIGHT,
+ ITEM_SEQ_HEAD_KNIGHT,
+ ITEM_SEQ_HEAD_OGRE,
+ ITEM_SEQ_HEAD_PLAYER,
+ ITEM_SEQ_HEAD_SHALRATH,
+ ITEM_SEQ_HEAD_SHAMBLER,
+ ITEM_SEQ_HEAD_WIZARD,
+ ITEM_SEQ_HEAD_ZOMBIE
+} item_seq;
+
+#define ITEM_SEQ_W_START ITEM_SEQ_AXE
+#define ITEM_SEQ_W_END ITEM_SEQ_LIGHTNINGGUN
+#define ITEM_SEQ_HEAD_START ITEM_SEQ_HEAD_ARMY
+#define ITEM_SEQ_HEAD_END ITEM_SEQ_HEAD_ZOMBIE
+
+//----------------------------------------------------------------------
+typedef enum
+{
+ ITEM_AMMO_NONE,
+ ITEM_AMMO_SHELLS, // id1 ammo types
+ ITEM_AMMO_NAILS,
+ ITEM_AMMO_ROCKETS,
+ ITEM_AMMO_CELLS
+} item_ammo_types;
+
+//----------------------------------------------------------------------
+// item_info -- CEV
+//----------------------------------------------------------------------
+typedef struct
+{
+ float class; // classtype
+ float option; // ammo type (if any), .skin
+ float pickup_vol; // volume of pickup sound
+ vector view_origin_offset; // viewmodel origin offset
+ vector view_angles_offset; // viewmodel angles offset
+ string name; // plaintext name (netname) of the item
+ string pickup_sound; // sound to play on pickup
+ string world_model; // model to be displayed in the world
+ string view_model; // viewmodel for the item
+} item_info_t;
+
+// entries in this array must match the order of elements in item_seq -- CEV
+item_info_t item_info[] =
+{
+ // index 0: empty hands
+ {0, 0, 0, '0 0 0', '0 0 0', "Hands", "", "", ""},
+
+ // index 1-8: id1 weapons, second field is ammo type
+ {CT_ITEM_AXE, 0, 0.3, '0 0 0', '0 0 0',
+ "Axe", "cev/items/weapon_pickup.ogg",
+ "progs/g_axe.mdl", "progs/v_axe.mdl"},
+ {CT_ITEM_SHOTGUN, ITEM_AMMO_SHELLS, 0.3, '0 0 0', '0 0 0',
+ "Shotgun", "cev/items/weapon_pickup.ogg",
+ "progs/g_shotgu.mdl", "progs/v_shot.mdl"},
+ {CT_ITEM_SUPER_SHOTGUN, ITEM_AMMO_SHELLS, 0.3, '0 0 0', '0 0 0',
+ "Double-barrelled Shotgun", "cev/items/weapon_pickup.ogg",
+ "progs/g_shot.mdl", "progs/v_shot2.mdl"},
+ {CT_ITEM_NAILGUN, ITEM_AMMO_NAILS, 0.3, '0 0 0', '0 0 0',
+ "Nailgun", "cev/items/weapon_pickup.ogg",
+ "progs/g_nail.mdl", "progs/v_nail.mdl"},
+ {CT_ITEM_SUPER_NAILGUN, ITEM_AMMO_NAILS, 0.3, '0 0 0', '0 0 0',
+ "Super Nailgun", "cev/items/weapon_pickup.ogg",
+ "progs/g_nail2.mdl", "progs/v_nail2.mdl"},
+ {CT_ITEM_GRENADE_LAUNCHER, ITEM_AMMO_ROCKETS, 0.3, '0 0 0', '0 0 0',
+ "Grenade Launcher", "cev/items/weapon_pickup.ogg",
+ "progs/g_rock.mdl", "progs/v_rock.mdl"},
+ {CT_ITEM_ROCKET_LAUNCHER, ITEM_AMMO_ROCKETS, 0.3, '0 0 0', '0 0 0',
+ "Rocket Launcher", "cev/items/weapon_pickup.ogg",
+ "progs/g_rock2.mdl", "progs/v_rock2.mdl"},
+ {CT_ITEM_LIGHTNING_GUN, ITEM_AMMO_CELLS, 0.3, '0 0 0', '0 0 0',
+ "Thunderbolt", "cev/items/weapon_pickup.ogg",
+ "progs/g_light.mdl", "progs/v_light.mdl"},
+
+ // index 9-16: id1 ammo (small then large)
+ {CT_ITEM_AMMO_SHELLS, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "shells", "cev/items/ammo_pickup.ogg",
+ "progs/a_mdls/m_shell1.mdl", "progs/a_mdls/m_shell1.mdl"},
+ {CT_ITEM_AMMO_SHELLS, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "shells", "cev/items/ammo_pickup.ogg",
+ "progs/a_mdls/m_shell2.mdl", "progs/a_mdls/m_shell2.mdl"},
+ {CT_ITEM_AMMO_SPIKES, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "nails", "cev/items/ammo_pickup.ogg",
+ "progs/a_mdls/m_nails1.mdl", "progs/a_mdls/m_nails1.mdl"},
+ {CT_ITEM_AMMO_SPIKES, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "nails", "cev/items/ammo_pickup.ogg",
+ "progs/a_mdls/m_nails2.mdl", "progs/a_mdls/m_nails2.mdl"},
+ {CT_ITEM_AMMO_ROCKETS, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "rockets", "cev/items/ammo_pickup.ogg",
+ "progs/a_mdls/m_rock1.mdl", "progs/a_mdls/m_rock1.mdl"},
+ {CT_ITEM_AMMO_ROCKETS, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "rockets", "cev/items/ammo_pickup.ogg",
+ "progs/a_mdls/m_rock2.mdl", "progs/a_mdls/m_rock2.mdl"},
+ {CT_ITEM_AMMO_CELLS, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "cells", "cev/items/ammo_pickup.ogg",
+ "progs/a_mdls/m_cells1.mdl", "progs/a_mdls/m_cells1.mdl"},
+ {CT_ITEM_AMMO_CELLS, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "cells", "cev/items/ammo_pickup.ogg",
+ "progs/a_mdls/m_cells2.mdl", "progs/a_mdls/m_cells2.mdl"},
+
+ // id1 armor (second field is .skin)
+ {CT_ITEM_ARMOR_GREEN, 0, VOL_MHI, '40 -13 -35', '0 190 0',
+ "green armor", "items/armor1.wav",
+ "progs/armor.mdl", "progs/armor.mdl"},
+ {CT_ITEM_ARMOR_YELLOW, 1, VOL_MHI, '40 -13 -35', '0 190 0',
+ "yellow armor", "items/armor1.wav",
+ "progs/armor.mdl", "progs/armor.mdl"},
+ {CT_ITEM_ARMOR_RED, 2, VOL_MHI, '40 -13 -35', '0 190 0',
+ "red armor", "items/armor1.wav",
+ "progs/armor.mdl", "progs/armor.mdl"},
+
+ // pd3 armor shard
+ {CT_ITEM_ARMOR_SHARD, 0, VOL_LOW, '40 -13 -35', '0 10 0',
+ "armor shard", "cev/items/shard_pickup.ogg",
+ "progs/armshr.mdl", "progs/armshr.mdl"},
+
+ // id1 backpacks
+ {CT_ITEM_BACKPACK, 0, VOL_HIGH, '40 -13 -35', '0 10 0',
+ "backpack", "cev/items/backpack_pickup.ogg",
+ "progs/backpack.mdl", "progs/backpack.mdl"},
+
+ // pd3 backpacks
+ {CT_ITEM_BACKPACK, 0, VOL_HIGH, '40 -13 -35', '0 10 0',
+ "backpack", "cev/items/backpack_pickup.ogg",
+ "progs/pd_bpack.mdl", "progs/pd_bpack.mdl"},
+
+ // id1 health
+ {CT_ITEM_HEALTH, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "Health (Rotten)", "items/r_item1.wav",
+ "progs/h_mdls/m_h15.mdl", "progs/h_mdls/m_h15.mdl"},
+ {CT_ITEM_HEALTH, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "Health", "items/health1.wav",
+ "progs/h_mdls/m_h25.mdl", "progs/h_mdls/m_h25.mdl"},
+ {CT_ITEM_HEALTH, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "Megahealth", "items/r_item2.wav",
+ "progs/h_mdls/m_h100.mdl", "progs/h_mdls/m_h100.mdl"},
+
+ // pd3 health
+ {CT_ITEM_HEALTH_VIAL, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "Health Vial", "items/r_item1.wav",
+ "progs/h_mdls/pd_vial.mdl", "progs/h_mdls/pd_vial.mdl"},
+
+ // id1 keys (.option is the IT_ flag)
+ {CT_ITEM_KEY1, IT_KEY1, VOL_HIGH, '0 0 0', '0 0 0',
+ "silver key", "misc/medkey.wav",
+ "progs/w_s_key.mdl", "progs/w_s_key.mdl"},
+ {CT_ITEM_KEY1, IT_KEY1, VOL_HIGH, '0 0 0', '0 0 0',
+ "silver runekey", "misc/runekey.wav",
+ "progs/m_s_key.mdl", "progs/m_s_key.mdl"},
+ {CT_ITEM_KEY1, IT_KEY1, VOL_HIGH, '0 0 0', '0 0 0',
+ "silver keycard", "misc/basekey.wav",
+ "progs/b_s_key.mdl", "progs/b_s_key.mdl"},
+ {CT_ITEM_KEY2, IT_KEY2, VOL_HIGH, '0 0 0', '0 0 0',
+ "gold key", "misc/medkey.wav",
+ "progs/w_g_key.mdl", "progs/w_g_key.mdl"},
+ {CT_ITEM_KEY2, IT_KEY2, VOL_HIGH, '0 0 0', '0 0 0',
+ "gold runekey", "misc/runekey.wav",
+ "progs/m_g_key.mdl", "progs/m_g_key.mdl"},
+ {CT_ITEM_KEY2, IT_KEY2, VOL_HIGH, '0 0 0', '0 0 0',
+ "gold keycard", "misc/basekey.wav",
+ "progs/b_g_key.mdl", "progs/b_g_key.mdl"},
+
+ // id1 runes
+ {CT_ITEM_RUNE, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "Rune of Earth Magic", "misc/runekey.wav",
+ "progs/end1.mdl", "progs/end1.mdl"},
+ {CT_ITEM_RUNE, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "Rune of Black Magic", "misc/runekey.wav",
+ "progs/end2.mdl", "progs/end2.mdl"},
+ {CT_ITEM_RUNE, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "Rune of Hell Magic", "misc/runekey.wav",
+ "progs/end3.mdl", "progs/end3.mdl"},
+ {CT_ITEM_RUNE, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "Rune of Elder Magic", "misc/runekey.wav",
+ "progs/end4.mdl", "progs/end4.mdl"},
+
+ // mg1 runes
+ {CT_ITEM_RUNE, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "Rune of Machinists", "misc/runekey.wav",
+ "progs/mg1_rune1.mdl", "progs/mg1_rune1.mdl"},
+ {CT_ITEM_RUNE, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "Rune of Blacksmiths", "misc/runekey.wav",
+ "progs/mg1_rune2.mdl", "progs/mg1_rune2.mdl"},
+ {CT_ITEM_RUNE, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "Rune of Stonemasons", "misc/runekey.wav",
+ "progs/mg1_rune3.mdl", "progs/mg1_rune3.mdl"},
+ {CT_ITEM_RUNE, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "Rune of Cultists", "misc/runekey.wav",
+ "progs/mg1_rune4.mdl", "progs/mg1_rune4.mdl"},
+ {CT_ITEM_RUNE, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "Rune of Astrologers", "misc/runekey.wav",
+ "progs/mg1_rune5.mdl", "progs/mg1_rune5.mdl"},
+ {CT_ITEM_RUNE, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "Rune of Mystics", "misc/runekey.wav",
+ "progs/mg1_rune6.mdl", "progs/mg1_rune6.mdl"},
+
+ // id1 powerups
+ {CT_ITEM_ENVIROSUIT, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "Biosuit", "items/suit.wav",
+ "progs/suit.mdl", "progs/suit.mdl"},
+ {CT_ITEM_INVISIBILITY, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "Ring of Shadows", "items/inv1.wav",
+ "progs/invisibl.mdl", "progs/invisibl.mdl"},
+ {CT_ITEM_INVULNERABILITY, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "Pentagram of Protection", "items/protect.wav",
+ "progs/invulner.mdl", "progs/invulner.mdl"},
+ {CT_ITEM_QUAD, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "Quad Damage", "items/damage.wav",
+ "progs/quaddama.mdl", "progs/quaddama.mdl"},
+
+ // id1 gibs
+ {CT_ITEM_GIB1, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "Gib", "items/damage.wav",
+ "progs/gib1.mdl", "progs/gib1.mdl"},
+ {CT_ITEM_GIB2, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "Gib", "items/damage.wav",
+ "progs/gib2.mdl", "progs/gib2.mdl"},
+ {CT_ITEM_GIB3, 0, VOL_MHI, '40 -13 -35', '0 10 0',
+ "Gib", "items/damage.wav",
+ "progs/gib3.mdl", "progs/gib3.mdl"},
+
+ // id1 monster heads
+ {CT_ITEM_HEAD_ARMY, 0, VOL_MHI, '40 0 -20', '0 170 0',
+ "Soldier Head", "items/damage.wav",
+ "progs/h_guard.mdl", "progs/h_guard.mdl"},
+ {CT_ITEM_HEAD_DEMON, 0, VOL_MHI, '40 0 -20', '0 170 0',
+ "Fiend Head", "items/damage.wav",
+ "progs/h_demon.mdl", "progs/h_demon.mdl"},
+ {CT_ITEM_HEAD_DOG, 0, VOL_MHI, '40 0 -20', '0 170 0',
+ "Dog Head", "items/damage.wav",
+ "progs/h_dog.mdl", "progs/h_dog.mdl"},
+ {CT_ITEM_HEAD_ENFORCER, 0, VOL_MHI, '40 0 -20', '0 170 0',
+ "Enforcer Head", "items/damage.wav",
+ "progs/h_mega.mdl", "progs/h_mega.mdl"},
+ {CT_ITEM_HEAD_HELLKNIGHT, 0, VOL_MHI, '40 0 -20', '0 170 0',
+ "Death Knight Head", "items/damage.wav",
+ "progs/h_hellkn.mdl", "progs/h_hellkn.mdl"},
+ {CT_ITEM_HEAD_KNIGHT, 0, VOL_MHI, '40 0 -20', '0 170 0',
+ "Knight Head", "items/damage.wav",
+ "progs/h_knight.mdl", "progs/h_knight.mdl"},
+ {CT_ITEM_HEAD_OGRE, 0, VOL_MHI, '40 0 -20', '0 170 0',
+ "Ogre Head", "items/damage.wav",
+ "progs/h_ogre.mdl", "progs/h_ogre.mdl"},
+ {CT_ITEM_HEAD_PLAYER, 0, VOL_MHI, '40 0 -20', '0 170 0',
+ "Player Head", "items/damage.wav",
+ "progs/h_player.mdl", "progs/h_player.mdl"},
+ {CT_ITEM_HEAD_SHALRATH, 0, VOL_MHI, '40 0 -20', '0 170 0',
+ "Vore Head", "items/damage.wav",
+ "progs/h_shal.mdl", "progs/h_shal.mdl"},
+ {CT_ITEM_HEAD_SHAMBLER, 0, VOL_MHI, '40 0 -20', '0 170 0',
+ "Shambler Head", "items/damage.wav",
+ "progs/h_shams.mdl", "progs/h_shams.mdl"},
+ {CT_ITEM_HEAD_WIZARD, 0, VOL_MHI, '40 0 -20', '0 170 0',
+ "Wizard Head", "items/damage.wav",
+ "progs/h_wizard.mdl", "progs/h_wizard.mdl"},
+ {CT_ITEM_HEAD_ZOMBIE, 0, VOL_MHI, '40 0 -20', '0 170 0',
+ "Zombie Head", "items/damage.wav",
+ "progs/h_zombie.mdl", "progs/h_zombie.mdl"}
+};
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/func/bob.qc
diff --git a/qc/func/bob.qc b/qc/func/bob.qc
index 16ef734..2106624 100644
--- a/qc/func/bob.qc
+++ b/qc/func/bob.qc
@@ -1,5 +1,5 @@
//==============================================================================
-// func_bob -- code attributed to RennyC
+// func_bob -- pd3 code attributed to RennyC, MG1 code by MachineGames
//==============================================================================
//======================================================================
@@ -7,9 +7,30 @@
//======================================================================
#ifdef SSQC
-const float BOB_STYLE_START_OFF = 1; // start off
-const float BOB_COLLISION = 2; // Collision for misc_bob
-const float BOB_NONSOLID = 4; // Non solid for func_bob
+//----------------------------------------------------------------------
+// func_bob spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_FUNC_BOB_MG1_NONSOLID = 1, // mg1 nonsolid
+ SPAWNFLAG_FUNC_BOB_COLLISION = 2, // pd3 collision for misc_bob
+ SPAWNFLAG_FUNC_BOB_MG1_START_ON = 2, // mg1 start on
+ SPAWNFLAG_FUNC_BOB_NONSOLID = 4 // pd3 nonsolid for func_bob
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} base_func_bob_spawnflags;
+#endif
+
+#ifdef SSQC
+const float FUNC_BOB_START_OFF = 1; // pd3 style key
+const float FUNC_BOB_THINKINTERVAL = 0.05;
#endif
//======================================================================
@@ -26,17 +47,30 @@ const float BOB_NONSOLID = 4; // Non solid for func_bob
//======================================================================
// base_func_bob
+#ifdef CSQC
+void(float isnew) base_func_bob_netreceive;
+#endif
#ifdef SSQC
+// BASE_FUNC_BOB_GETPOSITIONFORANGLE(an)
void() base_func_bob_on;
void() base_func_bob_off;
+void() base_func_bob_blocked;
+void() base_func_bob_think_mg1;
void() base_func_bob_think_timer;
+void() base_func_bob_use_mg1;
+void() base_func_bob_tick_mg1;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) base_func_bob_init;
+#ifdef SSQC
strip void() base_func_bob;
#endif
// func_bob
-#ifdef SSQC
+#if defined(CSQC) || defined(SSQC)
void(entity e) func_bob_init;
+#endif
+#ifdef SSQC
void() func_bob;
#endif
@@ -51,8 +85,36 @@ void() misc_bob;
//----------------------------------------------------------------------
// class base_func_bob: base_func
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) base_func_bob_netreceive =
+ {
+ // creates the netflag variable -- CEV
+ BASE_FUNC_NETRECEIVE (base_func_bob_init)
+
+ if (isnew)
+ base_entity_que_add (self, QUE_TYPE_ACTOR);
+ };
+#endif
+
#ifdef SSQC
//--------------------------------------------------------------
+ #define BASE_FUNC_BOB_GETPOSITIONFORANGLE(an) \
+ { \
+ self.count += (an); \
+ self.count = mod (self.count, 360); \
+ /* MG1 uses makevectors to calculate sin and cos -- CEV */ \
+ makevectors ([0, self.count, 0]); \
+ /* v_forward_y is sin */ \
+ local vector offs = self.dest * v_forward_y; \
+ if (self.dest2) \
+ { \
+ /* v_forward_x is cos */ \
+ offs += (self.dest2 * v_forward_x); \
+ } \
+ }
+
+ //--------------------------------------------------------------
void() base_func_bob_on =
{
// This may have been called by a "use" function, so don't
@@ -72,9 +134,11 @@ void() misc_bob;
self.flags = 0;
}
- if (self.spawnflags & BOB_NONSOLID)
+ if (self.spawnflags & SPAWNFLAG_FUNC_BOB_NONSOLID)
self.solid = SOLID_NOT;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_SOLID;
+
setmodel (self, self.mdl);
setsize (self, self.mins , self.maxs);
@@ -84,6 +148,9 @@ void() misc_bob;
self.nextthink = self.ltime + 0.1 + self.delay;
else
self.nextthink = time + 0.1 + self.delay;
+
+ // add to the frametick group since motion has started -- CEV
+ self.classgroup |= CG_FRAMETICK;
};
//--------------------------------------------------------------
@@ -100,15 +167,47 @@ void() misc_bob;
self.solid = SOLID_BBOX;
}
- if (self.spawnflags & BOB_NONSOLID)
+ if (self.spawnflags & SPAWNFLAG_FUNC_BOB_NONSOLID)
self.solid = SOLID_NOT;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_SOLID;
+
setmodel (self, self.mdl);
setsize (self, self.mins , self.maxs);
self.velocity = '0 0 0';
- if (self.style & BOB_STYLE_START_OFF)
+ if (self.style & FUNC_BOB_START_OFF)
self.use = base_func_bob_on;
+
+ // remove from frametick group since motion has stopped -- CEV
+ self.classgroup &= ~CG_FRAMETICK;
+ };
+
+ //--------------------------------------------------------------
+ // was func_bob_blocked in MG1 -- CEV
+ //--------------------------------------------------------------
+ void() base_func_bob_blocked =
+ {
+ if (self.attack_finished > time)
+ return;
+
+ t_damage2 (other, self, self, self.dmg);
+ self.attack_finished = time + 0.5;
+ };
+
+ //--------------------------------------------------------------
+ // was func_bob_think in MG1. 'Used by solid bobbers'. -- CEV
+ //--------------------------------------------------------------
+ void() base_func_bob_think_mg1 =
+ {
+ local float ang = self.pos1_x * FUNC_BOB_THINKINTERVAL;
+ // macros everywhere. creates the variable 'offs' -- CEV
+ BASE_FUNC_BOB_GETPOSITIONFORANGLE (ang)
+ local vector diff = offs - self.origin;
+ self.velocity = diff * (1 / FUNC_BOB_THINKINTERVAL);
+ self.nextthink = self.ltime + FUNC_BOB_THINKINTERVAL;
+
+ // self.tick will take care of SendFlags -- CEV
};
//--------------------------------------------------------------
@@ -161,52 +260,181 @@ void() misc_bob;
};
//--------------------------------------------------------------
- void(entity e) base_func_bob_init =
+ // was func_bob_tick in MG1. 'Used by non-solid bobbers'. -- CEV
+ //--------------------------------------------------------------
+ void() base_func_bob_tick_mg1 =
{
- base_func_init (e);
+ if (self.solid == SOLID_NOT)
+ {
+ local float ang = self.pos1_x * server_deltatime;
+ // macros everywhere. creates the variable 'offs' -- CEV
+ BASE_FUNC_BOB_GETPOSITIONFORANGLE (ang)
+ setorigin (self, offs);
+ }
- e.spawnflags |= BOB_COLLISION;
- if (e.spawnflags & BOB_NONSOLID)
- e.spawnflags &= ~BOB_COLLISION;
+ if (!(self.SendFlags & NETFLAG_BASE_ENTITY_ORIGIN)) {
+ if (self.origin != self.origin_net)
+ {
+ // need to send origin -- CEV
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
+ } }
+ };
- // Using a custom model?
- if (e.mdl == "")
+ //--------------------------------------------------------------
+ void() base_func_bob_use_mg1 =
+ {
+ if (self.state)
{
- e.bsporigin = TRUE;
- e.mdl = e.model;
+ if (self.solid)
+ {
+ self.velocity = '0 0 0';
+ self.nextthink = -1;
+ }
+
+ self.classgroup &= ~CG_FRAMETICK;
}
else
{
- e.bsporigin = FALSE;
- e.modelindex = 0;
- e.model = "";
+ if (self.solid)
+ base_func_bob_think_mg1 ();
+
+ self.classgroup |= CG_FRAMETICK;
}
- sub_setmovedir (e);
- e.movedir = normalize (e.movedir);
-
- if (e.height <= 0)
- // Direction intensity
- e.height = 8;
- if (e.count < 1)
- // Direction switch timer
- e.count = 2;
- if (e.waitmin <= 0)
- // Speed up
- e.waitmin = 1;
- if (e.waitmin2 <= 0)
- // Slow down
- e.waitmin2 = 0.75;
- if (e.delay < 0)
- e.delay = random() + random() + random();
-
- // added style key 1 for start off -- dumptruck_ds
- if (e.style & BOB_STYLE_START_OFF)
- sub_runvoidas (e, base_func_bob_off);
+ self.state = 1 - self.state;
+ };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+ //--------------------------------------------------------------
+ void(entity e) base_func_bob_init =
+ {
+ base_func_init (e);
+
+ #ifdef CSQC
+ e.drawmask = DRAWMASK_NORMAL;
+ e.predraw = base_func_predraw;
+
+ setmodelindex (e, e.modelindex);
+ setsize (e, e.mins, e.maxs);
+ setorigin (e, e.origin);
+
+ // TODO CEV eew
+ if (e.classtype == CT_MISC_BOB)
+ e.classname = "misc_bob";
+ else if (e.classtype == CT_FUNC_BOB)
+ e.classname = "func_bob";
+ #endif
+
+ #ifdef SSQC
+ if (known_release == KNOWN_RELEASE_MG1)
+ {
+ // MG1 func_bob -- TODO CEV
+ setmodel (e, e.model);
+ setorigin (e, e.origin);
+
+ if (!e.dest)
+ e.dest = '0 0 64';
+ if (!e.wait)
+ e.wait = 10;
+ if (!e.dmg)
+ e.dmg = 1;
+
+ // in the public MG1 sourcecode this was .avelocity;
+ // if you examine the fields of a func_bob entity with
+ // the released MG1 progs.dat loaded you'll see the
+ // field used is instead .bob_avelocity. (So there's
+ // a discrepancy between the released source and
+ // the released compiled progs.dat). Using .avelocity
+ // results in buggy func_bob movement in FTEQW; use
+ // another (not-used, not-special-to-the-engine)
+ // vector field and they'll work fine. I've chosen
+ // pos1 here. -- CEV
+ e.pos1_x = 360 / e.wait;
+ e.count = 360 * e.delay;
+
+ e.blocked = base_func_bob_blocked;
+ e.customphysics = base_entity_movetype_push;
+ e.think = base_func_bob_think_mg1;
+ e.tick = base_func_bob_tick_mg1;
+ e.use = base_func_bob_use_mg1;
+
+ if (e.spawnflags & SPAWNFLAG_FUNC_BOB_MG1_NONSOLID)
+ {
+ e.movetype = MOVETYPE_NONE;
+ e.solid = SOLID_NOT;
+ }
+ else
+ {
+ e.movetype = MOVETYPE_PUSH;
+ e.solid = SOLID_BSP;
+ }
+
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_MODEL |
+ NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_SIZE |
+ NETFLAG_BASE_ENTITY_SOLID;
+
+ if (e.spawnflags & SPAWNFLAG_FUNC_BOB_MG1_START_ON)
+ sub_runvoidas (e, base_func_bob_use_mg1);
+ }
else
- sub_runvoidas (e, base_func_bob_on);
+ {
+ e.spawnflags |= SPAWNFLAG_FUNC_BOB_COLLISION;
+ if (e.spawnflags & SPAWNFLAG_FUNC_BOB_NONSOLID)
+ e.spawnflags &= ~SPAWNFLAG_FUNC_BOB_COLLISION;
+
+ // Using a custom model?
+ if (e.mdl == "")
+ {
+ e.bsporigin = TRUE;
+ e.mdl = e.model;
+ }
+ else
+ {
+ e.bsporigin = FALSE;
+ e.modelindex = 0;
+ e.model = "";
+ }
+
+ sub_setmovedir (e);
+ e.movedir = normalize (e.movedir);
+
+ if (e.height <= 0)
+ // Direction intensity
+ e.height = 8;
+ if (e.count < 1)
+ // Direction switch timer
+ e.count = 2;
+ if (e.waitmin <= 0)
+ // Speed up
+ e.waitmin = 1;
+ if (e.waitmin2 <= 0)
+ // Slow down
+ e.waitmin2 = 0.75;
+ if (e.delay < 0)
+ e.delay = random() + random() + random();
+
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_MODEL |
+ NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_SIZE |
+ NETFLAG_BASE_ENTITY_SOLID;
+ e.customphysics = base_entity_movetype_push;
+ e.tick = base_func_neteval;
+
+ // added style key 1 for start off -- dumptruck_ds
+ if (e.style & FUNC_BOB_START_OFF)
+ sub_runvoidas (e, base_func_bob_off);
+ else
+ sub_runvoidas (e, base_func_bob_on);
+ }
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
strip void() base_func_bob =
{
@@ -239,7 +467,7 @@ A SOLID bmodel that gently moves back and forth
//----------------------------------------------------------------------
// class func_bob: base_func_bob
// {
-#ifdef SSQC
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) func_bob_init =
{
@@ -247,7 +475,9 @@ A SOLID bmodel that gently moves back and forth
e.classtype = CT_FUNC_BOB;
base_func_bob_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() func_bob =
{
@@ -260,7 +490,7 @@ A SOLID bmodel that gently moves back and forth
#endif
// };
-/*QUAKED misc_bob (0 0.5 0.8) (-8 -8 -8) (8 8 8) X BOB_COLLISION BOB_NONSOLID X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+/*QUAKED misc_bob (0 0.5 0.8) (-8 -8 -8) (8 8 8) X FUNC_BOB_COLLISION FUNC_BOB_NONSOLID X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ({"path" : mdl, "skin" : skin, "frame": frame});
}
Return to the top of this page or return to the overview of this repo.
Diff qc/func/bossgate.qc
diff --git a/qc/func/bossgate.qc b/qc/func/bossgate.qc
index a66d8ee..57b7c49 100644
--- a/qc/func/bossgate.qc
+++ b/qc/func/bossgate.qc
@@ -7,8 +7,23 @@
//======================================================================
#ifdef SSQC
-// For func_episodegate and func_bossgate appear when player has all runes
-const float BOSSGATE_REVERSE = 16;
+//----------------------------------------------------------------------
+// func_bossgate spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ // func_episodegate and func_bossgate appear when player has all runes
+ SPAWNFLAG_FUNC_BOSSGATE_REVERSE = 16
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} func_bossgate_spawnflags;
#endif
//======================================================================
@@ -16,8 +31,13 @@ const float BOSSGATE_REVERSE = 16;
//======================================================================
// func_bossgate
-#ifdef SSQC
+#ifdef CSQC
+void(float isnew) func_bossgate_netreceive;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) func_bossgate_init;
+#endif
+#ifdef SSQC
void() func_bossgate;
#endif
@@ -29,28 +49,48 @@ This bmodel appears unless players have all of the episode sigils.
//----------------------------------------------------------------------
// class func_bossgate: base_func_wall
// {
-#ifdef SSQC
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) func_bossgate_netreceive =
+ {
+ // creates the netflag variable -- CEV
+ BASE_FUNC_NETRECEIVE (func_bossgate_init)
+ };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) func_bossgate_init =
{
e.classname = "func_bossgate";
e.classtype = CT_FUNC_BOSSGATE;
- // will set use -- CEV
+ #if defined(CSQC)
+ base_func_init (e);
+ #elif defined(SSQC)
base_func_wall_init (e);
+ #endif
- if (e.spawnflags & BOSSGATE_REVERSE)
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ setsize (e, e.mins, e.maxs);
+ setorigin (e, e.origin);
+ e.drawmask = DRAWMASK_NORMAL;
+ #endif
+
+ #ifdef SSQC
+ if (e.spawnflags & SPAWNFLAG_FUNC_BOSSGATE_REVERSE)
{
- if (!((serverflags & 15) == 15))
+ if (!((serverflags & SIGIL_AL) == SIGIL_AL))
{
- // not all complete
+ // not all ID1 episodes complete
return;
}
}
else
{
- if ((serverflags & 15) == 15)
- // all episodes completed
+ if ((serverflags & SIGIL_AL) == SIGIL_AL)
+ // all ID1 episodes completed
return;
}
@@ -59,8 +99,15 @@ This bmodel appears unless players have all of the episode sigils.
e.movetype = MOVETYPE_PUSH;
e.solid = SOLID_BSP;
setmodel (e, e.model);
+
+ // network func_wall to the CSQC client -- CEV
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() func_bossgate =
{
Return to the top of this page or return to the overview of this repo.
Diff qc/func/breakable.qc
diff --git a/qc/func/breakable.qc b/qc/func/breakable.qc
index 07a98d1..73c081b 100644
--- a/qc/func/breakable.qc
+++ b/qc/func/breakable.qc
@@ -7,11 +7,24 @@
//======================================================================
#ifdef SSQC
-const float BREAKABLE_NO_MONSTERS = 1;
-const float BREAK_EXPLODE = 2;
-const float BREAK_CUSTOM = 4;
-
-const float BREAKABLE_NO_MONSTERS = 1;
+//----------------------------------------------------------------------
+// base_breakable spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_BASE_BREAKABLE_NO_MONSTERS = 1, // used in base_entities.qc
+ SPAWNFLAG_BASE_BREAKABLE_EXPLODE = 2, // explosion effect and sound
+ SPAWNFLAG_BASE_BREAKABLE_CUSTOM = 4 // models specified in fields
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} base_breakable_spawnflags;
#endif
//======================================================================
@@ -50,7 +63,7 @@ void(vector dir) base_breakable_destroy;
void() base_breakable_use;
void(entity e) base_breakable_template_setup;
void(entity e) base_breakable_init;
-void() base_breakable;
+strip void() base_breakable;
#endif
// func_breakable
@@ -270,9 +283,9 @@ void() func_breakable;
// after this entity is removed -- iw
sub_dislodge_resting_entities ();
- if (self.spawnflags & BREAK_EXPLODE)
+ if (self.spawnflags & SPAWNFLAG_BASE_BREAKABLE_EXPLODE)
{
- if (self.spawnflags & BREAK_CUSTOM)
+ if (self.spawnflags & SPAWNFLAG_BASE_BREAKABLE_CUSTOM)
base_breakable_make_templates_debris (dir);
else
base_breakable_make_debris (dir);
@@ -289,7 +302,7 @@ void() func_breakable;
// sound for now -- dumptruck_ds
// sound (self, CHAN_VOICE, self.noise2,
// VOL_HIGH, ATTN_NORM);
- remove (self);
+ base_entity_remove (self);
}
else
{
@@ -297,13 +310,13 @@ void() func_breakable;
setorigin (self, self.origin);
if (self.drop_item)
base_item_drop_stuff (self);
- if (self.spawnflags & BREAK_CUSTOM)
+ if (self.spawnflags & SPAWNFLAG_BASE_BREAKABLE_CUSTOM)
{
if (self.switchshadstyle)
lightstyle (self.switchshadstyle, "m");
base_breakable_make_templates_debris (dir);
if (self)
- remove (self);
+ base_entity_remove (self);
}
else
{
@@ -311,7 +324,7 @@ void() func_breakable;
lightstyle (self.switchshadstyle, "m");
base_breakable_make_debris (dir);
if (self)
- remove (self);
+ base_entity_remove (self);
}
}
};
Return to the top of this page or return to the overview of this repo.
Diff qc/func/brush.qc
diff --git a/qc/func/brush.qc b/qc/func/brush.qc
deleted file mode 100644
index cd912d4..0000000
--- a/qc/func/brush.qc
+++ /dev/null
@@ -1,104 +0,0 @@
-//==============================================================================
-// func_brush
-//==============================================================================
-
-//----------------------------------------------------------------------
-// crashes in QS at the moment Jaycie is looking into it
-//----------------------------------------------------------------------
-
-//======================================================================
-// constants
-//======================================================================
-
-#if 0
-const float BRUSH_START_INVISIBLE = 1;
-const float BRUSH_START_NONSOLID = 2;
-const float BRUSH_START_ALTFRAMES = 4;
-const float BRUSH_TOGGLE_VISIBILITY = 8;
-const float BRUSH_TOGGLE_SOLIDITY = 16;
-const float BRUSH_TOGGLE_FRAMES = 32;
-#endif
-
-//======================================================================
-// fields
-//======================================================================
-
-#if 0
-.float solidstate;
-.float visiblestate;
-#endif
-
-//------------------------------------------------------------------------------
-
-#if 0
-//----------------------------------------------------------------------
-void() func_brush_use =
-{
- if (self.spawnflags & BRUSH_TOGGLE_VISIBILITY)
- {
- if (self.visiblestate == 1)
- {
- self.model = "";
- self.visiblestate = 0;
- }
- else
- {
- self.model = self.mdl;
- self.visiblestate = 1;
- }
- }
- if (self.spawnflags & BRUSH_TOGGLE_SOLIDITY)
- {
- if (self.solidstate == 1)
- {
- self.solid = SOLID_NOT;
- self.solidstate = 0;
- }
- else
- {
- self.solid = SOLID_BSP;
- setorigin(self, self.origin);
- self.solidstate = 1;
- }
- }
- if (self.spawnflags & BRUSH_TOGGLE_FRAMES)
- self.frame = 1 - self.frame;
-};
-
-//----------------------------------------------------------------------
-void() func_brush =
-{
- self.angles = '0 0 0';
- self.movetype = MOVETYPE_NONE;
- self.use = func_brush_use;
- setmodel (self, self.model);
- self.mdl = self.model;
- setorigin (self, self.origin);
-
- if (self.spawnflags & BRUSH_START_INVISIBLE)
- {
- self.visiblestate = 0;
- self.model = "";
- }
- else
- {
- self.visiblestate = 1;
- }
-
- if (self.spawnflags & BRUSH_START_NONSOLID)
- {
- self.solidstate = 0;
- self.solid = SOLID_NOT;
- }
- else
- {
- self.solidstate = 1;
- self.solid = SOLID_BSP;
- }
-
- if (self.spawnflags & BRUSH_START_ALTFRAMES)
- self.frame = 1;
- else
- self.frame = 0;
-};
-#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/func/button.qc
diff --git a/qc/func/button.qc b/qc/func/button.qc
index 501a323..e5934f8 100644
--- a/qc/func/button.qc
+++ b/qc/func/button.qc
@@ -3,10 +3,36 @@
//==============================================================================
//======================================================================
+// constants
+//======================================================================
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// func_button spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_FUNC_BUTTON_KEY_ALWAYS_REQUIRED = 32 // MG1 compat -- CEV
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} func_button_spawnflags;
+#endif
+
+//======================================================================
// forward declarations
//======================================================================
// func_button
+#ifdef CSQC
+void(float isnew) func_button_netreceive;
+#endif
#ifdef SSQC
void() func_button_think_wait;
void() func_button_think_done;
@@ -18,7 +44,11 @@ void() func_button_use;
void() func_button_touch;
void(entity b) func_button_lock;
void(entity b, float dontresetstate) func_button_unlock;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) func_button_init;
+#endif
+#ifdef SSQC
void() func_button;
#endif
@@ -42,16 +72,32 @@ When a button is touched, it moves some distance in the direction of it's angle,
//----------------------------------------------------------------------
// class func_button: base_func
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) func_button_netreceive =
+ {
+ // creates the netflag variable -- CEV
+ BASE_FUNC_NETRECEIVE (func_button_init)
+
+ if (isnew)
+ base_entity_que_add (self, QUE_TYPE_ACTOR);
+ };
+#endif
+
#ifdef SSQC
//--------------------------------------------------------------
void() func_button_think_wait =
{
self.state = FUNC_STATE_TOP;
+
self.think = func_button_think_return;
self.nextthink = self.ltime + self.wait;
activator = self.enemy;
+
// use alternate textures
self.frame = 1;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME |
+ NETFLAG_BASE_ENTITY_ORIGIN;
if (self.estate != STATE_ACTIVE)
return;
@@ -62,6 +108,7 @@ When a button is touched, it moves some distance in the direction of it's angle,
//--------------------------------------------------------------
void() func_button_think_done =
{
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
self.state = FUNC_STATE_BOTTOM;
};
@@ -72,10 +119,12 @@ When a button is touched, it moves some distance in the direction of it's angle,
return;
self.state = FUNC_STATE_DOWN;
- sub_calcmove (self, self.pos1, self.speed,
+ base_func_calcmove (self, self.pos1, self.speed,
func_button_think_done);
+
// use normal textures
self.frame = 0;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
if (self.health)
// can be shot again
@@ -97,10 +146,22 @@ When a button is touched, it moves some distance in the direction of it's angle,
if (self.state == FUNC_STATE_UP || self.state == FUNC_STATE_TOP)
return;
+ // MG1 compat -- CEV
+ if (known_release == KNOWN_RELEASE_MG1) {
+ if (self.items)
+ {
+ sound (self, CHAN_ITEM, self.noise4, 1, ATTN_NORM);
+ if (!(self.spawnflags &
+ SPAWNFLAG_FUNC_BUTTON_KEY_ALWAYS_REQUIRED))
+ {
+ self.items = 0;
+ }
+ } }
+
sound (self, CHAN_VOICE, self.noise, VOL_MID, ATTN_NORM);
self.state = FUNC_STATE_UP;
- sub_calcmove (self, self.pos2, self.speed,
+ base_func_calcmove (self, self.pos2, self.speed,
func_button_think_wait);
};
@@ -155,7 +216,7 @@ When a button is touched, it moves some distance in the direction of it's angle,
b.takedamage = DAMAGE_NO;
b.state = FUNC_STATE_UP;
- sub_calcmove (b, b.pos2, b.speed, func_button_think_wait);
+ base_func_calcmove (b, b.pos2, b.speed, func_button_think_wait);
b.estate = STATE_INACTIVE;
};
@@ -177,23 +238,32 @@ When a button is touched, it moves some distance in the direction of it's angle,
// use normal textures
b.frame = 0;
b.state = FUNC_STATE_DOWN;
- sub_calcmove (b, b.pos1, b.speed,
+ base_func_calcmove (b, b.pos1, b.speed,
func_button_think_done);
}
b.estate = STATE_ACTIVE;
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) func_button_init =
{
e.classname = "func_button";
e.classtype = CT_FUNC_BUTTON;
- e.blocked = func_button_blocked;
- e.use = func_button_use;
base_func_init (e);
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ setsize (e, e.mins, e.maxs);
+ setorigin (e, e.origin);
+ e.drawmask = DRAWMASK_NORMAL;
+ e.predraw = base_func_predraw;
+ #endif
+
+ #ifdef SSQC
if (e.sounds == 0)
{
precache_sound ("buttons/airbut1.wav");
@@ -218,10 +288,10 @@ When a button is touched, it moves some distance in the direction of it's angle,
e.noise = "buttons/switch04.wav";
}
- sub_setmovedir (e);
-
e.movetype = MOVETYPE_PUSH;
e.solid = SOLID_BSP;
+ e.blocked = func_button_blocked;
+ e.use = func_button_use;
setmodel (e, e.model);
if (e.health)
@@ -244,11 +314,30 @@ When a button is touched, it moves some distance in the direction of it's angle,
e.state = FUNC_STATE_BOTTOM;
- e.pos1 = e.origin;
- e.pos2 = e.pos1 + e.movedir *
- (fabs(e.movedir * e.size) - e.lip);
+ // MG1 compat -- CEV
+ if (e.movedir)
+ {
+ e.pos1 = e.origin;
+ e.pos2 = e.pos1 + e.movedir;
+ e.angles = '0 0 0';
+ }
+ else
+ {
+ sub_setmovedir (e);
+ e.pos1 = e.origin;
+ e.pos2 = e.pos1 + e.movedir *
+ (fabs(e.movedir * e.size) - e.lip);
+ }
+
+ // network to CSQC -- CEV
+ e.tick = base_func_neteval;
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() func_button =
{
Return to the top of this page or return to the overview of this repo.
Diff qc/func/counter.qc
diff --git a/qc/func/counter.qc b/qc/func/counter.qc
index e82a780..1829af4 100644
--- a/qc/func/counter.qc
+++ b/qc/func/counter.qc
@@ -13,13 +13,28 @@
//======================================================================
#ifdef SSQC
-const float COUNTER_TOGGLE = 1;
-const float COUNTER_LOOP = 2;
-const float COUNTER_STEP = 4;
-const float COUNTER_RESET = 8;
-const float COUNTER_RANDOM = 16;
-const float COUNTER_FINISHCOUNT = 32;
-const float COUNTER_START_ON = 64;
+//----------------------------------------------------------------------
+// func_counter spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_FUNC_COUNTER_TOGGLE = 1,
+ SPAWNFLAG_FUNC_COUNTER_LOOP = 2,
+ SPAWNFLAG_FUNC_COUNTER_STEP = 4,
+ SPAWNFLAG_FUNC_COUNTER_RESET = 8,
+ SPAWNFLAG_FUNC_COUNTER_RANDOM = 16,
+ SPAWNFLAG_FUNC_COUNTER_FINISHCOUNT = 32,
+ SPAWNFLAG_FUNC_COUNTER_START_ON = 64
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} func_counter_spawnflags;
#endif
//======================================================================
@@ -89,7 +104,7 @@ it specifies how high to count before reseting to zero. Default is 10.
{
// was counter_think -- CEV
self.cnt = self.cnt + 1;
- if (self.spawnflags & COUNTER_RANDOM)
+ if (self.spawnflags & SPAWNFLAG_FUNC_COUNTER_RANDOM)
{
self.state = random () * self.count;
self.state = floor (self.state) + 1;
@@ -105,7 +120,7 @@ it specifies how high to count before reseting to zero. Default is 10.
sub_usetargets ();
self.nextthink = time + self.wait;
- if (self.spawnflags & COUNTER_STEP)
+ if (self.spawnflags & SPAWNFLAG_FUNC_COUNTER_STEP)
{
func_counter_use_on ();
}
@@ -113,22 +128,31 @@ it specifies how high to count before reseting to zero. Default is 10.
if (self.cnt >= self.count)
{
self.cnt = 0;
- if ((self.aflag) || !(self.spawnflags & COUNTER_LOOP))
- if (self.spawnflags & COUNTER_TOGGLE)
+ if (!(self.spawnflags & SPAWNFLAG_FUNC_COUNTER_LOOP) ||
+ (self.aflag))
+ {
+ if (self.spawnflags &
+ SPAWNFLAG_FUNC_COUNTER_TOGGLE)
+ {
func_counter_use_on ();
+ }
else
- remove (self);
+ {
+ base_entity_remove (self);
+ }
+ }
}
};
//--------------------------------------------------------------
void() func_counter_use_on =
{
- if ((self.cnt != 0) && (self.spawnflags & COUNTER_FINISHCOUNT))
+ if (self.cnt != 0) {
+ if (self.spawnflags & SPAWNFLAG_FUNC_COUNTER_FINISHCOUNT)
{
self.aflag = TRUE;
return;
- }
+ } }
self.use = func_counter_use_off;
self.think = sub_null;
@@ -140,12 +164,12 @@ it specifies how high to count before reseting to zero. Default is 10.
{
self.aflag = FALSE;
// make sure to toggle -- CEV
- if (self.spawnflags & COUNTER_TOGGLE)
+ if (self.spawnflags & SPAWNFLAG_FUNC_COUNTER_TOGGLE)
self.use = func_counter_use_on;
else
self.use = sub_null;
- if (self.spawnflags & COUNTER_RESET)
+ if (self.spawnflags & SPAWNFLAG_FUNC_COUNTER_RESET)
{
self.cnt = 0;
self.state = 0;
@@ -197,7 +221,7 @@ it specifies how high to count before reseting to zero. Default is 10.
e.use = func_counter_use_off;
- if (e.spawnflags & COUNTER_START_ON)
+ if (e.spawnflags & SPAWNFLAG_FUNC_COUNTER_START_ON)
{
e.think = func_counter_think_starton;
e.nextthink = time + 0.1;
@@ -206,6 +230,9 @@ it specifies how high to count before reseting to zero. Default is 10.
{
e.think = sub_null;
}
+
+ // don't transmit this entity to the client -- CEV
+ // e.SendEntity = base_entity_netsend_null;
};
//--------------------------------------------------------------
@@ -258,6 +285,9 @@ reaches the value set by count, func_oncount triggers its targets.
e.think = sub_null;
e.use = func_oncount_use;
+
+ // don't transmit this entity to the client -- CEV
+ // e.SendEntity = base_entity_netsend_null;
};
//--------------------------------------------------------------
Return to the top of this page or return to the overview of this repo.
Diff qc/func/door.qc
diff --git a/qc/func/door.qc b/qc/func/door.qc
index 00b21e8..495cfcb 100644
--- a/qc/func/door.qc
+++ b/qc/func/door.qc
@@ -17,12 +17,27 @@
//======================================================================
#ifdef SSQC
-const float DOOR_START_OPEN = 1; // spawnflags
-const float DOOR_DONT_LINK = 4;
-const float DOOR_GOLD_KEY = 8;
-const float DOOR_SILVER_KEY = 16;
-const float DOOR_TOGGLE = 32;
-const float DOOR_DOOM_STYLE_UNLOCK = 64;
+//----------------------------------------------------------------------
+// func_door spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_FUNC_DOOR_START_OPEN = 1,
+ SPAWNFLAG_FUNC_DOOR_DONT_LINK = 4,
+ SPAWNFLAG_FUNC_DOOR_GOLD_KEY = 8,
+ SPAWNFLAG_FUNC_DOOR_SILVER_KEY = 16,
+ SPAWNFLAG_FUNC_DOOR_TOGGLE = 32,
+ SPAWNFLAG_FUNC_DOOR_DOOM_STYLE_UNLOCK = 64
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} func_door_spawnflags;
#endif
//======================================================================
@@ -30,7 +45,7 @@ const float DOOR_DOOM_STYLE_UNLOCK = 64;
//======================================================================
#ifdef SSQC
-.float last_setstate_frame = light_lev;
+.float last_setstate_frame;
.entity last_setstate = aiment;
#endif
@@ -84,11 +99,6 @@ void() func_door;
//--------------------------------------------------------------
void() temp_door_trigger_touch =
{
- // don't trigger on non-explosive projectiles -- CEV
- if (other.classgroup & CG_PROJECTILE)
- if (!(other.aflag & PROJECTILE_EXPLOSIVE))
- return;
-
if (other.health <= 0)
return;
@@ -176,39 +186,11 @@ Key doors are always wait -1.
//--------------------------------------------------------------
void(float isnew) func_door_netreceive =
{
- local float netflags = ReadFloat ();
- base_func_netreceive_read (isnew, netflags);
+ // creates the netflag variable -- CEV
+ BASE_FUNC_NETRECEIVE (func_door_init)
if (isnew)
- func_door_init (self);
-
- if (netflags & BASE_FUNC_NET_VELOCITY)
- {
- if (self.velocity != self.velocity_net)
- {
- if (self.velocity)
- {
- self.origin_start = self.origin;
- self.movetime = time;
- }
- else
- {
- self.movetime = 0;
- }
- }
- }
-
- self.origin_net = self.origin;
- self.velocity_net = self.velocity;
-
- if (netflags & BASE_FUNC_NET_MODEL)
- setmodelindex (self, self.modelindex);
-
- if (netflags & BASE_FUNC_NET_SIZE)
- setsize (self, self.mins, self.maxs);
-
- if (netflags & BASE_FUNC_NET_ORIGIN)
- setorigin (self, self.origin);
+ base_entity_que_add (self, QUE_TYPE_ACTOR);
};
#endif
@@ -253,9 +235,11 @@ Key doors are always wait -1.
return;
}
- if (other.classgroup & CG_CORPSE &&
+ if (other.solid == SOLID_CORPSE &&
+ other.classgroup & CG_MONSTER &&
other.takedamage >= DAMAGE_YES)
{
+ dprint ("func_door_blocked: hit corpse!\n");
t_damage2 (other, self, self, self.dmg * 10);
}
else
@@ -281,15 +265,14 @@ Key doors are always wait -1.
sound (self, CHAN_VOICE, self.noise1, VOL_MHI, ATTN_NORM);
self.state = FUNC_STATE_TOP;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
+
// automatically return if DOOR_TOGGLE spawnflag not set
- if (!(self.spawnflags & DOOR_TOGGLE))
+ if (!(self.spawnflags & SPAWNFLAG_FUNC_DOOR_TOGGLE))
{
self.think = func_door_think_go_down;
self.nextthink = self.ltime + self.wait;
}
-
- self.SendFlags |= BASE_FUNC_NET_SPEED |
- BASE_FUNC_NET_ORIGIN | BASE_FUNC_NET_VELOCITY;
};
//--------------------------------------------------------------
@@ -297,8 +280,8 @@ Key doors are always wait -1.
{
sound (self, CHAN_VOICE, self.noise1, VOL_MHI, ATTN_NORM);
self.state = FUNC_STATE_BOTTOM;
- self.SendFlags |= BASE_FUNC_NET_SPEED |
- BASE_FUNC_NET_ORIGIN | BASE_FUNC_NET_VELOCITY;
+
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
};
//--------------------------------------------------------------
@@ -312,15 +295,21 @@ Key doors are always wait -1.
}
self.state = FUNC_STATE_DOWN;
- sub_calcmove (self, self.pos1, self.speed,
- func_door_hit_bottom);
- self.SendFlags |= BASE_FUNC_NET_SPEED |
- BASE_FUNC_NET_ORIGIN | BASE_FUNC_NET_VELOCITY;
+ // speed2 check from MG1 -- CEV
+ if (self.speed2)
+ base_func_calcmove (self, self.pos1, self.speed2,
+ func_door_hit_bottom);
+ else
+ base_func_calcmove (self, self.pos1, self.speed,
+ func_door_hit_bottom);
+
+ // flag to send ORIGIN now -- CEV
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
if (self.switchshadstyle && self.shadowcontroller)
{
- if (self.spawnflags & DOOR_START_OPEN)
+ if (self.spawnflags & SPAWNFLAG_FUNC_DOOR_START_OPEN)
{
sub_runvoidas (self.shadowcontroller,
misc_shadowcontroller_fade_out);
@@ -351,16 +340,19 @@ Key doors are always wait -1.
sound (self, CHAN_VOICE, self.noise2, VOL_MHI, ATTN_NORM);
self.state = FUNC_STATE_UP;
- sub_calcmove (self, self.pos2, self.speed, func_door_hit_top);
- self.SendFlags |= BASE_FUNC_NET_SPEED |
- BASE_FUNC_NET_ORIGIN | BASE_FUNC_NET_VELOCITY;
+ // start the movement -- CEV
+ base_func_calcmove (self, self.pos2, self.speed,
+ func_door_hit_top);
+
+ // go ahead and flag to send ORIGIN now -- CEV
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
sub_usetargets ();
if (self.switchshadstyle && self.shadowcontroller)
{
- if (self.spawnflags & DOOR_START_OPEN)
+ if (self.spawnflags & SPAWNFLAG_FUNC_DOOR_START_OPEN)
{
sub_runvoidas (self.shadowcontroller,
misc_shadowcontroller_fade_in);
@@ -425,7 +417,7 @@ Key doors are always wait -1.
// no more message
self.message = "";
- if (self.spawnflags & DOOR_TOGGLE)
+ if (self.spawnflags & SPAWNFLAG_FUNC_DOOR_TOGGLE)
{
if (self.state == FUNC_STATE_UP ||
self.state == FUNC_STATE_TOP)
@@ -480,7 +472,7 @@ Key doors are always wait -1.
//--------------------------------------------------------------
void() func_door_unlock =
{
- if (!(self.spawnflags & DOOR_DOOM_STYLE_UNLOCK))
+ if (!(self.spawnflags & SPAWNFLAG_FUNC_DOOR_DOOM_STYLE_UNLOCK))
{
// door has been unlocked, don't allow player to
// touch / activate it again
@@ -557,9 +549,8 @@ Key doors are always wait -1.
// don't close wait -1 nor toggleable doors...
// ...unless the trigger_setstate has a "Close all
// doors" spawnflag on
- if (!(self.wait == -1 ||
- (self.spawnflags & DOOR_TOGGLE)) ||
- closealldoors)
+ if (!(self.wait == -1 || closealldoors ||
+ (self.spawnflags & SPAWNFLAG_FUNC_DOOR_TOGGLE)))
{
func_door_group_go_down ();
}
@@ -602,9 +593,8 @@ Key doors are always wait -1.
if (self.prevstate == FUNC_STATE_UP ||
self.prevstate == FUNC_STATE_TOP)
{
- if ((self.wait == -1 ||
- (self.spawnflags & DOOR_TOGGLE)) &&
- openalldoors)
+ if ((self.wait == -1 || (openalldoors &&
+ self.spawnflags & SPAWNFLAG_FUNC_DOOR_TOGGLE)))
{
func_door_group_go_up ();
}
@@ -643,7 +633,7 @@ Key doors are always wait -1.
// already linked by another door
return;
- if (self.spawnflags & DOOR_DONT_LINK)
+ if (self.spawnflags & SPAWNFLAG_FUNC_DOOR_DONT_LINK)
{
// don't want to link this door
self.owner = self.enemy = self;
@@ -771,8 +761,6 @@ Key doors are always wait -1.
precache_sound (e.noise1);
precache_sound (e.noise2);
- sub_setmovedir (e);
-
e.max_health = e.health;
#endif
@@ -790,7 +778,7 @@ Key doors are always wait -1.
e.blocked = func_door_blocked;
e.use = func_door_use;
- if (e.spawnflags & DOOR_SILVER_KEY)
+ if (e.spawnflags & SPAWNFLAG_FUNC_DOOR_SILVER_KEY)
{
keylock_set_silver_key (e);
@@ -801,7 +789,7 @@ Key doors are always wait -1.
}
}
- if (e.spawnflags & DOOR_GOLD_KEY)
+ if (e.spawnflags & SPAWNFLAG_FUNC_DOOR_GOLD_KEY)
{
keylock_set_gold_key (e);
@@ -821,21 +809,49 @@ Key doors are always wait -1.
}
if (!e.speed)
- e.speed = 100;
+ {
+ if (known_release == KNOWN_RELEASE_QUAKE3)
+ e.speed = 400;
+ else if (known_release == KNOWN_RELEASE_CPMA)
+ e.speed = 400;
+ else
+ e.speed = 100;
+ }
+
if (!e.wait)
- e.wait = 3;
+ {
+ if (known_release == KNOWN_RELEASE_QUAKE3)
+ e.wait = 2;
+ else if (known_release == KNOWN_RELEASE_CPMA)
+ e.wait = 2;
+ else
+ e.wait = 3;
+ }
+
if (!e.lip)
e.lip = 8;
+
if (!e.dmg)
e.dmg = 2;
- e.pos1 = e.origin;
- e.pos2 = e.pos1 + e.movedir *
- (fabs(e.movedir * e.size) - e.lip);
+ // from MG1 doors.qc -- CEV
+ if (e.movedir)
+ {
+ e.pos1 = e.origin;
+ e.pos2 = e.pos1 + e.movedir;
+ e.angles = '0 0 0';
+ }
+ else
+ {
+ sub_setmovedir (e);
+ e.pos1 = e.origin;
+ e.pos2 = e.pos1 + e.movedir *
+ (fabs(e.movedir * e.size) - e.lip);
+ }
// DOOR_START_OPEN is to allow an entity to be lighted in
// the closed position but spawn in the open position
- if (e.spawnflags & DOOR_START_OPEN)
+ if (e.spawnflags & SPAWNFLAG_FUNC_DOOR_START_OPEN)
{
setorigin (e, e.pos2);
e.pos2 = e.pos1;
@@ -850,12 +866,13 @@ Key doors are always wait -1.
e.destroy = func_door_destroy;
}
- if (e.spawnflags & DOOR_DOOM_STYLE_UNLOCK)
+ if (e.spawnflags & SPAWNFLAG_FUNC_DOOR_DOOM_STYLE_UNLOCK)
e.cnt = 1;
if (keylock_has_key_set(e))
{
- if (!(e.spawnflags & DOOR_DOOM_STYLE_UNLOCK))
+ if (!(e.spawnflags &
+ SPAWNFLAG_FUNC_DOOR_DOOM_STYLE_UNLOCK))
{
e.wait = -1;
}
@@ -876,18 +893,19 @@ Key doors are always wait -1.
e.shadowcontroller = spawn_misc_shadowcontroller (
e, e.switchshadstyle,
vlen (e.pos2 - e.pos1) / e.speed,
- e.spawnflags & DOOR_START_OPEN ? 1 : 0);
+ e.spawnflags &
+ SPAWNFLAG_FUNC_DOOR_START_OPEN ? 1 : 0);
}
// network func_door to the CSQC client -- CEV
- // e.SendEntity = base_func_netsend;
- e.SendFlags = BASE_FUNC_NET_ORIGIN | BASE_FUNC_NET_SIZE |
- BASE_FUNC_NET_MODEL | BASE_FUNC_NET_SPEED;
+ e.tick = base_func_neteval;
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
#endif
#ifdef CSQC
e.drawmask = DRAWMASK_NORMAL;
- e.predraw = base_func_predraw_solidpush;
+ e.predraw = base_func_predraw;
#endif
};
#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/func/door_secret.qc
diff --git a/qc/func/door_secret.qc b/qc/func/door_secret.qc
index eb5bb02..df4d5bb 100644
--- a/qc/func/door_secret.qc
+++ b/qc/func/door_secret.qc
@@ -7,11 +7,42 @@
//======================================================================
#ifdef SSQC
-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
+//----------------------------------------------------------------------
+// func_door_secret spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_FUNC_DOOR_SECRET_OPEN_ONCE = 1, // stays open
+ SPAWNFLAG_FUNC_DOOR_SECRET_1ST_LEFT = 2, // 1st move is left of arrow
+ SPAWNFLAG_FUNC_DOOR_SECRET_1ST_DOWN = 4, // 1st move is down from arrow
+ SPAWNFLAG_FUNC_DOOR_SECRET_NO_SHOOT = 8, // only opened by trigger
+ SPAWNFLAG_FUNC_DOOR_SECRET_YES_SHOOT = 16 // shootable even if targeted
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} func_door_secret_spawnflags;
+#endif
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// func_door_secret movement states -- CEV
+//----------------------------------------------------------------------
+typedef enum
+{
+ fd_secret_move1 = 1, // these correspond to the think
+ fd_secret_move2, // functions in id1 -- CEV
+ fd_secret_move3,
+ fd_secret_move4,
+ fd_secret_move5,
+ fd_secret_move6,
+ fd_secret_done
+} func_door_secret_states;
#endif
//======================================================================
@@ -19,6 +50,9 @@ const float SECRET_YES_SHOOT = 16; // shootable even if targeted
//======================================================================
// func_door_secret
+#ifdef CSQC
+void(float isnew) func_door_secret_netreceive;
+#endif
#ifdef SSQC
void() func_door_secret_blocked;
void(entity attacker, float damage) func_door_secret_pain;
@@ -26,7 +60,11 @@ void(vector dir) func_door_secret_destroy;
void() func_door_secret_think;
void() func_door_secret_touch;
void() func_door_secret_use;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) func_door_secret_init;
+#endif
+#ifdef SSQC
void() func_door_secret;
#endif
@@ -52,6 +90,18 @@ If a secret door has a targetname, it will only be opened by it's botton or trig
//----------------------------------------------------------------------
// class func_door_secret: base_func
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) func_door_secret_netreceive =
+ {
+ // creates the netflag variable -- CEV
+ BASE_FUNC_NETRECEIVE (func_door_secret_init)
+
+ if (isnew)
+ base_entity_que_add (self, QUE_TYPE_ACTOR);
+ };
+#endif
+
#ifdef SSQC
//--------------------------------------------------------------
void() func_door_secret_blocked =
@@ -87,50 +137,62 @@ If a secret door has a targetname, it will only be opened by it's botton or trig
{
switch (self.state)
{
- case 1:
+ case fd_secret_move1:
// fd_secret_move1: Wait after first movement
self.nextthink = self.ltime + 1.0;
sound (self, CHAN_VOICE, self.noise3,
VOL_MHI, ATTN_NORM);
break;
- case 2:
+ case fd_secret_move2:
// fd_secret_move2: move sideways w/sound
sound (self, CHAN_VOICE, self.noise2,
VOL_MHI, ATTN_NORM);
- sub_calcmove (self, self.pos2, self.speed,
+ base_func_calcmove (self, self.pos2, self.speed,
func_door_secret_think);
break;
- case 3:
+ case fd_secret_move3:
// fd_secret_move3: wait until time to go back
sound (self, CHAN_VOICE, self.noise3,
VOL_MHI, ATTN_NORM);
- if (!(self.spawnflags & SECRET_OPEN_ONCE))
+ if (!(self.spawnflags &
+ SPAWNFLAG_FUNC_DOOR_SECRET_OPEN_ONCE))
+ {
self.nextthink = self.ltime + self.wait;
+ }
+ #if 1
+ else
+ {
+ dprint (sprintf("func_door_secret_think"
+ ": open once, removing from f"
+ "rametick at %g time\n", time));
+ }
+ #endif
break;
- case 4:
+ case fd_secret_move4:
// fd_secret_move4: move backward...
sound (self, CHAN_VOICE, self.noise2,
VOL_MHI, ATTN_NORM);
- sub_calcmove (self, self.pos1, self.speed,
+ base_func_calcmove (self, self.pos1, self.speed,
func_door_secret_think);
break;
- case 5:
+ case fd_secret_move5:
// fd_secret_move5: wait 1 second...
self.nextthink = self.ltime + 1.0;
sound (self, CHAN_VOICE, self.noise3,
VOL_MHI, ATTN_NORM);
break;
- case 6:
+ case fd_secret_move6:
// fd_secret_move6
sound (self, CHAN_VOICE, self.noise2,
VOL_MHI, ATTN_NORM);
- sub_calcmove (self, self.oldorigin, self.speed,
- func_door_secret_think);
+ base_func_calcmove (self, self.oldorigin,
+ self.speed, func_door_secret_think);
break;
- case 7:
+ case fd_secret_done:
// fd_secret_done
if (!self.targetname ||
- self.spawnflags & SECRET_YES_SHOOT)
+ self.spawnflags &
+ SPAWNFLAG_FUNC_DOOR_SECRET_YES_SHOOT)
{
self.health = 10000;
self.takedamage = DAMAGE_YES;
@@ -139,17 +201,22 @@ If a secret door has a targetname, it will only be opened by it's botton or trig
// self.th_pain = sub_nullpain;
}
+ #if 0
+ dprint (sprintf("func_door_secret_think: move "
+ "complete, removing from frametick at "
+ "%g time\n", time));
+ #endif
+
sound (self, CHAN_VOICE, self.noise3,
VOL_MHI, ATTN_NORM);
break;
default:
dprint (sprintf("func_door_secret_think: "
- "unhandled state %f!\n",
- self.state));
+ "unhandled state %f!\n", self.state));
}
- if (self.state < 4 ||
- !(self.spawnflags & SECRET_OPEN_ONCE))
+ if (self.state < fd_secret_move4 || !(self.spawnflags &
+ SPAWNFLAG_FUNC_DOOR_SECRET_OPEN_ONCE))
{
self.state++;
}
@@ -194,7 +261,7 @@ If a secret door has a targetname, it will only be opened by it's botton or trig
// fire all targets / killtargets
sub_usetargets ();
- if (!(self.spawnflags & SECRET_NO_SHOOT))
+ if (!(self.spawnflags & SPAWNFLAG_FUNC_DOOR_SECRET_NO_SHOOT))
{
self.th_pain = sub_nullpain;
self.takedamage = DAMAGE_NO;
@@ -207,33 +274,41 @@ If a secret door has a targetname, it will only be opened by it's botton or trig
self.nextthink = self.ltime + 0.1;
// 1 or -1
- temp = 1 - (self.spawnflags & SECRET_1ST_LEFT);
+ temp = 1 - (self.spawnflags &
+ SPAWNFLAG_FUNC_DOOR_SECRET_1ST_LEFT);
makevectors (self.mangle);
if (!self.t_width)
{
- if (self.spawnflags & SECRET_1ST_DOWN)
+ if (self.spawnflags &
+ SPAWNFLAG_FUNC_DOOR_SECRET_1ST_DOWN)
+ {
self.t_width = fabs (v_up * self.size);
+ }
else
+ {
self.t_width = fabs (v_right * self.size);
+ }
}
if (!self.t_length)
self.t_length = fabs (v_forward * self.size);
- if (self.spawnflags & SECRET_1ST_DOWN)
+ if (self.spawnflags & SPAWNFLAG_FUNC_DOOR_SECRET_1ST_DOWN)
self.pos1 = self.origin - v_up * self.t_width;
else
self.pos1 = self.origin + v_right *
(self.t_width * temp);
self.pos2 = self.pos1 + v_forward * self.t_length;
- self.state = 1;
- sub_calcmove (self, self.pos1, self.speed,
+ self.state = fd_secret_move1;
+ base_func_calcmove (self, self.pos1, self.speed,
func_door_secret_think);
sound (self, CHAN_VOICE, self.noise2, VOL_MHI, ATTN_NORM);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) func_door_secret_init =
{
@@ -241,6 +316,15 @@ If a secret door has a targetname, it will only be opened by it's botton or trig
e.classtype = CT_FUNC_DOOR_SECRET;
base_func_init (e);
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ setsize (e, e.mins, e.maxs);
+ setorigin (e, e.origin);
+ e.drawmask = DRAWMASK_NORMAL;
+ e.predraw = base_func_predraw;
+ #endif
+
+ #ifdef SSQC
if (e.sounds == 0)
e.sounds = 3;
@@ -289,7 +373,8 @@ If a secret door has a targetname, it will only be opened by it's botton or trig
e.touch = func_door_secret_touch;
e.use = func_door_secret_use;
- if (!e.targetname || e.spawnflags & SECRET_YES_SHOOT)
+ if (!e.targetname ||
+ e.spawnflags & SPAWNFLAG_FUNC_DOOR_SECRET_YES_SHOOT)
{
e.health = 10000;
e.takedamage = DAMAGE_YES;
@@ -302,8 +387,16 @@ If a secret door has a targetname, it will only be opened by it's botton or trig
if (!e.wait)
// 5 seconds before closing
e.wait = 5;
+
+ // network to the client -- CEV
+ e.tick = base_func_neteval;
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() func_door_secret =
{
Return to the top of this page or return to the overview of this repo.
Diff qc/func/elvtr_button.qc
diff --git a/qc/func/elvtr_button.qc b/qc/func/elvtr_button.qc
index 5087e73..3d8881f 100644
--- a/qc/func/elvtr_button.qc
+++ b/qc/func/elvtr_button.qc
@@ -11,7 +11,22 @@
//======================================================================
#ifdef SSQC
-const float BUTTON_ELVTR_DOWN = 1;
+//----------------------------------------------------------------------
+// func_elvtr_button spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_FUNC_ELVTR_BUTTON_DOWN = 1
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} func_elvtr_button_spawnflags;
#endif
//======================================================================
@@ -27,6 +42,9 @@ float elv_butn_dir;
//======================================================================
// func_elvtr_button
+#ifdef CSQC
+void(float isnew) func_elvtr_button_netreceive;
+#endif
#ifdef SSQC
void() func_elvtr_button_wait;
void() func_elvtr_button_done;
@@ -36,7 +54,11 @@ void() func_elvtr_button_blocked;
void(vector dir) func_elvtr_button_destroy;
void() func_elvtr_button_touch;
void() func_elvtr_button_use;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) func_elvtr_button_init;
+#endif
+#ifdef SSQC
void() func_elvtr_button;
#endif
@@ -66,12 +88,23 @@ When a button is touched, it moves some distance in the direction of it's angle,
//----------------------------------------------------------------------
// class func_elvtr_button: base_func
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) func_elvtr_button_netreceive =
+ {
+ // creates the netflag variable -- CEV
+ BASE_FUNC_NETRECEIVE (func_elvtr_button_init)
+
+ if (isnew)
+ base_entity_que_add (self, QUE_TYPE_ACTOR);
+ };
+#endif
+
#ifdef SSQC
//--------------------------------------------------------------
void() func_elvtr_button_wait =
{
- // elv_butn_dir = 0;
- if (self.spawnflags & BUTTON_ELVTR_DOWN)
+ if (self.spawnflags & SPAWNFLAG_FUNC_ELVTR_BUTTON_DOWN)
elv_butn_dir = -1;
else
elv_butn_dir = 1;
@@ -79,8 +112,10 @@ When a button is touched, it moves some distance in the direction of it's angle,
self.state = FUNC_STATE_TOP;
activator = self.enemy;
sub_usetargets ();
+
// use alternate textures
self.frame = 1;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
// schedule next action
self.think = func_elvtr_button_return;
@@ -97,11 +132,12 @@ When a button is touched, it moves some distance in the direction of it's angle,
void() func_elvtr_button_return =
{
self.state = FUNC_STATE_DOWN;
- sub_calcmove (self, self.pos1, self.speed,
+ base_func_calcmove (self, self.pos1, self.speed,
func_elvtr_button_done);
// use normal textures
self.frame = 0;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
if (self.health)
// can be shot again
@@ -117,7 +153,7 @@ When a button is touched, it moves some distance in the direction of it's angle,
sound (self, CHAN_VOICE, self.noise, VOL_MID, ATTN_NORM);
self.state = FUNC_STATE_UP;
- sub_calcmove (self, self.pos2, self.speed,
+ base_func_calcmove (self, self.pos2, self.speed,
func_elvtr_button_wait);
};
@@ -156,7 +192,9 @@ When a button is touched, it moves some distance in the direction of it's angle,
self.enemy = activator;
func_elvtr_button_fire ();
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) func_elvtr_button_init =
{
@@ -164,6 +202,15 @@ When a button is touched, it moves some distance in the direction of it's angle,
e.classtype = CT_FUNC_ELVTR_BUTTON;
base_func_init (e);
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ setsize (e, e.mins, e.maxs);
+ setorigin (e, e.origin);
+ e.drawmask = DRAWMASK_NORMAL;
+ e.predraw = base_func_predraw;
+ #endif
+
+ #ifdef SSQC
if (e.sounds == 0)
{
precache_sound ("buttons/airbut1.wav");
@@ -220,8 +267,16 @@ When a button is touched, it moves some distance in the direction of it's angle,
e.pos1 = e.origin;
e.pos2 = e.pos1 + e.movedir *
(fabs(e.movedir * e.size) - e.lip);
+
+ // network to the CSQC client -- CEV
+ e.tick = base_func_neteval;
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() func_elvtr_button =
{
Return to the top of this page or return to the overview of this repo.
Diff qc/func/episodegate.qc
diff --git a/qc/func/episodegate.qc b/qc/func/episodegate.qc
index ae7f7a1..83b78e8 100644
--- a/qc/func/episodegate.qc
+++ b/qc/func/episodegate.qc
@@ -7,8 +7,27 @@
//======================================================================
#ifdef SSQC
-// For func_episodegate and func_bossgate appear when player has all runes
-const float EPISODEGATE_REVERSE = 16;
+//----------------------------------------------------------------------
+// func_episodegate spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_FUNC_EPISODEGATE_EPISODE1 = 1, // appear when E1 completed
+ SPAWNFLAG_FUNC_EPISODEGATE_EPISODE2 = 2, // when E2
+ SPAWNFLAG_FUNC_EPISODEGATE_EPISODE3 = 4, // when E3
+ SPAWNFLAG_FUNC_EPISODEGATE_EPISODE4 = 8, // when E4
+ // func_episodegate and func_bossgate appear when player has all runes
+ SPAWNFLAG_FUNC_EPISODEGATE_REVERSE = 16
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} func_episodegate_spawnflags;
#endif
//======================================================================
@@ -16,8 +35,13 @@ const float EPISODEGATE_REVERSE = 16;
//======================================================================
// func_episodegate
-#ifdef SSQC
+#ifdef CSQC
+void(float isnew) func_episodegate_netreceive;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) func_episodegate_init;
+#endif
+#ifdef SSQC
void() func_episodegate;
#endif
@@ -29,18 +53,40 @@ This bmodel will appear if the episode has allready been completed, so players c
//----------------------------------------------------------------------
// class func_episodegate: base_func_wall
// {
-#ifdef SSQC
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) func_episodegate_netreceive =
+ {
+ // creates the netflag variable -- CEV
+ BASE_FUNC_NETRECEIVE (func_episodegate_init)
+ };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) func_episodegate_init =
{
e.classname = "func_episodegate";
e.classtype = CT_FUNC_EPISODEGATE;
+
+ #if defined(CSQC)
+ base_func_init (e);
+ #elif defined(SSQC)
base_func_wall_init (e);
+ #endif
- if (e.spawnflags & EPISODEGATE_REVERSE)
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ setsize (e, e.mins, e.maxs);
+ setorigin (e, e.origin);
+ e.drawmask = DRAWMASK_NORMAL;
+ #endif
+
+ #ifdef SSQC
+ if (e.spawnflags & SPAWNFLAG_FUNC_EPISODEGATE_REVERSE)
{
// this is to avoid a possible issue with sigil_touch2
- e.spawnflags = e.spawnflags - EPISODEGATE_REVERSE;
+ e.spawnflags &= ~SPAWNFLAG_FUNC_EPISODEGATE_REVERSE;
if (serverflags & e.spawnflags)
// Haven't gotten rune yet
return;
@@ -57,8 +103,15 @@ This bmodel will appear if the episode has allready been completed, so players c
e.movetype = MOVETYPE_PUSH;
e.solid = SOLID_BSP;
setmodel (e, e.model);
+
+ // network func_wall to the CSQC client -- CEV
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() func_episodegate =
{
Return to the top of this page or return to the overview of this repo.
Diff qc/func/explobox.qc
diff --git a/qc/func/explobox.qc b/qc/func/explobox.qc
index eb1c2b7..775cce8 100644
--- a/qc/func/explobox.qc
+++ b/qc/func/explobox.qc
@@ -7,11 +7,18 @@
//======================================================================
// func_explobox
+#ifdef CSQC
+void(float isnew) func_explobox_netreceive;
+#endif
#ifdef SSQC
void() func_explobox_explode_silent;
void(vector dir) func_explobox_destroy;
// void() func_explobox_think;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) func_explobox_init;
+#endif
+#ifdef SSQC
void() func_explobox;
#endif
@@ -31,17 +38,36 @@ Keys:
//----------------------------------------------------------------------
// class func_explobox: base_func
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) func_explobox_netreceive =
+ {
+ // creates the netflag variable -- CEV
+ BASE_FUNC_NETRECEIVE (func_explobox_init)
+ };
+#endif
+
#ifdef SSQC
//--------------------------------------------------------------
void() func_explobox_explode_silent =
{
self.takedamage = DAMAGE_NO;
+
self.origin = ((self.absmin + self.absmax) * 0.5);
t_radiusdamage2 (self, self, self.dmg, world);
+
write_explosion (self.origin);
+
+ // yoder add, 27/09/2020 to make barrels fire targets on explode
+ // functionality from MG1 code -- CEV
+ activator = self.enemy;
+ dprint (sprintf("func_explobox_detonate: enemy name %s\n",
+ self.enemy.classname));
+ sub_usetargets ();
+
// BecomeExplosion
spawn_base_explosion (self.origin);
- remove (self);
+ base_entity_remove (self);
};
//--------------------------------------------------------------
@@ -61,7 +87,9 @@ Keys:
func_explobox_explode_silent ();
};
*/
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) func_explobox_init =
{
@@ -69,6 +97,14 @@ Keys:
e.classtype = CT_FUNC_EXPLOBOX;
base_func_init (e);
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ setsize (e, e.mins, e.maxs);
+ setorigin (e, e.origin);
+ e.drawmask = DRAWMASK_NORMAL;
+ #endif
+
+ #ifdef SSQC
e.solid = SOLID_BSP;
e.movetype = MOVETYPE_PUSH;
setmodel (e, e.model);
@@ -78,12 +114,24 @@ Keys:
e.health = 20;
if (!e.dmg)
- e.dmg = 100;
+ {
+ if (known_release == KNOWN_RELEASE_MG1)
+ e.dmg = 160;
+ else
+ e.dmg = 100;
+ }
e.destroy = func_explobox_destroy;
e.takedamage = DAMAGE_AIM;
+
+ // network func_wall to the CSQC client -- CEV
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() func_explobox =
{
Return to the top of this page or return to the overview of this repo.
Diff qc/func/fall.qc
diff --git a/qc/func/fall.qc b/qc/func/fall.qc
index 2a28dce..80d6997 100644
--- a/qc/func/fall.qc
+++ b/qc/func/fall.qc
@@ -13,8 +13,23 @@
//======================================================================
#ifdef SSQC
-const float FUNCFADE_DONT_FADE = 1;
-const float FUNCFADE_SILENT = 2;
+//----------------------------------------------------------------------
+// func_fall spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_FUNC_FADE_DONT_FADE = 1,
+ SPAWNFLAG_FUNC_FADE_SILENT = 2
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} func_fall_spawnflags;
#endif
//======================================================================
@@ -22,11 +37,18 @@ const float FUNCFADE_SILENT = 2;
//======================================================================
// func_fall
+#ifdef CSQC
+void(float isnew) func_fall_netreceive;
+#endif
#ifdef SSQC
void() func_fall_think;
void() func_fall_touch;
void() func_fall_use;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) func_fall_init;
+#endif
+#ifdef SSQC
void() func_fall;
#endif
@@ -46,6 +68,15 @@ Falling brush upon touch
//----------------------------------------------------------------------
// class func_fall: base_func
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) func_fall_netreceive =
+ {
+ // creates the netflag variable -- CEV
+ BASE_FUNC_NETRECEIVE (func_fall_init)
+ };
+#endif
+
#ifdef SSQC
//--------------------------------------------------------------
void() func_fall_think =
@@ -54,20 +85,34 @@ Falling brush upon touch
{
self.solid = SOLID_BBOX;
self.movetype = MOVETYPE_TOSS;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_SOLID;
+
+ if (!(self.classgroup & CG_FRAMETICK))
+ self.classgroup |= CG_FRAMETICK;
- if (!(self.spawnflags & FUNCFADE_DONT_FADE))
+ if (!(self.spawnflags & SPAWNFLAG_FUNC_FADE_DONT_FADE))
{
if (self.alpha > 0.1)
{
self.alpha = self.alpha - 0.03;
+ self.SendFlags |=
+ NETFLAG_BASE_ENTITY_ALPHA;
}
else
{
- remove (self);
+ self.classgroup &= ~CG_FRAMETICK;
+ base_entity_remove (self);
return;
}
}
}
+ else if (self.flags & FL_ONGROUND)
+ {
+ if (self.classgroup & CG_FRAMETICK)
+ self.classgroup &= ~CG_FRAMETICK;
+ }
+
self.nextthink = time + 0.1;
};
@@ -94,7 +139,7 @@ Falling brush upon touch
self.attack_finished = time + self.wait;
self.cnt = TRUE;
- if (!(self.spawnflags & FUNCFADE_SILENT))
+ if (!(self.spawnflags & SPAWNFLAG_FUNC_FADE_SILENT))
{
if (self.noise != "")
sound (self, CHAN_AUTO, self.noise,
@@ -118,7 +163,9 @@ Falling brush upon touch
sound (self, CHAN_AUTO, "buttons/switch21.wav",
VOL_HIGH, ATTN_NORM);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) func_fall_init =
{
@@ -126,6 +173,15 @@ Falling brush upon touch
e.classtype = CT_FUNC_FALL;
base_func_init (e);
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ setsize (e, e.mins, e.maxs);
+ setorigin (e, e.origin);
+ e.drawmask = DRAWMASK_NORMAL;
+ e.predraw = base_func_predraw;
+ #endif
+
+ #ifdef SSQC
precache_sound ("buttons/switch21.wav");
if (e.noise != "")
precache_sound (e.noise);
@@ -139,8 +195,16 @@ Falling brush upon touch
e.think = func_fall_think;
e.nextthink = time;
setmodel (e, e.model);
+
+ e.customphysics = base_entity_movetype_push;
+ e.tick = base_func_neteval;
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() func_fall =
{
Return to the top of this page or return to the overview of this repo.
Diff qc/func/fall2.qc
diff --git a/qc/func/fall2.qc b/qc/func/fall2.qc
index e7f3a43..3ecfad5 100644
--- a/qc/func/fall2.qc
+++ b/qc/func/fall2.qc
@@ -7,10 +7,25 @@
//======================================================================
#ifdef SSQC
-const float FALL2_PLAYER_TRIGGERED = 1;
-const float FALL2_MONSTER_TRIGGERED = 2;
-const float FALL2_BREAKABLE = 8; // VR
-// const float FALL2_SOLID = 16; // VR
+//----------------------------------------------------------------------
+// func_fall2 spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_FUNC_FALL2_PLAYER_TRIGGERED = 1,
+ SPAWNFLAG_FUNC_FALL2_MONSTER_TRIGGERED = 2,
+ SPAWNFLAG_FUNC_FALL2_BREAKABLE = 8 // VR
+ // SPAWNFLAG_FUNC_FALL2_SOLID = 16; // VR
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} func_fall2_spawnflags;
#endif
//======================================================================
@@ -26,12 +41,19 @@ strip void() temp_fall2_field;
#endif
// func_fall2
+#ifdef CSQC
+void(float isnew) func_fall2_netreceive;
+#endif
#ifdef SSQC
void() func_fall2_think;
void() func_fall2_touch;
void() func_fall2_use;
void(entity e) func_fall2_breakable_fields;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) func_fall2_init;
+#endif
+#ifdef SSQC
void() func_fall2;
#endif
@@ -118,6 +140,15 @@ Able to .target other entities, including other func_fall2s
//----------------------------------------------------------------------
// class func_fall2: base_breakable
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) func_fall2_netreceive =
+ {
+ // creates the netflag variable -- CEV
+ BASE_FUNC_NETRECEIVE (func_fall2_init)
+ };
+#endif
+
#ifdef SSQC
//--------------------------------------------------------------
void() func_fall2_think =
@@ -170,10 +201,19 @@ Able to .target other entities, including other func_fall2s
self.velocity_z = self.lip;
}
+ self.SendFlags |= NETFLAG_BASE_ENTITY_SOLID;
+
+ if (!(self.classgroup & CG_FRAMETICK))
+ self.classgroup |= CG_FRAMETICK;
+
if (self.pain_finished != -1)
{
if (self.alpha > 0.1)
+ {
self.alpha -= self.pain_finished;
+ self.SendFlags |=
+ NETFLAG_BASE_ENTITY_ALPHA;
+ }
else
{
if (self.noise2 != __NULL__ &&
@@ -183,13 +223,13 @@ Able to .target other entities, including other func_fall2s
self.noise2,
VOL_HIGH, ATTN_NORM);
}
- remove (self);
+ base_entity_remove (self);
return;
}
}
- if (self.flags & FL_ONGROUND &&
- self.spawnflags & FALL2_BREAKABLE)
+ if (self.spawnflags & SPAWNFLAG_FUNC_FALL2_BREAKABLE &&
+ self.flags & FL_ONGROUND)
{
// VR
// aka BREAKABLE_NO_MONSTERS
@@ -209,6 +249,11 @@ Able to .target other entities, including other func_fall2s
return;
}
}
+ else if (self.flags & FL_ONGROUND)
+ {
+ if (self.classgroup & CG_FRAMETICK)
+ self.classgroup &= ~CG_FRAMETICK;
+ }
self.nextthink = self.ltime + 0.1;
};
@@ -223,7 +268,7 @@ Able to .target other entities, including other func_fall2s
// player activated only
return;
- if (self.spawnflags & FALL2_MONSTER_TRIGGERED)
+ if (self.spawnflags & SPAWNFLAG_FUNC_FALL2_MONSTER_TRIGGERED)
// disable on monster only, also fixes weird issue
return;
@@ -231,7 +276,7 @@ Able to .target other entities, including other func_fall2s
self.nextthink = self.ltime + 0.1;
self.attack_finished = time + self.wait;
- // if (self.spawnflags & FALL_SOLID)
+ // if (self.spawnflags & SPAWNFLAG_FUNC_FALL_SOLID)
// {
// // VR
// setsize (self, self.mins, self.maxs);
@@ -261,7 +306,7 @@ Able to .target other entities, including other func_fall2s
// disable touch when used
self.touch = sub_null;
- // if (self.spawnflags & FALL_SOLID)
+ // if (self.spawnflags & SPAWNFLAG_FUNC_FALL_SOLID)
// {
// // VR
// setsize (self, self.mins, self.maxs);
@@ -365,19 +410,31 @@ Able to .target other entities, including other func_fall2s
// was 6 dumptruck_ds
e.count = 5;
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) func_fall2_init =
{
e.classname = "func_fall2";
e.classtype = CT_FUNC_FALL2;
+
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ setsize (e, e.mins, e.maxs);
+ setorigin (e, e.origin);
+ e.drawmask = DRAWMASK_NORMAL;
+ e.predraw = base_func_predraw;
+ #endif
+
+ #ifdef SSQC
base_breakable_init (e);
// This is a hack to have monsters be able to trigger it
// by fake touch - Thanks to Nahuel
// Don't spawn on player only or if I'm a targetable
- if (!(e.spawnflags & FALL2_PLAYER_TRIGGERED) &&
+ if (!(e.spawnflags & SPAWNFLAG_FUNC_FALL2_PLAYER_TRIGGERED) &&
!(e.targetname))
{
// Link 'em -- modified to use a helper class -- CEV
@@ -413,7 +470,7 @@ Able to .target other entities, including other func_fall2s
e.avelocity = '0 0 0';
}
- if (e.spawnflags & FALL2_BREAKABLE)
+ if (e.spawnflags & SPAWNFLAG_FUNC_FALL2_BREAKABLE)
{
// VR
// dont fade if set to break
@@ -423,8 +480,16 @@ Able to .target other entities, including other func_fall2s
e.use = func_fall2_use;
setmodel (e, e.model);
+
+ e.customphysics = base_entity_movetype_push;
+ e.tick = base_func_neteval;
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() func_fall2 =
{
Return to the top of this page or return to the overview of this repo.
Diff qc/func/illusionary.qc
diff --git a/qc/func/illusionary.qc b/qc/func/illusionary.qc
index d8c0040..9362bf1 100644
--- a/qc/func/illusionary.qc
+++ b/qc/func/illusionary.qc
@@ -7,8 +7,13 @@
//======================================================================
// func_illusionary
-#ifdef SSQC
+#ifdef CSQC
+void(float isnew) func_illusionary_netreceive;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) func_illusionary_init;
+#endif
+#ifdef SSQC
void() func_illusionary;
#endif
@@ -20,7 +25,16 @@ A simple entity that looks solid but lets you walk through it.
//----------------------------------------------------------------------
// class func_illusionary: base_func
// {
-#ifdef SSQC
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) func_illusionary_netreceive =
+ {
+ // creates the netflag variable -- CEV
+ BASE_FUNC_NETRECEIVE (func_illusionary_init)
+ };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) func_illusionary_init =
{
@@ -28,13 +42,33 @@ A simple entity that looks solid but lets you walk through it.
e.classtype = CT_FUNC_ILLUSIONARY;
base_func_init (e);
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ setsize (e, e.mins, e.maxs);
+ setorigin (e, e.origin);
+ e.drawmask = DRAWMASK_NORMAL;
+ #endif
+
+ #ifdef SSQC
e.angles = '0 0 0';
e.movetype = MOVETYPE_NONE;
e.solid = SOLID_NOT;
setmodel (e, e.model);
+
+ // makestatic means networking for this object will be
+ // handled by the engine; I've left the CSQC bootstrap
+ // stuff here just in case -- CEV
+ #if 1
makestatic (e);
+ #else
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+ #endif
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() func_illusionary =
{
Return to the top of this page or return to the overview of this repo.
Diff qc/func/laser.qc
diff --git a/qc/func/laser.qc b/qc/func/laser.qc
index 9401b62..152a945 100644
--- a/qc/func/laser.qc
+++ b/qc/func/laser.qc
@@ -7,8 +7,23 @@
//======================================================================
#ifdef SSQC
-const float LASER_START_OFF = 1;
-const float LASER_SOLID = 2;
+//----------------------------------------------------------------------
+// func_laser spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_FUNC_LASER_START_OFF = 1,
+ SPAWNFLAG_FUNC_LASER_SOLID = 2
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} func_laser_spawnflags;
#endif
//======================================================================
@@ -16,7 +31,7 @@ const float LASER_SOLID = 2;
//======================================================================
// temp_laser_helper
-#ifdef SSQC
+#if defined(CSQC) || defined(SSQC)
void() temp_laser_helper_think;
entity(entity own, float newalpha) spawn_temp_laser_helper;
void(entity e) temp_laser_helper_init;
@@ -24,10 +39,17 @@ strip void() temp_laser_helper;
#endif
// func_laser
+#ifdef CSQC
+void(float isnew) func_laser_netreceive;
+#endif
#ifdef SSQC
void() func_laser_touch;
void() func_laser_use;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) func_laser_init;
+#endif
+#ifdef SSQC
void() func_laser;
#endif
@@ -36,7 +58,7 @@ void() func_laser;
//----------------------------------------------------------------------
// class temp_laser_helper: base_tempentity
// {
-#ifdef SSQC
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void() temp_laser_helper_think =
{
@@ -46,7 +68,7 @@ void() func_laser;
return;
}
- if (!(self.owner.spawnflags & LASER_START_OFF))
+ if (self.owner.origin == '0 0 0')
self.owner.alpha = self.alpha * 0.8 +
self.alpha * random() * 0.4;
@@ -104,6 +126,15 @@ Keys:
//----------------------------------------------------------------------
// class func_laser: base_func
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) func_laser_netreceive =
+ {
+ // creates the netflag variable -- CEV
+ BASE_FUNC_NETRECEIVE (func_laser_init)
+ };
+#endif
+
#ifdef SSQC
//--------------------------------------------------------------
void() func_laser_touch =
@@ -123,10 +154,11 @@ Keys:
//--------------------------------------------------------------
void() func_laser_use =
{
- if (self.spawnflags & LASER_START_OFF)
+ if (self.spawnflags & SPAWNFLAG_FUNC_LASER_START_OFF)
{
setorigin (self, '0 0 0');
- self.spawnflags = self.spawnflags - LASER_START_OFF;
+ self.spawnflags &= ~SPAWNFLAG_FUNC_LASER_START_OFF;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
// changed for progs_dump: the laser sound is now
// emitted from the func_laser itself instead of
@@ -142,15 +174,16 @@ Keys:
}
else
{
+ setorigin (self, '0 0 9000');
+ self.spawnflags |= SPAWNFLAG_FUNC_LASER_START_OFF;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
+
// changed for progs_dump: the laser sound is now
// emitted from the func_laser itself instead of
// from the activator -- iw
sound (self, CHAN_VOICE, self.noise1,
VOL_HIGH, ATTN_NORM);
- setorigin (self, '0 0 9000');
- self.spawnflags = self.spawnflags + LASER_START_OFF;
-
if (activator.classtype == CT_PLAYER &&
self.message2 != "")
{
@@ -158,7 +191,9 @@ Keys:
}
}
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) func_laser_init =
{
@@ -166,12 +201,25 @@ Keys:
e.classtype = CT_FUNC_LASER;
base_func_init (e);
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ setsize (e, e.mins, e.maxs);
+ setorigin (e, e.origin);
+ e.drawmask = DRAWMASK_NORMAL;
+ e.predraw = base_func_predraw;
+
+ // spawn the laser helper on the client side -- CEV
+ if (!e.enemy)
+ e.enemy = spawn_temp_laser_helper (e, e.alpha);
+ #endif
+
+ #ifdef SSQC
setmodel (e, e.model);
precache_sound ("buttons/switch02.wav");
precache_sound ("buttons/switch04.wav");
- if (e.spawnflags & LASER_SOLID)
+ if (e.spawnflags & SPAWNFLAG_FUNC_LASER_SOLID)
{
// so you can shoot between lasers in a single bmodel
e.solid = SOLID_BSP;
@@ -193,7 +241,7 @@ Keys:
e.touch = func_laser_touch;
e.use = func_laser_use;
- if (e.spawnflags & LASER_START_OFF)
+ if (e.spawnflags & SPAWNFLAG_FUNC_LASER_START_OFF)
setorigin (e, '0 0 9000');
if (e.noise != "")
@@ -206,11 +254,19 @@ Keys:
else
e.noise1 = "buttons/switch04.wav";
+ #if 0
// spawn a second entity to handle alpha changes, since
// MOVETYPE_PUSH doesn't support think functions
spawn_temp_laser_helper (e, e.alpha);
+ #endif
+
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() func_laser =
{
Return to the top of this page or return to the overview of this repo.
Diff qc/func/monster_spawner.qc
diff --git a/qc/func/monster_spawner.qc b/qc/func/monster_spawner.qc
index b0049c3..8716f2e 100644
--- a/qc/func/monster_spawner.qc
+++ b/qc/func/monster_spawner.qc
@@ -16,10 +16,25 @@
//======================================================================
#ifdef SSQC
-const float MOBOT_SPAWNER_RESET = 1;
-const float MOBOT_PASSIVE = 2; // MOBOT_DONT_SPAWN_ANGRY
-const float MOBOT_DONT_ADD_KILL_COUNT = 4;
-const float MOBOT_SILENT_SPAWN = 32;
+//----------------------------------------------------------------------
+// func_monster_spawner spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_FUNC_MOBOT_SPAWNER_RESET = 1,
+ SPAWNFLAG_FUNC_MOBOT_PASSIVE = 2, // MOBOT_DONT_SPAWN_ANGRY
+ SPAWNFLAG_FUNC_MOBOT_DONT_ADD_KILL_COUNT = 4,
+ SPAWNFLAG_FUNC_MOBOT_SILENT_SPAWN = 32
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} func_monster_spawner_spawnflags;
#endif
//======================================================================
@@ -87,7 +102,7 @@ Can only use default health, models and sounds.
//--------------------------------------------------------------
void(entity e) func_monster_spawner_tfrag =
{
- if (!(self.spawnflags & MOBOT_SILENT_SPAWN))
+ if (!(self.spawnflags & SPAWNFLAG_FUNC_MOBOT_SILENT_SPAWN))
// SILENT
spawn_tfog (e.origin);
spawn_tdeath (e.origin, e);
@@ -100,7 +115,12 @@ Can only use default health, models and sounds.
// spawn_spot = SelectSpawnPoint ();
local entity spawn_spot =
func_monster_spawner_find_spawnpoint ();
- local float angry = self.spawnflags & MOBOT_PASSIVE ? 0 : 1;
+
+ // use a flag instead of the spawn_angry field -- CEV
+ local float sflags = 0;
+ if (!(self.spawnflags & SPAWNFLAG_FUNC_MOBOT_PASSIVE))
+ sflags |= SPAWNFLAG_MONSTER_ANGRY;
+
local entity e = __NULL__;
switch (self.style)
@@ -110,9 +130,8 @@ Can only use default health, models and sounds.
e = spawn_monster_dog (
spawn_spot.origin + '0 0 1',
spawn_spot.angles,
- 0,
- 120,
- angry);
+ sflags,
+ 120);
e.view_ofs = '0 0 22';
break;
case 2:
@@ -120,9 +139,8 @@ Can only use default health, models and sounds.
e = spawn_monster_army (
spawn_spot.origin + '0 0 1',
spawn_spot.angles,
- 0,
- 120,
- angry);
+ sflags,
+ 120);
e.view_ofs = '0 0 22';
break;
case 3:
@@ -130,9 +148,8 @@ Can only use default health, models and sounds.
e = spawn_monster_enforcer (
spawn_spot.origin + '0 0 1',
spawn_spot.angles,
- 0,
- 120,
- angry);
+ sflags,
+ 120);
e.view_ofs = '0 0 22';
break;
case 4:
@@ -140,9 +157,8 @@ Can only use default health, models and sounds.
e = spawn_monster_ogre (
spawn_spot.origin + '0 0 1',
spawn_spot.angles,
- 0,
- 120,
- angry);
+ sflags,
+ 120);
e.view_ofs = '0 0 22';
break;
case 5:
@@ -150,9 +166,8 @@ Can only use default health, models and sounds.
e = spawn_monster_demon1 (
spawn_spot.origin + '0 0 1',
spawn_spot.angles,
- 0,
- 120,
- angry);
+ sflags,
+ 120);
e.view_ofs = '0 0 22';
break;
case 6:
@@ -160,9 +175,8 @@ Can only use default health, models and sounds.
e = spawn_monster_wizard (
spawn_spot.origin + '0 0 1',
spawn_spot.angles,
- 0,
- 120,
- angry);
+ sflags,
+ 120);
// e.mdl_proj = "progs/w_spike.mdl";
e.view_ofs = '0 0 22';
break;
@@ -171,9 +185,8 @@ Can only use default health, models and sounds.
e = spawn_monster_shambler (
spawn_spot.origin + '0 0 1',
spawn_spot.angles,
- 0,
- 120,
- angry);
+ sflags,
+ 120);
e.view_ofs = '0 0 2';
break;
case 8:
@@ -181,9 +194,8 @@ Can only use default health, models and sounds.
e = spawn_monster_knight (
spawn_spot.origin + '0 0 1',
spawn_spot.angles,
- 0,
- 120,
- angry);
+ sflags,
+ 120);
e.view_ofs = '0 0 22';
break;
case 9:
@@ -191,9 +203,8 @@ Can only use default health, models and sounds.
e = spawn_monster_hell_knight (
spawn_spot.origin + '0 0 1',
spawn_spot.angles,
- 0,
- 120,
- angry);
+ sflags,
+ 120);
e.view_ofs = '0 0 22';
break;
case 11:
@@ -201,9 +212,8 @@ Can only use default health, models and sounds.
e = spawn_monster_zombie (
spawn_spot.origin + '0 0 1',
spawn_spot.angles,
- 0,
- 120,
- angry);
+ sflags,
+ 120);
e.view_ofs = '0 0 2';
break;
case 12:
@@ -211,9 +221,8 @@ Can only use default health, models and sounds.
e = spawn_monster_shalrath (
spawn_spot.origin + '0 0 1',
spawn_spot.angles,
- 0,
- 120,
- angry);
+ sflags,
+ 120);
e.view_ofs = '0 0 22';
break;
default:
@@ -226,9 +235,12 @@ Can only use default health, models and sounds.
e.fixangle = TRUE;
func_monster_spawner_tfrag (e);
- if (!(self.spawnflags & MOBOT_DONT_ADD_KILL_COUNT))
+ if (!(self.spawnflags &
+ SPAWNFLAG_FUNC_MOBOT_DONT_ADD_KILL_COUNT))
+ {
// replacement function from iw -- dumptruck_ds
monster_update_total (1);
+ }
}
};
@@ -289,7 +301,8 @@ Can only use default health, models and sounds.
}
else
{
- if (self.spawnflags & MOBOT_SPAWNER_RESET)
+ if (self.spawnflags &
+ SPAWNFLAG_FUNC_MOBOT_SPAWNER_RESET)
{
self.count = self.cnt;
self.think = sub_null;
@@ -322,12 +335,17 @@ Can only use default health, models and sounds.
if (!e.count)
e.count = 5;
+
// fixes count display
e.count = e.count + 1;
+
// hold original count
e.cnt = e.count;
e.use = func_monster_spawner_think;
+
+ // don't transmit this entity to the client -- CEV
+ // e.SendEntity = base_entity_netsend_null;
};
//--------------------------------------------------------------
Return to the top of this page or return to the overview of this repo.
Diff qc/func/new_plat.qc
diff --git a/qc/func/new_plat.qc b/qc/func/new_plat.qc
index 6b971e8..5464181 100644
--- a/qc/func/new_plat.qc
+++ b/qc/func/new_plat.qc
@@ -11,12 +11,27 @@
//======================================================================
#ifdef SSQC
-const float NEWPLAT_DN_N_WAIT = 1; // spawnflags
-const float NEWPLAT_PLT_TOGGLE = 2;
-const float NEWPLAT_ELEVATOR = 4;
-const float NEWPLAT_START_AT_TOP = 8;
-const float NEWPLAT_PLAT2 = 16;
-const float NEWPLAT_PLAT2_BOTTOM = 32;
+//----------------------------------------------------------------------
+// func_new_plat spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_FUNC_NEW_PLAT_DN_N_WAIT = 1,
+ SPAWNFLAG_FUNC_NEW_PLAT_PLT_TOGGLE = 2,
+ SPAWNFLAG_FUNC_NEW_PLAT_ELEVATOR = 4,
+ SPAWNFLAG_FUNC_NEW_PLAT_START_AT_TOP = 8,
+ SPAWNFLAG_FUNC_NEW_PLAT_PLAT2 = 16,
+ SPAWNFLAG_FUNC_NEW_PLAT_PLAT2_BOTTOM = 32
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} func_new_plat_spawnflags;
#endif
//======================================================================
@@ -181,7 +196,8 @@ void() func_new_plat;
local vector tmax = e.owner.maxs - '25 25 -8';
tmin_z = tmax_z - (e.owner.pos1_z - e.owner.pos2_z + 8);
- if (e.owner.spawnflags & PLAT_LOW_TRIGGER)
+ // TODO CEV checking a flag from func_plat seems kinda sketchy
+ if (e.owner.spawnflags & SPAWNFLAG_FUNC_PLAT_LOW_TRIGGER)
tmax_z = tmin_z + 8;
if (e.owner.size_x <= 50)
@@ -248,39 +264,11 @@ Set "sounds" to one of the following:
//--------------------------------------------------------------
void(float isnew) func_new_plat_netreceive =
{
- local float netflags = ReadFloat ();
- base_func_netreceive_read (isnew, netflags);
+ // creates the netflag variable -- CEV
+ BASE_FUNC_NETRECEIVE (func_new_plat_init)
if (isnew)
- func_new_plat_init (self);
-
- if (netflags & BASE_FUNC_NET_VELOCITY)
- {
- if (self.velocity != self.velocity_net)
- {
- if (self.velocity)
- {
- self.origin_start = self.origin;
- self.movetime = time;
- }
- else
- {
- self.movetime = 0;
- }
- }
- }
-
- self.origin_net = self.origin;
- self.velocity_net = self.velocity;
-
- if (netflags & BASE_FUNC_NET_MODEL)
- setmodelindex (self, self.modelindex);
-
- if (netflags & BASE_FUNC_NET_SIZE)
- setsize (self, self.mins, self.maxs);
-
- if (netflags & BASE_FUNC_NET_ORIGIN)
- setorigin (self, self.origin);
+ base_entity_que_add (self, QUE_TYPE_ACTOR);
};
#endif
@@ -294,8 +282,8 @@ Set "sounds" to one of the following:
{
sound (self, CHAN_VOICE, self.noise1, VOL_MHI, ATTN_NORM);
self.state = FUNC_STATE_TOP;
- self.SendFlags = BASE_FUNC_NET_SPEED |
- BASE_FUNC_NET_ORIGIN | BASE_FUNC_NET_VELOCITY;
+
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
};
//--------------------------------------------------------------
@@ -303,10 +291,11 @@ Set "sounds" to one of the following:
{
sound (self, CHAN_VOICE, self.noise1, VOL_MHI, ATTN_NORM);
self.state = FUNC_STATE_BOTTOM;
+
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
+
self.think = func_new_plat_downandwait_go_up;
self.nextthink = self.ltime + self.health;
- self.SendFlags = BASE_FUNC_NET_SPEED |
- BASE_FUNC_NET_ORIGIN | BASE_FUNC_NET_VELOCITY;
};
//--------------------------------------------------------------
@@ -314,10 +303,9 @@ Set "sounds" to one of the following:
{
sound (self, CHAN_VOICE, self.noise, VOL_MHI, ATTN_NORM);
self.state = FUNC_STATE_DOWN;
- sub_calcmove (self, self.pos2, self.speed,
+ base_func_calcmove (self, self.pos2, self.speed,
func_new_plat_downandwait_hit_bottom);
- self.SendFlags = BASE_FUNC_NET_SPEED |
- BASE_FUNC_NET_ORIGIN | BASE_FUNC_NET_VELOCITY;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
};
//--------------------------------------------------------------
@@ -325,10 +313,9 @@ Set "sounds" to one of the following:
{
sound (self, CHAN_VOICE, self.noise, VOL_MHI, ATTN_NORM);
self.state = FUNC_STATE_UP;
- sub_calcmove (self, self.pos1, self.speed,
+ base_func_calcmove (self, self.pos1, self.speed,
func_new_plat_downandwait_hit_top);
- self.SendFlags = BASE_FUNC_NET_SPEED |
- BASE_FUNC_NET_ORIGIN | BASE_FUNC_NET_VELOCITY;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
};
//--------------------------------------------------------------
@@ -370,8 +357,8 @@ Set "sounds" to one of the following:
{
sound (self, CHAN_VOICE, self.noise1, VOL_MHI, ATTN_NORM);
self.state = FUNC_STATE_TOP;
- self.SendFlags = BASE_FUNC_NET_SPEED |
- BASE_FUNC_NET_ORIGIN | BASE_FUNC_NET_VELOCITY;
+
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
};
//--------------------------------------------------------------
@@ -379,8 +366,8 @@ Set "sounds" to one of the following:
{
sound (self, CHAN_VOICE, self.noise1, VOL_MHI, ATTN_NORM);
self.state = FUNC_STATE_BOTTOM;
- self.SendFlags = BASE_FUNC_NET_SPEED |
- BASE_FUNC_NET_ORIGIN | BASE_FUNC_NET_VELOCITY;
+
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
};
//--------------------------------------------------------------
@@ -388,10 +375,11 @@ Set "sounds" to one of the following:
{
sound (self, CHAN_VOICE, self.noise, VOL_MHI, ATTN_NORM);
self.state = FUNC_STATE_DOWN;
- sub_calcmove (self, self.pos2, self.speed,
+
+ base_func_calcmove (self, self.pos2, self.speed,
func_new_plat_toggle_hit_bottom);
- self.SendFlags = BASE_FUNC_NET_SPEED |
- BASE_FUNC_NET_ORIGIN | BASE_FUNC_NET_VELOCITY;
+
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
};
//--------------------------------------------------------------
@@ -399,10 +387,11 @@ Set "sounds" to one of the following:
{
sound (self, CHAN_VOICE, self.noise, VOL_MHI, ATTN_NORM);
self.state = FUNC_STATE_UP;
- sub_calcmove (self, self.pos1, self.speed,
+
+ base_func_calcmove (self, self.pos1, self.speed,
func_new_plat_toggle_hit_top);
- self.SendFlags = BASE_FUNC_NET_SPEED |
- BASE_FUNC_NET_ORIGIN | BASE_FUNC_NET_VELOCITY;
+
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
};
//--------------------------------------------------------------
@@ -447,27 +436,29 @@ Set "sounds" to one of the following:
//--------------------------------------------------------------
void() func_new_plat_elvtr_stop =
{
- self.style = self.style2;
sound (self, CHAN_VOICE, self.noise1, VOL_MHI, ATTN_NORM);
+
+ self.style = self.style2;
self.state = FUNC_STATE_BOTTOM;
self.rad_time = time;
- self.SendFlags = BASE_FUNC_NET_SPEED |
- BASE_FUNC_NET_ORIGIN | BASE_FUNC_NET_VELOCITY;
+
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
};
//--------------------------------------------------------------
void() func_new_plat_elvtr_go =
{
- self.finaldest = self.pos2;
- self.finaldest_z = self.pos2_z +
- (self.height * self.style2);
sound (self, CHAN_VOICE, self.noise, VOL_MHI, ATTN_NORM);
+
+ self.finaldest = self.pos2;
+ self.finaldest_z = self.pos2_z + (self.height * self.style2);
self.state = FUNC_STATE_UP;
- sub_calcmove (self, self.finaldest, self.speed,
- func_new_plat_elvtr_stop);
self.rad_time = time;
- self.SendFlags = BASE_FUNC_NET_SPEED |
- BASE_FUNC_NET_ORIGIN | BASE_FUNC_NET_VELOCITY;
+
+ base_func_calcmove (self, self.finaldest, self.speed,
+ func_new_plat_elvtr_stop);
+
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
};
//--------------------------------------------------------------
@@ -587,14 +578,15 @@ Set "sounds" to one of the following:
self.think = func_new_plat_plat2_go_down;
self.nextthink = self.ltime + 1.5;
}
- else if (!(self.spawnflags & NEWPLAT_START_AT_TOP))
+ else if (!(self.spawnflags &
+ SPAWNFLAG_FUNC_NEW_PLAT_START_AT_TOP))
{
self.cnt = 0;
self.think = func_new_plat_plat2_go_down;
self.nextthink = self.ltime + self.delay;
}
- self.SendFlags = BASE_FUNC_NET_SPEED |
- BASE_FUNC_NET_ORIGIN | BASE_FUNC_NET_VELOCITY;
+
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
};
//--------------------------------------------------------------
@@ -612,14 +604,14 @@ Set "sounds" to one of the following:
self.think = func_new_plat_plat2_go_up;
self.nextthink = self.ltime + 1.5;
}
- else if (self.spawnflags & NEWPLAT_START_AT_TOP)
+ else if (self.spawnflags & SPAWNFLAG_FUNC_NEW_PLAT_START_AT_TOP)
{
self.cnt = 0;
self.think = func_new_plat_plat2_go_up;
self.nextthink = self.ltime + self.delay;
}
- self.SendFlags = BASE_FUNC_NET_SPEED |
- BASE_FUNC_NET_ORIGIN | BASE_FUNC_NET_VELOCITY;
+
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
};
//--------------------------------------------------------------
@@ -627,10 +619,11 @@ Set "sounds" to one of the following:
{
sound (self, CHAN_VOICE, self.noise, VOL_MHI, ATTN_NORM);
self.state = FUNC_STATE_DOWN;
- sub_calcmove (self, self.pos2, self.speed,
+
+ base_func_calcmove (self, self.pos2, self.speed,
func_new_plat_plat2_hit_bottom);
- self.SendFlags = BASE_FUNC_NET_SPEED |
- BASE_FUNC_NET_ORIGIN | BASE_FUNC_NET_VELOCITY;
+
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
};
//--------------------------------------------------------------
@@ -638,10 +631,11 @@ Set "sounds" to one of the following:
{
sound (self, CHAN_VOICE, self.noise, VOL_MHI, ATTN_NORM);
self.state = FUNC_STATE_UP;
- sub_calcmove (self, self.pos1, self.speed,
+
+ base_func_calcmove (self, self.pos1, self.speed,
func_new_plat_plat2_hit_top);
- self.SendFlags = BASE_FUNC_NET_SPEED |
- BASE_FUNC_NET_ORIGIN | BASE_FUNC_NET_VELOCITY;
+
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
};
//--------------------------------------------------------------
@@ -687,6 +681,14 @@ Set "sounds" to one of the following:
e.classtype = CT_FUNC_NEW_PLAT;
base_func_init (e);
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ setsize (e, e.mins, e.maxs);
+ setorigin (e, e.origin);
+ e.drawmask = DRAWMASK_NORMAL;
+ e.predraw = base_func_predraw;
+ #endif
+
#ifdef SSQC
local float negative_height = 0;
@@ -743,19 +745,13 @@ Set "sounds" to one of the following:
e.mangle = e.angles;
e.angles = '0 0 0';
- #endif
e.solid = SOLID_BSP;
e.movetype = MOVETYPE_PUSH;
setorigin (e, e.origin);
- #if defined(SSQC)
setmodel (e, e.model);
- #elif defined(CSQC)
- setmodelindex (e, e.modelindex);
- #endif
setsize (e, e.mins , e.maxs);
- #ifdef SSQC
if (!e.speed)
e.speed = 150;
@@ -780,7 +776,7 @@ Set "sounds" to one of the following:
e.pos2_z = e.origin_z - e.height;
}
- if (e.spawnflags & NEWPLAT_DN_N_WAIT)
+ if (e.spawnflags & SPAWNFLAG_FUNC_NEW_PLAT_DN_N_WAIT)
{
e.blocked = func_new_plat_downandwait_blocked;
e.use = func_new_plat_downandwait_use;
@@ -798,7 +794,7 @@ Set "sounds" to one of the following:
if (!e.health)
e.health = 5;
}
- else if (e.spawnflags & NEWPLAT_PLT_TOGGLE)
+ else if (e.spawnflags & SPAWNFLAG_FUNC_NEW_PLAT_PLT_TOGGLE)
{
e.blocked = func_new_plat_toggle_blocked;
e.use = func_new_plat_toggle_use;
@@ -813,7 +809,7 @@ Set "sounds" to one of the following:
e.state = FUNC_STATE_TOP;
}
}
- else if (e.spawnflags & NEWPLAT_ELEVATOR)
+ else if (e.spawnflags & SPAWNFLAG_FUNC_NEW_PLAT_ELEVATOR)
{
e.rad_time = 0;
@@ -822,7 +818,7 @@ Set "sounds" to one of the following:
if (e.wait < 0)
e.wait = 0;
- if (e.spawnflags & NEWPLAT_START_AT_TOP)
+ if (e.spawnflags & SPAWNFLAG_FUNC_NEW_PLAT_START_AT_TOP)
{
e.pos1 = e.origin;
e.pos2 = e.origin;
@@ -844,7 +840,7 @@ Set "sounds" to one of the following:
e.blocked = func_new_plat_elvtr_blocked;
e.use = func_new_plat_elvtr_use;
}
- else if (e.spawnflags & NEWPLAT_PLAT2)
+ else if (e.spawnflags & SPAWNFLAG_FUNC_NEW_PLAT_PLAT2)
{
e.cnt = 0;
e.invincible_time = 0;
@@ -861,13 +857,14 @@ Set "sounds" to one of the following:
e.state = FUNC_STATE_BOTTOM;
// make sure START_AT_TOP isn't set.
// We need that...
- e.spawnflags = NEWPLAT_PLAT2;
+ e.spawnflags = SPAWNFLAG_FUNC_NEW_PLAT_PLAT2;
setorigin (e, e.pos2);
}
else
{
// default position is top.
- e.spawnflags |= NEWPLAT_START_AT_TOP;
+ e.spawnflags |=
+ SPAWNFLAG_FUNC_NEW_PLAT_START_AT_TOP;
e.state = FUNC_STATE_TOP;
}
@@ -881,14 +878,10 @@ Set "sounds" to one of the following:
e.trigger_field = spawn_temp_new_plat_trigger (e);
}
- // e.SendEntity = base_func_netsend;
- e.SendFlags = BASE_FUNC_NET_ORIGIN | BASE_FUNC_NET_SIZE |
- BASE_FUNC_NET_MODEL | BASE_FUNC_NET_SPEED;
- #endif
-
- #ifdef CSQC
- e.drawmask = DRAWMASK_NORMAL;
- e.predraw = base_func_predraw_solidpush;
+ // send this entity to CSQC -- CEV
+ e.tick = base_func_neteval;
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
#endif
};
#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/func/particlefield.qc
diff --git a/qc/func/particlefield.qc b/qc/func/particlefield.qc
index 3e818c2..63cda11 100644
--- a/qc/func/particlefield.qc
+++ b/qc/func/particlefield.qc
@@ -13,8 +13,23 @@
//======================================================================
#ifdef SSQC
-// float PARTICLEFIELD_START_OFF = 1;
-const float PARTICLEFIELD_USE_COUNT = 1;
+//----------------------------------------------------------------------
+// func_particlefield spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ // SPAWNFLAG_FUNC_PARTICLEFIELD_START_OFF = 1
+ SPAWNFLAG_FUNC_PARTICLEFIELD_USE_COUNT = 1
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} func_particlefield_spawnflags;
#endif
//======================================================================
@@ -55,8 +70,8 @@ to trigger.
//--------------------------------------------------------------
void() func_particlefield_xz =
{
- if ((self.spawnflags & PARTICLEFIELD_USE_COUNT) &&
- (func_counter_getcount(other) != self.cnt))
+ if (self.spawnflags & SPAWNFLAG_FUNC_PARTICLEFIELD_USE_COUNT &&
+ func_counter_getcount(other) != self.cnt)
{
return;
}
@@ -100,8 +115,8 @@ to trigger.
//--------------------------------------------------------------
void() func_particlefield_yz =
{
- if ((self.spawnflags & PARTICLEFIELD_USE_COUNT) &&
- (func_counter_getcount(other) != self.cnt))
+ if (self.spawnflags & SPAWNFLAG_FUNC_PARTICLEFIELD_USE_COUNT &&
+ func_counter_getcount(other) != self.cnt)
{
return;
}
@@ -146,8 +161,8 @@ to trigger.
//--------------------------------------------------------------
void() func_particlefield_xy =
{
- if ((self.spawnflags & PARTICLEFIELD_USE_COUNT) &&
- (func_counter_getcount(other) != self.cnt))
+ if (self.spawnflags & SPAWNFLAG_FUNC_PARTICLEFIELD_USE_COUNT &&
+ func_counter_getcount(other) != self.cnt)
{
return;
}
Return to the top of this page or return to the overview of this repo.
Diff qc/func/plat.qc
diff --git a/qc/func/plat.qc b/qc/func/plat.qc
index c74f4dc..351e332 100644
--- a/qc/func/plat.qc
+++ b/qc/func/plat.qc
@@ -7,7 +7,22 @@
//======================================================================
#ifdef SSQC
-const float PLAT_LOW_TRIGGER = 1;
+//----------------------------------------------------------------------
+// func_plat spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_FUNC_PLAT_LOW_TRIGGER = 1
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} func_plat_spawnflags;
#endif
//======================================================================
@@ -93,7 +108,7 @@ void() func_plat;
local vector tmin = e.owner.mins + '25 25 0';
local vector tmax = e.owner.maxs - '25 25 -8';
tmin_z = tmax_z - (e.owner.pos1_z - e.owner.pos2_z + 8);
- if (e.owner.spawnflags & PLAT_LOW_TRIGGER)
+ if (e.owner.spawnflags & SPAWNFLAG_FUNC_PLAT_LOW_TRIGGER)
tmax_z = tmin_z + 8;
if (e.owner.size_x <= 50)
@@ -139,39 +154,11 @@ Set "sounds" to one of the following:
//--------------------------------------------------------------
void(float isnew) func_plat_netreceive =
{
- local float netflags = ReadFloat ();
- base_func_netreceive_read (isnew, netflags);
+ // creates the netflag variable -- CEV
+ BASE_FUNC_NETRECEIVE (func_plat_init)
if (isnew)
- func_plat_init (self);
-
- if (netflags & BASE_FUNC_NET_VELOCITY)
- {
- if (self.velocity != self.velocity_net)
- {
- if (self.velocity)
- {
- self.origin_start = self.origin;
- self.movetime = time;
- }
- else
- {
- self.movetime = 0;
- }
- }
- }
-
- self.origin_net = self.origin;
- self.velocity_net = self.velocity;
-
- if (netflags & BASE_FUNC_NET_MODEL)
- setmodelindex (self, self.modelindex);
-
- if (netflags & BASE_FUNC_NET_SIZE)
- setsize (self, self.mins, self.maxs);
-
- if (netflags & BASE_FUNC_NET_ORIGIN)
- setorigin (self, self.origin);
+ base_entity_que_add (self, QUE_TYPE_ACTOR);
};
#endif
@@ -184,8 +171,8 @@ Set "sounds" to one of the following:
sound (self, CHAN_VOICE, self.noise1, VOL_MHI, ATTN_NORM);
self.think = func_plat_go_down;
self.nextthink = self.ltime + 3;
- self.SendFlags = BASE_FUNC_NET_SPEED |
- BASE_FUNC_NET_ORIGIN | BASE_FUNC_NET_VELOCITY;
+
+ self.SendFlags = NETFLAG_BASE_ENTITY_ORIGIN;
};
//--------------------------------------------------------------
@@ -194,31 +181,30 @@ Set "sounds" to one of the following:
self.state = FUNC_STATE_BOTTOM;
sound (self, CHAN_VOICE, self.noise1, VOL_MHI, ATTN_NORM);
- self.SendFlags = BASE_FUNC_NET_SPEED |
- BASE_FUNC_NET_ORIGIN | BASE_FUNC_NET_VELOCITY;
+
+ self.SendFlags = NETFLAG_BASE_ENTITY_ORIGIN;
};
//--------------------------------------------------------------
void() func_plat_go_down =
{
self.state = FUNC_STATE_DOWN;
- sub_calcmove (self, self.pos2, self.speed,
+ base_func_calcmove (self, self.pos2, self.speed,
func_plat_hit_bottom);
sound (self, CHAN_VOICE, self.noise, VOL_MHI, ATTN_NORM);
- self.SendFlags = BASE_FUNC_NET_SPEED |
- BASE_FUNC_NET_ORIGIN | BASE_FUNC_NET_VELOCITY;
+ self.SendFlags = NETFLAG_BASE_ENTITY_ORIGIN;
};
//--------------------------------------------------------------
void() func_plat_go_up =
{
self.state = FUNC_STATE_UP;
- sub_calcmove (self, self.pos1, self.speed, func_plat_hit_top);
+ base_func_calcmove (self, self.pos1, self.speed,
+ func_plat_hit_top);
sound (self, CHAN_VOICE, self.noise, VOL_MHI, ATTN_NORM);
- self.SendFlags = BASE_FUNC_NET_SPEED |
- BASE_FUNC_NET_ORIGIN | BASE_FUNC_NET_VELOCITY;
+ self.SendFlags = NETFLAG_BASE_ENTITY_ORIGIN;
};
//--------------------------------------------------------------
@@ -279,6 +265,14 @@ Set "sounds" to one of the following:
e.classtype = CT_FUNC_PLAT;
base_func_init (e);
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ setsize (e, e.mins, e.maxs);
+ setorigin (e, e.origin);
+ e.drawmask = DRAWMASK_NORMAL;
+ e.predraw = base_func_predraw;
+ #endif
+
#ifdef SSQC
if (!e.t_length)
e.t_length = 80;
@@ -307,23 +301,15 @@ Set "sounds" to one of the following:
e.mangle = e.angles;
e.angles = '0 0 0';
- #endif
// SOLID_BSP and MOVETYPE_PUSH on both client and server -- CEV
e.solid = SOLID_BSP;
e.movetype = MOVETYPE_PUSH;
setorigin (e, e.origin);
- #if defined(SSQC)
setmodel (e, e.model);
- #elif defined(CSQC)
- self.oldorigin = self.origin;
- setmodelindex (e, e.modelindex);
- #endif
-
setsize (e, e.mins, e.maxs);
- #ifdef SSQC
e.blocked = func_plat_blocked;
e.use = func_plat_use;
@@ -354,15 +340,11 @@ Set "sounds" to one of the following:
e.state = FUNC_STATE_BOTTOM;
}
- // network func_plat to the CSQC client -- CEV
- // e.SendEntity = base_func_netsend;
- e.SendFlags = BASE_FUNC_NET_ORIGIN | BASE_FUNC_NET_SIZE |
- BASE_FUNC_NET_MODEL | BASE_FUNC_NET_SPEED;
- #endif
- #ifdef CSQC
- e.drawmask = DRAWMASK_NORMAL;
- e.predraw = base_func_predraw_solidpush;
+ // network func_plat to the CSQC client -- CEV
+ e.tick = base_func_neteval;
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
#endif
};
#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/func/rotate.qc
diff --git a/qc/func/rotate.qc b/qc/func/rotate.qc
index f7526d1..8cee085 100644
--- a/qc/func/rotate.qc
+++ b/qc/func/rotate.qc
@@ -15,41 +15,150 @@
//======================================================================
#ifdef SSQC
-const float ROTATE_STATE_ACTIVE = 0;
-const float ROTATE_STATE_INACTIVE = 1;
-const float ROTATE_STATE_SPEEDINGUP = 2;
-const float ROTATE_STATE_SLOWINGDOWN = 3;
-const float ROTATE_STATE_CLOSED = 4;
-const float ROTATE_STATE_OPEN = 5;
-const float ROTATE_STATE_OPENING = 6;
-const float ROTATE_STATE_CLOSING = 7;
-
-const float ROTATE_STATE_WAIT = 0;
-const float ROTATE_STATE_MOVE = 1;
-const float ROTATE_STATE_STOP = 2;
-const float ROTATE_STATE_FIND = 3;
-const float ROTATE_STATE_NEXT = 4;
-
-const float ROTATE_OBJECT_ROTATE = 0;
-const float ROTATE_OBJECT_MOVEWALL = 1;
-const float ROTATE_OBJECT_SETORIGIN = 2;
-
-const float ROTATE_ENTITY_TOGGLE = 1; // spawnflags for func_rotate_entity
-const float ROTATE_ENTITY_START_ON = 2;
-
-const float PATH_ROTATE_ROTATION = 1; // spawnflags for path_rotate
-const float PATH_ROTATE_ANGLES = 2;
-const float PATH_ROTATE_STOP = 4;
-const float PATH_ROTATE_NO_ROTATE = 8;
-const float PATH_ROTATE_DAMAGE = 16;
-const float PATH_ROTATE_MOVETIME = 32;
-const float PATH_ROTATE_SET_DAMAGE = 64;
-
-const float ROTATE_DOOR_STAYOPEN = 1; // spawnflags for func_rotate_door
-
-const float MOVEWALL_VISIBLE = 1; // spawnflags for func_movewall
-const float MOVEWALL_TOUCH = 2;
-const float MOVEWALL_NONBLOCKING = 4;
+//----------------------------------------------------------------------
+// func_rotate_entity spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_FUNC_ROTATE_ENTITY_TOGGLE = 1,
+ SPAWNFLAG_FUNC_ROTATE_ENTITY_START_ON = 2
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} func_rotate_entity_spawnflags;
+
+//----------------------------------------------------------------------
+// path_rotate spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_PATH_ROTATE_ROTATION = 1, // spawnflags for path_rotate
+ SPAWNFLAG_PATH_ROTATE_ANGLES = 2,
+ SPAWNFLAG_PATH_ROTATE_STOP = 4,
+ SPAWNFLAG_PATH_ROTATE_NO_ROTATE = 8,
+ SPAWNFLAG_PATH_ROTATE_DAMAGE = 16,
+ SPAWNFLAG_PATH_ROTATE_MOVETIME = 32,
+ SPAWNFLAG_PATH_ROTATE_SET_DAMAGE = 64
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 1048576, // see base_entities.qc -- CEV
+} path_rotate_spawnflags;
+
+//----------------------------------------------------------------------
+// func_rotate_door spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_FUNC_ROTATE_DOOR_STAYOPEN = 1
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 1048576, // see base_entities.qc -- CEV
+} func_rotate_door_spawnflags;
+
+//----------------------------------------------------------------------
+// func_movewall spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_FUNC_MOVEWALL_VISIBLE = 1,
+ SPAWNFLAG_FUNC_MOVEWALL_TOUCH = 2,
+ SPAWNFLAG_FUNC_MOVEWALL_NONBLOCKING = 4
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 1048576, // see base_entities.qc -- CEV
+} func_movewall_spawnflags;
+
+//----------------------------------------------------------------------
+// rotate_object_continuously (MG1) spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_ROTATE_OBJECT_CONTINUOUSLY_START_OFF = 1,
+ SPAWNFLAG_ROTATE_OBJECT_CONTINUOUSLY_SOLID_BSP = 4
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 1048576, // see base_entities.qc -- CEV
+} rotate_object_continuously_spawnflags;
+#endif
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// base rotation states -- CEV
+//----------------------------------------------------------------------
+typedef enum
+{
+ ROTATE_STATE_ACTIVE = 0,
+ ROTATE_STATE_INACTIVE = 1,
+ ROTATE_STATE_SPEEDINGUP = 2,
+ ROTATE_STATE_SLOWINGDOWN = 3,
+ ROTATE_STATE_CLOSED = 4,
+ ROTATE_STATE_OPEN = 5,
+ ROTATE_STATE_OPENING = 6,
+ ROTATE_STATE_CLOSING = 7
+} base_rotate_states;
+
+//----------------------------------------------------------------------
+// train rotation states -- CEV
+//----------------------------------------------------------------------
+typedef enum
+{
+ ROTATE_TRAIN_STATE_WAIT = 0,
+ ROTATE_TRAIN_STATE_MOVE = 1,
+ ROTATE_TRAIN_STATE_STOP = 2,
+ ROTATE_TRAIN_STATE_FIND = 3,
+ ROTATE_TRAIN_STATE_NEXT = 4
+} func_rotate_train_states;
+
+//----------------------------------------------------------------------
+// base rotate object states -- CEV
+//----------------------------------------------------------------------
+typedef enum
+{
+ ROTATE_OBJECT_ROTATE = 0,
+ ROTATE_OBJECT_MOVEWALL = 1,
+ ROTATE_OBJECT_SETORIGIN = 2
+} base_rotate_object_states;
+
+//----------------------------------------------------------------------
+// MG1 continuous rotation states -- CEV
+//----------------------------------------------------------------------
+typedef enum
+{
+ MG1_ROTATE_STATE_OFF,
+ MG1_ROTATE_STATE_ACCEL_UP,
+ MG1_ROTATE_STATE_ON,
+ MG1_ROTATE_STATE_DECEL_DOWN
+} base_rotate_mg1_states;
#endif
//======================================================================
@@ -88,18 +197,49 @@ void(entity e) base_rotate_init;
strip void() base_rotate;
#endif
+// rotate_object_continuously
#ifdef SSQC
+// ROTATE_OBJECT_CONTINUOUSLY_MODANGLES(veca)
+#endif
+#ifdef CSQC
+void(float isnew) rotate_object_continuously_netreceive;
+#endif
+#ifdef SSQC
+void() rotate_object_continuously_tick;
+void() rotate_object_continuously_tween_tick;
+void() rotate_object_continuously_use;
+#endif
+#if defined(CSQC) || defined(SSQC)
+void(entity e) rotate_object_continuously_init;
+#endif
+#ifdef SSQC
+void() rotate_object_continuously;
+#endif
+
// rotate_object
-void(entity e) rotate_object_init
+#ifdef CSQC
+void(float isnew) rotate_object_netreceive;
+#endif
+#if defined(CSQC) || defined(SSQC)
+void(entity e) rotate_object_init;
+#endif
+#ifdef SSQC
void() rotate_object;
#endif
-#ifdef SSQC
// func_rotate_entity
+#ifdef CSQC
+void(float isnew) func_rotate_entity_netreceive;
+#endif
+#ifdef SSQC
void() func_rotate_entity_firstthink;
void() func_rotate_entity_think;
void() func_rotate_entity_use;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) func_rotate_entity_init;
+#endif
+#ifdef SSQC
void() func_rotate_entity;
#endif
@@ -109,15 +249,22 @@ void(entity e) path_rotate_init;
void() path_rotate;
#endif
-#ifdef SSQC
// func_rotate_train
+#ifdef CSQC
+void(float isnew) func_rotate_train_netreceive;
+#endif
+#ifdef SSQC
void() func_rotate_train_think_wait;
void() func_rotate_train_think_stop;
void() func_rotate_train_think_next;
void() func_rotate_train_think_find;
void() func_rotate_train_think;
void() func_rotate_train_use;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) func_rotate_train_init;
+#endif
+#ifdef SSQC
void() func_rotate_train;
#endif
@@ -142,14 +289,21 @@ void(entity e) func_movewall_init;
void() func_movewall;
#endif
-#ifdef SSQC
// func_rotate_door
+#ifdef CSQC
+void(float isnew) func_rotate_door_netreceive;
+#endif
+#ifdef SSQC
void() func_rotate_door_reversedirection;
void() func_rotate_door_group_reversedirection;
void() func_rotate_door_think;
void() func_rotate_door_think2;
void() func_rotate_door_use;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) func_rotate_door_init;
+#endif
+#ifdef SSQC
void() func_rotate_door;
#endif
@@ -233,12 +387,11 @@ void() func_rotate_door;
e.neworigin = self.origin - self.oldorigin +
(e.neworigin - e.oldorigin);
e.velocity = (e.neworigin - e.origin) * 25;
-
- if (e.rotate_type == ROTATE_OBJECT_MOVEWALL)
- e.SendFlags |= BASE_FUNC_NET_SPEED |
- BASE_FUNC_NET_ORIGIN |
- BASE_FUNC_NET_VELOCITY;
}
+
+ e.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_ANGLES;
+
e = find (e, targetname, self.target);
}
};
@@ -267,11 +420,8 @@ void() func_rotate_door;
if (e.rotate_type == ROTATE_OBJECT_ROTATE)
e.angles = self.angles;
- if (e.rotate_type == ROTATE_OBJECT_MOVEWALL)
- e.SendFlags |= BASE_FUNC_NET_SPEED |
- BASE_FUNC_NET_ORIGIN |
- BASE_FUNC_NET_VELOCITY;
-
+ e.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_ANGLES;
e = find (e, targetname, self.target);
}
@@ -300,15 +450,14 @@ void() func_rotate_door;
{
setorigin (e, self.origin - self.oldorigin +
(e.neworigin - e.oldorigin));
- e.SendFlags |= BASE_FUNC_NET_SPEED |
- BASE_FUNC_NET_ORIGIN |
- BASE_FUNC_NET_VELOCITY;
}
else
{
setorigin (e, e.neworigin + self.origin);
}
+ e.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
+
e = find (e, targetname, self.target);
}
};
@@ -352,6 +501,7 @@ void() func_rotate_door;
"targetname %s\n",
e.classname, e.targetname));
}
+
e = find (e, targetname, self.target);
}
};
@@ -394,13 +544,230 @@ void() func_rotate_door;
#endif
// };
+/*QUAKED rotate_object_continuously (0.4 1.0 0.6) (? ? ?) (? ? ?) MG1_ROTATE_START_OFF
+Non-solid object that rotates continuously.
+Trigger to turn on and off.
+*/
+//----------------------------------------------------------------------
+// class rotate_object_continuously: base_rotate
+// {
+#ifdef SSQC
+ //--------------------------------------------------------------
+ #define ROTATE_OBJECT_CONTINUOUSLY_MODANGLES(veca) \
+ { \
+ while (veca.x > 360) \
+ veca.x -= 360; \
+ while (veca.x < 0) \
+ veca.x += 360; \
+ while (veca.y > 360) \
+ veca.y -= 360; \
+ while (veca.y < 0) \
+ veca.y += 360; \
+ while (veca.z > 360) \
+ veca.z -= 360; \
+ while (veca.z < 0) \
+ veca.z += 360; \
+ }
+#endif
+
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) rotate_object_continuously_netreceive =
+ {
+ // creates the netflag variable -- CEV
+ BASE_FUNC_NETRECEIVE (rotate_object_continuously_init)
+
+ if (isnew)
+ base_entity_que_add (self, QUE_TYPE_ACTOR);
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ void() rotate_object_continuously_tick =
+ {
+ self.angles = self.angles + self.avelocity * server_deltatime;
+
+ ROTATE_OBJECT_CONTINUOUSLY_MODANGLES (self.angles)
+
+ if (self.angles != self.angles_net)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ANGLES;
+ };
+
+ //--------------------------------------------------------------
+ void() rotate_object_continuously_tween_tick =
+ {
+ self.speed += self.distance * server_deltatime;
+ self.speed = bound (0, self.speed, 1);
+ if (self.speed == 0)
+ {
+ self.state = MG1_ROTATE_STATE_OFF;
+ self.classgroup &= ~CG_FRAMETICK;
+ return;
+ }
+ if (self.speed == 1)
+ {
+ self.state = MG1_ROTATE_STATE_ON;
+ self.tick = rotate_object_continuously_tick;
+ self.tick ();
+ return;
+ }
+
+ self.angles = self.angles + self.avelocity *
+ server_deltatime * self.speed;
+
+ ROTATE_OBJECT_CONTINUOUSLY_MODANGLES (self.angles)
+
+ if (self.angles != self.angles_net)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ANGLES;
+ };
+
+ //--------------------------------------------------------------
+ void() rotate_object_continuously_use =
+ {
+ if (self.delay <= 0)
+ {
+ // No acceleration, just toggle on or off
+ if (self.state == MG1_ROTATE_STATE_OFF)
+ {
+ self.state = MG1_ROTATE_STATE_ON;
+ self.classgroup |= CG_FRAMETICK;
+ }
+ else
+ {
+ self.state = MG1_ROTATE_STATE_OFF;
+ self.classgroup &= ~CG_FRAMETICK;
+ }
+ return;
+ }
+
+ switch (self.state)
+ {
+ case MG1_ROTATE_STATE_OFF:
+ self.state = MG1_ROTATE_STATE_ACCEL_UP;
+ self.tick =
+ rotate_object_continuously_tween_tick;
+ self.distance = fabs (self.distance);
+ self.classgroup |= CG_FRAMETICK;
+ return;
+ case MG1_ROTATE_STATE_ACCEL_UP:
+ self.state = MG1_ROTATE_STATE_DECEL_DOWN;
+ self.tick =
+ rotate_object_continuously_tween_tick;
+ self.distance = -fabs (self.distance);
+ return;
+ case MG1_ROTATE_STATE_ON:
+ self.state = MG1_ROTATE_STATE_DECEL_DOWN;
+ self.tick =
+ rotate_object_continuously_tween_tick;
+ self.distance = -fabs (self.distance);
+ return;
+ case MG1_ROTATE_STATE_DECEL_DOWN:
+ self.state = MG1_ROTATE_STATE_ACCEL_UP;
+ self.tick =
+ rotate_object_continuously_tween_tick;
+ self.distance = fabs (self.distance);
+ return;
+ }
+ };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+ //--------------------------------------------------------------
+ void(entity e) rotate_object_continuously_init =
+ {
+ e.classname = "rotate_object_continuously";
+ e.classtype = CT_MISC_ROTATE_OBJECT_CONTINUOUSLY;
+
+ base_rotate_init (e);
+
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ setsize (e, e.mins, e.maxs);
+ setorigin (e, e.origin);
+ e.drawmask = DRAWMASK_NORMAL;
+ e.predraw = base_func_predraw;
+ #endif
+
+ #ifdef SSQC
+ if (!e.avelocity)
+ e.avelocity = '0 30 0';
+
+ if (e.delay > 0)
+ e.distance = 1 / e.delay;
+
+ if (e.spawnflags &
+ SPAWNFLAG_ROTATE_OBJECT_CONTINUOUSLY_SOLID_BSP)
+ {
+ e.movetype = MOVETYPE_PUSH;
+ e.solid = SOLID_BSP;
+ }
+ else
+ {
+ e.movetype = MOVETYPE_NONE;
+ e.solid = SOLID_NOT;
+ }
+
+ e.angles = '0 0 0';
+
+ if (e.pos2)
+ {
+ e.origin = e.pos2;
+ setorigin (e, e.origin);
+ }
+
+ setmodel (e, e.model);
+
+ e.use = rotate_object_continuously_use;
+ e.tick = rotate_object_continuously_tick;
+
+ if (e.spawnflags &
+ SPAWNFLAG_ROTATE_OBJECT_CONTINUOUSLY_START_OFF)
+ {
+ e.state = MG1_ROTATE_STATE_OFF;
+ }
+ else
+ {
+ e.state = MG1_ROTATE_STATE_ON;
+ e.speed = 1;
+ self.classgroup |= CG_FRAMETICK;
+ }
+
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+ #endif
+ };
+#endif
+
#ifdef SSQC
+ //--------------------------------------------------------------
+ void() rotate_object_continuously =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ rotate_object_continuously_init (self);
+ };
+#endif
+// };
+
/*QUAKED rotate_object (0 .5 .8) ? X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
This defines an object to be rotated. Used as the target of func_rotate_door.
*/
//----------------------------------------------------------------------
// class rotate_object: base_rotate
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) rotate_object_netreceive =
+ {
+ // creates the netflag variable -- CEV
+ BASE_FUNC_NETRECEIVE (rotate_object_init)
+ }
+#endif
+
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) rotate_object_init =
{
@@ -409,13 +776,28 @@ This defines an object to be rotated. Used as the target of func_rotate_door.
base_rotate_init (e);
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ setsize (e, e.mins, e.maxs);
+ setorigin (e, e.origin);
+ e.drawmask = DRAWMASK_NORMAL;
+ e.predraw = base_func_predraw;
+ #if 0
+ dprint (sprintf("rotate_object_init: CSQC entnum %g\n",
+ e.entnum));
+ #endif
+ #endif
+
+ #ifdef SSQC
e.solid = SOLID_NOT;
e.movetype = MOVETYPE_NONE;
setmodel (e, e.model);
setsize (e, e.mins, e.maxs);
- // e.think = sub_null;
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() rotate_object =
{
@@ -425,14 +807,13 @@ This defines an object to be rotated. Used as the target of func_rotate_door.
rotate_object_init (self);
};
-// };
#endif
+// };
//----------------------------------------------------------------------
// Simple continual rotatation
//----------------------------------------------------------------------
-#ifdef SSQC
/*QUAKED func_rotate_entity (0 .5 .8) (-8 -8 -8) (8 8 8) TOGGLE START_ON X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Creates an entity that continually rotates. Can be toggled on and
@@ -451,12 +832,22 @@ If "deathtype" is set with a string, this is the message that will appear when a
//----------------------------------------------------------------------
// class func_rotate_entity: base_rotate
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) func_rotate_entity_netreceive =
+ {
+ // creates the netflag variable -- CEV
+ BASE_FUNC_NETRECEIVE (func_rotate_entity_init)
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
void() func_rotate_entity_firstthink =
{
base_rotate_link_targets ();
- if (self.spawnflags & ROTATE_ENTITY_START_ON)
+ if (self.spawnflags & SPAWNFLAG_FUNC_ROTATE_ENTITY_START_ON)
{
self.state = ROTATE_STATE_ACTIVE;
self.think = func_rotate_entity_think;
@@ -506,6 +897,9 @@ If "deathtype" is set with a string, this is the message that will appear when a
self.angles = self.angles + (self.rotate * t);
self.angles = base_rotate_normalizeangles (self.angles);
+
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ANGLES;
+
base_rotate_targets ();
self.nextthink = time + 0.02;
};
@@ -515,10 +909,12 @@ If "deathtype" is set with a string, this is the message that will appear when a
{
// change to alternate textures
self.frame = 1 - self.frame;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
if (self.state == ROTATE_STATE_ACTIVE)
{
- if (self.spawnflags & ROTATE_ENTITY_TOGGLE)
+ if (self.spawnflags &
+ SPAWNFLAG_FUNC_ROTATE_ENTITY_TOGGLE)
{
if (self.speed)
{
@@ -549,7 +945,8 @@ If "deathtype" is set with a string, this is the message that will appear when a
}
else if (self.state == ROTATE_STATE_SPEEDINGUP)
{
- if (self.spawnflags & ROTATE_ENTITY_TOGGLE)
+ if (self.spawnflags &
+ SPAWNFLAG_FUNC_ROTATE_ENTITY_TOGGLE)
{
self.state = ROTATE_STATE_SLOWINGDOWN;
}
@@ -559,7 +956,9 @@ If "deathtype" is set with a string, this is the message that will appear when a
self.state = ROTATE_STATE_SPEEDINGUP;
}
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) func_rotate_entity_init =
{
@@ -568,6 +967,15 @@ If "deathtype" is set with a string, this is the message that will appear when a
base_rotate_init (e);
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ setsize (e, e.mins, e.maxs);
+ setorigin (e, e.origin);
+ e.drawmask = DRAWMASK_NORMAL;
+ e.predraw = base_func_predraw;
+ #endif
+
+ #ifdef SSQC
e.solid = SOLID_NOT;
e.movetype = MOVETYPE_NONE;
@@ -577,11 +985,18 @@ If "deathtype" is set with a string, this is the message that will appear when a
if (e.speed != 0)
e.cnt = 1 / e.speed;
+ e.tick = base_func_neteval;
e.think = func_rotate_entity_firstthink;
e.nextthink = time + 0.1;
e.ltime = time;
+
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() func_rotate_entity =
{
@@ -591,8 +1006,8 @@ If "deathtype" is set with a string, this is the message that will appear when a
func_rotate_entity_init (self);
};
-// };
#endif
+// };
//----------------------------------------------------------------------
// Train with rotation functionality
@@ -649,7 +1064,6 @@ If "deathtype" is set with a string, this is the message that will appear when a
// };
#endif
-#ifdef SSQC
/*QUAKED func_rotate_train (0 .5 .8) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
In path_rotate, set speed to be the new speed of the train after it reaches
@@ -681,10 +1095,20 @@ sounds
//----------------------------------------------------------------------
// class func_rotate_train: base_rotate
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) func_rotate_train_netreceive =
+ {
+ // creates the netflag variable -- CEV
+ BASE_FUNC_NETRECEIVE (func_rotate_train_init)
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
void() func_rotate_train_think_wait =
{
- self.state = ROTATE_STATE_WAIT;
+ self.state = ROTATE_TRAIN_STATE_WAIT;
if (self.goalentity.noise != "")
sound (self, CHAN_VOICE, self.goalentity.noise,
@@ -693,14 +1117,18 @@ sounds
sound (self, CHAN_VOICE, self.noise,
VOL_MHI, ATTN_NORM);
- if (self.goalentity.spawnflags & PATH_ROTATE_ANGLES)
+ if (self.goalentity.spawnflags & SPAWNFLAG_PATH_ROTATE_ANGLES)
{
self.rotate = '0 0 0';
self.angles = self.finalangle;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ANGLES;
}
- if (self.goalentity.spawnflags & PATH_ROTATE_NO_ROTATE)
+ if (self.goalentity.spawnflags &
+ SPAWNFLAG_PATH_ROTATE_NO_ROTATE)
+ {
self.rotate = '0 0 0';
+ }
self.endtime = self.ltime + self.goalentity.wait;
self.think1 = func_rotate_train_think_next;
@@ -709,7 +1137,7 @@ sounds
//--------------------------------------------------------------
void() func_rotate_train_think_stop =
{
- self.state = ROTATE_STATE_STOP;
+ self.state = ROTATE_TRAIN_STATE_STOP;
if (self.goalentity.noise != "")
sound (self, CHAN_VOICE, self.goalentity.noise,
@@ -718,14 +1146,18 @@ sounds
sound (self, CHAN_VOICE, self.noise,
VOL_MHI, ATTN_NORM);
- if (self.goalentity.spawnflags & PATH_ROTATE_ANGLES)
+ if (self.goalentity.spawnflags & SPAWNFLAG_PATH_ROTATE_ANGLES)
{
self.rotate = '0 0 0';
self.angles = self.finalangle;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ANGLES;
}
- if (self.goalentity.spawnflags & PATH_ROTATE_NO_ROTATE)
+ if (self.goalentity.spawnflags &
+ SPAWNFLAG_PATH_ROTATE_NO_ROTATE)
+ {
self.rotate = '0 0 0';
+ }
self.dmg = 0;
self.think1 = func_rotate_train_think_next;
@@ -740,7 +1172,7 @@ sounds
local float len, traveltime, div;
local string temp;
- self.state = ROTATE_STATE_NEXT;
+ self.state = ROTATE_TRAIN_STATE_NEXT;
current = self.goalentity;
targ = find (world, targetname, self.path);
@@ -758,7 +1190,7 @@ sounds
objerror ("func_rotate_train_think_next: "
"no next target!\n");
- if (targ.spawnflags & PATH_ROTATE_STOP)
+ if (targ.spawnflags & SPAWNFLAG_PATH_ROTATE_STOP)
self.think1 = func_rotate_train_think_stop;
else if (targ.wait)
self.think1 = func_rotate_train_think_wait;
@@ -776,23 +1208,24 @@ sounds
self.message = __NULL__;
}
- if (current.spawnflags & PATH_ROTATE_ANGLES)
+ if (current.spawnflags & SPAWNFLAG_PATH_ROTATE_ANGLES)
{
self.rotate = '0 0 0';
self.angles = self.finalangle;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ANGLES;
}
- if (current.spawnflags & PATH_ROTATE_ROTATION)
+ if (current.spawnflags & SPAWNFLAG_PATH_ROTATE_ROTATION)
{
self.rotate = current.rotate;
}
- if (current.spawnflags & PATH_ROTATE_DAMAGE)
+ if (current.spawnflags & SPAWNFLAG_PATH_ROTATE_DAMAGE)
{
self.dmg = current.dmg;
}
- if (current.spawnflags & PATH_ROTATE_SET_DAMAGE)
+ if (current.spawnflags & SPAWNFLAG_PATH_ROTATE_SET_DAMAGE)
{
base_rotate_set_damage_on_targets (current.dmg);
}
@@ -804,7 +1237,7 @@ sounds
self.endtime = self.ltime + 0.01;
base_rotate_set_target_origin ();
- if (targ.spawnflags & PATH_ROTATE_ANGLES)
+ if (targ.spawnflags & SPAWNFLAG_PATH_ROTATE_ANGLES)
self.angles = targ.angles;
self.duration = 1; // 1 / duration
@@ -812,10 +1245,13 @@ sounds
self.pos2 = '0 0 0'; // delta
self.pos1 = self.origin; // original position
self.finaldest = self.origin;
+
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_ANGLES;
}
else
{
- self.state = ROTATE_STATE_MOVE;
+ self.state = ROTATE_TRAIN_STATE_MOVE;
self.finaldest = targ.origin;
if (self.finaldest == self.origin)
@@ -837,7 +1273,7 @@ sounds
// calculate length of vector
len = vlen (vdestdelta);
- if (current.spawnflags & PATH_ROTATE_MOVETIME)
+ if (current.spawnflags & SPAWNFLAG_PATH_ROTATE_MOVETIME)
{
traveltime = current.speed;
}
@@ -859,15 +1295,20 @@ sounds
{
self.velocity = '0 0 0';
self.endtime = self.ltime + 0.1;
- if (targ.spawnflags & PATH_ROTATE_ANGLES)
+ if (targ.spawnflags &
+ SPAWNFLAG_PATH_ROTATE_ANGLES)
+ {
self.angles = targ.angles;
+ self.SendFlags |=
+ NETFLAG_BASE_ENTITY_ANGLES;
+ }
return;
}
// qcc won't take vec/float
div = 1 / traveltime;
- if (targ.spawnflags & PATH_ROTATE_ANGLES)
+ if (targ.spawnflags & SPAWNFLAG_PATH_ROTATE_ANGLES)
{
self.finalangle = base_rotate_normalizeangles (
targ.angles);
@@ -893,7 +1334,7 @@ sounds
{
local entity targ;
- self.state = ROTATE_STATE_FIND;
+ self.state = ROTATE_TRAIN_STATE_FIND;
base_rotate_link_targets ();
@@ -907,7 +1348,7 @@ sounds
// Save the current entity
self.goalentity = targ;
- if (targ.spawnflags & PATH_ROTATE_ANGLES)
+ if (targ.spawnflags & SPAWNFLAG_PATH_ROTATE_ANGLES)
{
self.angles = targ.angles;
self.finalangle = base_rotate_normalizeangles (
@@ -945,7 +1386,7 @@ sounds
if ((self.endtime) && (time >= self.endtime))
{
self.endtime = 0;
- if (self.state == ROTATE_STATE_MOVE)
+ if (self.state == ROTATE_TRAIN_STATE_MOVE)
{
setorigin (self, self.finaldest);
self.velocity = '0 0 0';
@@ -966,6 +1407,9 @@ sounds
self.angles = base_rotate_normalizeangles (self.angles);
base_rotate_targets ();
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_ANGLES;
+
self.nextthink = time + 0.02;
};
@@ -982,7 +1426,9 @@ sounds
self.think1 ();
}
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) func_rotate_train_init =
{
@@ -991,6 +1437,15 @@ sounds
base_rotate_init (e);
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ setsize (e, e.mins, e.maxs);
+ setorigin (e, e.origin);
+ e.drawmask = DRAWMASK_NORMAL;
+ e.predraw = base_func_predraw;
+ #endif
+
+ #ifdef SSQC
if (!e.speed)
e.speed = 100;
if (!e.target)
@@ -1033,7 +1488,7 @@ sounds
e.endtime = e.ltime + 0.1;
e.think = func_rotate_train_think;
e.think1 = func_rotate_train_think_find;
- e.state = ROTATE_STATE_FIND;
+ e.state = ROTATE_TRAIN_STATE_FIND;
e.duration = 1; // 1 / duration
e.cnt = 0.1; // start time
@@ -1041,8 +1496,15 @@ sounds
e.pos1 = e.origin; // original position
e.flags |= FL_ONGROUND;
+
+ e.tick = base_func_neteval;
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() func_rotate_train =
{
@@ -1052,8 +1514,8 @@ sounds
func_rotate_train_init (self);
};
-// };
#endif
+// };
#ifdef SSQC
//----------------------------------------------------------------------
@@ -1087,39 +1549,11 @@ NONBLOCKING makes the brush non-solid. This is useless if VISIBLE is set.
//--------------------------------------------------------------
void(float isnew) func_movewall_netreceive =
{
- local float netflags = ReadFloat ();
- base_func_netreceive_read (isnew, netflags);
+ // creates the netflag variable -- CEV
+ BASE_FUNC_NETRECEIVE (func_movewall_init)
if (isnew)
- func_movewall_init (self);
-
- if (netflags & BASE_FUNC_NET_VELOCITY)
- {
- if (self.velocity != self.velocity_net)
- {
- if (self.velocity)
- {
- self.origin_start = self.origin;
- self.movetime = time;
- }
- else
- {
- self.movetime = 0;
- }
- }
- }
-
- self.origin_net = self.origin;
- self.velocity_net = self.velocity;
-
- if (netflags & BASE_FUNC_NET_MODEL)
- setmodelindex (self, self.modelindex);
-
- if (netflags & BASE_FUNC_NET_SIZE)
- setsize (self, self.mins, self.maxs);
-
- if (netflags & BASE_FUNC_NET_ORIGIN)
- setorigin (self, self.origin);
+ base_entity_que_add (self, QUE_TYPE_ACTOR);
};
#endif
@@ -1172,16 +1606,16 @@ NONBLOCKING makes the brush non-solid. This is useless if VISIBLE is set.
self.owner.attack_finished = time + 0.5;
}
};
-#endif
-#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void() func_movewall_think =
{
self.ltime = time;
self.nextthink = time + 0.02;
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) func_movewall_init =
{
@@ -1190,36 +1624,29 @@ NONBLOCKING makes the brush non-solid. This is useless if VISIBLE is set.
base_rotate_init (e);
- e.angles = '0 0 0';
- e.movetype = MOVETYPE_PUSH;
-
#ifdef CSQC
- // only solid movewalls are networked to CSQC -- CEV
- e.solid = SOLID_BSP;
- e.customphysics = sub_null;
- local vector savemin = e.mins;
- local vector savemax = e.maxs;
- // setmodelindex (e, e.modelindex);
- setsize (e, savemin, savemax);
+ // movewalls seem to always be invisible so don't honor the
+ // modelindex SSQC sent; set to 0 so it won't be seen -- CEV
+ setmodelindex (e, 0);
+ setsize (e, e.mins, e.maxs);
setorigin (e, e.origin);
- if (e.model && e.model != "")
- {
- // set a mask and predraw if we're visible -- CEV
- e.drawmask = DRAWMASK_NORMAL;
- e.predraw = base_func_predraw_solidpush;
- }
+ e.drawmask = DRAWMASK_NORMAL;
+ e.predraw = base_func_predraw;
#endif
#ifdef SSQC
- if (e.spawnflags & MOVEWALL_TOUCH)
+ e.angles = '0 0 0';
+ e.movetype = MOVETYPE_PUSH;
+
+ if (e.spawnflags & SPAWNFLAG_FUNC_MOVEWALL_TOUCH)
e.touch = func_movewall_touch;
setmodel (e, e.model);
- if (!(e.spawnflags & MOVEWALL_VISIBLE))
+ if (!(e.spawnflags & SPAWNFLAG_FUNC_MOVEWALL_VISIBLE))
e.model = __NULL__;
- if (e.spawnflags & MOVEWALL_NONBLOCKING)
+ if (e.spawnflags & SPAWNFLAG_FUNC_MOVEWALL_NONBLOCKING)
{
e.solid = SOLID_NOT;
}
@@ -1227,12 +1654,12 @@ NONBLOCKING makes the brush non-solid. This is useless if VISIBLE is set.
{
e.solid = SOLID_BSP;
e.blocked = func_movewall_blocked;
- e.SendEntity = base_func_netsend;
- e.SendFlags = BASE_FUNC_NET_ORIGIN |
- BASE_FUNC_NET_SIZE | BASE_FUNC_NET_MODEL |
- BASE_FUNC_NET_SPEED;
}
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+ e.tick = base_func_neteval;
+
e.think = func_movewall_think;
e.nextthink = time + 0.02;
e.ltime = time;
@@ -1257,7 +1684,6 @@ NONBLOCKING makes the brush non-solid. This is useless if VISIBLE is set.
// Rotating doors
//----------------------------------------------------------------------
-#ifdef SSQC
/*QUAKED func_rotate_door (0 .5 .8) (-8 -8 -8) (8 8 8) STAYOPEN X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Creates a door that rotates between two positions around a point of
@@ -1277,6 +1703,16 @@ once door from closing again when it's blocked.
//----------------------------------------------------------------------
// class func_rotate_door: base_rotate
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) func_rotate_door_netreceive =
+ {
+ // creates the netflag variable -- CEV
+ BASE_FUNC_NETRECEIVE (func_rotate_door_init)
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
void() func_rotate_door_reversedirection =
{
@@ -1284,6 +1720,7 @@ once door from closing again when it's blocked.
// change to alternate textures
self.frame = 1 - self.frame;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
if (self.state == ROTATE_STATE_CLOSING)
{
@@ -1349,6 +1786,7 @@ once door from closing again when it's blocked.
self.think = func_rotate_door_think2;
}
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ANGLES;
self.nextthink = time + 0.01;
};
@@ -1362,13 +1800,17 @@ once door from closing again when it's blocked.
self.frame = 1 - self.frame;
self.angles = self.finaldest;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ANGLES |
+ NETFLAG_BASE_ENTITY_FRAME;
+
if (self.state == ROTATE_STATE_OPENING)
{
self.state = ROTATE_STATE_OPEN;
}
else
{
- if (self.spawnflags & ROTATE_DOOR_STAYOPEN)
+ if (self.spawnflags &
+ SPAWNFLAG_FUNC_ROTATE_DOOR_STAYOPEN)
{
func_rotate_door_group_reversedirection ();
return;
@@ -1423,7 +1865,9 @@ once door from closing again when it's blocked.
self.endtime = time + self.speed;
self.ltime = time;
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) func_rotate_door_init =
{
@@ -1432,6 +1876,19 @@ once door from closing again when it's blocked.
base_rotate_init (e);
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ setsize (e, e.mins, e.maxs);
+ setorigin (e, e.origin);
+ e.drawmask = DRAWMASK_NORMAL;
+ e.predraw = base_func_predraw;
+ #if 0
+ dprint (sprintf("func_rotate_door_init: CSQC entnum %g\n",
+ e.entnum));
+ #endif
+ #endif
+
+ #ifdef SSQC
if (!e.target)
objerror ("func_rotate_door_init: no target!\n");
@@ -1502,13 +1959,20 @@ once door from closing again when it's blocked.
e.solid = SOLID_NOT;
e.movetype = MOVETYPE_NONE;
setmodel (e, e.model);
- setorigin (e, e.origin);
setsize (e, e.mins, e.maxs);
+ setorigin (e, e.origin);
e.state = ROTATE_STATE_CLOSED;
e.use = func_rotate_door_use;
e.think = sub_null;
+
+ e.tick = base_func_neteval;
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() func_rotate_door =
{
@@ -1518,5 +1982,5 @@ once door from closing again when it's blocked.
func_rotate_door_init (self);
};
-// };
#endif
+// };
Return to the top of this page or return to the overview of this repo.
Diff qc/func/shadow.qc
diff --git a/qc/func/shadow.qc b/qc/func/shadow.qc
index 8dceb87..316d309 100644
--- a/qc/func/shadow.qc
+++ b/qc/func/shadow.qc
@@ -7,7 +7,22 @@
//======================================================================
#ifdef SSQC
-const float SHADOWCONTROLLER_STARTOFF = 1;
+//----------------------------------------------------------------------
+// misc_shadowcontroller spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_MISC_SHADOWCONTROLLER_STARTOFF = 1
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} misc_shadowcontroller_spawnflags;
#endif
//======================================================================
@@ -194,6 +209,9 @@ void() func_shadow;
e.classtype = CT_MISC_SHADOWCONTROLLER;
base_mapentity_init (e);
+ // don't transmit this entity to the client -- CEV
+ // e.SendEntity = base_entity_netsend_null;
+
// doesn't search for a target if switchshadstyle is already set
// used for built-in shadow controllers
if (!e.switchshadstyle)
@@ -240,7 +258,7 @@ void() func_shadow;
if (!e.speed2)
e.speed2 = e.speed;
- if (e.spawnflags & SHADOWCONTROLLER_STARTOFF)
+ if (e.spawnflags & SPAWNFLAG_MISC_SHADOWCONTROLLER_STARTOFF)
{
lightstyle (e.switchshadstyle, "m");
@@ -289,6 +307,9 @@ void() func_shadow;
e.modelindex = 0;
e.model = "";
+
+ // don't transmit this entity to the client -- CEV
+ // e.SendEntity = base_entity_netsend_null;
};
//--------------------------------------------------------------
Return to the top of this page or return to the overview of this repo.
Diff qc/func/togglevisiblewall.qc
diff --git a/qc/func/togglevisiblewall.qc b/qc/func/togglevisiblewall.qc
index bcfbca9..7e72f75 100644
--- a/qc/func/togglevisiblewall.qc
+++ b/qc/func/togglevisiblewall.qc
@@ -15,8 +15,23 @@
//======================================================================
#ifdef SSQC
-const float TOGGLEVISWALL_STARTOFF = 1;
-const float TOGGLEVISWALL_NOTSOLID = 2;
+//----------------------------------------------------------------------
+// func_togglevisiblewall spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_FUNC_TOGGLEVISWALL_STARTOFF = 1,
+ SPAWNFLAG_FUNC_TOGGLEVISWALL_NOTSOLID = 2
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} func_togglevisiblewall_spawnflags;
#endif
//======================================================================
@@ -24,9 +39,16 @@ const float TOGGLEVISWALL_NOTSOLID = 2;
//======================================================================
// func_togglevisiblewall
+#ifdef CSQC
+void(float isnew) func_togglevisiblewall_netreceive;
+#endif
#ifdef SSQC
void() func_togglevisiblewall_use;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) func_togglevisiblewall_init;
+#endif
+#ifdef SSQC
void() func_togglevisiblewall;
#endif
@@ -35,18 +57,28 @@ void() func_togglevisiblewall;
//----------------------------------------------------------------------
// class func_togglevisiblewall: base_func
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) func_togglevisiblewall_netreceive =
+ {
+ // creates the netflag variable -- CEV
+ BASE_FUNC_NETRECEIVE (func_togglevisiblewall_init)
+ };
+#endif
+
#ifdef SSQC
//--------------------------------------------------------------
void() func_togglevisiblewall_use =
{
if (!self.state)
{
- if (!(self.spawnflags & TOGGLEVISWALL_NOTSOLID))
+ if (!(self.spawnflags &
+ SPAWNFLAG_FUNC_TOGGLEVISWALL_NOTSOLID))
{
self.solid = SOLID_BSP;
self.movetype = MOVETYPE_PUSH;
}
- setmodel (self, self.origmodel);
+ setmodel (self, self.mdl);
if (self.switchshadstyle)
lightstyle (self.switchshadstyle, "a");
self.state = 1;
@@ -60,8 +92,13 @@ void() func_togglevisiblewall;
lightstyle (self.switchshadstyle, "m");
self.state = 0;
}
+
+ self.SendFlags |= NETFLAG_BASE_ENTITY_MODEL |
+ NETFLAG_BASE_ENTITY_SOLID;
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) func_togglevisiblewall_init =
{
@@ -69,25 +106,39 @@ void() func_togglevisiblewall;
e.classtype = CT_FUNC_TOGGLEVISIBLEWALL;
base_func_init (e);
- e.angles = '0 0 0';
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ setsize (e, e.mins, e.maxs);
+ setorigin (e, e.origin);
+ e.drawmask = DRAWMASK_NORMAL;
+ // shouldn't need a predraw -- CEV
+ #endif
+ #ifdef SSQC
+ e.angles = '0 0 0';
+ e.mdl = e.model;
e.use = func_togglevisiblewall_use;
- e.origmodel = e.model;
- if (e.spawnflags & TOGGLEVISWALL_STARTOFF)
+ if (e.spawnflags & SPAWNFLAG_FUNC_TOGGLEVISWALL_STARTOFF)
e.state = 1;
else
e.state = 0;
- if (e.spawnflags & TOGGLEVISWALL_NOTSOLID)
+ if (e.spawnflags & SPAWNFLAG_FUNC_TOGGLEVISWALL_NOTSOLID)
{
e.solid = SOLID_NOT;
e.movetype = MOVETYPE_NONE;
}
sub_runvoidas (e, func_togglevisiblewall_use);
+
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() func_togglevisiblewall =
{
Return to the top of this page or return to the overview of this repo.
Diff qc/func/togglewall.qc
diff --git a/qc/func/togglewall.qc b/qc/func/togglewall.qc
index c4d22c0..5bb505c 100644
--- a/qc/func/togglewall.qc
+++ b/qc/func/togglewall.qc
@@ -13,16 +13,22 @@
//======================================================================
#ifdef SSQC
-const float TOGGLEWALL_START_OFF = 1;
-#endif
-
-#if defined(CSQC) || defined(SSQC)
-enumflags
+//----------------------------------------------------------------------
+// func_togglewall spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
{
- TOGGLEWALL_NET_MODEL, // wall model has changed
- TOGGLEWALL_NET_ORIGIN, // wall origin has changed
- TOGGLEWALL_NET_SIZE // wall size has changed
-};
+ SPAWNFLAG_FUNC_TOGGLEWALL_START_OFF = 1
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} func_togglewall_spawnflags;
#endif
//======================================================================
@@ -34,7 +40,6 @@ enumflags
void(float isnew) func_togglewall_netreceive;
#endif
#ifdef SSQC
-float(entity to, float netflags) func_togglewall_netsend;
void() func_togglewall_touch;
void() func_togglewall_use;
#endif
@@ -47,11 +52,11 @@ void() func_togglewall;
//------------------------------------------------------------------------------
-/*QUAKED func_togglewall (0 .5 .8) ? TOGGLEWALL_START_OFF X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+/*QUAKED func_togglewall (0 .5 .8) ? START_OFF X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Creates a invisible wall that can be toggled on and off.
-TOGGLEWALL_START_OFF wall doesn't block until triggered.
+START_OFF wall doesn't block until triggered.
"noise" is the sound to play when wall is turned off.
"noise1" is the sound to play when wall is blocking.
@@ -64,73 +69,13 @@ TOGGLEWALL_START_OFF wall doesn't block until triggered.
//--------------------------------------------------------------
void(float isnew) func_togglewall_netreceive =
{
- local float netflags = ReadFloat ();
-
- if (netflags & TOGGLEWALL_NET_MODEL)
- self.modelindex = ReadFloat ();
-
- if (netflags & TOGGLEWALL_NET_ORIGIN)
- {
- self.origin_x = ReadCoord ();
- self.origin_y = ReadCoord ();
- self.origin_z = ReadCoord ();
- }
-
- if (netflags & TOGGLEWALL_NET_SIZE)
- {
- self.mins_x = ReadCoord ();
- self.mins_y = ReadCoord ();
- self.mins_z = ReadCoord ();
- self.maxs_x = ReadCoord ();
- self.maxs_y = ReadCoord ();
- self.maxs_z = ReadCoord ();
- }
-
- if (isnew)
- func_togglewall_init (self);
-
- if (netflags & TOGGLEWALL_NET_MODEL)
- setmodelindex (self, self.modelindex);
-
- if (netflags & TOGGLEWALL_NET_SIZE)
- setsize (self, self.mins, self.maxs);
-
- if (netflags & TOGGLEWALL_NET_ORIGIN)
- setorigin (self, self.origin);
+ // creates the netflag variable -- CEV
+ BASE_FUNC_NETRECEIVE (func_togglewall_init)
};
#endif
#ifdef SSQC
//--------------------------------------------------------------
- float(entity to, float netflags) func_togglewall_netsend =
- {
- WriteShort (MSG_ENTITY, self.classtype);
- WriteFloat (MSG_ENTITY, netflags);
-
- if (netflags & TOGGLEWALL_NET_MODEL)
- WriteFloat (MSG_ENTITY, self.modelindex);
-
- if (netflags & TOGGLEWALL_NET_ORIGIN)
- {
- WriteCoord (MSG_ENTITY, self.origin_x);
- WriteCoord (MSG_ENTITY, self.origin_y);
- WriteCoord (MSG_ENTITY, self.origin_z);
- }
-
- if (netflags & TOGGLEWALL_NET_SIZE)
- {
- WriteCoord (MSG_ENTITY, self.mins_x);
- WriteCoord (MSG_ENTITY, self.mins_y);
- WriteCoord (MSG_ENTITY, self.mins_z);
- WriteCoord (MSG_ENTITY, self.maxs_x);
- WriteCoord (MSG_ENTITY, self.maxs_y);
- WriteCoord (MSG_ENTITY, self.maxs_z);
- }
-
- return TRUE;
- };
-
- //--------------------------------------------------------------
void() func_togglewall_touch =
{
if (!self.dmg)
@@ -147,22 +92,22 @@ TOGGLEWALL_START_OFF wall doesn't block until triggered.
//--------------------------------------------------------------
void() func_togglewall_use =
{
- if (!self.state)
- {
- self.state = 1;
- setorigin (self, self.origin - '8000 8000 8000');
- // sound (self, CHAN_VOICE, self.noise1,
- // VOL_HIGH, ATTN_NORM);
- }
- else
+ if (self.state)
{
self.state = 0;
- setorigin (self, self.origin + '8000 8000 8000');
+ self.solid = SOLID_NOT;
sound (self, CHAN_VOICE, self.noise,
VOL_HIGH, ATTN_NORM);
}
+ else
+ {
+ self.state = 1;
+ self.solid = SOLID_BSP;
+ // sound (self, CHAN_VOICE, self.noise1,
+ // VOL_HIGH, ATTN_NORM);
+ }
- self.SendFlags = TOGGLEWALL_NET_ORIGIN;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_SOLID;
};
#endif
@@ -174,7 +119,14 @@ TOGGLEWALL_START_OFF wall doesn't block until triggered.
e.classtype = CT_FUNC_TOGGLEWALL;
base_func_init (e);
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ setsize (e, e.mins, e.maxs);
+ setorigin (e, e.origin);
+ #endif
+
#ifdef SSQC
+ e.solid = SOLID_BSP;
e.movetype = MOVETYPE_PUSH;
e.mdl = e.model;
setmodel (e, e.model);
@@ -192,16 +144,11 @@ TOGGLEWALL_START_OFF wall doesn't block until triggered.
precache_sound (e.noise);
precache_sound (e.noise1);
- #endif
- e.solid = SOLID_BSP;
- e.model = __NULL__;
-
- #ifdef SSQC
- if (e.spawnflags & TOGGLEWALL_START_OFF)
+ if (e.spawnflags & SPAWNFLAG_FUNC_TOGGLEWALL_START_OFF)
{
e.state = 0;
- setorigin (e, e.origin + '8000 8000 8000');
+ e.solid = SOLID_NOT;
}
else
{
@@ -209,9 +156,8 @@ TOGGLEWALL_START_OFF wall doesn't block until triggered.
sound (e, CHAN_VOICE, e.noise1, VOL_HIGH, ATTN_NORM);
}
- e.SendEntity = func_togglewall_netsend;
- e.SendFlags = TOGGLEWALL_NET_MODEL | TOGGLEWALL_NET_ORIGIN |
- TOGGLEWALL_NET_SIZE;
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
#endif
};
#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/func/train.qc
diff --git a/qc/func/train.qc b/qc/func/train.qc
index 222a8d9..310f006 100644
--- a/qc/func/train.qc
+++ b/qc/func/train.qc
@@ -7,18 +7,41 @@
//======================================================================
#ifdef SSQC
-const float TRAIN_RETRIGGER = 1;
-const float TRAIN_MOVEONTRIGGER = 2;
-const float TRAIN_STOPONTRIGGER = 4;
-const float TRAIN_NONSOLID = 8;
-const float TRAIN_NOROTATE = 16;
-const float TRAIN_ROTATEY = 32;
-const float TRAIN_CUSTOMALIGN = 64;
-
-const float TRAIN_NEXT_WAIT = 0; // normal movement
-const float TRAIN_NEXT_STOP = 1; // force a stop on the next path_corner
-const float TRAIN_NEXT_CONTINUE = 2; // force continue on the next
+//----------------------------------------------------------------------
+// base_func_train spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_FUNC_TRAIN_RETRIGGER = 1,
+ SPAWNFLAG_FUNC_TRAIN_MOVEONTRIGGER = 2,
+ SPAWNFLAG_FUNC_TRAIN_STOPONTRIGGER = 4,
+ SPAWNFLAG_FUNC_TRAIN_NONSOLID = 8,
+ SPAWNFLAG_FUNC_TRAIN_NOROTATE = 16,
+ SPAWNFLAG_FUNC_TRAIN_ROTATEY = 32,
+ SPAWNFLAG_FUNC_TRAIN_CUSTOMALIGN = 64
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} base_func_train_spawnflags;
+#endif
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// func_train states -- CEV
+//----------------------------------------------------------------------
+typedef enum
+{
+ FUNC_TRAIN_NEXT_WAIT = 0, // normal movement
+ FUNC_TRAIN_NEXT_STOP = 1, // force a stop on the next path_corner
+ FUNC_TRAIN_NEXT_CONTINUE = 2 // force continue on the next
// path_corner (ignores wait time)
+} func_train_states;
#endif
//======================================================================
@@ -84,7 +107,8 @@ void() func_train;
//--------------------------------------------------------------
void() base_func_train_use_stopped =
{
- if (self.spawnflags & TRAIN_MOVEONTRIGGER || self.wait < 0)
+ if (self.spawnflags & SPAWNFLAG_FUNC_TRAIN_MOVEONTRIGGER ||
+ self.wait < 0)
{
base_func_train_next ();
return;
@@ -93,7 +117,7 @@ void() func_train;
// Train has already moved after startup, and has no
// "stop on trigger" flag, so ignore activation.
if (self.think != base_func_train_find &&
- self.cnt != TRAIN_NEXT_STOP)
+ self.cnt != FUNC_TRAIN_NEXT_STOP)
{
return;
}
@@ -108,10 +132,15 @@ void() func_train;
//--------------------------------------------------------------
void() base_func_train_use_moving =
{
- if (self.spawnflags & TRAIN_MOVEONTRIGGER || self.wait < 0)
- self.cnt = TRAIN_NEXT_CONTINUE;
- else if (self.spawnflags & TRAIN_STOPONTRIGGER)
- self.cnt = TRAIN_NEXT_STOP;
+ if (self.spawnflags & SPAWNFLAG_FUNC_TRAIN_MOVEONTRIGGER ||
+ self.wait < 0)
+ {
+ self.cnt = FUNC_TRAIN_NEXT_CONTINUE;
+ }
+ else if (self.spawnflags & SPAWNFLAG_FUNC_TRAIN_STOPONTRIGGER)
+ {
+ self.cnt = FUNC_TRAIN_NEXT_STOP;
+ }
};
//--------------------------------------------------------------
@@ -178,14 +207,13 @@ void() func_train;
// train is moving normally and path_corner has a wait set,
// so pause for that time.
- if (self.wait > 0 && self.cnt == TRAIN_NEXT_WAIT &&
- !(self.spawnflags & TRAIN_RETRIGGER))
+ if (self.wait > 0 && self.cnt == FUNC_TRAIN_NEXT_WAIT &&
+ !(self.spawnflags & SPAWNFLAG_FUNC_TRAIN_RETRIGGER))
{
// state: stopped
self.state = 0;
- self.SendFlags |= BASE_FUNC_NET_ORIGIN |
- BASE_FUNC_NET_VELOCITY | BASE_FUNC_NET_SPEED;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
// oof -- CEV
if (self.classtype == CT_MISC_MODELTRAIN)
@@ -207,8 +235,8 @@ void() func_train;
}
// train is moving normally and path_corner has no wait time,
// or has been forced to move instantly through a triggering.
- else if (self.cnt != TRAIN_NEXT_STOP && !self.wait &&
- !(self.spawnflags & TRAIN_RETRIGGER))
+ else if (self.cnt != FUNC_TRAIN_NEXT_STOP && !self.wait &&
+ !(self.spawnflags & SPAWNFLAG_FUNC_TRAIN_RETRIGGER))
{
// play "passing by" sound, if any. If path_corner has
// a custom one, play that instead
@@ -240,8 +268,7 @@ void() func_train;
// state: stopped
self.state = 0;
- self.SendFlags |= BASE_FUNC_NET_ORIGIN |
- BASE_FUNC_NET_VELOCITY | BASE_FUNC_NET_SPEED;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
// oof -- CEV
if (self.classtype == CT_MISC_MODELTRAIN)
@@ -292,8 +319,8 @@ void() func_train;
sound (self, CHAN_VOICE, self.noise1, VOL_MHI, ATTN_NORM);
- if (!(!self.wait && self.cnt == TRAIN_NEXT_CONTINUE))
- self.cnt = TRAIN_NEXT_WAIT;
+ if (!(!self.wait && self.cnt == FUNC_TRAIN_NEXT_CONTINUE))
+ self.cnt = FUNC_TRAIN_NEXT_WAIT;
// store up any premature triggerings until current
// movement is finished
@@ -302,12 +329,13 @@ void() func_train;
// oof -- CEV
if (self.classtype == CT_MISC_MODELTRAIN)
{
- if (!(self.spawnflags & TRAIN_NOROTATE))
+ if (!(self.spawnflags & SPAWNFLAG_FUNC_TRAIN_NOROTATE))
{
destang = vectoangles (
targ.origin - self.origin);
- if (self.spawnflags & TRAIN_ROTATEY)
+ if (self.spawnflags &
+ SPAWNFLAG_FUNC_TRAIN_ROTATEY)
{
destang_x = self.angles_x;
destang_z = self.angles_z;
@@ -334,7 +362,7 @@ void() func_train;
self.state = 1;
if (self.classtype == CT_MISC_MODELTRAIN &&
- self.style != TRAIN_STYLE_SINGLEANIM)
+ self.style != MISC_MODELTRAIN_STYLE_SINGLEANIM)
{
sub_runvoidas (self.animcontroller,
self.animcontroller.think);
@@ -346,7 +374,7 @@ void() func_train;
// of an "origin" brush added to the train by the mapper
// instead of the mins corner -therektafire
local float do_displace;
- if (self.spawnflags & TRAIN_CUSTOMALIGN)
+ if (self.spawnflags & SPAWNFLAG_FUNC_TRAIN_CUSTOMALIGN)
do_displace = 0.0;
else
do_displace = 1.0;
@@ -354,11 +382,10 @@ void() func_train;
if (self.classtype != CT_MISC_MODELTRAIN)
displ = self.mins;
- sub_calcmove (self, targ.origin - (displ * do_displace),
+ base_func_calcmove (self, targ.origin - (displ * do_displace),
self.speed2, base_func_train_wait);
- self.SendFlags |= BASE_FUNC_NET_ORIGIN |
- BASE_FUNC_NET_VELOCITY | BASE_FUNC_NET_SPEED;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
};
//--------------------------------------------------------------
@@ -380,7 +407,7 @@ void() func_train;
self.target = targ.target;
local float do_displace;
- if (self.spawnflags & TRAIN_CUSTOMALIGN)
+ if (self.spawnflags & SPAWNFLAG_FUNC_TRAIN_CUSTOMALIGN)
do_displace = 0.0;
else
do_displace = 1.0;
@@ -393,8 +420,7 @@ void() func_train;
// If you set SendFlags here it will cause a movement error
// on the client; let the next think take care of it -- CEV
- self.SendFlags |= BASE_FUNC_NET_ORIGIN |
- BASE_FUNC_NET_VELOCITY | BASE_FUNC_NET_SPEED;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
if (targ.speed)
// uses speed from the 1st path corner if set
@@ -423,8 +449,8 @@ void() func_train;
if (!e.dmg)
e.dmg = 2;
- if (e.spawnflags & TRAIN_STOPONTRIGGER &&
- e.spawnflags & TRAIN_MOVEONTRIGGER)
+ if (e.spawnflags & SPAWNFLAG_FUNC_TRAIN_STOPONTRIGGER &&
+ e.spawnflags & SPAWNFLAG_FUNC_TRAIN_MOVEONTRIGGER)
{
objerror ("base_func_train_init: Stop and move on "
"trigger set at the same time\n");
@@ -464,9 +490,9 @@ void() func_train;
if (e.noise2 != "")
precache_sound (e.noise2);
- e.cnt = TRAIN_NEXT_WAIT;
+ e.cnt = FUNC_TRAIN_NEXT_WAIT;
- if (e.spawnflags & TRAIN_NONSOLID)
+ if (e.spawnflags & SPAWNFLAG_FUNC_TRAIN_NONSOLID)
{
e.solid = SOLID_NOT;
e.movetype = MOVETYPE_NOCLIP;
@@ -495,22 +521,11 @@ void() func_train;
e.nextthink = e.ltime + 0.1;
else
e.nextthink = time + 0.1;
-
- if (e.solid == SOLID_BSP && e.classtype == CT_FUNC_TRAIN)
- {
- // e.SendEntity = base_func_netsend;
- e.SendFlags = BASE_FUNC_NET_ORIGIN |
- BASE_FUNC_NET_SIZE | BASE_FUNC_NET_MODEL |
- BASE_FUNC_NET_SPEED;
- }
#endif
#ifdef CSQC
- // networked trains are always SOLID_BSP & MOVETYPE_PUSH
e.drawmask = DRAWMASK_NORMAL;
- e.predraw = base_func_predraw_solidpush;
- e.solid = SOLID_BSP;
- e.movetype = MOVETYPE_PUSH;
+ e.predraw = base_func_predraw;
// make sure model, size, and origin are set -- CEV
setmodelindex (e, e.modelindex);
@@ -552,39 +567,11 @@ sounds
//--------------------------------------------------------------
void(float isnew) func_train_netreceive =
{
- local float netflags = ReadFloat ();
- base_func_netreceive_read (isnew, netflags);
+ // creates the netflag variable -- CEV
+ BASE_FUNC_NETRECEIVE (func_train_init)
if (isnew)
- func_train_init (self);
-
- if (netflags & BASE_FUNC_NET_VELOCITY)
- {
- if (self.velocity != self.velocity_net)
- {
- if (self.velocity)
- {
- self.origin_start = self.origin;
- self.movetime = time;
- }
- else
- {
- self.movetime = 0;
- }
- }
- }
-
- self.origin_net = self.origin;
- self.velocity_net = self.velocity;
-
- if (netflags & BASE_FUNC_NET_MODEL)
- setmodelindex (self, self.modelindex);
-
- if (netflags & BASE_FUNC_NET_SIZE)
- setsize (self, self.mins, self.maxs);
-
- if (netflags & BASE_FUNC_NET_ORIGIN)
- setorigin (self, self.origin);
+ base_entity_que_add (self, QUE_TYPE_ACTOR);
};
#endif
@@ -596,6 +583,12 @@ sounds
e.classtype = CT_FUNC_TRAIN;
base_func_train_init (e);
+
+ #ifdef SSQC
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+ e.tick = base_func_neteval;
+ #endif
};
#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/func/wall.qc
diff --git a/qc/func/wall.qc b/qc/func/wall.qc
index 6af3038..f4b7702 100644
--- a/qc/func/wall.qc
+++ b/qc/func/wall.qc
@@ -13,9 +13,14 @@ void(entity e) base_func_wall_init;
strip void() base_func_wall;
#endif
-#ifdef SSQC
// func_wall
+#ifdef CSQC
+void(float isnew) func_wall_netreceive;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) func_wall_init;
+#endif
+#ifdef SSQC
void() func_wall;
#endif
@@ -30,50 +35,83 @@ void() func_wall;
{
// change to alternate textures
self.frame = 1 - self.frame;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
};
//--------------------------------------------------------------
void(entity e) base_func_wall_init =
{
base_func_init (e);
- e.use = base_func_wall_use;
+
+ // support for map hacks -- CEV
+ if (!e.use)
+ e.use = base_func_wall_use;
};
//--------------------------------------------------------------
strip void() base_func_wall =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
base_func_wall_init (self);
};
// };
#endif
-#ifdef SSQC
/*QUAKED func_wall (0 .5 .8) ? X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
This is just a solid wall if not inhibitted
*/
//----------------------------------------------------------------------
-// class func_wall: base_func_wall
+// class func_wall: base_func
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) func_wall_netreceive =
+ {
+ // creates the netflag variable -- CEV
+ BASE_FUNC_NETRECEIVE (func_wall_init)
+ };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) func_wall_init =
{
- self.classname = "func_wall";
- self.classtype = CT_FUNC_WALL;
+ e.classname = "func_wall";
+ e.classtype = CT_FUNC_WALL;
+
+ #if defined(CSQC)
+ base_func_init (e);
+ #elif defined(SSQC)
base_func_wall_init (e);
+ #endif
+
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ setsize (e, e.mins, e.maxs);
+ setorigin (e, e.origin);
+
+ e.drawmask = DRAWMASK_NORMAL;
+ // this ent is simple enough to not need a predraw -- CEV
+ #endif
- self.angles = '0 0 0';
+ #ifdef SSQC
+ e.angles = '0 0 0';
// so it doesn't get pushed by anything
- self.movetype = MOVETYPE_PUSH;
- self.solid = SOLID_BSP;
- // already set by base_func_wall_init -- CEV
- // self.use = base_func_wall_use;
- setmodel (self, self.model);
+ e.movetype = MOVETYPE_PUSH;
+ e.solid = SOLID_BSP;
+ setmodel (e, e.model);
+
+ // support for map hacks -- CEV
+ if (!e.use)
+ e.use = base_func_wall_use;
+
+ // network func_wall to the CSQC client -- CEV
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() func_wall =
{
@@ -83,5 +121,5 @@ This is just a solid wall if not inhibitted
func_wall_init (self);
};
-// };
#endif
+// };
Return to the top of this page or return to the overview of this repo.
Diff qc/hazards/ltrail.qc
diff --git a/qc/hazards/ltrail.qc b/qc/hazards/ltrail.qc
index 72bb99e..bff4de8 100644
--- a/qc/hazards/ltrail.qc
+++ b/qc/hazards/ltrail.qc
@@ -13,8 +13,23 @@
//======================================================================
#ifdef SSQC
-const float LTRAIL_TOGGLE = 1;
-const float LTRAIL_ACTIVE = 2;
+//----------------------------------------------------------------------
+// ltrail spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_HAZARD_LTRAIL_TOGGLE = 1,
+ SPAWNFLAG_HAZARD_LTRAIL_ACTIVE = 2
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} base_hazard_ltrail_spawnflags;
#endif
//======================================================================
@@ -105,17 +120,18 @@ void() ltrail_end;
{
// if it's a toggle ltrail, we ignore triggers from
// ltrail_end's when toggled off.
- if (self.spawnflags & LTRAIL_TOGGLE)
+ if (self.spawnflags & SPAWNFLAG_HAZARD_LTRAIL_TOGGLE)
{
// user is not a lightning trail; change activity state.
if (other.classtype != CT_HAZARD_LTRAIL_END)
{
- if (self.spawnflags & LTRAIL_ACTIVE)
+ if (self.spawnflags &
+ SPAWNFLAG_HAZARD_LTRAIL_ACTIVE)
{
// currently active
// self.spawnflags &= ~LTRAIL_ACTIVE;
self.spawnflags = self.spawnflags -
- LTRAIL_ACTIVE;
+ SPAWNFLAG_HAZARD_LTRAIL_ACTIVE;
return;
}
else
@@ -123,10 +139,11 @@ void() ltrail_end;
// not active
// self.spawnflags |= LTRAIL_ACTIVE;
self.spawnflags = self.spawnflags +
- LTRAIL_ACTIVE;
+ SPAWNFLAG_HAZARD_LTRAIL_ACTIVE;
}
}
- else if (!(self.spawnflags & LTRAIL_ACTIVE))
+ else if (!(self.spawnflags &
+ SPAWNFLAG_HAZARD_LTRAIL_ACTIVE))
{
// user is lightning trail, but trail has
// been turned off. ignore the message.
@@ -211,7 +228,7 @@ Set the LT_TOGGLE checkbox if you want the lightning shooter to continuously fir
// using rad_time instead of ltrailLastUsed -- CEV
e.rad_time = time;
- if (e.spawnflags & LTRAIL_ACTIVE)
+ if (e.spawnflags & SPAWNFLAG_HAZARD_LTRAIL_ACTIVE)
{
e.items = time + 99999999;
e.think = base_hazard_ltrail_fire;
Return to the top of this page or return to the overview of this repo.
Diff qc/hazards/shooter.qc
diff --git a/qc/hazards/shooter.qc b/qc/hazards/shooter.qc
index d23c042..0dba000 100644
--- a/qc/hazards/shooter.qc
+++ b/qc/hazards/shooter.qc
@@ -9,14 +9,29 @@
//======================================================================
#ifdef SSQC
-const float SHOOTER_SPAWNFLAG_SUPERSPIKE = 1;
-const float SHOOTER_SPAWNFLAG_LASER = 2;
-const float SHOOTER_SPAWNFLAG_LAVABALL = 4;
-const float SHOOTER_SPAWNFLAG_ROCKET = 8;
-const float SHOOTER_SPAWNFLAG_VOREBALL = 16;
-const float SHOOTER_SPAWNFLAG_GRENADE = 32;
-const float SHOOTER_SPAWNFLAG_GIBS = 64;
-const float SHOOTER_SPAWNFLAG_SILENT = 128;
+//----------------------------------------------------------------------
+// shooter hazard spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_HAZARD_SHOOTER_SUPERSPIKE = 1,
+ SPAWNFLAG_HAZARD_SHOOTER_LASER = 2,
+ SPAWNFLAG_HAZARD_SHOOTER_LAVABALL = 4,
+ SPAWNFLAG_HAZARD_SHOOTER_ROCKET = 8,
+ SPAWNFLAG_HAZARD_SHOOTER_VOREBALL = 16,
+ SPAWNFLAG_HAZARD_SHOOTER_GRENADE = 32,
+ SPAWNFLAG_HAZARD_SHOOTER_GIBS = 64,
+ SPAWNFLAG_HAZARD_SHOOTER_SILENT = 128
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} base_hazard_shooter_spawnflags;
#endif
//======================================================================
@@ -75,96 +90,85 @@ void() trap_switched_shooter;
//--------------------------------------------------------------
void() base_hazard_shooter_use =
{
- if (self.spawnflags & SHOOTER_SPAWNFLAG_LASER)
- {
- if (!(self.spawnflags & SHOOTER_SPAWNFLAG_SILENT))
- sound (self, CHAN_VOICE, "enforcer/enfire.wav",
- VOL_HIGH, ATTN_NORM);
+ local string sndfile = "";
+ local float spct = 0;
+ local float fl = 0;
+ local float tofs = random() * 100.0;
+ tofs *= -1;
- local vector laser_velocity = normalize (self.movedir);
+ if (self.spawnflags & SPAWNFLAG_HAZARD_SHOOTER_LASER)
+ {
+ sndfile = "enforcer/enfire.wav";
+ local vector l_v = normalize (self.movedir);
// SetSpeed
- laser_velocity *= min (LASER_SPEED *
+ l_v *= min (LASER_SPEED *
self.proj_speed_mod, PM_MAXVELOCITY);
-
- // fire_laser
- spawn_projectile_laser (self, self.origin,
- laser_velocity);
+ spawn_projectile_laser (self, self.origin, l_v);
}
- else if (self.spawnflags & SHOOTER_SPAWNFLAG_LAVABALL)
+ else if (self.spawnflags & SPAWNFLAG_HAZARD_SHOOTER_LAVABALL)
{
- if (!(self.spawnflags & SHOOTER_SPAWNFLAG_SILENT))
- // dms
- sound (self, CHAN_VOICE, "boss1/throw.wav",
- VOL_HIGH, ATTN_NORM);
-
+ sndfile = "boss1/throw.wav";
spawn_projectile_lavaball (self, self.origin,
self.movedir * 600);
}
- else if (self.spawnflags & SHOOTER_SPAWNFLAG_ROCKET)
+ else if (self.spawnflags & SPAWNFLAG_HAZARD_SHOOTER_ROCKET)
{
- if (!(self.spawnflags & SHOOTER_SPAWNFLAG_SILENT))
- sound (self, CHAN_VOICE, "weapons/sgun1.wav",
- VOL_HIGH, ATTN_NORM);
-
+ sndfile = "weapons/sgun1.wav";
spawn_projectile_rocket (self, self.origin,
self.movedir * ROCKET_SPEED,
self.proj_basespeed);
}
- else if (self.spawnflags & SHOOTER_SPAWNFLAG_VOREBALL)
+ else if (self.spawnflags & SPAWNFLAG_HAZARD_SHOOTER_VOREBALL)
{
- if (!(self.spawnflags & SHOOTER_SPAWNFLAG_SILENT))
- sound (self, CHAN_VOICE, "shalrath/attack2.wav",
- VOL_HIGH, ATTN_NORM);
-
+ sndfile = "shalrath/attack2.wav";
spawn_projectile_voreball (self, self.origin,
self.movedir * VOREBALL_SPEED,
self.proj_basespeed);
}
- else if (self.spawnflags & SHOOTER_SPAWNFLAG_GRENADE)
+ else if (self.spawnflags & SPAWNFLAG_HAZARD_SHOOTER_GRENADE)
{
- if (!(self.spawnflags & SHOOTER_SPAWNFLAG_SILENT))
- sound (self, CHAN_VOICE, "weapons/grenade.wav",
- VOL_HIGH, ATTN_NORM);
-
- local vector gnade_velocity = self.movedir * 600 +
+ sndfile = "weapons/grenade.wav";
+ local vector g_v = self.movedir * 600 +
v_up * 200 + crandom() * v_right * 10 +
crandom() * v_up * 10;
-
- spawn_projectile_grenade (self, self.origin,
- gnade_velocity);
+ spawn_projectile_grenade (self, self.origin, g_v);
}
- else if (self.spawnflags & SHOOTER_SPAWNFLAG_GIBS)
+ else if (self.spawnflags & SPAWNFLAG_HAZARD_SHOOTER_GIBS)
{
- if (!(self.spawnflags & SHOOTER_SPAWNFLAG_SILENT))
- sound (self, CHAN_VOICE, "zombie/z_shot1.wav",
- VOL_HIGH, ATTN_NORM);
-
- local vector znade_velocity = self.movedir * 600 +
+ sndfile = "zombie/z_shot1.wav";
+ local vector z_v = self.movedir * 600 +
v_up * 200 + crandom() * v_right * 10 +
crandom() * v_up * 10;
- spawn_projectile_zombiechunk (self, self.origin,
- znade_velocity);
+ spawn_projectile_zombiechunk (self, self.origin, z_v);
}
else
{
- if (!(self.spawnflags & SHOOTER_SPAWNFLAG_SILENT))
- // changed vol fromt 1 to 0.666 -- CEV
- sound (self, CHAN_VOICE, "weapons/spike2.wav",
- VOL_MID, ATTN_NORM);
-
+ sndfile = "weapons/spike2.wav";
local float damage;
- if (self.spawnflags & SHOOTER_SPAWNFLAG_SUPERSPIKE)
+ if (self.spawnflags &
+ SPAWNFLAG_HAZARD_SHOOTER_SUPERSPIKE)
+ {
damage = SPIKE_SUPER_DAMAGE;
+ }
else
+ {
damage = SPIKE_NORMAL_DAMAGE;
+ }
// shooter spikes move at half the speed of
// player spikes -- CEV
spawn_projectile_spike (self, self.origin,
self.movedir * 500, damage, 500);
}
+
+ if (!(self.spawnflags & SPAWNFLAG_HAZARD_SHOOTER_SILENT)) {
+ if (sndfile != "")
+ {
+ sound (self, CHAN_VOICE, sndfile, VOL_MHI,
+ ATTN_NORM, spct, fl, tofs);
+ } }
};
//--------------------------------------------------------------
@@ -179,35 +183,35 @@ void() trap_switched_shooter;
sub_setmovedir (e);
- if (e.spawnflags & SHOOTER_SPAWNFLAG_LASER)
+ if (e.spawnflags & SPAWNFLAG_HAZARD_SHOOTER_LASER)
{
precache_model2 ("progs/laser.mdl");
precache_sound2 ("enforcer/enfire.wav");
precache_sound2 ("enforcer/enfstop.wav");
}
- else if (e.spawnflags & SHOOTER_SPAWNFLAG_LAVABALL)
+ else if (e.spawnflags & SPAWNFLAG_HAZARD_SHOOTER_LAVABALL)
{
precache_model ("progs/lavaball.mdl");
// precache_sound2 ("knight/sword2.wav"); // dms
precache_sound2 ("boss1/throw.wav"); // dms
}
- else if (e.spawnflags & SHOOTER_SPAWNFLAG_ROCKET)
+ else if (e.spawnflags & SPAWNFLAG_HAZARD_SHOOTER_ROCKET)
{
precache_model ("progs/missile.mdl");
precache_sound ("weapons/sgun1.wav");
}
- else if (e.spawnflags & SHOOTER_SPAWNFLAG_VOREBALL)
+ else if (e.spawnflags & SPAWNFLAG_HAZARD_SHOOTER_VOREBALL)
{
precache_model ("progs/v_spike.mdl");
precache_sound ("shalrath/attack2.wav");
}
- else if (e.spawnflags & SHOOTER_SPAWNFLAG_GRENADE)
+ else if (e.spawnflags & SPAWNFLAG_HAZARD_SHOOTER_GRENADE)
{
precache_model ("progs/grenade.mdl");
// grenade launcher
precache_sound ("weapons/grenade.wav");
}
- else if (e.spawnflags & SHOOTER_SPAWNFLAG_GIBS)
+ else if (e.spawnflags & SPAWNFLAG_HAZARD_SHOOTER_GIBS)
{
precache_model ("progs/zom_gib.mdl");
// Zombie gibs
Return to the top of this page or return to the overview of this repo.
Diff qc/info/fog.qc
diff --git a/qc/info/fog.qc b/qc/info/fog.qc
new file mode 100644
index 0000000..e84c656
--- /dev/null
+++ b/qc/info/fog.qc
@@ -0,0 +1,57 @@
+//==============================================================================
+// info_fog -- MG1 Machine Games Dimension Of The Machine compat -- CEV
+//==============================================================================
+
+//======================================================================
+// forward declarations
+//======================================================================
+
+#ifdef SSQC
+// info_fog
+void(entity e) info_fog_init;
+void() info_fog;
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifdef SSQC
+/*QUAKED info_fog (0.5 .5 .8) (-8 -8 -8) (8 8 8)
+Fog value definition
+wait: fog density
+dest: fog color
+*/
+//----------------------------------------------------------------------
+// class info_fog: base_mapentity
+// {
+ //--------------------------------------------------------------
+ void(entity e) info_fog_init =
+ {
+ e.classname = "info_fog";
+ e.classtype = CT_INFO_FOG;
+ base_mapentity_init (e);
+
+ // TODO CEV the following looks mangled.
+ // Why is that else there? Should be validated.
+ if (!self.fog_density)
+ {
+ self.fog_density = 0.05;
+ }
+ else if (self.fog_color_x > 1.0 || self.fog_color_y > 1.0 ||
+ self.fog_color_z > 1.0)
+ {
+ //Not in 0..1 range?
+ self.fog_color = self.fog_color * (1.0 / 255);
+ }
+ };
+
+ //--------------------------------------------------------------
+ void() info_fog =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ info_fog_init (self);
+ };
+// };
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/info/intermission.qc
diff --git a/qc/info/intermission.qc b/qc/info/intermission.qc
index d5569a9..5de6414 100644
--- a/qc/info/intermission.qc
+++ b/qc/info/intermission.qc
@@ -6,25 +6,29 @@
// forward declarations
//======================================================================
+#ifdef SSQC
// info_intermission
entity(entity src, vector org) spawn_info_intermission;
void(entity e) info_intermission_init;
void() info_intermission;
+#endif
+#ifdef SSQC
// info_intermissiontext
entity(entity src, vector org, string smsg, float fcnt)
spawn_info_intermissiontext;
void(entity e) info_intermissiontext_init;
void() info_intermissiontext;
+#endif
//------------------------------------------------------------------------------
+#ifdef SSQC
/*QUAKED info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
This is the camera point for the intermission.
Use mangle instead of angle, so you can set pitch or roll as well as yaw. 'pitch roll yaw'
*/
-
//----------------------------------------------------------------------
// class info_intermission: base_mapentity
// {
@@ -56,7 +60,9 @@ Use mangle instead of angle, so you can set pitch or roll as well as yaw. 'pitc
info_intermission_init (self);
};
// };
+#endif
+#ifdef SSQC
//----------------------------------------------------------------------
// class info_intermissiontext: base_mapentity
// {
@@ -97,3 +103,4 @@ Use mangle instead of angle, so you can set pitch or roll as well as yaw. 'pitc
info_intermissiontext_init (self);
};
// };
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/info/notnull.qc
diff --git a/qc/info/notnull.qc b/qc/info/notnull.qc
index 635beb2..7b8c657 100644
--- a/qc/info/notnull.qc
+++ b/qc/info/notnull.qc
@@ -6,18 +6,20 @@
// forward declarations
//======================================================================
+#ifdef SSQC
// info_notnull
entity(entity src, vector org) spawn_info_notnull;
void(entity e) info_notnull_init;
void() info_notnull;
+#endif
//------------------------------------------------------------------------------
+#ifdef SSQC
/*QUAKED info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-Never used in the or
+Used as a positional target for lightning.
*/
-
//----------------------------------------------------------------------
// class info_notnull: base_mapentity
// {
@@ -49,3 +51,4 @@ Never used in the or
info_notnull_init (self);
};
// };
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/info/null.qc
diff --git a/qc/info/null.qc b/qc/info/null.qc
index 0fb0430..28a7155 100644
--- a/qc/info/null.qc
+++ b/qc/info/null.qc
@@ -6,18 +6,20 @@
// forward declarations
//======================================================================
+#ifdef SSQC
// info_null
entity(entity src, vector org) spawn_info_null;
void(entity e) info_null_init;
void() info_null;
+#endif
//------------------------------------------------------------------------------
+#ifdef SSQC
/*QUAKED info_null (0 0.5 0) (-4 -4 -4) (4 4 4) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Used as a positional target for spotlights, etc.
*/
-
//----------------------------------------------------------------------
// class info_null: base_mapentity
// {
@@ -37,6 +39,8 @@ Used as a positional target for spotlights, etc.
base_mapentity_init (e);
e.classname = "info_null";
e.classtype = CT_INFO_NULL;
+
+ // lol -- CEV
remove (self);
};
@@ -50,3 +54,4 @@ Used as a positional target for spotlights, etc.
info_null_init (self);
};
// };
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/info/path_corner.qc
diff --git a/qc/info/path_corner.qc b/qc/info/path_corner.qc
index 5c5b038..8122fc4 100644
--- a/qc/info/path_corner.qc
+++ b/qc/info/path_corner.qc
@@ -6,14 +6,17 @@
// forward declarations
//======================================================================
+#ifdef SSQC
void() path_corner_movetarget_touch;
void(entity e) path_corner_movetarget_init;
entity(entity src, vector org) spawn_path_corner;
void(entity e) path_corner_init;
void() path_corner;
+#endif
//------------------------------------------------------------------------------
+#ifdef SSQC
/*QUAKED path_corner (0.5 0.3 0) (-8 -8 -8) (8 8 8)
Monsters will continue walking towards the next target corner.
*/
@@ -42,8 +45,8 @@ Monsters will continue walking towards the next target corner.
other = stemp;
if (self.classtype == CT_MONSTER_OGRE)
- // chainsaw drag sound -- sound_custom -- dumptruck_ds
- sound_misc (self, CHAN_VOICE, "ogre/ogdrag.wav",
+ // chainsaw drag sound -- dumptruck_ds
+ sound (self, CHAN_VOICE, "ogre/ogdrag.wav",
VOL_HIGH, ATTN_IDLE);
// dprint ("t_movetarget\n");
@@ -133,3 +136,4 @@ Monsters will continue walking towards the next target corner.
path_corner_init (self);
};
// };
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/info/rotate.qc
diff --git a/qc/info/rotate.qc b/qc/info/rotate.qc
index f1596f4..20108e5 100644
--- a/qc/info/rotate.qc
+++ b/qc/info/rotate.qc
@@ -3,27 +3,52 @@
//==============================================================================
//======================================================================
-// Rotate QuickC program
-// By Jim Dose' 10/17/96
-// Copyright (c)1996 Hipnotic Interactive, Inc.
-// All rights reserved.
-// Distributed (unsupported) on 3.12.97
-//======================================================================
-
-//======================================================================
// forward declarations
//======================================================================
+#ifdef SSQC
+void() info_rotate_axis;
+#endif
+
+#ifdef SSQC
entity(entity src, vector org) spawn_info_rotate;
void(entity e) info_rotate_init;
void() info_rotate;
+#endif
//------------------------------------------------------------------------------
+//----------------------------------------------------------------------
+// From MG1's rotate.qc -- CEV
+//----------------------------------------------------------------------
+
+#ifdef SSQC
+/*QUAKED info_rotate (0.4 1.0 0.6) (-8 -8 -8) (8 8 8)
+Used to indicate center of rotation.
+*/
+//----------------------------------------------------------------------
+// class info_rotate: base_mapentity
+// {
+ //--------------------------------------------------------------
+ void() info_rotate_axis =
+ {
+ remove (self);
+ };
+// }
+#endif
+
+//----------------------------------------------------------------------
+// Rotate QuickC program
+// By Jim Dose' 10/17/96
+// Copyright (c)1996 Hipnotic Interactive, Inc.
+// All rights reserved.
+// Distributed (unsupported) on 3.12.97
+//----------------------------------------------------------------------
+
+#ifdef SSQC
/*QUAKED info_rotate (0 0.5 0) (-4 -4 -4) (4 4 4) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Used as the point of rotation for rotatable objects.
*/
-
//----------------------------------------------------------------------
// class info_rotate: base_mapentity
// {
@@ -59,3 +84,4 @@ Used as the point of rotation for rotatable objects.
info_rotate_init (self);
};
// };
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/info/spawnpoints.qc
diff --git a/qc/info/spawnpoints.qc b/qc/info/spawnpoints.qc
index 7a5d355..411ddcc 100644
--- a/qc/info/spawnpoints.qc
+++ b/qc/info/spawnpoints.qc
@@ -6,45 +6,57 @@
// forward declarations
//======================================================================
+#ifdef SSQC
// info_player_start
entity(entity src, vector org) spawn_info_player_start;
void(entity e) info_player_start_init;
void() info_player_start;
+#endif
+#ifdef SSQC
// info_player_start2
entity(entity src, vector org) spawn_info_player_start2;
void(entity e) info_player_start2_init;
void() info_player_start2;
+#endif
+#ifdef SSQC
// testplayerstart
entity(entity src, vector org) spawn_testplayerstart;
void(entity e) testplayerstart_init;
void() testplayerstart;
+#endif
+#ifdef SSQC
// info_player_coop
entity(entity src, vector org) spawn_info_player_coop;
void(entity e) info_player_coop_init;
void() info_player_coop;
+#endif
+#ifdef SSQC
// info_monster_spawnpoint
entity(entity src, vector org) spawn_info_monster_spawnpoint;
void(entity e) info_monster_spawnpoint_init;
void() info_monster_spawnpoint;
+#endif
+#ifdef SSQC
// info_player_deathmatch
entity(entity src, vector org) spawn_info_player_deathmatch;
void(entity e) info_player_deathmatch_init;
void() info_player_deathmatch;
+#endif
//------------------------------------------------------------------------------
+#ifdef SSQC
/*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ("progs/player.mdl");
}
The normal starting point for a level.
*/
-
//----------------------------------------------------------------------
// class info_player_start: base_mapentity
// {
@@ -76,14 +88,15 @@ The normal starting point for a level.
info_player_start_init (self);
};
// };
+#endif
+#ifdef SSQC
/*QUAKED info_player_start2 (1 0 0) (-16 -16 -24) (16 16 24) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ("progs/player.mdl");
}
Only used on start map for the return point from an episode.
*/
-
//----------------------------------------------------------------------
// class info_player_start2: base_mapentity
// {
@@ -115,11 +128,13 @@ Only used on start map for the return point from an episode.
info_player_start2_init (self);
};
// };
+#endif
//----------------------------------------------------------------------
// testplayerstart -- saved out by quaked in region mode
//----------------------------------------------------------------------
+#ifdef SSQC
//----------------------------------------------------------------------
// class testplayerstart: base_mapentity
// {
@@ -151,14 +166,15 @@ Only used on start map for the return point from an episode.
testplayerstart_init (self);
};
// };
+#endif
+#ifdef SSQC
/*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 24) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ("progs/player.mdl");
}
potential spawning position for coop games
*/
-
//----------------------------------------------------------------------
// class info_player_coop: base_mapentity
// {
@@ -190,14 +206,15 @@ potential spawning position for coop games
info_player_coop_init (self);
};
// };
+#endif
+#ifdef SSQC
/*QUAKED info_monster_spawnpoint (1 0 1) (-16 -16 -24) (16 16 24) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ("progs/teleport.mdl");
}
spawning position for func_monster_spawner
*/
-
//----------------------------------------------------------------------
// class info_monster_spawnpoint: base_mapentity
// {
@@ -229,14 +246,15 @@ model ("progs/teleport.mdl");
info_monster_spawnpoint_init (self);
};
// };
+#endif
+#ifdef SSQC
/*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ("progs/player.mdl");
}
potential spawning position for deathmatch games
*/
-
//----------------------------------------------------------------------
// class info_player_deathmatch: base_mapentity
// {
@@ -256,11 +274,6 @@ potential spawning position for deathmatch games
base_mapentity_init (e);
e.classname = "info_player_deathmatch";
e.classtype = CT_INFO_PLAYER_DEATHMATCH;
- e.alpha = 0.2;
- e.model = "progs/player.mdl";
- // $axstnd1 is 17.0 -- CEV
- e.frame = 17.0;
- setmodel (e, e.model);
};
//--------------------------------------------------------------
@@ -273,3 +286,4 @@ potential spawning position for deathmatch games
info_player_deathmatch_init (self);
};
// };
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/info/teleport_changedest.qc
diff --git a/qc/info/teleport_changedest.qc b/qc/info/teleport_changedest.qc
index cc1023f..250aa83 100644
--- a/qc/info/teleport_changedest.qc
+++ b/qc/info/teleport_changedest.qc
@@ -6,14 +6,17 @@
// forward declarations
//======================================================================
+#ifdef SSQC
void() info_teleport_changedest_use;
entity(entity src, vector org, string tname, string t, string m)
spawn_info_teleport_changedest;
void(entity e) info_teleport_changedest_init;
void() info_teleport_changedest;
+#endif
//------------------------------------------------------------------------------
+#ifdef SSQC
/*QUAKED info_teleport_changedest (0 0.5 0) (-4 -4 -4) (4 4 4) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Allows a mapper to change the target of a teleport_trigger. Useful in maps where
the player may fall into a void and the mapper wants to update where they "respawn"
@@ -22,7 +25,6 @@ target = trigger_teleport to change
message = new info_teleport_destination's targetname to switch to
targetname = name of this entity so we can use it
*/
-
//----------------------------------------------------------------------
// class info_teleport_changedest: base_mapentity
// {
@@ -51,12 +53,15 @@ targetname = name of this entity so we can use it
trig = find (world, targetname, self.target);
if (!trig || trig.classtype != CT_TRIGGER_TELEPORT)
{
- dprint ("\b[TELEPORT_DESTCHANGE]\b ");
- dprint ("Cannot find trigger_teleport\n");
+ dprint ("info_teleport_changedest_use: cannot find "
+ "trigger_teleport!\n");
return;
}
- trig.goalentity = find (world, ::targetname, self.message);
+ // TODO CEV commented out the following block, let
+ // trigger_teleport_think_findtarget do the work
+ #if 0
+ trig.goalentity = find (world, targetname, self.message);
if (!trig.goalentity)
{
dprint ("\b[TELEPORT_DESTCHANGE]\b ");
@@ -68,9 +73,12 @@ targetname = name of this entity so we can use it
trig.goalentity.movedir = v_forward;
trig.goalentity.pos1 = trig.goalentity.origin + 32 *
trig.goalentity.movedir;
+ #endif
// dumptruck_ds see comment above
trig.target = self.message;
+ trig.think = trigger_teleport_think_findtarget;
+ trig.nextthink = time + 0.1;
};
//--------------------------------------------------------------
@@ -96,22 +104,21 @@ targetname = name of this entity so we can use it
if (e.targetname == "")
{
- dprint ("\b[ERROR]\b info_teleport_changedest ");
- dprint ("with no targetname\n");
+ dprint ("info_teleport_changedest_init: "
+ "no targetname!\n");
remove (e);
}
if (e.target == "")
{
- dprint ("\b[ERROR]\b info_teleport_changedest ");
- dprint ("with no target\n");
+ dprint ("info_teleport_changedest_init: no target!\n");
remove (e);
}
if (e.message == "")
{
- dprint ("\b[ERROR]\b info_teleport_changedest ");
- dprint ("with no message set for new destination\n");
+ dprint ("info_teleport_changedest_init: no message "
+ "set for new destination!\n");
remove (e);
}
@@ -128,3 +135,4 @@ targetname = name of this entity so we can use it
info_teleport_changedest_init (self);
};
// };
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/info/teleport_destination.qc
diff --git a/qc/info/teleport_destination.qc b/qc/info/teleport_destination.qc
index d1d169a..419da95 100644
--- a/qc/info/teleport_destination.qc
+++ b/qc/info/teleport_destination.qc
@@ -3,21 +3,49 @@
//==============================================================================
//======================================================================
+// constants
+//======================================================================
+
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+// info_teleport_destination spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_INFO_TELEPORT_DESTINATION_DROP = 1
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024, // base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_IN_COOP = 4096,// see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_IN_SP = 8192, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768,// see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536,// see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} info_teleport_destination_spawnflags;
+#endif
+
+//======================================================================
// forward declarations
//======================================================================
+#ifdef SSQC
// info_teleport_destination
entity(entity src, vector org, string tname) spawn_info_teleport_destination;
void(entity e) info_teleport_destination_init;
void() info_teleport_destination;
+#endif
+#ifdef SSQC
// info_teleport_random
entity(entity src, vector org) spawn_info_teleport_random;
void(entity e) info_teleport_random_init;
void() info_teleport_random;
+#endif
//------------------------------------------------------------------------------
+#ifdef SSQC
/*QUAKED info_teleport_destination (.5 .5 .5) (-8 -8 -8) (8 8 32) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ("progs/player.mdl");
@@ -25,7 +53,6 @@ model ("progs/player.mdl");
This is the destination marker for a teleporter. It should have a "targetname"
field with the same value as a teleporter's "target" field.
*/
-
//----------------------------------------------------------------------
// class info_teleport_destination: base_mapentity
// {
@@ -54,24 +81,25 @@ field with the same value as a teleporter's "target" field.
e.mangle = e.angles;
e.angles = '0 0 0';
e.model = "";
+ setsize (e, VEC_HULL_MIN, VEC_HULL_MAX);
- // drop teleporter exit to the floor if it's PM_TELEDROP units
- // away -- CEV
- end = e.origin + PM_TELEDROP;
- tracebox (e.origin, e.mins, e.maxs, end, FALSE, e);
- if (trace_allsolid || trace_startsolid || trace_fraction < 1)
- {
- droptofloor ();
- // bump origin so player won't exit into floor -- CEV
- // This was '0 0 24' but that was causing issues -- CEV
+ if (known_release != KNOWN_RELEASE_QUAKE3)
+ if (known_release != KNOWN_RELEASE_CPMA)
+ if (known_release != KNOWN_RELEASE_QUAKELIVE)
+ // standard id1 offset from floor -- CEV
e.origin = e.origin + '0 0 27';
- }
- else
+
+ if (e.spawnflags & SPAWNFLAG_INFO_TELEPORT_DESTINATION_DROP)
{
- // instead apply the standard fixed Z offset -- CEV
- e.origin = e.origin + '0 0 27';
+ // drop if flagged to do so -- CEV
+ local entity oself = self;
+ self = e;
+ droptofloor ();
+ self = oself;
}
+ setorigin (e, e.origin);
+
if (!e.targetname)
if (e.target != __NULL__ && e.target != "")
// quake 3 compat -- CEV
@@ -90,14 +118,15 @@ field with the same value as a teleporter's "target" field.
info_teleport_destination_init (self);
};
// };
+#endif
+#ifdef SSQC
/*QUAKED info_teleport_random (.5 .5 .5) (-8 -8 -8) (8 8 32) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ("progs/player.mdl");
}
This is a random destination marker for a teleporter.
*/
-
//----------------------------------------------------------------------
// class info_teleport_random: base_mapentity
// {
@@ -135,3 +164,4 @@ This is a random destination marker for a teleporter.
info_teleport_random_init (self);
};
// };
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/items/ammo.qc
diff --git a/qc/items/ammo.qc b/qc/items/ammo.qc
index f4072f4..c0c920e 100644
--- a/qc/items/ammo.qc
+++ b/qc/items/ammo.qc
@@ -7,7 +7,33 @@
//======================================================================
#ifdef SSQC
-const float WEAPON_BIG2 = 1;
+//----------------------------------------------------------------------
+// ammo spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_ITEM_AMMO_LARGE_BOX = 1 // large box
+ // SPAWNFLAG_ITEM_SPAWNSILENT = 32, // see base_item.qc -- CEV
+ // SPAWNFLAG_ITEM_SPAWNED = 64, // see base_item.qc -- CEV
+ // SPAWNFLAG_ITEM_SUSPENDED = 128, // see base_item.qc -- CEV
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+ // SPAWNFLAG_ITEM_RESPAWN = 2097152, // see base_item.qc -- CEV
+ // SPAWNFLAG_ITEM_THROWN = 4194304, // see base_item.qc -- CEV
+ // SPAWNFLAG_ITEM_DONTDROP = 8388608 // see base_item.qc -- CEV
+} base_item_ammo_spawnflags;
+#endif
+
+#ifdef SSQC
+const float ITEM_AMMO_DAMAGE_SMALL = 10;// damage a small box deals when thrown
+const float ITEM_AMMO_DAMAGE_LARGE = 15;// same, but for large ammo boxes
const float AMMO_RESPAWN_TIME = 30; // ammo respawn time; id1 30s
const float AMMO_CELLS_SMALL = 6; // id1 6; small box of cells
@@ -28,160 +54,305 @@ const float AMMO_SHELLS_MAX = 100; // id1 maximum 100
// forward declarations
//======================================================================
-#ifdef SSQC
// base_item_ammo
-entity(entity src, vector org, float flags, void(entity) initfn)
+#ifdef SSQC
+// BASE_ITEM_AMMO_ADDAMMO(p, idx)
+entity(entity src, vector org, vector vel, float fl, void(entity) initfn)
spawn_item_ammo_n;
+void(entity grabber, entity ammo) base_item_ammo_grab;
+void(entity attacker, float item_index) base_item_ammo_fire;
void() base_item_ammo_touch;
+void(string key, string value) base_item_ammo_init_field;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) base_item_ammo_init;
+#endif
+#ifdef SSQC
strip void() base_item_ammo;
#endif
-#ifdef SSQC
// item_shells
-entity(entity src, vector org, float flags) spawn_item_shells;
+#ifdef CSQC
+void(float isnew) item_shells_netreceive;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_item_shells;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) item_shells_init;
+#endif
+#ifdef SSQC
void() item_shells;
#endif
-#ifdef SSQC
// item_spikes
-entity(entity src, vector org, float flags) spawn_item_spikes;
+#ifdef CSQC
+void(float isnew) item_spikes_netreceive;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_item_spikes;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) item_spikes_init;
+#endif
+#ifdef SSQC
void() item_spikes;
#endif
-#ifdef SSQC
// item_rockets
-entity(entity src, vector org, float flags) spawn_item_rockets;
+#ifdef CSQC
+void(float isnew) item_rockets_netreceive;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_item_rockets;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) item_rockets_init;
+#endif
+#ifdef SSQC
void() item_rockets;
#endif
-#ifdef SSQC
// item_cells
-entity(entity src, vector org, float flags) spawn_item_cells;
+#ifdef CSQC
+void(float isnew) item_cells_netreceive;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_item_cells;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) item_cells_init;
+#endif
+#ifdef SSQC
void() item_cells;
#endif
//------------------------------------------------------------------------------
-#ifdef SSQC
//----------------------------------------------------------------------
// class base_item_ammo: base_item
// {
+#ifdef SSQC
+ //--------------------------------------------------------------
+ #define BASE_ITEM_AMMO_ADDAMMO(p, idx) \
+ { \
+ switch (idx) \
+ { \
+ case ITEM_SEQ_AMMO_SHELLS_SMALL: \
+ if (p.ammo_shells >= AMMO_SHELLS_MAX) \
+ return; \
+ p.ammo_shells += AMMO_SHELLS_SMALL; \
+ break; \
+ case ITEM_SEQ_AMMO_SHELLS_LARGE: \
+ if (p.ammo_shells >= AMMO_SHELLS_MAX) \
+ return; \
+ p.ammo_shells += AMMO_SHELLS_BIG; \
+ break; \
+ case ITEM_SEQ_AMMO_NAILS_SMALL: \
+ if (p.ammo_nails >= AMMO_NAILS_MAX) \
+ return; \
+ p.ammo_nails += AMMO_NAILS_SMALL; \
+ break; \
+ case ITEM_SEQ_AMMO_NAILS_LARGE: \
+ if (p.ammo_nails >= AMMO_NAILS_MAX) \
+ return; \
+ p.ammo_nails += AMMO_NAILS_BIG; \
+ break; \
+ case ITEM_SEQ_AMMO_ROCKETS_SMALL: \
+ if (p.ammo_rockets >= AMMO_ROCKETS_MAX) \
+ return; \
+ p.ammo_rockets += AMMO_ROCKETS_SMALL; \
+ break; \
+ case ITEM_SEQ_AMMO_ROCKETS_LARGE: \
+ if (p.ammo_rockets >= AMMO_ROCKETS_MAX) \
+ return; \
+ p.ammo_rockets += AMMO_ROCKETS_BIG; \
+ break; \
+ case ITEM_SEQ_AMMO_CELLS_SMALL: \
+ if (p.ammo_cells >= AMMO_CELLS_MAX) \
+ return; \
+ p.ammo_cells += AMMO_CELLS_SMALL; \
+ break; \
+ case ITEM_SEQ_AMMO_CELLS_LARGE: \
+ if (p.ammo_cells >= AMMO_CELLS_MAX) \
+ return; \
+ p.ammo_cells += AMMO_CELLS_BIG; \
+ break; \
+ } \
+ }
+
//--------------------------------------------------------------
- entity(entity src, vector org, float flags, void(entity) initfn)
- spawn_item_ammo_n =
+ entity(entity src, vector org, vector vel, float fl,
+ void(entity) initfn) spawn_item_ammo_n =
{
local entity e = spawn ();
e.owner = src;
+ e.spawnflags = fl;
e.origin = org;
- e.spawnflags = flags;
+ e.velocity = vel;
initfn (e);
return e;
};
//--------------------------------------------------------------
+ // base_item_ammo_grab -- player has 'grabbed' the item -- CEV
+ //--------------------------------------------------------------
+ void(entity grabber, entity ammo) base_item_ammo_grab =
+ {
+ BASE_ITEM_INVENTORY_ADD (ammo, grabber)
+
+ // don't re-grab / immediately throw the item -- CEV
+ if (grabber.button6)
+ grabber.flags |= FL_THROW_HELD;
+
+ // let the player know -- CEV
+ sprint (grabber, sprintf("%s grabbed the %s\n",
+ grabber.netname, ammo.netname));
+
+ // let the client (CSQC) know -- CEV
+ if (grabber.classtype == CT_PLAYER && grabber.SendEntity)
+ grabber.SendFlags |= NETFLAG_PLAYER_WEAPON;
+
+ // fire all targets / killtargets
+ local entity stemp = self;
+ local entity otemp = other;
+ other = grabber;
+ self = ammo;
+ activator = other;
+ sub_usetargets ();
+ self = stemp;
+ other = otemp;
+
+ // either remove the item or set up for respawning -- CEV
+ BASE_ITEM_CHECKREMOVE (ammo,
+ AMMO_RESPAWN_TIME, AMMO_RESPAWN_TIME)
+ };
+
+ //--------------------------------------------------------------
+ // base_item_ammo_fire
+ // player has pressed +attack while holding the item -- CEV
+ //--------------------------------------------------------------
+ void(entity attacker, float item_index) base_item_ammo_fire =
+ {
+ // open the ammo box, add the ammo -- CEV
+ BASE_ITEM_AMMO_ADDAMMO (attacker, item_index)
+
+ // restrict ammo to game maximums -- CEV
+ base_entity_boundammo (attacker);
+
+ // now remove the ammo box from the inventory -- CEV
+ BASE_ITEM_INVENTORY_REMOVE (attacker)
+
+ // make sure the client knows -- CEV
+ if (attacker.classtype == CT_PLAYER && attacker.SendEntity)
+ attacker.SendFlags |= NETFLAG_PLAYER_AMMO |
+ NETFLAG_PLAYER_WEAPON;
+
+ // and make sure the player knows -- CEV
+ local item_info_t item = item_info[item_index];
+ BASE_ITEM_PICKUPMESSAGE (attacker, item, CHAN_ITEM_AMMO)
+ };
+
+ //--------------------------------------------------------------
// was ammo_touch -- CEV
//--------------------------------------------------------------
void() base_item_ammo_touch =
{
- local float best = 0;
+ // thrown item check -- CEV
+ if (base_item_touch_projectile())
+ return;
+ // proceed with normal SOLID_TRIGGER ammobox touch -- CEV
if (sub_checkvalidtouch(other) == FALSE)
return;
- // if the player was using his best weapon, change up to
- // the new one if better
- if (other.classtype == CT_PLAYER &&
- autocvar(cg_autoswitch, TRUE))
- {
- best = sub_runfloatas (other, player_best_weapon);
- }
-
- // shotgun
- if (self.weapon == 1)
+ // ...except for this:
+ // don't touch() if the player isn't holding a weapon -- CEV
+ BASE_ENTITY_WEAPONLOOKUP (other)
+ if (item_index < ITEM_SEQ_W_START||item_index > ITEM_SEQ_W_END)
{
- if (other.ammo_shells >= AMMO_SHELLS_MAX)
- return;
- other.ammo_shells += self.aflag;
- }
-
- // spikes
- if (self.weapon == 2)
- {
- if (other.ammo_nails >= AMMO_NAILS_MAX)
- return;
- other.ammo_nails += self.aflag;
- }
-
- // rockets
- if (self.weapon == 3)
- {
- if (other.ammo_rockets >= AMMO_ROCKETS_MAX)
+ if (item_index == ITEM_SEQ_HANDS && other.button6 &&
+ !(other.flags & FL_THROW_HELD))
+ {
+ // self.attack_finished = time + 0.5;
+ base_item_ammo_grab (other, self);
return;
- other.ammo_rockets += self.aflag;
- }
-
- // cells
- if (self.weapon == 4)
- {
- if (other.ammo_cells >= AMMO_CELLS_MAX)
+ }
+ else
+ {
return;
- other.ammo_cells += self.aflag;
+ }
}
- bound_entity_ammo (other);
+ // add the ammo -- CEV
+ BASE_ITEM_AMMO_ADDAMMO (other, self.weapon)
- sprint (other, sprintf("You got the %s\n", self.netname));
- // ammo touch sound
- sound (other, CHAN_ITEM, "items/ammo_pickup.ogg",
- VOL_MHI, ATTN_NORM);
- stuffcmd (other, "bf\n");
+ // restrict other's ammo if over max -- CEV
+ base_entity_boundammo (other);
- // change to a better weapon if appropriate
- if (other.classtype == CT_PLAYER && other.weapon == best &&
- autocvar(cg_autoswitch, TRUE))
- {
- other.weapon = sub_runfloatas (other,
- player_best_weapon);
- sub_runvoidas (other, player_set_current_ammo);
- }
-
- // if changed current ammo, update it
- if (other.classtype == CT_PLAYER)
- sub_runvoidas (other, player_set_current_ammo);
+ if (other.classtype == CT_PLAYER && other.SendEntity)
+ other.SendFlags |= NETFLAG_PLAYER_AMMO;
- // remove it in single player, or setup for respawning in DM
- self.solid = SOLID_NOT;
- self.model = __NULL__;
- base_item_check_respawn (self,
- AMMO_RESPAWN_TIME, AMMO_RESPAWN_TIME);
+ // let the player know -- CEV
+ local item_info_t item = item_info[self.weapon];
+ BASE_ITEM_PICKUPMESSAGE (other, item, CHAN_ITEM_AMMO)
- activator = other;
// fire all targets / killtargets
+ activator = other;
sub_usetargets ();
+
+ // either remove the item or set up for respawning -- CEV
+ BASE_ITEM_CHECKREMOVE (self,
+ AMMO_RESPAWN_TIME, AMMO_RESPAWN_TIME)
+ };
+
+ //--------------------------------------------------------------
+ void(string key, string value) base_item_ammo_init_field =
+ {
+ base_item_init_field (key, value);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) base_item_ammo_init =
{
e.classgroup |= CG_ITEM_AMMO;
+
+ local item_info_t item = item_info[e.weapon];
+
+ #ifdef SSQC
e.touch = base_item_ammo_touch;
+ precache_model (item.world_model);
+ precache_sound (item.pickup_sound);
+ setmodel (e, item.world_model);
+ #endif
+
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ #endif
+
+ e.noise = item.pickup_sound;
+ e.netname = item.name;
+
base_item_init (e);
+
+ #ifdef SSQC
+ // set up rotation -- CEV
+ BASE_ITEM_THROW_ROTATION (e, item)
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
strip void() base_item_ammo =
{
base_item_ammo_init (self);
};
-// };
#endif
+// };
-#ifdef SSQC
/*QUAKED item_shells (0 .5 .8) (0 0 0) (32 32 32) LARGE_BOX X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ( {{ spawnflags & 1 -> { "path" : "maps/b_shell1.bsp" }, "maps/b_shell0.bsp" }} );
@@ -192,79 +363,69 @@ LARGE_BOX is a box of 40 shells.
//----------------------------------------------------------------------
// class item_shells: base_item_ammo
// {
+#ifdef CSQC
//--------------------------------------------------------------
- entity(entity src, vector org, float flags) spawn_item_shells =
+ void(float isnew) item_shells_netreceive =
{
- return spawn_item_ammo_n (src, org, flags, item_shells_init);
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (item_shells_init)
};
+#endif
+#ifdef SSQC
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl) spawn_item_shells =
+ {
+ return spawn_item_ammo_n (src, org, vel, fl, item_shells_init);
+ };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) item_shells_init =
{
e.classname = "item_shells";
e.classtype = CT_ITEM_AMMO_SHELLS;
- if (e.spawnflags & WEAPON_BIG2)
+ #ifdef SSQC
+ if (e.spawnflags & SPAWNFLAG_ITEM_AMMO_LARGE_BOX)
{
- if (world.style)
- {
- // models courtesy Lunaran -- dumptruck_ds
- precache_body_model (e,
- "progs/ammo/m_shell2.mdl");
- body_model (e, "progs/ammo/m_shell2.mdl");
- }
- else
- {
- precache_body_model (e, "maps/b_shell1.bsp");
- body_model (e, "maps/b_shell1.bsp");
- }
-
+ e.weapon = ITEM_SEQ_AMMO_SHELLS_LARGE;
+ e.ammo_shells = AMMO_SHELLS_BIG;
+ e.dmg = ITEM_AMMO_DAMAGE_LARGE;
if !(e.particles_offset)
e.particles_offset = '16 16 16';
- e.aflag = AMMO_SHELLS_BIG;
}
else
{
- if (world.style)
- {
- // models courtesy Lunaran -- dumptruck_ds
- precache_body_model (e,
- "progs/ammo/m_shell1.mdl");
- body_model (e, "progs/ammo/m_shell1.mdl");
- }
- else
- {
- precache_body_model (e, "maps/b_shell0.bsp");
- body_model (e, "maps/b_shell0.bsp");
- }
-
+ e.weapon = ITEM_SEQ_AMMO_SHELLS_SMALL;
+ e.ammo_shells = AMMO_SHELLS_SMALL;
+ e.dmg = ITEM_AMMO_DAMAGE_SMALL;
if !(e.particles_offset)
e.particles_offset = '12 12 12';
- e.aflag = AMMO_SHELLS_SMALL;
}
+ #endif
- e.weapon = 1;
- e.netname = "shells";
e.pos1 = '0 0 0';
e.pos2 = '32 32 56';
// StartItem
base_item_ammo_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() item_shells =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (base_item_ammo_init_field)
item_shells_init (self);
};
-// };
#endif
+// };
-#ifdef SSQC
/*QUAKED item_spikes (0 .5 .8) (0 0 0) (32 32 32) LARGE_BOX X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ( {{ spawnflags & 1 -> { "path" : "maps/b_nail1.bsp" }, "maps/b_nail0.bsp" }} );
@@ -275,77 +436,69 @@ LARGE_BOX is a box of 50 nails.
//----------------------------------------------------------------------
// class item_spikes: base_item_ammo
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) item_spikes_netreceive =
+ {
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (item_spikes_init)
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
- entity(entity src, vector org, float flags) spawn_item_spikes =
+ entity(entity src, vector org, vector vel, float fl) spawn_item_spikes =
{
- return spawn_item_ammo_n (src, org, flags, item_spikes_init);
+ return spawn_item_ammo_n (src, org, vel, fl, item_spikes_init);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) item_spikes_init =
{
e.classname = "item_spikes";
e.classtype = CT_ITEM_AMMO_SPIKES;
- if (e.spawnflags & WEAPON_BIG2)
- {
- if (world.style)
- {
- // models courtesy Lunaran -- dumptruck_ds
- precache_body_model (e,
- "progs/ammo/m_nails2.mdl");
- body_model (e, "progs/ammo/m_nails2.mdl");
- }
- else
- {
- precache_body_model (e, "maps/b_nail1.bsp");
- body_model (e, "maps/b_nail1.bsp");
- }
+ #ifdef SSQC
+ if (e.spawnflags & SPAWNFLAG_ITEM_AMMO_LARGE_BOX)
+ {
+ e.weapon = ITEM_SEQ_AMMO_NAILS_LARGE;
+ e.ammo_nails = AMMO_NAILS_BIG;
+ e.dmg = ITEM_AMMO_DAMAGE_LARGE;
if !(e.particles_offset)
e.particles_offset = '16 16 16';
- e.aflag = AMMO_NAILS_BIG;
}
else
{
- if (world.style)
- {
- // models courtesy Lunaran -- dumptruck_ds
- precache_body_model (e,
- "progs/ammo/m_nails1.mdl");
- body_model (e, "progs/ammo/m_nails1.mdl");
- }
- else
- {
- precache_body_model (e, "maps/b_nail0.bsp");
- body_model (e, "maps/b_nail0.bsp");
- }
-
+ e.weapon = ITEM_SEQ_AMMO_NAILS_SMALL;
+ e.ammo_nails = AMMO_NAILS_SMALL;
+ e.dmg = ITEM_AMMO_DAMAGE_SMALL;
if !(e.particles_offset)
e.particles_offset = '12 12 12';
- e.aflag = AMMO_NAILS_SMALL;
}
- e.weapon = 2;
- e.netname = "nails";
+ #endif
+
e.pos1 = '0 0 0';
e.pos2 = '32 32 56';
// StartItem
base_item_ammo_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() item_spikes =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (base_item_ammo_init_field)
item_spikes_init (self);
};
-// };
#endif
+// };
-#ifdef SSQC
/*QUAKED item_rockets (0 .5 .8) (0 0 0) (32 32 32) LARGE_BOX X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ( {{ spawnflags & 1 -> { "path" : "maps/b_rock1.bsp" }, "maps/b_rock0.bsp" }} );
@@ -354,77 +507,70 @@ LARGE_BOX is a box of 50 nails.
//----------------------------------------------------------------------
// class item_rockets: base_item_ammo
// {
+#ifdef CSQC
//--------------------------------------------------------------
- entity(entity src, vector org, float flags) spawn_item_rockets =
+ void(float isnew) item_rockets_netreceive =
{
- return spawn_item_ammo_n (src, org, flags, item_rockets_init);
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (item_rockets_init)
};
+#endif
+#ifdef SSQC
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl)
+ spawn_item_rockets =
+ {
+ return spawn_item_ammo_n (src, org, vel, fl, item_rockets_init);
+ };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) item_rockets_init =
{
e.classname = "item_rockets";
e.classtype = CT_ITEM_AMMO_ROCKETS;
- if (e.spawnflags & WEAPON_BIG2)
- {
- if (world.style)
- {
- // models courtesy Lunaran -- dumptruck_ds
- precache_body_model (e,
- "progs/ammo/m_rock2.mdl");
- body_model (e, "progs/ammo/m_rock2.mdl");
- }
- else
- {
- precache_body_model (e, "maps/b_rock1.bsp");
- body_model (e, "maps/b_rock1.bsp");
- }
- e.particles_offset = '16 8 16';
- e.aflag = AMMO_ROCKETS_BIG;
+ #ifdef SSQC
+ if (e.spawnflags & SPAWNFLAG_ITEM_AMMO_LARGE_BOX)
+ {
+ e.weapon = ITEM_SEQ_AMMO_ROCKETS_LARGE;
+ e.ammo_rockets = AMMO_ROCKETS_BIG;
+ e.dmg = ITEM_AMMO_DAMAGE_LARGE;
+ if !(e.particles_offset)
+ e.particles_offset = '16 8 16';
}
else
{
- if (world.style)
- {
- // models courtesy Lunaran -- dumptruck_ds
- precache_body_model (e,
- "progs/ammo/m_rock1.mdl");
- body_model (e, "progs/ammo/m_rock1.mdl");
- }
- else
- {
- precache_body_model (e, "maps/b_rock0.bsp");
- body_model (e, "maps/b_rock0.bsp");
- }
-
+ e.weapon = ITEM_SEQ_AMMO_ROCKETS_SMALL;
+ e.ammo_rockets = AMMO_ROCKETS_SMALL;
+ e.dmg = ITEM_AMMO_DAMAGE_SMALL;
if !(e.particles_offset)
e.particles_offset = '8 8 16';
- e.aflag = AMMO_ROCKETS_SMALL;
}
+ #endif
- e.weapon = 3;
- e.netname = "rockets";
e.pos1 = '0 0 0';
e.pos2 = '32 32 56';
// StartItem
base_item_ammo_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() item_rockets =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (base_item_ammo_init_field)
item_rockets_init (self);
};
-// };
#endif
+// };
-#ifdef SSQC
/*QUAKED item_cells (0 .5 .8) (0 0 0) (32 32 32) LARGE_BOX X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ( {{ spawnflags & 1 -> { "path" : "maps/b_batt1.bsp" }, "maps/b_batt0.bsp" }} );
@@ -435,73 +581,65 @@ LARGE_BOX is a box of 12 cells.
//----------------------------------------------------------------------
// class item_cells: base_item_ammo
// {
+#ifdef CSQC
//--------------------------------------------------------------
- entity(entity src, vector org, float flags) spawn_item_cells =
+ void(float isnew) item_cells_netreceive =
{
- return spawn_item_ammo_n (src, org, flags, item_cells_init);
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (item_cells_init)
};
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl) spawn_item_cells =
+ {
+ return spawn_item_ammo_n (src, org, vel, fl, item_cells_init);
+ };
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) item_cells_init =
{
e.classname = "item_cells";
e.classtype = CT_ITEM_AMMO_CELLS;
- if (e.spawnflags & WEAPON_BIG2)
- {
- if (world.style)
- {
- // models courtesy Lunaran -- dumptruck_ds
- precache_body_model (e,
- "progs/ammo/m_cells2.mdl");
- body_model (e, "progs/ammo/m_cells2.mdl");
- }
- else
- {
- precache_body_model (e, "maps/b_batt1.bsp");
- body_model (e, "maps/b_batt1.bsp");
- }
+ #ifdef SSQC
+ if (e.spawnflags & SPAWNFLAG_ITEM_AMMO_LARGE_BOX)
+ {
+ e.weapon = ITEM_SEQ_AMMO_CELLS_LARGE;
+ e.ammo_cells = AMMO_CELLS_BIG;
+ e.dmg = ITEM_AMMO_DAMAGE_LARGE;
if !(e.particles_offset)
e.particles_offset = '16 16 16';
- e.aflag = AMMO_CELLS_BIG;
}
else
{
- if (world.style)
- {
- // models courtesy Lunaran -- dumptruck_ds
- precache_body_model (e,
- "progs/ammo/m_cells2.mdl");
- body_model (e, "progs/ammo/m_cells2.mdl");
- }
- else
- {
- precache_body_model (e, "maps/b_batt0.bsp");
- body_model (e, "maps/b_batt0.bsp");
- }
-
+ e.weapon = ITEM_SEQ_AMMO_CELLS_SMALL;
+ e.ammo_cells = AMMO_CELLS_SMALL;
+ e.dmg = ITEM_AMMO_DAMAGE_SMALL;
if !(e.particles_offset)
e.particles_offset = '12 12 12';
- e.aflag = AMMO_CELLS_SMALL;
}
+ #endif
- e.weapon = 4;
- e.netname = "cells";
e.pos1 = '0 0 0';
e.pos2 = '32 32 56';
// StartItem
base_item_ammo_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() item_cells =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (base_item_ammo_init_field)
item_cells_init (self);
};
-// };
#endif
+// };
Return to the top of this page or return to the overview of this repo.
Diff qc/items/armor.qc
diff --git a/qc/items/armor.qc b/qc/items/armor.qc
index 4fda159..6fe1956 100644
--- a/qc/items/armor.qc
+++ b/qc/items/armor.qc
@@ -21,6 +21,9 @@ const float ARMOR_RED_MAX = 225; // id1 225
const float ARMOR_SHARD_AMOUNT = 5; // Q3 5
+const float ARMOR_DAMAGE = 15; // damage armor deals when thrown
+const float ARMOR_DAMAGE_SHARD = 5; // damage a shard deals when thrown
+
const float ARMOR_RESPAWN_SP = 30; // id1 30s
const float ARMOR_RESPAWN_DM = 20; // id1 20s
#endif
@@ -29,57 +32,163 @@ const float ARMOR_RESPAWN_DM = 20; // id1 20s
// forward declarations
//======================================================================
-#ifdef SSQC
// base_item_armor
-entity(entity src, vector org, vector vel, void(entity) initfn)
+#ifdef SSQC
+// BASE_ITEM_ARMOR_ADDARMOR(p, idx)
+entity(entity src, vector org, vector vel, float fl, void(entity) initfn)
spawn_item_armor;
+void(entity grabber, entity armor) base_item_armor_grab;
+void(entity attacker, float item_index) base_item_armor_fire;
void() base_item_armor_touch;
+void(string key, string value) base_item_armor_init_field;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) base_item_armor_init;
+#endif
+#ifdef SSQC
strip void() base_item_armor;
#endif
-#ifdef SSQC
// item_armor1
-entity(entity src, vector org, vector vel) spawn_item_armor1;
+#ifdef CSQC
+void(float isnew) item_armor1_netreceive;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_item_armor1;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) item_armor1_init;
+#endif
+#ifdef SSQC
void() item_armor1;
#endif
-#ifdef SSQC
// item_armor2
-entity(entity src, vector org, vector vel) spawn_item_armor2;
+#ifdef CSQC
+void(float isnew) item_armor2_netreceive;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_item_armor2;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) item_armor2_init;
+#endif
+#ifdef SSQC
void() item_armor2;
#endif
-#ifdef SSQC
// item_armorInv
-entity(entity src, vector org, vector vel) spawn_item_armorInv;
+#ifdef CSQC
+void(float isnew) item_armorInv_netreceive;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_item_armorInv;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) item_armorInv_init;
+#endif
+#ifdef SSQC
void() item_armorInv;
#endif
-#ifdef SSQC
// item_armor_shard
-void() item_armor_shard_touch;
+#ifdef CSQC
+void(float isnew) item_armor_shard_netreceive;
+#endif
+#ifdef SSQC
entity(entity src) item_armor_shard_drop;
-entity(entity src, vector org, vector vel) spawn_item_armor_shard;
+entity(entity src, vector org, vector vel, float fl) spawn_item_armor_shard;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) item_armor_shard_init;
+#endif
+#ifdef SSQC
void() item_armor_shard;
#endif
//------------------------------------------------------------------------------
-#ifdef SSQC
//----------------------------------------------------------------------
// class base_item_armor: base_item
// {
+#ifdef SSQC
+ //--------------------------------------------------------------
+ #define BASE_ITEM_ARMOR_ADDARMOR(p, idx) \
+ { \
+ local float a_type, a_value, a_bit; \
+ /* silence a compiler warning -- CEV */ \
+ a_type = a_value = a_bit = 0; \
+ switch (idx) \
+ { \
+ case ITEM_SEQ_ARMOR_GREEN: \
+ /* green armor */ \
+ a_type = ARMOR_GREEN_ABSORB; \
+ a_value = ARMOR_GREEN_AMOUNT; \
+ a_bit = IT_ARMOR1; \
+ break; \
+ case ITEM_SEQ_ARMOR_YELLOW: \
+ /* yellow armor */ \
+ a_type = ARMOR_YELLOW_ABSORB; \
+ a_value = ARMOR_YELLOW_AMOUNT; \
+ a_bit = IT_ARMOR2; \
+ break; \
+ case ITEM_SEQ_ARMOR_RED: \
+ /* red armor */ \
+ a_type = ARMOR_RED_ABSORB; \
+ a_value = ARMOR_RED_AMOUNT; \
+ a_bit = IT_ARMOR3; \
+ break; \
+ case ITEM_SEQ_ARMOR_SHARD: \
+ a_value = p.armorvalue + ARMOR_SHARD_AMOUNT; \
+ if (p.items & IT_ARMOR2) \
+ { \
+ if (p.armorvalue >= ARMOR_YELLOW_MAX) \
+ return; \
+ if (a_value > ARMOR_YELLOW_MAX) \
+ a_value = ARMOR_YELLOW_MAX; \
+ a_type = ARMOR_YELLOW_ABSORB; \
+ a_bit = IT_ARMOR2; \
+ } \
+ else if (p.items & IT_ARMOR3) \
+ { \
+ if (p.armorvalue >= ARMOR_RED_MAX) \
+ return; \
+ if (a_value > ARMOR_RED_MAX) \
+ a_value = ARMOR_RED_MAX; \
+ a_type = ARMOR_RED_ABSORB; \
+ a_bit = IT_ARMOR3; \
+ } \
+ else \
+ { \
+ if (p.armorvalue >= ARMOR_GREEN_MAX) \
+ return; \
+ if (a_value > ARMOR_GREEN_MAX) \
+ a_value = ARMOR_GREEN_MAX; \
+ a_type = ARMOR_GREEN_ABSORB; \
+ a_bit = IT_ARMOR1; \
+ } \
+ break; \
+ default: \
+ dprint (sprintf("base_item_armor_touch: " \
+ "unknown armor type! seq %g, class " \
+ "%s!\n", idx, self.classname)); \
+ return; \
+ } \
+ if (p.armortype * p.armorvalue >= a_type * a_value) \
+ return; \
+ p.armortype = a_type; \
+ p.armorvalue = a_value; \
+ p.items = p.items - (p.items & \
+ (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + a_bit; \
+ }
+
//--------------------------------------------------------------
- entity(entity src, vector org, vector vel, void(entity) init_fn)
- spawn_item_armor =
+ entity(entity src, vector org, vector vel, float fl,
+ void(entity) init_fn) spawn_item_armor =
{
local entity e = spawn ();
e.owner = src;
+ e.spawnflags = fl;
e.origin = org;
e.velocity = vel;
init_fn (e);
@@ -87,97 +196,148 @@ void() item_armor_shard;
};
//--------------------------------------------------------------
+ void(entity grabber, entity armor) base_item_armor_grab =
+ {
+ BASE_ITEM_INVENTORY_ADD (armor, grabber)
+
+ sprint (grabber, sprintf("%s grabbed the %s\n",
+ grabber.netname, armor.netname));
+
+ // don't re-grab / immediately throw the item -- CEV
+ if (grabber.button6)
+ grabber.flags |= FL_THROW_HELD;
+
+ if (grabber.classtype == CT_PLAYER && grabber.SendEntity)
+ grabber.SendFlags |= NETFLAG_PLAYER_WEAPON;
+
+ // fire all targets / killtargets
+ local entity stemp = self;
+ local entity otemp = other;
+ other = grabber;
+ self = armor;
+ activator = other;
+ sub_usetargets ();
+ self = stemp;
+ other = otemp;
+
+ // remove or respawn -- CEV
+ BASE_ITEM_CHECKREMOVE (armor,
+ ARMOR_RESPAWN_SP, ARMOR_RESPAWN_DM)
+ };
+
+ //--------------------------------------------------------------
+ void(entity attacker, float item_index) base_item_armor_fire =
+ {
+ // add the armor -- CEV
+ BASE_ITEM_ARMOR_ADDARMOR (attacker, item_index)
+
+ // now remove the armor from inventory -- CEV
+ BASE_ITEM_INVENTORY_REMOVE (attacker)
+
+ // make sure the client knows -- CEV
+ if (attacker.classtype == CT_PLAYER && attacker.SendEntity)
+ attacker.SendFlags |= NETFLAG_PLAYER_ITEMS |
+ NETFLAG_PLAYER_HEALTH | NETFLAG_PLAYER_WEAPON;
+
+ // let the player know -- CEV
+ local item_info_t item = item_info[item_index];
+ BASE_ITEM_PICKUPMESSAGE (attacker, item, CHAN_ITEM_ARMOR)
+ };
+
+ //--------------------------------------------------------------
// was armor_touch -- CEV
//--------------------------------------------------------------
void() base_item_armor_touch =
{
- local float type, value, bit;
+ // thrown item check -- CEV
+ if (base_item_touch_projectile())
+ return;
if (sub_checkvalidtouch(other) == FALSE)
return;
- if (self.classtype == CT_ITEM_ARMOR_GREEN)
- {
- // green armor
- type = ARMOR_GREEN_ABSORB;
- value = ARMOR_GREEN_AMOUNT;
- bit = IT_ARMOR1;
- }
- else if (self.classtype == CT_ITEM_ARMOR_YELLOW)
- {
- // yellow armor
- type = ARMOR_YELLOW_ABSORB;
- value = ARMOR_YELLOW_AMOUNT;
- bit = IT_ARMOR2;
- }
- else if (self.classtype == CT_ITEM_ARMOR_RED)
+ // don't touch() if the player isn't holding a weapon -- CEV
+ BASE_ENTITY_WEAPONLOOKUP (other)
+ if (item_index < ITEM_SEQ_W_START||item_index > ITEM_SEQ_W_END)
{
- // red armor
- type = ARMOR_RED_ABSORB;
- value = ARMOR_RED_AMOUNT;
- bit = IT_ARMOR3;
- }
- else
- {
- dprint (sprintf("base_item_armor::do_touch: unknown "
- "classname %s!\n", self.classname));
- return;
+ if (item_index == ITEM_SEQ_HANDS && other.button6 &&
+ !(other.flags & FL_THROW_HELD))
+ {
+ // self.attack_finished = time + 0.5;
+ base_item_armor_grab (other, self);
+ return;
+ }
+ else
+ {
+ return;
+ }
}
- if (other.armortype * other.armorvalue >= type * value)
- return;
-
- other.armortype = type;
- other.armorvalue = value;
-
- other.items = other.items - (other.items &
- (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + bit;
-
- self.solid = SOLID_NOT;
- self.model = __NULL__;
- base_item_check_respawn (self,
- ARMOR_RESPAWN_SP, ARMOR_RESPAWN_DM);
-
- if (self.obit_name != __NULL__ && self.obit_name != "")
- // custom armor name
- sprint (other, sprintf("You got %s\n",
- self.obit_name));
- else
- sprint (other, "You got armor\n");
+ // add the armor -- CEV
+ BASE_ITEM_ARMOR_ADDARMOR (other, self.weapon)
- // armor touch sound
- // dumptruck_ds custom models and sounds START
- if (self.snd_misc != "")
- sound_misc (other, CHAN_ITEM, self.snd_misc,
- VOL_HIGH, ATTN_NORM);
- else
- sound_misc (other, CHAN_ITEM,"items/armor1.wav",
- VOL_HIGH, ATTN_NORM);
- // dumptruck_ds custom models and sounds END
+ // let the client (CSQC) know -- CEV
+ if (other.classtype == CT_PLAYER && other.SendEntity)
+ other.SendFlags |= NETFLAG_PLAYER_ITEMS |
+ NETFLAG_PLAYER_HEALTH;
- stuffcmd (other, "bf\n");
+ // let the player know -- CEV
+ local item_info_t item = item_info[self.weapon];
+ BASE_ITEM_PICKUPMESSAGE (other, item, CHAN_ITEM_ARMOR)
- activator = other;
// fire all targets / killtargets
+ activator = other;
sub_usetargets ();
+
+ // either remove the item or set up for respawning -- CEV
+ BASE_ITEM_CHECKREMOVE (self,
+ ARMOR_RESPAWN_SP, ARMOR_RESPAWN_DM)
+ };
+
+ //--------------------------------------------------------------
+ void(string key, string value) base_item_armor_init_field =
+ {
+ base_item_init_field (key, value);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) base_item_armor_init =
{
e.classgroup |= CG_ITEM_ARMOR;
+
+ local item_info_t item = item_info[e.weapon];
+
+ #ifdef SSQC
+ precache_model (item.world_model);
+ precache_sound (item.pickup_sound);
+ setmodel (e, item.world_model);
+ if (!e.skin)
+ e.skin = item.option;
+ #endif
+
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ e.modelflags |= MF_ROTATE;
+ #endif
+
+ e.noise = item.pickup_sound;
+ e.netname = item.name;
+
base_item_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
strip void() base_item_armor =
{
base_item_armor_init (self);
};
-// };
#endif
+// };
-#ifdef SSQC
/*QUAKED item_armor1 (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ("progs/armor.mdl");
@@ -186,96 +346,112 @@ model ("progs/armor.mdl");
//----------------------------------------------------------------------
// class item_armor1: base_item_armor
// {
+#ifdef CSQC
//--------------------------------------------------------------
- entity(entity src, vector org, vector vel) spawn_item_armor1 =
+ void(float isnew) item_armor1_netreceive =
{
- return spawn_item_armor (src, org, vel, item_armor1_init);
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (item_armor1_init)
};
+#endif
+#ifdef SSQC
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl) spawn_item_armor1 =
+ {
+ return spawn_item_armor (src, org, vel, fl, item_armor1_init);
+ };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) item_armor1_init =
{
e.classname = "item_armor1";
e.classtype = CT_ITEM_ARMOR_GREEN;
- e.touch = base_item_armor_touch;
- // dumptruck_ds custom models and sounds START
- precache_body_model (e, "progs/armor.mdl");
- // setmodel (e, "progs/armor.mdl");
- body_model (e, "progs/armor.mdl");
- precache_sound_misc (e, "items/armor1.wav");
- // dumptruck_ds custom models and sounds END
+ #ifdef SSQC
+ e.touch = base_item_armor_touch;
+ e.weapon = ITEM_SEQ_ARMOR_GREEN;
+ e.dmg = ARMOR_DAMAGE;
+ #endif
- if !(e.skin)
- e.skin = 0;
e.pos1 = '-16 -16 0';
e.pos2 = '16 16 56';
// StartItem
base_item_armor_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() item_armor1 =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (base_item_armor_init_field)
item_armor1_init (self);
};
-// };
#endif
+// };
-#ifdef SSQC
/*QUAKED item_armor2 (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model({ "path": ":progs/armor.mdl", "skin": 1 }); }
*/
//----------------------------------------------------------------------
// class item_armor2: base_item_armor
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) item_armor2_netreceive =
+ {
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (item_armor2_init)
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
- entity(entity src, vector org, vector vel) spawn_item_armor2 =
+ entity(entity src, vector org, vector vel, float fl) spawn_item_armor2 =
{
- return spawn_item_armor (src, org, vel, item_armor2_init);
+ return spawn_item_armor (src, org, vel, fl, item_armor2_init);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) item_armor2_init =
{
e.classname = "item_armor2";
e.classtype = CT_ITEM_ARMOR_YELLOW;
- e.touch = base_item_armor_touch;
- // dumptruck_ds custom models and sounds START
- precache_body_model (e, "progs/armor.mdl");
- // setmodel (e, "progs/armor.mdl");
- body_model (e, "progs/armor.mdl");
- // dumptruck_ds custom models and sounds END
+ #ifdef SSQC
+ e.touch = base_item_armor_touch;
+ e.weapon = ITEM_SEQ_ARMOR_YELLOW;
+ e.dmg = ARMOR_DAMAGE;
+ #endif
- if !(e.skin)
- e.skin = 1;
- precache_sound_misc (e, "items/armor1.wav");
e.pos1 = '-16 -16 0';
e.pos2 = '16 16 56';
// StartItem
base_item_armor_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() item_armor2 =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (base_item_armor_init_field)
item_armor2_init (self);
};
-// };
#endif
+// };
-#ifdef SSQC
/*QUAKED item_armorInv (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model({ "path": ":progs/armor.mdl", "skin": 2 });
@@ -284,143 +460,72 @@ model({ "path": ":progs/armor.mdl", "skin": 2 });
//----------------------------------------------------------------------
// class item_armorInv: base_item_armor
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) item_armorInv_netreceive =
+ {
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (item_armorInv_init)
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
- entity(entity src, vector org, vector vel) spawn_item_armorInv =
+ entity(entity src, vector org, vector vel, float fl)
+ spawn_item_armorInv =
{
- return spawn_item_armor (src, org, vel, item_armorInv_init);
+ return spawn_item_armor (src, org, vel, fl, item_armorInv_init);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) item_armorInv_init =
{
e.classname = "item_armorInv";
e.classtype = CT_ITEM_ARMOR_RED;
- e.touch = base_item_armor_touch;
- // dumptruck_ds custom models and sounds START
- precache_body_model (e, "progs/armor.mdl");
- // setmodel (e, "progs/armor.mdl");
- body_model (e, "progs/armor.mdl");
- // dumptruck_ds custom models and sounds END
+ #ifdef SSQC
+ e.touch = base_item_armor_touch;
+ e.weapon = ITEM_SEQ_ARMOR_RED;
+ e.dmg = ARMOR_DAMAGE;
+ #endif
- if !(e.skin)
- e.skin = 2;
- precache_sound_misc (e, "items/armor1.wav");
e.pos1 = '-16 -16 0';
e.pos2 = '16 16 56';
// StartItem
base_item_armor_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() item_armorInv =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (base_item_armor_init_field)
item_armorInv_init (self);
};
-// };
#endif
+// };
-#ifdef SSQC
//------------------------------------------------------------------------------
// item_armor_shard
//------------------------------------------------------------------------------
// class item_armor_shard: base_item_armor
// {
+#ifdef CSQC
//--------------------------------------------------------------
- // shard_touch -- this is from RMQ shard_touch
- //--------------------------------------------------------------
- void() item_armor_shard_touch =
+ void(float isnew) item_armor_shard_netreceive =
{
- local float bit;
-
- if (sub_checkvalidtouch(other) == FALSE)
- return;
-
- if ((other.items & IT_ARMOR1) || (other.items & IT_ARMOR2)
- || (other.items & IT_ARMOR3))
- {
- // has armor
- // Supa, check bounds, original armourvalue + 25
- if (other.items & IT_ARMOR1 &&
- other.armorvalue >= ARMOR_GREEN_MAX)
- {
- return;
- }
- if (other.items & IT_ARMOR2 &&
- other.armorvalue >= ARMOR_YELLOW_MAX)
- {
- return;
- }
- if (other.items & IT_ARMOR3 &&
- other.armorvalue >= ARMOR_RED_MAX)
- {
- return;
- }
-
- // was 2, RMQ team
- other.armorvalue = other.armorvalue +
- ARMOR_SHARD_AMOUNT;
-
- // Supa, now cap armourvalue to bounds
- if (other.items & IT_ARMOR1 &&
- other.armorvalue >= ARMOR_GREEN_MAX)
- {
- other.armorvalue = ARMOR_GREEN_MAX;
- }
- else if (other.items & IT_ARMOR2 &&
- other.armorvalue >= ARMOR_YELLOW_MAX)
- {
- other.armorvalue = ARMOR_YELLOW_MAX;
- }
- else if (other.items & IT_ARMOR3 &&
- other.armorvalue >= ARMOR_RED_MAX)
- {
- other.armorvalue = ARMOR_RED_MAX;
- }
- }
- else
- {
- // shard = Green armor level
- other.armortype = ARMOR_GREEN_ABSORB;
- other.armorvalue = ARMOR_SHARD_AMOUNT;
- bit = IT_ARMOR1;
- other.items = other.items - (other.items &
- (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + bit;
- }
-
- self.solid = SOLID_NOT;
- self.model = __NULL__;
- base_item_check_respawn (self,
- ARMOR_RESPAWN_SP, ARMOR_RESPAWN_DM);
-
- if (self.obit_name != __NULL__ && self.obit_name != "")
- // custom armor name
- sprint (other, sprintf("You got %s\n", self.obit_name));
- else
- sprint (other, "You got armor\n");
-
- // armor touch sound
- // dumptruck_ds custom models and sounds START
- if (self.snd_misc != "")
- sound_misc (other, CHAN_AUTO, self.snd_misc,
- VOL_HIGH, ATTN_NORM);
- else
- sound_misc (other, CHAN_AUTO,
- "items/shard_pickup.ogg", VOL_MID, ATTN_NORM);
-
- // dumptruck_ds custom models and sounds END
- stuffcmd (other, "bf\n");
-
- // fire all targets / killtargets
- activator = other;
- sub_usetargets ();
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (item_armor_shard_init)
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
entity(entity src) item_armor_shard_drop =
{
@@ -428,46 +533,48 @@ model({ "path": ":progs/armor.mdl", "skin": 2 });
vel_x = -100 + (random() * 200);
vel_y = -100 + (random() * 200);
vel_z = 300;
- return spawn_item_armor_shard (src, src.origin - '0 0 24', vel);
+ return spawn_item_armor_shard (src, src.origin - '0 0 24', vel,
+ SPAWNFLAG_ITEM_THROWN);
};
//--------------------------------------------------------------
- entity(entity src, vector org, vector vel) spawn_item_armor_shard =
+ entity(entity src, vector org, vector vel, float fl)
+ spawn_item_armor_shard =
{
- return spawn_item_armor (src, org, vel, item_armor_shard_init);
+ return spawn_item_armor (src, org, vel, fl,
+ item_armor_shard_init);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) item_armor_shard_init =
{
e.classname = "item_armor_shard";
e.classtype = CT_ITEM_ARMOR_SHARD;
- e.touch = item_armor_shard_touch;
- // dumptruck_ds custom models and sounds START
- precache_body_model (e, "progs/armshr.mdl");
- // setmodel (e, "progs/armor.mdl");
- body_model (e, "progs/armshr.mdl");
- precache_sound_misc (e, "items/armor_shard_q3.wav");
- // dumptruck_ds custom models and sounds END
+ #ifdef SSQC
+ e.touch = base_item_armor_touch;
+ e.weapon = ITEM_SEQ_ARMOR_SHARD;
+ e.dmg = ARMOR_DAMAGE_SHARD;
+ #endif
- if !(e.skin)
- e.skin = 0;
e.pos1 = '-16 -16 0';
e.pos2 = '16 16 56';
// StartItem
base_item_armor_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() item_armor_shard =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (base_item_armor_init_field)
item_armor_shard_init (self);
};
-// };
#endif
+// };
Return to the top of this page or return to the overview of this repo.
Diff qc/items/backpacks.qc
diff --git a/qc/items/backpacks.qc b/qc/items/backpacks.qc
index cf9118b..5b8444d 100644
--- a/qc/items/backpacks.qc
+++ b/qc/items/backpacks.qc
@@ -3,28 +3,58 @@
//==============================================================================
//======================================================================
-// constants -- dumptruck_ds
+// constants
//======================================================================
#ifdef SSQC
-const float BACKPACK_DEFAULT = 1;
-const float BACKPACK_SHELLS = 2;
-const float BACKPACK_NAILS = 4;
-const float BACKPACK_ROCKETS = 8;
-const float BACKPACK_CELLS = 16;
-const float BACKPACK_DROPPED = 32;
+//----------------------------------------------------------------------
+// backpack spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_ITEM_BACKPACK_DEFAULT = 1, // default logic
+ SPAWNFLAG_ITEM_BACKPACK_SHELLS = 2, // pack contains shells
+ SPAWNFLAG_ITEM_BACKPACK_NAILS = 4, // pack contains nails
+ SPAWNFLAG_ITEM_BACKPACK_ROCKETS = 8, // pack contains rockets
+ SPAWNFLAG_ITEM_BACKPACK_CELLS = 16, // pack contains cells
+ SPAWNFLAG_ITEM_BACKPACK_DROPPED = 32 // overlaps with SPAWNSILENT
+ // SPAWNFLAG_ITEM_SPAWNSILENT = 32, // see base_item.qc -- CEV
+ // SPAWNFLAG_ITEM_SPAWNED = 64, // see base_item.qc -- CEV
+ // SPAWNFLAG_ITEM_SUSPENDED = 128, // see base_item.qc -- CEV
+ // SPAWNFLAG_NOT_ON_EASY = 256, // next six see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+ // SPAWNFLAG_ITEM_RESPAWN = 2097152, // see base_item.qc -- CEV
+ // SPAWNFLAG_ITEM_THROWN = 4194304, // see base_item.qc -- CEV
+ // SPAWNFLAG_ITEM_DONTDROP = 8388608 // see base_item.qc -- CEV
+} item_backpack_spawnflags;
#endif
//======================================================================
// forward declarations
//======================================================================
-#ifdef SSQC
// item_backpack
+#ifdef CSQC
+void(float isnew) item_backpack_netreceive;
+#endif
+#ifdef SSQC
+// ITEM_BACKPACK_MESSAGE(field, name)
+void() item_backpack_think_groundcheck;
void() item_backpack_touch;
entity(entity src) item_backpack_drop;
entity(entity src, vector org, vector vel) spawn_item_backpack;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) item_backpack_init;
+#endif
+#ifdef SSQC
void() item_backpack;
#endif
@@ -32,7 +62,6 @@ void() item_backpack;
// Some of this text is from Drake -- dumptruck_ds
-#ifdef SSQC
/*QUAKED item_backpack (0 .5 .8) (-16 -16 0) (16 16 72) SHELLS NAILS ROCKETS CELLS X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model("progs/backpack.mdl"); }
By default, gives roughly half the ammo from the 4 standard pickups:
@@ -63,165 +92,200 @@ e.g. For 'You got a bunch of rockets!' the netname key would be
//----------------------------------------------------------------------
// class item_backpack: base_item
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) item_backpack_netreceive =
+ {
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (item_backpack_init)
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ #define ITEM_BACKPACK_MESSAGE(field, name) \
+ { \
+ if (self.field) \
+ { \
+ if (acount) \
+ s = sprintf ("%s, %d " name, s, self.field); \
+ else \
+ s = sprintf ("%s %d " name, s, self.field); \
+ acount += 1; \
+ } \
+ }
+
+ //--------------------------------------------------------------
+ void() item_backpack_think_groundcheck =
+ {
+ if (self.flags & FL_ONGROUND)
+ {
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
+ self.think = sub_remove;
+ self.nextthink = time + 120;
+ }
+ else
+ {
+ self.nextthink = time + 0.1;
+ }
+ };
+
//--------------------------------------------------------------
void() item_backpack_touch =
{
if (sub_checkvalidtouch(other) == FALSE)
return;
- // from Copper -- dumptruck_ds
- if (other.movetype == MOVETYPE_NOCLIP)
- return;
- if (other.classtype != CT_PLAYER)
- return;
- if (other.health <= 0)
- return;
-
- if (self.spawnflags & BACKPACK_DROPPED)
+ // don't touch if other isn't holding a weapon -- CEV
+ BASE_ENTITY_WEAPONLOOKUP (other)
+ if (item_index < ITEM_SEQ_W_START||item_index > ITEM_SEQ_W_END)
{
- local string s;
- local float acount, best, old, new;
+ if (item_index != ITEM_SEQ_HANDS)
+ return;
+ if (!other.button6 && (!(other.flags & FL_THROW_HELD)))
+ return;
+ }
- acount = 0;
- sprint (other, "You get ");
+ // add self.inventory1 (stored weapon) to other -- CEV
+ if (self.inventory1)
+ {
+ local float slot = 0;
- if (self.items)
+ // look up the default slot for this weapon -- CEV
+ switch (self.inventory1)
{
- if ((other.items & self.items) == 0)
- {
- acount = 1;
- sprint (other, "the ");
- sprint (other, self.netname);
- }
+ case ITEM_SEQ_AXE:
+ slot = ITEM_WEAPON_AXE;
+ break;
+ case ITEM_SEQ_SHOTGUN:
+ slot = ITEM_WEAPON_SHOTGUN;
+ break;
+ case ITEM_SEQ_SUPERSHOTGUN:
+ slot = ITEM_WEAPON_SUPERSHOTGUN;
+ break;
+ case ITEM_SEQ_NAILGUN:
+ slot = ITEM_WEAPON_NAILGUN;
+ break;
+ case ITEM_SEQ_SUPERNAILGUN:
+ slot = ITEM_WEAPON_SUPERNAILGUN;
+ break;
+ case ITEM_SEQ_GRENADELAUNCHER:
+ slot = ITEM_WEAPON_GRENADELAUNCHER;
+ break;
+ case ITEM_SEQ_ROCKETLAUNCHER:
+ slot = ITEM_WEAPON_ROCKETLAUNCHER;
+ break;
+ case ITEM_SEQ_LIGHTNINGGUN:
+ slot = ITEM_WEAPON_LIGHTNINGGUN;
+ break;
}
- // if the player was using his best weapon, change
- // up to the new one if better
- if (other.classtype == CT_PLAYER &&
- autocvar(cg_autoswitch, TRUE))
+ // now add the weapon if that slot is empty -- CEV
+ switch (slot)
{
- best = sub_runfloatas (other,
- player_best_weapon);
+ case 1:
+ if (other.inventory1 == ITEM_SEQ_HANDS)
+ other.inventory1 =
+ self.inventory1;
+ break;
+ case 2:
+ if (other.inventory2 == ITEM_SEQ_HANDS)
+ other.inventory2 =
+ self.inventory1;
+ break;
+ case 3:
+ if (other.inventory3 == ITEM_SEQ_HANDS)
+ other.inventory3 =
+ self.inventory1;
+ break;
+ case 4:
+ if (other.inventory4 == ITEM_SEQ_HANDS)
+ other.inventory4 =
+ self.inventory1;
+ break;
+ case 5:
+ if (other.inventory5 == ITEM_SEQ_HANDS)
+ other.inventory5 =
+ self.inventory1;
+ break;
+ case 6:
+ if (other.inventory6 == ITEM_SEQ_HANDS)
+ other.inventory6 =
+ self.inventory1;
+ break;
+ case 7:
+ if (other.inventory7 == ITEM_SEQ_HANDS)
+ other.inventory7 =
+ self.inventory1;
+ break;
+ case 8:
+ if (other.inventory8 == ITEM_SEQ_HANDS)
+ other.inventory8 =
+ self.inventory1;
+ break;
+ default:
+ dprint (sprintf("item_backpack_touch: "
+ "unknown slot for item index "
+ "%d!\n", self.inventory1));
+ break;
}
+ }
- // change weapons
- other.ammo_shells += self.ammo_shells;
- other.ammo_nails += self.ammo_nails;
- other.ammo_rockets += self.ammo_rockets;
- other.ammo_cells += self.ammo_cells;
+ // add ammo -- CEV
+ other.ammo_shells += self.ammo_shells;
+ other.ammo_nails += self.ammo_nails;
+ other.ammo_rockets += self.ammo_rockets;
+ other.ammo_cells += self.ammo_cells;
- new = self.items;
- if (!new)
- new = other.weapon;
- old = other.items;
- other.items = other.items | new;
+ // build the backpack message -- calls sprintf a lot -- CEV
+ local string s = sprintf ("%s gets", other.netname);
- bound_entity_ammo (other);
+ if (self.spawnflags & SPAWNFLAG_ITEM_BACKPACK_DROPPED)
+ {
+ local float acount = 0;
- // hack to fix an issue with custom Grunt, Ogre
- // and Enf ammo types. - dumptruck_ds
- // if (self.ammo_shells < 100)
- if (self.ammo_shells)
- {
- if (acount)
- sprint (other, ", ");
- acount = 1;
- s = ftos (self.ammo_shells);
- sprint (other, s);
- sprint (other, " shells");
- }
- if (self.ammo_nails)
- {
- if (acount)
- sprint (other, ", ");
- acount = 1;
- s = ftos (self.ammo_nails);
- sprint (other, s);
- sprint (other, " nails");
- }
- if (self.ammo_rockets)
- {
- if (acount)
- sprint (other, ", ");
- acount = 1;
- s = ftos (self.ammo_rockets);
- sprint (other, s);
- sprint (other, " rockets");
- }
- if (self.ammo_cells)
+ // include self.netname if an item is stored in
+ // inventory slot 1 -- CEV
+ if (self.inventory1)
{
- if (acount)
- sprint (other, ", ");
- acount = 1;
- s = ftos (self.ammo_cells);
- sprint (other, s);
- sprint (other, " cells");
+ s = sprintf ("%s the %s", s, self.netname);
+ acount += 1;
}
- sprint (other, "\n");
- // backpack touch sound
- sound (other, CHAN_ITEM, "items/backpack_pickup.wav",
- VOL_HIGH, ATTN_NORM);
- stuffcmd (other, "bf\n");
-
- if (other.classtype == CT_PLAYER)
- {
- // change to the weapon
- // 1997-12-23 Thunderbolt fix by Maddes start
- /*
- // don't separate between SinglePlayer/Coop
- // and Deathmatch
- if (!deathmatch)
- self.weapon = new;
- else
- */
- // 1997-12-23 Thunderbolt fix by Maddes end
-
- /*
- // TODO CEV
- self = other;
- Deathmatch_Weapon (old, new);
- PlayerSetCurrentAmmo ();
- */
- sub_runvoidas (other, player_set_current_ammo);
- }
+ // now do the ammo -- CEV
+ ITEM_BACKPACK_MESSAGE (ammo_shells, "shells")
+ ITEM_BACKPACK_MESSAGE (ammo_nails, "nails")
+ ITEM_BACKPACK_MESSAGE (ammo_rockets, "rockets")
+ ITEM_BACKPACK_MESSAGE (ammo_cells, "cells")
- // remove the backpack, change self to the player
- remove (self);
+ s = sprintf ("%s!\n", s);
}
else
{
- // item_backpack_message -- CEV
- other.ammo_shells += self.ammo_shells;
- other.ammo_nails += self.ammo_nails;
- other.ammo_rockets += self.ammo_rockets;
- other.ammo_cells += self.ammo_cells;
-
if (self.netname != "")
- {
- sprint (other, "You got ");
- sprint (other, self.netname);
- sprint (other, "\n");
- }
+ s = sprintf ("%s %s!\n", s, self.netname);
else
- {
- sprint (other, "You got a backpack!\n");
- }
+ s = sprintf ("%s a backpack!\n", s);
+ }
- // backpack touch sound
- // sound (other, CHAN_ITEM, "items/backpack_pickup.wav",
- // VOL_HIGH, ATTN_NORM);
- sound_misc (other, CHAN_ITEM, self.snd_misc,
- VOL_HIGH, ATTN_NORM);
- remove (self);
+ // print the backpack message -- CEV
+ sprint (other, s);
- if (other.classtype == CT_PLAYER)
- {
- stuffcmd (other, "bf\n");
- bound_entity_ammo (other);
- sub_runvoidas (other, player_set_current_ammo);
- }
+ // backpack touch sound
+ sound (other, CHAN_ITEM, self.noise, VOL_HIGH, ATTN_NORM);
+
+ // flash, bound ammo, & update CSQC clients -- CEV
+ if (other.classtype == CT_PLAYER)
+ {
+ stuffcmd (other, "bf\n");
+ base_entity_boundammo (other);
+ if (other.SendEntity)
+ other.SendFlags |= NETFLAG_PLAYER_AMMO |
+ NETFLAG_PLAYER_WEAPON |
+ NETFLAG_PLAYER_INVENTORY;
}
+
+ remove (self);
};
//--------------------------------------------------------------
@@ -246,25 +310,6 @@ e.g. For 'You got a bunch of rockets!' the netname key would be
pack = spawn_item_backpack (src, src.origin - '0 0 24', vel);
- if (pack.items == IT_AXE)
- pack.netname = "Axe";
- else if (pack.items == IT_SHOTGUN)
- pack.netname = "Shotgun";
- else if (pack.items == IT_SUPER_SHOTGUN)
- pack.netname = "Double-barrelled Shotgun";
- else if (pack.items == IT_NAILGUN)
- pack.netname = "Nailgun";
- else if (pack.items == IT_SUPER_NAILGUN)
- pack.netname = "Super Nailgun";
- else if (pack.items == IT_GRENADE_LAUNCHER)
- pack.netname = "Grenade Launcher";
- else if (pack.items == IT_ROCKET_LAUNCHER)
- pack.netname = "Rocket Launcher";
- else if (pack.items == IT_LIGHTNING)
- pack.netname = "Thunderbolt";
- else
- pack.netname = "";
-
return pack;
};
@@ -274,21 +319,42 @@ e.g. For 'You got a bunch of rockets!' the netname key would be
local entity e = spawn ();
e.owner = src;
e.origin = org;
- e.spawnflags = BACKPACK_DROPPED,
- e.items = src.weapon;
+ e.velocity = vel;
+ e.spawnflags = SPAWNFLAG_ITEM_BACKPACK_DROPPED,
+
+ // copy ammo values to the new backpack entity -- CEV
e.ammo_shells = src.ammo_shells;
e.ammo_nails = src.ammo_nails;
e.ammo_rockets = src.ammo_rockets;
e.ammo_cells = src.ammo_cells;
+
+ // if the source is a player & the player is holding a weapon
+ // then add that weapon to the backpack's inventory -- CEV
+ if (src.classtype == CT_PLAYER)
+ {
+ // creates item_index -- CEV
+ BASE_ENTITY_WEAPONLOOKUP (src)
+ if (item_index >= ITEM_SEQ_W_START &&
+ item_index <= ITEM_SEQ_W_END)
+ {
+ e.inventory1 = item_index;
+ }
+ }
+
+ // now we're clear to init the backpack -- CEV
item_backpack_init (e);
return e;
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) item_backpack_init =
{
e.classname = "item_backpack";
e.classtype = CT_ITEM_BACKPACK;
+
+ #ifdef SSQC
e.touch = item_backpack_touch;
e.flags = FL_ITEM;
e.solid = SOLID_TRIGGER;
@@ -301,7 +367,7 @@ e.g. For 'You got a bunch of rockets!' the netname key would be
return;
}
- if (e.spawnflags & BACKPACK_DEFAULT)
+ if (e.spawnflags & SPAWNFLAG_ITEM_BACKPACK_DEFAULT)
{
e.ammo_shells = 10;
e.ammo_nails = 12;
@@ -309,68 +375,114 @@ e.g. For 'You got a bunch of rockets!' the netname key would be
e.ammo_cells = 3;
}
- if (e.spawnflags & BACKPACK_SHELLS)
- {
+ if (e.spawnflags & SPAWNFLAG_ITEM_BACKPACK_SHELLS)
if (!e.ammo_shells)
e.ammo_shells = 10;
- }
- if (e.spawnflags & BACKPACK_NAILS)
- {
+
+ if (e.spawnflags & SPAWNFLAG_ITEM_BACKPACK_NAILS)
if (!e.ammo_nails)
e.ammo_nails = 12;
- }
- if (e.spawnflags & BACKPACK_ROCKETS)
- {
+
+ if (e.spawnflags & SPAWNFLAG_ITEM_BACKPACK_ROCKETS)
if (!e.ammo_rockets)
e.ammo_rockets = 2;
- }
- if (e.spawnflags & BACKPACK_CELLS)
- {
+
+ if (e.spawnflags & SPAWNFLAG_ITEM_BACKPACK_CELLS)
if (!e.ammo_cells)
e.ammo_cells = 3;
- }
-
- // set the custom noise in editor -- dumptruck_ds
- if (!e.snd_misc)
- e.snd_misc = "items/backpack_pickup.wav";
- precache_sound_misc (e, e.snd_misc);
- if (e.spawnflags & BACKPACK_DROPPED)
- {
- precache_body_model (e, "progs/backpack.mdl");
- // setmodel (e, "progs/backpack.mdl");
- body_model (e, "progs/backpack.mdl");
- }
+ if (e.spawnflags & SPAWNFLAG_ITEM_BACKPACK_DROPPED)
+ e.weapon = ITEM_SEQ_BACKPACK;
else
+ e.weapon = ITEM_SEQ_PD3BACKPACK;
+
+ if (e.inventory1) {
+ if (!e.netname || e.netname == "")
{
- precache_body_model (e, "progs/pd_bpack.mdl");
- body_model (e, "progs/pd_bpack.mdl");
- }
+ if (e.inventory1 == ITEM_SEQ_AXE)
+ e.netname = "Axe";
+ else if (e.inventory1 == ITEM_SEQ_SHOTGUN)
+ e.netname = "Shotgun";
+ else if (e.inventory1 == ITEM_SEQ_SUPERSHOTGUN)
+ e.netname = "Double-barrelled Shotgun";
+ else if (e.inventory1 == ITEM_SEQ_NAILGUN)
+ e.netname = "Nailgun";
+ else if (e.inventory1 == ITEM_SEQ_SUPERNAILGUN)
+ e.netname = "Super Nailgun";
+ else if (e.inventory1 == ITEM_SEQ_GRENADELAUNCHER)
+ e.netname = "Grenade Launcher";
+ else if (e.inventory1 == ITEM_SEQ_ROCKETLAUNCHER)
+ e.netname = "Rocket Launcher";
+ else if (e.inventory1 == ITEM_SEQ_LIGHTNINGGUN)
+ e.netname = "Thunderbolt";
+ else
+ e.netname = "";
+ } }
+ #endif
+
+ local item_info_t item = item_info[e.weapon];
+
+ #ifdef SSQC
+ precache_model (item.world_model);
+ precache_sound (item.pickup_sound);
+ setmodel (e, item.world_model);
+ #endif
- // setmodel (e, "progs/backpack.mdl");
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ e.modelflags |= MF_ROTATE;
+ #endif
+
+ e.noise = item.pickup_sound;
e.pos1 = '-16 -16 0';
e.pos2 = '16 16 56';
// StartItem
- if (e.spawnflags & BACKPACK_DROPPED)
+
+ #ifdef CSQC
+ setsize (e, e.pos1, e.pos2);
+ base_item_init (e);
+ #endif
+
+ #ifdef SSQC
+ if (e.spawnflags & SPAWNFLAG_ITEM_BACKPACK_DROPPED)
{
// don't delay, spawn immediately -- CEV
+ e.classgroup |= CG_ITEM;
setsize (e, e.pos1, e.pos2);
- e.think = sub_remove;
- e.nextthink = time + 120;
+
+ if (!(e.alpha))
+ e.alpha = ITEM_ALPHA_OPAQUE;
+
+ e.flags |= FL_FINDABLE_NONSOLID;
+ e.mdl = e.model;
+
+ e.tick = base_item_neteval;
+ e.classgroup |= CG_FRAMETICK;
+
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+
+ e.think = item_backpack_think_groundcheck;
+ e.nextthink = time + 0.1;
}
else
{
setsize (e, e.pos1, e.pos2);
base_item_init (e);
}
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() item_backpack =
{
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (__NULL__)
+
item_backpack_init (self);
};
-
// };
#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/items/gore.qc
diff --git a/qc/items/gore.qc b/qc/items/gore.qc
new file mode 100644
index 0000000..7648401
--- /dev/null
+++ b/qc/items/gore.qc
@@ -0,0 +1,1453 @@
+//==============================================================================
+// items/gore.qc -- corpses, gibs, heads. the meaty bits. -- CEV
+//==============================================================================
+
+//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
+// Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds
+//
+// deadstuff version 1.0 - tony collen - manero@canweb.net -
+// EfNet IRC #QuakeEd or #Trinity
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+//======================================================================
+// constants
+//======================================================================
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// base_item_gib spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_ITEM_GIB_SOLID = 1 // spawnflags: solid
+ // SPAWNFLAG_ITEM_SPAWNSILENT = 32, // see base_item.qc -- CEV
+ // SPAWNFLAG_ITEM_SPAWNED = 64, // see base_item.qc -- CEV
+ // SPAWNFLAG_ITEM_SUSPENDED = 128, // see base_item.qc -- CEV
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+ // SPAWNFLAG_ITEM_RESPAWN = 2097152, // see base_item.qc -- CEV
+ // SPAWNFLAG_ITEM_THROWN = 4194304, // see base_item.qc -- CEV
+ // SPAWNFLAG_ITEM_DONTDROP = 8388608 // see base_item.qc -- CEV
+} base_item_gib_spawnflags;
+#endif
+
+#ifdef SSQC
+const float DEBRISQUE_COUNT_MAX = 50; // max number of gibs at one time
+
+const float GIB1_DAMAGE = 5; // small gib damage when thrown
+const float GIB2_DAMAGE = 15; // large gib damage when thrown
+const float GIB3_DAMAGE = 10; // med. (slice-like) gib damage
+
+// TODO CEV
+const string GIB_SOUND_FIRE = "items/damage.wav";
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+// gib & head sizes; values from progs_dump 3 -- CEV
+const vector GIB1_MINS = '-3.57 -8.06 -3.34';
+const vector GIB1_MAXS = '3.69 8.31 30';
+const vector GIB2_MINS = '-12.68 -14.83 -6.19';
+const vector GIB2_MAXS = '13.53 14.57 30';
+const vector GIB3_MINS = '-18.95 -15.92 -3.13';
+const vector GIB3_MAXS = '13.17 15.66 30';
+const vector DEMON1_HEAD_MINS = '-13.64 -16.77 -0.11';
+const vector DEMON1_HEAD_MAXS = '17.44 16.22 30';
+const vector DOG_HEAD_MINS = '-9.66 -11.89 -0.2';
+const vector DOG_HEAD_MAXS = '6.57 7.96 13.29';
+const vector ENFORCER_HEAD_MINS = '-10.63 -10.23 -0.05';
+const vector ENFORCER_HEAD_MAXS = '9.27 8.25 30';
+const vector HELL_KNIGHT_HEAD_MINS = '-7.9 -12.97 -0.63';
+const vector HELL_KNIGHT_HEAD_MAXS = '10.55 8.87 21.06';
+const vector KNIGHT_HEAD_MINS = '-8.17 -7.47 -0.13';
+const vector KNIGHT_HEAD_MAXS = '8.36 6.5 30';
+const vector OGRE_HEAD_MINS = '-12.35 -15.7 -0.17';
+const vector OGRE_HEAD_MAXS = '10.67 13.88 30';
+const vector PLAYER_HEAD_MINS = '-9.67 -12.38 -2.1';
+const vector PLAYER_HEAD_MAXS = '11.49 50.7 30';
+const vector SHALRATH_HEAD_MINS = '-19.85 -19.09 -1.44';
+const vector SHALRATH_HEAD_MAXS = '13.72 16.8 30';
+const vector SHAMBLER_HEAD_MINS = '-15.15 -20.638 -0.45';
+const vector SHAMBLER_HEAD_MAXS = '21.44 21.76 30';
+const vector ARMY_HEAD_MINS = '-9.67 -8.27 -0.28';
+const vector ARMY_HEAD_MAXS = '4.05 4.8 13.41';
+const vector WIZARD_HEAD_MINS = '-10.41 -8.66 -0.54';
+const vector WIZARD_HEAD_MAXS = '6.52 10.82 30';
+const vector ZOMBIE_HEAD_MINS = '-16 -16 0'; // not exact size -- CEV
+const vector ZOMBIE_HEAD_MAXS = '16 16 56';
+#endif
+
+//======================================================================
+// forward declarations
+//======================================================================
+
+#ifdef SSQC
+void(vector org, vector vel, float damage) spawn_blood;
+void(float damage) spawn_touchblood;
+void(vector org, vector vel) spawn_chunk;
+entity(vector org, vector vel) spawn_meatspray;
+vector(vector dir, float dmg) velocity_for_damage;
+#endif
+
+// base_item_gib
+#ifdef CSQC
+void(float isnew, void(entity) initfn) base_item_gib_netreceive;
+#endif
+#ifdef SSQC
+// BASE_ITEM_GIB_THROW(spawnfunc)
+void(entity grabber, entity gib) base_item_gib_grab;
+void(entity attacker, float item_index) base_item_gib_fire;
+void() base_item_gib_touch;
+entity(entity src, vector org, vector vel, float fl, void(entity) initfn)
+ spawn_base_item_gib;
+#endif
+#if defined(CSQC) || defined(SSQC)
+void(entity e) base_item_gib_init;
+#endif
+#ifdef SSQC
+strip void() base_item_gib;
+#endif
+
+// item_gib1
+#if defined(CSQC) || defined(SSQC)
+void(entity e) item_gib1_init;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_item_gib1;
+void() item_gib1;
+#endif
+
+// item_gib2
+#if defined(CSQC) || defined(SSQC)
+void(entity e) item_gib2_init;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_item_gib2;
+void() item_gib2;
+#endif
+
+// item_gib3
+#if defined(CSQC) || defined(SSQC)
+void(entity e) item_gib3_init;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_item_gib3;
+void() item_gib3;
+#endif
+
+// item_head_demon
+#if defined(CSQC) || defined(SSQC)
+void(entity e) item_head_demon_init;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_item_head_demon;
+void() item_head_demon;
+#endif
+
+// item_head_dog
+#if defined(CSQC) || defined(SSQC)
+void(entity e) item_head_dog_init;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_item_head_dog;
+void() item_head_dog;
+#endif
+
+// item_head_enforcer
+#if defined(CSQC) || defined(SSQC)
+void(entity e) item_head_enforcer_init;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_item_head_enforcer;
+void() item_head_enforcer;
+#endif
+
+// item_head_hell_knight
+#if defined(CSQC) || defined(SSQC)
+void(entity e) item_head_hell_knight_init;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl)
+ spawn_item_head_hell_knight;
+void() item_head_hell_knight;
+#endif
+
+// item_head_knight
+#if defined(CSQC) || defined(SSQC)
+void(entity e) item_head_knight_init
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_item_head_knight;
+void() item_head_knight;
+#endif
+
+// item_head_ogre
+#if defined(CSQC) || defined(SSQC)
+void(entity e) item_head_ogre_init;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_item_head_ogre;
+void() item_head_ogre;
+#endif
+
+// item_head_player
+#if defined(CSQC) || defined(SSQC)
+void(entity e) item_head_player_init;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_item_head_player;
+void() item_head_player;
+#endif
+
+// item_head_shalrath
+#if defined(CSQC) || defined(SSQC)
+void(entity e) item_head_shalrath_init;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_item_head_shalrath;
+void() item_head_shalrath;
+#endif
+
+// item_head_shambler
+#if defined(CSQC) || defined(SSQC)
+void(entity e) item_head_shambler_init;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_item_head_shambler;
+void() item_head_shambler;
+#endif
+
+// item_head_army
+#if defined(CSQC) || defined(SSQC)
+void(entity e) item_head_army_init;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_item_head_army;
+void() item_head_army;
+#endif
+
+// item_head_wizard
+#if defined(CSQC) || defined(SSQC)
+void(entity e) item_head_wizard_init;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_item_head_wizard;
+void() item_head_wizard;
+#endif
+
+// item_head_zombie
+#if defined(CSQC) || defined(SSQC)
+void(entity e) item_head_zombie_init;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_item_head_zombie;
+void() item_head_zombie;
+#endif
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// original progs_dump 3 / DeadStuff entities -- CEV
+//----------------------------------------------------------------------
+void() gib_misc_1 = { item_gib1 (); };
+void() gib_misc_2 = { item_gib2 (); };
+void() gib_misc_3 = { item_gib3 (); };
+void() gib_head_demon = { item_head_demon (); };
+void() gib_head_dog = { item_head_dog (); };
+void() gib_head_enforcer = { item_head_enforcer (); };
+void() gib_head_hell_knight = { item_head_hell_knight (); };
+void() gib_head_knight = { item_head_knight (); };
+void() gib_head_ogre = { item_head_ogre (); };
+void() gib_head_player = { item_head_player (); };
+void() gib_head_shalrath = { item_head_shalrath (); };
+void() gib_head_shambler = { item_head_shambler (); };
+void() gib_head_army = { item_head_army (); };
+void() gib_head_wizard = { item_head_wizard (); };
+void() gib_head_zombie = { item_head_zombie (); };
+#endif
+
+//------------------------------------------------------------------------------
+
+//----------------------------------------------------------------------
+// misc. functions
+//----------------------------------------------------------------------
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// SpawnBlood
+//----------------------------------------------------------------------
+void(vector org, vector vel, float damage) spawn_blood =
+{
+ particle (org, vel * 0.1, 73, damage * 2);
+};
+
+//----------------------------------------------------------------------
+// spawn_touchblood
+//----------------------------------------------------------------------
+void(float damage) spawn_touchblood =
+{
+ // wall_velocity
+ local vector vel;
+
+ vel = normalize (self.velocity);
+ vel = normalize (vel + v_up * (random() - 0.5) +
+ v_right * (random() - 0.5));
+ // TODO CEV when was the last time a trace was called?
+ vel = vel + 2 * trace_plane_normal;
+ vel = (vel * 200) * 0.2;
+
+ spawn_blood (self.origin + vel * 0.01, vel, damage);
+};
+
+//----------------------------------------------------------------------
+// SpawnChunk
+//----------------------------------------------------------------------
+void(vector org, vector vel) spawn_chunk =
+{
+ particle (org, vel * 0.02, 0, 10);
+};
+
+//----------------------------------------------------------------------
+// SpawnMeatSpray
+//----------------------------------------------------------------------
+entity(vector org, vector vel) spawn_meatspray =
+{
+ // reusing the "zombiechunk" projectile -- CEV
+ local entity e = spawn_projectile_zombiechunk (self, org, vel);
+ // override some defaults, notably solid and force damage to 0 -- CEV
+ e.solid = SOLID_NOT;
+ e.direct_damage = 0;
+ e.velocity_z += 250 + 50 * random ();
+ e.nextthink = time + 1;
+ return e;
+};
+
+//----------------------------------------------------------------------
+vector(vector dir, float dmg) velocity_for_damage =
+{
+ // uncomment if needed for the debug print below -- CEV
+ // local vector startdir = dir;
+
+ // next three lines original id1 behavior -- CEV
+ local vector v;
+ v_x = 100 * crandom ();
+ v_y = 100 * crandom ();
+ v_z = 200 + 100 * random ();
+ // damage response scaling from Alkaline, presumably by bmFbr -- CEV
+ v *= max (1, min(10, dmg * dmg / 5000));
+
+ if (dir != '0 0 0')
+ {
+ // directional gib behavior from Alkaline (which appears to
+ // be by bmFbr according to the commit log, see Alkaline
+ // commit 083f87c18a2d2be645ba197c1f23fc6533afca81).
+ // dir is set by killed () and is already normalized -- CEV
+ dir *= bound (10, dmg * dmg / 22, 800);
+ dir_x *= 2.5;
+ dir_y *= 2.5;
+ dir_z *= 0.7;
+ v += dir;
+ }
+
+ // velocity limiting code again from Alkaline and written by bmFbr.
+ // I'm leaning on Alkaline here and above because the implementation
+ // I came up with was way worse. -- CEV
+ local float vspeed = vlen (v);
+ if (vspeed > 500)
+ v *= 500 / vspeed;
+ v_z = min (500, v_z);
+
+ #if 0
+ dprint (sprintf("velocity_for_damage: damage is %g, startdir is %v, "
+ "v is %v\n", dmg, startdir, v));
+ #endif
+
+ return v;
+};
+#endif
+
+//----------------------------------------------------------------------
+// base_item_gib
+//----------------------------------------------------------------------
+
+//----------------------------------------------------------------------
+// class base_item_gib: base_item
+// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew, void(entity) initfn) base_item_gib_netreceive =
+ {
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (initfn)
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ // was self.origin + '0 0 24' -- CEV
+ //--------------------------------------------------------------
+ #define BASE_ITEM_GIB_THROW(d, h, func) \
+ { \
+ spawn_base_item_gib (self, self.origin, \
+ velocity_for_damage(d, h), \
+ SPAWNFLAG_ITEM_THROWN, func); \
+ }
+
+ //--------------------------------------------------------------
+ void(entity grabber, entity gib) base_item_gib_grab =
+ {
+ BASE_ITEM_INVENTORY_ADD (gib, grabber)
+
+ // don't re-grab / immediately throw the item -- CEV
+ if (grabber.button6)
+ grabber.flags |= FL_THROW_HELD;
+
+ // let the player know -- CEV
+ sprint (grabber, sprintf("%s grabbed a %s\n",
+ grabber.netname, gib.netname));
+
+ // let CSQC know -- CEV
+ if (grabber.classtype == CT_PLAYER && grabber.SendEntity)
+ grabber.SendFlags |= NETFLAG_PLAYER_WEAPON;
+
+ // remove the gib from the queue before firing targets -- CEV
+ base_entity_que_rem (gib, QUE_TYPE_DEBRIS);
+
+ // fire all targets / killtargets (unlikely to be used) -- CEV
+ local entity stemp = self;
+ local entity otemp = grabber;
+ other = grabber;
+ self = gib;
+ activator = grabber;
+ sub_usetargets ();
+ self = stemp;
+ other = otemp;
+
+ // gibs won't respawn so we're clear to remove here -- CEV
+ if (gib)
+ {
+ gib.model = __NULL__;
+ setmodel (gib, gib.model);
+ gib.solid = SOLID_NOT;
+ gib.touch = sub_null;
+ gib.think = sub_remove;
+ gib.nextthink = time + 0.2;
+
+ gib.SendFlags |= NETFLAG_BASE_ENTITY_MODEL |
+ NETFLAG_BASE_ENTITY_SOLID;
+ }
+ };
+
+ //--------------------------------------------------------------
+ // player has pressed +attack while holding a gib -- CEV
+ //--------------------------------------------------------------
+ void(entity attacker, float item_index) base_item_gib_fire =
+ {
+ // play a sound then delay next attack -- CEV
+ sound (attacker, CHAN_ITEM, GIB_SOUND_FIRE, VOL_MHI, ATTN_NORM);
+ attacker.attack_finished = time + 0.5;
+ };
+
+ //--------------------------------------------------------------
+ // Inspired by Ivana Gibson's kickable gibs [1] and similar
+ // functions found in other mods (Scarlet, etc) -- CEV
+ // [1]: https://www.insideqc.com/qctut/lesson-52.shtml
+ //
+ // gib_touch runs much more often than other item touch funcs
+ // (mainly due to touching world); concessions have been made
+ // so it doesn't eat too much time -- CEV
+ //--------------------------------------------------------------
+ void() base_item_gib_touch =
+ {
+ setorigin (self, self.origin);
+
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_ANGLES;
+
+ // only run if touched by a player or monster -- CEV
+ if (other.classtype != CT_PLAYER)
+ if (!(other.classgroup & CG_MONSTER))
+ return;
+
+ // check touch_projectile & return early if in motion -- CEV
+ if (self.velocity)
+ {
+ // thrown item check -- CEV
+ base_item_touch_projectile ();
+ return;
+ }
+
+ // only run if other is moving fast enough to disturb
+ // stationary objects -- CEV
+ if (other.classtype == CT_PLAYER)
+ if (other.speed < 200)
+ return;
+
+ // push self horizontally according to other's direction and
+ // speed, maximum of 160ups -- CEV
+ base_entity_push (self, other, PM_MAXSPEED * 0.5);
+
+ if (self.avelocity_y == 0)
+ // a little spin, as a treat. Rotating in the other
+ // axes seem to cause gibs to move into the floor -- CEV
+ self.avelocity_y = 100 * crandom ();
+ };
+
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl,
+ void(entity) initfn) spawn_base_item_gib =
+ {
+ local entity e = spawn ();
+ e.owner = src;
+ e.spawnflags = fl;
+ e.origin = org;
+ e.velocity = vel;
+ initfn (e);
+
+ // thrown from a gibbed enemy -- CEV
+ if (fl & SPAWNFLAG_ITEM_THROWN) {
+ if (src.health < 0)
+ {
+ // special handling for heads -- CEV
+ if (e.weapon >= ITEM_SEQ_HEAD_START &&
+ e.weapon <= ITEM_SEQ_HEAD_END)
+ {
+ // -24 due to offset from BASE_ITEM_GIB_THROW
+ // then an addition -24 -- CEV
+ /*
+ if (!(src.classgroup & CG_CORPSE))
+ e.origin_z -= 48;
+ */
+ if (!e.avelocity)
+ e.avelocity = crandom() * '0 600 0';
+ }
+ else
+ {
+ e.avelocity_x = random() * 600;
+ e.avelocity_y = random() * 600;
+ e.avelocity_z = random() * 600;
+ }
+ } }
+
+ // register this entity in the gib queue -- CEV
+ local entity rem = base_entity_que_add (e, QUE_TYPE_DEBRIS);
+ if (rem)
+ {
+ // a gib was removed from the queue; schedule it for
+ // removal for real -- CEV
+ rem.alpha = 1.0;
+ rem.think = sub_remove_fade;
+ rem.nextthink = time + 2 + random() * 10;
+ }
+
+ return e;
+ };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+ //--------------------------------------------------------------
+ // gibs don't call base_item_init, they get special treatment -- CEV
+ //--------------------------------------------------------------
+ void(entity e) base_item_gib_init =
+ {
+ #ifdef SSQC
+ if (e.flags & FL_CLIENT)
+ dprint (sprintf("base_item_gib_init: found FL_CLIENT"
+ ", classtype %s\n", e.classname));
+
+ if (!(e.flags & FL_CLIENT))
+ if (!(e.spawnflags & SPAWNFLAG_ITEM_THROWN))
+ base_mapentity_init (e);
+ #endif
+
+ #ifdef CSQC
+ base_mapentity_init (e);
+ #endif
+
+ // both a (part of a) corpse and an item -- CEV
+ e.classgroup |= CG_CORPSE | CG_ITEM;
+
+ local item_info_t item = item_info[e.weapon];
+
+ #ifdef SSQC
+ precache_model (item.world_model);
+ precache_sound (item.pickup_sound);
+ setmodel (e, item.world_model);
+
+ // TODO CEV
+ precache_sound ("items/damage.wav");
+ #endif
+
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ #endif
+
+ e.noise = item.pickup_sound;
+
+ // guarantee size -- CEV
+ if (!e.pos1 && !e.pos2)
+ {
+ e.pos1 = '0 0 0';
+ e.pos2 = '32 32 56';
+ }
+
+ if (!(e.flags & FL_CLIENT))
+ // let's not change the player name lol -- CEV
+ e.netname = item.name;
+
+ #ifdef CSQC
+ e.drawmask = DRAWMASK_NORMAL;
+ e.predraw = base_item_predraw;
+ #endif
+
+ #ifdef SSQC
+ // in case we're converting an existing entity -- CEV
+ // clear potential leftover flags -- CEV
+ if (e.flags & FL_MONSTER)
+ e.flags &= ~FL_MONSTER;
+
+ if (e.flags & FL_FLY)
+ e.flags &= ~FL_FLY;
+
+ if (e.flags & FL_SWIM)
+ e.flags &= ~FL_SWIM;
+
+ // make sure destroy func is inactive -- CEV
+ if (e.destroy)
+ e.destroy = sub_nulldestroy;
+
+ // make sure we won't take damage -- CEV
+ e.takedamage = DAMAGE_NO;
+
+ // so we can be picked up -- CEV
+ e.flags |= FL_FINDABLE_NONSOLID;
+
+ if (e.spawnflags & SPAWNFLAG_ITEM_THROWN)
+ if (e.flags & FL_CLIENT)
+ e.flags &= ~FL_ONGROUND;
+
+ if (e.spawnflags & SPAWNFLAG_ITEM_GIB_SOLID)
+ {
+ // explicitly flagged as solid -- CEV
+ e.solid = SOLID_BBOX;
+ }
+ else if (e.spawnflags & SPAWNFLAG_ITEM_THROWN)
+ {
+ // thrown (as-in ThrowGib) -- CEV
+ if (e.owner && e.owner.classtype == CT_PLAYER)
+ {
+ e.solid = SOLID_SLIDEBOX;
+ e.think = base_item_think_throwgroundcheck;
+ e.nextthink = time + 0.1;
+ }
+ else
+ {
+ e.solid = SOLID_TRIGGER;
+ }
+ }
+ else
+ {
+ // otherwise spawn nonsolid -- CEV
+ e.solid = SOLID_NOT;
+ }
+
+ if (self.spawnflags & SPAWNFLAG_ITEM_SUSPENDED)
+ {
+ // suspended so FLY and no touch displacement -- CEV
+ e.movetype = MOVETYPE_FLY;
+ e.touch = sub_null;
+ }
+ else
+ {
+ // otherwise bounce & displacement (KickGib) -- CEV
+ e.movetype = MOVETYPE_BOUNCE;
+ e.touch = base_item_gib_touch;
+ }
+
+ // TODO CEV
+ e.angles.y = e.owner.angles.y + item.view_angles_offset.y;
+
+ // send this entity to CSQC -- CEV
+ e.classgroup |= CG_FRAMETICK;
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+ e.tick = base_item_neteval;
+ #endif
+
+ // now set bounding box if we're solid -- CEV
+ if (e.solid)
+ setsize (e, e.pos1, e.pos2);
+ else
+ setsize (e, '0 0 0', '0 0 0');
+
+ setorigin (e, e.origin);
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ strip void() base_item_gib =
+ {
+ base_item_gib_init (self);
+ };
+#endif
+// };
+
+//----------------------------------------------------------------------
+// individual gibs
+//----------------------------------------------------------------------
+
+/*QUAKED item_gib1 (0 0.5 0.8) (-8 -8 -8) (8 8 8) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/gib1.mdl");
+}*/
+//----------------------------------------------------------------------
+// class item_gib1: base_item_gib
+// {
+#if defined(CSQC) || defined(SSQC)
+ //--------------------------------------------------------------
+ void(entity e) item_gib1_init =
+ {
+ e.classname = "item_gib1";
+ e.classtype = CT_ITEM_GIB1;
+
+ #ifdef SSQC
+ e.weapon = ITEM_SEQ_GIB1;
+ e.dmg = GIB1_DAMAGE;
+ e.frame = 0;
+ #endif
+
+ e.pos1 = GIB1_MINS;
+ e.pos2 = GIB1_MAXS;
+
+ // this will set e.solid
+ base_item_gib_init (e);
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl) spawn_item_gib1 =
+ {
+ return spawn_base_item_gib (src, org, vel, fl, item_gib1_init);
+ };
+
+ //--------------------------------------------------------------
+ void() item_gib1 =
+ {
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (__NULL__)
+
+ item_gib1_init (self);
+ };
+#endif
+// };
+
+/*QUAKED item_gib2 (0 0.5 0.8) (-8 -8 -8) (8 8 8) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/gib2.mdl");
+}*/
+//----------------------------------------------------------------------
+// class item_gib2: base_item_gib
+// {
+#if defined(CSQC) || defined(SSQC)
+ //--------------------------------------------------------------
+ void(entity e) item_gib2_init =
+ {
+ e.classname = "item_gib2";
+ e.classtype = CT_ITEM_GIB2;
+
+ #ifdef SSQC
+ e.weapon = ITEM_SEQ_GIB2;
+ e.dmg = GIB2_DAMAGE;
+ e.frame = 0;
+ #endif
+
+ e.pos1 = GIB2_MINS;
+ e.pos2 = GIB2_MAXS;
+
+ // this will set e.solid
+ base_item_gib_init (e);
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl) spawn_item_gib2 =
+ {
+ return spawn_base_item_gib (src, org, vel, fl, item_gib2_init);
+ };
+
+ //--------------------------------------------------------------
+ void() item_gib2 =
+ {
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (__NULL__)
+
+ item_gib2_init (self);
+ };
+#endif
+// };
+
+/*QUAKED item_gib3 (0 0.5 0.8) (-8 -8 -8) (8 8 8) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/gib3.mdl");
+}*/
+//----------------------------------------------------------------------
+// class item_gib3: base_item_gib
+// {
+#if defined(CSQC) || defined(SSQC)
+ //--------------------------------------------------------------
+ void(entity e) item_gib3_init =
+ {
+ e.classname = "item_gib3";
+ e.classtype = CT_ITEM_GIB3;
+
+ #ifdef SSQC
+ e.weapon = ITEM_SEQ_GIB3;
+ e.dmg = GIB3_DAMAGE;
+ e.frame = 0;
+ #endif
+
+ e.pos1 = GIB3_MINS;
+ e.pos2 = GIB3_MAXS;
+
+ // this will set e.solid
+ base_item_gib_init (e);
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl) spawn_item_gib3 =
+ {
+ return spawn_base_item_gib (src, org, vel, fl, item_gib3_init);
+ };
+
+ //--------------------------------------------------------------
+ void() item_gib3 =
+ {
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (__NULL__)
+
+ item_gib3_init (self);
+ };
+#endif
+// };
+
+//----------------------------------------------------------------------
+// heads
+//----------------------------------------------------------------------
+
+/*QUAKED item_head_demon (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/h_demon.mdl");
+}
+*/
+//----------------------------------------------------------------------
+// class item_head_demon: base_item_gib
+// {
+#if defined(CSQC) || defined(SSQC)
+ //--------------------------------------------------------------
+ void(entity e) item_head_demon_init =
+ {
+ e.classname = "item_head_demon";
+ e.classtype = CT_ITEM_HEAD_DEMON;
+
+ #ifdef SSQC
+ e.weapon = ITEM_SEQ_HEAD_DEMON;
+ e.frame = 0;
+ e.view_ofs = '0 0 8';
+ #endif
+
+ e.pos1 = DEMON1_HEAD_MINS;
+ e.pos2 = DEMON1_HEAD_MAXS;
+
+ // gib_init interprets spawnflags and will set .solid -- CEV
+ base_item_gib_init (e);
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl)
+ spawn_item_head_demon =
+ {
+ return spawn_base_item_gib (src, org, vel, fl,
+ item_head_demon_init);
+ };
+
+ //--------------------------------------------------------------
+ void() item_head_demon =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ item_head_demon_init (self);
+ };
+#endif
+// };
+
+/*QUAKED item_head_dog (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/h_dog.mdl");
+}
+*/
+//----------------------------------------------------------------------
+// class item_head_dog: base_item_gib
+// {
+#if defined(CSQC) || defined(SSQC)
+ //--------------------------------------------------------------
+ void(entity e) item_head_dog_init =
+ {
+ e.classname = "item_head_dog";
+ e.classtype = CT_ITEM_HEAD_DOG;
+
+ #ifdef SSQC
+ e.weapon = ITEM_SEQ_HEAD_DOG;
+ // was 1 -- dumptruck_ds
+ e.frame = 0;
+ e.view_ofs = '0 0 8';
+ #endif
+
+ e.pos1 = DOG_HEAD_MINS;
+ e.pos2 = DOG_HEAD_MAXS;
+
+ // gib_init interprets spawnflags and will set .solid -- CEV
+ base_item_gib_init (e);
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl)
+ spawn_item_head_dog =
+ {
+ return spawn_base_item_gib (src, org, vel, fl,
+ item_head_dog_init);
+ };
+
+ //--------------------------------------------------------------
+ void() item_head_dog =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ item_head_dog_init (self);
+ };
+#endif
+// };
+
+/*QUAKED item_head_enforcer (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/h_mega.mdl");
+}
+*/
+//----------------------------------------------------------------------
+// class item_head_enforcer: base_item_gib
+// {
+#if defined(CSQC) || defined(SSQC)
+ //--------------------------------------------------------------
+ void(entity e) item_head_enforcer_init =
+ {
+ e.classname = "item_head_enforcer";
+ e.classtype = CT_ITEM_HEAD_ENFORCER;
+
+ #ifdef SSQC
+ e.weapon = ITEM_SEQ_HEAD_ENFORCER;
+ e.frame = 0;
+ e.view_ofs = '0 0 8';
+ #endif
+
+ e.pos1 = ENFORCER_HEAD_MINS;
+ e.pos2 = ENFORCER_HEAD_MAXS;
+
+ // gib_init interprets spawnflags and will set .solid -- CEV
+ base_item_gib_init (e);
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl)
+ spawn_item_head_enforcer =
+ {
+ return spawn_base_item_gib (src, org, vel, fl,
+ item_head_enforcer_init);
+ };
+
+ //--------------------------------------------------------------
+ void() item_head_enforcer =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ item_head_enforcer_init (self);
+ };
+#endif
+// };
+
+/*QUAKED item_head_hell_knight (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/h_hellkn.mdl");
+}*/
+//----------------------------------------------------------------------
+// class item_head_hell_knight: base_item_gib
+// {
+#if defined(CSQC) || defined(SSQC)
+ //--------------------------------------------------------------
+ void(entity e) item_head_hell_knight_init =
+ {
+ e.classname = "item_head_hellknight";
+ e.classtype = CT_ITEM_HEAD_HELLKNIGHT;
+
+ #ifdef SSQC
+ e.weapon = ITEM_SEQ_HEAD_HELLKNIGHT;
+ e.frame = 0;
+ e.view_ofs = '0 0 8';
+ #endif
+
+ e.pos1 = HELL_KNIGHT_HEAD_MINS;
+ e.pos2 = HELL_KNIGHT_HEAD_MAXS;
+
+ // gib_init interprets spawnflags and will set .solid -- CEV
+ base_item_gib_init (e);
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl)
+ spawn_item_head_hell_knight =
+ {
+ return spawn_base_item_gib (src, org, vel, fl,
+ item_head_hell_knight_init);
+ };
+
+ //--------------------------------------------------------------
+ void() item_head_hell_knight =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ item_head_hell_knight_init (self);
+ };
+#endif
+// };
+
+/*QUAKED item_head_knight (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/h_knight.mdl");
+}*/
+//----------------------------------------------------------------------
+// class item_head_knight: base_item_gib
+// {
+#if defined(CSQC) || defined(SSQC)
+ //--------------------------------------------------------------
+ void(entity e) item_head_knight_init =
+ {
+ e.classname = "item_head_knight";
+ e.classtype = CT_ITEM_HEAD_KNIGHT;
+
+ #ifdef SSQC
+ e.weapon = ITEM_SEQ_HEAD_KNIGHT;
+ e.frame = 0;
+ e.view_ofs = '0 0 8';
+ #endif
+
+ e.pos1 = KNIGHT_HEAD_MINS;
+ e.pos2 = KNIGHT_HEAD_MAXS;
+
+ // gib_init interprets spawnflags and will set .solid -- CEV
+ base_item_gib_init (e);
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl)
+ spawn_item_head_knight =
+ {
+ return spawn_base_item_gib (src, org, vel, fl,
+ item_head_knight_init);
+ };
+
+ //--------------------------------------------------------------
+ void() item_head_knight =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ item_head_knight_init (self);
+ };
+#endif
+// };
+
+/*QUAKED item_head_ogre (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/h_ogre.mdl");
+}*/
+//----------------------------------------------------------------------
+// class item_head_ogre: base_item_gib
+// {
+#if defined(CSQC) || defined(SSQC)
+ //--------------------------------------------------------------
+ void(entity e) item_head_ogre_init =
+ {
+ e.classname = "item_head_ogre";
+ e.classtype = CT_ITEM_HEAD_OGRE;
+
+ #ifdef SSQC
+ e.weapon = ITEM_SEQ_HEAD_OGRE;
+ e.frame = 0;
+ e.view_ofs = '0 0 8';
+ #endif
+
+ e.pos1 = OGRE_HEAD_MINS;
+ e.pos2 = OGRE_HEAD_MAXS;
+
+ // gib_init interprets spawnflags and will set .solid -- CEV
+ base_item_gib_init (e);
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl)
+ spawn_item_head_ogre =
+ {
+ return spawn_base_item_gib (src, org, vel, fl,
+ item_head_ogre_init);
+ };
+
+ //--------------------------------------------------------------
+ void() item_head_ogre =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ item_head_ogre_init (self);
+ };
+#endif
+// };
+
+/*QUAKED item_head_player (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/h_player.mdl");
+}*/
+//----------------------------------------------------------------------
+// class item_head_player: base_item_gib
+// {
+#if defined(CSQC) || defined(SSQC)
+ //--------------------------------------------------------------
+ void(entity e) item_head_player_init =
+ {
+ // don't reset class if passed a client entity -- CEV
+ if (!(e.flags & FL_CLIENT))
+ {
+ e.classname = "item_head_player";
+ e.classtype = CT_ITEM_HEAD_PLAYER;
+ }
+
+ #ifdef SSQC
+ // TODO CEV let's hope this behaves
+ e.weapon = ITEM_SEQ_HEAD_PLAYER;
+ e.frame = 0;
+ e.view_ofs = '0 0 8';
+ #endif
+
+ e.pos1 = PLAYER_HEAD_MINS;
+ e.pos2 = PLAYER_HEAD_MAXS;
+
+ // gib_init interprets spawnflags and will set .solid -- CEV
+ base_item_gib_init (e);
+
+ #ifdef SSQC
+ if (e.SendEntity)
+ {
+ e.SendFlags |= NETFLAG_PLAYER_MODEL |
+ NETFLAG_PLAYER_SOLID | NETFLAG_PLAYER_SIZE;
+ }
+ #endif
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl)
+ spawn_item_head_player =
+ {
+ return spawn_base_item_gib (src, org, vel, fl,
+ item_head_player_init);
+ };
+
+ //--------------------------------------------------------------
+ void() item_head_player =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ item_head_player_init (self);
+ };
+#endif
+// };
+
+/*QUAKED item_head_shalrath (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/h_shal.mdl");
+}*/
+//----------------------------------------------------------------------
+// class item_head_shalrath: base_item_gib
+// {
+#if defined(CSQC) || defined(SSQC)
+ //--------------------------------------------------------------
+ void(entity e) item_head_shalrath_init =
+ {
+ e.classname = "item_head_shalrath";
+ e.classtype = CT_ITEM_HEAD_SHALRATH;
+
+ #ifdef SSQC
+ e.weapon = ITEM_SEQ_HEAD_SHALRATH;
+ e.frame = 0;
+ e.view_ofs = '0 0 8';
+ #endif
+
+ e.pos1 = SHALRATH_HEAD_MINS;
+ e.pos2 = SHALRATH_HEAD_MAXS;
+
+ // gib_init interprets spawnflags and will set .solid -- CEV
+ base_item_gib_init (e);
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl)
+ spawn_item_head_shalrath =
+ {
+ return spawn_base_item_gib (src, org, vel, fl,
+ item_head_shalrath_init);
+ };
+
+ //--------------------------------------------------------------
+ void() item_head_shalrath =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ item_head_shalrath_init (self);
+ };
+#endif
+// };
+
+/*QUAKED item_head_shambler (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/h_shams.mdl");
+}*/
+//----------------------------------------------------------------------
+// class item_head_shambler: base_item_gib
+// {
+#if defined(CSQC) || defined(SSQC)
+ //--------------------------------------------------------------
+ void(entity e) item_head_shambler_init =
+ {
+ e.classname = "item_head_shambler";
+ e.classtype = CT_ITEM_HEAD_SHAMBLER;
+
+ #ifdef SSQC
+ e.weapon = ITEM_SEQ_HEAD_SHAMBLER;
+ // was 1, caused an error -- dumptruck_ds
+ e.frame = 0;
+ e.view_ofs = '0 0 8';
+ #endif
+
+ e.pos1 = SHAMBLER_HEAD_MINS;
+ e.pos2 = SHAMBLER_HEAD_MAXS;
+
+ // gib_init interprets spawnflags and will set .solid -- CEV
+ base_item_gib_init (e);
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl)
+ spawn_item_head_shambler =
+ {
+ return spawn_base_item_gib (src, org, vel, fl,
+ item_head_shambler_init);
+ };
+
+ //--------------------------------------------------------------
+ void() item_head_shambler =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ item_head_shambler_init (self);
+ };
+#endif
+// };
+
+/*QUAKED item_head_army (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/h_guard.mdl");
+}
+*/
+//----------------------------------------------------------------------
+// class item_head_army: base_item_gib
+// {
+#if defined(CSQC) || defined(SSQC)
+ //--------------------------------------------------------------
+ void(entity e) item_head_army_init =
+ {
+ e.classname = "item_head_army";
+ e.classtype = CT_ITEM_HEAD_ARMY;
+
+ #ifdef SSQC
+ e.weapon = ITEM_SEQ_HEAD_ARMY;
+ e.frame = 0;
+ e.view_ofs = '0 0 8';
+ #endif
+
+ e.pos1 = ARMY_HEAD_MINS;
+ e.pos2 = ARMY_HEAD_MAXS;
+
+ // gib_init interprets spawnflags and will set .solid -- CEV
+ base_item_gib_init (e);
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl)
+ spawn_item_head_army =
+ {
+ return spawn_base_item_gib (src, org, vel, fl,
+ item_head_army_init);
+ };
+
+ //--------------------------------------------------------------
+ void() item_head_army =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ item_head_army_init (self);
+ };
+#endif
+// };
+
+/*QUAKED item_head_wizard (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/h_wizard.mdl");
+}*/
+//----------------------------------------------------------------------
+// class item_head_wizard: base_item_gib
+// {
+#if defined(CSQC) || defined(SSQC)
+ //--------------------------------------------------------------
+ void(entity e) item_head_wizard_init =
+ {
+ e.classname = "item_head_wizard";
+ e.classtype = CT_ITEM_HEAD_WIZARD;
+
+ #ifdef SSQC
+ e.weapon = ITEM_SEQ_HEAD_WIZARD;
+ e.frame = 0;
+ e.view_ofs = '0 0 8';
+ #endif
+
+ e.pos1 = WIZARD_HEAD_MINS;
+ e.pos2 = WIZARD_HEAD_MAXS;
+
+ // gib_init interprets spawnflags and will set .solid -- CEV
+ base_item_gib_init (e);
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl)
+ spawn_item_head_wizard =
+ {
+ return spawn_base_item_gib (src, org, vel, fl,
+ item_head_wizard_init);
+ };
+
+ //--------------------------------------------------------------
+ void() item_head_wizard =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ item_head_wizard_init (self);
+ };
+#endif
+// };
+
+/*QUAKED item_head_zombie (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/h_zombie.mdl");
+}
+*/
+//----------------------------------------------------------------------
+// class item_head_zombie: base_item_gib
+// {
+#if defined(CSQC) || defined(SSQC)
+ //--------------------------------------------------------------
+ void(entity e) item_head_zombie_init =
+ {
+ e.classname = "item_head_zombie";
+ e.classtype = CT_ITEM_HEAD_ZOMBIE;
+
+ #ifdef SSQC
+ e.weapon = ITEM_SEQ_HEAD_ZOMBIE;
+ e.frame = 0;
+ e.view_ofs = '0 0 8';
+ #endif
+
+ e.pos1 = ZOMBIE_HEAD_MINS;
+ e.pos2 = ZOMBIE_HEAD_MAXS;
+
+ // gib_init interprets spawnflags and will set .solid -- CEV
+ base_item_gib_init (e);
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl)
+ spawn_item_head_zombie =
+ {
+ return spawn_base_item_gib (src, org, vel, fl,
+ item_head_zombie_init);
+ };
+
+ //--------------------------------------------------------------
+ void() item_head_zombie =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ item_head_zombie_init (self);
+ };
+#endif
+// };
Return to the top of this page or return to the overview of this repo.
Diff qc/items/health.qc
diff --git a/qc/items/health.qc b/qc/items/health.qc
index 9c59eee..0fafb1a 100644
--- a/qc/items/health.qc
+++ b/qc/items/health.qc
@@ -7,15 +7,36 @@
//======================================================================
#ifdef SSQC
-// constants spawnflags
-const float HEALTH_ROTTEN = 1; // rotten health box
-const float HEALTH_MEGA = 2; // megahealth
-const float HEALTH_VIAL = 4; // vial (AKA bubble)
+//----------------------------------------------------------------------
+// base health item spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_ITEM_HEALTH_ROTTEN = 1, // rotten health box
+ SPAWNFLAG_ITEM_HEALTH_MEGA = 2, // megahealth
+ SPAWNFLAG_ITEM_HEALTH_VIAL = 4 // vial (AKA bubble)
+ // SPAWNFLAG_ITEM_SPAWNSILENT = 32, // see base_item.qc -- CEV
+ // SPAWNFLAG_ITEM_SPAWNED = 64, // see base_item.qc -- CEV
+ // SPAWNFLAG_ITEM_SUSPENDED = 128, // see base_item.qc -- CEV
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536 // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+ // SPAWNFLAG_ITEM_RESPAWN = 2097152, // see base_item.qc -- CEV
+ // SPAWNFLAG_ITEM_THROWN = 4194304, // see base_item.qc -- CEV
+ // SPAWNFLAG_ITEM_DONTDROP = 8388608 // see base_item.qc -- CEV
+} base_item_health_spawnflags;
+#endif
-// constants healtypes
-const float HEALTH_TYPE_ROTTEN = 0; // rotten box
-const float HEALTH_TYPE_NORMAL = 1; // normal box
-const float HEALTH_TYPE_MEGA = 2; // megahealth
+#ifdef SSQC
+const float HEALTH_DAMAGE_SMALL = 10; // damage a small box deals when thrown
+const float HEALTH_DAMAGE_LARGE = 15; // same, but for large boxes (mega)
+const float HEALTH_DAMAGE_VIAL = 5; // same, but for health vials
// constants amounts & respawn times
const float HEALTH_ROTTEN_AMOUNT = 15; // rotten heal amount; id1 15
@@ -28,42 +49,56 @@ const float HEALTH_RESPAWN_MEGA = 125; // fixed mega respawn time; pd3 125
#endif
//======================================================================
-// fields
-//======================================================================
-
-#ifdef SSQC
-.float healamount;
-.float healtype;
-#endif
-
-//======================================================================
// forward declarations
//======================================================================
#ifdef SSQC
-// TODO CEV rework the damage system
+// TODO CEV roll T_Heal into addhealth somehow (triggers/heal.qc is a problem)
float (entity e, float healamount, float ignore) T_Heal;
#endif
-#ifdef SSQC
// base_item_health
+#ifdef SSQC
+// BASE_ITEM_HEALTH_RESPAWNDM(health_item)
+float(entity toucher, float item_index) base_item_health_addhealth;
+void(entity grabber, entity box) base_item_health_grab;
+void(entity attacker, float item_index) base_item_health_fire;
void() base_item_health_touch;
+void(string key, string value) base_item_health_init_field;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) base_item_health_init;
+#endif
+#ifdef SSQC
strip void() base_item_health;
#endif
-#ifdef SSQC
// item_health
-entity(entity src, vector org, vector vel, float flags) spawn_item_health;
+#ifdef CSQC
+void(float isnew) item_health_netreceive;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_item_health;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) item_health_init;
+#endif
+#ifdef SSQC
void() item_health;
#endif
-#ifdef SSQC
// item_health_vial
+#ifdef CSQC
+void(float isnew) item_health_vial_netreceive;
+#endif
+#ifdef SSQC
entity(entity src) item_health_vial_drop;
-entity(entity src, vector org, vector vel) spawn_item_health_vial;
+entity(entity src, vector org, vector vel, float fl) spawn_item_health_vial;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) item_health_vial_init;
+#endif
+#ifdef SSQC
void() item_health_vial;
#endif
@@ -78,115 +113,243 @@ float (entity e, float healamount, float ignore) T_Heal =
{
if (e.health <= 0)
return 0;
- if ((!ignore) && (e.health >= other.max_health))
+ if ((!ignore) && (e.health >= e.max_health))
return 0;
healamount = ceil(healamount);
e.health = e.health + healamount;
- if ((!ignore) && (e.health >= other.max_health))
- e.health = other.max_health;
+ if ((!ignore) && (e.health >= e.max_health))
+ e.health = e.max_health;
- if (e.health > 250)
- e.health = 250;
+ if (e.health > PLAYER_HEALTH_MEGA)
+ e.health = PLAYER_HEALTH_MEGA;
return 1;
};
#endif
-#ifdef SSQC
//----------------------------------------------------------------------
// class base_item_health: base_item
// {
+#ifdef SSQC
//--------------------------------------------------------------
- // health_touch
+ #define BASE_ITEM_HEALTH_RESPAWNDM(health_item) \
+ { \
+ /* Special case for megahealth -- CEV */ \
+ /* Regarding the deathmatch respawn time below:
+ * id's original code made the megahealth respawn 20 seconds
+ * after the health of the player who collected it finished
+ * rotting down. However, this mod has already got rid of the
+ * weird old megahealth behavior whereby it monitored the
+ * player who touched it, so the original respawn logic isn't
+ * applicable. As a solution, the code below uses a respawn
+ * time of 125 seconds for deathmatch, because that was the
+ * worst-case scenario of id's original code (5 seconds before
+ * the player's health started to rot, plus 100 seconds to rot
+ * down 100 health points, plus the original 20 second delay
+ * before the item respawned). -- iw */ \
+ local float respawndm; \
+ if (health_item.weapon == ITEM_SEQ_HEALTH_MEGA) \
+ respawndm = HEALTH_RESPAWN_MEGA; \
+ else \
+ respawndm = HEALTH_RESPAWN_DM; \
+ }
+
//--------------------------------------------------------------
- void() base_item_health_touch =
+ float(entity toucher, float item_index) base_item_health_addhealth =
{
- if (sub_checkvalidtouch(other) == FALSE)
- return;
+ local float amount = 0;
- local float amount;
- amount = self.healamount;
+ switch (item_index)
+ {
+ case ITEM_SEQ_HEALTH_ROTTEN:
+ amount = HEALTH_ROTTEN_AMOUNT;
+ break;
+ case ITEM_SEQ_HEALTH:
+ amount = HEALTH_NORMAL_AMOUNT;
+ break;
+ case ITEM_SEQ_HEALTH_MEGA:
+ amount = HEALTH_MEGA_AMOUNT;
+ break;
+ case ITEM_SEQ_HEALTH_VIAL:
+ amount = HEALTH_VIAL_AMOUNT;
+ break;
+ }
- if (self.healtype == HEALTH_TYPE_MEGA)
+ if (item_index == ITEM_SEQ_HEALTH_MEGA ||
+ item_index == ITEM_SEQ_HEALTH_VIAL)
{
- // Megahealth? Ignore max_health...
- if (other.health >= 250)
- return;
- if (!T_Heal(other, amount, 1))
- return;
+ // Megahealth? Ignore max_health...
+ if (toucher.health >= PLAYER_HEALTH_MEGA)
+ return FALSE;
+ if (!T_Heal(toucher, amount, 1))
+ return FALSE;
+
+ // Megahealth = rot down the player's super health
+ // thanks ydrol!!!
+ toucher.megahealth_rottime = time + 5;
+ toucher.items = toucher.items | IT_SUPERHEALTH;
}
else
{
- if (!T_Heal(other, amount, 0))
- return;
+ if (!T_Heal(toucher, amount, 0))
+ return FALSE;
}
- sprint (other, sprintf("You receive %g health\n", amount));
+ sprint (toucher, sprintf("%s receives %g health!\n",
+ toucher.netname, amount));
- // health touch sound
- // sound (other, CHAN_ITEM, self.noise, VOL_HIGH, ATTN_NORM);
- // custom sounds -- dumptruck_ds
- sound_misc (other, CHAN_AUTO, self.noise, VOL_HIGH, ATTN_NORM);
+ local item_info_t item = item_info[item_index];
+ sound (toucher, CHAN_ITEM_HEALTH, item.pickup_sound,
+ item.pickup_vol, ATTN_NORM);
- stuffcmd (other, "bf\n");
+ stuffcmd (toucher, "bf\n");
- self.model = __NULL__;
- self.solid = SOLID_NOT;
+ return TRUE;
+ };
- // Megahealth = rot down the player's super health
- if (self.healtype == HEALTH_TYPE_MEGA)
- {
- // thanks ydrol!!!
- other.megahealth_rottime = time + 5;
- other.items = other.items | IT_SUPERHEALTH;
- self.owner = other;
-
- // Regarding the deathmatch respawn time below:
- // id's original code made the megahealth respawn
- // 20 seconds after the health of the player who
- // collected it finished rotting down. However,
- // this mod has already got rid of the weird old
- // megahealth behavior whereby it monitored the
- // player who touched it, so the original respawn
- // logic isn't applicable. As a solution, the code
- // below uses a respawn time of 125 seconds for
- // deathmatch, because that was the worst-case
- // scenario of id's original code (5 seconds before
- // the player's health started to rot, plus 100
- // seconds to rot down 100 health points, plus the
- // original 20 second delay before the item
- // respawned). -- iw
-
- base_item_check_respawn (self, HEALTH_RESPAWN_SP,
- HEALTH_RESPAWN_MEGA);
- }
- else
+ //--------------------------------------------------------------
+ // base_item_health_grab -- player has 'grabbed' the item -- CEV
+ //--------------------------------------------------------------
+ void(entity grabber, entity box) base_item_health_grab =
+ {
+ BASE_ITEM_INVENTORY_ADD (box, grabber)
+
+ sprint (grabber, sprintf("%s grabbed the %s\n",
+ grabber.netname, box.netname));
+
+ // don't re-grab / immediately throw the item -- CEV
+ if (grabber.button6)
+ grabber.flags |= FL_THROW_HELD;
+
+ if (grabber.classtype == CT_PLAYER && grabber.SendEntity)
+ grabber.SendFlags |= NETFLAG_PLAYER_WEAPON;
+
+ // fire all targets / killtargets
+ local entity stemp = self;
+ local entity otemp = other;
+ other = grabber;
+ self = box;
+ activator = other;
+ sub_usetargets ();
+ self = stemp;
+ other = otemp;
+
+ // remove or respawn -- CEV
+ BASE_ITEM_HEALTH_RESPAWNDM (box)
+ BASE_ITEM_CHECKREMOVE (box, HEALTH_RESPAWN_SP, respawndm)
+ };
+
+ //--------------------------------------------------------------
+ // base_item_health_fire
+ // player has pressed +attack while holding the item -- CEV
+ //--------------------------------------------------------------
+ void(entity attacker, float item_index) base_item_health_fire =
+ {
+ // open the health box -- CEV
+ if (base_item_health_addhealth(attacker, item_index) == FALSE)
+ // health didn't add (for whatever reason) -- CEV
+ return;
+
+ // now remove the health box from inventory -- CEV
+ BASE_ITEM_INVENTORY_REMOVE (attacker)
+
+ if (attacker.classtype == CT_PLAYER && attacker.SendEntity)
+ attacker.SendFlags |= NETFLAG_PLAYER_HEALTH |
+ NETFLAG_PLAYER_WEAPON;
+ };
+
+ //--------------------------------------------------------------
+ // health_touch
+ //--------------------------------------------------------------
+ void() base_item_health_touch =
+ {
+ // thrown item check -- CEV
+ if (base_item_touch_projectile())
+ return;
+
+ if (sub_checkvalidtouch(other) == FALSE)
+ return;
+
+ // ...except for this: don't touch() if the player isn't
+ // holding a weapon -- CEV
+ BASE_ENTITY_WEAPONLOOKUP (other)
+ if (item_index < ITEM_SEQ_W_START||item_index > ITEM_SEQ_W_END)
{
- base_item_check_respawn (self, HEALTH_RESPAWN_SP,
- HEALTH_RESPAWN_DM);
+ if (item_index == ITEM_SEQ_HANDS && other.button6 &&
+ !(other.flags & FL_THROW_HELD))
+ {
+ // self.attack_finished = time + 0.5;
+ base_item_health_grab (other, self);
+ return;
+ }
+ else
+ {
+ return;
+ }
}
+ if (base_item_health_addhealth(other, self.weapon) == FALSE)
+ return;
+
+ if (other.classtype == CT_PLAYER && other.SendEntity)
+ other.SendFlags |= NETFLAG_PLAYER_HEALTH;
+
// fire all targets / killtargets
activator = other;
sub_usetargets ();
+
+ // remove or respawn -- CEV
+ BASE_ITEM_HEALTH_RESPAWNDM (self)
+ BASE_ITEM_CHECKREMOVE (self, HEALTH_RESPAWN_SP, respawndm)
+ };
+
+ //--------------------------------------------------------------
+ void(string key, string value) base_item_health_init_field =
+ {
+ base_item_init_field (key, value);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) base_item_health_init =
{
e.classgroup |= CG_ITEM_HEALTH;
+
+ local item_info_t item = item_info[e.weapon];
+
+ #ifdef SSQC
+ e.touch = base_item_health_touch;
+ precache_model (item.world_model);
+ precache_sound (item.pickup_sound);
+ setmodel (e, item.world_model);
+ #endif
+
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ #endif
+
+ e.noise = item.pickup_sound;
+ e.netname = item.name;
+
base_item_init (e);
+
+ #ifdef SSQC
+ // set up rotation -- CEV
+ BASE_ITEM_THROW_ROTATION (e, item)
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
strip void() base_item_health =
{
base_item_health_init (self);
};
-// };
#endif
+// };
-#ifdef SSQC
/*QUAKED item_health (.3 .3 1) (0 0 0) (32 32 32) ROTTEN MEGAHEALTH X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ( {{ spawnflags & 1 -> { "path" : "maps/b_bh10.bsp" }, spawnflags & 2 -> { "path" : "maps/b_bh100.bsp" },
@@ -200,129 +363,60 @@ rot the player back down to 100 health after 5 seconds.
//----------------------------------------------------------------------
// class item_health: base_item_health
// {
+#ifdef CSQC
//--------------------------------------------------------------
- entity(entity src, vector org, vector vel, float flags)
+ void(float isnew) item_health_netreceive =
+ {
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (item_health_init)
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl)
spawn_item_health =
{
local entity e = spawn ();
e.owner = src;
+ e.spawnflags = fl;
e.origin = org;
e.velocity = vel;
- e.spawnflags = flags;
item_health_init (e);
return e;
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) item_health_init =
{
e.classname = "item_health";
e.classtype = CT_ITEM_HEALTH;
- e.touch = base_item_health_touch;
- if (e.spawnflags & HEALTH_ROTTEN)
+ #ifdef SSQC
+ if (e.spawnflags & SPAWNFLAG_ITEM_HEALTH_ROTTEN)
{
- // dumptruck_ds custom health models and sounds START
- if (world.style)
- {
- precache_body_model (e,
- "progs/health/m_h15.mdl");
- body_model (e, "progs/health/m_h15.mdl");
- }
- else
- {
- precache_body_model (e, "maps/b_bh10.bsp");
- body_model (e, "maps/b_bh10.bsp");
- }
-
- precache_sound_misc (e, "items/r_item1.wav");
- // e.noise = "items/r_item1.wav";
- if !(e.snd_misc)
- // set the custom noise in editor
- // -- dumptruck_ds
- e.snd_misc = "items/r_item1.wav";
- e.noise = e.snd_misc;
-
- // if !(e.healamount)
- // set your custom health amount here
- // -- dumptruck_ds
-
- e.healamount = HEALTH_ROTTEN_AMOUNT;
- e.healtype = HEALTH_TYPE_ROTTEN;
+ e.weapon = ITEM_SEQ_HEALTH_ROTTEN;
+ e.dmg = HEALTH_DAMAGE_SMALL;
if !(e.particles_offset)
e.particles_offset = '16 16 8';
- // dumptruck_ds custom health models and sounds END
+ }
+ else if (e.spawnflags & SPAWNFLAG_ITEM_HEALTH_MEGA)
+ {
+ e.weapon = ITEM_SEQ_HEALTH_MEGA;
+ e.dmg = HEALTH_DAMAGE_LARGE;
+ if !(e.particles_offset)
+ e.particles_offset = '16 16 16';
}
else
{
- if (e.spawnflags & HEALTH_MEGA)
- {
- // precache_model ("maps/b_bh100.bsp");
- if (world.style)
- {
- // models courtesy Lunaran
- // -- dumptruck_ds
- precache_body_model (e,
- "progs/health/m_h100.mdl");
- body_model (e,
- "progs/health/m_h100.mdl");
- }
- else
- {
- // setmodel(e, "maps/b_bh100.bsp");
- precache_body_model (e,
- "maps/b_bh100.bsp");
- body_model (e, "maps/b_bh100.bsp");
- }
-
- precache_sound_misc (e, "items/r_item2.wav");
- // e.noise = "items/r_item2.wav";
- if !(e.snd_misc)
- // set the custom noise in editor
- // -- dumptruck_ds
- e.snd_misc = "items/r_item2.wav";
- e.noise = e.snd_misc;
-
- // if !(e.healamount)
- // custom health amount
- // -- dumptruck_ds
-
- e.healamount = HEALTH_MEGA_AMOUNT;
- e.healtype = HEALTH_TYPE_MEGA;
- if !(e.particles_offset)
- e.particles_offset = '16 16 16';
- }
- else
- {
- if (world.style)
- {
- // models courtesy Lunaran
- // -- dumptruck_ds
- precache_body_model (e,
- "progs/health/m_h25.mdl");
- body_model (e,
- "progs/health/m_h25.mdl");
- }
- else
- {
- precache_body_model (e,
- "maps/b_bh25.bsp");
- body_model (e, "maps/b_bh25.bsp");
- }
- precache_sound_misc (e, "items/health1.wav");
- if !(e.snd_misc)
- // set custom noise in editor
- // -- dumptruck_ds
- e.snd_misc = "items/health1.wav";
- e.noise = e.snd_misc;
-
- e.healamount = HEALTH_NORMAL_AMOUNT;
- e.healtype = HEALTH_TYPE_NORMAL;
- if !(e.particles_offset)
- e.particles_offset = '16 16 8';
- // dumptruck_ds custom health models and sounds
- }
+ e.weapon = ITEM_SEQ_HEALTH;
+ e.dmg = HEALTH_DAMAGE_SMALL;
+ if !(e.particles_offset)
+ e.particles_offset = '16 16 8';
}
+ #endif
e.pos1 = '0 0 0';
e.pos2 = '32 32 56';
@@ -330,25 +424,35 @@ rot the player back down to 100 health after 5 seconds.
// StartItem
base_item_health_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() item_health =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (base_item_health_init_field)
item_health_init (self);
};
-// };
#endif
+// };
-#ifdef SSQC
//----------------------------------------------------------------------
// item_health_vial
//----------------------------------------------------------------------
// class item_health_vial: base_item_health
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) item_health_vial_netreceive =
+ {
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (item_health_vial_init)
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
entity(entity src) item_health_vial_drop =
{
@@ -356,57 +460,55 @@ rot the player back down to 100 health after 5 seconds.
vel_x = -100 + (random() * 200);
vel_y = -100 + (random() * 200);
vel_z = 300;
- return spawn_item_health_vial (src, src.origin - '0 0 24', vel);
+ return spawn_item_health_vial (src, src.origin - '0 0 24',
+ vel, SPAWNFLAG_ITEM_THROWN);
};
//--------------------------------------------------------------
- entity(entity src, vector org, vector vel) spawn_item_health_vial =
+ entity(entity src, vector org, vector vel, float fl)
+ spawn_item_health_vial =
{
local entity e = spawn ();
e.owner = src;
+ e.spawnflags = fl;
e.origin = org;
e.velocity = vel;
item_health_vial_init (e);
return e;
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) item_health_vial_init =
{
e.classname = "item_health_vial";
e.classtype = CT_ITEM_HEALTH_VIAL;
- e.touch = base_item_health_touch;
- // model from Hexen 2 -- dumptruck_ds
- precache_body_model (e, "progs/health/pd_vial.mdl");
- body_model (e, "progs/health/pd_vial.mdl");
- precache_sound_misc (e, "items/r_item1.wav");
- if !(e.snd_misc)
- // set the custom noise in editor -- dumptruck_ds
- e.snd_misc = "items/r_item1.wav";
- e.noise = e.snd_misc;
-
- e.healamount = HEALTH_VIAL_AMOUNT;
- // over heal and count down like mega health -- dumptruck_ds
- e.healtype = HEALTH_TYPE_MEGA;
- e.pos1 = '-16 -16 0';
- e.pos2 = '16 16 56';
+ #ifdef SSQC
+ e.weapon = ITEM_SEQ_HEALTH_VIAL;
+ e.dmg = HEALTH_DAMAGE_VIAL;
if !(e.particles_offset)
e.particles_offset = '0 0 0';
+ #endif
+
+ e.pos1 = '-16 -16 0';
+ e.pos2 = '16 16 56';
// StartItem
base_item_health_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() item_health_vial =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (base_item_health_init_field)
item_health_vial_init (self);
};
-// };
#endif
+// };
Return to the top of this page or return to the overview of this repo.
Diff qc/items/keys.qc
diff --git a/qc/items/keys.qc b/qc/items/keys.qc
index 76ec860..c83e2a0 100644
--- a/qc/items/keys.qc
+++ b/qc/items/keys.qc
@@ -40,8 +40,8 @@ void(entity e) temp_keydef_init;
strip void() temp_keydef;
#endif
-#ifdef SSQC
// base_item_key
+#ifdef SSQC
string() base_item_key_silvername;
string() base_item_key_goldname;
entity(string key_name) base_item_key_find_keydef;
@@ -51,30 +51,55 @@ void(entity client, float flags, float custom_flags) base_item_key_givekeys;
void(entity client) base_item_key_giveallkeys;
void(entity client, float flags, float custom_flags) base_item_key_removekeys;
void() base_item_key_touch;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) base_item_key_init;
+#endif
+#ifdef SSQC
strip void() base_item_key;
#endif
-#ifdef SSQC
// item_key1
+#ifdef CSQC
+void(float isnew) item_key1_netreceive;
+#endif
+#ifdef SSQC
entity(entity src) item_key1_drop;
entity(entity src, vector org, vector vel) spawn_item_key1;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) item_key1_init;
+#endif
+#ifdef SSQC
void() item_key1;
#endif
-#ifdef SSQC
// item_key2
+#ifdef CSQC
+void(float isnew) item_key2_netreceive;
+#endif
+#ifdef SSQC
entity(entity src) item_key2_drop;
entity(entity src, vector org, vector vel) spawn_item_key2;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) item_key2_init;
+#endif
+#ifdef SSQC
void() item_key2;
#endif
-#ifdef SSQC
// item_key_custom
+#ifdef CSQC
+void(float isnew) item_key_custom_netreceive;
+#endif
+#ifdef SSQC
entity(entity src, vector org, vector vel, string kname) spawn_item_key_custom;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) item_key_custom_init;
+#endif
+#ifdef SSQC
void() item_key_custom;
#endif
@@ -126,10 +151,10 @@ void() item_key_custom;
// };
#endif
-#ifdef SSQC
//----------------------------------------------------------------------
// class base_item_key: base_item
// {
+#ifdef SSQC
//==============================================================
// FUNCTIONS WHICH DEAL WITH KEY ITEM BITFLAGS AND NAMES
//==============================================================
@@ -156,11 +181,24 @@ void() item_key_custom;
//--------------------------------------------------------------
string() base_item_key_silvername =
{
- if (world.worldtype == WORLDTYPE_BASE)
- return "silver keycard";
- if (world.worldtype == WORLDTYPE_METAL)
- return "silver runekey";
- return "silver key";
+ local float item_index = 0;
+
+ if (world.style == WORLDTYPE_BASE)
+ item_index = ITEM_SEQ_KEY_SILVER_BASE;
+ else if (world.style == WORLDTYPE_MEDIEVAL)
+ item_index = ITEM_SEQ_KEY_SILVER_MEDIEVAL;
+ else if (world.style == WORLDTYPE_METAL)
+ item_index = ITEM_SEQ_KEY_SILVER_METAL;
+
+ if (item_index)
+ {
+ local item_info_t item = item_info[item_index];
+ return item.name;
+ }
+ else
+ {
+ return "base_item_key_goldname: ERROR";
+ }
};
//--------------------------------------------------------------
@@ -171,11 +209,24 @@ void() item_key_custom;
//--------------------------------------------------------------
string() base_item_key_goldname =
{
- if (world.worldtype == WORLDTYPE_BASE)
- return "gold keycard";
- if (world.worldtype == WORLDTYPE_METAL)
- return "gold runekey";
- return "gold key";
+ local float item_index = 0;
+
+ if (world.style == WORLDTYPE_BASE)
+ item_index = ITEM_SEQ_KEY_GOLD_BASE;
+ else if (world.style == WORLDTYPE_MEDIEVAL)
+ item_index = ITEM_SEQ_KEY_GOLD_MEDIEVAL;
+ else if (world.style == WORLDTYPE_METAL)
+ item_index = ITEM_SEQ_KEY_GOLD_METAL;
+
+ if (item_index)
+ {
+ local item_info_t item = item_info[item_index];
+ return item.name;
+ }
+ else
+ {
+ return "base_item_key_goldname: ERROR";
+ }
};
//--------------------------------------------------------------
@@ -297,8 +348,9 @@ void() item_key_custom;
if (base_item_key_haskeys(other, self.items, self.customkeys))
return;
- sprint (other, sprintf("You got the %s\n", self.netname));
-
+ // pickup message, pickup sound, & flash the screen -- CEV
+ sprint (other, sprintf("%s got the %s\n",
+ other.netname, self.netname));
sound (other, CHAN_ITEM, self.noise, VOL_HIGH, ATTN_NORM);
stuffcmd (other, "bf\n");
@@ -308,16 +360,20 @@ void() item_key_custom;
if (!coop)
{
self.solid = SOLID_NOT;
- self.model = __NULL__;
+ self.model = "";
+ setmodel (self, self.model);
+ self.SendFlags |= NETFLAG_BASE_ENTITY_SOLID |
+ NETFLAG_BASE_ENTITY_MODEL;
}
- activator = other;
- // fix key items firing their targets multiple times in coop
- // -- iw
+ // fix keys firing their targets multiple times in coop -- iw
// fire all targets / killtargets
+ activator = other;
sub_useandforgettargets ();
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
// key_start -- Finish initializing self as a key item. -- iw
//--------------------------------------------------------------
@@ -325,49 +381,53 @@ void() item_key_custom;
{
e.classgroup |= CG_ITEM_KEY;
- // key_setsounds
- // support for item_key_custom -- iw
- if (e.noise != "")
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ #endif
+
+ // get settings from an item_info def if we have one -- CEV
+ if (e.weapon)
{
- precache_sound (e.noise);
- }
- else
- {
- if (world.worldtype == WORLDTYPE_MEDIEVAL)
- {
- precache_sound ("misc/medkey.wav");
- e.noise = "misc/medkey.wav";
- }
- else if (world.worldtype == WORLDTYPE_METAL)
- {
- precache_sound ("misc/runekey.wav");
- e.noise = "misc/runekey.wav";
- }
- else if (world.worldtype == WORLDTYPE_BASE)
- {
- precache_sound2 ("misc/basekey.wav");
- e.noise = "misc/basekey.wav";
- }
+ local item_info_t item = item_info[e.weapon];
+
+ #ifdef SSQC
+ e.items = item.option;
+ precache_model (item.world_model);
+ precache_sound (item.pickup_sound);
+ setmodel (e, item.world_model);
+ #endif
+
+ e.noise = item.pickup_sound;
+
+ #ifdef SSQC
+ if (e.keyname != "")
+ e.netname = e.keyname;
+ else
+ #endif
+ e.netname = item.name;
}
// key_start
+ #ifdef SSQC
e.particles_offset = '0 0 18';
+ #endif
e.pos1 = '-16 -16 -24';
e.pos2 = '16 16 32';
// StartItem
base_item_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
strip void() base_item_key =
{
base_item_key_init (self);
};
-// };
#endif
+// };
-#ifdef SSQC
/*QUAKED item_key1 (0 .5 .8) (-16 -16 -24) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model("progs/w_s_key.mdl"); }
SILVER key
@@ -379,6 +439,16 @@ In order for keys to work you MUST set your map's worldtype to one of the follow
//----------------------------------------------------------------------
// class item_key1: base_item_key
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) item_key1_netreceive =
+ {
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (item_key1_init)
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
entity(entity src) item_key1_drop =
{
@@ -402,58 +472,51 @@ In order for keys to work you MUST set your map's worldtype to one of the follow
item_key1_init (e);
return e;
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) item_key1_init =
{
e.classname = "item_key1";
e.classtype = CT_ITEM_KEY1;
- e.touch = base_item_key_touch;
- if (world.worldtype == WORLDTYPE_MEDIEVAL)
- {
- precache_body_model (e, "progs/w_s_key.mdl");
- body_model (e, "progs/w_s_key.mdl");
- }
- else if (world.worldtype == WORLDTYPE_METAL)
- {
- precache_body_model (e, "progs/m_s_key.mdl");
- body_model (e, "progs/m_s_key.mdl");
- }
- else if (world.worldtype == WORLDTYPE_BASE)
- {
- precache_body_model2 (e, "progs/b_s_key.mdl");
- body_model (e, "progs/b_s_key.mdl");
- }
+ #ifdef CSQC
+ e.modelflags |= MF_ROTATE;
+ #endif
- if (e.keyname != "")
- e.netname = e.keyname;
- else
- e.netname = base_item_key_silvername ();
+ #ifdef SSQC
+ if (world.style == WORLDTYPE_MEDIEVAL)
+ e.weapon = ITEM_SEQ_KEY_SILVER_MEDIEVAL;
+ else if (world.style == WORLDTYPE_METAL)
+ e.weapon = ITEM_SEQ_KEY_SILVER_METAL;
+ else if (world.style == WORLDTYPE_BASE)
+ e.weapon = ITEM_SEQ_KEY_SILVER_BASE;
- e.items = IT_KEY1;
+ e.touch = base_item_key_touch;
- // support for item_key_custom -- iw
- e.customkeys = 0; // ignore any mapper-set value
- e.noise = ""; // ignore any mapper-set value
+ // ignore mapper-set fields (support for item_key_custom) -- iw
+ e.customkeys = 0;
+ e.noise = "";
+ #endif
// key_start
base_item_key_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() item_key1 =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (__NULL__)
item_key1_init (self);
};
-// };
#endif
+// };
-#ifdef SSQC
/*QUAKED item_key2 (0 .5 .8) (-16 -16 -24) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ("progs/w_g_key.mdl");
@@ -467,6 +530,16 @@ In order for keys to work you MUST set your map's worldtype to one of the follow
//----------------------------------------------------------------------
// class item_key2: base_item_key
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) item_key2_netreceive =
+ {
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (item_key2_init)
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
entity(entity src) item_key2_drop =
{
@@ -490,63 +563,56 @@ In order for keys to work you MUST set your map's worldtype to one of the follow
item_key2_init (e);
return e;
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) item_key2_init =
{
e.classname = "item_key2";
e.classtype = CT_ITEM_KEY2;
- e.touch = base_item_key_touch;
- if (world.worldtype == WORLDTYPE_MEDIEVAL)
- {
- precache_body_model (e, "progs/w_g_key.mdl");
- body_model (e, "progs/w_g_key.mdl");
- }
- else if (world.worldtype == WORLDTYPE_METAL)
- {
- precache_body_model (e, "progs/m_g_key.mdl");
- body_model (e, "progs/m_g_key.mdl");
- }
- else if (world.worldtype == WORLDTYPE_BASE)
- {
- precache_body_model2 (e, "progs/b_g_key.mdl");
- body_model (e, "progs/b_g_key.mdl");
- }
+ #ifdef CSQC
+ e.modelflags |= MF_ROTATE;
+ #endif
- if (e.keyname != "")
- e.keyname = "";
- else
- e.netname = base_item_key_goldname ();
+ #ifdef SSQC
+ if (world.style == WORLDTYPE_MEDIEVAL)
+ e.weapon = ITEM_SEQ_KEY_GOLD_MEDIEVAL;
+ else if (world.style == WORLDTYPE_METAL)
+ e.weapon = ITEM_SEQ_KEY_GOLD_METAL;
+ else if (world.style == WORLDTYPE_BASE)
+ e.weapon = ITEM_SEQ_KEY_GOLD_BASE;
- e.items = IT_KEY2;
+ e.touch = base_item_key_touch;
- // support for item_key_custom -- iw
- e.customkeys = 0; // ignore any mapper-set value
- e.noise = ""; // ignore any mapper-set value
+ // ignore mapper-set fields (support for item_key_custom) -- iw
+ e.customkeys = 0;
+ e.noise = "";
+ #endif
// key_start
base_item_key_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() item_key2 =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (__NULL__)
item_key2_init (self);
};
-// };
#endif
+// };
//======================================================================
// item_key_custom is a brand-spanking-new entity class created for
// progs_dump -- iw
//======================================================================
-#ifdef SSQC
/*QUAKED item_key_custom (0 .5 .8) (-16 -16 -24) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ({"path" : "progs/pd_w_key.mdl", "skin" : 1});
@@ -580,6 +646,16 @@ picked up. This is a limitation of the engine.
//----------------------------------------------------------------------
// class item_key_custom: base_item_key
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) item_key_custom_netreceive =
+ {
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (item_key_custom_init)
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
entity(entity src, vector org, vector vel, string kname)
spawn_item_key_custom =
@@ -592,14 +668,20 @@ picked up. This is a limitation of the engine.
item_key_custom_init (e);
return e;
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) item_key_custom_init =
{
e.classname = "item_key_custom";
e.classtype = CT_ITEM_KEY_CUSTOM;
- e.touch = base_item_key_touch;
+ #ifdef CSQC
+ e.modelflags |= MF_ROTATE;
+ #endif
+
+ #ifdef SSQC
if (e.keyname == "")
{
objerror ("no keyname specified");
@@ -612,6 +694,8 @@ picked up. This is a limitation of the engine.
return;
}
+ e.touch = base_item_key_touch;
+
precache_model (e.mdl);
setmodel (e, e.mdl);
// this should not be referenced again
@@ -625,18 +709,44 @@ picked up. This is a limitation of the engine.
e.items = 0;
e.customkeys = base_item_key_customflag (e.netname);
+ // key_setsounds -- support for item_key_custom -- iw
+ if (e.noise != "")
+ {
+ precache_sound (e.noise);
+ }
+ else
+ {
+ if (world.style == WORLDTYPE_MEDIEVAL)
+ {
+ precache_sound ("misc/medkey.wav");
+ e.noise = "misc/medkey.wav";
+ }
+ else if (world.style == WORLDTYPE_METAL)
+ {
+ precache_sound ("misc/runekey.wav");
+ e.noise = "misc/runekey.wav";
+ }
+ else if (world.style == WORLDTYPE_BASE)
+ {
+ precache_sound2 ("misc/basekey.wav");
+ e.noise = "misc/basekey.wav";
+ }
+ }
+ #endif
+
// key_start
base_item_key_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() item_key_custom =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (__NULL__)
item_key_custom_init (self);
};
-// };
#endif
+// };
Return to the top of this page or return to the overview of this repo.
Diff qc/items/powerups.qc
diff --git a/qc/items/powerups.qc b/qc/items/powerups.qc
index a8a1c3d..989b824 100644
--- a/qc/items/powerups.qc
+++ b/qc/items/powerups.qc
@@ -6,130 +6,253 @@
// forward declarations
//======================================================================
-#ifdef SSQC
// base_item_powerup
+#ifdef SSQC
+// BASE_ITEM_POWERUP_RESPAWNDELAY(idx)
+// BASE_ITEM_POWERUP_ADD(pl, idx)
+void(entity grabber, entity power) base_item_powerup_grab;
+void(entity attacker, float item_index) base_item_powerup_fire;
void() base_item_powerup_touch;
-entity(entity src, vector org, vector vel, void(entity) init_fn)
+entity(entity src, vector org, vector vel, float fl, void(entity) init_fn)
spawn_base_item_powerup;
+void(string key, string value) base_item_powerup_init_field;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) base_item_powerup_init;
-strip void() base_item_powerup;
#endif
-
#ifdef SSQC
-// item_artifact_invulnerability
-entity(entity src, vector org, vector vel) spawn_item_artifact_invulnerability;
-void(entity e) item_artifact_invulnerability_init;
-void() item_artifact_invulnerability;
+strip void() base_item_powerup;
#endif
-#ifdef SSQC
// item_artifact_envirosuit
-entity(entity src, vector org, vector vel) spawn_item_artifact_envirosuit;
+#ifdef CSQC
+void(float isnew) item_artifact_envirosuit_netreceive;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl)
+ spawn_item_artifact_envirosuit;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) item_artifact_envirosuit_init;
+#endif
+#ifdef SSQC
void() item_artifact_envirosuit;
#endif
-#ifdef SSQC
// item_artifact_invisibility
-entity(entity src, vector org, vector vel) spawn_item_artifact_invisibility;
+#ifdef CSQC
+void(float isnew) item_artifact_invisibility_netreceive;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl)
+ spawn_item_artifact_invisibility;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) item_artifact_invisibility_init;
+#endif
+#ifdef SSQC
void() item_artifact_invisibility;
#endif
+// item_artifact_invulnerability
+#ifdef CSQC
+void(float isnew) item_artifact_invulnerability_netreceive;
+#endif
#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl)
+ spawn_item_artifact_invulnerability;
+#endif
+#if defined(CSQC) || defined(SSQC)
+void(entity e) item_artifact_invulnerability_init;
+#endif
+#ifdef SSQC
+void() item_artifact_invulnerability;
+#endif
+
// item_artifact_super_damage
-entity(entity src, vector org, vector vel) spawn_item_artifact_super_damage;
+#ifdef CSQC
+void(float isnew) item_artifact_super_damage_netreceive;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl)
+ spawn_item_artifact_super_damage;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) item_artifact_super_damage_init;
+#endif
+#ifdef SSQC
void() item_artifact_super_damage;
#endif
//------------------------------------------------------------------------------
-#ifdef SSQC
//----------------------------------------------------------------------
// class base_item_powerup: base_item
// {
+#ifdef SSQC
+ //--------------------------------------------------------------
+ #define BASE_ITEM_POWERUP_RESPAWNDELAY(idx) \
+ { \
+ local float delay_sp = 0; \
+ local float delay_dm = 0; \
+ if (deathmatch) \
+ { \
+ if (idx == ITEM_SEQ_ARTIFACT_INVISIBILITY || \
+ idx == ITEM_SEQ_ARTIFACT_INVULNERABILITY) \
+ { \
+ delay_dm = time + 60 * 5; \
+ } \
+ else \
+ { \
+ delay_dm = time + 60; \
+ } \
+ } \
+ else \
+ { \
+ if (idx == ITEM_SEQ_ARTIFACT_INVISIBILITY || \
+ idx == ITEM_SEQ_ARTIFACT_INVULNERABILITY) \
+ { \
+ delay_sp = 300; \
+ } \
+ else \
+ { \
+ delay_sp = 60; \
+ } \
+ } \
+ }
+
+ //--------------------------------------------------------------
+ #define BASE_ITEM_POWERUP_ADD(pl, idx) \
+ { \
+ /* do the apropriate action */ \
+ if (idx == ITEM_SEQ_ARTIFACT_ENVIROSUIT) \
+ { \
+ pl.items |= IT_SUIT; \
+ pl.rad_time = 1; \
+ pl.radsuit_finished = time + 30; \
+ } \
+ else if (idx == ITEM_SEQ_ARTIFACT_INVISIBILITY) \
+ { \
+ pl.items |= IT_INVISIBILITY; \
+ pl.invisible_time = 1; \
+ pl.invisible_finished = time + 30; \
+ } \
+ else if (idx == ITEM_SEQ_ARTIFACT_INVULNERABILITY) \
+ { \
+ pl.items |= IT_INVULNERABILITY; \
+ pl.invincible_time = 1; \
+ pl.invincible_finished = time + 30; \
+ } \
+ else if (idx == ITEM_SEQ_ARTIFACT_QUAD) \
+ { \
+ pl.items |= IT_QUAD; \
+ pl.super_time = 1; \
+ pl.super_damage_finished = time + 30; \
+ } \
+ }
+
+ //--------------------------------------------------------------
+ void(entity grabber, entity power) base_item_powerup_grab =
+ {
+ BASE_ITEM_INVENTORY_ADD (power, grabber)
+
+ // don't re-grab / immediately throw the item -- CEV
+ if (grabber.button6)
+ grabber.flags |= FL_THROW_HELD;
+
+ // let the player know -- CEV
+ sprint (grabber, sprintf("%s grabbed the %s\n",
+ grabber.netname, power.netname));
+
+ // let the client (CSQC) know -- CEV
+ if (grabber.classtype == CT_PLAYER && grabber.SendEntity)
+ grabber.SendFlags |= NETFLAG_PLAYER_WEAPON;
+
+ // fire all targets / killtargets
+ local entity stemp = self;
+ local entity otemp = other;
+ other = grabber;
+ self = power;
+ activator = other;
+ sub_usetargets ();
+ self = stemp;
+ other = otemp;
+
+ // either remove the item or set up for respawning -- CEV
+ power.mdl = power.model;
+ BASE_ITEM_POWERUP_RESPAWNDELAY (power.weapon)
+ BASE_ITEM_CHECKREMOVE (power, delay_sp, delay_dm)
+ };
+
+ //--------------------------------------------------------------
+ void(entity attacker, float item_index) base_item_powerup_fire =
+ {
+ // add the item -- CEV
+ BASE_ITEM_POWERUP_ADD (attacker, item_index)
+
+ // now remove the powerup from the inventory -- CEV
+ BASE_ITEM_INVENTORY_REMOVE (attacker)
+
+ // make sure the client knows -- CEV
+ if (attacker.classtype == CT_PLAYER && attacker.SendEntity)
+ attacker.SendFlags |= NETFLAG_PLAYER_ITEMS |
+ NETFLAG_PLAYER_WEAPON;
+
+ // and make sure the player knows -- CEV
+ local item_info_t item = item_info[item_index];
+ BASE_ITEM_PICKUPMESSAGE (attacker, item, CHAN_ITEM_POWERUP)
+ };
+
//--------------------------------------------------------------
void() base_item_powerup_touch =
{
- if (sub_checkvalidtouch(other) == FALSE)
+ // thrown item check -- CEV
+ if (base_item_touch_projectile())
return;
- local float delay_sp = 0;
- local float delay_dm = 0;
-
- sprint (other, sprintf("You got the %s\n", self.netname));
+ if (sub_checkvalidtouch(other) == FALSE)
+ return;
- if (!deathmatch)
- {
- if (self.classtype == CT_ITEM_INVULNERABILITY ||
- self.classtype == CT_ITEM_INVISIBILITY)
- {
- delay_sp = 300;
- }
- else
- {
- delay_sp = 60;
- }
- }
- else
+ // don't touch() if the player isn't holding a weapon -- CEV
+ BASE_ENTITY_WEAPONLOOKUP (other)
+ if (item_index < ITEM_SEQ_W_START||item_index > ITEM_SEQ_W_END)
{
- if ((self.classtype == CT_ITEM_INVULNERABILITY) ||
- (self.classtype == CT_ITEM_INVISIBILITY))
+ if (item_index == ITEM_SEQ_HANDS && other.button6 &&
+ !(other.flags & FL_THROW_HELD))
{
- delay_dm = time + 60 * 5;
+ // self.attack_finished = time + 0.5;
+ base_item_powerup_grab (other, self);
+ return;
}
else
{
- delay_dm = time + 60;
+ return;
}
}
- sound (other, CHAN_VOICE, self.noise, VOL_HIGH, ATTN_NORM);
- stuffcmd (other, "bf\n");
- other.items = other.items | self.items;
+ // add the item -- CEV
+ BASE_ITEM_POWERUP_RESPAWNDELAY (self.weapon)
+ BASE_ITEM_POWERUP_ADD (other, self.weapon)
- // do the apropriate action
- if (self.classtype == CT_ITEM_ENVIROSUIT)
- {
- other.rad_time = 1;
- other.radsuit_finished = time + 30;
- }
+ local item_info_t item = item_info[self.weapon];
+ BASE_ITEM_PICKUPMESSAGE (other, item, CHAN_ITEM_POWERUP)
- if (self.classtype == CT_ITEM_INVULNERABILITY)
- {
- other.invincible_time = 1;
- other.invincible_finished = time + 30;
- }
- else if (self.classtype == CT_ITEM_INVISIBILITY)
- {
- other.invisible_time = 1;
- other.invisible_finished = time + 30;
- }
- else if (self.classtype == CT_ITEM_QUAD)
- {
- other.super_time = 1;
- other.super_damage_finished = time + 30;
- }
-
- // remove it in single player, or setup for respawning in DM
- // Supa, SP respawning items support
- self.mdl = self.model;
- self.solid = SOLID_NOT;
- self.model = __NULL__;
- base_item_check_respawn (self, delay_sp, delay_dm);
-
- activator = other;
// fire all targets / killtargets
+ activator = other;
sub_usetargets ();
+
+ // either remove the item or set up for respawning -- CEV
+ self.mdl = self.model;
+ BASE_ITEM_CHECKREMOVE (self, delay_sp, delay_dm)
};
//--------------------------------------------------------------
- entity(entity src, vector org, vector vel, void(entity) init_fn)
- spawn_base_item_powerup =
+ entity(entity src, vector org, vector vel, float fl,
+ void(entity) init_fn) spawn_base_item_powerup =
{
local entity e = spawn ();
e.owner = src;
+ e.spawnflags = fl;
e.origin = org;
e.velocity = vel;
init_fn (e);
@@ -137,79 +260,51 @@ void() item_artifact_super_damage;
};
//--------------------------------------------------------------
- void(entity e) base_item_powerup_init =
- {
- self.classgroup |= CG_ITEM_POWERUP;
- self.touch = base_item_powerup_touch;
- base_item_init (e);
- };
-
- //--------------------------------------------------------------
- strip void() base_item_powerup =
+ void(string key, string value) base_item_powerup_init_field =
{
- base_item_powerup_init (self);
+ base_item_init_field (key, value);
};
-// };
#endif
-#ifdef SSQC
-/*QUAKED item_artifact_invulnerability (0 .5 .8) (-16 -16 -24) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{ model("progs/invulner.mdl"); }
-Pentagram of Protection
-Player is invulnerable for 30 seconds
-*/
-//----------------------------------------------------------------------
-// class item_artifact_invulnerability: base_item_powerup
-// {
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
- entity(entity src, vector org, vector vel)
- spawn_item_artifact_invulnerability =
+ void(entity e) base_item_powerup_init =
{
- return spawn_base_item_powerup (src, org, vel,
- item_artifact_invulnerability_init);
- };
+ e.classgroup |= CG_ITEM_POWERUP;
- //--------------------------------------------------------------
- void(entity e) item_artifact_invulnerability_init =
- {
- e.classname = "item_artifact_invulnerability";
- e.classtype = CT_ITEM_INVULNERABILITY;
- precache_body_model (e, "progs/invulner.mdl");
- precache_sound ("items/protect.wav");
- // called in client.qc -- dumptruck_ds
- precache_sound ("items/protect2.wav");
- // called in combat.qc -- dumptruck_ds
- precache_sound ("items/protect3.wav");
- e.noise = "items/protect.wav";
- // setmodel (this, "progs/invulner.mdl");
- body_model (e, "progs/invulner.mdl");
- e.netname = "Pentagram of Protection";
- e.items = IT_INVULNERABILITY;
- e.pos1 = '-16 -16 -24';
- e.pos2 = '16 16 32';
+ local item_info_t item = item_info[e.weapon];
- // t_fog fix for custom models dumptruck_ds
- if !(e.particles_offset)
- e.particles_offset = '0 0 16';
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ e.modelflags |= MF_ROTATE;
+ #endif
- // StartItem
- base_item_powerup_init (e);
+ #ifdef SSQC
+ precache_model (item.world_model);
+ precache_sound (item.pickup_sound);
+ setmodel (e, item.world_model);
+ e.touch = base_item_powerup_touch;
+ #endif
+
+ e.noise = item.pickup_sound;
+
+ if (e.netname == __NULL__ || e.netname == "")
+ e.netname = item.name;
+
+ base_item_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
- void() item_artifact_invulnerability =
+ strip void() base_item_powerup =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- item_artifact_invulnerability_init (self);
+ base_item_powerup_init (self);
};
-// };
#endif
+// };
-#ifdef SSQC
/*QUAKED item_artifact_envirosuit (0 .5 .8) (-16 -16 -24) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model("progs/suit.mdl"); }
Biosuit
@@ -218,52 +313,64 @@ Player takes no damage from water or slime for 30 seconds
//----------------------------------------------------------------------
// class item_artifact_envirosuit: base_item_powerup
// {
+#ifdef CSQC
//--------------------------------------------------------------
- entity(entity src, vector org, vector vel)
+ void(float isnew) item_artifact_envirosuit_netreceive =
+ {
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (item_artifact_envirosuit_init)
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl)
spawn_item_artifact_envirosuit =
{
- return spawn_base_item_powerup (src, org, vel,
+ return spawn_base_item_powerup (src, org, vel, fl,
item_artifact_envirosuit_init);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) item_artifact_envirosuit_init =
{
e.classname = "item_artifact_envirosuit";
e.classtype = CT_ITEM_ENVIROSUIT;
- precache_body_model (e, "progs/suit.mdl");
- precache_sound ("items/suit.wav");
+ #ifdef SSQC
+ // base_item_powerup_init will cache suit.wav -- CEV
precache_sound ("items/suit2.wav");
- e.noise = "items/suit.wav";
- // setmodel (this, "progs/suit.mdl");
- body_model (e, "progs/suit.mdl");
- e.netname = "Biosuit";
+
+ e.weapon = ITEM_SEQ_ARTIFACT_ENVIROSUIT;
e.items = IT_SUIT;
- e.pos1 = '-16 -16 -24';
- e.pos2 = '16 16 32';
// t_fog fix for custom models dumptruck_ds
if !(e.particles_offset)
e.particles_offset = '0 0 32';
+ #endif
+
+ e.pos1 = '-16 -16 -24';
+ e.pos2 = '16 16 32';
// StartItem
base_item_powerup_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() item_artifact_envirosuit =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (base_item_powerup_init_field)
item_artifact_envirosuit_init (self);
};
-// };
#endif
+// };
-#ifdef SSQC
/*QUAKED item_artifact_invisibility (0 .5 .8) (-16 -16 -24) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model("progs/invisibl.mdl"); }
Ring of Shadows
@@ -272,53 +379,132 @@ Player is invisible for 30 seconds
//----------------------------------------------------------------------
// class item_artifact_invisibility: base_item_powerup
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) item_artifact_invisibility_netreceive =
+ {
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (item_artifact_invisibility_init)
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
- entity(entity src, vector org, vector vel)
+ entity(entity src, vector org, vector vel, float fl)
spawn_item_artifact_invisibility =
{
- return spawn_base_item_powerup (src, org, vel,
+ return spawn_base_item_powerup (src, org, vel, fl,
item_artifact_invisibility_init);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) item_artifact_invisibility_init =
{
e.classname = "item_artifact_invisibility";
e.classtype = CT_ITEM_INVISIBILITY;
- precache_body_model (e, "progs/invisibl.mdl");
- precache_sound ("items/inv1.wav");
+ #ifdef SSQC
precache_sound ("items/inv2.wav");
precache_sound ("items/inv3.wav");
- e.noise = "items/inv1.wav";
- // setmodel (this, "progs/invisibl.mdl");
- body_model (e, "progs/invisibl.mdl");
- e.netname = "Ring of Shadows";
+
+ e.weapon = ITEM_SEQ_ARTIFACT_INVISIBILITY;
e.items = IT_INVISIBILITY;
- e.pos1 = '-16 -16 -24';
- e.pos2 = '16 16 32';
// t_fog fix for custom models dumptruck_ds
if !(e.particles_offset)
e.particles_offset = '0 0 0';
+ #endif
+
+ e.pos1 = '-16 -16 -24';
+ e.pos2 = '16 16 32';
// StartItem
base_item_powerup_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() item_artifact_invisibility =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (base_item_powerup_init_field)
item_artifact_invisibility_init (self);
};
+#endif
// };
+
+/*QUAKED item_artifact_invulnerability (0 .5 .8) (-16 -16 -24) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{ model("progs/invulner.mdl"); }
+Pentagram of Protection
+Player is invulnerable for 30 seconds
+*/
+//----------------------------------------------------------------------
+// class item_artifact_invulnerability: base_item_powerup
+// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) item_artifact_invulnerability_netreceive =
+ {
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (item_artifact_invulnerability_init)
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl)
+ spawn_item_artifact_invulnerability =
+ {
+ return spawn_base_item_powerup (src, org, vel, fl,
+ item_artifact_invulnerability_init);
+ };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+ //--------------------------------------------------------------
+ void(entity e) item_artifact_invulnerability_init =
+ {
+ e.classname = "item_artifact_invulnerability";
+ e.classtype = CT_ITEM_INVULNERABILITY;
+
+ #ifdef SSQC
+ // called in client.qc -- dumptruck_ds
+ precache_sound ("items/protect2.wav");
+ // called in combat.qc -- dumptruck_ds
+ precache_sound ("items/protect3.wav");
+
+ e.weapon = ITEM_SEQ_ARTIFACT_INVULNERABILITY;
+ e.items = IT_INVULNERABILITY;
+
+ // t_fog fix for custom models dumptruck_ds
+ if !(e.particles_offset)
+ e.particles_offset = '0 0 16';
+ #endif
+
+ e.pos1 = '-16 -16 -24';
+ e.pos2 = '16 16 32';
+
+ // StartItem
+ base_item_powerup_init (e);
+ };
#endif
#ifdef SSQC
+ //--------------------------------------------------------------
+ void() item_artifact_invulnerability =
+ {
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (base_item_powerup_init_field)
+
+ item_artifact_invulnerability_init (self);
+ };
+#endif
+// };
+
/*QUAKED item_artifact_super_damage (0 .5 .8) (-16 -16 -24) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model("progs/quaddama.mdl"); }
Quad Damage
@@ -327,51 +513,60 @@ Player does 4x damage for 30 seconds
//----------------------------------------------------------------------
// class item_artifact_super_damage: base_item_powerup
// {
+#ifdef CSQC
//--------------------------------------------------------------
- entity(entity src, vector org, vector vel)
+ void(float isnew) item_artifact_super_damage_netreceive =
+ {
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (item_artifact_super_damage_init)
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl)
spawn_item_artifact_super_damage =
{
- return spawn_base_item_powerup (src, org, vel,
+ return spawn_base_item_powerup (src, org, vel, fl,
item_artifact_super_damage_init);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) item_artifact_super_damage_init =
{
e.classname = "item_artifact_super_damage";
e.classtype = CT_ITEM_QUAD;
- precache_body_model (e, "progs/quaddama.mdl");
- precache_sound ("items/damage.wav");
+ #ifdef SSQC
+ // base_item_powerup_init will cache damage.wav -- CEV
precache_sound ("items/damage3.wav");
- e.noise = "items/damage.wav";
- // setmodel (this, "progs/quaddama.mdl");
- body_model (e, "progs/quaddama.mdl");
-
- // custom name -- dumptruck_ds
- if !(e.netname)
- e.netname = "Quad Damage";
+ e.weapon = ITEM_SEQ_ARTIFACT_QUAD;
e.items = IT_QUAD;
- e.pos1 = '-16 -16 -24';
- e.pos2 = '16 16 32';
// t_fog fix for custom models dumptruck_ds
if !(e.particles_offset)
e.particles_offset = '0 0 16';
+ #endif
+
+ e.pos1 = '-16 -16 -24';
+ e.pos2 = '16 16 32';
// StartItem
base_item_powerup_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() item_artifact_super_damage =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (base_item_powerup_init_field)
item_artifact_super_damage_init (self);
};
-// };
#endif
+// };
Return to the top of this page or return to the overview of this repo.
Diff qc/items/runes.qc
diff --git a/qc/items/runes.qc b/qc/items/runes.qc
index 65e116e..f35956a 100644
--- a/qc/items/runes.qc
+++ b/qc/items/runes.qc
@@ -3,20 +3,62 @@
//==============================================================================
//======================================================================
+// constants
+//======================================================================
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// rune item spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_ITEM_SIGIL_RUNE1 = 1, // rune 1
+ SPAWNFLAG_ITEM_SIGIL_RUNE2 = 2, // rune 2
+ SPAWNFLAG_ITEM_SIGIL_RUNE3 = 4, // rune 3
+ SPAWNFLAG_ITEM_SIGIL_RUNE4 = 8, // rune 4
+ SPAWNFLAG_ITEM_SIGIL_RUNE5 = 16,// rune 5
+ SPAWNFLAG_ITEM_SIGIL_RUNE6 = 32 // rune 6 (overlaps with SPAWNSILENT)
+ // SPAWNFLAG_ITEM_SPAWNSILENT = 32, // see base_item.qc -- CEV
+ // SPAWNFLAG_ITEM_SPAWNED = 64, // see base_item.qc -- CEV
+ // SPAWNFLAG_ITEM_SUSPENDED = 128, // see base_item.qc -- CEV
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536 // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+ // SPAWNFLAG_ITEM_RESPAWN = 2097152, // see base_item.qc -- CEV
+ // SPAWNFLAG_ITEM_THROWN = 4194304, // see base_item.qc -- CEV
+ // SPAWNFLAG_ITEM_DONTDROP = 8388608 // see base_item.qc -- CEV
+} item_sigil_spawnflags;
+#endif
+
+//======================================================================
// forward declarations
//======================================================================
+// item_sigil
+#ifdef CSQC
+void(float isnew) item_sigil_netreceive;
+#endif
#ifdef SSQC
+// ITEM_SIGIL_GIVE()
void() item_sigil_touch2;
void() item_sigil_touch;
entity(entity src, vector org, vector vel, float flags) spawn_item_sigil;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) item_sigil_init;
+#endif
+#ifdef SSQC
void() item_sigil;
#endif
//------------------------------------------------------------------------------
-#ifdef SSQC
/*QUAKED item_sigil (0 .5 .8) (-16 -16 -24) (16 16 32) E1 E2 E3 E4 X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ( {{ spawnflags & 1 -> { "path" : "progs/end1.mdl" }, spawnflags & 2 -> { "path" : "progs/end2.mdl" },
@@ -33,6 +75,40 @@ Episode 4 - The Elder World - Run of Elder Magic
//----------------------------------------------------------------------
// class item_sigil: base_item
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) item_sigil_netreceive =
+ {
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (item_sigil_init)
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ #define ITEM_SIGIL_GIVE() \
+ { \
+ local entity p = findfloat (world, classtype, CT_PLAYER); \
+ while (p) \
+ { \
+ if (self.spawnflags & SPAWNFLAG_ITEM_SIGIL_RUNE1) \
+ p.items |= IT_RUNE1; \
+ else if (self.spawnflags & SPAWNFLAG_ITEM_SIGIL_RUNE2) \
+ p.items |= IT_RUNE2; \
+ else if (self.spawnflags & SPAWNFLAG_ITEM_SIGIL_RUNE3) \
+ p.items |= IT_RUNE3; \
+ else if (self.spawnflags & SPAWNFLAG_ITEM_SIGIL_RUNE4) \
+ p.items |= IT_RUNE4; \
+ else if (self.spawnflags & SPAWNFLAG_ITEM_SIGIL_RUNE5) \
+ p.items |= IT_RUNE5; \
+ else if (self.spawnflags & SPAWNFLAG_ITEM_SIGIL_RUNE6) \
+ p.items |= IT_RUNE6; \
+ if (p.SendEntity) \
+ p.SendFlags |= NETFLAG_PLAYER_ITEMS; \
+ p = findfloat (p, classtype, CT_PLAYER); \
+ } \
+ }
+
//--------------------------------------------------------------
// sigil_touch2 -- replacement for Skill Select Rune hack
// uses info_player_start2 if spawnflag 16 -- dumptruck_ds
@@ -44,18 +120,26 @@ Episode 4 - The Elder World - Run of Elder Magic
if (other.health <= 0)
return;
+ // don't alert the player in sigil_touch2 -- CEV
// centerprint (other, "You got the rune!");
-
// sound (other, CHAN_ITEM, this.noise, VOL_HIGH, ATTN_NORM);
// stuffcmd (other, "bf\n");
+
self.solid = SOLID_NOT;
- self.model = __NULL__;
+ self.model = "";
+ setmodel (self, self.model);
+ self.SendFlags |= NETFLAG_BASE_ENTITY_SOLID |
+ NETFLAG_BASE_ENTITY_MODEL;
serverflags = serverflags | (self.spawnflags & 16);
+
+ // give all connected players this item -- CEV
+ ITEM_SIGIL_GIVE ()
+
// so rune doors won't find it
self.classname = "";
- activator = other;
// fire all targets / killtargets
+ // activator = other;
// sub_usetargets ();
};
@@ -65,88 +149,129 @@ Episode 4 - The Elder World - Run of Elder Magic
if (sub_checkvalidtouch(other) == FALSE)
return;
- centerprint (other, "You got the rune!");
+ // don't touch if other isn't holding a weapon -- CEV
+ BASE_ENTITY_WEAPONLOOKUP (other)
+ if (item_index < ITEM_SEQ_W_START||item_index > ITEM_SEQ_W_END)
+ {
+ if (item_index != ITEM_SEQ_HANDS)
+ return;
+ if (!other.button6 && (!(other.flags & FL_THROW_HELD)))
+ return;
+ }
+ centerprint (other, sprintf("%s got the %s!",
+ other.netname, self.netname));
sound (other, CHAN_ITEM, self.noise, VOL_HIGH, ATTN_NORM);
stuffcmd (other, "bf\n");
+
self.solid = SOLID_NOT;
- self.model = __NULL__;
- serverflags = serverflags | (self.spawnflags & 15);
+ self.model = "";
+ setmodel (self, self.model);
+ self.SendFlags |= NETFLAG_BASE_ENTITY_SOLID |
+ NETFLAG_BASE_ENTITY_MODEL;
+ serverflags = serverflags | (self.spawnflags & SIGIL_AL);
+
+ // give all connected players this item -- CEV
+ ITEM_SIGIL_GIVE ()
+
// so rune doors won't find it
self.classname = "";
- activator = other;
// fire all targets / killtargets
+ activator = other;
sub_usetargets ();
};
//--------------------------------------------------------------
- entity(entity src, vector org, vector vel, float flags)
+ entity(entity src, vector org, vector vel, float fl)
spawn_item_sigil =
{
local entity e = spawn ();
e.owner = src;
+ e.spawnflags = fl;
e.origin = org;
e.velocity = vel;
- e.spawnflags = flags;
item_sigil_init (e);
return e;
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) item_sigil_init =
{
e.classname = "item_sigil";
e.classtype = CT_ITEM_RUNE;
+
+ #ifdef SSQC
e.touch = item_sigil_touch;
if (!e.spawnflags)
- objerror ("no spawnflags");
+ objerror ("item_sigil_init: no spawnflags!");
- precache_sound ("misc/runekey.wav");
- e.noise = "misc/runekey.wav";
-
- if (e.spawnflags & 1)
+ if (known_release == KNOWN_RELEASE_MG1)
{
- precache_model ("progs/end1.mdl");
- setmodel (e, "progs/end1.mdl");
+ if (e.spawnflags & SPAWNFLAG_ITEM_SIGIL_RUNE1)
+ e.weapon = ITEM_SEQ_MGRUNE1;
+ else if (e.spawnflags & SPAWNFLAG_ITEM_SIGIL_RUNE2)
+ e.weapon = ITEM_SEQ_MGRUNE2;
+ else if (e.spawnflags & SPAWNFLAG_ITEM_SIGIL_RUNE3)
+ e.weapon = ITEM_SEQ_MGRUNE3;
+ else if (e.spawnflags & SPAWNFLAG_ITEM_SIGIL_RUNE4)
+ e.weapon = ITEM_SEQ_MGRUNE4;
+ else if (e.spawnflags & SPAWNFLAG_ITEM_SIGIL_RUNE5)
+ e.weapon = ITEM_SEQ_MGRUNE5;
+ else if (e.spawnflags & SPAWNFLAG_ITEM_SIGIL_RUNE6)
+ e.weapon = ITEM_SEQ_MGRUNE6;
}
-
- if (e.spawnflags & 2)
+ else
{
- precache_model2 ("progs/end2.mdl");
- setmodel (e, "progs/end2.mdl");
+ if (e.spawnflags & SPAWNFLAG_ITEM_SIGIL_RUNE1)
+ e.weapon = ITEM_SEQ_RUNE1;
+ else if (e.spawnflags & SPAWNFLAG_ITEM_SIGIL_RUNE2)
+ e.weapon = ITEM_SEQ_RUNE2;
+ else if (e.spawnflags & SPAWNFLAG_ITEM_SIGIL_RUNE3)
+ e.weapon = ITEM_SEQ_RUNE3;
+ else if (e.spawnflags & SPAWNFLAG_ITEM_SIGIL_RUNE4)
+ e.weapon = ITEM_SEQ_RUNE4;
}
+ #endif
- if (e.spawnflags & 4)
- {
- precache_model2 ("progs/end3.mdl");
- setmodel (e, "progs/end3.mdl");
- }
+ local item_info_t item = item_info[e.weapon];
- if (e.spawnflags & 8)
- {
- precache_model2 ("progs/end4.mdl");
- setmodel (e, "progs/end4.mdl");
- }
+ #ifdef SSQC
+ precache_model (item.world_model);
+ setmodel (e, item.world_model);
+ precache_sound (item.pickup_sound);
+ #endif
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ e.modelflags |= MF_ROTATE;
+ #endif
+
+ e.noise = item.pickup_sound;
+ e.netname = item.name;
e.pos1 = '-16 -16 -24';
e.pos2 = '16 16 32';
+ #ifdef SSQC
e.particles_offset = '0 0 18';
+ #endif
// StartItem
base_item_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() item_sigil =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (__NULL__)
item_sigil_init (self);
};
-// };
#endif
+// };
Return to the top of this page or return to the overview of this repo.
Diff qc/items/weapons.qc
diff --git a/qc/items/weapons.qc b/qc/items/weapons.qc
index 9b3aedf..9ca280b 100644
--- a/qc/items/weapons.qc
+++ b/qc/items/weapons.qc
@@ -2,15 +2,33 @@
// items/weapons.qc -- weapons
//==============================================================================
+// TODO CEV .weapon is being used for default inventory slot AND
+// the item_seq index. This is a conflict.
+
//======================================================================
// constants
//======================================================================
#ifdef SSQC
-const float AMMO_CELLS_WP = 15; // cells on weapon pickup; id1 15
+//----------------------------------------------------------------------
+// default inventory slots for weapons
+//----------------------------------------------------------------------
+typedef enum
+{
+ ITEM_WEAPON_AXE = 1, // id1 weapons first
+ ITEM_WEAPON_SHOTGUN = 2,
+ ITEM_WEAPON_SUPERSHOTGUN = 3,
+ ITEM_WEAPON_NAILGUN = 4,
+ ITEM_WEAPON_SUPERNAILGUN = 5,
+ ITEM_WEAPON_GRENADELAUNCHER = 6,
+ ITEM_WEAPON_ROCKETLAUNCHER = 7,
+ ITEM_WEAPON_LIGHTNINGGUN = 8
+} item_info_weapon_defaultslots;
+
+const float AMMO_SHELLS_WP = 5; // shells on weapon pickup; id1 5
const float AMMO_NAILS_WP = 30; // nails on weapon pickup; id1 30
const float AMMO_ROCKETS_WP = 5; // rockets on weapon pickup; id1 5
-const float AMMO_SHELLS_WP = 5; // shells on weapon pickup; id1 5
+const float AMMO_CELLS_WP = 15; // cells on weapon pickup; id1 15
const float WEAPON_RESPAWN_TIME = 30; // as the name suggests; id1 30
#endif
@@ -19,340 +37,542 @@ const float WEAPON_RESPAWN_TIME = 30; // as the name suggests; id1 30
// forward declarations
//======================================================================
-#ifdef SSQC
-void(entity e) bound_entity_ammo;
-float(entity e, float w) rank_for_weapon;
-void(entity e, float old, float new) deathmatch_weapon;
-#endif
-
-#ifdef SSQC
// base_item_weapon
+#ifdef SSQC
+// BASE_ITEM_WEAPON_HAVEWEAPON(p, w)
+// BASE_ITEM_WEAPON_SLOTEMPTY(slot, p)
+// BASE_ITEM_WEAPON_ADDAMMO(p, w, i)
+// BASE_ITEM_WEAPON_ADDWEAPON(p, w, slot)
+void(entity grabber, entity wep) base_item_weapon_grab;
void() base_item_weapon_touch;
-entity(entity src, vector org, vector vel, void(entity) init_fn)
+entity(entity src, vector org, vector vel, float fl, void(entity) init_fn)
spawn_base_item_weapon;
+void(string key, string value) base_item_weapon_init_field;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) base_item_weapon_init;
+#endif
+#ifdef SSQC
strip void() base_item_weapon;
#endif
-#ifdef SSQC
// weapon_axe
-entity(entity src, vector org, vector vel) spawn_weapon_axe;
+#ifdef CSQC
+void(float isnew) weapon_axe_netreceive;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_weapon_axe;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) weapon_axe_init;
+#endif
+#ifdef SSQC
void() weapon_axe;
#endif
-#ifdef SSQC
// weapon_shotgun
-entity(entity src, vector org, vector vel) spawn_weapon_shotgun;
+#ifdef CSQC
+void(float isnew) weapon_shotgun_netreceive;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_weapon_shotgun;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) weapon_shotgun_init;
+#endif
+#ifdef SSQC
void() weapon_shotgun;
#endif
-#ifdef SSQC
// weapon_supershotgun
-entity(entity src, vector org, vector vel) spawn_weapon_supershotgun;
+#ifdef CSQC
+void(float isnew) weapon_supershotgun_netreceive;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_weapon_supershotgun;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) weapon_supershotgun_init;
+#endif
+#ifdef SSQC
void() weapon_supershotgun;
#endif
-#ifdef SSQC
// weapon_nailgun
-entity(entity src, vector org, vector vel) spawn_weapon_nailgun;
+#ifdef CSQC
+void(float isnew) weapon_nailgun_netreceive;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_weapon_nailgun;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) weapon_nailgun_init;
+#endif
+#ifdef SSQC
void() weapon_nailgun;
#endif
-#ifdef SSQC
// weapon_supernailgun
-entity(entity src, vector org, vector vel) spawn_weapon_supernailgun;
+#ifdef CSQC
+void(float isnew) weapon_supernailgun_netreceive;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl) spawn_weapon_supernailgun;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) weapon_supernailgun_init;
+#endif
+#ifdef SSQC
void() weapon_supernailgun;
#endif
-#ifdef SSQC
// weapon_grenadelauncher
-entity(entity src, vector org, vector vel) spawn_weapon_grenadelauncher;
+#ifdef CSQC
+void(float isnew) weapon_grenadelauncher_netreceive;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl)
+ spawn_weapon_grenadelauncher;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) weapon_grenadelauncher_init;
+#endif
+#ifdef SSQC
void() weapon_grenadelauncher;
#endif
-#ifdef SSQC
// weapon_rocketlauncher
-entity(entity src, vector org, vector vel) spawn_weapon_rocketlauncher;
+#ifdef CSQC
+void(float isnew) weapon_rocketlauncher_netreceive;
+#endif
+#ifdef SSQC
+entity(entity src, vector org, vector vel, float fl)
+ spawn_weapon_rocketlauncher;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) weapon_rocketlauncher_init;
+#endif
+#ifdef SSQC
void() weapon_rocketlauncher;
#endif
-#ifdef SSQC
// weapon_lightning
+#ifdef CSQC
+void(float isnew) weapon_lightning_netreceive;
+#endif
+#ifdef SSQC
void(vector p1, vector p2, entity from, float damage) fire_lightning;
-entity(entity src, vector org, vector vel) spawn_weapon_lightning;
+entity(entity src, vector org, vector vel, float fl) spawn_weapon_lightning;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) weapon_lightning_init;
+#endif
+#ifdef SSQC
void() weapon_lightning;
#endif
//------------------------------------------------------------------------------
-#ifdef SSQC
//----------------------------------------------------------------------
-void(entity e) bound_entity_ammo =
-{
- // these constants are defined in items/ammo.qc -- CEV
- if (e.ammo_shells > AMMO_SHELLS_MAX)
- e.ammo_shells = AMMO_SHELLS_MAX;
- if (e.ammo_nails > AMMO_NAILS_MAX)
- e.ammo_nails = AMMO_NAILS_MAX;
- if (e.ammo_rockets > AMMO_ROCKETS_MAX)
- e.ammo_rockets = AMMO_ROCKETS_MAX;
- if (e.ammo_cells > AMMO_CELLS_MAX)
- e.ammo_cells = AMMO_CELLS_MAX;
-};
+// class base_item_weapon: base_item
+// {
+#ifdef SSQC
+ //--------------------------------------------------------------
+ #define BASE_ITEM_WEAPON_HAVEWEAPON(p, w) \
+ { \
+ local float haveweapon = FALSE; \
+ if (p.inventory1 == w.weapon) haveweapon = TRUE; \
+ else if (p.inventory2 == w.weapon) haveweapon = TRUE; \
+ else if (p.inventory3 == w.weapon) haveweapon = TRUE; \
+ else if (p.inventory4 == w.weapon) haveweapon = TRUE; \
+ else if (p.inventory5 == w.weapon) haveweapon = TRUE; \
+ else if (p.inventory6 == w.weapon) haveweapon = TRUE; \
+ else if (p.inventory7 == w.weapon) haveweapon = TRUE; \
+ else if (p.inventory8 == w.weapon) haveweapon = TRUE; \
+ local item_info_t item = item_info[w.weapon]; \
+ }
-//----------------------------------------------------------------------
-float(entity e, float w) rank_for_weapon =
-{
- // 1997-12-23 Thunderbolt fix by Maddes recognize waterlevel
- if (e.waterlevel <= WATERLEVEL_FEET && w == IT_LIGHTNING)
- return 1;
- if (w == IT_ROCKET_LAUNCHER)
- return 2;
- if (w == IT_SUPER_NAILGUN)
- return 3;
- if (w == IT_GRENADE_LAUNCHER)
- return 4;
- if (w == IT_SUPER_SHOTGUN)
- return 5;
- if (w == IT_NAILGUN)
- return 6;
- if (w == IT_SHOTGUN)
- return 7;
- return 8;
-};
+ //--------------------------------------------------------------
+ #define BASE_ITEM_WEAPON_SLOTEMPTY(xin, p) \
+ { \
+ local float slotempty = FALSE; \
+ switch (xin) \
+ { \
+ case 1: \
+ if (p.inventory1 == ITEM_SEQ_HANDS) \
+ slotempty = TRUE; \
+ break; \
+ case 2: \
+ if (p.inventory2 == ITEM_SEQ_HANDS) \
+ slotempty = TRUE; \
+ break; \
+ case 3: \
+ if (p.inventory3 == ITEM_SEQ_HANDS) \
+ slotempty = TRUE; \
+ break; \
+ case 4: \
+ if (p.inventory4 == ITEM_SEQ_HANDS) \
+ slotempty = TRUE; \
+ break; \
+ case 5: \
+ if (p.inventory5 == ITEM_SEQ_HANDS) \
+ slotempty = TRUE; \
+ break; \
+ case 6: \
+ if (p.inventory6 == ITEM_SEQ_HANDS) \
+ slotempty = TRUE; \
+ break; \
+ case 7: \
+ if (p.inventory7 == ITEM_SEQ_HANDS) \
+ slotempty = TRUE; \
+ break; \
+ case 8: \
+ if (p.inventory8 == ITEM_SEQ_HANDS) \
+ slotempty = TRUE; \
+ break; \
+ } \
+ }
-//----------------------------------------------------------------------
-// deathmatch_weapon -- DM weapon change rules for picking up a weapon
-//----------------------------------------------------------------------
-void(entity e, float old, float new) deathmatch_weapon =
-{
- local float or, nr;
+ //--------------------------------------------------------------
+ #define BASE_ITEM_WEAPON_ADDAMMO(p, w, i) \
+ { \
+ switch (i.option) \
+ { \
+ case ITEM_AMMO_SHELLS: \
+ p.ammo_shells += w.ammo_shells; \
+ break; \
+ case ITEM_AMMO_NAILS: \
+ p.ammo_nails += w.ammo_nails; \
+ break; \
+ case ITEM_AMMO_ROCKETS: \
+ p.ammo_rockets += w.ammo_rockets; \
+ break; \
+ case ITEM_AMMO_CELLS: \
+ p.ammo_cells += w.ammo_cells; \
+ break; \
+ } \
+ }
- // change self.weapon if desired
- or = rank_for_weapon (e, e.weapon);
- nr = rank_for_weapon (e, new);
- if (nr < or)
- e.weapon = new;
-};
-#endif
+ //--------------------------------------------------------------
+ #define BASE_ITEM_WEAPON_ADDWEAPON(p, w, slot) \
+ { \
+ if (haveweapon == FALSE) \
+ { \
+ /* assign to the currently selected slot -- CEV */ \
+ switch (slot) \
+ { \
+ case 1: p.inventory1 = w.weapon; break; \
+ case 2: p.inventory2 = w.weapon; break; \
+ case 3: p.inventory3 = w.weapon; break; \
+ case 4: p.inventory4 = w.weapon; break; \
+ case 5: p.inventory5 = w.weapon; break; \
+ case 6: p.inventory6 = w.weapon; break; \
+ case 7: p.inventory7 = w.weapon; break; \
+ case 8: p.inventory8 = w.weapon; break; \
+ } \
+ } \
+ }
+
+ //--------------------------------------------------------------
+ void(entity pl, entity wep) base_item_weapon_grab =
+ {
+ // don't let the owner re-grab within a set time -- CEV
+ if (wep.owner)
+ if (pl == wep.owner)
+ if (time < wep.attack_finished)
+ return;
+
+ // creates the variables haveweapon, item -- CEV
+ BASE_ITEM_WEAPON_HAVEWEAPON (pl, wep)
+
+ // add ammo first -- CEV
+ BASE_ITEM_WEAPON_ADDAMMO (pl, wep, item)
+
+ // now add the weapon -- CEV
+ BASE_ITEM_WEAPON_ADDWEAPON (pl, wep, pl.weapon)
+
+ // let the player know -- CEV
+ BASE_ITEM_PICKUPMESSAGE (pl, item, CHAN_ITEM_WEAPON)
+
+ // restrict ammo to game maximums -- CEV
+ base_entity_boundammo (pl);
+
+ // don't re-grab / immediately throw the item -- CEV
+ if (pl.button6)
+ pl.flags |= FL_THROW_HELD;
+
+ if (pl.classtype == CT_PLAYER && pl.SendEntity)
+ pl.SendFlags |= NETFLAG_PLAYER_AMMO |
+ NETFLAG_PLAYER_INVENTORY;
+
+ // fire all targets / killtargets
+ local entity stemp = self;
+ local entity otemp = other;
+ other = pl;
+ self = wep;
+ activator = other;
+ sub_usetargets ();
+ self = stemp;
+ other = otemp;
+
+ // remove the grabbed item or set up for respawning -- CEV
+ BASE_ITEM_CHECKREMOVE (wep,
+ WEAPON_RESPAWN_TIME, WEAPON_RESPAWN_TIME)
+ };
-#ifdef SSQC
-//----------------------------------------------------------------------
-// class base_item_weapon: base_item
-// {
//--------------------------------------------------------------
// weapon_touch
//--------------------------------------------------------------
void() base_item_weapon_touch =
{
- local float hadammo, best, new, old;
- local float leave;
-
if (sub_checkvalidtouch(other) == FALSE)
return;
if (!(other.flags & FL_CLIENT))
return;
- // if the player was using his best weapon, change up to the
- // new one if better
- if (other.classtype == CT_PLAYER &&
- autocvar(cg_autoswitch, TRUE))
- {
- best = sub_runfloatas (other, player_best_weapon);
- }
+ // this macro creates the float 'item_index' -- CEV
+ BASE_ENTITY_WEAPONLOOKUP (other)
- if (deathmatch == 2 || coop)
- {
- leave = 1;
- // fix weapon items never firing their targets in coop or
- // "deathmatch 2" -- iw
- activator = other;
- sub_useandforgettargets ();
- }
- else
- {
- leave = 0;
- }
+ // don't touch() if other is holding a non-weapon -- CEV
+ if (item_index > ITEM_SEQ_W_END)
+ return;
- // johnfitz added for axe, shotgun items
- // -- dumptruck_ds from RRP / rubicon2
- if (self.classtype == CT_ITEM_AXE)
- {
- if (leave && (other.items & IT_AXE))
- return;
- new = IT_AXE;
- }
- else if (self.classtype == CT_ITEM_SHOTGUN)
- {
- if (leave && (other.items & IT_SHOTGUN))
- return;
- hadammo = other.ammo_shells;
- new = IT_SHOTGUN;
- other.ammo_shells += AMMO_SHELLS_WP;
- }
- else if (self.classtype == CT_ITEM_NAILGUN)
- {
- // johnfitz
- if (leave && (other.items & IT_NAILGUN))
- return;
- hadammo = other.ammo_nails;
- new = IT_NAILGUN;
- other.ammo_nails += AMMO_NAILS_WP;
- }
- else if (self.classtype == CT_ITEM_SUPER_NAILGUN)
- {
- if (leave && (other.items & IT_SUPER_NAILGUN))
- return;
- hadammo = other.ammo_rockets;
- new = IT_SUPER_NAILGUN;
- other.ammo_nails += AMMO_NAILS_WP;
- }
- else if (self.classtype == CT_ITEM_SUPER_SHOTGUN)
- {
- if (leave && (other.items & IT_SUPER_SHOTGUN))
- return;
- hadammo = other.ammo_rockets;
- new = IT_SUPER_SHOTGUN;
- other.ammo_shells += AMMO_SHELLS_WP;
- }
- else if (self.classtype == CT_ITEM_ROCKET_LAUNCHER)
- {
- if (leave && (other.items & IT_ROCKET_LAUNCHER))
- return;
- hadammo = other.ammo_rockets;
- new = IT_ROCKET_LAUNCHER;
- other.ammo_rockets += AMMO_ROCKETS_WP;
- }
- else if (self.classtype == CT_ITEM_GRENADE_LAUNCHER)
- {
- if (leave && (other.items & IT_GRENADE_LAUNCHER))
- return;
- hadammo = other.ammo_rockets;
- new = IT_GRENADE_LAUNCHER;
- other.ammo_rockets += AMMO_ROCKETS_WP;
- }
- else if (self.classtype == CT_ITEM_LIGHTNING_GUN)
+ // creates the variables haveweapon, item -- CEV
+ BASE_ITEM_WEAPON_HAVEWEAPON (other, self)
+
+ // creates the variable slotempty -- CEV
+ BASE_ITEM_WEAPON_SLOTEMPTY (self.weapon, other)
+
+ // behavior is different if player is holding grab -- CEV
+ if (other.button6 && !(other.flags & FL_THROW_HELD))
{
- if (leave && (other.items & IT_LIGHTNING))
- return;
- hadammo = other.ammo_rockets;
- new = IT_LIGHTNING;
- other.ammo_cells += AMMO_CELLS_WP;
+ // when player is holding grab, don't touch if
+ // A. they aren't already holding the same weapon or
+ // B. they don't have their hands out -- CEV
+ if (item_index != ITEM_SEQ_HANDS)
+ // if (item_index != self.weapon)
+ return;
}
else
{
- objerror ("base_item_weapon_touch: unknown classtype");
- return;
+ // when player isn't holding grab, don't touch if
+ // A. their hands aren't out and
+ // B. they don't already have the weapon -- CEV
+ if (item_index == ITEM_SEQ_HANDS)
+ return;
+ if (slotempty == FALSE)
+ if (haveweapon == FALSE)
+ return;
}
- sprint (other, sprintf("You got the %s\n", self.netname));
- // weapon touch sound
- sound (other, CHAN_ITEM, "items/weapon_pickup.ogg",
- VOL_MHI, ATTN_NORM);
- stuffcmd (other, "bf\n");
+ // add ammo from the pickup -- CEV
+ BASE_ITEM_WEAPON_ADDAMMO (other, self, item)
- bound_entity_ammo (other);
+ // only add the weapon if the player's hands are empty -- CEV
+ local float destslot = 0;
+ if (item_index == ITEM_SEQ_HANDS)
+ destslot = other.weapon;
+ else if (slotempty)
+ destslot = self.weapon;
- // change to the weapon
- old = other.items;
- other.items = other.items | new;
-
- if (other.classtype == CT_PLAYER &&
- autocvar(cg_autoswitch, TRUE))
+ if (destslot)
{
- // 1997-12-23 Thunderbolt fix by Maddes start
- /*
- // don't separate between SinglePlayer/Coop
- // and Deathmatch
- if (!deathmatch)
- self.weapon = new;
- else
- */
- // 1997-12-23 Thunderbolt fix by Maddes end
- deathmatch_weapon (other, old, new);
- sub_runvoidas (other, player_set_current_ammo);
+ BASE_ITEM_WEAPON_ADDWEAPON (other, self, destslot)
}
- if (leave)
- return;
+ // let the player know -- CEV
+ BASE_ITEM_PICKUPMESSAGE (other, item, CHAN_ITEM_WEAPON)
- // remove it in single player, or setup for respawning
- // in deathmatch
- self.model = __NULL__;
- self.solid = SOLID_NOT;
- // Supa, SP respawning items support
- base_item_check_respawn (self,
- WEAPON_RESPAWN_TIME, WEAPON_RESPAWN_TIME);
+ // restrict ammo to game maximums -- CEV
+ base_entity_boundammo (other);
+
+ if (other.classtype == CT_PLAYER && other.SendEntity)
+ other.SendFlags |= NETFLAG_PLAYER_AMMO |
+ NETFLAG_PLAYER_INVENTORY;
- activator = other;
// fire all targets / killtargets
+ activator = other;
sub_usetargets ();
+
+ // remove the touched item or set up for respawning -- CEV
+ BASE_ITEM_CHECKREMOVE (self,
+ WEAPON_RESPAWN_TIME, WEAPON_RESPAWN_TIME)
};
//--------------------------------------------------------------
- entity(entity src, vector org, vector vel, void(entity) init_fn)
- spawn_base_item_weapon =
+ entity(entity src, vector org, vector vel, float fl,
+ void(entity) init_fn) spawn_base_item_weapon =
{
local entity e = spawn ();
e.owner = src;
+ e.spawnflags = fl;
e.origin = org;
e.velocity = vel;
init_fn (e);
+ e.attack_finished = time + 0.5;
return e;
};
//--------------------------------------------------------------
+ void(string key, string value) base_item_weapon_init_field =
+ {
+ base_item_init_field (key, value);
+ };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+ //--------------------------------------------------------------
void(entity e) base_item_weapon_init =
{
e.classgroup |= CG_ITEM_WEAPON;
+
+ local item_info_t item = item_info[e.weapon];
+
+ #ifdef SSQC
e.touch = base_item_weapon_touch;
+ precache_model (item.world_model);
+ precache_sound (item.pickup_sound);
+ setmodel (e, item.world_model);
+ #endif
+
+ #ifdef CSQC
+ setmodelindex (e, e.modelindex);
+ e.modelflags |= MF_ROTATE;
+ #endif
+
+ e.noise = item.pickup_sound;
+ e.netname = item.name;
+
+ #ifdef SSQC
+ // if we have an owner pull from that entity's ammo pool -- CEV
+ if (e.spawnflags & SPAWNFLAG_ITEM_THROWN) {
+ if (e.owner)
+ {
+ local float ammo = 0;
+ switch (item.option)
+ {
+ case ITEM_AMMO_SHELLS:
+ ammo = AMMO_SHELLS_WP;
+ if (e.owner.ammo_shells >= ammo)
+ {
+ e.owner.ammo_shells -= ammo;
+ }
+ else
+ {
+ ammo = e.owner.ammo_shells;
+ e.ammo_shells = ammo;
+ e.owner.ammo_shells = 0;
+ }
+ break;
+ case ITEM_AMMO_NAILS:
+ ammo = AMMO_NAILS_WP;
+ if (e.owner.ammo_nails >= ammo)
+ {
+ e.owner.ammo_nails -= ammo;
+ }
+ else
+ {
+ ammo = e.owner.ammo_nails;
+ e.ammo_nails = ammo;
+ e.owner.ammo_nails = 0;
+ }
+ break;
+ case ITEM_AMMO_ROCKETS:
+ ammo = AMMO_ROCKETS_WP;
+ if (e.owner.ammo_rockets >= ammo)
+ {
+ e.owner.ammo_rockets -= ammo;
+ }
+ else
+ {
+ ammo = e.owner.ammo_rockets;
+ e.ammo_rockets = ammo;
+ e.owner.ammo_rockets = 0;
+ }
+ break;
+ case ITEM_AMMO_CELLS:
+ ammo = AMMO_CELLS_WP;
+ if (e.owner.ammo_cells >= ammo)
+ {
+ e.owner.ammo_cells -= ammo;
+ }
+ else
+ {
+ ammo = e.owner.ammo_cells;
+ e.ammo_cells = ammo;
+ e.owner.ammo_cells = 0;
+ }
+ break;
+ default:
+ dprint (sprintf("base_item_weapon_"
+ "init: unknown ammo type %g "
+ "for entity type %s!\n",
+ item.option, e.classname));
+ break;
+ }
+
+ // update any CSQC clients listening in -- CEV
+ if (e.owner.classtype == CT_PLAYER)
+ if (e.owner.SendEntity) {
+ {
+ e.owner.SendFlags |= NETFLAG_PLAYER_WEAPON |
+ NETFLAG_PLAYER_AMMO;
+ } }
+ } }
+ #endif
+
base_item_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
strip void() base_item_weapon =
{
base_item_weapon_init (self);
};
-// };
#endif
+// };
//======================================================================
// Weapon 1: Ranger's Axe -- johnfitz -- dumptruck_ds from RRP and rubicon2
//======================================================================
-#ifdef SSQC
/*QUAKED weapon_axe (0 .5 .8) (-16 -16 0) (16 16 32)
Axe
*/
//----------------------------------------------------------------------
// class weapon_axe: base_item_weapon
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) weapon_axe_netreceive =
+ {
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (weapon_axe_init)
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
- entity(entity src, vector org, vector vel) spawn_weapon_axe =
+ entity(entity src, vector org, vector vel, float fl) spawn_weapon_axe =
{
- return spawn_base_item_weapon (src, org, vel, weapon_axe_init);
+ return spawn_base_item_weapon (src, org, vel, fl,
+ weapon_axe_init);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) weapon_axe_init =
{
e.classname = "weapon_axe";
e.classtype = CT_ITEM_AXE;
- precache_model ("progs/g_axe.mdl");
- setmodel (e, "progs/g_axe.mdl");
- e.weapon = IT_AXE;
- e.netname = "Axe";
+ #ifdef SSQC
+ e.weapon = ITEM_SEQ_AXE;
+ #endif
e.pos1 = '-16 -16 0';
e.pos2 = '16 16 56';
@@ -360,24 +580,24 @@ Axe
// StartItem
base_item_weapon_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() weapon_axe =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (base_item_weapon_init_field)
weapon_axe_init (self);
};
-// };
#endif
+// };
//======================================================================
// Weapon 2: Shotgun -- johnfitz -- dumptruck_ds from RRP and rubicon2
//======================================================================
-#ifdef SSQC
/*QUAKED weapon_shotgun (0 .5 .8) (-16 -16 0) (16 16 32) X STYLE_1 STYLE_2 X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model("progs/g_shotgn.mdl"); }
This is a pickup model that should be used when you want a player to spawn with only an axe and then later get the shotgun: (trigger_take_weapon or reset_items 2 in worldspawn). There are two models to choose from. Spawnflag 2 (the default) selects an unused “classic look” model from Rubicon 2 by metlslime. Spawnflag 4 is an alternate from Slapmap and has been used in a few mods.
@@ -387,49 +607,64 @@ Shotgun
//----------------------------------------------------------------------
// class weapon_shotgun: base_item_weapon
// {
+#ifdef CSQC
//--------------------------------------------------------------
- entity(entity src, vector org, vector vel) spawn_weapon_shotgun =
+ void(float isnew) weapon_shotgun_netreceive =
{
- return spawn_base_item_weapon (src, org, vel,
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (weapon_shotgun_init)
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl)
+ spawn_weapon_shotgun =
+ {
+ return spawn_base_item_weapon (src, org, vel, fl,
weapon_shotgun_init);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) weapon_shotgun_init =
{
e.classname = "weapon_shotgun";
e.classtype = CT_ITEM_SHOTGUN;
- precache_model ("progs/g_shotgu.mdl");
+ #ifdef SSQC
// new shotgun model by Starshipwaters
- // - dumptruck_ds - removed 2 older shotguns that used spawnflags
- setmodel (e, "progs/g_shotgu.mdl");
- e.weapon = IT_SHOTGUN;
- e.netname = "Shotgun";
+ // removed 2 older shotguns that used spawnflags -- dumptruck_ds
+ e.weapon = ITEM_SEQ_SHOTGUN;
+ if (!e.ammo_shells)
+ e.ammo_shells = AMMO_SHELLS_WP;
+ #endif
+
e.pos1 = '-16 -16 0';
e.pos2 = '16 16 56';
// StartItem
base_item_weapon_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() weapon_shotgun =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (base_item_weapon_init_field)
weapon_shotgun_init (self);
};
-// };
#endif
+// };
//======================================================================
// Weapon 3: Super Shotgun
//======================================================================
-#ifdef SSQC
/*QUAKED weapon_supershotgun (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model("progs/g_shot.mdl"); }
Double-barrelled Shotgun
@@ -437,49 +672,63 @@ Double-barrelled Shotgun
//----------------------------------------------------------------------
// class weapon_supershotgun: base_item_weapon
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) weapon_supershotgun_netreceive =
+ {
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (weapon_supershotgun_init)
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
- entity(entity src, vector org, vector vel) spawn_weapon_supershotgun =
+ entity(entity src, vector org, vector vel, float fl)
+ spawn_weapon_supershotgun =
{
- return spawn_base_item_weapon (src, org, vel,
+ return spawn_base_item_weapon (src, org, vel, fl,
weapon_supershotgun_init);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) weapon_supershotgun_init =
{
e.classname = "weapon_supershotgun";
e.classtype = CT_ITEM_SUPER_SHOTGUN;
- precache_model ("progs/g_shot.mdl");
- setmodel (e, "progs/g_shot.mdl");
- e.weapon = IT_SUPER_SHOTGUN;
- e.netname = "Double-barrelled Shotgun";
+ #ifdef SSQC
+ e.weapon = ITEM_SEQ_SUPERSHOTGUN;
+ if (!e.ammo_shells)
+ e.ammo_shells = AMMO_SHELLS_WP;
+ e.particles_offset = '0 0 33';
+ #endif
+
e.pos1 = '-16 -16 0';
e.pos2 = '16 16 56';
- e.particles_offset = '0 0 33';
-
// StartItem
base_item_weapon_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() weapon_supershotgun =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (base_item_weapon_init_field)
weapon_supershotgun_init (self);
};
-// };
#endif
+// };
//======================================================================
// Weapon 4: Nailgun
//======================================================================
-#ifdef SSQC
/*QUAKED weapon_nailgun (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model("progs/g_nail.mdl"); }
Nailgun
@@ -487,49 +736,63 @@ Nailgun
//----------------------------------------------------------------------
// class weapon_nailgun: base_item_weapon
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) weapon_nailgun_netreceive =
+ {
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (weapon_nailgun_init)
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
- entity(entity src, vector org, vector vel) spawn_weapon_nailgun =
+ entity(entity src, vector org, vector vel, float fl)
+ spawn_weapon_nailgun =
{
- return spawn_base_item_weapon (src, org, vel,
+ return spawn_base_item_weapon (src, org, vel, fl,
weapon_nailgun_init);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) weapon_nailgun_init =
{
e.classname = "weapon_nailgun";
e.classtype = CT_ITEM_NAILGUN;
- precache_model ("progs/g_nail.mdl");
- setmodel (e, "progs/g_nail.mdl");
- e.weapon = IT_NAILGUN;
- e.netname = "nailgun";
+ #ifdef SSQC
+ e.weapon = ITEM_SEQ_NAILGUN;
+ if (!e.ammo_shells)
+ e.ammo_nails = AMMO_NAILS_WP;
+ e.particles_offset = '0 0 31';
+ #endif
+
e.pos1 = '-16 -16 0';
e.pos2 = '16 16 56';
- e.particles_offset = '0 0 31';
-
// StartItem
base_item_weapon_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() weapon_nailgun =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (base_item_weapon_init_field)
weapon_nailgun_init (self);
};
-// };
#endif
+// };
//======================================================================
// Weapon 5: Super Nailgun
//======================================================================
-#ifdef SSQC
/*QUAKED weapon_supernailgun (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model("progs/g_nail2.mdl"); }
Perforator
@@ -537,49 +800,63 @@ Perforator
//----------------------------------------------------------------------
// class weapon_supernailgun: base_item_weapon
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) weapon_supernailgun_netreceive =
+ {
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (weapon_supernailgun_init)
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
- entity(entity src, vector org, vector vel) spawn_weapon_supernailgun =
+ entity(entity src, vector org, vector vel, float fl)
+ spawn_weapon_supernailgun =
{
- return spawn_base_item_weapon (src, org, vel,
+ return spawn_base_item_weapon (src, org, vel, fl,
weapon_supernailgun_init);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) weapon_supernailgun_init =
{
e.classname = "weapon_supernailgun";
e.classtype = CT_ITEM_SUPER_NAILGUN;
- precache_model ("progs/g_nail2.mdl");
- setmodel (e, "progs/g_nail2.mdl");
- e.weapon = IT_SUPER_NAILGUN;
- e.netname = "Super Nailgun";
+ #ifdef SSQC
+ e.weapon = ITEM_SEQ_SUPERNAILGUN;
+ if (!e.ammo_shells)
+ e.ammo_nails = AMMO_NAILS_WP;
+ e.particles_offset = '0 0 34';
+ #endif
+
e.pos1 = '-16 -16 0';
e.pos2 = '16 16 56';
- e.particles_offset = '0 0 34';
-
// StartItem
base_item_weapon_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() weapon_supernailgun =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (base_item_weapon_init_field)
weapon_supernailgun_init (self);
};
-// };
#endif
+// };
//======================================================================
// Weapon 6: Grenade Launcher
//======================================================================
-#ifdef SSQC
/*QUAKED weapon_grenadelauncher (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model("progs/g_rock.mdl"); }
Grenade Launcher
@@ -587,50 +864,63 @@ Grenade Launcher
//----------------------------------------------------------------------
// class weapon_grenadelauncher: base_item_weapon
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) weapon_grenadelauncher_netreceive =
+ {
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (weapon_grenadelauncher_init)
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
- entity(entity src, vector org, vector vel)
+ entity(entity src, vector org, vector vel, float fl)
spawn_weapon_grenadelauncher =
{
- return spawn_base_item_weapon (src, org, vel,
+ return spawn_base_item_weapon (src, org, vel, fl,
weapon_grenadelauncher_init);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) weapon_grenadelauncher_init =
{
e.classname = "weapon_grenadelauncher";
e.classtype = CT_ITEM_GRENADE_LAUNCHER;
- precache_model ("progs/g_rock.mdl");
- setmodel (e, "progs/g_rock.mdl");
- e.weapon = 3;
- e.netname = "Grenade Launcher";
+ #ifdef SSQC
+ e.weapon = ITEM_SEQ_GRENADELAUNCHER;
+ if (!e.ammo_shells)
+ e.ammo_rockets = AMMO_ROCKETS_WP;
+ e.particles_offset = '0 0 28';
+ #endif
+
e.pos1 = '-16 -16 0';
e.pos2 = '16 16 56';
- e.particles_offset = '0 0 28';
-
// StartItem
base_item_weapon_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() weapon_grenadelauncher =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (base_item_weapon_init_field)
weapon_grenadelauncher_init (self);
};
-// };
#endif
+// };
//======================================================================
// Weapon 7: Rocket Launcher
//======================================================================
-#ifdef SSQC
/*QUAKED weapon_rocketlauncher (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model("progs/g_rock2.mdl"); }
Rocket Launcher
@@ -638,49 +928,63 @@ Rocket Launcher
//----------------------------------------------------------------------
// class weapon_rocketlauncher: base_item_weapon
// {
+#ifdef CSQC
//--------------------------------------------------------------
- entity(entity src, vector org, vector vel) spawn_weapon_rocketlauncher =
+ void(float isnew) weapon_rocketlauncher_netreceive =
{
- return spawn_base_item_weapon (src, org, vel,
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (weapon_rocketlauncher_init)
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ entity(entity src, vector org, vector vel, float fl)
+ spawn_weapon_rocketlauncher =
+ {
+ return spawn_base_item_weapon (src, org, vel, fl,
weapon_rocketlauncher_init);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) weapon_rocketlauncher_init =
{
e.classname = "weapon_rocketlauncher";
e.classtype = CT_ITEM_ROCKET_LAUNCHER;
- precache_model ("progs/g_rock2.mdl");
- setmodel (e, "progs/g_rock2.mdl");
- e.weapon = 3;
- e.netname = "Rocket Launcher";
+ #ifdef SSQC
+ e.weapon = ITEM_SEQ_ROCKETLAUNCHER;
+ if (!e.ammo_shells)
+ e.ammo_rockets = AMMO_ROCKETS_WP;
+ e.particles_offset = '0 0 32';
+ #endif
+
e.pos1 = '-16 -16 0';
e.pos2 = '16 16 56';
- e.particles_offset = '0 0 32';
-
// StartItem
base_item_weapon_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() weapon_rocketlauncher =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (base_item_weapon_init_field)
weapon_rocketlauncher_init (self);
};
-// };
#endif
+// };
//======================================================================
// Weapon 8: Lightning Gun
//======================================================================
-#ifdef SSQC
/*QUAKED weapon_lightning (0 .5 .8) (-16 -16 0) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model("progs/g_light.mdl"); }
Thunderbolt
@@ -688,6 +992,16 @@ Thunderbolt
//----------------------------------------------------------------------
// class weapon_lightning: base_item_weapon
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) weapon_lightning_netreceive =
+ {
+ // creates a number of variables, including netflags -- CEV
+ BASE_ITEM_NETRECEIVE (weapon_lightning_init)
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
// this is here 'cause LG doesn't create a projectile... -- CEV
//--------------------------------------------------------------
@@ -736,39 +1050,44 @@ Thunderbolt
};
//--------------------------------------------------------------
- entity(entity src, vector org, vector vel) spawn_weapon_lightning =
+ entity(entity src, vector org, vector vel, float fl)
+ spawn_weapon_lightning =
{
- return spawn_base_item_weapon (src, org, vel,
+ return spawn_base_item_weapon (src, org, vel, fl,
weapon_lightning_init);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) weapon_lightning_init =
{
e.classname = "weapon_lightning";
e.classtype = CT_ITEM_LIGHTNING_GUN;
- precache_model ("progs/g_light.mdl");
- setmodel (e, "progs/g_light.mdl");
- e.weapon = 3;
- e.netname = "Thunderbolt";
+ #ifdef SSQC
+ e.weapon = ITEM_SEQ_LIGHTNINGGUN;
+ if (!e.ammo_shells)
+ e.ammo_cells = AMMO_CELLS_WP;
+ e.particles_offset = '0 0 31';
+ #endif
+
e.pos1 = '-16 -16 0';
e.pos2 = '16 16 56';
- e.particles_offset = '0 0 31';
-
// StartItem
base_item_weapon_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() weapon_lightning =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags, inhibit spawn, remap fields -- CEV
+ BASE_ITEM_PREINIT (base_item_weapon_init_field)
weapon_lightning_init (self);
};
-// };
#endif
+// };
Return to the top of this page or return to the overview of this repo.
Diff qc/keylock.qc
diff --git a/qc/keylock.qc b/qc/keylock.qc
index ea5bb57..b4d9b70 100644
--- a/qc/keylock.qc
+++ b/qc/keylock.qc
@@ -74,12 +74,14 @@ void(entity e) keylock_init =
local string default_noise3;
local string default_noise4;
- if (world.worldtype == WORLDTYPE_BASE)
+ // if (world.worldtype == WORLDTYPE_BASE)
+ if (world.style == WORLDTYPE_BASE)
{
default_noise3 = "doors/basetry.wav";
default_noise4 = "doors/baseuse.wav";
}
- else if (world.worldtype == WORLDTYPE_METAL)
+ // else if (world.worldtype == WORLDTYPE_METAL)
+ else if (world.style == WORLDTYPE_METAL)
{
default_noise3 = "doors/runetry.wav";
default_noise4 = "doors/runeuse.wav";
Return to the top of this page or return to the overview of this repo.
Diff qc/math.qc
diff --git a/qc/math.qc b/qc/math.qc
index e902a12..5731187 100644
--- a/qc/math.qc
+++ b/qc/math.qc
@@ -9,9 +9,6 @@
//======================================================================
#if defined(CSQC) || defined (SSQC)
-float(float value, float minValue, float maxValue) clamp;
-// float(float a, float b) mod; // available as an engine builtin
-float(float x) sign;
float(float value, float minValue, float maxValue) wrap;
#endif
@@ -42,61 +39,6 @@ float(float theta, float spd, vector source, vector dest)
#if defined(CSQC) || defined (SSQC)
//----------------------------------------------------------------------
-// clamp
-//
-// Limits the given value to the given range.
-// value: A number
-// minValue: The minimum value of the range
-// maxValue: The maximum value of the range
-// Returns: A number within the given range.
-//----------------------------------------------------------------------
-float(float value, float minValue, float maxValue) clamp =
-{
- if (value < minValue)
- {
- return minValue;
- }
- else if (value > maxValue)
- {
- return maxValue;
- }
-
- return value;
-};
-
-//----------------------------------------------------------------------
-// mod
-//
-// Returns the remainder after the division of a by n
-// a: The dividend
-// b: The divisor
-// Returns: The remainder of a divided by n
-//----------------------------------------------------------------------
-/*
-float(float a, float n) mod =
-{
- return a - (n * floor(a / n));
-};
-*/
-
-//----------------------------------------------------------------------
-// sign
-//
-// Returns an indication of the sign of the given number.
-// x: A number
-// Returns: -1 if x < 0, 0 if x == 0, 1 if x > 0.
-//----------------------------------------------------------------------
-float(float x) sign =
-{
- if (x > 0)
- return 1;
- else if (x < 0)
- return -1;
-
- return 0;
-};
-
-//----------------------------------------------------------------------
// wrap
//
// Limits the given value to the given range and will wrap the value to the
Return to the top of this page or return to the overview of this repo.
Diff qc/misc/ambient_sound.qc
diff --git a/qc/misc/ambient_sound.qc b/qc/misc/ambient_sound.qc
index 1104026..cc8dc18 100644
--- a/qc/misc/ambient_sound.qc
+++ b/qc/misc/ambient_sound.qc
@@ -42,9 +42,13 @@ void(entity e) base_ambient_sound_init;
strip void() base_ambient_sound;
// ambient_general
-void(entity e) ambient_general_init
+void(entity e) ambient_general_init;
void() ambient_general;
+// ambient_generic
+void(entity e) ambient_generic_init;
+void() ambient_generic;
+
// FireAmbient
void(entity e) FireAmbient_init;
void() FireAmbient;
@@ -166,7 +170,7 @@ void() ambient_thunder;
//--------------------------------------------------------------
void(vector source) ambient_sound_swamp2 =
{
- precache_sound (SND_AMBIENTSWAMP1);
+ precache_sound (SND_AMBIENTSWAMP2);
ambientsound (source, SND_AMBIENTSWAMP2, VOL_MID, ATTN_STATIC);
};
@@ -259,6 +263,47 @@ Keys:
};
// };
+/*QUAKED ambient_generic (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+*/
+//----------------------------------------------------------------------
+// class ambient_generic: base_mapentity
+// {
+ //--------------------------------------------------------------
+ void(entity e) ambient_generic_init =
+ {
+ e.classname = "ambient_generic";
+ e.classtype = CT_MISC_AMBIENT_GENERIC;
+
+ base_mapentity_init (e);
+
+ if (!e.noise)
+ {
+ dprint ("ambient_generic_init: no noise set. "
+ "removing.\n");
+ remove (e);
+ }
+
+ if (!e.volume)
+ e.volume = 0.5;
+ if (!e.delay)
+ e.delay = 3;
+
+ precache_sound (e.noise);
+ ambientsound (e.origin, e.noise, e.volume, e.delay);
+ makestatic (e);
+ };
+
+ //--------------------------------------------------------------
+ void() ambient_generic =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ ambient_generic_init (self);
+ };
+// };
+
/*QUAKED FireAmbient (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/
//----------------------------------------------------------------------
Return to the top of this page or return to the overview of this repo.
Diff qc/misc/explobox.qc
diff --git a/qc/misc/explobox.qc b/qc/misc/explobox.qc
index 21ae888..752105d 100644
--- a/qc/misc/explobox.qc
+++ b/qc/misc/explobox.qc
@@ -7,11 +7,17 @@
//======================================================================
#if defined(CSQC) || defined(SSQC)
-enumflags
+//----------------------------------------------------------------------
+// misc_explobox netflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
{
- MISC_EXPLOBOX_NET_ORIGIN, // origin has changed
- MISC_EXPLOBOX_NET_MODEL // model has changed
-};
+ NETFLAG_MISC_EXPLOBOX_ORIGIN, // origin has changed
+ NETFLAG_MISC_EXPLOBOX_MODEL // model has changed
+} base_explobox_netflags;
+
+const float NETFLAG_MISC_EXPLOBOX_FULLSEND = NETFLAG_MISC_EXPLOBOX_ORIGIN |
+ NETFLAG_MISC_EXPLOBOX_MODEL;
#endif
//======================================================================
@@ -58,17 +64,17 @@ void() misc_explobox2;
//--------------------------------------------------------------
void(float isnew) base_explobox_netreceive =
{
- local float netflags = ReadFloat ();
+ local float netflags = ReadByte ();
- if (netflags & MISC_EXPLOBOX_NET_ORIGIN)
+ if (netflags & NETFLAG_MISC_EXPLOBOX_ORIGIN)
{
self.origin_x = ReadCoord ();
self.origin_y = ReadCoord ();
self.origin_z = ReadCoord ();
}
- if (netflags & MISC_EXPLOBOX_NET_MODEL)
- self.modelindex = ReadFloat ();
+ if (netflags & NETFLAG_MISC_EXPLOBOX_MODEL)
+ self.modelindex = ReadShort ();
if (isnew)
if (self.classtype == CT_MISC_EXPLOBOX)
@@ -82,18 +88,22 @@ void() misc_explobox2;
//--------------------------------------------------------------
float(entity to, float netflags) base_explobox_netsend =
{
- WriteShort (MSG_ENTITY, self.classtype);
- WriteFloat (MSG_ENTITY, netflags);
+ WriteByte (MSG_ENTITY, self.classtype);
+
+ if (netflags > 255)
+ netflags = NETFLAG_MISC_EXPLOBOX_FULLSEND;
+
+ WriteByte (MSG_ENTITY, netflags);
- if (netflags & MISC_EXPLOBOX_NET_ORIGIN)
+ if (netflags & NETFLAG_MISC_EXPLOBOX_ORIGIN)
{
WriteCoord (MSG_ENTITY, self.origin_x);
WriteCoord (MSG_ENTITY, self.origin_y);
WriteCoord (MSG_ENTITY, self.origin_z);
}
- if (netflags & MISC_EXPLOBOX_NET_MODEL)
- WriteFloat (MSG_ENTITY, self.modelindex);
+ if (netflags & NETFLAG_MISC_EXPLOBOX_MODEL)
+ WriteShort (MSG_ENTITY, self.modelindex);
return TRUE;
};
@@ -189,8 +199,7 @@ Explosive box
}
e.SendEntity = base_explobox_netsend;
- e.SendFlags = e.SendFlags | MISC_EXPLOBOX_NET_ORIGIN |
- MISC_EXPLOBOX_NET_MODEL;
+ e.SendFlags = NETFLAG_MISC_EXPLOBOX_FULLSEND;
#endif
};
#endif
@@ -260,8 +269,7 @@ Smaller explosive box
}
e.SendEntity = base_explobox_netsend;
- e.SendFlags = e.SendFlags | MISC_EXPLOBOX_NET_ORIGIN |
- MISC_EXPLOBOX_NET_MODEL;
+ e.SendFlags = NETFLAG_MISC_EXPLOBOX_FULLSEND;
#endif
};
#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/misc/fireball.qc
diff --git a/qc/misc/fireball.qc b/qc/misc/fireball.qc
index 4aa53f3..c85f4ee 100644
--- a/qc/misc/fireball.qc
+++ b/qc/misc/fireball.qc
@@ -29,12 +29,30 @@ speed - set vertical speed of fireballs. default 1000.
//--------------------------------------------------------------
void() misc_fireball_think =
{
- spawn_projectile_fireball (self, self.origin,
- [(random() * 100) - 50,
- (random() * 100) - 50,
- self.speed + (random() * 200)],
+ local vector newvel;
+
+ if (self.movedir)
+ {
+ newvel = self.movedir;
+ newvel_x += crandom() * 20;
+ newvel_y += crandom() * 20;
+ newvel_z += crandom() * 20;
+ }
+ else
+ {
+ newvel_x = (random() * 100) - 50;
+ newvel_y = (random() * 100) - 50;
+ newvel_z = self.speed + (random() * 200);
+ }
+
+ spawn_projectile_fireball (self, self.origin, newvel,
FIREBALL_DIRECT_DAMAGE);
+ if (self.noise != __NULL__ && self.noise != "")
+ sound (self, CHAN_VOICE, self.noise,
+ VOL_HIGH, ATTN_NORM);
+ // fireball.noise2 = self.noise2
+
self.think = misc_fireball_think;
self.nextthink = time + (random() * 5) + 3;
};
@@ -53,13 +71,26 @@ speed - set vertical speed of fireballs. default 1000.
// fixed typo QIP - dumptruck_ds
e.speed = FIREBALL_SPEED;
- e.think = misc_fireball_think;
- // 1998-08-14 Incorrect setting of nextthink fix
- // by Maddes/Lord Sméagol
- // e.nextthink = time + (random() * 5);
- e.nextthink = time + 0.1 + (random() * 5);
- // 1998-08-14 Incorrect setting of nextthink fix
- // by Maddes/Lord Sméagol
+ if (e.noise != __NULL__ && e.noise != "")
+ precache_sound (e.noise);
+
+ if (e.noise2 != __NULL__ && e.noise2 != "")
+ precache_sound (e.noise2);
+
+ if (e.targetname != __NULL__ && e.targetname != "")
+ {
+ e.use = misc_fireball_think;
+ }
+ else
+ {
+ e.think = misc_fireball_think;
+ // 1998-08-14 Incorrect setting of nextthink fix
+ // by Maddes/Lord Sméagol
+ // e.nextthink = time + (random() * 5);
+ e.nextthink = time + 0.1 + (random() * 5);
+ // 1998-08-14 Incorrect setting of nextthink fix
+ // by Maddes/Lord Sméagol
+ }
};
//--------------------------------------------------------------
Return to the top of this page or return to the overview of this repo.
Diff qc/misc/infight.qc
diff --git a/qc/misc/infight.qc b/qc/misc/infight.qc
index 98556fd..1e221fa 100644
--- a/qc/misc/infight.qc
+++ b/qc/misc/infight.qc
@@ -18,8 +18,23 @@
//======================================================================
#ifdef SSQC
-const float INFIGHT_MUTUAL = 1;
-const float INFIGHT_PLAYER_ACTIVATION = 2;
+//----------------------------------------------------------------------
+// misc_infight spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_MISC_INFIGHT_MUTUAL = 1,
+ SPAWNFLAG_MISC_INFIGHT_MAINTAIN = 2 // was INFIGHT_PLAYER_ACTIVATION
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} misc_infight_spawnflags;
#endif
//======================================================================
@@ -133,14 +148,18 @@ void() misc_infight;
misc_infight_make_angry_at (t1, t2);
- if (self.spawnflags & INFIGHT_PLAYER_ACTIVATION)
+ if (self.spawnflags &
+ SPAWNFLAG_MISC_INFIGHT_MAINTAIN)
{
t1.infight_activator = activator;
t2.infight_activator = activator;
}
- if (self.spawnflags & INFIGHT_MUTUAL)
+ if (self.spawnflags &
+ SPAWNFLAG_MISC_INFIGHT_MUTUAL)
+ {
misc_infight_make_angry_at (t2, t1);
+ }
}
}
};
Return to the top of this page or return to the overview of this repo.
Diff qc/misc/lights.qc
diff --git a/qc/misc/lights.qc b/qc/misc/lights.qc
index b835147..a2a6ce7 100644
--- a/qc/misc/lights.qc
+++ b/qc/misc/lights.qc
@@ -1,5 +1,6 @@
//==============================================================================
// lights.qc taken from c0burn's Slipgate mod -- dumptruck_ds
+// also includes selections from MG1 lights.qc -- CEV
//==============================================================================
//======================================================================
@@ -7,12 +8,25 @@
//======================================================================
#ifdef SSQC
-const float LIGHT_START_OFF = 1;
-const float LIGHT_FADE_IN_OUT = 2;
-const float LIGHT_SILENT_TORCH = 4; // for silent torch -- dumptruck_ds
-
-const float LIGHT_THINK_FADE_IN = 1;
-const float LIGHT_THINK_FADE_OUT = 2;
+//----------------------------------------------------------------------
+// base_light spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_BASE_LIGHT_START_OFF = 1,
+ SPAWNFLAG_BASE_LIGHT_FADE_IN_OUT = 2,
+ SPAWNFLAG_BASE_LIGHT_SILENT_TORCH = 4, // silent torch -- dumptruck_ds
+ SPAWNFLAG_BASE_LIGHT_MG1_UPSIDE_DOWN = 4 // MG1 compat -- CEV
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} base_light_spawnflags;
#endif
//======================================================================
@@ -25,12 +39,17 @@ void() setup_lightstyles;
string(float num) lightstyle_fade_lookup;
// base_light
+// BASE_LIGHT_MG1_UPSIDEDOWN(entity e)
void() base_light_think_fade_in;
void() base_light_think_fade_out;
void() base_light_use;
void(entity e) base_light_init;
strip void() base_light;
+// dynamiclight
+void(entity e) dynamiclight_init;
+void() dynamiclight;
+
// light
void(entity e) light_init;
void() light;
@@ -66,6 +85,10 @@ void() light_flame_small_white;
// light_sprite_flame
void(entity e) light_sprite_flame_init;
void() light_sprite_flame;
+
+// light_flame_gas
+void(entity e) light_flame_gas_init;
+void() light_flame_gas;
#endif
//------------------------------------------------------------------------------
@@ -183,6 +206,19 @@ string(float num) lightstyle_fade_lookup =
// class base_light: base_mapentity
// {
//--------------------------------------------------------------
+ // MG1 spawnflag compatibility -- CEV
+ //--------------------------------------------------------------
+ #define BASE_LIGHT_MG1_UPSIDEDOWN(entity e) \
+ { \
+ if (known_release == KNOWN_RELEASE_MG1) { \
+ if (e.spawnflags & SPAWNFLAG_BASE_LIGHT_MG1_UPSIDE_DOWN) \
+ { \
+ e.spawnflags &= ~SPAWNFLAG_BASE_LIGHT_MG1_UPSIDE_DOWN; \
+ e.angles = '180 0 0'; \
+ } } \
+ }
+
+ //--------------------------------------------------------------
void() base_light_think_fade_in =
{
if (self.count < 0)
@@ -224,24 +260,34 @@ string(float num) lightstyle_fade_lookup =
//--------------------------------------------------------------
void() base_light_use =
{
- if (self.spawnflags & LIGHT_START_OFF)
+ if (self.spawnflags & SPAWNFLAG_BASE_LIGHT_START_OFF)
{
- self.spawnflags = self.spawnflags - LIGHT_START_OFF;
+ self.spawnflags &= ~SPAWNFLAG_BASE_LIGHT_START_OFF;
- if (self.spawnflags & LIGHT_FADE_IN_OUT && !self.style2)
+ if (!self.style2 && self.spawnflags &
+ SPAWNFLAG_BASE_LIGHT_FADE_IN_OUT)
+ {
base_light_think_fade_in ();
+ }
else
+ {
lightstyle (self.style,
lightstyle_lookup(self.style2));
+ }
}
else
{
- self.spawnflags = self.spawnflags + LIGHT_START_OFF;
+ self.spawnflags |= SPAWNFLAG_BASE_LIGHT_START_OFF;
- if (self.spawnflags & LIGHT_FADE_IN_OUT && !self.style2)
+ if (!self.style2 && self.spawnflags &
+ SPAWNFLAG_BASE_LIGHT_FADE_IN_OUT)
+ {
base_light_think_fade_out ();
+ }
else
+ {
lightstyle (self.style, "a");
+ }
}
};
@@ -268,7 +314,7 @@ string(float num) lightstyle_fade_lookup =
// switchable light
e.use = base_light_use;
- if (e.spawnflags & LIGHT_START_OFF)
+ if (e.spawnflags & SPAWNFLAG_BASE_LIGHT_START_OFF)
{
e.count = 0;
lightstyle (e.style, "a");
@@ -287,6 +333,28 @@ string(float num) lightstyle_fade_lookup =
};
// };
+//----------------------------------------------------------------------
+// class dynamiclight: base_mapentity
+// {
+ //--------------------------------------------------------------
+ void(entity e) dynamiclight_init =
+ {
+ e.classname = "dynamiclight";
+ e.classtype = CT_LIGHT_DYNAMIC;
+ base_mapentity_init (e);
+ };
+
+ //--------------------------------------------------------------
+ void() dynamiclight =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ dynamiclight_init (self);
+ };
+// };
+
/*QUAKED light (0 1 0) (-8 -8 -8) (8 8 8) LIGHT_START_OFF LIGHT_FADE_IN_OUT X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Light
@@ -530,14 +598,17 @@ See the "light" entity for a full description.
e.classtype = CT_LIGHT_TORCH_SMALL_WALLTORCH;
base_mapentity_init (e);
- // precache_model ("progs/flame.mdl");
- precache_body_model (e, "progs/flame.mdl");
- // setmodel (e, "progs/flame.mdl");
- body_model (e, "progs/flame.mdl");
+ BASE_LIGHT_MG1_UPSIDEDOWN (e)
+
+ precache_model ("progs/flame.mdl");
+ setmodel (e, "progs/flame.mdl");
+
// for silent torch -- dumptruck_ds
- if !(e.spawnflags && LIGHT_SILENT_TORCH)
+ if (!(e.spawnflags && SPAWNFLAG_BASE_LIGHT_SILENT_TORCH))
ambient_sound_fire (e.origin);
- makestatic (e);
+
+ // TODO CEV
+ // makestatic (e);
};
//--------------------------------------------------------------
@@ -566,6 +637,8 @@ See the "light" entity for a full description.
e.classtype = CT_LIGHT_FLAME_LARGE_YELLOW;
base_mapentity_init (e);
+ BASE_LIGHT_MG1_UPSIDEDOWN (e)
+
precache_model ("progs/flame2.mdl");
setmodel (e, "progs/flame2.mdl");
e.frame = 1;
@@ -599,6 +672,8 @@ See the "light" entity for a full description.
e.classtype = CT_LIGHT_FLAME_SMALL_YELLOW;
base_mapentity_init (e);
+ BASE_LIGHT_MG1_UPSIDEDOWN (e)
+
precache_model ("progs/flame2.mdl");
setmodel (e, "progs/flame2.mdl");
ambient_sound_fire (e.origin);
@@ -631,6 +706,8 @@ Identical to "light_flame_small_yellow"
e.classtype = CT_LIGHT_FLAME_SMALL_WHITE;
base_mapentity_init (e);
+ BASE_LIGHT_MG1_UPSIDEDOWN (e)
+
// same as small_yellow -- CEV
precache_model ("progs/flame2.mdl");
setmodel (e, "progs/flame2.mdl");
@@ -684,4 +761,45 @@ Large flame spite*/
light_sprite_flame_init (self);
};
// };
+
+/*QUAKED light_flame_gas (0 1 0) (-10 -10 -40) (10 10 40) START_OFF
+Gas flare (spawns two entites)
+*/
+//----------------------------------------------------------------------
+// class light_flame_gas: base_mapentity
+// {
+ //--------------------------------------------------------------
+ void(entity e) light_flame_gas_init =
+ {
+ // first entity -- CEV
+ e.classname = "light_flame_gas";
+ e.classtype = CT_LIGHT_FLAME_GAS;
+ base_mapentity_init (e);
+
+ precache_model ("progs/flame3.mdl");
+ setmodel (e, "progs/flame3.mdl");
+ e.alpha = 0.6;
+
+ // second entity -- CEV
+ entity s = spawn ();
+ s.classname = "light_flame_gas";
+ s.classtype = CT_LIGHT_FLAME_GAS;
+ base_mapentity_init (s);
+
+ setorigin (s, e.origin);
+ setmodel (s, "progs/flame3.mdl");
+ s.alpha = 0.4;
+ s.frame = 1;
+ };
+
+ //--------------------------------------------------------------
+ void() light_flame_gas =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ light_flame_gas_init (self);
+ };
+// };
#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/misc/model.qc
diff --git a/qc/misc/model.qc b/qc/misc/model.qc
index c85f012..fb1dc06 100644
--- a/qc/misc/model.qc
+++ b/qc/misc/model.qc
@@ -7,31 +7,57 @@
// Edited by: dumptruck_ds to add start and stop animations
//==============================================================================
+// TODO CEV the networking could be further optimized
+
//======================================================================
// constants
//======================================================================
#ifdef SSQC
-const float MISC_MODEL_GRAVITY = 1;
-const float MISC_MODEL_SOLID = 2;
-const float MISC_MODEL_BACK_AND_FORTH = 4;
-const float MISC_MODEL_ONLY_ONCE = 8;
-const float MISC_MODEL_PLAY_COUNT = 16;
-const float MISC_MODEL_STARTOFF = 32;
+//----------------------------------------------------------------------
+// base_misc_model spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_BASE_MISC_MODEL_GRAVITY = 1,
+ SPAWNFLAG_BASE_MISC_MODEL_SOLID = 2,
+ SPAWNFLAG_BASE_MISC_MODEL_BACK_AND_FORTH = 4,
+ SPAWNFLAG_BASE_MISC_MODEL_ONLY_ONCE = 8,
+ SPAWNFLAG_BASE_MISC_MODEL_PLAY_COUNT = 16,
+ SPAWNFLAG_BASE_MISC_MODEL_STARTOFF = 32
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} base_misc_model_spawnflags;
#endif
#if defined(CSQC) || defined(SSQC)
-enumflags
+//----------------------------------------------------------------------
+// generic misc_model networking flags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
{
- MISC_MODEL_NET_ORIGIN, // origin has changed
- MISC_MODEL_NET_MINS, // model size has changed
- MISC_MODEL_NET_MAXS, // ^^^
- MISC_MODEL_NET_MODEL, // .model has changed
- MISC_MODEL_NET_FRAME, // frame has changed
- MISC_MODEL_NET_FIRSTFRAME, // first frame
- MISC_MODEL_NET_LASTFRAME, // last frame
- MISC_MODEL_NET_STATE // active, inactive
-};
+ NETFLAG_MISC_MODEL_ORIGIN, // origin has changed
+ NETFLAG_MISC_MODEL_MINS, // model size has changed
+ NETFLAG_MISC_MODEL_MAXS, // ^^^
+ NETFLAG_MISC_MODEL_MODEL, // .model has changed
+ NETFLAG_MISC_MODEL_FRAME, // frame has changed
+ NETFLAG_MISC_MODEL_FIRSTFRAME, // first frame
+ NETFLAG_MISC_MODEL_LASTFRAME, // last frame
+ NETFLAG_MISC_MODEL_STATE // active, inactive
+} base_misc_model_netflags;
+
+const float NETFLAG_MISC_MODEL_FULLSEND = NETFLAG_MISC_MODEL_ORIGIN |
+ NETFLAG_MISC_MODEL_MINS | NETFLAG_MISC_MODEL_MAXS |
+ NETFLAG_MISC_MODEL_MODEL | NETFLAG_MISC_MODEL_FRAME |
+ NETFLAG_MISC_MODEL_FIRSTFRAME | NETFLAG_MISC_MODEL_LASTFRAME |
+ NETFLAG_MISC_MODEL_STATE;
#endif
//======================================================================
@@ -43,6 +69,11 @@ enumflags
.float last_frame; // The ending frame of the animation
#endif
+#ifdef SSQC
+.vector mdlsz; // additions by bmFbr for custom bbox
+.vector centeroffset;
+#endif
+
//======================================================================
// forward declarations
//======================================================================
@@ -78,57 +109,68 @@ void() misc_model;
//--------------------------------------------------------------
void(float isnew) base_misc_model_netreceive =
{
- local float netflags = ReadFloat ();
+ local float newframe = 0;
+ local float netflags = ReadByte ();
- if (netflags & MISC_MODEL_NET_ORIGIN)
+ if (netflags & NETFLAG_MISC_MODEL_ORIGIN)
{
self.origin_x = ReadCoord ();
self.origin_y = ReadCoord ();
self.origin_z = ReadCoord ();
}
- if (netflags & MISC_MODEL_NET_MINS)
+ if (netflags & NETFLAG_MISC_MODEL_MINS)
{
self.mins_x = ReadCoord ();
self.mins_y = ReadCoord ();
self.mins_z = ReadCoord ();
}
- if (netflags & MISC_MODEL_NET_MAXS)
+ if (netflags & NETFLAG_MISC_MODEL_MAXS)
{
self.maxs_x = ReadCoord ();
self.maxs_y = ReadCoord ();
self.maxs_z = ReadCoord ();
}
- if (netflags & MISC_MODEL_NET_MODEL)
- self.modelindex = ReadFloat ();
+ if (netflags & NETFLAG_MISC_MODEL_MODEL)
+ self.modelindex = ReadShort ();
- if (netflags & MISC_MODEL_NET_FRAME)
- self.frame = ReadFloat ();
+ if (netflags & NETFLAG_MISC_MODEL_FRAME)
+ newframe = ReadByte ();
- if (netflags & MISC_MODEL_NET_FIRSTFRAME)
- self.first_frame = ReadFloat ();
+ if (netflags & NETFLAG_MISC_MODEL_FIRSTFRAME)
+ self.first_frame = ReadByte ();
- if (netflags & MISC_MODEL_NET_LASTFRAME)
- self.last_frame = ReadFloat ();
+ if (netflags & NETFLAG_MISC_MODEL_LASTFRAME)
+ self.last_frame = ReadByte ();
- if (netflags & MISC_MODEL_NET_STATE)
- self.state = ReadFloat ();
+ if (netflags & NETFLAG_MISC_MODEL_STATE)
+ self.state = ReadByte ();
- if (isnew)
+ if (isnew && !(self.predraw))
if (self.classtype == CT_MISC_MODEL)
misc_model_init (self);
+
+ if (newframe != self.frame || isnew)
+ {
+ self.frame2 = self.frame;
+ self.lerptime = time;
+ self.frame = newframe;
+ }
};
//--------------------------------------------------------------
float() base_misc_model_predraw =
{
- // TODO CEV interpolation? animate on the client-side?
+ // interpolate frame
+ if (self.lerptime)
+ self.lerpfrac = 1 - (time - self.lerptime) * 10;
+
if (self.state == STATE_ACTIVE)
- return PREDRAW_AUTOADD;
- else
- return PREDRAW_NEXT;
+ addentity (self);
+
+ return PREDRAW_NEXT;
};
#endif
@@ -136,44 +178,48 @@ void() misc_model;
//--------------------------------------------------------------
float(entity to, float netflags) base_misc_model_netsend =
{
- WriteShort (MSG_ENTITY, self.classtype);
- WriteFloat (MSG_ENTITY, netflags);
+ WriteByte (MSG_ENTITY, self.classtype);
- if (netflags & MISC_MODEL_NET_ORIGIN)
+ if (netflags > 255)
+ netflags = NETFLAG_MISC_MODEL_FULLSEND;
+
+ WriteByte (MSG_ENTITY, netflags);
+
+ if (netflags & NETFLAG_MISC_MODEL_ORIGIN)
{
WriteCoord (MSG_ENTITY, self.origin_x);
WriteCoord (MSG_ENTITY, self.origin_y);
WriteCoord (MSG_ENTITY, self.origin_z);
}
- if (netflags & MISC_MODEL_NET_MINS)
+ if (netflags & NETFLAG_MISC_MODEL_MINS)
{
WriteCoord (MSG_ENTITY, self.mins_x);
WriteCoord (MSG_ENTITY, self.mins_y);
WriteCoord (MSG_ENTITY, self.mins_z);
}
- if (netflags & MISC_MODEL_NET_MAXS)
+ if (netflags & NETFLAG_MISC_MODEL_MAXS)
{
WriteCoord (MSG_ENTITY, self.maxs_x);
WriteCoord (MSG_ENTITY, self.maxs_y);
WriteCoord (MSG_ENTITY, self.maxs_z);
}
- if (netflags & MISC_MODEL_NET_MODEL)
- WriteFloat (MSG_ENTITY, self.modelindex);
+ if (netflags & NETFLAG_MISC_MODEL_MODEL)
+ WriteShort (MSG_ENTITY, self.modelindex);
- if (netflags & MISC_MODEL_NET_FRAME)
- WriteFloat (MSG_ENTITY, self.frame);
+ if (netflags & NETFLAG_MISC_MODEL_FRAME)
+ WriteByte (MSG_ENTITY, self.frame);
- if (netflags & MISC_MODEL_NET_FIRSTFRAME)
- WriteFloat (MSG_ENTITY, self.first_frame);
+ if (netflags & NETFLAG_MISC_MODEL_FIRSTFRAME)
+ WriteByte (MSG_ENTITY, self.first_frame);
- if (netflags & MISC_MODEL_NET_LASTFRAME)
- WriteFloat (MSG_ENTITY, self.last_frame);
+ if (netflags & NETFLAG_MISC_MODEL_LASTFRAME)
+ WriteByte (MSG_ENTITY, self.last_frame);
- if (netflags & MISC_MODEL_NET_STATE)
- WriteFloat (MSG_ENTITY, self.state);
+ if (netflags & NETFLAG_MISC_MODEL_STATE)
+ WriteByte (MSG_ENTITY, self.state);
return TRUE;
};
@@ -187,16 +233,18 @@ void() misc_model;
if (self.estate != STATE_ACTIVE)
return;
- self.frame = self.frame + sign (self.speed);
+ self.frame += (self.speed < 0 ? -1 : 1);
- if (self.spawnflags & MISC_MODEL_BACK_AND_FORTH &&
+ if (self.spawnflags &
+ SPAWNFLAG_BASE_MISC_MODEL_BACK_AND_FORTH &&
self.frame < self.first_frame)
{
self.speed = -1 * self.speed;
self.frame += 2;
}
- else if (self.spawnflags & MISC_MODEL_BACK_AND_FORTH
- && self.frame > self.last_frame)
+ else if (self.spawnflags &
+ SPAWNFLAG_BASE_MISC_MODEL_BACK_AND_FORTH &&
+ self.frame > self.last_frame)
{
self.speed = -1 * self.speed;
self.frame -= 2;
@@ -208,16 +256,16 @@ void() misc_model;
}
// signal CSQC that the frame has changed -- CEV
- self.SendFlags = MISC_MODEL_NET_FRAME;
+ self.SendFlags |= NETFLAG_MISC_MODEL_FRAME;
- if (self.spawnflags & MISC_MODEL_ONLY_ONCE &&
+ if (self.spawnflags & SPAWNFLAG_BASE_MISC_MODEL_ONLY_ONCE &&
self.frame == self.last_frame &&
self.last_frame != self.first_frame)
{
self.nextthink = -1;
}
- if (self.spawnflags & MISC_MODEL_PLAY_COUNT &&
+ if (self.spawnflags & SPAWNFLAG_BASE_MISC_MODEL_PLAY_COUNT &&
self.frame == self.last_frame &&
self.last_frame != self.first_frame)
{
@@ -239,7 +287,7 @@ void() misc_model;
{
if (self.state == STATE_ACTIVE)
{
- if (self.spawnflags & MISC_MODEL_SOLID)
+ if (self.spawnflags & SPAWNFLAG_BASE_MISC_MODEL_SOLID)
self.solid = SOLID_NOT;
self.model = "";
@@ -248,7 +296,7 @@ void() misc_model;
}
else
{
- if (self.spawnflags & MISC_MODEL_SOLID)
+ if (self.spawnflags & SPAWNFLAG_BASE_MISC_MODEL_SOLID)
self.solid = SOLID_BBOX;
self.model = self.mdl;
@@ -257,7 +305,7 @@ void() misc_model;
}
// update CSQC
- self.SendFlags = MISC_MODEL_NET_STATE;
+ self.SendFlags |= NETFLAG_MISC_MODEL_STATE;
};
#endif
@@ -299,7 +347,7 @@ last_frame: The last frame of the animation.
local vector vmin, vmax;
#ifdef CSQC
- // only SOLID_BBOX misc_model entities are networked -- CEV
+ // only SOLID_BBOX misc_model entities are sent to CSQC -- CEV
e.movetype = MOVETYPE_NONE;
e.solid = SOLID_BBOX;
vmin = e.mins;
@@ -312,6 +360,14 @@ last_frame: The last frame of the animation.
#endif
#ifdef SSQC
+ // TODO CEV
+ if (known_release == KNOWN_RELEASE_QUAKE3 ||
+ known_release == KNOWN_RELEASE_CPMA ||
+ known_release == KNOWN_RELEASE_QUAKELIVE)
+ {
+ e.mdl = e.model;
+ }
+
if (!e.mdl || e.mdl == "")
objerror ("Model not defined");
@@ -333,12 +389,12 @@ last_frame: The last frame of the animation.
setmodel (e, e.mdl);
setsize (e, vmin, vmax);
- if (e.spawnflags & MISC_MODEL_SOLID)
+ if (e.spawnflags & SPAWNFLAG_BASE_MISC_MODEL_SOLID)
e.solid = SOLID_BBOX;
else
e.solid = SOLID_NOT;
- if (e.spawnflags & MISC_MODEL_GRAVITY)
+ if (e.spawnflags & SPAWNFLAG_BASE_MISC_MODEL_GRAVITY)
e.movetype = MOVETYPE_TOSS;
else
e.movetype = MOVETYPE_NONE;
@@ -350,11 +406,12 @@ last_frame: The last frame of the animation.
// not affected by gravity; also remains active if it has a
// targetname (so it can be killtargeted/toggled)
if (!e.last_frame &&
- !(e.spawnflags & MISC_MODEL_GRAVITY) &&
- !(e.spawnflags & MISC_MODEL_SOLID) &&
+ !(e.spawnflags & SPAWNFLAG_BASE_MISC_MODEL_GRAVITY) &&
+ !(e.spawnflags & SPAWNFLAG_BASE_MISC_MODEL_SOLID) &&
!e.targetname &&
!e.targetname2)
- // !(e.spawnflags & MISC_MODEL_DONTMAKESTATIC) &&
+ // !(e.spawnflags &
+ // SPAWNFLAG_BASE_MISC_MODEL_DONTMAKESTATIC)
{
makestatic (e);
}
@@ -363,7 +420,7 @@ last_frame: The last frame of the animation.
// not affected by gravity
// changed by bmFbr
// if (!e.last_frame &&
- // !(e.spawnflags & MISC_MODEL_GRAVITY))
+ // !(e.spawnflags & SPAWNFLAG_BASE_MISC_MODEL_GRAVITY))
// {
// makestatic (e);
// return;
@@ -379,7 +436,7 @@ last_frame: The last frame of the animation.
e.nextthink = time + e.speed;
}
- if (e.spawnflags & MISC_MODEL_STARTOFF)
+ if (e.spawnflags & SPAWNFLAG_BASE_MISC_MODEL_STARTOFF)
e.state = STATE_ACTIVE;
else
e.state = STATE_INVISIBLE;
@@ -391,11 +448,13 @@ last_frame: The last frame of the animation.
{
e.SendEntity = base_misc_model_netsend;
// send everything (at first)
- e.SendFlags = e.SendFlags | MISC_MODEL_NET_ORIGIN |
- MISC_MODEL_NET_MINS | MISC_MODEL_NET_MAXS |
- MISC_MODEL_NET_MODEL | MISC_MODEL_NET_FRAME |
- MISC_MODEL_NET_FIRSTFRAME |
- MISC_MODEL_NET_LASTFRAME;
+ e.SendFlags |= NETFLAG_MISC_MODEL_ORIGIN |
+ NETFLAG_MISC_MODEL_MINS |
+ NETFLAG_MISC_MODEL_MAXS |
+ NETFLAG_MISC_MODEL_MODEL |
+ NETFLAG_MISC_MODEL_FRAME |
+ NETFLAG_MISC_MODEL_FIRSTFRAME |
+ NETFLAG_MISC_MODEL_LASTFRAME;
}
#endif
};
Return to the top of this page or return to the overview of this repo.
Diff qc/misc/modeltrain.qc
diff --git a/qc/misc/modeltrain.qc b/qc/misc/modeltrain.qc
index 83a47d0..c8bf8d2 100644
--- a/qc/misc/modeltrain.qc
+++ b/qc/misc/modeltrain.qc
@@ -7,10 +7,18 @@
//======================================================================
#ifdef SSQC
-const float TRAIN_STYLE_SINGLEANIM = 1; // modeltrain with one animation
+//----------------------------------------------------------------------
+typedef enum
+{
+ MISC_MODELTRAIN_STYLE_SINGLEANIM = 1 // modeltrain with one animation
+} misc_modeltrain_styles;
-const float TRAIN_ANIMTYPE_FORWARD = 1;
-const float TRAIN_ANIMTYPE_BACKFORTH = 2;
+//----------------------------------------------------------------------
+typedef enum
+{
+ MISC_MODELTRAIN_ANIMTYPE_FORWARD = 1,
+ MISC_MODELTRAIN_ANIMTYPE_BACKFORTH = 2
+} misc_modeltrain_animtypes;
#endif
//======================================================================
@@ -74,7 +82,7 @@ void() misc_modeltrain;
// train just went from stopped to moving or vice-versa,
// and have both animations set
if (self.state != self.owner.state &&
- self.owner.style != TRAIN_STYLE_SINGLEANIM)
+ self.owner.style != MISC_MODELTRAIN_STYLE_SINGLEANIM)
{
if (self.owner.state)
// just started moving
@@ -92,7 +100,8 @@ void() misc_modeltrain;
else
{
if (self.state &&
- self.owner.style != TRAIN_STYLE_SINGLEANIM)
+ self.owner.style !=
+ MISC_MODELTRAIN_STYLE_SINGLEANIM)
{
// moving train animation, if set
first = zeroconvert (self.owner.first_frame2);
@@ -120,7 +129,7 @@ void() misc_modeltrain;
nextframe = self.owner.frame + step;
- if (atype == TRAIN_ANIMTYPE_BACKFORTH)
+ if (atype == MISC_MODELTRAIN_ANIMTYPE_BACKFORTH)
{
if (dir > 0 && (nextframe > last ||
nextframe < first) ||
@@ -143,10 +152,15 @@ void() misc_modeltrain;
self.think = temp_anim_controller_think;
- if (self.state || self.owner.style == TRAIN_STYLE_SINGLEANIM)
+ if (self.state ||
+ self.owner.style == MISC_MODELTRAIN_STYLE_SINGLEANIM)
+ {
self.nextthink = time + self.owner.frtime;
+ }
else
+ {
self.nextthink = time + self.owner.frtime2;
+ }
};
//--------------------------------------------------------------
@@ -224,16 +238,17 @@ void() misc_modeltrain;
precache_model (e.mdl);
base_func_train_init (e);
- if (e.spawnflags & TRAIN_NONSOLID)
+ // TODO CEV func_train spawnflag in misc_modeltrain
+ if (e.spawnflags & SPAWNFLAG_FUNC_TRAIN_NONSOLID)
{
e.solid = SOLID_NOT;
}
else
{
e.solid = SOLID_BBOX;
- if (e.cmins == VEC_ORIGIN)
+ if (e.cmins == '0 0 0')
e.cmins = '-8 -8 -8';
- if (e.cmaxs == VEC_ORIGIN)
+ if (e.cmaxs == '0 0 0')
e.cmaxs = '8 8 8';
}
@@ -266,10 +281,10 @@ void() misc_modeltrain;
e.first_frame2 = e.last_frame2;
if (e.first_frame2 == 0)
- e.style = TRAIN_STYLE_SINGLEANIM;
+ e.style = MISC_MODELTRAIN_STYLE_SINGLEANIM;
if (!e.animtype)
- e.animtype = TRAIN_ANIMTYPE_FORWARD;
+ e.animtype = MISC_MODELTRAIN_ANIMTYPE_FORWARD;
if (!e.animtype2)
e.animtype2 = e.animtype;
Return to the top of this page or return to the overview of this repo.
Diff qc/misc/particle_embers.qc
diff --git a/qc/misc/particle_embers.qc b/qc/misc/particle_embers.qc
new file mode 100644
index 0000000..15fd07a
--- /dev/null
+++ b/qc/misc/particle_embers.qc
@@ -0,0 +1,115 @@
+//==============================================================================
+// particle_embers -- selections from MachineGames misc_fx.qc -- CEV
+//==============================================================================
+
+//======================================================================
+// forward declarations
+//======================================================================
+
+#ifdef SSQC
+// particle_embers
+void() particle_embers_think;
+void(entity e) particle_embers_init;
+void() particle_embers;
+#endif
+
+#ifdef SSQC
+// particle_embers_tall
+void(entity e) particle_embers_tall_init;
+void() particle_embers_tall;
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// class particle_embers: base_mapentity
+// {
+ //--------------------------------------------------------------
+ void() particle_embers_think =
+ {
+ local vector pos;
+ local vector speed;
+ speed = '0 0 2' * random() + '0 0 2';
+ speed_x = crandom() * self.velocity_x;
+ speed_y = crandom() * self.velocity_y;
+ speed_z = speed_z * self.velocity_z;
+ pos = self.origin;
+ pos_x = pos_x + self.size_x * crandom();
+ pos_y = pos_y + self.size_y * crandom();
+ // pos = crandom() * self.size + self.origin;
+ particle (pos, speed, 234, 2);
+ self.nextthink = time + self.wait + self.delay * random();
+ };
+
+ //--------------------------------------------------------------
+ void(entity e) particle_embers_init =
+ {
+ e.classname = "particle_embers";
+ e.classtype = CT_MISC_PARTICLE_EMBERS;
+ base_mapentity_init (e);
+
+ // size determines the box the particles can spawn within
+ if (!e.size)
+ e.size = '128 128 0';
+ // delay is random time added per loop
+ if (!e.delay)
+ e.delay = 0.1;
+ // wait is time always added per loop
+ if (!e.wait)
+ e.wait = 0.05;
+ // velocity is used as a scalar on speed
+ if (!e.velocity)
+ e.velocity = '1 1 1';
+
+ e.think = particle_embers_think;
+ e.nextthink = time + e.wait + e.delay * random();
+ };
+
+ //--------------------------------------------------------------
+ void() particle_embers =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ particle_embers_init (self);
+ };
+// };
+#endif
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// class particle_embers_tall: base_mapentity
+// {
+ //--------------------------------------------------------------
+ void(entity e) particle_embers_tall_init =
+ {
+ e.classname = "particle_embers_tall";
+ e.classtype = CT_MISC_PARTICLE_EMBERS_TALL;
+ base_mapentity_init (e);
+
+ if (!e.size)
+ e.size = '40 40 0';
+ if (!e.delay)
+ e.delay = 0.1;
+ if (!e.wait)
+ e.wait = 0.05;
+ if (!e.velocity)
+ // scalar for speed
+ e.velocity = '1 1 2';
+ e.think = particle_embers_think;
+ e.nextthink = time + e.wait + e.delay * random();
+ };
+
+ //--------------------------------------------------------------
+ void() particle_embers_tall =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ particle_embers_tall_init (self);
+ };
+// };
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/misc/particle_spray.qc
diff --git a/qc/misc/particle_spray.qc b/qc/misc/particle_spray.qc
new file mode 100644
index 0000000..88ff48b
--- /dev/null
+++ b/qc/misc/particle_spray.qc
@@ -0,0 +1,111 @@
+//==============================================================================
+// misc_particlespray -- Particle Sprayer
+// this is from Custents not Rubicon2 -- dumptruck_ds
+// renamed from func to misc
+//==============================================================================
+
+//======================================================================
+// fields
+//======================================================================
+
+#ifdef SSQC
+.float duration;
+#endif
+
+//======================================================================
+// forward declarations
+//======================================================================
+
+#ifdef SSQC
+// misc_particlespray
+void() misc_particlespray_think;
+void() misc_particlespray_use;
+void(entity e) misc_particlespray_init;
+void() misc_particlespray;
+#endif
+
+//------------------------------------------------------------------------------
+
+/*QUAKED misc_particlespray (0 .5 .8) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+Shoots particles either when triggered, or contiuously when not triggered by anything.
+"color" is the palette color of the particles
+
+"count" is the number of particles to make each time
+
+"delay" is the delay between each triggering
+
+"noise" is the name of the wav file to play when triggered
+
+"movedir" is the vector distance that the particles will travel before disappearing. (in x y z)
+
+"duration" is the amount of time that the it will continue to release particles so that it can release a long stream of particles with only one triggering.
+*/
+//----------------------------------------------------------------------
+// class misc_particlespray: base_mapentity
+// {
+#ifdef SSQC
+ //--------------------------------------------------------------
+ void() misc_particlespray_think =
+ {
+ particle (self.origin, self.movedir, self.color, self.count);
+
+ if (!self.targetname || self.attack_finished > time)
+ self.nextthink = time + self.delay;
+
+ if (self.noise != "")
+ sound (self, CHAN_AUTO, self.noise,
+ VOL_HIGH, ATTN_NORM);
+ else
+ sound (self, CHAN_AUTO, "misc/null.wav",
+ VOL_HIGH, ATTN_NORM);
+ };
+
+ //--------------------------------------------------------------
+ void() misc_particlespray_use =
+ {
+ if (self.targetname != __NULL__ && self.targetname != "")
+ return;
+
+ self.attack_finished = time + self.duration;
+ misc_particlespray_think ();
+ };
+
+ //--------------------------------------------------------------
+ void(entity e) misc_particlespray_init =
+ {
+ e.classname = "particlespray";
+ e.classtype = CT_MISC_PARTICLESPRAY;
+ base_mapentity_init (e);
+
+ if (!e.color)
+ e.color = 47;
+
+ if (e.count <= 0)
+ e.count = 15;
+
+ if (e.delay <= 0)
+ e.delay = 0.1;
+
+ if (e.noise != "")
+ precache_sound (e.noise);
+ precache_sound ("misc/null.wav");
+
+ e.think = misc_particlespray_think;
+
+ if (!e.targetname)
+ e.nextthink = time + 0.1 + e.delay;
+ else
+ e.use = misc_particlespray_use;
+ };
+
+ //--------------------------------------------------------------
+ void() misc_particlespray =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ misc_particlespray_init (self);
+ };
+#endif
+// };
Return to the top of this page or return to the overview of this repo.
Diff qc/misc/particle_stream.qc
diff --git a/qc/misc/particle_stream.qc b/qc/misc/particle_stream.qc
index c9689ae..6a54adb 100644
--- a/qc/misc/particle_stream.qc
+++ b/qc/misc/particle_stream.qc
@@ -72,7 +72,7 @@ I used the info_notnull, but you should be able to target anything
if (!pspot)
{
- dprint ("misc_particle_stream::do_think: "
+ dprint ("misc_particle_stream_think: "
"Particle stream can't find target!\n");
return;
}
Return to the top of this page or return to the overview of this repo.
Diff qc/misc/particle_tele.qc
diff --git a/qc/misc/particle_tele.qc b/qc/misc/particle_tele.qc
new file mode 100644
index 0000000..e2e2520
--- /dev/null
+++ b/qc/misc/particle_tele.qc
@@ -0,0 +1,176 @@
+//==============================================================================
+// particle_tele -- selections from MachineGames misc_fx.qc -- CEV
+//==============================================================================
+
+//======================================================================
+// constants
+//======================================================================
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// misc_particle_tele spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_MISC_PARTICLE_TELE_START_OFF = 1
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} misc_particle_tele_spawnflags;
+#endif
+
+//======================================================================
+// forward declarations
+//======================================================================
+
+#ifdef SSQC
+// particle_tele
+void() particle_tele_think;
+void(entity e) particle_tele_init;
+void() particle_tele;
+#endif
+
+#ifdef SSQC
+// particle_tele_fountain
+void() particle_tele_fountain_think;
+void() particle_tele_fountain_use;
+void(entity e) particle_tele_fountain_init;
+void() particle_tele_fountain;
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// class particle_tele: base_mapentity
+// {
+ //--------------------------------------------------------------
+ void() particle_tele_think =
+ {
+ // where to spawn
+ local vector pos;
+ // scalar from org, used for speed too
+ local float dist = 64;
+ local vector rando;
+
+ rando_x = crandom() * 10;
+ rando_y = crandom() * 10;
+ rando_z = crandom() * 5;
+ rando = normalize(rando);
+
+ pos = self.origin + (rando * dist);
+
+ // spawn particle
+ particle (pos, rando * dist * -.125, 3, 3);
+ self.nextthink = time + self.wait + self.delay * random();
+ };
+
+ //--------------------------------------------------------------
+ void(entity e) particle_tele_init =
+ {
+ e.classname = "particle_tele";
+ e.classtype = CT_MISC_PARTICLE_TELE;
+ base_mapentity_init (e);
+
+ /*
+ 1. get origin
+ 2. get a random vector, then normalize it. Save it for later
+ 3. scale a copy of the vector by distance
+ 4. spawn the particle at vector + origin
+ 5. set the particle's vel to the old normalized vector * -scalar
+ */
+
+ // size determines the box the particles can spawn within
+ if (!e.size)
+ e.size = '128 128 0';
+ // delay is random time added per loop
+ if (!e.delay)
+ e.delay = 0.1;
+
+ // wait is time always added per loop
+ if (!e.wait)
+ e.wait = 0;
+
+ e.think = particle_tele_think;
+ e.nextthink = time + e.wait + e.delay * random();
+ };
+
+ //--------------------------------------------------------------
+ void() particle_tele =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ particle_tele_init (self);
+ };
+// };
+#endif
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// class particle_tele_fountain: base_mapentity
+// {
+ //--------------------------------------------------------------
+ void() particle_tele_fountain_think =
+ {
+ local vector dir;
+ dir_x = crandom() * self.velocity_x;
+ dir_y = crandom() * self.velocity_y;
+ dir_z = self.velocity_z;
+ particle (self.origin, dir, 13, 2);
+ self.nextthink = time + self.wait + self.delay * random();
+ };
+
+ //--------------------------------------------------------------
+ void() particle_tele_fountain_use =
+ {
+ self.think = particle_tele_fountain_think;
+ self.nextthink = time + 0.1;
+ };
+
+ //--------------------------------------------------------------
+ void(entity e) particle_tele_fountain_init =
+ {
+ e.classname = "particle_tele_fountain";
+ e.classtype = CT_MISC_PARTICLE_TELE_FOUNTAIN;
+ base_mapentity_init (e);
+
+ if (!e.delay)
+ e.delay = 0.1;
+
+ if (!e.wait)
+ e.wait = 0.05;
+
+ if (!e.velocity)
+ e.velocity = '1 1 6';
+
+ if (e.spawnflags & SPAWNFLAG_MISC_PARTICLE_TELE_START_OFF)
+ {
+ e.use = particle_tele_fountain_use;
+ }
+ else
+ {
+ e.think = particle_tele_fountain_think;
+ e.nextthink = time + e.wait + e.delay * random();
+ }
+ };
+
+ //--------------------------------------------------------------
+ void() particle_tele_fountain =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ particle_tele_fountain_init (self);
+ };
+// };
+#endif
+
Return to the top of this page or return to the overview of this repo.
Diff qc/misc/particles.qc
diff --git a/qc/misc/particles.qc b/qc/misc/particles.qc
index 7741f52..beab0c6 100644
--- a/qc/misc/particles.qc
+++ b/qc/misc/particles.qc
@@ -9,7 +9,22 @@
//======================================================================
#ifdef SSQC
-const float PARTICLES_START_OFF = 1;
+//----------------------------------------------------------------------
+// misc_particles spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_MISC_PARTICLES_START_OFF = 1
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} misc_particles_spawnflags;
#endif
//======================================================================
@@ -31,7 +46,8 @@ void() misc_splash;
//------------------------------------------------------------------------------
-/*QUAKED misc_particles (0 .5 .8) (-8 -8 -8) (8 8 8) PARTICLES_START_OFF X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+#ifdef SSQC
+/*QUAKED misc_particles (0 .5 .8) (-8 -8 -8) (8 8 8) START_OFF X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Produces a continuous particle splash for waterfalls and other effects
@@ -46,7 +62,6 @@ Produces a continuous particle splash for waterfalls and other effects
//----------------------------------------------------------------------
// class misc_particles: base_mapentity
// {
-#ifdef SSQC
//--------------------------------------------------------------
// was splash_think -- CEV
//--------------------------------------------------------------
@@ -65,14 +80,14 @@ Produces a continuous particle splash for waterfalls and other effects
//--------------------------------------------------------------
void() misc_particles_use =
{
- if (self.spawnflags & PARTICLES_START_OFF)
+ if (self.spawnflags & SPAWNFLAG_MISC_PARTICLES_START_OFF)
{
- self.spawnflags = self.spawnflags - PARTICLES_START_OFF;
+ self.spawnflags &= ~SPAWNFLAG_MISC_PARTICLES_START_OFF;
self.think = __NULL__;
}
else
{
- self.spawnflags = self.spawnflags + PARTICLES_START_OFF;
+ self.spawnflags |= SPAWNFLAG_MISC_PARTICLES_START_OFF;
self.think = misc_particles_think;
self.nextthink = time + self.wait;
}
@@ -94,7 +109,7 @@ Produces a continuous particle splash for waterfalls and other effects
if (!e.volume)
e.volume = 10;
- if (e.spawnflags & PARTICLES_START_OFF)
+ if (e.spawnflags & SPAWNFLAG_MISC_PARTICLES_START_OFF)
{
e.think = __NULL__;
}
@@ -117,13 +132,13 @@ Produces a continuous particle splash for waterfalls and other effects
misc_particles_init (self);
};
-#endif
// };
+#endif
+#ifdef SSQC
//----------------------------------------------------------------------
// class misc_splash: misc_particles
// {
-#ifdef SSQC
//--------------------------------------------------------------
void() misc_splash =
{
@@ -133,5 +148,5 @@ Produces a continuous particle splash for waterfalls and other effects
misc_particles_init (self);
};
-#endif
// };
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/misc/particlespray.qc
diff --git a/qc/misc/particlespray.qc b/qc/misc/particlespray.qc
deleted file mode 100644
index 4aef172..0000000
--- a/qc/misc/particlespray.qc
+++ /dev/null
@@ -1,112 +0,0 @@
-//==============================================================================
-// misc_particlespray -- Particle Sprayer
-// this is from Custents not Rubicon2 -- dumptruck_ds
-// renamed from func to misc
-//==============================================================================
-
-//======================================================================
-// fields
-//======================================================================
-
-#ifdef SSQC
-.float endtime;
-.float duration;
-#endif
-
-//======================================================================
-// forward declarations
-//======================================================================
-
-#ifdef SSQC
-// misc_particlespray
-void() misc_particlespray_think;
-void() misc_particlespray_use;
-void(entity e) misc_particlespray_init;
-void() misc_particlespray;
-#endif
-
-//------------------------------------------------------------------------------
-
-/*QUAKED misc_particlespray (0 .5 .8) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-Shoots particles either when triggered, or contiuously when not triggered by anything.
-"color" is the palette color of the particles
-
-"count" is the number of particles to make each time
-
-"delay" is the delay between each triggering
-
-"noise" is the name of the wav file to play when triggered
-
-"movedir" is the vector distance that the particles will travel before disappearing. (in x y z)
-
-"duration" is the amount of time that the it will continue to release particles so that it can release a long stream of particles with only one triggering.
-*/
-//----------------------------------------------------------------------
-// class misc_particlespray: base_mapentity
-// {
-#ifdef SSQC
- //--------------------------------------------------------------
- void() misc_particlespray_think =
- {
- particle (self.origin, self.movedir, self.color, self.count);
-
- if (!self.targetname || self.endtime > time)
- self.nextthink = time + self.delay;
-
- if (self.noise != "")
- sound (self, CHAN_AUTO, self.noise,
- VOL_HIGH, ATTN_NORM);
- else
- sound (self, CHAN_AUTO, "misc/null.wav",
- VOL_HIGH, ATTN_NORM);
- };
-
- //--------------------------------------------------------------
- void() misc_particlespray_use =
- {
- if (self.targetname != __NULL__ && self.targetname != "")
- return;
-
- self.endtime = time + self.duration;
- misc_particlespray_think ();
- };
-
- //--------------------------------------------------------------
- void(entity e) misc_particlespray_init =
- {
- e.classname = "particlespray";
- e.classtype = CT_MISC_PARTICLESPRAY;
- base_mapentity_init (e);
-
- if (!e.color)
- e.color = 47;
-
- if (e.count <= 0)
- e.count = 15;
-
- if (e.delay <= 0)
- e.delay = 0.1;
-
- if (e.noise != "")
- precache_sound (e.noise);
- precache_sound ("misc/null.wav");
-
- e.think = misc_particlespray_think;
-
- if (!e.targetname)
- e.nextthink = time + 0.1 + e.delay;
- else
- e.use = misc_particlespray_use;
- };
-
- //--------------------------------------------------------------
- void() misc_particlespray =
- {
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- misc_particlespray_init (self);
- };
-#endif
-// };
Return to the top of this page or return to the overview of this repo.
Diff qc/misc/play.qc
diff --git a/qc/misc/play.qc b/qc/misc/play.qc
index fdb145d..f38b312 100644
--- a/qc/misc/play.qc
+++ b/qc/misc/play.qc
@@ -10,6 +10,29 @@
//======================================================================
//======================================================================
+// constants
+//======================================================================
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// base_play_sound spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_BASE_PLAY_SOUND_TOGGLE = 1
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} base_play_sound_spawnflags;
+#endif
+
+//======================================================================
// forward declarations
//======================================================================
@@ -109,7 +132,7 @@ void() play_dimlight;
//--------------------------------------------------------------
void() base_play_sound_use =
{
- if (self.spawnflags & 1)
+ if (self.spawnflags & SPAWNFLAG_BASE_PLAY_SOUND_TOGGLE)
{
if (self.state == 0)
{
@@ -147,7 +170,7 @@ void() play_dimlight;
if (e.speed == -1)
// e.speed = 0;
e.speed = ATTN_NONE;
- if (e.spawnflags & 1)
+ if (e.spawnflags & SPAWNFLAG_BASE_PLAY_SOUND_TOGGLE)
if (e.impulse == 0)
e.impulse = 7;
@@ -444,21 +467,23 @@ Use noise key for a custom sound.
//--------------------------------------------------------------
void() base_meat_shower_use =
{
+ local vector v = '0 0 0';
+
// -- dumptruck_ds -- thanks to Spike for helping with errors
if (self.style == 1)
{
- throw_gib_1 (self, '0 0 0', random() * -80);
- throw_gib_2 (self, '0 0 0', random() * -80);
- throw_gib_3 (self, '0 0 0', random() * -80);
- throw_gib_1 (self, '0 0 0', random() * -75);
- throw_gib_2 (self, '0 0 0', random() * -75);
- throw_gib_3 (self, '0 0 0', random() * -75);
+ BASE_ITEM_GIB_THROW (v, random() * -80, item_gib1_init)
+ BASE_ITEM_GIB_THROW (v, random() * -80, item_gib2_init)
+ BASE_ITEM_GIB_THROW (v, random() * -80, item_gib3_init)
+ BASE_ITEM_GIB_THROW (v, random() * -75, item_gib1_init)
+ BASE_ITEM_GIB_THROW (v, random() * -75, item_gib2_init)
+ BASE_ITEM_GIB_THROW (v, random() * -75, item_gib3_init)
}
else
{
- throw_gib_1 (self, '0 0 0', random() * -65);
- throw_gib_2 (self, '0 0 0', random() * -65);
- throw_gib_3 (self, '0 0 0', random() * -65);
+ BASE_ITEM_GIB_THROW (v, random() * -65, item_gib1_init)
+ BASE_ITEM_GIB_THROW (v, random() * -65, item_gib2_init)
+ BASE_ITEM_GIB_THROW (v, random() * -65, item_gib3_init)
}
if (self.fly_sound != 1)
Return to the top of this page or return to the overview of this repo.
Diff qc/misc/rune_indicator.qc
diff --git a/qc/misc/rune_indicator.qc b/qc/misc/rune_indicator.qc
new file mode 100644
index 0000000..e79bcae
--- /dev/null
+++ b/qc/misc/rune_indicator.qc
@@ -0,0 +1,161 @@
+//==============================================================================
+// misc_rune_indicator -- MG1 rune indicators from items_runes.qc -- CEV
+//==============================================================================
+
+//======================================================================
+// constants
+//======================================================================
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// rune indicator spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ // SPAWNFLAG_ITEM_SIGIL_RUNE1 = 1, // see items/runes.qc -- CEV
+ // SPAWNFLAG_ITEM_SIGIL_RUNE2 = 2, // rune 2
+ // SPAWNFLAG_ITEM_SIGIL_RUNE3 = 4, // rune 3
+ // SPAWNFLAG_ITEM_SIGIL_RUNE4 = 8, // rune 4
+ // SPAWNFLAG_ITEM_SIGIL_RUNE5 = 16,// rune 5
+ // SPAWNFLAG_ITEM_SIGIL_RUNE6 = 32,// rune 6
+ SPAWNFLAG_RUNE_INDICATOR_ACTIVE = 64 // MG1 active rune indicator -- CEV
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536 // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} misc_rune_indicator_spawnflags;
+#endif
+
+#ifdef SSQC
+const float SIGIL_AL = SPAWNFLAG_ITEM_SIGIL_RUNE1 | SPAWNFLAG_ITEM_SIGIL_RUNE2 |
+ SPAWNFLAG_ITEM_SIGIL_RUNE3 | SPAWNFLAG_ITEM_SIGIL_RUNE4;
+const float SIGIL_ALL = SPAWNFLAG_ITEM_SIGIL_RUNE1 |
+ SPAWNFLAG_ITEM_SIGIL_RUNE2 | SPAWNFLAG_ITEM_SIGIL_RUNE3 |
+ SPAWNFLAG_ITEM_SIGIL_RUNE4 | SPAWNFLAG_ITEM_SIGIL_RUNE5;
+const float SIGIL_ALL_ALL_ALLLL = SPAWNFLAG_ITEM_SIGIL_RUNE1 |
+ SPAWNFLAG_ITEM_SIGIL_RUNE2 | SPAWNFLAG_ITEM_SIGIL_RUNE3 |
+ SPAWNFLAG_ITEM_SIGIL_RUNE4 | SPAWNFLAG_ITEM_SIGIL_RUNE5 |
+ SPAWNFLAG_ITEM_SIGIL_RUNE6;
+#endif
+
+//======================================================================
+// forward declarations
+//======================================================================
+
+#ifdef SSQC
+// misc_rune_indicator
+void() misc_rune_indicator_use;
+void(entity e) misc_rune_indicator_init;
+void() misc_rune_indicator;
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// class misc_rune_indicator: base_mapentity
+// {
+ //--------------------------------------------------------------
+ void() misc_rune_indicator_use =
+ {
+ self.alpha = 1.0;
+ sub_usetargets ();
+ };
+
+ //--------------------------------------------------------------
+ void(entity e) misc_rune_indicator_init =
+ {
+ e.classname = "misc_rune_indicator";
+ e.classtype = CT_MISC_RUNE_INDICATOR;
+ base_mapentity_init (e);
+
+ local float active = e.spawnflags &
+ SPAWNFLAG_RUNE_INDICATOR_ACTIVE ? TRUE : FALSE;
+ e.spawnflags &= ~SPAWNFLAG_RUNE_INDICATOR_ACTIVE;
+
+ if (!e.spawnflags)
+ e.spawnflags |= SPAWNFLAG_ITEM_SIGIL_RUNE1;
+
+ e.spawnflags &= SIGIL_ALL_ALL_ALLLL;
+
+ e.mdl = "";
+
+ if (e.spawnflags & SPAWNFLAG_ITEM_SIGIL_RUNE1)
+ {
+ e.spawnflags = SPAWNFLAG_ITEM_SIGIL_RUNE1;
+ if (known_release == KNOWN_RELEASE_MG1)
+ e.mdl = "progs/mg1_rune1.mdl";
+ else
+ e.mdl = "progs/end1.mdl";
+ }
+ else if (e.spawnflags & SPAWNFLAG_ITEM_SIGIL_RUNE2)
+ {
+ e.spawnflags = SPAWNFLAG_ITEM_SIGIL_RUNE2;
+ if (known_release == KNOWN_RELEASE_MG1)
+ e.mdl = "progs/mg1_rune2.mdl";
+ else
+ e.mdl = "progs/end2.mdl";
+ }
+ else if (e.spawnflags & SPAWNFLAG_ITEM_SIGIL_RUNE3)
+ {
+ e.spawnflags = SPAWNFLAG_ITEM_SIGIL_RUNE3;
+ if (known_release == KNOWN_RELEASE_MG1)
+ e.mdl = "progs/mg1_rune3.mdl";
+ else
+ e.mdl = "progs/end3.mdl";
+ }
+ else if (e.spawnflags & SPAWNFLAG_ITEM_SIGIL_RUNE4)
+ {
+ e.spawnflags = SPAWNFLAG_ITEM_SIGIL_RUNE4;
+ if (known_release == KNOWN_RELEASE_MG1)
+ e.mdl = "progs/mg1_rune4.mdl";
+ else
+ e.mdl = "progs/end4.mdl";
+ }
+ else if (known_release == KNOWN_RELEASE_MG1)
+ {
+ if (e.spawnflags & SPAWNFLAG_ITEM_SIGIL_RUNE5)
+ {
+ e.spawnflags = SPAWNFLAG_ITEM_SIGIL_RUNE5;
+ e.mdl = "progs/mg1_rune5.mdl";
+ }
+ else if (e.spawnflags & SPAWNFLAG_ITEM_SIGIL_RUNE6)
+ {
+ e.spawnflags = SPAWNFLAG_ITEM_SIGIL_RUNE6;
+ e.mdl = "progs/mg1_rune6.mdl";
+ }
+ }
+
+ precache_model (e.mdl);
+ setmodel (e, e.mdl);
+
+ e.use = misc_rune_indicator_use;
+
+ if(((e.spawnflags & serverflags) == e.spawnflags) || active)
+ {
+ e.think = sub_usetargets;
+ e.nextthink = time + 0.2;
+ }
+ else
+ {
+ // Show a ghost of the rune before you collect it.
+ e.alpha = 0.2;
+ }
+ };
+
+ //--------------------------------------------------------------
+ void() misc_rune_indicator =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ misc_rune_indicator_init (self);
+ };
+// };
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/misc/sparks.qc
diff --git a/qc/misc/sparks.qc b/qc/misc/sparks.qc
index e2fbd15..f510d65 100644
--- a/qc/misc/sparks.qc
+++ b/qc/misc/sparks.qc
@@ -7,18 +7,36 @@
//======================================================================
#ifdef SSQC
-const float MISC_SPARKS_START_OFF = 1;
-const float MISC_SPARKS_BLUE = 2;
-const float MISC_SPARKS_PALE = 4;
+//----------------------------------------------------------------------
+// misc_sparks spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_MISC_SPARKS_START_OFF = 1,
+ SPAWNFLAG_MISC_SPARKS_BLUE = 2,
+ SPAWNFLAG_MISC_SPARKS_PALE = 4
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} misc_sparks_spawnflags;
+#endif
-enum
+#ifdef SSQC
+//----------------------------------------------------------------------
+typedef enum
{
TEMP_SPARK_FADE1, // animation states for temp_spark
TEMP_SPARK_FADE2,
TEMP_SPARK_FADE3,
TEMP_SPARK_FADE4,
TEMP_SPARK_REMOVE
-};
+} temp_spark_states;
#endif
//======================================================================
@@ -100,9 +118,9 @@ void() misc_sparks;
else
e.skin = 2;
- if (e.spawnflags & MISC_SPARKS_PALE)
+ if (e.spawnflags & SPAWNFLAG_MISC_SPARKS_PALE)
e.skin = e.skin + 6;
- else if (e.spawnflags & MISC_SPARKS_BLUE)
+ else if (e.spawnflags & SPAWNFLAG_MISC_SPARKS_BLUE)
e.skin = e.skin + 3;
setmodel (e, "progs/spark.mdl");
@@ -122,7 +140,7 @@ void() misc_sparks;
#endif
// };
-/*QUAKED misc_sparks (0 .5 .8) (-8 -8 -8) (8 8 8) MISC_SPARKS_START_OFF MISC_SPARKS_BLUE MISC_SPARKS_PALE X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+/*QUAKED misc_sparks (0 .5 .8) (-8 -8 -8) (8 8 8) START_OFF SPARKS_BLUE SPARKS_PALE X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Produces a burst of yellow sparks at random intervals. If targeted, it will toggle between on or off. If it targets a light, that light will flash allong with each burst of sparks. Note: targeted lights should be set to START_OFF.
@@ -147,7 +165,7 @@ Keys:
//--------------------------------------------------------------
void() misc_sparks_think_make =
{
- if (self.spawnflags & MISC_SPARKS_START_OFF)
+ if (self.spawnflags & SPAWNFLAG_MISC_SPARKS_START_OFF)
{
self.think = misc_sparks_think_make;
self.nextthink = time + 0.1;
@@ -187,10 +205,10 @@ Keys:
void() misc_sparks_use =
{
- if (self.spawnflags & MISC_SPARKS_START_OFF)
- self.spawnflags &= ~MISC_SPARKS_START_OFF;
+ if (self.spawnflags & SPAWNFLAG_MISC_SPARKS_START_OFF)
+ self.spawnflags &= ~SPAWNFLAG_MISC_SPARKS_START_OFF;
else
- self.spawnflags |= MISC_SPARKS_START_OFF;
+ self.spawnflags |= SPAWNFLAG_MISC_SPARKS_START_OFF;
};
//--------------------------------------------------------------
Return to the top of this page or return to the overview of this repo.
Diff qc/misc/teleporttrain.qc
diff --git a/qc/misc/teleporttrain.qc b/qc/misc/teleporttrain.qc
index 2896037..34c130b 100644
--- a/qc/misc/teleporttrain.qc
+++ b/qc/misc/teleporttrain.qc
@@ -8,12 +8,24 @@
//======================================================================
#ifdef SSQC
-enum // teleporttrain states
+//----------------------------------------------------------------------
+// misc_teleporttrain spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
{
- TELEPORTTRAIN_NEXT,
- TELEPORTTRAIN_WAIT,
- TELEPORTTRAIN_FIND
-};
+ SPAWNFLAG_MISC_TELEPORTTRAIN_DONT_ROTATE = 2,
+ SPAWNFLAG_MISC_TELEPORTTRAIN_START_ON_WITH_TARGETNAME = 4,
+ SPAWNFLAG_MISC_TELEPORTTRAIN_INVISIBLE = 8
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} misc_teleporttrain_spawnflags;
#endif
//======================================================================
@@ -160,14 +172,21 @@ If a targetname is set, it must be triggered to start moving, otherwise it will
return;
}
- if (self.spawnflags & 4)
+ if (self.spawnflags &
+ SPAWNFLAG_MISC_TELEPORTTRAIN_START_ON_WITH_TARGETNAME)
+ {
// start immediately even with a targetname
misc_teleporttrain_next ();
+ }
else if (!self.targetname)
+ {
// not triggered, so start immediately
misc_teleporttrain_next ();
+ }
else
+ {
self.use = misc_teleporttrain_use;
+ }
};
//--------------------------------------------------------------
@@ -198,22 +217,20 @@ If a targetname is set, it must be triggered to start moving, otherwise it will
e.solid = SOLID_NOT;
e.movetype = MOVETYPE_FLY;
- // custom custom_mdls -- dumptruck_ds
- // precache_model ("progs/teleport.mdl");
- precache_body_model (e, "progs/teleport.mdl");
- // invisble -- dumptruck_ds
+ precache_model ("progs/teleport.mdl");
+ // invisible -- dumptruck_ds
precache_model ("progs/s_null.spr");
- if (e.spawnflags & 8)
- body_model (e, "progs/s_null.spr");
+ if (e.spawnflags & SPAWNFLAG_MISC_TELEPORTTRAIN_INVISIBLE)
+ setmodel (e, "progs/s_null.spr");
else
- body_model (e, "progs/teleport.mdl");
+ setmodel (e, "progs/teleport.mdl");
setsize (e, '-16 -16 -16', '16 16 16');
// setorigin (e, e.origin);
// Causes the ball to spin around like it was
// originally intended to.
- if (!(e.spawnflags & 2))
+ if (!(e.spawnflags & SPAWNFLAG_MISC_TELEPORTTRAIN_DONT_ROTATE))
// don't spin - helpful for invisible
// spawner -- dumptruck_ds
e.avelocity = '40 80 120';
Return to the top of this page or return to the overview of this repo.
Diff qc/monsters/boss.qc
diff --git a/qc/monsters/boss.qc b/qc/monsters/boss.qc
index abb6eb8..8aeff92 100644
--- a/qc/monsters/boss.qc
+++ b/qc/monsters/boss.qc
@@ -3,17 +3,33 @@
//==============================================================================
//======================================================================
+// constants
+//======================================================================
+
+#if defined(CSQC) || defined(SSQC)
+const vector BOSS_MINS = '-128 -128 -24';
+const vector BOSS_MAXS = '128 128 256';
+#endif
+
+//======================================================================
// globals
//======================================================================
+#ifdef SSQC
entity le1, le2;
float lightning_end;
+#endif
//======================================================================
// forward declarations
//======================================================================
// monster_boss
+#ifdef CSQC
+void(float isnew) monster_boss_netreceive;
+#endif
+#ifdef SSQC
+// F() // macro to set FRAME netflag -- CEV
void() monster_boss_face; // AI & firing
void(vector p) monster_boss_missile; // thinking & animation below
void() boss_idle1; void() boss_idle2; void() boss_idle3; void() boss_idle4;
@@ -51,19 +67,27 @@ void() boss_death1; void() boss_death2; void() boss_death3; void() boss_death4;
void() boss_death5; void() boss_death6; void() boss_death7; void() boss_death8;
void() boss_death9; void() boss_death10;
void() monster_boss_use; // interaction & initialization
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) monster_boss_init;
+#endif
+#ifdef SSQC
void() monster_boss;
+#endif
+#ifdef SSQC
// event_lightning
void() event_lightning_fire;
void() event_lightning_use;
void(entity e) event_lightning_init;
void() event_lightning;
+#endif
//======================================================================
// frame macros
//======================================================================
+#if defined(CSQC) || defined(SSQC)
$cd id1/models/boss1
$origin 0 0 -15
$base base
@@ -92,6 +116,7 @@ $frame shockb1 shockb2 shockb3 shockb4 shockb5 shockb6
$frame shockc1 shockc2 shockc3 shockc4 shockc5 shockc6 shockc7 shockc8
$frame shockc9 shockc10
+#endif
//------------------------------------------------------------------------------
@@ -100,6 +125,26 @@ $frame shockc9 shockc10
//----------------------------------------------------------------------
// class monster_boss: base_monster
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) monster_boss_netreceive =
+ {
+ // creates the newframe and netflags variables -- CEV
+ BASE_MONSTER_NETRECEIVE (monster_boss_init,
+ BOSS_MINS, BOSS_MAXS)
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ #define F() \
+ /* { */ \
+ if (!(self.SendFlags & NETFLAG_BASE_ENTITY_FRAME)) \
+ { \
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME; \
+ } \
+ /* } */
+
//--------------------------------------------------------------
void() monster_boss_face =
{
@@ -114,6 +159,7 @@ $frame shockc9 shockc10
}
ai_face ();
+ F ()
};
//--------------------------------------------------------------
@@ -144,7 +190,7 @@ $frame shockc9 shockc10
base_monster_fire_lavaball (org, d - org, LAVABALL_SPEED);
- sound_attack (self, CHAN_WEAPON, "boss1/throw.wav",
+ sound (self, CHAN_WEAPON, "boss1/throw.wav",
VOL_HIGH, ATTN_NORM);
// check for dead enemy
@@ -158,6 +204,7 @@ $frame shockc9 shockc10
void() boss_idle1 = [$walk1, boss_idle2]
{
// look for other players
+ F ()
};
void() boss_idle2 = [$walk2, boss_idle3] { monster_boss_face (); };
void() boss_idle3 = [$walk3, boss_idle4] { monster_boss_face (); };
@@ -195,29 +242,31 @@ $frame shockc9 shockc10
//--------------------------------------------------------------
void() boss_rise1 = [$rise1, boss_rise2]
{
- sound_move (self, CHAN_WEAPON, "boss1/out1.wav",
+ sound (self, CHAN_WEAPON, "boss1/out1.wav",
VOL_HIGH, ATTN_NORM);
+ F ()
};
void() boss_rise2 = [$rise2, boss_rise3]
{
- sound_sight (self, CHAN_VOICE, "boss1/sight1.wav",
+ sound (self, CHAN_VOICE, "boss1/sight1.wav",
VOL_HIGH, ATTN_NORM);
+ F ()
};
- void() boss_rise3 = [$rise3, boss_rise4] { };
- void() boss_rise4 = [$rise4, boss_rise5] { };
- void() boss_rise5 = [$rise5, boss_rise6] { };
- void() boss_rise6 = [$rise6, boss_rise7] { };
- void() boss_rise7 = [$rise7, boss_rise8] { };
- void() boss_rise8 = [$rise8, boss_rise9] { };
- void() boss_rise9 = [$rise9, boss_rise10] { };
- void() boss_rise10 = [$rise10, boss_rise11] { };
- void() boss_rise11 = [$rise11, boss_rise12] { };
- void() boss_rise12 = [$rise12, boss_rise13] { };
- void() boss_rise13 = [$rise13, boss_rise14] { };
- void() boss_rise14 = [$rise14, boss_rise15] { };
- void() boss_rise15 = [$rise15, boss_rise16] { };
- void() boss_rise16 = [$rise16, boss_rise17] { };
- void() boss_rise17 = [$rise17, boss_atk1] { };
+ void() boss_rise3 = [$rise3, boss_rise4] { F () };
+ void() boss_rise4 = [$rise4, boss_rise5] { F () };
+ void() boss_rise5 = [$rise5, boss_rise6] { F () };
+ void() boss_rise6 = [$rise6, boss_rise7] { F () };
+ void() boss_rise7 = [$rise7, boss_rise8] { F () };
+ void() boss_rise8 = [$rise8, boss_rise9] { F () };
+ void() boss_rise9 = [$rise9, boss_rise10] { F () };
+ void() boss_rise10 = [$rise10, boss_rise11] { F () };
+ void() boss_rise11 = [$rise11, boss_rise12] { F () };
+ void() boss_rise12 = [$rise12, boss_rise13] { F () };
+ void() boss_rise13 = [$rise13, boss_rise14] { F () };
+ void() boss_rise14 = [$rise14, boss_rise15] { F () };
+ void() boss_rise15 = [$rise15, boss_rise16] { F () };
+ void() boss_rise16 = [$rise16, boss_rise17] { F () };
+ void() boss_rise17 = [$rise17, boss_atk1] { F () };
//--------------------------------------------------------------
// Chthon Attack Lavaball
@@ -233,6 +282,7 @@ $frame shockc9 shockc10
void() boss_atk9 = [$attack9, boss_atk10]
{
monster_boss_missile ('100 100 200');
+ F ()
};
void() boss_atk10 = [$attack10, boss_atk11] { monster_boss_face (); };
void() boss_atk11 = [$attack11, boss_atk12] { monster_boss_face (); };
@@ -247,6 +297,7 @@ $frame shockc9 shockc10
void() boss_atk20 = [$attack20, boss_atk21]
{
monster_boss_missile ('100 -100 200');
+ F ()
};
void() boss_atk21 = [$attack21, boss_atk22] { monster_boss_face (); };
void() boss_atk22 = [$attack22, boss_atk23] { monster_boss_face (); };
@@ -255,79 +306,84 @@ $frame shockc9 shockc10
//--------------------------------------------------------------
// Chthon Shock! A
//--------------------------------------------------------------
- void() boss_shocka1 = [$shocka1, boss_shocka2] { };
- void() boss_shocka2 = [$shocka2, boss_shocka3] { };
- void() boss_shocka3 = [$shocka3, boss_shocka4] { };
- void() boss_shocka4 = [$shocka4, boss_shocka5] { };
- void() boss_shocka5 = [$shocka5, boss_shocka6] { };
- void() boss_shocka6 = [$shocka6, boss_shocka7] { };
- void() boss_shocka7 = [$shocka7, boss_shocka8] { };
- void() boss_shocka8 = [$shocka8, boss_shocka9] { };
- void() boss_shocka9 = [$shocka9, boss_shocka10] { };
- void() boss_shocka10 = [$shocka10, boss_atk1] { };
+ void() boss_shocka1 = [$shocka1, boss_shocka2] { F () };
+ void() boss_shocka2 = [$shocka2, boss_shocka3] { F () };
+ void() boss_shocka3 = [$shocka3, boss_shocka4] { F () };
+ void() boss_shocka4 = [$shocka4, boss_shocka5] { F () };
+ void() boss_shocka5 = [$shocka5, boss_shocka6] { F () };
+ void() boss_shocka6 = [$shocka6, boss_shocka7] { F () };
+ void() boss_shocka7 = [$shocka7, boss_shocka8] { F () };
+ void() boss_shocka8 = [$shocka8, boss_shocka9] { F () };
+ void() boss_shocka9 = [$shocka9, boss_shocka10] { F () };
+ void() boss_shocka10 = [$shocka10, boss_atk1] { F () };
//--------------------------------------------------------------
// Chthon Shock! B
//--------------------------------------------------------------
- void() boss_shockb1 = [$shockb1, boss_shockb2] { };
- void() boss_shockb2 = [$shockb2, boss_shockb3] { };
- void() boss_shockb3 = [$shockb3, boss_shockb4] { };
- void() boss_shockb4 = [$shockb4, boss_shockb5] { };
- void() boss_shockb5 = [$shockb5, boss_shockb6] { };
- void() boss_shockb6 = [$shockb6, boss_shockb7] { };
- void() boss_shockb7 = [$shockb1, boss_shockb8] { };
- void() boss_shockb8 = [$shockb2, boss_shockb9] { };
- void() boss_shockb9 = [$shockb3, boss_shockb10] { };
- void() boss_shockb10 = [$shockb4, boss_atk1] { };
+ void() boss_shockb1 = [$shockb1, boss_shockb2] { F () };
+ void() boss_shockb2 = [$shockb2, boss_shockb3] { F () };
+ void() boss_shockb3 = [$shockb3, boss_shockb4] { F () };
+ void() boss_shockb4 = [$shockb4, boss_shockb5] { F () };
+ void() boss_shockb5 = [$shockb5, boss_shockb6] { F () };
+ void() boss_shockb6 = [$shockb6, boss_shockb7] { F () };
+ void() boss_shockb7 = [$shockb1, boss_shockb8] { F () };
+ void() boss_shockb8 = [$shockb2, boss_shockb9] { F () };
+ void() boss_shockb9 = [$shockb3, boss_shockb10] { F () };
+ void() boss_shockb10 = [$shockb4, boss_atk1] { F () };
//--------------------------------------------------------------
// Chthon Shock! C
//--------------------------------------------------------------
- void() boss_shockc1 = [$shockc1, boss_shockc2] { };
- void() boss_shockc2 = [$shockc2, boss_shockc3] { };
- void() boss_shockc3 = [$shockc3, boss_shockc4] { };
- void() boss_shockc4 = [$shockc4, boss_shockc5] { };
- void() boss_shockc5 = [$shockc5, boss_shockc6] { };
- void() boss_shockc6 = [$shockc6, boss_shockc7] { };
- void() boss_shockc7 = [$shockc7, boss_shockc8] { };
- void() boss_shockc8 = [$shockc8, boss_shockc9] { };
- void() boss_shockc9 = [$shockc9, boss_shockc10] { };
- void() boss_shockc10 = [$shockc10, boss_death1] { };
+ void() boss_shockc1 = [$shockc1, boss_shockc2] { F () };
+ void() boss_shockc2 = [$shockc2, boss_shockc3] { F () };
+ void() boss_shockc3 = [$shockc3, boss_shockc4] { F () };
+ void() boss_shockc4 = [$shockc4, boss_shockc5] { F () };
+ void() boss_shockc5 = [$shockc5, boss_shockc6] { F () };
+ void() boss_shockc6 = [$shockc6, boss_shockc7] { F () };
+ void() boss_shockc7 = [$shockc7, boss_shockc8] { F () };
+ void() boss_shockc8 = [$shockc8, boss_shockc9] { F () };
+ void() boss_shockc9 = [$shockc9, boss_shockc10] { F () };
+ void() boss_shockc10 = [$shockc10, boss_death1] { F () };
//--------------------------------------------------------------
// Chthon Death state
//--------------------------------------------------------------
void() boss_death1 = [$death1, boss_death2]
{
- sound_death (self, CHAN_VOICE, "boss1/death.wav",
+ sound (self, CHAN_VOICE, "boss1/death.wav",
VOL_HIGH, ATTN_NORM);
+ F ()
};
- void() boss_death2 = [$death2, boss_death3] { };
- void() boss_death3 = [$death3, boss_death4] { };
- void() boss_death4 = [$death4, boss_death5] { };
- void() boss_death5 = [$death5, boss_death6] { };
- void() boss_death6 = [$death6, boss_death7] { };
- void() boss_death7 = [$death7, boss_death8] { };
- void() boss_death8 = [$death8, boss_death9] { };
+ void() boss_death2 = [$death2, boss_death3] { F () };
+ void() boss_death3 = [$death3, boss_death4] { F () };
+ void() boss_death4 = [$death4, boss_death5] { F () };
+ void() boss_death5 = [$death5, boss_death6] { F () };
+ void() boss_death6 = [$death6, boss_death7] { F () };
+ void() boss_death7 = [$death7, boss_death8] { F () };
+ void() boss_death8 = [$death8, boss_death9] { F () };
void() boss_death9 = [$death9, boss_death10]
{
- sound_move (self, CHAN_BODY, "boss1/out1.wav",
+ sound (self, CHAN_BODY, "boss1/out1.wav",
VOL_HIGH, ATTN_NORM);
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_LAVASPLASH);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);
+ F ()
};
void() boss_death10 = [$death9, boss_death10]
{
killed_monsters = killed_monsters + 1;
+ F ()
// FIXME: reliable broadcast
WriteByte (MSG_ALL, SVC_KILLEDMONSTER);
sub_usetargets ();
- remove (self);
+ base_entity_remove (self);
};
+ #undef F
+
//==============================================================
// Interaction
//==============================================================
@@ -340,11 +396,10 @@ $frame shockc9 shockc10
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
self.takedamage = DAMAGE_NO;
+ self.touch = base_monster_touch;
- body_model (self, "progs/boss.mdl");
- // custom_mdl -- dumptruck_ds
- // setmodel (self, "progs/boss.mdl");
- setsize (self, '-128 -128 -24', '128 128 256');
+ setmodel (self, "progs/boss.mdl");
+ setsize (self, BOSS_MINS, BOSS_MAXS);
if (skill == 0)
self.health = 1;
@@ -361,16 +416,20 @@ $frame shockc9 shockc10
self.yaw_speed = 20;
boss_rise1 ();
+ self.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
};
+#endif
//==============================================================
// Initialization
//==============================================================
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) monster_boss_init =
{
- if (e.spawnflags & I_AM_TURRET)
+ #ifdef SSQC
+ if (e.spawnflags & SPAWNFLAG_MONSTER_TURRET)
objerror ("Incompatible spawnflag: TURRET_MODE\n");
if (deathmatch)
@@ -378,46 +437,68 @@ $frame shockc9 shockc10
remove (e);
return;
}
+ #endif
e.classname = "monster_boss";
e.classtype = CT_MONSTER_BOSS_CHTHON;
+
+ #ifdef CSQC
+ if (e.modelindex)
+ {
+ setmodelindex (e, e.modelindex);
+ setsize (e, BOSS_MINS, BOSS_MAXS);
+ }
+
+ // only call base_monster_init on the client side -- CEV
base_monster_init (e);
+ #endif
- // precache_model ("progs/boss.mdl");
- precache_body_model (e, "progs/boss.mdl");
- precache_head_model (e, "progs/h_boss.mdl");
+ #ifdef SSQC
+ precache_model ("progs/boss.mdl");
+ precache_model ("progs/h_boss.mdl");
precache_model ("progs/lavaball.mdl");
precache_sound ("weapons/rocket1i.wav");
- precache_sound_move (e, "boss1/out1.wav");
- precache_sound_sight (e, "boss1/sight1.wav");
+ precache_sound ("boss1/out1.wav");
+ precache_sound ("boss1/sight1.wav");
precache_sound ("misc/power.wav");
- precache_sound_attack (e, "boss1/throw.wav");
- precache_sound_pain (e, "boss1/pain.wav");
- precache_sound_death (e, "boss1/death.wav");
+ precache_sound ("boss1/throw.wav");
+ precache_sound ("boss1/pain.wav");
+ precache_sound ("boss1/death.wav");
total_monsters = total_monsters + 1;
+ e.classgroup |= CG_MONSTER;
+ base_mapentity_init (e);
+
e.flags = FL_MONSTER;
e.use = monster_boss_use;
+
+ // set up to transmit to CSQC -- CEV
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() monster_boss =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags & fields, inhibit if necessary -- CEV
+ BASE_MONSTER_PREINIT (base_monster_init_field)
monster_boss_init (self);
};
+#endif
// };
//----------------------------------------------------------------------
// Event Lightning
//----------------------------------------------------------------------
+#ifdef SSQC
/*QUAKED event_lightning (0 1 1) (-16 -16 -16) (16 16 16) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Just for boss level.
*/
@@ -502,7 +583,7 @@ Just for boss level.
boss.enemy = activator;
if (le1.state == FUNC_STATE_TOP && boss.health > 0)
{
- sound_pain (boss, CHAN_VOICE, "boss1/pain.wav",
+ sound (boss, CHAN_VOICE, "boss1/pain.wav",
VOL_HIGH, ATTN_NORM);
boss.health = boss.health - 1;
if (boss.health >= 2)
@@ -533,3 +614,8 @@ Just for boss level.
event_lightning_init (self);
};
// };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+$flush
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/monsters/boss2.qc
diff --git a/qc/monsters/boss2.qc b/qc/monsters/boss2.qc
index 9cc982b..60f1377 100644
--- a/qc/monsters/boss2.qc
+++ b/qc/monsters/boss2.qc
@@ -6,17 +6,54 @@
// constants
//======================================================================
-// supress lava splash effect when raising, lowering or gibbing -- dumptruck_ds
-const float NO_LAVASPLASH = 2;
-
+#ifdef SSQC
+//----------------------------------------------------------------------
+// monster boss2 spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ // supress lava splash effect when raising, lowering or
+ // gibbing -- dumptruck_ds
+ SPAWNFLAG_MONSTER_BOSS2_NO_LAVASPLASH = 2
+ // SPAWNFLAG_MONSTER_NO_SIGHT_SOUND = 32, // see base_monster.qc -- CEV
+ // SPAWNFLAG_MONSTER_PASSIVE_UNTIL_ATTACKED = 64,
+ // SPAWNFLAG_MONSTER_PASSIVE_ALWAYS = 128,
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024, // base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_IN_COOP = 4096, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_IN_SP = 8192, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+ // SPAWNFLAG_MONSTER_TURRET = 262144, // see base_monster.qc -- CEV
+ // SPAWNFLAG_MONSTER_SILENT = 2097152 // see base_monster.qc -- CEV
+} monster_boss2_spawnflags;
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+const vector BOSS2_MINS = '-128 -128 -24';
+const vector BOSS2_MAXS = '128 128 256';
+const vector BOSS2_HEAD_MINS = '-67 -60 -6'; // -16 -16 0
+const vector BOSS2_HEAD_MAXS = '62 52 88'; // 16 16 56
+#endif
+
+#ifdef SSQC
const float BOSS2_HEALTH_EASY = 1000; // pd3 1000
const float BOSS2_HEALTH_NORM = 3000; // pd3 3000
+#endif
//======================================================================
// forward declarations
//======================================================================
// monster_boss2
+#ifdef CSQC
+void(float isnew) monster_boss2_netreceive;
+#endif
+#ifdef SSQC
+// F() // macro to set FRAME netflag -- CEV
void() monster_boss2_face; // AI & firing
void(vector p) monster_boss2_missile;
void(vector dir) monster_boss2_gib; // thinking & animation below
@@ -63,13 +100,19 @@ void() boss2_death10;
void(entity attacker, float damage) monster_boss2_pain; // interaction
void(vector dir) monster_boss2_destroy;
void() monster_boss2_use;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) monster_boss2_init; // initialization
+#endif
+#ifdef SSQC
void() monster_boss2;
+#endif
//======================================================================
// frame macros
//======================================================================
+#if defined(CSQC) || defined(SSQC)
$cd id1/models/boss1
$origin 0 0 -15
$base base
@@ -98,6 +141,7 @@ $frame shockb1 shockb2 shockb3 shockb4 shockb5 shockb6
$frame shockc1 shockc2 shockc3 shockc4 shockc5 shockc6 shockc7 shockc8
$frame shockc9 shockc10
+#endif
//------------------------------------------------------------------------------
@@ -106,6 +150,26 @@ $frame shockc9 shockc10
//----------------------------------------------------------------------
// class monster_boss2: base_monster
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) monster_boss2_netreceive =
+ {
+ // creates the newframe and netflags variables -- CEV
+ BASE_MONSTER_NETRECEIVE (monster_boss2_init,
+ BOSS2_MINS, BOSS2_MAXS)
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ #define F() \
+ /* { */ \
+ if (!(self.SendFlags & NETFLAG_BASE_ENTITY_FRAME)) \
+ { \
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME; \
+ } \
+ /* } */
+
//--------------------------------------------------------------
void() monster_boss2_face =
{
@@ -119,6 +183,7 @@ $frame shockc9 shockc10
CT_PLAYER);
}
ai_face ();
+ F ()
};
//--------------------------------------------------------------
@@ -149,7 +214,7 @@ $frame shockc9 shockc10
base_monster_fire_lavaball (org, d - org, LAVABALL_SPEED);
- sound_attack (self, CHAN_WEAPON, "boss1/throw.wav",
+ sound (self, CHAN_WEAPON, "boss1/throw.wav",
VOL_HIGH, ATTN_NORM);
// check for dead enemy
@@ -171,6 +236,8 @@ $frame shockc9 shockc10
local float r;
// local entity n;
+ local void(entity e) func1;
+
boss = self.origin;
z = 16;
while (z <= 144)
@@ -187,15 +254,22 @@ $frame shockc9 shockc10
r = random ();
if (r < 0.3)
- throw_gib_1 (self, dir, -120);
+ {
+ func1 = item_gib1_init;
+ }
else if (r < 0.5)
- throw_gib_2 (self, dir, -120);
+ {
+ func1 = item_gib2_init;
+ }
// FIXME TODO CEV
// else if (r < 0.7)
// throw_gib ("progs/lavaball.mdl",
// -120);
else
- throw_gib_3 (self, dir, -120);
+ {
+ func1 = item_gib3_init;
+ }
+ BASE_ITEM_GIB_THROW (dir, -120, func1)
y = y + 32;
}
x = x + 32;
@@ -203,6 +277,7 @@ $frame shockc9 shockc10
z = z + 96;
}
+ // TODO CEV boss2 head
local entity head;
head = spawn ();
@@ -217,31 +292,13 @@ $frame shockc9 shockc10
head.solid = SOLID_NOT;
head.movetype = MOVETYPE_BOUNCE;
head.takedamage = DAMAGE_NO;
- // dumptruck_ds custom_mdls
- if (self.mdl_head != "")
- {
- setmodel (head, self.mdl_head);
- }
- else
- {
- setmodel (head, "progs/h_boss.mdl");
- }
-
- // dumptruck_ds
- if (!self.skin_head)
- {
- head.skin = self.skin_proj;
- }
- else
- {
- head.skin = 0;
- }
- setsize (head, '-67 -60 -6', '62 52 88');
- // setsize (head, '-16 -16 0', '16 16 56');
+ setmodel (head, "progs/h_boss.mdl");
+ head.skin = 0;
+ setsize (head, BOSS2_HEAD_MINS, BOSS2_HEAD_MAXS);
head.touch = sub_null;
head.think = sub_remove;
head.nextthink = time + 120;
- if !(self.spawnflags & NO_LAVASPLASH)
+ if (!(self.spawnflags & SPAWNFLAG_MONSTER_BOSS2_NO_LAVASPLASH))
{
// done in combat.qc since self is now FL_MONSTER
// killed_monsters = killed_monsters + 1;
@@ -263,6 +320,7 @@ $frame shockc9 shockc10
void() boss2_idle1 = [$walk1, boss2_idle2]
{
// look for other players
+ F ()
};
void() boss2_idle2 = [$walk2, boss2_idle3] { monster_boss2_face (); };
void() boss2_idle3 = [$walk3, boss2_idle4] { monster_boss2_face (); };
@@ -300,29 +358,31 @@ $frame shockc9 shockc10
//--------------------------------------------------------------
void() boss2_rise1 = [$rise1, boss2_rise2]
{
- sound_move (self, CHAN_WEAPON, "boss1/out1.wav",
+ sound (self, CHAN_WEAPON, "boss1/out1.wav",
VOL_HIGH, ATTN_NORM);
+ F ()
};
void() boss2_rise2 = [$rise2, boss2_rise3]
{
- sound_sight (self, CHAN_VOICE, "boss1/sight1.wav",
+ sound (self, CHAN_VOICE, "boss1/sight1.wav",
VOL_HIGH, ATTN_NORM);
+ F ()
};
- void() boss2_rise3 = [$rise3, boss2_rise4] { };
- void() boss2_rise4 = [$rise4, boss2_rise5] { };
- void() boss2_rise5 = [$rise5, boss2_rise6] { };
- void() boss2_rise6 = [$rise6, boss2_rise7] { };
- void() boss2_rise7 = [$rise7, boss2_rise8] { };
- void() boss2_rise8 = [$rise8, boss2_rise9] { };
- void() boss2_rise9 = [$rise9, boss2_rise10] { };
- void() boss2_rise10 = [$rise10, boss2_rise11] { };
- void() boss2_rise11 = [$rise11, boss2_rise12] { };
- void() boss2_rise12 = [$rise12, boss2_rise13] { };
- void() boss2_rise13 = [$rise13, boss2_rise14] { };
- void() boss2_rise14 = [$rise14, boss2_rise15] { };
- void() boss2_rise15 = [$rise15, boss2_rise16] { };
- void() boss2_rise16 = [$rise16, boss2_rise17] { };
- void() boss2_rise17 = [$rise17, boss2_atk1] { };
+ void() boss2_rise3 = [$rise3, boss2_rise4] { F () };
+ void() boss2_rise4 = [$rise4, boss2_rise5] { F () };
+ void() boss2_rise5 = [$rise5, boss2_rise6] { F () };
+ void() boss2_rise6 = [$rise6, boss2_rise7] { F () };
+ void() boss2_rise7 = [$rise7, boss2_rise8] { F () };
+ void() boss2_rise8 = [$rise8, boss2_rise9] { F () };
+ void() boss2_rise9 = [$rise9, boss2_rise10] { F () };
+ void() boss2_rise10 = [$rise10, boss2_rise11] { F () };
+ void() boss2_rise11 = [$rise11, boss2_rise12] { F () };
+ void() boss2_rise12 = [$rise12, boss2_rise13] { F () };
+ void() boss2_rise13 = [$rise13, boss2_rise14] { F () };
+ void() boss2_rise14 = [$rise14, boss2_rise15] { F () };
+ void() boss2_rise15 = [$rise15, boss2_rise16] { F () };
+ void() boss2_rise16 = [$rise16, boss2_rise17] { F () };
+ void() boss2_rise17 = [$rise17, boss2_atk1] { F () };
//--------------------------------------------------------------
// Chthon Attack Lavaball
@@ -338,6 +398,7 @@ $frame shockc9 shockc10
void() boss2_atk9 = [$attack9, boss2_atk10]
{
monster_boss2_missile ('100 100 200');
+ F ()
};
void() boss2_atk10 = [$attack10, boss2_atk11] { monster_boss2_face ();};
void() boss2_atk11 = [$attack11, boss2_atk12] { monster_boss2_face ();};
@@ -352,6 +413,7 @@ $frame shockc9 shockc10
void() boss2_atk20 = [$attack20, boss2_atk21]
{
monster_boss2_missile ('100 -100 200');
+ F ()
};
void() boss2_atk21 = [$attack21, boss2_atk22] { monster_boss2_face ();};
void() boss2_atk22 = [$attack22, boss2_atk23] { monster_boss2_face ();};
@@ -360,64 +422,66 @@ $frame shockc9 shockc10
//--------------------------------------------------------------
// Chthon Shock! A
//--------------------------------------------------------------
- void() boss2_shocka1 = [$shocka1, boss2_shocka2] { };
- void() boss2_shocka2 = [$shocka2, boss2_shocka3] { };
- void() boss2_shocka3 = [$shocka3, boss2_shocka4] { };
- void() boss2_shocka4 = [$shocka4, boss2_shocka5] { };
- void() boss2_shocka5 = [$shocka5, boss2_shocka6] { };
- void() boss2_shocka6 = [$shocka6, boss2_shocka7] { };
- void() boss2_shocka7 = [$shocka7, boss2_shocka8] { };
- void() boss2_shocka8 = [$shocka8, boss2_shocka9] { };
- void() boss2_shocka9 = [$shocka9, boss2_shocka10] { };
- void() boss2_shocka10 = [$shocka10, boss2_atk1] { };
+ void() boss2_shocka1 = [$shocka1, boss2_shocka2] { F () };
+ void() boss2_shocka2 = [$shocka2, boss2_shocka3] { F () };
+ void() boss2_shocka3 = [$shocka3, boss2_shocka4] { F () };
+ void() boss2_shocka4 = [$shocka4, boss2_shocka5] { F () };
+ void() boss2_shocka5 = [$shocka5, boss2_shocka6] { F () };
+ void() boss2_shocka6 = [$shocka6, boss2_shocka7] { F () };
+ void() boss2_shocka7 = [$shocka7, boss2_shocka8] { F () };
+ void() boss2_shocka8 = [$shocka8, boss2_shocka9] { F () };
+ void() boss2_shocka9 = [$shocka9, boss2_shocka10] { F () };
+ void() boss2_shocka10 = [$shocka10, boss2_atk1] { F () };
//--------------------------------------------------------------
// Chthon Shock! B
//--------------------------------------------------------------
- void() boss2_shockb1 = [$shockb1, boss2_shockb2] { };
- void() boss2_shockb2 = [$shockb2, boss2_shockb3] { };
- void() boss2_shockb3 = [$shockb3, boss2_shockb4] { };
- void() boss2_shockb4 = [$shockb4, boss2_shockb5] { };
- void() boss2_shockb5 = [$shockb5, boss2_shockb6] { };
- void() boss2_shockb6 = [$shockb6, boss2_shockb7] { };
- void() boss2_shockb7 = [$shockb1, boss2_shockb8] { };
- void() boss2_shockb8 = [$shockb2, boss2_shockb9] { };
- void() boss2_shockb9 = [$shockb3, boss2_shockb10] { };
- void() boss2_shockb10 = [$shockb4, boss2_atk1] { };
+ void() boss2_shockb1 = [$shockb1, boss2_shockb2] { F () };
+ void() boss2_shockb2 = [$shockb2, boss2_shockb3] { F () };
+ void() boss2_shockb3 = [$shockb3, boss2_shockb4] { F () };
+ void() boss2_shockb4 = [$shockb4, boss2_shockb5] { F () };
+ void() boss2_shockb5 = [$shockb5, boss2_shockb6] { F () };
+ void() boss2_shockb6 = [$shockb6, boss2_shockb7] { F () };
+ void() boss2_shockb7 = [$shockb1, boss2_shockb8] { F () };
+ void() boss2_shockb8 = [$shockb2, boss2_shockb9] { F () };
+ void() boss2_shockb9 = [$shockb3, boss2_shockb10] { F () };
+ void() boss2_shockb10 = [$shockb4, boss2_atk1] { F () };
//--------------------------------------------------------------
// Chthon Shock! C
//--------------------------------------------------------------
- void() boss2_shockc1 = [$shockc1, boss2_shockc2] { };
- void() boss2_shockc2 = [$shockc2, boss2_shockc3] { };
- void() boss2_shockc3 = [$shockc3, boss2_shockc4] { };
- void() boss2_shockc4 = [$shockc4, boss2_shockc5] { };
- void() boss2_shockc5 = [$shockc5, boss2_shockc6] { };
- void() boss2_shockc6 = [$shockc6, boss2_shockc7] { };
- void() boss2_shockc7 = [$shockc7, boss2_shockc8] { };
- void() boss2_shockc8 = [$shockc8, boss2_shockc9] { };
- void() boss2_shockc9 = [$shockc9, boss2_shockc10] { };
- void() boss2_shockc10 = [$shockc10, boss2_death1] { };
+ void() boss2_shockc1 = [$shockc1, boss2_shockc2] { F () };
+ void() boss2_shockc2 = [$shockc2, boss2_shockc3] { F () };
+ void() boss2_shockc3 = [$shockc3, boss2_shockc4] { F () };
+ void() boss2_shockc4 = [$shockc4, boss2_shockc5] { F () };
+ void() boss2_shockc5 = [$shockc5, boss2_shockc6] { F () };
+ void() boss2_shockc6 = [$shockc6, boss2_shockc7] { F () };
+ void() boss2_shockc7 = [$shockc7, boss2_shockc8] { F () };
+ void() boss2_shockc8 = [$shockc8, boss2_shockc9] { F () };
+ void() boss2_shockc9 = [$shockc9, boss2_shockc10] { F () };
+ void() boss2_shockc10 = [$shockc10, boss2_death1] { F () };
//--------------------------------------------------------------
// Chthon Pain state
//--------------------------------------------------------------
- void() boss2_pain1 = [$shocka1, boss2_pain2] { };
- void() boss2_pain2 = [$shocka2, boss2_pain3] { };
- void() boss2_pain3 = [$shocka3, boss2_pain4] { };
+ void() boss2_pain1 = [$shocka1, boss2_pain2] { F () };
+ void() boss2_pain2 = [$shocka2, boss2_pain3] { F () };
+ void() boss2_pain3 = [$shocka3, boss2_pain4] { F () };
void() boss2_pain4 = [$shocka4, boss2_pain5]
{
// pain noise
- sound_pain (self, CHAN_VOICE, "boss1/pain.wav",
+ sound (self, CHAN_VOICE, "boss1/pain.wav",
VOL_HIGH, ATTN_NORM);
+ F ()
};
- void() boss2_pain5 = [$shocka5, boss2_pain6] { };
- void() boss2_pain6 = [$shocka6, boss2_pain7] { };
- void() boss2_pain7 = [$shocka7, boss2_pain8] { };
- void() boss2_pain8 = [$shocka8, boss2_pain9] { };
+ void() boss2_pain5 = [$shocka5, boss2_pain6] { F () };
+ void() boss2_pain6 = [$shocka6, boss2_pain7] { F () };
+ void() boss2_pain7 = [$shocka7, boss2_pain8] { F () };
+ void() boss2_pain8 = [$shocka8, boss2_pain9] { F () };
void() boss2_pain9 = [$shocka9, boss2_atk1]
{
// auto shoot a lavaball (by advancing to next think state)
+ F ()
};
//--------------------------------------------------------------
@@ -425,21 +489,22 @@ $frame shockc9 shockc10
//--------------------------------------------------------------
void() boss2_death1 = [$death1, boss2_death2]
{
- sound_death (self, CHAN_VOICE, "boss1/death.wav",
+ sound (self, CHAN_VOICE, "boss1/death.wav",
VOL_HIGH, ATTN_NORM);
+ F ()
};
- void() boss2_death2 = [$death2, boss2_death3] { };
- void() boss2_death3 = [$death3, boss2_death4] { };
- void() boss2_death4 = [$death4, boss2_death5] { };
- void() boss2_death5 = [$death5, boss2_death6] { };
- void() boss2_death6 = [$death6, boss2_death7] { };
- void() boss2_death7 = [$death7, boss2_death8] { };
- void() boss2_death8 = [$death8, boss2_death9] { };
+ void() boss2_death2 = [$death2, boss2_death3] { F () };
+ void() boss2_death3 = [$death3, boss2_death4] { F () };
+ void() boss2_death4 = [$death4, boss2_death5] { F () };
+ void() boss2_death5 = [$death5, boss2_death6] { F () };
+ void() boss2_death6 = [$death6, boss2_death7] { F () };
+ void() boss2_death7 = [$death7, boss2_death8] { F () };
+ void() boss2_death8 = [$death8, boss2_death9] { F () };
void() boss2_death9 = [$death9, boss2_death10]
{
- sound_move (self, CHAN_BODY, "boss1/out1.wav",
+ sound (self, CHAN_BODY, "boss1/out1.wav",
VOL_HIGH, ATTN_NORM);
- if !(self.spawnflags & NO_LAVASPLASH)
+ if (!(self.spawnflags & SPAWNFLAG_MONSTER_BOSS2_NO_LAVASPLASH))
{
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_LAVASPLASH);
@@ -447,18 +512,22 @@ $frame shockc9 shockc10
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);
}
+ F ()
};
void() boss2_death10 = [$death9, boss2_death10]
{
+ F ()
// unlike the code for the original monster_boss, this
// function doesn't need to increment killed_monsters
// or call SUB_UseTargets(); this entity gets killed
// by regular damage and has FL_MONSTER, so the Killed()
// function (in combat.qc) will already have taken care
// of those things -- iw
- remove (self);
+ base_entity_remove (self);
};
+ #undef F
+
//==============================================================
// Interaction
//==============================================================
@@ -502,10 +571,10 @@ $frame shockc9 shockc10
self.solid = SOLID_SLIDEBOX;
self.movetype = MOVETYPE_STEP;
self.takedamage = DAMAGE_AIM;
+ self.touch = base_monster_touch;
- body_model (self, "progs/boss.mdl");
- // setmodel (self, "progs/boss.mdl");
- setsize (self, '-128 -128 -24', '128 128 256');
+ setmodel (self, "progs/boss.mdl");
+ setsize (self, BOSS2_MINS, BOSS2_MAXS);
if (!self.health)
if (skill == 0)
@@ -528,7 +597,7 @@ $frame shockc9 shockc10
self.enemy = activator;
- if !(self.spawnflags & NO_LAVASPLASH)
+ if (!(self.spawnflags & SPAWNFLAG_MONSTER_BOSS2_NO_LAVASPLASH))
{
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_LAVASPLASH);
@@ -538,17 +607,23 @@ $frame shockc9 shockc10
}
self.yaw_speed = 20;
+
+ // full send -- CEV
boss2_rise1 ();
+ self.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
};
+#endif
//==============================================================
// Initialization
//==============================================================
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) monster_boss2_init =
{
- if (e.spawnflags & I_AM_TURRET)
+ #ifdef SSQC
+ if (e.spawnflags & SPAWNFLAG_MONSTER_TURRET)
objerror ("Incompatible spawnflag: TURRET_MODE\n");
if (deathmatch)
@@ -556,42 +631,67 @@ $frame shockc9 shockc10
remove (e);
return;
}
+ #endif
e.classname = "monster_boss2";
e.classtype = CT_MONSTER_BOSS_CHTHON2;
+
+ #ifdef CSQC
+ if (e.modelindex)
+ {
+ setmodelindex (e, e.modelindex);
+ setsize (e, BOSS2_MINS, BOSS2_MAXS);
+ }
+
+ // only call base_monster_init on the client side -- CEV
base_monster_init (e);
+ #endif
- // custom sounds and models -- dumptruck_ds
- precache_body_model (e, "progs/boss.mdl");
- precache_head_model (e, "progs/h_boss.mdl");
+ #ifdef SSQC
+ precache_model ("progs/boss.mdl");
+ precache_model ("progs/h_boss.mdl");
precache_model ("progs/lavaball.mdl");
- // precache_model ("progs/boss.mdl");
precache_model ("progs/h_boss.mdl");
precache_sound ("weapons/rocket1i.wav");
- precache_sound_move (e, "boss1/out1.wav");
- precache_sound_sight (e, "boss1/sight1.wav");
+ precache_sound ("boss1/out1.wav");
+ precache_sound ("boss1/sight1.wav");
precache_sound ("misc/power.wav");
- precache_sound_attack (e, "boss1/throw.wav");
- precache_sound_pain (e, "boss1/pain.wav");
- precache_sound_death (e, "boss1/death.wav");
+ precache_sound ("boss1/throw.wav");
+ precache_sound ("boss1/pain.wav");
+ precache_sound ("boss1/death.wav");
- precache_gib1 (e, "progs/gib1.mdl");
- precache_gib2 (e, "progs/gib2.mdl");
- precache_gib3 (e, "progs/gib3.mdl");
+ precache_model ("progs/gib1.mdl");
+ precache_model ("progs/gib2.mdl");
+ precache_model ("progs/gib3.mdl");
total_monsters = total_monsters + 1;
+
+ e.classgroup |= CG_MONSTER;
+ base_mapentity_init (e);
+
e.flags = FL_MONSTER;
e.use = monster_boss2_use;
+
+ // set up to transmit to CSQC -- CEV
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() monster_boss2 =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags & fields, inhibit if necessary -- CEV
+ BASE_MONSTER_PREINIT (base_monster_init_field)
monster_boss2_init (self);
};
+#endif
// };
+
+#if defined(CSQC) || defined(SSQC)
+$flush
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/monsters/demon.qc
diff --git a/qc/monsters/demon.qc b/qc/monsters/demon.qc
index c89b2ed..736b754 100644
--- a/qc/monsters/demon.qc
+++ b/qc/monsters/demon.qc
@@ -6,26 +6,34 @@
// constants
//======================================================================
+#ifdef SSQC
const float DEMON1_HEALTH = 300; // id1 300
const float DEMON1_HEALTH_CORPSE = 80;
+#endif
-const vector DEMON1_HEAD_MINS = '-13.64 -16.77 -0.11';
-const vector DEMON1_HEAD_MAXS = '17.44 16.22 30';
+#if defined(CSQC) || defined(SSQC)
const vector DEMON1_CORPSE_MINS = '-43.63 -47.26 -50.53';
const vector DEMON1_CORPSE_MAXS = '32.48 24.65 30';
const vector DEMON1_CORPSE_Z_MINS = '-20 -20 -24'; // thin 40x40 box on ground
const vector DEMON1_CORPSE_Z_MAXS = '20 20 -8';
+#endif
//======================================================================
// forward declarations
//======================================================================
// monster_demon1
+#ifdef CSQC
+void(float isnew) monster_demon1_netreceive;
+#endif
+#ifdef SSQC
// float() monster_demon1_checkmelee; // AI & attacks
float() monster_demon1_checkjump;
float() monster_demon1_checkattack;
void() monster_demon1_sightsound;
void(float side) monster_demon1_melee; // thinking & animation below
+// F() // macro to set FRAME netflag -- CEV
+// FO() // macro to set FRAME & ORIGIN -- CEV
void() dem1_stand1; void() dem1_stand2; void() dem1_stand3; void() dem1_stand4;
void() dem1_stand5; void() dem1_stand6; void() dem1_stand7; void() dem1_stand8;
void() dem1_stand9; void() dem1_stand10; void() dem1_stand11;
@@ -37,6 +45,7 @@ void() dem1_run5; void() dem1_run6;
void() dem1_jump1; void() dem1_jump2; void() dem1_jump3; void() dem1_jump4;
void() dem1_jump5; void() dem1_jump6; void() dem1_jump7; void() dem1_jump8;
void() dem1_jump9; void() dem1_jump10; void() dem1_jump11; void() dem1_jump12;
+void() dem1_jump99;
void() dem1_atk1; void() dem1_atk2; void() dem1_atk3; void() dem1_atk4;
void() dem1_atk5; void() dem1_atk6; void() dem1_atk7; void() dem1_atk8;
void() dem1_atk9; void() dem1_atk10; void() dem1_atk11; void() dem1_atk12;
@@ -49,24 +58,27 @@ void() dem1_die9;
void(entity attacker, float damage) monster_demon1_pain; // interaction
void(vector dir) monster_demon1_destroy;
void() monster_demon1_touch;
-entity(vector org, vector ang, float sflags, float yaw, float angry)
+entity(vector org, vector ang, float sflags, float yaw)
spawn_monster_demon1; // initialization
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) monster_demon1_init;
+#endif
+#ifdef SSQC
void() monster_demon1;
+#endif
-// gib_head_demon
-void(entity act, vector dir, float dmg) throw_gib_head_demon;
-void(entity e) gib_head_demon_init;
-void() gib_head_demon;
-
+#ifdef SSQC
// monster_dead_demon
void(entity e) monster_dead_demon_init;
void() monster_dead_demon;
+#endif
//======================================================================
// frame macros
//======================================================================
+#if defined(CSQC) || defined(SSQC)
$cd id1/models/demon3
$scale 0.8
$origin 0 0 24
@@ -90,6 +102,10 @@ $frame death1 death2 death3 death4 death5 death6 death7 death8 death9
$frame attacka1 attacka2 attacka3 attacka4 attacka5 attacka6 attacka7 attacka8
$frame attacka9 attacka10 attacka11 attacka12 attacka13 attacka14 attacka15
+// MG1 compat -- CEV
+const float CORPSEFRAME_DEMON_1 = $death9;
+#endif
+
//------------------------------------------------------------------------------
/*QUAKED monster_demon1 (1 0 0) (-32 -32 -24) (32 32 64) AMBUSH X X TRIGGER_SPAWNED X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
@@ -149,8 +165,28 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
*/
//----------------------------------------------------------------------
-// class monster_demon1: base_walkmonster
+// class monster_demon1: base_monster
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) monster_demon1_netreceive =
+ {
+ // creates the newframe and netflags variables -- CEV
+ BASE_MONSTER_NETRECEIVE (monster_demon1_init,
+ VEC_HULL2_MIN, VEC_HULL2_MAX)
+
+ if (isnew)
+ base_entity_que_add (self, QUE_TYPE_ACTOR);
+
+ if (self.frame >= $death6 && self.frame <= $death9)
+ {
+ if (self.solid != SOLID_NOT)
+ self.solid = SOLID_NOT;
+ }
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
// CheckDemonMelee
// Returns TRUE if a melee attack would hit right now
@@ -223,7 +259,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
if (monster_demon1_checkjump())
{
self.attack_state = AS_MISSILE;
- sound_attack (self, CHAN_VOICE, "demon/djump.wav",
+ sound (self, CHAN_VOICE, "demon/djump.wav",
VOL_HIGH, ATTN_NORM);
return TRUE;
}
@@ -234,7 +270,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//--------------------------------------------------------------
void() monster_demon1_sightsound =
{
- sound_sight (self, CHAN_VOICE, "demon/sight2.wav",
+ sound (self, CHAN_VOICE, "demon/sight2.wav",
VOL_HIGH, ATTN_NORM);
};
@@ -247,6 +283,8 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
ai_face ();
// allow a little closing
walkmove (self.ideal_yaw, 12);
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_ANGLES;
delta = self.enemy.origin - self.origin;
@@ -255,7 +293,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
if (!can_damage(self, self.enemy))
return;
- sound_hit (self, CHAN_WEAPON, "demon/dhit2.wav",
+ sound (self, CHAN_WEAPON, "demon/dhit2.wav",
VOL_HIGH, ATTN_NORM);
ldmg = 10 + 5 * random ();
t_damage2 (self.enemy, self, self, ldmg);
@@ -265,21 +303,43 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
};
//--------------------------------------------------------------
+ #define F() \
+ /* { */ \
+ if (!(self.SendFlags & NETFLAG_BASE_ENTITY_FRAME)) \
+ { \
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME; \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
+ #define FO() \
+ /* { */ \
+ if (!(self.SendFlags & NETFLAG_BASE_ENTITY_FRAME)) \
+ { \
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME; \
+ } \
+ if (!(self.SendFlags & NETFLAG_BASE_ENTITY_ORIGIN)) \
+ { \
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN; \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
// Fiend stand functions
//--------------------------------------------------------------
- void() dem1_stand1 = [$stand1, dem1_stand2] { ai_stand (); };
- void() dem1_stand2 = [$stand2, dem1_stand3] { ai_stand (); };
- void() dem1_stand3 = [$stand3, dem1_stand4] { ai_stand (); };
- void() dem1_stand4 = [$stand4, dem1_stand5] { ai_stand (); };
- void() dem1_stand5 = [$stand5, dem1_stand6] { ai_stand (); };
- void() dem1_stand6 = [$stand6, dem1_stand7] { ai_stand (); };
- void() dem1_stand7 = [$stand7, dem1_stand8] { ai_stand (); };
- void() dem1_stand8 = [$stand8, dem1_stand9] { ai_stand (); };
- void() dem1_stand9 = [$stand9, dem1_stand10] { ai_stand (); };
- void() dem1_stand10 = [$stand10, dem1_stand11] { ai_stand (); };
- void() dem1_stand11 = [$stand11, dem1_stand12] { ai_stand (); };
- void() dem1_stand12 = [$stand12, dem1_stand13] { ai_stand (); };
- void() dem1_stand13 = [$stand13, dem1_stand1] { ai_stand (); };
+ void() dem1_stand1 = [$stand1, dem1_stand2] { ai_stand (); F () };
+ void() dem1_stand2 = [$stand2, dem1_stand3] { ai_stand (); F () };
+ void() dem1_stand3 = [$stand3, dem1_stand4] { ai_stand (); F () };
+ void() dem1_stand4 = [$stand4, dem1_stand5] { ai_stand (); F () };
+ void() dem1_stand5 = [$stand5, dem1_stand6] { ai_stand (); F () };
+ void() dem1_stand6 = [$stand6, dem1_stand7] { ai_stand (); F () };
+ void() dem1_stand7 = [$stand7, dem1_stand8] { ai_stand (); F () };
+ void() dem1_stand8 = [$stand8, dem1_stand9] { ai_stand (); F () };
+ void() dem1_stand9 = [$stand9, dem1_stand10] { ai_stand (); F () };
+ void() dem1_stand10 = [$stand10, dem1_stand11] { ai_stand (); F () };
+ void() dem1_stand11 = [$stand11, dem1_stand12] { ai_stand (); F () };
+ void() dem1_stand12 = [$stand12, dem1_stand13] { ai_stand (); F () };
+ void() dem1_stand13 = [$stand13, dem1_stand1] { ai_stand (); F () };
//--------------------------------------------------------------
// Fiend walk functions
@@ -287,17 +347,18 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() dem1_walk1 = [$walk1, dem1_walk2]
{
if (random() < 0.2)
- sound_idle (self, CHAN_VOICE, "demon/idle1.wav",
+ sound (self, CHAN_VOICE, "demon/idle1.wav",
VOL_HIGH, ATTN_IDLE);
ai_walk (8);
+ F ()
};
- void() dem1_walk2 = [$walk2, dem1_walk3] { ai_walk (6); };
- void() dem1_walk3 = [$walk3, dem1_walk4] { ai_walk (6); };
- void() dem1_walk4 = [$walk4, dem1_walk5] { ai_walk (7); };
- void() dem1_walk5 = [$walk5, dem1_walk6] { ai_walk (4); };
- void() dem1_walk6 = [$walk6, dem1_walk7] { ai_walk (6); };
- void() dem1_walk7 = [$walk7, dem1_walk8] { ai_walk (10); };
- void() dem1_walk8 = [$walk8, dem1_walk1] { ai_walk (10); };
+ void() dem1_walk2 = [$walk2, dem1_walk3] { ai_walk (6); F () };
+ void() dem1_walk3 = [$walk3, dem1_walk4] { ai_walk (6); F () };
+ void() dem1_walk4 = [$walk4, dem1_walk5] { ai_walk (7); F () };
+ void() dem1_walk5 = [$walk5, dem1_walk6] { ai_walk (4); F () };
+ void() dem1_walk6 = [$walk6, dem1_walk7] { ai_walk (6); F () };
+ void() dem1_walk7 = [$walk7, dem1_walk8] { ai_walk (10); F () };
+ void() dem1_walk8 = [$walk8, dem1_walk1] { ai_walk (10); F () };
//--------------------------------------------------------------
// Fiend run functions
@@ -305,82 +366,112 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() dem1_run1 = [$run1, dem1_run2]
{
if (random() < 0.2)
- sound_idle (self, CHAN_VOICE, "demon/idle1.wav",
+ sound (self, CHAN_VOICE, "demon/idle1.wav",
VOL_HIGH, ATTN_IDLE);
ai_run (20);
+ F ()
};
- void() dem1_run2 = [$run2, dem1_run3] { ai_run (15); };
- void() dem1_run3 = [$run3, dem1_run4] { ai_run (36); };
- void() dem1_run4 = [$run4, dem1_run5] { ai_run (20); };
- void() dem1_run5 = [$run5, dem1_run6] { ai_run (15); };
- void() dem1_run6 = [$run6, dem1_run1] { ai_run (36); };
+ void() dem1_run2 = [$run2, dem1_run3] { ai_run (15); F () };
+ void() dem1_run3 = [$run3, dem1_run4] { ai_run (36); F () };
+ void() dem1_run4 = [$run4, dem1_run5] { ai_run (20); F () };
+ void() dem1_run5 = [$run5, dem1_run6] { ai_run (15); F () };
+ void() dem1_run6 = [$run6, dem1_run1] { ai_run (36); F () };
//--------------------------------------------------------------
// Fiend jump functions
//--------------------------------------------------------------
- void() dem1_jump1 = [$leap1, dem1_jump2] { ai_face (); };
- void() dem1_jump2 = [$leap2, dem1_jump3] { ai_face (); };
- void() dem1_jump3 = [$leap3, dem1_jump4] { ai_face (); };
+ void() dem1_jump1 = [$leap1, dem1_jump2] { ai_face (); F () };
+ void() dem1_jump2 = [$leap2, dem1_jump3] { ai_face (); F () };
+ void() dem1_jump3 = [$leap3, dem1_jump4] { ai_face (); F () };
void() dem1_jump4 = [$leap4, dem1_jump5]
{
ai_face ();
// fix for instakill bug -- dumptruck_ds
- self.worldtype = 0;
+ self.pm_flags &= ~PMF_JUMP_HELD;
self.touch = monster_demon1_touch;
makevectors (self.angles);
self.origin_z = self.origin_z + 1;
self.velocity = v_forward * 600 + '0 0 250';
if (self.flags & FL_ONGROUND)
self.flags = self.flags - FL_ONGROUND;
+ FO ()
+ };
+ void() dem1_jump5 = [$leap5, dem1_jump6] { FO () };
+ void() dem1_jump6 = [$leap6, dem1_jump7] { FO () };
+ void() dem1_jump7 = [$leap7, dem1_jump8] { FO () };
+ void() dem1_jump8 = [$leap8, dem1_jump9] { FO () };
+ void() dem1_jump9 = [$leap9, dem1_jump10] { FO () };
+ void() dem1_jump10 = [$leap10, dem1_jump99]
+ {
+ // store jump1 as think1 so jump99 can call it after time + 3
+ self.think1 = dem1_jump1;
+ // TODO CEV using wait field to store a nextthink
+ self.wait = time + 3;
+ FO ()
+ // we'll go automatically to dem1_jump99 (so we can update
+ // origin on listening clients as this demon falls) -- CEV
};
- void() dem1_jump5 = [$leap5, dem1_jump6] {};
- void() dem1_jump6 = [$leap6, dem1_jump7] {};
- void() dem1_jump7 = [$leap7, dem1_jump8] {};
- void() dem1_jump8 = [$leap8, dem1_jump9] {};
- void() dem1_jump9 = [$leap9, dem1_jump10] {};
- void() dem1_jump10 = [$leap10, dem1_jump1]
+ void() dem1_jump11 = [$leap11, dem1_jump12] { F () };
+ void() dem1_jump12 = [$leap12, dem1_run1] { F () };
+ void() dem1_jump99 =
{
- // if three seconds pass, assume demon is stuck and jump again
- self.nextthink = time + 3;
+ // update origin on clients if entity is airborne -- CEV
+ if (!(self.flags & FL_ONGROUND))
+ if (!(self.SendFlags & NETFLAG_BASE_ENTITY_ORIGIN))
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN;
+
+ // should we revert back to think1? (dem1_jump1) -- CEV
+ if (self.think1 && self.wait > 0)
+ {
+ if (self.wait < time)
+ {
+ self.wait = 0;
+ self.think = self.think1;
+ self.think1 = __NULL__;
+ }
+ }
+
+ // think again in 0.1s -- CEV
+ self.nextthink = time + 0.1;
};
- void() dem1_jump11 = [$leap11, dem1_jump12] {};
- void() dem1_jump12 = [$leap12, dem1_run1] {};
//--------------------------------------------------------------
// Fiend attack functions
//--------------------------------------------------------------
- void() dem1_atk1 = [$attacka1, dem1_atk2] { ai_charge (4); };
- void() dem1_atk2 = [$attacka2, dem1_atk3] { ai_charge (0); };
- void() dem1_atk3 = [$attacka3, dem1_atk4] { ai_charge (0); };
- void() dem1_atk4 = [$attacka4, dem1_atk5] { ai_charge (1); };
+ void() dem1_atk1 = [$attacka1, dem1_atk2] { ai_charge (4); F () };
+ void() dem1_atk2 = [$attacka2, dem1_atk3] { ai_charge (0); F () };
+ void() dem1_atk3 = [$attacka3, dem1_atk4] { ai_charge (0); F () };
+ void() dem1_atk4 = [$attacka4, dem1_atk5] { ai_charge (1); F () };
void() dem1_atk5 = [$attacka5, dem1_atk6]
{
ai_charge (2);
monster_demon1_melee (200);
+ F ()
};
- void() dem1_atk6 = [$attacka6, dem1_atk7] { ai_charge (1); };
- void() dem1_atk7 = [$attacka7, dem1_atk8] { ai_charge (6); };
- void() dem1_atk8 = [$attacka8, dem1_atk9] { ai_charge (8); };
- void() dem1_atk9 = [$attacka9, dem1_atk10] { ai_charge (4); };
- void() dem1_atk10 = [$attacka10, dem1_atk11] { ai_charge (2); };
+ void() dem1_atk6 = [$attacka6, dem1_atk7] { ai_charge (1); F () };
+ void() dem1_atk7 = [$attacka7, dem1_atk8] { ai_charge (6); F () };
+ void() dem1_atk8 = [$attacka8, dem1_atk9] { ai_charge (8); F () };
+ void() dem1_atk9 = [$attacka9, dem1_atk10] { ai_charge (4); F () };
+ void() dem1_atk10 = [$attacka10, dem1_atk11] { ai_charge (2); F () };
void() dem1_atk11 = [$attacka11, dem1_atk12]
{
monster_demon1_melee (-200);
+ F ()
};
- void() dem1_atk12 = [$attacka12, dem1_atk13] { ai_charge (5); };
- void() dem1_atk13 = [$attacka13, dem1_atk14] { ai_charge (8); };
- void() dem1_atk14 = [$attacka14, dem1_atk15] { ai_charge (4); };
- void() dem1_atk15 = [$attacka15, dem1_run1] { ai_charge (4); };
+ void() dem1_atk12 = [$attacka12, dem1_atk13] { ai_charge (5); F () };
+ void() dem1_atk13 = [$attacka13, dem1_atk14] { ai_charge (8); F () };
+ void() dem1_atk14 = [$attacka14, dem1_atk15] { ai_charge (4); F () };
+ void() dem1_atk15 = [$attacka15, dem1_run1] { ai_charge (4); F () };
//--------------------------------------------------------------
// Fiend pain states
//--------------------------------------------------------------
- void() dem1_pain1 = [$pain1, dem1_pain2] { };
- void() dem1_pain2 = [$pain2, dem1_pain3] { };
- void() dem1_pain3 = [$pain3, dem1_pain4] { };
- void() dem1_pain4 = [$pain4, dem1_pain5] { };
- void() dem1_pain5 = [$pain5, dem1_pain6] { };
- void() dem1_pain6 = [$pain6, dem1_run1] { };
+ void() dem1_pain1 = [$pain1, dem1_pain2] { F () };
+ void() dem1_pain2 = [$pain2, dem1_pain3] { F () };
+ void() dem1_pain3 = [$pain3, dem1_pain4] { F () };
+ void() dem1_pain4 = [$pain4, dem1_pain5] { F () };
+ void() dem1_pain5 = [$pain5, dem1_pain6] { F () };
+ void() dem1_pain6 = [$pain6, dem1_run1] { F () };
//--------------------------------------------------------------
// Fiend death states
@@ -388,24 +479,37 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() dem1_die1 = [$death1, dem1_die2]
{
base_entity_aligntoground (self);
- sound_death (self, CHAN_VOICE, "demon/ddeath.wav",
+ sound (self, CHAN_VOICE, "demon/ddeath.wav",
VOL_HIGH, ATTN_NORM);
+ F ()
};
- void() dem1_die2 = [$death2, dem1_die3] { };
- void() dem1_die3 = [$death3, dem1_die4] { };
- void() dem1_die4 = [$death4, dem1_die5] { };
- void() dem1_die5 = [$death5, dem1_die6] { };
+ void() dem1_die2 = [$death2, dem1_die3] { F () };
+ void() dem1_die3 = [$death3, dem1_die4] { F () };
+ void() dem1_die4 = [$death4, dem1_die5] { F () };
+ void() dem1_die5 = [$death5, dem1_die6] { F () };
void() dem1_die6 = [$death6, dem1_die7]
{
self.solid = SOLID_NOT;
+ F ()
};
- void() dem1_die7 = [$death7, dem1_die8] { };
+ void() dem1_die7 = [$death7, dem1_die8] { F () };
void() dem1_die8 = [$death8, dem1_die9]
{
become_base_corpse (self, DEMON1_HEALTH_CORPSE);
setsize (self, DEMON1_CORPSE_Z_MINS, DEMON1_CORPSE_Z_MAXS);
+ F ()
};
- void() dem1_die9 = [$death9, dem1_die9] { };
+ void() dem1_die9 = [$death9, dem1_die9]
+ {
+ if (self.origin != self.origin_net)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_FRAME;
+ else if (self.frame_net != self.frame)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
+ };
+
+ #undef F
+ #undef FO
//==============================================================
// Interaction
@@ -421,7 +525,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
return;
self.pain_finished = time + 1;
- sound_pain (self, CHAN_VOICE, "demon/dpain1.wav",
+ sound (self, CHAN_VOICE, "demon/dpain1.wav",
VOL_HIGH, ATTN_NORM);
if (random() * 200 > damage)
@@ -434,54 +538,22 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//--------------------------------------------------------------
void(vector dir) monster_demon1_destroy =
{
- // check if we're dead already
- if (self.classgroup & CG_CORPSE)
- {
- sound (self, CHAN_VOICE, "player/udeath.wav",
- VOL_HIGH, ATTN_NORM);
-
- throw_gib_head_demon (self, dir, self.health);
-
- // TODO CEV this doesn't work *quite* right
- throw_gib_1 (self, dir, self.health);
-
- // custom models -- dumptruck_ds
- if (self.mdl_gib2 != "")
- throw_gib_2 (self, dir, self.health);
- else
- throw_gib_1 (self, dir, self.health);
-
- if (self.mdl_gib3 != "")
- throw_gib_3 (self, dir, self.health);
- else
- throw_gib_1 (self, dir, self.health);
-
- return;
- }
-
// check for gib
- if (self.health < -80)
+ if (self.classgroup & CG_CORPSE || self.health < -80)
{
sound (self, CHAN_VOICE, "player/udeath.wav",
VOL_HIGH, ATTN_NORM);
- throw_gib_head_demon (self, dir, self.health);
-
- // TODO CEV this doesn't work *quite* right
- throw_gib_1 (self, dir, self.health);
+ if (!(self.classgroup & CG_CORPSE))
+ base_item_drop_stuff (self);
- // custom models -- dumptruck_ds
- if (self.mdl_gib2 != "")
- throw_gib_2 (self, dir, self.health);
- else
- throw_gib_1 (self, dir, self.health);
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib1_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib1_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib1_init)
+ BASE_ITEM_GIB_THROW (dir, self.health,
+ item_head_demon_init)
- if (self.mdl_gib3 != "")
- throw_gib_3 (self, dir, self.health);
- else
- throw_gib_1 (self, dir, self.health);
-
- base_item_drop_stuff (self);
+ base_entity_remove (self);
return;
}
@@ -504,7 +576,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
{
if (vlen(self.velocity) > 400)
{
- if !(self.worldtype)
+ if (!(self.pm_flags & PMF_JUMP_HELD))
{
ldmg = 40 + 10 * random();
t_damage2 (other, self, self, ldmg);
@@ -512,7 +584,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
// Preach's instakill bug check
// - dumptruck_ds
if (other.health > 0)
- self.worldtype = 1;
+ self.pm_flags |= PMF_JUMP_HELD;
}
}
}
@@ -522,7 +594,6 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
if (self.flags & FL_ONGROUND)
{
// jump randomly to not get hung up
- // dprint ("popjump\n");
// 1998-09-16 Sliding/not-jumping on monsters/
// boxes/players fix by Maddes/Kryten start
self.touch = base_monster_touch;
@@ -530,11 +601,6 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
// boxes/players fix by Maddes/Kryten end
self.think = dem1_jump1;
self.nextthink = time + 0.1;
-
- // self.velocity_x = (random() - 0.5) * 600;
- // self.velocity_y = (random() - 0.5) * 600;
- // self.velocity_z = 200;
- // self.flags = self.flags - FL_ONGROUND;
}
// not on ground yet
return;
@@ -554,148 +620,101 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//==============================================================
//--------------------------------------------------------------
- entity(vector org, vector ang, float sflags, float yaw, float angry)
+ entity(vector org, vector ang, float sflags, float yaw)
spawn_monster_demon1 =
{
- return spawn_base_monster (org, ang, sflags, yaw, angry,
+ return spawn_base_monster (org, ang, sflags, yaw,
monster_demon1_init);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) monster_demon1_init =
{
- if (e.spawnflags & I_AM_TURRET)
- objerror ("Incompatible spawnflag: TURRET_MODE\n");
-
+ #ifdef SSQC
if (deathmatch)
{
remove (e);
return;
}
+ if (e.spawnflags & SPAWNFLAG_MONSTER_TURRET)
+ objerror ("Incompatible spawnflag: TURRET_MODE\n");
+ #endif
+
e.classname = "monster_demon1";
e.classtype = CT_MONSTER_FIEND;
+ e.pos1 = VEC_HULL2_MIN;
+ e.pos2 = VEC_HULL2_MAX;
- // dumptruck_ds custom_mdls
- precache_body_model (e, "progs/demon.mdl");
- precache_head_model (e, "progs/h_demon.mdl");
-
- precache_sound_death (e, "demon/ddeath.wav");
- precache_sound_hit (e, "demon/dhit2.wav");
- precache_sound_attack (e, "demon/djump.wav");
- precache_sound_pain (e, "demon/dpain1.wav");
- precache_sound_idle (e, "demon/idle1.wav");
- precache_sound_sight (e, "demon/sight2.wav");
-
- precache_gib1 (e, "progs/gib1.mdl");
- // precache_gib2 ("progs/gib2.mdl");
- // precache_gib3 ("progs/gib3.mdl");
+ #ifdef CSQC
+ if (e.modelindex)
+ {
+ setmodelindex (e, e.modelindex);
+ setsize (e, VEC_HULL2_MIN, VEC_HULL2_MAX);
+ }
+ #endif
- e.solid = SOLID_SLIDEBOX;
- e.movetype = MOVETYPE_STEP;
+ #ifdef SSQC
+ precache_model ("progs/demon.mdl");
+ precache_model ("progs/h_demon.mdl");
+ precache_model ("progs/gib1.mdl");
+ // precache_model ("progs/gib2.mdl");
+ // precache_model ("progs/gib3.mdl");
- body_model (e, "progs/demon.mdl");
- // setmodel (e, "progs/demon.mdl");
+ precache_sound ("demon/ddeath.wav");
+ precache_sound ("demon/dhit2.wav");
+ precache_sound ("demon/djump.wav");
+ precache_sound ("demon/dpain1.wav");
+ precache_sound ("demon/idle1.wav");
+ precache_sound ("demon/sight2.wav");
- setsize (e, VEC_HULL2_MIN, VEC_HULL2_MAX);
+ // set up model and size for later -- CEV
+ e.mdl = "progs/demon.mdl";
if (!e.health)
// thanks RennyC -- dumptruck_ds
e.health = DEMON1_HEALTH;
e.checkattack = monster_demon1_checkattack;
+ e.destroy = monster_demon1_destroy;
e.sightsound = monster_demon1_sightsound;
e.th_stand = dem1_stand1;
e.th_walk = dem1_walk1;
e.th_run = dem1_run1;
- // two attacks: melee, jump
- // e.th_melee = Demon_MeleeAttack;
e.th_melee = dem1_atk1;
e.th_missile = dem1_jump1;
- // Berserk test from
- // http://celephais.net/board/view_thread.php?id=4&start=3465
- // -- dumptruck_ds
- if !(e.berserk)
- e.th_pain = monster_demon1_pain;
- else
+ // changed berserk test from field to flag -- CEV
+ if (self.spawnflags & SPAWNFLAG_MONSTER_BERSERK)
e.th_pain = sub_nullpain;
+ else
+ e.th_pain = monster_demon1_pain;
+ #endif
- e.destroy = monster_demon1_destroy;
-
- // walkmonster_start
- base_walkmonster_init (e);
+ // InitMonster -- runs on both client & server -- CEV
+ base_monster_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() monster_demon1 =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags & fields, inhibit if necessary -- CEV
+ BASE_MONSTER_PREINIT (base_monster_init_field)
monster_demon1_init (self);
};
+#endif
// };
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-/*QUAKED gib_head_demon (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/h_demon.mdl");
-}
-*/
-//----------------------------------------------------------------------
-// class gib_head_demon: base_gib_head
-// {
- //--------------------------------------------------------------
- // ThrowHead
- //--------------------------------------------------------------
- void(entity act, vector dir, float dmg) throw_gib_head_demon =
- {
- base_gib_head_throw (act, dir, dmg, gib_head_demon_init);
- };
-
- //--------------------------------------------------------------
- void(entity e) gib_head_demon_init =
- {
- e.classname = "gib_head_demon";
- e.classtype = CT_GORE_HEAD_DEMON;
-
- // gib_init interprets spawnflags and will set .solid -- CEV
- base_gib_head_init (e);
-
- if (e.mdl_head != "")
- {
- precache_model (e.mdl_head);
- setmodel (e, e.mdl_head);
- }
- else
- {
- precache_model ("progs/h_demon.mdl");
- setmodel (e, "progs/h_demon.mdl");
- if (e.solid == SOLID_BBOX)
- setsize (e, DEMON1_HEAD_MINS, DEMON1_HEAD_MAXS);
- else if (e.solid == SOLID_TRIGGER)
- setsize (e, '-16 -16 0', '16 16 56');
- }
-
- e.frame = 0;
- };
-
- //--------------------------------------------------------------
- void() gib_head_demon =
- {
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- gib_head_demon_init (self);
- };
-// };
-
+#ifdef SSQC
/*QUAKED monster_dead_demon (0 0.5 0.8) (-32 -32 -24) (32 32 64) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ({"path":"progs/demon.mdl","frame":53});
@@ -728,3 +747,8 @@ model ("progs/h_demon.mdl");
monster_dead_demon_init (self);
};
// };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+$flush
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/monsters/dog.qc
diff --git a/qc/monsters/dog.qc b/qc/monsters/dog.qc
index 8c11199..bde7715 100644
--- a/qc/monsters/dog.qc
+++ b/qc/monsters/dog.qc
@@ -6,26 +6,35 @@
// constants
//======================================================================
+#ifdef SSQC
const float DOG_HEALTH = 25; // id1 25
const float DOG_HEALTH_CORPSE = 20;
+#endif
-const vector DOG_HEAD_MINS = '-9.66 -11.89 -0.2';
-const vector DOG_HEAD_MAXS = '6.57 7.96 13.29';
+#if defined(CSQC) || defined(SSQC)
+const vector DOG_MINS = '-32 -32 -24';
+const vector DOG_MAXS = '32 32 40';
const vector DOG_CORPSE_MINS = '-24.51 -16.5 -50.37';
const vector DOG_CORPSE_MAXS = '28.2 13.81 30';
const vector DOG_CORPSE_Z_MINS = '-16 -16 -24'; // thin 32x32 box on ground
const vector DOG_CORPSE_Z_MAXS = '16 16 -8';
+#endif
//======================================================================
// forward declarations
//======================================================================
// monster_dog
+#ifdef CSQC
+void(float isnew) monster_dog_netreceive;
+#endif
+#ifdef SSQC
// float() monster_dog_checkmelee; // attacks, alert sound
float() monster_dog_checkjump;
float() monster_dog_checkattack;
void() monster_dog_sightsound;
void() monster_dog_bite;
+// F()
void() dog_stand1; void() dog_stand2; // thinking & animation states
void() dog_stand3; void() dog_stand4; void() dog_stand5; void() dog_stand6;
void() dog_stand7; void() dog_stand8; void() dog_stand9;
@@ -54,24 +63,27 @@ void() dog_dieb9;
void(entity attacker, float damage) monster_dog_pain; // interaction
void(vector dir) monster_dog_destroy;
void() monster_dog_touch_jump;
-entity(vector org, vector ang, float sflags, float yaw, float angry)
+entity(vector org, vector ang, float sflags, float yaw)
spawn_monster_dog; // initialization
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) monster_dog_init;
+#endif
+#ifdef SSQC
void() monster_dog;
+#endif
-// gib_head_dog
-void(entity act, vector dir, float dmg) throw_gib_head_dog;
-void(entity e) gib_head_dog_init;
-void() gib_head_dog;
-
+#ifdef SSQC
// monster_dead_dog
void(entity e) monster_dead_dog_init;
void() monster_dead_dog;
+#endif
//======================================================================
// frame macros
//======================================================================
+#if defined(CSQC) || defined(SSQC)
$cd id1/models/dog
$origin 0 0 24
$base base
@@ -97,6 +109,11 @@ $frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9
$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8
+// MG1 compat -- CEV
+const float CORPSEFRAME_DOG_1 = $death9;
+const float CORPSEFRAME_DOG_2 = $deathb9;
+#endif
+
//------------------------------------------------------------------------------
/*QUAKED monster_dog (1 0 0) (-32 -32 -24) (32 32 40) AMBUSH X X TRIGGER_SPAWNED X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
@@ -157,8 +174,32 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
*/
//----------------------------------------------------------------------
-// class monster_dog: base_walkmonster
+// class monster_dog: base_monster
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) monster_dog_netreceive =
+ {
+ // creates the newframe and netflags variables -- CEV
+ BASE_MONSTER_NETRECEIVE (monster_dog_init, DOG_MINS, DOG_MAXS)
+
+ if (isnew)
+ base_entity_que_add (self, QUE_TYPE_ACTOR);
+
+ if (self.frame >= $death1 && self.frame <= $death9)
+ {
+ if (self.solid != SOLID_NOT)
+ self.solid = SOLID_NOT;
+ }
+ else if (self.frame >= $deathb1 && self.frame <= $deathb9)
+ {
+ if (self.solid != SOLID_NOT)
+ self.solid = SOLID_NOT;
+ }
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
// CheckDogMelee
// Returns TRUE if a melee attack would hit right now
@@ -238,7 +279,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() monster_dog_sightsound =
{
// dumptruck_ds
- sound_sight (self, CHAN_VOICE, "dog/dsight.wav",
+ sound (self, CHAN_VOICE, "dog/dsight.wav",
VOL_HIGH, ATTN_NORM);
};
@@ -268,17 +309,26 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
};
//--------------------------------------------------------------
+ #define F() \
+ /* { */ \
+ if (!(self.SendFlags & NETFLAG_BASE_ENTITY_FRAME)) \
+ { \
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME; \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
// Dog standing state
//--------------------------------------------------------------
- void() dog_stand1 = [$stand1, dog_stand2] { ai_stand (); };
- void() dog_stand2 = [$stand2, dog_stand3] { ai_stand (); };
- void() dog_stand3 = [$stand3, dog_stand4] { ai_stand (); };
- void() dog_stand4 = [$stand4, dog_stand5] { ai_stand (); };
- void() dog_stand5 = [$stand5, dog_stand6] { ai_stand (); };
- void() dog_stand6 = [$stand6, dog_stand7] { ai_stand (); };
- void() dog_stand7 = [$stand7, dog_stand8] { ai_stand (); };
- void() dog_stand8 = [$stand8, dog_stand9] { ai_stand (); };
- void() dog_stand9 = [$stand9, dog_stand1] { ai_stand (); };
+ void() dog_stand1 = [$stand1, dog_stand2] { ai_stand (); F () };
+ void() dog_stand2 = [$stand2, dog_stand3] { ai_stand (); F () };
+ void() dog_stand3 = [$stand3, dog_stand4] { ai_stand (); F () };
+ void() dog_stand4 = [$stand4, dog_stand5] { ai_stand (); F () };
+ void() dog_stand5 = [$stand5, dog_stand6] { ai_stand (); F () };
+ void() dog_stand6 = [$stand6, dog_stand7] { ai_stand (); F () };
+ void() dog_stand7 = [$stand7, dog_stand8] { ai_stand (); F () };
+ void() dog_stand8 = [$stand8, dog_stand9] { ai_stand (); F () };
+ void() dog_stand9 = [$stand9, dog_stand1] { ai_stand (); F () };
//--------------------------------------------------------------
// Dog walking state
@@ -287,17 +337,18 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
{
if (random() < 0.2)
// dumptruck_ds
- sound_idle (self, CHAN_VOICE, "dog/idle.wav",
+ sound (self, CHAN_VOICE, "dog/idle.wav",
VOL_HIGH, ATTN_IDLE);
ai_walk (8);
+ F ()
};
- void() dog_walk2 = [$walk2, dog_walk3] { ai_walk (8); };
- void() dog_walk3 = [$walk3, dog_walk4] { ai_walk (8); };
- void() dog_walk4 = [$walk4, dog_walk5] { ai_walk (8); };
- void() dog_walk5 = [$walk5, dog_walk6] { ai_walk (8); };
- void() dog_walk6 = [$walk6, dog_walk7] { ai_walk (8); };
- void() dog_walk7 = [$walk7, dog_walk8] { ai_walk (8); };
- void() dog_walk8 = [$walk8, dog_walk1] { ai_walk (8); };
+ void() dog_walk2 = [$walk2, dog_walk3] { ai_walk (8); F () };
+ void() dog_walk3 = [$walk3, dog_walk4] { ai_walk (8); F () };
+ void() dog_walk4 = [$walk4, dog_walk5] { ai_walk (8); F () };
+ void() dog_walk5 = [$walk5, dog_walk6] { ai_walk (8); F () };
+ void() dog_walk6 = [$walk6, dog_walk7] { ai_walk (8); F () };
+ void() dog_walk7 = [$walk7, dog_walk8] { ai_walk (8); F () };
+ void() dog_walk8 = [$walk8, dog_walk1] { ai_walk (8); F () };
//--------------------------------------------------------------
// Dog running state
@@ -306,93 +357,96 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
{
if (random() < 0.2)
// dumptruck_ds
- sound_idle (self, CHAN_VOICE, "dog/idle.wav",
+ sound (self, CHAN_VOICE, "dog/idle.wav",
VOL_HIGH, ATTN_IDLE);
ai_run (16);
+ F ()
};
- void() dog_run2 = [$run2, dog_run3] { ai_run (32); };
- void() dog_run3 = [$run3, dog_run4] { ai_run (32); };
- void() dog_run4 = [$run4, dog_run5] { ai_run (20); };
- void() dog_run5 = [$run5, dog_run6] { ai_run (64); };
- void() dog_run6 = [$run6, dog_run7] { ai_run (32); };
- void() dog_run7 = [$run7, dog_run8] { ai_run (16); };
- void() dog_run8 = [$run8, dog_run9] { ai_run (32); };
- void() dog_run9 = [$run9, dog_run10] { ai_run (32); };
- void() dog_run10 = [$run10, dog_run11] { ai_run (20); };
- void() dog_run11 = [$run11, dog_run12] { ai_run (64); };
- void() dog_run12 = [$run12, dog_run1] { ai_run (32); };
+ void() dog_run2 = [$run2, dog_run3] { ai_run (32); F () };
+ void() dog_run3 = [$run3, dog_run4] { ai_run (32); F () };
+ void() dog_run4 = [$run4, dog_run5] { ai_run (20); F () };
+ void() dog_run5 = [$run5, dog_run6] { ai_run (64); F () };
+ void() dog_run6 = [$run6, dog_run7] { ai_run (32); F () };
+ void() dog_run7 = [$run7, dog_run8] { ai_run (16); F () };
+ void() dog_run8 = [$run8, dog_run9] { ai_run (32); F () };
+ void() dog_run9 = [$run9, dog_run10] { ai_run (32); F () };
+ void() dog_run10 = [$run10, dog_run11] { ai_run (20); F () };
+ void() dog_run11 = [$run11, dog_run12] { ai_run (64); F () };
+ void() dog_run12 = [$run12, dog_run1] { ai_run (32); F () };
//--------------------------------------------------------------
// Dog attack state
//--------------------------------------------------------------
- void() dog_atta1 = [$attack1, dog_atta2] { ai_charge (10); };
- void() dog_atta2 = [$attack2, dog_atta3] { ai_charge (10); };
- void() dog_atta3 = [$attack3, dog_atta4] { ai_charge (10); };
+ void() dog_atta1 = [$attack1, dog_atta2] { ai_charge (10); F () };
+ void() dog_atta2 = [$attack2, dog_atta3] { ai_charge (10); F () };
+ void() dog_atta3 = [$attack3, dog_atta4] { ai_charge (10); F () };
void() dog_atta4 = [$attack4, dog_atta5]
{
// dumptruck_ds
- sound_attack (self, CHAN_VOICE, "dog/dattack1.wav",
+ sound (self, CHAN_VOICE, "dog/dattack1.wav",
VOL_HIGH, ATTN_NORM);
monster_dog_bite ();
+ F ()
};
- void() dog_atta5 = [$attack5, dog_atta6] { ai_charge (10); };
- void() dog_atta6 = [$attack6, dog_atta7] { ai_charge (10); };
- void() dog_atta7 = [$attack7, dog_atta8] { ai_charge (10); };
- void() dog_atta8 = [$attack8, dog_run1] { ai_charge (10); };
+ void() dog_atta5 = [$attack5, dog_atta6] { ai_charge (10); F () };
+ void() dog_atta6 = [$attack6, dog_atta7] { ai_charge (10); F () };
+ void() dog_atta7 = [$attack7, dog_atta8] { ai_charge (10); F () };
+ void() dog_atta8 = [$attack8, dog_run1] { ai_charge (10); F () };
//--------------------------------------------------------------
// Dog jumping (leaping) state
//--------------------------------------------------------------
- void() dog_leap1 = [$leap1, dog_leap2] { ai_face (); };
+ void() dog_leap1 = [$leap1, dog_leap2] { ai_face (); F () };
void() dog_leap2 = [$leap2, dog_leap3]
{
ai_face ();
// fix for instakill bug -- dumptruck_ds
- self.worldtype = 0;
+ self.pm_flags &= ~PMF_JUMP_HELD;
self.touch = monster_dog_touch_jump;
makevectors (self.angles);
self.origin_z = self.origin_z + 1;
self.velocity = v_forward * 300 + '0 0 200';
if (self.flags & FL_ONGROUND)
self.flags = self.flags - FL_ONGROUND;
+ F ()
};
- void() dog_leap3 = [$leap3, dog_leap4] { };
- void() dog_leap4 = [$leap4, dog_leap5] { };
- void() dog_leap5 = [$leap5, dog_leap6] { };
- void() dog_leap6 = [$leap6, dog_leap7] { };
- void() dog_leap7 = [$leap7, dog_leap8] { };
- void() dog_leap8 = [$leap8, dog_leap9] { };
- void() dog_leap9 = [$leap9, dog_leap9] { };
+ void() dog_leap3 = [$leap3, dog_leap4] { F () };
+ void() dog_leap4 = [$leap4, dog_leap5] { F () };
+ void() dog_leap5 = [$leap5, dog_leap6] { F () };
+ void() dog_leap6 = [$leap6, dog_leap7] { F () };
+ void() dog_leap7 = [$leap7, dog_leap8] { F () };
+ void() dog_leap8 = [$leap8, dog_leap9] { F () };
+ void() dog_leap9 = [$leap9, dog_leap9] { F () };
//--------------------------------------------------------------
// Dog pain state A
//--------------------------------------------------------------
- void() dog_pain1 = [$pain1, dog_pain2] { };
- void() dog_pain2 = [$pain2, dog_pain3] { };
- void() dog_pain3 = [$pain3, dog_pain4] { };
- void() dog_pain4 = [$pain4, dog_pain5] { };
- void() dog_pain5 = [$pain5, dog_pain6] { };
- void() dog_pain6 = [$pain6, dog_run1] { };
+ void() dog_pain1 = [$pain1, dog_pain2] { F () };
+ void() dog_pain2 = [$pain2, dog_pain3] { F () };
+ void() dog_pain3 = [$pain3, dog_pain4] { F () };
+ void() dog_pain4 = [$pain4, dog_pain5] { F () };
+ void() dog_pain5 = [$pain5, dog_pain6] { F () };
+ void() dog_pain6 = [$pain6, dog_run1] { F () };
//--------------------------------------------------------------
// Dog pain state B
//--------------------------------------------------------------
- void() dog_painb1 = [$painb1, dog_painb2] { };
- void() dog_painb2 = [$painb2, dog_painb3] { };
- void() dog_painb3 = [$painb3, dog_painb4] { ai_pain (4); };
- void() dog_painb4 = [$painb4, dog_painb5] { ai_pain (12); };
- void() dog_painb5 = [$painb5, dog_painb6] { ai_pain (12); };
- void() dog_painb6 = [$painb6, dog_painb7] { ai_pain (2); };
- void() dog_painb7 = [$painb7, dog_painb8] { };
- void() dog_painb8 = [$painb8, dog_painb9] { ai_pain (4); };
- void() dog_painb9 = [$painb9, dog_painb10] { };
- void() dog_painb10 = [$painb10, dog_painb11] { ai_pain (10); };
- void() dog_painb11 = [$painb11, dog_painb12] { };
- void() dog_painb12 = [$painb12, dog_painb13] { };
- void() dog_painb13 = [$painb13, dog_painb14] { };
- void() dog_painb14 = [$painb14, dog_painb15] { };
- void() dog_painb15 = [$painb15, dog_painb16] { };
- void() dog_painb16 = [$painb16, dog_run1] { };
+ void() dog_painb1 = [$painb1, dog_painb2] { F () };
+ void() dog_painb2 = [$painb2, dog_painb3] { F () };
+ void() dog_painb3 = [$painb3, dog_painb4] { ai_pain (4); F () };
+ void() dog_painb4 = [$painb4, dog_painb5] { ai_pain (12); F () };
+ void() dog_painb5 = [$painb5, dog_painb6] { ai_pain (12); F () };
+ void() dog_painb6 = [$painb6, dog_painb7] { ai_pain (2); F () };
+ void() dog_painb7 = [$painb7, dog_painb8] { F () };
+ void() dog_painb8 = [$painb8, dog_painb9] { ai_pain (4); F () };
+ void() dog_painb9 = [$painb9, dog_painb10] { F () };
+ void() dog_painb10 = [$painb10, dog_painb11] { ai_pain (10); F () };
+ void() dog_painb11 = [$painb11, dog_painb12] { F () };
+ void() dog_painb12 = [$painb12, dog_painb13] { F () };
+ void() dog_painb13 = [$painb13, dog_painb14] { F () };
+ void() dog_painb14 = [$painb14, dog_painb15] { F () };
+ void() dog_painb15 = [$painb15, dog_painb16] { F () };
+ void() dog_painb16 = [$painb16, dog_run1] { F () };
//--------------------------------------------------------------
// Dog death state A
@@ -400,19 +454,28 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() dog_die1 = [$death1, dog_die2]
{
base_entity_aligntoground (self);
+ F ()
};
- void() dog_die2 = [$death2, dog_die3] { };
- void() dog_die3 = [$death3, dog_die4] { };
- void() dog_die4 = [$death4, dog_die5] { };
- void() dog_die5 = [$death5, dog_die6] { };
- void() dog_die6 = [$death6, dog_die7] { };
- void() dog_die7 = [$death7, dog_die8] { };
+ void() dog_die2 = [$death2, dog_die3] { F () };
+ void() dog_die3 = [$death3, dog_die4] { F () };
+ void() dog_die4 = [$death4, dog_die5] { F () };
+ void() dog_die5 = [$death5, dog_die6] { F () };
+ void() dog_die6 = [$death6, dog_die7] { F () };
+ void() dog_die7 = [$death7, dog_die8] { F () };
void() dog_die8 = [$death8, dog_die9]
{
become_base_corpse (self, DOG_HEALTH_CORPSE);
setsize (self, DOG_CORPSE_Z_MINS, DOG_CORPSE_Z_MAXS);
+ F ()
+ };
+ void() dog_die9 = [$death9, dog_die9]
+ {
+ if (self.origin != self.origin_net)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_FRAME;
+ else if (self.frame_net != self.frame)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
};
- void() dog_die9 = [$death9, dog_die9] { };
//--------------------------------------------------------------
// Dog death state B
@@ -420,19 +483,30 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() dog_dieb1 = [$deathb1, dog_dieb2]
{
base_entity_aligntoground (self);
+ F ()
};
- void() dog_dieb2 = [$deathb2, dog_dieb3] { };
- void() dog_dieb3 = [$deathb3, dog_dieb4] { };
- void() dog_dieb4 = [$deathb4, dog_dieb5] { };
- void() dog_dieb5 = [$deathb5, dog_dieb6] { };
- void() dog_dieb6 = [$deathb6, dog_dieb7] { };
- void() dog_dieb7 = [$deathb7, dog_dieb8] { };
+ void() dog_dieb2 = [$deathb2, dog_dieb3] { F () };
+ void() dog_dieb3 = [$deathb3, dog_dieb4] { F () };
+ void() dog_dieb4 = [$deathb4, dog_dieb5] { F () };
+ void() dog_dieb5 = [$deathb5, dog_dieb6] { F () };
+ void() dog_dieb6 = [$deathb6, dog_dieb7] { F () };
+ void() dog_dieb7 = [$deathb7, dog_dieb8] { F () };
void() dog_dieb8 = [$deathb8, dog_dieb9]
{
become_base_corpse (self, DOG_HEALTH_CORPSE);
setsize (self, DOG_CORPSE_Z_MINS, DOG_CORPSE_Z_MAXS);
+ F ()
};
- void() dog_dieb9 = [$deathb9, dog_dieb9] { };
+ void() dog_dieb9 = [$deathb9, dog_dieb9]
+ {
+ if (self.origin != self.origin_net)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_FRAME;
+ else if (self.frame_net != self.frame)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
+ };
+
+ #undef F
//==============================================================
// Interaction
@@ -442,7 +516,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void(entity attacker, float damage) monster_dog_pain =
{
// dumptruck_ds
- sound_pain (self, CHAN_VOICE, "dog/dpain1.wav",
+ sound (self, CHAN_VOICE, "dog/dpain1.wav",
VOL_HIGH, ATTN_NORM);
if (random() > 0.5)
@@ -454,65 +528,28 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//--------------------------------------------------------------
void(vector dir) monster_dog_destroy =
{
- // check if we're dead already
- if (self.classgroup & CG_CORPSE)
- {
- sound (self, CHAN_VOICE, "player/udeath.wav",
- VOL_HIGH, ATTN_NORM);
-
- // custom models -- dumptruck_ds
- if (self.mdl_gib1 != "")
- throw_gib_1 (self, dir, self.health);
- else
- throw_gib_3 (self, dir, self.health);
-
- if (self.mdl_gib2 != "")
- throw_gib_2 (self, dir, self.health);
- else
- throw_gib_3 (self, dir, self.health);
-
- if (self.mdl_gib3 != "")
- throw_gib_3 (self, dir, self.health);
- else
- throw_gib_3 (self, dir, self.health);
-
- throw_gib_head_dog (self, dir, self.health);
-
- return;
- }
-
// check for gib
- if (self.health < -35)
+ if (self.classgroup & CG_CORPSE || self.health < -35)
{
sound (self, CHAN_VOICE, "player/udeath.wav",
VOL_HIGH, ATTN_NORM);
- // custom models -- dumptruck_ds
- if (self.mdl_gib1 != "")
- throw_gib_1 (self, dir, self.health);
- else
- throw_gib_3 (self, dir, self.health);
-
- if (self.mdl_gib2 != "")
- throw_gib_2 (self, dir, self.health);
- else
- throw_gib_3 (self, dir, self.health);
+ if (!(self.classgroup & CG_CORPSE))
+ base_item_drop_stuff (self);
- if (self.mdl_gib3 != "")
- throw_gib_3 (self, dir, self.health);
- else
- throw_gib_3 (self, dir, self.health);
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib3_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib3_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib3_init)
+ BASE_ITEM_GIB_THROW (dir, self.health,
+ item_head_dog_init)
- throw_gib_head_dog (self, dir, self.health);
-
- base_item_drop_stuff (self);
+ base_entity_remove (self);
return;
}
// regular death
// dumptruck_ds
- sound_death (self, CHAN_VOICE, "dog/ddeath.wav",
- VOL_HIGH, ATTN_NORM);
+ sound (self, CHAN_VOICE, "dog/ddeath.wav", VOL_HIGH, ATTN_NORM);
self.solid = SOLID_NOT;
base_item_drop_stuff (self);
@@ -536,15 +573,15 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
{
if (vlen(self.velocity) > 300)
{
- if !(self.worldtype)
+ if (!(self.pm_flags & PMF_JUMP_HELD))
{
ldmg = 10 + 10 * random();
t_damage2 (other, self, self, ldmg);
+ // is the player still alive?
+ // Preach's instakill bug check
+ // - dumptruck_ds
if (other.health > 0)
- // is the player still alive?
- // Preach's instakill bug check
- // - dumptruck_ds
- self.worldtype = 1;
+ self.pm_flags |= PMF_JUMP_HELD;
}
}
}
@@ -586,58 +623,65 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//==============================================================
//--------------------------------------------------------------
- entity(vector org, vector ang, float sflags, float yaw, float angry)
+ entity(vector org, vector ang, float sflags, float yaw)
spawn_monster_dog =
{
- return spawn_base_monster (org, ang, sflags, yaw, angry,
+ return spawn_base_monster (org, ang, sflags, yaw,
monster_dog_init);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) monster_dog_init =
{
- if (e.spawnflags & I_AM_TURRET)
- objerror ("monster_dog_init: "
- "incompatible spawnflag: TURRET_MODE\n");
-
+ #ifdef SSQC
if (deathmatch)
{
remove (e);
return;
}
+ if (e.spawnflags & SPAWNFLAG_MONSTER_TURRET)
+ objerror ("monster_dog_init: "
+ "incompatible spawnflag: TURRET_MODE\n");
+ #endif
+
e.classname = "monster_dog";
e.classtype = CT_MONSTER_DOG;
+ e.pos1 = DOG_MINS;
+ e.pos2 = DOG_MAXS;
- // dumptruck_ds -- model_custom and sounds changes
- precache_head_model (e, "progs/h_dog.mdl");
- precache_body_model (e, "progs/dog.mdl");
- precache_sound_attack (e, "dog/dattack1.wav");
- precache_sound_death (e, "dog/ddeath.wav");
- precache_sound_pain (e, "dog/dpain1.wav");
- precache_sound_sight (e, "dog/dsight.wav");
- precache_sound_idle (e, "dog/idle.wav");
-
- precache_gib1 (e, "progs/gib1.mdl");
- precache_gib2 (e, "progs/gib2.mdl");
- precache_gib3 (e, "progs/gib3.mdl");
-
- // dumptruck_ds
+ #ifdef CSQC
+ if (e.modelindex)
+ {
+ setmodelindex (e, e.modelindex);
+ setsize (e, DOG_MINS, DOG_MAXS);
+ }
+ #endif
- e.solid = SOLID_SLIDEBOX;
- e.movetype = MOVETYPE_STEP;
+ #ifdef SSQC
+ precache_model ("progs/h_dog.mdl");
+ precache_model ("progs/dog.mdl");
+ precache_sound ("dog/dattack1.wav");
+ precache_sound ("dog/ddeath.wav");
+ precache_sound ("dog/dpain1.wav");
+ precache_sound ("dog/dsight.wav");
+ precache_sound ("dog/idle.wav");
- // dumptruck_ds
- body_model (e, "progs/dog.mdl");
- // setmodel (e, "progs/dog.mdl");
+ precache_model ("progs/gib1.mdl");
+ precache_model ("progs/gib2.mdl");
+ precache_model ("progs/gib3.mdl");
- setsize (e, '-32 -32 -24', '32 32 40');
+ // set up model and size for later -- CEV
+ e.mdl = "progs/dog.mdl";
if (!e.health)
- //thanks RennyC -- dumptruck_ds
+ // thanks RennyC -- dumptruck_ds
e.health = DOG_HEALTH;
e.checkattack = monster_dog_checkattack;
+ e.destroy = monster_dog_destroy;
e.sightsound = monster_dog_sightsound;
e.th_stand = dog_stand1;
e.th_walk = dog_walk1;
@@ -645,88 +689,35 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
e.th_melee = dog_atta1;
e.th_missile = dog_leap1;
- // Berserk test from
- // http://celephais.net/board/view_thread.php?id=4&start=3465
- // -- dumptruck_ds
- if !(e.berserk)
- e.th_pain = monster_dog_pain;
- else
+ // changed berserk test from field to flag -- CEV
+ if (self.spawnflags & SPAWNFLAG_MONSTER_BERSERK)
e.th_pain = sub_nullpain;
- e.destroy = monster_dog_destroy;
+ else
+ e.th_pain = monster_dog_pain;
+ #endif
- // walkmonster_start
- base_walkmonster_init (e);
+ // InitMonster -- runs on both client & server -- CEV
+ base_monster_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() monster_dog =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags & fields, inhibit if necessary -- CEV
+ BASE_MONSTER_PREINIT (base_monster_init_field)
monster_dog_init (self);
};
+#endif
// };
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-/*QUAKED gib_head_dog (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/h_dog.mdl");
-}
-*/
-//----------------------------------------------------------------------
-// class gib_head_dog: base_gib_head
-// {
- //--------------------------------------------------------------
- // ThrowHead
- //--------------------------------------------------------------
- void(entity act, vector dir, float dmg) throw_gib_head_dog =
- {
- base_gib_head_throw (act, dir, dmg, gib_head_dog_init);
- };
-
- //--------------------------------------------------------------
- void(entity e) gib_head_dog_init =
- {
- e.classname = "gib_head_dog";
- e.classtype = CT_GORE_HEAD_DOG;
-
- // gib_init interprets spawnflags and will set .solid -- CEV
- base_gib_head_init (e);
-
- if (e.mdl_head != "")
- {
- precache_model (e.mdl_head);
- setmodel (e, e.mdl_head);
- }
- else
- {
- precache_model ("progs/h_dog.mdl");
- setmodel (e, "progs/h_dog.mdl");
- if (e.solid == SOLID_BBOX)
- setsize (e, DOG_HEAD_MINS, DOG_HEAD_MAXS);
- else if (e.solid == SOLID_TRIGGER)
- setsize (e, '-16 -16 0', '16 16 56');
- }
-
- e.frame = 0; // was 1 -- dumptruck_ds
- };
-
- //--------------------------------------------------------------
- void() gib_head_dog =
- {
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- gib_head_dog_init (self);
- };
-// };
-
+#ifdef SSQC
/*QUAKED monster_dead_dog (0 0.5 0.8) (-32 -32 -24) (32 32 64) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ({"path":"progs/dog.mdl","frame":16});
@@ -743,10 +734,23 @@ model ("progs/h_dog.mdl");
precache_model ("progs/dog.mdl");
setmodel (e, "progs/dog.mdl");
- e.frame = $death8;
+ if (e.spawnflags & 2)
+ {
+ // MG1 compat -- CEV
+ e.frame = $death9;
+ }
+ else if (e.spawnflags & 4)
+ {
+ // MG1 compat -- CEV
+ e.frame = $deathb9;
+ }
+ else
+ {
+ e.frame = $death8;
- if (e.solid == SOLID_BBOX)
- setsize (e, DOG_CORPSE_MINS, DOG_CORPSE_MAXS);
+ if (e.solid == SOLID_BBOX)
+ setsize (e, DOG_CORPSE_MINS, DOG_CORPSE_MAXS);
+ }
};
//--------------------------------------------------------------
@@ -759,3 +763,8 @@ model ("progs/h_dog.mdl");
monster_dead_dog_init (self);
};
// };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+$flush
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/monsters/enforcer.qc
diff --git a/qc/monsters/enforcer.qc b/qc/monsters/enforcer.qc
index 8a49545..fbaf94e 100644
--- a/qc/monsters/enforcer.qc
+++ b/qc/monsters/enforcer.qc
@@ -6,26 +6,35 @@
// constants
//======================================================================
+#ifdef SSQC
const float ENFORCER_HEALTH = 80; // id1 80
const float ENFORCER_HEALTH_CORPSE = 40;
+#endif
-const vector ENFORCER_HEAD_MINS = '-10.63 -10.23 -0.05';
-const vector ENFORCER_HEAD_MAXS = '9.27 8.25 30';
+#if defined(CSQC) || defined(SSQC)
+const vector ENFORCER_MINS = '-16 -16 -24';
+const vector ENFORCER_MAXS = '16 16 40';
const vector ENFORCER_CORPSE_MINS = '-39.85 -29.35 -49.07';
const vector ENFORCER_CORPSE_MAXS = '20.52 33.17 30';
const vector ENFORCER_CORPSE_F_MINS = '-41.16 -45.65 -51.95';
const vector ENFORCER_CORPSE_F_MAXS = '21.45 25.49 30';
const vector ENFORCER_CORPSE_Z_MINS = '-16 -16 -24'; // thin 32sq box on ground
const vector ENFORCER_CORPSE_Z_MAXS = '16 16 -8';
+#endif
//======================================================================
// forward declarations
//======================================================================
// monster_enforcer
+#ifdef CSQC
+void(float isnew) monster_enforcer_netreceive;
+#endif
+#ifdef SSQC
void() monster_enforcer_sightsound; // AI & attacks
void() monster_enforcer_attack_lightning;
void() monster_enforcer_attack; // animation & thinking below
+// F() // macro to set FRAME netflag -- CEV
void() enf_stand1; void() enf_stand2; void() enf_stand3; void() enf_stand4;
void() enf_stand5; void() enf_stand6; void() enf_stand7;
void() enf_walk1; void() enf_walk2; void() enf_walk3; void() enf_walk4;
@@ -81,23 +90,27 @@ void() enf_dief5; void() enf_dief6; void() enf_dief7; void() enf_dief8;
void() enf_dief9; void() enf_dief10; void() enf_dief11;
void(entity attacker, float damage) monster_enforcer_pain; // interaction
void(vector dir) monster_enforcer_destroy;
-entity(vector org, vector ang, float sflags, float yaw, float angry)
+entity(vector org, vector ang, float sflags, float yaw)
spawn_monster_enforcer; // initialization
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) monster_enforcer_init;
+#endif
+#ifdef SSQC
void() monster_enforcer;
+#endif
-// gib_head_enforcer
-void(entity act, vector dir, float dmg) throw_gib_head_enforcer;
-void(entity e) gib_head_enforcer_init;
-void() gib_head_enforcer;
-
+#ifdef SSQC
// monster_dead_enforcer
void(entity e) monster_dead_enforcer_init;
void() monster_dead_enforcer;
+#endif
//======================================================================
// frame macros
//======================================================================
+
+#if defined(CSQC) || defined(SSQC)
$cd id1/models/enforcer
$origin 0 -6 24
$base base
@@ -129,6 +142,11 @@ $frame paind1 paind2 paind3 paind4 paind5 paind6 paind7 paind8
$frame paind9 paind10 paind11 paind12 paind13 paind14 paind15 paind16
$frame paind17 paind18 paind19
+// MG1 compat -- CEV
+const float CORPSEFRAME_ENFORCER_1 = $death14;
+const float CORPSEFRAME_ENFORCER_2 = $fdeath11;
+#endif
+
//------------------------------------------------------------------------------
/*QUAKED monster_enforcer (1 0 0) (-16 -16 -24) (16 16 40) AMBUSH X X TRIGGER_SPAWNED X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
@@ -204,8 +222,38 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
*/
//----------------------------------------------------------------------
-// class monster_enforcer: base_walkmonster
+// class monster_enforcer: base_monster
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) monster_enforcer_netreceive =
+ {
+ // creates the newframe and netflags variables -- CEV
+ BASE_MONSTER_NETRECEIVE (monster_enforcer_init,
+ ENFORCER_MINS, ENFORCER_MAXS)
+
+ if (isnew)
+ base_entity_que_add (self, QUE_TYPE_ACTOR);
+
+ // attack6 is the one frame with a visible muzzleflash -- CEV
+ if (self.frame == $attack6)
+ {
+ self.effects |= EF_MUZZLEFLASH;
+ }
+ else if (self.frame >= $death3 && self.frame <= $death14)
+ {
+ if (self.solid != SOLID_NOT)
+ self.solid = SOLID_NOT;
+ }
+ else if (self.frame >= $fdeath3 && self.frame <= $fdeath11)
+ {
+ if (self.solid != SOLID_NOT)
+ self.solid = SOLID_NOT;
+ }
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
void() monster_enforcer_sightsound =
{
@@ -214,16 +262,16 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
rsnd = rint (random() * 3);
if (rsnd == 1)
// dumptruck_ds
- sound_sight (self, CHAN_VOICE, "enforcer/sight1.wav",
+ sound (self, CHAN_VOICE, "enforcer/sight1.wav",
VOL_HIGH, ATTN_NORM);
else if (rsnd == 2)
- sound_misc (self, CHAN_VOICE, "enforcer/sight2.wav",
+ sound (self, CHAN_VOICE, "enforcer/sight2.wav",
VOL_HIGH, ATTN_NORM);
else if (rsnd == 0)
- sound_misc1 (self, CHAN_VOICE, "enforcer/sight3.wav",
+ sound (self, CHAN_VOICE, "enforcer/sight3.wav",
VOL_HIGH, ATTN_NORM);
else
- sound_misc2 (self, CHAN_VOICE, "enforcer/sight4.wav",
+ sound (self, CHAN_VOICE, "enforcer/sight4.wav",
VOL_HIGH, ATTN_NORM);
};
@@ -235,7 +283,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
local vector org, dir;
self.effects = self.effects | EF_MUZZLEFLASH;
- sound_attack (self, CHAN_WEAPON, "weapons/lstart.wav",
+ sound (self, CHAN_WEAPON, "weapons/lstart.wav",
VOL_HIGH, ATTN_NORM);
ai_face ();
makevectors (self.angles);
@@ -244,7 +292,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
dir = self.enemy.origin - self.enemy.velocity * 0.075;
dir = normalize (dir - org + '0 0 16');
- if (self.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_TURRET)
traceline (org, self.origin + dir * 900, TRUE, self);
else
traceline (org, self.origin + dir * 600, TRUE, self);
@@ -270,7 +318,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
{
self.effects = self.effects | EF_MUZZLEFLASH;
ai_face ();
- sound_attack (self, CHAN_WEAPON, "enforcer/enfire.wav",
+ sound (self, CHAN_WEAPON, "enforcer/enfire.wav",
VOL_HIGH, ATTN_NORM);
makevectors (self.angles);
@@ -293,7 +341,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
// enforcer grenade offset -- CEV
local vector org1 = self.origin +
(v_forward * 30 + v_right * 8.5 + '0 0 16');
- if (self.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_TURRET)
base_monster_fire_grenade (org1,
40, 40, self.attack_elevation);
else
@@ -302,7 +350,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
}
else if (self.style == 3 || self.style == 5)
{
- sound_attack (self, CHAN_WEAPON, "weapons/spike2.wav",
+ sound (self, CHAN_WEAPON, "weapons/spike2.wav",
VOL_HIGH, ATTN_NORM);
self.effects = self.effects | EF_MUZZLEFLASH;
makevectors (self.angles);
@@ -328,15 +376,24 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
};
//--------------------------------------------------------------
+ #define F() \
+ /* { */ \
+ if (!(self.SendFlags & NETFLAG_BASE_ENTITY_FRAME)) \
+ { \
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME; \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
// Enforcer stand functions
//--------------------------------------------------------------
- void() enf_stand1 = [$stand1, enf_stand2] { ai_stand (); };
- void() enf_stand2 = [$stand2, enf_stand3] { ai_stand (); };
- void() enf_stand3 = [$stand3, enf_stand4] { ai_stand (); };
- void() enf_stand4 = [$stand4, enf_stand5] { ai_stand (); };
- void() enf_stand5 = [$stand5, enf_stand6] { ai_stand (); };
- void() enf_stand6 = [$stand6, enf_stand7] { ai_stand (); };
- void() enf_stand7 = [$stand7, enf_stand1] { ai_stand (); };
+ void() enf_stand1 = [$stand1, enf_stand2] { ai_stand (); F () };
+ void() enf_stand2 = [$stand2, enf_stand3] { ai_stand (); F () };
+ void() enf_stand3 = [$stand3, enf_stand4] { ai_stand (); F () };
+ void() enf_stand4 = [$stand4, enf_stand5] { ai_stand (); F () };
+ void() enf_stand5 = [$stand5, enf_stand6] { ai_stand (); F () };
+ void() enf_stand6 = [$stand6, enf_stand7] { ai_stand (); F () };
+ void() enf_stand7 = [$stand7, enf_stand1] { ai_stand (); F () };
//--------------------------------------------------------------
// Enforcer walk functions
@@ -345,25 +402,26 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
{
if (random() < 0.2)
// dumptruck_ds
- sound_idle (self, CHAN_VOICE, "enforcer/idle1.wav",
+ sound (self, CHAN_VOICE, "enforcer/idle1.wav",
VOL_HIGH, ATTN_IDLE);
ai_walk (2);
+ F ()
};
- void() enf_walk2 = [$walk2, enf_walk3] { ai_walk (4); };
- void() enf_walk3 = [$walk3, enf_walk4] { ai_walk (4); };
- void() enf_walk4 = [$walk4, enf_walk5] { ai_walk (3); };
- void() enf_walk5 = [$walk5, enf_walk6] { ai_walk (1); };
- void() enf_walk6 = [$walk6, enf_walk7] { ai_walk (2); };
- void() enf_walk7 = [$walk7, enf_walk8] { ai_walk (2); };
- void() enf_walk8 = [$walk8, enf_walk9] { ai_walk (1); };
- void() enf_walk9 = [$walk9, enf_walk10] { ai_walk (2); };
- void() enf_walk10 = [$walk10, enf_walk11] { ai_walk (4); };
- void() enf_walk11 = [$walk11, enf_walk12] { ai_walk (4); };
- void() enf_walk12 = [$walk12, enf_walk13] { ai_walk (1); };
- void() enf_walk13 = [$walk13, enf_walk14] { ai_walk (2); };
- void() enf_walk14 = [$walk14, enf_walk15] { ai_walk (3); };
- void() enf_walk15 = [$walk15, enf_walk16] { ai_walk (4); };
- void() enf_walk16 = [$walk16, enf_walk1] { ai_walk (2); };
+ void() enf_walk2 = [$walk2, enf_walk3] { ai_walk (4); F () };
+ void() enf_walk3 = [$walk3, enf_walk4] { ai_walk (4); F () };
+ void() enf_walk4 = [$walk4, enf_walk5] { ai_walk (3); F () };
+ void() enf_walk5 = [$walk5, enf_walk6] { ai_walk (1); F () };
+ void() enf_walk6 = [$walk6, enf_walk7] { ai_walk (2); F () };
+ void() enf_walk7 = [$walk7, enf_walk8] { ai_walk (2); F () };
+ void() enf_walk8 = [$walk8, enf_walk9] { ai_walk (1); F () };
+ void() enf_walk9 = [$walk9, enf_walk10] { ai_walk (2); F () };
+ void() enf_walk10 = [$walk10, enf_walk11] { ai_walk (4); F () };
+ void() enf_walk11 = [$walk11, enf_walk12] { ai_walk (4); F () };
+ void() enf_walk12 = [$walk12, enf_walk13] { ai_walk (1); F () };
+ void() enf_walk13 = [$walk13, enf_walk14] { ai_walk (2); F () };
+ void() enf_walk14 = [$walk14, enf_walk15] { ai_walk (3); F () };
+ void() enf_walk15 = [$walk15, enf_walk16] { ai_walk (4); F () };
+ void() enf_walk16 = [$walk16, enf_walk1] { ai_walk (2); F () };
//--------------------------------------------------------------
// Enforcer run functions
@@ -372,38 +430,48 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
{
if (random() < 0.2)
// dumptruck_ds
- sound_idle (self, CHAN_VOICE, "enforcer/idle1.wav",
+ sound (self, CHAN_VOICE, "enforcer/idle1.wav",
VOL_HIGH, ATTN_IDLE);
ai_run (18);
+ F ()
};
- void() enf_run2 = [$run2, enf_run3] { ai_run (14); };
- void() enf_run3 = [$run3, enf_run4] { ai_run (7); };
- void() enf_run4 = [$run4, enf_run5] { ai_run (12); };
- void() enf_run5 = [$run5, enf_run6] { ai_run (14); };
- void() enf_run6 = [$run6, enf_run7] { ai_run (14); };
- void() enf_run7 = [$run7, enf_run8] { ai_run (7); };
- void() enf_run8 = [$run8, enf_run1] { ai_run (11); };
+ void() enf_run2 = [$run2, enf_run3] { ai_run (14); F () };
+ void() enf_run3 = [$run3, enf_run4] { ai_run (7); F () };
+ void() enf_run4 = [$run4, enf_run5] { ai_run (12); F () };
+ void() enf_run5 = [$run5, enf_run6] { ai_run (14); F () };
+ void() enf_run6 = [$run6, enf_run7] { ai_run (14); F () };
+ void() enf_run7 = [$run7, enf_run8] { ai_run (7); F () };
+ void() enf_run8 = [$run8, enf_run1] { ai_run (11); F () };
//--------------------------------------------------------------
// Enforcer attack functions
//--------------------------------------------------------------
- void() enf_atk1 = [$attack1, enf_atk2] { ai_face (); };
- void() enf_atk2 = [$attack2, enf_atk3] { ai_face (); };
- void() enf_atk3 = [$attack3, enf_atk4] { ai_face (); };
- void() enf_atk4 = [$attack4, enf_atk5] { ai_face (); };
- void() enf_atk5 = [$attack5, enf_atk6] { ai_face (); };
- void() enf_atk6 = [$attack6, enf_atk7] { monster_enforcer_attack (); };
- void() enf_atk7 = [$attack7, enf_atk8] { ai_face (); };
- void() enf_atk8 = [$attack8, enf_atk9] { ai_face (); };
- void() enf_atk9 = [$attack5, enf_atk10] { ai_face (); };
- void() enf_atk10 = [$attack6, enf_atk11] { monster_enforcer_attack ();};
- void() enf_atk11 = [$attack7, enf_atk12] { ai_face (); };
- void() enf_atk12 = [$attack8, enf_atk13] { ai_face (); };
- void() enf_atk13 = [$attack9, enf_atk14] { ai_face (); };
+ void() enf_atk1 = [$attack1, enf_atk2] { ai_face (); F () };
+ void() enf_atk2 = [$attack2, enf_atk3] { ai_face (); F () };
+ void() enf_atk3 = [$attack3, enf_atk4] { ai_face (); F () };
+ void() enf_atk4 = [$attack4, enf_atk5] { ai_face (); F () };
+ void() enf_atk5 = [$attack5, enf_atk6] { ai_face (); F () };
+ void() enf_atk6 = [$attack6, enf_atk7]
+ {
+ monster_enforcer_attack ();
+ F ()
+ };
+ void() enf_atk7 = [$attack7, enf_atk8] { ai_face (); F () };
+ void() enf_atk8 = [$attack8, enf_atk9] { ai_face (); F () };
+ void() enf_atk9 = [$attack5, enf_atk10] { ai_face (); F () };
+ void() enf_atk10 = [$attack6, enf_atk11]
+ {
+ monster_enforcer_attack ();
+ F ()
+ };
+ void() enf_atk11 = [$attack7, enf_atk12] { ai_face (); F () };
+ void() enf_atk12 = [$attack8, enf_atk13] { ai_face (); F () };
+ void() enf_atk13 = [$attack9, enf_atk14] { ai_face (); F () };
void() enf_atk14 = [$attack10, enf_run1]
{
ai_face ();
sub_checkrefire (enf_atk1);
+ F ()
};
//--------------------------------------------------------------
@@ -415,11 +483,12 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
ai_face ();
self.count = 0;
self.t_length = 8 + floor (random() * 6);
+ F ()
};
- void() enf_atkb2 = [$attack2, enf_atkb3] { ai_face (); };
- void() enf_atkb3 = [$attack3, enf_atkb4] { ai_face (); };
- void() enf_atkb4 = [$attack4, enf_atkb5] { ai_face (); };
- void() enf_atkb5 = [$attack5, enf_atkb6] { ai_face (); };
+ void() enf_atkb2 = [$attack2, enf_atkb3] { ai_face (); F () };
+ void() enf_atkb3 = [$attack3, enf_atkb4] { ai_face (); F () };
+ void() enf_atkb4 = [$attack4, enf_atkb5] { ai_face (); F () };
+ void() enf_atkb5 = [$attack5, enf_atkb6] { ai_face (); F () };
void() enf_atkb6 =
{
self.frame = $attack6;
@@ -434,43 +503,49 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
}
ai_face ();
monster_enforcer_attack ();
+ F ()
};
- void() enf_atkb7 = [$attack7, enf_atkb8] { ai_face (); };
- void() enf_atkb8 = [$attack8, enf_atkb9] { ai_face (); };
- void() enf_atkb9 = [$attack9, enf_atkb10] { ai_face (); };
+ void() enf_atkb7 = [$attack7, enf_atkb8] { ai_face (); F () };
+ void() enf_atkb8 = [$attack8, enf_atkb9] { ai_face (); F () };
+ void() enf_atkb9 = [$attack9, enf_atkb10] { ai_face (); F () };
void() enf_atkb10 = [$attack10, enf_run1]
{
ai_face ();
sub_checkrefire (enf_atkb1);
+ F ()
};
//--------------------------------------------------------------
// Enforcer attack functions 4
//--------------------------------------------------------------
- void() enf_atkc1 = [$attack1, enf_atkc2] { ai_face (); };
- void() enf_atkc2 = [$attack2, enf_atkc3] { ai_face (); };
- void() enf_atkc3 = [$attack3, enf_atkc4] { ai_face (); };
- void() enf_atkc4 = [$attack4, enf_atkc5] { ai_face (); };
- void() enf_atkc5 = [$attack5, enf_atkc6] { ai_face (); };
+ void() enf_atkc1 = [$attack1, enf_atkc2] { ai_face (); F () };
+ void() enf_atkc2 = [$attack2, enf_atkc3] { ai_face (); F () };
+ void() enf_atkc3 = [$attack3, enf_atkc4] { ai_face (); F () };
+ void() enf_atkc4 = [$attack4, enf_atkc5] { ai_face (); F () };
+ void() enf_atkc5 = [$attack5, enf_atkc6] { ai_face (); F () };
void() enf_atkc6 = [$attack6, enf_atkc7]
{
monster_enforcer_attack_lightning ();
+ F ()
};
void() enf_atkc7 = [$attack6, enf_atkc8]
{
monster_enforcer_attack_lightning ();
+ F ()
};
void() enf_atkc8 = [$attack6, enf_atkc9]
{
monster_enforcer_attack_lightning ();
+ F ()
};
- void() enf_atkc9 = [$attack7, enf_atkc10] { ai_face (); };
- void() enf_atkc10 = [$attack8, enf_atkc11] { ai_face (); };
- void() enf_atkc11 = [$attack9, enf_atkc12] { ai_face (); };
+ void() enf_atkc9 = [$attack7, enf_atkc10] { ai_face (); F () };
+ void() enf_atkc10 = [$attack8, enf_atkc11] { ai_face (); F () };
+ void() enf_atkc11 = [$attack9, enf_atkc12] { ai_face (); F () };
void() enf_atkc12 = [$attack10, enf_run1]
{
ai_face ();
sub_checkrefire (enf_atkc1);
+ F ()
};
//////////////////////////////////////
@@ -480,14 +555,15 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//--------------------------------------------------------------
// Enforcer turret attack 1
//--------------------------------------------------------------
- void() enf_tur_atk1 = [$attack1, enf_tur_atk2] { ai_face (); };
- void() enf_tur_atk2 = [$attack2, enf_tur_atk3] { ai_face (); };
+ void() enf_tur_atk1 = [$attack1, enf_tur_atk2] { ai_face (); F () };
+ void() enf_tur_atk2 = [$attack2, enf_tur_atk3] { ai_face (); F () };
void() enf_tur_atk3 = [$attack3, enf_tur_atk4]
{
ai_face ();
self.attack_elevation = preach_iterate_elevation (
OGRE_DEFAULT_ELEVATION, GRENADE_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() enf_tur_atk4 = [$attack4, enf_tur_atk5]
{
@@ -495,6 +571,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
self.attack_elevation = preach_iterate_elevation (
self.attack_elevation, GRENADE_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() enf_tur_atk5 = [$attack5, enf_tur_atk6]
{
@@ -502,10 +579,12 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
self.attack_elevation = preach_iterate_elevation (
self.attack_elevation, GRENADE_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() enf_tur_atk6 = [$attack6, enf_tur_atk7]
{
monster_enforcer_attack ();
+ F ()
};
void() enf_tur_atk7 = [$attack7, enf_tur_atk8]
{
@@ -513,6 +592,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
self.attack_elevation = preach_iterate_elevation (
self.attack_elevation, GRENADE_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() enf_tur_atk8 = [$attack8, enf_tur_atk9]
{
@@ -520,6 +600,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
self.attack_elevation = preach_iterate_elevation (
self.attack_elevation, GRENADE_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() enf_tur_atk9 = [$attack5, enf_tur_atk10]
{
@@ -527,30 +608,33 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
self.attack_elevation = preach_iterate_elevation (
self.attack_elevation, GRENADE_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() enf_tur_atk10 = [$attack6, enf_tur_atk11]
{
monster_enforcer_attack ();
+ F ()
};
- void() enf_tur_atk11 = [$attack7, enf_tur_atk12] { ai_face (); };
- void() enf_tur_atk12 = [$attack8, enf_tur_atk13] { ai_face (); };
- void() enf_tur_atk13 = [$attack9, enf_tur_atk14] { ai_face (); };
+ void() enf_tur_atk11 = [$attack7, enf_tur_atk12] { ai_face (); F () };
+ void() enf_tur_atk12 = [$attack8, enf_tur_atk13] { ai_face (); F () };
+ void() enf_tur_atk13 = [$attack9, enf_tur_atk14] { ai_face (); F () };
void() enf_tur_atk14 = [$attack10, enf_seek_stand1]
{
ai_face ();
sub_checkrefire (enf_tur_atk1);
+ F ()
};
//--------------------------------------------------------------
// Enforcer turret seek
//--------------------------------------------------------------
- void() enf_seek_stand1 = [$stand1, enf_seek_stand2] { ai_run (0); };
- void() enf_seek_stand2 = [$stand2, enf_seek_stand3] { ai_run (0); };
- void() enf_seek_stand3 = [$stand3, enf_seek_stand4] { ai_run (0); };
- void() enf_seek_stand4 = [$stand4, enf_seek_stand5] { ai_run (0); };
- void() enf_seek_stand5 = [$stand5, enf_seek_stand6] { ai_run (0); };
- void() enf_seek_stand6 = [$stand6, enf_seek_stand7] { ai_run (0); };
- void() enf_seek_stand7 = [$stand7, enf_seek_stand1] { ai_run (0); };
+ void() enf_seek_stand1 = [$stand1, enf_seek_stand2] { ai_run (0); F ()};
+ void() enf_seek_stand2 = [$stand2, enf_seek_stand3] { ai_run (0); F ()};
+ void() enf_seek_stand3 = [$stand3, enf_seek_stand4] { ai_run (0); F ()};
+ void() enf_seek_stand4 = [$stand4, enf_seek_stand5] { ai_run (0); F ()};
+ void() enf_seek_stand5 = [$stand5, enf_seek_stand6] { ai_run (0); F ()};
+ void() enf_seek_stand6 = [$stand6, enf_seek_stand7] { ai_run (0); F ()};
+ void() enf_seek_stand7 = [$stand7, enf_seek_stand1] { ai_run (0); F ()};
//--------------------------------------------------------------
// Enforcer turret attack 2 (?)
@@ -560,11 +644,12 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
ai_face ();
self.count = 0;
self.t_length = 4 + floor (random() * 4);
+ F ()
};
- void() enf_tur_atkb2 = [$attack2, enf_tur_atkb3] { ai_face (); };
- void() enf_tur_atkb3 = [$attack3, enf_tur_atkb4] { ai_face (); };
- void() enf_tur_atkb4 = [$attack4, enf_tur_atkb5] { ai_face (); };
- void() enf_tur_atkb5 = [$attack5, enf_tur_atkb6] { ai_face (); };
+ void() enf_tur_atkb2 = [$attack2, enf_tur_atkb3] { ai_face (); F () };
+ void() enf_tur_atkb3 = [$attack3, enf_tur_atkb4] { ai_face (); F () };
+ void() enf_tur_atkb4 = [$attack4, enf_tur_atkb5] { ai_face (); F () };
+ void() enf_tur_atkb5 = [$attack5, enf_tur_atkb6] { ai_face (); F () };
void() enf_tur_atkb6 =
{
self.frame = $attack6;
@@ -577,55 +662,61 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
ai_face ();
monster_enforcer_attack ();
+ F ()
};
- void() enf_tur_atkb7 = [$attack7, enf_tur_atkb8] { ai_face (); };
- void() enf_tur_atkb8 = [$attack8, enf_tur_atkb9] { ai_face (); };
- void() enf_tur_atkb9 = [$attack9, enf_tur_atkb10] { ai_face (); };
+ void() enf_tur_atkb7 = [$attack7, enf_tur_atkb8] { ai_face (); F () };
+ void() enf_tur_atkb8 = [$attack8, enf_tur_atkb9] { ai_face (); F () };
+ void() enf_tur_atkb9 = [$attack9, enf_tur_atkb10] { ai_face (); F () };
void() enf_tur_atkb10 = [$attack10, enf_standb1]
{
ai_face ();
sub_checkrefire (enf_tur_atkb1);
+ F ()
};
//--------------------------------------------------------------
// Enforcer turret attack 4 (?)
//--------------------------------------------------------------
- void() enf_tur_atkc1 = [$attack1, enf_tur_atkc2] { ai_face (); };
- void() enf_tur_atkc2 = [$attack2, enf_tur_atkc3] { ai_face (); };
- void() enf_tur_atkc3 = [$attack3, enf_tur_atkc4] { ai_face (); };
- void() enf_tur_atkc4 = [$attack4, enf_tur_atkc5] { ai_face (); };
- void() enf_tur_atkc5 = [$attack5, enf_tur_atkc6] { ai_face (); };
+ void() enf_tur_atkc1 = [$attack1, enf_tur_atkc2] { ai_face (); F () };
+ void() enf_tur_atkc2 = [$attack2, enf_tur_atkc3] { ai_face (); F () };
+ void() enf_tur_atkc3 = [$attack3, enf_tur_atkc4] { ai_face (); F () };
+ void() enf_tur_atkc4 = [$attack4, enf_tur_atkc5] { ai_face (); F () };
+ void() enf_tur_atkc5 = [$attack5, enf_tur_atkc6] { ai_face (); F () };
void() enf_tur_atkc6 = [$attack6, enf_tur_atkc7]
{
monster_enforcer_attack_lightning ();
+ F ()
};
void() enf_tur_atkc7 = [$attack6, enf_tur_atkc8]
{
monster_enforcer_attack_lightning ();
+ F ()
};
void() enf_tur_atkc8 = [$attack6, enf_tur_atkc9]
{
monster_enforcer_attack_lightning ();
+ F ()
};
- void() enf_tur_atkc9 = [$attack7, enf_tur_atkc10] { ai_face (); };
- void() enf_tur_atkc10 = [$attack8, enf_tur_atkc11] { ai_face (); };
- void() enf_tur_atkc11 = [$attack9, enf_tur_atkc12] { ai_face (); };
+ void() enf_tur_atkc9 = [$attack7, enf_tur_atkc10] { ai_face (); F () };
+ void() enf_tur_atkc10 = [$attack8, enf_tur_atkc11] { ai_face (); F () };
+ void() enf_tur_atkc11 = [$attack9, enf_tur_atkc12] { ai_face (); F () };
void() enf_tur_atkc12 = [$attack10, enf_standb1]
{
ai_face ();
sub_checkrefire (enf_tur_atkb1);
+ F ()
};
//--------------------------------------------------------------
// Enforcer turret stand 2 (?)
//--------------------------------------------------------------
- void() enf_standb1 = [$stand1, enf_standb2] { ai_run (0); };
- void() enf_standb2 = [$stand2, enf_standb3] { ai_run (0); };
- void() enf_standb3 = [$stand3, enf_standb4] { ai_run (0); };
- void() enf_standb4 = [$stand4, enf_standb5] { ai_run (0); };
- void() enf_standb5 = [$stand5, enf_standb6] { ai_run (0); };
- void() enf_standb6 = [$stand6, enf_standb7] { ai_run (0); };
- void() enf_standb7 = [$stand7, enf_standb1] { ai_run (0); };
+ void() enf_standb1 = [$stand1, enf_standb2] { ai_run (0); F () };
+ void() enf_standb2 = [$stand2, enf_standb3] { ai_run (0); F () };
+ void() enf_standb3 = [$stand3, enf_standb4] { ai_run (0); F () };
+ void() enf_standb4 = [$stand4, enf_standb5] { ai_run (0); F () };
+ void() enf_standb5 = [$stand5, enf_standb6] { ai_run (0); F () };
+ void() enf_standb6 = [$stand6, enf_standb7] { ai_run (0); F () };
+ void() enf_standb7 = [$stand7, enf_standb1] { ai_run (0); F () };
//////////////////////////////////////
// new frames for turret mode END //
@@ -634,54 +725,54 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//--------------------------------------------------------------
// Enforcer pain state A
//--------------------------------------------------------------
- void() enf_paina1 = [$paina1, enf_paina2] { };
- void() enf_paina2 = [$paina2, enf_paina3] { };
- void() enf_paina3 = [$paina3, enf_paina4] { };
- void() enf_paina4 = [$paina4, enf_run1] { };
+ void() enf_paina1 = [$paina1, enf_paina2] { F () };
+ void() enf_paina2 = [$paina2, enf_paina3] { F () };
+ void() enf_paina3 = [$paina3, enf_paina4] { F () };
+ void() enf_paina4 = [$paina4, enf_run1] { F () };
//--------------------------------------------------------------
// Enforcer pain state B
//--------------------------------------------------------------
- void() enf_painb1 = [$painb1, enf_painb2] { };
- void() enf_painb2 = [$painb2, enf_painb3] { };
- void() enf_painb3 = [$painb3, enf_painb4] { };
- void() enf_painb4 = [$painb4, enf_painb5] { };
- void() enf_painb5 = [$painb5, enf_run1] { };
+ void() enf_painb1 = [$painb1, enf_painb2] { F () };
+ void() enf_painb2 = [$painb2, enf_painb3] { F () };
+ void() enf_painb3 = [$painb3, enf_painb4] { F () };
+ void() enf_painb4 = [$painb4, enf_painb5] { F () };
+ void() enf_painb5 = [$painb5, enf_run1] { F () };
//--------------------------------------------------------------
// Enforcer pain state C
//--------------------------------------------------------------
- void() enf_painc1 = [$painc1, enf_painc2] { };
- void() enf_painc2 = [$painc2, enf_painc3] { };
- void() enf_painc3 = [$painc3, enf_painc4] { };
- void() enf_painc4 = [$painc4, enf_painc5] { };
- void() enf_painc5 = [$painc5, enf_painc6] { };
- void() enf_painc6 = [$painc6, enf_painc7] { };
- void() enf_painc7 = [$painc7, enf_painc8] { };
- void() enf_painc8 = [$painc8, enf_run1] { };
+ void() enf_painc1 = [$painc1, enf_painc2] { F () };
+ void() enf_painc2 = [$painc2, enf_painc3] { F () };
+ void() enf_painc3 = [$painc3, enf_painc4] { F () };
+ void() enf_painc4 = [$painc4, enf_painc5] { F () };
+ void() enf_painc5 = [$painc5, enf_painc6] { F () };
+ void() enf_painc6 = [$painc6, enf_painc7] { F () };
+ void() enf_painc7 = [$painc7, enf_painc8] { F () };
+ void() enf_painc8 = [$painc8, enf_run1] { F () };
//--------------------------------------------------------------
// Enforcer pain state D
//--------------------------------------------------------------
- void() enf_paind1 = [$paind1, enf_paind2] { };
- void() enf_paind2 = [$paind2, enf_paind3] { };
- void() enf_paind3 = [$paind3, enf_paind4] { };
- void() enf_paind4 = [$paind4, enf_paind5] { ai_painforward (2); };
- void() enf_paind5 = [$paind5, enf_paind6] { ai_painforward (1); };
- void() enf_paind6 = [$paind6, enf_paind7] { };
- void() enf_paind7 = [$paind7, enf_paind8] { };
- void() enf_paind8 = [$paind8, enf_paind9] { };
- void() enf_paind9 = [$paind9, enf_paind10] { };
- void() enf_paind10 = [$paind10, enf_paind11] { };
- void() enf_paind11 = [$paind11, enf_paind12] { ai_painforward (1); };
- void() enf_paind12 = [$paind12, enf_paind13] { ai_painforward (1); };
- void() enf_paind13 = [$paind13, enf_paind14] { ai_painforward (1); };
- void() enf_paind14 = [$paind14, enf_paind15] { };
- void() enf_paind15 = [$paind15, enf_paind16] { };
- void() enf_paind16 = [$paind16, enf_paind17] { ai_pain (1); };
- void() enf_paind17 = [$paind17, enf_paind18] { ai_pain (1); };
- void() enf_paind18 = [$paind18, enf_paind19] { };
- void() enf_paind19 = [$paind19, enf_run1] { };
+ void() enf_paind1 = [$paind1, enf_paind2] { F () };
+ void() enf_paind2 = [$paind2, enf_paind3] { F () };
+ void() enf_paind3 = [$paind3, enf_paind4] { F () };
+ void() enf_paind4 = [$paind4, enf_paind5] { ai_painforward (2); F () };
+ void() enf_paind5 = [$paind5, enf_paind6] { ai_painforward (1); F () };
+ void() enf_paind6 = [$paind6, enf_paind7] { F () };
+ void() enf_paind7 = [$paind7, enf_paind8] { F () };
+ void() enf_paind8 = [$paind8, enf_paind9] { F () };
+ void() enf_paind9 = [$paind9, enf_paind10] { F () };
+ void() enf_paind10 = [$paind10, enf_paind11] { F () };
+ void() enf_paind11 = [$paind11, enf_paind12] { ai_painforward (1);F ()};
+ void() enf_paind12 = [$paind12, enf_paind13] { ai_painforward (1);F ()};
+ void() enf_paind13 = [$paind13, enf_paind14] { ai_painforward (1);F ()};
+ void() enf_paind14 = [$paind14, enf_paind15] { F () };
+ void() enf_paind15 = [$paind15, enf_paind16] { F () };
+ void() enf_paind16 = [$paind16, enf_paind17] { ai_pain (1); F () };
+ void() enf_paind17 = [$paind17, enf_paind18] { ai_pain (1); F () };
+ void() enf_paind18 = [$paind18, enf_paind19] { F () };
+ void() enf_paind19 = [$paind19, enf_run1] { F () };
//--------------------------------------------------------------
// Enforcer death state A
@@ -689,8 +780,9 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() enf_die1 = [$death1, enf_die2]
{
base_entity_aligntoground (self);
+ F ()
};
- void() enf_die2 = [$death2, enf_die3] { };
+ void() enf_die2 = [$death2, enf_die3] { F () };
void() enf_die3 = [$death3, enf_die4]
{
self.solid = SOLID_NOT;
@@ -713,22 +805,32 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
if (!self.keep_ammo)
item_backpack_drop (self);
+
+ F ()
};
- void() enf_die4 = [$death4, enf_die5] { ai_forward (14); };
- void() enf_die5 = [$death5, enf_die6] { ai_forward (2); };
- void() enf_die6 = [$death6, enf_die7] { };
- void() enf_die7 = [$death7, enf_die8] { };
- void() enf_die8 = [$death8, enf_die9] { };
- void() enf_die9 = [$death9, enf_die10] { ai_forward (3); };
- void() enf_die10 = [$death10, enf_die11] { ai_forward (5); };
- void() enf_die11 = [$death11, enf_die12] { ai_forward (5); };
- void() enf_die12 = [$death12, enf_die13] { ai_forward (5); };
+ void() enf_die4 = [$death4, enf_die5] { ai_forward (14); F () };
+ void() enf_die5 = [$death5, enf_die6] { ai_forward (2); F () };
+ void() enf_die6 = [$death6, enf_die7] { F () };
+ void() enf_die7 = [$death7, enf_die8] { F () };
+ void() enf_die8 = [$death8, enf_die9] { F () };
+ void() enf_die9 = [$death9, enf_die10] { ai_forward (3); F () };
+ void() enf_die10 = [$death10, enf_die11] { ai_forward (5); F () };
+ void() enf_die11 = [$death11, enf_die12] { ai_forward (5); F () };
+ void() enf_die12 = [$death12, enf_die13] { ai_forward (5); F () };
void() enf_die13 = [$death13, enf_die14]
{
become_base_corpse (self, ENFORCER_HEALTH_CORPSE);
setsize (self, ENFORCER_CORPSE_Z_MINS, ENFORCER_CORPSE_Z_MAXS);
+ F ()
+ };
+ void() enf_die14 = [$death14, enf_die14]
+ {
+ if (self.origin != self.origin_net)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_FRAME;
+ else if (self.frame_net != self.frame)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
};
- void() enf_die14 = [$death14, enf_die14] { };
//--------------------------------------------------------------
// Enforcer death state F
@@ -736,8 +838,9 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() enf_dief1 = [$fdeath1, enf_dief2]
{
base_entity_aligntoground (self);
+ F ()
};
- void() enf_dief2 = [$fdeath2, enf_dief3] { };
+ void() enf_dief2 = [$fdeath2, enf_dief3] { F () };
void() enf_dief3 = [$fdeath3, enf_dief4]
{
self.solid = SOLID_NOT;
@@ -760,19 +863,31 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
if (!self.keep_ammo)
item_backpack_drop (self);
+
+ F ()
};
- void() enf_dief4 = [$fdeath4, enf_dief5] { };
- void() enf_dief5 = [$fdeath5, enf_dief6] { };
- void() enf_dief6 = [$fdeath6, enf_dief7] { };
- void() enf_dief7 = [$fdeath7, enf_dief8] { };
- void() enf_dief8 = [$fdeath8, enf_dief9] { };
- void() enf_dief9 = [$fdeath9, enf_dief10] { };
+ void() enf_dief4 = [$fdeath4, enf_dief5] { F () };
+ void() enf_dief5 = [$fdeath5, enf_dief6] { F () };
+ void() enf_dief6 = [$fdeath6, enf_dief7] { F () };
+ void() enf_dief7 = [$fdeath7, enf_dief8] { F () };
+ void() enf_dief8 = [$fdeath8, enf_dief9] { F () };
+ void() enf_dief9 = [$fdeath9, enf_dief10] { F () };
void() enf_dief10 = [$fdeath10, enf_dief11]
{
become_base_corpse (self, ENFORCER_HEALTH_CORPSE);
setsize (self, ENFORCER_CORPSE_Z_MINS, ENFORCER_CORPSE_Z_MAXS);
+ F ()
};
- void() enf_dief11 = [$fdeath11, enf_dief11] { };
+ void() enf_dief11 = [$fdeath11, enf_dief11]
+ {
+ if (self.origin != self.origin_net)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_FRAME;
+ else if (self.frame_net != self.frame)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
+ };
+
+ #undef F
//==============================================================
// Interaction
@@ -792,11 +907,11 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
if (r < 0.5)
// dumptruck_ds
- sound_pain (self, CHAN_VOICE, "enforcer/pain1.wav",
+ sound (self, CHAN_VOICE, "enforcer/pain1.wav",
VOL_HIGH, ATTN_NORM);
else
// dumptruck_ds
- sound_misc3 (self, CHAN_VOICE, "enforcer/pain2.wav",
+ sound (self, CHAN_VOICE, "enforcer/pain2.wav",
VOL_HIGH, ATTN_NORM);
if (r < 0.2)
@@ -804,7 +919,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
self.pain_finished = time + 1;
// moved these here to avoid spamming pain sounds
// -- dumptruck_ds
- if (self.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_TURRET)
return;
else
enf_paina1 ();
@@ -812,7 +927,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
else if (r < 0.4)
{
self.pain_finished = time + 1;
- if (self.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_TURRET)
return;
else
enf_painb1 ();
@@ -820,7 +935,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
else if (r < 0.7)
{
self.pain_finished = time + 1;
- if (self.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_TURRET)
return;
else
enf_painc1 ();
@@ -828,7 +943,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
else
{
self.pain_finished = time + 2;
- if (self.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_TURRET)
return;
else
enf_paind1 ();
@@ -840,38 +955,28 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//--------------------------------------------------------------
void(vector dir) monster_enforcer_destroy =
{
- // check if we're dead already
- if (self.classgroup & CG_CORPSE)
- {
- sound (self, CHAN_VOICE, "player/udeath.wav",
- VOL_HIGH, ATTN_NORM);
-
- throw_gib_head_enforcer (self, dir, self.health);
- throw_gib_1 (self, dir, self.health);
- throw_gib_2 (self, dir, self.health);
- throw_gib_3 (self, dir, self.health);
-
- return;
- }
-
// check for gib
- if (self.health < -35)
+ if (self.classgroup & CG_CORPSE || self.health < -35)
{
sound (self, CHAN_VOICE, "player/udeath.wav",
VOL_HIGH, ATTN_NORM);
- throw_gib_head_enforcer (self, dir, self.health);
- throw_gib_1 (self, dir, self.health);
- throw_gib_2 (self, dir, self.health);
- throw_gib_3 (self, dir, self.health);
+ if (!(self.classgroup & CG_CORPSE))
+ base_item_drop_stuff (self);
- base_item_drop_stuff (self);
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib1_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib2_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib3_init)
+ BASE_ITEM_GIB_THROW (dir, self.health,
+ item_head_enforcer_init)
+
+ base_entity_remove (self);
return;
}
// regular death
// dumptruck_ds
- sound_death (self, CHAN_VOICE, "enforcer/death1.wav",
+ sound (self, CHAN_VOICE, "enforcer/death1.wav",
VOL_HIGH, ATTN_NORM);
base_item_drop_stuff (self);
if (random() > 0.5)
@@ -885,16 +990,19 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//==============================================================
//--------------------------------------------------------------
- entity(vector org, vector ang, float sflags, float yaw, float angry)
+ entity(vector org, vector ang, float sflags, float yaw)
spawn_monster_enforcer =
{
- return spawn_base_monster (org, ang, sflags, yaw, angry,
+ return spawn_base_monster (org, ang, sflags, yaw,
monster_enforcer_init);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) monster_enforcer_init =
{
+ #ifdef SSQC
if (deathmatch)
{
remove (e);
@@ -903,43 +1011,44 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
if (e.style >= 6)
objerror ("style key set too high\n");
+ #endif
e.classname = "monster_enforcer";
e.classtype = CT_MONSTER_ENFORCER;
+ e.pos1 = ENFORCER_MINS;
+ e.pos2 = ENFORCER_MAXS;
- // custom_mdls function -- dumptruck_ds
- precache_body_model2 (e, "progs/enforcer.mdl");
- precache_head_model2 (e, "progs/h_mega.mdl");
- precache_proj_model2 (e, "progs/laser.mdl");
- precache_proj_model2 (e, "progs/s_spike.mdl");
- precache_proj_model2 (e, "progs/missile.mdl");
- // dumptruck_ds
- precache_sound2_death (e, "enforcer/death1.wav");
- precache_sound2_attack (e, "enforcer/enfire.wav");
- precache_sound2_hit (e, "enforcer/enfstop.wav");
- precache_sound2_idle (e, "enforcer/idle1.wav");
- precache_sound2_pain (e, "enforcer/pain1.wav");
- precache_sound2_misc3 (e, "enforcer/pain2.wav");
- precache_sound2_sight (e, "enforcer/sight1.wav");
- // these will be replaced with custom noise fields eventually
- // -- dumptruck_ds
- precache_sound2_misc (e, "enforcer/sight2.wav");
- precache_sound2_misc1 (e, "enforcer/sight3.wav");
- precache_sound2_misc2 (e, "enforcer/sight4.wav");
-
- precache_gib1 (e, "progs/gib1.mdl");
- precache_gib2 (e, "progs/gib2.mdl");
- precache_gib3 (e, "progs/gib3.mdl");
-
- e.solid = SOLID_SLIDEBOX;
- e.movetype = MOVETYPE_STEP;
-
- // SPIKE to the RESCUE!!!! - got this fixed. -- dumptruck_ds
- body_model (e, "progs/enforcer.mdl");
- // orginal dumptruck_ds
- // setmodel (e, "progs/enforcer.mdl");
-
- setsize (e, '-16 -16 -24', '16 16 40');
+ #ifdef CSQC
+ if (e.modelindex)
+ {
+ setmodelindex (e, e.modelindex);
+ setsize (e, ENFORCER_MINS, ENFORCER_MAXS);
+ }
+ #endif
+
+ #ifdef SSQC
+ precache_model2 ("progs/enforcer.mdl");
+ precache_model2 ("progs/h_mega.mdl");
+ precache_model2 ("progs/laser.mdl");
+ precache_model2 ("progs/s_spike.mdl");
+ precache_model2 ("progs/missile.mdl");
+ precache_sound2 ("enforcer/death1.wav");
+ precache_sound2 ("enforcer/enfire.wav");
+ precache_sound2 ("enforcer/enfstop.wav");
+ precache_sound2 ("enforcer/idle1.wav");
+ precache_sound2 ("enforcer/pain1.wav");
+ precache_sound2 ("enforcer/pain2.wav");
+ precache_sound2 ("enforcer/sight1.wav");
+ precache_sound2 ("enforcer/sight2.wav");
+ precache_sound2 ("enforcer/sight3.wav");
+ precache_sound2 ("enforcer/sight4.wav");
+
+ precache_model ("progs/gib1.mdl");
+ precache_model ("progs/gib2.mdl");
+ precache_model ("progs/gib3.mdl");
+
+ // set up model and size for later -- CEV
+ e.mdl = "progs/enforcer.mdl";
if (!e.proj_speed_mod)
e.proj_speed_mod = 1;
@@ -948,116 +1057,65 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
// thanks RennyC -- dumptruck_ds
e.health = ENFORCER_HEALTH;
+ e.destroy = monster_enforcer_destroy;
e.sightsound = monster_enforcer_sightsound;
e.th_stand = enf_stand1;
e.th_walk = enf_walk1;
- if (e.spawnflags & I_AM_TURRET)
+ if (e.spawnflags & SPAWNFLAG_MONSTER_TURRET)
e.th_run = enf_standb1;
else
e.th_run = enf_run1;
- // Berserk test from
- // http://celephais.net/board/view_thread.php?id=4&start=3465
- // -- dumptruck_ds
- if !(e.berserk)
- e.th_pain = monster_enforcer_pain;
- else
+
+ // changed berserk test from field to flag -- CEV
+ if (self.spawnflags & SPAWNFLAG_MONSTER_BERSERK)
e.th_pain = sub_nullpain;
- e.destroy = monster_enforcer_destroy;
+ else
+ e.th_pain = monster_enforcer_pain;
+
// new animation frame check -- dumptruck_ds
if (e.style == 1 || e.style == 2 || e.style == 5)
{
- if (e.spawnflags & I_AM_TURRET)
+ if (e.spawnflags & SPAWNFLAG_MONSTER_TURRET)
e.th_turret = enf_tur_atkb1;
e.th_missile = enf_atkb1;
}
else if (e.style == 0 || e.style == 3 )
{
- if (e.spawnflags & I_AM_TURRET)
+ if (e.spawnflags & SPAWNFLAG_MONSTER_TURRET)
e.th_turret = enf_tur_atk1;
e.th_missile = enf_atk1;
}
else if (e.style == 4)
{
- if (e.spawnflags & I_AM_TURRET)
+ if (e.spawnflags & SPAWNFLAG_MONSTER_TURRET)
e.th_turret = enf_tur_atkc1;
e.th_missile = enf_atkc1;
}
+ #endif
- // walkmonster_start
- base_walkmonster_init (e);
+ // InitMonster -- runs on both client & server -- CEV
+ base_monster_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() monster_enforcer =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags & fields, inhibit if necessary -- CEV
+ BASE_MONSTER_PREINIT (base_monster_init_field)
monster_enforcer_init (self);
};
+#endif
// };
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-/*QUAKED gib_head_enforcer (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/h_mega.mdl");
-}
-*/
-//----------------------------------------------------------------------
-// class gib_head_enforcer: base_gib_head
-// {
- //--------------------------------------------------------------
- // ThrowHead
- //--------------------------------------------------------------
- void(entity act, vector dir, float dmg) throw_gib_head_enforcer =
- {
- base_gib_head_throw (act, dir, dmg, gib_head_enforcer_init);
- };
-
- //--------------------------------------------------------------
- void(entity e) gib_head_enforcer_init =
- {
- e.classname = "gib_head_enforcer";
- e.classtype = CT_GORE_HEAD_ENFORCER;
-
- // gib_init interprets spawnflags and will set .solid -- CEV
- base_gib_head_init (e);
-
- if (e.mdl_head != "")
- {
- precache_model (e.mdl_head);
- setmodel (e, e.mdl_head);
- }
- else
- {
- precache_model ("progs/h_mega.mdl");
- setmodel (e, "progs/h_mega.mdl");
- if (e.solid == SOLID_BBOX)
- setsize (e, ENFORCER_HEAD_MINS,
- ENFORCER_HEAD_MAXS);
- else if (e.solid == SOLID_TRIGGER)
- setsize (e, '-16 -16 0', '16 16 56');
- }
-
- e.frame = 0;
- };
-
- //--------------------------------------------------------------
- void() gib_head_enforcer =
- {
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- gib_head_enforcer_init (self);
- };
-// };
-
+#ifdef SSQC
/*QUAKED monster_dead_enforcer (0 0.5 0.8) (-16 -16 -24) (16 16 32) SOLID FACE_UP X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ({"path":"progs/enforcer.mdl","frame":54});
@@ -1074,6 +1132,7 @@ model ("progs/h_mega.mdl");
precache_model ("progs/enforcer.mdl");
setmodel (e, "progs/enforcer.mdl");
+ // TODO CEV
if (e.spawnflags & 2)
{
e.frame = $fdeath11;
@@ -1102,3 +1161,8 @@ model ("progs/h_mega.mdl");
monster_dead_enforcer_init (self);
};
// };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+$flush
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/monsters/fish.qc
diff --git a/qc/monsters/fish.qc b/qc/monsters/fish.qc
index b04151c..9b65572 100644
--- a/qc/monsters/fish.qc
+++ b/qc/monsters/fish.qc
@@ -6,18 +6,29 @@
// constants
//======================================================================
+#ifdef SSQC
const float FISH_HEALTH = 25; // id1 25
const float FISH_HEALTH_CORPSE = 20;
+#endif
+#if defined(CSQC) || defined(SSQC)
+const vector FISH_MINS = '-16 -16 -24';
+const vector FISH_MAXS = '16 16 24';
const vector FISH_CORPSE_Z_MINS = '-16 -16 -24'; // thin 32x32 box on ground
const vector FISH_CORPSE_Z_MAXS = '16 16 -8';
+#endif
//======================================================================
// forward declarations
//======================================================================
// monster_fish
+#ifdef CSQC
+void(float isnew) monster_fish_netreceive;
+#endif
+#ifdef SSQC
void() monster_fish_attack_melee; // AI, attacks, animation, thinking
+// F() // macro to set FRAME netflag -- CEV
void() fish_stand1; void() fish_stand2; void() fish_stand3; void() fish_stand4;
void() fish_stand5; void() fish_stand6; void() fish_stand7; void() fish_stand8;
void() fish_stand9; void() fish_stand10; void() fish_stand11;
@@ -49,15 +60,27 @@ void() fish_death18; void() fish_death19; void() fish_death20;
void() fish_death21;
void(entity attacker, float damage) monster_fish_pain; // interaction
void(vector dir) monster_fish_destroy;
-entity(vector org, vector ang, float sflags, float yaw, float angry)
+entity(vector org, vector ang, float sflags, float yaw)
spawn_monster_fish; // initialization
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) monster_fish_init;
+#endif
+#ifdef SSQC
void() monster_fish;
+#endif
+
+#ifdef SSQC
+// monster_dead_fish
+void(entity e) monster_dead_fish_init;
+void() monster_dead_fish;
+#endif
//======================================================================
// frame macros
//======================================================================
+#if defined(CSQC) || defined(SSQC)
$cd id1/models/fish
$origin 0 0 24
$base base
@@ -78,6 +101,10 @@ $frame swim18
$frame pain1 pain2 pain3 pain4 pain5 pain6 pain7 pain8
$frame pain9
+// MG1 compat -- CEV
+const float CORPSEFRAME_FISH_1 = $death21;
+#endif
+
//------------------------------------------------------------------------------
/*QUAKED monster_fish (1 0 0) (-16 -16 -24) (16 16 24) AMBUSH X X TRIGGER_SPAWNED X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
@@ -134,8 +161,30 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
*/
//----------------------------------------------------------------------
-// class monster_fish: base_swimmonster
+// class monster_fish: base_monster
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) monster_fish_netreceive =
+ {
+ // creates the newframe and netflags variables -- CEV
+ BASE_MONSTER_NETRECEIVE (monster_fish_init,
+ FISH_MINS, FISH_MAXS)
+
+ if (isnew)
+ base_entity_que_add (self, QUE_TYPE_ACTOR);
+
+ if (self.frame >= $death1 && self.frame <= $death21)
+ {
+ if (self.solid != SOLID_NOT)
+ self.solid = SOLID_NOT;
+ if (self.flags & FL_SWIM)
+ self.flags &= ~FL_SWIM;
+ }
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
void() monster_fish_attack_melee =
{
@@ -151,55 +200,64 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
if (vlen(delta) > 60)
return;
- sound_attack (self, CHAN_VOICE, "fish/bite.wav",
+ sound (self, CHAN_VOICE, "fish/bite.wav",
VOL_HIGH, ATTN_NORM);
ldmg = (random() + random()) * 3;
t_damage2 (self.enemy, self, self, ldmg);
};
//--------------------------------------------------------------
+ #define F() \
+ /* { */ \
+ if (!(self.SendFlags & NETFLAG_BASE_ENTITY_FRAME)) \
+ { \
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME; \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
// Fish stand (resting?) functions
//--------------------------------------------------------------
- void() fish_stand1 = [$swim1, fish_stand2] { ai_stand (); };
- void() fish_stand2 = [$swim2, fish_stand3] { ai_stand (); };
- void() fish_stand3 = [$swim3, fish_stand4] { ai_stand (); };
- void() fish_stand4 = [$swim4, fish_stand5] { ai_stand (); };
- void() fish_stand5 = [$swim5, fish_stand6] { ai_stand (); };
- void() fish_stand6 = [$swim6, fish_stand7] { ai_stand (); };
- void() fish_stand7 = [$swim7, fish_stand8] { ai_stand (); };
- void() fish_stand8 = [$swim8, fish_stand9] { ai_stand (); };
- void() fish_stand9 = [$swim9, fish_stand10 ] { ai_stand (); };
- void() fish_stand10 = [$swim10, fish_stand11] { ai_stand (); };
- void() fish_stand11 = [$swim11, fish_stand12] { ai_stand (); };
- void() fish_stand12 = [$swim12, fish_stand13] { ai_stand (); };
- void() fish_stand13 = [$swim13, fish_stand14] { ai_stand (); };
- void() fish_stand14 = [$swim14, fish_stand15] { ai_stand (); };
- void() fish_stand15 = [$swim15, fish_stand16] { ai_stand (); };
- void() fish_stand16 = [$swim16, fish_stand17] { ai_stand (); };
- void() fish_stand17 = [$swim17, fish_stand18] { ai_stand (); };
- void() fish_stand18 = [$swim18, fish_stand1] { ai_stand (); };
+ void() fish_stand1 = [$swim1, fish_stand2] { ai_stand (); F () };
+ void() fish_stand2 = [$swim2, fish_stand3] { ai_stand (); F () };
+ void() fish_stand3 = [$swim3, fish_stand4] { ai_stand (); F () };
+ void() fish_stand4 = [$swim4, fish_stand5] { ai_stand (); F () };
+ void() fish_stand5 = [$swim5, fish_stand6] { ai_stand (); F () };
+ void() fish_stand6 = [$swim6, fish_stand7] { ai_stand (); F () };
+ void() fish_stand7 = [$swim7, fish_stand8] { ai_stand (); F () };
+ void() fish_stand8 = [$swim8, fish_stand9] { ai_stand (); F () };
+ void() fish_stand9 = [$swim9, fish_stand10 ] { ai_stand (); F () };
+ void() fish_stand10 = [$swim10, fish_stand11] { ai_stand (); F () };
+ void() fish_stand11 = [$swim11, fish_stand12] { ai_stand (); F () };
+ void() fish_stand12 = [$swim12, fish_stand13] { ai_stand (); F () };
+ void() fish_stand13 = [$swim13, fish_stand14] { ai_stand (); F () };
+ void() fish_stand14 = [$swim14, fish_stand15] { ai_stand (); F () };
+ void() fish_stand15 = [$swim15, fish_stand16] { ai_stand (); F () };
+ void() fish_stand16 = [$swim16, fish_stand17] { ai_stand (); F () };
+ void() fish_stand17 = [$swim17, fish_stand18] { ai_stand (); F () };
+ void() fish_stand18 = [$swim18, fish_stand1] { ai_stand (); F () };
//--------------------------------------------------------------
// Fish walking functions (ever seen a fish walk?)
//--------------------------------------------------------------
- void() fish_walk1 = [$swim1, fish_walk2] { ai_walk (8); };
- void() fish_walk2 = [$swim2, fish_walk3] { ai_walk (8); };
- void() fish_walk3 = [$swim3, fish_walk4] { ai_walk (8); };
- void() fish_walk4 = [$swim4, fish_walk5] { ai_walk (8); };
- void() fish_walk5 = [$swim5, fish_walk6] { ai_walk (8); };
- void() fish_walk6 = [$swim6, fish_walk7] { ai_walk (8); };
- void() fish_walk7 = [$swim7, fish_walk8] { ai_walk (8); };
- void() fish_walk8 = [$swim8, fish_walk9] { ai_walk (8); };
- void() fish_walk9 = [$swim9, fish_walk10] { ai_walk (8); };
- void() fish_walk10 = [$swim10, fish_walk11] { ai_walk (8); };
- void() fish_walk11 = [$swim11, fish_walk12] { ai_walk (8); };
- void() fish_walk12 = [$swim12, fish_walk13] { ai_walk (8); };
- void() fish_walk13 = [$swim13, fish_walk14] { ai_walk (8); };
- void() fish_walk14 = [$swim14, fish_walk15] { ai_walk (8); };
- void() fish_walk15 = [$swim15, fish_walk16] { ai_walk (8); };
- void() fish_walk16 = [$swim16, fish_walk17] { ai_walk (8); };
- void() fish_walk17 = [$swim17, fish_walk18] { ai_walk (8); };
- void() fish_walk18 = [$swim18, fish_walk1] { ai_walk (8); };
+ void() fish_walk1 = [$swim1, fish_walk2] { ai_walk (8); F () };
+ void() fish_walk2 = [$swim2, fish_walk3] { ai_walk (8); F () };
+ void() fish_walk3 = [$swim3, fish_walk4] { ai_walk (8); F () };
+ void() fish_walk4 = [$swim4, fish_walk5] { ai_walk (8); F () };
+ void() fish_walk5 = [$swim5, fish_walk6] { ai_walk (8); F () };
+ void() fish_walk6 = [$swim6, fish_walk7] { ai_walk (8); F () };
+ void() fish_walk7 = [$swim7, fish_walk8] { ai_walk (8); F () };
+ void() fish_walk8 = [$swim8, fish_walk9] { ai_walk (8); F () };
+ void() fish_walk9 = [$swim9, fish_walk10] { ai_walk (8); F () };
+ void() fish_walk10 = [$swim10, fish_walk11] { ai_walk (8); F () };
+ void() fish_walk11 = [$swim11, fish_walk12] { ai_walk (8); F () };
+ void() fish_walk12 = [$swim12, fish_walk13] { ai_walk (8); F () };
+ void() fish_walk13 = [$swim13, fish_walk14] { ai_walk (8); F () };
+ void() fish_walk14 = [$swim14, fish_walk15] { ai_walk (8); F () };
+ void() fish_walk15 = [$swim15, fish_walk16] { ai_walk (8); F () };
+ void() fish_walk16 = [$swim16, fish_walk17] { ai_walk (8); F () };
+ void() fish_walk17 = [$swim17, fish_walk18] { ai_walk (8); F () };
+ void() fish_walk18 = [$swim18, fish_walk1] { ai_walk (8); F () };
//--------------------------------------------------------------
// Fish run functions
@@ -208,90 +266,104 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
{
ai_run (12);
if (random() < 0.5)
- sound_idle (self, CHAN_VOICE, "fish/idle.wav",
+ sound (self, CHAN_VOICE, "fish/idle.wav",
VOL_HIGH, ATTN_NORM);
+ F ()
};
- void() fish_run2 = [$swim3, fish_run3] { ai_run (12); };
- void() fish_run3 = [$swim5, fish_run4] { ai_run (12); };
- void() fish_run4 = [$swim7, fish_run5] { ai_run (12); };
- void() fish_run5 = [$swim9, fish_run6] { ai_run (12); };
- void() fish_run6 = [$swim11, fish_run7] { ai_run (12); };
- void() fish_run7 = [$swim13, fish_run8] { ai_run (12); };
- void() fish_run8 = [$swim15, fish_run9] { ai_run (12); };
- void() fish_run9 = [$swim17, fish_run1] { ai_run (12); };
+ void() fish_run2 = [$swim3, fish_run3] { ai_run (12); F () };
+ void() fish_run3 = [$swim5, fish_run4] { ai_run (12); F () };
+ void() fish_run4 = [$swim7, fish_run5] { ai_run (12); F () };
+ void() fish_run5 = [$swim9, fish_run6] { ai_run (12); F () };
+ void() fish_run6 = [$swim11, fish_run7] { ai_run (12); F () };
+ void() fish_run7 = [$swim13, fish_run8] { ai_run (12); F () };
+ void() fish_run8 = [$swim15, fish_run9] { ai_run (12); F () };
+ void() fish_run9 = [$swim17, fish_run1] { ai_run (12); F () };
//--------------------------------------------------------------
// Fish attack functions
//--------------------------------------------------------------
- void() fish_atk1 = [$attack1, fish_atk2] { ai_charge (10); };
- void() fish_atk2 = [$attack2, fish_atk3] { ai_charge (10); };
+ void() fish_atk1 = [$attack1, fish_atk2] { ai_charge (10); F () };
+ void() fish_atk2 = [$attack2, fish_atk3] { ai_charge (10); F () };
void() fish_atk3 = [$attack3, fish_atk4]
{
monster_fish_attack_melee ();
+ F ()
};
- void() fish_atk4 = [$attack4, fish_atk5] { ai_charge (10); };
- void() fish_atk5 = [$attack5, fish_atk6] { ai_charge (10); };
- void() fish_atk6 = [$attack6, fish_atk7] { ai_charge (10); };
- void() fish_atk7 = [$attack7, fish_atk8] { ai_charge (10); };
- void() fish_atk8 = [$attack8, fish_atk9] { ai_charge (10); };
+ void() fish_atk4 = [$attack4, fish_atk5] { ai_charge (10); F () };
+ void() fish_atk5 = [$attack5, fish_atk6] { ai_charge (10); F () };
+ void() fish_atk6 = [$attack6, fish_atk7] { ai_charge (10); F () };
+ void() fish_atk7 = [$attack7, fish_atk8] { ai_charge (10); F () };
+ void() fish_atk8 = [$attack8, fish_atk9] { ai_charge (10); F () };
void() fish_atk9 = [$attack9, fish_atk10]
{
monster_fish_attack_melee ();
+ F ()
};
- void() fish_atk10 = [$attack10, fish_atk11] { ai_charge (10); };
- void() fish_atk11 = [$attack11, fish_atk12] { ai_charge (10); };
- void() fish_atk12 = [$attack12, fish_atk13] { ai_charge (10); };
- void() fish_atk13 = [$attack13, fish_atk14] { ai_charge (10); };
- void() fish_atk14 = [$attack14, fish_atk15] { ai_charge (10); };
+ void() fish_atk10 = [$attack10, fish_atk11] { ai_charge (10); F () };
+ void() fish_atk11 = [$attack11, fish_atk12] { ai_charge (10); F () };
+ void() fish_atk12 = [$attack12, fish_atk13] { ai_charge (10); F () };
+ void() fish_atk13 = [$attack13, fish_atk14] { ai_charge (10); F () };
+ void() fish_atk14 = [$attack14, fish_atk15] { ai_charge (10); F () };
void() fish_atk15 = [$attack15, fish_atk16]
{
monster_fish_attack_melee ();
+ F ()
};
- void() fish_atk16 = [$attack16, fish_atk17] { ai_charge (10); };
- void() fish_atk17 = [$attack17, fish_atk18] { ai_charge (10); };
- void() fish_atk18 = [$attack18, fish_run1] { ai_charge (10); };
+ void() fish_atk16 = [$attack16, fish_atk17] { ai_charge (10); F () };
+ void() fish_atk17 = [$attack17, fish_atk18] { ai_charge (10); F () };
+ void() fish_atk18 = [$attack18, fish_run1] { ai_charge (10); F () };
//--------------------------------------------------------------
// Fish pain states (please don't hurt the fish)
//--------------------------------------------------------------
- void() fish_pain1 = [$pain1, fish_pain2] { };
- void() fish_pain2 = [$pain2, fish_pain3] { ai_pain (6); };
- void() fish_pain3 = [$pain3, fish_pain4] { ai_pain (6); };
- void() fish_pain4 = [$pain4, fish_pain5] { ai_pain (6); };
- void() fish_pain5 = [$pain5, fish_pain6] { ai_pain (6); };
- void() fish_pain6 = [$pain6, fish_pain7] { ai_pain (6); };
- void() fish_pain7 = [$pain7, fish_pain8] { ai_pain (6); };
- void() fish_pain8 = [$pain8, fish_pain9] { ai_pain (6); };
- void() fish_pain9 = [$pain9, fish_run1] { ai_pain (6); };
+ void() fish_pain1 = [$pain1, fish_pain2] { F () };
+ void() fish_pain2 = [$pain2, fish_pain3] { ai_pain (6); F () };
+ void() fish_pain3 = [$pain3, fish_pain4] { ai_pain (6); F () };
+ void() fish_pain4 = [$pain4, fish_pain5] { ai_pain (6); F () };
+ void() fish_pain5 = [$pain5, fish_pain6] { ai_pain (6); F () };
+ void() fish_pain6 = [$pain6, fish_pain7] { ai_pain (6); F () };
+ void() fish_pain7 = [$pain7, fish_pain8] { ai_pain (6); F () };
+ void() fish_pain8 = [$pain8, fish_pain9] { ai_pain (6); F () };
+ void() fish_pain9 = [$pain9, fish_run1] { ai_pain (6); F () };
//--------------------------------------------------------------
// Fish death states (RIP fish)
//--------------------------------------------------------------
- void() fish_death1 = [$death1, fish_death2] { };
- void() fish_death2 = [$death2, fish_death3] { };
- void() fish_death3 = [$death3, fish_death4] { };
- void() fish_death4 = [$death4, fish_death5] { };
- void() fish_death5 = [$death5, fish_death6] { };
- void() fish_death6 = [$death6, fish_death7] { };
- void() fish_death7 = [$death7, fish_death8] { };
- void() fish_death8 = [$death8, fish_death9] { };
- void() fish_death9 = [$death9, fish_death10] { };
- void() fish_death10 = [$death10, fish_death11] { };
- void() fish_death11 = [$death11, fish_death12] { };
- void() fish_death12 = [$death12, fish_death13] { };
- void() fish_death13 = [$death13, fish_death14] { };
- void() fish_death14 = [$death14, fish_death15] { };
- void() fish_death15 = [$death15, fish_death16] { };
- void() fish_death16 = [$death16, fish_death17] { };
- void() fish_death17 = [$death17, fish_death18] { };
- void() fish_death18 = [$death18, fish_death19] { };
- void() fish_death19 = [$death19, fish_death20] { };
+ void() fish_death1 = [$death1, fish_death2] { F () };
+ void() fish_death2 = [$death2, fish_death3] { F () };
+ void() fish_death3 = [$death3, fish_death4] { F () };
+ void() fish_death4 = [$death4, fish_death5] { F () };
+ void() fish_death5 = [$death5, fish_death6] { F () };
+ void() fish_death6 = [$death6, fish_death7] { F () };
+ void() fish_death7 = [$death7, fish_death8] { F () };
+ void() fish_death8 = [$death8, fish_death9] { F () };
+ void() fish_death9 = [$death9, fish_death10] { F () };
+ void() fish_death10 = [$death10, fish_death11] { F () };
+ void() fish_death11 = [$death11, fish_death12] { F () };
+ void() fish_death12 = [$death12, fish_death13] { F () };
+ void() fish_death13 = [$death13, fish_death14] { F () };
+ void() fish_death14 = [$death14, fish_death15] { F () };
+ void() fish_death15 = [$death15, fish_death16] { F () };
+ void() fish_death16 = [$death16, fish_death17] { F () };
+ void() fish_death17 = [$death17, fish_death18] { F () };
+ void() fish_death18 = [$death18, fish_death19] { F () };
+ void() fish_death19 = [$death19, fish_death20] { F () };
void() fish_death20 = [$death20, fish_death21]
{
become_base_corpse (self, FISH_HEALTH_CORPSE);
setsize (self, FISH_CORPSE_Z_MINS, FISH_CORPSE_Z_MAXS);
+ F ()
+ };
+ void() fish_death21 = [$death21, fish_death21]
+ {
+ if (self.origin != self.origin_net)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_FRAME;
+ else if (self.frame_net != self.frame)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
};
- void() fish_death21 = [$death21, fish_death21] { };
+
+ #undef F
//==============================================================
// Interaction
@@ -311,68 +383,30 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//--------------------------------------------------------------
void(vector dir) monster_fish_destroy =
{
- // check if we're dead already
- if (self.classgroup & CG_CORPSE)
- {
- // fish gibs -- dumptruck_ds
- sound (self, CHAN_VOICE, "player/udeath.wav",
- VOL_HIGH, ATTN_NORM);
-
- // custom models -- dumptruck_ds
- if (self.mdl_gib1 != "")
- throw_gib_1 (self, dir, self.health);
- else
- throw_gib_3 (self, dir, self.health);
-
- if (self.mdl_gib2 != "")
- throw_gib_2 (self, dir, self.health);
- else
- throw_gib_3 (self, dir, self.health);
-
- if (self.mdl_gib3 != "")
- throw_gib_3 (self, dir, self.health);
- else
- throw_gib_3 (self, dir, self.health);
-
- // no fish heads -- CEV
- remove (self);
- return;
- }
-
// check for gib
- if (self.health < -35)
+ if (self.classgroup & CG_CORPSE || self.health < -35)
{
// fish gibs -- dumptruck_ds
sound (self, CHAN_VOICE, "player/udeath.wav",
VOL_HIGH, ATTN_NORM);
- // custom models -- dumptruck_ds
- if (self.mdl_gib1 != "")
- throw_gib_1 (self, dir, self.health);
- else
- throw_gib_3 (self, dir, self.health);
-
- if (self.mdl_gib2 != "")
- throw_gib_2 (self, dir, self.health);
- else
- throw_gib_3 (self, dir, self.health);
+ if (!(self.classgroup & CG_CORPSE))
+ base_item_drop_stuff (self);
- if (self.mdl_gib3 != "")
- throw_gib_3 (self, dir, self.health);
- else
- throw_gib_3 (self, dir, self.health);
-
- base_item_drop_stuff (self);
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib3_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib3_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib3_init)
// no fish heads -- CEV
- remove (self);
+ base_entity_remove (self);
return;
}
// regular death
self.solid = SOLID_NOT;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
base_item_drop_stuff (self);
- sound_death (self, CHAN_VOICE, "fish/death.wav",
+ sound (self, CHAN_VOICE, "fish/death.wav",
VOL_HIGH, ATTN_NORM);
fish_death1 ();
};
@@ -382,17 +416,20 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//==============================================================
//--------------------------------------------------------------
- entity(vector org, vector ang, float sflags, float yaw, float angry)
+ entity(vector org, vector ang, float sflags, float yaw)
spawn_monster_fish =
{
- return spawn_base_monster (org, ang, sflags, yaw, angry,
+ return spawn_base_monster (org, ang, sflags, yaw,
monster_fish_init);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) monster_fish_init =
{
- if (e.spawnflags & I_AM_TURRET)
+ #ifdef SSQC
+ if (e.spawnflags & SPAWNFLAG_MONSTER_TURRET)
objerror ("Incompatible spawnflag: TURRET_MODE\n");
if (deathmatch)
@@ -400,57 +437,105 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
remove (e);
return;
}
+ #endif
e.classname = "monster_fish";
e.classtype = CT_MONSTER_FISH;
+ e.classgroup |= CG_MONSTER_SWIM;
+ e.pos1 = FISH_MINS;
+ e.pos2 = FISH_MAXS;
- precache_body_model2 (e, "progs/fish.mdl");
- // precache_model2 ("progs/fish.mdl");
-
- precache_sound2_death (e, "fish/death.wav");
- precache_sound2_attack (e, "fish/bite.wav");
- precache_sound2_idle (e, "fish/idle.wav");
+ #ifdef CSQC
+ if (e.modelindex)
+ {
+ setmodelindex (e, e.modelindex);
+ setsize (e, FISH_MINS, FISH_MAXS);
+ }
+ #endif
- precache_gib1 (e, "progs/gib1.mdl");
- precache_gib2 (e, "progs/gib2.mdl");
- precache_gib3 (e, "progs/gib3.mdl");
+ #ifdef SSQC
+ precache_model2 ("progs/fish.mdl");
- e.solid = SOLID_SLIDEBOX;
- e.movetype = MOVETYPE_STEP;
+ precache_sound2 ("fish/death.wav");
+ precache_sound2 ("fish/bite.wav");
+ precache_sound2 ("fish/idle.wav");
- body_model (e, "progs/fish.mdl");
- // setmodel (e, "progs/fish.mdl");
+ precache_model ("progs/gib1.mdl");
+ precache_model ("progs/gib2.mdl");
+ precache_model ("progs/gib3.mdl");
- setsize (e, '-16 -16 -24', '16 16 24');
+ // set up model and size for later -- CEV
+ e.mdl = "progs/fish.mdl";
if (!e.health)
// thanks RennyC -- dumptruck_ds
e.health = FISH_HEALTH;
+ e.destroy = monster_fish_destroy;
e.th_stand = fish_stand1;
e.th_walk = fish_walk1;
e.th_run = fish_run1;
- e.destroy = monster_fish_destroy;
- // Berserk from
- // http://celephais.net/board/view_thread.php?id=4&start=3465
- // -- dumptruck_ds
- if !(e.berserk)
- e.th_pain = monster_fish_pain;
- else
- e.th_pain = sub_nullpain;
e.th_melee = fish_atk1;
- // swimmonster_start
- base_swimmonster_init (e);
+ // changed berserk test from field to flag -- CEV
+ if (self.spawnflags & SPAWNFLAG_MONSTER_BERSERK)
+ e.th_pain = sub_nullpain;
+ else
+ e.th_pain = monster_fish_pain;
+ #endif
+
+ // InitMonster -- runs on both client & server -- CEV
+ base_monster_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() monster_fish =
{
+ // remap spawnflags & fields, inhibit if necessary -- CEV
+ BASE_MONSTER_PREINIT (base_monster_init_field)
+
+ monster_fish_init (self);
+ };
+#endif
+// };
+
+#ifdef SSQC
+/*QUAKED monster_dead_fish (0 0.5 0.8) (-16 -16 -24) (16 16 32) SOLID FACE_UP X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+ model ({"path":"progs/fish.mdl","frame":28});
+}
+*/
+//----------------------------------------------------------------------
+// class monster_dead_fish: base_corpse
+// {
+ //--------------------------------------------------------------
+ void(entity e) monster_dead_fish_init =
+ {
+ base_corpse_init (e);
+
+ precache_model ("progs/fish.mdl");
+ setmodel (e, "progs/fish.mdl");
+
+ e.frame = $death21;
+
+ if (e.solid == SOLID_BBOX)
+ setsize (e, FISH_CORPSE_Z_MINS, FISH_CORPSE_Z_MAXS);
+ };
+
+ //--------------------------------------------------------------
+ void() monster_dead_fish =
+ {
// new spawnflags for all entities -- iw
if (SUB_Inhibit())
return;
- monster_fish_init (self);
+ monster_dead_fish_init (self);
};
// };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+$flush
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/monsters/hknight.qc
diff --git a/qc/monsters/hknight.qc b/qc/monsters/hknight.qc
index 8a1b691..0960820 100644
--- a/qc/monsters/hknight.qc
+++ b/qc/monsters/hknight.qc
@@ -8,23 +8,31 @@
// constants
//======================================================================
+#ifdef SSQC
const float HELL_KNIGHT_HEALTH = 250; // id1 250
const float HELL_KNIGHT_HEALTH_CORPSE = 60;
+#endif
-const vector HELL_KNIGHT_HEAD_MINS = '-7.9 -12.97 -0.63';
-const vector HELL_KNIGHT_HEAD_MAXS = '10.55 8.87 21.06';
+#if defined(CSQC) || defined(SSQC)
+const vector HELL_KNIGHT_MINS = '-16 -16 -24';
+const vector HELL_KNIGHT_MAXS = '16 16 40';
const vector HELL_KNIGHT_CORPSE_MINS = '-42.05 -31.07 -51.56';
const vector HELL_KNIGHT_CORPSE_MAXS = '46.34 25.02 30';
const vector HELL_KNIGHT_CORPSE_B_MINS = '-68.96 -20.43 -53.98';
const vector HELL_KNIGHT_CORPSE_B_MAXS = '34.8 21.15 30';
const vector HELL_KNIGHT_CORPSE_Z_MINS = '-16 -16 -24';
const vector HELL_KNIGHT_CORPSE_Z_MAXS = '16 16 -8';
+#endif
//======================================================================
// forward declarations
//======================================================================
// monster_hell_knight
+#ifdef CSQC
+void(float isnew) monster_hell_knight_netreceive;
+#endif
+#ifdef SSQC
void() monster_hell_knight_sightsound; // AI & attacks
void() monster_hell_knight_checkforcharge;
void() monster_hell_knight_checkcontinuecharge;
@@ -32,6 +40,7 @@ void() monster_hell_knight_attack_lightning;
void() monster_hell_knight_attack_melee;
void(float offset) monster_hell_knight_attack_shot;
void() monster_hell_knight_idlesound;
+// F() // macro to set FRAME netflag -- CEV
void() hkn_stand1; void() hkn_stand2; void() hkn_stand3; void() hkn_stand4;
void() hkn_stand5; void() hkn_stand6; void() hkn_stand7; void() hkn_stand8;
void() hkn_stand9;
@@ -96,24 +105,27 @@ void() hkn_dieb5; void() hkn_dieb6; void() hkn_dieb7; void() hkn_dieb8;
void() hkn_dieb9;
void(entity attacker, float damage) monster_hell_knight_pain; // interaction
void(vector dir) monster_hell_knight_destroy;
-entity(vector org, vector ang, float sflags, float yaw, float angry)
+entity(vector org, vector ang, float sflags, float yaw)
spawn_monster_hell_knight; // initialization
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) monster_hell_knight_init;
+#endif
+#ifdef SSQC
void() monster_hell_knight;
+#endif
-// gib_head_hell_knight
-void(entity act, vector dir, float dmg) throw_gib_head_hell_knight;
-void(entity e) gib_head_hell_knight_init;
-void() gib_head_hell_knight;
-
+#ifdef SSQC
// monster_dead_hell_knight
void(entity e) monster_dead_hell_knight_init;
void() monster_dead_hell_knight;
+#endif
//======================================================================
// frame macros
//======================================================================
+#if defined(CSQC) || defined(SSQC)
$cd id1/models/knight2
$origin 0 0 24
$base base
@@ -159,6 +171,11 @@ $frame w_attack21 w_attack22
$frame magicc1 magicc2 magicc3 magicc4 magicc5 magicc6 magicc7 magicc8
$frame magicc9 magicc10 magicc11
+// MG1 compat -- CEV
+const float CORPSEFRAME_HKNIGHT_1 = $death12;
+const float CORPSEFRAME_HKNIGHT_2 = $deathb9;
+#endif
+
//------------------------------------------------------------------------------
/*QUAKED monster_hell_knight (1 0 0) (-16 -16 -24) (16 16 40) AMBUSH X X TRIGGER_SPAWNED X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
@@ -230,12 +247,42 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
*/
//----------------------------------------------------------------------
-// class monster_hell_knight: base_walkmonster
+// class monster_hell_knight: base_monster
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) monster_hell_knight_netreceive =
+ {
+ // creates the newframe and netflags variables -- CEV
+ BASE_MONSTER_NETRECEIVE (monster_hell_knight_init,
+ HELL_KNIGHT_MINS, HELL_KNIGHT_MAXS)
+
+ if (isnew)
+ base_entity_que_add (self, QUE_TYPE_ACTOR);
+
+ // flash on lightning attack -- CEV
+ if (self.frame == $magicb10)
+ {
+ self.effects |= EF_MUZZLEFLASH;
+ }
+ else if (self.frame >= $death3 && self.frame <= $death12)
+ {
+ if (self.solid != SOLID_NOT)
+ self.solid = SOLID_NOT;
+ }
+ else if (self.frame >= $deathb3 && self.frame <= $deathb9)
+ {
+ if (self.solid != SOLID_NOT)
+ self.solid = SOLID_NOT;
+ }
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
void() monster_hell_knight_sightsound =
{
- sound_sight (self, CHAN_VOICE, "hknight/sight1.wav",
+ sound (self, CHAN_VOICE, "hknight/sight1.wav",
VOL_HIGH, ATTN_NORM);
};
@@ -289,8 +336,8 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
{
local vector org, dir;
- self.effects = self.effects | EF_MUZZLEFLASH;
- sound_attack(self, CHAN_WEAPON, "weapons/lstart.wav",
+ self.effects |= EF_MUZZLEFLASH;
+ sound (self, CHAN_WEAPON, "weapons/lstart.wav",
VOL_HIGH, ATTN_NORM);
ai_face ();
makevectors (self.angles);
@@ -299,7 +346,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
dir = self.enemy.origin - self.enemy.velocity * 0.075;
dir = normalize (dir - org + '0 0 16');
- if (self.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_TURRET)
traceline (org, self.origin + dir * 900, TRUE, self);
else
traceline (org, self.origin + dir * 600, TRUE, self);
@@ -324,7 +371,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
{
self.animtype = self.animtype + 1;
- sound_misc (self, CHAN_WEAPON, "hknight/slash1.wav",
+ sound (self, CHAN_WEAPON, "hknight/slash1.wav",
VOL_HIGH, ATTN_NORM);
if (self.animtype == 1)
{
@@ -365,22 +412,31 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() monster_hell_knight_idlesound =
{
if (random() < 0.2)
- sound_idle (self, CHAN_VOICE, "hknight/idle.wav",
+ sound (self, CHAN_VOICE, "hknight/idle.wav",
VOL_HIGH, ATTN_NORM);
};
//--------------------------------------------------------------
+ #define F() \
+ /* { */ \
+ if (!(self.SendFlags & NETFLAG_BASE_ENTITY_FRAME)) \
+ { \
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME; \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
// Death Knight Standing functions
//--------------------------------------------------------------
- void() hkn_stand1 = [$stand1, hkn_stand2] { ai_stand (); };
- void() hkn_stand2 = [$stand2, hkn_stand3] { ai_stand (); };
- void() hkn_stand3 = [$stand3, hkn_stand4] { ai_stand (); };
- void() hkn_stand4 = [$stand4, hkn_stand5] { ai_stand (); };
- void() hkn_stand5 = [$stand5, hkn_stand6] { ai_stand (); };
- void() hkn_stand6 = [$stand6, hkn_stand7] { ai_stand (); };
- void() hkn_stand7 = [$stand7, hkn_stand8] { ai_stand (); };
- void() hkn_stand8 = [$stand8, hkn_stand9] { ai_stand (); };
- void() hkn_stand9 = [$stand9, hkn_stand1] { ai_stand (); };
+ void() hkn_stand1 = [$stand1, hkn_stand2] { ai_stand (); F () };
+ void() hkn_stand2 = [$stand2, hkn_stand3] { ai_stand (); F () };
+ void() hkn_stand3 = [$stand3, hkn_stand4] { ai_stand (); F () };
+ void() hkn_stand4 = [$stand4, hkn_stand5] { ai_stand (); F () };
+ void() hkn_stand5 = [$stand5, hkn_stand6] { ai_stand (); F () };
+ void() hkn_stand6 = [$stand6, hkn_stand7] { ai_stand (); F () };
+ void() hkn_stand7 = [$stand7, hkn_stand8] { ai_stand (); F () };
+ void() hkn_stand8 = [$stand8, hkn_stand9] { ai_stand (); F () };
+ void() hkn_stand9 = [$stand9, hkn_stand1] { ai_stand (); F () };
//--------------------------------------------------------------
// Death Knight Walking functions
@@ -389,26 +445,27 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
{
monster_hell_knight_idlesound ();
ai_walk (2);
- };
- void() hkn_walk2 = [$walk2, hkn_walk3] { ai_walk (5); };
- void() hkn_walk3 = [$walk3, hkn_walk4] { ai_walk (5); };
- void() hkn_walk4 = [$walk4, hkn_walk5] { ai_walk (4); };
- void() hkn_walk5 = [$walk5, hkn_walk6] { ai_walk (4); };
- void() hkn_walk6 = [$walk6, hkn_walk7] { ai_walk (2); };
- void() hkn_walk7 = [$walk7, hkn_walk8] { ai_walk (2); };
- void() hkn_walk8 = [$walk8, hkn_walk9] { ai_walk (3); };
- void() hkn_walk9 = [$walk9, hkn_walk10] { ai_walk (3); };
- void() hkn_walk10 = [$walk10, hkn_walk11] { ai_walk (4); };
- void() hkn_walk11 = [$walk11, hkn_walk12] { ai_walk (3); };
- void() hkn_walk12 = [$walk12, hkn_walk13] { ai_walk (4); };
- void() hkn_walk13 = [$walk13, hkn_walk14] { ai_walk (6); };
- void() hkn_walk14 = [$walk14, hkn_walk15] { ai_walk (2); };
- void() hkn_walk15 = [$walk15, hkn_walk16] { ai_walk (2); };
- void() hkn_walk16 = [$walk16, hkn_walk17] { ai_walk (4); };
- void() hkn_walk17 = [$walk17, hkn_walk18] { ai_walk (3); };
- void() hkn_walk18 = [$walk18, hkn_walk19] { ai_walk (3); };
- void() hkn_walk19 = [$walk19, hkn_walk20] { ai_walk (3); };
- void() hkn_walk20 = [$walk20, hkn_walk1] { ai_walk (2); };
+ F ()
+ };
+ void() hkn_walk2 = [$walk2, hkn_walk3] { ai_walk (5); F () };
+ void() hkn_walk3 = [$walk3, hkn_walk4] { ai_walk (5); F () };
+ void() hkn_walk4 = [$walk4, hkn_walk5] { ai_walk (4); F () };
+ void() hkn_walk5 = [$walk5, hkn_walk6] { ai_walk (4); F () };
+ void() hkn_walk6 = [$walk6, hkn_walk7] { ai_walk (2); F () };
+ void() hkn_walk7 = [$walk7, hkn_walk8] { ai_walk (2); F () };
+ void() hkn_walk8 = [$walk8, hkn_walk9] { ai_walk (3); F () };
+ void() hkn_walk9 = [$walk9, hkn_walk10] { ai_walk (3); F () };
+ void() hkn_walk10 = [$walk10, hkn_walk11] { ai_walk (4); F () };
+ void() hkn_walk11 = [$walk11, hkn_walk12] { ai_walk (3); F () };
+ void() hkn_walk12 = [$walk12, hkn_walk13] { ai_walk (4); F () };
+ void() hkn_walk13 = [$walk13, hkn_walk14] { ai_walk (6); F () };
+ void() hkn_walk14 = [$walk14, hkn_walk15] { ai_walk (2); F () };
+ void() hkn_walk15 = [$walk15, hkn_walk16] { ai_walk (2); F () };
+ void() hkn_walk16 = [$walk16, hkn_walk17] { ai_walk (4); F () };
+ void() hkn_walk17 = [$walk17, hkn_walk18] { ai_walk (3); F () };
+ void() hkn_walk18 = [$walk18, hkn_walk19] { ai_walk (3); F () };
+ void() hkn_walk19 = [$walk19, hkn_walk20] { ai_walk (3); F () };
+ void() hkn_walk20 = [$walk20, hkn_walk1] { ai_walk (2); F () };
//--------------------------------------------------------------
// Death Knight Running functions
@@ -418,58 +475,65 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
monster_hell_knight_idlesound ();
ai_run (20);
monster_hell_knight_checkforcharge ();
+ F ()
};
- void() hkn_run2 = [$run2, hkn_run3] { ai_run (25); };
- void() hkn_run3 = [$run3, hkn_run4] { ai_run (18); };
- void() hkn_run4 = [$run4, hkn_run5] { ai_run (16); };
- void() hkn_run5 = [$run5, hkn_run6] { ai_run (14); };
- void() hkn_run6 = [$run6, hkn_run7] { ai_run (25); };
- void() hkn_run7 = [$run7, hkn_run8] { ai_run (21); };
- void() hkn_run8 = [$run8, hkn_run1] { ai_run (13); };
+ void() hkn_run2 = [$run2, hkn_run3] { ai_run (25); F () };
+ void() hkn_run3 = [$run3, hkn_run4] { ai_run (18); F () };
+ void() hkn_run4 = [$run4, hkn_run5] { ai_run (16); F () };
+ void() hkn_run5 = [$run5, hkn_run6] { ai_run (14); F () };
+ void() hkn_run6 = [$run6, hkn_run7] { ai_run (25); F () };
+ void() hkn_run7 = [$run7, hkn_run8] { ai_run (21); F () };
+ void() hkn_run8 = [$run8, hkn_run1] { ai_run (13); F () };
//--------------------------------------------------------------
// Death Knight Charge A
//--------------------------------------------------------------
- void() hkn_char_a1 = [$char_a1, hkn_char_a2] { ai_charge (20); };
- void() hkn_char_a2 = [$char_a2, hkn_char_a3] { ai_charge (25); };
- void() hkn_char_a3 = [$char_a3, hkn_char_a4] { ai_charge (18); };
- void() hkn_char_a4 = [$char_a4, hkn_char_a5] { ai_charge (16); };
- void() hkn_char_a5 = [$char_a5, hkn_char_a6] { ai_charge (14); };
+ void() hkn_char_a1 = [$char_a1, hkn_char_a2] { ai_charge (20); F () };
+ void() hkn_char_a2 = [$char_a2, hkn_char_a3] { ai_charge (25); F () };
+ void() hkn_char_a3 = [$char_a3, hkn_char_a4] { ai_charge (18); F () };
+ void() hkn_char_a4 = [$char_a4, hkn_char_a5] { ai_charge (16); F () };
+ void() hkn_char_a5 = [$char_a5, hkn_char_a6] { ai_charge (14); F () };
void() hkn_char_a6 = [$char_a6, hkn_char_a7]
{
ai_charge (20);
ai_melee ();
+ F ()
};
void() hkn_char_a7 = [$char_a7, hkn_char_a8]
{
ai_charge (21);
ai_melee ();
+ F ()
};
void() hkn_char_a8 = [$char_a8, hkn_char_a9]
{
ai_charge (13);
ai_melee ();
+ F ()
};
void() hkn_char_a9 = [$char_a9, hkn_char_a10]
{
ai_charge (20);
ai_melee ();
+ F ()
};
void() hkn_char_a10 = [$char_a10, hkn_char_a11]
{
ai_charge (20);
ai_melee ();
+ F ()
};
void() hkn_char_a11 = [$char_a11, hkn_char_a12]
{
ai_charge (18);
ai_melee ();
+ F ()
};
- void() hkn_char_a12 = [$char_a12, hkn_char_a13] { ai_charge (16); };
- void() hkn_char_a13 = [$char_a13, hkn_char_a14] { ai_charge (14); };
- void() hkn_char_a14 = [$char_a14, hkn_char_a15] { ai_charge (25); };
- void() hkn_char_a15 = [$char_a15, hkn_char_a16] { ai_charge (21); };
- void() hkn_char_a16 = [$char_a16, hkn_run1] { ai_charge (13); };
+ void() hkn_char_a12 = [$char_a12, hkn_char_a13] { ai_charge (16); F()};
+ void() hkn_char_a13 = [$char_a13, hkn_char_a14] { ai_charge (14); F()};
+ void() hkn_char_a14 = [$char_a14, hkn_char_a15] { ai_charge (25); F()};
+ void() hkn_char_a15 = [$char_a15, hkn_char_a16] { ai_charge (21); F()};
+ void() hkn_char_a16 = [$char_a16, hkn_run1] { ai_charge (13); F () };
//--------------------------------------------------------------
// Death Knight Charge B
@@ -479,238 +543,272 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
monster_hell_knight_checkcontinuecharge ();
ai_charge (23);
ai_melee ();
+ F ()
};
void() hkn_char_b2 = [$char_b2, hkn_char_b3]
{
ai_charge (17);
ai_melee ();
+ F ()
};
void() hkn_char_b3 = [$char_b3, hkn_char_b4]
{
ai_charge (12);
ai_melee ();
+ F ()
};
void() hkn_char_b4 = [$char_b4, hkn_char_b5]
{
ai_charge (22);
ai_melee ();
+ F ()
};
void() hkn_char_b5 = [$char_b5, hkn_char_b6]
{
ai_charge (18);
ai_melee ();
+ F ()
};
void() hkn_char_b6 = [$char_b6, hkn_char_b1]
{
ai_charge (8);
ai_melee ();
+ F ()
};
//--------------------------------------------------------------
// Death Knight Slice Attack
//--------------------------------------------------------------
- void() hkn_slice1 = [$slice1, hkn_slice2] { ai_charge (9); };
- void() hkn_slice2 = [$slice2, hkn_slice3] { ai_charge (6); };
- void() hkn_slice3 = [$slice3, hkn_slice4] { ai_charge (13); };
- void() hkn_slice4 = [$slice4, hkn_slice5] { ai_charge (4); };
+ void() hkn_slice1 = [$slice1, hkn_slice2] { ai_charge (9); F () };
+ void() hkn_slice2 = [$slice2, hkn_slice3] { ai_charge (6); F () };
+ void() hkn_slice3 = [$slice3, hkn_slice4] { ai_charge (13); F () };
+ void() hkn_slice4 = [$slice4, hkn_slice5] { ai_charge (4); F () };
void() hkn_slice5 = [$slice5, hkn_slice6]
{
ai_charge (7);
ai_melee ();
+ F ()
};
void() hkn_slice6 = [$slice6, hkn_slice7]
{
ai_charge (15);
ai_melee ();
+ F ()
};
void() hkn_slice7 = [$slice7, hkn_slice8]
{
ai_charge (8);
ai_melee ();
+ F ()
};
void() hkn_slice8 = [$slice8, hkn_slice9]
{
ai_charge (2);
ai_melee ();
+ F ()
};
- void() hkn_slice9 = [$slice9, hkn_slice10] { ai_melee (); };
- void() hkn_slice10 = [$slice10, hkn_run1] { ai_charge (3); };
+ void() hkn_slice9 = [$slice9, hkn_slice10] { ai_melee (); F () };
+ void() hkn_slice10 = [$slice10, hkn_run1] { ai_charge (3); F () };
//--------------------------------------------------------------
// Death Knight Smash Attack
//--------------------------------------------------------------
- void() hkn_smash1 = [$smash1, hkn_smash2] { ai_charge (1); };
- void() hkn_smash2 = [$smash2, hkn_smash3] { ai_charge (13); };
- void() hkn_smash3 = [$smash3, hkn_smash4] { ai_charge (9); };
- void() hkn_smash4 = [$smash4, hkn_smash5] { ai_charge (11); };
+ void() hkn_smash1 = [$smash1, hkn_smash2] { ai_charge (1); F () };
+ void() hkn_smash2 = [$smash2, hkn_smash3] { ai_charge (13); F () };
+ void() hkn_smash3 = [$smash3, hkn_smash4] { ai_charge (9); F () };
+ void() hkn_smash4 = [$smash4, hkn_smash5] { ai_charge (11); F () };
void() hkn_smash5 = [$smash5, hkn_smash6]
{
ai_charge (10);
ai_melee ();
+ F ()
};
void() hkn_smash6 = [$smash6, hkn_smash7]
{
ai_charge (7);
ai_melee ();
+ F ()
};
void() hkn_smash7 = [$smash7, hkn_smash8]
{
ai_charge (12);
ai_melee ();
+ F ()
};
void() hkn_smash8 = [$smash8, hkn_smash9]
{
ai_charge (2);
ai_melee ();
+ F ()
};
void() hkn_smash9 = [$smash9, hkn_smash10]
{
ai_charge (3);
ai_melee ();
+ F ()
};
- void() hkn_smash10 = [$smash10, hkn_smash11] { ai_charge (0); };
- void() hkn_smash11 = [$smash11, hkn_run1] { ai_charge (0); };
+ void() hkn_smash10 = [$smash10, hkn_smash11] { ai_charge (0); F () };
+ void() hkn_smash11 = [$smash11, hkn_run1] { ai_charge (0); F () };
//--------------------------------------------------------------
// Death Knight W (?) Attack
//--------------------------------------------------------------
- void() hkn_watk1 = [$w_attack1, hkn_watk2] { ai_charge (2); };
- void() hkn_watk2 = [$w_attack2, hkn_watk3] { ai_charge (0); };
- void() hkn_watk3 = [$w_attack3, hkn_watk4] { ai_charge (0); };
- void() hkn_watk4 = [$w_attack4, hkn_watk5] { ai_melee (); };
- void() hkn_watk5 = [$w_attack5, hkn_watk6] { ai_melee (); };
- void() hkn_watk6 = [$w_attack6, hkn_watk7] { ai_melee (); };
- void() hkn_watk7 = [$w_attack7, hkn_watk8] { ai_charge (1); };
- void() hkn_watk8 = [$w_attack8, hkn_watk9] { ai_charge (4); };
- void() hkn_watk9 = [$w_attack9, hkn_watk10] { ai_charge (5); };
+ void() hkn_watk1 = [$w_attack1, hkn_watk2] { ai_charge (2); F () };
+ void() hkn_watk2 = [$w_attack2, hkn_watk3] { ai_charge (0); F () };
+ void() hkn_watk3 = [$w_attack3, hkn_watk4] { ai_charge (0); F () };
+ void() hkn_watk4 = [$w_attack4, hkn_watk5] { ai_melee (); F () };
+ void() hkn_watk5 = [$w_attack5, hkn_watk6] { ai_melee (); F () };
+ void() hkn_watk6 = [$w_attack6, hkn_watk7] { ai_melee (); F () };
+ void() hkn_watk7 = [$w_attack7, hkn_watk8] { ai_charge (1); F () };
+ void() hkn_watk8 = [$w_attack8, hkn_watk9] { ai_charge (4); F () };
+ void() hkn_watk9 = [$w_attack9, hkn_watk10] { ai_charge (5); F () };
void() hkn_watk10 = [$w_attack10, hkn_watk11]
{
ai_charge (3);
ai_melee ();
+ F ()
};
void() hkn_watk11 = [$w_attack11, hkn_watk12]
{
ai_charge (2);
ai_melee ();
+ F ()
};
void() hkn_watk12 = [$w_attack12, hkn_watk13]
{
ai_charge (2);
ai_melee ();
+ F ()
};
- void() hkn_watk13 = [$w_attack13, hkn_watk14] { ai_charge (0); };
- void() hkn_watk14 = [$w_attack14, hkn_watk15] { ai_charge (0); };
- void() hkn_watk15 = [$w_attack15, hkn_watk16] { ai_charge (0); };
- void() hkn_watk16 = [$w_attack16, hkn_watk17] { ai_charge (1); };
+ void() hkn_watk13 = [$w_attack13, hkn_watk14] { ai_charge (0); F () };
+ void() hkn_watk14 = [$w_attack14, hkn_watk15] { ai_charge (0); F () };
+ void() hkn_watk15 = [$w_attack15, hkn_watk16] { ai_charge (0); F () };
+ void() hkn_watk16 = [$w_attack16, hkn_watk17] { ai_charge (1); F () };
void() hkn_watk17 = [$w_attack17, hkn_watk18]
{
ai_charge (1);
ai_melee ();
+ F ()
};
void() hkn_watk18 = [$w_attack18, hkn_watk19]
{
ai_charge (3);
ai_melee ();
+ F ()
};
void() hkn_watk19 = [$w_attack19, hkn_watk20]
{
ai_charge (4);
ai_melee ();
+ F ()
};
- void() hkn_watk20 = [$w_attack20, hkn_watk21] { ai_charge (6); };
- void() hkn_watk21 = [$w_attack21, hkn_watk22] { ai_charge (7); };
- void() hkn_watk22 = [$w_attack22, hkn_run1] { ai_charge (3); };
+ void() hkn_watk20 = [$w_attack20, hkn_watk21] { ai_charge (6); F () };
+ void() hkn_watk21 = [$w_attack21, hkn_watk22] { ai_charge (7); F () };
+ void() hkn_watk22 = [$w_attack22, hkn_run1] { ai_charge (3); F () };
//--------------------------------------------------------------
// Death Knight Magic A
//--------------------------------------------------------------
- void() hkn_magica1 = [$magica1, hkn_magica2] { ai_face (); };
- void() hkn_magica2 = [$magica2, hkn_magica3] { ai_face (); };
- void() hkn_magica3 = [$magica3, hkn_magica4] { ai_face (); };
- void() hkn_magica4 = [$magica4, hkn_magica5] { ai_face (); };
- void() hkn_magica5 = [$magica5, hkn_magica6] { ai_face (); };
- void() hkn_magica6 = [$magica6, hkn_magica7] { ai_face (); };
+ void() hkn_magica1 = [$magica1, hkn_magica2] { ai_face (); F () };
+ void() hkn_magica2 = [$magica2, hkn_magica3] { ai_face (); F () };
+ void() hkn_magica3 = [$magica3, hkn_magica4] { ai_face (); F () };
+ void() hkn_magica4 = [$magica4, hkn_magica5] { ai_face (); F () };
+ void() hkn_magica5 = [$magica5, hkn_magica6] { ai_face (); F () };
+ void() hkn_magica6 = [$magica6, hkn_magica7] { ai_face (); F () };
void() hkn_magica7 = [$magica7, hkn_magica8]
{
monster_hell_knight_attack_shot (-2);
+ F ()
};
void() hkn_magica8 = [$magica8, hkn_magica9]
{
monster_hell_knight_attack_shot (-1);
+ F ()
};
void() hkn_magica9 = [$magica9, hkn_magica10]
{
monster_hell_knight_attack_shot (0);
+ F ()
};
void() hkn_magica10 = [$magica10, hkn_magica11]
{
monster_hell_knight_attack_shot (1);
+ F ()
};
void() hkn_magica11 = [$magica11, hkn_magica12]
{
monster_hell_knight_attack_shot (2);
+ F ()
};
void() hkn_magica12 = [$magica12, hkn_magica13]
{
monster_hell_knight_attack_shot (3);
+ F ()
};
- void() hkn_magica13 = [$magica13, hkn_magica14] { ai_face (); };
- void() hkn_magica14 = [$magica14, hkn_run1] { ai_face (); };
+ void() hkn_magica13 = [$magica13, hkn_magica14] { ai_face (); F () };
+ void() hkn_magica14 = [$magica14, hkn_run1] { ai_face (); F () };
//--------------------------------------------------------------
// Death Knight Magic B
//--------------------------------------------------------------
- void() hkn_magicb1 = [$magicb1, hkn_magicb2] { ai_face (); };
- void() hkn_magicb2 = [$magicb2, hkn_magicb3] { ai_face (); };
- void() hkn_magicb3 = [$magicb3, hkn_magicb4] { ai_face (); };
- void() hkn_magicb4 = [$magicb4, hkn_magicb5] { ai_face (); };
- void() hkn_magicb5 = [$magicb5, hkn_magicb6] { ai_face (); };
- void() hkn_magicb6 = [$magicb6, hkn_magicb7] { ai_face (); };
- void() hkn_magicb7 = [$magicb7, hkn_magicb8] { ai_face (); };
- void() hkn_magicb8 = [$magicb8, hkn_magicb9] { ai_face (); };
- void() hkn_magicb9 = [$magicb9, hkn_magicb10] { ai_face (); };
+ void() hkn_magicb1 = [$magicb1, hkn_magicb2] { ai_face (); F () };
+ void() hkn_magicb2 = [$magicb2, hkn_magicb3] { ai_face (); F () };
+ void() hkn_magicb3 = [$magicb3, hkn_magicb4] { ai_face (); F () };
+ void() hkn_magicb4 = [$magicb4, hkn_magicb5] { ai_face (); F () };
+ void() hkn_magicb5 = [$magicb5, hkn_magicb6] { ai_face (); F () };
+ void() hkn_magicb6 = [$magicb6, hkn_magicb7] { ai_face (); F () };
+ void() hkn_magicb7 = [$magicb7, hkn_magicb8] { ai_face (); F () };
+ void() hkn_magicb8 = [$magicb8, hkn_magicb9] { ai_face (); F () };
+ void() hkn_magicb9 = [$magicb9, hkn_magicb10] { ai_face (); F () };
void() hkn_magicb10 = [$magicb10, hkn_magicb11]
{
ai_face ();
- sound_misc2 (self, CHAN_WEAPON, "shambler/sboom.wav",
+ sound (self, CHAN_WEAPON, "shambler/sboom.wav",
VOL_HIGH, ATTN_NORM);
monster_hell_knight_attack_lightning ();
+ F ()
};
- void() hkn_magicb11 = [$magicb11, hkn_magicb12] { ai_face (); };
- void() hkn_magicb12 = [$magicb12, hkn_magicb13] { ai_face (); };
- void() hkn_magicb13 = [$magicb13, hkn_run1] { ai_face (); };
+ void() hkn_magicb11 = [$magicb11, hkn_magicb12] { ai_face (); F () };
+ void() hkn_magicb12 = [$magicb12, hkn_magicb13] { ai_face (); F () };
+ void() hkn_magicb13 = [$magicb13, hkn_run1] { ai_face (); F () };
//--------------------------------------------------------------
// Death Knight Magic C
//--------------------------------------------------------------
- void() hkn_magicc1 = [$magicc1, hkn_magicc2] { ai_face (); };
- void() hkn_magicc2 = [$magicc2, hkn_magicc3] { ai_face (); };
- void() hkn_magicc3 = [$magicc3, hkn_magicc4] { ai_face (); };
- void() hkn_magicc4 = [$magicc4, hkn_magicc5] { ai_face (); };
- void() hkn_magicc5 = [$magicc5, hkn_magicc6] { ai_face (); };
+ void() hkn_magicc1 = [$magicc1, hkn_magicc2] { ai_face (); F () };
+ void() hkn_magicc2 = [$magicc2, hkn_magicc3] { ai_face (); F () };
+ void() hkn_magicc3 = [$magicc3, hkn_magicc4] { ai_face (); F () };
+ void() hkn_magicc4 = [$magicc4, hkn_magicc5] { ai_face (); F () };
+ void() hkn_magicc5 = [$magicc5, hkn_magicc6] { ai_face (); F () };
void() hkn_magicc6 = [$magicc6, hkn_magicc7]
{
monster_hell_knight_attack_shot (-2);
+ F ()
};
void() hkn_magicc7 = [$magicc7, hkn_magicc8]
{
monster_hell_knight_attack_shot (-1);
+ F ()
};
void() hkn_magicc8 = [$magicc8, hkn_magicc9]
{
monster_hell_knight_attack_shot (0);
+ F ()
};
void() hkn_magicc9 = [$magicc9, hkn_magicc10]
{
monster_hell_knight_attack_shot (1);
+ F ()
};
void() hkn_magicc10 = [$magicc10, hkn_magicc11]
{
- monster_hell_knight_attack_shot(2);
+ monster_hell_knight_attack_shot (2);
+ F ()
};
void() hkn_magicc11 = [$magicc11, hkn_run1]
{
monster_hell_knight_attack_shot (3);
+ F ()
};
/////////////////////////////////////////////
@@ -720,72 +818,78 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//--------------------------------------------------------------
// Death Knight Seek / Standing Frames
//--------------------------------------------------------------
- void() hkn_seek_stand1 = [$stand1, hkn_seek_stand2] { ai_run (0); };
- void() hkn_seek_stand2 = [$stand2, hkn_seek_stand3] { ai_run (0); };
- void() hkn_seek_stand3 = [$stand3, hkn_seek_stand4] { ai_run (0); };
- void() hkn_seek_stand4 = [$stand4, hkn_seek_stand5] { ai_run (0); };
- void() hkn_seek_stand5 = [$stand5, hkn_seek_stand6] { ai_run (0); };
- void() hkn_seek_stand6 = [$stand6, hkn_seek_stand7] { ai_run (0); };
- void() hkn_seek_stand7 = [$stand7, hkn_seek_stand8] { ai_run (0); };
- void() hkn_seek_stand8 = [$stand8, hkn_seek_stand9] { ai_run (0); };
- void() hkn_seek_stand9 = [$stand9, hkn_seek_stand1] { ai_run (0); };
+ void() hkn_seek_stand1 = [$stand1, hkn_seek_stand2] { ai_run (0); F()};
+ void() hkn_seek_stand2 = [$stand2, hkn_seek_stand3] { ai_run (0); F()};
+ void() hkn_seek_stand3 = [$stand3, hkn_seek_stand4] { ai_run (0); F()};
+ void() hkn_seek_stand4 = [$stand4, hkn_seek_stand5] { ai_run (0); F()};
+ void() hkn_seek_stand5 = [$stand5, hkn_seek_stand6] { ai_run (0); F()};
+ void() hkn_seek_stand6 = [$stand6, hkn_seek_stand7] { ai_run (0); F()};
+ void() hkn_seek_stand7 = [$stand7, hkn_seek_stand8] { ai_run (0); F()};
+ void() hkn_seek_stand8 = [$stand8, hkn_seek_stand9] { ai_run (0); F()};
+ void() hkn_seek_stand9 = [$stand9, hkn_seek_stand1] { ai_run (0); F()};
//--------------------------------------------------------------
// Death Knight Turret Magic B (fnames shortened -- CEV)
//--------------------------------------------------------------
- void() hkn_tur_magb1 = [$magicb1, hkn_tur_magb2] { ai_face (); };
- void() hkn_tur_magb2 = [$magicb2, hkn_tur_magb3] { ai_face (); };
- void() hkn_tur_magb3 = [$magicb3, hkn_tur_magb4] { ai_face (); };
- void() hkn_tur_magb4 = [$magicb4, hkn_tur_magb5] { ai_face (); };
- void() hkn_tur_magb5 = [$magicb5, hkn_tur_magb6] { ai_face (); };
- void() hkn_tur_magb6 = [$magicb6, hkn_tur_magb7] { ai_face (); };
- void() hkn_tur_magb7 = [$magicb7, hkn_tur_magb8] { ai_face (); };
- void() hkn_tur_magb8 = [$magicb8, hkn_tur_magb9] { ai_face (); };
- void() hkn_tur_magb9 = [$magicb9, hkn_tur_magb10] { ai_face (); };
+ void() hkn_tur_magb1 = [$magicb1, hkn_tur_magb2] { ai_face (); F () };
+ void() hkn_tur_magb2 = [$magicb2, hkn_tur_magb3] { ai_face (); F () };
+ void() hkn_tur_magb3 = [$magicb3, hkn_tur_magb4] { ai_face (); F () };
+ void() hkn_tur_magb4 = [$magicb4, hkn_tur_magb5] { ai_face (); F () };
+ void() hkn_tur_magb5 = [$magicb5, hkn_tur_magb6] { ai_face (); F () };
+ void() hkn_tur_magb6 = [$magicb6, hkn_tur_magb7] { ai_face (); F () };
+ void() hkn_tur_magb7 = [$magicb7, hkn_tur_magb8] { ai_face (); F () };
+ void() hkn_tur_magb8 = [$magicb8, hkn_tur_magb9] { ai_face (); F () };
+ void() hkn_tur_magb9 = [$magicb9, hkn_tur_magb10] { ai_face (); F () };
void() hkn_tur_magb10 = [$magicb10, hkn_tur_magb11]
{
ai_face ();
- sound_misc2 (self, CHAN_WEAPON, "shambler/sboom.wav",
+ sound (self, CHAN_WEAPON, "shambler/sboom.wav",
VOL_HIGH, ATTN_NORM);
monster_hell_knight_attack_lightning ();
+ F ()
};
- void() hkn_tur_magb11 = [$magicb11, hkn_tur_magb12] { ai_face (); };
- void() hkn_tur_magb12 = [$magicb12, hkn_tur_magb13] { ai_face (); };
- void() hkn_tur_magb13 = [$magicb13, hkn_seek_stand1] { ai_face (); };
+ void() hkn_tur_magb11 = [$magicb11, hkn_tur_magb12] { ai_face (); F()};
+ void() hkn_tur_magb12 = [$magicb12, hkn_tur_magb13] { ai_face (); F()};
+ void() hkn_tur_magb13 = [$magicb13, hkn_seek_stand1] { ai_face (); F()};
//--------------------------------------------------------------
// Death Knight Turret Magic C (fnames shortened -- CEV)
//--------------------------------------------------------------
- void() hkn_tur_magc1 = [$magicc1, hkn_tur_magc2] { ai_face (); };
- void() hkn_tur_magc2 = [$magicc2, hkn_tur_magc3] { ai_face (); };
- void() hkn_tur_magc3 = [$magicc3, hkn_tur_magc4] { ai_face (); };
- void() hkn_tur_magc4 = [$magicc4, hkn_tur_magc5] { ai_face (); };
- void() hkn_tur_magc5 = [$magicc5, hkn_tur_magc6] { ai_face (); };
+ void() hkn_tur_magc1 = [$magicc1, hkn_tur_magc2] { ai_face (); F () };
+ void() hkn_tur_magc2 = [$magicc2, hkn_tur_magc3] { ai_face (); F () };
+ void() hkn_tur_magc3 = [$magicc3, hkn_tur_magc4] { ai_face (); F () };
+ void() hkn_tur_magc4 = [$magicc4, hkn_tur_magc5] { ai_face (); F () };
+ void() hkn_tur_magc5 = [$magicc5, hkn_tur_magc6] { ai_face (); F () };
void() hkn_tur_magc6 = [$magicc6, hkn_tur_magc7]
{
monster_hell_knight_attack_shot (-2);
+ F ()
};
void() hkn_tur_magc7 = [$magicc7, hkn_tur_magc8]
{
monster_hell_knight_attack_shot (-1);
+ F ()
};
void() hkn_tur_magc8 = [$magicc8, hkn_tur_magc9]
{
monster_hell_knight_attack_shot (0);
+ F ()
};
void() hkn_tur_magc9 = [$magicc9, hkn_tur_magc10]
{
monster_hell_knight_attack_shot (1);
+ F ()
};
void() hkn_tur_magc10 = [$magicc10, hkn_tur_magc11]
{
monster_hell_knight_attack_shot (2);
+ F ()
};
- void() hkn_tur_magc11 = [$magicc11, hkn_tur_magc12] { ai_face (); };
- void() hkn_tur_magc12 = [$stand1, hkn_tur_magc13] { ai_face (); };
- void() hkn_tur_magc13 = [$stand2, hkn_tur_magc14] { ai_face (); };
- void() hkn_tur_magc14 = [$stand3, hkn_tur_magc15] { ai_face (); };
- void() hkn_tur_magc15 = [$stand4, hkn_seek_stand1] { ai_run (0); };
+ void() hkn_tur_magc11 = [$magicc11, hkn_tur_magc12] { ai_face (); F ()};
+ void() hkn_tur_magc12 = [$stand1, hkn_tur_magc13] { ai_face (); F () };
+ void() hkn_tur_magc13 = [$stand2, hkn_tur_magc14] { ai_face (); F () };
+ void() hkn_tur_magc14 = [$stand3, hkn_tur_magc15] { ai_face (); F () };
+ void() hkn_tur_magc15 = [$stand4, hkn_seek_stand1] { ai_run (0); F () };
/////////////////////////////////////////////
////// turret frames END //////
@@ -796,13 +900,14 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//--------------------------------------------------------------
void() hkn_pain1 = [$pain1, hkn_pain2]
{
- sound_pain (self, CHAN_VOICE, "hknight/pain1.wav",
+ sound (self, CHAN_VOICE, "hknight/pain1.wav",
VOL_HIGH, ATTN_NORM);
+ F ()
};
- void() hkn_pain2 = [$pain2, hkn_pain3] { };
- void() hkn_pain3 = [$pain3, hkn_pain4] { };
- void() hkn_pain4 = [$pain4, hkn_pain5] { };
- void() hkn_pain5 = [$pain5, hkn_run1] { };
+ void() hkn_pain2 = [$pain2, hkn_pain3] { F () };
+ void() hkn_pain3 = [$pain3, hkn_pain4] { F () };
+ void() hkn_pain4 = [$pain4, hkn_pain5] { F () };
+ void() hkn_pain5 = [$pain5, hkn_run1] { F () };
//--------------------------------------------------------------
// Death Knight death state A
@@ -811,27 +916,37 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
{
ai_forward (10);
base_entity_aligntoground (self);
+ F ()
};
- void() hkn_die2 = [$death2, hkn_die3] { ai_forward (8); };
+ void() hkn_die2 = [$death2, hkn_die3] { ai_forward (8); F () };
void() hkn_die3 = [$death3, hkn_die4]
{
self.solid = SOLID_NOT;
ai_forward (7);
- };
- void() hkn_die4 = [$death4, hkn_die5] { };
- void() hkn_die5 = [$death5, hkn_die6] { };
- void() hkn_die6 = [$death6, hkn_die7] { };
- void() hkn_die7 = [$death7, hkn_die8] { };
- void() hkn_die8 = [$death8, hkn_die9] { ai_forward (10); };
- void() hkn_die9 = [$death9, hkn_die10] { ai_forward (11); };
- void() hkn_die10 = [$death10, hkn_die11] { };
+ F ()
+ };
+ void() hkn_die4 = [$death4, hkn_die5] { F () };
+ void() hkn_die5 = [$death5, hkn_die6] { F () };
+ void() hkn_die6 = [$death6, hkn_die7] { F () };
+ void() hkn_die7 = [$death7, hkn_die8] { F () };
+ void() hkn_die8 = [$death8, hkn_die9] { ai_forward (10); F () };
+ void() hkn_die9 = [$death9, hkn_die10] { ai_forward (11); F () };
+ void() hkn_die10 = [$death10, hkn_die11] { F () };
void() hkn_die11 = [$death11, hkn_die12]
{
become_base_corpse (self, HELL_KNIGHT_HEALTH_CORPSE);
setsize (self, HELL_KNIGHT_CORPSE_Z_MINS,
HELL_KNIGHT_CORPSE_Z_MAXS);
+ F ()
};
- void() hkn_die12 = [$death12, hkn_die12] { };
+ void() hkn_die12 = [$death12, hkn_die12]
+ {
+ if (self.origin != self.origin_net)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_FRAME;
+ else if (self.frame_net != self.frame)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
+ };
//--------------------------------------------------------------
// Death Knight death state B
@@ -839,23 +954,35 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() hkn_dieb1 = [$deathb1, hkn_dieb2]
{
base_entity_aligntoground (self);
+ F ()
};
- void() hkn_dieb2 = [$deathb2, hkn_dieb3] { };
+ void() hkn_dieb2 = [$deathb2, hkn_dieb3] { F () };
void() hkn_dieb3 = [$deathb3, hkn_dieb4]
{
self.solid = SOLID_NOT;
+ F ()
};
- void() hkn_dieb4 = [$deathb4, hkn_dieb5] { };
- void() hkn_dieb5 = [$deathb5, hkn_dieb6] { };
- void() hkn_dieb6 = [$deathb6, hkn_dieb7] { };
- void() hkn_dieb7 = [$deathb7, hkn_dieb8] { };
+ void() hkn_dieb4 = [$deathb4, hkn_dieb5] { F () };
+ void() hkn_dieb5 = [$deathb5, hkn_dieb6] { F () };
+ void() hkn_dieb6 = [$deathb6, hkn_dieb7] { F () };
+ void() hkn_dieb7 = [$deathb7, hkn_dieb8] { F () };
void() hkn_dieb8 = [$deathb8, hkn_dieb9]
{
become_base_corpse (self, HELL_KNIGHT_HEALTH_CORPSE);
setsize (self, HELL_KNIGHT_CORPSE_Z_MINS,
HELL_KNIGHT_CORPSE_Z_MAXS);
+ F ()
};
- void() hkn_dieb9 = [$deathb9, hkn_dieb9] { };
+ void() hkn_dieb9 = [$deathb9, hkn_dieb9]
+ {
+ if (self.origin != self.origin_net)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_FRAME;
+ else if (self.frame_net != self.frame)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
+ };
+
+ #undef F
//==============================================================
// Interaction
@@ -873,19 +1000,19 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
if (self.pain_finished > time)
return;
- if (self.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_TURRET)
{
if (r < 0.5)
{
self.pain_finished = time + 1.5;
- sound_pain (self, CHAN_VOICE,
+ sound (self, CHAN_VOICE,
"hknight/pain1.wav",
VOL_HIGH, ATTN_NORM);
}
return;
}
- sound_pain (self, CHAN_VOICE, "hknight/pain1.wav",
+ sound (self, CHAN_VOICE, "hknight/pain1.wav",
VOL_HIGH, ATTN_NORM);
if (time - self.pain_finished > 5)
@@ -909,37 +1036,27 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//--------------------------------------------------------------
void(vector dir) monster_hell_knight_destroy =
{
- // check if we're dead already
- if (self.classgroup & CG_CORPSE)
- {
- sound (self, CHAN_VOICE, "player/udeath.wav",
- VOL_HIGH, ATTN_NORM);
-
- throw_gib_head_hell_knight (self, dir, self.health);
- throw_gib_1 (self, dir, self.health);
- throw_gib_2 (self, dir, self.health);
- throw_gib_3 (self, dir, self.health);
-
- return;
- }
-
// check for gib
- if (self.health < -40)
+ if (self.classgroup & CG_CORPSE || self.health < -40)
{
sound (self, CHAN_VOICE, "player/udeath.wav",
VOL_HIGH, ATTN_NORM);
- throw_gib_head_hell_knight (self, dir, self.health);
- throw_gib_1 (self, dir, self.health);
- throw_gib_2 (self, dir, self.health);
- throw_gib_3 (self, dir, self.health);
+ if (!(self.classgroup & CG_CORPSE))
+ base_item_drop_stuff (self);
+
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib1_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib2_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib3_init)
+ BASE_ITEM_GIB_THROW (dir, self.health,
+ item_head_hell_knight_init)
- base_item_drop_stuff (self);
+ base_entity_remove (self);
return;
}
// regular death
- sound_death (self, CHAN_VOICE, "hknight/death1.wav",
+ sound (self, CHAN_VOICE, "hknight/death1.wav",
VOL_HIGH, ATTN_NORM);
base_item_drop_stuff (self);
if (random() > 0.5)
@@ -953,64 +1070,65 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//==============================================================
//--------------------------------------------------------------
- entity(vector org, vector ang, float sflags, float yaw, float angry)
+ entity(vector org, vector ang, float sflags, float yaw)
spawn_monster_hell_knight =
{
- return spawn_base_monster (org, ang, sflags, yaw, angry,
+ return spawn_base_monster (org, ang, sflags, yaw,
monster_hell_knight_init);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) monster_hell_knight_init =
{
+ #ifdef SSQC
if (deathmatch)
{
remove (e);
return;
}
+ #endif
e.classname = "monster_hell_knight";
e.classtype = CT_MONSTER_DEATHKNIGHT;
+ e.pos1 = HELL_KNIGHT_MINS;
+ e.pos2 = HELL_KNIGHT_MAXS;
+
+ #ifdef CSQC
+ if (e.modelindex)
+ {
+ setmodelindex (e, e.modelindex);
+ setsize (e, HELL_KNIGHT_MINS, HELL_KNIGHT_MAXS);
+ }
+ #endif
+ #ifdef SSQC
precache_model2 ("progs/hknight.mdl");
precache_model2 ("progs/k_spike.mdl");
precache_model2 ("progs/k_spike2.mdl");
precache_model2 ("progs/h_hellkn.mdl");
- // dumptruck_ds custom_mdls
- precache_body_model2 (e, "progs/hknight.mdl");
- precache_head_model2 (e, "progs/h_hellkn.mdl");
- precache_proj_model2 (e, "progs/k_spike.mdl");
- // this needed a unique name defined in custom_mdls.qc
- // -- dumptruck_ds
- precache_exproj_model2 (e, "progs/k_spike2.mdl");
- // dumptruck_ds
-
- precache_sound2_attack (e, "hknight/attack1.wav");
- precache_sound2_death (e, "hknight/death1.wav");
- precache_sound2_pain (e, "hknight/pain1.wav");
- precache_sound2_sight (e, "hknight/sight1.wav");
+
+ precache_sound2 ("hknight/attack1.wav");
+ precache_sound2 ("hknight/death1.wav");
+ precache_sound2 ("hknight/pain1.wav");
+ precache_sound2 ("hknight/sight1.wav");
// used by C code, so don't sound2
precache_sound ("hknight/hit.wav");
- precache_sound2_misc (e, "hknight/slash1.wav");
- precache_sound2_idle (e, "hknight/idle.wav");
- // what??? never knew about e! -- dumptruck_ds
+ precache_sound2 ("hknight/slash1.wav");
+ precache_sound2 ("hknight/idle.wav");
+ // what??? never knew about this! -- dumptruck_ds
precache_sound2 ("hknight/grunt.wav");
precache_sound ("knight/sword1.wav");
precache_sound ("knight/sword2.wav");
- precache_gib1 (e, "progs/gib1.mdl");
- precache_gib2 (e, "progs/gib2.mdl");
- precache_gib3 (e, "progs/gib3.mdl");
+ precache_model ("progs/gib1.mdl");
+ precache_model ("progs/gib2.mdl");
+ precache_model ("progs/gib3.mdl");
- e.solid = SOLID_SLIDEBOX;
- e.movetype = MOVETYPE_STEP;
-
- // custom_mdls dumptruck_ds
- body_model (e, "progs/hknight.mdl");
- // setmodel (e, "progs/hknight.mdl");
-
- setsize (e, '-16 -16 -24', '16 16 40');
+ // set up model and size for later -- CEV
+ e.mdl = "progs/hknight.mdl";
// thanks RennyC -- dumptruck_ds
if (!e.health)
@@ -1019,10 +1137,11 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
if (!e.proj_speed_mod)
e.proj_speed_mod = 1;
+ e.destroy = monster_hell_knight_destroy;
e.sightsound = monster_hell_knight_sightsound;
e.th_stand = hkn_stand1;
e.th_walk = hkn_walk1;
- if (e.spawnflags & I_AM_TURRET)
+ if (e.spawnflags & SPAWNFLAG_MONSTER_TURRET)
e.th_run = hkn_seek_stand1;
else
e.th_run = hkn_run1;
@@ -1037,88 +1156,36 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
e.th_missile = hkn_magicc1;
e.th_turret = hkn_tur_magc1;
}
- // Berserk test from
- // http://celephais.net/board/view_thread.php?id=4&start=3465
- // -- dumptruck_ds
- if !(e.berserk)
- e.th_pain = monster_hell_knight_pain;
- else
+
+ // changed berserk test from field to flag -- CEV
+ if (self.spawnflags & SPAWNFLAG_MONSTER_BERSERK)
e.th_pain = sub_nullpain;
- e.destroy = monster_hell_knight_destroy;
+ else
+ e.th_pain = monster_hell_knight_pain;
+ #endif
- // walkmonster_start
- base_walkmonster_init (e);
+ // InitMonster -- runs on both client & server -- CEV
+ base_monster_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() monster_hell_knight =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags & fields, inhibit if necessary -- CEV
+ BASE_MONSTER_PREINIT (base_monster_init_field)
monster_hell_knight_init (self);
};
+#endif
// };
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-/*QUAKED gib_head_hell_knight (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/h_hellkn.mdl");
-}*/
-//----------------------------------------------------------------------
-// class gib_head_hell_knight: base_gib_head
-// {
- //--------------------------------------------------------------
- // ThrowHead
- //--------------------------------------------------------------
- void(entity act, vector dir, float dmg) throw_gib_head_hell_knight =
- {
- base_gib_head_throw (act, dir, dmg, gib_head_hell_knight_init);
- };
-
- //--------------------------------------------------------------
- void(entity e) gib_head_hell_knight_init =
- {
- e.classname = "gib_head_hell_knight";
- e.classtype = CT_GORE_HEAD_HELL_KNIGHT;
-
- // gib_init interprets spawnflags and will set .solid -- CEV
- base_gib_head_init (e);
-
- if (e.mdl_head != "")
- {
- precache_model (e.mdl_head);
- setmodel (e, e.mdl_head);
- }
- else
- {
- precache_model ("progs/h_hellkn.mdl");
- setmodel (e, "progs/h_hellkn.mdl");
- if (e.solid == SOLID_BBOX)
- setsize (e, HELL_KNIGHT_HEAD_MINS,
- HELL_KNIGHT_HEAD_MAXS);
- else if (e.solid == SOLID_TRIGGER)
- setsize (e, '-16 -16 0', '16 16 56');
- }
-
- e.frame = 0;
- };
-
- //--------------------------------------------------------------
- void() gib_head_hell_knight =
- {
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- gib_head_hell_knight_init (self);
- };
-// };
-
+#ifdef SSQC
/*QUAKED monster_dead_hell_knight (0 0.5 0.8) (-16 -16 -24) (16 16 32) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ({"path":"progs/hknight.mdl","frame":62});
@@ -1135,6 +1202,7 @@ model ("progs/h_hellkn.mdl");
precache_model ("progs/hknight.mdl");
setmodel (e, "progs/hknight.mdl");
+ // TODO CEV
if (e.spawnflags & 2)
{
e.frame = $deathb9;
@@ -1163,3 +1231,8 @@ model ("progs/h_hellkn.mdl");
monster_dead_hell_knight_init (self);
};
// };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+$flush
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/monsters/knight.qc
diff --git a/qc/monsters/knight.qc b/qc/monsters/knight.qc
index 9227c72..115cad2 100644
--- a/qc/monsters/knight.qc
+++ b/qc/monsters/knight.qc
@@ -6,25 +6,34 @@
// constants
//======================================================================
+#ifdef SSQC
const float KNIGHT_HEALTH = 75; // id1 75
const float KNIGHT_HEALTH_CORPSE = 60;
+#endif
-const vector KNIGHT_HEAD_MINS = '-8.17 -7.47 -0.13';
-const vector KNIGHT_HEAD_MAXS = '8.36 6.5 30';
+#if defined(CSQC) || defined(SSQC)
+const vector KNIGHT_MINS = '-16 -16 -24';
+const vector KNIGHT_MAXS = '16 16 40';
const vector KNIGHT_CORPSE_MINS = '-25.56 -14.56 -50.49';
const vector KNIGHT_CORPSE_MAXS = '26.45 40.2 30';
const vector KNIGHT_CORPSE_B_MINS = '-30.36 -45.6 -50.18';
const vector KNIGHT_CORPSE_B_MAXS = '28.29 11.59 30';
const vector KNIGHT_CORPSE_Z_MINS = '-16 -16 -24';
const vector KNIGHT_CORPSE_Z_MAXS = '16 16 -8';
+#endif
//======================================================================
// forward declarations
//======================================================================
// monster_knight
+#ifdef CSQC
+void(float isnew) monster_knight_netreceive;
+#endif
+#ifdef SSQC
void() monster_knight_sightsound; // AI & attacks
void() monster_knight_attack; // animation & thinking below
+// F() // macro to set FRAME netflag -- CEV
void() kn_stand1; void() kn_stand2; void() kn_stand3; void() kn_stand4;
void() kn_stand5; void() kn_stand6; void() kn_stand7; void() kn_stand8;
void() kn_stand9;
@@ -55,24 +64,27 @@ void() kn_dieb5; void() kn_dieb6; void() kn_dieb7; void() kn_dieb8;
void() kn_dieb9; void() kn_dieb10; void() kn_dieb11;
void(entity attacker, float damage) monster_knight_pain; // interaction
void(vector dir) monster_knight_destroy;
-entity(vector org, vector ang, float sflags, float yaw, float angry)
+entity(vector org, vector ang, float sflags, float yaw)
spawn_monster_knight; // initialization
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) monster_knight_init;
+#endif
+#ifdef SSQC
void() monster_knight;
+#endif
-// gib_head_knight
-void(entity act, vector dir, float dmg) throw_gib_head_knight;
-void(entity e) gib_head_knight_init
-void() gib_head_knight;
-
+#ifdef SSQC
// monster_dead_knight
void(entity e) monster_dead_knight_init;
void() monster_dead_knight;
+#endif
//======================================================================
// frame macros
//======================================================================
+#if defined(CSQC) || defined(SSQC)
$cd id1/models/knight
$origin 0 0 24
$base base
@@ -113,6 +125,11 @@ $frame death9 death10
$frame deathb1 deathb2 deathb3 deathb4 deathb5 deathb6 deathb7 deathb8
$frame deathb9 deathb10 deathb11
+// MG1 compat -- CEV
+const float CORPSEFRAME_KNIGHT_1 = $death10;
+const float CORPSEFRAME_KNIGHT_2 = $deathb11;
+#endif
+
//------------------------------------------------------------------------------
/*QUAKED monster_knight (1 0 0) (-16 -16 -24) (16 16 40) AMBUSH X X TRIGGER_SPAWNED X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
@@ -174,12 +191,37 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
*/
//----------------------------------------------------------------------
-// class monster_knight: base_walkmonster
+// class monster_knight: base_monster
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) monster_knight_netreceive =
+ {
+ // creates the newframe and netflags variables -- CEV
+ BASE_MONSTER_NETRECEIVE (monster_knight_init,
+ KNIGHT_MINS, KNIGHT_MAXS)
+
+ if (isnew)
+ base_entity_que_add (self, QUE_TYPE_ACTOR);
+
+ if (self.frame >= $death3 && self.frame <= $death10)
+ {
+ if (self.solid != SOLID_NOT)
+ self.solid = SOLID_NOT;
+ }
+ else if (self.frame >= $deathb3 && self.frame <= $deathb11)
+ {
+ if (self.solid != SOLID_NOT)
+ self.solid = SOLID_NOT;
+ }
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
void() monster_knight_sightsound =
{
- sound_sight (self, CHAN_VOICE, "knight/ksight.wav",
+ sound (self, CHAN_VOICE, "knight/ksight.wav",
VOL_HIGH, ATTN_NORM);
};
@@ -201,17 +243,24 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
};
//--------------------------------------------------------------
+ #define F() \
+ { \
+ if (!(self.SendFlags & NETFLAG_BASE_ENTITY_FRAME)) \
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME; \
+ } \
+
+ //--------------------------------------------------------------
// Knight Standing functions
//--------------------------------------------------------------
- void() kn_stand1 = [$stand1, kn_stand2] { ai_stand (); };
- void() kn_stand2 = [$stand2, kn_stand3] { ai_stand (); };
- void() kn_stand3 = [$stand3, kn_stand4] { ai_stand (); };
- void() kn_stand4 = [$stand4, kn_stand5] { ai_stand (); };
- void() kn_stand5 = [$stand5, kn_stand6] { ai_stand (); };
- void() kn_stand6 = [$stand6, kn_stand7] { ai_stand (); };
- void() kn_stand7 = [$stand7, kn_stand8] { ai_stand (); };
- void() kn_stand8 = [$stand8, kn_stand9] { ai_stand (); };
- void() kn_stand9 = [$stand9, kn_stand1] { ai_stand (); };
+ void() kn_stand1 = [$stand1, kn_stand2] { ai_stand (); F () };
+ void() kn_stand2 = [$stand2, kn_stand3] { ai_stand (); F () };
+ void() kn_stand3 = [$stand3, kn_stand4] { ai_stand (); F () };
+ void() kn_stand4 = [$stand4, kn_stand5] { ai_stand (); F () };
+ void() kn_stand5 = [$stand5, kn_stand6] { ai_stand (); F () };
+ void() kn_stand6 = [$stand6, kn_stand7] { ai_stand (); F () };
+ void() kn_stand7 = [$stand7, kn_stand8] { ai_stand (); F () };
+ void() kn_stand8 = [$stand8, kn_stand9] { ai_stand (); F () };
+ void() kn_stand9 = [$stand9, kn_stand1] { ai_stand (); F () };
//--------------------------------------------------------------
// Knight Walking functions
@@ -219,23 +268,24 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() kn_walk1 = [$walk1, kn_walk2]
{
if (random() < 0.2)
- sound_idle (self, CHAN_VOICE, "knight/idle.wav",
+ sound (self, CHAN_VOICE, "knight/idle.wav",
VOL_HIGH, ATTN_IDLE);
ai_walk (3);
+ F ()
};
- void() kn_walk2 = [$walk2, kn_walk3] { ai_walk (2); };
- void() kn_walk3 = [$walk3, kn_walk4] { ai_walk (3); };
- void() kn_walk4 = [$walk4, kn_walk5] { ai_walk (4); };
- void() kn_walk5 = [$walk5, kn_walk6] { ai_walk (3); };
- void() kn_walk6 = [$walk6, kn_walk7] { ai_walk (3); };
- void() kn_walk7 = [$walk7, kn_walk8] { ai_walk (3); };
- void() kn_walk8 = [$walk8, kn_walk9] { ai_walk (4); };
- void() kn_walk9 = [$walk9, kn_walk10] { ai_walk (3); };
- void() kn_walk10 = [$walk10, kn_walk11] { ai_walk (3); };
- void() kn_walk11 = [$walk11, kn_walk12] { ai_walk (2); };
- void() kn_walk12 = [$walk12, kn_walk13] { ai_walk (3); };
- void() kn_walk13 = [$walk13, kn_walk14] { ai_walk (4); };
- void() kn_walk14 = [$walk14, kn_walk1] { ai_walk (3); };
+ void() kn_walk2 = [$walk2, kn_walk3] { ai_walk (2); F () };
+ void() kn_walk3 = [$walk3, kn_walk4] { ai_walk (3); F () };
+ void() kn_walk4 = [$walk4, kn_walk5] { ai_walk (4); F () };
+ void() kn_walk5 = [$walk5, kn_walk6] { ai_walk (3); F () };
+ void() kn_walk6 = [$walk6, kn_walk7] { ai_walk (3); F () };
+ void() kn_walk7 = [$walk7, kn_walk8] { ai_walk (3); F () };
+ void() kn_walk8 = [$walk8, kn_walk9] { ai_walk (4); F () };
+ void() kn_walk9 = [$walk9, kn_walk10] { ai_walk (3); F () };
+ void() kn_walk10 = [$walk10, kn_walk11] { ai_walk (3); F () };
+ void() kn_walk11 = [$walk11, kn_walk12] { ai_walk (2); F () };
+ void() kn_walk12 = [$walk12, kn_walk13] { ai_walk (3); F () };
+ void() kn_walk13 = [$walk13, kn_walk14] { ai_walk (4); F () };
+ void() kn_walk14 = [$walk14, kn_walk1] { ai_walk (3); F () };
//--------------------------------------------------------------
// Knight Running functions
@@ -243,17 +293,18 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() kn_run1 = [$runb1, kn_run2]
{
if (random() < 0.2)
- sound_idle (self, CHAN_VOICE, "knight/idle.wav",
+ sound (self, CHAN_VOICE, "knight/idle.wav",
VOL_HIGH, ATTN_IDLE);
ai_run (16);
+ F ()
};
- void() kn_run2 = [ $runb2, kn_run3] { ai_run (20); };
- void() kn_run3 = [ $runb3, kn_run4] { ai_run (13); };
- void() kn_run4 = [ $runb4, kn_run5] { ai_run (7); };
- void() kn_run5 = [ $runb5, kn_run6] { ai_run (16); };
- void() kn_run6 = [ $runb6, kn_run7] { ai_run (20); };
- void() kn_run7 = [ $runb7, kn_run8] { ai_run (14); };
- void() kn_run8 = [ $runb8, kn_run1] { ai_run (6); };
+ void() kn_run2 = [ $runb2, kn_run3] { ai_run (20); F () };
+ void() kn_run3 = [ $runb3, kn_run4] { ai_run (13); F () };
+ void() kn_run4 = [ $runb4, kn_run5] { ai_run (7); F () };
+ void() kn_run5 = [ $runb5, kn_run6] { ai_run (16); F () };
+ void() kn_run6 = [ $runb6, kn_run7] { ai_run (20); F () };
+ void() kn_run7 = [ $runb7, kn_run8] { ai_run (14); F () };
+ void() kn_run8 = [ $runb8, kn_run1] { ai_run (6); F () };
//--------------------------------------------------------------
// Knight Running Attack
@@ -261,94 +312,99 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() kn_runatk1 = [$runattack1, kn_runatk2]
{
if (random() > 0.5)
- sound_misc (self, CHAN_WEAPON, "knight/sword2.wav",
+ sound (self, CHAN_WEAPON, "knight/sword2.wav",
VOL_HIGH, ATTN_NORM);
else
- sound_attack (self, CHAN_WEAPON, "knight/sword1.wav",
+ sound (self, CHAN_WEAPON, "knight/sword1.wav",
VOL_HIGH, ATTN_NORM);
ai_charge (20);
+ F ()
};
- void() kn_runatk2 = [$runattack2, kn_runatk3] { ai_charge_side (); };
- void() kn_runatk3 = [$runattack3, kn_runatk4] { ai_charge_side (); };
- void() kn_runatk4 = [$runattack4, kn_runatk5] { ai_charge_side (); };
- void() kn_runatk5 = [$runattack5, kn_runatk6] { ai_melee_side (); };
- void() kn_runatk6 = [$runattack6, kn_runatk7] { ai_melee_side (); };
- void() kn_runatk7 = [$runattack7, kn_runatk8] { ai_melee_side (); };
- void() kn_runatk8 = [$runattack8, kn_runatk9] { ai_melee_side (); };
- void() kn_runatk9 = [$runattack9, kn_runatk10] { ai_melee_side (); };
- void() kn_runatk10 = [$runattack10, kn_runatk11] { ai_charge_side (); };
- void() kn_runatk11 = [$runattack11, kn_run1] { ai_charge (10); };
+ void() kn_runatk2 = [$runattack2, kn_runatk3] { ai_charge_side (); F()};
+ void() kn_runatk3 = [$runattack3, kn_runatk4] { ai_charge_side (); F()};
+ void() kn_runatk4 = [$runattack4, kn_runatk5] { ai_charge_side (); F()};
+ void() kn_runatk5 = [$runattack5, kn_runatk6] { ai_melee_side (); F ()};
+ void() kn_runatk6 = [$runattack6, kn_runatk7] { ai_melee_side (); F ()};
+ void() kn_runatk7 = [$runattack7, kn_runatk8] { ai_melee_side (); F ()};
+ void() kn_runatk8 = [$runattack8, kn_runatk9] { ai_melee_side (); F ()};
+ void() kn_runatk9 = [$runattack9, kn_runatk10] { ai_melee_side (); F()};
+ void() kn_runatk10 = [$runattack10, kn_runatk11] {ai_charge_side();F()};
+ void() kn_runatk11 = [$runattack11, kn_run1] { ai_charge (10); F () };
//--------------------------------------------------------------
// Knight Attack
//--------------------------------------------------------------
void() kn_atk1 = [$attackb1, kn_atk2]
{
- sound_attack (self, CHAN_WEAPON, "knight/sword1.wav",
+ sound (self, CHAN_WEAPON, "knight/sword1.wav",
VOL_HIGH, ATTN_NORM);
ai_charge (0);
+ F ()
};
- void() kn_atk2 = [$attackb2, kn_atk3] { ai_charge (7); };
- void() kn_atk3 = [$attackb3, kn_atk4] { ai_charge (4); };
- void() kn_atk4 = [$attackb4, kn_atk5] { ai_charge (0); };
- void() kn_atk5 = [$attackb5, kn_atk6] { ai_charge (3); };
+ void() kn_atk2 = [$attackb2, kn_atk3] { ai_charge (7); F () };
+ void() kn_atk3 = [$attackb3, kn_atk4] { ai_charge (4); F () };
+ void() kn_atk4 = [$attackb4, kn_atk5] { ai_charge (0); F () };
+ void() kn_atk5 = [$attackb5, kn_atk6] { ai_charge (3); F () };
void() kn_atk6 = [$attackb6, kn_atk7]
{
ai_charge (4);
ai_melee ();
+ F ()
};
void() kn_atk7 = [$attackb7, kn_atk8]
{
ai_charge (1);
ai_melee ();
+ F ()
};
void() kn_atk8 = [$attackb8, kn_atk9]
{
ai_charge (3);
ai_melee ();
+ F ()
};
- void() kn_atk9 = [$attackb9, kn_atk10] { ai_charge (1); };
- void() kn_atk10 = [$attackb10, kn_run1] { ai_charge (5); };
+ void() kn_atk9 = [$attackb9, kn_atk10] { ai_charge (1); F () };
+ void() kn_atk10 = [$attackb10, kn_run1] { ai_charge (5); F () };
- // void() kn_atk9 = [$attack9, kn_atk10] { };
- // void() kn_atk10 = [$attack10, kn_atk11] { };
- // void() kn_atk11 = [$attack11, kn_run1] { };
+ // void() kn_atk9 = [$attack9, kn_atk10] { F () };
+ // void() kn_atk10 = [$attack10, kn_atk11] { F () };
+ // void() kn_atk11 = [$attack11, kn_run1] { F () };
//--------------------------------------------------------------
// Knight Bowing / Kneeling state
//--------------------------------------------------------------
- void() kn_bow1 = [$kneel1, kn_bow2] { ai_turn (); };
- void() kn_bow2 = [$kneel2, kn_bow3] { ai_turn (); };
- void() kn_bow3 = [$kneel3, kn_bow4] { ai_turn (); };
- void() kn_bow4 = [$kneel4, kn_bow5] { ai_turn (); };
- void() kn_bow5 = [$kneel5, kn_bow5] { ai_turn (); };
- void() kn_bow6 = [$kneel4, kn_bow7] { ai_turn (); };
- void() kn_bow7 = [$kneel3, kn_bow8] { ai_turn (); };
- void() kn_bow8 = [$kneel2, kn_bow9] { ai_turn (); };
- void() kn_bow9 = [$kneel1, kn_bow10] { ai_turn (); };
- void() kn_bow10 = [$walk1, kn_walk1] { ai_turn (); };
+ void() kn_bow1 = [$kneel1, kn_bow2] { ai_turn (); F () };
+ void() kn_bow2 = [$kneel2, kn_bow3] { ai_turn (); F () };
+ void() kn_bow3 = [$kneel3, kn_bow4] { ai_turn (); F () };
+ void() kn_bow4 = [$kneel4, kn_bow5] { ai_turn (); F () };
+ void() kn_bow5 = [$kneel5, kn_bow5] { ai_turn (); F () };
+ void() kn_bow6 = [$kneel4, kn_bow7] { ai_turn (); F () };
+ void() kn_bow7 = [$kneel3, kn_bow8] { ai_turn (); F () };
+ void() kn_bow8 = [$kneel2, kn_bow9] { ai_turn (); F () };
+ void() kn_bow9 = [$kneel1, kn_bow10] { ai_turn (); F () };
+ void() kn_bow10 = [$walk1, kn_walk1] { ai_turn (); F () };
//--------------------------------------------------------------
// Knight Pain state A
//--------------------------------------------------------------
- void() kn_pain1 = [$pain1, kn_pain2] { };
- void() kn_pain2 = [$pain2, kn_pain3] { };
- void() kn_pain3 = [$pain3, kn_run1] { };
+ void() kn_pain1 = [$pain1, kn_pain2] { F () };
+ void() kn_pain2 = [$pain2, kn_pain3] { F () };
+ void() kn_pain3 = [$pain3, kn_run1] { F () };
//--------------------------------------------------------------
// Knight Pain state B
//--------------------------------------------------------------
- void() kn_painb1 = [$painb1, kn_painb2] { ai_painforward (0); };
- void() kn_painb2 = [$painb2, kn_painb3] { ai_painforward (3); };
- void() kn_painb3 = [$painb3, kn_painb4] { };
- void() kn_painb4 = [$painb4, kn_painb5] { };
- void() kn_painb5 = [$painb5, kn_painb6] { ai_painforward (2); };
- void() kn_painb6 = [$painb6, kn_painb7] { ai_painforward (4); };
- void() kn_painb7 = [$painb7, kn_painb8] { ai_painforward (2); };
- void() kn_painb8 = [$painb8, kn_painb9] { ai_painforward (5); };
- void() kn_painb9 = [$painb9, kn_painb10] { ai_painforward (5); };
- void() kn_painb10 = [$painb10, kn_painb11] { ai_painforward (0); };
- void() kn_painb11 = [$painb11, kn_run1] { };
+ void() kn_painb1 = [$painb1, kn_painb2] { ai_painforward (0); F () };
+ void() kn_painb2 = [$painb2, kn_painb3] { ai_painforward (3); F () };
+ void() kn_painb3 = [$painb3, kn_painb4] { F () };
+ void() kn_painb4 = [$painb4, kn_painb5] { F () };
+ void() kn_painb5 = [$painb5, kn_painb6] { ai_painforward (2); F () };
+ void() kn_painb6 = [$painb6, kn_painb7] { ai_painforward (4); F () };
+ void() kn_painb7 = [$painb7, kn_painb8] { ai_painforward (2); F () };
+ void() kn_painb8 = [$painb8, kn_painb9] { ai_painforward (5); F () };
+ void() kn_painb9 = [$painb9, kn_painb10] { ai_painforward (5); F () };
+ void() kn_painb10 = [$painb10, kn_painb11] { ai_painforward (0); F () };
+ void() kn_painb11 = [$painb11, kn_run1] { F () };
//--------------------------------------------------------------
// Knight Death state A
@@ -356,20 +412,33 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() kn_die1 = [$death1, kn_die2]
{
base_entity_aligntoground (self);
+ F ()
+ };
+ void() kn_die2 = [$death2, kn_die3] { F () };
+ void() kn_die3 = [$death3, kn_die4]
+ {
+ self.solid = SOLID_NOT;
+ F ()
};
- void() kn_die2 = [$death2, kn_die3] { };
- void() kn_die3 = [$death3, kn_die4] { self.solid = SOLID_NOT; };
- void() kn_die4 = [$death4, kn_die5] { };
- void() kn_die5 = [$death5, kn_die6] { };
- void() kn_die6 = [$death6, kn_die7] { };
- void() kn_die7 = [$death7, kn_die8] { };
- void() kn_die8 = [$death8, kn_die9] { };
+ void() kn_die4 = [$death4, kn_die5] { F () };
+ void() kn_die5 = [$death5, kn_die6] { F () };
+ void() kn_die6 = [$death6, kn_die7] { F () };
+ void() kn_die7 = [$death7, kn_die8] { F () };
+ void() kn_die8 = [$death8, kn_die9] { F () };
void() kn_die9 = [$death9, kn_die10]
{
become_base_corpse (self, KNIGHT_HEALTH_CORPSE);
setsize (self, KNIGHT_CORPSE_Z_MINS, KNIGHT_CORPSE_Z_MAXS);
+ F ()
+ };
+ void() kn_die10 = [$death10, kn_die10]
+ {
+ if (self.origin != self.origin_net)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_FRAME;
+ else if (self.frame_net != self.frame)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
};
- void() kn_die10 = [$death10, kn_die10] { };
//--------------------------------------------------------------
// Knight Death state B
@@ -377,21 +446,36 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() kn_dieb1 = [$deathb1, kn_dieb2]
{
base_entity_aligntoground (self);
+ F ()
+ };
+ void() kn_dieb2 = [$deathb2, kn_dieb3] { F () };
+ void() kn_dieb3 = [$deathb3, kn_dieb4]
+ {
+ self.solid = SOLID_NOT;
+ F ()
};
- void() kn_dieb2 = [$deathb2, kn_dieb3] { };
- void() kn_dieb3 = [$deathb3, kn_dieb4] { self.solid = SOLID_NOT; };
- void() kn_dieb4 = [$deathb4, kn_dieb5] { };
- void() kn_dieb5 = [$deathb5, kn_dieb6] { };
- void() kn_dieb6 = [$deathb6, kn_dieb7] { };
- void() kn_dieb7 = [$deathb7, kn_dieb8] { };
- void() kn_dieb8 = [$deathb8, kn_dieb9] { };
- void() kn_dieb9 = [$deathb9, kn_dieb10] { };
+ void() kn_dieb4 = [$deathb4, kn_dieb5] { F () };
+ void() kn_dieb5 = [$deathb5, kn_dieb6] { F () };
+ void() kn_dieb6 = [$deathb6, kn_dieb7] { F () };
+ void() kn_dieb7 = [$deathb7, kn_dieb8] { F () };
+ void() kn_dieb8 = [$deathb8, kn_dieb9] { F () };
+ void() kn_dieb9 = [$deathb9, kn_dieb10] { F () };
void() kn_dieb10 = [$deathb10, kn_dieb11]
{
become_base_corpse (self, KNIGHT_HEALTH_CORPSE);
setsize (self, KNIGHT_CORPSE_Z_MINS, KNIGHT_CORPSE_Z_MAXS);
+ F ()
};
- void() kn_dieb11 = [$deathb11, kn_dieb11] { };
+ void() kn_dieb11 = [$deathb11, kn_dieb11]
+ {
+ if (self.origin != self.origin_net)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_FRAME;
+ else if (self.frame_net != self.frame)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
+ };
+
+ #undef F
//==============================================================
// Interaction
@@ -407,7 +491,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
local float r = random ();
- sound_pain (self, CHAN_VOICE, "knight/khurt.wav",
+ sound (self, CHAN_VOICE, "knight/khurt.wav",
VOL_HIGH, ATTN_NORM);
if (r < 0.85)
@@ -427,37 +511,27 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//--------------------------------------------------------------
void(vector dir) monster_knight_destroy =
{
- // check if we're dead already
- if (self.classgroup & CG_CORPSE)
- {
- sound (self, CHAN_VOICE, "player/udeath.wav",
- VOL_HIGH, ATTN_NORM);
-
- throw_gib_head_knight (self, dir, self.health);
- throw_gib_1 (self, dir, self.health);
- throw_gib_2 (self, dir, self.health);
- throw_gib_3 (self, dir, self.health);
-
- return;
- }
-
// check for gib
- if (self.health < -40)
+ if (self.classgroup & CG_CORPSE || self.health < -40)
{
sound (self, CHAN_VOICE, "player/udeath.wav",
VOL_HIGH, ATTN_NORM);
- throw_gib_head_knight (self, dir, self.health);
- throw_gib_1 (self, dir, self.health);
- throw_gib_2 (self, dir, self.health);
- throw_gib_3 (self, dir, self.health);
+ if (!(self.classgroup & CG_CORPSE))
+ base_item_drop_stuff (self);
+
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib1_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib2_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib3_init)
+ BASE_ITEM_GIB_THROW (dir, self.health,
+ item_head_knight_init)
- base_item_drop_stuff (self);
+ base_entity_remove (self);
return;
}
// regular death
- sound_death (self, CHAN_VOICE, "knight/kdeath.wav",
+ sound (self, CHAN_VOICE, "knight/kdeath.wav",
VOL_HIGH, ATTN_NORM);
base_item_drop_stuff (self);
if (random() < 0.5)
@@ -471,17 +545,20 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//==============================================================
//--------------------------------------------------------------
- entity(vector org, vector ang, float sflags, float yaw, float angry)
+ entity(vector org, vector ang, float sflags, float yaw)
spawn_monster_knight =
{
- return spawn_base_monster (org, ang, sflags, yaw, angry,
+ return spawn_base_monster (org, ang, sflags, yaw,
monster_knight_init);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) monster_knight_init =
{
- if (e.spawnflags & I_AM_TURRET)
+ #ifdef SSQC
+ if (e.spawnflags & SPAWNFLAG_MONSTER_TURRET)
objerror("Incompatible spawnflag: TURRET_MODE\n");
if (deathmatch)
@@ -489,124 +566,78 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
remove (e);
return;
}
+ #endif
e.classname = "monster_knight";
e.classtype = CT_MONSTER_KNIGHT;
+ e.pos1 = KNIGHT_MINS;
+ e.pos2 = KNIGHT_MAXS;
- // dumptruck_ds custom_mdls
- precache_body_model (e, "progs/knight.mdl");
- precache_head_model (e, "progs/h_knight.mdl");
- // dumptruck_ds
- precache_sound_death (e, "knight/kdeath.wav");
- precache_sound_pain (e, "knight/khurt.wav");
- precache_sound_sight (e, "knight/ksight.wav");
- precache_sound_attack (e, "knight/sword1.wav");
- precache_sound_misc (e, "knight/sword2.wav");
- precache_sound_idle (e, "knight/idle.wav");
-
- precache_gib1 (e, "progs/gib1.mdl");
- precache_gib2 (e, "progs/gib2.mdl");
- precache_gib3 (e, "progs/gib3.mdl");
+ #ifdef CSQC
+ if (e.modelindex)
+ {
+ setmodelindex (e, e.modelindex);
+ setsize (e, KNIGHT_MINS, KNIGHT_MAXS);
+ }
+ #endif
- e.solid = SOLID_SLIDEBOX;
- e.movetype = MOVETYPE_STEP;
+ #ifdef SSQC
+ precache_model ("progs/knight.mdl");
+ precache_model ("progs/h_knight.mdl");
+ precache_sound ("knight/kdeath.wav");
+ precache_sound ("knight/khurt.wav");
+ precache_sound ("knight/ksight.wav");
+ precache_sound ("knight/sword1.wav");
+ precache_sound ("knight/sword2.wav");
+ precache_sound ("knight/idle.wav");
- // dumptruck_ds custom_mdls
- body_model (e, "progs/knight.mdl");
- // setmodel (e, "progs/knight.mdl");
+ precache_model ("progs/gib1.mdl");
+ precache_model ("progs/gib2.mdl");
+ precache_model ("progs/gib3.mdl");
- setsize (e, '-16 -16 -24', '16 16 40');
+ // set up model and size for later -- CEV
+ e.mdl = "progs/knight.mdl";
if (!e.health)
// thanks RennyC -- dumptruck_ds
e.health = KNIGHT_HEALTH;
+ e.destroy = monster_knight_destroy;
e.sightsound = monster_knight_sightsound;
e.th_stand = kn_stand1;
e.th_walk = kn_walk1;
e.th_run = kn_run1;
e.th_melee = kn_atk1;
- // Berserk test from
- // http://celephais.net/board/view_thread.php?id=4&start=3465
- // -- dumptruck_ds
- if !(e.berserk)
- e.th_pain = monster_knight_pain;
- else
+
+ // changed berserk test from field to flag -- CEV
+ if (self.spawnflags & SPAWNFLAG_MONSTER_BERSERK)
e.th_pain = sub_nullpain;
- e.destroy = monster_knight_destroy;
+ else
+ e.th_pain = monster_knight_pain;
+ #endif
- // walkmonster_start
- base_walkmonster_init (e);
+ // InitMonster -- runs on both client & server -- CEV
+ base_monster_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() monster_knight =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags & fields, inhibit if necessary -- CEV
+ BASE_MONSTER_PREINIT (base_monster_init_field)
monster_knight_init (self);
};
+#endif
// };
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-/*QUAKED gib_head_knight (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/h_knight.mdl");
-}*/
-//----------------------------------------------------------------------
-// class gib_head_knight: base_gib_head
-// {
- //--------------------------------------------------------------
- // ThrowHead
- //--------------------------------------------------------------
- void(entity act, vector dir, float dmg) throw_gib_head_knight =
- {
- base_gib_head_throw (act, dir, dmg, gib_head_knight_init);
- };
-
- //--------------------------------------------------------------
- void(entity e) gib_head_knight_init =
- {
- e.classname = "gib_head_knight";
- e.classtype = CT_GORE_HEAD_KNIGHT;
-
- // gib_init interprets spawnflags and will set .solid -- CEV
- base_gib_head_init (e);
-
- if (e.mdl_head != "")
- {
- precache_model (e.mdl_head);
- setmodel (e, e.mdl_head);
- }
- else
- {
- precache_model ("progs/h_knight.mdl");
- setmodel (e, "progs/h_knight.mdl");
- if (e.solid == SOLID_BBOX)
- setsize (e, KNIGHT_HEAD_MINS, KNIGHT_HEAD_MAXS);
- else if (e.solid == SOLID_TRIGGER)
- setsize (e, '-16 -16 0', '16 16 56');
- }
-
- e.frame = 0;
- };
-
- //--------------------------------------------------------------
- void() gib_head_knight =
- {
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- gib_head_knight_init (self);
- };
-// };
-
+#ifdef SSQC
/*QUAKED monster_dead_knight (0 0.5 0.8) (-16 -16 -24) (16 16 32) SOLID ON_SIDE X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ({"path":"progs/knight.mdl","frame":96});
@@ -623,6 +654,7 @@ model ("progs/h_knight.mdl");
precache_model ("progs/knight.mdl");
setmodel (e, "progs/knight.mdl");
+ // TODO CEV
if (e.spawnflags & 2)
{
e.frame = $death10;
@@ -651,3 +683,8 @@ model ("progs/h_knight.mdl");
monster_dead_knight_init (self);
};
// };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+$flush
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/monsters/ogre.qc
diff --git a/qc/monsters/ogre.qc b/qc/monsters/ogre.qc
index ebe75c5..624c2c7 100644
--- a/qc/monsters/ogre.qc
+++ b/qc/monsters/ogre.qc
@@ -6,27 +6,34 @@
// constants
//======================================================================
+#ifdef SSQC
const float MONSTER_FLAK_OGRE = 4;
-const float FL_NOSELECT = 8192; // ignored by entity selector
const float OGRE_DEFAULT_ELEVATION = 30;// angle to fire at if enemy too far
const float OGRE_HEALTH = 200; // id1 200
const float OGRE_HEALTH_CORPSE = 80;
+#endif
-const vector OGRE_HEAD_MINS = '-12.35 -15.7 -0.17';
-const vector OGRE_HEAD_MAXS = '10.67 13.88 30';
+#if defined(CSQC) || defined(SSQC)
+const vector OGRE_MINS = VEC_HULL2_MIN;
+const vector OGRE_MAXS = VEC_HULL2_MAX;
const vector OGRE_CORPSE_MINS = '-40.64 -54.06 -54.1';
const vector OGRE_CORPSE_MAXS = '29.42 54.63 30';
const vector OGRE_CORPSE_B_MINS = '-45.64 -29.46 -54.52';
const vector OGRE_CORPSE_B_MAXS = '33.87 39.18 30';
const vector OGRE_CORPSE_Z_MINS = '-20 -20 -24';
const vector OGRE_CORPSE_Z_MAXS = '20 20 -8';
+#endif
//======================================================================
// forward declarations
//======================================================================
// monster_ogre
+#ifdef CSQC
+void(float isnew) monster_ogre_netreceive;
+#endif
+#ifdef SSQC
void() monster_ogre_sightsound; // AI & attacks
float() monster_ogre_checkattack;
void() monster_ogre_fire_spike;
@@ -34,6 +41,7 @@ void() monster_ogre_fire_lavaball;
void() monster_ogre_attack_ranged;
void(float side) monster_ogre_attack_chainsaw;
void() monster_ogre_attack_melee;
+// F() // macro to set FRAME netflag -- CEV
void() ogre_stand1; void() ogre_stand2; void() ogre_stand3; void() ogre_stand4;
void() ogre_stand5; void() ogre_stand6; void() ogre_stand7; void() ogre_stand8;
void() ogre_stand9;
@@ -83,12 +91,22 @@ void() ogre_bdie5; void() ogre_bdie6; void() ogre_bdie7; void() ogre_bdie8;
void() ogre_bdie9; void() ogre_bdie10;
void(entity attacker, float damage) monster_ogre_pain; // interaction
void(vector dir) monster_ogre_destroy;
-entity(vector org, vector ang, float sflags, float yaw, float angry)
+entity(vector org, vector ang, float sflags, float yaw)
spawn_monster_ogre; // initialization
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) monster_ogre_init;
+#endif
+#ifdef SSQC
void() monster_ogre;
+#endif
// monster_ogre_marksman
+#ifdef CSQC
+void(float isnew) monster_ogre_marksman_netreceive;
+#endif
+#ifdef SSQC
+// F() // macro to set FRAME netflag -- CEV
void() ogre_mm_nail1; void() ogre_mm_nail2; void() ogre_mm_nail3;
void() ogre_mm_nail4;
void() ogre_mm_t_atk1; void() ogre_mm_t_atk2; void() ogre_mm_t_atk3;
@@ -97,22 +115,25 @@ void() ogre_mm_t_atk7; void() ogre_mm_t_atk8; void() ogre_mm_t_atk9;
void() ogre_mm_t_seek1; void() ogre_mm_t_seek2; void() ogre_mm_t_seek3;
void() ogre_mm_t_seek4; void() ogre_mm_t_seek5; void() ogre_mm_t_seek6;
void() ogre_mm_t_seek7; void() ogre_mm_t_seek8; void() ogre_mm_t_seek9;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) monster_ogre_marksman_init;// initialization
+#endif
+#ifdef SSQC
void() monster_ogre_marksman;
+#endif
-// gib_head_ogre
-void(entity act, vector dir, float dmg) throw_gib_head_ogre;
-void(entity e) gib_head_ogre_init;
-void() gib_head_ogre;
-
+#ifdef SSQC
// monster_dead_ogre
void(entity e) monster_dead_ogre_init;
void() monster_dead_ogre;
+#endif
//======================================================================
// frame macros
//======================================================================
+#if defined(CSQC) || defined(SSQC)
$cd id1/models/ogre_c
$origin 0 0 24
$base base
@@ -154,6 +175,11 @@ $frame bdeath7 bdeath8 bdeath9 bdeath10
$frame pull1 pull2 pull3 pull4 pull5 pull6 pull7 pull8 pull9 pull10 pull11
+// MG1 compat -- CEV
+const float CORPSEFRAME_OGRE_1 = $death14;
+const float CORPSEFRAME_OGRE_2 = $bdeath10;
+#endif
+
//------------------------------------------------------------------------------
/*QUAKED monster_ogre (1 0 0) (-32 -32 -24) (32 32 64) AMBUSH X X TRIGGER_SPAWNED X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
@@ -225,12 +251,41 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
*/
//----------------------------------------------------------------------
-// class monster_ogre: base_walkmonster
+// class monster_ogre: base_monster
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) monster_ogre_netreceive =
+ {
+ // creates the newframe and netflags variables -- CEV
+ BASE_MONSTER_NETRECEIVE (monster_ogre_init,
+ OGRE_MINS, OGRE_MAXS)
+
+ if (isnew)
+ base_entity_que_add (self, QUE_TYPE_ACTOR);
+
+ if (self.frame == $shoot3)
+ {
+ self.effects |= EF_MUZZLEFLASH;
+ }
+ else if (self.frame >= $death3 && self.frame <= $death14)
+ {
+ if (self.solid != SOLID_NOT)
+ self.solid = SOLID_NOT;
+ }
+ else if (self.frame >= $bdeath3 && self.frame <= $bdeath10)
+ {
+ if (self.solid != SOLID_NOT)
+ self.solid = SOLID_NOT;
+ }
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
void() monster_ogre_sightsound =
{
- sound_sight (self, CHAN_VOICE, "ogre/ogwake.wav",
+ sound (self, CHAN_VOICE, "ogre/ogwake.wav",
VOL_HIGH, ATTN_NORM);
};
@@ -247,7 +302,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
// dprint("OgreCheckAttack\n");
// dumptruck_ds
- if (self.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_TURRET)
{
self.attack_state = AS_MISSILE;
sub_attackfinished (2 + 2 * random());
@@ -283,7 +338,8 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
// sight line crossed contents
return FALSE;
- if ((self.spawnflags & I_AM_TURRET) && (trace_ent != targ))
+ if ((self.spawnflags & SPAWNFLAG_MONSTER_TURRET) &&
+ (trace_ent != targ))
{
// dprint("trace_ent...\n");
self.attack_state = AS_TURRET;
@@ -343,7 +399,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
makevectors (vectoangles(self.enemy.origin - self.origin));
self.effects = self.effects | EF_MUZZLEFLASH;
- sound_attack (self, CHAN_AUTO, "boss1/throw.wav",
+ sound (self, CHAN_AUTO, "boss1/throw.wav",
VOL_HIGH, ATTN_NORM);
// damage should be 40, 40 -- TODO CEV
@@ -379,7 +435,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
case 4:
monster_ogre_fire_lavaball ();
// used for initial attack sound dumptruck_ds
- sound_misc2 (self, CHAN_WEAPON,
+ sound (self, CHAN_WEAPON,
"shalrath/attack2.wav",
VOL_HIGH, ATTN_NORM);
break;
@@ -433,55 +489,67 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
};
//--------------------------------------------------------------
+ #define F() \
+ /* { */ \
+ if (!(self.SendFlags & NETFLAG_BASE_ENTITY_FRAME)) \
+ { \
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME; \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
// Ogre Standing functions
//--------------------------------------------------------------
- void() ogre_stand1 = [$stand1, ogre_stand2] { ai_stand (); };
- void() ogre_stand2 = [$stand2, ogre_stand3] { ai_stand (); };
- void() ogre_stand3 = [$stand3, ogre_stand4] { ai_stand (); };
- void() ogre_stand4 = [$stand4, ogre_stand5] { ai_stand (); };
+ void() ogre_stand1 = [$stand1, ogre_stand2] { ai_stand (); F () };
+ void() ogre_stand2 = [$stand2, ogre_stand3] { ai_stand (); F () };
+ void() ogre_stand3 = [$stand3, ogre_stand4] { ai_stand (); F () };
+ void() ogre_stand4 = [$stand4, ogre_stand5] { ai_stand (); F () };
void() ogre_stand5 = [$stand5, ogre_stand6]
{
if (random() < 0.2)
- sound_idle (self, CHAN_VOICE, "ogre/ogidle.wav",
+ sound (self, CHAN_VOICE, "ogre/ogidle.wav",
VOL_HIGH, ATTN_IDLE);
ai_stand ();
+ F ()
};
- void() ogre_stand6 = [$stand6, ogre_stand7] { ai_stand (); };
- void() ogre_stand7 = [$stand7, ogre_stand8] { ai_stand (); };
- void() ogre_stand8 = [$stand8, ogre_stand9] { ai_stand (); };
- void() ogre_stand9 = [$stand9, ogre_stand1] { ai_stand (); };
+ void() ogre_stand6 = [$stand6, ogre_stand7] { ai_stand (); F () };
+ void() ogre_stand7 = [$stand7, ogre_stand8] { ai_stand (); F () };
+ void() ogre_stand8 = [$stand8, ogre_stand9] { ai_stand (); F () };
+ void() ogre_stand9 = [$stand9, ogre_stand1] { ai_stand (); F () };
//--------------------------------------------------------------
// Ogre Walking functions
//--------------------------------------------------------------
- void() ogre_walk1 = [$walk1, ogre_walk2] { ai_walk (3); };
- void() ogre_walk2 = [$walk2, ogre_walk3] { ai_walk (2); };
+ void() ogre_walk1 = [$walk1, ogre_walk2] { ai_walk (3); F () };
+ void() ogre_walk2 = [$walk2, ogre_walk3] { ai_walk (2); F () };
void() ogre_walk3 = [$walk3, ogre_walk4]
{
ai_walk (2);
if (random() < 0.2)
- sound_idle (self, CHAN_VOICE, "ogre/ogidle.wav",
+ sound (self, CHAN_VOICE, "ogre/ogidle.wav",
VOL_HIGH, ATTN_IDLE);
+ F ()
};
- void() ogre_walk4 = [$walk4, ogre_walk5] { ai_walk (2); };
- void() ogre_walk5 = [$walk5, ogre_walk6] { ai_walk (2); };
+ void() ogre_walk4 = [$walk4, ogre_walk5] { ai_walk (2); F () };
+ void() ogre_walk5 = [$walk5, ogre_walk6] { ai_walk (2); F () };
void() ogre_walk6 = [$walk6, ogre_walk7]
{
ai_walk (5);
if (random() < 0.1)
- sound_misc (self, CHAN_VOICE, "ogre/ogdrag.wav",
+ sound (self, CHAN_VOICE, "ogre/ogdrag.wav",
VOL_HIGH, ATTN_IDLE);
+ F ()
};
- void() ogre_walk7 = [$walk7, ogre_walk8] { ai_walk (3); };
- void() ogre_walk8 = [$walk8, ogre_walk9] { ai_walk (2); };
- void() ogre_walk9 = [$walk9, ogre_walk10] { ai_walk (3); };
- void() ogre_walk10 = [$walk10, ogre_walk11] { ai_walk (1); };
- void() ogre_walk11 = [$walk11, ogre_walk12] { ai_walk (2); };
- void() ogre_walk12 = [$walk12, ogre_walk13] { ai_walk (3); };
- void() ogre_walk13 = [$walk13, ogre_walk14] { ai_walk (3); };
- void() ogre_walk14 = [$walk14, ogre_walk15] { ai_walk (3); };
- void() ogre_walk15 = [$walk15, ogre_walk16] { ai_walk (3); };
- void() ogre_walk16 = [$walk16, ogre_walk1] { ai_walk (4); };
+ void() ogre_walk7 = [$walk7, ogre_walk8] { ai_walk (3); F () };
+ void() ogre_walk8 = [$walk8, ogre_walk9] { ai_walk (2); F () };
+ void() ogre_walk9 = [$walk9, ogre_walk10] { ai_walk (3); F () };
+ void() ogre_walk10 = [$walk10, ogre_walk11] { ai_walk (1); F () };
+ void() ogre_walk11 = [$walk11, ogre_walk12] { ai_walk (2); F () };
+ void() ogre_walk12 = [$walk12, ogre_walk13] { ai_walk (3); F () };
+ void() ogre_walk13 = [$walk13, ogre_walk14] { ai_walk (3); F () };
+ void() ogre_walk14 = [$walk14, ogre_walk15] { ai_walk (3); F () };
+ void() ogre_walk15 = [$walk15, ogre_walk16] { ai_walk (3); F () };
+ void() ogre_walk16 = [$walk16, ogre_walk1] { ai_walk (4); F () };
//--------------------------------------------------------------
// Ogre Running functions
@@ -490,16 +558,17 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
{
ai_run (9);
if (random() < 0.2)
- sound_misc1 (self, CHAN_VOICE, "ogre/ogidle2.wav",
+ sound (self, CHAN_VOICE, "ogre/ogidle2.wav",
VOL_HIGH, ATTN_IDLE);
+ F ()
};
- void() ogre_run2 = [$run2, ogre_run3] { ai_run (12); };
- void() ogre_run3 = [$run3, ogre_run4] { ai_run (8); };
- void() ogre_run4 = [$run4, ogre_run5] { ai_run (22); };
- void() ogre_run5 = [$run5, ogre_run6] { ai_run (16); };
- void() ogre_run6 = [$run6, ogre_run7] { ai_run (4); };
- void() ogre_run7 = [$run7, ogre_run8] { ai_run (13); };
- void() ogre_run8 = [$run8, ogre_run1] { ai_run (24); };
+ void() ogre_run2 = [$run2, ogre_run3] { ai_run (12); F () };
+ void() ogre_run3 = [$run3, ogre_run4] { ai_run (8); F () };
+ void() ogre_run4 = [$run4, ogre_run5] { ai_run (22); F () };
+ void() ogre_run5 = [$run5, ogre_run6] { ai_run (16); F () };
+ void() ogre_run6 = [$run6, ogre_run7] { ai_run (4); F () };
+ void() ogre_run7 = [$run7, ogre_run8] { ai_run (13); F () };
+ void() ogre_run8 = [$run8, ogre_run1] { ai_run (24); F () };
//--------------------------------------------------------------
// Ogre Smash Attack
@@ -507,50 +576,57 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() ogre_smash1 = [$smash1, ogre_smash2]
{
ai_charge (6);
- sound_attack (self, CHAN_WEAPON, "ogre/ogsawatk.wav",
+ sound (self, CHAN_WEAPON, "ogre/ogsawatk.wav",
VOL_HIGH, ATTN_NORM);
+ F ()
};
- void() ogre_smash2 = [$smash2, ogre_smash3] { ai_charge (0); };
- void() ogre_smash3 = [$smash3, ogre_smash4] { ai_charge (0); };
- void() ogre_smash4 = [$smash4, ogre_smash5] { ai_charge (1); };
- void() ogre_smash5 = [$smash5, ogre_smash6] { ai_charge (4); };
+ void() ogre_smash2 = [$smash2, ogre_smash3] { ai_charge (0); F () };
+ void() ogre_smash3 = [$smash3, ogre_smash4] { ai_charge (0); F () };
+ void() ogre_smash4 = [$smash4, ogre_smash5] { ai_charge (1); F () };
+ void() ogre_smash5 = [$smash5, ogre_smash6] { ai_charge (4); F () };
void() ogre_smash6 = [$smash6, ogre_smash7]
{
ai_charge (4);
monster_ogre_attack_chainsaw (0);
+ F ()
};
void() ogre_smash7 = [$smash7, ogre_smash8]
{
ai_charge (4);
monster_ogre_attack_chainsaw (0);
+ F ()
};
void() ogre_smash8 = [$smash8, ogre_smash9]
{
ai_charge (10);
monster_ogre_attack_chainsaw (0);
+ F ()
};
void() ogre_smash9 = [$smash9, ogre_smash10]
{
ai_charge (13);
monster_ogre_attack_chainsaw (0);
+ F ()
};
void() ogre_smash10 = [$smash10, ogre_smash11]
{
- monster_ogre_attack_chainsaw(1);
+ monster_ogre_attack_chainsaw (1);
+ F ()
};
void() ogre_smash11 = [$smash11, ogre_smash12]
{
ai_charge (2);
monster_ogre_attack_chainsaw (0);
+ F ()
// slight variation
// self.nextthink = self.nextthink + random()*0.2;};
// 1998-08-14 Incorrect setting of nextthink fix
// by Maddes/Lord Sméagol
self.nextthink = time + 0.1 + random() * 0.2;
};
- 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); };
+ void() ogre_smash12 = [$smash12, ogre_smash13] { ai_charge (0); F () };
+ void() ogre_smash13 = [$smash13, ogre_smash14] { ai_charge (4); F () };
+ void() ogre_smash14 = [$smash14, ogre_run1] { ai_charge (12); F () };
//--------------------------------------------------------------
// Ogre Swing Attack
@@ -558,51 +634,59 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() ogre_swing1 = [$swing1, ogre_swing2]
{
ai_charge (11);
- sound_attack (self, CHAN_WEAPON, "ogre/ogsawatk.wav",
+ sound (self, CHAN_WEAPON, "ogre/ogsawatk.wav",
VOL_HIGH, ATTN_NORM);
+ F ()
};
- void() ogre_swing2 = [$swing2, ogre_swing3] { ai_charge (1); };
- void() ogre_swing3 = [$swing3, ogre_swing4] { ai_charge (4); };
- void() ogre_swing4 = [$swing4, ogre_swing5] { ai_charge (13); };
+ void() ogre_swing2 = [$swing2, ogre_swing3] { ai_charge (1); F () };
+ void() ogre_swing3 = [$swing3, ogre_swing4] { ai_charge (4); F () };
+ void() ogre_swing4 = [$swing4, ogre_swing5] { ai_charge (13); F () };
void() ogre_swing5 = [$swing5, ogre_swing6]
{
ai_charge (9);
monster_ogre_attack_chainsaw (0);
self.angles_y = self.angles_y + random() * 25;
+ F ()
};
void() ogre_swing6 = [$swing6, ogre_swing7]
{
monster_ogre_attack_chainsaw (200);
self.angles_y = self.angles_y + random() * 25;
+ F ()
};
void() ogre_swing7 = [$swing7, ogre_swing8]
{
monster_ogre_attack_chainsaw (0);
self.angles_y = self.angles_y + random() * 25;
+ F ()
};
void() ogre_swing8 = [$swing8, ogre_swing9]
{
monster_ogre_attack_chainsaw (0);
self.angles_y = self.angles_y + random() * 25;
+ F ()
};
void() ogre_swing9 = [$swing9, ogre_swing10]
{
monster_ogre_attack_chainsaw (0);
self.angles_y = self.angles_y + random() * 25;
+ F ()
};
void() ogre_swing10 = [$swing10, ogre_swing11]
{
monster_ogre_attack_chainsaw (-200);
self.angles_y = self.angles_y + random() * 25;
+ F ()
};
void() ogre_swing11 = [$swing11, ogre_swing12]
{
monster_ogre_attack_chainsaw (0);
self.angles_y = self.angles_y + random() * 25;
+ F ()
};
- void() ogre_swing12 = [$swing12, ogre_swing13] { ai_charge (3); };
- void() ogre_swing13 = [$swing13, ogre_swing14] { ai_charge (8); };
- void() ogre_swing14 = [$swing14, ogre_run1] { ai_charge (9); };
+ void() ogre_swing12 = [$swing12, ogre_swing13] { ai_charge (3); F () };
+ void() ogre_swing13 = [$swing13, ogre_swing14] { ai_charge (8); F () };
+ void() ogre_swing14 = [$swing14, ogre_run1] { ai_charge (9); F () };
//--------------------------------------------------------------
// Ogre Projectile Attack
@@ -613,6 +697,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
self.attack_elevation = preach_iterate_elevation (
OGRE_DEFAULT_ELEVATION, BOLT_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() ogre_nail2 = [$shoot2, ogre_nail3]
{
@@ -620,6 +705,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
self.attack_elevation = preach_iterate_elevation (
self.attack_elevation, BOLT_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() ogre_nail3 = [$shoot2, ogre_nail4]
{
@@ -627,15 +713,17 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
self.attack_elevation = preach_iterate_elevation (
self.attack_elevation, BOLT_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() ogre_nail4 = [$shoot3, ogre_nail5]
{
ai_face ();
monster_ogre_attack_ranged ();
+ F ()
};
- void() ogre_nail5 = [$shoot4, ogre_nail6] { ai_face (); };
- void() ogre_nail6 = [$shoot5, ogre_nail7] { ai_face (); };
- void() ogre_nail7 = [$shoot6, ogre_run1] { ai_face (); };
+ void() ogre_nail5 = [$shoot4, ogre_nail6] { ai_face (); F () };
+ void() ogre_nail6 = [$shoot5, ogre_nail7] { ai_face (); F () };
+ void() ogre_nail7 = [$shoot6, ogre_run1] { ai_face (); F () };
/////////////////////////
// turret frames START //
@@ -650,6 +738,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
self.attack_elevation = preach_iterate_elevation (
OGRE_DEFAULT_ELEVATION, BOLT_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() ogre_tur_atk2 = [$shoot2, ogre_tur_atk3]
{
@@ -657,6 +746,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
self.attack_elevation = preach_iterate_elevation (
self.attack_elevation, BOLT_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() ogre_tur_atk3 = [$shoot2, ogre_tur_atk4]
{
@@ -664,36 +754,39 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
self.attack_elevation = preach_iterate_elevation (
self.attack_elevation, BOLT_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() ogre_tur_atk4 = [$shoot3, ogre_tur_atk5]
{
ai_face ();
monster_ogre_attack_ranged ();
+ F ()
};
- void() ogre_tur_atk5 = [$shoot4, ogre_tur_atk6] { ai_face (); };
- void() ogre_tur_atk6 = [$shoot5, ogre_tur_atk7] { ai_face (); };
- void() ogre_tur_atk7 = [$shoot5, ogre_tur_atk8] { ai_face (); };
- void() ogre_tur_atk8 = [$shoot6, ogre_tur_atk9] { ai_face (); };
- void() ogre_tur_atk9 = [$shoot6, ogre_tur_seek1] { ai_face (); };
+ void() ogre_tur_atk5 = [$shoot4, ogre_tur_atk6] { ai_face (); F () };
+ void() ogre_tur_atk6 = [$shoot5, ogre_tur_atk7] { ai_face (); F () };
+ void() ogre_tur_atk7 = [$shoot5, ogre_tur_atk8] { ai_face (); F () };
+ void() ogre_tur_atk8 = [$shoot6, ogre_tur_atk9] { ai_face (); F () };
+ void() ogre_tur_atk9 = [$shoot6, ogre_tur_seek1] { ai_face (); F () };
//--------------------------------------------------------------
// Ogre Turret Seek / Stand
//--------------------------------------------------------------
- void() ogre_tur_seek1 = [$stand1, ogre_tur_seek2] { ai_run (0); };
- void() ogre_tur_seek2 = [$stand2, ogre_tur_seek3] { ai_run (0); };
- void() ogre_tur_seek3 = [$stand3, ogre_tur_seek4] { ai_run (0); };
- void() ogre_tur_seek4 = [$stand4, ogre_tur_seek5] { ai_run (0); };
+ void() ogre_tur_seek1 = [$stand1, ogre_tur_seek2] { ai_run (0); F () };
+ void() ogre_tur_seek2 = [$stand2, ogre_tur_seek3] { ai_run (0); F () };
+ void() ogre_tur_seek3 = [$stand3, ogre_tur_seek4] { ai_run (0); F () };
+ void() ogre_tur_seek4 = [$stand4, ogre_tur_seek5] { ai_run (0); F () };
void() ogre_tur_seek5 = [$stand5, ogre_tur_seek6]
{
if (random() < 0.2)
- sound_idle (self, CHAN_VOICE, "ogre/ogidle.wav",
+ sound (self, CHAN_VOICE, "ogre/ogidle.wav",
VOL_HIGH, ATTN_IDLE);
ai_run (0);
+ F ()
};
- void() ogre_tur_seek6 = [$stand6, ogre_tur_seek7] { ai_run (0); };
- void() ogre_tur_seek7 = [$stand7, ogre_tur_seek8] { ai_run (0); };
- void() ogre_tur_seek8 = [$stand8, ogre_tur_seek9] { ai_run (0); };
- void() ogre_tur_seek9 = [$stand9, ogre_tur_seek1] { ai_run (0); };
+ void() ogre_tur_seek6 = [$stand6, ogre_tur_seek7] { ai_run (0); F () };
+ void() ogre_tur_seek7 = [$stand7, ogre_tur_seek8] { ai_run (0); F () };
+ void() ogre_tur_seek8 = [$stand8, ogre_tur_seek9] { ai_run (0); F () };
+ void() ogre_tur_seek9 = [$stand9, ogre_tur_seek1] { ai_run (0); F () };
/////////////////////////
// turret frames END //
@@ -702,67 +795,67 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//--------------------------------------------------------------
// Ogre Pain state A
//--------------------------------------------------------------
- void() ogre_pain1 = [$pain1, ogre_pain2] { };
- void() ogre_pain2 = [$pain2, ogre_pain3] { };
- void() ogre_pain3 = [$pain3, ogre_pain4] { };
- void() ogre_pain4 = [$pain4, ogre_pain5] { };
- void() ogre_pain5 = [$pain5, ogre_run1] { };
+ void() ogre_pain1 = [$pain1, ogre_pain2] { F () };
+ void() ogre_pain2 = [$pain2, ogre_pain3] { F () };
+ void() ogre_pain3 = [$pain3, ogre_pain4] { F () };
+ void() ogre_pain4 = [$pain4, ogre_pain5] { F () };
+ void() ogre_pain5 = [$pain5, ogre_run1] { F () };
//--------------------------------------------------------------
// Ogre Pain state B
//--------------------------------------------------------------
- void() ogre_painb1 = [$painb1, ogre_painb2] { };
- void() ogre_painb2 = [$painb2, ogre_painb3] { };
- void() ogre_painb3 = [$painb3, ogre_run1] { };
+ void() ogre_painb1 = [$painb1, ogre_painb2] { F () };
+ void() ogre_painb2 = [$painb2, ogre_painb3] { F () };
+ void() ogre_painb3 = [$painb3, ogre_run1] { F () };
//--------------------------------------------------------------
// Ogre Pain state C
//--------------------------------------------------------------
- void() ogre_painc1 = [$painc1, ogre_painc2] { };
- void() ogre_painc2 = [$painc2, ogre_painc3] { };
- void() ogre_painc3 = [$painc3, ogre_painc4] { };
- void() ogre_painc4 = [$painc4, ogre_painc5] { };
- void() ogre_painc5 = [$painc5, ogre_painc6] { };
- void() ogre_painc6 = [$painc6, ogre_run1] { };
+ void() ogre_painc1 = [$painc1, ogre_painc2] { F () };
+ void() ogre_painc2 = [$painc2, ogre_painc3] { F () };
+ void() ogre_painc3 = [$painc3, ogre_painc4] { F () };
+ void() ogre_painc4 = [$painc4, ogre_painc5] { F () };
+ void() ogre_painc5 = [$painc5, ogre_painc6] { F () };
+ void() ogre_painc6 = [$painc6, ogre_run1] { F () };
//--------------------------------------------------------------
// Ogre Pain state D
//--------------------------------------------------------------
- void() ogre_paind1 = [$paind1, ogre_paind2] { };
- void() ogre_paind2 = [$paind2, ogre_paind3] { ai_pain (10); };
- void() ogre_paind3 = [$paind3, ogre_paind4] { ai_pain (9); };
- void() ogre_paind4 = [$paind4, ogre_paind5] { ai_pain (4); };
- void() ogre_paind5 = [$paind5, ogre_paind6] { };
- void() ogre_paind6 = [$paind6, ogre_paind7] { };
- void() ogre_paind7 = [$paind7, ogre_paind8] { };
- void() ogre_paind8 = [$paind8, ogre_paind9] { };
- void() ogre_paind9 = [$paind9, ogre_paind10] { };
- void() ogre_paind10 = [$paind10, ogre_paind11] { };
- void() ogre_paind11 = [$paind11, ogre_paind12] { };
- void() ogre_paind12 = [$paind12, ogre_paind13] { };
- void() ogre_paind13 = [$paind13, ogre_paind14] { };
- void() ogre_paind14 = [$paind14, ogre_paind15] { };
- void() ogre_paind15 = [$paind15, ogre_paind16] { };
- void() ogre_paind16 = [$paind16, ogre_run1] { };
+ void() ogre_paind1 = [$paind1, ogre_paind2] { F () };
+ void() ogre_paind2 = [$paind2, ogre_paind3] { ai_pain (10); F () };
+ void() ogre_paind3 = [$paind3, ogre_paind4] { ai_pain (9); F () };
+ void() ogre_paind4 = [$paind4, ogre_paind5] { ai_pain (4); F () };
+ void() ogre_paind5 = [$paind5, ogre_paind6] { F () };
+ void() ogre_paind6 = [$paind6, ogre_paind7] { F () };
+ void() ogre_paind7 = [$paind7, ogre_paind8] { F () };
+ void() ogre_paind8 = [$paind8, ogre_paind9] { F () };
+ void() ogre_paind9 = [$paind9, ogre_paind10] { F () };
+ void() ogre_paind10 = [$paind10, ogre_paind11] { F () };
+ void() ogre_paind11 = [$paind11, ogre_paind12] { F () };
+ void() ogre_paind12 = [$paind12, ogre_paind13] { F () };
+ void() ogre_paind13 = [$paind13, ogre_paind14] { F () };
+ void() ogre_paind14 = [$paind14, ogre_paind15] { F () };
+ void() ogre_paind15 = [$paind15, ogre_paind16] { F () };
+ void() ogre_paind16 = [$paind16, ogre_run1] { F () };
//--------------------------------------------------------------
// Ogre Pain state E
//--------------------------------------------------------------
- void() ogre_paine1 = [$paine1, ogre_paine2] { };
- void() ogre_paine2 = [$paine2, ogre_paine3] { ai_pain (10); };
- void() ogre_paine3 = [$paine3, ogre_paine4] { ai_pain (9); };
- void() ogre_paine4 = [$paine4, ogre_paine5] { ai_pain (4); };
- void() ogre_paine5 = [$paine5, ogre_paine6] { };
- void() ogre_paine6 = [$paine6, ogre_paine7] { };
- void() ogre_paine7 = [$paine7, ogre_paine8] { };
- void() ogre_paine8 = [$paine8, ogre_paine9] { };
- void() ogre_paine9 = [$paine9, ogre_paine10] { };
- void() ogre_paine10 = [$paine10, ogre_paine11] { };
- void() ogre_paine11 = [$paine11, ogre_paine12] { };
- void() ogre_paine12 = [$paine12, ogre_paine13] { };
- void() ogre_paine13 = [$paine13, ogre_paine14] { };
- void() ogre_paine14 = [$paine14, ogre_paine15] { };
- void() ogre_paine15 = [$paine15, ogre_run1] { };
+ void() ogre_paine1 = [$paine1, ogre_paine2] { F () };
+ void() ogre_paine2 = [$paine2, ogre_paine3] { ai_pain (10); F () };
+ void() ogre_paine3 = [$paine3, ogre_paine4] { ai_pain (9); F () };
+ void() ogre_paine4 = [$paine4, ogre_paine5] { ai_pain (4); F () };
+ void() ogre_paine5 = [$paine5, ogre_paine6] { F () };
+ void() ogre_paine6 = [$paine6, ogre_paine7] { F () };
+ void() ogre_paine7 = [$paine7, ogre_paine8] { F () };
+ void() ogre_paine8 = [$paine8, ogre_paine9] { F () };
+ void() ogre_paine9 = [$paine9, ogre_paine10] { F () };
+ void() ogre_paine10 = [$paine10, ogre_paine11] { F () };
+ void() ogre_paine11 = [$paine11, ogre_paine12] { F () };
+ void() ogre_paine12 = [$paine12, ogre_paine13] { F () };
+ void() ogre_paine13 = [$paine13, ogre_paine14] { F () };
+ void() ogre_paine14 = [$paine14, ogre_paine15] { F () };
+ void() ogre_paine15 = [$paine15, ogre_run1] { F () };
//--------------------------------------------------------------
// Ogre Death state A
@@ -770,8 +863,9 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() ogre_die1 = [$death1, ogre_die2]
{
base_entity_aligntoground (self);
+ F ()
};
- void() ogre_die2 = [$death2, ogre_die3] { };
+ void() ogre_die2 = [$death2, ogre_die3] { F () };
void() ogre_die3 = [$death3, ogre_die4]
{
self.solid = SOLID_NOT;
@@ -799,22 +893,32 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
}
if (!self.keep_ammo)
item_backpack_drop (self);
+
+ F ()
};
- void() ogre_die4 = [$death4, ogre_die5] { };
- void() ogre_die5 = [$death5, ogre_die6] { };
- void() ogre_die6 = [$death6, ogre_die7] { };
- void() ogre_die7 = [$death7, ogre_die8] { };
- void() ogre_die8 = [$death8, ogre_die9] { };
- void() ogre_die9 = [$death9, ogre_die10] { };
- void() ogre_die10 = [$death10, ogre_die11] { };
- void() ogre_die11 = [$death11, ogre_die12] { };
- void() ogre_die12 = [$death12, ogre_die13] { };
+ void() ogre_die4 = [$death4, ogre_die5] { F () };
+ void() ogre_die5 = [$death5, ogre_die6] { F () };
+ void() ogre_die6 = [$death6, ogre_die7] { F () };
+ void() ogre_die7 = [$death7, ogre_die8] { F () };
+ void() ogre_die8 = [$death8, ogre_die9] { F () };
+ void() ogre_die9 = [$death9, ogre_die10] { F () };
+ void() ogre_die10 = [$death10, ogre_die11] { F () };
+ void() ogre_die11 = [$death11, ogre_die12] { F () };
+ void() ogre_die12 = [$death12, ogre_die13] { F () };
void() ogre_die13 = [$death13, ogre_die14]
{
become_base_corpse (self, OGRE_HEALTH_CORPSE);
setsize (self, OGRE_CORPSE_Z_MINS, OGRE_CORPSE_Z_MAXS);
+ F ()
};
- void() ogre_die14 = [$death14, ogre_die14] { };
+ void() ogre_die14 = [$death14, ogre_die14]
+ {
+ if (self.origin != self.origin_net)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_FRAME;
+ else if (self.frame_net != self.frame)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
+ };
//--------------------------------------------------------------
// Ogre Death state B
@@ -822,8 +926,9 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() ogre_bdie1 = [$bdeath1, ogre_bdie2]
{
base_entity_aligntoground (self);
+ F ()
};
- void() ogre_bdie2 = [$bdeath2, ogre_bdie3] { ai_forward (5); };
+ void() ogre_bdie2 = [$bdeath2, ogre_bdie3] { ai_forward (5); F () };
void() ogre_bdie3 = [$bdeath3, ogre_bdie4]
{
self.solid = SOLID_NOT;
@@ -853,18 +958,30 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
}
if(!self.keep_ammo)
item_backpack_drop (self);
+
+ F ()
};
- void() ogre_bdie4 = [$bdeath4, ogre_bdie5] { ai_forward (1); };
- void() ogre_bdie5 = [$bdeath5, ogre_bdie6] { ai_forward (3); };
- void() ogre_bdie6 = [$bdeath6, ogre_bdie7] { ai_forward (7); };
- void() ogre_bdie7 = [$bdeath7, ogre_bdie8] { ai_forward (25); };
- void() ogre_bdie8 = [$bdeath8, ogre_bdie9] { };
+ void() ogre_bdie4 = [$bdeath4, ogre_bdie5] { ai_forward (1); F () };
+ void() ogre_bdie5 = [$bdeath5, ogre_bdie6] { ai_forward (3); F () };
+ void() ogre_bdie6 = [$bdeath6, ogre_bdie7] { ai_forward (7); F () };
+ void() ogre_bdie7 = [$bdeath7, ogre_bdie8] { ai_forward (25); F () };
+ void() ogre_bdie8 = [$bdeath8, ogre_bdie9] { F () };
void() ogre_bdie9 = [$bdeath9, ogre_bdie10]
{
become_base_corpse (self, OGRE_HEALTH_CORPSE);
setsize (self, OGRE_CORPSE_Z_MINS, OGRE_CORPSE_Z_MAXS);
+ F ()
+ };
+ void() ogre_bdie10 = [$bdeath10, ogre_bdie10]
+ {
+ if (self.origin != self.origin_net)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_FRAME;
+ else if (self.frame_net != self.frame)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
};
- void() ogre_bdie10 = [$bdeath10, ogre_bdie10] { };
+
+ #undef F
//==============================================================
// Interaction
@@ -881,10 +998,10 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
if (self.pain_finished > time)
return;
- if (self.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_TURRET)
return;
- sound_pain (self, CHAN_VOICE, "ogre/ogpain1.wav",
+ sound (self, CHAN_VOICE, "ogre/ogpain1.wav",
VOL_HIGH, ATTN_NORM);
r = random();
@@ -921,65 +1038,28 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//--------------------------------------------------------------
void(vector dir) monster_ogre_destroy =
{
- // check if we're dead already
- if (self.classgroup & CG_CORPSE)
- {
- sound (self, CHAN_VOICE, "player/udeath.wav",
- VOL_HIGH, ATTN_NORM);
-
- throw_gib_head_ogre (self, dir, self.health);
-
- // custom models -- dumptruck_ds
- if (self.mdl_gib1 != "")
- throw_gib_1 (self, dir, self.health);
- else
- throw_gib_3 (self, dir, self.health);
-
- if (self.mdl_gib2 != "")
- throw_gib_2 (self, dir, self.health);
- else
- throw_gib_3 (self, dir, self.health);
-
- if (self.mdl_gib3 != "")
- throw_gib_3 (self, dir, self.health);
- else
- throw_gib_3 (self, dir, self.health);
-
- return;
- }
-
// check for gib
- if (self.health < -80)
+ if (self.classgroup & CG_CORPSE || self.health < -80)
{
sound (self, CHAN_VOICE, "player/udeath.wav",
VOL_HIGH, ATTN_NORM);
- throw_gib_head_ogre (self, dir, self.health);
-
- // custom models -- dumptruck_ds
- if (self.mdl_gib1 != "")
- throw_gib_1 (self, dir, self.health);
- else
- throw_gib_3 (self, dir, self.health);
-
- if (self.mdl_gib2 != "")
- throw_gib_2 (self, dir, self.health);
- else
- throw_gib_3 (self, dir, self.health);
+ if (!(self.classgroup & CG_CORPSE))
+ base_item_drop_stuff (self);
- if (self.mdl_gib3 != "")
- throw_gib_3 (self, dir, self.health);
- else
- throw_gib_3 (self, dir, self.health);
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib3_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib3_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib3_init)
+ BASE_ITEM_GIB_THROW (dir, self.health,
+ item_head_ogre_init)
- base_item_drop_stuff (self);
+ base_entity_remove (self);
return;
}
- sound_death (self, CHAN_VOICE, "ogre/ogdth.wav",
- VOL_HIGH, ATTN_NORM);
-
+ sound (self, CHAN_VOICE, "ogre/ogdth.wav", VOL_HIGH, ATTN_NORM);
base_item_drop_stuff (self);
+
if (random() < 0.5)
ogre_die1 ();
else
@@ -991,60 +1071,68 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//==============================================================
//--------------------------------------------------------------
- entity(vector org, vector ang, float sflags, float yaw, float angry)
+ entity(vector org, vector ang, float sflags, float yaw)
spawn_monster_ogre =
{
- return spawn_base_monster (org, ang, sflags, yaw, angry,
+ return spawn_base_monster (org, ang, sflags, yaw,
monster_ogre_init);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) monster_ogre_init =
{
+ #ifdef SSQC
if (deathmatch)
{
remove (e);
return;
}
+ #endif
// let subclasses override classtype -- CEV
e.classname = "monster_ogre";
e.classtype = CT_MONSTER_OGRE;
+ e.pos1 = OGRE_MINS;
+ e.pos2 = OGRE_MAXS;
- // custom_mdls dumptruck_ds
- precache_body_model (e, "progs/ogre.mdl");
- precache_head_model (e, "progs/h_ogre.mdl");
- precache_proj_model (e, "progs/grenade.mdl");
+ #ifdef CSQC
+ if (e.modelindex)
+ {
+ setmodelindex (e, e.modelindex);
+ setsize (e, OGRE_MINS, OGRE_MAXS);
+ }
+ #endif
+ #ifdef SSQC
// custom_mdls dumptruck_ds
+ precache_model ("progs/ogre.mdl");
+ precache_model ("progs/h_ogre.mdl");
+ precache_model ("progs/grenade.mdl");
+
// for style 3 Orge dumptruck_ds
precache_model ("progs/mervup.mdl");
// for style 2 Ogre dumptruck_ds
precache_model ("progs/lspike.mdl");
- precache_sound_misc (e, "ogre/ogdrag.wav");
- precache_sound_death (e, "ogre/ogdth.wav");
- precache_sound_idle (e, "ogre/ogidle.wav");
- precache_sound_misc1 (e, "ogre/ogidle2.wav");
- precache_sound_pain (e, "ogre/ogpain1.wav");
- precache_sound_attack (e, "ogre/ogsawatk.wav");
- precache_sound_sight (e, "ogre/ogwake.wav");
- precache_sound_misc2 (e, "shalrath/attack2.wav");
+ precache_sound ("ogre/ogdrag.wav");
+ precache_sound ("ogre/ogdth.wav");
+ precache_sound ("ogre/ogidle.wav");
+ precache_sound ("ogre/ogidle2.wav");
+ precache_sound ("ogre/ogpain1.wav");
+ precache_sound ("ogre/ogsawatk.wav");
+ precache_sound ("ogre/ogwake.wav");
+ precache_sound ("shalrath/attack2.wav");
precache_sound ("fish/bite.wav");
// jaycie erysdren 2021-09-14
precache_sound ("boss1/throw.wav");
- precache_gib1 (e, "progs/gib1.mdl");
- precache_gib2 (e, "progs/gib2.mdl");
- precache_gib3 (e, "progs/gib3.mdl");
-
- e.solid = SOLID_SLIDEBOX;
- e.movetype = MOVETYPE_STEP;
-
- // custom_mdls dumptruck_ds
- body_model (e, "progs/ogre.mdl");
- // setmodel (e, "progs/ogre.mdl");
+ precache_model ("progs/gib1.mdl");
+ precache_model ("progs/gib2.mdl");
+ precache_model ("progs/gib3.mdl");
- setsize (e, VEC_HULL2_MIN, VEC_HULL2_MAX);
+ // set up model and size for later -- CEV
+ e.mdl = "progs/ogre.mdl";
if (!e.proj_speed_mod)
e.proj_speed_mod = 1;
@@ -1053,40 +1141,43 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
if (!e.health)
e.health = OGRE_HEALTH;
+ e.destroy = monster_ogre_destroy;
e.checkattack = monster_ogre_checkattack;
e.sightsound = monster_ogre_sightsound;
+
e.th_stand = ogre_stand1;
e.th_walk = ogre_walk1;
- if (e.spawnflags & I_AM_TURRET)
+ if (e.spawnflags & SPAWNFLAG_MONSTER_TURRET)
e.th_run = ogre_tur_seek1;
else
e.th_run = ogre_run1;
- e.destroy = monster_ogre_destroy;
e.th_melee = monster_ogre_attack_melee;
e.th_missile = ogre_nail1;
// dumptruck_ds
e.th_turret = ogre_tur_atk1;
- // Berserk test from
- // http://celephais.net/board/view_thread.php?id=4&start=3465
- // -- dumptruck_ds
- if !(e.berserk)
- e.th_pain = monster_ogre_pain;
- else
+
+ // changed berserk test from field to flag -- CEV
+ if (self.spawnflags & SPAWNFLAG_MONSTER_BERSERK)
e.th_pain = sub_nullpain;
+ else
+ e.th_pain = monster_ogre_pain;
+ #endif
- // walkmonster_start
- base_walkmonster_init (e);
+ // InitMonster -- runs on both client & server -- CEV
+ base_monster_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() monster_ogre =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags & fields, inhibit if necessary -- CEV
+ BASE_MONSTER_PREINIT (base_monster_init_field)
monster_ogre_init (self);
};
+#endif
// };
//----------------------------------------------------------------------
@@ -1157,10 +1248,45 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//----------------------------------------------------------------------
// class monster_ogre_marksman: monster_ogre
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) monster_ogre_marksman_netreceive =
+ {
+ // creates the newframe and netflags variables -- CEV
+ BASE_MONSTER_NETRECEIVE (monster_ogre_marksman_init,
+ OGRE_MINS, OGRE_MAXS)
+
+ if (self.frame == $shoot3)
+ {
+ self.effects |= EF_MUZZLEFLASH;
+ }
+ else if (self.frame >= $death3 || self.frame <= $death14)
+ {
+ if (self.solid != SOLID_NOT)
+ self.solid = SOLID_NOT;
+ }
+ else if (self.frame >= $bdeath3 || self.frame <= $bdeath10)
+ {
+ if (self.solid != SOLID_NOT)
+ self.solid = SOLID_NOT;
+ }
+ };
+#endif
+
+#ifdef SSQC
// Preach tutorial alternate animation frames for
// monster_ogre_marksman -- dumptruck_ds
//--------------------------------------------------------------
+ #define F() \
+ /* { */ \
+ if (!(self.SendFlags & NETFLAG_BASE_ENTITY_FRAME)) \
+ { \
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME; \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
// Ogre2 Nail frames
//--------------------------------------------------------------
void() ogre_mm_nail1 = [$shoot1, ogre_mm_nail2]
@@ -1169,6 +1295,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
self.attack_elevation = preach_iterate_elevation (
OGRE_DEFAULT_ELEVATION, GRENADE_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() ogre_mm_nail2 = [$shoot2, ogre_mm_nail3]
{
@@ -1176,6 +1303,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
self.attack_elevation = preach_iterate_elevation (
self.attack_elevation, GRENADE_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() ogre_mm_nail3 = [$shoot2, ogre_mm_nail4]
{
@@ -1183,12 +1311,14 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
self.attack_elevation = preach_iterate_elevation (
self.attack_elevation, GRENADE_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() ogre_mm_nail4 = [$shoot3, ogre_nail5]
{
ai_face ();
base_monster_fire_grenade (
self.origin, 40, 40, self.attack_elevation);
+ F ()
};
// these are for the turret version of monster_ogre_marksman
@@ -1202,6 +1332,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
self.attack_elevation = preach_iterate_elevation (
OGRE_DEFAULT_ELEVATION, GRENADE_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() ogre_mm_t_atk2 = [$shoot2, ogre_mm_t_atk3]
{
@@ -1209,6 +1340,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
self.attack_elevation = preach_iterate_elevation (
self.attack_elevation, GRENADE_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() ogre_mm_t_atk3 = [$shoot2, ogre_mm_t_atk4]
{
@@ -1216,81 +1348,95 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
self.attack_elevation = preach_iterate_elevation (
self.attack_elevation, GRENADE_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() ogre_mm_t_atk4 = [$shoot3, ogre_mm_t_atk5]
{
ai_face ();
base_monster_fire_grenade (
self.origin, 40, 40, self.attack_elevation);
+ F ()
};
- void() ogre_mm_t_atk5 = [$shoot4, ogre_mm_t_atk6] { ai_face (); };
- void() ogre_mm_t_atk6 = [$shoot5, ogre_mm_t_atk7] { ai_face (); };
- void() ogre_mm_t_atk7 = [$shoot5, ogre_mm_t_atk8] { ai_face (); };
- void() ogre_mm_t_atk8 = [$shoot6, ogre_mm_t_atk9] { ai_face (); };
- void() ogre_mm_t_atk9 = [$shoot6, ogre_mm_t_seek1] { ai_face (); };
+ void() ogre_mm_t_atk5 = [$shoot4, ogre_mm_t_atk6] { ai_face (); F () };
+ void() ogre_mm_t_atk6 = [$shoot5, ogre_mm_t_atk7] { ai_face (); F () };
+ void() ogre_mm_t_atk7 = [$shoot5, ogre_mm_t_atk8] { ai_face (); F () };
+ void() ogre_mm_t_atk8 = [$shoot6, ogre_mm_t_atk9] { ai_face (); F () };
+ void() ogre_mm_t_atk9 = [$shoot6, ogre_mm_t_seek1] { ai_face (); F () };
//--------------------------------------------------------------
// Ogre2 Turret Seek / Stand
//--------------------------------------------------------------
- void() ogre_mm_t_seek1 = [$stand1, ogre_mm_t_seek2] { ai_run (0); };
- void() ogre_mm_t_seek2 = [$stand2, ogre_mm_t_seek3] { ai_run (0); };
- void() ogre_mm_t_seek3 = [$stand3, ogre_mm_t_seek4] { ai_run (0); };
- void() ogre_mm_t_seek4 = [$stand4, ogre_mm_t_seek5] { ai_run (0); };
+ void() ogre_mm_t_seek1 = [$stand1, ogre_mm_t_seek2] { ai_run (0); F ()};
+ void() ogre_mm_t_seek2 = [$stand2, ogre_mm_t_seek3] { ai_run (0); F ()};
+ void() ogre_mm_t_seek3 = [$stand3, ogre_mm_t_seek4] { ai_run (0); F ()};
+ void() ogre_mm_t_seek4 = [$stand4, ogre_mm_t_seek5] { ai_run (0); F ()};
void() ogre_mm_t_seek5 = [$stand5, ogre_mm_t_seek6]
{
if (random() < 0.2)
- sound_idle (self, CHAN_VOICE, "ogre/ogidle.wav",
+ sound (self, CHAN_VOICE, "ogre/ogidle.wav",
VOL_HIGH, ATTN_IDLE);
ai_run (0);
+ F ()
};
- void() ogre_mm_t_seek6 = [$stand6, ogre_mm_t_seek7] { ai_run (0); };
- void() ogre_mm_t_seek7 = [$stand7, ogre_mm_t_seek8] { ai_run (0); };
- void() ogre_mm_t_seek8 = [$stand8, ogre_mm_t_seek9] { ai_run (0); };
- void() ogre_mm_t_seek9 = [$stand9, ogre_mm_t_seek1] { ai_run (0); };
+ void() ogre_mm_t_seek6 = [$stand6, ogre_mm_t_seek7] { ai_run (0); F ()};
+ void() ogre_mm_t_seek7 = [$stand7, ogre_mm_t_seek8] { ai_run (0); F ()};
+ void() ogre_mm_t_seek8 = [$stand8, ogre_mm_t_seek9] { ai_run (0); F ()};
+ void() ogre_mm_t_seek9 = [$stand9, ogre_mm_t_seek1] { ai_run (0); F ()};
+
+ #undef F
// end Preach -- dumptruck_ds
+#endif
//==============================================================
// Initialization
//==============================================================
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) monster_ogre_marksman_init =
{
+ #ifdef SSQC
if (deathmatch)
{
remove (e);
return;
}
+ #endif
e.classname = "monster_ogre_marksman";
e.classtype = CT_MONSTER_OGRE_MARKSMAN;
+ e.pos1 = OGRE_MINS;
+ e.pos2 = OGRE_MAXS;
- // custom_mdls dumptruck_ds
- precache_body_model (e, "progs/ogre.mdl");
- precache_head_model (e, "progs/h_ogre.mdl");
- precache_proj_model (e, "progs/grenade.mdl");
+ #ifdef CSQC
+ if (e.modelindex)
+ {
+ setmodelindex (e, e.modelindex);
+ setsize (e, OGRE_MINS, OGRE_MAXS);
+ }
+ #endif
- precache_sound_misc (e, "ogre/ogdrag.wav");
- precache_sound_death (e, "ogre/ogdth.wav");
- precache_sound_idle (e, "ogre/ogidle.wav");
- precache_sound_misc1 (e, "ogre/ogidle2.wav");
- precache_sound_pain (e, "ogre/ogpain1.wav");
- precache_sound_attack (e, "ogre/ogsawatk.wav");
- precache_sound_sight (e, "ogre/ogwake.wav");
+ #ifdef SSQC
+ precache_model ("progs/ogre.mdl");
+ precache_model ("progs/h_ogre.mdl");
+ precache_model ("progs/grenade.mdl");
- precache_gib1 (e, "progs/gib1.mdl");
- precache_gib2 (e, "progs/gib2.mdl");
- precache_gib3 (e, "progs/gib3.mdl");
+ precache_sound ("ogre/ogdrag.wav");
+ precache_sound ("ogre/ogdth.wav");
+ precache_sound ("ogre/ogidle.wav");
+ precache_sound ("ogre/ogidle2.wav");
+ precache_sound ("ogre/ogpain1.wav");
+ precache_sound ("ogre/ogsawatk.wav");
+ precache_sound ("ogre/ogwake.wav");
- e.solid = SOLID_SLIDEBOX;
- e.movetype = MOVETYPE_STEP;
+ precache_model ("progs/gib1.mdl");
+ precache_model ("progs/gib2.mdl");
+ precache_model ("progs/gib3.mdl");
- // custom_mdls dumptruck_ds
- body_model (e, "progs/ogre.mdl");
- // setmodel (e, "progs/ogre.mdl");
+ // set up model and size for later -- CEV
+ e.mdl = "progs/ogre.mdl";
- setsize (e, VEC_HULL2_MIN, VEC_HULL2_MAX);
if (!e.proj_speed_mod)
e.proj_speed_mod = 1;
@@ -1298,100 +1444,50 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
if (!e.health)
e.health = 200;
+ e.destroy = monster_ogre_destroy;
e.checkattack = monster_ogre_checkattack;
e.sightsound = monster_ogre_sightsound;
+
e.th_stand = ogre_stand1;
e.th_walk = ogre_walk1;
- if (e.spawnflags & I_AM_TURRET)
+ if (e.spawnflags & SPAWNFLAG_MONSTER_TURRET)
e.th_run = ogre_mm_t_seek1;
else
e.th_run = ogre_run1;
- e.destroy = monster_ogre_destroy;
e.th_melee = monster_ogre_attack_melee;
e.th_missile = ogre_mm_nail1;
// dumptruck_ds
e.th_turret = ogre_mm_t_atk1;
- // Berserk test from
- // http://celephais.net/board/view_thread.php?id=4&start=3465
- // -- dumptruck_ds
- if !(e.berserk)
- e.th_pain = monster_ogre_pain;
- else
+
+ // changed berserk test from field to flag -- CEV
+ if (self.spawnflags & SPAWNFLAG_MONSTER_BERSERK)
e.th_pain = sub_nullpain;
+ else
+ e.th_pain = monster_ogre_pain;
+ #endif
- // could be a call to monster_ogre_init but let's go
- // straight to walkmonster instead -- CEV
- base_walkmonster_init (e);
+ // InitMonster -- runs on both client & server -- CEV
+ base_monster_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() monster_ogre_marksman =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags & fields, inhibit if necessary -- CEV
+ BASE_MONSTER_PREINIT (base_monster_init_field)
monster_ogre_marksman_init (self);
};
+#endif
// };
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-/*QUAKED gib_head_ogre (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/h_ogre.mdl");
-}*/
-//----------------------------------------------------------------------
-// class gib_head_ogre: base_gib_head
-// {
- //--------------------------------------------------------------
- // ThrowHead
- //--------------------------------------------------------------
- void(entity act, vector dir, float dmg) throw_gib_head_ogre =
- {
- base_gib_head_throw (act, dir, dmg, gib_head_ogre_init);
- };
-
- //--------------------------------------------------------------
- void(entity e) gib_head_ogre_init =
- {
- e.classname = "gib_head_ogre";
- e.classtype = CT_GORE_HEAD_OGRE;
-
- // gib_init interprets spawnflags and will set .solid -- CEV
- base_gib_head_init (e);
-
- if (e.mdl_head != "")
- {
- precache_model (e.mdl_head);
- setmodel (e, e.mdl_head);
- }
- else
- {
- precache_model ("progs/h_ogre.mdl");
- setmodel (e, "progs/h_ogre.mdl");
- if (e.solid == SOLID_BBOX)
- setsize (e, OGRE_HEAD_MINS, OGRE_HEAD_MAXS);
- else if (e.solid == SOLID_TRIGGER)
- setsize (e, '-16 -16 0', '16 16 56');
- }
-
- e.frame = 0;
- };
-
- //--------------------------------------------------------------
- void() gib_head_ogre =
- {
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- gib_head_ogre_init (self);
- };
-// };
-
+#ifdef SSQC
/*QUAKED monster_dead_ogre (0 0.5 0.8) (-32 -32 -24) (32 32 64) SOLID ON_SIDE X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ({"path":"progs/ogre.mdl","frame":135});
@@ -1408,6 +1504,7 @@ model ("progs/h_ogre.mdl");
precache_model ("progs/ogre.mdl");
setmodel (e, "progs/ogre.mdl");
+ // TODO CEV
if (e.spawnflags & 2)
{
e.frame = $death14;
@@ -1436,3 +1533,8 @@ model ("progs/h_ogre.mdl");
monster_dead_ogre_init (self);
};
// };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+$flush
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/monsters/oldone.qc
diff --git a/qc/monsters/oldone.qc b/qc/monsters/oldone.qc
index 49c095e..a5923c4 100644
--- a/qc/monsters/oldone.qc
+++ b/qc/monsters/oldone.qc
@@ -3,10 +3,23 @@
//==============================================================================
//======================================================================
+// constants
+//======================================================================
+
+#if defined(CSQC) || defined(SSQC)
+const vector OLDONE_MINS = '-160 -128 -24';
+const vector OLDONE_MAXS = '160 128 256';
+#endif
+
+//======================================================================
// forward declarations
//======================================================================
// monster_oldone
+#ifdef CSQC
+void(float isnew) monster_oldone_netreceive;
+#endif
+#ifdef SSQC
void(vector dir) monster_oldone_finale1;// endgame
void() monster_oldone_finale2;
void() monster_oldone_finale3;
@@ -32,13 +45,19 @@ void() old_thrash15; void() old_thrash16; void() old_thrash17;
void() old_thrash18; void() old_thrash19; void() old_thrash20;
void(entity attacker, float damage) monster_oldone_pain; // interaction
void(vector dir) monster_oldone_destroy;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) monster_oldone_init;
+#endif
+#ifdef SSQC
void() monster_oldone;
+#endif
//======================================================================
// frame macros
//======================================================================
+#if defined(CSQC) || defined(SSQC)
$cd id1/models/old_one
$origin 0 0 24
$base base
@@ -54,14 +73,35 @@ $frame old40 old41 old42 old43 old44 old45 old46
$frame shake1 shake2 shake3 shake4 shake5 shake6 shake7 shake8
$frame shake9 shake10 shake11 shake12 shake13 shake14
$frame shake15 shake16 shake17 shake18 shake19 shake20
+#endif
//------------------------------------------------------------------------------
/*QUAKED monster_oldone (1 0 0) (-160 -128 -24) (160 128 256)
*/
//----------------------------------------------------------------------
-// class monster_oldone: base_walkmonster
+// class monster_oldone: base_monster
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) monster_oldone_netreceive =
+ {
+ // creates the newframe and netflags variables -- CEV
+ BASE_MONSTER_NETRECEIVE (monster_oldone_init,
+ OLDONE_MINS, OLDONE_MAXS)
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ #define F() \
+ /* { */ \
+ if (!(self.SendFlags & NETFLAG_BASE_ENTITY_FRAME)) \
+ { \
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME; \
+ } \
+ /* } */
+
//--------------------------------------------------------------
void(vector dir) monster_oldone_finale1 =
{
@@ -146,7 +186,7 @@ $frame shake15 shake16 shake17 shake18 shake19 shake20
{
// start shub thrashing wildly
self.enemy.think = old_thrash1;
- sound_death (self.enemy, CHAN_VOICE, "boss2/death.wav",
+ sound (self.enemy, CHAN_VOICE, "boss2/death.wav",
VOL_HIGH, ATTN_NORM);
lightstyle (0, "abcdefghijklmlkjihgfedcb");
};
@@ -160,8 +200,9 @@ $frame shake15 shake16 shake17 shake18 shake19 shake20
local float x, y, z;
local float r;
local entity n;
+ local void(entity e) func1;
- sound_misc (self, CHAN_VOICE, "boss2/pop2.wav",
+ sound (self, CHAN_VOICE, "boss2/pop2.wav",
VOL_HIGH, ATTN_NORM);
oldo = self.origin;
@@ -181,11 +222,12 @@ $frame shake15 shake16 shake17 shake18 shake19 shake20
r = random ();
if (r < 0.3)
- throw_gib_1 (self, dir, -999);
+ func1 = item_gib1_init;
else if (r < 0.6)
- throw_gib_2 (self, dir, -999);
+ func1 = item_gib2_init;
else
- throw_gib_3 (self, dir, -999);
+ func1 = item_gib3_init;
+ BASE_ITEM_GIB_THROW (dir, -999, func1)
y = y + 32;
}
x = x + 32;
@@ -220,93 +262,164 @@ $frame shake15 shake16 shake17 shake18 shake19 shake20
};
//--------------------------------------------------------------
- // Shub Stand function
- //--------------------------------------------------------------
- // void() old_stand = [$old1, old_stand] { };
-
- //--------------------------------------------------------------
// Shub Idle functions
//--------------------------------------------------------------
- void() old_idle1 = [$old1, old_idle2] { };
- void() old_idle2 = [$old2, old_idle3] { };
- void() old_idle3 = [$old3, old_idle4] { };
- void() old_idle4 = [$old4, old_idle5] { };
- void() old_idle5 = [$old5, old_idle6] { };
- void() old_idle6 = [$old6, old_idle7] { };
- void() old_idle7 = [$old7, old_idle8] { };
- void() old_idle8 = [$old8, old_idle9] { };
- void() old_idle9 = [$old9, old_idle10] { };
- void() old_idle10 = [$old10, old_idle11] { };
- void() old_idle11 = [$old11, old_idle12] { };
- void() old_idle12 = [$old12, old_idle13] { };
- void() old_idle13 = [$old13, old_idle14] { };
- void() old_idle14 = [$old14, old_idle15] { };
- void() old_idle15 = [$old15, old_idle16] { };
- void() old_idle16 = [$old16, old_idle17] { };
- void() old_idle17 = [$old17, old_idle18] { };
- void() old_idle18 = [$old18, old_idle19] { };
- void() old_idle19 = [$old19, old_idle20] { };
- void() old_idle20 = [$old20, old_idle21] { };
- void() old_idle21 = [$old21, old_idle22] { };
- void() old_idle22 = [$old22, old_idle23] { };
- void() old_idle23 = [$old23, old_idle24] { };
- void() old_idle24 = [$old24, old_idle25] { };
- void() old_idle25 = [$old25, old_idle26] { };
- void() old_idle26 = [$old26, old_idle27] { };
- void() old_idle27 = [$old27, old_idle28] { };
- void() old_idle28 = [$old28, old_idle29] { };
- void() old_idle29 = [$old29, old_idle30] { };
- void() old_idle30 = [$old30, old_idle31] { };
- void() old_idle31 = [$old31, old_idle32] { };
- void() old_idle32 = [$old32, old_idle33] { };
- void() old_idle33 = [$old33, old_idle34] { };
- void() old_idle34 = [$old34, old_idle35] { };
- void() old_idle35 = [$old35, old_idle36] { };
- void() old_idle36 = [$old36, old_idle37] { };
- void() old_idle37 = [$old37, old_idle38] { };
- void() old_idle38 = [$old38, old_idle39] { };
- void() old_idle39 = [$old39, old_idle40] { };
- void() old_idle40 = [$old40, old_idle41] { };
- void() old_idle41 = [$old41, old_idle42] { };
- void() old_idle42 = [$old42, old_idle43] { };
- void() old_idle43 = [$old43, old_idle44] { };
- void() old_idle44 = [$old44, old_idle45] { };
- void() old_idle45 = [$old45, old_idle46] { };
- void() old_idle46 = [$old46, old_idle1] { };
+ void() old_idle1 = [$old1, old_idle2] { F () };
+ void() old_idle2 = [$old2, old_idle3] { F () };
+ void() old_idle3 = [$old3, old_idle4] { F () };
+ void() old_idle4 = [$old4, old_idle5] { F () };
+ void() old_idle5 = [$old5, old_idle6] { F () };
+ void() old_idle6 = [$old6, old_idle7] { F () };
+ void() old_idle7 = [$old7, old_idle8] { F () };
+ void() old_idle8 = [$old8, old_idle9] { F () };
+ void() old_idle9 = [$old9, old_idle10] { F () };
+ void() old_idle10 = [$old10, old_idle11] { F () };
+ void() old_idle11 = [$old11, old_idle12] { F () };
+ void() old_idle12 = [$old12, old_idle13] { F () };
+ void() old_idle13 = [$old13, old_idle14] { F () };
+ void() old_idle14 = [$old14, old_idle15] { F () };
+ void() old_idle15 = [$old15, old_idle16] { F () };
+ void() old_idle16 = [$old16, old_idle17] { F () };
+ void() old_idle17 = [$old17, old_idle18] { F () };
+ void() old_idle18 = [$old18, old_idle19] { F () };
+ void() old_idle19 = [$old19, old_idle20] { F () };
+ void() old_idle20 = [$old20, old_idle21] { F () };
+ void() old_idle21 = [$old21, old_idle22] { F () };
+ void() old_idle22 = [$old22, old_idle23] { F () };
+ void() old_idle23 = [$old23, old_idle24] { F () };
+ void() old_idle24 = [$old24, old_idle25] { F () };
+ void() old_idle25 = [$old25, old_idle26] { F () };
+ void() old_idle26 = [$old26, old_idle27] { F () };
+ void() old_idle27 = [$old27, old_idle28] { F () };
+ void() old_idle28 = [$old28, old_idle29] { F () };
+ void() old_idle29 = [$old29, old_idle30] { F () };
+ void() old_idle30 = [$old30, old_idle31] { F () };
+ void() old_idle31 = [$old31, old_idle32] { F () };
+ void() old_idle32 = [$old32, old_idle33] { F () };
+ void() old_idle33 = [$old33, old_idle34] { F () };
+ void() old_idle34 = [$old34, old_idle35] { F () };
+ void() old_idle35 = [$old35, old_idle36] { F () };
+ void() old_idle36 = [$old36, old_idle37] { F () };
+ void() old_idle37 = [$old37, old_idle38] { F () };
+ void() old_idle38 = [$old38, old_idle39] { F () };
+ void() old_idle39 = [$old39, old_idle40] { F () };
+ void() old_idle40 = [$old40, old_idle41] { F () };
+ void() old_idle41 = [$old41, old_idle42] { F () };
+ void() old_idle42 = [$old42, old_idle43] { F () };
+ void() old_idle43 = [$old43, old_idle44] { F () };
+ void() old_idle44 = [$old44, old_idle45] { F () };
+ void() old_idle45 = [$old45, old_idle46] { F () };
+ void() old_idle46 = [$old46, old_idle1] { F () };
//--------------------------------------------------------------
// Shub Thrashing
//--------------------------------------------------------------
- void() old_thrash1 = [$shake1, old_thrash2] { lightstyle (0, "m"); };
- void() old_thrash2 = [$shake2, old_thrash3] { lightstyle (0, "k"); };
- void() old_thrash3 = [$shake3, old_thrash4] { lightstyle (0, "k"); };
- void() old_thrash4 = [$shake4, old_thrash5] { lightstyle (0, "i"); };
- void() old_thrash5 = [$shake5, old_thrash6] { lightstyle (0, "g"); };
- void() old_thrash6 = [$shake6, old_thrash7] { lightstyle (0, "e"); };
- void() old_thrash7 = [$shake7, old_thrash8] { lightstyle (0, "c"); };
- void() old_thrash8 = [$shake8, old_thrash9] { lightstyle (0, "a"); };
- void() old_thrash9 = [$shake9, old_thrash10] { lightstyle (0, "c"); };
- void() old_thrash10 = [$shake10, old_thrash11] { lightstyle (0, "e"); };
- void() old_thrash11 = [$shake11, old_thrash12] { lightstyle (0, "g"); };
- void() old_thrash12 = [$shake12, old_thrash13] { lightstyle (0, "i"); };
- void() old_thrash13 = [$shake13, old_thrash14] { lightstyle (0, "k"); };
- void() old_thrash14 = [$shake14, old_thrash15] { lightstyle (0, "m"); };
+ void() old_thrash1 = [$shake1, old_thrash2]
+ {
+ lightstyle (0, "m");
+ F ()
+ };
+ void() old_thrash2 = [$shake2, old_thrash3]
+ {
+ lightstyle (0, "k");
+ F ()
+ };
+ void() old_thrash3 = [$shake3, old_thrash4]
+ {
+ lightstyle (0, "k");
+ F ()
+ };
+ void() old_thrash4 = [$shake4, old_thrash5]
+ {
+ lightstyle (0, "i");
+ F ()
+ };
+ void() old_thrash5 = [$shake5, old_thrash6]
+ {
+ lightstyle (0, "g");
+ F ()
+ };
+ void() old_thrash6 = [$shake6, old_thrash7]
+ {
+ lightstyle (0, "e");
+ F ()
+ };
+ void() old_thrash7 = [$shake7, old_thrash8]
+ {
+ lightstyle (0, "c");
+ F ()
+ };
+ void() old_thrash8 = [$shake8, old_thrash9]
+ {
+ lightstyle (0, "a");
+ F ()
+ };
+ void() old_thrash9 = [$shake9, old_thrash10]
+ {
+ lightstyle (0, "c");
+ F ()
+ };
+ void() old_thrash10 = [$shake10, old_thrash11]
+ {
+ lightstyle (0, "e");
+ F ()
+ };
+ void() old_thrash11 = [$shake11, old_thrash12]
+ {
+ lightstyle (0, "g");
+ F ()
+ };
+ void() old_thrash12 = [$shake12, old_thrash13]
+ {
+ lightstyle (0, "i");
+ F ()
+ };
+ void() old_thrash13 = [$shake13, old_thrash14]
+ {
+ lightstyle (0, "k");
+ F ()
+ };
+ void() old_thrash14 = [$shake14, old_thrash15]
+ {
+ lightstyle (0, "m");
+ F ()
+ };
void() old_thrash15 = [$shake15, old_thrash16]
{
lightstyle (0, "m");
self.cnt = self.cnt + 1;
if (self.cnt != 3)
self.think = old_thrash1;
+ F ()
+ };
+ void() old_thrash16 = [$shake16, old_thrash17]
+ {
+ lightstyle (0, "g");
+ F ()
+ };
+ void() old_thrash17 = [$shake17, old_thrash18]
+ {
+ lightstyle (0, "c");
+ F ()
+ };
+ void() old_thrash18 = [$shake18, old_thrash19]
+ {
+ lightstyle (0, "b");
+ F ()
+ };
+ void() old_thrash19 = [$shake19, old_thrash20]
+ {
+ lightstyle (0, "a");
+ F ()
};
- void() old_thrash16 = [$shake16, old_thrash17] { lightstyle (0, "g"); };
- void() old_thrash17 = [$shake17, old_thrash18] { lightstyle (0, "c"); };
- void() old_thrash18 = [$shake18, old_thrash19] { lightstyle (0, "b"); };
- void() old_thrash19 = [$shake19, old_thrash20] { lightstyle (0, "a"); };
void() old_thrash20 = [$shake20, old_thrash20]
{
+ F ()
monster_oldone_finale4 ();
};
+ #undef F
+
//==============================================================
// Interaction
//==============================================================
@@ -347,6 +460,7 @@ $frame shake15 shake16 shake17 shake18 shake19 shake20
local float x, y, z;
local float r;
local float gibpow;
+ local void(entity e) func1;
sound (self, CHAN_VOICE, "boss2/pop2.wav",
VOL_HIGH, ATTN_NORM);
@@ -369,11 +483,12 @@ $frame shake15 shake16 shake17 shake18 shake19 shake20
r = random ();
if (r < 0.3)
- throw_gib_1 (self, dir, gibpow);
+ func1 = item_gib1_init;
else if (r < 0.6)
- throw_gib_2 (self, dir, gibpow);
+ func1 = item_gib2_init;
else
- throw_gib_3 (self, dir, gibpow);
+ func1 = item_gib3_init;
+ BASE_ITEM_GIB_THROW (dir, gibpow, func1)
y = y + 32;
}
x = x + 32;
@@ -383,15 +498,18 @@ $frame shake15 shake16 shake17 shake18 shake19 shake20
remove (self);
};
+#endif
//==============================================================
// Initialization
//==============================================================
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) monster_oldone_init =
{
- if (e.spawnflags & I_AM_TURRET)
+ #ifdef SSQC
+ if (e.spawnflags & SPAWNFLAG_MONSTER_TURRET)
objerror ("Incompatible spawnflag: TURRET_MODE\n");
if (deathmatch)
@@ -399,35 +517,54 @@ $frame shake15 shake16 shake17 shake18 shake19 shake20
remove (e);
return;
}
+ #endif
e.classname = "monster_oldone";
e.classtype = CT_MONSTER_BOSS_OLDONE;
+ e.pos1 = OLDONE_MINS;
+ e.pos2 = OLDONE_MAXS;
+
+ #ifdef CSQC
+ if (e.modelindex)
+ {
+ setmodelindex (e, e.modelindex);
+ setsize (e, OLDONE_MINS, OLDONE_MAXS);
+ }
+
+ // TODO CEV kinda sketchy to call base_monster_init here in
+ // CSQC and not in SSQC; maybe correct this later?
+ base_monster_init (e);
+ #endif
+
+ #ifdef SSQC
e.classgroup |= CG_MONSTER;
e.touch = base_monster_touch;
base_mapentity_init (e);
- precache_body_model2 (e, "progs/oldone.mdl");
- // precache_model2 ("progs/oldone.mdl");
+ precache_model2 ("progs/oldone.mdl");
- precache_sound2_death (e, "boss2/death.wav");
- // precache_sound2_idle ("boss2/idle.wav");
- precache_sound2_sight (e, "boss2/sight.wav");
+ precache_sound2 ("boss2/death.wav");
+ // precache_sound2 ("boss2/idle.wav");
+ precache_sound2 ("boss2/sight.wav");
// next line silences a compiler warning -- CEV
precache_sound2 ("boss2/pop2.wav");
- precache_sound2_misc (e, "boss2/pop2.wav");
+ precache_sound2 ("boss2/pop2.wav");
e.solid = SOLID_SLIDEBOX;
e.movetype = MOVETYPE_STEP;
// custom_mdls dumptruck_ds
- body_model (e, "progs/oldone.mdl");
- // setmodel (e, "progs/oldone.mdl");
- setsize (e, '-160 -128 -24', '160 128 256');
+ setmodel (e, "progs/oldone.mdl");
+
+ // set up size for later -- CEV
+ setsize (e, OLDONE_MINS, OLDONE_MAXS);
// kill by telefrag
e.health = 40000;
e.takedamage = DAMAGE_YES;
e.th_pain = monster_oldone_pain;
+
+ // TODO CEV
if (e.spawnflags & 2)
e.destroy = monster_oldone_destroy;
else
@@ -436,15 +573,24 @@ $frame shake15 shake16 shake17 shake18 shake19 shake20
total_monsters = total_monsters + 1;
e.think = old_idle1;
e.nextthink = time + 0.1;
+
+ // TODO CEV
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() monster_oldone =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags & fields, inhibit if necessary -- CEV
+ BASE_MONSTER_PREINIT (base_monster_init_field)
monster_oldone_init (self);
};
+#endif
// };
+
+
Return to the top of this page or return to the overview of this repo.
Diff qc/monsters/oldone2.qc
diff --git a/qc/monsters/oldone2.qc b/qc/monsters/oldone2.qc
index 4a052ca..bfca6fb 100644
--- a/qc/monsters/oldone2.qc
+++ b/qc/monsters/oldone2.qc
@@ -3,10 +3,24 @@
//==============================================================================
//======================================================================
+// constants
+//======================================================================
+
+#if defined(CSQC) || defined(SSQC)
+const vector OLDONE2_MINS = '-160 -128 -24';
+const vector OLDONE2_MAXS = '160 128 256';
+#endif
+
+//======================================================================
// forward declarations
//======================================================================
// monster_oldone2
+#ifdef CSQC
+void(float isnew) monster_oldone2_netreceive;
+#endif
+#ifdef SSQC
+// F() // macro to set FRAME netflag -- CEV
void() monster_oldone2_sightsound; // AI, attacks, thinking, animation
void(vector p) monster_oldone2_missile;
void() monster_oldone2_face;
@@ -52,13 +66,19 @@ void(entity attacker, float damage) monster_oldone2_pain; // interaction
void() monster_oldone2_think_destroy;
void(vector dir) monster_oldone2_destroy_twitch1;
void(vector dir) monster_oldone2_destroy;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) monster_oldone2_init; // initialization
+#endif
+#ifdef SSQC
void() monster_oldone2;
+#endif
//======================================================================
// frame macros
//======================================================================
+#if defined(CSQC) || defined(SSQC)
$cd id1/models/old2_one
$origin 0 0 24
$base base
@@ -74,18 +94,39 @@ $frame old40 old41 old42 old43 old44 old45 old46
$frame shake1 shake2 shake3 shake4 shake5 shake6 shake7 shake8
$frame shake9 shake10 shake11 shake12 shake13 shake14
$frame shake15 shake16 shake17 shake18 shake19 shake20
+#endif
//------------------------------------------------------------------------------
/*QUAKED monster_oldone2 (1 0 0) (-160 -128 -24) (160 128 256)
*/
//----------------------------------------------------------------------
-// class monster_oldone2: base_walkmonster
+// class monster_oldone2: base_monster
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) monster_oldone2_netreceive =
+ {
+ // creates the newframe and netflags variables -- CEV
+ BASE_MONSTER_NETRECEIVE (monster_oldone2_init,
+ OLDONE2_MINS, OLDONE2_MAXS)
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ #define F() \
+ /* { */ \
+ if (!(self.SendFlags & NETFLAG_BASE_ENTITY_FRAME)) \
+ { \
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME; \
+ } \
+ /* } */
+
//--------------------------------------------------------------
void() monster_oldone2_sightsound =
{
- sound_sight (self, CHAN_VOICE, "boss2/sight.wav",
+ sound (self, CHAN_VOICE, "boss2/sight.wav",
VOL_HIGH, ATTN_NORM);
};
@@ -119,7 +160,7 @@ $frame shake15 shake16 shake17 shake18 shake19 shake20
// lavaball in your face!
base_monster_fire_lavaball (org, d - org, LAVABALL_SPEED);
- sound_attack (self, CHAN_WEAPON, "boss1/throw.wav",
+ sound (self, CHAN_WEAPON, "boss1/throw.wav",
VOL_HIGH, ATTN_NORM);
// check for dead enemy
@@ -139,66 +180,60 @@ $frame shake15 shake16 shake17 shake18 shake19 shake20
self.enemy = findfloat (self.enemy, classtype,
CT_PLAYER);
}
- ai_face ();
- };
- //--------------------------------------------------------------
- /*
- void() monster_oldone2_stand =
- {
- ai_findtarget ();
+ ai_face ();
+ F ()
};
- */
//--------------------------------------------------------------
// Shub Idle functions
//--------------------------------------------------------------
- void() old2_idle1 = [$old1, old2_idle2] { ai_findtarget (); };
- void() old2_idle2 = [$old2, old2_idle3] { ai_findtarget (); };
- void() old2_idle3 = [$old3, old2_idle4] { ai_findtarget (); };
- void() old2_idle4 = [$old4, old2_idle5] { ai_findtarget (); };
- void() old2_idle5 = [$old5, old2_idle6] { ai_findtarget (); };
- void() old2_idle6 = [$old6, old2_idle7] { ai_findtarget (); };
- void() old2_idle7 = [$old7, old2_idle8] { ai_findtarget (); };
- void() old2_idle8 = [$old8, old2_idle9] { ai_findtarget (); };
- void() old2_idle9 = [$old9, old2_idle10] { ai_findtarget (); };
- void() old2_idle10 = [$old10, old2_idle11] { ai_findtarget (); };
- void() old2_idle11 = [$old11, old2_idle12] { ai_findtarget (); };
- void() old2_idle12 = [$old12, old2_idle13] { ai_findtarget (); };
- void() old2_idle13 = [$old13, old2_idle14] { ai_findtarget (); };
- void() old2_idle14 = [$old14, old2_idle15] { ai_findtarget (); };
- void() old2_idle15 = [$old15, old2_idle16] { ai_findtarget (); };
- void() old2_idle16 = [$old16, old2_idle17] { ai_findtarget (); };
- void() old2_idle17 = [$old17, old2_idle18] { ai_findtarget (); };
- void() old2_idle18 = [$old18, old2_idle19] { ai_findtarget (); };
- void() old2_idle19 = [$old19, old2_idle20] { ai_findtarget (); };
- void() old2_idle20 = [$old20, old2_idle21] { ai_findtarget (); };
- void() old2_idle21 = [$old21, old2_idle22] { ai_findtarget (); };
- void() old2_idle22 = [$old22, old2_idle23] { ai_findtarget (); };
- void() old2_idle23 = [$old23, old2_idle24] { ai_findtarget (); };
- void() old2_idle24 = [$old24, old2_idle25] { ai_findtarget (); };
- void() old2_idle25 = [$old25, old2_idle26] { ai_findtarget (); };
- void() old2_idle26 = [$old26, old2_idle27] { ai_findtarget (); };
- void() old2_idle27 = [$old27, old2_idle28] { ai_findtarget (); };
- void() old2_idle28 = [$old28, old2_idle29] { ai_findtarget (); };
- void() old2_idle29 = [$old29, old2_idle30] { ai_findtarget (); };
- void() old2_idle30 = [$old30, old2_idle31] { ai_findtarget (); };
- void() old2_idle31 = [$old31, old2_idle32] { ai_findtarget (); };
- void() old2_idle32 = [$old32, old2_idle33] { ai_findtarget (); };
- void() old2_idle33 = [$old33, old2_idle34] { ai_findtarget (); };
- void() old2_idle34 = [$old34, old2_idle35] { ai_findtarget (); };
- void() old2_idle35 = [$old35, old2_idle36] { ai_findtarget (); };
- void() old2_idle36 = [$old36, old2_idle37] { ai_findtarget (); };
- void() old2_idle37 = [$old37, old2_idle38] { ai_findtarget (); };
- void() old2_idle38 = [$old38, old2_idle39] { ai_findtarget (); };
- void() old2_idle39 = [$old39, old2_idle40] { ai_findtarget (); };
- void() old2_idle40 = [$old40, old2_idle41] { ai_findtarget (); };
- void() old2_idle41 = [$old41, old2_idle42] { ai_findtarget (); };
- void() old2_idle42 = [$old42, old2_idle43] { ai_findtarget (); };
- void() old2_idle43 = [$old43, old2_idle44] { ai_findtarget (); };
- void() old2_idle44 = [$old44, old2_idle45] { ai_findtarget (); };
- void() old2_idle45 = [$old45, old2_idle46] { ai_findtarget (); };
- void() old2_idle46 = [$old46, old2_idle1] { ai_findtarget (); };
+ void() old2_idle1 = [$old1, old2_idle2] { ai_findtarget (); F () };
+ void() old2_idle2 = [$old2, old2_idle3] { ai_findtarget (); F () };
+ void() old2_idle3 = [$old3, old2_idle4] { ai_findtarget (); F () };
+ void() old2_idle4 = [$old4, old2_idle5] { ai_findtarget (); F () };
+ void() old2_idle5 = [$old5, old2_idle6] { ai_findtarget (); F () };
+ void() old2_idle6 = [$old6, old2_idle7] { ai_findtarget (); F () };
+ void() old2_idle7 = [$old7, old2_idle8] { ai_findtarget (); F () };
+ void() old2_idle8 = [$old8, old2_idle9] { ai_findtarget (); F () };
+ void() old2_idle9 = [$old9, old2_idle10] { ai_findtarget (); F () };
+ void() old2_idle10 = [$old10, old2_idle11] { ai_findtarget (); F () };
+ void() old2_idle11 = [$old11, old2_idle12] { ai_findtarget (); F () };
+ void() old2_idle12 = [$old12, old2_idle13] { ai_findtarget (); F () };
+ void() old2_idle13 = [$old13, old2_idle14] { ai_findtarget (); F () };
+ void() old2_idle14 = [$old14, old2_idle15] { ai_findtarget (); F () };
+ void() old2_idle15 = [$old15, old2_idle16] { ai_findtarget (); F () };
+ void() old2_idle16 = [$old16, old2_idle17] { ai_findtarget (); F () };
+ void() old2_idle17 = [$old17, old2_idle18] { ai_findtarget (); F () };
+ void() old2_idle18 = [$old18, old2_idle19] { ai_findtarget (); F () };
+ void() old2_idle19 = [$old19, old2_idle20] { ai_findtarget (); F () };
+ void() old2_idle20 = [$old20, old2_idle21] { ai_findtarget (); F () };
+ void() old2_idle21 = [$old21, old2_idle22] { ai_findtarget (); F () };
+ void() old2_idle22 = [$old22, old2_idle23] { ai_findtarget (); F () };
+ void() old2_idle23 = [$old23, old2_idle24] { ai_findtarget (); F () };
+ void() old2_idle24 = [$old24, old2_idle25] { ai_findtarget (); F () };
+ void() old2_idle25 = [$old25, old2_idle26] { ai_findtarget (); F () };
+ void() old2_idle26 = [$old26, old2_idle27] { ai_findtarget (); F () };
+ void() old2_idle27 = [$old27, old2_idle28] { ai_findtarget (); F () };
+ void() old2_idle28 = [$old28, old2_idle29] { ai_findtarget (); F () };
+ void() old2_idle29 = [$old29, old2_idle30] { ai_findtarget (); F () };
+ void() old2_idle30 = [$old30, old2_idle31] { ai_findtarget (); F () };
+ void() old2_idle31 = [$old31, old2_idle32] { ai_findtarget (); F () };
+ void() old2_idle32 = [$old32, old2_idle33] { ai_findtarget (); F () };
+ void() old2_idle33 = [$old33, old2_idle34] { ai_findtarget (); F () };
+ void() old2_idle34 = [$old34, old2_idle35] { ai_findtarget (); F () };
+ void() old2_idle35 = [$old35, old2_idle36] { ai_findtarget (); F () };
+ void() old2_idle36 = [$old36, old2_idle37] { ai_findtarget (); F () };
+ void() old2_idle37 = [$old37, old2_idle38] { ai_findtarget (); F () };
+ void() old2_idle38 = [$old38, old2_idle39] { ai_findtarget (); F () };
+ void() old2_idle39 = [$old39, old2_idle40] { ai_findtarget (); F () };
+ void() old2_idle40 = [$old40, old2_idle41] { ai_findtarget (); F () };
+ void() old2_idle41 = [$old41, old2_idle42] { ai_findtarget (); F () };
+ void() old2_idle42 = [$old42, old2_idle43] { ai_findtarget (); F () };
+ void() old2_idle43 = [$old43, old2_idle44] { ai_findtarget (); F () };
+ void() old2_idle44 = [$old44, old2_idle45] { ai_findtarget (); F () };
+ void() old2_idle45 = [$old45, old2_idle46] { ai_findtarget (); F () };
+ void() old2_idle46 = [$old46, old2_idle1] { ai_findtarget (); F () };
//--------------------------------------------------------------
// Shub Attack!
@@ -214,6 +249,7 @@ $frame shake15 shake16 shake17 shake18 shake19 shake20
void() old2_atk9 = [$old9, old2_atk10]
{
monster_oldone2_missile ('0 -16 416');
+ F ()
};
void() old2_atk10 = [$old10, old2_atk11] { monster_oldone2_face (); };
void() old2_atk11 = [$old11, old2_atk12] { monster_oldone2_face (); };
@@ -226,6 +262,7 @@ $frame shake15 shake16 shake17 shake18 shake19 shake20
void() old2_atk18 = [$old18, old2_atk19]
{
monster_oldone2_missile ('0 -16 416');
+ F ()
};
void() old2_atk19 = [$old19, old2_atk20] { monster_oldone2_face (); };
void() old2_atk20 = [$old20, old2_atk21] { monster_oldone2_face (); };
@@ -238,6 +275,7 @@ $frame shake15 shake16 shake17 shake18 shake19 shake20
void() old2_atk27 = [$old27, old2_atk28]
{
monster_oldone2_missile ('0 -16 416');
+ F ()
};
void() old2_atk28 = [$old28, old2_atk29] { monster_oldone2_face (); };
void() old2_atk29 = [$old29, old2_atk30] { monster_oldone2_face (); };
@@ -250,6 +288,7 @@ $frame shake15 shake16 shake17 shake18 shake19 shake20
void() old2_atk36 = [$old36, old2_atk37]
{
monster_oldone2_missile ('0 -16 416');
+ F ()
};
void() old2_atk37 = [$old37, old2_atk38] { monster_oldone2_face (); };
void() old2_atk38 = [$old38, old2_atk39] { monster_oldone2_face (); };
@@ -262,6 +301,7 @@ $frame shake15 shake16 shake17 shake18 shake19 shake20
void() old2_atk45 = [$old45, old2_atk46]
{
monster_oldone2_missile ('0 -16 416');
+ F ()
};
void() old2_atk46 = [$old46, old2_atk1] { monster_oldone2_face (); };
@@ -270,36 +310,42 @@ $frame shake15 shake16 shake17 shake18 shake19 shake20
//--------------------------------------------------------------
void() old2_twitch1 = [$shake1, old2_twitch2]
{
- sound_misc (self, CHAN_VOICE, "boss2/pop2.wav",
+ sound (self, CHAN_VOICE, "boss2/pop2.wav",
VOL_HIGH, ATTN_NONE);
+ F ()
+ };
+ void() old2_twitch2 = [$shake2, old2_twitch3] { F () };
+ void() old2_twitch3 = [$shake3, old2_twitch4] { F () };
+ void() old2_twitch4 = [$shake4, old2_twitch5] { F () };
+ void() old2_twitch5 = [$shake5, old2_twitch6] { F () };
+ void() old2_twitch6 = [$shake6, old2_twitch7] { F () };
+ void() old2_twitch7 = [$shake7, old2_twitch8] { F () };
+ void() old2_twitch8 = [$shake8, old2_twitch9] { F () };
+ void() old2_twitch9 = [$shake9, old2_twitch10] { F () };
+ void() old2_twitch10 = [$shake10, old2_twitch11] { F () };
+ void() old2_twitch11 = [$shake11, old2_twitch12] { F () };
+ void() old2_twitch12 = [$shake12, old2_twitch13] { F () };
+ void() old2_twitch13 = [$shake13, old2_twitch14] { F () };
+ void() old2_twitch14 = [$shake14, old2_twitch15] { F () };
+ void() old2_twitch15 = [$shake15, old2_twitch16] { F () };
+ void() old2_twitch16 = [$shake16, old2_twitch17] { F () };
+ void() old2_twitch17 = [$shake17, old2_twitch18] { F () };
+ void() old2_twitch18 = [$shake18, old2_twitch19] { F () };
+ void() old2_twitch19 = [$shake19, old2_twitch20] { F () };
+ void() old2_twitch20 = [$shake20, old2_twitch21] { F () };
+ void() old2_twitch21 = [$shake17, old2_twitch22] { F () };
+ void() old2_twitch22 = [$shake18, old2_twitch23] { F () };
+ void() old2_twitch23 = [$shake19, old2_twitch24] { F () };
+ void() old2_twitch24 = [$shake20, old2_twitch25] { F () };
+ void() old2_twitch25 = [$shake17, old2_twitch26] { F () };
+ void() old2_twitch26 = [$shake18, old2_twitch27] { F () };
+ void() old2_twitch27 = [$shake19, old2_twitch28] { F () };
+ void() old2_twitch28 = [$shake20, monster_oldone2_think_destroy]
+ {
+ F ()
};
- void() old2_twitch2 = [$shake2, old2_twitch3] { };
- void() old2_twitch3 = [$shake3, old2_twitch4] { };
- void() old2_twitch4 = [$shake4, old2_twitch5] { };
- void() old2_twitch5 = [$shake5, old2_twitch6] { };
- void() old2_twitch6 = [$shake6, old2_twitch7] { };
- void() old2_twitch7 = [$shake7, old2_twitch8] { };
- void() old2_twitch8 = [$shake8, old2_twitch9] { };
- void() old2_twitch9 = [$shake9, old2_twitch10] { };
- void() old2_twitch10 = [$shake10, old2_twitch11] { };
- void() old2_twitch11 = [$shake11, old2_twitch12] { };
- void() old2_twitch12 = [$shake12, old2_twitch13] { };
- void() old2_twitch13 = [$shake13, old2_twitch14] { };
- void() old2_twitch14 = [$shake14, old2_twitch15] { };
- void() old2_twitch15 = [$shake15, old2_twitch16] { };
- void() old2_twitch16 = [$shake16, old2_twitch17] { };
- void() old2_twitch17 = [$shake17, old2_twitch18] { };
- void() old2_twitch18 = [$shake18, old2_twitch19] { };
- void() old2_twitch19 = [$shake19, old2_twitch20] { };
- void() old2_twitch20 = [$shake20, old2_twitch21] { };
- void() old2_twitch21 = [$shake17, old2_twitch22] { };
- void() old2_twitch22 = [$shake18, old2_twitch23] { };
- void() old2_twitch23 = [$shake19, old2_twitch24] { };
- void() old2_twitch24 = [$shake20, old2_twitch25] { };
- void() old2_twitch25 = [$shake17, old2_twitch26] { };
- void() old2_twitch26 = [$shake18, old2_twitch27] { };
- void() old2_twitch27 = [$shake19, old2_twitch28] { };
- void() old2_twitch28 = [$shake20, monster_oldone2_think_destroy] { };
+
+ #undef F
//==============================================================
// Interaction
@@ -314,7 +360,7 @@ $frame shake15 shake16 shake17 shake18 shake19 shake20
return;
// new pain sound
- sound_pain (self, CHAN_AUTO, "oldone2/pd_pop2.wav",
+ sound (self, CHAN_AUTO, "oldone2/pd_pop2.wav",
VOL_HIGH, ATTN_NORM);
old2_atk1 ();
self.pain_finished = time + 4;
@@ -346,6 +392,7 @@ $frame shake15 shake16 shake17 shake18 shake19 shake20
local vector oldo;
local float x, y, z;
local float r;
+ local void(entity e) func1;
oldo = self.origin + '0 0 112';
@@ -364,11 +411,12 @@ $frame shake15 shake16 shake17 shake18 shake19 shake20
r = random ();
if (r < 0.3)
- throw_gib_1 (self, dir, -120);
+ func1 = item_gib1_init;
else if (r < 0.6)
- throw_gib_2 (self, dir, -120);
+ func1 = item_gib2_init;
else
- throw_gib_3 (self, dir, -120);
+ func1 = item_gib3_init;
+ BASE_ITEM_GIB_THROW (dir, -120, func1)
y = y + 32;
}
x = x + 32;
@@ -378,19 +426,22 @@ $frame shake15 shake16 shake17 shake18 shake19 shake20
particle (oldo, '0 0 0', 0, 255);
particle (oldo, '128 128 128', 0, 255);
- sound_death (self, CHAN_VOICE, "player/teledth1.wav",
+ sound (self, CHAN_VOICE, "player/teledth1.wav",
VOL_HIGH, ATTN_NONE);
remove (self);
};
+#endif
//==============================================================
// Initialization
//==============================================================
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) monster_oldone2_init =
{
- if (e.spawnflags & I_AM_TURRET)
+ #ifdef SSQC
+ if (e.spawnflags & SPAWNFLAG_MONSTER_TURRET)
objerror ("Incompatible spawnflag: TURRET_MODE\n");
if (deathmatch)
@@ -398,34 +449,46 @@ $frame shake15 shake16 shake17 shake18 shake19 shake20
remove (e);
return;
}
+ #endif
e.classname = "monster_oldone2";
e.classtype = CT_MONSTER_BOSS_OLDONE2;
+ e.pos1 = OLDONE2_MINS;
+ e.pos2 = OLDONE2_MAXS;
+
+ #ifdef CSQC
+ if (e.modelindex)
+ {
+ setmodelindex (e, e.modelindex);
+ setsize (e, OLDONE2_MINS, OLDONE2_MAXS);
+ }
+ #endif
+
base_monster_init (e);
- precache_body_model2 (e, "progs/oldone.mdl");
- // precache_model2 ("progs/oldone.mdl");
+ #ifdef SSQC
+ precache_model2 ("progs/oldone.mdl");
- precache_sound2_death (e, "boss2/death.wav");
- // precache_sound2_idle ("boss2/idle.wav");
- precache_sound2_sight (e, "boss2/sight.wav");
- precache_sound2_misc (e, "boss2/pop2.wav");
- precache_sound2_pain (e, "oldone2/pd_pop2.wav");
+ precache_sound2 ("boss2/death.wav");
+ // precache_sound2 ("boss2/idle.wav");
+ precache_sound2 ("boss2/sight.wav");
+ precache_sound2 ("boss2/pop2.wav");
+ precache_sound2 ("oldone2/pd_pop2.wav");
precache_model ("progs/lavaball.mdl");
precache_sound ("boss1/throw.wav");
- precache_gib1 (e, "progs/gib1.mdl");
- precache_gib2 (e, "progs/gib2.mdl");
- precache_gib3 (e, "progs/gib3.mdl");
+ precache_model ("progs/gib1.mdl");
+ precache_model ("progs/gib2.mdl");
+ precache_model ("progs/gib3.mdl");
e.solid = SOLID_SLIDEBOX;
e.movetype = MOVETYPE_STEP;
- // custom_mdls dumptruck_ds
- body_model (e, "progs/oldone.mdl");
- // setmodel (e, "progs/oldone.mdl");
- setsize (e, '-160 -128 -24', '160 128 256');
+ setmodel (e, "progs/oldone.mdl");
+
+ // set up size for later -- CEV
+ setsize (e, OLDONE2_MINS, OLDONE2_MAXS);
if (!e.health)
if (skill == 0)
@@ -443,15 +506,26 @@ $frame shake15 shake16 shake17 shake18 shake19 shake20
e.nextthink = time + 0.1;
total_monsters = total_monsters + 1;
+
+ // TODO CEV
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() monster_oldone2 =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags & fields, inhibit if necessary -- CEV
+ BASE_MONSTER_PREINIT (base_monster_init_field)
monster_oldone2_init (self);
};
+#endif
// };
+
+#if defined(CSQC) || defined(SSQC)
+$flush
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/monsters/playerclient.qc
diff --git a/qc/monsters/playerclient.qc b/qc/monsters/playerclient.qc
index 6d5f143..d1c2fa0 100644
--- a/qc/monsters/playerclient.qc
+++ b/qc/monsters/playerclient.qc
@@ -9,9 +9,8 @@
#ifdef SSQC
const float PLAYER_HEALTH = 100; // id1 100
const float PLAYER_HEALTH_CORPSE = 30;
+const float PLAYER_HEALTH_MEGA = 200; // id1 250
-const vector PLAYER_HEAD_MINS = '-9.67 -12.38 -2.1';
-const vector PLAYER_HEAD_MAXS = '11.49 50.7 30';
const vector PLAYER_CORPSE_C_MINS = '-50.28 -23.55 -49.85';
const vector PLAYER_CORPSE_C_MAXS = '30.66 14.49 30';
const vector PLAYER_CORPSE_E_MINS = '-38.72 -5.83 -50.45';
@@ -25,21 +24,27 @@ const float PLAYER_CROUCH_SMOOTH = 0.1f;
#endif
#if defined(CSQC) || defined(SSQC)
-enumflags
+//----------------------------------------------------------------------
+// player netflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
{
- PLAYER_NET_FRAME, // frame has changed
- PLAYER_NET_MODEL, // model has changed
- PLAYER_NET_ORIGIN, // origin has changed
- PLAYER_NET_SIZE, // size has changed (mins, maxs)
- PLAYER_NET_ANGLES, // player angles have changed
- PLAYER_NET_VELOCITY, // velocity has changed
- PLAYER_NET_FLAGS, // .flags & .pm_flags
- PLAYER_NET_TIMERS, // .pm_timer
- PLAYER_NET_EFFECTS, // .sveffects has changed
- PLAYER_NET_SOLID, // .solid and/or .movetype have changed
- PLAYER_NET_ITEMS, // .items (& others) have changed
- PLAYER_NET_PUNCHANGLE // .punchangle has changed
-};
+ NETFLAG_PLAYER_FRAME, // frame has changed
+ NETFLAG_PLAYER_MODEL, // model has changed
+ NETFLAG_PLAYER_ORIGIN, // origin has changed
+ NETFLAG_PLAYER_SIZE, // size has changed (mins, maxs)
+ NETFLAG_PLAYER_ANGLES, // player angles have changed
+ NETFLAG_PLAYER_VELOCITY, // velocity has changed
+ NETFLAG_PLAYER_FLAGS, // .flags & .pm_flags
+ NETFLAG_PLAYER_TIMERS, // .pm_timer
+ NETFLAG_PLAYER_SOLID, // .solid and/or .movetype have changed
+ NETFLAG_PLAYER_WEAPON, // .weapon, .weaponframe
+ NETFLAG_PLAYER_ITEMS, // .items (& others) have changed
+ NETFLAG_PLAYER_INVENTORY, // .inventory1 thru .inventory8
+ NETFLAG_PLAYER_AMMO, // ammo fields have changed
+ NETFLAG_PLAYER_HEALTH, // .health has changed
+ NETFLAG_PLAYER_PUNCHANGLE // .punchangle has changed
+} player_netflags;
#endif
//======================================================================
@@ -52,8 +57,11 @@ float view_bob_old;
float view_crouch; // view smoothing for crouching -- CEV
float view_crouch_old;
float view_crouch_finished;
-float view_punch1; // punchangle_x -- CEV
-float view_punch2;
+vector view_error; // prediction error correction -- CEV
+float view_error_speed;
+float view_error_time;
+vector view_punch1; // CSQC punchangle -- CEV
+vector view_punch2;
float view_punch_time;
float view_step; // view smoothing for steps -- CEV
float view_step_adjust;
@@ -75,7 +83,6 @@ float modelindex_player;
.float axhitme;
.float fly_sound;
.float jump_flag; // player jump flag
-.float reset_items; // dumptruck_ds
#endif
#ifdef SSQC
@@ -117,10 +124,6 @@ float modelindex_player;
.float button8;
#endif
-#ifdef CSQC
-.float commandframe;
-#endif
-
//======================================================================
// forward declarations
//======================================================================
@@ -129,31 +132,30 @@ float modelindex_player;
#ifdef CSQC
// PLAYER_PREDICTION_SAVE(e)
// PLAYER_PREDICTION_RESET(e)
-// PLAYER_PREDICTION(e, endframe)
+// PLAYER_PREDICTION_ERRORCHECK(org_client, org_server)
// PLAYER_VIEW_BOB(e)
// PLAYER_VIEW_CROUCH(e)
// PLAYER_VIEW_PUNCHANGLE()
// PLAYER_VIEW_ROLL(e)
// PLAYER_VIEW_STEPS(e)
+// PLAYER_VIEW_ERROR(e)
void(float isnew) player_netreceive;
float() player_predraw;
-static void() player_remove;
-void(entity e) player_prediction_preframe;
-void(entity e) player_prediction_postframe;
+void(float endframe) player_prediction_run;
#endif
#ifdef SSQC
float(entity to, float netflags) player_netsend;
void() player_impulse_cheat; // impulse commands
void() player_impulse_quadcheat;
void() player_impulse_serverflags;
-void() player_impulse_changeweapon;
-void() player_impulse_cycleweapon;
-void() player_impulse_cycleweaponreverse;
+// PLAYER_IMPULSE_BESTWEAPON_SCAN(i, idx, WEAPON)
+void() player_impulse_bestweapon;
+void(float imp) player_impulse_changeweapon;
+void(float fwd) player_impulse_cycleinventory;
void() player_impulse;
void() player_superdamage_sound;
-void() player_set_current_ammo; // ammo, weapon firing, attacks
-float() player_best_weapon;
-float() player_check_no_ammo;
+float(float idx) player_check_no_ammo; // ammo, weapon firing, attacks
+void() player_fire_hands;
void() player_fire_axe;
void() player_fire_shotgun;
void() player_fire_supershotgun;
@@ -164,6 +166,7 @@ void() player_fire_tribolt;
void() player_fire_rocket;
void() player_fire_lightning;
void() player_attack;
+void() player_throw_item;
void() player_set_suicide_frame; // pain, damage, death
void() player_pain_sound;
void() player_death_sound;
@@ -212,7 +215,7 @@ void() pl_diee5; void() pl_diee6; void() pl_diee7; void() pl_diee8;
void() pl_diee9;
void() player_death_think;
void() player_prethink_watermove;
-void() player_prethink;
+// PLAYER_PRETHINK()
void() player_postthink_powerups;
void() player_postthink;
void(entity attacker, float damage) player_pain;
@@ -235,13 +238,6 @@ strip void() player;
#endif
#ifdef SSQC
-// gib_head_player
-void(entity act, vector dir, float dmg) throw_gib_head_player;
-void(entity e) gib_head_player_init;
-void() gib_head_player;
-#endif
-
-#ifdef SSQC
// player_dead_axe
void() player_dead_axe;
#endif
@@ -260,6 +256,7 @@ void() player_dead_on_side;
// frame macros
//======================================================================
+#if defined(CSQC) || defined(SSQC)
$cd id1/models/player_4
$origin 0 -6 24
$base base
@@ -305,6 +302,15 @@ $frame axattb1 axattb2 axattb3 axattb4 axattb5 axattb6
$frame axattc1 axattc2 axattc3 axattc4 axattc5 axattc6
$frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
+// MG1 compat -- CEV
+const float CORPSEFRAME_PLAYER_1 = $axdeth9;
+const float CORPSEFRAME_PLAYER_2 = $deatha11;
+const float CORPSEFRAME_PLAYER_3 = $deathb9;
+const float CORPSEFRAME_PLAYER_4 = $deathc15;
+const float CORPSEFRAME_PLAYER_5 = $deathd9;
+const float CORPSEFRAME_PLAYER_6 = $deathe9;
+#endif
+
//------------------------------------------------------------------------------
//----------------------------------------------------------------------
@@ -319,122 +325,84 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
#ifdef CSQC
//--------------------------------------------------------------
#define PLAYER_PREDICTION_SAVE(e) \
- { \
+ /* { */ \
e.origin_net = e.origin; \
e.velocity_net = e.velocity; \
e.angles_net = e.angles; \
e.flags_net = e.flags; \
e.pm_flags_net = e.pm_flags; \
e.pm_timer_net = e.pm_timer; \
- }
+ /* } */
//--------------------------------------------------------------
// was Pred_ResetPlayerPrediction in CSQCTest cs/prediction.qc
//--------------------------------------------------------------
#define PLAYER_PREDICTION_RESET(e) \
- { \
+ /* { */ \
e.origin = e.origin_net; \
e.velocity = e.velocity_net; \
e.angles = e.angles_net; \
e.flags = e.flags_net; \
e.pm_flags = e.pm_flags_net; \
e.pm_timer = e.pm_timer_net; \
- /* setsize (e, e.mins, e.maxs); */ \
if (e.pm_flags & PMF_CROUCHED) \
setsize (e, PM_CROUCH_MIN, PM_CROUCH_MAX); \
else \
setsize (e, PM_STAND_MIN, PM_STAND_MAX); \
- if (e.commandframe < clientcommandframe - 128) \
+ pmovecommandframe = view_player_commandframe + 1; \
+ if (pmovecommandframe < clientcommandframe - 128) \
+ { \
/* avoid an infinite loop */ \
- e.commandframe = clientcommandframe - 128; \
- }
+ dprint (sprintf("PLAYER_PREDICTION_RESET: " \
+ "pmovecommandframe is behind by %g\n", \
+ clientcommandframe - pmovecommandframe)); \
+ pmovecommandframe = clientcommandframe - 128; \
+ } \
+ /* } */
//--------------------------------------------------------------
- // was Pred_RunMovement in CSQCTest cs/prediction.qc
+ // based on code from CSQCTest -- CEV
//--------------------------------------------------------------
- #define PLAYER_PREDICTION(e, endframe) \
- { \
- if (servercommandframe >= e.commandframe + 63) \
+ #define PLAYER_PREDICTION_ERRORCHECK(org_client, org_server) \
+ /* { */ \
+ if (vlen(org_client - org_server) > 64) \
{ \
- /* we're meant to be updating the player faster than
- * this. hopefully its just that we're throttled... */ \
- /* you can comment out this block and the player will
- * continue to be predicted locally. But its best to
- * freeze them */ \
- /* dprint ("player_prediction: slow update\n"); */ \
- e.commandframe = servercommandframe - 63; \
+ /* teleport? */ \
+ view_error = '0 0 0'; \
+ view_error_time = time; \
+ view_error_speed = 24.0f; \
} \
else \
{ \
- if (getstatf(STAT_HEALTH) <= 0) \
+ view_error = (view_error_time - time) * \
+ view_error_speed * view_error + \
+ (org_client - org_server); \
+ if (vlen(view_error) < 1) \
{ \
- /* dead, so don't run prediction. :D */ \
- e.commandframe = clientcommandframe; \
- if (getinputstate(e.commandframe - 1) == FALSE) \
- { \
- dprint ("PLAYER_PREDICTION: noop?\n"); \
- /* TODO CEV no-op ? */ \
- } \
+ view_error = '0 0 0'; \
} \
else \
{ \
- /* 'self' needs to be the entity moving for
- * the macros below to work -- CEV */ \
- local entity oself = self; \
- self = e; \
- /* update view_pl -- CEV */ \
- if (self.entnum == player_localentnum) { \
- if (self != view_pl) \
- { \
- view_pl = self; \
- } } \
- for (float lc = e.commandframe + 1; \
- lc <= endframe; lc++) \
+ view_error_time = time + 1 / \
+ view_error_speed; \
+ /*
+ if (vlen(org_client - org_server)) \
{ \
- local float f = getinputstate (lc); \
- if (f == FALSE) \
- { \
- /* no input from client */ \
- break; \
- } \
- if (input_timelength <= 0) \
- { \
- break; \
- } \
- /*
- if (i == clientcommandframe)
- CSQC_Input_Frame ();
- */ \
- /* do the move; see pmove.qc -- CEV */ \
- PM_MOVE_PRE () \
- PM_MOVE_MOVETYPES () \
- PM_MOVE_POST () \
- /* don't do step smoothing when flagged
- * not to -- CEV */ \
- if (self.pm_flags & PMF_ONMOVINGENT) { \
- if (view_step_disable == FALSE) \
- { \
- view_step_disable = TRUE; \
- } } \
- else if (view_step_disable) \
- { \
- view_step_disable = FALSE; \
- } \
+ dprint (sprintf("PLAYER_PREDICTION_" \
+ "ERRORCHECK: pmove err %g\n", \
+ vlen(org_client-org_server)); \
} \
- /* restore 'self' -- CEV */ \
- self = oself; \
- /* add anything that was applied after
- * (for low packet rate protocols) */ \
- /* input_angles = view_angles; */ \
+ */ \
} \
} \
- } \
+ /* } */
//--------------------------------------------------------------
// PLAYER_VIEW_BOB -- view bob (based on Ironwail's V_CalcBob) -- CEV
//--------------------------------------------------------------
#define PLAYER_VIEW_BOB(e) \
- { \
+ /* { */ \
+ /* TODO CEV this currently has problems */ \
local float cl_bob = autocvar (cl_bob, 0.02); \
local float cl_bobcycle = autocvar (cl_bobcycle, 0.6); \
if (cl_bob && cl_bobcycle) \
@@ -450,8 +418,9 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
(1.0 - cl_bobup); \
/* bob is proportional to velocity in the xy plane
* (don't count Z, or jumping messes it up) */ \
- view_bob = vlen ([self.velocity_x, self.velocity_y]); \
- view_bob *= cl_bob; \
+ /* we've already calculated the player's current
+ * speed elsewhere in pmove -- CEV */ \
+ view_bob = e.speed * cl_bob; \
view_bob = view_bob * 0.3 + view_bob * 0.7 * sin(C); \
view_bob = bound (-7, view_bob, 4); \
/* only bob when onground and try to limit abrupt
@@ -504,13 +473,13 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
view_bob_old = 0; \
} \
view_origin.z += view_bob; \
- }
+ /* } */
//--------------------------------------------------------------
// PLAYER_VIEW_CROUCH -- smooth crouching -- CEV
//--------------------------------------------------------------
#define PLAYER_VIEW_CROUCH(e) \
- { \
+ /* { */ \
if (view_crouch_finished > time) \
{ \
if (view_crouch_old != e.view_ofs.z) \
@@ -529,32 +498,43 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
view_crouch = e.view_ofs.z; \
} \
view_origin.z += view_crouch; \
- }
+ /* } */
//--------------------------------------------------------------
// PLAYER_VIEW_PUNCHANGLE -- punchangle code from Ironwail -- CEV
//--------------------------------------------------------------
#define PLAYER_VIEW_PUNCHANGLE() \
- { \
+ /* { */ \
/* punchangle code from Ironwail -- CEV */ \
if (autocvar(v_gunkick, 1)) { \
if (view_punch2 || view_punch1) \
{ \
- view_angles.x += view_punch2 + bound \
+ view_angles.x += view_punch2.x + bound \
+ (0, (time - view_punch_time) / 0.1f, 1) * \
+ (view_punch1.x - view_punch2.x); \
+ view_angles.y += view_punch2.y + bound \
(0, (time - view_punch_time) / 0.1f, 1) * \
- (view_punch1 - view_punch2); \
+ (view_punch1.y - view_punch2.y); \
+ view_angles.z += view_punch2.z + bound \
+ (0, (time - view_punch_time) / 0.1f, 1) * \
+ (view_punch1.z - view_punch2.z); \
} } \
- }
+ /* } */
//--------------------------------------------------------------
// PLAYER_VIEW_ROLL -- sideways view roll code from Ironwail -- CEV
//--------------------------------------------------------------
#define PLAYER_VIEW_ROLL(e) \
- { \
+ /* { */ \
local float view_rollspeed = autocvar (cl_rollspeed, 200); \
local float view_rollangle = autocvar (cl_rollangle, 2.0f); \
if (view_rollspeed && view_rollangle) \
{ \
+ if (e.pm_flags & PMF_CROUCHSLIDE || \
+ e.pm_flags & PMF_ONSLICK) \
+ { \
+ view_rollangle = min (4, view_rollangle * 4); \
+ } \
local float view_roll = e.velocity * v_right; \
local float view_sign = view_roll < 0 ? -1 : 1; \
view_roll = fabs (view_roll); \
@@ -563,23 +543,28 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
else \
view_roll = view_rollangle; \
view_angles.z += view_roll * view_sign; \
+ /*
+ dprint (sprintf("PLAYER_VIEW_ROLL: view_angles_z " \
+ "%g\n", view_angles.z)); \
+ */ \
} \
- }
+ /* } */
//--------------------------------------------------------------
// PLAYER_VIEW_STEPS -- step smoothing, based on CSQCTest -- CEV
//--------------------------------------------------------------
#define PLAYER_VIEW_STEPS(e) \
- { \
+ /* { */ \
local float view_step_diff = e.origin.z - view_step_oldz; \
if (view_step_disable == FALSE) { \
if (e.pm_flags & PMF_ONGROUND) { \
if (view_step_diff >= 4 && view_step_diff <= PM_STEPHEIGHT) \
{ \
+ /* was * 0.018f or serverdeltatime -- CEV */ \
if (e.speed) \
- view_step_adjust = e.speed * 0.018; \
+ view_step_adjust = e.speed * 0.018f; \
else \
- view_step_adjust = PM_MAXSPEED * 0.018; \
+ view_step_adjust = PM_MAXSPEED * 0.018f; \
view_step_adjust = bound (4, view_step_adjust, 16); \
/* evaluate out the remaining old step */ \
if (view_step_time - time > 0) \
@@ -590,7 +575,7 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
view_step += view_step_diff; \
view_step_time = time + (1 / view_step_adjust); \
/*
- dprint (sprintf("player_prediction_preframe: "
+ dprint (sprintf("PLAYER_VIEW_STEPS: "
"pm_step %g, step %g, step_adjust %g\n",
view_pm_step, view_step, view_step_adjust));
*/ \
@@ -600,7 +585,24 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
if (view_step_time - time > 0) \
view_origin.z -= (view_step_time - time) * \
view_step_adjust * view_step; \
- }
+ /* } */
+
+ //--------------------------------------------------------------
+ // origin prediction error compensation -- based on CSQCTest -- CEV
+ //--------------------------------------------------------------
+ #define PLAYER_VIEW_ERROR(e) \
+ /* { */ \
+ if (view_error_time - time > 0) \
+ { \
+ /*
+ dprint (sprintf("PLAYER_VIEW_ERROR: " \
+ "adjusting, delta %g\n", \
+ view_error_time - time)); \
+ */ \
+ view_origin += (view_error_time - time) * \
+ view_error_speed * view_error; \
+ } \
+ /* } */
//--------------------------------------------------------------
// called from CSQC_Ent_Update for CT_PLAYER entities
@@ -611,31 +613,45 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
local float newmoveflags = 0;
local float netflags = ReadFloat ();
- if (netflags & PLAYER_NET_FRAME)
+ if (netflags & NETFLAG_PLAYER_FRAME)
+ {
newframe = ReadByte ();
+ self.weaponframe = ReadByte ();
+ }
- if (netflags & PLAYER_NET_MODEL)
+ if (netflags & NETFLAG_PLAYER_MODEL)
self.modelindex = ReadShort ();
- if (netflags & PLAYER_NET_ORIGIN)
+ if (netflags & NETFLAG_PLAYER_ORIGIN)
{
+ // self.origin_prev = self.origin_net;
+ self.origin_prev_time = self.origin_net_time;
self.origin_x = ReadCoord ();
self.origin_y = ReadCoord ();
self.origin_z = ReadCoord ();
+ // self.origin_net = self.origin;
+ self.origin_net_time = time;
}
- // we can safely infer PLAYER_NET_SIZE from .pm_flags;
+ // we can safely infer NETFLAG_PLAYER_SIZE from .pm_flags;
// if it's necessary to transmit size (mins & maxs) in
// the future we'd do so here -- CEV
- if (netflags & PLAYER_NET_ANGLES)
+ if (netflags & NETFLAG_PLAYER_ANGLES)
{
+ self.angles_prev_time = self.angles_net_time;
+ /*
self.angles_x = ReadAngle ();
self.angles_y = ReadAngle ();
self.angles_z = ReadAngle ();
+ */
+ self.angles_x = ReadShort () * (360.0 / 65536) + 32768;
+ self.angles_y = ReadShort () * (360.0 / 65536) + 32768;
+ self.angles_z = ReadShort () * (360.0 / 65536) + 32768;
+ self.angles_net_time = time;
}
- if (netflags & PLAYER_NET_VELOCITY)
+ if (netflags & NETFLAG_PLAYER_VELOCITY)
{
self.velocity_x = ReadShort() * 0.125;
self.velocity_y = ReadShort() * 0.125;
@@ -643,7 +659,7 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
self.speed = vlen ([self.velocity_x,self.velocity_y,0]);
}
- if (netflags & PLAYER_NET_FLAGS)
+ if (netflags & NETFLAG_PLAYER_FLAGS)
{
self.flags = ReadFloat ();
newmoveflags = ReadFloat ();
@@ -653,38 +669,102 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
newmoveflags = self.pm_flags;
}
- if (netflags & PLAYER_NET_TIMERS)
+ if (netflags & NETFLAG_PLAYER_TIMERS)
self.pm_timer = ReadFloat ();
- if (netflags & PLAYER_NET_EFFECTS)
- self.sveffects = ReadByte ();
-
- if (netflags & PLAYER_NET_SOLID)
+ if (netflags & NETFLAG_PLAYER_SOLID)
{
self.solid = ReadByte ();
self.movetype = ReadByte ();
}
- if (netflags & PLAYER_NET_ITEMS)
+ if (netflags & NETFLAG_PLAYER_WEAPON)
+ {
+ self.weapon = ReadByte ();
+
+ switch (self.weapon)
+ {
+ case 1: self.inventory1 = ReadByte (); break;
+ case 2: self.inventory2 = ReadByte (); break;
+ case 3: self.inventory3 = ReadByte (); break;
+ case 4: self.inventory4 = ReadByte (); break;
+ case 5: self.inventory5 = ReadByte (); break;
+ case 6: self.inventory6 = ReadByte (); break;
+ case 7: self.inventory7 = ReadByte (); break;
+ case 8: self.inventory8 = ReadByte (); break;
+ }
+ }
+
+ if (netflags & NETFLAG_PLAYER_ITEMS)
self.items = ReadFloat ();
- if (netflags & PLAYER_NET_PUNCHANGLE)
+ if (netflags & NETFLAG_PLAYER_INVENTORY)
{
- self.punchangle_x = ReadShort ();
+ // dprint (sprintf("player_netreceive: received "
+ // "inventory at %g\n", time));
+ self.inventory1 = ReadByte ();
+ self.inventory2 = ReadByte ();
+ self.inventory3 = ReadByte ();
+ self.inventory4 = ReadByte ();
+ self.inventory5 = ReadByte ();
+ self.inventory6 = ReadByte ();
+ self.inventory7 = ReadByte ();
+ self.inventory8 = ReadByte ();
+ }
- // punchangle code from Ironwail -- CEV
- if (self.entnum == player_localentnum) {
- if (view_punch1 != self.punchangle_x)
- {
- view_punch2 = view_punch1;
- view_punch1 = self.punchangle_x;
- view_punch_time = time;
- } }
+ if (netflags & NETFLAG_PLAYER_AMMO)
+ {
+ self.ammo_shells = ReadByte ();
+ self.ammo_nails = ReadByte ();
+ self.ammo_rockets = ReadByte ();
+ self.ammo_cells = ReadByte ();
}
+ if (netflags & NETFLAG_PLAYER_HEALTH)
+ {
+ self.health = ReadByte ();
+ self.armorvalue = ReadByte ();
+ }
+
+ if (netflags & NETFLAG_PLAYER_PUNCHANGLE)
+ {
+ self.punchangle_x = ReadByte () - 128;
+ self.punchangle_y = ReadByte () - 128;
+ self.punchangle_z = ReadByte () - 128;
+ }
+ else if (self.punchangle)
+ {
+ // clear punchangle on the client -- CEV
+ self.punchangle = '0 0 0';
+ }
+
+ // TODO CEV move this ?
+ // punchangle code from Ironwail -- CEV
+ if (self.entnum == player_localentnum) {
+ if (view_punch1 != self.punchangle)
+ {
+ view_punch2 = view_punch1;
+ view_punch1 = self.punchangle;
+ view_punch_time = time;
+ } }
+
if (isnew && !(self.predraw))
{
- dprint ("player_netreceive: init player...\n");
+ if (self.entnum == player_localentnum)
+ {
+ view_player = self;
+
+ // spawn the view entity now -- CEV
+ if (!view_entity)
+ {
+ view_entity = spawn ();
+ view_entity.classname = "weaponentity";
+ view_entity.drawmask = DRAWMASK_NONE;
+ view_entity.renderflags = RF_DEPTHHACK |
+ RF_NOSHADOW | RF_VIEWMODEL;
+ }
+ }
+
self.pm_flags = newmoveflags;
player_init (self);
}
@@ -723,11 +803,54 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
setsize (self, PM_STAND_MIN, PM_STAND_MAX);
}
- if (self.entnum == player_localentnum)
+ if (self.entnum == player_localentnum) {
+ if (netflags & NETFLAG_PLAYER_ORIGIN)
{
- view_pl = self;
- self.commandframe = servercommandframe;
+ view_player = self;
+
+ // locally store what the server sent us -- CEV
+ local vector origin_new = self.origin;
+ local vector velocity_new = self.velocity;
+ local vector angles_new = self.angles;
+ local float flags_new = self.flags;
+ local float pm_flags_new = self.pm_flags;
+ local float pm_timer_new = self.pm_timer;
+
+ // now rewind to the previous server state -- CEV
+ PLAYER_PREDICTION_RESET (self)
+
+ // run up to clientcommandframe -- CEV
+ player_prediction_run (clientcommandframe);
+
+ // save old predicted origin for later -- CEV
+ local vector origin_pred = self.origin;
+
+ // revert to what the server sent us -- CEV
+ self.origin = origin_new;
+ self.velocity = velocity_new;
+ self.angles = angles_new;
+ self.flags = flags_new;
+ self.pm_flags = pm_flags_new;
+ self.pm_timer = pm_timer_new;
+
+ // start from the most recent servercommandframe -- CEV
+ view_player_commandframe = servercommandframe;
+ pmovecommandframe = view_player_commandframe + 1;
+
+ // SAVE our new known-good state -- CEV
PLAYER_PREDICTION_SAVE (self)
+
+ // run up to clientcommandframe again -- CEV
+ player_prediction_run (clientcommandframe);
+
+ // check for a difference (error) in prediction based
+ // on extrapolation from the previous server message &
+ // the current (most recent) message -- CEV
+ PLAYER_PREDICTION_ERRORCHECK (origin_pred, self.origin)
+ } }
+ else
+ {
+ dprint ("player_netreceive: non-local player!\n");
}
// TODO CEV movement interpolation for other players
@@ -738,8 +861,6 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
self.lerptime = time;
self.frame = newframe;
}
-
- self.oldframe = self.frame;
};
//--------------------------------------------------------------
@@ -747,99 +868,241 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
//--------------------------------------------------------------
float() player_predraw =
{
+ if (serverkeyfloat(SERVERKEY_PAUSESTATE))
+ {
+ self.renderflags = 0;
+
+ if (intermission)
+ addentity (self);
+
+ return PREDRAW_NEXT;
+ }
+
+ if (self.lerptime)
+ self.lerpfrac = 1 - (time - self.lerptime) * 10;
+
+ if (self.entnum == player_localentnum)
+ {
+ // the active view player -- CEV
+ if (intermission)
+ {
+ view_origin = self.origin;
+ }
+ else
+ {
+ // reset here or there'll be stuttering -- CEV
+ PLAYER_PREDICTION_RESET (self)
+
+ // run up to the current frame -- CEV
+ player_prediction_run (clientcommandframe);
+
+ view_origin = self.origin;
+
+ // head bob, crouching, steps, error comp -- CEV
+ PLAYER_VIEW_BOB (self)
+ PLAYER_VIEW_CROUCH (self)
+ PLAYER_VIEW_STEPS (self)
+ PLAYER_VIEW_ERROR (self)
+
+ // punchangle, sideways view roll -- CEV
+ makevectors (view_angles);
+ PLAYER_VIEW_PUNCHANGLE ()
+ PLAYER_VIEW_ROLL (self)
+ }
+
+ self.renderflags |= RF_EXTERNALMODEL;
+ }
+ else
+ {
+ // other players -- CEV
+ self.renderflags = 0;
+ }
+
// player visual effects; this might need to be some place
// other than predraw for multiplayer support -- CEV
- if (self.sveffects & EF_MUZZLEFLASH)
+ if (self.flags & FL_MUZZLEFLASH)
{
- self.sveffects &= ~EF_MUZZLEFLASH;
+ self.flags &= ~FL_MUZZLEFLASH;
+ if (self.flags_net & FL_MUZZLEFLASH)
+ self.flags_net &= ~FL_MUZZLEFLASH;
makevectors ([0, self.angles_y, 0]);
pointparticles (particleeffectnum("te_muzzleflash"),
self.origin, v_forward, 1);
}
- if (self.sveffects & EF_DIMLIGHT)
+ if (self.flags & FL_DIMLIGHT)
{
local vector col;
makevectors (self.v_angle);
- // rely on sitems here instead of transmitting .items
- // through SendEntity; might reduce net traffic? -- CEV
- // sitems set in cl_hud already -- CEV
- // sitems = getstatf (STAT_ITEMS, 0, 23);
-
// quad + pent, pent, quad, normal -- CEV
- if (sitems & IT_INVULNERABILITY)
- if (sitems & IT_QUAD)
+ if (self.items & IT_INVULNERABILITY)
+ {
+ if (self.items & IT_QUAD)
col = '0.5 0.3 0.4';
else
col = '0.4 0 0';
- else if (sitems & IT_QUAD)
+ }
+ else if (self.items & IT_QUAD)
+ {
col = '0.05 0.05 0.94';
+ }
else
+ {
col = '0.5 0.5 0.2';
+ }
// cubemap orientation is read from v_forward etc.
dynamiclight_add (self.origin, 200, col, 0, "",
PFLAGS_NOSHADOW);
}
- if (self.lerptime)
- self.lerpfrac = 1 - (time - self.lerptime) * 10;
-
- if (self.entnum != player_localentnum)
- self.renderflags = 0;
- else
- self.renderflags |= RF_EXTERNALMODEL;
-
addentity (self);
+
return PREDRAW_NEXT;
};
//--------------------------------------------------------------
- static void() player_remove =
- {
- if (view_pl == self)
- view_pl = world;
-
- setmodel (self, "");
- self.oldskin = "";
- self.predraw = __NULL__;
- };
-
+ // was Pred_RunMovement in CSQCTest cs/prediction.qc
//--------------------------------------------------------------
- void(entity e) player_prediction_preframe =
+ void(float endframe) player_prediction_run =
{
- if (serverkeyfloat(SERVERKEY_PAUSESTATE))
+ if (servercommandframe >= view_player_commandframe + 63)
+ {
+ // we're meant to be updating the player faster than
+ // this. hopefully its just that we're throttled...
+ // you can comment out this block and the player will
+ // continue to be predicted locally. But its best to
+ // freeze them
+ dprint ("player_prediction_run: slow update\n");
+ view_player_commandframe = servercommandframe - 63;
return;
+ }
- if (intermission == TRUE)
+ if (self.health <= 0)
{
- view_origin = e.origin;
- return;
+ // dead, so don't run prediction. :D
+ pmovecommandframe = clientcommandframe;
+ if (!getinputstate(pmovecommandframe - 1))
+ {
+ dprint ("player_prediction_run: noop?\n");
+ // TODO CEV no-op ?
+ }
}
- // PLAYER_PREDICTION_SAVE (e)
- PLAYER_PREDICTION (e, clientcommandframe)
+ // update view_player -- CEV
+ if (self.entnum == player_localentnum)
+ if (view_player != self)
+ view_player = self;
- view_origin = e.origin;
+ while (pmovecommandframe <= endframe)
+ {
+ if (!getinputstate(pmovecommandframe))
+ // no input from client
+ break;
- // view_origin: head bob, crouch smoothing, steps -- CEV
- PLAYER_VIEW_BOB (e)
- PLAYER_VIEW_CROUCH (e)
- PLAYER_VIEW_STEPS (e)
+ if (input_timelength <= 0)
+ {
+ /*
+ if (pmovecommandframe != endframe)
+ {
+ dprint (sprintf("player_prediction_run: "
+ "itl %g clframetime %g\n",
+ input_timelength, clframetime));
+ }
+ */
+ break;
+ }
- // view_angles: punchangle, sideways view roll -- CEV
- makevectors (view_angles);
- PLAYER_VIEW_PUNCHANGLE ()
- PLAYER_VIEW_ROLL (e)
- };
+ /*
+ if (pmovecommandframe == clientcommandframe)
+ {
+ CSQC_Input_Frame ();
+ }
+ */
- //--------------------------------------------------------------
- void(entity e) player_prediction_postframe =
- {
- PLAYER_PREDICTION_RESET (e)
- setsize (e, e.mins, e.maxs);
- setorigin (e, e.origin);
+ #if 1
+ local entity act = world;
+
+ // set all moving actors to a best-guess of their
+ // position in this pmovecommandframe -- CEV
+ while ((act = findflags(act, queflag, QUE_TYPE_ACTOR)))
+ {
+ if (act.origin_net == act.origin_prev)
+ continue;
+
+ #if 1
+ if (input_clienttime < act.origin_net_time)
+ {
+ /*
+ dprint (sprintf("player_prediction_run"
+ ": skipping %s %g, diff %g\n",
+ act.classname, act.entnum,
+ act.origin_net_stime -
+ input_servertime));
+ */
+ setorigin (act, act.origin_net);
+ continue;
+ }
+ #endif
+
+ // need to do angles for rotating brushes -- CEV
+ BASE_ENTITY_LERP_ANGLES (act,
+ act.angles_net, act.angles_prev,
+ input_clienttime,
+ act.angles_net_time,
+ act.angles_prev_time)
+
+ // now origin for collision checking -- CEV
+ BASE_ENTITY_LERP_ORIGIN (act,
+ act.origin_net, act.origin_prev,
+ input_clienttime,
+ act.origin_net_time,
+ act.origin_prev_time)
+
+ if (act.movetype == MOVETYPE_PUSH)
+ {
+ local vector dispang, disporg;
+ dispang = act.angles - act.angles_net;
+ disporg = act.origin - act.origin_net;
+ act.angles = act.angles_net;
+ setorigin (act, act.origin_net);
+
+ pushmove (act, disporg, dispang);
+ }
+ }
+ #endif
+
+ // do the move. these three macros stuff most of
+ // the player movement directly into this function.
+ // (a wild hack). the same three macros are called
+ // in SV_RunClientCommand. See pmove.qc -- CEV
+ PM_MOVE_PRE ()
+ PM_MOVE_MOVETYPES ()
+ PM_MOVE_POST ()
+
+ setorigin (self, self.origin);
+ self.oldorigin = self.origin;
+
+ // don't do step smoothing when flagged not to -- CEV
+ if (self.pm_flags & PMF_ONMOVINGENT)
+ {
+ if (view_step_disable == FALSE)
+ {
+ view_step_disable = TRUE;
+ }
+ }
+ else if (view_step_disable)
+ {
+ view_step_disable = FALSE;
+ }
+
+ pmovecommandframe++;
+ }
+
+ // add anything that was applied after (for low
+ // packet rate protocols)
+ input_angles = view_angles;
};
#endif
@@ -849,71 +1112,136 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
//--------------------------------------------------------------
float(entity to, float netflags) player_netsend =
{
- WriteShort (MSG_ENTITY, self.classtype);
+ WriteByte (MSG_ENTITY, self.classtype);
WriteFloat (MSG_ENTITY, netflags);
- if (netflags & PLAYER_NET_FRAME)
+ if (netflags & NETFLAG_PLAYER_FRAME)
+ {
WriteByte (MSG_ENTITY, self.frame);
+ WriteByte (MSG_ENTITY, self.weaponframe);
+ }
- if (netflags & PLAYER_NET_MODEL)
+ if (netflags & NETFLAG_PLAYER_MODEL)
WriteShort (MSG_ENTITY, self.modelindex);
- if (netflags & PLAYER_NET_ORIGIN)
+ if (netflags & NETFLAG_PLAYER_ORIGIN)
{
WriteCoord (MSG_ENTITY, self.origin_x);
WriteCoord (MSG_ENTITY, self.origin_y);
WriteCoord (MSG_ENTITY, self.origin_z);
}
- // we can safely infer PLAYER_NET_SIZE from .pm_flags;
+ // we can safely infer NETFLAG_PLAYER_SIZE from .pm_flags;
// if it's necessary to transmit size (mins & maxs) in
// the future we'd do so here -- CEV
- // if (netflags & PLAYER_NET_SIZE)
+ // if (netflags & NETFLAG_PLAYER_SIZE)
- if (netflags & PLAYER_NET_ANGLES)
+ if (netflags & NETFLAG_PLAYER_ANGLES)
{
+ /*
WriteAngle (MSG_ENTITY, self.angles_x);
WriteAngle (MSG_ENTITY, self.angles_y);
WriteAngle (MSG_ENTITY, self.angles_z);
+ */
+ WriteShort (MSG_ENTITY, (rint(self.angles_x *
+ 65536.0 / 360.0) & 65535) - 32768);
+ WriteShort (MSG_ENTITY, (rint(self.angles_y *
+ 65536.0 / 360.0) & 65535) - 32768);
+ WriteShort (MSG_ENTITY, (rint(self.angles_z *
+ 65536.0 / 360.0) & 65535) - 32768);
}
- if (netflags & PLAYER_NET_VELOCITY)
+ if (netflags & NETFLAG_PLAYER_VELOCITY)
{
WriteShort (MSG_ENTITY, floor(self.velocity_x * 8));
WriteShort (MSG_ENTITY, floor(self.velocity_y * 8));
WriteShort (MSG_ENTITY, floor(self.velocity_z * 8));
}
- if (netflags & PLAYER_NET_FLAGS)
+ if (netflags & NETFLAG_PLAYER_FLAGS)
{
WriteFloat (MSG_ENTITY, self.flags);
WriteFloat (MSG_ENTITY, self.pm_flags);
}
- if (netflags & PLAYER_NET_TIMERS)
+ if (netflags & NETFLAG_PLAYER_TIMERS)
WriteFloat (MSG_ENTITY, self.pm_timer);
- if (netflags & PLAYER_NET_EFFECTS)
- WriteByte (MSG_ENTITY, self.sveffects);
-
- if (netflags & PLAYER_NET_SOLID)
+ if (netflags & NETFLAG_PLAYER_SOLID)
{
WriteByte (MSG_ENTITY, self.solid);
WriteByte (MSG_ENTITY, self.movetype);
}
- if (netflags & PLAYER_NET_ITEMS)
+ if (netflags & NETFLAG_PLAYER_WEAPON)
+ {
+ WriteByte (MSG_ENTITY, self.weapon);
+ switch (self.weapon)
+ {
+ case 1: WriteByte (MSG_ENTITY, self.inventory1);
+ break;
+ case 2: WriteByte (MSG_ENTITY, self.inventory2);
+ break;
+ case 3: WriteByte (MSG_ENTITY, self.inventory3);
+ break;
+ case 4: WriteByte (MSG_ENTITY, self.inventory4);
+ break;
+ case 5: WriteByte (MSG_ENTITY, self.inventory5);
+ break;
+ case 6: WriteByte (MSG_ENTITY, self.inventory6);
+ break;
+ case 7: WriteByte (MSG_ENTITY, self.inventory7);
+ break;
+ case 8: WriteByte (MSG_ENTITY, self.inventory8);
+ break;
+ }
+ }
+
+ if (netflags & NETFLAG_PLAYER_ITEMS)
WriteFloat (MSG_ENTITY, self.items);
- if (netflags & PLAYER_NET_PUNCHANGLE)
+ if (netflags & NETFLAG_PLAYER_INVENTORY)
+ {
+ WriteByte (MSG_ENTITY, self.inventory1);
+ WriteByte (MSG_ENTITY, self.inventory2);
+ WriteByte (MSG_ENTITY, self.inventory3);
+ WriteByte (MSG_ENTITY, self.inventory4);
+ WriteByte (MSG_ENTITY, self.inventory5);
+ WriteByte (MSG_ENTITY, self.inventory6);
+ WriteByte (MSG_ENTITY, self.inventory7);
+ WriteByte (MSG_ENTITY, self.inventory8);
+ }
+
+ if (netflags & NETFLAG_PLAYER_AMMO)
+ {
+ WriteByte (MSG_ENTITY, bound(0, self.ammo_shells,255));
+ WriteByte (MSG_ENTITY, bound(0, self.ammo_nails, 255));
+ WriteByte (MSG_ENTITY, bound(0,self.ammo_rockets,255));
+ WriteByte (MSG_ENTITY, bound(0, self.ammo_cells, 255));
+ }
+
+ if (netflags & NETFLAG_PLAYER_HEALTH)
+ {
+ // don't track negative health on the client -- CEV
+ WriteByte (MSG_ENTITY, bound (0, self.health, 255));
+ WriteByte (MSG_ENTITY, self.armorvalue);
+ }
+
+ if (netflags & NETFLAG_PLAYER_PUNCHANGLE)
{
- WriteShort (MSG_ENTITY, self.punchangle_x);
- self.punchangle_x = 0;
+ WriteByte (MSG_ENTITY,
+ bound (0, self.punchangle_x + 128, 255));
+ WriteByte (MSG_ENTITY,
+ bound (0, self.punchangle_y + 128, 255));
+ WriteByte (MSG_ENTITY,
+ bound (0, self.punchangle_z + 128, 255));
+ // clear punchangle on the server -- CEV
+ self.punchangle = '0 0 0';
}
// only muzzleflash once, should be cleared elsewhere -- CEV
- if (self.sveffects & EF_MUZZLEFLASH)
- self.sveffects &= ~EF_MUZZLEFLASH;
+ if (self.flags & FL_MUZZLEFLASH)
+ self.flags &= ~FL_MUZZLEFLASH;
return TRUE;
};
@@ -937,16 +1265,33 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
self.ammo_nails = 200;
self.ammo_rockets = 100;
self.ammo_shells = 100;
- self.items = self.items | IT_AXE | IT_SHOTGUN |
- IT_SUPER_SHOTGUN | IT_NAILGUN | IT_SUPER_NAILGUN |
- IT_GRENADE_LAUNCHER | IT_ROCKET_LAUNCHER | IT_LIGHTNING;
+
+ // the traditional id1 layout -- CEV
+ self.inventory1 = ITEM_SEQ_AXE;
+ self.inventory2 = ITEM_SEQ_SHOTGUN;
+ self.inventory3 = ITEM_SEQ_SUPERSHOTGUN;
+ self.inventory4 = ITEM_SEQ_NAILGUN;
+ self.inventory5 = ITEM_SEQ_SUPERNAILGUN;
+ self.inventory6 = ITEM_SEQ_GRENADELAUNCHER;
+ self.inventory7 = ITEM_SEQ_ROCKETLAUNCHER;
+ self.inventory8 = ITEM_SEQ_LIGHTNINGGUN;
+ self.weapon = 7;
+ self.impulse = 0;
// support for item_key_custom -- iw
base_item_key_giveallkeys (self);
- self.weapon = IT_ROCKET_LAUNCHER;
- self.impulse = 0;
- player_set_current_ammo ();
+ if (self.think == pl_shot1 || self.think == pl_shot2 ||
+ self.think == pl_shot3 || self.think == pl_shot3 ||
+ self.think == pl_shot5 || self.think == pl_shot6)
+ {
+ // get out of any residual shooting sequence -- CEV
+ pl_run1 ();
+ }
+ // reset weapon frame -- CEV
+ self.weaponframe = 0;
+ self.SendFlags |= NETFLAG_PLAYER_ITEMS | NETFLAG_PLAYER_AMMO |
+ NETFLAG_PLAYER_INVENTORY | NETFLAG_PLAYER_WEAPON;
};
//--------------------------------------------------------------
@@ -960,8 +1305,8 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
self.super_time = 1;
self.super_damage_finished = time + 30;
- self.items = self.items | IT_QUAD;
- dprint ("player::quad_cheat: quad damage\n");
+ self.items |= IT_QUAD;
+ dprint ("player_impulse_quadcheat: quad damage\n");
};
//--------------------------------------------------------------
@@ -978,219 +1323,149 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
};
//--------------------------------------------------------------
- // ChangeWeaponCommand -- was W_ChangeWeapon
+ #define PLAYER_IMPULSE_BESTWEAPON_SCAN(i, idx, WEAPON) \
+ /* { */ \
+ for (i = 1; i < 9; i++) \
+ { \
+ switch (i) \
+ { \
+ case 1: idx = self.inventory1; break; \
+ case 2: idx = self.inventory2; break; \
+ case 3: idx = self.inventory3; break; \
+ case 4: idx = self.inventory4; break; \
+ case 5: idx = self.inventory5; break; \
+ case 6: idx = self.inventory6; break; \
+ case 7: idx = self.inventory7; break; \
+ case 8: idx = self.inventory8; break; \
+ } \
+ if (idx == WEAPON) \
+ { \
+ player_impulse_changeweapon (i); \
+ return; \
+ } \
+ } \
+ /* } */
+
+ #define SCAN(i, idx, WEAPON) \
+ /* { */ \
+ PLAYER_IMPULSE_BESTWEAPON_SCAN(i, idx, WEAPON) \
+ /* } */
+
//--------------------------------------------------------------
- void() player_impulse_changeweapon =
+ // performs a similar function to W_BestWeapon -- CEV
+ //--------------------------------------------------------------
+ void() player_impulse_bestweapon =
{
- local float it, haveammo, fl;
+ local float i = 1;
+ local float idx = 0;
- // assign fl to silence a warning -- CEV
- fl = IT_AXE;
- it = self.items;
- haveammo = TRUE;
+ if (self.conlevel <= 1 && self.ammo_cells > 0)
+ {
+ // check for LG, switch to it if available, return
+ SCAN (i, idx, ITEM_SEQ_LIGHTNINGGUN)
+ }
- switch (self.impulse)
+ if (self.ammo_nails > 1)
{
- case 1:
- fl = IT_AXE;
- break;
- case 2:
- fl = IT_SHOTGUN;
- if (self.ammo_shells < 1)
- haveammo = FALSE;
- break;
- case 3:
- fl = IT_SUPER_SHOTGUN;
- if (self.ammo_shells < 2)
- haveammo = FALSE;
- break;
- case 4:
- fl = IT_NAILGUN;
- if (self.ammo_nails < 1)
- haveammo = FALSE;
- break;
- case 5:
- fl = IT_SUPER_NAILGUN;
- if (self.ammo_nails < 2)
- haveammo = FALSE;
- break;
- case 6:
- fl = IT_GRENADE_LAUNCHER;
- if (self.ammo_rockets < 1)
- haveammo = FALSE;
- break;
- case 7:
- fl = IT_ROCKET_LAUNCHER;
- if (self.ammo_rockets < 1)
- haveammo = FALSE;
- break;
- case 8:
- fl = IT_LIGHTNING;
- if (self.ammo_cells < 1)
- haveammo = FALSE;
- break;
- default:
- dprint (sprintf("player_impulse_changeweapon: "
- "WARNING bad impulse: %f\n",
- self.impulse));
- return;
+ // check for SNG, switch if available, return
+ SCAN (i, idx, ITEM_SEQ_SUPERNAILGUN)
}
- self.impulse = 0;
+ if (self.ammo_shells > 1)
+ {
+ // check for SSG, switch if available, return
+ SCAN (i, idx, ITEM_SEQ_SUPERSHOTGUN)
+ }
- if (!(self.items & fl))
+ if (self.ammo_nails > 0)
{
- // don't have the weapon or the ammo
- sprint (self, "no weapon.\n");
- return;
+ // check for NG, switch if available, return
+ SCAN (i, idx, ITEM_SEQ_NAILGUN)
}
- if (haveammo == FALSE)
+ if (self.ammo_shells > 0)
{
- // don't have the ammo
- sprint (self, "not enough ammo.\n");
- return;
+ // check for SG, switch if available, return
+ SCAN (i, idx, ITEM_SEQ_SHOTGUN)
}
- // set weapon, set ammo
- self.weapon = fl;
- player_set_current_ammo ();
+ // always switch to slot 1 at this point (even if the
+ // axe isn't equipped / available) -- CEV
+ player_impulse_changeweapon (1);
};
+ #undef SCAN
+
//--------------------------------------------------------------
- // CycleWeaponCommand -- Go to the next weapon with ammo
+ // ChangeWeaponCommand -- was W_ChangeWeapon
//--------------------------------------------------------------
- void() player_impulse_cycleweapon =
+ void(float imp) player_impulse_changeweapon =
{
- local float haveammo;
-
- self.impulse = 0;
+ // don't change weapon if attack hasn't finished -- CEV
+ if (time < self.attack_finished)
+ return;
- while (1)
- {
- haveammo = TRUE;
+ // argument will equal the inventory slot here -- CEV
+ self.weapon = imp;
- if (self.weapon == IT_LIGHTNING)
- {
- self.weapon = IT_AXE;
- }
- else if (self.weapon == IT_AXE)
- {
- self.weapon = IT_SHOTGUN;
- if (self.ammo_shells < 1)
- haveammo = FALSE;
- }
- else if (self.weapon == IT_SHOTGUN)
- {
- self.weapon = IT_SUPER_SHOTGUN;
- if (self.ammo_shells < 2)
- haveammo = FALSE;
- }
- else if (self.weapon == IT_SUPER_SHOTGUN)
- {
- self.weapon = IT_NAILGUN;
- if (self.ammo_nails < 1)
- haveammo = FALSE;
- }
- else if (self.weapon == IT_NAILGUN)
- {
- self.weapon = IT_SUPER_NAILGUN;
- if (self.ammo_nails < 2)
- haveammo = FALSE;
- }
- else if (self.weapon == IT_SUPER_NAILGUN)
- {
- self.weapon = IT_GRENADE_LAUNCHER;
- if (self.ammo_rockets < 1)
- haveammo = FALSE;
- }
- else if (self.weapon == IT_GRENADE_LAUNCHER)
- {
- self.weapon = IT_ROCKET_LAUNCHER;
- if (self.ammo_rockets < 1)
- haveammo = FALSE;
- }
- else if (self.weapon == IT_ROCKET_LAUNCHER)
- {
- self.weapon = IT_LIGHTNING;
- if (self.ammo_cells < 1)
- haveammo = FALSE;
- }
+ // zero out impulse if necessary -- CEV
+ if (self.impulse)
+ self.impulse = 0;
- if ((self.items & self.weapon) && haveammo == TRUE)
- {
- player_set_current_ammo ();
- return;
- }
+ if (self.think == pl_shot1 || self.think == pl_shot2 ||
+ self.think == pl_shot3 || self.think == pl_shot3 ||
+ self.think == pl_shot5 || self.think == pl_shot6)
+ {
+ // get out of any residual shooting sequence -- CEV
+ pl_run1 ();
}
+
+ // reset weapon frame -- CEV
+ self.weaponframe = 0;
+ self.SendFlags |= NETFLAG_PLAYER_FRAME | NETFLAG_PLAYER_WEAPON;
};
//--------------------------------------------------------------
- // CycleWeaponReverseCommand -- Go to the prev weapon with ammo
+ // player_impulse_cycleinventory -- go to next inventory slot
+ // args are: TRUE to cycle forward, FALSE to cycle backward
//--------------------------------------------------------------
- void() player_impulse_cycleweaponreverse =
+ void(float fwd) player_impulse_cycleinventory =
{
- local float haveammo;
+ // don't change weapon if attack hasn't finished -- CEV
+ if (time < self.attack_finished)
+ return;
- self.impulse = 0;
+ // wrap selection if needed -- CEV
+ // TODO CEV only switch to occupied slots?
+ if (fwd)
+ {
+ self.weapon += 1;
+ if (self.weapon < 1 || self.weapon > 8)
+ self.weapon = 1;
- while (1)
+ }
+ else
{
- haveammo = TRUE;
+ self.weapon -= 1;
+ if (self.weapon < 1 || self.weapon > 8)
+ self.weapon = 8;
+ }
- if (self.weapon == IT_LIGHTNING)
- {
- self.weapon = IT_ROCKET_LAUNCHER;
- if (self.ammo_rockets < 1)
- haveammo = FALSE;
- }
- else if (self.weapon == IT_ROCKET_LAUNCHER)
- {
- self.weapon = IT_GRENADE_LAUNCHER;
- if (self.ammo_rockets < 1)
- haveammo = FALSE;
- }
- else if (self.weapon == IT_GRENADE_LAUNCHER)
- {
- self.weapon = IT_SUPER_NAILGUN;
- if (self.ammo_nails < 2)
- haveammo = FALSE;
- }
- else if (self.weapon == IT_SUPER_NAILGUN)
- {
- self.weapon = IT_NAILGUN;
- if (self.ammo_nails < 1)
- haveammo = FALSE;
- }
- else if (self.weapon == IT_NAILGUN)
- {
- self.weapon = IT_SUPER_SHOTGUN;
- if (self.ammo_shells < 2)
- haveammo = FALSE;
- }
- else if (self.weapon == IT_SUPER_SHOTGUN)
- {
- self.weapon = IT_SHOTGUN;
- if (self.ammo_shells < 1)
- haveammo = FALSE;
- }
- else if (self.weapon == IT_SHOTGUN)
- {
- self.weapon = IT_AXE;
- }
- else if (self.weapon == IT_AXE)
- {
- self.weapon = IT_LIGHTNING;
- if (self.ammo_cells < 1)
- haveammo = FALSE;
- }
+ // zero out impulse if necessary -- CEV
+ if (self.impulse)
+ self.impulse = 0;
- if ((self.items & self.weapon) && haveammo == TRUE)
- {
- player_set_current_ammo ();
- return;
- }
+ if (self.think == pl_shot1 || self.think == pl_shot2 ||
+ self.think == pl_shot3 || self.think == pl_shot3 ||
+ self.think == pl_shot5 || self.think == pl_shot6)
+ {
+ // get out of any residual shooting sequence -- CEV
+ pl_run1 ();
}
+
+ // reset weapon frame -- CEV
+ self.weaponframe = 0;
+ self.SendFlags |= NETFLAG_PLAYER_FRAME | NETFLAG_PLAYER_WEAPON;
};
//--------------------------------------------------------------
@@ -1201,19 +1476,19 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
switch (self.impulse)
{
case 1..8:
- player_impulse_changeweapon ();
+ player_impulse_changeweapon (self.impulse);
return;
case 9:
player_impulse_cheat ();
break;
case 10:
- player_impulse_cycleweapon ();
+ player_impulse_cycleinventory (TRUE);
break;
case 11:
player_impulse_serverflags ();
break;
case 12:
- player_impulse_cycleweaponreverse ();
+ player_impulse_cycleinventory (FALSE);
break;
case 100:
// dumptruck_ds version inspired by Copper
@@ -1249,118 +1524,144 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
}
};
- //==============================================================
- // Ammo Handling, Weapon Switching, Attack
- //==============================================================
-
- //--------------------------------------------------------------
- // player_set_current_ammo -- was W_SetCurrentAmmo in weapons.qc
- //--------------------------------------------------------------
- void() player_set_current_ammo =
- {
- // get out of any weapon firing states
- pl_run1 ();
-
- self.items = self.items - (self.items & (IT_SHELLS | IT_NAILS |
- IT_ROCKETS | IT_CELLS));
-
- if (self.weapon == IT_AXE)
- {
- self.currentammo = 0;
- self.weaponmodel = "progs/v_axe.mdl";
- }
- else if (self.weapon == IT_SHOTGUN)
- {
- self.currentammo = self.ammo_shells;
- self.weaponmodel = "progs/v_shot.mdl";
- 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.items = self.items | IT_SHELLS;
- }
- else if (self.weapon == IT_NAILGUN)
- {
- self.currentammo = self.ammo_nails;
- self.weaponmodel = "progs/v_nail.mdl";
- 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.items = self.items | IT_NAILS;
- }
- else if (self.weapon == IT_GRENADE_LAUNCHER)
- {
- self.currentammo = self.ammo_rockets;
- self.weaponmodel = "progs/v_rock.mdl";
- 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.items = self.items | IT_ROCKETS;
- }
- else if (self.weapon == IT_LIGHTNING)
- {
- self.currentammo = self.ammo_cells;
- self.weaponmodel = "progs/v_light.mdl";
- self.items = self.items | IT_CELLS;
- }
- else
- {
- self.currentammo = 0;
- self.weaponmodel = "";
- }
-
- // TODO CEV
- self.weaponframe = 0;
- };
-
- //--------------------------------------------------------------
- // best_weapon -- was W_BestWeapon in weapons.qc
+ //==============================================================
+ // Ammo Handling, Weapon Switching, Attack
+ //==============================================================
+
//--------------------------------------------------------------
- float() player_best_weapon =
+ float(float idx) player_check_no_ammo =
{
- if (self.conlevel <= WATERLEVEL_FEET &&
- self.ammo_cells >= 1 && (self.items & IT_LIGHTNING))
- {
- return IT_LIGHTNING;
- }
-
- if (self.ammo_nails >= 2 && (self.items & IT_SUPER_NAILGUN))
- return IT_SUPER_NAILGUN;
+ if (idx < ITEM_SEQ_SHOTGUN)
+ return TRUE;
- if (self.ammo_shells >= 2 && (self.items & IT_SUPER_SHOTGUN))
- return IT_SUPER_SHOTGUN;
+ if (idx > ITEM_SEQ_LIGHTNINGGUN)
+ return TRUE;
- if (self.ammo_nails >= 1 && (self.items & IT_NAILGUN))
- return IT_NAILGUN;
+ local item_info_t item = item_info[idx];
- if (self.ammo_shells >= 1 && (self.items & IT_SHOTGUN))
- return IT_SHOTGUN;
+ if (item.option)
+ {
+ switch (item.option)
+ {
+ case ITEM_AMMO_SHELLS:
+ if (self.ammo_shells > 0)
+ return TRUE;
+ break;
+ case ITEM_AMMO_NAILS:
+ if (self.ammo_nails > 0)
+ return TRUE;
+ break;
+ case ITEM_AMMO_ROCKETS:
+ if (self.ammo_rockets > 0)
+ return TRUE;
+ break;
+ case ITEM_AMMO_CELLS:
+ if (self.ammo_cells > 0)
+ return TRUE;
+ break;
+ }
+ }
- return IT_AXE;
+ // no ammo
+ return FALSE;
};
//--------------------------------------------------------------
- float() player_check_no_ammo =
+ // Weapon 0: Player Hands
+ //--------------------------------------------------------------
+ void() player_fire_hands =
{
- if (self.currentammo > 0)
- return TRUE;
+ // based on / inspired by the find loop in the W_FireAxe
+ // function in Arcane Dimensions -- CEV
+ local float dot, i;
+ local vector org;
+ local entity head;
- if (self.weapon == IT_AXE)
- return TRUE;
+ makevectors (self.v_angle);
+ head = findradius (self.origin, 96);
- self.weapon = player_best_weapon ();
- player_set_current_ammo ();
+ while (head)
+ {
+ if (!(head.classgroup & CG_ITEM))
+ {
+ // found a non-item -- CEV
+ dprint (sprintf("player_fire_hands: "
+ "%s at %v is not an item!\n",
+ head.classname, head.origin));
+ head = head.chain;
+ continue;
+ }
- // drop the weapon down
- return FALSE;
+ if (head.think == sub_remove)
+ {
+ // this entity is waiting to be removed -- CEV
+ dprint (sprintf("player_fire_hands: "
+ "%s at %v is scheduled for removal!\n",
+ head.classname, head.origin));
+ head = head.chain;
+ continue;
+ }
+
+ if (head.solid == SOLID_NOT) {
+ if (head.alpha > 0) {
+ if (head.alpha < ITEM_ALPHA_OPAQUE)
+ {
+ // this item is waiting to respawn -- CEV
+ dprint (sprintf("player_fire_hands: "
+ "%s at %v is waiting to respawn!\n",
+ head.classname, head.origin));
+ head = head.chain;
+ continue;
+ } } }
+
+ org = normalize (head.origin - self.origin);
+ dot = org * v_forward;
+
+ // check if we're looking at head -- CEV
+ if (dot > 0.95)
+ {
+ if (head.classgroup & CG_ITEM_WEAPON)
+ // grab weapon -- CEV
+ base_item_weapon_grab (self, head);
+ else if (head.classgroup & CG_ITEM_AMMO)
+ // grab ammo -- CEV
+ base_item_ammo_grab (self, head);
+ else if (head.classgroup & CG_ITEM_ARMOR)
+ // grab armor -- CEV
+ base_item_armor_grab (self, head);
+ else if (head.classgroup & CG_ITEM_HEALTH)
+ // grab health -- CEV
+ base_item_health_grab (self, head);
+ else if (head.classgroup & CG_ITEM_KEY)
+ // run touch() for keys -- CEV
+ sub_runvoidas (head, head.touch);
+ else if (head.classgroup & CG_ITEM_POWERUP)
+ // grab powerups -- CEV
+ base_item_powerup_grab (self, head);
+ else if (head.classtype == CT_ITEM_BACKPACK)
+ // run touch() for backpacks -- CEV
+ sub_runvoidas (head, head.touch);
+ else if (head.classtype == CT_ITEM_RUNE)
+ // run touch() for runes -- CEV
+ sub_runvoidas (head, head.touch);
+ else if (head.classgroup & CG_CORPSE &&
+ head.classgroup & CG_ITEM)
+ base_item_gib_grab (self, head);
+ else
+ dprint (sprintf("player_fire_hands: "
+ "hit %s!, dot %g\n",
+ head.classname, dot));
+ return;
+ }
+ else
+ {
+ dprint (sprintf("player_fire_hands: "
+ "skipping %s!, dot %g\n",
+ head.classname, dot));
+ }
+
+ head = head.chain;
+ }
};
//--------------------------------------------------------------
@@ -1415,9 +1716,10 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
VOL_HIGH, ATTN_NORM);
self.punchangle_x = -2;
- // self.SendFlags |= PLAYER_NET_PUNCHANGLE;
+ self.SendFlags |= NETFLAG_PLAYER_PUNCHANGLE;
self.currentammo = self.ammo_shells = self.ammo_shells - 1;
+ self.SendFlags |= NETFLAG_PLAYER_AMMO;
// dir = aim (self, 100000);
makevectors (self.v_angle);
@@ -1460,9 +1762,10 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
VOL_HIGH, ATTN_NORM);
self.punchangle_x = -4;
- // self.SendFlags |= PLAYER_NET_PUNCHANGLE;
+ self.SendFlags |= NETFLAG_PLAYER_PUNCHANGLE;
self.currentammo = self.ammo_shells = self.ammo_shells - 2;
+ self.SendFlags |= NETFLAG_PLAYER_AMMO;
// dir = aim (self, 100000);
makevectors (self.v_angle);
@@ -1487,28 +1790,38 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
//--------------------------------------------------------------
void(float offset) player_fire_spikes =
{
+ if (self.ammo_nails < 1)
+ {
+ // no ammo sound -- CEV
+ sound (self, CHAN_WEAPON, "cev/items/noammo.ogg",
+ VOL_MID, ATTN_NORM);
+ self.attack_finished = time + 1.0;
+ // signal player_attack to switch weapon -- CEV
+ self.aflag = 1;
+ // get out of the nail firing animation -- CEV
+ pl_run1 ();
+ return;
+ }
+
local vector dir;
local vector org = self.origin + self.view_ofs;
makevectors (self.v_angle);
- if (self.ammo_nails >= 2 && self.weapon == IT_SUPER_NAILGUN)
+ BASE_ENTITY_WEAPONLOOKUP (self)
+
+ if (self.ammo_nails >= 2 && item_index == ITEM_SEQ_SUPERNAILGUN)
{
player_fire_superspikes ();
return;
}
- if (self.ammo_nails < 1)
- {
- self.weapon = player_best_weapon ();
- player_set_current_ammo ();
- return;
- }
+ self.attack_finished = time + 0.2;
sound (self, CHAN_WEAPON, "weapons/rocket1i.wav",
VOL_HIGH, ATTN_NORM);
- self.attack_finished = time + 0.2;
self.currentammo = self.ammo_nails = self.ammo_nails - 1;
+ self.SendFlags |= NETFLAG_PLAYER_AMMO;
dir = aim (self, SPIKE_SPEED);
// dir = normalize (dir);
@@ -1522,7 +1835,7 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
spawn_projectile_spike (self, org, dir, SPIKE_NORMAL_DAMAGE);
self.punchangle_x = -2;
- // self.SendFlags |= PLAYER_NET_PUNCHANGLE;
+ self.SendFlags |= NETFLAG_PLAYER_PUNCHANGLE;
};
//--------------------------------------------------------------
@@ -1537,6 +1850,7 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
VOL_HIGH, ATTN_NORM);
self.attack_finished = time + 0.2;
self.currentammo = self.ammo_nails = self.ammo_nails - 2;
+ self.SendFlags |= NETFLAG_PLAYER_AMMO;
dir = aim (self, SPIKE_SPEED);
// dir = normalize (dir);
@@ -1548,7 +1862,7 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
spawn_projectile_spike (self, org, dir, SPIKE_SUPER_DAMAGE);
self.punchangle_x = -2;
- // self.SendFlags |= PLAYER_NET_PUNCHANGLE;
+ self.SendFlags |= NETFLAG_PLAYER_PUNCHANGLE;
};
//--------------------------------------------------------------
@@ -1560,12 +1874,13 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
local vector org = self.origin + (self.view_ofs - '0 0 8');
self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
+ self.SendFlags |= NETFLAG_PLAYER_AMMO;
sound (self, CHAN_WEAPON, "weapons/grenade.wav",
VOL_HIGH, ATTN_NORM);
self.punchangle_x = -2;
- // self.SendFlags |= PLAYER_NET_PUNCHANGLE;
+ self.SendFlags |= NETFLAG_PLAYER_PUNCHANGLE;
// set missile speed
makevectors (self.v_angle);
@@ -1592,12 +1907,13 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
local vector missile_vel = '0 0 0';
self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
+ self.SendFlags |= NETFLAG_PLAYER_AMMO;
sound (self, CHAN_WEAPON, "weapons/grenade.wav",
VOL_HIGH, ATTN_NORM);
self.punchangle_x = -2;
- // self.SendFlags |= PLAYER_NET_PUNCHANGLE;
+ self.SendFlags |= NETFLAG_PLAYER_PUNCHANGLE;
// called a tribolt 'cause there's three of 'em -- CEV
spawn_projectile_bolt (self, 0);
@@ -1614,12 +1930,13 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
local vector missile_velocity = '0 0 0';
self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
+ self.SendFlags |= NETFLAG_PLAYER_AMMO;
- sound (self, CHAN_WEAPON, "weapons/sgun1.wav",
+ sound (self, CHAN_ITEM_WEAPON_ROCKETS, "weapons/sgun1.wav",
VOL_HIGH, ATTN_NORM);
self.punchangle_x = -2;
- // self.SendFlags |= PLAYER_NET_PUNCHANGLE;
+ self.SendFlags |= NETFLAG_PLAYER_PUNCHANGLE;
// set missile speed
makevectors (self.v_angle);
@@ -1638,8 +1955,14 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
{
if (self.ammo_cells < 1)
{
- self.weapon = player_best_weapon ();
- player_set_current_ammo ();
+ // no ammo sound -- CEV
+ sound (self, CHAN_WEAPON, "cev/items/noammo.ogg",
+ VOL_MID, ATTN_NORM);
+ self.attack_finished = time + 0.2;
+ // signal player_attack to switch weapon -- CEV
+ self.aflag = 1;
+ // get out of lightning firing animation -- CEV
+ pl_run1 ();
return;
}
@@ -1648,7 +1971,6 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
{
local float cells = self.ammo_cells;
self.ammo_cells = 0;
- player_set_current_ammo ();
t_radiusdamage2 (self, self, 35 * cells, world);
return;
}
@@ -1660,9 +1982,10 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
self.t_width = time + 0.6;
}
self.punchangle_x = -2;
- // self.SendFlags |= PLAYER_NET_PUNCHANGLE;
+ self.SendFlags |= NETFLAG_PLAYER_PUNCHANGLE;
self.currentammo = self.ammo_cells = self.ammo_cells - 1;
+ self.SendFlags |= NETFLAG_PLAYER_AMMO;
// TODO CEV
local vector org = self.origin + (self.view_ofs - '0 0 8');
@@ -1675,6 +1998,7 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
traceline (org, org + v_forward * 600, TRUE, self);
self.solid = player_solid;
+ /*
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_LIGHTNING2);
WriteEntity (MSG_BROADCAST, self);
@@ -1684,6 +2008,18 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
WriteCoord (MSG_BROADCAST, trace_endpos_x);
WriteCoord (MSG_BROADCAST, trace_endpos_y);
WriteCoord (MSG_BROADCAST, trace_endpos_z);
+ */
+
+ WriteByte (MSG_MULTICAST, SVC_CGAMEPACKET);
+ WriteByte (MSG_MULTICAST, EVENT_LIGHTNING2);
+ WriteCoord (MSG_MULTICAST, org_x);
+ WriteCoord (MSG_MULTICAST, org_y);
+ WriteCoord (MSG_MULTICAST, org_z);
+ WriteCoord (MSG_MULTICAST, trace_endpos_x);
+ WriteCoord (MSG_MULTICAST, trace_endpos_y);
+ WriteCoord (MSG_MULTICAST, trace_endpos_z);
+ msg_entity = self;
+ multicast (self.origin, MULTICAST_ONE_R);
fire_lightning (self.origin, trace_endpos + v_forward * 4,
self, 30);
@@ -1696,71 +2032,383 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
{
local float r;
- if (player_check_no_ammo() == FALSE)
+ // creates item_index -- CEV
+ BASE_ENTITY_WEAPONLOOKUP (self)
+
+ if (player_check_no_ammo(item_index) == FALSE)
+ {
+ if (self.aflag == 1)
+ {
+ // +attack after the noammo sound; select
+ // the best weapon available w/ammo -- CEV
+ self.aflag = 0;
+ player_impulse_bestweapon ();
+ return;
+ }
+
+ // no ammo sound -- CEV
+ sound (self, CHAN_WEAPON, "cev/items/noammo.ogg",
+ VOL_MID, ATTN_NORM);
+
+ if (self.weaponframe)
+ self.weaponframe = 0;
+
+ // signal the next +attack will switch weapon -- CEV
+ self.aflag = 1;
+
+ // delay 0.5 seconds before allow another attack -- CEV
+ self.attack_finished = time + 1.0;
+
return;
+ }
// calculate forward angle for velocity
makevectors (self.v_angle);
// wake monsters up
self.show_hostile = time + 1;
- if (self.weapon == IT_AXE)
+ switch (item_index)
{
- sound (self, CHAN_WEAPON, "weapons/ax1.wav",
- VOL_HIGH, ATTN_NORM);
- r = random ();
- if (r < 0.25)
- pl_axe1 ();
- else if (r < 0.5)
- pl_axeb1 ();
- else if (r < 0.75)
- pl_axec1 ();
- else
- pl_axed1 ();
- self.attack_finished = time + 0.5;
+ case ITEM_SEQ_HANDS:
+ self.attack_finished = time + 0.5;
+ player_fire_hands ();
+ break;
+ case ITEM_SEQ_AXE:
+ sound (self, CHAN_WEAPON, "weapons/ax1.wav",
+ VOL_HIGH, ATTN_NORM);
+ r = random ();
+ if (r < 0.25)
+ pl_axe1 ();
+ else if (r < 0.5)
+ pl_axeb1 ();
+ else if (r < 0.75)
+ pl_axec1 ();
+ else
+ pl_axed1 ();
+ self.attack_finished = time + 0.5;
+ break;
+ case ITEM_SEQ_SHOTGUN:
+ pl_shot1 ();
+ player_fire_shotgun ();
+ self.attack_finished = time + 0.5;
+ break;
+ case ITEM_SEQ_SUPERSHOTGUN:
+ pl_shot1 ();
+ player_fire_supershotgun ();
+ self.attack_finished = time + 0.7;
+ break;
+ case ITEM_SEQ_NAILGUN:
+ pl_nail1 ();
+ break;
+ case ITEM_SEQ_SUPERNAILGUN:
+ pl_nail1 ();
+ break;
+ case ITEM_SEQ_GRENADELAUNCHER:
+ pl_rocket1 ();
+ // TODO CEV
+ // player_fire_grenade ();
+ player_fire_tribolt ();
+ // self.attack_finished = time + 0.6;
+ self.attack_finished = time + 1.3;
+ break;
+ case ITEM_SEQ_ROCKETLAUNCHER:
+ pl_rocket1 ();
+ player_fire_rocket ();
+ self.attack_finished = time + 0.8;
+ break;
+ case ITEM_SEQ_LIGHTNINGGUN:
+ pl_light1 ();
+ self.attack_finished = time + 0.1;
+ sound (self, CHAN_AUTO, "weapons/lstart.wav",
+ VOL_HIGH, ATTN_NORM);
+ break;
+ case ITEM_SEQ_AMMO_SHELLS_SMALL:
+ case ITEM_SEQ_AMMO_SHELLS_LARGE:
+ case ITEM_SEQ_AMMO_NAILS_SMALL:
+ case ITEM_SEQ_AMMO_NAILS_LARGE:
+ case ITEM_SEQ_AMMO_ROCKETS_SMALL:
+ case ITEM_SEQ_AMMO_ROCKETS_LARGE:
+ case ITEM_SEQ_AMMO_CELLS_SMALL:
+ case ITEM_SEQ_AMMO_CELLS_LARGE:
+ self.attack_finished = time + 0.5;
+ base_item_ammo_fire (self, item_index);
+ break;
+ case ITEM_SEQ_ARMOR_GREEN:
+ case ITEM_SEQ_ARMOR_YELLOW:
+ case ITEM_SEQ_ARMOR_RED:
+ case ITEM_SEQ_ARMOR_SHARD:
+ self.attack_finished = time + 0.5;
+ base_item_armor_fire (self, item_index);
+ break;
+ case ITEM_SEQ_HEALTH_ROTTEN:
+ case ITEM_SEQ_HEALTH:
+ case ITEM_SEQ_HEALTH_MEGA:
+ case ITEM_SEQ_HEALTH_VIAL:
+ self.attack_finished = time + 0.5;
+ base_item_health_fire (self, item_index);
+ break;
+ case ITEM_SEQ_ARTIFACT_ENVIROSUIT:
+ case ITEM_SEQ_ARTIFACT_INVISIBILITY:
+ case ITEM_SEQ_ARTIFACT_INVULNERABILITY:
+ case ITEM_SEQ_ARTIFACT_QUAD:
+ self.attack_finished = time + 0.5;
+ base_item_powerup_fire (self, item_index);
+ break;
+ case ITEM_SEQ_GIB1:
+ case ITEM_SEQ_GIB2:
+ case ITEM_SEQ_GIB3:
+ case ITEM_SEQ_HEAD_ARMY:
+ case ITEM_SEQ_HEAD_DEMON:
+ case ITEM_SEQ_HEAD_DOG:
+ case ITEM_SEQ_HEAD_ENFORCER:
+ case ITEM_SEQ_HEAD_HELLKNIGHT:
+ case ITEM_SEQ_HEAD_KNIGHT:
+ case ITEM_SEQ_HEAD_OGRE:
+ case ITEM_SEQ_HEAD_PLAYER:
+ case ITEM_SEQ_HEAD_SHALRATH:
+ case ITEM_SEQ_HEAD_SHAMBLER:
+ case ITEM_SEQ_HEAD_WIZARD:
+ case ITEM_SEQ_HEAD_ZOMBIE:
+ self.attack_finished = time + 0.5;
+ base_item_gib_fire (self, item_index);
+ break;
+ default:
+ dprint (sprintf("player_attack: "
+ "self.weapon %g, item index %g\n",
+ self.weapon, item_index));
+ break;
}
- else if (self.weapon == IT_SHOTGUN)
+ };
+
+ //--------------------------------------------------------------
+ // player_throw_item
+ // throw the active item, freeing the current inventory slot -- CEV
+ //--------------------------------------------------------------
+ void() player_throw_item =
+ {
+ if (time < self.attack_finished)
+ // we're waiting to attack -- CEV
+ return;
+
+ if (self.flags & FL_THROW_HELD)
+ return;
+
+ self.flags |= FL_THROW_HELD;
+
+ BASE_ENTITY_WEAPONLOOKUP (self)
+ if (item_index == ITEM_SEQ_HANDS)
{
- pl_shot1 ();
- player_fire_shotgun ();
+ // call fire_hands to perform a grab -- CEV
+ player_fire_hands ();
self.attack_finished = time + 0.5;
+ return;
}
- else if (self.weapon == IT_SUPER_SHOTGUN)
- {
- pl_shot1 ();
- player_fire_supershotgun ();
- self.attack_finished = time + 0.7;
- }
- else if (self.weapon == IT_NAILGUN)
+
+ if (item_index == ITEM_SEQ_AXE)
{
- pl_nail1 ();
+ // can't throw the axe (yet...) -- CEV
+ self.attack_finished = time + 0.5;
+ return;
}
- else if (self.weapon == IT_SUPER_NAILGUN)
+
+ makevectors (self.v_angle);
+ // TODO CEV work out how to convert viewmodel space into
+ // world space (so the thrown item appears to spawn from
+ // the same position the player is holding the item)
+ local vector org = self.origin + (self.view_ofs - '0 0 16') +
+ (v_forward * 50);
+
+ // don't spawn items into the solid world -- CEV
+ tracebox (self.origin, '-16 -16 -16', '16 16 16', org,
+ MOVE_NORMAL, self);
+ if (trace_startsolid || trace_allsolid)
{
- pl_nail1 ();
+ // we're too close to a wall to spawn the ent -- CEV
+ self.attack_finished = time + 0.2;
+ return;
}
- else if (self.weapon == IT_GRENADE_LAUNCHER)
+ if (trace_fraction < 1.0f)
{
- pl_rocket1 ();
- // TODO CEV
- // player_fire_grenade ();
- player_fire_tribolt ();
- // self.attack_finished = time + 0.6;
- self.attack_finished = time + 1.3;
+ // again, too close to a wall -- CEV
+ self.attack_finished = time + 0.2;
+ return;
}
- else if (self.weapon == IT_ROCKET_LAUNCHER)
+
+ local item_info_t item = item_info[item_index];
+ sprint (self, sprintf("%s threw the %s!\n",
+ self.netname, item.name));
+
+ // forward and up/down -- CEV
+ local vector vel = v_forward * 200.0f + v_up * 180.0f;
+ local float fl = SPAWNFLAG_ITEM_THROWN;
+
+ // spawn a new entity matching the held item definition -- CEV
+ switch (item_index)
{
- pl_rocket1 ();
- player_fire_rocket ();
- self.attack_finished = time + 0.8;
+ // id1 weapons
+ case ITEM_SEQ_SHOTGUN:
+ spawn_weapon_shotgun (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_SUPERSHOTGUN:
+ spawn_weapon_supershotgun (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_NAILGUN:
+ spawn_weapon_nailgun (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_SUPERNAILGUN:
+ spawn_weapon_supernailgun (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_GRENADELAUNCHER:
+ spawn_weapon_grenadelauncher (self, org, vel,
+ fl);
+ break;
+ case ITEM_SEQ_ROCKETLAUNCHER:
+ spawn_weapon_rocketlauncher (self, org, vel,
+ fl);
+ break;
+ case ITEM_SEQ_LIGHTNINGGUN:
+ spawn_weapon_lightning (self, org, vel, fl);
+ break;
+ // id1 ammo
+ case ITEM_SEQ_AMMO_SHELLS_SMALL:
+ spawn_item_shells (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_AMMO_SHELLS_LARGE:
+ spawn_item_shells (self, org, vel,
+ fl | SPAWNFLAG_ITEM_AMMO_LARGE_BOX);
+ break;
+ case ITEM_SEQ_AMMO_NAILS_SMALL:
+ spawn_item_spikes (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_AMMO_NAILS_LARGE:
+ spawn_item_spikes (self, org, vel,
+ fl | SPAWNFLAG_ITEM_AMMO_LARGE_BOX);
+ break;
+ case ITEM_SEQ_AMMO_ROCKETS_SMALL:
+ spawn_item_rockets (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_AMMO_ROCKETS_LARGE:
+ spawn_item_rockets (self, org, vel,
+ fl | SPAWNFLAG_ITEM_AMMO_LARGE_BOX);
+ break;
+ case ITEM_SEQ_AMMO_CELLS_SMALL:
+ spawn_item_cells (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_AMMO_CELLS_LARGE:
+ spawn_item_cells (self, org, vel,
+ fl | SPAWNFLAG_ITEM_AMMO_LARGE_BOX);
+ break;
+ case ITEM_SEQ_ARMOR_GREEN:
+ spawn_item_armor1 (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_ARMOR_YELLOW:
+ spawn_item_armor2 (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_ARMOR_RED:
+ spawn_item_armorInv (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_ARMOR_SHARD:
+ spawn_item_armor_shard (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_HEALTH_ROTTEN:
+ spawn_item_health (self, org, vel,
+ fl | SPAWNFLAG_ITEM_HEALTH_ROTTEN);
+ break;
+ case ITEM_SEQ_HEALTH:
+ spawn_item_health (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_HEALTH_MEGA:
+ spawn_item_health (self, org, vel,
+ fl | SPAWNFLAG_ITEM_HEALTH_MEGA);
+ break;
+ case ITEM_SEQ_HEALTH_VIAL:
+ spawn_item_health_vial (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_ARTIFACT_ENVIROSUIT:
+ spawn_item_artifact_envirosuit (self, org,
+ vel, fl);
+ break;
+ case ITEM_SEQ_ARTIFACT_INVISIBILITY:
+ spawn_item_artifact_invisibility (self, org,
+ vel, fl);
+ break;
+ case ITEM_SEQ_ARTIFACT_INVULNERABILITY:
+ spawn_item_artifact_invulnerability (self, org,
+ vel, fl);
+ break;
+ case ITEM_SEQ_ARTIFACT_QUAD:
+ spawn_item_artifact_super_damage (self, org,
+ vel, fl);
+ break;
+ case ITEM_SEQ_GIB1:
+ spawn_item_gib1 (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_GIB2:
+ spawn_item_gib2 (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_GIB3:
+ spawn_item_gib3 (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_HEAD_ARMY:
+ spawn_item_head_army (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_HEAD_DEMON:
+ spawn_item_head_demon (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_HEAD_DOG:
+ spawn_item_head_dog (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_HEAD_ENFORCER:
+ spawn_item_head_enforcer (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_HEAD_HELLKNIGHT:
+ spawn_item_head_hell_knight(self, org, vel, fl);
+ break;
+ case ITEM_SEQ_HEAD_KNIGHT:
+ spawn_item_head_knight (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_HEAD_OGRE:
+ spawn_item_head_ogre (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_HEAD_PLAYER:
+ spawn_item_head_player (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_HEAD_SHALRATH:
+ spawn_item_head_shalrath (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_HEAD_SHAMBLER:
+ spawn_item_head_shambler (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_HEAD_WIZARD:
+ spawn_item_head_wizard (self, org, vel, fl);
+ break;
+ case ITEM_SEQ_HEAD_ZOMBIE:
+ spawn_item_head_zombie (self, org, vel, fl);
+ break;
+ default:
+ objerror (sprintf("player_throw_item: "
+ "unknown item type %g!\n", item_index));
+ self.attack_finished = time + 0.5;
+ return;
}
- else if (self.weapon == IT_LIGHTNING)
+
+ // now remove the held item -- CEV
+ switch (self.weapon)
{
- pl_light1 ();
- self.attack_finished = time + 0.1;
- sound (self, CHAN_AUTO, "weapons/lstart.wav",
- VOL_HIGH, ATTN_NORM);
+ case 1: self.inventory1 = ITEM_SEQ_HANDS; break;
+ case 2: self.inventory2 = ITEM_SEQ_HANDS; break;
+ case 3: self.inventory3 = ITEM_SEQ_HANDS; break;
+ case 4: self.inventory4 = ITEM_SEQ_HANDS; break;
+ case 5: self.inventory5 = ITEM_SEQ_HANDS; break;
+ case 6: self.inventory6 = ITEM_SEQ_HANDS; break;
+ case 7: self.inventory7 = ITEM_SEQ_HANDS; break;
+ case 8: self.inventory8 = ITEM_SEQ_HANDS; break;
}
+
+ // clear weaponframe & set a cooldown then we're done -- CEV
+ self.weaponframe = 0;
+ self.attack_finished = time + 0.5;
+ self.SendFlags |= NETFLAG_PLAYER_FRAME | NETFLAG_PLAYER_WEAPON;
};
//==============================================================
@@ -1770,7 +2418,7 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
//--------------------------------------------------------------
void() player_set_suicide_frame =
{
- // used by klill command and disconnect command
+ // used by kill command and disconnect command
if (self.model != "progs/player.mdl")
// allready gibbed
return;
@@ -1973,16 +2621,16 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
switch (self.cnt)
{
case 0:
- wav = "player/stepwater1.ogg";
+ wav = "cev/player/step_water_01.ogg";
break;
case 1:
- wav = "player/stepwater2.ogg";
+ wav = "cev/player/step_water_02.ogg";
break;
case 2:
- wav = "player/stepwater3.ogg";
+ wav = "cev/player/step_water_03.ogg";
break;
case 3:
- wav = "player/stepwater4.ogg";
+ wav = "cev/player/step_water_04.ogg";
}
}
else if (self.conlevel == WATERLEVEL_WAIST)
@@ -1998,10 +2646,10 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
switch (self.cnt)
{
case 0:
- wav = "player/stepwade1.ogg";
+ wav = "cev/player/wade_water_01.ogg";
break;
case 1:
- wav = "player/stepwade2.ogg";
+ wav = "cev/player/wade_water_02.ogg";
}
}
else
@@ -2009,35 +2657,35 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
// call world_surface_type (which then calls out
// to compatibility modules) to get a material type
// under the player -- CEV
- switch (world_surface_type(self, [0, 0, self.mins_z]))
+ switch (world_surface_type([0, 0, self.mins_z]))
{
case SURFACE_DIRT:
vol = 0.3 + (random() * 0.2);
if (self.cnt > 4)
self.cnt = 0;
- wav = sprintf ("player/stepdirt%g.ogg",
- self.cnt + 1);
+ wav = sprintf ("cev/player/step_dirt_0"
+ "%g.ogg", self.cnt + 1);
break;
case SURFACE_METAL:
vol = 0.3 + (random() * 0.2);
self.cnt = rint (random() * 8);
- wav = sprintf ("player/stepmetal%g.ogg",
- self.cnt + 1);
+ wav = sprintf ("cev/player/step_metal_0"
+ "%g.ogg", self.cnt + 1);
break;
case SURFACE_WOOD:
vol = 0.3 + (random() * 0.2);
if (self.cnt > 3)
self.cnt = 0;
- wav = sprintf ("player/stepwood%g.ogg",
- self.cnt + 1);
+ wav = sprintf ("cev/player/step_wood_0"
+ "%g.ogg", self.cnt + 1);
break;
default:
// default is SURFACE_STONE -- CEV
vol = 0.3 + (random() * 0.2);
if (self.cnt > 5)
self.cnt = 0;
- wav = sprintf ("player/stepstone%g.ogg",
- self.cnt + 1);
+ wav = sprintf ("cev/player/step_stone_0"
+ "%g.ogg", self.cnt + 1);
}
}
@@ -2058,12 +2706,12 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
if (self.velocity_x || self.velocity_y)
{
- if (self.weapon == IT_AXE)
+ if (self.weapon == ITEM_SEQ_AXE)
pl_axrun1 ();
else
pl_run1 ();
}
- else if (self.weapon == IT_AXE)
+ else if (self.weapon == ITEM_SEQ_AXE)
{
pl_axstnd1 ();
}
@@ -2076,13 +2724,13 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
if (self.velocity_x || self.velocity_y)
{
- if (self.weapon == IT_AXE)
+ if (self.weapon == ITEM_SEQ_AXE)
pl_axrun1 ();
else
pl_run1 ();
return;
}
- else if (self.weapon != IT_AXE)
+ else if (self.weapon != ITEM_SEQ_AXE)
{
pl_stand1 ();
}
@@ -2095,7 +2743,7 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
if (self.velocity_x == 0 && self.velocity_y == 0)
pl_stand1 ();
- else if (self.weapon == IT_AXE)
+ else if (self.weapon == ITEM_SEQ_AXE)
axthink ();
};
@@ -2106,7 +2754,7 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
if (self.velocity_x == 0 && self.velocity_y == 0)
pl_stand1 ();
- else if (self.weapon != IT_AXE)
+ else if (self.weapon != ITEM_SEQ_AXE)
runthink ();
};
@@ -2195,8 +2843,7 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
void() pl_shot1 = [$shotatt1, pl_shot2]
{
self.weaponframe = 1;
- self.sveffects |= EF_MUZZLEFLASH;
- // self.SendFlags |= PLAYER_NET_EFFECTS;
+ self.flags |= FL_MUZZLEFLASH;
};
void() pl_shot2 = [$shotatt2, pl_shot3] { self.weaponframe = 2; };
void() pl_shot3 = [$shotatt3, pl_shot4] { self.weaponframe = 3; };
@@ -2257,8 +2904,7 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
//--------------------------------------------------------------
void() pl_nail1 = [$nailatt1, pl_nail2]
{
- self.sveffects |= EF_MUZZLEFLASH;
- // self.SendFlags |= PLAYER_NET_EFFECTS;
+ self.flags |= FL_MUZZLEFLASH;
if (!self.button0)
{
@@ -2275,8 +2921,7 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
};
void() pl_nail2 = [$nailatt2, pl_nail1]
{
- self.sveffects |= EF_MUZZLEFLASH;
- // self.SendFlags |= PLAYER_NET_EFFECTS;
+ self.flags |= FL_MUZZLEFLASH;
if (!self.button0)
{
@@ -2297,8 +2942,7 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
//--------------------------------------------------------------
void() pl_light1 = [$light1, pl_light2]
{
- self.sveffects |= EF_MUZZLEFLASH;
- // self.SendFlags |= PLAYER_NET_EFFECTS;
+ self.flags |= FL_MUZZLEFLASH;
if (!self.button0)
{
@@ -2315,8 +2959,7 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
};
void() pl_light2 = [$light2, pl_light1]
{
- self.sveffects |= EF_MUZZLEFLASH;
- // self.SendFlags |= PLAYER_NET_EFFECTS;
+ self.flags |= FL_MUZZLEFLASH;
if (!self.button0)
{
@@ -2338,8 +2981,7 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
void() pl_rocket1 = [$rockatt1, pl_rocket2]
{
self.weaponframe = 1;
- self.sveffects |= EF_MUZZLEFLASH;
- // self.SendFlags |= PLAYER_NET_EFFECTS;
+ self.flags |= FL_MUZZLEFLASH;
};
void() pl_rocket2 = [$rockatt2, pl_rocket3] { self.weaponframe = 2; };
void() pl_rocket3 = [$rockatt3, pl_rocket4] { self.weaponframe = 3; };
@@ -2468,7 +3110,7 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
{
local float forward;
- if ((self.flags & FL_ONGROUND))
+ if (self.flags & FL_ONGROUND)
{
forward = vlen (self.velocity);
forward = forward - 20;
@@ -2599,43 +3241,33 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
};
//--------------------------------------------------------------
- // Called by PlayerPreThink in entrypoints.qc -- CEV
+ // Called by PlayerPreThink in sv_entry.qc -- CEV
//--------------------------------------------------------------
- void() player_prethink =
- {
- local float do_ladder_physics = FALSE;
-
- // If just spawned in, try to recover previous fog values
- // from own client entity, if any
- if (clean_up_client_stuff)
- fog_set_from_ent (self, self);
-
- self.gravity = self.wantedgravity;
-
- player_prethink_watermove ();
-
- if (self.deadflag >= DEAD_DEAD)
- {
- // dead, so run the death think -- CEV
- player_death_think ();
- return;
- }
-
- if (self.deadflag == DEAD_DYING)
- // dying, so do nothing
- return;
-
- // teleporters can force a non-moving pause time
- if (time < self.pausetime)
- self.velocity = '0 0 0';
-
- if (time > self.attack_finished && self.currentammo == 0
- && self.weapon != IT_AXE)
- {
- self.weapon = player_best_weapon ();
- player_set_current_ammo ();
- }
- };
+ #define PLAYER_PRETHINK() \
+ /* { */ \
+ local float do_ladder_physics = FALSE; \
+ /* If just spawned in, try to recover previous fog values
+ * from own client entity, if any */ \
+ if (clean_up_client_stuff) \
+ fog_set_from_ent (self, self); \
+ self.gravity = self.wantedgravity; \
+ player_prethink_watermove (); \
+ if (self.deadflag >= DEAD_DEAD) \
+ { \
+ /* dead, so run the death think -- CEV */ \
+ player_death_think (); \
+ } \
+ else if (self.deadflag != DEAD_DYING) \
+ { \
+ /* clear THROW_HELD if needed -- CEV */ \
+ if (!(self.button6)) \
+ if (self.flags & FL_THROW_HELD) \
+ self.flags &= ~FL_THROW_HELD; \
+ /* teleporters can force a non-moving pause time */ \
+ if (time < self.pausetime) \
+ self.velocity = '0 0 0'; \
+ } \
+ /* } */
//--------------------------------------------------------------
// CheckPowerups -- Check for turning off powerups
@@ -2645,6 +3277,10 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
if (self.health <= 0)
return;
+ if (self.punchangle)
+ if (self.SendEntity)
+ self.SendFlags |= NETFLAG_PLAYER_PUNCHANGLE;
+
// invisibility
if (self.invisible_finished)
{
@@ -2679,7 +3315,7 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
if (self.invisible_finished < time)
{
// just stopped
- self.items = self.items - IT_INVISIBILITY;
+ self.items &= ~IT_INVISIBILITY;
self.invisible_finished = 0;
self.invisible_time = 0;
}
@@ -2689,8 +3325,8 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
{
self.frame = 0;
self.modelindex = modelindex_eyes;
- // self.SendFlags |= PLAYER_NET_FRAME |
- // PLAYER_NET_MODEL;
+ // self.SendFlags |= NETFLAG_PLAYER_FRAME |
+ // NETFLAG_PLAYER_MODEL;
}
}
else
@@ -2699,8 +3335,8 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
if (self.modelindex != modelindex_player)
{
self.modelindex = modelindex_player;
- // self.SendFlags |= PLAYER_NET_FRAME |
- // PLAYER_NET_MODEL;
+ // self.SendFlags |= NETFLAG_PLAYER_FRAME |
+ // NETFLAG_PLAYER_MODEL;
}
}
@@ -2731,16 +3367,14 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
if (self.invincible_finished < time)
{
// just stopped
- self.items = self.items - IT_INVULNERABILITY;
+ self.items &= ~IT_INVULNERABILITY;
self.invincible_time = 0;
self.invincible_finished = 0;
}
if (self.invincible_finished > time)
- self.sveffects |= EF_DIMLIGHT;
+ self.flags |= FL_DIMLIGHT;
else
- self.sveffects &= ~EF_DIMLIGHT;
-
- // self.SendFlags |= PLAYER_NET_EFFECTS;
+ self.flags &= ~FL_DIMLIGHT;
}
// super damage
@@ -2770,16 +3404,14 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
if (self.super_damage_finished < time)
{
// just stopped
- self.items = self.items - IT_QUAD;
+ self.items &= ~IT_QUAD;
self.super_damage_finished = 0;
self.super_time = 0;
}
if (self.super_damage_finished > time)
- self.sveffects |= EF_DIMLIGHT;
+ self.flags |= FL_DIMLIGHT;
else
- self.sveffects &= ~EF_DIMLIGHT;
-
- // self.SendFlags |= PLAYER_NET_EFFECTS;
+ self.flags &= ~FL_DIMLIGHT;
}
// suit
@@ -2812,7 +3444,7 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
if (self.radsuit_finished < time)
{
// just stopped
- self.items = self.items - IT_SUIT;
+ self.items &= ~IT_SUIT;
self.rad_time = 0;
self.radsuit_finished = 0;
}
@@ -2826,12 +3458,12 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
{
// load up the sendflags -- CEV
// if (self.oldorigin != self.origin)
- // self.SendFlags |= PLAYER_NET_ORIGIN;
- self.SendFlags = PLAYER_NET_FRAME | PLAYER_NET_MODEL |
- PLAYER_NET_ORIGIN | PLAYER_NET_ANGLES |
- PLAYER_NET_VELOCITY | PLAYER_NET_FLAGS |
- PLAYER_NET_TIMERS | PLAYER_NET_EFFECTS |
- PLAYER_NET_SOLID | PLAYER_NET_PUNCHANGLE;
+ // self.SendFlags |= NETFLAG_PLAYER_ORIGIN;
+ self.SendFlags |= NETFLAG_PLAYER_FRAME | NETFLAG_PLAYER_MODEL |
+ NETFLAG_PLAYER_ORIGIN | NETFLAG_PLAYER_ANGLES |
+ NETFLAG_PLAYER_VELOCITY | NETFLAG_PLAYER_FLAGS |
+ NETFLAG_PLAYER_TIMERS | NETFLAG_PLAYER_SOLID |
+ NETFLAG_PLAYER_ITEMS | NETFLAG_PLAYER_HEALTH;
if (self.view_ofs == '0 0 0')
// intermission or finale
@@ -2863,19 +3495,32 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
if (self.impulse)
player_impulse ();
- if (input_buttons & PM_BTN_ATTACK)
+ // don't attack or throw when climbing -- CEV
+ // don't attack or throw when on ladder -- CEV
+ // attack and throw are mutually exclusive -- CEV
+ if (!(self.pm_flags & PMF_CLIMB)) {
+ if (!(self.pm_flags & PMF_ONLADDER)) {
+ if (self.button0)
{
+ // button0 = attack -- CEV
player_superdamage_sound ();
player_attack ();
}
+ else if (self.button6 && !(self.flags & FL_THROW_HELD))
+ {
+ // button6 = grab / throw -- CEV
+ player_throw_item ();
+ } } }
}
// check to see if player landed and play landing sound
if (self.jump_flag < -300 && self.health > 0)
{
if (self.contype == CONTENT_WATER)
+ {
sound (self, CHAN_BODY, "player/h2ojump.wav",
VOL_HIGH, ATTN_NORM);
+ }
else if (self.jump_flag < -650)
{
self.deathtype = "falling";
@@ -2885,8 +3530,10 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
VOL_HIGH, ATTN_NORM);
}
else
+ {
sound (self, CHAN_VOICE, "player/land.wav",
VOL_HIGH, ATTN_NORM);
+ }
self.jump_flag = 0;
}
@@ -2901,9 +3548,7 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
}
else if (self.health <= 100)
{
- // thanks ydrol!!!
- self.items = self.items -
- (self.items & IT_SUPERHEALTH);
+ self.items &= ~IT_SUPERHEALTH;
}
}
@@ -2926,7 +3571,7 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
// eyes don't have pain frames
return;
- if (self.weapon == IT_AXE)
+ if (self.weapon == ITEM_SEQ_AXE)
pl_axpain1 ();
else
pl_pain1 ();
@@ -2937,10 +3582,18 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
//--------------------------------------------------------------
void(vector dir) player_destroy_gib =
{
- throw_gib_head_player (self, dir, self.health);
- throw_gib_1 (self, dir, self.health);
- throw_gib_2 (self, dir, self.health);
- throw_gib_3 (self, dir, self.health);
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib1_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib2_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib3_init)
+
+ // throw the player head -- this needs special treatment -- CEV
+ self.nextthink = -1;
+ self.spawnflags = SPAWNFLAG_ITEM_THROWN;
+ self.view_ofs = '0 0 8';
+ self.origin_z = self.origin_z - 24;
+ self.avelocity = crandom() * '0 600 0';
+ self.velocity = velocity_for_damage (dir, self.health);
+ item_head_player_init (self);
self.deadflag = DEAD_DEAD;
@@ -2966,14 +3619,11 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
{
local float i;
- // 1998-07-23 Palette shift when player dies with quad/pentagram
- // fix by Maddes start
- // self.items = self.items - (self.items & IT_INVISIBILITY);
- self.items = self.items - (self.items &
- (IT_INVISIBILITY | IT_INVULNERABILITY |
- IT_SUIT | IT_QUAD));
- // 1998-07-23 Palette shift when player dies with quad/pentagram
- // fix by Maddes end
+ // clear held powerups -- CEV
+ self.items &= ~IT_INVISIBILITY;
+ self.items &= ~IT_INVULNERABILITY;
+ self.items &= ~IT_SUIT;
+ self.items &= ~IT_QUAD;
// don't die as eyes
// self.invisible_finished = 0;
@@ -2984,7 +3634,6 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
// 1998-07-23 Glowing corpse of players which had quad/pentagram
// until respawn fix by Maddes
self.effects = 0;
- self.sveffects = 0;
// don't use eyes
self.modelindex = modelindex_player;
@@ -2996,7 +3645,8 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
self.view_ofs = '0 0 -8';
self.deadflag = DEAD_DYING;
self.solid = SOLID_NOT;
- self.flags = self.flags - (self.flags & FL_ONGROUND);
+ self.flags &= ~FL_ONGROUND;
+ self.pm_flags &= ~PMF_ONGROUND;
self.movetype = MOVETYPE_TOSS;
if (self.velocity_z < 10)
@@ -3005,6 +3655,10 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
if (self.health < -40)
{
player_destroy_gib (dir);
+
+ if (self.SendEntity)
+ self.SendFlags = 0xffffff;
+
return;
}
@@ -3013,9 +3667,16 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
self.angles_x = 0;
self.angles_z = 0;
- if (self.weapon == IT_AXE)
+ // creates item_index -- CEV
+ BASE_ENTITY_WEAPONLOOKUP (self)
+
+ if (item_index == ITEM_SEQ_AXE)
{
pl_die_ax1 ();
+
+ if (self.SendEntity)
+ self.SendFlags = 0xffffff;
+
return;
}
@@ -3033,6 +3694,9 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
pl_died1 ();
else
pl_diee1 ();
+
+ if (self.SendEntity)
+ self.SendFlags = 0xffffff;
};
#endif
@@ -3153,9 +3817,23 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
// (The old "reset_items" check, which this replaces,
// had a comment from dumptruck_ds thanking Spike.) -- iw
if ((serverflags != 0 && world.model == "maps/start.bsp") ||
- world.reset_items != 0)
+ world.aflag & WORLD_FLAG_RESET_ITEMS)
{
SetNewParms ();
+
+ // restore runes -- CEV
+ if (serverflags & SPAWNFLAG_ITEM_SIGIL_RUNE1)
+ parm1 |= IT_RUNE1;
+ if (serverflags & SPAWNFLAG_ITEM_SIGIL_RUNE2)
+ parm1 |= IT_RUNE2;
+ if (serverflags & SPAWNFLAG_ITEM_SIGIL_RUNE3)
+ parm1 |= IT_RUNE3;
+ if (serverflags & SPAWNFLAG_ITEM_SIGIL_RUNE4)
+ parm1 |= IT_RUNE4;
+ if (serverflags & SPAWNFLAG_ITEM_SIGIL_RUNE5)
+ parm1 |= IT_RUNE5;
+ if (serverflags & SPAWNFLAG_ITEM_SIGIL_RUNE6)
+ parm1 |= IT_RUNE6;
}
self.items = parm1;
@@ -3167,6 +3845,17 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
self.ammo_cells = parm7;
self.weapon = parm8;
self.armortype = parm9 * 0.01;
+ self.inventory1 = parm11;
+ self.inventory2 = parm12;
+ self.inventory3 = parm13;
+ self.inventory4 = parm14;
+ self.inventory5 = parm15;
+ self.inventory6 = parm16;
+ self.inventory7 = parm17;
+ self.inventory8 = parm18;
+
+ if (self.SendEntity)
+ self.SendFlags = 0xffffff;
};
//--------------------------------------------------------------
@@ -3211,19 +3900,28 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
#endif
// block common to both client & server -- CEV
- e.classname = "player";
e.classtype = CT_PLAYER;
e.solid = SOLID_SLIDEBOX;
e.movetype = MOVETYPE_WALK;
e.touch = player_touch;
+ // clear any lingering classgroups -- CEV
+ if (e.classgroup & CG_CORPSE)
+ e.classgroup &= ~CG_CORPSE;
+ if (e.classgroup & CG_ITEM)
+ e.classgroup &= ~CG_ITEM;
+ if (e.classgroup & CG_MAPENTITY)
+ e.classgroup &= ~CG_MAPENTITY;
+
#ifdef CSQC
+ if (view_player == e)
+ e.classname = "viewentity";
+ else
+ e.classname = "player";
+
e.customphysics = sub_null;
e.drawmask = DRAWMASK_NORMAL;
e.predraw = player_predraw;
- e.preframe = player_prediction_preframe;
- e.postframe = player_prediction_postframe;
- e.removefunc = player_remove;
e.view_ofs = PM_STAND_VIEWOFS;
e.velocity = '0 0 0';
@@ -3233,9 +3931,13 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
else
setsize (e, PM_STAND_MIN, PM_STAND_MAX);
setorigin (e, e.origin);
+
+ // make sure this isn't 0 -- CEV
+ view_error_speed = 24.0f;
#endif
#ifdef SSQC
+ e.classname = "player";
e.flags = FL_CLIENT;
e.effects = 0;
e.gravity = 0;
@@ -3263,7 +3965,6 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
e.script_time = 0;
player_init_level_parms ();
- player_set_current_ammo ();
e.attack_finished = time;
e.th_pain = player_pain;
@@ -3284,9 +3985,24 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
// Looks if there's any fog values set at the current
// spawn point. If not, looks for those in worldspawn instead
if (spot.fog_density)
+ {
fog_save (e, spot.fog_density, spot.fog_color);
+ }
else if (world.fog_density)
+ {
fog_save (e, world.fog_density, world.fog_color);
+ }
+ else if (world.fog_info_entity != __NULL__ &&
+ world.fog_info_entity != "")
+ {
+ // MG1 compat -- CEV
+ local entity f;
+ f = find (world, targetname, world.fog_info_entity);
+ if (f.classtype == CT_INFO_FOG)
+ {
+ fog_save (e, f.fog_density, f.fog_color);
+ }
+ }
if (spot.skyfog_density)
skyfog_save (e, spot.skyfog_density);
@@ -3297,19 +4013,16 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
// fog-related stuff
clean_up_client_stuff = 2;
- // oh, this is a hack!
- setmodel (e, "progs/eyes.mdl");
- modelindex_eyes = e.modelindex;
-
- // Drake -- dumptruck_ds
- setmodel (e, "progs/s_null.spr");
- // Drake -- dumptruck_ds
- // setmodel (e, "progs/null_256.spr");
- mindex_inviso = e.modelindex;
-
+ // set the player model & store the player's model index -- CEV
setmodel (e, "progs/player.mdl");
modelindex_player = e.modelindex;
+ // store the eyes modelindex to save lookups later -- CEV
+ modelindex_eyes = getmodelindex ("progs/eyes.mdl");
+
+ // Drake -- dumptruck_ds
+ modelindex_invisible = getmodelindex ("progs/s_null.spr");
+
setsize (e, PM_STAND_MIN, PM_STAND_MAX);
e.view_ofs = PM_STAND_VIEWOFS;
// Mod - Xian (May.20.97)
@@ -3351,69 +4064,6 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
#ifdef SSQC
-/*QUAKED gib_head_player (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/h_player.mdl");
-}*/
-//----------------------------------------------------------------------
-// class gib_head_player: base_gib_head
-// {
- //--------------------------------------------------------------
- // ThrowHead
- //--------------------------------------------------------------
- void(entity act, vector dir, float dmg) throw_gib_head_player =
- {
- base_gib_head_throw (act, dir, dmg, gib_head_player_init);
- };
-
- //--------------------------------------------------------------
- void(entity e) gib_head_player_init =
- {
- // don't reset class if passed a client entity -- CEV
- if (!(e.flags & FL_CLIENT))
- {
- e.classname = "gib_head_player";
- e.classtype = CT_GORE_HEAD_PLAYER;
- }
-
- // gib_init interprets spawnflags and will set .solid -- CEV
- base_gib_head_init (e);
-
- if (e.mdl_head != "")
- {
- precache_model (e.mdl_head);
- setmodel (e, e.mdl_head);
- e.SendFlags |= PLAYER_NET_MODEL | PLAYER_NET_SOLID |
- PLAYER_NET_SIZE;
- }
- else
- {
- precache_model ("progs/h_player.mdl");
- setmodel (e, "progs/h_player.mdl");
- if (e.solid == SOLID_BBOX)
- setsize (e, PLAYER_HEAD_MINS, PLAYER_HEAD_MAXS);
- else if (e.solid == SOLID_TRIGGER)
- setsize (e, '-16 -16 0', '16 16 56');
- e.SendFlags |= PLAYER_NET_MODEL | PLAYER_NET_SOLID |
- PLAYER_NET_SIZE;
- }
-
- e.frame = 0;
- };
-
- //--------------------------------------------------------------
- void() gib_head_player =
- {
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- gib_head_player_init (self);
- };
-// };
-#endif
-
-#ifdef SSQC
/*QUAKED player_dead_axe (0 0.5 0.8) (-16 -16 -24) (16 16 32) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ({"path":"progs/player.mdl","frame":49});
@@ -3429,6 +4079,7 @@ void() player_dead_axe =
setmodel (self, "progs/player.mdl");
self.frame = $axdeth9;
+ // TODO CEV
if (self.spawnflags & 1)
{
self.solid = SOLID_BBOX;
@@ -3457,6 +4108,7 @@ void() player_dead_face_down =
setmodel (self, "progs/player.mdl");
self.frame = $deathc14;
+ // TODO CEV
if (self.spawnflags & 1)
{
self.solid = SOLID_BBOX;
@@ -3485,6 +4137,7 @@ void() player_dead_on_side =
setmodel (self, "progs/player.mdl");
self.frame = $deathe9;
+ // TODO CEV
if (self.spawnflags & 1)
{
self.solid = SOLID_BBOX;
@@ -3500,3 +4153,7 @@ void() player_dead_on_side =
//======================================================================
// END Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds
//======================================================================
+
+#if defined(CSQC) || defined(SSQC)
+$flush
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/monsters/shalrath.qc
diff --git a/qc/monsters/shalrath.qc b/qc/monsters/shalrath.qc
index f90ac57..345ca76 100644
--- a/qc/monsters/shalrath.qc
+++ b/qc/monsters/shalrath.qc
@@ -6,22 +6,31 @@
// constants
//======================================================================
+#ifdef SSQC
const float SHALRATH_HEALTH = 400; // id1 400
const float SHALRATH_HEALTH_CORPSE = 80;
+#endif
-const vector SHALRATH_HEAD_MINS = '-19.85 -19.09 -1.44';
-const vector SHALRATH_HEAD_MAXS = '13.72 16.8 30';
+#if defined(CSQC) || defined(SSQC)
+const vector SHALRATH_MINS = VEC_HULL2_MIN;
+const vector SHALRATH_MAXS = VEC_HULL2_MAX;
const vector SHALRATH_CORPSE_MINS = '-41.41 -40.06 -49.38';
const vector SHALRATH_CORPSE_MAXS = '34.52 24.32 30';
const vector SHALRATH_CORPSE_Z_MINS = '-20 -20 -24';
const vector SHALRATH_CORPSE_Z_MAXS = '20 20 -8';
+#endif
//======================================================================
// forward declarations
//======================================================================
// monster_shalrath
+#ifdef CSQC
+void(float isnew) monster_shalrath_netreceive;
+#endif
+#ifdef SSQC
void() monster_shalrath_sightsound; // AI, animation, & thinking
+// F() // macro to set FRAME netflag -- CEV
void() shal_walk1; void() shal_walk2; void() shal_walk3; void() shal_walk4;
void() shal_walk5; void() shal_walk6; void() shal_walk7; void() shal_walk8;
void() shal_walk9; void() shal_walk10; void() shal_walk11; void() shal_walk12;
@@ -43,24 +52,27 @@ void() shal_death1; void() shal_death2; void() shal_death3; void() shal_death4;
void() shal_death5; void() shal_death6; void() shal_death7;
void(entity attacker, float damage) monster_shalrath_pain; // interaction
void(vector dir) monster_shalrath_destroy;
-entity(vector org, vector ang, float sflags, float yaw, float angry)
+entity(vector org, vector ang, float sflags, float yaw)
spawn_monster_shalrath; // initialization
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) monster_shalrath_init;
+#endif
+#ifdef SSQC
void() monster_shalrath;
+#endif
-// gib_head_shalrath
-void(entity act, vector dir, float dmg) throw_gib_head_shalrath;
-void(entity e) gib_head_shalrath_init;
-void() gib_head_shalrath;
-
+#ifdef SSQC
// monster_dead_shalrath
void(entity e) monster_dead_shalrath_init;
void() monster_dead_shalrath;
+#endif
//======================================================================
// frame macros
//======================================================================
+#if defined(CSQC) || defined(SSQC)
$cd id1/models/shalrath
$origin 0 0 24
$base base
@@ -77,6 +89,10 @@ $frame death1 death2 death3 death4 death5 death6 death7
$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9 walk10
$frame walk11 walk12
+// MG1 compat -- CEV
+const float CORPSEFRAME_SHALRATH_1 = $death7;
+#endif
+
//------------------------------------------------------------------------------
/*QUAKED monster_shalrath (1 0 0) (-32 -32 -24) (32 32 48) AMBUSH X X TRIGGER_SPAWNED X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
@@ -141,19 +157,48 @@ homing(float) : "Amount that the projectile should home in target. 1 is default,
*/
//----------------------------------------------------------------------
-// class monster_shalrath: base_walkmonster
+// class monster_shalrath: base_monster
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) monster_shalrath_netreceive =
+ {
+ // creates the newframe and netflags variables -- CEV
+ BASE_MONSTER_NETRECEIVE (monster_shalrath_init,
+ SHALRATH_MINS, SHALRATH_MAXS)
+
+ if (isnew)
+ base_entity_que_add (self, QUE_TYPE_ACTOR);
+
+ if (self.frame >= $death1 && self.frame <= $death7)
+ {
+ if (self.solid != SOLID_NOT)
+ self.solid = SOLID_NOT;
+ }
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
void() monster_shalrath_sightsound =
{
- sound_sight (self, CHAN_VOICE, "shalrath/sight.wav",
+ sound (self, CHAN_VOICE, "shalrath/sight.wav",
VOL_HIGH, ATTN_NORM);
};
//--------------------------------------------------------------
+ #define F() \
+ /* { */ \
+ if (!(self.SendFlags & NETFLAG_BASE_ENTITY_FRAME)) \
+ { \
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME; \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
// Shalrath Standing (only one frame)
//--------------------------------------------------------------
- void() shal_stand1 = [$walk1, shal_stand1] { ai_stand (); };
+ void() shal_stand1 = [$walk1, shal_stand1] { ai_stand (); F () };
//--------------------------------------------------------------
// Shalrath Walking functions
@@ -161,21 +206,22 @@ homing(float) : "Amount that the projectile should home in target. 1 is default,
void() shal_walk1 = [$walk2, shal_walk2]
{
if (random() < 0.2)
- sound_idle (self, CHAN_VOICE, "shalrath/idle.wav",
+ sound (self, CHAN_VOICE, "shalrath/idle.wav",
VOL_HIGH, ATTN_IDLE);
ai_walk (6);
+ F ()
};
- void() shal_walk2 = [$walk3, shal_walk3] { ai_walk (4); };
- void() shal_walk3 = [$walk4, shal_walk4] { ai_walk (0); };
- void() shal_walk4 = [$walk5, shal_walk5] { ai_walk (0); };
- void() shal_walk5 = [$walk6, shal_walk6] { ai_walk (0); };
- void() shal_walk6 = [$walk7, shal_walk7] { ai_walk (0); };
- void() shal_walk7 = [$walk8, shal_walk8] { ai_walk (5); };
- void() shal_walk8 = [$walk9, shal_walk9] { ai_walk (6); };
- void() shal_walk9 = [$walk10, shal_walk10] { ai_walk (5); };
- void() shal_walk10 = [$walk11, shal_walk11] { ai_walk (0); };
- void() shal_walk11 = [$walk12, shal_walk12] { ai_walk (4); };
- void() shal_walk12 = [$walk1, shal_walk1] { ai_walk (5); };
+ void() shal_walk2 = [$walk3, shal_walk3] { ai_walk (4); F () };
+ void() shal_walk3 = [$walk4, shal_walk4] { ai_walk (0); F () };
+ void() shal_walk4 = [$walk5, shal_walk5] { ai_walk (0); F () };
+ void() shal_walk5 = [$walk6, shal_walk6] { ai_walk (0); F () };
+ void() shal_walk6 = [$walk7, shal_walk7] { ai_walk (0); F () };
+ void() shal_walk7 = [$walk8, shal_walk8] { ai_walk (5); F () };
+ void() shal_walk8 = [$walk9, shal_walk9] { ai_walk (6); F () };
+ void() shal_walk9 = [$walk10, shal_walk10] { ai_walk (5); F () };
+ void() shal_walk10 = [$walk11, shal_walk11] { ai_walk (0); F () };
+ void() shal_walk11 = [$walk12, shal_walk12] { ai_walk (4); F () };
+ void() shal_walk12 = [$walk1, shal_walk1] { ai_walk (5); F () };
//--------------------------------------------------------------
// Shalrath Run functions
@@ -183,45 +229,48 @@ homing(float) : "Amount that the projectile should home in target. 1 is default,
void() shal_run1 = [$walk2, shal_run2]
{
if (random() < 0.2)
- sound_idle (self, CHAN_VOICE, "shalrath/idle.wav",
+ sound (self, CHAN_VOICE, "shalrath/idle.wav",
VOL_HIGH, ATTN_IDLE);
ai_run (6);
+ F ()
};
- void() shal_run2 = [$walk3, shal_run3] { ai_run (4); };
- void() shal_run3 = [$walk4, shal_run4] { ai_run (0); };
- void() shal_run4 = [$walk5, shal_run5] { ai_run (0); };
- void() shal_run5 = [$walk6, shal_run6] { ai_run (0); };
- void() shal_run6 = [$walk7, shal_run7] { ai_run (0); };
- void() shal_run7 = [$walk8, shal_run8] { ai_run (5); };
- void() shal_run8 = [$walk9, shal_run9] { ai_run (6); };
- void() shal_run9 = [$walk10, shal_run10] { ai_run (5); };
- void() shal_run10 = [$walk11, shal_run11] { ai_run (0); };
- void() shal_run11 = [$walk12, shal_run12] { ai_run (4); };
- void() shal_run12 = [$walk1, shal_run1] { ai_run (5); };
+ void() shal_run2 = [$walk3, shal_run3] { ai_run (4); F () };
+ void() shal_run3 = [$walk4, shal_run4] { ai_run (0); F () };
+ void() shal_run4 = [$walk5, shal_run5] { ai_run (0); F () };
+ void() shal_run5 = [$walk6, shal_run6] { ai_run (0); F () };
+ void() shal_run6 = [$walk7, shal_run7] { ai_run (0); F () };
+ void() shal_run7 = [$walk8, shal_run8] { ai_run (5); F () };
+ void() shal_run8 = [$walk9, shal_run9] { ai_run (6); F () };
+ void() shal_run9 = [$walk10, shal_run10] { ai_run (5); F () };
+ void() shal_run10 = [$walk11, shal_run11] { ai_run (0); F () };
+ void() shal_run11 = [$walk12, shal_run12] { ai_run (4); F () };
+ void() shal_run12 = [$walk1, shal_run1] { ai_run (5); F () };
//--------------------------------------------------------------
// Shalrath Attack functions
//--------------------------------------------------------------
void() shal_atk1 = [$attack1, shal_atk2]
{
- sound_attack (self, CHAN_VOICE, "shalrath/attack.wav",
+ sound (self, CHAN_VOICE, "shalrath/attack.wav",
VOL_HIGH, ATTN_NORM);
ai_face ();
+ F ()
};
- void() shal_atk2 = [$attack2, shal_atk3] { ai_face (); };
- void() shal_atk3 = [$attack3, shal_atk4] { ai_face (); };
- void() shal_atk4 = [$attack4, shal_atk5] { ai_face (); };
- void() shal_atk5 = [$attack5, shal_atk6] { ai_face (); };
- void() shal_atk6 = [$attack6, shal_atk7] { ai_face (); };
- void() shal_atk7 = [$attack7, shal_atk8] { ai_face (); };
- void() shal_atk8 = [$attack8, shal_atk9] { ai_face (); };
+ void() shal_atk2 = [$attack2, shal_atk3] { ai_face (); F () };
+ void() shal_atk3 = [$attack3, shal_atk4] { ai_face (); F () };
+ void() shal_atk4 = [$attack4, shal_atk5] { ai_face (); F () };
+ void() shal_atk5 = [$attack5, shal_atk6] { ai_face (); F () };
+ void() shal_atk6 = [$attack6, shal_atk7] { ai_face (); F () };
+ void() shal_atk7 = [$attack7, shal_atk8] { ai_face (); F () };
+ void() shal_atk8 = [$attack8, shal_atk9] { ai_face (); F () };
void() shal_atk9 = [$attack9, shal_atk10]
{
base_monster_fire_voreball (self.origin + '0 0 10',
(self.enemy.origin + '0 0 10') - self.origin);
+ F ()
};
- void() shal_atk10 = [$attack10, shal_atk11] { ai_face (); };
- void() shal_atk11 = [$attack11, shal_run1] { };
+ void() shal_atk10 = [$attack10, shal_atk11] { ai_face (); F () };
+ void() shal_atk11 = [$attack11, shal_run1] { F () };
////////////////////////////////////////
/// new frames for turret mode START ///
@@ -232,34 +281,44 @@ homing(float) : "Amount that the projectile should home in target. 1 is default,
//--------------------------------------------------------------
void() shal_tur_atk1 = [$attack1, shal_tur_atk2]
{
- sound_attack (self, CHAN_VOICE, "shalrath/attack.wav",
+ sound (self, CHAN_VOICE, "shalrath/attack.wav",
VOL_HIGH, ATTN_NORM);
ai_face ();
+ F ()
};
- void() shal_tur_atk2 = [$attack2, shal_tur_atk3] { ai_face (); };
- void() shal_tur_atk3 = [$attack3, shal_tur_atk4] { ai_face (); };
- void() shal_tur_atk4 = [$attack4, shal_tur_atk5] { ai_face (); };
- void() shal_tur_atk5 = [$attack5, shal_tur_atk6] { ai_face (); };
- void() shal_tur_atk6 = [$attack6, shal_tur_atk7] { ai_face (); };
- void() shal_tur_atk7 = [$attack7, shal_tur_atk8] { ai_face (); };
- void() shal_tur_atk8 = [$attack8, shal_tur_atk9] { ai_face (); };
+ void() shal_tur_atk2 = [$attack2, shal_tur_atk3] { ai_face (); F () };
+ void() shal_tur_atk3 = [$attack3, shal_tur_atk4] { ai_face (); F () };
+ void() shal_tur_atk4 = [$attack4, shal_tur_atk5] { ai_face (); F () };
+ void() shal_tur_atk5 = [$attack5, shal_tur_atk6] { ai_face (); F () };
+ void() shal_tur_atk6 = [$attack6, shal_tur_atk7] { ai_face (); F () };
+ void() shal_tur_atk7 = [$attack7, shal_tur_atk8] { ai_face (); F () };
+ void() shal_tur_atk8 = [$attack8, shal_tur_atk9] { ai_face (); F () };
void() shal_tur_atk9 = [$attack9, shal_tur_atk10]
{
base_monster_fire_voreball (self.origin + '0 0 10',
(self.enemy.origin + '0 0 10') - self.origin);
+ F ()
};
- void() shal_tur_atk10 = [$attack10, shal_tur_atk11] { ai_face (); };
- void() shal_tur_atk11 = [$attack11, shal_tur_atk12] { ai_face (); };
- void() shal_tur_atk12 = [$walk1, shal_tur_atk13] { ai_face (); };
- void() shal_tur_atk13 = [$walk1, shal_tur_atk14] { ai_face (); };
- void() shal_tur_atk14 = [$walk1, shal_tur_atk15] { ai_face (); };
- void() shal_tur_atk15 = [$walk1, shal_seek_stand1] { ai_run (0); };
+ void() shal_tur_atk10 = [$attack10, shal_tur_atk11] { ai_face (); F ()};
+ void() shal_tur_atk11 = [$attack11, shal_tur_atk12] { ai_face (); F ()};
+ void() shal_tur_atk12 = [$walk1, shal_tur_atk13] { ai_face (); F () };
+ void() shal_tur_atk13 = [$walk1, shal_tur_atk14] { ai_face (); F () };
+ void() shal_tur_atk14 = [$walk1, shal_tur_atk15] { ai_face (); F () };
+ void() shal_tur_atk15 = [$walk1, shal_seek_stand1] { ai_run (0); F () };
//--------------------------------------------------------------
// Shalrath Turret Standing/Seeeking
//--------------------------------------------------------------
- void() shal_seek_stand1 = [$walk1, shal_seek_stand2] { ai_run (0); };
- void() shal_seek_stand2 = [$walk1, shal_seek_stand1] { ai_run (0); };
+ void() shal_seek_stand1 = [$walk1, shal_seek_stand2]
+ {
+ ai_run (0);
+ F ()
+ };
+ void() shal_seek_stand2 = [$walk1, shal_seek_stand1]
+ {
+ ai_run (0);
+ F ()
+ };
////////////////////////////////////////
/// new frames for turret mode END ///
@@ -268,11 +327,11 @@ homing(float) : "Amount that the projectile should home in target. 1 is default,
//--------------------------------------------------------------
// Shalrath Pain State
//--------------------------------------------------------------
- void() shal_pain1 = [$pain1, shal_pain2] { };
- void() shal_pain2 = [$pain2, shal_pain3] { };
- void() shal_pain3 = [$pain3, shal_pain4] { };
- void() shal_pain4 = [$pain4, shal_pain5] { };
- void() shal_pain5 = [$pain5, shal_run1] { };
+ void() shal_pain1 = [$pain1, shal_pain2] { F () };
+ void() shal_pain2 = [$pain2, shal_pain3] { F () };
+ void() shal_pain3 = [$pain3, shal_pain4] { F () };
+ void() shal_pain4 = [$pain4, shal_pain5] { F () };
+ void() shal_pain5 = [$pain5, shal_run1] { F () };
//--------------------------------------------------------------
// Shalrath Death State
@@ -280,17 +339,29 @@ homing(float) : "Amount that the projectile should home in target. 1 is default,
void() shal_death1 = [$death1, shal_death2]
{
base_entity_aligntoground (self);
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME |
+ NETFLAG_BASE_ENTITY_ANGLES;
};
- void() shal_death2 = [$death2, shal_death3] { };
- void() shal_death3 = [$death3, shal_death4] { };
- void() shal_death4 = [$death4, shal_death5] { };
- void() shal_death5 = [$death5, shal_death6] { };
+ void() shal_death2 = [$death2, shal_death3] { F () };
+ void() shal_death3 = [$death3, shal_death4] { F () };
+ void() shal_death4 = [$death4, shal_death5] { F () };
+ void() shal_death5 = [$death5, shal_death6] { F () };
void() shal_death6 = [$death6, shal_death7]
{
become_base_corpse (self, SHALRATH_HEALTH_CORPSE);
setsize (self, SHALRATH_CORPSE_Z_MINS, SHALRATH_CORPSE_Z_MAXS);
+ F ()
+ };
+ void() shal_death7 = [$death7, shal_death7]
+ {
+ if (self.origin != self.origin_net)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_FRAME;
+ else if (self.frame_net != self.frame)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
};
- void() shal_death7 = [$death7, shal_death7] { };
+
+ #undef F
//==============================================================
// Interaction
@@ -305,11 +376,11 @@ homing(float) : "Amount that the projectile should home in target. 1 is default,
return;
// CHAN_AUTO was voice - dumptruck_ds
- sound_pain (self, CHAN_AUTO, "shalrath/pain.wav",
+ sound (self, CHAN_AUTO, "shalrath/pain.wav",
VOL_HIGH, ATTN_NORM);
self.pain_finished = time + 3;
- if (self.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_TURRET)
return;
else
shal_pain1 ();
@@ -320,37 +391,27 @@ homing(float) : "Amount that the projectile should home in target. 1 is default,
//--------------------------------------------------------------
void(vector dir) monster_shalrath_destroy =
{
- // check if we're dead already
- if (self.classgroup & CG_CORPSE)
- {
- sound (self, CHAN_VOICE, "player/udeath.wav",
- VOL_HIGH, ATTN_NORM);
-
- throw_gib_head_shalrath (self, dir, self.health);
- throw_gib_1 (self, dir, self.health);
- throw_gib_2 (self, dir, self.health);
- throw_gib_3 (self, dir, self.health);
-
- return;
- }
-
// check for gib
- if (self.health < -90)
+ if (self.classgroup & CG_CORPSE || self.health < -90)
{
sound (self, CHAN_VOICE, "player/udeath.wav",
VOL_HIGH, ATTN_NORM);
- throw_gib_head_shalrath (self, dir, self.health);
- throw_gib_1 (self, dir, self.health);
- throw_gib_2 (self, dir, self.health);
- throw_gib_3 (self, dir, self.health);
+ if (!(self.classgroup & CG_CORPSE))
+ base_item_drop_stuff (self);
+
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib1_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib2_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib3_init)
+ BASE_ITEM_GIB_THROW (dir, self.health,
+ item_head_shalrath_init)
- base_item_drop_stuff (self);
+ base_entity_remove (self);
return;
}
// insert death sounds here
- sound_death (self, CHAN_VOICE, "shalrath/death.wav",
+ sound (self, CHAN_VOICE, "shalrath/death.wav",
VOL_HIGH, ATTN_NORM);
self.solid = SOLID_NOT;
base_item_drop_stuff (self);
@@ -362,47 +423,58 @@ homing(float) : "Amount that the projectile should home in target. 1 is default,
//==============================================================
//--------------------------------------------------------------
- entity(vector org, vector ang, float sflags, float yaw, float angry)
+ entity(vector org, vector ang, float sflags, float yaw)
spawn_monster_shalrath =
{
- return spawn_base_monster (org, ang, sflags, yaw, angry,
+ return spawn_base_monster (org, ang, sflags, yaw,
monster_shalrath_init);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) monster_shalrath_init =
{
+ #ifdef SSQC
if (deathmatch)
{
remove (e);
return;
}
+ #endif
e.classname = "monster_shalrath";
e.classtype = CT_MONSTER_VORE;
+ e.pos1 = SHALRATH_MINS;
+ e.pos2 = SHALRATH_MAXS;
- // dumptruck_ds custom_mdls
- precache_body_model2 (e, "progs/shalrath.mdl");
- precache_head_model2 (e, "progs/h_shal.mdl");
- precache_proj_model2 (e, "progs/v_spike.mdl");
- // dumptruck_ds
- precache_sound2_attack (e, "shalrath/attack.wav");
- precache_sound2_misc (e, "shalrath/attack2.wav");
- precache_sound2_death (e, "shalrath/death.wav");
- precache_sound2_idle (e, "shalrath/idle.wav");
- precache_sound2_pain (e, "shalrath/pain.wav");
- precache_sound2_sight (e, "shalrath/sight.wav");
-
- precache_gib1 (e, "progs/gib1.mdl");
- precache_gib2 (e, "progs/gib2.mdl");
- precache_gib3 (e, "progs/gib3.mdl");
-
- e.solid = SOLID_SLIDEBOX;
- e.movetype = MOVETYPE_STEP;
-
- body_model (e, "progs/shalrath.mdl");
- // setmodel (e, "progs/shalrath.mdl");
- setsize (e, VEC_HULL2_MIN, VEC_HULL2_MAX);
+ #ifdef CSQC
+ if (e.modelindex)
+ {
+ setmodelindex (e, e.modelindex);
+ setsize (e, SHALRATH_MINS, SHALRATH_MAXS);
+ }
+ #endif
+
+ #ifdef SSQC
+ precache_model2 ("progs/shalrath.mdl");
+ precache_model2 ("progs/h_shal.mdl");
+ precache_model2 ("progs/v_spike.mdl");
+ precache_sound2 ("shalrath/attack.wav");
+ precache_sound2 ("shalrath/attack2.wav");
+ precache_sound2 ("shalrath/death.wav");
+ precache_sound2 ("shalrath/idle.wav");
+ precache_sound2 ("shalrath/pain.wav");
+ precache_sound2 ("shalrath/sight.wav");
+
+ precache_model ("progs/gib1.mdl");
+ precache_model ("progs/gib2.mdl");
+ precache_model ("progs/gib3.mdl");
+
+ // set up model and size for later -- CEV
+ e.mdl = "progs/shalrath.mdl";
+
+ e.destroy = monster_shalrath_destroy;
if (!e.health)
// thanks RennyC -- dumptruck_ds
@@ -420,96 +492,43 @@ homing(float) : "Amount that the projectile should home in target. 1 is default,
e.th_stand = shal_stand1;
e.th_walk = shal_walk1;
- if (e.spawnflags & I_AM_TURRET)
+ if (e.spawnflags & SPAWNFLAG_MONSTER_TURRET)
e.th_run = shal_seek_stand1;
else
e.th_run = shal_run1;
- e.destroy = monster_shalrath_destroy;
-
- // Berserk test from
- // http://celephais.net/board/view_thread.php?id=4&start=3465
- // -- dumptruck_ds
- if !(e.berserk)
- e.th_pain = monster_shalrath_pain;
- else
- e.th_pain = sub_nullpain;
e.th_missile = shal_atk1;
e.th_turret = shal_tur_atk1;
- // walkmonster_start
- base_walkmonster_init (e);
+ // changed berserk test from field to flag -- CEV
+ if (self.spawnflags & SPAWNFLAG_MONSTER_BERSERK)
+ e.th_pain = sub_nullpain;
+ else
+ e.th_pain = monster_shalrath_pain;
+ #endif
+
+ // InitMonster -- runs on both client & server -- CEV
+ base_monster_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() monster_shalrath =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags & fields, inhibit if necessary -- CEV
+ BASE_MONSTER_PREINIT (base_monster_init_field)
monster_shalrath_init (self);
};
+#endif
// };
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-/*QUAKED gib_head_shalrath (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/h_shal.mdl");
-}*/
-//----------------------------------------------------------------------
-// class gib_head_shalrath: base_gib_head
-// {
- //--------------------------------------------------------------
- // ThrowHead
- //--------------------------------------------------------------
- void(entity act, vector dir, float dmg) throw_gib_head_shalrath =
- {
- base_gib_head_throw (act, dir, dmg, gib_head_shalrath_init);
- };
-
- //--------------------------------------------------------------
- void(entity e) gib_head_shalrath_init =
- {
- e.classname = "gib_head_shalrath";
- e.classtype = CT_GORE_HEAD_SHALRATH;
-
- // gib_init interprets spawnflags and will set .solid -- CEV
- base_gib_head_init (e);
-
- if (e.mdl_head != "")
- {
- precache_model (e.mdl_head);
- setmodel (e, e.mdl_head);
- }
- else
- {
- precache_model ("progs/h_shal.mdl");
- setmodel (e, "progs/h_shal.mdl");
- if (e.solid == SOLID_BBOX)
- setsize (e, SHALRATH_HEAD_MINS,
- SHALRATH_HEAD_MAXS);
- else if (e.solid == SOLID_TRIGGER)
- setsize (e, '-16 -16 0', '16 16 56');
- }
-
- e.frame = 0;
- };
-
- //--------------------------------------------------------------
- void() gib_head_shalrath =
- {
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- gib_head_shalrath_init (self);
- };
-// };
-
+#ifdef SSQC
/*QUAKED monster_dead_shalrath (0 0.5 0.8) (-32 -32 -24) (32 32 64) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ({"path":"progs/shalrath.mdl","frame":22});
@@ -542,3 +561,8 @@ model ("progs/h_shal.mdl");
monster_dead_shalrath_init (self);
};
// };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+$flush
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/monsters/shambler.qc
diff --git a/qc/monsters/shambler.qc b/qc/monsters/shambler.qc
index 79c2521..541ca8a 100644
--- a/qc/monsters/shambler.qc
+++ b/qc/monsters/shambler.qc
@@ -6,27 +6,37 @@
// constants
//======================================================================
+#ifdef SSQC
const float SHAMBLER_HEALTH = 600; // id1 600
const float SHAMBLER_HEALTH_CORPSE = 100;
+#endif
-const vector SHAMBLER_HEAD_MINS = '-15.15 -20.638 -0.45';
-const vector SHAMBLER_HEAD_MAXS = '21.44 21.76 30';
+#if defined(CSQC) || defined(SSQC)
+const vector SHAMBLER_MINS = VEC_HULL2_MIN;
+const vector SHAMBLER_MAXS = VEC_HULL2_MAX;
const vector SHAMBLER_CORPSE_MINS = '-77.09 -72.17 -51.52';
const vector SHAMBLER_CORPSE_MAXS = '47.44 98.15 30';
const vector SHAMBLER_CORPSE_Z_MINS = '-20 -20 -24';
const vector SHAMBLER_CORPSE_Z_MAXS = '20 20 -8';
+#endif
//======================================================================
// forward declarations
//======================================================================
+#ifdef SSQC
// temp_shambler_field
void() temp_shambler_field_think;
entity(entity src, vector org) spawn_temp_shambler_field;
void(entity e) temp_shambler_field_init;
strip void() temp_shambler_field;
+#endif
// monster_shambler
+#ifdef CSQC
+void(float isnew) monster_shambler_netreceive;
+#endif
+#ifdef SSQC
void() monster_shambler_sightsound; // AI & attacks
float() monster_shambler_checkattack;
void(float side) monster_shambler_attack_claw;
@@ -34,6 +44,7 @@ void() monster_shambler_attack_lightning;
void() monster_shambler_attack_lavaball;
void() monster_shambler_attack_melee2;
void() monster_shambler_attack_melee; // animation & think states below
+// F() // macro to set FRAME netflag -- CEV
void() sham_stand1; void() sham_stand2; void() sham_stand3; void() sham_stand4;
void() sham_stand5; void() sham_stand6; void() sham_stand7; void() sham_stand8;
void() sham_stand9; void() sham_stand10; void() sham_stand11;
@@ -82,24 +93,27 @@ void() sham_death5; void() sham_death6; void() sham_death7; void() sham_death8;
void() sham_death9; void() sham_death10; void() sham_death11;
void(entity attacker, float damage) monster_shambler_pain; // interaction
void(vector dir) monster_shambler_destroy;
-entity(vector org, vector ang, float sflags, float yaw, float angry)
+entity(vector org, vector ang, float sflags, float yaw)
spawn_monster_shambler; // initialization
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) monster_shambler_init;
+#endif
+#ifdef SSQC
void() monster_shambler;
+#endif
-// gib_head_shambler
-void(entity act, vector dir, float dmg) throw_gib_head_shambler;
-void(entity e) gib_head_shambler_init;
-void() gib_head_shambler;
-
+#ifdef SSQC
// monster_dead_shambler
void(entity e) monster_dead_shambler_init;
void() monster_dead_shambler;
+#endif
//======================================================================
// frame macros
//======================================================================
+#if defined(CSQC) || defined(SSQC)
$cd id1/models/shams
$origin 0 0 24
$base base
@@ -130,8 +144,13 @@ $frame pain1 pain2 pain3 pain4 pain5 pain6
$frame death1 death2 death3 death4 death5 death6
$frame death7 death8 death9 death10 death11
+// MG1 compat -- CEV
+const float CORPSEFRAME_SHAMBLER_1 = $death11;
+#endif
+
//------------------------------------------------------------------------------
+#ifdef SSQC
//----------------------------------------------------------------------
// shambler trigger field
//----------------------------------------------------------------------
@@ -176,6 +195,7 @@ $frame death7 death8 death9 death10 death11
temp_shambler_field_init (self);
};
// };
+#endif
/*QUAKED monster_shambler (1 0 0) (-32 -32 -24) (32 32 64) AMBUSH X X TRIGGER_SPAWNED X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
@@ -239,12 +259,46 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
*/
//----------------------------------------------------------------------
-// class monster_shambler: base_walkmonster
+// class monster_shambler: base_monster
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) monster_shambler_netreceive =
+ {
+ // creates the newframe and netflags variables -- CEV
+ BASE_MONSTER_NETRECEIVE (monster_shambler_init,
+ SHAMBLER_MINS, SHAMBLER_MAXS)
+
+ if (isnew)
+ base_entity_que_add (self, QUE_TYPE_ACTOR);
+
+ if (self.frame == $magic3)
+ self.effects |= EF_MUZZLEFLASH;
+ else if (self.frame == $magic4)
+ self.effects |= EF_MUZZLEFLASH;
+ else if (self.frame == $magic5)
+ self.effects |= EF_MUZZLEFLASH;
+ else if (self.frame == $magic6)
+ self.effects |= EF_MUZZLEFLASH;
+ else if (self.frame == $magic9)
+ self.effects |= EF_MUZZLEFLASH;
+ else if (self.frame == $magic10)
+ self.effects |= EF_MUZZLEFLASH;
+ else if (self.frame == $magic11)
+ self.effects |= EF_MUZZLEFLASH;
+ else if (self.frame >= $death3 && self.frame <= $death11)
+ {
+ if (self.solid != SOLID_NOT)
+ self.solid = SOLID_NOT;
+ }
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
void() monster_shambler_sightsound =
{
- sound_sight (self, CHAN_VOICE, "shambler/ssight.wav",
+ sound (self, CHAN_VOICE, "shambler/ssight.wav",
VOL_HIGH, ATTN_NORM);
};
@@ -268,7 +322,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
}
}
- if (self.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_TURRET)
{
self.attack_state = AS_MISSILE;
sub_attackfinished (2 + 2 * random());
@@ -291,7 +345,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
if (vlen(spot1 - spot2) > 600)
return FALSE;
- if (self.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_TURRET)
if (vlen(spot1 - spot2) > 900)
return FALSE;
@@ -303,7 +357,8 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
// sight line crossed contents
return FALSE;
- if ((self.spawnflags & I_AM_TURRET) && (trace_ent != targ))
+ if ((self.spawnflags & SPAWNFLAG_MONSTER_TURRET) &&
+ (trace_ent != targ))
{
// dprint("trace_ent...\n");
self.attack_state = AS_TURRET;
@@ -342,7 +397,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
ldmg = (random() + random() + random()) * 20;
t_damage2 (self.enemy, self, self, ldmg);
- sound_hit (self, CHAN_VOICE, "shambler/smack.wav",
+ sound (self, CHAN_VOICE, "shambler/smack.wav",
VOL_HIGH, ATTN_NORM);
if (side)
@@ -360,7 +415,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
{
local vector org, dir;
- self.effects = self.effects | EF_MUZZLEFLASH;
+ self.effects |= EF_MUZZLEFLASH;
ai_face ();
@@ -369,7 +424,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
dir = self.enemy.origin + '0 0 16' - org;
dir = normalize (dir);
- if (self.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_TURRET)
traceline (org, self.origin + dir * 900, TRUE, self);
else
traceline (org, self.origin + dir * 600, TRUE, self);
@@ -392,8 +447,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//--------------------------------------------------------------
void() monster_shambler_attack_lavaball =
{
- sound_attack (self, CHAN_AUTO, "boss1/throw.wav",
- VOL_HIGH, ATTN_NORM);
+ sound (self, CHAN_AUTO, "boss1/throw.wav", VOL_HIGH, ATTN_NORM);
// custom lavaball speed -- CEV
base_monster_fire_lavaball (
@@ -428,62 +482,73 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
};
//--------------------------------------------------------------
+ #define F() \
+ /* { */ \
+ if (!(self.SendFlags & NETFLAG_BASE_ENTITY_FRAME)) \
+ { \
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME; \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
// Shambler standing functions
//--------------------------------------------------------------
- void() sham_stand1 = [$stand1, sham_stand2] { ai_stand (); };
- void() sham_stand2 = [$stand2, sham_stand3] { ai_stand (); };
- void() sham_stand3 = [$stand3, sham_stand4] { ai_stand (); };
- void() sham_stand4 = [$stand4, sham_stand5] { ai_stand (); };
- void() sham_stand5 = [$stand5, sham_stand6] { ai_stand (); };
- void() sham_stand6 = [$stand6, sham_stand7] { ai_stand (); };
- void() sham_stand7 = [$stand7, sham_stand8] { ai_stand (); };
- void() sham_stand8 = [$stand8, sham_stand9] { ai_stand (); };
- void() sham_stand9 = [$stand9, sham_stand10] { ai_stand (); };
- void() sham_stand10 = [$stand10, sham_stand11] { ai_stand (); };
- void() sham_stand11 = [$stand11, sham_stand12] { ai_stand (); };
- void() sham_stand12 = [$stand12, sham_stand13] { ai_stand (); };
- void() sham_stand13 = [$stand13, sham_stand14] { ai_stand (); };
- void() sham_stand14 = [$stand14, sham_stand15] { ai_stand (); };
- void() sham_stand15 = [$stand15, sham_stand16] { ai_stand (); };
- void() sham_stand16 = [$stand16, sham_stand17] { ai_stand (); };
- void() sham_stand17 = [$stand17, sham_stand1] { ai_stand (); };
+ void() sham_stand1 = [$stand1, sham_stand2] { ai_stand (); F () };
+ void() sham_stand2 = [$stand2, sham_stand3] { ai_stand (); F () };
+ void() sham_stand3 = [$stand3, sham_stand4] { ai_stand (); F () };
+ void() sham_stand4 = [$stand4, sham_stand5] { ai_stand (); F () };
+ void() sham_stand5 = [$stand5, sham_stand6] { ai_stand (); F () };
+ void() sham_stand6 = [$stand6, sham_stand7] { ai_stand (); F () };
+ void() sham_stand7 = [$stand7, sham_stand8] { ai_stand (); F () };
+ void() sham_stand8 = [$stand8, sham_stand9] { ai_stand (); F () };
+ void() sham_stand9 = [$stand9, sham_stand10] { ai_stand (); F () };
+ void() sham_stand10 = [$stand10, sham_stand11] { ai_stand (); F () };
+ void() sham_stand11 = [$stand11, sham_stand12] { ai_stand (); F () };
+ void() sham_stand12 = [$stand12, sham_stand13] { ai_stand (); F () };
+ void() sham_stand13 = [$stand13, sham_stand14] { ai_stand (); F () };
+ void() sham_stand14 = [$stand14, sham_stand15] { ai_stand (); F () };
+ void() sham_stand15 = [$stand15, sham_stand16] { ai_stand (); F () };
+ void() sham_stand16 = [$stand16, sham_stand17] { ai_stand (); F () };
+ void() sham_stand17 = [$stand17, sham_stand1] { ai_stand (); F () };
//--------------------------------------------------------------
// Shambler walk functions
//--------------------------------------------------------------
- void() sham_walk1 = [$walk1, sham_walk2] { ai_walk (10); };
- void() sham_walk2 = [$walk2, sham_walk3] { ai_walk (9); };
- void() sham_walk3 = [$walk3, sham_walk4] { ai_walk (9); };
- void() sham_walk4 = [$walk4, sham_walk5] { ai_walk (5); };
- void() sham_walk5 = [$walk5, sham_walk6] { ai_walk (6); };
- void() sham_walk6 = [$walk6, sham_walk7] { ai_walk (12); };
- void() sham_walk7 = [$walk7, sham_walk8] { ai_walk (8); };
- void() sham_walk8 = [$walk8, sham_walk9] { ai_walk (3); };
- void() sham_walk9 = [$walk9, sham_walk10] { ai_walk (13); };
- void() sham_walk10 = [$walk10, sham_walk11] { ai_walk (9); };
- void() sham_walk11 = [$walk11, sham_walk12] { ai_walk (7); };
+ void() sham_walk1 = [$walk1, sham_walk2] { ai_walk (10); F () };
+ void() sham_walk2 = [$walk2, sham_walk3] { ai_walk (9); F () };
+ void() sham_walk3 = [$walk3, sham_walk4] { ai_walk (9); F () };
+ void() sham_walk4 = [$walk4, sham_walk5] { ai_walk (5); F () };
+ void() sham_walk5 = [$walk5, sham_walk6] { ai_walk (6); F () };
+ void() sham_walk6 = [$walk6, sham_walk7] { ai_walk (12); F () };
+ void() sham_walk7 = [$walk7, sham_walk8] { ai_walk (8); F () };
+ void() sham_walk8 = [$walk8, sham_walk9] { ai_walk (3); F () };
+ void() sham_walk9 = [$walk9, sham_walk10] { ai_walk (13); F () };
+ void() sham_walk10 = [$walk10, sham_walk11] { ai_walk (9); F () };
+ void() sham_walk11 = [$walk11, sham_walk12] { ai_walk (7); F () };
void() sham_walk12 = [$walk12, sham_walk1]
{
ai_walk (7);
if (random() > 0.8)
- sound_idle (self, CHAN_VOICE, "shambler/sidle.wav",
+ sound (self, CHAN_VOICE, "shambler/sidle.wav",
VOL_HIGH, ATTN_IDLE);
+ F ()
};
//--------------------------------------------------------------
// Shambler run functions
//--------------------------------------------------------------
- void() sham_run1 = [$run1, sham_run2] { ai_run (20); };
- void() sham_run2 = [$run2, sham_run3] { ai_run (24); };
- void() sham_run3 = [$run3, sham_run4] { ai_run (20); };
- void() sham_run4 = [$run4, sham_run5] { ai_run (20); };
- void() sham_run5 = [$run5, sham_run6] { ai_run (24); };
+ void() sham_run1 = [$run1, sham_run2] { ai_run (20); F () };
+ void() sham_run2 = [$run2, sham_run3] { ai_run (24); F () };
+ void() sham_run3 = [$run3, sham_run4] { ai_run (20); F () };
+ void() sham_run4 = [$run4, sham_run5] { ai_run (20); F () };
+ void() sham_run5 = [$run5, sham_run6] { ai_run (24); F () };
void() sham_run6 = [$run6, sham_run1]
{
ai_run (20);
if (random() > 0.8)
- sound_idle (self, CHAN_VOICE, "shambler/sidle.wav",
+ sound (self, CHAN_VOICE, "shambler/sidle.wav",
VOL_HIGH, ATTN_IDLE);
+ F ()
};
//--------------------------------------------------------------
@@ -491,18 +556,19 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//--------------------------------------------------------------
void() sham_smash1 = [$smash1, sham_smash2]
{
- sound_attack (self, CHAN_VOICE, "shambler/melee1.wav",
+ sound (self, CHAN_VOICE, "shambler/melee1.wav",
VOL_HIGH, ATTN_NORM);
ai_charge (2);
+ F ()
};
- void() sham_smash2 = [$smash2, sham_smash3] { ai_charge (6); };
- void() sham_smash3 = [$smash3, sham_smash4] { ai_charge (6); };
- void() sham_smash4 = [$smash4, sham_smash5] { ai_charge (5); };
- void() sham_smash5 = [$smash5, sham_smash6] { ai_charge (4); };
- void() sham_smash6 = [$smash6, sham_smash7] { ai_charge (1); };
- void() sham_smash7 = [$smash7, sham_smash8] { ai_charge (0); };
- void() sham_smash8 = [$smash8, sham_smash9] { ai_charge (0); };
- void() sham_smash9 = [$smash9, sham_smash10] { ai_charge (0); };
+ void() sham_smash2 = [$smash2, sham_smash3] { ai_charge (6); F () };
+ void() sham_smash3 = [$smash3, sham_smash4] { ai_charge (6); F () };
+ void() sham_smash4 = [$smash4, sham_smash5] { ai_charge (5); F () };
+ void() sham_smash5 = [$smash5, sham_smash6] { ai_charge (4); F () };
+ void() sham_smash6 = [$smash6, sham_smash7] { ai_charge (1); F () };
+ void() sham_smash7 = [$smash7, sham_smash8] { ai_charge (0); F () };
+ void() sham_smash8 = [$smash8, sham_smash9] { ai_charge (0); F () };
+ void() sham_smash9 = [$smash9, sham_smash10] { ai_charge (0); F () };
void() sham_smash10 = [$smash10, sham_smash11]
{
local vector delta;
@@ -521,16 +587,17 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
ldmg = (random() + random() + random()) * 40;
t_damage2 (self.enemy, self, self, ldmg);
- sound_hit (self, CHAN_VOICE, "shambler/smack.wav",
+ sound (self, CHAN_VOICE, "shambler/smack.wav",
VOL_HIGH, ATTN_NORM);
spawn_meatspray (self.origin + v_forward * 16,
crandom() * 100 * v_right);
spawn_meatspray (self.origin + v_forward * 16,
crandom() * 100 * v_right);
+ F ()
};
- void() sham_smash11 = [$smash11, sham_smash12] { ai_charge (5); };
- void() sham_smash12 = [$smash12, sham_run1] { ai_charge (4); };
+ void() sham_smash11 = [$smash11, sham_smash12] { ai_charge (5); F () };
+ void() sham_smash12 = [$smash12, sham_run1] { ai_charge (4); F () };
/////////////////////////////////////
// new frames for projectile style //
@@ -539,46 +606,52 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//--------------------------------------------------------------
// Shambler Projectile
//--------------------------------------------------------------
- void() sham_proj1 = [$smash1, sham_proj2] { ai_face (); };
- void() sham_proj2 = [$smash2, sham_proj3] { ai_face (); };
- void() sham_proj3 = [$smash3, sham_proj4] { ai_face (); };
- void() sham_proj4 = [$smash4, sham_proj5] { ai_face (); };
- void() sham_proj5 = [$smash5, sham_proj6] { ai_face (); };
- void() sham_proj6 = [$smash6, sham_proj7] { ai_face (); };
- void() sham_proj7 = [$smash7, sham_proj8] { ai_face (); };
- void() sham_proj8 = [$smash8, sham_proj9] { ai_face (); };
- void() sham_proj9 = [$smash9, sham_proj10] { ai_face (); };
+ void() sham_proj1 = [$smash1, sham_proj2] { ai_face (); F () };
+ void() sham_proj2 = [$smash2, sham_proj3] { ai_face (); F () };
+ void() sham_proj3 = [$smash3, sham_proj4] { ai_face (); F () };
+ void() sham_proj4 = [$smash4, sham_proj5] { ai_face (); F () };
+ void() sham_proj5 = [$smash5, sham_proj6] { ai_face (); F () };
+ void() sham_proj6 = [$smash6, sham_proj7] { ai_face (); F () };
+ void() sham_proj7 = [$smash7, sham_proj8] { ai_face (); F () };
+ void() sham_proj8 = [$smash8, sham_proj9] { ai_face (); F () };
+ void() sham_proj9 = [$smash9, sham_proj10] { ai_face (); F () };
void() sham_proj10 = [$smash10, sham_proj11]
{
monster_shambler_attack_lavaball ();
- sound_attack (self, CHAN_VOICE, "shambler/melee1.wav",
+ sound (self, CHAN_VOICE, "shambler/melee1.wav",
VOL_HIGH, ATTN_NORM);
ai_face ();
+ F ()
};
- void() sham_proj11 = [$smash11, sham_proj12] { ai_face (); };
- void() sham_proj12 = [$smash12, sham_run1] { ai_face (); };
+ void() sham_proj11 = [$smash11, sham_proj12] { ai_face (); F () };
+ void() sham_proj12 = [$smash12, sham_run1] { ai_face (); F () };
//--------------------------------------------------------------
// Shambler Projectile (Turret Mode)
//--------------------------------------------------------------
- void() sham_tur_proj1 = [$smash1, sham_tur_proj2] { ai_face (); };
- void() sham_tur_proj2 = [$smash2, sham_tur_proj3] { ai_face (); };
- void() sham_tur_proj3 = [$smash3, sham_tur_proj4] { ai_face (); };
- void() sham_tur_proj4 = [$smash4, sham_tur_proj5] { ai_face (); };
- void() sham_tur_proj5 = [$smash5, sham_tur_proj6] { ai_face (); };
- void() sham_tur_proj6 = [$smash6, sham_tur_proj7] { ai_face (); };
- void() sham_tur_proj7 = [$smash7, sham_tur_proj8] { ai_face (); };
- void() sham_tur_proj8 = [$smash8, sham_tur_proj9] { ai_face (); };
- void() sham_tur_proj9 = [$smash9, sham_tur_proj10] { ai_face (); };
+ void() sham_tur_proj1 = [$smash1, sham_tur_proj2] { ai_face (); F () };
+ void() sham_tur_proj2 = [$smash2, sham_tur_proj3] { ai_face (); F () };
+ void() sham_tur_proj3 = [$smash3, sham_tur_proj4] { ai_face (); F () };
+ void() sham_tur_proj4 = [$smash4, sham_tur_proj5] { ai_face (); F () };
+ void() sham_tur_proj5 = [$smash5, sham_tur_proj6] { ai_face (); F () };
+ void() sham_tur_proj6 = [$smash6, sham_tur_proj7] { ai_face (); F () };
+ void() sham_tur_proj7 = [$smash7, sham_tur_proj8] { ai_face (); F () };
+ void() sham_tur_proj8 = [$smash8, sham_tur_proj9] { ai_face (); F () };
+ void() sham_tur_proj9 = [$smash9, sham_tur_proj10] { ai_face (); F () };
void() sham_tur_proj10 = [$smash10, sham_tur_proj11]
{
monster_shambler_attack_lavaball ();
- sound_attack (self, CHAN_VOICE, "shambler/melee1.wav",
+ sound (self, CHAN_VOICE, "shambler/melee1.wav",
VOL_HIGH, ATTN_NORM);
ai_face();
+ F ()
+ };
+ void() sham_tur_proj11 = [$smash11, sham_tur_proj12]
+ {
+ ai_face ();
+ F ()
};
- void() sham_tur_proj11 = [$smash11, sham_tur_proj12] { ai_face (); };
- void() sham_tur_proj12 = [$smash12, sham_seek_1] { ai_face (); };
+ void() sham_tur_proj12 = [$smash12, sham_seek_1] { ai_face (); F () };
/////////////////////////////////////
// end projectile style frames //
@@ -589,26 +662,29 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//--------------------------------------------------------------
void() sham_swingl1 = [$swingl1, sham_swingl2]
{
- sound_misc (self, CHAN_VOICE, "shambler/melee2.wav",
+ sound (self, CHAN_VOICE, "shambler/melee2.wav",
VOL_HIGH, ATTN_NORM);
ai_charge (5);
+ F ()
};
- void() sham_swingl2 = [$swingl2, sham_swingl3] { ai_charge (3); };
- void() sham_swingl3 = [$swingl3, sham_swingl4] { ai_charge (7); };
- void() sham_swingl4 = [$swingl4, sham_swingl5] { ai_charge (3); };
- void() sham_swingl5 = [$swingl5, sham_swingl6] { ai_charge (7); };
- void() sham_swingl6 = [$swingl6, sham_swingl7] { ai_charge (9); };
+ void() sham_swingl2 = [$swingl2, sham_swingl3] { ai_charge (3); F () };
+ void() sham_swingl3 = [$swingl3, sham_swingl4] { ai_charge (7); F () };
+ void() sham_swingl4 = [$swingl4, sham_swingl5] { ai_charge (3); F () };
+ void() sham_swingl5 = [$swingl5, sham_swingl6] { ai_charge (7); F () };
+ void() sham_swingl6 = [$swingl6, sham_swingl7] { ai_charge (9); F () };
void() sham_swingl7 = [$swingl7, sham_swingl8]
{
ai_charge (5);
monster_shambler_attack_claw (250);
+ F ()
};
- void() sham_swingl8 = [$swingl8, sham_swingl9] { ai_charge (4); };
+ void() sham_swingl8 = [$swingl8, sham_swingl9] { ai_charge (4); F () };
void() sham_swingl9 = [$swingl9, sham_run1]
{
ai_charge (8);
if (random() < 0.5)
self.think = sham_swingr1;
+ F ()
};
//--------------------------------------------------------------
@@ -616,27 +692,30 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//--------------------------------------------------------------
void() sham_swingr1 = [$swingr1, sham_swingr2]
{
- sound_attack (self, CHAN_VOICE, "shambler/melee1.wav",
+ sound (self, CHAN_VOICE, "shambler/melee1.wav",
VOL_HIGH, ATTN_NORM);
ai_charge (1);
+ F ()
};
- void() sham_swingr2 = [$swingr2, sham_swingr3] { ai_charge (8); };
- void() sham_swingr3 = [$swingr3, sham_swingr4] { ai_charge (14); };
- void() sham_swingr4 = [$swingr4, sham_swingr5] { ai_charge (7); };
- void() sham_swingr5 = [$swingr5, sham_swingr6] { ai_charge (3); };
- void() sham_swingr6 = [$swingr6, sham_swingr7] { ai_charge (6); };
+ void() sham_swingr2 = [$swingr2, sham_swingr3] { ai_charge (8); F () };
+ void() sham_swingr3 = [$swingr3, sham_swingr4] { ai_charge (14); F () };
+ void() sham_swingr4 = [$swingr4, sham_swingr5] { ai_charge (7); F () };
+ void() sham_swingr5 = [$swingr5, sham_swingr6] { ai_charge (3); F () };
+ void() sham_swingr6 = [$swingr6, sham_swingr7] { ai_charge (6); F () };
void() sham_swingr7 = [$swingr7, sham_swingr8]
{
ai_charge (6);
monster_shambler_attack_claw (-250);
+ F ()
};
- void() sham_swingr8 = [$swingr8, sham_swingr9] { ai_charge (3); };
+ void() sham_swingr8 = [$swingr8, sham_swingr9] { ai_charge (3); F () };
void() sham_swingr9 = [$swingr9, sham_run1]
{
ai_charge (1);
ai_charge (10);
if (random() < 0.5)
self.think = sham_swingl1;
+ F ()
};
//--------------------------------------------------------------
@@ -645,50 +724,58 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() sham_magic1 = [$magic1, sham_magic2]
{
ai_face ();
- sound_misc1 (self, CHAN_WEAPON, "shambler/sattck1.wav",
+ sound (self, CHAN_WEAPON, "shambler/sattck1.wav",
VOL_HIGH, ATTN_NORM);
+ F ()
};
- void() sham_magic2 = [$magic2, sham_magic3] { ai_face (); };
+ void() sham_magic2 = [$magic2, sham_magic3] { ai_face (); F () };
void() sham_magic3 = [$magic3, sham_magic4]
{
ai_face ();
self.nextthink = time + 0.2;
self.trigger_field = spawn_temp_shambler_field (
self, self.origin);
+ F ()
};
void() sham_magic4 = [$magic4, sham_magic5]
{
self.effects = self.effects | EF_MUZZLEFLASH;
self.trigger_field.frame = 1;
+ F ()
};
void() sham_magic5 = [$magic5, sham_magic6]
{
self.effects = self.effects | EF_MUZZLEFLASH;
self.trigger_field.frame = 2;
+ F ()
};
void() sham_magic6 = [$magic6, sham_magic9]
{
remove (self.trigger_field);
self.trigger_field = world;
monster_shambler_attack_lightning ();
- sound_misc2 (self, CHAN_WEAPON, "shambler/sboom.wav",
+ sound (self, CHAN_WEAPON, "shambler/sboom.wav",
VOL_HIGH, ATTN_NORM);
+ F ()
};
// TODO CEV why are frames $magic8 and $magic9 not used?
void() sham_magic9 = [$magic9, sham_magic10]
{
monster_shambler_attack_lightning ();
+ F ()
};
void() sham_magic10 = [$magic10, sham_magic11]
{
monster_shambler_attack_lightning ();
+ F ()
};
void() sham_magic11 = [$magic11, sham_magic12]
{
if (skill == 3)
monster_shambler_attack_lightning ();
+ F ()
};
- void() sham_magic12 = [$magic12, sham_run1] { };
+ void() sham_magic12 = [$magic12, sham_run1] { F () };
/////////////////////////
//// turret start ////
@@ -700,10 +787,11 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() sham_tur_magic1 = [$magic1, sham_tur_magic2]
{
ai_face ();
- sound_misc1 (self, CHAN_WEAPON, "shambler/sattck1.wav",
+ sound (self, CHAN_WEAPON, "shambler/sattck1.wav",
VOL_HIGH, ATTN_NORM);
+ F ()
};
- void() sham_tur_magic2 = [$magic2, sham_tur_magic3] { ai_face (); };
+ void() sham_tur_magic2 = [$magic2, sham_tur_magic3] { ai_face (); F ()};
void() sham_tur_magic3 = [$magic3, sham_tur_magic4]
{
ai_face ();
@@ -713,74 +801,84 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
ai_face ();
self.trigger_field = spawn_temp_shambler_field (
self, self.origin);
+ F ()
};
void() sham_tur_magic4 = [$magic4, sham_tur_magic5]
{
self.effects = self.effects | EF_MUZZLEFLASH;
self.trigger_field.frame = 1;
+ F ()
};
void() sham_tur_magic5 = [$magic5, sham_tur_magic6]
{
self.effects = self.effects | EF_MUZZLEFLASH;
self.trigger_field.frame = 2;
+ F ()
};
void() sham_tur_magic6 = [$magic6, sham_tur_magic9]
{
remove (self.trigger_field);
self.trigger_field = world;
monster_shambler_attack_lightning ();
- sound_misc2 (self, CHAN_WEAPON, "shambler/sboom.wav",
+ sound (self, CHAN_WEAPON, "shambler/sboom.wav",
VOL_HIGH, ATTN_NORM);
+ F ()
};
// TODO CEV again why are $magic7 and $magic8 not used?
void() sham_tur_magic9 = [$magic9, sham_tur_magic10]
{
monster_shambler_attack_lightning ();
+ F ()
};
void() sham_tur_magic10 = [$magic10, sham_tur_magic11]
{
monster_shambler_attack_lightning ();
+ F ()
};
void() sham_tur_magic11 = [$magic11, sham_tur_magic12]
{
if (skill == 3)
monster_shambler_attack_lightning ();
+ F ()
};
- void() sham_tur_magic12 = [$magic12, sham_tur_magic13] { };
+ void() sham_tur_magic12 = [$magic12, sham_tur_magic13] { F () };
void() sham_tur_magic13 = [$stand14, sham_tur_magic14]
{
ai_face ();
+ F ()
};
void() sham_tur_magic14 = [$stand15, sham_tur_magic15]
{
ai_face ();
+ F ()
};
void() sham_tur_magic15 = [$stand16, sham_tur_magic16]
{
ai_face ();
+ F ()
};
- void() sham_tur_magic16 = [$stand17, sham_seek_1] { };
+ void() sham_tur_magic16 = [$stand17, sham_seek_1] { F () };
//--------------------------------------------------------------
// Shambler Turret Seeking state (tracking target?)
//--------------------------------------------------------------
- void() sham_seek_1 = [$stand1, sham_seek_2] { ai_run (0); };
- void() sham_seek_2 = [$stand2, sham_seek_3] { ai_run (0); };
- void() sham_seek_3 = [$stand3, sham_seek_4] { ai_run (0); };
- void() sham_seek_4 = [$stand4, sham_seek_5] { ai_run (0); };
- void() sham_seek_5 = [$stand5, sham_seek_6] { ai_run (0); };
- void() sham_seek_6 = [$stand6, sham_seek_7] { ai_run (0); };
- void() sham_seek_7 = [$stand7, sham_seek_8] { ai_run (0); };
- void() sham_seek_8 = [$stand8, sham_seek_9] { ai_run (0); };
- void() sham_seek_9 = [$stand9, sham_seek_10] { ai_run (0); };
- void() sham_seek_10 = [$stand10, sham_seek_11] { ai_run (0); };
- void() sham_seek_11 = [$stand11, sham_seek_12] { ai_run (0); };
- void() sham_seek_12 = [$stand12, sham_seek_13] { ai_run (0); };
- void() sham_seek_13 = [$stand13, sham_seek_14] { ai_run (0); };
- void() sham_seek_14 = [$stand14, sham_seek_15] { ai_run (0); };
- void() sham_seek_15 = [$stand15, sham_seek_16] { ai_run (0); };
- void() sham_seek_16 = [$stand16, sham_seek_17] { ai_run (0); };
- void() sham_seek_17 = [$stand17, sham_seek_1] { ai_run (0); };
+ void() sham_seek_1 = [$stand1, sham_seek_2] { ai_run (0); F () };
+ void() sham_seek_2 = [$stand2, sham_seek_3] { ai_run (0); F () };
+ void() sham_seek_3 = [$stand3, sham_seek_4] { ai_run (0); F () };
+ void() sham_seek_4 = [$stand4, sham_seek_5] { ai_run (0); F () };
+ void() sham_seek_5 = [$stand5, sham_seek_6] { ai_run (0); F () };
+ void() sham_seek_6 = [$stand6, sham_seek_7] { ai_run (0); F () };
+ void() sham_seek_7 = [$stand7, sham_seek_8] { ai_run (0); F () };
+ void() sham_seek_8 = [$stand8, sham_seek_9] { ai_run (0); F () };
+ void() sham_seek_9 = [$stand9, sham_seek_10] { ai_run (0); F () };
+ void() sham_seek_10 = [$stand10, sham_seek_11] { ai_run (0); F () };
+ void() sham_seek_11 = [$stand11, sham_seek_12] { ai_run (0); F () };
+ void() sham_seek_12 = [$stand12, sham_seek_13] { ai_run (0); F () };
+ void() sham_seek_13 = [$stand13, sham_seek_14] { ai_run (0); F () };
+ void() sham_seek_14 = [$stand14, sham_seek_15] { ai_run (0); F () };
+ void() sham_seek_15 = [$stand15, sham_seek_16] { ai_run (0); F () };
+ void() sham_seek_16 = [$stand16, sham_seek_17] { ai_run (0); F () };
+ void() sham_seek_17 = [$stand17, sham_seek_1] { ai_run (0); F () };
/////////////////////////
//// turret end ////
@@ -789,12 +887,12 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//--------------------------------------------------------------
// Shambler Pain state
//--------------------------------------------------------------
- void() sham_pain1 = [$pain1, sham_pain2] { };
- void() sham_pain2 = [$pain2, sham_pain3] { };
- void() sham_pain3 = [$pain3, sham_pain4] { };
- void() sham_pain4 = [$pain4, sham_pain5] { };
- void() sham_pain5 = [$pain5, sham_pain6] { };
- void() sham_pain6 = [$pain6, sham_run1] { };
+ void() sham_pain1 = [$pain1, sham_pain2] { F () };
+ void() sham_pain2 = [$pain2, sham_pain3] { F () };
+ void() sham_pain3 = [$pain3, sham_pain4] { F () };
+ void() sham_pain4 = [$pain4, sham_pain5] { F () };
+ void() sham_pain5 = [$pain5, sham_pain6] { F () };
+ void() sham_pain6 = [$pain6, sham_run1] { F () };
//--------------------------------------------------------------
// Shambler Death state
@@ -802,43 +900,51 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() sham_death1 = [$death1, sham_death2]
{
base_entity_aligntoground (self);
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME |
+ NETFLAG_BASE_ENTITY_ANGLES;
+ };
+ void() sham_death2 = [$death2, sham_death3] { F () };
+ void() sham_death3 = [$death3, sham_death4]
+ {
+ self.solid = SOLID_NOT;
+ F ()
};
- void() sham_death2 = [$death2, sham_death3] { };
- void() sham_death3 = [$death3, sham_death4] { self.solid = SOLID_NOT; };
- void() sham_death4 = [$death4, sham_death5] { };
- void() sham_death5 = [$death5, sham_death6] { };
- void() sham_death6 = [$death6, sham_death7] { };
- void() sham_death7 = [$death7, sham_death8] { };
- void() sham_death8 = [$death8, sham_death9] { };
- void() sham_death9 = [$death9, sham_death10] { };
+ void() sham_death4 = [$death4, sham_death5] { F () };
+ void() sham_death5 = [$death5, sham_death6] { F () };
+ void() sham_death6 = [$death6, sham_death7] { F () };
+ void() sham_death7 = [$death7, sham_death8] { F () };
+ void() sham_death8 = [$death8, sham_death9] { F () };
+ void() sham_death9 = [$death9, sham_death10] { F () };
void() sham_death10 = [$death10, sham_death11]
{
become_base_corpse (self, SHAMBLER_HEALTH_CORPSE);
setsize (self, SHAMBLER_CORPSE_Z_MINS, SHAMBLER_CORPSE_Z_MAXS);
+ F ()
};
- void() sham_death11 = [$death11, sham_death11] { };
+ void() sham_death11 = [$death11, sham_death11]
+ {
+ if (self.origin != self.origin_net)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_FRAME;
+ else if (self.frame_net != self.frame)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
+ };
+
+ #undef F
//==============================================================
// Interaction
//==============================================================
//--------------------------------------------------------------
- entity(vector org, vector ang, float sflags, float yaw, float angry)
- spawn_monster_shambler =
- {
- return spawn_base_monster (org, ang, sflags, yaw, angry,
- monster_shambler_init);
- };
-
- //--------------------------------------------------------------
// sham_pain
//--------------------------------------------------------------
void(entity attacker, float damage) monster_shambler_pain =
{
- sound_pain (self, CHAN_VOICE, "shambler/shurt2.wav",
+ sound (self, CHAN_VOICE, "shambler/shurt2.wav",
VOL_HIGH, ATTN_NORM);
- if (self.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_TURRET)
return;
if (self.health <= 0)
@@ -868,37 +974,27 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//--------------------------------------------------------------
void(vector dir) monster_shambler_destroy =
{
- // check if we're dead already
- if (self.classgroup & CG_CORPSE)
- {
- sound (self, CHAN_VOICE, "player/udeath.wav",
- VOL_HIGH, ATTN_NORM);
-
- throw_gib_head_shambler (self, dir, self.health);
- throw_gib_1 (self, dir, self.health);
- throw_gib_2 (self, dir, self.health);
- throw_gib_3 (self, dir, self.health);
-
- return;
- }
-
// check for gib
- if (self.health < -60)
+ if (self.classgroup & CG_CORPSE || self.health < -60)
{
sound (self, CHAN_VOICE, "player/udeath.wav",
VOL_HIGH, ATTN_NORM);
- throw_gib_head_shambler (self, dir, self.health);
- throw_gib_1 (self, dir, self.health);
- throw_gib_2 (self, dir, self.health);
- throw_gib_3 (self, dir, self.health);
+ if (!(self.classgroup & CG_CORPSE))
+ base_item_drop_stuff (self);
+
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib1_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib2_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib3_init)
+ BASE_ITEM_GIB_THROW (dir, self.health,
+ item_head_shambler_init)
- base_item_drop_stuff (self);
+ base_entity_remove (self);
return;
}
// regular death
- sound_death (self, CHAN_VOICE, "shambler/sdeath.wav",
+ sound (self, CHAN_VOICE, "shambler/sdeath.wav",
VOL_HIGH, ATTN_NORM);
base_item_drop_stuff (self);
sham_death1 ();
@@ -909,49 +1005,64 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//==============================================================
//--------------------------------------------------------------
+ entity(vector org, vector ang, float sflags, float yaw)
+ spawn_monster_shambler =
+ {
+ return spawn_base_monster (org, ang, sflags, yaw,
+ monster_shambler_init);
+ };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+ //--------------------------------------------------------------
void(entity e) monster_shambler_init =
{
+ #ifdef SSQC
if (deathmatch)
{
remove (e);
return;
}
+ #endif
e.classname = "monster_shambler";
e.classtype = CT_MONSTER_SHAMBLER;
+ e.pos1 = SHAMBLER_MINS;
+ e.pos2 = SHAMBLER_MAXS;
+
+ #ifdef CSQC
+ if (e.modelindex)
+ {
+ setmodelindex (e, e.modelindex);
+ setsize (e, SHAMBLER_MINS, SHAMBLER_MAXS);
+ }
+ #endif
- // custom_mdls dumptruck_ds
- precache_body_model (e, "progs/shambler.mdl");
- // custom_mdls dumptruck_ds
- precache_head_model (e, "progs/h_shams.mdl");
- // precache_model ("progs/shambler.mdl");
+ #ifdef SSQC
+ precache_model ("progs/shambler.mdl");
+ precache_model ("progs/h_shams.mdl");
precache_model ("progs/s_light.mdl");
- // precache_model ("progs/h_shams.mdl");
precache_model ("progs/bolt.mdl");
- precache_proj_model (e, "progs/lavaball.mdl");
-
- precache_sound_misc1 (e, "shambler/sattck1.wav");
- precache_sound_misc2 (e, "shambler/sboom.wav");
- precache_sound_death (e, "shambler/sdeath.wav");
- precache_sound_pain (e, "shambler/shurt2.wav");
- precache_sound_idle (e, "shambler/sidle.wav");
- precache_sound_sight (e, "shambler/ssight.wav");
- precache_sound_attack (e, "shambler/melee1.wav");
- precache_sound_misc (e, "shambler/melee2.wav");
- precache_sound_hit (e, "shambler/smack.wav");
+ precache_model ("progs/lavaball.mdl");
+
+ precache_sound ("shambler/sattck1.wav");
+ precache_sound ("shambler/sboom.wav");
+ precache_sound ("shambler/sdeath.wav");
+ precache_sound ("shambler/shurt2.wav");
+ precache_sound ("shambler/sidle.wav");
+ precache_sound ("shambler/ssight.wav");
+ precache_sound ("shambler/melee1.wav");
+ precache_sound ("shambler/melee2.wav");
+ precache_sound ("shambler/smack.wav");
// jaycie erysdren 2021-09-14
precache_sound ("boss1/throw.wav");
- precache_gib1 (e, "progs/gib1.mdl");
- precache_gib2 (e, "progs/gib2.mdl");
- precache_gib3 (e, "progs/gib3.mdl");
-
- e.solid = SOLID_SLIDEBOX;
- e.movetype = MOVETYPE_STEP;
- body_model (e, "progs/shambler.mdl");
- // setmodel (e, "progs/shambler.mdl");
+ precache_model ("progs/gib1.mdl");
+ precache_model ("progs/gib2.mdl");
+ precache_model ("progs/gib3.mdl");
- setsize (e, VEC_HULL2_MIN, VEC_HULL2_MAX);
+ // set up model and size for later -- CEV
+ e.mdl = "progs/shambler.mdl";
if (!e.health)
// thanks RennyC -- dumptruck_ds
@@ -962,13 +1073,14 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
e.checkattack = monster_shambler_checkattack;
e.sightsound = monster_shambler_sightsound;
+ e.destroy = monster_shambler_destroy;
+
e.th_stand = sham_stand1;
e.th_walk = sham_walk1;
- if (e.spawnflags & I_AM_TURRET)
+ if (e.spawnflags & SPAWNFLAG_MONSTER_TURRET)
e.th_run = sham_seek_1;
else
e.th_run = sham_run1;
- e.destroy = monster_shambler_destroy;
if (e.style == 1)
e.th_melee = monster_shambler_attack_melee2;
else
@@ -981,87 +1093,36 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
e.th_turret = sham_tur_proj1;
else
e.th_turret = sham_tur_magic1;
- // Berserk test from
- // http://celephais.net/board/view_thread.php?id=4&start=3465
- // -- dumptruck_ds
- if !(e.berserk)
- e.th_pain = monster_shambler_pain;
- else
+
+ // changed berserk test from field to flag -- CEV
+ if (self.spawnflags & SPAWNFLAG_MONSTER_BERSERK)
e.th_pain = sub_nullpain;
+ else
+ e.th_pain = monster_shambler_pain;
+ #endif
- // walkmonster_start
- base_walkmonster_init (e);
+ // InitMonster -- runs on both client & server -- CEV
+ base_monster_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() monster_shambler =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags & fields, inhibit if necessary -- CEV
+ BASE_MONSTER_PREINIT (base_monster_init_field)
monster_shambler_init (self);
};
+#endif
// };
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-/*QUAKED gib_head_shambler (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/h_shams.mdl");
-}*/
-//----------------------------------------------------------------------
-// class gib_head_shambler: base_gib_head
-// {
- //--------------------------------------------------------------
- // ThrowHead
- //--------------------------------------------------------------
- void(entity act, vector dir, float dmg) throw_gib_head_shambler =
- {
- base_gib_head_throw (act, dir, dmg, gib_head_shambler_init);
- };
-
- //--------------------------------------------------------------
- void(entity e) gib_head_shambler_init =
- {
- e.classname = "gib_head_shambler";
- e.classtype = CT_GORE_HEAD_SHAMBLER;
-
- // gib_init interprets spawnflags and will set .solid -- CEV
- base_gib_head_init (e);
-
- if (e.mdl_head != "")
- {
- precache_model (e.mdl_head);
- setmodel (e, e.mdl_head);
- }
- else
- {
- precache_model ("progs/h_shams.mdl");
- setmodel (e, "progs/h_shams.mdl");
- if (e.solid == SOLID_BBOX)
- setsize (e, SHAMBLER_HEAD_MINS,
- SHAMBLER_HEAD_MAXS);
- else if (e.solid == SOLID_TRIGGER)
- setsize (e, '-16 -16 0', '16 16 56');
- }
-
- e.frame = 0; // was 1, caused an error -- dumptruck_ds
- };
-
- //--------------------------------------------------------------
- void() gib_head_shambler =
- {
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- gib_head_shambler_init (self);
- };
-// };
-
+#ifdef SSQC
/*QUAKED monster_dead_shambler (0 0.5 0.8) (-32 -32 -24) (32 32 64) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ({"path":"progs/shambler.mdl","frame":93});
@@ -1093,3 +1154,8 @@ model ("progs/h_shams.mdl");
monster_dead_shambler_init (self);
};
// };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+$flush
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/monsters/soldier.qc
diff --git a/qc/monsters/soldier.qc b/qc/monsters/soldier.qc
index 85dd198..87ab86f 100644
--- a/qc/monsters/soldier.qc
+++ b/qc/monsters/soldier.qc
@@ -6,28 +6,37 @@
// constants
//======================================================================
+#ifdef SSQC
const float ARMY_HEALTH = 30; // id1 30
const float ARMY_HEALTH_CORPSE = 30;
+#endif
-const vector ARMY_HEAD_MINS = '-9.67 -8.27 -0.28';
-const vector ARMY_HEAD_MAXS = '4.05 4.8 13.41';
+#if defined(CSQC) || defined(SSQC)
+const vector ARMY_MINS = '-16 -16 -24';
+const vector ARMY_MAXS = '16 16 40';
const vector ARMY_CORPSE_MINS = '-38.27 -30.47 -50.3';
const vector ARMY_CORPSE_MAXS = '22.1 25.35 30';
const vector ARMY_CORPSE_C_MINS = '-39.85 -29.35 -49.07';
const vector ARMY_CORPSE_C_MAXS = '20.52 33.17 30';
const vector ARMY_CORPSE_Z_MINS = '-16 -16 -24'; // thin 32x32 box on ground
const vector ARMY_CORPSE_Z_MAXS = '16 16 -8';
+#endif
//======================================================================
// forward declarations
//======================================================================
// monster_army
+#ifdef CSQC
+void(float isnew) monster_army_netreceive;
+#endif
+#ifdef SSQC
float() monster_army_checkattack;
void() monster_army_sightsound;
void() monster_army_fire;
void(entity attacker, float damage) monster_army_pain;
void(vector dir) monster_army_destroy;
+// F() // macro to set FRAME netflag -- CEV
void() army_stand1; void() army_stand2; // animation & thinking
void() army_stand3; void() army_stand4; void() army_stand5;
void() army_stand6; void() army_stand7; void() army_stand8;
@@ -65,24 +74,27 @@ void() army_die9; void() army_die10;
void() army_cdie1; void() army_cdie2; void() army_cdie3; void() army_cdie4;
void() army_cdie5; void() army_cdie6; void() army_cdie7; void() army_cdie8;
void() army_cdie9; void() army_cdie10; void() army_cdie11;
-entity(vector org, vector ang, float sflags, float yaw, float angry)
+entity(vector org, vector ang, float sflags, float yaw)
spawn_monster_army; // initialization
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) monster_army_init;
+#endif
+#ifdef SSQC
void() monster_army;
+#endif
-// gib_head_army
-void(entity act, vector dir, float dmg) throw_gib_head_army;
-void(entity e) gib_head_army_init;
-void() gib_head_army;
-
+#ifdef SSQC
// monster_dead_army
void(entity e) monster_dead_army_init;
void() monster_dead_army;
+#endif
//======================================================================
// frame macros
//======================================================================
+#if defined(CSQC) || defined(SSQC)
$cd id1/models/soldier3
$origin 0 -6 24
$base base
@@ -114,6 +126,11 @@ $frame prowl_1 prowl_2 prowl_3 prowl_4 prowl_5 prowl_6 prowl_7 prowl_8
$frame prowl_9 prowl_10 prowl_11 prowl_12 prowl_13 prowl_14 prowl_15 prowl_16
$frame prowl_17 prowl_18 prowl_19 prowl_20 prowl_21 prowl_22 prowl_23 prowl_24
+// MG1 compat -- CEV
+const float CORPSEFRAME_SOLDIER_1 = $death10;
+const float CORPSEFRAME_SOLDIER_2 = $deathc11;
+#endif
+
//------------------------------------------------------------------------------
/*QUAKED monster_army (1 0 0) (-16 -16 -24) (16 16 40) AMBUSH X X TRIGGER_SPAWNED X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
@@ -125,12 +142,6 @@ Grunt.
Default health = 30"
keep_ammo "1 = Don't drop backpack upon death"
-snd_death "Path to custom death sound"
-snd_pain "Path to custom pain sound"
-snd_sight "Path to custom sight sound"
-snd_attack "Path to custom attack sound (GUNSHOT)"
-snd_idle "Path to custom idle sound"
-snd_misc "Path to custom sound (PAIN 2)"
mdl_head(string) : "Path to custom head model"
mdl_body(string) : "Path to custom body model"
@@ -181,8 +192,37 @@ obit_name(string) : "When used with obit_method, this will set part of the text
obit_method(string) : "When used with obit_name, will set part of the text for a custom obituary. e.g. eviscerated - If empty, defaults to killed."
damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by this number (e.g. 4 = Quad damage)"
*/
-// class monster_army: base_walkmonster
+// class monster_army: base_monster
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) monster_army_netreceive =
+ {
+ // creates the newframe and netflags variables -- CEV
+ BASE_MONSTER_NETRECEIVE (monster_army_init,
+ ARMY_MINS, ARMY_MAXS)
+
+ if (isnew)
+ base_entity_que_add (self, QUE_TYPE_ACTOR);
+
+ if (self.frame == $shoot5)
+ {
+ self.effects |= EF_MUZZLEFLASH;
+ }
+ else if (self.frame >= $death3 && self.frame <= $death10)
+ {
+ if (self.solid != SOLID_NOT)
+ self.solid = SOLID_NOT;
+ }
+ else if (self.frame >= $deathc3 && self.frame <= $deathc11)
+ {
+ if (self.solid != SOLID_NOT)
+ self.solid = SOLID_NOT;
+ }
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
// SoldierCheckAttack
// The player is in view, so decide to move or launch an attack
@@ -196,7 +236,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
// dprint ("SoldierAttack\n");
// dumptruck_ds
- if (self.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_TURRET)
{
// self.th_turret ();
self.attack_state = AS_MISSILE;
@@ -218,7 +258,8 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
// sight line crossed contents
return FALSE;
- if ((self.spawnflags & I_AM_TURRET) && (trace_ent != targ))
+ if ((self.spawnflags & SPAWNFLAG_MONSTER_TURRET) &&
+ (trace_ent != targ))
{
// dprint("trace_ent...\n");
self.attack_state = AS_TURRET;
@@ -261,7 +302,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//--------------------------------------------------------------
void() monster_army_sightsound =
{
- sound_sight (self, CHAN_VOICE, "soldier/sight1.wav",
+ sound (self, CHAN_VOICE, "soldier/sight1.wav",
VOL_HIGH, ATTN_NORM);
};
@@ -289,7 +330,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
// grunt grenade offset
local vector org1 = self.origin +
(v_forward * 30 + v_right * 5 + '0 0 16');
- if (self.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_TURRET)
base_monster_fire_grenade (
org1, 40, 40, self.attack_elevation);
else
@@ -309,7 +350,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
// Nailgun; MonFireSpike -- used for Grunts
ai_face ();
- sound_attack (self, CHAN_WEAPON, "weapons/rocket1i.wav",
+ sound (self, CHAN_WEAPON, "weapons/rocket1i.wav",
VOL_HIGH, ATTN_NORM);
self.effects = self.effects | EF_MUZZLEFLASH;
@@ -333,11 +374,9 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
ai_face ();
self.effects |= EF_MUZZLEFLASH;
- sound_attack (self, CHAN_WEAPON, "soldier/sattck1.wav",
+ sound (self, CHAN_WEAPON, "soldier/sattck1.wav",
VOL_HIGH, ATTN_NORM);
- // FireBullets (4, dir, '0.1 0.1 0');
-
// fire somewhat behind the player, so a dodging player
// is harder to hit
dir = self.enemy.origin - self.enemy.velocity * 0.2;
@@ -362,9 +401,9 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
// turret checks moved here to play pain sounds
// correctly -- dumptruck_ds
self.pain_finished = time + 0.6;
- sound_pain (self, CHAN_VOICE, "soldier/pain1.wav",
+ sound (self, CHAN_VOICE, "soldier/pain1.wav",
VOL_HIGH, ATTN_NORM);
- if (self.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_TURRET)
return;
else
army_pain1 ();
@@ -372,9 +411,9 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
else if (r < 0.6)
{
self.pain_finished = time + 1.1;
- sound_misc (self, CHAN_VOICE, "soldier/pain2.wav",
+ sound (self, CHAN_VOICE, "soldier/pain2.wav",
VOL_HIGH, ATTN_NORM);
- if (self.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_TURRET)
return;
else
army_painb2 ();
@@ -382,9 +421,9 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
else
{
self.pain_finished = time + 1.1;
- sound_misc (self, CHAN_VOICE, "soldier/pain2.wav",
+ sound (self, CHAN_VOICE, "soldier/pain2.wav",
VOL_HIGH, ATTN_NORM);
- if (self.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_TURRET)
return;
else
army_painc1 ();
@@ -394,37 +433,27 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//--------------------------------------------------------------
void(vector dir) monster_army_destroy =
{
- // check if we're dead already
- if (self.classgroup & CG_CORPSE)
- {
- sound (self, CHAN_VOICE, "player/udeath.wav",
- VOL_HIGH, ATTN_NORM);
-
- throw_gib_head_army (self, dir, self.health);
- throw_gib_1 (self, dir, self.health);
- throw_gib_2 (self, dir, self.health);
- throw_gib_3 (self, dir, self.health);
-
- return;
- }
-
// check for gib
- if (self.health < -35)
+ if (self.classgroup & CG_CORPSE || self.health < -35)
{
sound (self, CHAN_VOICE, "player/udeath.wav",
VOL_HIGH, ATTN_NORM);
- throw_gib_head_army (self, dir, self.health);
- throw_gib_1 (self, dir, self.health);
- throw_gib_2 (self, dir, self.health);
- throw_gib_3 (self, dir, self.health);
+ if (!(self.classgroup & CG_CORPSE))
+ base_item_drop_stuff (self);
- base_item_drop_stuff (self);
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib1_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib2_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib3_init)
+ BASE_ITEM_GIB_THROW (dir, self.health,
+ item_head_army_init)
+
+ base_entity_remove (self);
return;
}
// regular death
- sound_death (self, CHAN_VOICE, "soldier/death1.wav",
+ sound (self, CHAN_VOICE, "soldier/death1.wav",
VOL_HIGH, ATTN_NORM);
base_item_drop_stuff (self);
if (random() < 0.5)
@@ -434,16 +463,25 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
};
//--------------------------------------------------------------
+ #define F() \
+ /* { */ \
+ if (!(self.SendFlags & NETFLAG_BASE_ENTITY_FRAME)) \
+ { \
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME; \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
// Grunt stand functions
//--------------------------------------------------------------
- void() army_stand1 = [$stand1, army_stand2] { ai_stand (); };
- void() army_stand2 = [$stand2, army_stand3] { ai_stand (); };
- void() army_stand3 = [$stand3, army_stand4] { ai_stand (); };
- void() army_stand4 = [$stand4, army_stand5] { ai_stand (); };
- void() army_stand5 = [$stand5, army_stand6] { ai_stand (); };
- void() army_stand6 = [$stand6, army_stand7] { ai_stand (); };
- void() army_stand7 = [$stand7, army_stand8] { ai_stand (); };
- void() army_stand8 = [$stand8, army_stand1] { ai_stand (); };
+ void() army_stand1 = [$stand1, army_stand2] { ai_stand (); F () };
+ void() army_stand2 = [$stand2, army_stand3] { ai_stand (); F () };
+ void() army_stand3 = [$stand3, army_stand4] { ai_stand (); F () };
+ void() army_stand4 = [$stand4, army_stand5] { ai_stand (); F () };
+ void() army_stand5 = [$stand5, army_stand6] { ai_stand (); F () };
+ void() army_stand6 = [$stand6, army_stand7] { ai_stand (); F () };
+ void() army_stand7 = [$stand7, army_stand8] { ai_stand (); F () };
+ void() army_stand8 = [$stand8, army_stand1] { ai_stand (); F () };
//--------------------------------------------------------------
// Grunt walk functions
@@ -451,33 +489,34 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() army_walk1 = [$prowl_1, army_walk2]
{
if (random() < 0.2)
- sound_idle (self, CHAN_VOICE, "soldier/idle.wav",
+ sound (self, CHAN_VOICE, "soldier/idle.wav",
VOL_HIGH, ATTN_IDLE);
ai_walk (1);
- };
- void() army_walk2 = [$prowl_2, army_walk3] { ai_walk (1); };
- void() army_walk3 = [$prowl_3, army_walk4] { ai_walk (1); };
- void() army_walk4 = [$prowl_4, army_walk5] { ai_walk (1); };
- void() army_walk5 = [$prowl_5, army_walk6] { ai_walk (2); };
- void() army_walk6 = [$prowl_6, army_walk7] { ai_walk (3); };
- void() army_walk7 = [$prowl_7, army_walk8] { ai_walk (4); };
- void() army_walk8 = [$prowl_8, army_walk9] { ai_walk (4); };
- void() army_walk9 = [$prowl_9, army_walk10] { ai_walk (2); };
- void() army_walk10 = [$prowl_10, army_walk11] { ai_walk (2); };
- void() army_walk11 = [$prowl_11, army_walk12] { ai_walk (2); };
- void() army_walk12 = [$prowl_12, army_walk13] { ai_walk (1); };
- void() army_walk13 = [$prowl_13, army_walk14] { ai_walk (0); };
- void() army_walk14 = [$prowl_14, army_walk15] { ai_walk (1); };
- void() army_walk15 = [$prowl_15, army_walk16] { ai_walk (1); };
- void() army_walk16 = [$prowl_16, army_walk17] { ai_walk (1); };
- void() army_walk17 = [$prowl_17, army_walk18] { ai_walk (3); };
- void() army_walk18 = [$prowl_18, army_walk19] { ai_walk (3); };
- void() army_walk19 = [$prowl_19, army_walk20] { ai_walk (3); };
- void() army_walk20 = [$prowl_20, army_walk21] { ai_walk (3); };
- void() army_walk21 = [$prowl_21, army_walk22] { ai_walk (2); };
- void() army_walk22 = [$prowl_22, army_walk23] { ai_walk (1); };
- void() army_walk23 = [$prowl_23, army_walk24] { ai_walk (1); };
- void() army_walk24 = [$prowl_24, army_walk1] { ai_walk (1); };
+ F ()
+ };
+ void() army_walk2 = [$prowl_2, army_walk3] { ai_walk (1); F () };
+ void() army_walk3 = [$prowl_3, army_walk4] { ai_walk (1); F () };
+ void() army_walk4 = [$prowl_4, army_walk5] { ai_walk (1); F () };
+ void() army_walk5 = [$prowl_5, army_walk6] { ai_walk (2); F () };
+ void() army_walk6 = [$prowl_6, army_walk7] { ai_walk (3); F () };
+ void() army_walk7 = [$prowl_7, army_walk8] { ai_walk (4); F () };
+ void() army_walk8 = [$prowl_8, army_walk9] { ai_walk (4); F () };
+ void() army_walk9 = [$prowl_9, army_walk10] { ai_walk (2); F () };
+ void() army_walk10 = [$prowl_10, army_walk11] { ai_walk (2); F () };
+ void() army_walk11 = [$prowl_11, army_walk12] { ai_walk (2); F () };
+ void() army_walk12 = [$prowl_12, army_walk13] { ai_walk (1); F () };
+ void() army_walk13 = [$prowl_13, army_walk14] { ai_walk (0); F () };
+ void() army_walk14 = [$prowl_14, army_walk15] { ai_walk (1); F () };
+ void() army_walk15 = [$prowl_15, army_walk16] { ai_walk (1); F () };
+ void() army_walk16 = [$prowl_16, army_walk17] { ai_walk (1); F () };
+ void() army_walk17 = [$prowl_17, army_walk18] { ai_walk (3); F () };
+ void() army_walk18 = [$prowl_18, army_walk19] { ai_walk (3); F () };
+ void() army_walk19 = [$prowl_19, army_walk20] { ai_walk (3); F () };
+ void() army_walk20 = [$prowl_20, army_walk21] { ai_walk (3); F () };
+ void() army_walk21 = [$prowl_21, army_walk22] { ai_walk (2); F () };
+ void() army_walk22 = [$prowl_22, army_walk23] { ai_walk (1); F () };
+ void() army_walk23 = [$prowl_23, army_walk24] { ai_walk (1); F () };
+ void() army_walk24 = [$prowl_24, army_walk1] { ai_walk (1); F () };
//--------------------------------------------------------------
// Grunt run functions
@@ -485,17 +524,18 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() army_run1 = [$run1, army_run2]
{
if (random() < 0.2)
- sound_idle (self, CHAN_VOICE, "soldier/idle.wav",
+ sound (self, CHAN_VOICE, "soldier/idle.wav",
VOL_HIGH, ATTN_IDLE);
ai_run (11);
+ F ()
};
- void() army_run2 = [$run2, army_run3] { ai_run (15); };
- void() army_run3 = [$run3, army_run4] { ai_run (10); };
- void() army_run4 = [$run4, army_run5] { ai_run (10); };
- void() army_run5 = [$run5, army_run6] { ai_run (8); };
- void() army_run6 = [$run6, army_run7] { ai_run (15); };
- void() army_run7 = [$run7, army_run8] { ai_run (10); };
- void() army_run8 = [$run8, army_run1] { ai_run (8); };
+ void() army_run2 = [$run2, army_run3] { ai_run (15); F () };
+ void() army_run3 = [$run3, army_run4] { ai_run (10); F () };
+ void() army_run4 = [$run4, army_run5] { ai_run (10); F () };
+ void() army_run5 = [$run5, army_run6] { ai_run (8); F () };
+ void() army_run6 = [$run6, army_run7] { ai_run (15); F () };
+ void() army_run7 = [$run7, army_run8] { ai_run (10); F () };
+ void() army_run8 = [$run8, army_run1] { ai_run (8); F () };
//--------------------------------------------------------------
// Grunt attack functions
@@ -505,10 +545,11 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
ai_face ();
self.count = 0;
self.t_length = 4 + floor (random() * 4);
+ F ()
};
- void() army_atk2 = [$shoot2, army_atk3] { ai_face (); };
- void() army_atk3 = [$shoot3, army_atk4] { ai_face (); };
- void() army_atk4 = [$shoot4, army_atk5] { ai_face (); };
+ void() army_atk2 = [$shoot2, army_atk3] { ai_face (); F () };
+ void() army_atk3 = [$shoot3, army_atk4] { ai_face (); F () };
+ void() army_atk4 = [$shoot4, army_atk5] { ai_face (); F () };
void() army_atk5 =
{
self.frame = $shoot5;
@@ -521,24 +562,27 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
ai_face ();
monster_army_fire ();
+ F ()
};
- void() army_atk6 = [$shoot6, army_atk7] { ai_face (); };
+ void() army_atk6 = [$shoot6, army_atk7] { ai_face (); F () };
void() army_atk7 = [$shoot7, army_atk8]
{
ai_face ();
sub_checkrefire (army_atk1);
+ F ()
};
- void() army_atk8 = [$shoot8, army_atk9] { ai_face (); };
- void() army_atk9 = [$shoot9, army_run1] { ai_face (); };
+ void() army_atk8 = [$shoot8, army_atk9] { ai_face (); F () };
+ void() army_atk9 = [$shoot9, army_run1] { ai_face (); F () };
//--------------------------------------------------------------
- // Grunt turrent attack functions
+ // Grunt turret attack functions
//--------------------------------------------------------------
void() army_tur_atk1 = [$shoot1, army_tur_atk2]
{
ai_face ();
self.count = 0;
self.t_length = 4 + floor (random() * 4);
+ F ()
};
void() army_tur_atk2 = [$shoot2, army_tur_atk3]
{
@@ -546,6 +590,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
self.attack_elevation = preach_iterate_elevation (
OGRE_DEFAULT_ELEVATION, GRENADE_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() army_tur_atk3 = [$shoot3, army_tur_atk4]
{
@@ -553,6 +598,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
self.attack_elevation = preach_iterate_elevation (
self.attack_elevation, GRENADE_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() army_tur_atk4 = [$shoot4, army_tur_atk5]
{
@@ -560,6 +606,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
self.attack_elevation = preach_iterate_elevation (
self.attack_elevation, GRENADE_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() army_tur_atk5 =
{
@@ -573,73 +620,77 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
ai_face ();
monster_army_fire ();
+ F ()
};
- void() army_tur_atk6 = [$shoot6, army_tur_atk7] { ai_face (); };
+ void() army_tur_atk6 = [$shoot6, army_tur_atk7] { ai_face (); F () };
void() army_tur_atk7 = [$shoot7, army_tur_atk8]
{
ai_face ();
sub_checkrefire (army_tur_atk1);
+ F ()
};
- void() army_tur_atk8 = [$shoot8, army_tur_atk9] { ai_face (); };
+ void() army_tur_atk8 = [$shoot8, army_tur_atk9] { ai_face (); F () };
void() army_tur_atk9 = [$stand4, army_tur_atk10]
{
ai_face ();
+ F ()
};
void() army_tur_atk10 = [$stand5, army_seek_stand1]
{
ai_face ();
+ F ()
};
//--------------------------------------------------------------
- // Grunt turrent standing functions
+ // Grunt turret standing functions
//--------------------------------------------------------------
- void() army_seek_stand1 = [$stand1, army_seek_stand2] { ai_run (0); };
- void() army_seek_stand2 = [$stand2, army_seek_stand3] { ai_run (0); };
- void() army_seek_stand3 = [$stand3, army_seek_stand4] { ai_run (0); };
- void() army_seek_stand4 = [$stand4, army_seek_stand5] { ai_run (0); };
- void() army_seek_stand5 = [$stand5, army_seek_stand6] { ai_run (0); };
- void() army_seek_stand6 = [$stand6, army_seek_stand7] { ai_run (0); };
- void() army_seek_stand7 = [$stand7, army_seek_stand8] { ai_run (0); };
- void() army_seek_stand8 = [$stand8, army_seek_stand1] { ai_run (0); };
+ void() army_seek_stand1 = [$stand1, army_seek_stand2] {ai_run (0); F()};
+ void() army_seek_stand2 = [$stand2, army_seek_stand3] {ai_run (0); F()};
+ void() army_seek_stand3 = [$stand3, army_seek_stand4] {ai_run (0); F()};
+ void() army_seek_stand4 = [$stand4, army_seek_stand5] {ai_run (0); F()};
+ void() army_seek_stand5 = [$stand5, army_seek_stand6] {ai_run (0); F()};
+ void() army_seek_stand6 = [$stand6, army_seek_stand7] {ai_run (0); F()};
+ void() army_seek_stand7 = [$stand7, army_seek_stand8] {ai_run (0); F()};
+ void() army_seek_stand8 = [$stand8, army_seek_stand1] {ai_run (0); F()};
//--------------------------------------------------------------
// Grunt pain states
//--------------------------------------------------------------
- void() army_pain1 = [$pain1, army_pain2] { };
- void() army_pain2 = [$pain2, army_pain3] { };
- void() army_pain3 = [$pain3, army_pain4] { };
- void() army_pain4 = [$pain4, army_pain5] { };
- void() army_pain5 = [$pain5, army_pain6] { };
- void() army_pain6 = [$pain6, army_run1] { ai_pain (1); };
-
- void() army_painb1 = [$painb1, army_painb2] { };
- void() army_painb2 = [$painb2, army_painb3] { ai_painforward (13); };
- void() army_painb3 = [$painb3, army_painb4] { ai_painforward (9); };
- void() army_painb4 = [$painb4, army_painb5] { };
- void() army_painb5 = [$painb5, army_painb6] { };
- void() army_painb6 = [$painb6, army_painb7] { };
- void() army_painb7 = [$painb7, army_painb8] { };
- void() army_painb8 = [$painb8, army_painb9] { };
- void() army_painb9 = [$painb9, army_painb10] { };
- void() army_painb10 = [$painb10, army_painb11] { };
- void() army_painb11 = [$painb11, army_painb12] { };
- void() army_painb12 = [$painb12, army_painb13] { ai_pain(2); };
- void() army_painb13 = [$painb13, army_painb14] { };
- void() army_painb14 = [$painb14, army_run1] { };
-
- void() army_painc1 = [$painc1, army_painc2] { };
- void() army_painc2 = [$painc2, army_painc3] { ai_pain (1); };
- void() army_painc3 = [$painc3, army_painc4] { };
- void() army_painc4 = [$painc4, army_painc5] { };
- void() army_painc5 = [$painc5, army_painc6] { ai_painforward (1); };
- void() army_painc6 = [$painc6, army_painc7] { ai_painforward (1); };
- void() army_painc7 = [$painc7, army_painc8] { };
- void() army_painc8 = [$painc8, army_painc9] { ai_pain (1); };
- void() army_painc9 = [$painc9, army_painc10] { ai_painforward (4); };
- void() army_painc10 = [$painc10, army_painc11] { ai_painforward (3); };
- void() army_painc11 = [$painc11, army_painc12] { ai_painforward (6); };
- void() army_painc12 = [$painc12, army_painc13] { ai_painforward (8); };
- void() army_painc13 = [$painc13, army_run1] { };
+ void() army_pain1 = [$pain1, army_pain2] { F () };
+ void() army_pain2 = [$pain2, army_pain3] { F () };
+ void() army_pain3 = [$pain3, army_pain4] { F () };
+ void() army_pain4 = [$pain4, army_pain5] { F () };
+ void() army_pain5 = [$pain5, army_pain6] { F () };
+ void() army_pain6 = [$pain6, army_run1] { ai_pain (1); F () };
+
+ void() army_painb1 = [$painb1, army_painb2] { F () };
+ void() army_painb2 = [$painb2, army_painb3] { ai_painforward (13); F()};
+ void() army_painb3 = [$painb3, army_painb4] { ai_painforward (9); F()};
+ void() army_painb4 = [$painb4, army_painb5] { F () };
+ void() army_painb5 = [$painb5, army_painb6] { F () };
+ void() army_painb6 = [$painb6, army_painb7] { F () };
+ void() army_painb7 = [$painb7, army_painb8] { F () };
+ void() army_painb8 = [$painb8, army_painb9] { F () };
+ void() army_painb9 = [$painb9, army_painb10] { F () };
+ void() army_painb10 = [$painb10, army_painb11] { F () };
+ void() army_painb11 = [$painb11, army_painb12] { F () };
+ void() army_painb12 = [$painb12, army_painb13] { ai_pain(2); F () };
+ void() army_painb13 = [$painb13, army_painb14] { F () };
+ void() army_painb14 = [$painb14, army_run1] { F () };
+
+ void() army_painc1 = [$painc1, army_painc2] { F () };
+ void() army_painc2 = [$painc2, army_painc3] { ai_pain (1); F () };
+ void() army_painc3 = [$painc3, army_painc4] { F () };
+ void() army_painc4 = [$painc4, army_painc5] { F () };
+ void() army_painc5 = [$painc5, army_painc6] { ai_painforward (1); F()};
+ void() army_painc6 = [$painc6, army_painc7] { ai_painforward (1); F()};
+ void() army_painc7 = [$painc7, army_painc8] { F () };
+ void() army_painc8 = [$painc8, army_painc9] { ai_pain (1); F () };
+ void() army_painc9 = [$painc9, army_painc10] { ai_painforward (4); F()};
+ void() army_painc10 = [$painc10, army_painc11] {ai_painforward (3);F()};
+ void() army_painc11 = [$painc11, army_painc12] {ai_painforward (6);F()};
+ void() army_painc12 = [$painc12, army_painc13] {ai_painforward (8);F()};
+ void() army_painc13 = [$painc13, army_run1] { F () };
//--------------------------------------------------------------
// Grunt death states
@@ -647,8 +698,9 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() army_die1 = [$death1, army_die2]
{
base_entity_aligntoground (self);
+ F ()
};
- void() army_die2 = [$death2, army_die3] { };
+ void() army_die2 = [$death2, army_die3] { F () };
void() army_die3 = [$death3, army_die4]
{
self.solid = SOLID_NOT;
@@ -667,24 +719,34 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
if (!self.keep_ammo)
item_backpack_drop (self);
+ F ()
};
- void() army_die4 = [$death4, army_die5] { };
- void() army_die5 = [$death5, army_die6] { };
- void() army_die6 = [$death6, army_die7] { };
- void() army_die7 = [$death7, army_die8] { };
- void() army_die8 = [$death8, army_die9] { };
+ void() army_die4 = [$death4, army_die5] { F () };
+ void() army_die5 = [$death5, army_die6] { F () };
+ void() army_die6 = [$death6, army_die7] { F () };
+ void() army_die7 = [$death7, army_die8] { F () };
+ void() army_die8 = [$death8, army_die9] { F () };
void() army_die9 = [$death9, army_die10]
{
become_base_corpse (self, ARMY_HEALTH_CORPSE);
setsize (self, ARMY_CORPSE_Z_MINS, ARMY_CORPSE_Z_MAXS);
+ F ()
+ };
+ void() army_die10 = [$death10, army_die10]
+ {
+ if (self.origin != self.origin_net)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_FRAME;
+ else if (self.frame_net != self.frame)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
};
- void() army_die10 = [$death10, army_die10] { };
void() army_cdie1 = [$deathc1, army_cdie2]
{
base_entity_aligntoground (self);
+ F ()
};
- void() army_cdie2 = [$deathc2, army_cdie3] { ai_back (5); };
+ void() army_cdie2 = [$deathc2, army_cdie3] { ai_back (5); F () };
void() army_cdie3 = [$deathc3, army_cdie4]
{
self.solid = SOLID_NOT;
@@ -705,65 +767,91 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
item_backpack_drop (self);
ai_back (4);
- };
- void() army_cdie4 = [$deathc4, army_cdie5] { ai_back (13); };
- void() army_cdie5 = [$deathc5, army_cdie6] { ai_back (3); };
- void() army_cdie6 = [$deathc6, army_cdie7] { ai_back (4); };
- void() army_cdie7 = [$deathc7, army_cdie8] { };
- void() army_cdie8 = [$deathc8, army_cdie9] { };
- void() army_cdie9 = [$deathc9, army_cdie10] { };
+ F ()
+ };
+ void() army_cdie4 = [$deathc4, army_cdie5] { ai_back (13); F () };
+ void() army_cdie5 = [$deathc5, army_cdie6] { ai_back (3); F () };
+ void() army_cdie6 = [$deathc6, army_cdie7] { ai_back (4); F () };
+ void() army_cdie7 = [$deathc7, army_cdie8] { F () };
+ void() army_cdie8 = [$deathc8, army_cdie9] { F () };
+ void() army_cdie9 = [$deathc9, army_cdie10] { F () };
void() army_cdie10 = [$deathc10, army_cdie11]
{
become_base_corpse (self, ARMY_HEALTH_CORPSE);
setsize (self, ARMY_CORPSE_Z_MINS, ARMY_CORPSE_Z_MAXS);
+ F ()
+ };
+ void() army_cdie11 = [$deathc11, army_cdie11]
+ {
+ if (self.origin != self.origin_net)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_FRAME;
+ else if (self.frame_net != self.frame)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
};
- void() army_cdie11 = [$deathc11, army_cdie11] { };
+
+ #undef F
//==============================================================
// Initialization
//==============================================================
//--------------------------------------------------------------
- entity(vector org, vector ang, float sflags, float yaw, float angry)
+ entity(vector org, vector ang, float sflags, float yaw)
spawn_monster_army =
{
- return spawn_base_monster (org, ang, sflags, yaw, angry,
+ return spawn_base_monster (org, ang, sflags, yaw,
monster_army_init);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) monster_army_init =
{
+ #ifdef SSQC
if (deathmatch)
{
remove (e);
return;
}
+ #endif
e.classname = "monster_army";
e.classtype = CT_MONSTER_GRUNT;
+ e.solid = SOLID_SLIDEBOX;
+ e.pos1 = ARMY_MINS;
+ e.pos2 = ARMY_MAXS;
+
+ #ifdef CSQC
+ if (e.modelindex)
+ {
+ setmodelindex (e, e.modelindex);
+ setsize (e, ARMY_MINS, ARMY_MAXS);
+ }
+ #endif
- //dumptruck_ds custom_mdls
- precache_body_model (e, "progs/soldier.mdl");
- precache_head_model (e, "progs/h_guard.mdl");
+ #ifdef SSQC
+ precache_model ("progs/soldier.mdl");
+ precache_model ("progs/h_guard.mdl");
// used if style == 1
- precache_proj_model (e, "progs/missile.mdl");
+ precache_model ("progs/missile.mdl");
// used if style == 2
- precache_proj_model (e, "progs/grenade.mdl");
+ precache_model ("progs/grenade.mdl");
// used if style == 3
precache_model2 ("progs/laser.mdl");
- //dumptruck_ds custom_mdls
+ // dumptruck_ds custom_mdls
precache_model ("progs/gib1.mdl");
precache_model ("progs/gib2.mdl");
precache_model ("progs/gib3.mdl");
- precache_sound_death (e, "soldier/death1.wav");
- precache_sound_idle (e, "soldier/idle.wav");
- precache_sound_pain (e, "soldier/pain1.wav");
- precache_sound_misc (e, "soldier/pain2.wav");
- precache_sound_attack (e, "soldier/sattck1.wav");
- precache_sound_sight (e, "soldier/sight1.wav");
+ precache_sound ("soldier/death1.wav");
+ precache_sound ("soldier/idle.wav");
+ precache_sound ("soldier/pain1.wav");
+ precache_sound ("soldier/pain2.wav");
+ precache_sound ("soldier/sattck1.wav");
+ precache_sound ("soldier/sight1.wav");
// used if style == 3
precache_sound2 ("enforcer/enfire.wav");
// used if style == 3
@@ -772,17 +860,12 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
// gib death
precache_sound ("player/udeath.wav");
- precache_gib1 (e, "progs/gib1.mdl");
- precache_gib2 (e, "progs/gib2.mdl");
- precache_gib3 (e, "progs/gib3.mdl");
-
- e.solid = SOLID_SLIDEBOX;
- e.movetype = MOVETYPE_STEP;
-
- // dumptruck_ds custom_mdls
- body_model (e, "progs/soldier.mdl");
+ precache_model ("progs/gib1.mdl");
+ precache_model ("progs/gib2.mdl");
+ precache_model ("progs/gib3.mdl");
- setsize (e, '-16 -16 -24', '16 16 40');
+ // set up model and size for later -- CEV
+ e.mdl = "progs/soldier.mdl";
if (!e.proj_speed_mod)
e.proj_speed_mod = 1;
@@ -791,101 +874,48 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
// thanks RennyC -- dumptruck_ds
e.health = ARMY_HEALTH;
+ e.checkattack = monster_army_checkattack;
+ e.destroy = monster_army_destroy;
+ e.sightsound = monster_army_sightsound;
+
e.th_stand = army_stand1;
e.th_walk = army_walk1;
- if (e.spawnflags & I_AM_TURRET)
+ if (e.spawnflags & SPAWNFLAG_MONSTER_TURRET)
e.th_run = army_seek_stand1;
else
e.th_run = army_run1;
e.th_missile = army_atk1;
e.th_turret = army_tur_atk1;
- if !(e.berserk)
- // Berserk test from
- // celephais.net/board/view_thread.php?id=4&start=3465
- // -- dumptruck_ds
- e.th_pain = monster_army_pain;
- else
+ // changed berserk test from field to flag -- CEV
+ if (self.spawnflags & SPAWNFLAG_MONSTER_BERSERK)
e.th_pain = sub_nullpain;
+ else
+ e.th_pain = monster_army_pain;
+ #endif
- e.destroy = monster_army_destroy;
-
- e.checkattack = monster_army_checkattack;
- e.sightsound = monster_army_sightsound;
-
- // walkmonster_start
- base_walkmonster_init (e);
+ // InitMonster -- runs on both client & server -- CEV
+ base_monster_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() monster_army =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags & fields, inhibit if necessary -- CEV
+ BASE_MONSTER_PREINIT (base_monster_init_field)
monster_army_init (self);
};
+#endif
// };
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-/*QUAKED gib_head_army (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/h_guard.mdl");
-}
-*/
-//----------------------------------------------------------------------
-// class gib_head_army: base_gib_head
-// {
- //--------------------------------------------------------------
- // ThrowHead
- //--------------------------------------------------------------
- void(entity act, vector dir, float dmg) throw_gib_head_army =
- {
- base_gib_head_throw (act, dir, dmg, gib_head_army_init);
- };
-
- //--------------------------------------------------------------
- void(entity e) gib_head_army_init =
- {
- e.classname = "gib_head_army";
- e.classtype = CT_GORE_HEAD_ARMY;
-
- // gib_init interprets spawnflags and will set .solid -- CEV
- base_gib_head_init (e);
-
- if (e.mdl_head != "")
- {
- precache_model (e.mdl_head);
- setmodel (e, e.mdl_head);
- }
- else
- {
- precache_model ("progs/h_guard.mdl");
- setmodel (e, "progs/h_guard.mdl");
- if (e.solid == SOLID_BBOX)
- setsize (e, ARMY_HEAD_MINS, ARMY_HEAD_MAXS);
- else if (e.solid == SOLID_TRIGGER)
- setsize (e, '-16 -16 0', '16 16 56');
- }
-
- e.frame = 0;
- };
-
- //--------------------------------------------------------------
- void() gib_head_army =
- {
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- gib_head_army_init (self);
- };
-// };
-
+#ifdef SSQC
/*QUAKED monster_dead_army (0 0.5 0.8) (-16 -16 -24) (16 16 32) SOLID FACE_UP X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ({"path":"progs/soldier.mdl","frame":28});
@@ -902,6 +932,7 @@ model ("progs/h_guard.mdl");
precache_model ("progs/soldier.mdl");
setmodel (e, "progs/soldier.mdl");
+ // TODO CEV
if (e.spawnflags & 2)
{
e.frame = $death10;
@@ -929,3 +960,8 @@ model ("progs/h_guard.mdl");
monster_dead_army_init (self);
};
// };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+$flush
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/monsters/wizard.qc
diff --git a/qc/monsters/wizard.qc b/qc/monsters/wizard.qc
index 78c3c3c..b209fab 100644
--- a/qc/monsters/wizard.qc
+++ b/qc/monsters/wizard.qc
@@ -6,27 +6,36 @@
// constants
//======================================================================
+#ifdef SSQC
const float WIZARD_HEALTH = 80; // id1 80
const float WIZARD_HEALTH_CORPSE = 30;
+#endif
-const vector WIZARD_HEAD_MINS = '-10.41 -8.66 -0.54';
-const vector WIZARD_HEAD_MAXS = '6.52 10.82 30';
+#if defined(CSQC) || defined(SSQC)
+const vector WIZARD_MINS = '-16 -16 -24';
+const vector WIZARD_MAXS = '16 16 40';
const vector WIZARD_CORPSE_MINS = '-50.75 -27.46 -55.19';
const vector WIZARD_CORPSE_MAXS = '31.81 33.61 30';
const vector WIZARD_CORPSE_Z_MINS = '-20 -20 -24';
const vector WIZARD_CORPSE_Z_MAXS = '20 20 -8';
+#endif
//======================================================================
// forward declarations
//======================================================================
// monster_wizard
+#ifdef CSQC
+void(float isnew) monster_wizard_netreceive;
+#endif
+#ifdef SSQC
// void() monster_wizard_attack_ranged; // AI & attacks
void() monster_wizard_attackfinished;
void() monster_wizard_sightsound;
void() monster_wizard_attacksound;
void() monster_wizard_idlesound;
float() monster_wizard_checkattack; // animation & thinking below
+// F() // macro to set FRAME netflag -- CEV
void() wiz_stand1; void() wiz_stand2; void() wiz_stand3; void() wiz_stand4;
void() wiz_stand5; void() wiz_stand6; void() wiz_stand7; void() wiz_stand8;
void() wiz_walk1; void() wiz_walk2; void() wiz_walk3; void() wiz_walk4;
@@ -45,24 +54,27 @@ void() wiz_death1; void() wiz_death2; void() wiz_death3; void() wiz_death4;
void() wiz_death5; void() wiz_death6; void() wiz_death7; void() wiz_death8;
void(entity attacker, float damage) monster_wizard_pain; // interaction
void(vector dir) monster_wizard_destroy;
-entity(vector org, vector ang, float sflags, float yaw, float angry)
+entity(vector org, vector ang, float sflags, float yaw)
spawn_monster_wizard; // initialization
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) monster_wizard_init;
+#endif
+#ifdef SSQC
void() monster_wizard;
+#endif
-// gib_head_wizard
-void(entity act, vector dir, float dmg) throw_gib_head_wizard;
-void(entity e) gib_head_wizard_init;
-void() gib_head_wizard;
-
+#ifdef SSQC
// monster_dead_wizard
void(entity e) monster_dead_wizard_init;
void() monster_dead_wizard;
+#endif
//======================================================================
// frame macros
//======================================================================
+#if defined(CSQC) || defined(SSQC)
$cd id1/models/a_wizard
$origin 0 0 24
$base wizbase
@@ -81,6 +93,10 @@ $frame pain1 pain2 pain3 pain4
$frame death1 death2 death3 death4 death5 death6 death7 death8
+// MG1 compat -- CEV
+const float CORPSEFRAME_WIZARD_1 = $death8;
+#endif
+
//------------------------------------------------------------------------------
/*QUAKED monster_wizard (1 0 0) (-16 -16 -24) (16 16 40) AMBUSH X X TRIGGER_SPAWNED X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
@@ -146,8 +162,39 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
*/
//----------------------------------------------------------------------
-// class monster_wizard: base_flymonster
+// class monster_wizard: base_monster
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) monster_wizard_netreceive =
+ {
+ // creates the newframe and netflags variables -- CEV
+ BASE_MONSTER_NETRECEIVE (monster_wizard_init,
+ WIZARD_MINS, WIZARD_MAXS)
+
+ if (isnew)
+ base_entity_que_add (self, QUE_TYPE_ACTOR);
+
+ // make sure monster is SOLID_NOT and FL_FLY is subtracted
+ // on the client -- CEV
+ if (self.frame >= $death3 && self.frame <= $death8)
+ {
+ if (self.solid != SOLID_NOT)
+ self.solid = SOLID_NOT;
+ if (self.flags & FL_FLY)
+ self.flags &= ~FL_FLY;
+ }
+
+ #if 0
+ if (netflags & NETFLAG_BASE_ENTITY_ORIGIN)
+ dprint (sprintf("monster_wizard_netreceive: "
+ "ORIGIN %v; time %g\n",
+ self.origin - self.origin_net, time));
+ #endif
+ };
+#endif
+
+#ifdef SSQC
/*
void() monster_wizard_attack_ranged =
{
@@ -170,12 +217,18 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
self.attack_state = AS_SLIDING;
self.think = wiz_side1;
}
+
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME |
+ NETFLAG_BASE_ENTITY_ORIGIN_X |
+ NETFLAG_BASE_ENTITY_ORIGIN_Y |
+ NETFLAG_BASE_ENTITY_ORIGIN_Z |
+ NETFLAG_BASE_ENTITY_ANGLES;
};
//--------------------------------------------------------------
void() monster_wizard_sightsound =
{
- sound_sight (self, CHAN_VOICE, "wizard/wsight.wav",
+ sound (self, CHAN_VOICE, "wizard/wsight.wav",
VOL_HIGH, ATTN_NORM);
};
@@ -185,7 +238,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
void() monster_wizard_attacksound =
{
// this is a hack to fix Wizard custom attack sounds
- sound_attack (self, CHAN_AUTO, "wizard/wattack.wav",
+ sound (self, CHAN_AUTO, "wizard/wattack.wav",
VOL_HIGH, ATTN_NORM);
};
@@ -194,21 +247,20 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//--------------------------------------------------------------
void() monster_wizard_idlesound =
{
- local float wr = random() * 5;
-
if (self.fly_sound < time)
{
+ local float wr = random() * 5;
self.fly_sound = time + 2;
+
if (wr > 4.5)
- sound_idle (self, CHAN_VOICE,
+ sound (self, CHAN_VOICE,
"wizard/widle1.wav",
VOL_HIGH, ATTN_IDLE);
if (wr < 1.5)
- sound_misc (self, CHAN_VOICE,
+ sound (self, CHAN_VOICE,
"wizard/widle2.wav",
VOL_HIGH, ATTN_IDLE);
}
- return;
};
//--------------------------------------------------------------
@@ -232,6 +284,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
self.attack_state = AS_STRAIGHT;
wiz_run1 ();
}
+
return FALSE;
}
@@ -244,12 +297,14 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
traceline (spot1, spot2, FALSE, self);
if (trace_ent != targ)
- { // don't have a clear shot, so move to a side
+ {
+ // don't have a clear shot, so move to a side
if (self.attack_state != AS_STRAIGHT)
{
self.attack_state = AS_STRAIGHT;
wiz_run1 ();
}
+
return FALSE;
}
@@ -289,16 +344,25 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
};
//--------------------------------------------------------------
+ #define F() \
+ /* { */ \
+ if (!(self.SendFlags & NETFLAG_BASE_ENTITY_FRAME)) \
+ { \
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME; \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
// Stationary wizard (?)
//--------------------------------------------------------------
- void() wiz_stand1 = [$hover1, wiz_stand2] { ai_stand (); };
- void() wiz_stand2 = [$hover2, wiz_stand3] { ai_stand (); };
- void() wiz_stand3 = [$hover3, wiz_stand4] { ai_stand (); };
- void() wiz_stand4 = [$hover4, wiz_stand5] { ai_stand (); };
- void() wiz_stand5 = [$hover5, wiz_stand6] { ai_stand (); };
- void() wiz_stand6 = [$hover6, wiz_stand7] { ai_stand (); };
- void() wiz_stand7 = [$hover7, wiz_stand8] { ai_stand (); };
- void() wiz_stand8 = [$hover8, wiz_stand1] { ai_stand (); };
+ void() wiz_stand1 = [$hover1, wiz_stand2] { ai_stand (); F () };
+ void() wiz_stand2 = [$hover2, wiz_stand3] { ai_stand (); F () };
+ void() wiz_stand3 = [$hover3, wiz_stand4] { ai_stand (); F () };
+ void() wiz_stand4 = [$hover4, wiz_stand5] { ai_stand (); F () };
+ void() wiz_stand5 = [$hover5, wiz_stand6] { ai_stand (); F () };
+ void() wiz_stand6 = [$hover6, wiz_stand7] { ai_stand (); F () };
+ void() wiz_stand7 = [$hover7, wiz_stand8] { ai_stand (); F () };
+ void() wiz_stand8 = [$hover8, wiz_stand1] { ai_stand (); F () };
//--------------------------------------------------------------
// Can a Wizard walk?
@@ -307,14 +371,15 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
{
ai_walk (8);
monster_wizard_idlesound ();
+ F ()
};
- void() wiz_walk2 = [$hover2, wiz_walk3] { ai_walk (8); };
- void() wiz_walk3 = [$hover3, wiz_walk4] { ai_walk (8); };
- void() wiz_walk4 = [$hover4, wiz_walk5] { ai_walk (8); };
- void() wiz_walk5 = [$hover5, wiz_walk6] { ai_walk (8); };
- void() wiz_walk6 = [$hover6, wiz_walk7] { ai_walk (8); };
- void() wiz_walk7 = [$hover7, wiz_walk8] { ai_walk (8); };
- void() wiz_walk8 = [$hover8, wiz_walk1] { ai_walk (8); };
+ void() wiz_walk2 = [$hover2, wiz_walk3] { ai_walk (8); F () };
+ void() wiz_walk3 = [$hover3, wiz_walk4] { ai_walk (8); F () };
+ void() wiz_walk4 = [$hover4, wiz_walk5] { ai_walk (8); F () };
+ void() wiz_walk5 = [$hover5, wiz_walk6] { ai_walk (8); F () };
+ void() wiz_walk6 = [$hover6, wiz_walk7] { ai_walk (8); F () };
+ void() wiz_walk7 = [$hover7, wiz_walk8] { ai_walk (8); F () };
+ void() wiz_walk8 = [$hover8, wiz_walk1] { ai_walk (8); F () };
//--------------------------------------------------------------
// Wizards _can_ move side-to-side...
@@ -323,14 +388,15 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
{
ai_run (8);
monster_wizard_idlesound ();
+ F ()
};
- void() wiz_side2 = [$hover2, wiz_side3] { ai_run (8); };
- void() wiz_side3 = [$hover3, wiz_side4] { ai_run (8); };
- void() wiz_side4 = [$hover4, wiz_side5] { ai_run (8); };
- void() wiz_side5 = [$hover5, wiz_side6] { ai_run (8); };
- void() wiz_side6 = [$hover6, wiz_side7] { ai_run (8); };
- void() wiz_side7 = [$hover7, wiz_side8] { ai_run (8); };
- void() wiz_side8 = [$hover8, wiz_side1] { ai_run (8); };
+ void() wiz_side2 = [$hover2, wiz_side3] { ai_run (8); F () };
+ void() wiz_side3 = [$hover3, wiz_side4] { ai_run (8); F () };
+ void() wiz_side4 = [$hover4, wiz_side5] { ai_run (8); F () };
+ void() wiz_side5 = [$hover5, wiz_side6] { ai_run (8); F () };
+ void() wiz_side6 = [$hover6, wiz_side7] { ai_run (8); F () };
+ void() wiz_side7 = [$hover7, wiz_side8] { ai_run (8); F () };
+ void() wiz_side8 = [$hover8, wiz_side1] { ai_run (8); F () };
//--------------------------------------------------------------
// Wizard workout
@@ -339,20 +405,21 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
{
ai_run (16);
monster_wizard_idlesound ();
+ F ()
};
- void() wiz_run2 = [$fly2, wiz_run3] { ai_run (16); };
- void() wiz_run3 = [$fly3, wiz_run4] { ai_run (16); };
- void() wiz_run4 = [$fly4, wiz_run5] { ai_run (16); };
- void() wiz_run5 = [$fly5, wiz_run6] { ai_run (16); };
- void() wiz_run6 = [$fly6, wiz_run7] { ai_run (16); };
- void() wiz_run7 = [$fly7, wiz_run8] { ai_run (16); };
- void() wiz_run8 = [$fly8, wiz_run9] { ai_run (16); };
- void() wiz_run9 = [$fly9, wiz_run10] { ai_run (16); };
- void() wiz_run10 = [$fly10, wiz_run11] { ai_run (16); };
- void() wiz_run11 = [$fly11, wiz_run12] { ai_run (16); };
- void() wiz_run12 = [$fly12, wiz_run13] { ai_run (16); };
- void() wiz_run13 = [$fly13, wiz_run14] { ai_run (16); };
- void() wiz_run14 = [$fly14, wiz_run1] { ai_run (16); };
+ void() wiz_run2 = [$fly2, wiz_run3] { ai_run (16); F () };
+ void() wiz_run3 = [$fly3, wiz_run4] { ai_run (16); F () };
+ void() wiz_run4 = [$fly4, wiz_run5] { ai_run (16); F () };
+ void() wiz_run5 = [$fly5, wiz_run6] { ai_run (16); F () };
+ void() wiz_run6 = [$fly6, wiz_run7] { ai_run (16); F () };
+ void() wiz_run7 = [$fly7, wiz_run8] { ai_run (16); F () };
+ void() wiz_run8 = [$fly8, wiz_run9] { ai_run (16); F () };
+ void() wiz_run9 = [$fly9, wiz_run10] { ai_run (16); F () };
+ void() wiz_run10 = [$fly10, wiz_run11] { ai_run (16); F () };
+ void() wiz_run11 = [$fly11, wiz_run12] { ai_run (16); F () };
+ void() wiz_run12 = [$fly12, wiz_run13] { ai_run (16); F () };
+ void() wiz_run13 = [$fly13, wiz_run14] { ai_run (16); F () };
+ void() wiz_run14 = [$fly14, wiz_run1] { ai_run (16); F () };
//--------------------------------------------------------------
// ~Fast~ Wizards
@@ -362,33 +429,36 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
ai_face ();
base_monster_fire_wizardspell ();
monster_wizard_attacksound ();
+ F ()
};
- void() wiz_fast2 = [$magatt2, wiz_fast3] { ai_face (); };
- void() wiz_fast3 = [$magatt3, wiz_fast4] { ai_face (); };
- void() wiz_fast4 = [$magatt4, wiz_fast5] { ai_face (); };
- void() wiz_fast5 = [$magatt5, wiz_fast6] { ai_face (); };
- void() wiz_fast6 = [$magatt6, wiz_fast7] { ai_face (); };
+ void() wiz_fast2 = [$magatt2, wiz_fast3] { ai_face (); F () };
+ void() wiz_fast3 = [$magatt3, wiz_fast4] { ai_face (); F () };
+ void() wiz_fast4 = [$magatt4, wiz_fast5] { ai_face (); F () };
+ void() wiz_fast5 = [$magatt5, wiz_fast6] { ai_face (); F () };
+ void() wiz_fast6 = [$magatt6, wiz_fast7] { ai_face (); F () };
void() wiz_fast7 = [$magatt5, wiz_fast8]
{
ai_face ();
monster_wizard_attacksound ();
+ F ()
};
- void() wiz_fast8 = [$magatt4, wiz_fast9] { ai_face (); };
- void() wiz_fast9 = [$magatt3, wiz_fast10] { ai_face (); };
+ void() wiz_fast8 = [$magatt4, wiz_fast9] { ai_face (); F () };
+ void() wiz_fast9 = [$magatt3, wiz_fast10] { ai_face (); F () };
void() wiz_fast10 = [$magatt2, wiz_run1]
{
ai_face ();
sub_attackfinished (2);
monster_wizard_attackfinished ();
+ F ()
};
//--------------------------------------------------------------
// Wizard Pain State
//--------------------------------------------------------------
- void() wiz_pain1 = [$pain1, wiz_pain2] { };
- void() wiz_pain2 = [$pain2, wiz_pain3] { };
- void() wiz_pain3 = [$pain3, wiz_pain4] { };
- void() wiz_pain4 = [$pain4, wiz_run1] { };
+ void() wiz_pain1 = [$pain1, wiz_pain2] { F () };
+ void() wiz_pain2 = [$pain2, wiz_pain3] { F () };
+ void() wiz_pain3 = [$pain3, wiz_pain4] { F () };
+ void() wiz_pain4 = [$pain4, wiz_run1] { F () };
//--------------------------------------------------------------
// Wizard Death State
@@ -400,20 +470,36 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
self.velocity_z = 100 + 100 * random ();
// self.flags = self.flags - (self.flags & FL_ONGROUND);
base_entity_aligntoground (self);
- sound_death (self, CHAN_VOICE, "wizard/wdeath.wav",
+ sound (self, CHAN_VOICE, "wizard/wdeath.wav",
VOL_HIGH, ATTN_NORM);
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME |
+ NETFLAG_BASE_ENTITY_ANGLES;
+ };
+ void() wiz_death2 = [$death2, wiz_death3] { F () };
+ void() wiz_death3 = [$death3, wiz_death4]
+ {
+ self.solid = SOLID_NOT;
+ F ()
};
- void() wiz_death2 = [$death2, wiz_death3] { };
- void() wiz_death3 = [$death3, wiz_death4] { self.solid = SOLID_NOT; };
- void() wiz_death4 = [$death4, wiz_death5] { };
- void() wiz_death5 = [$death5, wiz_death6] { };
- void() wiz_death6 = [$death6, wiz_death7] { };
+ void() wiz_death4 = [$death4, wiz_death5] { F () };
+ void() wiz_death5 = [$death5, wiz_death6] { F () };
+ void() wiz_death6 = [$death6, wiz_death7] { F () };
void() wiz_death7 = [$death7, wiz_death8]
{
become_base_corpse (self, WIZARD_HEALTH_CORPSE);
setsize (self, WIZARD_CORPSE_Z_MINS, WIZARD_CORPSE_Z_MAXS);
+ F ()
};
- void() wiz_death8 = [$death8, wiz_death8] { };
+ void() wiz_death8 = [$death8, wiz_death8]
+ {
+ if (self.origin != self.origin_net)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_ORIGIN |
+ NETFLAG_BASE_ENTITY_FRAME;
+ else if (self.frame_net != self.frame)
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME;
+ };
+
+ #undef F
//==============================================================
// Interaction
@@ -424,7 +510,7 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//--------------------------------------------------------------
void(entity attacker, float damage) monster_wizard_pain =
{
- sound_pain (self, CHAN_VOICE, "wizard/wpain.wav",
+ sound (self, CHAN_VOICE, "wizard/wpain.wav",
VOL_HIGH, ATTN_NORM);
if (random() * 70 > damage)
@@ -439,58 +525,22 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//--------------------------------------------------------------
void(vector dir) monster_wizard_destroy =
{
- // check if we're dead already
- if (self.classgroup & CG_CORPSE)
- {
- sound (self, CHAN_VOICE, "player/udeath.wav",
- VOL_HIGH, ATTN_NORM);
-
- throw_gib_head_wizard (self, dir, self.health);
-
- // custom models -- dumptruck_ds
- if (self.mdl_gib1 != "")
- throw_gib_1 (self, dir, self.health);
- else
- throw_gib_2 (self, dir, self.health);
-
- if (self.mdl_gib2 != "")
- throw_gib_2 (self, dir, self.health);
- else
- throw_gib_2 (self, dir, self.health);
-
- if (self.mdl_gib3 != "")
- throw_gib_3 (self, dir, self.health);
- else
- throw_gib_2 (self, dir, self.health);
-
- return;
- }
-
// check for gib
- if (self.health < -40)
+ if (self.classgroup & CG_CORPSE || self.health < -40)
{
sound (self, CHAN_VOICE, "player/udeath.wav",
VOL_HIGH, ATTN_NORM);
- throw_gib_head_wizard (self, dir, self.health);
-
- // custom models -- dumptruck_ds
- if (self.mdl_gib1 != "")
- throw_gib_1 (self, dir, self.health);
- else
- throw_gib_2 (self, dir, self.health);
-
- if (self.mdl_gib2 != "")
- throw_gib_2 (self, dir, self.health);
- else
- throw_gib_2 (self, dir, self.health);
+ if (!(self.classgroup & CG_CORPSE))
+ base_item_drop_stuff (self);
- if (self.mdl_gib3 != "")
- throw_gib_3 (self, dir, self.health);
- else
- throw_gib_2 (self, dir, self.health);
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib2_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib2_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib2_init)
+ BASE_ITEM_GIB_THROW (dir, self.health,
+ item_head_wizard_init)
- base_item_drop_stuff (self);
+ base_entity_remove (self);
return;
}
@@ -503,17 +553,20 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
//==============================================================
//--------------------------------------------------------------
- entity(vector org, vector ang, float sflags, float yaw, float angry)
+ entity(vector org, vector ang, float sflags, float yaw)
spawn_monster_wizard =
{
- return spawn_base_monster (org, ang, sflags, yaw, angry,
+ return spawn_base_monster (org, ang, sflags, yaw,
monster_wizard_init);
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) monster_wizard_init =
{
- if (e.spawnflags & I_AM_TURRET)
+ #ifdef SSQC
+ if (e.spawnflags & SPAWNFLAG_MONSTER_TURRET)
objerror("Incompatible spawnflag: TURRET_MODE\n");
if (deathmatch)
@@ -521,38 +574,41 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
remove (e);
return;
}
+ #endif
e.classname = "monster_wizard";
e.classtype = CT_MONSTER_SCRAG;
+ e.classgroup |= CG_MONSTER_FLY;
+ e.pos1 = WIZARD_MINS;
+ e.pos2 = WIZARD_MAXS;
- if (!e.mdl_proj)
- e.mdl_proj = "progs/w_spike.mdl";
+ #ifdef CSQC
+ if (e.modelindex)
+ {
+ setmodelindex (e, e.modelindex);
+ setsize (e, WIZARD_MINS, WIZARD_MAXS);
+ }
+ #endif
- // dumptruck_ds custom_mdls
- precache_body_model (e, "progs/wizard.mdl");
- precache_head_model (e, "progs/h_wizard.mdl");
- precache_proj_model (e, "progs/w_spike.mdl");
- // dumptruck_ds
+ #ifdef SSQC
+ precache_model ("progs/wizard.mdl");
+ precache_model ("progs/h_wizard.mdl");
+ precache_model ("progs/w_spike.mdl");
// wizard/hit used by c code
- precache_sound_hit (e, "wizard/hit.wav");
- precache_sound_attack (e, "wizard/wattack.wav");
- precache_sound_death (e, "wizard/wdeath.wav");
- precache_sound_idle (e, "wizard/widle1.wav");
- precache_sound_misc (e, "wizard/widle2.wav");
- precache_sound_pain (e, "wizard/wpain.wav");
- precache_sound_sight (e, "wizard/wsight.wav");
-
- precache_gib1 (e, "progs/gib1.mdl");
- precache_gib2 (e, "progs/gib2.mdl");
- precache_gib3 (e, "progs/gib3.mdl");
-
- e.solid = SOLID_SLIDEBOX;
- e.movetype = MOVETYPE_STEP;
+ precache_sound ("wizard/hit.wav");
+ precache_sound ("wizard/wattack.wav");
+ precache_sound ("wizard/wdeath.wav");
+ precache_sound ("wizard/widle1.wav");
+ precache_sound ("wizard/widle2.wav");
+ precache_sound ("wizard/wpain.wav");
+ precache_sound ("wizard/wsight.wav");
- body_model (e, "progs/wizard.mdl");
- // setmodel (e, "progs/wizard.mdl"); //dumptruck_ds
+ precache_model ("progs/gib1.mdl");
+ precache_model ("progs/gib2.mdl");
+ precache_model ("progs/gib3.mdl");
- setsize (e, '-16 -16 -24', '16 16 40');
+ // set up model and size for later -- CEV
+ e.mdl = "progs/wizard.mdl";
if (!e.proj_speed_mod)
e.proj_speed_mod = 1;
@@ -562,93 +618,43 @@ damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by
e.health = WIZARD_HEALTH;
e.checkattack = monster_wizard_checkattack;
+ e.destroy = monster_wizard_destroy;
e.sightsound = monster_wizard_sightsound;
+
e.th_stand = wiz_stand1;
e.th_walk = wiz_walk1;
e.th_run = wiz_run1;
e.th_missile = wiz_fast1;
- // Berserk test from
- // http://celephais.net/board/view_thread.php?id=4&start=3465
- // -- dumptruck_ds
- if !(e.berserk)
- e.th_pain = monster_wizard_pain;
- else
+
+ // changed berserk test from field to flag -- CEV
+ if (self.spawnflags & SPAWNFLAG_MONSTER_BERSERK)
e.th_pain = sub_nullpain;
- e.destroy = monster_wizard_destroy;
+ else
+ e.th_pain = monster_wizard_pain;
+ #endif
- // flymonster_starts
- base_flymonster_init (e);
+ // InitMonster -- runs on both client & server -- CEV
+ base_monster_init (e);
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() monster_wizard =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags & fields, inhibit if necessary -- CEV
+ BASE_MONSTER_PREINIT (base_monster_init_field)
monster_wizard_init (self);
};
+#endif
// };
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
// Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-/*QUAKED gib_head_wizard (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/h_wizard.mdl");
-}*/
-//----------------------------------------------------------------------
-// class gib_head_wizard: base_gib_head
-// {
- //--------------------------------------------------------------
- // ThrowHead
- //--------------------------------------------------------------
- void(entity act, vector dir, float dmg) throw_gib_head_wizard =
- {
- base_gib_head_throw (act, dir, dmg, gib_head_wizard_init);
- };
-
- //--------------------------------------------------------------
- void(entity e) gib_head_wizard_init =
- {
- e.classname = "gib_head_wizard";
- e.classtype = CT_GORE_HEAD_WIZARD;
-
- // gib_init interprets spawnflags and will set .solid -- CEV
- base_gib_head_init (e);
-
- if (e.mdl_head != "")
- {
- precache_model (e.mdl_head);
- setmodel (e, e.mdl_head);
- }
- else
- {
- precache_model ("progs/h_wizard.mdl");
- setmodel (e, "progs/h_wizard.mdl");
- if (e.solid == SOLID_BBOX)
- setsize (e, WIZARD_HEAD_MINS,
- WIZARD_HEAD_MAXS);
- else if (e.solid == SOLID_TRIGGER)
- setsize (e, '-16 -16 0', '16 16 56');
- }
-
- e.frame = 0;
- };
-
- //--------------------------------------------------------------
- void() gib_head_wizard =
- {
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- gib_head_wizard_init (self);
- };
-// };
-
+#ifdef SSQC
/*QUAKED monster_dead_wizard (0 0.5 0.8) (-16 -16 -24) (16 16 32) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ({"path":"progs/wizard.mdl","frame":53});
@@ -680,3 +686,8 @@ model ("progs/h_wizard.mdl");
monster_dead_wizard_init (self);
};
// };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+$flush
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/monsters/zombie.qc
diff --git a/qc/monsters/zombie.qc b/qc/monsters/zombie.qc
index 9c5dbbc..ba0a17a 100644
--- a/qc/monsters/zombie.qc
+++ b/qc/monsters/zombie.qc
@@ -6,28 +6,59 @@
//==============================================================================
//======================================================================
-// Constants - spawnflags
+// Constants
//======================================================================
-const float ZOMBIE_SPAWN_CRUCIFIED = 1;
-const float ZOMBIE_SPAWN_DEAD_CRUCIFIED = 4;
-// const float ZOMBIE_SPAWN_DEAD = 4; // from Zer src, saved for reference
-// const float ZOMBIE_SPAWN_DEAD_CRUCIFIED = 8; // from Zer src, for reference
-const float ZOMBIE_SPAWN_SLEEPING = 16; // changed from 2 which was Zer default
-
+#ifdef SSQC
+//----------------------------------------------------------------------
+// monster zombie spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_MONSTER_ZOMBIE_CRUCIFIED = 1, // animated dead
+ SPAWNFLAG_MONSTER_ZOMBIE_DEAD_CRUCIFIED = 4, // motionless dead
+ // SPAWN_DEAD = 4, // from Zer src, for reference
+ // SPAWN_DEAD_CRUCIFIED = 8, // from Zer src again
+ SPAWNFLAG_MONSTER_ZOMBIE_SLEEPING = 16 // Zer default was 2
+ // SPAWNFLAG_MONSTER_NO_SIGHT_SOUND = 32, // see base_monster.qc -- CEV
+ // SPAWNFLAG_MONSTER_PASSIVE_UNTIL_ATTACKED = 64,
+ // SPAWNFLAG_MONSTER_PASSIVE_ALWAYS = 128,
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024, // base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_IN_COOP = 4096, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_IN_SP = 8192, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+ // SPAWNFLAG_MONSTER_TURRET = 262144, // see base_monster.qc -- CEV
+ // SPAWNFLAG_MONSTER_SILENT = 2097152 // see base_monster.qc -- CEV
+} monster_zombie_spawnflags;
+#endif
+
+#ifdef SSQC
const float ZOMBIE_HEALTH = 61; // pd3 61
+#endif
-const vector ZOMBIE_HEAD_MINS = '-16 -16 0'; // not exact size -- CEV
-const vector ZOMBIE_HEAD_MAXS = '16 16 56';
+#if defined(CSQC) || defined(SSQC)
+const vector ZOMBIE_MINS = '-16 -16 -24';
+const vector ZOMBIE_MAXS = '16 16 40';
+#endif
//======================================================================
// forward declarations
//======================================================================
// monster_zombie
+#ifdef CSQC
+void(float isnew) monster_zombie_netreceive;
+#endif
+#ifdef SSQC
void() monster_zombie_sightsound; // AI & attacks
void() monster_zombie_attack_missile;
void() monster_zombie_attack_turretmissile;
+// F() // macro to set FRAME netflag -- CEV
void() zom_dead_cruc1; // animation & thinking
void() zom_cruc1; void() zom_cruc2; void() zom_cruc3; void() zom_cruc4;
void() zom_cruc5; void() zom_cruc6;
@@ -107,20 +138,21 @@ void(vector dir) monster_zombie_destroy;
void() monster_zombie_use;
void() monster_zombie_decide; // initialization
void() monster_zombie_start;
-entity(vector org, vector ang, float sflags, float yaw, float angry)
+entity(vector org, vector ang, float sflags, float yaw)
spawn_monster_zombie;
+#endif
+#if defined(CSQC) || defined(SSQC)
void(entity e) monster_zombie_init;
+#endif
+#ifdef SSQC
void() monster_zombie;
-
-// gib_head_zombie
-void(entity act, vector dir, float dmg) throw_gib_head_zombie;
-void(entity e) gib_head_zombie_init;
-void() gib_head_zombie;
+#endif
//======================================================================
// frame macros
//======================================================================
+#ifdef SSQC
$cd /raid/quake/id1/models/zombie
$origin 0 0 24
$base base
@@ -163,6 +195,7 @@ $frame paine20 paine21 paine22 paine23 paine24 paine25 paine26 paine27 paine28
$frame paine29 paine30
$frame cruc_1 cruc_2 cruc_3 cruc_4 cruc_5 cruc_6
+#endif
//------------------------------------------------------------------------------
@@ -236,12 +269,26 @@ spawnflags(Flags) =
16 : "Spawn Sleeping"
*/
//----------------------------------------------------------------------
-// class monster_zombie: base_walkmonster
+// class monster_zombie: base_monster
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) monster_zombie_netreceive =
+ {
+ // creates the newframe and netflags variables -- CEV
+ BASE_MONSTER_NETRECEIVE (monster_zombie_init,
+ ZOMBIE_MINS, ZOMBIE_MAXS)
+
+ if (isnew)
+ base_entity_que_add (self, QUE_TYPE_ACTOR);
+ };
+#endif
+
+#ifdef SSQC
//--------------------------------------------------------------
void() monster_zombie_sightsound =
{
- sound_sight (self, CHAN_VOICE, "zombie/z_idle.wav",
+ sound (self, CHAN_VOICE, "zombie/z_idle.wav",
VOL_HIGH, ATTN_NORM);
};
@@ -276,11 +323,21 @@ spawnflags(Flags) =
};
//--------------------------------------------------------------
+ #define F() \
+ /* { */ \
+ if (!(self.SendFlags & NETFLAG_BASE_ENTITY_FRAME)) \
+ { \
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME; \
+ } \
+ /* } */
+
+ //--------------------------------------------------------------
// motionless crucified zombie
//--------------------------------------------------------------
void() zom_dead_cruc1 = [$cruc_1, zom_dead_cruc1]
{
self.nextthink = time + 1;
+ F ()
};
//--------------------------------------------------------------
@@ -289,28 +346,34 @@ spawnflags(Flags) =
void() zom_cruc1 = [$cruc_1, zom_cruc2]
{
if (random() < 0.1)
- sound_idle (self, CHAN_VOICE, "zombie/idle_w2.wav",
+ sound (self, CHAN_VOICE, "zombie/idle_w2.wav",
VOL_HIGH, ATTN_STATIC);
+ F ()
};
void() zom_cruc2 = [$cruc_2, zom_cruc3]
{
self.nextthink = time + 0.1 + random() * 0.1;
+ F ()
};
void() zom_cruc3 = [$cruc_3, zom_cruc4]
{
self.nextthink = time + 0.1 + random() * 0.1;
+ F ()
};
void() zom_cruc4 = [$cruc_4, zom_cruc5]
{
self.nextthink = time + 0.1 + random() * 0.1;
+ F ()
};
void() zom_cruc5 = [$cruc_5, zom_cruc6]
{
self.nextthink = time + 0.1 + random() * 0.1;
+ F ()
};
void() zom_cruc6 = [$cruc_6, zom_cruc1]
{
self.nextthink = time + 0.1 + random() * 0.1;
+ F ()
};
//--------------------------------------------------------------
@@ -323,11 +386,14 @@ spawnflags(Flags) =
// sleeping until triggered!
if (self.count == 0)
ai_stand ();
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME |
+ NETFLAG_BASE_ENTITY_SOLID;
};
void() zom_stand2 = [$paine11, zom_stand1]
{
if (self.count == 0)
ai_stand ();
+ F ()
};
//--------------------------------------------------------------
@@ -337,21 +403,22 @@ spawnflags(Flags) =
{
self.health = 60;
ai_stand ();
+ F ()
};
- void() zom_alt_stand2 = [$stand2, zom_stand3] { ai_stand (); };
- void() zom_stand3 = [$stand3, zom_stand4] { ai_stand (); };
- void() zom_stand4 = [$stand4, zom_stand5] { ai_stand (); };
- void() zom_stand5 = [$stand5, zom_stand6] { ai_stand (); };
- void() zom_stand6 = [$stand6, zom_stand7] { ai_stand (); };
- void() zom_stand7 = [$stand7, zom_stand8] { ai_stand (); };
- void() zom_stand8 = [$stand8, zom_stand9] { ai_stand (); };
- void() zom_stand9 = [$stand9, zom_stand10] { ai_stand (); };
- void() zom_stand10 = [$stand10, zom_stand11] { ai_stand (); };
- void() zom_stand11 = [$stand11, zom_stand12] { ai_stand (); };
- void() zom_stand12 = [$stand12, zom_stand13] { ai_stand (); };
- void() zom_stand13 = [$stand13, zom_stand14] { ai_stand (); };
- void() zom_stand14 = [$stand14, zom_stand15] { ai_stand (); };
- void() zom_stand15 = [$stand15, zom_alt_stand1] { ai_stand (); };
+ void() zom_alt_stand2 = [$stand2, zom_stand3] { ai_stand (); F () };
+ void() zom_stand3 = [$stand3, zom_stand4] { ai_stand (); F () };
+ void() zom_stand4 = [$stand4, zom_stand5] { ai_stand (); F () };
+ void() zom_stand5 = [$stand5, zom_stand6] { ai_stand (); F () };
+ void() zom_stand6 = [$stand6, zom_stand7] { ai_stand (); F () };
+ void() zom_stand7 = [$stand7, zom_stand8] { ai_stand (); F () };
+ void() zom_stand8 = [$stand8, zom_stand9] { ai_stand (); F () };
+ void() zom_stand9 = [$stand9, zom_stand10] { ai_stand (); F () };
+ void() zom_stand10 = [$stand10, zom_stand11] { ai_stand (); F () };
+ void() zom_stand11 = [$stand11, zom_stand12] { ai_stand (); F () };
+ void() zom_stand12 = [$stand12, zom_stand13] { ai_stand (); F () };
+ void() zom_stand13 = [$stand13, zom_stand14] { ai_stand (); F () };
+ void() zom_stand14 = [$stand14, zom_stand15] { ai_stand (); F () };
+ void() zom_stand15 = [$stand15, zom_alt_stand1] { ai_stand (); F () };
//--------------------------------------------------------------
// Zombie walk (shamble? shuffle?) functions
@@ -362,30 +429,33 @@ spawnflags(Flags) =
// so he doesn't fall
self.health = 60;
ai_walk (0);
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME |
+ NETFLAG_BASE_ENTITY_SOLID;
};
- void() zom_walk2 = [$walk2, zom_walk3] { ai_walk (2); };
- void() zom_walk3 = [$walk3, zom_walk4] { ai_walk (3); };
- void() zom_walk4 = [$walk4, zom_walk5] { ai_walk (2); };
- void() zom_walk5 = [$walk5, zom_walk6] { ai_walk (1); };
- void() zom_walk6 = [$walk6, zom_walk7] { ai_walk (0); };
- void() zom_walk7 = [$walk7, zom_walk8] { ai_walk (0); };
- void() zom_walk8 = [$walk8, zom_walk9] { ai_walk (0); };
- void() zom_walk9 = [$walk9, zom_walk10] { ai_walk (0); };
- void() zom_walk10 = [$walk10, zom_walk11] { ai_walk (0); };
- void() zom_walk11 = [$walk11, zom_walk12] { ai_walk (2); };
- void() zom_walk12 = [$walk12, zom_walk13] { ai_walk (2); };
- void() zom_walk13 = [$walk13, zom_walk14] { ai_walk (1); };
- void() zom_walk14 = [$walk14, zom_walk15] { ai_walk (0); };
- void() zom_walk15 = [$walk15, zom_walk16] { ai_walk (0); };
- void() zom_walk16 = [$walk16, zom_walk17] { ai_walk (0); };
- void() zom_walk17 = [$walk17, zom_walk18] { ai_walk (0); };
- void() zom_walk18 = [$walk18, zom_walk19] { ai_walk (0); };
+ void() zom_walk2 = [$walk2, zom_walk3] { ai_walk (2); F () };
+ void() zom_walk3 = [$walk3, zom_walk4] { ai_walk (3); F () };
+ void() zom_walk4 = [$walk4, zom_walk5] { ai_walk (2); F () };
+ void() zom_walk5 = [$walk5, zom_walk6] { ai_walk (1); F () };
+ void() zom_walk6 = [$walk6, zom_walk7] { ai_walk (0); F () };
+ void() zom_walk7 = [$walk7, zom_walk8] { ai_walk (0); F () };
+ void() zom_walk8 = [$walk8, zom_walk9] { ai_walk (0); F () };
+ void() zom_walk9 = [$walk9, zom_walk10] { ai_walk (0); F () };
+ void() zom_walk10 = [$walk10, zom_walk11] { ai_walk (0); F () };
+ void() zom_walk11 = [$walk11, zom_walk12] { ai_walk (2); F () };
+ void() zom_walk12 = [$walk12, zom_walk13] { ai_walk (2); F () };
+ void() zom_walk13 = [$walk13, zom_walk14] { ai_walk (1); F () };
+ void() zom_walk14 = [$walk14, zom_walk15] { ai_walk (0); F () };
+ void() zom_walk15 = [$walk15, zom_walk16] { ai_walk (0); F () };
+ void() zom_walk16 = [$walk16, zom_walk17] { ai_walk (0); F () };
+ void() zom_walk17 = [$walk17, zom_walk18] { ai_walk (0); F () };
+ void() zom_walk18 = [$walk18, zom_walk19] { ai_walk (0); F () };
void() zom_walk19 = [$walk19, zom_walk1]
{
ai_walk (0);
if (random() < 0.2)
- sound_misc (self, CHAN_VOICE, "zombie/z_idle.wav",
+ sound (self, CHAN_VOICE, "zombie/z_idle.wav",
VOL_HIGH, ATTN_IDLE);
+ F ()
};
//--------------------------------------------------------------
@@ -393,106 +463,111 @@ spawnflags(Flags) =
//--------------------------------------------------------------
void() zom_run1 = [$run1, zom_run2]
{
- if (self.spawnflags & ZOMBIE_SPAWN_SLEEPING)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_ZOMBIE_SLEEPING)
{
// sloppy hack, but it fixes the illusionary zombie bug
// custom_mdls dumptruck_ds
- body_model (self, "progs/zombie.mdl");
+ setmodel (self, "progs/zombie.mdl");
// setmodel (self, "progs/zombie.mdl");
setsize (self, '-16 -16 -24', '16 16 40');
}
ai_run (1);
// self.inpain = 0;
self.speed2 = 0;
+ F ()
};
- void() zom_run2 = [$run2, zom_run3] { ai_run (1); };
- void() zom_run3 = [$run3, zom_run4] { ai_run (0); };
- void() zom_run4 = [$run4, zom_run5] { ai_run (1); };
- void() zom_run5 = [$run5, zom_run6] { ai_run (2); };
- void() zom_run6 = [$run6, zom_run7] { ai_run (3); };
- void() zom_run7 = [$run7, zom_run8] { ai_run (4); };
- void() zom_run8 = [$run8, zom_run9] { ai_run (4); };
- void() zom_run9 = [$run9, zom_run10] { ai_run (2); };
- void() zom_run10 = [$run10, zom_run11] { ai_run (0); };
- void() zom_run11 = [$run11, zom_run12] { ai_run (0); };
- void() zom_run12 = [$run12, zom_run13] { ai_run (0); };
- void() zom_run13 = [$run13, zom_run14] { ai_run (2); };
- void() zom_run14 = [$run14, zom_run15] { ai_run (4); };
- void() zom_run15 = [$run15, zom_run16] { ai_run (6); };
- void() zom_run16 = [$run16, zom_run17] { ai_run (7); };
- void() zom_run17 = [$run17, zom_run18] { ai_run (3); };
+ void() zom_run2 = [$run2, zom_run3] { ai_run (1); F () };
+ void() zom_run3 = [$run3, zom_run4] { ai_run (0); F () };
+ void() zom_run4 = [$run4, zom_run5] { ai_run (1); F () };
+ void() zom_run5 = [$run5, zom_run6] { ai_run (2); F () };
+ void() zom_run6 = [$run6, zom_run7] { ai_run (3); F () };
+ void() zom_run7 = [$run7, zom_run8] { ai_run (4); F () };
+ void() zom_run8 = [$run8, zom_run9] { ai_run (4); F () };
+ void() zom_run9 = [$run9, zom_run10] { ai_run (2); F () };
+ void() zom_run10 = [$run10, zom_run11] { ai_run (0); F () };
+ void() zom_run11 = [$run11, zom_run12] { ai_run (0); F () };
+ void() zom_run12 = [$run12, zom_run13] { ai_run (0); F () };
+ void() zom_run13 = [$run13, zom_run14] { ai_run (2); F () };
+ void() zom_run14 = [$run14, zom_run15] { ai_run (4); F () };
+ void() zom_run15 = [$run15, zom_run16] { ai_run (6); F () };
+ void() zom_run16 = [$run16, zom_run17] { ai_run (7); F () };
+ void() zom_run17 = [$run17, zom_run18] { ai_run (3); F () };
void() zom_run18 = [$run18, zom_run1]
{
ai_run (8);
if (random() < 0.2)
- sound_misc (self, CHAN_VOICE, "zombie/z_idle.wav",
+ sound (self, CHAN_VOICE, "zombie/z_idle.wav",
VOL_HIGH, ATTN_IDLE);
if (random() > 0.8)
- sound_sight (self, CHAN_VOICE, "zombie/z_idle1.wav",
+ sound (self, CHAN_VOICE, "zombie/z_idle1.wav",
VOL_HIGH, ATTN_IDLE);
+ F ()
};
//--------------------------------------------------------------
// Zombie Attack A
//--------------------------------------------------------------
- void() zom_atka1 = [$atta1, zom_atka2] { ai_face (); };
- void() zom_atka2 = [$atta2, zom_atka3] { ai_face (); };
- void() zom_atka3 = [$atta3, zom_atka4] { ai_face (); };
- void() zom_atka4 = [$atta4, zom_atka5] { ai_face (); };
- void() zom_atka5 = [$atta5, zom_atka6] { ai_face (); };
- void() zom_atka6 = [$atta6, zom_atka7] { ai_face (); };
- void() zom_atka7 = [$atta7, zom_atka8] { ai_face (); };
- void() zom_atka8 = [$atta8, zom_atka9] { ai_face (); };
- void() zom_atka9 = [$atta9, zom_atka10] { ai_face (); };
- void() zom_atka10 = [$atta10, zom_atka11] { ai_face (); };
- void() zom_atka11 = [$atta11, zom_atka12] { ai_face (); };
- void() zom_atka12 = [$atta12, zom_atka13] { ai_face (); };
+ void() zom_atka1 = [$atta1, zom_atka2] { ai_face (); F () };
+ void() zom_atka2 = [$atta2, zom_atka3] { ai_face (); F () };
+ void() zom_atka3 = [$atta3, zom_atka4] { ai_face (); F () };
+ void() zom_atka4 = [$atta4, zom_atka5] { ai_face (); F () };
+ void() zom_atka5 = [$atta5, zom_atka6] { ai_face (); F () };
+ void() zom_atka6 = [$atta6, zom_atka7] { ai_face (); F () };
+ void() zom_atka7 = [$atta7, zom_atka8] { ai_face (); F () };
+ void() zom_atka8 = [$atta8, zom_atka9] { ai_face (); F () };
+ void() zom_atka9 = [$atta9, zom_atka10] { ai_face (); F () };
+ void() zom_atka10 = [$atta10, zom_atka11] { ai_face (); F () };
+ void() zom_atka11 = [$atta11, zom_atka12] { ai_face (); F () };
+ void() zom_atka12 = [$atta12, zom_atka13] { ai_face (); F () };
void() zom_atka13 = [$atta13, zom_run1]
{
ai_face ();
base_monster_fire_zombiechunk ('-10 -22 30', 0);
+ F ()
};
//--------------------------------------------------------------
// Zombie Attack B
//--------------------------------------------------------------
- void() zom_atkb1 = [$attb1, zom_atkb2] { ai_face (); };
- void() zom_atkb2 = [$attb2, zom_atkb3] { ai_face (); };
- void() zom_atkb3 = [$attb3, zom_atkb4] { ai_face (); };
- void() zom_atkb4 = [$attb4, zom_atkb5] { ai_face (); };
- void() zom_atkb5 = [$attb5, zom_atkb6] { ai_face (); };
- void() zom_atkb6 = [$attb6, zom_atkb7] { ai_face (); };
- void() zom_atkb7 = [$attb7, zom_atkb8] { ai_face (); };
- void() zom_atkb8 = [$attb8, zom_atkb9] { ai_face (); };
- void() zom_atkb9 = [$attb9, zom_atkb10] { ai_face (); };
- void() zom_atkb10 = [$attb10, zom_atkb11] { ai_face (); };
- void() zom_atkb11 = [$attb11, zom_atkb12] { ai_face (); };
- void() zom_atkb12 = [$attb12, zom_atkb13] { ai_face (); };
- void() zom_atkb13 = [$attb13, zom_atkb14] { ai_face (); };
+ void() zom_atkb1 = [$attb1, zom_atkb2] { ai_face (); F () };
+ void() zom_atkb2 = [$attb2, zom_atkb3] { ai_face (); F () };
+ void() zom_atkb3 = [$attb3, zom_atkb4] { ai_face (); F () };
+ void() zom_atkb4 = [$attb4, zom_atkb5] { ai_face (); F () };
+ void() zom_atkb5 = [$attb5, zom_atkb6] { ai_face (); F () };
+ void() zom_atkb6 = [$attb6, zom_atkb7] { ai_face (); F () };
+ void() zom_atkb7 = [$attb7, zom_atkb8] { ai_face (); F () };
+ void() zom_atkb8 = [$attb8, zom_atkb9] { ai_face (); F () };
+ void() zom_atkb9 = [$attb9, zom_atkb10] { ai_face (); F () };
+ void() zom_atkb10 = [$attb10, zom_atkb11] { ai_face (); F () };
+ void() zom_atkb11 = [$attb11, zom_atkb12] { ai_face (); F () };
+ void() zom_atkb12 = [$attb12, zom_atkb13] { ai_face (); F () };
+ void() zom_atkb13 = [$attb13, zom_atkb14] { ai_face (); F () };
void() zom_atkb14 = [$attb13, zom_run1]
{
ai_face ();
base_monster_fire_zombiechunk ('-10 -24 29', 0);
+ F ()
};
//--------------------------------------------------------------
// Zombie Attack C
//--------------------------------------------------------------
- void() zom_atkc1 = [$attc1, zom_atkc2] { ai_face (); };
- void() zom_atkc2 = [$attc2, zom_atkc3] { ai_face (); };
- void() zom_atkc3 = [$attc3, zom_atkc4] { ai_face (); };
- void() zom_atkc4 = [$attc4, zom_atkc5] { ai_face (); };
- void() zom_atkc5 = [$attc5, zom_atkc6] { ai_face (); };
- void() zom_atkc6 = [$attc6, zom_atkc7] { ai_face (); };
- void() zom_atkc7 = [$attc7, zom_atkc8] { ai_face (); };
- void() zom_atkc8 = [$attc8, zom_atkc9] { ai_face (); };
- void() zom_atkc9 = [$attc9, zom_atkc10] { ai_face (); };
- void() zom_atkc10 = [$attc10, zom_atkc11] { ai_face (); };
- void() zom_atkc11 = [$attc11, zom_atkc12] { ai_face (); };
+ void() zom_atkc1 = [$attc1, zom_atkc2] { ai_face (); F () };
+ void() zom_atkc2 = [$attc2, zom_atkc3] { ai_face (); F () };
+ void() zom_atkc3 = [$attc3, zom_atkc4] { ai_face (); F () };
+ void() zom_atkc4 = [$attc4, zom_atkc5] { ai_face (); F () };
+ void() zom_atkc5 = [$attc5, zom_atkc6] { ai_face (); F () };
+ void() zom_atkc6 = [$attc6, zom_atkc7] { ai_face (); F () };
+ void() zom_atkc7 = [$attc7, zom_atkc8] { ai_face (); F () };
+ void() zom_atkc8 = [$attc8, zom_atkc9] { ai_face (); F () };
+ void() zom_atkc9 = [$attc9, zom_atkc10] { ai_face (); F () };
+ void() zom_atkc10 = [$attc10, zom_atkc11] { ai_face (); F () };
+ void() zom_atkc11 = [$attc11, zom_atkc12] { ai_face (); F () };
void() zom_atkc12 = [$attc12, zom_run1]
{
ai_face ();
base_monster_fire_zombiechunk ('-12 -19 29', 0);
+ F ()
};
///////////////////////////
@@ -506,21 +581,23 @@ spawnflags(Flags) =
{
self.health = 60;
ai_face ();
+ F ()
};
- void() zom_tur_atka2 = [$atta2, zom_tur_atka3] { ai_face (); };
- void() zom_tur_atka3 = [$atta3, zom_tur_atka4] { ai_face (); };
- void() zom_tur_atka4 = [$atta4, zom_tur_atka5] { ai_face (); };
- void() zom_tur_atka5 = [$atta5, zom_tur_atka6] { ai_face (); };
- void() zom_tur_atka6 = [$atta6, zom_tur_atka7] { ai_face (); };
- void() zom_tur_atka7 = [$atta7, zom_tur_atka8] { ai_face (); };
- void() zom_tur_atka8 = [$atta8, zom_tur_atka9] { ai_face (); };
- void() zom_tur_atka9 = [$atta9, zom_tur_atka10] { ai_face (); };
+ void() zom_tur_atka2 = [$atta2, zom_tur_atka3] { ai_face (); F () };
+ void() zom_tur_atka3 = [$atta3, zom_tur_atka4] { ai_face (); F () };
+ void() zom_tur_atka4 = [$atta4, zom_tur_atka5] { ai_face (); F () };
+ void() zom_tur_atka5 = [$atta5, zom_tur_atka6] { ai_face (); F () };
+ void() zom_tur_atka6 = [$atta6, zom_tur_atka7] { ai_face (); F () };
+ void() zom_tur_atka7 = [$atta7, zom_tur_atka8] { ai_face (); F () };
+ void() zom_tur_atka8 = [$atta8, zom_tur_atka9] { ai_face (); F () };
+ void() zom_tur_atka9 = [$atta9, zom_tur_atka10] { ai_face (); F () };
void() zom_tur_atka10 = [$atta10, zom_tur_atka11]
{
ai_face ();
self.attack_elevation = preach_iterate_elevation (
OGRE_DEFAULT_ELEVATION, ZCHUNK_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() zom_tur_atka11 = [$atta11, zom_tur_atka12]
{
@@ -528,6 +605,7 @@ spawnflags(Flags) =
self.attack_elevation = preach_iterate_elevation (
self.attack_elevation, ZCHUNK_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() zom_tur_atka12 = [$atta12, zom_tur_atka13]
{
@@ -535,11 +613,13 @@ spawnflags(Flags) =
self.attack_elevation = preach_iterate_elevation (
self.attack_elevation, ZCHUNK_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() zom_tur_atka13 = [$atta13, zom_alt_seek1]
{
ai_run (0);
base_monster_fire_zombiechunk ('0 0 0', self.attack_elevation);
+ F ()
};
//--------------------------------------------------------------
@@ -549,22 +629,24 @@ spawnflags(Flags) =
{
self.health = 60;
ai_face ();
+ F ()
};
- void() zom_tur_atkb2 = [$attb2, zom_tur_atkb3] { ai_face (); };
- void() zom_tur_atkb3 = [$attb3, zom_tur_atkb4] { ai_face (); };
- void() zom_tur_atkb4 = [$attb4, zom_tur_atkb5] { ai_face (); };
- void() zom_tur_atkb5 = [$attb5, zom_tur_atkb6] { ai_face (); };
- void() zom_tur_atkb6 = [$attb6, zom_tur_atkb7] { ai_face (); };
- void() zom_tur_atkb7 = [$attb7, zom_tur_atkb8] { ai_face (); };
- void() zom_tur_atkb8 = [$attb8, zom_tur_atkb9] { ai_face (); };
- void() zom_tur_atkb9 = [$attb9, zom_tur_atkb10] { ai_face (); };
- void() zom_tur_atkb10 = [$attb10, zom_tur_atkb11] {ai_face (); };
+ void() zom_tur_atkb2 = [$attb2, zom_tur_atkb3] { ai_face (); F () };
+ void() zom_tur_atkb3 = [$attb3, zom_tur_atkb4] { ai_face (); F () };
+ void() zom_tur_atkb4 = [$attb4, zom_tur_atkb5] { ai_face (); F () };
+ void() zom_tur_atkb5 = [$attb5, zom_tur_atkb6] { ai_face (); F () };
+ void() zom_tur_atkb6 = [$attb6, zom_tur_atkb7] { ai_face (); F () };
+ void() zom_tur_atkb7 = [$attb7, zom_tur_atkb8] { ai_face (); F () };
+ void() zom_tur_atkb8 = [$attb8, zom_tur_atkb9] { ai_face (); F () };
+ void() zom_tur_atkb9 = [$attb9, zom_tur_atkb10] { ai_face (); F () };
+ void() zom_tur_atkb10 = [$attb10, zom_tur_atkb11] {ai_face (); F () };
void() zom_tur_atkb11 = [$attb11, zom_tur_atkb12]
{
ai_face ();
self.attack_elevation = preach_iterate_elevation (
OGRE_DEFAULT_ELEVATION, ZCHUNK_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() zom_tur_atkb12 = [$attb12, zom_tur_atkb13]
{
@@ -572,6 +654,7 @@ spawnflags(Flags) =
self.attack_elevation = preach_iterate_elevation (
self.attack_elevation, ZCHUNK_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() zom_tur_atkb13 = [$attb13, zom_tur_atkb14]
{
@@ -579,11 +662,13 @@ spawnflags(Flags) =
self.attack_elevation = preach_iterate_elevation (
self.attack_elevation, ZCHUNK_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() zom_tur_atkb14 = [$attb13, zom_alt_seek1]
{
ai_run (0);
base_monster_fire_zombiechunk ('0 0 0', self.attack_elevation);
+ F ()
};
//--------------------------------------------------------------
@@ -593,20 +678,22 @@ spawnflags(Flags) =
{
self.health = 60;
ai_face ();
+ F ()
};
- void() zom_tur_atkc2 = [$attc2, zom_tur_atkc3] { ai_face (); };
- void() zom_tur_atkc3 = [$attc3, zom_tur_atkc4] { ai_face (); };
- void() zom_tur_atkc4 = [$attc4, zom_tur_atkc5] { ai_face (); };
- void() zom_tur_atkc5 = [$attc5, zom_tur_atkc6] { ai_face (); };
- void() zom_tur_atkc6 = [$attc6, zom_tur_atkc7] { ai_face (); };
- void() zom_tur_atkc7 = [$attc7, zom_tur_atkc8] { ai_face (); };
- void() zom_tur_atkc8 = [$attc8, zom_tur_atkc9] { ai_face (); };
+ void() zom_tur_atkc2 = [$attc2, zom_tur_atkc3] { ai_face (); F () };
+ void() zom_tur_atkc3 = [$attc3, zom_tur_atkc4] { ai_face (); F () };
+ void() zom_tur_atkc4 = [$attc4, zom_tur_atkc5] { ai_face (); F () };
+ void() zom_tur_atkc5 = [$attc5, zom_tur_atkc6] { ai_face (); F () };
+ void() zom_tur_atkc6 = [$attc6, zom_tur_atkc7] { ai_face (); F () };
+ void() zom_tur_atkc7 = [$attc7, zom_tur_atkc8] { ai_face (); F () };
+ void() zom_tur_atkc8 = [$attc8, zom_tur_atkc9] { ai_face (); F () };
void() zom_tur_atkc9 = [$attc9, zom_tur_atkc10]
{
ai_face ();
self.attack_elevation = preach_iterate_elevation (
OGRE_DEFAULT_ELEVATION, ZCHUNK_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() zom_tur_atkc10 = [$attc10, zom_tur_atkc11]
{
@@ -614,6 +701,7 @@ spawnflags(Flags) =
self.attack_elevation = preach_iterate_elevation (
self.attack_elevation, ZCHUNK_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() zom_tur_atkc11 = [$attc11, zom_tur_atkc12]
{
@@ -621,11 +709,13 @@ spawnflags(Flags) =
self.attack_elevation = preach_iterate_elevation (
self.attack_elevation, ZCHUNK_SPEED,
self.origin, self.enemy.origin);
+ F ()
};
void() zom_tur_atkc12 = [$attc12, zom_alt_seek1]
{
ai_run (0);
base_monster_fire_zombiechunk ('0 0 0', self.attack_elevation);
+ F ()
};
//--------------------------------------------------------------
@@ -635,21 +725,22 @@ spawnflags(Flags) =
{
self.health = 60;
ai_run (0);
+ F ()
};
- void() zom_alt_seek2 = [$stand2, zom_seek3] { ai_run (0); };
- void() zom_seek3 = [$stand3, zom_seek4] { ai_run (0); };
- void() zom_seek4 = [$stand4, zom_seek5] { ai_run (0); };
- void() zom_seek5 = [$stand5, zom_seek6] { ai_run (0); };
- void() zom_seek6 = [$stand6, zom_seek7] { ai_run (0); };
- void() zom_seek7 = [$stand7, zom_seek8] { ai_run (0); };
- void() zom_seek8 = [$stand8, zom_seek9] { ai_run (0); };
- void() zom_seek9 = [$stand9, zom_seek10] { ai_run (0); };
- void() zom_seek10 = [$stand10, zom_seek11] { ai_run (0); };
- void() zom_seek11 = [$stand11, zom_seek12] { ai_run (0); };
- void() zom_seek12 = [$stand12, zom_seek13] { ai_run (0); };
- void() zom_seek13 = [$stand13, zom_seek14] { ai_run (0); };
- void() zom_seek14 = [$stand14, zom_seek15] { ai_run (0); };
- void() zom_seek15 = [$stand15, zom_alt_seek1] { ai_run (0); };
+ void() zom_alt_seek2 = [$stand2, zom_seek3] { ai_run (0); F () };
+ void() zom_seek3 = [$stand3, zom_seek4] { ai_run (0); F () };
+ void() zom_seek4 = [$stand4, zom_seek5] { ai_run (0); F () };
+ void() zom_seek5 = [$stand5, zom_seek6] { ai_run (0); F () };
+ void() zom_seek6 = [$stand6, zom_seek7] { ai_run (0); F () };
+ void() zom_seek7 = [$stand7, zom_seek8] { ai_run (0); F () };
+ void() zom_seek8 = [$stand8, zom_seek9] { ai_run (0); F () };
+ void() zom_seek9 = [$stand9, zom_seek10] { ai_run (0); F () };
+ void() zom_seek10 = [$stand10, zom_seek11] { ai_run (0); F () };
+ void() zom_seek11 = [$stand11, zom_seek12] { ai_run (0); F () };
+ void() zom_seek12 = [$stand12, zom_seek13] { ai_run (0); F () };
+ void() zom_seek13 = [$stand13, zom_seek14] { ai_run (0); F () };
+ void() zom_seek14 = [$stand14, zom_seek15] { ai_run (0); F () };
+ void() zom_seek15 = [$stand15, zom_alt_seek1] { ai_run (0); F () };
///////////////////////////
/// turret frames END ///
@@ -660,107 +751,124 @@ spawnflags(Flags) =
//--------------------------------------------------------------
void() zom_paina1 = [$paina1, zom_paina2]
{
- sound_pain (self, CHAN_VOICE, "zombie/z_pain.wav",
+ sound (self, CHAN_VOICE, "zombie/z_pain.wav",
VOL_HIGH, ATTN_NORM);
+ F ()
};
- void() zom_paina2 = [$paina2, zom_paina3] { ai_painforward (3); };
- void() zom_paina3 = [$paina3, zom_paina4] { ai_painforward (1); };
- void() zom_paina4 = [$paina4, zom_paina5] { ai_pain (1); };
- void() zom_paina5 = [$paina5, zom_paina6] { ai_pain (3); };
- void() zom_paina6 = [$paina6, zom_paina7] { ai_pain (1); };
- void() zom_paina7 = [$paina7, zom_paina8] { };
- void() zom_paina8 = [$paina8, zom_paina9] { };
- void() zom_paina9 = [$paina9, zom_paina10] { };
- void() zom_paina10 = [$paina10, zom_paina11] { };
- void() zom_paina11 = [$paina11, zom_paina12] { };
- void() zom_paina12 = [$paina12, zom_run1] { };
+ void() zom_paina2 = [$paina2, zom_paina3] { ai_painforward (3); F () };
+ void() zom_paina3 = [$paina3, zom_paina4] { ai_painforward (1); F () };
+ void() zom_paina4 = [$paina4, zom_paina5] { ai_pain (1); F () };
+ void() zom_paina5 = [$paina5, zom_paina6] { ai_pain (3); F () };
+ void() zom_paina6 = [$paina6, zom_paina7] { ai_pain (1); F () };
+ void() zom_paina7 = [$paina7, zom_paina8] { F () };
+ void() zom_paina8 = [$paina8, zom_paina9] { F () };
+ void() zom_paina9 = [$paina9, zom_paina10] { F () };
+ void() zom_paina10 = [$paina10, zom_paina11] { F () };
+ void() zom_paina11 = [$paina11, zom_paina12] { F () };
+ void() zom_paina12 = [$paina12, zom_run1] { F () };
//--------------------------------------------------------------
// Zombie Pain State B
//--------------------------------------------------------------
void() zom_painb1 = [$painb1, zom_painb2]
{
- sound_misc2 (self, CHAN_VOICE, "zombie/z_pain1.wav",
+ sound (self, CHAN_VOICE, "zombie/z_pain1.wav",
VOL_HIGH, ATTN_NORM);
+ F ()
};
- void() zom_painb2 = [$painb2, zom_painb3] { ai_pain (2); };
- void() zom_painb3 = [$painb3, zom_painb4] { ai_pain (8); };
- void() zom_painb4 = [$painb4, zom_painb5] { ai_pain (6); };
- void() zom_painb5 = [$painb5, zom_painb6] { ai_pain (2); };
- void() zom_painb6 = [$painb6, zom_painb7] { };
- void() zom_painb7 = [$painb7, zom_painb8] { };
- void() zom_painb8 = [$painb8, zom_painb9] { };
+ void() zom_painb2 = [$painb2, zom_painb3] { ai_pain (2); F () };
+ void() zom_painb3 = [$painb3, zom_painb4] { ai_pain (8); F () };
+ void() zom_painb4 = [$painb4, zom_painb5] { ai_pain (6); F () };
+ void() zom_painb5 = [$painb5, zom_painb6] { ai_pain (2); F () };
+ void() zom_painb6 = [$painb6, zom_painb7] { F () };
+ void() zom_painb7 = [$painb7, zom_painb8] { F () };
+ void() zom_painb8 = [$painb8, zom_painb9] { F () };
void() zom_painb9 = [$painb9, zom_painb10]
{
- sound_misc3 (self, CHAN_BODY, "zombie/z_fall.wav",
+ sound (self, CHAN_BODY, "zombie/z_fall.wav",
VOL_HIGH, ATTN_NORM);
+ F ()
};
- void() zom_painb10 = [$painb10, zom_painb11] { };
- void() zom_painb11 = [$painb11, zom_painb12] { };
- void() zom_painb12 = [$painb12, zom_painb13] { };
- void() zom_painb13 = [$painb13, zom_painb14] { };
- void() zom_painb14 = [$painb14, zom_painb15] { };
- void() zom_painb15 = [$painb15, zom_painb16] { };
- void() zom_painb16 = [$painb16, zom_painb17] { };
- void() zom_painb17 = [$painb17, zom_painb18] { };
- void() zom_painb18 = [$painb18, zom_painb19] { };
- void() zom_painb19 = [$painb19, zom_painb20] { };
- void() zom_painb20 = [$painb20, zom_painb21] { };
- void() zom_painb21 = [$painb21, zom_painb22] { };
- void() zom_painb22 = [$painb22, zom_painb23] { };
- void() zom_painb23 = [$painb23, zom_painb24] { };
- void() zom_painb24 = [$painb24, zom_painb25] { };
- void() zom_painb25 = [$painb25, zom_painb26] { ai_painforward (1); };
- void() zom_painb26 = [$painb26, zom_painb27] { };
- void() zom_painb27 = [$painb27, zom_painb28] { };
- void() zom_painb28 = [$painb28, zom_run1] { };
+ void() zom_painb10 = [$painb10, zom_painb11] { F () };
+ void() zom_painb11 = [$painb11, zom_painb12] { F () };
+ void() zom_painb12 = [$painb12, zom_painb13] { F () };
+ void() zom_painb13 = [$painb13, zom_painb14] { F () };
+ void() zom_painb14 = [$painb14, zom_painb15] { F () };
+ void() zom_painb15 = [$painb15, zom_painb16] { F () };
+ void() zom_painb16 = [$painb16, zom_painb17] { F () };
+ void() zom_painb17 = [$painb17, zom_painb18] { F () };
+ void() zom_painb18 = [$painb18, zom_painb19] { F () };
+ void() zom_painb19 = [$painb19, zom_painb20] { F () };
+ void() zom_painb20 = [$painb20, zom_painb21] { F () };
+ void() zom_painb21 = [$painb21, zom_painb22] { F () };
+ void() zom_painb22 = [$painb22, zom_painb23] { F () };
+ void() zom_painb23 = [$painb23, zom_painb24] { F () };
+ void() zom_painb24 = [$painb24, zom_painb25] { F () };
+ void() zom_painb25 = [$painb25, zom_painb26]
+ {
+ ai_painforward (1);
+ F ()
+ };
+ void() zom_painb26 = [$painb26, zom_painb27] { F () };
+ void() zom_painb27 = [$painb27, zom_painb28] { F () };
+ void() zom_painb28 = [$painb28, zom_run1] { F () };
//--------------------------------------------------------------
// Zombie Pain State C
//--------------------------------------------------------------
void() zom_painc1 = [$painc1, zom_painc2]
{
- sound_misc2 (self, CHAN_VOICE, "zombie/z_pain1.wav",
+ sound (self, CHAN_VOICE, "zombie/z_pain1.wav",
VOL_HIGH, ATTN_NORM);
+ F ()
+ };
+ void() zom_painc2 = [$painc2, zom_painc3] { F () };
+ void() zom_painc3 = [$painc3, zom_painc4] { ai_pain (3); F () };
+ void() zom_painc4 = [$painc4, zom_painc5] { ai_pain (1); F () };
+ void() zom_painc5 = [$painc5, zom_painc6] { F () };
+ void() zom_painc6 = [$painc6, zom_painc7] { F () };
+ void() zom_painc7 = [$painc7, zom_painc8] { F () };
+ void() zom_painc8 = [$painc8, zom_painc9] { F () };
+ void() zom_painc9 = [$painc9, zom_painc10] { F () };
+ void() zom_painc10 = [$painc10, zom_painc11] { F () };
+ void() zom_painc11 = [$painc11, zom_painc12]
+ {
+ ai_painforward (1);
+ F ()
+ };
+ void() zom_painc12 = [$painc12, zom_painc13]
+ {
+ ai_painforward (1);
+ F ()
};
- void() zom_painc2 = [$painc2, zom_painc3] { };
- void() zom_painc3 = [$painc3, zom_painc4] { ai_pain (3); };
- void() zom_painc4 = [$painc4, zom_painc5] { ai_pain (1); };
- void() zom_painc5 = [$painc5, zom_painc6] { };
- void() zom_painc6 = [$painc6, zom_painc7] { };
- void() zom_painc7 = [$painc7, zom_painc8] { };
- void() zom_painc8 = [$painc8, zom_painc9] { };
- void() zom_painc9 = [$painc9, zom_painc10] { };
- void() zom_painc10 = [$painc10, zom_painc11] { };
- void() zom_painc11 = [$painc11, zom_painc12] { ai_painforward (1); };
- void() zom_painc12 = [$painc12, zom_painc13] { ai_painforward (1); };
- void() zom_painc13 = [$painc13, zom_painc14] { };
- void() zom_painc14 = [$painc14, zom_painc15] { };
- void() zom_painc15 = [$painc15, zom_painc16] { };
- void() zom_painc16 = [$painc16, zom_painc17] { };
- void() zom_painc17 = [$painc17, zom_painc18] { };
- void() zom_painc18 = [$painc18, zom_run1] { };
+ void() zom_painc13 = [$painc13, zom_painc14] { F () };
+ void() zom_painc14 = [$painc14, zom_painc15] { F () };
+ void() zom_painc15 = [$painc15, zom_painc16] { F () };
+ void() zom_painc16 = [$painc16, zom_painc17] { F () };
+ void() zom_painc17 = [$painc17, zom_painc18] { F () };
+ void() zom_painc18 = [$painc18, zom_run1] { F () };
//--------------------------------------------------------------
// Zombie Pain State D
//--------------------------------------------------------------
void() zom_paind1 = [$paind1, zom_paind2]
{
- sound_pain (self, CHAN_VOICE, "zombie/z_pain.wav",
+ sound (self, CHAN_VOICE, "zombie/z_pain.wav",
VOL_HIGH, ATTN_NORM);
+ F ()
};
- void() zom_paind2 = [$paind2, zom_paind3] { };
- void() zom_paind3 = [$paind3, zom_paind4] { };
- void() zom_paind4 = [$paind4, zom_paind5] { };
- void() zom_paind5 = [$paind5, zom_paind6] { };
- void() zom_paind6 = [$paind6, zom_paind7] { };
- void() zom_paind7 = [$paind7, zom_paind8] { };
- void() zom_paind8 = [$paind8, zom_paind9] { };
- void() zom_paind9 = [$paind9, zom_paind10] { ai_pain (1); };
- void() zom_paind10 = [$paind10, zom_paind11] { };
- void() zom_paind11 = [$paind11, zom_paind12] { };
- void() zom_paind12 = [$paind12, zom_paind13] { };
- void() zom_paind13 = [$paind13, zom_run1] { };
+ void() zom_paind2 = [$paind2, zom_paind3] { F () };
+ void() zom_paind3 = [$paind3, zom_paind4] { F () };
+ void() zom_paind4 = [$paind4, zom_paind5] { F () };
+ void() zom_paind5 = [$paind5, zom_paind6] { F () };
+ void() zom_paind6 = [$paind6, zom_paind7] { F () };
+ void() zom_paind7 = [$paind7, zom_paind8] { F () };
+ void() zom_paind8 = [$paind8, zom_paind9] { F () };
+ void() zom_paind9 = [$paind9, zom_paind10] { ai_pain (1); F () };
+ void() zom_paind10 = [$paind10, zom_paind11] { F () };
+ void() zom_paind11 = [$paind11, zom_paind12] { F () };
+ void() zom_paind12 = [$paind12, zom_paind13] { F () };
+ void() zom_paind13 = [$paind13, zom_run1] { F () };
//--------------------------------------------------------------
// Zombie Pain State E
@@ -773,61 +881,83 @@ spawnflags(Flags) =
t_damage2 (self, world, world, 80);
return;
}
- sound_pain (self, CHAN_VOICE, "zombie/z_pain.wav",
+ sound (self, CHAN_VOICE, "zombie/z_pain.wav",
VOL_HIGH, ATTN_NORM);
self.health = 60;
+ F ()
};
- void() zom_paine2 = [$paine2, zom_paine3] { ai_pain (8); };
- void() zom_paine3 = [$paine3, zom_paine4] { ai_pain (5); };
- void() zom_paine4 = [$paine4, zom_paine5] { ai_pain (3); };
- void() zom_paine5 = [$paine5, zom_paine6] { ai_pain (1); };
- void() zom_paine6 = [$paine6, zom_paine7] { ai_pain (2); };
- void() zom_paine7 = [$paine7, zom_paine8] { ai_pain (1); };
- void() zom_paine8 = [$paine8, zom_paine9] { ai_pain (1); };
- void() zom_paine9 = [$paine9, zom_paine10] { ai_pain (2); };
+ void() zom_paine2 = [$paine2, zom_paine3] { ai_pain (8); F () };
+ void() zom_paine3 = [$paine3, zom_paine4] { ai_pain (5); F () };
+ void() zom_paine4 = [$paine4, zom_paine5] { ai_pain (3); F () };
+ void() zom_paine5 = [$paine5, zom_paine6] { ai_pain (1); F () };
+ void() zom_paine6 = [$paine6, zom_paine7] { ai_pain (2); F () };
+ void() zom_paine7 = [$paine7, zom_paine8] { ai_pain (1); F () };
+ void() zom_paine8 = [$paine8, zom_paine9] { ai_pain (1); F () };
+ void() zom_paine9 = [$paine9, zom_paine10] { ai_pain (2); F () };
void() zom_paine10 = [$paine10, zom_paine11]
{
- sound_misc3 (self, CHAN_BODY, "zombie/z_fall.wav",
+ sound (self, CHAN_BODY, "zombie/z_fall.wav",
VOL_HIGH, ATTN_NORM);
self.solid = SOLID_NOT;
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME |
+ NETFLAG_BASE_ENTITY_SOLID;
};
void() zom_paine11 = [$paine11, zom_paine12]
{
self.nextthink = self.nextthink + 5;
self.health = 60;
+ F ()
};
void() zom_paine12 = [$paine12, zom_paine13]
{
// see if ok to stand up
self.health = 60;
- sound_misc (self, CHAN_VOICE, "zombie/z_idle.wav",
+ sound (self, CHAN_VOICE, "zombie/z_idle.wav",
VOL_HIGH, ATTN_IDLE);
- self.solid = SOLID_SLIDEBOX;
if (!walkmove(0, 0))
{
self.think = zom_paine11;
self.solid = SOLID_NOT;
- return;
}
+ else
+ {
+ self.solid = SOLID_SLIDEBOX;
+ }
+ self.SendFlags |= NETFLAG_BASE_ENTITY_FRAME |
+ NETFLAG_BASE_ENTITY_SOLID;
+ };
+ void() zom_paine13 = [$paine13, zom_paine14] { F () };
+ void() zom_paine14 = [$paine14, zom_paine15] { F () };
+ void() zom_paine15 = [$paine15, zom_paine16] { F () };
+ void() zom_paine16 = [$paine16, zom_paine17] { F () };
+ void() zom_paine17 = [$paine17, zom_paine18] { F () };
+ void() zom_paine18 = [$paine18, zom_paine19] { F () };
+ void() zom_paine19 = [$paine19, zom_paine20] { F () };
+ void() zom_paine20 = [$paine20, zom_paine21] { F () };
+ void() zom_paine21 = [$paine21, zom_paine22] { F () };
+ void() zom_paine22 = [$paine22, zom_paine23] { F () };
+ void() zom_paine23 = [$paine23, zom_paine24] { F () };
+ void() zom_paine24 = [$paine24, zom_paine25] { F () };
+ void() zom_paine25 = [$paine25, zom_paine26]
+ {
+ ai_painforward (5);
+ F ()
};
- void() zom_paine13 = [$paine13, zom_paine14] { };
- void() zom_paine14 = [$paine14, zom_paine15] { };
- void() zom_paine15 = [$paine15, zom_paine16] { };
- void() zom_paine16 = [$paine16, zom_paine17] { };
- void() zom_paine17 = [$paine17, zom_paine18] { };
- void() zom_paine18 = [$paine18, zom_paine19] { };
- void() zom_paine19 = [$paine19, zom_paine20] { };
- void() zom_paine20 = [$paine20, zom_paine21] { };
- void() zom_paine21 = [$paine21, zom_paine22] { };
- void() zom_paine22 = [$paine22, zom_paine23] { };
- void() zom_paine23 = [$paine23, zom_paine24] { };
- void() zom_paine24 = [$paine24, zom_paine25] { };
- void() zom_paine25 = [$paine25, zom_paine26] { ai_painforward (5); };
- void() zom_paine26 = [$paine26, zom_paine27] { ai_painforward (3); };
- void() zom_paine27 = [$paine27, zom_paine28] { ai_painforward (1); };
- void() zom_paine28 = [$paine28, zom_paine29] { ai_pain (1); };
- void() zom_paine29 = [$paine29, zom_paine30] { };
- void() zom_paine30 = [$paine30, zom_run1] { };
+ void() zom_paine26 = [$paine26, zom_paine27]
+ {
+ ai_painforward (3);
+ F ()
+ };
+ void() zom_paine27 = [$paine27, zom_paine28]
+ {
+ ai_painforward (1);
+ F ()
+ };
+ void() zom_paine28 = [$paine28, zom_paine29] { ai_pain (1); F () };
+ void() zom_paine29 = [$paine29, zom_paine30] { F () };
+ void() zom_paine30 = [$paine30, zom_run1] { F () };
+
+ #undef F
//==============================================================
// Interaction
@@ -854,7 +984,7 @@ spawnflags(Flags) =
//--------------------------------------------------------------
void(entity attacker, float take) monster_zombie_pain =
{
- if (self.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_TURRET)
{
// always reset health
self.health = 60;
@@ -935,15 +1065,17 @@ spawnflags(Flags) =
//--------------------------------------------------------------
void(vector dir) monster_zombie_destroy =
{
- sound_death (self, CHAN_VOICE, "zombie/z_gib.wav",
+ sound (self, CHAN_VOICE, "zombie/z_gib.wav",
VOL_HIGH, ATTN_NORM);
- throw_gib_head_zombie (self, dir, self.health);
- throw_gib_1 (self, dir, self.health);
- throw_gib_2 (self, dir, self.health);
- throw_gib_3 (self, dir, self.health);
-
base_item_drop_stuff (self);
+
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib1_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib2_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_gib3_init)
+ BASE_ITEM_GIB_THROW (dir, self.health, item_head_zombie_init)
+
+ base_entity_remove (self);
};
//--------------------------------------------------------------
@@ -963,10 +1095,10 @@ spawnflags(Flags) =
//==============================================================
//--------------------------------------------------------------
- entity(vector org, vector ang, float sflags, float yaw, float angry)
+ entity(vector org, vector ang, float sflags, float yaw)
spawn_monster_zombie =
{
- return spawn_base_monster (org, ang, sflags, yaw, angry,
+ return spawn_base_monster (org, ang, sflags, yaw,
monster_zombie_init);
};
@@ -992,11 +1124,11 @@ spawnflags(Flags) =
// dumptruck_ds -- Don't start zombie_stand1 yet!
self.count = 1;
- if (self.spawnflags & ZOMBIE_SPAWN_SLEEPING)
+ if (self.spawnflags & SPAWNFLAG_MONSTER_ZOMBIE_SLEEPING)
{
if (!sub_istargeted())
{
- dprint (sprintf("monster_zombie::zombie_start: "
+ dprint (sprintf("monster_zombie_start: "
"WARNING removed untargeted sleeping "
"zombie at %v\n", self.origin));
@@ -1015,149 +1147,117 @@ spawnflags(Flags) =
self.th_stand = zom_alt_stand1;
};
+#endif
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
void(entity e) monster_zombie_init =
{
+ #ifdef SSQC
if (deathmatch)
{
remove (e);
return;
}
+ #endif
e.classname = "monster_zombie";
e.classtype = CT_MONSTER_ZOMBIE;
+ e.pos1 = ZOMBIE_MINS;
+ e.pos2 = ZOMBIE_MAXS;
+
+ #ifdef CSQC
+ if (e.modelindex)
+ {
+ setmodelindex (e, e.modelindex);
+ setsize (e, ZOMBIE_MINS, ZOMBIE_MAXS);
+ }
- // custom_mdls dumptruck_ds
- precache_body_model (e, "progs/zombie.mdl");
- precache_head_model (e, "progs/h_zombie.mdl");
- precache_proj_model (e, "progs/zom_gib.mdl");
- // precache_model ("progs/zombie.mdl");
- // precache_model ("progs/h_zombie.mdl");
- // precache_model ("progs/zom_gib.mdl");
-
- precache_sound_misc (e, "zombie/z_idle.wav");
- precache_sound_sight (e, "zombie/z_idle1.wav");
- precache_sound_attack (e, "zombie/z_shot1.wav");
- precache_sound_death (e, "zombie/z_gib.wav");
- precache_sound_pain (e, "zombie/z_pain.wav");
- precache_sound_misc2 (e, "zombie/z_pain1.wav");
- precache_sound_misc3 (e, "zombie/z_fall.wav");
+ // call walkmonster_init on the clientside -- CEV
+ base_monster_init (e);
+ #endif
+
+ #ifdef SSQC
+ precache_model ("progs/zombie.mdl");
+ precache_model ("progs/h_zombie.mdl");
+ precache_model ("progs/zom_gib.mdl");
+
+ precache_sound ("zombie/z_idle.wav");
+ precache_sound ("zombie/z_idle1.wav");
+ precache_sound ("zombie/z_shot1.wav");
+ precache_sound ("zombie/z_gib.wav");
+ precache_sound ("zombie/z_pain.wav");
+ precache_sound ("zombie/z_pain1.wav");
+ precache_sound ("zombie/z_fall.wav");
precache_sound ("zombie/z_miss.wav");
precache_sound ("zombie/z_hit.wav");
- precache_sound_idle (e, "zombie/idle_w2.wav");
+ precache_sound ("zombie/idle_w2.wav");
+
+ precache_model ("progs/gib1.mdl");
+ precache_model ("progs/gib2.mdl");
+ precache_model ("progs/gib3.mdl");
- precache_gib1 (e, "progs/gib1.mdl");
- precache_gib2 (e, "progs/gib2.mdl");
- precache_gib3 (e, "progs/gib3.mdl");
+ e.destroy = monster_zombie_destroy;
+ e.health = ZOMBIE_HEALTH;
+ e.sightsound = monster_zombie_sightsound;
e.th_stand = monster_zombie_start;
e.th_walk = zom_walk1;
- if (e.spawnflags & I_AM_TURRET)
+ if (e.spawnflags & SPAWNFLAG_MONSTER_TURRET)
e.th_run = zom_alt_seek1;
else
e.th_run = monster_zombie_decide;
-
- e.sightsound = monster_zombie_sightsound;
e.th_pain = monster_zombie_pain;
- e.destroy = monster_zombie_destroy;
e.th_turret = monster_zombie_attack_turretmissile;
e.th_missile = monster_zombie_attack_missile;
- e.solid = SOLID_SLIDEBOX;
- e.movetype = MOVETYPE_STEP;
- // custom_mdls dumptruck_ds
- body_model (e, "progs/zombie.mdl");
- // setmodel (e, "progs/zombie.mdl");
-
- setsize (e, '-16 -16 -24', '16 16 40');
- e.health = ZOMBIE_HEALTH;
+ // set up model and size for later -- CEV
+ e.mdl = "progs/zombie.mdl";
- if (e.spawnflags & ZOMBIE_SPAWN_CRUCIFIED)
+ if (e.spawnflags & SPAWNFLAG_MONSTER_ZOMBIE_CRUCIFIED)
{
+ e.solid = SOLID_SLIDEBOX;
e.movetype = MOVETYPE_NONE;
- zom_cruc1 ();
+ setmodel (e, "progs/zombie.mdl");
+ setsize (e, ZOMBIE_MINS, ZOMBIE_MAXS);
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+
+ sub_runvoidas (e, zom_cruc1);
}
- else if (e.spawnflags & ZOMBIE_SPAWN_DEAD_CRUCIFIED)
+ else if (e.spawnflags & SPAWNFLAG_MONSTER_ZOMBIE_DEAD_CRUCIFIED)
{
+ e.solid = SOLID_SLIDEBOX;
e.movetype = MOVETYPE_NONE;
- zom_dead_cruc1 ();
+ setmodel (e, "progs/zombie.mdl");
+ setsize (e, ZOMBIE_MINS, ZOMBIE_MAXS);
+ e.SendEntity = base_entity_netsend;
+ e.SendFlags = NETFLAG_BASE_ENTITY_FULLSEND;
+
+ sub_runvoidas (e, zom_dead_cruc1);
}
else
{
// walkmonster_start
- base_walkmonster_init (e);
+ base_monster_init (e);
}
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() monster_zombie =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ // remap spawnflags & fields, inhibit if necessary -- CEV
+ BASE_MONSTER_PREINIT (base_monster_init_field)
monster_zombie_init (self);
};
+#endif
// };
-//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-// Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds
-//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-
-/*QUAKED gib_head_zombie (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/h_zombie.mdl");
-}
-*/
-//----------------------------------------------------------------------
-// class gib_head_zombie: base_gib_head
-// {
- //--------------------------------------------------------------
- // ThrowHead
- //--------------------------------------------------------------
- void(entity act, vector dir, float dmg) throw_gib_head_zombie =
- {
- base_gib_head_throw (act, dir, dmg, gib_head_zombie_init);
- };
-
- //--------------------------------------------------------------
- void(entity e) gib_head_zombie_init =
- {
- e.classname = "gib_head_zombie";
- e.classtype = CT_GORE_HEAD_ZOMBIE;
-
- // gib_init interprets spawnflags and will set .solid -- CEV
- base_gib_head_init (e);
-
- if (e.mdl_head != "")
- {
- precache_model (e.mdl_head);
- setmodel (e, e.mdl_head);
- }
- else
- {
- precache_model ("progs/h_zombie.mdl");
- setmodel (e, "progs/h_zombie.mdl");
- if (e.solid == SOLID_BBOX)
- setsize (e, ZOMBIE_HEAD_MINS, ZOMBIE_HEAD_MAXS);
- else if (e.solid == SOLID_TRIGGER)
- setsize (e, '-16 -16 0', '16 16 56');
- }
-
- e.frame = 0;
- };
-
- //--------------------------------------------------------------
- void() gib_head_zombie =
- {
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- gib_head_zombie_init (self);
- };
-// };
-
-
+#if defined(CSQC) || defined(SSQC)
+$flush
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/newflags.qc
diff --git a/qc/newflags.qc b/qc/newflags.qc
index 385c608..5d351ca 100644
--- a/qc/newflags.qc
+++ b/qc/newflags.qc
@@ -58,10 +58,12 @@ affecting the other.
//======================================================================
// The new spawnflags. (16384 is already used elsewhere.)
+/*
const float SPAWNFLAG_NOT_IN_COOP = 4096; // Not in Coop
const float SPAWNFLAG_NOT_IN_SP = 8192; // Not in Single Player
const float SPAWNFLAG_NOT_ON_SKILL2 = 32768; // Not on Hard Only
const float SPAWNFLAG_NOT_ON_SKILL3 = 65536; // Not on Nightmare Only
+*/
//======================================================================
// globals
@@ -144,8 +146,43 @@ float() SUB_Inhibit =
// The built-in skill level spawnflags are ignored in Deathmatch, so
// we ignore the new ones in Deathmatch, too. -- iw
- if (!deathmatch)
+ if (deathmatch)
{
+ if (self.spawnflags & SPAWNFLAG_NOT_IN_DEATHMATCH)
+ {
+ remove (self);
+ return TRUE;
+ }
+ }
+ else
+ {
+ if (self.spawnflags & SPAWNFLAG_NOT_IN_SP)
+ {
+ remove (self);
+ return TRUE;
+ }
+
+ if (skill == 0 && (self.spawnflags & SPAWNFLAG_NOT_ON_EASY))
+ {
+ remove (self);
+ return TRUE;
+ }
+
+ if (skill == 1 && (self.spawnflags & SPAWNFLAG_NOT_ON_NORMAL))
+ {
+ remove (self);
+ return TRUE;
+ }
+
+ if (skill == 2 || skill == 3)
+ {
+ if (self.spawnflags&SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE)
+ {
+ remove (self);
+ return TRUE;
+ }
+ }
+
if (skill == 2 && (self.spawnflags & SPAWNFLAG_NOT_ON_SKILL2))
{
total_not_on_skill2 = total_not_on_skill2 + 1;
Return to the top of this page or return to the overview of this repo.
Diff qc/obituary.qc
diff --git a/qc/obituary.qc b/qc/obituary.qc
index ec1a6f6..b8d6326 100644
--- a/qc/obituary.qc
+++ b/qc/obituary.qc
@@ -90,7 +90,7 @@ void(entity targ, entity inflictor, entity attacker) ClientObituary =
bprint (" discharges into the water.\n");
return;
}
- if (targ.weapon == IT_GRENADE_LAUNCHER)
+ if (targ.weapon == ITEM_SEQ_GRENADELAUNCHER)
bprint (" tries to put the pin back in\n");
else
bprint (" becomes bored with life\n");
@@ -118,32 +118,32 @@ void(entity targ, entity inflictor, entity attacker) ClientObituary =
attacker.frags = attacker.frags + 1;
rnum = attacker.weapon;
- if (rnum == IT_AXE)
+ if (rnum == ITEM_SEQ_AXE)
{
deathstring = " was ax-murdered by ";
deathstring2 = "\n";
}
- if (rnum == IT_SHOTGUN)
+ if (rnum == ITEM_SEQ_SHOTGUN)
{
deathstring = " chewed on ";
deathstring2 = "'s boomstick\n";
}
- if (rnum == IT_SUPER_SHOTGUN)
+ if (rnum == ITEM_SEQ_SUPERSHOTGUN)
{
deathstring = " ate 2 loads of ";
deathstring2 = "'s buckshot\n";
}
- if (rnum == IT_NAILGUN)
+ if (rnum == ITEM_SEQ_NAILGUN)
{
deathstring = " was nailed by ";
deathstring2 = "\n";
}
- if (rnum == IT_SUPER_NAILGUN)
+ if (rnum == ITEM_SEQ_SUPERNAILGUN)
{
deathstring = " was punctured by ";
deathstring2 = "\n";
}
- if (rnum == IT_GRENADE_LAUNCHER)
+ if (rnum == ITEM_SEQ_GRENADELAUNCHER)
{
deathstring = " eats ";
deathstring2 = "'s pineapple\n";
@@ -153,7 +153,7 @@ void(entity targ, entity inflictor, entity attacker) ClientObituary =
deathstring2 = "'s grenade\n";
}
}
- if (rnum == IT_ROCKET_LAUNCHER)
+ if (rnum == ITEM_SEQ_ROCKETLAUNCHER)
{
deathstring = " rides ";
deathstring2 = "'s rocket\n";
@@ -163,7 +163,7 @@ void(entity targ, entity inflictor, entity attacker) ClientObituary =
deathstring2 = "'s rocket\n" ;
}
}
- if (rnum == IT_LIGHTNING)
+ if (rnum == ITEM_SEQ_LIGHTNINGGUN)
{
deathstring = " accepts ";
if (attacker.waterlevel > WATERLEVEL_FEET)
Return to the top of this page or return to the overview of this repo.
Diff qc/pmove.qc
diff --git a/qc/pmove.qc b/qc/pmove.qc
index d89b161..081944d 100644
--- a/qc/pmove.qc
+++ b/qc/pmove.qc
@@ -4,7 +4,6 @@
// TODO CEV: improved player unstick function
// TODO CEV: varied sounds (different jump sounds)
-// TODO CEV: fix telejump check (teleporter time isn't networked to CSQC)
//======================================================================
// globals
@@ -14,6 +13,10 @@
// the following are all managed by FTEQW -- CEV
float input_buttons; // buttons pressed by the client
// float input_impulse;
+#ifdef CSQC
+float input_clienttime; // not supported? seems to work anyway
+float input_servertime; // SSQC timestamp of CSQC lerp state
+#endif
float input_timelength; // frame / tic time
vector input_angles; // +x = DOWN
vector input_movevalues; // movement requested by client
@@ -38,23 +41,19 @@ vector input_movevalues; // movement requested by client
#if defined(CSQC) || defined(SSQC)
// acceleration & friction
-// 10 - 6.5265 = 3.4375
-// 3.4375 / 2.0 = 1.71875
-// 10 - 1.71875 = 8.28125
-const float PM_AIRACCELY = 70.0f; // (320 / 30) * 6.5625; 106.666 in Q1
-const float PM_AIRACCELXY = 1.0f; // for Q3 strafejumping; 1.0 in Q3; 0.85
-const float PM_AIRACCELXFWD = 1.0f; // 1 feels close to Q3 / CPM; 0.85f
-const float PM_AIRACCELXBACK = 2.5f; // Air stop speed in Q3? 5.0f?
-const float PM_AIRACCELBASE = 32.0f; //
-const float PM_AIRACCELTURN = 250.0f; // affects +fwd turning radius; 150.0f
+const float PM_AIRACCEL = 1.0f; // for Q3 strafejumping; 1.0 in Q3
+const float PM_AIRACCELBACK = 2.5f; // Air stop speed in Q3? 5.0f? 2.5f?
+const float PM_AIRACCELFWD = 1.0f; // 1 feels close to Q3 / CPM
+const float PM_AIRACCELSIDE = 70.0f; // (320 / 30) * 6.5625; 106.666 in Q1
+const float PM_AIRACCELTURN = 6.5625f; // magic value; see PM_AIRCONTROL -- CEV
const float PM_GROUNDACCEL = 10.0f; // 10 is Q1 & VQ3, 15 is CPM
const float PM_GROUNDFRICTION = 6.0f; // 4 for Q1, 6 for Q3, 8 for (old?) CPM
const float PM_SLICKACCEL = 10.0f; // accel while on ice / slick floor
-const float PM_SLIDEACCELY = 70.0f; //
-const float PM_SLIDEACCELXY = 1.0f; // crouchslide accel; 0.85f
+const float PM_SLIDEACCELFWD = 1.0f; // crouchslide accel
+const float PM_SLIDEACCELSIDE = 70.0f; // crouchslide accel
const float PM_SLIDEFRICTION = 0.25f; // crouchslide friction; 1.0?
-const float PM_SURFACCELY = 106.666f; // (320 / 30) * 10.0
-const float PM_SURFACCELXY = 1.0f; //
+const float PM_SURFACCEL = 1.0f; //
+const float PM_SURFACCELSIDE = 106.666f;// (320 / 30) * 10.0
const float PM_WATERACCEL = 10.0f; // water acceleration
const float PM_WATERFRICTION = 4.0f; // friction in water
@@ -62,7 +61,8 @@ const float PM_WATERFRICTION = 4.0f; // friction in water
const float PM_CROUCHSPEED = 80.0f; // ???
const float PM_MAXSPEED = 320.0f; // 320 always
const float PM_MAXAIRSPEED = 30.0f; // 30 for Q1 (PM_MAXSPEED / 10.666)
-const float PM_MAXWISHSPEED = 400.0f; // 320, 400
+const float PM_MAXSLIDESPEED = 30.0f; //
+const float PM_MAXWISHSPEED = 380.0f; // 320, 400
const float PM_STOPSPEED = 100.0f; // used in friction calculations
const float PM_WALKSPEED = 160.0f; // walk speed
const float PM_WATERMAXSPEED = 224.0f; // id1 224; 320 * 0.7
@@ -78,7 +78,7 @@ const float PM_DOUBLEJUMPSPEED = 270.0f;// 270 * 1.5 in CPM
const float PM_STAIRJUMPSPEED = 360.0f; // 360 = 90 * 4
const float PM_TELEJUMPSPEED = 360.0f; // same as STAIRJUMPSPEED
const float PM_WALLJUMPFORCE = 90.0f; // push away from wall
-const float PM_WALLJUMPGROUND = 28.0f; // distance from ground to allow WJ
+const float PM_WALLJUMPGROUND = 32.0f; // distance from ground to allow WJ
const float PM_WALLJUMPLIMIT = -180.f; // no walljump if Z vel below this
const float PM_WALLJUMPSPEED = 270.0f; // same as JUMPSPEED
const float PM_WALLJUMPDOUBLE = 360.0f; // same as STAIRJUMPSPEED
@@ -93,6 +93,7 @@ const float PM_WALLCLIP_WINDOW = 0.15f; // 0.4 - 0.25
const float PM_BTN_ATTACK = INPUT_BUTTON0;
const float PM_BTN_DOWN = INPUT_BUTTON8;// crouch key
const float PM_BTN_JUMP = INPUT_BUTTON2;// jump key
+const float PM_BTN_GRAB = INPUT_BUTTON6;// grab key
const float PM_BTN_WALK = INPUT_BUTTON7;// walk key
// misc
@@ -132,8 +133,7 @@ const vector PM_CROUCH_VIEWOFS = '0 0 8'; // Q3 crouch 0 0 12 -- CEV
// pmove_flags is used by the engine; FTE defines two constants:
// PMF_JUMP_HELD = 1, PMF_LADDER = 2. So those two constants should
// be first (and in that order) in our enum below. -- CEV
-// this is currently 19 flags; max flags for a float is 23 -- CEV
-enumflags
+typedef enumflags
{
PMF_JUMP_HELD, // player is holding the jump key
PMF_ONLADDER, // entity is on a ladder
@@ -153,8 +153,12 @@ enumflags
PMF_WATERJUMPED, // entity has waterjumped
PMF_CLIMB, // entity is climbing
PMF_PUSHED, // entity moved by a trigger_push
- PMF_SLIDE_STEP // slidemove hint to traverse steps
-};
+ PMF_SLIDE_STEP, // slidemove hint to traverse steps
+ PMF_UNUSED1, // unused flags
+ PMF_UNUSED2,
+ PMF_UNUSED3,
+ PMF_UNUSED4 // 23rd flag
+} entity_pm_flags;
// remove these flags when landing on ground -- CEV
const float PM_ONGROUNDFLAGS = PMF_ONSLOPE | PMF_CLIMB | PMF_PUSHED |
@@ -186,12 +190,16 @@ float(float maxspeed, float a, float c, float t) PM_MaxCircleGroundSpeed;
float() PM_Nudge;
// PM_SETONGROUND_NOGROUND()
// PM_SETONGROUND_TRACEGROUND()
+// PM_SETONGROUND_ONMOVINGENT()
// PM_SETONGROUND()
// PM_DANCEMOVE_ADDTOUCH(ent)
// PM_DANCEMOVE_DOTOUCH(ent)
+// PM_DANCEMOVE_STEP_DOWN(start_vel, end, j, k, FL)
+// PM_DANCEMOVE_STEP_FORWARD(start_vel, end, j, k, FL)
+// PM_DANCEMOVE_STEP_UP(start_vel, end, j, k, FL)
// PM_DANCEMOVE_AXIALNUDGE(plane)
-// PM_DANCEMOVE_CLIP_INNER(v, pl_a, pl_b, pl_c, k)
-// PM_DANCEMOVE_CLIP(v, pl_i, pl_j, pl_k, k)
+// PM_DANCEMOVE_CLIP_INNER(v, p_a, p_b, p_c, k)
+// PM_DANCEMOVE_CLIP(v, p_i, p_j, p_k, k)
// PM_DANCEMOVE_GROUNDIMPACT()
// PM_DANCEMOVE(end, start_vel, i, j, k)
void() PM_CrouchStart;
@@ -204,7 +212,7 @@ void() PM_WallJump;
void() PM_WallJumpCheck;
// PM_FRICTION(speed1, temp, friction, move_time)
// PM_ACCELERATE(dir, wish, speed1, newspeed, accel, move_time)
-// PM_AIRCONTROL(dir, wish, cur, new, zspeed, dot, move_time)
+// PM_AIRCONTROL(dir, pushdir, newspeed, move_time)
// PM_MOVE_MOVETYPES_CATEGORIZEPOSITION()
// PM_MOVE_MOVETYPES_SETNOCLIPFLAGS()
// PM_MOVE_MOVETYPES_NOCLIPACCELERATE(scale, move_time)
@@ -265,25 +273,25 @@ float(float maxspeed, float a, float f, float t) PM_MaxCircleGroundSpeed =
// PM_TRUNCATEVECTORTOEIGTH - truncate a vector to 0.125 precision -- CEV
//----------------------------------------------------------------------
#define PM_TRUNCATEVECTORTOEIGTH(vec) \
-{ \
+/* { */ \
vec.x = (floor(vec.x * 8 + (1.0 / 16))) * PM_FLMIN; \
vec.y = (floor(vec.y * 8 + (1.0 / 16))) * PM_FLMIN; \
vec.z = (floor(vec.z * 8 + (1.0 / 16))) * PM_FLMIN; \
-}
+/* } */
//----------------------------------------------------------------------
// PM_CHECKVELOCITY - bound self.velocity to server maximums -- CEV
//----------------------------------------------------------------------
#define PM_CHECKVELOCITY(vel) \
-{ \
+/* { */ \
vel.x = bound (-PM_MAXVELOCITY, vel.x, PM_MAXVELOCITY); \
vel.y = bound (-PM_MAXVELOCITY, vel.y, PM_MAXVELOCITY); \
vel.z = bound (-PM_MAXVELOCITY, vel.z, PM_MAXVELOCITY); \
-}
+/* } */
//----------------------------------------------------------------------
// PM_Nudge
-// from the GPL2 CSQCTest code that comes with FTEQW; is called often
+// from the GPL2 CSQCTest code that comes with FTEQW; may be called often
// to nudge player origin due to float/network precision errors -- CEV
//----------------------------------------------------------------------
float() PM_Nudge =
@@ -328,7 +336,7 @@ float() PM_Nudge =
//----------------------------------------------------------------------
#define PM_SETONGROUND_NOGROUND() \
-{ \
+/* { */ \
/* not on ground, clear pmove flags & fields -- CEV */ \
self.groundentity = __NULL__; \
self.groundnormal = '0 0 0'; \
@@ -337,25 +345,66 @@ float() PM_Nudge =
/* don't crouchslide in air -- CEV */ \
if (self.pm_flags & PMF_CROUCHSLIDE) \
{ \
- if (self.pm_timer < 0) \
- self.pm_timer = 0; \
+ /* TODO CEV */ \
PM_CrouchSlideStop (); \
} \
-}
+/* } */
//----------------------------------------------------------------------
#define PM_SETONGROUND_TRACEGROUND() \
-{ \
+/* { */ \
/* do a trace to check for ground -- CEV */ \
- tracebox (self.origin, self.mins, self.maxs, \
- self.origin - '0 0 0.25', PM_MOVEFLAGS, self); \
+ if (self.pm_flags & PMF_ONMOVINGENT) \
+ { \
+ /* trace further when on a vertically moving ent -- CEV */ \
+ tracebox (self.origin, self.mins, self.maxs, \
+ self.origin - '0 0 4', PM_MOVEFLAGS, self); \
+ } \
+ else \
+ { \
+ tracebox (self.origin, self.mins, self.maxs, \
+ self.origin - '0 0 0.25', PM_MOVEFLAGS, self); \
+ } \
+/* } */
+
+//----------------------------------------------------------------------
+// PM_SETONGROUND_ONMOVINGENT -- set flag & glue the player to any
+// vertically moving PUSH entity they're standing on -- CEV
+//----------------------------------------------------------------------
+#ifdef SSQC
+#define PM_SETONGROUND_ONMOVINGENT() \
+/* { */ \
+ /* flag when standing on a moving ent -- CEV */ \
+ if (trace_ent.movetype == MOVETYPE_PUSH) \
+ { \
+ if (trace_ent.origin - trace_ent.origin_net) \
+ { \
+ self.pm_flags |= PMF_ONMOVINGENT; \
+ /*
+ dprint (sprintf("PM_SETONGROUND_ONMOVINGENT: found " \
+ " %s moving at %v\n", trace_ent.classname, \
+ trace_ent.velocity)); \
+ */ \
+ } \
+ } \
+ else if (self.pm_flags & PMF_ONMOVINGENT) \
+ { \
+ self.pm_flags &= ~PMF_ONMOVINGENT; \
+ } \
+/* } */
+#endif
+
+#ifdef CSQC
+#define PM_SETONGROUND_ONMOVINGENT() \
+{ \
}
+#endif
//----------------------------------------------------------------------
// PM_SETONGROUND -- manage ground flags and fields -- CEV
//----------------------------------------------------------------------
#define PM_SETONGROUND() \
-{ \
+/* { */ \
/* onground if we hit something & it faces upwards */ \
if (trace_fraction < 1.0f) \
{ \
@@ -370,7 +419,7 @@ float() PM_Nudge =
if (self.pm_flags & PMF_CROUCH_HELD) { \
if (!(self.pm_flags & PMF_CROUCHSLIDE)) { \
if (self.conlevel < WATERLEVEL_WAIST) { \
- if (self.speed > PM_MAXSPEED) \
+ if (speedc > PM_MAXSPEED) \
{ \
PM_CrouchSlideStart (); \
} } } } } \
@@ -396,7 +445,7 @@ float() PM_Nudge =
else if (trace_plane_normal.z > PM_PLANE_VERTICAL) \
{ \
/* on a steep slope */ \
- /* set groundentity and groundnormal -- CEV */ \
+ /* clear groundentity and groundnormal -- CEV */ \
self.groundentity = __NULL__; \
self.groundnormal = '0 0 0'; \
/* now do flags -- CEV */ \
@@ -414,21 +463,29 @@ float() PM_Nudge =
/* we probably shouldn't end up here -- CEV */ \
PM_SETONGROUND_NOGROUND () \
} \
- /* flag when standing on a vertically moving ent -- CEV */ \
- if (trace_networkentity || trace_ent.velocity.z != 0) \
- self.pm_flags |= PMF_ONMOVINGENT; \
- else if (self.pm_flags & PMF_ONMOVINGENT) \
- self.pm_flags &= ~PMF_ONMOVINGENT; \
+ PM_SETONGROUND_ONMOVINGENT () \
+ /* hack Z vel when standing on an entity with a touch
+ * function to make sure DANCEMOVE runs (and calls touch
+ * functions) later -- CEV */ \
+ /*
+ if (trace_ent.touch && trace_ent.touch != sub_null) \
+ { \
+ if (self.velocity.z == 0) \
+ { \
+ self.velocity.z = -1; \
+ } \
+ } \
+ */ \
} \
else \
{ \
PM_SETONGROUND_NOGROUND () \
} \
-}
+/* } */
//----------------------------------------------------------------------
#define PM_DANCEMOVE_ADDTOUCH(ent) \
-{ \
+/* { */ \
if (ent) \
{ \
if (ent.touch) \
@@ -443,11 +500,11 @@ float() PM_Nudge =
} } } \
} \
} \
-}
+/* } */
//----------------------------------------------------------------------
#define PM_DANCEMOVE_DOTOUCH(ent) \
-{ \
+/* { */ \
if (ent) \
{ \
if (ent.touch != __NULL__) \
@@ -464,11 +521,195 @@ float() PM_Nudge =
} \
} \
} \
-}
+/* } */
+
+//----------------------------------------------------------------------
+#define PM_DANCEMOVE_STEP_REWIND() \
+/* { */ \
+ /* discard the step attempt -- CEV */ \
+ trace_plane_normal = first_plane; \
+ /* TODO CEV rewind touched ents? */ \
+ trace_ent = first_ent; \
+ trace_fraction = first_frac; \
+/* } */
+
+//----------------------------------------------------------------------
+#define PM_DANCEMOVE_STEP_DOWN(start_vel, end, j, k, FL) \
+/* { */ \
+ /* third: move down; +1 to k is important -- CEV */ \
+ end = trace_endpos; \
+ end.z -= k + 1; \
+ tracebox (trace_endpos, self.mins, self.maxs, end, FL, self); \
+ if (trace_allsolid) \
+ { \
+ goto PM_DanceMove_RejectStep3; \
+ } \
+ else \
+ { \
+ /*
+ if (trace_endpos == save_pos) \
+ { \
+ dprint (sprintf("PM_DANCEMOVE: D\n")); \
+ goto PM_DanceMove_RejectStep3; \
+ } \
+ */ \
+ /* The down move will sometimes hit nothing (frac 1).
+ * In this case trace_plane_normal is unreliable (again
+ * we hit nothing) so do some extra checks to determine
+ * if we keep the step move -- CEV */ \
+ if (trace_fraction == 1.0f) \
+ { \
+ /* Check the plane just in case -- CEV */ \
+ if (trace_plane_normal.z != 0) \
+ { \
+ dprint ("PM_DANCEMOVE: C\n"); \
+ goto PM_DanceMove_RejectStep3; \
+ } \
+ /* If we haven't moved and first_plane is not
+ * vertical then reject the attempt -- CEV */ \
+ if (trace_endpos == self.origin) \
+ { \
+ if (first_plane.z != 0.0f) \
+ { \
+ dprint ("PM_DANCEMOVE: E\n"); \
+ goto PM_DanceMove_RejectStep3; \
+ } \
+ } \
+ else \
+ { \
+ /* dprint (sprintf("PM_DANCEMOVE: Z %g\n", \
+ self.velocity.z)); */ \
+ if (self.velocity.z < 0) \
+ { \
+ goto PM_DanceMove_RejectStep3; \
+ } \
+ } \
+ } \
+ else if (trace_plane_normal.z <= PM_PLANE_GROUND) \
+ { \
+ /* this is the expected and regular
+ * not-good-ground step rejection -- CEV */ \
+ goto PM_DanceMove_RejectStep3; \
+ } \
+ /* accept the stepped move. update time_left,
+ * origin, touched ents, and stored planes,
+ * then update flags -- CEV */ \
+ time_left = j; \
+ self.origin = trace_endpos; \
+ if (trace_ent.touch) \
+ { \
+ PM_DANCEMOVE_ADDTOUCH (trace_ent) \
+ } \
+ /* plane2 = plane1 = '0 0 0'; */ \
+ if (roof_plane) \
+ { \
+ if (roof_plane != trace_plane_normal) \
+ { \
+ if (roof_plane != plane1) \
+ { \
+ if (roof_plane != plane2) \
+ { \
+ plane2 = plane1; \
+ plane1 = roof_plane; \
+ } \
+ } \
+ } \
+ } \
+ if (fwd_plane) \
+ { \
+ if (fwd_plane != trace_plane_normal) \
+ { \
+ if (fwd_plane != plane1) \
+ { \
+ if (fwd_plane != plane2) \
+ { \
+ plane2 = plane1; \
+ plane1 = fwd_plane; \
+ } \
+ } \
+ } \
+ } \
+ self.pm_flags |= PMF_STEPPED; \
+ if (!(self.pm_flags & PMF_ONGROUND)) \
+ { \
+ if (start_vel.z <= 0) \
+ { \
+ /* for stairjumps -- CEV */ \
+ self.pm_flags |= PMF_AIRSTEPPED; \
+ } \
+ } \
+ } \
+/* } */
+
+//----------------------------------------------------------------------
+#define PM_DANCEMOVE_STEP_FORWARD(start_vel, end, j, k, FL) \
+/* { */ \
+ /* second: move forward */ \
+ k = trace_endpos.z - self.origin.z; \
+ end = trace_endpos + (self.velocity * j); \
+ end.z = trace_endpos.z; \
+ tracebox (trace_endpos, self.mins, self.maxs, end, FL, self); \
+ if (trace_allsolid) \
+ { \
+ goto PM_DanceMove_RejectStep3; \
+ } \
+ /* if we hit the same plane we're trying to step over
+ * and we made no progress in the move then reject
+ * the step attempt -- CEV */ \
+ if (trace_plane_normal == first_plane) \
+ { \
+ if (fabs(self.origin.x - trace_endpos.x) < PM_FLMIN) \
+ { \
+ if (fabs(self.origin.y - trace_endpos.y) < PM_FLMIN) \
+ { \
+ /* dprint (sprintf("PM_DANCEMOVE: B\n")); */ \
+ goto PM_DanceMove_RejectStep3; \
+ } \
+ } \
+ } \
+ local vector fwd_plane = '0 0 0'; \
+ /* local vector save_pos = trace_endpos; */ \
+ j -= j * trace_fraction; \
+ if (trace_fraction < 1.0f) \
+ { \
+ PM_DANCEMOVE_ADDTOUCH (trace_ent) \
+ fwd_plane = trace_plane_normal; \
+ } \
+ PM_DANCEMOVE_STEP_DOWN (start_vel, end, j, k, FL) \
+/* } */
+
+//----------------------------------------------------------------------
+#define PM_DANCEMOVE_STEP_UP(start_vel, end, j, k, FL) \
+/* { */ \
+ /* first: move up */ \
+ trace_endpos.z += PM_STEPHEIGHT; \
+ tracebox (self.origin, self.mins, self.maxs, trace_endpos, FL, self); \
+ if (!trace_allsolid && !trace_startsolid) \
+ { \
+ if (trace_endpos.z - self.origin.z <= 0) \
+ { \
+ /* dprint (sprintf("PM_DANCEMOVE: A %v\n", \
+ trace_endpos - self.origin)); */ \
+ goto PM_DanceMove_RejectStep3; \
+ } \
+ local vector roof_plane = '0 0 0'; \
+ if (trace_fraction < 1.0f) \
+ { \
+ PM_DANCEMOVE_ADDTOUCH (trace_ent) \
+ roof_plane = trace_plane_normal; \
+ } \
+ PM_DANCEMOVE_STEP_FORWARD (start_vel, end, j, k, FL) \
+ } \
+ else \
+ { \
+ PM_DanceMove_RejectStep3: \
+ PM_DANCEMOVE_STEP_REWIND () \
+ } \
+/* } */
//----------------------------------------------------------------------
#define PM_DANCEMOVE_AXIALNUDGE(plane) \
-{ \
+/* { */ \
if (plane) \
{ \
if (trace_plane_normal * plane > 0.99f) \
@@ -476,65 +717,81 @@ float() PM_Nudge =
self.velocity += trace_plane_normal; \
} \
} \
-}
+/* } */
//----------------------------------------------------------------------
// PM_DANCEMOVE_CLIP_INNER
// This macro is meant to be called from PM_DANCEMOVE_CLIP -- CEV
//----------------------------------------------------------------------
-#define PM_DANCEMOVE_CLIP_INNER(v, pl_a, pl_b, pl_c, k) \
-{ \
- /* test if plane_b exists, is not identical to plane_a, and
- * that velocity interacts with it -- CEV */ \
- if (pl_b) { \
- if (pl_b != pl_a) \
+#define PM_DANCEMOVE_CLIP_INNER(v, p_a, p_b, p_c, k) \
+/* { */ \
+ /* if plane_b is not plane_a and if velocity interacts -- CEV */ \
+ if (p_b != p_a) \
{ \
- k = self.velocity * pl_b; \
+ k = self.velocity * p_b; \
if (k < PM_PLANE_INTERACT) \
{ \
- /* clip to plane_b (the second plane) -- CEV */ \
- self.velocity -= pl_b * k; \
+ /* clip to plane_b -- CEV */ \
+ self.velocity -= p_b * k; \
/* test if move goes back into the first plane */ \
- if (self.velocity * pl_a < 0) \
+ if (self.velocity * p_a < 0) \
{ \
/* slide along the crease -- CEV */ \
/* ("><" is crossproduct) -- CEV */ \
- v = pl_a >< pl_b; \
+ v = p_a >< p_b; \
v = normalize (v); \
self.velocity = v * (v * self.velocity); \
/* check if we interact with a 3rd plane */ \
- if (pl_c) { \
- if (self.velocity * pl_c < 0) \
+ if (self.velocity * p_c < 0) \
{ \
/* stop when 3 planes interact */ \
self.velocity = '0 0 0'; \
break; \
- } } \
+ } \
} \
} \
- } } \
-}
+ } \
+/* } */
//----------------------------------------------------------------------
// PM_DANCEMOVE_CLIP
// This macro is meant to be called from PM_DANCEMOVE -- CEV
//----------------------------------------------------------------------
-#define PM_DANCEMOVE_CLIP(v, pl_i, pl_j, pl_k, k) \
-{ \
- /* test if plane_i exists & if velocity interacts with it -- CEV */ \
- if (pl_i) \
+#define PM_DANCEMOVE_CLIP(v, p_i, p_j, p_k, k) \
+/* { */ \
+ /* test if velocity interacts with first plane -- CEV */ \
+ k = self.velocity * p_i; \
+ if (k < PM_PLANE_INTERACT) \
{ \
- k = self.velocity * pl_i; \
+ /* clip to the plane -- CEV */ \
+ self.velocity -= p_i * k; \
+ /* check for 2nd and 3rd plane interactions -- CEV */ \
+ PM_DANCEMOVE_CLIP_INNER (v, p_i, p_j, p_k, k) \
+ PM_DANCEMOVE_CLIP_INNER (v, p_i, p_k, p_j, k) \
+ } \
+ else \
+ { \
+ /* if no interaction with first then check the 2nd -- CEV */ \
+ k = self.velocity * p_j; \
if (k < PM_PLANE_INTERACT) \
{ \
- /* clip to the plane -- CEV */ \
- self.velocity -= pl_i * k; \
- /* check for 2nd and 3rd plane interactions -- CEV */ \
- PM_DANCEMOVE_CLIP_INNER (v, pl_i, pl_j, pl_k, k) \
- PM_DANCEMOVE_CLIP_INNER (v, pl_i, pl_k, pl_j, k) \
+ self.velocity -= p_j * k; \
+ PM_DANCEMOVE_CLIP_INNER (v, p_j, p_i, p_k, k) \
+ PM_DANCEMOVE_CLIP_INNER (v, p_j, p_k, p_i, k) \
+ } \
+ else \
+ { \
+ /* now the third stored plane -- CEV */ \
+ k = self.velocity * p_k; \
+ if (k < PM_PLANE_INTERACT) \
+ { \
+ self.velocity -= p_k * k; \
+ PM_DANCEMOVE_CLIP_INNER (v, p_k, p_j, p_i, k) \
+ PM_DANCEMOVE_CLIP_INNER (v, p_k, p_i, p_j, k) \
+ } \
} \
} \
-}
+/* } */
//----------------------------------------------------------------------
// PM_DANCEMOVE_GROUNDIMPACT
@@ -542,14 +799,14 @@ float() PM_Nudge =
//----------------------------------------------------------------------
#ifdef SSQC
#define PM_DANCEMOVE_GROUNDIMPACT() \
-{ \
+/* { */ \
/* impact info (see player_postthink) -- CEV */ \
if (!(self.pm_flags & PMF_ONGROUND)) { \
if (self.velocity.z < self.jump_flag) \
{ \
self.jump_flag = self.velocity.z; \
} } \
-}
+/* } */
#endif
#ifdef CSQC
@@ -572,7 +829,7 @@ float() PM_Nudge =
// that comes with FTEQW. -- CEV
//----------------------------------------------------------------------
#define PM_DANCEMOVE(end, start_vel, i, j, k) \
-{ \
+/* { */ \
local float grav = 0; \
if (self.conlevel < WATERLEVEL_WAIST) { \
if (!(self.pm_flags & PMF_ONLADDER)) { \
@@ -607,22 +864,18 @@ float() PM_Nudge =
end = self.origin + (self.velocity * time_left); \
tracebox (self.origin, self.mins, self.maxs, end, \
PM_MOVEFLAGS, self); \
- if (trace_allsolid) \
+ if (trace_allsolid && trace_startsolid) \
{ \
/* self is in something else; attempt to nudge out */ \
if (PM_Nudge()) \
continue; \
- else \
- setorigin (self, self.oldorigin); \
- /* nah, we're stuck. don't build up falling damage
- * but allow sideways acceleration -- CEV */ \
- dprint ("PM_DANCEMOVE: player entity stuck!"); \
- dprint (sprintf(" timestamp %g\n", time)); \
- self.velocity.z = 0; \
+ dprint (sprintf("PM_DANCEMOVE: trapped in a solid %s" \
+ "! time %g\n", trace_ent.classname, time)); \
break; \
} \
- /* accept the move -- CEV */ \
- self.origin = trace_endpos; \
+ if (trace_fraction > 0) \
+ /* accept the move -- CEV */ \
+ self.origin = trace_endpos; \
if (trace_fraction >= 1.0f) \
/* no obstructions, made the whole move -- CEV */ \
break; \
@@ -641,150 +894,12 @@ float() PM_Nudge =
local vector first_plane = trace_plane_normal; \
local entity first_ent = trace_ent; \
local float first_frac = trace_fraction; \
- local float first_net = trace_networkentity; \
j = time_left; \
- /* first: move up */ \
- trace_endpos.z += PM_STEPHEIGHT; \
- tracebox (self.origin, self.mins, self.maxs, \
- trace_endpos, PM_MOVEFLAGS, self); \
- if (trace_allsolid || trace_startsolid) \
- goto PM_DanceMove_RejectStep2; \
- if (trace_endpos.z - self.origin.z <= 0) \
- { \
- /* dprint (sprintf("PM_DANCEMOVE: A %v\n", \
- trace_endpos - self.origin)); */ \
- goto PM_DanceMove_RejectStep2; \
- } \
- local vector roof_plane = '0 0 0'; \
- if (trace_fraction < 1.0f) \
- { \
- PM_DANCEMOVE_ADDTOUCH (trace_ent) \
- roof_plane = trace_plane_normal; \
- } \
- /* second: move forward */ \
- k = trace_endpos.z - self.origin.z; \
- end = trace_endpos + (self.velocity * j); \
- end.z = trace_endpos.z; \
- tracebox (trace_endpos, self.mins, self.maxs, end, \
- PM_MOVEFLAGS, self); \
- if (trace_allsolid) \
- goto PM_DanceMove_RejectStep2; \
- /* if we hit the same plane we're trying to step over
- * and we made no progress in the move then reject
- * the step attempt -- CEV */ \
- if (trace_plane_normal == first_plane) { \
- if (fabs(self.origin.x - trace_endpos.x) < PM_FLMIN) \
- if (fabs(self.origin.y - trace_endpos.y) < PM_FLMIN) \
- /* dprint (sprintf("PM_DANCEMOVE: B\n")); */ \
- goto PM_DanceMove_RejectStep2; \
- } \
- local vector fwd_plane = '0 0 0'; \
- /* local vector save_pos = trace_endpos; */ \
- j -= j * trace_fraction; \
- if (trace_fraction < 1.0f) \
- { \
- PM_DANCEMOVE_ADDTOUCH (trace_ent) \
- fwd_plane = trace_plane_normal; \
- } \
- /* third: move down; +1 to k is important -- CEV */ \
- end = trace_endpos; \
- end.z -= k + 1; \
- tracebox (trace_endpos, self.mins, self.maxs, end, \
- PM_MOVEFLAGS, self); \
- /*
- if (trace_endpos == save_pos) \
- { \
- dprint (sprintf("PM_DANCEMOVE: D\n")); \
- goto PM_DanceMove_RejectStep2; \
- } \
- */ \
- /* The down move will sometimes hit nothing (frac 1).
- * In this case trace_plane_normal is unreliable (again
- * we hit nothing) so do some extra checks to determine
- * if we keep the step move -- CEV */ \
- if (trace_fraction == 1.0f) \
- { \
- /*
- dprint (sprintf("PM_DANCEMOVE: norm %v, " \
- "diff %v, time %g\n", \
- trace_plane_normal, \
- trace_endpos - self.origin, \
- j)); \
- */ \
- /* Check the plane just in case -- CEV */ \
- if (trace_plane_normal.z != 0) \
- { \
- dprint ("PM_DANCEMOVE: C\n"); \
- goto PM_DanceMove_RejectStep2; \
- } \
- /* If we haven't moved and first_plane is not
- * vertical then reject the attempt -- CEV */ \
- if (trace_endpos == self.origin) \
- { \
- if (first_plane.z != 0.0f) \
- goto PM_DanceMove_RejectStep2; \
- } \
- else \
- { \
- /* TODO CEV we still need to reject the
- * step here, don't fully understand
- * the reason why -- CEV */ \
- /*
- dprint (sprintf("PM_DANCEMOVE: Z %v\n",\
- trace_endpos - save_pos)); \
- */ \
- goto PM_DanceMove_RejectStep2; \
- } \
- } \
- else if (trace_plane_normal.z <= PM_PLANE_GROUND) \
- { \
- /* this is the expected and regular
- * not-good-ground step rejection -- CEV */ \
- goto PM_DanceMove_RejectStep2; \
- } \
- if (trace_allsolid == FALSE) \
- { \
- /* accept the stepped move. update time_left,
- * origin, touched ents, and stored planes,
- * then update flags -- CEV */ \
- time_left = j; \
- self.origin = trace_endpos; \
- if (trace_ent.touch) \
- PM_DANCEMOVE_ADDTOUCH (trace_ent) \
- plane2 = plane1 = '0 0 0'; \
- if (roof_plane) { \
- if (roof_plane != trace_plane_normal) \
- { \
- plane1 = roof_plane; \
- } } \
- if (fwd_plane) { \
- if (fwd_plane != trace_plane_normal) \
- { \
- plane2 = plane1; \
- plane1 = fwd_plane; \
- } } \
- self.pm_flags |= PMF_STEPPED; \
- if (!(self.pm_flags & PMF_ONGROUND)) { \
- if (start_vel.z <= 0) \
- { \
- /* for stairjumps. -- CEV */ \
- self.pm_flags |= PMF_AIRSTEPPED; \
- } } \
- } \
- else \
- { \
- /* discard the step attempt -- CEV */ \
- PM_DanceMove_RejectStep2: \
- trace_plane_normal = first_plane; \
- /* TODO CEV rewind touched ents? */ \
- trace_ent = first_ent; \
- trace_fraction = first_frac; \
- trace_networkentity = first_net; \
- } \
+ /* this next macro starts a chain of macros that will
+ * complete (or abandon) the step attempt -- CEV */ \
+ PM_DANCEMOVE_STEP_UP (start_vel, end, j, k, \
+ PM_MOVEFLAGS) \
} } } \
- PM_DANCEMOVE_AXIALNUDGE (self.velocity) \
- PM_DANCEMOVE_AXIALNUDGE (plane1) \
- PM_DANCEMOVE_AXIALNUDGE (plane2) \
/* we've found a ground plane so call PM_SETONGROUND -- CEV */ \
if (trace_plane_normal.z > PM_PLANE_GROUND) \
{ \
@@ -793,14 +908,13 @@ float() PM_Nudge =
} \
/* check stored planes and clip velocity as needed -- CEV */ \
PM_DANCEMOVE_CLIP (end, trace_plane_normal, plane1, plane2, k) \
- PM_DANCEMOVE_CLIP (end, plane1, trace_plane_normal, plane2, k) \
- PM_DANCEMOVE_CLIP (end, plane2, plane1, trace_plane_normal, k) \
/* store current plane and plane1 for the next pass -- CEV */ \
- if (trace_plane_normal != self.groundnormal) \
+ if (trace_plane_normal != plane1) { \
+ if (trace_plane_normal != plane2) \
{ \
plane2 = plane1; \
plane1 = trace_plane_normal; \
- } \
+ } } \
/* stop if we've turned against original velocity -- CEV */ \
if (self.velocity * start_vel <= 0) \
self.velocity = '0 0 0'; \
@@ -808,8 +922,7 @@ float() PM_Nudge =
if (self.velocity == '0 0 0') \
break; \
} \
- /* call the touch functions of any entities we've collided with
- * (as needed) -- CEV */ \
+ /* call touch () on any entities we've collided with -- CEV */ \
PM_DANCEMOVE_DOTOUCH (touched_ent3) \
PM_DANCEMOVE_DOTOUCH (touched_ent2) \
PM_DANCEMOVE_DOTOUCH (touched_ent1) \
@@ -855,7 +968,7 @@ float() PM_Nudge =
PM_DanceMove_ClearFlags2: \
/* clear slide hint flags -- CEV */ \
self.pm_flags = self.pm_flags - (self.pm_flags & PM_SLIDEFLAGS); \
-}
+/* } */
//----------------------------------------------------------------------
void() PM_CrouchStart =
@@ -913,23 +1026,20 @@ void() PM_CrouchStop =
//----------------------------------------------------------------------
void() PM_CrouchSlideStart =
{
+ #if 0
+ dprint (sprintf("PM_CrouchSlideStart: lesgo %g, timer %g\n",
+ self.velocity.z, self.pm_timer));
+ #endif
+
if (self.pm_timer >= 0)
{
#ifdef SSQC
- #if 0
- sound (self, CHAN_AUTO, "player/slidestart.ogg",
- 0.4, ATTN_FEET);
+ sound (self, CHAN_SLIDE, "cev/player/dive.ogg",
+ 0.3, ATTN_FEET);
#endif
- sound (self, CHAN_SLIDE, "player/slide.ogg",
- 0.2, ATTN_FEET);
- #endif
- self.pm_timer = -PM_CROUCHSLIDE_TIME;
+ self.pm_timer = PM_CROUCHSLIDE_TIME * -1;
}
- #ifdef SSQC
- dprint (sprintf("PM_CrouchSlideStart: lesgo %g\n", self.velocity.z));
- #endif
-
self.pm_flags |= PMF_CROUCHSLIDE;
};
@@ -941,7 +1051,8 @@ void() PM_CrouchSlideStop =
self.pm_flags &= ~PMF_CROUCHSLIDE;
#ifdef SSQC
- sound (self, CHAN_SLIDE, "misc/null.wav", 0.4, ATTN_FEET);
+ if (self.pm_timer >= 0)
+ sound (self, CHAN_SLIDE, "misc/null.wav", 0.4, ATTN_FEET);
#endif
};
@@ -1009,7 +1120,7 @@ void() PM_Jump =
#ifdef SSQC
local float r2 = rint (random() * 3);
vol = 0.1;
- wav = sprintf ("player/jump0%g.ogg", r2 + 1);
+ wav = sprintf ("cev/player/jump_0%g.ogg", r2 + 1);
#endif
if (self.pm_flags & PMF_ONRAMP)
@@ -1050,10 +1161,17 @@ void() PM_Jump =
if (wav != "")
sound (self, CHAN_BODY, wav, vol, ATTN_NORM);
player_footstep ();
+ #if 0
+ dprint (sprintf("PM_Jump: Z velocity %g, time %g\n",
+ self.velocity.z, time));
+ #endif
#endif
// timers for all jumps -- CEV
- self.pm_timer = PM_DOUBLEJUMP_WINDOW;
+ if (self.pm_timer >= 0)
+ {
+ self.pm_timer = PM_DOUBLEJUMP_WINDOW;
+ }
};
//----------------------------------------------------------------------
@@ -1079,7 +1197,9 @@ void() PM_WallClimb =
// reset pm_timer so we don't stick to the floor -- CEV
self.pm_flags |= PMF_CLIMB;
self.pm_flags |= PMF_JUMP_HELD;
- self.pm_timer = 0;
+
+ if (self.pm_timer > 0)
+ self.pm_timer = 0;
#if 0
dprint (sprintf("PM_WallClimb: vel.z %g\n", self.velocity.z));
@@ -1107,28 +1227,43 @@ void() PM_WallJump =
if (self.velocity.z > 0)
self.velocity += trace_plane_normal * PM_WALLJUMPFORCE;
+ #ifdef SSQC
if (self.pm_timer > 0)
{
- #ifdef SSQC
vol = 0.9;
wav = "player/plyrjmp8.wav";
- #endif
- self.velocity.z = PM_WALLJUMPDOUBLE;
}
else
{
- #ifdef SSQC
local float r = rint (random() * 3);
vol = 0.2;
- wav = sprintf ("player/jump0%g.ogg", r + 1);
- #endif
- self.velocity.z = PM_WALLJUMPSPEED;
+ wav = sprintf ("cev/player/jump_0%g.ogg", r + 1);
+ }
+ #endif
+
+ // additive if not falling -- CEV
+ if (self.pm_timer > 0)
+ {
+ if (self.velocity.z > 0)
+ self.velocity.z = max (PM_WALLJUMPDOUBLE,
+ self.velocity.z + PM_WALLJUMPSPEED);
+ else
+ self.velocity.z = PM_WALLJUMPDOUBLE;
+ }
+ else
+ {
+ if (self.velocity.z > 0)
+ self.velocity.z += PM_WALLJUMPSPEED;
+ else
+ self.velocity.z = PM_WALLJUMPSPEED;
}
// manage flags & fields -- CEV
self.pm_flags |= PMF_JUMP_HELD;
self.pm_flags |= PMF_WALLJUMPED;
- self.pm_timer = 0;
+
+ if (self.pm_timer > 0)
+ self.pm_timer = 0;
// server-side stuff
#ifdef SSQC
@@ -1214,6 +1349,11 @@ void() PM_WallJumpCheck =
{
// moving away from the wall, not holding
// jump, and haven't walljumped -- CEV
+ #if 0
+ dprint (sprintf("PM_WallJumpCheck: calling "
+ "WallJump, grounddist %g\n",
+ grounddist));
+ #endif
PM_WallJump ();
break;
} } }
@@ -1287,13 +1427,14 @@ void() PM_WallJumpCheck =
} } }
// player can't hold on to thin air -- CEV
- self.pm_flags &= ~PMF_CLIMB;
+ // TODO CEV
+ // self.pm_flags &= ~PMF_CLIMB;
}
};
//----------------------------------------------------------------------
#define PM_FRICTION(speed1, temp, friction, move_time) \
-{ \
+/* { */ \
speed1 = vlen (self.velocity); \
if (speed1 < PM_FLMIN) \
{ \
@@ -1314,11 +1455,11 @@ void() PM_WallJumpCheck =
else \
self.velocity *= temp / speed1; \
} \
-}
+/* } */
//----------------------------------------------------------------------
#define PM_ACCELERATE(dir, wish, speed1, newspeed, accel, move_time) \
-{ \
+/* { */ \
speed1 = wish - (self.velocity * dir); \
if (speed1 > 0) \
{ \
@@ -1326,34 +1467,46 @@ void() PM_WallJumpCheck =
newspeed = min (newspeed, speed1); \
self.velocity += newspeed * dir; \
} \
-}
+/* } */
//----------------------------------------------------------------------
-#define PM_AIRCONTROL(dir, wish, cur, new, zspeed, dot, move_time) \
-{ \
- zspeed = self.velocity.z; \
- self.velocity.z = 0; \
- cur = vlen (self.velocity); \
- self.velocity = normalize (self.velocity); \
- dot = self.velocity * dir; \
- if (dot > 0) \
- { \
- new = PM_AIRACCELBASE; \
- new *= bound (0, wish / PM_MAXAIRSPEED, 1); \
- new *= PM_AIRACCELTURN * dot * dot * move_time; \
- self.velocity = self.velocity * cur + dir * new; \
- self.velocity = normalize (self.velocity); \
- } \
- self.velocity *= cur; \
- self.velocity.z = zspeed; \
-}
+// this is based on the unused disabled "proper way" to do acceleration
+// in Quake 3 Arena; see code/game/bg_pmove.c line 260 of the GPL Quake
+// 3 source release -- CEV
+//
+// this macro is different in that it does no acceleration (and does not
+// reference wishspeed). Instead it changes movement direction and may
+// reduce movement speed. Use PM_ACCELERATE first to accel. -- CEV
+//
+// inspired by zweek's "how does airstrafing ACTUALLY work?" youtube video
+// (available here: https://www.youtube.com/watch?v=gRqoXy-0d84) -- CEV
+//
+// arguments are: wishdir, vec1, float1, float2, move_time
+//----------------------------------------------------------------------
+#define PM_AIRCONTROL(dir, pushdir, newspeed, move_time) \
+/* { */ \
+ /* self.velocity.z is already 0 -- CEV */ \
+ speedc = vlen (self.velocity); \
+ /* scale wishdir up to self.speed; cheers zweek, see
+ * https://www.youtube.com/watch?v=gRqoXy-0d84&t=1492s
+ * for more information -- CEV */ \
+ pushdir = (dir * speedc) - self.velocity; \
+ newspeed = PM_AIRACCELTURN * move_time * speedc; \
+ newspeed = min (newspeed, vlen(pushdir)); \
+ /*
+ dprint (sprintf("PM_AIRCONTROL: vlen pushdir %g, newspeed %g, " \
+ "speedc %g\n", vlen(pushdir), newspeed, speedc)); \
+ */ \
+ pushdir = normalize (pushdir); \
+ self.velocity += pushdir * newspeed; \
+/* } */
//----------------------------------------------------------------------
// PM_MOVE_MOVETYPES_CATEGORIZEPOSITION
// Based on similarly-named function in the GPL2 purecsqc pmove.qc
//----------------------------------------------------------------------
#define PM_MOVE_MOVETYPES_CATEGORIZEPOSITION() \
-{ \
+/* { */ \
/* if Z velocity is greater than 180 and we're not on a ramp or
* a steep slope then assume we're not onground (an optimization
* from Warsow / Warfork) -- CEV */ \
@@ -1390,8 +1543,7 @@ void() PM_WallJumpCheck =
if (self.pm_flags & PMF_ONGROUND) { \
if (self.conlevel >= WATERLEVEL_WAIST) \
{ \
- if (self.pm_timer < 0) \
- self.pm_timer = 0; \
+ /* TODO CEV */ \
PM_CrouchSlideStop (); \
} } } \
/* can't be waterjumping if we're on ground */ \
@@ -1401,11 +1553,11 @@ void() PM_WallJumpCheck =
self.pm_flags &= ~PMF_WATERJUMPED; \
self.flags &= ~FL_WATERJUMP; \
} } \
-}
+/* } */
//----------------------------------------------------------------------
#define PM_MOVE_MOVETYPES_SETNOCLIPFLAGS() \
-{ \
+/* { */ \
/* noclip is never on ground */ \
if (self.groundentity != __NULL__) \
self.groundentity = __NULL__; \
@@ -1423,14 +1575,14 @@ void() PM_WallJumpCheck =
self.pm_flags &= ~PMF_PUSHED; \
if (self.pm_flags & PMF_CLIMB) \
self.pm_flags &= ~PMF_CLIMB; \
- self.pm_timer = 0; \
-}
+ /* self.pm_timer = 0; */ \
+/* } */
//----------------------------------------------------------------------
// PM_MOVE_MOVETYPES_NOCLIPACCELERATE -- for flying / noclip -- CEV
//----------------------------------------------------------------------
#define PM_MOVE_MOVETYPES_NOCLIPACCELERATE(move_time) \
-{ \
+/* { */ \
if (input_buttons & PM_BTN_JUMP) \
{ \
/* smartjump */ \
@@ -1446,12 +1598,12 @@ void() PM_WallJumpCheck =
PM_FRICTION (speed1, temp, PM_GROUNDFRICTION, move_time) \
PM_ACCELERATE (wishdir, wishspeed, speed1, temp, PM_GROUNDACCEL, \
move_time) \
-}
+/* } */
#ifdef SSQC
//----------------------------------------------------------------------
#define PM_MOVE_MOVETYPES_SWIMPREMOVE_SSQC() \
-{ \
+/* { */ \
/* functionality copied into pmove from client.qc -- CEV */ \
if (self.conlevel >= WATERLEVEL_WAIST) { \
if (self.conlevel >= WATERLEVEL_EYES) { \
@@ -1466,7 +1618,7 @@ void() PM_WallJumpCheck =
sound (self, CHAN_BODY, "misc/water2.wav", \
0.6, ATTN_NORM); \
} } } \
-}
+/* } */
#endif
#ifdef CSQC
@@ -1480,7 +1632,7 @@ void() PM_WallJumpCheck =
// PM_MOVE_MOVETYPES_SWIMPREMOVE -- water jump, water wading sounds -- CEV
//----------------------------------------------------------------------
#define PM_MOVE_MOVETYPES_SWIMPREMOVE(start, end, move_time) \
-{ \
+/* { */ \
/* CheckWaterJump */ \
if (self.conlevel == WATERLEVEL_WAIST) \
{ \
@@ -1501,8 +1653,8 @@ void() PM_WallJumpCheck =
/* open at eye level */ \
self.flags |= FL_WATERJUMP; \
self.pm_flags |= PMF_WATERJUMPED; \
- self.flags &= ~FL_JUMPRELEASED; \
- self.pm_flags &= ~PMF_JUMP_HELD; \
+ self.flags |= FL_JUMPRELEASED; \
+ self.pm_flags |= PMF_JUMP_HELD; \
/* Z velocity was 225 */ \
self.velocity.z = PM_JUMPSPEED; \
} \
@@ -1514,14 +1666,14 @@ void() PM_WallJumpCheck =
self.pm_flags &= ~PMF_STEPPED; \
self.pm_flags &= ~PMF_AIRSTEPPED; \
} \
-}
+/* } */
//----------------------------------------------------------------------
// PM_MOVE_MOVETYPES_SWIMACCELERATE
// Largely copied from id Software's WaterMove -- CEV
//----------------------------------------------------------------------
#define PM_MOVE_MOVETYPES_SWIMACCELERATE(move_time) \
-{ \
+/* { */ \
if (!(self.pm_flags & PMF_WATERJUMPED)) \
{ \
if (input_buttons & PM_BTN_JUMP) \
@@ -1543,28 +1695,28 @@ void() PM_WallJumpCheck =
} \
PM_ACCELERATE (wishdir, wishspeed, speed1, temp, PM_WATERACCEL, \
move_time) \
-}
+/* } */
//----------------------------------------------------------------------
// PM_MOVE_MOVETYPES_WALKPREMOVE -- crouching, jumping, ladders -- CEV
//----------------------------------------------------------------------
#define PM_MOVE_MOVETYPES_WALKPREMOVE() \
-{ \
+/* { */ \
if (self.pm_flags & PMF_ONLADDER) \
{ \
- local float zspeed = fabs(self.velocity.z) + PM_CLIMBACCEL; \
+ local float znew = fabs(self.velocity.z) + PM_CLIMBACCEL; \
self.velocity *= PM_CLIMBSCALE; \
- self.speed = vlen ([self.velocity.x, self.velocity.y, 0]); \
+ speedc = vlen ([self.velocity.x, self.velocity.y, 0]); \
if (input_buttons & PM_BTN_JUMP || input_movevalues.z > 0) \
{ \
/* PlayerClimb -- johnfitz */ \
- self.velocity.z = bound (PM_CLIMBSPEEDMIN, zspeed, \
+ self.velocity.z = bound (PM_CLIMBSPEEDMIN, znew, \
PM_CLIMBSPEEDMAX); \
} \
else if (input_buttons & PM_BTN_DOWN || input_movevalues.z < 0)\
{ \
/* PlayerClimbDown -- CEV */ \
- self.velocity.z = bound (-PM_CLIMBSPEEDMAX, -zspeed, \
+ self.velocity.z = bound (-PM_CLIMBSPEEDMAX, -znew, \
-PM_CLIMBSPEEDMIN); \
} \
else \
@@ -1574,8 +1726,10 @@ void() PM_WallJumpCheck =
self.velocity.z = 0; \
} \
if (self.pm_flags & PMF_ONGROUND) \
+ { \
PM_SETONGROUND_NOGROUND () \
- self.pm_timer = 0; \
+ } \
+ /* self.pm_timer = 0; */ \
} \
else \
{ \
@@ -1618,35 +1772,73 @@ void() PM_WallJumpCheck =
if (wishspeed) \
{ \
/* work out the requested movement direction -- CEV */ \
- /* vectoyaw ignores the Z component of its input -- CEV */ \
- wishyaw -= vectoyaw (input_movevalues); \
- wishyaw = fabs (wishyaw - 360.0f * rint(wishyaw / 360.0f)); \
- /* we don't care about 180 (backward) wishyaw; we'll test
- * the dotproduct of wishvel and self.velocity later to
- * determine if we're slowing down or speeding up -- CEV */ \
- if (wishyaw == 180) \
- wishyaw = 0; \
- if (wishyaw == 0) \
+ if (input_movevalues.x == 0) \
{ \
- /* test if the player is looking perpendicular to
- * the direction they're moving in (+/- 30 degrees)
- * if that's the case then alter wishyaw so the
- * checks below will do Q1 air accel -- CEV */ \
- temp = input_angles.y - vectoyaw(self.velocity); \
- temp = fabs (temp - 360.0f * rint(temp / 360.0f)); \
- wishyaw = -wishyaw; \
- if (temp > 60.0f) \
- if (temp < 120.0f) \
- wishyaw = -90.0f; \
+ if (input_movevalues.y) \
+ wishyaw = 90; \
+ else \
+ wishyaw = 0; \
+ } \
+ else \
+ { \
+ if (input_movevalues.y == 0) \
+ { \
+ wishyaw = 0; \
+ } \
+ else \
+ { \
+ wishyaw = atan2 (input_movevalues.y, \
+ input_movevalues.x); \
+ wishyaw *= M_RAD2DEG; \
+ if (fabs(wishyaw) > 90) \
+ { \
+ if (wishyaw < 0) \
+ wishyaw += 180; \
+ else \
+ wishyaw -= 180; \
+ } \
+ /* don't need left/right here -- CEV */ \
+ if (wishyaw < 0) \
+ wishyaw = fabs (wishyaw); \
+ } \
} \
+ /*
+ dprint (sprintf("PM_MOVE_MOVETYPES_WALKPREMOVE: wishyaw %g, " \
+ "temp %g, time %g\n", wishyaw, temp, time)); \
+ */ \
+ /* test if the player is requesting movement perpendicular
+ * to the direction they're currently moving in (+/- 30
+ * degrees); if that's the case then alter wishyaw so the
+ * checks below will do Q1 air accel -- CEV */ \
+ if (wishyaw != 45) { \
+ if (self.pm_flags & PMF_CROUCHSLIDE || \
+ !(self.pm_flags & PMF_ONGROUND)) \
+ { \
+ temp = atan2 (self.velocity.y, self.velocity.x); \
+ temp *= M_RAD2DEG; \
+ temp = input_angles.y - temp; \
+ temp = fabs (temp - 360.0f * rint(temp / 360.0f)); \
+ if (wishyaw == 90) \
+ { \
+ if (temp > 60.0f) \
+ if (temp < 120.0f) \
+ wishyaw = 0; \
+ } \
+ else if (wishyaw == 0) \
+ { \
+ if (temp > 60.0f) \
+ if (temp < 120.0f) \
+ wishyaw = 90.0f; \
+ } \
+ } } \
} \
-}
+/* } */
//----------------------------------------------------------------------
// PM_MOVE_MOVETYPES_WALKACCELERATE -- accel & friction for MOVETYPE_WALK -- CEV
//----------------------------------------------------------------------
#define PM_MOVE_MOVETYPES_WALKACCELERATE(move_time) \
-{ \
+/* { */ \
accel = friction = speed1 = temp = 0; \
/* priority and sequence of these checks is important -- CEV */ \
if (self.pm_flags & PMF_ONGROUND) \
@@ -1654,37 +1846,29 @@ void() PM_WallJumpCheck =
if (self.pm_flags & PMF_ONSLICK) \
{ \
/* ice physics; friction remains 0 -- CEV */ \
- wishnew = min (wishspeed, PM_MAXSPEED); \
if (wishspeed) \
+ { \
accel = PM_SLICKACCEL; \
+ wishspeed = min (wishspeed, PM_MAXSPEED); \
+ } \
} \
else if (self.pm_flags & PMF_CROUCHSLIDE) \
{ \
/* movement while crouchsliding -- CEV */ \
- wishnew = min (wishspeed, PM_CROUCHSPEED); \
/* water level adds extra friction -- CEV */ \
friction = PM_SLIDEFRICTION + self.conlevel; \
- if (wishspeed) { \
- if (fabs(wishyaw) == 90) \
- { \
- /* Q1 air accel -- CEV */ \
- /* same behavior as when in the air -- CEV */ \
- accel = PM_SLIDEACCELY; \
- wishnew = min (wishspeed, PM_MAXAIRSPEED); \
- } \
- else if (wishyaw == 0) \
+ if (wishspeed) \
{ \
- /* CPM / Painkiller style control -- CEV */ \
- if (wishvel * self.velocity < 0) \
- accel = PM_AIRACCELXBACK; \
+ if (wishyaw == 0) \
+ { \
+ accel = -PM_SLIDEACCELFWD; \
+ } \
else \
- accel = PM_AIRACCELXFWD; \
+ { \
+ accel = PM_SLIDEACCELSIDE; \
+ } \
+ wishspeed = min (wishspeed, PM_MAXSLIDESPEED); \
} \
- else \
- { \
- /* regular ground accel -- CEV */ \
- accel = PM_SLIDEACCELXY; \
- } } \
} \
else \
{ \
@@ -1697,22 +1881,17 @@ void() PM_WallJumpCheck =
friction = PM_GROUNDFRICTION; \
if (wishspeed) \
{ \
- if (self.pm_timer > 0) \
- { \
+ if (self.pm_flags & PMF_CROUCHED) \
+ temp = PM_CROUCHSPEED; \
+ else if (self.pm_timer > 0) \
/* go directly to PM_MAXWISHSPEED
* for stairjumps -- CEV */ \
- wishnew = PM_MAXWISHSPEED; \
- } \
+ temp = PM_MAXWISHSPEED; \
+ else if (self.pm_flags & PMF_WALK_HELD) \
+ temp = PM_WALKSPEED; \
else \
- { \
- if (self.pm_flags & PMF_CROUCHED) \
- temp = PM_CROUCHSPEED; \
- else if (self.pm_flags & PMF_WALK_HELD)\
- temp = PM_WALKSPEED; \
- else \
- temp = PM_MAXSPEED; \
- wishnew = min (wishspeed, temp); \
- } \
+ temp = PM_MAXSPEED; \
+ wishspeed = min (wishspeed, temp); \
if (self.pm_flags & PMF_STEPPED) \
accel = PM_GROUNDACCEL * 0.1f; \
else \
@@ -1725,71 +1904,83 @@ void() PM_WallJumpCheck =
/* movement while surfing -- CEV */ \
if (wishspeed) \
{ \
- if (wishyaw == 45 || wishyaw == 135) \
+ if (wishyaw == 90) \
{ \
- /* Q3 accel -- CEV */ \
- accel = PM_SURFACCELXY; \
- wishnew = min (wishspeed, PM_MAXSPEED); \
+ /* Q1 air accel -- CEV */ \
+ accel = PM_SURFACCELSIDE; \
+ wishspeed = min (wishspeed, PM_MAXAIRSPEED); \
} \
else \
{ \
- /* Q1 air accel -- CEV */ \
- accel = PM_SURFACCELY; \
- wishnew = min (wishspeed, PM_MAXAIRSPEED); \
+ /* Q3 accel -- CEV */ \
+ accel = PM_SURFACCEL; \
+ wishspeed = min (wishspeed, PM_MAXSPEED); \
} \
} \
} \
else if (wishspeed) \
{ \
/* movement in the air -- CEV */ \
- if (fabs(wishyaw) == 90) \
+ if (wishyaw == 0) \
{ \
- /* Q1 air accel -- CEV */ \
- if (wishyaw < 0) { \
- if (self.speed < PM_MAXSPEED) \
- { \
- /* if player is holding +fwd / +back and
- * they're below MAXSPEED then nudge them
- * towards wishdir -- CEV */ \
- wishnew = min (wishspeed, PM_MAXSPEED); \
- accel = PM_AIRACCELXY; \
- PM_ACCELERATE (wishdir, wishnew, speed1, \
- temp, accel, move_time) \
- } } \
- accel = PM_AIRACCELY; \
- wishnew = min (wishspeed, PM_MAXAIRSPEED); \
+ /* Doom 2016 / Eternal-ish air control -- CEV */ \
+ if (self.pm_flags & PMF_CROUCHED) \
+ wishspeed = min (wishspeed, PM_CROUCHSPEED); \
+ else \
+ wishspeed = min (wishspeed, PM_MAXSPEED); \
+ if (wishvel * self.velocity < 0) \
+ accel = -PM_AIRACCELBACK; \
+ else \
+ accel = -PM_AIRACCELFWD; \
} \
else \
{ \
- wishnew = min (wishspeed, PM_MAXSPEED); \
- /* apply a penalty to wishspeed if player is holding
- * jump (simulating PM_CmdScale behavior in Quake 3)
- * -- CEV */ \
- if (self.pm_flags & PMF_JUMP_HELD) { \
- /*
- if (!(self.pm_flags & PMF_DOUBLEJUMPED)) \
+ /* Chovelyoukai / Lumia's "differential strafing" */ \
+ /* angle of the dot of wishdir and velocity -- CEV */ \
+ temp = vlen (wishdir) * speedc; \
+ temp = acos (wishdir * self.velocity / temp); \
+ temp *= M_RAD2DEG; \
+ /* optimal angle for Q1 accel at curspeed -- CEV */ \
+ /* approaches 90 deg as curspeed increases -- CEV */ \
+ friction = acos (PM_MAXAIRSPEED / speedc); \
+ friction *= M_RAD2DEG; \
+ if (temp > friction) \
{ \
- */ \
- /* scale in Q3 is 2.519685 when not holding
- * jump, 1.781686 when holding jump. 1.78 is
- * roughly 70% of 2.51. -- CEV */ \
- wishnew *= (0.7f + (0.3f * \
- (1 - (self.pm_timer / \
- PM_DOUBLEJUMP_WINDOW)))); \
- /* } */ } \
- if (wishyaw == 0) \
- { \
- /* CPM / Painkiller air control -- CEV */ \
- if (wishvel * self.velocity < 0) \
- accel = PM_AIRACCELXBACK; \
- else \
- accel = PM_AIRACCELXFWD; \
+ /* Q1 style air acceleration */ \
+ /* if we're below PM_MAXSPEED then nudge
+ * velocity towards wishdir -- CEV */ \
+ if (speedc < PM_MAXSPEED) \
+ { \
+ accel = PM_AIRACCEL; \
+ wishspeed = min (wishspeed, \
+ PM_MAXSPEED); \
+ PM_ACCELERATE (wishdir, wishspeed, \
+ speed1, temp, accel, \
+ move_time) \
+ } \
+ accel = PM_AIRACCELSIDE; \
+ /* this will work because MAXAIRSPEED is lower
+ * than MAXSPEED -- CEV */ \
+ wishspeed = min (wishspeed, PM_MAXAIRSPEED); \
} \
else \
{ \
- /* X and Y in the air: strafejumping -- CEV */ \
- accel = PM_AIRACCELXY; \
+ /* Q3 style air acceleration */ \
+ accel = PM_AIRACCEL; \
+ if (self.pm_flags & PMF_CROUCHED) \
+ temp = PM_CROUCHSPEED; \
+ else \
+ temp = PM_MAXSPEED; \
+ wishspeed = min (wishspeed, temp); \
+ if (self.pm_flags & PMF_JUMP_HELD) \
+ { \
+ wishspeed *= (0.7f + (0.4f * \
+ (1 - (self.pm_timer / \
+ PM_DOUBLEJUMP_WINDOW)))); \
+ } \
} \
+ /* revert the borrowed friction var -- CEV */ \
+ friction = 0; \
} \
} \
if (friction > 0) \
@@ -1797,38 +1988,48 @@ void() PM_WallJumpCheck =
/* standard Quake friction -- CEV */ \
PM_FRICTION (speed1, temp, friction, move_time) \
} \
- if (accel) \
+ if (accel > 0) \
{ \
/* standard Quake ground accel function -- CEV */ \
- PM_ACCELERATE (wishdir, wishnew, speed1, temp, accel, \
+ PM_ACCELERATE (wishdir, wishspeed, speed1, temp, accel, \
move_time) \
} \
- if (wishspeed) { \
- if (wishyaw == 0 || wishyaw == 180) \
+ else if (accel < 0) \
{ \
- PM_AIRCONTROL (wishdir, wishnew, speed1, temp, friction, \
+ /* +fwd air control -- CEV */ \
+ accel *= -1; \
+ /* accel if below wishspeed or we're slowing down -- CEV */ \
+ if (speedc < wishspeed || accel == PM_AIRACCELBACK) \
+ { \
+ PM_ACCELERATE (wishdir, wishspeed, speed1, temp, \
accel, move_time) \
- } } \
-}
+ } \
+ /* no control when braking -- CEV */ \
+ if (accel != PM_AIRACCELBACK) \
+ { \
+ PM_AIRCONTROL (wishdir, vec1, speed1, move_time) \
+ } \
+ } \
+/* } */
//----------------------------------------------------------------------
// PM_MOVE_MOVETYPES_MANAGETIMER
// self.pm_timer is pos when jumping, neg when crouchsliding -- CEV
//----------------------------------------------------------------------
#define PM_MOVE_MOVETYPES_MANAGETIMER(adjust_time) \
-{ \
+/* { */ \
if (self.pm_timer) \
{ \
- if (self.pm_flags & PMF_CROUCHSLIDE) \
+ if (self.pm_timer < 0) \
{ \
self.pm_timer += adjust_time; \
- if (self.pm_timer >= 0) \
+ if (self.pm_timer > 0) \
self.pm_timer = 0; \
} \
else \
{ \
self.pm_timer -= adjust_time; \
- if (self.pm_timer <= 0) \
+ if (self.pm_timer < 0) \
self.pm_timer = 0; \
} \
} \
@@ -1842,20 +2043,13 @@ void() PM_WallJumpCheck =
if (self.pm_timer <= 0) \
self.pm_flags &= ~PMF_DOUBLEJUMPED; \
} \
-}
+/* } */
//----------------------------------------------------------------------
// PM_MOVE_PRE -- prepare to move the player -- CEV
//----------------------------------------------------------------------
#define PM_MOVE_PRE() \
-{ \
- /* nudge player's origin if the server is sending low-precision
- * (16 bit?) player coordinates. This can be fixed by setting
- * sv_bigcoords to 1 (so the server sends float coords). -- CEV */ \
- if (world_bigcoords == FALSE) \
- { \
- PM_Nudge (); \
- } \
+/* { */ \
/* truncate velocity to network precision -- CEV */ \
if (self.velocity != '0 0 0') \
{ \
@@ -1864,7 +2058,10 @@ void() PM_WallJumpCheck =
/* clear JUMP_HELD if it's set and the user isn't pressing jump */ \
if (!(input_buttons & PM_BTN_JUMP)) \
{ \
- self.pm_flags &= ~PMF_JUMP_HELD; \
+ if (self.pm_flags & PMF_JUMP_HELD) \
+ { \
+ self.pm_flags &= ~PMF_JUMP_HELD; \
+ } \
} \
/* crouch key, crouchsliding -- CEV */ \
if (input_buttons & PM_BTN_DOWN) \
@@ -1886,18 +2083,28 @@ void() PM_WallJumpCheck =
{ \
self.pm_flags &= ~PMF_WALK_HELD; \
} \
-}
+ /* in case engine code has found ground -- CEV */ \
+ if (self.flags & FL_ONGROUND) \
+ { \
+ if (!(self.pm_flags & PMF_ONGROUND)) \
+ { \
+ self.pm_flags |= PMF_ONGROUND; \
+ } \
+ } \
+/* } */
//----------------------------------------------------------------------
// PM_MOVE_MOVETYPES
//----------------------------------------------------------------------
#define PM_MOVE_MOVETYPES() \
-{ \
- local vector wishdir, wishvel; \
- local float speed1, temp, wishspeed, wishyaw, wishyawdiff; \
- wishdir = wishvel = '0 0 0'; \
- speed1 = temp = wishspeed = wishyaw = wishyawdiff = 0; \
- self.speed = vlen ([self.velocity.x, self.velocity.y, 0]); \
+/* { */ \
+ local vector vec1, vec2, wishdir, wishvel; \
+ local float accel, friction, speed1, speedc, temp, wishspeed, wishyaw; \
+ vec1 = vec2 = wishdir = wishvel = '0 0 0'; \
+ accel = friction = speed1 = temp = wishspeed = wishyaw = 0; \
+ local float itl = input_timelength; \
+ speedc = vlen ([self.velocity.x, self.velocity.y, 0]); \
+ self.speed = speedc; \
if (self.movetype == MOVETYPE_NOCLIP) \
{ \
PM_MOVE_MOVETYPES_SETNOCLIPFLAGS () \
@@ -1905,18 +2112,32 @@ void() PM_WallJumpCheck =
wishvel = v_forward * input_movevalues.x; \
wishvel += v_right * input_movevalues.y; \
wishvel += v_up * input_movevalues.z; \
- PM_MOVE_MOVETYPES_NOCLIPACCELERATE (input_timelength) \
+ PM_MOVE_MOVETYPES_NOCLIPACCELERATE (itl) \
/* we're noclipping so update origin directly -- CEV */ \
- self.origin += self.velocity * input_timelength; \
+ self.origin += self.velocity * itl; \
+ } \
+ else if (self.movetype == MOVETYPE_TOSS || \
+ self.movetype == MOVETYPE_BOUNCE) \
+ { \
+ /* we should only get here when dead -- CEV */ \
+ if (self.health <= 0) \
+ { \
+ input_movevalues = '0 0 0'; \
+ } \
+ /* let the engine handle BOUNCE and TOSS -- CEV */ \
+ runstandardplayerphysics (self); \
+ /* might as well copy ONGROUND state to pm_flags -- CEV */ \
+ if (self.flags & FL_ONGROUND) \
+ { \
+ if (!(self.pm_flags & PMF_ONGROUND)) \
+ { \
+ self.pm_flags |= PMF_ONGROUND; \
+ } \
+ } \
} \
else \
{ \
/* the following vars will be used in macros below */ \
- local vector vec1, vec2; \
- local float accel, friction, half_time, wishnew; \
- vec1 = vec2 = '0 0 0'; \
- accel = friction = wishnew = 0; \
- half_time = input_timelength * 0.5f; \
if (self.movetype == MOVETYPE_WALK) \
{ \
/* work out the properties of the player's position */ \
@@ -1926,6 +2147,8 @@ void() PM_WallJumpCheck =
/* intended movement for walking/air accel */ \
/* only yaw matters here -- CEV */ \
makevectors (input_angles.y * '0 1 0'); \
+ v_forward.z = 0; \
+ v_right.z = 0; \
wishvel = v_forward * input_movevalues.x + \
v_right * input_movevalues.y; \
wishvel.z = 0; \
@@ -1933,7 +2156,12 @@ void() PM_WallJumpCheck =
wishspeed = vlen (wishvel); \
/* walking & air acceleration -- CEV */ \
PM_MOVE_MOVETYPES_WALKPREMOVE () \
- PM_MOVE_MOVETYPES_WALKACCELERATE (half_time) \
+ /* don't factor in Z velocity when running
+ * ground/air accel functions -- CEV */ \
+ local float zsave = self.velocity.z; \
+ self.velocity.z = 0; \
+ PM_MOVE_MOVETYPES_WALKACCELERATE (itl) \
+ self.velocity.z = zsave; \
} \
else \
{ \
@@ -1945,12 +2173,11 @@ void() PM_WallJumpCheck =
wishdir = normalize (wishvel); \
wishspeed = vlen (wishvel); \
/* swim acceleration -- CEV */ \
- PM_MOVE_MOVETYPES_SWIMPREMOVE (vec1, vec2, \
- half_time) \
- PM_MOVE_MOVETYPES_SWIMACCELERATE (half_time) \
+ PM_MOVE_MOVETYPES_SWIMPREMOVE (vec1, vec2, itl) \
+ PM_MOVE_MOVETYPES_SWIMACCELERATE (itl) \
} \
/* handle countdown timers -- CEV */ \
- PM_MOVE_MOVETYPES_MANAGETIMER (half_time) \
+ PM_MOVE_MOVETYPES_MANAGETIMER (itl) \
} \
else if (self.movetype == MOVETYPE_FLY) \
{ \
@@ -1959,7 +2186,7 @@ void() PM_WallJumpCheck =
wishvel = v_forward * input_movevalues.x; \
wishvel += v_right * input_movevalues.y; \
wishvel += v_up * input_movevalues.z; \
- PM_MOVE_MOVETYPES_NOCLIPACCELERATE (half_time) \
+ PM_MOVE_MOVETYPES_NOCLIPACCELERATE (itl) \
} \
/* step if nostep is false and we're not on a ladder... */ \
if (world_nostep == FALSE) { \
@@ -1978,30 +2205,13 @@ void() PM_WallJumpCheck =
} \
/* Do the move. Bounce, Rock, Skate, Roll -- CEV */ \
PM_DANCEMOVE (vec1, vec2, accel, friction, temp) \
- /* now the back half of player acceleration -- CEV */ \
- if (self.movetype == MOVETYPE_WALK) \
- { \
- if (self.conlevel < WATERLEVEL_WAIST) \
- { \
- PM_MOVE_MOVETYPES_WALKACCELERATE (half_time) \
- } \
- else \
- { \
- PM_MOVE_MOVETYPES_SWIMACCELERATE (half_time) \
- } \
- PM_MOVE_MOVETYPES_MANAGETIMER (half_time) \
- } \
- else if (self.movetype == MOVETYPE_FLY) \
- { \
- PM_MOVE_MOVETYPES_NOCLIPACCELERATE (half_time) \
- } \
/* clear ladder flag -- CEV */ \
if (self.pm_flags & PMF_ONLADDER) \
self.pm_flags &= ~PMF_ONLADDER; \
- touchtriggers (); \
+ touchtriggers (self); \
base_entity_positioncontents (self); \
} \
-}
+/* } */
//----------------------------------------------------------------------
// PM_MOVE_POST -- handle any after-move operations -- CEV
@@ -2011,15 +2221,22 @@ void() PM_WallJumpCheck =
// Then udpate speed, origin, and oldorigin -- CEV
//----------------------------------------------------------------------
#define PM_MOVE_POST() \
-{ \
+/* { */ \
+ /* in case engine code has found ground -- CEV */ \
+ if (self.pm_flags & PMF_ONGROUND) \
+ { \
+ if (!(self.flags & FL_ONGROUND)) \
+ { \
+ self.flags |= FL_ONGROUND; \
+ } \
+ } \
if (self.velocity != '0 0 0') \
{ \
PM_CHECKVELOCITY (self.velocity) \
PM_TRUNCATEVECTORTOEIGTH (self.velocity) \
} \
self.speed = vlen ([self.velocity.x, self.velocity.y, 0]); \
- setorigin (self, self.origin); \
- self.oldorigin = self.origin; \
-}
-
+ /* setorigin (self, self.origin); \
+ self.oldorigin = self.origin; */ \
+/* } */
#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/projectiles/beam2.qc
diff --git a/qc/projectiles/beam2.qc b/qc/projectiles/beam2.qc
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/qc/projectiles/beam2.qc
Return to the top of this page or return to the overview of this repo.
Diff qc/projectiles/bolt.qc
diff --git a/qc/projectiles/bolt.qc b/qc/projectiles/bolt.qc
index 5ba204b..d64ce3b 100644
--- a/qc/projectiles/bolt.qc
+++ b/qc/projectiles/bolt.qc
@@ -5,6 +5,7 @@
//======================================================================
// constants
//======================================================================
+
const float BOLT_SPEED = 1200; // 1600ups in QC
const float BOLT_DIRECT_DAMAGE = 35; // 35 in QC
const float BOLT_SPLASH_DAMAGE = 35; // 35 damage per bolt in QC
@@ -46,7 +47,7 @@ strip void() projectile_bolt;
// BecomeExplosion
pointparticles (particleeffectnum("te_explosion2_230_5"),
self.origin);
- sound (self, CHAN_WEAPON, "cev/tribolt/boltexpl.ogg",
+ sound (self, CHAN_WEAPON, "cev/weapons/boltexpl.ogg",
1.0, ATTN_NORM);
become_base_explosion (self);
};
@@ -109,10 +110,6 @@ strip void() projectile_bolt;
// damage
e.direct_damage = BOLT_DIRECT_DAMAGE;
e.splash_damage = BOLT_SPLASH_DAMAGE;
- // model, skin, & sounds
- e.mdl_proj = src.mdl_proj;
- e.skin_proj = src.skin_proj;
- e.snd_hit = src.snd_hit;
if (d)
{
@@ -217,5 +214,3 @@ strip void() projectile_bolt;
projectile_bolt_init (self);
};
// };
-
-
Return to the top of this page or return to the overview of this repo.
Diff qc/projectiles/bullet.qc
diff --git a/qc/projectiles/bullet.qc b/qc/projectiles/bullet.qc
index a6c8df4..1b4e40a 100644
--- a/qc/projectiles/bullet.qc
+++ b/qc/projectiles/bullet.qc
@@ -124,25 +124,14 @@ strip void() projectile_bullet;
if (!e.direct_damage)
e.direct_damage = BULLET_DIRECT_DAMAGE;
- // dumptruck_ds
- if (e.mdl_proj && e.mdl_proj != "")
- {
- setmodel (e, e.mdl_proj);
- }
- else
- {
- // AD projectile diamond model
- setmodel (e, "progs/ad/proj_diam2.mdl");
+ // AD projectile diamond model
+ setmodel (e, "progs/ad/proj_diam2.mdl");
- // full range of sizes -- Sock (comment from AD)
- e.frame = random () * 15;
-
- // Bright colours -- Sock (comment from AD)
- e.skin = 16 + random () * 7;
- }
+ // full range of sizes -- Sock (comment from AD)
+ e.frame = random () * 15;
- if (e.skin_proj)
- e.skin = e.skin_proj;
+ // Bright colours -- Sock (comment from AD)
+ e.skin = 16 + random () * 7;
setsize (e, BULLET_MINS, BULLET_MAXS);
setorigin (e, e.origin);
Return to the top of this page or return to the overview of this repo.
Diff qc/projectiles/fireball.qc
diff --git a/qc/projectiles/fireball.qc b/qc/projectiles/fireball.qc
index 14062f9..1c76cef 100644
--- a/qc/projectiles/fireball.qc
+++ b/qc/projectiles/fireball.qc
@@ -62,14 +62,7 @@ strip void() projectile_fireball;
if (!e.direct_damage)
e.direct_damage = FIREBALL_DIRECT_DAMAGE;
- // dumptruck_ds
- if (e.mdl_proj && e.mdl_proj != "")
- setmodel (e, e.mdl_proj);
- else
- setmodel (e, "progs/lavaball.mdl");
-
- if (e.skin_proj)
- e.skin = e.skin_proj;
+ setmodel (e, "progs/lavaball.mdl");
setsize (e, '0 0 0', '0 0 0');
setorigin (e, e.origin);
Return to the top of this page or return to the overview of this repo.
Diff qc/projectiles/flak.qc
diff --git a/qc/projectiles/flak.qc b/qc/projectiles/flak.qc
index 4ee1b75..051754f 100644
--- a/qc/projectiles/flak.qc
+++ b/qc/projectiles/flak.qc
@@ -7,6 +7,7 @@
//======================================================================
// constants
//======================================================================
+
const float FLAK_DIRECT_DAMAGE = 8; // default direct damage; was 4
// flak doesn't splash
const float FLAK_SPEED = 800; // speed of BDW's OgreFireFlak
@@ -133,10 +134,6 @@ strip void() projectile_flak;
e.homing = src.homing;
e.proj_speed_mod = src.proj_speed_mod;
e.waitmin = src.waitmin;
- // model, skin, & sounds
- e.mdl_proj = src.mdl_proj;
- e.skin_proj = src.skin_proj;
- e.snd_hit = src.snd_hit;
// hack to tell FlakTouch this was spawned by an ogre
if (src.classtype == CT_MONSTER_OGRE)
e.spawnflags |= MONSTER_FLAK_OGRE;
@@ -165,17 +162,8 @@ strip void() projectile_flak;
if (!e.direct_damage)
e.direct_damage = FLAK_DIRECT_DAMAGE;
- // dumptruck_ds
- if (e.mdl_proj && e.mdl_proj != "")
- setmodel (e, e.mdl_proj);
- else
- setmodel (e, "progs/spike.mdl");
-
- // if (e.skin_proj)
- // e.skin = e.skin_proj;
- // else
- e.skin = 0;
- // dumptruck_ds - end
+ setmodel (e, "progs/spike.mdl");
+ e.skin = 0;
if (e.homing > 0)
{
Return to the top of this page or return to the overview of this repo.
Diff qc/projectiles/grenade.qc
diff --git a/qc/projectiles/grenade.qc b/qc/projectiles/grenade.qc
index dd6ec94..2e78129 100644
--- a/qc/projectiles/grenade.qc
+++ b/qc/projectiles/grenade.qc
@@ -5,6 +5,7 @@
//======================================================================
// constants
//======================================================================
+
const float GRENADE_DIRECT_DAMAGE = 100;// direct damage; 100 is id1
const float GRENADE_SPLASH_DAMAGE = 120;// splash damage; 120 is id1
const float GRENADE_SPEED = 600; // id1 grenade speed is 600
@@ -138,10 +139,6 @@ strip void() projectile_grenade;
// damage
e.direct_damage = GRENADE_DIRECT_DAMAGE;
e.splash_damage = GRENADE_SPLASH_DAMAGE;
- // model, skin, & sounds
- e.mdl_proj = src.mdl_proj;
- e.skin_proj = src.skin_proj;
- e.snd_hit = src.snd_hit;
projectile_grenade_init (e);
return e;
@@ -176,15 +173,8 @@ strip void() projectile_grenade;
if (!e.splash_damage)
e.splash_damage = GRENADE_SPLASH_DAMAGE;
- if (e.mdl_proj && e.mdl_proj != "")
- setmodel (e, e.mdl_proj);
- else
- setmodel (e, "progs/grenade.mdl");
-
- if (e.skin_proj)
- e.skin = e.skin_proj;
- else
- e.skin = 0;
+ setmodel (e, "progs/grenade.mdl");
+ e.skin = 0;
// setsize (e, GRENADE_MINS, GRENADE_MAXS);
setsize (e, '0 0 0', '0 0 0');
Return to the top of this page or return to the overview of this repo.
Diff qc/projectiles/hknightspell.qc
diff --git a/qc/projectiles/hknightspell.qc b/qc/projectiles/hknightspell.qc
index 40ce41a..3adfcf4 100644
--- a/qc/projectiles/hknightspell.qc
+++ b/qc/projectiles/hknightspell.qc
@@ -5,6 +5,7 @@
//======================================================================
// constants
//======================================================================
+
const float HKNSPELL_DIRECT_DAMAGE = 9; // direct damage; 9 is id1
const float HKNSPELL_SPLASH_DAMAGE = 50;// splash damage; 50 is pd3
const float HKNSPELL_EXPLOD_DAMAGE = 20;// explosive direct damage; 20 is pd3
@@ -42,10 +43,6 @@ strip void() projectile_hknightspell;
e.homing = src.homing;
e.proj_speed_mod = src.proj_speed_mod;
e.waitmin = src.waitmin;
- // model, skin, & sounds
- e.mdl_proj = src.mdl_proj;
- e.skin_proj = src.skin_proj;
- e.snd_hit = src.snd_hit;
// unique to this magic missile
e.distance = offset;
@@ -84,19 +81,12 @@ strip void() projectile_hknightspell;
e.splash_damage = 0;
// dumptruck_ds custom_mdls
- if (e.mdl_proj != "")
- setmodel (e, e.mdl_proj);
+ if (e.aflag & PROJECTILE_EXPLOSIVE)
+ setmodel (e, "progs/k_spike2.mdl");
else
- if (e.aflag & PROJECTILE_EXPLOSIVE)
- setmodel (e, "progs/k_spike2.mdl");
- else
- setmodel (e, "progs/k_spike.mdl");
+ setmodel (e, "progs/k_spike.mdl");
- // dumptruck_ds
- if (e.skin_proj)
- e.skin = e.skin_proj;
- else
- e.skin = 0;
+ e.skin = 0;
if (e.homing > 0)
{
Return to the top of this page or return to the overview of this repo.
Diff qc/projectiles/laser.qc
diff --git a/qc/projectiles/laser.qc b/qc/projectiles/laser.qc
index d2a0851..f068eac 100644
--- a/qc/projectiles/laser.qc
+++ b/qc/projectiles/laser.qc
@@ -5,6 +5,7 @@
//======================================================================
// constants
//======================================================================
+
const float LASER_DIRECT_DAMAGE = 15; // direct damage; 15 is id1
// lasers don't splash
const float LASER_SPEED = 600; // id1 laser speed is 600
@@ -31,7 +32,7 @@ strip void() projectile_laser;
void() projectile_laser_touch =
{
// dumptruck_ds
- sound_hit (self, CHAN_WEAPON, "enforcer/enfstop.wav",
+ sound (self, CHAN_WEAPON, "enforcer/enfstop.wav",
VOL_HIGH, ATTN_STATIC);
local vector org = self.origin - 8 * normalize (self.velocity);
@@ -66,10 +67,6 @@ strip void() projectile_laser;
e.homing = src.homing;
e.proj_speed_mod = src.proj_speed_mod;
e.waitmin = src.waitmin;
- // model, skin, & sounds
- e.mdl_proj = src.mdl_proj;
- e.skin_proj = src.skin_proj;
- e.snd_hit = src.snd_hit;
projectile_laser_init (e);
return e;
@@ -94,17 +91,8 @@ strip void() projectile_laser;
if (!e.direct_damage)
e.direct_damage = LASER_DIRECT_DAMAGE;
- // dumptruck_ds
- if (e.mdl_proj != "")
- setmodel (e, e.mdl_proj);
- else
- setmodel (e, "progs/laser.mdl");
-
- // dumptruck_ds
- if (e.skin_proj)
- e.skin = e.skin_proj;
- else
- e.skin = 0;
+ setmodel (e, "progs/laser.mdl");
+ e.skin = 0;
if (e.homing > 0)
{
Return to the top of this page or return to the overview of this repo.
Diff qc/projectiles/lavaball.qc
diff --git a/qc/projectiles/lavaball.qc b/qc/projectiles/lavaball.qc
index a9aa22c..56ad607 100644
--- a/qc/projectiles/lavaball.qc
+++ b/qc/projectiles/lavaball.qc
@@ -5,6 +5,7 @@
//======================================================================
// constants
//======================================================================
+
const float LAVABALL_DIRECT_DAMAGE = 100;// direct damage; 100 is id1
const float LAVABALL_SPLASH_DAMAGE = 120;// splash damage; 120 is id1
const float LAVABALL_SPEED = 300; // id1 Chthon fires at 300ups
@@ -57,10 +58,6 @@ strip void() projectile_lavaball;
e.homing = src.homing;
e.proj_speed_mod = src.proj_speed_mod;
e.waitmin = src.waitmin;
- // model, skin, & sounds
- e.mdl_proj = src.mdl_proj;
- e.skin_proj = src.skin_proj;
- e.snd_hit = src.snd_hit;
projectile_lavaball_init (e);
return e;
@@ -95,17 +92,8 @@ strip void() projectile_lavaball;
if (!e.splash_damage)
e.splash_damage = LAVABALL_SPLASH_DAMAGE;
- // dumptruck_ds custom_mdls
- if (e.mdl_proj != "")
- setmodel (e, e.mdl_proj);
- else
- setmodel (e, "progs/lavaball.mdl");
-
- // dumptruck_ds
- if (e.skin_proj)
- e.skin = e.skin_proj;
- else
- e.skin = 0;
+ setmodel (e, "progs/lavaball.mdl");
+ e.skin = 0;
if (e.homing > 0)
{
Return to the top of this page or return to the overview of this repo.
Diff qc/projectiles/multigrenade.qc
diff --git a/qc/projectiles/multigrenade.qc b/qc/projectiles/multigrenade.qc
index 05982cd..3fbbd9f 100644
--- a/qc/projectiles/multigrenade.qc
+++ b/qc/projectiles/multigrenade.qc
@@ -5,6 +5,7 @@
//======================================================================
// constants
//======================================================================
+
const float MININADE_SPLASH_DAMAGE = 35;// PD3 is 90 for player, 60 other
const float MULTINADE_SPLASH_DAMAGE = 35;// 35 is the tribolt from QC
const float MULTINADE_HEALTH = 50; //
@@ -103,10 +104,6 @@ strip void() projectile_multigrenade;
e.velocity = vel;
// damage
e.splash_damage = MININADE_SPLASH_DAMAGE;
- // model, skin, & sounds
- e.mdl_proj = src.mdl_proj;
- e.skin_proj = src.skin_proj;
- e.snd_hit = src.snd_hit;
projectile_minigrenade_init (e);
return e;
@@ -242,10 +239,6 @@ strip void() projectile_multigrenade;
e.velocity = vel;
// damage
e.splash_damage = MULTINADE_SPLASH_DAMAGE;
- // model, skin, & sounds
- e.mdl_proj = src.mdl_proj;
- e.skin_proj = src.skin_proj;
- e.snd_hit = src.snd_hit;
projectile_multigrenade_init (e);
return e;
@@ -278,15 +271,8 @@ strip void() projectile_multigrenade;
if (!e.splash_damage)
e.splash_damage = MULTINADE_SPLASH_DAMAGE;
- if (e.mdl_proj && e.mdl_proj != "")
- setmodel (e, e.mdl_proj);
- else
- setmodel (e, "progs/mervup.mdl");
-
- if (e.skin_proj)
- e.skin = e.skin_proj;
- else
- e.skin = 0;
+ setmodel (e, "progs/mervup.mdl");
+ e.skin = 0;
// setsize (e, MULTINADE_MINS, MULTINADE_MAXS);
setsize (e, '0 0 0', '0 0 0');
Return to the top of this page or return to the overview of this repo.
Diff qc/projectiles/rocket.qc
diff --git a/qc/projectiles/rocket.qc b/qc/projectiles/rocket.qc
index c550300..561e999 100644
--- a/qc/projectiles/rocket.qc
+++ b/qc/projectiles/rocket.qc
@@ -5,6 +5,7 @@
//======================================================================
// constants
//======================================================================
+
const float ROCKET_DIRECT_DAMAGE = 100; // direct damage; 100 is id1
const float ROCKET_SPLASH_DAMAGE = 120; // splash damage; 120 is id1
const float ROCKET_SPEED = 1000; // id1 1000ups
@@ -59,10 +60,6 @@ strip void() projectile_rocket;
// speed
e.proj_basespeed = projspeed;
e.proj_speed_mod = src.proj_speed_mod;
- // model, skin, & sounds
- e.mdl_proj = src.mdl_proj;
- e.skin_proj = src.skin_proj;
- e.snd_hit = src.snd_hit;
projectile_rocket_init (e);
return e;
@@ -92,17 +89,8 @@ strip void() projectile_rocket;
if (!e.splash_damage)
e.splash_damage = ROCKET_SPLASH_DAMAGE;
- // dumptruck_ds custom_mdls
- if (e.mdl_proj != "")
- setmodel (e, e.mdl_proj);
- else
- setmodel (e, "progs/missile.mdl");
-
- // dumptruck_ds
- if (e.skin_proj)
- e.skin = e.skin_proj;
- else
- e.skin = 0;
+ setmodel (e, "progs/missile.mdl");
+ e.skin = 0;
// homing & missile duration
if (e.homing > 0)
Return to the top of this page or return to the overview of this repo.
Diff qc/projectiles/spike.qc
diff --git a/qc/projectiles/spike.qc b/qc/projectiles/spike.qc
index 93edc09..f491645 100644
--- a/qc/projectiles/spike.qc
+++ b/qc/projectiles/spike.qc
@@ -5,6 +5,7 @@
//======================================================================
// constants
//======================================================================
+
const float SPIKE_NORMAL_DAMAGE = 9; // direct damage; 9 is id1
const float SPIKE_SUPER_DAMAGE = 18; // superspike direct damage; 18 is id1
const float SPIKE_DUPER_DAMAGE = 36; // superduperspike direct; 36 is pd3
@@ -45,10 +46,6 @@ strip void() projectile_spike;
e.homing = src.homing;
e.proj_basespeed = projspeed;
e.proj_speed_mod = src.proj_speed_mod;
- // model, skin, & sounds
- e.mdl_proj = src.mdl_proj;
- e.skin_proj = src.skin_proj;
- e.snd_hit = src.snd_hit;
projectile_spike_init (e);
return e;
@@ -83,26 +80,18 @@ strip void() projectile_spike;
else
e.splash_damage = 0;
- // dumptruck_ds custom_mdls
- if (e.mdl_proj != "")
- setmodel (e, e.mdl_proj);
+ // this is kinda wonky -- CEV
+ if (e.direct_damage == SPIKE_SUPER_DAMAGE)
+ // supernail
+ setmodel (e, "progs/s_spike.mdl");
+ else if (e.direct_damage == SPIKE_DUPER_DAMAGE)
+ // superdupernail
+ setmodel (e, "progs/lspike.mdl");
else
- // e is kinda wonky -- CEV
- if (e.direct_damage == SPIKE_SUPER_DAMAGE)
- // supernail
- setmodel (e, "progs/s_spike.mdl");
- else if (e.direct_damage == SPIKE_DUPER_DAMAGE)
- // superdupernail
- setmodel (e, "progs/lspike.mdl");
- else
- // regular nail
- setmodel (e, "progs/spike.mdl");
+ // regular nail
+ setmodel (e, "progs/spike.mdl");
- // dumptruck_ds
- if (e.skin_proj)
- e.skin = e.skin_proj;
- else
- e.skin = 0;
+ e.skin = 0;
if (e.homing > 0)
{
Return to the top of this page or return to the overview of this repo.
Diff qc/projectiles/voreball.qc
diff --git a/qc/projectiles/voreball.qc b/qc/projectiles/voreball.qc
index ad9ea2a..0fc6378 100644
--- a/qc/projectiles/voreball.qc
+++ b/qc/projectiles/voreball.qc
@@ -5,6 +5,7 @@
//======================================================================
// constants
//======================================================================
+
const float VOREBALL_DIRECT_DAMAGE = 110;// only for zombies -- CEV
const float VOREBALL_SPLASH_DAMAGE = 40;// splash damage; 120 is id1
const float VOREBALL_SPEED = 400; // id1 400ups
@@ -81,10 +82,6 @@ strip void() projectile_voreball;
e.homing = src.homing;
e.proj_basespeed = basespeed;
e.proj_speed_mod = src.proj_speed_mod;
- // model, skin, & sounds
- e.mdl_proj = src.mdl_proj;
- e.skin_proj = src.skin_proj;
- e.snd_hit = src.snd_hit;
projectile_voreball_init (e);
return e;
@@ -119,17 +116,8 @@ strip void() projectile_voreball;
if (!e.splash_damage)
e.splash_damage = VOREBALL_SPLASH_DAMAGE;
- // dumptruck_ds custom_mdls
- if (e.mdl_proj != "")
- setmodel (e, e.mdl_proj);
- else
- setmodel (e, "progs/v_spike.mdl");
-
- // dumptruck_ds
- if (e.skin_proj)
- e.skin = e.skin_proj;
- else
- e.skin = 0;
+ setmodel (e, "progs/v_spike.mdl");
+ e.skin = 0;
if (e.homing > 0)
{
Return to the top of this page or return to the overview of this repo.
Diff qc/projectiles/wizardspell.qc
diff --git a/qc/projectiles/wizardspell.qc b/qc/projectiles/wizardspell.qc
index 1709a43..051f995 100644
--- a/qc/projectiles/wizardspell.qc
+++ b/qc/projectiles/wizardspell.qc
@@ -57,18 +57,7 @@ strip void() projectile_wizardspell;
else
{
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
- if (self.owner.snd_hit != __NULL__ &&
- self.owner.snd_hit != "")
- {
- // dumptruck_ds
- sound (self, CHAN_WEAPON, self.owner.snd_hit,
- VOL_HIGH, ATTN_STATIC);
- WriteByte (MSG_BROADCAST, TE_WIZSPIKE);
- }
- else
- {
- WriteByte (MSG_BROADCAST, TE_WIZSPIKE);
- }
+ WriteByte (MSG_BROADCAST, TE_WIZSPIKE);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);
@@ -93,10 +82,6 @@ strip void() projectile_wizardspell;
// damage
// e.direct_damage = direct;
// e.splash_damage = splash;
- // model, skin, & sounds
- e.mdl_proj = src.mdl_proj;
- e.skin_proj = src.skin_proj;
- e.snd_hit = src.snd_hit;
projectile_wizardmissile_init (e);
return e;
@@ -130,17 +115,8 @@ strip void() projectile_wizardspell;
else
e.splash_damage = WIZMIS_SPLASH_DAMAGE;
- // dumptruck_ds custom_mdls
- if (e.mdl_proj != "")
- setmodel (e, e.mdl_proj);
- else
- setmodel (e, "progs/w_spike.mdl");
-
- // dumptruck_ds
- if (e.skin_proj)
- e.skin = e.skin_proj;
- else
- e.skin = 0;
+ setmodel (e, "progs/w_spike.mdl");
+ e.skin = 0;
if (e.homing > 0 || e.owner.homing > 0)
{
Return to the top of this page or return to the overview of this repo.
Diff qc/projectiles/zombiechunk.qc
diff --git a/qc/projectiles/zombiechunk.qc b/qc/projectiles/zombiechunk.qc
index 24ed85f..221261b 100644
--- a/qc/projectiles/zombiechunk.qc
+++ b/qc/projectiles/zombiechunk.qc
@@ -65,10 +65,6 @@ strip void() projectile_zombiechunk;
e.avelocity = src.cust_avelocity;
// damage
e.direct_damage = ZCHUNK_DIRECT_DAMAGE;
- // model, skin, & sounds
- e.mdl_proj = src.mdl_proj;
- e.skin_proj = src.skin_proj;
- e.snd_hit = src.snd_hit;
projectile_zombiechunk_init (e);
return e;
@@ -95,17 +91,8 @@ strip void() projectile_zombiechunk;
if (!e.direct_damage)
e.direct_damage = ZCHUNK_DIRECT_DAMAGE;
- // dumptruck_ds custom_mdls
- if (e.mdl_proj != "")
- setmodel (e, e.mdl_proj);
- else
- setmodel (e, "progs/zom_gib.mdl");
-
- // dumptruck_ds
- if (e.skin_proj)
- e.skin = e.skin_proj;
- else
- e.skin = 0;
+ setmodel (e, "progs/zom_gib.mdl");
+ e.skin = 0;
setsize (e, ZCHUNK_MINS, ZCHUNK_MAXS);
setorigin (e, e.origin);
Return to the top of this page or return to the overview of this repo.
Diff qc/sv_entry.qc
diff --git a/qc/sv_entry.qc b/qc/sv_entry.qc
index d8bb186..1a2444f 100644
--- a/qc/sv_entry.qc
+++ b/qc/sv_entry.qc
@@ -19,10 +19,8 @@ float framecount;
nosave float clean_up_client_stuff;
nosave float gamestarted;
-// Reports which ssqc entnum was hit when a csqc traceline impacts an
-// ssqc-based brush entity.
-// Only active in CSQC but needed here to compile pmove. -- CEV
-nosave float trace_networkentity;
+float server_deltatime; // MG1 frametick system -- CEV
+float server_lasttime; // MG1 frametick system -- CEV
#endif
//======================================================================
@@ -275,7 +273,7 @@ void() Episode4End =
//----------------------------------------------------------------------
float() RunId1Intermissions =
{
- if (world.skip_id1_overrides == 0)
+ if (!(world.aflag & WORLD_FLAG_SKIP_ID1_OVERRIDES))
{
if (world.model == "maps/e1m7.bsp")
{
@@ -386,6 +384,9 @@ void() ExitIntermission =
intermission_exittime = time + 1;
intermission = intermission + 1;
+ // let clients know the intermission flag has changed -- CEV
+ WriteIntermission ();
+
// run some text if at the end of an episode
if (intermission == 2)
{
@@ -475,7 +476,7 @@ void() WriteIntermission =
{
WriteByte (MSG_MULTICAST, SVC_CGAMEPACKET);
WriteByte (MSG_MULTICAST, EVENT_INTERMISSION);
- WriteFloat (MSG_MULTICAST, intermission);
+ WriteByte (MSG_MULTICAST, intermission);
multicast ('0 0 0', MULTICAST_ALL);
};
@@ -488,12 +489,15 @@ void() RestartLoopSounds_think =
//----------------------------------------------------------------------
void() RestartLoopSounds =
{
- entity e;
+ local entity e;
e = findfloat (world, classtype, CT_MISC_PLAY_SOUND_TRIGGERED);
- while (e) {
- if (e.spawnflags & 3 == 3) {
+ while (e)
+ {
+ if (e.spawnflags & 3 == 3)
+ {
// both "toggle" and "looped" need to be set
- if (e.state == 1) {
+ if (e.state == 1)
+ {
e.nextthink = time + 0.1;
e.think = RestartLoopSounds_think;
}
@@ -744,17 +748,35 @@ void() SetNewParms =
parm9 = 0; // self.armortype * 100
// "reset_items 2" makes the player start with only the axe -- iw
- if (world.reset_items == 2)
+ if (world.aflag & WORLD_FLAG_RESET_ITEMS_AXE_ONLY)
{
- parm1 = IT_AXE; // self.items
+ parm1 = 0; // self.items
parm4 = 0; // self.ammo_shells
- parm8 = IT_AXE; // self.weapon
+ parm8 = 1; // self.weapon
+
+ parm11 = ITEM_SEQ_AXE; // self.inventory1
+ parm12 = 0; // self.inventory2
+ parm13 = 0; // self.inventory3
+ parm14 = 0; // self.inventory4
+ parm15 = 0; // self.inventory5
+ parm16 = 0; // self.inventory6
+ parm17 = 0; // self.inventory7
+ parm18 = 0; // self.inventory8
}
else
{
- parm1 = IT_AXE | IT_SHOTGUN; // self.items
+ parm1 = 0; // self.items
parm4 = 25; // self.ammo_shells
- parm8 = IT_SHOTGUN; // self.weapon
+ parm8 = 2; // self.weapon
+
+ parm11 = ITEM_SEQ_AXE; // self.inventory1
+ parm12 = ITEM_SEQ_SHOTGUN; // self.inventory2
+ parm13 = 0; // self.inventory3
+ parm14 = 0; // self.inventory4
+ parm15 = 0; // self.inventory5
+ parm16 = 0; // self.inventory6
+ parm17 = 0; // self.inventory7
+ parm18 = 0; // self.inventory8
}
};
@@ -768,10 +790,8 @@ void() SetChangeParms =
}
// remove items
- self.items = self.items - (self.items &
- (IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY
- | IT_SUIT | IT_QUAD)
- );
+ self.items &= ~(IT_KEY1 | IT_KEY2 | IT_SUIT | IT_QUAD |
+ IT_INVISIBILITY | IT_INVULNERABILITY);
// cap super health
if (self.health > 100)
@@ -790,6 +810,16 @@ void() SetChangeParms =
parm7 = self.ammo_cells;
parm8 = self.weapon;
parm9 = self.armortype * 100;
+
+ // player inventory -- CEV
+ parm11 = self.inventory1;
+ parm12 = self.inventory2;
+ parm13 = self.inventory3;
+ parm14 = self.inventory4;
+ parm15 = self.inventory5;
+ parm16 = self.inventory6;
+ parm17 = self.inventory7;
+ parm18 = self.inventory8;
};
//----------------------------------------------------------------------
@@ -800,8 +830,8 @@ void() SetChangeParms =
//----------------------------------------------------------------------
void() PutClientInServer =
{
- if (self.classname == "player")
- dprint ("PutClientInServer: classname already player!\n");
+ if (self.classname != "player")
+ dprint ("PutClientInServer: classname is not player!\n");
};
//----------------------------------------------------------------------
@@ -829,14 +859,18 @@ void() PlayerPreThink =
// call prethink on the player after double checking classtype -- CEV
if (self.classtype == CT_PLAYER)
- player_prethink ();
+ {
+ PLAYER_PRETHINK ()
+ }
else
+ {
dprint (sprintf("PlayerPreThink: called for a %s!\n",
self.classname));
+ }
};
//----------------------------------------------------------------------
-// SV_RunClientCommand -- Called every frame to run physics
+// SV_RunClientCommand -- Called every frame for players to run physics
//----------------------------------------------------------------------
void() SV_RunClientCommand =
{
@@ -844,6 +878,8 @@ void() SV_RunClientCommand =
PM_MOVE_PRE ()
PM_MOVE_MOVETYPES ()
PM_MOVE_POST ()
+ setorigin (self, self.origin);
+ self.oldorigin = self.origin;
};
//----------------------------------------------------------------------
@@ -857,25 +893,27 @@ void() PlayerPostThink =
// call postthink on the player after double checking classtype -- CEV
if (self.classtype == CT_PLAYER)
player_postthink ();
+
+ if (isbackbuffered(self))
+ dprint ("\nPlayerPostThink: player is backbuffered!\n");
};
//----------------------------------------------------------------------
void() StartFrame =
{
// new spawnflags for all entities -- iw
- if (!done_inhibition_summary)
- PrintInhibitionSummary ();
+ if (done_inhibition_summary == FALSE)
+ if (framecount == 20)
+ PrintInhibitionSummary ();
- // per-frame latched variables -- CEV
- teamplay = cvar ("teamplay");
- skill = cvar ("skill");
+ framecount++;
if (clean_up_client_stuff)
{
clean_up_client_stuff -= 1;
RestartLoopSounds ();
}
- else if (!gamestarted)
+ else if (gamestarted == FALSE)
{
if (framecount > 2)
{
@@ -886,25 +924,24 @@ void() StartFrame =
}
}
- /*
- // aid clientside prediction by updating any networked SOLID_BSP
- // MOVETYPE_PUSH entities that are in motion. I hate looping
- // through all entities like this. -- CEV
+ // inspired by the MG1 frametick system -- CEV
+ local entity oself = self;
local entity e = world;
- while ((e = nextent(e)))
+
+ // changed deltatime to a global -- CEV
+ server_deltatime = time - server_lasttime;
+ server_lasttime = time;
+
+ // findfloat / findflags is more reliable here -- CEV
+ while ((e = findflags(e, classgroup, CG_FRAMETICK)))
{
- // only SOLID PUSH entities
- if (e.solid == SOLID_BSP && e.movetype == MOVETYPE_PUSH)
- // only CG_FUNC entities
- if (e.classgroup & CG_FUNC)
- // only ents in motion with a SendEntity func
- if (e.velocity && e.SendEntity)
- // transmit origin and velocity
- e.SendFlags |= BASE_FUNC_NET_ORIGIN |
- BASE_FUNC_NET_VELOCITY |
- BASE_FUNC_NET_SPEED;
+ if (e.tick)
+ {
+ self = e;
+ self.tick ();
+ }
}
- */
+ self = oself;
};
//----------------------------------------------------------------------
@@ -923,14 +960,14 @@ void(void() spawnfunc) CheckSpawn =
{
if (spawnfunc)
{
- // dprint (sprintf("CheckSpawn: creating %s\n",
- // self.classname));
+ dprint (sprintf("CheckSpawn: creating %s; fullspawndata %s\n",
+ self.classname, __fullspawndata));
spawnfunc ();
}
else
{
- // print (sprintf("CheckSpawn: cannot find entity class %s\n",
- // self.classname));
+ print (sprintf("CheckSpawn: cannot find entity class %s\n",
+ self.classname));
remove (self);
}
};
Return to the top of this page or return to the overview of this repo.
Diff qc/sv_progs.src
diff --git a/qc/sv_progs.src b/qc/sv_progs.src
index 90ae81c..2089bff 100644
--- a/qc/sv_progs.src
+++ b/qc/sv_progs.src
@@ -15,6 +15,7 @@ defs_fields.qc // id1 entvars_t
defs_builtins.qc // id1 / FTE builtin functions (& overrides)
defs_const.qc // id1 & pd3 common constants
defs_ctypes.qc // global class list
+defs_items.qc // global item definitions
//----------------------------------------------------------------------
// utility & helper functions
@@ -22,15 +23,12 @@ defs_ctypes.qc // global class list
math.qc // Code by Joshua Skelton + misc
newflags.qc // new spawnflags for all entities
keylock.qc // common code for entities unlockable with keys
-custom_snd.qc // mapper-settable sound FX for monsters - iw
-custom_mdls.qc // mapper-settable models for monsters - iw
//----------------------------------------------------------------------
// base classes
//----------------------------------------------------------------------
base_entities.qc // topmost entity classes (+ damage functions)
base_func.qc // base func_ classes
-base_gore.qc // spawnblood etc; TODO CEV need to reformat
base_item.qc // ammo, armor, health, weapons, etc.
base_monster.qc // base monster classes (+ monster AI)
base_proj.qc // projectiles
@@ -40,6 +38,7 @@ base_trigger.qc // methods & fields for trigger entities
// info entities -- destinations, targets, etc.
//----------------------------------------------------------------------
info/camera.qc // was in cutscene.qc
+info/fog.qc // MG1 compat -- CEV
info/intermission.qc // intermission point entity
info/null.qc // info_null; was in lights.qc
info/notnull.qc // info_notnull; was in lights.qc
@@ -72,10 +71,13 @@ projectiles/zombiechunk.qc // id1 zombie flesh chunk (traditionally thrown)
//----------------------------------------------------------------------
items/ammo.qc // ammo; was in items.qc
items/armor.qc // armor; was in items.qc
+items/debris.qc // debris from breakables
+items/gore.qc // gore; was base_gore.qc; was elsewhere in id1
items/keys.qc // key pickups; contains items.qc and keydata.qc
items/health.qc // health; was in items.qc
items/powerups.qc // envirosuit, pent, ring, quad; was in items.qc
items/runes.qc // end-of-episode runes; was in items.qc
+items/walltorch.qc // id1 light_torch_small_walltorch
items/weapons.qc // weapon pickups; was in items.qc
items/backpacks.qc // backpack code; was in items.qc
@@ -116,7 +118,6 @@ func/wall.qc // was misc.qc -- CEV
func/bob.qc // RennyC's stand alone version based on AD
func/bossgate.qc // was misc.qc -- CEV
func/breakable.qc // selections from Rubicon2 QC
-func/brush.qc // currently disabled per comments in the file
func/button.qc // id1 buttons
func/counter.qc // Hipnotic counter; was in hipcount.qc
func/door.qc // was doors.qc -- CEV
@@ -130,8 +131,8 @@ func/illusionary.qc // was misc.qc -- CEV
func/laser.qc // selections from Rubicon2 QC
func/monster_spawner.qc // "bot" creation code for func_monster_spawner
func/new_plat.qc // Rogue MP newplats.qc
-func/plat.qc // was plats.qc -- CEV
func/particlefield.qc // Hipnotic particlefield
+func/plat.qc // was plats.qc -- CEV
func/rotate.qc // from Hipnotic thanks RennyC; was rotate.qc
func/togglevisiblewall.qc // was misc.qc -- CEV
func/togglewall.qc // was hippart.qc -- CEV
@@ -148,6 +149,7 @@ triggers/changetarget.qc //
triggers/counter.qc //
triggers/cvarset.qc // was in cutscene.qc
triggers/everything.qc // trigger_everything
+triggers/explosion.qc // MG1 trigger_explosion
triggers/filter.qc //
triggers/fog.qc // fog triggers
triggers/heal.qc // trigger_heal (was in dtmisc.qc) -- CEV
@@ -192,9 +194,12 @@ misc/lights.qc // c0burn's excellent switchable lights
misc/modeltrain.qc // was in plats.qc -- CEV
misc/noisemaker.qc // was in misc.qc -- CEV
misc/particles.qc // selections from Rubicon2 QC; was rubicon2.qc
-misc/particlespray.qc // selections from Rubicon2 QC; was rubicon2.qc
+misc/particle_spray.qc // selections from Rubicon2 QC; was rubicon2.qc
+misc/particle_embers.qc // selections from MG1 misc_fx.qc
misc/particle_stream.qc // from Zerstrorer mod -- dumptruck_ds
+misc/particle_tele.qc // selections from MG1 misc_fx.qc
misc/play.qc // sound code from Hip & Rubicon Rumble + misc
+misc/rune_indicator.qc // MG1 rune indicators
misc/sparks.qc // selections from Rubicon2 QC; was rubicon2.qc
misc/target_autosave.qc // was in misc.qc -- CEV
misc/teleporttrain.qc // was in plats.qc -- CEV
@@ -210,5 +215,7 @@ world.qc // worldspawn
// compatibility spawn functions & misc
//----------------------------------------------------------------------
compat/id1.qc // loose functions specific to id1 maps
+compat/mg1.qc // MG1 Dimension Of The Machine compat
+compat/copper.qc // very loose support for Copper mods
compat/quake3.qc // entrypoints & support for Quake 3 entities
#endlist
Return to the top of this page or return to the overview of this repo.
Diff qc/triggers/changelevel.qc
diff --git a/qc/triggers/changelevel.qc b/qc/triggers/changelevel.qc
index d394660..3fc9ad6 100644
--- a/qc/triggers/changelevel.qc
+++ b/qc/triggers/changelevel.qc
@@ -7,7 +7,24 @@
//======================================================================
#ifdef SSQC
-const float TRIGGER_CHANGELEVEL_EXITOFF = 8; // was DT_EXITOFF
+//----------------------------------------------------------------------
+// trigger_changelevel spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_TRIGGER_CHANGELEVEL_NOINTERMISSION = 1,
+ SPAWNFLAG_TRIGGER_CHANGELEVEL_EXITOFF = 8, // was DT_EXITOFF
+ SPAWNFLAG_TRIGGER_CHANGELEVEL_START2 = 16 // use info_player_start2
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} trigger_changelevel_spawnflags;
#endif
//======================================================================
@@ -97,9 +114,6 @@ When the player touches this, he gets sent to the map listed in the "map" variab
//--------------------------------------------------------------
void() trigger_changelevel_touch =
{
- if (self.estate != STATE_ACTIVE)
- return;
-
// from Copper -- dumptruck_ds
if (sub_checkvalidtouch(other) == FALSE)
return;
@@ -120,17 +134,22 @@ When the player touches this, he gets sent to the map listed in the "map" variab
nextmap = self.map;
sub_usetargets ();
- if ((self.spawnflags & 16) && (deathmatch == 0))
+ if (deathmatch == 0)
{
- // use info_player_start2 -- dumptruck_ds
- item_sigil_touch2 ();
- }
+ if (self.spawnflags &
+ SPAWNFLAG_TRIGGER_CHANGELEVEL_START2)
+ {
+ // use info_player_start2 -- dumptruck_ds
+ item_sigil_touch2 ();
+ }
- if ((self.spawnflags & 1) && (deathmatch == 0))
- {
- // NO_INTERMISSION
- GotoNextMap ();
- return;
+ if (self.spawnflags &
+ SPAWNFLAG_TRIGGER_CHANGELEVEL_NOINTERMISSION)
+ {
+ // NO_INTERMISSION
+ GotoNextMap ();
+ return;
+ }
}
self.touch = sub_null;
@@ -182,7 +201,7 @@ When the player touches this, he gets sent to the map listed in the "map" variab
e.use = trigger_changelevel_use;
// dumptruck_ds
- if (e.spawnflags & TRIGGER_CHANGELEVEL_EXITOFF)
+ if (e.spawnflags & SPAWNFLAG_TRIGGER_CHANGELEVEL_EXITOFF)
e.is_waiting = 1;
sub_checkwaiting (e);
Return to the top of this page or return to the overview of this repo.
Diff qc/triggers/counter.qc
diff --git a/qc/triggers/counter.qc b/qc/triggers/counter.qc
index 2f5e235..85de325 100644
--- a/qc/triggers/counter.qc
+++ b/qc/triggers/counter.qc
@@ -7,7 +7,22 @@
//======================================================================
#ifdef SSQC
-const float TRIGGER_COUNTER_NOMESSAGE = 1;
+//----------------------------------------------------------------------
+// trigger_counter spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_TRIGGER_COUNTER_NOMESSAGE = 1
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} trigger_counter_spawnflags;
#endif
//======================================================================
@@ -48,8 +63,8 @@ After the counter has been triggered "count" times (default 2), it will fire all
if (self.count != 0)
{
if (activator.classtype == CT_PLAYER &&
- (self.spawnflags &
- TRIGGER_COUNTER_NOMESSAGE) == 0)
+ (!(self.spawnflags &
+ SPAWNFLAG_TRIGGER_COUNTER_NOMESSAGE)))
{
if (self.count >= 4)
centerprint (activator,
@@ -68,7 +83,8 @@ After the counter has been triggered "count" times (default 2), it will fire all
}
if (activator.classtype == CT_PLAYER &&
- (self.spawnflags & TRIGGER_COUNTER_NOMESSAGE) == 0)
+ (!(self.spawnflags &
+ SPAWNFLAG_TRIGGER_COUNTER_NOMESSAGE)))
{
centerprint (activator, "Sequence completed!");
}
Return to the top of this page or return to the overview of this repo.
Diff qc/triggers/explosion.qc
diff --git a/qc/triggers/explosion.qc b/qc/triggers/explosion.qc
new file mode 100644
index 0000000..b8ef444
--- /dev/null
+++ b/qc/triggers/explosion.qc
@@ -0,0 +1,95 @@
+//==============================================================================
+// trigger_explosion -- from MachineGames Dimension Of The machine -- CEV
+//==============================================================================
+
+//======================================================================
+// constants
+//======================================================================
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// trigger_explosion spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_TRIGGER_EXPLOSION_NO_DAMAGE = 1
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} trigger_explosion_spawnflags;
+#endif
+
+//======================================================================
+// forward declarations
+//======================================================================
+
+#ifdef SSQC
+// trigger_explosion
+void() trigger_explosion_activate;
+void() trigger_explosion_use;
+void(entity e) trigger_explosion_init;
+void() trigger_explosion;
+#endif
+
+//------------------------------------------------------------------------------
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// class trigger_explosion: base_trigger
+// {
+ //--------------------------------------------------------------
+ void() trigger_explosion_activate =
+ {
+ self.delay = 0;
+ sub_usetargets ();
+
+ if (!(self.spawnflags & SPAWNFLAG_TRIGGER_EXPLOSION_NO_DAMAGE))
+ t_radiusdamage2 (self, self.owner, 120, self);
+
+ // BecomeExplosion
+ write_explosion (self.origin);
+ become_base_explosion (self);
+ };
+
+ //--------------------------------------------------------------
+ void() trigger_explosion_use =
+ {
+ if (self.delay > 0)
+ {
+ self.think = trigger_explosion_activate;
+ self.nextthink = time + self.delay;
+ }
+ else
+ {
+ trigger_explosion_activate ();
+ }
+ };
+
+ //--------------------------------------------------------------
+ void(entity e) trigger_explosion_init =
+ {
+ e.classname = "trigger_explosion";
+ e.classtype = CT_TRIGGER_EXPLOSION;
+
+ base_trigger_init (e);
+
+ e.use = trigger_explosion_use;
+ };
+
+ //--------------------------------------------------------------
+ void() trigger_explosion =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ trigger_explosion_init (self);
+ };
+// };
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/triggers/filter.qc
diff --git a/qc/triggers/filter.qc b/qc/triggers/filter.qc
index 9bcb77b..d14d08c 100644
--- a/qc/triggers/filter.qc
+++ b/qc/triggers/filter.qc
@@ -7,30 +7,62 @@
//======================================================================
#ifdef SSQC
-const float FILTER_FIELD_STATE = 0;
-const float FILTER_FIELD_HEALTH = 1;
-const float FILTER_FIELD_WEAPON = 2;
-const float FILTER_FIELD_FLAGS = 3;
-const float FILTER_FIELD_SPAWNFLAGS = 4;
-const float FILTER_FIELD_CLASSNAME = 5;
-const float FILTER_FIELD_ESTATE = 6;
-const float FILTER_FIELD_TARGETNAME = 8;
-const float FILTER_FIELD_ITEMS = 10;
-const float FILTER_FIELD_COUNT = 11;
-const float FILTER_FIELD_CNT = 12;
-const float FILTER_FIELD_TYPE = 13;
-
-const float FILTER_FIELDTYPE_FLOAT = 0;
-const float FILTER_FIELDTYPE_STRING = 1;
-const float FILTER_FIELDTYPE_FLAG = 2;
-
-const float FILTER_OP_EQUALS = 0;
-const float FILTER_OP_LT = 1;
-const float FILTER_OP_LTE = 2;
-const float FILTER_OP_GT = 3;
-const float FILTER_OP_GTE = 4;
-const float FILTER_OP_BITMASK_AND = 5;
-const float FILTER_OP_BITMASK_OR = 6;
+//----------------------------------------------------------------------
+// trigger_changelevel spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_TRIGGER_FILTER_NEGATE_RESULT = 1,
+ SPAWNFLAG_TRIGGER_FILTER_RELAY_ACTIVATOR = 2
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} trigger_filter_spawnflags;
+#endif
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+typedef enum
+{
+ TRIGGER_FILTER_FIELD_STATE = 0,
+ TRIGGER_FILTER_FIELD_HEALTH = 1,
+ TRIGGER_FILTER_FIELD_WEAPON = 2,
+ TRIGGER_FILTER_FIELD_FLAGS = 3,
+ TRIGGER_FILTER_FIELD_SPAWNFLAGS = 4,
+ TRIGGER_FILTER_FIELD_CLASSNAME = 5,
+ TRIGGER_FILTER_FIELD_ESTATE = 6,
+ TRIGGER_FILTER_FIELD_TARGETNAME = 8,
+ TRIGGER_FILTER_FIELD_ITEMS = 10,
+ TRIGGER_FILTER_FIELD_COUNT = 11,
+ TRIGGER_FILTER_FIELD_CNT = 12,
+ TRIGGER_FILTER_FIELD_TYPE = 13
+} trigger_filter_fields;
+
+//----------------------------------------------------------------------
+typedef enum
+{
+ TRIGGER_FILTER_FIELDTYPE_FLOAT = 0,
+ TRIGGER_FILTER_FIELDTYPE_STRING = 1,
+ TRIGGER_FILTER_FIELDTYPE_FLAG = 2
+} trigger_filter_filedtypes;
+
+//----------------------------------------------------------------------
+typedef enum
+{
+ TRIGGER_FILTER_OP_EQUALS = 0,
+ TRIGGER_FILTER_OP_LT = 1,
+ TRIGGER_FILTER_OP_LTE = 2,
+ TRIGGER_FILTER_OP_GT = 3,
+ TRIGGER_FILTER_OP_GTE = 4,
+ TRIGGER_FILTER_OP_BITMASK_AND = 5,
+ TRIGGER_FILTER_OP_BITMASK_OR = 6
+} trigger_filter_operations;
#endif
//======================================================================
@@ -94,100 +126,100 @@ void() trigger_filter;
switch (self.style)
{
- case FILTER_FIELD_STATE:
- fieldtype = FILTER_FIELDTYPE_FLOAT;
+ case TRIGGER_FILTER_FIELD_STATE:
+ fieldtype = TRIGGER_FILTER_FIELDTYPE_FLOAT;
targfloat = targ.state;
break;
- case FILTER_FIELD_ESTATE:
- fieldtype = FILTER_FIELDTYPE_FLOAT;
+ case TRIGGER_FILTER_FIELD_ESTATE:
+ fieldtype = TRIGGER_FILTER_FIELDTYPE_FLOAT;
targfloat = targ.estate;
break;
- case FILTER_FIELD_HEALTH:
- fieldtype = FILTER_FIELDTYPE_FLOAT;
+ case TRIGGER_FILTER_FIELD_HEALTH:
+ fieldtype = TRIGGER_FILTER_FIELDTYPE_FLOAT;
targfloat = targ.health;
break;
- case FILTER_FIELD_COUNT:
- fieldtype = FILTER_FIELDTYPE_FLOAT;
+ case TRIGGER_FILTER_FIELD_COUNT:
+ fieldtype = TRIGGER_FILTER_FIELDTYPE_FLOAT;
targfloat = targ.count;
break;
- case FILTER_FIELD_CNT:
- fieldtype = FILTER_FIELDTYPE_FLOAT;
+ case TRIGGER_FILTER_FIELD_CNT:
+ fieldtype = TRIGGER_FILTER_FIELDTYPE_FLOAT;
targfloat = targ.cnt;
break;
- case FILTER_FIELD_WEAPON:
- fieldtype = FILTER_FIELDTYPE_FLOAT;
+ case TRIGGER_FILTER_FIELD_WEAPON:
+ fieldtype = TRIGGER_FILTER_FIELDTYPE_FLOAT;
targfloat = targ.weapon;
break;
- case FILTER_FIELD_FLAGS:
- fieldtype = FILTER_FIELDTYPE_FLAG;
+ case TRIGGER_FILTER_FIELD_FLAGS:
+ fieldtype = TRIGGER_FILTER_FIELDTYPE_FLAG;
targfloat = targ.flags;
break;
- case FILTER_FIELD_SPAWNFLAGS:
- fieldtype = FILTER_FIELDTYPE_FLAG;
+ case TRIGGER_FILTER_FIELD_SPAWNFLAGS:
+ fieldtype = TRIGGER_FILTER_FIELDTYPE_FLAG;
targfloat = targ.spawnflags;
break;
- case FILTER_FIELD_ITEMS:
- fieldtype = FILTER_FIELDTYPE_FLAG;
+ case TRIGGER_FILTER_FIELD_ITEMS:
+ fieldtype = TRIGGER_FILTER_FIELDTYPE_FLAG;
targfloat = targ.items;
break;
- case FILTER_FIELD_CLASSNAME:
- fieldtype = FILTER_FIELDTYPE_STRING;
+ case TRIGGER_FILTER_FIELD_CLASSNAME:
+ fieldtype = TRIGGER_FILTER_FIELDTYPE_STRING;
targstring = targ.classname;
break;
- case FILTER_FIELD_TARGETNAME:
- fieldtype = FILTER_FIELDTYPE_STRING;
+ case TRIGGER_FILTER_FIELD_TARGETNAME:
+ fieldtype = TRIGGER_FILTER_FIELDTYPE_STRING;
targstring = targ.targetname;
break;
- case FILTER_FIELD_TYPE:
- fieldtype = FILTER_FIELDTYPE_STRING;
+ case TRIGGER_FILTER_FIELD_TYPE:
+ fieldtype = TRIGGER_FILTER_FIELDTYPE_STRING;
targstring = targ.type;
break;
}
- if (fieldtype == FILTER_FIELDTYPE_FLOAT)
+ if (fieldtype == TRIGGER_FILTER_FIELDTYPE_FLOAT)
{
- if (op == FILTER_OP_EQUALS)
+ if (op == TRIGGER_FILTER_OP_EQUALS)
{
if (targfloat == self.count)
result = 1;
}
- else if (op == FILTER_OP_LT)
+ else if (op == TRIGGER_FILTER_OP_LT)
{
if (targfloat < self.count)
result = 1;
}
- else if (op == FILTER_OP_LTE)
+ else if (op == TRIGGER_FILTER_OP_LTE)
{
if (targfloat <= self.count)
result = 1;
}
- else if (op == FILTER_OP_GT)
+ else if (op == TRIGGER_FILTER_OP_GT)
{
if (targfloat > self.count)
result = 1;
}
- else if (op == FILTER_OP_GTE)
+ else if (op == TRIGGER_FILTER_OP_GTE)
{
if (targfloat >= self.count)
result = 1;
}
- else if (op == FILTER_OP_BITMASK_AND)
+ else if (op == TRIGGER_FILTER_OP_BITMASK_AND)
{
if (targfloat & self.count)
result = 1;
}
- else if (op == FILTER_OP_BITMASK_OR)
+ else if (op == TRIGGER_FILTER_OP_BITMASK_OR)
{
if (targfloat | self.count)
result = 1;
@@ -198,19 +230,19 @@ void() trigger_filter;
result = 1;
}
}
- else if (fieldtype == FILTER_FIELDTYPE_FLAG)
+ else if (fieldtype == TRIGGER_FILTER_FIELDTYPE_FLAG)
{
- if (op == FILTER_OP_EQUALS)
+ if (op == TRIGGER_FILTER_OP_EQUALS)
{
if (targfloat == self.aflag)
result = 1;
}
- else if (op == FILTER_OP_BITMASK_AND)
+ else if (op == TRIGGER_FILTER_OP_BITMASK_AND)
{
if (targfloat & self.aflag)
result = 1;
}
- else if (op == FILTER_OP_BITMASK_OR)
+ else if (op == TRIGGER_FILTER_OP_BITMASK_OR)
{
if (targfloat | self.aflag)
result = 1;
@@ -221,7 +253,7 @@ void() trigger_filter;
result = 1;
}
}
- else if (fieldtype == FILTER_FIELDTYPE_STRING)
+ else if (fieldtype == TRIGGER_FILTER_FIELDTYPE_STRING)
{
if (targstring == self.type)
result = 1;
@@ -232,7 +264,7 @@ void() trigger_filter;
return;
}
- if (self.spawnflags & 1)
+ if (self.spawnflags & SPAWNFLAG_TRIGGER_FILTER_NEGATE_RESULT)
// negate
result = 1 - result;
@@ -241,8 +273,11 @@ void() trigger_filter;
self.state = 1;
// relay activator as owner
- if (self.spawnflags & 2 && activator.owner)
+ if (activator.owner && self.spawnflags &
+ SPAWNFLAG_TRIGGER_FILTER_RELAY_ACTIVATOR)
+ {
activator = activator.owner;
+ }
sub_usetargets ();
Return to the top of this page or return to the overview of this repo.
Diff qc/triggers/fog.qc
diff --git a/qc/triggers/fog.qc b/qc/triggers/fog.qc
index 5b858b9..9b00c1a 100644
--- a/qc/triggers/fog.qc
+++ b/qc/triggers/fog.qc
@@ -20,12 +20,31 @@
//======================================================================
#ifdef SSQC
-const float FOG_INTERVAL = 0.04166667; // 1/24;
+//----------------------------------------------------------------------
+// base_fog spawnflags -- common to various fog triggers -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_BASE_FOG_ONEWAY = 1,
+ SPAWNFLAG_BASE_FOG_REVERSE = 2,
+ SPAWNFLAG_BASE_FOG_ALLCLIENTS = 4,
+ SPAWNFLAG_BASE_FOG_BLENDTO = 8,
+ SPAWNFLAG_BASE_FOG_NOTOUCH = 16 // MG1 compat -- CEV
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} base_fog_spawnflags;
+#endif
-const float FOGBLEND_ONEWAY = 1;
-const float FOGBLEND_REVERSE = 2;
-const float FOGBLEND_ALLCLIENTS = 4;
-const float FOGBLEND_BLENDTO = 8;
+
+#ifdef SSQC
+const float FOG_INTERVAL = 0.04166667; // 1/24;
#endif
//======================================================================
@@ -37,6 +56,7 @@ const float FOGBLEND_BLENDTO = 8;
.float fog_density, fog_density2;
.float skyfog_density, skyfog_density2;
.entity fogblend_entity;
+.string fog_info_entity; // MG1 fog
#endif
//======================================================================
@@ -93,8 +113,17 @@ void() trigger_fogblend;
#endif
#ifdef SSQC
+// trigger_fog_transition
+void() trigger_fog_transition_touch;
+void() trigger_fog_transition_think;
+void(entity e) trigger_fog_transition_init;
+void() trigger_fog_transition;
+#endif
+
+#ifdef SSQC
// trigger_fog
void() trigger_fog_touch;
+void() trigger_fog_think_mg1;
entity(vector org, vector nmins, vector nmaxs, float newspeed, vector newcolor,
float fdensity, float sfdensity, float newdelay) spawn_trigger_fog;
void(entity e) trigger_fog_init;
@@ -315,7 +344,7 @@ void(entity client, entity fogger) fog_set_from_ent =
// dprint3 ("fog_density: ", ftos(fogger.fog_density*100), "\n");
if (fogger.fog_density)
{
- dprint ("setting fog\n");
+ dprint ("fog_set_from_ent: setting fog\n");
density = zeroconvert (fogger.fog_density);
fog_set (client, density, fogger.fog_color);
}
@@ -323,7 +352,7 @@ void(entity client, entity fogger) fog_set_from_ent =
// dprint3 ("skyfog_density: ", ftos(fogger.skyfog_density*100), "\n");
if (fogger.skyfog_density)
{
- dprint ("setting skyfog\n");
+ dprint ("fog_set_from_ent: setting skyfog\n");
density = zeroconvert (fogger.skyfog_density);
skyfog_set (client, density);
}
@@ -359,7 +388,7 @@ void(entity client, float density) skyfog_set =
if (client.classtype != CT_PLAYER)
return;
- // dprint3 ("Setting skyfog: ", ftos(density), "\n");
+ // dprint3 ("fog_set_from_ent: setting skyfog: ", ftos(density), "\n");
stuffcmd (client, "\nr_skyfog ");
stuffcmd_float (client, density);
@@ -445,7 +474,7 @@ void(entity client, float sTo, float f) skyfog_blend_set_fraction =
sTo = self.skyfog_density;
}
- if (self.spawnflags & FOGBLEND_ALLCLIENTS)
+ if (self.spawnflags & SPAWNFLAG_BASE_FOG_ALLCLIENTS)
{
entity pl;
pl = nextent (world);
@@ -591,7 +620,7 @@ Activator's fog will be blended over time from start to end values.
if (self.enemy.classtype != CT_PLAYER)
return;
- if (!(self.spawnflags & FOGBLEND_ONEWAY))
+ if (!(self.spawnflags & SPAWNFLAG_BASE_FOG_ONEWAY))
self.state = 1 - self.state;
if (self.state)
@@ -599,7 +628,7 @@ Activator's fog will be blended over time from start to end values.
else
self.pain_finished = time + self.delay + self.speed2;
- if (self.spawnflags & FOGBLEND_ALLCLIENTS)
+ if (self.spawnflags & SPAWNFLAG_BASE_FOG_ALLCLIENTS)
{
entity pl;
pl = nextent (world);
@@ -660,12 +689,12 @@ Activator's fog will be blended over time from start to end values.
return;
}
- if (e.spawnflags & FOGBLEND_REVERSE)
+ if (e.spawnflags & SPAWNFLAG_BASE_FOG_REVERSE)
e.state = 1;
else
e.state = 0;
- if (e.spawnflags & FOGBLEND_ONEWAY)
+ if (e.spawnflags & SPAWNFLAG_BASE_FOG_ONEWAY)
e.state = 1 - e.state;
if (!e.speed)
@@ -858,6 +887,125 @@ Acts as a smoothly blending portal between two zones of different fog. Sets the
#endif
#ifdef SSQC
+/*QUAKED trigger_fog_transition (0.5 .5 .8) (? ? ?) (? ? ?)
+Trigger to transition fog between two sides.
+fog_info_entity: info_fog that contains values this trigger should use on the 'left' side.
+target: info_fog that contains values this trigger should use on the 'right' side.
+style: Which axis this trigger fades across. 0 = X, 1 = Y, 2 = Z
+*/
+// class trigger_fog_transition: base_trigger
+// {
+ //--------------------------------------------------------------
+ void() trigger_fog_transition_touch =
+ {
+ // MG1 trigger_fog_transition_touch_get_tween -- CEV
+ local vector t = other.origin - self.mins;
+ local vector b = self.size;
+ local float tween = 0;
+
+ if (self.style == 0)
+ tween = t_x / b_x;
+ else if (self.style == 1)
+ tween = t_y / b_y;
+ else if (self.style == 2)
+ tween = t_z / b_z;
+
+ if (tween < 0)
+ tween = 0;
+ if (tween > 1)
+ tween = 1;
+
+ // back to MG1 trigger_fog_transition_touch -- CEV
+ local float density = ((1 - tween) * self.fog_density) +
+ (tween * self.fog_density2);
+ local vector color = ((1 - tween) * self.fog_color) +
+ (tween * self.fog_color2);
+
+ fog_set (other, density, color);
+ };
+
+ //--------------------------------------------------------------
+ void() trigger_fog_transition_think =
+ {
+ if (self.fog_info_entity != __NULL__ &&
+ self.fog_info_entity != "")
+ {
+ local entity f;
+ f = find (world, targetname, self.fog_info_entity);
+ if (f.classtype == CT_INFO_FOG)
+ {
+ dprint (sprintf("trigger_fog_transition_"
+ "think: found info_fog, density "
+ "%g, color %v\n",
+ f.fog_density, f.fog_color));
+ self.fog_density = f.fog_density;
+ self.fog_color = f.fog_color;
+ }
+ }
+ else
+ {
+ objerror ("trigger_fog_transition_think: "
+ "no fog_info_entity!");
+ }
+
+ if (self.target != __NULL__ && self.target != "")
+ {
+ local entity t;
+ t = find (world, targetname, self.target);
+ if (t.classtype == CT_INFO_FOG)
+ {
+ dprint (sprintf("trigger_fog_transition_"
+ "think: found info_fog target, "
+ "density %g, color %v\n",
+ t.fog_density, t.fog_color));
+ self.fog_density2 = t.fog_density;
+ self.fog_color2 = t.fog_color;
+ }
+ }
+ else
+ {
+ objerror ("trigger_fog_transition_think: no target!");
+ }
+
+ self.think = sub_null;
+ self.touch = trigger_fog_transition_touch;
+ };
+
+ //--------------------------------------------------------------
+ void(entity e) trigger_fog_transition_init =
+ {
+ e.classname = "trigger_fog_transition";
+ e.classtype = CT_TRIGGER_FOGTRANSITION;
+
+ if (e.style < 0 || e.style > 2)
+ {
+ objerror("trigger_fog_transition_init: invalid style; "
+ "needs to be 0, 1 or 2.");
+ return;
+ }
+
+ base_trigger_init (e);
+ sub_checkwaiting (e);
+
+ e.think = trigger_fog_transition_think;
+ e.nextthink = 0.3 + (random() * 0.25);
+ };
+
+ //--------------------------------------------------------------
+ // an entity from MG1 Dimension Of The Machine -- CEV
+ //--------------------------------------------------------------
+ void() trigger_fog_transition =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ trigger_fog_transition_init (self);
+ };
+// };
+#endif
+
+#ifdef SSQC
/*QUAKED trigger_fog (.5 .5 .2) ?
Smoothly blends touching client's currently applied fog to "fog_color" and "fog_density" over time.
@@ -900,6 +1048,27 @@ CAVEATS:
};
//--------------------------------------------------------------
+ void() trigger_fog_think_mg1 =
+ {
+ if (self.fog_info_entity != __NULL__ &&
+ self.fog_info_entity != "")
+ {
+ local entity f;
+ f = find (world, targetname, self.fog_info_entity);
+ if (f.classtype == CT_INFO_FOG)
+ {
+ dprint (sprintf("trigger_fog_think_mg1: found "
+ "info_fog, density %g, color %v\n",
+ f.fog_density, f.fog_color));
+ self.fog_density = f.fog_density;
+ self.fog_color = f.fog_color;
+ }
+ }
+
+ self.think = sub_null;
+ };
+
+ //--------------------------------------------------------------
entity(vector org, vector nmins, vector nmaxs,
float newspeed, vector newcolor, float fdensity,
float sfdensity, float newdelay) spawn_trigger_fog =
@@ -924,7 +1093,8 @@ CAVEATS:
{
e.classname = "trigger_fog";
e.classtype = CT_TRIGGER_FOG;
- e.touch = trigger_fog_touch;
+ if (!(e.spawnflags & SPAWNFLAG_BASE_FOG_NOTOUCH))
+ e.touch = trigger_fog_touch;
if (!e.fog_density && !e.skyfog_density)
{
@@ -937,6 +1107,16 @@ CAVEATS:
if (!e.speed)
e.speed = 1;
+ // MG1 compat -- CEV
+ if (known_release == KNOWN_RELEASE_MG1)
+ {
+ if (!e.delay)
+ e.delay = 0.5;
+ e.use = trigger_fog_touch;
+ e.think = trigger_fog_think_mg1;
+ e.nextthink = 0.2 + (random() * 0.25);
+ }
+
sub_checkwaiting (e);
};
@@ -947,6 +1127,15 @@ CAVEATS:
if (SUB_Inhibit())
return;
+ // rewrite NOTOUCH spawnflag for MG1 fog entities -- CEV
+ if (known_release == KNOWN_RELEASE_MG1) {
+ if (self.spawnflags & 1)
+ {
+ dprint ("trigger_fog MG1 rewrite\n");
+ self.spawnflags &= ~1;
+ self.spawnflags |= SPAWNFLAG_BASE_FOG_NOTOUCH;
+ } }
+
trigger_fog_init (self);
};
// };
Return to the top of this page or return to the overview of this repo.
Diff qc/triggers/heal.qc
diff --git a/qc/triggers/heal.qc b/qc/triggers/heal.qc
index 2f2e758..16acb2b 100644
--- a/qc/triggers/heal.qc
+++ b/qc/triggers/heal.qc
@@ -9,9 +9,24 @@
//======================================================================
#ifdef SSQC
-const float TRIGGER_HEAL_START_ON = 1;
-const float TRIGGER_HEAL_PLAYER_ONLY = 2;
-const float TRIGGER_HEAL_MONSTER_ONLY = 4;
+//----------------------------------------------------------------------
+// trigger_heal spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_TRIGGER_HEAL_START_ON = 1,
+ SPAWNFLAG_TRIGGER_HEAL_PLAYER_ONLY = 2,
+ SPAWNFLAG_TRIGGER_HEAL_MONSTER_ONLY = 4
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} trigger_heal_spawnflags;
#endif
//======================================================================
@@ -40,7 +55,7 @@ void() trigger_heal;
//------------------------------------------------------------------------------
#ifdef SSQC
-/*QUAKED trigger_heal (.5 .5 .5) ? TRIGGER_HEAL_START_ON TRIGGER_HEAL_PLAYER_ONLY TRIGGER_HEAL_MONSTER_ONLY X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+/*QUAKED trigger_heal (.5 .5 .5) ? START_ON PLAYER_ONLY MONSTER_ONLY X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Any object touching this will be healed
heal_amount -- the amount to heal each time (default 5)
@@ -96,13 +111,13 @@ message2 -- message to print when exhausted
return;
}
- if (self.spawnflags & TRIGGER_HEAL_PLAYER_ONLY &&
+ if (self.spawnflags & SPAWNFLAG_TRIGGER_HEAL_PLAYER_ONLY &&
other.classtype != CT_PLAYER)
{
return;
}
- if (self.spawnflags & TRIGGER_HEAL_MONSTER_ONLY &&
+ if (self.spawnflags & SPAWNFLAG_TRIGGER_HEAL_MONSTER_ONLY &&
!(other.flags & FL_MONSTER))
{
return;
@@ -201,8 +216,8 @@ message2 -- message to print when exhausted
if (e.health_max == 0)
e.health_max = 100;
- else if (e.health_max > 250)
- e.health_max = 250;
+ else if (e.health_max > PLAYER_HEALTH_MEGA)
+ e.health_max = PLAYER_HEALTH_MEGA;
if (e.count)
{
@@ -218,7 +233,7 @@ message2 -- message to print when exhausted
if (e.targetname)
{
e.use = trigger_heal_toggle;
- if (e.spawnflags & TRIGGER_HEAL_START_ON)
+ if (e.spawnflags & SPAWNFLAG_TRIGGER_HEAL_START_ON)
e.touch = trigger_heal_touch;
else
e.touch = sub_null;
Return to the top of this page or return to the overview of this repo.
Diff qc/triggers/ladder.qc
diff --git a/qc/triggers/ladder.qc b/qc/triggers/ladder.qc
index ff816f5..ab09ed6 100644
--- a/qc/triggers/ladder.qc
+++ b/qc/triggers/ladder.qc
@@ -3,6 +3,28 @@
//==============================================================================
//======================================================================
+// constants
+//======================================================================
+
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+// trigger_ladder netflags; should be able to do this in 8 bits -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ NETFLAG_TRIGGER_LADDER_STATE = NETFLAG_BASE_TRIGGER_STATE,
+ NETFLAG_TRIGGER_LADDER_ESTATE = NETFLAG_BASE_TRIGGER_ESTATE,
+ NETFLAG_TRIGGER_LADDER_SIZE,
+ NETFLAG_TRIGGER_LADDER_ANGLES,
+ NETFLAG_TRIGGER_LADDER_MOVEDIR
+} trigger_ladder_netflags;
+
+const float NETFLAG_TRIGGER_LADDER_FULLSEND = NETFLAG_TRIGGER_LADDER_SIZE |
+ NETFLAG_TRIGGER_LADDER_ANGLES | NETFLAG_TRIGGER_LADDER_MOVEDIR |
+ NETFLAG_TRIGGER_LADDER_ESTATE;
+#endif
+
+//======================================================================
// forward declarations
//======================================================================
@@ -36,16 +58,15 @@ Keys:
//--------------------------------------------------------------
void(float isnew) trigger_ladder_netreceive =
{
- local float netflags = ReadFloat ();
+ local float netflags = ReadByte ();
- if (netflags & BASE_TRIGGER_NET_ORIGIN)
- {
- self.origin_x = ReadCoord ();
- self.origin_y = ReadCoord ();
- self.origin_z = ReadCoord ();
- }
+ if (netflags & NETFLAG_TRIGGER_LADDER_STATE)
+ self.state = ReadByte ();
+
+ if (netflags & NETFLAG_TRIGGER_LADDER_ESTATE)
+ self.estate = ReadByte ();
- if (netflags & BASE_TRIGGER_NET_SIZE)
+ if (netflags & NETFLAG_TRIGGER_LADDER_SIZE)
{
self.mins_x = ReadCoord ();
self.mins_y = ReadCoord ();
@@ -55,32 +76,26 @@ Keys:
self.maxs_z = ReadCoord ();
}
- if (netflags & BASE_TRIGGER_NET_MOVEDIR)
- {
- self.movedir_x = ReadShort () * (360 / 32767);
- self.movedir_y = ReadShort () * (360 / 32767);
- self.movedir_z = ReadShort () * (360 / 32767);
- }
-
- if (netflags & BASE_TRIGGER_NET_ANGLES)
+ if (netflags & NETFLAG_TRIGGER_LADDER_ANGLES)
{
self.angles_x = ReadAngle ();
self.angles_y = ReadAngle ();
self.angles_z = ReadAngle ();
}
- if (netflags & BASE_TRIGGER_NET_ESTATE)
- self.estate = ReadFloat ();
+ if (netflags & NETFLAG_TRIGGER_LADDER_MOVEDIR)
+ {
+ self.movedir_x = ReadAngle ();
+ self.movedir_y = ReadAngle ();
+ self.movedir_z = ReadAngle ();
+ }
if (isnew)
trigger_ladder_init (self);
- // make sure size and origin are set -- CEV
- if (netflags & BASE_TRIGGER_NET_SIZE)
+ // make sure size is set -- CEV
+ if (netflags & NETFLAG_TRIGGER_LADDER_SIZE)
setsize (self, self.mins, self.maxs);
-
- if (netflags & BASE_TRIGGER_NET_ORIGIN)
- setorigin (self, self.origin);
};
#endif
@@ -88,17 +103,20 @@ Keys:
//--------------------------------------------------------------
float(entity to, float netflags) trigger_ladder_netsend =
{
- WriteShort (MSG_ENTITY, self.classtype);
- WriteFloat (MSG_ENTITY, netflags);
+ WriteByte (MSG_ENTITY, self.classtype);
- if (netflags & BASE_TRIGGER_NET_ORIGIN)
- {
- WriteCoord (MSG_ENTITY, self.origin_x);
- WriteCoord (MSG_ENTITY, self.origin_y);
- WriteCoord (MSG_ENTITY, self.origin_z);
- }
+ if (netflags > NETFLAG_TRIGGER_LADDER_FULLSEND)
+ netflags = NETFLAG_TRIGGER_LADDER_FULLSEND;
+
+ WriteByte (MSG_ENTITY, netflags);
+
+ if (netflags & NETFLAG_TRIGGER_LADDER_STATE)
+ WriteByte (MSG_ENTITY, self.state);
- if (netflags & BASE_TRIGGER_NET_SIZE)
+ if (netflags & NETFLAG_TRIGGER_LADDER_ESTATE)
+ WriteByte (MSG_ENTITY, self.estate);
+
+ if (netflags & NETFLAG_TRIGGER_LADDER_SIZE)
{
WriteCoord (MSG_ENTITY, self.mins_x);
WriteCoord (MSG_ENTITY, self.mins_y);
@@ -108,22 +126,19 @@ Keys:
WriteCoord (MSG_ENTITY, self.maxs_z);
}
- if (netflags & BASE_TRIGGER_NET_MOVEDIR)
- {
- WriteShort (MSG_ENTITY, self.movedir_x * (32767 / 360));
- WriteShort (MSG_ENTITY, self.movedir_y * (32767 / 360));
- WriteShort (MSG_ENTITY, self.movedir_z * (32767 / 360));
- }
-
- if (netflags & BASE_TRIGGER_NET_ANGLES)
+ if (netflags & NETFLAG_TRIGGER_LADDER_ANGLES)
{
WriteAngle (MSG_ENTITY, self.angles_x);
WriteAngle (MSG_ENTITY, self.angles_y);
WriteAngle (MSG_ENTITY, self.angles_z);
}
- if (netflags & BASE_TRIGGER_NET_ESTATE)
- WriteFloat (MSG_ENTITY, self.estate);
+ if (netflags & NETFLAG_TRIGGER_LADDER_MOVEDIR)
+ {
+ WriteAngle (MSG_ENTITY, self.movedir_x);
+ WriteAngle (MSG_ENTITY, self.movedir_y);
+ WriteAngle (MSG_ENTITY, self.movedir_z);
+ }
return TRUE;
};
@@ -152,8 +167,16 @@ Keys:
{
makevectors (other.angles);
if (v_forward * self.movedir < 0)
+ {
+ #if 0
+ dprint (sprintf("trigger_ladder_touch: "
+ "facing wrong way; movedir %v, "
+ "other ang %v\n", self.movedir,
+ other.angles));
+ #endif
// not facing the right way
return;
+ }
}
// changed to PMFLAGS -- CEV
@@ -189,11 +212,7 @@ Keys:
// trigger_ladder needs to be networked to the client. set
// our transmit function then full send the entity -- CEV
e.SendEntity = trigger_ladder_netsend;
- e.SendFlags |= BASE_TRIGGER_NET_ORIGIN |
- BASE_TRIGGER_NET_SIZE |
- BASE_TRIGGER_NET_ESTATE |
- BASE_TRIGGER_NET_ANGLES |
- BASE_TRIGGER_NET_MOVEDIR;
+ e.SendFlags |= NETFLAG_TRIGGER_LADDER_FULLSEND;
#endif
};
#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/triggers/monsterjump.qc
diff --git a/qc/triggers/monsterjump.qc b/qc/triggers/monsterjump.qc
index 58be4be..af5c7d9 100644
--- a/qc/triggers/monsterjump.qc
+++ b/qc/triggers/monsterjump.qc
@@ -7,7 +7,22 @@
//======================================================================
#ifdef SSQC
-const float TRIGGER_MONSTERJUMP_STARTOFF = 8;
+//----------------------------------------------------------------------
+// trigger_monsterjump spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_TRIGGER_MONSTERJUMP_STARTOFF = 8
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} trigger_monsterjump_spawnflags;
#endif
//======================================================================
@@ -25,14 +40,14 @@ void() trigger_monsterjump;
//------------------------------------------------------------------------------
#ifdef SSQC
-/*QUAKED trigger_monsterjump (.5 .5 .5) ? X X X TRIGGER_MONSTERJUMP_STARTOFF X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+/*QUAKED trigger_monsterjump (.5 .5 .5) ? X X X STARTOFF X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Walking monsters that touch this will jump in the direction of the
trigger's angle
"speed" default to 200, the speed thrown forward
"height" default to 200, the speed thrown upwards
-If TRIGGER_MONSTERJUMP_STARTOFF flag is set, this makes the trigger inactive. This can
+If STARTOFF flag is set, this makes the trigger inactive. This can
be targeted and toggled off and on.
*/
//----------------------------------------------------------------------
@@ -82,10 +97,8 @@ be targeted and toggled off and on.
e.use = trigger_monsterjump_use;
// dumptruck_ds
- if (e.spawnflags & TRIGGER_MONSTERJUMP_STARTOFF)
- {
+ if (e.spawnflags & SPAWNFLAG_TRIGGER_MONSTERJUMP_STARTOFF)
e.estate = STATE_INACTIVE;
- }
if (!e.speed)
e.speed = 200;
Return to the top of this page or return to the overview of this repo.
Diff qc/triggers/multiple.qc
diff --git a/qc/triggers/multiple.qc b/qc/triggers/multiple.qc
index 37a5668..2220537 100644
--- a/qc/triggers/multiple.qc
+++ b/qc/triggers/multiple.qc
@@ -7,9 +7,24 @@
//======================================================================
#ifdef SSQC
-const float TRIGGER_MULTIPLE_NOTOUCH = 1;
-// used for Wait for retrigger spawnflag
-const float TRIGGER_MULTIPLE_TURNS_OFF = 2;
+//----------------------------------------------------------------------
+// base_multiple spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_BASE_MULTIPLE_NOTOUCH = 1,
+ SPAWNFLAG_BASE_MULTIPLE_TURNS_OFF = 2, // wait for retrigger
+ SPAWNFLAG_BASE_MULTIPLE_TRIGGER_FIRST = 4 // MG1 compat -- CEV
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} base_multiple_spawnflags;
#endif
//======================================================================
@@ -100,7 +115,8 @@ void() trigger_once;
{
self.think = base_multiple_think_wait;
self.nextthink = time + self.wait;
- if (self.spawnflags & TRIGGER_MULTIPLE_TURNS_OFF)
+ if (self.spawnflags &
+ SPAWNFLAG_BASE_MULTIPLE_TURNS_OFF)
{
self.is_waiting = 1;
sub_checkwaiting (self);
@@ -144,7 +160,7 @@ void() trigger_once;
//--------------------------------------------------------------
void() base_multiple_touch =
{
- if (self.spawnflags & TRIGGER_MULTIPLE_NOTOUCH)
+ if (self.spawnflags & SPAWNFLAG_BASE_MULTIPLE_NOTOUCH)
return;
if (other.classtype != CT_PLAYER)
@@ -204,7 +220,7 @@ void() trigger_once;
e.wait = 0.2;
}
else if (e.wait < 0 &&
- (e.spawnflags & TRIGGER_MULTIPLE_TURNS_OFF))
+ (e.spawnflags & SPAWNFLAG_BASE_MULTIPLE_TURNS_OFF))
{
objerror ("base_multiple_init: wait for retrigger "
"and negative wait don't make sense\n");
@@ -216,7 +232,7 @@ void() trigger_once;
if (e.health)
{
- if (e.spawnflags & TRIGGER_MULTIPLE_NOTOUCH)
+ if (e.spawnflags & SPAWNFLAG_BASE_MULTIPLE_NOTOUCH)
objerror ("base_multiple_init: health "
"and notouch don't make sense\n");
e.max_health = e.health;
@@ -230,8 +246,10 @@ void() trigger_once;
}
else
{
- if (!(e.spawnflags & TRIGGER_MULTIPLE_NOTOUCH))
+ if (!(e.spawnflags & SPAWNFLAG_BASE_MULTIPLE_NOTOUCH))
+ {
e.touch = base_multiple_touch;
+ }
}
sub_checkwaiting (e);
@@ -279,7 +297,17 @@ set "message" to text string
if (SUB_Inhibit())
return;
- trigger_multiple_init (self);
+ // Dimension Of The Machine compat -- CEV
+ if (known_release == KNOWN_RELEASE_MG1 && self.spawnflags & 2)
+ {
+ self.use = trigger_multiple;
+ self.spawnflags &= ~2;
+ self.spawnflags |= SPAWNFLAG_BASE_MULTIPLE_TRIGGER_FIRST;
+ }
+ else
+ {
+ trigger_multiple_init (self);
+ }
};
// };
#endif
@@ -317,7 +345,17 @@ set "message" to text string
if (SUB_Inhibit())
return;
- trigger_once_init (self);
+ // Dimension Of The Machine compat -- CEV
+ if (known_release == KNOWN_RELEASE_MG1 && self.spawnflags & 2)
+ {
+ self.use = trigger_once;
+ self.spawnflags &= ~2;
+ self.spawnflags |= SPAWNFLAG_BASE_MULTIPLE_TRIGGER_FIRST;
+ }
+ else
+ {
+ trigger_once_init (self);
+ }
};
// };
#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/triggers/push.qc
diff --git a/qc/triggers/push.qc b/qc/triggers/push.qc
index d422258..c371cd7 100644
--- a/qc/triggers/push.qc
+++ b/qc/triggers/push.qc
@@ -7,21 +7,64 @@
//======================================================================
#ifdef SSQC
-const float TRIGGER_PUSH_ONCE = 1; // only trigger once
-const float TRIGGER_PUSH_STARTOFF = 8; // trigger will start off
-const float TRIGGER_PUSH_SILENT = 16; // push silently
-const float TRIGGER_PUSH_NOISE = 32; // use custom sound via noise key/value
+//----------------------------------------------------------------------
+// trigger_push spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_TRIGGER_PUSH_ONCE = 1, // only trigger once
+ SPAWNFLAG_TRIGGER_PUSH_ADDITIVE = 2, // from mg1 -- CEV
+ SPAWNFLAG_TRIGGER_PUSH_MGSTARTOFF = 4, // start off (mg1) -- CEV
+ SPAWNFLAG_TRIGGER_PUSH_STARTOFF = 8, // start off
+ SPAWNFLAG_TRIGGER_PUSH_SILENT = 16, // push silently
+ SPAWNFLAG_TRIGGER_PUSH_NOISE = 32 // custom sound via noise key/value
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} trigger_push_spawnflags;
#endif
#if defined(CSQC) || defined(SSQC)
-const float TRIGGER_PUSH_STATE_TARGETED = 1;
+//----------------------------------------------------------------------
+// trigger_push netflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ NETFLAG_TRIGGER_PUSH_STATE = NETFLAG_BASE_TRIGGER_STATE,
+ NETFLAG_TRIGGER_PUSH_ESTATE = NETFLAG_BASE_TRIGGER_ESTATE,
+ NETFLAG_TRIGGER_PUSH_SIZE,
+ NETFLAG_TRIGGER_PUSH_ANGLES,
+ NETFLAG_TRIGGER_PUSH_MOVEDIR,
+ NETFLAG_TRIGGER_PUSH_NEWORIGIN,
+ NETFLAG_TRIGGER_PUSH_SPEED
+} trigger_push_netflags;
+
+const float NETFLAG_TRIGGER_PUSH_FULLSEND = NETFLAG_TRIGGER_PUSH_SIZE |
+ NETFLAG_TRIGGER_PUSH_ANGLES | NETFLAG_TRIGGER_PUSH_MOVEDIR |
+ NETFLAG_TRIGGER_PUSH_NEWORIGIN | NETFLAG_TRIGGER_PUSH_SPEED |
+ NETFLAG_TRIGGER_PUSH_STATE | NETFLAG_TRIGGER_PUSH_ESTATE;
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+typedef enum
+{
+ TRIGGER_PUSH_STATE_TARGETED = 1,
+ TRIGGER_PUSH_STATE_ADDITIVE = 2
+} trigger_push_states;
#endif
//======================================================================
// forward declarations
//======================================================================
-#ifdef SSQC
+#if defined(CSQC) || defined(SSQC)
vector(float a, float b, float c) solve_quadratic;
#endif
@@ -31,12 +74,15 @@ void(float isnew) base_trigger_push_netreceive;
#endif
#ifdef SSQC
float(entity to, float netflags) base_trigger_push_netsend;
-vector(vector org, entity tgt, float ht) base_trigger_push_calculatevelocity;
-void() base_trigger_push_findtarget;
+void() base_trigger_push_think_findtarget;
#endif
#if defined(CSQC) || defined(SSQC)
+vector(vector org, vector torg, float ht) base_trigger_push_calcvel;
void() base_trigger_push_touch;
#endif
+#ifdef SSQC
+void(string key, string value) base_trigger_push_init_field;
+#endif
// trigger_push
// void() trigger_push_use;
@@ -60,7 +106,7 @@ void() trigger_push_custom;
//------------------------------------------------------------------------------
-#ifdef SSQC
+#if defined(CSQC) || defined(SSQC)
//----------------------------------------------------------------------
// solve_quadratic -- from Nexuiz source code; original can be found at
// https://github.com/smlinux/nexuiz/blob/master/data/qcsrc/common/util.qc
@@ -128,16 +174,15 @@ vector(float a, float b, float c) solve_quadratic =
//--------------------------------------------------------------
void(float isnew) base_trigger_push_netreceive =
{
- local float netflags = ReadFloat ();
+ local float netflags = ReadByte ();
- if (netflags & BASE_TRIGGER_NET_ORIGIN)
- {
- self.origin_x = ReadCoord ();
- self.origin_y = ReadCoord ();
- self.origin_z = ReadCoord ();
- }
+ if (netflags & NETFLAG_TRIGGER_PUSH_STATE)
+ self.state = ReadByte ();
+
+ if (netflags & NETFLAG_TRIGGER_PUSH_ESTATE)
+ self.estate = ReadByte ();
- if (netflags & BASE_TRIGGER_NET_SIZE)
+ if (netflags & NETFLAG_TRIGGER_PUSH_SIZE)
{
self.mins_x = ReadCoord ();
self.mins_y = ReadCoord ();
@@ -147,18 +192,22 @@ vector(float a, float b, float c) solve_quadratic =
self.maxs_z = ReadCoord ();
}
- if (netflags & BASE_TRIGGER_NET_MOVEDIR)
+ if (netflags & NETFLAG_TRIGGER_PUSH_MOVEDIR)
{
- self.movedir_x = ReadCoord ();
- self.movedir_y = ReadCoord ();
- self.movedir_z = ReadCoord ();
+ self.movedir_x = ReadAngle ();
+ self.movedir_y = ReadAngle ();
+ self.movedir_z = ReadAngle ();
}
- if (netflags & BASE_TRIGGER_NET_STATE)
- self.state = ReadByte ();
+ if (netflags & NETFLAG_TRIGGER_PUSH_NEWORIGIN)
+ {
+ self.neworigin_x = ReadCoord ();
+ self.neworigin_y = ReadCoord ();
+ self.neworigin_z = ReadCoord ();
+ }
- if (netflags & BASE_TRIGGER_NET_ESTATE)
- self.estate = ReadFloat ();
+ if (netflags & NETFLAG_TRIGGER_PUSH_SPEED)
+ self.speed = ReadShort ();
if (isnew)
if (self.classtype == CT_TRIGGER_PUSH)
@@ -166,12 +215,9 @@ vector(float a, float b, float c) solve_quadratic =
else if (self.classtype == CT_TRIGGER_PUSH_CUSTOM)
trigger_push_custom_init (self);
- // make sure size and origin are set -- CEV
- if (netflags & BASE_TRIGGER_NET_SIZE)
+ // make sure size is set -- CEV
+ if (netflags & NETFLAG_TRIGGER_PUSH_SIZE)
setsize (self, self.mins, self.maxs);
-
- if (netflags & BASE_TRIGGER_NET_ORIGIN)
- setorigin (self, self.origin);
};
#endif
@@ -179,17 +225,21 @@ vector(float a, float b, float c) solve_quadratic =
//--------------------------------------------------------------
float(entity to, float netflags) base_trigger_push_netsend =
{
- WriteShort (MSG_ENTITY, self.classtype);
- WriteFloat (MSG_ENTITY, netflags);
+ WriteByte (MSG_ENTITY, self.classtype);
- if (netflags & BASE_TRIGGER_NET_ORIGIN)
- {
- WriteCoord (MSG_ENTITY, self.origin_x);
- WriteCoord (MSG_ENTITY, self.origin_y);
- WriteCoord (MSG_ENTITY, self.origin_z);
- }
+ // restrict netflags so we can send it in one byte -- CEV
+ if (netflags > NETFLAG_TRIGGER_PUSH_FULLSEND)
+ netflags = NETFLAG_TRIGGER_PUSH_FULLSEND;
- if (netflags & BASE_TRIGGER_NET_SIZE)
+ WriteByte (MSG_ENTITY, netflags);
+
+ if (netflags & NETFLAG_TRIGGER_PUSH_STATE)
+ WriteByte (MSG_ENTITY, self.state);
+
+ if (netflags & NETFLAG_TRIGGER_PUSH_ESTATE)
+ WriteByte (MSG_ENTITY, self.estate);
+
+ if (netflags & NETFLAG_TRIGGER_PUSH_SIZE)
{
WriteCoord (MSG_ENTITY, self.mins_x);
WriteCoord (MSG_ENTITY, self.mins_y);
@@ -199,23 +249,66 @@ vector(float a, float b, float c) solve_quadratic =
WriteCoord (MSG_ENTITY, self.maxs_z);
}
- if (netflags & BASE_TRIGGER_NET_MOVEDIR)
+ if (netflags & NETFLAG_TRIGGER_PUSH_MOVEDIR)
{
- WriteCoord (MSG_ENTITY, self.movedir_x);
- WriteCoord (MSG_ENTITY, self.movedir_y);
- WriteCoord (MSG_ENTITY, self.movedir_z);
+ WriteAngle (MSG_ENTITY, self.movedir_x);
+ WriteAngle (MSG_ENTITY, self.movedir_y);
+ WriteAngle (MSG_ENTITY, self.movedir_z);
}
- if (netflags & BASE_TRIGGER_NET_STATE)
- WriteByte (MSG_ENTITY, self.state);
+ if (netflags & NETFLAG_TRIGGER_PUSH_NEWORIGIN)
+ {
+ WriteCoord (MSG_ENTITY, self.neworigin_x);
+ WriteCoord (MSG_ENTITY, self.neworigin_y);
+ WriteCoord (MSG_ENTITY, self.neworigin_z);
+ }
- if (netflags & BASE_TRIGGER_NET_ESTATE)
- WriteFloat (MSG_ENTITY, self.estate);
+ if (netflags & NETFLAG_TRIGGER_PUSH_SPEED)
+ WriteShort (MSG_ENTITY, self.speed);
return TRUE;
};
//--------------------------------------------------------------
+ void() base_trigger_push_think_findtarget =
+ {
+ // attempt to find the target -- CEV
+ self.enemy = find (world, targetname, self.target);
+ if (self.enemy)
+ {
+ self.neworigin = self.enemy.origin;
+ self.state |= TRIGGER_PUSH_STATE_TARGETED;
+ }
+ else
+ {
+ // force a default if no target was found -- CEV
+ if (!self.movedir)
+ {
+ // TODO CEV is this up? I don't remember
+ self.movedir = '0 0 180';
+ self.speed = 1000;
+ }
+ }
+
+ // make sure SendEntity and SendFlags are set so the client
+ // sees this entity -- CEV
+ self.SendEntity = base_trigger_push_netsend;
+ self.SendFlags = NETFLAG_TRIGGER_PUSH_SIZE |
+ NETFLAG_TRIGGER_PUSH_STATE |
+ NETFLAG_TRIGGER_PUSH_ESTATE |
+ NETFLAG_TRIGGER_PUSH_SPEED;
+ if (self.neworigin)
+ self.SendFlags |= NETFLAG_TRIGGER_PUSH_NEWORIGIN;
+ if (self.movedir)
+ self.SendFlags |= NETFLAG_TRIGGER_PUSH_MOVEDIR;
+
+ // don't (shouldn't) need to call think anymore -- CEV
+ self.think = sub_null;
+ };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+ //--------------------------------------------------------------
// trigger_push_calculatevelocity
//
// Arguments:
@@ -232,16 +325,13 @@ vector(float a, float b, float c) solve_quadratic =
// copied from Nexuiz source code; original can be found here:
// github.com/smlinux/nexuiz/blob/master/data/qcsrc/server/t_jumppads.qc
//--------------------------------------------------------------
- vector(vector org, entity tgt, float ht)
- base_trigger_push_calculatevelocity =
+ vector(vector org, vector torg, float ht) base_trigger_push_calcvel =
{
local float sdist, zdist, vs, vz, jumpheight;
- local vector sdir, torg;
+ local vector sdir;
local vector solution;
local float flighttime;
- torg = tgt.origin + (tgt.mins + tgt.maxs) * 0.5;
-
zdist = torg_z - org_z;
sdist = vlen (torg - org - zdist * '0 0 1');
sdir = normalize (torg - org - zdist * '0 0 1');
@@ -338,25 +428,6 @@ vector(float a, float b, float c) solve_quadratic =
};
//--------------------------------------------------------------
- void() base_trigger_push_findtarget =
- {
- self.enemy = find (world, targetname, self.target);
- if (self.enemy)
- {
- local vector org;
- org = (self.absmin + self.absmax) * 0.5;
- org_z = self.absmax_z - -24; // - PL_MIN_z;
- self.movedir = base_trigger_push_calculatevelocity (
- org, self.enemy, self.height);
- self.state = TRIGGER_PUSH_STATE_TARGETED;
- self.SendFlags |= BASE_TRIGGER_NET_MOVEDIR;
- self.SendFlags |= BASE_TRIGGER_NET_STATE;
- }
- };
-#endif
-
-#if defined(CSQC) || defined(SSQC)
- //--------------------------------------------------------------
void() base_trigger_push_touch =
{
if (self.estate != STATE_ACTIVE)
@@ -366,40 +437,35 @@ vector(float a, float b, float c) solve_quadratic =
if (other.movetype == MOVETYPE_NOCLIP)
return;
- #ifdef SSQC
- // try to find target again if necessary
- if (self.target && (!self.enemy))
- base_trigger_push_findtarget ();
-
- // we have a target, set movedir accordingly
- if (self.target && self.enemy)
- {
- self.movedir = base_trigger_push_calculatevelocity (
- other.origin, self.enemy, self.height);
- self.state = TRIGGER_PUSH_STATE_TARGETED;
- self.SendFlags |= BASE_TRIGGER_NET_MOVEDIR |
- BASE_TRIGGER_NET_STATE;
- }
- #endif
-
if (other.classtype == CT_PROJECTILE_GRENADE)
{
- if (self.state == TRIGGER_PUSH_STATE_TARGETED)
+ if (self.state & TRIGGER_PUSH_STATE_TARGETED)
other.velocity = self.movedir;
else
other.velocity = self.speed * self.movedir * 10;
}
- #if defined(CSQC)
- else if (other.classtype == CT_PLAYER)
- #elif defined(SSQC)
else if (other.health > 0)
- #endif
{
- if (self.state == TRIGGER_PUSH_STATE_TARGETED)
- other.velocity = self.movedir;
+ if (self.state & TRIGGER_PUSH_STATE_TARGETED)
+ // jumppad style
+ other.velocity = base_trigger_push_calcvel (
+ other.origin, self.neworigin,
+ self.height);
+ else if (self.state & TRIGGER_PUSH_STATE_ADDITIVE)
+ // MG1 additive push
+ other.velocity = other.velocity + self.speed *
+ self.movedir * 10 * frametime;
else
+ // regular
other.velocity = self.speed * self.movedir * 10;
+ #if 0
+ dprint (sprintf("base_trigger_push_touch: "
+ "moving player... self movedir %v, "
+ "self speed %g, other vel %v\n",
+ self.movedir, self.speed, other.velocity));
+ #endif
+
if (other.classtype == CT_PLAYER)
{
// signal pmove that player has touched a
@@ -409,11 +475,12 @@ vector(float a, float b, float c) solve_quadratic =
#ifdef SSQC
// carry on with normal push sound behavior
- if (!(self.spawnflags & TRIGGER_PUSH_SILENT) &&
+ if (!(self.spawnflags &
+ SPAWNFLAG_TRIGGER_PUSH_SILENT) &&
other.fly_sound < time)
{
if (!(self.spawnflags &
- TRIGGER_PUSH_NOISE))
+ SPAWNFLAG_TRIGGER_PUSH_NOISE))
{
other.fly_sound = time + 1.5;
sound (other, CHAN_AUTO,
@@ -433,14 +500,33 @@ vector(float a, float b, float c) solve_quadratic =
}
#ifdef SSQC
- if (self.spawnflags & TRIGGER_PUSH_ONCE)
+ if (self.spawnflags & SPAWNFLAG_TRIGGER_PUSH_ONCE)
remove (self);
#endif
};
#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ void(string key, string value) base_trigger_push_init_field =
+ {
+ #if 0
+ if (cvar("developer"))
+ dprint (sprintf("base_trigger_push_init_field: "
+ "key %s, value %s\n", key, value));
+ #endif
+
+ switch (key)
+ {
+ case "height":
+ self.height = stof (value);
+ break;
+ }
+ };
+#endif
// };
-/*QUAKED trigger_push (.5 .5 .5) ? TRIGGER_PUSH_ONCE X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+/*QUAKED trigger_push (.5 .5 .5) ? TRIGGER_PUSH_ONCE TRIGGER_PUSH_ADDITIVE TRIGGER_PUSH_MGSTARTOFF TRIGGER_PUSH_STARTOFF TRIGGER_PUSH_SILENT TRIGGER_PUSH_NOISE X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Pushes the player
*/
//----------------------------------------------------------------------
@@ -469,29 +555,41 @@ Pushes the player
#ifdef SSQC
precache_sound ("ambience/windfly.wav");
- if (!e.speed)
- e.speed = 1000;
+ // TODO CEV should probably test this
+ if (e.spawnflags & SPAWNFLAG_TRIGGER_PUSH_STARTOFF ||
+ e.spawnflags & SPAWNFLAG_TRIGGER_PUSH_MGSTARTOFF)
+ {
+ e.estate = STATE_INACTIVE;
+ }
+
+ if (e.spawnflags & SPAWNFLAG_TRIGGER_PUSH_ADDITIVE)
+ self.state |= TRIGGER_PUSH_STATE_ADDITIVE;
+
+ if (e.noise != "")
+ precache_sound (e.noise);
if (e.target != __NULL__ && e.target != "")
{
- // attempt to find the target
- base_trigger_push_findtarget ();
- if (!e.enemy)
- if (!e.movedir)
- // TODO CEV is this up? I don't remember
- e.movedir = '0 0 180';
+ // schedule a think to find target -- CEV
+ e.think = base_trigger_push_think_findtarget;
+ e.nextthink = time + 0.2 + (random() * 0.25);
+ }
+ else
+ {
+ if (!e.speed)
+ e.speed = 1000;
+
+ e.SendEntity = base_trigger_push_netsend;
+ e.SendFlags = NETFLAG_TRIGGER_PUSH_SIZE |
+ NETFLAG_TRIGGER_PUSH_STATE |
+ NETFLAG_TRIGGER_PUSH_ESTATE |
+ NETFLAG_TRIGGER_PUSH_SPEED;
+ // don't need to send NEWORIGIN -- CEV
+ if (e.movedir)
+ e.SendFlags |= NETFLAG_TRIGGER_PUSH_MOVEDIR;
}
sub_checkwaiting (e);
-
- e.SendEntity = base_trigger_push_netsend;
- e.SendFlags |= BASE_TRIGGER_NET_ORIGIN |
- BASE_TRIGGER_NET_SIZE |
- BASE_TRIGGER_NET_STATE |
- BASE_TRIGGER_NET_ESTATE |
- BASE_TRIGGER_NET_SPEED;
- if (e.movedir)
- e.SendFlags |= BASE_TRIGGER_NET_MOVEDIR;
#endif
};
#endif
@@ -500,6 +598,9 @@ Pushes the player
//--------------------------------------------------------------
void() trigger_push =
{
+ // read unprocessed fields as present in the map file -- CEV
+ base_mapentity_init_spawndata (base_trigger_push_init_field);
+
// new spawnflags for all entities -- iw
if (SUB_Inhibit())
return;
@@ -558,35 +659,40 @@ Adapted from Hipnotic's func_togglewall
#ifdef SSQC
precache_sound ("ambience/windfly.wav");
- if (e.spawnflags & TRIGGER_PUSH_STARTOFF)
+ if (e.spawnflags & SPAWNFLAG_TRIGGER_PUSH_STARTOFF ||
+ e.spawnflags & SPAWNFLAG_TRIGGER_PUSH_MGSTARTOFF)
+ {
e.estate = STATE_INACTIVE;
+ }
+
+ if (e.spawnflags & SPAWNFLAG_TRIGGER_PUSH_ADDITIVE)
+ self.state |= TRIGGER_PUSH_STATE_ADDITIVE;
if (e.noise != "")
precache_sound (e.noise);
- if (!e.speed)
- e.speed = 1000;
-
if (e.target != __NULL__ && e.target != "")
{
- // attempt to find the target
- base_trigger_push_findtarget ();
- if (!e.enemy)
- if (!e.movedir)
- // TODO CEV is this up? I don't remember
- e.movedir = '0 0 180';
+ // schedule a think to find target -- CEV
+ e.think = base_trigger_push_think_findtarget;
+ e.nextthink = time + 0.2 + (random() * 0.25);
+ }
+ else
+ {
+ if (!e.speed)
+ e.speed = 1000;
+
+ e.SendEntity = base_trigger_push_netsend;
+ e.SendFlags = NETFLAG_TRIGGER_PUSH_SIZE |
+ NETFLAG_TRIGGER_PUSH_STATE |
+ NETFLAG_TRIGGER_PUSH_ESTATE |
+ NETFLAG_TRIGGER_PUSH_SPEED;
+ // don't need to send NEWORIGIN -- CEV
+ if (e.movedir)
+ e.SendFlags |= NETFLAG_TRIGGER_PUSH_MOVEDIR;
}
sub_checkwaiting (e);
-
- e.SendEntity = base_trigger_push_netsend;
- e.SendFlags |= BASE_TRIGGER_NET_ORIGIN |
- BASE_TRIGGER_NET_SIZE |
- BASE_TRIGGER_NET_STATE |
- BASE_TRIGGER_NET_ESTATE |
- BASE_TRIGGER_NET_SPEED;
- if (e.movedir)
- e.SendFlags |= BASE_TRIGGER_NET_MOVEDIR;
#endif
};
#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/triggers/setcount.qc
diff --git a/qc/triggers/setcount.qc b/qc/triggers/setcount.qc
index 9500d35..4172f32 100644
--- a/qc/triggers/setcount.qc
+++ b/qc/triggers/setcount.qc
@@ -2,6 +2,8 @@
// target_setcount
//==============================================================================
+/** TODO CEV figure out what this is doing **/
+
//======================================================================
// forward declarations
//======================================================================
Return to the top of this page or return to the overview of this repo.
Diff qc/triggers/setgravity.qc
diff --git a/qc/triggers/setgravity.qc b/qc/triggers/setgravity.qc
index 86febc0..1253bc2 100644
--- a/qc/triggers/setgravity.qc
+++ b/qc/triggers/setgravity.qc
@@ -14,11 +14,40 @@
// constants
//======================================================================
-#if defined(CSQC) || defined(SSQC)
-const float TRIGGER_SETGRAVITY_STARTOFF = 8; // trigger will start off
+#ifdef SSQC
+//----------------------------------------------------------------------
+// trigger_setgravity spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_TRIGGER_SETGRAVITY_STARTOFF = 8 // trigger will start off
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} trigger_setgravity_spawnflags;
+#endif
-// trigger net constants start at 1<<4
-const float TRIGGER_SETGRAVITY_NET_GRAVITY = 1<<6; // .gravity has changed
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+// trigger_setgravity netflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ NETFLAG_TRIGGER_SETGRAVITY_STATE = NETFLAG_BASE_TRIGGER_STATE,
+ NETFLAG_TRIGGER_SETGRAVITY_ESTATE = NETFLAG_BASE_TRIGGER_ESTATE,
+ NETFLAG_TRIGGER_SETGRAVITY_SIZE,
+ NETFLAG_TRIGGER_SETGRAVITY_GRAVITY
+} trigger_setgravity_netflags;
+
+const float NETFLAG_TRIGGER_SETGRAVITY_FULLSEND =
+ NETFLAG_TRIGGER_SETGRAVITY_STATE | NETFLAG_TRIGGER_SETGRAVITY_ESTATE |
+ NETFLAG_TRIGGER_SETGRAVITY_SIZE | NETFLAG_TRIGGER_SETGRAVITY_GRAVITY;
#endif
//======================================================================
@@ -77,16 +106,15 @@ set the gravity of a player
//--------------------------------------------------------------
void(float isnew) trigger_setgravity_netreceive =
{
- local float netflags = ReadFloat ();
+ local float netflags = ReadByte ();
- if (netflags & BASE_TRIGGER_NET_ORIGIN)
- {
- self.origin_x = ReadCoord ();
- self.origin_y = ReadCoord ();
- self.origin_z = ReadCoord ();
- }
+ if (netflags & NETFLAG_TRIGGER_SETGRAVITY_STATE)
+ self.state = ReadByte ();
+
+ if (netflags & NETFLAG_TRIGGER_SETGRAVITY_ESTATE)
+ self.estate = ReadByte ();
- if (netflags & BASE_TRIGGER_NET_SIZE)
+ if (netflags & NETFLAG_TRIGGER_SETGRAVITY_SIZE)
{
self.mins_x = ReadCoord ();
self.mins_y = ReadCoord ();
@@ -96,14 +124,14 @@ set the gravity of a player
self.maxs_z = ReadCoord ();
}
- if (netflags & TRIGGER_SETGRAVITY_NET_GRAVITY)
- self.gravity = ReadFloat ();
-
- if (netflags & BASE_TRIGGER_NET_ESTATE)
- self.estate = ReadFloat ();
+ if (netflags & NETFLAG_TRIGGER_SETGRAVITY_GRAVITY)
+ self.gravity = ReadShort ();
if (isnew)
trigger_setgravity_init (self);
+
+ if (netflags & NETFLAG_TRIGGER_SETGRAVITY_SIZE)
+ setsize (self, self.mins, self.maxs);
};
#endif
@@ -111,17 +139,20 @@ set the gravity of a player
//--------------------------------------------------------------
float(entity to, float netflags) trigger_setgravity_netsend =
{
- WriteShort (MSG_ENTITY, self.classtype);
- WriteFloat (MSG_ENTITY, netflags);
+ WriteByte (MSG_ENTITY, self.classtype);
- if (netflags & BASE_TRIGGER_NET_ORIGIN)
- {
- WriteCoord (MSG_ENTITY, self.origin_x);
- WriteCoord (MSG_ENTITY, self.origin_y);
- WriteCoord (MSG_ENTITY, self.origin_z);
- }
+ if (netflags > NETFLAG_TRIGGER_SETGRAVITY_FULLSEND)
+ netflags = NETFLAG_TRIGGER_SETGRAVITY_FULLSEND;
+
+ WriteByte (MSG_ENTITY, netflags);
- if (netflags & BASE_TRIGGER_NET_SIZE)
+ if (netflags & NETFLAG_TRIGGER_SETGRAVITY_STATE)
+ WriteByte (MSG_ENTITY, self.state);
+
+ if (netflags & NETFLAG_TRIGGER_SETGRAVITY_ESTATE)
+ WriteByte (MSG_ENTITY, self.estate);
+
+ if (netflags & NETFLAG_TRIGGER_SETGRAVITY_SIZE)
{
WriteCoord (MSG_ENTITY, self.mins_x);
WriteCoord (MSG_ENTITY, self.mins_y);
@@ -131,11 +162,8 @@ set the gravity of a player
WriteCoord (MSG_ENTITY, self.maxs_z);
}
- if (netflags & TRIGGER_SETGRAVITY_NET_GRAVITY)
- WriteFloat (MSG_ENTITY, self.gravity);
-
- if (netflags & BASE_TRIGGER_NET_ESTATE)
- WriteFloat (MSG_ENTITY, self.estate);
+ if (netflags & NETFLAG_TRIGGER_SETGRAVITY_GRAVITY)
+ WriteShort (MSG_ENTITY, self.gravity);
return TRUE;
};
@@ -147,12 +175,6 @@ set the gravity of a player
//--------------------------------------------------------------
void() trigger_setgravity_touch =
{
- // from Copper -- dumptruck_ds
- /*
- if (sub_checkvalidtouch(other) == FALSE)
- return;
- */
-
// This is commented out so that the changing gravity will
// affect everything, if you don't want to use all affecting
// gravity changes, then uncomment these two lines.
@@ -190,7 +212,7 @@ set the gravity of a player
else
self.estate = STATE_INACTIVE;
- self.SendFlags |= BASE_TRIGGER_NET_ESTATE;
+ self.SendFlags |= NETFLAG_TRIGGER_SETGRAVITY_ESTATE;
};
#endif
@@ -213,7 +235,7 @@ set the gravity of a player
e.use = trigger_setgravity_use;
// dumptruck_ds
- if (e.spawnflags & TRIGGER_SETGRAVITY_STARTOFF)
+ if (e.spawnflags & SPAWNFLAG_TRIGGER_SETGRAVITY_STARTOFF)
e.estate = STATE_INACTIVE;
if (!e.gravity)
@@ -224,10 +246,7 @@ set the gravity of a player
sub_checkwaiting (e);
e.SendEntity = trigger_setgravity_netsend;
- e.SendFlags = e.SendFlags | BASE_TRIGGER_NET_ORIGIN |
- BASE_TRIGGER_NET_SIZE |
- TRIGGER_SETGRAVITY_NET_GRAVITY |
- BASE_TRIGGER_NET_ESTATE;
+ e.SendFlags = NETFLAG_TRIGGER_SETGRAVITY_FULLSEND;
#endif
};
#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/triggers/setstate.qc
diff --git a/qc/triggers/setstate.qc b/qc/triggers/setstate.qc
index ef8aeec..0f2d94b 100644
--- a/qc/triggers/setstate.qc
+++ b/qc/triggers/setstate.qc
@@ -7,9 +7,24 @@
//======================================================================
#ifdef SSQC
-const float SETSTATE_STARTOFF = 1;
-const float SETSTATE_CLOSEALLDOORS = 2;
-const float SETSTATE_DONTRESETBUTTON = 4;
+//----------------------------------------------------------------------
+// target_setstate spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_TARGET_SETSTATE_STARTOFF = 1,
+ SPAWNFLAG_TARGET_SETSTATE_CLOSEALLDOORS = 2,
+ SPAWNFLAG_TARGET_SETSTATE_DONTRESETBTN = 4
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} target_setstate_spawnflags;
#endif
//======================================================================
@@ -54,14 +69,14 @@ void() target_setstate;
if (e.classtype == CT_FUNC_BUTTON)
{
if (state == STATE_ACTIVE)
- func_button_unlock (e,
- flags & SETSTATE_DONTRESETBUTTON);
+ func_button_unlock (e, flags &
+ SPAWNFLAG_TARGET_SETSTATE_DONTRESETBTN);
else
func_button_lock (e);
}
else if (e.classtype == CT_FUNC_DOOR)
{
- if (flags & SETSTATE_CLOSEALLDOORS)
+ if (flags & SPAWNFLAG_TARGET_SETSTATE_CLOSEALLDOORS)
closealldoors = 1;
if (state == STATE_ACTIVE)
@@ -187,7 +202,7 @@ void() target_setstate;
//--------------------------------------------------------------
void() target_setstate_think_startoff =
{
- if (self.spawnflags & SETSTATE_STARTOFF)
+ if (self.spawnflags & SPAWNFLAG_TARGET_SETSTATE_STARTOFF)
target_setstate_setalltargets (STATE_INACTIVE);
};
@@ -200,7 +215,7 @@ void() target_setstate;
base_mapentity_init (e);
- if (e.spawnflags & SETSTATE_STARTOFF)
+ if (e.spawnflags & SPAWNFLAG_TARGET_SETSTATE_STARTOFF)
{
// wait a bit while doors finish being set up
e.think = target_setstate_think_startoff;
Return to the top of this page or return to the overview of this repo.
Diff qc/triggers/shake.qc
diff --git a/qc/triggers/shake.qc b/qc/triggers/shake.qc
index 7794fb4..b2788a0 100644
--- a/qc/triggers/shake.qc
+++ b/qc/triggers/shake.qc
@@ -1,5 +1,6 @@
//==============================================================================
// trigger_shake -- point entity from Rubicon Rumble Pack; requires TARGETNAME
+// trigger_screenshake - entity from MG1
//==============================================================================
//======================================================================
@@ -7,7 +8,41 @@
//======================================================================
#ifdef SSQC
-const float TRIGGER_SHAKE_VIEWONLY = 1;
+//----------------------------------------------------------------------
+// RRP trigger_shake spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_TRIGGER_SHAKE_VIEWONLY = 1
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} trigger_shake_spawnflags;
+#endif
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// MG1 trigger_screenshake spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_TRIGGER_SCREENSHAKE_SILENT = 1
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} trigger_screenshake_spawnflags;
#endif
//======================================================================
@@ -22,6 +57,14 @@ void(entity e) trigger_shake_init;
void() trigger_shake;
#endif
+#ifdef SSQC
+// trigger_screenshake
+void() trigger_screenshake_think;
+void() trigger_screenshake_use;
+void(entity e) trigger_screenshake_init;
+void() trigger_screenshake;
+#endif
+
//------------------------------------------------------------------------------
#ifdef SSQC
@@ -46,6 +89,9 @@ TRIGGER_SHAKE_VIEWONLY Shakes the view, but player movement is not affected
//--------------------------------------------------------------
void() trigger_shake_think =
{
+ if (intermission)
+ return;
+
if (self.attack_finished < time)
{
// Done
@@ -64,36 +110,40 @@ TRIGGER_SHAKE_VIEWONLY Shakes the view, but player movement is not affected
while (p)
{
- if (p.flags & FL_CLIENT)
+ if (!(p.flags & FL_CLIENT))
{
- local float d;
+ p = p.chain;
+ continue;
+ }
+
+ local float d;
- // Scale effect by distance
- d = vlen (self.origin - p.origin);
- d = (self.count - d) / self.count;
+ // Scale effect by distance
+ d = vlen (self.origin - p.origin);
+ d = (self.count - d) / self.count;
- if (d > 0)
+ if (d > 0)
+ {
+ // shake up the view
+ p.punchangle_x = -1 * (random() +
+ (0.025 * self.dmg * d));
+ if (p.SendEntity)
+ p.SendFlags|=NETFLAG_PLAYER_PUNCHANGLE;
+
+ // push the player around
+ if (p.flags & FL_ONGROUND) {
+ if (!(self.spawnflags &
+ SPAWNFLAG_TRIGGER_SHAKE_VIEWONLY))
{
- // shake up the view
- p.punchangle_x = -1 * (random() +
- (0.025 * self.dmg * d));
- p.SendFlags |= PLAYER_NET_PUNCHANGLE;
-
- // push the player around
- if (p.flags & FL_ONGROUND
- && !(self.spawnflags &
- TRIGGER_SHAKE_VIEWONLY))
- {
- d = self.dmg * d;
- p.velocity_x = p.velocity_x +
- (random() * d * 2 - d);
- p.velocity_y = p.velocity_y +
- (random() * d * 2 - d);
- // always push up
- p.velocity_z = p.velocity_z +
- (random() * d);
- }
- }
+ d = self.dmg * d;
+ p.velocity_x = p.velocity_x +
+ (random() * d * 2 - d);
+ p.velocity_y = p.velocity_y +
+ (random() * d * 2 - d);
+ // always push up
+ p.velocity_z = p.velocity_z +
+ (random() * d);
+ } }
}
p = p.chain;
}
@@ -158,3 +208,132 @@ TRIGGER_SHAKE_VIEWONLY Shakes the view, but player movement is not affected
};
// };
#endif
+
+#ifdef SSQC
+/*QUAKED trigger_screenshake
+
+wait is duration of the shake
+dmg is the intensity of the shake
+*/
+//----------------------------------------------------------------------
+// class trigger_screenshake: base_trigger
+// {
+ //--------------------------------------------------------------
+ // T_Shake from MG1. Similar to trigger_shake_think above but
+ // has slightly different logic. -- CEV
+ //--------------------------------------------------------------
+ void() trigger_screenshake_think =
+ {
+ local entity t;
+ local float starttime;
+ local float hit;
+
+ starttime = self.attack_finished - self.wait;
+
+ // early out if intermission is running
+ if (intermission)
+ return;
+
+ // Completed, cleanup!
+ if (time > self.attack_finished)
+ {
+ if (!(self.spawnflags &
+ SPAWNFLAG_TRIGGER_SCREENSHAKE_SILENT))
+ {
+ sound (self, CHAN_VOICE, self.noise1,
+ 1, ATTN_NORM);
+ }
+
+ t = findfloat (world, classtype, CT_PLAYER);
+ while (t)
+ {
+ t.v_angle_z = 0;
+ t = findfloat (t, classtype, CT_PLAYER);
+ }
+ return;
+ }
+
+ // Ramp up?
+ if (time < self.delay)
+ hit = (time - starttime) / (self.wait / 3);
+ else
+ hit = 1;
+
+ // dprint ("intensity: ");
+ // dprint (ftos(hit));
+ // dprint ("\n");
+
+ hit = self.dmg * hit;
+
+ // for each player
+ t = findfloat (world, classtype, CT_PLAYER);
+ while (t)
+ {
+ // do the shake!
+ t.punchangle_x = random() * hit;
+ t.punchangle_y = crandom() * hit;
+ t.punchangle_z = random() * hit;
+ if (t.SendEntity)
+ t.SendFlags |= NETFLAG_PLAYER_PUNCHANGLE;
+
+ t = findfloat (t, classtype, CT_PLAYER);
+ }
+
+ self.nextthink = time + 0.05;
+ };
+
+ //--------------------------------------------------------------
+ void() trigger_screenshake_use =
+ {
+ // when to end
+ self.attack_finished = time + self.wait;
+ // how long to ramp up
+ self.delay = time + (self.wait / 3);
+
+ if (!(self.spawnflags & SPAWNFLAG_TRIGGER_SCREENSHAKE_SILENT))
+ sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
+
+ self.think = trigger_screenshake_think;
+ self.nextthink = time + 0.05;
+ };
+
+ //--------------------------------------------------------------
+ void(entity e) trigger_screenshake_init =
+ {
+ e.classname = "trigger_screenshake";
+ e.classtype = CT_TRIGGER_SCREENSHAKE;
+
+ base_trigger_init (e);
+
+ // wait is sustain time
+ // dmg is intensity
+ if (!(e.spawnflags & SPAWNFLAG_TRIGGER_SCREENSHAKE_SILENT))
+ {
+ e.noise = "misc/quake.wav";
+ e.noise1 = "misc/quakeend.wav";
+ precache_sound (e.noise);
+ precache_sound (e.noise1);
+ }
+
+ if (!e.wait)
+ // no duration!
+ e.wait = 2;
+
+ if (!e.dmg)
+ // no intensity!
+ e.dmg = 3;
+
+ e.use = trigger_screenshake_use;
+ };
+
+ //--------------------------------------------------------------
+ void() trigger_screenshake =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ trigger_screenshake_init (self);
+ };
+// };
+#endif
Return to the top of this page or return to the overview of this repo.
Diff qc/triggers/take_weapon.qc
diff --git a/qc/triggers/take_weapon.qc b/qc/triggers/take_weapon.qc
index 9f6656b..0a6dad4 100644
--- a/qc/triggers/take_weapon.qc
+++ b/qc/triggers/take_weapon.qc
@@ -41,16 +41,40 @@ Removes shotgun upon touch. You can also set "reset_items" in the worldspawn ent
return;
base_multiple_fire ();
- other.items &= ~IT_SHOTGUN;
+
+ // TODO CEV currently only subtracts the SHOTGUN
+ if (other.inventory1 == ITEM_SEQ_SHOTGUN)
+ other.inventory1 = ITEM_SEQ_HANDS;
+ if (other.inventory2 == ITEM_SEQ_SHOTGUN)
+ other.inventory2 = ITEM_SEQ_HANDS;
+ if (other.inventory3 == ITEM_SEQ_SHOTGUN)
+ other.inventory3 = ITEM_SEQ_HANDS;
+ if (other.inventory4 == ITEM_SEQ_SHOTGUN)
+ other.inventory4 = ITEM_SEQ_HANDS;
+ if (other.inventory5 == ITEM_SEQ_SHOTGUN)
+ other.inventory5 = ITEM_SEQ_HANDS;
+ if (other.inventory6 == ITEM_SEQ_SHOTGUN)
+ other.inventory6 = ITEM_SEQ_HANDS;
+ if (other.inventory7 == ITEM_SEQ_SHOTGUN)
+ other.inventory7 = ITEM_SEQ_HANDS;
+ if (other.inventory8 == ITEM_SEQ_SHOTGUN)
+ other.inventory8 = ITEM_SEQ_HANDS;
+
+ // TODO CEV
+ /*
other.currentammo = !other.ammo_shells;
other.ammo_shells = !other.ammo_shells;
other.items = other.items - (other.items & IT_SHELLS);
+ */
+ // TODO CEV
+ /*
if (other.classtype == CT_PLAYER)
{
sub_runfloatas (other, player_best_weapon);
sub_runvoidas (other, player_set_current_ammo);
}
+ */
};
//--------------------------------------------------------------
Return to the top of this page or return to the overview of this repo.
Diff qc/triggers/teleport.qc
diff --git a/qc/triggers/teleport.qc b/qc/triggers/teleport.qc
index dbd816b..5402db9 100644
--- a/qc/triggers/teleport.qc
+++ b/qc/triggers/teleport.qc
@@ -3,17 +3,52 @@
// -- dumptruck_ds
//==============================================================================
+// TODO CEV: redo the use of self.state as spawnflags for CSQC touch checks
+
//======================================================================
// constants
//======================================================================
-#ifdef SSQC
-const float TRIGGER_TELEPORT_ONLYPLAYER = 1;
-const float TRIGGER_TELEPORT_SILENT = 2;
-const float TRIGGER_TELEPORT_RANDOM = 4;
-const float TRIGGER_TELEPORT_STEALTH = 8;
-const float TRIGGER_TELEPORT_ONLYMONSTER = 16;
-const float TRIGGER_TELEPORT_DD = 32;
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+// trigger_teleport spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_TRIGGER_TELEPORT_ONLYPLAYER = 1,
+ SPAWNFLAG_TRIGGER_TELEPORT_SILENT = 2,
+ SPAWNFLAG_TRIGGER_TELEPORT_RANDOM = 4,
+ SPAWNFLAG_TRIGGER_TELEPORT_STEALTH = 8,
+ SPAWNFLAG_TRIGGER_TELEPORT_ONLYMONSTER = 16,
+ SPAWNFLAG_TRIGGER_TELEPORT_DD = 32 // "different destination" -- 80s
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} trigger_teleport_spawnflags;
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+// trigger_teleport netflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ NETFLAG_TRIGGER_TELEPORT_STATE = NETFLAG_BASE_TRIGGER_STATE,
+ NETFLAG_TRIGGER_TELEPORT_ESTATE = NETFLAG_BASE_TRIGGER_ESTATE,
+ NETFLAG_TRIGGER_TELEPORT_SIZE,
+ NETFLAG_TRIGGER_TELEPORT_ANGLES,
+ NETFLAG_TRIGGER_TELEPORT_NEWORIGIN
+} trigger_teleport_netflags;
+
+const float NETFLAG_TRIGGER_TELEPORT_FULLSEND = NETFLAG_TRIGGER_TELEPORT_SIZE |
+ NETFLAG_TRIGGER_TELEPORT_ANGLES | NETFLAG_TRIGGER_TELEPORT_STATE |
+ NETFLAG_TRIGGER_TELEPORT_ESTATE | NETFLAG_TRIGGER_TELEPORT_NEWORIGIN;
#endif
//======================================================================
@@ -28,12 +63,22 @@ void() spawn_tdeath_touch;
void(vector org, entity death_owner) spawn_tdeath;
#endif
-#ifdef SSQC
// trigger_teleport
+#ifdef CSQC
+void(float isnew) trigger_teleport_netreceive;
+void() trigger_teleport_think_particle;
+#endif
+#ifdef SSQC
+float(entity to, float netflags) trigger_teleport_netsend;
entity() trigger_teleport_randomspot;
-void() trigger_teleport_touch;
+void() trigger_teleport_think_findtarget;
void() trigger_teleport_use;
+#endif
+#if defined(CSQC) || defined(SSQC)
+void() trigger_teleport_touch;
void(entity e) trigger_teleport_init;
+#endif
+#ifdef SSQC
void() trigger_teleport;
#endif
@@ -179,8 +224,7 @@ void(vector org, entity death_owner) spawn_tdeath =
// trigger_teleport
//======================================================================
-#ifdef SSQC
-/*QUAKED trigger_teleport (.5 .5 .5) ? TRIGGER_TELEPORT_ONLYPLAYER TRIGGER_TELEPORT_SILENT TRIGGER_TELEPORT_RANDOM TRIGGER_TELEPORT_STEALTH X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+/*QUAKED trigger_teleport (.5 .5 .5) ? ONLYPLAYER SILENT RANDOM STEALTH ONLYMONSTER X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Any object touching this will be transported to the corresponding
info_teleport_destination entity. You must set the "target" field,
@@ -189,22 +233,137 @@ and create an object with a "targetname" field that matches.
If the trigger_teleport has a targetname, it will only teleport entities
when it has been fired.
-TRIGGER_TELEPORT_SILENT(2) eliminates the teleporter ambient noise (good
+SILENT(2) eliminates the teleporter ambient noise (good
for hidden monster teleporters.
-TRIGGER_TELEPORT_RANDOM(4) causes the teleporter to send the player to a
+RANDOM(4) causes the teleporter to send the player to a
random destination among the info_teleport_random markers in the level.
You MUST place a "count" field that is the number of info_teleport_random
entities you placed.
-TRIGGER_TELEPORT_STEALTH(8) eliminates the particle flash and noise when
+STEALTH(8) eliminates the particle flash and noise when
an entity is teleported.
-TRIGGER_TELEPORT_ONLYMONSTER(16) will only teleport monsters
+ONLYMONSTER(16) will only teleport monsters
*/
//----------------------------------------------------------------------
// class trigger_teleport: base_trigger
// {
+#ifdef CSQC
+ //--------------------------------------------------------------
+ void(float isnew) trigger_teleport_netreceive =
+ {
+ local float netflags = ReadByte ();
+
+ if (netflags & NETFLAG_TRIGGER_TELEPORT_STATE)
+ // TODO CEV fix use of state as spawnflags
+ self.state = ReadFloat ();
+
+ if (netflags & NETFLAG_TRIGGER_TELEPORT_ESTATE)
+ self.estate = ReadByte ();
+
+ if (netflags & NETFLAG_TRIGGER_TELEPORT_SIZE)
+ {
+ self.mins_x = ReadCoord ();
+ self.mins_y = ReadCoord ();
+ self.mins_z = ReadCoord ();
+ self.maxs_x = ReadCoord ();
+ self.maxs_y = ReadCoord ();
+ self.maxs_z = ReadCoord ();
+ }
+
+ if (netflags & NETFLAG_TRIGGER_TELEPORT_ANGLES)
+ {
+ self.mangle_x = ReadAngle ();
+ self.mangle_y = ReadAngle ();
+ self.mangle_z = ReadAngle ();
+ }
+
+ if (netflags & NETFLAG_TRIGGER_TELEPORT_NEWORIGIN)
+ {
+ self.neworigin_x = ReadCoord ();
+ self.neworigin_y = ReadCoord ();
+ self.neworigin_z = ReadCoord ();
+ }
+
+ if (isnew)
+ trigger_teleport_init (self);
+
+ // make sure size is set -- CEV
+ if (netflags & NETFLAG_TRIGGER_TELEPORT_SIZE)
+ setsize (self, self.mins, self.maxs);
+ };
+
+ //--------------------------------------------------------------
+ // clientside teleporter particles based on particle_tele from
+ // MachineGames misc_fx.qc -- CEV
+ //--------------------------------------------------------------
+ void() trigger_teleport_think_particle =
+ {
+ // where to spawn
+ local vector pos;
+ // scalar from org, used for speed too
+ local float dist = 64;
+ local vector rando;
+
+ rando_x = crandom() * 10;
+ rando_y = crandom() * 10;
+ rando_z = crandom() * 5;
+ rando = normalize (rando);
+
+ pos = ((self.absmin + self.absmax) * 0.5) + (rando * dist);
+
+ // spawn particle
+ particle (pos, rando * dist * -.125, 3, 3);
+ self.nextthink = time + 0.1 * random();
+ };
+#endif
+
+#ifdef SSQC
+ //--------------------------------------------------------------
+ float(entity to, float netflags) trigger_teleport_netsend =
+ {
+ WriteByte (MSG_ENTITY, self.classtype);
+
+ if (netflags > 255)
+ netflags = NETFLAG_TRIGGER_TELEPORT_FULLSEND;
+
+ WriteByte (MSG_ENTITY, netflags);
+
+ if (netflags & NETFLAG_TRIGGER_TELEPORT_STATE)
+ // TODO CEV fix use of state as spawnflags
+ WriteFloat (MSG_ENTITY, self.state);
+
+ if (netflags & NETFLAG_TRIGGER_TELEPORT_ESTATE)
+ WriteByte (MSG_ENTITY, self.estate);
+
+ if (netflags & NETFLAG_TRIGGER_TELEPORT_SIZE)
+ {
+ WriteCoord (MSG_ENTITY, self.mins_x);
+ WriteCoord (MSG_ENTITY, self.mins_y);
+ WriteCoord (MSG_ENTITY, self.mins_z);
+ WriteCoord (MSG_ENTITY, self.maxs_x);
+ WriteCoord (MSG_ENTITY, self.maxs_y);
+ WriteCoord (MSG_ENTITY, self.maxs_z);
+ }
+
+ if (netflags & NETFLAG_TRIGGER_TELEPORT_ANGLES)
+ {
+ WriteAngle (MSG_ENTITY, self.mangle_x);
+ WriteAngle (MSG_ENTITY, self.mangle_y);
+ WriteAngle (MSG_ENTITY, self.mangle_z);
+ }
+
+ if (netflags & NETFLAG_TRIGGER_TELEPORT_NEWORIGIN)
+ {
+ WriteCoord (MSG_ENTITY, self.neworigin_x);
+ WriteCoord (MSG_ENTITY, self.neworigin_y);
+ WriteCoord (MSG_ENTITY, self.neworigin_z);
+ }
+
+ return TRUE;
+ };
+
//--------------------------------------------------------------
// trigger_teleport_randomspot -- more Zerstrorer -- dumptruck_ds
// teleport_randomspot - returns a random spot to teleport to
@@ -243,28 +402,116 @@ TRIGGER_TELEPORT_ONLYMONSTER(16) will only teleport monsters
// end dumptruck_ds
//--------------------------------------------------------------
- void() trigger_teleport_touch =
+ void() trigger_teleport_think_findtarget =
{
local entity t;
+ local string tname;
+
+ if (self.spawnflags & SPAWNFLAG_TRIGGER_TELEPORT_DD)
+ tname = self.noise;
+ else
+ tname = self.target;
+
+ if (self.wait >= 2.0)
+ {
+ objerror (sprintf("trigger_teleport_think_findtarget: "
+ "giving up searching for target! tname %s\n",
+ tname));
+ self.think = sub_remove;
+ self.nextthink = time + 0.1;
+ return;
+ }
+
+ t = find (world, targetname, tname);
+
+ // if we didn't find a target then schedule a think for 0.5
+ // seconds from now and try again -- CEV
+ if (!t)
+ {
+ dprint (sprintf("trigger_teleport_think_findtarget: "
+ "couldn't find target; tname %s, wait %g\n",
+ tname, self.wait));
+ self.wait += 0.5;
+ self.nextthink = time + self.wait;
+ return;
+ }
+
+ // if we found a teleporttrain then *never* set a neworigin,
+ // instead look for the target on teleport_touch -- CEV
+ if (t.classtype == CT_MISC_TELEPORTTRAIN)
+ {
+ dprint (sprintf("trigger_teleport_think_findtarget: "
+ "returning early, found teleporttrain; tname "
+ "%s\n", tname));
+ self.nextthink = -1;
+ self.think = sub_null;
+ return;
+ }
+
+ if (self.wait)
+ self.wait = 0;
+
+ self.enemy = t;
+ self.mangle = t.mangle;
+ self.neworigin = t.origin;
+
+ self.SendEntity = trigger_teleport_netsend;
+ self.SendFlags = NETFLAG_TRIGGER_TELEPORT_FULLSEND;
+
+ // don't (shouldn't) need to call think anymore -- CEV
+ self.nextthink = -1;
+ self.think = sub_null;
+ };
+
+ //--------------------------------------------------------------
+ void() trigger_teleport_use =
+ {
+ // TODO CEV
+ self.nextthink = time + 0.2;
+ self.estate = STATE_ACTIVE;
+ // make sure even still objects get hit
+ force_retouch = 2;
+ self.think = sub_null;
+ };
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+ //--------------------------------------------------------------
+ void() trigger_teleport_touch =
+ {
+ #ifdef SSQC
local vector org;
+ #endif
if (self.estate != STATE_ACTIVE)
return;
+ /*
if (self.targetname != "")
+ {
if (self.nextthink < time)
+ {
// not fired yet
+ dprint ("trigger_teleport_touch: not yet\n");
return;
+ }
+ }
+ */
- if (self.spawnflags & TRIGGER_TELEPORT_ONLYPLAYER)
+ // TODO CEV fix use of state as spawnflags
+ if (self.state & SPAWNFLAG_TRIGGER_TELEPORT_ONLYPLAYER)
+ {
if (other.classtype != CT_PLAYER &&
other.classtype != CT_PROJECTILE_GRENADE)
return;
+ }
// is this going to work? dumptruck_ds
- if (self.spawnflags & TRIGGER_TELEPORT_ONLYMONSTER)
+ if (self.state & SPAWNFLAG_TRIGGER_TELEPORT_ONLYMONSTER)
+ {
if (other.classtype == CT_PLAYER)
return;
+ }
// from Copper -- dumptruck_ds
if (other.movetype == MOVETYPE_NOCLIP)
@@ -274,90 +521,131 @@ TRIGGER_TELEPORT_ONLYMONSTER(16) will only teleport monsters
if (self.is_waiting == TRUE)
return;
+ /*
// Special case
if (self.is_waiting != -1)
if (self.targetname != "")
if (self.nextthink < time)
// not fired yet
return;
+ */
// only teleport living creatures (and projectiles)
if (other.health <= 0 || (other.solid != SOLID_SLIDEBOX &&
other.solid != SOLID_BBOX))
+ {
return;
+ }
+ #ifdef SSQC
sub_usetargets ();
// put a tfog where the player was
// ### dhm - if stealth, don't spawn a fog
- if (!(self.spawnflags & TRIGGER_TELEPORT_STEALTH))
+ if (!(self.spawnflags & SPAWNFLAG_TRIGGER_TELEPORT_STEALTH))
spawn_tfog (other.origin);
// dhm - if this is a random teleporter, pick a random spot!
- if (self.spawnflags & TRIGGER_TELEPORT_RANDOM)
+ if (self.spawnflags & SPAWNFLAG_TRIGGER_TELEPORT_RANDOM)
{
- t = trigger_teleport_randomspot ();
+ local entity t1 = trigger_teleport_randomspot ();
+ if (!t1)
+ objerror ("trigger_teleport_touch: couldn't "
+ "find target");
+
+ self.enemy = t1;
+ self.mangle = t1.mangle;
+ self.neworigin = t1.origin;
}
- else if ((self.spawnflags & TRIGGER_TELEPORT_DD) &&
+
+ // this is probably a teleporter targetting a teleporttrain.
+ // look for target and set neworigin, mangle, and enemy. -- CEV
+ // TODO CEV this assumes we find the target
+ if (!(self.SendEntity))
+ {
+ // TODO CEV: self.noise or self.target ?
+ local entity t3 = find (world, targetname, self.target);
+ self.enemy = t3;
+ self.mangle = t3.mangle;
+ self.neworigin = t3.origin;
+ }
+
+ if ((self.spawnflags & SPAWNFLAG_TRIGGER_TELEPORT_DD) &&
other.classtype == CT_PLAYER)
{
- t = find (world, targetname, self.noise);
+ local entity t2 = find (world, targetname, self.noise);
+ makevectors (t2.mangle);
+ org = t2.origin + 32 * v_forward;
+ spawn_tdeath (t2.origin, other);
}
else
{
- t = find (world, targetname, self.target);
+ makevectors (self.mangle);
+ org = self.neworigin + 32 * v_forward;
+ spawn_tdeath (self.neworigin, other);
}
- if (!t)
- objerror ("trigger_teleport_touch: couldn't "
- "find target");
-
- // put a tfog where the player was
- /*
- spawn_tfog (other.origin);
-
- t = find (world, targetname, self.target);
- if (!t)
- objerror ("couldn't find target");
- */
-
// spawn a tfog flash in front of the destination
- makevectors (t.mangle);
- org = t.origin + 32 * v_forward;
-
// ### dhm - if stealth, don't spawn a fog
- if (!(self.spawnflags & TRIGGER_TELEPORT_STEALTH))
+ if (!(self.spawnflags & SPAWNFLAG_TRIGGER_TELEPORT_STEALTH))
spawn_tfog (org);
+ #endif
- spawn_tdeath (t.origin, other);
+ #ifdef CSQC
+ // ensure makevectors is called on the client-side -- CEV
+ makevectors (self.mangle);
+ #endif
// move the player and lock him down for a little while
if (!other.health)
{
- other.origin = t.origin;
+ other.origin = self.neworigin;
other.velocity = (v_forward * other.velocity_x) +
(v_forward * other.velocity_y);
return;
}
- setorigin (other, t.origin);
- other.angles = t.mangle;
-
+ setorigin (other, self.neworigin);
+ other.angles = self.mangle;
+
if (other.classtype == CT_PLAYER)
{
- // retrieves fog values from teleport destination,
- // if any
- fog_set_from_ent (other, t);
+ #ifdef CSQC
+ // update view angles on the client side -- CEV
+ if (pmovecommandframe == clientcommandframe - 1)
+ {
+ // TODO CEV
+ /*
+ dprint (sprintf("trigger_teleport_touch: "
+ "updating angles at %g, tl %g; "
+ "pmovecmdframe %g, clientcmdframe %g\n",
+ time, input_timelength,
+ pmovecommandframe, clientcommandframe));
+ */
+ view_angles = self.mangle;
+ setproperty (VF_CL_VIEWANGLES, self.mangle);
+ }
+ input_angles = self.mangle;
+ #endif
- // turn this way immediately
- other.fixangle = 1;
+ #ifdef SSQC
+ // fixangle on the server if the client is unaware
+ // of this teleporter (for random teles) -- CEV
+ if (!(self.SendEntity))
+ other.fixangle = 1;
+
+ // set fog values from teleport destination if needed
+ fog_set_from_ent (other, self.enemy);
+ #endif
+
+ // update teleport_time and velocity for both
+ // client and server -- CEV
other.teleport_time = time + 0.7;
other.velocity = v_forward * PM_MAXSPEED;
- // TODO CEV commented out the next line
- // other.flags -= other.flags & FL_ONGROUND;
}
- if ((self.spawnflags & TRIGGER_TELEPORT_ONLYMONSTER) &&
+ #ifdef SSQC
+ if (self.spawnflags & SPAWNFLAG_TRIGGER_TELEPORT_ONLYMONSTER &&
other.classtype != CT_PLAYER)
{
// turn this way immediately
@@ -367,15 +655,7 @@ TRIGGER_TELEPORT_ONLYMONSTER(16) will only teleport monsters
if (other.flags & FL_ONGROUND)
other.flags -= other.flags & FL_ONGROUND;
}
- };
-
- //--------------------------------------------------------------
- void() trigger_teleport_use =
- {
- self.nextthink = time + 0.2;
- // make sure even still objects get hit
- force_retouch = 2;
- self.think = sub_null;
+ #endif
};
//--------------------------------------------------------------
@@ -386,13 +666,30 @@ TRIGGER_TELEPORT_ONLYMONSTER(16) will only teleport monsters
base_trigger_init (e);
e.touch = trigger_teleport_touch;
+
+ #ifdef CSQC
+ e.think = trigger_teleport_think_particle;
+ e.nextthink = time + 0.1 * random();
+ #endif
+
+ #ifdef SSQC
e.use = trigger_teleport_use;
- // find the destination
if (!e.target)
objerror ("trigger_teleport_init: no target");
- if (!(e.spawnflags & TRIGGER_TELEPORT_SILENT))
+ // RANDOM teleporters will look for their destination
+ // every time trigger_teleport_touch is called -- CEV
+ if (!(e.spawnflags & SPAWNFLAG_TRIGGER_TELEPORT_RANDOM))
+ {
+ // schedule a think to find the destination -- CEV
+ if (self.targetname != "")
+ e.estate = STATE_INACTIVE;
+ e.think = trigger_teleport_think_findtarget;
+ e.nextthink = time + 0.2 + (random() * 0.25);
+ }
+
+ if (!(e.spawnflags & SPAWNFLAG_TRIGGER_TELEPORT_SILENT))
{
precache_sound ("ambience/hum1.wav");
// volume was 0.5 -- CEV
@@ -400,9 +697,17 @@ TRIGGER_TELEPORT_ONLYMONSTER(16) will only teleport monsters
"ambience/hum1.wav", VOL_LOW, ATTN_STATIC);
}
+ // TODO CEV FIXME
+ // copy spawnflags to state so the client will see it (and
+ // touch() checks will work on both client and server) -- CEV
+ e.state = e.spawnflags;
+
sub_checkwaiting (e);
+ #endif
};
+#endif
+#ifdef SSQC
//--------------------------------------------------------------
void() trigger_teleport =
{
@@ -412,5 +717,6 @@ TRIGGER_TELEPORT_ONLYMONSTER(16) will only teleport monsters
trigger_teleport_init (self);
};
-// };
#endif
+// };
+
Return to the top of this page or return to the overview of this repo.
Diff qc/triggers/textstory.qc
diff --git a/qc/triggers/textstory.qc b/qc/triggers/textstory.qc
index 275b598..85f57c9 100644
--- a/qc/triggers/textstory.qc
+++ b/qc/triggers/textstory.qc
@@ -7,8 +7,23 @@
//======================================================================
#ifdef SSQC
-const float TEXTSTORY_SILENT = 1;
-const float TEXTSTORY_NOFADE = 2;
+//----------------------------------------------------------------------
+// base_textstory spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_BASE_TEXTSTORY_SILENT = 1,
+ SPAWNFLAG_BASE_TEXTSTORY_NOFADE = 2
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} base_textstory_spawnflags;
#endif
//======================================================================
@@ -71,7 +86,7 @@ void() target_textstory;
sound (self.enemy, CHAN_BODY, controller.noise2,
VOL_HIGH, ATTN_NORM);
- if (!(controller.spawnflags & TEXTSTORY_NOFADE))
+ if (!(controller.spawnflags & SPAWNFLAG_BASE_TEXTSTORY_NOFADE))
csf_fade (self.enemy, 0, '0 0 0', 0.5);
};
@@ -96,7 +111,8 @@ void() target_textstory;
VOL_HIGH, ATTN_NORM);
}
- if (!(controller.spawnflags & TEXTSTORY_NOFADE))
+ if (!(controller.spawnflags &
+ SPAWNFLAG_BASE_TEXTSTORY_NOFADE))
{
//custom fade amount --dumptruck_ds
if (!self.fade_amt)
@@ -188,7 +204,7 @@ void() target_textstory;
if (e.noise2 == "")
e.noise2 = "misc/null.wav";
- if (e.spawnflags & TEXTSTORY_SILENT)
+ if (e.spawnflags & SPAWNFLAG_BASE_TEXTSTORY_SILENT)
{
e.noise1 = "";
e.noise2 = "";
@@ -309,7 +325,7 @@ void() target_textstory;
local entity t;
- if (self.spawnflags & TRIGGER_CENTERPRINTALL)
+ if (self.spawnflags & SPAWNFLAG_CENTERPRINTALL)
{
t = findfloat (world, classtype, CT_PLAYER);
while (t)
@@ -337,7 +353,7 @@ void() target_textstory;
if (e.noise2 == "")
e.noise2 = "misc/null.wav";
- if (e.spawnflags & TEXTSTORY_SILENT) {
+ if (e.spawnflags & SPAWNFLAG_BASE_TEXTSTORY_SILENT) {
e.noise1 = "";
e.noise2 = "";
}
Return to the top of this page or return to the overview of this repo.
Diff qc/triggers/usekey.qc
diff --git a/qc/triggers/usekey.qc b/qc/triggers/usekey.qc
index ac82046..0c10181 100644
--- a/qc/triggers/usekey.qc
+++ b/qc/triggers/usekey.qc
@@ -15,8 +15,23 @@
//======================================================================
#ifdef SSQC
-const float TRIGGER_USEKEY_SILV_KEY = 8;
-const float TRIGGER_USEKEY_GOLD_KEY = 16;
+//----------------------------------------------------------------------
+// trigger_usekey spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_TRIGGER_USEKEY_SILV_KEY = 8,
+ SPAWNFLAG_TRIGGER_USEKEY_GOLD_KEY = 16
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} trigger_usekey_spawnflags;
#endif
//======================================================================
@@ -35,11 +50,7 @@ void() trigger_usekey;
//------------------------------------------------------------------------------
#ifdef SSQC
-/*
-QUAKED trigger_usekey (0 .5 0) ? X X X
-TRIGGER_USEKEY_SILV_KEY TRIGGER_USEKEY_GOLD_KEY X X X
-NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH
-NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+/* QUAKED trigger_usekey (0 .5 0) ? X X X SILV_KEY GOLD_KEY X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Variable sized single use trigger that requires a key to trigger
targets. Must be targeted at one or more entities.
@@ -66,13 +77,14 @@ targets. Must be targeted at one or more entities.
//--------------------------------------------------------------
void() trigger_usekey_unlock =
{
- // we can't just remove (self) here, because this is a
- // touch function called while C code is looping through
- // area links...
+ // message has already been printed keylock_try_to_unlock -- CEV
self.message = "";
sub_usetargets ();
+ // we can't just remove (self) here, because this is a
+ // touch function called while C code is looping through
+ // area links...
self.think = sub_remove;
self.touch = sub_null;
self.use = sub_null;
@@ -119,7 +131,7 @@ targets. Must be targeted at one or more entities.
keylock_init (e);
- if (e.spawnflags & TRIGGER_USEKEY_SILV_KEY)
+ if (e.spawnflags & SPAWNFLAG_TRIGGER_USEKEY_SILV_KEY)
{
// dumptruck_ds
keylock_set_silver_key (e);
@@ -131,7 +143,7 @@ targets. Must be targeted at one or more entities.
}
}
- if (e.spawnflags & TRIGGER_USEKEY_GOLD_KEY)
+ if (e.spawnflags & SPAWNFLAG_TRIGGER_USEKEY_GOLD_KEY)
{
// dumptruck_ds
keylock_set_gold_key (e);
Return to the top of this page or return to the overview of this repo.
Diff qc/triggers/void.qc
diff --git a/qc/triggers/void.qc b/qc/triggers/void.qc
index cfff6d3..a23f061 100644
--- a/qc/triggers/void.qc
+++ b/qc/triggers/void.qc
@@ -12,8 +12,23 @@
//======================================================================
#ifdef SSQC
-const float TRIGGER_VOID_MONSTER_SAFE = 1;
-const float TRIGGER_VOID_PLAYER_SAFE = 2;
+//----------------------------------------------------------------------
+// trigger_void spawnflags -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ SPAWNFLAG_TRIGGER_VOID_MONSTER_SAFE = 1,
+ SPAWNFLAG_TRIGGER_VOID_PLAYER_SAFE = 2
+ // SPAWNFLAG_NOT_ON_EASY = 256, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_NORMAL = 512,
+ // SPAWNFLAG_NOT_ON_HARD_OR_NIGHTMARE = 1024,
+ // SPAWNFLAG_NOT_IN_DEATHMATCH = 2048,
+ // SPAWNFLAG_NOT_IN_COOP = 4096,
+ // SPAWNFLAG_NOT_IN_SP = 8192,
+ // SPAWNFLAG_NOT_ON_SKILL2 = 32768, // see base_entities.qc -- CEV
+ // SPAWNFLAG_NOT_ON_SKILL3 = 65536, // see base_entities.qc -- CEV
+ // SPAWNFLAG_CENTERPRINTALL = 131072 // see base_entities.qc -- CEV
+} trigger_void_spawnflags;
#endif
//======================================================================
@@ -30,10 +45,7 @@ void() trigger_void;
//------------------------------------------------------------------------------
#ifdef SSQC
-/*
-QUAKED trigger_void (.5 .5 .5) ? X X X X X X X X
-NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH
-NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+/*QUAKED trigger_void (.5 .5 .5) ? X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Use this for a 'void' area.
Removes monsters, gibs, ammo, etc... also kills player.
*/
@@ -46,24 +58,32 @@ Removes monsters, gibs, ammo, etc... also kills player.
if (self.estate != STATE_ACTIVE)
return;
+ // entity has already been removed -- CEV
+ if (!other)
+ return;
+
// from Copper -- dumptruck_ds
if (other.movetype == MOVETYPE_NOCLIP)
return FALSE;
- if (self.spawnflags & TRIGGER_VOID_MONSTER_SAFE &&
+ if (self.spawnflags & SPAWNFLAG_TRIGGER_VOID_MONSTER_SAFE &&
other.flags & FL_MONSTER)
{
// ignore monsters
return;
}
- if (self.spawnflags & TRIGGER_VOID_PLAYER_SAFE &&
+ if (self.spawnflags & SPAWNFLAG_TRIGGER_VOID_PLAYER_SAFE &&
other.flags & FL_CLIENT)
{
// ignore players
return;
}
+ // ignore player heads -- CEV
+ if (other.classtype == CT_ITEM_HEAD_PLAYER)
+ return;
+
if (other.takedamage)
{
// kills even with Pentagram, this took forever to
@@ -72,19 +92,22 @@ Removes monsters, gibs, ammo, etc... also kills player.
t_damage2 (other, self, self, other.health + 1000);
if (other.flags & FL_MONSTER)
- remove (other);
+ base_entity_remove (other);
}
-
- if (other.classname == "gib" ||
- other.classtype == CT_PROJECTILE_GRENADE ||
- other.classtype == CT_PROJECTILE_SPIKE ||
- other.classtype == CT_PROJECTILE_ROCKET)
+ else if (other.classtype != CT_PLAYER)
{
- remove (other);
- }
+ // remove projectiles -- CEV
+ if (other.classgroup & CG_PROJECTILE)
+ base_entity_remove (other);
- if (other.flags & FL_ITEM)
- remove (other);
+ // remove corpses - gibs, heads, bodies -- CEV
+ if (other.classgroup & CG_CORPSE)
+ base_entity_remove (other);
+
+ // remove all items -- CEV
+ if (other.classgroup & CG_ITEM)
+ base_entity_remove (other);
+ }
force_retouch = 2;
};
Return to the top of this page or return to the overview of this repo.
Diff qc/world.qc
diff --git a/qc/world.qc b/qc/world.qc
index a034ec6..1696087 100644
--- a/qc/world.qc
+++ b/qc/world.qc
@@ -7,19 +7,42 @@
//======================================================================
#if defined(CSQC) || defined(SSQC)
-enum
+//----------------------------------------------------------------------
+// world flags -- only used internally -- CEV
+//----------------------------------------------------------------------
+typedef enumflags
+{
+ WORLD_FLAG_SKIP_ID1_OVERRIDES = 1, // was .skip_id1_overrides -- CEV
+ WORLD_FLAG_RESET_ITEMS = 2, // was .reset_items -- CEV
+ WORLD_FLAG_RESET_ITEMS_AXE_ONLY = 4
+} world_flags;
+#endif
+
+#if defined(CSQC) || defined(SSQC)
+//----------------------------------------------------------------------
+typedef enum
{
KNOWN_RELEASE_NOT, // known_release values -- iw
- KNOWN_RELEASE_ID1,
- KNOWN_RELEASE_FUNC_MAPJAMX,
- KNOWN_RELEASE_DMD, // Deathmatch Dimension
- KNOWN_RELEASE_QUAKE3,
- KNOWN_RELEASE_DOTP // Dimension Of The Past
-};
+ KNOWN_RELEASE_ID1, // ID1 (Quake 1 full release)
+ KNOWN_RELEASE_DOTP, // Dimension Of The Past
+ KNOWN_RELEASE_MG1, // Dimension Of The Machine
+ KNOWN_RELEASE_COPPER, // (loose) support for Copper
+ KNOWN_RELEASE_DMD, // Than's Deathmatch Dimension
+ KNOWN_RELEASE_FUNC_MAPJAMX, // func_map jam X
+ KNOWN_RELEASE_QUAKE3, // Quake 3
+ KNOWN_RELEASE_CPMA, // Challenge Pro Mode Arena
+ KNOWN_RELEASE_QUAKELIVE // Quake Live
+} world_known_releases;
-const float WORLDTYPE_MEDIEVAL = 0; // worldtype values
-const float WORLDTYPE_METAL = 1;
-const float WORLDTYPE_BASE = 2;
+//----------------------------------------------------------------------
+// .worldtype / world.style values -- CEV
+//----------------------------------------------------------------------
+typedef enum
+{
+ WORLDTYPE_MEDIEVAL = 0,
+ WORLDTYPE_METAL = 1,
+ WORLDTYPE_BASE = 2
+} world_types;
#endif
//======================================================================
@@ -27,6 +50,7 @@ const float WORLDTYPE_BASE = 2;
//======================================================================
#ifdef SSQC
+entity debris_head;
entity bodyque_head;
entity lastspawn;
float known_release; // unique ID for a release
@@ -35,7 +59,6 @@ nosave float *world_sounds; // via Spike fun times! nosave=noclobber
#if defined(CSQC) || defined(SSQC)
float world_airstep; // latched cvars, reset on world spawn
-float world_bigcoords;
float world_gravity;
float world_maxvelocity;
float world_nostep;
@@ -49,10 +72,7 @@ float world_clsidespeed;
//======================================================================
#if defined(CSQC) || defined(SSQC)
-.string wad;
.string map;
-.float worldtype; // 0=medieval 1=metal 2=base
-.float skip_id1_overrides;
#endif
//======================================================================
@@ -65,7 +85,10 @@ void() world_latched_cvars;
#ifdef SSQC
void() world_weapon_precache;
void() world_detect_known_release;
-float(entity e, vector offset) world_surface_type;
+float(vector offset) world_surface_type;
+#endif
+#ifdef SSQC
+void(string key, string value) worldspawn_init_field;
#endif
#if defined(CSQC) || defined(SSQC)
void() worldspawn;
@@ -82,8 +105,11 @@ void(entity ent) CopyToBodyQue;
//----------------------------------------------------------------------
void() world_latched_cvars =
{
+ // moved to world loading from StartFrame -- CEV
+ teamplay = cvar ("teamplay");
+ skill = cvar ("skill");
+
world_airstep = autocvar (pm_airstep, TRUE);
- world_bigcoords = autocvar (sv_bigcoords, FALSE);
world_gravity = autocvar (sv_gravity, 800.0);
world_maxvelocity = autocvar (sv_maxvelocity, 10000.0);
world_nostep = autocvar (pm_nostep, FALSE);
@@ -114,7 +140,8 @@ void() world_weapon_precache =
precache_sound ("weapons/shotgn2.wav"); // super shotgun
// cev custom weapons precaches START
- precache_sound ("cev/tribolt/boltexpl.ogg");
+ precache_sound ("cev/weapons/boltexpl.ogg");
+ precache_sound ("cev/items/noammo.ogg");
// dumptruck_ds mobot.qc precaches START
precache_model ("progs/ogre.mdl");
@@ -291,108 +318,158 @@ void() world_detect_known_release =
known_release = KNOWN_RELEASE_NOT;
release_name = "";
- if (mapname == "dm1" || mapname == "dm2" || mapname == "dm3" ||
- mapname == "dm4" || mapname == "dm5" || mapname == "dm6" ||
- // include the remaining standard DM maps -- CEV
- mapname == "aerowalk" || mapname == "ztndm3" ||
- // back to id1
- mapname == "e1m1" || mapname == "e1m2" || mapname == "e1m3" ||
- mapname == "e1m4" || mapname == "e1m5" || mapname == "e1m6" ||
- mapname == "e1m7" || mapname == "e1m8" ||
- mapname == "e2m1" || mapname == "e2m2" || mapname == "e2m3" ||
- mapname == "e2m4" || mapname == "e2m5" || mapname == "e2m6" ||
- mapname == "e2m7" ||
- mapname == "e3m1" || mapname == "e3m2" || mapname == "e3m3" ||
- mapname == "e3m4" || mapname == "e3m5" || mapname == "e3m6" ||
- mapname == "e3m7" ||
- mapname == "e4m1" || mapname == "e4m2" || mapname == "e4m3" ||
- mapname == "e4m4" || mapname == "e4m5" || mapname == "e4m6" ||
- mapname == "e4m7" || mapname == "e4m8" ||
- mapname == "end" ||
- (mapname == "start" && world.message == "Introduction"))
- {
- known_release = KNOWN_RELEASE_ID1;
- release_name = "id1";
- }
- else if (mapname == "jamx_artistical" || mapname == "jamx_bloodshot" ||
- mapname == "jamx_fw" || mapname == "jamx_hcm" ||
- mapname == "jamx_ionous" || mapname == "jamx_jcr" ||
- mapname == "jamx_kalebclark" || mapname == "jamx_mafon" ||
- // mapname == "jamx_mugwump" || // dummy map
- mapname == "jamx_naitelveni" || mapname == "jamx_newhouse" ||
- mapname == "jamx_pinchy" || mapname == "jamx_strwrk" ||
- mapname == "jamx_ukko" || mapname == "jamx_yoder" ||
- (mapname == "start" && world.message == "An Unending Dusk"))
- {
- known_release = KNOWN_RELEASE_FUNC_MAPJAMX;
- release_name = "func_mapjamx";
- }
- else if (mapname == "dmd0" || mapname == "dmd1" || mapname == "dmd2" ||
- mapname == "dmd3" || mapname == "dmd4" || mapname == "dmd5" ||
- mapname == "dmd6" || mapname == "dmd7" || mapname == "dmd8" ||
- mapname == "dmd9" || (mapname == "start" &&
- world.message == "Deathmatch Dimension"))
- {
- known_release = KNOWN_RELEASE_DMD;
- release_name = "Deathmatch Dimension";
- }
- else if (mapname == "q3ctf1" || mapname == "q3ctf2" ||
- mapname == "q3ctf3" || mapname == "q3ctf4" ||
- mapname == "q3ctf5" ||
- mapname == "q3dm0" || mapname == "q3dm1" ||
- mapname == "q3dm2" || mapname == "q3dm3" ||
- mapname == "q3dm4" || mapname == "q3dm5" ||
- mapname == "q3dm6" || mapname == "q3dm7" ||
- mapname == "q3dm8" || mapname == "q3dm9" ||
- mapname == "q3dm10" || mapname == "q3dm11" ||
- mapname == "q3dm12" || mapname == "q3dm13" ||
- mapname == "q3dm14" || mapname == "q3dm15" ||
- mapname == "q3dm16" || mapname == "q3dm17" ||
- mapname == "q3dm18" || mapname == "q3dm19" ||
- mapname == "q3tourney1" || mapname == "q3tourney2" ||
- mapname == "q3tourney3" || mapname == "q3tourney4" ||
- mapname == "q3tourney5" || mapname == "q3tourney6" ||
- mapname == "q3tourney6_ctf" ||
- mapname == "pro-q3dm13" || mapname == "pro-q3dm6" ||
- mapname == "pro-q3tourney2" || mapname == "pro-q3tourney4")
+ switch (mapname)
{
- known_release = KNOWN_RELEASE_QUAKE3;
- release_name = "Quake 3";
- }
- else if (mapname == "e5m1" || mapname == "e5m2" || mapname == "e5m3" ||
- mapname == "e5m4" || mapname == "e5m5" || mapname == "e5m6" ||
- mapname == "e5m7" || mapname == "e5m8" || mapname == "e5dm" ||
- mapname == "e5start" || (mapname == "start" &&
- world.message == "Dimension Of The Past"))
- {
- known_release = KNOWN_RELEASE_DOTP;
- release_name = "Dimension Of The Past";
+ case "dm1": // DM maps -- CEV
+ case "dm2": case "dm3": case "dm4": case "dm5": case "dm6":
+ case "aerowalk": // 3rd party standard DM maps -- CEV
+ case "ztndm3":
+ case "e1m1": // SP maps -- CEV
+ case "e1m2": case "e1m3": case "e1m4": case "e1m5":
+ case "e1m6": case "e1m7": case "e1m8":
+ case "e2m1": case "e2m2": case "e2m3": case "e2m4":
+ case "e2m5": case "e2m6": case "e2m7":
+ case "e3m1": case "e3m2": case "e3m3": case "e3m4":
+ case "e3m5": case "e3m6": case "e3m7":
+ case "e4m1": case "e4m2": case "e4m3": case "e4m4":
+ case "e4m5": case "e4m6": case "e4m7": case "e4m8":
+ known_release = KNOWN_RELEASE_ID1;
+ release_name = "Quake";
+ break;
+ case "e5dm": // dimension of the past -- CEV
+ case "e5start":
+ case "e5m1": case "e5m2": case "e5m3": case "e5m4":
+ case "e5m5": case "e5m6": case "e5m7": case "e5m8":
+ known_release = KNOWN_RELEASE_DOTP;
+ release_name = "Dimension Of The Past";
+ break;
+ case "mgdm1": // dimension of the machine -- CEV
+ case "mgdm2": case "mgdm3": case "mgdm4":
+ case "mgstart":
+ case "mghub":
+ case "mge1m1": case "mge1m2": case "mge1m3":
+ case "mge2m1": case "mge2m2":
+ case "mge3m1": case "mge3m2":
+ case "mge4m1": case "mge4m2":
+ case "mge5m1": case "mge5m2":
+ case "mgend":
+ case "horde1": case "horde2": case "horde3": case "horde4":
+ case "horde5": case "horde6": case "horde7":
+ known_release = KNOWN_RELEASE_MG1;
+ release_name = "Dimension Of The Machine";
+ break;
+ case "jamx_artistical": // func_map_jam_x -- CEV
+ case "jamx_bloodshot": case "jamx_fw": case "jamx_hcm":
+ case "jamx_ionous": case "jamx_jcr": case "jamx_kalebclark":
+ case "jamx_mafon":
+ // case "jamx_mugwump": // dummy map
+ case "jamx_naitelveni": case "jamx_newhouse":
+ case "jamx_pinchy": case "jamx_strwrk": case "jamx_ukko":
+ case "jamx_yoder":
+ known_release = KNOWN_RELEASE_FUNC_MAPJAMX;
+ release_name = "func_mapjamx";
+ break;
+ case "dmd0": // than's deathmatch dimension -- CEV
+ case "dmd1": case "dmd2": case "dmd3": case "dmd4":
+ case "dmd5": case "dmd6": case "dmd7": case "dmd8":
+ case "dmd9":
+ known_release = KNOWN_RELEASE_DMD;
+ release_name = "Deathmatch Dimension";
+ break;
+ case "q3ctf1": // Quake 3 -- CEV
+ case "q3ctf2": case "q3ctf3": case "q3ctf4": case "q3ctf5":
+ case "q3dm0": case "q3dm1": case "q3dm2": case "q3dm3":
+ case "q3dm4": case "q3dm5": case "q3dm6": case "q3dm7":
+ case "q3dm8": case "q3dm9": case "q3dm10": case "q3dm11":
+ case "q3dm12": case "q3dm13": case "q3dm14": case "q3dm15":
+ case "q3dm16": case "q3dm17": case "q3dm18": case "q3dm19":
+ case "q3tourney1": case "q3tourney2": case "q3tourney3":
+ case "q3tourney4": case "q3tourney5": case "q3tourney6":
+ case "q3tourney6_ctf":
+ case "pro-q3dm13": case "pro-q3dm6":
+ case "pro-q3tourney2": case "pro-q3tourney4":
+ known_release = KNOWN_RELEASE_QUAKE3;
+ release_name = "Quake 3";
+ break;
+ case "cpm1": // Challenge Pro Mode Arena -- CEV
+ case "cpm1a": case "cpm2": case "cpm3": case "cpm3a":
+ case "cpm3b_b1": case "cpm3b":
+ case "cpm4": case "cpm4a": case "cpm5": case "cpm6":
+ case "cpm7": case "cpm8": case "cpm9": case "cpm9a":
+ case "cpm10": case "cpm11": case "cpm11a": case "cpm12":
+ case "cpm13": case "cpm14": case "cpm15": case "cpm16":
+ case "cpm17": case "cpm18": case "cpm19": case "cpm20":
+ case "cpm21": case "cpm22": case "cpm23": case "cpm24":
+ case "cpm25": case "cpm26": case "cpm27": case "cpm28":
+ case "cpm29": case "cpm30_b1": case "cpm32_b1": case "cpm33_b1":
+ case "cpmctf1": case "cpmctf2": case "cpmctf3":
+ case "cpmctf4": case "cpmctf5":
+ known_release = KNOWN_RELEASE_CPMA;
+ release_name = "Challenge Pro Mode Arena";
+ break;
+ case "campgrounds":
+ known_release = KNOWN_RELEASE_QUAKELIVE;
+ release_name = "Quake Live";
+ break;
+ case "hub": // special handling for hub -- CEV
+ if (world.message == "The Machine")
+ {
+ known_release = KNOWN_RELEASE_MG1;
+ release_name = "Dimension Of The Machine";
+ }
+ break;
+ case "start": // special handling for start -- CEV
+ if (world.message == "Introduction")
+ {
+ known_release = KNOWN_RELEASE_ID1;
+ release_name = "Quake";
+ }
+ else if (world.message == "Dimension Of The Past")
+ {
+ known_release = KNOWN_RELEASE_DOTP;
+ release_name = "Dimension Of The Past";
+ }
+ else if (world.message == "The Gateway")
+ {
+ known_release = KNOWN_RELEASE_MG1;
+ release_name = "Dimension Of The Machine";
+ }
+ else if (world.message == "An Unending Dusk")
+ {
+ known_release = KNOWN_RELEASE_FUNC_MAPJAMX;
+ release_name = "func_mapjamx";
+ }
+ else if (world.message == "Deathmatch Dimension")
+ {
+ known_release = KNOWN_RELEASE_DMD;
+ release_name = "Deathmatch Dimension";
+ }
+ break;
}
if (release_name != "")
- dprint (sprintf("WARNING: progs.dat detected a map from %s "
- "(%g), attempting to behave compatibly\n",
- release_name, known_release));
+ dprint (sprintf("world_detect_known_release: found a map "
+ "from %s (%g)\n", release_name, known_release));
};
//----------------------------------------------------------------------
-float(entity e, vector offset) world_surface_type =
+float(vector offset) world_surface_type =
{
if (known_release == KNOWN_RELEASE_NOT)
return SURFACE_UNKNOWN;
- if (e.pm_flags & PMF_WALLJUMPED)
+ if (self.pm_flags & PMF_WALLJUMPED)
return SURFACE_UNKNOWN;
local string tex = "";
local float surfnum = 0;
- if (e.classtype != CT_PLAYER)
+ if (self.classtype != CT_PLAYER)
{
// trace to the ground entity, get the surface
// number we're standing on, then get the texture
// name on that surface. traceline will do fine.
- traceline (e.origin, e.origin + offset, 0, e);
+ traceline (self.origin, self.origin + offset, 0, self);
surfnum = getsurfacenearpoint (trace_ent, trace_endpos);
tex = getsurfacetexture (trace_ent, surfnum);
#if 0
@@ -405,13 +482,13 @@ float(entity e, vector offset) world_surface_type =
{
// we have reliable access to the ground entity
// already, no need to trace -- CEV
- surfnum = getsurfacenearpoint (e.groundentity,
- e.origin + offset);
- tex = getsurfacetexture (e.groundentity, surfnum);
- #if 0
+ surfnum = getsurfacenearpoint (self.groundentity,
+ self.origin + offset);
+ tex = getsurfacetexture (self.groundentity, surfnum);
+ #if 1
dprint (sprintf("world_surface_type: ground ent %s, "
"surface id %g, texture %s\n",
- e.groundentity.classname, surfnum, tex));
+ self.groundentity.classname, surfnum, tex));
#endif
}
@@ -429,6 +506,34 @@ float(entity e, vector offset) world_surface_type =
};
#endif
+#ifdef SSQC
+void(string key, string value) worldspawn_init_field =
+{
+ if (cvar("developer"))
+ dprint (sprintf("worldspawn_init_field: "
+ "key %s, value %s\n", key, value));
+
+ switch (key)
+ {
+ case "reset_items":
+ local float reset = stof (value);
+ if (reset)
+ world.aflag |= WORLD_FLAG_RESET_ITEMS;
+ if (reset == 2)
+ world.aflag |= WORLD_FLAG_RESET_ITEMS_AXE_ONLY;
+ break;
+ case "skip_id1_overrides":
+ local float skip = stof (value);
+ if (skip)
+ world.aflag |= WORLD_FLAG_SKIP_ID1_OVERRIDES;
+ break;
+ case "worldtype":
+ self.style = stof (value);
+ break;
+ }
+};
+#endif
+
#if defined(CSQC) || defined(SSQC)
/*QUAKED worldspawn (0 0 0) ?
Only used for the world entity.
@@ -505,6 +610,7 @@ sky(string) : "Sky Texture" : : "Must have compatible skybox textures in gfx/en
void() worldspawn =
{
#ifdef SSQC
+ // check this map's filename & try to detect a release -- CEV
world_detect_known_release ();
// new spawnflags for all entities -- iw
@@ -513,22 +619,48 @@ void() worldspawn =
// read per-map latched cvars -- CEV
world_latched_cvars ();
+ // read map data & set fields -- CEV
+ base_mapentity_init_spawndata (worldspawn_init_field);
+
lastspawn = world;
InitBodyQue ();
+
+ // TODO CEV debris fading system FIXME
+ local entity debris;
+ local float debris_count = 0;
+
+ debris = spawn ();
+ debris.classname = "debris";
+ debris.owner = debris;
+ debris_head = debris;
+
+ while (debris_count < 64)
+ {
+ debris = spawn ();
+ debris.classname = "debris";
+ debris.owner = debris_head.owner;
+ debris_head.owner = debris;
+ debris_count += 1;
+ }
#endif
self.classname = "world";
self.classtype = CT_WORLD;
// custom map attributes
- if (self.model == "maps/e1m8.bsp" && self.skip_id1_overrides == 0)
+ if (self.model == "maps/e1m8.bsp" &&
+ !(self.aflag & WORLD_FLAG_SKIP_ID1_OVERRIDES))
{
+ #ifdef SSQC
cvar_set ("sv_gravity", "100");
+ #endif
world_gravity = 100.0;
}
else
{
+ #ifdef SSQC
cvar_set ("sv_gravity", "800");
+ #endif
world_gravity = 800.0;
}
@@ -545,17 +677,13 @@ void() worldspawn =
world_weapon_precache ();
// sounds used from C physics code
- precache_sound_land (self, "demon/dland2.wav"); // landing thud
+ precache_sound ("demon/dland2.wav"); // landing thud
precache_sound ("misc/h2ohit1.wav"); // landing splash
// setup precaches always needed
precache_sound ("misc/null.wav"); // empty sound
precache_sound ("items/itembk2.wav"); // item respawn sound
precache_sound ("player/plyrjmp8.wav"); // player jump
- precache_sound ("player/jump01.ogg"); //
- precache_sound ("player/jump02.ogg"); //
- precache_sound ("player/jump03.ogg"); //
- precache_sound ("player/jump04.ogg"); //
precache_sound ("player/land.wav"); // player landing
precache_sound ("player/land2.wav"); // player hurt landing
precache_sound ("player/drown1.wav"); // drowning pain
@@ -565,38 +693,41 @@ void() worldspawn =
precache_sound ("player/h2odeath.wav"); // drowning death
// player footstep sounds -- CEV
- precache_sound ("player/stepdirt1.ogg");
- precache_sound ("player/stepdirt2.ogg");
- precache_sound ("player/stepdirt3.ogg");
- precache_sound ("player/stepdirt4.ogg");
- precache_sound ("player/stepdirt5.ogg");
- precache_sound ("player/stepmetal1.ogg");
- precache_sound ("player/stepmetal2.ogg");
- precache_sound ("player/stepmetal3.ogg");
- precache_sound ("player/stepmetal4.ogg");
- precache_sound ("player/stepmetal5.ogg");
- precache_sound ("player/stepmetal6.ogg");
- precache_sound ("player/stepmetal7.ogg");
- precache_sound ("player/stepmetal8.ogg");
- precache_sound ("player/stepmetal9.ogg");
- precache_sound ("player/stepstone1.ogg");
- precache_sound ("player/stepstone2.ogg");
- precache_sound ("player/stepstone3.ogg");
- precache_sound ("player/stepstone4.ogg");
- precache_sound ("player/stepstone5.ogg");
- precache_sound ("player/stepstone6.ogg");
- precache_sound ("player/stepwade1.ogg");
- precache_sound ("player/stepwade2.ogg");
- precache_sound ("player/stepwater1.ogg");
- precache_sound ("player/stepwater2.ogg");
- precache_sound ("player/stepwater3.ogg");
- precache_sound ("player/stepwater4.ogg");
- precache_sound ("player/stepwood1.ogg");
- precache_sound ("player/stepwood2.ogg");
- precache_sound ("player/stepwood3.ogg");
- precache_sound ("player/stepwood4.ogg");
- precache_sound ("player/slide.ogg");
- precache_sound ("player/slidestart.ogg");
+ precache_sound ("cev/player/dive.ogg");
+ precache_sound ("cev/player/jump_01.ogg");
+ precache_sound ("cev/player/jump_02.ogg");
+ precache_sound ("cev/player/jump_03.ogg");
+ precache_sound ("cev/player/jump_04.ogg");
+ precache_sound ("cev/player/step_dirt_01.ogg");
+ precache_sound ("cev/player/step_dirt_02.ogg");
+ precache_sound ("cev/player/step_dirt_03.ogg");
+ precache_sound ("cev/player/step_dirt_04.ogg");
+ precache_sound ("cev/player/step_dirt_05.ogg");
+ precache_sound ("cev/player/step_metal_01.ogg");
+ precache_sound ("cev/player/step_metal_02.ogg");
+ precache_sound ("cev/player/step_metal_03.ogg");
+ precache_sound ("cev/player/step_metal_04.ogg");
+ precache_sound ("cev/player/step_metal_05.ogg");
+ precache_sound ("cev/player/step_metal_06.ogg");
+ precache_sound ("cev/player/step_metal_07.ogg");
+ precache_sound ("cev/player/step_metal_08.ogg");
+ precache_sound ("cev/player/step_metal_09.ogg");
+ precache_sound ("cev/player/step_stone_01.ogg");
+ precache_sound ("cev/player/step_stone_02.ogg");
+ precache_sound ("cev/player/step_stone_03.ogg");
+ precache_sound ("cev/player/step_stone_04.ogg");
+ precache_sound ("cev/player/step_stone_05.ogg");
+ precache_sound ("cev/player/step_stone_06.ogg");
+ precache_sound ("cev/player/step_water_01.ogg");
+ precache_sound ("cev/player/step_water_02.ogg");
+ precache_sound ("cev/player/step_water_03.ogg");
+ precache_sound ("cev/player/step_water_04.ogg");
+ precache_sound ("cev/player/step_wood_01.ogg");
+ precache_sound ("cev/player/step_wood_02.ogg");
+ precache_sound ("cev/player/step_wood_03.ogg");
+ precache_sound ("cev/player/step_wood_04.ogg");
+ precache_sound ("cev/player/wade_water_01.ogg");
+ precache_sound ("cev/player/wade_water_02.ogg");
precache_sound ("misc/talk.wav"); // talk
precache_sound ("player/teledth1.wav"); // telefrag
@@ -605,9 +736,9 @@ void() worldspawn =
precache_sound ("misc/r_tele3.wav");
precache_sound ("misc/r_tele4.wav");
precache_sound ("misc/r_tele5.wav");
- precache_sound ("items/ammo_pickup.ogg"); // ammo pick up
- precache_sound ("items/backpack_pickup.wav"); // backpack up
- precache_sound ("items/weapon_pickup.ogg"); // weapon up
+ precache_sound ("cev/items/ammo_pickup.ogg"); // ammo pick up
+ precache_sound ("cev/items/backpack_pickup.ogg"); // backpack up
+ precache_sound ("cev/items/weapon_pickup.ogg"); // weapon up
precache_sound ("items/armor1.wav"); // armor up
precache_sound ("weapons/lhit.wav"); // lightning
precache_sound ("weapons/lstart.wav"); // lightning start
@@ -717,8 +848,8 @@ void() worldspawn =
precache_model2 ("progs/b_g_key.mdl");
precache_model ("progs/health/pd_vial.mdl"); // DropVial -- dumptruck_ds
precache_sound ("items/r_item1.wav");
- precache_sound ("items/shard_pickup.ogg"); // DropShard - dumptruck_ds
- precache_sound ("items/respawn.ogg"); // CEV
+ precache_sound ("cev/items/shard_pickup.ogg");// DropShard -dumptruck_ds
+ precache_sound ("cev/items/respawn.ogg"); // CEV
precache_model ("progs/armshr.mdl");
// Setup light anim tables. 'a' is total darkness, 'z' is maxbright.
Return to the top of this page or return to the overview of this repo.
Diff sound/items/armor_shard_q3.wav
diff --git a/sound/items/armor_shard_q3.wav b/sound/items/armor_shard_q3.wav
deleted file mode 100644
index fa6da69..0000000
Binary files a/sound/items/armor_shard_q3.wav and /dev/null differ
Return to the top of this page or return to the overview of this repo.
Diff sound/items/respawn.wav
diff --git a/sound/items/respawn.wav b/sound/items/respawn.wav
deleted file mode 100644
index d73781e..0000000
Binary files a/sound/items/respawn.wav and /dev/null differ
Return to the top of this page or return to the overview of this repo.