djcev.com

//

Git Repos / fte_dogmode / commit f83788e

Commit: f83788e50d28c91b0501ee6251a9b6c523c204ea
Parent: bbf96f9961a27e963287adaab8306c9b87de20c3
Author: Cameron Vanderzanden, 2024-01-13 18:06
Committer: Cameron Vanderzanden, 2024-01-13 18:06

Commit Message

Refactored items into classes, fix teleporttrain

Refactored / reworked the items (item_*) into the class/OO structure
I've been writing. There may be some regressions here; in particular
respawn times need to be validated and the PD3 DropStuff system needs
to be touched up (right now the latter is mostly commented out).

Added a simple item respawn indicator (item .alpha is set to 0.1 when
waiting to respawn, then set to 0.25 when 5 seconds away from spawning).

I also fixed teleporttrain for compatibility with dmd8.bsp (from Than's
Deathmatch Dimension) and added a function to oldone.qc (again for
compat with dmd8).

Messed with the movement constants again. Still looking for the magic
values that feel fast but don't make maps feel too small.

Next task is to rework projectiles and then shuffle the weapon functions
(firing etc) around.

Change List

Diff qc/base_entities.qc

diff --git a/qc/base_entities.qc b/qc/base_entities.qc
index e64fa31..ca52a0b 100644
--- a/qc/base_entities.qc
+++ b/qc/base_entities.qc
@@ -11,6 +11,20 @@ enumflags
DISABLE_USE
};

+//----------------------------------------------------------------------
+// droptofloorwrapper -- CallAsSelf-style drop-to-floor from Nuclide -- CEV
+//----------------------------------------------------------------------
+float(entity caller) droptofloorwrapper =
+{
+ local float result;
+ local entity old_self = self;
+
+ self = caller;
+ result = droptofloor ();
+ self = old_self;
+ return result;
+}
+
//------------------------------------------------------------------------------
class base_entity: entity
{

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 c8257f5..334b9f9 100644
--- a/qc/base_item.qc
+++ b/qc/base_item.qc
@@ -9,33 +9,209 @@ const float ITEM_SUSPENDED = 128;
const float ITEM_RESPAWNDM = 16384;
const float ITEM_DONTDROP = 8388608;

+// constants - alpha values (for respawn feedback)
+const float ITEM_ALPHA_WAITSPAWN = 0.1;
+const float ITEM_ALPHA_NEARSPAWN = 0.25;
+const float ITEM_ALPHA_OPAQUE = 1.0;
+
+const string ITEM_SOUND_SPAWN = "items/item_respawn_q3.wav";
+
// constants - internal flags
enumflags
{
- ITEM_FLAG_RESPAWN
+ ITEM_FLAG_DELAYSPAWN,
+ ITEM_FLAG_RHULL,
+ ITEM_FLAG_RESPAWN,
+ ITEM_FLAG_SPAWN,
+ ITEM_FLAG_NEARSPAWNTIME,
+ ITEM_FLAG_REMOVE
};

//------------------------------------------------------------------------------
class base_item: base_mapentity
{
- float item_flags;
+ float item_flags; // internal think & use state flags
+
+ float ritem; // legacy singleplayer item respawn flag
+ float respawndelay; // legacy singleplayer respawn delay
+ float respawncount; // legacy singleplayer respawn limit

- float ritem;
- float respawndelay;
- float respawncount;
+ string respawn_sound; // custom respawn sound
+
+ vector particles_offset;
+ vector size_min; // item bounding box mins
+ vector size_max; // item bounding box maxs
+
+ //--------------------------------------------------------------
+ virtual void(string fieldname, string fieldvalue) init_field =
+ {
+ switch (fieldname)
+ {
+ case "particles_offset":
+ particles_offset = stov (fieldvalue);
+ break;
+ case "ritem":
+ ritem = stof (fieldvalue);
+ break;
+ case "respawndelay":
+ respawndelay = stof (fieldvalue);
+ break;
+ case "respawncount":
+ respawncount = stof (fieldvalue);
+ break;
+ default:
+ super::init_field (fieldname, fieldvalue);
+ }
+ };

//==============================================================
- // Subs
+ // Static Helper Functions
//==============================================================

//--------------------------------------------------------------
- virtual void(entity toucher) check_touch =
+ // TODO CEV this should probably be outside of base_item
+ //--------------------------------------------------------------
+ static void(entity actor) drop_stuff =
{
+ switch (actor.drop_item)
+ {
+ case 1:
+ DropKey1 ();
+ break;
+ case 2:
+ DropKey2 ();
+ break;
+ case 3:
+ DropVial ();
+ break;
+ case 4:
+ DropShard ();
+ break;
+ case 5:
+ DropVial ();
+ DropShard ();
+ break;
+ case 6:
+ local float rand_drop = rint(random() * 3);
+ if (rand_drop == 1)
+ {
+ DropShard ();
+ DropVial ();
+ DropVial ();
+ }
+ else if (rand_drop == 2)
+ {
+ DropShard ();
+ DropShard ();
+ DropVial ();
+ }
+ else if (rand_drop == 0)
+ {
+ DropShard ();
+ DropShard ();
+ DropShard ();
+ }
+ else
+ {
+ DropVial ();
+ DropVial ();
+ DropVial ();
+ }
+ break;
+ /*
+ default:
+ dprint (sprintf("base_item::drop_stuff: "
+ "unhandled drop_item %g\n",
+ actor.drop_item));
+ */
+ }
};

+ //==============================================================
+ // Subs
+ //==============================================================
+
//--------------------------------------------------------------
- virtual void(entity item, float defaultdelay) check_respawn =
+ // CheckItemRespawn -- was in items.qc
+ //--------------------------------------------------------------
+ static float(base_item item, float delay_sp, float delay_dm)
+ check_respawn =
{
+ // DM rules first
+ if (deathmatch == 1)
+ {
+ if (delay_dm > 5.0)
+ {
+ item.alpha = ITEM_ALPHA_WAITSPAWN;
+ item.item_flags |= ITEM_FLAG_NEARSPAWNTIME;
+ item.item_flags &= ~ITEM_FLAG_RESPAWN;
+ item.nextthink = time + delay_dm - 5.0;
+ }
+ else
+ {
+ item.alpha = ITEM_ALPHA_NEARSPAWN;
+ item.nextthink = time + delay_dm;
+ }
+
+ item.nextthink = time + delay_dm;
+ setmodel (this, this.mdl);
+ return TRUE;
+ }
+
+ if (deathmatch)
+ {
+ dprint (sprintf("base_item::check_respawn: unhandled "
+ "deathmatch state %f\n", deathmatch));
+ return FALSE;
+ }
+
+ // Supa, SP respawning items support
+ // respawn item if true, otherwise abort
+ if (!item.ritem)
+ return FALSE;
+
+ // inc before check to account for zero indexing
+ item.cnt = item.cnt + 1;
+
+ // limited respawns
+ if (item.respawncount && item.respawncount < item.cnt)
+ return FALSE;
+
+ // okay, we're clear to set up a respawn
+ if (item.respawndelay)
+ {
+ // custom respawn delay
+ if (item.respawndelay > 5.0)
+ {
+ item.alpha = ITEM_ALPHA_WAITSPAWN;
+ item.item_flags |= ITEM_FLAG_NEARSPAWNTIME;
+ item.item_flags &= ~ITEM_FLAG_RESPAWN;
+ item.nextthink = time + item.respawndelay - 5.0;
+ }
+ else
+ {
+ item.alpha = ITEM_ALPHA_NEARSPAWN;
+ item.nextthink = time + item.respawndelay;
+ }
+ }
+ else
+ {
+ if (delay_sp > 5.0)
+ {
+ item.alpha = ITEM_ALPHA_WAITSPAWN;
+ item.item_flags |= ITEM_FLAG_NEARSPAWNTIME;
+ item.item_flags &= ~ITEM_FLAG_RESPAWN;
+ item.nextthink = time + delay_sp - 5.0;
+ }
+ else
+ {
+ item.alpha = ITEM_ALPHA_NEARSPAWN;
+ item.nextthink = time + delay_sp;
+ }
+ }
+
+ setmodel (item, item.mdl);
+ return TRUE;
};

//--------------------------------------------------------------
@@ -45,20 +221,244 @@ class base_item: base_mapentity
{
// restore original model
this.model = this.mdl;
+ this.alpha = ITEM_ALPHA_OPAQUE;

// allow it to be touched again
this.solid = SOLID_TRIGGER;

- // TODO CEV
+ // new respawning effects -- CEV
// Respawn with DM effects
// if (deathmatch || (this.spawnflags & ITEM_RESPAWNDM))
// play respawn sound
- sound (this, CHAN_VOICE, "items/item_respawn_q3.wav",
- 1, ATTN_NORM);
- // else
- // play teleport sound and display particles
- // spawn_tfog (this.origin + this.particles_offset);
+ if (respawn_sound && respawn_sound != "")
+ sound (this, CHAN_VOICE, respawn_sound, 1, ATTN_NORM);
+ else
+ sound (this, CHAN_VOICE, ITEM_SOUND_SPAWN, 1, ATTN_NORM);

setorigin (this, this.origin);
+ setsize (this, this.size_min, this.size_max);
+ };
+
+ //--------------------------------------------------------------
+ // PlaceItem -- plants the object on the floor
+ //--------------------------------------------------------------
+ nonvirtual void() sub_place_item =
+ {
+ // so it can be restored on respawn
+ this.mdl = this.model;
+ this.alpha = ITEM_ALPHA_OPAQUE;
+ if (!this.size_min && !this.size_max)
+ {
+ this.size_min = '0 0 0';
+ this.size_max = '32 32 56';
+ }
+ setsize (this, this.size_min, this.size_max);
+
+ // make extra wide
+ this.flags = FL_ITEM;
+
+ this.solid = SOLID_TRIGGER;
+ this.velocity = '0 0 0';
+
+ if (this.spawnflags & ITEM_SUSPENDED)
+ {
+ // ijed Don't drop spawnflag
+ this.movetype = MOVETYPE_FLY;
+ }
+ else
+ {
+ // 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
+ // nice to remove this code entirely, because progs_dump
+ // doesn't need it, and it breaks item_health's
+ // collision with entities that have MOVETYPE_PUSH.
+ // However, removing this code would cause some of the
+ // item_health entities in some of the func_mapjamx
+ // maps to "fall out of the level", because they're
+ // accidentally touching solid surfaces. So, to
+ // maintain backwards-compatibility, this code has
+ // been left in, but will only be run if one of the
+ // func_mapjamx maps is being played. -- iw
+ if (known_release == KNOWN_RELEASE_FUNC_MAPJAMX)
+ {
+ if (this.classtype == CT_ITEM_HEALTH)
+ {
+ // Supa, CTF
+ // hacking around hull issues..
+ // void hull for now
+ setsize (this, '0 0 0', '0 0 0');
+ this.item_flags &= ~ITEM_FLAG_SPAWN;
+ this.item_flags &= ~ITEM_FLAG_RESPAWN;
+ this.item_flags |= ITEM_FLAG_RHULL;
+ this.nextthink = time + 0.2;
+ }
+ }
+
+ this.movetype = MOVETYPE_TOSS;
+
+ if (!(this.spawnflags & ITEM_DONTDROP))
+ {
+ setorigin (this, this.origin + '0 0 6');
+
+ if (!droptofloorwrapper(this))
+ {
+ dprint (sprintf("base_item::sub_place_"
+ "item: bonus item %s fell out "
+ "of level at %v\n",
+ this.classname, this.origin));
+ // TODO CEV
+ // remove (this);
+ return;
+ }
+ }
+ }
+
+ if (this.spawnflags & ITEM_SPAWNED)
+ {
+ // SPAWNED, gb
+ this.pos1 = this.mins;
+ this.pos2 = this.maxs;
+
+ this.model = "";
+ this.solid = SOLID_NOT;
+
+ if (this.spawnflags & ITEM_DONTDROP)
+ this.movetype = MOVETYPE_NONE;
+
+ this.item_flags |= ITEM_FLAG_DELAYSPAWN;
+ }
+ };
+
+ //--------------------------------------------------------------
+ // RefreshHull -- Supa, restore old hull and lock movement
+ //--------------------------------------------------------------
+ nonvirtual void() sub_refresh_hull =
+ {
+ dprint ("base_item::sub_refresh_hull: fix for bboxes\n");
+
+ // dumptruck_ds -- fix for bounding boxes
+ if (this.size_min && this.size_max)
+ setsize (this, this.size_min, this.size_max);
+ else
+ setsize (this, '0 0 0', '32 32 56');
+
+ this.movetype = MOVETYPE_NONE;
+ this.velocity = '0 0 0';
+ };
+
+ //==============================================================
+ // Interfacing
+ //==============================================================
+
+ //--------------------------------------------------------------
+ virtual void(entity caller) do_think =
+ {
+ if (this.item_flags & ITEM_FLAG_SPAWN)
+ {
+ // flags might be altered by place_item, so
+ // set them beforehand -- CEV
+ this.item_flags &= ~ITEM_FLAG_SPAWN;
+ this.item_flags |= ITEM_FLAG_RESPAWN;
+ sub_place_item ();
+ }
+ else if (this.item_flags & ITEM_FLAG_RESPAWN)
+ {
+ sub_regen ();
+ }
+ else if (this.item_flags & ITEM_FLAG_NEARSPAWNTIME)
+ {
+ // bump alpha when 5s remain -- CEV
+ this.alpha = ITEM_ALPHA_NEARSPAWN;
+ this.item_flags &= ~ITEM_FLAG_NEARSPAWNTIME;
+ this.item_flags |= ITEM_FLAG_RESPAWN;
+ this.nextthink = time + 5.0;
+ }
+ else if (this.item_flags & ITEM_FLAG_RHULL)
+ {
+ sub_refresh_hull ();
+ }
+ else if (this.item_flags & ITEM_FLAG_REMOVE)
+ {
+ remove (this);
+ }
};
+
+ //--------------------------------------------------------------
+ virtual void(entity toucher) handle_touch =
+ {
+ // has touch been disabled? -- CEV
+ if (this.interaction_flags & DISABLE_TOUCH)
+ return;
+
+ if (sub_checkvalidtouch(toucher) == FALSE)
+ return;
+
+ do_touch (toucher);
+ };
+
+ //--------------------------------------------------------------
+ virtual void(entity caller) do_use =
+ {
+ if (this.item_flags & ITEM_FLAG_DELAYSPAWN)
+ {
+ //----------------------------------------------
+ // DelaySpawnItem -- this is from rmq-items.qc;
+ // Makes a SPAWNED item ready for pickup on a
+ // trigger event - modified a bit -- dumptruck_ds
+ //----------------------------------------------
+ this.solid = SOLID_TRIGGER;
+ setmodel (this, this.mdl);
+ setsize (this, this.pos1, this.pos2);
+
+ if (!(this.spawnflags & ITEM_SPAWNSILENT))
+ // SILENT, gb
+ // sound (this, CHAN_VOICE, "items/itembk2.wav",
+ // 1, ATTN_NORM);
+ spawn_tfog (this.origin +
+ this.particles_offset);
+
+ if (this.spawnflags & ITEM_SUSPENDED)
+ this.movetype = MOVETYPE_FLY;
+ else
+ this.movetype = MOVETYPE_TOSS;
+
+ this.item_flags &= ~ITEM_FLAG_DELAYSPAWN;
+ }
+ };
+
+ //==============================================================
+ // Constructor & Spawn Functions
+ //==============================================================
+
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
+ {
+ //------------------------------------------------------
+ // StartItem -- Sets the clipping size and plants the
+ // object on the floor
+ //------------------------------------------------------
+
+ // items start after other solids || was 0.2 -- dumptruck_ds
+ this.nextthink = time + 0.3;
+ this.item_flags |= ITEM_FLAG_SPAWN;
+ };
+
+ //--------------------------------------------------------------
+ void() base_item =
+ {
+ this.classgroup |= CG_ITEM;
+ this.item_flags |= ITEM_FLAG_SPAWN;
+ };
+};
+
+//==============================================================================
+
+/*QUAKED noclass (0 0 0) (-8 -8 -8) (8 8 8)
+prints a warning message when spawned
+*/
+void() noclass =
+{
+ dprint (sprintf("noclass: spawned at %v\n", self.origin));
+ remove (self);
};

Return to the top of this page or return to the overview of this repo.

Diff qc/client/impulse.qc

diff --git a/qc/client/impulse.qc b/qc/client/impulse.qc
index 19f897a..e7a9b6d 100644
--- a/qc/client/impulse.qc
+++ b/qc/client/impulse.qc
@@ -22,7 +22,7 @@ void() CheatCommand =
IT_ROCKET_LAUNCHER | IT_LIGHTNING;

// support for item_key_custom -- iw
- GiveAllKeys (self);
+ base_item_key::give_all_keys (self);

self.weapon = IT_ROCKET_LAUNCHER;
self.impulse = 0;

Return to the top of this page or return to the overview of this repo.

Diff qc/client/playerspawn.qc

diff --git a/qc/client/playerspawn.qc b/qc/client/playerspawn.qc
index 6536f6a..9087969 100644
--- a/qc/client/playerspawn.qc
+++ b/qc/client/playerspawn.qc
@@ -305,19 +305,6 @@ void() testplayerstart =
// empty function
};

-/*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
-*/
-void() info_player_deathmatch =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-};
-
/*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");

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 cd434d3..a2ee243 100644
--- a/qc/compat_quake3.qc
+++ b/qc/compat_quake3.qc
@@ -2,17 +2,7 @@
// Quake 3 compatibility entrypoints / functions
//==============================================================================

-// prototypes / foward declarations
-void() item_armor1;
-void() item_armor2;
-void() item_armorInv;
-void() item_cells;
-void() item_health;
-void() item_health_vial;
-void() item_rockets;
-void() item_shells;
-void() item_spikes;
-void() weapon_supernailgun;
+class item_quad: item_artifact_super_damage { };

//======================================================================
// Quake 3 armor item support -- CEV
@@ -21,47 +11,44 @@ void() weapon_supernailgun;
//----------------------------------------------------------------------
// Green Armor -- CEV
//----------------------------------------------------------------------
-void() spawnfunc_item_armor_jacket =
-{
- self.classname = "item_armor1";
- item_armor1 ();
-};
+class item_armor_jacket: item_armor1 { };

//----------------------------------------------------------------------
// Yellow Armor -- CEV
//----------------------------------------------------------------------
-void() spawnfunc_item_armor_combat =
-{
- self.classname = "item_armor2";
- item_armor2 ();
-};
+class item_armor_combat: item_armor2 { };

//----------------------------------------------------------------------
// Red Armor -- CEV
//----------------------------------------------------------------------
-void() spawnfunc_item_armor_body =
-{
- self.classname = "item_armorInv";
- item_armorInv ();
-};
+class item_armor_body: item_armorInv { };

//======================================================================
// Quake 3 health item support -- CEV
//======================================================================

//----------------------------------------------------------------------
-void() spawnfunc_item_health_mega =
+class item_health_mega: item_health
{
- self.classname = "item_health";
- self.spawnflags |= 2;
- item_health ();
+ virtual void() init_spawned =
+ {
+ this.spawnflags |= 2;
+ super::init_spawned ();
+ };
+
+ void() item_health_mega =
+ {
+ this.classname = "item_health";
+ };
};

//----------------------------------------------------------------------
-void() spawnfunc_item_health_small =
+class item_health_small: item_health_vial
{
- self.classname = "item_health_vial";
- item_health_vial ();
+ void() item_health_small =
+ {
+ this.classname = "item_health_vial";
+ };
};

//======================================================================
@@ -69,45 +56,27 @@ void() spawnfunc_item_health_small =
//======================================================================

//----------------------------------------------------------------------
-void() spawnfunc_ammo_cells =
-{
- self.classname = "item_spikes";
- item_spikes ();
-};
+class ammo_cells: item_spikes { };

//----------------------------------------------------------------------
-void() spawnfunc_ammo_grenades =
-{
- self.classname = "item_rockets";
- item_rockets ();
-};
+class ammo_grenades: item_rockets { };

//----------------------------------------------------------------------
-void() spawnfunc_ammo_lightning =
-{
- self.classname = "item_cells";
- item_cells ();
-};
+class ammo_lightning: item_cells { };

//----------------------------------------------------------------------
-void() spawnfunc_ammo_rockets =
-{
- self.classname = "item_rockets";
- item_rockets ();
-};
+class ammo_rockets: item_rockets { };

//----------------------------------------------------------------------
-void() spawnfunc_ammo_shells =
-{
- self.classname = "item_shells";
- item_shells ();
-};
+class ammo_shells: item_shells { };

//----------------------------------------------------------------------
-void() weapon_plasmagun =
+class weapon_plasmagun: weapon_supernailgun
{
- self.classname = "weapon_supernailgun";
- weapon_supernailgun ();
+ void() weapon_plasmagun =
+ {
+ this.classname = "weapon_supernailgun";
+ };
};

//======================================================================

Return to the top of this page or return to the overview of this repo.

Diff qc/csqc/csqc_defsclient.qc

diff --git a/qc/csqc/csqc_defsclient.qc b/qc/csqc/csqc_defsclient.qc
index d6defb6..273784c 100644
--- a/qc/csqc/csqc_defsclient.qc
+++ b/qc/csqc/csqc_defsclient.qc
@@ -79,6 +79,15 @@ vector pmove_error;
float pmove_errortime;
float pmove_frame;

+// imported from fteextensions.qc
+int trace_endcontents;
+int trace_surfaceflags;
+int trace_brush_id;
+int trace_brush_faceid;
+int trace_surface_id; // 1-based. 0 if not known.
+int trace_bone_id; // 1-based. 0 if not known.
+int trace_triangle_id; // 1-based. 0 if not known.
+
//----------------------------------------------------------------------
// Extra fields
//----------------------------------------------------------------------

Return to the top of this page or return to the overview of this repo.

Diff qc/defs_classtype.qc

diff --git a/qc/defs_classtype.qc b/qc/defs_classtype.qc
index 176e378..eb0e508 100644
--- a/qc/defs_classtype.qc
+++ b/qc/defs_classtype.qc
@@ -83,6 +83,35 @@ enum
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_ARMOR_GREEN, // id1 armor1 Green Armor
+ CT_ITEM_ARMOR_YELLOW, // id1 armor2 Yellow Armor
+ CT_ITEM_ARMOR_RED, // id1 armorInv Red Armor
+ CT_ITEM_ARMOR_SHARD, // pd3 armor shards
+ CT_ITEM_AXE, // id1 weapon axe
+ CT_ITEM_BACKPACK, // id1 backpacks
+ CT_ITEM_ENVIROSUIT, // id1 powerup environment suit
+ CT_ITEM_GRENADE_LAUNCHER, // id1 weapon grenade launcher
+ CT_ITEM_HEALTH, // id1 health
+ CT_ITEM_HEALTH_VIAL, // pd3 health vial (5hp bubble)
+ CT_ITEM_INVISIBILITY, // id1 powerup ring of shadows
+ CT_ITEM_INVULNERABILITY, // id1 powerup pentagram of protection
+ CT_ITEM_KEY1, // id1 key1 (silver)
+ CT_ITEM_KEY2, // id1 key2 (gold)
+ CT_ITEM_KEY_CUSTOM, // pd3 custom keys
+ CT_ITEM_LIGHTNING_GUN, // id1 weapon thunderbolt (LG)
+ CT_ITEM_NAILGUN, // id1 weapon nailgun (NG)
+ CT_ITEM_QUAD, // id1 powerup quad damage
+ CT_ITEM_ROCKET_LAUNCHER, // id1 weapon rocket launcher (RL)
+ CT_ITEM_RUNE, // id1 rune/sigil
+ CT_ITEM_SHOTGUN, // id1 weapon shotgun (SG)
+ CT_ITEM_SUPER_NAILGUN, // id1 weapon super nailgun (SNG)
+ CT_ITEM_SUPER_SHOTGUN, // id1 weapon super shotgun (SSG)
+
// lights
CT_LIGHT, // id1 light
CT_LIGHT_CANDLE, // light_candle
@@ -191,16 +220,22 @@ enum
CT_TEMP_DOOR_TRIGGER, // id1 doors
CT_TEMP_FALL2_HELPER, // RennyC & whirledtsar fall2
CT_TEMP_FIREBALL, // created by misc_fireball
- CT_TEMP_FOG_CONTROLLER, // fog
+ CT_TEMP_FOG_CONTROLLER, // pd3 fog
+ CT_TEMP_GRENADE, // id1 grenade projectile
+ CT_TEMP_KEYDEF, // pd3 custom key definition
+ CT_TEMP_LASERBEAM, // id1 laser projectile
+ CT_TEMP_ROCKET, // id1 rocket projectile
CT_TEMP_LASER_HELPER, // Rubicon2 func_laser
CT_TEMP_NEWPLAT_TRIGGER, // pd3 newplats
CT_TEMP_PLAT_TRIGGER, // id1 plats
CT_TEMP_ROTATE_CONTROLLER, // rotation controller
- CT_TEMP_SPARK // misc_sparks
+ CT_TEMP_SPARK, // misc_sparks
+ CT_TEMP_SPIKE // id1 nail/spike projectile
};

//----------------------------------------------------------------------
// classgroups, defined as needed; I did not want to do this -- CEV
+// go no higher than 24 bits (according to the FTEQCC manual) -- CEV
//----------------------------------------------------------------------
enumflags
{
@@ -208,7 +243,18 @@ enumflags
CG_TEMPENTITY, // temporary entities
CG_MAPENTITY, // entities with spawn functions
CG_FUNC, // func_*
+ CG_FUNC_ROTATE, // rotation objects
+ CG_ITEM, // items
+ CG_ITEM_ARMOR, // armor pickups
+ CG_ITEM_AMMO, // ammunition boxes
+ CG_ITEM_HEALTH, // health pickups
+ CG_ITEM_KEY, // keys
+ CG_ITEM_POWERUP, // powerups
+ CG_ITEM_WEAPON, // weapon pickups
+ CG_MONSTER, //
+ CG_MONSTER_FLY, //
+ CG_MONSTER_SWIM, //
+ CG_PROJECTILE, // missiles & projectiles
CG_TRIGGER, // trigger_*
- CG_ROTATE, // rotation objects
CG_HAZARD_LTRAIL // DOE lightning trail
};

Return to the top of this page or return to the overview of this repo.

Diff qc/defs_misc.qc

diff --git a/qc/defs_misc.qc b/qc/defs_misc.qc
index 606974b..8c590f7 100644
--- a/qc/defs_misc.qc
+++ b/qc/defs_misc.qc
@@ -230,6 +230,17 @@ float skill;
float known_release; // unique ID for a release;
// see values above -- iw

+// imported from fteextensions.qc
+/*
+int trace_endcontents;
+int trace_surfaceflags;
+int trace_brush_id;
+int trace_brush_faceid;
+int trace_surface_id; // 1-based. 0 if not known.
+int trace_bone_id; // 1-based. 0 if not known.
+int trace_triangle_id; // 1-based. 0 if not known.
+*/
+
//======================================================================
// world fields (FIXME: make globals)
//======================================================================
@@ -421,22 +432,10 @@ float BREAKABLE_NO_MONSTERS = 1;
.float wantedgravity; // thanks Spike!
// .float ladder_step_finished; // footsteps on ladder -- dumptruck_ds

-// from remakequake -- dumptruck_ds
-
-void(string type, string text) print_self =
-{
- dprint (type);
- dprint (" '");
- dprint (self.classname);
- dprint ("' ");
- dprint (text);
- dprint (" at ");
- dprint (vtos(self.origin));
- dprint ("\n");
-};
-
// TODO CEV keep these
.float alpha; // translucency in supported engines
+.vector colormod; // Provides a colour tint for the entity
+.vector glowmod; // make 'em glow

// TODO CEV check these
.float pain_threshold; // dumptruck_ds

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 df73fa4..3dfa51d 100644
--- a/qc/func/breakable.qc
+++ b/qc/func/breakable.qc
@@ -284,7 +284,7 @@ class base_breakable: base_func
{
this.origin = ((this.absmin + this.absmax) * 0.5);
setorigin (this, this.origin);
- DropStuff ();
+ base_item::drop_stuff (this);
if (this.spawnflags & BREAK_CUSTOM)
{
if (this.switchshadstyle)

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 d0d6d73..14fdb7c 100644
--- a/qc/func/door.qc
+++ b/qc/func/door.qc
@@ -759,7 +759,7 @@ class func_door: base_func
// forgive me for using the ternary operator -- CEV
this.shadow = spawn (misc_shadowcontroller,
switchshadstyle: this.switchshadstyle,
- speed: vlen (this.pos2 - this.pos1) / this.speed,
+ speed: vlen (pos2 - pos1) / speed,
spawnflags: spawnflags & DOOR_START_OPEN ? 1:0);
}
};

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 76dab78..2e7df47 100644
--- a/qc/func/rotate.qc
+++ b/qc/func/rotate.qc
@@ -139,7 +139,7 @@ class base_rotate: base_func

while (ent)
{
- if (!(ent.classgroup & CG_ROTATE))
+ if (!(ent.classgroup & CG_FUNC_ROTATE))
{
dprint (sprintf("rotate_targets: found "
"unhandled class %s, targetname %s\n",
@@ -198,7 +198,7 @@ class base_rotate: base_func

while (ent)
{
- if (!(ent.classgroup & CG_ROTATE))
+ if (!(ent.classgroup & CG_FUNC_ROTATE))
{
dprint (sprintf("rotate_targets_final: found "
"unhandled class %s, targetname %s\n",
@@ -230,7 +230,7 @@ class base_rotate: base_func

while (ent)
{
- if (!(ent.classgroup & CG_ROTATE))
+ if (!(ent.classgroup & CG_FUNC_ROTATE))
{
dprint (sprintf("rotate_targets_final: found "
"unhandled class %s, targetname %s\n",
@@ -287,7 +287,7 @@ class base_rotate: base_func
rot.neworigin = rot.oldorigin;
rot.owner = this;
}
- else if (ent.classgroup & CG_ROTATE)
+ else if (ent.classgroup & CG_FUNC_ROTATE)
{
// cast to base_rotate -- CEV
rot = (base_rotate)ent;
@@ -331,7 +331,7 @@ class base_rotate: base_func
//--------------------------------------------------------------
void() base_rotate =
{
- this.classgroup |= CG_ROTATE;
+ this.classgroup |= CG_FUNC_ROTATE;
};
};

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 260fa32..15a6509 100644
--- a/qc/items/ammo.qc
+++ b/qc/items/ammo.qc
@@ -22,100 +22,128 @@ const float AMMO_SHELLS_SMALL = 20; // id1 20; small box of shells
const float AMMO_SHELLS_BIG = 40; // id1 40; large box of shells
const float AMMO_SHELLS_MAX = 100; // id1 maximum 100

-//----------------------------------------------------------------------
-void() ammo_touch =
+// REMOVE the following two functions once PlayerBestWeapon and
+// PlayerSetCurrentAmmo have been refactored -- CEV
+
+void(entity doas, void() f) REMOVEME_CallAsSelf =
{
local entity stemp;
- local float best = 0;

- // from Copper -- dumptruck_ds
- if (!CheckValidTouch())
- return;
+ stemp = self;
+ self = doas;
+ f ();
+ self = stemp;
+};

- // if the player was using his best weapon, change up to the new
- // one if better
- if (other.classname == "player" && autocvar(cg_autoswitch, TRUE))
- {
- stemp = self;
- self = other;
- best = PlayerBestWeapon ();
- self = stemp;
- }
-
- // shotgun
- if (self.weapon == 1)
- {
- if (other.ammo_shells >= AMMO_SHELLS_MAX)
- return;
- other.ammo_shells = other.ammo_shells + self.aflag;
- }
+float(entity doas, float() f) REMOVEME_CallAsSelfFloat =
+{
+ local entity stemp;
+ local float fl;

- // spikes
- if (self.weapon == 2)
- {
- if (other.ammo_nails >= AMMO_NAILS_MAX)
- return;
- other.ammo_nails = other.ammo_nails + self.aflag;
- }
+ stemp = self;
+ self = doas;
+ fl = f ();
+ self = stemp;
+ return fl;
+};

- // rockets
- if (self.weapon == 3)
+//------------------------------------------------------------------------------
+class base_item_ammo: base_item
+{
+ //--------------------------------------------------------------
+ // was ammo_touch -- CEV
+ //--------------------------------------------------------------
+ virtual void(entity toucher) do_touch =
{
- if (other.ammo_rockets >= AMMO_ROCKETS_MAX)
- return;
- other.ammo_rockets = other.ammo_rockets + self.aflag;
- }
+ local float best = 0;

- // cells
- if (self.weapon == 4)
- {
- if (other.ammo_cells >= AMMO_CELLS_MAX)
- return;
- other.ammo_cells = other.ammo_cells + self.aflag;
- }
-
- bound_other_ammo ();
-
- sprint (other, "You got the ");
- sprint (other, self.netname);
- sprint (other, "\n");
- // ammo touch sound
- sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
- stuffcmd (other, "bf\n");
-
- // change to a better weapon if appropriate
- if (other.classname == "player" && other.weapon == best &&
- autocvar(cg_autoswitch, TRUE))
- {
- stemp = self;
- self = other;
- self.weapon = PlayerBestWeapon ();
- PlayerSetCurrentAmmo ();
- self = stemp;
- }
-
- // if changed current ammo, update it
- if (other.classname == "player")
+ // if the player was using his best weapon, change up to
+ // the new one if better
+ if (toucher.classtype == CT_PLAYER &&
+ autocvar(cg_autoswitch, TRUE))
+ {
+ dprint ("base_item_ammo::do_touch: PlayerBestWeapon"
+ "()\n");
+ // TODO CEV
+ best = REMOVEME_CallAsSelfFloat (other,
+ PlayerBestWeapon);
+ }
+
+ // shotgun
+ if (this.weapon == 1)
+ {
+ if (toucher.ammo_shells >= AMMO_SHELLS_MAX)
+ return;
+ toucher.ammo_shells += this.aflag;
+ }
+
+ // spikes
+ if (this.weapon == 2)
+ {
+ if (toucher.ammo_nails >= AMMO_NAILS_MAX)
+ return;
+ toucher.ammo_nails =+ this.aflag;
+ }
+
+ // rockets
+ if (this.weapon == 3)
+ {
+ if (toucher.ammo_rockets >= AMMO_ROCKETS_MAX)
+ return;
+ toucher.ammo_rockets += this.aflag;
+ }
+
+ // cells
+ if (this.weapon == 4)
+ {
+ if (toucher.ammo_cells >= AMMO_CELLS_MAX)
+ return;
+ toucher.ammo_cells += this.aflag;
+ }
+
+ bound_other_ammo ();
+
+ sprint (toucher, sprintf("You got the %s\n", this.netname));
+ // ammo touch sound
+ sound (toucher, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
+ stuffcmd (toucher, "bf\n");
+
+ // change to a better weapon if appropriate
+ if (toucher.classtype == CT_PLAYER && toucher.weapon == best &&
+ autocvar(cg_autoswitch, TRUE))
+ {
+ dprint ("base_item_ammo::do_touch: PlayerSetCurrentAmmo"
+ "()\n");
+ // TODO CEV
+ other.weapon = REMOVEME_CallAsSelfFloat (other,
+ PlayerBestWeapon);
+ REMOVEME_CallAsSelf (other, PlayerSetCurrentAmmo);
+ }
+
+ // if changed current ammo, update it
+ if (toucher.classtype == CT_PLAYER)
+ {
+ dprint ("base_item_ammo::do_touch: PlayerSetCurrentAmmo"
+ "()\n");
+ // TODO CEV
+ REMOVEME_CallAsSelf (other, PlayerSetCurrentAmmo);
+ }
+
+ // remove it in single player, or setup for respawning in DM
+ this.solid = SOLID_NOT;
+ this.model = string_null;
+ check_respawn (this, AMMO_RESPAWN_TIME, AMMO_RESPAWN_TIME);
+
+ activator = toucher;
+ // fire all targets / killtargets
+ sub_usetargets ();
+ };
+
+ //--------------------------------------------------------------
+ void() base_item_ammo =
{
- stemp = self;
- self = other;
- PlayerSetCurrentAmmo ();
- self = stemp;
- }
-
- // remove it in single player, or setup for respawning in deathmatch
- self.model = string_null;
- self.solid = SOLID_NOT;
- if (!deathmatch)
- CheckItemRespawn (self, AMMO_RESPAWN_TIME);
- else if (deathmatch == 1)
- // doesn't respawn in "deathmatch 2"
- self.nextthink = time + AMMO_RESPAWN_TIME;
- self.think = SUB_Regen;
-
- activator = other;
- // fire all targets / killtargets
- SUB_UseTargets ();
+ this.classgroup |= CG_ITEM_AMMO;
+ };
};

/*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
@@ -125,60 +153,68 @@ void() ammo_touch =
Box of 20 shells.
LARGE_BOX is a box of 40 shells.
*/
-void() item_shells =
+class item_shells: base_item_ammo
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- self.touch = ammo_touch;
-
- if (self.spawnflags & WEAPON_BIG2)
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
{
- if (!self.mdl_body && world.s_lg_mdl)
- self.mdl_body = world.s_lg_mdl;
-
- if (world.style)
+ if (this.spawnflags & WEAPON_BIG2)
{
- // models courtesy Lunaran -- dumptruck_ds
- precache_body_model ("progs/ammo/m_shell2.mdl");
- body_model ("progs/ammo/m_shell2.mdl");
+ if (!this.mdl_body && world.s_lg_mdl)
+ this.mdl_body = world.s_lg_mdl;
+
+ if (world.style)
+ {
+ // models courtesy Lunaran -- dumptruck_ds
+ precache_body_model ("progs/ammo/m_shell2.mdl");
+ body_model ("progs/ammo/m_shell2.mdl");
+ }
+ else
+ {
+ precache_body_model ("maps/b_shell1.bsp");
+ body_model ("maps/b_shell1.bsp");
+ }
+
+ if !(this.particles_offset)
+ this.particles_offset = '16 16 16';
+ this.aflag = AMMO_SHELLS_BIG;
}
else
{
- precache_body_model ("maps/b_shell1.bsp");
- body_model ("maps/b_shell1.bsp");
+ if (!this.mdl_body && world.s_sm_mdl)
+ this.mdl_body = world.s_sm_mdl;
+
+ if (world.style)
+ {
+ // models courtesy Lunaran -- dumptruck_ds
+ precache_body_model ("progs/ammo/m_shell1.mdl");
+ body_model ("progs/ammo/m_shell1.mdl");
+ }
+ else
+ {
+ precache_body_model ("maps/b_shell0.bsp");
+ body_model ("maps/b_shell0.bsp");
+ }
+
+ if !(this.particles_offset)
+ this.particles_offset = '12 12 12';
+ this.aflag = AMMO_SHELLS_SMALL;
}

- if !(self.particles_offset)
- self.particles_offset = '16 16 16';
- self.aflag = AMMO_SHELLS_BIG;
- }
- else
- {
- if (!self.mdl_body && world.s_sm_mdl)
- self.mdl_body = world.s_sm_mdl;
+ this.weapon = 1;
+ this.netname = "shells";
+ this.size_min = '0 0 0';
+ this.size_max = '32 32 56';

- if (world.style)
- {
- // models courtesy Lunaran -- dumptruck_ds
- precache_body_model ("progs/ammo/m_shell1.mdl");
- body_model ("progs/ammo/m_shell1.mdl");
- }
- else
- {
- precache_body_model ("maps/b_shell0.bsp");
- body_model ("maps/b_shell0.bsp");
- }
+ // StartItem
+ super::init_spawned ();
+ };

- if !(self.particles_offset)
- self.particles_offset = '12 12 12';
- self.aflag = AMMO_SHELLS_SMALL;
- }
- self.weapon = 1;
- self.netname = "shells";
- setsize (self, '0 0 0', '32 32 56');
- StartItem ();
+ //--------------------------------------------------------------
+ void() item_shells =
+ {
+ this.classtype = CT_ITEM_AMMO_SHELLS;
+ };
};

/*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
@@ -188,60 +224,67 @@ void() item_shells =
Box of 25 nails.
LARGE_BOX is a box of 50 nails.
*/
-void() item_spikes =
+class item_spikes: base_item_ammo
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- self.touch = ammo_touch;
-
- if (self.spawnflags & WEAPON_BIG2)
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
{
- if (!self.mdl_body && world.n_lg_mdl)
- self.mdl_body = world.n_lg_mdl;
-
- if (world.style)
+ if (this.spawnflags & WEAPON_BIG2)
{
- // models courtesy Lunaran -- dumptruck_ds
- precache_body_model ("progs/ammo/m_nails2.mdl");
- body_model ("progs/ammo/m_nails2.mdl");
+ if (!this.mdl_body && world.n_lg_mdl)
+ this.mdl_body = world.n_lg_mdl;
+
+ if (world.style)
+ {
+ // models courtesy Lunaran -- dumptruck_ds
+ precache_body_model ("progs/ammo/m_nails2.mdl");
+ body_model ("progs/ammo/m_nails2.mdl");
+ }
+ else
+ {
+ precache_body_model ("maps/b_nail1.bsp");
+ body_model ("maps/b_nail1.bsp");
+ }
+
+ if !(this.particles_offset)
+ this.particles_offset = '16 16 16';
+ this.aflag = AMMO_NAILS_BIG;
}
else
{
- precache_body_model ("maps/b_nail1.bsp");
- body_model ("maps/b_nail1.bsp");
+ if (!this.mdl_body && world.n_sm_mdl)
+ this.mdl_body = world.n_sm_mdl;
+
+ if (world.style)
+ {
+ // models courtesy Lunaran -- dumptruck_ds
+ precache_body_model ("progs/ammo/m_nails1.mdl");
+ body_model ("progs/ammo/m_nails1.mdl");
+ }
+ else
+ {
+ precache_body_model ("maps/b_nail0.bsp");
+ body_model ("maps/b_nail0.bsp");
+ }
+
+ if !(this.particles_offset)
+ this.particles_offset = '12 12 12';
+ this.aflag = AMMO_NAILS_SMALL;
}
+ this.weapon = 2;
+ this.netname = "nails";
+ this.size_min = '0 0 0';
+ this.size_max = '32 32 56';

- if !(self.particles_offset)
- self.particles_offset = '16 16 16';
- self.aflag = AMMO_NAILS_BIG;
- }
- else
- {
- if (!self.mdl_body && world.n_sm_mdl)
- self.mdl_body = world.n_sm_mdl;
+ // StartItem
+ super::init_spawned ();
+ };

- if (world.style)
- {
- // models courtesy Lunaran -- dumptruck_ds
- precache_body_model ("progs/ammo/m_nails1.mdl");
- body_model ("progs/ammo/m_nails1.mdl");
- }
- else
- {
- precache_body_model ("maps/b_nail0.bsp");
- body_model ("maps/b_nail0.bsp");
- }
-
- if !(self.particles_offset)
- self.particles_offset = '12 12 12';
- self.aflag = AMMO_NAILS_SMALL;
- }
- self.weapon = 2;
- self.netname = "nails";
- setsize (self, '0 0 0', '32 32 56');
- StartItem ();
+ //--------------------------------------------------------------
+ void() item_spikes =
+ {
+ this.classtype = CT_ITEM_AMMO_SPIKES;
+ };
};

/*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
@@ -249,59 +292,67 @@ void() item_spikes =
model ( {{ spawnflags & 1 -> { "path" : "maps/b_rock1.bsp" }, "maps/b_rock0.bsp" }} );
}
*/
-void() item_rockets =
+class item_rockets: base_item_ammo
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- self.touch = ammo_touch;
-
- if (self.spawnflags & WEAPON_BIG2)
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
{
- if (!self.mdl_body && world.r_lg_mdl)
- self.mdl_body = world.r_lg_mdl;
-
- if (world.style)
+ if (this.spawnflags & WEAPON_BIG2)
{
- // models courtesy Lunaran -- dumptruck_ds
- precache_body_model ("progs/ammo/m_rock2.mdl");
- body_model ("progs/ammo/m_rock2.mdl");
+ if (!this.mdl_body && world.r_lg_mdl)
+ this.mdl_body = world.r_lg_mdl;
+
+ if (world.style)
+ {
+ // models courtesy Lunaran -- dumptruck_ds
+ precache_body_model ("progs/ammo/m_rock2.mdl");
+ body_model ("progs/ammo/m_rock2.mdl");
+ }
+ else
+ {
+ precache_body_model ("maps/b_rock1.bsp");
+ body_model ("maps/b_rock1.bsp");
+ }
+
+ this.particles_offset = '16 8 16';
+ this.aflag = AMMO_ROCKETS_BIG;
}
else
{
- precache_body_model ("maps/b_rock1.bsp");
- body_model ("maps/b_rock1.bsp");
+ if (!this.mdl_body && world.r_sm_mdl)
+ this.mdl_body = world.r_sm_mdl;
+
+ if (world.style)
+ {
+ // models courtesy Lunaran -- dumptruck_ds
+ precache_body_model ("progs/ammo/m_rock1.mdl");
+ body_model ("progs/ammo/m_rock1.mdl");
+ }
+ else
+ {
+ precache_body_model ("maps/b_rock0.bsp");
+ body_model ("maps/b_rock0.bsp");
+ }
+
+ if !(this.particles_offset)
+ this.particles_offset = '8 8 16';
+ this.aflag = AMMO_ROCKETS_SMALL;
}

- self.particles_offset = '16 8 16';
- self.aflag = AMMO_ROCKETS_BIG;
- }
- else
- {
- if (!self.mdl_body && world.r_sm_mdl)
- self.mdl_body = world.r_sm_mdl;
+ this.weapon = 3;
+ this.netname = "rockets";
+ this.size_min = '0 0 0';
+ this.size_max = '32 32 56';

- if (world.style)
- {
- // models courtesy Lunaran -- dumptruck_ds
- precache_body_model ("progs/ammo/m_rock1.mdl");
- body_model ("progs/ammo/m_rock1.mdl");
- }
- else
- {
- precache_body_model ("maps/b_rock0.bsp");
- body_model ("maps/b_rock0.bsp");
- }
+ // StartItem
+ super::init_spawned ();
+ };

- if !(self.particles_offset)
- self.particles_offset = '8 8 16';
- self.aflag = AMMO_ROCKETS_SMALL;
- }
- self.weapon = 3;
- self.netname = "rockets";
- setsize (self, '0 0 0', '32 32 56');
- StartItem ();
+ //--------------------------------------------------------------
+ void() item_rockets =
+ {
+ this.classtype = CT_ITEM_AMMO_ROCKETS;
+ };
};

/*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
@@ -311,58 +362,66 @@ void() item_rockets =
Box of 6 cells.
LARGE_BOX is a box of 12 cells.
*/
-void() item_cells =
+class item_cells: base_item_ammo
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- self.touch = ammo_touch;
-
- if (self.spawnflags & WEAPON_BIG2)
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
{
- if (!self.mdl_body && world.c_lg_mdl)
- self.mdl_body = world.c_lg_mdl;
-
- if (world.style)
+ if (this.spawnflags & WEAPON_BIG2)
{
- // models courtesy Lunaran -- dumptruck_ds
- precache_body_model ("progs/ammo/m_cells2.mdl");
- body_model ("progs/ammo/m_cells2.mdl");
+ if (!this.mdl_body && world.c_lg_mdl)
+ this.mdl_body = world.c_lg_mdl;
+
+ if (world.style)
+ {
+ // models courtesy Lunaran -- dumptruck_ds
+ precache_body_model ("progs/ammo/m_cells2.mdl");
+ body_model ("progs/ammo/m_cells2.mdl");
+ }
+ else
+ {
+ precache_body_model ("maps/b_batt1.bsp");
+ body_model ("maps/b_batt1.bsp");
+ }
+
+ if !(this.particles_offset)
+ this.particles_offset = '16 16 16';
+ this.aflag = AMMO_CELLS_BIG;
}
else
{
- precache_body_model ("maps/b_batt1.bsp");
- body_model ("maps/b_batt1.bsp");
+ if (!this.mdl_body && world.c_sm_mdl)
+ this.mdl_body = world.c_sm_mdl;
+
+ if (world.style)
+ {
+ // models courtesy Lunaran -- dumptruck_ds
+ precache_body_model ("progs/ammo/m_cells2.mdl");
+ body_model ("progs/ammo/m_cells2.mdl");
+ }
+ else
+ {
+ precache_body_model ("maps/b_batt0.bsp");
+ body_model ("maps/b_batt0.bsp");
+ }
+
+ if !(this.particles_offset)
+ this.particles_offset = '12 12 12';
+ this.aflag = AMMO_CELLS_SMALL;
}

- if !(self.particles_offset)
- self.particles_offset = '16 16 16';
- self.aflag = AMMO_CELLS_BIG;
- }
- else
- {
- if (!self.mdl_body && world.c_sm_mdl)
- self.mdl_body = world.c_sm_mdl;
+ this.weapon = 4;
+ this.netname = "cells";
+ this.size_min = '0 0 0';
+ this.size_max = '32 32 56';

- if (world.style)
- {
- // models courtesy Lunaran -- dumptruck_ds
- precache_body_model ("progs/ammo/m_cells2.mdl");
- body_model ("progs/ammo/m_cells2.mdl");
- }
- else
- {
- precache_body_model ("maps/b_batt0.bsp");
- body_model ("maps/b_batt0.bsp");
- }
+ // StartItem
+ super::init_spawned ();
+ };

- if !(self.particles_offset)
- self.particles_offset = '12 12 12';
- self.aflag = AMMO_CELLS_SMALL;
- }
- self.weapon = 4;
- self.netname = "cells";
- setsize (self, '0 0 0', '32 32 56');
- StartItem ();
+ //--------------------------------------------------------------
+ void() item_cells =
+ {
+ this.classtype = CT_ITEM_AMMO_CELLS;
+ };
};

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 f21e130..63fddb0 100644
--- a/qc/items/armor.qc
+++ b/qc/items/armor.qc
@@ -20,218 +20,85 @@ const float ARMOR_SHARD_AMOUNT = 5; // Q3 5
const float ARMOR_RESPAWN_SP = 30; // id1 30s
const float ARMOR_RESPAWN_DM = 20; // id1 20s

-//----------------------------------------------------------------------
-// shard_touch -- this is from RMQ shard_touch
-//----------------------------------------------------------------------
-void() shard_touch =
+//------------------------------------------------------------------------------
+class base_item_armor: base_item
{
- // from Copper -- dumptruck_ds
- if (!CheckValidTouch())
- return;
-
- local float bit;
-
- if ((other.items & IT_ARMOR1) || (other.items & IT_ARMOR2) ||
- (other.items & IT_ARMOR3))
+ //--------------------------------------------------------------
+ // was armor_touch -- CEV
+ //--------------------------------------------------------------
+ virtual void(entity toucher) do_touch =
{
- // 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)
+ local float type, value, bit;
+
+ if (this.classtype == CT_ITEM_ARMOR_GREEN)
{
- return;
+ // green armor
+ type = ARMOR_GREEN_ABSORB;
+ value = ARMOR_GREEN_AMOUNT;
+ bit = IT_ARMOR1;
}
-
- // was 2, RMQ team
- other.armorvalue = other.armorvalue + 5;
-
- // Supa, now cap armourvalue to bounds
- if (other.items & IT_ARMOR1 &&
- other.armorvalue >= ARMOR_GREEN_MAX)
+ else if (this.classtype == CT_ITEM_ARMOR_YELLOW)
{
- other.armorvalue = ARMOR_GREEN_MAX;
+ // yellow armor
+ type = ARMOR_YELLOW_ABSORB;
+ value = ARMOR_YELLOW_AMOUNT;
+ bit = IT_ARMOR2;
}
- else if (other.items & IT_ARMOR2 &&
- other.armorvalue >= ARMOR_YELLOW_MAX)
+ else if (this.classtype == CT_ITEM_ARMOR_RED)
{
- other.armorvalue = ARMOR_YELLOW_MAX;
+ // red armor
+ type = ARMOR_RED_ABSORB;
+ value = ARMOR_RED_AMOUNT;
+ bit = IT_ARMOR3;
}
- else if (other.items & IT_ARMOR3 &&
- other.armorvalue >= ARMOR_RED_MAX)
+ else
{
- other.armorvalue = ARMOR_RED_MAX;
+ dprint (sprintf("base_item_armor::do_touch: unknown "
+ "classname %s!\n", this.classname));
+ return;
}
- }
- 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 = string_null;
-
- // Supa, SP respawning items support
- if (!deathmatch)
- CheckItemRespawn (self, ARMOR_RESPAWN_SP);
- else if (deathmatch == 1)
- // doesn't respawn in "deathmatch 2"
- self.nextthink = time + ARMOR_RESPAWN_DM;
- self.think = SUB_Regen;
-
- if (self.obit_name != "")
- {
- sprint (other, "You got ");
- // custom armor name
- sprint (other, self.obit_name);
- sprint (other, "\n");
- }
- 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, 1, ATTN_NORM);
- else
- sound_misc (other, CHAN_AUTO,"items/armor_shard_q3.wav",
- 1, ATTN_NORM);
-
- // dumptruck_ds custom models and sounds END
- stuffcmd (other, "bf\n");
-
- activator = other;
-
- // fire all targets / killtargets
- SUB_UseTargets ();
-};
-
-//----------------------------------------------------------------------
-// armor_touch
-//----------------------------------------------------------------------
-void() armor_touch =
-{
- local float type, value, bit;
-
- // from Copper -- dumptruck_ds
- if (!CheckValidTouch())
- return;
-
- if (self.classname == "item_armor1")
- {
- // green armor
- type = ARMOR_GREEN_ABSORB;
- value = ARMOR_GREEN_AMOUNT;
- bit = IT_ARMOR1;
- }
- else if (self.classname == "item_armor2" ||
- self.classname == "item_armor_combat")
- {
- // yellow armor
- type = ARMOR_YELLOW_ABSORB;
- value = ARMOR_YELLOW_AMOUNT;
- bit = IT_ARMOR2;
- }
- else if (self.classname == "item_armorInv" ||
- self.classname == "item_armor_body")
- {
- // red armor
- type = ARMOR_RED_ABSORB;
- value = ARMOR_RED_AMOUNT;
- bit = IT_ARMOR3;
- }
- else
- {
- dprint ("WARNING: armor_touch: unknown classname: ");
- dprint (self.classname);
- dprint ("\n");
- 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;
+ if (toucher.armortype * toucher.armorvalue >= type * value)
+ return;

- self.solid = SOLID_NOT;
- self.model = string_null;
+ toucher.armortype = type;
+ toucher.armorvalue = value;

- // Supa, SP respawning items support
- if (!deathmatch)
- CheckItemRespawn (self, ARMOR_RESPAWN_SP);
- else if (deathmatch == 1)
- // doesn't respawn in "deathmatch 2"
- self.nextthink = time + ARMOR_RESPAWN_DM;
- self.think = SUB_Regen;
+ toucher.items = toucher.items - (toucher.items &
+ (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + bit;

- if (self.obit_name != "")
+ this.solid = SOLID_NOT;
+ this.model = string_null;
+ check_respawn (this, ARMOR_RESPAWN_SP, ARMOR_RESPAWN_DM);
+
+ if (this.obit_name != __NULL__ && this.obit_name != "")
+ // custom armor name
+ sprint (toucher, sprintf("You got %s\n",
+ this.obit_name));
+ else
+ sprint(toucher, "You got armor\n");
+
+ // armor touch sound
+ // dumptruck_ds custom models and sounds START
+ if (this.snd_misc != "")
+ sound_misc (toucher, CHAN_ITEM, this.snd_misc,
+ 1, ATTN_NORM);
+ else
+ sound_misc (toucher, CHAN_ITEM,"items/armor1.wav",
+ 1, ATTN_NORM);
+ // dumptruck_ds custom models and sounds END
+ stuffcmd (toucher, "bf\n");
+
+ activator = toucher;
+ // fire all targets / killtargets
+ sub_usetargets ();
+ };
+
+ //--------------------------------------------------------------
+ void() base_item_armor =
{
- sprint (other, "You got ");
- // custom armor name
- sprint (other, self.obit_name);
- sprint (other, "\n");
- }
- 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_ITEM, self.snd_misc, 1, ATTN_NORM);
- else
- sound_misc (other, CHAN_ITEM,"items/armor1.wav", 1, ATTN_NORM);
- // dumptruck_ds custom models and sounds END
- stuffcmd (other, "bf\n");
-
- activator = other;
- // fire all targets / killtargets
- SUB_UseTargets ();
-};
-
-//----------------------------------------------------------------------
-// item_armor_shard
-//----------------------------------------------------------------------
-void() item_armor_shard =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- if (!self.mdl_body && world.a_shr_mdl)
- self.mdl_body = world.a_shr_mdl;
-
- self.touch = shard_touch;
- // dumptruck_ds custom models and sounds START
- precache_body_model ("progs/armshr.mdl");
- // setmodel (self, "progs/armor.mdl");
- body_model ("progs/armshr.mdl");
- precache_sound_misc ("items/armor_shard_q3.wav");
- // dumptruck_ds custom models and sounds END
- if !(self.skin)
- self.skin = 0;
- setsize (self, '-16 -16 0', '16 16 56');
- StartItem ();
+ this.classgroup |= CG_ITEM_ARMOR;
+ };
};

/*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
@@ -239,51 +106,69 @@ void() item_armor_shard =
model ("progs/armor.mdl");
}
*/
-void() item_armor1 =
+class item_armor1: base_item_armor
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- if (!self.mdl_body && world.a_grn_mdl)
- self.mdl_body = world.a_grn_mdl;
-
- self.touch = armor_touch;
- // dumptruck_ds custom models and sounds START
- precache_body_model ("progs/armor.mdl");
- // setmodel (self, "progs/armor.mdl");
- body_model ("progs/armor.mdl");
- precache_sound_misc ("items/armor1.wav");
- // dumptruck_ds custom models and sounds END
- if !(self.skin)
- self.skin = 0;
- setsize (self, '-16 -16 0', '16 16 56');
- StartItem ();
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
+ {
+ if (!this.mdl_body && world.a_grn_mdl)
+ this.mdl_body = world.a_grn_mdl;
+
+ // dumptruck_ds custom models and sounds START
+ precache_body_model ("progs/armor.mdl");
+ // setmodel (this, "progs/armor.mdl");
+ body_model ("progs/armor.mdl");
+ precache_sound_misc ("items/armor1.wav");
+ // dumptruck_ds custom models and sounds END
+
+ if !(this.skin)
+ this.skin = 0;
+ this.size_min = '-16 -16 0';
+ this.size_max = '16 16 56';
+
+ // StartItem
+ super::init_spawned ();
+ };
+
+ //--------------------------------------------------------------
+ void() item_armor1 =
+ {
+ this.classtype = CT_ITEM_ARMOR_GREEN;
+ };
};

/*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 }); }
*/
-void() item_armor2 =
+class item_armor2: base_item_armor
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- if (!self.mdl_body && world.a_ylw_mdl)
- self.mdl_body = world.a_ylw_mdl;
-
- self.touch = armor_touch;
- // dumptruck_ds custom models and sounds START
- precache_body_model ("progs/armor.mdl");
- // setmodel (self, "progs/armor.mdl");
- body_model ("progs/armor.mdl");
- // dumptruck_ds custom models and sounds END
- if !(self.skin)
- self.skin = 1;
- precache_sound_misc ("items/armor1.wav");
- setsize (self, '-16 -16 0', '16 16 56');
- StartItem ();
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
+ {
+ if (!this.mdl_body && world.a_ylw_mdl)
+ this.mdl_body = world.a_ylw_mdl;
+
+ // dumptruck_ds custom models and sounds START
+ precache_body_model ("progs/armor.mdl");
+ // setmodel (this, "progs/armor.mdl");
+ body_model ("progs/armor.mdl");
+ // dumptruck_ds custom models and sounds END
+
+ if !(this.skin)
+ this.skin = 1;
+ precache_sound_misc ("items/armor1.wav");
+ this.size_min = '-16 -16 0';
+ this.size_max = '16 16 56';
+
+ // StartItem
+ super::init_spawned ();
+ };
+
+ //--------------------------------------------------------------
+ void() item_armor2 =
+ {
+ this.classtype = CT_ITEM_ARMOR_YELLOW;
+ };
};

/*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
@@ -291,24 +176,154 @@ void() item_armor2 =
model({ "path": ":progs/armor.mdl", "skin": 2 });
}
*/
-void() item_armorInv =
+class item_armorInv: base_item_armor
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- if (!self.mdl_body && world.a_red_mdl)
- self.mdl_body = world.a_red_mdl;
-
- self.touch = armor_touch;
- // dumptruck_ds custom models and sounds START
- precache_body_model ("progs/armor.mdl");
- // setmodel (self, "progs/armor.mdl");
- body_model ("progs/armor.mdl");
- // dumptruck_ds custom models and sounds END
- if !(self.skin)
- self.skin = 2;
- precache_sound_misc ("items/armor1.wav");
- setsize (self, '-16 -16 0', '16 16 56');
- StartItem ();
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
+ {
+ if (!this.mdl_body && world.a_red_mdl)
+ this.mdl_body = world.a_red_mdl;
+
+ // dumptruck_ds custom models and sounds START
+ precache_body_model ("progs/armor.mdl");
+ // setmodel (this, "progs/armor.mdl");
+ body_model ("progs/armor.mdl");
+ // dumptruck_ds custom models and sounds END
+
+ if !(this.skin)
+ this.skin = 2;
+ precache_sound_misc ("items/armor1.wav");
+ this.size_min = '-16 -16 0';
+ this.size_max = '16 16 56';
+
+ // StartItem
+ super::init_spawned ();
+ };
+
+ //--------------------------------------------------------------
+ void() item_armorInv =
+ {
+ this.classtype = CT_ITEM_ARMOR_RED;
+ };
+};
+
+//------------------------------------------------------------------------------
+// item_armor_shard
+//------------------------------------------------------------------------------
+class item_armor_shard: base_item_armor
+{
+ //--------------------------------------------------------------
+ // shard_touch -- this is from RMQ shard_touch
+ //--------------------------------------------------------------
+ virtual void(entity toucher) do_touch =
+ {
+
+ local float bit;
+
+ 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 + 5;
+
+ // 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;
+ }
+
+ this.solid = SOLID_NOT;
+ this.model = string_null;
+ check_respawn (this, ARMOR_RESPAWN_SP, ARMOR_RESPAWN_DM);
+
+ if (this.obit_name != __NULL__ && this.obit_name != "")
+ // custom armor name
+ sprint (toucher, sprintf("You got %s\n",
+ this.obit_name));
+ else
+ sprint(toucher, "You got armor\n");
+
+ // armor touch sound
+ // dumptruck_ds custom models and sounds START
+ if (this.snd_misc != "")
+ sound_misc (other, CHAN_AUTO, this.snd_misc,
+ 1, ATTN_NORM);
+ else
+ sound_misc (other, CHAN_AUTO,"items/armor_shard_q3.wav",
+ 1, ATTN_NORM);
+
+ // dumptruck_ds custom models and sounds END
+ stuffcmd (other, "bf\n");
+
+ // fire all targets / killtargets
+ activator = other;
+ sub_usetargets ();
+ };
+
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
+ {
+ if (!this.mdl_body && world.a_shr_mdl)
+ this.mdl_body = world.a_shr_mdl;
+
+ // dumptruck_ds custom models and sounds START
+ precache_body_model ("progs/armshr.mdl");
+ // setmodel (this, "progs/armor.mdl");
+ body_model ("progs/armshr.mdl");
+ precache_sound_misc ("items/armor_shard_q3.wav");
+ // dumptruck_ds custom models and sounds END
+
+ if !(this.skin)
+ this.skin = 0;
+ this.size_min = '-16 -16 0';
+ this.size_max = '16 16 56';
+
+ // StartItem
+ super::init_spawned ();
+ };
+
+ //--------------------------------------------------------------
+ void() item_armor_shard =
+ {
+ this.classtype = CT_ITEM_ARMOR_SHARD;
+ };
};

Return to the top of this page or return to the overview of this repo.

Diff qc/items/axe.qc

diff --git a/qc/items/axe.qc b/qc/items/axe.qc
deleted file mode 100644
index cd60080..0000000
--- a/qc/items/axe.qc
+++ /dev/null
@@ -1,88 +0,0 @@
-//==============================================================================
-// items/axe.qc -- Ranger's Axe
-//==============================================================================
-
-// constants
-const float AXE_ATTACK_COOLDOWN = 0.5; //
-
-// prototypes
-void() player_axe1;
-void() player_axeb1;
-void() player_axec1;
-void() player_axed1;
-
-//----------------------------------------------------------------------
-// W_FireAxe
-//----------------------------------------------------------------------
-void() W_FireAxe =
-{
- local vector source;
- local vector org;
-
- makevectors (self.v_angle);
- source = self.origin + '0 0 16';
- traceline (source, source + v_forward * 64, FALSE, self);
- if (trace_fraction == 1.0)
- return;
- org = trace_endpos - v_forward * 4;
-
- if (trace_ent.takedamage)
- {
- trace_ent.axhitme = 1;
- SpawnBlood (org, '0 0 0', 20);
- T_Damage (trace_ent, self, self, 20);
- }
- else
- { // hit wall
- sound (self, CHAN_WEAPON, "player/axhit2.wav", 1, ATTN_NORM);
- WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
- WriteByte (MSG_BROADCAST, TE_GUNSHOT);
- WriteCoord (MSG_BROADCAST, org_x);
- WriteCoord (MSG_BROADCAST, org_y);
- WriteCoord (MSG_BROADCAST, org_z);
- }
-};
-
-//----------------------------------------------------------------------
-void() weapon_axe_attack =
-{
- local float r = random ();
- sound (self, CHAN_WEAPON, "weapons/ax1.wav", 1, ATTN_NORM);
-
- if (r < 0.25)
- player_axe1 ();
- else if (r<0.5)
- player_axeb1 ();
- else if (r<0.75)
- player_axec1 ();
- else
- player_axed1 ();
-
- self.attack_finished = time + AXE_ATTACK_COOLDOWN;
-};
-
-//======================================================================
-// johnfitz new items -- dumptruck_ds from RRP and rubicon2
-//======================================================================
-
-/*QUAKED weapon_axe (0 .5 .8) (-16 -16 0) (16 16 32)
-Axe
-*/
-void() weapon_axe =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/g_axe.mdl");
- setmodel (self, "progs/g_axe.mdl");
- self.weapon = IT_AXE;
- self.netname = "Axe";
- self.touch = weapon_touch; // TODO CEV
- setsize (self, '-16 -16 0', '16 16 56');
- StartItem ();
-};
-
-//======================================================================
-// johnfitz
-//======================================================================

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 b5fed74..49f652a 100644
--- a/qc/items/backpacks.qc
+++ b/qc/items/backpacks.qc
@@ -8,123 +8,329 @@ const float BACKPACK_SHELLS = 2;
const float BACKPACK_NAILS = 4;
const float BACKPACK_ROCKETS = 8;
const float BACKPACK_CELLS = 16;
+const float BACKPACK_CUSTOM = 32;

-//----------------------------------------------------------------------
-void() BackpackTouch =
-{
- local string s;
- local float acount, best, old, new;
- local entity stemp;
+// Some of this text is from Drake -- dumptruck_ds

- // from Copper -- dumptruck_ds
- if (other.movetype == MOVETYPE_NOCLIP)
- return;
- if (other.classname != "player")
- return;
- if (other.health <= 0)
- return;
+/*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:
+
+10 Shells
+12 Nails
+2 Rockets
+3 Cells

- acount = 0;
- sprint (other, "You get ");
+Or you can use the spawnflags to mix and match types.
+Override the spawnflags defaults by adding custom amounts to:
+
+ammo_shells
+ammo_nails
+ammo_rockets
+ammo_cells
+
+Can trigger spawn and suspend in air, but not respawn. You can set a skin
+index if you are using a custom model with skins.
+
+The default pickup message is `You got a backpack.` But you can
+set a custom message with the netname key. 'You got' will be the prefix
+and the mapper chooses the rest of the message.

- if (self.items)
+e.g. For 'You got a bunch of rockets!' the netname key would be
+'a bunch of rockets!'
+*/
+class item_backpack: base_item
+{
+ //--------------------------------------------------------------
+ // DropBackpack
+ //--------------------------------------------------------------
+ static void(entity source) drop_backpack =
{
- if ((other.items & self.items) == 0)
+ local item_backpack pack;
+
+ if (!(source.ammo_shells + source.ammo_nails +
+ source.ammo_rockets + source.ammo_cells))
{
- acount = 1;
- sprint (other, "the ");
- sprint (other, self.netname);
+ // nothing in it
+ return;
}
- }

- // if the player was using his best weapon, change up to
- // the new one if better
- if (other.classname == "player" && autocvar(cg_autoswitch, TRUE))
+ pack = spawn (item_backpack, spawnflags: BACKPACK_CUSTOM);
+ pack.origin = source.origin - '0 0 24';
+
+ pack.items = source.weapon;
+
+ 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 = "";
+
+ pack.ammo_shells = source.ammo_shells;
+ pack.ammo_nails = source.ammo_nails;
+ pack.ammo_rockets = source.ammo_rockets;
+ pack.ammo_cells = source.ammo_cells;
+
+ pack.velocity_z = 300;
+ pack.velocity_x = -100 + (random() * 200);
+ pack.velocity_y = -100 + (random() * 200);
+
+ pack.flags = FL_ITEM;
+ pack.solid = SOLID_TRIGGER;
+ pack.movetype = MOVETYPE_TOSS;
+ precache_body_model ("progs/backpack.mdl");
+ setmodel (pack, "progs/backpack.mdl");
+ setsize (pack, '-16 -16 0', '16 16 56');
+
+ // remove after 2 minutes
+ pack.nextthink = time + 120;
+ pack.item_flags = ITEM_FLAG_REMOVE;
+ };
+
+ //--------------------------------------------------------------
+ virtual void(entity toucher) do_touch =
{
- stemp = self;
- self = other;
- best = PlayerBestWeapon ();
- self = stemp;
- }
+ if (this.spawnflags & BACKPACK_CUSTOM)
+ {
+ local string s;
+ local float acount, best, old, new;
+ local entity stemp;
+
+ // from Copper -- dumptruck_ds
+ if (other.movetype == MOVETYPE_NOCLIP)
+ return;
+ if (other.classname != "player")
+ return;
+ if (other.health <= 0)
+ return;
+
+ acount = 0;
+ sprint (other, "You get ");
+
+ if (this.items)
+ {
+ if ((other.items & this.items) == 0)
+ {
+ acount = 1;
+ sprint (other, "the ");
+ sprint (other, this.netname);
+ }
+ }
+
+ // 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 = REMOVEME_CallAsSelfFloat (other,
+ PlayerBestWeapon);
+ }
+
+ // change weapons
+ other.ammo_shells += this.ammo_shells;
+ other.ammo_nails += this.ammo_nails;
+ other.ammo_rockets += this.ammo_rockets;
+ other.ammo_cells += this.ammo_cells;
+
+ new = this.items;
+ if (!new)
+ new = other.weapon;
+ old = other.items;
+ other.items = other.items | new;
+
+ bound_other_ammo ();
+
+ // hack to fix an issue with custom Grunt, Ogre
+ // and Enf ammo types. - dumptruck_ds
+ // if (this.ammo_shells < 100)
+ if (this.ammo_shells)
+ {
+ if (acount)
+ sprint (other, ", ");
+ acount = 1;
+ s = ftos (this.ammo_shells);
+ sprint (other, s);
+ sprint (other, " shells");
+ }
+ if (this.ammo_nails)
+ {
+ if (acount)
+ sprint (other, ", ");
+ acount = 1;
+ s = ftos (this.ammo_nails);
+ sprint (other, s);
+ sprint (other, " nails");
+ }
+ if (this.ammo_rockets)
+ {
+ if (acount)
+ sprint (other, ", ");
+ acount = 1;
+ s = ftos (this.ammo_rockets);
+ sprint (other, s);
+ sprint (other, " rockets");
+ }
+ if (this.ammo_cells)
+ {
+ if (acount)
+ sprint (other, ", ");
+ acount = 1;
+ s = ftos (this.ammo_cells);
+ sprint (other, s);
+ sprint (other, " cells");
+ }
+
+ sprint (other, "\n");
+ // backpack touch sound
+ sound (other, CHAN_ITEM, "weapons/lock4.wav",
+ 1, 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)
+ this.weapon = new;
+ else
+ */
+ // 1997-12-23 Thunderbolt fix by Maddes end
+
+ /*
+ // TODO CEV
+ self = other;
+ Deathmatch_Weapon (old, new);
+ PlayerSetCurrentAmmo ();
+ */
+ }
+
+ // remove the backpack, change this to the player
+ remove (this);
+ }
+ else
+ {
+ // item_backpack_message -- CEV
+ other.ammo_shells += this.ammo_shells;
+ other.ammo_nails += this.ammo_nails;
+ other.ammo_rockets += this.ammo_rockets;
+ other.ammo_cells += this.ammo_cells;
+
+ if (this.netname != "")
+ {
+ sprint (other, "You got ");
+ sprint (other, this.netname);
+ sprint (other, "\n");
+ }
+ else
+ {
+ sprint (other, "You got a backpack!\n");
+ }
+
+ // backpack touch sound
+ // sound (other, CHAN_ITEM, "weapons/lock4.wav",
+ // 1, ATTN_NORM);
+ sound_misc (other, CHAN_ITEM, this.snd_misc,
+ 1, ATTN_NORM);
+ remove (this);
+
+ if (other.classtype == CT_PLAYER)
+ {
+ stuffcmd (other, "bf\n");
+ bound_other_ammo ();
+ REMOVEME_CallAsSelf (other,
+ PlayerSetCurrentAmmo);
+ }
+ }
+ };

- // change weapons
- other.ammo_shells = other.ammo_shells + self.ammo_shells;
- other.ammo_nails = other.ammo_nails + self.ammo_nails;
- other.ammo_rockets = other.ammo_rockets + self.ammo_rockets;
- other.ammo_cells = other.ammo_cells + self.ammo_cells;
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
+ {
+ /*
+ if (deathmatch)
+ {
+ remove (this);
+ return;
+ }
+ */

- new = self.items;
- if (!new)
- new = other.weapon;
- old = other.items;
- other.items = other.items | new;
+ this.flags = FL_ITEM;
+ this.solid = SOLID_TRIGGER;
+ this.movetype = MOVETYPE_TOSS;
+ // this.netname = this.netname;

- bound_other_ammo ();
+ if !(this.spawnflags)
+ {
+ objerror ("\bNO SPAWNFLAG SET ON item_backpack");
+ return;
+ }

- // 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)
- {
- if (acount)
- sprint (other, ", ");
- acount = 1;
- s = ftos (self.ammo_cells);
- sprint (other, s);
- sprint (other, " cells");
- }
+ if (this.spawnflags & BACKPACK_DEFAULT)
+ {
+ this.ammo_shells = 10;
+ this.ammo_nails = 12;
+ this.ammo_rockets = 2;
+ this.ammo_cells = 3;
+ }

- sprint (other, "\n");
- // backpack touch sound
- sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
- stuffcmd (other, "bf\n");
+ if (this.spawnflags & BACKPACK_SHELLS)
+ {
+ if !(this.ammo_shells)
+ this.ammo_shells = 10;
+ }
+ if (this.spawnflags & BACKPACK_NAILS)
+ {
+ if !(this.ammo_nails)
+ this.ammo_nails = 12;
+ }
+ if (this.spawnflags & BACKPACK_ROCKETS)
+ {
+ if !(this.ammo_rockets)
+ this.ammo_rockets = 2;
+ }
+ if (this.spawnflags & BACKPACK_CELLS)
+ {
+ if !(this.ammo_cells)
+ this.ammo_cells = 3;
+ }

- // remove the backpack, change self to the player
- remove (self);
- if (other.classname == "player")
+ // set the custom noise in editor -- dumptruck_ds
+ if !(this.snd_misc)
+ this.snd_misc = "weapons/lock4.wav";
+ precache_sound_misc (this.snd_misc);
+ precache_body_model ("progs/pd_bpack.mdl");
+ body_model ("progs/pd_bpack.mdl");
+ // setmodel (this, "progs/backpack.mdl");
+ this.size_min = '-16 -16 0';
+ this.size_max = '16 16 56';
+
+ // StartItem
+ super::init_spawned ();
+ };
+
+ //--------------------------------------------------------------
+ void() item_backpack =
{
- self = other;
-
- // 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
+ this.classname = "item_backpack";
+ this.classtype = CT_ITEM_BACKPACK;
+ };

- Deathmatch_Weapon (old, new);
- PlayerSetCurrentAmmo ();
- }
};

//======================================================================
@@ -142,6 +348,8 @@ void() BackpackTouch =
//----------------------------------------------------------------------
void() DropKey1 =
{
+ /*
+ TODO CEV
local entity item;

item = spawn ();
@@ -178,11 +386,14 @@ void() DropKey1 =
item.movetype = MOVETYPE_TOSS;
setsize (item, '-16 -16 0', '16 16 56');
item.touch = key_touch;
+ */
};

//----------------------------------------------------------------------
void() DropKey2 =
{
+ /*
+ TODO CEV
local entity item;

item = spawn ();
@@ -218,11 +429,14 @@ void() DropKey2 =
item.movetype = MOVETYPE_TOSS;
setsize (item, '-16 -16 0', '16 16 56');
item.touch = key_touch;
+*/
};

//----------------------------------------------------------------------
void() DropVial =
{
+ /*
+ TODO CEV
local entity item;

item = spawn ();
@@ -244,11 +458,14 @@ void() DropVial =
item.noise = "items/r_item1.wav";

StartItem ();
+ */
};

//----------------------------------------------------------------------
void() DropShard =
{
+ /*
+ TODO CEV
local entity item;

item = spawn ();
@@ -266,249 +483,5 @@ void() DropShard =
item.snd_misc = "dump/armsh1.wav";

StartItem ();
-};
-
-//----------------------------------------------------------------------
-void() DropStuff =
-{
- local float rand_drop;
-
- if (self.drop_item == 1)
- {
- DropKey1 ();
- }
- else if (self.drop_item == 2)
- {
- DropKey2 ();
- }
- else if (self.drop_item == 3)
- {
- DropVial ();
- }
- else if (self.drop_item == 4)
- {
- DropShard ();
- }
- else if (self.drop_item == 5)
- {
- DropVial ();
- DropShard ();
- }
- else if (self.drop_item == 6)
- {
- rand_drop = rint(random() * 3);
- if (rand_drop == 1)
- {
- DropShard ();
- DropVial ();
- DropVial ();
- }
- else if (rand_drop == 2)
- {
- DropShard ();
- DropShard ();
- DropVial ();
- }
- else if (rand_drop == 0)
- {
- DropShard ();
- DropShard ();
- DropShard ();
- }
- else
- {
- DropVial ();
- DropVial ();
- DropVial ();
- }
- }
-};
-
-//----------------------------------------------------------------------
-// DropBackpack
-//----------------------------------------------------------------------
-void() DropBackpack =
-{
- local entity item;
-
- if (!(self.ammo_shells + self.ammo_nails +
- self.ammo_rockets + self.ammo_cells))
- {
- // nothing in it
- return;
- }
-
- item = spawn ();
- item.origin = self.origin - '0 0 24';
-
- item.items = self.weapon;
- if (item.items == IT_AXE)
- item.netname = "Axe";
- else if (item.items == IT_SHOTGUN)
- item.netname = "Shotgun";
- else if (item.items == IT_SUPER_SHOTGUN)
- item.netname = "Double-barrelled Shotgun";
- else if (item.items == IT_NAILGUN)
- item.netname = "Nailgun";
- else if (item.items == IT_SUPER_NAILGUN)
- item.netname = "Super Nailgun";
- else if (item.items == IT_GRENADE_LAUNCHER)
- item.netname = "Grenade Launcher";
- else if (item.items == IT_ROCKET_LAUNCHER)
- item.netname = "Rocket Launcher";
- else if (item.items == IT_LIGHTNING)
- item.netname = "Thunderbolt";
- else
- item.netname = "";
-
- item.ammo_shells = self.ammo_shells;
- item.ammo_nails = self.ammo_nails;
- item.ammo_rockets = self.ammo_rockets;
- item.ammo_cells = self.ammo_cells;
-
- item.velocity_z = 300;
- item.velocity_x = -100 + (random() * 200);
- item.velocity_y = -100 + (random() * 200);
-
- item.flags = FL_ITEM;
- item.solid = SOLID_TRIGGER;
- item.movetype = MOVETYPE_TOSS;
- setmodel (item, "progs/backpack.mdl");
- setsize (item, '-16 -16 0', '16 16 56');
- item.touch = BackpackTouch;
-
- // remove after 2 minutes
- item.nextthink = time + 120;
- item.think = sub_remove;
-};
-
-//----------------------------------------------------------------------
-void() item_backpack_message =
-{
-
- // from Copper -- dumptruck_ds
- if (!CheckValidTouch())
- return;
-
- other.ammo_shells = other.ammo_shells + self.ammo_shells;
- other.ammo_nails = other.ammo_nails + self.ammo_nails;
- other.ammo_rockets = other.ammo_rockets + self.ammo_rockets;
- other.ammo_cells = other.ammo_cells + self.ammo_cells;
-
- if (self.netname != "")
- {
- sprint (other, "You got ");
- sprint (other, self.netname);
- sprint (other, "\n");
- }
- else
- {
- sprint (other, "You got a backpack!\n");
- }
-
- // backpack touch sound
- // sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
- sound_misc (other, CHAN_ITEM, self.snd_misc, 1, ATTN_NORM);
- remove (self);
-
- if (other.classname == "player")
- {
- stuffcmd (other, "bf\n");
- self = other;
- bound_other_ammo ();
- PlayerSetCurrentAmmo ();
- }
-};
-
-// Some of this text is from Drake -- dumptruck_ds
-/*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:
-
-10 Shells
-12 Nails
-2 Rockets
-3 Cells
-
-Or you can use the spawnflags to mix and match types.
-Override the spawnflags defaults by adding custom amounts to:
-
-ammo_shells
-ammo_nails
-ammo_rockets
-ammo_cells
-
-Can trigger spawn and suspend in air, but not respawn. You can set a skin
-index if you are using a custom model with skins.
-
-The default pickup message is `You got a backpack.` But you can
-set a custom message with the netname key. 'You got' will be the prefix
-and the mapper chooses the rest of the message.
-
-e.g. For 'You got a bunch of rockets!' the netname key would be
-'a bunch of rockets!'
-*/
-void() item_backpack =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- if (deathmatch)
- {
- remove (self);
- return;
- }
-
- self.flags = FL_ITEM;
- self.solid = SOLID_TRIGGER;
- self.movetype = MOVETYPE_TOSS;
- self.classname = "item_backpack";
- // self.netname = self.netname;
- if !(self.spawnflags)
- {
- objerror ("\bNO SPAWNFLAG SET ON item_backpack");
- return;
- }
-
- if (self.spawnflags & BACKPACK_DEFAULT)
- {
- self.ammo_shells = 10;
- self.ammo_nails = 12;
- self.ammo_rockets = 2;
- self.ammo_cells = 3;
- }
-
- if (self.spawnflags & BACKPACK_SHELLS)
- {
- if !(self.ammo_shells)
- self.ammo_shells = 10;
- }
- if (self.spawnflags & BACKPACK_NAILS)
- {
- if !(self.ammo_nails)
- self.ammo_nails = 12;
- }
- if (self.spawnflags & BACKPACK_ROCKETS)
- {
- if !(self.ammo_rockets)
- self.ammo_rockets = 2;
- }
- if (self.spawnflags & BACKPACK_CELLS)
- {
- if !(self.ammo_cells)
- self.ammo_cells = 3;
- }
-
- self.touch = item_backpack_message;
-
- // set the custom noise in editor -- dumptruck_ds
- if !(self.snd_misc)
- self.snd_misc = "weapons/lock4.wav";
- precache_sound_misc (self.snd_misc);
- precache_body_model ("progs/pd_bpack.mdl");
- body_model ("progs/pd_bpack.mdl");
- // setmodel (self, "progs/backpack.mdl");
- setsize (self, '-16 -16 0', '16 16 56');
- StartItem ();
+ */
};

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 cceb6a9..86ca373 100644
--- a/qc/items/health.qc
+++ b/qc/items/health.qc
@@ -2,9 +2,6 @@
// HEALTH BOXES
//==============================================================================

-// fields
-.float healamount, healtype;
-
// constants flags
const float HEALTH_ROTTEN = 1; // rotten health box
const float HEALTH_MEGA = 2; // megahealth
@@ -24,10 +21,6 @@ const float HEALTH_RESPAWN_DM = 20; // deathmatch respawn time; id1 20
const float HEALTH_RESPAWN_SP = 30; // singleplayer respawn time; id1 30
const float HEALTH_RESPAWN_MEGA = 125; // fixed mega respawn time; pd3 125

-// primitives
-void() health_touch;
-// void() item_megahealth_rot;
-
//----------------------------------------------------------------------
// T_Heal: add health to an entity, limiting health to max_health
// "ignore" will ignore max_health limit
@@ -49,6 +42,109 @@ float (entity e, float healamount, float ignore) T_Heal =
return 1;
};

+//------------------------------------------------------------------------------
+class base_item_health: base_item
+{
+ // fields
+ float healamount;
+ float healtype;
+
+ //--------------------------------------------------------------
+ virtual void(string fieldname, string fieldvalue) init_field =
+ {
+ switch (fieldname)
+ {
+ case "healamount":
+ healamount = stof (fieldvalue);
+ break;
+ case "healtype":
+ healtype = stof (fieldvalue);
+ break;
+ default:
+ super::init_field (fieldname, fieldvalue);
+ }
+ };
+
+ //--------------------------------------------------------------
+ // health_touch
+ //--------------------------------------------------------------
+ virtual void(entity toucher) do_touch =
+ {
+ local float amount;
+ local string s;
+ amount = this.healamount;
+
+ if (this.healtype == HEALTH_TYPE_MEGA)
+ {
+ // Megahealth? Ignore max_health...
+ if (other.health >= 250)
+ return;
+ if (!T_Heal(other, amount, 1))
+ return;
+ }
+ else
+ {
+ if (!T_Heal(other, amount, 0))
+ return;
+ }
+
+ sprint (other, sprintf("You receive %g health\n", amount));
+
+ // health touch sound
+ // sound (other, CHAN_ITEM, this.noise, 1, ATTN_NORM);
+ // custom sounds -- dumptruck_ds
+ sound_misc (other, CHAN_AUTO, this.noise, 1, ATTN_NORM);
+
+ stuffcmd (other, "bf\n");
+
+ this.model = string_null;
+ this.solid = SOLID_NOT;
+
+ // Megahealth = rot down the player's super health
+ if (this.healtype == HEALTH_TYPE_MEGA)
+ {
+ // thanks ydrol!!!
+ other.megahealth_rottime = time + 5;
+ other.items = other.items | IT_SUPERHEALTH;
+ this.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
+
+ check_respawn (this, HEALTH_RESPAWN_SP,
+ HEALTH_RESPAWN_MEGA);
+ }
+ else
+ {
+ check_respawn (this, HEALTH_RESPAWN_SP,
+ HEALTH_RESPAWN_DM);
+ }
+
+ // fire all targets / killtargets
+ activator = other;
+ sub_usetargets ();
+ };
+
+ //--------------------------------------------------------------
+ void() base_item_health =
+ {
+ this.classgroup |= CG_ITEM_HEALTH;
+ };
+};
+
/*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" },
@@ -59,227 +155,176 @@ Rotten box heals 15 points.
Megahealth will add 100 health, then start to
rot the player back down to 100 health after 5 seconds.
*/
-void() item_health =
+class item_health: base_item_health
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- self.touch = health_touch;
-
- if (self.spawnflags & HEALTH_ROTTEN)
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
{
- if (!self.mdl_body && world.h_15_mdl)
- self.mdl_body = world.h_15_mdl;
-
- // dumptruck_ds custom health models and sounds START
- if (world.style)
+ if (this.spawnflags & HEALTH_ROTTEN)
{
- // models courtesy Lunaran -- dumptruck_ds
- precache_body_model ("progs/health/m_h15.mdl");
- body_model ("progs/health/m_h15.mdl");
- }
- else
- {
- // setmodel(self, "maps/b_bh10.bsp");
- precache_body_model ("maps/b_bh10.bsp");
- body_model ("maps/b_bh10.bsp");
- }
+ if (!this.mdl_body && world.h_15_mdl)
+ this.mdl_body = world.h_15_mdl;

- // precache_sound("items/r_item1.wav");
- precache_sound_misc("items/r_item1.wav");
- // self.noise = "items/r_item1.wav";
- if !(self.snd_misc)
- //set the custom noise in editor -- dumptruck_ds
- self.snd_misc = "items/r_item1.wav";
- self.noise = self.snd_misc;
-
- // if !(self.healamount)
- // set your custom health amount here -- dumptruck_ds
- self.healamount = HEALTH_ROTTEN_AMOUNT;
- self.healtype = HEALTH_TYPE_ROTTEN;
- if !(self.particles_offset)
- self.particles_offset = '16 16 8';
- // dumptruck_ds custom health models and sounds END
- }
- else
- {
- if (self.spawnflags & HEALTH_MEGA)
- {
- if (!self.mdl_body && world.h_mega_mdl)
- self.mdl_body = world.h_mega_mdl;
- // precache_model("maps/b_bh100.bsp");
+ // dumptruck_ds custom health models and sounds START
if (world.style)
{
// models courtesy Lunaran -- dumptruck_ds
- precache_body_model ("progs/health/m_h100.mdl");
- body_model ("progs/health/m_h100.mdl");
+ precache_body_model ("progs/health/m_h15.mdl");
+ body_model ("progs/health/m_h15.mdl");
}
else
{
- // setmodel(self, "maps/b_bh100.bsp");
- precache_body_model ("maps/b_bh100.bsp");
- body_model ("maps/b_bh100.bsp");
+ // setmodel(this, "maps/b_bh10.bsp");
+ precache_body_model ("maps/b_bh10.bsp");
+ body_model ("maps/b_bh10.bsp");
}

- precache_sound_misc("items/r_item2.wav");
- // self.noise = "items/r_item2.wav";
- if !(self.snd_misc)
- //set the custom noise in editor -- dumptruck_ds
- self.snd_misc = "items/r_item2.wav";
- self.noise = self.snd_misc;
-
- // if !(self.healamount)
- // custom health amount -- dumptruck_ds
- self.healamount = HEALTH_MEGA_AMOUNT;
- self.healtype = HEALTH_TYPE_MEGA;
- if !(self.particles_offset)
- self.particles_offset = '16 16 16';
+ // precache_sound("items/r_item1.wav");
+ precache_sound_misc("items/r_item1.wav");
+ // this.noise = "items/r_item1.wav";
+ if !(this.snd_misc)
+ // set the custom noise in editor
+ // -- dumptruck_ds
+ this.snd_misc = "items/r_item1.wav";
+ this.noise = this.snd_misc;
+
+ // if !(this.healamount)
+ // set your custom health amount here
+ // -- dumptruck_ds
+
+ this.healamount = HEALTH_ROTTEN_AMOUNT;
+ this.healtype = HEALTH_TYPE_ROTTEN;
+ if !(this.particles_offset)
+ this.particles_offset = '16 16 8';
+ // dumptruck_ds custom health models and sounds END
}
else
{
- if (!self.mdl_body && world.h_25_mdl)
- self.mdl_body = world.h_25_mdl;
- if (world.style)
+ if (this.spawnflags & HEALTH_MEGA)
{
- // models courtesy Lunaran -- dumptruck_ds
- precache_body_model ("progs/health/m_h25.mdl");
- body_model ("progs/health/m_h25.mdl");
+ if (!this.mdl_body && world.h_mega_mdl)
+ this.mdl_body = world.h_mega_mdl;
+ // precache_model("maps/b_bh100.bsp");
+ if (world.style)
+ {
+ // models courtesy Lunaran
+ // -- dumptruck_ds
+ precache_body_model ("progs/health/"
+ "m_h100.mdl");
+ body_model ("progs/health/m_h100.mdl");
+ }
+ else
+ {
+ // setmodel(this, "maps/b_bh100.bsp");
+ precache_body_model ("maps/"
+ "b_bh100.bsp");
+ body_model ("maps/b_bh100.bsp");
+ }
+
+ precache_sound_misc("items/r_item2.wav");
+ // this.noise = "items/r_item2.wav";
+ if !(this.snd_misc)
+ // set the custom noise in editor
+ // -- dumptruck_ds
+ this.snd_misc = "items/r_item2.wav";
+ this.noise = this.snd_misc;
+
+ // if !(this.healamount)
+ // custom health amount
+ // -- dumptruck_ds
+
+ this.healamount = HEALTH_MEGA_AMOUNT;
+ this.healtype = HEALTH_TYPE_MEGA;
+ if !(this.particles_offset)
+ this.particles_offset = '16 16 16';
}
else
{
- precache_body_model ("maps/b_bh25.bsp");
- body_model ("maps/b_bh25.bsp");
+ if (!this.mdl_body && world.h_25_mdl)
+ this.mdl_body = world.h_25_mdl;
+ if (world.style)
+ {
+ // models courtesy Lunaran
+ // -- dumptruck_ds
+ precache_body_model ("progs/health/"
+ "m_h25.mdl");
+ body_model ("progs/health/m_h25.mdl");
+ }
+ else
+ {
+ precache_body_model ("maps/b_bh25.bsp");
+ body_model ("maps/b_bh25.bsp");
+ }
+ precache_sound_misc("items/health1.wav");
+ if !(this.snd_misc)
+ // set custom noise in editor
+ // -- dumptruck_ds
+ this.snd_misc = "items/health1.wav";
+ this.noise = this.snd_misc;
+
+ this.healamount = HEALTH_NORMAL_AMOUNT;
+ this.healtype = HEALTH_TYPE_NORMAL;
+ if !(this.particles_offset)
+ this.particles_offset = '16 16 8';
+ // dumptruck_ds custom health models and sounds
}
- precache_sound_misc("items/health1.wav");
- if !(self.snd_misc)
- // set custom noise in editor -- dumptruck_ds
- self.snd_misc = "items/health1.wav";
- self.noise = self.snd_misc;
-
- self.healamount = HEALTH_NORMAL_AMOUNT;
- self.healtype = HEALTH_TYPE_NORMAL;
- if !(self.particles_offset)
- self.particles_offset = '16 16 8';
- // dumptruck_ds custom health models and sounds END
}
- }
- setsize (self, '0 0 0', '32 32 56');
- StartItem ();
-};

-//----------------------------------------------------------------------
-// item_health_vial
-//----------------------------------------------------------------------
-void() item_health_vial =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- self.touch = health_touch;
-
- if (!self.mdl_body && world.h_vial_mdl)
- self.mdl_body = world.h_vial_mdl;
-
- // model from Hexen 2 -- dumptruck_ds
- precache_body_model ("progs/health/pd_vial.mdl");
- body_model ("progs/health/pd_vial.mdl");
- precache_sound_misc ("items/r_item1.wav");
- if !(self.snd_misc)
- // set the custom noise in editor -- dumptruck_ds
- self.snd_misc = "items/r_item1.wav";
- self.noise = self.snd_misc;
-
- self.healamount = HEALTH_VIAL_AMOUNT;
- // over heal and count down like mega health -- dumptruck_ds
- self.healtype = HEALTH_TYPE_MEGA;
- setsize (self, '-16 -16 0', '16 16 56');
- if !(self.particles_offset)
- self.particles_offset = '0 0 0';
- StartItem ();
+ this.size_min = '0 0 0';
+ this.size_max = '32 32 56';
+
+ // StartItem
+ super::init_spawned ();
+ };
+
+ //--------------------------------------------------------------
+ void() item_health =
+ {
+ this.classtype = CT_ITEM_HEALTH;
+ };
};

//----------------------------------------------------------------------
-// health_touch
+// item_health_vial
//----------------------------------------------------------------------
-void() health_touch =
+class item_health_vial: base_item_health
{
- local float amount;
- local string s;
- amount = self.healamount;
- // from Copper -- dumptruck_ds
- if (!CheckValidTouch())
- return;
-
- if (self.healtype == HEALTH_TYPE_MEGA)
- {
- // Megahealth? Ignore max_health...
- if (other.health >= 250)
- return;
- if (!T_Heal(other, amount, 1))
- return;
- }
- else
+ //--------------------------------------------------------------
+ static void() drop_vial =
{
- if (!T_Heal(other, amount, 0))
- return;
- }
-
- sprint (other, "You receive ");
- s = ftos (amount);
- sprint (other, s);
- sprint (other, " health\n");
-
- // health touch sound
- // sound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
- // custom sounds -- dumptruck_ds
- sound_misc (other, CHAN_AUTO, self.noise, 1, ATTN_NORM);
-
- stuffcmd (other, "bf\n");
-
- self.model = string_null;
- self.solid = SOLID_NOT;
-
- self.think = SUB_Regen;
+ };

- // Megahealth = rot down the player's super health
- if (self.healtype == HEALTH_TYPE_MEGA)
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
{
- // 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
- //
- if (!deathmatch)
- CheckItemRespawn (self, HEALTH_RESPAWN_SP);
- else if (deathmatch == 1)
- // doesn't respawn in "deathmatch 2"
- self.nextthink = time + HEALTH_RESPAWN_MEGA;
- }
- else
+ if (!this.mdl_body && world.h_vial_mdl)
+ this.mdl_body = world.h_vial_mdl;
+
+ // model from Hexen 2 -- dumptruck_ds
+ precache_body_model ("progs/health/pd_vial.mdl");
+ body_model ("progs/health/pd_vial.mdl");
+ precache_sound_misc ("items/r_item1.wav");
+ if !(this.snd_misc)
+ // set the custom noise in editor -- dumptruck_ds
+ this.snd_misc = "items/r_item1.wav";
+ this.noise = this.snd_misc;
+
+ this.healamount = HEALTH_VIAL_AMOUNT;
+ // over heal and count down like mega health -- dumptruck_ds
+ this.healtype = HEALTH_TYPE_MEGA;
+ this.size_min = '-16 -16 0';
+ this.size_max = '16 16 56';
+
+ if !(this.particles_offset)
+ this.particles_offset = '0 0 0';
+
+ // StartItem
+ super::init_spawned ();
+ };
+
+ //--------------------------------------------------------------
+ void() item_health_vial =
{
- if (!deathmatch)
- CheckItemRespawn (self, HEALTH_RESPAWN_SP);
- else if (deathmatch == 1)
- // doesn't respawn in "deathmatch 2"
- self.nextthink = time + HEALTH_RESPAWN_DM;
- }
-
- activator = other;
- // fire all targets / killtargets
- SUB_UseTargets ();
+ this.classtype = CT_ITEM_HEALTH_VIAL;
+ };
};

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 c437966..5a2f660 100644
--- a/qc/items/keys.qc
+++ b/qc/items/keys.qc
@@ -2,77 +2,282 @@
// KEYS
//==============================================================================

-//----------------------------------------------------------------------
-void() key_touch =
-{
- // from Copper -- dumptruck_ds
- if (!CheckValidTouch())
- return;
-
- // support for item_key_custom -- iw
- if (HasKeys(other, self.items, self.customkeys))
- return;
-
- sprint (other, "You got the ");
- sprint (other, self.netname);
- sprint (other,"\n");
+// Globals

- sound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
- stuffcmd (other, "bf\n");
+// The highest bitflag that will be assigned to a custom key.
+float FINAL_CUSTOM_KEY = 4194304;

- // support for item_key_custom -- iw
- GiveKeys (other, self.items, self.customkeys);
+// The highest bitflag that has been assigned to a custom key.
+float highest_custom_key;

- if (!coop)
+//------------------------------------------------------------------------------
+class temp_keydef: base_tempentity
+{
+ void() temp_keydef =
{
- self.solid = SOLID_NOT;
- self.model = string_null;
- }
-
- activator = other;
- // fix key items firing their targets multiple times in coop -- iw
- // SUB_UseTargets ();
- // fire all targets / killtargets
- SUB_UseAndForgetTargets ();
+ this.classname = "custom_key_def";
+ this.classtype = CT_TEMP_KEYDEF;
+ };
};

-//----------------------------------------------------------------------
-void() key_setsounds =
+//------------------------------------------------------------------------------
+class base_item_key: base_item
{
- // support for item_key_custom -- iw
- if (self.noise != "")
+ //==============================================================
+ // FUNCTIONS WHICH DEAL WITH KEY ITEM BITFLAGS AND NAMES
+ //==============================================================
+
+ /*
+ ================================================================
+ The functions below were created for progs_dump by Ian "iw" Walshaw,
+ January 2020.
+
+ They define functions which deal with the bitflags and names which
+ refer to the key items, including the new item_key_custom.
+
+ These functions are a dependency of the updated code for the key
+ items (in items.qc [now in items/keys.qc -- CEV]) and also the
+ updated code for unlockable entities (in keylock.qc).
+ ================================================================
+ */
+
+ //--------------------------------------------------------------
+ // SilverKeyName
+ //
+ // Return the name that should be used for the silver key as per
+ // world.worldtype. -- iw
+ //--------------------------------------------------------------
+ static string() silver_key_name =
{
- precache_sound (self.noise);
- return;
- }
-
- if (world.worldtype == WORLDTYPE_MEDIEVAL)
+ if (world.worldtype == WORLDTYPE_BASE)
+ return "silver keycard";
+ if (world.worldtype == WORLDTYPE_METAL)
+ return "silver runekey";
+ return "silver key";
+ };
+
+ //--------------------------------------------------------------
+ // GoldKeyName
+ //
+ // Return the name that should be used for the gold key as per
+ // world.worldtype. -- iw
+ //--------------------------------------------------------------
+ static string() gold_key_name =
{
- precache_sound ("misc/medkey.wav");
- self.noise = "misc/medkey.wav";
- }
- else if (world.worldtype == WORLDTYPE_METAL)
+ if (world.worldtype == WORLDTYPE_BASE)
+ return "gold keycard";
+ if (world.worldtype == WORLDTYPE_METAL)
+ return "gold runekey";
+ return "gold key";
+ };
+
+ //--------------------------------------------------------------
+ // FindCustomKeyDef
+ //
+ // If a custom_key_def entity exists which defines the custom key
+ // named key_name, then find and return it, otherwise return world.
+ //
+ // If a custom_key_def entity is returned, then the value of its
+ // customkeys field will be the bitflag that should be used to
+ // represent the custom key named key_name. -- iw
+ //--------------------------------------------------------------
+ static entity(string key_name) find_custom_keydef =
{
- precache_sound ("misc/runekey.wav");
- self.noise = "misc/runekey.wav";
- }
- else if (world.worldtype == WORLDTYPE_BASE)
+ local entity keydef;
+
+ keydef = findfloat (world, ::classtype, CT_TEMP_KEYDEF);
+ while (keydef != world)
+ {
+ if (keydef.netname == key_name)
+ return keydef;
+ keydef = findfloat(keydef, ::classtype, CT_TEMP_KEYDEF);
+ }
+ return world;
+ };
+
+ //--------------------------------------------------------------
+ // SpawnCustomKeyDef
+ //
+ // Spawn and return a new custom_key_def entity which will define
+ // the custom key named key_name.
+ //
+ // The value of the entity's customkeys field will be a bitflag
+ // which has not yet been used to represent a custom key. -- iw
+ //--------------------------------------------------------------
+ static entity(string key_name) spawn_custom_keydef =
{
- precache_sound2 ("misc/basekey.wav");
- self.noise = "misc/basekey.wav";
- }
-};
-
-//----------------------------------------------------------------------
-// key_start -- Finish initializing self as a key item. -- iw
-//----------------------------------------------------------------------
-void() key_start =
-{
- key_setsounds ();
- self.particles_offset = '0 0 18';
- self.touch = key_touch;
- setsize (self, '-16 -16 -24', '16 16 32');
- StartItem ();
+ local temp_keydef keydef;
+
+ if (highest_custom_key == FINAL_CUSTOM_KEY)
+ error ("too many custom keys");
+
+ if (highest_custom_key == 0)
+ highest_custom_key = 1;
+ else
+ highest_custom_key = highest_custom_key * 2;
+
+ keydef = spawn (temp_keydef,
+ netname: key_name,
+ customkeys: highest_custom_key);
+
+ return keydef;
+ };
+
+ //--------------------------------------------------------------
+ // CustomKeyFlag
+ //
+ // Return the bitflag that should be used to represent the custom
+ // key named key_name.
+ //
+ // More specifically, if this is the first time that this function
+ // has been called for the specified key_name, then return a bitflag
+ // which has not previously been returned by this function for
+ // anykey_name. Otherwise, return the same bitflag that was
+ // previously returned for the specified key_name. -- iw
+ //--------------------------------------------------------------
+ static float(string key_name) custom_key_flag =
+ {
+ local temp_keydef keydef;
+
+ keydef = find_custom_keydef (key_name);
+ if (keydef == world)
+ keydef = spawn_custom_keydef (key_name);
+ return keydef.customkeys;
+ };
+
+ //--------------------------------------------------------------
+ // HasKeys
+ //
+ // Return TRUE if the specified client has all of the non-custom
+ // keys represented by the flags and all of the custom keys
+ // represented by the custom_flags, otherwise return FALSE. -- iw
+ //--------------------------------------------------------------
+ static float(entity client, float flags, float custom_flags) has_keys =
+ {
+ return (client.items & flags) == flags &&
+ (client.customkeys & custom_flags) == custom_flags;
+ };
+
+ //--------------------------------------------------------------
+ // GiveKeys
+ //
+ // Give the specified client all of the non-custom keys represented
+ // by the item_flags and all of the custom keys represented by the
+ // customkey_flags. -- iw
+ //--------------------------------------------------------------
+ static void(entity client, float flags, float custom_flags) give_keys =
+ {
+ client.items = client.items | flags;
+ client.customkeys = client.customkeys | custom_flags;
+ };
+
+ //--------------------------------------------------------------
+ // GiveAllKeys
+ //
+ // Give the specified client the silver key, the gold key, and
+ // all of the custom keys that have been defined for the current
+ // map. -- iw
+ //--------------------------------------------------------------
+ static void(entity client) give_all_keys =
+ {
+ give_keys (client, IT_KEY1 | IT_KEY2,
+ highest_custom_key * 2 - 1);
+ };
+
+ //--------------------------------------------------------------
+ // RemoveKeys
+ //
+ // Remove all of the non-custom keys represented by the item_flags
+ // and all of the custom keys represented by the customkey_flags
+ // from the specified client's inventory. -- iw
+ //--------------------------------------------------------------
+ static void(entity client, float flags, float custom_flags)
+ remove_keys =
+ {
+ client.items = client.items - (client.items & flags);
+ client.customkeys = client.customkeys -
+ (client.customkeys & custom_flags);
+ };
+
+ //==============================================================
+ // End iw's excellent key handling functions (what was previously
+ // keydata.qc) -- CEV
+ //==============================================================
+
+ //--------------------------------------------------------------
+ // was key_touch -- CEV
+ //--------------------------------------------------------------
+ virtual void(entity toucher) do_touch =
+ {
+ // support for item_key_custom -- iw
+ if (has_keys(toucher, this.items, this.customkeys))
+ return;
+
+ sprint (toucher, sprintf("You got the %s\n", this.netname));
+
+ sound (toucher, CHAN_ITEM, this.noise, 1, ATTN_NORM);
+ stuffcmd (toucher, "bf\n");
+
+ // support for item_key_custom -- iw
+ give_keys (toucher, this.items, this.customkeys);
+
+ if (!coop)
+ {
+ this.solid = SOLID_NOT;
+ this.model = string_null;
+ }
+
+ activator = toucher;
+ // fix key items firing their targets multiple times in coop
+ // -- iw
+ // fire all targets / killtargets
+ sub_useandforgettargets ();
+ };
+
+ //--------------------------------------------------------------
+ // key_start -- Finish initializing self as a key item. -- iw
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
+ {
+ // key_setsounds
+ // support for item_key_custom -- iw
+ if (this.noise != "")
+ {
+ precache_sound (this.noise);
+ }
+ else
+ {
+ if (world.worldtype == WORLDTYPE_MEDIEVAL)
+ {
+ precache_sound ("misc/medkey.wav");
+ this.noise = "misc/medkey.wav";
+ }
+ else if (world.worldtype == WORLDTYPE_METAL)
+ {
+ precache_sound ("misc/runekey.wav");
+ this.noise = "misc/runekey.wav";
+ }
+ else if (world.worldtype == WORLDTYPE_BASE)
+ {
+ precache_sound2 ("misc/basekey.wav");
+ this.noise = "misc/basekey.wav";
+ }
+ }
+
+ // key_start
+ this.particles_offset = '0 0 18';
+ this.size_min = '-16 -16 -24';
+ this.size_max = '16 16 32';
+
+ // StartItem
+ super::init_spawned ();
+ };
+
+ //--------------------------------------------------------------
+ void() base_item_key =
+ {
+ this.classgroup |= CG_ITEM_KEY;
+ };
};

/*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
@@ -83,40 +288,47 @@ In order for keys to work you MUST set your map's worldtype to one of the follow
1: metal
2: base
*/
-void() item_key1 =
+class item_key1: base_item_key
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- if (world.worldtype == WORLDTYPE_MEDIEVAL)
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
{
- precache_body_model ("progs/w_s_key.mdl");
- body_model ("progs/w_s_key.mdl");
- }
- else if (world.worldtype == WORLDTYPE_METAL)
+ if (world.worldtype == WORLDTYPE_MEDIEVAL)
+ {
+ precache_body_model ("progs/w_s_key.mdl");
+ body_model ("progs/w_s_key.mdl");
+ }
+ else if (world.worldtype == WORLDTYPE_METAL)
+ {
+ precache_body_model ("progs/m_s_key.mdl");
+ body_model ("progs/m_s_key.mdl");
+ }
+ else if (world.worldtype == WORLDTYPE_BASE)
+ {
+ precache_body_model2 ("progs/b_s_key.mdl");
+ body_model ("progs/b_s_key.mdl");
+ }
+
+ if (this.keyname != "")
+ this.netname = this.keyname;
+ else
+ this.netname = silver_key_name ();
+
+ this.items = IT_KEY1;
+
+ // support for item_key_custom -- iw
+ this.customkeys = 0; // ignore any mapper-set value
+ this.noise = ""; // ignore any mapper-set value
+
+ // key_start
+ super::init_spawned ();
+ };
+
+ //--------------------------------------------------------------
+ void() item_key1 =
{
- precache_body_model ("progs/m_s_key.mdl");
- body_model ("progs/m_s_key.mdl");
- }
- else if (world.worldtype == WORLDTYPE_BASE)
- {
- precache_body_model2 ("progs/b_s_key.mdl");
- body_model ("progs/b_s_key.mdl");
- }
-
- if (self.keyname != "")
- self.netname = self.keyname;
- else
- self.netname = SilverKeyName ();
-
- self.items = IT_KEY1;
-
- // support for item_key_custom -- iw
- self.customkeys = 0; // ignore any mapper-set value
- self.noise = ""; // ignore any mapper-set value
-
- key_start ();
+ this.classtype = CT_ITEM_KEY1;
+ };
};

/*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
@@ -129,40 +341,47 @@ In order for keys to work you MUST set your map's worldtype to one of the follow
1: metal
2: base
*/
-void() item_key2 =
+class item_key2: base_item_key
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- if (world.worldtype == WORLDTYPE_MEDIEVAL)
- {
- precache_body_model ("progs/w_g_key.mdl");
- body_model ("progs/w_g_key.mdl");
- }
- else if (world.worldtype == WORLDTYPE_METAL)
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
{
- precache_body_model ("progs/m_g_key.mdl");
- body_model ("progs/m_g_key.mdl");
- }
- else if (world.worldtype == WORLDTYPE_BASE)
+ if (world.worldtype == WORLDTYPE_MEDIEVAL)
+ {
+ precache_body_model ("progs/w_g_key.mdl");
+ body_model ("progs/w_g_key.mdl");
+ }
+ else if (world.worldtype == WORLDTYPE_METAL)
+ {
+ precache_body_model ("progs/m_g_key.mdl");
+ body_model ("progs/m_g_key.mdl");
+ }
+ else if (world.worldtype == WORLDTYPE_BASE)
+ {
+ precache_body_model2 ("progs/b_g_key.mdl");
+ body_model ("progs/b_g_key.mdl");
+ }
+
+ if (this.keyname != "")
+ this.keyname = "";
+ else
+ this.netname = gold_key_name ();
+
+ this.items = IT_KEY2;
+
+ // support for item_key_custom -- iw
+ this.customkeys = 0; // ignore any mapper-set value
+ this.noise = ""; // ignore any mapper-set value
+
+ // key_start
+ super::init_spawned ();
+ };
+
+ //--------------------------------------------------------------
+ void() item_key2 =
{
- precache_body_model2 ("progs/b_g_key.mdl");
- body_model ("progs/b_g_key.mdl");
- }
-
- if (self.keyname != "")
- self.keyname = "";
- else
- self.netname = GoldKeyName ();
-
- self.items = IT_KEY2;
-
- // support for item_key_custom -- iw
- self.customkeys = 0; // ignore any mapper-set value
- self.noise = ""; // ignore any mapper-set value
-
- key_start ();
+ this.classtype = CT_ITEM_KEY2;
+ };
};

//======================================================================
@@ -200,35 +419,42 @@ The behavior of an item_key_custom should be as the player expects
that it will not appear as an icon in the player's status bar when
picked up. This is a limitation of the engine.
*/
-void() item_key_custom =
+class item_key_custom: base_item_key
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- if (self.keyname == "")
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
{
- objerror ("no keyname specified");
- return;
- }
-
- if (self.mdl == "")
+ if (this.keyname == "")
+ {
+ objerror ("no keyname specified");
+ return;
+ }
+
+ if (this.mdl == "")
+ {
+ objerror ("no mdl specified");
+ return;
+ }
+
+ precache_model (this.mdl);
+ setmodel (this, this.mdl);
+ // this should not be referenced again
+ this.mdl = "";
+
+ this.netname = this.keyname;
+ // this should not be referenced again
+ this.keyname = "";
+
+ this.items = 0; // ignore any mapper-set value
+ this.customkeys = custom_key_flag (this.netname);
+
+ // key_start
+ super::init_spawned ();
+ };
+
+ //--------------------------------------------------------------
+ void() item_key_custom =
{
- objerror ("no mdl specified");
- return;
- }
-
- precache_model (self.mdl);
- setmodel (self, self.mdl);
- // this should not be referenced again
- self.mdl = "";
-
- self.netname = self.keyname;
- // this should not be referenced again
- self.keyname = "";
-
- self.items = 0; // ignore any mapper-set value
- self.customkeys = CustomKeyFlag (self.netname);
-
- key_start ();
+ this.classtype = CT_ITEM_KEY_CUSTOM;
+ };
};

Return to the top of this page or return to the overview of this repo.

Diff qc/items/misc.qc

diff --git a/qc/items/misc.qc b/qc/items/misc.qc
deleted file mode 100644
index ad16b36..0000000
--- a/qc/items/misc.qc
+++ /dev/null
@@ -1,155 +0,0 @@
-//==============================================================================
-// items.qc
-//==============================================================================
-
-/* LIGHTS SHOULD BE 0 1 0 IN COLOR OTHER ITEMS SHOULD BE .8 .3 .4 IN COLOR */
-
-// fields
-.vector particles_offset;
-
-// constants
-const float ITEM_SPAWNSILENT = 32;
-const float ITEM_SPAWNED = 64;
-const float ITEM_SUSPENDED = 128;
-const float ITEM_RESPAWNDM = 16384;
-const float ITEM_DONTDROP = 8388608;
-
-// prototypes
-void (vector org) spawn_tfog;
-
-/*QUAKED noclass (0 0 0) (-8 -8 -8) (8 8 8)
-prints a warning message when spawned
-*/
-void() noclass =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- dprint ("noclass spawned at");
- dprint (vtos(self.origin));
- dprint ("\n");
- remove (self);
-};
-
-//----------------------------------------------------------------------
-// DelaySpawnItem -- this is from rmq-items.qc; Makes a SPAWNED item
-// ready for pickup on a trigger event - modified a bit -- dumptruck_ds
-//----------------------------------------------------------------------
-void() DelaySpawnItem =
-{
- self.solid = SOLID_TRIGGER;
- setmodel (self, self.mdl);
- setsize (self, self.pos1, self.pos2);
-
- if (!(self.spawnflags & ITEM_SPAWNSILENT))
- // SILENT, gb
- // sound (self, CHAN_VOICE, "items/itembk2.wav", 1, ATTN_NORM);
- spawn_tfog (self.origin + self.particles_offset);
-
- if (self.spawnflags & ITEM_SUSPENDED)
- self.movetype = MOVETYPE_FLY;
- else
- self.movetype = MOVETYPE_TOSS;
-
- self.use = sub_null;
-};
-
-//----------------------------------------------------------------------
-// RefreshHull -- Supa, restore old hull and lock movement
-//----------------------------------------------------------------------
-void() RefreshHull =
-{
- // dumptruck_ds -- fix for bounding boxes
- // setsize (self, self.dest, self.dest2);
- setsize (self, '0 0 0', '32 32 56');
-
- self.movetype = MOVETYPE_NONE;
- self.velocity = '0 0 0';
-};
-
-//----------------------------------------------------------------------
-// PlaceItem -- plants the object on the floor
-//----------------------------------------------------------------------
-void() PlaceItem =
-{
- // so it can be restored on respawn
- self.mdl = self.model;
-
- // make extra wide
- self.flags = FL_ITEM;
-
- self.solid = SOLID_TRIGGER;
- self.velocity = '0 0 0';
-
- if (self.spawnflags & ITEM_SUSPENDED)
- {
- // ijed Don't drop spawnflag
- self.movetype = MOVETYPE_FLY;
- }
- else
- {
- // 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 nice to remove this code entirely, because
- // progs_dump doesn't need it, and it breaks item_health's
- // collision with entities that have MOVETYPE_PUSH. However,
- // removing this code would cause some of the item_health
- // entities in some of the func_mapjamx maps to "fall out of the
- // level", because they're accidentally touching solid surfaces.
- // So, to maintain backwards-compatibility, this code has been
- // left in, but will only be run if one of the func_mapjamx maps
- // is being played. -- iw
- if (known_release == KNOWN_RELEASE_FUNC_MAPJAMX)
- {
- if (self.classname == "item_health")
- {
- // Supa, CTF
- // hacking around hull issues..
- // void hull for now
- setsize (self, '0 0 0', '0 0 0');
- self.think = RefreshHull;
- self.nextthink = time + 0.2;
- }
- }
-
- self.movetype = MOVETYPE_TOSS;
-
- if (!(self.spawnflags & ITEM_DONTDROP))
- {
- setorigin (self, self.origin + '0 0 6');
-
- if (!droptofloor())
- {
- print_self ("bonus item", "fell out of level");
- remove (self);
- return;
- }
- }
- }
-
- if ((self.spawnflags & ITEM_SPAWNED))
- {
- // SPAWNED, gb
- self.pos1 = self.mins;
- self.pos2 = self.maxs;
-
- self.model = "";
- self.solid = SOLID_NOT;
-
- if (self.spawnflags & ITEM_DONTDROP)
- self.movetype = MOVETYPE_NONE;
-
- self.use = DelaySpawnItem;
- }
-};
-
-//----------------------------------------------------------------------
-// StartItem -- Sets the clipping size and plants the object on the floor
-//----------------------------------------------------------------------
-void() StartItem =
-{
- // items start after other solids || was 0.2 -- dumptruck_ds
- self.nextthink = time + 0.3;
- self.think = PlaceItem;
-};

Return to the top of this page or return to the overview of this repo.

Diff qc/items/nailguns.qc

diff --git a/qc/items/nailguns.qc b/qc/items/nailguns.qc
deleted file mode 100644
index 3bc7fcb..0000000
--- a/qc/items/nailguns.qc
+++ /dev/null
@@ -1,46 +0,0 @@
-//==============================================================================
-// items/nailguns.qc -- nailgun weapons
-//==============================================================================
-
-// constants
-const float AMMO_NAILS_WP = 30; // nails on weapon pickup; id1 30
-
-/*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
-*/
-void() weapon_nailgun =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/g_nail.mdl");
- setmodel (self, "progs/g_nail.mdl");
- self.weapon = IT_NAILGUN;
- self.netname = "nailgun";
- self.touch = weapon_touch;
- setsize (self, '-16 -16 0', '16 16 56');
- self.particles_offset = '0 0 31';
- StartItem ();
-};
-
-/*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
-*/
-void() weapon_supernailgun =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/g_nail2.mdl");
- setmodel (self, "progs/g_nail2.mdl");
- self.weapon = IT_SUPER_NAILGUN;
- self.netname = "Super Nailgun";
- self.touch = weapon_touch;
- setsize (self, '-16 -16 0', '16 16 56');
- self.particles_offset = '0 0 34';
- StartItem ();
-};

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 7c73c85..55250ee 100644
--- a/qc/items/powerups.qc
+++ b/qc/items/powerups.qc
@@ -2,97 +2,86 @@
// items/powerups.qc -- POWERUPS
//==============================================================================

-//----------------------------------------------------------------------
-void() powerup_touch =
+//------------------------------------------------------------------------------
+class base_item_powerup: base_item
{
- // from Copper -- dumptruck_ds
- if (!CheckValidTouch())
- return;
-
- sprint (other, "You got the ");
- sprint (other, self.netname);
- sprint (other,"\n");
-
- /*
- if (deathmatch)
+ //--------------------------------------------------------------
+ virtual void(entity toucher) do_touch =
{
- self.mdl = self.model;
-
- if ((self.classname == "item_artifact_invulnerability") ||
- (self.classname == "item_artifact_invisibility"))
- self.nextthink = time + 60*5;
- else
- self.nextthink = time + 60;
-
- self.think = SUB_Regen;
- }
- */
-
- // Supa, SP respawning items support
- self.mdl = self.model;
- self.think = SUB_Regen;
+ local float delay_sp = 0;
+ local float delay_dm = 0;

- if (!deathmatch)
- {
- local float spawndelay;
+ sprint (other, sprintf("You got the %s\n", this.netname));

- if (self.classname == "item_artifact_invulnerability" ||
- self.classname == "item_artifact_invisibility")
+ if (!deathmatch)
{
- spawndelay = 300;
+ if (this.classtype == CT_ITEM_INVULNERABILITY ||
+ this.classtype == CT_ITEM_INVISIBILITY)
+ {
+ delay_sp = 300;
+ }
+ else
+ {
+ delay_sp = 60;
+ }
}
else
{
- spawndelay = 60;
+ if ((this.classtype == CT_ITEM_INVULNERABILITY) ||
+ (this.classtype == CT_ITEM_INVISIBILITY))
+ {
+ delay_dm = time + 60 * 5;
+ }
+ else
+ {
+ delay_dm = time + 60;
+ }
}

- CheckItemRespawn (self, spawndelay);
- }
- else
- {
- if ((self.classname == "item_artifact_invulnerability") ||
- (self.classname == "item_artifact_invisibility"))
+ sound (other, CHAN_VOICE, this.noise, 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+ other.items = other.items | this.items;
+
+ // do the apropriate action
+ if (this.classtype == CT_ITEM_ENVIROSUIT)
{
- self.nextthink = time + 60 * 5;
+ other.rad_time = 1;
+ other.radsuit_finished = time + 30;
}
- else
+
+ if (this.classtype == CT_ITEM_INVULNERABILITY)
+ {
+ other.invincible_time = 1;
+ other.invincible_finished = time + 30;
+ }
+ else if (this.classtype == CT_ITEM_INVISIBILITY)
+ {
+ other.invisible_time = 1;
+ other.invisible_finished = time + 30;
+ }
+ else if (this.classtype == CT_ITEM_QUAD)
{
- self.nextthink = time + 60;
+ other.super_time = 1;
+ other.super_damage_finished = time + 30;
}
- }

- sound (other, CHAN_VOICE, self.noise, 1, ATTN_NORM);
- stuffcmd (other, "bf\n");
- self.solid = SOLID_NOT;
- other.items = other.items | self.items;
- self.model = string_null;
+ // remove it in single player, or setup for respawning in DM
+ // Supa, SP respawning items support
+ this.mdl = this.model;
+ this.solid = SOLID_NOT;
+ this.model = string_null;
+ check_respawn (this, delay_sp, delay_dm);

- // do the apropriate action
- if (self.classname == "item_artifact_envirosuit")
- {
- other.rad_time = 1;
- other.radsuit_finished = time + 30;
- }
+ activator = other;
+ // fire all targets / killtargets
+ sub_usetargets ();
+ };

- if (self.classname == "item_artifact_invulnerability")
- {
- other.invincible_time = 1;
- other.invincible_finished = time + 30;
- }
- else if (self.classname == "item_artifact_invisibility")
- {
- other.invisible_time = 1;
- other.invisible_finished = time + 30;
- }
- else if (self.classname == "item_artifact_super_damage")
+ //--------------------------------------------------------------
+ void() base_item_powerup =
{
- other.super_time = 1;
- other.super_damage_finished = time + 30;
- }
-
- activator = other;
- // fire all targets / killtargets
- SUB_UseTargets ();
+ this.classgroup |= CG_ITEM_POWERUP;
+ };
};

/*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
@@ -100,33 +89,39 @@ void() powerup_touch =
Pentagram of Protection
Player is invulnerable for 30 seconds
*/
-void() item_artifact_invulnerability =
+class item_artifact_invulnerability: base_item_powerup
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- self.touch = powerup_touch;
-
- // precache_model ("progs/invulner.mdl");
- precache_body_model ("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");
- self.noise = "items/protect.wav";
- // setmodel (self, "progs/invulner.mdl");
- body_model ("progs/invulner.mdl");
- self.netname = "Pentagram of Protection";
- self.items = IT_INVULNERABILITY;
- setsize (self, '-16 -16 -24', '16 16 32');
-
- // t_fog fix for custom models dumptruck_ds
- if !(self.particles_offset)
- self.particles_offset = '0 0 16';
-
- StartItem ();
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
+ {
+ // precache_model ("progs/invulner.mdl");
+ precache_body_model ("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");
+ this.noise = "items/protect.wav";
+ // setmodel (this, "progs/invulner.mdl");
+ body_model ("progs/invulner.mdl");
+ this.netname = "Pentagram of Protection";
+ this.items = IT_INVULNERABILITY;
+ this.size_min = '-16 -16 -24';
+ this.size_max = '16 16 32';
+
+ // t_fog fix for custom models dumptruck_ds
+ if !(this.particles_offset)
+ this.particles_offset = '0 0 16';
+
+ // StartItem
+ super::init_spawned ();
+ };
+
+ //--------------------------------------------------------------
+ void() item_artifact_invulnerability =
+ {
+ this.classtype = CT_ITEM_INVULNERABILITY;
+ };
};

/*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
@@ -134,29 +129,35 @@ void() item_artifact_invulnerability =
Biosuit
Player takes no damage from water or slime for 30 seconds
*/
-void() item_artifact_envirosuit =
+class item_artifact_envirosuit: base_item_powerup
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- self.touch = powerup_touch;
-
- precache_body_model ("progs/suit.mdl");
- precache_sound ("items/suit.wav");
- precache_sound ("items/suit2.wav");
- self.noise = "items/suit.wav";
- // setmodel (self, "progs/suit.mdl");
- body_model ("progs/suit.mdl");
- self.netname = "Biosuit";
- self.items = IT_SUIT;
- setsize (self, '-16 -16 -24', '16 16 32');
-
- // t_fog fix for custom models dumptruck_ds
- if !(self.particles_offset)
- self.particles_offset = '0 0 32';
-
- StartItem ();
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
+ {
+ precache_body_model ("progs/suit.mdl");
+ precache_sound ("items/suit.wav");
+ precache_sound ("items/suit2.wav");
+ this.noise = "items/suit.wav";
+ // setmodel (this, "progs/suit.mdl");
+ body_model ("progs/suit.mdl");
+ this.netname = "Biosuit";
+ this.items = IT_SUIT;
+ this.size_min = '-16 -16 -24';
+ this.size_max = '16 16 32';
+
+ // t_fog fix for custom models dumptruck_ds
+ if !(this.particles_offset)
+ this.particles_offset = '0 0 32';
+
+ // StartItem
+ super::init_spawned ();
+ };
+
+ //--------------------------------------------------------------
+ void() item_artifact_envirosuit =
+ {
+ this.classtype = CT_ITEM_ENVIROSUIT;
+ };
};

/*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
@@ -164,30 +165,36 @@ void() item_artifact_envirosuit =
Ring of Shadows
Player is invisible for 30 seconds
*/
-void() item_artifact_invisibility =
+class item_artifact_invisibility: base_item_powerup
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- self.touch = powerup_touch;
-
- precache_body_model ("progs/invisibl.mdl");
- precache_sound ("items/inv1.wav");
- precache_sound ("items/inv2.wav");
- precache_sound ("items/inv3.wav");
- self.noise = "items/inv1.wav";
- // setmodel (self, "progs/invisibl.mdl");
- body_model ("progs/invisibl.mdl");
- self.netname = "Ring of Shadows";
- self.items = IT_INVISIBILITY;
- setsize (self, '-16 -16 -24', '16 16 32');
-
- // t_fog fix for custom models dumptruck_ds
- if !(self.particles_offset)
- self.particles_offset = '0 0 0';
-
- StartItem ();
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
+ {
+ precache_body_model ("progs/invisibl.mdl");
+ precache_sound ("items/inv1.wav");
+ precache_sound ("items/inv2.wav");
+ precache_sound ("items/inv3.wav");
+ this.noise = "items/inv1.wav";
+ // setmodel (this, "progs/invisibl.mdl");
+ body_model ("progs/invisibl.mdl");
+ this.netname = "Ring of Shadows";
+ this.items = IT_INVISIBILITY;
+ this.size_min = '-16 -16 -24';
+ this.size_max = '16 16 32';
+
+ // t_fog fix for custom models dumptruck_ds
+ if !(this.particles_offset)
+ this.particles_offset = '0 0 0';
+
+ // StartItem
+ super::init_spawned ();
+ };
+
+ //--------------------------------------------------------------
+ void() item_artifact_invisibility =
+ {
+ this.classtype = CT_ITEM_INVISIBILITY;
+ };
};

/*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
@@ -195,31 +202,37 @@ void() item_artifact_invisibility =
Quad Damage
Player does 4x damage for 30 seconds
*/
-void() item_artifact_super_damage =
+class item_artifact_super_damage: base_item_powerup
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- self.touch = powerup_touch;
-
- precache_body_model ("progs/quaddama.mdl");
- precache_sound ("items/damage.wav");
- precache_sound ("items/damage3.wav");
- self.noise = "items/damage.wav";
- // setmodel (self, "progs/quaddama.mdl");
- body_model ("progs/quaddama.mdl");
-
- // custom name -- dumptruck_ds
- if !(self.netname)
- self.netname = "Quad Damage";
-
- self.items = IT_QUAD;
- setsize (self, '-16 -16 -24', '16 16 32');
-
- // t_fog fix for custom models dumptruck_ds
- if !(self.particles_offset)
- self.particles_offset = '0 0 16';
-
- StartItem ();
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
+ {
+ precache_body_model ("progs/quaddama.mdl");
+ precache_sound ("items/damage.wav");
+ precache_sound ("items/damage3.wav");
+ this.noise = "items/damage.wav";
+ // setmodel (this, "progs/quaddama.mdl");
+ body_model ("progs/quaddama.mdl");
+
+ // custom name -- dumptruck_ds
+ if !(this.netname)
+ this.netname = "Quad Damage";
+
+ this.items = IT_QUAD;
+ this.size_min = '-16 -16 -24';
+ this.size_max = '16 16 32';
+
+ // t_fog fix for custom models dumptruck_ds
+ if !(this.particles_offset)
+ this.particles_offset = '0 0 16';
+
+ // StartItem
+ super::init_spawned ();
+ };
+
+ //--------------------------------------------------------------
+ void() item_artifact_super_damage =
+ {
+ this.classtype = CT_ITEM_QUAD;
+ };
};

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 541baf5..49cbbf3 100644
--- a/qc/items/runes.qc
+++ b/qc/items/runes.qc
@@ -2,52 +2,59 @@
// END OF LEVEL RUNES
//==============================================================================

-//----------------------------------------------------------------------
-void() sigil_touch =
+//------------------------------------------------------------------------------
+class base_item_rune: base_item
{
- // from Copper -- dumptruck_ds
- if (!CheckValidTouch())
- return;
-
- centerprint (other, "You got the rune!");
-
- sound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
- stuffcmd (other, "bf\n");
- self.solid = SOLID_NOT;
- self.model = string_null;
- serverflags = serverflags | (self.spawnflags & 15);
- // so rune doors won't find it
- self.classname = "";
-
- activator = other;
- // fire all targets / killtargets
- SUB_UseTargets ();
-};
-
-//----------------------------------------------------------------------
-// sigil_touch2 -- replacement for Skill Select Rune hack
-// uses info_player_start2 if spawnflag 16 -- dumptruck_ds
-//----------------------------------------------------------------------
-void() sigil_touch2 =
-{
- if (other.classname != "player")
- return;
- if (other.health <= 0)
- return;
-
- // centerprint (other, "You got the rune!");
-
- // sound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
- // stuffcmd (other, "bf\n");
- self.solid = SOLID_NOT;
- self.model = string_null;
- serverflags = serverflags | (self.spawnflags & 16);
- // so rune doors won't find it
- self.classname = "";
-
- activator = other;
- // fire all targets / killtargets
- // SUB_UseTargets ();
+ //--------------------------------------------------------------
+ // sigil_touch2 -- replacement for Skill Select Rune hack
+ // uses info_player_start2 if spawnflag 16 -- dumptruck_ds
+ //--------------------------------------------------------------
+ static void(base_mapentity bme, entity toucher) sigil_touch2 =
+ {
+ if (toucher.classtype != CT_PLAYER)
+ return;
+ if (toucher.health <= 0)
+ return;
+
+ // centerprint (other, "You got the rune!");
+
+ // sound (other, CHAN_ITEM, this.noise, 1, ATTN_NORM);
+ // stuffcmd (other, "bf\n");
+ bme.solid = SOLID_NOT;
+ bme.model = string_null;
+ serverflags = serverflags | (bme.spawnflags & 16);
+ // so rune doors won't find it
+ bme.classname = "";
+
+ activator = toucher;
+ // fire all targets / killtargets
+ // SUB_UseTargets ();
+ };
+
+ //--------------------------------------------------------------
+ virtual void(entity toucher) do_touch =
+ {
+ centerprint (other, "You got the rune!");
+
+ sound (other, CHAN_ITEM, this.noise, 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+ this.solid = SOLID_NOT;
+ this.model = string_null;
+ serverflags = serverflags | (this.spawnflags & 15);
+ // so rune doors won't find it
+ this.classname = "";
+
+ activator = other;
+ // fire all targets / killtargets
+ sub_usetargets ();
+ };
+
+ //--------------------------------------------------------------
+ void() base_item_rune =
+ {
+ // not enough subclasses for this to be necessary -- CEV
+ // this.classgroup |= CG_ITEM_RUNE;
+ };
};

/*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
@@ -63,44 +70,53 @@ Episode 2 - The Realm of Black Magic - Rune of Black Magic
Episode 3 - The Netherworld - Rune of Hell Magic
Episode 4 - The Elder World - Run of Elder Magic
*/
-void() item_sigil =
+class item_sigil: base_item_rune
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- if (!self.spawnflags)
- objerror ("no spawnflags");
-
- precache_sound ("misc/runekey.wav");
- self.noise = "misc/runekey.wav";
-
- if (self.spawnflags & 1)
- {
- precache_model ("progs/end1.mdl");
- setmodel (self, "progs/end1.mdl");
- }
-
- if (self.spawnflags & 2)
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
{
- precache_model2 ("progs/end2.mdl");
- setmodel (self, "progs/end2.mdl");
- }
-
- if (self.spawnflags & 4)
- {
- precache_model2 ("progs/end3.mdl");
- setmodel (self, "progs/end3.mdl");
- }
-
- if (self.spawnflags & 8)
+ if (!this.spawnflags)
+ objerror ("no spawnflags");
+
+ precache_sound ("misc/runekey.wav");
+ this.noise = "misc/runekey.wav";
+
+ if (this.spawnflags & 1)
+ {
+ precache_model ("progs/end1.mdl");
+ setmodel (this, "progs/end1.mdl");
+ }
+
+ if (this.spawnflags & 2)
+ {
+ precache_model2 ("progs/end2.mdl");
+ setmodel (this, "progs/end2.mdl");
+ }
+
+ if (this.spawnflags & 4)
+ {
+ precache_model2 ("progs/end3.mdl");
+ setmodel (this, "progs/end3.mdl");
+ }
+
+ if (this.spawnflags & 8)
+ {
+ precache_model2 ("progs/end4.mdl");
+ setmodel (this, "progs/end4.mdl");
+ }
+
+ this.size_min = '-16 -16 -24';
+ this.size_max = '16 16 32';
+
+ this.particles_offset = '0 0 18';
+
+ // StartItem
+ super::init_spawned ();
+ };
+
+ //--------------------------------------------------------------
+ void() item_sigil =
{
- precache_model2 ("progs/end4.mdl");
- setmodel (self, "progs/end4.mdl");
- }
-
- self.touch = sigil_touch;
- setsize (self, '-16 -16 -24', '16 16 32');
- self.particles_offset = '0 0 18';
- StartItem ();
+ this.classtype = CT_ITEM_RUNE;
+ };
};

Return to the top of this page or return to the overview of this repo.

Diff qc/items/shotguns.qc

diff --git a/qc/items/shotguns.qc b/qc/items/shotguns.qc
deleted file mode 100644
index 0b9b898..0000000
--- a/qc/items/shotguns.qc
+++ /dev/null
@@ -1,59 +0,0 @@
-//==============================================================================
-// items/shotguns.qc -- shotgun weapons
-//==============================================================================
-
-// constants
-const float AMMO_SHELLS_WP = 5; // shells on weapon pickup; id1 5
-
-//======================================================================
-// johnfitz new items -- dumptruck_ds from RRP and rubicon2
-//======================================================================
-
-/*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.
-Single-barrelled Shotgun
-Shotgun
-*/
-void() weapon_shotgun =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/g_shotgu.mdl");
- // new shotgun model by Starshipwaters
- // - dumptruck_ds - removed 2 older shotguns that used spawnflags
- setmodel (self, "progs/g_shotgu.mdl");
- self.weapon = IT_SHOTGUN;
- self.netname = "Shotgun";
- self.touch = weapon_touch;
- setsize (self, '-16 -16 0', '16 16 56');
- StartItem ();
-};
-
-//======================================================================
-// johnfitz
-//======================================================================
-
-/*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
-*/
-void() weapon_supershotgun =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/g_shot.mdl");
- setmodel (self, "progs/g_shot.mdl");
- self.weapon = IT_SUPER_SHOTGUN;
- self.netname = "Double-barrelled Shotgun";
- self.touch = weapon_touch;
- setsize (self, '-16 -16 0', '16 16 56');
- self.particles_offset = '0 0 33';
- StartItem ();
-};
-
-

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 876b69f..05ba4de 100644
--- a/qc/items/weapons.qc
+++ b/qc/items/weapons.qc
@@ -4,10 +4,20 @@

// constants
const float AMMO_CELLS_WP = 15; // cells on weapon pickup; id1 15
+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 WEAPON_RESPAWN_TIME = 30; // as the name suggests; id1 30

+const float AXE_ATTACK_COOLDOWN = 0.5; //
+
+// prototypes
+void() player_axe1;
+void() player_axeb1;
+void() player_axec1;
+void() player_axed1;
+
//----------------------------------------------------------------------
void() bound_other_ammo =
{
@@ -57,225 +67,485 @@ void(float old, float new) Deathmatch_Weapon =
self.weapon = new;
};

-//----------------------------------------------------------------------
-// weapon_touch
-//----------------------------------------------------------------------
-void() weapon_touch =
+void(entity doas, float old, float new) REMOVEME_CallAsSelf_DeathmatchWeapon =
{
- local float hadammo, best, new, old;
local entity stemp;
- local float leave;

- // from Copper -- dumptruck_ds
- if (!CheckValidTouch())
- return;
-
- if (!(other.flags & FL_CLIENT))
- return;
+ stemp = self;
+ self = doas;
+ Deathmatch_Weapon (old, new);
+ self = stemp;
+};

- // if the player was using his best weapon, change up to the
- // new one if better
- if (other.classname == "player" && autocvar(cg_autoswitch, TRUE))
+//------------------------------------------------------------------------------
+class base_item_weapon: base_item
+{
+ //--------------------------------------------------------------
+ // weapon_touch
+ //--------------------------------------------------------------
+ virtual void(entity toucher) do_touch =
{
- stemp = self;
- self = other;
- best = PlayerBestWeapon ();
- self = stemp;
- }
+ local float hadammo, best, new, old;
+ local entity stemp;
+ local float leave;
+
+ 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))
+ {
+ dprint ("base_item_weapon::do_touch: PlayerBestWeapon"
+ "()\n");
+ best = REMOVEME_CallAsSelfFloat (other,
+ PlayerBestWeapon);
+ }
+
+ 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;
+ }
+
+ // johnfitz added for axe, shotgun items
+ // -- dumptruck_ds from RRP / rubicon2
+ if (this.classtype == CT_ITEM_AXE)
+ {
+ if (leave && (other.items & IT_AXE))
+ return;
+ new = IT_AXE;
+ }
+ else if (this.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 (this.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 (this.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 (this.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 (this.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 (this.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 (this.classtype == CT_ITEM_LIGHTNING_GUN)
+ {
+ if (leave && (other.items & IT_LIGHTNING))
+ return;
+ hadammo = other.ammo_rockets;
+ new = IT_LIGHTNING;
+ other.ammo_cells += AMMO_CELLS_WP;
+ }
+ else
+ {
+ objerror ("base_item_weapon::do_touch: "
+ "unknown classtype");
+ return;
+ }
+
+ sprint (other, sprintf("You got the %s\n", this.netname));
+ // weapon touch sound
+ sound (other, CHAN_ITEM, "weapons/pkup.wav", 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+
+ bound_other_ammo ();
+
+ // change to the weapon
+ old = other.items;
+ other.items = other.items | new;
+
+ if (other.classtype == CT_PLAYER &&
+ autocvar(cg_autoswitch, TRUE))
+ {
+ // 1997-12-23 Thunderbolt fix by Maddes start
+ /*
+ // don't separate between SinglePlayer/Coop
+ // and Deathmatch
+ if (!deathmatch)
+ this.weapon = new;
+ else
+ */
+ // 1997-12-23 Thunderbolt fix by Maddes end
+ REMOVEME_CallAsSelf_DeathmatchWeapon (other, old, new);
+ REMOVEME_CallAsSelf (other, PlayerSetCurrentAmmo);
+ }
+
+ if (leave)
+ return;
+
+ // remove it in single player, or setup for respawning
+ // in deathmatch
+ this.model = string_null;
+ this.solid = SOLID_NOT;
+ // Supa, SP respawning items support
+ check_respawn (this, WEAPON_RESPAWN_TIME, WEAPON_RESPAWN_TIME);

- 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;
- }
+ // fire all targets / killtargets
+ sub_usetargets ();
+ };

- // johnfitz added for axe, shotgun items
- // -- dumptruck_ds from RRP / rubicon2
- if (self.classname == "weapon_axe")
+ //--------------------------------------------------------------
+ void() base_item_weapon =
{
- if (leave && (other.items & IT_AXE))
- return;
- new = IT_AXE;
- }
- else if (self.classname == "weapon_shotgun")
+ this.classgroup |= CG_ITEM_WEAPON;
+ };
+};
+
+//=======================================================================
+// Weapon 1: Ranger's Axe -- johnfitz -- dumptruck_ds from RRP and rubicon2
+//=======================================================================
+
+//----------------------------------------------------------------------
+// W_FireAxe
+//----------------------------------------------------------------------
+void() W_FireAxe =
+{
+ local vector source;
+ local vector org;
+
+ makevectors (self.v_angle);
+ source = self.origin + '0 0 16';
+ traceline (source, source + v_forward * 64, FALSE, self);
+ if (trace_fraction == 1.0)
+ return;
+ org = trace_endpos - v_forward * 4;
+
+ if (trace_ent.takedamage)
{
- if (leave && (other.items & IT_SHOTGUN))
- return;
- hadammo = other.ammo_shells;
- new = IT_SHOTGUN;
- other.ammo_shells = other.ammo_shells + AMMO_SHELLS_WP;
+ trace_ent.axhitme = 1;
+ SpawnBlood (org, '0 0 0', 20);
+ T_Damage (trace_ent, self, self, 20);
}
- else if (self.classname == "weapon_nailgun")
- {
- // johnfitz
- if (leave && (other.items & IT_NAILGUN))
- return;
- hadammo = other.ammo_nails;
- new = IT_NAILGUN;
- other.ammo_nails = other.ammo_nails + AMMO_NAILS_WP;
+ else
+ { // hit wall
+ sound (self, CHAN_WEAPON, "player/axhit2.wav", 1, ATTN_NORM);
+ WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteByte (MSG_BROADCAST, TE_GUNSHOT);
+ WriteCoord (MSG_BROADCAST, org_x);
+ WriteCoord (MSG_BROADCAST, org_y);
+ WriteCoord (MSG_BROADCAST, org_z);
}
- else if (self.classname == "weapon_supernailgun")
+};
+
+//----------------------------------------------------------------------
+void() weapon_axe_attack =
+{
+ local float r = random ();
+ sound (self, CHAN_WEAPON, "weapons/ax1.wav", 1, ATTN_NORM);
+
+ if (r < 0.25)
+ player_axe1 ();
+ else if (r<0.5)
+ player_axeb1 ();
+ else if (r<0.75)
+ player_axec1 ();
+ else
+ player_axed1 ();
+
+ self.attack_finished = time + AXE_ATTACK_COOLDOWN;
+};
+
+/*QUAKED weapon_axe (0 .5 .8) (-16 -16 0) (16 16 32)
+Axe
+*/
+class weapon_axe: base_item_weapon
+{
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
{
- if (leave && (other.items & IT_SUPER_NAILGUN))
- return;
- hadammo = other.ammo_rockets;
- new = IT_SUPER_NAILGUN;
- other.ammo_nails = other.ammo_nails + AMMO_NAILS_WP;
- }
- else if (self.classname == "weapon_supershotgun")
+ precache_model ("progs/g_axe.mdl");
+ setmodel (this, "progs/g_axe.mdl");
+ this.weapon = IT_AXE;
+ this.netname = "Axe";
+
+ this.size_min = '-16 -16 0';
+ this.size_max = '16 16 56';
+
+ // StartItem
+ super::init_spawned ();
+ };
+
+ //--------------------------------------------------------------
+ void() weapon_axe =
{
- if (leave && (other.items & IT_SUPER_SHOTGUN))
- return;
- hadammo = other.ammo_rockets;
- new = IT_SUPER_SHOTGUN;
- other.ammo_shells = other.ammo_shells + AMMO_SHELLS_WP;
- }
- else if (self.classname == "weapon_rocketlauncher")
+ this.classtype = CT_ITEM_AXE;
+ };
+};
+
+//=======================================================================
+// Weapon 2: Shotgun -- johnfitz -- dumptruck_ds from RRP and rubicon2
+//=======================================================================
+
+/*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.
+Single-barrelled Shotgun
+Shotgun
+*/
+class weapon_shotgun: base_item_weapon
+{
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
{
- if (leave && (other.items & IT_ROCKET_LAUNCHER))
- return;
- hadammo = other.ammo_rockets;
- new = IT_ROCKET_LAUNCHER;
- other.ammo_rockets = other.ammo_rockets + AMMO_ROCKETS_WP;
- }
- else if (self.classname == "weapon_grenadelauncher")
+ precache_model ("progs/g_shotgu.mdl");
+ // new shotgun model by Starshipwaters
+ // - dumptruck_ds - removed 2 older shotguns that used spawnflags
+ setmodel (this, "progs/g_shotgu.mdl");
+ this.weapon = IT_SHOTGUN;
+ this.netname = "Shotgun";
+ this.size_min = '-16 -16 0';
+ this.size_max = '16 16 56';
+
+ // StartItem
+ super::init_spawned ();
+ };
+
+ //--------------------------------------------------------------
+ void() weapon_shotgun =
{
- if (leave && (other.items & IT_GRENADE_LAUNCHER))
- return;
- hadammo = other.ammo_rockets;
- new = IT_GRENADE_LAUNCHER;
- other.ammo_rockets = other.ammo_rockets + AMMO_ROCKETS_WP;
- }
- else if (self.classname == "weapon_lightning")
+ this.classtype = CT_ITEM_SHOTGUN;
+ };
+};
+
+//=======================================================================
+// Weapon 3: Super Shotgun
+//=======================================================================
+
+/*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
+*/
+class weapon_supershotgun: base_item_weapon
+{
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
{
- if (leave && (other.items & IT_LIGHTNING))
- return;
- hadammo = other.ammo_rockets;
- new = IT_LIGHTNING;
- other.ammo_cells = other.ammo_cells + AMMO_CELLS_WP;
- }
- else
+ precache_model ("progs/g_shot.mdl");
+ setmodel (this, "progs/g_shot.mdl");
+ this.weapon = IT_SUPER_SHOTGUN;
+ this.netname = "Double-barrelled Shotgun";
+ this.size_min = '-16 -16 0';
+ this.size_max = '16 16 56';
+
+ this.particles_offset = '0 0 33';
+
+ // StartItem
+ super::init_spawned ();
+ };
+
+ void() weapon_supershotgun =
{
- objerror ("weapon_touch: unknown classname");
- return;
- }
+ this.classtype = CT_ITEM_SUPER_SHOTGUN;
+ };
+};

- sprint (other, "You got the ");
- sprint (other, self.netname);
- sprint (other, "\n");
- // weapon touch sound
- sound (other, CHAN_ITEM, "weapons/pkup.wav", 1, ATTN_NORM);
- stuffcmd (other, "bf\n");
+//=======================================================================
+// Weapon 4: Nailgun
+//=======================================================================

- bound_other_ammo ();
+/*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
+*/
+class weapon_nailgun: base_item_weapon
+{
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
+ {
+ precache_model ("progs/g_nail.mdl");
+ setmodel (this, "progs/g_nail.mdl");
+ this.weapon = IT_NAILGUN;
+ this.netname = "nailgun";
+ this.size_min = '-16 -16 0';
+ this.size_max = '16 16 56';
+
+ this.particles_offset = '0 0 31';

- // change to the weapon
- old = other.items;
- other.items = other.items | new;
+ // StartItem
+ super::init_spawned ();
+ };

- if (other.classname == "player" && autocvar(cg_autoswitch, TRUE))
+ //--------------------------------------------------------------
+ void() weapon_nailgun =
{
- stemp = self;
- self = other;
-
- // 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 (old, new);
+ this.classtype = CT_ITEM_NAILGUN;
+ };
+};

- PlayerSetCurrentAmmo ();
+//=======================================================================
+// Weapon 5: Super Nailgun
+//=======================================================================

- self = stemp;
- }
+/*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
+*/
+class weapon_supernailgun: base_item_weapon
+{
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
+ {
+ precache_model ("progs/g_nail2.mdl");
+ setmodel (this, "progs/g_nail2.mdl");
+ this.weapon = IT_SUPER_NAILGUN;
+ this.netname = "Super Nailgun";
+ this.size_min = '-16 -16 0';
+ this.size_max = '16 16 56';

- if (leave)
- return;
+ this.particles_offset = '0 0 34';
+
+ // StartItem
+ super::init_spawned ();
+ };

- // remove it in single player, or setup for respawning in deathmatch
- self.model = string_null;
- self.solid = SOLID_NOT;
- // Supa, SP respawning items support
- if (!deathmatch)
- CheckItemRespawn (self, WEAPON_RESPAWN_TIME);
- else if (deathmatch == 1)
- // weapons never disappear in "deathmatch 2"
- self.nextthink = time + WEAPON_RESPAWN_TIME;
-
- self.think = SUB_Regen;
-
- activator = other;
- // fire all targets / killtargets
- SUB_UseTargets ();
+ //--------------------------------------------------------------
+ void() weapon_supernailgun =
+ {
+ this.classtype = CT_ITEM_SUPER_NAILGUN;
+ };
};

+//=======================================================================
+// Weapon 6: Grenade Launcher
+//=======================================================================
+
/*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
*/
-void() weapon_grenadelauncher =
+class weapon_grenadelauncher: base_item_weapon
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
+ {
+ precache_model ("progs/g_rock.mdl");
+ setmodel (this, "progs/g_rock.mdl");
+ this.weapon = 3;
+ this.netname = "Grenade Launcher";
+ this.size_min = '-16 -16 0';
+ this.size_max = '16 16 56';
+
+ this.particles_offset = '0 0 28';

- precache_model ("progs/g_rock.mdl");
- setmodel (self, "progs/g_rock.mdl");
- self.weapon = 3;
- self.netname = "Grenade Launcher";
- self.touch = weapon_touch;
- setsize (self, '-16 -16 0', '16 16 56');
- self.particles_offset = '0 0 28';
- StartItem ();
+ // StartItem
+ super::init_spawned ();
+ };
+
+ //--------------------------------------------------------------
+ void() weapon_grenadelauncher =
+ {
+ this.classtype = CT_ITEM_GRENADE_LAUNCHER;
+ };
};

+//=======================================================================
+// Weapon 7: Rocket Launcher
+//=======================================================================
+
/*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
*/
-void() weapon_rocketlauncher =
+class weapon_rocketlauncher: base_item_weapon
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
+ {
+ precache_model ("progs/g_rock2.mdl");
+ setmodel (this, "progs/g_rock2.mdl");
+ this.weapon = 3;
+ this.netname = "Rocket Launcher";
+ this.size_min = '-16 -16 0';
+ this.size_max = '16 16 56';
+
+ this.particles_offset = '0 0 32';
+
+ // StartItem
+ super::init_spawned ();
+ };

- precache_model ("progs/g_rock2.mdl");
- setmodel (self, "progs/g_rock2.mdl");
- self.weapon = 3;
- self.netname = "Rocket Launcher";
- self.touch = weapon_touch;
- setsize (self, '-16 -16 0', '16 16 56');
- self.particles_offset = '0 0 32';
- StartItem ();
+ //--------------------------------------------------------------
+ void() weapon_rocketlauncher =
+ {
+ this.classtype = CT_ITEM_ROCKET_LAUNCHER;
+ };
};

+//=======================================================================
+// Weapon 8: Lightning Gun
+//=======================================================================
+
/*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
*/
-void() weapon_lightning =
+class weapon_lightning: base_item_weapon
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ //--------------------------------------------------------------
+ virtual void() init_spawned =
+ {
+ precache_model ("progs/g_light.mdl");
+ setmodel (this, "progs/g_light.mdl");
+ this.weapon = 3;
+ this.netname = "Thunderbolt";
+ this.size_min = '-16 -16 0';
+ this.size_max = '16 16 56';

- precache_model ("progs/g_light.mdl");
- setmodel (self, "progs/g_light.mdl");
- self.weapon = 3;
- self.netname = "Thunderbolt";
- self.touch = weapon_touch;
- setsize (self, '-16 -16 0', '16 16 56');
- self.particles_offset = '0 0 31';
- StartItem ();
+ this.particles_offset = '0 0 31';
+
+ // StartItem
+ super::init_spawned ();
+ };
+
+ //--------------------------------------------------------------
+ void() weapon_lightning =
+ {
+ this.classtype = CT_ITEM_LIGHTNING_GUN;
+ };
};

Return to the top of this page or return to the overview of this repo.

Diff qc/keydata.qc

diff --git a/qc/keydata.qc b/qc/keydata.qc
deleted file mode 100644
index 07d54c0..0000000
--- a/qc/keydata.qc
+++ /dev/null
@@ -1,190 +0,0 @@
-//==============================================================================
-// FUNCTIONS WHICH DEAL WITH KEY ITEM BITFLAGS AND NAMES
-//==============================================================================
-
-/*
-========================================================================
-This file was created for progs_dump by Ian "iw" Walshaw, January 2020.
-
-It defines functions which deal with the bitflags and names which refer
-to the key items, including the new item_key_custom.
-
-These functions are a dependency of the updated code for the key items
-(in items.qc) and also the updated code for unlockable entities (in
-keylock.qc).
-========================================================================
-*/
-
-// The highest bitflag that will be assigned to a custom key.
-float FINAL_CUSTOM_KEY = 4194304;
-
-// The highest bitflag that has been assigned to a custom key.
-float highest_custom_key;
-
-// prototypes
-string() SilverKeyName;
-string() GoldKeyName;
-float(string key_name) CustomKeyFlag;
-entity(string key_name) SpawnCustomKeyDef;
-entity(string key_name) FindCustomKeyDef;
-float(entity client, float item_flags, float customkey_flags) HasKeys;
-void(entity client, float item_flags, float customkey_flags) GiveKeys;
-void(entity client) GiveAllKeys;
-void(entity client, float item_flags, float customkey_flags) RemoveKeys;
-
-//----------------------------------------------------------------------
-// SilverKeyName
-//
-// Return the name that should be used for the silver key as per
-// world.worldtype. -- iw
-//----------------------------------------------------------------------
-string() SilverKeyName =
-{
- if (world.worldtype == WORLDTYPE_BASE)
- return "silver keycard";
- if (world.worldtype == WORLDTYPE_METAL)
- return "silver runekey";
- return "silver key";
-};
-
-//----------------------------------------------------------------------
-// GoldKeyName
-//
-// Return the name that should be used for the gold key as per
-// world.worldtype. -- iw
-//----------------------------------------------------------------------
-string() GoldKeyName =
-{
- if (world.worldtype == WORLDTYPE_BASE)
- return "gold keycard";
- if (world.worldtype == WORLDTYPE_METAL)
- return "gold runekey";
- return "gold key";
-};
-
-//----------------------------------------------------------------------
-// CustomKeyFlag
-//
-// Return the bitflag that should be used to represent the custom key named
-// key_name.
-
-// More specifically, if this is the first time that this function has been
-// called for the specified key_name, then return a bitflag which has not
-// previously been returned by this function for any key_name. Otherwise,
-// return the same bitflag that was previously returned for the specified
-// key_name. -- iw
-//----------------------------------------------------------------------
-float(string key_name) CustomKeyFlag =
-{
- local entity key_def;
-
- key_def = FindCustomKeyDef (key_name);
- if (key_def == world)
- key_def = SpawnCustomKeyDef (key_name);
- return key_def.customkeys;
-};
-
-//----------------------------------------------------------------------
-// SpawnCustomKeyDef
-//
-// Spawn and return a new custom_key_def entity which will define the
-// custom key named key_name.
-//
-// The value of the entity's customkeys field will be a bitflag which has
-// not yet been used to represent a custom key. -- iw
-//----------------------------------------------------------------------
-entity(string key_name) SpawnCustomKeyDef =
-{
- local entity key_def;
-
- if (highest_custom_key == FINAL_CUSTOM_KEY)
- error ("too many custom keys");
-
- if (highest_custom_key == 0)
- highest_custom_key = 1;
- else
- highest_custom_key = highest_custom_key * 2;
-
- key_def = spawn ();
- key_def.classname = "custom_key_def";
- key_def.netname = key_name;
- key_def.customkeys = highest_custom_key;
-
- return key_def;
-};
-
-//----------------------------------------------------------------------
-// FindCustomKeyDef
-//
-// If a custom_key_def entity exists which defines the custom key named
-// key_name, then find and return it, otherwise return world.
-//
-// If a custom_key_def entity is returned, then the value of its customkeys
-// field will be the bitflag that should be used to represent the custom
-// key named key_name. -- iw
-//----------------------------------------------------------------------
-entity(string key_name) FindCustomKeyDef =
-{
- local entity key_def;
-
- key_def = find (world, classname, "custom_key_def");
- while (key_def != world)
- {
- if (key_def.netname == key_name)
- return key_def;
- key_def = find (key_def, classname, "custom_key_def");
- }
- return world;
-};
-
-//----------------------------------------------------------------------
-// HasKeys
-//
-// Return TRUE if the specified client has all of the non-custom keys
-// represented by the item_flags and all of the custom keys represented by
-// the customkey_flags, otherwise return FALSE. -- iw
-//----------------------------------------------------------------------
-float(entity client, float item_flags, float customkey_flags) HasKeys =
-{
- return (client.items & item_flags) == item_flags &&
- (client.customkeys & customkey_flags) == customkey_flags;
-};
-
-//----------------------------------------------------------------------
-// GiveKeys
-//
-// Give the specified client all of the non-custom keys represented by the
-// item_flags and all of the custom keys represented by the
-// customkey_flags. -- iw
-//----------------------------------------------------------------------
-void(entity client, float item_flags, float customkey_flags) GiveKeys =
-{
- client.items = client.items | item_flags;
- client.customkeys = client.customkeys | customkey_flags;
-};
-
-//----------------------------------------------------------------------
-// GiveAllKeys
-//
-// Give the specified client the silver key, the gold key, and all of the
-// custom keys that have been defined for the current map. -- iw
-//----------------------------------------------------------------------
-void(entity client) GiveAllKeys =
-{
- GiveKeys (client, IT_KEY1 | IT_KEY2, highest_custom_key * 2 - 1);
-};
-
-//----------------------------------------------------------------------
-// RemoveKeys
-//
-// Remove all of the non-custom keys represented by the item_flags and all
-// of the custom keys represented by the customkey_flags from the specified
-// client's inventory. -- iw
-//----------------------------------------------------------------------
-void(entity client, float item_flags, float customkey_flags) RemoveKeys =
-{
- client.items = client.items -
- (client.items & item_flags);
- client.customkeys = client.customkeys -
- (client.customkeys & customkey_flags);
-};

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 3fc2f53..6f7db28 100644
--- a/qc/keylock.qc
+++ b/qc/keylock.qc
@@ -92,7 +92,7 @@ void() keylock_set_silver_key =
{
self.items = IT_KEY1;
self.customkeys = 0; // support for item_key_custom -- iw
- self.netname = SilverKeyName ();
+ self.netname = base_item_key::silver_key_name ();
};

//----------------------------------------------------------------------
@@ -106,7 +106,7 @@ void() keylock_set_gold_key =
self.items = IT_KEY2;
// support for item_key_custom -- iw
self.customkeys = 0;
- self.netname = GoldKeyName ();
+ self.netname = base_item_key::gold_key_name ();
};

//----------------------------------------------------------------------
@@ -120,7 +120,7 @@ void() keylock_set_gold_key =
void(string key_name) keylock_set_custom_key =
{
self.items = 0;
- self.customkeys = CustomKeyFlag (key_name);
+ self.customkeys = base_item_key::custom_key_flag (key_name);
self.netname = key_name;
};

@@ -175,7 +175,7 @@ void(entity client, string custom_message,
local string s;

// support for item_key_custom -- iw
- if (!HasKeys (client, self.items, self.customkeys))
+ if (!base_item_key::has_keys (client, self.items, self.customkeys))
{
if (custom_message != "")
centerprint (client, custom_message);
@@ -194,7 +194,7 @@ void(entity client, string custom_message,
else
{
// support for item_key_custom -- iw
- RemoveKeys (client, self.items, self.customkeys);
+ base_item_key::remove_keys(client, self.items, self.customkeys);
s = "You used the ";
}

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 57f8dae..aa80bb9 100644
--- a/qc/misc/teleporttrain.qc
+++ b/qc/misc/teleporttrain.qc
@@ -40,11 +40,21 @@ class misc_teleporttrain: base_mapentity
local vector delta;
local float len, spd;

+ if (this.enemy == world)
+ {
+ dprint ("misc_teleporttrain::teleporttrain_calcmove: "
+ "enemy is world!\n");
+ return;
+ }
+
delta = (this.enemy.origin + '16 16 16') - this.origin;
len = vlen (delta);
spd = vlen (this.velocity);
this.think_state = TELEPORTTRAIN_WAIT;
- this.nextthink = time + (len / spd);
+ if (this.ltime)
+ this.nextthink = this.ltime + (len / spd);
+ else
+ this.nextthink = time + (len / spd);
};

//--------------------------------------------------------------
@@ -70,8 +80,10 @@ class misc_teleporttrain: base_mapentity
}
else
{
- objerror ("unable to find target\n");
+ objerror ("misc_teleporttrain::teleporttrain_next: "
+ "unable to find target");
remove (this);
+ return;
}

teleporttrain_calcmove ();
@@ -82,14 +94,17 @@ class misc_teleporttrain: base_mapentity
{
local float wait_time;

- if (this.enemy.wait > 0)
+ if (this.enemy != world && this.enemy.wait > 0)
wait_time = this.enemy.wait;
else
wait_time = 0.1;

this.velocity = '0 0 0';
this.think_state = TELEPORTTRAIN_NEXT;
- this.nextthink = time + wait_time;
+ if (this.ltime)
+ this.nextthink = this.ltime + wait_time;
+ else
+ this.nextthink = time + wait_time;
};

//--------------------------------------------------------------
@@ -100,6 +115,17 @@ class misc_teleporttrain: base_mapentity
if (this.enemy.classtype == CT_PATH_CORNER)
{
setorigin (this, this.enemy.origin + '16 16 16');
+ // if the path_corner has the same target we already
+ // have, then the train should stop. Fix for dmd8 -- CEV
+ if (this.target == this.enemy.target)
+ {
+ this.interaction_flags |= DISABLE_THINK;
+ this.interaction_flags |= DISABLE_TOUCH;
+ this.interaction_flags |= DISABLE_USE;
+ return;
+ }
+
+ // now set our target and continue
this.target = this.enemy.target;
}
else
@@ -115,6 +141,9 @@ class misc_teleporttrain: base_mapentity
else if (!this.targetname)
// not triggered, so start immediately
teleporttrain_next ();
+ else
+ dprint ("misc_teleporttrain::teleporttrain_find: "
+ "third state\n");
};

//--------------------------------------------------------------
@@ -131,6 +160,10 @@ class misc_teleporttrain: base_mapentity
case TELEPORTTRAIN_FIND:
this.teleporttrain_find ();
break;
+ default:
+ dprint (sprintf("misc_teleporttrain::do_think: "
+ "unhandled think state %g\n",
+ this.think_state));
}
};

@@ -157,19 +190,21 @@ class misc_teleporttrain: base_mapentity
if (this.speed <= 0)
this.speed = 100;

+ this.cnt = 1;
this.solid = SOLID_NOT;
this.movetype = MOVETYPE_FLY;
// custom custom_mdls -- dumptruck_ds
+ // precache_model ("progs/teleport.mdl");
precache_body_model ("progs/teleport.mdl");
// invisble -- dumptruck_ds
precache_model ("progs/s_null.spr");
if (this.spawnflags & 8)
- // setmodel (this, "progs/s_null.spr");
body_model ("progs/s_null.spr");
else
body_model ("progs/teleport.mdl");
- // precache_model ("progs/teleport.mdl");
+
setsize (this, '-16 -16 -16', '16 16 16');
+ // setorigin (this, this.origin);

// Causes the ball to spin around like it was
// originally intended to.
@@ -177,10 +212,18 @@ class misc_teleporttrain: base_mapentity
// don't spin - helpful for invisible
// spawner -- dumptruck_ds
this.avelocity = '40 80 120';
- // this.avelocity = '100 200 300';
+
+ /*
+ precache_sound ("misc/null.wav");
+ this.noise = "misc/null.wav";
+ this.noise1 = "misc/null.wav";
+ */

this.think_state = TELEPORTTRAIN_FIND;
- this.nextthink = time + 0.1;
+ if (this.ltime)
+ this.nextthink = this.ltime + 0.1;
+ else
+ this.nextthink = time + 0.1;
};

//--------------------------------------------------------------

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 ac06fe8..3b62ff5 100644
--- a/qc/monsters/demon.qc
+++ b/qc/monsters/demon.qc
@@ -192,12 +192,13 @@ void() demon_die =
{
ThrowGib ("progs/gib1.mdl", self.health);
}
- DropStuff();
+ base_item::drop_stuff (self);
+
return;
}

// regular death
- DropStuff();
+base_item::drop_stuff (self);
demon1_die1 ();
};

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 eb5b6b3..4f6a71a 100644
--- a/qc/monsters/dog.qc
+++ b/qc/monsters/dog.qc
@@ -276,7 +276,7 @@ void() dog_die =
{
ThrowHead ("progs/h_dog.mdl", self.health);
}
- DropStuff();
+ base_item::drop_stuff (self);
return;
}

@@ -284,7 +284,7 @@ void() dog_die =
sound_death (self, CHAN_VOICE, "dog/ddeath.wav", 1, ATTN_NORM); //dumptruck_ds
self.solid = SOLID_NOT;

- DropStuff();
+ base_item::drop_stuff (self);

if (random() > 0.5)
dog_die1 ();

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 052b0d8..e3de581 100644
--- a/qc/monsters/enforcer.qc
+++ b/qc/monsters/enforcer.qc
@@ -731,7 +731,8 @@ void() enf_die3 =[ $death3, enf_die4 ]
{
self.ammo_cells = 5;
}
- if(!self.keep_ammo)DropBackpack();
+ if(!self.keep_ammo)
+ item_backpack::drop_backpack (self);
};
void() enf_die4 =[ $death4, enf_die5 ] {ai_forward(14);};
void() enf_die5 =[ $death5, enf_die6 ] {ai_forward(2);};
@@ -769,7 +770,8 @@ void() enf_fdie3 =[ $fdeath3, enf_fdie4 ]
{
self.ammo_cells = 5;
}
- if(!self.keep_ammo)DropBackpack();
+ if(!self.keep_ammo)
+ item_backpack::drop_backpack (self);
};
void() enf_fdie4 =[ $fdeath4, enf_fdie5 ] {};
void() enf_fdie5 =[ $fdeath5, enf_fdie6 ] {};
@@ -822,13 +824,13 @@ void() enf_die =
{
ThrowGib ("progs/gib3.mdl", self.health);
}
- DropStuff();
+ base_item::drop_stuff (self);
return;
}

// regular death
sound_death (self, CHAN_VOICE, "enforcer/death1.wav", 1, ATTN_NORM); //dumptruck_ds
- DropStuff();
+ base_item::drop_stuff (self);
if (random() > 0.5)
enf_die1 ();
else

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 a4a3c54..e348590 100644
--- a/qc/monsters/fish.qc
+++ b/qc/monsters/fish.qc
@@ -174,13 +174,13 @@ void() fish_die =
{
ThrowHead ("progs/h_dog.mdl", self.health);
}
- DropStuff();
+ base_item::drop_stuff (self);
sub_remove();
}
// regular death
else
{
- DropStuff();
+ base_item::drop_stuff (self);
f_death1();
}
};

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 9bfa7a5..c59446f 100644
--- a/qc/monsters/hknight.qc
+++ b/qc/monsters/hknight.qc
@@ -276,13 +276,13 @@ void() hknight_die =
{
ThrowGib ("progs/gib3.mdl", self.health);
}
- DropStuff();
+ base_item::drop_stuff (self);
return;
}

// regular death
sound_death (self, CHAN_VOICE, "hknight/death1.wav", 1, ATTN_NORM);
- DropStuff();
+ base_item::drop_stuff (self);
if (random() > 0.5)
hknight_die1 ();
else

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 936322d..c058a89 100644
--- a/qc/monsters/knight.qc
+++ b/qc/monsters/knight.qc
@@ -250,13 +250,13 @@ void() knight_die =
{
ThrowGib ("progs/gib3.mdl", self.health);
}
- DropStuff();
+ base_item::drop_stuff (self);
return;
}

// regular death
sound_death (self, CHAN_VOICE, "knight/kdeath.wav", 1, ATTN_NORM);
- DropStuff();
+ base_item::drop_stuff (self);
if (random() < 0.5)
knight_die1 ();
else

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 edd017e..83998fc 100644
--- a/qc/monsters/ogre.qc
+++ b/qc/monsters/ogre.qc
@@ -1147,7 +1147,10 @@ void() ogre_die3 =[ $death3, ogre_die4 ]
{
self.ammo_rockets = 2;
}
-if(!self.keep_ammo)DropBackpack();};
+if(!self.keep_ammo)
+ item_backpack::drop_backpack (self);
+};
+
void() ogre_die4 =[ $death4, ogre_die5 ] {};
void() ogre_die5 =[ $death5, ogre_die6 ] {};
void() ogre_die6 =[ $death6, ogre_die7 ] {};
@@ -1185,7 +1188,10 @@ void() ogre_bdie3 =[ $bdeath3, ogre_bdie4 ]
{
self.ammo_rockets = 2;
}
-if(!self.keep_ammo)DropBackpack();};
+if(!self.keep_ammo)
+ item_backpack::drop_backpack (self);
+};
+
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);};
@@ -1235,13 +1241,13 @@ void() ogre_die =
{
ThrowGib ("progs/gib3.mdl", self.health);
}
- DropStuff();
+ base_item::drop_stuff (self);
return;
}

sound_death (self, CHAN_VOICE, "ogre/ogdth.wav", 1, ATTN_NORM);

- DropStuff();
+ base_item::drop_stuff (self);
if (random() < 0.5)
ogre_die1 ();
else

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 116e9de..13731a2 100644
--- a/qc/monsters/oldone.qc
+++ b/qc/monsters/oldone.qc
@@ -1,5 +1,3 @@
-// TODO CEV: this is causing FTEQW to hang for some reason
-
/*
==============================================================================

@@ -7,7 +5,6 @@ OLD ONE

==============================================================================
*/
-/*
$cd id1/models/old_one
$origin 0 0 24
$base base
@@ -254,11 +251,69 @@ void(entity attacker, float damage) nopain =

//============================================================================

-*/
+// The next function is from Than's Deathmatch Dimensions; I've cut-and-pasted
+// it in here so I can play dmd8.bsp -- CEV
+
+// Shub death treated more like a standard monster death for Deathmatch
+// Dimension; Customised intermission message is handled in client.qc
+// -- comment from DMD's QC source
+void() shub_death =
+{
+ self.solid = SOLID_NOT;
+ killed_monsters = killed_monsters + 1;
+ WriteByte (MSG_ALL, SVC_KILLEDMONSTER);
+
+ // Remove any teleporttrain in the map (will need one for vanilla progs to avoid error)
+ local entity tt;
+ tt = find (world, classname, "misc_teleporttrain");
+ if (tt)
+ remove (tt);
+
+ // throw tons of meat chunks
+ local vector oldo;
+ local float x, y, z;
+ local float r;
+ local float gibpow;
+
+ sound (self, CHAN_VOICE, "boss2/pop2.wav", 1, ATTN_NORM);
+
+ oldo = self.origin;
+ gibpow = -160;
+
+ z = 16;
+ while (z <= 144)
+ {
+ x = -64;
+ while (x <= 64)
+ {
+ y = -64;
+ while (y <= 64)
+ {
+ self.origin_x = oldo_x + x;
+ self.origin_y = oldo_y + y;
+ self.origin_z = oldo_z + z;
+
+ r = random();
+ if (r < 0.3)
+ ThrowGib ("progs/gib1.mdl", gibpow);
+ else if (r < 0.6)
+ ThrowGib ("progs/gib2.mdl", gibpow);
+ else
+ ThrowGib ("progs/gib3.mdl", gibpow);
+ y = y + 32;
+ }
+ x = x + 32;
+ }
+ z = z + 96;
+ }
+
+ remove (self);
+};
+
+
/*QUAKED monster_oldone (1 0 0) (-160 -128 -24) (160 128 256)
*/
// TODO CEV
-/*
void() monster_oldone =
{
// new spawnflags for all entities -- iw
@@ -294,10 +349,16 @@ void() monster_oldone =
self.nextthink = time + 0.1;
self.takedamage = DAMAGE_YES;
self.th_pain = nopain;
- self.th_die = finale_1;
+ if (self.spawnflags & 2)
+ {
+ self.th_die = shub_death;
+ }
+ else
+ {
+ self.th_die = finale_1;
+ }
self.touch = monster_touch; // 1998-09-16 Sliding/not-jumping on monsters/boxes/players fix by Maddes/Kryten
shub = self;

total_monsters = total_monsters + 1;
};
-*/

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 a8c7603..e27b3f7 100644
--- a/qc/monsters/shalrath.qc
+++ b/qc/monsters/shalrath.qc
@@ -166,12 +166,12 @@ void() shalrath_die =
{
ThrowGib ("progs/gib3.mdl", self.health);
}
- DropStuff();
+ base_item::drop_stuff (self);
return;
}
// insert death sounds here
sound_death (self, CHAN_VOICE, "shalrath/death.wav", 1, ATTN_NORM);
- DropStuff();
+ base_item::drop_stuff (self);
shal_death1();
self.solid = SOLID_NOT;
};

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 24958e8..420319c 100644
--- a/qc/monsters/shambler.qc
+++ b/qc/monsters/shambler.qc
@@ -549,13 +549,13 @@ void() sham_die =
{
ThrowGib ("progs/gib3.mdl", self.health);
}
- DropStuff();
+ base_item::drop_stuff (self);
return;
}

// regular death
sound_death (self, CHAN_VOICE, "shambler/sdeath.wav", 1, ATTN_NORM);
- DropStuff();
+ base_item::drop_stuff (self);
sham_death1 ();
};

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 44f774c..4d17c84 100644
--- a/qc/monsters/soldier.qc
+++ b/qc/monsters/soldier.qc
@@ -426,7 +426,10 @@ void() army_die3 =[ $death3, army_die4 ]
{
self.ammo_shells = 5;
}
-if(!self.keep_ammo)DropBackpack();};
+if(!self.keep_ammo)
+ item_backpack::drop_backpack (self);
+};
+
void() army_die4 =[ $death4, army_die5 ] {};
void() army_die5 =[ $death5, army_die6 ] {};
void() army_die6 =[ $death6, army_die7 ] {};
@@ -460,7 +463,10 @@ void() army_cdie3 =[ $deathc3, army_cdie4 ]
{
self.ammo_shells = 5;
}
-if(!self.keep_ammo)DropBackpack();ai_back(4);}; //dumptruck_ds
+if(!self.keep_ammo)
+ item_backpack::drop_backpack (self);
+ ai_back(4);
+}; //dumptruck_ds
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);};
@@ -512,13 +518,13 @@ void() army_die =
{
ThrowGib ("progs/gib3.mdl", self.health);
}
- DropStuff();
+ base_item::drop_stuff (self);
return;
}

// regular death
sound_death (self, CHAN_VOICE, "soldier/death1.wav", 1, ATTN_NORM);
- DropStuff();
+ base_item::drop_stuff (self);
if (random() < 0.5)
army_die1 ();
else

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 672c939..357b004 100644
--- a/qc/monsters/wizard.qc
+++ b/qc/monsters/wizard.qc
@@ -402,10 +402,10 @@ void() wiz_die =
{
ThrowGib ("progs/gib2.mdl", self.health);
}
- DropStuff();
+ base_item::drop_stuff (self);
return;
}
- DropStuff();
+ base_item::drop_stuff (self);
wiz_death1 ();
};

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 ba4022a..1efb2fe 100644
--- a/qc/monsters/zombie.qc
+++ b/qc/monsters/zombie.qc
@@ -564,7 +564,7 @@ void() zombie_die =
{
ThrowGib ("progs/gib3.mdl", self.health);
}
- DropStuff();
+ base_item::drop_stuff (self);
};

/*

Return to the top of this page or return to the overview of this repo.

Diff qc/player/player.qc

diff --git a/qc/player/player.qc b/qc/player/player.qc
index 1e9d8ba..1724b94 100644
--- a/qc/player/player.qc
+++ b/qc/player/player.qc
@@ -817,7 +817,7 @@ void() PlayerDie =
self.modelindex = modelindex_player;

if (deathmatch || coop)
- DropBackpack ();
+ item_backpack::drop_backpack (self);

self.weaponmodel = "";
self.view_ofs = '0 0 -8';
@@ -1029,3 +1029,22 @@ void() player_dead_on_side =
//======================================================================
// END Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds
//======================================================================
+
+/*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
+*/
+void() info_player_deathmatch =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ self.alpha = 0.2;
+ self.glowmod = [4.0, 4.0, 4.0];
+ self.model = "progs/player.mdl";
+ self.frame = $axstnd1;
+ setmodel (self, self.model);
+};

Return to the top of this page or return to the overview of this repo.

Diff qc/player/pmove.qc

diff --git a/qc/player/pmove.qc b/qc/player/pmove.qc
index 2207d49..be4ca5d 100644
--- a/qc/player/pmove.qc
+++ b/qc/player/pmove.qc
@@ -32,9 +32,9 @@ const float PM_AIRACCELQ3 = 0.75f; // 1.0 in Q3 ?; now 0.75 or 0.8
const float PM_AIRACCELFWD = 0.75f; // 1 feels close to Q3 / CPM
const float PM_AIRACCELBACK = 5.0f; // Air stop speed in Q3?
const float PM_AIRACCELTURN = 100.0f; // affects +fwd style turning radius
-const float PM_BOOSTACCEL = 11.0f; // ground boost accel; 10 is enough
+const float PM_BOOSTACCEL = 11.875f; // ground boost accel; 10 is enough; 11
const float PM_BOOSTFRICTION = 4.0f; // ground boost friction; 4 is Q1
-const float PM_GROUNDACCEL = 15.0f; // 10 is normal, 15 is CPM
+const float PM_GROUNDACCEL = 13.75f; // 10 is Q1, 15 is CPM; 12.5? 13.75?
const float PM_GROUNDFRICTION = 8.0f; // 4 for Q1, 6 for Q3, 8 for CPM
const vector PM_GROUNDDIST_V = '0 0 1'; // distance for ground check
const float PM_WATERACCEL = 10.0f; // water acceleration

Return to the top of this page or return to the overview of this repo.

Diff qc/progs.src

diff --git a/qc/progs.src b/qc/progs.src
index 64a2dc0..bcbb233 100644
--- a/qc/progs.src
+++ b/qc/progs.src
@@ -23,7 +23,6 @@ utility.qc
newflags.qc // new spawnflags for all entities
cshift.qc // background color shift controller
subs.qc // modified targets, triggers and killtargets
-keydata.qc // functions which deal with key item bitflags + names
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
@@ -83,17 +82,12 @@ weapons.qc // TODO CEV need to reformat
//----------------------------------------------------------------------
items/ammo.qc // ammo; was in items.qc
items/armor.qc // armor; was in items.qc
-items/backpacks.qc // backpack code; was in items.qc
-items/keys.qc // key pickups; was in items.qc
+items/keys.qc // key pickups; contains items.qc and keydata.qc
items/health.qc // health; was in items.qc
-items/misc.qc // miscellaneous item helper functions & noclass
items/powerups.qc // envirosuit, pent, ring, quad; was in items.qc
items/runes.qc // end-of-episode runes; was in items.qc
items/weapons.qc // weapon pickups; was in items.qc
-
-items/axe.qc //
-items/nailguns.qc //
-items/shotguns.qc //
+items/backpacks.qc // backpack code; was in items.qc

//----------------------------------------------------------------------
// func entities

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 d747548..b84919d 100644
--- a/qc/triggers/changelevel.qc
+++ b/qc/triggers/changelevel.qc
@@ -96,7 +96,7 @@ class trigger_changelevel: base_trigger
if ((this.spawnflags & 16) && (deathmatch == 0))
{
// use info_player_start2 -- dumptruck_ds
- sigil_touch2 ();
+ base_item_rune::sigil_touch2 (this, toucher);
}

if ((this.spawnflags & 1) && (deathmatch == 0))

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 f1866bb..d7c8cbf 100644
--- a/qc/triggers/multiple.qc
+++ b/qc/triggers/multiple.qc
@@ -63,7 +63,9 @@ class base_multiple: base_trigger

activator = this.enemy;

+ /*
dprint ("base_multiple::multi_trigger: firing targets...\n");
+ */
sub_usetargets ();

if (this.wait > 0)

Return to the top of this page or return to the overview of this repo.