djcev.com

//

Git Repos / fte_dogmode / commit 9ed77a9

Commit: 9ed77a98ac7b77f00bb9316145097040cb0e17e3
Parent: 689b89135916beb05b98056dc5fbbf5ad0b7dbd4
Author: Cameron Vanderzanden, 2023-12-09 18:29
Committer: Cameron Vanderzanden, 2023-12-09 18:29

Commit Message

Start OO / class-based refactor, work on items

This is a commit in-progress, a task half done. I've started
reworking the various entities in the game into FTEQCC compatible
classes. Most of the triggers and misc entities are done, next
is to do func and then items and then monsters. Then I'll attempt
to untangle the various functions those entities depend on into
base classes, working my way through ai, combat, subs, et cetera
as I go.

I'm doing this as a further excuse to familiarize myself with the
program, and also because I think it makes more sense expressed
in an object-oriented fashion. This approach has some advantages
that I'm looking forward to, class-specific fields for example, and
Transmitting entities from server to client.

It's pretty slow going so I'll be splitting the task into multiple
commits.

Looking over the files that changed I see other things I did before
I started the class rewrite, things I've now forgotten.

Change List

?File Add Del
M README.md +12
M autoexec.cfg +12 -4
M qc/ai.qc +9
A qc/classes/base_trigger.qc +46
D qc/client.qc -1493
A qc/client/connect.qc +37
M qc/client/impulse.qc +247 -21
A qc/client/levelparms.qc +88
A qc/client/maprules.qc +91
A qc/client/obituary.qc +336
A qc/client/playerspawn.qc +345
M qc/compat_quake3.qc +11 -20
M qc/csqc/csqc_defsclient.qc +7 -4
M qc/csqc/csqc_entrypoints.qc +13 -11
M qc/csqc/csqc_player.qc +7 -6
M qc/csqc/csqc_progs.src +4 -3
M qc/cutscene.qc +770 -855
M qc/defs_builtins.qc +12 -17
A qc/defs_classtype.qc +141
M qc/defs_entvars.qc +4 -4
M qc/defs_globalvars.qc +3 -5
M qc/defs_misc.qc +159 -171
M qc/fight.qc +3 -1
M qc/func/breakable.qc -3
M qc/func/laser.qc +8 -7
M qc/func/rotate.qc +4 -2
M qc/func/shadow.qc +2
M qc/func/togglewall.qc +6 -3
M qc/func/train.qc +2
A qc/info/camera.qc +68
A qc/info/notnull.qc +21
A qc/info/null.qc +22
A qc/info/teleport_changedest.qc +96
A qc/info/teleport_destination.qc +79
M qc/items/ammo.qc +50 -28
M qc/items/armor.qc +63 -23
A qc/items/axe.qc +88
M qc/items/backpacks.qc +34 -21
M qc/items/health.qc +48 -34
M qc/items/misc.qc +1 -1
A qc/items/nailguns.qc +46
M qc/items/powerups.qc +14 -13
A qc/items/shotguns.qc +59
M qc/items/weapons.qc +50 -149
M qc/math.qc +3 -3
M qc/misc/air_bubbles.qc +108 -108
M qc/misc/ambient_sound.qc +307 -141
M qc/misc/deadstuff.qc +320 -238
M qc/misc/explobox.qc +76 -61
M qc/misc/fireball.qc +49 -45
M qc/misc/infight.qc +99 -89
M qc/misc/light_candle.qc +37 -29
M qc/misc/lights.qc +227 -196
M qc/misc/model.qc +165 -154
M qc/misc/modeltrain.qc +2 -2
M qc/misc/noisemaker.qc +35 -29
M qc/misc/particle_stream.qc +74 -66
M qc/misc/particles.qc +58 -51
M qc/misc/particlespray.qc +56 -56
M qc/misc/play.qc +386 -304
M qc/misc/sparks.qc +138 -129
M qc/misc/target_autosave.qc +92 -74
M qc/misc/teleporttrain.qc +136 -130
M qc/misc/viewthing.qc +15 -12
M qc/monsters/zombie.qc -28
M qc/newflags.qc +21 -28
D qc/player.qc -747
A qc/player/player.qc +1043
A qc/player/playerthink.qc +616
A qc/player/pmove.qc +2165
D qc/pmove.qc -2139
M qc/progs.src +42 -13
M qc/subs.qc +14 -43
A qc/triggers/camera.qc +209
M qc/triggers/changelevel.qc +126 -117
M qc/triggers/changemusic.qc +87 -69
M qc/triggers/changetarget.qc +31 -23
M qc/triggers/counter.qc +57 -45
A qc/triggers/cvarset.qc +56
A qc/triggers/everything.qc +38
M qc/triggers/filter.qc +177 -167
M qc/triggers/fog.qc +387 -360
M qc/triggers/heal.qc +174 -153
M qc/triggers/hurt.qc +75 -76
M qc/triggers/ladder.qc +52 -50
M qc/triggers/look.qc +106 -103
D qc/triggers/misc.qc -506
M qc/triggers/monsterface.qc +44 -38
M qc/triggers/monsterjump.qc +61 -41
A qc/triggers/multiple.qc +255
M qc/triggers/onlyregistered.qc +40 -36
M qc/triggers/push.qc +229 -225
A qc/triggers/relay.qc +21
M qc/triggers/remove.qc +4 -3
M qc/triggers/secret.qc +26 -21
A qc/triggers/setcount.qc +76
M qc/triggers/setgravity.qc +73 -68
M qc/triggers/setskill.qc +22 -15
A qc/triggers/setstate.qc +177
M qc/triggers/shake.qc +102 -98
M qc/triggers/take_weapon.qc +41 -30
M qc/triggers/teleport.qc +202 -321
M qc/triggers/textstory.qc +211 -166
M qc/triggers/usekey.qc +117 -100
M qc/triggers/void.qc +67 -46
M qc/weapons.qc +46 -701
M qc/world.qc +205 -67
A sound/items/armor_shard_q3.wav
A sound/items/item_respawn_q3.wav

Diff README.md

diff --git a/README.md b/README.md
index 9cec2dd..8b4ed6d 100644
--- a/README.md
+++ b/README.md
@@ -2,6 +2,8 @@

### Credits, Sources, & License

+#### Quake C (Mod Source)
+
Client side Quake C based on Arcane Dimensions by Simon O'Callaghan (Sock)
and others, original available at:
<https://github.com/SimsOCallaghan/ArcaneDimensions>
@@ -12,6 +14,16 @@ Server side Quake C based on progs_dump version 3.0, which can be found at:
Both above sources licensed GPL 2.0; Dog Mode (this mod, and the Quake C
source in this repo) is presented under the same license.

+#### Models & Sounds
+
+Models
+
+Sounds
+
+* sound/items/armor_shard_q3.wav Armor shard sound from Quake 3 (id Software).
+* sound/items/item_respawn_q3.wav item repsawning sound from Q3 (id Software).
+* sound/oldone2/pd_pop2.wav from progs_dump version 3.0
+
### The Name "Dog Mode"

I have a (now foggy) memory of a night of PQL duels where, inbetween

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

Diff autoexec.cfg

diff --git a/autoexec.cfg b/autoexec.cfg
index e46d21f..ed12c6c 100644
--- a/autoexec.cfg
+++ b/autoexec.cfg
@@ -1,4 +1,12 @@
-cl_run 0
-pm_airstep 1
-pm_walljump 1
-sv_bigcoords 1
+// don't autoswitch weapons
+seta cg_autoswitch 0
+//
+seta cl_run 0
+// enable air stepping
+seta pm_airstep 1
+// enable wall jumps
+seta pm_walljump 1
+// transmit large coords from server to client
+seta sv_bigcoords 1
+// save in FTE format
+seta sv_savefmt 1

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

Diff qc/ai.qc

diff --git a/qc/ai.qc b/qc/ai.qc
index f123707..24a28a8 100644
--- a/qc/ai.qc
+++ b/qc/ai.qc
@@ -330,6 +330,15 @@ void() SightSound =
sound_sight (self, CHAN_VOICE, "boss2/sight.wav", 1, ATTN_NONE);
};

+// TODO CEV
+void(entity ent) FoundTargetForEntity =
+{
+ entity oself = self;
+ self = ent;
+ FoundTarget ();
+ self = oself;
+}
+
void() FoundTarget =
{
if (self.enemy.classname == "player")

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

Diff qc/classes/base_trigger.qc

diff --git a/qc/classes/base_trigger.qc b/qc/classes/base_trigger.qc
new file mode 100644
index 0000000..957cfc5
--- /dev/null
+++ b/qc/classes/base_trigger.qc
@@ -0,0 +1,46 @@
+//==============================================================================
+// base_trigger.qc -- trigger base class
+//==============================================================================
+
+//------------------------------------------------------------------------------
+class base_trigger: entity
+{
+ //--------------------------------------------------------------
+ // InitTrigger
+ //--------------------------------------------------------------
+ nonvirtual void() init_trigger =
+ {
+ // trigger angles are used for one-way touches.
+ // An angle of 0 is assumed to mean no restrictions, so use a
+ // yaw of 360 instead.
+ if (this.angles != '0 0 0')
+ SetMovedir ();
+
+ this.solid = SOLID_TRIGGER;
+ // set size and link into world
+ setmodel (this, this.model);
+ this.movetype = MOVETYPE_NONE;
+ this.modelindex = 0;
+ this.model = "";
+ };
+
+ //--------------------------------------------------------------
+ // InitPointTrigger -- Drake -- dumptruck_ds
+ // PM: The point trigger version of InitTrigger.
+ //--------------------------------------------------------------
+ nonvirtual void() init_point_trigger =
+ {
+ local vector v1, v2;
+
+ v1 = this.origin;
+ v2 = v1 + this.mangle;
+ this.model = "";
+ setorigin (this, '0 0 0');
+
+ // Calls 'setmodel', so do first.
+ init_trigger ();
+
+ // Calling 'setmodel' resets entity size.
+ setsize (this, v1, v2);
+ };
+};

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

Diff qc/client.qc

diff --git a/qc/client.qc b/qc/client.qc
deleted file mode 100644
index cb625e4..0000000
--- a/qc/client.qc
+++ /dev/null
@@ -1,1493 +0,0 @@
-/*==============================================================================
- CLIENT.QC
-==============================================================================*/
-
-// prototypes
-void() W_WeaponFrame;
-void() W_SetCurrentAmmo;
-void(entity attacker, float damage) player_pain;
-void() player_stand1;
-//void (vector org) spawn_tfog; //moved to items.qc -- dumptruck_ds
-void (vector org, entity death_owner) spawn_tdeath;
-
-float modelindex_eyes, modelindex_player;
-
-void() SetChangeParms =
-{
- if (self.health <= 0)
- {
- SetNewParms ();
- return;
- }
-
- // remove items
- self.items = self.items - (self.items &
- (IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY
- | IT_SUIT | IT_QUAD)
- );
-
- // cap super health
- if (self.health > 100)
- self.health = 100;
- if (self.health < 50)
- self.health = 50;
- parm1 = self.items;
- parm2 = self.health;
- parm3 = self.armorvalue;
- if (self.ammo_shells < 25)
- parm4 = 25;
- else
- parm4 = self.ammo_shells;
- parm5 = self.ammo_nails;
- parm6 = self.ammo_rockets;
- parm7 = self.ammo_cells;
- parm8 = self.weapon;
- parm9 = self.armortype * 100;
-};
-
-void() SetNewParms =
-{
- parm2 = 100; // self.health
- parm3 = 0; // self.armorvalue
- parm5 = 0; // self.ammo_nails
- parm6 = 0; // self.ammo_rockets
- parm7 = 0; // self.ammo_cells
- parm9 = 0; // self.armortype * 100
-
- // "reset_items 2" makes the player start with only the axe -- iw
- if (world.reset_items == 2)
- {
- parm1 = IT_AXE; // self.items
- parm4 = 0; // self.ammo_shells
- parm8 = IT_AXE; // self.weapon
- }
- else
- {
- parm1 = IT_AXE | IT_SHOTGUN; // self.items
- parm4 = 25; // self.ammo_shells
- parm8 = IT_SHOTGUN; // self.weapon
- }
-};
-
-void() DecodeLevelParms =
-{
- // Reset the player's inventory if they returned to the start map
- // with a rune, or if the mapper set the "reset_items" field of
- // worldspawn to a non-zero value. (The old "reset_items" check,
- // which this replaces, had a comment from dumptruck_ds thanking
- // Spike.) -- iw
- if ((serverflags != 0 && world.model == "maps/start.bsp") ||
- world.reset_items != 0)
- {
- SetNewParms ();
- }
-
- self.items = parm1;
- self.health = parm2;
- self.armorvalue = parm3;
- self.ammo_shells = parm4;
- self.ammo_nails = parm5;
- self.ammo_rockets = parm6;
- self.ammo_cells = parm7;
- self.weapon = parm8;
- self.armortype = parm9 * 0.01;
-};
-
-void(entity client, string savename) autosave =
-{
- //autosavename = savename;
- stuffcmd(client, "echo Autosaving...; wait; save ");
- stuffcmd(client, savename);
- stuffcmd(client, "\n");
-}
-
-/*==============================================================================
- PLAYER GAME EDGE FUNCTIONS
-==============================================================================*/
-
-void() set_suicide_frame;
-
-// called by ClientKill and DeadThink
-void() respawn =
-{
- if (coop)
- {
- // make a copy of the dead body for appearances sake
- CopyToBodyQue (self);
- // get the spawn parms as they were at level start
- setspawnparms (self);
- // respawn
- PutClientInServer ();
- }
- else if (deathmatch)
- {
- // make a copy of the dead body for appearances sake
- CopyToBodyQue (self);
- // set default spawn parms
- SetNewParms ();
- // respawn
- PutClientInServer ();
- }
- else
- { // restart the entire server
- localcmd ("restart\n");
- }
-};
-
-//======================================================================
-// ClientKill
-// Player entered the suicide command
-//======================================================================
-void() ClientKill =
-{
- // 1998-07-27 Suicide during intermission fix by Zhenga start
- // not allowed during intermission
- if ((intermission_running) && ((coop) || (deathmatch)))
- return;
- // 1998-07-27 Suicide during intermission fix by Zhenga end
- bprint (self.netname);
- bprint (" suicides\n");
- set_suicide_frame ();
- self.modelindex = modelindex_player;
- // extra penalty
- self.frags = self.frags - 2;
- respawn ();
-};
-
-float(vector v) CheckSpawnPoint =
-{
- return FALSE;
-};
-
-//======================================================================
-// SelectSpawnPoint
-// Returns the entity to spawn at
-//======================================================================
-entity() SelectSpawnPoint =
-{
- local entity spot;
- local entity thing;
- local float pcount;
-
- // testinfo_player_start is only found in regioned levels
- spot = find (world, classname, "testplayerstart");
- if (spot) return spot;
-
- // choose a info_player_deathmatch point
- if (coop)
- {
- lastspawn = find (lastspawn, classname, "info_player_coop");
- if (lastspawn == world)
- lastspawn = find (lastspawn, classname,
- "info_player_start");
- if (lastspawn != world) return lastspawn;
- }
- else if (deathmatch)
- {
- spot = lastspawn;
- // TODO CEV this loops infinitely if no info_player_deathmatch
- while (1)
- {
- spot = find (spot, classname, "info_player_deathmatch");
- if (spot != world)
- {
- if (spot == lastspawn) return lastspawn;
- pcount = 0;
- thing = findradius (spot.origin, 32);
- while (thing)
- {
- if (thing.classname == "player")
- pcount = pcount + 1;
- thing = thing.chain;
- }
- if (pcount == 0)
- {
- lastspawn = spot;
- return spot;
- }
- }
- }
- }
-
- if (serverflags)
- {
- // return with a rune to start
- spot = find (world, classname, "info_player_start2");
- if (spot) return spot;
- }
-
- spot = find (world, classname, "info_player_start");
- if (!spot)
- error ("PutClientInServer: no info_player_start on level");
-
- return spot;
-};
-
-// TODO CEV
-float(entity to, float fl) SendPlayer =
-{
- WriteByte (MSG_ENTITY, CLASS_PLAYER);
- WriteByte (MSG_ENTITY, self.frame);
- WriteCoord (MSG_ENTITY, self.origin_x);
- WriteCoord (MSG_ENTITY, self.origin_y);
- WriteCoord (MSG_ENTITY, self.origin_z);
- WriteShort (MSG_ENTITY, self.angles_x * 32767 / 360);
- WriteShort (MSG_ENTITY, self.angles_y * 32767 / 360);
- WriteShort (MSG_ENTITY, self.angles_z * 32767 / 360);
- WriteShort (MSG_ENTITY, self.velocity_x);
- WriteShort (MSG_ENTITY, self.velocity_y);
- WriteShort (MSG_ENTITY, self.velocity_z);
- WriteFloat (MSG_ENTITY, self.flags);
- WriteFloat (MSG_ENTITY, self.pmove_flags);
- WriteFloat (MSG_ENTITY, self.doublejump_timer);
- WriteFloat (MSG_ENTITY, self.groundboost_timer);
- return TRUE;
-};
-
-//======================================================================
-// PutClientInServer
-// called each time a player is spawned
-//======================================================================
-void() DecodeLevelParms;
-void() PlayerDie;
-// 1998-09-16 Sliding/not-jumping on monsters/boxes/players fix by Maddes/Kryten
-void() monster_touch;
-
-void() PutClientInServer =
-{
- local entity spot;
-
- spot = SelectSpawnPoint ();
-
- self.classname = "player";
- self.health = 100;
- self.takedamage = DAMAGE_AIM;
- self.solid = SOLID_SLIDEBOX;
- self.movetype = MOVETYPE_WALK;
- self.show_hostile = 0;
- self.max_health = 100;
- self.flags = FL_CLIENT;
- self.air_finished = time + 12;
- self.dmg = 2; // initial water damage
- self.super_damage_finished = 0;
- self.radsuit_finished = 0;
- self.invisible_finished = 0;
- self.invincible_finished = 0;
- self.effects = 0;
- self.invincible_time = 0;
- self.deathtype = "";
- self.gravity = 0;
- self.wantedgravity = 0;
- self.customkeys = 0; // support for item_key_custom -- iw
-
- // Setup cutscene stuff. Legacy code from Zerstorer. -- dumptruck_ds
- self.script_count = 2;
- self.script_delay = 1;
- self.script_time = 0;
-
- DecodeLevelParms ();
-
- W_SetCurrentAmmo ();
-
- self.attack_finished = time;
- self.th_pain = player_pain;
- self.th_die = PlayerDie;
- // 1998-09-16 Sliding/not-jumping on monsters/boxes/players fix
- // by Maddes/Kryten
- self.touch = monster_touch;
- self.deadflag = DEAD_NO;
- // pausetime is set by teleporters to keep the player from moving
- // for a while
- self.pausetime = 0;
-
- // spot = SelectSpawnPoint ();
-
- self.origin = spot.origin + '0 0 1';
- self.angles = spot.angles;
- self.fixangle = TRUE; // turn this way immediately
-
- // fog control.
- // Looks if there's any fog values set at the current spawn point.
- // If not, looks for those in worldspawn instead
- if (spot.fog_density)
- fog_save (self, spot.fog_density, spot.fog_color);
- else if (world.fog_density)
- fog_save (self, world.fog_density, world.fog_color);
-
- if (spot.skyfog_density)
- skyfog_save (self, spot.skyfog_density);
- else if (world.skyfog_density)
- skyfog_save (self, world.skyfog_density);
-
- // decreased on subsequent frames, used to start some fog-related stuff
- cleanUpClientStuff = 2;
-
- // oh, this is a hack!
- setmodel (self, "progs/eyes.mdl");
- modelindex_eyes = self.modelindex;
-
- // Drake -- dumptruck_ds
- setmodel (self, "progs/s_null.spr");
- // Drake -- dumptruck_ds
- // setmodel (self, "progs/null_256.spr");
- mindex_inviso = self.modelindex;
-
- setmodel (self, "progs/player.mdl");
- modelindex_player = self.modelindex;
-
- setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
-
- self.view_ofs = '0 0 22';
- // Mod - Xian (May.20.97)
- // Bug where player would have velocity from their last kill
- self.velocity = '0 0 0';
- // 1998-07-21 Player moves after respawn fix by Xian
-
- // TODO CEV
- self.SendEntity = SendPlayer;
- self.SendFlags = 0xffffff;
-
- player_stand1 ();
-
- if (deathmatch || coop)
- {
- makevectors (self.angles);
- spawn_tfog (self.origin + v_forward*20);
- }
-
- spawn_tdeath (self.origin, self);
-};
-
-
-/*==============================================================================
- QUAKED FUNCTIONS
-==============================================================================*/
-
-/*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/player.mdl");
-}
-The normal starting point for a level.
-*/
-void() info_player_start =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit ())
- return;
-};
-
-
-/*QUAKED info_player_start2 (1 0 0) (-16 -16 -24) (16 16 24) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/player.mdl");
-}
-Only used on start map for the return point from an episode.
-*/
-void() info_player_start2 =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit ())
- return;
-};
-
-
-/*
-saved out by quaked in region mode
-*/
-void() testplayerstart =
-{
-};
-
-/*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");
-}
-potential spawning position for coop games
-*/
-void() info_player_coop =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit ())
- return;
-};
-
-/*QUAKED info_monster_spawnpoint (1 0 1) (-16 -16 -24) (16 16 24) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
-model ("progs/teleport.mdl");
-}
- spawning position for func_monster_spawner
-*/
-void() info_monster_spawnpoint =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit ())
- return;
-};
-
-/*==============================================================================
- RULES
-==============================================================================*/
-
-// go to the next level for deathmatch
-// only called if a time or frag limit has expired
-void() NextLevel =
-{
- local entity o;
-
- if (mapname == "start")
- {
- if (!cvar ("registered"))
- {
- mapname = "e1m1";
- }
- else if (!(serverflags & 1))
- {
- mapname = "e1m1";
- serverflags = serverflags | 1;
- }
- else if (!(serverflags & 2))
- {
- mapname = "e2m1";
- serverflags = serverflags | 2;
- }
- else if (!(serverflags & 4))
- {
- mapname = "e3m1";
- serverflags = serverflags | 4;
- }
- else if (!(serverflags & 8))
- {
- mapname = "e4m1";
- serverflags = serverflags - 7;
- }
-
- o = spawn ();
- o.map = mapname;
- }
- else
- {
- // find a trigger changelevel
- o = find (world, classname, "trigger_changelevel");
-
- // go back to start if no trigger_changelevel
- if (!o)
- {
- mapname = "start";
- o = spawn ();
- o.map = mapname;
- }
- }
-
- nextmap = o.map;
- gameover = TRUE;
-
- if (o.nextthink < time)
- {
- o.think = execute_changelevel;
- o.nextthink = time + 0.1;
- }
-};
-
-//======================================================================
-// CheckRules
-// Exit deathmatch games upon conditions
-//======================================================================
-void() CheckRules =
-{
- local float timelimit;
- local float fraglimit;
-
- // someone else quit the game already
- if (gameover) return;
-
- timelimit = cvar ("timelimit") * 60;
- fraglimit = cvar ("fraglimit");
-
- // 1998-07-27 Timelimit/Fraglimit fix by Maddes
- if (deathmatch && timelimit && time >= timelimit)
- {
- NextLevel ();
- return;
- }
-
- // 1998-07-27 Timelimit/Fraglimit fix by Maddes
- if (deathmatch && fraglimit && self.frags >= fraglimit)
- {
- NextLevel ();
- return;
- }
-};
-
-//======================================================================
-void() PlayerDeathThink =
-{
- local float forward;
-
- if ((self.flags & FL_ONGROUND))
- {
- forward = vlen (self.velocity);
- forward = forward - 20;
- if (forward <= 0)
- self.velocity = '0 0 0';
- else
- self.velocity = forward * normalize (self.velocity);
- }
-
- // wait for all buttons released
- if (self.deadflag == DEAD_DEAD)
- {
- if (self.button2 || self.button1 || self.button0)
- return;
- self.deadflag = DEAD_RESPAWNABLE;
- return;
- }
-
- // wait for any button down
- if (!self.button2 && !self.button1 && !self.button0)
- return;
-
- self.button0 = 0;
- self.button1 = 0;
- self.button2 = 0;
- respawn ();
-};
-
-//======================================================================
-// PlayerClimb -- johnfitz
-//----------------------------------------------------------------------
-void() PlayerClimb =
-{
- self.velocity = '0 0 160';
-}
-
-//======================================================================
-// PlayerJump
-//----------------------------------------------------------------------
-void() PlayerJump =
-{
- if (self.flags & FL_WATERJUMP)
- return;
-
- if (self.waterlevel >= 2)
- {
- if (self.watertype == CONTENT_WATER)
- self.velocity_z = 100;
- else if (self.watertype == CONTENT_SLIME)
- self.velocity_z = 80;
- else
- self.velocity_z = 50;
-
- // play swiming sound
- if (self.swim_flag < time)
- {
- self.swim_flag = time + 1;
- if (random() < 0.5)
- sound (self, CHAN_BODY, "misc/water1.wav",
- 1, ATTN_NORM);
- else
- sound (self, CHAN_BODY, "misc/water2.wav",
- 1, ATTN_NORM);
- }
- return;
- }
-
- // refactoring from Copper -- dumptruck_ds
- if (self.movetype != MOVETYPE_NOCLIP)
- {
- if (!(self.flags & FL_ONGROUND))
- return;
- // don't pogo stick
- if ( !(self.flags & FL_JUMPRELEASED) )
- return;
- // player jumping sound (h00rt)
- sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
- }
-
- self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
-
- // don't stairwalk
- self.flags = self.flags - FL_ONGROUND;
-
- self.button2 = 0;
- // sound (self, CHAN_AUTO, "player/plyrjmp8.wav", 1, ATTN_NORM);
- self.velocity_z = self.velocity_z + 270;
-};
-
-//======================================================================
-// WaterMove
-//======================================================================
-.float dmgtime;
-
-void() WaterMove =
-{
- if (self.movetype == MOVETYPE_NOCLIP)
- {
- self.air_finished = time + 120;
- return;
- }
-
- if (self.health < 0)
- return;
-
- if (self.waterlevel != 3)
- {
- if (self.air_finished < time)
- sound (self, CHAN_VOICE, "player/gasp2.wav",
- 1, ATTN_NORM);
- else if (self.air_finished < time + 9)
- sound (self, CHAN_VOICE, "player/gasp1.wav",
- 1, ATTN_NORM);
- self.air_finished = time + 12;
- self.dmg = 2;
- }
- else if (self.air_finished < time)
- {
- // drown!
- if (self.pain_finished < time)
- {
- self.dmg = self.dmg + 2;
- if (self.dmg > 15)
- self.dmg = 10;
- self.deathtype = "drowning";
- T_Damage (self, world, world, self.dmg);
- self.deathtype = "";
- self.pain_finished = time + 1;
- }
- }
-
- if (!self.waterlevel)
- {
- if (self.flags & FL_INWATER)
- {
- // play leave water sound
- sound (self, CHAN_BODY, "misc/outwater.wav",
- 1, ATTN_NORM);
- self.flags = self.flags - FL_INWATER;
- }
- return;
- }
-
- if (self.watertype == CONTENT_LAVA)
- {
- // do damage
- if (self.dmgtime < time)
- {
- if (self.radsuit_finished > time)
- self.dmgtime = time + 1;
- else
- self.dmgtime = time + 0.2;
-
- self.deathtype = "lava";
- T_Damage (self, world, world, 10 * self.waterlevel);
- self.deathtype = "";
- }
- }
- else if (self.watertype == CONTENT_SLIME)
- {
- // do damage
- if (self.dmgtime < time && self.radsuit_finished < time)
- {
- self.dmgtime = time + 1;
- self.deathtype = "slime";
- T_Damage (self, world, world, 4 * self.waterlevel);
- self.deathtype = "";
- }
- }
-
- if ( !(self.flags & FL_INWATER) )
- {
-
- // player enter water sound
- if (self.watertype == CONTENT_LAVA)
- sound (self, CHAN_BODY, "player/inlava.wav",
- 1, ATTN_NORM);
- if (self.watertype == CONTENT_WATER)
- sound (self, CHAN_BODY, "player/inh2o.wav",
- 1, ATTN_NORM);
- if (self.watertype == CONTENT_SLIME)
- sound (self, CHAN_BODY, "player/slimbrn2.wav",
- 1, ATTN_NORM);
-
- self.flags = self.flags + FL_INWATER;
- self.dmgtime = 0;
- }
-};
-
-//======================================================================
-// CheckWaterJump
-//----------------------------------------------------------------------
-void() CheckWaterJump =
-{
- // from Copper -- dumptruck_ds
- if (self.movetype == MOVETYPE_NOCLIP)
- return;
-
- local vector start, end;
-
- // check for a jump-out-of-water
- makevectors (self.angles);
- start = self.origin;
- start_z = start_z + 8;
- v_forward_z = 0;
- normalize (v_forward);
- end = start + v_forward * 24;
- traceline (start, end, TRUE, self);
- if (trace_fraction < 1)
- {
- // solid at waist
- start_z = start_z + self.maxs_z - 8;
- end = start + v_forward * 24;
- self.movedir = trace_plane_normal * -50;
- traceline (start, end, TRUE, self);
- if (trace_fraction == 1)
- {
- // open at eye level
- self.flags = self.flags | FL_WATERJUMP;
- self.velocity_z = 225;
- self.flags -= self.flags & FL_JUMPRELEASED;
- // safety net
- self.teleport_time = time + 2; // safety net
- return;
- }
- }
-};
-
-//======================================================================
-// PlayerPreThink
-// Called every frame before physics are run
-//======================================================================
-void() PlayerPreThink =
-{
- local float do_ladder_physics = FALSE;
-
- if (intermission_running)
- {
- // otherwise a button could be missed between the think tics
- IntermissionThink ();
- return;
- }
-
- if (self.view_ofs == '0 0 0')
- {
- // Check for cutscene stuff.
- Cutscene_Think ();
- // intermission or finale
- return;
- }
-
- // note that this code block is here, before the tests which check
- // whether the player is dead, so that the player's gravity will be
- // correctly updated even if they e.g. fell off a ladder because
- // they died -- iw
- if (autocvar(pm_standardphysics, FALSE))
- {
- if (self.pmove_flags & PMF_ONLADDER)
- {
- do_ladder_physics = TRUE;
- // not zero, because zero means "default"
- self.gravity = 0.0000001;
- self.pmove_flags &= ~PMF_ONLADDER;
- }
- else
- {
- do_ladder_physics = FALSE;
- self.gravity = self.wantedgravity;
- }
- }
- else
- {
- self.gravity = self.wantedgravity;
- }
-
- // If just spawned in, try to recover previous fog values from
- // own client entity, if any
- if (cleanUpClientStuff)
- fog_setFromEnt(self, self);
-
- // is this still used?
- makevectors (self.v_angle);
-
- CheckRules ();
- WaterMove ();
-
- // Run legacy CheckWaterJump if we're doing standard physics -- CEV
- if (autocvar(pm_standardphysics, FALSE))
- if (self.waterlevel == 2)
- CheckWaterJump ();
-
- if (self.deadflag >= DEAD_DEAD)
- {
- PlayerDeathThink ();
- return;
- }
-
- if (self.deadflag == DEAD_DYING)
- // dying, so do nothing
- return;
-
- // johnfitz ladder conditions, added from Rubicon2 -- dumptruck_ds
- if (autocvar(pm_standardphysics, FALSE))
- {
- if (do_ladder_physics)
- {
- if (self.button2)
- {
- PlayerClimb ();
- /*
- // no ladder footsteps for now
- if (time > self.ladder_step_finished)
- {
- r = random();
- if (r > 0.66)
- sound (self, CHAN_BODY,
- "ladder/metal1.wav",
- 0.5, ATTN_NORM);
- else if (r > 0.33)
- sound (self, CHAN_BODY,
- "ladder/metal2.wav",
- 0.5, ATTN_NORM);
- else
- sound (self, CHAN_BODY,
- "ladder/metal3.wav",
- 0.5, ATTN_NORM);
- self.ladder_step_finished = time + 0.3;
- }
- */
- }
- else
- {
- self.flags = self.flags | FL_JUMPRELEASED;
- self.velocity = 0.9 * self.velocity;
- self.velocity_z = 0;
- }
- }
- else
- {
- if (self.button2)
- PlayerJump ();
- else
- self.flags = self.flags | FL_JUMPRELEASED;
- }
- }
-
- // teleporters can force a non-moving pause time
- if (time < self.pausetime)
- self.velocity = '0 0 0';
-
- if (time > self.attack_finished && self.currentammo == 0
- && self.weapon != IT_AXE)
- {
- self.weapon = W_BestWeapon ();
- W_SetCurrentAmmo ();
- }
-
- // from copper -- dumptruck_ds
- if (autocvar(pm_standardphysics, FALSE))
- {
- if (self.movetype == MOVETYPE_NOCLIP)
- {
- self.flags = self.flags | FL_FLY;
- }
- }
-
- // TODO CEV
- if (self.groundboost_timer <= 0 && (self.teleport_time > time - 0.1))
- self.groundboost_timer = PM_GROUNDBOOST_WINDOW;
-};
-
-//======================================================================
-// CheckPowerups
-// Check for turning off powerups
-//======================================================================
-void() CheckPowerups =
-{
- if (self.health <= 0) return;
-
- // invisibility
- if (self.invisible_finished)
- {
- // sound and screen flash when items starts to run out
- if (self.invisible_sound < time)
- {
- sound (self, CHAN_AUTO, "items/inv3.wav", 0.5, ATTN_IDLE);
- self.invisible_sound = time + ((random() * 3) + 1);
- }
-
- if (self.invisible_finished < time + 3)
- {
- if (self.invisible_time == 1)
- {
- sprint (self, "Ring of Shadows magic is fading\n");
- stuffcmd (self, "bf\n");
- sound (self, CHAN_AUTO, "items/inv2.wav", 1, ATTN_NORM);
- self.invisible_time = time + 1;
- }
-
- if (self.invisible_time < time)
- {
- self.invisible_time = time + 1;
- stuffcmd (self, "bf\n");
- }
- }
-
- if (self.invisible_finished < time)
- {
- // just stopped
- self.items = self.items - IT_INVISIBILITY;
- self.invisible_finished = 0;
- self.invisible_time = 0;
- }
-
- // use the eyes
- self.frame = 0;
- self.modelindex = modelindex_eyes;
- }
- else
- {
- // don't use the eyes
- self.modelindex = modelindex_player;
- }
-
- // invincibility
- if (self.invincible_finished)
- {
- // sound and screen flash when items starts to run out
- if (self.invincible_finished < time + 3)
- {
- if (self.invincible_time == 1)
- {
- sprint (self, "Protection is almost burned out\n");
- stuffcmd (self, "bf\n");
- sound (self, CHAN_AUTO, "items/protect2.wav", 1, ATTN_NORM);
- self.invincible_time = time + 1;
- }
-
- if (self.invincible_time < time)
- {
- self.invincible_time = time + 1;
- stuffcmd (self, "bf\n");
- }
- }
-
- if (self.invincible_finished < time)
- {
- // just stopped
- self.items = self.items - IT_INVULNERABILITY;
- self.invincible_time = 0;
- self.invincible_finished = 0;
- }
- if (self.invincible_finished > time)
- self.effects = self.effects | EF_DIMLIGHT;
- else
- self.effects -= self.effects & EF_DIMLIGHT;
- }
-
- // super damage
- if (self.super_damage_finished)
- {
- // sound and screen flash when items starts to run out
- if (self.super_damage_finished < time + 3)
- {
- if (self.super_time == 1)
- {
- sprint (self, "Quad Damage is wearing off\n");
- stuffcmd (self, "bf\n");
- sound (self, CHAN_AUTO, "items/damage2.wav", 1, ATTN_NORM);
- self.super_time = time + 1;
- }
-
- if (self.super_time < time)
- {
- self.super_time = time + 1;
- stuffcmd (self, "bf\n");
- }
- }
-
- if (self.super_damage_finished < time)
- {
- // just stopped
- self.items = self.items - IT_QUAD;
- self.super_damage_finished = 0;
- self.super_time = 0;
- }
- if (self.super_damage_finished > time)
- self.effects = self.effects | EF_DIMLIGHT;
- else
- self.effects -= self.effects & EF_DIMLIGHT;
- }
-
- // suit
- if (self.radsuit_finished)
- {
- // don't drown
- self.air_finished = time + 12;
-
- // sound and screen flash when items starts to run out
- if (self.radsuit_finished < time + 3)
- {
- if (self.rad_time == 1)
- {
- sprint (self, "Air supply in Biosuit expiring\n");
- stuffcmd (self, "bf\n");
- sound (self, CHAN_AUTO, "items/suit2.wav", 1, ATTN_NORM);
- self.rad_time = time + 1;
- }
-
- if (self.rad_time < time)
- {
- self.rad_time = time + 1;
- stuffcmd (self, "bf\n");
- }
- }
-
- if (self.radsuit_finished < time)
- {
- // just stopped
- self.items = self.items - IT_SUIT;
- self.rad_time = 0;
- self.radsuit_finished = 0;
- }
- }
-};
-
-//======================================================================
-// PlayerPostThink
-// Called every frame after physics are run
-//======================================================================
-void() PlayerPostThink =
-{
- // TODO CEV
- self.SendFlags = 0xffffff;
-
- if (self.view_ofs == '0 0 0')
- // intermission or finale
- return;
- if (self.deadflag)
- return;
-
- // do weapon stuff
- W_WeaponFrame ();
-
- // check to see if player landed and play landing sound
- if ((self.jump_flag < -300) && (self.flags & FL_ONGROUND) &&
- (self.health > 0))
- {
- if (self.watertype == CONTENT_WATER)
- sound (self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM);
- else if (self.jump_flag < -650)
- {
- self.deathtype = "falling";
- T_Damage (self, world, world, 5);
- self.deathtype = "";
- sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
- }
- else
- sound (self, CHAN_VOICE, "player/land.wav", 1, ATTN_NORM);
-
- self.jump_flag = 0;
- }
-
- if (!(self.flags & FL_ONGROUND))
- self.jump_flag = self.velocity_z;
-
- // dumptruck_ds -- this replaces item_megahealth_rot in items.qc
- if (self.health > self.max_health)
- {
- if (self.megahealth_rottime < time)
- {
- self.megahealth_rottime = time + 1;
- self.health = self.health - 1;
- }
- else if (self.health <= 100)
- {
- // thanks ydrol!!!
- self.items = self.items - (self.items & IT_SUPERHEALTH);
- }
- }
-
- CheckPowerups ();
-
- // from Copper -- dumptruck_ds
- if (autocvar(pm_standardphysics, FALSE))
- if (self.movetype != MOVETYPE_NOCLIP)
- // self.flags = not(self.flags, FL_FLY);
- self.flags &= ~FL_FLY;
-};
-
-//======================================================================
-// ClientConnect
-// called when a player connects to a server
-//======================================================================
-void() ClientConnect =
-{
- bprint (self.netname);
- bprint (" entered the game\n");
-
- // a client connecting during an intermission can cause problems
- if (intermission_running)
- ExitIntermission ();
-};
-
-//======================================================================
-// ClientDisconnect
-// called when a player disconnects from a server
-//======================================================================
-void() ClientDisconnect =
-{
- if (gameover)
- return;
- // if the level end trigger has been activated, just return
- // since they aren't *really* leaving
-
- // let everyone else know
- bprint (self.netname);
- bprint (" left the game with ");
- bprint (ftos(self.frags));
- bprint (" frags\n");
- sound (self, CHAN_BODY, "player/tornoff2.wav", 1, ATTN_NONE);
- set_suicide_frame ();
-};
-
-//======================================================================
-// ClientObituary
-// called when a player dies
-//======================================================================
-void(entity targ, entity inflictor, entity attacker) ClientObituary =
-{
- local float rnum;
- local string deathstring, deathstring2;
-
- rnum = random();
- deathstring = deathstring2 = "";
-
- // refactored to remove one level of indentation -- CEV
- if (targ.classname != "player") return;
-
- if (attacker.classname == "teledeath")
- {
- bprint (targ.netname);
- bprint (" was telefragged by ");
- bprint (attacker.owner.netname);
- bprint ("\n");
-
- attacker.owner.frags = attacker.owner.frags + 1;
- return;
- }
-
- if (attacker.classname == "teledeath2")
- {
- bprint ("Satan's power deflects ");
- bprint (targ.netname);
- bprint ("'s telefrag\n");
-
- targ.frags = targ.frags - 1;
- return;
- }
-
- // 1998-07-26 Pentagram telefrag fix by Zoid/Maddes start
- // double 666 telefrag
- // (can happen often in deathmatch 4 and levels with more
- // than one pentagram)
- if (attacker.classname == "teledeath3")
- {
- bprint (targ.netname);
- bprint (" was telefragged by ");
- bprint (attacker.owner.netname);
- bprint ("'s Satan's power\n");
- // 1998-07-26 only tfrag player on spot by Maddes start
- // targ.frags = targ.frags - 1;
- attacker.owner.frags = attacker.owner.frags + 1;
- // 1998-07-26 only tfrag player on spot by Maddes end
- return;
- }
-
- // 1998-07-26 Pentagram telefrag fix by Zoid/Maddes end
- if (attacker.classname == "player")
- {
- if (targ == attacker)
- {
- // killed self
- attacker.frags = attacker.frags - 1;
- bprint (targ.netname);
-
- if (targ.weapon == 64 && targ.waterlevel > 1)
- {
- bprint (" discharges into the water.\n");
- return;
- }
- if (targ.weapon == IT_GRENADE_LAUNCHER)
- bprint (" tries to put the pin back in\n");
- else
- bprint (" becomes bored with life\n");
- return;
- }
- else if ((teamplay == 2) && (targ.team > 0) &&
- (targ.team == attacker.team))
- {
- if (rnum < 0.25)
- deathstring = " mows down a teammate\n";
- else if (rnum < 0.50)
- deathstring = " checks his glasses\n";
- else if (rnum < 0.75)
- deathstring = " gets a frag for the other team\n";
- else
- deathstring = " loses another friend\n";
- bprint (attacker.netname);
- bprint (deathstring);
- attacker.frags = attacker.frags - 1;
- return;
- }
- else
- {
- attacker.frags = attacker.frags + 1;
-
- rnum = attacker.weapon;
- if (rnum == IT_AXE)
- {
- deathstring = " was ax-murdered by ";
- deathstring2 = "\n";
- }
- if (rnum == IT_SHOTGUN)
- {
- deathstring = " chewed on ";
- deathstring2 = "'s boomstick\n";
- }
- if (rnum == IT_SUPER_SHOTGUN)
- {
- deathstring = " ate 2 loads of ";
- deathstring2 = "'s buckshot\n";
- }
- if (rnum == IT_NAILGUN)
- {
- deathstring = " was nailed by ";
- deathstring2 = "\n";
- }
- if (rnum == IT_SUPER_NAILGUN)
- {
- deathstring = " was punctured by ";
- deathstring2 = "\n";
- }
- if (rnum == IT_GRENADE_LAUNCHER)
- {
- deathstring = " eats ";
- deathstring2 = "'s pineapple\n";
- if (targ.health < -40)
- {
- deathstring = " was gibbed by ";
- deathstring2 = "'s grenade\n";
- }
- }
- if (rnum == IT_ROCKET_LAUNCHER)
- {
- deathstring = " rides ";
- deathstring2 = "'s rocket\n";
- if (targ.health < -40)
- {
- deathstring = " was gibbed by ";
- deathstring2 = "'s rocket\n" ;
- }
- }
- if (rnum == IT_LIGHTNING)
- {
- deathstring = " accepts ";
- if (attacker.waterlevel > 1)
- deathstring2 = "'s discharge\n";
- else
- deathstring2 = "'s shaft\n";
- }
- bprint (targ.netname);
- bprint (deathstring);
- bprint (attacker.netname);
- bprint (deathstring2);
- }
- return;
- }
- else
- {
- targ.frags = targ.frags - 1;
- bprint (targ.netname);
-
- // custom obituary messages
- if (inflictor.deathtype != "")
- {
- bprint (" ");
- bprint (inflictor.deathtype);
- bprint ("\n");
- return;
- }
- if (attacker.deathtype != "")
- {
- bprint (" ");
- bprint (attacker.deathtype);
- bprint ("\n");
- return;
- }
-
- // killed by a monster?
- // if (attacker.flags & FL_MONSTER)
- if ((attacker.flags & FL_MONSTER) && (attacker.obit_name == ""))
- {
- if (attacker.classname == "monster_army")
- bprint (" was shot by a Grunt\n");
- if (attacker.classname == "monster_demon1")
- bprint (" was eviscerated by a Fiend\n");
- if (attacker.classname == "monster_dog")
- bprint (" was mauled by a Rottweiler\n");
- if (attacker.classname == "monster_dragon")
- bprint (" was fried by a Dragon\n");
- if (attacker.classname == "monster_enforcer")
- bprint (" was blasted by an Enforcer\n");
- if (attacker.classname == "monster_fish")
- bprint (" was fed to the Rotfish\n");
- if (attacker.classname == "monster_hell_knight")
- bprint (" was slain by a Death Knight\n");
- if (attacker.classname == "monster_knight")
- bprint (" was slashed by a Knight\n");
- if (attacker.classname == "monster_ogre")
- bprint (" was destroyed by an Ogre\n");
- if (attacker.classname == "monster_ogre_marksman")
- // dumptruck_ds
- bprint (" was felled by a Marksman\n");
- if (attacker.classname == "monster_oldone")
- bprint (" became one with Shub-Niggurath\n");
- if (attacker.classname == "monster_oldone2")
- // dumptruck_ds
- bprint (" became one with Shub-Niggurath\n");
- if (attacker.classname == "monster_boss2")
- // dumptruck_ds
- bprint (" was exploded by Chthon\n");
- if (attacker.classname == "monster_boss")
- // dumptruck_ds
- bprint (" was exploded by Chthon\n");
- if (attacker.classname == "monster_shalrath")
- bprint (" was exploded by a Vore\n");
- if (attacker.classname == "monster_shambler")
- bprint (" was smashed by a Shambler\n");
- if (attacker.classname == "monster_vomit")
- bprint (" was vomited on by a Vomitus\n");
- if (attacker.classname == "monster_wizard")
- bprint (" was scragged by a Scrag\n");
- if (attacker.classname == "monster_zombie")
- bprint (" joins the Zombies\n");
-
- return;
- }
-
- // obits for custom monsters -- progs_dump -- dumptruck_ds
- if (attacker.obit_name != "")
- {
- bprint (" was ");
- if !(attacker.obit_method)
- bprint ("killed");
- else
- // e.g. ripped apart
- bprint (attacker.obit_method);
- bprint (" by ");
- // a bad monster
- bprint (attacker.obit_name);
- bprint ("\n");
- return;
- }
-
- // tricks and traps
- if (attacker.classname == "explo_box" ||
- attacker.classname == "play_explosion")
- {
- bprint (" blew up\n");
- return;
- }
- if (attacker.classname == "func_laser")
- {
- bprint (" discovered that lasers are hot\n");
- return;
- }
- if ((attacker.solid == SOLID_BSP &&
- attacker != world &&
- attacker.classname != "togglewall") ||
- (inflictor.classname == "func_movewall" &&
- !(inflictor.spawnflags & MOVEWALL_TOUCH)))
- {
- bprint (" was squished\n");
- return;
- }
- if (attacker.classname == "trap_shooter" ||
- attacker.classname == "trap_spikeshooter" ||
- attacker.classname == "trap_switched_shooter")
- {
- // bprint (" was spiked\n");
- // changed for custom shooters -- dumptruck_ds
- bprint (" was unlucky\n");
- return;
- }
- if (attacker.classname == "ltrail_start" ||
- attacker.classname == "ltrail_relay")
- {
- bprint (" had an electrifying experience\n");
- return;
- }
- if (attacker.classname == "fireball")
- {
- bprint (" ate a lavaball\n");
- return;
- }
- if (attacker.classname == "trigger_changelevel")
- {
- bprint (" tried to leave\n");
- return;
- }
-
- // in-liquid deaths
- if (targ.deathtype == "drowning")
- {
- if (random() < 0.5)
- bprint (" sleeps with the fishes\n");
- else
- bprint (" sucks it down\n");
- return;
- }
- if (targ.deathtype == "slime")
- {
- if (random() < 0.5)
- bprint (" gulped a load of slime\n");
- else
- bprint (" can't exist on slime alone\n");
- return;
- }
- if (targ.deathtype == "lava")
- {
- if (targ.health < -15)
- {
- bprint (" burst into flames\n");
- return;
- }
- if (random() < 0.5)
- bprint (" turned into hot slag\n");
- else
- bprint (" visits the Volcano God\n");
- return;
- }
-
- // fell to their death?
- if (targ.deathtype == "falling")
- {
- bprint (" fell to his death\n");
- return;
- }
-
- // hell if I know; he's just dead!!!
- bprint (" died\n");
- }
-};

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

Diff qc/client/connect.qc

diff --git a/qc/client/connect.qc b/qc/client/connect.qc
new file mode 100644
index 0000000..6b2fe77
--- /dev/null
+++ b/qc/client/connect.qc
@@ -0,0 +1,37 @@
+//==============================================================================
+// client/connect.qc
+//==============================================================================
+
+//----------------------------------------------------------------------
+// ClientConnect
+// called when a player connects to a server
+//----------------------------------------------------------------------
+void() ClientConnect =
+{
+ bprint (self.netname);
+ bprint (" entered the game\n");
+
+ // a client connecting during an intermission can cause problems
+ if (intermission_running)
+ ExitIntermission ();
+};
+
+//----------------------------------------------------------------------
+// ClientDisconnect
+// called when a player disconnects from a server
+//----------------------------------------------------------------------
+void() ClientDisconnect =
+{
+ // if the level end trigger has been activated, just return
+ // since they aren't *really* leaving
+ if (gameover)
+ return;
+
+ // let everyone else know
+ bprint (self.netname);
+ bprint (" left the game with ");
+ bprint (ftos(self.frags));
+ bprint (" frags\n");
+ sound (self, CHAN_BODY, "player/tornoff2.wav", 1, ATTN_NONE);
+ set_suicide_frame ();
+};

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 aebefa5..19f897a 100644
--- a/qc/client/impulse.qc
+++ b/qc/client/impulse.qc
@@ -26,7 +26,7 @@ void() CheatCommand =

self.weapon = IT_ROCKET_LAUNCHER;
self.impulse = 0;
- W_SetCurrentAmmo ();
+ PlayerSetCurrentAmmo ();
};

//----------------------------------------------------------------------
@@ -58,30 +58,256 @@ void() ServerflagsCommand =
};

//----------------------------------------------------------------------
+// ChangeWeaponCommand -- was W_ChangeWeapon
+//----------------------------------------------------------------------
+void() ChangeWeaponCommand =
+{
+ local float it, haveammo, fl;
+
+ // assign fl to silence a warning -- CEV
+ fl = IT_AXE;
+ it = self.items;
+ haveammo = TRUE;
+
+ switch (self.impulse)
+ {
+ case 1:
+ fl = IT_AXE;
+ break;
+ case 2:
+ fl = IT_SHOTGUN;
+ if (self.ammo_shells < 1)
+ haveammo = FALSE;
+ break;
+ case 3:
+ fl = IT_SUPER_SHOTGUN;
+ if (self.ammo_shells < 2)
+ haveammo = FALSE;
+ break;
+ case 4:
+ fl = IT_NAILGUN;
+ if (self.ammo_nails < 1)
+ haveammo = FALSE;
+ break;
+ case 5:
+ fl = IT_SUPER_NAILGUN;
+ if (self.ammo_nails < 2)
+ haveammo = FALSE;
+ break;
+ case 6:
+ fl = IT_GRENADE_LAUNCHER;
+ if (self.ammo_rockets < 1)
+ haveammo = FALSE;
+ break;
+ case 7:
+ fl = IT_ROCKET_LAUNCHER;
+ if (self.ammo_rockets < 1)
+ haveammo = FALSE;
+ break;
+ case 8:
+ fl = IT_LIGHTNING;
+ if (self.ammo_cells < 1)
+ haveammo = FALSE;
+ break;
+ default:
+ dprint ("WARNING: W_ChangeWeapon: bad impulse: ");
+ dprint (ftos (self.impulse));
+ dprint ("\n");
+ return;
+ }
+
+ self.impulse = 0;
+
+ if (!(self.items & fl))
+ { // don't have the weapon or the ammo
+ sprint (self, "no weapon.\n");
+ return;
+ }
+
+ if (haveammo == FALSE)
+ { // don't have the ammo
+ sprint (self, "not enough ammo.\n");
+ return;
+ }
+
+ // set weapon, set ammo
+ self.weapon = fl;
+ PlayerSetCurrentAmmo ();
+};
+
+//----------------------------------------------------------------------
+// CycleWeaponCommand -- Go to the next weapon with ammo
+//----------------------------------------------------------------------
+void() CycleWeaponCommand =
+{
+ local float haveammo;
+
+ self.impulse = 0;
+
+ while (1)
+ {
+ haveammo = TRUE;
+
+ if (self.weapon == IT_LIGHTNING)
+ {
+ self.weapon = IT_AXE;
+ }
+ else if (self.weapon == IT_AXE)
+ {
+ self.weapon = IT_SHOTGUN;
+ if (self.ammo_shells < 1)
+ haveammo = FALSE;
+ }
+ else if (self.weapon == IT_SHOTGUN)
+ {
+ self.weapon = IT_SUPER_SHOTGUN;
+ if (self.ammo_shells < 2)
+ haveammo = FALSE;
+ }
+ else if (self.weapon == IT_SUPER_SHOTGUN)
+ {
+ self.weapon = IT_NAILGUN;
+ if (self.ammo_nails < 1)
+ haveammo = FALSE;
+ }
+ else if (self.weapon == IT_NAILGUN)
+ {
+ self.weapon = IT_SUPER_NAILGUN;
+ if (self.ammo_nails < 2)
+ haveammo = FALSE;
+ }
+ else if (self.weapon == IT_SUPER_NAILGUN)
+ {
+ self.weapon = IT_GRENADE_LAUNCHER;
+ if (self.ammo_rockets < 1)
+ haveammo = FALSE;
+ }
+ else if (self.weapon == IT_GRENADE_LAUNCHER)
+ {
+ self.weapon = IT_ROCKET_LAUNCHER;
+ if (self.ammo_rockets < 1)
+ haveammo = FALSE;
+ }
+ else if (self.weapon == IT_ROCKET_LAUNCHER)
+ {
+ self.weapon = IT_LIGHTNING;
+ if (self.ammo_cells < 1)
+ haveammo = FALSE;
+ }
+
+ if ((self.items & self.weapon) && haveammo == TRUE)
+ {
+ PlayerSetCurrentAmmo ();
+ return;
+ }
+ }
+};
+
+//----------------------------------------------------------------------
+// CycleWeaponReverseCommand -- Go to the prev weapon with ammo
+//----------------------------------------------------------------------
+void() CycleWeaponReverseCommand =
+{
+ local float haveammo;
+
+ self.impulse = 0;
+
+ while (1)
+ {
+ haveammo = TRUE;
+
+ if (self.weapon == IT_LIGHTNING)
+ {
+ self.weapon = IT_ROCKET_LAUNCHER;
+ if (self.ammo_rockets < 1)
+ haveammo = FALSE;
+ }
+ else if (self.weapon == IT_ROCKET_LAUNCHER)
+ {
+ self.weapon = IT_GRENADE_LAUNCHER;
+ if (self.ammo_rockets < 1)
+ haveammo = FALSE;
+ }
+ else if (self.weapon == IT_GRENADE_LAUNCHER)
+ {
+ self.weapon = IT_SUPER_NAILGUN;
+ if (self.ammo_nails < 2)
+ haveammo = FALSE;
+ }
+ else if (self.weapon == IT_SUPER_NAILGUN)
+ {
+ self.weapon = IT_NAILGUN;
+ if (self.ammo_nails < 1)
+ haveammo = FALSE;
+ }
+ else if (self.weapon == IT_NAILGUN)
+ {
+ self.weapon = IT_SUPER_SHOTGUN;
+ if (self.ammo_shells < 2)
+ haveammo = FALSE;
+ }
+ else if (self.weapon == IT_SUPER_SHOTGUN)
+ {
+ self.weapon = IT_SHOTGUN;
+ if (self.ammo_shells < 1)
+ haveammo = FALSE;
+ }
+ else if (self.weapon == IT_SHOTGUN)
+ {
+ self.weapon = IT_AXE;
+ }
+ else if (self.weapon == IT_AXE)
+ {
+ self.weapon = IT_LIGHTNING;
+ if (self.ammo_cells < 1)
+ haveammo = FALSE;
+ }
+
+ if ((self.items & self.weapon) && haveammo == TRUE)
+ {
+ PlayerSetCurrentAmmo ();
+ return;
+ }
+ }
+};
+
+//----------------------------------------------------------------------
// ImpulseCommands
//----------------------------------------------------------------------
void() ImpulseCommands =
{
- if (self.impulse >= 1 && self.impulse <= 8)
- W_ChangeWeapon ();
-
- if (self.impulse == 9)
- CheatCommand ();
- if (self.impulse == 10)
- CycleWeaponCommand ();
- if (self.impulse == 11)
- ServerflagsCommand ();
- if (self.impulse == 12)
- CycleWeaponReverseCommand ();
-
- if (self.impulse == 255)
- QuadCheat ();
-
- // dumptruck_ds version inspired by Copper
- if (self.impulse == 100)
- sprint (self, version);
-
- // if (self.impulse == 101) // debugging armor shards -- dumptruck_ds
+ switch (self.impulse)
+ {
+ case 1..8:
+ ChangeWeaponCommand ();
+ return;
+ case 9:
+ CheatCommand ();
+ break;
+ case 10:
+ CycleWeaponCommand ();
+ break;
+ case 11:
+ ServerflagsCommand ();
+ break;
+ case 12:
+ CycleWeaponReverseCommand ();
+ break;
+ case 100:
+ // dumptruck_ds version inspired by Copper
+ sprint (self, version);
+ break;
+ case 255:
+ QuadCheat ();
+ break;
+ default:
+ dprint (sprintf("ImpulseCommand: unknown impulse %g\n",
+ self.impulse));
+ break;
+ }
+
+ // debugging armor shards -- dumptruck_ds
+ // if (self.impulse == 101)
// dprint ("Armortype is");
// dprint (ftos(self.armortype));
// dprint ("\n");

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

Diff qc/client/levelparms.qc

diff --git a/qc/client/levelparms.qc b/qc/client/levelparms.qc
new file mode 100644
index 0000000..7ed4462
--- /dev/null
+++ b/qc/client/levelparms.qc
@@ -0,0 +1,88 @@
+//==============================================================================
+// client/levelparms.qc
+//==============================================================================
+
+//----------------------------------------------------------------------
+void() SetChangeParms =
+{
+ if (self.health <= 0)
+ {
+ SetNewParms ();
+ return;
+ }
+
+ // remove items
+ self.items = self.items - (self.items &
+ (IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY
+ | IT_SUIT | IT_QUAD)
+ );
+
+ // cap super health
+ if (self.health > 100)
+ self.health = 100;
+ if (self.health < 50)
+ self.health = 50;
+ parm1 = self.items;
+ parm2 = self.health;
+ parm3 = self.armorvalue;
+ if (self.ammo_shells < 25)
+ parm4 = 25;
+ else
+ parm4 = self.ammo_shells;
+ parm5 = self.ammo_nails;
+ parm6 = self.ammo_rockets;
+ parm7 = self.ammo_cells;
+ parm8 = self.weapon;
+ parm9 = self.armortype * 100;
+};
+
+//----------------------------------------------------------------------
+void() SetNewParms =
+{
+ parm2 = 100; // self.health
+ parm3 = 0; // self.armorvalue
+ parm5 = 0; // self.ammo_nails
+ parm6 = 0; // self.ammo_rockets
+ parm7 = 0; // self.ammo_cells
+ parm9 = 0; // self.armortype * 100
+
+ // "reset_items 2" makes the player start with only the axe -- iw
+ if (world.reset_items == 2)
+ {
+ parm1 = IT_AXE; // self.items
+ parm4 = 0; // self.ammo_shells
+ parm8 = IT_AXE; // self.weapon
+ }
+ else
+ {
+ parm1 = IT_AXE | IT_SHOTGUN; // self.items
+ parm4 = 25; // self.ammo_shells
+ parm8 = IT_SHOTGUN; // self.weapon
+ }
+};
+
+//----------------------------------------------------------------------
+void() DecodeLevelParms =
+{
+ // Reset the player's inventory if they returned to the start map
+ // with a rune, or if the mapper set the "reset_items" field of
+ // worldspawn to a non-zero value. (The old "reset_items" check,
+ // which this replaces, had a comment from dumptruck_ds thanking
+ // Spike.) -- iw
+ if ((serverflags != 0 && world.model == "maps/start.bsp") ||
+ world.reset_items != 0)
+ {
+ SetNewParms ();
+ }
+
+ self.items = parm1;
+ self.health = parm2;
+ self.armorvalue = parm3;
+ self.ammo_shells = parm4;
+ self.ammo_nails = parm5;
+ self.ammo_rockets = parm6;
+ self.ammo_cells = parm7;
+ self.weapon = parm8;
+ self.armortype = parm9 * 0.01;
+};
+

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

Diff qc/client/maprules.qc

diff --git a/qc/client/maprules.qc b/qc/client/maprules.qc
new file mode 100644
index 0000000..40d3005
--- /dev/null
+++ b/qc/client/maprules.qc
@@ -0,0 +1,91 @@
+//==============================================================================
+// client/maprules.qc -- RULES
+//==============================================================================
+
+//----------------------------------------------------------------------
+// NextLevel -- go to the next level for deathmatch
+// only called if a time or frag limit has expired
+//----------------------------------------------------------------------
+void() NextLevel =
+{
+ local trigger_changelevel t_level;
+
+ if (mapname == "start")
+ {
+ if (!cvar ("registered"))
+ {
+ mapname = "e1m1";
+ }
+ else if (!(serverflags & 1))
+ {
+ mapname = "e1m1";
+ serverflags = serverflags | 1;
+ }
+ else if (!(serverflags & 2))
+ {
+ mapname = "e2m1";
+ serverflags = serverflags | 2;
+ }
+ else if (!(serverflags & 4))
+ {
+ mapname = "e3m1";
+ serverflags = serverflags | 4;
+ }
+ else if (!(serverflags & 8))
+ {
+ mapname = "e4m1";
+ serverflags = serverflags - 7;
+ }
+
+ t_level = spawn (trigger_changelevel, map:mapname);
+ }
+ else
+ {
+ // find a trigger changelevel
+ local entity e;
+ e = findfloat (world, classtype, CT_TRIGGER_CHANGELEVEL);
+ t_level = (trigger_changelevel)e;
+
+ // go back to start if no trigger_changelevel
+ if (!t_level)
+ t_level = spawn (trigger_changelevel, map:"start");
+ }
+
+ nextmap = t_level.map;
+ gameover = TRUE;
+
+ if (t_level.nextthink < time)
+ {
+ t_level.think = trigger_changelevel::changelevel_execute;
+ t_level.nextthink = time + 0.1;
+ }
+};
+
+//----------------------------------------------------------------------
+// CheckRules -- // Exit deathmatch games upon conditions
+//----------------------------------------------------------------------
+void() CheckRules =
+{
+ local float fraglimit, timelimit;
+
+ // someone else quit the game already
+ if (gameover)
+ return;
+
+ timelimit = cvar ("timelimit") * 60;
+ fraglimit = cvar ("fraglimit");
+
+ // 1998-07-27 Timelimit/Fraglimit fix by Maddes
+ if (deathmatch && timelimit && time >= timelimit)
+ {
+ NextLevel ();
+ return;
+ }
+
+ // 1998-07-27 Timelimit/Fraglimit fix by Maddes
+ if (deathmatch && fraglimit && self.frags >= fraglimit)
+ {
+ NextLevel ();
+ return;
+ }
+};

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

Diff qc/client/obituary.qc

diff --git a/qc/client/obituary.qc b/qc/client/obituary.qc
new file mode 100644
index 0000000..3a5ff7e
--- /dev/null
+++ b/qc/client/obituary.qc
@@ -0,0 +1,336 @@
+//==============================================================================
+// client/obituary.qc
+//==============================================================================
+
+//----------------------------------------------------------------------
+// ClientObituary -- called when a player dies
+//----------------------------------------------------------------------
+void(entity targ, entity inflictor, entity attacker) ClientObituary =
+{
+ local float rnum;
+ local string deathstring, deathstring2;
+
+ rnum = random ();
+ deathstring = deathstring2 = "";
+
+ // refactored to remove one level of indentation -- CEV
+ if (targ.classname != "player")
+ return;
+
+ if (attacker.classname == "teledeath")
+ {
+ bprint (targ.netname);
+ bprint (" was telefragged by ");
+ bprint (attacker.owner.netname);
+ bprint ("\n");
+
+ attacker.owner.frags = attacker.owner.frags + 1;
+ return;
+ }
+
+ if (attacker.classname == "teledeath2")
+ {
+ bprint ("Satan's power deflects ");
+ bprint (targ.netname);
+ bprint ("'s telefrag\n");
+
+ targ.frags = targ.frags - 1;
+ return;
+ }
+
+ // 1998-07-26 Pentagram telefrag fix by Zoid/Maddes start
+ // double 666 telefrag
+ // (can happen often in deathmatch 4 and levels with more
+ // than one pentagram)
+ if (attacker.classname == "teledeath3")
+ {
+ bprint (targ.netname);
+ bprint (" was telefragged by ");
+ bprint (attacker.owner.netname);
+ bprint ("'s Satan's power\n");
+ // 1998-07-26 only tfrag player on spot by Maddes start
+ // targ.frags = targ.frags - 1;
+ attacker.owner.frags = attacker.owner.frags + 1;
+ // 1998-07-26 only tfrag player on spot by Maddes end
+ return;
+ }
+
+ // 1998-07-26 Pentagram telefrag fix by Zoid/Maddes end
+ if (attacker.classname == "player")
+ {
+ if (targ == attacker)
+ {
+ // killed self
+ attacker.frags = attacker.frags - 1;
+ bprint (targ.netname);
+
+ if (targ.weapon == 64 &&
+ targ.waterlevel > WATERLEVEL_FEET)
+ {
+ bprint (" discharges into the water.\n");
+ return;
+ }
+ if (targ.weapon == IT_GRENADE_LAUNCHER)
+ bprint (" tries to put the pin back in\n");
+ else
+ bprint (" becomes bored with life\n");
+ return;
+ }
+ else if ((teamplay == 2) && (targ.team > 0) &&
+ (targ.team == attacker.team))
+ {
+ if (rnum < 0.25)
+ deathstring = " mows down a teammate\n";
+ else if (rnum < 0.50)
+ deathstring = " checks his glasses\n";
+ else if (rnum < 0.75)
+ deathstring = " gets a frag for the other "
+ "team\n";
+ else
+ deathstring = " loses another friend\n";
+ bprint (attacker.netname);
+ bprint (deathstring);
+ attacker.frags = attacker.frags - 1;
+ return;
+ }
+ else
+ {
+ attacker.frags = attacker.frags + 1;
+
+ rnum = attacker.weapon;
+ if (rnum == IT_AXE)
+ {
+ deathstring = " was ax-murdered by ";
+ deathstring2 = "\n";
+ }
+ if (rnum == IT_SHOTGUN)
+ {
+ deathstring = " chewed on ";
+ deathstring2 = "'s boomstick\n";
+ }
+ if (rnum == IT_SUPER_SHOTGUN)
+ {
+ deathstring = " ate 2 loads of ";
+ deathstring2 = "'s buckshot\n";
+ }
+ if (rnum == IT_NAILGUN)
+ {
+ deathstring = " was nailed by ";
+ deathstring2 = "\n";
+ }
+ if (rnum == IT_SUPER_NAILGUN)
+ {
+ deathstring = " was punctured by ";
+ deathstring2 = "\n";
+ }
+ if (rnum == IT_GRENADE_LAUNCHER)
+ {
+ deathstring = " eats ";
+ deathstring2 = "'s pineapple\n";
+ if (targ.health < -40)
+ {
+ deathstring = " was gibbed by ";
+ deathstring2 = "'s grenade\n";
+ }
+ }
+ if (rnum == IT_ROCKET_LAUNCHER)
+ {
+ deathstring = " rides ";
+ deathstring2 = "'s rocket\n";
+ if (targ.health < -40)
+ {
+ deathstring = " was gibbed by ";
+ deathstring2 = "'s rocket\n" ;
+ }
+ }
+ if (rnum == IT_LIGHTNING)
+ {
+ deathstring = " accepts ";
+ if (attacker.waterlevel > WATERLEVEL_FEET)
+ deathstring2 = "'s discharge\n";
+ else
+ deathstring2 = "'s shaft\n";
+ }
+ bprint (targ.netname);
+ bprint (deathstring);
+ bprint (attacker.netname);
+ bprint (deathstring2);
+ }
+ return;
+ }
+ else
+ {
+ targ.frags = targ.frags - 1;
+ bprint (targ.netname);
+
+ // custom obituary messages
+ if (inflictor.deathtype != "")
+ {
+ bprint (" ");
+ bprint (inflictor.deathtype);
+ bprint ("\n");
+ return;
+ }
+ if (attacker.deathtype != "")
+ {
+ bprint (" ");
+ bprint (attacker.deathtype);
+ bprint ("\n");
+ return;
+ }
+
+ // killed by a monster?
+ // if (attacker.flags & FL_MONSTER)
+ if ((attacker.flags & FL_MONSTER) && (attacker.obit_name == ""))
+ {
+ if (attacker.classname == "monster_army")
+ bprint (" was shot by a Grunt\n");
+ if (attacker.classname == "monster_demon1")
+ bprint (" was eviscerated by a Fiend\n");
+ if (attacker.classname == "monster_dog")
+ bprint (" was mauled by a Rottweiler\n");
+ if (attacker.classname == "monster_dragon")
+ bprint (" was fried by a Dragon\n");
+ if (attacker.classname == "monster_enforcer")
+ bprint (" was blasted by an Enforcer\n");
+ if (attacker.classname == "monster_fish")
+ bprint (" was fed to the Rotfish\n");
+ if (attacker.classname == "monster_hell_knight")
+ bprint (" was slain by a Death Knight\n");
+ if (attacker.classname == "monster_knight")
+ bprint (" was slashed by a Knight\n");
+ if (attacker.classname == "monster_ogre")
+ bprint (" was destroyed by an Ogre\n");
+ if (attacker.classname == "monster_ogre_marksman")
+ // dumptruck_ds
+ bprint (" was felled by a Marksman\n");
+ if (attacker.classname == "monster_oldone")
+ bprint (" became one with Shub-Niggurath\n");
+ if (attacker.classname == "monster_oldone2")
+ // dumptruck_ds
+ bprint (" became one with Shub-Niggurath\n");
+ if (attacker.classname == "monster_boss2")
+ // dumptruck_ds
+ bprint (" was exploded by Chthon\n");
+ if (attacker.classname == "monster_boss")
+ // dumptruck_ds
+ bprint (" was exploded by Chthon\n");
+ if (attacker.classname == "monster_shalrath")
+ bprint (" was exploded by a Vore\n");
+ if (attacker.classname == "monster_shambler")
+ bprint (" was smashed by a Shambler\n");
+ if (attacker.classname == "monster_vomit")
+ bprint (" was vomited on by a Vomitus\n");
+ if (attacker.classname == "monster_wizard")
+ bprint (" was scragged by a Scrag\n");
+ if (attacker.classname == "monster_zombie")
+ bprint (" joins the Zombies\n");
+
+ return;
+ }
+
+ // obits for custom monsters -- progs_dump -- dumptruck_ds
+ if (attacker.obit_name != "")
+ {
+ bprint (" was ");
+ if !(attacker.obit_method)
+ bprint ("killed");
+ else
+ // e.g. ripped apart
+ bprint (attacker.obit_method);
+ bprint (" by ");
+ // a bad monster
+ bprint (attacker.obit_name);
+ bprint ("\n");
+ return;
+ }
+
+ // tricks and traps
+ if (attacker.classname == "explo_box" ||
+ attacker.classname == "play_explosion")
+ {
+ bprint (" blew up\n");
+ return;
+ }
+ if (attacker.classname == "func_laser")
+ {
+ bprint (" discovered that lasers are hot\n");
+ return;
+ }
+ if ((attacker.solid == SOLID_BSP &&
+ attacker != world &&
+ attacker.classname != "togglewall") ||
+ (inflictor.classname == "func_movewall" &&
+ !(inflictor.spawnflags & MOVEWALL_TOUCH)))
+ {
+ bprint (" was squished\n");
+ return;
+ }
+ if (attacker.classname == "trap_shooter" ||
+ attacker.classname == "trap_spikeshooter" ||
+ attacker.classname == "trap_switched_shooter")
+ {
+ // bprint (" was spiked\n");
+ // changed for custom shooters -- dumptruck_ds
+ bprint (" was unlucky\n");
+ return;
+ }
+ if (attacker.classname == "ltrail_start" ||
+ attacker.classname == "ltrail_relay")
+ {
+ bprint (" had an electrifying experience\n");
+ return;
+ }
+ if (attacker.classname == "fireball")
+ {
+ bprint (" ate a lavaball\n");
+ return;
+ }
+ if (attacker.classname == "trigger_changelevel")
+ {
+ bprint (" tried to leave\n");
+ return;
+ }
+
+ // in-liquid deaths
+ if (targ.deathtype == "drowning")
+ {
+ if (random() < 0.5)
+ bprint (" sleeps with the fishes\n");
+ else
+ bprint (" sucks it down\n");
+ return;
+ }
+ if (targ.deathtype == "slime")
+ {
+ if (random() < 0.5)
+ bprint (" gulped a load of slime\n");
+ else
+ bprint (" can't exist on slime alone\n");
+ return;
+ }
+ if (targ.deathtype == "lava")
+ {
+ if (targ.health < -15)
+ {
+ bprint (" burst into flames\n");
+ return;
+ }
+ if (random() < 0.5)
+ bprint (" turned into hot slag\n");
+ else
+ bprint (" visits the Volcano God\n");
+ return;
+ }
+
+ // fell to their death?
+ if (targ.deathtype == "falling")
+ {
+ bprint (" fell to his death\n");
+ return;
+ }
+
+ // hell if I know; he's just dead!!!
+ bprint (" died\n");
+ }
+};

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
new file mode 100644
index 0000000..6536f6a
--- /dev/null
+++ b/qc/client/playerspawn.qc
@@ -0,0 +1,345 @@
+//==============================================================================
+// client/playerspawn.qc -- PLAYER GAME EDGE FUNCTIONS
+//==============================================================================
+
+// globals
+float modelindex_eyes, modelindex_player;
+
+// prototypes
+void() set_suicide_frame;
+void() DecodeLevelParms;
+void() PlayerDie;
+// 1998-09-16 Sliding/not-jumping on monsters/boxes/players fix by Maddes/Kryten
+void() monster_touch;
+
+//----------------------------------------------------------------------
+// respawn -- called by ClientKill and DeadThink
+//----------------------------------------------------------------------
+void() respawn =
+{
+ if (coop)
+ {
+ // make a copy of the dead body for appearances sake
+ CopyToBodyQue (self);
+ // get the spawn parms as they were at level start
+ setspawnparms (self);
+ // respawn
+ PutClientInServer ();
+ }
+ else if (deathmatch)
+ {
+ // make a copy of the dead body for appearances sake
+ CopyToBodyQue (self);
+ // set default spawn parms
+ SetNewParms ();
+ // respawn
+ PutClientInServer ();
+ }
+ else
+ { // restart the entire server
+ localcmd ("restart\n");
+ }
+};
+
+//----------------------------------------------------------------------
+// ClientKill -- Player entered the suicide command
+//----------------------------------------------------------------------
+void() ClientKill =
+{
+ // 1998-07-27 Suicide during intermission fix by Zhenga start
+ // not allowed during intermission
+ if ((intermission_running) && ((coop) || (deathmatch)))
+ return;
+ // 1998-07-27 Suicide during intermission fix by Zhenga end
+ bprint (self.netname);
+ bprint (" suicides\n");
+ set_suicide_frame ();
+ self.modelindex = modelindex_player;
+ // extra penalty
+ self.frags = self.frags - 2;
+ respawn ();
+};
+
+//----------------------------------------------------------------------
+float(vector v) CheckSpawnPoint =
+{
+ return FALSE;
+};
+
+//----------------------------------------------------------------------
+// SelectSpawnPoint -- Returns the entity to spawn at
+//----------------------------------------------------------------------
+entity() SelectSpawnPoint =
+{
+ local entity spot, thing;
+ local float pcount;
+
+ // testinfo_player_start is only found in regioned levels
+ spot = find (world, classname, "testplayerstart");
+ if (spot)
+ return spot;
+
+ // choose a info_player_deathmatch point
+ if (coop)
+ {
+ lastspawn = find (lastspawn, classname, "info_player_coop");
+ if (lastspawn == world)
+ lastspawn = find (lastspawn, classname,
+ "info_player_start");
+ if (lastspawn != world)
+ return lastspawn;
+ }
+ else if (deathmatch)
+ {
+ spot = lastspawn;
+ // TODO CEV this loops infinitely if no info_player_deathmatch
+ while (1)
+ {
+ spot = find (spot, classname, "info_player_deathmatch");
+ if (spot != world)
+ {
+ if (spot == lastspawn)
+ return lastspawn;
+ pcount = 0;
+ thing = findradius (spot.origin, 32);
+ while (thing)
+ {
+ if (thing.classname == "player")
+ pcount = pcount + 1;
+ thing = thing.chain;
+ }
+ if (pcount == 0)
+ {
+ lastspawn = spot;
+ return spot;
+ }
+ }
+ }
+ }
+
+ if (serverflags)
+ {
+ // return with a rune to start
+ spot = find (world, classname, "info_player_start2");
+ if (spot)
+ return spot;
+ }
+
+ spot = find (world, classname, "info_player_start");
+ if (!spot)
+ error ("PutClientInServer: no info_player_start on level");
+
+ return spot;
+};
+
+//----------------------------------------------------------------------
+// SendPlayer -- transmit player updates from server to client -- CEV
+//----------------------------------------------------------------------
+float(entity to, float fl) SendPlayer =
+{
+ WriteByte (MSG_ENTITY, CT_PLAYER);
+ WriteByte (MSG_ENTITY, self.frame);
+ WriteCoord (MSG_ENTITY, self.origin_x);
+ WriteCoord (MSG_ENTITY, self.origin_y);
+ WriteCoord (MSG_ENTITY, self.origin_z);
+ WriteShort (MSG_ENTITY, self.angles_x * 32767 / 360);
+ WriteShort (MSG_ENTITY, self.angles_y * 32767 / 360);
+ WriteShort (MSG_ENTITY, self.angles_z * 32767 / 360);
+ WriteShort (MSG_ENTITY, self.velocity_x);
+ WriteShort (MSG_ENTITY, self.velocity_y);
+ WriteShort (MSG_ENTITY, self.velocity_z);
+ WriteFloat (MSG_ENTITY, self.flags);
+ WriteFloat (MSG_ENTITY, self.pmove_flags);
+ WriteFloat (MSG_ENTITY, self.doublejump_timer);
+ WriteFloat (MSG_ENTITY, self.groundboost_timer);
+ return TRUE;
+};
+
+//----------------------------------------------------------------------
+// PutClientInServer -- called each time a player is spawned
+//----------------------------------------------------------------------
+void() PutClientInServer =
+{
+ local entity spot;
+
+ spot = SelectSpawnPoint ();
+
+ self.classname = "player";
+ self.classtype = CT_PLAYER;
+ self.health = 100;
+ self.takedamage = DAMAGE_AIM;
+ self.solid = SOLID_SLIDEBOX;
+ // self.solid = SOLID_BBOX;
+ self.movetype = MOVETYPE_WALK;
+ self.show_hostile = 0;
+ self.max_health = 100;
+ self.flags = FL_CLIENT;
+ self.air_finished = time + 12;
+ // initial water damage
+ self.dmg = 2;
+ self.super_damage_finished = 0;
+ self.radsuit_finished = 0;
+ self.invisible_finished = 0;
+ self.invincible_finished = 0;
+ self.effects = 0;
+ self.invincible_time = 0;
+ self.deathtype = "";
+ self.gravity = 0;
+ self.wantedgravity = 0;
+ // support for item_key_custom -- iw
+ self.customkeys = 0;
+
+ // Setup cutscene stuff. Legacy code from Zerstorer. -- dumptruck_ds
+ self.script_count = 2;
+ self.script_delay = 1;
+ self.script_time = 0;
+
+ DecodeLevelParms ();
+ PlayerSetCurrentAmmo ();
+
+ self.attack_finished = time;
+ self.th_pain = player_pain;
+ self.th_die = PlayerDie;
+ // 1998-09-16 Sliding/not-jumping on monsters/boxes/players fix
+ // by Maddes/Kryten
+ self.touch = monster_touch;
+ self.deadflag = DEAD_NO;
+ // pausetime is set by teleporters to keep the player from moving
+ // for a while
+ self.pausetime = 0;
+
+ // spot = SelectSpawnPoint ();
+
+ self.origin = spot.origin + '0 0 1';
+ self.angles = spot.angles;
+ // turn this way immediately
+ self.fixangle = TRUE;
+
+ // fog control.
+ // Looks if there's any fog values set at the current spawn point.
+ // If not, looks for those in worldspawn instead
+ if (spot.fog_density)
+ fog_save (self, spot.fog_density, spot.fog_color);
+ else if (world.fog_density)
+ fog_save (self, world.fog_density, world.fog_color);
+
+ if (spot.skyfog_density)
+ skyfog_save (self, spot.skyfog_density);
+ else if (world.skyfog_density)
+ skyfog_save (self, world.skyfog_density);
+
+ // decreased on subsequent frames, used to start some fog-related stuff
+ cleanUpClientStuff = 2;
+
+ // oh, this is a hack!
+ setmodel (self, "progs/eyes.mdl");
+ modelindex_eyes = self.modelindex;
+
+ // Drake -- dumptruck_ds
+ setmodel (self, "progs/s_null.spr");
+ // Drake -- dumptruck_ds
+ // setmodel (self, "progs/null_256.spr");
+ mindex_inviso = self.modelindex;
+
+ setmodel (self, "progs/player.mdl");
+ modelindex_player = self.modelindex;
+
+ setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
+
+ self.view_ofs = '0 0 22';
+ // Mod - Xian (May.20.97)
+ // Bug where player would have velocity from their last kill
+ self.velocity = '0 0 0';
+ // 1998-07-21 Player moves after respawn fix by Xian
+
+ // TODO CEV
+ self.SendEntity = SendPlayer;
+ self.SendFlags = 0xffffff;
+
+ player_stand1 ();
+
+ if (deathmatch || coop)
+ {
+ makevectors (self.angles);
+ spawn_tfog (self.origin + v_forward*20);
+ }
+
+ spawn_tdeath (self.origin, self);
+};
+
+//======================================================================
+// Player spawnpoint entities
+//======================================================================
+
+/*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/player.mdl");
+}
+The normal starting point for a level.
+*/
+void() info_player_start =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+};
+
+/*QUAKED info_player_start2 (1 0 0) (-16 -16 -24) (16 16 24) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/player.mdl");
+}
+Only used on start map for the return point from an episode.
+*/
+void() info_player_start2 =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+};
+
+//----------------------------------------------------------------------
+// testplayerstart -- saved out by quaked in region mode
+//----------------------------------------------------------------------
+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");
+}
+potential spawning position for coop games
+*/
+void() info_player_coop =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+};
+
+/*QUAKED info_monster_spawnpoint (1 0 1) (-16 -16 -24) (16 16 24) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/teleport.mdl");
+}
+ spawning position for func_monster_spawner
+*/
+void() info_monster_spawnpoint =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+};

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

+// prototypes / foward declarations
void() item_armor1;
void() item_armor2;
void() item_armorInv;
@@ -12,7 +13,6 @@ void() item_rockets;
void() item_shells;
void() item_spikes;
void() weapon_supernailgun;
-void() info_teleport_destination;

//======================================================================
// Quake 3 armor item support -- CEV
@@ -47,7 +47,7 @@ void() spawnfunc_item_armor_body =

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

//----------------------------------------------------------------------
void() spawnfunc_item_health_mega =
@@ -66,6 +66,8 @@ void() spawnfunc_item_health_small =

//======================================================================
// Quake 3 ammo & weapons -- CEV
+//======================================================================
+
//----------------------------------------------------------------------
void() spawnfunc_ammo_cells =
{
@@ -110,6 +112,8 @@ void() weapon_plasmagun =

//======================================================================
// Quake 3 push target entities -- CEV
+//======================================================================
+
//----------------------------------------------------------------------
void() spawnfunc_target_push =
{
@@ -134,23 +138,10 @@ void() spawnfunc_target_position =

//======================================================================
// Quake 3 Teleporter targets -- CEV
-//----------------------------------------------------------------------
-void() spawnfunc_misc_teleporter_dest =
-{
- self.classname = "info_teleport_destination";
- info_teleport_destination ();
-};
+//======================================================================

-//----------------------------------------------------------------------
-void() spawnfunc_misc_teleporter_destination =
-{
- self.classname = "info_teleport_destination";
- info_teleport_destination ();
-};
+class misc_teleport_dest: info_teleport_destination {};
+class misc_teleporter_dest: info_teleport_destination {};
+class misc_teleporter_destination: info_teleport_destination {};
+class target_teleporter: info_teleport_destination {};

-//----------------------------------------------------------------------
-void() spawnfunc_target_teleporter =
-{
- self.classname = "info_teleport_destination";
- info_teleport_destination ();
-};

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 0a11eb6..d6defb6 100644
--- a/qc/csqc/csqc_defsclient.qc
+++ b/qc/csqc/csqc_defsclient.qc
@@ -60,7 +60,7 @@ vector VEC_HULL2_MIN = '-32 -32 -24';
vector VEC_HULL2_MAX = '32 32 64';

entity viewentity; // camera -- CEV
-vector vieworg; // origin for viewentity -- CEV
+vector view_origin; // origin for viewentity -- CEV
vector view_angles; // +x=DOWN

entity player_local; // handle to the local player entity
@@ -191,8 +191,6 @@ enumflags {
RF_USEAXIS
};

-const float CLASS_PLAYER = 77; // TODO CEV
-
// edict.flags
const float FL_FLY = 1;
const float FL_SWIM = 2;
@@ -267,8 +265,14 @@ const float VF_ANGLES = 15;
const float VF_ANGLES_X = 16;
const float VF_ANGLES_Y = 17;
const float VF_ANGLES_Z = 18;
+const float VF_DRAWWORLD = 19;
const float VF_DRAWENGINESBAR = 20;
const float VF_DRAWCROSSHAIR = 21;
+const float VF_CL_VIEWANGLES = 33;
+const float VF_CL_VIEWANGLES_X = 34;
+const float VF_CL_VIEWANGLES_Y = 35;
+const float VF_CL_VIEWANGLES_Z = 36;
+const float VF_VIEWENTITY = 206;

//----------------------------------------------------------------------
// Supported Extension Constants
@@ -404,4 +408,3 @@ const float K_YBUTTON = 829;
const float K_LTRIGGER = 830;
const float K_RTRIGGER = 831;
const float K_PAUSE = 153;
-

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

Diff qc/csqc/csqc_entrypoints.qc

diff --git a/qc/csqc/csqc_entrypoints.qc b/qc/csqc/csqc_entrypoints.qc
index fcf11bc..cd40038 100644
--- a/qc/csqc/csqc_entrypoints.qc
+++ b/qc/csqc/csqc_entrypoints.qc
@@ -115,7 +115,8 @@ void(float vwidth, float vheight, float notmenu) CSQC_UpdateView =

// TODO CEV
// addentities (MASK_ENGINE|MASK_VIEWMODEL);
- addentities (MASK_NORMAL | MASK_ENGINE | MASK_VIEWMODEL);
+ addentities (MASK_NORMAL | MASK_ENGINE);
+ setproperty (VF_DRAWWORLD, (float)1);
setproperty (VF_MIN, '0 0');
setproperty (VF_SIZE, ssize);

@@ -127,18 +128,26 @@ void(float vwidth, float vheight, float notmenu) CSQC_UpdateView =
if (self.entnum == player_localentnum)
{
// read our smoothed & predicted view origin
- setproperty (VF_ORIGIN, vieworg);
+ setproperty (VF_VIEWENTITY, player_localentnum);
+ setproperty (VF_ORIGIN, view_origin);
setproperty (VF_ANGLES, view_angles);
+ // setproperty (VF_ANGLES, player_local.angles);
+ setproperty (VF_CL_VIEWANGLES, view_angles);
+ // setproperty (VF_CL_VIEWANGLES, player_local.angles);

makevectors (view_angles);
- SetListener (vieworg, v_forward, v_right, v_up);
+ SetListener (view_origin, v_forward, v_right, v_up);

if (intermission)
+ {
// don't draw crosshair in intermission
setproperty (VF_DRAWCROSSHAIR, FALSE);
+ }
else
+ {
// draw view model when not in intermission
CSQC_DrawViewModel (viewentity);
+ }
}
else
{
@@ -222,17 +231,10 @@ void(float isnew) CSQC_Ent_Update =

switch (classtype)
{
- case CLASS_PLAYER:
+ case CT_PLAYER:
PlayerUpdate (isnew);
break;
}
-
- /*
- if (classtype == CLASS_PLAYER)
- {
- PlayerUpdate (isnew);
- }
- */
};

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

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

Diff qc/csqc/csqc_player.qc

diff --git a/qc/csqc/csqc_player.qc b/qc/csqc/csqc_player.qc
index ab3a326..f8cb736 100644
--- a/qc/csqc/csqc_player.qc
+++ b/qc/csqc/csqc_player.qc
@@ -102,6 +102,7 @@ void(entity ent, float endframe) PlayerRunMovement =

// add anything that was applied after (for low packet
// rate protocols)
+ // TODO CEV
input_angles = view_angles;
};

@@ -147,21 +148,21 @@ float() PlayerPreDraw =
else if (viewheight > 7)
viewheight = 7;

- vieworg = self.origin;
- vieworg_z += getstatf (STAT_VIEWHEIGHT) + viewheight;
- viewentity.origin = vieworg;
+ view_origin = self.origin;
+ view_origin_z += getstatf (STAT_VIEWHEIGHT) + viewheight;
+ viewentity.origin = view_origin;

// correct the view position to compensate for any errors,
// slowly over time, 0.1 seconds.
if (pmove_errortime - time > 0)
{
dprint ("PlayerPreDraw: pmove error\n");
- vieworg += (pmove_errortime - time) *
+ view_origin += (pmove_errortime - time) *
ERRORTIME * pmove_error;
}

if (player_steptime - time > 0)
- vieworg_z += (player_steptime - time) *
+ view_origin_z += (player_steptime - time) *
STEPTIME * player_step;

if (self.lerptime)
@@ -206,7 +207,7 @@ void() PlayerNew =
//======================================================================
// PlayerUpdate
//
-// called from CSQC_Ent_Update for CLASS_PLAYER entities
+// called from CSQC_Ent_Update for CT_PLAYER entities
//----------------------------------------------------------------------
void(float isnew) PlayerUpdate =
{

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

Diff qc/csqc/csqc_progs.src

diff --git a/qc/csqc/csqc_progs.src b/qc/csqc/csqc_progs.src
index 0df5b11..395faf9 100644
--- a/qc/csqc/csqc_progs.src
+++ b/qc/csqc/csqc_progs.src
@@ -12,13 +12,14 @@
../defs_globalvars.qc // globalvars_t
../defs_entvars.qc // entvars_t
csqc_defsbuiltins.qc // curated builtings list
-csqc_defsclient.qc
-csqc_defs.qc
+csqc_defsclient.qc // from Sock's AD CSQC
+csqc_defs.qc // from Sock's AD CSQC
+../defs_classtype.qc // global class list

//----------------------------------------------------------------------
// movement & client prediction, HUD, entity handling
//----------------------------------------------------------------------
-../pmove.qc // player movement code
+../player/pmove.qc // player movement code
csqc_player.qc // player handling
csqc_hudvanilla.qc // HUD
csqc_entrypoints.qc //

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

Diff qc/cutscene.qc

diff --git a/qc/cutscene.qc b/qc/cutscene.qc
index d113c71..fbecb3b 100644
--- a/qc/cutscene.qc
+++ b/qc/cutscene.qc
@@ -1,940 +1,855 @@
-// Heavily modified for Drake.
+//==============================================================================
+// cutscene.qc -- Heavily modified for Drake -- Drake version -- dumptruck_ds
+//==============================================================================

-// player_run prototype is in proto.qc.
void() DHM_CalcMoveDone;
void() move_camera;
-//- - - - - - - - - - - - - - - - - - -
-// This resets air capacity and drowning damage.
+
+//----------------------------------------------------------------------
+// more_air -- This resets air capacity and drowning damage.
+//----------------------------------------------------------------------
void(entity ent) more_air =
{
-//- - - - - - - - -
- ent.air_finished = time + 12;
- ent.dmg = 2; // initial water damage
+ ent.air_finished = time + 12;
+ // initial water damage
+ ent.dmg = 2;
};

-// ============================================ //
-// | Movie camera trigger - dhm | //
-// ============================================ //
-
+//======================================================================
+// Movie camera trigger - dhm
+//======================================================================

+//----------------------------------------------------------------------
+// spawn_dummy
// 'o' should be other, who in turn is the player who touched camera trigger.
+//----------------------------------------------------------------------
void(entity o) spawn_dummy =
{
-local entity s;
-
- s = spawn ();
-// s.origin = o.origin;
- s.velocity = o.velocity;
- s.angles = o.angles;
- s.health = o.health;
- s.weapon = o.weapon;
- s.classname = "dummy";
- s.movetype = MOVETYPE_NONE;
- s.solid = SOLID_NOT;
- setmodel (s, "progs/player.mdl"); // set temp player model in case camera can see -- dumptruck_ds
- if (s.weapon == IT_AXE)
- {
- s.frame = 0; // standing there with axe -- dumptruck_ds
- }
- else
- s.frame = 12; // standing there with gun -- dumptruck_ds
- s.weaponmodel = o.weaponmodel;
- s.flags = o.flags;
- s.effects = o.effects;
- s.items = o.items;
- s.enemy = o.enemy; // PM: o.enemy changed to camera later.
-
-// Save powerups
-// Pentagram
- if (o.invincible_finished)
- { s.invincible_finished = o.invincible_finished - time;
- if (o.invincible_time)
- s.invincible_time = o.invincible_time - time;
- }
- else
- s.invincible_finished = s.invincible_time = 0;
-// Ring of Shadows
- if (o.invisible_finished)
- { s.invisible_finished = o.invisible_finished - time;
- if (o.invisible_time)
- s.invisible_time = o.invisible_time - time;
- }
- else
- s.invisible_finished = s.invisible_time = 0;
-// Quad Damage
- if (o.super_damage_finished)
- { s.super_damage_finished = o.super_damage_finished - time;
- if (o.super_time)
- s.super_time = o.super_time - time;
- }
- else
- s.super_damage_finished = s.super_time = 0;
-// Biosuit
- if (o.radsuit_finished)
- { s.radsuit_finished = o.radsuit_finished - time;
- if (o.rad_time)
- s.rad_time = o.rad_time - time;
- }
- else
- s.radsuit_finished = s.rad_time = 0;
-// // Empathy Shields
-// if (o.thorns_finished)
-// { s.thorns_finished = o.thorns_finished - time;
-// if (o.thorns_time)
-// s.thorns_time = o.thorns_time - time;
-// }
-// else
-// s.thorns_finished = s.thorns_time = 0;
-// // Cross of Deflection
-// if (o.cross_finished)
-// { s.cross_finished = o.cross_finished - time;
-// if (o.cross_time)
-// s.cross_time = o.cross_time - time;
-// }
-// else
-// s.cross_finished = s.cross_time = 0;
-// // Dark Angel Wings
-// if (o.wing_finished)
-// { s.wing_finished = o.wing_finished - time;
-// if (o.wing_time)
-// s.wing_time = o.wing_time - time;
-// }
-// else
-// s.wing_finished = s.wing_time = 0;
-// // Amulet of Reflection
-// if (o.mirror_finished)
-// { s.mirror_finished = o.mirror_finished - time;
-// if (o.mirror_time)
-// s.mirror_time = o.mirror_time - time;
-// }
-// else
-// s.mirror_finished = s.mirror_time = 0;
-// // Tome of Power
-// if (o.tome_finished)
-// { s.tome_finished = o.tome_finished - time;
-// if (o.tome_time)
-// s.tome_time = o.tome_time - time;
-// }
-// else
-// s.tome_finished = s.tome_time = 0;
-
-// FIXME: Called during touch func, don't set directly?
- setorigin (s, o.origin);
-
-// PM: Link player to dummy, for now.
- if (o) //.classname == "player")
- if (!o.trigger_field)
- o.trigger_field = s;
+ local entity s;
+
+ s = spawn ();
+ // s.origin = o.origin;
+ s.velocity = o.velocity;
+ s.angles = o.angles;
+ s.health = o.health;
+ s.weapon = o.weapon;
+ s.classname = "dummy";
+ s.movetype = MOVETYPE_NONE;
+ s.solid = SOLID_NOT;
+ // set temp player model in case camera can see -- dumptruck_ds
+ setmodel (s, "progs/player.mdl");
+ if (s.weapon == IT_AXE)
+ {
+ // standing there with axe -- dumptruck_ds
+ s.frame = 0;
+ }
+ else
+ {
+ // standing there with gun -- dumptruck_ds
+ s.frame = 12;
+ }
+ s.weaponmodel = o.weaponmodel;
+ s.flags = o.flags;
+ s.effects = o.effects;
+ s.items = o.items;
+ // PM: o.enemy changed to camera later.
+ s.enemy = o.enemy;
+
+ // Save powerups; first Pentagram
+ if (o.invincible_finished)
+ {
+ s.invincible_finished = o.invincible_finished - time;
+ if (o.invincible_time)
+ s.invincible_time = o.invincible_time - time;
+ }
+ else
+ {
+ s.invincible_finished = s.invincible_time = 0;
+ }
+
+ // Ring of Shadows
+ if (o.invisible_finished)
+ {
+ s.invisible_finished = o.invisible_finished - time;
+ if (o.invisible_time)
+ s.invisible_time = o.invisible_time - time;
+ }
+ else
+ {
+ s.invisible_finished = s.invisible_time = 0;
+ }
+
+ // Quad Damage
+ if (o.super_damage_finished)
+ {
+ s.super_damage_finished = o.super_damage_finished - time;
+ if (o.super_time)
+ s.super_time = o.super_time - time;
+ }
+ else
+ {
+ s.super_damage_finished = s.super_time = 0;
+ }
+
+ // Biosuit
+ if (o.radsuit_finished)
+ {
+ s.radsuit_finished = o.radsuit_finished - time;
+ if (o.rad_time)
+ s.rad_time = o.rad_time - time;
+ }
+ else
+ {
+ s.radsuit_finished = s.rad_time = 0;
+ }
+
+ /*
+ // Empathy Shields
+ if (o.thorns_finished)
+ {
+ s.thorns_finished = o.thorns_finished - time;
+ if (o.thorns_time)
+ s.thorns_time = o.thorns_time - time;
+ }
+ else
+ {
+ s.thorns_finished = s.thorns_time = 0;
+ }
+
+ // Cross of Deflection
+ if (o.cross_finished)
+ {
+ s.cross_finished = o.cross_finished - time;
+ if (o.cross_time)
+ s.cross_time = o.cross_time - time;
+ }
+ else
+ {
+ s.cross_finished = s.cross_time = 0;
+ }
+
+ // Dark Angel Wings
+ if (o.wing_finished)
+ {
+ s.wing_finished = o.wing_finished - time;
+ if (o.wing_time)
+ s.wing_time = o.wing_time - time;
+ }
+ else
+ {
+ s.wing_finished = s.wing_time = 0;
+ }
+
+ // Amulet of Reflection
+ if (o.mirror_finished)
+ {
+ s.mirror_finished = o.mirror_finished - time;
+ if (o.mirror_time)
+ s.mirror_time = o.mirror_time - time;
+ }
+ else
+ {
+ s.mirror_finished = s.mirror_time = 0;
+ }
+
+ // Tome of Power
+ if (o.tome_finished)
+ {
+ s.tome_finished = o.tome_finished - time;
+ if (o.tome_time)
+ s.tome_time = o.tome_time - time;
+ }
+ else
+ {
+ s.tome_finished = s.tome_time = 0;
+ }
+ */
+
+ // FIXME: Called during touch func, don't set directly?
+ setorigin (s, o.origin);
+
+ // PM: Link player to dummy, for now.
+ // if (o.classname == "player")
+ if (o)
+ if (!o.trigger_field)
+ o.trigger_field = s;
};

-// PM: Removed 'name_player'; no longer needed.
+//======================================================================
+// PM: Removed 'name_player'; no longer needed.
+//======================================================================

+//----------------------------------------------------------------------
void() go_back =
{
-local entity t, c, cvars, old;
-local string val;
-
- t = find (world, classname, "dummy");
- if (!t)
- objerror ("couldn't find dummy");
- t.solid = SOLID_NOT; // So player won't bounce back.
- setmodel (t, ""); // remove temp player model upon return -- dumptruck_ds
-
- c = find (world, classname, "camera");
- if (!c)
- objerror ("couldn't find camera");
-
- c.oldorigin = t.origin; // So player won't bounce back to cam.
-
-// FIXME: Check the new vars.
- setorigin (c, t.origin);
- c.velocity = t.velocity;
- c.view_ofs = '0 0 22'; // PM: Morph should take care of itself.
- c.angles_x = t.angles_x;
- c.angles_y = t.angles_y;
- c.angles_z = 0;
- c.health = t.health;
- c.weapon = t.weapon;
- c.weaponframe = 0;
- c.weaponmodel = t.weaponmodel;
- c.flags = t.flags;
- c.effects = t.effects;
- c.items = t.items;
- c.enemy = t.enemy; // PM: Restore client's original enemy.
-
-// Restore powerups
- if (t.invincible_finished)
- { c.invincible_finished = time + t.invincible_finished;
- if (t.invincible_time)
- c.invincible_time = time + t.invincible_time;
- }
- if (t.invisible_finished)
- { c.invisible_finished = time + t.invisible_finished;
- if (t.invisible_time)
- c.invisible_time = time + t.invisible_time;
- }
- if (t.super_damage_finished)
- { c.super_damage_finished = time + t.super_damage_finished;
- if (t.super_time)
- c.super_time = time + t.super_time;
- }
- if (t.radsuit_finished)
- { c.radsuit_finished = time + t.radsuit_finished;
- if (t.rad_time)
- c.rad_time = time + t.rad_time;
- }
- // if (t.thorns_finished)
- // { c.thorns_finished = time + t.thorns_finished;
- // if (t.thorns_time)
- // c.thorns_time = time + t.thorns_time;
- // }
- // if (t.cross_finished)
- // { c.cross_finished = time + t.cross_finished;
- // if (t.cross_time)
- // c.cross_time = time + t.cross_time;
- // }
- // if (t.wing_finished)
- // { c.wing_finished = time + t.wing_finished;
- // if (t.wing_time)
- // c.wing_time = time + t.wing_time;
- // }
- // if (t.mirror_finished)
- // { c.mirror_finished = time + t.mirror_finished;
- // if (t.mirror_time)
- // c.mirror_time = time + t.mirror_time;
- // }
- // if (t.tome_finished)
- // { c.tome_finished = time + t.tome_finished;
- // if (t.tome_time)
- // c.tome_time = time + t.tome_time;
- // }
-
- c.fixangle = 1; // turn this way immediately
- c.takedamage = DAMAGE_AIM;
- c.solid = SOLID_SLIDEBOX;
- c.movetype = MOVETYPE_WALK;
- c.nextthink = time;
- c.think = player_run; // PM: Reset player anim frames.
- more_air (c); // No gasping from you!
-
- // c.xfl = c.xfl | XFL_ITEMS; // Restore pickup again. Drake -- dumptruck_ds
-
-// Yes, you CAN change the classname here since the 'find' command already
-// found the camera. It is best to change the classname back to player now.
- c.classname = "player";
- cutscene = 0; // Cutscene OFF
- stuffcmd (c, "-forward\n");
- stuffcmd (c, "-strafe\n");
-
-// Look for any CVARSET entities to restore old cvars that
-// were changed for the cut-scene
- if (c.ideal_yaw == -1)
- {
- cvars = find(world, classname, "cvar_done");
- while (cvars) // != world)
- {
- if (!cvars.message)
- cvars.message = cvars.model;
- cvar_set (cvars.netname, cvars.script);
- old = cvars;
- cvars = find (cvars, classname, "cvar_done");
- remove (old);
- }
- c.ideal_yaw = 0;
- }
-
- val = ftos (c.cnt);
- cvar_set ("viewsize", val); //restore old viewsize
-// stuffcmd (c, "sizedown\nsizeup\n"); //hack-fix for GLquake
-
- t.nextthink = time + 0.1;
- t.think = SUB_Remove;
- remove (self);
+ local entity t, c, cvars, old;
+ local string val;
+
+ t = find (world, classname, "dummy");
+ if (!t)
+ objerror ("couldn't find dummy");
+ // So player won't bounce back.
+ t.solid = SOLID_NOT;
+ // remove temp player model upon return -- dumptruck_ds
+ setmodel (t, "");
+
+ c = find (world, classname, "camera");
+ if (!c)
+ objerror ("couldn't find camera");
+
+ // So player won't bounce back to cam.
+ c.oldorigin = t.origin;
+
+ // FIXME: Check the new vars.
+ setorigin (c, t.origin);
+ c.velocity = t.velocity;
+ // PM: Morph should take care of itself.
+ c.view_ofs = '0 0 22';
+ c.angles_x = t.angles_x;
+ c.angles_y = t.angles_y;
+ c.angles_z = 0;
+ c.health = t.health;
+ c.weapon = t.weapon;
+ c.weaponframe = 0;
+ c.weaponmodel = t.weaponmodel;
+ c.flags = t.flags;
+ c.effects = t.effects;
+ c.items = t.items;
+ // PM: Restore client's original enemy.
+ c.enemy = t.enemy;
+
+ // Restore powerups
+ if (t.invincible_finished)
+ {
+ c.invincible_finished = time + t.invincible_finished;
+ if (t.invincible_time)
+ c.invincible_time = time + t.invincible_time;
+ }
+
+ if (t.invisible_finished)
+ {
+ c.invisible_finished = time + t.invisible_finished;
+ if (t.invisible_time)
+ c.invisible_time = time + t.invisible_time;
+ }
+
+ if (t.super_damage_finished)
+ {
+ c.super_damage_finished = time + t.super_damage_finished;
+ if (t.super_time)
+ c.super_time = time + t.super_time;
+ }
+
+ if (t.radsuit_finished)
+ {
+ c.radsuit_finished = time + t.radsuit_finished;
+ if (t.rad_time)
+ c.rad_time = time + t.rad_time;
+ }
+
+ /*
+ if (t.thorns_finished)
+ {
+ c.thorns_finished = time + t.thorns_finished;
+ if (t.thorns_time)
+ c.thorns_time = time + t.thorns_time;
+ }
+
+ if (t.cross_finished)
+ {
+ c.cross_finished = time + t.cross_finished;
+ if (t.cross_time)
+ c.cross_time = time + t.cross_time;
+ }
+
+ if (t.wing_finished)
+ {
+ c.wing_finished = time + t.wing_finished;
+ if (t.wing_time)
+ c.wing_time = time + t.wing_time;
+ }
+
+ if (t.mirror_finished)
+ {
+ c.mirror_finished = time + t.mirror_finished;
+ if (t.mirror_time)
+ c.mirror_time = time + t.mirror_time;
+ }
+
+ if (t.tome_finished)
+ {
+ c.tome_finished = time + t.tome_finished;
+ if (t.tome_time)
+ c.tome_time = time + t.tome_time;
+ }
+ */
+
+ // turn this way immediately
+ c.fixangle = 1;
+ c.takedamage = DAMAGE_AIM;
+ c.solid = SOLID_SLIDEBOX;
+ c.movetype = MOVETYPE_WALK;
+ c.nextthink = time;
+ // PM: Reset player anim frames.
+ c.think = player_run;
+ // No gasping from you!
+ more_air (c);
+
+ // Restore pickup again. Drake -- dumptruck_ds
+ // c.xfl = c.xfl | XFL_ITEMS;
+
+ // Yes, you CAN change the classname here since the 'find' command
+ // already found the camera. It is best to change the classname back
+ // to player now.
+ c.classname = "player";
+ // Cutscene OFF
+ cutscene = 0;
+ stuffcmd (c, "-forward\n");
+ stuffcmd (c, "-strafe\n");
+
+ // Look for any CVARSET entities to restore old cvars that
+ // were changed for the cut-scene
+ if (c.ideal_yaw == -1)
+ {
+ cvars = find(world, classname, "cvar_done");
+ while (cvars) // != world)
+ {
+ if (!cvars.message)
+ cvars.message = cvars.model;
+ cvar_set (cvars.netname, cvars.script);
+ old = cvars;
+ cvars = find (cvars, classname, "cvar_done");
+ remove (old);
+ }
+ c.ideal_yaw = 0;
+ }
+
+ val = ftos (c.cnt);
+ // restore old viewsize
+ cvar_set ("viewsize", val);
+ // hack-fix for GLquake
+ // stuffcmd (c, "sizedown\nsizeup\n");
+
+ t.nextthink = time + 0.1;
+ t.think = SUB_Remove;
+ remove (self);
};

-//===============
+//----------------------------------------------------------------------
// This routine short-circuits player turning and movement while in camera
// mode. self.oldorigin is used as self.angles, and self.mangle is used as
// self.velocity. This allows me to compute these figures in code, and
// overwrite what the game thinks they should be. Called from 'client.qc'.
-//===============
+//----------------------------------------------------------------------
void() look_ahead =
{
-// PM: Vision style cam sets angles to mangle and velocity to zeroes.
-// The camera in vision mode cutscenes cannot move.
-// if (vision)
-// {
-// self.angles = self.enemy.mangle;
-// self.fixangle = 1;
-// // self.nextthink removed since it's done in PlayerPreThink.
-// return;
-// }
-
-// PM: Using Zerstorer style cutscene code...
- self.angles = self.oldorigin;
- self.velocity = self.mangle;
- self.fixangle = 1;
- cvar_set ("viewsize", "120"); //keep screen maximized
-
- if (self.delay == 0)
- {
- local vector looky;
-
- looky_x = self.movedir_x - self.origin_x;
- looky_y = self.movedir_y - self.origin_y;
- looky_z = self.origin_z - self.movedir_z;
- self.oldorigin = vectoangles (looky);
- }
+ // PM: Vision style cam sets angles to mangle and velocity to zeroes.
+ // The camera in vision mode cutscenes cannot move.
+ /*
+ if (vision)
+ {
+ self.angles = self.enemy.mangle;
+ self.fixangle = 1;
+ self.nextthink removed since it's done in PlayerPreThink.
+ return;
+ }
+ */
+
+ // PM: Using Zerstorer style cutscene code...
+ self.angles = self.oldorigin;
+ self.velocity = self.mangle;
+ self.fixangle = 1;
+ // keep screen maximized
+ cvar_set ("viewsize", "120");
+
+ if (self.delay == 0)
+ {
+ local vector looky;
+
+ looky_x = self.movedir_x - self.origin_x;
+ looky_y = self.movedir_y - self.origin_y;
+ looky_z = self.origin_z - self.movedir_z;
+ self.oldorigin = vectoangles (looky);
+ }
};

-// This is a modified SUB_CalcMove routine.
+//----------------------------------------------------------------------
+// DHM_CalcMove -- This is a modified SUB_CalcMove routine.
+//----------------------------------------------------------------------
void(vector tdest, float tspeed, entity cam) DHM_CalcMove =
{
-local vector vdestdelta;
-local float len, traveltime;
+ local vector vdestdelta;
+ local float len, traveltime;

- self.finaldest = tdest;
- self.think = DHM_CalcMoveDone;
+ self.finaldest = tdest;
+ self.think = DHM_CalcMoveDone;

- if (tdest == cam.origin)
- {
- cam.velocity = cam.mangle = '0 0 0';
- self.nextthink = time + 0.01;
- return;
- }
+ if (tdest == cam.origin)
+ {
+ cam.velocity = cam.mangle = '0 0 0';
+ self.nextthink = time + 0.01;
+ return;
+ }

-// set destdelta to the vector needed to move
- vdestdelta = tdest - cam.origin;
+ // set destdelta to the vector needed to move
+ vdestdelta = tdest - cam.origin;

-// calculate length of vector
- len = vlen (vdestdelta);
+ // calculate length of vector
+ len = vlen (vdestdelta);

-// divide by speed to get time to reach dest
- traveltime = len / tspeed;
+ // divide by speed to get time to reach dest
+ traveltime = len / tspeed;

- if (traveltime < 0.1)
- {
- cam.velocity = cam.mangle = '0 0 0';
- self.nextthink = time + 0.01;
- return;
- }
+ if (traveltime < 0.1)
+ {
+ cam.velocity = cam.mangle = '0 0 0';
+ self.nextthink = time + 0.01;
+ return;
+ }

-// set nextthink to trigger a think when dest is reached
- self.nextthink = time + traveltime;
+ // set nextthink to trigger a think when dest is reached
+ self.nextthink = time + traveltime;

-// scale the destdelta vector by the time spent traveling to get velocity
- cam.velocity = cam.mangle = vdestdelta * (1/traveltime);
+ // scale the destdelta vector by the time spent traveling to get vel
+ cam.velocity = cam.mangle = vdestdelta * (1 / traveltime);
};

-//- - - - - - - - -
-// Zerstorer-only cutscene code.
+//----------------------------------------------------------------------
+// wait_camera -- Zerstorer-only cutscene code.
+//----------------------------------------------------------------------
void() wait_camera =
{
- if (!self.wait)
- {move_camera (); return;}
-
- self.nextthink = time + self.wait;
- self.think = move_camera;
+ if (!self.wait)
+ {
+ move_camera ();
+ return;
+ }
+
+ self.nextthink = time + self.wait;
+ self.think = move_camera;
};

-//============
-// After moving, set origin to exact final destination
-//============
+//----------------------------------------------------------------------
+// DHM_CalcMoveDone -- After moving, set origin to exact final destination
+//----------------------------------------------------------------------
void() DHM_CalcMoveDone =
{
- if (!cutscene) // Old check: if (self.enemy.classname != "camera")
- {remove (self); return;}
-
- setorigin(self.enemy, self.finaldest);
- self.enemy.velocity = self.enemy.mangle = '0 0 0';
-
- if (self.cnt == -1)
- {remove (self); return;}
-
- self.nextthink = time + 0.01;
- self.think = wait_camera;
+ // Old check: if (self.enemy.classname != "camera")
+ if (!cutscene)
+ {
+ remove (self);
+ return;
+ }
+
+ setorigin (self.enemy, self.finaldest);
+ self.enemy.velocity = self.enemy.mangle = '0 0 0';
+
+ if (self.cnt == -1)
+ {
+ remove (self);
+ return;
+ }
+
+ self.nextthink = time + 0.01;
+ self.think = wait_camera;
};

+//----------------------------------------------------------------------
void() move_camera =
{
-local entity cpt, fpt;
-local vector looky;
-
- if (!cutscene) // Old check: if (self.enemy.classname != "camera")
- {remove (self); return;}
-
- cpt = find (world, targetname, self.target);
- if (!cpt.target) //if this is the end of the line, stop camera
- {
- self.think = SUB_Null;
- self.enemy.velocity = '0 0 0';
- self.enemy.mangle = '0 0 0'; //mangle == velocity in cut-scene
- DHM_CalcMoveDone();
- self.cnt = -1; // remove control entity in DHM_CalcMoveDone
- //return;
- }
- if (cpt.focal_point != __NULL__ && cpt.focal_point != "")
- {
- // is there a new focal point?
- fpt = find (world, targetname, cpt.focal_point);
- if (!fpt)
- objerror("Couldn't find new focal point!");
-
- self.enemy.movedir = fpt.origin;
- looky_x = self.enemy.movedir_x - self.enemy.origin_x;
- looky_y = self.enemy.movedir_y - self.enemy.origin_y;
- looky_z = self.enemy.origin_z - self.enemy.movedir_z;
- self.enemy.oldorigin = vectoangles (looky);
- self.enemy.angles = self.enemy.oldorigin; //oldorigin == angles in CS
- }
-// Check for auto-focus or still camera angle
- if (cpt.delay)
- self.enemy.delay = cpt.delay;
- else
- self.enemy.delay = 0;
-
- self.target = cpt.target;
- self.wait = cpt.wait;
- if(cpt.speed)
- self.speed = cpt.speed;
- DHM_CalcMove (cpt.origin, self.speed, self.enemy);
+ local entity cpt, fpt;
+ local vector looky;
+
+ // Old check: if (self.enemy.classname != "camera")
+ if (!cutscene)
+ {
+ remove (self);
+ return;
+ }
+
+ // if this is the end of the line, stop camera
+ cpt = find (world, targetname, self.target);
+ if (!cpt.target)
+ {
+ self.think = SUB_Null;
+ self.enemy.velocity = '0 0 0';
+ // mangle == velocity in cut-scene
+ self.enemy.mangle = '0 0 0';
+ DHM_CalcMoveDone ();
+ // remove control entity in DHM_CalcMoveDone
+ self.cnt = -1;
+ // return;
+ }
+ if (cpt.focal_point != __NULL__ && cpt.focal_point != "")
+ {
+ // is there a new focal point?
+ fpt = find (world, targetname, cpt.focal_point);
+ if (!fpt)
+ objerror ("Couldn't find new focal point!");
+
+ self.enemy.movedir = fpt.origin;
+ looky_x = self.enemy.movedir_x - self.enemy.origin_x;
+ looky_y = self.enemy.movedir_y - self.enemy.origin_y;
+ looky_z = self.enemy.origin_z - self.enemy.movedir_z;
+ self.enemy.oldorigin = vectoangles (looky);
+ // oldorigin == angles in CS
+ self.enemy.angles = self.enemy.oldorigin;
+ }
+
+ // Check for auto-focus or still camera angle
+ if (cpt.delay)
+ self.enemy.delay = cpt.delay;
+ else
+ self.enemy.delay = 0;
+
+ self.target = cpt.target;
+ self.wait = cpt.wait;
+ if (cpt.speed)
+ self.speed = cpt.speed;
+ DHM_CalcMove (cpt.origin, self.speed, self.enemy);
};
-//- - - - - - - - -

+//----------------------------------------------------------------------
void() go_camera =
{
-local vector looky;
-
- cutscene = 1; // Cutscene ON.
-
-// Don't let player-turned-camera pick up items.
- // self.xfl = self.xfl - (self.xfl & XFL_ITEMS);
-
-// Change the player into a camera
-// PM: Ok, you win! Too much stuff checks for 'player', so use 'camera'
-// to be safe. Just make sure alignment stuff doesn't break, namely
-// friendly monsters getting mad at a player when they shouldn't.
- self.classname = "camera";
- self.velocity = '0 0 0';
- self.view_ofs = '0 0 0';
- // PM: Change the modelindex to a non-zero number that points to an
- // invisible model so that the camera entity is invisible if seen
- // because of reflective textures or builtin chasecam (chase_active 1).
- // Requires my custom invisible model (which is a sprite).
- self.modelindex = mindex_inviso;
- // Turn off glowing effects.
- self.effects = 0;
- self.items = 0;
- self.weaponmodel = ""; // Remove weapon from the screen.
-//- - - - - - - - - - - - - - - - - - -
-// if (vision)
-// {
-// self.angles = self.enemy.mangle;
-// self.fixangle = 1;
-// self.movetype = MOVETYPE_NONE;
-// self.takedamage = DAMAGE_NO;
-// self.solid = SOLID_NOT;
-// self.weaponmodel= "";
-
- // Removed thinking since it's done by PlayerPreThink->Cutscene_Think.
-// }
-//- - - - - - - - - - - - - - - - - - -
-// else // Default to Zerstorer style cutscene.
- {
- looky_x = self.movedir_x - self.enemy.origin_x;
- looky_y = self.movedir_y - self.enemy.origin_y;
- looky_z = self.enemy.origin_z - self.movedir_z;
- self.oldorigin = vectoangles (looky);
- self.angles = self.oldorigin; //oldorigin == angles in CS
-
- // Check if camera is auto-focus or not
- if (self.enemy.delay)
- self.delay = self.enemy.delay;
- else
- self.delay = 0;
-
- self.velocity = self.mangle = '0 0 0';
-
- self.dmg = 0; // PM: Do we need this?
- self.fixangle = 1; // turn this way immediately
- self.movetype = MOVETYPE_NOCLIP;
- self.takedamage = DAMAGE_NO;
- // PM: Solid cannot be 0 or else camera can't trigger stuff by touch.
-
- // Spawn a control function to handle moving the camera
- if (self.enemy.target != __NULL__ && self.enemy.target != "")
- {
- local entity control;
-
- control = spawn();
- control.classname = "camcontrol";
- control.enemy = self;
- control.target = self.enemy.target;
- control.speed = self.enemy.speed;
- control.nextthink = time + self.enemy.wait + 0.05;
- control.think = move_camera;
- }
- }
-
-// Setting script_count to 0 is what triggers the script to play,
-// It will then play the script number.
- if (!self.script)
- dprint ("trigger_camera needs a script number!");
- self.script_count = 0;
-
- self.cnt = cvar("viewsize");
- cvar_set ("viewsize", "120"); //Full screen
- // PM: Vision sets 'v_idlescale' for swaying screen. Not in Drake!
- stuffcmd (self, "sizedown\nsizeup\n"); //hack-fix for GLquake
- stuffcmd (self, "+strafe\n");
-
- setorigin (self, self.enemy.origin);
-
-//- - - - - - - - -
-// PM: Space invasion prevention.
-// Make the dummy solid to prevent monsters or other junk from occupying
-// the space where the player stood before the cutscene started.
-// After all, the player will be placed back when the cutscene ends,
-// and we don't want him stuck inside a monster or something.
-//
-// We need to wait until after the player becomes the camera, before we can
-// make the dummy solid. If we make the dummy solid as it spawned, the
-// player could get stuck inside the dummy (instead of moving) between
-// trigger activation and transformation to camera.
-//
-// In Vision code, player becomes camera a frame or so after trigger
-// activation. In Zer code, player becomes camera at the same time
-// the trigger activates.
-//
-// Note: If you still have trouble getting a Vision cutscene to work in a
-// certain level, move the following code to the top of 'look_ahead'.
-// Doing so would be less than ideal since the check would get called every
-// frame during the cutscene, instead of just once here.
-// The only level that still has problems with dummy made solid now
-// is 'vision.bsp', which has its own pak. Tronyn's maps, the levels
-// that really matter, have no problems.
-//- - - - - - - - -
-// 'self' is the player-turned-camera entity.
- // '!self.trigger_field' is the world, and its classname is worldspawn.
- if (self.trigger_field.classname == "dummy")
- {
- self.trigger_field.solid = SOLID_BBOX;
- setsize (self.trigger_field, self.mins, self.maxs);
-
- self.trigger_field = world; // Unlink now that it's done.
- }
-//- - - - - - - - -
-};
-
-// PM: Called from either touch or use.
-void(entity who) camera_activate =
-{
-// only activate for player, 1st time touched
- if (who.health <= 0)
- return;
- if (who.deadflag) // In case of Alien Quake facehugger kill.
- return;
- if (who.classname != "player")
- return;
-
-// You can't touch/use this again.
- self.touch = self.use = SUB_Null;
-
-// If player is on ground, take him off ground so no one gets confused
- who.flags = who.flags - (who.flags & FL_ONGROUND);
-
-// put a dummy where the player was
- spawn_dummy (who);
-
-// find camera
- local entity t;
-
- t = find (world, targetname, self.target);
-// if (vision)
-// {
-// if (!t)
-// objerror ("couldn't find target");
-// }
-// else
- {
- local entity fpt;
-
- while ((t != world) && (t.classname != "info_movie_camera"))
- t = find (t, targetname, self.target);
- if (!t)
- objerror ("couldn't find target");
-
- // find focal point
- fpt = find (world, targetname, self.focal_point);
- if (!fpt)
- objerror ("You must have a focal point!\n");
- else
- who.movedir = fpt.origin; //movedir used to calc focal dir
- }
-
-// Go to the camera - not in this function, because touch functions are
-// called while looping through c code, and you don't want to move the
-// player, or something like that?
- who.enemy = t; //save camera position, etc.
- who.script = self.script; //save script number
- who.script_delay = self.script_delay; //save delay for page 1
-
-// if (vision)
-// { // PM: Don't try instant start because that breaks soeexit.bsp.
-// who.nextthink = time + 0.05;
-// who.think = go_camera;
-// }
-// else
- SUB_Think (who, go_camera);
-
- activator = self;
- SUB_UseTargets ();
-
-//Remove the trigger_camera from level
- self.nextthink = time + 0.1;
- self.think = SUB_Remove;
-};
-
-void() camera_touch =
-{
- if (self.targetname != __NULL__ && self.targetname != "")
- if (self.nextthink < time)
- return;
- if (self.cnt == -1)
- return;
- camera_activate (other);
+ local vector looky;
+
+ // Cutscene ON.
+ cutscene = 1;
+
+ // Don't let player-turned-camera pick up items.
+ // self.xfl = self.xfl - (self.xfl & XFL_ITEMS);
+
+ // Change the player into a camera
+ // PM: Ok, you win! Too much stuff checks for 'player', so use
+ // 'camera' to be safe. Just make sure alignment stuff doesn't
+ // break, namely friendly monsters getting mad at a player when
+ // they shouldn't.
+ self.classname = "camera";
+ self.velocity = '0 0 0';
+ self.view_ofs = '0 0 0';
+ // PM: Change the modelindex to a non-zero number that points to an
+ // invisible model so that the camera entity is invisible if seen
+ // because of reflective textures or builtin chasecam (chase_active 1).
+ // Requires my custom invisible model (which is a sprite).
+ self.modelindex = mindex_inviso;
+ // Turn off glowing effects.
+ self.effects = 0;
+ self.items = 0;
+ // Remove weapon from the screen.
+ self.weaponmodel = "";
+
+ /*
+ if (vision)
+ {
+ self.angles = self.enemy.mangle;
+ self.fixangle = 1;
+ self.movetype = MOVETYPE_NONE;
+ self.takedamage = DAMAGE_NO;
+ self.solid = SOLID_NOT;
+ self.weaponmodel = "";
+
+ Removed thinking since it's done by
+ PlayerPreThink->Cutscene_Think.
+ }
+ else
+ {
+ */
+ // Default to Zerstorer style cutscene.
+ looky_x = self.movedir_x - self.enemy.origin_x;
+ looky_y = self.movedir_y - self.enemy.origin_y;
+ looky_z = self.enemy.origin_z - self.movedir_z;
+ self.oldorigin = vectoangles (looky);
+ // oldorigin == angles in CS
+ self.angles = self.oldorigin;
+
+ // Check if camera is auto-focus or not
+ if (self.enemy.delay)
+ self.delay = self.enemy.delay;
+ else
+ self.delay = 0;
+
+ self.velocity = self.mangle = '0 0 0';
+
+ // PM: Do we need this?
+ self.dmg = 0;
+ // turn this way immediately
+ self.fixangle = 1;
+ self.movetype = MOVETYPE_NOCLIP;
+ self.takedamage = DAMAGE_NO;
+ // PM: Solid cannot be 0 or else camera can't trigger
+ // stuff by touch.
+
+ // Spawn a control function to handle moving the camera
+ if (self.enemy.target != __NULL__ && self.enemy.target != "")
+ {
+ local entity control;
+
+ control = spawn ();
+ control.classname = "camcontrol";
+ control.enemy = self;
+ control.target = self.enemy.target;
+ control.speed = self.enemy.speed;
+ control.nextthink = time + self.enemy.wait + 0.05;
+ control.think = move_camera;
+ }
+ /*
+ }
+ */
+
+ // Setting script_count to 0 is what triggers the script to play,
+ // It will then play the script number.
+ if (!self.script)
+ dprint ("trigger_camera needs a script number!");
+ self.script_count = 0;
+
+ self.cnt = cvar ("viewsize");
+ // Full screen
+ cvar_set ("viewsize", "120");
+ // PM: Vision sets 'v_idlescale' for swaying screen. Not in Drake!
+ // hack-fix for GLquake
+ stuffcmd (self, "sizedown\nsizeup\n");
+ stuffcmd (self, "+strafe\n");
+
+ setorigin (self, self.enemy.origin);
+
+ // PM: Space invasion prevention.
+ // Make the dummy solid to prevent monsters or other junk from occupying
+ // the space where the player stood before the cutscene started.
+ // After all, the player will be placed back when the cutscene ends,
+ // and we don't want him stuck inside a monster or something.
+ //
+ // We need to wait until after the player becomes the camera, before
+ // we can make the dummy solid. If we make the dummy solid as it
+ // spawned, the player could get stuck inside the dummy (instead of
+ // moving) between trigger activation and transformation to camera.
+ //
+ // In Vision code, player becomes camera a frame or so after trigger
+ // activation. In Zer code, player becomes camera at the same time
+ // the trigger activates.
+ //
+ // Note: If you still have trouble getting a Vision cutscene to work
+ // in a certain level, move the following code to the top of
+ // 'look_ahead'. Doing so would be less than ideal since the check
+ // would get called every frame during the cutscene, instead of just
+ // once here. The only level that still has problems with dummy made
+ // solid now is 'vision.bsp', which has its own pak. Tronyn's maps,
+ // the levels that really matter, have no problems.
+
+ // 'self' is the player-turned-camera entity.
+ // '!self.trigger_field' is the world, and its classname is worldspawn.
+ if (self.trigger_field.classname == "dummy")
+ {
+ self.trigger_field.solid = SOLID_BBOX;
+ setsize (self.trigger_field, self.mins, self.maxs);
+
+ // Unlink now that it's done.
+ self.trigger_field = world;
+ }
};
-void() camera_point_touch = {camera_activate (other);};

-//============
-// --> QUAKED info_movie_camera (.5 .5 .5) (-8 -8 -8) (8 8 32) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-
-// This is the destination marker for a camera. It should have a "targetname"
-// field with the same value as a camera-trigger's "target" field.
-//============
-void() imc_touch =
-{
-local string temps;
-
- if (other.classname != "camera")
- return;
- temps = self.target;
- self.target = self.message;
- SUB_UseTargets();
- self.target = temps;
- if (self.cnt)
- return;
-
- self.think = SUB_Remove;
- self.nextthink = time + 10;
- self.solid = SOLID_NOT;
-};
-
-void() info_movie_camera =
-{
-// this does nothing, just serves as a target spot
-// if (vision)
-// return;
-
-// ...more than a spot in Zer mode.
- //self.use = SUB_Null;
- self.solid = SOLID_TRIGGER;
- setorigin(self, self.origin);
- setsize(self, '-8 -8 -8', '8 8 8');
- self.touch = imc_touch;
-};
-
-void() camera_use =
-{
- local entity pl;
-
- pl = find(world, classname, "player"); // Only one in single-player.
- camera_activate (pl);
-
-// Old code.
-// self.nextthink = time + 100000;
-// force_retouch = 2; // make sure even still objects get hit
-// self.think = SUB_Null;
-};
-
-//- - - - - - - - -
-// Zerstorer-only cutscene code.
+//----------------------------------------------------------------------
+// gocam_use -- Zerstorer-only cutscene code.
+//----------------------------------------------------------------------
void() gocam_use =
{
-local entity control, temp;
-
- control = find(world, classname, "camcontrol");
- if (control == world)
- dprint ("Can't find camcontrol!\n");
-
- temp = self;
- self = control;
- DHM_CalcMoveDone ();
- self = temp;
- self.nextthink = time + 0.1;
- self.think = SUB_Remove;
+ local entity control, temp;
+
+ control = find (world, classname, "camcontrol");
+ if (control == world)
+ dprint ("Can't find camcontrol!\n");
+
+ temp = self;
+ self = control;
+ DHM_CalcMoveDone ();
+ self = temp;
+ self.nextthink = time + 0.1;
+ self.think = SUB_Remove;
};

-void() trigger_gocamera = {self.use = gocam_use;};
-
-/*QUAKED info_focal_point (.5 .5 .5) (-8 -8 -8) (8 8 32) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-This is the point that the camera will face. It should have a "targetname"
-field with the same value as a camera-trigger's "focal_point" field.
-*/
-// PM: This entity is kept only for map compatibility reasons.
-// Otherwise, this entity is redundant. Use 'info_notnull' instead.
-void() info_focal_point = {}; // just holds a spot for the focal point.
-
-void(float pt) trigger_camera_spawn =
+//----------------------------------------------------------------------
+void() trigger_gocamera =
{
-// Update: Don't let dmsp muck up cutscenes and vice versa.
- if (deathmatch || coop)
- {remove (self); return;} // PM: Fix -- abort if removed.
-
- if (pt)
- { // The new way, this is for you Tronyn.
- InitPointTrigger ();
- if (!self.targetname)
- self.touch = camera_point_touch;
- }
- else
- { // The old way...
- InitTrigger ();
- // PM: Must always allow touch because some old maps need it.
- self.touch = camera_touch;
- }
- // find the destination
- if (!self.target)
- objerror ("Camera trigger with no target");
- self.use = camera_use;
+ self.use = gocam_use;
};

-/*QUAKED trigger_camera (.5 .5 .5) ? X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-A player touching this will be transported to the corresponding
-info_movie_camera entity. You must set the "target" field, and put a
-info_movie_camera with a "targetname" field that matches. The "script"
-key gives a starting script number, and the "script_delay" key is the
-amount of time(seconds) to stay on the first script page.
-
-If the trigger_camera has a targetname, it will only enter camera mode
-after it has been fired.
-*/
-void() trigger_camera = {trigger_camera_spawn (FALSE);};
-
-/*QUAKED trigger_camera_point (.5 .5 .5) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-When this is triggered the player will be transported to the corresponding
-info_movie_camera entity. You must set the "target" field, and put a
-info_movie_camera with a "targetname" field that matches. The "script"
-key gives a starting script number, and the "script_delay" key is the
-amount of time(seconds) to stay on the first script page.
-*/
-void() trigger_camera_point = {trigger_camera_spawn (TRUE);};
-
-//----------------------------------
-// Scripting function - dhm
-//----------------------------------
-// The original timing idea for scripts was inspired by Zoid. Study the
+//======================================================================
+// Scripting function - dhm
+//
+// The original timing idea for scripts was inspired by Zoid. Study the
// code for Zoid's CTF, it is an excellent example of good Quake-C coding.
-// Also look at all of Quake Command's stuff. Wedge rules.
-//----------------------------------
+// Also look at all of Quake Command's stuff. Wedge rules.
+//======================================================================
+
+//----------------------------------------------------------------------
// Script_play is called from PlayerPreThink()
// 'self' is the player (camera)
-//----------------------------------
+//----------------------------------------------------------------------
void() Script_play =
{
-local entity scrpt;
-
- scrpt = find (world, script_num, self.script);
- if (!scrpt)
- dprint ("Error: script not found!");
-
- // If script has a target, trigger it once.
-// if (!vision)
- if (scrpt.target != __NULL__ && scrpt.target != "")
- {
- local entity temp;
-
- temp = self;
- self = scrpt;
- SUB_UseTargets ();
- self.target = world.null_string;
- self = temp;
- }
-
- self.script_delay = scrpt.script_delay;
- self.script_time = time + 1;
- self.script_count = self.script_count + 1;
- centerprint (self, scrpt.message);
-
- if (self.script_count == self.script_delay)
- {
- self.script = scrpt.next_script;
- if (self.script != "0")
- self.script_count = 0;
- else
- {
- scrpt.nextthink = time + 3;
- scrpt.classname = "going_back";
- scrpt.think = go_back;
- }
- }
+ local entity scrpt;
+
+ scrpt = find (world, script_num, self.script);
+ if (!scrpt)
+ dprint ("Error: script not found!");
+
+ // If script has a target, trigger it once.
+ // if (!vision)
+ if (scrpt.target != __NULL__ && scrpt.target != "")
+ {
+ local entity temp;
+
+ temp = self;
+ self = scrpt;
+ SUB_UseTargets ();
+ self.target = world.null_string;
+ self = temp;
+ }
+
+ self.script_delay = scrpt.script_delay;
+ self.script_time = time + 1;
+ self.script_count = self.script_count + 1;
+ centerprint (self, scrpt.message);
+
+ if (self.script_count == self.script_delay)
+ {
+ self.script = scrpt.next_script;
+ if (self.script != "0")
+ {
+ self.script_count = 0;
+ }
+ else
+ {
+ scrpt.nextthink = time + 3;
+ scrpt.classname = "going_back";
+ scrpt.think = go_back;
+ }
+ }
};

-
-//- - - - - - - - -
-// PM: Player thinking during a cutscene. Called by 'PlayerPreThink'.
+//----------------------------------------------------------------------
+// PM: Player thinking during a cutscene. Called by 'PlayerPreThink'.
+//----------------------------------------------------------------------
void() Cutscene_Think =
{
- /* --------------------------------------------
- If we are in camera mode, play the script.
- -------------------------------------------- */
- // PM: Allow player to stop cutscene on any map.
- if (self.impulse)
- if (self.script_count != 1000000)
- {
- local entity goback; // PM: dhm's cutscene code.
-
- self.script_count = 1000000;
- // if (world.model == "maps/soeexit.bsp")
- // { // Hack: Jump directly to intermission/credits.
- // NextLevel ();
- // return;
- // }
- // If cut-scene has ended, and user tries to exit, don't
- // spawn a second go_back control entity.
- goback = find(world, classname, "going_back");
- if (!goback)
- {
- sprint(self, "...\n");
- goback = spawn();
- goback.nextthink = time + 1.5;
- goback.think = go_back;
- self.impulse = 0; // PM: New -- just kill cutscene.
- }
- }
-
- if (cutscene) // PM: Vision didn't look_ahead here, but do it
- look_ahead (); // anyway instead of thinking about it.
- if (self.script_count < self.script_delay)
- if (self.script_time < time)
- Script_play ();
+ // If we are in camera mode, play the script.
+ // PM: Allow player to stop cutscene on any map.
+ if (self.impulse)
+ {
+ if (self.script_count != 1000000)
+ {
+ // PM: dhm's cutscene code.
+ local entity goback;
+
+ self.script_count = 1000000;
+
+ /*
+ if (world.model == "maps/soeexit.bsp")
+ {
+ // Hack: Jump directly to intermission/credits.
+ NextLevel ();
+ return;
+ }
+ */
+
+ // If cut-scene has ended, and user tries to exit, don't
+ // spawn a second go_back control entity.
+ goback = find (world, classname, "going_back");
+ if (!goback)
+ {
+ sprint (self, "...\n");
+ goback = spawn ();
+ goback.nextthink = time + 1.5;
+ goback.think = go_back;
+ // PM: New -- just kill cutscene.
+ self.impulse = 0;
+ }
+ }
+ }
+
+ // PM: Vision didn't look_ahead here, but do it
+ if (cutscene)
+ // anyway instead of thinking about it.
+ look_ahead ();
+
+ if (self.script_count < self.script_delay)
+ if (self.script_time < time)
+ Script_play ();
};

+//----------------------------------------------------------------------
void() script_sound_play =
{
- if (self.noise != "")
- sound (other, CHAN_AUTO, self.noise, 1, ATTN_NONE);
- else
- sound (other, CHAN_AUTO, self.noise1, 1, ATTN_NONE);
+ if (self.noise != "")
+ sound (other, CHAN_AUTO, self.noise, 1, ATTN_NONE);
+ else
+ sound (other, CHAN_AUTO, self.noise1, 1, ATTN_NONE);
};
-//- - - - - - - - -
-//============
-// --> QUAKED info_script_sound (.5 .5 .5) (-8 -8 -8) (8 8 32) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY

-// This is the noise player for a script.
+/*QUAKED info_script_sound (.5 .5 .5) (-8 -8 -8) (8 8 32) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY

+This is the noise player for a script.
+*/
void() info_script_sound =
{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
- //play all the sounds available for a normal trigger
- if (self.sounds == 0)
- {
- precache_sound ("misc/null.wav");
- self.noise = "misc/null.wav";
- }
- else if (self.sounds == 1)
- {
- precache_sound ("misc/secret.wav");
- self.noise = "misc/secret.wav";
- }
- else if (self.sounds == 2)
- {
- precache_sound ("misc/talk.wav");
- self.noise = "misc/talk.wav";
- }
- else if (self.sounds == 3)
- {
- precache_sound ("misc/trigger1.wav");
- self.noise = "misc/trigger1.wav";
- }
- else if (self.sounds == 4)
- {
- if (!self.noise1) //dumptruck_ds
- {
- objerror ("no soundfile set in noise1!\n");
- remove(self);
- return;
- }
- else
- precache_sound (self.noise1);
- self.noise = self.noise1;
- }
- self.use = script_sound_play;
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ // play all the sounds available for a normal trigger
+ if (self.sounds == 0)
+ {
+ precache_sound ("misc/null.wav");
+ self.noise = "misc/null.wav";
+ }
+ else if (self.sounds == 1)
+ {
+ precache_sound ("misc/secret.wav");
+ self.noise = "misc/secret.wav";
+ }
+ else if (self.sounds == 2)
+ {
+ precache_sound ("misc/talk.wav");
+ self.noise = "misc/talk.wav";
+ }
+ else if (self.sounds == 3)
+ {
+ precache_sound ("misc/trigger1.wav");
+ self.noise = "misc/trigger1.wav";
+ }
+ else if (self.sounds == 4)
+ {
+ // dumptruck_ds
+ if (!self.noise1)
+ {
+ objerror ("no soundfile set in noise1!\n");
+ remove (self);
+ return;
+ }
+ else
+ {
+ precache_sound (self.noise1);
+ }
+
+ self.noise = self.noise1;
+ }
+ self.use = script_sound_play;
};

-//============
-// --> QUAKED info_script (.5 .5 .5) (-8 -8 -8) (8 8 32)
-// This is the destination marker for a script.
-// It should have a "script_num" field that signifies the script number, and
-// a "next_script" to signal the next script ("0" if this is the last page of
-// the script), a "script_delay" to signify how many seconds to display this
-// page, and of course a "message" field with the text to display.
-//
-// PM: Use 'info_notnull' instead.
-//============
-void() info_script =
-{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
- return;
-};
-
-
-// ------------------------------ //
-// | trigger_cvarset | //
-// ------------------------------ //
-//============
-// --> QUAKED trigger_cvarset (.5 .5 .5) (-8 -8 -8) (8 8 32)
-// You can set any CVAR on the server with this trigger. Put the CVAR name
-// in "netname" and put the value in "message". Useful CVAR's are
-// sv_gravity, sv_friction, fov, and v_idlescale.
-//============
-void() change_cvar =
-{
-local entity check;
+/*QUAKED info_script (.5 .5 .5) (-8 -8 -8) (8 8 32)
+This is the destination marker for a script.
+It should have a "script_num" field that signifies the script number, and
+a "next_script" to signal the next script ("0" if this is the last page of
+the script), a "script_delay" to signify how many seconds to display this
+page, and of course a "message" field with the text to display.

- cvar_set (self.netname, self.message);
- bprint("\n\n\n\n");
-
- self.classname = "cvar_done";
- check = find(world, classname, "player");
- if (!check)
- check = find(world, classname, "camera");
-
- check.ideal_yaw = -1;
-
- self.nextthink = time + 0.02;
- self.think = SUB_UseTargets;
-};
-
-void() cvarset_touch =
-{
- if (self.cnt > time || other.health <= 0 || other.classname != "player")
- return;
-
- change_cvar ();
-};
-
-void() trigger_cvarset =
+PM: Use 'info_notnull' instead.
+*/
+void() info_script =
{
- if (deathmatch || coop)
- remove (self);
-
- InitTrigger ();
- self.use = change_cvar;
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
};

-
-// PM: Removed gravity and earthquake entities.
-
-//===========================/ END OF FILE /===========================//
+//===========================/ END OF FILE /===========================/

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

Diff qc/defs_builtins.qc

diff --git a/qc/defs_builtins.qc b/qc/defs_builtins.qc
index c961148..0546a71 100644
--- a/qc/defs_builtins.qc
+++ b/qc/defs_builtins.qc
@@ -1,6 +1,6 @@
-/*==============================================================================
- BUILTIN FUNCTIONS
-==============================================================================*/
+//==============================================================================
+// BUILTIN FUNCTIONS
+//==============================================================================

void(vector ang) makevectors = #1; // sets v_forward, etc globals
void(entity e, vector o) setorigin = #2;
@@ -76,18 +76,6 @@ void(float to, entity s) WriteEntity = #59;
// otherwise equivalent).
void(float buf, int fl) WriteInt = #0:WriteInt;

-//======================================================================
-// broadcast client message generation
-//======================================================================
-// void(float f) bWriteByte = #59;
-// void(float f) bWriteChar = #60;
-// void(float f) bWriteShort = #61;
-// void(float f) bWriteLong = #62;
-// void(float f) bWriteCoord = #63;
-// void(float f) bWriteAngle = #64;
-// void(string s) bWriteString = #65;
-// void(entity e) bWriteEntity = #66;
-
// Part of DP_QC_SINCOSSQRTPOW Forgive me father, for I have
// trigonometry homework.
// from fteextensions.qc -- CEV
@@ -184,8 +172,8 @@ void(entity e) setspawnparms = #78; // set parm1... to the values at
// Part of DP_QC_TRACEBOX Exactly like traceline, but a box instead
// of a uselessly thin point. Acceptable sizes are limited by bsp format,
// q1bsp has strict acceptable size values.
-// brought in from fteextensions.qc -- CEV
-void(vector start, vector mins, vector maxs, vector end, float nomonsters, entity ent) tracebox = #90;
+void(vector start, vector mins, vector maxs, vector end, float nomonsters,
+ entity ent) tracebox = #90;

// Part of DP_QC_MINMAXBOUND Returns the lowest value of its arguments.
float(float a, float b, ...) min = #94;
@@ -197,6 +185,13 @@ float(float minimum, float val, float maximum) bound = #96;
// Part of DP_QC_SINCOSSQRTPOW
float(float value, float exp) pow = #97;

+// Part of DP_QC_FINDFLOAT
+// Equivelent to the find builtin, but instead of comparing strings contents,
+// this builtin compares the raw values. This builtin requires multiple calls
+// in order to scan all entities - set start to the previous call's return
+// value. world is returned when there are no more entities.
+entity(entity start, .__variant fld, __variant match) findfloat = #98;
+
// for CSQC interaction -- CEV
void(float num, float type, .__variant fld) clientstat = #232;

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
new file mode 100644
index 0000000..53134ac
--- /dev/null
+++ b/qc/defs_classtype.qc
@@ -0,0 +1,141 @@
+//=============================================================================
+// CLASSTYPES
+//=============================================================================
+
+// fields
+.float classtype; // used to identify an entity's type
+
+//----------------------------------------------------------------------
+// global classtype list; shared by client & server
+//----------------------------------------------------------------------
+enum
+{
+ CT_WORLD, // world entity
+
+ // monsters
+ CT_PLAYER, // player (client)
+
+ // items & weapons
+
+ // info
+ CT_INFO_FOCAL_POINT, // cutscenes
+ CT_INFO_MOVIE_CAMERA, // cutscenes
+ CT_INFO_NOTNULL, //
+ CT_INFO_NULL, //
+ CT_INFO_TELEPORT_CHANGEDEST, // teleporters
+ CT_INFO_TELEPORT_DESTINATION, // teleporters
+ CT_INFO_TELEPORT_RANDOM, // teleporters
+
+ // func
+
+ // gibs
+ CT_GIB_HEAD_ARMY, // deadstuff
+ CT_GIB_HEAD_DEMON, //
+ CT_GIB_HEAD_DOG, //
+ CT_GIB_HEAD_ENFORCER, //
+ CT_GIB_HEAD_HELL_KNIGHT, //
+ CT_GIB_HEAD_KNIGHT, //
+ CT_GIB_HEAD_OGRE, //
+ CT_GIB_HEAD_PLAYER, //
+ CT_GIB_HEAD_SHALRATH, //
+ CT_GIB_HEAD_SHAMBLER, //
+ CT_GIB_HEAD_WIZARD, //
+ CT_GIB_MISC_1, //
+ CT_GIB_MISC_2, //
+ CT_GIB_MISC_3, //
+
+ // lights
+ CT_LIGHT, // id1 light
+ CT_LIGHT_CANDLE, // light_candle
+ CT_LIGHT_FLAME_LARGE_YELLOW, // id1
+ CT_LIGHT_FLAME_SMALL_YELLOW, // id1
+ CT_LIGHT_FLUORO, // id1 light_fluoro
+ CT_LIGHT_FLUOROSPARK, // id1 light_fluorospark
+ CT_LIGHT_GLOBE, // id1 light_globe
+ CT_LIGHT_TORCH_SMALL_WALLTORCH, // id1
+
+ // misc
+ CT_MISC_AIR_BUBBLES, // id1 air bubbles
+ CT_MISC_AMBIENT_COMPHUM, // computer hum
+ CT_MISC_AMBIENT_DRIP, // drip sound
+ CT_MISC_AMBIENT_DRONE, // drone sound
+ CT_MISC_AMBIENT_FBUZZ, // fluoro buzz
+ CT_MISC_AMBIENT_GENERAL, // Rubicon Rumble devkit ambient_general
+ CT_MISC_AMBIENT_FIRE, // ambient fire sound
+ CT_MISC_AMBIENT_LBUZZ, // light buzz
+ CT_MISC_AMBIENT_SUCKWIND, // suck wind
+ CT_MISC_AMBIENT_SWAMP1, // swamp 1
+ CT_MISC_AMBIENT_SWAMP2, // swamp 2
+ CT_MISC_AMBIENT_THUNDER, // Zerstorer ambient thunder
+ CT_MISC_AMBIENT_WATER1, // ambient water 1
+ CT_MISC_AMBIENT_WIND2, // ambient wind 2
+ CT_MISC_EXPLOBOX, // id1 misc_explobox
+ CT_MISC_EXPLOBOX2, // id1 misc_explobox2
+ CT_MISC_FIREBALL, // id1 misc_fireball
+ CT_MISC_INFIGHT, // progs_dump 3 misc_infight
+ CT_MISC_MODEL, // misc_model -- Joshua Skelton
+ CT_MISC_NOISEMAKER, // pd3 some kind of testing ent?
+ CT_MISC_PARTICLES, // Rubicon2 misc_splash
+ CT_MISC_PARTICLESPRAY, // custents misc_particlespray
+ CT_MISC_PARTICLE_STREAM, // Zerstorer misc_particle_stream
+ CT_MISC_PLAY_BFIELD, // pd3 play
+ CT_MISC_PLAY_BRLIGHT, // pd3 play
+ CT_MISC_PLAY_DIMLIGHT, // pd3 play
+ CT_MISC_PLAY_EXPLOSION, // pd3 play
+ CT_MISC_PLAY_GIBS, // pd3 play
+ CT_MISC_PLAY_LAVASPLASH, // pd3 play
+ CT_MISC_PLAY_MFLASH, // pd3 play muzzleflash
+ CT_MISC_PLAY_SOUND, // pd3 play_sound
+ CT_MISC_PLAY_SOUND_TRIGGERED, // pd3 play_sound
+ CT_MISC_SPARKS, // misc_sparks
+ CT_MISC_VIEWTHING, // id1?
+ CT_MISC_TELE_FOG, // pd3 play
+ CT_MISC_TELEPORTTRAIN, // id1 teleport train
+
+ // targets
+ CT_TARGET_AUTOSAVE, // target_autosave from copper
+ CT_TARGET_FOGBLEND, // fog
+ CT_TARGET_SETCOUNT, //
+ CT_TARGET_SETSTATE, //
+ CT_TARGET_TEXTSTORY, // progs_dump textstory
+ CT_TARGET_TEXTSTORY_HELPER, // textstory helper subclass
+
+ // triggers
+ CT_TRIGGER_CAMERA, // cutscenes
+ CT_TRIGGER_CAMERA_POINT, // cutscenes
+ CT_TRIGGER_CDTRACK, // progs_dump 3 cd track trigger
+ CT_TRIGGER_CHANGELEVEL, // id1 change level trigger
+ CT_TRIGGER_CHANGEMUSIC, // jleww via changemusic.rar
+ CT_TRIGGER_CHANGETARGET, // change an entity's target field
+ CT_TRIGGER_COUNTER, // id1 trigger_counter
+ CT_TRIGGER_CVARSET, // was in cutscene.qc; from Drake?
+ CT_TRIGGER_EVERYTHING, // progs_dump 3; unknown prior source
+ CT_TRIGGER_FILTER, //
+ CT_TRIGGER_FOG, // fog
+ CT_TRIGGER_FOGBLEND, // fog
+ CT_TRIGGER_HEAL, // custents trigger_heal by TGR
+ CT_TRIGGER_HURT, // Hipnotic trigger_hurt
+ CT_TRIGGER_LADDER, // rubicon2 ladders
+ CT_TRIGGER_LOOK, // trigger_onlookat by NullPointPaladin
+ CT_TRIGGER_MONSTERFACE, // progs_dump 3 monsterface
+ CT_TRIGGER_MONSTERJUMP, // id1 trigger_monsterjump
+ CT_TRIGGER_MULTIPLE, // id1 trigger_multiple
+ CT_TRIGGER_ONCE, // id1 trigger_once
+ CT_TRIGGER_ONLYREGISTERED, // id1 registered content trigger
+ CT_TRIGGER_PUSH, // id1 push/wind brush
+ CT_TRIGGER_PUSH_CUSTOM, // progs_dump push custom
+ CT_TRIGGER_RELAY, // id1 trigger_relay
+ CT_TRIGGER_SECRET, // id1 secret trigger
+ CT_TRIGGER_SETGRAVITY, // Hipnotic gravity trigger
+ CT_TRIGGER_SETSKILL, // id1 setskill trigger
+ CT_TRIGGER_SHAKE, // ground-shake trigger
+ CT_TRIGGER_TAKE_WEAPON, // take_weapon
+ CT_TRIGGER_TELEPORT, // id1 teleporters
+ CT_TRIGGER_TEXTSTORY, // progs_dump textstory
+ CT_TRIGGER_USEKEY, // originally based on Hipnotic code
+ CT_TRIGGER_VOID, // necros' trigger_void, modified
+
+ // temp entities
+ CT_TEMP_BUBBLES, // air bubble
+ CT_TEMP_FOG_CONTROLLER // fog
+};

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

Diff qc/defs_entvars.qc

diff --git a/qc/defs_entvars.qc b/qc/defs_entvars.qc
index 59f5812..8fdc4a8 100644
--- a/qc/defs_entvars.qc
+++ b/qc/defs_entvars.qc
@@ -1,6 +1,6 @@
-/*==============================================================================
- SOURCE FOR ENTVARS_T C STRUCTURE
-==============================================================================*/
+//==============================================================================
+// SOURCE FOR ENTVARS_T C STRUCTURE
+//==============================================================================

//======================================================================
// system fields (*** = do not set in prog code, maintained by C code)
@@ -12,7 +12,7 @@
.float movetype;
.float solid;

-.vector origin; // ***
+.vector origin; // *** only some of the time -- CEV
.vector oldorigin; // ***
.vector velocity;
.vector angles;

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

Diff qc/defs_globalvars.qc

diff --git a/qc/defs_globalvars.qc b/qc/defs_globalvars.qc
index fac70c6..dbfc510 100644
--- a/qc/defs_globalvars.qc
+++ b/qc/defs_globalvars.qc
@@ -1,6 +1,6 @@
-/*==============================================================================
- SOURCE FOR GLOBALVARS_T C STRUCTURE
-==============================================================================*/
+//==============================================================================
+// SOURCE FOR GLOBALVARS_T C STRUCTURE
+//==============================================================================

//======================================================================
// system globals
@@ -31,7 +31,6 @@ float total_monsters;
float found_secrets; // number of secrets found
float killed_monsters; // number of monsters killed

-
// spawnparms are used to encode information about clients across server
// level changes
float parm1, parm2, parm3, parm4, parm5, parm6, parm7, parm8,
@@ -80,7 +79,6 @@ void() SetNewParms; // called when a client first connects
void() SetChangeParms; // call to set parms for self so they
// can be saved for a level transition

-
//================================================
void end_sys_globals; // flag for structure dumping
//================================================

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 0ae68d9..de12145 100644
--- a/qc/defs_misc.qc
+++ b/qc/defs_misc.qc
@@ -3,201 +3,203 @@
==============================================================================*/

// inspired by Copper
-string version = "\nprogs_dump devkit\nversion 3.0.0";
+const string version = "\n\"Dog\" mode for FTE\nversion 0.1a";

// constants
-float FALSE = 0;
-float TRUE = 1;
-float NEGATIVE = -1;
+const float FALSE = 0;
+const float TRUE = 1;
+const float NEGATIVE = -1;

// worldtype values
-float WORLDTYPE_MEDIEVAL = 0;
-float WORLDTYPE_METAL = 1;
-float WORLDTYPE_BASE = 2;
+const float WORLDTYPE_MEDIEVAL = 0;
+const float WORLDTYPE_METAL = 1;
+const float WORLDTYPE_BASE = 2;

// edict.flags
-float FL_FLY = 1;
-float FL_SWIM = 2;
-float FL_CLIENT = 8; // set for all client edicts
-float FL_INWATER = 16; // for enter / leave water splash
-float FL_MONSTER = 32;
-float FL_GODMODE = 64; // player cheat
-float FL_NOTARGET = 128; // player cheat
-float FL_ITEM = 256; // extra wide size for bonus items
-float FL_ONGROUND = 512; // standing on something
-float FL_PARTIALGROUND = 1024; // not all corners are valid
-float FL_WATERJUMP = 2048; // player jumping out of water
-float FL_JUMPRELEASED = 4096; // for jump debouncing
-float FL_NOCENTERPRINT = 65536; // don't centerprint entity's message
+const float FL_FLY = 1;
+const float FL_SWIM = 2;
+const float FL_CLIENT = 8; // set for all client edicts
+const float FL_INWATER = 16; // for enter / leave water splash
+const float FL_MONSTER = 32;
+const float FL_GODMODE = 64; // player cheat
+const float FL_NOTARGET = 128; // player cheat
+const float FL_ITEM = 256; // extra wide size for bonus items
+const float FL_ONGROUND = 512; // standing on something
+const float FL_PARTIALGROUND = 1024; // not all corners are valid
+const float FL_WATERJUMP = 2048; // player jumping out of water
+const float FL_JUMPRELEASED = 4096; // for jump debouncing
+const float FL_NOCENTERPRINT = 65536; // don't centerprint entity's message
// field when its targets are used
// edict.movetype values
-float MOVETYPE_NONE = 0; // never moves
-//float MOVETYPE_ANGLENOCLIP = 1;
-//float MOVETYPE_ANGLECLIP = 2;
-float MOVETYPE_WALK = 3; // players only
-float MOVETYPE_STEP = 4; // discrete, not real time unless fall
-float MOVETYPE_FLY = 5;
-float MOVETYPE_TOSS = 6; // gravity
-float MOVETYPE_PUSH = 7; // no clip to world, push and crush
-float MOVETYPE_NOCLIP = 8;
-float MOVETYPE_FLYMISSILE = 9; // fly with extra size against monsters
-float MOVETYPE_BOUNCE = 10;
-float MOVETYPE_BOUNCEMISSILE = 11; // bounce with extra size
+const float MOVETYPE_NONE = 0; // never moves
+// float MOVETYPE_ANGLENOCLIP = 1;
+// float MOVETYPE_ANGLECLIP = 2;
+const float MOVETYPE_WALK = 3; // players only
+const float MOVETYPE_STEP = 4; // discrete, not real time unless fall
+const float MOVETYPE_FLY = 5;
+const float MOVETYPE_TOSS = 6; // gravity
+const float MOVETYPE_PUSH = 7; // no clip to world, push and crush
+const float MOVETYPE_NOCLIP = 8;
+const float MOVETYPE_FLYMISSILE = 9; // fly with extra size against monsters
+const float MOVETYPE_BOUNCE = 10;
+const float MOVETYPE_BOUNCEMISSILE = 11; // bounce with extra size

// edict.solid values
-float SOLID_NOT = 0; // no interaction with other objects
-float SOLID_TRIGGER = 1; // touch on edge, but not blocking
-float SOLID_BBOX = 2; // touch on edge, block
-float SOLID_SLIDEBOX = 3; // touch on edge, but not an onground
-float SOLID_BSP = 4; // bsp clip, touch on edge, block
+const float SOLID_NOT = 0; // no interaction with other objects
+const float SOLID_TRIGGER = 1; // touch on edge, but not blocking
+const float SOLID_BBOX = 2; // touch on edge, block
+const float SOLID_SLIDEBOX = 3; // touch on edge, but not an onground
+const float SOLID_BSP = 4; // bsp clip, touch on edge, block

// range values
-float RANGE_MELEE = 0;
-float RANGE_NEAR = 1;
-float RANGE_MID = 2;
-float RANGE_FAR = 3;
+const float RANGE_MELEE = 0;
+const float RANGE_NEAR = 1;
+const float RANGE_MID = 2;
+const float RANGE_FAR = 3;

// deadflag values
-float DEAD_NO = 0;
-float DEAD_DYING = 1;
-float DEAD_DEAD = 2;
-float DEAD_RESPAWNABLE = 3;
+const float DEAD_NO = 0;
+const float DEAD_DYING = 1;
+const float DEAD_DEAD = 2;
+const float DEAD_RESPAWNABLE = 3;

// takedamage values
-float DAMAGE_NO = 0;
-float DAMAGE_YES = 1;
-float DAMAGE_AIM = 2;
+const float DAMAGE_NO = 0;
+const float DAMAGE_YES = 1;
+const float DAMAGE_AIM = 2;

// items
-float IT_AXE = 4096;
-float IT_SHOTGUN = 1;
-float IT_SUPER_SHOTGUN = 2;
-float IT_NAILGUN = 4;
-float IT_SUPER_NAILGUN = 8;
-float IT_GRENADE_LAUNCHER = 16;
-float IT_ROCKET_LAUNCHER = 32;
-float IT_LIGHTNING = 64;
-float IT_EXTRA_WEAPON = 128;
-
-float IT_SHELLS = 256;
-float IT_NAILS = 512;
-float IT_ROCKETS = 1024;
-float IT_CELLS = 2048;
-
-float IT_ARMOR1 = 8192;
-float IT_ARMOR2 = 16384;
-float IT_ARMOR3 = 32768;
-float IT_SUPERHEALTH = 65536;
-
-float IT_KEY1 = 131072;
-float IT_KEY2 = 262144;
-
-float IT_INVISIBILITY = 524288;
-float IT_INVULNERABILITY = 1048576;
-float IT_SUIT = 2097152;
-float IT_QUAD = 4194304;
+const float IT_AXE = 4096;
+const float IT_SHOTGUN = 1;
+const float IT_SUPER_SHOTGUN = 2;
+const float IT_NAILGUN = 4;
+const float IT_SUPER_NAILGUN = 8;
+const float IT_GRENADE_LAUNCHER = 16;
+const float IT_ROCKET_LAUNCHER = 32;
+const float IT_LIGHTNING = 64;
+const float IT_EXTRA_WEAPON = 128;
+
+const float IT_SHELLS = 256;
+const float IT_NAILS = 512;
+const float IT_ROCKETS = 1024;
+const float IT_CELLS = 2048;
+
+const float IT_ARMOR1 = 8192;
+const float IT_ARMOR2 = 16384;
+const float IT_ARMOR3 = 32768;
+const float IT_SUPERHEALTH = 65536;
+
+const float IT_KEY1 = 131072;
+const float IT_KEY2 = 262144;
+
+const float IT_INVISIBILITY = 524288;
+const float IT_INVULNERABILITY = 1048576;
+const float IT_SUIT = 2097152;
+const float IT_QUAD = 4194304;

// point content values
-float CONTENT_EMPTY = -1;
-float CONTENT_SOLID = -2;
-float CONTENT_WATER = -3;
-float CONTENT_SLIME = -4;
-float CONTENT_LAVA = -5;
-float CONTENT_SKY = -6;
-
-float STATE_TOP = 0;
-float STATE_BOTTOM = 1;
-float STATE_UP = 2;
-float STATE_DOWN = 3;
-
-vector VEC_ORIGIN = '0 0 0';
+const float CONTENT_EMPTY = -1;
+const float CONTENT_SOLID = -2;
+const float CONTENT_WATER = -3;
+const float CONTENT_SLIME = -4;
+const float CONTENT_LAVA = -5;
+const float CONTENT_SKY = -6;
+
+const float STATE_TOP = 0;
+const float STATE_BOTTOM = 1;
+const float STATE_UP = 2;
+const float STATE_DOWN = 3;
+
+const vector VEC_ORIGIN = '0 0 0';
// Player
-vector VEC_HULL_MIN = '-16 -16 -24';
-vector VEC_HULL_MAX = '16 16 32';
-vector VEC_HULL_SIZE = '32 32 56';
+const vector VEC_HULL_MIN = '-16 -16 -24';
+const vector VEC_HULL_MAX = '16 16 32';
+const vector VEC_HULL_SIZE = '32 32 56';
+// Player crouching
+const vector VEC_CHULL_MIN = '-16 -16 -18';
+const vector VEC_CHULL_MAX = '16 16 18';
+const vector VEC_CHULL_SIZE = '32 32 36';
// Ogres, Shalrath, Demon, Shambler
-vector VEC_HULL2_MIN = '-32 -32 -24';
-vector VEC_HULL2_MAX = '32 32 64';
-vector VEC_HULL2_SIZE = '64 64 88';
+const vector VEC_HULL2_MIN = '-32 -32 -24';
+const vector VEC_HULL2_MAX = '32 32 64';
+const vector VEC_HULL2_SIZE = '64 64 88';

// protocol bytes
-float SVC_UPDATESTAT = 3; // required by Hipnotic code
-float SVC_SETVIEWPORT = 5; // Camera Hip. Drake devkit dumptruck_ds
-float SVC_SETVIEWANGLES = 10; // Camera Hip. Drake devkit dumptruck_ds
-float SVC_TEMPENTITY = 23;
-float SVC_KILLEDMONSTER = 27;
-float SVC_FOUNDSECRET = 28;
-float SVC_INTERMISSION = 30;
-float SVC_FINALE = 31;
-float SVC_CDTRACK = 32;
-float SVC_SELLSCREEN = 33;
-float SVC_CUTSCENE = 34; // Hipnotic Drake devkit -- dumptruck_ds
-
-float TE_SPIKE = 0;
-float TE_SUPERSPIKE = 1;
-float TE_GUNSHOT = 2;
-float TE_EXPLOSION = 3;
-float TE_TAREXPLOSION = 4;
-float TE_LIGHTNING1 = 5;
-float TE_LIGHTNING2 = 6;
-float TE_WIZSPIKE = 7;
-float TE_KNIGHTSPIKE = 8;
-float TE_LIGHTNING3 = 9;
-float TE_LAVASPLASH = 10;
-float TE_TELEPORT = 11;
-float TE_EXPLOSION2 = 12; // from doe -- dumptruck_ds
-
-float CLASS_PLAYER = 77; // TODO CEV
-
-// sound channels
-// channel 0 never willingly overrides
-// other channels (1-7) always override a playing sound on that channel
-float CHAN_AUTO = 0;
-float CHAN_WEAPON = 1;
-float CHAN_VOICE = 2;
-float CHAN_ITEM = 3;
-float CHAN_BODY = 4;
-
-float ATTN_NONE = 0;
-float ATTN_NORM = 1;
-float ATTN_IDLE = 2;
-float ATTN_STATIC = 3;
+const float SVC_UPDATESTAT = 3; // required by Hipnotic code
+const float SVC_SETVIEWPORT = 5; // Camera Hip. Drake devkit dumptruck_ds
+const float SVC_SETVIEWANGLES = 10; // Camera Hip. Drake devkit dumptruck_ds
+const float SVC_TEMPENTITY = 23;
+const float SVC_KILLEDMONSTER = 27;
+const float SVC_FOUNDSECRET = 28;
+const float SVC_INTERMISSION = 30;
+const float SVC_FINALE = 31;
+const float SVC_CDTRACK = 32;
+const float SVC_SELLSCREEN = 33;
+const float SVC_CUTSCENE = 34; // Hipnotic Drake devkit -- dumptruck_ds
+
+const float TE_SPIKE = 0;
+const float TE_SUPERSPIKE = 1;
+const float TE_GUNSHOT = 2;
+const float TE_EXPLOSION = 3;
+const float TE_TAREXPLOSION = 4;
+const float TE_LIGHTNING1 = 5;
+const float TE_LIGHTNING2 = 6;
+const float TE_WIZSPIKE = 7;
+const float TE_KNIGHTSPIKE = 8;
+const float TE_LIGHTNING3 = 9;
+const float TE_LAVASPLASH = 10;
+const float TE_TELEPORT = 11;
+const float TE_EXPLOSION2 = 12; // from doe -- dumptruck_ds
+
+// sound channels: channel 0 never willingly overrides, other channels
+// (1-7) always override a playing sound on that channel
+const float CHAN_AUTO = 0;
+const float CHAN_WEAPON = 1;
+const float CHAN_VOICE = 2;
+const float CHAN_ITEM = 3;
+const float CHAN_BODY = 4;
+const float CHAN_FEET = 5; // dedicated channel for steps -- CEV
+
+const float ATTN_NONE = 0;
+const float ATTN_NORM = 1;
+const float ATTN_IDLE = 2;
+const float ATTN_STATIC = 3;

// update types
-float UPDATE_GENERAL = 0;
-float UPDATE_STATIC = 1;
-float UPDATE_BINARY = 2;
-float UPDATE_TEMP = 3;
+const float UPDATE_GENERAL = 0;
+const float UPDATE_STATIC = 1;
+const float UPDATE_BINARY = 2;
+const float UPDATE_TEMP = 3;

// entity effects
-float EF_BRIGHTFIELD = 1;
-float EF_MUZZLEFLASH = 2;
-float EF_BRIGHTLIGHT = 4;
-float EF_DIMLIGHT = 8;
+const float EF_BRIGHTFIELD = 1;
+const float EF_MUZZLEFLASH = 2;
+const float EF_BRIGHTLIGHT = 4;
+const float EF_DIMLIGHT = 8;

// messages
-float MSG_BROADCAST = 0; // unreliable to all
-float MSG_ONE = 1; // reliable to one (msg_entity)
-float MSG_ALL = 2; // reliable to all
-float MSG_INIT = 3; // write to the init string
+const float MSG_BROADCAST = 0; // unreliable to all
+const float MSG_ONE = 1; // reliable to one (msg_entity)
+const float MSG_ALL = 2; // reliable to all
+const float MSG_INIT = 3; // write to the init string
// The byte(s) will be written into the multicast buffer for more
// selective sending. Messages sent this way will never be split across
// packets, and using this for csqc-only messages will not break protocol
// translation.
-float MSG_MULTICAST = 4;
+const float MSG_MULTICAST = 4;
// The byte(s) will be written into the entity buffer. This is a special
// value used only inside 'SendEntity' functions.
-float MSG_ENTITY = 5;
+const float MSG_ENTITY = 5;

// spawnflags for func_movewall
-float MOVEWALL_VISIBLE = 1;
-float MOVEWALL_TOUCH = 2;
-float MOVEWALL_NONBLOCKING = 4;
+const float MOVEWALL_VISIBLE = 1;
+const float MOVEWALL_TOUCH = 2;
+const float MOVEWALL_NONBLOCKING = 4;

// known_release values -- iw
-float KNOWN_RELEASE_NOT = 0;
-float KNOWN_RELEASE_ID1 = 1;
-float KNOWN_RELEASE_FUNC_MAPJAMX = 2;
+const float KNOWN_RELEASE_NOT = 0;
+const float KNOWN_RELEASE_ID1 = 1;
+const float KNOWN_RELEASE_FUNC_MAPJAMX = 2;

const float EV_VOID = 0;
const float EV_STRING = 1;
@@ -413,13 +415,11 @@ string lastnameused; // the targetname that was last used
.float switchshadstyle;
.float shadowoff;
.entity shadowcontroller;
-.float speed2;

void() misc_shadowcontroller;
void() misc_shadowcontroller_use;
void() shadow_fade_in;
void() shadow_fade_out;
-string(float num) lightstyle_fade_lookup;// add. by bmFbr for switchable shadows

//======================================================================
// misc pd_additions
@@ -433,18 +433,6 @@ string(float num) lightstyle_fade_lookup;// add. by bmFbr for switchable shadows
.float damage_mod; // dumptruck_ds

/*==============================================================================
- subs.qc
-==============================================================================*/
-void(vector tdest, float tspeed, void() func) SUB_CalcMove;
-void(entity ent, vector tdest, float tspeed, void() func) SUB_CalcMoveEnt;
-void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove;
-void() SUB_CalcMoveDone;
-void() SUB_CalcAngleMoveDone;
-void() SUB_Null;
-void() SUB_UseTargets;
-void() SUB_Remove;
-
-/*==============================================================================
combat.qc
==============================================================================*/
void(entity targ, entity inflictor, entity attacker, float damage) T_Damage;
@@ -501,8 +489,6 @@ void(string type, string text) print_self =
};

// TODO CEV
-void() monster_pain_use; // dumptruck_ds
-void() SUB_UsePain; // dumptruck_ds
.float pain_threshold; // dumptruck_ds
.string pain_target; // dumptruck_ds
.float color; // Hipnotic
@@ -600,6 +586,8 @@ float I_AM_TURRET = 262144; // dumptruck_ds
.entity rotatecontroller;
.float multiplier;

+
+// TODO CEV
.float first_frame, last_frame;
.float first_frame2, last_frame2;
.float frtime, frtime2;

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

Diff qc/fight.qc

diff --git a/qc/fight.qc b/qc/fight.qc
index 9ecea5e..ad9f9bd 100644
--- a/qc/fight.qc
+++ b/qc/fight.qc
@@ -1,4 +1,3 @@
-
/*

A monster is in fight mode if it thinks it can effectively attack its
@@ -60,6 +59,9 @@ float() CheckAttack =
local entity targ;
local float chance;

+ // silence a compiler warning -- CEV
+ spot1 = spot2 = '0 0 0';
+
if (self.spawnflags & I_AM_TURRET) //dumptruck_ds
{
// dprint("CheckAttack...\n");

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 3cfb7b8..40f83d4 100644
--- a/qc/func/breakable.qc
+++ b/qc/func/breakable.qc
@@ -6,9 +6,6 @@
const float BREAKABLE_NO_MONSTERS = 1;
const float BREAK_EXPLODE = 2;
const float BREAK_CUSTOM = 4;
-const float START_OFF = 1;
-const float SPARKS_BLUE = 2;
-const float SPARKS_PALE = 4;

// prototypes
void() make_breakable_debris;

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

Diff qc/func/laser.qc

diff --git a/qc/func/laser.qc b/qc/func/laser.qc
index c98ccc6..63967d8 100644
--- a/qc/func/laser.qc
+++ b/qc/func/laser.qc
@@ -7,6 +7,7 @@
.string message2;

// constants
+const float LASER_START_OFF = 1;
const float LASER_SOLID = 2;

//----------------------------------------------------------------------
@@ -18,7 +19,7 @@ void() laser_helper_think =
return;
}

- if (!(self.owner.spawnflags & START_OFF))
+ if (!(self.owner.spawnflags & LASER_START_OFF))
self.owner.alpha = self.alpha * 0.8 +
self.alpha * random() * 0.4;

@@ -43,10 +44,10 @@ void() func_laser_touch =
//----------------------------------------------------------------------
void() func_laser_use =
{
- if (self.spawnflags & START_OFF)
+ if (self.spawnflags & LASER_START_OFF)
{
setorigin (self, '0 0 0');
- self.spawnflags = self.spawnflags - START_OFF;
+ self.spawnflags = self.spawnflags - LASER_START_OFF;

// changed for progs_dump: the laser sound is now emitted from
// the func_laser itself instead of from the activator -- iw
@@ -64,7 +65,7 @@ void() func_laser_use =
sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);

setorigin (self, '0 0 9000');
- self.spawnflags = self.spawnflags + START_OFF;
+ self.spawnflags = self.spawnflags + LASER_START_OFF;

if (activator.classname == "player" && self.message2 != "")
{
@@ -73,11 +74,11 @@ void() func_laser_use =
}
};

-/*QUAKED func_laser (0 .5 .8) ? START_OFF LASER_SOLID X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+/*QUAKED func_laser (0 .5 .8) ? LASER_START_OFF LASER_SOLID 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

A toggleable laser, hurts to touch, can be used to block players

-START_OFF: Laser starts off.
+LASER_START_OFF: Laser starts off.

LASER_SOLID: Laser blocks movement while turned on.

@@ -127,7 +128,7 @@ void () func_laser =
self.use = func_laser_use;
self.touch = func_laser_touch;

- if (self.spawnflags & START_OFF)
+ if (self.spawnflags & LASER_START_OFF)
setorigin (self, '0 0 9000');

if (self.noise != "")

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 33be98f..5ba211c 100644
--- a/qc/func/rotate.qc
+++ b/qc/func/rotate.qc
@@ -225,9 +225,11 @@ void(float amount) SetDamageOnTargets =

while (ent)
{
- if (ent.classname == "trigger_hurt")
+ if (ent.classtype == CT_TRIGGER_HURT)
{
- hurt_setdamage (ent, amount);
+ // cast to trigger_hurt -- CEV
+ local trigger_hurt t = (trigger_hurt)ent;
+ t.setdamage (ent, amount);
}
else if (ent.classname == "func_movewall")
{

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

Diff qc/func/shadow.qc

diff --git a/qc/func/shadow.qc b/qc/func/shadow.qc
index b4b6558..daa936e 100644
--- a/qc/func/shadow.qc
+++ b/qc/func/shadow.qc
@@ -2,6 +2,8 @@
// func_shadow -- An invisible bmodel that can be used to only cast shadows.
//==============================================================================

+.float speed2;
+
// constants
const float SHADOWCONTROLLER_STARTOFF = 1;

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

Diff qc/func/togglewall.qc

diff --git a/qc/func/togglewall.qc b/qc/func/togglewall.qc
index d9a86de..88df402 100644
--- a/qc/func/togglewall.qc
+++ b/qc/func/togglewall.qc
@@ -8,6 +8,9 @@
// All rights reserved.
// Distributed (unsupported) on 3.12.97

+// constants
+const float TOGGLEWALL_START_OFF = 1;
+
//----------------------------------------------------------------------
void() blocker_touch =
{
@@ -38,11 +41,11 @@ void() blocker_use =
}
};

-/*QUAKED func_togglewall (0 .5 .8) ? START_OFF X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+/*QUAKED func_togglewall (0 .5 .8) ? TOGGLEWALL_START_OFF X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY

Creates a invisible wall that can be toggled on and off.

-START_OFF wall doesn't block until triggered.
+TOGGLEWALL_START_OFF wall doesn't block until triggered.

"noise" is the sound to play when wall is turned off.
"noise1" is the sound to play when wall is blocking.
@@ -78,7 +81,7 @@ void() func_togglewall =
self.solid = SOLID_BSP;
self.model = string_null;

- if (self.spawnflags & START_OFF)
+ if (self.spawnflags & TOGGLEWALL_START_OFF)
{
self.state = 0;
setorigin (self, self.origin + '8000 8000 8000');

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

Diff qc/func/train.qc

diff --git a/qc/func/train.qc b/qc/func/train.qc
index a41bd5e..4e28eb3 100644
--- a/qc/func/train.qc
+++ b/qc/func/train.qc
@@ -2,6 +2,8 @@
// func_train
//==============================================================================

+.float speed2;
+
// constants
const float TRAIN_RETRIGGER = 1;
const float TRAIN_MOVEONTRIGGER = 2;

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

Diff qc/info/camera.qc

diff --git a/qc/info/camera.qc b/qc/info/camera.qc
new file mode 100644
index 0000000..b2fb64a
--- /dev/null
+++ b/qc/info/camera.qc
@@ -0,0 +1,68 @@
+//==============================================================================
+// info_movie_camera, info_focal_point -- was in cutscene.qc
+//==============================================================================
+
+/*QUAKED info_movie_camera (.5 .5 .5) (-8 -8 -8) (8 8 32) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+This is the destination marker for a camera. It should have a "targetname"
+field with the same value as a camera-trigger's "target" field.
+*/
+class info_movie_camera: entity
+{
+ //--------------------------------------------------------------
+ virtual void() imc_touch =
+ {
+ local string temps;
+
+ if (other.classname != "camera")
+ return;
+
+ temps = this.target;
+ this.target = this.message;
+ SUB_UseTargets ();
+ this.target = temps;
+ if (this.cnt)
+ return;
+
+ this.think = SUB_Remove;
+ this.nextthink = time + 10;
+ this.solid = SOLID_NOT;
+ };
+
+ //--------------------------------------------------------------
+ void() info_movie_camera =
+ {
+ // this does nothing, just serves as a target spot
+ /*
+ if (vision)
+ return;
+ */
+
+ // ...more than a spot in Zer mode.
+ // this.use = SUB_Null;
+ this.solid = SOLID_TRIGGER;
+ this.classname = "info_movie_camera";
+ this.classtype = CT_INFO_MOVIE_CAMERA;
+ setorigin (this, this.origin);
+ setsize (this, '-8 -8 -8', '8 8 8');
+ this.touch = this.imc_touch;
+ };
+};
+
+/*QUAKED info_focal_point (.5 .5 .5) (-8 -8 -8) (8 8 32) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+This is the point that the camera will face. It should have a "targetname"
+field with the same value as a camera-trigger's "focal_point" field.
+*/
+class info_focal_point: entity
+{
+ //--------------------------------------------------------------
+ void() info_focal_point =
+ {
+ // PM: This entity is kept only for map compatibility reasons.
+ // Otherwise, this entity is redundant. Use 'info_notnull'
+ // instead.
+
+ // just holds a spot for the focal point.
+ this.classname = "info_focal_point";
+ this.classtype = CT_INFO_FOCAL_POINT;
+ };
+};

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

Diff qc/info/notnull.qc

diff --git a/qc/info/notnull.qc b/qc/info/notnull.qc
new file mode 100644
index 0000000..6d4dbd6
--- /dev/null
+++ b/qc/info/notnull.qc
@@ -0,0 +1,21 @@
+//==============================================================================
+// info_notnull
+//==============================================================================
+
+/*QUAKED info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+
+Never used in the or
+*/
+class info_notnull: entity
+{
+ //--------------------------------------------------------------
+ void() info_notnull =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "info_notnull";
+ this.classtype = CT_INFO_NOTNULL;
+ };
+};

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

Diff qc/info/null.qc

diff --git a/qc/info/null.qc b/qc/info/null.qc
new file mode 100644
index 0000000..42bff05
--- /dev/null
+++ b/qc/info/null.qc
@@ -0,0 +1,22 @@
+//==============================================================================
+// info_null
+//==============================================================================
+
+/*QUAKED info_null (0 0.5 0) (-4 -4 -4) (4 4 4) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+
+Used as a positional target for spotlights, etc.
+*/
+class info_null: entity
+{
+ //--------------------------------------------------------------
+ void() info_null =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "info_null";
+ this.classtype = CT_INFO_NULL;
+ remove (this);
+ };
+};

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

Diff qc/info/teleport_changedest.qc

diff --git a/qc/info/teleport_changedest.qc b/qc/info/teleport_changedest.qc
new file mode 100644
index 0000000..2e1a6fc
--- /dev/null
+++ b/qc/info/teleport_changedest.qc
@@ -0,0 +1,96 @@
+//==============================================================================
+// info_teleport_changedest -- by Qmaster, from progs_dump 3
+//==============================================================================
+
+/*QUAKED info_teleport_changedest (0 0.5 0) (-4 -4 -4) (4 4 4) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+Allows a mapper to change the target of a teleport_trigger. Useful in maps where
+the player may fall into a void and the mapper wants to update where they "respawn"
+as they progress through the level. Could also be used for teleport puzzles and more.
+target = trigger_teleport to change
+message = new info_teleport_destination's targetname to switch to
+targetname = name of this entity so we can use it
+*/
+class info_teleport_changedest: entity
+{
+ // this is from Qmaster:
+ //
+ // "I created an info_teleport_changedest
+ // target = targetname of trigger_teleport to affect
+ // message = targetname of new info_teleport_destination (or
+ // whatever entity really) to now teleport to
+ //
+ // So that I can automatically update the teleporter under my coagula
+ // map as you progress rather than have a bunch of triggers that I
+ // need to killtarget. Falling is not fatal then, but it does put you
+ // back some. Works as a sorta checkpoint system but also builds on my
+ // older idea for saving time in coop implemented in my Terracity map
+ // eons ago.
+ //
+ // looking at vanilla, you would only need to change trig.target to
+ // match self.message if you were to add this."
+
+ //--------------------------------------------------------------
+ virtual void() changedest_use =
+ {
+ local entity trig;
+
+ trig = find (world, ::targetname, this.target);
+ if (!trig || trig.classtype != CT_TRIGGER_TELEPORT)
+ {
+ dprint ("\b[TELEPORT_DESTCHANGE]\b ");
+ dprint ("Cannot find trigger_teleport\n");
+ return;
+ }
+
+ trig.goalentity = find (world, ::targetname, this.message);
+ if (!trig.goalentity)
+ {
+ dprint ("\b[TELEPORT_DESTCHANGE]\b ");
+ dprint ("Cannot find teleport destination\n");
+ return;
+ }
+
+ makevectors (trig.goalentity.mangle);
+ trig.goalentity.movedir = v_forward;
+ trig.goalentity.pos1 = trig.goalentity.origin + 32 *
+ trig.goalentity.movedir;
+
+ // dumptruck_ds see comment above
+ trig.target = this.message;
+ };
+
+ //--------------------------------------------------------------
+ void() info_teleport_changedest =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "info_teleport_changedest";
+ this.classtype = CT_INFO_TELEPORT_CHANGEDEST;
+ this.use = this.changedest_use;
+
+ if (this.targetname == "")
+ {
+ dprint ("\b[ERROR]\b info_teleport_changedest ");
+ dprint ("with no targetname\n");
+ remove (this);
+ }
+
+ if (this.target == "")
+ {
+ dprint ("\b[ERROR]\b info_teleport_changedest ");
+ dprint ("with no target\n");
+ remove (this);
+ }
+
+ if (this.message == "")
+ {
+ dprint ("\b[ERROR]\b info_teleport_changedest ");
+ dprint ("with no message set for new destination\n");
+ remove (this);
+ }
+ };
+};
+
+

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

Diff qc/info/teleport_destination.qc

diff --git a/qc/info/teleport_destination.qc b/qc/info/teleport_destination.qc
new file mode 100644
index 0000000..d4c09fb
--- /dev/null
+++ b/qc/info/teleport_destination.qc
@@ -0,0 +1,79 @@
+//==============================================================================
+// info_teleport_destination, info_teleport_random -- with additions by CEV
+//==============================================================================
+
+//======================================================================
+// teleporter targets
+//======================================================================
+
+/*QUAKED info_teleport_destination (.5 .5 .5) (-8 -8 -8) (8 8 32) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/player.mdl");
+}
+This is the destination marker for a teleporter. It should have a "targetname"
+field with the same value as a teleporter's "target" field.
+*/
+class info_teleport_destination: entity
+{
+ //--------------------------------------------------------------
+ void() info_teleport_destination =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit ())
+ return;
+
+ local vector end;
+
+ // this does nothing, just serves as a target spot
+ this.classname = "info_teleport_destination";
+ this.classtype = CT_INFO_TELEPORT_DESTINATION;
+ this.mangle = this.angles;
+ this.angles = '0 0 0';
+ this.model = "";
+
+ // drop teleporter exit to the floor if it's PM_TELEDROP units
+ // away -- CEV
+ end = this.origin + PM_TELEDROP;
+ tracebox (this.origin, this.mins, this.maxs, end, FALSE, this);
+ if (trace_allsolid || trace_startsolid || trace_fraction < 1)
+ {
+ droptofloor ();
+ // bump origin so player won't exit into floor -- CEV
+ // This was '0 0 24' but that was causing issues -- CEV
+ this.origin = this.origin + '0 0 27';
+ }
+ else
+ {
+ // instead apply the standard fixed Z offset -- CEV
+ this.origin = this.origin + '0 0 27';
+ }
+
+ if (!this.targetname)
+ if (this.target != __NULL__ && this.target != "")
+ // quake 3 compat -- CEV
+ this.targetname = this.target;
+ else
+ objerror ("no targetname");
+ };
+};
+
+/*QUAKED info_teleport_random (.5 .5 .5) (-8 -8 -8) (8 8 32) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+model ("progs/player.mdl");
+}
+This is a random destination marker for a teleporter.
+*/
+class info_teleport_random: entity
+{
+ //--------------------------------------------------------------
+ void() info_teleport_random =
+ {
+ // this does nothing, just serves as a target spot
+ this.classname = "info_teleport_random";
+ this.classtype = CT_INFO_TELEPORT_RANDOM;
+ this.mangle = this.angles;
+ this.angles = '0 0 0';
+ this.model = "";
+ this.origin = this.origin + '0 0 27';
+ };
+};

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 3f17440..260fa32 100644
--- a/qc/items/ammo.qc
+++ b/qc/items/ammo.qc
@@ -5,11 +5,28 @@
// constants
const float WEAPON_BIG2 = 1;

+// fixed ammo respawn time
+const float AMMO_RESPAWN_TIME = 30; // ammo respawn time; id1 30s
+
+// ammunition maximums & small / big box contents
+const float AMMO_CELLS_SMALL = 6; // id1 6; small box of cells
+const float AMMO_CELLS_BIG = 12; // id1 12; large box of cells
+const float AMMO_CELLS_MAX = 100; // id1 maximum 100
+const float AMMO_NAILS_SMALL = 25; // id1 25; small box of nails
+const float AMMO_NAILS_BIG = 50; // id1 50; large box of nails
+const float AMMO_NAILS_MAX = 200; // id1 maximum 200
+const float AMMO_ROCKETS_SMALL = 5; // id1 5; small box of rockets
+const float AMMO_ROCKETS_BIG = 10; // id1 10; large box of rockets
+const float AMMO_ROCKETS_MAX = 100; // id1 maximum 100
+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 =
{
local entity stemp;
- local float best;
+ local float best = 0;

// from Copper -- dumptruck_ds
if (!CheckValidTouch())
@@ -17,16 +34,18 @@ void() ammo_touch =

// if the player was using his best weapon, change up to the new
// one if better
- stemp = self;
- self = other;
- best = W_BestWeapon ();
- self = stemp;
-
+ 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 >= 100)
+ if (other.ammo_shells >= AMMO_SHELLS_MAX)
return;
other.ammo_shells = other.ammo_shells + self.aflag;
}
@@ -34,7 +53,7 @@ void() ammo_touch =
// spikes
if (self.weapon == 2)
{
- if (other.ammo_nails >= 200)
+ if (other.ammo_nails >= AMMO_NAILS_MAX)
return;
other.ammo_nails = other.ammo_nails + self.aflag;
}
@@ -42,7 +61,7 @@ void() ammo_touch =
// rockets
if (self.weapon == 3)
{
- if (other.ammo_rockets >= 100)
+ if (other.ammo_rockets >= AMMO_ROCKETS_MAX)
return;
other.ammo_rockets = other.ammo_rockets + self.aflag;
}
@@ -50,7 +69,7 @@ void() ammo_touch =
// cells
if (self.weapon == 4)
{
- if (other.ammo_cells >= 100)
+ if (other.ammo_cells >= AMMO_CELLS_MAX)
return;
other.ammo_cells = other.ammo_cells + self.aflag;
}
@@ -65,30 +84,33 @@ void() ammo_touch =
stuffcmd (other, "bf\n");

// change to a better weapon if appropriate
-
- if (other.weapon == best)
+ if (other.classname == "player" && other.weapon == best &&
+ autocvar(cg_autoswitch, TRUE))
{
stemp = self;
self = other;
- self.weapon = W_BestWeapon ();
- W_SetCurrentAmmo ();
+ self.weapon = PlayerBestWeapon ();
+ PlayerSetCurrentAmmo ();
self = stemp;
}

// if changed current ammo, update it
- stemp = self;
- self = other;
- W_SetCurrentAmmo ();
- self = stemp;
+ if (other.classname == "player")
+ {
+ 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, 30);
+ CheckItemRespawn (self, AMMO_RESPAWN_TIME);
else if (deathmatch == 1)
// doesn't respawn in "deathmatch 2"
- self.nextthink = time + 30;
+ self.nextthink = time + AMMO_RESPAWN_TIME;
self.think = SUB_Regen;

activator = other;
@@ -130,7 +152,7 @@ void() item_shells =

if !(self.particles_offset)
self.particles_offset = '16 16 16';
- self.aflag = 40;
+ self.aflag = AMMO_SHELLS_BIG;
}
else
{
@@ -151,7 +173,7 @@ void() item_shells =

if !(self.particles_offset)
self.particles_offset = '12 12 12';
- self.aflag = 20;
+ self.aflag = AMMO_SHELLS_SMALL;
}
self.weapon = 1;
self.netname = "shells";
@@ -193,7 +215,7 @@ void() item_spikes =

if !(self.particles_offset)
self.particles_offset = '16 16 16';
- self.aflag = 50;
+ self.aflag = AMMO_NAILS_BIG;
}
else
{
@@ -214,7 +236,7 @@ void() item_spikes =

if !(self.particles_offset)
self.particles_offset = '12 12 12';
- self.aflag = 25;
+ self.aflag = AMMO_NAILS_SMALL;
}
self.weapon = 2;
self.netname = "nails";
@@ -253,7 +275,7 @@ void() item_rockets =
}

self.particles_offset = '16 8 16';
- self.aflag = 10;
+ self.aflag = AMMO_ROCKETS_BIG;
}
else
{
@@ -274,7 +296,7 @@ void() item_rockets =

if !(self.particles_offset)
self.particles_offset = '8 8 16';
- self.aflag = 5;
+ self.aflag = AMMO_ROCKETS_SMALL;
}
self.weapon = 3;
self.netname = "rockets";
@@ -316,7 +338,7 @@ void() item_cells =

if !(self.particles_offset)
self.particles_offset = '16 16 16';
- self.aflag = 12;
+ self.aflag = AMMO_CELLS_BIG;
}
else
{
@@ -337,7 +359,7 @@ void() item_cells =

if !(self.particles_offset)
self.particles_offset = '12 12 12';
- self.aflag = 6;
+ self.aflag = AMMO_CELLS_SMALL;
}
self.weapon = 4;
self.netname = "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 34aeeb4..7470e1e 100644
--- a/qc/items/armor.qc
+++ b/qc/items/armor.qc
@@ -2,6 +2,24 @@
// armor.qc
//==============================================================================

+// constants
+const float ARMOR_GREEN_ABSORB = 0.3; // absorb percent; id1 0.3
+const float ARMOR_GREEN_AMOUNT = 100; // amount per pickup; id1 100
+const float ARMOR_GREEN_MAX = 125; // id1 125
+
+const float ARMOR_YELLOW_ABSORB = 0.6; // id1 0.6
+const float ARMOR_YELLOW_AMOUNT = 150; // id1 150
+const float ARMOR_YELLOW_MAX = 175; // id1 175
+
+const float ARMOR_RED_ABSORB = 0.8; // id1 0.8
+const float ARMOR_RED_AMOUNT = 200; // id1 200
+const float ARMOR_RED_MAX = 225; // id1 225
+
+const float ARMOR_SHARD_AMOUNT = 5; // Q3 5
+
+const float ARMOR_RESPAWN_SP = 30; // id1 30s
+const float ARMOR_RESPAWN_DM = 20; // id1 20s
+
// prototypes
void() armor_touch;
void() shard_touch;
@@ -22,29 +40,47 @@ void() shard_touch =
{
// has armor
// Supa, check bounds, original armourvalue + 25
- if (other.items & IT_ARMOR1 && other.armorvalue >= 125)
+ if (other.items & IT_ARMOR1 &&
+ other.armorvalue >= ARMOR_GREEN_MAX)
+ {
return;
- if (other.items & IT_ARMOR2 && other.armorvalue >= 175)
+ }
+ if (other.items & IT_ARMOR2 &&
+ other.armorvalue >= ARMOR_YELLOW_MAX)
+ {
return;
- if (other.items & IT_ARMOR3 && other.armorvalue >= 225)
+ }
+ 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 >= 125)
- other.armorvalue = 125;
- else if (other.items & IT_ARMOR2 && other.armorvalue >= 175)
- other.armorvalue = 175;
- else if (other.items & IT_ARMOR3 && other.armorvalue >= 225)
- other.armorvalue = 225;
+ 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 = 0.3;
- other.armorvalue = 5;
+ 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;
@@ -54,10 +90,10 @@ void() shard_touch =

// Supa, SP respawning items support
if (!deathmatch)
- CheckItemRespawn (self, 30);
+ CheckItemRespawn (self, ARMOR_RESPAWN_SP);
else if (deathmatch == 1)
// doesn't respawn in "deathmatch 2"
- self.nextthink = time + 20;
+ self.nextthink = time + ARMOR_RESPAWN_DM;
self.think = SUB_Regen;

if (self.obit_name != "")
@@ -77,7 +113,8 @@ void() shard_touch =
if (self.snd_misc != "")
sound_misc (other, CHAN_AUTO, self.snd_misc, 1, ATTN_NORM);
else
- sound_misc (other, CHAN_AUTO,"dump/armsh1.wav", 1, ATTN_NORM);
+ sound_misc (other, CHAN_AUTO,"items/armor_shard_q3.wav",
+ 1, ATTN_NORM);

// dumptruck_ds custom models and sounds END
stuffcmd (other, "bf\n");
@@ -101,22 +138,25 @@ void() armor_touch =

if (self.classname == "item_armor1")
{
- type = 0.3;
- value = 100;
+ // green armor
+ type = ARMOR_GREEN_ABSORB;
+ value = ARMOR_GREEN_AMOUNT;
bit = IT_ARMOR1;
}
else if (self.classname == "item_armor2" ||
self.classname == "item_armor_combat")
{
- type = 0.6;
- value = 150;
+ // yellow armor
+ type = ARMOR_YELLOW_ABSORB;
+ value = ARMOR_YELLOW_AMOUNT;
bit = IT_ARMOR2;
}
else if (self.classname == "item_armorInv" ||
self.classname == "item_armor_body")
{
- type = 0.8;
- value = 200;
+ // red armor
+ type = ARMOR_RED_ABSORB;
+ value = ARMOR_RED_AMOUNT;
bit = IT_ARMOR3;
}
else
@@ -141,10 +181,10 @@ void() armor_touch =

// Supa, SP respawning items support
if (!deathmatch)
- CheckItemRespawn (self, 30);
+ CheckItemRespawn (self, ARMOR_RESPAWN_SP);
else if (deathmatch == 1)
// doesn't respawn in "deathmatch 2"
- self.nextthink = time + 20;
+ self.nextthink = time + ARMOR_RESPAWN_DM;
self.think = SUB_Regen;

if (self.obit_name != "")
@@ -190,7 +230,7 @@ void() item_armor_shard =
precache_body_model ("progs/armshr.mdl");
// setmodel (self, "progs/armor.mdl");
body_model ("progs/armshr.mdl");
- precache_sound_misc ("dump/armsh1.wav");
+ precache_sound_misc ("items/armor_shard_q3.wav");
// dumptruck_ds custom models and sounds END
if !(self.skin)
self.skin = 0;

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
new file mode 100644
index 0000000..cd60080
--- /dev/null
+++ b/qc/items/axe.qc
@@ -0,0 +1,88 @@
+//==============================================================================
+// 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 5898e18..415bcc1 100644
--- a/qc/items/backpacks.qc
+++ b/qc/items/backpacks.qc
@@ -39,10 +39,13 @@ void() BackpackTouch =

// if the player was using his best weapon, change up to
// the new one if better
- stemp = self;
- self = other;
- best = W_BestWeapon ();
- self = stemp;
+ if (other.classname == "player" && autocvar(cg_autoswitch, TRUE))
+ {
+ stemp = self;
+ self = other;
+ best = PlayerBestWeapon ();
+ self = stemp;
+ }

// change weapons
other.ammo_shells = other.ammo_shells + self.ammo_shells;
@@ -105,19 +108,23 @@ void() BackpackTouch =

// remove the backpack, change self to the player
remove (self);
- 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
+ if (other.classname == "player")
+ {
+ 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

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

//======================================================================
@@ -231,7 +238,9 @@ void() DropVial =
setsize (item, '-16 -16 0', '16 16 56');
item.touch = health_touch;
item.healamount = 5;
- item.healtype = 0;
+ // changed the healtype from 0 (rotten) to 2 (mega) to reflect
+ // health vial behavior in item_health_vial -- CEV
+ item.healtype = HEALTH_TYPE_MEGA;
item.noise = "items/r_item1.wav";

StartItem ();
@@ -400,11 +409,15 @@ void() item_backpack_message =
// backpack touch sound
// sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
sound_misc (other, CHAN_ITEM, self.snd_misc, 1, ATTN_NORM);
- stuffcmd (other, "bf\n");
remove (self);
- self = other;
- bound_other_ammo ();
- W_SetCurrentAmmo ();
+
+ if (other.classname == "player")
+ {
+ stuffcmd (other, "bf\n");
+ self = other;
+ bound_other_ammo ();
+ PlayerSetCurrentAmmo ();
+ }
};

// Some of this text is from Drake -- dumptruck_ds

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 598a4c4..cceb6a9 100644
--- a/qc/items/health.qc
+++ b/qc/items/health.qc
@@ -2,19 +2,33 @@
// HEALTH BOXES
//==============================================================================

-// constants
-const float H_ROTTEN = 1;
-const float H_MEGA = 2;
-const float H_VIAL = 4;
-
// fields
.float healamount, healtype;

+// constants flags
+const float HEALTH_ROTTEN = 1; // rotten health box
+const float HEALTH_MEGA = 2; // megahealth
+const float HEALTH_VIAL = 4; // vial (AKA bubble)
+
+// constants healtypes
+const float HEALTH_TYPE_ROTTEN = 0; // rotten box
+const float HEALTH_TYPE_NORMAL = 1; // normal box
+const float HEALTH_TYPE_MEGA = 2; // megahealth
+
+// constants amounts & respawn times
+const float HEALTH_ROTTEN_AMOUNT = 15; // rotten heal amount; id1 15
+const float HEALTH_NORMAL_AMOUNT = 25; // standard heal amount; id1 25
+const float HEALTH_MEGA_AMOUNT = 100; // megahealth amount; id1 100
+const float HEALTH_VIAL_AMOUNT = 5; // vial heal amount; Quake3 5
+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
//----------------------------------------------------------------------
@@ -45,9 +59,6 @@ Rotten box heals 15 points.
Megahealth will add 100 health, then start to
rot the player back down to 100 health after 5 seconds.
*/
-//======================================================================
-// item_health
-//----------------------------------------------------------------------
void() item_health =
{
// new spawnflags for all entities -- iw
@@ -56,7 +67,7 @@ void() item_health =

self.touch = health_touch;

- if (self.spawnflags & H_ROTTEN)
+ if (self.spawnflags & HEALTH_ROTTEN)
{
if (!self.mdl_body && world.h_15_mdl)
self.mdl_body = world.h_15_mdl;
@@ -85,15 +96,15 @@ void() item_health =

// if !(self.healamount)
// set your custom health amount here -- dumptruck_ds
- self.healamount = 15;
- self.healtype = 0;
+ 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 & H_MEGA)
+ if (self.spawnflags & HEALTH_MEGA)
{
if (!self.mdl_body && world.h_mega_mdl)
self.mdl_body = world.h_mega_mdl;
@@ -120,8 +131,8 @@ void() item_health =

// if !(self.healamount)
// custom health amount -- dumptruck_ds
- self.healamount = 100;
- self.healtype = 2;
+ self.healamount = HEALTH_MEGA_AMOUNT;
+ self.healtype = HEALTH_TYPE_MEGA;
if !(self.particles_offset)
self.particles_offset = '16 16 16';
}
@@ -146,8 +157,8 @@ void() item_health =
self.snd_misc = "items/health1.wav";
self.noise = self.snd_misc;

- self.healamount = 25;
- self.healtype = 1;
+ 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
@@ -157,7 +168,7 @@ void() item_health =
StartItem ();
};

-//======================================================================
+//----------------------------------------------------------------------
// item_health_vial
//----------------------------------------------------------------------
void() item_health_vial =
@@ -180,16 +191,16 @@ void() item_health_vial =
self.snd_misc = "items/r_item1.wav";
self.noise = self.snd_misc;

- self.healamount = 5;
+ self.healamount = HEALTH_VIAL_AMOUNT;
// over heal and count down like mega health -- dumptruck_ds
- self.healtype = 2;
+ self.healtype = HEALTH_TYPE_MEGA;
setsize (self, '-16 -16 0', '16 16 56');
if !(self.particles_offset)
self.particles_offset = '0 0 0';
StartItem ();
};

-//======================================================================
+//----------------------------------------------------------------------
// health_touch
//----------------------------------------------------------------------
void() health_touch =
@@ -201,24 +212,27 @@ void() health_touch =
if (!CheckValidTouch())
return;

- if (self.healtype == 2)
+ if (self.healtype == HEALTH_TYPE_MEGA)
{
// Megahealth? Ignore max_health...
- if (other.health >= 250) return;
- if (!T_Heal(other, amount, 1)) return;
+ if (other.health >= 250)
+ return;
+ if (!T_Heal(other, amount, 1))
+ return;
}
else
{
- if (!T_Heal(other, amount, 0)) return;
+ if (!T_Heal(other, amount, 0))
+ return;
}

- sprint(other, "You receive ");
+ sprint (other, "You receive ");
s = ftos (amount);
- sprint(other, s);
- sprint(other, " health\n");
+ sprint (other, s);
+ sprint (other, " health\n");

// health touch sound
- // sound(other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
+ // sound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
// custom sounds -- dumptruck_ds
sound_misc (other, CHAN_AUTO, self.noise, 1, ATTN_NORM);

@@ -230,7 +244,7 @@ void() health_touch =
self.think = SUB_Regen;

// Megahealth = rot down the player's super health
- if (self.healtype == 2)
+ if (self.healtype == HEALTH_TYPE_MEGA)
{
// thanks ydrol!!!
other.megahealth_rottime = time + 5;
@@ -251,18 +265,18 @@ void() health_touch =
// item respawned). -- iw
//
if (!deathmatch)
- CheckItemRespawn (self, 30);
+ CheckItemRespawn (self, HEALTH_RESPAWN_SP);
else if (deathmatch == 1)
// doesn't respawn in "deathmatch 2"
- self.nextthink = time + 125;
+ self.nextthink = time + HEALTH_RESPAWN_MEGA;
}
else
{
if (!deathmatch)
- CheckItemRespawn (self, 30);
+ CheckItemRespawn (self, HEALTH_RESPAWN_SP);
else if (deathmatch == 1)
// doesn't respawn in "deathmatch 2"
- self.nextthink = time + 20;
+ self.nextthink = time + HEALTH_RESPAWN_DM;
}

activator = other;

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
index 051d938..952722f 100644
--- a/qc/items/misc.qc
+++ b/qc/items/misc.qc
@@ -84,7 +84,7 @@ void() PlaceItem =

if (self.spawnflags & ITEM_SUSPENDED)
{
- //ijed Don't drop spawnflag
+ // ijed Don't drop spawnflag
self.movetype = MOVETYPE_FLY;
}
else

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
new file mode 100644
index 0000000..3bc7fcb
--- /dev/null
+++ b/qc/items/nailguns.qc
@@ -0,0 +1,46 @@
+//==============================================================================
+// 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 4a81ec2..7c73c85 100644
--- a/qc/items/powerups.qc
+++ b/qc/items/powerups.qc
@@ -13,18 +13,20 @@ void() powerup_touch =
sprint (other, self.netname);
sprint (other,"\n");

- // if (deathmatch)
- // {
- // 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;
- // }
+ /*
+ if (deathmatch)
+ {
+ 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;
@@ -157,7 +159,6 @@ void() item_artifact_envirosuit =
StartItem ();
};

-
/*QUAKED item_artifact_invisibility (0 .5 .8) (-16 -16 -24) (16 16 32) X X X X X SPAWN_SILENT TRIGGER_SPAWNED SUSPENDED_IN_AIR NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER RESPAWN_WITH_DM_EFFECTS NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model("progs/invisibl.mdl"); }
Ring of Shadows

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
new file mode 100644
index 0000000..0b9b898
--- /dev/null
+++ b/qc/items/shotguns.qc
@@ -0,0 +1,59 @@
+//==============================================================================
+// 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 734167c..876b69f 100644
--- a/qc/items/weapons.qc
+++ b/qc/items/weapons.qc
@@ -2,27 +2,31 @@
// items/weapons.qc -- weapons
//==============================================================================

-// prototypes
-float() W_BestWeapon;
+// constants
+const float AMMO_CELLS_WP = 15; // cells on weapon pickup; id1 15
+const float AMMO_ROCKETS_WP = 5; // rockets on weapon pickup; id1 5
+
+const float WEAPON_RESPAWN_TIME = 30; // as the name suggests; id1 30

//----------------------------------------------------------------------
void() bound_other_ammo =
{
- if (other.ammo_shells > 100)
- other.ammo_shells = 100;
- if (other.ammo_nails > 200)
- other.ammo_nails = 200;
- if (other.ammo_rockets > 100)
- other.ammo_rockets = 100;
- if (other.ammo_cells > 100)
- other.ammo_cells = 100;
+ // these constants are defined in items/ammo.qc -- CEV
+ if (other.ammo_shells > AMMO_SHELLS_MAX)
+ other.ammo_shells = AMMO_SHELLS_MAX;
+ if (other.ammo_nails > AMMO_NAILS_MAX)
+ other.ammo_nails = AMMO_NAILS_MAX;
+ if (other.ammo_rockets > AMMO_ROCKETS_MAX)
+ other.ammo_rockets = AMMO_ROCKETS_MAX;
+ if (other.ammo_cells > AMMO_CELLS_MAX)
+ other.ammo_cells = AMMO_CELLS_MAX;
};

//----------------------------------------------------------------------
float(float w) RankForWeapon =
{
// 1997-12-23 Thunderbolt fix by Maddes recognize waterlevel
- if (self.waterlevel <= 1 && w == IT_LIGHTNING)
+ if (self.waterlevel <= WATERLEVEL_FEET && w == IT_LIGHTNING)
return 1;
if (w == IT_ROCKET_LAUNCHER)
return 2;
@@ -71,10 +75,13 @@ void() weapon_touch =

// if the player was using his best weapon, change up to the
// new one if better
- stemp = self;
- self = other;
- best = W_BestWeapon ();
- self = stemp;
+ if (other.classname == "player" && autocvar(cg_autoswitch, TRUE))
+ {
+ stemp = self;
+ self = other;
+ best = PlayerBestWeapon ();
+ self = stemp;
+ }

if (deathmatch == 2 || coop)
{
@@ -103,7 +110,7 @@ void() weapon_touch =
return;
hadammo = other.ammo_shells;
new = IT_SHOTGUN;
- other.ammo_shells = other.ammo_shells + 5;
+ other.ammo_shells = other.ammo_shells + AMMO_SHELLS_WP;
}
else if (self.classname == "weapon_nailgun")
{
@@ -112,7 +119,7 @@ void() weapon_touch =
return;
hadammo = other.ammo_nails;
new = IT_NAILGUN;
- other.ammo_nails = other.ammo_nails + 30;
+ other.ammo_nails = other.ammo_nails + AMMO_NAILS_WP;
}
else if (self.classname == "weapon_supernailgun")
{
@@ -120,7 +127,7 @@ void() weapon_touch =
return;
hadammo = other.ammo_rockets;
new = IT_SUPER_NAILGUN;
- other.ammo_nails = other.ammo_nails + 30;
+ other.ammo_nails = other.ammo_nails + AMMO_NAILS_WP;
}
else if (self.classname == "weapon_supershotgun")
{
@@ -128,7 +135,7 @@ void() weapon_touch =
return;
hadammo = other.ammo_rockets;
new = IT_SUPER_SHOTGUN;
- other.ammo_shells = other.ammo_shells + 5;
+ other.ammo_shells = other.ammo_shells + AMMO_SHELLS_WP;
}
else if (self.classname == "weapon_rocketlauncher")
{
@@ -136,7 +143,7 @@ void() weapon_touch =
return;
hadammo = other.ammo_rockets;
new = IT_ROCKET_LAUNCHER;
- other.ammo_rockets = other.ammo_rockets + 5;
+ other.ammo_rockets = other.ammo_rockets + AMMO_ROCKETS_WP;
}
else if (self.classname == "weapon_grenadelauncher")
{
@@ -144,7 +151,7 @@ void() weapon_touch =
return;
hadammo = other.ammo_rockets;
new = IT_GRENADE_LAUNCHER;
- other.ammo_rockets = other.ammo_rockets + 5;
+ other.ammo_rockets = other.ammo_rockets + AMMO_ROCKETS_WP;
}
else if (self.classname == "weapon_lightning")
{
@@ -152,7 +159,7 @@ void() weapon_touch =
return;
hadammo = other.ammo_rockets;
new = IT_LIGHTNING;
- other.ammo_cells = other.ammo_cells + 15;
+ other.ammo_cells = other.ammo_cells + AMMO_CELLS_WP;
}
else
{
@@ -173,21 +180,25 @@ void() weapon_touch =
old = other.items;
other.items = other.items | new;

- 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);
-
- W_SetCurrentAmmo ();
-
- self = stemp;
+ if (other.classname == "player" && autocvar(cg_autoswitch, TRUE))
+ {
+ 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);
+
+ PlayerSetCurrentAmmo ();
+
+ self = stemp;
+ }

if (leave)
return;
@@ -197,10 +208,10 @@ void() weapon_touch =
self.solid = SOLID_NOT;
// Supa, SP respawning items support
if (!deathmatch)
- CheckItemRespawn (self, 30);
+ CheckItemRespawn (self, WEAPON_RESPAWN_TIME);
else if (deathmatch == 1)
// weapons never disappear in "deathmatch 2"
- self.nextthink = time + 30;
+ self.nextthink = time + WEAPON_RESPAWN_TIME;

self.think = SUB_Regen;

@@ -209,115 +220,6 @@ void() weapon_touch =
SUB_UseTargets ();
};

-//======================================================================
-// 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;
- setsize (self, '-16 -16 0', '16 16 56');
- StartItem ();
-};
-
-/*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 ();
-};
-
-/*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 ();
-};
-
/*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
@@ -358,7 +260,6 @@ void() weapon_rocketlauncher =
StartItem ();
};

-
/*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

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

Diff qc/math.qc

diff --git a/qc/math.qc b/qc/math.qc
index 7559803..3803c1b 100644
--- a/qc/math.qc
+++ b/qc/math.qc
@@ -179,9 +179,9 @@ vector(vector ang) normalizeAngles =
//----------------------------------------------------------------------
vector(vector ang) normalizeAngles180 =
{
- ang_x = ((ang_x + 180) - floor ((ang_x + 180)/360) * 360) - 180;
- ang_y = ((ang_y + 180) - floor ((ang_y + 180)/360) * 360) - 180;
- ang_z = ((ang_z + 180) - floor ((ang_z + 180)/360) * 360) - 180;
+ ang_x = ((ang_x + 180) - floor ((ang_x + 180) / 360) * 360) - 180;
+ ang_y = ((ang_y + 180) - floor ((ang_y + 180) / 360) * 360) - 180;
+ ang_z = ((ang_z + 180) - floor ((ang_z + 180) / 360) * 360) - 180;

return ang;
};

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

Diff qc/misc/air_bubbles.qc

diff --git a/qc/misc/air_bubbles.qc b/qc/misc/air_bubbles.qc
index e9f4ded..1358c53 100644
--- a/qc/misc/air_bubbles.qc
+++ b/qc/misc/air_bubbles.qc
@@ -2,123 +2,123 @@
// air_bubbles
//==============================================================================

-// prototypes
-void() make_bubbles;
-void() bubble_remove;
-void() bubble_bob;
+class temp_bubbles: entity
+{
+ //--------------------------------------------------------------
+ virtual void() bubble_bob =
+ {
+ local float rnd1, rnd2, rnd3;
+
+ this.cnt = this.cnt + 1;
+ if (this.cnt == 4)
+ bubble_split ();
+ if (this.cnt == 20)
+ remove (this);
+
+ rnd1 = this.velocity_x + (-10 + (random() * 20));
+ rnd2 = this.velocity_y + (-10 + (random() * 20));
+ rnd3 = this.velocity_z + 10 + random() * 10;
+
+ if (rnd1 > 10)
+ rnd1 = 5;
+ if (rnd1 < -10)
+ rnd1 = -5;
+
+ if (rnd2 > 10)
+ rnd2 = 5;
+ if (rnd2 < -10)
+ rnd2 = -5;
+
+ if (rnd3 < 10)
+ rnd3 = 15;
+ if (rnd3 > 30)
+ rnd3 = 25;
+
+ this.velocity_x = rnd1;
+ this.velocity_y = rnd2;
+ this.velocity_z = rnd3;
+
+ this.nextthink = time + 0.5;
+ this.think = bubble_bob;
+ };
+
+ //--------------------------------------------------------------
+ virtual void() bubble_remove =
+ {
+ if (other.classtype == this.classtype)
+ {
+ // dprint ("bump");
+ return;
+ }
+ remove (this);
+ };
+
+ //--------------------------------------------------------------
+ virtual void() bubble_split =
+ {
+ local temp_bubbles bubble;
+ bubble = spawn (temp_bubbles, frame: 1, cnt: 10,
+ origin: this.origin);
+ this.frame = 1;
+ this.cnt = 10;
+ if (this.waterlevel != WATERLEVEL_EYES)
+ remove (this);
+ };
+
+ void() temp_bubbles =
+ {
+ // make bubbles
+ setmodel (this, "progs/s_bubble.spr");
+ setorigin (this, this.origin);
+ this.movetype = MOVETYPE_NOCLIP;
+ this.solid = SOLID_NOT;
+ this.velocity = '0 0 15';
+ this.nextthink = time + 0.5;
+ this.think = bubble_bob;
+ // no touch function when spawning death bubbles -- CEV
+ this.touch = bubble_remove;
+ this.classname = "bubble";
+ this.classtype = CT_TEMP_BUBBLES;
+ this.frame = 0;
+ this.cnt = 0;
+ setsize (this, '-8 -8 -8', '8 8 8');
+ };
+};

/*QUAKED air_bubbles (0 .5 .8) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY

air bubbles entity

*/
-void() air_bubbles =
+class air_bubbles: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- if (deathmatch)
+ //--------------------------------------------------------------
+ virtual void() make_bubbles =
{
- remove (self);
- return;
- }
-
- precache_model ("progs/s_bubble.spr");
- self.nextthink = time + 1;
- self.think = make_bubbles;
-};
+ local temp_bubbles bubble;

-//----------------------------------------------------------------------
-void() make_bubbles =
-{
- local entity bubble;
-
- bubble = spawn ();
- setmodel (bubble, "progs/s_bubble.spr");
- setorigin (bubble, self.origin);
- bubble.movetype = MOVETYPE_NOCLIP;
- bubble.solid = SOLID_NOT;
- bubble.velocity = '0 0 15';
- bubble.nextthink = time + 0.5;
- bubble.think = bubble_bob;
- bubble.touch = bubble_remove;
- bubble.classname = "bubble";
- bubble.frame = 0;
- bubble.cnt = 0;
- setsize (bubble, '-8 -8 -8', '8 8 8');
- self.nextthink = time + random() + 0.5;
- self.think = make_bubbles;
-};
-
-//----------------------------------------------------------------------
-void() bubble_split =
-{
- local entity bubble;
- bubble = spawn ();
- setmodel (bubble, "progs/s_bubble.spr");
- setorigin (bubble, self.origin);
- bubble.movetype = MOVETYPE_NOCLIP;
- bubble.solid = SOLID_NOT;
- bubble.velocity = self.velocity;
- bubble.nextthink = time + 0.5;
- bubble.think = bubble_bob;
- bubble.touch = bubble_remove;
- bubble.classname = "bubble";
- bubble.frame = 1;
- bubble.cnt = 10;
- setsize (bubble, '-8 -8 -8', '8 8 8');
- self.frame = 1;
- self.cnt = 10;
- if (self.waterlevel != 3)
- remove (self);
-};
+ bubble = spawn (temp_bubbles, origin: this.origin);
+ this.nextthink = time + random() + 0.5;
+ this.think = make_bubbles;
+ };

-//----------------------------------------------------------------------
-void() bubble_remove =
-{
- if (other.classname == self.classname)
+ //--------------------------------------------------------------
+ void() air_bubbles =
{
- // dprint ("bump");
- return;
- }
- remove (self);
-};
-
-//----------------------------------------------------------------------
-void() bubble_bob =
-{
- local float rnd1, rnd2, rnd3;
-
- self.cnt = self.cnt + 1;
- if (self.cnt == 4)
- bubble_split ();
- if (self.cnt == 20)
- remove (self);
-
- rnd1 = self.velocity_x + (-10 + (random() * 20));
- rnd2 = self.velocity_y + (-10 + (random() * 20));
- rnd3 = self.velocity_z + 10 + random() * 10;
-
- if (rnd1 > 10)
- rnd1 = 5;
- if (rnd1 < -10)
- rnd1 = -5;
-
- if (rnd2 > 10)
- rnd2 = 5;
- if (rnd2 < -10)
- rnd2 = -5;
-
- if (rnd3 < 10)
- rnd3 = 15;
- if (rnd3 > 30)
- rnd3 = 25;
-
- self.velocity_x = rnd1;
- self.velocity_y = rnd2;
- self.velocity_z = rnd3;
-
- self.nextthink = time + 0.5;
- self.think = bubble_bob;
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ if (deathmatch)
+ {
+ remove (this);
+ return;
+ }
+
+ this.classname = "air_bubbles";
+ this.classtype = CT_MISC_AIR_BUBBLES;
+ precache_model ("progs/s_bubble.spr");
+ this.nextthink = time + 1;
+ this.think = make_bubbles;
+ };
};

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

Diff qc/misc/ambient_sound.qc

diff --git a/qc/misc/ambient_sound.qc b/qc/misc/ambient_sound.qc
index 8a500c8..9e7ebb2 100644
--- a/qc/misc/ambient_sound.qc
+++ b/qc/misc/ambient_sound.qc
@@ -2,6 +2,101 @@
// ambient_sound -- miscellaneous ambient sound entities
//==============================================================================

+// constants
+const string SND_AMBIENTCOMPHUM = "ambience/comp1.wav";
+const string SND_AMBIENTDRIP = "ambience/drip1.wav";
+const string SND_AMBIENTDRONE = "ambience/drone6.wav";
+const string SND_AMBIENTFIRE = "ambience/fire1.wav";
+const string SND_AMBIENTFBUZZ = "ambience/buzz1.wav";
+const string SND_AMBIENTLBUZZ = "ambience/fl_hum1.wav";
+const string SND_AMBIENTSWIND = "ambience/suck1.wav";
+const string SND_AMBIENTSWAMP1 = "ambience/swamp1.wav";
+const string SND_AMBIENTSWAMP2 = "ambience/swamp2.wav";
+const string SND_AMBIENTWATER1 = "ambience/water1.wav";
+const string SND_AMBIENTWIND2 = "ambience/wind2.wav";
+const string SND_AMBIENTHUNDER = "ambience/thunder1.wav";
+
+class base_ambient_sound: entity
+{
+ //--------------------------------------------------------------
+ static void(vector source) ambient_sound_fire =
+ {
+ precache_sound (SND_AMBIENTFIRE);
+ // attenuate fast
+ ambientsound (source, SND_AMBIENTFIRE, 0.5, ATTN_STATIC);
+ };
+
+ //--------------------------------------------------------------
+ static void(vector source) ambient_sound_comphum =
+ {
+ precache_sound (SND_AMBIENTCOMPHUM);
+ ambientsound (source, SND_AMBIENTCOMPHUM, 1, ATTN_STATIC);
+ };
+
+ //--------------------------------------------------------------
+ static void(vector source) ambient_sound_drip =
+ {
+ precache_sound (SND_AMBIENTDRIP);
+ ambientsound (source, SND_AMBIENTDRIP, 0.5, ATTN_STATIC);
+ };
+
+ //--------------------------------------------------------------
+ static void(vector source) ambient_sound_drone =
+ {
+ precache_sound (SND_AMBIENTDRONE);
+ ambientsound (source, SND_AMBIENTDRONE, 0.5, ATTN_STATIC);
+ };
+
+ //--------------------------------------------------------------
+ static void(vector source) ambient_sound_fbuzz =
+ {
+ precache_sound (SND_AMBIENTFBUZZ);
+ ambientsound (source, SND_AMBIENTFBUZZ, 1, ATTN_STATIC);
+ };
+
+ //--------------------------------------------------------------
+ static void(vector source) ambient_sound_lbuzz =
+ {
+ precache_sound (SND_AMBIENTLBUZZ);
+ ambientsound (source, SND_AMBIENTLBUZZ, 0.5, ATTN_STATIC);
+ };
+
+ //--------------------------------------------------------------
+ static void(vector source) ambient_sound_suckwind =
+ {
+ precache_sound (SND_AMBIENTSWIND);
+ ambientsound (source, SND_AMBIENTSWIND, 1, ATTN_STATIC);
+ };
+
+ //--------------------------------------------------------------
+ static void(vector source) ambient_sound_swamp1 =
+ {
+ precache_sound (SND_AMBIENTSWAMP1);
+ ambientsound (source, SND_AMBIENTSWAMP1, 0.5, ATTN_STATIC);
+ };
+
+ //--------------------------------------------------------------
+ static void(vector source) ambient_sound_swamp2 =
+ {
+ precache_sound (SND_AMBIENTSWAMP1);
+ ambientsound (source, SND_AMBIENTSWAMP2, 0.5, ATTN_STATIC);
+ };
+
+ //--------------------------------------------------------------
+ static void(vector source) ambient_sound_water1 =
+ {
+ precache_sound (SND_AMBIENTWATER1);
+ ambientsound (source, SND_AMBIENTWATER1, 1, ATTN_STATIC);
+ };
+
+ //--------------------------------------------------------------
+ static void(vector source) ambient_sound_wind2 =
+ {
+ precache_sound (SND_AMBIENTWIND2);
+ ambientsound (source, SND_AMBIENTWIND2, 1, ATTN_STATIC);
+ };
+};
+
//======================================================================
//johnfitz -- ambient_general (this is from Rubicon Rumble dev kit)
//======================================================================
@@ -17,68 +112,80 @@ Keys:

"speed" attenuation, default 3
*/
-void() ambient_general =
+class ambient_general: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- // dumptruck_ds
- if (!self.noise)
- {
- objerror ("no soundfile set in noise!\n");
- remove (self);
- return;
- }
-
- precache_sound (self.noise);
-
- if (!self.speed)
- {
- self.speed = ATTN_NORM;
- }
-
- if (self.speed == 0)
- self.speed = 1;
- if (self.speed == -1)
- // self.speed = 0;
- self.speed = ATTN_NONE;
-
- if (!self.volume)
+ //--------------------------------------------------------------
+ void() ambient_general =
{
- self.volume = 0.5;
- }
-
- ambientsound (self.origin, self.noise, self.volume, self.speed);
- remove (self);
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "ambient_general";
+ this.classtype = CT_MISC_AMBIENT_GENERAL;
+
+ // dumptruck_ds
+ if (!this.noise)
+ {
+ objerror ("no soundfile set in noise!\n");
+ remove (this);
+ return;
+ }
+
+ precache_sound (this.noise);
+
+ if (!this.speed)
+ this.speed = ATTN_NORM;
+ if (this.speed == 0)
+ this.speed = 1;
+ if (this.speed == -1)
+ // this.speed = 0;
+ this.speed = ATTN_NONE;
+
+ if (!this.volume)
+ this.volume = 0.5;
+
+ ambientsound (this.origin, this.noise, this.volume, this.speed);
+ remove (this);
+ };
};

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

/*QUAKED FireAmbient (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
*/
-void() FireAmbient =
+class FireAmbient: base_ambient_sound
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_sound ("ambience/fire1.wav");
- // attenuate fast
- ambientsound (self.origin, "ambience/fire1.wav", 0.5, ATTN_STATIC);
+ //--------------------------------------------------------------
+ void() FireAmbient =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "FireAmbient";
+ this.classtype = CT_MISC_AMBIENT_FIRE;
+ ambient_sound_fire (this.origin);
+ };
};

/*QUAKED ambient_fire (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
ambinet fire sound effects added for consistency
same as FireAmbient
*/
-void() ambient_fire =
+class ambient_fire: base_ambient_sound
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- FireAmbient ();
+ //--------------------------------------------------------------
+ void() ambient_fire =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "ambient_fire";
+ this.classtype = CT_MISC_AMBIENT_FIRE;
+ ambient_sound_fire (this.origin);
+ };
};

//======================================================================
@@ -86,98 +193,138 @@ void() ambient_fire =
/*QUAKED ambient_comp_hum (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY

*/
-void() ambient_comp_hum =
+class ambient_comp_hum: base_ambient_sound
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_sound ("ambience/comp1.wav");
- ambientsound (self.origin, "ambience/comp1.wav", 1, ATTN_STATIC);
+ //--------------------------------------------------------------
+ void() ambient_comp_hum =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "ambient_comp_hum";
+ this.classtype = CT_MISC_AMBIENT_COMPHUM;
+ ambient_sound_comphum (this.origin);
+ };
};

/*QUAKED ambient_drip (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
*/
-void() ambient_drip =
+class ambient_drip: base_ambient_sound
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_sound ("ambience/drip1.wav");
- ambientsound (self.origin, "ambience/drip1.wav", 0.5, ATTN_STATIC);
+ //--------------------------------------------------------------
+ void() ambient_drip =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "ambient_drip";
+ this.classtype = CT_MISC_AMBIENT_DRIP;
+ ambient_sound_drip (this.origin);
+ };
};

/*QUAKED ambient_drone (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
*/
-void() ambient_drone =
+class ambient_drone: base_ambient_sound
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_sound ("ambience/drone6.wav");
- ambientsound (self.origin, "ambience/drone6.wav", 0.5, ATTN_STATIC);
+ //--------------------------------------------------------------
+ void() ambient_drone =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "ambient_drone";
+ this.classtype = CT_MISC_AMBIENT_DRONE;
+ ambient_sound_drone (this.origin);
+ };
};

/*QUAKED ambient_flouro_buzz (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
*/
-void() ambient_flouro_buzz =
+class ambient_flouro_buzz: base_ambient_sound
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_sound ("ambience/buzz1.wav");
- ambientsound (self.origin, "ambience/buzz1.wav", 1, ATTN_STATIC);
+ //--------------------------------------------------------------
+ void() ambient_flouro_buzz =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "ambient_fluoro_buzz";
+ this.classtype = CT_MISC_AMBIENT_FBUZZ;
+ ambient_sound_fbuzz (this.origin);
+ };
};

/*QUAKED ambient_light_buzz (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
*/
-void() ambient_light_buzz =
+class ambient_light_buzz: base_ambient_sound
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_sound ("ambience/fl_hum1.wav");
- ambientsound (self.origin, "ambience/fl_hum1.wav", 0.5, ATTN_STATIC);
+ //--------------------------------------------------------------
+ void() ambient_light_buzz =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "ambient_light_buzz";
+ this.classtype = CT_MISC_AMBIENT_LBUZZ;
+ ambient_sound_lbuzz (this.origin);
+ };
};

/*QUAKED ambient_suck_wind (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
*/
-void() ambient_suck_wind =
+class ambient_suck_wind: base_ambient_sound
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_sound ("ambience/suck1.wav");
- ambientsound (self.origin, "ambience/suck1.wav", 1, ATTN_STATIC);
+ //--------------------------------------------------------------
+ void() ambient_suck_wind =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "ambient_suck_wind";
+ this.classtype = CT_MISC_AMBIENT_SUCKWIND;
+ ambient_sound_suckwind (this.origin);
+ };
};

/*QUAKED ambient_swamp1 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
*/
-void() ambient_swamp1 =
+class ambient_swamp1: base_ambient_sound
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_sound ("ambience/swamp1.wav");
- ambientsound (self.origin, "ambience/swamp1.wav", 0.5, ATTN_STATIC);
+ //--------------------------------------------------------------
+ void() ambient_swamp1 =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "ambient_swamp1";
+ this.classtype = CT_MISC_AMBIENT_SWAMP1;
+ ambient_sound_swamp1 (this.origin);
+ };
};

/*QUAKED ambient_swamp2 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
*/
-void() ambient_swamp2 =
+class ambient_swamp2: base_ambient_sound
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_sound ("ambience/swamp2.wav");
- ambientsound (self.origin, "ambience/swamp2.wav", 0.5, ATTN_STATIC);
+ //--------------------------------------------------------------
+ void() ambient_swamp2 =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "ambient_swamp2";
+ this.classtype = CT_MISC_AMBIENT_SWAMP2;
+ ambient_sound_swamp2 (this.origin);
+ };
};

//======================================================================
@@ -193,26 +340,36 @@ void() ambient_swamp2 =

/*QUAKED ambient_water1 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
*/
-void() ambient_water1 =
+class ambient_water1: base_ambient_sound
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_sound ("ambience/water1.wav");
- ambientsound (self.origin, "ambience/water1.wav", 1, ATTN_STATIC);
+ //--------------------------------------------------------------
+ void() ambient_water1 =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "ambient_water1";
+ this.classtype = CT_MISC_AMBIENT_WATER1;
+ ambient_sound_water1 (this.origin);
+ };
};

/*QUAKED ambient_wind2 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
*/
-void() ambient_wind2 =
+class ambient_wind2: base_ambient_sound
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_sound ("ambience/wind2.wav");
- ambientsound (self.origin, "ambience/wind2.wav", 1, ATTN_STATIC);
+ //--------------------------------------------------------------
+ void() ambient_wind2 =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "ambient_wind2";
+ this.classtype = CT_MISC_AMBIENT_WIND2;
+ ambient_sound_wind2 (this.origin);
+ };
};

/////////////////////////////////////////////////////////////
@@ -221,22 +378,10 @@ void() ambient_wind2 =

// The original ambient_thunder was included in Quake but the code was missing.
// This version is borrowed from the Zerstörer mod but modified to only play the
-// original thumder1.wav included in the game. This is also different than the
-// other ambient sounds as it plays back randomly as opposed to looping. You
+// original thunder1.wav included in the game. This is also different than the
+// other ambient sounds as it plays back randomly as opposed to looping. You
// only need one of these in your level. It will play everywhere.

-//----------------------------------------------------------------------
-void() thunder_go_boom =
-{
- if (random() < 0.5)
- sound (self, CHAN_AUTO, "ambience/thunder1.wav", 0.7, ATTN_NONE);
- else
- sound (self, CHAN_AUTO, "ambience/thunder1.wav", 1, ATTN_NONE);
-
- self.think = thunder_go_boom;
- self.nextthink = time + 40 * random ();
-};
-
/*QUAKED ambient_thunder (0.3 0.1 0.6) (-10 -10 -8) (10 10 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
The original ambient_thunder was included in Quake but the code was missing.
This version is borrowed from the Zerstörer mod but modified to only play the
@@ -244,16 +389,37 @@ original thumder1.wav included in the game. This is also different than the
other ambient sounds as it plays back randomly as opposed to looping. You
only need one of these in your level. It will play everywhere.
*/
-void() ambient_thunder =
+class ambient_thunder: base_ambient_sound
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- // changed from ambient to delayed sound (sounds better)
- precache_sound ("ambience/thunder1.wav");
- // this file in not included in the game
- // precache_sound ("ambience/thunder2.wav");
- self.think = thunder_go_boom;
- self.nextthink = time + random ();
+ //--------------------------------------------------------------
+ virtual void() thunder_go_boom =
+ {
+ if (random() < 0.5)
+ sound (this, CHAN_AUTO, SND_AMBIENTHUNDER,
+ 0.7, ATTN_NONE);
+ else
+ sound (this, CHAN_AUTO, SND_AMBIENTHUNDER,
+ 1, ATTN_NONE);
+
+ this.think = thunder_go_boom;
+ this.nextthink = time + 40 * random ();
+ };
+
+ //--------------------------------------------------------------
+ void() ambient_thunder =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "ambient_thunder";
+ this.classtype = CT_MISC_AMBIENT_THUNDER;
+
+ // changed from ambient to delayed sound (sounds better)
+ precache_sound (SND_AMBIENTHUNDER);
+ // this file in not included in the game
+ // precache_sound ("ambience/thunder2.wav");
+ this.think = thunder_go_boom;
+ this.nextthink = time + random ();
+ };
};

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

Diff qc/misc/deadstuff.qc

diff --git a/qc/misc/deadstuff.qc b/qc/misc/deadstuff.qc
index 3bfbd42..d91fd69 100644
--- a/qc/misc/deadstuff.qc
+++ b/qc/misc/deadstuff.qc
@@ -11,25 +11,31 @@
model ("progs/h_demon.mdl");
}
*/
-void() gib_head_demon =
+class gib_head_demon: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/h_demon.mdl");
- setmodel (self, "progs/h_demon.mdl");
- self.frame = 0;
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize(self,'-13.64 -16.77 -0.11','17.44 16.22 30');
- }
- else
+ //--------------------------------------------------------------
+ void() gib_head_demon =
{
- self.solid = SOLID_NOT;
- }
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "gib_head_demon";
+ this.classtype = CT_GIB_HEAD_DEMON;
+ precache_model ("progs/h_demon.mdl");
+ setmodel (this, "progs/h_demon.mdl");
+ this.frame = 0;
+
+ if (this.spawnflags & 1)
+ {
+ this.solid = SOLID_BBOX;
+ setsize (this,'-13.64 -16.77 -0.11','17.44 16.22 30');
+ }
+ else
+ {
+ this.solid = SOLID_NOT;
+ }
+ };
};

/*QUAKED gib_head_dog (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
@@ -37,25 +43,31 @@ void() gib_head_demon =
model ("progs/h_dog.mdl");
}
*/
-void() gib_head_dog =
+class gib_head_dog: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/h_dog.mdl");
- setmodel (self, "progs/h_dog.mdl");
- self.frame = 0; // was 1 -- dumptruck_ds
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize (self,'-9.66 -11.89 -0.2','6.57 7.96 13.29');
- }
- else
+ //--------------------------------------------------------------
+ void() gib_head_dog =
{
- self.solid = SOLID_NOT;
- }
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "gib_head_dog";
+ this.classtype = CT_GIB_HEAD_DOG;
+ precache_model ("progs/h_dog.mdl");
+ setmodel (this, "progs/h_dog.mdl");
+ this.frame = 0; // was 1 -- dumptruck_ds
+
+ if (this.spawnflags & 1)
+ {
+ this.solid = SOLID_BBOX;
+ setsize (this,'-9.66 -11.89 -0.2','6.57 7.96 13.29');
+ }
+ else
+ {
+ this.solid = SOLID_NOT;
+ }
+ };
};

/*QUAKED gib_head_army (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
@@ -63,75 +75,91 @@ void() gib_head_dog =
model ("progs/h_guard.mdl");
}
*/
-void() gib_head_army =
+class gib_head_army: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/h_guard.mdl");
- setmodel (self, "progs/h_guard.mdl");
- self.frame = 0;
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize (self,'-9.67 -8.27 -0.28','4.05 4.8 13.41');
- }
- else
+ //--------------------------------------------------------------
+ void() gib_head_army =
{
- self.solid = SOLID_NOT;
- }
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/h_guard.mdl");
+ setmodel (this, "progs/h_guard.mdl");
+ this.frame = 0;
+
+ if (this.spawnflags & 1)
+ {
+ this.solid = SOLID_BBOX;
+ setsize (this,'-9.67 -8.27 -0.28','4.05 4.8 13.41');
+ }
+ else
+ {
+ this.solid = SOLID_NOT;
+ }
+ };
};

/*QUAKED gib_head_hell_knight (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ("progs/h_hellkn.mdl");
}*/
-void() gib_head_hell_knight =
+class gib_head_hell_knight: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/h_hellkn.mdl");
- setmodel (self, "progs/h_hellkn.mdl");
- self.frame = 0;
-
- if (self.spawnflags & 1)
+ //--------------------------------------------------------------
+ void() gib_head_hell_knight =
{
- self.solid = SOLID_BBOX;
- setsize (self,'-7.9 -12.97 -0.63','10.55 8.87 21.06');
- }
- else
- {
- self.solid = SOLID_NOT;
- }
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "gib_head_hell_knight";
+ this.classtype = CT_GIB_HEAD_HELL_KNIGHT;
+ precache_model ("progs/h_hellkn.mdl");
+ setmodel (this, "progs/h_hellkn.mdl");
+ this.frame = 0;
+
+ if (this.spawnflags & 1)
+ {
+ this.solid = SOLID_BBOX;
+ setsize (this,'-7.9 -12.97 -0.63','10.55 8.87 21.06');
+ }
+ else
+ {
+ this.solid = SOLID_NOT;
+ }
+ };
};

/*QUAKED gib_head_knight (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ("progs/h_knight.mdl");
}*/
-void() gib_head_knight =
+class gib_head_knight: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/h_knight.mdl");
- setmodel (self, "progs/h_knight.mdl");
- self.frame = 0;
-
- if (self.spawnflags & 1)
+ //--------------------------------------------------------------
+ void() gib_head_knight =
{
- self.solid = SOLID_BBOX;
- setsize (self,'-8.17 -7.47 -0.13','8.36 6.5 30');
- }
- else
- {
- self.solid = SOLID_NOT;
- }
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "gib_head_knight";
+ this.classtype = CT_GIB_HEAD_KNIGHT;
+ precache_model ("progs/h_knight.mdl");
+ setmodel (this, "progs/h_knight.mdl");
+ this.frame = 0;
+
+ if (this.spawnflags & 1)
+ {
+ this.solid = SOLID_BBOX;
+ setsize (this,'-8.17 -7.47 -0.13','8.36 6.5 30');
+ }
+ else
+ {
+ this.solid = SOLID_NOT;
+ }
+ };
};

/*QUAKED gib_head_enforcer (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
@@ -139,223 +167,277 @@ void() gib_head_knight =
model ("progs/h_mega.mdl");
}
*/
-void() gib_head_enforcer =
+class gib_head_enforcer: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/h_mega.mdl");
- setmodel (self, "progs/h_mega.mdl");
- self.frame = 0;
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize (self,'-10.63 -10.23 -0.05','9.27 8.25 30');
- }
- else
+ //--------------------------------------------------------------
+ void() gib_head_enforcer =
{
- self.solid = SOLID_NOT;
- }
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "gib_head_enforcer";
+ this.classtype = CT_GIB_HEAD_ENFORCER;
+ precache_model ("progs/h_mega.mdl");
+ setmodel (this, "progs/h_mega.mdl");
+ this.frame = 0;
+
+ if (this.spawnflags & 1)
+ {
+ this.solid = SOLID_BBOX;
+ setsize (this,'-10.63 -10.23 -0.05','9.27 8.25 30');
+ }
+ else
+ {
+ this.solid = SOLID_NOT;
+ }
+ };
};

/*QUAKED gib_head_ogre (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ("progs/h_ogre.mdl");
}*/
-void() gib_head_ogre =
+class gib_head_ogre: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/h_ogre.mdl");
- setmodel (self, "progs/h_ogre.mdl");
- self.frame = 0;
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize (self,'-12.35 -15.7 -0.17','10.67 13.88 30');
- }
- else
+ //--------------------------------------------------------------
+ void() gib_head_ogre =
{
- self.solid = SOLID_NOT;
- }
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "gib_head_ogre";
+ this.classtype = CT_GIB_HEAD_OGRE;
+ precache_model ("progs/h_ogre.mdl");
+ setmodel (this, "progs/h_ogre.mdl");
+ this.frame = 0;
+
+ if (this.spawnflags & 1)
+ {
+ this.solid = SOLID_BBOX;
+ setsize (this,'-12.35 -15.7 -0.17','10.67 13.88 30');
+ }
+ else
+ {
+ this.solid = SOLID_NOT;
+ }
+ };
};

/*QUAKED gib_head_player (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ("progs/h_player.mdl");
}*/
-void() gib_head_player =
+class gib_head_player: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/h_player.mdl");
- setmodel (self, "progs/h_player.mdl");
- self.frame = 0;
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize (self,'-9.67 -12.38 -2.1','11.49 50.7 30');
- }
- else
+ //--------------------------------------------------------------
+ void() gib_head_player =
{
- self.solid = SOLID_NOT;
- }
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "gib_head_player";
+ this.classtype = CT_GIB_HEAD_PLAYER;
+ precache_model ("progs/h_player.mdl");
+ setmodel (this, "progs/h_player.mdl");
+ this.frame = 0;
+
+ if (this.spawnflags & 1)
+ {
+ this.solid = SOLID_BBOX;
+ setsize (this,'-9.67 -12.38 -2.1','11.49 50.7 30');
+ }
+ else
+ {
+ this.solid = SOLID_NOT;
+ }
+ };
};

/*QUAKED gib_head_shalrath (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ("progs/h_shal.mdl");
}*/
-void() gib_head_shalrath =
+class gib_head_shalrath: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/h_shal.mdl");
- setmodel (self, "progs/h_shal.mdl");
- self.frame = 0;
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize (self,'-19.85 -19.09 -1.44','13.72 16.8 30');
- }
- else
+ //--------------------------------------------------------------
+ void() gib_head_shalrath =
{
- self.solid = SOLID_NOT;
- }
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "gib_head_shalrath";
+ this.classtype = CT_GIB_HEAD_SHALRATH;
+ precache_model ("progs/h_shal.mdl");
+ setmodel (this, "progs/h_shal.mdl");
+ this.frame = 0;
+
+ if (this.spawnflags & 1)
+ {
+ this.solid = SOLID_BBOX;
+ setsize (this,'-19.85 -19.09 -1.44','13.72 16.8 30');
+ }
+ else
+ {
+ this.solid = SOLID_NOT;
+ }
+ };
};

/*QUAKED gib_head_shambler (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ("progs/h_shams.mdl");
}*/
-void() gib_head_shambler =
+class gib_head_shambler: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/h_shams.mdl");
- setmodel (self, "progs/h_shams.mdl");
- self.frame = 0; // was 1, caused an error -- dumptruck_ds
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize (self,'-15.15 -20.638 -0.45','21.44 21.76 30');
- }
- else
+ //--------------------------------------------------------------
+ void() gib_head_shambler =
{
- self.solid = SOLID_NOT;
- }
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "gib_head_shambler";
+ this.classtype = CT_GIB_HEAD_SHAMBLER;
+ precache_model ("progs/h_shams.mdl");
+ setmodel (this, "progs/h_shams.mdl");
+ this.frame = 0; // was 1, caused an error -- dumptruck_ds
+
+ if (this.spawnflags & 1)
+ {
+ this.solid = SOLID_BBOX;
+ setsize (this,'-15.15 -20.638 -0.45','21.44 21.76 30');
+ }
+ else
+ {
+ this.solid = SOLID_NOT;
+ }
+ };
};

/*QUAKED gib_head_wizard (0 0.5 0.8) (-16 -16 0) (16 16 56) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ("progs/h_wizard.mdl");
}*/
-void() gib_head_wizard =
+class gib_head_wizard: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/h_wizard.mdl");
- setmodel (self, "progs/h_wizard.mdl");
- self.frame = 0;
-
- if (self.spawnflags & 1)
+ //--------------------------------------------------------------
+ void() gib_head_wizard =
{
- self.solid = SOLID_BBOX;
- setsize (self,'-10.41 -8.66 -0.54','6.52 10.82 30');
- }
- else
- {
- self.solid = SOLID_NOT;
- }
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "gib_head_wizard";
+ this.classtype = CT_GIB_HEAD_WIZARD;
+ precache_model ("progs/h_wizard.mdl");
+ setmodel (this, "progs/h_wizard.mdl");
+ this.frame = 0;
+
+ if (this.spawnflags & 1)
+ {
+ this.solid = SOLID_BBOX;
+ setsize (this,'-10.41 -8.66 -0.54','6.52 10.82 30');
+ }
+ else
+ {
+ this.solid = SOLID_NOT;
+ }
+ };
};

/*QUAKED gib_misc_1 (0 0.5 0.8) (-8 -8 -8) (8 8 8) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ("progs/gib1.mdl");
}*/
-void() gib_misc_1 =
+class gib_misc_1: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/gib1.mdl");
- setmodel (self, "progs/gib1.mdl");
- self.frame = 0;
-
- if (self.spawnflags & 1)
+ //--------------------------------------------------------------
+ void() gib_misc_1 =
{
- self.solid = SOLID_BBOX;
- setsize (self,'-3.57 -8.06 -3.34','3.69 8.31 30');
- }
- else
- {
- self.solid = SOLID_NOT;
- }
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "gib_misc_1";
+ this.classtype = CT_GIB_MISC_1;
+ precache_model ("progs/gib1.mdl");
+ setmodel (this, "progs/gib1.mdl");
+ this.frame = 0;
+
+ if (this.spawnflags & 1)
+ {
+ this.solid = SOLID_BBOX;
+ setsize (this,'-3.57 -8.06 -3.34','3.69 8.31 30');
+ }
+ else
+ {
+ this.solid = SOLID_NOT;
+ }
+ };
};

/*QUAKED gib_misc_2 (0 0.5 0.8) (-8 -8 -8) (8 8 8) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ("progs/gib2.mdl");
}*/
-void() gib_misc_2 =
+class gib_misc_2: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/gib2.mdl");
- setmodel (self, "progs/gib2.mdl");
- self.frame = 0;
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize (self,'-12.68 -14.83 -6.19','13.53 14.57 30');
- }
- else
+ //--------------------------------------------------------------
+ void() gib_misc_2 =
{
- self.solid = SOLID_NOT;
- }
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "gib_misc_2";
+ this.classtype = CT_GIB_MISC_2;
+ precache_model ("progs/gib2.mdl");
+ setmodel (this, "progs/gib2.mdl");
+ this.frame = 0;
+
+ if (this.spawnflags & 1)
+ {
+ this.solid = SOLID_BBOX;
+ setsize (this,'-12.68 -14.83 -6.19','13.53 14.57 30');
+ }
+ else
+ {
+ this.solid = SOLID_NOT;
+ }
+ };
};

/*QUAKED gib_misc_3 (0 0.5 0.8) (-8 -8 -8) (8 8 8) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ("progs/gib3.mdl");
}*/
-void() gib_misc_3 =
+class gib_misc_3: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/gib3.mdl");
- setmodel (self, "progs/gib3.mdl");
- self.frame = 0;
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize (self,'-18.95 -15.92 -3.13','13.17 15.66 30');
- }
- else
+ //--------------------------------------------------------------
+ void() gib_misc_3 =
{
- self.solid = SOLID_NOT;
- }
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "gib_misc_3";
+ this.classtype = CT_GIB_MISC_3;
+ precache_model ("progs/gib3.mdl");
+ setmodel (this, "progs/gib3.mdl");
+ this.frame = 0;
+
+ if (this.spawnflags & 1)
+ {
+ this.solid = SOLID_BBOX;
+ setsize (this,'-18.95 -15.92 -3.13','13.17 15.66 30');
+ }
+ else
+ {
+ this.solid = SOLID_NOT;
+ }
+ };
};

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

Diff qc/misc/explobox.qc

diff --git a/qc/misc/explobox.qc b/qc/misc/explobox.qc
index 9fff181..dd3f8c5 100644
--- a/qc/misc/explobox.qc
+++ b/qc/misc/explobox.qc
@@ -3,17 +3,20 @@
//==============================================================================

//----------------------------------------------------------------------
-void() barrel_explode =
+class base_explobox: entity
{
- self.takedamage = DAMAGE_NO;
- self.classname = "explo_box";
- // did say self.owner
- T_RadiusDamage (self, self, 160, world);
- sound (self, CHAN_VOICE, "weapons/r_exp3.wav", 1, ATTN_NORM);
- particle (self.origin, '0 0 0', 75, 255);
+ virtual void() barrel_explode =
+ {
+ this.takedamage = DAMAGE_NO;
+ this.classname = "explo_box";
+ // did say this.owner
+ T_RadiusDamage (this, this, 160, world);
+ sound (this, CHAN_VOICE, "weapons/r_exp3.wav", 1, ATTN_NORM);
+ particle (this.origin, '0 0 0', 75, 255);

- self.origin_z = self.origin_z + 32;
- BecomeExplosion ();
+ this.origin_z = this.origin_z + 32;
+ BecomeExplosion ();
+ };
};

/*QUAKED misc_explobox (0 .5 .8) (0 0 0) (32 32 64) 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
@@ -22,36 +25,42 @@ void() barrel_explode =
}
Explosive box
*/
-void() misc_explobox =
+class misc_explobox: base_explobox
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ //--------------------------------------------------------------
+ void() misc_explobox =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;

- local float oldz;
+ local float oldz;

- self.solid = SOLID_BBOX;
- self.movetype = MOVETYPE_NONE;
- precache_model ("maps/b_explob.bsp");
- setmodel (self, "maps/b_explob.bsp");
- precache_sound ("weapons/r_exp3.wav");
- self.health = 20;
- self.th_die = barrel_explode;
- self.takedamage = DAMAGE_AIM;
- // 1998-09-16 Sliding/not-jumping on monsters/boxes/players
- // fix by Maddes/Kryten
- self.touch = monster_touch;
+ this.classname = "misc_explobox";
+ this.classtype = CT_MISC_EXPLOBOX;
+ this.solid = SOLID_BBOX;
+ this.movetype = MOVETYPE_NONE;
+ precache_model ("maps/b_explob.bsp");
+ setmodel (this, "maps/b_explob.bsp");
+ precache_sound ("weapons/r_exp3.wav");
+ this.health = 20;
+ this.th_die = barrel_explode;
+ this.takedamage = DAMAGE_AIM;
+ // 1998-09-16 Sliding/not-jumping on monsters/boxes/players
+ // fix by Maddes/Kryten
+ this.touch = monster_touch;

- self.origin_z = self.origin_z + 2;
- oldz = self.origin_z;
- droptofloor ();
- if (oldz - self.origin_z > 250)
- {
- dprint ("item fell out of level at ");
- dprint (vtos(self.origin));
- dprint ("\n");
- remove (self);
- }
+ this.origin_z = this.origin_z + 2;
+ oldz = this.origin_z;
+ droptofloor ();
+ if (oldz - this.origin_z > 250)
+ {
+ dprint ("item fell out of level at ");
+ dprint (vtos(this.origin));
+ dprint ("\n");
+ remove (this);
+ }
+ };
};

/*QUAKED misc_explobox2 (0 .5 .8) (0 0 0) (32 32 64) 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
@@ -60,34 +69,40 @@ void() misc_explobox =
}
Smaller explosive box
*/
-void() misc_explobox2 =
+class misc_explobox2: base_explobox
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ //--------------------------------------------------------------
+ void() misc_explobox2 =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;

- local float oldz;
+ local float oldz;

- self.solid = SOLID_BBOX;
- self.movetype = MOVETYPE_NONE;
- precache_model2 ("maps/b_exbox2.bsp");
- setmodel (self, "maps/b_exbox2.bsp");
- precache_sound ("weapons/r_exp3.wav");
- self.health = 20;
- self.th_die = barrel_explode;
- self.takedamage = DAMAGE_AIM;
- // 1998-09-16 Sliding/not-jumping on monsters/boxes/players
- // fix by Maddes/Kryten
- self.touch = monster_touch;
+ this.classname = "misc_explobox2";
+ this.classtype = CT_MISC_EXPLOBOX2;
+ this.solid = SOLID_BBOX;
+ this.movetype = MOVETYPE_NONE;
+ precache_model2 ("maps/b_exbox2.bsp");
+ setmodel (this, "maps/b_exbox2.bsp");
+ precache_sound ("weapons/r_exp3.wav");
+ this.health = 20;
+ this.th_die = barrel_explode;
+ this.takedamage = DAMAGE_AIM;
+ // 1998-09-16 Sliding/not-jumping on monsters/boxes/players
+ // fix by Maddes/Kryten
+ this.touch = monster_touch;

- self.origin_z = self.origin_z + 2;
- oldz = self.origin_z;
- droptofloor ();
- if (oldz - self.origin_z > 250)
- {
- dprint ("item fell out of level at ");
- dprint (vtos(self.origin));
- dprint ("\n");
- remove (self);
- }
+ this.origin_z = this.origin_z + 2;
+ oldz = this.origin_z;
+ droptofloor ();
+ if (oldz - this.origin_z > 250)
+ {
+ dprint ("item fell out of level at ");
+ dprint (vtos(this.origin));
+ dprint ("\n");
+ remove (this);
+ }
+ };
};

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

Diff qc/misc/fireball.qc

diff --git a/qc/misc/fireball.qc b/qc/misc/fireball.qc
index 39427e1..52de1b6 100644
--- a/qc/misc/fireball.qc
+++ b/qc/misc/fireball.qc
@@ -2,60 +2,64 @@
// misc_fireball
//==============================================================================

-// prototypes
-void() fire_fly;
-void() fire_touch;
-
/*QUAKED misc_fireball (0 .5 .8) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model ("progs/lavaball.mdl"); }
Flying lava balls
speed - set vertical speed of fireballs. default 1000.
*/
-void() misc_fireball =
+class misc_fireball: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ //--------------------------------------------------------------
+ virtual void() fire_touch =
+ {
+ T_Damage (other, this, this, 20);
+ remove (this);
+ };
+ //--------------------------------------------------------------
+ nonvirtual void() fire_fly =
+ {
+ local entity fireball;

- precache_model ("progs/lavaball.mdl");
- self.classname = "fireball";
- // 1998-08-14 Incorrect setting of nextthink fix by Maddes/Lord Sméagol
- // self.nextthink = time + (random() * 5);
- self.nextthink = time + 0.1 + (random() * 5);
- // 1998-08-14 Incorrect setting of nextthink fix by Maddes/Lord Sméagol
- self.think = fire_fly;
- if (!self.speed)
- // fixed typo QIP - dumptruck_ds
- self.speed = 1000;
-};
+ fireball = spawn ();
+ fireball.solid = SOLID_TRIGGER;
+ fireball.movetype = MOVETYPE_TOSS;
+ fireball.velocity = '0 0 1000';
+ fireball.velocity_x = (random() * 100) - 50;
+ fireball.velocity_y = (random() * 100) - 50;
+ fireball.velocity_z = this.speed + (random() * 200);
+ fireball.classname = "fireball";
+ setmodel (fireball, "progs/lavaball.mdl");
+ setsize (fireball, '0 0 0', '0 0 0');
+ setorigin (fireball, this.origin);
+ fireball.nextthink = time + 5;
+ fireball.think = SUB_Remove;
+ fireball.touch = fire_touch;

-//----------------------------------------------------------------------
-void() fire_fly =
-{
- local entity fireball;
+ this.nextthink = time + (random() * 5) + 3;
+ this.think = fire_fly;
+ };

- fireball = spawn ();
- fireball.solid = SOLID_TRIGGER;
- fireball.movetype = MOVETYPE_TOSS;
- fireball.velocity = '0 0 1000';
- fireball.velocity_x = (random() * 100) - 50;
- fireball.velocity_y = (random() * 100) - 50;
- fireball.velocity_z = self.speed + (random() * 200);
- fireball.classname = "fireball";
- setmodel (fireball, "progs/lavaball.mdl");
- setsize (fireball, '0 0 0', '0 0 0');
- setorigin (fireball, self.origin);
- fireball.nextthink = time + 5;
- fireball.think = SUB_Remove;
- fireball.touch = fire_touch;
+ //--------------------------------------------------------------
+ void() misc_fireball =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;

- self.nextthink = time + (random() * 5) + 3;
- self.think = fire_fly;
-};
+ this.classname = "fireball";
+ // this.classname = "misc_fireball";
+ this.classtype = CT_MISC_FIREBALL;
+ precache_model ("progs/lavaball.mdl");
+ // 1998-08-14 Incorrect setting of nextthink fix
+ // by Maddes/Lord Sméagol
+ // this.nextthink = time + (random() * 5);
+ this.nextthink = time + 0.1 + (random() * 5);
+ // 1998-08-14 Incorrect setting of nextthink fix
+ // by Maddes/Lord Sméagol
+ this.think = fire_fly;
+ if (!this.speed)
+ // fixed typo QIP - dumptruck_ds
+ this.speed = 1000;
+ };

-//----------------------------------------------------------------------
-void() fire_touch =
-{
- T_Damage (other, self, self, 20);
- remove (self);
};

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

Diff qc/misc/infight.qc

diff --git a/qc/misc/infight.qc b/qc/misc/infight.qc
index 24f16cb..bac87ad 100644
--- a/qc/misc/infight.qc
+++ b/qc/misc/infight.qc
@@ -14,107 +14,117 @@
//======================================================================

// constants
-float INFIGHT_MUTUAL = 1;
-float INFIGHT_PLAYER_ACTIVATION = 2;
+const float INFIGHT_MUTUAL = 1;
+const float INFIGHT_PLAYER_ACTIVATION = 2;

-//----------------------------------------------------------------------
-void(entity t1, entity t2) make_angry_at =
+class misc_infight: entity
{
- // checks if targets are alive
- if (t2.health > 0 && t1.health > 0)
+ //--------------------------------------------------------------
+ nonvirtual void(entity t1, entity t2) make_angry_at =
{
- if (t1.enemy.classname == "player")
- t1.oldenemy = t1.enemy;
- t1.enemy = t2;
-
- entity oself = self;
- // FoundTarget () only acts on self
- self = t1;
- FoundTarget ();
- self = oself;
- }
-};
+ // checks if targets are alive
+ if (t2.health > 0 && t1.health > 0)
+ {
+ if (t1.enemy.classtype == CT_PLAYER)
+ t1.oldenemy = t1.enemy;
+ t1.enemy = t2;

-//----------------------------------------------------------------------
-void() misc_infight_use =
-{
- local entity t1, t2;
+ // TODO CEV need to rework; this/self/FoundTarget
+ // FoundTarget () only acts on self
+ FoundTargetForEntity (t1);
+ }
+ };

- for (t1 = world; (t1 = find (t1, targetname, self.target)); )
+ //--------------------------------------------------------------
+ virtual void() misc_infight_use =
{
- for (t2 = world; (t2 = find (t2, targetname, self.target2)); )
+ local entity t1, t2;
+
+ for (t1 = world; (t1 = find (t1, ::targetname, this.target)); )
{
- // t1 = find(world, targetname, self.target);
- // t2 = find(world, targetname, self.target2);
- if (!t1)
- {
- dprint ("[trigger_infight] Cannot find target, "
- "checking targetname2\n");
- t1 = find (world, targetname2, self.target);
- }
- if (!t1)
- {
- dprint ("[trigger_infight] Cannot find target, "
- "checking targetname3\n");
- t1 = find (world, targetname3, self.target);
- }
- if (!t1)
- {
- dprint ("[trigger_infight] Cannot find target, "
- "checking targetname4\n");
- t1 = find (world, targetname4, self.target);
- }
- if (!t1)
- {
- dprint ("[trigger_infight] Cannot find target, "
- "exhausted all targetnames\n");
- return;
- }
- if (!t2)
+ for (t2 = world;
+ (t2 = find (t2, ::targetname, this.target2)); )
{
- dprint ("[trigger_infight] Cannot find target2 "
- "checking targetname2\n");
- t2 = find (world, targetname2, self.target2);
- }
- if (!t2)
- {
- dprint ("[trigger_infight] Cannot find target2 "
- "checking targetname3\n");
- t2 = find (world, targetname3, self.target2);
- }
- if (!t2)
- {
- dprint ("[trigger_infight] Cannot find target2 "
- "checking targetname4\n");
- t2 = find (world, targetname4, self.target2);
- }
- if (!t2)
- {
- dprint ("[trigger_infight] Cannot find target2,"
- " exhausted all targetnames\n");
- return;
- }
+ // t1 = find(world, ::targetname, this.target);
+ // t2 = find(world, ::targetname, this.target2);
+ if (!t1)
+ {
+ dprint ("misc_infight_use: Cannot find "
+ "target, trying targetname2\n");
+ t1 = find (world, ::targetname2,
+ this.target);
+ }
+ if (!t1)
+ {
+ dprint ("misc_infight_use: Cannot find "
+ "target, trying targetname3\n");
+ t1 = find (world, ::targetname3,
+ this.target);
+ }
+ if (!t1)
+ {
+ dprint ("misc_infight_use: Cannot find "
+ "target, trying targetname4\n");
+ t1 = find (world, ::targetname4,
+ this.target);
+ }
+ if (!t1)
+ {
+ dprint ("misc_infight_use: Cannot find "
+ "target, out of targetnames\n");
+ return;
+ }
+ if (!t2)
+ {
+ dprint ("misc_infight_use: Cannot find "
+ "target2 trying targetname2\n");
+ t2 = find (world, ::targetname2,
+ this.target2);
+ }
+ if (!t2)
+ {
+ dprint ("misc_infight_use: Cannot find "
+ "target2 trying targetname3\n");
+ t2 = find (world, ::targetname3,
+ this.target2);
+ }
+ if (!t2)
+ {
+ dprint ("misc_infight_use: Cannot find "
+ "target2 trying targetname4\n");
+ t2 = find (world, ::targetname4,
+ this.target2);
+ }
+ if (!t2)
+ {
+ dprint ("misc_infight_use: Cannot find "
+ "target2 out of targetnames\n");
+ return;
+ }

- make_angry_at (t1, t2);
+ make_angry_at (t1, t2);

- if (self.spawnflags & INFIGHT_PLAYER_ACTIVATION)
- {
- t1.infight_activator = activator;
- t2.infight_activator = activator;
- }
+ if (this.spawnflags & INFIGHT_PLAYER_ACTIVATION)
+ {
+ t1.infight_activator = activator;
+ t2.infight_activator = activator;
+ }

- if (self.spawnflags & INFIGHT_MUTUAL)
- make_angry_at (t2, t1);
+ if (this.spawnflags & INFIGHT_MUTUAL)
+ make_angry_at (t2, t1);
+ }
}
- }
-};
+ };

-//----------------------------------------------------------------------
-void() misc_infight =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ //--------------------------------------------------------------
+ void() misc_infight =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;

- self.use = misc_infight_use;
+ this.classname = "misc_infight";
+ this.classtype = CT_MISC_INFIGHT;
+ this.use = misc_infight_use;
+ };
};

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

Diff qc/misc/light_candle.qc

diff --git a/qc/misc/light_candle.qc b/qc/misc/light_candle.qc
index 4d42ea1..d7ee158 100644
--- a/qc/misc/light_candle.qc
+++ b/qc/misc/light_candle.qc
@@ -114,34 +114,42 @@ _anglescale => _anglescale
//dumptruck_ds taken from honey (originally from Rogue)
White candle
*/
-void() light_candle =
+class light_candle: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/candle.mdl");
- setmodel (self, "progs/candle.mdl");
- makestatic (self);
-};
-
-//----------------------------------------------------------------------
-void() model_candle_think =
-{
- self.frame = self.frame + 1;
- if (self.frame > 3)
- self.frame = 0;
- self.nextthink = time + 0.1;
-};
-
-//----------------------------------------------------------------------
-void() model_candle =
-{
-
- precache_model ("progs/candle.mdl");
-
- setmodel (self, "progs/candle.mdl");
-
- self.think = model_candle_think;
- self.nextthink = time + 0.1;
+ // the following block of code doesn't seem to be used anywhere -- CEV
+ /*
+ //--------------------------------------------------------------
+ void() model_candle_think =
+ {
+ this.frame = this.frame + 1;
+ if (this.frame > 3)
+ this.frame = 0;
+ this.nextthink = time + 0.1;
+ };
+
+ //--------------------------------------------------------------
+ void() model_candle =
+ {
+ precache_model ("progs/candle.mdl");
+
+ setmodel (this, "progs/candle.mdl");
+
+ this.think = model_candle_think;
+ this.nextthink = time + 0.1;
+ };
+ */
+
+ //--------------------------------------------------------------
+ void() light_candle =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "light_candle";
+ this.classtype = CT_LIGHT_CANDLE;
+ precache_model ("progs/candle.mdl");
+ setmodel (this, "progs/candle.mdl");
+ makestatic (this);
+ };
};

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

Diff qc/misc/lights.qc

diff --git a/qc/misc/lights.qc b/qc/misc/lights.qc
index 4680ec0..5f0ebe2 100644
--- a/qc/misc/lights.qc
+++ b/qc/misc/lights.qc
@@ -3,36 +3,9 @@
//==============================================================================

// constants
-const float START_OFF = 1;
-const float FADE_IN_OUT = 2;
-const float SILENT_TORCH = 4; // for silent torch -- dumptruck_ds
-
-// prototypes
-void() FireAmbient;
-
-/*QUAKED info_null (0 0.5 0) (-4 -4 -4) (4 4 4) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-
-Used as a positional target for spotlights, etc.
-*/
-void() info_null =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- remove (self);
-};
-
-/*QUAKED info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-
-Never used in the or
-*/
-void() info_notnull =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-};
+const float LIGHT_START_OFF = 1;
+const float LIGHT_FADE_IN_OUT = 2;
+const float LIGHT_SILENT_TORCH = 4; // for silent torch -- dumptruck_ds

//----------------------------------------------------------------------
// lightstyle_lookup
@@ -142,76 +115,114 @@ string(float num) lightstyle_fade_lookup =
}
};

-//----------------------------------------------------------------------
-// light_fade_in
-//----------------------------------------------------------------------
-void() light_fade_in =
+class base_light: entity
{
- if (self.count < 0)
- self.count = 0;
- if (self.count > 12)
- self.count = 12;
-
- lightstyle (self.style, lightstyle_fade_lookup(self.count));
- self.count = self.count + 1;
- if (self.count > 12)
- return;
-
- self.think = light_fade_in;
- self.nextthink = time + self.speed;
-};
-
-//----------------------------------------------------------------------
-// light_fade_out
-//----------------------------------------------------------------------
-void() light_fade_out =
-{
- if (self.count < 0)
- self.count = 0;
- if (self.count > 12)
- self.count = 12;
-
- lightstyle (self.style, lightstyle_fade_lookup(self.count));
- self.count = self.count - 1;
- if (self.count < 0)
- return;
-
- self.think = light_fade_out;
- self.nextthink = time + self.speed;
-};
-
-//----------------------------------------------------------------------
-// light_use -- using a light will turn it on and off
-//----------------------------------------------------------------------
-void() light_use =
-{
- if (self.spawnflags & START_OFF)
+ //--------------------------------------------------------------
+ // light_fade_in
+ //--------------------------------------------------------------
+ nonvirtual void() light_fade_in =
+ {
+ if (this.count < 0)
+ this.count = 0;
+ if (this.count > 12)
+ this.count = 12;
+
+ lightstyle (this.style, lightstyle_fade_lookup(this.count));
+ this.count = this.count + 1;
+ if (this.count > 12)
+ return;
+
+ this.think = light_fade_in;
+ this.nextthink = time + this.speed;
+ };
+
+ //--------------------------------------------------------------
+ // light_fade_out
+ //--------------------------------------------------------------
+ nonvirtual void() light_fade_out =
{
- self.spawnflags = self.spawnflags - START_OFF;
- if (self.spawnflags & FADE_IN_OUT && !self.style2)
- light_fade_in ();
+ if (this.count < 0)
+ this.count = 0;
+ if (this.count > 12)
+ this.count = 12;
+
+ lightstyle (this.style, lightstyle_fade_lookup(this.count));
+ this.count = this.count - 1;
+ if (this.count < 0)
+ return;
+
+ this.think = light_fade_out;
+ this.nextthink = time + this.speed;
+ };
+
+ //--------------------------------------------------------------
+ // light_use -- using a light will turn it on and off
+ //--------------------------------------------------------------
+ nonvirtual void() light_use =
+ {
+ if (this.spawnflags & LIGHT_START_OFF)
+ {
+ this.spawnflags = this.spawnflags - LIGHT_START_OFF;
+ if (this.spawnflags & LIGHT_FADE_IN_OUT && !this.style2)
+ light_fade_in ();
+ else
+ lightstyle (this.style,
+ lightstyle_lookup(this.style2));
+ }
else
- lightstyle (self.style, lightstyle_lookup(self.style2));
- }
- else
+ {
+ this.spawnflags = this.spawnflags + LIGHT_START_OFF;
+ if (this.spawnflags & LIGHT_FADE_IN_OUT && !this.style2)
+ light_fade_out ();
+ else
+ lightstyle (this.style, "a");
+ }
+ };
+
+ //--------------------------------------------------------------
+ nonvirtual void() light_init =
{
- self.spawnflags = self.spawnflags + START_OFF;
- if (self.spawnflags & FADE_IN_OUT && !self.style2)
- light_fade_out ();
+ // default speed for fading in/out
+ if (this.speed <= 0)
+ this.speed = 0.1;
+
+ // non-switchable light
+ if (!this.targetname)
+ {
+ remove (this);
+ return;
+ }
+
+ if (this.style < 32)
+ // return now if this is not a switchable light
+ // removes one level of indentation below -- CEV
+ return;
+
+ // switchable light
+ this.use = light_use;
+ if (this.spawnflags & LIGHT_START_OFF)
+ {
+ this.count = 0;
+ lightstyle (this.style, "a");
+ }
else
- lightstyle (self.style, "a");
- }
+ {
+ this.count = 12;
+ lightstyle (this.style, lightstyle_lookup(this.style2));
+ }
+ };
};

-/*QUAKED light (0 1 0) (-8 -8 -8) (8 8 8) START_OFF FADE_IN_OUT X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+
+/*QUAKED light (0 1 0) (-8 -8 -8) (8 8 8) LIGHT_START_OFF LIGHT_FADE_IN_OUT X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY

Light

==========
Spawnflags
==========
-START_OFF - switchable lights only - light is off by default
-FADE_IN_OUT - switchable lights only - light fades in and out. can't be combined with animated lights.
+LIGHT_START_OFF - switchable lights only - light is off by default
+LIGHT_FADE_IN_OUT - switchable lights only - light fades in and out. can't be combined with animated lights.

==========
Keys
@@ -259,7 +270,7 @@ Specifies the angle in degrees for an inner spotlight cone (must be less than th
Turns the light into a switchable light, toggled by another entity targeting it�s name.

"speed" "n"
-If the light is switchable and FADE_IN_OUT is set, the speed at which the light transitions. Default 0.1.
+If the light is switchable and LIGHT_FADE_IN_OUT is set, the speed at which the light transitions. Default 0.1.

"style" "n"
Set the animated light style. Default 0.
@@ -314,57 +325,47 @@ _color => _sunlight_color
_dirt => _sunlight_dirt
_anglescale => _anglescale
*/
-void() light =
+class light: base_light
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- // default speed for fading in/out
- if (self.speed <= 0)
- self.speed = 0.1;
-
- // non-switchable light
- if (!self.targetname)
+ //--------------------------------------------------------------
+ void() light =
{
- remove (self);
- return;
- }
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;

- // switchable light
- if (self.style >= 32)
- {
- self.use = light_use;
- if (self.spawnflags & START_OFF)
- {
- self.count = 0;
- lightstyle (self.style, "a");
- }
- else
- {
- self.count = 12;
- lightstyle (self.style, lightstyle_lookup(self.style2));
- }
- }
+ this.classname = "light";
+ this.classtype = CT_LIGHT;
+
+ light_init ();
+ };
};

-/*QUAKED light_fluoro (0 1 0) (-8 -8 -8) (8 8 8) START_OFF FADE_IN_OUT X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+/*QUAKED light_fluoro (0 1 0) (-8 -8 -8) (8 8 8) LIGHT_START_OFF LIGHT_FADE_IN_OUT X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY

Non-displayed light.
Makes steady fluorescent humming sound.
See the "light" entity for a full description.
*/
-void() light_fluoro =
+class light_fluoro: base_light
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ //--------------------------------------------------------------
+ void() light_fluoro =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "light_fluoro";
+ this.classtype = CT_LIGHT_FLUORO;

- ambient_light_buzz ();
- light ();
+ // TODO CEV calling lbuzz directly
+ base_ambient_sound::ambient_sound_lbuzz (this.origin);
+ light_init ();
+ };
};

-/*QUAKED light_fluorospark (0 1 0) (-8 -8 -8) (8 8 8) START_OFF FADE_IN_OUT X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+/*QUAKED light_fluorospark (0 1 0) (-8 -8 -8) (8 8 8) LIGHT_START_OFF LIGHT_FADE_IN_OUT X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY

Non-displayed light.
Makes sparking, broken fluorescent sound.
@@ -372,16 +373,23 @@ Can't be toggled.
Default style is 10.
See the "light" entity for a full description.
*/
-void() light_fluorospark =
+class light_fluorospark: base_ambient_sound
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- if (!self.style)
- self.style = 10;
- ambient_flouro_buzz ();
- remove (self);
+ //--------------------------------------------------------------
+ void() light_fluorospark =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "light_fluorospark";
+ this.classtype = CT_LIGHT_FLUOROSPARK;
+
+ if (!this.style)
+ this.style = 10;
+ ambient_sound_fbuzz (this.origin);
+ remove (this);
+ };
};

/*QUAKED light_globe (0 1 0) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
@@ -389,15 +397,22 @@ Sphere globe light.
Can't be toggled.
See the "light" entity for a full description.
*/
-void() light_globe =
+class light_globe: base_light
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ //--------------------------------------------------------------
+ void() light_globe =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;

- precache_model ("progs/s_light.spr");
- setmodel (self, "progs/s_light.spr");
- makestatic (self);
+ this.classname = "light_globe";
+ this.classtype = CT_LIGHT_GLOBE;
+
+ precache_model ("progs/s_light.spr");
+ setmodel (this, "progs/s_light.spr");
+ makestatic (this);
+ };
};

/*QUAKED light_torch_small_walltorch (0 .5 0) (-10 -10 -20) (10 10 20) 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
@@ -405,20 +420,26 @@ void() light_globe =
Short wall torch
See the "light" entity for a full description.
*/
-void() light_torch_small_walltorch =
+class light_torch_small_walltorch: base_ambient_sound
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- // precache_model ("progs/flame.mdl");
- precache_body_model ("progs/flame.mdl");
- // setmodel (self, "progs/flame.mdl");
- body_model ("progs/flame.mdl");
- // for silent torch -- dumptruck_ds
- if !(self.spawnflags && SILENT_TORCH)
- FireAmbient ();
- makestatic (self);
+ //--------------------------------------------------------------
+ void() light_torch_small_walltorch =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "light_torch_small_walltorch";
+ this.classtype = CT_LIGHT_TORCH_SMALL_WALLTORCH;
+ // precache_model ("progs/flame.mdl");
+ precache_body_model ("progs/flame.mdl");
+ // setmodel (this, "progs/flame.mdl");
+ body_model ("progs/flame.mdl");
+ // for silent torch -- dumptruck_ds
+ if !(this.spawnflags && LIGHT_SILENT_TORCH)
+ ambient_sound_fire (this.origin);
+ makestatic (this);
+ };
};

/*QUAKED light_flame_large_yellow (0 1 0) (-10 -10 -12) (12 12 18) 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
@@ -426,17 +447,23 @@ void() light_torch_small_walltorch =
Large yellow flame
See the "light" entity for a full description.
*/
-void() light_flame_large_yellow =
+class light_flame_large_yellow: base_ambient_sound
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/flame2.mdl");
- setmodel (self, "progs/flame2.mdl");
- self.frame = 1;
- FireAmbient ();
- makestatic (self);
+ //--------------------------------------------------------------
+ void() light_flame_large_yellow =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "light_flame_large_yellow";
+ this.classtype = CT_LIGHT_FLAME_LARGE_YELLOW;
+ precache_model ("progs/flame2.mdl");
+ setmodel (this, "progs/flame2.mdl");
+ this.frame = 1;
+ ambient_sound_fire (this.origin);
+ makestatic (this);
+ };
};

/*QUAKED light_flame_small_yellow (0 1 0) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
@@ -444,16 +471,21 @@ void() light_flame_large_yellow =
Small yellow flame
See the "light" entity for a full description.
*/
-void() light_flame_small_yellow =
+class light_flame_small_yellow: base_ambient_sound
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/flame2.mdl");
- setmodel (self, "progs/flame2.mdl");
- FireAmbient ();
- makestatic (self);
+ void() light_flame_small_yellow =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "light_flame_small_yellow";
+ this.classtype = CT_LIGHT_FLAME_SMALL_YELLOW;
+ precache_model ("progs/flame2.mdl");
+ setmodel (this, "progs/flame2.mdl");
+ ambient_sound_fire (this.origin);
+ makestatic (this);
+ };
};

/*QUAKED light_flame_small_white (0 1 0) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
@@ -461,32 +493,31 @@ void() light_flame_small_yellow =
Left for compatability
Identical to "light_flame_small_yellow"
*/
-void() light_flame_small_white =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- light_flame_small_yellow ();
-};
+class light_flame_small_white: light_flame_small_yellow { };

/*QUAKED light_sprite_flame (0 1 0) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model ("progs/s_flame.spr"); }
Large flame spite*/
-void() light_sprite_flame =
+class light_sprite_flame: base_misc_model
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/s_flame.spr");
- setmodel (self, "progs/s_flame.spr");
- FireAmbient ();
-
- self.frame = rint(random() * 13);
- self.first_frame = 0;
- self.last_frame = 13;
- self.speed = 0.05;
- self.think = misc_model_think;
- self.nextthink = time + 0.1;
+ //--------------------------------------------------------------
+ void() light_sprite_flame =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/s_flame.spr");
+ setmodel (this, "progs/s_flame.spr");
+ // TODO CEV was FireAmbient (), now calling
+ // ambient_sound_fire directly
+ base_ambient_sound::ambient_sound_fire (this.origin);
+
+ this.frame = rint (random() * 13);
+ this.first_frame = 0;
+ this.last_frame = 13;
+ this.speed = 0.05;
+ this.think = misc_model_think;
+ this.nextthink = time + 0.1;
+ };
};

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

Diff qc/misc/model.qc

diff --git a/qc/misc/model.qc b/qc/misc/model.qc
index aa72143..afefc39 100644
--- a/qc/misc/model.qc
+++ b/qc/misc/model.qc
@@ -1,20 +1,11 @@
//==============================================================================
-// misc_model -- Joshua Skelton
-//==============================================================================
-
-//======================================================================
-// misc_model.qc requires math.qc
-//
+// misc_model -- Joshua Skelton -- misc_model.qc requires math.qc
// Author: Joshua Skelton joshua.skelton@gmail.com
// Edited by: Inky 20201219 Minor changes for a better integration with their
// own code
// Edited by: bmFbr for solid and gravity spawnflags and custom bbox sizes
// Edited by: dumptruck_ds to add start and stop animations
-//======================================================================
-
-// fields
-.float first_frame; // The starting frame of the animation
-.float last_frame; // The ending frame of the animation
+//==============================================================================

// constants
const float MISC_MODEL_GRAVITY = 1;
@@ -24,78 +15,88 @@ const float MISC_MODEL_ONLY_ONCE = 8;
const float MISC_MODEL_PLAY_COUNT = 16;
const float MISC_MODEL_STARTOFF = 32;

-//----------------------------------------------------------------------
-void() misc_model_use =
+class base_misc_model: entity
{
- if (self.state == STATE_ACTIVE)
- {
- if (self.spawnflags & MISC_MODEL_SOLID)
- self.solid = SOLID_NOT;
- self.model = "";
-
- self.state = STATE_INVISIBLE;
- setorigin (self, self.origin);
- }
- else
- {
- if (self.spawnflags & MISC_MODEL_SOLID)
- self.solid = SOLID_BBOX;
- self.model = self.mdl;
-
- self.state = STATE_ACTIVE;
- setorigin (self, self.origin);
- }
-};
+ // class fields
+ float first_frame; // The starting frame of the animation
+ float last_frame; // The ending frame of the animation

-//----------------------------------------------------------------------
-// misc_model_think -- Handles animation for misc_model entity.
-//----------------------------------------------------------------------
-void() misc_model_think =
-{
- self.nextthink = time + fabs (self.speed);
- if (self.estate != STATE_ACTIVE)
- return;
-
- self.frame = self.frame + sign (self.speed);
-
- if (self.spawnflags & MISC_MODEL_BACK_AND_FORTH
- && self.frame < self.first_frame)
- {
- self.speed = -1 * self.speed;
- self.frame += 2;
- }
- else if (self.spawnflags & MISC_MODEL_BACK_AND_FORTH
- && self.frame > self.last_frame)
- {
- self.speed = -1 * self.speed;
- self.frame -= 2;
- }
- else
+ //--------------------------------------------------------------
+ virtual void() misc_model_use =
{
- self.frame = wrap (self.frame, self.first_frame,
- self.last_frame);
- }
-
- if (self.spawnflags & MISC_MODEL_ONLY_ONCE
- && self.frame == self.last_frame
- && self.last_frame != self.first_frame)
- self.nextthink = -1;
-
- if (self.spawnflags & MISC_MODEL_PLAY_COUNT
- && self.frame == self.last_frame
- && self.last_frame != self.first_frame)
+ if (this.state == STATE_ACTIVE)
+ {
+ if (this.spawnflags & MISC_MODEL_SOLID)
+ this.solid = SOLID_NOT;
+ this.model = "";
+
+ this.state = STATE_INVISIBLE;
+ setorigin (this, this.origin);
+ }
+ else
+ {
+ if (this.spawnflags & MISC_MODEL_SOLID)
+ this.solid = SOLID_BBOX;
+ this.model = this.mdl;
+
+ this.state = STATE_ACTIVE;
+ setorigin (this, this.origin);
+ }
+ };
+
+ //--------------------------------------------------------------
+ // misc_model_think -- Handles animation for misc_model entity.
+ //--------------------------------------------------------------
+ virtual void() misc_model_think =
{
- if !(self.count)
- objerror ("Error: set count to the number of "
- " animation cycles!");
- self.cnt = self.cnt + 1;
- dprint (ftos(self.cnt));
- dprint ("\n");
- if (self.cnt != self.count)
- return FALSE;
+ this.nextthink = time + fabs (this.speed);
+ if (this.estate != STATE_ACTIVE)
+ return;
+
+ this.frame = this.frame + sign (this.speed);
+
+ if (this.spawnflags & MISC_MODEL_BACK_AND_FORTH
+ && this.frame < this.first_frame)
+ {
+ this.speed = -1 * this.speed;
+ this.frame += 2;
+ }
+ else if (this.spawnflags & MISC_MODEL_BACK_AND_FORTH
+ && this.frame > this.last_frame)
+ {
+ this.speed = -1 * this.speed;
+ this.frame -= 2;
+ }
else
- self.nextthink = -1;
- }
+ {
+ this.frame = wrap (this.frame, this.first_frame,
+ this.last_frame);
+ }
+
+ if (this.spawnflags & MISC_MODEL_ONLY_ONCE &&
+ this.frame == this.last_frame &&
+ this.last_frame != this.first_frame)
+ {
+ this.nextthink = -1;
+ }
+
+ if (this.spawnflags & MISC_MODEL_PLAY_COUNT &&
+ this.frame == this.last_frame &&
+ this.last_frame != this.first_frame)
+ {
+ if !(this.count)
+ objerror ("Error: set count to the number of "
+ " animation cycles!");
+ this.cnt = this.cnt + 1;
+ dprint (ftos(this.cnt));
+ dprint ("\n");
+ if (this.cnt != this.count)
+ return FALSE;
+ else
+ this.nextthink = -1;
+ }
+ };
+
};

/*QUAKED misc_model (0 0.5 0.8) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
@@ -113,82 +114,92 @@ first_frame: The starting frame of the animation.

last_frame: The last frame of the animation.
*/
-void() misc_model =
+class misc_model: base_misc_model
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- if (!self.mdl || self.mdl == "")
- objerror ("Model not defined");
-
- if (!self.centeroffset)
- self.centeroffset = '0 0 0';
- if (!self.mdlsz)
- self.mdlsz = '32 32 32';
-
- vector vmin, vmax;
-
- vmin_x = self.centeroffset_x - (self.mdlsz_x / 2);
- vmin_y = self.centeroffset_y - (self.mdlsz_y / 2);
- vmin_z = self.centeroffset_z - (self.mdlsz_z / 2);
-
- vmax_x = self.centeroffset_x + (self.mdlsz_x / 2);
- vmax_y = self.centeroffset_y + (self.mdlsz_y / 2);
- vmax_z = self.centeroffset_z + (self.mdlsz_z / 2);
-
- precache_model (self.mdl);
- setmodel (self, self.mdl);
-
- setsize (self, vmin, vmax);
-
- if (self.spawnflags & MISC_MODEL_SOLID)
- self.solid = SOLID_BBOX;
- else self.solid = SOLID_NOT;
-
- if (self.spawnflags & MISC_MODEL_GRAVITY)
- self.movetype = MOVETYPE_TOSS;
- else self.movetype = MOVETYPE_NONE;
-
- self.use = misc_model_use;
-
- if (!self.frame)
- self.frame = self.first_frame;
-
- // Make static (not animate) if not given a frame range, and
- // not affected by gravity; also remains active if it has a
- // targetname (so it can be killtargeted/toggled)
- if (!self.last_frame
- && !(self.spawnflags & MISC_MODEL_GRAVITY)
- && !(self.spawnflags & MISC_MODEL_SOLID)
- && !self.targetname
- && !self.targetname2)
- // && !(self.spawnflags & MISC_MODEL_DONTMAKESTATIC)
- makestatic (self);
-
- // Make static (not animate) if not given a frame range, and
- // not affected by gravity
- // changed by bmFbr
- // if (!self.last_frame && !(self.spawnflags & MISC_MODEL_GRAVITY))
- // {
- // makestatic(self);
- // return;
- // }
-
- // if it as a custom animation range
- if (self.last_frame)
+ //--------------------------------------------------------------
+ void() misc_model =
{
- // Default animation speed to 10 fps
- if (!self.speed)
- self.speed = 0.1;
- self.nextthink = time + self.speed;
- self.think = misc_model_think;
- }
-
- if (self.spawnflags & MISC_MODEL_STARTOFF)
- self.state = STATE_ACTIVE;
- else
- self.state = STATE_INVISIBLE;
-
- misc_model_use ();
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "misc_model";
+ this.classtype = CT_MISC_MODEL;
+
+ if (!this.mdl || this.mdl == "")
+ objerror ("Model not defined");
+
+ if (!this.centeroffset)
+ this.centeroffset = '0 0 0';
+ if (!this.mdlsz)
+ this.mdlsz = '32 32 32';
+
+ vector vmin, vmax;
+
+ vmin_x = this.centeroffset_x - (this.mdlsz_x / 2);
+ vmin_y = this.centeroffset_y - (this.mdlsz_y / 2);
+ vmin_z = this.centeroffset_z - (this.mdlsz_z / 2);
+
+ vmax_x = this.centeroffset_x + (this.mdlsz_x / 2);
+ vmax_y = this.centeroffset_y + (this.mdlsz_y / 2);
+ vmax_z = this.centeroffset_z + (this.mdlsz_z / 2);
+
+ precache_model (this.mdl);
+ setmodel (this, this.mdl);
+
+ setsize (this, vmin, vmax);
+
+ if (this.spawnflags & MISC_MODEL_SOLID)
+ this.solid = SOLID_BBOX;
+ else this.solid = SOLID_NOT;
+
+ if (this.spawnflags & MISC_MODEL_GRAVITY)
+ this.movetype = MOVETYPE_TOSS;
+ else this.movetype = MOVETYPE_NONE;
+
+ this.use = misc_model_use;
+
+ if (!this.frame)
+ this.frame = this.first_frame;
+
+ // Make static (not animate) if not given a frame range, and
+ // not affected by gravity; also remains active if it has a
+ // targetname (so it can be killtargeted/toggled)
+ if (!this.last_frame &&
+ !(this.spawnflags & MISC_MODEL_GRAVITY) &&
+ !(this.spawnflags & MISC_MODEL_SOLID) &&
+ !this.targetname &&
+ !this.targetname2)
+ // !(this.spawnflags & MISC_MODEL_DONTMAKESTATIC) &&
+ {
+ makestatic (this);
+ }
+
+ // Make static (not animate) if not given a frame range, and
+ // not affected by gravity
+ // changed by bmFbr
+ // if (!this.last_frame &&
+ // !(this.spawnflags & MISC_MODEL_GRAVITY))
+ // {
+ // makestatic(this);
+ // return;
+ // }
+
+ // if it as a custom animation range
+ if (this.last_frame)
+ {
+ // Default animation speed to 10 fps
+ if (!this.speed)
+ this.speed = 0.1;
+ this.nextthink = time + this.speed;
+ this.think = misc_model_think;
+ }
+
+ if (this.spawnflags & MISC_MODEL_STARTOFF)
+ this.state = STATE_ACTIVE;
+ else
+ this.state = STATE_INVISIBLE;
+
+ misc_model_use ();
+ };
};

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

Diff qc/misc/modeltrain.qc

diff --git a/qc/misc/modeltrain.qc b/qc/misc/modeltrain.qc
index f303113..c8ff211 100644
--- a/qc/misc/modeltrain.qc
+++ b/qc/misc/modeltrain.qc
@@ -2,7 +2,7 @@
// misc_modeltrain -- was plats.qc
//==============================================================================

-//----------------------------------------------------------------------
+ //--------------------------------------------------------------
void() animcontroller_think =
{
local float first, last, step, atype, dir, nextframe;
@@ -86,7 +86,7 @@ void() animcontroller_think =
self.nextthink = time + tr.frtime2;
};

-//----------------------------------------------------------------------
+ //--------------------------------------------------------------
void() misc_modeltrain =
{
// new spawnflags for all entities -- iw

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

Diff qc/misc/noisemaker.qc

diff --git a/qc/misc/noisemaker.qc b/qc/misc/noisemaker.qc
index 1d536a1..32a0671 100644
--- a/qc/misc/noisemaker.qc
+++ b/qc/misc/noisemaker.qc
@@ -2,40 +2,46 @@
// misc_noisemaker
//==============================================================================

-//----------------------------------------------------------------------
-void() noise_think =
-{
- self.nextthink = time + 0.5;
- sound (self, 1, "enforcer/enfire.wav", 1, ATTN_NORM);
- sound (self, 2, "enforcer/enfstop.wav", 1, ATTN_NORM);
- sound (self, 3, "enforcer/sight1.wav", 1, ATTN_NORM);
- sound (self, 4, "enforcer/sight2.wav", 1, ATTN_NORM);
- sound (self, 5, "enforcer/sight3.wav", 1, ATTN_NORM);
- sound (self, 6, "enforcer/sight4.wav", 1, ATTN_NORM);
- sound (self, 7, "enforcer/pain1.wav", 1, ATTN_NORM);
-};
-
/*QUAKED misc_noisemaker (1 0.5 0) (-10 -10 -10) (10 10 10) 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

For optimzation testing, starts a lot of sounds.
*/
-void() misc_noisemaker =
+class misc_noisemaker: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ //--------------------------------------------------------------
+ virtual void() noise_think =
+ {
+ this.nextthink = time + 0.5;
+ sound (this, 1, "enforcer/enfire.wav", 1, ATTN_NORM);
+ sound (this, 2, "enforcer/enfstop.wav", 1, ATTN_NORM);
+ sound (this, 3, "enforcer/sight1.wav", 1, ATTN_NORM);
+ sound (this, 4, "enforcer/sight2.wav", 1, ATTN_NORM);
+ sound (this, 5, "enforcer/sight3.wav", 1, ATTN_NORM);
+ sound (this, 6, "enforcer/sight4.wav", 1, ATTN_NORM);
+ sound (this, 7, "enforcer/pain1.wav", 1, ATTN_NORM);
+ };
+
+ //--------------------------------------------------------------
+ void() misc_noisemaker =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;

- precache_sound2 ("enforcer/enfire.wav");
- precache_sound2 ("enforcer/enfstop.wav");
- precache_sound2 ("enforcer/sight1.wav");
- precache_sound2 ("enforcer/sight2.wav");
- precache_sound2 ("enforcer/sight3.wav");
- precache_sound2 ("enforcer/sight4.wav");
- precache_sound2 ("enforcer/pain1.wav");
- precache_sound2 ("enforcer/pain2.wav");
- precache_sound2 ("enforcer/death1.wav");
- precache_sound2 ("enforcer/idle1.wav");
+ precache_sound2 ("enforcer/enfire.wav");
+ precache_sound2 ("enforcer/enfstop.wav");
+ precache_sound2 ("enforcer/sight1.wav");
+ precache_sound2 ("enforcer/sight2.wav");
+ precache_sound2 ("enforcer/sight3.wav");
+ precache_sound2 ("enforcer/sight4.wav");
+ precache_sound2 ("enforcer/pain1.wav");
+ precache_sound2 ("enforcer/pain2.wav");
+ precache_sound2 ("enforcer/death1.wav");
+ precache_sound2 ("enforcer/idle1.wav");

- self.nextthink = time + 0.1 + random ();
- self.think = noise_think;
+ this.classname = "misc_noisemaker";
+ this.classtype = CT_MISC_NOISEMAKER;
+ this.nextthink = time + 0.1 + random ();
+ this.think = noise_think;
+ };
};

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

Diff qc/misc/particle_stream.qc

diff --git a/qc/misc/particle_stream.qc b/qc/misc/particle_stream.qc
index 7517999..15a2e34 100644
--- a/qc/misc/particle_stream.qc
+++ b/qc/misc/particle_stream.qc
@@ -4,56 +4,6 @@

//=START PARTICLE-STREAM================================================

-//----------------------------------------------------------------------
-void(vector start, vector end, float color1, float color2, float pdensity)
- Particle_Beam =
-{
- local vector spray, next;
- local float dist, loop, clr;
-
- clr = color1;
- spray = start - end;
- dist = vlen (spray);
- loop = dist / 24;
- spray = normalize (spray);
- next = spray * 24;
-
- while (loop > 0)
- {
- particle (end, spray, clr, pdensity);
- end = end + next;
- loop = loop - 1;
- if (clr == color1)
- clr = color2;
- else
- clr = color1;
- }
-};
-
-//----------------------------------------------------------------------
-void() particle_use =
-{
- sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
- // was 40 - too many particles for my taste -- dumptruck_ds
- Particle_Beam(self.origin, self.enemy.origin, self.dmg, self.cnt, 15);
-};
-
-//----------------------------------------------------------------------
-void() particle_stream_start =
-{
- local entity pspot;
-
- pspot = find (world, targetname, self.target);
-
- if (!pspot)
- {
- dprint ("Particle stream can't find target!");
- return;
- }
-
- self.enemy = pspot;
-};
-
/*QUAKED misc_particle_stream (0 .5 .8) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
A particle stream! It appears when triggered. This entity is
one end of the stream, target another entity as the other end-point.
@@ -65,25 +15,83 @@ I used the info_notnull, but you should be able to target anything
"cnt" 2nd Color - Mixes particles of both colors
"noise" Sound to play when triggered
*/
-void() misc_particle_stream =
+class misc_particle_stream: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ //--------------------------------------------------------------
+ nonvirtual void(vector start, vector end, float color1, float color2,
+ float pdensity) particle_beam =
+ {
+ local vector spray, next;
+ local float dist, loop, clr;
+
+ clr = color1;
+ spray = start - end;
+ dist = vlen (spray);
+ loop = dist / 24;
+ spray = normalize (spray);
+ next = spray * 24;
+
+ while (loop > 0)
+ {
+ particle (end, spray, clr, pdensity);
+ end = end + next;
+ loop = loop - 1;
+ if (clr == color1)
+ clr = color2;
+ else
+ clr = color1;
+ }
+ };
+
+ //--------------------------------------------------------------
+ virtual void() particle_use =
+ {
+ sound (this, CHAN_VOICE, this.noise, 1, ATTN_NORM);
+ // was 40 - too many particles for my taste -- dumptruck_ds
+ particle_beam (this.origin, this.enemy.origin,
+ this.dmg, this.cnt, 15);
+ };
+
+ //--------------------------------------------------------------
+ virtual void() particle_stream_start =
+ {
+ local entity pspot;
+
+ pspot = find (world, ::targetname, this.target);
+
+ if (!pspot)
+ {
+ dprint ("Particle stream can't find target!");
+ return;
+ }
+
+ this.enemy = pspot;
+ };
+
+ //--------------------------------------------------------------
+ void() misc_particle_stream =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "misc_particle_stream";
+ this.classtype = CT_MISC_PARTICLE_STREAM;

- if (!self.target)
- objerror ("misc_particle_stream with not target!");
+ if (!this.target)
+ objerror ("misc_particle_stream with not target!");

- if (!self.dmg)
- self.dmg = 73;
- if (!self.cnt)
- self.cnt = self.dmg;
- if (!self.noise)
- self.noise = "misc/null.wav";
+ if (!this.dmg)
+ this.dmg = 73;
+ if (!this.cnt)
+ this.cnt = this.dmg;
+ if (!this.noise)
+ this.noise = "misc/null.wav";

- precache_sound(self.noise);
+ precache_sound(this.noise);

- self.use = particle_use;
- self.think = particle_stream_start;
- self.nextthink = time + 0.2;
+ this.use = particle_use;
+ this.think = particle_stream_start;
+ this.nextthink = time + 0.2;
+ };
};

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

Diff qc/misc/particles.qc

diff --git a/qc/misc/particles.qc b/qc/misc/particles.qc
index 7263432..b9a6975 100644
--- a/qc/misc/particles.qc
+++ b/qc/misc/particles.qc
@@ -1,44 +1,13 @@
//==============================================================================
// misc_particles AKA misc_splash
// selections from Rubicon 2 qc by john fitzgibbons
+// renamed from misc_splash (Rubcion 2) -- dumptruck_ds
//==============================================================================

-//======================================================================
-// misc_particles
-// renamed from misc_splash (Rubcion 2) --dumptruck_ds
-//======================================================================
+// constants
+const float PARTICLES_START_OFF;

-//----------------------------------------------------------------------
-void() splash_use =
-{
- if (self.spawnflags & START_OFF)
- self.spawnflags = self.spawnflags - START_OFF;
- else
- self.spawnflags = self.spawnflags + START_OFF;
-};
-
-//----------------------------------------------------------------------
-void() splash_think =
-{
- if (self.spawnflags & START_OFF)
- {
- self.nextthink = time + 0.1;
- self.think = splash_think;
- }
- else
- {
- local vector vec;
- local float variance;
- variance = vlen(self.movedir) / 2;
- vec_x = self.movedir_x - variance + random() * variance * 2;
- vec_y = self.movedir_y - variance + random() * variance * 2;
- vec_z = self.movedir_z - variance + random() * variance * 2;
- particle (self.origin, vec, self.color, self.volume);
- self.nextthink = time + self.wait;
- }
-};
-
-/*QUAKED misc_particles (0 .5 .8) (-8 -8 -8) (8 8 8) START_OFF X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+/*QUAKED misc_particles (0 .5 .8) (-8 -8 -8) (8 8 8) PARTICLES_START_OFF X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY

Produces a continuous particle splash for waterfalls and other effects

@@ -49,26 +18,64 @@ Produces a continuous particle splash for waterfalls and other effects
"wait" time between particle generation cycles. (default 0.1)

"volume" density of particles. (default 10)
-
-
*/
-void() misc_particles =
+class misc_particles: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ //--------------------------------------------------------------
+ virtual void() splash_use =
+ {
+ if (this.spawnflags & PARTICLES_START_OFF)
+ this.spawnflags = this.spawnflags - PARTICLES_START_OFF;
+ else
+ this.spawnflags = this.spawnflags + PARTICLES_START_OFF;
+ };
+
+ //--------------------------------------------------------------
+ virtual void() splash_think =
+ {
+ if (this.spawnflags & PARTICLES_START_OFF)
+ {
+ this.nextthink = time + 0.1;
+ this.think = splash_think;
+ }
+ else
+ {
+ local vector vec;
+ local float variance;
+ variance = vlen(this.movedir) / 2;
+ vec_x = this.movedir_x - variance +
+ random() * variance * 2;
+ vec_y = this.movedir_y - variance +
+ random() * variance * 2;
+ vec_z = this.movedir_z - variance +
+ random() * variance * 2;
+ particle (this.origin, vec, this.color, this.volume);
+ this.nextthink = time + this.wait;
+ }
+ };
+
+ //--------------------------------------------------------------
+ void() misc_particles =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "misc_particles";
+ this.classtype = CT_MISC_PARTICLES;

- if (!self.wait)
- self.wait = 0.1;
+ if (!this.wait)
+ this.wait = 0.1;

- if (!self.movedir)
- self.movedir = '0 0 4';
+ if (!this.movedir)
+ this.movedir = '0 0 4';

- if (!self.volume)
- self.volume = 10;
+ if (!this.volume)
+ this.volume = 10;

- self.color = self.color * 16;
- self.use = splash_use;
- self.nextthink = time + self.wait;
- self.think = splash_think;
+ this.color = this.color * 16;
+ this.use = splash_use;
+ this.nextthink = time + this.wait;
+ this.think = splash_think;
+ };
};

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

Diff qc/misc/particlespray.qc

diff --git a/qc/misc/particlespray.qc b/qc/misc/particlespray.qc
index 864665c..9e1826f 100644
--- a/qc/misc/particlespray.qc
+++ b/qc/misc/particlespray.qc
@@ -1,37 +1,8 @@
//==============================================================================
-// misc_particlespray
-//==============================================================================
-
-//======================================================================
-// Particle Sprayer
+// misc_particlespray -- Particle Sprayer
// this is from Custents not Rubicon2 -- dumptruck_ds
// renamed from func to misc
-//======================================================================
-
-// fields
-.float endtime;
-.float duration;
-
-//----------------------------------------------------------------------
-void() partspray_think =
-{
- particle (self.origin, self.movedir, self.color, self.count);
-
- if (!self.targetname || self.endtime > time)
- self.nextthink = time + self.delay;
-
- if (self.noise != "")
- sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
- else
- sound (self, CHAN_AUTO, "misc/null.wav", 1, ATTN_NORM);
-};
-
-//----------------------------------------------------------------------
-void() partspray_use =
-{
- self.endtime = time + self.duration;
- partspray_think ();
-};
+//==============================================================================

/*QUAKED misc_particlespray (0 .5 .8) (-8 -8 -8) (8 8 8) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
Shoots particles either when triggered, or contiuously when not triggered by anything.
@@ -47,30 +18,59 @@ Shoots particles either when triggered, or contiuously when not triggered by any

"duration" is the amount of time that the it will continue to release particles so that it can release a long stream of particles with only one triggering.
*/
-void() misc_particlespray =
+class misc_particlespray: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- if (!self.color)
- self.color = 47;
-
- if (self.count <= 0)
- self.count = 15;
-
- if (self.delay <= 0)
- self.delay = 0.1;
-
- if (self.noise != "")
- precache_sound (self.noise);
- precache_sound ("misc/null.wav");
-
- self.classname = "particlespray";
- self.think = partspray_think;
-
- if (!self.targetname)
- self.nextthink = time + 0.1 + self.delay;
- else
- self.use = partspray_use;
+ // class fields
+ float endtime;
+ float duration;
+
+ //--------------------------------------------------------------
+ virtual void() particlespray_think =
+ {
+ particle (this.origin, this.movedir, this.color, this.count);
+
+ if (!this.targetname || this.endtime > time)
+ this.nextthink = time + this.delay;
+
+ if (this.noise != "")
+ sound (this, CHAN_AUTO, this.noise, 1, ATTN_NORM);
+ else
+ sound (this, CHAN_AUTO, "misc/null.wav", 1, ATTN_NORM);
+ };
+
+ //--------------------------------------------------------------
+ virtual void() particlespray_use =
+ {
+ this.endtime = time + this.duration;
+ particlespray_think ();
+ };
+
+ void() misc_particlespray =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ if (!this.color)
+ this.color = 47;
+
+ if (this.count <= 0)
+ this.count = 15;
+
+ if (this.delay <= 0)
+ this.delay = 0.1;
+
+ if (this.noise != "")
+ precache_sound (this.noise);
+ precache_sound ("misc/null.wav");
+
+ this.classname = "particlespray";
+ this.classtype = CT_MISC_PARTICLESPRAY;
+ this.think = particlespray_think;
+
+ if (!this.targetname)
+ this.nextthink = time + 0.1 + this.delay;
+ else
+ this.use = particlespray_use;
+ };
};

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

Diff qc/misc/play.qc

diff --git a/qc/misc/play.qc b/qc/misc/play.qc
index afd18df..9ed77d9 100644
--- a/qc/misc/play.qc
+++ b/qc/misc/play.qc
@@ -9,41 +9,63 @@
// Distributed (unsupported) on 3.12.97
//======================================================================

-//----------------------------------------------------------------------
-void() play_sound_use =
+class base_play_sound: entity
{
- if (self.spawnflags & 1)
+ //--------------------------------------------------------------
+ virtual void() play_sound_use =
{
- if (self.state == 0)
+ if (this.spawnflags & 1)
{
- self.state = 1;
- sound (self, self.impulse, self.noise, self.volume,
- self.speed);
+ if (this.state == 0)
+ {
+ this.state = 1;
+ sound (this, this.impulse, this.noise,
+ this.volume, this.speed);
+ }
+ else
+ {
+ this.state = 0;
+ sound (this, this.impulse, "misc/null.wav",
+ this.volume, this.speed);
+ }
}
else
{
- self.state = 0;
- sound (self, self.impulse, "misc/null.wav",
- self.volume, self.speed);
+ sound (this, this.impulse, this.noise,
+ this.volume, this.speed);
}
- }
- else
+ };
+
+ //--------------------------------------------------------------
+ virtual void() play_sound_think =
{
- sound (self, self.impulse, self.noise, self.volume, self.speed);
- }
-};
+ local float t;
+ t = this.wait * random ();

-//----------------------------------------------------------------------
-void() PlaySoundThink =
-{
- local float t;
- t = self.wait * random ();
+ if (t < this.delay)
+ t = this.delay;

- if (t < self.delay)
- t = self.delay;
+ this.nextthink = time + t;
+ play_sound_use ();
+ };

- self.nextthink = time + t;
- play_sound_use ();
+ //--------------------------------------------------------------
+ nonvirtual void() play_sound_init =
+ {
+ precache_sound (this.noise);
+ precache_sound ("misc/null.wav");
+ if (this.volume == 0)
+ this.volume = 1;
+ if (this.speed == 0)
+ this.speed = 1;
+ if (this.speed == -1)
+ // this.speed = 0;
+ this.speed = ATTN_NONE;
+ if (this.spawnflags & 1)
+ if (this.impulse == 0)
+ this.impulse = 7;
+ this.use = play_sound_use;
+ };
};

/*QUAKED play_sound_triggered (0.3 0.1 0.6) (-8 -8 -8) (8 8 8) toggle
@@ -58,33 +80,27 @@ play a sound when it is used
2 - idle
3 - static
*/
-void() play_sound_triggered =
+class play_sound_triggered: base_play_sound
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- // dumptruck_ds
- if (!self.noise)
+ //--------------------------------------------------------------
+ virtual void() play_sound_triggered =
{
- objerror ("no soundfile set in noise!\n");
- remove (self);
- return;
- }
-
- precache_sound (self.noise);
- precache_sound ("misc/null.wav");
- if (self.volume == 0)
- self.volume = 1;
- if (self.speed == 0)
- self.speed = 1;
- if (self.speed == -1)
- // self.speed = 0;
- self.speed = ATTN_NONE;
- if (self.spawnflags & 1)
- if (self.impulse == 0)
- self.impulse = 7;
- self.use = play_sound_use;
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ // dumptruck_ds
+ if (!this.noise)
+ {
+ objerror ("no soundfile set in noise!\n");
+ remove (this);
+ return;
+ }
+
+ this.classname = "play_sound_triggered";
+ this.classtype = CT_MISC_PLAY_SOUND_TRIGGERED;
+ play_sound_init ();
+ };
};

/*QUAKED play_sound (0.3 0.1 0.6) (-8 -8 -8) (8 8 8)
@@ -100,36 +116,53 @@ play a sound on a periodic basis
2 - idle
3 - static
*/
-void() play_sound =
+class play_sound: base_play_sound
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ //--------------------------------------------------------------
+ void() play_sound =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;

- local float t;
+ local float t;

- // dumptruck_ds
- if (!self.noise)
- {
- objerror ("no soundfile set in noise!\n");
- remove (self);
- return;
- }
+ // dumptruck_ds
+ if (!this.noise)
+ {
+ objerror ("no soundfile set in noise!\n");
+ remove (this);
+ return;
+ }
+
+ this.classname = "play_sound";
+ this.classtype = CT_MISC_PLAY_SOUND;
+ play_sound_init ();
+
+ if (this.wait == 0)
+ this.wait = 20;
+ if (this.delay == 0)
+ this.delay = 2;

- play_sound_triggered ();
+ this.think = play_sound_think;

- if (self.wait == 0)
- self.wait = 20;
- if (self.delay == 0)
- self.delay = 2;
+ t = this.wait * random ();
+ if (t < this.delay)
+ t = this.delay;

- self.think = PlaySoundThink;
+ this.nextthink = time + t;
+ };
+};

- t = self.wait * random ();
- if (t < self.delay)
- t = self.delay;
+class base_tele_fog: entity
+{
+ //--------------------------------------------------------------
+ virtual void() play_tfog =
+ {
+ // thanks Khreathor -- dumptruck_ds
+ spawn_tfog (this.origin);
+ };

- self.nextthink = time + t;
};

/*QUAKED tele_fog (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
@@ -139,21 +172,21 @@ When triggered, tele_fog shows the teleport particle effects and sounds.
Use this when killtageting an entity if the player can see.

*/
-void() play_tfog =
+class tele_fog: base_tele_fog
{
- // thanks Khreathor -- dumptruck_ds
- spawn_tfog (self.origin);
+ //--------------------------------------------------------------
+ void() tele_fog =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "tele_fog";
+ this.classtype = CT_MISC_TELE_FOG;
+ this.use = play_tfog;
+ };
};

-//----------------------------------------------------------------------
-void() tele_fog =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- self.use = play_tfog;
-};

/*QUAKED play_tele (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)

@@ -163,15 +196,21 @@ Same os tele_fog.
Use this when killtageting an entity if the player can see.

*/
-void() play_tele =
+class play_tele: base_tele_fog
{
- // same as tele_fog, added for "play_xxxx" consistancy
-
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- self.use = play_tfog;
+ //--------------------------------------------------------------
+ void() play_tele =
+ {
+ // same as tele_fog, added for "play_xxxx" consistancy
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "tele_fog";
+ // use same classtype as tele_fog () -- CEV
+ this.classtype = CT_MISC_TELE_FOG;
+ this.use = play_tfog;
+ };
};

/*QUAKED play_explosion (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
@@ -179,22 +218,28 @@ void() play_tele =
When triggered, creates a explosion at it's origin. Causes damage.

*/
-void() play_explosion_fx =
-{
- // thanks Khreathor -- dumptruck_ds
- // GrenadeExplode uses self.owner as the attacker -- iw
- self.owner = self;
- GrenadeExplode ();
-};
-
-//----------------------------------------------------------------------
-void() play_explosion =
+class play_explosion: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- self.use = play_explosion_fx;
+ //--------------------------------------------------------------
+ virtual void() play_explosion_fx =
+ {
+ // thanks Khreathor -- dumptruck_ds
+ // GrenadeExplode uses this.owner as the attacker -- iw
+ this.owner = this;
+ GrenadeExplode ();
+ };
+
+ //--------------------------------------------------------------
+ void() play_explosion =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "play_explosion";
+ this.classtype = CT_MISC_PLAY_EXPLOSION;
+ this.use = play_explosion_fx;
+ };
};

/*QUAKED play_lavasplash (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
@@ -204,37 +249,73 @@ When triggered, plays the lavasplash effect from E1M7.
Use noise key for a custom sound.

*/
-void() play_lavasplash_fx =
+class play_lavasplash: entity
{
- // thanks Khreathor -- dumptruck_ds
- if (self.noise != "")
+ //--------------------------------------------------------------
+ virtual void() play_lavasplash_fx =
{
- sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
- }
- else
+ // thanks Khreathor -- dumptruck_ds
+ if (this.noise != "")
+ sound (this, CHAN_AUTO, this.noise, 1, ATTN_NORM);
+ else
+ sound (this, CHAN_AUTO, "boss1/out1.wav", 1, ATTN_NORM);
+
+ WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteByte (MSG_BROADCAST, TE_LAVASPLASH);
+ WriteCoord (MSG_BROADCAST, this.origin_x);
+ WriteCoord (MSG_BROADCAST, this.origin_y);
+ WriteCoord (MSG_BROADCAST, this.origin_z);
+ };
+
+ //--------------------------------------------------------------
+ void() play_lavasplash =
{
- sound (self, CHAN_AUTO, "boss1/out1.wav", 1, ATTN_NORM);
- }
-
- WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
- WriteByte (MSG_BROADCAST, TE_LAVASPLASH);
- WriteCoord (MSG_BROADCAST, self.origin_x);
- WriteCoord (MSG_BROADCAST, self.origin_y);
- WriteCoord (MSG_BROADCAST, self.origin_z);
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "play_lavasplash";
+ this.classtype = CT_MISC_PLAY_LAVASPLASH;
+ if (this.noise != "")
+ precache_sound (this.noise);
+
+ precache_sound("boss1/out1.wav");
+ this.use = play_lavasplash_fx;
+ };
};

-//----------------------------------------------------------------------
-void() play_lavasplash =
+class base_meat_shower: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ //--------------------------------------------------------------
+ virtual void() play_meatspray =
+ {
+ // -- dumptruck_ds -- thanks to Spike for helping with errors
+ if (this.style == 1)
+ {
+ ThrowGib ("progs/gib1.mdl", random() * -80);
+ ThrowGib ("progs/gib2.mdl", random() * -80);
+ ThrowGib ("progs/gib3.mdl", random() * -80);
+ ThrowGib ("progs/gib1.mdl", random() * -75);
+ ThrowGib ("progs/gib2.mdl", random() * -75);
+ ThrowGib ("progs/gib3.mdl", random() * -75);
+ }
+ else
+ {
+ ThrowGib ("progs/gib1.mdl", random() * -65);
+ ThrowGib ("progs/gib2.mdl", random() * -65);
+ ThrowGib ("progs/gib3.mdl", random() * -65);
+ }

- if (self.noise != "")
- precache_sound (self.noise);
+ if (this.fly_sound != 1)
+ return;

- precache_sound("boss1/out1.wav");
- self.use = play_lavasplash_fx;
+ if (random() < 0.5)
+ sound (this, CHAN_VOICE, "player/gib.wav",
+ 1, ATTN_NORM);
+ else
+ sound (this, CHAN_VOICE, "player/udeath.wav",
+ 1, ATTN_NORM);
+ };
};

/*QUAKED meat_shower (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
@@ -244,42 +325,19 @@ When triggered, plays a gib effect.
Use style 0 for normal and 1 for extra large. fly_sound 0 is silent, 1 for regular gib sounds.

*/
-void() play_meatspray =
+class meat_shower: base_meat_shower
{
- // -- dumptruck_ds -- thanks to Spike for helping with errors
- if (self.style == 1)
+ //--------------------------------------------------------------
+ void() meat_shower =
{
- ThrowGib ("progs/gib1.mdl", random() * -80);
- ThrowGib ("progs/gib2.mdl", random() * -80);
- ThrowGib ("progs/gib3.mdl", random() * -80);
- ThrowGib ("progs/gib1.mdl", random() * -75);
- ThrowGib ("progs/gib2.mdl", random() * -75);
- ThrowGib ("progs/gib3.mdl", random() * -75);
- }
- else
- {
- ThrowGib ("progs/gib1.mdl", random() * -65);
- ThrowGib ("progs/gib2.mdl", random() * -65);
- ThrowGib ("progs/gib3.mdl", random() * -65);
- }
-
- if (self.fly_sound != 1)
- return;
-
- if (random() < 0.5)
- sound (self, CHAN_VOICE, "player/gib.wav", 1, ATTN_NORM);
- else
- sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
-};
-
-//----------------------------------------------------------------------
-void() meat_shower =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- self.use = play_meatspray;
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "meat_shower";
+ this.classtype = CT_MISC_PLAY_GIBS;
+ this.use = play_meatspray;
+ };
};

/*QUAKED play_gibs (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
@@ -289,180 +347,204 @@ When triggered, plays a gib effect. Same as meat_shower.
Use style 0 for normal and 1 for extra large. fly_sound 0 is silent, 1 for regular gib sounds.

*/
-void() play_gibs =
+class play_gibs: base_meat_shower
{
- // same as meat_shower, added for "play_xxxx" consistancy
-
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- self.use = play_meatspray;
-};
-
-//----------------------------------------------------------------------
-void() mflash_use =
-{
- self.effects = self.effects | EF_MUZZLEFLASH;
-
- if (self.noise != "")
- sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
+ //--------------------------------------------------------------
+ void() play_gibs =
+ {
+ // same as meat_shower, added for "play_xxxx" consistancy
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "play_gibs";
+ this.classtype = CT_MISC_PLAY_GIBS;
+ this.use = play_meatspray;
+ };
};

/*QUAKED play_mflash (0 .5 .8) (-8 -8 -8) (8 8 8)
triggable muzzle flash effect entity
*/
-void() play_mflash =
+class play_mflash: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/s_null.spr");
- if (self.noise != "")
- precache_sound (self.noise);
-
- setmodel (self, "progs/s_null.spr");
- setorigin (self, self.origin);
- self.movetype = MOVETYPE_NONE;
- self.solid = SOLID_NOT;
- setsize (self, '0 0 0', '0 0 0');
- self.use = mflash_use;
-};
+ //--------------------------------------------------------------
+ virtual void() mflash_use =
+ {
+ this.effects = this.effects | EF_MUZZLEFLASH;

-//======================================================================
-// play_bfield triggerable effect
-//======================================================================
+ if (this.noise != "")
+ sound (this, CHAN_AUTO, this.noise, 1, ATTN_NORM);
+ };

-//----------------------------------------------------------------------
-void() bfield_toggle =
-{
- if (!self.state)
+ //--------------------------------------------------------------
+ void() play_mflash =
{
- self.state = 1;
- self.effects = self.effects | EF_BRIGHTFIELD;
- sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
- }
- else
- {
- self.state = 0;
- self.effects = self.effects - (self.effects & EF_BRIGHTFIELD);
- sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
- }
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "play_mflash";
+ this.classtype = CT_MISC_PLAY_MFLASH;
+
+ precache_model ("progs/s_null.spr");
+ if (this.noise != "")
+ precache_sound (this.noise);
+
+ setmodel (this, "progs/s_null.spr");
+ setorigin (this, this.origin);
+ this.movetype = MOVETYPE_NONE;
+ this.solid = SOLID_NOT;
+ setsize (this, '0 0 0', '0 0 0');
+ this.use = mflash_use;
+ };
};

/*QUAKED play_bfield (0 .5 .8) (-8 -8 -8) (8 8 8)
a triggerable, spherical field of yellow particles
state 1 = start on
*/
-void() play_bfield =
+class play_bfield: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/s_null.spr");
- if (self.noise != "")
- precache_sound (self.noise);
-
- setmodel (self, "progs/s_null.spr");
- setorigin (self, self.origin);
- self.movetype = MOVETYPE_NONE;
- self.solid = SOLID_NOT;
- setsize (self, '0 0 0', '0 0 0');
- if (self.state)
- self.effects = self.effects | EF_BRIGHTFIELD;
- self.use = bfield_toggle;
-};
-
-//======================================================================
-// play_brlight triggerable effect
-//======================================================================
-
-//----------------------------------------------------------------------
-void() brlight_toggle =
-{
- // dumptruck_ds -- thanks to c0burn
- if (!self.state)
+ //--------------------------------------------------------------
+ virtual void() bfield_toggle =
{
- self.state = 1;
- self.effects = self.effects | EF_BRIGHTLIGHT;
- sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
- }
- else
+ if (!this.state)
+ {
+ this.state = 1;
+ this.effects = this.effects | EF_BRIGHTFIELD;
+ sound (this, CHAN_AUTO, this.noise, 1, ATTN_NORM);
+ }
+ else
+ {
+ this.state = 0;
+ this.effects = this.effects -
+ (this.effects & EF_BRIGHTFIELD);
+ sound (this, CHAN_AUTO, this.noise, 1, ATTN_NORM);
+ }
+ };
+
+ //--------------------------------------------------------------
+ void() play_bfield =
{
- self.state = 0;
- self.effects = self.effects - (self.effects & EF_BRIGHTLIGHT);
- sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
- }
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "play_bfield";
+ this.classtype = CT_MISC_PLAY_BFIELD;
+
+ precache_model ("progs/s_null.spr");
+ if (this.noise != "")
+ precache_sound (this.noise);
+
+ setmodel (this, "progs/s_null.spr");
+ setorigin (this, this.origin);
+ this.movetype = MOVETYPE_NONE;
+ this.solid = SOLID_NOT;
+ setsize (this, '0 0 0', '0 0 0');
+ if (this.state)
+ this.effects = this.effects | EF_BRIGHTFIELD;
+ this.use = bfield_toggle;
+ };
};

/*QUAKED play_brlight (0 .5 .8) (-8 -8 -8) (8 8 8)
a triggerable bright lighting effect
state 1 = start on
*/
-void() play_brlight =
+class play_brlight: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/s_null.spr");
- if (self.noise != "")
- precache_sound (self.noise);
-
- setmodel (self, "progs/s_null.spr");
- setorigin (self, self.origin);
- self.movetype = MOVETYPE_NONE;
- self.solid = SOLID_NOT;
- setsize (self, '0 0 0', '0 0 0');
- if (self.state)
- self.effects = self.effects | EF_BRIGHTLIGHT;
- self.use = brlight_toggle;
-};
-
-//======================================================================
-// play_dimlight triggerable effect
-//======================================================================
-
-//----------------------------------------------------------------------
-void() dim_toggle =
-{
- if (!self.state)
+ //--------------------------------------------------------------
+ virtual void() brlight_toggle =
{
- self.state = 1;
- self.effects = self.effects | EF_DIMLIGHT;
- sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
- }
- else
+ // dumptruck_ds -- thanks to c0burn
+ if (!this.state)
+ {
+ this.state = 1;
+ this.effects = this.effects | EF_BRIGHTLIGHT;
+ sound (this, CHAN_AUTO, this.noise, 1, ATTN_NORM);
+ }
+ else
+ {
+ this.state = 0;
+ this.effects = this.effects -
+ (this.effects & EF_BRIGHTLIGHT);
+ sound (this, CHAN_AUTO, this.noise, 1, ATTN_NORM);
+ }
+ };
+
+ //--------------------------------------------------------------
+ void() play_brlight =
{
- self.state = 0;
- self.effects = self.effects - (self.effects & EF_DIMLIGHT);
- sound (self, CHAN_AUTO, self.noise, 1, ATTN_NORM);
- }
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "play_brlight";
+ this.classtype = CT_MISC_PLAY_BRLIGHT;
+
+ precache_model ("progs/s_null.spr");
+ if (this.noise != "")
+ precache_sound (this.noise);
+
+ setmodel (this, "progs/s_null.spr");
+ setorigin (this, this.origin);
+ this.movetype = MOVETYPE_NONE;
+ this.solid = SOLID_NOT;
+ setsize (this, '0 0 0', '0 0 0');
+ if (this.state)
+ this.effects = this.effects | EF_BRIGHTLIGHT;
+ this.use = brlight_toggle;
+ };
};

/*QUAKED play_dimlight (0 .5 .8) (-8 -8 -8) (8 8 8)
a triggerable lighting effect
state 1 = start on
*/
-void() play_dimlight =
+class play_dimlight: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/s_null.spr");
- if (self.noise != "")
- precache_sound (self.noise);
-
- setmodel (self, "progs/s_null.spr");
- // setorigin (self, self.origin);
- self.movetype = MOVETYPE_NONE;
- self.solid = SOLID_NOT;
- setsize (self, '0 0 0', '0 0 0');
- if (self.state)
- self.effects = self.effects | EF_DIMLIGHT;
- setorigin (self, self.origin);
- self.use = dim_toggle;
+ //--------------------------------------------------------------
+ virtual void() dim_toggle =
+ {
+ if (!this.state)
+ {
+ this.state = 1;
+ this.effects = this.effects | EF_DIMLIGHT;
+ sound (this, CHAN_AUTO, this.noise, 1, ATTN_NORM);
+ }
+ else
+ {
+ this.state = 0;
+ this.effects = this.effects -
+ (this.effects & EF_DIMLIGHT);
+ sound (this, CHAN_AUTO, this.noise, 1, ATTN_NORM);
+ }
+ };
+
+ //--------------------------------------------------------------
+ void() play_dimlight =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "play_dimlight";
+ this.classtype = CT_MISC_PLAY_DIMLIGHT;
+
+ precache_model ("progs/s_null.spr");
+ if (this.noise != "")
+ precache_sound (this.noise);
+
+ setmodel (this, "progs/s_null.spr");
+ // setorigin (this, this.origin);
+ this.movetype = MOVETYPE_NONE;
+ this.solid = SOLID_NOT;
+ setsize (this, '0 0 0', '0 0 0');
+ if (this.state)
+ this.effects = this.effects | EF_DIMLIGHT;
+ setorigin (this, this.origin);
+ this.use = dim_toggle;
+ };
};

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

Diff qc/misc/sparks.qc

diff --git a/qc/misc/sparks.qc b/qc/misc/sparks.qc
index 5685b0b..58cdee6 100644
--- a/qc/misc/sparks.qc
+++ b/qc/misc/sparks.qc
@@ -2,159 +2,168 @@
// misc_sparks -- selections from Rubicon 2 qc by john fitzgibbons
//==============================================================================

-// prototypes
-void() make_sparks;
+// constants
+const float MISC_SPARKS_START_OFF = 1;
+const float MISC_SPARKS_BLUE = 2;
+const float MISC_SPARKS_PALE = 4;

-//----------------------------------------------------------------------
-void() sparks_fade1 = [0, sparks_fade2]
-{
- self.alpha = 0.8; self.nextthink = time + 0.05;
-};
+/*QUAKED misc_sparks (0 .5 .8) (-8 -8 -8) (8 8 8) MISC_SPARKS_START_OFF MISC_SPARKS_BLUE MISC_SPARKS_PALE X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY

-//----------------------------------------------------------------------
-void() sparks_fade2 = [0, sparks_fade3]
-{
- self.alpha = 0.6; self.nextthink = time + 0.05;
-};
+Produces a burst of yellow sparks at random intervals. If targeted, it will toggle between on or off. If it targets a light, that light will flash allong with each burst of sparks. Note: targeted lights should be set to START_OFF.

-//----------------------------------------------------------------------
-void() sparks_fade3 = [0, sparks_fade4]
-{
- self.alpha = 0.4; self.nextthink = time + 0.05;
-};
+SPARKS_BLUE: sparks are blue in color

-//----------------------------------------------------------------------
-void() sparks_fade4 = [0, SUB_Remove]
-{
- self.alpha = 0.2; self.nextthink = time + 0.05;
-};
+SPARKS_PALE: sparks are pale yellow in color

-//----------------------------------------------------------------------
-void() sparks_use =
-{
- if (self.spawnflags & START_OFF)
- self.spawnflags = self.spawnflags - START_OFF;
- else
- self.spawnflags = self.spawnflags + START_OFF;
-};
+Keys:

-//----------------------------------------------------------------------
-void() spark_turnofflight =
-{
- SUB_UseTargets ();
- self.think = make_sparks;
- self.nextthink = time + (random() + 0.5) * self.wait - 0.15;
-};
+"wait" is the average delay between bursts (variance is 1/2 wait). Default is 2.
+
+"cnt" is the average number of sparks in a burst (variance is 1/4 cnt). Default is 15.

-//----------------------------------------------------------------------
-void() make_sparks =
+"sounds"
+0) no sound
+1) sparks
+*/
+class misc_sparks: entity
{
+ //--------------------------------------------------------------
+ nonvirtual void() sparks_fade1 = [0, sparks_fade2]
+ {
+ this.alpha = 0.8; this.nextthink = time + 0.05;
+ };

- if (self.spawnflags & START_OFF)
+ //--------------------------------------------------------------
+ nonvirtual void() sparks_fade2 = [0, sparks_fade3]
{
- self.nextthink = time + 0.1;
- self.think = make_sparks;
- }
- else
+ this.alpha = 0.6; this.nextthink = time + 0.05;
+ };
+
+ //--------------------------------------------------------------
+ nonvirtual void() sparks_fade3 = [0, sparks_fade4]
{
- local float i;
- i = -0.25 * self.cnt + random() * 0.5 * self.cnt;
- while (i < self.cnt)
- {
+ this.alpha = 0.4; this.nextthink = time + 0.05;
+ };

- local entity spark;
- spark = spawn ();
- spark.owner = self;
- setmodel (spark, "progs/spark.mdl");
- setorigin (spark, self.origin);
- spark.movetype = MOVETYPE_BOUNCE;
- spark.solid = SOLID_TRIGGER;
- spark.gravity = 0.3;
- spark.velocity_x = -40 + random() * 80;
- spark.velocity_y = -40 + random() * 80;
- spark.velocity_z = -40 + random() * 80;
- spark.avelocity = '3000 3000 3000';
- spark.nextthink = time + 0.5 + 1.5 * random();
- spark.think = sparks_fade1;
- spark.classname = "spark";
-
- if (random() < 0.33)
- spark.skin = 0;
- else if (random() < 0.5)
- spark.skin = 1;
- else
- spark.skin = 2;
-
- if (self.spawnflags & SPARKS_PALE)
- spark.skin = spark.skin + 6;
- else if (self.spawnflags & SPARKS_BLUE)
- spark.skin = spark.skin + 3;
-
- setsize (spark, '0 0 0', '0 0 0');
- i = i + 1;
- }
+ //--------------------------------------------------------------
+ nonvirtual void() sparks_fade4 = [0, SUB_Remove]
+ {
+ this.alpha = 0.2; this.nextthink = time + 0.05;
+ };

- if (self.sounds == 1)
+ //--------------------------------------------------------------
+ virtual void() sparks_use =
+ {
+ if (this.spawnflags & MISC_SPARKS_START_OFF)
+ this.spawnflags = this.spawnflags -
+ MISC_SPARKS_START_OFF;
+ else
+ this.spawnflags = this.spawnflags +
+ MISC_SPARKS_START_OFF;
+ };
+
+ //--------------------------------------------------------------
+ nonvirtual void() spark_turnofflight =
+ {
+ SUB_UseTargets ();
+ this.think = this.make_sparks;
+ this.nextthink = time + (random() + 0.5) * this.wait - 0.15;
+ };
+
+ //--------------------------------------------------------------
+ virtual void() make_sparks =
+ {
+ if (this.spawnflags & MISC_SPARKS_START_OFF)
+ {
+ this.nextthink = time + 0.1;
+ this.think = make_sparks;
+ }
+ else
{
- if (self.noise != "")
+ local float i;
+ i = -0.25 * this.cnt + random() * 0.5 * this.cnt;
+ while (i < this.cnt)
{
- sound (self, CHAN_AUTO, self.noise,
- 1, ATTN_STATIC);
+ local entity spark;
+ spark = spawn ();
+ spark.owner = this;
+ setmodel (spark, "progs/spark.mdl");
+ setorigin (spark, this.origin);
+ spark.movetype = MOVETYPE_BOUNCE;
+ spark.solid = SOLID_TRIGGER;
+ spark.gravity = 0.3;
+ spark.velocity_x = -40 + random() * 80;
+ spark.velocity_y = -40 + random() * 80;
+ spark.velocity_z = -40 + random() * 80;
+ spark.avelocity = '3000 3000 3000';
+ spark.nextthink = time + 0.5 + 1.5 * random();
+ spark.think = sparks_fade1;
+ spark.classname = "spark";
+
+ if (random() < 0.33)
+ spark.skin = 0;
+ else if (random() < 0.5)
+ spark.skin = 1;
+ else
+ spark.skin = 2;
+
+ if (this.spawnflags & MISC_SPARKS_PALE)
+ spark.skin = spark.skin + 6;
+ else if (this.spawnflags & MISC_SPARKS_BLUE)
+ spark.skin = spark.skin + 3;
+
+ setsize (spark, '0 0 0', '0 0 0');
+ i = i + 1;
}
- else
+
+ if (this.sounds == 1)
{
- sound (self, CHAN_AUTO, "enforcer/enfstop.wav",
- 1, ATTN_STATIC);
+ if (this.noise != "")
+ {
+ sound (this, CHAN_AUTO, this.noise,
+ 1, ATTN_STATIC);
+ }
+ else
+ {
+ sound (this, CHAN_AUTO,
+ "enforcer/enfstop.wav",
+ 1, ATTN_STATIC);
+ }
}
- }
-
- SUB_UseTargets ();
- self.nextthink = time + 0.1 + random() * 0.1;
- self.think = spark_turnofflight;
- }
-};
-
-/*QUAKED misc_sparks (0 .5 .8) (-8 -8 -8) (8 8 8) START_OFF SPARKS_BLUE SPARKS_PALE X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-
-Produces a burst of yellow sparks at random intervals. If targeted, it will toggle between on or off. If it targets a light, that light will flash allong with each burst of sparks. Note: targeted lights should be set to START_OFF.
-
-SPARKS_BLUE: sparks are blue in color

-SPARKS_PALE: sparks are pale yellow in color
-
-Keys:
-
-"wait" is the average delay between bursts (variance is 1/2 wait). Default is 2.
-
-"cnt" is the average number of sparks in a burst (variance is 1/4 cnt). Default is 15.
+ SUB_UseTargets ();
+ this.nextthink = time + 0.1 + random() * 0.1;
+ this.think = this.spark_turnofflight;
+ }
+ };

-"sounds"
-0) no sound
-1) sparks
-*/
-void() misc_sparks =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ //--------------------------------------------------------------
+ void() misc_sparks =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;

- precache_model ("progs/spark.mdl");
+ this.classname = "misc_sparks";
+ this.classtype = CT_MISC_SPARKS;
+ precache_model ("progs/spark.mdl");

- if (!self.noise)
- precache_sound ("dump/spark.wav");
- else
- precache_sound (self.noise);
+ if (!this.noise)
+ precache_sound ("dump/spark.wav");
+ else
+ precache_sound (this.noise);

- if (!self.movedir)
- self.movedir = '0 0 -30';
+ if (!this.movedir)
+ this.movedir = '0 0 -30';

- if (!self.wait)
- self.wait = 2;
+ if (!this.wait)
+ this.wait = 2;

- if (!self.cnt)
- self.cnt = 15;
+ if (!this.cnt)
+ this.cnt = 15;

- self.use = sparks_use;
- self.nextthink = time + random() * 0.1;
- self.think = make_sparks;
+ this.use = sparks_use;
+ this.nextthink = time + random() * 0.1;
+ this.think = make_sparks;
+ };
};

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

Diff qc/misc/target_autosave.qc

diff --git a/qc/misc/target_autosave.qc b/qc/misc/target_autosave.qc
index 43b7553..b192def 100644
--- a/qc/misc/target_autosave.qc
+++ b/qc/misc/target_autosave.qc
@@ -2,71 +2,6 @@
// target_autosave -- from Copper
//==============================================================================

-//----------------------------------------------------------------------
-void() target_autosave_use =
-{
- if (self.enemy)
- {
- activator = self.enemy;
- self.enemy = world;
- }
-
- if (activator.classname != "player")
- return;
-
- // make sure an autosave fired from a player start doesn't
- // happen too early
- if (time < 2)
- {
- // if (serverflags & SVFL_RESPAWNING)
- // {
- // dprint("RESPAWNING flag set, skipping autosave\n");
- // return;
- // }
- self.enemy = activator;
- self.think = target_autosave_use;
- self.nextthink = 2;
- return;
- }
-
- // sound(activator, CHAN_VOICE, "misc/sav.wav", 0.3, ATTN_NORM);
- autosave (activator, self.message);
-};
-
-//----------------------------------------------------------------------
-void() toggle_autosave =
-{
- local entity e = world;
- local float printed = FALSE;
-
- do {
- e = find (e, classname, "target_autosave");
- if (!e)
- break;
-
- if (e.use == target_autosave_use)
- {
- e.use = SUB_Null;
- if (!printed)
- {
- bprint ("Autosaves disabled\n");
- printed = TRUE;
- }
- }
- else
- {
- e.use = target_autosave_use;
- if (!printed)
- {
- bprint ("Autosaves reenabled\n");
- printed = TRUE;
- }
- }
-
- }
- while (e != world);
-};
-
/*QUAKED target_autosave (1 .0 .5) (-8 -8 -8) (8 8 8)
Saves the game when triggered by a player. Never appears in multiplayer. the bprint tends to stomp any other prints on screen in most quake clients, so use a delayed trigger_relay if you fire this from an important pickup/trigger_counter/something else that puts text on screen more important than the autosave blurb.

@@ -81,16 +16,99 @@ the bprint tends to stomp any other prints on screen in most quake clients, so u
message(string) : "Change save filename" : "auto"
]
*/
-void() target_autosave =
+class target_autosave: entity
{
- if (deathmatch || coop)
+ //--------------------------------------------------------------
+ // autosave -- was in client.qc
+ //--------------------------------------------------------------
+ virtual void(entity client, string savename) autosave =
{
- remove (self);
- return;
- }
+ // autosavename = savename;
+ stuffcmd (client, "echo Autosaving...; wait; save ");
+ stuffcmd (client, savename);
+ stuffcmd (client, "\n");
+ };
+
+ //--------------------------------------------------------------
+ virtual void() target_autosave_use =
+ {
+ if (this.enemy)
+ {
+ activator = this.enemy;
+ this.enemy = world;
+ }
+
+ if (activator.classname != "player")
+ return;
+
+ // make sure an autosave fired from a player start doesn't
+ // happen too early
+ if (time < 2)
+ {
+ // if (serverflags & SVFL_RESPAWNING)
+ // {
+ // dprint("RESPAWNING flag set, skipping "
+ // "autosave\n");
+ // return;
+ // }
+ this.enemy = activator;
+ this.think = target_autosave_use;
+ this.nextthink = 2;
+ return;
+ }
+
+ // sound(activator, CHAN_VOICE, "misc/sav.wav", 0.3, ATTN_NORM);
+ autosave (activator, this.message);
+ };
+
+ //--------------------------------------------------------------
+ virtual void() toggle_autosave =
+ {
+ local entity e = world;
+ local float printed = FALSE;
+
+ do {
+ e = findfloat (e, ::classtype, CT_TARGET_AUTOSAVE);
+ if (!e)
+ break;
+
+ if (e.use == target_autosave_use)
+ {
+ e.use = SUB_Null;
+ if (!printed)
+ {
+ bprint ("Autosaves disabled\n");
+ printed = TRUE;
+ }
+ }
+ else
+ {
+ e.use = target_autosave_use;
+ if (!printed)
+ {
+ bprint ("Autosaves reenabled\n");
+ printed = TRUE;
+ }
+ }
+ }
+ while (e != world);
+ };
+
+ //--------------------------------------------------------------
+ void() target_autosave =
+ {
+ if (deathmatch || coop)
+ {
+ remove (this);
+ return;
+ }
+
+ this.classname = "target_autosave";
+ this.classtype = CT_TARGET_AUTOSAVE;

- if (self.message == string_null)
- self.message = "auto";
- // precache_sound2 ("misc/sav.wav");
- self.use = target_autosave_use;
+ if (this.message == string_null)
+ this.message = "auto";
+ // precache_sound2 ("misc/sav.wav");
+ this.use = target_autosave_use;
+ };
};

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 032363d..56e6418 100644
--- a/qc/misc/teleporttrain.qc
+++ b/qc/misc/teleporttrain.qc
@@ -3,101 +3,6 @@
// Code for the fixed teleporttrain written by c0burn and modified by ZungryWare
//==============================================================================

-// prototypes
-void() teleporttrain_calcmove;
-
-//----------------------------------------------------------------------
-void() teleporttrain_next =
-{
- local vector dir;
-
- setorigin (self, self.enemy.origin + '16 16 16');
-
- if (!self.target)
- {
- self.enemy = world;
- return;
- }
-
- self.enemy = find (world, targetname, self.target);
- if (self.enemy.classname == "path_corner")
- {
- dir = normalize ((self.enemy.origin + '16 16 16') -
- self.origin);
- self.velocity = dir * self.speed;
- self.target = self.enemy.target;
- }
- else
- {
- objerror ("unable to find target\n");
- remove (self);
- }
-
- teleporttrain_calcmove ();
-};
-
-//----------------------------------------------------------------------
-void() teleporttrain_wait =
-{
- local float wait_time;
-
- if (self.enemy.wait > 0)
- wait_time = self.enemy.wait;
- else
- wait_time = 0.1;
-
- self.velocity = '0 0 0';
- self.nextthink = time + wait_time;
- self.think = teleporttrain_next;
-};
-
-//----------------------------------------------------------------------
-void() teleporttrain_calcmove =
-{
- local vector delta;
- local float len, spd;
-
- delta = (self.enemy.origin + '16 16 16') - self.origin;
- len = vlen (delta);
- spd = vlen (self.velocity);
- self.nextthink = time + (len / spd);
- self.think = teleporttrain_wait;
-};
-
-//----------------------------------------------------------------------
-void() teleporttrain_use =
-{
- if (self.velocity == '0 0 0')
- teleporttrain_next ();
-};
-
-//----------------------------------------------------------------------
-void() teleporttrain_find =
-{
- // always start positioned on the first path_corner
- self.enemy = find (world, targetname, self.target);
- if (self.enemy.classname == "path_corner")
- {
- setorigin (self, self.enemy.origin + '16 16 16');
- self.target = self.enemy.target;
- }
- else
- {
- objerror ("unable to find target\n");
- remove (self);
- return;
- }
-
- if (self.spawnflags & 4)
- // start immediately even with a targetname
- teleporttrain_next ();
- else if (!self.targetname)
- // not triggered, so start immediately
- teleporttrain_next ();
- else
- self.use = teleporttrain_use;
-};
-
/*QUAKED misc_teleporttrain (.5 .5 .5) (-16 -16 -16) (16 16 16) X DONT_ROTATE START_ON_WITH_TARGETNAME INVISIBLE X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{ model("progs/teleport.mdl"); }
This was used for the final boss level in the original game. In progs_dump you can use this as a moving decoration or even target it as a spawn point for a func_monster_spawner. Make sure and select the Don't Rotate spawnflag though or you'll experience a pretty hilarious effect!
@@ -117,42 +22,143 @@ Teleporter target for final boss level. Must target a series of 'path_corner' en
It will position itself on its first target at map load.
If a targetname is set, it must be triggered to start moving, otherwise it will start automatically.
*/
-void() misc_teleporttrain =
+class misc_teleporttrain: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ //--------------------------------------------------------------
+ virtual void() teleporttrain_next =
+ {
+ local vector dir;
+
+ setorigin (this, this.enemy.origin + '16 16 16');
+
+ if (!this.target)
+ {
+ this.enemy = world;
+ return;
+ }
+
+ this.enemy = find (world, ::targetname, this.target);
+ if (this.enemy.classname == "path_corner")
+ {
+ dir = normalize ((this.enemy.origin + '16 16 16') -
+ this.origin);
+ this.velocity = dir * this.speed;
+ this.target = this.enemy.target;
+ }
+ else
+ {
+ objerror ("unable to find target\n");
+ remove (this);
+ }
+
+ teleporttrain_calcmove ();
+ };
+
+ //--------------------------------------------------------------
+ virtual void() teleporttrain_wait =
+ {
+ local float wait_time;
+
+ if (this.enemy.wait > 0)
+ wait_time = this.enemy.wait;
+ else
+ wait_time = 0.1;
+
+ this.velocity = '0 0 0';
+ this.nextthink = time + wait_time;
+ this.think = teleporttrain_next;
+ };

- if (!self.target)
+ //--------------------------------------------------------------
+ virtual void() teleporttrain_calcmove =
+ {
+ local vector delta;
+ local float len, spd;
+
+ delta = (this.enemy.origin + '16 16 16') - this.origin;
+ len = vlen (delta);
+ spd = vlen (this.velocity);
+ this.nextthink = time + (len / spd);
+ this.think = teleporttrain_wait;
+ };
+
+ //--------------------------------------------------------------
+ virtual void() teleporttrain_use =
+ {
+ if (this.velocity == '0 0 0')
+ teleporttrain_next ();
+ };
+
+ //--------------------------------------------------------------
+ virtual void() teleporttrain_find =
+ {
+ // always start positioned on the first path_corner
+ this.enemy = find (world, ::targetname, this.target);
+ if (this.enemy.classname == "path_corner")
+ {
+ setorigin (this, this.enemy.origin + '16 16 16');
+ this.target = this.enemy.target;
+ }
+ else
+ {
+ objerror ("unable to find target\n");
+ remove (this);
+ return;
+ }
+
+ if (this.spawnflags & 4)
+ // start immediately even with a targetname
+ teleporttrain_next ();
+ else if (!this.targetname)
+ // not triggered, so start immediately
+ teleporttrain_next ();
+ else
+ this.use = teleporttrain_use;
+ };
+
+ //--------------------------------------------------------------
+ void() misc_teleporttrain =
{
- objerror ("misc_teleporttrain has no target");
- remove (self);
- return;
- }
-
- if (self.speed <= 0)
- self.speed = 100;
-
- self.solid = SOLID_NOT;
- self.movetype = MOVETYPE_FLY;
- // custom custom_mdls -- dumptruck_ds
- precache_body_model ("progs/teleport.mdl");
- // invisble -- dumptruck_ds
- precache_model ("progs/s_null.spr");
- if (self.spawnflags & 8)
- // setmodel (self, "progs/s_null.spr");
- body_model ("progs/s_null.spr");
- else
- body_model ("progs/teleport.mdl");
- // precache_model ("progs/teleport.mdl");
- setsize (self, '-16 -16 -16', '16 16 16');
-
- // Causes the ball to spin around like it was originally intended to.
- if (!(self.spawnflags & 2))
- // don't spin - helpful for invisible spawner -- dumptruck_ds
- self.avelocity = '40 80 120';
- // self.avelocity = '100 200 300';
-
- self.think = teleporttrain_find;
- self.nextthink = time + 0.1;
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ this.classname = "misc_teleporttrain";
+ this.classtype = CT_MISC_TELEPORTTRAIN;
+
+ if (!this.target)
+ {
+ objerror ("misc_teleporttrain has no target");
+ remove (this);
+ return;
+ }
+
+ if (this.speed <= 0)
+ this.speed = 100;
+
+ this.solid = SOLID_NOT;
+ this.movetype = MOVETYPE_FLY;
+ // custom custom_mdls -- dumptruck_ds
+ 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');
+
+ // Causes the ball to spin around like it was
+ // originally intended to.
+ if (!(this.spawnflags & 2))
+ // don't spin - helpful for invisible
+ // spawner -- dumptruck_ds
+ this.avelocity = '40 80 120';
+ // this.avelocity = '100 200 300';
+
+ this.think = teleporttrain_find;
+ this.nextthink = time + 0.1;
+ };
};

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

Diff qc/misc/viewthing.qc

diff --git a/qc/misc/viewthing.qc b/qc/misc/viewthing.qc
index 985dd4a..21ae6e4 100644
--- a/qc/misc/viewthing.qc
+++ b/qc/misc/viewthing.qc
@@ -1,21 +1,24 @@
-//==============================================================================
+//~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>
// viewthing -- was in misc.qc
-//==============================================================================
-
-//~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>
+//~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>

/*QUAKED viewthing (0 .5 .8) (-8 -8 -8) (8 8 8)

Just for the debugging level. Don't use
*/
-void() viewthing =
+class viewthing: entity
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
+ void() viewthing =
+ {
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;

- self.movetype = MOVETYPE_NONE;
- self.solid = SOLID_NOT;
- precache_model ("progs/player.mdl");
- setmodel (self, "progs/player.mdl");
+ this.classname = "viewthing";
+ this.classtype = CT_MISC_VIEWTHING;
+ this.movetype = MOVETYPE_NONE;
+ this.solid = SOLID_NOT;
+ precache_model ("progs/player.mdl");
+ setmodel (this, "progs/player.mdl");
+ };
};

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 52df0bc..63cf23d 100644
--- a/qc/monsters/zombie.qc
+++ b/qc/monsters/zombie.qc
@@ -693,34 +693,6 @@ void() zombie_start = // determine if zombie is to be lying down, or standing
self.th_stand = alt_zombie_stand1;
};

-// void() zombie_start2 = //unused in progs_dump -- dumptruck_ds
-// {
-// local vector org;
-// local entity teldeath;
-//
-// if (self.style)
-// {
-// makevectors (self.angles);
-// org = self.origin + 16 * v_forward;
-// spawn_tfog (org);
-// teldeath = spawn();
-// teldeath.origin = org;
-// teldeath.owner = self;
-// // teldeath.think = sf64_teledeath; -- not used in progs_dump -- dumptruck_ds
-// teldeath.nextthink = time + 0.1;
-// }
-//
-// self.solid = SOLID_SLIDEBOX;
-// self.movetype = MOVETYPE_STEP;
-//
-// setmodel (self, "progs/zombie.mdl");
-//
-// setsize (self, '-16 -16 -24', '16 16 40');
-// self.health = 61;
-//
-// walkmonster_start();
-// };
-
//============================================================================

/*QUAKED monster_zombie (1 0 0) (-16 -16 -24) (16 16 32) CRUCIFIED AMBUSH CRUCIFIED_MOTIONLESS TRIGGER_SPAWNED SPAWN_SLEEPING 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

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

Diff qc/newflags.qc

diff --git a/qc/newflags.qc b/qc/newflags.qc
index a7ac7ba..ef462ad 100644
--- a/qc/newflags.qc
+++ b/qc/newflags.qc
@@ -1,11 +1,9 @@
-/*
-========================================================================
-
-NEW SPAWNFLAGS FOR ALL ENTITIES
+//==============================================================================
+// NEW SPAWNFLAGS FOR ALL ENTITIES
+//==============================================================================

+/*
========================================================================
-
-
This file was created for progs_dump by Ian "iw" Walshaw, August 2019.

It defines functions which can be called to implement the following new
@@ -52,7 +50,6 @@ The new "Not on Hard Only" and "Not on Nightmare Only" spawnflags allow
the mapper to exclude an entity from one of these skill levels without
affecting the other.

-
========================================================================
*/

@@ -71,14 +68,12 @@ float total_not_on_skill3;
// TRUE if the developer summary has been printed.
float done_inhibition_summary;

-/*
-================
-InitNewSpawnflags
-
-This function is intended to be called from the top of the worldspawn
-function (in world.qc). -- iw
-================
-*/
+//----------------------------------------------------------------------
+// InitNewSpawnflags
+//
+// This function is intended to be called from the top of the worldspawn
+// function (in world.qc). -- iw
+//----------------------------------------------------------------------
void() InitNewSpawnflags =
{
// Initialize the global variables.
@@ -96,7 +91,7 @@ void() InitNewSpawnflags =
};

/*
-================
+------------------------------------------------------------------------
SUB_Inhibit

This function is intended to be called from the top of every spawn
@@ -109,7 +104,7 @@ If the entity's spawnflags mean that it should be inhibited in the
current game mode or on the current skill level, this function will
remove the entity and return TRUE, otherwise this function will take no
action and return FALSE. -- iw
-================
+------------------------------------------------------------------------
*/
float() SUB_Inhibit =
{
@@ -149,15 +144,13 @@ float() SUB_Inhibit =
return FALSE;
};

-/*
-================
-PrintInhibitionTotal
-
-This just dprints the summary line about the total number of entities
-inhibited by one of the new spawnflags (see PrintInhibitionSummary
-below). -- iw
-================
-*/
+//----------------------------------------------------------------------
+// PrintInhibitionTotal
+//
+// This just dprints the summary line about the total number of entities
+// inhibited by one of the new spawnflags (see PrintInhibitionSummary
+// below). -- iw
+//----------------------------------------------------------------------
void(float total, string spawnflag_name) PrintInhibitionTotal =
{
if (total == 0)
@@ -171,7 +164,7 @@ void(float total, string spawnflag_name) PrintInhibitionTotal =
};

/*
-================
+------------------------------------------------------------------------
PrintInhibitionSummary

This function is intended to be called from the top of the StartFrame
@@ -183,7 +176,7 @@ function (in world.qc), like this:
The engine already logs a developer message about the number of entities
inhibited by the built-in spawnflags; this function logs a message about
the number of entities inhibited by the new spawnflags. -- iw
-================
+------------------------------------------------------------------------
*/
void() PrintInhibitionSummary =
{

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

Diff qc/player.qc

diff --git a/qc/player.qc b/qc/player.qc
deleted file mode 100644
index 5ae36f4..0000000
--- a/qc/player.qc
+++ /dev/null
@@ -1,747 +0,0 @@
-//==============================================================================
-// player
-//==============================================================================
-
-// prototypes
-void() bubble_bob;
-void() player_run;
-void() player_diea1;
-void() player_dieb1;
-void() player_diec1;
-void() player_died1;
-void() player_diee1;
-void() player_die_ax1;
-
-// frame macros
-$cd id1/models/player_4
-$origin 0 -6 24
-$base base
-$skin skin
-
-//----------------------------------------------------------------------
-// running
-$frame axrun1 axrun2 axrun3 axrun4 axrun5 axrun6
-$frame rockrun1 rockrun2 rockrun3 rockrun4 rockrun5 rockrun6
-
-//----------------------------------------------------------------------
-// standing
-$frame stand1 stand2 stand3 stand4 stand5
-$frame axstnd1 axstnd2 axstnd3 axstnd4 axstnd5 axstnd6
-$frame axstnd7 axstnd8 axstnd9 axstnd10 axstnd11 axstnd12
-
-//----------------------------------------------------------------------
-// pain
-$frame axpain1 axpain2 axpain3 axpain4 axpain5 axpain6
-$frame pain1 pain2 pain3 pain4 pain5 pain6
-
-//----------------------------------------------------------------------
-// death
-$frame axdeth1 axdeth2 axdeth3 axdeth4 axdeth5 axdeth6
-$frame axdeth7 axdeth8 axdeth9
-$frame deatha1 deatha2 deatha3 deatha4 deatha5 deatha6 deatha7 deatha8
-$frame deatha9 deatha10 deatha11
-$frame deathb1 deathb2 deathb3 deathb4 deathb5 deathb6 deathb7 deathb8
-$frame deathb9
-$frame deathc1 deathc2 deathc3 deathc4 deathc5 deathc6 deathc7 deathc8
-$frame deathc9 deathc10 deathc11 deathc12 deathc13 deathc14 deathc15
-$frame deathd1 deathd2 deathd3 deathd4 deathd5 deathd6 deathd7
-$frame deathd8 deathd9
-$frame deathe1 deathe2 deathe3 deathe4 deathe5 deathe6 deathe7
-$frame deathe8 deathe9
-
-//----------------------------------------------------------------------
-// attacks
-$frame nailatt1 nailatt2
-$frame light1 light2
-$frame rockatt1 rockatt2 rockatt3 rockatt4 rockatt5 rockatt6
-$frame shotatt1 shotatt2 shotatt3 shotatt4 shotatt5 shotatt6
-$frame axatt1 axatt2 axatt3 axatt4 axatt5 axatt6
-$frame axattb1 axattb2 axattb3 axattb4 axattb5 axattb6
-$frame axattc1 axattc2 axattc3 axattc4 axattc5 axattc6
-$frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
-
-//======================================================================
-
-void() player_stand1 = [$axstnd1, player_stand1]
-{
- self.weaponframe = 0;
- if (self.velocity_x || self.velocity_y)
- {
- self.walkframe = 0;
- player_run ();
- return;
- }
-
- if (self.weapon == IT_AXE)
- {
- if (self.walkframe >= 12)
- self.walkframe = 0;
- self.frame = $axstnd1 + self.walkframe;
- }
- else
- {
- if (self.walkframe >= 5)
- self.walkframe = 0;
- self.frame = $stand1 + self.walkframe;
- }
- self.walkframe = self.walkframe + 1;
-};
-
-void() player_run = [$rockrun1, player_run]
-{
- self.weaponframe = 0;
- if (!self.velocity_x && !self.velocity_y)
- {
- self.walkframe = 0;
- player_stand1 ();
- return;
- }
-
- if (self.weapon == IT_AXE)
- {
- if (self.walkframe == 6)
- self.walkframe = 0;
- self.frame = $axrun1 + self.walkframe;
- }
- else
- {
- if (self.walkframe == 6)
- self.walkframe = 0;
- self.frame = self.frame + self.walkframe;
- }
- self.walkframe = self.walkframe + 1;
-};
-
-void() player_shot1 = [$shotatt1, player_shot2]
-{
- self.weaponframe = 1;
- self.effects = self.effects | EF_MUZZLEFLASH;
-};
-void() player_shot2 = [$shotatt2, player_shot3] { self.weaponframe = 2; };
-void() player_shot3 = [$shotatt3, player_shot4] { self.weaponframe = 3; };
-void() player_shot4 = [$shotatt4, player_shot5] { self.weaponframe = 4; };
-void() player_shot5 = [$shotatt5, player_shot6] { self.weaponframe = 5; };
-void() player_shot6 = [$shotatt6, player_run] { self.weaponframe = 6; };
-
-void() player_axe1 = [$axatt1, player_axe2] { self.weaponframe = 1; };
-void() player_axe2 = [$axatt2, player_axe3] { self.weaponframe = 2; };
-void() player_axe3 = [$axatt3, player_axe4]
-{
- self.weaponframe = 3;
- W_FireAxe ();
-};
-void() player_axe4 = [$axatt4, player_run] { self.weaponframe = 4; };
-
-void() player_axeb1 = [$axattb1, player_axeb2] { self.weaponframe = 5; };
-void() player_axeb2 = [$axattb2, player_axeb3] { self.weaponframe = 6; };
-void() player_axeb3 = [$axattb3, player_axeb4]
-{
- self.weaponframe = 7;
- W_FireAxe ();
-};
-void() player_axeb4 = [$axattb4, player_run] { self.weaponframe = 8; };
-
-void() player_axec1 = [$axattc1, player_axec2] { self.weaponframe = 1; };
-void() player_axec2 = [$axattc2, player_axec3] { self.weaponframe = 2; };
-void() player_axec3 = [$axattc3, player_axec4]
-{
- self.weaponframe = 3;
- W_FireAxe ();
-};
-void() player_axec4 = [$axattc4, player_run] { self.weaponframe = 4; };
-
-void() player_axed1 = [$axattd1, player_axed2] { self.weaponframe = 5; };
-void() player_axed2 = [$axattd2, player_axed3] { self.weaponframe = 6; };
-void() player_axed3 = [$axattd3, player_axed4]
-{
- self.weaponframe = 7;
- W_FireAxe ();
-};
-void() player_axed4 = [$axattd4, player_run] { self.weaponframe = 8; };
-
-//======================================================================
-
-// TODO CEV
-
-void() player_nail1 =[$nailatt1, player_nail2 ]
-{
- self.effects = self.effects | EF_MUZZLEFLASH;
-
- if (!self.button0)
- {player_run ();return;}
- self.weaponframe = self.weaponframe + 1;
- if (self.weaponframe == 9)
- self.weaponframe = 1;
- SuperDamageSound();
- W_FireSpikes (4);
- self.attack_finished = time + 0.2;
-};
-void() player_nail2 =[$nailatt2, player_nail1 ]
-{
- self.effects = self.effects | EF_MUZZLEFLASH;
-
- if (!self.button0)
- {player_run ();return;}
- self.weaponframe = self.weaponframe + 1;
- if (self.weaponframe == 9)
- self.weaponframe = 1;
- SuperDamageSound();
- W_FireSpikes (-4);
- self.attack_finished = time + 0.2;
-};
-
-//======================================================================
-
-void() player_light1 =[$light1, player_light2 ]
-{
- self.effects = self.effects | EF_MUZZLEFLASH;
-
- if (!self.button0)
- {player_run ();return;}
- self.weaponframe = self.weaponframe + 1;
- if (self.weaponframe == 5)
- self.weaponframe = 1;
- SuperDamageSound();
- W_FireLightning();
- self.attack_finished = time + 0.2;
-};
-void() player_light2 =[$light2, player_light1 ]
-{
- self.effects = self.effects | EF_MUZZLEFLASH;
-
- if (!self.button0)
- {player_run ();return;}
- self.weaponframe = self.weaponframe + 1;
- if (self.weaponframe == 5)
- self.weaponframe = 1;
- SuperDamageSound();
- W_FireLightning();
- self.attack_finished = time + 0.2;
-};
-
-//======================================================================
-
-void() player_rocket1 =[$rockatt1, player_rocket2 ] {self.weaponframe=1;
-self.effects = self.effects | EF_MUZZLEFLASH;};
-void() player_rocket2 =[$rockatt2, player_rocket3 ] {self.weaponframe=2;};
-void() player_rocket3 =[$rockatt3, player_rocket4 ] {self.weaponframe=3;};
-void() player_rocket4 =[$rockatt4, player_rocket5 ] {self.weaponframe=4;};
-void() player_rocket5 =[$rockatt5, player_rocket6 ] {self.weaponframe=5;};
-void() player_rocket6 =[$rockatt6, player_run ] {self.weaponframe=6;};
-void(float num_bubbles) DeathBubbles;
-
-void() PainSound =
-{
-local float rs;
-
- if (self.health < 0)
- return;
-
- if (damage_attacker.classname == "teledeath")
- {
- sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
- return;
- }
-
-// water pain sounds
- if (self.watertype == CONTENT_WATER && self.waterlevel == 3)
- {
- DeathBubbles(1);
- if (random() > 0.5)
- sound (self, CHAN_VOICE, "player/drown1.wav", 1, ATTN_NORM);
- else
- sound (self, CHAN_VOICE, "player/drown2.wav", 1, ATTN_NORM);
- return;
- }
-
-// slime pain sounds
- if (self.watertype == CONTENT_SLIME)
- {
-// FIX ME put in some steam here
-// 1998-08-10 Player gulps bubbles when hurt in slime by Maddes start
- if (self.waterlevel == 3)
- DeathBubbles(1);
-// 1998-08-10 Player gulps bubbles when hurt in slime by Maddes end
- if (random() > 0.5)
- sound (self, CHAN_VOICE, "player/lburn1.wav", 1, ATTN_NORM);
- else
- sound (self, CHAN_VOICE, "player/lburn2.wav", 1, ATTN_NORM);
- return;
- }
-
- if (self.watertype == CONTENT_LAVA)
- {
- if (random() > 0.5)
- sound (self, CHAN_VOICE, "player/lburn1.wav", 1, ATTN_NORM);
- else
- sound (self, CHAN_VOICE, "player/lburn2.wav", 1, ATTN_NORM);
- return;
- }
-
- if (self.pain_finished > time)
- {
- self.axhitme = 0;
- return;
- }
- self.pain_finished = time + 0.5;
-
-// don't make multiple pain sounds right after each other
-
-// ax pain sound
- if (self.axhitme == 1)
- {
- self.axhitme = 0;
- sound (self, CHAN_VOICE, "player/axhit1.wav", 1, ATTN_NORM);
- return;
- }
-
-
- rs = rint((random() * 5) + 1);
-
- self.noise = "";
- if (rs == 1)
- self.noise = "player/pain1.wav";
- else if (rs == 2)
- self.noise = "player/pain2.wav";
- else if (rs == 3)
- self.noise = "player/pain3.wav";
- else if (rs == 4)
- self.noise = "player/pain4.wav";
- else if (rs == 5)
- self.noise = "player/pain5.wav";
- else
- self.noise = "player/pain6.wav";
-
- sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
- return;
-};
-
-void() player_pain1 = [ $pain1, player_pain2 ] {PainSound();self.weaponframe=0;};
-void() player_pain2 = [ $pain2, player_pain3 ] {};
-void() player_pain3 = [ $pain3, player_pain4 ] {};
-void() player_pain4 = [ $pain4, player_pain5 ] {};
-void() player_pain5 = [ $pain5, player_pain6 ] {};
-void() player_pain6 = [ $pain6, player_run ] {};
-
-void() player_axpain1 = [ $axpain1, player_axpain2 ] {PainSound();self.weaponframe=0;};
-void() player_axpain2 = [ $axpain2, player_axpain3 ] {};
-void() player_axpain3 = [ $axpain3, player_axpain4 ] {};
-void() player_axpain4 = [ $axpain4, player_axpain5 ] {};
-void() player_axpain5 = [ $axpain5, player_axpain6 ] {};
-void() player_axpain6 = [ $axpain6, player_run ] {};
-
-void(entity attacker, float damage) player_pain =
-{
- if (self.weaponframe)
- return;
-
- if (self.invisible_finished > time)
- return; // eyes don't have pain frames
-
- if (self.weapon == IT_AXE)
- player_axpain1 ();
- else
- player_pain1 ();
-};
-
-void() DeathBubblesSpawn =
-{
-local entity bubble;
- if ((self.owner.waterlevel != 3) && (self.owner.health > 0)) // 1998-08-14 Improved bubble spawn by Maddes
-// 1998-08-14 Bubblespawner remove fix by Perged start
-{
- remove(self); // remove bubble spawner
-// 1998-08-14 Bubblespawner remove fix by Perged end
- return;
-} // 1998-08-14 Bubblespawner remove fix by Perged return;
- bubble = spawn();
- setmodel (bubble, "progs/s_bubble.spr");
- setorigin (bubble, self.owner.origin + '0 0 24');
- bubble.movetype = MOVETYPE_NOCLIP;
- bubble.solid = SOLID_NOT;
- bubble.velocity = '0 0 15';
- bubble.nextthink = time + 0.5;
- bubble.think = bubble_bob;
- bubble.classname = "bubble";
- bubble.frame = 0;
- bubble.cnt = 0;
- setsize (bubble, '-8 -8 -8', '8 8 8');
-// 1998-08-14 Improved bubble spawn by Maddes start
-// self.nextthink = time + 0.1;
- self.nextthink = time + 0.01;
-// 1998-08-14 Improved bubble spawn by Maddes end
- self.think = DeathBubblesSpawn;
- self.air_finished = self.air_finished + 1;
- if (self.air_finished >= self.bubble_count)
- remove(self);
-};
-
-void(float num_bubbles) DeathBubbles =
-{
-local entity bubble_spawner;
-
- bubble_spawner = spawn();
- setorigin (bubble_spawner, self.origin);
- bubble_spawner.movetype = MOVETYPE_NONE;
- bubble_spawner.solid = SOLID_NOT;
-// 1998-08-14 Improved bubble spawn by Maddes start
-// bubble_spawner.nextthink = time + 0.1;
- bubble_spawner.nextthink = time + 0.01;
-// 1998-08-14 Improved bubble spawn by Maddes end
- bubble_spawner.think = DeathBubblesSpawn;
- bubble_spawner.air_finished = 0;
- bubble_spawner.owner = self;
- bubble_spawner.bubble_count = num_bubbles;
-// return; // 1998-08-14 unnecessary by Maddes
-};
-
-
-void() DeathSound =
-{
-local float rs;
-
- // water death sounds
- if (self.waterlevel == 3)
- {
- DeathBubbles(20);
- sound (self, CHAN_VOICE, "player/h2odeath.wav", 1, ATTN_NONE);
- return;
- }
-
- rs = rint ((random() * 4) + 1);
- if (rs == 1)
- self.noise = "player/death1.wav";
- if (rs == 2)
- self.noise = "player/death2.wav";
- if (rs == 3)
- self.noise = "player/death3.wav";
- if (rs == 4)
- self.noise = "player/death4.wav";
- if (rs == 5)
- self.noise = "player/death5.wav";
-
- sound (self, CHAN_VOICE, self.noise, 1, ATTN_NONE);
- return;
-};
-
-
-void() PlayerDead =
-{
- self.nextthink = -1;
-// allow respawn after a certain time
- self.deadflag = DEAD_DEAD;
-};
-
-vector(float dm) VelocityForDamage =
-{
- local vector v;
-
- v_x = 100 * crandom();
- v_y = 100 * crandom();
- v_z = 200 + 100 * random();
-
- if (dm > -50)
- {
-// dprint ("level 1\n");
- v = v * 0.7;
- }
- else if (dm > -200)
- {
-// dprint ("level 3\n");
- v = v * 2;
- }
- else
- v = v * 10;
-
- return v;
-};
-
-void(string gibname, float dm) ThrowGib =
-{
- local entity new;
-
- new = spawn();
- new.origin = self.origin;
- setmodel (new, gibname);
- setsize (new, '0 0 0', '0 0 0');
- new.velocity = VelocityForDamage (dm);
- new.movetype = MOVETYPE_BOUNCE;
- new.solid = SOLID_NOT;
- new.avelocity_x = random()*600;
- new.avelocity_y = random()*600;
- new.avelocity_z = random()*600;
- new.think = SUB_Remove;
- new.ltime = time;
- new.nextthink = time + 10 + random()*10;
- new.frame = 0;
- new.flags = 0;
-};
-
-void(string gibname, float dm) ThrowHead =
-{
- setmodel (self, gibname);
- self.skin = self.skin_head; // dumptruck_ds custom_mdl changes
- if !(self.skin_head)
- self.skin_head = 0;
- // end dumptruck_ds
- self.frame = 0;
- self.nextthink = -1;
- self.movetype = MOVETYPE_BOUNCE;
- self.takedamage = DAMAGE_NO;
- self.solid = SOLID_NOT;
- self.view_ofs = '0 0 8';
- setsize (self, '-16 -16 0', '16 16 56');
- self.velocity = VelocityForDamage (dm);
- self.origin_z = self.origin_z - 24;
- self.flags = self.flags - (self.flags & FL_ONGROUND);
- self.avelocity = crandom() * '0 600 0';
-};
-
-
-void() GibPlayer =
-{
- ThrowHead ("progs/h_player.mdl", self.health);
- ThrowGib ("progs/gib1.mdl", self.health);
- ThrowGib ("progs/gib2.mdl", self.health);
- ThrowGib ("progs/gib3.mdl", self.health);
-
- self.deadflag = DEAD_DEAD;
-
- if (damage_attacker.classname == "teledeath")
- {
- sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
- return;
- }
-
- if (damage_attacker.classname == "teledeath2")
- {
- sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
- return;
- }
-
- if (random() < 0.5)
- sound (self, CHAN_VOICE, "player/gib.wav", 1, ATTN_NONE);
- else
- sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NONE);
-};
-
-void() PlayerDie =
-{
- local float i;
-
-// 1998-07-23 Palette shift when player dies with quad/pentagram fix by Maddes start
-// self.items = self.items - (self.items & IT_INVISIBILITY);
- self.items = self.items - (self.items & (IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD) );
-// 1998-07-23 Palette shift when player dies with quad/pentagram fix by Maddes end self.invisible_finished = 0; // don't die as eyes
- self.invincible_finished = 0;
- self.super_damage_finished = 0;
- self.radsuit_finished = 0;
- self.effects = 0; // 1998-07-23 Glowing corpse of players which had quad/pentagram until respawn fix by Maddes
- self.modelindex = modelindex_player; // don't use eyes
-
- if (deathmatch || coop)
- DropBackpack();
-
- self.weaponmodel="";
- self.view_ofs = '0 0 -8';
- self.deadflag = DEAD_DYING;
- self.solid = SOLID_NOT;
- self.flags = self.flags - (self.flags & FL_ONGROUND);
- self.movetype = MOVETYPE_TOSS;
- if (self.velocity_z < 10)
- self.velocity_z = self.velocity_z + random()*300;
-
- if (self.health < -40)
- {
- GibPlayer ();
- return;
- }
-
- DeathSound();
-
- self.angles_x = 0;
- self.angles_z = 0;
-
- if (self.weapon == IT_AXE)
- {
- player_die_ax1 ();
- return;
- }
-
- i = cvar("temp1");
- if (!i)
- i = 1 + floor(random()*6);
-
- if (i == 1)
- player_diea1();
- else if (i == 2)
- player_dieb1();
- else if (i == 3)
- player_diec1();
- else if (i == 4)
- player_died1();
- else
- player_diee1();
-
-};
-
-void() set_suicide_frame =
-{ // used by klill command and diconnect command
- if (self.model != "progs/player.mdl")
- return; // allready gibbed
- self.frame = $deatha11;
- self.solid = SOLID_NOT;
- self.movetype = MOVETYPE_TOSS;
- self.deadflag = DEAD_DEAD;
- self.nextthink = -1;
-};
-
-
-void() player_diea1 = [ $deatha1, player_diea2 ] {};
-void() player_diea2 = [ $deatha2, player_diea3 ] {};
-void() player_diea3 = [ $deatha3, player_diea4 ] {};
-void() player_diea4 = [ $deatha4, player_diea5 ] {};
-void() player_diea5 = [ $deatha5, player_diea6 ] {};
-void() player_diea6 = [ $deatha6, player_diea7 ] {};
-void() player_diea7 = [ $deatha7, player_diea8 ] {};
-void() player_diea8 = [ $deatha8, player_diea9 ] {};
-void() player_diea9 = [ $deatha9, player_diea10 ] {};
-void() player_diea10 = [ $deatha10, player_diea11 ] {};
-void() player_diea11 = [ $deatha11, player_diea11 ] {PlayerDead();};
-
-void() player_dieb1 = [ $deathb1, player_dieb2 ] {};
-void() player_dieb2 = [ $deathb2, player_dieb3 ] {};
-void() player_dieb3 = [ $deathb3, player_dieb4 ] {};
-void() player_dieb4 = [ $deathb4, player_dieb5 ] {};
-void() player_dieb5 = [ $deathb5, player_dieb6 ] {};
-void() player_dieb6 = [ $deathb6, player_dieb7 ] {};
-void() player_dieb7 = [ $deathb7, player_dieb8 ] {};
-void() player_dieb8 = [ $deathb8, player_dieb9 ] {};
-void() player_dieb9 = [ $deathb9, player_dieb9 ] {PlayerDead();};
-
-void() player_diec1 = [ $deathc1, player_diec2 ] {};
-void() player_diec2 = [ $deathc2, player_diec3 ] {};
-void() player_diec3 = [ $deathc3, player_diec4 ] {};
-void() player_diec4 = [ $deathc4, player_diec5 ] {};
-void() player_diec5 = [ $deathc5, player_diec6 ] {};
-void() player_diec6 = [ $deathc6, player_diec7 ] {};
-void() player_diec7 = [ $deathc7, player_diec8 ] {};
-void() player_diec8 = [ $deathc8, player_diec9 ] {};
-void() player_diec9 = [ $deathc9, player_diec10 ] {};
-void() player_diec10 = [ $deathc10, player_diec11 ] {};
-void() player_diec11 = [ $deathc11, player_diec12 ] {};
-void() player_diec12 = [ $deathc12, player_diec13 ] {};
-void() player_diec13 = [ $deathc13, player_diec14 ] {};
-void() player_diec14 = [ $deathc14, player_diec15 ] {};
-void() player_diec15 = [ $deathc15, player_diec15 ] {PlayerDead();};
-
-void() player_died1 = [ $deathd1, player_died2 ] {};
-void() player_died2 = [ $deathd2, player_died3 ] {};
-void() player_died3 = [ $deathd3, player_died4 ] {};
-void() player_died4 = [ $deathd4, player_died5 ] {};
-void() player_died5 = [ $deathd5, player_died6 ] {};
-void() player_died6 = [ $deathd6, player_died7 ] {};
-void() player_died7 = [ $deathd7, player_died8 ] {};
-void() player_died8 = [ $deathd8, player_died9 ] {};
-void() player_died9 = [ $deathd9, player_died9 ] {PlayerDead();};
-
-void() player_diee1 = [ $deathe1, player_diee2 ] {};
-void() player_diee2 = [ $deathe2, player_diee3 ] {};
-void() player_diee3 = [ $deathe3, player_diee4 ] {};
-void() player_diee4 = [ $deathe4, player_diee5 ] {};
-void() player_diee5 = [ $deathe5, player_diee6 ] {};
-void() player_diee6 = [ $deathe6, player_diee7 ] {};
-void() player_diee7 = [ $deathe7, player_diee8 ] {};
-void() player_diee8 = [ $deathe8, player_diee9 ] {};
-void() player_diee9 = [ $deathe9, player_diee9 ] {PlayerDead();};
-
-void() player_die_ax1 = [ $axdeth1, player_die_ax2 ] {};
-void() player_die_ax2 = [ $axdeth2, player_die_ax3 ] {};
-void() player_die_ax3 = [ $axdeth3, player_die_ax4 ] {};
-void() player_die_ax4 = [ $axdeth4, player_die_ax5 ] {};
-void() player_die_ax5 = [ $axdeth5, player_die_ax6 ] {};
-void() player_die_ax6 = [ $axdeth6, player_die_ax7 ] {};
-void() player_die_ax7 = [ $axdeth7, player_die_ax8 ] {};
-void() player_die_ax8 = [ $axdeth8, player_die_ax9 ] {};
-void() player_die_ax9 = [ $axdeth9, player_die_ax9 ] {PlayerDead();};
-
-//======================================================================
-
-/*QUAKED player_dead_axe (0 0.5 0.8) (-16 -16 -24) (16 16 32) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
- model ({"path":"progs/player.mdl","frame":49});
-}
-*/
-void() player_dead_axe =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/player.mdl");
- setmodel (self, "progs/player.mdl");
- self.frame = $axdeth9;
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize (self,'-38.72 -5.83 -50.45','28.73 33.85 30');
- }
- else
- {
- self.solid = SOLID_NOT;
- }
-};
-
-/*QUAKED player_dead_face_down (0 0.5 0.8) (-16 -16 -24) (16 16 32) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
- model ({"path":"progs/player.mdl","frame":84});
-}
-*/
-void() player_dead_face_down =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/player.mdl");
- setmodel (self, "progs/player.mdl");
- self.frame = $deathc14;
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize (self,'-50.28 -23.55 -49.85','30.66 14.49 30');
- }
- else
- {
- self.solid = SOLID_NOT;
- }
-};
-
-/*QUAKED player_dead_on_side (0 0.5 0.8) (-16 -16 -24) (16 16 32) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-{
- model ({"path":"progs/player.mdl","frame":102});
-}
-*/
-void() player_dead_on_side =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- precache_model ("progs/player.mdl");
- setmodel (self, "progs/player.mdl");
- self.frame = $deathe9;
-
- if (self.spawnflags & 1)
- {
- self.solid = SOLID_BBOX;
- setsize (self,'-38.72 -5.83 -50.45','28.73 33.85 30');
- }
- else
- {
- self.solid = SOLID_NOT;
- }
-};
-// END Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds

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
new file mode 100644
index 0000000..be90a5e
--- /dev/null
+++ b/qc/player/player.qc
@@ -0,0 +1,1043 @@
+//==============================================================================
+// player
+//==============================================================================
+
+// prototypes
+void(float num_bubbles) PlayerDeathBubbles;
+void() player_run;
+void() player_diea1;
+void() player_dieb1;
+void() player_diec1;
+void() player_died1;
+void() player_diee1;
+void() player_die_ax1;
+
+//======================================================================
+// Player ammo limits, weapon selection
+//======================================================================
+
+//----------------------------------------------------------------------
+// PlayerSetCurrentAmmo -- was W_SetCurrentAmmo in weapons.qc
+//----------------------------------------------------------------------
+void() PlayerSetCurrentAmmo =
+{
+ // get out of any weapon firing states
+ player_run ();
+
+ self.items = self.items - (self.items & (IT_SHELLS | IT_NAILS |
+ IT_ROCKETS | IT_CELLS));
+
+ if (self.weapon == IT_AXE)
+ {
+ self.currentammo = 0;
+ self.weaponmodel = "progs/v_axe.mdl";
+ self.weaponframe = 0;
+ }
+ else if (self.weapon == IT_SHOTGUN)
+ {
+ self.currentammo = self.ammo_shells;
+ self.weaponmodel = "progs/v_shot.mdl";
+ self.weaponframe = 0;
+ self.items = self.items | IT_SHELLS;
+ }
+ else if (self.weapon == IT_SUPER_SHOTGUN)
+ {
+ self.currentammo = self.ammo_shells;
+ self.weaponmodel = "progs/v_shot2.mdl";
+ self.weaponframe = 0;
+ self.items = self.items | IT_SHELLS;
+ }
+ else if (self.weapon == IT_NAILGUN)
+ {
+ self.currentammo = self.ammo_nails;
+ self.weaponmodel = "progs/v_nail.mdl";
+ self.weaponframe = 0;
+ self.items = self.items | IT_NAILS;
+ }
+ else if (self.weapon == IT_SUPER_NAILGUN)
+ {
+ self.currentammo = self.ammo_nails;
+ self.weaponmodel = "progs/v_nail2.mdl";
+ self.weaponframe = 0;
+ self.items = self.items | IT_NAILS;
+ }
+ else if (self.weapon == IT_GRENADE_LAUNCHER)
+ {
+ self.currentammo = self.ammo_rockets;
+ self.weaponmodel = "progs/v_rock.mdl";
+ self.weaponframe = 0;
+ self.items = self.items | IT_ROCKETS;
+ }
+ else if (self.weapon == IT_ROCKET_LAUNCHER)
+ {
+ self.currentammo = self.ammo_rockets;
+ self.weaponmodel = "progs/v_rock2.mdl";
+ self.weaponframe = 0;
+ self.items = self.items | IT_ROCKETS;
+ }
+ else if (self.weapon == IT_LIGHTNING)
+ {
+ self.currentammo = self.ammo_cells;
+ self.weaponmodel = "progs/v_light.mdl";
+ self.weaponframe = 0;
+ self.items = self.items | IT_CELLS;
+ }
+ else
+ {
+ self.currentammo = 0;
+ self.weaponmodel = "";
+ self.weaponframe = 0;
+ }
+};
+
+//----------------------------------------------------------------------
+float() PlayerCheckNoAmmo =
+{
+ if (self.currentammo > 0)
+ return TRUE;
+
+ if (self.weapon == IT_AXE)
+ return TRUE;
+
+ self.weapon = PlayerBestWeapon ();
+
+ PlayerSetCurrentAmmo ();
+
+ // drop the weapon down
+ return FALSE;
+};
+
+//----------------------------------------------------------------------
+// PlayerBestWeapon -- was W_BestWeapon in weapons.qc
+//----------------------------------------------------------------------
+float() PlayerBestWeapon =
+{
+ if (self.waterlevel <= WATERLEVEL_FEET && self.ammo_cells >= 1 &&
+ (self.items & IT_LIGHTNING))
+ {
+ return IT_LIGHTNING;
+ }
+
+ if (self.ammo_nails >= 2 && (self.items & IT_SUPER_NAILGUN))
+ return IT_SUPER_NAILGUN;
+
+ if (self.ammo_shells >= 2 && (self.items & IT_SUPER_SHOTGUN))
+ return IT_SUPER_SHOTGUN;
+
+ if (self.ammo_nails >= 1 && (self.items & IT_NAILGUN))
+ return IT_NAILGUN;
+
+ if (self.ammo_shells >= 1 && (self.items & IT_SHOTGUN))
+ return IT_SHOTGUN;
+
+ return IT_AXE;
+};
+
+//======================================================================
+// Player thinking
+//======================================================================
+
+//----------------------------------------------------------------------
+// PlayerAttack -- An attack impulse can be triggered now
+//----------------------------------------------------------------------
+void() PlayerAttack =
+{
+ local float r;
+
+ if (!PlayerCheckNoAmmo())
+ return;
+
+ // calculate forward angle for velocity
+ makevectors (self.v_angle);
+ // wake monsters up
+ self.show_hostile = time + 1;
+
+ if (self.weapon == IT_AXE)
+ {
+ sound (self, CHAN_WEAPON, "weapons/ax1.wav", 1, ATTN_NORM);
+ r = random ();
+ 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 + 0.5;
+ }
+ else if (self.weapon == IT_SHOTGUN)
+ {
+ player_shot1 ();
+ W_FireShotgun ();
+ self.attack_finished = time + 0.5;
+ }
+ else if (self.weapon == IT_SUPER_SHOTGUN)
+ {
+ player_shot1 ();
+ W_FireSuperShotgun ();
+ self.attack_finished = time + 0.7;
+ }
+ else if (self.weapon == IT_NAILGUN)
+ {
+ player_nail1 ();
+ }
+ else if (self.weapon == IT_SUPER_NAILGUN)
+ {
+ player_nail1 ();
+ }
+ else if (self.weapon == IT_GRENADE_LAUNCHER)
+ {
+ player_rocket1 ();
+ W_FireGrenade ();
+ self.attack_finished = time + 0.6;
+ }
+ else if (self.weapon == IT_ROCKET_LAUNCHER)
+ {
+ player_rocket1 ();
+ W_FireRocket ();
+ self.attack_finished = time + 0.8;
+ }
+ else if (self.weapon == IT_LIGHTNING)
+ {
+ player_light1 ();
+ self.attack_finished = time + 0.1;
+ sound (self, CHAN_AUTO, "weapons/lstart.wav", 1, ATTN_NORM);
+ }
+};
+
+//======================================================================
+// Player Frame Macros
+//======================================================================
+$cd id1/models/player_4
+$origin 0 -6 24
+$base base
+$skin skin
+
+//----------------------------------------------------------------------
+// running
+$frame axrun1 axrun2 axrun3 axrun4 axrun5 axrun6
+$frame rockrun1 rockrun2 rockrun3 rockrun4 rockrun5 rockrun6
+
+//----------------------------------------------------------------------
+// standing
+$frame stand1 stand2 stand3 stand4 stand5
+$frame axstnd1 axstnd2 axstnd3 axstnd4 axstnd5 axstnd6
+$frame axstnd7 axstnd8 axstnd9 axstnd10 axstnd11 axstnd12
+
+//----------------------------------------------------------------------
+// pain
+$frame axpain1 axpain2 axpain3 axpain4 axpain5 axpain6
+$frame pain1 pain2 pain3 pain4 pain5 pain6
+
+//----------------------------------------------------------------------
+// death
+$frame axdeth1 axdeth2 axdeth3 axdeth4 axdeth5 axdeth6
+$frame axdeth7 axdeth8 axdeth9
+$frame deatha1 deatha2 deatha3 deatha4 deatha5 deatha6 deatha7 deatha8
+$frame deatha9 deatha10 deatha11
+$frame deathb1 deathb2 deathb3 deathb4 deathb5 deathb6 deathb7 deathb8
+$frame deathb9
+$frame deathc1 deathc2 deathc3 deathc4 deathc5 deathc6 deathc7 deathc8
+$frame deathc9 deathc10 deathc11 deathc12 deathc13 deathc14 deathc15
+$frame deathd1 deathd2 deathd3 deathd4 deathd5 deathd6 deathd7
+$frame deathd8 deathd9
+$frame deathe1 deathe2 deathe3 deathe4 deathe5 deathe6 deathe7
+$frame deathe8 deathe9
+
+//----------------------------------------------------------------------
+// attacks
+$frame nailatt1 nailatt2
+$frame light1 light2
+$frame rockatt1 rockatt2 rockatt3 rockatt4 rockatt5 rockatt6
+$frame shotatt1 shotatt2 shotatt3 shotatt4 shotatt5 shotatt6
+$frame axatt1 axatt2 axatt3 axatt4 axatt5 axatt6
+$frame axattb1 axattb2 axattb3 axattb4 axattb5 axattb6
+$frame axattc1 axattc2 axattc3 axattc4 axattc5 axattc6
+$frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
+
+//======================================================================
+
+void() player_stand1 = [$axstnd1, player_stand1]
+{
+ self.weaponframe = 0;
+ if (self.velocity_x || self.velocity_y)
+ {
+ self.walkframe = 0;
+ player_run ();
+ return;
+ }
+
+ if (self.weapon == IT_AXE)
+ {
+ if (self.walkframe >= 12)
+ self.walkframe = 0;
+ self.frame = $axstnd1 + self.walkframe;
+ }
+ else
+ {
+ if (self.walkframe >= 5)
+ self.walkframe = 0;
+ self.frame = $stand1 + self.walkframe;
+ }
+ self.walkframe = self.walkframe + 1;
+};
+
+//======================================================================
+
+void() player_run = [$rockrun1, player_run]
+{
+ self.weaponframe = 0;
+ if (!self.velocity_x && !self.velocity_y)
+ {
+ self.walkframe = 0;
+ player_stand1 ();
+ return;
+ }
+
+ if (self.weapon == IT_AXE)
+ {
+ if (self.walkframe == 6)
+ self.walkframe = 0;
+ self.frame = $axrun1 + self.walkframe;
+ }
+ else
+ {
+ if (self.walkframe == 6)
+ self.walkframe = 0;
+ self.frame = self.frame + self.walkframe;
+ }
+ self.walkframe = self.walkframe + 1;
+};
+
+//======================================================================
+
+void() player_shot1 = [$shotatt1, player_shot2]
+{
+ self.weaponframe = 1;
+ self.effects = self.effects | EF_MUZZLEFLASH;
+};
+
+void() player_shot2 = [$shotatt2, player_shot3] { self.weaponframe = 2; };
+void() player_shot3 = [$shotatt3, player_shot4] { self.weaponframe = 3; };
+void() player_shot4 = [$shotatt4, player_shot5] { self.weaponframe = 4; };
+void() player_shot5 = [$shotatt5, player_shot6] { self.weaponframe = 5; };
+void() player_shot6 = [$shotatt6, player_run] { self.weaponframe = 6; };
+
+//======================================================================
+
+void() player_axe1 = [$axatt1, player_axe2] { self.weaponframe = 1; };
+void() player_axe2 = [$axatt2, player_axe3] { self.weaponframe = 2; };
+
+void() player_axe3 = [$axatt3, player_axe4]
+{
+ self.weaponframe = 3;
+ W_FireAxe ();
+};
+
+void() player_axe4 = [$axatt4, player_run] { self.weaponframe = 4; };
+
+//======================================================================
+
+void() player_axeb1 = [$axattb1, player_axeb2] { self.weaponframe = 5; };
+void() player_axeb2 = [$axattb2, player_axeb3] { self.weaponframe = 6; };
+
+void() player_axeb3 = [$axattb3, player_axeb4]
+{
+ self.weaponframe = 7;
+ W_FireAxe ();
+};
+
+void() player_axeb4 = [$axattb4, player_run] { self.weaponframe = 8; };
+
+//======================================================================
+
+void() player_axec1 = [$axattc1, player_axec2] { self.weaponframe = 1; };
+void() player_axec2 = [$axattc2, player_axec3] { self.weaponframe = 2; };
+
+void() player_axec3 = [$axattc3, player_axec4]
+{
+ self.weaponframe = 3;
+ W_FireAxe ();
+};
+
+void() player_axec4 = [$axattc4, player_run] { self.weaponframe = 4; };
+
+//======================================================================
+
+void() player_axed1 = [$axattd1, player_axed2] { self.weaponframe = 5; };
+void() player_axed2 = [$axattd2, player_axed3] { self.weaponframe = 6; };
+
+void() player_axed3 = [$axattd3, player_axed4]
+{
+ self.weaponframe = 7;
+ W_FireAxe ();
+};
+
+void() player_axed4 = [$axattd4, player_run] { self.weaponframe = 8; };
+
+//======================================================================
+
+void() player_nail1 = [$nailatt1, player_nail2]
+{
+ self.effects = self.effects | EF_MUZZLEFLASH;
+
+ if (!self.button0)
+ {
+ player_run ();
+ return;
+ }
+
+ self.weaponframe = self.weaponframe + 1;
+ if (self.weaponframe == 9)
+ self.weaponframe = 1;
+ SuperDamageSound ();
+ W_FireSpikes (4);
+ self.attack_finished = time + 0.2;
+};
+
+void() player_nail2 = [$nailatt2, player_nail1]
+{
+ self.effects = self.effects | EF_MUZZLEFLASH;
+
+ if (!self.button0)
+ {
+ player_run ();
+ return;
+ }
+
+ self.weaponframe = self.weaponframe + 1;
+ if (self.weaponframe == 9)
+ self.weaponframe = 1;
+ SuperDamageSound ();
+ W_FireSpikes (-4);
+ self.attack_finished = time + 0.2;
+};
+
+//======================================================================
+
+void() player_light1 = [$light1, player_light2]
+{
+ self.effects = self.effects | EF_MUZZLEFLASH;
+
+ if (!self.button0)
+ {
+ player_run ();
+ return;
+ }
+
+ self.weaponframe = self.weaponframe + 1;
+ if (self.weaponframe == 5)
+ self.weaponframe = 1;
+ SuperDamageSound ();
+ W_FireLightning ();
+ self.attack_finished = time + 0.2;
+};
+
+void() player_light2 = [$light2, player_light1]
+{
+ self.effects = self.effects | EF_MUZZLEFLASH;
+
+ if (!self.button0)
+ {
+ player_run ();
+ return;
+ }
+
+ self.weaponframe = self.weaponframe + 1;
+ if (self.weaponframe == 5)
+ self.weaponframe = 1;
+ SuperDamageSound ();
+ W_FireLightning ();
+ self.attack_finished = time + 0.2;
+};
+
+//======================================================================
+
+void() player_rocket1 = [$rockatt1, player_rocket2]
+{
+ self.weaponframe=1;
+ self.effects = self.effects | EF_MUZZLEFLASH;
+};
+
+void() player_rocket2 = [$rockatt2, player_rocket3] { self.weaponframe=2; };
+void() player_rocket3 = [$rockatt3, player_rocket4] { self.weaponframe=3; };
+void() player_rocket4 = [$rockatt4, player_rocket5] { self.weaponframe=4; };
+void() player_rocket5 = [$rockatt5, player_rocket6] { self.weaponframe=5; };
+void() player_rocket6 = [$rockatt6, player_run] { self.weaponframe=6; };
+
+//======================================================================
+
+//----------------------------------------------------------------------
+// PlayerPainSound -- was PainSound()
+//----------------------------------------------------------------------
+void() PlayerPainSound =
+{
+ local float rs;
+
+ if (self.health < 0)
+ return;
+
+ if (damage_attacker.classname == "teledeath")
+ {
+ sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
+ return;
+ }
+
+ // water pain sounds
+ if (self.watertype == CONTENT_WATER &&
+ self.waterlevel == WATERLEVEL_EYES)
+ {
+ PlayerDeathBubbles (1);
+ if (random() > 0.5)
+ sound (self, CHAN_VOICE, "player/drown1.wav",
+ 1, ATTN_NORM);
+ else
+ sound (self, CHAN_VOICE, "player/drown2.wav",
+ 1, ATTN_NORM);
+ return;
+ }
+
+ // slime pain sounds
+ if (self.watertype == CONTENT_SLIME)
+ {
+ // FIX ME put in some steam here
+ // 1998-08-10 Player gulps bubbles when hurt in slime
+ // by Maddes start
+ if (self.waterlevel == WATERLEVEL_EYES)
+ PlayerDeathBubbles (1);
+ // 1998-08-10 Player gulps bubbles when hurt in slime
+ // by Maddes end
+ if (random() > 0.5)
+ sound (self, CHAN_VOICE, "player/lburn1.wav",
+ 1, ATTN_NORM);
+ else
+ sound (self, CHAN_VOICE, "player/lburn2.wav",
+ 1, ATTN_NORM);
+ return;
+ }
+
+ if (self.watertype == CONTENT_LAVA)
+ {
+ if (random() > 0.5)
+ sound (self, CHAN_VOICE, "player/lburn1.wav",
+ 1, ATTN_NORM);
+ else
+ sound (self, CHAN_VOICE, "player/lburn2.wav",
+ 1, ATTN_NORM);
+ return;
+ }
+
+ if (self.pain_finished > time)
+ {
+ self.axhitme = 0;
+ return;
+ }
+
+ // don't make multiple pain sounds right after each other
+ self.pain_finished = time + 0.5;
+
+ // ax pain sound
+ if (self.axhitme == 1)
+ {
+ self.axhitme = 0;
+ sound (self, CHAN_VOICE, "player/axhit1.wav", 1, ATTN_NORM);
+ return;
+ }
+
+ rs = rint ((random() * 5) + 1);
+
+ self.noise = "";
+ if (rs == 1)
+ self.noise = "player/pain1.wav";
+ else if (rs == 2)
+ self.noise = "player/pain2.wav";
+ else if (rs == 3)
+ self.noise = "player/pain3.wav";
+ else if (rs == 4)
+ self.noise = "player/pain4.wav";
+ else if (rs == 5)
+ self.noise = "player/pain5.wav";
+ else
+ self.noise = "player/pain6.wav";
+
+ sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
+ return;
+};
+
+void() player_pain1 = [$pain1, player_pain2]
+{
+ PlayerPainSound ();
+ self.weaponframe=0;
+};
+
+void() player_pain2 = [$pain2, player_pain3] {};
+void() player_pain3 = [$pain3, player_pain4] {};
+void() player_pain4 = [$pain4, player_pain5] {};
+void() player_pain5 = [$pain5, player_pain6] {};
+void() player_pain6 = [$pain6, player_run] {};
+
+void() player_axpain1 = [$axpain1, player_axpain2]
+{
+ PlayerPainSound ();
+ self.weaponframe=0;
+};
+
+void() player_axpain2 = [$axpain2, player_axpain3] {};
+void() player_axpain3 = [$axpain3, player_axpain4] {};
+void() player_axpain4 = [$axpain4, player_axpain5] {};
+void() player_axpain5 = [$axpain5, player_axpain6] {};
+void() player_axpain6 = [$axpain6, player_run] {};
+
+//----------------------------------------------------------------------
+void(entity attacker, float damage) player_pain =
+{
+ if (self.weaponframe)
+ return;
+
+ if (self.invisible_finished > time)
+ // eyes don't have pain frames
+ return;
+
+ if (self.weapon == IT_AXE)
+ player_axpain1 ();
+ else
+ player_pain1 ();
+};
+
+//======================================================================
+
+//----------------------------------------------------------------------
+void() PlayerDeathBubblesSpawn =
+{
+ local temp_bubbles bubble;
+ if (self.owner.waterlevel != WATERLEVEL_EYES && self.owner.health > 0)
+ {
+ // 1998-08-14 Improved bubble spawn by Maddes
+ // 1998-08-14 Bubblespawner remove fix by Perged start
+ // remove bubble spawner
+ remove (self);
+ // 1998-08-14 Bubblespawner remove fix by Perged end
+ return;
+ // 1998-08-14 Bubblespawner remove fix by Perged
+ }
+
+ bubble = spawn (temp_bubbles, origin: self.owner.origin + '0 0 24');
+ /*
+ setmodel (bubble, "progs/s_bubble.spr");
+ bubble.movetype = MOVETYPE_NOCLIP;
+ bubble.solid = SOLID_NOT;
+ bubble.velocity = '0 0 15';
+ bubble.nextthink = time + 0.5;
+ bubble.think = bubble_bob;
+ bubble.classname = "bubble";
+ bubble.frame = 0;
+ bubble.cnt = 0;
+ setsize (bubble, '-8 -8 -8', '8 8 8');
+ */
+ // 1998-08-14 Improved bubble spawn by Maddes start
+ // self.nextthink = time + 0.1;
+ self.nextthink = time + 0.01;
+ // 1998-08-14 Improved bubble spawn by Maddes end
+ self.think = PlayerDeathBubblesSpawn;
+ self.air_finished = self.air_finished + 1;
+ if (self.air_finished >= self.bubble_count)
+ remove (self);
+};
+
+//----------------------------------------------------------------------
+void(float num_bubbles) PlayerDeathBubbles =
+{
+ local entity bubble_spawner;
+
+ bubble_spawner = spawn ();
+ setorigin (bubble_spawner, self.origin);
+ bubble_spawner.movetype = MOVETYPE_NONE;
+ bubble_spawner.solid = SOLID_NOT;
+ // 1998-08-14 Improved bubble spawn by Maddes start
+ // bubble_spawner.nextthink = time + 0.1;
+ bubble_spawner.nextthink = time + 0.01;
+ // 1998-08-14 Improved bubble spawn by Maddes end
+ bubble_spawner.think = PlayerDeathBubblesSpawn;
+ bubble_spawner.air_finished = 0;
+ bubble_spawner.owner = self;
+ bubble_spawner.bubble_count = num_bubbles;
+ // return; // 1998-08-14 unnecessary by Maddes
+};
+
+//----------------------------------------------------------------------
+void() PlayerDeathSound =
+{
+ local float rs;
+
+ // water death sounds
+ if (self.waterlevel == WATERLEVEL_EYES)
+ {
+ PlayerDeathBubbles (20);
+ sound (self, CHAN_VOICE, "player/h2odeath.wav", 1, ATTN_NONE);
+ return;
+ }
+
+ rs = rint ((random() * 4) + 1);
+ if (rs == 1)
+ self.noise = "player/death1.wav";
+ if (rs == 2)
+ self.noise = "player/death2.wav";
+ if (rs == 3)
+ self.noise = "player/death3.wav";
+ if (rs == 4)
+ self.noise = "player/death4.wav";
+ if (rs == 5)
+ self.noise = "player/death5.wav";
+
+ sound (self, CHAN_VOICE, self.noise, 1, ATTN_NONE);
+ return;
+};
+
+//----------------------------------------------------------------------
+void() PlayerDead =
+{
+ self.nextthink = -1;
+ // allow respawn after a certain time
+ self.deadflag = DEAD_DEAD;
+};
+
+//----------------------------------------------------------------------
+vector(float dm) VelocityForDamage =
+{
+ local vector v;
+
+ v_x = 100 * crandom ();
+ v_y = 100 * crandom ();
+ v_z = 200 + 100 * random ();
+
+ if (dm > -50)
+ {
+ // dprint ("level 1\n");
+ v = v * 0.7;
+ }
+ else if (dm > -200)
+ {
+ // dprint ("level 3\n");
+ v = v * 2;
+ }
+ else
+ {
+ v = v * 10;
+ }
+
+ return v;
+};
+
+//----------------------------------------------------------------------
+void(string gibname, float dm) ThrowGib =
+{
+ local entity new;
+
+ new = spawn ();
+ new.origin = self.origin;
+ setmodel (new, gibname);
+ setsize (new, '0 0 0', '0 0 0');
+ new.velocity = VelocityForDamage (dm);
+ new.movetype = MOVETYPE_BOUNCE;
+ new.solid = SOLID_NOT;
+ new.avelocity_x = random() * 600;
+ new.avelocity_y = random() * 600;
+ new.avelocity_z = random() * 600;
+ new.think = SUB_Remove;
+ new.ltime = time;
+ new.nextthink = time + 10 + random() * 10;
+ new.frame = 0;
+ new.flags = 0;
+};
+
+//----------------------------------------------------------------------
+void(string gibname, float dm) ThrowHead =
+{
+ setmodel (self, gibname);
+
+ // dumptruck_ds custom_mdl changes
+ self.skin = self.skin_head;
+ if !(self.skin_head)
+ self.skin_head = 0;
+ // end dumptruck_ds
+
+ self.frame = 0;
+ self.nextthink = -1;
+ self.movetype = MOVETYPE_BOUNCE;
+ self.takedamage = DAMAGE_NO;
+ self.solid = SOLID_NOT;
+ self.view_ofs = '0 0 8';
+ setsize (self, '-16 -16 0', '16 16 56');
+ self.velocity = VelocityForDamage (dm);
+ self.origin_z = self.origin_z - 24;
+ self.flags = self.flags - (self.flags & FL_ONGROUND);
+ self.avelocity = crandom() * '0 600 0';
+};
+
+//----------------------------------------------------------------------
+void() GibPlayer =
+{
+ ThrowHead ("progs/h_player.mdl", self.health);
+ ThrowGib ("progs/gib1.mdl", self.health);
+ ThrowGib ("progs/gib2.mdl", self.health);
+ ThrowGib ("progs/gib3.mdl", self.health);
+
+ self.deadflag = DEAD_DEAD;
+
+ if (damage_attacker.classname == "teledeath")
+ {
+ sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
+ return;
+ }
+
+ if (damage_attacker.classname == "teledeath2")
+ {
+ sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
+ return;
+ }
+
+ if (random() < 0.5)
+ sound (self, CHAN_VOICE, "player/gib.wav", 1, ATTN_NONE);
+ else
+ sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NONE);
+};
+
+//----------------------------------------------------------------------
+void() PlayerDie =
+{
+ local float i;
+
+ // 1998-07-23 Palette shift when player dies with quad/pentagram fix
+ // by Maddes start
+ // self.items = self.items - (self.items & IT_INVISIBILITY);
+ self.items = self.items - (self.items &
+ (IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD));
+ // 1998-07-23 Palette shift when player dies with quad/pentagram fix
+ // by Maddes end
+
+ // self.invisible_finished = 0; // don't die as eyes
+ self.invincible_finished = 0;
+ self.super_damage_finished = 0;
+ self.radsuit_finished = 0;
+
+ // 1998-07-23 Glowing corpse of players which had quad/pentagram
+ // until respawn fix by Maddes
+ self.effects = 0;
+
+ // don't use eyes
+ self.modelindex = modelindex_player;
+
+ if (deathmatch || coop)
+ DropBackpack ();
+
+ self.weaponmodel = "";
+ self.view_ofs = '0 0 -8';
+ self.deadflag = DEAD_DYING;
+ self.solid = SOLID_NOT;
+ self.flags = self.flags - (self.flags & FL_ONGROUND);
+ self.movetype = MOVETYPE_TOSS;
+
+ if (self.velocity_z < 10)
+ self.velocity_z = self.velocity_z + random() * 300;
+
+ if (self.health < -40)
+ {
+ GibPlayer ();
+ return;
+ }
+
+ PlayerDeathSound ();
+
+ self.angles_x = 0;
+ self.angles_z = 0;
+
+ if (self.weapon == IT_AXE)
+ {
+ player_die_ax1 ();
+ return;
+ }
+
+ i = cvar ("temp1");
+ if (!i)
+ i = 1 + floor (random() * 6);
+
+ if (i == 1)
+ player_diea1 ();
+ else if (i == 2)
+ player_dieb1 ();
+ else if (i == 3)
+ player_diec1 ();
+ else if (i == 4)
+ player_died1 ();
+ else
+ player_diee1 ();
+};
+
+//----------------------------------------------------------------------
+void() set_suicide_frame =
+{
+ // used by klill command and diconnect command
+ if (self.model != "progs/player.mdl")
+ // allready gibbed
+ return;
+ self.frame = $deatha11;
+ self.solid = SOLID_NOT;
+ self.movetype = MOVETYPE_TOSS;
+ self.deadflag = DEAD_DEAD;
+ self.nextthink = -1;
+};
+
+void() player_diea1 = [$deatha1, player_diea2] {};
+void() player_diea2 = [$deatha2, player_diea3] {};
+void() player_diea3 = [$deatha3, player_diea4] {};
+void() player_diea4 = [$deatha4, player_diea5] {};
+void() player_diea5 = [$deatha5, player_diea6] {};
+void() player_diea6 = [$deatha6, player_diea7] {};
+void() player_diea7 = [$deatha7, player_diea8] {};
+void() player_diea8 = [$deatha8, player_diea9] {};
+void() player_diea9 = [$deatha9, player_diea10] {};
+void() player_diea10 = [$deatha10, player_diea11] {};
+void() player_diea11 = [$deatha11, player_diea11] { PlayerDead (); };
+
+void() player_dieb1 = [$deathb1, player_dieb2] {};
+void() player_dieb2 = [$deathb2, player_dieb3] {};
+void() player_dieb3 = [$deathb3, player_dieb4] {};
+void() player_dieb4 = [$deathb4, player_dieb5] {};
+void() player_dieb5 = [$deathb5, player_dieb6] {};
+void() player_dieb6 = [$deathb6, player_dieb7] {};
+void() player_dieb7 = [$deathb7, player_dieb8] {};
+void() player_dieb8 = [$deathb8, player_dieb9] {};
+void() player_dieb9 = [$deathb9, player_dieb9] { PlayerDead (); };
+
+void() player_diec1 = [$deathc1, player_diec2] {};
+void() player_diec2 = [$deathc2, player_diec3] {};
+void() player_diec3 = [$deathc3, player_diec4] {};
+void() player_diec4 = [$deathc4, player_diec5] {};
+void() player_diec5 = [$deathc5, player_diec6] {};
+void() player_diec6 = [$deathc6, player_diec7] {};
+void() player_diec7 = [$deathc7, player_diec8] {};
+void() player_diec8 = [$deathc8, player_diec9] {};
+void() player_diec9 = [$deathc9, player_diec10] {};
+void() player_diec10 = [$deathc10, player_diec11] {};
+void() player_diec11 = [$deathc11, player_diec12] {};
+void() player_diec12 = [$deathc12, player_diec13] {};
+void() player_diec13 = [$deathc13, player_diec14] {};
+void() player_diec14 = [$deathc14, player_diec15] {};
+void() player_diec15 = [$deathc15, player_diec15] { PlayerDead (); };
+
+void() player_died1 = [$deathd1, player_died2] {};
+void() player_died2 = [$deathd2, player_died3] {};
+void() player_died3 = [$deathd3, player_died4] {};
+void() player_died4 = [$deathd4, player_died5] {};
+void() player_died5 = [$deathd5, player_died6] {};
+void() player_died6 = [$deathd6, player_died7] {};
+void() player_died7 = [$deathd7, player_died8] {};
+void() player_died8 = [$deathd8, player_died9] {};
+void() player_died9 = [$deathd9, player_died9] { PlayerDead (); };
+
+void() player_diee1 = [$deathe1, player_diee2] {};
+void() player_diee2 = [$deathe2, player_diee3] {};
+void() player_diee3 = [$deathe3, player_diee4] {};
+void() player_diee4 = [$deathe4, player_diee5] {};
+void() player_diee5 = [$deathe5, player_diee6] {};
+void() player_diee6 = [$deathe6, player_diee7] {};
+void() player_diee7 = [$deathe7, player_diee8] {};
+void() player_diee8 = [$deathe8, player_diee9] {};
+void() player_diee9 = [$deathe9, player_diee9] { PlayerDead (); };
+
+void() player_die_ax1 = [$axdeth1, player_die_ax2] {};
+void() player_die_ax2 = [$axdeth2, player_die_ax3] {};
+void() player_die_ax3 = [$axdeth3, player_die_ax4] {};
+void() player_die_ax4 = [$axdeth4, player_die_ax5] {};
+void() player_die_ax5 = [$axdeth5, player_die_ax6] {};
+void() player_die_ax6 = [$axdeth6, player_die_ax7] {};
+void() player_die_ax7 = [$axdeth7, player_die_ax8] {};
+void() player_die_ax8 = [$axdeth8, player_die_ax9] {};
+void() player_die_ax9 = [$axdeth9, player_die_ax9] { PlayerDead (); };
+
+//======================================================================
+// Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds
+//======================================================================
+
+/*QUAKED player_dead_axe (0 0.5 0.8) (-16 -16 -24) (16 16 32) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+ model ({"path":"progs/player.mdl","frame":49});
+}
+*/
+void() player_dead_axe =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/player.mdl");
+ setmodel (self, "progs/player.mdl");
+ self.frame = $axdeth9;
+
+ if (self.spawnflags & 1)
+ {
+ self.solid = SOLID_BBOX;
+ setsize (self,'-38.72 -5.83 -50.45','28.73 33.85 30');
+ }
+ else
+ {
+ self.solid = SOLID_NOT;
+ }
+};
+
+/*QUAKED player_dead_face_down (0 0.5 0.8) (-16 -16 -24) (16 16 32) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+ model ({"path":"progs/player.mdl","frame":84});
+}
+*/
+void() player_dead_face_down =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/player.mdl");
+ setmodel (self, "progs/player.mdl");
+ self.frame = $deathc14;
+
+ if (self.spawnflags & 1)
+ {
+ self.solid = SOLID_BBOX;
+ setsize (self,'-50.28 -23.55 -49.85','30.66 14.49 30');
+ }
+ else
+ {
+ self.solid = SOLID_NOT;
+ }
+};
+
+/*QUAKED player_dead_on_side (0 0.5 0.8) (-16 -16 -24) (16 16 32) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+{
+ model ({"path":"progs/player.mdl","frame":102});
+}
+*/
+void() player_dead_on_side =
+{
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ precache_model ("progs/player.mdl");
+ setmodel (self, "progs/player.mdl");
+ self.frame = $deathe9;
+
+ if (self.spawnflags & 1)
+ {
+ self.solid = SOLID_BBOX;
+ setsize (self,'-38.72 -5.83 -50.45','28.73 33.85 30');
+ }
+ else
+ {
+ self.solid = SOLID_NOT;
+ }
+};
+
+//======================================================================
+// END Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds
+//======================================================================

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

Diff qc/player/playerthink.qc

diff --git a/qc/player/playerthink.qc b/qc/player/playerthink.qc
new file mode 100644
index 0000000..625f97a
--- /dev/null
+++ b/qc/player/playerthink.qc
@@ -0,0 +1,616 @@
+//==============================================================================
+// player/playerthink.qc
+//==============================================================================
+
+// fields
+.float dmgtime;
+
+//----------------------------------------------------------------------
+void() PlayerDeathThink =
+{
+ local float forward;
+
+ if ((self.flags & FL_ONGROUND))
+ {
+ forward = vlen (self.velocity);
+ forward = forward - 20;
+ if (forward <= 0)
+ self.velocity = '0 0 0';
+ else
+ self.velocity = forward * normalize (self.velocity);
+ }
+
+ // wait for all buttons released
+ if (self.deadflag == DEAD_DEAD)
+ {
+ if (self.button2 || self.button1 || self.button0)
+ return;
+ self.deadflag = DEAD_RESPAWNABLE;
+ return;
+ }
+
+ // wait for any button down
+ if (!self.button2 && !self.button1 && !self.button0)
+ return;
+
+ self.button0 = 0;
+ self.button1 = 0;
+ self.button2 = 0;
+ respawn ();
+};
+
+//----------------------------------------------------------------------
+// PlayerClimb -- johnfitz
+//----------------------------------------------------------------------
+void() PlayerClimb =
+{
+ self.velocity = '0 0 160';
+}
+
+//----------------------------------------------------------------------
+// PlayerJump
+//----------------------------------------------------------------------
+void() PlayerJump =
+{
+ if (self.flags & FL_WATERJUMP)
+ return;
+
+ if (self.waterlevel >= 2)
+ {
+ if (self.watertype == CONTENT_WATER)
+ self.velocity_z = 100;
+ else if (self.watertype == CONTENT_SLIME)
+ self.velocity_z = 80;
+ else
+ self.velocity_z = 50;
+
+ // play swiming sound
+ if (self.swim_flag < time)
+ {
+ self.swim_flag = time + 1;
+ if (random() < 0.5)
+ sound (self, CHAN_BODY, "misc/water1.wav",
+ 1, ATTN_NORM);
+ else
+ sound (self, CHAN_BODY, "misc/water2.wav",
+ 1, ATTN_NORM);
+ }
+ return;
+ }
+
+ // refactoring from Copper -- dumptruck_ds
+ if (self.movetype != MOVETYPE_NOCLIP)
+ {
+ if (!(self.flags & FL_ONGROUND))
+ return;
+ // don't pogo stick
+ if ( !(self.flags & FL_JUMPRELEASED) )
+ return;
+ // player jumping sound (h00rt)
+ sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
+ }
+
+ self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
+
+ // don't stairwalk
+ self.flags = self.flags - FL_ONGROUND;
+
+ self.button2 = 0;
+ self.velocity_z = self.velocity_z + 270;
+};
+
+//----------------------------------------------------------------------
+// WaterMove
+//----------------------------------------------------------------------
+void() WaterMove =
+{
+ if (self.movetype == MOVETYPE_NOCLIP)
+ {
+ self.air_finished = time + 120;
+ return;
+ }
+
+ if (self.health < 0)
+ return;
+
+ if (self.waterlevel != 3)
+ {
+ if (self.air_finished < time)
+ sound (self, CHAN_VOICE, "player/gasp2.wav",
+ 1, ATTN_NORM);
+ else if (self.air_finished < time + 9)
+ sound (self, CHAN_VOICE, "player/gasp1.wav",
+ 1, ATTN_NORM);
+ self.air_finished = time + 12;
+ self.dmg = 2;
+ }
+ else if (self.air_finished < time)
+ {
+ // drown!
+ if (self.pain_finished < time)
+ {
+ self.dmg = self.dmg + 2;
+ if (self.dmg > 15)
+ self.dmg = 10;
+ self.deathtype = "drowning";
+ T_Damage (self, world, world, self.dmg);
+ self.deathtype = "";
+ self.pain_finished = time + 1;
+ }
+ }
+
+ if (!self.waterlevel)
+ {
+ if (self.flags & FL_INWATER)
+ {
+ // play leave water sound
+ sound (self, CHAN_BODY, "misc/outwater.wav",
+ 1, ATTN_NORM);
+ self.flags = self.flags - FL_INWATER;
+ }
+ return;
+ }
+
+ if (self.watertype == CONTENT_LAVA)
+ {
+ // do damage
+ if (self.dmgtime < time)
+ {
+ if (self.radsuit_finished > time)
+ self.dmgtime = time + 1;
+ else
+ self.dmgtime = time + 0.2;
+
+ self.deathtype = "lava";
+ T_Damage (self, world, world, 10 * self.waterlevel);
+ self.deathtype = "";
+ }
+ }
+ else if (self.watertype == CONTENT_SLIME)
+ {
+ // do damage
+ if (self.dmgtime < time && self.radsuit_finished < time)
+ {
+ self.dmgtime = time + 1;
+ self.deathtype = "slime";
+ T_Damage (self, world, world, 4 * self.waterlevel);
+ self.deathtype = "";
+ }
+ }
+
+ if ( !(self.flags & FL_INWATER) )
+ {
+
+ // player enter water sound
+ if (self.watertype == CONTENT_LAVA)
+ sound (self, CHAN_BODY, "player/inlava.wav",
+ 1, ATTN_NORM);
+ if (self.watertype == CONTENT_WATER)
+ sound (self, CHAN_BODY, "player/inh2o.wav",
+ 1, ATTN_NORM);
+ if (self.watertype == CONTENT_SLIME)
+ sound (self, CHAN_BODY, "player/slimbrn2.wav",
+ 1, ATTN_NORM);
+
+ self.flags = self.flags + FL_INWATER;
+ self.dmgtime = 0;
+ }
+};
+
+//----------------------------------------------------------------------
+// CheckWaterJump
+//----------------------------------------------------------------------
+void() CheckWaterJump =
+{
+ // from Copper -- dumptruck_ds
+ if (self.movetype == MOVETYPE_NOCLIP)
+ return;
+
+ local vector start, end;
+
+ // check for a jump-out-of-water
+ makevectors (self.angles);
+ start = self.origin;
+ start_z = start_z + 8;
+ v_forward_z = 0;
+ normalize (v_forward);
+ end = start + v_forward * 24;
+ traceline (start, end, TRUE, self);
+ if (trace_fraction < 1)
+ {
+ // solid at waist
+ start_z = start_z + self.maxs_z - 8;
+ end = start + v_forward * 24;
+ self.movedir = trace_plane_normal * -50;
+ traceline (start, end, TRUE, self);
+ if (trace_fraction == 1)
+ {
+ // open at eye level
+ self.flags = self.flags | FL_WATERJUMP;
+ self.velocity_z = 225;
+ self.flags -= self.flags & FL_JUMPRELEASED;
+ // safety net
+ self.teleport_time = time + 2; // safety net
+ return;
+ }
+ }
+};
+
+//----------------------------------------------------------------------
+// PlayerPreThink -- Called every frame before physics are run
+//----------------------------------------------------------------------
+void() PlayerPreThink =
+{
+ local float do_ladder_physics = FALSE;
+
+ if (intermission_running)
+ {
+ // otherwise a button could be missed between the think tics
+ IntermissionThink ();
+ return;
+ }
+
+ if (self.view_ofs == '0 0 0')
+ {
+ // Check for cutscene stuff.
+ Cutscene_Think ();
+ // intermission or finale
+ return;
+ }
+
+ // note that this code block is here, before the tests which check
+ // whether the player is dead, so that the player's gravity will be
+ // correctly updated even if they e.g. fell off a ladder because
+ // they died -- iw
+ if (autocvar(pm_standardphysics, FALSE))
+ {
+ if (self.pmove_flags & PMF_ONLADDER)
+ {
+ do_ladder_physics = TRUE;
+ // not zero, because zero means "default"
+ self.gravity = 0.0000001;
+ self.pmove_flags &= ~PMF_ONLADDER;
+ }
+ else
+ {
+ do_ladder_physics = FALSE;
+ self.gravity = self.wantedgravity;
+ }
+ }
+ else
+ {
+ self.gravity = self.wantedgravity;
+ }
+
+ // If just spawned in, try to recover previous fog values from
+ // own client entity, if any
+ if (cleanUpClientStuff)
+ fog_setFromEnt(self, self);
+
+ // is this still used?
+ makevectors (self.v_angle);
+
+ CheckRules ();
+ WaterMove ();
+
+ // Run legacy CheckWaterJump if we're doing standard physics -- CEV
+ if (autocvar(pm_standardphysics, FALSE))
+ if (self.waterlevel == 2)
+ CheckWaterJump ();
+
+ if (self.deadflag >= DEAD_DEAD)
+ {
+ PlayerDeathThink ();
+ return;
+ }
+
+ if (self.deadflag == DEAD_DYING)
+ // dying, so do nothing
+ return;
+
+ // johnfitz ladder conditions, added from Rubicon2 -- dumptruck_ds
+ if (autocvar(pm_standardphysics, FALSE))
+ {
+ if (do_ladder_physics)
+ {
+ if (self.button2)
+ {
+ PlayerClimb ();
+ /*
+ // no ladder footsteps for now
+ if (time > self.ladder_step_finished)
+ {
+ r = random();
+ if (r > 0.66)
+ sound (self, CHAN_BODY,
+ "ladder/metal1.wav",
+ 0.5, ATTN_NORM);
+ else if (r > 0.33)
+ sound (self, CHAN_BODY,
+ "ladder/metal2.wav",
+ 0.5, ATTN_NORM);
+ else
+ sound (self, CHAN_BODY,
+ "ladder/metal3.wav",
+ 0.5, ATTN_NORM);
+ self.ladder_step_finished = time + 0.3;
+ }
+ */
+ }
+ else
+ {
+ self.flags = self.flags | FL_JUMPRELEASED;
+ self.velocity = 0.9 * self.velocity;
+ self.velocity_z = 0;
+ }
+ }
+ else
+ {
+ if (self.button2)
+ PlayerJump ();
+ else
+ self.flags = self.flags | FL_JUMPRELEASED;
+ }
+ }
+
+ // teleporters can force a non-moving pause time
+ if (time < self.pausetime)
+ self.velocity = '0 0 0';
+
+ if (time > self.attack_finished && self.currentammo == 0
+ && self.weapon != IT_AXE)
+ {
+ self.weapon = PlayerBestWeapon ();
+ PlayerSetCurrentAmmo ();
+ }
+
+ // from copper -- dumptruck_ds
+ if (autocvar(pm_standardphysics, FALSE))
+ {
+ if (self.movetype == MOVETYPE_NOCLIP)
+ {
+ self.flags = self.flags | FL_FLY;
+ }
+ }
+
+ // TODO CEV
+ if (self.groundboost_timer <= 0 && (self.teleport_time > time - 0.1))
+ self.groundboost_timer = PM_GROUNDBOOST_WINDOW;
+};
+
+//----------------------------------------------------------------------
+// CheckPowerups -- Check for turning off powerups
+//----------------------------------------------------------------------
+void() CheckPowerups =
+{
+ if (self.health <= 0) return;
+
+ // invisibility
+ if (self.invisible_finished)
+ {
+ // sound and screen flash when items starts to run out
+ if (self.invisible_sound < time)
+ {
+ sound (self, CHAN_AUTO, "items/inv3.wav",
+ 0.5, ATTN_IDLE);
+ self.invisible_sound = time + ((random() * 3) + 1);
+ }
+
+ if (self.invisible_finished < time + 3)
+ {
+ if (self.invisible_time == 1)
+ {
+ sprint (self, "Ring of Shadows magic is "
+ "fading\n");
+ stuffcmd (self, "bf\n");
+ sound (self, CHAN_AUTO, "items/inv2.wav",
+ 1, ATTN_NORM);
+ self.invisible_time = time + 1;
+ }
+
+ if (self.invisible_time < time)
+ {
+ self.invisible_time = time + 1;
+ stuffcmd (self, "bf\n");
+ }
+ }
+
+ if (self.invisible_finished < time)
+ {
+ // just stopped
+ self.items = self.items - IT_INVISIBILITY;
+ self.invisible_finished = 0;
+ self.invisible_time = 0;
+ }
+
+ // use the eyes
+ self.frame = 0;
+ self.modelindex = modelindex_eyes;
+ }
+ else
+ {
+ // don't use the eyes
+ self.modelindex = modelindex_player;
+ }
+
+ // invincibility
+ if (self.invincible_finished)
+ {
+ // sound and screen flash when items starts to run out
+ if (self.invincible_finished < time + 3)
+ {
+ if (self.invincible_time == 1)
+ {
+ sprint (self, "Protection is almost burned "
+ "out\n");
+ stuffcmd (self, "bf\n");
+ sound (self, CHAN_AUTO, "items/protect2.wav",
+ 1, ATTN_NORM);
+ self.invincible_time = time + 1;
+ }
+
+ if (self.invincible_time < time)
+ {
+ self.invincible_time = time + 1;
+ stuffcmd (self, "bf\n");
+ }
+ }
+
+ if (self.invincible_finished < time)
+ {
+ // just stopped
+ self.items = self.items - IT_INVULNERABILITY;
+ self.invincible_time = 0;
+ self.invincible_finished = 0;
+ }
+ if (self.invincible_finished > time)
+ self.effects = self.effects | EF_DIMLIGHT;
+ else
+ self.effects -= self.effects & EF_DIMLIGHT;
+ }
+
+ // super damage
+ if (self.super_damage_finished)
+ {
+ // sound and screen flash when items starts to run out
+ if (self.super_damage_finished < time + 3)
+ {
+ if (self.super_time == 1)
+ {
+ sprint (self, "Quad Damage is wearing off\n");
+ stuffcmd (self, "bf\n");
+ sound (self, CHAN_AUTO, "items/damage2.wav",
+ 1, ATTN_NORM);
+ self.super_time = time + 1;
+ }
+
+ if (self.super_time < time)
+ {
+ self.super_time = time + 1;
+ stuffcmd (self, "bf\n");
+ }
+ }
+
+ if (self.super_damage_finished < time)
+ {
+ // just stopped
+ self.items = self.items - IT_QUAD;
+ self.super_damage_finished = 0;
+ self.super_time = 0;
+ }
+ if (self.super_damage_finished > time)
+ self.effects = self.effects | EF_DIMLIGHT;
+ else
+ self.effects -= self.effects & EF_DIMLIGHT;
+ }
+
+ // suit
+ if (self.radsuit_finished)
+ {
+ // don't drown
+ self.air_finished = time + 12;
+
+ // sound and screen flash when items starts to run out
+ if (self.radsuit_finished < time + 3)
+ {
+ if (self.rad_time == 1)
+ {
+ sprint (self, "Air supply in Biosuit "
+ "expiring\n");
+ stuffcmd (self, "bf\n");
+ sound (self, CHAN_AUTO, "items/suit2.wav",
+ 1, ATTN_NORM);
+ self.rad_time = time + 1;
+ }
+
+ if (self.rad_time < time)
+ {
+ self.rad_time = time + 1;
+ stuffcmd (self, "bf\n");
+ }
+ }
+
+ if (self.radsuit_finished < time)
+ {
+ // just stopped
+ self.items = self.items - IT_SUIT;
+ self.rad_time = 0;
+ self.radsuit_finished = 0;
+ }
+ }
+};
+
+//----------------------------------------------------------------------
+// PlayerPostThink -- Called every frame after physics are run
+//----------------------------------------------------------------------
+void() PlayerPostThink =
+{
+ // TODO CEV
+ self.SendFlags = 0xffffff;
+
+ if (self.view_ofs == '0 0 0')
+ // intermission or finale
+ return;
+ if (self.deadflag)
+ return;
+
+ // next block was in W_WeaponFrame -- CEV
+ if (time >= self.attack_finished)
+ {
+ if (self.impulse)
+ ImpulseCommands ();
+ if (self.button0)
+ {
+ SuperDamageSound ();
+ PlayerAttack ();
+ }
+ }
+
+ // check to see if player landed and play landing sound
+ if ((self.jump_flag < -300) && (self.flags & FL_ONGROUND) &&
+ (self.health > 0))
+ {
+ if (self.watertype == CONTENT_WATER)
+ sound (self, CHAN_BODY, "player/h2ojump.wav",
+ 1, ATTN_NORM);
+ else if (self.jump_flag < -650)
+ {
+ self.deathtype = "falling";
+ T_Damage (self, world, world, 5);
+ self.deathtype = "";
+ sound (self, CHAN_VOICE, "player/land2.wav",
+ 1, ATTN_NORM);
+ }
+ else
+ sound (self, CHAN_VOICE, "player/land.wav",
+ 1, ATTN_NORM);
+
+ self.jump_flag = 0;
+ }
+
+ if (!(self.flags & FL_ONGROUND))
+ self.jump_flag = self.velocity_z;
+
+ // dumptruck_ds -- this replaces item_megahealth_rot in items.qc
+ if (self.health > self.max_health)
+ {
+ if (self.megahealth_rottime < time)
+ {
+ self.megahealth_rottime = time + 1;
+ self.health = self.health - 1;
+ }
+ else if (self.health <= 100)
+ {
+ // thanks ydrol!!!
+ self.items = self.items - (self.items & IT_SUPERHEALTH);
+ }
+ }
+
+ CheckPowerups ();
+
+ // from Copper -- dumptruck_ds
+ if (autocvar(pm_standardphysics, FALSE))
+ if (self.movetype != MOVETYPE_NOCLIP)
+ // self.flags = not(self.flags, FL_FLY);
+ self.flags &= ~FL_FLY;
+};

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
new file mode 100644
index 0000000..561f5d6
--- /dev/null
+++ b/qc/player/pmove.qc
@@ -0,0 +1,2165 @@
+//==============================================================================
+// PMOVE
+//==============================================================================
+
+// TODO CEV: crouching
+// TODO CEV: crouch sliding (useful for sliding up stairs)
+// TODO CEV: crouch-wall-thing (wallrunning? wall sliding?)
+// TODO CEV: improved player unstick function
+// TODO CEV: more work on walking
+// TODO CEV: varied sounds (footsteps, different jump sounds)
+
+// globals managed by FTEQW, from fteextensions.qc -- CEV
+float input_buttons;
+// float input_impulse;
+float input_timelength;
+vector input_angles; // +x = DOWN
+vector input_movevalues;
+
+// fields
+// note: timers are expensive, require synch between server and client -- CEV
+.entity groundentity;
+.vector groundnormal;
+.float pmove_flags; // custom movement flags -- CEV
+.float doublejump_timer; // time in which a player can doublejump
+.float groundboost_timer; // time to apply low friction -- CEV
+.void() customphysics;
+
+// pmove constants; it's definitely possible to rework these as cvars -- CEV
+// acceleration & friction
+const float PM_AIRACCEL = 8.0f; // 10 in Q1; now 7.5
+const float PM_AIRACCELQ3 = 0.8f; // 1.0 in Q3 ?; now 0.75
+const float PM_AIRACCELFWD = 1.0f; // 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 = 12.0f; // ground boost accel; 10 is enough
+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_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
+const float PM_WATERFRICTION = 4.0f; // friction in water
+
+// horizontal speeds (mostly)
+const float PM_CROUCHSPEED = 120.0f; // ???
+const float PM_MAXSPEED = 320.0f; // 320 always
+const float PM_MAXAIRSPEED = 30.0f; // 30 for Q1 air control
+const float PM_RUNSPEED = 400.0f; // run speed override
+const float PM_STOPSPEED = 100.0f;
+const float PM_TELEEXITSPEED = 400.0f; // exit teleporters at this speed
+const float PM_WALKSPEED = 200.0f; // walk speed override
+const float PM_WATERMAXSPEED = 224.0f; // 320 * 0.7
+const float PM_WATERSINKSPEED = 60.0f;
+
+// vertical speeds (mostly)
+const float PM_GRAVITY = 800.0f; // unless sv_gravity, scaled by .gravity
+const float PM_JUMPSPEED = 270.0f; // standard jump Z velocity; 90 * 3
+const float PM_DOUBLEJUMPSPEED = 270.0f;// 270 * 1.5 in CPM; 360 here
+const float PM_STAIRJUMPSPEED = 360.0f; // 360 = 90 * 4
+const float PM_TELEJUMPSPEED = 360.0f; // same as STAIRJUMPSPEED
+const float PM_WALLJUMPFORCE = 90.0f; // 90 * 2; push away from wall
+const float PM_WALLJUMPGROUND = 36.0f; // distance from ground to allow WJ
+const float PM_WALLJUMPLIMIT = -180.f; // no walljump if Z vel below this
+const float PM_WALLJUMPSPEED = 270.0f; // 225 = 90 * 2.5; wall jump
+const float PM_WALLJUMPDOUBLE = 360.0f; // 315 = 90 * 3.5; wall doublejump
+
+// timing
+const float PM_DOUBLEJUMP_WINDOW = 0.4f;// 2 jumps in this time is a double
+const float PM_GROUNDBOOST_WINDOW = 0.4f;// groundboost duration
+const float PM_TELEJUMP_WINDOW = 0.4f; // duration to perform a telejump
+const float PM_WALLJUMP_WINDOW = 0.2f; // duration between walljumps
+const float PM_WALLCLIP_WINDOW = 0.25f; //
+
+// misc
+const float PM_OVERCLIP = 1.0f; // Quake3's OVERCLIP is 1.001f
+const float PM_ONESIDEDCLIP = -0.1; // -0.001;
+const float PM_STEPHEIGHT = 18.0f; // 18 for Q1, 22 for later games?
+const vector PM_TELEDROP = '0 0 -64'; // drop teleporter exit to floor if
+ // floor is within this distance
+// water level
+const int WATERLEVEL_NONE = 0;
+const int WATERLEVEL_FEET = 1;
+const int WATERLEVEL_WAIST = 2;
+const int WATERLEVEL_EYES = 3;
+
+//
+const vector CROUCHED_MINS = '-16 -16 -18';// VEC_HULL_MIN is '-16 -16 -24'
+const vector CROUCHED_MAXS = '16 16 18';// VEC_HULL_MAX is '16 16 32'
+
+// pmove_flags
+enumflags
+{
+ PMF_ONGROUND, // entity is on ground
+ PMF_STARTGROUND, // entity started the move on ground
+ PMF_ONLADDER, // entity is on a ladder
+ PMF_INWATER, // entity is in water
+ PMF_CROUCH_HELD, // player is holding the crouch key
+ PMF_CROUCHED, // entity is crouching
+ PMF_JUMP_HELD, // player is holding the jump key
+ PMF_DOUBLEJUMPED, // entity has doublejumped
+ PMF_WALLJUMPED, // entity has walljumped
+ PMF_WATERJUMPED, // entity has waterjumped
+ PMF_PRE_MOVE // hint that origin hasn't updated yet
+};
+
+// prototypes
+static void(entity ent) PM_DoTouch;
+float() PM_Nudge;
+void(float dogravity, float sticky, float dostep, float doskim) PM_DanceMove;
+void() PM_CategorizePosition;
+void(float friction, float move_time) PM_Friction;
+void(vector wishdir, float wishspeed, float accel, float move_time)
+ PM_Accelerate;
+void(vector wishvel, float wishspeed, float accel, float move_time)
+ PM_AirAccelerate;
+void(vector wishdir, float wishspeed, float move_time) PM_AirControl;
+void() PM_Jump;
+void() PM_WallJump;
+void(vector wishvel, float move_time) PM_WalkAccelerate;
+void(vector wishvel, float move_time) PM_SwimAccelerate;
+void(vector wishvel, float scale, float move_time) PM_NoClipAccelerate;
+void(float move_time) PM_ManageTimers;
+void(entity target) PM_Move;
+
+#ifdef SSQC
+//----------------------------------------------------------------------
+// SV_RunClientCommand -- server-side movement entrypoint -- CEV
+//----------------------------------------------------------------------
+void() SV_RunClientCommand =
+{
+ // should match the one used by csqc.
+ if (autocvar(pm_standardphysics, FALSE))
+ // for testing -- CEV
+ runstandardplayerphysics (self);
+ else
+ // for real
+ PM_Move (self);
+};
+#endif
+
+//----------------------------------------------------------------------
+// PM_DoTouch
+//----------------------------------------------------------------------
+static void(entity ent) PM_DoTouch =
+{
+ if (ent && ent.touch != __NULL__)
+ {
+ local entity orig_self;
+
+ orig_self = self;
+ other = self;
+ self = ent;
+ self.touch ();
+ self = orig_self;
+ }
+};
+
+//----------------------------------------------------------------------
+// PM_Nudge
+// from the GPL2 CSQCTest code that comes with FTEQW; is called often
+// to nudge player origin due to float/network precision errors -- CEV
+//----------------------------------------------------------------------
+float() PM_Nudge =
+{
+ vector test, org = self.origin;
+
+ // check current position.
+ tracebox (org, self.mins, self.maxs, org, FALSE, self);
+ if (!trace_startsolid)
+ return TRUE;
+
+ // truncate to network accuracy
+ org_x = floor (org_x * 8 + (1.0 / 16)) * 0.125;
+ org_y = floor (org_y * 8 + (1.0 / 16)) * 0.125;
+ org_z = floor (org_z * 8 + (1.0 / 16)) * 0.125;
+
+ test = org;
+
+ static float offsets[] = {0, -1./8, 1./8, -2./8, 2./8};
+ for (float z = 0; z < offsets.length; z++)
+ {
+ test.z = org.z + offsets[z];
+ for (float y = 0; y < offsets.length; y++)
+ {
+ test.y = org.y + offsets[y];
+ for (float x = 0; x < offsets.length; x++)
+ {
+ test.x = org.x + offsets[x];
+ tracebox (test, self.mins, self.maxs, test,
+ FALSE, self);
+ if (!trace_startsolid)
+ {
+ // okay, that'll do
+ self.origin = test;
+ return TRUE;
+ }
+ }
+ }
+ }
+ self.origin = org;
+ return FALSE;
+};
+
+//----------------------------------------------------------------------
+// PM_DanceMove
+//
+// Updates origin according to velocity, moves the player through the world.
+// Same as Q3 SlideMove and Q1 FlyMove. This version handles steps, applies
+// gravity, and restores velocity based on a timer check (those latter two
+// are features of Q3's SlideMove). I've inlined a number of functions
+// (ClipVelocity, DoTouch) to hopefully improve performance.
+//
+// Based on code from the Nuclide SDK (presumably by Eukara), specifically
+// the function PMoveCustom_Move found in the file pmove_custom.qc. This
+// in turn appears to be based on a similar function in the CSQCTest code
+// that comes with FTEQW. -- CEV
+//----------------------------------------------------------------------
+void(float dogravity, float sticky, float dostep, float doskim) PM_DanceMove =
+{
+ vector end, prev_plane, prev_plane2, plane, start_v;
+ float backoff, grav, stepsize, time_left;
+ int i;
+ entity touched_ent;
+
+ // silence some FTEQCC warnings -- CEV
+ end = prev_plane = prev_plane2 = plane = start_v = '0 0 0';
+ backoff = grav = stepsize = time_left = 0;
+
+ if (dogravity)
+ {
+ if (self.gravity)
+ grav = self.gravity;
+ else
+ grav = 1.0;
+ grav = grav * autocvar (sv_gravity, PM_GRAVITY) *
+ input_timelength;
+ // Half now, half later. Apparently affects framerate
+ // dependence. -- CEV
+ self.velocity_z -= grav * 0.5;
+ }
+
+ start_v = self.velocity;
+
+ // Borrowing FTEQW's pm_airstep cvar here. If false, don't step up
+ // while in the air (changes stairs) -- CEV
+ if (!(autocvar(pm_airstep, TRUE)) && !(self.pmove_flags & PMF_ONGROUND))
+ dostep = FALSE;
+
+ // no stepping. useful for testing -- CEV
+ if (autocvar(pm_nostep, FALSE))
+ dostep = FALSE;
+
+ // we need to bounce off surfaces (in order to slide along them),
+ // so we need at 2 attempts -- comment from the Nuclide SDK
+ // I've changed this to a larger number of attempts (from 3 to 5)
+ // to accommodate more complex plane interactions -- CEV
+ for (i = 5, time_left = input_timelength; time_left > 0 && i; i--)
+ {
+ // set our destination & test the move -- CEV
+ end = self.origin + (self.velocity * time_left);
+ tracebox (self.origin, self.mins, self.maxs, end, FALSE, self);
+
+ if (trace_allsolid || trace_startsolid)
+ {
+ // entity is trapped in a solid; attempt to nudge out
+ if (PM_Nudge())
+ continue;
+
+ // nah, we're stuck. don't build up falling damage
+ // but allow sideways acceleration -- CEV
+ /*
+ #ifdef CSQC
+ dprint ("PM_DanceMove: client ");
+ #endif
+ #ifdef SSQC
+ dprint ("PM_DanceMove: server ");
+ #endif
+ #if defined(CSQC) || defined(SSQC)
+ dprint ("entity trapped in a solid!\n");
+ #endif
+ */
+ self.velocity_z = 0;
+ break;
+ }
+
+ // accept the move -- CEV
+ self.origin = trace_endpos;
+
+ if (trace_fraction >= 1.0f)
+ // no obstructions, made the whole move -- CEV
+ break;
+
+ // zero out stepsize, then store the plane normal and touched
+ // ent for later, then reduce time_left -- CEV
+ stepsize = 0;
+ plane = trace_plane_normal;
+ touched_ent = trace_ent;
+ time_left -= time_left * trace_fraction;
+
+ // integrated StepSlideMove from Nuclide / CSQCTest -- CEV
+ // only attempt to step if there's time left, stepping was
+ // requested, and we hit something like a vertical plane
+ if (dostep && time_left && plane_z >= 0 && plane_z <= 0.7f)
+ {
+ // first: move up
+ trace_endpos = self.origin;
+ trace_endpos_z += PM_STEPHEIGHT;
+ tracebox (self.origin, self.mins, self.maxs,
+ trace_endpos, FALSE, self);
+
+ // don't like having to store another float & vector
+ // but this solves more interactions (ztndm3) -- CEV
+ local float roof_fraction = trace_fraction;
+ local vector roof_plane = trace_plane_normal;
+
+ // second: move forward
+ stepsize = trace_endpos_z - self.origin_z;
+ end = trace_endpos + (self.velocity * time_left);
+ end_z = trace_endpos_z;
+ tracebox (trace_endpos, self.mins, self.maxs, end,
+ FALSE, self);
+
+ // save trace_ent if it has a touch function
+ if (trace_ent && trace_ent.touch != __NULL__)
+ touched_ent = trace_ent;
+
+ if (trace_allsolid || trace_startsolid)
+ {
+ // reject the move immediately -- CEV
+ #ifdef SSQC
+ dprint ("PM_DanceMove: fwd move solid\n");
+ #endif
+ stepsize = 0;
+ self.velocity = '0 0 0';
+ break;
+ }
+ else if (trace_fraction >= 1.0f)
+ {
+ // storing another vector, disappointed in
+ // myself -- CEV
+ local vector fwd_plane = trace_plane_normal;
+
+ // forward move didn't hit anything
+ // third: move down
+ end = trace_endpos;
+ end_z -= stepsize + 1;
+ tracebox (trace_endpos, self.mins, self.maxs,
+ end, FALSE, self);
+
+ if (trace_allsolid || trace_startsolid)
+ {
+ // again reject the move -- CEV
+ #ifdef SSQC
+ dprint ("PM_DanceMove: down move "
+ "solid\n");
+ #endif
+ stepsize = 0;
+ self.velocity = '0 0 0';
+ break;
+ }
+ else if (trace_fraction < 1.0f &&
+ trace_plane_normal_z > 0.7f)
+ {
+ // good ground, accept the move
+ if (roof_fraction < 1.0f &&
+ roof_plane != fwd_plane &&
+ roof_plane != plane)
+ {
+ // do a simple clipvel to the
+ // roof plane right now -- CEV
+ self.velocity -= roof_plane *
+ (self.velocity *
+ roof_plane);
+ }
+
+ stepsize = trace_endpos_z -
+ self.origin_z;
+ self.origin = trace_endpos;
+ time_left -= time_left * trace_fraction;
+
+ prev_plane2 = __NULL__;
+ prev_plane = fwd_plane;
+ plane = trace_plane_normal;
+
+ if (trace_ent &&
+ trace_ent.touch != __NULL__)
+ touched_ent = trace_ent;
+
+ // don't attempt to step again
+ dostep = FALSE;
+ }
+ else
+ {
+ // down move didn't hit and/or
+ // it hit a plane too steep to
+ // be ground -- CEV
+ stepsize = 0;
+ }
+ }
+ else if (trace_plane_normal != plane)
+ {
+ // raised forward move hit something different
+ // than the initial move so clip velocity to
+ // it. solves issues with weird ceilings and
+ // complex movement on stairs. note that we're
+ // not updating origin. -- CEV
+ prev_plane2 = __NULL__;
+ prev_plane = __NULL__;
+ time_left -= time_left * trace_fraction;
+ stepsize = 0;
+
+ if (roof_fraction < 1.0f &&
+ roof_plane != trace_plane_normal)
+ {
+ // save the roof plane & fwd plane
+ prev_plane = roof_plane;
+ plane = trace_plane_normal;
+ }
+ else if (roof_plane == trace_plane_normal)
+ {
+ // roof plane is fwd plane, so save
+ // first and fwd plane
+ prev_plane = plane;
+ plane = trace_plane_normal;
+ }
+ else
+ {
+ // only save fwd plane
+ plane = trace_plane_normal;
+ }
+ }
+ }
+
+ // need to do the ground check & touch the saved ent before
+ // we might stop the loop early -- CEV
+ if (plane_z > 0.7)
+ {
+ if (touched_ent.solid == SOLID_BSP)
+ {
+ self.groundentity = touched_ent;
+ self.groundnormal = plane;
+ self.flags |= FL_ONGROUND;
+ self.pmove_flags |= PMF_ONGROUND;
+ }
+ }
+ else
+ {
+ self.groundentity = __NULL__;
+ self.groundnormal = __NULL__;
+ self.flags &= ~FL_ONGROUND;
+ self.pmove_flags &= ~PMF_ONGROUND;
+ }
+
+ // touch the saved entity; inline PM_DoTouch -- CEV
+ if (touched_ent && touched_ent.touch != __NULL__)
+ {
+ local entity orig_self;
+
+ orig_self = self;
+ other = self;
+ self = touched_ent;
+ self.touch ();
+ self = orig_self;
+ }
+
+ // clip velocity to the saved plane
+ // inline PM_Rebound aka PM_ClipVelocity -- CEV
+ backoff = self.velocity * plane;
+
+ if (backoff < 0)
+ backoff *= PM_OVERCLIP;
+ else
+ if (sticky)
+ backoff /= PM_OVERCLIP;
+ else
+ backoff *= PM_ONESIDEDCLIP;
+
+ self.velocity -= plane * backoff;
+
+ // if velocity interacts with prev_plane then clip to it.
+ // I'm duplicating a little code here (ClipVelocity),
+ // hopefully the audience will forgive me. -- CEV
+ if (prev_plane && prev_plane != plane &&
+ self.velocity * prev_plane < 0)
+ {
+ backoff = self.velocity * prev_plane;
+
+ if (backoff < 0)
+ backoff *= PM_OVERCLIP;
+ else
+ if (sticky)
+ backoff /= PM_OVERCLIP;
+ else
+ backoff *= PM_ONESIDEDCLIP;
+
+ self.velocity -= prev_plane * backoff;
+
+ // Slide along the crease of previous plane and
+ // current plane if the two still interact -- CEV
+ if (self.velocity * plane < 0)
+ {
+ end = crossproduct (prev_plane, plane);
+ end = normalize (end);
+ self.velocity = end * (end * self.velocity);
+ }
+
+ // An optimization from Quake 3 -- CEV
+ if (prev_plane2 && prev_plane2 != plane &&
+ prev_plane2 != prev_plane &&
+ self.velocity * prev_plane2 < 0)
+ {
+ // Stop if we interact with three planes -- CEV
+ #ifdef SSQC
+ dprint ("PM_DanceMove: triple plane stop\n");
+ #endif
+ self.velocity = '0 0 0';
+ break;
+ }
+ }
+
+ // an optimization from Quake 1; is this necessary? -- CEV
+ if ((self.velocity * start_v) <= 0)
+ {
+ // we've turned against original velocity so
+ // clear vel and stop the loop
+ self.velocity = '0 0 0';
+ break;
+ }
+
+ // store current plane and prev_plane for later -- CEV
+ if (prev_plane)
+ prev_plane2 = prev_plane;
+ prev_plane = plane;
+ }
+
+ // wallclip / wall skim timer check
+ // if doskim is true and velocity is non-zero and we lost speed
+ // during the move then restore velocity -- CEV
+ if (doskim && self.velocity && (vlen(start_v) > vlen(self.velocity)))
+ {
+ /*
+ #ifdef SSQC
+ dprint ("PM_DanceMove: wall skim, restoring velocity...\n");
+ #endif
+ */
+ // take the start Z or clipped Z, whichever is lower -- CEV
+ if (start_v_z > self.velocity_z)
+ self.velocity = [start_v_x, start_v_y, self.velocity_z];
+ else
+ self.velocity = start_v;
+ }
+
+ // final gravity check here -- CEV
+ if (dogravity)
+ self.velocity_z -= grav * 0.5;
+
+ // if stepsize is nonzero and we changed from inair to onground then
+ // we've airstepped. this check is here as a placeholder for possible
+ // functionality later -- CEV
+ #ifdef SSQC
+ if (stepsize > 0 && !(self.pmove_flags & PMF_STARTGROUND) &&
+ self.pmove_flags & PMF_ONGROUND)
+ {
+ // more debugging -- CEV
+ dprint (sprintf("PM_DanceMove: airstep: %g\n", stepsize));
+ }
+ #endif
+
+ // a final call to setorigin to update links -- CEV
+ setorigin (self, self.origin);
+
+ /*
+ #ifdef SSQC
+ if (cvar("developer"))
+ // for debugging purposes -- CEV
+ dprint (sprintf("PM_DanceMove: %g bumps\n", 5 - i));
+ #endif
+ */
+};
+
+//----------------------------------------------------------------------
+// PM_CategorizePosition
+// Based on similarly-named function in the GPL2 purecsqc pmove.qc
+//----------------------------------------------------------------------
+void() PM_CategorizePosition =
+{
+ vector point;
+ float contents;
+
+ if (self.movetype == MOVETYPE_NOCLIP || self.movetype == MOVETYPE_FLY)
+ {
+ // noclip is never on ground
+ self.groundentity = __NULL__;
+ self.groundnormal = __NULL__;
+ self.pmove_flags &= ~PMF_DOUBLEJUMPED;
+ self.pmove_flags &= ~PMF_WALLJUMPED;
+ self.pmove_flags &= ~PMF_ONGROUND;
+ self.flags &= ~FL_ONGROUND;
+ }
+ else
+ {
+ // TODO CEV there must be a way to optimize out this
+ // tracebox ground check some of the time
+
+ // do a trace to check for ground
+ tracebox (self.origin, self.mins, self.maxs,
+ self.origin - PM_GROUNDDIST_V, FALSE, self);
+ // only onground if we hit it & it faces upwards
+ if (trace_fraction < 1.0f && trace_plane_normal_z > 0.7f)
+ {
+ // on ground
+ self.groundentity = trace_ent;
+ self.groundnormal = trace_plane_normal;
+ self.flags |= FL_ONGROUND;
+ self.pmove_flags |= PMF_ONGROUND;
+ self.pmove_flags &= ~PMF_WALLJUMPED;
+ }
+ else
+ {
+ // not on ground
+ self.groundentity = __NULL__;
+ self.groundnormal = __NULL__;
+ self.flags &= ~FL_ONGROUND;
+ self.pmove_flags &= ~PMF_ONGROUND;
+ }
+ }
+
+ // check water levels
+ point = self.origin;
+ point_z = self.origin_z + self.mins_z + 1;
+ contents = pointcontents (point);
+ if (contents < CONTENT_SOLID)
+ {
+ self.watertype = contents;
+ point_z = self.origin_z + (self.mins_z + self.maxs_z) * 0.5;
+ if (pointcontents(point) < CONTENT_SOLID)
+ {
+ point_z = self.origin_z + self.maxs_z;
+