djcev.com

//

Git Repos / fte_dogmode / commit 99c9cf2

Commit: 99c9cf2068b54f8c0b34f384b4c960f60b4e58c0
Parent: bbed149398d54162c1a2399766856efb96a3c535
Author: Cameron Vanderzanden, 2024-04-05 14:18
Committer: Cameron Vanderzanden, 2024-04-05 14:18

Commit Message

Player footsteps, shareware monsters, misc?

Refactoring and cleaning continues. Monsters from the shareware
release work again (Chthon, dogs, fiends, knights, ogres, shamblers,
soldiers, scraggs, zombies). Next task is to do the monsters from
the registered version.

I've also implemented player footsteps using the same timing and
structure as the steps in Arcane Dimensions. (Footsteps are tied
to player animation frames). I haven't settled on what sounds I
want to use just yet so those aren't included. (And I may pull
all the assets - models and sounds, etc - from this repo anyway.
I'll maintain a separate assets package if I go that route).

There are doubtless other small changes that I'm forgetting.

Change List

Diff qc/base_entities.qc

diff --git a/qc/base_entities.qc b/qc/base_entities.qc
index f37275a..2510aab 100644
--- a/qc/base_entities.qc
+++ b/qc/base_entities.qc
@@ -97,46 +97,58 @@ entity damage_attacker; // set by T_Damage
// forward declarations
//======================================================================

-#ifdef SSQC
// base entity
+#ifdef SSQC
float(entity src, entity dest) can_damage;
void(entity targ, entity inflictor, entity attacker) killed;
void(entity inflictor, entity attacker, float damage, entity ignore)
t_radiusdamage2;
void(entity attacker, float damage) t_beamdamage2;
void(entity targ, entity inflictor, entity attacker, float damage) t_damage2;
-// void(entity targ, entity inflictor, entity attacker, float damage) t_damage2;
-// void(entity inflictor, entity attacker, float damage) t_damage2_receive;
+#endif
+#if defined(CSQC) || defined(SSQC)
+void() sub_null; // Subs
+void(entity attacker, float damage) sub_nullpain;
+void() sub_remove;
void(entity doas, void() f) sub_runvoidas;
float(entity doas, float() f) sub_runfloatas;
float(entity toucher) sub_checkvalidtouch;
+#endif
+#ifdef SSQC
void() sub_usetargets;
void(string matchstring, .string matchfield) sub_killtarget;
void(string matchstring, .string matchfield) sub_usetarget;
+#endif

// base_tempentity
+#ifdef SSQC
void(entity e) base_tempentity_init;
strip void() base_tempentity;
+#endif

// temp_delayed_targets
+#ifdef SSQC
void() temp_delayed_targets_think;
entity() spawn_temp_delayed_targets;
void(entity e) temp_delayed_targets_init;
strip void() temp_delayed_targets;
+#endif

// base_mapentity
+#ifdef SSQC
void(entity e) sub_setmovedir;
void() sub_useandforgettargets;
void(entity e) base_mapentity_init;
strip void() base_mapentity;
+#endif

// noclass
+#ifdef SSQC
void() noclass;
#endif

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

-#ifdef SSQC
//----------------------------------------------------------------------
// class base_entity: entity
// {
@@ -144,6 +156,8 @@ void() noclass;
// Damage Functions
//==============================================================

+#ifdef SSQC
+
//--------------------------------------------------------------
// CanDamage
// Returns true if the source (inflictor) can directly damage
@@ -219,11 +233,8 @@ void() noclass;
self.takedamage = DAMAGE_NO;
self.touch = sub_null;

- // TODO CEV
- /*
if (self.classgroup & CG_MONSTER)
sub_death_use ();
- */

self.destroy ();

@@ -470,20 +481,13 @@ void() noclass;
// do the damage
targ.health = targ.health - take;

- /*
- // TODO CEV
// fire pain_target if appropriate
if ((targ.flags & FL_MONSTER) &&
targ.pain_target != "" &&
targ.health <= targ.pain_threshold)
{
- // TODO CEV
- oldself = self;
- self = targ;
- monster_pain_use ();
- self = oldself;
+ sub_runvoidas (targ, sub_pain_use);
}
- */

if (targ.health <= 0)
{
@@ -524,8 +528,7 @@ void() noclass;
self.oldenemy =
self.enemy;
self.enemy = attacker;
- // TODO CEV
- // ai_foundtarget ();
+ ai_foundtarget ();
}
}
else if ((self.classname != attacker.classname)
@@ -543,8 +546,7 @@ void() noclass;
if (self.enemy.classtype == CT_PLAYER)
self.oldenemy = self.enemy;
self.enemy = attacker;
- // TODO CEV
- // ai_foundtarget ();
+ ai_foundtarget ();
}
}
}
@@ -560,247 +562,30 @@ void() noclass;

self = stemp;
};
+#endif

+ //==============================================================
+ // Subs
+ //==============================================================
+
+#if defined(CSQC) || defined(SSQC)
//--------------------------------------------------------------
- // T_Damage
- // The damage is coming from inflictor, but get mad at attacker
- // This should be the only function that ever reduces health.
- //--------------------------------------------------------------
- /*
- void(entity targ, entity inflictor, entity attacker, float damage)
- t_damage2 =
+ void() sub_null =
{
- // don't try to damage the world. Not healthy - bmFbr
- if (!targ)
- return;
-
- if (!targ.takedamage)
- return;
-
- // team play damage avoidance
- // 1998-07-29 Teamplay 1 fix by Maddes start
- if ((teamplay == 1) && (targ.team > 0) &&
- (targ.team == attacker.team) && (targ != attacker) &&
- (attacker.classtype == CT_PLAYER) &&
- (inflictor.classtype != CT_FUNC_DOOR))
- {
- // because squishing a teammate is still possible
- // 1998-07-29 Teamplay 1 fix by Maddes end
- return;
- }
-
- // some func_breakables ignore monster damage -- johnfitz
- // added from Rubicon2 combat.qc -- dumptruck_ds
- if (targ.classtype == CT_FUNC_BREAKABLE)
- {
- if (targ.spawnflags & BREAKABLE_NO_MONSTERS &&
- attacker.flags & FL_MONSTER)
- {
- return;
- }
- }
- // johnfitz
-
- // used by buttons and triggers to set activator for
- // target firing
- damage_attacker = attacker;
-
- // check for quad damage powerup on the attacker
- if (attacker.super_damage_finished > time)
- damage = damage * 4;
-
- // damage mod for monsters -- dumptruck_ds
- if (attacker.damage_mod)
- damage = damage * attacker.damage_mod;
-
- local entity stemp = self;
- self = targ;
- t_damage2_receive (inflictor, attacker, damage);
- self = stemp;
+ // no-op
};

//--------------------------------------------------------------
- // 'self' in this function should be the receiver of the damage
- //--------------------------------------------------------------
- void(entity inflictor, entity attacker, float damage)
- t_damage2_receive =
+ void(entity attacker, float damage) sub_nullpain =
{
- local vector dir;
- local float save;
- local float take;
- local float ignore_armor; // johnfitz
- local string death_type; // johnfitz
-
- // make sure deathtype doesn't keep stale info after
- // this function is done -- johnfitz
- death_type = self.deathtype;
- self.deathtype = "";
- // johnfitz
-
- // don't deplete armor if drowning/burning, or protected by
- // biosuit/pentagram/godmode (note: in ID1 pentagram/godmode
- // doesn't actually protect your armor)
- if (death_type == "burning" || death_type == "drowning" ||
- self.invincible_finished >= time ||
- self.flags & FL_GODMODE)
- {
- ignore_armor = TRUE;
- }
- else
- {
- ignore_armor = FALSE;
- }
-
- // johnfitz
- // save damage based on the target's armor level
- if (ignore_armor)
- {
- // johnfitz -- some damage doesn't deplete armor
- save = 0;
- }
- else
- {
- save = ceil (self.armortype * damage);
- if (save >= self.armorvalue)
- {
- save = self.armorvalue;
- // lost all armor
- self.armortype = 0;
- self.items = self.items - (self.items &
- (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3));
- }
- }
-
- self.armorvalue = self.armorvalue - save;
- take = ceil (damage - save);
-
- // add to the damage total for clients, which will be sent as a
- // single message at the end of the frame
- // FIXME: remove after combining shotgun blasts?
- if (self.flags & FL_CLIENT)
- {
- self.dmg_take = self.dmg_take + take;
- self.dmg_save = self.dmg_save + save;
- self.dmg_inflictor = inflictor;
- }
-
- // figure momentum add
- if ((inflictor != world) && (self.movetype == MOVETYPE_WALK))
- {
- dir = self.origin -
- (inflictor.absmin + inflictor.absmax) * 0.5;
- dir = normalize (dir);
- self.velocity = self.velocity + dir * damage * 8;
- }
-
- // check for godmode, then invincibility
- // must happen after possibly changing velocity -- CEV
- if (self.flags & FL_GODMODE)
- return;
-
- if (self.invincible_finished >= time)
- {
- if (self.invincible_sound < time)
- {
- sound (self, CHAN_ITEM, "items/protect3.wav",
- 1, ATTN_NORM);
- self.invincible_sound = time + 2;
- }
- return;
- }
-
- // do the damage
- self.health = self.health - take;
-
- // fire pain_target if appropriate
- if ((self.flags & FL_MONSTER) && self.pain_target != "" &&
- self.health <= self.pain_threshold)
- {
- // TODO CEV
- sub_pain_use ();
- }
-
- if (self.health <= 0)
- {
- killed (inflictor, attacker);
- return;
- }
-
- // react to the damage
- if ((self.flags & FL_MONSTER) && attacker != world)
- {
- // get mad unless of the same class (except soldiers)
- if (self != attacker && attacker != self.enemy)
- {
- local float mode;
- mode = 0;
-
- // take highest mode so infighting happens
- // consistently
- if (self.infight_mode == -1 ||
- self.infight_mode > mode)
- {
- mode = self.infight_mode;
- }
-
- if (mode != -1 && attacker.infight_mode > mode)
- {
- mode = attacker.infight_mode;
- }
-
- // soldiers of the same style will infight
- // -- dumptruck_ds
- // thanks for c0burn and Shamblernaut forx
- // your help!
- if (mode == -1)
- {
- if (attacker.classtype == CT_PLAYER)
- {
- if (self.enemy.classtype ==
- CT_PLAYER)
- {
- self.oldenemy =
- self.enemy;
- }
- self.enemy = attacker;
- // TODO CEV
- ai_foundtarget ();
- }
- }
- else if ((self.classtype != attacker.classtype)
- || ((self.classtype == CT_MONSTER_GRUNT)
- && (self.style == attacker.style)) ||
- // infight if different models
- (mode > 0 && self.mdl_body !=
- attacker.mdl_body) ||
- // infight if different skin
- (mode > 1 && self.skin !=
- attacker.skin) ||
- // always infight
- (mode > 2))
- {
- if (self.enemy.classtype == CT_PLAYER)
- self.oldenemy = self.enemy;
- self.enemy = attacker;
- // TODO CEV
- ai_foundtarget ();
- }
- }
- }
-
- // TODO CEV
- if (self.pain)
- {
- self.pain (attacker, take);
- if (skill == 3)
- self.pain_finished = time + 5;
- }
+ // no-op
};
- */

- //==============================================================
- // Subs
- //==============================================================
+ //--------------------------------------------------------------
+ void() sub_remove =
+ {
+ remove (self);
+ };

//--------------------------------------------------------------
// SUB_CallAsSelf
@@ -855,7 +640,9 @@ void() noclass;

return TRUE;
};
+#endif

+#ifdef SSQC
//--------------------------------------------------------------
void() sub_usetargets =
{
@@ -998,8 +785,8 @@ void() noclass;
t = find (t, matchfield, matchstring);
}
};
-// };
#endif
+// };

#ifdef SSQC
//----------------------------------------------------------------------

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

Diff qc/base_monster.qc

diff --git a/qc/base_monster.qc b/qc/base_monster.qc
index cae1589..62ad591 100644
--- a/qc/base_monster.qc
+++ b/qc/base_monster.qc
@@ -6,20 +6,12 @@
// constants
//======================================================================

-// think and use states should start at -1 and decrement because
-// subclasses will start at 0 and work up -- CEV
-const float MONSTER_THINK_START = -1;
-const float MONSTER_THINK_FOUNDTARGET = -2;
-const float MONSTER_USE_MAKEANGRY = -1;
-const float MONSTER_USE_TELEDELAY = -2;
-
-// spawnflags
-const float NO_SIGHT_SOUND = 32;
+const float NO_SIGHT_SOUND = 32; // spawnflags
const float PASSIVE_UNTIL_ATTACKED = 64;
const float PASSIVE_ALWAYS = 128;
+const float I_AM_TURRET = 262144; // dumptruck_ds

-// values for attack_state field (defined in base_monster below)
-const float AS_STRAIGHT = 1;
+const float AS_STRAIGHT = 1; // values for attack_state field
const float AS_SLIDING = 2;
const float AS_MELEE = 3;
const float AS_MISSILE = 4;
@@ -30,8 +22,6 @@ const float RANGE_NEAR = 1;
const float RANGE_MID = 2;
const float RANGE_FAR = 3;

-const float I_AM_TURRET = 262144; // dumptruck_ds
-
//======================================================================
// globals
//======================================================================
@@ -49,27 +39,116 @@ entity sight_entity; // was in ai.qc
// fields
//======================================================================

+.float attack_elevation; // Preach's Z-aware nades -- CEV
+.float attack_state;
.float berserk; // dumptruck_ds
.float drop_item; // key DropStuff
.float infight_mode;
.float keep_ammo; // dumptruck_ds
+.float pain_threshold; // dumptruck_ds
.float pausetime;
-.float search_time; // base_monster
+.float search_time;
.float sight_trigger; // dumptruck_ds
.float spawn_angry; // dumptruck_ds
-
-.float pain_threshold; // dumptruck_ds
+.float touch_time;

.entity infight_activator;
.entity movetarget;

+.string tele_model; // Preach's new fields -- dumptruck_ds
+.vector tele_mins; // TODO CEV
+.vector tele_maxs;
+.float tele_solid;
+.float tele_movetype;
+
+.void() think_stand; // the typical th_ monster functions
+.void() think_walk;
+.void() think_run;
+.void() think_missile;
+.void() think_melee;
+.void() think_turret;
+
+.float() checkattack; // per-monster CheckAttack -- CEV
+.void() sightsound; // per-monster SightSound -- CEV
+
//======================================================================
// forward declarations
//======================================================================

+void(float n) monster_update_total;
+
+// base_monster // generic projectile firing
+void(vector org, float projspeed) base_monster_fire_flak;
+void(vector org, float direct, float splash, float elevation)
+ base_monster_fire_grenade;
+void(vector org, vector dir, float off) base_monster_fire_hknightspell;
+void(vector org, vector dir) base_monster_fire_laser;
+void(vector org, vector dir, float projspeed) base_monster_fire_lavaball;
+void() base_monster_fire_multigrenade;
+void(vector org, vector dir, float direct, float splash, float projspeed)
+ base_monster_fire_rocket;
+void(vector org, vector dir, vector spread) base_monster_fire_shotgun;
+void(vector org, vector dir, float damage, float projspeed)
+ base_monster_fire_spike;
+void(vector org, vector dir) base_monster_fire_voreball;
+void() base_monster_fire_wizardspell;
+void(vector offset, float elevation) base_monster_fire_zombiechunk;
+float() ai_checkattack; // monster AI
+float(entity targ) ai_infront;
+float(entity targ) ai_range;
+float(entity targ) ai_visible;
+void() ai_hunttarget;
+void() ai_foundtarget;
+float() ai_findtarget;
+void() ai_face;
+float() ai_facing_ideal;
+void(float dist) ai_forward;
+void(float dist) ai_back;
+void(float dist) ai_pain;
+void(float dist) ai_painforward;
+void(float dist) ai_walk;
+void() ai_stand;
+void() ai_turn;
+void() ai_run_melee;
+void() ai_run_missile;
+void() ai_run_slide;
+void(float dist) ai_run;
+void(float dist) ai_charge;
+void() ai_charge_side;
+void() ai_melee;
+void() ai_melee_side;
+void(float normal) sub_attackfinished; // monster subs
+void(void() nextfunc) sub_checkrefire;
+float(.string fld) sub_fieldistargeted;
+float() sub_istargeted;
+void() sub_death_use;
+void() sub_pain_use;
+void() base_monster_think_teleport_go; // monster interaction
+void() base_monster_touch;
+void() base_monster_use_teledelay;
+void() base_monster_use_angry;
+void() base_monster_init_teleport_check;// monster initialization
+float(entity e, void() start_fn) base_monster_init_teleport;
+void(entity e) base_monster_init;
+strip void() base_monster;
+
+// base_flymonster
+void() base_flymonster_think_start;
+void(entity e) base_flymonster_init;
+strip void() base_flymonster;
+
+// base_swimmonster
+void() base_swimmonster_think_start;
+void(entity e) base_swimmonster_init;
+strip void() base_swimmonster;
+
+// base_walkmonster
+void() base_walkmonster_think_start;
+void(entity e) base_walkmonster_init;
+strip void() base_walkmonster;
+
//------------------------------------------------------------------------------

-#if 0
//======================================================================
// .enemy
// Will be world if not currently angry at anyone.
@@ -112,27 +191,9 @@ void(float n) monster_update_total =
WriteLong (MSG_ALL, total_monsters);
};

-//------------------------------------------------------------------------------
-class base_monster: base_mapentity
-{
- float attack_state;
- float touch_time;
- float use_flag;
-
- string tele_model; // Preach's new fields -- dumptruck_ds
- vector tele_mins;
- vector tele_maxs;
- float tele_solid;
- float tele_movetype;
-
- // the typical th_ monster think functions -- CEV
- virtual void() think_stand = {};
- virtual void() think_walk = {};
- virtual void() think_run = {};
- virtual void() think_missile = {};
- virtual void() think_melee = {};
- virtual void() think_turret = {};
-
+//----------------------------------------------------------------------
+// class base_monster: base_mapentity
+// {
//==============================================================
// Generic Monster Weapon Firing
//==============================================================
@@ -140,16 +201,16 @@ class base_monster: base_mapentity
//--------------------------------------------------------------
// BDW_OgreFireFlak
//--------------------------------------------------------------
- nonvirtual void(vector org, float projspeed) fire_flak =
+ void(vector org, float projspeed) base_monster_fire_flak =
{
local float flakcount = 8;
local vector dir, ang;

- this.effects = this.effects | EF_MUZZLEFLASH;
- sound (this, CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM);
+ self.effects = self.effects | EF_MUZZLEFLASH;
+ sound (self, CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM);

// make angles out of the current displacement vector...
- ang = vectoangles (this.enemy.origin - this.origin);
+ ang = vectoangles (self.enemy.origin - self.origin);
// then get the required components...
makevectors (ang);

@@ -160,31 +221,13 @@ class base_monster: base_mapentity
crandom() * v_right +
crandom() * v_up;
dir = normalize (dir);
- // f*cking hack...is this a v_forward problem?
+ // f*cking hack...is self a v_forward problem?
dir_z *= -1;
// SetSpeed -- CEV
- dir *= min (projspeed * (this.proj_speed_mod ?
- this.proj_speed_mod : 1), frame_maxvelocity);
-
- spawn (projectile_flak,
- // this is a hack to tell FlakTouch that
- // it came from an ogre
- spawnflags: MONSTER_FLAK_OGRE,
- owner: this,
- // origin offset suitable for an ogre -- CEV
- origin: org,
- velocity: dir,
- // parameters for homing
- homing: this.homing,
- enemy: this.enemy,
- proj_speed_mod: this.proj_speed_mod,
- waitmin: this.waitmin,
- // model & skin
- mdl_proj: this.mdl_proj,
- skin_proj: this.skin_proj,
- // sound
- snd_hit: this.snd_hit);
+ dir *= min (projspeed * (self.proj_speed_mod ?
+ self.proj_speed_mod : 1), world_maxvelocity);

+ spawn_projectile_flak (self, org, dir);
flakcount -= 1;
}
};
@@ -192,18 +235,18 @@ class base_monster: base_mapentity
//--------------------------------------------------------------
// Monster grenade function, incorporates PreachFireGrenade -- CEV
//--------------------------------------------------------------
- nonvirtual void(vector org, float direct, float splash,
- float elevation) fire_grenade =
+ void(vector org, float direct, float splash, float elevation)
+ base_monster_fire_grenade =
{
local vector missile_velocity = '0 0 0';

- this.effects = this.effects | EF_MUZZLEFLASH;
- sound (this, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
+ self.effects = self.effects | EF_MUZZLEFLASH;
+ sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);

// set missile speed
if (elevation)
{
- local vector ang = this.angles;
+ local vector ang = self.angles;
ang_x = -elevation;
makevectors (ang);
missile_velocity = v_forward * GRENADE_SPEED;
@@ -211,161 +254,100 @@ class base_monster: base_mapentity
else
{
missile_velocity =
- normalize (this.enemy.origin - this.origin);
+ normalize (self.enemy.origin - self.origin);
missile_velocity *= 600;
missile_velocity_z = 200;
}

- spawn (projectile_grenade,
- owner: this,
- origin: org,
- velocity: missile_velocity,
- direct_damage: direct,
- splash_damage: splash,
- mdl_proj: this.mdl_proj,
- skin_proj: this.skin_proj,
- // sound
- snd_hit: this.snd_hit);
+ // TODO CEV pass direct and splash damage?
+ spawn_projectile_grenade (self, org, missile_velocity);
};

//--------------------------------------------------------------
// hknight_shot
//--------------------------------------------------------------
- nonvirtual void(vector org, vector dir, float off) fire_hknightspell =
+ void(vector org, vector dir, float off) base_monster_fire_hknightspell =
{
// set missile speed
dir = normalize (v_forward);
dir_z = 0 - dir_z + (random() - 0.5) * 0.1;
- dir *= min (HKNSPELL_SPEED * (this.proj_speed_mod ?
- this.proj_speed_mod : 1), frame_maxvelocity);
-
- spawn (projectile_hknightspell,
- owner: this,
- origin: org,
- velocity: dir,
- projexpl: this.projexpl,
- // parameters for homing
- homing: this.homing,
- enemy: this.enemy,
- proj_speed_mod: this.proj_speed_mod,
- waitmin: this.waitmin,
- // model & skin
- mdl_proj: this.mdl_proj,
- skin_proj: this.skin_proj,
- snd_hit: this.snd_hit,
- // unique to this magic missile
- spell_offset: off);
-
- sound_attack (this, CHAN_WEAPON, "hknight/attack1.wav",
+ dir *= min (HKNSPELL_SPEED * (self.proj_speed_mod ?
+ self.proj_speed_mod : 1), world_maxvelocity);
+
+ spawn_projectile_hknightspell (self, org, dir, off);
+ sound_attack (self, CHAN_WEAPON, "hknight/attack1.wav",
1, ATTN_NORM);
};

//--------------------------------------------------------------
// Enforcer lasers, was LaunchLaser
//--------------------------------------------------------------
- nonvirtual void(vector org, vector dir) fire_laser =
+ void(vector org, vector dir) base_monster_fire_laser =
{
- this.effects = this.effects | EF_MUZZLEFLASH;
- sound_attack (this, CHAN_WEAPON, "enforcer/enfire.wav",
+ self.effects = self.effects | EF_MUZZLEFLASH;
+ sound_attack (self, CHAN_WEAPON, "enforcer/enfire.wav",
1, ATTN_NORM);

dir = normalize (dir);
// SetSpeed (newmis, vec, projspeed);
- dir *= min (LASER_SPEED * (this.proj_speed_mod ?
- this.proj_speed_mod : 1), frame_maxvelocity);
-
- spawn (projectile_laser,
- owner: this,
- origin: org,
- velocity: dir,
- homing: this.homing,
- enemy: this.enemy,
- proj_speed_mod: this.proj_speed_mod,
- snd_hit: this.snd_hit,
- mdl_proj: this.mdl_proj,
- skin_proj: this.skin_proj);
+ dir *= min (LASER_SPEED * (self.proj_speed_mod ?
+ self.proj_speed_mod : 1), world_maxvelocity);
+
+ spawn_projectile_laser (self, org, dir);
};

//--------------------------------------------------------------
- nonvirtual void(vector org, vector dir, float projspeed) fire_lavaball =
+ void(vector org, vector dir, float projspeed)
+ base_monster_fire_lavaball =
{
dir = normalize (dir);
// SetSpeed
- dir *= min (projspeed * (this.proj_speed_mod ?
- this.proj_speed_mod : 1), frame_maxvelocity);
-
- spawn (projectile_lavaball,
- owner: this,
- origin: org,
- velocity: dir,
- // custom spin of projectile - monster_shambler
- avelocity: this.cust_avelocity,
- homing: this.homing,
- enemy: this.enemy,
- proj_basespeed: projspeed,
- proj_speed_mod: this.proj_speed_mod,
- mdl_proj: this.mdl_proj,
- skin_proj: this.skin_proj,
- // sound
- snd_hit: this.snd_hit);
+ dir *= min (projspeed * (self.proj_speed_mod ?
+ self.proj_speed_mod : 1), world_maxvelocity);
+
+ spawn_projectile_lavaball (self, org, dir);
};

//--------------------------------------------------------------
// DOE multigrenades
//--------------------------------------------------------------
- nonvirtual void() fire_multigrenade =
+ void() base_monster_fire_multigrenade =
{
local vector missile_velocity;

- sound (this, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
+ sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);

- // this.punchangle_x = -2;
+ // self.punchangle_x = -2;

// set missile speed
- missile_velocity = normalize (this.enemy.origin - this.origin);
+ missile_velocity = normalize (self.enemy.origin - self.origin);
missile_velocity *= 600;
missile_velocity_z = 200;

- spawn (projectile_multigrenade,
- owner: this,
- origin: this.origin + '0 0 16',
- velocity: missile_velocity,
- // dumptruck_ds
- skin: this.skin_proj,
- snd_hit: this.snd_hit);
+ spawn_projectile_multigrenade (self, self.origin + '0 0 16',
+ missile_velocity);
};

//--------------------------------------------------------------
- nonvirtual void(vector org, vector dir, float direct, float splash,
- float projspeed) fire_rocket =
+ void(vector org, vector dir, float direct, float splash,
+ float projspeed) base_monster_fire_rocket =
{
- this.effects = this.effects | EF_MUZZLEFLASH;
- sound_attack (this, CHAN_WEAPON, "weapons/sgun1.wav",
+ self.effects = self.effects | EF_MUZZLEFLASH;
+ sound_attack (self, CHAN_WEAPON, "weapons/sgun1.wav",
1, ATTN_NORM);

dir = normalize (dir);
// SetSpeed
- dir *= min (projspeed * (this.proj_speed_mod ?
- this.proj_speed_mod : 1), frame_maxvelocity);
-
- spawn (projectile_rocket,
- owner: this,
- origin: org,
- velocity: dir,
- direct_damage: direct,
- splash_damage: splash,
- homing: this.homing,
- enemy: this.enemy,
- proj_basespeed: projspeed,
- proj_speed_mod: this.proj_speed_mod,
- mdl_proj: this.mdl_proj,
- skin_proj: this.skin_proj,
- // sound
- snd_hit: this.snd_hit);
+ dir *= min (projspeed * (self.proj_speed_mod ?
+ self.proj_speed_mod : 1), world_maxvelocity);
+
+
+ // TODO CEV pass direct & splash damage?
+ spawn_projectile_rocket (self, org, dir, projspeed);
};

//--------------------------------------------------------------
- nonvirtual void(vector org, vector dir, vector spread) fire_shotgun =
+ void(vector org, vector dir, vector spread) base_monster_fire_shotgun =
{
local vector vdir;
local float vspeed;
@@ -377,153 +359,104 @@ class base_monster: base_mapentity
vdir = dir + crandom() * spread_x * v_right +
crandom() * spread_y * v_up;

- vdir *= min (vspeed, frame_maxvelocity);
+ vdir *= min (vspeed, world_maxvelocity);

- spawn (projectile_bullet,
- owner: this,
- origin: org,
- velocity: vdir);
+ spawn_projectile_bullet (self, org, vdir);
}
};

//--------------------------------------------------------------
- nonvirtual void(vector org, vector dir, float damage, float projspeed)
- fire_spike =
+ void(vector org, vector dir, float damage, float projspeed)
+ base_monster_fire_spike =
{
dir = normalize (dir);
// SetSpeed
- dir *= min (projspeed * (this.proj_speed_mod ?
- this.proj_speed_mod : 1), frame_maxvelocity);
-
- spawn (projectile_spike,
- owner: this,
- origin: org,
- velocity: dir,
- direct_damage: damage,
- // homing fields
- homing: this.homing,
- enemy: this.enemy,
- proj_basespeed: projspeed,
- proj_speed_mod: this.proj_speed_mod,
- // model fields
- mdl_proj: this.mdl_proj,
- skin_proj: this.skin_proj,
- // sound
- snd_hit: this.snd_hit);
+ dir *= min (projspeed * (self.proj_speed_mod ?
+ self.proj_speed_mod : 1), world_maxvelocity);
+
+ spawn_projectile_spike (self, org, dir, damage, projspeed);
};

//--------------------------------------------------------------
// ShalMissile
//--------------------------------------------------------------
- nonvirtual void(vector org, vector dir) fire_voreball =
+ void(vector org, vector dir) base_monster_fire_voreball =
{
local float basespeed;

- this.effects = this.effects | EF_MUZZLEFLASH;
- sound_misc (this, CHAN_WEAPON, "shalrath/attack2.wav",
+ self.effects = self.effects | EF_MUZZLEFLASH;
+ sound_misc (self, CHAN_WEAPON, "shalrath/attack2.wav",
1, ATTN_NORM);

dir = normalize (dir);
// SetSpeed
- dir *= min (VOREBALL_SPEED * proj_speed_mod, frame_maxvelocity);
+ dir *= min (VOREBALL_SPEED * self.proj_speed_mod,
+ world_maxvelocity);

if (skill == 3)
- basespeed = 350 * this.proj_speed_mod;
+ basespeed = 350 * self.proj_speed_mod;
else
- basespeed = 250 * this.proj_speed_mod;
-
- spawn (projectile_voreball,
- owner: this,
- enemy: this.enemy,
- origin: org,
- velocity: dir,
- avelocity: this.cust_avelocity,
- homing: this.homing,
- proj_basespeed: basespeed,
- proj_speed_mod: this.proj_speed_mod,
- mdl_proj: this.mdl_proj,
- skin_proj: this.skin_proj,
- // sound
- snd_hit: this.snd_hit);
+ basespeed = 250 * self.proj_speed_mod;
+
+ spawn_projectile_voreball (self, org, dir, basespeed);
};

//--------------------------------------------------------------
// Wiz_StartFast
//--------------------------------------------------------------
- nonvirtual void() fire_wizardspell =
+ void() base_monster_fire_wizardspell =
{
- this.v_angle = this.angles;
- makevectors (this.angles);
-
- spawn (projectile_wizardspell,
- owner: this,
- enemy: this.enemy,
- origin: this.origin + '0 0 30' +
- v_forward * 14 + v_right * 14,
- movedir: v_right,
- proj_basespeed: WIZMIS_SPEED,
- proj_speed_mod: this.proj_speed_mod,
- projexpl: this.projexpl,
- // two nextthinks were present in Wiz_StartFast,
- // I'm leaving the last of them -- CEV
- // nextthink: time + 0.6,
- nextthink: time + 0.8);
-
- spawn (projectile_wizardspell,
- owner: this,
- enemy: this.enemy,
- origin: this.origin + '0 0 30' +
- v_forward * 14 + v_right * -14,
- movedir: '0 0 0' - v_right,
- proj_basespeed: WIZMIS_SPEED,
- proj_speed_mod: this.proj_speed_mod,
- projexpl: this.projexpl,
- // two nextthinks were present in Wiz_StartFast,
- // I'm leaving the last of them -- CEV
- // nextthink: time + 1,
- nextthink: time + 0.3);
+ self.v_angle = self.angles;
+ makevectors (self.angles);
+
+ // two nextthinks were present in Wiz_StartFast, I'm leaving
+ // the last of them -- CEV
+ // nextthink: time + 0.6,
+ spawn_projectile_wizardspell (self,
+ self.origin + '0 0 30' + v_forward * 14 + v_right * 14,
+ v_right, time + 0.8);
+
+ // two nextthinks were present in Wiz_StartFast, I'm leaving
+ // the last of them -- CEV
+ // nextthink: time + 1,
+ spawn_projectile_wizardspell (self,
+ self.origin + '0 0 30' + v_forward * 14 + v_right * -14,
+ '0 0 0' - v_right, time + 0.3);
};

//--------------------------------------------------------------
// Throw a zombie gib; incorporates PreachFireGrenade -- CEV
//--------------------------------------------------------------
- nonvirtual void(vector offset, float elevation) fire_zombiechunk =
+ void(vector offset, float elevation) base_monster_fire_zombiechunk =
{
- local vector missile_velocity = '0 0 0';
+ local vector vel = '0 0 0';

- sound_attack (this, CHAN_WEAPON, "zombie/z_shot1.wav",
+ sound_attack (self, CHAN_WEAPON, "zombie/z_shot1.wav",
1, ATTN_NORM);

// set missile speed
if (elevation)
{
// PreachFireZombie -- for Z-Aware Zombies
- local vector ang = this.angles;
+ local vector ang = self.angles;
ang_x = -elevation;
makevectors (ang);
- missile_velocity = v_forward * ZCHUNK_SPEED;
+ vel = v_forward * ZCHUNK_SPEED;
}
else
{
// calc org
offset = offset_x * v_forward +
offset_y * v_right + (offset_z - 24) * v_up;
- local vector org = this.origin + offset;
+ local vector org = self.origin + offset;

- makevectors (this.angles);
- missile_velocity = normalize (this.enemy.origin - org);
- missile_velocity = missile_velocity * ZCHUNK_SPEED;
- missile_velocity_z = 200;
+ makevectors (self.angles);
+ vel = normalize (self.enemy.origin - org);
+ vel = vel * ZCHUNK_SPEED;
+ vel_z = 200;
}

- spawn (projectile_zombiechunk,
- owner: this,
- origin: this.origin + offset,
- velocity: missile_velocity,
- mdl_proj: this.mdl_proj,
- skin_proj: this.skin_proj,
- // sound
- snd_hit: this.snd_hit);
+ spawn_projectile_zombiechunk (self, self.origin + offset, vel);
};

//==============================================================
@@ -537,67 +470,79 @@ class base_monster: base_mapentity
// The player is in view, so decide to move or launch an attack
// Returns FALSE if movement should continue
//--------------------------------------------------------------
- virtual float() ai_checkattack =
+ float() ai_checkattack =
{
+ // Drake devkit -- dumptruck_ds
+ if (cutscene)
+ if (self.enemy.classtype == CT_INFO_MOVIE_CAMERA)
+ // Don't attack the camera (player)!
+ return FALSE;
+
+ if (!enemy_vis)
+ return FALSE;
+
+ if (self.checkattack)
+ return self.checkattack ();
+
local vector spot1 = '0 0 0';
local vector spot2 = '0 0 0';
local entity targ;
local float chance;

- // TODO CEV: fix these classname checks, generalize
- // calls to knight_attack
+ // TODO CEV: fix these class checks, generalize
+ // call to knight_attack

// dumptruck_ds
- if (this.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & I_AM_TURRET)
{
// dprint ("CheckAttack...\n");
- if (this.classname == "monster_enforcer")
+ if (self.classtype == CT_MONSTER_ENFORCER)
{
- if (this.style == 4)
+ if (self.style == 4)
{
// lightning can only go so far
if (vlen(spot1 - spot2) > 900)
return FALSE;
}
- this.attack_state = AS_MISSILE;
+ self.attack_state = AS_MISSILE;
}
- else if (this.classname == "monster_hell_knight")
+ else if (self.classtype == CT_MONSTER_DEATHKNIGHT)
{
- if (this.style == 1)
+ if (self.style == 1)
{
// lightning can only go so far
if (vlen(spot1 - spot2) > 900)
return FALSE;
}
- // this.attack_state = AS_MISSILE;
- this.think_turret ();
+ // self.attack_state = AS_MISSILE;
+ self.think_turret ();
}
- else if (this.classname == "monster_shalrath")
+ else if (self.classtype == CT_MONSTER_VORE)
{
- this.think_turret ();
+ self.think_turret ();
}
- else if (this.classname == "monster_zombie")
+ else if (self.classtype == CT_MONSTER_ZOMBIE)
{
// dprint ("CheckAttack...\n");
// zombie_turret_missile ();
- this.think_turret ();
+ self.think_turret ();
}
sub_attackfinished (2 * random());
return TRUE;
}

- targ = this.enemy;
+ targ = self.enemy;

// see if any entities are in the way of the shot
- spot1 = this.origin + this.view_ofs;
+ spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;

- traceline (spot1, spot2, FALSE, this);
+ traceline (spot1, spot2, FALSE, self);

- if ((this.spawnflags & I_AM_TURRET) && (trace_ent != targ))
+ if ((self.spawnflags & I_AM_TURRET) && (trace_ent != targ))
{
// dprint ("trace_ent...\n");
- this.attack_state = AS_TURRET;
+ self.attack_state = AS_TURRET;
return FALSE;
}

@@ -612,18 +557,22 @@ class base_monster: base_mapentity
if (enemy_range == RANGE_MELEE)
{
// melee attack
- if (this.classtype == CT_MONSTER_KNIGHT)
- ((monster_knight)this).knight_attack ();
- else
- this.think_melee ();
- return TRUE;
+ if (self.think_melee)
+ {
+ // TODO CEV
+ if (self.classtype == CT_MONSTER_KNIGHT)
+ monster_knight_attack ();
+ else
+ self.think_melee ();
+ return TRUE;
+ }
}

// missile attack
- if (!this.think_missile)
+ if (!self.think_missile)
return FALSE;

- if (time < this.attack_finished)
+ if (time < self.attack_finished)
return FALSE;

if (enemy_range == RANGE_FAR)
@@ -632,18 +581,18 @@ class base_monster: base_mapentity
if (enemy_range == RANGE_MELEE)
{
chance = 0.9;
- this.attack_finished = 0;
+ self.attack_finished = 0;
}
else if (enemy_range == RANGE_NEAR)
{
- if (this.think_melee)
+ if (self.think_melee)
chance = 0.2;
else
chance = 0.4;
}
else if (enemy_range == RANGE_MID)
{
- if (this.think_melee)
+ if (self.think_melee)
chance = 0.05;
else
chance = 0.1;
@@ -655,7 +604,7 @@ class base_monster: base_mapentity

if (random() < chance)
{
- this.think_missile ();
+ self.think_missile ();
sub_attackfinished (2 * random());
return TRUE;
}
@@ -664,21 +613,18 @@ class base_monster: base_mapentity
};

//--------------------------------------------------------------
- // infront -- returns 1 if the entity is in front (in sight) of self
+ // infront -- return TRUE if targ is in front (in sight) of self
//--------------------------------------------------------------
- nonvirtual float(entity targ) ai_infront =
+ float(entity targ) ai_infront =
{
local vector vec;
- local float dot;

- makevectors (this.angles);
- vec = normalize (targ.origin - this.origin);
- dot = vec * v_forward;
+ makevectors (self.angles);
+ vec = normalize (targ.origin - self.origin);

- if (dot > 0.3)
- {
+ if ((vec * v_forward) > 0.3)
return TRUE;
- }
+
return FALSE;
};

@@ -691,9 +637,9 @@ class base_monster: base_mapentity
// 2 infront and show hostile
// 3 only triggered by damage
//--------------------------------------------------------------
- nonvirtual float(entity targ) ai_range =
+ float(entity targ) ai_range =
{
- local vector spot1 = this.origin + this.view_ofs;
+ local vector spot1 = self.origin + self.view_ofs;
local vector spot2 = targ.origin + targ.view_ofs;
local float r = vlen (spot1 - spot2);

@@ -707,17 +653,17 @@ class base_monster: base_mapentity
};

//--------------------------------------------------------------
- // visible - returns 1 if the entity is visible to self, even
+ // visible - returns TRUE if targ is visible to self, even
// if not infront ()
//--------------------------------------------------------------
- nonvirtual float (entity targ) ai_visible =
+ float(entity targ) ai_visible =
{
local vector spot1, spot2;

- spot1 = this.origin + this.view_ofs;
+ spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;
// see through other monsters
- traceline (spot1, spot2, TRUE, this);
+ traceline (spot1, spot2, TRUE, self);

if (trace_inopen && trace_inwater)
// sight line crossed contents
@@ -725,23 +671,19 @@ class base_monster: base_mapentity

if (trace_fraction == 1)
return TRUE;
+
return FALSE;
};

//--------------------------------------------------------------
- // SightSound -- was in ai.qc -- implement in subclasses -- CEV
- //--------------------------------------------------------------
- virtual void() ai_sightsound = { };
-
- //--------------------------------------------------------------
// HuntTarget -- was in ai.qc -- CEV
//--------------------------------------------------------------
- nonvirtual void() ai_hunttarget =
+ void() ai_hunttarget =
{
- this.goalentity = this.enemy;
- this.think = this.think_run;
- this.ideal_yaw = vectoyaw (this.enemy.origin - this.origin);
- this.nextthink = time + 0.1;
+ self.goalentity = self.enemy;
+ self.ideal_yaw = vectoyaw (self.enemy.origin - self.origin);
+ self.think = self.think_run;
+ self.nextthink = time + 0.1;
// wait a while before first attack
sub_attackfinished (1);
};
@@ -749,31 +691,32 @@ class base_monster: base_mapentity
//--------------------------------------------------------------
// FoundTarget -- was in ai.qc -- CEV
//--------------------------------------------------------------
- nonvirtual void() ai_foundtarget =
+ void() ai_foundtarget =
{
- if (this.enemy.classtype == CT_PLAYER)
+ if (self.enemy.classtype == CT_PLAYER)
{
// let other monsters see this monster for a while
- sight_entity = this;
+ sight_entity = self;
sight_entity_time = time;
}

// wake up other monsters
- this.show_hostile = time + 1;
+ self.show_hostile = time + 1;

- if !(this.spawnflags & NO_SIGHT_SOUND ||
- this.spawnflags & PASSIVE_ALWAYS ||
- this.spawnflags & PASSIVE_UNTIL_ATTACKED)
+ if !(self.spawnflags & NO_SIGHT_SOUND ||
+ self.spawnflags & PASSIVE_ALWAYS ||
+ self.spawnflags & PASSIVE_UNTIL_ATTACKED)
{
- ai_sightsound ();
+ if (self.sightsound)
+ self.sightsound ();
}

ai_hunttarget ();

// thanks RennyC -- dumptruck_ds
- if (this.sight_trigger == 1)
+ if (self.sight_trigger == 1)
{
- activator = this.enemy;
+ activator = self.enemy;
sub_useandforgettargets ();
}
};
@@ -793,7 +736,7 @@ class base_monster: base_mapentity
// fakeclient) is checked each frame. This means multi player games
// will have slightly slower noticing monsters.
//--------------------------------------------------------------
- nonvirtual float() ai_findtarget =
+ float() ai_findtarget =
{
local entity client;
local float r;
@@ -805,10 +748,10 @@ class base_monster: base_mapentity
// spawnflags & 3 is a big hack, because zombie crucified
// used the first spawn flag prior to the ambush flag, and
// I forgot about it, so the second spawn flag works as well
- if (sight_entity_time >= time - 0.1 && !(this.spawnflags & 3))
+ if (sight_entity_time >= time - 0.1 && !(self.spawnflags & 3))
{
client = sight_entity;
- if (client.enemy == this.enemy)
+ if (client.enemy == self.enemy)
return TRUE;
}
else
@@ -819,8 +762,8 @@ class base_monster: base_mapentity
return FALSE;
}

- if ((this.spawnflags & PASSIVE_UNTIL_ATTACKED) ||
- (this.spawnflags & PASSIVE_ALWAYS))
+ if ((self.spawnflags & PASSIVE_UNTIL_ATTACKED) ||
+ (self.spawnflags & PASSIVE_ALWAYS))
{
return FALSE;
}
@@ -839,7 +782,7 @@ class base_monster: base_mapentity
if (client.enemy.health <= 0)
return FALSE;

- if (client == this.enemy)
+ if (client == self.enemy)
return FALSE;

if (client.flags & FL_NOTARGET)
@@ -870,13 +813,13 @@ class base_monster: base_mapentity
}

// got one
- this.enemy = client;
- if (this.enemy.classtype != CT_PLAYER)
+ self.enemy = client;
+ if (self.enemy.classtype != CT_PLAYER)
{
- this.enemy = this.enemy.enemy;
- if (this.enemy.classtype != CT_PLAYER)
+ self.enemy = self.enemy.enemy;
+ if (self.enemy.classtype != CT_PLAYER)
{
- this.enemy = world;
+ self.enemy = world;
return FALSE;
}
}
@@ -889,49 +832,49 @@ class base_monster: base_mapentity
//--------------------------------------------------------------
// ai_face Stay facing the enemy
//--------------------------------------------------------------
- nonvirtual void() ai_face =
+ void() ai_face =
{
- this.ideal_yaw = vectoyaw (this.enemy.origin - this.origin);
+ self.ideal_yaw = vectoyaw (self.enemy.origin - self.origin);
changeyaw ();
};

//--------------------------------------------------------------
// FacingIdeal
//--------------------------------------------------------------
- nonvirtual float() ai_facing_ideal =
+ float() ai_facing_ideal =
{
local float delta;

- delta = anglemod (this.angles_y - this.ideal_yaw);
+ delta = anglemod (self.angles_y - self.ideal_yaw);
if (delta > 45 && delta < 315)
return FALSE;
return TRUE;
};

//--------------------------------------------------------------
- nonvirtual void(float dist) ai_forward =
+ void(float dist) ai_forward =
{
// dprint ("ai_forward\n");
- walkmove (this.angles_y, dist);
+ walkmove (self.angles_y, dist);
};

//--------------------------------------------------------------
- nonvirtual void(float dist) ai_back =
+ void(float dist) ai_back =
{
// dprint ("ai_back\n");
- walkmove ((this.angles_y + 180), dist);
+ walkmove ((self.angles_y + 180), dist);
};

//--------------------------------------------------------------
// ai_pain -- stagger back a bit
//--------------------------------------------------------------
- nonvirtual void(float dist) ai_pain =
+ void(float dist) ai_pain =
{
ai_back (dist);
/*
local float away;

- away = anglemod (vectoyaw (this.origin - this.enemy.origin)
+ away = anglemod (vectoyaw (self.origin - self.enemy.origin)
+ 180 * (random() - 0.5));

walkmove (away, dist);
@@ -941,20 +884,20 @@ class base_monster: base_mapentity
//--------------------------------------------------------------
// ai_painforward -- stagger back a bit
//--------------------------------------------------------------
- nonvirtual void(float dist) ai_painforward =
+ void(float dist) ai_painforward =
{
// dprint ("ai_painforward\n");
- walkmove (this.ideal_yaw, dist);
+ walkmove (self.ideal_yaw, dist);
};

//--------------------------------------------------------------
- // ai_walk -- The monster is walking it's beat
+ // ai_walk -- The monster is walking its beat
//--------------------------------------------------------------
- nonvirtual void(float dist) ai_walk =
+ void(float dist) ai_walk =
{
movedist = dist;

- if (this.classname == "monster_dragon")
+ if (self.classname == "monster_dragon")
{
movetogoal (dist);
return;
@@ -971,23 +914,24 @@ class base_monster: base_mapentity
// ai_stand -- The monster is staying in one place for a while,
// with slight angle turns
//--------------------------------------------------------------
- nonvirtual void() ai_stand =
+ void() ai_stand =
{
if (ai_findtarget())
return;

- if (time > this.pausetime)
+ if (time > self.pausetime)
{
- this.think_walk ();
+ self.think_walk ();
return;
}
- // change angle slightly -- TODO CEV ???
+ // change angle slightly -- TODO CEV this comment was
+ // in PD3 source but had no associated code
};

//--------------------------------------------------------------
// ai_turn -- don't move, but turn towards ideal_yaw
//--------------------------------------------------------------
- nonvirtual void() ai_turn =
+ void() ai_turn =
{
if (ai_findtarget())
return;
@@ -999,15 +943,15 @@ class base_monster: base_mapentity
// ai_run_melee
// Turn and close until within an angle to launch a melee attack
//--------------------------------------------------------------
- nonvirtual void() ai_run_melee =
+ void() ai_run_melee =
{
- this.ideal_yaw = enemy_yaw;
+ self.ideal_yaw = enemy_yaw;
changeyaw ();

if (ai_facing_ideal())
{
- this.think_melee ();
- this.attack_state = AS_STRAIGHT;
+ self.think_melee ();
+ self.attack_state = AS_STRAIGHT;
}
};

@@ -1015,24 +959,24 @@ class base_monster: base_mapentity
// ai_run_missile
// Turn in place until within an angle to launch a missile attack
//--------------------------------------------------------------
- nonvirtual void() ai_run_missile =
+ void() ai_run_missile =
{
- this.ideal_yaw = enemy_yaw;
+ self.ideal_yaw = enemy_yaw;
// dprint ("ai_run_missile GO\n");
changeyaw ();
- if (this.ai_facing_ideal())
+ if (ai_facing_ideal())
{
- if (this.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & I_AM_TURRET)
{
- this.think_turret ();
+ self.think_turret ();
// dprint ("th_turret...\n");
}
else
{
- this.think_missile ();
+ self.think_missile ();
// dprint ("th_missile\n");
}
- this.attack_state = AS_STRAIGHT;
+ self.attack_state = AS_STRAIGHT;
}
};

@@ -1040,90 +984,90 @@ class base_monster: base_mapentity
// ai_run_slide
// Strafe sideways, but stay at approximately the same range
//--------------------------------------------------------------
- nonvirtual void() ai_run_slide =
+ void() ai_run_slide =
{
local float ofs;

- this.ideal_yaw = enemy_yaw;
+ self.ideal_yaw = enemy_yaw;
changeyaw ();
- if (this.lefty)
+ if (self.lefty)
ofs = 90;
else
ofs = -90;

- if (walkmove(this.ideal_yaw + ofs, movedist))
+ if (walkmove(self.ideal_yaw + ofs, movedist))
return;

- this.lefty = 1 - this.lefty;
+ self.lefty = 1 - self.lefty;

- walkmove (this.ideal_yaw - ofs, movedist);
+ walkmove (self.ideal_yaw - ofs, movedist);
};

//--------------------------------------------------------------
// ai_run -- The monster has an enemy it is trying to kill
//--------------------------------------------------------------
- nonvirtual void(float dist) ai_run =
+ void(float dist) ai_run =
{
// dprint ("ai_run\n");
movedist = dist;
// see if the enemy is dead
- if ((this.enemy.health <= 0) ||
- (this.spawnflags & PASSIVE_ALWAYS))
+ if ((self.enemy.health <= 0) ||
+ (self.spawnflags & PASSIVE_ALWAYS))
{
- this.enemy = world;
+ self.enemy = world;
// FIXME: look all around for other targets
- if (this.oldenemy.health > 0)
+ if (self.oldenemy.health > 0)
{
- this.enemy = this.oldenemy;
+ self.enemy = self.oldenemy;
ai_hunttarget ();
}
else
{
- if (this.spawnflags & I_AM_TURRET)
- this.think_stand ();
- else if (this.movetarget)
- this.think_walk ();
+ if (self.spawnflags & I_AM_TURRET)
+ self.think_stand ();
+ else if (self.movetarget)
+ self.think_walk ();
else
- this.think_stand ();
+ self.think_stand ();
return;
}
}

// wake up other monsters
- this.show_hostile = time + 1;
+ self.show_hostile = time + 1;

// check knowledge of enemy
- enemy_vis = ai_visible (this.enemy);
+ enemy_vis = ai_visible (self.enemy);
if (enemy_vis)
- this.search_time = time + 5;
+ self.search_time = time + 5;

// look for other coop players
- if (coop && this.search_time < time)
+ if (coop && self.search_time < time)
{
if (ai_findtarget())
return;
}

- enemy_infront = ai_infront (this.enemy);
- enemy_range = ai_range (this.enemy);
- enemy_yaw = vectoyaw (this.enemy.origin - this.origin);
+ enemy_infront = ai_infront (self.enemy);
+ enemy_range = ai_range (self.enemy);
+ enemy_yaw = vectoyaw (self.enemy.origin - self.origin);

- if (this.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & I_AM_TURRET)
{
ai_face ();
}

- // if ((this.attack_state == AS_MISSILE) ||
- // !(this.spawnflags & I_AM_TURRET))
- if (this.attack_state == AS_MISSILE)
+ // if ((self.attack_state == AS_MISSILE) ||
+ // !(self.spawnflags & I_AM_TURRET))
+ if (self.attack_state == AS_MISSILE)
{
// dprint ("ai_run_missile... from ai_run\n");
ai_run_missile ();
return;
}
- // if ((this.attack_state == AS_MELEE) ||
- // !(this.spawnflags & I_AM_TURRET))
- if (this.attack_state == AS_MELEE)
+ // if ((self.attack_state == AS_MELEE) ||
+ // !(self.spawnflags & I_AM_TURRET))
+ if (self.attack_state == AS_MELEE)
{
// dprint ("ai_run_melee\n");
ai_run_melee ();
@@ -1134,48 +1078,48 @@ class base_monster: base_mapentity
// beginning an attack
return;

- // if ((this.attack_state == AS_SLIDING) ||
- // !(this.spawnflags & I_AM_TURRET))
- if (this.attack_state == AS_SLIDING)
+ // if ((self.attack_state == AS_SLIDING) ||
+ // !(self.spawnflags & I_AM_TURRET))
+ if (self.attack_state == AS_SLIDING)
{
ai_run_slide ();
return;
}
// part of monster face from TheSolipsist
// urged to change positions
- if (time < this.t_length)
+ if (time < self.t_length)
{
// if orientation is forced
changeyaw ();

- if (walkmove(this.ideal_yaw, dist))
+ if (walkmove(self.ideal_yaw, dist))
return;

// dodge left
- this.ideal_yaw += 30;
+ self.ideal_yaw += 30;
changeyaw ();

- if (walkmove(this.ideal_yaw, dist))
+ if (walkmove(self.ideal_yaw, dist))
return;

// dodge right
- this.ideal_yaw -= 60;
+ self.ideal_yaw -= 60;
changeyaw ();
changeyaw ();

- if (walkmove(this.ideal_yaw, dist))
+ if (walkmove(self.ideal_yaw, dist))
return;

// give up
- this.ideal_yaw += 30;
+ self.ideal_yaw += 30;
changeyaw();
// lose patience
- this.touch_time = this.touch_time - 0.1;
+ self.touch_time = self.touch_time - 0.1;

return;
}

- if !(this.spawnflags & I_AM_TURRET)
+ if !(self.spawnflags & I_AM_TURRET)
// keeps monster from moving to player - dumptruck_ds
// head straight in -- done in C code...
movetogoal (dist);
@@ -1185,26 +1129,26 @@ class base_monster: base_mapentity
// ai_charge -- The monster is in a melee attack, so get as close
// as possible to .enemy
//--------------------------------------------------------------
- nonvirtual void(float d) ai_charge =
+ void(float dist) ai_charge =
{
ai_face ();
// done in C code...
- movetogoal (d);
+ movetogoal (dist);
};

//--------------------------------------------------------------
- nonvirtual void() ai_charge_side =
+ void() ai_charge_side =
{
local vector dtemp;
local float heading;

// aim to the left of the enemy for a flyby
- this.ideal_yaw = vectoyaw (this.enemy.origin - this.origin);
+ self.ideal_yaw = vectoyaw (self.enemy.origin - self.origin);
changeyaw ();

- makevectors (this.angles);
- dtemp = this.enemy.origin - 30 * v_right;
- heading = vectoyaw (dtemp - this.origin);
+ makevectors (self.angles);
+ dtemp = self.enemy.origin - 30 * v_right;
+ heading = vectoyaw (dtemp - self.origin);

walkmove (heading, 20);
};
@@ -1212,46 +1156,46 @@ class base_monster: base_mapentity
//--------------------------------------------------------------
// ai_melee
//--------------------------------------------------------------
- nonvirtual void() ai_melee =
+ void() ai_melee =
{
local vector delta;
local float ldmg;

- if (!this.enemy)
+ if (!self.enemy)
// removed before stroke
return;

- delta = this.enemy.origin - this.origin;
+ delta = self.enemy.origin - self.origin;

if (vlen(delta) > 60)
return;

ldmg = (random() + random() + random()) * 3;
- this.t_damage2 (this.enemy, this, this, ldmg);
+ t_damage2 (self.enemy, self, self, ldmg);
};

//--------------------------------------------------------------
- nonvirtual void() ai_melee_side =
+ void() ai_melee_side =
{
local vector delta;
local float ldmg;

- if (!this.enemy)
+ if (!self.enemy)
// removed before stroke
return;

ai_charge_side ();

- delta = this.enemy.origin - this.origin;
+ delta = self.enemy.origin - self.origin;

if (vlen(delta) > 60)
return;

- if (!this.can_damage(this, this.enemy))
+ if (!can_damage(self, self.enemy))
return;

ldmg = (random() + random() + random()) * 3;
- this.t_damage2 (this.enemy, this, this, ldmg);
+ t_damage2 (self.enemy, self, self, ldmg);
};

//==============================================================
@@ -1263,26 +1207,26 @@ class base_monster: base_mapentity
// in nightmare mode, all attack_finished times become 0
// some monsters refire twice automatically
//--------------------------------------------------------------
- nonvirtual void(float normal) sub_attackfinished =
+ void(float normal) sub_attackfinished =
{
// refire count for nightmare
- this.cnt = 0;
+ self.cnt = 0;
if (skill != 3)
- this.attack_finished = time + normal;
+ self.attack_finished = time + normal;
};

//--------------------------------------------------------------
- nonvirtual void(void() nextfunc) sub_checkrefire =
+ void(void() nextfunc) sub_checkrefire =
{
if (skill != 3)
return;
- if (this.cnt == 1)
+ if (self.cnt == 1)
return;
- if (!ai_visible(this.enemy))
+ if (!ai_visible(self.enemy))
return;

- this.cnt = 1;
- this.think = nextfunc;
+ self.cnt = 1;
+ self.think = nextfunc;
};

//--------------------------------------------------------------
@@ -1292,28 +1236,28 @@ class base_monster: base_mapentity
// matches the target (or target2/3/4 or pain_target) field of
// any other entity, otherwise return FALSE. -- iw
//--------------------------------------------------------------
- nonvirtual float(.string fld) sub_fieldistargeted =
+ float(.string fld) sub_fieldistargeted =
{
- if (this.fld == "")
+ if (self.fld == "")
return FALSE;

// the following function calls are staggered to avoid
// the silly "return value conflict" problem with
// traditional compilers -- iw

- if (find (world, ::target, this.fld) != world)
+ if (find(world, target, self.fld) != world)
return TRUE;

- if (find (world, ::target2, this.fld) != world)
+ if (find(world, target2, self.fld) != world)
return TRUE;

- if (find (world, ::target3, this.fld) != world)
+ if (find(world, target3, self.fld) != world)
return TRUE;

- if (find (world, ::target4, this.fld) != world)
+ if (find(world, target4, self.fld) != world)
return TRUE;

- if (find (world, ::pain_target, this.fld) != world)
+ if (find(world, pain_target, self.fld) != world)
return TRUE;

return FALSE;
@@ -1327,21 +1271,21 @@ class base_monster: base_mapentity
// or pain_target) field of any other entity, otherwise return
// FALSE. -- iw
//--------------------------------------------------------------
- nonvirtual float() sub_istargeted =
+ float() sub_istargeted =
{
// the following function calls are staggered to avoid
// the silly "return value conflict" problem with
// traditional compilers -- iw
- if (sub_fieldistargeted(::targetname))
+ if (sub_fieldistargeted(targetname))
return TRUE;

- if (sub_fieldistargeted(::targetname2))
+ if (sub_fieldistargeted(targetname2))
return TRUE;

- if (sub_fieldistargeted(::targetname3))
+ if (sub_fieldistargeted(targetname3))
return TRUE;

- if (sub_fieldistargeted(::targetname4))
+ if (sub_fieldistargeted(targetname4))
return TRUE;

return FALSE;
@@ -1353,25 +1297,21 @@ class base_monster: base_mapentity
// When a mosnter dies, it fires all of its targets with the
// current enemy as activator.
//--------------------------------------------------------------
- nonvirtual void() sub_death_use =
+ void() sub_death_use =
{
// fall to ground
- if (this.flags & FL_FLY)
- this.flags = this.flags - FL_FLY;
- if (this.flags & FL_SWIM)
- this.flags = this.flags - FL_SWIM;
+ if (self.flags & FL_FLY)
+ self.flags = self.flags - FL_FLY;
+ if (self.flags & FL_SWIM)
+ self.flags = self.flags - FL_SWIM;

- if (!this.target)
+ if (!self.target)
return;

- if (this.infight_activator)
- {
- activator = this.infight_activator;
- }
+ if (self.infight_activator)
+ activator = self.infight_activator;
else
- {
- activator = this.enemy;
- }
+ activator = self.enemy;

sub_usetargets ();
};
@@ -1382,22 +1322,22 @@ class base_monster: base_mapentity
// When a monster reaches pain_threshold, it fires all of its
// pain_targets with the current enemy as activator.
//--------------------------------------------------------------
- nonvirtual void() sub_pain_use =
+ void() sub_pain_use =
{
- if (!this.pain_target)
+ if (!self.pain_target)
return;

- activator = this.enemy;
+ activator = self.enemy;
// SUB_UsePain ();
- if (this.pain_target != "")
+ if (self.pain_target != "")
{
- sub_usetarget (this.pain_target, ::targetname);
- sub_usetarget (this.pain_target, ::targetname2);
- sub_usetarget (this.pain_target, ::targetname3);
- sub_usetarget (this.pain_target, ::targetname4);
+ sub_usetarget (self.pain_target, targetname);
+ sub_usetarget (self.pain_target, targetname2);
+ sub_usetarget (self.pain_target, targetname3);
+ sub_usetarget (self.pain_target, targetname4);
}
// dumptruck_ds via Discord - thanks Spike, Snaut and QueenJazz
- this.pain_target = "";
+ self.pain_target = "";
};

//==============================================================
@@ -1405,41 +1345,33 @@ class base_monster: base_mapentity
//==============================================================

//--------------------------------------------------------------
- // think is reassigned in subclasses so isn't defined here -- CEV
- //--------------------------------------------------------------
- /*
- virtual void() think = { };
- */
-
- //--------------------------------------------------------------
- virtual void() think_start = { };
-
- //--------------------------------------------------------------
- nonvirtual void() think_teleport_go =
+ void() base_monster_think_teleport_go =
{
- this.solid = this.tele_solid;
- this.movetype = this.tele_movetype;
- setmodel (this, this.tele_model);
- setsize (this, this.tele_mins, this.tele_maxs);
+ self.solid = self.tele_solid;
+ self.movetype = self.tele_movetype;
+ setmodel (self, self.tele_model);
+ setsize (self, self.tele_mins, self.tele_maxs);

- // fix for cumulative delays for counters etc. -- dumptruck_ds
- this.delay = 0;
+ // ensure touch and use are set; think1 might override -- CEV
+ self.touch = base_monster_touch;
+ self.use = base_monster_use_angry;

- this.use_flag = MONSTER_USE_MAKEANGRY;
+ // fix for cumulative delays for counters etc. -- dumptruck_ds
+ self.delay = 0;

- // was a call to think1 -- CEV
- this.think_start ();
+ self.think1 ();

// override the random delay some go functions apply
- this.nextthink = time + 0.1;
+ self.nextthink = time + 0.1;
+ // TODO CEV what is this bracket doing here?
{
- if !(this.spawnflags & SPAWN_SILENTLY)
+ if !(self.spawnflags & SPAWN_SILENTLY)
{
// dumptruck_ds: if wait value is > 0
// spawn silently or use a spawnflag
- if (this.wait == 0)
- spawn_tfog (this.origin);
- spawn_tdeath (this.origin, this);
+ if (self.wait == 0)
+ spawn_tfog (self.origin);
+ spawn_tdeath (self.origin, self);
}
}
};
@@ -1447,12 +1379,8 @@ class base_monster: base_mapentity
//--------------------------------------------------------------
// monster_touch -- was in monsters.qc -- CEV
//--------------------------------------------------------------
- virtual void() touch =
+ void() base_monster_touch =
{
- // has touch been disabled? -- CEV
- if (this.interaction_flags & DISABLE_TOUCH)
- return;
-
// 1998-09-16 Sliding/not-jumping on monsters/boxes/players
// fix by Maddes/Kryten start

@@ -1470,7 +1398,7 @@ class base_monster: base_mapentity
return;

if ((!(other.flags & FL_ONGROUND)) &&
- ((other.absmin_z >= this.absmax_z - 2)))
+ ((other.absmin_z >= self.absmax_z - 2)))
{
other.flags = other.flags + FL_ONGROUND;
}
@@ -1482,47 +1410,47 @@ class base_monster: base_mapentity
};

//--------------------------------------------------------------
- // monster_use -- Using a monster makes it angry at the activator
+ // monster_teleport_delay
//--------------------------------------------------------------
- virtual void(entity caller) do_use =
+ void() base_monster_use_teledelay =
{
- if (this.use_flag == MONSTER_USE_MAKEANGRY)
+ // new from Qmaster func coding help thread
+ self.think = base_monster_think_teleport_go;
+ if (self.delay == -1)
{
- if (this.enemy)
- return;
- if (this.health <= 0)
- return;
- if (activator.items & IT_INVISIBILITY)
- return;
- if (activator.flags & FL_NOTARGET)
- return;
- if (activator.movetype == MOVETYPE_NOCLIP)
- // Copper -- dumptruck_ds
- return FALSE;
+ // if delay is set to -1 random delay
+ // from 0.1 to 1 second - dumptruck_ds
+ self.nextthink = time + 0.1 + random();
+ return;
+ }
+ self.nextthink = time + 0.1 + self.delay;
+ };

- if (activator.classtype != CT_PLAYER)
- return;
+ //--------------------------------------------------------------
+ // monster_use -- Using a monster makes it angry at the activator
+ //--------------------------------------------------------------
+ void() base_monster_use_angry =
+ {
+ if (self.enemy)
+ return;
+ if (self.health <= 0)
+ return;
+ if (activator.items & IT_INVISIBILITY)
+ return;
+ if (activator.flags & FL_NOTARGET)
+ return;
+ if (activator.movetype == MOVETYPE_NOCLIP)
+ // Copper -- dumptruck_ds
+ return FALSE;

- // delay reaction so if the monster is teleported,
- // its sound is still heard
- this.enemy = activator;
- this.think = ai_foundtarget;
- this.nextthink = time + 0.1;
- }
- else if (this.use_flag == MONSTER_USE_TELEDELAY)
- {
- // monster_teleport_delay
- // new from Qmaster func coding help thread
- this.think = this.think_teleport_go;
- if (this.delay == -1)
- {
- // if delay is set to -1 random delay
- // from 0.1 to 1 second - dumptruck_ds
- this.nextthink = time + 0.1 + random();
- return;
- }
- this.nextthink = time + 0.1 + this.delay;
- }
+ if (activator.classtype != CT_PLAYER)
+ return;
+
+ // delay reaction so if the monster is teleported,
+ // its sound is still heard
+ self.enemy = activator;
+ self.think = ai_foundtarget;
+ self.nextthink = time + 0.1;
};

//==============================================================
@@ -1538,68 +1466,71 @@ class base_monster: base_mapentity
// other entity. (This map bug would otherwise make it impossible
// for the player to get 100% kills.) -- iw
//--------------------------------------------------------------
- nonvirtual void() init_teleport_check =
+ void() base_monster_init_teleport_check =
{
if (!sub_istargeted())
{
- dprint (sprintf("base_monster::init_teleport_check: "
+ dprint (sprintf("base_monster_init_teleport_check: "
"WARNING: removed untargeted trigger-spawned "
- "%s at %v\n", this.classname, this.origin));
+ "%s at %v\n", self.classname, self.origin));

- remove (this);
+ remove (self);
return;
}

// the targetname appears to be OK, so let's finish
// setting up the trigger-spawned monster -- iw
// qmaster
- // this.use = monster_teleport_delay;
- this.use_flag = MONSTER_USE_TELEDELAY;
+ self.touch = sub_null;
+ self.use = base_monster_use_teledelay;
monster_update_total (1);
};

//--------------------------------------------------------------
- nonvirtual float () init_teleport =
+ float(entity e, void() start_fn) base_monster_init_teleport =
{
- if(!(this.spawnflags & 8))
+ if(!(e.spawnflags & 8))
return FALSE;

// PREACH: This monster is to be teleported in, so hide it
- this.tele_model= this.model;
- this.tele_mins = this.mins;
- this.tele_maxs = this.maxs;
- this.tele_solid = this.solid;
- this.tele_movetype = this.movetype;
-
- this.model = "";
- this.modelindex = 0;
- this.solid = SOLID_NOT;
- this.movetype = MOVETYPE_NONE;
+ e.tele_model = e.model;
+ e.tele_mins = e.mins;
+ e.tele_maxs = e.maxs;
+ e.tele_solid = e.solid;
+ e.tele_movetype = e.movetype;
+
+ e.model = "";
+ e.modelindex = 0;
+ e.solid = SOLID_NOT;
+ e.movetype = MOVETYPE_NONE;
+ e.think1 = start_fn;

// wait for other entities to finish spawning, then check that
- // something targets this -- iw
- this.think = init_teleport_check;
- this.nextthink = time + 0.1;
+ // something targets self -- iw
+ e.think = base_monster_init_teleport_check;
+ e.nextthink = time + 0.1;

return TRUE;
};

//--------------------------------------------------------------
- virtual void() init_spawned =
+ void(entity e) base_monster_init =
{
- this.use_flag = MONSTER_USE_MAKEANGRY;
+ e.classgroup |= CG_MONSTER;
+ e.touch = base_monster_touch;
+ e.use = base_monster_use_angry;
};

//--------------------------------------------------------------
- void() base_monster =
+ strip void() base_monster =
{
- this.classgroup |= CG_MONSTER;
+ base_monster_init (self);
};
-};
+// };

-//------------------------------------------------------------------------------
-class base_flymonster: base_monster
-{
+//----------------------------------------------------------------------
+// class base_flymonster: base_monster
+// {
//==============================================================
// Interaction
//==============================================================
@@ -1607,50 +1538,52 @@ class base_flymonster: base_monster
//--------------------------------------------------------------
// flymonster_start_go
//--------------------------------------------------------------
- virtual void() think_start =
+ void() base_flymonster_think_start =
{
- this.takedamage = DAMAGE_AIM;
+ self.takedamage = DAMAGE_AIM;

- this.ideal_yaw = this.angles * '0 1 0';
- if (!this.yaw_speed)
- this.yaw_speed = 10;
- this.view_ofs = '0 0 25';
+ self.ideal_yaw = self.angles * '0 1 0';
+ if (!self.yaw_speed)
+ self.yaw_speed = 10;
+ self.view_ofs = '0 0 25';
+ self.use = base_monster_use_angry;

- this.flags = this.flags | FL_FLY;
- this.flags = this.flags | FL_MONSTER;
+ self.flags |= FL_FLY;
+ self.flags |= FL_MONSTER;

- if (!walkmove(0,0))
- dprint (sprintf("base_flymonster::think_start: "
- "monster in awll at %v\n", this.origin));
+ if (!walkmove(0, 0))
+ dprint (sprintf("base_flymonster_think_start: "
+ "monster in wall at %v\n", self.origin));

- if (this.target != "")
+ if (self.target != "")
{
- this.goalentity = this.movetarget = find (world,
- ::targetname, this.target);
- if (!this.movetarget)
- dprint (sprintf("base_flymonster::monster_think"
- "_start: monster can't find target at "
- "%v\n", this.origin));
+ self.goalentity = self.movetarget = find (world,
+ targetname, self.target);

// this used to be an objerror
- if (this.movetarget.classtype == CT_PATH_CORNER)
+ if (!self.movetarget)
+ dprint (sprintf("base_flymonster_think_start: "
+ "monster at %v can't find target\n",
+ self.origin));
+
+ if (self.movetarget.classtype == CT_PATH_CORNER)
{
- this.think_walk ();
+ self.think_walk ();
}
else
{
- this.pausetime = 99999999;
- this.think_stand ();
+ self.pausetime = 99999999;
+ self.think_stand ();
}
}
else
{
- this.pausetime = 99999999;
- this.think_stand ();
+ self.pausetime = 99999999;
+ self.think_stand ();
}

// 1998-08-14 Monsters sometimes don't move fix by Lord Sméagol
- this.nextthink = time + 0.1 + random() * 0.5;
+ self.nextthink = time + 0.1 + random() * 0.5;

// dumptruck_ds -- using spawn_angry set to 1 in order to spawn
// in "angry" monsters
@@ -1662,12 +1595,12 @@ class base_flymonster: base_monster
// dumptruck_ds -- this is Shamblernaut's method
local entity pl;

- pl = findfloat (world, ::classtype, CT_PLAYER);
+ pl = findfloat (world, classtype, CT_PLAYER);

- if (this.spawn_angry == 1)
+ if (self.spawn_angry == 1)
{
activator = pl;
- this.use ();
+ base_monster_use_angry ();
}
};

@@ -1678,38 +1611,45 @@ class base_flymonster: base_monster
//--------------------------------------------------------------
// flymonster_start
//--------------------------------------------------------------
- virtual void() init_spawned =
+ void(entity e) base_flymonster_init =
{
if (cvar("nomonsters"))
{
- remove (this);
+ remove (e);
return;
}

- super::init_spawned ();
+ base_monster_init (e);
+ e.classgroup |= CG_MONSTER_FLY;

// Preach's tutorial
- if (init_teleport())
+ if (base_monster_init_teleport(e, base_flymonster_think_start))
return;

// 1998-08-14 Monsters sometimes don't move fix by Lord Sméagol
- this.flags = this.flags | FL_FLY;
+ e.flags |= FL_FLY;

total_monsters = total_monsters + 1;
- this.think = this.think_start;
+ e.think = base_flymonster_think_start;
// spread think times so they don't all happen at same time
// 1998-08-14 Monsters sometimes don't move fix by
// Lord Sméagol start
- // this.nextthink = this.nextthink + random() * 0.5;
- this.nextthink = time + 0.1 + random() * 0.5;
+ // e.nextthink = e.nextthink + random() * 0.5;
+ e.nextthink = time + 0.1 + random() * 0.5;
// 1998-08-14 Monsters sometimes don't move fix by
// Lord Sméagol end
};
-};

-//------------------------------------------------------------------------------
-class base_swimmonster: base_monster
-{
+ //--------------------------------------------------------------
+ strip void() base_flymonster =
+ {
+ base_flymonster_init (self);
+ };
+// };
+
+//----------------------------------------------------------------------
+// class base_swimmonster: base_monster
+// {
//==============================================================
// Interaction
//==============================================================
@@ -1717,56 +1657,57 @@ class base_swimmonster: base_monster
//--------------------------------------------------------------
// swimmonster_start_go
//--------------------------------------------------------------
- virtual void() think_start =
+ void() base_swimmonster_think_start =
{
if (deathmatch)
{
- remove (this);
+ remove (self);
return;
}

- this.takedamage = DAMAGE_AIM;
+ self.takedamage = DAMAGE_AIM;

- this.ideal_yaw = this.angles * '0 1 0';
- if (!this.yaw_speed)
- this.yaw_speed = 10;
- this.view_ofs = '0 0 10';
+ self.ideal_yaw = self.angles * '0 1 0';
+ if (!self.yaw_speed)
+ self.yaw_speed = 10;
+ self.view_ofs = '0 0 10';
+ self.use = base_monster_use_angry;

- this.flags = this.flags | FL_SWIM;
- this.flags = this.flags | FL_MONSTER;
+ self.flags |= FL_SWIM;
+ self.flags |= FL_MONSTER;

- if (this.target != "")
+ if (self.target != "")
{
- this.goalentity = this.movetarget = find (world,
- ::targetname, this.target);
- if (!this.movetarget)
- {
- dprint ("Monster can't find target at ");
- dprint (vtos(this.origin));
- dprint ("\n");
- }
+ self.goalentity = self.movetarget = find (world,
+ targetname, self.target);
+
// this used to be an objerror
- this.ideal_yaw = vectoyaw (
- this.goalentity.origin - this.origin);
- this.think_walk ();
+ if (!self.movetarget)
+ dprint (sprintf("base_swimmonster_think_start: "
+ "monster at %v can't find target\n",
+ self.origin));
+
+ self.ideal_yaw = vectoyaw (
+ self.goalentity.origin - self.origin);
+ self.think_walk ();
}
else
{
- this.pausetime = 99999999;
- this.think_stand ();
+ self.pausetime = 99999999;
+ self.think_stand ();
}

// spread think times so they don't all happen at same time
// 1998-08-14 Monsters sometimes do not move fix
// by Lord Sméagol start
- // this.nextthink = this.nextthink + random()*0.5;
- this.nextthink = time + 0.1 + random() * 0.5;
+ // self.nextthink = self.nextthink + random()*0.5;
+ self.nextthink = time + 0.1 + random() * 0.5;
// 1998-08-14 Monsters sometimes do not move fix
// by Lord Sméagol end

// dumptruck_ds -- using spawn_angry set to 1 in order to
// spawn in "angry" monsters
- // if ((this.spawnflags & 8) && this.spawn_angry == 1)
+ // if ((self.spawnflags & 8) && self.spawn_angry == 1)
// {
// monster_use ();
// }
@@ -1774,12 +1715,12 @@ class base_swimmonster: base_monster
// dumptruck_ds -- this is Shamblernaut's method
local entity pl;

- pl = findfloat (world, ::classtype, CT_PLAYER);
+ pl = findfloat (world, classtype, CT_PLAYER);

- if (this.spawn_angry == 1)
+ if (self.spawn_angry == 1)
{
activator = pl;
- this.use ();
+ base_monster_use_angry ();
}
};

@@ -1790,38 +1731,45 @@ class base_swimmonster: base_monster
//--------------------------------------------------------------
// swimmonster_start
//--------------------------------------------------------------
- virtual void() init_spawned =
+ void(entity e) base_swimmonster_init =
{
if (cvar("nomonsters"))
{
- remove (this);
+ remove (e);
return;
}

- // 1998-08-14 Monsters sometimes don't move fix by Lord Sméagol
- this.flags = this.flags | FL_SWIM;
+ base_monster_init (e);
+ e.classgroup |= CG_MONSTER_SWIM;

- super::init_spawned ();
+ // 1998-08-14 Monsters sometimes don't move fix by Lord Sméagol
+ e.flags = e.flags | FL_SWIM;

// Preach's tutorial
- if (init_teleport())
+ if (base_monster_init_teleport(e, base_swimmonster_think_start))
return;

total_monsters = total_monsters + 1;
- this.think = this.think_start;
+ e.think = base_swimmonster_think_start;
// spread think times so they don't all happen at same time
// 1998-08-14 Monsters sometimes do not move fix
// by Lord Sméagol start
- // this.nextthink = this.nextthink + random() * 0.5;
- this.nextthink = time + 0.1 + random() * 0.5;
+ // e.nextthink = e.nextthink + random() * 0.5;
+ e.nextthink = time + 0.1 + random() * 0.5;
// 1998-08-14 Monsters sometimes do not move fix
// by Lord Sméagol end
};
-};

-//------------------------------------------------------------------------------
-class base_walkmonster: base_monster
-{
+ //--------------------------------------------------------------
+ strip void() base_swimmonster =
+ {
+ base_swimmonster_init (self);
+ };
+// };
+
+//----------------------------------------------------------------------
+// class base_walkmonster: base_monster
+// {
//==============================================================
// Interaction
//==============================================================
@@ -1829,77 +1777,74 @@ class base_walkmonster: base_monster
//--------------------------------------------------------------
// walkmonster_start_go
//--------------------------------------------------------------
- virtual void() think_start =
+ void() base_walkmonster_think_start =
{
// raise off floor a bit
- this.origin_z = this.origin_z + 1;
+ self.origin_z = self.origin_z + 1;

// Preach's "check" here
-
// if(time <= 0.5)
- if(!(this.spawnflags & 8))
+ if(!(self.spawnflags & 8))
{
- droptofloorwrapper (this);
- if !(this.spawnflags & I_AM_TURRET)
+ droptofloor ();
+ if !(self.spawnflags & I_AM_TURRET)
{
// fixes an incorrect dprint
// -- dumptruck_ds
- if (!walkmove(0,0))
- {
+ if (!walkmove(0, 0))
dprint (sprintf("\n\n%s "
"in wall at: %v\n\n",
- this.classname, this.origin));
- }
+ self.classname, self.origin));
}
}

- this.takedamage = DAMAGE_AIM;
- this.ideal_yaw = this.angles * '0 1 0';
- if (!this.yaw_speed)
- this.yaw_speed = 20;
- this.view_ofs = '0 0 25';
- this.flags |= FL_MONSTER;
+ self.takedamage = DAMAGE_AIM;
+ self.ideal_yaw = self.angles * '0 1 0';
+ if (!self.yaw_speed)
+ self.yaw_speed = 20;
+ self.view_ofs = '0 0 25';
+ self.use = base_monster_use_angry;
+ self.flags |= FL_MONSTER;

- if (this.target != "")
+ if (self.target != "")
{
- this.goalentity = this.movetarget = find (
- world, ::targetname, this.target);
- this.ideal_yaw = vectoyaw (
- this.goalentity.origin - this.origin);
- if (!this.movetarget)
- {
- dprint (sprintf("base_walkmonster::"
- "think: Monster can't find "
- "target at %v\n", this.origin));
- }
+ self.goalentity = self.movetarget = find (
+ world, targetname, self.target);
+ self.ideal_yaw = vectoyaw (
+ self.goalentity.origin - self.origin);

// this used to be an objerror
- if (this.movetarget.classtype == CT_PATH_CORNER)
+ if (!self.movetarget)
+ dprint (sprintf("base_walkmonster_think: "
+ "monster at %v can't find target\n",
+ self.origin));
+
+ if (self.movetarget.classtype == CT_PATH_CORNER)
{
- this.think_walk ();
+ self.think_walk ();
}
else
{
- this.pausetime = 99999999;
- this.think_stand ();
+ self.pausetime = 99999999;
+ self.think_stand ();
}
}
else
{
- this.pausetime = 99999999;
- this.think_stand ();
+ self.pausetime = 99999999;
+ self.think_stand ();
}

// spread think times so they don't all happen at once
// 1998-08-14 Monsters sometimes do not move fix
// by Lord Sméagol start
- // this.nextthink = this.nextthink + random() * 0.5;
- this.nextthink = time + 0.1 + random() * 0.5;
+ // self.nextthink = self.nextthink + random() * 0.5;
+ self.nextthink = time + 0.1 + random() * 0.5;
// 1998-08-14 Monsters sometimes do not move fixx
// by Lord Sméagol end
// dumptruck_ds -- using spawn_angry set to 1 in
// order to spawn in "angry" monsters
- // if ((this.spawnflags & 8) && this.spawn_angry == 1)
+ // if ((self.spawnflags & 8) && self.spawn_angry == 1)
// {
// monster_use ();
// }
@@ -1907,12 +1852,12 @@ class base_walkmonster: base_monster
// dumptruck_ds -- this is Shamblernaut's method
local entity pl;

- pl = findfloat (world, ::classtype, CT_PLAYER);
+ pl = findfloat (world, classtype, CT_PLAYER);

- if (this.spawn_angry == 1)
+ if (self.spawn_angry == 1)
{
activator = pl;
- this.use ();
+ base_monster_use_angry ();
}
};

@@ -1923,34 +1868,37 @@ class base_walkmonster: base_monster
//--------------------------------------------------------------
// walkmonster_start
//--------------------------------------------------------------
- virtual void() init_spawned =
+ void(entity e) base_walkmonster_init =
{
// Preach's tutorial
if (cvar("nomonsters"))
{
- remove (this);
+ remove (e);
return;
}

- super::init_spawned ();
+ base_monster_init (e);

// Preach's tutorial
- if (init_teleport())
+ if (base_monster_init_teleport(e, base_walkmonster_think_start))
return;

- // delay drop to floor to make sure all doors have been
- // spawned spread think times so they don't all happen
- // at same time
+ // delay drop to floor to make sure all doors have been spawned
+ // spread think times so they don't all happen at same time

total_monsters = total_monsters + 1;
- // not real keen on assigning & reassigning think -- CEV
- this.think = this.think_start;
+ e.think = base_walkmonster_think_start;
// 1998-08-14 Monsters sometimes do not move fix
// by Lord Sméagol start
- // this.nextthink = this.nextthink + random() * 0.5;
- this.nextthink = time + 0.1 + random() * 0.5;
+ // e.nextthink = e.nextthink + random() * 0.5;
+ e.nextthink = time + 0.1 + random() * 0.5;
// 1998-08-14 Monsters sometimes do not move fix
- // by Lord Sméagol end
+ // by Lord Sméagol end
};
-};
-#endif
+
+ //--------------------------------------------------------------
+ strip void() base_walkmonster =
+ {
+ base_walkmonster_init (self);
+ };
+// };

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

Diff qc/base_proj.qc

diff --git a/qc/base_proj.qc b/qc/base_proj.qc
index e7e80f0..d25f045 100644
--- a/qc/base_proj.qc
+++ b/qc/base_proj.qc
@@ -176,7 +176,7 @@ strip void() base_projectile_qcphys;
dprint ("spawn_base_explosion: zero origin\n");
setorigin (e, e.origin);
setmodel (e, "progs/s_explod.spr");
- sub_think (e, base_explosion_think);
+ sub_runvoidas (e, base_explosion_think);
};

//--------------------------------------------------------------
@@ -598,7 +598,8 @@ strip void() base_projectile_qcphys;
other = oldother;

// be sure to touch triggers! -- CEV
- touchtriggers ();
+ if (self)
+ touchtriggers ();
};

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

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

Diff qc/cl_progs.src

diff --git a/qc/cl_progs.src b/qc/cl_progs.src
index f81ab77..4e98d66 100644
--- a/qc/cl_progs.src
+++ b/qc/cl_progs.src
@@ -20,7 +20,6 @@ defs_ctypes.qc // global class list
//----------------------------------------------------------------------
base_entities.qc //
world.qc //
-subs.qc //

//----------------------------------------------------------------------
// movement & client prediction, HUD, entity handling

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 998d4cb..57231ef 100644
--- a/qc/compat_quake3.qc
+++ b/qc/compat_quake3.qc
@@ -13,7 +13,7 @@ void() spawnfunc_item_quad =
//======================================================================

//----------------------------------------------------------------------
-// Green Armor -- CEV
+// Green Armor
//----------------------------------------------------------------------
void() spawnfunc_item_armor_jacket =
{
@@ -21,7 +21,7 @@ void() spawnfunc_item_armor_jacket =
};

//----------------------------------------------------------------------
-// Yellow Armor -- CEV
+// Yellow Armor
//----------------------------------------------------------------------
void() spawnfunc_item_armor_combat =
{
@@ -29,7 +29,7 @@ void() spawnfunc_item_armor_combat =
};

//----------------------------------------------------------------------
-// Red Armor -- CEV
+// Red Armor
//----------------------------------------------------------------------
void() spawnfunc_item_armor_body =
{

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

Diff qc/defs_const.qc

diff --git a/qc/defs_const.qc b/qc/defs_const.qc
index 75f626e..db4138b 100644
--- a/qc/defs_const.qc
+++ b/qc/defs_const.qc
@@ -167,6 +167,7 @@ const float CHAN_FEET = 5; // dedicated channel for steps -- CEV
const float ATTN_NONE = 0; // sound attenuation; no attenuation
const float ATTN_NORM = 1; // standard attenuation
const float ATTN_IDLE = 2; // extra attenuation
+const float ATTN_FEET = 2;
const float ATTN_STATIC = 3; // even more attn. (good for torches)

const float EF_BRIGHTFIELD = 1; // entity .effects values

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

Diff qc/defs_ctypes.qc

diff --git a/qc/defs_ctypes.qc b/qc/defs_ctypes.qc
index 5269bf6..6890887 100644
--- a/qc/defs_ctypes.qc
+++ b/qc/defs_ctypes.qc
@@ -148,6 +148,7 @@ enum
CT_MISC_AMBIENT_WATER1, // ambient water 1
CT_MISC_AMBIENT_WIND2, // ambient wind 2
CT_MISC_BOB, // RennyC func_bob
+ CT_MISC_EVENTLIGHTNING, // id1 event_lightning (Chthon)
CT_MISC_EXPLOBOX, // id1 misc_explobox
CT_MISC_EXPLOBOX2, // id1 misc_explobox2
CT_MISC_FIREBALL, // id1 misc_fireball
@@ -270,6 +271,7 @@ enum
CT_TEMP_NEWPLAT_TRIGGER, // pd3 newplats
CT_TEMP_PLAT_TRIGGER, // id1 plats
CT_TEMP_ROTATE_CONTROLLER, // rotation controller
+ CT_TEMP_SHAMBLER_FIELD, // id1 shambler field
CT_TEMP_SPARK, // misc_sparks
CT_TEMP_WIZARDSPELL // id1 wizard spell (spawns missiles)
};

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

Diff qc/func/bob.qc

diff --git a/qc/func/bob.qc b/qc/func/bob.qc
index d77a853..cad3032 100644
--- a/qc/func/bob.qc
+++ b/qc/func/bob.qc
@@ -199,10 +199,6 @@ void() misc_bob;
//--------------------------------------------------------------
strip void() base_func_bob =
{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
base_func_bob_init (self);
};
// };

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

Diff qc/gore.qc

diff --git a/qc/gore.qc b/qc/gore.qc
index 2f80918..78f5c9e 100644
--- a/qc/gore.qc
+++ b/qc/gore.qc
@@ -62,7 +62,7 @@ void(float damage) spawn_touchblood =
local vector vel;

vel = wall_velocity() * 0.2;
- spawn_blood (self.origin + vel* 0.01, vel, damage);
+ spawn_blood (self.origin + vel * 0.01, vel, damage);
};

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

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 496c9b8..7a6a0c7 100644
--- a/qc/math.qc
+++ b/qc/math.qc
@@ -4,8 +4,6 @@
// A collection of helpful math functions.
//==============================================================================

-const float OGRE_DEFAULT_ELEVATION = 30;//TODO CEV remove this
-
//======================================================================
// forward declarations
//======================================================================
@@ -83,13 +81,9 @@ float(float a, float n) mod =
float(float x) sign =
{
if (x > 0)
- {
return 1;
- }
else if (x < 0)
- {
return -1;
- }

return 0;
};
@@ -239,7 +233,7 @@ float(float v) anglemod =
};

//----------------------------------------------------------------------
-// the next two functions were in ogre.qc -- CEV
+// the next three functions were in ogre.qc -- CEV
//----------------------------------------------------------------------

//////////////////////////////////////////////////////////////

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

Diff qc/monsters/boss.qc

diff --git a/qc/monsters/boss.qc b/qc/monsters/boss.qc
index 782862d..dc13a82 100644
--- a/qc/monsters/boss.qc
+++ b/qc/monsters/boss.qc
@@ -3,8 +3,67 @@
//==============================================================================

//======================================================================
+// globals
+//======================================================================
+
+entity le1, le2;
+float lightning_end;
+
+//======================================================================
+// forward declarations
+//======================================================================
+
+// monster_boss
+void() monster_boss_face; // AI & firing
+void(vector p) monster_boss_missile; // thinking & animation below
+void() boss_idle1; void() boss_idle2; void() boss_idle3; void() boss_idle4;
+void() boss_idle5; void() boss_idle6; void() boss_idle7; void() boss_idle8;
+void() boss_idle9; void() boss_idle10; void() boss_idle11; void() boss_idle12;
+void() boss_idle13; void() boss_idle14; void() boss_idle15; void() boss_idle16;
+void() boss_idle17; void() boss_idle18; void() boss_idle19; void() boss_idle20;
+void() boss_idle21; void() boss_idle22; void() boss_idle23; void() boss_idle24;
+void() boss_idle25; void() boss_idle26; void() boss_idle27; void() boss_idle28;
+void() boss_idle29; void() boss_idle30; void() boss_idle31;
+void() boss_rise1; void() boss_rise2; void() boss_rise3; void() boss_rise4;
+void() boss_rise5; void() boss_rise6; void() boss_rise7; void() boss_rise8;
+void() boss_rise9; void() boss_rise10; void() boss_rise11; void() boss_rise12;
+void() boss_rise13; void() boss_rise14; void() boss_rise15; void() boss_rise16;
+void() boss_rise17;
+void() boss_atk1; void() boss_atk2; void() boss_atk3; void() boss_atk4;
+void() boss_atk5; void() boss_atk6; void() boss_atk7; void() boss_atk8;
+void() boss_atk9; void() boss_atk10; void() boss_atk11; void() boss_atk12;
+void() boss_atk13; void() boss_atk14; void() boss_atk15; void() boss_atk16;
+void() boss_atk17; void() boss_atk18; void() boss_atk19; void() boss_atk20;
+void() boss_atk21; void() boss_atk22; void() boss_atk23;
+void() boss_shocka1; void() boss_shocka2; void() boss_shocka3;
+void() boss_shocka4; void() boss_shocka5; void() boss_shocka6;
+void() boss_shocka7; void() boss_shocka8; void() boss_shocka9;
+void() boss_shocka10;
+void() boss_shockb1; void() boss_shockb2; void() boss_shockb3;
+void() boss_shockb4; void() boss_shockb5; void() boss_shockb6;
+void() boss_shockb7; void() boss_shockb8; void() boss_shockb9;
+void() boss_shockb10;
+void() boss_shockc1; void() boss_shockc2; void() boss_shockc3;
+void() boss_shockc4; void() boss_shockc5; void() boss_shockc6;
+void() boss_shockc7; void() boss_shockc8; void() boss_shockc9;
+void() boss_shockc10;
+void() boss_death1; void() boss_death2; void() boss_death3; void() boss_death4;
+void() boss_death5; void() boss_death6; void() boss_death7; void() boss_death8;
+void() boss_death9; void() boss_death10;
+void() monster_boss_use; // interaction & initialization
+void(entity e) monster_boss_init;
+void() monster_boss;
+
+// event_lightning
+void() event_lightning_fire;
+void() event_lightning_use;
+void(entity e) event_lightning_init;
+void() event_lightning;
+
+//======================================================================
// frame macros
//======================================================================
+
$cd id1/models/boss1
$origin 0 0 -15
$base base
@@ -34,232 +93,235 @@ $frame shockb1 shockb2 shockb3 shockb4 shockb5 shockb6
$frame shockc1 shockc2 shockc3 shockc4 shockc5 shockc6 shockc7 shockc8
$frame shockc9 shockc10

+//------------------------------------------------------------------------------
+
/*QUAKED monster_boss (1 0 0) (-128 -128 -24) (128 128 256)
*/
-class monster_boss: base_monster
-{
+//----------------------------------------------------------------------
+// class monster_boss: base_monster
+// {
//--------------------------------------------------------------
- nonvirtual void() boss_face =
+ void() monster_boss_face =
{
// go for another player if multi player
- if (this.enemy.health <= 0 || random() < 0.02)
+ if (self.enemy.health <= 0 || random() < 0.02)
{
- this.enemy = findfloat (this.enemy, ::classtype,
+ self.enemy = findfloat (self.enemy, classtype,
CT_PLAYER);
- if (!this.enemy)
- this.enemy = findfloat (this.enemy, ::classtype,
+ if (!self.enemy)
+ self.enemy = findfloat (self.enemy, classtype,
CT_PLAYER);
}

- ai_face();
+ ai_face ();
};

//--------------------------------------------------------------
// boss_missile
//--------------------------------------------------------------
- nonvirtual void(vector p) attack_missile =
+ void(vector p) monster_boss_missile =
{
local vector org, d;
local float t;

- makevectors (vectoangles(this.enemy.origin - this.origin));
+ makevectors (vectoangles(self.enemy.origin - self.origin));

- org = this.origin + p_x * v_forward + p_y * v_right +
+ org = self.origin + p_x * v_forward + p_y * v_right +
p_z * '0 0 1';

// lead the player on hard mode
if (skill > 1)
{
- t = vlen(this.enemy.origin - org) / 300;
- d = this.enemy.velocity;
+ t = vlen(self.enemy.origin - org) / 300;
+ d = self.enemy.velocity;
d_z = 0;
- d = this.enemy.origin + t * d;
+ d = self.enemy.origin + t * d;
}
else
{
- d = this.enemy.origin;
+ d = self.enemy.origin;
}

- fire_lavaball (org, d - org, LAVABALL_SPEED);
+ base_monster_fire_lavaball (org, d - org, LAVABALL_SPEED);

- sound_attack (this, CHAN_WEAPON, "boss1/throw.wav",
+ sound_attack (self, CHAN_WEAPON, "boss1/throw.wav",
1, ATTN_NORM);

// check for dead enemy
- if (this.enemy.health <= 0)
- this.idle1 ();
+ if (self.enemy.health <= 0)
+ boss_idle1 ();
};

//--------------------------------------------------------------
// Chthon Idle functions
//--------------------------------------------------------------
- nonvirtual void() idle1 = [$walk1, idle2]
+ void() boss_idle1 = [$walk1, boss_idle2]
{
// look for other players
};
- nonvirtual void() idle2 = [$walk2, idle3] { boss_face (); };
- nonvirtual void() idle3 = [$walk3, idle4] { boss_face (); };
- nonvirtual void() idle4 = [$walk4, idle5] { boss_face (); };
- nonvirtual void() idle5 = [$walk5, idle6] { boss_face (); };
- nonvirtual void() idle6 = [$walk6, idle7] { boss_face (); };
- nonvirtual void() idle7 = [$walk7, idle8] { boss_face (); };
- nonvirtual void() idle8 = [$walk8, idle9] { boss_face (); };
- nonvirtual void() idle9 = [$walk9, idle10] { boss_face (); };
- nonvirtual void() idle10 = [$walk10, idle11] { boss_face (); };
- nonvirtual void() idle11 = [$walk11, idle12] { boss_face (); };
- nonvirtual void() idle12 = [$walk12, idle13] { boss_face (); };
- nonvirtual void() idle13 = [$walk13, idle14] { boss_face (); };
- nonvirtual void() idle14 = [$walk14, idle15] { boss_face (); };
- nonvirtual void() idle15 = [$walk15, idle16] { boss_face (); };
- nonvirtual void() idle16 = [$walk16, idle17] { boss_face (); };
- nonvirtual void() idle17 = [$walk17, idle18] { boss_face (); };
- nonvirtual void() idle18 = [$walk18, idle19] { boss_face (); };
- nonvirtual void() idle19 = [$walk19, idle20] { boss_face (); };
- nonvirtual void() idle20 = [$walk20, idle21] { boss_face (); };
- nonvirtual void() idle21 = [$walk21, idle22] { boss_face (); };
- nonvirtual void() idle22 = [$walk22, idle23] { boss_face (); };
- nonvirtual void() idle23 = [$walk23, idle24] { boss_face (); };
- nonvirtual void() idle24 = [$walk24, idle25] { boss_face (); };
- nonvirtual void() idle25 = [$walk25, idle26] { boss_face (); };
- nonvirtual void() idle26 = [$walk26, idle27] { boss_face (); };
- nonvirtual void() idle27 = [$walk27, idle28] { boss_face (); };
- nonvirtual void() idle28 = [$walk28, idle29] { boss_face (); };
- nonvirtual void() idle29 = [$walk29, idle30] { boss_face (); };
- nonvirtual void() idle30 = [$walk30, idle31] { boss_face (); };
- nonvirtual void() idle31 = [$walk31, idle1] { boss_face (); };
+ void() boss_idle2 = [$walk2, boss_idle3] { monster_boss_face (); };
+ void() boss_idle3 = [$walk3, boss_idle4] { monster_boss_face (); };
+ void() boss_idle4 = [$walk4, boss_idle5] { monster_boss_face (); };
+ void() boss_idle5 = [$walk5, boss_idle6] { monster_boss_face (); };
+ void() boss_idle6 = [$walk6, boss_idle7] { monster_boss_face (); };
+ void() boss_idle7 = [$walk7, boss_idle8] { monster_boss_face (); };
+ void() boss_idle8 = [$walk8, boss_idle9] { monster_boss_face (); };
+ void() boss_idle9 = [$walk9, boss_idle10] { monster_boss_face (); };
+ void() boss_idle10 = [$walk10, boss_idle11] { monster_boss_face (); };
+ void() boss_idle11 = [$walk11, boss_idle12] { monster_boss_face (); };
+ void() boss_idle12 = [$walk12, boss_idle13] { monster_boss_face (); };
+ void() boss_idle13 = [$walk13, boss_idle14] { monster_boss_face (); };
+ void() boss_idle14 = [$walk14, boss_idle15] { monster_boss_face (); };
+ void() boss_idle15 = [$walk15, boss_idle16] { monster_boss_face (); };
+ void() boss_idle16 = [$walk16, boss_idle17] { monster_boss_face (); };
+ void() boss_idle17 = [$walk17, boss_idle18] { monster_boss_face (); };
+ void() boss_idle18 = [$walk18, boss_idle19] { monster_boss_face (); };
+ void() boss_idle19 = [$walk19, boss_idle20] { monster_boss_face (); };
+ void() boss_idle20 = [$walk20, boss_idle21] { monster_boss_face (); };
+ void() boss_idle21 = [$walk21, boss_idle22] { monster_boss_face (); };
+ void() boss_idle22 = [$walk22, boss_idle23] { monster_boss_face (); };
+ void() boss_idle23 = [$walk23, boss_idle24] { monster_boss_face (); };
+ void() boss_idle24 = [$walk24, boss_idle25] { monster_boss_face (); };
+ void() boss_idle25 = [$walk25, boss_idle26] { monster_boss_face (); };
+ void() boss_idle26 = [$walk26, boss_idle27] { monster_boss_face (); };
+ void() boss_idle27 = [$walk27, boss_idle28] { monster_boss_face (); };
+ void() boss_idle28 = [$walk28, boss_idle29] { monster_boss_face (); };
+ void() boss_idle29 = [$walk29, boss_idle30] { monster_boss_face (); };
+ void() boss_idle30 = [$walk30, boss_idle31] { monster_boss_face (); };
+ void() boss_idle31 = [$walk31, boss_idle1] { monster_boss_face (); };

//--------------------------------------------------------------
// Chthon Rises
//--------------------------------------------------------------
- nonvirtual void() rise1 = [$rise1, rise2]
+ void() boss_rise1 = [$rise1, boss_rise2]
{
- sound_move (this, CHAN_WEAPON, "boss1/out1.wav", 1, ATTN_NORM);
+ sound_move (self, CHAN_WEAPON, "boss1/out1.wav", 1, ATTN_NORM);
};
- nonvirtual void() rise2 = [$rise2, rise3]
+ void() boss_rise2 = [$rise2, boss_rise3]
{
- sound_sight (this, CHAN_VOICE, "boss1/sight1.wav", 1, ATTN_NORM);
+ sound_sight (self, CHAN_VOICE, "boss1/sight1.wav", 1,ATTN_NORM);
};
- nonvirtual void() rise3 = [$rise3, rise4] { };
- nonvirtual void() rise4 = [$rise4, rise5] { };
- nonvirtual void() rise5 = [$rise5, rise6] { };
- nonvirtual void() rise6 = [$rise6, rise7] { };
- nonvirtual void() rise7 = [$rise7, rise8] { };
- nonvirtual void() rise8 = [$rise8, rise9] { };
- nonvirtual void() rise9 = [$rise9, rise10] { };
- nonvirtual void() rise10 = [$rise10, rise11] { };
- nonvirtual void() rise11 = [$rise11, rise12] { };
- nonvirtual void() rise12 = [$rise12, rise13] { };
- nonvirtual void() rise13 = [$rise13, rise14] { };
- nonvirtual void() rise14 = [$rise14, rise15] { };
- nonvirtual void() rise15 = [$rise15, rise16] { };
- nonvirtual void() rise16 = [$rise16, rise17] { };
- nonvirtual void() rise17 = [$rise17, missile1] { };
+ void() boss_rise3 = [$rise3, boss_rise4] { };
+ void() boss_rise4 = [$rise4, boss_rise5] { };
+ void() boss_rise5 = [$rise5, boss_rise6] { };
+ void() boss_rise6 = [$rise6, boss_rise7] { };
+ void() boss_rise7 = [$rise7, boss_rise8] { };
+ void() boss_rise8 = [$rise8, boss_rise9] { };
+ void() boss_rise9 = [$rise9, boss_rise10] { };
+ void() boss_rise10 = [$rise10, boss_rise11] { };
+ void() boss_rise11 = [$rise11, boss_rise12] { };
+ void() boss_rise12 = [$rise12, boss_rise13] { };
+ void() boss_rise13 = [$rise13, boss_rise14] { };
+ void() boss_rise14 = [$rise14, boss_rise15] { };
+ void() boss_rise15 = [$rise15, boss_rise16] { };
+ void() boss_rise16 = [$rise16, boss_rise17] { };
+ void() boss_rise17 = [$rise17, boss_atk1] { };

//--------------------------------------------------------------
// Chthon Attack Lavaball
//--------------------------------------------------------------
- nonvirtual void() missile1 = [$attack1, missile2] { boss_face (); };
- nonvirtual void() missile2 = [$attack2, missile3] { boss_face (); };
- nonvirtual void() missile3 = [$attack3, missile4] { boss_face (); };
- nonvirtual void() missile4 = [$attack4, missile5] { boss_face (); };
- nonvirtual void() missile5 = [$attack5, missile6] { boss_face (); };
- nonvirtual void() missile6 = [$attack6, missile7] { boss_face (); };
- nonvirtual void() missile7 = [$attack7, missile8] { boss_face (); };
- nonvirtual void() missile8 = [$attack8, missile9] { boss_face (); };
- nonvirtual void() missile9 = [$attack9, missile10]
+ void() boss_atk1 = [$attack1, boss_atk2] { monster_boss_face (); };
+ void() boss_atk2 = [$attack2, boss_atk3] { monster_boss_face (); };
+ void() boss_atk3 = [$attack3, boss_atk4] { monster_boss_face (); };
+ void() boss_atk4 = [$attack4, boss_atk5] { monster_boss_face (); };
+ void() boss_atk5 = [$attack5, boss_atk6] { monster_boss_face (); };
+ void() boss_atk6 = [$attack6, boss_atk7] { monster_boss_face (); };
+ void() boss_atk7 = [$attack7, boss_atk8] { monster_boss_face (); };
+ void() boss_atk8 = [$attack8, boss_atk9] { monster_boss_face (); };
+ void() boss_atk9 = [$attack9, boss_atk10]
{
- attack_missile ('100 100 200');
+ monster_boss_missile ('100 100 200');
};
- nonvirtual void() missile10 = [$attack10, missile11] { boss_face (); };
- nonvirtual void() missile11 = [$attack11, missile12] { boss_face (); };
- nonvirtual void() missile12 = [$attack12, missile13] { boss_face (); };
- nonvirtual void() missile13 = [$attack13, missile14] { boss_face (); };
- nonvirtual void() missile14 = [$attack14, missile15] { boss_face (); };
- nonvirtual void() missile15 = [$attack15, missile16] { boss_face (); };
- nonvirtual void() missile16 = [$attack16, missile17] { boss_face (); };
- nonvirtual void() missile17 = [$attack17, missile18] { boss_face (); };
- nonvirtual void() missile18 = [$attack18, missile19] { boss_face (); };
- nonvirtual void() missile19 = [$attack19, missile20] { boss_face (); };
- nonvirtual void() missile20 = [$attack20, missile21]
+ void() boss_atk10 = [$attack10, boss_atk11] { monster_boss_face (); };
+ void() boss_atk11 = [$attack11, boss_atk12] { monster_boss_face (); };
+ void() boss_atk12 = [$attack12, boss_atk13] { monster_boss_face (); };
+ void() boss_atk13 = [$attack13, boss_atk14] { monster_boss_face (); };
+ void() boss_atk14 = [$attack14, boss_atk15] { monster_boss_face (); };
+ void() boss_atk15 = [$attack15, boss_atk16] { monster_boss_face (); };
+ void() boss_atk16 = [$attack16, boss_atk17] { monster_boss_face (); };
+ void() boss_atk17 = [$attack17, boss_atk18] { monster_boss_face (); };
+ void() boss_atk18 = [$attack18, boss_atk19] { monster_boss_face (); };
+ void() boss_atk19 = [$attack19, boss_atk20] { monster_boss_face (); };
+ void() boss_atk20 = [$attack20, boss_atk21]
{
- attack_missile ('100 -100 200');
+ monster_boss_missile ('100 -100 200');
};
- nonvirtual void() missile21 = [$attack21, missile22] { boss_face (); };
- nonvirtual void() missile22 = [$attack22, missile23] { boss_face (); };
- nonvirtual void() missile23 = [$attack23, missile1] { boss_face (); };
+ void() boss_atk21 = [$attack21, boss_atk22] { monster_boss_face (); };
+ void() boss_atk22 = [$attack22, boss_atk23] { monster_boss_face (); };
+ void() boss_atk23 = [$attack23, boss_atk1] { monster_boss_face (); };

//--------------------------------------------------------------
// Chthon Shock! A
//--------------------------------------------------------------
- nonvirtual void() shocka1 = [$shocka1, shocka2] { };
- nonvirtual void() shocka2 = [$shocka2, shocka3] { };
- nonvirtual void() shocka3 = [$shocka3, shocka4] { };
- nonvirtual void() shocka4 = [$shocka4, shocka5] { };
- nonvirtual void() shocka5 = [$shocka5, shocka6] { };
- nonvirtual void() shocka6 = [$shocka6, shocka7] { };
- nonvirtual void() shocka7 = [$shocka7, shocka8] { };
- nonvirtual void() shocka8 = [$shocka8, shocka9] { };
- nonvirtual void() shocka9 = [$shocka9, shocka10] { };
- nonvirtual void() shocka10 = [$shocka10, missile1] { };
+ void() boss_shocka1 = [$shocka1, boss_shocka2] { };
+ void() boss_shocka2 = [$shocka2, boss_shocka3] { };
+ void() boss_shocka3 = [$shocka3, boss_shocka4] { };
+ void() boss_shocka4 = [$shocka4, boss_shocka5] { };
+ void() boss_shocka5 = [$shocka5, boss_shocka6] { };
+ void() boss_shocka6 = [$shocka6, boss_shocka7] { };
+ void() boss_shocka7 = [$shocka7, boss_shocka8] { };
+ void() boss_shocka8 = [$shocka8, boss_shocka9] { };
+ void() boss_shocka9 = [$shocka9, boss_shocka10] { };
+ void() boss_shocka10 = [$shocka10, boss_atk1] { };

//--------------------------------------------------------------
// Chthon Shock! B
//--------------------------------------------------------------
- nonvirtual void() shockb1 = [$shockb1, shockb2] { };
- nonvirtual void() shockb2 = [$shockb2, shockb3] { };
- nonvirtual void() shockb3 = [$shockb3, shockb4] { };
- nonvirtual void() shockb4 = [$shockb4, shockb5] { };
- nonvirtual void() shockb5 = [$shockb5, shockb6] { };
- nonvirtual void() shockb6 = [$shockb6, shockb7] { };
- nonvirtual void() shockb7 = [$shockb1, shockb8] { };
- nonvirtual void() shockb8 = [$shockb2, shockb9] { };
- nonvirtual void() shockb9 = [$shockb3, shockb10] { };
- nonvirtual void() shockb10 = [$shockb4, missile1] { };
+ void() boss_shockb1 = [$shockb1, boss_shockb2] { };
+ void() boss_shockb2 = [$shockb2, boss_shockb3] { };
+ void() boss_shockb3 = [$shockb3, boss_shockb4] { };
+ void() boss_shockb4 = [$shockb4, boss_shockb5] { };
+ void() boss_shockb5 = [$shockb5, boss_shockb6] { };
+ void() boss_shockb6 = [$shockb6, boss_shockb7] { };
+ void() boss_shockb7 = [$shockb1, boss_shockb8] { };
+ void() boss_shockb8 = [$shockb2, boss_shockb9] { };
+ void() boss_shockb9 = [$shockb3, boss_shockb10] { };
+ void() boss_shockb10 = [$shockb4, boss_atk1] { };

//--------------------------------------------------------------
// Chthon Shock! C
//--------------------------------------------------------------
- nonvirtual void() shockc1 = [$shockc1, shockc2] { };
- nonvirtual void() shockc2 = [$shockc2, shockc3] { };
- nonvirtual void() shockc3 = [$shockc3, shockc4] { };
- nonvirtual void() shockc4 = [$shockc4, shockc5] { };
- nonvirtual void() shockc5 = [$shockc5, shockc6] { };
- nonvirtual void() shockc6 = [$shockc6, shockc7] { };
- nonvirtual void() shockc7 = [$shockc7, shockc8] { };
- nonvirtual void() shockc8 = [$shockc8, shockc9] { };
- nonvirtual void() shockc9 = [$shockc9, shockc10] { };
- nonvirtual void() shockc10 = [$shockc10, death1] { };
+ void() boss_shockc1 = [$shockc1, boss_shockc2] { };
+ void() boss_shockc2 = [$shockc2, boss_shockc3] { };
+ void() boss_shockc3 = [$shockc3, boss_shockc4] { };
+ void() boss_shockc4 = [$shockc4, boss_shockc5] { };
+ void() boss_shockc5 = [$shockc5, boss_shockc6] { };
+ void() boss_shockc6 = [$shockc6, boss_shockc7] { };
+ void() boss_shockc7 = [$shockc7, boss_shockc8] { };
+ void() boss_shockc8 = [$shockc8, boss_shockc9] { };
+ void() boss_shockc9 = [$shockc9, boss_shockc10] { };
+ void() boss_shockc10 = [$shockc10, boss_death1] { };

//--------------------------------------------------------------
// Chthon Death state
//--------------------------------------------------------------
- nonvirtual void() death1 = [$death1, death2]
+ void() boss_death1 = [$death1, boss_death2]
{
- sound_death (this, CHAN_VOICE, "boss1/death.wav", 1, ATTN_NORM);
+ sound_death (self, CHAN_VOICE, "boss1/death.wav", 1, ATTN_NORM);
};
- nonvirtual void() death2 = [$death2, death3] { };
- nonvirtual void() death3 = [$death3, death4] { };
- nonvirtual void() death4 = [$death4, death5] { };
- nonvirtual void() death5 = [$death5, death6] { };
- nonvirtual void() death6 = [$death6, death7] { };
- nonvirtual void() death7 = [$death7, death8] { };
- nonvirtual void() death8 = [$death8, death9] { };
- nonvirtual void() death9 = [$death9, death10]
+ void() boss_death2 = [$death2, boss_death3] { };
+ void() boss_death3 = [$death3, boss_death4] { };
+ void() boss_death4 = [$death4, boss_death5] { };
+ void() boss_death5 = [$death5, boss_death6] { };
+ void() boss_death6 = [$death6, boss_death7] { };
+ void() boss_death7 = [$death7, boss_death8] { };
+ void() boss_death8 = [$death8, boss_death9] { };
+ void() boss_death9 = [$death9, boss_death10]
{
- sound_move (this, CHAN_BODY, "boss1/out1.wav", 1, ATTN_NORM);
+ sound_move (self, CHAN_BODY, "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);
+ WriteCoord (MSG_BROADCAST, self.origin_x);
+ WriteCoord (MSG_BROADCAST, self.origin_y);
+ WriteCoord (MSG_BROADCAST, self.origin_z);
};
- nonvirtual void() death10 = [$death9, death10]
+ void() boss_death10 = [$death9, boss_death10]
{
killed_monsters = killed_monsters + 1;
// FIXME: reliable broadcast
WriteByte (MSG_ALL, SVC_KILLEDMONSTER);
sub_usetargets ();
- remove (this);
+ remove (self);
};

//==============================================================
@@ -269,32 +331,32 @@ class monster_boss: base_monster
//--------------------------------------------------------------
// boss_awake
//--------------------------------------------------------------
- virtual void() use =
+ void() monster_boss_use =
{
- this.solid = SOLID_SLIDEBOX;
- this.movetype = MOVETYPE_STEP;
- this.takedamage = DAMAGE_NO;
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+ self.takedamage = DAMAGE_NO;

- body_model ("progs/boss.mdl");
+ body_model (self, "progs/boss.mdl");
// custom_mdl -- dumptruck_ds
- // setmodel (this, "progs/boss.mdl");
- setsize (this, '-128 -128 -24', '128 128 256');
+ // setmodel (self, "progs/boss.mdl");
+ setsize (self, '-128 -128 -24', '128 128 256');

if (skill == 0)
- this.health = 1;
+ self.health = 1;
else
- this.health = 3;
+ self.health = 3;

- this.enemy = activator;
+ self.enemy = activator;

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);
+ WriteCoord (MSG_BROADCAST, self.origin_x);
+ WriteCoord (MSG_BROADCAST, self.origin_y);
+ WriteCoord (MSG_BROADCAST, self.origin_z);

- this.yaw_speed = 20;
- this.rise1 ();
+ self.yaw_speed = 20;
+ boss_rise1 ();
};

//==============================================================
@@ -302,147 +364,167 @@ class monster_boss: base_monster
//==============================================================

//--------------------------------------------------------------
- virtual void() init_spawned =
+ void(entity e) monster_boss_init =
{
- if (this.spawnflags & I_AM_TURRET)
+ if (e.spawnflags & I_AM_TURRET)
objerror ("Incompatible spawnflag: TURRET_MODE\n");

if (deathmatch)
{
- remove (this);
+ remove (e);
return;
}

+ e.classname = "monster_boss";
+ e.classtype = CT_MONSTER_BOSS_CHTHON;
+ base_monster_init (e);
+
// precache_model ("progs/boss.mdl");
- precache_body_model ("progs/boss.mdl");
- precache_head_model ("progs/h_boss.mdl");
+ precache_body_model (e, "progs/boss.mdl");
+ precache_head_model (e, "progs/h_boss.mdl");

precache_model ("progs/lavaball.mdl");

precache_sound ("weapons/rocket1i.wav");
- precache_sound_move ("boss1/out1.wav");
- precache_sound_sight ("boss1/sight1.wav");
+ precache_sound_move (e, "boss1/out1.wav");
+ precache_sound_sight (e, "boss1/sight1.wav");
precache_sound ("misc/power.wav");
- precache_sound_attack ("boss1/throw.wav");
- precache_sound_pain ("boss1/pain.wav");
- precache_sound_death ("boss1/death.wav");
+ precache_sound_attack (e, "boss1/throw.wav");
+ precache_sound_pain (e, "boss1/pain.wav");
+ precache_sound_death (e, "boss1/death.wav");

total_monsters = total_monsters + 1;

- this.flags = FL_MONSTER;
+ e.flags = FL_MONSTER;
+ e.use = monster_boss_use;
};

//--------------------------------------------------------------
void() monster_boss =
{
- this.classtype = CT_MONSTER_BOSS_CHTHON;
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ monster_boss_init (self);
};
-};
+// };

-//==============================================================================
+//----------------------------------------------------------------------
// Event Lightning
-//==============================================================================
-
-//======================================================================
-// globals
-//======================================================================
-entity le1, le2;
-float lightning_end;
-
//----------------------------------------------------------------------
-void() lightning_fire =
-{
- local vector p1, p2;

- if (time >= lightning_end)
+/*QUAKED event_lightning (0 1 1) (-16 -16 -16) (16 16 16) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
+Just for boss level.
+*/
+//----------------------------------------------------------------------
+// class event_lightning: base_mapentity
+// {
+ //--------------------------------------------------------------
+ void() event_lightning_fire =
{
- // done here, put the terminals back up
- ((func_door)le1).door_go_down ();
- ((func_door)le2).door_go_down ();
- return;
- }
-
- p1 = (le1.mins + le1.maxs) * 0.5;
- p1_z = le1.absmin_z - 16;
-
- p2 = (le2.mins + le2.maxs) * 0.5;
- p2_z = le2.absmin_z - 16;
-
- // compensate for length of bolt
- p2 = p2 - normalize(p2-p1) * 100;
-
- self.nextthink = time + 0.1;
- self.think = lightning_fire;
-
- WriteByte (MSG_ALL, SVC_TEMPENTITY);
- WriteByte (MSG_ALL, TE_LIGHTNING3);
- WriteEntity (MSG_ALL, world);
- WriteCoord (MSG_ALL, p1_x);
- WriteCoord (MSG_ALL, p1_y);
- WriteCoord (MSG_ALL, p1_z);
- WriteCoord (MSG_ALL, p2_x);
- WriteCoord (MSG_ALL, p2_y);
- WriteCoord (MSG_ALL, p2_z);
-};
+ local vector p1, p2;

-//----------------------------------------------------------------------
-void() lightning_use =
-{
- if (lightning_end >= time + 1)
- return;
-
- le1 = find (world, target, "lightning");
- le2 = find (le1, target, "lightning");
- if (!le1 || !le2)
+ if (time >= lightning_end)
+ {
+ // done here, put the terminals back up
+ sub_runvoidas (le1, func_door_think_go_down);
+ sub_runvoidas (le2, func_door_think_go_down);
+ return;
+ }
+
+ p1 = (le1.mins + le1.maxs) * 0.5;
+ p1_z = le1.absmin_z - 16;
+
+ p2 = (le2.mins + le2.maxs) * 0.5;
+ p2_z = le2.absmin_z - 16;
+
+ // compensate for length of bolt
+ p2 = p2 - normalize(p2-p1) * 100;
+
+ self.nextthink = time + 0.1;
+ self.think = event_lightning_fire;
+
+ WriteByte (MSG_ALL, SVC_TEMPENTITY);
+ WriteByte (MSG_ALL, TE_LIGHTNING3);
+ WriteEntity (MSG_ALL, world);
+ WriteCoord (MSG_ALL, p1_x);
+ WriteCoord (MSG_ALL, p1_y);
+ WriteCoord (MSG_ALL, p1_z);
+ WriteCoord (MSG_ALL, p2_x);
+ WriteCoord (MSG_ALL, p2_y);
+ WriteCoord (MSG_ALL, p2_z);
+ };
+
+ //--------------------------------------------------------------
+ void() event_lightning_use =
{
- dprint ("missing lightning targets\n");
- return;
- }
+ if (lightning_end >= time + 1)
+ return;
+
+ le1 = find (world, target, "lightning");
+ le2 = find (le1, target, "lightning");
+ if (!le1 || !le2)
+ {
+ dprint ("missing lightning targets\n");
+ return;
+ }
+
+ if ((le1.state != FUNC_STATE_TOP &&
+ le1.state != FUNC_STATE_BOTTOM) ||
+ (le2.state != FUNC_STATE_TOP &&
+ le2.state != FUNC_STATE_BOTTOM)
+ || (le1.state != le2.state))
+ {
+ // dprint ("not aligned\n");
+ return;
+ }

- if ((le1.state != FUNC_STATE_TOP && le1.state != FUNC_STATE_BOTTOM) ||
- (le2.state != FUNC_STATE_TOP && le2.state != FUNC_STATE_BOTTOM)
- || (le1.state != le2.state))
+ // don't let the electrodes go back up until the bolt is done
+ le1.nextthink = -1;
+ le2.nextthink = -1;
+ lightning_end = time + 1;
+
+ sound (self, CHAN_VOICE, "misc/power.wav", 1, ATTN_NORM);
+ event_lightning_fire ();
+
+ // advance the boss pain if down
+ local entity boss;
+ boss = findfloat (world, classtype, CT_MONSTER_BOSS_CHTHON);
+ if (!boss)
+ return;
+
+ boss.enemy = activator;
+ if (le1.state == FUNC_STATE_TOP && boss.health > 0)
+ {
+ sound_pain (boss, CHAN_VOICE, "boss1/pain.wav",
+ 1, ATTN_NORM);
+ boss.health = boss.health - 1;
+ if (boss.health >= 2)
+ sub_runvoidas (boss, boss_shocka1);
+ else if (boss.health == 1)
+ sub_runvoidas (boss, boss_shockb1);
+ else if (boss.health == 0)
+ sub_runvoidas (boss, boss_shockc1);
+ }
+ };
+
+ //--------------------------------------------------------------
+ void(entity e) event_lightning_init =
{
- // dprint ("not aligned\n");
- return;
- }
-
- // don't let the electrodes go back up until the bolt is done
- le1.nextthink = -1;
- le2.nextthink = -1;
- lightning_end = time + 1;
-
- sound (self, CHAN_VOICE, "misc/power.wav", 1, ATTN_NORM);
- lightning_fire ();
-
- // advance the boss pain if down
- local entity e;
- e = findfloat (world, classtype, CT_MONSTER_BOSS_CHTHON);
- if (!e)
- return;
- local monster_boss boss = (monster_boss)e;
- boss.enemy = activator;
- if (le1.state == FUNC_STATE_TOP && boss.health > 0)
+ e.classname = "event_lightning";
+ e.classtype = CT_MISC_EVENTLIGHTNING;
+ base_mapentity_init (e);
+ e.use = event_lightning_use;
+ };
+
+ //--------------------------------------------------------------
+ void() event_lightning =
{
- sound_pain (boss, CHAN_VOICE, "boss1/pain.wav", 1, ATTN_NORM);
- boss.health = boss.health - 1;
- if (boss.health >= 2)
- boss.shocka1 ();
- else if (boss.health == 1)
- boss.shockb1 ();
- else if (boss.health == 0)
- boss.shockc1 ();
- }
-};
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;

-/*QUAKED event_lightning (0 1 1) (-16 -16 -16) (16 16 16) X X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
-Just for boss level.
-*/
-void() event_lightning =
-{
- // new spawnflags for all entities -- iw
- if (SUB_Inhibit())
- return;
-
- self.use = lightning_use;
-};
+ event_lightning_init (self);
+ };
+// };

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

Diff qc/monsters/boss2.qc

diff --git a/qc/monsters/boss2.qc b/qc/monsters/boss2.qc
index da8300d..1a6877c 100644
--- a/qc/monsters/boss2.qc
+++ b/qc/monsters/boss2.qc
@@ -6,12 +6,67 @@
// constants
//======================================================================

-// supress lava splash effect when raising, lowering or gibbing - dumptruck_ds
+// supress lava splash effect when raising, lowering or gibbing -- dumptruck_ds
const float NO_LAVASPLASH = 2;

//======================================================================
+// forward declarations
+//======================================================================
+
+// monster_boss2
+void() monster_boss2_face; // AI & firing
+void(vector p) monster_boss2_missile;
+void() monster_boss2_gib; // thinking & animation below
+void() boss2_idle1; void() boss2_idle2; void() boss2_idle3; void() boss2_idle4;
+void() boss2_idle5; void() boss2_idle6; void() boss2_idle7; void() boss2_idle8;
+void() boss2_idle9; void() boss2_idle10; void() boss2_idle11;
+void() boss2_idle12; void() boss2_idle13; void() boss2_idle14;
+void() boss2_idle15; void() boss2_idle16; void() boss2_idle17;
+void() boss2_idle18; void() boss2_idle19; void() boss2_idle20;
+void() boss2_idle21; void() boss2_idle22; void() boss2_idle23;
+void() boss2_idle24; void() boss2_idle25; void() boss2_idle26;
+void() boss2_idle27; void() boss2_idle28; void() boss2_idle29;
+void() boss2_idle30; void() boss2_idle31;
+void() boss2_rise1; void() boss2_rise2; void() boss2_rise3; void() boss2_rise4;
+void() boss2_rise5; void() boss2_rise6; void() boss2_rise7; void() boss2_rise8;
+void() boss2_rise9; void() boss2_rise10; void() boss2_rise11;
+void() boss2_rise12; void() boss2_rise13; void() boss2_rise14;
+void() boss2_rise15; void() boss2_rise16; void() boss2_rise17;
+void() boss2_atk1; void() boss2_atk2; void() boss2_atk3; void() boss2_atk4;
+void() boss2_atk5; void() boss2_atk6; void() boss2_atk7; void() boss2_atk8;
+void() boss2_atk9; void() boss2_atk10; void() boss2_atk11; void() boss2_atk12;
+void() boss2_atk13; void() boss2_atk14; void() boss2_atk15; void() boss2_atk16;
+void() boss2_atk17; void() boss2_atk18; void() boss2_atk19; void() boss2_atk20;
+void() boss2_atk21; void() boss2_atk22; void() boss2_atk23;
+void() boss2_shocka1; void() boss2_shocka2; void() boss2_shocka3;
+void() boss2_shocka4; void() boss2_shocka5; void() boss2_shocka6;
+void() boss2_shocka7; void() boss2_shocka8; void() boss2_shocka9;
+void() boss2_shocka10;
+void() boss2_shockb1; void() boss2_shockb2; void() boss2_shockb3;
+void() boss2_shockb4; void() boss2_shockb5; void() boss2_shockb6;
+void() boss2_shockb7; void() boss2_shockb8; void() boss2_shockb9;
+void() boss2_shockb10;
+void() boss2_shockc1; void() boss2_shockc2; void() boss2_shockc3;
+void() boss2_shockc4; void() boss2_shockc5; void() boss2_shockc6;
+void() boss2_shockc7; void() boss2_shockc8; void() boss2_shockc9;
+void() boss2_shockc10;
+void() boss2_pain1; void() boss2_pain2; void() boss2_pain3; void() boss2_pain4;
+void() boss2_pain5; void() boss2_pain6; void() boss2_pain7; void() boss2_pain8;
+void() boss2_pain9;
+void() boss2_death1; void() boss2_death2; void() boss2_death3;
+void() boss2_death4; void() boss2_death5; void() boss2_death6;
+void() boss2_death7; void() boss2_death8; void() boss2_death9;
+void() boss2_death10;
+void(entity attacker, float damage) monster_boss2_pain; // interaction
+void() monster_boss2_destroy;
+void() monster_boss2_use;
+void(entity e) monster_boss2_init; // initialization
+void() monster_boss2;
+
+//======================================================================
// frame macros
//======================================================================
+
$cd id1/models/boss1
$origin 0 0 -15
$base base
@@ -41,20 +96,23 @@ $frame shockb1 shockb2 shockb3 shockb4 shockb5 shockb6
$frame shockc1 shockc2 shockc3 shockc4 shockc5 shockc6 shockc7 shockc8
$frame shockc9 shockc10

+//------------------------------------------------------------------------------
+
/*QUAKED monster_boss2 (1 0 0) (-128 -128 -24) (128 128 256)
*/
-class monster_boss2: base_monster
-{
+//----------------------------------------------------------------------
+// class monster_boss2: base_monster
+// {
//--------------------------------------------------------------
- nonvirtual void() boss2_face =
+ void() monster_boss2_face =
{
// go for another player if multi player
- if (this.enemy.health <= 0 || random() < 0.02)
+ if (self.enemy.health <= 0 || random() < 0.02)
{
- this.enemy = findfloat (this.enemy, ::classtype,
+ self.enemy = findfloat (self.enemy, classtype,
CT_PLAYER);
- if (!this.enemy)
- this.enemy = findfloat (this.enemy, ::classtype,
+ if (!self.enemy)
+ self.enemy = findfloat (self.enemy, classtype,
CT_PLAYER);
}
ai_face ();
@@ -63,45 +121,45 @@ class monster_boss2: base_monster
//--------------------------------------------------------------
// boss2_missile
//--------------------------------------------------------------
- nonvirtual void(vector p) attack_missile =
+ void(vector p) monster_boss2_missile =
{
local vector org, d;
local float t;

- makevectors (vectoangles(this.enemy.origin - this.origin));
+ makevectors (vectoangles(self.enemy.origin - self.origin));

- org = this.origin + p_x * v_forward + p_y * v_right +
+ org = self.origin + p_x * v_forward + p_y * v_right +
p_z * '0 0 1';

// lead the player on hard mode
if (skill > 1)
{
- t = vlen(this.enemy.origin - org) / 300;
- d = this.enemy.velocity;
+ t = vlen(self.enemy.origin - org) / 300;
+ d = self.enemy.velocity;
d_z = 0;
- d = this.enemy.origin + t * d;
+ d = self.enemy.origin + t * d;
}
else
{
- d = this.enemy.origin;
+ d = self.enemy.origin;
}

- fire_lavaball (org, d - org, LAVABALL_SPEED);
+ base_monster_fire_lavaball (org, d - org, LAVABALL_SPEED);

- sound_attack (this, CHAN_WEAPON, "boss1/throw.wav",
+ sound_attack (self, CHAN_WEAPON, "boss1/throw.wav",
1, ATTN_NORM);

// check for dead enemy
- if (this.enemy.health <= 0)
- this.idle1 ();
+ if (self.enemy.health <= 0)
+ boss2_idle1 ();
};

//--------------------------------------------------------------
// GibBoss2
//--------------------------------------------------------------
- nonvirtual void() gib_boss2 =
+ void() monster_boss2_gib =
{
- sound (this, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
+ sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
// throw tons of meat chunks

local vector boss;
@@ -109,7 +167,7 @@ class monster_boss2: base_monster
local float r;
// local entity n;

- boss = this.origin;
+ boss = self.origin;
z = 16;
while (z <= 144)
{
@@ -119,55 +177,55 @@ class monster_boss2: base_monster
y = -64;
while (y <= 64)
{
- this.origin_x = boss_x + x;
- this.origin_y = boss_y + y;
- this.origin_z = boss_z + z;
+ self.origin_x = boss_x + x;
+ self.origin_y = boss_y + y;
+ self.origin_z = boss_z + z;

r = random ();
if (r < 0.3)
{
// custom models -- dumptruck_ds
- if (this.mdl_gib1 != "")
+ if (self.mdl_gib1 != "")
{
- ThrowGib (this.mdl_gib1,
+ throw_gib(self.mdl_gib1,
-120);
}
else
{
- ThrowGib ("progs/gib1."
+ throw_gib ("progs/gib1."
"mdl", -120);
}
}
else if (r < 0.5)
{
// custom models -- dumptruck_ds
- if (this.mdl_gib2 != "")
+ if (self.mdl_gib2 != "")
{
- ThrowGib (this.mdl_gib2,
+ throw_gib(self.mdl_gib2,
-120);
}
else
{
- ThrowGib ("progs/gib2."
+ throw_gib ("progs/gib2."
"mdl", -120);
}
}
else if (r < 0.7)
{
- ThrowGib ("progs/lavaball.mdl",
+ throw_gib ("progs/lavaball.mdl",
-120);
}
else
{
// custom models -- dumptruck_ds
- if (this.mdl_gib3 != "")
+ if (self.mdl_gib3 != "")
{
- ThrowGib (this.mdl_gib3,
+ throw_gib(self.mdl_gib3,
-120);
}
else
{
- ThrowGib ("progs/gib3."
+ throw_gib ("progs/gib3."
"mdl", -120);
}
}
@@ -181,21 +239,21 @@ class monster_boss2: base_monster
local entity head;

head = spawn ();
- head.origin = this.origin + '0 0 128';
+ head.origin = self.origin + '0 0 128';
head.velocity_z = 600; + (random() * 200);
head.velocity_x = -300 + (random() * 600);
head.velocity_y = -200 + (random() * 600);
head.avelocity_x = random() * 120;
head.avelocity_y = random() * 120;
head.avelocity_z = random() * 120;
- head.flags = this.flags - (this.flags & FL_ONGROUND);
+ head.flags = self.flags - (self.flags & FL_ONGROUND);
head.solid = SOLID_NOT;
head.movetype = MOVETYPE_BOUNCE;
head.takedamage = DAMAGE_NO;
// dumptruck_ds custom_mdls
- if (this.mdl_head != "")
+ if (self.mdl_head != "")
{
- setmodel (head, this.mdl_head);
+ setmodel (head, self.mdl_head);
}
else
{
@@ -203,9 +261,9 @@ class monster_boss2: base_monster
}

// dumptruck_ds
- if (!this.skin_head)
+ if (!self.skin_head)
{
- head.skin = this.skin_proj;
+ head.skin = self.skin_proj;
}
else
{
@@ -216,178 +274,178 @@ class monster_boss2: base_monster
head.touch = sub_null;
head.think = sub_remove;
head.nextthink = time + 120;
- if !(this.spawnflags & NO_LAVASPLASH)
+ if !(self.spawnflags & NO_LAVASPLASH)
{
- // done in combat.qc since this is now FL_MONSTER
+ // done in combat.qc since self is now FL_MONSTER
// killed_monsters = killed_monsters + 1;
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_LAVASPLASH);
- // done in combat.qc since this is now FL_MONSTER
+ // done in combat.qc since self is now FL_MONSTER
// -- dumptruck_ds
// WriteByte (MSG_ALL, SVC_KILLEDMONSTER);
- WriteCoord (MSG_BROADCAST, this.origin_x);
- WriteCoord (MSG_BROADCAST, this.origin_y);
- WriteCoord (MSG_BROADCAST, this.origin_z);
+ WriteCoord (MSG_BROADCAST, self.origin_x);
+ WriteCoord (MSG_BROADCAST, self.origin_y);
+ WriteCoord (MSG_BROADCAST, self.origin_z);
}
- remove (this);
+ remove (self);
};

//--------------------------------------------------------------
- // Chthon Idle State
+ // Chthon Idle functions
//--------------------------------------------------------------
- nonvirtual void() idle1 = [$walk1, idle2]
+ void() boss2_idle1 = [$walk1, boss2_idle2]
{
// look for other players
};
- nonvirtual void() idle2 = [$walk2, idle3] { boss2_face (); };
- nonvirtual void() idle3 = [$walk3, idle4] { boss2_face (); };
- nonvirtual void() idle4 = [$walk4, idle5] { boss2_face (); };
- nonvirtual void() idle5 = [$walk5, idle6] { boss2_face (); };
- nonvirtual void() idle6 = [$walk6, idle7] { boss2_face (); };
- nonvirtual void() idle7 = [$walk7, idle8] { boss2_face (); };
- nonvirtual void() idle8 = [$walk8, idle9] { boss2_face (); };
- nonvirtual void() idle9 = [$walk9, idle10] { boss2_face (); };
- nonvirtual void() idle10 = [$walk10, idle11] { boss2_face (); };
- nonvirtual void() idle11 = [$walk11, idle12] { boss2_face (); };
- nonvirtual void() idle12 = [$walk12, idle13] { boss2_face (); };
- nonvirtual void() idle13 = [$walk13, idle14] { boss2_face (); };
- nonvirtual void() idle14 = [$walk14, idle15] { boss2_face (); };
- nonvirtual void() idle15 = [$walk15, idle16] { boss2_face (); };
- nonvirtual void() idle16 = [$walk16, idle17] { boss2_face (); };
- nonvirtual void() idle17 = [$walk17, idle18] { boss2_face (); };
- nonvirtual void() idle18 = [$walk18, idle19] { boss2_face (); };
- nonvirtual void() idle19 = [$walk19, idle20] { boss2_face (); };
- nonvirtual void() idle20 = [$walk20, idle21] { boss2_face (); };
- nonvirtual void() idle21 = [$walk21, idle22] { boss2_face (); };
- nonvirtual void() idle22 = [$walk22, idle23] { boss2_face (); };
- nonvirtual void() idle23 = [$walk23, idle24] { boss2_face (); };
- nonvirtual void() idle24 = [$walk24, idle25] { boss2_face (); };
- nonvirtual void() idle25 = [$walk25, idle26] { boss2_face (); };
- nonvirtual void() idle26 = [$walk26, idle27] { boss2_face (); };
- nonvirtual void() idle27 = [$walk27, idle28] { boss2_face (); };
- nonvirtual void() idle28 = [$walk28, idle29] { boss2_face (); };
- nonvirtual void() idle29 = [$walk29, idle30] { boss2_face (); };
- nonvirtual void() idle30 = [$walk30, idle31] { boss2_face (); };
- nonvirtual void() idle31 = [$walk31, idle1] { boss2_face (); };
+ void() boss2_idle2 = [$walk2, boss2_idle3] { monster_boss2_face (); };
+ void() boss2_idle3 = [$walk3, boss2_idle4] { monster_boss2_face (); };
+ void() boss2_idle4 = [$walk4, boss2_idle5] { monster_boss2_face (); };
+ void() boss2_idle5 = [$walk5, boss2_idle6] { monster_boss2_face (); };
+ void() boss2_idle6 = [$walk6, boss2_idle7] { monster_boss2_face (); };
+ void() boss2_idle7 = [$walk7, boss2_idle8] { monster_boss2_face (); };
+ void() boss2_idle8 = [$walk8, boss2_idle9] { monster_boss2_face (); };
+ void() boss2_idle9 = [$walk9, boss2_idle10] { monster_boss2_face (); };
+ void() boss2_idle10 = [$walk10, boss2_idle11] { monster_boss2_face ();};
+ void() boss2_idle11 = [$walk11, boss2_idle12] { monster_boss2_face ();};
+ void() boss2_idle12 = [$walk12, boss2_idle13] { monster_boss2_face ();};
+ void() boss2_idle13 = [$walk13, boss2_idle14] { monster_boss2_face ();};
+ void() boss2_idle14 = [$walk14, boss2_idle15] { monster_boss2_face ();};
+ void() boss2_idle15 = [$walk15, boss2_idle16] { monster_boss2_face ();};
+ void() boss2_idle16 = [$walk16, boss2_idle17] { monster_boss2_face ();};
+ void() boss2_idle17 = [$walk17, boss2_idle18] { monster_boss2_face ();};
+ void() boss2_idle18 = [$walk18, boss2_idle19] { monster_boss2_face ();};
+ void() boss2_idle19 = [$walk19, boss2_idle20] { monster_boss2_face ();};
+ void() boss2_idle20 = [$walk20, boss2_idle21] { monster_boss2_face ();};
+ void() boss2_idle21 = [$walk21, boss2_idle22] { monster_boss2_face ();};
+ void() boss2_idle22 = [$walk22, boss2_idle23] { monster_boss2_face ();};
+ void() boss2_idle23 = [$walk23, boss2_idle24] { monster_boss2_face ();};
+ void() boss2_idle24 = [$walk24, boss2_idle25] { monster_boss2_face ();};
+ void() boss2_idle25 = [$walk25, boss2_idle26] { monster_boss2_face ();};
+ void() boss2_idle26 = [$walk26, boss2_idle27] { monster_boss2_face ();};
+ void() boss2_idle27 = [$walk27, boss2_idle28] { monster_boss2_face ();};
+ void() boss2_idle28 = [$walk28, boss2_idle29] { monster_boss2_face ();};
+ void() boss2_idle29 = [$walk29, boss2_idle30] { monster_boss2_face ();};
+ void() boss2_idle30 = [$walk30, boss2_idle31] { monster_boss2_face ();};
+ void() boss2_idle31 = [$walk31, boss2_idle1] { monster_boss2_face (); };

//--------------------------------------------------------------
// Chthon Rises
//--------------------------------------------------------------
- nonvirtual void() rise1 = [$rise1, rise2]
+ void() boss2_rise1 = [$rise1, boss2_rise2]
{
- sound_move (this, CHAN_AUTO, "boss1/out1.wav", 1, ATTN_NORM);
+ sound_move (self, CHAN_WEAPON, "boss1/out1.wav", 1, ATTN_NORM);
};
- nonvirtual void() rise2 = [$rise2, rise3]
+ void() boss2_rise2 = [$rise2, boss2_rise3]
{
- sound_sight (this, CHAN_AUTO, "boss1/sight1.wav", 1, ATTN_NORM);
+ sound_sight (self, CHAN_VOICE, "boss1/sight1.wav", 1,ATTN_NORM);
};
- nonvirtual void() rise3 = [$rise3, rise4] { };
- nonvirtual void() rise4 = [$rise4, rise5] { };
- nonvirtual void() rise5 = [$rise5, rise6] { };
- nonvirtual void() rise6 = [$rise6, rise7] { };
- nonvirtual void() rise7 = [$rise7, rise8] { };
- nonvirtual void() rise8 = [$rise8, rise9] { };
- nonvirtual void() rise9 = [$rise9, rise10] { };
- nonvirtual void() rise10 = [$rise10, rise11] { };
- nonvirtual void() rise11 = [$rise11, rise12] { };
- nonvirtual void() rise12 = [$rise12, rise13] { };
- nonvirtual void() rise13 = [$rise13, rise14] { };
- nonvirtual void() rise14 = [$rise14, rise15] { };
- nonvirtual void() rise15 = [$rise15, rise16] { };
- nonvirtual void() rise16 = [$rise16, rise17] { };
- nonvirtual void() rise17 = [$rise17, missile1] { };
+ void() boss2_rise3 = [$rise3, boss2_rise4] { };
+ void() boss2_rise4 = [$rise4, boss2_rise5] { };
+ void() boss2_rise5 = [$rise5, boss2_rise6] { };
+ void() boss2_rise6 = [$rise6, boss2_rise7] { };
+ void() boss2_rise7 = [$rise7, boss2_rise8] { };
+ void() boss2_rise8 = [$rise8, boss2_rise9] { };
+ void() boss2_rise9 = [$rise9, boss2_rise10] { };
+ void() boss2_rise10 = [$rise10, boss2_rise11] { };
+ void() boss2_rise11 = [$rise11, boss2_rise12] { };
+ void() boss2_rise12 = [$rise12, boss2_rise13] { };
+ void() boss2_rise13 = [$rise13, boss2_rise14] { };
+ void() boss2_rise14 = [$rise14, boss2_rise15] { };
+ void() boss2_rise15 = [$rise15, boss2_rise16] { };
+ void() boss2_rise16 = [$rise16, boss2_rise17] { };
+ void() boss2_rise17 = [$rise17, boss2_atk1] { };

//--------------------------------------------------------------
// Chthon Attack Lavaball
//--------------------------------------------------------------
- nonvirtual void() missile1 = [$attack1, missile2] { boss2_face (); };
- nonvirtual void() missile2 = [$attack2, missile3] { boss2_face (); };
- nonvirtual void() missile3 = [$attack3, missile4] { boss2_face (); };
- nonvirtual void() missile4 = [$attack4, missile5] { boss2_face (); };
- nonvirtual void() missile5 = [$attack5, missile6] { boss2_face (); };
- nonvirtual void() missile6 = [$attack6, missile7] { boss2_face (); };
- nonvirtual void() missile7 = [$attack7, missile8] { boss2_face (); };
- nonvirtual void() missile8 = [$attack8, missile9] { boss2_face (); };
- nonvirtual void() missile9 = [$attack9, missile10]
+ void() boss2_atk1 = [$attack1, boss2_atk2] { monster_boss2_face (); };
+ void() boss2_atk2 = [$attack2, boss2_atk3] { monster_boss2_face (); };
+ void() boss2_atk3 = [$attack3, boss2_atk4] { monster_boss2_face (); };
+ void() boss2_atk4 = [$attack4, boss2_atk5] { monster_boss2_face (); };
+ void() boss2_atk5 = [$attack5, boss2_atk6] { monster_boss2_face (); };
+ void() boss2_atk6 = [$attack6, boss2_atk7] { monster_boss2_face (); };
+ void() boss2_atk7 = [$attack7, boss2_atk8] { monster_boss2_face (); };
+ void() boss2_atk8 = [$attack8, boss2_atk9] { monster_boss2_face (); };
+ void() boss2_atk9 = [$attack9, boss2_atk10]
{
- this.attack_missile ('100 100 200');
+ monster_boss2_missile ('100 100 200');
};
- nonvirtual void() missile10 = [$attack10, missile11] { boss2_face (); };
- nonvirtual void() missile11 = [$attack11, missile12] { boss2_face (); };
- nonvirtual void() missile12 = [$attack12, missile13] { boss2_face (); };
- nonvirtual void() missile13 = [$attack13, missile14] { boss2_face (); };
- nonvirtual void() missile14 = [$attack14, missile15] { boss2_face (); };
- nonvirtual void() missile15 = [$attack15, missile16] { boss2_face (); };
- nonvirtual void() missile16 = [$attack16, missile17] { boss2_face (); };
- nonvirtual void() missile17 = [$attack17, missile18] { boss2_face (); };
- nonvirtual void() missile18 = [$attack18, missile19] { boss2_face (); };
- nonvirtual void() missile19 = [$attack19, missile20] { boss2_face (); };
- nonvirtual void() missile20 = [$attack20, missile21]
+ void() boss2_atk10 = [$attack10, boss2_atk11] { monster_boss2_face ();};
+ void() boss2_atk11 = [$attack11, boss2_atk12] { monster_boss2_face ();};
+ void() boss2_atk12 = [$attack12, boss2_atk13] { monster_boss2_face ();};
+ void() boss2_atk13 = [$attack13, boss2_atk14] { monster_boss2_face ();};
+ void() boss2_atk14 = [$attack14, boss2_atk15] { monster_boss2_face ();};
+ void() boss2_atk15 = [$attack15, boss2_atk16] { monster_boss2_face ();};
+ void() boss2_atk16 = [$attack16, boss2_atk17] { monster_boss2_face ();};
+ void() boss2_atk17 = [$attack17, boss2_atk18] { monster_boss2_face ();};
+ void() boss2_atk18 = [$attack18, boss2_atk19] { monster_boss2_face ();};
+ void() boss2_atk19 = [$attack19, boss2_atk20] { monster_boss2_face ();};
+ void() boss2_atk20 = [$attack20, boss2_atk21]
{
- attack_missile ('100 -100 200');
+ monster_boss2_missile ('100 -100 200');
};
- nonvirtual void() missile21 = [$attack21, missile22] { boss2_face (); };
- nonvirtual void() missile22 = [$attack22, missile23] { boss2_face (); };
- nonvirtual void() missile23 = [$attack23, missile1] { boss2_face (); };
+ void() boss2_atk21 = [$attack21, boss2_atk22] { monster_boss2_face ();};
+ void() boss2_atk22 = [$attack22, boss2_atk23] { monster_boss2_face ();};
+ void() boss2_atk23 = [$attack23, boss2_atk1] { monster_boss2_face (); };

//--------------------------------------------------------------
// Chthon Shock! A
//--------------------------------------------------------------
- nonvirtual void() shocka1 = [$shocka1, shocka2] { };
- nonvirtual void() shocka2 = [$shocka2, shocka3] { };
- nonvirtual void() shocka3 = [$shocka3, shocka4] { };
- nonvirtual void() shocka4 = [$shocka4, shocka5] { };
- nonvirtual void() shocka5 = [$shocka5, shocka6] { };
- nonvirtual void() shocka6 = [$shocka6, shocka7] { };
- nonvirtual void() shocka7 = [$shocka7, shocka8] { };
- nonvirtual void() shocka8 = [$shocka8, shocka9] { };
- nonvirtual void() shocka9 = [$shocka9, shocka10] { };
- nonvirtual void() shocka10 = [$shocka10, missile1] { };
+ void() boss2_shocka1 = [$shocka1, boss2_shocka2] { };
+ void() boss2_shocka2 = [$shocka2, boss2_shocka3] { };
+ void() boss2_shocka3 = [$shocka3, boss2_shocka4] { };
+ void() boss2_shocka4 = [$shocka4, boss2_shocka5] { };
+ void() boss2_shocka5 = [$shocka5, boss2_shocka6] { };
+ void() boss2_shocka6 = [$shocka6, boss2_shocka7] { };
+ void() boss2_shocka7 = [$shocka7, boss2_shocka8] { };
+ void() boss2_shocka8 = [$shocka8, boss2_shocka9] { };
+ void() boss2_shocka9 = [$shocka9, boss2_shocka10] { };
+ void() boss2_shocka10 = [$shocka10, boss2_atk1] { };

//--------------------------------------------------------------
// Chthon Shock! B
//--------------------------------------------------------------
- nonvirtual void() shockb1 = [$shockb1, shockb2] { };
- nonvirtual void() shockb2 = [$shockb2, shockb3] { };
- nonvirtual void() shockb3 = [$shockb3, shockb4] { };
- nonvirtual void() shockb4 = [$shockb4, shockb5] { };
- nonvirtual void() shockb5 = [$shockb5, shockb6] { };
- nonvirtual void() shockb6 = [$shockb6, shockb7] { };
- nonvirtual void() shockb7 = [$shockb1, shockb8] { };
- nonvirtual void() shockb8 = [$shockb2, shockb9] { };
- nonvirtual void() shockb9 = [$shockb3, shockb10] { };
- nonvirtual void() shockb10 = [$shockb4, missile1] { };
+ void() boss2_shockb1 = [$shockb1, boss2_shockb2] { };
+ void() boss2_shockb2 = [$shockb2, boss2_shockb3] { };
+ void() boss2_shockb3 = [$shockb3, boss2_shockb4] { };
+ void() boss2_shockb4 = [$shockb4, boss2_shockb5] { };
+ void() boss2_shockb5 = [$shockb5, boss2_shockb6] { };
+ void() boss2_shockb6 = [$shockb6, boss2_shockb7] { };
+ void() boss2_shockb7 = [$shockb1, boss2_shockb8] { };
+ void() boss2_shockb8 = [$shockb2, boss2_shockb9] { };
+ void() boss2_shockb9 = [$shockb3, boss2_shockb10] { };
+ void() boss2_shockb10 = [$shockb4, boss2_atk1] { };

//--------------------------------------------------------------
// Chthon Shock! C
//--------------------------------------------------------------
- nonvirtual void() shockc1 = [$shockc1, shockc2] { };
- nonvirtual void() shockc2 = [$shockc2, shockc3] { };
- nonvirtual void() shockc3 = [$shockc3, shockc4] { };
- nonvirtual void() shockc4 = [$shockc4, shockc5] { };
- nonvirtual void() shockc5 = [$shockc5, shockc6] { };
- nonvirtual void() shockc6 = [$shockc6, shockc7] { };
- nonvirtual void() shockc7 = [$shockc7, shockc8] { };
- nonvirtual void() shockc8 = [$shockc8, shockc9] { };
- nonvirtual void() shockc9 = [$shockc9, shockc10] { };
- nonvirtual void() shockc10 = [$shockc10, death1] { };
+ void() boss2_shockc1 = [$shockc1, boss2_shockc2] { };
+ void() boss2_shockc2 = [$shockc2, boss2_shockc3] { };
+ void() boss2_shockc3 = [$shockc3, boss2_shockc4] { };
+ void() boss2_shockc4 = [$shockc4, boss2_shockc5] { };
+ void() boss2_shockc5 = [$shockc5, boss2_shockc6] { };
+ void() boss2_shockc6 = [$shockc6, boss2_shockc7] { };
+ void() boss2_shockc7 = [$shockc7, boss2_shockc8] { };
+ void() boss2_shockc8 = [$shockc8, boss2_shockc9] { };
+ void() boss2_shockc9 = [$shockc9, boss2_shockc10] { };
+ void() boss2_shockc10 = [$shockc10, boss2_death1] { };

//--------------------------------------------------------------
// Chthon Pain state
//--------------------------------------------------------------
- nonvirtual void() pain1 = [$shocka1, pain2] { };
- nonvirtual void() pain2 = [$shocka2, pain3] { };
- nonvirtual void() pain3 = [$shocka3, pain4] { };
- nonvirtual void() pain4 = [$shocka4, pain5]
+ void() boss2_pain1 = [$shocka1, boss2_pain2] { };
+ void() boss2_pain2 = [$shocka2, boss2_pain3] { };
+ void() boss2_pain3 = [$shocka3, boss2_pain4] { };
+ void() boss2_pain4 = [$shocka4, boss2_pain5]
{
// pain noise
- sound_pain (this, CHAN_VOICE, "boss1/pain.wav", 1, ATTN_NORM);
+ sound_pain (self, CHAN_VOICE, "boss1/pain.wav", 1, ATTN_NORM);
};
- nonvirtual void() pain5 = [$shocka5, pain6] { };
- nonvirtual void() pain6 = [$shocka6, pain7] { };
- nonvirtual void() pain7 = [$shocka7, pain8] { };
- nonvirtual void() pain8 = [$shocka8, pain9] { };
- nonvirtual void() pain9 = [$shocka9, missile1]
+ void() boss2_pain5 = [$shocka5, boss2_pain6] { };
+ void() boss2_pain6 = [$shocka6, boss2_pain7] { };
+ void() boss2_pain7 = [$shocka7, boss2_pain8] { };
+ void() boss2_pain8 = [$shocka8, boss2_pain9] { };
+ void() boss2_pain9 = [$shocka9, boss2_atk1]
{
// auto shoot a lavaball (by advancing to next think state)
};
@@ -395,30 +453,30 @@ class monster_boss2: base_monster
//--------------------------------------------------------------
// Chthon Death state
//--------------------------------------------------------------
- nonvirtual void() death1 = [$death1, death2]
+ void() boss2_death1 = [$death1, boss2_death2]
{
- sound_death (this, CHAN_VOICE, "boss1/death.wav", 1, ATTN_NORM);
+ sound_death (self, CHAN_VOICE, "boss1/death.wav", 1, ATTN_NORM);
};
- nonvirtual void() death2 = [$death2, death3] { };
- nonvirtual void() death3 = [$death3, death4] { };
- nonvirtual void() death4 = [$death4, death5] { };
- nonvirtual void() death5 = [$death5, death6] { };
- nonvirtual void() death6 = [$death6, death7] { };
- nonvirtual void() death7 = [$death7, death8] { };
- nonvirtual void() death8 = [$death8, death9] { };
- nonvirtual void() death9 = [$death9, death10]
+ void() boss2_death2 = [$death2, boss2_death3] { };
+ void() boss2_death3 = [$death3, boss2_death4] { };
+ void() boss2_death4 = [$death4, boss2_death5] { };
+ void() boss2_death5 = [$death5, boss2_death6] { };
+ void() boss2_death6 = [$death6, boss2_death7] { };
+ void() boss2_death7 = [$death7, boss2_death8] { };
+ void() boss2_death8 = [$death8, boss2_death9] { };
+ void() boss2_death9 = [$death9, boss2_death10]
{
- sound_move (this, CHAN_BODY, "boss1/out1.wav", 1, ATTN_NORM);
- if !(this.spawnflags & NO_LAVASPLASH)
+ sound_move (self, CHAN_BODY, "boss1/out1.wav", 1, ATTN_NORM);
+ if !(self.spawnflags & NO_LAVASPLASH)
{
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);
+ WriteCoord (MSG_BROADCAST, self.origin_x);
+ WriteCoord (MSG_BROADCAST, self.origin_y);
+ WriteCoord (MSG_BROADCAST, self.origin_z);
}
};
- nonvirtual void() death10 = [$death9, death10]
+ void() boss2_death10 = [$death9, boss2_death10]
{
// unlike the code for the original monster_boss, this
// function doesn't need to increment killed_monsters
@@ -426,7 +484,7 @@ class monster_boss2: base_monster
// by regular damage and has FL_MONSTER, so the Killed()
// function (in combat.qc) will already have taken care
// of those things -- iw
- remove (this);
+ remove (self);
};

//==============================================================
@@ -436,30 +494,30 @@ class monster_boss2: base_monster
//--------------------------------------------------------------
// boss2_pain_go
//--------------------------------------------------------------
- virtual void(entity attacker, float damage) do_damage =
+ void(entity attacker, float damage) monster_boss2_pain =
{
- if (this.pain_finished > time)
+ if (self.pain_finished > time)
return;

- this.pain1 ();
- this.pain_finished = time + 4;
+ boss2_pain1 ();
+ self.pain_finished = time + 4;
};

//--------------------------------------------------------------
// boss2_die
//--------------------------------------------------------------
- virtual void() do_destroy =
+ void() monster_boss2_destroy =
{
- if (this.health < -50)
+ if (self.health < -50)
{
// if health under -15
- this.gib_boss2 ();
+ monster_boss2_gib ();
return;
}
else
{
// otherwise normal death
- this.death1 ();
+ boss2_death1 ();
return;
}
};
@@ -467,50 +525,50 @@ class monster_boss2: base_monster
//--------------------------------------------------------------
// boss2_awake
//--------------------------------------------------------------
- virtual void() use =
+ void() monster_boss2_use =
{
- this.solid = SOLID_SLIDEBOX;
- this.movetype = MOVETYPE_STEP;
- this.takedamage = DAMAGE_AIM;
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+ self.takedamage = DAMAGE_AIM;

- body_model ("progs/boss.mdl");
- // setmodel (this, "progs/boss.mdl");
- setsize (this, '-128 -128 -24', '128 128 256');
+ body_model (self, "progs/boss.mdl");
+ // setmodel (self, "progs/boss.mdl");
+ setsize (self, '-128 -128 -24', '128 128 256');

- if (!this.health)
+ if (!self.health)
{
if (skill == 0)
- this.health = 1000;
+ self.health = 1000;
else
- this.health = 3000;
+ self.health = 3000;
}

- // note that this.th_run has to be set in order to avoid a
+ // note that self.th_run has to be set in order to avoid a
// "NULL function" Host_Error in the case where T_Damage()
// calls FoundTarget(), which calls HuntTarget(), which
- // uses this.th_run as the next this.think -- iw
- this.think_run = this.missile1;
+ // uses self.th_run as the next self.think -- iw
+ self.think_run = boss2_atk1;

- this.th_pain = this.do_damage;
- this.th_die = this.do_destroy;
+ self.pain = monster_boss2_pain;
+ self.destroy = monster_boss2_destroy;

// give the boss a couple of seconds to finish rising
// before allowing it to go into its pain animation -- iw
- this.pain_finished = time + 2;
+ self.pain_finished = time + 2;

- this.enemy = activator;
+ self.enemy = activator;

- if !(this.spawnflags & NO_LAVASPLASH)
+ if !(self.spawnflags & NO_LAVASPLASH)
{
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);
+ WriteCoord (MSG_BROADCAST, self.origin_x);
+ WriteCoord (MSG_BROADCAST, self.origin_y);
+ WriteCoord (MSG_BROADCAST, self.origin_z);
}

- this.yaw_speed = 20;
- this.rise1 ();
+ self.yaw_speed = 20;
+ boss2_rise1 ();
};

//==============================================================
@@ -518,43 +576,52 @@ class monster_boss2: base_monster
//==============================================================

//--------------------------------------------------------------
- virtual void() init_spawned =
+ void(entity e) monster_boss2_init =
{
- if (this.spawnflags & I_AM_TURRET)
+ if (e.spawnflags & I_AM_TURRET)
objerror ("Incompatible spawnflag: TURRET_MODE\n");

if (deathmatch)
{
- remove (this);
+ remove (e);
return;
}

+ e.classname = "monster_boss2";
+ e.classtype = CT_MONSTER_BOSS_CHTHON2;
+ base_monster_init (e);
+
// custom sounds and models -- dumptruck_ds
- precache_body_model ("progs/boss.mdl");
- precache_head_model ("progs/h_boss.mdl");
+ precache_body_model (e, "progs/boss.mdl");
+ precache_head_model (e, "progs/h_boss.mdl");
precache_model ("progs/lavaball.mdl");
// precache_model ("progs/boss.mdl");
precache_model ("progs/h_boss.mdl");

precache_sound ("weapons/rocket1i.wav");
- precache_sound_move ("boss1/out1.wav");
- precache_sound_sight ("boss1/sight1.wav");
+ precache_sound_move (e, "boss1/out1.wav");
+ precache_sound_sight (e, "boss1/sight1.wav");
precache_sound ("misc/power.wav");
- precache_sound_attack ("boss1/throw.wav");
- precache_sound_pain ("boss1/pain.wav");
- precache_sound_death ("boss1/death.wav");
+ precache_sound_attack (e, "boss1/throw.wav");
+ precache_sound_pain (e, "boss1/pain.wav");
+ precache_sound_death (e, "boss1/death.wav");

- precache_gib1 ("progs/gib1.mdl");
- precache_gib2 ("progs/gib2.mdl");
- precache_gib3 ("progs/gib3.mdl");
+ precache_gib1 (e, "progs/gib1.mdl");
+ precache_gib2 (e, "progs/gib2.mdl");
+ precache_gib3 (e, "progs/gib3.mdl");

total_monsters = total_monsters + 1;
- this.flags = FL_MONSTER;
+ e.flags = FL_MONSTER;
+ e.use = monster_boss2_use;
};

//--------------------------------------------------------------
void() monster_boss2 =
{
- this.classtype = CT_MONSTER_BOSS_CHTHON2;
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ monster_boss2_init (self);
};
-};
+// };

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

Diff qc/monsters/demon.qc

diff --git a/qc/monsters/demon.qc b/qc/monsters/demon.qc
index bfeb343..b53b21b 100644
--- a/qc/monsters/demon.qc
+++ b/qc/monsters/demon.qc
@@ -3,17 +3,48 @@
//==============================================================================

//======================================================================
-// constants -- demon touch states
+// forward declarations
//======================================================================
-enum
-{
- DEMON_TOUCH_DEFAULT,
- DEMON_TOUCH_JUMP
-};
+
+// monster_demon1
+// float() monster_demon1_checkmelee; // AI & attacks
+float() monster_demon1_checkjump;
+float() monster_demon1_checkattack;
+void() monster_demon1_sightsound;
+void(float side) monster_demon1_melee; // thinking & animation below
+void() dem1_stand1; void() dem1_stand2; void() dem1_stand3; void() dem1_stand4;
+void() dem1_stand5; void() dem1_stand6; void() dem1_stand7; void() dem1_stand8;
+void() dem1_stand9; void() dem1_stand10; void() dem1_stand11;
+void() dem1_stand12; void() dem1_stand13;
+void() dem1_walk1; void() dem1_walk2; void() dem1_walk3; void() dem1_walk4;
+void() dem1_walk5; void() dem1_walk6; void() dem1_walk7; void() dem1_walk8;
+void() dem1_run1; void() dem1_run2; void() dem1_run3; void() dem1_run4;
+void() dem1_run5; void() dem1_run6;
+void() dem1_jump1; void() dem1_jump2; void() dem1_jump3; void() dem1_jump4;
+void() dem1_jump5; void() dem1_jump6; void() dem1_jump7; void() dem1_jump8;
+void() dem1_jump9; void() dem1_jump10; void() dem1_jump11; void() dem1_jump12;
+void() dem1_atk1; void() dem1_atk2; void() dem1_atk3; void() dem1_atk4;
+void() dem1_atk5; void() dem1_atk6; void() dem1_atk7; void() dem1_atk8;
+void() dem1_atk9; void() dem1_atk10; void() dem1_atk11; void() dem1_atk12;
+void() dem1_atk13; void() dem1_atk14; void() dem1_atk15;
+void() dem1_pain1; void() dem1_pain2; void() dem1_pain3; void() dem1_pain4;
+void() dem1_pain5; void() dem1_pain6;
+void() dem1_die1; void() dem1_die2; void() dem1_die3; void() dem1_die4;
+void() dem1_die5; void() dem1_die6; void() dem1_die7; void() dem1_die8;
+void() dem1_die9;
+void(entity attacker, float damage) monster_demon1_pain; // interaction
+void() monster_demon1_destroy;
+void() monster_demon1_touch;
+void(entity e) monster_demon1_init; // initialization
+void() monster_demon1;
+
+// monster_dead_demon
+void() monster_dead_demon;

//======================================================================
// frame macros
//======================================================================
+
$cd id1/models/demon3
$scale 0.8
$origin 0 0 24
@@ -37,6 +68,8 @@ $frame death1 death2 death3 death4 death5 death6 death7 death8 death9
$frame attacka1 attacka2 attacka3 attacka4 attacka5 attacka6 attacka7 attacka8
$frame attacka9 attacka10 attacka11 attacka12 attacka13 attacka14 attacka15

+//------------------------------------------------------------------------------
+
/*QUAKED monster_demon1 (1 0 0) (-32 -32 -24) (32 32 64) AMBUSH X X TRIGGER_SPAWNED X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ("progs/demon.mdl");
@@ -93,21 +126,20 @@ obit_method(string) : "When used with obit_name, will set part of the text for a
damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by this number (e.g. 4 = Quad damage)"

*/
-class monster_demon1: base_walkmonster
-{
- float touch_state;
-
+//----------------------------------------------------------------------
+// class monster_demon1: base_walkmonster
+// {
//--------------------------------------------------------------
// CheckDemonMelee
// Returns TRUE if a melee attack would hit right now
//--------------------------------------------------------------
/*
- float() CheckDemonMelee =
+ float() monster_demon1_checkmelee =
{
if (enemy_range == RANGE_MELEE)
{
// FIXME: check canreach
- this.attack_state = AS_MELEE;
+ self.attack_state = AS_MELEE;
return TRUE;
}
return FALSE;
@@ -117,26 +149,26 @@ class monster_demon1: base_walkmonster
//--------------------------------------------------------------
// CheckDemonJump
//--------------------------------------------------------------
- nonvirtual float() check_jump =
+ float() monster_demon1_checkjump =
{
local vector dist;
local float d;

- if (this.origin_z + this.mins_z >
- this.enemy.origin_z + this.enemy.mins_z +
- 0.75 * this.enemy.size_z)
+ if (self.origin_z + self.mins_z >
+ self.enemy.origin_z + self.enemy.mins_z +
+ 0.75 * self.enemy.size_z)
{
return FALSE;
}

- if (this.origin_z + this.maxs_z <
- this.enemy.origin_z + this.enemy.mins_z +
- 0.25 * this.enemy.size_z)
+ if (self.origin_z + self.maxs_z <
+ self.enemy.origin_z + self.enemy.mins_z +
+ 0.25 * self.enemy.size_z)
{
return FALSE;
}

- dist = this.enemy.origin - this.origin;
+ dist = self.enemy.origin - self.origin;
dist_z = 0;

d = vlen (dist);
@@ -156,20 +188,20 @@ class monster_demon1: base_walkmonster
//--------------------------------------------------------------
// DemonCheckAttack
//--------------------------------------------------------------
- virtual float() ai_checkattack =
+ float() monster_demon1_checkattack =
{
// if close enough for slashing, go for it
// if (CheckDemonMelee())
if (enemy_range == RANGE_MELEE)
{
- this.attack_state = AS_MELEE;
+ self.attack_state = AS_MELEE;
return TRUE;
}

- if (this.check_jump())
+ if (monster_demon1_checkjump())
{
- this.attack_state = AS_MISSILE;
- sound_attack (this, CHAN_VOICE, "demon/djump.wav",
+ self.attack_state = AS_MISSILE;
+ sound_attack (self, CHAN_VOICE, "demon/djump.wav",
1, ATTN_NORM);
return TRUE;
}
@@ -178,302 +210,286 @@ class monster_demon1: base_walkmonster
};

//--------------------------------------------------------------
- virtual void() ai_sightsound =
+ void() monster_demon1_sightsound =
{
- sound_sight (this, CHAN_VOICE, "demon/sight2.wav",
+ sound_sight (self, CHAN_VOICE, "demon/sight2.wav",
1, ATTN_NORM);
};

//--------------------------------------------------------------
- virtual void(entity attacker, float damage) do_damage =
- {
- if (this.touch_state == DEMON_TOUCH_JUMP)
- return;
-
- if (this.pain_finished > time)
- return;
-
- this.pain_finished = time + 1;
- sound_pain (this, CHAN_VOICE, "demon/dpain1.wav", 1, ATTN_NORM);
-
- if (random() * 200 > damage)
- // didn't flinch
- return;
-
- this.pain1 ();
- };
-
- //--------------------------------------------------------------
- virtual void() do_destroy =
- {
- // check for gib
- if (this.health < -80)
- {
- sound (this, CHAN_VOICE, "player/udeath.wav",
- 1, ATTN_NORM);
- if (this.mdl_head != "")
- {
- ThrowHead (this.mdl_head, this.health);
- }
- else
- {
- ThrowHead ("progs/h_demon.mdl", this.health);
- }
- // ThrowHead ("progs/h_demon.mdl", this.health);
- // ThrowGib ("progs/gib1.mdl", this.health);
- // ThrowGib ("progs/gib1.mdl", this.health);
- // ThrowGib ("progs/gib1.mdl", this.health);
- if (this.mdl_gib1 != "")
- {
- // custom models -- dumptruck_ds
- ThrowGib (this.mdl_gib1, this.health);
- }
- else
- {
- ThrowGib ("progs/gib1.mdl", this.health);
- }
- if (this.mdl_gib2 != "")
- {
- ThrowGib (this.mdl_gib2, this.health);
- }
- else
- {
- ThrowGib ("progs/gib1.mdl", this.health);
- }
- if (this.mdl_gib3 != "")
- {
- ThrowGib (this.mdl_gib3, this.health);
- }
- else
- {
- ThrowGib ("progs/gib1.mdl", this.health);
- }
- base_item::drop_stuff (this);
- return;
- }
-
- // regular death
- base_item::drop_stuff (this);
- this.die1 ();
- };
-
- //--------------------------------------------------------------
- nonvirtual void(float side) melee =
+ void(float side) monster_demon1_melee =
{
local float ldmg;
local vector delta;

ai_face ();
// allow a little closing
- walkmove (this.ideal_yaw, 12);
+ walkmove (self.ideal_yaw, 12);

- delta = this.enemy.origin - this.origin;
+ delta = self.enemy.origin - self.origin;

if (vlen(delta) > 100)
return;
- if (!this.can_damage(this, this.enemy))
+ if (!can_damage(self, self.enemy))
return;

- sound_hit (this, CHAN_WEAPON, "demon/dhit2.wav", 1, ATTN_NORM);
+ sound_hit (self, CHAN_WEAPON, "demon/dhit2.wav", 1, ATTN_NORM);
ldmg = 10 + 5 * random ();
- this.t_damage2 (this.enemy, this, this, ldmg);
+ t_damage2 (self.enemy, self, self, ldmg);

- makevectors (this.angles);
- SpawnMeatSpray (this.origin + v_forward * 16, side * v_right);
+ makevectors (self.angles);
+ spawn_meatspray (self.origin + v_forward * 16, side * v_right);
};

//--------------------------------------------------------------
// Fiend stand functions
//--------------------------------------------------------------
- nonvirtual void() stand1 = [$stand1, stand2] { ai_stand (); };
- nonvirtual void() stand2 = [$stand2, stand3] { ai_stand (); };
- nonvirtual void() stand3 = [$stand3, stand4] { ai_stand (); };
- nonvirtual void() stand4 = [$stand4, stand5] { ai_stand (); };
- nonvirtual void() stand5 = [$stand5, stand6] { ai_stand (); };
- nonvirtual void() stand6 = [$stand6, stand7] { ai_stand (); };
- nonvirtual void() stand7 = [$stand7, stand8] { ai_stand (); };
- nonvirtual void() stand8 = [$stand8, stand9] { ai_stand (); };
- nonvirtual void() stand9 = [$stand9, stand10] { ai_stand (); };
- nonvirtual void() stand10 = [$stand10, stand11] { ai_stand (); };
- nonvirtual void() stand11 = [$stand11, stand12] { ai_stand (); };
- nonvirtual void() stand12 = [$stand12, stand13] { ai_stand (); };
- nonvirtual void() stand13 = [$stand13, stand1] { ai_stand (); };
+ void() dem1_stand1 = [$stand1, dem1_stand2] { ai_stand (); };
+ void() dem1_stand2 = [$stand2, dem1_stand3] { ai_stand (); };
+ void() dem1_stand3 = [$stand3, dem1_stand4] { ai_stand (); };
+ void() dem1_stand4 = [$stand4, dem1_stand5] { ai_stand (); };
+ void() dem1_stand5 = [$stand5, dem1_stand6] { ai_stand (); };
+ void() dem1_stand6 = [$stand6, dem1_stand7] { ai_stand (); };
+ void() dem1_stand7 = [$stand7, dem1_stand8] { ai_stand (); };
+ void() dem1_stand8 = [$stand8, dem1_stand9] { ai_stand (); };
+ void() dem1_stand9 = [$stand9, dem1_stand10] { ai_stand (); };
+ void() dem1_stand10 = [$stand10, dem1_stand11] { ai_stand (); };
+ void() dem1_stand11 = [$stand11, dem1_stand12] { ai_stand (); };
+ void() dem1_stand12 = [$stand12, dem1_stand13] { ai_stand (); };
+ void() dem1_stand13 = [$stand13, dem1_stand1] { ai_stand (); };

//--------------------------------------------------------------
// Fiend walk functions
//--------------------------------------------------------------
- nonvirtual void() walk1 = [$walk1, walk2]
+ void() dem1_walk1 = [$walk1, dem1_walk2]
{
if (random() < 0.2)
- sound_idle (this, CHAN_VOICE, "demon/idle1.wav",
+ sound_idle (self, CHAN_VOICE, "demon/idle1.wav",
1, ATTN_IDLE);
ai_walk (8);
};
- nonvirtual void() walk2 = [$walk2, walk3] { ai_walk (6); };
- nonvirtual void() walk3 = [$walk3, walk4] { ai_walk (6); };
- nonvirtual void() walk4 = [$walk4, walk5] { ai_walk (7); };
- nonvirtual void() walk5 = [$walk5, walk6] { ai_walk (4); };
- nonvirtual void() walk6 = [$walk6, walk7] { ai_walk (6); };
- nonvirtual void() walk7 = [$walk7, walk8] { ai_walk (10); };
- nonvirtual void() walk8 = [$walk8, walk1] { ai_walk (10); };
+ void() dem1_walk2 = [$walk2, dem1_walk3] { ai_walk (6); };
+ void() dem1_walk3 = [$walk3, dem1_walk4] { ai_walk (6); };
+ void() dem1_walk4 = [$walk4, dem1_walk5] { ai_walk (7); };
+ void() dem1_walk5 = [$walk5, dem1_walk6] { ai_walk (4); };
+ void() dem1_walk6 = [$walk6, dem1_walk7] { ai_walk (6); };
+ void() dem1_walk7 = [$walk7, dem1_walk8] { ai_walk (10); };
+ void() dem1_walk8 = [$walk8, dem1_walk1] { ai_walk (10); };

//--------------------------------------------------------------
// Fiend run functions
//--------------------------------------------------------------
- nonvirtual void() run1 = [$run1, run2]
+ void() dem1_run1 = [$run1, dem1_run2]
{
if (random() < 0.2)
- sound_idle (this, CHAN_VOICE, "demon/idle1.wav",
+ sound_idle (self, CHAN_VOICE, "demon/idle1.wav",
1, ATTN_IDLE);
ai_run (20);
};
- nonvirtual void() run2 = [$run2, run3] { ai_run (15); };
- nonvirtual void() run3 = [$run3, run4] { ai_run (36); };
- nonvirtual void() run4 = [$run4, run5] { ai_run (20); };
- nonvirtual void() run5 = [$run5, run6] { ai_run (15); };
- nonvirtual void() run6 = [$run6, run1] { ai_run (36); };
+ void() dem1_run2 = [$run2, dem1_run3] { ai_run (15); };
+ void() dem1_run3 = [$run3, dem1_run4] { ai_run (36); };
+ void() dem1_run4 = [$run4, dem1_run5] { ai_run (20); };
+ void() dem1_run5 = [$run5, dem1_run6] { ai_run (15); };
+ void() dem1_run6 = [$run6, dem1_run1] { ai_run (36); };

//--------------------------------------------------------------
// Fiend jump functions
//--------------------------------------------------------------
- nonvirtual void() jump1 = [$leap1, jump2] { ai_face (); };
- nonvirtual void() jump2 = [$leap2, jump3] { ai_face (); };
- nonvirtual void() jump3 = [$leap3, jump4] { ai_face (); };
- nonvirtual void() jump4 = [$leap4, jump5]
+ void() dem1_jump1 = [$leap1, dem1_jump2] { ai_face (); };
+ void() dem1_jump2 = [$leap2, dem1_jump3] { ai_face (); };
+ void() dem1_jump3 = [$leap3, dem1_jump4] { ai_face (); };
+ void() dem1_jump4 = [$leap4, dem1_jump5]
{
ai_face ();
// fix for instakill bug -- dumptruck_ds
- this.worldtype = 0;
- this.touch_state = DEMON_TOUCH_JUMP;
- makevectors (this.angles);
- this.origin_z = this.origin_z + 1;
- this.velocity = v_forward * 600 + '0 0 250';
- if (this.flags & FL_ONGROUND)
- this.flags = this.flags - FL_ONGROUND;
+ self.worldtype = 0;
+ self.touch = monster_demon1_touch;
+ makevectors (self.angles);
+ self.origin_z = self.origin_z + 1;
+ self.velocity = v_forward * 600 + '0 0 250';
+ if (self.flags & FL_ONGROUND)
+ self.flags = self.flags - FL_ONGROUND;
};
- nonvirtual void() jump5 = [$leap5, jump6] {};
- nonvirtual void() jump6 = [$leap6, jump7] {};
- nonvirtual void() jump7 = [$leap7, jump8] {};
- nonvirtual void() jump8 = [$leap8, jump9] {};
- nonvirtual void() jump9 = [$leap9, jump10] {};
- nonvirtual void() jump10 = [$leap10, jump1]
+ void() dem1_jump5 = [$leap5, dem1_jump6] {};
+ void() dem1_jump6 = [$leap6, dem1_jump7] {};
+ void() dem1_jump7 = [$leap7, dem1_jump8] {};
+ void() dem1_jump8 = [$leap8, dem1_jump9] {};
+ void() dem1_jump9 = [$leap9, dem1_jump10] {};
+ void() dem1_jump10 = [$leap10, dem1_jump1]
{
// if three seconds pass, assume demon is stuck and jump again
- this.nextthink = time + 3;
+ self.nextthink = time + 3;
};
- nonvirtual void() jump11 = [$leap11, jump12] {};
- nonvirtual void() jump12 = [$leap12, run1] {};
+ void() dem1_jump11 = [$leap11, dem1_jump12] {};
+ void() dem1_jump12 = [$leap12, dem1_run1] {};

//--------------------------------------------------------------
// Fiend attack functions
//--------------------------------------------------------------
- nonvirtual void() atta1 = [$attacka1, atta2] { ai_charge (4); };
- nonvirtual void() atta2 = [$attacka2, atta3] { ai_charge (0); };
- nonvirtual void() atta3 = [$attacka3, atta4] { ai_charge (0); };
- nonvirtual void() atta4 = [$attacka4, atta5] { ai_charge (1); };
- nonvirtual void() atta5 = [$attacka5, atta6]
+ void() dem1_atk1 = [$attacka1, dem1_atk2] { ai_charge (4); };
+ void() dem1_atk2 = [$attacka2, dem1_atk3] { ai_charge (0); };
+ void() dem1_atk3 = [$attacka3, dem1_atk4] { ai_charge (0); };
+ void() dem1_atk4 = [$attacka4, dem1_atk5] { ai_charge (1); };
+ void() dem1_atk5 = [$attacka5, dem1_atk6]
{
ai_charge (2);
- this.melee (200);
+ monster_demon1_melee (200);
+ };
+ void() dem1_atk6 = [$attacka6, dem1_atk7] { ai_charge (1); };
+ void() dem1_atk7 = [$attacka7, dem1_atk8] { ai_charge (6); };
+ void() dem1_atk8 = [$attacka8, dem1_atk9] { ai_charge (8); };
+ void() dem1_atk9 = [$attacka9, dem1_atk10] { ai_charge (4); };
+ void() dem1_atk10 = [$attacka10, dem1_atk11] { ai_charge (2); };
+ void() dem1_atk11 = [$attacka11, dem1_atk12]
+ {
+ monster_demon1_melee (-200);
};
- nonvirtual void() atta6 = [$attacka6, atta7] { ai_charge (1); };
- nonvirtual void() atta7 = [$attacka7, atta8] { ai_charge (6); };
- nonvirtual void() atta8 = [$attacka8, atta9] { ai_charge (8); };
- nonvirtual void() atta9 = [$attacka9, atta10] { ai_charge (4); };
- nonvirtual void() atta10 = [$attacka10, atta11] { ai_charge (2); };
- nonvirtual void() atta11 = [$attacka11, atta12] { this.melee (-200); };
- nonvirtual void() atta12 = [$attacka12, atta13] { ai_charge (5); };
- nonvirtual void() atta13 = [$attacka13, atta14] { ai_charge (8); };
- nonvirtual void() atta14 = [$attacka14, atta15] { ai_charge (4); };
- nonvirtual void() atta15 = [$attacka15, run1] { ai_charge (4); };
+ void() dem1_atk12 = [$attacka12, dem1_atk13] { ai_charge (5); };
+ void() dem1_atk13 = [$attacka13, dem1_atk14] { ai_charge (8); };
+ void() dem1_atk14 = [$attacka14, dem1_atk15] { ai_charge (4); };
+ void() dem1_atk15 = [$attacka15, dem1_run1] { ai_charge (4); };

//--------------------------------------------------------------
// Fiend pain states
//--------------------------------------------------------------
- nonvirtual void() pain1 = [$pain1, pain2] { };
- nonvirtual void() pain2 = [$pain2, pain3] { };
- nonvirtual void() pain3 = [$pain3, pain4] { };
- nonvirtual void() pain4 = [$pain4, pain5] { };
- nonvirtual void() pain5 = [$pain5, pain6] { };
- nonvirtual void() pain6 = [$pain6, run1] { };
+ void() dem1_pain1 = [$pain1, dem1_pain2] { };
+ void() dem1_pain2 = [$pain2, dem1_pain3] { };
+ void() dem1_pain3 = [$pain3, dem1_pain4] { };
+ void() dem1_pain4 = [$pain4, dem1_pain5] { };
+ void() dem1_pain5 = [$pain5, dem1_pain6] { };
+ void() dem1_pain6 = [$pain6, dem1_run1] { };

//--------------------------------------------------------------
// Fiend death states
//--------------------------------------------------------------
- nonvirtual void() die1 = [$death1, die2]
+ void() dem1_die1 = [$death1, dem1_die2]
{
- sound_death (this, CHAN_VOICE, "demon/ddeath.wav",
+ sound_death (self, CHAN_VOICE, "demon/ddeath.wav",
1, ATTN_NORM);
};
- nonvirtual void() die2 = [$death2, die3] { };
- nonvirtual void() die3 = [$death3, die4] { };
- nonvirtual void() die4 = [$death4, die5] { };
- nonvirtual void() die5 = [$death5, die6] { };
- nonvirtual void() die6 = [$death6, die7]
+ void() dem1_die2 = [$death2, dem1_die3] { };
+ void() dem1_die3 = [$death3, dem1_die4] { };
+ void() dem1_die4 = [$death4, dem1_die5] { };
+ void() dem1_die5 = [$death5, dem1_die6] { };
+ void() dem1_die6 = [$death6, dem1_die7]
{
- this.solid = SOLID_NOT;
+ self.solid = SOLID_NOT;
};
- nonvirtual void() die7 = [$death7, die8] { };
- nonvirtual void() die8 = [$death8, die9] { };
- nonvirtual void() die9 = [$death9, die9] { };
+ void() dem1_die7 = [$death7, dem1_die8] { };
+ void() dem1_die8 = [$death8, dem1_die9] { };
+ void() dem1_die9 = [$death9, dem1_die9] { };

//==============================================================
// Interaction
//==============================================================

//--------------------------------------------------------------
- // Demon_JumpTouch
+ void(entity attacker, float damage) monster_demon1_pain =
+ {
+ if (self.touch == monster_demon1_touch)
+ return;
+
+ if (self.pain_finished > time)
+ return;
+
+ self.pain_finished = time + 1;
+ sound_pain (self, CHAN_VOICE, "demon/dpain1.wav", 1, ATTN_NORM);
+
+ if (random() * 200 > damage)
+ // didn't flinch
+ return;
+
+ dem1_pain1 ();
+ };
+
//--------------------------------------------------------------
- virtual void() touch =
+ void() monster_demon1_destroy =
{
- if (this.touch_state == DEMON_TOUCH_DEFAULT)
+ // check for gib
+ if (self.health < -80)
{
- super::touch ();
+ sound (self, CHAN_VOICE, "player/udeath.wav",
+ 1, ATTN_NORM);
+ if (self.mdl_head != "")
+ throw_head (self.mdl_head, self.health);
+ else
+ throw_head ("progs/h_demon.mdl", self.health);
+
+ // ThrowHead ("progs/h_demon.mdl", self.health);
+ // ThrowGib ("progs/gib1.mdl", self.health);
+ // ThrowGib ("progs/gib1.mdl", self.health);
+ // ThrowGib ("progs/gib1.mdl", self.health);
+
+ if (self.mdl_gib1 != "")
+ // custom models -- dumptruck_ds
+ throw_gib (self.mdl_gib1, self.health);
+ else
+ throw_gib ("progs/gib1.mdl", self.health);
+
+ if (self.mdl_gib2 != "")
+ throw_gib (self.mdl_gib2, self.health);
+ else
+ throw_gib ("progs/gib1.mdl", self.health);
+
+ if (self.mdl_gib3 != "")
+ throw_gib (self.mdl_gib3, self.health);
+ else
+ throw_gib ("progs/gib1.mdl", self.health);
+
+ base_item_drop_stuff (self);
return;
}

- // there's only two states (right now) so we're clear to
- // do Demon_JumpTouch now -- CEV
+ // regular death
+ base_item_drop_stuff (self);
+ dem1_die1 ();
+ };
+
+ //--------------------------------------------------------------
+ // Demon_JumpTouch
+ //--------------------------------------------------------------
+ void() monster_demon1_touch =
+ {
local float ldmg;

- if (this.health <= 0)
+ if (self.health <= 0)
return;

if (other.takedamage)
{
- if (vlen(this.velocity) > 400)
+ if (vlen(self.velocity) > 400)
{
- if !(this.worldtype)
+ if !(self.worldtype)
{
ldmg = 40 + 10 * random();
- this.t_damage2 (other, this, this, ldmg);
+ t_damage2 (other, self, self, ldmg);
// is the player still alive?
// Preach's instakill bug check
// - dumptruck_ds
if (other.health > 0)
- this.worldtype = 1;
+ self.worldtype = 1;
}
}
}

- if (!checkbottom(this))
+ if (!checkbottom(self))
{
- if (this.flags & FL_ONGROUND)
+ if (self.flags & FL_ONGROUND)
{
// jump randomly to not get hung up
// dprint ("popjump\n");
// 1998-09-16 Sliding/not-jumping on monsters/
// boxes/players fix by Maddes/Kryten start
- this.touch_state = DEMON_TOUCH_DEFAULT;
+ self.touch = base_monster_touch;
// 1998-09-16 Sliding/not-jumping on monsters/
// boxes/players fix by Maddes/Kryten end
- this.think = this.jump1;
- this.nextthink = time + 0.1;
+ self.think = dem1_jump1;
+ self.nextthink = time + 0.1;

- // this.velocity_x = (random() - 0.5) * 600;
- // this.velocity_y = (random() - 0.5) * 600;
- // this.velocity_z = 200;
- // this.flags = this.flags - FL_ONGROUND;
+ // self.velocity_x = (random() - 0.5) * 600;
+ // self.velocity_y = (random() - 0.5) * 600;
+ // self.velocity_z = 200;
+ // self.flags = self.flags - FL_ONGROUND;
}
// not on ground yet
return;
@@ -481,11 +497,11 @@ class monster_demon1: base_walkmonster

// 1998-09-16 Sliding/not-jumping on monsters/boxes/players
// fix by Maddes/Kryten start
- this.touch_state = DEMON_TOUCH_DEFAULT;
+ self.touch = base_monster_touch;
// 1998-09-16 Sliding/not-jumping on monsters/boxes/players
// fix by Maddes/Kryten end
- this.think = jump11;
- this.nextthink = time + 0.1;
+ self.think = dem1_jump11;
+ self.nextthink = time + 0.1;
};

//==============================================================
@@ -493,78 +509,85 @@ class monster_demon1: base_walkmonster
//==============================================================

//--------------------------------------------------------------
- virtual void() init_spawned =
+ void(entity e) monster_demon1_init =
{
- if (this.spawnflags & I_AM_TURRET)
+ if (e.spawnflags & I_AM_TURRET)
objerror ("Incompatible spawnflag: TURRET_MODE\n");

if (deathmatch)
{
- remove (this);
+ remove (e);
return;
}

+ e.classname = "monster_demon1";
+ e.classtype = CT_MONSTER_FIEND;
+
// dumptruck_ds custom_mdls
- precache_body_model ("progs/demon.mdl");
- precache_head_model ("progs/h_demon.mdl");
+ precache_body_model (e, "progs/demon.mdl");
+ precache_head_model (e, "progs/h_demon.mdl");

- precache_sound_death ("demon/ddeath.wav");
- precache_sound_hit ("demon/dhit2.wav");
- precache_sound_attack ("demon/djump.wav");
- precache_sound_pain ("demon/dpain1.wav");
- precache_sound_idle ("demon/idle1.wav");
- precache_sound_sight ("demon/sight2.wav");
+ precache_sound_death (e, "demon/ddeath.wav");
+ precache_sound_hit (e, "demon/dhit2.wav");
+ precache_sound_attack (e, "demon/djump.wav");
+ precache_sound_pain (e, "demon/dpain1.wav");
+ precache_sound_idle (e, "demon/idle1.wav");
+ precache_sound_sight (e, "demon/sight2.wav");

- precache_gib1 ("progs/gib1.mdl");
+ precache_gib1 (e, "progs/gib1.mdl");
// precache_gib2 ("progs/gib2.mdl");
// precache_gib3 ("progs/gib3.mdl");

- this.solid = SOLID_SLIDEBOX;
- this.movetype = MOVETYPE_STEP;
+ e.solid = SOLID_SLIDEBOX;
+ e.movetype = MOVETYPE_STEP;

- body_model ("progs/demon.mdl");
- // setmodel (this, "progs/demon.mdl");
+ body_model (e, "progs/demon.mdl");
+ // setmodel (e, "progs/demon.mdl");

- setsize (this, VEC_HULL2_MIN, VEC_HULL2_MAX);
+ setsize (e, VEC_HULL2_MIN, VEC_HULL2_MAX);

- if (!this.health)
+ if (!e.health)
// thanks RennyC -- dumptruck_ds
- this.health = 300;
-
- this.touch_state = DEMON_TOUCH_DEFAULT;
+ e.health = 300;

- this.think_stand = this.stand1;
- this.think_walk = this.walk1;
- this.think_run = this.run1;
+ e.checkattack = monster_demon1_checkattack;
+ e.sightsound = monster_demon1_sightsound;
+ e.think_stand = dem1_stand1;
+ e.think_walk = dem1_walk1;
+ e.think_run = dem1_run1;
// two attacks: melee, jump
- // this.think_melee = Demon_MeleeAttack;
- this.think_melee = this.atta1;
- this.think_missile = this.jump1;
+ // e.think_melee = Demon_MeleeAttack;
+ e.think_melee = dem1_atk1;
+ e.think_missile = dem1_jump1;

// Berserk test from
// http://celephais.net/board/view_thread.php?id=4&start=3465
// -- dumptruck_ds
- if !(this.berserk)
- this.th_pain = this.do_damage;
+ if !(e.berserk)
+ e.pain = monster_demon1_pain;
else
- this.th_pain = sub_nullpain;
+ e.pain = sub_nullpain;

- this.th_die = do_destroy;
+ e.destroy = monster_demon1_destroy;

// walkmonster_start
- super::init_spawned ();
+ base_walkmonster_init (e);
};

//--------------------------------------------------------------
void() monster_demon1 =
{
- this.classtype = CT_MONSTER_FIEND;
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ monster_demon1_init (self);
};
-};
+// };

-//==============================================================================
+//----------------------------------------------------------------------
// Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds
-//==============================================================================
+//----------------------------------------------------------------------

/*QUAKED monster_dead_demon (0 0.5 0.8) (-32 -32 -24) (32 32 64) SOLID X X X X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
@@ -573,8 +596,8 @@ class monster_demon1: base_walkmonster
*/
void() monster_dead_demon =
{
+ // new spawnflags for all entities -- iw
if (SUB_Inhibit())
- // new spawnflags for all entities -- iw
return;

precache_model ("progs/demon.mdl");

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

Diff qc/monsters/dog.qc

diff --git a/qc/monsters/dog.qc b/qc/monsters/dog.qc
index 3020712..8269691 100644
--- a/qc/monsters/dog.qc
+++ b/qc/monsters/dog.qc
@@ -3,17 +3,53 @@
//==============================================================================

//======================================================================
-// constants -- dog touch states
+// forward declarations
//======================================================================
-enum
-{
- DOG_TOUCH_DEFAULT,
- DOG_TOUCH_JUMP
-};
+
+// monster_dog
+// float() monster_dog_checkmelee; // attacks, alert sound
+float() monster_dog_checkjump;
+float() monster_dog_checkattack;
+void() monster_dog_sightsound;
+void() monster_dog_bite;
+void() dog_stand1; void() dog_stand2; // thinking & animation states
+void() dog_stand3; void() dog_stand4; void() dog_stand5; void() dog_stand6;
+void() dog_stand7; void() dog_stand8; void() dog_stand9;
+void() dog_walk1; void() dog_walk2; void() dog_walk3; void() dog_walk4;
+void() dog_walk5; void() dog_walk6; void() dog_walk7; void() dog_walk8;
+void() dog_run1; void() dog_run2; void() dog_run3; void() dog_run4;
+void() dog_run5; void() dog_run6; void() dog_run7; void() dog_run8;
+void() dog_run9; void() dog_run10; void() dog_run11; void() dog_run12;
+void() dog_atta1; void() dog_atta2; void() dog_atta3; void() dog_atta4;
+void() dog_atta5; void() dog_atta6; void() dog_atta7; void() dog_atta8;
+void() dog_leap1; void() dog_leap2; void() dog_leap3; void() dog_leap4;
+void() dog_leap5; void() dog_leap6; void() dog_leap7; void() dog_leap8;
+void() dog_leap9;
+void() dog_pain1; void() dog_pain2; void() dog_pain3; void() dog_pain4;
+void() dog_pain5; void() dog_pain6;
+void() dog_painb1; void() dog_painb2; void() dog_painb3; void() dog_painb4;
+void() dog_painb5; void() dog_painb6; void() dog_painb7; void() dog_painb8;
+void() dog_painb9; void() dog_painb10; void() dog_painb11; void() dog_painb12;
+void() dog_painb13; void() dog_painb14; void() dog_painb15; void() dog_painb16;
+void() dog_die1; void() dog_die2; void() dog_die3; void() dog_die4;
+void() dog_die5; void() dog_die6; void() dog_die7; void() dog_die8;
+void() dog_die9;
+void() dog_dieb1; void() dog_dieb2; void() dog_dieb3; void() dog_dieb4;
+void() dog_dieb5; void() dog_dieb6; void() dog_dieb7; void() dog_dieb8;
+void() dog_dieb9;
+void(entity attacker, float damage) monster_dog_pain; // interaction
+void() monster_dog_destroy;
+void() monster_dog_touch_jump;
+void(entity e) monster_dog_init; // initialization
+void() monster_dog;
+
+// monster_dead_dog
+void() monster_dead_dog;

//======================================================================
// frame macros
//======================================================================
+
$cd id1/models/dog
$origin 0 0 24
$base base
@@ -39,6 +75,8 @@ $frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9

$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8

+//------------------------------------------------------------------------------
+
/*QUAKED monster_dog (1 0 0) (-32 -32 -24) (32 32 40) AMBUSH X X TRIGGER_SPAWNED X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ("progs/dog.mdl");
@@ -96,21 +134,20 @@ obit_method(string) : "When used with obit_name, will set part of the text for a
damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by this number (e.g. 4 = Quad damage)"

*/
-class monster_dog: base_walkmonster
-{
- float touch_state;
-
+//----------------------------------------------------------------------
+// class monster_dog: base_walkmonster
+// {
//--------------------------------------------------------------
// CheckDogMelee
// Returns TRUE if a melee attack would hit right now
//--------------------------------------------------------------
/*
- nonvirtual float() check_melee =
+ float() monster_dog_checkmelee =
{
if (enemy_range == RANGE_MELEE)
{
// FIXME: check canreach
- this.attack_state = AS_MELEE;
+ self.attack_state = AS_MELEE;
return TRUE;
}
return FALSE;
@@ -120,26 +157,26 @@ class monster_dog: base_walkmonster
//--------------------------------------------------------------
// CheckDogJump
//--------------------------------------------------------------
- nonvirtual float() check_jump =
+ float() monster_dog_checkjump =
{
local vector dist;
local float d;

- if (this.origin_z + this.mins_z >
- this.enemy.origin_z + this.enemy.mins_z +
- 0.75 * this.enemy.size_z)
+ if (self.origin_z + self.mins_z >
+ self.enemy.origin_z + self.enemy.mins_z +
+ 0.75 * self.enemy.size_z)
{
return FALSE;
}

- if (this.origin_z + this.maxs_z <
- this.enemy.origin_z + this.enemy.mins_z +
- 0.25 * this.enemy.size_z)
+ if (self.origin_z + self.maxs_z <
+ self.enemy.origin_z + self.enemy.mins_z +
+ 0.25 * self.enemy.size_z)
{
return FALSE;
}

- dist = this.enemy.origin - this.origin;
+ dist = self.enemy.origin - self.origin;
dist_z = 0;

d = vlen (dist);
@@ -154,21 +191,21 @@ class monster_dog: base_walkmonster
};

//--------------------------------------------------------------
- virtual float() ai_checkattack =
+ float() monster_dog_checkattack =
{
// if close enough for slashing, go for it
/*
- if (this.check_melee())
+ if (monster_dog_checkmelee())
*/
if (enemy_range == RANGE_MELEE)
{
- this.attack_state = AS_MELEE;
+ self.attack_state = AS_MELEE;
return TRUE;
}

- if (this.check_jump())
+ if (monster_dog_checkjump())
{
- this.attack_state = AS_MISSILE;
+ self.attack_state = AS_MISSILE;
return TRUE;
}

@@ -176,315 +213,298 @@ class monster_dog: base_walkmonster
};

//--------------------------------------------------------------
- virtual void() ai_sightsound =
+ void() monster_dog_sightsound =
{
// dumptruck_ds
- sound_sight (this, CHAN_VOICE, "dog/dsight.wav", 1, ATTN_NORM);
+ sound_sight (self, CHAN_VOICE, "dog/dsight.wav", 1, ATTN_NORM);
};

//--------------------------------------------------------------
// dog_bite
//--------------------------------------------------------------
- nonvirtual void() bite =
+ void() monster_dog_bite =
{
local vector delta;
local float ldmg;

- if (!this.enemy)
+ if (!self.enemy)
return;

ai_charge (10);

- if (!this.can_damage(this, this.enemy))
+ if (!can_damage(self, self.enemy))
return;

- delta = this.enemy.origin - this.origin;
+ delta = self.enemy.origin - self.origin;

if (vlen(delta) > 100)
return;

ldmg = (random() + random() + random()) * 8;
- this.t_damage2 (this.enemy, this, this, ldmg);
+ t_damage2 (self.enemy, self, self, ldmg);
};

//--------------------------------------------------------------
// Dog standing state
//--------------------------------------------------------------
- nonvirtual void() stand1 = [$stand1, stand2] { ai_stand (); };
- nonvirtual void() stand2 = [$stand2, stand3] { ai_stand (); };
- nonvirtual void() stand3 = [$stand3, stand4] { ai_stand (); };
- nonvirtual void() stand4 = [$stand4, stand5] { ai_stand (); };
- nonvirtual void() stand5 = [$stand5, stand6] { ai_stand (); };
- nonvirtual void() stand6 = [$stand6, stand7] { ai_stand (); };
- nonvirtual void() stand7 = [$stand7, stand8] { ai_stand (); };
- nonvirtual void() stand8 = [$stand8, stand9] { ai_stand (); };
- nonvirtual void() stand9 = [$stand9, stand1] { ai_stand (); };
+ void() dog_stand1 = [$stand1, dog_stand2] { ai_stand (); };
+ void() dog_stand2 = [$stand2, dog_stand3] { ai_stand (); };
+ void() dog_stand3 = [$stand3, dog_stand4] { ai_stand (); };
+ void() dog_stand4 = [$stand4, dog_stand5] { ai_stand (); };
+ void() dog_stand5 = [$stand5, dog_stand6] { ai_stand (); };
+ void() dog_stand6 = [$stand6, dog_stand7] { ai_stand (); };
+ void() dog_stand7 = [$stand7, dog_stand8] { ai_stand (); };
+ void() dog_stand8 = [$stand8, dog_stand9] { ai_stand (); };
+ void() dog_stand9 = [$stand9, dog_stand1] { ai_stand (); };

//--------------------------------------------------------------
// Dog walking state
//--------------------------------------------------------------
- nonvirtual void() walk1 = [$walk1, walk2]
+ void() dog_walk1 = [$walk1, dog_walk2]
{
if (random() < 0.2)
// dumptruck_ds
- sound_idle (this, CHAN_VOICE, "dog/idle.wav",
+ sound_idle (self, CHAN_VOICE, "dog/idle.wav",
1, ATTN_IDLE);
ai_walk (8);
};
- nonvirtual void() walk2 = [$walk2, walk3] { ai_walk (8); };
- nonvirtual void() walk3 = [$walk3, walk4] { ai_walk (8); };
- nonvirtual void() walk4 = [$walk4, walk5] { ai_walk (8); };
- nonvirtual void() walk5 = [$walk5, walk6] { ai_walk (8); };
- nonvirtual void() walk6 = [$walk6, walk7] { ai_walk (8); };
- nonvirtual void() walk7 = [$walk7, walk8] { ai_walk (8); };
- nonvirtual void() walk8 = [$walk8, walk1] { ai_walk (8); };
+ void() dog_walk2 = [$walk2, dog_walk3] { ai_walk (8); };
+ void() dog_walk3 = [$walk3, dog_walk4] { ai_walk (8); };
+ void() dog_walk4 = [$walk4, dog_walk5] { ai_walk (8); };
+ void() dog_walk5 = [$walk5, dog_walk6] { ai_walk (8); };
+ void() dog_walk6 = [$walk6, dog_walk7] { ai_walk (8); };
+ void() dog_walk7 = [$walk7, dog_walk8] { ai_walk (8); };
+ void() dog_walk8 = [$walk8, dog_walk1] { ai_walk (8); };

//--------------------------------------------------------------
// Dog running state
//--------------------------------------------------------------
- nonvirtual void() run1 = [$run1, run2]
+ void() dog_run1 = [$run1, dog_run2]
{
if (random() < 0.2)
// dumptruck_ds
- sound_idle (this, CHAN_VOICE, "dog/idle.wav",
+ sound_idle (self, CHAN_VOICE, "dog/idle.wav",
1, ATTN_IDLE);
ai_run (16);
};
- nonvirtual void() run2 = [$run2, run3] { ai_run (32); };
- nonvirtual void() run3 = [$run3, run4] { ai_run (32); };
- nonvirtual void() run4 = [$run4, run5] { ai_run (20); };
- nonvirtual void() run5 = [$run5, run6] { ai_run (64); };
- nonvirtual void() run6 = [$run6, run7] { ai_run (32); };
- nonvirtual void() run7 = [$run7, run8] { ai_run (16); };
- nonvirtual void() run8 = [$run8, run9] { ai_run (32); };
- nonvirtual void() run9 = [$run9, run10] { ai_run (32); };
- nonvirtual void() run10 = [$run10, run11] { ai_run (20); };
- nonvirtual void() run11 = [$run11, run12] { ai_run (64); };
- nonvirtual void() run12 = [$run12, run1] { ai_run (32); };
+ void() dog_run2 = [$run2, dog_run3] { ai_run (32); };
+ void() dog_run3 = [$run3, dog_run4] { ai_run (32); };
+ void() dog_run4 = [$run4, dog_run5] { ai_run (20); };
+ void() dog_run5 = [$run5, dog_run6] { ai_run (64); };
+ void() dog_run6 = [$run6, dog_run7] { ai_run (32); };
+ void() dog_run7 = [$run7, dog_run8] { ai_run (16); };
+ void() dog_run8 = [$run8, dog_run9] { ai_run (32); };
+ void() dog_run9 = [$run9, dog_run10] { ai_run (32); };
+ void() dog_run10 = [$run10, dog_run11] { ai_run (20); };
+ void() dog_run11 = [$run11, dog_run12] { ai_run (64); };
+ void() dog_run12 = [$run12, dog_run1] { ai_run (32); };

//--------------------------------------------------------------
// Dog attack state
//--------------------------------------------------------------
- nonvirtual void() atta1 = [$attack1, atta2] { ai_charge (10); };
- nonvirtual void() atta2 = [$attack2, atta3] { ai_charge (10); };
- nonvirtual void() atta3 = [$attack3, atta4] { ai_charge (10); };
- nonvirtual void() atta4 = [$attack4, atta5]
+ void() dog_atta1 = [$attack1, dog_atta2] { ai_charge (10); };
+ void() dog_atta2 = [$attack2, dog_atta3] { ai_charge (10); };
+ void() dog_atta3 = [$attack3, dog_atta4] { ai_charge (10); };
+ void() dog_atta4 = [$attack4, dog_atta5]
{
// dumptruck_ds
- sound_attack (this, CHAN_VOICE, "dog/dattack1.wav",
+ sound_attack (self, CHAN_VOICE, "dog/dattack1.wav",
1, ATTN_NORM);
- this.bite ();
+ monster_dog_bite ();
};
- nonvirtual void() atta5 = [$attack5, atta6] { ai_charge (10); };
- nonvirtual void() atta6 = [$attack6, atta7] { ai_charge (10); };
- nonvirtual void() atta7 = [$attack7, atta8] { ai_charge (10); };
- nonvirtual void() atta8 = [$attack8, run1] { ai_charge (10); };
+ void() dog_atta5 = [$attack5, dog_atta6] { ai_charge (10); };
+ void() dog_atta6 = [$attack6, dog_atta7] { ai_charge (10); };
+ void() dog_atta7 = [$attack7, dog_atta8] { ai_charge (10); };
+ void() dog_atta8 = [$attack8, dog_run1] { ai_charge (10); };

//--------------------------------------------------------------
// Dog jumping (leaping) state
//--------------------------------------------------------------
- nonvirtual void() leap1 = [$leap1, leap2] { ai_face (); };
- nonvirtual void() leap2 = [$leap2, leap3]
+ void() dog_leap1 = [$leap1, dog_leap2] { ai_face (); };
+ void() dog_leap2 = [$leap2, dog_leap3]
{
ai_face ();
// fix for instakill bug -- dumptruck_ds
- this.worldtype = 0;
- this.touch_state = DOG_TOUCH_JUMP;
- makevectors (this.angles);
- this.origin_z = this.origin_z + 1;
- this.velocity = v_forward * 300 + '0 0 200';
- if (this.flags & FL_ONGROUND)
- this.flags = this.flags - FL_ONGROUND;
+ self.worldtype = 0;
+ self.touch = monster_dog_touch_jump;
+ makevectors (self.angles);
+ self.origin_z = self.origin_z + 1;
+ self.velocity = v_forward * 300 + '0 0 200';
+ if (self.flags & FL_ONGROUND)
+ self.flags = self.flags - FL_ONGROUND;
};
- nonvirtual void() leap3 = [$leap3, leap4] { };
- nonvirtual void() leap4 = [$leap4, leap5] { };
- nonvirtual void() leap5 = [$leap5, leap6] { };
- nonvirtual void() leap6 = [$leap6, leap7] { };
- nonvirtual void() leap7 = [$leap7, leap8] { };
- nonvirtual void() leap8 = [$leap8, leap9] { };
- nonvirtual void() leap9 = [$leap9, leap9] { };
+ void() dog_leap3 = [$leap3, dog_leap4] { };
+ void() dog_leap4 = [$leap4, dog_leap5] { };
+ void() dog_leap5 = [$leap5, dog_leap6] { };
+ void() dog_leap6 = [$leap6, dog_leap7] { };
+ void() dog_leap7 = [$leap7, dog_leap8] { };
+ void() dog_leap8 = [$leap8, dog_leap9] { };
+ void() dog_leap9 = [$leap9, dog_leap9] { };

//--------------------------------------------------------------
// Dog pain state A
//--------------------------------------------------------------
- nonvirtual void() pain1 = [$pain1, pain2] { };
- nonvirtual void() pain2 = [$pain2, pain3] { };
- nonvirtual void() pain3 = [$pain3, pain4] { };
- nonvirtual void() pain4 = [$pain4, pain5] { };
- nonvirtual void() pain5 = [$pain5, pain6] { };
- nonvirtual void() pain6 = [$pain6, run1] { };
+ void() dog_pain1 = [$pain1, dog_pain2] { };
+ void() dog_pain2 = [$pain2, dog_pain3] { };
+ void() dog_pain3 = [$pain3, dog_pain4] { };
+ void() dog_pain4 = [$pain4, dog_pain5] { };
+ void() dog_pain5 = [$pain5, dog_pain6] { };
+ void() dog_pain6 = [$pain6, dog_run1] { };

//--------------------------------------------------------------
// Dog pain state B
//--------------------------------------------------------------
- nonvirtual void() painb1 = [$painb1, painb2] { };
- nonvirtual void() painb2 = [$painb2, painb3] { };
- nonvirtual void() painb3 = [$painb3, painb4] { ai_pain (4); };
- nonvirtual void() painb4 = [$painb4, painb5] { ai_pain (12); };
- nonvirtual void() painb5 = [$painb5, painb6] { ai_pain (12); };
- nonvirtual void() painb6 = [$painb6, painb7] { ai_pain (2); };
- nonvirtual void() painb7 = [$painb7, painb8] { };
- nonvirtual void() painb8 = [$painb8, painb9] { ai_pain (4); };
- nonvirtual void() painb9 = [$painb9, painb10] { };
- nonvirtual void() painb10 = [$painb10, painb11] { ai_pain (10); };
- nonvirtual void() painb11 = [$painb11, painb12] { };
- nonvirtual void() painb12 = [$painb12, painb13] { };
- nonvirtual void() painb13 = [$painb13, painb14] { };
- nonvirtual void() painb14 = [$painb14, painb15] { };
- nonvirtual void() painb15 = [$painb15, painb16] { };
- nonvirtual void() painb16 = [$painb16, run1] { };
+ void() dog_painb1 = [$painb1, dog_painb2] { };
+ void() dog_painb2 = [$painb2, dog_painb3] { };
+ void() dog_painb3 = [$painb3, dog_painb4] { ai_pain (4); };
+ void() dog_painb4 = [$painb4, dog_painb5] { ai_pain (12); };
+ void() dog_painb5 = [$painb5, dog_painb6] { ai_pain (12); };
+ void() dog_painb6 = [$painb6, dog_painb7] { ai_pain (2); };
+ void() dog_painb7 = [$painb7, dog_painb8] { };
+ void() dog_painb8 = [$painb8, dog_painb9] { ai_pain (4); };
+ void() dog_painb9 = [$painb9, dog_painb10] { };
+ void() dog_painb10 = [$painb10, dog_painb11] { ai_pain (10); };
+ void() dog_painb11 = [$painb11, dog_painb12] { };
+ void() dog_painb12 = [$painb12, dog_painb13] { };
+ void() dog_painb13 = [$painb13, dog_painb14] { };
+ void() dog_painb14 = [$painb14, dog_painb15] { };
+ void() dog_painb15 = [$painb15, dog_painb16] { };
+ void() dog_painb16 = [$painb16, dog_run1] { };

//--------------------------------------------------------------
// Dog death state A
//--------------------------------------------------------------
- nonvirtual void() die1 = [$death1, die2] { };
- nonvirtual void() die2 = [$death2, die3] { };
- nonvirtual void() die3 = [$death3, die4] { };
- nonvirtual void() die4 = [$death4, die5] { };
- nonvirtual void() die5 = [$death5, die6] { };
- nonvirtual void() die6 = [$death6, die7] { };
- nonvirtual void() die7 = [$death7, die8] { };
- nonvirtual void() die8 = [$death8, die9] { };
- nonvirtual void() die9 = [$death9, die9] { };
+ void() dog_die1 = [$death1, dog_die2] { };
+ void() dog_die2 = [$death2, dog_die3] { };
+ void() dog_die3 = [$death3, dog_die4] { };
+ void() dog_die4 = [$death4, dog_die5] { };
+ void() dog_die5 = [$death5, dog_die6] { };
+ void() dog_die6 = [$death6, dog_die7] { };
+ void() dog_die7 = [$death7, dog_die8] { };
+ void() dog_die8 = [$death8, dog_die9] { };
+ void() dog_die9 = [$death9, dog_die9] { };

//--------------------------------------------------------------
// Dog death state B
//--------------------------------------------------------------
- nonvirtual void() dieb1 = [$deathb1, dieb2] { };
- nonvirtual void() dieb2 = [$deathb2, dieb3] { };
- nonvirtual void() dieb3 = [$deathb3, dieb4] { };
- nonvirtual void() dieb4 = [$deathb4, dieb5] { };
- nonvirtual void() dieb5 = [$deathb5, dieb6] { };
- nonvirtual void() dieb6 = [$deathb6, dieb7] { };
- nonvirtual void() dieb7 = [$deathb7, dieb8] { };
- nonvirtual void() dieb8 = [$deathb8, dieb9] { };
- nonvirtual void() dieb9 = [$deathb9, dieb9] { };
+ void() dog_dieb1 = [$deathb1, dog_dieb2] { };
+ void() dog_dieb2 = [$deathb2, dog_dieb3] { };
+ void() dog_dieb3 = [$deathb3, dog_dieb4] { };
+ void() dog_dieb4 = [$deathb4, dog_dieb5] { };
+ void() dog_dieb5 = [$deathb5, dog_dieb6] { };
+ void() dog_dieb6 = [$deathb6, dog_dieb7] { };
+ void() dog_dieb7 = [$deathb7, dog_dieb8] { };
+ void() dog_dieb8 = [$deathb8, dog_dieb9] { };
+ void() dog_dieb9 = [$deathb9, dog_dieb9] { };

//==============================================================
// Interaction
//==============================================================

//--------------------------------------------------------------
- virtual void(entity attacker, float damage) do_damage =
+ void(entity attacker, float damage) monster_dog_pain =
{
// dumptruck_ds
- sound_pain (this, CHAN_VOICE, "dog/dpain1.wav", 1, ATTN_NORM);
+ sound_pain (self, CHAN_VOICE, "dog/dpain1.wav", 1, ATTN_NORM);

if (random() > 0.5)
- this.pain1 ();
+ dog_pain1 ();
else
- this.painb1 ();
+ dog_painb1 ();
};

//--------------------------------------------------------------
- virtual void() do_destroy =
+ void() monster_dog_destroy =
{
// check for gib
- if (this.health < -35)
+ if (self.health < -35)
{
- sound (this, CHAN_VOICE, "player/udeath.wav",
+ sound (self, CHAN_VOICE, "player/udeath.wav",
1, ATTN_NORM);

// custom models -- dumptruck_ds
- if (this.mdl_gib1 != "")
- {
- ThrowGib (this.mdl_gib1, this.health);
- }
+ if (self.mdl_gib1 != "")
+ throw_gib (self.mdl_gib1, self.health);
else
- {
- ThrowGib ("progs/gib3.mdl", this.health);
- }
- if (this.mdl_gib2 != "")
- {
- ThrowGib (this.mdl_gib2, this.health);
- }
+ throw_gib ("progs/gib3.mdl", self.health);
+
+ if (self.mdl_gib2 != "")
+ throw_gib (self.mdl_gib2, self.health);
else
- {
- ThrowGib ("progs/gib3.mdl", this.health);
- }
- if (this.mdl_gib3 != "")
- {
- ThrowGib (this.mdl_gib3, this.health);
- }
+ throw_gib ("progs/gib3.mdl", self.health);
+
+ if (self.mdl_gib3 != "")
+ throw_gib (self.mdl_gib3, self.health);
else
- {
- ThrowGib ("progs/gib3.mdl", this.health);
- }
- if (this.mdl_head != "")
- {
- ThrowHead (this.mdl_head, this.health);
- }
+ throw_gib ("progs/gib3.mdl", self.health);
+
+ if (self.mdl_head != "")
+ throw_head (self.mdl_head, self.health);
else
- {
- ThrowHead ("progs/h_dog.mdl", this.health);
- }
- base_item::drop_stuff (this);
+ throw_head ("progs/h_dog.mdl", self.health);
+
+ base_item_drop_stuff (self);
return;
}

// regular death
- sound_death (this, CHAN_VOICE, "dog/ddeath.wav",
- 1, ATTN_NORM); //dumptruck_ds
- this.solid = SOLID_NOT;
+ // dumptruck_ds
+ sound_death (self, CHAN_VOICE, "dog/ddeath.wav", 1, ATTN_NORM);
+ self.solid = SOLID_NOT;

- base_item::drop_stuff (this);
+ base_item_drop_stuff (self);

if (random() > 0.5)
- this.die1 ();
+ dog_die1 ();
else
- this.dieb1 ();
+ dog_dieb1 ();
};

//--------------------------------------------------------------
- virtual void() touch =
+ // Dog_JumpTouch
+ //--------------------------------------------------------------
+ void() monster_dog_touch_jump =
{
- if (this.touch_state == DOG_TOUCH_DEFAULT)
- {
- super::touch ();
- return;
- }
-
- // clear to do Dog_JumpTouch now
local float ldmg;

- if (this.health <= 0)
+ if (self.health <= 0)
return;

if (other.takedamage)
{
- if (vlen(this.velocity) > 300)
+ if (vlen(self.velocity) > 300)
{
- if !(this.worldtype)
+ if !(self.worldtype)
{
ldmg = 10 + 10 * random();
- this.t_damage2 (other, this, this, ldmg);
+ t_damage2 (other, self, self, ldmg);
if (other.health > 0)
// is the player still alive?
// Preach's instakill bug check
// - dumptruck_ds
- this.worldtype = 1;
+ self.worldtype = 1;
}
}
}

- if (!checkbottom(this))
+ if (!checkbottom(self))
{
- if (this.flags & FL_ONGROUND)
+ if (self.flags & FL_ONGROUND)
{
// jump randomly to not get hung up
// dprint ("popjump\n");
// 1998-09-16 Sliding/not-jumping on monsters/
// boxes/players fix by Maddes/Kryten start
- this.touch_state = DOG_TOUCH_DEFAULT;
+ self.touch = base_monster_touch;
// 1998-09-16 Sliding/not-jumping on monsters/
// boxes/players fix by Maddes/Kryten end
- this.think = leap1;
- this.nextthink = time + 0.1;
+ self.think = dog_leap1;
+ self.nextthink = time + 0.1;

- // this.velocity_x = (random() - 0.5) * 600;
- // this.velocity_y = (random() - 0.5) * 600;
- // this.velocity_z = 200;
- // this.flags = this.flags - FL_ONGROUND;
+ // self.velocity_x = (random() - 0.5) * 600;
+ // self.velocity_y = (random() - 0.5) * 600;
+ // self.velocity_z = 200;
+ // self.flags = self.flags - FL_ONGROUND;
}
// not on ground yet
return;
@@ -492,11 +512,11 @@ class monster_dog: base_walkmonster

// 1998-09-16 Sliding/not-jumping on monsters/boxes/players
// fix by Maddes/Kryten start
- this.touch_state = DOG_TOUCH_DEFAULT;
+ self.touch = base_monster_touch;
// 1998-09-16 Sliding/not-jumping on monsters/boxes/players
// fix by Maddes/Kryten end
- this.think = run1;
- this.nextthink = time + 0.1;
+ self.think = dog_run1;
+ self.nextthink = time + 0.1;
};

//==============================================================
@@ -504,73 +524,80 @@ class monster_dog: base_walkmonster
//==============================================================

//--------------------------------------------------------------
- virtual void() init_spawned =
+ void(entity e) monster_dog_init =
{
- if (this.spawnflags & I_AM_TURRET)
- objerror ("Incompatible spawnflag: TURRET_MODE\n");
+ if (e.spawnflags & I_AM_TURRET)
+ objerror ("monster_dog_init: "
+ "incompatible spawnflag: TURRET_MODE\n");

if (deathmatch)
{
- remove (this);
+ remove (e);
return;
}

+ e.classname = "monster_dog";
+ e.classtype = CT_MONSTER_DOG;
+
// dumptruck_ds -- model_custom and sounds changes
- precache_head_model ("progs/h_dog.mdl");
- precache_body_model ("progs/dog.mdl");
- precache_sound_attack ("dog/dattack1.wav");
- precache_sound_death ("dog/ddeath.wav");
- precache_sound_pain ("dog/dpain1.wav");
- precache_sound_sight ("dog/dsight.wav");
- precache_sound_idle ("dog/idle.wav");
-
- precache_gib1 ("progs/gib1.mdl");
- precache_gib2 ("progs/gib2.mdl");
- precache_gib3 ("progs/gib3.mdl");
+ precache_head_model (e, "progs/h_dog.mdl");
+ precache_body_model (e, "progs/dog.mdl");
+ precache_sound_attack (e, "dog/dattack1.wav");
+ precache_sound_death (e, "dog/ddeath.wav");
+ precache_sound_pain (e, "dog/dpain1.wav");
+ precache_sound_sight (e, "dog/dsight.wav");
+ precache_sound_idle (e, "dog/idle.wav");
+
+ precache_gib1 (e, "progs/gib1.mdl");
+ precache_gib2 (e, "progs/gib2.mdl");
+ precache_gib3 (e, "progs/gib3.mdl");

// dumptruck_ds

- this.solid = SOLID_SLIDEBOX;
- this.movetype = MOVETYPE_STEP;
+ e.solid = SOLID_SLIDEBOX;
+ e.movetype = MOVETYPE_STEP;

- body_model ("progs/dog.mdl"); //dumptruck_ds
- // setmodel (this, "progs/dog.mdl");
+ // dumptruck_ds
+ body_model (e, "progs/dog.mdl");
+ // setmodel (e, "progs/dog.mdl");

- setsize (this, '-32 -32 -24', '32 32 40');
+ setsize (e, '-32 -32 -24', '32 32 40');

- if (!this.health)
+ if (!e.health)
//thanks RennyC -- dumptruck_ds
- this.health = 25;
-
- this.touch_state = DOG_TOUCH_DEFAULT;
+ e.health = 25;

- this.think_stand = this.stand1;
- this.think_walk = this.walk1;
- this.think_run = this.run1;
- this.think_melee = this.atta1;
- this.think_missile = this.leap1;
+ e.checkattack = monster_dog_checkattack;
+ e.sightsound = monster_dog_sightsound;
+ e.think_stand = dog_stand1;
+ e.think_walk = dog_walk1;
+ e.think_run = dog_run1;
+ e.think_melee = dog_atta1;
+ e.think_missile = dog_leap1;

// Berserk test from
// http://celephais.net/board/view_thread.php?id=4&start=3465
// -- dumptruck_ds
- if !(this.berserk)
- this.th_pain = this.do_damage;
+ if !(e.berserk)
+ e.pain = monster_dog_pain;
else
- this.th_pain = sub_nullpain;
- this.th_die = this.do_destroy;
+ e.pain = sub_nullpain;
+ e.destroy = monster_dog_destroy;

// walkmonster_start
- super::init_spawned ();
+ base_walkmonster_init (e);
};

//--------------------------------------------------------------
void() monster_dog =
{
- this.classtype = CT_MONSTER_DOG;
- };
-};
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;

-//==============================================================================
+ monster_dog_init (self);
+ };
+// };

/* Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds */

@@ -581,16 +608,17 @@ class monster_dog: base_walkmonster
*/
void() monster_dead_dog =
{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
return;

- precache_model("progs/dog.mdl");
- setmodel(self, "progs/dog.mdl");
+ precache_model ("progs/dog.mdl");
+ setmodel (self, "progs/dog.mdl");
self.frame = $death8;
if (self.spawnflags & 1)
{
self.solid = SOLID_BBOX;
- setsize(self,'-24.51 -16.5 -50.37','28.2 13.81 30');
+ setsize (self,'-24.51 -16.5 -50.37','28.2 13.81 30');
}
else
{

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

Diff qc/monsters/knight.qc

diff --git a/qc/monsters/knight.qc b/qc/monsters/knight.qc
index c0b4bbe..77418ea 100644
--- a/qc/monsters/knight.qc
+++ b/qc/monsters/knight.qc
@@ -3,8 +3,52 @@
//==============================================================================

//======================================================================
+// forward declarations
+//======================================================================
+
+// monster_knight
+void() monster_knight_sightsound; // AI & attacks
+void() monster_knight_attack; // animation & thinking below
+void() kn_stand1; void() kn_stand2; void() kn_stand3; void() kn_stand4;
+void() kn_stand5; void() kn_stand6; void() kn_stand7; void() kn_stand8;
+void() kn_stand9;
+void() kn_walk1; void() kn_walk2; void() kn_walk3; void() kn_walk4;
+void() kn_walk5; void() kn_walk6; void() kn_walk7; void() kn_walk8;
+void() kn_walk9; void() kn_walk10; void() kn_walk11; void() kn_walk12;
+void() kn_walk13; void() kn_walk14;
+void() kn_run1; void() kn_run2; void() kn_run3; void() kn_run4;
+void() kn_run5; void() kn_run6; void() kn_run7; void() kn_run8;
+void() kn_runatk1; void() kn_runatk2; void() kn_runatk3; void() kn_runatk4;
+void() kn_runatk5; void() kn_runatk6; void() kn_runatk7; void() kn_runatk8;
+void() kn_runatk9; void() kn_runatk10; void() kn_runatk11;
+void() kn_atk1; void() kn_atk2; void() kn_atk3; void() kn_atk4;
+void() kn_atk5; void() kn_atk6; void() kn_atk7; void() kn_atk8;
+void() kn_atk9; void() kn_atk10;
+void() kn_bow1; void() kn_bow2; void() kn_bow3; void() kn_bow4;
+void() kn_bow5; void() kn_bow6; void() kn_bow7; void() kn_bow8;
+void() kn_bow9; void() kn_bow10;
+void() kn_pain1; void() kn_pain2; void() kn_pain3;
+void() kn_painb1; void() kn_painb2; void() kn_painb3; void() kn_painb4;
+void() kn_painb5; void() kn_painb6; void() kn_painb7; void() kn_painb8;
+void() kn_painb9; void() kn_painb10; void() kn_painb11;
+void() kn_die1; void() kn_die2; void() kn_die3; void() kn_die4;
+void() kn_die5; void() kn_die6; void() kn_die7; void() kn_die8;
+void() kn_die9; void() kn_die10;
+void() kn_dieb1; void() kn_dieb2; void() kn_dieb3; void() kn_dieb4;
+void() kn_dieb5; void() kn_dieb6; void() kn_dieb7; void() kn_dieb8;
+void() kn_dieb9; void() kn_dieb10; void() kn_dieb11;
+void(entity attacker, float damage) monster_knight_pain; // interaction
+void() monster_knight_destroy;
+void(entity e) monster_knight_init; // initialization
+void() monster_knight;
+
+// monster_dead_knight
+void() monster_dead_knight;
+
+//======================================================================
// frame macros
//======================================================================
+
$cd id1/models/knight
$origin 0 0 24
$base base
@@ -45,6 +89,8 @@ $frame death9 death10
$frame deathb1 deathb2 deathb3 deathb4 deathb5 deathb6 deathb7 deathb8
$frame deathb9 deathb10 deathb11

+//------------------------------------------------------------------------------
+
/*QUAKED monster_knight (1 0 0) (-16 -16 -24) (16 16 40) AMBUSH X X TRIGGER_SPAWNED X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ("progs/knight.mdl");
@@ -103,210 +149,211 @@ obit_method(string) : "When used with obit_name, will set part of the text for a
damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by this number (e.g. 4 = Quad damage)"

*/
-class monster_knight: base_walkmonster
-{
+//----------------------------------------------------------------------
+// class monster_knight: base_walkmonster
+// {
//--------------------------------------------------------------
- virtual void() ai_sightsound =
+ void() monster_knight_sightsound =
{
- sound_sight (this, CHAN_VOICE, "knight/ksight.wav",
+ sound_sight (self, CHAN_VOICE, "knight/ksight.wav",
1, ATTN_NORM);
};

//--------------------------------------------------------------
// knight_attack
//--------------------------------------------------------------
- nonvirtual void() knight_attack =
+ void() monster_knight_attack =
{
local float len;

// decide if now is a good swing time
- len = vlen (this.enemy.origin + this.enemy.view_ofs -
- (this.origin + this.view_ofs));
+ len = vlen (self.enemy.origin + self.enemy.view_ofs -
+ (self.origin + self.view_ofs));

if (len < 80)
- this.atk1 ();
+ kn_atk1 ();
else
- this.runatk1 ();
+ kn_runatk1 ();
};

//--------------------------------------------------------------
// Knight Standing functions
//--------------------------------------------------------------
- nonvirtual void() stand1 = [$stand1, stand2] { ai_stand (); };
- nonvirtual void() stand2 = [$stand2, stand3] { ai_stand (); };
- nonvirtual void() stand3 = [$stand3, stand4] { ai_stand (); };
- nonvirtual void() stand4 = [$stand4, stand5] { ai_stand (); };
- nonvirtual void() stand5 = [$stand5, stand6] { ai_stand (); };
- nonvirtual void() stand6 = [$stand6, stand7] { ai_stand (); };
- nonvirtual void() stand7 = [$stand7, stand8] { ai_stand (); };
- nonvirtual void() stand8 = [$stand8, stand9] { ai_stand (); };
- nonvirtual void() stand9 = [$stand9, stand1] { ai_stand (); };
+ void() kn_stand1 = [$stand1, kn_stand2] { ai_stand (); };
+ void() kn_stand2 = [$stand2, kn_stand3] { ai_stand (); };
+ void() kn_stand3 = [$stand3, kn_stand4] { ai_stand (); };
+ void() kn_stand4 = [$stand4, kn_stand5] { ai_stand (); };
+ void() kn_stand5 = [$stand5, kn_stand6] { ai_stand (); };
+ void() kn_stand6 = [$stand6, kn_stand7] { ai_stand (); };
+ void() kn_stand7 = [$stand7, kn_stand8] { ai_stand (); };
+ void() kn_stand8 = [$stand8, kn_stand9] { ai_stand (); };
+ void() kn_stand9 = [$stand9, kn_stand1] { ai_stand (); };

//--------------------------------------------------------------
// Knight Walking functions
//--------------------------------------------------------------
- nonvirtual void() walk1 = [$walk1, walk2]
+ void() kn_walk1 = [$walk1, kn_walk2]
{
if (random() < 0.2)
- sound_idle (this, CHAN_VOICE, "knight/idle.wav",
+ sound_idle (self, CHAN_VOICE, "knight/idle.wav",
1, ATTN_IDLE);
ai_walk (3);
};
- nonvirtual void() walk2 = [$walk2, walk3] { ai_walk (2); };
- nonvirtual void() walk3 = [$walk3, walk4] { ai_walk (3); };
- nonvirtual void() walk4 = [$walk4, walk5] { ai_walk (4); };
- nonvirtual void() walk5 = [$walk5, walk6] { ai_walk (3); };
- nonvirtual void() walk6 = [$walk6, walk7] { ai_walk (3); };
- nonvirtual void() walk7 = [$walk7, walk8] { ai_walk (3); };
- nonvirtual void() walk8 = [$walk8, walk9] { ai_walk (4); };
- nonvirtual void() walk9 = [$walk9, walk10] { ai_walk (3); };
- nonvirtual void() walk10 = [$walk10, walk11] { ai_walk (3); };
- nonvirtual void() walk11 = [$walk11, walk12] { ai_walk (2); };
- nonvirtual void() walk12 = [$walk12, walk13] { ai_walk (3); };
- nonvirtual void() walk13 = [$walk13, walk14] { ai_walk (4); };
- nonvirtual void() walk14 = [$walk14, walk1] { ai_walk (3); };
+ void() kn_walk2 = [$walk2, kn_walk3] { ai_walk (2); };
+ void() kn_walk3 = [$walk3, kn_walk4] { ai_walk (3); };
+ void() kn_walk4 = [$walk4, kn_walk5] { ai_walk (4); };
+ void() kn_walk5 = [$walk5, kn_walk6] { ai_walk (3); };
+ void() kn_walk6 = [$walk6, kn_walk7] { ai_walk (3); };
+ void() kn_walk7 = [$walk7, kn_walk8] { ai_walk (3); };
+ void() kn_walk8 = [$walk8, kn_walk9] { ai_walk (4); };
+ void() kn_walk9 = [$walk9, kn_walk10] { ai_walk (3); };
+ void() kn_walk10 = [$walk10, kn_walk11] { ai_walk (3); };
+ void() kn_walk11 = [$walk11, kn_walk12] { ai_walk (2); };
+ void() kn_walk12 = [$walk12, kn_walk13] { ai_walk (3); };
+ void() kn_walk13 = [$walk13, kn_walk14] { ai_walk (4); };
+ void() kn_walk14 = [$walk14, kn_walk1] { ai_walk (3); };

//--------------------------------------------------------------
// Knight Running functions
//--------------------------------------------------------------
- nonvirtual void() run1 = [$runb1, run2]
+ void() kn_run1 = [$runb1, kn_run2]
{
if (random() < 0.2)
- sound_idle (this, CHAN_VOICE, "knight/idle.wav",
+ sound_idle (self, CHAN_VOICE, "knight/idle.wav",
1, ATTN_IDLE);
ai_run (16);
};
- nonvirtual void() run2 = [ $runb2, run3] { ai_run (20); };
- nonvirtual void() run3 = [ $runb3, run4] { ai_run (13); };
- nonvirtual void() run4 = [ $runb4, run5] { ai_run (7); };
- nonvirtual void() run5 = [ $runb5, run6] { ai_run (16); };
- nonvirtual void() run6 = [ $runb6, run7] { ai_run (20); };
- nonvirtual void() run7 = [ $runb7, run8] { ai_run (14); };
- nonvirtual void() run8 = [ $runb8, run1] { ai_run (6); };
+ void() kn_run2 = [ $runb2, kn_run3] { ai_run (20); };
+ void() kn_run3 = [ $runb3, kn_run4] { ai_run (13); };
+ void() kn_run4 = [ $runb4, kn_run5] { ai_run (7); };
+ void() kn_run5 = [ $runb5, kn_run6] { ai_run (16); };
+ void() kn_run6 = [ $runb6, kn_run7] { ai_run (20); };
+ void() kn_run7 = [ $runb7, kn_run8] { ai_run (14); };
+ void() kn_run8 = [ $runb8, kn_run1] { ai_run (6); };

//--------------------------------------------------------------
// Knight Running Attack
//--------------------------------------------------------------
- nonvirtual void() runatk1 = [$runattack1, runatk2]
+ void() kn_runatk1 = [$runattack1, kn_runatk2]
{
if (random() > 0.5)
- sound_misc (this, CHAN_WEAPON, "knight/sword2.wav",
+ sound_misc (self, CHAN_WEAPON, "knight/sword2.wav",
1, ATTN_NORM);
else
- sound_attack (this, CHAN_WEAPON, "knight/sword1.wav",
+ sound_attack (self, CHAN_WEAPON, "knight/sword1.wav",
1, ATTN_NORM);
ai_charge (20);
};
- nonvirtual void() runatk2 = [$runattack2, runatk3] {ai_charge_side();};
- nonvirtual void() runatk3 = [$runattack3, runatk4] {ai_charge_side();};
- nonvirtual void() runatk4 = [$runattack4, runatk5] {ai_charge_side();};
- nonvirtual void() runatk5 = [$runattack5, runatk6] {ai_melee_side();};
- nonvirtual void() runatk6 = [$runattack6, runatk7] {ai_melee_side();};
- nonvirtual void() runatk7 = [$runattack7, runatk8] {ai_melee_side();};
- nonvirtual void() runatk8 = [$runattack8, runatk9] {ai_melee_side();};
- nonvirtual void() runatk9 = [$runattack9, runatk10] {ai_melee_side();};
- nonvirtual void() runatk10 = [$runattack10, runatk11] {ai_charge_side();};
- nonvirtual void() runatk11 = [$runattack11, run1] { ai_charge (10); };
+ void() kn_runatk2 = [$runattack2, kn_runatk3] { ai_charge_side (); };
+ void() kn_runatk3 = [$runattack3, kn_runatk4] { ai_charge_side (); };
+ void() kn_runatk4 = [$runattack4, kn_runatk5] { ai_charge_side (); };
+ void() kn_runatk5 = [$runattack5, kn_runatk6] { ai_melee_side (); };
+ void() kn_runatk6 = [$runattack6, kn_runatk7] { ai_melee_side (); };
+ void() kn_runatk7 = [$runattack7, kn_runatk8] { ai_melee_side (); };
+ void() kn_runatk8 = [$runattack8, kn_runatk9] { ai_melee_side (); };
+ void() kn_runatk9 = [$runattack9, kn_runatk10] { ai_melee_side (); };
+ void() kn_runatk10 = [$runattack10, kn_runatk11] { ai_charge_side (); };
+ void() kn_runatk11 = [$runattack11, kn_run1] { ai_charge (10); };

//--------------------------------------------------------------
// Knight Attack
//--------------------------------------------------------------
- nonvirtual void() atk1 = [$attackb1, atk2]
+ void() kn_atk1 = [$attackb1, kn_atk2]
{
- sound_attack (this, CHAN_WEAPON, "knight/sword1.wav",
+ sound_attack (self, CHAN_WEAPON, "knight/sword1.wav",
1, ATTN_NORM);
ai_charge (0);
};
- nonvirtual void() atk2 = [$attackb2, atk3] { ai_charge (7); };
- nonvirtual void() atk3 = [$attackb3, atk4] { ai_charge (4); };
- nonvirtual void() atk4 = [$attackb4, atk5] { ai_charge (0); };
- nonvirtual void() atk5 = [$attackb5, atk6] { ai_charge (3); };
- nonvirtual void() atk6 = [$attackb6, atk7]
+ void() kn_atk2 = [$attackb2, kn_atk3] { ai_charge (7); };
+ void() kn_atk3 = [$attackb3, kn_atk4] { ai_charge (4); };
+ void() kn_atk4 = [$attackb4, kn_atk5] { ai_charge (0); };
+ void() kn_atk5 = [$attackb5, kn_atk6] { ai_charge (3); };
+ void() kn_atk6 = [$attackb6, kn_atk7]
{
ai_charge (4);
ai_melee ();
};
- nonvirtual void() atk7 = [$attackb7, atk8]
+ void() kn_atk7 = [$attackb7, kn_atk8]
{
ai_charge (1);
ai_melee ();
};
- nonvirtual void() atk8 = [$attackb8, atk9]
+ void() kn_atk8 = [$attackb8, kn_atk9]
{
ai_charge (3);
ai_melee ();
};
- nonvirtual void() atk9 = [$attackb9, atk10] { ai_charge (1); };
- nonvirtual void() atk10 = [$attackb10, run1] { ai_charge (5); };
+ void() kn_atk9 = [$attackb9, kn_atk10] { ai_charge (1); };
+ void() kn_atk10 = [$attackb10, kn_run1] { ai_charge (5); };

- // nonvirtual void() atk9 = [$attack9, atk10] { };
- // nonvirtual void() atk10 = [$attack10, atk11] { };
- // nonvirtual void() atk11 = [$attack11, run1] { };
+ // void() kn_atk9 = [$attack9, kn_atk10] { };
+ // void() kn_atk10 = [$attack10, kn_atk11] { };
+ // void() kn_atk11 = [$attack11, kn_run1] { };

//--------------------------------------------------------------
// Knight Bowing / Kneeling state
//--------------------------------------------------------------
- nonvirtual void() bow1 = [$kneel1, bow2] { ai_turn (); };
- nonvirtual void() bow2 = [$kneel2, bow3] { ai_turn (); };
- nonvirtual void() bow3 = [$kneel3, bow4] { ai_turn (); };
- nonvirtual void() bow4 = [$kneel4, bow5] { ai_turn (); };
- nonvirtual void() bow5 = [$kneel5, bow5] { ai_turn (); };
- nonvirtual void() bow6 = [$kneel4, bow7] { ai_turn (); };
- nonvirtual void() bow7 = [$kneel3, bow8] { ai_turn (); };
- nonvirtual void() bow8 = [$kneel2, bow9] { ai_turn (); };
- nonvirtual void() bow9 = [$kneel1, bow10] { ai_turn (); };
- nonvirtual void() bow10 = [$walk1, walk1] { ai_turn (); };
+ void() kn_bow1 = [$kneel1, kn_bow2] { ai_turn (); };
+ void() kn_bow2 = [$kneel2, kn_bow3] { ai_turn (); };
+ void() kn_bow3 = [$kneel3, kn_bow4] { ai_turn (); };
+ void() kn_bow4 = [$kneel4, kn_bow5] { ai_turn (); };
+ void() kn_bow5 = [$kneel5, kn_bow5] { ai_turn (); };
+ void() kn_bow6 = [$kneel4, kn_bow7] { ai_turn (); };
+ void() kn_bow7 = [$kneel3, kn_bow8] { ai_turn (); };
+ void() kn_bow8 = [$kneel2, kn_bow9] { ai_turn (); };
+ void() kn_bow9 = [$kneel1, kn_bow10] { ai_turn (); };
+ void() kn_bow10 = [$walk1, kn_walk1] { ai_turn (); };

//--------------------------------------------------------------
// Knight Pain state A
//--------------------------------------------------------------
- nonvirtual void() pain1 = [$pain1, pain2] { };
- nonvirtual void() pain2 = [$pain2, pain3] { };
- nonvirtual void() pain3 = [$pain3, run1] { };
+ void() kn_pain1 = [$pain1, kn_pain2] { };
+ void() kn_pain2 = [$pain2, kn_pain3] { };
+ void() kn_pain3 = [$pain3, kn_run1] { };

//--------------------------------------------------------------
// Knight Pain state B
//--------------------------------------------------------------
- nonvirtual void() painb1 = [$painb1, painb2] { ai_painforward (0); };
- nonvirtual void() painb2 = [$painb2, painb3] { ai_painforward (3); };
- nonvirtual void() painb3 = [$painb3, painb4] { };
- nonvirtual void() painb4 = [$painb4, painb5] { };
- nonvirtual void() painb5 = [$painb5, painb6] { ai_painforward (2); };
- nonvirtual void() painb6 = [$painb6, painb7] { ai_painforward (4); };
- nonvirtual void() painb7 = [$painb7, painb8] { ai_painforward (2); };
- nonvirtual void() painb8 = [$painb8, painb9] { ai_painforward (5); };
- nonvirtual void() painb9 = [$painb9, painb10] { ai_painforward (5); };
- nonvirtual void() painb10 = [$painb10, painb11] { ai_painforward (0); };
- nonvirtual void() painb11 = [$painb11, run1] { };
+ void() kn_painb1 = [$painb1, kn_painb2] { ai_painforward (0); };
+ void() kn_painb2 = [$painb2, kn_painb3] { ai_painforward (3); };
+ void() kn_painb3 = [$painb3, kn_painb4] { };
+ void() kn_painb4 = [$painb4, kn_painb5] { };
+ void() kn_painb5 = [$painb5, kn_painb6] { ai_painforward (2); };
+ void() kn_painb6 = [$painb6, kn_painb7] { ai_painforward (4); };
+ void() kn_painb7 = [$painb7, kn_painb8] { ai_painforward (2); };
+ void() kn_painb8 = [$painb8, kn_painb9] { ai_painforward (5); };
+ void() kn_painb9 = [$painb9, kn_painb10] { ai_painforward (5); };
+ void() kn_painb10 = [$painb10, kn_painb11] { ai_painforward (0); };
+ void() kn_painb11 = [$painb11, kn_run1] { };

//--------------------------------------------------------------
// Knight Death state A
//--------------------------------------------------------------
- nonvirtual void() die1 = [$death1, die2] { };
- nonvirtual void() die2 = [$death2, die3] { };
- nonvirtual void() die3 = [$death3, die4] { this.solid = SOLID_NOT;};
- nonvirtual void() die4 = [$death4, die5] { };
- nonvirtual void() die5 = [$death5, die6] { };
- nonvirtual void() die6 = [$death6, die7] { };
- nonvirtual void() die7 = [$death7, die8] { };
- nonvirtual void() die8 = [$death8, die9] { };
- nonvirtual void() die9 = [$death9, die10] { };
- nonvirtual void() die10 = [$death10, die10] { };
+ void() kn_die1 = [$death1, kn_die2] { };
+ void() kn_die2 = [$death2, kn_die3] { };
+ void() kn_die3 = [$death3, kn_die4] { self.solid = SOLID_NOT; };
+ void() kn_die4 = [$death4, kn_die5] { };
+ void() kn_die5 = [$death5, kn_die6] { };
+ void() kn_die6 = [$death6, kn_die7] { };
+ void() kn_die7 = [$death7, kn_die8] { };
+ void() kn_die8 = [$death8, kn_die9] { };
+ void() kn_die9 = [$death9, kn_die10] { };
+ void() kn_die10 = [$death10, kn_die10] { };

//--------------------------------------------------------------
// Knight Death state B
//--------------------------------------------------------------
- nonvirtual void() dieb1 = [$deathb1, dieb2 ] { };
- nonvirtual void() dieb2 = [$deathb2, dieb3 ] { };
- nonvirtual void() dieb3 = [$deathb3, dieb4 ] {this.solid = SOLID_NOT;};
- nonvirtual void() dieb4 = [$deathb4, dieb5 ] { };
- nonvirtual void() dieb5 = [$deathb5, dieb6 ] { };
- nonvirtual void() dieb6 = [$deathb6, dieb7 ] { };
- nonvirtual void() dieb7 = [$deathb7, dieb8 ] { };
- nonvirtual void() dieb8 = [$deathb8, dieb9 ] { };
- nonvirtual void() dieb9 = [$deathb9, dieb10] { };
- nonvirtual void() dieb10 = [$deathb10, dieb11] { };
- nonvirtual void() dieb11 = [$deathb11, dieb11] { };
+ void() kn_dieb1 = [$deathb1, kn_dieb2 ] { };
+ void() kn_dieb2 = [$deathb2, kn_dieb3 ] { };
+ void() kn_dieb3 = [$deathb3, kn_dieb4 ] { self.solid = SOLID_NOT; };
+ void() kn_dieb4 = [$deathb4, kn_dieb5 ] { };
+ void() kn_dieb5 = [$deathb5, kn_dieb6 ] { };
+ void() kn_dieb6 = [$deathb6, kn_dieb7 ] { };
+ void() kn_dieb7 = [$deathb7, kn_dieb8 ] { };
+ void() kn_dieb8 = [$deathb8, kn_dieb9 ] { };
+ void() kn_dieb9 = [$deathb9, kn_dieb10] { };
+ void() kn_dieb10 = [$deathb10, kn_dieb11] { };
+ void() kn_dieb11 = [$deathb11, kn_dieb11] { };

//==============================================================
// Interaction
@@ -315,90 +362,77 @@ class monster_knight: base_walkmonster
//--------------------------------------------------------------
// knight_pain
//--------------------------------------------------------------
- virtual void(entity attacker, float damage) do_damage =
+ void(entity attacker, float damage) monster_knight_pain =
{
- if (this.pain_finished > time)
+ if (self.pain_finished > time)
return;

local float r = random ();

- sound_pain (this, CHAN_VOICE, "knight/khurt.wav",
+ sound_pain (self, CHAN_VOICE, "knight/khurt.wav",
1, ATTN_NORM);

if (r < 0.85)
{
- this.pain1 ();
- this.pain_finished = time + 1;
+ kn_pain1 ();
+ self.pain_finished = time + 1;
}
else
{
- this.painb1 ();
- this.pain_finished = time + 1;
+ kn_painb1 ();
+ self.pain_finished = time + 1;
}
};

//--------------------------------------------------------------
// knight_die
//--------------------------------------------------------------
- virtual void() do_destroy =
+ void() monster_knight_destroy =
{
// check for gib
- if (this.health < -40)
+ if (self.health < -40)
{
- sound (this, CHAN_VOICE, "player/udeath.wav",
+ sound (self, CHAN_VOICE, "player/udeath.wav",
1, ATTN_NORM);

// dumptruck_ds custom_mdls
- if (this.mdl_head != "")
- {
- ThrowHead (this.mdl_head, this.health);
- }
+ if (self.mdl_head != "")
+ throw_head (self.mdl_head, self.health);
else
- {
- ThrowHead ("progs/h_knight.mdl", this.health);
- }
+ throw_head ("progs/h_knight.mdl", self.health);

- // ThrowGib ("progs/gib1.mdl", this.health);
- // ThrowGib ("progs/gib2.mdl", this.health);
- // ThrowGib ("progs/gib3.mdl", this.health);
+ // ThrowGib ("progs/gib1.mdl", self.health);
+ // ThrowGib ("progs/gib2.mdl", self.health);
+ // ThrowGib ("progs/gib3.mdl", self.health);

// custom models -- dumptruck_ds
- if (this.mdl_gib1 != "")
- {
- ThrowGib (this.mdl_gib1, this.health);
- }
+ if (self.mdl_gib1 != "")
+ throw_gib (self.mdl_gib1, self.health);
else
- {
- ThrowGib ("progs/gib1.mdl", this.health);
- }
- if (this.mdl_gib2 != "")
- {
- ThrowGib (this.mdl_gib2, this.health);
- }
+ throw_gib ("progs/gib1.mdl", self.health);
+
+ if (self.mdl_gib2 != "")
+ throw_gib (self.mdl_gib2, self.health);
else
- {
- ThrowGib ("progs/gib2.mdl", this.health);
- }
- if (this.mdl_gib3 != "")
- {
- ThrowGib (this.mdl_gib3, this.health);
- }
+ throw_gib ("progs/gib2.mdl", self.health);
+
+ if (self.mdl_gib3 != "")
+ throw_gib (self.mdl_gib3, self.health);
else
- {
- ThrowGib ("progs/gib3.mdl", this.health);
- }
- base_item::drop_stuff (this);
+ throw_gib ("progs/gib3.mdl", self.health);
+
+ base_item_drop_stuff (self);
return;
}

// regular death
- sound_death (this, CHAN_VOICE, "knight/kdeath.wav",
+ sound_death (self, CHAN_VOICE, "knight/kdeath.wav",
1, ATTN_NORM);
- base_item::drop_stuff (this);
+ base_item_drop_stuff (self);
if (random() < 0.5)
- this.die1 ();
+ kn_die1 ();
else
- this.dieb1 ();
+ kn_dieb1 ();
};

//==============================================================
@@ -406,67 +440,76 @@ class monster_knight: base_walkmonster
//==============================================================

//--------------------------------------------------------------
- virtual void() init_spawned =
+ void(entity e) monster_knight_init =
{
- if (this.spawnflags & I_AM_TURRET)
+ if (e.spawnflags & I_AM_TURRET)
objerror("Incompatible spawnflag: TURRET_MODE\n");

if (deathmatch)
{
- remove (this);
+ remove (e);
return;
}

+ e.classname = "monster_knight";
+ e.classtype = CT_MONSTER_KNIGHT;
+
// dumptruck_ds custom_mdls
- precache_body_model ("progs/knight.mdl");
- precache_head_model ("progs/h_knight.mdl");
+ precache_body_model (e, "progs/knight.mdl");
+ precache_head_model (e, "progs/h_knight.mdl");
// dumptruck_ds
- precache_sound_death ("knight/kdeath.wav");
- precache_sound_pain ("knight/khurt.wav");
- precache_sound_sight ("knight/ksight.wav");
- precache_sound_attack ("knight/sword1.wav");
- precache_sound_misc ("knight/sword2.wav");
- precache_sound_idle ("knight/idle.wav");
+ precache_sound_death (e, "knight/kdeath.wav");
+ precache_sound_pain (e, "knight/khurt.wav");
+ precache_sound_sight (e, "knight/ksight.wav");
+ precache_sound_attack (e, "knight/sword1.wav");
+ precache_sound_misc (e, "knight/sword2.wav");
+ precache_sound_idle (e, "knight/idle.wav");

- precache_gib1 ("progs/gib1.mdl");
- precache_gib2 ("progs/gib2.mdl");
- precache_gib3 ("progs/gib3.mdl");
+ precache_gib1 (e, "progs/gib1.mdl");
+ precache_gib2 (e, "progs/gib2.mdl");
+ precache_gib3 (e, "progs/gib3.mdl");

- this.solid = SOLID_SLIDEBOX;
- this.movetype = MOVETYPE_STEP;
+ e.solid = SOLID_SLIDEBOX;
+ e.movetype = MOVETYPE_STEP;

- body_model ("progs/knight.mdl"); // dumptruck_ds custom_mdls
- // setmodel (this, "progs/knight.mdl");
+ // dumptruck_ds custom_mdls
+ body_model (e, "progs/knight.mdl");
+ // setmodel (e, "progs/knight.mdl");

- setsize (this, '-16 -16 -24', '16 16 40');
+ setsize (e, '-16 -16 -24', '16 16 40');

- if (!this.health)
+ if (!e.health)
// thanks RennyC -- dumptruck_ds
- this.health = 75;
+ e.health = 75;

- this.think_stand = this.stand1;
- this.think_walk = this.walk1;
- this.think_run = this.run1;
- this.think_melee = this.atk1;
+ e.sightsound = monster_knight_sightsound;
+ e.think_stand = kn_stand1;
+ e.think_walk = kn_walk1;
+ e.think_run = kn_run1;
+ e.think_melee = kn_atk1;
// Berserk test from
// http://celephais.net/board/view_thread.php?id=4&start=3465
// -- dumptruck_ds
- if !(this.berserk)
- this.th_pain = this.do_damage;
+ if !(e.berserk)
+ e.pain = monster_knight_pain;
else
- this.th_pain = sub_nullpain;
- this.th_die = this.do_destroy;
+ e.pain = sub_nullpain;
+ e.destroy = monster_knight_destroy;

// walkmonster_start
- super::init_spawned ();
+ base_walkmonster_init (e);
};

//--------------------------------------------------------------
void() monster_knight =
{
- this.classtype = CT_MONSTER_KNIGHT;
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ monster_knight_init (self);
};
-};
+// };

/* Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds */

@@ -477,11 +520,12 @@ class monster_knight: base_walkmonster
*/
void() monster_dead_knight =
{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
return;

- precache_model("progs/knight.mdl");
- setmodel(self, "progs/knight.mdl");
+ precache_model ("progs/knight.mdl");
+ setmodel (self, "progs/knight.mdl");
if (self.spawnflags & 2)
{
self.frame = $death10;
@@ -489,7 +533,7 @@ void() monster_dead_knight =
if (self.spawnflags & 1)
{
self.solid = SOLID_BBOX;
- setsize(self,'-25.56 -14.56 -50.49','26.45 40.2 30');
+ setsize (self,'-25.56 -14.56 -50.49','26.45 40.2 30');
}
else
{
@@ -502,7 +546,7 @@ void() monster_dead_knight =
if (self.spawnflags & 1)
{
self.solid = SOLID_BBOX;
- setsize(self,'-30.36 -45.6 -50.18','28.29 11.59 30');
+ setsize (self,'-30.36 -45.6 -50.18','28.29 11.59 30');
}
else
{

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

Diff qc/monsters/ogre.qc

diff --git a/qc/monsters/ogre.qc b/qc/monsters/ogre.qc
index 3a21fdc..788724f 100644
--- a/qc/monsters/ogre.qc
+++ b/qc/monsters/ogre.qc
@@ -5,13 +5,94 @@
//======================================================================
// constants
//======================================================================
+
const float MONSTER_FLAK_OGRE = 4;
const float FL_NOSELECT = 8192; // ignored by entity selector
const float OGRE_DEFAULT_ELEVATION = 30;// angle to fire at if enemy too far

//======================================================================
+// forward declarations
+//======================================================================
+
+// monster_ogre
+void() monster_ogre_sightsound; // AI & attacks
+float() monster_ogre_checkattack;
+void() monster_ogre_fire_spike;
+void() monster_ogre_fire_lavaball;
+void() monster_ogre_attack_ranged;
+void(float side) monster_ogre_attack_chainsaw;
+void() monster_ogre_attack_melee;
+void() ogre_stand1; void() ogre_stand2; void() ogre_stand3; void() ogre_stand4;
+void() ogre_stand5; void() ogre_stand6; void() ogre_stand7; void() ogre_stand8;
+void() ogre_stand9;
+void() ogre_walk1; void() ogre_walk2; void() ogre_walk3; void() ogre_walk4;
+void() ogre_walk5; void() ogre_walk6; void() ogre_walk7; void() ogre_walk8;
+void() ogre_walk9; void() ogre_walk10; void() ogre_walk11; void() ogre_walk12;
+void() ogre_walk13; void() ogre_walk14; void() ogre_walk15; void() ogre_walk16;
+void() ogre_run1; void() ogre_run2; void() ogre_run3; void() ogre_run4;
+void() ogre_run5; void() ogre_run6; void() ogre_run7; void() ogre_run8;
+void() ogre_smash1; void() ogre_smash2; void() ogre_smash3; void() ogre_smash4;
+void() ogre_smash5; void() ogre_smash6; void() ogre_smash7; void() ogre_smash8;
+void() ogre_smash9; void() ogre_smash10; void() ogre_smash11;
+void() ogre_smash12; void() ogre_smash13; void() ogre_smash14;
+void() ogre_swing1; void() ogre_swing2; void() ogre_swing3; void() ogre_swing4;
+void() ogre_swing5; void() ogre_swing6; void() ogre_swing7; void() ogre_swing8;
+void() ogre_swing9; void() ogre_swing10; void() ogre_swing11;
+void() ogre_swing12; void() ogre_swing13; void() ogre_swing14;
+void() ogre_nail1; void() ogre_nail2; void() ogre_nail3; void() ogre_nail4;
+void() ogre_nail5; void() ogre_nail6; void() ogre_nail7;
+void() ogre_tur_atk1; void() ogre_tur_atk2; void() ogre_tur_atk3;
+void() ogre_tur_atk4; void() ogre_tur_atk5; void() ogre_tur_atk6;
+void() ogre_tur_atk7; void() ogre_tur_atk8; void() ogre_tur_atk9;
+void() ogre_tur_seek1; void() ogre_tur_seek2; void() ogre_tur_seek3;
+void() ogre_tur_seek4; void() ogre_tur_seek5; void() ogre_tur_seek6;
+void() ogre_tur_seek7; void() ogre_tur_seek8; void() ogre_tur_seek9;
+void() ogre_pain1; void() ogre_pain2; void() ogre_pain3; void() ogre_pain4;
+void() ogre_pain5;
+void() ogre_painb1; void() ogre_painb2; void() ogre_painb3;
+void() ogre_painc1; void() ogre_painc2; void() ogre_painc3; void() ogre_painc4;
+void() ogre_painc5; void() ogre_painc6;
+void() ogre_paind1; void() ogre_paind2; void() ogre_paind3; void() ogre_paind4;
+void() ogre_paind5; void() ogre_paind6; void() ogre_paind7; void() ogre_paind8;
+void() ogre_paind9; void() ogre_paind10; void() ogre_paind11;
+void() ogre_paind12; void() ogre_paind13; void() ogre_paind14;
+void() ogre_paind15; void() ogre_paind16;
+void() ogre_paine1; void() ogre_paine2; void() ogre_paine3; void() ogre_paine4;
+void() ogre_paine5; void() ogre_paine6; void() ogre_paine7; void() ogre_paine8;
+void() ogre_paine9; void() ogre_paine10; void() ogre_paine11;
+void() ogre_paine12; void() ogre_paine13; void() ogre_paine14;
+void() ogre_paine15;
+void() ogre_die1; void() ogre_die2; void() ogre_die3; void() ogre_die4;
+void() ogre_die5; void() ogre_die6; void() ogre_die7; void() ogre_die8;
+void() ogre_die9; void() ogre_die10; void() ogre_die11;
+void() ogre_die12; void() ogre_die13; void() ogre_die14;
+void() ogre_bdie1; void() ogre_bdie2; void() ogre_bdie3; void() ogre_bdie4;
+void() ogre_bdie5; void() ogre_bdie6; void() ogre_bdie7; void() ogre_bdie8;
+void() ogre_bdie9; void() ogre_bdie10;
+void(entity attacker, float damage) monster_ogre_pain; // interaction
+void() monster_ogre_destroy;
+void(entity e) monster_ogre_init; // initialization
+void() monster_ogre;
+
+// monster_ogre_marksman
+void() ogre_mm_nail1; void() ogre_mm_nail2; void() ogre_mm_nail3;
+void() ogre_mm_nail4;
+void() ogre_mm_t_atk1; void() ogre_mm_t_atk2; void() ogre_mm_t_atk3;
+void() ogre_mm_t_atk4; void() ogre_mm_t_atk5; void() ogre_mm_t_atk6;
+void() ogre_mm_t_atk7; void() ogre_mm_t_atk8; void() ogre_mm_t_atk9;
+void() ogre_mm_t_seek1; void() ogre_mm_t_seek2; void() ogre_mm_t_seek3;
+void() ogre_mm_t_seek4; void() ogre_mm_t_seek5; void() ogre_mm_t_seek6;
+void() ogre_mm_t_seek7; void() ogre_mm_t_seek8; void() ogre_mm_t_seek9;
+void(entity e) monster_ogre_marksman_init;// initialization
+void() monster_ogre_marksman;
+
+// monster_dead_ogre
+void() monster_dead_ogre;
+
+//======================================================================
// frame macros
//======================================================================
+
$cd id1/models/ogre_c
$origin 0 0 24
$base base
@@ -53,6 +134,8 @@ $frame bdeath7 bdeath8 bdeath9 bdeath10

$frame pull1 pull2 pull3 pull4 pull5 pull6 pull7 pull8 pull9 pull10 pull11

+//------------------------------------------------------------------------------
+
/*QUAKED monster_ogre (1 0 0) (-32 -32 -24) (32 32 64) AMBUSH X X TRIGGER_SPAWNED X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ("progs/ogre.mdl");
@@ -121,14 +204,13 @@ obit_method(string) : "When used with obit_name, will set part of the text for a
damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by this number (e.g. 4 = Quad damage)"

*/
-class monster_ogre: base_walkmonster
-{
- float attack_elevation;
-
+//----------------------------------------------------------------------
+// class monster_ogre: base_walkmonster
+// {
//--------------------------------------------------------------
- virtual void() ai_sightsound =
+ void() monster_ogre_sightsound =
{
- sound_sight (this, CHAN_VOICE, "ogre/ogwake.wav",
+ sound_sight (self, CHAN_VOICE, "ogre/ogwake.wav",
1, ATTN_NORM);
};

@@ -137,7 +219,7 @@ class monster_ogre: base_walkmonster
// The player is in view, so decide to move or launch an attack
// Returns FALSE if movement should continue
//--------------------------------------------------------------
- virtual float() ai_checkattack =
+ float() monster_ogre_checkattack =
{
local vector spot1, spot2;
local entity targ;
@@ -145,44 +227,44 @@ class monster_ogre: base_walkmonster

// dprint("OgreCheckAttack\n");
// dumptruck_ds
- if (this.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & I_AM_TURRET)
{
- this.attack_state = AS_MISSILE;
+ self.attack_state = AS_MISSILE;
sub_attackfinished (2 + 2 * random());
return TRUE;
}

if (enemy_range == RANGE_MELEE)
{
- if (this.can_damage(this, this.enemy))
+ if (can_damage(self, self.enemy))
{
- this.attack_state = AS_MELEE;
+ self.attack_state = AS_MELEE;
return TRUE;
}
}

- if (time < this.attack_finished)
+ if (time < self.attack_finished)
return FALSE;

if (!enemy_vis)
return FALSE;

- targ = this.enemy;
+ targ = self.enemy;

// see if any entities are in the way of the shot
- spot1 = this.origin + this.view_ofs;
+ spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;

- traceline (spot1, spot2, FALSE, this);
+ traceline (spot1, spot2, FALSE, self);

if (trace_inopen && trace_inwater)
// sight line crossed contents
return FALSE;

- if ((this.spawnflags & I_AM_TURRET) && (trace_ent != targ))
+ if ((self.spawnflags & I_AM_TURRET) && (trace_ent != targ))
{
// dprint("trace_ent...\n");
- this.attack_state = AS_TURRET;
+ self.attack_state = AS_TURRET;
return FALSE;
}

@@ -191,7 +273,7 @@ class monster_ogre: base_walkmonster
return FALSE;

// missile attack
- if (time < this.attack_finished)
+ if (time < self.attack_finished)
return FALSE;

if (enemy_range == RANGE_FAR)
@@ -203,7 +285,7 @@ class monster_ogre: base_walkmonster
else
chance = 0;

- this.attack_state = AS_MISSILE;
+ self.attack_state = AS_MISSILE;
sub_attackfinished (1 + 2 * random());
return TRUE;
};
@@ -212,59 +294,64 @@ class monster_ogre: base_walkmonster
// OgreFireSpike from insideqc tutorial here:
// http://www.insideqc.com/qctut/lesson-33.shtml
//--------------------------------------------------------------
- nonvirtual void() attack_spike =
+ void() monster_ogre_fire_spike =
{
- sound (this, CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM);
- this.effects = this.effects | EF_MUZZLEFLASH;
+ sound (self, CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM);
+ self.effects = self.effects | EF_MUZZLEFLASH;

- this.attack_finished = time + 0.7;
- // this.attack_finished = time + 0.2;
+ self.attack_finished = time + 0.7;
+ // self.attack_finished = time + 0.2;
// -- dumptruck_ds

// when was makevectors last called? -- CEV
- makevectors (this.angles);
- fire_spike (this.origin + v_right * 4 + '0 0 16',
- this.enemy.origin - this.origin, SPIKE_DUPER_DAMAGE,
+ makevectors (self.angles);
+ base_monster_fire_spike (
+ self.origin + v_right * 4 + '0 0 16',
+ self.enemy.origin - self.origin,
+ SPIKE_DUPER_DAMAGE,
SPIKE_SPEED);
};

//--------------------------------------------------------------
// OgreFireLavaBall by jaycie erysdren 2021-09-14
//--------------------------------------------------------------
- nonvirtual void() attack_lavaball =
+ void() monster_ogre_fire_lavaball =
{
- makevectors (vectoangles(this.enemy.origin - this.origin));
+ makevectors (vectoangles(self.enemy.origin - self.origin));

- this.effects = this.effects | EF_MUZZLEFLASH;
- sound_attack (this, CHAN_AUTO, "boss1/throw.wav", 1, ATTN_NORM);
+ self.effects = self.effects | EF_MUZZLEFLASH;
+ sound_attack (self, CHAN_AUTO, "boss1/throw.wav", 1, ATTN_NORM);

// damage should be 40, 40 -- TODO CEV
// custom lavaball speed -- CEV
- fire_lavaball (this.origin + v_right * 4 + '0 0 16',
- this.enemy.origin - this.origin, 600);
+ base_monster_fire_lavaball (
+ self.origin + v_right * 4 + '0 0 16',
+ self.enemy.origin - self.origin, 600);
};

//--------------------------------------------------------------
- nonvirtual void() attack_ranged =
+ void() monster_ogre_attack_ranged =
{
- switch (this.style)
+ switch (self.style)
{
case 0:
- fire_grenade (this.origin, 40, 40, 0);
+ base_monster_fire_grenade (
+ self.origin, 40, 40, 0);
break;
case 1:
- fire_flak (this.origin + '0 0 16', 800);
+ base_monster_fire_flak (
+ self.origin + '0 0 16', 800);
break;
case 2:
- attack_spike ();
+ monster_ogre_fire_spike ();
break;
case 3:
- fire_multigrenade ();
+ base_monster_fire_multigrenade ();
break;
case 4:
- attack_lavaball ();
+ monster_ogre_fire_lavaball ();
// used for initial attack sound dumptruck_ds
- sound_misc2 (this, CHAN_WEAPON,
+ sound_misc2 (self, CHAN_WEAPON,
"shalrath/attack2.wav",
1, ATTN_NORM);
break;
@@ -274,34 +361,34 @@ class monster_ogre: base_walkmonster
//--------------------------------------------------------------
// chainsaw -- FIXME
//--------------------------------------------------------------
- nonvirtual void(float side) attack_chainsaw =
+ void(float side) monster_ogre_attack_chainsaw =
{
local vector delta;
local float ldmg;

- if (!this.enemy)
+ if (!self.enemy)
return;
- if (!this.can_damage(this, this.enemy))
+ if (!can_damage(self, self.enemy))
return;

ai_charge (10);

- delta = this.enemy.origin - this.origin;
+ delta = self.enemy.origin - self.origin;

if (vlen(delta) > 100)
return;

ldmg = (random() + random() + random()) * 4;
- this.t_damage2 (this.enemy, this, this, ldmg);
+ t_damage2 (self.enemy, self, self, ldmg);

if (side)
{
- makevectors (this.angles);
+ makevectors (self.angles);
if (side == 1)
- SpawnMeatSpray (this.origin + v_forward * 16,
+ spawn_meatspray (self.origin + v_forward * 16,
crandom() * 100 * v_right);
else
- SpawnMeatSpray (this.origin + v_forward * 16,
+ spawn_meatspray (self.origin + v_forward * 16,
side * v_right);
}
};
@@ -309,197 +396,200 @@ class monster_ogre: base_walkmonster
//--------------------------------------------------------------
// ogre_melee
//--------------------------------------------------------------
- nonvirtual void() attack_melee =
+ void() monster_ogre_attack_melee =
{
if (random() > 0.5)
- this.smash1 ();
+ ogre_smash1 ();
else
- this.swing1 ();
+ ogre_swing1 ();
};

//--------------------------------------------------------------
// Ogre Standing functions
//--------------------------------------------------------------
- nonvirtual void() stand1 = [$stand1, stand2] { ai_stand (); };
- nonvirtual void() stand2 = [$stand2, stand3] { ai_stand (); };
- nonvirtual void() stand3 = [$stand3, stand4] { ai_stand (); };
- nonvirtual void() stand4 = [$stand4, stand5] { ai_stand (); };
- nonvirtual void() stand5 = [$stand5, stand6]
+ void() ogre_stand1 = [$stand1, ogre_stand2] { ai_stand (); };
+ void() ogre_stand2 = [$stand2, ogre_stand3] { ai_stand (); };
+ void() ogre_stand3 = [$stand3, ogre_stand4] { ai_stand (); };
+ void() ogre_stand4 = [$stand4, ogre_stand5] { ai_stand (); };
+ void() ogre_stand5 = [$stand5, ogre_stand6]
{
if (random() < 0.2)
- sound_idle (this, CHAN_VOICE, "ogre/ogidle.wav",
+ sound_idle (self, CHAN_VOICE, "ogre/ogidle.wav",
1, ATTN_IDLE);
ai_stand ();
};
- nonvirtual void() stand6 = [$stand6, stand7] { ai_stand (); };
- nonvirtual void() stand7 = [$stand7, stand8] { ai_stand (); };
- nonvirtual void() stand8 = [$stand8, stand9] { ai_stand (); };
- nonvirtual void() stand9 = [$stand9, stand1] { ai_stand (); };
+ void() ogre_stand6 = [$stand6, ogre_stand7] { ai_stand (); };
+ void() ogre_stand7 = [$stand7, ogre_stand8] { ai_stand (); };
+ void() ogre_stand8 = [$stand8, ogre_stand9] { ai_stand (); };
+ void() ogre_stand9 = [$stand9, ogre_stand1] { ai_stand (); };

//--------------------------------------------------------------
// Ogre Walking functions
//--------------------------------------------------------------
- nonvirtual void() walk1 = [$walk1, walk2] { ai_walk (3); };
- nonvirtual void() walk2 = [$walk2, walk3] { ai_walk (2); };
- nonvirtual void() walk3 = [$walk3, walk4]
+ void() ogre_walk1 = [$walk1, ogre_walk2] { ai_walk (3); };
+ void() ogre_walk2 = [$walk2, ogre_walk3] { ai_walk (2); };
+ void() ogre_walk3 = [$walk3, ogre_walk4]
{
ai_walk (2);
if (random() < 0.2)
- sound_idle (this, CHAN_VOICE, "ogre/ogidle.wav",
+ sound_idle (self, CHAN_VOICE, "ogre/ogidle.wav",
1, ATTN_IDLE);
};
- nonvirtual void() walk4 = [$walk4,walk5] { ai_walk (2); };
- nonvirtual void() walk5 = [$walk5,walk6] { ai_walk (2); };
- nonvirtual void() walk6 = [$walk6,walk7]
+ void() ogre_walk4 = [$walk4, ogre_walk5] { ai_walk (2); };
+ void() ogre_walk5 = [$walk5, ogre_walk6] { ai_walk (2); };
+ void() ogre_walk6 = [$walk6, ogre_walk7]
{
ai_walk (5);
if (random() < 0.1)
- sound_misc (this, CHAN_VOICE, "ogre/ogdrag.wav",
+ sound_misc (self, CHAN_VOICE, "ogre/ogdrag.wav",
1, ATTN_IDLE);
};
- nonvirtual void() walk7 = [$walk7, walk8] { ai_walk (3); };
- nonvirtual void() walk8 = [$walk8, walk9] { ai_walk (2); };
- nonvirtual void() walk9 = [$walk9, walk10] { ai_walk (3); };
- nonvirtual void() walk10 = [$walk10, walk11] { ai_walk (1); };
- nonvirtual void() walk11 = [$walk11, walk12] { ai_walk (2); };
- nonvirtual void() walk12 = [$walk12, walk13] { ai_walk (3); };
- nonvirtual void() walk13 = [$walk13, walk14] { ai_walk (3); };
- nonvirtual void() walk14 = [$walk14, walk15] { ai_walk (3); };
- nonvirtual void() walk15 = [$walk15, walk16] { ai_walk (3); };
- nonvirtual void() walk16 = [$walk16, walk1] { ai_walk (4); };
+ void() ogre_walk7 = [$walk7, ogre_walk8] { ai_walk (3); };
+ void() ogre_walk8 = [$walk8, ogre_walk9] { ai_walk (2); };
+ void() ogre_walk9 = [$walk9, ogre_walk10] { ai_walk (3); };
+ void() ogre_walk10 = [$walk10, ogre_walk11] { ai_walk (1); };
+ void() ogre_walk11 = [$walk11, ogre_walk12] { ai_walk (2); };
+ void() ogre_walk12 = [$walk12, ogre_walk13] { ai_walk (3); };
+ void() ogre_walk13 = [$walk13, ogre_walk14] { ai_walk (3); };
+ void() ogre_walk14 = [$walk14, ogre_walk15] { ai_walk (3); };
+ void() ogre_walk15 = [$walk15, ogre_walk16] { ai_walk (3); };
+ void() ogre_walk16 = [$walk16, ogre_walk1] { ai_walk (4); };

//--------------------------------------------------------------
// Ogre Running functions
//--------------------------------------------------------------
- nonvirtual void() run1 = [$run1, run2]
+ void() ogre_run1 = [$run1, ogre_run2]
{
ai_run (9);
if (random() < 0.2)
- sound_misc1 (this, CHAN_VOICE, "ogre/ogidle2.wav",
+ sound_misc1 (self, CHAN_VOICE, "ogre/ogidle2.wav",
1, ATTN_IDLE);
};
- nonvirtual void() run2 = [$run2, run3] { ai_run (12); };
- nonvirtual void() run3 = [$run3, run4] { ai_run (8); };
- nonvirtual void() run4 = [$run4, run5] { ai_run (22); };
- nonvirtual void() run5 = [$run5, run6] { ai_run (16); };
- nonvirtual void() run6 = [$run6, run7] { ai_run (4); };
- nonvirtual void() run7 = [$run7, run8] { ai_run (13); };
- nonvirtual void() run8 = [$run8, run1] { ai_run (24); };
+ void() ogre_run2 = [$run2, ogre_run3] { ai_run (12); };
+ void() ogre_run3 = [$run3, ogre_run4] { ai_run (8); };
+ void() ogre_run4 = [$run4, ogre_run5] { ai_run (22); };
+ void() ogre_run5 = [$run5, ogre_run6] { ai_run (16); };
+ void() ogre_run6 = [$run6, ogre_run7] { ai_run (4); };
+ void() ogre_run7 = [$run7, ogre_run8] { ai_run (13); };
+ void() ogre_run8 = [$run8, ogre_run1] { ai_run (24); };

//--------------------------------------------------------------
// Ogre Smash Attack
//--------------------------------------------------------------
- nonvirtual void() smash1 = [$smash1, smash2]
+ void() ogre_smash1 = [$smash1, ogre_smash2]
{
ai_charge (6);
- sound_attack (this, CHAN_WEAPON, "ogre/ogsawatk.wav",
+ sound_attack (self, CHAN_WEAPON, "ogre/ogsawatk.wav",
1, ATTN_NORM);
};
- nonvirtual void() smash2 = [$smash2, smash3] { ai_charge (0); };
- nonvirtual void() smash3 = [$smash3, smash4] { ai_charge (0); };
- nonvirtual void() smash4 = [$smash4, smash5] { ai_charge (1); };
- nonvirtual void() smash5 = [$smash5, smash6] { ai_charge (4); };
- nonvirtual void() smash6 = [$smash6, smash7]
+ void() ogre_smash2 = [$smash2, ogre_smash3] { ai_charge (0); };
+ void() ogre_smash3 = [$smash3, ogre_smash4] { ai_charge (0); };
+ void() ogre_smash4 = [$smash4, ogre_smash5] { ai_charge (1); };
+ void() ogre_smash5 = [$smash5, ogre_smash6] { ai_charge (4); };
+ void() ogre_smash6 = [$smash6, ogre_smash7]
{
ai_charge (4);
- attack_chainsaw (0);
+ monster_ogre_attack_chainsaw (0);
};
- nonvirtual void() smash7 = [$smash7, smash8]
+ void() ogre_smash7 = [$smash7, ogre_smash8]
{
ai_charge (4);
- attack_chainsaw (0);
+ monster_ogre_attack_chainsaw (0);
};
- nonvirtual void() smash8 = [$smash8, smash9]
+ void() ogre_smash8 = [$smash8, ogre_smash9]
{
ai_charge (10);
- attack_chainsaw (0);
+ monster_ogre_attack_chainsaw (0);
};
- nonvirtual void() smash9 = [$smash9,smash10]
+ void() ogre_smash9 = [$smash9, ogre_smash10]
{
ai_charge (13);
- attack_chainsaw (0);
+ monster_ogre_attack_chainsaw (0);
+ };
+ void() ogre_smash10 = [$smash10, ogre_smash11]
+ {
+ monster_ogre_attack_chainsaw(1);
};
- nonvirtual void() smash10 = [$smash10, smash11] { attack_chainsaw(1); };
- nonvirtual void() smash11 = [$smash11, smash12]
+ void() ogre_smash11 = [$smash11, ogre_smash12]
{
ai_charge (2);
- attack_chainsaw (0);
+ monster_ogre_attack_chainsaw (0);
// slight variation
- // this.nextthink = this.nextthink + random()*0.2;};
+ // self.nextthink = self.nextthink + random()*0.2;};
// 1998-08-14 Incorrect setting of nextthink fix
// by Maddes/Lord Sméagol
- this.nextthink = time + 0.1 + random() * 0.2;
+ self.nextthink = time + 0.1 + random() * 0.2;
};
- nonvirtual void() smash12 = [$smash12, smash13] { ai_charge (0); };
- nonvirtual void() smash13 = [$smash13, smash14] { ai_charge (4); };
- nonvirtual void() smash14 = [$smash14, run1] { ai_charge (12); };
+ void() ogre_smash12 = [$smash12, ogre_smash13] { ai_charge (0); };
+ void() ogre_smash13 = [$smash13, ogre_smash14] { ai_charge (4); };
+ void() ogre_smash14 = [$smash14, ogre_run1] { ai_charge (12); };

//--------------------------------------------------------------
// Ogre Swing Attack
//--------------------------------------------------------------
- nonvirtual void() swing1 = [$swing1, swing2]
+ void() ogre_swing1 = [$swing1, ogre_swing2]
{
ai_charge (11);
- sound_attack (this, CHAN_WEAPON, "ogre/ogsawatk.wav",
+ sound_attack (self, CHAN_WEAPON, "ogre/ogsawatk.wav",
1, ATTN_NORM);
};
- nonvirtual void() swing2 = [$swing2, swing3] { ai_charge (1); };
- nonvirtual void() swing3 = [$swing3, swing4] { ai_charge (4); };
- nonvirtual void() swing4 = [$swing4, swing5] { ai_charge (13); };
- nonvirtual void() swing5 = [$swing5, swing6]
+ void() ogre_swing2 = [$swing2, ogre_swing3] { ai_charge (1); };
+ void() ogre_swing3 = [$swing3, ogre_swing4] { ai_charge (4); };
+ void() ogre_swing4 = [$swing4, ogre_swing5] { ai_charge (13); };
+ void() ogre_swing5 = [$swing5, ogre_swing6]
{
ai_charge (9);
- attack_chainsaw (0);
- this.angles_y = this.angles_y + random() * 25;
+ monster_ogre_attack_chainsaw (0);
+ self.angles_y = self.angles_y + random() * 25;
};
- nonvirtual void() swing6 = [$swing6, swing7]
+ void() ogre_swing6 = [$swing6, ogre_swing7]
{
- attack_chainsaw (200);
- this.angles_y = this.angles_y + random() * 25;
+ monster_ogre_attack_chainsaw (200);
+ self.angles_y = self.angles_y + random() * 25;
};
- nonvirtual void() swing7 = [$swing7,swing8]
+ void() ogre_swing7 = [$swing7, ogre_swing8]
{
- attack_chainsaw (0);
- this.angles_y = this.angles_y + random() * 25;
+ monster_ogre_attack_chainsaw (0);
+ self.angles_y = self.angles_y + random() * 25;
};
- nonvirtual void() swing8 = [$swing8,swing9]
+ void() ogre_swing8 = [$swing8, ogre_swing9]
{
- attack_chainsaw (0);
- this.angles_y = this.angles_y + random() * 25;
+ monster_ogre_attack_chainsaw (0);
+ self.angles_y = self.angles_y + random() * 25;
};
- nonvirtual void() swing9 = [$swing9,swing10]
+ void() ogre_swing9 = [$swing9, ogre_swing10]
{
- attack_chainsaw (0);
- this.angles_y = this.angles_y + random() * 25;
+ monster_ogre_attack_chainsaw (0);
+ self.angles_y = self.angles_y + random() * 25;
};
- nonvirtual void() swing10 = [$swing10, swing11]
+ void() ogre_swing10 = [$swing10, ogre_swing11]
{
- attack_chainsaw (-200);
- this.angles_y = this.angles_y + random() * 25;
+ monster_ogre_attack_chainsaw (-200);
+ self.angles_y = self.angles_y + random() * 25;
};
- nonvirtual void() swing11 = [$swing11,swing12]
+ void() ogre_swing11 = [$swing11, ogre_swing12]
{
- attack_chainsaw (0);
- this.angles_y = this.angles_y + random() * 25;
+ monster_ogre_attack_chainsaw (0);
+ self.angles_y = self.angles_y + random() * 25;
};
- nonvirtual void() swing12 = [$swing12, swing13] { ai_charge (3); };
- nonvirtual void() swing13 = [$swing13, swing14] { ai_charge (8); };
- nonvirtual void() swing14 = [$swing14, run1] { ai_charge (9); };
+ void() ogre_swing12 = [$swing12, ogre_swing13] { ai_charge (3); };
+ void() ogre_swing13 = [$swing13, ogre_swing14] { ai_charge (8); };
+ void() ogre_swing14 = [$swing14, ogre_run1] { ai_charge (9); };

//--------------------------------------------------------------
// Ogre Projectile Attack
//--------------------------------------------------------------
- nonvirtual void() nail1 = [$shoot1, nail2] { ai_face (); };
- nonvirtual void() nail2 = [$shoot2, nail3] { ai_face (); };
- nonvirtual void() nail3 = [$shoot2, nail4] { ai_face (); };
- nonvirtual void() nail4 = [$shoot3, nail5]
+ void() ogre_nail1 = [$shoot1, ogre_nail2] { ai_face (); };
+ void() ogre_nail2 = [$shoot2, ogre_nail3] { ai_face (); };
+ void() ogre_nail3 = [$shoot2, ogre_nail4] { ai_face (); };
+ void() ogre_nail4 = [$shoot3, ogre_nail5]
{
ai_face ();
- this.attack_ranged ();
+ monster_ogre_attack_ranged ();
};
- nonvirtual void() nail5 = [$shoot4, nail6] { ai_face (); };
- nonvirtual void() nail6 = [$shoot5, nail7] { ai_face (); };
- nonvirtual void() nail7 = [$shoot6, run1] { ai_face (); };
+ void() ogre_nail5 = [$shoot4, ogre_nail6] { ai_face (); };
+ void() ogre_nail6 = [$shoot5, ogre_nail7] { ai_face (); };
+ void() ogre_nail7 = [$shoot6, ogre_run1] { ai_face (); };

/////////////////////////
// turret frames START //
@@ -508,38 +598,38 @@ class monster_ogre: base_walkmonster
//--------------------------------------------------------------
// Ogre Turret Attack
//--------------------------------------------------------------
- nonvirtual void() tur_atk1 = [$shoot1, tur_atk2] { ai_face (); };
- nonvirtual void() tur_atk2 = [$shoot2, tur_atk3] { ai_face (); };
- nonvirtual void() tur_atk3 = [$shoot2, tur_atk4] { ai_face (); };
- nonvirtual void() tur_atk4 = [$shoot3, tur_atk5]
+ void() ogre_tur_atk1 = [$shoot1, ogre_tur_atk2] { ai_face (); };
+ void() ogre_tur_atk2 = [$shoot2, ogre_tur_atk3] { ai_face (); };
+ void() ogre_tur_atk3 = [$shoot2, ogre_tur_atk4] { ai_face (); };
+ void() ogre_tur_atk4 = [$shoot3, ogre_tur_atk5]
{
ai_face ();
- attack_ranged ();
+ monster_ogre_attack_ranged ();
};
- nonvirtual void() tur_atk5 = [$shoot4, tur_atk6] { ai_face (); };
- nonvirtual void() tur_atk6 = [$shoot5, tur_atk7] { ai_face (); };
- nonvirtual void() tur_atk7 = [$shoot5, tur_atk8] { ai_face (); };
- nonvirtual void() tur_atk8 = [$shoot6, tur_atk9] { ai_face (); };
- nonvirtual void() tur_atk9 = [$shoot6, tur_seek1] { ai_face (); };
+ void() ogre_tur_atk5 = [$shoot4, ogre_tur_atk6] { ai_face (); };
+ void() ogre_tur_atk6 = [$shoot5, ogre_tur_atk7] { ai_face (); };
+ void() ogre_tur_atk7 = [$shoot5, ogre_tur_atk8] { ai_face (); };
+ void() ogre_tur_atk8 = [$shoot6, ogre_tur_atk9] { ai_face (); };
+ void() ogre_tur_atk9 = [$shoot6, ogre_tur_seek1] { ai_face (); };

//--------------------------------------------------------------
// Ogre Turret Seek / Stand
//--------------------------------------------------------------
- nonvirtual void() tur_seek1 = [$stand1, tur_seek2] { ai_run (0);};
- nonvirtual void() tur_seek2 = [$stand2, tur_seek3] { ai_run (0);};
- nonvirtual void() tur_seek3 = [$stand3, tur_seek4] { ai_run (0);};
- nonvirtual void() tur_seek4 = [$stand4, tur_seek5] { ai_run (0);};
- nonvirtual void() tur_seek5 = [$stand5, tur_seek6]
+ void() ogre_tur_seek1 = [$stand1, ogre_tur_seek2] { ai_run (0); };
+ void() ogre_tur_seek2 = [$stand2, ogre_tur_seek3] { ai_run (0); };
+ void() ogre_tur_seek3 = [$stand3, ogre_tur_seek4] { ai_run (0); };
+ void() ogre_tur_seek4 = [$stand4, ogre_tur_seek5] { ai_run (0); };
+ void() ogre_tur_seek5 = [$stand5, ogre_tur_seek6]
{
if (random() < 0.2)
- sound_idle (this, CHAN_VOICE, "ogre/ogidle.wav",
+ sound_idle (self, CHAN_VOICE, "ogre/ogidle.wav",
1, ATTN_IDLE);
ai_run (0);
};
- nonvirtual void() tur_seek6 = [$stand6, tur_seek7] { ai_run (0);};
- nonvirtual void() tur_seek7 = [$stand7, tur_seek8] { ai_run (0);};
- nonvirtual void() tur_seek8 = [$stand8, tur_seek9] { ai_run (0);};
- nonvirtual void() tur_seek9 = [$stand9, tur_seek1] { ai_run (0);};
+ void() ogre_tur_seek6 = [$stand6, ogre_tur_seek7] { ai_run (0); };
+ void() ogre_tur_seek7 = [$stand7, ogre_tur_seek8] { ai_run (0); };
+ void() ogre_tur_seek8 = [$stand8, ogre_tur_seek9] { ai_run (0); };
+ void() ogre_tur_seek9 = [$stand9, ogre_tur_seek1] { ai_run (0); };

/////////////////////////
// turret frames END //
@@ -548,157 +638,153 @@ class monster_ogre: base_walkmonster
//--------------------------------------------------------------
// Ogre Pain state A
//--------------------------------------------------------------
- nonvirtual void() pain1 = [$pain1, pain2] { };
- nonvirtual void() pain2 = [$pain2, pain3] { };
- nonvirtual void() pain3 = [$pain3, pain4] { };
- nonvirtual void() pain4 = [$pain4, pain5] { };
- nonvirtual void() pain5 = [$pain5, run1] { };
+ void() ogre_pain1 = [$pain1, ogre_pain2] { };
+ void() ogre_pain2 = [$pain2, ogre_pain3] { };
+ void() ogre_pain3 = [$pain3, ogre_pain4] { };
+ void() ogre_pain4 = [$pain4, ogre_pain5] { };
+ void() ogre_pain5 = [$pain5, ogre_run1] { };

//--------------------------------------------------------------
// Ogre Pain state B
//--------------------------------------------------------------
- nonvirtual void() painb1 = [$painb1, painb2] { };
- nonvirtual void() painb2 = [$painb2, painb3] { };
- nonvirtual void() painb3 = [$painb3, run1] { };
+ void() ogre_painb1 = [$painb1, ogre_painb2] { };
+ void() ogre_painb2 = [$painb2, ogre_painb3] { };
+ void() ogre_painb3 = [$painb3, ogre_run1] { };

//--------------------------------------------------------------
// Ogre Pain state C
//--------------------------------------------------------------
- nonvirtual void() painc1 = [$painc1, painc2] { };
- nonvirtual void() painc2 = [$painc2, painc3] { };
- nonvirtual void() painc3 = [$painc3, painc4] { };
- nonvirtual void() painc4 = [$painc4, painc5] { };
- nonvirtual void() painc5 = [$painc5, painc6] { };
- nonvirtual void() painc6 = [$painc6, run1] { };
+ void() ogre_painc1 = [$painc1, ogre_painc2] { };
+ void() ogre_painc2 = [$painc2, ogre_painc3] { };
+ void() ogre_painc3 = [$painc3, ogre_painc4] { };
+ void() ogre_painc4 = [$painc4, ogre_painc5] { };
+ void() ogre_painc5 = [$painc5, ogre_painc6] { };
+ void() ogre_painc6 = [$painc6, ogre_run1] { };

//--------------------------------------------------------------
// Ogre Pain state D
//--------------------------------------------------------------
- nonvirtual void() paind1 = [$paind1, paind2] { };
- nonvirtual void() paind2 = [$paind2, paind3] { ai_pain (10); };
- nonvirtual void() paind3 = [$paind3, paind4] { ai_pain (9); };
- nonvirtual void() paind4 = [$paind4, paind5] { ai_pain (4); };
- nonvirtual void() paind5 = [$paind5, paind6] { };
- nonvirtual void() paind6 = [$paind6, paind7] { };
- nonvirtual void() paind7 = [$paind7, paind8] { };
- nonvirtual void() paind8 = [$paind8, paind9] { };
- nonvirtual void() paind9 = [$paind9, paind10] { };
- nonvirtual void() paind10 = [$paind10, paind11] { };
- nonvirtual void() paind11 = [$paind11, paind12] { };
- nonvirtual void() paind12 = [$paind12, paind13] { };
- nonvirtual void() paind13 = [$paind13, paind14] { };
- nonvirtual void() paind14 = [$paind14, paind15] { };
- nonvirtual void() paind15 = [$paind15, paind16] { };
- nonvirtual void() paind16 = [$paind16, run1] { };
+ void() ogre_paind1 = [$paind1, ogre_paind2] { };
+ void() ogre_paind2 = [$paind2, ogre_paind3] { ai_pain (10); };
+ void() ogre_paind3 = [$paind3, ogre_paind4] { ai_pain (9); };
+ void() ogre_paind4 = [$paind4, ogre_paind5] { ai_pain (4); };
+ void() ogre_paind5 = [$paind5, ogre_paind6] { };
+ void() ogre_paind6 = [$paind6, ogre_paind7] { };
+ void() ogre_paind7 = [$paind7, ogre_paind8] { };
+ void() ogre_paind8 = [$paind8, ogre_paind9] { };
+ void() ogre_paind9 = [$paind9, ogre_paind10] { };
+ void() ogre_paind10 = [$paind10, ogre_paind11] { };
+ void() ogre_paind11 = [$paind11, ogre_paind12] { };
+ void() ogre_paind12 = [$paind12, ogre_paind13] { };
+ void() ogre_paind13 = [$paind13, ogre_paind14] { };
+ void() ogre_paind14 = [$paind14, ogre_paind15] { };
+ void() ogre_paind15 = [$paind15, ogre_paind16] { };
+ void() ogre_paind16 = [$paind16, ogre_run1] { };

//--------------------------------------------------------------
// Ogre Pain state E
//--------------------------------------------------------------
- nonvirtual void() paine1 = [$paine1, paine2] { };
- nonvirtual void() paine2 = [$paine2, paine3] { ai_pain (10); };
- nonvirtual void() paine3 = [$paine3, paine4] { ai_pain (9); };
- nonvirtual void() paine4 = [$paine4, paine5] { ai_pain (4); };
- nonvirtual void() paine5 = [$paine5, paine6] { };
- nonvirtual void() paine6 = [$paine6, paine7] { };
- nonvirtual void() paine7 = [$paine7, paine8] { };
- nonvirtual void() paine8 = [$paine8, paine9] { };
- nonvirtual void() paine9 = [$paine9, paine10] { };
- nonvirtual void() paine10 = [$paine10, paine11] { };
- nonvirtual void() paine11 = [$paine11, paine12] { };
- nonvirtual void() paine12 = [$paine12, paine13] { };
- nonvirtual void() paine13 = [$paine13, paine14] { };
- nonvirtual void() paine14 = [$paine14, paine15] { };
- nonvirtual void() paine15 = [$paine15, run1] { };
+ void() ogre_paine1 = [$paine1, ogre_paine2] { };
+ void() ogre_paine2 = [$paine2, ogre_paine3] { ai_pain (10); };
+ void() ogre_paine3 = [$paine3, ogre_paine4] { ai_pain (9); };
+ void() ogre_paine4 = [$paine4, ogre_paine5] { ai_pain (4); };
+ void() ogre_paine5 = [$paine5, ogre_paine6] { };
+ void() ogre_paine6 = [$paine6, ogre_paine7] { };
+ void() ogre_paine7 = [$paine7, ogre_paine8] { };
+ void() ogre_paine8 = [$paine8, ogre_paine9] { };
+ void() ogre_paine9 = [$paine9, ogre_paine10] { };
+ void() ogre_paine10 = [$paine10, ogre_paine11] { };
+ void() ogre_paine11 = [$paine11, ogre_paine12] { };
+ void() ogre_paine12 = [$paine12, ogre_paine13] { };
+ void() ogre_paine13 = [$paine13, ogre_paine14] { };
+ void() ogre_paine14 = [$paine14, ogre_paine15] { };
+ void() ogre_paine15 = [$paine15, ogre_run1] { };

//--------------------------------------------------------------
// Ogre Death state A
//--------------------------------------------------------------
- nonvirtual void() die1 = [$death1, die2] { };
- nonvirtual void() die2 = [$death2, die3] { };
- nonvirtual void() die3 = [$death3, die4]
+ void() ogre_die1 = [$death1, ogre_die2] { };
+ void() ogre_die2 = [$death2, ogre_die3] { };
+ void() ogre_die3 = [$death3, ogre_die4]
{
- this.solid = SOLID_NOT;
+ self.solid = SOLID_NOT;
// style ammotype check -- dumptruck_ds
- if (this.style == 1)
+ if (self.style == 1)
{
// flak style
- this.ammo_nails = 5;
+ self.ammo_nails = 5;
}
- if (this.style == 2)
+ if (self.style == 2)
{
// super nail style
- this.ammo_nails = 5;
+ self.ammo_nails = 5;
}
- if (this.style == 3)
+ if (self.style == 3)
{
// DOE multi-grenade
- this.ammo_rockets = 2;
+ self.ammo_rockets = 2;
}
- else if (this.style == 0)
+ else if (self.style == 0)
{
// default Ogre
- this.ammo_rockets = 2;
+ self.ammo_rockets = 2;
}
- if (!this.keep_ammo)
- item_backpack::drop_backpack (this.origin, this.weapon,
- this.ammo_shells, this.ammo_nails,
- this.ammo_rockets, this.ammo_cells);
+ if (!self.keep_ammo)
+ item_backpack_drop (self);
};
- nonvirtual void() die4 = [$death4, die5] { };
- nonvirtual void() die5 = [$death5, die6] { };
- nonvirtual void() die6 = [$death6, die7] { };
- nonvirtual void() die7 = [$death7, die8] { };
- nonvirtual void() die8 = [$death8, die9] { };
- nonvirtual void() die9 = [$death9, die10] { };
- nonvirtual void() die10 = [$death10, die11] { };
- nonvirtual void() die11 = [$death11, die12] { };
- nonvirtual void() die12 = [$death12, die13] { };
- nonvirtual void() die13 = [$death13, die14] { };
- nonvirtual void() die14 = [$death14, die14] { };
+ void() ogre_die4 = [$death4, ogre_die5] { };
+ void() ogre_die5 = [$death5, ogre_die6] { };
+ void() ogre_die6 = [$death6, ogre_die7] { };
+ void() ogre_die7 = [$death7, ogre_die8] { };
+ void() ogre_die8 = [$death8, ogre_die9] { };
+ void() ogre_die9 = [$death9, ogre_die10] { };
+ void() ogre_die10 = [$death10, ogre_die11] { };
+ void() ogre_die11 = [$death11, ogre_die12] { };
+ void() ogre_die12 = [$death12, ogre_die13] { };
+ void() ogre_die13 = [$death13, ogre_die14] { };
+ void() ogre_die14 = [$death14, ogre_die14] { };

//--------------------------------------------------------------
// Ogre Death state B
//--------------------------------------------------------------
- nonvirtual void() bdie1 = [$bdeath1, bdie2] { };
- nonvirtual void() bdie2 = [$bdeath2, bdie3] { ai_forward (5); };
- nonvirtual void() bdie3 = [$bdeath3, bdie4]
+ void() ogre_bdie1 = [$bdeath1, ogre_bdie2] { };
+ void() ogre_bdie2 = [$bdeath2, ogre_bdie3] { ai_forward (5); };
+ void() ogre_bdie3 = [$bdeath3, ogre_bdie4]
{
- this.solid = SOLID_NOT;
+ self.solid = SOLID_NOT;
// style ammotype check -- dumptruck_ds
- if (this.style == 1)
+ if (self.style == 1)
{
- this.ammo_nails = 5;
+ self.ammo_nails = 5;
}
- if (this.style == 2)
+ if (self.style == 2)
{
- this.ammo_nails = 5;
+ self.ammo_nails = 5;
}
- if (this.style == 3)
+ if (self.style == 3)
{
// DOE multi-grenade
- this.ammo_rockets = 2;
+ self.ammo_rockets = 2;
}
- if (this.style == 4)
+ if (self.style == 4)
{
// lavaball ogre jaycie erysdren 2021-09-14
- this.ammo_rockets = 2;
+ self.ammo_rockets = 2;
}
- else if (this.style == 0)
+ else if (self.style == 0)
{
- this.ammo_rockets = 2;
+ self.ammo_rockets = 2;
}
- if(!this.keep_ammo)
- item_backpack::drop_backpack (this.origin, this.weapon,
- this.ammo_shells, this.ammo_nails,
- this.ammo_rockets, this.ammo_cells);
+ if(!self.keep_ammo)
+ item_backpack_drop (self);
};
- nonvirtual void() bdie4 = [$bdeath4, bdie5] { ai_forward (1); };
- nonvirtual void() bdie5 = [$bdeath5, bdie6] { ai_forward (3); };
- nonvirtual void() bdie6 = [$bdeath6, bdie7] { ai_forward (7); };
- nonvirtual void() bdie7 = [$bdeath7, bdie8] { ai_forward (25); };
- nonvirtual void() bdie8 = [$bdeath8, bdie9] { };
- nonvirtual void() bdie9 = [$bdeath9, bdie10] { };
- nonvirtual void() bdie10 = [$bdeath10, bdie10] { };
+ void() ogre_bdie4 = [$bdeath4, ogre_bdie5] { ai_forward (1); };
+ void() ogre_bdie5 = [$bdeath5, ogre_bdie6] { ai_forward (3); };
+ void() ogre_bdie6 = [$bdeath6, ogre_bdie7] { ai_forward (7); };
+ void() ogre_bdie7 = [$bdeath7, ogre_bdie8] { ai_forward (25); };
+ void() ogre_bdie8 = [$bdeath8, ogre_bdie9] { };
+ void() ogre_bdie9 = [$bdeath9, ogre_bdie10] { };
+ void() ogre_bdie10 = [$bdeath10, ogre_bdie10] { };

//==============================================================
// Interaction
@@ -707,107 +793,96 @@ class monster_ogre: base_walkmonster
//--------------------------------------------------------------
// ogre_pain
//--------------------------------------------------------------
- virtual void(entity attacker, float damage) do_damage =
+ void(entity attacker, float damage) monster_ogre_pain =
{
local float r;

// don't make multiple pain sounds right after each other
- if (this.pain_finished > time)
+ if (self.pain_finished > time)
return;

- if (this.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & I_AM_TURRET)
return;

- sound_pain (this, CHAN_VOICE, "ogre/ogpain1.wav", 1, ATTN_NORM);
+ sound_pain (self, CHAN_VOICE, "ogre/ogpain1.wav", 1, ATTN_NORM);

r = random();

if (r < 0.25)
{
- this.pain1 ();
- this.pain_finished = time + 1;
+ ogre_pain1 ();
+ self.pain_finished = time + 1;
}
else if (r < 0.5)
{
- this.painb1 ();
- this.pain_finished = time + 1;
+ ogre_painb1 ();
+ self.pain_finished = time + 1;
}
else if (r < 0.75)
{
- this.painc1 ();
- this.pain_finished = time + 1;
+ ogre_painc1 ();
+ self.pain_finished = time + 1;
}
else if (r < 0.88)
{
- this.paind1 ();
- this.pain_finished = time + 2;
+ ogre_paind1 ();
+ self.pain_finished = time + 2;
}
else
{
- this.paine1 ();
- this.pain_finished = time + 2;
+ ogre_paine1 ();
+ self.pain_finished = time + 2;
}
};

//--------------------------------------------------------------
// ogre_die
//--------------------------------------------------------------
- virtual void() do_destroy =
+ void() monster_ogre_destroy =
{
// check for gib
- if (this.health < -80)
+ if (self.health < -80)
{
- sound (this, CHAN_VOICE, "player/udeath.wav",
+ sound (self, CHAN_VOICE, "player/udeath.wav",
1, ATTN_NORM);

// dumptruck_ds custom_mdls
- if (this.mdl_head != "")
- {
- ThrowHead (this.mdl_head, this.health);
- }
+ if (self.mdl_head != "")
+ throw_head (self.mdl_head, self.health);
else
- {
- ThrowHead ("progs/h_ogre.mdl", this.health);
- }
- // ThrowGib ("progs/gib3.mdl", this.health);
- // ThrowGib ("progs/gib3.mdl", this.health);
- // ThrowGib ("progs/gib3.mdl", this.health);
+ throw_head ("progs/h_ogre.mdl", self.health);
+
+ // ThrowGib ("progs/gib3.mdl", self.health);
+ // ThrowGib ("progs/gib3.mdl", self.health);
+ // ThrowGib ("progs/gib3.mdl", self.health);
+
// custom models -- dumptruck_ds
- if (this.mdl_gib1 != "")
- {
- ThrowGib (this.mdl_gib1, this.health);
- }
+ if (self.mdl_gib1 != "")
+ throw_gib (self.mdl_gib1, self.health);
else
- {
- ThrowGib ("progs/gib3.mdl", this.health);
- }
- if (this.mdl_gib2 != "")
- {
- ThrowGib (this.mdl_gib2, this.health);
- }
+ throw_gib ("progs/gib3.mdl", self.health);
+
+ if (self.mdl_gib2 != "")
+ throw_gib (self.mdl_gib2, self.health);
else
- {
- ThrowGib ("progs/gib3.mdl", this.health);
- }
- if (this.mdl_gib3 != "")
- {
- ThrowGib (this.mdl_gib3, this.health);
- }
+ throw_gib ("progs/gib3.mdl", self.health);
+
+ if (self.mdl_gib3 != "")
+ throw_gib (self.mdl_gib3, self.health);
else
- {
- ThrowGib ("progs/gib3.mdl", this.health);
- }
- base_item::drop_stuff (this);
+ throw_gib ("progs/gib3.mdl", self.health);
+
+ base_item_drop_stuff (self);
return;
}

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

- base_item::drop_stuff (this);
+ base_item_drop_stuff (self);
if (random() < 0.5)
- this.die1 ();
+ ogre_die1 ();
else
- this.bdie1 ();
+ ogre_bdie1 ();
};

//==============================================================
@@ -815,95 +890,99 @@ class monster_ogre: base_walkmonster
//==============================================================

//--------------------------------------------------------------
- virtual void() init_spawned =
+ void(entity e) monster_ogre_init =
{
if (deathmatch)
{
- remove (this);
+ remove (e);
return;
}

+ // let subclasses override classtype -- CEV
+ e.classname = "monster_ogre";
+ e.classtype = CT_MONSTER_OGRE;
+
// custom_mdls dumptruck_ds
- precache_body_model ("progs/ogre.mdl");
- precache_head_model ("progs/h_ogre.mdl");
- precache_proj_model ("progs/grenade.mdl");
+ precache_body_model (e, "progs/ogre.mdl");
+ precache_head_model (e, "progs/h_ogre.mdl");
+ precache_proj_model (e, "progs/grenade.mdl");

// custom_mdls dumptruck_ds
// for style 3 Orge dumptruck_ds
precache_model ("progs/mervup.mdl");
// for style 2 Ogre dumptruck_ds
precache_model ("progs/lspike.mdl");
- precache_sound_misc ("ogre/ogdrag.wav");
- precache_sound_death ("ogre/ogdth.wav");
- precache_sound_idle ("ogre/ogidle.wav");
- precache_sound_misc1 ("ogre/ogidle2.wav");
- precache_sound_pain ("ogre/ogpain1.wav");
- precache_sound_attack ("ogre/ogsawatk.wav");
- precache_sound_sight ("ogre/ogwake.wav");
- precache_sound_misc2 ("shalrath/attack2.wav");
+ precache_sound_misc (e, "ogre/ogdrag.wav");
+ precache_sound_death (e, "ogre/ogdth.wav");
+ precache_sound_idle (e, "ogre/ogidle.wav");
+ precache_sound_misc1 (e, "ogre/ogidle2.wav");
+ precache_sound_pain (e, "ogre/ogpain1.wav");
+ precache_sound_attack (e, "ogre/ogsawatk.wav");
+ precache_sound_sight (e, "ogre/ogwake.wav");
+ precache_sound_misc2 (e, "shalrath/attack2.wav");
precache_sound ("fish/bite.wav");
// jaycie erysdren 2021-09-14
precache_sound ("boss1/throw.wav");

- precache_gib1 ("progs/gib1.mdl");
- precache_gib2 ("progs/gib2.mdl");
- precache_gib3 ("progs/gib3.mdl");
+ precache_gib1 (e, "progs/gib1.mdl");
+ precache_gib2 (e, "progs/gib2.mdl");
+ precache_gib3 (e, "progs/gib3.mdl");

- this.solid = SOLID_SLIDEBOX;
- this.movetype = MOVETYPE_STEP;
+ e.solid = SOLID_SLIDEBOX;
+ e.movetype = MOVETYPE_STEP;

// custom_mdls dumptruck_ds
- body_model ("progs/ogre.mdl");
- // setmodel (this, "progs/ogre.mdl");
+ body_model (e, "progs/ogre.mdl");
+ // setmodel (e, "progs/ogre.mdl");

- setsize (this, VEC_HULL2_MIN, VEC_HULL2_MAX);
+ setsize (e, VEC_HULL2_MIN, VEC_HULL2_MAX);

- if (!this.proj_speed_mod)
- this.proj_speed_mod = 1;
+ if (!e.proj_speed_mod)
+ e.proj_speed_mod = 1;

// thanks RennyC -- dumptruck_ds
- if (!this.health)
- this.health = 200;
-
- this.think_stand = this.stand1;
- this.think_walk = this.walk1;
- if (this.spawnflags & I_AM_TURRET)
- {
- this.think_run = this.tur_seek1;
- }
+ if (!e.health)
+ e.health = 200;
+
+ e.checkattack = monster_ogre_checkattack;
+ e.sightsound = monster_ogre_sightsound;
+ e.think_stand = ogre_stand1;
+ e.think_walk = ogre_walk1;
+ if (e.spawnflags & I_AM_TURRET)
+ e.think_run = ogre_tur_seek1;
else
- {
- this.think_run = this.run1;
- }
- this.th_die = this.do_destroy;
- this.think_melee = this.attack_melee;
- this.think_missile = this.nail1;
+ e.think_run = ogre_run1;
+ e.destroy = monster_ogre_destroy;
+ e.think_melee = monster_ogre_attack_melee;
+ e.think_missile = ogre_nail1;
// dumptruck_ds
- this.think_turret = this.tur_atk1;
+ e.think_turret = ogre_tur_atk1;
// Berserk test from
// http://celephais.net/board/view_thread.php?id=4&start=3465
// -- dumptruck_ds
- if !(this.berserk)
- this.th_pain = this.do_damage;
+ if !(e.berserk)
+ e.pain = monster_ogre_pain;
else
- this.th_pain = sub_nullpain;
+ e.pain = sub_nullpain;

// walkmonster_start
- super::init_spawned ();
+ base_walkmonster_init (e);
};

//--------------------------------------------------------------
void() monster_ogre =
{
- // let subclasses override classtype -- CEV
- if (!this.classtype)
- this.classtype = CT_MONSTER_OGRE;
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ monster_ogre_init (self);
};
-};
+// };

-//==============================================================================
+//----------------------------------------------------------------------
// OGRE MARKSMAN
-//==============================================================================
+//----------------------------------------------------------------------

/*QUAKED monster_ogre_marksman (1 0 0) (-32 -32 -24) (32 32 64) AMBUSH X X TRIGGER_SPAWNED X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
@@ -966,36 +1045,38 @@ obit_method(string) : "When used with obit_name, will set part of the text for a
damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by this number (e.g. 4 = Quad damage)"

*/
-class monster_ogre_marksman: monster_ogre
-{
+//----------------------------------------------------------------------
+// class monster_ogre_marksman: monster_ogre
+// {
// Preach tutorial alternate animation frames for
// monster_ogre_marksman -- dumptruck_ds

//--------------------------------------------------------------
// Ogre2 Nail frames
//--------------------------------------------------------------
- nonvirtual void() mm_nail1 = [$shoot1, mm_nail2]
+ void() ogre_mm_nail1 = [$shoot1, ogre_mm_nail2]
{
ai_face ();
- this.attack_elevation = preach_iterate_elevation (
- OGRE_DEFAULT_ELEVATION, this.origin, this.enemy.origin);
+ self.attack_elevation = preach_iterate_elevation (
+ OGRE_DEFAULT_ELEVATION, self.origin, self.enemy.origin);
};
- nonvirtual void() mm_nail2 = [$shoot2, mm_nail3]
+ void() ogre_mm_nail2 = [$shoot2, ogre_mm_nail3]
{
ai_face ();
- this.attack_elevation = preach_iterate_elevation (
- this.attack_elevation, this.origin, this.enemy.origin);
+ self.attack_elevation = preach_iterate_elevation (
+ self.attack_elevation, self.origin, self.enemy.origin);
};
- nonvirtual void() mm_nail3 = [$shoot2, mm_nail4]
+ void() ogre_mm_nail3 = [$shoot2, ogre_mm_nail4]
{
ai_face ();
- this.attack_elevation = preach_iterate_elevation (
- this.attack_elevation, this.origin, this.enemy.origin);
+ self.attack_elevation = preach_iterate_elevation (
+ self.attack_elevation, self.origin, self.enemy.origin);
};
- nonvirtual void() mm_nail4 = [$shoot3, nail5]
+ void() ogre_mm_nail4 = [$shoot3, ogre_nail5]
{
ai_face ();
- fire_grenade (this.origin, 40, 40, this.attack_elevation);
+ base_monster_fire_grenade (
+ self.origin, 40, 40, self.attack_elevation);
};

// these are for the turret version of monster_ogre_marksman
@@ -1003,53 +1084,54 @@ class monster_ogre_marksman: monster_ogre
//--------------------------------------------------------------
// Ogre2 Turret Attack
//--------------------------------------------------------------
- nonvirtual void() mm_t_atk1 = [$shoot1, mm_t_atk2]
+ void() ogre_mm_t_atk1 = [$shoot1, ogre_mm_t_atk2]
{
ai_face ();
- this.attack_elevation = preach_iterate_elevation (
- OGRE_DEFAULT_ELEVATION, this.origin, this.enemy.origin);
+ self.attack_elevation = preach_iterate_elevation (
+ OGRE_DEFAULT_ELEVATION, self.origin, self.enemy.origin);
};
- nonvirtual void() mm_t_atk2 = [$shoot2, mm_t_atk3]
+ void() ogre_mm_t_atk2 = [$shoot2, ogre_mm_t_atk3]
{
ai_face ();
- this.attack_elevation = preach_iterate_elevation (
- this.attack_elevation, this.origin, this.enemy.origin);
+ self.attack_elevation = preach_iterate_elevation (
+ self.attack_elevation, self.origin, self.enemy.origin);
};
- nonvirtual void() mm_t_atk3 = [$shoot2, mm_t_atk4]
+ void() ogre_mm_t_atk3 = [$shoot2, ogre_mm_t_atk4]
{
ai_face ();
- this.attack_elevation = preach_iterate_elevation (
- this.attack_elevation, this.origin, this.enemy.origin);
+ self.attack_elevation = preach_iterate_elevation (
+ self.attack_elevation, self.origin, self.enemy.origin);
};
- nonvirtual void() mm_t_atk4 = [$shoot3, mm_t_atk5]
+ void() ogre_mm_t_atk4 = [$shoot3, ogre_mm_t_atk5]
{
ai_face ();
- fire_grenade (this.origin, 40, 40, this.attack_elevation);
+ base_monster_fire_grenade (
+ self.origin, 40, 40, self.attack_elevation);
};
- nonvirtual void() mm_t_atk5 = [$shoot4, mm_t_atk6] { ai_face (); };
- nonvirtual void() mm_t_atk6 = [$shoot5, mm_t_atk7] { ai_face (); };
- nonvirtual void() mm_t_atk7 = [$shoot5, mm_t_atk8] { ai_face (); };
- nonvirtual void() mm_t_atk8 = [$shoot6, mm_t_atk9] { ai_face (); };
- nonvirtual void() mm_t_atk9 = [$shoot6, mm_t_seek1] { ai_face (); };
+ void() ogre_mm_t_atk5 = [$shoot4, ogre_mm_t_atk6] { ai_face (); };
+ void() ogre_mm_t_atk6 = [$shoot5, ogre_mm_t_atk7] { ai_face (); };
+ void() ogre_mm_t_atk7 = [$shoot5, ogre_mm_t_atk8] { ai_face (); };
+ void() ogre_mm_t_atk8 = [$shoot6, ogre_mm_t_atk9] { ai_face (); };
+ void() ogre_mm_t_atk9 = [$shoot6, ogre_mm_t_seek1] { ai_face (); };

//--------------------------------------------------------------
// Ogre2 Turret Seek / Stand
//--------------------------------------------------------------
- nonvirtual void() mm_t_seek1 = [$stand1, mm_t_seek2] { ai_run (0); };
- nonvirtual void() mm_t_seek2 = [$stand2, mm_t_seek3] { ai_run (0); };
- nonvirtual void() mm_t_seek3 = [$stand3, mm_t_seek4] { ai_run (0); };
- nonvirtual void() mm_t_seek4 = [$stand4, mm_t_seek5] { ai_run (0); };
- nonvirtual void() mm_t_seek5 = [$stand5, mm_t_seek6]
+ void() ogre_mm_t_seek1 = [$stand1, ogre_mm_t_seek2] { ai_run (0); };
+ void() ogre_mm_t_seek2 = [$stand2, ogre_mm_t_seek3] { ai_run (0); };
+ void() ogre_mm_t_seek3 = [$stand3, ogre_mm_t_seek4] { ai_run (0); };
+ void() ogre_mm_t_seek4 = [$stand4, ogre_mm_t_seek5] { ai_run (0); };
+ void() ogre_mm_t_seek5 = [$stand5, ogre_mm_t_seek6]
{
if (random() < 0.2)
- sound_idle (this, CHAN_VOICE, "ogre/ogidle.wav",
+ sound_idle (self, CHAN_VOICE, "ogre/ogidle.wav",
1, ATTN_IDLE);
ai_run (0);
};
- nonvirtual void() mm_t_seek6 = [$stand6, mm_t_seek7] { ai_run (0); };
- nonvirtual void() mm_t_seek7 = [$stand7, mm_t_seek8] { ai_run (0); };
- nonvirtual void() mm_t_seek8 = [$stand8, mm_t_seek9] { ai_run (0); };
- nonvirtual void() mm_t_seek9 = [$stand9, mm_t_seek1] { ai_run (0); };
+ void() ogre_mm_t_seek6 = [$stand6, ogre_mm_t_seek7] { ai_run (0); };
+ void() ogre_mm_t_seek7 = [$stand7, ogre_mm_t_seek8] { ai_run (0); };
+ void() ogre_mm_t_seek8 = [$stand8, ogre_mm_t_seek9] { ai_run (0); };
+ void() ogre_mm_t_seek9 = [$stand9, ogre_mm_t_seek1] { ai_run (0); };

// end Preach -- dumptruck_ds

@@ -1058,81 +1140,85 @@ class monster_ogre_marksman: monster_ogre
//==============================================================

//--------------------------------------------------------------
- virtual void() init_spawned =
+ void(entity e) monster_ogre_marksman_init =
{
if (deathmatch)
{
- remove (this);
+ remove (e);
return;
}

+ e.classname = "monster_ogre_marksman";
+ e.classtype = CT_MONSTER_OGRE_MARKSMAN;
+
// custom_mdls dumptruck_ds
- precache_body_model ("progs/ogre.mdl");
- precache_head_model ("progs/h_ogre.mdl");
- precache_proj_model ("progs/grenade.mdl");
+ precache_body_model (e, "progs/ogre.mdl");
+ precache_head_model (e, "progs/h_ogre.mdl");
+ precache_proj_model (e, "progs/grenade.mdl");

- precache_sound_misc ("ogre/ogdrag.wav");
- precache_sound_death ("ogre/ogdth.wav");
- precache_sound_idle ("ogre/ogidle.wav");
- precache_sound_misc1 ("ogre/ogidle2.wav");
- precache_sound_pain ("ogre/ogpain1.wav");
- precache_sound_attack ("ogre/ogsawatk.wav");
- precache_sound_sight ("ogre/ogwake.wav");
+ precache_sound_misc (e, "ogre/ogdrag.wav");
+ precache_sound_death (e, "ogre/ogdth.wav");
+ precache_sound_idle (e, "ogre/ogidle.wav");
+ precache_sound_misc1 (e, "ogre/ogidle2.wav");
+ precache_sound_pain (e, "ogre/ogpain1.wav");
+ precache_sound_attack (e, "ogre/ogsawatk.wav");
+ precache_sound_sight (e, "ogre/ogwake.wav");

- precache_gib1 ("progs/gib1.mdl");
- precache_gib2 ("progs/gib2.mdl");
- precache_gib3 ("progs/gib3.mdl");
+ precache_gib1 (e, "progs/gib1.mdl");
+ precache_gib2 (e, "progs/gib2.mdl");
+ precache_gib3 (e, "progs/gib3.mdl");

- this.solid = SOLID_SLIDEBOX;
- this.movetype = MOVETYPE_STEP;
+ e.solid = SOLID_SLIDEBOX;
+ e.movetype = MOVETYPE_STEP;

// custom_mdls dumptruck_ds
- body_model ("progs/ogre.mdl");
- // setmodel (this, "progs/ogre.mdl");
+ body_model (e, "progs/ogre.mdl");
+ // setmodel (e, "progs/ogre.mdl");

- setsize (this, VEC_HULL2_MIN, VEC_HULL2_MAX);
- if (!this.proj_speed_mod)
- {
- this.proj_speed_mod = 1;
- }
+ setsize (e, VEC_HULL2_MIN, VEC_HULL2_MAX);
+ if (!e.proj_speed_mod)
+ e.proj_speed_mod = 1;

// thanks RennyC -- dumptruck_ds
- if (!this.health)
- this.health = 200;
-
- this.think_stand = this.stand1;
- this.think_walk = this.walk1;
- if (this.spawnflags & I_AM_TURRET)
- {
- this.think_run = this.mm_t_seek1;
- }
+ if (!e.health)
+ e.health = 200;
+
+ e.checkattack = monster_ogre_checkattack;
+ e.sightsound = monster_ogre_sightsound;
+ e.think_stand = ogre_stand1;
+ e.think_walk = ogre_walk1;
+ if (e.spawnflags & I_AM_TURRET)
+ e.think_run = ogre_mm_t_seek1;
else
- {
- this.think_run = this.run1;
- }
- this.th_die = this.do_destroy;
- this.think_melee = this.attack_melee;
- this.think_missile = this.mm_nail1;
+ e.think_run = ogre_run1;
+ e.destroy = monster_ogre_destroy;
+ e.think_melee = monster_ogre_attack_melee;
+ e.think_missile = ogre_mm_nail1;
// dumptruck_ds
- this.think_turret = this.mm_t_atk1;
+ e.think_turret = ogre_mm_t_atk1;
// Berserk test from
// http://celephais.net/board/view_thread.php?id=4&start=3465
// -- dumptruck_ds
- if !(this.berserk)
- this.th_pain = this.do_damage;
+ if !(e.berserk)
+ e.pain = monster_ogre_pain;
else
- this.th_pain = sub_nullpain;
+ e.pain = sub_nullpain;

- // walkmonster_start
- super::init_spawned ();
+ // could be a call to monster_ogre_init but let's go
+ // straight to walkmonster instead -- CEV
+ base_walkmonster_init (e);
};

//--------------------------------------------------------------
void() monster_ogre_marksman =
{
- this.classtype = CT_MONSTER_OGRE_MARKSMAN;
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ monster_ogre_marksman_init (self);
};
-};
+// };

/* Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds */

@@ -1143,11 +1229,12 @@ class monster_ogre_marksman: monster_ogre
*/
void() monster_dead_ogre =
{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
return;

- precache_model("progs/ogre.mdl");
- setmodel(self, "progs/ogre.mdl");
+ precache_model ("progs/ogre.mdl");
+ setmodel (self, "progs/ogre.mdl");
if (self.spawnflags & 2)
{
self.frame = $death14;

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

Diff qc/monsters/playerclient.qc

diff --git a/qc/monsters/playerclient.qc b/qc/monsters/playerclient.qc
index baac16c..08f9ac4 100644
--- a/qc/monsters/playerclient.qc
+++ b/qc/monsters/playerclient.qc
@@ -17,7 +17,6 @@ float modelindex_player;
.float jump_flag; // player jump flag
.float reset_items; // dumptruck_ds
.float swim_flag; // player swimming sound flag
-.float walkframe;

.float air_finished; // when time > air_finished, drown
.float attack_finished;
@@ -34,6 +33,8 @@ float modelindex_player;
.float rad_time;
.float megahealth_rottime; // dumptruck_ds

+.float step_time; // CEV
+
// set to time+0.2 whenever a client fires a weapon or takes damage.
// Used to alert monsters that otherwise would let the player go
.float show_hostile;
@@ -69,8 +70,18 @@ void() player_set_suicide_frame; // pain, damage, death
void() player_pain_sound;
void() player_death_sound;
void() player_dead;
-void() pl_stand1; // thinking & animation frames
-void() pl_run1;
+void() player_footsteps; // thinking & animation frames
+void() player_stand;
+void() player_axstand;
+void(void() axthink) player_run;
+void(void() runthink) player_axrun;
+void() pl_axstnd1; void() pl_axstnd2; void() pl_axstnd3; void() pl_axstnd4;
+void() pl_axstnd5; void() pl_axstnd6; void() pl_axstnd7; void() pl_axstnd8;
+void() pl_axstnd9; void() pl_axstnd10; void() pl_axstnd11; void() pl_axstnd12;
+void() pl_stand1; void() pl_stand2; void() pl_stand3; void() pl_stand4;
+void() pl_stand5;
+void() pl_run1; void() pl_run2; void() pl_run3; void() pl_run4;
+void() pl_run5; void() pl_run6;
void() pl_shot1; void() pl_shot2; void() pl_shot3; void() pl_shot4;
void() pl_shot5; void() pl_shot6;
void() pl_axe1; void() pl_axe2; void() pl_axe3; void() pl_axe4;
@@ -130,6 +141,7 @@ void() player_dead_on_side;
//======================================================================
// frame macros
//======================================================================
+
$cd id1/models/player_4
$origin 0 -6 24
$base base
@@ -175,12 +187,13 @@ $frame axattb1 axattb2 axattb3 axattb4 axattb5 axattb6
$frame axattc1 axattc2 axattc3 axattc4 axattc5 axattc6
$frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6

+//------------------------------------------------------------------------------
+
//----------------------------------------------------------------------
// Player Class: spawn functions, animation, client handling, etc. -- CEV
//----------------------------------------------------------------------
// class player: entity
// {
-
//==============================================================
// Client Input Handling
//==============================================================
@@ -1151,62 +1164,214 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
//==============================================================

//--------------------------------------------------------------
- // Player Stand function
- //--------------------------------------------------------------
- void() pl_stand1 = [$axstnd1, pl_stand1]
+ void() player_footsteps =
{
- self.weaponframe = 0;
- if (self.velocity_x || self.velocity_y)
- {
- self.walkframe = 0;
- pl_run1 ();
+ if (self.velocity_x == 0 || self.velocity_y == 0)
return;
- }

- if (self.weapon == IT_AXE)
+ if (self.pmove_flags & PMF_AIRSTEPPED)
{
- if (self.walkframe >= 12)
- self.walkframe = 0;
- self.frame = $axstnd1 + self.walkframe;
+ // the heavy foot
+ self.pmove_flags &= ~PMF_AIRSTEPPED;
+ sound (self, CHAN_FEET, "steps/foot6.wav",
+ 0.9, ATTN_FEET);
+ }
+ else if (self.waterlevel > WATERLEVEL_NONE)
+ {
+ dprint ("player_footsteps: water\n");
}
else
{
- if (self.walkframe >= 5)
- self.walkframe = 0;
- self.frame = $stand1 + self.walkframe;
+ local float vol;
+
+ if (self.speed > PM_RUNSPEED * 0.9)
+ {
+ vol = 0.2 + (random() * 0.5);
+ }
+ else if (self.speed > PM_WALKSPEED * 0.9 &&
+ (self.frame == $rockrun2 ||
+ self.frame == $axrun2))
+ {
+ vol = 0.1 + (random() * 0.3);
+ }
+ else
+ {
+ // no footsteps below PM_WALKSPEED * 0.9
+ return;
+ }
+
+ local string newstep = "";
+
+ if (self.cnt == 0 || self.cnt > 6)
+ self.cnt = rint (1 + random() * 5);
+
+ switch (self.cnt)
+ {
+ case 1:
+ newstep = "steps/foot1.wav";
+ break;
+ case 2:
+ newstep = "steps/foot2.wav";
+ break;
+ case 3:
+ newstep = "steps/foot3.wav";
+ break;
+ case 4:
+ newstep = "steps/foot4.wav";
+ break;
+ case 5:
+ newstep = "steps/foot5.wav";
+ break;
+ case 6:
+ newstep = "steps/foot7.wav";
+ break;
+ }
+
+ self.cnt++;
+ sound (self, CHAN_FEET, newstep, vol, ATTN_FEET);
}
- self.walkframe = self.walkframe + 1;
+ // dprint (sprintf("player_footsteps: step time diff %g\n",
+ // time - self.step_time));
+ self.step_time = time;
};

//--------------------------------------------------------------
- // Player Run function
- //--------------------------------------------------------------
- void() pl_run1 = [$rockrun1, pl_run1]
+ void() player_stand =
{
self.weaponframe = 0;
- if (!self.velocity_x && !self.velocity_y)
+
+ if (self.velocity_x || self.velocity_y)
{
- self.walkframe = 0;
- pl_stand1 ();
- return;
+ if (self.weapon == IT_AXE)
+ pl_axrun1 ();
+ else
+ pl_run1 ();
+ }
+ else if (self.weapon == IT_AXE)
+ {
+ pl_axstnd1 ();
}
+ };

- if (self.weapon == IT_AXE)
+ //--------------------------------------------------------------
+ void() player_axstand =
+ {
+ self.weaponframe = 0;
+
+ if (self.velocity_x || self.velocity_y)
{
- if (self.walkframe == 6)
- self.walkframe = 0;
- self.frame = $axrun1 + self.walkframe;
+ if (self.weapon == IT_AXE)
+ pl_axrun1 ();
+ else
+ pl_run1 ();
+ return;
}
- else
+ else if (self.weapon != IT_AXE)
{
- if (self.walkframe == 6)
- self.walkframe = 0;
- self.frame = self.frame + self.walkframe;
+ pl_stand1 ();
}
- self.walkframe = self.walkframe + 1;
};

//--------------------------------------------------------------
+ void(void() axthink) player_run =
+ {
+ // dprint (sprintf("player_run: frame %g\n", self.frame));
+
+ if (self.velocity_x == 0 && self.velocity_y == 0)
+ pl_stand1 ();
+ else if (self.weapon == IT_AXE)
+ axthink ();
+ };
+
+ //--------------------------------------------------------------
+ void(void() runthink) player_axrun =
+ {
+ // dprint (sprintf("player_axrun: frame %g\n", self.frame));
+
+ if (self.velocity_x == 0 && self.velocity_y == 0)
+ pl_stand1 ();
+ else if (self.weapon != IT_AXE)
+ runthink ();
+ };
+
+ //--------------------------------------------------------------
+ // Player Axe Stand function
+ //--------------------------------------------------------------
+ void() pl_axstnd1 = [$axstnd1, pl_axstnd2] { player_axstand (); };
+ void() pl_axstnd2 = [$axstnd2, pl_axstnd3] { player_axstand (); };
+ void() pl_axstnd3 = [$axstnd3, pl_axstnd4] { player_axstand (); };
+ void() pl_axstnd4 = [$axstnd4, pl_axstnd5] { player_axstand (); };
+ void() pl_axstnd5 = [$axstnd5, pl_axstnd6] { player_axstand (); };
+ void() pl_axstnd6 = [$axstnd6, pl_axstnd7] { player_axstand (); };
+ void() pl_axstnd7 = [$axstnd7, pl_axstnd8] { player_axstand (); };
+ void() pl_axstnd8 = [$axstnd8, pl_axstnd9] { player_axstand (); };
+ void() pl_axstnd9 = [$axstnd9, pl_axstnd10] { player_axstand (); };
+ void() pl_axstnd10 = [$axstnd10, pl_axstnd11] { player_axstand (); };
+ void() pl_axstnd11 = [$axstnd11, pl_axstnd12] { player_axstand (); };
+ void() pl_axstnd12 = [$axstnd12, pl_axstnd1] { player_axstand (); };
+
+ //--------------------------------------------------------------
+ // Player Stand function
+ //--------------------------------------------------------------
+ void() pl_stand1 = [$stand1, pl_stand2] { player_stand (); };
+ void() pl_stand2 = [$stand2, pl_stand3] { player_stand (); };
+ void() pl_stand3 = [$stand3, pl_stand4] { player_stand (); };
+ void() pl_stand4 = [$stand4, pl_stand5] { player_stand (); };
+ void() pl_stand5 = [$stand5, pl_stand1] { player_stand (); };
+
+ //--------------------------------------------------------------
+ // Player Axe Run function
+ //--------------------------------------------------------------
+ void() pl_axrun1 = [$axrun1, pl_axrun2]
+ {
+ self.weaponframe = 0;
+ player_axrun (pl_run1);
+ };
+ void() pl_axrun2 = [$axrun2, pl_axrun3]
+ {
+ // left foot down
+ player_axrun (pl_run2);
+ if (self.flags & FL_ONGROUND)
+ player_footsteps ();
+ };
+ void() pl_axrun3 = [$axrun3, pl_axrun4] { player_axrun (pl_run3); };
+ void() pl_axrun4 = [$axrun4, pl_axrun5] { player_axrun (pl_run4); };
+ void() pl_axrun5 = [$axrun5, pl_axrun6]
+ {
+ // right foot down
+ player_axrun (pl_run5);
+ if (self.flags & FL_ONGROUND)
+ player_footsteps ();
+ };
+ void() pl_axrun6 = [$axrun6, pl_axrun1] { player_axrun (pl_run6); };
+
+ //--------------------------------------------------------------
+ // Player Run function
+ //--------------------------------------------------------------
+ void() pl_run1 = [$rockrun1, pl_run2]
+ {
+ self.weaponframe = 0;
+ player_run (pl_axrun1);
+ };
+ void() pl_run2 = [$rockrun2, pl_run3]
+ {
+ // left foot down
+ player_run (pl_axrun2);
+ if (self.flags & FL_ONGROUND)
+ player_footsteps ();
+ };
+ void() pl_run3 = [$rockrun3, pl_run4] { player_run (pl_axrun3); };
+ void() pl_run4 = [$rockrun4, pl_run5] { player_run (pl_axrun4); };
+ void() pl_run5 = [$rockrun5, pl_run6]
+ {
+ // right foot down
+ player_run (pl_axrun5);
+ if (self.flags & FL_ONGROUND)
+ player_footsteps ();
+ };
+ void() pl_run6 = [$rockrun6, pl_run1] { player_run (pl_axrun6); };
+
+ //--------------------------------------------------------------
// Player Projectile Attack
//--------------------------------------------------------------
void() pl_shot1 = [$shotatt1, pl_shot2]
@@ -1743,6 +1908,9 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
getlight (self.origin)));
*/

+ // for referencing horizontal velocity later -- CEV
+ self.speed = vlen ([self.velocity_x, self.velocity_y, 0]);
+
// If just spawned in, try to recover previous fog values
// from own client entity, if any
if (clean_up_client_stuff)
@@ -2005,6 +2173,10 @@ $frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
// intermission or finale
return;

+ if (self.pmove_flags & PMF_AIRSTEPPED)
+ if (self.step_time <= time - 0.4)
+ self.pmove_flags &= ~PMF_AIRSTEPPED;
+
// full send -- CEV
self.SendFlags = 0xffffff;

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

Diff qc/monsters/shambler.qc

diff --git a/qc/monsters/shambler.qc b/qc/monsters/shambler.qc
index dbec299..ede17a7 100644
--- a/qc/monsters/shambler.qc
+++ b/qc/monsters/shambler.qc
@@ -3,8 +3,81 @@
//==============================================================================

//======================================================================
+// forward declarations
+//======================================================================
+
+// temp_shambler_field
+void() temp_shambler_field_think;
+entity(entity src, vector org) spawn_temp_shambler_field;
+void(entity e) temp_shambler_field_init;
+strip void() temp_shambler_field;
+
+// monster_shambler
+void() monster_shambler_sightsound; // AI & attacks
+float() monster_shambler_checkattack;
+void(float side) monster_shambler_attack_claw;
+void() monster_shambler_attack_lightning;
+void() monster_shambler_attack_lavaball;
+void() monster_shambler_attack_melee2;
+void() monster_shambler_attack_melee; // animation & think states below
+void() sham_stand1; void() sham_stand2; void() sham_stand3; void() sham_stand4;
+void() sham_stand5; void() sham_stand6; void() sham_stand7; void() sham_stand8;
+void() sham_stand9; void() sham_stand10; void() sham_stand11;
+void() sham_stand12; void() sham_stand13; void() sham_stand14;
+void() sham_stand15; void() sham_stand16; void() sham_stand17;
+void() sham_walk1; void() sham_walk2; void() sham_walk3; void() sham_walk4;
+void() sham_walk5; void() sham_walk6; void() sham_walk7; void() sham_walk8;
+void() sham_walk9; void() sham_walk10; void() sham_walk11; void() sham_walk12;
+void() sham_run1; void() sham_run2; void() sham_run3; void() sham_run4;
+void() sham_run5; void() sham_run6;
+void() sham_smash1; void() sham_smash2; void() sham_smash3; void() sham_smash4;
+void() sham_smash5; void() sham_smash6; void() sham_smash7; void() sham_smash8;
+void() sham_smash9; void() sham_smash10; void() sham_smash11;
+void() sham_smash12;
+void() sham_proj1; void() sham_proj2; void() sham_proj3; void() sham_proj4;
+void() sham_proj5; void() sham_proj6; void() sham_proj7; void() sham_proj8;
+void() sham_proj9; void() sham_proj10; void() sham_proj11; void() sham_proj12;
+void() sham_tur_proj1; void() sham_tur_proj2; void() sham_tur_proj3;
+void() sham_tur_proj4; void() sham_tur_proj5; void() sham_tur_proj6;
+void() sham_tur_proj7; void() sham_tur_proj8; void() sham_tur_proj9;
+void() sham_tur_proj10; void() sham_tur_proj11; void() sham_tur_proj12;
+void() sham_swingl1; void() sham_swingl2; void() sham_swingl3;
+void() sham_swingl4; void() sham_swingl5; void() sham_swingl6;
+void() sham_swingl7; void() sham_swingl8; void() sham_swingl9;
+void() sham_swingr1; void() sham_swingr2; void() sham_swingr3;
+void() sham_swingr4; void() sham_swingr5; void() sham_swingr6;
+void() sham_swingr7; void() sham_swingr8; void() sham_swingr9;
+void() sham_magic1; void() sham_magic2; void() sham_magic3;
+void() sham_magic4; void() sham_magic5; void() sham_magic6;
+void() sham_magic9; void() sham_magic10; void() sham_magic11;
+void() sham_magic12;
+void() sham_tur_magic1; void() sham_tur_magic2; void() sham_tur_magic3;
+void() sham_tur_magic4; void() sham_tur_magic5; void() sham_tur_magic6;
+void() sham_tur_magic9; void() sham_tur_magic10; void() sham_tur_magic11;
+void() sham_tur_magic12; void() sham_tur_magic13; void() sham_tur_magic14;
+void() sham_tur_magic15; void() sham_tur_magic16;
+void() sham_seek_1; void() sham_seek_2; void() sham_seek_3; void() sham_seek_4;
+void() sham_seek_5; void() sham_seek_6; void() sham_seek_7; void() sham_seek_8;
+void() sham_seek_9; void() sham_seek_10; void() sham_seek_11;
+void() sham_seek_12; void() sham_seek_13; void() sham_seek_14;
+void() sham_seek_15; void() sham_seek_16; void() sham_seek_17;
+void() sham_pain1; void() sham_pain2; void() sham_pain3; void() sham_pain4;
+void() sham_pain5; void() sham_pain6;
+void() sham_death1; void() sham_death2; void() sham_death3; void() sham_death4;
+void() sham_death5; void() sham_death6; void() sham_death7; void() sham_death8;
+void() sham_death9; void() sham_death10; void() sham_death11;
+void(entity attacker, float damage) monster_shambler_pain; // interaction
+void() monster_shambler_destroy;
+void(entity e) monster_shambler_init; // initialization
+void() monster_shambler;
+
+// monster_dead_shambler
+void() monster_dead_shambler;
+
+//======================================================================
// frame macros
//======================================================================
+
$cd id1/models/shams
$origin 0 0 24
$base base
@@ -16,7 +89,7 @@ $frame stand10 stand11 stand12 stand13 stand14 stand15 stand16 stand17
$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7
$frame walk8 walk9 walk10 walk11 walk12

-$frame run1 run2 run3 run4 run5 run6
+$frame run1 run2 run3 run4 run5 run6

$frame smash1 smash2 smash3 smash4 smash5 smash6 smash7
$frame smash8 smash9 smash10 smash11 smash12
@@ -35,15 +108,52 @@ $frame pain1 pain2 pain3 pain4 pain5 pain6
$frame death1 death2 death3 death4 death5 death6
$frame death7 death8 death9 death10 death11

+//------------------------------------------------------------------------------
+
//----------------------------------------------------------------------
-// shambler trigger field think function
+// shambler trigger field
//----------------------------------------------------------------------
-void() sham_arc_think =
-{
- if (self.owner != world && self.owner.trigger_field == self)
- self.owner.trigger_field = world;
- remove (self);
-};
+// class temp_shambler_field: base_tempentity
+// {
+ //--------------------------------------------------------------
+ // sham_arc_think
+ //--------------------------------------------------------------
+ void() temp_shambler_field_think =
+ {
+ if (self.owner != world && self.owner.trigger_field == self)
+ self.owner.trigger_field = world;
+ remove (self);
+ };
+
+ //--------------------------------------------------------------
+ entity(entity src, vector org) spawn_temp_shambler_field =
+ {
+ local entity e = spawn ();
+ e.owner = src;
+ e.origin = org;
+ e.angles = src.angles;
+ temp_shambler_field_init (e);
+ return e;
+ };
+
+ //--------------------------------------------------------------
+ void(entity e) temp_shambler_field_init =
+ {
+ e.classname = "temp_shambler_field";
+ e.classtype = CT_TEMP_SHAMBLER_FIELD;
+ setmodel (e, "progs/s_light.mdl");
+ setorigin (e, e.origin);
+ e.think = temp_shambler_field_think;
+ e.nextthink = time + 0.7;
+ base_tempentity_init (e);
+ };
+
+ //--------------------------------------------------------------
+ strip void() temp_shambler_field =
+ {
+ temp_shambler_field_init (self);
+ };
+// };

/*QUAKED monster_shambler (1 0 0) (-32 -32 -24) (32 32 64) AMBUSH X X TRIGGER_SPAWNED X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
@@ -106,12 +216,13 @@ obit_method(string) : "When used with obit_name, will set part of the text for a
damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by this number (e.g. 4 = Quad damage)"

*/
-class monster_shambler: base_walkmonster
-{
+//----------------------------------------------------------------------
+// class monster_shambler: base_walkmonster
+// {
//--------------------------------------------------------------
- virtual void() ai_sightsound =
+ void() monster_shambler_sightsound =
{
- sound_sight (this, CHAN_VOICE, "shambler/ssight.wav",
+ sound_sight (self, CHAN_VOICE, "shambler/ssight.wav",
1, ATTN_NORM);
};

@@ -121,59 +232,59 @@ class monster_shambler: base_walkmonster
// The player is in view, so decide to move or launch an attack
// Returns FALSE if movement should continue
//--------------------------------------------------------------
- virtual float() ai_checkattack =
+ float() monster_shambler_checkattack =
{
local vector spot1, spot2;
local entity targ;

if (enemy_range == RANGE_MELEE)
{
- if (this.can_damage(this, this.enemy))
+ if (can_damage(self, self.enemy))
{
- this.attack_state = AS_MELEE;
+ self.attack_state = AS_MELEE;
return TRUE;
}
}

- if (this.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & I_AM_TURRET)
{
- this.attack_state = AS_MISSILE;
+ self.attack_state = AS_MISSILE;
sub_attackfinished (2 + 2 * random());
return TRUE;
}

- if (time < this.attack_finished)
+ if (time < self.attack_finished)
return FALSE;

if (!enemy_vis)
return FALSE;

- targ = this.enemy;
+ targ = self.enemy;

// see if any entities are in the way of the shot
- spot1 = this.origin + this.view_ofs;
+ spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;

- if (this.style == 0)
+ if (self.style == 0)
if (vlen(spot1 - spot2) > 600)
return FALSE;

- if (this.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & I_AM_TURRET)
if (vlen(spot1 - spot2) > 900)
return FALSE;

// return FALSE;

- traceline (spot1, spot2, FALSE, this);
+ traceline (spot1, spot2, FALSE, self);

if (trace_inopen && trace_inwater)
// sight line crossed contents
return FALSE;

- if ((this.spawnflags & I_AM_TURRET) && (trace_ent != targ))
+ if ((self.spawnflags & I_AM_TURRET) && (trace_ent != targ))
{
// dprint("trace_ent...\n");
- this.attack_state = AS_TURRET;
+ self.attack_state = AS_TURRET;
return FALSE;
}

@@ -182,10 +293,10 @@ class monster_shambler: base_walkmonster
return FALSE;

// missile attack
- if (this.style == 0 && enemy_range == RANGE_FAR)
+ if (self.style == 0 && enemy_range == RANGE_FAR)
return FALSE;

- this.attack_state = AS_MISSILE;
+ self.attack_state = AS_MISSILE;
sub_attackfinished (2 + 2 * random());
return TRUE;
};
@@ -193,29 +304,29 @@ class monster_shambler: base_walkmonster
//--------------------------------------------------------------
// ShamClaw
//--------------------------------------------------------------
- nonvirtual void(float side) attack_claw =
+ void(float side) monster_shambler_attack_claw =
{
local vector delta;
local float ldmg;

- if (!this.enemy)
+ if (!self.enemy)
return;

ai_charge (10);

- delta = this.enemy.origin - this.origin;
+ delta = self.enemy.origin - self.origin;
if (vlen(delta) > 100)
return;

ldmg = (random() + random() + random()) * 20;
- this.t_damage2 (this.enemy, this, this, ldmg);
- sound_hit (this, CHAN_VOICE, "shambler/smack.wav",
+ t_damage2 (self.enemy, self, self, ldmg);
+ sound_hit (self, CHAN_VOICE, "shambler/smack.wav",
1, ATTN_NORM);

if (side)
{
- makevectors (this.angles);
- SpawnMeatSpray (this.origin + v_forward * 16,
+ makevectors (self.angles);
+ spawn_meatspray (self.origin + v_forward * 16,
side * v_right);
}
};
@@ -223,31 +334,27 @@ class monster_shambler: base_walkmonster
//--------------------------------------------------------------
// CastLightning
//--------------------------------------------------------------
- nonvirtual void() attack_lightning =
+ void() monster_shambler_attack_lightning =
{
local vector org, dir;

- this.effects = this.effects | EF_MUZZLEFLASH;
+ self.effects = self.effects | EF_MUZZLEFLASH;

ai_face ();

- org = this.origin + '0 0 40';
+ org = self.origin + '0 0 40';

- dir = this.enemy.origin + '0 0 16' - org;
+ dir = self.enemy.origin + '0 0 16' - org;
dir = normalize (dir);

- if (this.spawnflags & I_AM_TURRET)
- {
- traceline (org, this.origin + dir * 900, TRUE, this);
- }
+ if (self.spawnflags & I_AM_TURRET)
+ traceline (org, self.origin + dir * 900, TRUE, self);
else
- {
- traceline (org, this.origin + dir * 600, TRUE, this);
- }
+ traceline (org, self.origin + dir * 600, TRUE, self);

WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte (MSG_BROADCAST, TE_LIGHTNING1);
- WriteEntity (MSG_BROADCAST, this);
+ WriteEntity (MSG_BROADCAST, self);
WriteCoord (MSG_BROADCAST, org_x);
WriteCoord (MSG_BROADCAST, org_y);
WriteCoord (MSG_BROADCAST, org_z);
@@ -255,154 +362,152 @@ class monster_shambler: base_walkmonster
WriteCoord (MSG_BROADCAST, trace_endpos_y);
WriteCoord (MSG_BROADCAST, trace_endpos_z);

- weapon_lightning::lightning_damage (org, trace_endpos, this, 10);
+ fire_lightning (org, trace_endpos, self, 10);
};

//--------------------------------------------------------------
// ShamRocket
//--------------------------------------------------------------
- nonvirtual void() attack_lavaball =
+ void() monster_shambler_attack_lavaball =
{
- sound_attack (this, CHAN_AUTO, "boss1/throw.wav", 1, ATTN_NORM);
+ sound_attack (self, CHAN_AUTO, "boss1/throw.wav", 1, ATTN_NORM);

// custom lavaball speed -- CEV
- fire_lavaball (this.origin + v_forward * 8 + '0 0 24',
- this.enemy.origin - this.origin, 900);
+ base_monster_fire_lavaball (
+ self.origin + v_forward * 8 + '0 0 24',
+ self.enemy.origin - self.origin,
+ 900);
};

//--------------------------------------------------------------
- nonvirtual void() attack_melee2 =
+ void() monster_shambler_attack_melee2 =
{
- local float chance;
-
- chance = random ();
+ local float chance = random ();

if (chance > 0.6)
- this.swingr1 ();
+ sham_swingr1 ();
else
- this.swingl1 ();
+ sham_swingl1 ();
};

//--------------------------------------------------------------
- nonvirtual void() attack_melee =
+ void() monster_shambler_attack_melee =
{
- local float chance;
-
- chance = random ();
+ local float chance = random ();

// changed to >= as you can set custom health
- if (chance > 0.6 || this.health == 600)
- this.smash1 ();
+ if (chance > 0.6 || self.health == 600)
+ sham_smash1 ();
else if (chance > 0.3)
- this.swingr1 ();
+ sham_swingr1 ();
else
- this.swingl1 ();
+ sham_swingl1 ();
};

//--------------------------------------------------------------
// Shambler standing functions
//--------------------------------------------------------------
- nonvirtual void() stand1 = [$stand1, stand2] { ai_stand (); };
- nonvirtual void() stand2 = [$stand2, stand3] { ai_stand (); };
- nonvirtual void() stand3 = [$stand3, stand4] { ai_stand (); };
- nonvirtual void() stand4 = [$stand4, stand5] { ai_stand (); };
- nonvirtual void() stand5 = [$stand5, stand6] { ai_stand (); };
- nonvirtual void() stand6 = [$stand6, stand7] { ai_stand (); };
- nonvirtual void() stand7 = [$stand7, stand8] { ai_stand (); };
- nonvirtual void() stand8 = [$stand8, stand9] { ai_stand (); };
- nonvirtual void() stand9 = [$stand9, stand10] { ai_stand (); };
- nonvirtual void() stand10 = [$stand10, stand11] { ai_stand (); };
- nonvirtual void() stand11 = [$stand11, stand12] { ai_stand (); };
- nonvirtual void() stand12 = [$stand12, stand13] { ai_stand (); };
- nonvirtual void() stand13 = [$stand13, stand14] { ai_stand (); };
- nonvirtual void() stand14 = [$stand14, stand15] { ai_stand (); };
- nonvirtual void() stand15 = [$stand15, stand16] { ai_stand (); };
- nonvirtual void() stand16 = [$stand16, stand17] { ai_stand (); };
- nonvirtual void() stand17 = [$stand17, stand1] { ai_stand (); };
+ void() sham_stand1 = [$stand1, sham_stand2] { ai_stand (); };
+ void() sham_stand2 = [$stand2, sham_stand3] { ai_stand (); };
+ void() sham_stand3 = [$stand3, sham_stand4] { ai_stand (); };
+ void() sham_stand4 = [$stand4, sham_stand5] { ai_stand (); };
+ void() sham_stand5 = [$stand5, sham_stand6] { ai_stand (); };
+ void() sham_stand6 = [$stand6, sham_stand7] { ai_stand (); };
+ void() sham_stand7 = [$stand7, sham_stand8] { ai_stand (); };
+ void() sham_stand8 = [$stand8, sham_stand9] { ai_stand (); };
+ void() sham_stand9 = [$stand9, sham_stand10] { ai_stand (); };
+ void() sham_stand10 = [$stand10, sham_stand11] { ai_stand (); };
+ void() sham_stand11 = [$stand11, sham_stand12] { ai_stand (); };
+ void() sham_stand12 = [$stand12, sham_stand13] { ai_stand (); };
+ void() sham_stand13 = [$stand13, sham_stand14] { ai_stand (); };
+ void() sham_stand14 = [$stand14, sham_stand15] { ai_stand (); };
+ void() sham_stand15 = [$stand15, sham_stand16] { ai_stand (); };
+ void() sham_stand16 = [$stand16, sham_stand17] { ai_stand (); };
+ void() sham_stand17 = [$stand17, sham_stand1] { ai_stand (); };

//--------------------------------------------------------------
// Shambler walk functions
//--------------------------------------------------------------
- nonvirtual void() walk1 = [$walk1, walk2] { ai_walk (10); };
- nonvirtual void() walk2 = [$walk2, walk3] { ai_walk (9); };
- nonvirtual void() walk3 = [$walk3, walk4] { ai_walk (9); };
- nonvirtual void() walk4 = [$walk4, walk5] { ai_walk (5); };
- nonvirtual void() walk5 = [$walk5, walk6] { ai_walk (6); };
- nonvirtual void() walk6 = [$walk6, walk7] { ai_walk (12); };
- nonvirtual void() walk7 = [$walk7, walk8] { ai_walk (8); };
- nonvirtual void() walk8 = [$walk8, walk9] { ai_walk (3); };
- nonvirtual void() walk9 = [$walk9, walk10] { ai_walk (13); };
- nonvirtual void() walk10 = [$walk10, walk11] { ai_walk (9); };
- nonvirtual void() walk11 = [$walk11, walk12] { ai_walk (7); };
- nonvirtual void() walk12 = [$walk12, walk1]
+ void() sham_walk1 = [$walk1, sham_walk2] { ai_walk (10); };
+ void() sham_walk2 = [$walk2, sham_walk3] { ai_walk (9); };
+ void() sham_walk3 = [$walk3, sham_walk4] { ai_walk (9); };
+ void() sham_walk4 = [$walk4, sham_walk5] { ai_walk (5); };
+ void() sham_walk5 = [$walk5, sham_walk6] { ai_walk (6); };
+ void() sham_walk6 = [$walk6, sham_walk7] { ai_walk (12); };
+ void() sham_walk7 = [$walk7, sham_walk8] { ai_walk (8); };
+ void() sham_walk8 = [$walk8, sham_walk9] { ai_walk (3); };
+ void() sham_walk9 = [$walk9, sham_walk10] { ai_walk (13); };
+ void() sham_walk10 = [$walk10, sham_walk11] { ai_walk (9); };
+ void() sham_walk11 = [$walk11, sham_walk12] { ai_walk (7); };
+ void() sham_walk12 = [$walk12, sham_walk1]
{
ai_walk (7);
if (random() > 0.8)
- sound_idle (this, CHAN_VOICE, "shambler/sidle.wav",
+ sound_idle (self, CHAN_VOICE, "shambler/sidle.wav",
1, ATTN_IDLE);
};

//--------------------------------------------------------------
// Shambler run functions
//--------------------------------------------------------------
- nonvirtual void() run1 = [$run1, run2] { ai_run (20); };
- nonvirtual void() run2 = [$run2, run3] { ai_run (24); };
- nonvirtual void() run3 = [$run3, run4] { ai_run (20); };
- nonvirtual void() run4 = [$run4, run5] { ai_run (20); };
- nonvirtual void() run5 = [$run5, run6] { ai_run (24); };
- nonvirtual void() run6 = [$run6, run1]
+ void() sham_run1 = [$run1, sham_run2] { ai_run (20); };
+ void() sham_run2 = [$run2, sham_run3] { ai_run (24); };
+ void() sham_run3 = [$run3, sham_run4] { ai_run (20); };
+ void() sham_run4 = [$run4, sham_run5] { ai_run (20); };
+ void() sham_run5 = [$run5, sham_run6] { ai_run (24); };
+ void() sham_run6 = [$run6, sham_run1]
{
ai_run (20);
if (random() > 0.8)
- sound_idle (this, CHAN_VOICE, "shambler/sidle.wav",
+ sound_idle (self, CHAN_VOICE, "shambler/sidle.wav",
1, ATTN_IDLE);
};

//--------------------------------------------------------------
// Shambler smash!
//--------------------------------------------------------------
- nonvirtual void() smash1 = [$smash1, smash2]
+ void() sham_smash1 = [$smash1, sham_smash2]
{
- sound_attack (this, CHAN_VOICE, "shambler/melee1.wav",
+ sound_attack (self, CHAN_VOICE, "shambler/melee1.wav",
1, ATTN_NORM);
ai_charge (2);
};
- nonvirtual void() smash2 = [$smash2, smash3] { ai_charge (6); };
- nonvirtual void() smash3 = [$smash3, smash4] { ai_charge (6); };
- nonvirtual void() smash4 = [$smash4, smash5] { ai_charge (5); };
- nonvirtual void() smash5 = [$smash5, smash6] { ai_charge (4); };
- nonvirtual void() smash6 = [$smash6, smash7] { ai_charge (1); };
- nonvirtual void() smash7 = [$smash7, smash8] { ai_charge (0); };
- nonvirtual void() smash8 = [$smash8, smash9] { ai_charge (0); };
- nonvirtual void() smash9 = [$smash9, smash10] { ai_charge (0); };
- nonvirtual void() smash10 = [$smash10, smash11]
+ void() sham_smash2 = [$smash2, sham_smash3] { ai_charge (6); };
+ void() sham_smash3 = [$smash3, sham_smash4] { ai_charge (6); };
+ void() sham_smash4 = [$smash4, sham_smash5] { ai_charge (5); };
+ void() sham_smash5 = [$smash5, sham_smash6] { ai_charge (4); };
+ void() sham_smash6 = [$smash6, sham_smash7] { ai_charge (1); };
+ void() sham_smash7 = [$smash7, sham_smash8] { ai_charge (0); };
+ void() sham_smash8 = [$smash8, sham_smash9] { ai_charge (0); };
+ void() sham_smash9 = [$smash9, sham_smash10] { ai_charge (0); };
+ void() sham_smash10 = [$smash10, sham_smash11]
{
local vector delta;
local float ldmg;

- if (!this.enemy)
+ if (!self.enemy)
return;
ai_charge (0);

- delta = this.enemy.origin - this.origin;
+ delta = self.enemy.origin - self.origin;

if (vlen(delta) > 100)
return;
- if (!this.can_damage(this, this.enemy))
+ if (!can_damage(self, self.enemy))
return;

ldmg = (random() + random() + random()) * 40;
- this.t_damage2 (this.enemy, this, this, ldmg);
- sound_hit (this, CHAN_VOICE, "shambler/smack.wav",
+ t_damage2 (self.enemy, self, self, ldmg);
+ sound_hit (self, CHAN_VOICE, "shambler/smack.wav",
1, ATTN_NORM);

- SpawnMeatSpray (this.origin + v_forward * 16,
+ spawn_meatspray (self.origin + v_forward * 16,
crandom() * 100 * v_right);
- SpawnMeatSpray (this.origin + v_forward * 16,
+ spawn_meatspray (self.origin + v_forward * 16,
crandom() * 100 * v_right);
};
- nonvirtual void() smash11 = [$smash11, smash12] { ai_charge (5); };
- nonvirtual void() smash12 = [$smash12, run1] { ai_charge (4); };
+ void() sham_smash11 = [$smash11, sham_smash12] { ai_charge (5); };
+ void() sham_smash12 = [$smash12, sham_run1] { ai_charge (4); };

/////////////////////////////////////
// new frames for projectile style //
@@ -411,47 +516,46 @@ class monster_shambler: base_walkmonster
//--------------------------------------------------------------
// Shambler Projectile
//--------------------------------------------------------------
- nonvirtual void() proj1 = [$smash1, proj2] { ai_face (); };
- nonvirtual void() proj2 = [$smash2, proj3] { ai_face (); };
- nonvirtual void() proj3 = [$smash3, proj4] { ai_face (); };
- nonvirtual void() proj4 = [$smash4, proj5] { ai_face (); };
- nonvirtual void() proj5 = [$smash5, proj6] { ai_face (); };
- nonvirtual void() proj6 = [$smash6, proj7] { ai_face (); };
- nonvirtual void() proj7 = [$smash7, proj8] { ai_face (); };
- nonvirtual void() proj8 = [$smash8, proj9] { ai_face (); };
- nonvirtual void() proj9 = [$smash9, proj10] { ai_face (); };
- nonvirtual void() proj10 = [$smash10, proj11]
- {
- this.attack_lavaball ();
- sound_attack (this, CHAN_VOICE, "shambler/melee1.wav",
+ void() sham_proj1 = [$smash1, sham_proj2] { ai_face (); };
+ void() sham_proj2 = [$smash2, sham_proj3] { ai_face (); };
+ void() sham_proj3 = [$smash3, sham_proj4] { ai_face (); };
+ void() sham_proj4 = [$smash4, sham_proj5] { ai_face (); };
+ void() sham_proj5 = [$smash5, sham_proj6] { ai_face (); };
+ void() sham_proj6 = [$smash6, sham_proj7] { ai_face (); };
+ void() sham_proj7 = [$smash7, sham_proj8] { ai_face (); };
+ void() sham_proj8 = [$smash8, sham_proj9] { ai_face (); };
+ void() sham_proj9 = [$smash9, sham_proj10] { ai_face (); };
+ void() sham_proj10 = [$smash10, sham_proj11]
+ {
+ monster_shambler_attack_lavaball ();
+ sound_attack (self, CHAN_VOICE, "shambler/melee1.wav",
1, ATTN_NORM);
ai_face ();
};
- nonvirtual void() proj11 = [$smash11, proj12] { ai_face (); };
- nonvirtual void() proj12 = [$smash12, run1] { ai_face (); };
-
+ void() sham_proj11 = [$smash11, sham_proj12] { ai_face (); };
+ void() sham_proj12 = [$smash12, sham_run1] { ai_face (); };

//--------------------------------------------------------------
// Shambler Projectile (Turret Mode)
//--------------------------------------------------------------
- nonvirtual void() tur_proj1 = [$smash1, tur_proj2] { ai_face (); };
- nonvirtual void() tur_proj2 = [$smash2, tur_proj3] { ai_face (); };
- nonvirtual void() tur_proj3 = [$smash3, tur_proj4] { ai_face (); };
- nonvirtual void() tur_proj4 = [$smash4, tur_proj5] { ai_face (); };
- nonvirtual void() tur_proj5 = [$smash5, tur_proj6] { ai_face (); };
- nonvirtual void() tur_proj6 = [$smash6, tur_proj7] { ai_face (); };
- nonvirtual void() tur_proj7 = [$smash7, tur_proj8] { ai_face (); };
- nonvirtual void() tur_proj8 = [$smash8, tur_proj9] { ai_face (); };
- nonvirtual void() tur_proj9 = [$smash9, tur_proj10] { ai_face (); };
- nonvirtual void() tur_proj10 = [$smash10, tur_proj11]
- {
- this.attack_lavaball ();
- sound_attack (this, CHAN_VOICE, "shambler/melee1.wav",
+ void() sham_tur_proj1 = [$smash1, sham_tur_proj2] { ai_face (); };
+ void() sham_tur_proj2 = [$smash2, sham_tur_proj3] { ai_face (); };
+ void() sham_tur_proj3 = [$smash3, sham_tur_proj4] { ai_face (); };
+ void() sham_tur_proj4 = [$smash4, sham_tur_proj5] { ai_face (); };
+ void() sham_tur_proj5 = [$smash5, sham_tur_proj6] { ai_face (); };
+ void() sham_tur_proj6 = [$smash6, sham_tur_proj7] { ai_face (); };
+ void() sham_tur_proj7 = [$smash7, sham_tur_proj8] { ai_face (); };
+ void() sham_tur_proj8 = [$smash8, sham_tur_proj9] { ai_face (); };
+ void() sham_tur_proj9 = [$smash9, sham_tur_proj10] { ai_face (); };
+ void() sham_tur_proj10 = [$smash10, sham_tur_proj11]
+ {
+ monster_shambler_attack_lavaball ();
+ sound_attack (self, CHAN_VOICE, "shambler/melee1.wav",
1, ATTN_NORM);
ai_face();
};
- nonvirtual void() tur_proj11 = [$smash11, tur_proj12] { ai_face (); };
- nonvirtual void() tur_proj12 = [$smash12, seek_1] { ai_face (); };
+ void() sham_tur_proj11 = [$smash11, sham_tur_proj12] { ai_face (); };
+ void() sham_tur_proj12 = [$smash12, sham_seek_1] { ai_face (); };

/////////////////////////////////////
// end projectile style frames //
@@ -460,117 +564,108 @@ class monster_shambler: base_walkmonster
//--------------------------------------------------------------
// Shambler's left hook
//--------------------------------------------------------------
- nonvirtual void() swingl1 = [$swingl1, swingl2]
+ void() sham_swingl1 = [$swingl1, sham_swingl2]
{
- sound_misc (this, CHAN_VOICE, "shambler/melee2.wav",
+ sound_misc (self, CHAN_VOICE, "shambler/melee2.wav",
1, ATTN_NORM);
ai_charge (5);
};
- nonvirtual void() swingl2 = [$swingl2, swingl3] { ai_charge (3); };
- nonvirtual void() swingl3 = [$swingl3, swingl4] { ai_charge (7); };
- nonvirtual void() swingl4 = [$swingl4, swingl5] { ai_charge (3); };
- nonvirtual void() swingl5 = [$swingl5, swingl6] { ai_charge (7); };
- nonvirtual void() swingl6 = [$swingl6, swingl7] { ai_charge (9); };
- nonvirtual void() swingl7 = [$swingl7, swingl8]
+ void() sham_swingl2 = [$swingl2, sham_swingl3] { ai_charge (3); };
+ void() sham_swingl3 = [$swingl3, sham_swingl4] { ai_charge (7); };
+ void() sham_swingl4 = [$swingl4, sham_swingl5] { ai_charge (3); };
+ void() sham_swingl5 = [$swingl5, sham_swingl6] { ai_charge (7); };
+ void() sham_swingl6 = [$swingl6, sham_swingl7] { ai_charge (9); };
+ void() sham_swingl7 = [$swingl7, sham_swingl8]
{
ai_charge (5);
- this.attack_claw (250);
+ monster_shambler_attack_claw (250);
};
- nonvirtual void() swingl8 = [$swingl8, swingl9] { ai_charge (4); };
- nonvirtual void() swingl9 = [$swingl9, run1]
+ void() sham_swingl8 = [$swingl8, sham_swingl9] { ai_charge (4); };
+ void() sham_swingl9 = [$swingl9, sham_run1]
{
ai_charge (8);
- if (random()<0.5)
- this.think = this.swingr1;
+ if (random() < 0.5)
+ self.think = sham_swingr1;
};

//--------------------------------------------------------------
// Shambler's right hook
//--------------------------------------------------------------
- nonvirtual void() swingr1 = [$swingr1, swingr2]
+ void() sham_swingr1 = [$swingr1, sham_swingr2]
{
- sound_attack (this, CHAN_VOICE, "shambler/melee1.wav",
+ sound_attack (self, CHAN_VOICE, "shambler/melee1.wav",
1, ATTN_NORM);
ai_charge (1);
};
- nonvirtual void() swingr2 = [$swingr2, swingr3] { ai_charge (8); };
- nonvirtual void() swingr3 = [$swingr3, swingr4] { ai_charge (14); };
- nonvirtual void() swingr4 = [$swingr4, swingr5] { ai_charge (7); };
- nonvirtual void() swingr5 = [$swingr5, swingr6] { ai_charge (3); };
- nonvirtual void() swingr6 = [$swingr6, swingr7] { ai_charge (6); };
- nonvirtual void() swingr7 = [$swingr7, swingr8]
+ void() sham_swingr2 = [$swingr2, sham_swingr3] { ai_charge (8); };
+ void() sham_swingr3 = [$swingr3, sham_swingr4] { ai_charge (14); };
+ void() sham_swingr4 = [$swingr4, sham_swingr5] { ai_charge (7); };
+ void() sham_swingr5 = [$swingr5, sham_swingr6] { ai_charge (3); };
+ void() sham_swingr6 = [$swingr6, sham_swingr7] { ai_charge (6); };
+ void() sham_swingr7 = [$swingr7, sham_swingr8]
{
ai_charge (6);
- this.attack_claw (-250);
+ monster_shambler_attack_claw (-250);
};
- nonvirtual void() swingr8 = [$swingr8, swingr9] { ai_charge (3); };
- nonvirtual void() swingr9 = [$swingr9, run1]
+ void() sham_swingr8 = [$swingr8, sham_swingr9] { ai_charge (3); };
+ void() sham_swingr9 = [$swingr9, sham_run1]
{
ai_charge (1);
ai_charge (10);
- if (random()<0.5)
- this.think = this.swingl1;
+ if (random() < 0.5)
+ self.think = sham_swingl1;
};

//--------------------------------------------------------------
// ~Shambler Magic~
//--------------------------------------------------------------
- nonvirtual void() magic1 = [$magic1, magic2]
+ void() sham_magic1 = [$magic1, sham_magic2]
{
ai_face ();
- sound_misc1 (this, CHAN_WEAPON, "shambler/sattck1.wav",
+ sound_misc1 (self, CHAN_WEAPON, "shambler/sattck1.wav",
1, ATTN_NORM);
};
- nonvirtual void() magic2 = [$magic2, magic3] { ai_face (); };
- nonvirtual void() magic3 = [$magic3, magic4]
+ void() sham_magic2 = [$magic2, sham_magic3] { ai_face (); };
+ void() sham_magic3 = [$magic3, sham_magic4]
{
ai_face ();
- this.nextthink = time + 0.2;
- local entity o;
-
- this.effects = this.effects | EF_MUZZLEFLASH;
- ai_face ();
- this.trigger_field = spawn ();
- o = this.trigger_field;
- setmodel (o, "progs/s_light.mdl");
- setorigin (o, this.origin);
- o.owner = this;
- o.angles = this.angles;
- o.nextthink = time + 0.7;
- o.think = sham_arc_think;
+ self.nextthink = time + 0.2;
+ self.trigger_field = spawn_temp_shambler_field (
+ self, self.origin);
};
- nonvirtual void() magic4 = [$magic4, magic5]
+ void() sham_magic4 = [$magic4, sham_magic5]
{
- this.effects = this.effects | EF_MUZZLEFLASH;
- this.trigger_field.frame = 1;
+ self.effects = self.effects | EF_MUZZLEFLASH;
+ self.trigger_field.frame = 1;
};
- nonvirtual void() magic5 = [$magic5, magic6]
+ void() sham_magic5 = [$magic5, sham_magic6]
{
- this.effects = this.effects | EF_MUZZLEFLASH;
- this.trigger_field.frame = 2;
+ self.effects = self.effects | EF_MUZZLEFLASH;
+ self.trigger_field.frame = 2;
};
- nonvirtual void() magic6 = [$magic6, magic9]
+ void() sham_magic6 = [$magic6, sham_magic9]
{
- remove (this.trigger_field);
- this.trigger_field = world;
- this.attack_lightning ();
- sound_misc2 (this, CHAN_WEAPON, "shambler/sboom.wav",
+ remove (self.trigger_field);
+ self.trigger_field = world;
+ monster_shambler_attack_lightning ();
+ sound_misc2 (self, CHAN_WEAPON, "shambler/sboom.wav",
1, ATTN_NORM);
};
- nonvirtual void() magic9 = [$magic9, magic10]
+ // TODO CEV why are frames $magic8 and $magic9 not used?
+ void() sham_magic9 = [$magic9, sham_magic10]
{
- this.attack_lightning ();
+ monster_shambler_attack_lightning ();
};
- nonvirtual void() magic10 = [$magic10, magic11]
+ void() sham_magic10 = [$magic10, sham_magic11]
{
- this.attack_lightning ();
+ monster_shambler_attack_lightning ();
};
- nonvirtual void() magic11 = [$magic11, magic12]
+ void() sham_magic11 = [$magic11, sham_magic12]
{
if (skill == 3)
- this.attack_lightning ();
+ monster_shambler_attack_lightning ();
};
- nonvirtual void() magic12 = [$magic12, run1] { };
+ void() sham_magic12 = [$magic12, sham_run1] { };

/////////////////////////
//// turret start ////
@@ -579,96 +674,90 @@ class monster_shambler: base_walkmonster
//--------------------------------------------------------------
// ~Shambler Turret Magic~
//--------------------------------------------------------------
- nonvirtual void() tur_magic1 = [$magic1, tur_magic2]
+ void() sham_tur_magic1 = [$magic1, sham_tur_magic2]
{
ai_face ();
- sound_misc1 (this, CHAN_WEAPON, "shambler/sattck1.wav",
+ sound_misc1 (self, CHAN_WEAPON, "shambler/sattck1.wav",
1, ATTN_NORM);
};
- nonvirtual void() tur_magic2 = [$magic2, tur_magic3] {ai_face();};
- nonvirtual void() tur_magic3 = [$magic3, tur_magic4]
+ void() sham_tur_magic2 = [$magic2, sham_tur_magic3] { ai_face (); };
+ void() sham_tur_magic3 = [$magic3, sham_tur_magic4]
{
ai_face ();
- this.nextthink = time + 0.2;
- local entity o;
+ self.nextthink = time + 0.2;

- this.effects = this.effects | EF_MUZZLEFLASH;
+ self.effects = self.effects | EF_MUZZLEFLASH;
ai_face ();
- this.trigger_field = spawn ();
- o = this.trigger_field;
- setmodel (o, "progs/s_light.mdl");
- setorigin (o, this.origin);
- o.owner = this;
- o.angles = this.angles;
- o.nextthink = time + 0.7;
- o.think = sham_arc_think;
+ self.trigger_field = spawn_temp_shambler_field (
+ self, self.origin);
};
- nonvirtual void() tur_magic4 = [$magic4, tur_magic5]
+ void() sham_tur_magic4 = [$magic4, sham_tur_magic5]
{
- this.effects = this.effects | EF_MUZZLEFLASH;
- this.trigger_field.frame = 1;
+ self.effects = self.effects | EF_MUZZLEFLASH;
+ self.trigger_field.frame = 1;
};
- nonvirtual void() tur_magic5 = [$magic5, tur_magic6]
+ void() sham_tur_magic5 = [$magic5, sham_tur_magic6]
{
- this.effects = this.effects | EF_MUZZLEFLASH;
- this.trigger_field.frame = 2;
+ self.effects = self.effects | EF_MUZZLEFLASH;
+ self.trigger_field.frame = 2;
};
- nonvirtual void() tur_magic6 = [$magic6, tur_magic9]
+ void() sham_tur_magic6 = [$magic6, sham_tur_magic9]
{
- remove (this.trigger_field);
- this.trigger_field = world;
- this.attack_lightning ();
- sound_misc2 (this, CHAN_WEAPON, "shambler/sboom.wav",
+ remove (self.trigger_field);
+ self.trigger_field = world;
+ monster_shambler_attack_lightning ();
+ sound_misc2 (self, CHAN_WEAPON, "shambler/sboom.wav",
1, ATTN_NORM);
};
- nonvirtual void() tur_magic9 = [$magic9, tur_magic10]
+ // TODO CEV again why are $magic7 and $magic8 not used?
+ void() sham_tur_magic9 = [$magic9, sham_tur_magic10]
{
- this.attack_lightning ();
+ monster_shambler_attack_lightning ();
};
- nonvirtual void() tur_magic10 = [$magic10, tur_magic11]
+ void() sham_tur_magic10 = [$magic10, sham_tur_magic11]
{
- this.attack_lightning ();
+ monster_shambler_attack_lightning ();
};
- nonvirtual void() tur_magic11 = [$magic11, tur_magic12]
+ void() sham_tur_magic11 = [$magic11, sham_tur_magic12]
{
if (skill == 3)
- this.attack_lightning ();
+ monster_shambler_attack_lightning ();
};
- nonvirtual void() tur_magic12 =[ $magic12, tur_magic13] { };
- nonvirtual void() tur_magic13 =[ $stand14, tur_magic14]
+ void() sham_tur_magic12 = [$magic12, sham_tur_magic13] { };
+ void() sham_tur_magic13 = [$stand14, sham_tur_magic14]
{
ai_face ();
};
- nonvirtual void() tur_magic14 =[ $stand15, tur_magic15]
+ void() sham_tur_magic14 = [$stand15, sham_tur_magic15]
{
ai_face ();
};
- nonvirtual void() tur_magic15 =[ $stand16, tur_magic16]
+ void() sham_tur_magic15 = [$stand16, sham_tur_magic16]
{
ai_face ();
};
- nonvirtual void() tur_magic16 =[ $stand17, seek_1] { };
+ void() sham_tur_magic16 = [$stand17, sham_seek_1] { };

//--------------------------------------------------------------
// Shambler Turret Seeking state (tracking target?)
//--------------------------------------------------------------
- nonvirtual void() seek_1 = [$stand1, seek_2] { ai_run (0); };
- nonvirtual void() seek_2 = [$stand2, seek_3] { ai_run (0); };
- nonvirtual void() seek_3 = [$stand3, seek_4] { ai_run (0); };
- nonvirtual void() seek_4 = [$stand4, seek_5] { ai_run (0); };
- nonvirtual void() seek_5 = [$stand5, seek_6] { ai_run (0); };
- nonvirtual void() seek_6 = [$stand6, seek_7] { ai_run (0); };
- nonvirtual void() seek_7 = [$stand7, seek_8] { ai_run (0); };
- nonvirtual void() seek_8 = [$stand8, seek_9] { ai_run (0); };
- nonvirtual void() seek_9 = [$stand9, seek_10] { ai_run (0); };
- nonvirtual void() seek_10 = [$stand10, seek_11] { ai_run (0); };
- nonvirtual void() seek_11 = [$stand11, seek_12] { ai_run (0); };
- nonvirtual void() seek_12 = [$stand12, seek_13] { ai_run (0); };
- nonvirtual void() seek_13 = [$stand13, seek_14] { ai_run (0); };
- nonvirtual void() seek_14 = [$stand14, seek_15] { ai_run (0); };
- nonvirtual void() seek_15 = [$stand15, seek_16] { ai_run (0); };
- nonvirtual void() seek_16 = [$stand16, seek_17] { ai_run (0); };
- nonvirtual void() seek_17 = [$stand17, seek_1] { ai_run(0); };
+ void() sham_seek_1 = [$stand1, sham_seek_2] { ai_run (0); };
+ void() sham_seek_2 = [$stand2, sham_seek_3] { ai_run (0); };
+ void() sham_seek_3 = [$stand3, sham_seek_4] { ai_run (0); };
+ void() sham_seek_4 = [$stand4, sham_seek_5] { ai_run (0); };
+ void() sham_seek_5 = [$stand5, sham_seek_6] { ai_run (0); };
+ void() sham_seek_6 = [$stand6, sham_seek_7] { ai_run (0); };
+ void() sham_seek_7 = [$stand7, sham_seek_8] { ai_run (0); };
+ void() sham_seek_8 = [$stand8, sham_seek_9] { ai_run (0); };
+ void() sham_seek_9 = [$stand9, sham_seek_10] { ai_run (0); };
+ void() sham_seek_10 = [$stand10, sham_seek_11] { ai_run (0); };
+ void() sham_seek_11 = [$stand11, sham_seek_12] { ai_run (0); };
+ void() sham_seek_12 = [$stand12, sham_seek_13] { ai_run (0); };
+ void() sham_seek_13 = [$stand13, sham_seek_14] { ai_run (0); };
+ void() sham_seek_14 = [$stand14, sham_seek_15] { ai_run (0); };
+ void() sham_seek_15 = [$stand15, sham_seek_16] { ai_run (0); };
+ void() sham_seek_16 = [$stand16, sham_seek_17] { ai_run (0); };
+ void() sham_seek_17 = [$stand17, sham_seek_1] { ai_run (0); };

/////////////////////////
//// turret end ////
@@ -677,30 +766,30 @@ class monster_shambler: base_walkmonster
//--------------------------------------------------------------
// Shambler Pain state
//--------------------------------------------------------------
- nonvirtual void() pain1 = [$pain1, pain2] { };
- nonvirtual void() pain2 = [$pain2, pain3] { };
- nonvirtual void() pain3 = [$pain3, pain4] { };
- nonvirtual void() pain4 = [$pain4, pain5] { };
- nonvirtual void() pain5 = [$pain5, pain6] { };
- nonvirtual void() pain6 = [$pain6, run1] { };
+ void() sham_pain1 = [$pain1, sham_pain2] { };
+ void() sham_pain2 = [$pain2, sham_pain3] { };
+ void() sham_pain3 = [$pain3, sham_pain4] { };
+ void() sham_pain4 = [$pain4, sham_pain5] { };
+ void() sham_pain5 = [$pain5, sham_pain6] { };
+ void() sham_pain6 = [$pain6, sham_run1] { };

//--------------------------------------------------------------
// Shambler Death state
//--------------------------------------------------------------
- nonvirtual void() death1 = [$death1, death2] { };
- nonvirtual void() death2 = [$death2, death3] { };
- nonvirtual void() death3 = [$death3, death4]
+ void() sham_death1 = [$death1, sham_death2] { };
+ void() sham_death2 = [$death2, sham_death3] { };
+ void() sham_death3 = [$death3, sham_death4]
{
- this.solid = SOLID_NOT;
+ self.solid = SOLID_NOT;
};
- nonvirtual void() death4 = [$death4, death5] { };
- nonvirtual void() death5 = [$death5, death6] { };
- nonvirtual void() death6 = [$death6, death7] { };
- nonvirtual void() death7 = [$death7, death8] { };
- nonvirtual void() death8 = [$death8, death9] { };
- nonvirtual void() death9 = [$death9, death10] { };
- nonvirtual void() death10 = [$death10, death11] { };
- nonvirtual void() death11 = [$death11, death11] { };
+ void() sham_death4 = [$death4, sham_death5] { };
+ void() sham_death5 = [$death5, sham_death6] { };
+ void() sham_death6 = [$death6, sham_death7] { };
+ void() sham_death7 = [$death7, sham_death8] { };
+ void() sham_death8 = [$death8, sham_death9] { };
+ void() sham_death9 = [$death9, sham_death10] { };
+ void() sham_death10 = [$death10, sham_death11] { };
+ void() sham_death11 = [$death11, sham_death11] { };

//==============================================================
// Interaction
@@ -709,15 +798,15 @@ class monster_shambler: base_walkmonster
//--------------------------------------------------------------
// sham_pain
//--------------------------------------------------------------
- virtual void(entity attacker, float damage) do_damage =
+ void(entity attacker, float damage) monster_shambler_pain =
{
- sound_pain (this, CHAN_VOICE, "shambler/shurt2.wav",
+ sound_pain (self, CHAN_VOICE, "shambler/shurt2.wav",
1, ATTN_NORM);

- if (this.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & I_AM_TURRET)
return;

- if (this.health <= 0)
+ if (self.health <= 0)
// allready dying, don't go into pain frame
return;

@@ -725,76 +814,66 @@ class monster_shambler: base_walkmonster
// didn't flinch
return;

- if (this.pain_finished > time)
+ if (self.pain_finished > time)
return;
- this.pain_finished = time + 2;
+ self.pain_finished = time + 2;

- if (this.trigger_field != world &&
- this.trigger_field.owner == this)
+ if (self.trigger_field != world &&
+ self.trigger_field.owner == self)
{
- this.trigger_field.frame = 2;
+ self.trigger_field.frame = 2;
}
- this.trigger_field = world;
+ self.trigger_field = world;

- this.pain1 ();
+ sham_pain1 ();
};

//--------------------------------------------------------------
// sham_die
//--------------------------------------------------------------
- virtual void() do_destroy =
+ void() monster_shambler_destroy =
{
// check for gib
- if (this.health < -60)
+ if (self.health < -60)
{
- sound (this, CHAN_VOICE, "player/udeath.wav",
+ sound (self, CHAN_VOICE, "player/udeath.wav",
1, ATTN_NORM);
+
// dumptruck_ds custom_mdls
- if (this.mdl_head != "")
- {
- ThrowHead (this.mdl_head, this.health);
- }
+ if (self.mdl_head != "")
+ throw_head (self.mdl_head, self.health);
else
- {
- ThrowHead ("progs/h_shams.mdl", this.health);
- }
- // ThrowGib ("progs/gib1.mdl", this.health);
- // ThrowGib ("progs/gib2.mdl", this.health);
- // ThrowGib ("progs/gib3.mdl", this.health);
+ throw_head ("progs/h_shams.mdl", self.health);
+
+ // throw_gib ("progs/gib1.mdl", self.health);
+ // throw_gib ("progs/gib2.mdl", self.health);
+ // throw_gib ("progs/gib3.mdl", self.health);
+
// custom models -- dumptruck_ds
- if (this.mdl_gib1 != "")
- {
- ThrowGib (this.mdl_gib1, this.health);
- }
+ if (self.mdl_gib1 != "")
+ throw_gib (self.mdl_gib1, self.health);
else
- {
- ThrowGib ("progs/gib1.mdl", this.health);
- }
- if (this.mdl_gib2 != "")
- {
- ThrowGib (this.mdl_gib2, this.health);
- }
+ throw_gib ("progs/gib1.mdl", self.health);
+
+ if (self.mdl_gib2 != "")
+ throw_gib (self.mdl_gib2, self.health);
else
- {
- ThrowGib ("progs/gib2.mdl", this.health);
- }
- if (this.mdl_gib3 != "")
- {
- ThrowGib (this.mdl_gib3, this.health);
- }
+ throw_gib ("progs/gib2.mdl", self.health);
+
+ if (self.mdl_gib3 != "")
+ throw_gib (self.mdl_gib3, self.health);
else
- {
- ThrowGib ("progs/gib3.mdl", this.health);
- }
- base_item::drop_stuff (this);
+ throw_gib ("progs/gib3.mdl", self.health);
+
+ base_item_drop_stuff (self);
return;
}

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

//==============================================================
@@ -802,91 +881,100 @@ class monster_shambler: base_walkmonster
//==============================================================

//--------------------------------------------------------------
- virtual void() init_spawned =
+ void(entity e) monster_shambler_init =
{
if (deathmatch)
{
- remove (this);
+ remove (e);
return;
}

+ e.classname = "monster_shambler";
+ e.classtype = CT_MONSTER_SHAMBLER;
+
// custom_mdls dumptruck_ds
- precache_body_model ("progs/shambler.mdl");
+ precache_body_model (e, "progs/shambler.mdl");
// custom_mdls dumptruck_ds
- precache_head_model ("progs/h_shams.mdl");
+ precache_head_model (e, "progs/h_shams.mdl");
// precache_model ("progs/shambler.mdl");
precache_model ("progs/s_light.mdl");
// precache_model ("progs/h_shams.mdl");
precache_model ("progs/bolt.mdl");
- precache_proj_model ("progs/lavaball.mdl");
-
- precache_sound_misc1 ("shambler/sattck1.wav");
- precache_sound_misc2 ("shambler/sboom.wav");
- precache_sound_death ("shambler/sdeath.wav");
- precache_sound_pain ("shambler/shurt2.wav");
- precache_sound_idle ("shambler/sidle.wav");
- precache_sound_sight ("shambler/ssight.wav");
- precache_sound_attack ("shambler/melee1.wav");
- precache_sound_misc ("shambler/melee2.wav");
- precache_sound_hit ("shambler/smack.wav");
+ precache_proj_model (e, "progs/lavaball.mdl");
+
+ precache_sound_misc1 (e, "shambler/sattck1.wav");
+ precache_sound_misc2 (e, "shambler/sboom.wav");
+ precache_sound_death (e, "shambler/sdeath.wav");
+ precache_sound_pain (e, "shambler/shurt2.wav");
+ precache_sound_idle (e, "shambler/sidle.wav");
+ precache_sound_sight (e, "shambler/ssight.wav");
+ precache_sound_attack (e, "shambler/melee1.wav");
+ precache_sound_misc (e, "shambler/melee2.wav");
+ precache_sound_hit (e, "shambler/smack.wav");
// jaycie erysdren 2021-09-14
precache_sound ("boss1/throw.wav");

- precache_gib1 ("progs/gib1.mdl");
- precache_gib2 ("progs/gib2.mdl");
- precache_gib3 ("progs/gib3.mdl");
+ precache_gib1 (e, "progs/gib1.mdl");
+ precache_gib2 (e, "progs/gib2.mdl");
+ precache_gib3 (e, "progs/gib3.mdl");

- this.solid = SOLID_SLIDEBOX;
- this.movetype = MOVETYPE_STEP;
- body_model ("progs/shambler.mdl");
- // setmodel (this, "progs/shambler.mdl");
+ e.solid = SOLID_SLIDEBOX;
+ e.movetype = MOVETYPE_STEP;
+ body_model (e, "progs/shambler.mdl");
+ // setmodel (e, "progs/shambler.mdl");

- setsize (this, VEC_HULL2_MIN, VEC_HULL2_MAX);
+ setsize (e, VEC_HULL2_MIN, VEC_HULL2_MAX);

- if (!this.health)
+ if (!e.health)
// thanks RennyC -- dumptruck_ds
- this.health = 600;
+ e.health = 600;

- if (this.proj_speed_mod <= 0)
- this.proj_speed_mod = 1;
+ if (e.proj_speed_mod <= 0)
+ e.proj_speed_mod = 1;

- this.think_stand = this.stand1;
- this.think_walk = this.walk1;
- if (this.spawnflags & I_AM_TURRET)
- this.think_run = this.seek_1;
+ e.checkattack = monster_shambler_checkattack;
+ e.sightsound = monster_shambler_sightsound;
+ e.think_stand = sham_stand1;
+ e.think_walk = sham_walk1;
+ if (e.spawnflags & I_AM_TURRET)
+ e.think_run = sham_seek_1;
else
- this.think_run = this.run1;
- this.th_die = this.do_destroy;
- if (this.style == 1)
- this.think_melee = this.attack_melee2;
+ e.think_run = sham_run1;
+ e.destroy = monster_shambler_destroy;
+ if (e.style == 1)
+ e.think_melee = monster_shambler_attack_melee2;
else
- this.think_melee = this.attack_melee;
- if (this.style == 1)
- this.think_missile = this.proj1;
+ e.think_melee = monster_shambler_attack_melee;
+ if (e.style == 1)
+ e.think_missile = sham_proj1;
else
- this.think_missile = this.magic1;
- if (this.style == 1)
- this.think_turret = this.tur_proj1;
+ e.think_missile = sham_magic1;
+ if (e.style == 1)
+ e.think_turret = sham_tur_proj1;
else
- this.think_turret = this.tur_magic1;
+ e.think_turret = sham_tur_magic1;
// Berserk test from
// http://celephais.net/board/view_thread.php?id=4&start=3465
// -- dumptruck_ds
- if !(this.berserk)
- this.th_pain = this.do_damage;
+ if !(e.berserk)
+ e.pain = monster_shambler_pain;
else
- this.th_pain = sub_nullpain;
+ e.pain = sub_nullpain;

// walkmonster_start
- super::init_spawned ();
+ base_walkmonster_init (e);
};

//--------------------------------------------------------------
void() monster_shambler =
{
- this.classtype = CT_MONSTER_SHAMBLER;
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ monster_shambler_init (self);
};
-};
+// };

/* Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds */

@@ -897,7 +985,8 @@ class monster_shambler: base_walkmonster
*/
void() monster_dead_shambler =
{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
return;

precache_model("progs/shambler.mdl");

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

Diff qc/monsters/soldier.qc

diff --git a/qc/monsters/soldier.qc b/qc/monsters/soldier.qc
index 1e64e89..aa334d9 100644
--- a/qc/monsters/soldier.qc
+++ b/qc/monsters/soldier.qc
@@ -3,8 +3,62 @@
//==============================================================================

//======================================================================
+// forward declarations
+//======================================================================
+
+// monster_army
+float() monster_army_checkattack;
+void() monster_army_sightsound;
+void() monster_army_fire;
+void(entity attacker, float damage) monster_army_pain;
+void() monster_army_destroy;
+void() army_stand1; void() army_stand2; // animation & thinking
+void() army_stand3; void() army_stand4; void() army_stand5;
+void() army_stand6; void() army_stand7; void() army_stand8;
+void() army_walk1; void() army_walk2; void() army_walk3; void() army_walk4;
+void() army_walk5; void() army_walk6; void() army_walk7; void() army_walk8;
+void() army_walk9; void() army_walk10; void() army_walk11; void() army_walk12;
+void() army_walk13; void() army_walk14; void() army_walk15; void() army_walk16;
+void() army_walk17; void() army_walk18; void() army_walk19; void() army_walk20;
+void() army_walk21; void() army_walk22; void() army_walk23; void() army_walk24;
+void() army_run1; void() army_run2; void() army_run3; void() army_run4;
+void() army_run5; void() army_run6; void() army_run7; void() army_run8;
+void() army_atk1; void() army_atk2; void() army_atk3; void() army_atk4;
+void() army_atk5; void() army_atk6; void() army_atk7; void() army_atk8;
+void() army_atk9;
+void() army_tur_atk1; void() army_tur_atk2; void() army_tur_atk3;
+void() army_tur_atk4; void() army_tur_atk5; void() army_tur_atk6;
+void() army_tur_atk7; void() army_tur_atk8; void() army_tur_atk9;
+void() army_tur_atk10;
+void() army_seek_stand1; void() army_seek_stand2; void() army_seek_stand3;
+void() army_seek_stand4; void() army_seek_stand5; void() army_seek_stand6;
+void() army_seek_stand7; void() army_seek_stand8;
+void() army_pain1; void() army_pain2; void() army_pain3; void() army_pain4;
+void() army_pain5; void() army_pain6;
+void() army_painb1; void() army_painb2; void() army_painb3; void() army_painb4;
+void() army_painb5; void() army_painb6; void() army_painb7; void() army_painb8;
+void() army_painb9; void() army_painb10; void() army_painb11;
+void() army_painb12; void() army_painb13; void() army_painb14;
+void() army_painc1; void() army_painc2; void() army_painc3; void() army_painc4;
+void() army_painc5; void() army_painc6; void() army_painc7; void() army_painc8;
+void() army_painc9; void() army_painc10; void() army_painc11;
+void() army_painc12; void() army_painc13;
+void() army_die1; void() army_die2; void() army_die3; void() army_die4;
+void() army_die5; void() army_die6; void() army_die7; void() army_die8;
+void() army_die9; void() army_die10;
+void() army_cdie1; void() army_cdie2; void() army_cdie3; void() army_cdie4;
+void() army_cdie5; void() army_cdie6; void() army_cdie7; void() army_cdie8;
+void() army_cdie9; void() army_cdie10; void() army_cdie11;
+void(entity e) monster_army_init; // initialization
+void() monster_army;
+
+// monster_dead_army
+void() monster_dead_army;
+
+//======================================================================
// frame macros
//======================================================================
+
$cd id1/models/soldier3
$origin 0 -6 24
$base base
@@ -36,6 +90,8 @@ $frame prowl_1 prowl_2 prowl_3 prowl_4 prowl_5 prowl_6 prowl_7 prowl_8
$frame prowl_9 prowl_10 prowl_11 prowl_12 prowl_13 prowl_14 prowl_15 prowl_16
$frame prowl_17 prowl_18 prowl_19 prowl_20 prowl_21 prowl_22 prowl_23 prowl_24

+//------------------------------------------------------------------------------
+
/*QUAKED monster_army (1 0 0) (-16 -16 -24) (16 16 40) AMBUSH X X TRIGGER_SPAWNED X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ("progs/soldier.mdl");
@@ -101,16 +157,14 @@ obit_name(string) : "When used with obit_method, this will set part of the text
obit_method(string) : "When used with obit_name, will set part of the text for a custom obituary. e.g. eviscerated - If empty, defaults to killed."
damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by this number (e.g. 4 = Quad damage)"
*/
-class monster_army: base_walkmonster
-{
- float attack_elevation;
-
+// class monster_army: base_walkmonster
+// {
//--------------------------------------------------------------
// SoldierCheckAttack
// The player is in view, so decide to move or launch an attack
// Returns FALSE if movement should continue
//--------------------------------------------------------------
- virtual float() ai_checkattack =
+ float() monster_army_checkattack =
{
local vector spot1, spot2;
local entity targ;
@@ -118,32 +172,32 @@ class monster_army: base_walkmonster

// dprint ("SoldierAttack\n");
// dumptruck_ds
- if (this.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & I_AM_TURRET)
{
- // this.th_turret ();
- this.attack_state = AS_MISSILE;
+ // self.th_turret ();
+ self.attack_state = AS_MISSILE;
sub_attackfinished (1 + random());
if (random() < 0.3)
- this.lefty = !this.lefty;
+ self.lefty = !self.lefty;
return TRUE;
}

- targ = this.enemy;
+ targ = self.enemy;

// see if any entities are in the way of the shot
- spot1 = this.origin + this.view_ofs;
+ spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;

- traceline (spot1, spot2, FALSE, this);
+ traceline (spot1, spot2, FALSE, self);

if (trace_inopen && trace_inwater)
// sight line crossed contents
return FALSE;

- if ((this.spawnflags & I_AM_TURRET) && (trace_ent != targ))
+ if ((self.spawnflags & I_AM_TURRET) && (trace_ent != targ))
{
// dprint("trace_ent...\n");
- this.attack_state = AS_TURRET;
+ self.attack_state = AS_TURRET;
return FALSE;
}

@@ -152,7 +206,7 @@ class monster_army: base_walkmonster
return FALSE;

// missile attack
- if (time < this.attack_finished)
+ if (time < self.attack_finished)
return FALSE;

if (enemy_range == RANGE_FAR)
@@ -169,10 +223,10 @@ class monster_army: base_walkmonster

if (random() < chance)
{
- this.think_missile ();
+ self.think_missile ();
sub_attackfinished (1 + random());
if (random() < 0.3)
- this.lefty = !this.lefty;
+ self.lefty = !self.lefty;

return TRUE;
}
@@ -181,70 +235,71 @@ class monster_army: base_walkmonster
};

//--------------------------------------------------------------
- virtual void() ai_sightsound =
+ void() monster_army_sightsound =
{
- sound_sight (this, CHAN_VOICE, "soldier/sight1.wav",
+ sound_sight (self, CHAN_VOICE, "soldier/sight1.wav",
1, ATTN_NORM);
};

//--------------------------------------------------------------
- nonvirtual void() army_fire =
+ void() monster_army_fire =
{
// dumptruck_ds start rocket grunt stuff
- if (this.style == 1)
+ if (self.style == 1)
{
// Rocket
ai_face ();
- makevectors (this.angles);
+ makevectors (self.angles);
// org, dir, direct_damage, splash_damage, speed
- fire_rocket (this.origin +
+ base_monster_fire_rocket (self.origin +
(v_forward * 30 + v_right * 5 + '0 0 12'),
- this.enemy.origin - this.origin, 30, 40, 900);
+ self.enemy.origin - self.origin, 30, 40, 900);
}
- else if (this.style == 2)
+ else if (self.style == 2)
{
// Grenade
ai_face ();
// TODO CEV calling makevectors here & then again in
// fire_grenade below is not ideal
- makevectors (this.angles);
+ makevectors (self.angles);
// grunt grenade offset
- local vector org1 = this.origin +
+ local vector org1 = self.origin +
(v_forward * 30 + v_right * 5 + '0 0 16');
- if (this.spawnflags & I_AM_TURRET)
- fire_grenade (org1, 40, 40, attack_elevation);
+ if (self.spawnflags & I_AM_TURRET)
+ base_monster_fire_grenade (
+ org1, 40, 40, self.attack_elevation);
else
- fire_grenade (org1, 40, 40, 0);
+ base_monster_fire_grenade (org1, 40, 40, 0);
}
- else if (this.style == 3)
+ else if (self.style == 3)
{
// Enforcer Laser
ai_face ();
- makevectors (this.angles);
- fire_laser (this.origin +
+ makevectors (self.angles);
+ base_monster_fire_laser (self.origin +
(v_forward * 30 + v_right * 5 + '0 0 12'),
- this.enemy.origin - this.origin);
+ self.enemy.origin - self.origin);
}
- else if (this.style == 4 || this.style == 5)
+ else if (self.style == 4 || self.style == 5)
{
// Nailgun; MonFireSpike -- used for Grunts
ai_face ();

- sound_attack (this, CHAN_WEAPON, "weapons/rocket1i.wav",
+ sound_attack (self, CHAN_WEAPON, "weapons/rocket1i.wav",
1, ATTN_NORM);
- this.effects = this.effects | EF_MUZZLEFLASH;
+ self.effects = self.effects | EF_MUZZLEFLASH;

- if (this.style == 5)
- this.attack_finished = time + 1.5;
+ if (self.style == 5)
+ self.attack_finished = time + 1.5;
else
- this.attack_finished = time + 0.2;
+ self.attack_finished = time + 0.2;

// thanks Voidforce -- dumptruck_ds
- makevectors (this.angles);
+ makevectors (self.angles);

- fire_spike (this.origin +
+ base_monster_fire_spike (self.origin +
(v_forward * 30 + v_right * 5 + '0 0 12'),
- this.enemy.origin - this.origin,
+ self.enemy.origin - self.origin,
SPIKE_SUPER_DAMAGE, SPIKE_SPEED);
}
else
@@ -253,26 +308,27 @@ class monster_army: base_walkmonster

ai_face ();

- this.effects |= EF_MUZZLEFLASH;
- sound_attack (this, CHAN_WEAPON, "soldier/sattck1.wav",
+ self.effects |= EF_MUZZLEFLASH;
+ sound_attack (self, CHAN_WEAPON, "soldier/sattck1.wav",
1, ATTN_NORM);

// FireBullets (4, dir, '0.1 0.1 0');

// fire somewhat behind the player, so a dodging player
// is harder to hit
- dir = this.enemy.origin - this.enemy.velocity * 0.2;
- dir = normalize (dir - this.origin);
- makevectors (this.angles);
- fire_shotgun (this.origin + (v_forward * 10 + '0 0 12'),
+ dir = self.enemy.origin - self.enemy.velocity * 0.2;
+ dir = normalize (dir - self.origin);
+ makevectors (self.angles);
+ base_monster_fire_shotgun (
+ self.origin + (v_forward * 10 + '0 0 12'),
dir, '0.1 0.1 0');
}
};

//--------------------------------------------------------------
- virtual void(entity attacker, float damage) do_damage =
+ void(entity attacker, float damage) monster_army_pain =
{
- if (this.pain_finished > time)
+ if (self.pain_finished > time)
return;

local float r = random ();
@@ -281,249 +337,245 @@ class monster_army: base_walkmonster
{
// turret checks moved here to play pain sounds
// correctly -- dumptruck_ds
- this.pain_finished = time + 0.6;
- sound_pain (this, CHAN_VOICE, "soldier/pain1.wav",
+ self.pain_finished = time + 0.6;
+ sound_pain (self, CHAN_VOICE, "soldier/pain1.wav",
1, ATTN_NORM);
- if (this.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & I_AM_TURRET)
return;
else
- this.pain1 ();
+ army_pain1 ();
}
else if (r < 0.6)
{
- this.pain_finished = time + 1.1;
- sound_misc (this, CHAN_VOICE, "soldier/pain2.wav",
+ self.pain_finished = time + 1.1;
+ sound_misc (self, CHAN_VOICE, "soldier/pain2.wav",
1, ATTN_NORM);
- if (this.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & I_AM_TURRET)
return;
else
- this.painb2 ();
+ army_painb2 ();
}
else
{
- this.pain_finished = time + 1.1;
- sound_misc (this, CHAN_VOICE, "soldier/pain2.wav",
+ self.pain_finished = time + 1.1;
+ sound_misc (self, CHAN_VOICE, "soldier/pain2.wav",
1, ATTN_NORM);
- if (this.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & I_AM_TURRET)
return;
else
- this.painc1 ();
+ army_painc1 ();
}
};

//--------------------------------------------------------------
- virtual void() do_destroy =
+ void() monster_army_destroy =
{
// check for gib
- if (this.health < -35)
+ if (self.health < -35)
{
- sound (this, CHAN_VOICE, "player/udeath.wav",
+ sound (self, CHAN_VOICE, "player/udeath.wav",
1, ATTN_NORM);
- if (this.mdl_head != "")
+ if (self.mdl_head != "")
{
// dumptruck_ds custom_mdls
- ThrowHead (this.mdl_head, this.health);
+ throw_head (self.mdl_head, self.health);
}
else
{
- ThrowHead ("progs/h_guard.mdl", this.health);
+ throw_head ("progs/h_guard.mdl", self.health);
}
- // ThrowGib ("progs/gib1.mdl", this.health);
- // ThrowGib ("progs/gib2.mdl", this.health);
- // ThrowGib ("progs/gib3.mdl", this.health);
- if (this.mdl_gib1 != "")
+ // throw_gib ("progs/gib1.mdl", self.health);
+ // throw_gib ("progs/gib2.mdl", self.health);
+ // throw_gib ("progs/gib3.mdl", self.health);
+ if (self.mdl_gib1 != "")
{
// custom models -- dumptruck_ds
- ThrowGib (this.mdl_gib1, this.health);
+ throw_gib (self.mdl_gib1, self.health);
}
else
{
- ThrowGib ("progs/gib1.mdl", this.health);
+ throw_gib ("progs/gib1.mdl", self.health);
}
- if (this.mdl_gib2 != "")
+ if (self.mdl_gib2 != "")
{
- ThrowGib (this.mdl_gib2, this.health);
+ throw_gib (self.mdl_gib2, self.health);
}
else
{
- ThrowGib ("progs/gib2.mdl", this.health);
+ throw_gib ("progs/gib2.mdl", self.health);
}
- if (this.mdl_gib3 != "")
+ if (self.mdl_gib3 != "")
{
- ThrowGib (this.mdl_gib3, this.health);
+ throw_gib (self.mdl_gib3, self.health);
}
else
{
- ThrowGib ("progs/gib3.mdl", this.health);
+ throw_gib ("progs/gib3.mdl", self.health);
}
- base_item::drop_stuff (this);
+ base_item_drop_stuff (self);
return;
}

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

//--------------------------------------------------------------
// Grunt stand functions
//--------------------------------------------------------------
- nonvirtual void() stand1 = [$stand1, stand2] { ai_stand (); };
- nonvirtual void() stand2 = [$stand2, stand3] { ai_stand (); };
- nonvirtual void() stand3 = [$stand3, stand4] { ai_stand (); };
- nonvirtual void() stand4 = [$stand4, stand5] { ai_stand (); };
- nonvirtual void() stand5 = [$stand5, stand6] { ai_stand (); };
- nonvirtual void() stand6 = [$stand6, stand7] { ai_stand (); };
- nonvirtual void() stand7 = [$stand7, stand8] { ai_stand (); };
- nonvirtual void() stand8 = [$stand8, stand1] { ai_stand (); };
+ void() army_stand1 = [$stand1, army_stand2] { ai_stand (); };
+ void() army_stand2 = [$stand2, army_stand3] { ai_stand (); };
+ void() army_stand3 = [$stand3, army_stand4] { ai_stand (); };
+ void() army_stand4 = [$stand4, army_stand5] { ai_stand (); };
+ void() army_stand5 = [$stand5, army_stand6] { ai_stand (); };
+ void() army_stand6 = [$stand6, army_stand7] { ai_stand (); };
+ void() army_stand7 = [$stand7, army_stand8] { ai_stand (); };
+ void() army_stand8 = [$stand8, army_stand1] { ai_stand (); };

//--------------------------------------------------------------
// Grunt walk functions
//--------------------------------------------------------------
- nonvirtual void() walk1 = [$prowl_1, walk2]
+ void() army_walk1 = [$prowl_1, army_walk2]
{
if (random() < 0.2)
- sound_idle (this, CHAN_VOICE, "soldier/idle.wav",
+ sound_idle (self, CHAN_VOICE, "soldier/idle.wav",
1, ATTN_IDLE);
ai_walk (1);
};
- nonvirtual void() walk2 = [$prowl_2, walk3] { ai_walk (1); };
- nonvirtual void() walk3 = [$prowl_3, walk4] { ai_walk (1); };
- nonvirtual void() walk4 = [$prowl_4, walk5] { ai_walk (1); };
- nonvirtual void() walk5 = [$prowl_5, walk6] { ai_walk (2); };
- nonvirtual void() walk6 = [$prowl_6, walk7] { ai_walk (3); };
- nonvirtual void() walk7 = [$prowl_7, walk8] { ai_walk (4); };
- nonvirtual void() walk8 = [$prowl_8, walk9] { ai_walk (4); };
- nonvirtual void() walk9 = [$prowl_9, walk10] { ai_walk (2); };
- nonvirtual void() walk10 = [$prowl_10, walk11] { ai_walk (2); };
- nonvirtual void() walk11 = [$prowl_11, walk12] { ai_walk (2); };
- nonvirtual void() walk12 = [$prowl_12, walk13] { ai_walk (1); };
- nonvirtual void() walk13 = [$prowl_13, walk14] { ai_walk (0); };
- nonvirtual void() walk14 = [$prowl_14, walk15] { ai_walk (1); };
- nonvirtual void() walk15 = [$prowl_15, walk16] { ai_walk (1); };
- nonvirtual void() walk16 = [$prowl_16, walk17] { ai_walk (1); };
- nonvirtual void() walk17 = [$prowl_17, walk18] { ai_walk (3); };
- nonvirtual void() walk18 = [$prowl_18, walk19] { ai_walk (3); };
- nonvirtual void() walk19 = [$prowl_19, walk20] { ai_walk (3); };
- nonvirtual void() walk20 = [$prowl_20, walk21] { ai_walk (3); };
- nonvirtual void() walk21 = [$prowl_21, walk22] { ai_walk (2); };
- nonvirtual void() walk22 = [$prowl_22, walk23] { ai_walk (1); };
- nonvirtual void() walk23 = [$prowl_23, walk24] { ai_walk (1); };
- nonvirtual void() walk24 = [$prowl_24, walk1] { ai_walk (1); };
+ void() army_walk2 = [$prowl_2, army_walk3] { ai_walk (1); };
+ void() army_walk3 = [$prowl_3, army_walk4] { ai_walk (1); };
+ void() army_walk4 = [$prowl_4, army_walk5] { ai_walk (1); };
+ void() army_walk5 = [$prowl_5, army_walk6] { ai_walk (2); };
+ void() army_walk6 = [$prowl_6, army_walk7] { ai_walk (3); };
+ void() army_walk7 = [$prowl_7, army_walk8] { ai_walk (4); };
+ void() army_walk8 = [$prowl_8, army_walk9] { ai_walk (4); };
+ void() army_walk9 = [$prowl_9, army_walk10] { ai_walk (2); };
+ void() army_walk10 = [$prowl_10, army_walk11] { ai_walk (2); };
+ void() army_walk11 = [$prowl_11, army_walk12] { ai_walk (2); };
+ void() army_walk12 = [$prowl_12, army_walk13] { ai_walk (1); };
+ void() army_walk13 = [$prowl_13, army_walk14] { ai_walk (0); };
+ void() army_walk14 = [$prowl_14, army_walk15] { ai_walk (1); };
+ void() army_walk15 = [$prowl_15, army_walk16] { ai_walk (1); };
+ void() army_walk16 = [$prowl_16, army_walk17] { ai_walk (1); };
+ void() army_walk17 = [$prowl_17, army_walk18] { ai_walk (3); };
+ void() army_walk18 = [$prowl_18, army_walk19] { ai_walk (3); };
+ void() army_walk19 = [$prowl_19, army_walk20] { ai_walk (3); };
+ void() army_walk20 = [$prowl_20, army_walk21] { ai_walk (3); };
+ void() army_walk21 = [$prowl_21, army_walk22] { ai_walk (2); };
+ void() army_walk22 = [$prowl_22, army_walk23] { ai_walk (1); };
+ void() army_walk23 = [$prowl_23, army_walk24] { ai_walk (1); };
+ void() army_walk24 = [$prowl_24, army_walk1] { ai_walk (1); };

//--------------------------------------------------------------
// Grunt run functions
//--------------------------------------------------------------
- nonvirtual void() run1 = [$run1, run2]
+ void() army_run1 = [$run1, army_run2]
{
if (random() < 0.2)
- sound_idle (this, CHAN_VOICE, "soldier/idle.wav",
+ sound_idle (self, CHAN_VOICE, "soldier/idle.wav",
1, ATTN_IDLE);
ai_run (11);
};
- nonvirtual void() run2 = [$run2, run3] { ai_run (15); };
- nonvirtual void() run3 = [$run3, run4] { ai_run (10); };
- nonvirtual void() run4 = [$run4, run5] { ai_run (10); };
- nonvirtual void() run5 = [$run5, run6] { ai_run (8); };
- nonvirtual void() run6 = [$run6, run7] { ai_run (15); };
- nonvirtual void() run7 = [$run7, run8] { ai_run (10); };
- nonvirtual void() run8 = [$run8, run1] { ai_run (8); };
+ void() army_run2 = [$run2, army_run3] { ai_run (15); };
+ void() army_run3 = [$run3, army_run4] { ai_run (10); };
+ void() army_run4 = [$run4, army_run5] { ai_run (10); };
+ void() army_run5 = [$run5, army_run6] { ai_run (8); };
+ void() army_run6 = [$run6, army_run7] { ai_run (15); };
+ void() army_run7 = [$run7, army_run8] { ai_run (10); };
+ void() army_run8 = [$run8, army_run1] { ai_run (8); };

//--------------------------------------------------------------
// Grunt attack functions
//--------------------------------------------------------------
- nonvirtual void() atk1 = [$shoot1, atk2]
+ void() army_atk1 = [$shoot1, army_atk2]
{
ai_face ();
- this.count = 0;
- this.t_length = 4 + floor (random() * 4);
+ self.count = 0;
+ self.t_length = 4 + floor (random() * 4);
};
- nonvirtual void() atk2 = [$shoot2, atk3] { ai_face (); };
- nonvirtual void() atk3 = [$shoot3, atk4] { ai_face (); };
- nonvirtual void() atk4 = [$shoot4, atk5] { ai_face (); };
- nonvirtual void() atk5 =
+ void() army_atk2 = [$shoot2, army_atk3] { ai_face (); };
+ void() army_atk3 = [$shoot3, army_atk4] { ai_face (); };
+ void() army_atk4 = [$shoot4, army_atk5] { ai_face (); };
+ void() army_atk5 =
{
- this.frame = $shoot5;
- this.nextthink = time + 0.1;
- if (this.style == 5 && this.count < this.t_length)
- {
- this.count +=1;
- }
+ self.frame = $shoot5;
+ self.nextthink = time + 0.1;
+
+ if (self.style == 5 && self.count < self.t_length)
+ self.count +=1;
else
- {
- this.think = this.atk6;
- }
+ self.think = army_atk6;
+
ai_face ();
- army_fire ();
+ monster_army_fire ();
};
- nonvirtual void() atk6 = [$shoot6, atk7] { ai_face (); };
- nonvirtual void() atk7 = [$shoot7, atk8]
+ void() army_atk6 = [$shoot6, army_atk7] { ai_face (); };
+ void() army_atk7 = [$shoot7, army_atk8]
{
ai_face ();
- sub_checkrefire (atk1);
+ sub_checkrefire (army_atk1);
};
- nonvirtual void() atk8 = [$shoot8, atk9] { ai_face (); };
- nonvirtual void() atk9 = [$shoot9, run1] { ai_face (); };
+ void() army_atk8 = [$shoot8, army_atk9] { ai_face (); };
+ void() army_atk9 = [$shoot9, army_run1] { ai_face (); };

//--------------------------------------------------------------
// Grunt turrent attack functions
//--------------------------------------------------------------
- nonvirtual void() tur_atk1 = [$shoot1, tur_atk2]
+ void() army_tur_atk1 = [$shoot1, army_tur_atk2]
{
ai_face ();
- this.count = 0;
- this.t_length = 4 + floor (random() * 4);
+ self.count = 0;
+ self.t_length = 4 + floor (random() * 4);
};
- nonvirtual void() tur_atk2 = [$shoot2, tur_atk3]
+ void() army_tur_atk2 = [$shoot2, army_tur_atk3]
{
ai_face ();
- this.attack_elevation = preach_iterate_elevation (
- OGRE_DEFAULT_ELEVATION, this.origin, this.enemy.origin);
+ self.attack_elevation = preach_iterate_elevation (
+ OGRE_DEFAULT_ELEVATION, self.origin, self.enemy.origin);
};
- nonvirtual void() tur_atk3 = [$shoot3, tur_atk4]
+ void() army_tur_atk3 = [$shoot3, army_tur_atk4]
{
ai_face ();
- this.attack_elevation = preach_iterate_elevation (
- this.attack_elevation, this.origin, this.enemy.origin);
+ self.attack_elevation = preach_iterate_elevation (
+ self.attack_elevation, self.origin, self.enemy.origin);
};
- nonvirtual void() tur_atk4 = [$shoot4, tur_atk5]
+ void() army_tur_atk4 = [$shoot4, army_tur_atk5]
{
ai_face ();
- this.attack_elevation = preach_iterate_elevation (
- this.attack_elevation, this.origin, this.enemy.origin);
+ self.attack_elevation = preach_iterate_elevation (
+ self.attack_elevation, self.origin, self.enemy.origin);
};
- nonvirtual void() tur_atk5 =
+ void() army_tur_atk5 =
{
- this.frame = $shoot5;
- this.nextthink = time + .1;
- if (this.style == 5 && this.count < this.t_length)
- {
- this.count +=1;
- }
+ self.frame = $shoot5;
+ self.nextthink = time + 0.1;
+
+ if (self.style == 5 && self.count < self.t_length)
+ self.count +=1;
else
- {
- this.think = tur_atk6;
- }
+ self.think = army_tur_atk6;
+
ai_face ();
- army_fire ();
+ monster_army_fire ();
};
- nonvirtual void() tur_atk6 = [$shoot6, tur_atk7] { ai_face (); };
- nonvirtual void() tur_atk7 = [$shoot7, tur_atk8]
+ void() army_tur_atk6 = [$shoot6, army_tur_atk7] { ai_face (); };
+ void() army_tur_atk7 = [$shoot7, army_tur_atk8]
{
ai_face ();
- sub_checkrefire (tur_atk1);
+ sub_checkrefire (army_tur_atk1);
};
- nonvirtual void() tur_atk8 = [$shoot8, tur_atk9] { ai_face (); };
- nonvirtual void() tur_atk9 = [$stand4, tur_atk10]
+ void() army_tur_atk8 = [$shoot8, army_tur_atk9] { ai_face (); };
+ void() army_tur_atk9 = [$stand4, army_tur_atk10]
{
ai_face ();
};
- nonvirtual void() tur_atk10 = [$stand5, seek_stand1]
+ void() army_tur_atk10 = [$stand5, army_seek_stand1]
{
ai_face ();
};
@@ -531,161 +583,136 @@ class monster_army: base_walkmonster
//--------------------------------------------------------------
// Grunt turrent standing functions
//--------------------------------------------------------------
- nonvirtual void() seek_stand1 = [$stand1, seek_stand2] { ai_run (0); };
- nonvirtual void() seek_stand2 = [$stand2, seek_stand3] { ai_run (0); };
- nonvirtual void() seek_stand3 = [$stand3, seek_stand4] { ai_run (0); };
- nonvirtual void() seek_stand4 = [$stand4, seek_stand5] { ai_run (0); };
- nonvirtual void() seek_stand5 = [$stand5, seek_stand6] { ai_run (0); };
- nonvirtual void() seek_stand6 = [$stand6, seek_stand7] { ai_run (0); };
- nonvirtual void() seek_stand7 = [$stand7, seek_stand8] { ai_run (0); };
- nonvirtual void() seek_stand8 = [$stand8, seek_stand1] { ai_run (0); };
+ void() army_seek_stand1 = [$stand1, army_seek_stand2] { ai_run (0); };
+ void() army_seek_stand2 = [$stand2, army_seek_stand3] { ai_run (0); };
+ void() army_seek_stand3 = [$stand3, army_seek_stand4] { ai_run (0); };
+ void() army_seek_stand4 = [$stand4, army_seek_stand5] { ai_run (0); };
+ void() army_seek_stand5 = [$stand5, army_seek_stand6] { ai_run (0); };
+ void() army_seek_stand6 = [$stand6, army_seek_stand7] { ai_run (0); };
+ void() army_seek_stand7 = [$stand7, army_seek_stand8] { ai_run (0); };
+ void() army_seek_stand8 = [$stand8, army_seek_stand1] { ai_run (0); };

//--------------------------------------------------------------
// Grunt pain states
//--------------------------------------------------------------
- nonvirtual void() pain1 = [$pain1, pain2] { };
- nonvirtual void() pain2 = [$pain2, pain3] { };
- nonvirtual void() pain3 = [$pain3, pain4] { };
- nonvirtual void() pain4 = [$pain4, pain5] { };
- nonvirtual void() pain5 = [$pain5, pain6] { };
- nonvirtual void() pain6 = [$pain6, run1] { ai_pain (1); };
-
- nonvirtual void() painb1 = [$painb1, painb2] { };
- nonvirtual void() painb2 = [$painb2, painb3] { ai_painforward (13); };
- nonvirtual void() painb3 = [$painb3, painb4] { ai_painforward (9); };
- nonvirtual void() painb4 = [$painb4, painb5] { };
- nonvirtual void() painb5 = [$painb5, painb6] { };
- nonvirtual void() painb6 = [$painb6, painb7] { };
- nonvirtual void() painb7 = [$painb7, painb8] { };
- nonvirtual void() painb8 = [$painb8, painb9] { };
- nonvirtual void() painb9 = [$painb9, painb10] { };
- nonvirtual void() painb10 = [$painb10, painb11] { };
- nonvirtual void() painb11 = [$painb11, painb12] { };
- nonvirtual void() painb12 = [$painb12, painb13] { ai_pain(2); };
- nonvirtual void() painb13 = [$painb13, painb14] { };
- nonvirtual void() painb14 = [$painb14, run1] { };
-
- nonvirtual void() painc1 = [$painc1, painc2] { };
- nonvirtual void() painc2 = [$painc2, painc3] { ai_pain (1); };
- nonvirtual void() painc3 = [$painc3, painc4] { };
- nonvirtual void() painc4 = [$painc4, painc5] { };
- nonvirtual void() painc5 = [$painc5, painc6] { ai_painforward (1); };
- nonvirtual void() painc6 = [$painc6, painc7] { ai_painforward (1); };
- nonvirtual void() painc7 = [$painc7, painc8] { };
- nonvirtual void() painc8 = [$painc8, painc9] { ai_pain (1); };
- nonvirtual void() painc9 = [$painc9, painc10] { ai_painforward (4); };
- nonvirtual void() painc10 = [$painc10, painc11] { ai_painforward (3); };
- nonvirtual void() painc11 = [$painc11, painc12] { ai_painforward (6); };
- nonvirtual void() painc12 = [$painc12, painc13] { ai_painforward (8); };
- nonvirtual void() painc13 = [$painc13, run1] { };
+ void() army_pain1 = [$pain1, army_pain2] { };
+ void() army_pain2 = [$pain2, army_pain3] { };
+ void() army_pain3 = [$pain3, army_pain4] { };
+ void() army_pain4 = [$pain4, army_pain5] { };
+ void() army_pain5 = [$pain5, army_pain6] { };
+ void() army_pain6 = [$pain6, army_run1] { ai_pain (1); };
+
+ void() army_painb1 = [$painb1, army_painb2] { };
+ void() army_painb2 = [$painb2, army_painb3] { ai_painforward (13); };
+ void() army_painb3 = [$painb3, army_painb4] { ai_painforward (9); };
+ void() army_painb4 = [$painb4, army_painb5] { };
+ void() army_painb5 = [$painb5, army_painb6] { };
+ void() army_painb6 = [$painb6, army_painb7] { };
+ void() army_painb7 = [$painb7, army_painb8] { };
+ void() army_painb8 = [$painb8, army_painb9] { };
+ void() army_painb9 = [$painb9, army_painb10] { };
+ void() army_painb10 = [$painb10, army_painb11] { };
+ void() army_painb11 = [$painb11, army_painb12] { };
+ void() army_painb12 = [$painb12, army_painb13] { ai_pain(2); };
+ void() army_painb13 = [$painb13, army_painb14] { };
+ void() army_painb14 = [$painb14, army_run1] { };
+
+ void() army_painc1 = [$painc1, army_painc2] { };
+ void() army_painc2 = [$painc2, army_painc3] { ai_pain (1); };
+ void() army_painc3 = [$painc3, army_painc4] { };
+ void() army_painc4 = [$painc4, army_painc5] { };
+ void() army_painc5 = [$painc5, army_painc6] { ai_painforward (1); };
+ void() army_painc6 = [$painc6, army_painc7] { ai_painforward (1); };
+ void() army_painc7 = [$painc7, army_painc8] { };
+ void() army_painc8 = [$painc8, army_painc9] { ai_pain (1); };
+ void() army_painc9 = [$painc9, army_painc10] { ai_painforward (4); };
+ void() army_painc10 = [$painc10, army_painc11] { ai_painforward (3); };
+ void() army_painc11 = [$painc11, army_painc12] { ai_painforward (6); };
+ void() army_painc12 = [$painc12, army_painc13] { ai_painforward (8); };
+ void() army_painc13 = [$painc13, army_run1] { };

//--------------------------------------------------------------
// Grunt death states
//--------------------------------------------------------------
- nonvirtual void() die1 = [$death1, die2] { };
- nonvirtual void() die2 = [$death2, die3] { };
- nonvirtual void() die3 = [$death3, die4]
+ void() army_die1 = [$death1, army_die2] { };
+ void() army_die2 = [$death2, army_die3] { };
+ void() army_die3 = [$death3, army_die4]
{
- this.solid = SOLID_NOT;
+ self.solid = SOLID_NOT;
// style ammotype check -- dumptruck_ds
- if (this.style == 1)
- {
- this.ammo_rockets = 2;
- }
- if (this.style == 2)
- {
- this.ammo_rockets = 2;
- }
- if (this.style == 3)
- {
- this.ammo_cells = 5;
- }
- if (this.style == 4 || this.style == 5)
- {
- this.ammo_nails = 5;
- }
- else if (this.style == 0)
- {
- this.ammo_shells = 5;
- }
- if (!this.keep_ammo)
- {
- item_backpack::drop_backpack (this.origin,
- this.weapon, ammo_shells, ammo_nails,
- ammo_rockets, ammo_cells);
- }
+ if (self.style == 1)
+ self.ammo_rockets = 2;
+ if (self.style == 2)
+ self.ammo_rockets = 2;
+ if (self.style == 3)
+ self.ammo_cells = 5;
+ if (self.style == 4 || self.style == 5)
+ self.ammo_nails = 5;
+ else if (self.style == 0)
+ self.ammo_shells = 5;
+ if (!self.keep_ammo)
+ item_backpack_drop (self);
};
- nonvirtual void() die4 = [$death4, die5] { };
- nonvirtual void() die5 = [$death5, die6] { };
- nonvirtual void() die6 = [$death6, die7] { };
- nonvirtual void() die7 = [$death7, die8] { };
- nonvirtual void() die8 = [$death8, die9] { };
- nonvirtual void() die9 = [$death9, die10] { };
- nonvirtual void() die10 = [$death10, die10] { };
-
- nonvirtual void() cdie1 = [$deathc1, cdie2] { };
- nonvirtual void() cdie2 = [$deathc2, cdie3] { ai_back (5); };
- nonvirtual void() cdie3 = [$deathc3, cdie4]
+ void() army_die4 = [$death4, army_die5] { };
+ void() army_die5 = [$death5, army_die6] { };
+ void() army_die6 = [$death6, army_die7] { };
+ void() army_die7 = [$death7, army_die8] { };
+ void() army_die8 = [$death8, army_die9] { };
+ void() army_die9 = [$death9, army_die10] { };
+ void() army_die10 = [$death10, army_die10] { };
+
+ void() army_cdie1 = [$deathc1, army_cdie2] { };
+ void() army_cdie2 = [$deathc2, army_cdie3] { ai_back (5); };
+ void() army_cdie3 = [$deathc3, army_cdie4]
{
- this.solid = SOLID_NOT;
+ self.solid = SOLID_NOT;
// style ammotype check -- dumptruck_ds
- if (this.style == 1)
- {
- this.ammo_rockets = 2;
- }
- if (this.style == 2)
- {
- this.ammo_rockets = 2;
- }
- if (this.style == 3)
- {
- this.ammo_cells = 5;
- }
- if (this.style == 4 || this.style == 5)
- {
- this.ammo_nails = 5;
- }
- else if (this.style == 0)
- {
- this.ammo_shells = 5;
- }
- if (!this.keep_ammo)
- {
- item_backpack::drop_backpack (this.origin,
- this.weapon, ammo_shells, ammo_nails,
- ammo_rockets, ammo_cells);
- }
+ if (self.style == 1)
+ self.ammo_rockets = 2;
+ if (self.style == 2)
+ self.ammo_rockets = 2;
+ if (self.style == 3)
+ self.ammo_cells = 5;
+ if (self.style == 4 || self.style == 5)
+ self.ammo_nails = 5;
+ else if (self.style == 0)
+ self.ammo_shells = 5;
+ if (!self.keep_ammo)
+ item_backpack_drop (self);
ai_back (4);
};
- nonvirtual void() cdie4 = [$deathc4, cdie5] { ai_back (13); };
- nonvirtual void() cdie5 = [$deathc5, cdie6] { ai_back (3); };
- nonvirtual void() cdie6 = [$deathc6, cdie7] { ai_back (4); };
- nonvirtual void() cdie7 = [$deathc7, cdie8] { };
- nonvirtual void() cdie8 = [$deathc8, cdie9] { };
- nonvirtual void() cdie9 = [$deathc9, cdie10] { };
- nonvirtual void() cdie10 = [$deathc10, cdie11] { };
- nonvirtual void() cdie11 = [$deathc11, cdie11] { };
+ void() army_cdie4 = [$deathc4, army_cdie5] { ai_back (13); };
+ void() army_cdie5 = [$deathc5, army_cdie6] { ai_back (3); };
+ void() army_cdie6 = [$deathc6, army_cdie7] { ai_back (4); };
+ void() army_cdie7 = [$deathc7, army_cdie8] { };
+ void() army_cdie8 = [$deathc8, army_cdie9] { };
+ void() army_cdie9 = [$deathc9, army_cdie10] { };
+ void() army_cdie10 = [$deathc10, army_cdie11] { };
+ void() army_cdie11 = [$deathc11, army_cdie11] { };

//==============================================================
// Initialization
//==============================================================

//--------------------------------------------------------------
- virtual void() init_spawned =
+ void(entity e) monster_army_init =
{
if (deathmatch)
{
- remove (this);
+ remove (e);
return;
}

+ e.classname = "monster_army";
+ e.classtype = CT_MONSTER_GRUNT;
+
//dumptruck_ds custom_mdls
- precache_body_model ("progs/soldier.mdl");
- precache_head_model ("progs/h_guard.mdl");
+ precache_body_model (e, "progs/soldier.mdl");
+ precache_head_model (e, "progs/h_guard.mdl");
// used if style == 1
- precache_proj_model ("progs/missile.mdl");
+ precache_proj_model (e, "progs/missile.mdl");
// used if style == 2
- precache_proj_model ("progs/grenade.mdl");
+ precache_proj_model (e, "progs/grenade.mdl");
// used if style == 3
precache_model2 ("progs/laser.mdl");
//dumptruck_ds custom_mdls
@@ -694,12 +721,12 @@ class monster_army: base_walkmonster
precache_model ("progs/gib2.mdl");
precache_model ("progs/gib3.mdl");

- precache_sound_death ("soldier/death1.wav");
- precache_sound_idle ("soldier/idle.wav");
- precache_sound_pain ("soldier/pain1.wav");
- precache_sound_misc ("soldier/pain2.wav");
- precache_sound_attack ("soldier/sattck1.wav");
- precache_sound_sight ("soldier/sight1.wav");
+ precache_sound_death (e, "soldier/death1.wav");
+ precache_sound_idle (e, "soldier/idle.wav");
+ precache_sound_pain (e, "soldier/pain1.wav");
+ precache_sound_misc (e, "soldier/pain2.wav");
+ precache_sound_attack (e, "soldier/sattck1.wav");
+ precache_sound_sight (e, "soldier/sight1.wav");
// used if style == 3
precache_sound2 ("enforcer/enfire.wav");
// used if style == 3
@@ -708,54 +735,61 @@ class monster_army: base_walkmonster
// gib death
precache_sound ("player/udeath.wav");

- precache_gib1 ("progs/gib1.mdl");
- precache_gib2 ("progs/gib2.mdl");
- precache_gib3 ("progs/gib3.mdl");
+ precache_gib1 (e, "progs/gib1.mdl");
+ precache_gib2 (e, "progs/gib2.mdl");
+ precache_gib3 (e, "progs/gib3.mdl");

- this.solid = SOLID_SLIDEBOX;
- this.movetype = MOVETYPE_STEP;
+ e.solid = SOLID_SLIDEBOX;
+ e.movetype = MOVETYPE_STEP;

// dumptruck_ds custom_mdls
- body_model ("progs/soldier.mdl");
+ body_model (e, "progs/soldier.mdl");

- setsize (this, '-16 -16 -24', '16 16 40');
+ setsize (e, '-16 -16 -24', '16 16 40');

- if (!this.proj_speed_mod)
- this.proj_speed_mod = 1;
+ if (!e.proj_speed_mod)
+ e.proj_speed_mod = 1;

- if (!this.health)
+ if (!e.health)
// thanks RennyC -- dumptruck_ds
- this.health = 30;
+ e.health = 30;

- this.think_stand = this.stand1;
- this.think_walk = this.walk1;
- if (this.spawnflags & I_AM_TURRET)
- this.think_run = this.seek_stand1;
+ e.think_stand = army_stand1;
+ e.think_walk = army_walk1;
+ if (e.spawnflags & I_AM_TURRET)
+ e.think_run = army_seek_stand1;
else
- this.think_run = this.run1;
- this.think_missile = this.atk1;
- this.think_turret = this.tur_atk1;
+ e.think_run = army_run1;
+ e.think_missile = army_atk1;
+ e.think_turret = army_tur_atk1;

- if !(this.berserk)
+ if !(e.berserk)
// Berserk test from
// celephais.net/board/view_thread.php?id=4&start=3465
// -- dumptruck_ds
- this.th_pain = this.do_damage;
+ e.pain = monster_army_pain;
else
- this.th_pain = sub_nullpain;
+ e.pain = sub_nullpain;
+
+ e.destroy = monster_army_destroy;

- this.th_die = this.do_destroy;
+ e.checkattack = monster_army_checkattack;
+ e.sightsound = monster_army_sightsound;

// walkmonster_start
- super::init_spawned ();
+ base_walkmonster_init (e);
};

//--------------------------------------------------------------
void() monster_army =
{
- this.classtype = CT_MONSTER_GRUNT;
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ monster_army_init (self);
};
-};
+// };

/* Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds */

@@ -766,7 +800,8 @@ class monster_army: base_walkmonster
*/
void() monster_dead_army =
{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
return;

precache_model ("progs/soldier.mdl");

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

Diff qc/monsters/wizard.qc

diff --git a/qc/monsters/wizard.qc b/qc/monsters/wizard.qc
index 1127450..257679e 100644
--- a/qc/monsters/wizard.qc
+++ b/qc/monsters/wizard.qc
@@ -3,8 +3,44 @@
//==============================================================================

//======================================================================
+// forward declarations
+//======================================================================
+
+// monster_wizard
+// void() monster_wizard_attack_ranged; // AI & attacks
+void() monster_wizard_attackfinished;
+void() monster_wizard_sightsound;
+void() monster_wizard_attacksound;
+void() monster_wizard_idlesound;
+float() monster_wizard_checkattack; // animation & thinking below
+void() wiz_stand1; void() wiz_stand2; void() wiz_stand3; void() wiz_stand4;
+void() wiz_stand5; void() wiz_stand6; void() wiz_stand7; void() wiz_stand8;
+void() wiz_walk1; void() wiz_walk2; void() wiz_walk3; void() wiz_walk4;
+void() wiz_walk5; void() wiz_walk6; void() wiz_walk7; void() wiz_walk8;
+void() wiz_side1; void() wiz_side2; void() wiz_side3; void() wiz_side4;
+void() wiz_side5; void() wiz_side6; void() wiz_side7; void() wiz_side8;
+void() wiz_run1; void() wiz_run2; void() wiz_run3; void() wiz_run4;
+void() wiz_run5; void() wiz_run6; void() wiz_run7; void() wiz_run8;
+void() wiz_run9; void() wiz_run10; void() wiz_run11; void() wiz_run12;
+void() wiz_run13; void() wiz_run14;
+void() wiz_fast1; void() wiz_fast2; void() wiz_fast3; void() wiz_fast4;
+void() wiz_fast5; void() wiz_fast6; void() wiz_fast7; void() wiz_fast8;
+void() wiz_fast9; void() wiz_fast10;
+void() wiz_pain1; void() wiz_pain2; void() wiz_pain3; void() wiz_pain4;
+void() wiz_death1; void() wiz_death2; void() wiz_death3; void() wiz_death4;
+void() wiz_death5; void() wiz_death6; void() wiz_death7; void() wiz_death8;
+void(entity attacker, float damage) monster_wizard_pain; // interaction
+void() monster_wizard_destroy;
+void(entity e) monster_wizard_init; // initialization
+void() monster_wizard;
+
+// monster_dead_wizard
+void() monster_dead_wizard;
+
+//======================================================================
// frame macros
//======================================================================
+
$cd id1/models/a_wizard
$origin 0 0 24
$base wizbase
@@ -23,6 +59,8 @@ $frame pain1 pain2 pain3 pain4

$frame death1 death2 death3 death4 death5 death6 death7 death8

+//------------------------------------------------------------------------------
+
/*QUAKED monster_wizard (1 0 0) (-16 -16 -24) (16 16 40) AMBUSH X X TRIGGER_SPAWNED X X X X NOT_ON_EASY NOT_ON_NORMAL NOT_ON_HARD_OR_NIGHTMARE NOT_IN_DEATHMATCH NOT_IN_COOP NOT_IN_SINGLEPLAYER X NOT_ON_HARD_ONLY NOT_ON_NIGHTMARE_ONLY
{
model ("progs/wizard.mdl");
@@ -85,62 +123,65 @@ obit_method(string) : "When used with obit_name, will set part of the text for a
damage_mod(float) : "USE WITH CAUTION! Multiply all damage from this monster by this number (e.g. 4 = Quad damage)"

*/
-class monster_wizard: base_flymonster
-{
- nonvirtual void() attack_ranged =
+//----------------------------------------------------------------------
+// class monster_wizard: base_flymonster
+// {
+ /*
+ void() monster_wizard_attack_ranged =
{
- fire_wizardspell ();
+ base_monster_fire_wizardspell ();
};
+ */

//--------------------------------------------------------------
// WizardAttackFinished
//--------------------------------------------------------------
- nonvirtual void() attackfinished =
+ void() monster_wizard_attackfinished =
{
if (enemy_range >= RANGE_MID || !enemy_vis)
{
- this.attack_state = AS_STRAIGHT;
- this.think = this.run1;
+ self.attack_state = AS_STRAIGHT;
+ self.think = wiz_run1;
}
else
{
- this.attack_state = AS_SLIDING;
- this.think = this.side1;
+ self.attack_state = AS_SLIDING;
+ self.think = wiz_side1;
}
};

//--------------------------------------------------------------
- virtual void() ai_sightsound =
+ void() monster_wizard_sightsound =
{
- sound_sight (this, CHAN_VOICE, "wizard/wsight.wav",
+ sound_sight (self, CHAN_VOICE, "wizard/wsight.wav",
1, ATTN_NORM);
};

//--------------------------------------------------------------
// Wiz_AttackSound
//--------------------------------------------------------------
- nonvirtual void() attack_sound =
+ void() monster_wizard_attacksound =
{
// this is a hack to fix Wizard custom attack sounds
- sound_attack (this, CHAN_AUTO, "wizard/wattack.wav",
+ sound_attack (self, CHAN_AUTO, "wizard/wattack.wav",
1, ATTN_NORM);
};

//--------------------------------------------------------------
// WizardIdleSound
//--------------------------------------------------------------
- nonvirtual void() idlesound =
+ void() monster_wizard_idlesound =
{
local float wr = random() * 5;

- if (this.fly_sound < time)
+ if (self.fly_sound < time)
{
- this.fly_sound = time + 2;
+ self.fly_sound = time + 2;
if (wr > 4.5)
- sound_idle (this, CHAN_VOICE,
+ sound_idle (self, CHAN_VOICE,
"wizard/widle1.wav", 1, ATTN_IDLE);
if (wr < 1.5)
- sound_misc (this, CHAN_VOICE,
+ sound_misc (self, CHAN_VOICE,
"wizard/widle2.wav", 1, ATTN_IDLE);
}
return;
@@ -149,41 +190,41 @@ class monster_wizard: base_flymonster
//--------------------------------------------------------------
// WizardCheckAttack
//--------------------------------------------------------------
- virtual float() ai_checkattack =
+ float() monster_wizard_checkattack =
{
local vector spot1, spot2;
local entity targ;
local float chance;

- if (time < this.attack_finished)
+ if (time < self.attack_finished)
return FALSE;
if (!enemy_vis)
return FALSE;

if (enemy_range == RANGE_FAR)
{
- if (this.attack_state != AS_STRAIGHT)
+ if (self.attack_state != AS_STRAIGHT)
{
- this.attack_state = AS_STRAIGHT;
- this.run1 ();
+ self.attack_state = AS_STRAIGHT;
+ wiz_run1 ();
}
return FALSE;
}

- targ = this.enemy;
+ targ = self.enemy;

// see if any entities are in the way of the shot
- spot1 = this.origin + this.view_ofs;
+ spot1 = self.origin + self.view_ofs;
spot2 = targ.origin + targ.view_ofs;

- traceline (spot1, spot2, FALSE, this);
+ traceline (spot1, spot2, FALSE, self);

if (trace_ent != targ)
{ // don't have a clear shot, so move to a side
- if (this.attack_state != AS_STRAIGHT)
+ if (self.attack_state != AS_STRAIGHT)
{
- this.attack_state = AS_STRAIGHT;
- this.run1 ();
+ self.attack_state = AS_STRAIGHT;
+ wiz_run1 ();
}
return FALSE;
}
@@ -199,24 +240,24 @@ class monster_wizard: base_flymonster

if (random () < chance)
{
- this.attack_state = AS_MISSILE;
+ self.attack_state = AS_MISSILE;
return TRUE;
}

if (enemy_range == RANGE_MID)
{
- if (this.attack_state != AS_STRAIGHT)
+ if (self.attack_state != AS_STRAIGHT)
{
- this.attack_state = AS_STRAIGHT;
- this.run1 ();
+ self.attack_state = AS_STRAIGHT;
+ wiz_run1 ();
}
}
else
{
- if (this.attack_state != AS_SLIDING)
+ if (self.attack_state != AS_SLIDING)
{
- this.attack_state = AS_SLIDING;
- this.side1 ();
+ self.attack_state = AS_SLIDING;
+ wiz_side1 ();
}
}

@@ -226,127 +267,124 @@ class monster_wizard: base_flymonster
//--------------------------------------------------------------
// Stationary wizard (?)
//--------------------------------------------------------------
- nonvirtual void() stand1 = [$hover1, stand2] { ai_stand (); };
- nonvirtual void() stand2 = [$hover2, stand3] { ai_stand (); };
- nonvirtual void() stand3 = [$hover3, stand4] { ai_stand (); };
- nonvirtual void() stand4 = [$hover4, stand5] { ai_stand (); };
- nonvirtual void() stand5 = [$hover5, stand6] { ai_stand (); };
- nonvirtual void() stand6 = [$hover6, stand7] { ai_stand (); };
- nonvirtual void() stand7 = [$hover7, stand8] { ai_stand (); };
- nonvirtual void() stand8 = [$hover8, stand1] { ai_stand (); };
+ void() wiz_stand1 = [$hover1, wiz_stand2] { ai_stand (); };
+ void() wiz_stand2 = [$hover2, wiz_stand3] { ai_stand (); };
+ void() wiz_stand3 = [$hover3, wiz_stand4] { ai_stand (); };
+ void() wiz_stand4 = [$hover4, wiz_stand5] { ai_stand (); };
+ void() wiz_stand5 = [$hover5, wiz_stand6] { ai_stand (); };
+ void() wiz_stand6 = [$hover6, wiz_stand7] { ai_stand (); };
+ void() wiz_stand7 = [$hover7, wiz_stand8] { ai_stand (); };
+ void() wiz_stand8 = [$hover8, wiz_stand1] { ai_stand (); };

//--------------------------------------------------------------
// Can a Wizard walk?
//--------------------------------------------------------------
- nonvirtual void() walk1 = [$hover1, walk2]
+ void() wiz_walk1 = [$hover1, wiz_walk2]
{
ai_walk (8);
- this.idlesound ();
+ monster_wizard_idlesound ();
};
- nonvirtual void() walk2 = [$hover2, walk3] { ai_walk (8); };
- nonvirtual void() walk3 = [$hover3, walk4] { ai_walk (8); };
- nonvirtual void() walk4 = [$hover4, walk5] { ai_walk (8); };
- nonvirtual void() walk5 = [$hover5, walk6] { ai_walk (8); };
- nonvirtual void() walk6 = [$hover6, walk7] { ai_walk (8); };
- nonvirtual void() walk7 = [$hover7, walk8] { ai_walk (8); };
- nonvirtual void() walk8 = [$hover8, walk1] { ai_walk (8); };
+ void() wiz_walk2 = [$hover2, wiz_walk3] { ai_walk (8); };
+ void() wiz_walk3 = [$hover3, wiz_walk4] { ai_walk (8); };
+ void() wiz_walk4 = [$hover4, wiz_walk5] { ai_walk (8); };
+ void() wiz_walk5 = [$hover5, wiz_walk6] { ai_walk (8); };
+ void() wiz_walk6 = [$hover6, wiz_walk7] { ai_walk (8); };
+ void() wiz_walk7 = [$hover7, wiz_walk8] { ai_walk (8); };
+ void() wiz_walk8 = [$hover8, wiz_walk1] { ai_walk (8); };

//--------------------------------------------------------------
- // Wizards _can_ move side-to-side
+ // Wizards _can_ move side-to-side...
//--------------------------------------------------------------
- nonvirtual void() side1 = [$hover1, side2]
+ void() wiz_side1 = [$hover1, wiz_side2]
{
ai_run (8);
- this.idlesound ();
+ monster_wizard_idlesound ();
};
- nonvirtual void() side2 = [$hover2, side3] { ai_run (8); };
- nonvirtual void() side3 = [$hover3, side4] { ai_run (8); };
- nonvirtual void() side4 = [$hover4, side5] { ai_run (8); };
- nonvirtual void() side5 = [$hover5, side6] { ai_run (8); };
- nonvirtual void() side6 = [$hover6, side7] { ai_run (8); };
- nonvirtual void() side7 = [$hover7, side8] { ai_run (8); };
- nonvirtual void() side8 = [$hover8, side1] { ai_run (8); };
+ void() wiz_side2 = [$hover2, wiz_side3] { ai_run (8); };
+ void() wiz_side3 = [$hover3, wiz_side4] { ai_run (8); };
+ void() wiz_side4 = [$hover4, wiz_side5] { ai_run (8); };
+ void() wiz_side5 = [$hover5, wiz_side6] { ai_run (8); };
+ void() wiz_side6 = [$hover6, wiz_side7] { ai_run (8); };
+ void() wiz_side7 = [$hover7, wiz_side8] { ai_run (8); };
+ void() wiz_side8 = [$hover8, wiz_side1] { ai_run (8); };

//--------------------------------------------------------------
// Wizard workout
//--------------------------------------------------------------
- nonvirtual void() run1 = [$fly1, run2]
+ void() wiz_run1 = [$fly1, wiz_run2]
{
ai_run (16);
- this.idlesound ();
+ monster_wizard_idlesound ();
};
- nonvirtual void() run2 = [$fly2, run3] { ai_run (16); };
- nonvirtual void() run3 = [$fly3, run4] { ai_run (16); };
- nonvirtual void() run4 = [$fly4, run5] { ai_run (16); };
- nonvirtual void() run5 = [$fly5, run6] { ai_run (16); };
- nonvirtual void() run6 = [$fly6, run7] { ai_run (16); };
- nonvirtual void() run7 = [$fly7, run8] { ai_run (16); };
- nonvirtual void() run8 = [$fly8, run9] { ai_run (16); };
- nonvirtual void() run9 = [$fly9, run10] { ai_run (16); };
- nonvirtual void() run10 = [$fly10, run11] { ai_run (16); };
- nonvirtual void() run11 = [$fly11, run12] { ai_run (16); };
- nonvirtual void() run12 = [$fly12, run13] { ai_run (16); };
- nonvirtual void() run13 = [$fly13, run14] { ai_run (16); };
- nonvirtual void() run14 = [$fly14, run1] { ai_run (16); };
+ void() wiz_run2 = [$fly2, wiz_run3] { ai_run (16); };
+ void() wiz_run3 = [$fly3, wiz_run4] { ai_run (16); };
+ void() wiz_run4 = [$fly4, wiz_run5] { ai_run (16); };
+ void() wiz_run5 = [$fly5, wiz_run6] { ai_run (16); };
+ void() wiz_run6 = [$fly6, wiz_run7] { ai_run (16); };
+ void() wiz_run7 = [$fly7, wiz_run8] { ai_run (16); };
+ void() wiz_run8 = [$fly8, wiz_run9] { ai_run (16); };
+ void() wiz_run9 = [$fly9, wiz_run10] { ai_run (16); };
+ void() wiz_run10 = [$fly10, wiz_run11] { ai_run (16); };
+ void() wiz_run11 = [$fly11, wiz_run12] { ai_run (16); };
+ void() wiz_run12 = [$fly12, wiz_run13] { ai_run (16); };
+ void() wiz_run13 = [$fly13, wiz_run14] { ai_run (16); };
+ void() wiz_run14 = [$fly14, wiz_run1] { ai_run (16); };

//--------------------------------------------------------------
// ~Fast~ Wizards
//--------------------------------------------------------------
- nonvirtual void() fast1 = [$magatt1, fast2]
+ void() wiz_fast1 = [$magatt1, wiz_fast2]
{
ai_face ();
- this.attack_ranged ();
- this.attack_sound ();
+ base_monster_fire_wizardspell ();
+ monster_wizard_attacksound ();
};
- nonvirtual void() fast2 = [$magatt2, fast3] { ai_face (); };
- nonvirtual void() fast3 = [$magatt3, fast4] { ai_face (); };
- nonvirtual void() fast4 = [$magatt4, fast5] { ai_face (); };
- nonvirtual void() fast5 = [$magatt5, fast6] { ai_face (); };
- nonvirtual void() fast6 = [$magatt6, fast7] { ai_face (); };
- nonvirtual void() fast7 = [$magatt5, fast8]
+ void() wiz_fast2 = [$magatt2, wiz_fast3] { ai_face (); };
+ void() wiz_fast3 = [$magatt3, wiz_fast4] { ai_face (); };
+ void() wiz_fast4 = [$magatt4, wiz_fast5] { ai_face (); };
+ void() wiz_fast5 = [$magatt5, wiz_fast6] { ai_face (); };
+ void() wiz_fast6 = [$magatt6, wiz_fast7] { ai_face (); };
+ void() wiz_fast7 = [$magatt5, wiz_fast8]
{
ai_face ();
- this.attack_sound ();
+ monster_wizard_attacksound ();
};
- nonvirtual void() fast8 = [$magatt4, fast9] { ai_face (); };
- nonvirtual void() fast9 = [$magatt3, fast10] { ai_face (); };
- nonvirtual void() fast10 = [$magatt2, run1]
+ void() wiz_fast8 = [$magatt4, wiz_fast9] { ai_face (); };
+ void() wiz_fast9 = [$magatt3, wiz_fast10] { ai_face (); };
+ void() wiz_fast10 = [$magatt2, wiz_run1]
{
ai_face ();
sub_attackfinished (2);
- this.attackfinished ();
+ monster_wizard_attackfinished ();
};

//--------------------------------------------------------------
// Wizard Pain State
//--------------------------------------------------------------
- nonvirtual void() pain1 = [$pain1, pain2] { };
- nonvirtual void() pain2 = [$pain2, pain3] { };
- nonvirtual void() pain3 = [$pain3, pain4] { };
- nonvirtual void() pain4 = [$pain4, run1] { };
+ void() wiz_pain1 = [$pain1, wiz_pain2] { };
+ void() wiz_pain2 = [$pain2, wiz_pain3] { };
+ void() wiz_pain3 = [$pain3, wiz_pain4] { };
+ void() wiz_pain4 = [$pain4, wiz_run1] { };

//--------------------------------------------------------------
// Wizard Death State
//--------------------------------------------------------------
- nonvirtual void() death1 = [$death1, death2]
+ void() wiz_death1 = [$death1, wiz_death2]
{
- this.velocity_x = -200 + 400 * random ();
- this.velocity_y = -200 + 400 * random ();
- this.velocity_z = 100 + 100 * random ();
- this.flags = this.flags - (this.flags & FL_ONGROUND);
- sound_death (this, CHAN_VOICE, "wizard/wdeath.wav",
+ self.velocity_x = -200 + 400 * random ();
+ self.velocity_y = -200 + 400 * random ();
+ self.velocity_z = 100 + 100 * random ();
+ self.flags = self.flags - (self.flags & FL_ONGROUND);
+ sound_death (self, CHAN_VOICE, "wizard/wdeath.wav",
1, ATTN_NORM);
};
- nonvirtual void() death2 = [$death2, death3] { };
- nonvirtual void() death3 = [$death3, death4]
- {
- this.solid = SOLID_NOT;
- };
- nonvirtual void() death4 = [$death4, death5] { };
- nonvirtual void() death5 = [$death5, death6] { };
- nonvirtual void() death6 = [$death6, death7] { };
- nonvirtual void() death7 = [$death7, death8] { };
- nonvirtual void() death8 = [$death8, death8] { };
+ void() wiz_death2 = [$death2, wiz_death3] { };
+ void() wiz_death3 = [$death3, wiz_death4] { self.solid = SOLID_NOT; };
+ void() wiz_death4 = [$death4, wiz_death5] { };
+ void() wiz_death5 = [$death5, wiz_death6] { };
+ void() wiz_death6 = [$death6, wiz_death7] { };
+ void() wiz_death7 = [$death7, wiz_death8] { };
+ void() wiz_death8 = [$death8, wiz_death8] { };

//==============================================================
// Interaction
@@ -355,71 +393,61 @@ class monster_wizard: base_flymonster
//--------------------------------------------------------------
// Wiz_Pain
//--------------------------------------------------------------
- virtual void(entity attacker, float damage) do_damage =
+ void(entity attacker, float damage) monster_wizard_pain =
{
- sound_pain (this, CHAN_VOICE, "wizard/wpain.wav",
+ sound_pain (self, CHAN_VOICE, "wizard/wpain.wav",
1, ATTN_NORM);
+
if (random() * 70 > damage)
// didn't flinch
return;

- this.pain1 ();
+ wiz_pain1 ();
};

//--------------------------------------------------------------
// wiz_die
//--------------------------------------------------------------
- virtual void() do_destroy =
+ void() monster_wizard_destroy =
{
// check for gib
- if (this.health < -40)
+ if (self.health < -40)
{
- sound (this, CHAN_VOICE, "player/udeath.wav",
+ sound (self, CHAN_VOICE, "player/udeath.wav",
1, ATTN_NORM);

// dumptruck_ds custom_mdls
- if (this.mdl_head != "")
- {
- ThrowHead (this.mdl_head, this.health);
- }
+ if (self.mdl_head != "")
+ throw_head (self.mdl_head, self.health);
else
- {
- ThrowHead ("progs/h_wizard.mdl", this.health);
- }
- // ThrowGib ("progs/gib2.mdl", this.health);
- // ThrowGib ("progs/gib2.mdl", this.health);
- // ThrowGib ("progs/gib2.mdl", this.health);
+ throw_head ("progs/h_wizard.mdl", self.health);
+
+ // throw_gib ("progs/gib2.mdl", self.health);
+ // throw_gib ("progs/gib2.mdl", self.health);
+ // throw_gib ("progs/gib2.mdl", self.health);
+
// custom models -- dumptruck_ds
- if (this.mdl_gib1 != "")
- {
- ThrowGib (this.mdl_gib1, this.health);
- }
+ if (self.mdl_gib1 != "")
+ throw_gib (self.mdl_gib1, self.health);
else
- {
- ThrowGib ("progs/gib2.mdl", this.health);
- }
- if (this.mdl_gib2 != "")
- {
- ThrowGib (this.mdl_gib2, this.health);
- }
+ throw_gib ("progs/gib2.mdl", self.health);
+
+ if (self.mdl_gib2 != "")
+ throw_gib (self.mdl_gib2, self.health);
else
- {
- ThrowGib ("progs/gib2.mdl", this.health);
- }
- if (this.mdl_gib3 != "")
- {
- ThrowGib (this.mdl_gib3, this.health);
- }
+ throw_gib ("progs/gib2.mdl", self.health);
+
+ if (self.mdl_gib3 != "")
+ throw_gib (self.mdl_gib3, self.health);
else
- {
- ThrowGib ("progs/gib2.mdl", this.health);
- }
- base_item::drop_stuff (this);
+ throw_gib ("progs/gib2.mdl", self.health);
+
+ base_item_drop_stuff (self);
return;
}

- base_item::drop_stuff (this);
- this.death1 ();
+ base_item_drop_stuff (self);
+ wiz_death1 ();
};

//==============================================================
@@ -427,80 +455,85 @@ class monster_wizard: base_flymonster
//==============================================================

//--------------------------------------------------------------
- virtual void() init_spawned =
+ void(entity e) monster_wizard_init =
{
- if (this.spawnflags & I_AM_TURRET)
+ if (e.spawnflags & I_AM_TURRET)
objerror("Incompatible spawnflag: TURRET_MODE\n");

if (deathmatch)
{
- remove (this);
+ remove (e);
return;
}

- if (!this.mdl_proj)
- {
- this.mdl_proj = "progs/w_spike.mdl";
- }
+ e.classname = "monster_wizard";
+ e.classtype = CT_MONSTER_SCRAG;
+
+ if (!e.mdl_proj)
+ e.mdl_proj = "progs/w_spike.mdl";

// dumptruck_ds custom_mdls
- precache_body_model ("progs/wizard.mdl");
- precache_head_model ("progs/h_wizard.mdl");
- precache_proj_model ("progs/w_spike.mdl");
+ precache_body_model (e, "progs/wizard.mdl");
+ precache_head_model (e, "progs/h_wizard.mdl");
+ precache_proj_model (e, "progs/w_spike.mdl");
// dumptruck_ds
// wizard/hit used by c code
- precache_sound_hit ("wizard/hit.wav");
- precache_sound_attack ("wizard/wattack.wav");
- precache_sound_death ("wizard/wdeath.wav");
- precache_sound_idle ("wizard/widle1.wav");
- precache_sound_misc ("wizard/widle2.wav");
- precache_sound_pain ("wizard/wpain.wav");
- precache_sound_sight ("wizard/wsight.wav");
+ precache_sound_hit (e, "wizard/hit.wav");
+ precache_sound_attack (e, "wizard/wattack.wav");
+ precache_sound_death (e, "wizard/wdeath.wav");
+ precache_sound_idle (e, "wizard/widle1.wav");
+ precache_sound_misc (e, "wizard/widle2.wav");
+ precache_sound_pain (e, "wizard/wpain.wav");
+ precache_sound_sight (e, "wizard/wsight.wav");

- precache_gib1 ("progs/gib1.mdl");
- precache_gib2 ("progs/gib2.mdl");
- precache_gib3 ("progs/gib3.mdl");
+ precache_gib1 (e, "progs/gib1.mdl");
+ precache_gib2 (e, "progs/gib2.mdl");
+ precache_gib3 (e, "progs/gib3.mdl");

- this.solid = SOLID_SLIDEBOX;
- this.movetype = MOVETYPE_STEP;
+ e.solid = SOLID_SLIDEBOX;
+ e.movetype = MOVETYPE_STEP;

- body_model ("progs/wizard.mdl");
- // setmodel (this, "progs/wizard.mdl"); //dumptruck_ds
+ body_model (e, "progs/wizard.mdl");
+ // setmodel (e, "progs/wizard.mdl"); //dumptruck_ds

- setsize (this, '-16 -16 -24', '16 16 40');
+ setsize (e, '-16 -16 -24', '16 16 40');

- if (!this.proj_speed_mod)
- {
- this.proj_speed_mod = 1;
- }
+ if (!e.proj_speed_mod)
+ e.proj_speed_mod = 1;

- if (!this.health)
+ if (!e.health)
// thanks RennyC -- dumptruck_ds
- this.health = 80;
-
- this.think_stand = this.stand1;
- this.think_walk = this.walk1;
- this.think_run = this.run1;
- this.think_missile = this.fast1;
+ e.health = 80;
+
+ e.checkattack = monster_wizard_checkattack;
+ e.sightsound = monster_wizard_sightsound;
+ e.think_stand = wiz_stand1;
+ e.think_walk = wiz_walk1;
+ e.think_run = wiz_run1;
+ e.think_missile = wiz_fast1;
// Berserk test from
// http://celephais.net/board/view_thread.php?id=4&start=3465
// -- dumptruck_ds
- if !(this.berserk)
- this.th_pain = this.do_damage;
+ if !(e.berserk)
+ e.pain = monster_wizard_pain;
else
- this.th_pain = sub_nullpain;
- this.th_die = do_destroy;
+ e.pain = sub_nullpain;
+ e.destroy = monster_wizard_destroy;

- // flymonster_start
- super::init_spawned ();
+ // flymonster_starts
+ base_flymonster_init (e);
};

//--------------------------------------------------------------
void() monster_wizard =
{
- this.classtype = CT_MONSTER_SCRAG;
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ monster_wizard_init (self);
};
-};
+// };

/* Scenic Dead Monster Patch stuff here from DeadStuff mod -- dumptruck_ds */

@@ -511,21 +544,21 @@ class monster_wizard: base_flymonster
*/
void() monster_dead_wizard =
{
- if (SUB_Inhibit ()) // new spawnflags for all entities -- iw
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
return;

- precache_model("progs/wizard.mdl");
- setmodel(self, "progs/wizard.mdl");
+ precache_model ("progs/wizard.mdl");
+ setmodel (self, "progs/wizard.mdl");
self.frame = $death8;

if (self.spawnflags & 1)
{
self.solid = SOLID_BBOX;
- setsize(self,'-50.75 -27.46 -55.19','31.81 33.61 30');
+ setsize (self,'-50.75 -27.46 -55.19','31.81 33.61 30');
}
else
{
self.solid = SOLID_NOT;
}
-
};

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 cef31db..07549a7 100644
--- a/qc/monsters/zombie.qc
+++ b/qc/monsters/zombie.qc
@@ -8,6 +8,7 @@
//======================================================================
// Constants - spawnflags
//======================================================================
+
const float ZOMBIE_SPAWN_CRUCIFIED = 1;
const float ZOMBIE_SPAWN_DEAD_CRUCIFIED = 4;
// const float ZOMBIE_SPAWN_DEAD = 4; // from Zer src, saved for reference
@@ -15,8 +16,99 @@ const float ZOMBIE_SPAWN_DEAD_CRUCIFIED = 4;
const float ZOMBIE_SPAWN_SLEEPING = 16; // changed from 2 which was Zer default

//======================================================================
+// forward declarations
+//======================================================================
+
+// monster_zombie
+void() monster_zombie_sightsound; // AI & attacks
+void() monster_zombie_attack_missile;
+void() monster_zombie_attack_turretmissile;
+void() zom_dead_cruc1; // animation & thinking
+void() zom_cruc1; void() zom_cruc2; void() zom_cruc3; void() zom_cruc4;
+void() zom_cruc5; void() zom_cruc6;
+void() zom_stand1; void() zom_stand2;
+void() zom_alt_stand1; void() zom_alt_stand2; void() zom_stand3;
+void() zom_stand4; void() zom_stand5; void() zom_stand6; void() zom_stand7;
+void() zom_stand8; void() zom_stand9; void() zom_stand10; void() zom_stand11;
+void() zom_stand12; void() zom_stand13; void() zom_stand14; void() zom_stand15;
+void() zom_walk1; void() zom_walk2; void() zom_walk3; void() zom_walk4;
+void() zom_walk5; void() zom_walk6; void() zom_walk7; void() zom_walk8;
+void() zom_walk9; void() zom_walk10; void() zom_walk11; void() zom_walk12;
+void() zom_walk13; void() zom_walk14; void() zom_walk15; void() zom_walk16;
+void() zom_walk17; void() zom_walk18; void() zom_walk19;
+void() zom_run1; void() zom_run2; void() zom_run3; void() zom_run4;
+void() zom_run5; void() zom_run6; void() zom_run7; void() zom_run8;
+void() zom_run9; void() zom_run10; void() zom_run11; void() zom_run12;
+void() zom_run13; void() zom_run14; void() zom_run15; void() zom_run16;
+void() zom_run17; void() zom_run18;
+void() zom_atka1; void() zom_atka2; void() zom_atka3; void() zom_atka4;
+void() zom_atka5; void() zom_atka6; void() zom_atka7; void() zom_atka8;
+void() zom_atka9; void() zom_atka10; void() zom_atka11; void() zom_atka12;
+void() zom_atka13;
+void() zom_atkb1; void() zom_atkb2; void() zom_atkb3; void() zom_atkb4;
+void() zom_atkb5; void() zom_atkb6; void() zom_atkb7; void() zom_atkb8;
+void() zom_atkb9; void() zom_atkb10; void() zom_atkb11; void() zom_atkb12;
+void() zom_atkb13; void() zom_atkb14;
+void() zom_atkc1; void() zom_atkc2; void() zom_atkc3; void() zom_atkc4;
+void() zom_atkc5; void() zom_atkc6; void() zom_atkc7; void() zom_atkc8;
+void() zom_atkc9; void() zom_atkc10; void() zom_atkc11; void() zom_atkc12;
+void() zom_tur_atka1; void() zom_tur_atka2; void() zom_tur_atka3;
+void() zom_tur_atka4; void() zom_tur_atka5; void() zom_tur_atka6;
+void() zom_tur_atka7; void() zom_tur_atka8; void() zom_tur_atka9;
+void() zom_tur_atka10; void() zom_tur_atka11; void() zom_tur_atka12;
+void() zom_tur_atka13;
+void() zom_tur_atkb1; void() zom_tur_atkb2; void() zom_tur_atkb3;
+void() zom_tur_atkb4; void() zom_tur_atkb5; void() zom_tur_atkb6;
+void() zom_tur_atkb7; void() zom_tur_atkb8; void() zom_tur_atkb9;
+void() zom_tur_atkb10; void() zom_tur_atkb11; void() zom_tur_atkb12;
+void() zom_tur_atkb13; void() zom_tur_atkb14;
+void() zom_tur_atkc1; void() zom_tur_atkc2; void() zom_tur_atkc3;
+void() zom_tur_atkc4; void() zom_tur_atkc5; void() zom_tur_atkc6;
+void() zom_tur_atkc7; void() zom_tur_atkc8; void() zom_tur_atkc9;
+void() zom_tur_atkc10; void() zom_tur_atkc11; void() zom_tur_atkc12;
+void() zom_alt_seek1; void() zom_alt_seek2; void() zom_seek3; void() zom_seek4;
+void() zom_seek5; void() zom_seek6; void() zom_seek7; void() zom_seek8;
+void() zom_seek9; void() zom_seek10; void() zom_seek11; void() zom_seek12;
+void() zom_seek13; void() zom_seek14; void() zom_seek15;
+void() zom_paina1; void() zom_paina2; void() zom_paina3; void() zom_paina4;
+void() zom_paina5; void() zom_paina6; void() zom_paina7; void() zom_paina8;
+void() zom_paina9; void() zom_paina10; void() zom_paina11; void() zom_paina12;
+void() zom_painb1; void() zom_painb2; void() zom_painb3; void() zom_painb4;
+void() zom_painb5; void() zom_painb6; void() zom_painb7; void() zom_painb8;
+void() zom_painb9; void() zom_painb10; void() zom_painb11; void() zom_painb12;
+void() zom_painb13; void() zom_painb14; void() zom_painb15; void() zom_painb16;
+void() zom_painb17; void() zom_painb18; void() zom_painb19; void() zom_painb20;
+void() zom_painb21; void() zom_painb22; void() zom_painb23; void() zom_painb24;
+void() zom_painb25; void() zom_painb26; void() zom_painb27; void() zom_painb28;
+void() zom_painc1; void() zom_painc2; void() zom_painc3; void() zom_painc4;
+void() zom_painc5; void() zom_painc6; void() zom_painc7; void() zom_painc8;
+void() zom_painc9; void() zom_painc10; void() zom_painc11; void() zom_painc12;
+void() zom_painc13; void() zom_painc14; void() zom_painc15; void() zom_painc16;
+void() zom_painc17; void() zom_painc18;
+void() zom_paind1; void() zom_paind2; void() zom_paind3; void() zom_paind4;
+void() zom_paind5; void() zom_paind6; void() zom_paind7; void() zom_paind8;
+void() zom_paind9; void() zom_paind10; void() zom_paind11; void() zom_paind12;
+void() zom_paind13;
+void() zom_paine1; void() zom_paine2; void() zom_paine3; void() zom_paine4;
+void() zom_paine5; void() zom_paine6; void() zom_paine7; void() zom_paine8;
+void() zom_paine9; void() zom_paine10; void() zom_paine11; void() zom_paine12;
+void() zom_paine13; void() zom_paine14; void() zom_paine15; void() zom_paine16;
+void() zom_paine17; void() zom_paine18; void() zom_paine19; void() zom_paine20;
+void() zom_paine21; void() zom_paine22; void() zom_paine23; void() zom_paine24;
+void() zom_paine25; void() zom_paine26; void() zom_paine27; void() zom_paine28;
+void() zom_paine29; void() zom_paine30;
+void(entity attacker, float take) monster_zombie_pain; // interaction
+void() monster_zombie_destroy;
+void() monster_zombie_use;
+void() monster_zombie_decide; // initialization
+void() monster_zombie_start;
+void(entity e) monster_zombie_init;
+void() monster_zombie;
+
+//======================================================================
// frame macros
//======================================================================
+
$cd /raid/quake/id1/models/zombie
$origin 0 0 24
$base base
@@ -60,6 +152,8 @@ $frame paine29 paine30

$frame cruc_1 cruc_2 cruc_3 cruc_4 cruc_5 cruc_6

+//------------------------------------------------------------------------------
+
/*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
{
model ( {{ spawnflags & 1 -> { "path" : "progs/zombie.mdl", "frame" : 192 }, "progs/zombie.mdl" }} );
@@ -129,265 +223,264 @@ spawnflags(Flags) =
4 : "Crucified motionless"
16 : "Spawn Sleeping"
*/
-class monster_zombie: base_walkmonster
-{
- float attack_elevation;
- float inpain;
-
+//----------------------------------------------------------------------
+// class monster_zombie: base_walkmonster
+// {
//--------------------------------------------------------------
- virtual void() ai_sightsound =
+ void() monster_zombie_sightsound =
{
- sound_sight (this, CHAN_VOICE, "zombie/z_idle.wav",
+ sound_sight (self, CHAN_VOICE, "zombie/z_idle.wav",
1, ATTN_NORM);
};

//--------------------------------------------------------------
- nonvirtual void() fire_missile =
+ void() monster_zombie_attack_missile =
{
local float r;

r = random ();

if (r < 0.3)
- this.atta1 ();
+ zom_atka1 ();
else if (r < 0.6)
- this.attb1 ();
+ zom_atkb1 ();
else
- this.attc1 ();
+ zom_atkc1 ();
};

//--------------------------------------------------------------
- nonvirtual void() fire_turret_missile =
+ void() monster_zombie_attack_turretmissile =
{
local float r;

r = random ();

if (r < 0.3)
- this.tur_atkb1 ();
+ zom_tur_atkb1 ();
else if (r < 0.6)
- this.tur_atka1 ();
+ zom_tur_atka1 ();
else
- this.tur_atkc1 ();
+ zom_tur_atkc1 ();
};

//--------------------------------------------------------------
// motionless crucified zombie
//--------------------------------------------------------------
- nonvirtual void() dead_cruc1 = [$cruc_1, dead_cruc1]
+ void() zom_dead_cruc1 = [$cruc_1, zom_dead_cruc1]
{
- this.nextthink = time + 1;
+ self.nextthink = time + 1;
};

//--------------------------------------------------------------
// crucified zombie
//--------------------------------------------------------------
- nonvirtual void() cruc1 = [$cruc_1, cruc2]
+ void() zom_cruc1 = [$cruc_1, zom_cruc2]
{
if (random() < 0.1)
- sound_idle (this, CHAN_VOICE, "zombie/idle_w2.wav",
+ sound_idle (self, CHAN_VOICE, "zombie/idle_w2.wav",
1, ATTN_STATIC);
};
- nonvirtual void() cruc2 = [$cruc_2, cruc3]
+ void() zom_cruc2 = [$cruc_2, zom_cruc3]
{
- this.nextthink = time + 0.1 + random() * 0.1;
+ self.nextthink = time + 0.1 + random() * 0.1;
};
- nonvirtual void() cruc3 = [$cruc_3, cruc4]
+ void() zom_cruc3 = [$cruc_3, zom_cruc4]
{
- this.nextthink = time + 0.1 + random() * 0.1;
+ self.nextthink = time + 0.1 + random() * 0.1;
};
- nonvirtual void() cruc4 = [$cruc_4, cruc5]
+ void() zom_cruc4 = [$cruc_4, zom_cruc5]
{
- this.nextthink = time + 0.1 + random() * 0.1;
+ self.nextthink = time + 0.1 + random() * 0.1;
};
- nonvirtual void() cruc5 = [$cruc_5, cruc6]
+ void() zom_cruc5 = [$cruc_5, zom_cruc6]
{
- this.nextthink = time + 0.1 + random() * 0.1;
+ self.nextthink = time + 0.1 + random() * 0.1;
};
- nonvirtual void() cruc6 = [$cruc_6, cruc1]
+ void() zom_cruc6 = [$cruc_6, zom_cruc1]
{
- this.nextthink = time + 0.1 + random() * 0.1;
+ self.nextthink = time + 0.1 + random() * 0.1;
};

//--------------------------------------------------------------
// new "stand" - for sleeping zombies
//--------------------------------------------------------------
- nonvirtual void() stand1 = [$paine11, stand2]
+ void() zom_stand1 = [$paine11, zom_stand2]
{
- this.solid = SOLID_NOT;
+ self.solid = SOLID_NOT;
// dumptruck_ds -- count value > 0 to leave the zombie
// sleeping until triggered!
- if (this.count == 0)
+ if (self.count == 0)
ai_stand ();
};
- nonvirtual void() stand2 = [$paine11, stand1]
+ void() zom_stand2 = [$paine11, zom_stand1]
{
- if (this.count == 0)
+ if (self.count == 0)
ai_stand ();
};

//--------------------------------------------------------------
// old "stand" - called when standing only
//--------------------------------------------------------------
- nonvirtual void() alt_stand1 = [$stand1, alt_stand2]
+ void() zom_alt_stand1 = [$stand1, zom_alt_stand2]
{
- this.health = 60;
+ self.health = 60;
ai_stand ();
};
- nonvirtual void() alt_stand2 = [$stand2, stand3] { ai_stand (); };
- nonvirtual void() stand3 = [$stand3, stand4] { ai_stand (); };
- nonvirtual void() stand4 = [$stand4, stand5] { ai_stand (); };
- nonvirtual void() stand5 = [$stand5, stand6] { ai_stand (); };
- nonvirtual void() stand6 = [$stand6, stand7] { ai_stand (); };
- nonvirtual void() stand7 = [$stand7, stand8] { ai_stand (); };
- nonvirtual void() stand8 = [$stand8, stand9] { ai_stand (); };
- nonvirtual void() stand9 = [$stand9, stand10] { ai_stand (); };
- nonvirtual void() stand10 = [$stand10, stand11] { ai_stand (); };
- nonvirtual void() stand11 = [$stand11, stand12] { ai_stand (); };
- nonvirtual void() stand12 = [$stand12, stand13] { ai_stand (); };
- nonvirtual void() stand13 = [$stand13, stand14] { ai_stand (); };
- nonvirtual void() stand14 = [$stand14, stand15] { ai_stand (); };
- nonvirtual void() stand15 = [$stand15, alt_stand1] { ai_stand (); };
+ void() zom_alt_stand2 = [$stand2, zom_stand3] { ai_stand (); };
+ void() zom_stand3 = [$stand3, zom_stand4] { ai_stand (); };
+ void() zom_stand4 = [$stand4, zom_stand5] { ai_stand (); };
+ void() zom_stand5 = [$stand5, zom_stand6] { ai_stand (); };
+ void() zom_stand6 = [$stand6, zom_stand7] { ai_stand (); };
+ void() zom_stand7 = [$stand7, zom_stand8] { ai_stand (); };
+ void() zom_stand8 = [$stand8, zom_stand9] { ai_stand (); };
+ void() zom_stand9 = [$stand9, zom_stand10] { ai_stand (); };
+ void() zom_stand10 = [$stand10, zom_stand11] { ai_stand (); };
+ void() zom_stand11 = [$stand11, zom_stand12] { ai_stand (); };
+ void() zom_stand12 = [$stand12, zom_stand13] { ai_stand (); };
+ void() zom_stand13 = [$stand13, zom_stand14] { ai_stand (); };
+ void() zom_stand14 = [$stand14, zom_stand15] { ai_stand (); };
+ void() zom_stand15 = [$stand15, zom_alt_stand1] { ai_stand (); };

//--------------------------------------------------------------
// Zombie walk (shamble? shuffle?) functions
//--------------------------------------------------------------
- nonvirtual void() walk1 = [$walk1, walk2]
+ void() zom_walk1 = [$walk1, zom_walk2]
{
- this.solid = SOLID_SLIDEBOX;
+ self.solid = SOLID_SLIDEBOX;
// so he doesn't fall
- this.health = 60;
+ self.health = 60;
ai_walk (0);
};
- nonvirtual void() walk2 = [$walk2, walk3] { ai_walk (2); };
- nonvirtual void() walk3 = [$walk3, walk4] { ai_walk (3); };
- nonvirtual void() walk4 = [$walk4, walk5] { ai_walk (2); };
- nonvirtual void() walk5 = [$walk5, walk6] { ai_walk (1); };
- nonvirtual void() walk6 = [$walk6, walk7] { ai_walk (0); };
- nonvirtual void() walk7 = [$walk7, walk8] { ai_walk (0); };
- nonvirtual void() walk8 = [$walk8, walk9] { ai_walk (0); };
- nonvirtual void() walk9 = [$walk9, walk10] { ai_walk (0); };
- nonvirtual void() walk10 = [$walk10, walk11] { ai_walk (0); };
- nonvirtual void() walk11 = [$walk11, walk12] { ai_walk (2); };
- nonvirtual void() walk12 = [$walk12, walk13] { ai_walk (2); };
- nonvirtual void() walk13 = [$walk13, walk14] { ai_walk (1); };
- nonvirtual void() walk14 = [$walk14, walk15] { ai_walk (0); };
- nonvirtual void() walk15 = [$walk15, walk16] { ai_walk (0); };
- nonvirtual void() walk16 = [$walk16, walk17] { ai_walk (0); };
- nonvirtual void() walk17 = [$walk17, walk18] { ai_walk (0); };
- nonvirtual void() walk18 = [$walk18, walk19] { ai_walk (0); };
- nonvirtual void() walk19 = [$walk19, walk1]
+ void() zom_walk2 = [$walk2, zom_walk3] { ai_walk (2); };
+ void() zom_walk3 = [$walk3, zom_walk4] { ai_walk (3); };
+ void() zom_walk4 = [$walk4, zom_walk5] { ai_walk (2); };
+ void() zom_walk5 = [$walk5, zom_walk6] { ai_walk (1); };
+ void() zom_walk6 = [$walk6, zom_walk7] { ai_walk (0); };
+ void() zom_walk7 = [$walk7, zom_walk8] { ai_walk (0); };
+ void() zom_walk8 = [$walk8, zom_walk9] { ai_walk (0); };
+ void() zom_walk9 = [$walk9, zom_walk10] { ai_walk (0); };
+ void() zom_walk10 = [$walk10, zom_walk11] { ai_walk (0); };
+ void() zom_walk11 = [$walk11, zom_walk12] { ai_walk (2); };
+ void() zom_walk12 = [$walk12, zom_walk13] { ai_walk (2); };
+ void() zom_walk13 = [$walk13, zom_walk14] { ai_walk (1); };
+ void() zom_walk14 = [$walk14, zom_walk15] { ai_walk (0); };
+ void() zom_walk15 = [$walk15, zom_walk16] { ai_walk (0); };
+ void() zom_walk16 = [$walk16, zom_walk17] { ai_walk (0); };
+ void() zom_walk17 = [$walk17, zom_walk18] { ai_walk (0); };
+ void() zom_walk18 = [$walk18, zom_walk19] { ai_walk (0); };
+ void() zom_walk19 = [$walk19, zom_walk1]
{
ai_walk (0);
if (random() < 0.2)
- sound_misc (this, CHAN_VOICE, "zombie/z_idle.wav",
+ sound_misc (self, CHAN_VOICE, "zombie/z_idle.wav",
1, ATTN_IDLE);
};

//--------------------------------------------------------------
// Zombie run functions
//--------------------------------------------------------------
- nonvirtual void() run1 = [$run1, run2]
+ void() zom_run1 = [$run1, zom_run2]
{
- if (this.spawnflags & ZOMBIE_SPAWN_SLEEPING)
+ if (self.spawnflags & ZOMBIE_SPAWN_SLEEPING)
{
// sloppy hack, but it fixes the illusionary zombie bug
// custom_mdls dumptruck_ds
- body_model ("progs/zombie.mdl");
- // setmodel (this, "progs/zombie.mdl");
- setsize (this, '-16 -16 -24', '16 16 40');
+ body_model (self, "progs/zombie.mdl");
+ // setmodel (self, "progs/zombie.mdl");
+ setsize (self, '-16 -16 -24', '16 16 40');
}
ai_run (1);
- this.inpain = 0;
- };
- nonvirtual void() run2 = [$run2, run3] { ai_run (1); };
- nonvirtual void() run3 = [$run3, run4] { ai_run (0); };
- nonvirtual void() run4 = [$run4, run5] { ai_run (1); };
- nonvirtual void() run5 = [$run5, run6] { ai_run (2); };
- nonvirtual void() run6 = [$run6, run7] { ai_run (3); };
- nonvirtual void() run7 = [$run7, run8] { ai_run (4); };
- nonvirtual void() run8 = [$run8, run9] { ai_run (4); };
- nonvirtual void() run9 = [$run9, run10] { ai_run (2); };
- nonvirtual void() run10 = [$run10, run11] { ai_run (0); };
- nonvirtual void() run11 = [$run11, run12] { ai_run (0); };
- nonvirtual void() run12 = [$run12, run13] { ai_run (0); };
- nonvirtual void() run13 = [$run13, run14] { ai_run (2); };
- nonvirtual void() run14 = [$run14, run15] { ai_run (4); };
- nonvirtual void() run15 = [$run15, run16] { ai_run (6); };
- nonvirtual void() run16 = [$run16, run17] { ai_run (7); };
- nonvirtual void() run17 = [$run17, run18] { ai_run (3); };
- nonvirtual void() run18 = [$run18, run1]
+ // self.inpain = 0;
+ self.speed2 = 0;
+ };
+ void() zom_run2 = [$run2, zom_run3] { ai_run (1); };
+ void() zom_run3 = [$run3, zom_run4] { ai_run (0); };
+ void() zom_run4 = [$run4, zom_run5] { ai_run (1); };
+ void() zom_run5 = [$run5, zom_run6] { ai_run (2); };
+ void() zom_run6 = [$run6, zom_run7] { ai_run (3); };
+ void() zom_run7 = [$run7, zom_run8] { ai_run (4); };
+ void() zom_run8 = [$run8, zom_run9] { ai_run (4); };
+ void() zom_run9 = [$run9, zom_run10] { ai_run (2); };
+ void() zom_run10 = [$run10, zom_run11] { ai_run (0); };
+ void() zom_run11 = [$run11, zom_run12] { ai_run (0); };
+ void() zom_run12 = [$run12, zom_run13] { ai_run (0); };
+ void() zom_run13 = [$run13, zom_run14] { ai_run (2); };
+ void() zom_run14 = [$run14, zom_run15] { ai_run (4); };
+ void() zom_run15 = [$run15, zom_run16] { ai_run (6); };
+ void() zom_run16 = [$run16, zom_run17] { ai_run (7); };
+ void() zom_run17 = [$run17, zom_run18] { ai_run (3); };
+ void() zom_run18 = [$run18, zom_run1]
{
ai_run (8);
if (random() < 0.2)
- sound_misc (this, CHAN_VOICE, "zombie/z_idle.wav",
+ sound_misc (self, CHAN_VOICE, "zombie/z_idle.wav",
1, ATTN_IDLE);
if (random() > 0.8)
- sound_sight (this, CHAN_VOICE, "zombie/z_idle1.wav",
+ sound_sight (self, CHAN_VOICE, "zombie/z_idle1.wav",
1, ATTN_IDLE);
};

//--------------------------------------------------------------
// Zombie Attack A
//--------------------------------------------------------------
- nonvirtual void() atta1 = [$atta1, atta2] { ai_face (); };
- nonvirtual void() atta2 = [$atta2, atta3] { ai_face (); };
- nonvirtual void() atta3 = [$atta3, atta4] { ai_face (); };
- nonvirtual void() atta4 = [$atta4, atta5] { ai_face (); };
- nonvirtual void() atta5 = [$atta5, atta6] { ai_face (); };
- nonvirtual void() atta6 = [$atta6, atta7] { ai_face (); };
- nonvirtual void() atta7 = [$atta7, atta8] { ai_face (); };
- nonvirtual void() atta8 = [$atta8, atta9] { ai_face (); };
- nonvirtual void() atta9 = [$atta9, atta10] { ai_face (); };
- nonvirtual void() atta10 = [$atta10, atta11] { ai_face (); };
- nonvirtual void() atta11 = [$atta11, atta12] { ai_face (); };
- nonvirtual void() atta12 = [$atta12, atta13] { ai_face (); };
- nonvirtual void() atta13 = [$atta13, run1]
+ void() zom_atka1 = [$atta1, zom_atka2] { ai_face (); };
+ void() zom_atka2 = [$atta2, zom_atka3] { ai_face (); };
+ void() zom_atka3 = [$atta3, zom_atka4] { ai_face (); };
+ void() zom_atka4 = [$atta4, zom_atka5] { ai_face (); };
+ void() zom_atka5 = [$atta5, zom_atka6] { ai_face (); };
+ void() zom_atka6 = [$atta6, zom_atka7] { ai_face (); };
+ void() zom_atka7 = [$atta7, zom_atka8] { ai_face (); };
+ void() zom_atka8 = [$atta8, zom_atka9] { ai_face (); };
+ void() zom_atka9 = [$atta9, zom_atka10] { ai_face (); };
+ void() zom_atka10 = [$atta10, zom_atka11] { ai_face (); };
+ void() zom_atka11 = [$atta11, zom_atka12] { ai_face (); };
+ void() zom_atka12 = [$atta12, zom_atka13] { ai_face (); };
+ void() zom_atka13 = [$atta13, zom_run1]
{
ai_face ();
- fire_zombiechunk ('-10 -22 30', 0);
+ base_monster_fire_zombiechunk ('-10 -22 30', 0);
};

//--------------------------------------------------------------
// Zombie Attack B
//--------------------------------------------------------------
- nonvirtual void() attb1 = [$attb1, attb2] { ai_face (); };
- nonvirtual void() attb2 = [$attb2, attb3] { ai_face (); };
- nonvirtual void() attb3 = [$attb3, attb4] { ai_face (); };
- nonvirtual void() attb4 = [$attb4, attb5] { ai_face (); };
- nonvirtual void() attb5 = [$attb5, attb6] { ai_face (); };
- nonvirtual void() attb6 = [$attb6, attb7] { ai_face (); };
- nonvirtual void() attb7 = [$attb7, attb8] { ai_face (); };
- nonvirtual void() attb8 = [$attb8, attb9] { ai_face (); };
- nonvirtual void() attb9 = [$attb9, attb10] { ai_face (); };
- nonvirtual void() attb10 = [$attb10, attb11] { ai_face (); };
- nonvirtual void() attb11 = [$attb11, attb12] { ai_face (); };
- nonvirtual void() attb12 = [$attb12, attb13] { ai_face (); };
- nonvirtual void() attb13 = [$attb13, attb14] { ai_face (); };
- nonvirtual void() attb14 = [$attb13, run1]
+ void() zom_atkb1 = [$attb1, zom_atkb2] { ai_face (); };
+ void() zom_atkb2 = [$attb2, zom_atkb3] { ai_face (); };
+ void() zom_atkb3 = [$attb3, zom_atkb4] { ai_face (); };
+ void() zom_atkb4 = [$attb4, zom_atkb5] { ai_face (); };
+ void() zom_atkb5 = [$attb5, zom_atkb6] { ai_face (); };
+ void() zom_atkb6 = [$attb6, zom_atkb7] { ai_face (); };
+ void() zom_atkb7 = [$attb7, zom_atkb8] { ai_face (); };
+ void() zom_atkb8 = [$attb8, zom_atkb9] { ai_face (); };
+ void() zom_atkb9 = [$attb9, zom_atkb10] { ai_face (); };
+ void() zom_atkb10 = [$attb10, zom_atkb11] { ai_face (); };
+ void() zom_atkb11 = [$attb11, zom_atkb12] { ai_face (); };
+ void() zom_atkb12 = [$attb12, zom_atkb13] { ai_face (); };
+ void() zom_atkb13 = [$attb13, zom_atkb14] { ai_face (); };
+ void() zom_atkb14 = [$attb13, zom_run1]
{
ai_face ();
- fire_zombiechunk ('-10 -24 29', 0);
+ base_monster_fire_zombiechunk ('-10 -24 29', 0);
};

//--------------------------------------------------------------
// Zombie Attack C
//--------------------------------------------------------------
- nonvirtual void() attc1 = [$attc1, attc2] { ai_face (); };
- nonvirtual void() attc2 = [$attc2, attc3] { ai_face (); };
- nonvirtual void() attc3 = [$attc3, attc4] { ai_face (); };
- nonvirtual void() attc4 = [$attc4, attc5] { ai_face (); };
- nonvirtual void() attc5 = [$attc5, attc6] { ai_face (); };
- nonvirtual void() attc6 = [$attc6, attc7] { ai_face (); };
- nonvirtual void() attc7 = [$attc7, attc8] { ai_face (); };
- nonvirtual void() attc8 = [$attc8, attc9] { ai_face (); };
- nonvirtual void() attc9 = [$attc9, attc10] { ai_face (); };
- nonvirtual void() attc10 = [$attc10, attc11] { ai_face (); };
- nonvirtual void() attc11 = [$attc11, attc12] { ai_face (); };
- nonvirtual void() attc12 = [$attc12, run1]
+ void() zom_atkc1 = [$attc1, zom_atkc2] { ai_face (); };
+ void() zom_atkc2 = [$attc2, zom_atkc3] { ai_face (); };
+ void() zom_atkc3 = [$attc3, zom_atkc4] { ai_face (); };
+ void() zom_atkc4 = [$attc4, zom_atkc5] { ai_face (); };
+ void() zom_atkc5 = [$attc5, zom_atkc6] { ai_face (); };
+ void() zom_atkc6 = [$attc6, zom_atkc7] { ai_face (); };
+ void() zom_atkc7 = [$attc7, zom_atkc8] { ai_face (); };
+ void() zom_atkc8 = [$attc8, zom_atkc9] { ai_face (); };
+ void() zom_atkc9 = [$attc9, zom_atkc10] { ai_face (); };
+ void() zom_atkc10 = [$attc10, zom_atkc11] { ai_face (); };
+ void() zom_atkc11 = [$attc11, zom_atkc12] { ai_face (); };
+ void() zom_atkc12 = [$attc12, zom_run1]
{
ai_face ();
- fire_zombiechunk ('-12 -19 29', 0);
+ base_monster_fire_zombiechunk ('-12 -19 29', 0);
};

///////////////////////////
@@ -397,145 +490,145 @@ class monster_zombie: base_walkmonster
//--------------------------------------------------------------
// Zombie Turret Attack A
//--------------------------------------------------------------
- nonvirtual void() tur_atka1 = [$atta1, tur_atka2]
+ void() zom_tur_atka1 = [$atta1, zom_tur_atka2]
{
- this.health = 60;
+ self.health = 60;
ai_face ();
};
- nonvirtual void() tur_atka2 = [$atta2, tur_atka3] { ai_face (); };
- nonvirtual void() tur_atka3 = [$atta3, tur_atka4] { ai_face (); };
- nonvirtual void() tur_atka4 = [$atta4, tur_atka5] { ai_face (); };
- nonvirtual void() tur_atka5 = [$atta5, tur_atka6] { ai_face (); };
- nonvirtual void() tur_atka6 = [$atta6, tur_atka7] { ai_face (); };
- nonvirtual void() tur_atka7 = [$atta7, tur_atka8] { ai_face (); };
- nonvirtual void() tur_atka8 = [$atta8, tur_atka9] { ai_face (); };
- nonvirtual void() tur_atka9 = [$atta9, tur_atka10] { ai_face ();};
- nonvirtual void() tur_atka10 = [$atta10, tur_atka11]
+ void() zom_tur_atka2 = [$atta2, zom_tur_atka3] { ai_face (); };
+ void() zom_tur_atka3 = [$atta3, zom_tur_atka4] { ai_face (); };
+ void() zom_tur_atka4 = [$atta4, zom_tur_atka5] { ai_face (); };
+ void() zom_tur_atka5 = [$atta5, zom_tur_atka6] { ai_face (); };
+ void() zom_tur_atka6 = [$atta6, zom_tur_atka7] { ai_face (); };
+ void() zom_tur_atka7 = [$atta7, zom_tur_atka8] { ai_face (); };
+ void() zom_tur_atka8 = [$atta8, zom_tur_atka9] { ai_face (); };
+ void() zom_tur_atka9 = [$atta9, zom_tur_atka10] { ai_face (); };
+ void() zom_tur_atka10 = [$atta10, zom_tur_atka11]
{
ai_face ();
- this.attack_elevation = preach_iterate_elevation (
- OGRE_DEFAULT_ELEVATION, this.origin, this.enemy.origin);
+ self.attack_elevation = preach_iterate_elevation (
+ OGRE_DEFAULT_ELEVATION, self.origin, self.enemy.origin);
};
- nonvirtual void() tur_atka11 = [$atta11, tur_atka12]
+ void() zom_tur_atka11 = [$atta11, zom_tur_atka12]
{
ai_face ();
- this.attack_elevation = preach_iterate_elevation (
- this.attack_elevation, this.origin, this.enemy.origin);
+ self.attack_elevation = preach_iterate_elevation (
+ self.attack_elevation, self.origin, self.enemy.origin);
};
- nonvirtual void() tur_atka12 = [$atta12, tur_atka13]
+ void() zom_tur_atka12 = [$atta12, zom_tur_atka13]
{
ai_face ();
- this.attack_elevation = preach_iterate_elevation (
- this.attack_elevation, this.origin, this.enemy.origin);
+ self.attack_elevation = preach_iterate_elevation (
+ self.attack_elevation, self.origin, self.enemy.origin);
};
- nonvirtual void() tur_atka13 = [$atta13, alt_seek1]
+ void() zom_tur_atka13 = [$atta13, zom_alt_seek1]
{
ai_run (0);
- fire_zombiechunk ('0 0 0', this.attack_elevation);
+ base_monster_fire_zombiechunk ('0 0 0', self.attack_elevation);
};

//--------------------------------------------------------------
// Zombie Turret Attack B
//--------------------------------------------------------------
- nonvirtual void() tur_atkb1 = [$attb1, tur_atkb2]
+ void() zom_tur_atkb1 = [$attb1, zom_tur_atkb2]
{
- this.health = 60;
+ self.health = 60;
ai_face ();
};
- nonvirtual void() tur_atkb2 = [$attb2, tur_atkb3] { ai_face (); };
- nonvirtual void() tur_atkb3 = [$attb3, tur_atkb4] { ai_face (); };
- nonvirtual void() tur_atkb4 = [$attb4, tur_atkb5] { ai_face (); };
- nonvirtual void() tur_atkb5 = [$attb5, tur_atkb6] { ai_face (); };
- nonvirtual void() tur_atkb6 = [$attb6, tur_atkb7] { ai_face (); };
- nonvirtual void() tur_atkb7 = [$attb7, tur_atkb8] { ai_face (); };
- nonvirtual void() tur_atkb8 = [$attb8, tur_atkb9] { ai_face (); };
- nonvirtual void() tur_atkb9 = [$attb9, tur_atkb10] { ai_face ();};
- nonvirtual void() tur_atkb10 = [$attb10, tur_atkb11] {ai_face();};
- nonvirtual void() tur_atkb11 = [$attb11, tur_atkb12]
+ void() zom_tur_atkb2 = [$attb2, zom_tur_atkb3] { ai_face (); };
+ void() zom_tur_atkb3 = [$attb3, zom_tur_atkb4] { ai_face (); };
+ void() zom_tur_atkb4 = [$attb4, zom_tur_atkb5] { ai_face (); };
+ void() zom_tur_atkb5 = [$attb5, zom_tur_atkb6] { ai_face (); };
+ void() zom_tur_atkb6 = [$attb6, zom_tur_atkb7] { ai_face (); };
+ void() zom_tur_atkb7 = [$attb7, zom_tur_atkb8] { ai_face (); };
+ void() zom_tur_atkb8 = [$attb8, zom_tur_atkb9] { ai_face (); };
+ void() zom_tur_atkb9 = [$attb9, zom_tur_atkb10] { ai_face (); };
+ void() zom_tur_atkb10 = [$attb10, zom_tur_atkb11] {ai_face (); };
+ void() zom_tur_atkb11 = [$attb11, zom_tur_atkb12]
{
ai_face ();
- this.attack_elevation = preach_iterate_elevation (
- OGRE_DEFAULT_ELEVATION, this.origin, this.enemy.origin);
+ self.attack_elevation = preach_iterate_elevation (
+ OGRE_DEFAULT_ELEVATION, self.origin, self.enemy.origin);
};
- nonvirtual void() tur_atkb12 = [$attb12, tur_atkb13]
+ void() zom_tur_atkb12 = [$attb12, zom_tur_atkb13]
{
ai_face ();
- this.attack_elevation = preach_iterate_elevation (
- this.attack_elevation, this.origin, this.enemy.origin);
+ self.attack_elevation = preach_iterate_elevation (
+ self.attack_elevation, self.origin, self.enemy.origin);
};
- nonvirtual void() tur_atkb13 = [$attb13, tur_atkb14]
+ void() zom_tur_atkb13 = [$attb13, zom_tur_atkb14]
{
ai_face ();
- this.attack_elevation = preach_iterate_elevation (
- this.attack_elevation, this.origin, this.enemy.origin);
+ self.attack_elevation = preach_iterate_elevation (
+ self.attack_elevation, self.origin, self.enemy.origin);
};
- nonvirtual void() tur_atkb14 = [$attb13, alt_seek1]
+ void() zom_tur_atkb14 = [$attb13, zom_alt_seek1]
{
ai_run (0);
- fire_zombiechunk ('0 0 0', this.attack_elevation);
+ base_monster_fire_zombiechunk ('0 0 0', self.attack_elevation);
};

//--------------------------------------------------------------
// Zombie Turret Attack C
//--------------------------------------------------------------
- nonvirtual void() tur_atkc1 = [$attc1, tur_atkc2]
+ void() zom_tur_atkc1 = [$attc1, zom_tur_atkc2]
{
- this.health = 60;
+ self.health = 60;
ai_face ();
};
- nonvirtual void() tur_atkc2 = [$attc2, tur_atkc3] { ai_face (); };
- nonvirtual void() tur_atkc3 = [$attc3, tur_atkc4] { ai_face (); };
- nonvirtual void() tur_atkc4 = [$attc4, tur_atkc5] { ai_face (); };
- nonvirtual void() tur_atkc5 = [$attc5, tur_atkc6] { ai_face (); };
- nonvirtual void() tur_atkc6 = [$attc6, tur_atkc7] { ai_face (); };
- nonvirtual void() tur_atkc7 = [$attc7, tur_atkc8] { ai_face (); };
- nonvirtual void() tur_atkc8 = [$attc8, tur_atkc9] { ai_face (); };
- nonvirtual void() tur_atkc9 = [$attc9, tur_atkc10]
+ void() zom_tur_atkc2 = [$attc2, zom_tur_atkc3] { ai_face (); };
+ void() zom_tur_atkc3 = [$attc3, zom_tur_atkc4] { ai_face (); };
+ void() zom_tur_atkc4 = [$attc4, zom_tur_atkc5] { ai_face (); };
+ void() zom_tur_atkc5 = [$attc5, zom_tur_atkc6] { ai_face (); };
+ void() zom_tur_atkc6 = [$attc6, zom_tur_atkc7] { ai_face (); };
+ void() zom_tur_atkc7 = [$attc7, zom_tur_atkc8] { ai_face (); };
+ void() zom_tur_atkc8 = [$attc8, zom_tur_atkc9] { ai_face (); };
+ void() zom_tur_atkc9 = [$attc9, zom_tur_atkc10]
{
ai_face ();
- this.attack_elevation = preach_iterate_elevation (
- OGRE_DEFAULT_ELEVATION, this.origin, this.enemy.origin);
+ self.attack_elevation = preach_iterate_elevation (
+ OGRE_DEFAULT_ELEVATION, self.origin, self.enemy.origin);
};
- nonvirtual void() tur_atkc10 = [$attc10, tur_atkc11]
+ void() zom_tur_atkc10 = [$attc10, zom_tur_atkc11]
{
ai_face ();
- this.attack_elevation = preach_iterate_elevation (
- this.attack_elevation, this.origin, this.enemy.origin);
+ self.attack_elevation = preach_iterate_elevation (
+ self.attack_elevation, self.origin, self.enemy.origin);
};
- nonvirtual void() tur_atkc11 = [$attc11, tur_atkc12]
+ void() zom_tur_atkc11 = [$attc11, zom_tur_atkc12]
{
ai_face ();
- this.attack_elevation = preach_iterate_elevation (
- this.attack_elevation, this.origin, this.enemy.origin);
+ self.attack_elevation = preach_iterate_elevation (
+ self.attack_elevation, self.origin, self.enemy.origin);
};
- nonvirtual void() tur_atkc12 = [$attc12, alt_seek1]
+ void() zom_tur_atkc12 = [$attc12, zom_alt_seek1]
{
ai_run (0);
- fire_zombiechunk ('0 0 0', this.attack_elevation);
+ base_monster_fire_zombiechunk ('0 0 0', self.attack_elevation);
};

//--------------------------------------------------------------
// Zombie Turret Seek Stand
//--------------------------------------------------------------
- nonvirtual void() alt_seek1 = [$stand1, alt_seek2]
- {
- this.health = 60;
- ai_run(0);
- };
- nonvirtual void() alt_seek2 = [$stand2, seek3 ] { ai_run (0); };
- nonvirtual void() seek3 = [$stand3, seek4] { ai_run (0); };
- nonvirtual void() seek4 = [$stand4, seek5] { ai_run (0); };
- nonvirtual void() seek5 = [$stand5, seek6] { ai_run (0); };
- nonvirtual void() seek6 = [$stand6, seek7] { ai_run (0); };
- nonvirtual void() seek7 = [$stand7, seek8] { ai_run (0); };
- nonvirtual void() seek8 = [$stand8, seek9] { ai_run (0); };
- nonvirtual void() seek9 = [$stand9, seek10] { ai_run (0); };
- nonvirtual void() seek10 = [$stand10, seek11] { ai_run (0); };
- nonvirtual void() seek11 = [$stand11, seek12] { ai_run (0); };
- nonvirtual void() seek12 = [$stand12, seek13] { ai_run (0); };
- nonvirtual void() seek13 = [$stand13, seek14] { ai_run (0); };
- nonvirtual void() seek14 = [$stand14, seek15] { ai_run (0); };
- nonvirtual void() seek15 = [$stand15, alt_seek1] { ai_run (0); };
+ void() zom_alt_seek1 = [$stand1, zom_alt_seek2]
+ {
+ self.health = 60;
+ ai_run (0);
+ };
+ void() zom_alt_seek2 = [$stand2, zom_seek3] { ai_run (0); };
+ void() zom_seek3 = [$stand3, zom_seek4] { ai_run (0); };
+ void() zom_seek4 = [$stand4, zom_seek5] { ai_run (0); };
+ void() zom_seek5 = [$stand5, zom_seek6] { ai_run (0); };
+ void() zom_seek6 = [$stand6, zom_seek7] { ai_run (0); };
+ void() zom_seek7 = [$stand7, zom_seek8] { ai_run (0); };
+ void() zom_seek8 = [$stand8, zom_seek9] { ai_run (0); };
+ void() zom_seek9 = [$stand9, zom_seek10] { ai_run (0); };
+ void() zom_seek10 = [$stand10, zom_seek11] { ai_run (0); };
+ void() zom_seek11 = [$stand11, zom_seek12] { ai_run (0); };
+ void() zom_seek12 = [$stand12, zom_seek13] { ai_run (0); };
+ void() zom_seek13 = [$stand13, zom_seek14] { ai_run (0); };
+ void() zom_seek14 = [$stand14, zom_seek15] { ai_run (0); };
+ void() zom_seek15 = [$stand15, zom_alt_seek1] { ai_run (0); };

///////////////////////////
/// turret frames END ///
@@ -544,176 +637,176 @@ class monster_zombie: base_walkmonster
//--------------------------------------------------------------
// Zombie Pain State A
//--------------------------------------------------------------
- nonvirtual void() paina1 = [$paina1, paina2]
+ void() zom_paina1 = [$paina1, zom_paina2]
{
- sound_pain (this, CHAN_VOICE, "zombie/z_pain.wav",
+ sound_pain (self, CHAN_VOICE, "zombie/z_pain.wav",
1, ATTN_NORM);
};
- nonvirtual void() paina2 = [$paina2, paina3] { ai_painforward (3); };
- nonvirtual void() paina3 = [$paina3, paina4] { ai_painforward (1); };
- nonvirtual void() paina4 = [$paina4, paina5] { ai_pain (1); };
- nonvirtual void() paina5 = [$paina5, paina6] { ai_pain (3); };
- nonvirtual void() paina6 = [$paina6, paina7] { ai_pain (1); };
- nonvirtual void() paina7 = [$paina7, paina8] { };
- nonvirtual void() paina8 = [$paina8, paina9] { };
- nonvirtual void() paina9 = [$paina9, paina10] { };
- nonvirtual void() paina10 = [$paina10, paina11] { };
- nonvirtual void() paina11 = [$paina11, paina12] { };
- nonvirtual void() paina12 = [$paina12, run1] { };
+ void() zom_paina2 = [$paina2, zom_paina3] { ai_painforward (3); };
+ void() zom_paina3 = [$paina3, zom_paina4] { ai_painforward (1); };
+ void() zom_paina4 = [$paina4, zom_paina5] { ai_pain (1); };
+ void() zom_paina5 = [$paina5, zom_paina6] { ai_pain (3); };
+ void() zom_paina6 = [$paina6, zom_paina7] { ai_pain (1); };
+ void() zom_paina7 = [$paina7, zom_paina8] { };
+ void() zom_paina8 = [$paina8, zom_paina9] { };
+ void() zom_paina9 = [$paina9, zom_paina10] { };
+ void() zom_paina10 = [$paina10, zom_paina11] { };
+ void() zom_paina11 = [$paina11, zom_paina12] { };
+ void() zom_paina12 = [$paina12, zom_run1] { };

//--------------------------------------------------------------
// Zombie Pain State B
//--------------------------------------------------------------
- nonvirtual void() painb1 = [$painb1, painb2]
+ void() zom_painb1 = [$painb1, zom_painb2]
{
- sound_misc2 (this, CHAN_VOICE, "zombie/z_pain1.wav",
+ sound_misc2 (self, CHAN_VOICE, "zombie/z_pain1.wav",
1, ATTN_NORM);
};
- nonvirtual void() painb2 = [$painb2, painb3] { ai_pain (2); };
- nonvirtual void() painb3 = [$painb3, painb4] { ai_pain (8); };
- nonvirtual void() painb4 = [$painb4, painb5] { ai_pain (6); };
- nonvirtual void() painb5 = [$painb5, painb6] { ai_pain (2); };
- nonvirtual void() painb6 = [$painb6, painb7] { };
- nonvirtual void() painb7 = [$painb7, painb8] { };
- nonvirtual void() painb8 = [$painb8, painb9] { };
- nonvirtual void() painb9 = [$painb9, painb10]
+ void() zom_painb2 = [$painb2, zom_painb3] { ai_pain (2); };
+ void() zom_painb3 = [$painb3, zom_painb4] { ai_pain (8); };
+ void() zom_painb4 = [$painb4, zom_painb5] { ai_pain (6); };
+ void() zom_painb5 = [$painb5, zom_painb6] { ai_pain (2); };
+ void() zom_painb6 = [$painb6, zom_painb7] { };
+ void() zom_painb7 = [$painb7, zom_painb8] { };
+ void() zom_painb8 = [$painb8, zom_painb9] { };
+ void() zom_painb9 = [$painb9, zom_painb10]
{
- sound_misc3 (this, CHAN_BODY, "zombie/z_fall.wav",
+ sound_misc3 (self, CHAN_BODY, "zombie/z_fall.wav",
1, ATTN_NORM);
};
- nonvirtual void() painb10 = [$painb10, painb11] { };
- nonvirtual void() painb11 = [$painb11, painb12] { };
- nonvirtual void() painb12 = [$painb12, painb13] { };
- nonvirtual void() painb13 = [$painb13, painb14] { };
- nonvirtual void() painb14 = [$painb14, painb15] { };
- nonvirtual void() painb15 = [$painb15, painb16] { };
- nonvirtual void() painb16 = [$painb16, painb17] { };
- nonvirtual void() painb17 = [$painb17, painb18] { };
- nonvirtual void() painb18 = [$painb18, painb19] { };
- nonvirtual void() painb19 = [$painb19, painb20] { };
- nonvirtual void() painb20 = [$painb20, painb21] { };
- nonvirtual void() painb21 = [$painb21, painb22] { };
- nonvirtual void() painb22 = [$painb22, painb23] { };
- nonvirtual void() painb23 = [$painb23, painb24] { };
- nonvirtual void() painb24 = [$painb24, painb25] { };
- nonvirtual void() painb25 = [$painb25, painb26] { ai_painforward (1); };
- nonvirtual void() painb26 = [$painb26, painb27] { };
- nonvirtual void() painb27 = [$painb27, painb28] { };
- nonvirtual void() painb28 = [$painb28, run1] { };
+ void() zom_painb10 = [$painb10, zom_painb11] { };
+ void() zom_painb11 = [$painb11, zom_painb12] { };
+ void() zom_painb12 = [$painb12, zom_painb13] { };
+ void() zom_painb13 = [$painb13, zom_painb14] { };
+ void() zom_painb14 = [$painb14, zom_painb15] { };
+ void() zom_painb15 = [$painb15, zom_painb16] { };
+ void() zom_painb16 = [$painb16, zom_painb17] { };
+ void() zom_painb17 = [$painb17, zom_painb18] { };
+ void() zom_painb18 = [$painb18, zom_painb19] { };
+ void() zom_painb19 = [$painb19, zom_painb20] { };
+ void() zom_painb20 = [$painb20, zom_painb21] { };
+ void() zom_painb21 = [$painb21, zom_painb22] { };
+ void() zom_painb22 = [$painb22, zom_painb23] { };
+ void() zom_painb23 = [$painb23, zom_painb24] { };
+ void() zom_painb24 = [$painb24, zom_painb25] { };
+ void() zom_painb25 = [$painb25, zom_painb26] { ai_painforward (1); };
+ void() zom_painb26 = [$painb26, zom_painb27] { };
+ void() zom_painb27 = [$painb27, zom_painb28] { };
+ void() zom_painb28 = [$painb28, zom_run1] { };

//--------------------------------------------------------------
// Zombie Pain State C
//--------------------------------------------------------------
- nonvirtual void() painc1 = [$painc1, painc2]
+ void() zom_painc1 = [$painc1, zom_painc2]
{
- sound_misc2 (this, CHAN_VOICE, "zombie/z_pain1.wav",
+ sound_misc2 (self, CHAN_VOICE, "zombie/z_pain1.wav",
1, ATTN_NORM);
};
- nonvirtual void() painc2 = [$painc2, painc3] { };
- nonvirtual void() painc3 = [$painc3, painc4] { ai_pain (3); };
- nonvirtual void() painc4 = [$painc4, painc5] { ai_pain (1); };
- nonvirtual void() painc5 = [$painc5, painc6] { };
- nonvirtual void() painc6 = [$painc6, painc7] { };
- nonvirtual void() painc7 = [$painc7, painc8] { };
- nonvirtual void() painc8 = [$painc8, painc9] { };
- nonvirtual void() painc9 = [$painc9, painc10] { };
- nonvirtual void() painc10 = [$painc10, painc11] { };
- nonvirtual void() painc11 = [$painc11, painc12] { ai_painforward (1); };
- nonvirtual void() painc12 = [$painc12, painc13] { ai_painforward (1); };
- nonvirtual void() painc13 = [$painc13, painc14] { };
- nonvirtual void() painc14 = [$painc14, painc15] { };
- nonvirtual void() painc15 = [$painc15, painc16] { };
- nonvirtual void() painc16 = [$painc16, painc17] { };
- nonvirtual void() painc17 = [$painc17, painc18] { };
- nonvirtual void() painc18 = [$painc18, run1] { };
+ void() zom_painc2 = [$painc2, zom_painc3] { };
+ void() zom_painc3 = [$painc3, zom_painc4] { ai_pain (3); };
+ void() zom_painc4 = [$painc4, zom_painc5] { ai_pain (1); };
+ void() zom_painc5 = [$painc5, zom_painc6] { };
+ void() zom_painc6 = [$painc6, zom_painc7] { };
+ void() zom_painc7 = [$painc7, zom_painc8] { };
+ void() zom_painc8 = [$painc8, zom_painc9] { };
+ void() zom_painc9 = [$painc9, zom_painc10] { };
+ void() zom_painc10 = [$painc10, zom_painc11] { };
+ void() zom_painc11 = [$painc11, zom_painc12] { ai_painforward (1); };
+ void() zom_painc12 = [$painc12, zom_painc13] { ai_painforward (1); };
+ void() zom_painc13 = [$painc13, zom_painc14] { };
+ void() zom_painc14 = [$painc14, zom_painc15] { };
+ void() zom_painc15 = [$painc15, zom_painc16] { };
+ void() zom_painc16 = [$painc16, zom_painc17] { };
+ void() zom_painc17 = [$painc17, zom_painc18] { };
+ void() zom_painc18 = [$painc18, zom_run1] { };

//--------------------------------------------------------------
// Zombie Pain State D
//--------------------------------------------------------------
- nonvirtual void() paind1 = [$paind1, paind2]
+ void() zom_paind1 = [$paind1, zom_paind2]
{
- sound_pain (this, CHAN_VOICE, "zombie/z_pain.wav",
+ sound_pain (self, CHAN_VOICE, "zombie/z_pain.wav",
1, ATTN_NORM);
};
- nonvirtual void() paind2 = [$paind2, paind3] { };
- nonvirtual void() paind3 = [$paind3, paind4] { };
- nonvirtual void() paind4 = [$paind4, paind5] { };
- nonvirtual void() paind5 = [$paind5, paind6] { };
- nonvirtual void() paind6 = [$paind6, paind7] { };
- nonvirtual void() paind7 = [$paind7, paind8] { };
- nonvirtual void() paind8 = [$paind8, paind9] { };
- nonvirtual void() paind9 = [$paind9, paind10] { ai_pain (1); };
- nonvirtual void() paind10 = [$paind10, paind11] { };
- nonvirtual void() paind11 = [$paind11, paind12] { };
- nonvirtual void() paind12 = [$paind12, paind13] { };
- nonvirtual void() paind13 = [$paind13, run1] { };
+ void() zom_paind2 = [$paind2, zom_paind3] { };
+ void() zom_paind3 = [$paind3, zom_paind4] { };
+ void() zom_paind4 = [$paind4, zom_paind5] { };
+ void() zom_paind5 = [$paind5, zom_paind6] { };
+ void() zom_paind6 = [$paind6, zom_paind7] { };
+ void() zom_paind7 = [$paind7, zom_paind8] { };
+ void() zom_paind8 = [$paind8, zom_paind9] { };
+ void() zom_paind9 = [$paind9, zom_paind10] { ai_pain (1); };
+ void() zom_paind10 = [$paind10, zom_paind11] { };
+ void() zom_paind11 = [$paind11, zom_paind12] { };
+ void() zom_paind12 = [$paind12, zom_paind13] { };
+ void() zom_paind13 = [$paind13, zom_run1] { };

//--------------------------------------------------------------
// Zombie Pain State E
//--------------------------------------------------------------
- nonvirtual void() paine1 = [$paine1, paine2]
+ void() zom_paine1 = [$paine1, zom_paine2]
{
// Chainsaw will gib zombie
- if (this.axhitme == 2)
+ if (self.axhitme == 2)
{
- this.t_damage2 (this, world, world, 80);
+ t_damage2 (self, world, world, 80);
return;
}
- sound_pain (this, CHAN_VOICE, "zombie/z_pain.wav",
+ sound_pain (self, CHAN_VOICE, "zombie/z_pain.wav",
1, ATTN_NORM);
- this.health = 60;
- };
- nonvirtual void() paine2 = [$paine2, paine3] { ai_pain (8); };
- nonvirtual void() paine3 = [$paine3, paine4] { ai_pain (5); };
- nonvirtual void() paine4 = [$paine4, paine5] { ai_pain (3); };
- nonvirtual void() paine5 = [$paine5, paine6] { ai_pain (1); };
- nonvirtual void() paine6 = [$paine6, paine7] { ai_pain (2); };
- nonvirtual void() paine7 = [$paine7, paine8] { ai_pain (1); };
- nonvirtual void() paine8 = [$paine8, paine9] { ai_pain (1); };
- nonvirtual void() paine9 = [$paine9, paine10] { ai_pain (2); };
- nonvirtual void() paine10 = [$paine10, paine11]
- {
- sound_misc3 (this, CHAN_BODY, "zombie/z_fall.wav",
+ self.health = 60;
+ };
+ void() zom_paine2 = [$paine2, zom_paine3] { ai_pain (8); };
+ void() zom_paine3 = [$paine3, zom_paine4] { ai_pain (5); };
+ void() zom_paine4 = [$paine4, zom_paine5] { ai_pain (3); };
+ void() zom_paine5 = [$paine5, zom_paine6] { ai_pain (1); };
+ void() zom_paine6 = [$paine6, zom_paine7] { ai_pain (2); };
+ void() zom_paine7 = [$paine7, zom_paine8] { ai_pain (1); };
+ void() zom_paine8 = [$paine8, zom_paine9] { ai_pain (1); };
+ void() zom_paine9 = [$paine9, zom_paine10] { ai_pain (2); };
+ void() zom_paine10 = [$paine10, zom_paine11]
+ {
+ sound_misc3 (self, CHAN_BODY, "zombie/z_fall.wav",
1, ATTN_NORM);
- this.solid = SOLID_NOT;
+ self.solid = SOLID_NOT;
};
- nonvirtual void() paine11 = [$paine11, paine12]
+ void() zom_paine11 = [$paine11, zom_paine12]
{
- this.nextthink = this.nextthink + 5;
- this.health = 60;
+ self.nextthink = self.nextthink + 5;
+ self.health = 60;
};
- nonvirtual void() paine12 = [$paine12, paine13]
+ void() zom_paine12 = [$paine12, zom_paine13]
{
// see if ok to stand up
- this.health = 60;
- sound_misc (this, CHAN_VOICE, "zombie/z_idle.wav",
+ self.health = 60;
+ sound_misc (self, CHAN_VOICE, "zombie/z_idle.wav",
1, ATTN_IDLE);
- this.solid = SOLID_SLIDEBOX;
+ self.solid = SOLID_SLIDEBOX;
if (!walkmove(0, 0))
{
- this.think = paine11;
- this.solid = SOLID_NOT;
+ self.think = zom_paine11;
+ self.solid = SOLID_NOT;
return;
}
};
- nonvirtual void() paine13 = [$paine13, paine14] { };
- nonvirtual void() paine14 = [$paine14, paine15] { };
- nonvirtual void() paine15 = [$paine15, paine16] { };
- nonvirtual void() paine16 = [$paine16, paine17] { };
- nonvirtual void() paine17 = [$paine17, paine18] { };
- nonvirtual void() paine18 = [$paine18, paine19] { };
- nonvirtual void() paine19 = [$paine19, paine20] { };
- nonvirtual void() paine20 = [$paine20, paine21] { };
- nonvirtual void() paine21 = [$paine21, paine22] { };
- nonvirtual void() paine22 = [$paine22, paine23] { };
- nonvirtual void() paine23 = [$paine23, paine24] { };
- nonvirtual void() paine24 = [$paine24, paine25] { };
- nonvirtual void() paine25 = [$paine25, paine26] { ai_painforward (5); };
- nonvirtual void() paine26 = [$paine26, paine27] { ai_painforward (3); };
- nonvirtual void() paine27 = [$paine27, paine28] { ai_painforward (1); };
- nonvirtual void() paine28 = [$paine28, paine29] { ai_pain (1); };
- nonvirtual void() paine29 = [$paine29, paine30] { };
- nonvirtual void() paine30 = [$paine30, run1] { };
+ void() zom_paine13 = [$paine13, zom_paine14] { };
+ void() zom_paine14 = [$paine14, zom_paine15] { };
+ void() zom_paine15 = [$paine15, zom_paine16] { };
+ void() zom_paine16 = [$paine16, zom_paine17] { };
+ void() zom_paine17 = [$paine17, zom_paine18] { };
+ void() zom_paine18 = [$paine18, zom_paine19] { };
+ void() zom_paine19 = [$paine19, zom_paine20] { };
+ void() zom_paine20 = [$paine20, zom_paine21] { };
+ void() zom_paine21 = [$paine21, zom_paine22] { };
+ void() zom_paine22 = [$paine22, zom_paine23] { };
+ void() zom_paine23 = [$paine23, zom_paine24] { };
+ void() zom_paine24 = [$paine24, zom_paine25] { };
+ void() zom_paine25 = [$paine25, zom_paine26] { ai_painforward (5); };
+ void() zom_paine26 = [$paine26, zom_paine27] { ai_painforward (3); };
+ void() zom_paine27 = [$paine27, zom_paine28] { ai_painforward (1); };
+ void() zom_paine28 = [$paine28, zom_paine29] { ai_pain (1); };
+ void() zom_paine29 = [$paine29, zom_paine30] { };
+ void() zom_paine30 = [$paine30, zom_run1] { };

//==============================================================
// Interaction
@@ -738,14 +831,14 @@ class monster_zombie: base_walkmonster
//
// FIXME: don't use pain_finished because of nightmare hack
//--------------------------------------------------------------
- virtual void(entity attacker, float take) do_damage =
+ void(entity attacker, float take) monster_zombie_pain =
{
- if (this.spawnflags & I_AM_TURRET)
+ if (self.spawnflags & I_AM_TURRET)
{
// always reset health
- this.health = 60;
+ self.health = 60;
if (take >= 60)
- this.do_destroy ();
+ monster_zombie_destroy ();
else
return;
}
@@ -753,114 +846,108 @@ class monster_zombie: base_walkmonster
local float r;

// always reset health
- this.health = 60;
+ self.health = 60;

if (take < 9)
// totally ignore
return;

- if (this.inpain == 2)
+ // if (self.inpain == 2)
+ if (self.speed2 == 2)
// down on ground, so don't reset any counters
return;

// go down immediately if a big enough hit
- if ((take >= 25) || (this.axhitme == 2))
+ if ((take >= 25) || (self.axhitme == 2))
{
- this.inpain = 2;
- this.paine1 ();
+ // self.inpain = 2;
+ self.speed2 = 2;
+ zom_paine1 ();
return;
}

- if (this.inpain)
+ // if (self.inpain)
+ if (self.speed2)
{
// if hit again in next gre seconds while
// not in pain frames, definately drop
- this.pain_finished = time + 3;
+ self.pain_finished = time + 3;
// currently going through an animation, don't change
return;
}

- if (this.pain_finished > time)
+ if (self.pain_finished > time)
{
// hit again, so drop down
- this.inpain = 2;
- this.paine1 ();
+ // self.inpain = 2;
+ self.speed2 = 2;
+ zom_paine1 ();
return;
}

// gp into one of the fast pain animations
- this.inpain = 1;
+ // self.inpain = 1;
+ self.speed2 = 1;

r = random ();
if (r < 0.25)
- this.paina1 ();
+ zom_paina1 ();
else if (r < 0.5)
- this.painb1 ();
+ zom_painb1 ();
else if (r < 0.75)
- this.painc1 ();
+ zom_painc1 ();
else
- this.paind1 ();
+ zom_paind1 ();
};

//--------------------------------------------------------------
// zombie_die
//--------------------------------------------------------------
- virtual void() do_destroy =
+ void() monster_zombie_destroy =
{
- sound_death (this, CHAN_VOICE, "zombie/z_gib.wav",
+ sound_death (self, CHAN_VOICE, "zombie/z_gib.wav",
1, ATTN_NORM);

// dumptruck_ds custom_mdls
- if (this.mdl_head != "")
- {
- ThrowHead (this.mdl_head, this.health);
- }
+ if (self.mdl_head != "")
+ throw_head (self.mdl_head, self.health);
else
- {
// commented out dest -- dumptruck_ds
- ThrowHead ("progs/h_zombie.mdl", this.health);
- }
- // ThrowGib ("progs/gib1.mdl", this.health/*, this.dest*/);
- // ThrowGib ("progs/gib2.mdl", this.health/*, this.dest*/);
- // ThrowGib ("progs/gib3.mdl", this.health/*, this.dest*/);
+ throw_head ("progs/h_zombie.mdl", self.health);
+
+ // throw_gib ("progs/gib1.mdl", self.health/*, self.dest*/);
+ // throw_gib ("progs/gib2.mdl", self.health/*, self.dest*/);
+ // throw_gib ("progs/gib3.mdl", self.health/*, self.dest*/);
+
// custom models -- dumptruck_ds
- if (this.mdl_gib1 != "")
- {
- ThrowGib (this.mdl_gib1, this.health);
- }
+ if (self.mdl_gib1 != "")
+ throw_gib (self.mdl_gib1, self.health);
else
- {
- ThrowGib ("progs/gib1.mdl", this.health);
- }
- if (this.mdl_gib2 != "")
- {
- ThrowGib (this.mdl_gib2, this.health);
- }
+ throw_gib ("progs/gib1.mdl", self.health);
+
+ if (self.mdl_gib2 != "")
+ throw_gib (self.mdl_gib2, self.health);
else
- {
- ThrowGib ("progs/gib2.mdl", this.health);
- }
- if (this.mdl_gib3 != "")
- {
- ThrowGib (this.mdl_gib3, this.health);
- }
+ throw_gib ("progs/gib2.mdl", self.health);
+
+ if (self.mdl_gib3 != "")
+ throw_gib (self.mdl_gib3, self.health);
else
- {
- ThrowGib ("progs/gib3.mdl", this.health);
- }
- base_item::drop_stuff (this);
+ throw_gib ("progs/gib3.mdl", self.health);
+
+ base_item_drop_stuff (self);
};

//--------------------------------------------------------------
// dumptruck_ds -- makes self.count = 0 so zombie_stand1 is called
//--------------------------------------------------------------
- virtual void(entity caller) do_use =
+ void() monster_zombie_use =
{
// wake up a sleeping zombie!
- this.count = 0;
+ self.count = 0;
// attacker = other;
// monster_use
- super::do_use (caller);
+ base_monster_use_angry ();
};

//==============================================================
@@ -870,126 +957,131 @@ class monster_zombie: base_walkmonster
//--------------------------------------------------------------
// stand up if orig. lying down, else just start running
//--------------------------------------------------------------
- nonvirtual void() zombie_decide =
+ void() monster_zombie_decide =
{
- if (this.health == 61)
- this.paine12 ();
+ if (self.health == 61)
+ zom_paine12 ();
else
- this.run1 ();
+ zom_run1 ();

- this.think_run = this.run1;
+ self.think_run = zom_run1;
};

//--------------------------------------------------------------
// determine if zombie is to be lying down, or standing
// shims think_stand -- CEV
//--------------------------------------------------------------
- nonvirtual void() zombie_start =
+ void() monster_zombie_start =
{
// dumptruck_ds -- Don't start zombie_stand1 yet!
- this.count = 1;
+ self.count = 1;

- if (this.spawnflags & ZOMBIE_SPAWN_SLEEPING)
+ if (self.spawnflags & ZOMBIE_SPAWN_SLEEPING)
{
if (!sub_istargeted())
{
dprint (sprintf("monster_zombie::zombie_start: "
"WARNING removed untargeted sleeping "
- "zombie at %v\n", this.origin));
+ "zombie at %v\n", self.origin));

monster_update_total (-1);
- remove (this);
+ remove (self);
return;
}
- this.inpain = 2;
- this.stand1 ();
+ // self.inpain = 2;
+ self.speed2 = 2;
+ zom_stand1 ();
}
else
{
- this.alt_stand1 ();
+ zom_alt_stand1 ();
}

- this.think_stand = this.alt_stand1;
+ self.think_stand = zom_alt_stand1;
};

//--------------------------------------------------------------
- virtual void() init_spawned =
+ void(entity e) monster_zombie_init =
{
if (deathmatch)
{
- remove (this);
+ remove (e);
return;
}

+ e.classname = "monster_zombie";
+ e.classtype = CT_MONSTER_ZOMBIE;
+
// custom_mdls dumptruck_ds
- precache_body_model ("progs/zombie.mdl");
- precache_head_model ("progs/h_zombie.mdl");
- precache_proj_model ("progs/zom_gib.mdl");
+ precache_body_model (e, "progs/zombie.mdl");
+ precache_head_model (e, "progs/h_zombie.mdl");
+ precache_proj_model (e, "progs/zom_gib.mdl");
// precache_model ("progs/zombie.mdl");
// precache_model ("progs/h_zombie.mdl");
// precache_model ("progs/zom_gib.mdl");

- precache_sound_misc ("zombie/z_idle.wav");
- precache_sound_sight ("zombie/z_idle1.wav");
- precache_sound_attack ("zombie/z_shot1.wav");
- precache_sound_death ("zombie/z_gib.wav");
- precache_sound_pain ("zombie/z_pain.wav");
- precache_sound_misc2 ("zombie/z_pain1.wav");
- precache_sound_misc3 ("zombie/z_fall.wav");
+ precache_sound_misc (e, "zombie/z_idle.wav");
+ precache_sound_sight (e, "zombie/z_idle1.wav");
+ precache_sound_attack (e, "zombie/z_shot1.wav");
+ precache_sound_death (e, "zombie/z_gib.wav");
+ precache_sound_pain (e, "zombie/z_pain.wav");
+ precache_sound_misc2 (e, "zombie/z_pain1.wav");
+ precache_sound_misc3 (e, "zombie/z_fall.wav");
precache_sound ("zombie/z_miss.wav");
precache_sound ("zombie/z_hit.wav");

- precache_sound_idle ("zombie/idle_w2.wav");
+ precache_sound_idle (e, "zombie/idle_w2.wav");

- precache_gib1 ("progs/gib1.mdl");
- precache_gib2 ("progs/gib2.mdl");
- precache_gib3 ("progs/gib3.mdl");
+ precache_gib1 (e, "progs/gib1.mdl");
+ precache_gib2 (e, "progs/gib2.mdl");
+ precache_gib3 (e, "progs/gib3.mdl");

- this.think_stand = this.zombie_start;
- this.think_walk = this.walk1;
- if (this.spawnflags & I_AM_TURRET)
- {
- this.think_run = this.alt_seek1;
- }
+ e.think_stand = monster_zombie_start;
+ e.think_walk = zom_walk1;
+ if (e.spawnflags & I_AM_TURRET)
+ e.think_run = zom_alt_seek1;
else
- {
- this.think_run = this.zombie_decide;
- }
+ e.think_run = monster_zombie_decide;

- this.th_pain = this.do_damage;
- this.th_die = this.do_destroy;
- this.think_turret = fire_turret_missile;
- this.think_missile = fire_missile;
- this.solid = SOLID_SLIDEBOX;
- this.movetype = MOVETYPE_STEP;
+ e.sightsound = monster_zombie_sightsound;
+ e.pain = monster_zombie_pain;
+ e.destroy = monster_zombie_destroy;
+ e.think_turret = monster_zombie_attack_turretmissile;
+ e.think_missile = monster_zombie_attack_missile;
+ e.solid = SOLID_SLIDEBOX;
+ e.movetype = MOVETYPE_STEP;

// custom_mdls dumptruck_ds
- body_model ("progs/zombie.mdl");
- // setmodel (this, "progs/zombie.mdl");
+ body_model (e, "progs/zombie.mdl");
+ // setmodel (e, "progs/zombie.mdl");

- setsize (this, '-16 -16 -24', '16 16 40');
- this.health = 61;
+ setsize (e, '-16 -16 -24', '16 16 40');
+ e.health = 61;

- if (this.spawnflags & ZOMBIE_SPAWN_CRUCIFIED)
+ if (e.spawnflags & ZOMBIE_SPAWN_CRUCIFIED)
{
- this.movetype = MOVETYPE_NONE;
- this.cruc1 ();
+ e.movetype = MOVETYPE_NONE;
+ zom_cruc1 ();
}
- else if (this.spawnflags & ZOMBIE_SPAWN_DEAD_CRUCIFIED)
+ else if (e.spawnflags & ZOMBIE_SPAWN_DEAD_CRUCIFIED)
{
- this.movetype = MOVETYPE_NONE;
- this.dead_cruc1 ();
+ e.movetype = MOVETYPE_NONE;
+ zom_dead_cruc1 ();
}
else
{
// walkmonster_start
- super::init_spawned ();
+ base_walkmonster_init (e);
}
};

//--------------------------------------------------------------
void() monster_zombie =
{
- this.classtype = CT_MONSTER_ZOMBIE;
+ // new spawnflags for all entities -- iw
+ if (SUB_Inhibit())
+ return;
+
+ monster_zombie_init (self);
};
-};
+// };

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

Diff qc/pmove.qc

diff --git a/qc/pmove.qc b/qc/pmove.qc
index 53b2a04..1764c91 100644
--- a/qc/pmove.qc
+++ b/qc/pmove.qc
@@ -6,8 +6,7 @@
// 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)
+// TODO CEV: varied sounds (different jump sounds)

//======================================================================
// globals
@@ -110,7 +109,6 @@ enumflags
PMF_ONLADDER, // entity is on a ladder
PMF_ONGROUND, // entity is on ground
PMF_STARTGROUND, // entity started the move on ground
- PMF_INWATER, // entity is in water
PMF_CROUCH_HELD, // player is holding the crouch key
PMF_CROUCHED, // entity is crouching
PMF_DOUBLEJUMPED, // entity has doublejumped
@@ -120,7 +118,8 @@ enumflags
PMF_SLIDE_GRAVITY, // slidemove hint to apply gravity
PMF_SLIDE_SKIM, // slidemove hint to skim/wallclip
PMF_SLIDE_STEP, // slidemove hint to traverse steps
- PMF_SLIDE_STICKY // slidemove hint to stick to ground
+ PMF_SLIDE_STICKY, // slidemove hint to stick to ground
+ PMF_AIRSTEPPED // we've airstepped
};

//======================================================================
@@ -591,16 +590,17 @@ void() PM_DanceMove =
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
- /*
+ // we've airstepped. flag for later (see player_footsteps) -- 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));
+ // dprint (sprintf("PM_DanceMove: airstep: %g\n", stepsize));
+ self.step_time = time;
+ self.pmove_flags |= PMF_AIRSTEPPED;
}
- */
+ #endif

// clear slide hint flags -- CEV
self.pmove_flags = self.pmove_flags - (self.pmove_flags &

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

Diff qc/projectiles/bullet.qc

diff --git a/qc/projectiles/bullet.qc b/qc/projectiles/bullet.qc
index 7debeec..20a9173 100644
--- a/qc/projectiles/bullet.qc
+++ b/qc/projectiles/bullet.qc
@@ -23,6 +23,7 @@ const vector BULLET_MAXS = '0 0 0'; //
// forward declarations
//======================================================================

+// projectile_bullet
void() projectile_bullet_think_damage;
void() projectile_bullet_touch;
entity(entity src, vector org, vector vel) spawn_projectile_bullet;
@@ -130,10 +131,10 @@ strip void() projectile_bullet;
// AD projectile diamond model
setmodel (e, "progs/ad/proj_diam2.mdl");

- // full range of sizes (comment from AD)
+ // full range of sizes -- Sock (comment from AD)
e.frame = random () * 15;

- // Bright colours (comment from AD)
+ // Bright colours -- Sock (comment from AD)
e.skin = 16 + random () * 7;
}

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

Diff qc/projectiles/flak.qc

diff --git a/qc/projectiles/flak.qc b/qc/projectiles/flak.qc
index 65de88f..02ab0f2 100644
--- a/qc/projectiles/flak.qc
+++ b/qc/projectiles/flak.qc
@@ -28,6 +28,7 @@ const float MONSTER_FLAK_OGRE = 4; // TODO CEV remove
// forward declarations
//======================================================================

+// projectile_flak
void() projectile_flak_think_damage;
void() projectile_flak_touch;
entity(entity src, vector org, vector vel) spawn_projectile_flak;
@@ -132,6 +133,9 @@ strip void() projectile_flak;
e.mdl_proj = src.mdl_proj;
e.skin_proj = src.skin_proj;
e.snd_hit = src.snd_hit;
+ // hack to tell FlakTouch this was spawned by an ogre
+ if (src.classtype == CT_MONSTER_OGRE)
+ e.spawnflags |= MONSTER_FLAK_OGRE;

projectile_flak_init (e);
return e;

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

Diff qc/projectiles/grenade.qc

diff --git a/qc/projectiles/grenade.qc b/qc/projectiles/grenade.qc
index 01a36a4..2c1d0ab 100644
--- a/qc/projectiles/grenade.qc
+++ b/qc/projectiles/grenade.qc
@@ -20,6 +20,7 @@ const vector GRENADE_MAXS = '8 8 8';
// forward declarations
//======================================================================

+// projectile_grenade
void() projectile_grenade_destroy;
void() projectile_grenade_think;
entity(entity src, vector org, vector vel) spawn_projectile_grenade;

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

Diff qc/projectiles/hknightspell.qc

diff --git a/qc/projectiles/hknightspell.qc b/qc/projectiles/hknightspell.qc
index 1a4deb7..40ce41a 100644
--- a/qc/projectiles/hknightspell.qc
+++ b/qc/projectiles/hknightspell.qc
@@ -17,6 +17,7 @@ const vector HKNSPELL_MAXS = '0 0 0'; //
// forward declarations
//======================================================================

+// projectile_hknightspell
entity(entity src, vector org, vector vel, float offset)
spawn_projectile_hknightspell;
void(entity e) projectile_hknightspell_init;

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

Diff qc/projectiles/laser.qc

diff --git a/qc/projectiles/laser.qc b/qc/projectiles/laser.qc
index 5412d3b..1be13b7 100644
--- a/qc/projectiles/laser.qc
+++ b/qc/projectiles/laser.qc
@@ -16,6 +16,7 @@ const vector LASER_MAXS = '0 0 0'; //
// forward declarations
//======================================================================

+// projectile_laser
void() projectile_laser_touch;
entity(entity src, vector org, vector vel) spawn_projectile_laser;
void(entity e) projectile_laser_init;

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

Diff qc/projectiles/lavaball.qc

diff --git a/qc/projectiles/lavaball.qc b/qc/projectiles/lavaball.qc
index bff9d75..7232067 100644
--- a/qc/projectiles/lavaball.qc
+++ b/qc/projectiles/lavaball.qc
@@ -20,6 +20,7 @@ const vector LAVABALL_MAXS = '7 7 8';
// forward declarations
//======================================================================

+// projectile_lavaball
void() projectile_lavaball_destroy;
entity(entity src, vector org, vector vel) spawn_projectile_lavaball;
void(entity e) projectile_lavaball_init;

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

Diff qc/projectiles/rocket.qc

diff --git a/qc/projectiles/rocket.qc b/qc/projectiles/rocket.qc
index 9717bea..878d32e 100644
--- a/qc/projectiles/rocket.qc
+++ b/qc/projectiles/rocket.qc
@@ -20,6 +20,7 @@ const vector ROCKET_MAXS = '9 4 4';
// forward declarations
//======================================================================

+// projectile_rocket
void() projectile_rocket_destroy;
entity(entity src, vector org, vector vel, optional float projspeed)
spawn_projectile_rocket;

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

Diff qc/projectiles/spike.qc

diff --git a/qc/projectiles/spike.qc b/qc/projectiles/spike.qc
index 6de7664..93edc09 100644
--- a/qc/projectiles/spike.qc
+++ b/qc/projectiles/spike.qc
@@ -19,6 +19,7 @@ const vector SPIKE_MAXS = '0 0 0'; //
// forward declarations
//======================================================================

+// projectile_spike
entity(entity src, vector org, vector vel, optional float direct,
optional float projspeed) spawn_projectile_spike;
void(entity e) projectile_spike_init;

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

Diff qc/projectiles/voreball.qc

diff --git a/qc/projectiles/voreball.qc b/qc/projectiles/voreball.qc
index ccdffbc..73e723f 100644
--- a/qc/projectiles/voreball.qc
+++ b/qc/projectiles/voreball.qc
@@ -18,6 +18,7 @@ const vector VOREBALL_MAXS = '16 16 16';
// forward declarations
//======================================================================

+// projectile_voreball
void() projectile_voreball_destroy;
void() projectile_voreball_touch;
entity(entity src, vector org, vector vel, float basespeed)

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

Diff qc/projectiles/wizardspell.qc

diff --git a/qc/projectiles/wizardspell.qc b/qc/projectiles/wizardspell.qc
index 77e9998..5f52e3b 100644
--- a/qc/projectiles/wizardspell.qc
+++ b/qc/projectiles/wizardspell.qc
@@ -27,8 +27,7 @@ const vector WIZMIS_MAXS = '0 0 0'; //

// projectile_wizardmissile
void() base_wizardmissile_touch;
-entity(entity src, vector org, vector vel, optional float direct,
- optional float splash) spawn_projectile_wizardmissile;
+entity(entity src, vector org, vector vel) spawn_projectile_wizardmissile;
void(entity e) projectile_wizardmissile_init;
strip void() projectile_wizardmissile;

@@ -78,8 +77,8 @@ strip void() projectile_wizardspell;
};

//--------------------------------------------------------------
- entity(entity src, vector org, vector vel, optional float direct,
- optional float splash) spawn_projectile_wizardmissile =
+ entity(entity src, vector org, vector vel)
+ spawn_projectile_wizardmissile =
{
local entity e = spawn ();
e.owner = src;
@@ -91,8 +90,8 @@ strip void() projectile_wizardspell;
e.proj_speed_mod = src.proj_speed_mod;
e.projexpl = src.projexpl;
// damage
- e.direct_damage = direct;
- e.splash_damage = splash;
+ // e.direct_damage = direct;
+ // e.splash_damage = splash;
// model, skin, & sounds
e.mdl_proj = src.mdl_proj;
e.skin_proj = src.skin_proj;
@@ -199,7 +198,8 @@ strip void() projectile_wizardspell;
dir *= min (self.proj_basespeed * (self.proj_speed_mod ?
self.proj_speed_mod : 1), world_maxvelocity);

- spawn_projectile_wizardmissile (self, self.origin, dir);
+ spawn_projectile_wizardmissile (
+ self.owner, self.origin, dir);
}

remove (self);

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

Diff qc/projectiles/zombiechunk.qc

diff --git a/qc/projectiles/zombiechunk.qc b/qc/projectiles/zombiechunk.qc
index b368b74..c0c925f 100644
--- a/qc/projectiles/zombiechunk.qc
+++ b/qc/projectiles/zombiechunk.qc
@@ -16,6 +16,7 @@ const vector ZCHUNK_MAXS = '0 0 0'; //
// forward declarations
//======================================================================

+// projectile_zombiechunk
void() projectile_zombiechunk_touch;
entity(entity src, vector org, vector vel) spawn_projectile_zombiechunk;
void(entity e) projectile_zombiechunk_init;

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

Diff qc/subs.qc

diff --git a/qc/subs.qc b/qc/subs.qc
deleted file mode 100644
index 73a8f09..0000000
--- a/qc/subs.qc
+++ /dev/null
@@ -1,45 +0,0 @@
-//==============================================================================
-// subs.qc
-//==============================================================================
-
-//======================================================================
-// forward declarations
-//======================================================================
-
-void() sub_null;
-void(entity attacker, float damage) sub_nullpain;
-void() sub_remove;
-void(entity ent, void() thinkst) sub_think;
-
-//------------------------------------------------------------------------------
-
-//----------------------------------------------------------------------
-void() sub_null =
-{
- // no-op
-};
-
-//----------------------------------------------------------------------
-void(entity attacker, float damage) sub_nullpain =
-{
- // no-op
-};
-
-//----------------------------------------------------------------------
-void() sub_remove =
-{
- remove (self);
-};
-
-//--------------------------------------------------------------------//
-// SUB_Think -- Drake -- This makes an entity do a think function right now.
-//--------------------------------------------------------------------//
-void(entity ent, void() thinkst) sub_think =
-{
- local entity stemp;
-
- stemp = self;
- self = ent;
- thinkst ();
- self = stemp;
-};

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

Diff qc/sv_progs.src

diff --git a/qc/sv_progs.src b/qc/sv_progs.src
index 6d42f11..11b8353 100644
--- a/qc/sv_progs.src
+++ b/qc/sv_progs.src
@@ -22,7 +22,6 @@ math.qc // Code by Joshua Skelton + misc
utility.qc
newflags.qc // new spawnflags for all entities
cshift.qc // background color shift controller
-subs.qc // modified targets, triggers and killtargets
keylock.qc // common code for entities unlockable with keys
custom_snd.qc // mapper-settable sound FX for monsters - iw
custom_mdls.qc // mapper-settable models for monsters - iw
@@ -91,7 +90,6 @@ pmove.qc // QC player movement code -- CEV
// monster entities
//----------------------------------------------------------------------
monsters/playerclient.qc // player and client handling
-/*
monsters/boss.qc // id1 Chthon
monsters/boss2.qc // pd3 killable Chthon
monsters/dog.qc // id1 Doggo
@@ -102,6 +100,7 @@ monsters/shambler.qc // id1 Shambler
monsters/soldier.qc // id1 Grunt
monsters/wizard.qc // id1 Scragg / Wizard
monsters/zombie.qc // modified Ace_Dave's zombies from Rubicon2
+/*
monsters/enforcer.qc // id1 Enforcer (registered)
monsters/fish.qc // id1 Fish (registered)
monsters/hknight.qc // id1 Death Knight / Hell Knight (registered)
@@ -167,7 +166,7 @@ triggers/setcount.qc // target_setcount
triggers/setgravity.qc // was in hip_trig.qc
triggers/setskill.qc //
triggers/setstate.qc // target_setstate
-triggers/shake.qc // triggerable shake from Zer cutscenes
+triggers/shake.qc // triggerable shake from Zerstorer cutscenes
triggers/take_weapon.qc //
triggers/teleport.qc // was in triggers.qc -- CEV
triggers/textstory.qc // textstory (was in misc.qc) -- CEV

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

Diff qc/world.qc

diff --git a/qc/world.qc b/qc/world.qc
index be71310..bfb29fb 100644
--- a/qc/world.qc
+++ b/qc/world.qc
@@ -443,6 +443,15 @@ void() worldspawn =
precache_sound ("player/gasp2.wav"); // taking breath
precache_sound ("player/h2odeath.wav"); // drowning death

+ // player footstep sounds -- CEV
+ precache_sound ("steps/foot1.wav");
+ precache_sound ("steps/foot2.wav");
+ precache_sound ("steps/foot3.wav");
+ precache_sound ("steps/foot4.wav");
+ precache_sound ("steps/foot5.wav");
+ precache_sound ("steps/foot6.wav");
+ precache_sound ("steps/foot7.wav");
+
precache_sound ("misc/talk.wav"); // talk
precache_sound ("player/teledth1.wav"); // telefrag
precache_sound ("misc/r_tele1.wav"); // teleport sounds

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