diff --git a/r17/Revamped src/Revamped QC/NeedleAI.qc b/r17/Revamped src/Revamped QC/NeedleAI.qc
new file mode 100755
index 00000000..8bb9bd94
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/NeedleAI.qc
@@ -0,0 +1,127 @@
+
+
+void() MarioHome =
+{
+ local vector dir, vtemp, wantdir;
+ local entity te;
+ local float maxmove;
+ maxmove = 85; // maximum xyz value we're allowed to change in mid-air
+
+ if (self.enemy != world && self.enemy.health > 0) {
+ vtemp = (self.enemy.origin + '0 0 10');
+ dir = normalize ((vtemp - self.origin));
+ wantdir = (dir * 550);
+ wantdir_x = wantdir_x - self.velocity_x;
+ if (wantdir_x > maxmove)
+ wantdir_x = maxmove;
+ if (wantdir_x < -maxmove)
+ wantdir_x = -maxmove;
+ wantdir_y = wantdir_y - self.velocity_y;
+ if (wantdir_y > maxmove)
+ wantdir_y = maxmove;
+ if (wantdir_y < -maxmove)
+ wantdir_y = -maxmove;
+ wantdir_z = wantdir_z - self.velocity_z;
+ if (wantdir_z > maxmove)
+ wantdir_z = maxmove;
+ if (wantdir_z < -maxmove)
+ wantdir_z = -maxmove;
+
+
+ self.velocity += wantdir;//(dir * 550);
+ }
+ else {
+ te = findradius(self.origin, 950);
+ while (te)
+ {
+ if ( (te.classname == "player" || te.flags & FL_MONSTER) && te.health > 0 && te != self.owner)
+ {
+ self.enemy = te;
+ //bprint("found enemy!\n");
+ }
+ te = te.chain;
+ }
+ }
+ self.angles = vectoangles (self.velocity);
+
+ self.nextthink = (time + 0.5);
+ self.think = NeedlerHome;
+};
+
+void () Mario_Touch =
+{
+ if (other.takedamage != FALSE && other.health > 0) {
+ T_Damage (other, self, self.owner, 50, MOD_SOLITUDE);
+ Add_Needle(self.owner, other, self.origin_x);
+ }
+ else if (self.lives > 0) {
+ Bounce_Off_Walls ();
+ self.lives -= 1;
+ return;
+ }
+
+ remove(self);
+};
+void() dust =
+{
+ self.enemy.kill_amount += 1;
+ self.enemy.frags += 1;
+ self.enemy.needles -= 1;
+ T_Damage (self.enemy, self, self.owner, 4, MOD_SOLITUDE);
+ sound (self, CHAN_WEAPON, "weapons/crystal.wav", 1, ATTN_NORM);
+ createpinkdust(self.origin);
+ remove(self);
+};
+void() misc_marion;
+void() W_FireMario =
+{
+ local entity fshell;
+ local vector spread;
+ muzzleflash6();
+ sound (self, CHAN_WEAPON, "weapons/bigneedler.wav", 1, ATTN_NORM);
+
+ spread = '3.60 3.60 0.10';
+
+
+ fshell = spawn ();
+ fshell.owner = self;
+ fshell.health = 15;
+ fshell.classname = "Needle-spikes";
+ fshell.movetype = 9;
+ fshell.solid = SOLID_BBOX;
+ fshell.takedamage = DAMAGE_AIM;
+ fshell.th_die = dust;
+ makevectors (self.v_angle);
+ fshell.velocity = v_forward + crandom()*spread_x*v_right + crandom()*spread_y*v_up;
+ fshell.velocity = (fshell.velocity * 6550);
+ fshell.angles = vectoangles (fshell.velocity);
+ fshell.touch = Mario_Touch;
+ fshell.armorvalue = time + 100000000; // amount of time the needler projectile should stay alive
+ fshell.nextthink = (time + 0.2);
+ fshell.think = MarioHome;
+ fshell.lives = 100000000;
+ self.think = W_FireMario;
+ self.nextthink = (time + 1.5); // number of times the needle will bounce off walls
+ setmodel (fshell, "progs/Bigneedproy.mdl");
+ setsize (fshell, '-12 -12 -12', '12 12 12');
+ setorigin (fshell, ((self.origin + (v_forward * 8)) + '0 0 16')); //setorigin (fshell, ((self.origin + (v_forward * 8)) + '0 0 16'));
+
+
+};
+
+void() misc_marion =
+{
+local entity mario;
+
+mario = spawn();
+
+mario.solid = SOLID_SLIDEBOX;
+mario.movetype = MOVETYPE_NONE;
+mario.classname = "Mario";
+
+setsize (mario, '-25 -25 -10', '25 25 50');
+setorigin (mario, self.origin);
+
+mario.think = W_FireMario && SUB_Remove;
+mario.nextthink = (time + 1);
+};
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/Animations.qc b/r17/Revamped src/Revamped QC/Primeqc4/Animations.qc
new file mode 100755
index 00000000..159ff3e5
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/Animations.qc
@@ -0,0 +1,115 @@
+
+//The Rocket Is gay and messed up. I have to use it In the Fire Function I guess >:(
+void() player_missle14 = [$missle14, player_missle15] {self.weaponframe=22;};
+void() player_missle15 = [$missle15, player_missle16] {self.weaponframe=23;};
+void() player_missle16 = [$missle16, player_missle17] {self.weaponframe=24;};
+void() player_missle17 = [$missle17, player_missle18] {self.weaponframe=25;};
+void() player_missle18 = [$missle18, player_missle19] {self.weaponframe=26;};
+void() player_missle19 = [$missle19, player_missle20] {self.weaponframe=27;};
+void() player_missle20 = [$missle20, player_missle21] {self.weaponframe=28;};
+void() player_missle21 = [$missle21, player_missle22] {self.weaponframe=39;};
+void() player_missle22 = [$missle22, player_missle23] {self.weaponframe=30;};
+void() player_missle23 = [$missle23, player_missle24] {self.weaponframe=31;};
+void() player_missle24 = [$missle24, player_missle25] {self.weaponframe=32;};
+void() player_missle25 = [$missle25, player_missle26] {self.weaponframe=33;};
+void() player_missle26 = {self.weaponframe=34;};
+
+//Shooting Animations For Richochet beam. Any Weapon that Has transforming anims, needs These kinda frames
+void() player_missle45 = [$missle1, player_missle46] {self.weaponframe=49;};
+void() player_missle46 = [$missle2, player_missle47] {self.weaponframe=50;};
+void() player_missle47 = [$missle3, player_missle48] {self.weaponframe=51;};
+void() player_missle48 = [$missle4, player_missle49] {self.weaponframe=52;};
+void() player_missle49 = [$missle5, player_missle50] {self.weaponframe=53;};
+void() player_missle50 = [$missle6, player_missle51] {self.weaponframe=54;};
+void() player_missle51 = [$missle7, player_missle52] {self.weaponframe=55;};
+void() player_missle52 = [$missle8, player_missle53] {self.weaponframe=56;};
+void() player_missle53 = [$missle9, player_missle54] {self.weaponframe=57;};
+void() player_missle54 = [$missle10, player_missle55] {self.weaponframe=58;};
+void() player_missle55 = {self.weaponframe=59;};
+
+// Shooting Animations for The blaster.
+void() player_missle56 = [$missle1, player_missle57] {self.weaponframe=1;};
+void() player_missle57 = [$missle2, player_missle58] {self.weaponframe=2;};
+void() player_missle58 = [$missle3, player_missle59] {self.weaponframe=3;};
+void() player_missle59 = [$missle4, player_missle60] {self.weaponframe=4;};
+void() player_missle60 = [$missle5, player_missle61] {self.weaponframe=5;};
+void() player_missle61 = [$missle6, player_missle62] {self.weaponframe=6;};
+void() player_missle62 = [$missle7, player_missle63] {self.weaponframe=7;};
+void() player_missle63 = [$missle8, player_missle64] {self.weaponframe=8;};
+void() player_missle64 = [$missle9, player_missle65] {self.weaponframe=9;};
+void() player_missle65 = [$missle10, player_missle66] {self.weaponframe=10;};
+void() player_missle66 = {self.weaponframe=11;};
+
+
+void (entity t_plyr, float t_frame) startwframe =
+{
+ if (t_plyr.weaponframe < t_frame)
+ t_plyr.weaponframe = t_frame;
+};
+
+void () Fire_finished =
+{
+ self.donefire = 1;
+ self.weaponframe = 0;
+ player_run ();
+};
+void() Fire_nail =
+{
+ self.weaponframe += 1;
+ if (self.weaponframe > 11)
+ {
+ Fire_finished();
+ }
+ if (self.weaponframe == 2)
+ {
+ W_FireSplaser();
+ }
+};
+void() Fire_Sniper =
+{
+ self.weaponframe += 1;
+ if (self.weaponframe > 11)
+ {
+ Fire_finished();
+ }
+ if (self.weaponframe == 2)
+ {
+ W_FireSniper();
+ }
+};
+void() Fire_Magma =
+{
+ self.weaponframe += 1;
+ if (self.weaponframe > 11)
+ {
+ Fire_finished();
+ }
+ if (self.weaponframe == 2)
+ {
+ W_FireMagma();
+ }
+};
+void() FireAnimations =
+{
+ switch(self.weapon)
+ {
+ case IT_SPLASER:
+ {
+ startwframe(self, 1);
+ Fire_nail();
+ }
+ break;
+ case IT_SNIPER:
+ {
+ startwframe(self, 1);
+ Fire_Sniper();
+ }
+ break;
+ case IT_MAGMA:
+ {
+ startwframe(self, 1);
+ Fire_Magma();
+ }
+ break;
+ }
+};
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/Grapple.qc b/r17/Revamped src/Revamped QC/Primeqc4/Grapple.qc
new file mode 100755
index 00000000..f3999faf
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/Grapple.qc
@@ -0,0 +1,118 @@
+void () DrawBeam =
+{
+ local vector org;
+ org = (self.origin) + '0 0 16';
+ WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteByte(MSG_BROADCAST, TE_LIGHTNING1);
+ WriteEntity(MSG_BROADCAST, world);
+ WriteCoord(MSG_BROADCAST, org_x);
+ WriteCoord(MSG_BROADCAST, org_y);
+ WriteCoord(MSG_BROADCAST, org_z);
+ WriteCoord(MSG_BROADCAST, self.hook.origin_x);
+ WriteCoord(MSG_BROADCAST, self.hook.origin_y);
+ WriteCoord(MSG_BROADCAST, self.hook.origin_z);
+};
+
+void() pull =
+{
+ if (self.owner.hooking == 1)
+ {
+ self.owner.velocity = normalize(self.origin - self.owner.origin);
+ self.owner.velocity = self.owner.velocity * 500;
+ self.think = pull;
+ self.nextthink = time + 0.1;
+ }
+ else
+ {
+ self.owner.hooking = 0;
+ remove(self);
+ sound (self.owner, CHAN_WEAPON, "grapple/grreset.wav", 1, ATTN_NORM);
+ }
+};
+
+void() hookdamage =
+{
+if (self.enemy.health)
+{
+ self.owner.velocity = normalize(self.origin - self.owner.origin);
+ self.owner.velocity = self.owner.velocity * 500;
+
+ T_Damage(self.enemy, self, self.owner, 2);
+
+ self.origin = self.enemy.origin;
+ self.think = hookdamage;
+ self.nextthink = time + 0.1;
+}
+else
+{
+ self.owner.hooking = 0;
+ remove(self);
+ sound (self.owner, CHAN_WEAPON, "grapple/grreset.wav", 1, ATTN_NORM);
+}
+};
+
+void() PullHook =
+{
+ if (other == self.owner)
+ return;
+
+ if (other.classname == "grapple") // Pull
+ {
+ self.solid = SOLID_NOT;
+ self.movetype = MOVETYPE_NONE;
+ self.think = pull;
+ self.nextthink = time;
+ }
+ if (other.takedamage && other.health)
+ {
+ self.think = hookdamage;
+ self.enemy = other;
+ self.solid = SOLID_NOT;
+ self.nextthink = time;
+ }
+else
+ remove(self);
+ sound (self.owner, CHAN_WEAPON, "grapple/grhit.wav", 1, ATTN_NORM);
+
+};
+
+
+void() BreakHook =
+{
+ if (self.hooking == 1)
+ {
+ remove(self.hook);
+ self.hooking = 0;
+ sound (self, CHAN_WEAPON, "grapple/grreset.wav", 1, ATTN_NORM);
+ }
+};
+
+void () FireHook =
+{
+ local entity hooky;
+ hooky = spawn();
+ setorigin(hooky, self.origin + self.view_ofs);
+ setmodel(hooky, "progs/null.spr");
+ setsize (hooky, '0 0 0', '0 0 0');
+ hooky.solid = SOLID_BBOX;
+ hooky.movetype = MOVETYPE_FLYMISSILE;
+ makevectors(self.v_angle);
+ self.aiment = hooky;
+ hooky.velocity = v_forward * 1500;
+ hooky.owner = self;
+ self.hook = hooky;
+ hooky.classname = "hookend";
+ self.hooking = 1;
+ hooky.touch = PullHook;
+ //hooky.cansplash = 1; // If my splash tutorial is installed, uncomment this line
+ sound (self, CHAN_WEAPON, "grapple/grfire.wav", 1, ATTN_NORM);
+};
+
+void() CheckRope =
+{
+ if (self.hooking == 1 && self.hook.classname == "hookend")
+ {
+ DrawBeam ();
+ }
+
+};
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/Metroid.qc b/r17/Revamped src/Revamped QC/Primeqc4/Metroid.qc
new file mode 100755
index 00000000..e2da4b42
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/Metroid.qc
@@ -0,0 +1,347 @@
+/*
+==============================================================================
+
+WIZARD
+
+==============================================================================
+*/
+
+$cd id1/models/a_wizard
+$origin 0 0 24
+$base wizbase
+$skin wizbase
+
+$frame hover1 hover2 hover3 hover4 hover5 hover6 hover7 hover8
+$frame hover9 hover10 hover11 hover12 hover13 hover14 hover15
+
+$frame fly1 fly2 fly3 fly4 fly5 fly6 fly7 fly8 fly9 fly10
+$frame fly11 fly12 fly13 fly14
+
+$frame magatt1 magatt2 magatt3 magatt4 magatt5 magatt6 magatt7
+$frame magatt8 magatt9 magatt10 magatt11 magatt12 magatt13
+
+$frame pain1 pain2 pain3 pain4
+
+$frame death1 death2 death3 death4 death5 death6 death7 death8
+
+$frame idel1 idel2 idel3 idel4 idel5 idel6 idel7 idel8 idel9
+
+/*
+==============================================================================
+
+WIZARD
+
+If the player moves behind cover before the missile is launched, launch it
+at the last visible spot with no velocity leading, in hopes that the player
+will duck back out and catch it.
+==============================================================================
+*/
+
+
+
+void() met_run1;
+void() met_side1;
+
+/*
+=================
+WizardCheckAttack
+=================
+*/
+float() WizardCheckAttack =
+{
+ local vector spot1, spot2;
+ local entity targ;
+ local float chance;
+
+ if (time < self.attack_finished)
+ return FALSE;
+ if (!enemy_vis)
+ return FALSE;
+
+ if (enemy_range == RANGE_FAR)
+ {
+ if (self.attack_state != AS_STRAIGHT)
+ {
+ self.attack_state = AS_STRAIGHT;
+ met_run1 ();
+ }
+ return FALSE;
+ }
+
+ targ = self.enemy;
+
+// see if any entities are in the way of the shot
+ spot1 = self.origin + self.view_ofs;
+ spot2 = targ.origin + targ.view_ofs;
+
+ traceline (spot1, spot2, FALSE, self);
+
+ if (trace_ent != targ)
+ { // don't have a clear shot, so move to a side
+ if (self.attack_state != AS_STRAIGHT)
+ {
+ self.attack_state = AS_STRAIGHT;
+ met_run1 ();
+ }
+ return FALSE;
+ }
+
+ if (enemy_range == RANGE_MELEE)
+ chance = 0.9;
+ else if (enemy_range == RANGE_NEAR)
+ chance = 0.6;
+ else if (enemy_range == RANGE_MID)
+ chance = 0.2;
+ else
+ chance = 0;
+
+
+ if (enemy_range == RANGE_MID)
+ {
+ if (self.attack_state != AS_STRAIGHT)
+ {
+ self.attack_state = AS_STRAIGHT;
+ met_run1 ();
+ }
+ }
+ else
+ {
+ if (self.attack_state != AS_SLIDING)
+ {
+ self.attack_state = AS_SLIDING;
+ met_side1 ();
+ }
+ }
+
+ return FALSE;
+};
+
+/*
+=================
+WizardAttackFinished
+=================
+*/
+float() WizardAttackFinished =
+{
+ if (enemy_range >= RANGE_MID || !enemy_vis)
+ {
+ self.attack_state = AS_STRAIGHT;
+ self.think = met_run1;
+ }
+ else
+ {
+ self.attack_state = AS_SLIDING;
+ self.think = met_side1;
+ }
+};
+
+/*
+==============================================================================
+
+FAST ATTACKS
+
+==============================================================================
+*/
+
+void() Wiz_FastFire =
+{
+ local vector vec;
+ local vector dst;
+
+ if (self.owner.health > 0)
+ {
+ self.owner.effects = self.owner.effects | EF_MUZZLEFLASH;
+
+ makevectors (self.enemy.angles);
+ dst = self.enemy.origin - 13*self.movedir;
+
+ vec = normalize(dst - self.origin);
+ sound (self, CHAN_WEAPON, "wizard/wattack.wav", 1, ATTN_NORM);
+ launch_spike (self.origin, vec);
+ newmis.velocity = vec*600;
+ newmis.owner = self.owner;
+ newmis.classname = "wizspike";
+ setmodel (newmis, "progs/w_spike.mdl");
+ setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);
+ }
+
+ remove (self);
+};
+
+
+void() metroid_idlesound =
+{
+local float wr;
+ wr = random() * 5;
+
+ if (self.waitmin < time)
+ {
+ self.waitmin = time + 2;
+ if (wr > 4.5)
+ sound (self, CHAN_VOICE, "wizard/widle1.wav", 1, ATTN_IDLE);
+ if (wr < 1.5)
+ sound (self, CHAN_VOICE, "wizard/widle2.wav", 1, ATTN_IDLE);
+ }
+ return;
+};
+
+void() met_stand1 =[ $hover1, met_stand2 ] {ai_stand();};
+void() met_stand2 =[ $hover2, met_stand3 ] {ai_stand();};
+void() met_stand3 =[ $hover3, met_stand4 ] {ai_stand();};
+void() met_stand4 =[ $hover4, met_stand5 ] {ai_stand();};
+void() met_stand5 =[ $hover5, met_stand6 ] {ai_stand();};
+void() met_stand6 =[ $hover6, met_stand7 ] {ai_stand();};
+void() met_stand7 =[ $hover7, met_stand8 ] {ai_stand();};
+void() met_stand8 =[ $hover8, met_stand1 ] {ai_stand();};
+
+void() met_walk1 =[ $hover1, met_walk2 ] {ai_walk(8);
+metroid_idlesound();};
+void() met_walk2 =[ $hover2, met_walk3 ] {ai_walk(8);};
+void() met_walk3 =[ $hover3, met_walk4 ] {ai_walk(8);};
+void() met_walk4 =[ $hover4, met_walk5 ] {ai_walk(8);};
+void() met_walk5 =[ $hover5, met_walk6 ] {ai_walk(8);};
+void() met_walk6 =[ $hover6, met_walk7 ] {ai_walk(8);};
+void() met_walk7 =[ $hover7, met_walk8 ] {ai_walk(8);};
+void() met_walk8 =[ $hover8, met_walk1 ] {ai_walk(8);};
+
+void() met_side1 =[ $hover1, met_side2 ] {ai_run(8);
+metroid_idlesound();};
+void() met_side2 =[ $hover2, met_side3 ] {ai_run(8);};
+void() met_side3 =[ $hover3, met_side4 ] {ai_run(8);};
+void() met_side4 =[ $hover4, met_side5 ] {ai_run(8);};
+void() met_side5 =[ $hover5, met_side6 ] {ai_run(8);};
+void() met_side6 =[ $hover6, met_side7 ] {ai_run(8);};
+void() met_side7 =[ $hover7, met_side8 ] {ai_run(8);};
+void() met_side8 =[ $hover8, met_side1 ] {ai_run(8);};
+
+void() met_run1 =[ $fly1, met_run2 ] {ai_run(16);
+metroid_idlesound();
+};
+void() met_run2 =[ $fly2, met_run3 ] {ai_run(16);};
+void() met_run3 =[ $fly3, met_run4 ] {ai_run(16);};
+void() met_run4 =[ $fly4, met_run5 ] {ai_run(16);};
+void() met_run5 =[ $fly5, met_run6 ] {ai_run(16);};
+void() met_run6 =[ $fly6, met_run7 ] {ai_run(16);};
+void() met_run7 =[ $fly7, met_run8 ] {ai_run(16);};
+void() met_run8 =[ $fly8, met_run9 ] {ai_run(16);};
+void() met_run9 =[ $fly9, met_run10 ] {ai_run(16);};
+void() met_run10 =[ $fly10, met_run11 ] {ai_run(16);};
+void() met_run11 =[ $fly11, met_run12 ] {ai_run(16);};
+void() met_run12 =[ $fly12, met_run13 ] {ai_run(16);};
+void() met_run13 =[ $fly13, met_run14 ] {ai_run(16);};
+void() met_run14 =[ $fly14, met_run1 ] {ai_run(16);};
+
+void() met_fast1 =[ $magatt1, met_fast2 ] {ai_face();Wiz_StartFast();};
+void() met_fast2 =[ $magatt2, met_fast3 ] {ai_face();};
+void() met_fast3 =[ $magatt3, met_fast4 ] {ai_face();};
+void() met_fast4 =[ $magatt4, met_fast5 ] {ai_face();};
+void() met_fast5 =[ $magatt5, met_fast6 ] {ai_face();};
+void() met_fast6 =[ $magatt6, met_fast7 ] {ai_face();};
+void() met_fast7 =[ $magatt5, met_fast8 ] {ai_face();};
+void() met_fast8 =[ $magatt4, met_fast9 ] {ai_face();};
+void() met_fast9 =[ $magatt3, met_fast10 ] {ai_face();};
+void() met_fast10 =[ $magatt2, met_run1 ] {ai_face();SUB_AttackFinished(2);WizardAttackFinished ();};
+
+void() met_pain1 =[ $pain1, met_pain2 ] {};
+void() met_pain2 =[ $pain2, met_pain3 ] {};
+void() met_pain3 =[ $pain3, met_pain4 ] {};
+void() met_pain4 =[ $pain4, met_run1 ] {};
+
+void() met_death1 =[ $death1, met_death2 ] {
+
+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 (self, CHAN_VOICE, "wizard/wdeath.wav", 1, ATTN_NORM);
+};
+void() met_death2 =[ $death2, met_death3 ] {};
+void() met_death3 =[ $death3, met_death4 ]{self.solid = SOLID_NOT;};
+void() met_death4 =[ $death4, met_death5 ] {};
+void() met_death5 =[ $death5, met_death6 ] {};
+void() met_death6 =[ $death6, met_death7 ] {};
+void() met_death7 =[ $death7, met_death8 ] {};
+void() met_death8 =[ $death8, met_death8 ] {};
+
+void() metroid_die =
+{
+// check for gib
+ if (self.health < -40)
+ {
+ sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
+ ThrowHead ("progs/h_wizard.mdl", self.health);
+ ThrowGib ("progs/gib2.mdl", self.health);
+ ThrowGib ("progs/gib2.mdl", self.health);
+ ThrowGib ("progs/gib2.mdl", self.health);
+ return;
+ }
+
+ met_death1 ();
+};
+
+
+void(entity attacker, float damage) metroid_Pain =
+{
+ sound (self, CHAN_VOICE, "wizard/wpain.wav", 1, ATTN_NORM);
+ if (random()*70 > damage)
+ return; // didn't flinch
+
+ met_pain1 ();
+};
+void() met_atk1 =[ $attackb1, knight_atk2 ]
+{
+sound (self, CHAN_WEAPON, "knight/sword1.wav", 1, ATTN_NORM);
+ai_charge(0);};
+void() met_atk2 =[ $idel1, met_atk3 ] {ai_charge(7);};
+void() met_atk3 =[ $idel2, met_atk4 ] {ai_charge(4);};
+void() met_atk4 =[ $idel3, met_atk5 ] {ai_charge(0);};
+void() met_atk5 =[ $idel4, met_atk6 ] {ai_charge(3);};
+void() met_atk6 =[ $idel5, met_atk7 ] {ai_charge(4); ai_melee();};
+void() met_atk7 =[ $idel6, met_atk8 ] {ai_charge(1); ai_melee();};
+void() met_atk8 =[ $idel7, met_atk9 ] {ai_charge(3);
+ai_melee();};
+void() met_atk9 =[ $idel8, met_atk10] {ai_charge(1);};
+void() met_atk10=[ $idel9, met_run1 ] {ai_charge(5);};
+
+//void() knight_atk9 =[ $attack9, knight_atk10 ] {};
+//void() knight_atk10 =[ $attack10, knight_atk11 ] {};
+//void() knight_atk11 =[ $attack11, knight_run1 ] {};
+/*QUAKED monster_wizard (1 0 0) (-16 -16 -24) (16 16 40) Ambush
+*/
+void() monster_wizard =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+ precache_model ("progs/metroid.mdl");
+ precache_model ("progs/h_wizard.mdl");
+ precache_model ("progs/w_spike.mdl");
+
+ precache_sound ("wizard/hit.wav"); // used by c code
+ precache_sound ("wizard/wattack.wav");
+ precache_sound ("wizard/wdeath.wav");
+ precache_sound ("wizard/widle1.wav");
+ precache_sound ("wizard/widle2.wav");
+ precache_sound ("wizard/wpain.wav");
+ precache_sound ("wizard/wsight.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/metroid.mdl");
+
+ setsize (self, '-16 -16 -24', '16 16 32');
+ self.health = 120;
+
+ self.th_stand = met_stand1;
+ self.th_walk = met_walk1;
+ self.th_run = met_run1;
+ self.th_pain = metroid_Pain;
+ self.th_melee = met_atk1;
+ self.th_die = metroid_die;
+
+ flymonster_start ();
+};
+
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/Touch_functions.qc b/r17/Revamped src/Revamped QC/Primeqc4/Touch_functions.qc
new file mode 100755
index 00000000..24ce9c44
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/Touch_functions.qc
@@ -0,0 +1,30 @@
+//For Blaster.
+void(vector org) BlasterTouch =
+{
+ self.velocity = '0 0 0';
+
+ if (other.takedamage) {
+ spawn_touchblood (18);
+ T_Damage (other, self, self.owner, 15);
+ }
+ else
+ {
+ puff_org = self.origin;
+ }
+ remove(self);
+};
+//Sniper
+void(vector org) SniperTouch =
+{
+ self.velocity = '0 0 0';
+
+ if (other.takedamage) {
+ spawn_touchblood (18);
+ T_Damage (other, self, self.owner, 15);
+ }
+ else
+ {
+ puff_org = self.origin;
+ }
+ remove(self);
+};
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/ai.qc b/r17/Revamped src/Revamped QC/Primeqc4/ai.qc
new file mode 100755
index 00000000..e42a7940
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/ai.qc
@@ -0,0 +1,741 @@
+void() movetarget_f;
+void() t_movetarget;
+void() knight_walk1;
+void() knight_bow6;
+void() knight_bow1;
+void(entity etemp, entity stemp, entity stemp, float dmg) T_Damage;
+/*
+
+.enemy
+Will be world if not currently angry at anyone.
+
+.movetarget
+The next path spot to walk toward. If .enemy, ignore .movetarget.
+When an enemy is killed, the monster will try to return to it's path.
+
+.huntt_ime
+Set to time + something when the player is in sight, but movement straight for
+him is blocked. This causes the monster to use wall following code for
+movement direction instead of sighting on the player.
+
+.ideal_yaw
+A yaw angle of the intended direction, which will be turned towards at up
+to 45 deg / state. If the enemy is in view and hunt_time is not active,
+this will be the exact line towards the enemy.
+
+.pausetime
+A monster will leave it's stand state and head towards it's .movetarget when
+time > .pausetime.
+
+walkmove(angle, speed) primitive is all or nothing
+*/
+
+
+//
+// globals
+//
+//
+// when a monster becomes angry at a player, that monster will be used
+// as the sight target the next frame so that monsters near that one
+// will wake up even if they wouldn't have noticed the player
+//
+entity sight_entity;
+float sight_entity_time;
+
+float(float v) anglemod =
+{
+ while (v >= 360)
+ v = v - 360;
+ while (v < 0)
+ v = v + 360;
+ return v;
+};
+
+/*
+==============================================================================
+
+MOVETARGET CODE
+
+The angle of the movetarget effects standing and bowing direction, but has no effect on movement, which allways heads to the next target.
+
+targetname
+must be present. The name of this movetarget.
+
+target
+the next spot to move to. If not present, stop here for good.
+
+pausetime
+The number of seconds to spend standing or bowing for path_stand or path_bow
+
+==============================================================================
+*/
+
+
+void() movetarget_f =
+{
+ if (!self.targetname)
+ objerror ("monster_movetarget: no targetname");
+
+ self.solid = SOLID_TRIGGER;
+ self.touch = t_movetarget;
+ setsize (self, '-8 -8 -8', '8 8 8');
+
+};
+
+/*QUAKED path_corner (0.5 0.3 0) (-8 -8 -8) (8 8 8)
+Monsters will continue walking towards the next target corner.
+*/
+void() path_corner =
+{
+ movetarget_f ();
+};
+
+
+/*
+=============
+t_movetarget
+
+Something has bumped into a movetarget. If it is a monster
+moving towards it, change the next destination and continue.
+==============
+*/
+void() t_movetarget =
+{
+local entity temp;
+
+ if (other.movetarget != self)
+ return;
+
+ if (other.enemy)
+ return; // fighting, not following a path
+
+ temp = self;
+ self = other;
+ other = temp;
+
+ if (self.classname == "monster_ogre")
+ sound (self, CHAN_VOICE, "ogre/ogdrag.wav", 1, ATTN_IDLE);// play chainsaw drag sound
+
+//dprint ("t_movetarget\n");
+ self.goalentity = self.movetarget = find (world, targetname, other.target);
+ self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
+ if (!self.movetarget)
+ {
+ self.pausetime = time + 999999;
+ self.th_stand ();
+ return;
+ }
+};
+
+
+
+//============================================================================
+
+/*
+=============
+range
+
+returns the range catagorization of an entity reletive to self
+0 melee range, will become hostile even if back is turned
+1 visibility and infront, or visibility and show hostile
+2 infront and show hostile
+3 only triggered by damage
+=============
+*/
+float(entity targ) range =
+{
+local vector spot1, spot2;
+local float r;
+ spot1 = self.origin + self.view_ofs;
+ spot2 = targ.origin + targ.view_ofs;
+
+ r = vlen (spot1 - spot2);
+ if (r < 120)
+ return RANGE_MELEE;
+ if (r < 500)
+ return RANGE_NEAR;
+ if (r < 1000)
+ return RANGE_MID;
+ return RANGE_FAR;
+};
+
+/*
+=============
+visible
+
+returns 1 if the entity is visible to self, even if not infront ()
+=============
+*/
+float (entity targ) visible =
+{
+ local vector spot1, spot2;
+
+ spot1 = self.origin + self.view_ofs;
+ spot2 = targ.origin + targ.view_ofs;
+ traceline (spot1, spot2, TRUE, self); // see through other monsters
+
+ if (trace_inopen && trace_inwater)
+ return FALSE; // sight line crossed contents
+
+ if (trace_fraction == 1)
+ return TRUE;
+ return FALSE;
+};
+
+
+/*
+=============
+infront
+
+returns 1 if the entity is in front (in sight) of self
+=============
+*/
+float(entity targ) infront =
+{
+ local vector vec;
+ local float dot;
+
+ makevectors (self.angles);
+ vec = normalize (targ.origin - self.origin);
+ dot = vec * v_forward;
+
+ if ( dot > 0.3)
+ {
+ return TRUE;
+ }
+ return FALSE;
+};
+
+
+//============================================================================
+
+/*
+===========
+ChangeYaw
+
+Turns towards self.ideal_yaw at self.yaw_speed
+Sets the global variable current_yaw
+Called every 0.1 sec by monsters
+============
+*/
+/*
+
+void() ChangeYaw =
+{
+ local float ideal, move;
+
+//current_yaw = self.ideal_yaw;
+// mod down the current angle
+ current_yaw = anglemod( self.angles_y );
+ ideal = self.ideal_yaw;
+
+ if (current_yaw == ideal)
+ return;
+
+ move = ideal - current_yaw;
+ if (ideal > current_yaw)
+ {
+ if (move > 180)
+ move = move - 360;
+ }
+ else
+ {
+ if (move < -180)
+ move = move + 360;
+ }
+
+ if (move > 0)
+ {
+ if (move > self.yaw_speed)
+ move = self.yaw_speed;
+ }
+ else
+ {
+ if (move < 0-self.yaw_speed )
+ move = 0-self.yaw_speed;
+ }
+
+ current_yaw = anglemod (current_yaw + move);
+
+ self.angles_y = current_yaw;
+};
+
+*/
+
+
+//============================================================================
+
+void() HuntTarget =
+{
+ self.goalentity = self.enemy;
+ self.think = self.th_run;
+ self.ideal_yaw = vectoyaw(self.enemy.origin - self.origin);
+ self.nextthink = time + 0.1;
+ SUB_AttackFinished (1); // wait a while before first attack
+};
+
+void() SightSound =
+{
+local float rsnd;
+
+ if (self.classname == "monster_ogre")
+ sound (self, CHAN_VOICE, "ogre/ogwake.wav", 1, ATTN_NORM);
+ else if (self.classname == "monster_knight")
+ sound (self, CHAN_VOICE, "knight/ksight.wav", 1, ATTN_NORM);
+ else if (self.classname == "monster_shambler")
+ sound (self, CHAN_VOICE, "shambler/ssight.wav", 1, ATTN_NORM);
+ else if (self.classname == "monster_demon1")
+ sound (self, CHAN_VOICE, "demon/sight2.wav", 1, ATTN_NORM);
+ else if (self.classname == "monster_wizard")
+ sound (self, CHAN_VOICE, "wizard/wsight.wav", 1, ATTN_NORM);
+ else if (self.classname == "monster_zombie")
+ sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_NORM);
+ else if (self.classname == "monster_dog")
+ sound (self, CHAN_VOICE, "dog/dsight.wav", 1, ATTN_NORM);
+ else if (self.classname == "monster_hell_knight")
+ sound (self, CHAN_VOICE, "hknight/sight1.wav", 1, ATTN_NORM);
+ else if (self.classname == "monster_tarbaby")
+ sound (self, CHAN_VOICE, "blob/sight1.wav", 1, ATTN_NORM);
+ else if (self.classname == "monster_vomit")
+ sound (self, CHAN_VOICE, "vomitus/v_sight1.wav", 1, ATTN_NORM);
+ else if (self.classname == "monster_enforcer")
+ {
+ rsnd = rint(random() * 3);
+ if (rsnd == 1)
+ sound (self, CHAN_VOICE, "enforcer/sight1.wav", 1, ATTN_NORM);
+ else if (rsnd == 2)
+ sound (self, CHAN_VOICE, "enforcer/sight2.wav", 1, ATTN_NORM);
+ else if (rsnd == 0)
+ sound (self, CHAN_VOICE, "enforcer/sight3.wav", 1, ATTN_NORM);
+ else
+ sound (self, CHAN_VOICE, "enforcer/sight4.wav", 1, ATTN_NORM);
+ }
+ else if (self.classname == "monster_army")
+ sound (self, CHAN_VOICE, "soldier/sight1.wav", 1, ATTN_NORM);
+ else if (self.classname == "monster_shalrath")
+ sound (self, CHAN_VOICE, "shalrath/sight.wav", 1, ATTN_NORM);
+};
+
+void() FoundTarget =
+{
+ if (self.enemy.classname == "player")
+ { // let other monsters see this monster for a while
+ sight_entity = self;
+ sight_entity_time = time;
+ }
+
+ self.show_hostile = time + 1; // wake up other monsters
+
+ SightSound ();
+ HuntTarget ();
+};
+
+/*
+===========
+FindTarget
+
+Self is currently not attacking anything, so try to find a target
+
+Returns TRUE if an enemy was sighted
+
+When a player fires a missile, the point of impact becomes a fakeplayer so
+that monsters that see the impact will respond as if they had seen the
+player.
+
+To avoid spending too much time, only a single client (or fakeclient) is
+checked each frame. This means multi player games will have slightly
+slower noticing monsters.
+============
+*/
+float() FindTarget =
+{
+ local entity client;
+ local float r;
+
+// if the first spawnflag bit is set, the monster will only wake up on
+// really seeing the player, not another monster getting angry
+
+// 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 && !(self.spawnflags & 3) )
+ {
+ client = sight_entity;
+ if (client.enemy == self.enemy)
+ return TRUE;
+ }
+ else
+ {
+ client = checkclient ();
+ if (!client)
+ return FALSE; // current check entity isn't in PVS
+ }
+
+ if (client == self.enemy)
+ return FALSE;
+
+ if (client.flags & FL_NOTARGET)
+ return FALSE;
+ if (client.items & IT_INVISIBILITY)
+ return FALSE;
+
+ r = range (client);
+ if (r == RANGE_FAR)
+ return FALSE;
+
+ if (!visible (client))
+ return FALSE;
+
+ if (r == RANGE_NEAR)
+ {
+ if (client.show_hostile < time && !infront (client))
+ return FALSE;
+ }
+ else if (r == RANGE_MID)
+ {
+ if ( /* client.show_hostile < time || */ !infront (client))
+ return FALSE;
+ }
+
+//
+// got one
+//
+ self.enemy = client;
+ if (self.enemy.classname != "player")
+ {
+ self.enemy = self.enemy.enemy;
+ if (self.enemy.classname != "player")
+ {
+ self.enemy = world;
+ return FALSE;
+ }
+ }
+
+ FoundTarget ();
+
+ return TRUE;
+};
+
+
+//=============================================================================
+
+void(float dist) ai_forward =
+{
+ walkmove (self.angles_y, dist);
+};
+
+void(float dist) ai_back =
+{
+ walkmove ( (self.angles_y+180), dist);
+};
+
+
+/*
+=============
+ai_pain
+
+stagger back a bit
+=============
+*/
+void(float dist) ai_pain =
+{
+ ai_back (dist);
+/*
+ local float away;
+
+ away = anglemod (vectoyaw (self.origin - self.enemy.origin)
+ + 180*(random()- 0.5) );
+
+ walkmove (away, dist);
+*/
+};
+
+/*
+=============
+ai_painforward
+
+stagger back a bit
+=============
+*/
+void(float dist) ai_painforward =
+{
+ walkmove (self.ideal_yaw, dist);
+};
+
+/*
+=============
+ai_walk
+
+The monster is walking it's beat
+=============
+*/
+void(float dist) ai_walk =
+{
+
+ movedist = dist;
+
+ if (self.classname == "monster_dragon")
+ {
+ movetogoal (dist);
+ return;
+ }
+ // check for noticing a player
+ if (FindTarget ())
+ return;
+
+ movetogoal (dist);
+};
+
+
+/*
+=============
+ai_stand
+
+The monster is staying in one place for a while, with slight angle turns
+=============
+*/
+void() ai_stand =
+{
+ if (FindTarget ())
+ return;
+
+ if (time > self.pausetime)
+ {
+ self.th_walk ();
+ return;
+ }
+
+// change angle slightly
+
+};
+
+/*
+=============
+ai_turn
+
+don't move, but turn towards ideal_yaw
+=============
+*/
+void() ai_turn =
+{
+ if (FindTarget ())
+ return;
+
+ ChangeYaw ();
+};
+
+//=============================================================================
+
+/*
+=============
+ChooseTurn
+=============
+*/
+void(vector dest3) ChooseTurn =
+{
+ local vector dir, newdir;
+
+ dir = self.origin - dest3;
+
+ newdir_x = trace_plane_normal_y;
+ newdir_y = 0 - trace_plane_normal_x;
+ newdir_z = 0;
+
+ if (dir * newdir > 0)
+ {
+ dir_x = 0 - trace_plane_normal_y;
+ dir_y = trace_plane_normal_x;
+ }
+ else
+ {
+ dir_x = trace_plane_normal_y;
+ dir_y = 0 - trace_plane_normal_x;
+ }
+
+ dir_z = 0;
+ self.ideal_yaw = vectoyaw(dir);
+};
+
+/*
+============
+FacingIdeal
+
+============
+*/
+float() FacingIdeal =
+{
+ local float delta;
+
+ delta = anglemod(self.angles_y - self.ideal_yaw);
+ if (delta > 45 && delta < 315)
+ return FALSE;
+ return TRUE;
+};
+
+
+//=============================================================================
+
+float() WizardCheckAttack;
+float() DogCheckAttack;
+
+float() CheckAnyAttack =
+{
+ if (!enemy_vis)
+ return;
+ if (self.classname == "monster_army")
+ return SoldierCheckAttack ();
+ if (self.classname == "monster_ogre")
+ return OgreCheckAttack ();
+ if (self.classname == "monster_shambler")
+ return ShamCheckAttack ();
+ if (self.classname == "monster_demon1")
+ return DemonCheckAttack ();
+ if (self.classname == "monster_dog")
+ return DogCheckAttack ();
+ if (self.classname == "monster_wizard")
+ return WizardCheckAttack ();
+ return CheckAttack ();
+};
+
+
+/*
+=============
+ai_run_melee
+
+Turn and close until within an angle to launch a melee attack
+=============
+*/
+void() ai_run_melee =
+{
+ self.ideal_yaw = enemy_yaw;
+ ChangeYaw ();
+
+ if (FacingIdeal())
+ {
+ self.th_melee ();
+ self.attack_state = AS_STRAIGHT;
+ }
+};
+
+
+/*
+=============
+ai_run_missile
+
+Turn in place until within an angle to launch a missile attack
+=============
+*/
+void() ai_run_missile =
+{
+ self.ideal_yaw = enemy_yaw;
+ ChangeYaw ();
+ if (FacingIdeal())
+ {
+ self.th_missile ();
+ self.attack_state = AS_STRAIGHT;
+ }
+};
+
+
+/*
+=============
+ai_run_slide
+
+Strafe sideways, but stay at aproximately the same range
+=============
+*/
+void() ai_run_slide =
+{
+ local float ofs;
+
+ self.ideal_yaw = enemy_yaw;
+ ChangeYaw ();
+ if (self.lefty)
+ ofs = 90;
+ else
+ ofs = -90;
+
+ if (walkmove (self.ideal_yaw + ofs, movedist))
+ return;
+
+ self.lefty = 1 - self.lefty;
+
+ walkmove (self.ideal_yaw - ofs, movedist);
+};
+
+
+/*
+=============
+ai_run
+
+The monster has an enemy it is trying to kill
+=============
+*/
+void(float dist) ai_run =
+{
+
+ movedist = dist;
+// see if the enemy is dead
+ if (self.enemy.health <= 0)
+ {
+ self.enemy = world;
+ // FIXME: look all around for other targets
+ if (self.oldenemy.health > 0)
+ {
+ self.enemy = self.oldenemy;
+ HuntTarget ();
+ }
+ else
+ {
+ if (self.movetarget)
+ self.th_walk ();
+ else
+ self.th_stand ();
+ return;
+ }
+ }
+
+ self.show_hostile = time + 1; // wake up other monsters
+
+// check knowledge of enemy
+ enemy_vis = visible(self.enemy);
+ if (enemy_vis)
+ self.search_time = time + 5;
+
+// look for other coop players
+ if (coop && self.search_time < time)
+ {
+ if (FindTarget ())
+ return;
+ }
+
+ enemy_infront = infront(self.enemy);
+ enemy_range = range(self.enemy);
+ enemy_yaw = vectoyaw(self.enemy.origin - self.origin);
+
+ if (self.attack_state == AS_MISSILE)
+ {
+//dprint ("ai_run_missile\n");
+ ai_run_missile ();
+ return;
+ }
+ if (self.attack_state == AS_MELEE)
+ {
+//dprint ("ai_run_melee\n");
+ ai_run_melee ();
+ return;
+ }
+
+ if (CheckAnyAttack ())
+ return; // beginning an attack
+
+ if (self.attack_state == AS_SLIDING)
+ {
+ ai_run_slide ();
+ return;
+ }
+
+// head straight in
+ movetogoal (dist); // done in C code...
+};
+
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/amtest.qc b/r17/Revamped src/Revamped QC/Primeqc4/amtest.qc
new file mode 100755
index 00000000..97f95928
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/amtest.qc
@@ -0,0 +1,85 @@
+/*~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>
+~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~*/
+
+void() test_teleport_touch;
+void() tele_done;
+
+/*QUAKED test_teleport (0 .5 .8) ?
+Teleporter testing
+*/
+void() test_teleport =
+{
+ precache_model ("sprites/s_aball.spr");
+ setsize (self, self.mins, self.maxs);
+ self.touch = test_teleport_touch;
+ self.solid = 1;
+
+ if (!self.target)
+ objerror ("no target\n");
+};
+
+void() test_teleport_touch =
+{
+local entity oldself;
+ other.movetype = MOVETYPE_TOSS;
+// other.solid = SOLID_NOT;
+ other.dest = '256 -128 -128';
+ oldself = self;
+ self = other;
+// SUB_CalcMove (self.dest, 200, tele_done);
+ self.velocity = '1000 0 0 ';
+ self = oldself;
+};
+
+void() tele_done =
+{
+ self.movetype = MOVETYPE_WALK;
+ self.solid = SOLID_SLIDEBOX;
+};
+
+/*~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>
+~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~*/
+
+void() test_goaway;
+void() test_spawn;
+
+/*QUAKED test_fodder (0 .5 .8) ?
+beating guy
+*/
+void() test_fodder =
+{
+ self.nextthink = time + 3;
+ self.think = test_spawn;
+};
+
+void() test_spawn =
+{
+local entity body;
+ makevectors (self.angles);
+
+ body = spawn();
+ setmodel (body, "progs/soldier.mdl");
+ setorigin (body, self.origin);
+ body.classname = "player";
+ body.health = 1000;
+ body.frags = 0;
+ body.takedamage = DAMAGE_AIM;
+ body.solid = SOLID_SLIDEBOX;
+ body.movetype = MOVETYPE_WALK;
+ body.show_hostile = 0;
+ body.weapon = 1;
+ body.velocity = v_forward * 200;
+
+ body.nextthink = time + 5;
+ body.think = test_goaway;
+
+self.nextthink = time + 3;
+self.think = test_spawn;
+
+};
+
+void() test_goaway =
+{
+ remove (self);
+};
+
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/boss.qc b/r17/Revamped src/Revamped QC/Primeqc4/boss.qc
new file mode 100755
index 00000000..949de52d
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/boss.qc
@@ -0,0 +1,385 @@
+/*
+==============================================================================
+
+BOSS-ONE
+
+==============================================================================
+*/
+$cd id1/models/boss1
+$origin 0 0 -15
+$base base
+$skin skin
+$scale 5
+
+$frame rise1 rise2 rise3 rise4 rise5 rise6 rise7 rise8 rise9 rise10
+$frame rise11 rise12 rise13 rise14 rise15 rise16 rise17
+
+$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8
+$frame walk9 walk10 walk11 walk12 walk13 walk14 walk15
+$frame walk16 walk17 walk18 walk19 walk20 walk21 walk22
+$frame walk23 walk24 walk25 walk26 walk27 walk28 walk29 walk30 walk31
+
+$frame death1 death2 death3 death4 death5 death6 death7 death8 death9
+
+$frame attack1 attack2 attack3 attack4 attack5 attack6 attack7 attack8
+$frame attack9 attack10 attack11 attack12 attack13 attack14 attack15
+$frame attack16 attack17 attack18 attack19 attack20 attack21 attack22
+$frame attack23
+
+$frame shocka1 shocka2 shocka3 shocka4 shocka5 shocka6 shocka7 shocka8
+$frame shocka9 shocka10
+
+$frame shockb1 shockb2 shockb3 shockb4 shockb5 shockb6
+
+$frame shockc1 shockc2 shockc3 shockc4 shockc5 shockc6 shockc7 shockc8
+$frame shockc9 shockc10
+
+
+void(vector p) boss_missile;
+
+void() boss_face =
+{
+
+// go for another player if multi player
+ if (self.enemy.health <= 0 || random() < 0.02)
+ {
+ self.enemy = find(self.enemy, classname, "player");
+ if (!self.enemy)
+ self.enemy = find(self.enemy, classname, "player");
+ }
+ ai_face();
+};
+
+void() boss_rise1 =[ $rise1, boss_rise2 ] {
+sound (self, CHAN_WEAPON, "boss1/out1.wav", 1, ATTN_NORM);
+};
+void() boss_rise2 =[ $rise2, boss_rise3 ] {
+sound (self, CHAN_VOICE, "boss1/sight1.wav", 1, ATTN_NORM);
+};
+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_missile1 ] {};
+
+void() boss_idle1 =[ $walk1, boss_idle2 ]
+{
+// look for other players
+};
+void() boss_idle2 =[ $walk2, boss_idle3 ] {boss_face();};
+void() boss_idle3 =[ $walk3, boss_idle4 ] {boss_face();};
+void() boss_idle4 =[ $walk4, boss_idle5 ] {boss_face();};
+void() boss_idle5 =[ $walk5, boss_idle6 ] {boss_face();};
+void() boss_idle6 =[ $walk6, boss_idle7 ] {boss_face();};
+void() boss_idle7 =[ $walk7, boss_idle8 ] {boss_face();};
+void() boss_idle8 =[ $walk8, boss_idle9 ] {boss_face();};
+void() boss_idle9 =[ $walk9, boss_idle10 ] {boss_face();};
+void() boss_idle10 =[ $walk10, boss_idle11 ] {boss_face();};
+void() boss_idle11 =[ $walk11, boss_idle12 ] {boss_face();};
+void() boss_idle12 =[ $walk12, boss_idle13 ] {boss_face();};
+void() boss_idle13 =[ $walk13, boss_idle14 ] {boss_face();};
+void() boss_idle14 =[ $walk14, boss_idle15 ] {boss_face();};
+void() boss_idle15 =[ $walk15, boss_idle16 ] {boss_face();};
+void() boss_idle16 =[ $walk16, boss_idle17 ] {boss_face();};
+void() boss_idle17 =[ $walk17, boss_idle18 ] {boss_face();};
+void() boss_idle18 =[ $walk18, boss_idle19 ] {boss_face();};
+void() boss_idle19 =[ $walk19, boss_idle20 ] {boss_face();};
+void() boss_idle20 =[ $walk20, boss_idle21 ] {boss_face();};
+void() boss_idle21 =[ $walk21, boss_idle22 ] {boss_face();};
+void() boss_idle22 =[ $walk22, boss_idle23 ] {boss_face();};
+void() boss_idle23 =[ $walk23, boss_idle24 ] {boss_face();};
+void() boss_idle24 =[ $walk24, boss_idle25 ] {boss_face();};
+void() boss_idle25 =[ $walk25, boss_idle26 ] {boss_face();};
+void() boss_idle26 =[ $walk26, boss_idle27 ] {boss_face();};
+void() boss_idle27 =[ $walk27, boss_idle28 ] {boss_face();};
+void() boss_idle28 =[ $walk28, boss_idle29 ] {boss_face();};
+void() boss_idle29 =[ $walk29, boss_idle30 ] {boss_face();};
+void() boss_idle30 =[ $walk30, boss_idle31 ] {boss_face();};
+void() boss_idle31 =[ $walk31, boss_idle1 ] {boss_face();};
+
+void() boss_missile1 =[ $attack1, boss_missile2 ] {boss_face();};
+void() boss_missile2 =[ $attack2, boss_missile3 ] {boss_face();};
+void() boss_missile3 =[ $attack3, boss_missile4 ] {boss_face();};
+void() boss_missile4 =[ $attack4, boss_missile5 ] {boss_face();};
+void() boss_missile5 =[ $attack5, boss_missile6 ] {boss_face();};
+void() boss_missile6 =[ $attack6, boss_missile7 ] {boss_face();};
+void() boss_missile7 =[ $attack7, boss_missile8 ] {boss_face();};
+void() boss_missile8 =[ $attack8, boss_missile9 ] {boss_face();};
+void() boss_missile9 =[ $attack9, boss_missile10 ] {boss_missile('100 100 200');};
+void() boss_missile10 =[ $attack10, boss_missile11 ] {boss_face();};
+void() boss_missile11 =[ $attack11, boss_missile12 ] {boss_face();};
+void() boss_missile12 =[ $attack12, boss_missile13 ] {boss_face();};
+void() boss_missile13 =[ $attack13, boss_missile14 ] {boss_face();};
+void() boss_missile14 =[ $attack14, boss_missile15 ] {boss_face();};
+void() boss_missile15 =[ $attack15, boss_missile16 ] {boss_face();};
+void() boss_missile16 =[ $attack16, boss_missile17 ] {boss_face();};
+void() boss_missile17 =[ $attack17, boss_missile18 ] {boss_face();};
+void() boss_missile18 =[ $attack18, boss_missile19 ] {boss_face();};
+void() boss_missile19 =[ $attack19, boss_missile20 ] {boss_face();};
+void() boss_missile20 =[ $attack20, boss_missile21 ] {boss_missile('100 -100 200');};
+void() boss_missile21 =[ $attack21, boss_missile22 ] {boss_face();};
+void() boss_missile22 =[ $attack22, boss_missile23 ] {boss_face();};
+void() boss_missile23 =[ $attack23, boss_missile1 ] {boss_face();};
+
+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_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_missile1 ] {};
+
+void() boss_shockc1 =[ $shockc1, boss_shockc2 ] {};
+void() boss_shockc2 =[ $shockc2, boss_shockc3 ] {};
+void() boss_shockc3 =[ $shockc3, boss_shockc4 ] {};
+void() boss_shockc4 =[ $shockc4, boss_shockc5 ] {};
+void() boss_shockc5 =[ $shockc5, boss_shockc6 ] {};
+void() boss_shockc6 =[ $shockc6, boss_shockc7 ] {};
+void() boss_shockc7 =[ $shockc7, boss_shockc8 ] {};
+void() boss_shockc8 =[ $shockc8, boss_shockc9 ] {};
+void() boss_shockc9 =[ $shockc9, boss_shockc10 ] {};
+void() boss_shockc10 =[ $shockc10, boss_death1 ] {};
+
+void() boss_death1 = [$death1, boss_death2] {
+sound (self, CHAN_VOICE, "boss1/death.wav", 1, ATTN_NORM);
+};
+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 (self, CHAN_BODY, "boss1/out1.wav", 1, ATTN_NORM);
+ WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteByte (MSG_BROADCAST, TE_LAVASPLASH);
+ WriteCoord (MSG_BROADCAST, self.origin_x);
+ WriteCoord (MSG_BROADCAST, self.origin_y);
+ WriteCoord (MSG_BROADCAST, self.origin_z);
+};
+
+void() boss_death10 = [$death9, boss_death10]
+{
+ killed_monsters = killed_monsters + 1;
+ WriteByte (MSG_ALL, SVC_KILLEDMONSTER); // FIXME: reliable broadcast
+ SUB_UseTargets ();
+ remove (self);
+};
+
+void(vector p) boss_missile =
+{
+ local vector offang;
+ local vector org, vec, d;
+ local float t;
+
+ offang = vectoangles (self.enemy.origin - self.origin);
+ makevectors (offang);
+
+ 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(self.enemy.origin - org) / 300;
+ vec = self.enemy.velocity;
+ vec_z = 0;
+ d = self.enemy.origin + t * vec;
+ }
+ else
+ {
+ d = self.enemy.origin;
+ }
+
+ vec = normalize (d - org);
+
+ launch_spike (org, vec);
+ setmodel (newmis, "progs/lavaball.mdl");
+ newmis.avelocity = '200 100 300';
+ setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);
+ newmis.velocity = vec*300;
+ newmis.touch = T_MissileTouch; // rocket explosion
+ sound (self, CHAN_WEAPON, "boss1/throw.wav", 1, ATTN_NORM);
+
+// check for dead enemy
+ if (self.enemy.health <= 0)
+ boss_idle1 ();
+};
+
+
+void() boss_awake =
+{
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+ self.takedamage = DAMAGE_NO;
+
+ setmodel (self, "progs/boss.mdl");
+ setsize (self, '-128 -128 -24', '128 128 256');
+
+ if (skill == 0)
+ self.health = 1;
+ else
+ self.health = 3;
+
+ self.enemy = activator;
+
+ WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteByte (MSG_BROADCAST, TE_LAVASPLASH);
+ WriteCoord (MSG_BROADCAST, self.origin_x);
+ WriteCoord (MSG_BROADCAST, self.origin_y);
+ WriteCoord (MSG_BROADCAST, self.origin_z);
+
+ self.yaw_speed = 20;
+ boss_rise1 ();
+};
+
+
+/*QUAKED monster_boss (1 0 0) (-128 -128 -24) (128 128 256)
+*/
+void() monster_boss =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+ precache_model ("progs/boss.mdl");
+ precache_model ("progs/lavaball.mdl");
+
+ precache_sound ("weapons/rocket1i.wav");
+ precache_sound ("boss1/out1.wav");
+ precache_sound ("boss1/sight1.wav");
+ precache_sound ("misc/power.wav");
+ precache_sound ("boss1/throw.wav");
+ precache_sound ("boss1/pain.wav");
+ precache_sound ("boss1/death.wav");
+
+ total_monsters = total_monsters + 1;
+
+ self.use = boss_awake;
+};
+
+//===========================================================================
+
+entity le1, le2;
+float lightning_end;
+
+void() lightning_fire =
+{
+ local vector p1, p2;
+
+ if (time >= lightning_end)
+ { // done here, put the terminals back up
+ self = le1;
+ door_go_down ();
+ self = 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);
+};
+
+void() lightning_use =
+{
+ 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 != STATE_TOP && le1.state != STATE_BOTTOM)
+ || (le2.state != STATE_TOP && le2.state != STATE_BOTTOM)
+ || (le1.state != le2.state) )
+ {
+// 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
+ self = find (world, classname, "monster_boss");
+ if (!self)
+ return;
+ self.enemy = activator;
+ if (le1.state == STATE_TOP && self.health > 0)
+ {
+ sound (self, CHAN_VOICE, "boss1/pain.wav", 1, ATTN_NORM);
+ self.health = self.health - 1;
+ if (self.health >= 2)
+ boss_shocka1();
+ else if (self.health == 1)
+ boss_shockb1();
+ else if (self.health == 0)
+ boss_shockc1();
+ }
+};
+
+
+/*QUAKED event_lightning (0 1 1) (-16 -16 -16) (16 16 16)
+Just for boss level.
+*/
+void() event_lightning =
+{
+ self.use = lightning_use;
+};
+
+
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/buttons.qc b/r17/Revamped src/Revamped QC/Primeqc4/buttons.qc
new file mode 100755
index 00000000..695115b0
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/buttons.qc
@@ -0,0 +1,139 @@
+// button and multiple button
+
+void() button_wait;
+void() button_return;
+
+void() button_wait =
+{
+ self.state = STATE_TOP;
+ self.nextthink = self.ltime + self.wait;
+ self.think = button_return;
+ activator = self.enemy;
+ SUB_UseTargets();
+ self.frame = 1; // use alternate textures
+};
+
+void() button_done =
+{
+ self.state = STATE_BOTTOM;
+};
+
+void() button_return =
+{
+ self.state = STATE_DOWN;
+ SUB_CalcMove (self.pos1, self.speed, button_done);
+ self.frame = 0; // use normal textures
+ if (self.health)
+ self.takedamage = DAMAGE_YES; // can be shot again
+};
+
+
+void() button_blocked =
+{ // do nothing, just don't ome all the way back out
+};
+
+
+void() button_fire =
+{
+ if (self.state == STATE_UP || self.state == STATE_TOP)
+ return;
+
+ sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
+
+ self.state = STATE_UP;
+ SUB_CalcMove (self.pos2, self.speed, button_wait);
+};
+
+
+void() button_use =
+{
+ self.enemy = activator;
+ button_fire ();
+};
+
+void() button_touch =
+{
+ if (other.classname != "player")
+ return;
+ self.enemy = other;
+ button_fire ();
+};
+
+void() button_killed =
+{
+ self.enemy = damage_attacker;
+ self.health = self.max_health;
+ self.takedamage = DAMAGE_NO; // wil be reset upon return
+ button_fire ();
+};
+
+
+/*QUAKED func_button (0 .5 .8) ?
+When a button is touched, it moves some distance in the direction of it's angle, triggers all of it's targets, waits some time, then returns to it's original position where it can be triggered again.
+
+"angle" determines the opening direction
+"target" all entities with a matching targetname will be used
+"speed" override the default 40 speed
+"wait" override the default 1 second wait (-1 = never return)
+"lip" override the default 4 pixel lip remaining at end of move
+"health" if set, the button must be killed instead of touched
+"sounds"
+0) steam metal
+1) wooden clunk
+2) metallic click
+3) in-out
+*/
+void() func_button =
+{
+ if (self.sounds == 0)
+ {
+ precache_sound ("buttons/airbut1.wav");
+ self.noise = "buttons/airbut1.wav";
+ }
+ if (self.sounds == 1)
+ {
+ precache_sound ("buttons/switch21.wav");
+ self.noise = "buttons/switch21.wav";
+ }
+ if (self.sounds == 2)
+ {
+ precache_sound ("buttons/switch02.wav");
+ self.noise = "buttons/switch02.wav";
+ }
+ if (self.sounds == 3)
+ {
+ precache_sound ("buttons/switch04.wav");
+ self.noise = "buttons/switch04.wav";
+ }
+
+ SetMovedir ();
+
+ self.movetype = MOVETYPE_PUSH;
+ self.solid = SOLID_BSP;
+ setmodel (self, self.model);
+
+ self.blocked = button_blocked;
+ self.use = button_use;
+
+ if (self.health)
+ {
+ self.max_health = self.health;
+ self.th_die = button_killed;
+ self.takedamage = DAMAGE_YES;
+ }
+ else
+ self.touch = button_touch;
+
+ if (!self.speed)
+ self.speed = 40;
+ if (!self.wait)
+ self.wait = 1;
+ if (!self.lip)
+ self.lip = 4;
+
+ self.state = STATE_BOTTOM;
+
+ self.pos1 = self.origin;
+ self.pos2 = self.pos1 + self.movedir*(fabs(self.movedir*self.size) - self.lip);
+};
+
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/ccam.qc b/r17/Revamped src/Revamped QC/Primeqc4/ccam.qc
new file mode 100755
index 00000000..b85cfde0
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/ccam.qc
@@ -0,0 +1,83 @@
+void () CCam;
+
+ void () CCamChasePlayer =
+ {
+ makevectors (self.v_angle);
+ traceline ((self.origin + self.view_ofs),((((self.origin + self.view_ofs)
+ + (v_forward * self.camview_z)) + (v_up * self.camview_x)) + (v_right * self.camview_y)),FALSE,self);
+ setorigin (self.trigger_field,trace_endpos);
+ WriteByte (MSG_ONE,5);
+ WriteEntity (MSG_ONE,self.trigger_field);
+ self.weaponmodel = "";
+ };
+
+ void () CCam =
+ {
+ local entity camera;
+ local entity spot;
+
+ if (self.health <= BROKENITEMS)
+ return;
+ if (self.aflag == FALSE)
+ {
+ self.cam = 1;
+ self.aflag = TRUE;
+ camera = spawn ();
+ spot = spawn ();
+ self.trigger_field = camera;
+ camera.classname = "camera";
+ camera.movetype = MOVETYPE_FLY;
+ camera.solid = SOLID_NOT;
+ setmodel (camera,"progs/eyes.mdl");
+ setsize (camera,'0 0 0','0 0 0');
+ makevectors (self.v_angle);
+ traceline ((self.origin + self.view_ofs),(((self.origin + self.view_ofs)
+ + (v_forward * -64.000))),FALSE,self);
+ self.camview = '0 0 -64'; // added
+ setorigin (camera,trace_endpos);
+ camera.angles = self.angles;
+ self.weaponmodel = "";
+ msg_entity = self;
+ WriteByte (MSG_ONE,5);
+ WriteEntity (MSG_ONE,camera);
+ WriteByte (MSG_ONE,10.000);
+ WriteAngle (MSG_ONE,camera.angles_x);
+ WriteAngle (MSG_ONE,camera.angles_y);
+ WriteAngle (MSG_ONE,camera.angles_z);
+ self.avelocity = '300 300 300';
+ self.currentammo = self.mbombs;
+ self.boostlives = 1;
+ self.mbombs = 3;
+ self.mball = 1;
+ self.view_ofs = '0 0 8';
+ setsize (self, '-12 -12 -40', '12 12 7');
+ }
+ else
+ {
+ //if (self.laid == LAYED)
+ //return;
+ self.cam = 0;
+ self.aflag = FALSE;
+ msg_entity = self;
+ WriteByte (MSG_ONE,5);
+ WriteEntity (MSG_ONE,self);
+ WriteByte (MSG_ONE,10);
+ WriteAngle (MSG_ONE,self.angles_x);
+ WriteAngle (MSG_ONE,self.angles_y);
+ WriteAngle (MSG_ONE,self.angles_z);
+ remove (self.trigger_field);
+ if (self.health <= BROKENITEMS) //For the Suit charging.(25 health)
+ {}
+ else
+ {
+ //self.weapon = IT_BLASTER;
+ W_SetCurrentAmmo ();
+ self.origin = self.origin + v_up * 30; //Solves the Spawning in the Ground Problem
+ }
+ self.mball = 0;
+ self.view_ofs = '0 0 22';
+ setsize (self, '-16 -16 -24', '16 16 32');
+ self.weapon = IT_BLASTER;
+ W_SetCurrentAmmo ();
+ }
+ }
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/client.qc b/r17/Revamped src/Revamped QC/Primeqc4/client.qc
new file mode 100755
index 00000000..7cb4a637
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/client.qc
@@ -0,0 +1,1510 @@
+
+// prototypes
+void () W_WeaponFrame;
+void() W_SetCurrentAmmo;
+void() player_pain;
+void() player_stand1;
+void (vector org) spawn_tfog;
+void (vector org, entity death_owner) spawn_tdeath;
+
+float modelindex_eyes, modelindex_mball, modelindex_player;
+
+/*
+=============================================================================
+
+ LEVEL CHANGING / INTERMISSION
+
+=============================================================================
+*/
+
+float intermission_running;
+float intermission_exittime;
+
+/*QUAKED info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16)
+This is the camera point for the intermission.
+Use mangle instead of angle, so you can set pitch or roll as well as yaw. 'pitch roll yaw'
+*/
+void() info_intermission =
+{
+};
+
+
+
+void() SetChangeParms =
+{
+ if (self.health <= 0)
+ {
+ SetNewParms ();
+ return;
+ }
+
+// remove items
+ self.items = self.items - (self.items &
+ (IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD) );
+
+// cap super health
+ if (self.health > 100)
+ self.health = 100;
+ if (self.health < 50)
+ self.health = 50;
+ parm1 = self.items;
+ parm2 = self.health;
+ parm3 = self.armorvalue;
+ if (self.ammo_shells < 25)
+ parm4 = 25;
+ else
+ parm4 = self.ammo_blaster;
+ parm5 = self.ammo_sniper;
+ parm6 = self.ammo_rockets;
+ parm7 = self.ammo_nails;
+ parm8 = self.weapon;
+ parm9 = self.armortype * 100;
+ parm10 = self.energy;
+};
+
+void() SetNewParms =
+{
+ parm1 = IT_BLASTER | IT_MORPHBALL;
+ parm2 = 99;
+ parm3 = 0;
+ parm4 = 100;
+ parm5 = 1;
+ parm6 = 0;
+ parm7 = 0;
+ parm8 = 1;
+ parm9 = 0;
+ if (deathmatch)
+ parm10 = 1;
+ else
+ parm10 = 0;
+};
+
+void() DecodeLevelParms =
+{
+ if (serverflags)
+ {
+ if (world.model == "maps/start.bsp")
+ SetNewParms (); // take away all stuff on starting new episode
+ }
+
+ self.items = parm1;
+ self.health = parm2;
+ self.armorvalue = parm3;
+ self.ammo_blaster = parm4;
+ self.ammo_sniper = parm5;
+ self.ammo_rockets = parm6;
+ self.ammo_nails = parm7;
+ self.weapon = parm8;
+ self.armortype = parm9 * 0.01;
+ self.energy = parm10;
+};
+
+/*
+============
+FindIntermission
+
+Returns the entity to view from
+============
+*/
+entity() FindIntermission =
+{
+ local entity spot;
+ local float cyc;
+
+// look for info_intermission first
+ spot = find (world, classname, "info_intermission");
+ if (spot)
+ { // pick a random one
+ cyc = random() * 4;
+ while (cyc > 1)
+ {
+ spot = find (spot, classname, "info_intermission");
+ if (!spot)
+ spot = find (spot, classname, "info_intermission");
+ cyc = cyc - 1;
+ }
+ return spot;
+ }
+
+// then look for the start position
+ spot = find (world, classname, "info_player_start");
+ if (spot)
+ return spot;
+
+// testinfo_player_start is only found in regioned levels
+ spot = find (world, classname, "testplayerstart");
+ if (spot)
+ return spot;
+
+ objerror ("FindIntermission: no spot");
+};
+
+
+string nextmap;
+void() GotoNextMap =
+{
+ if (cvar("samelevel")) // if samelevel is set, stay on same level
+ changelevel (mapname);
+ else
+ changelevel (nextmap);
+};
+
+
+void() ExitIntermission =
+{
+// skip any text in deathmatch
+ if (deathmatch)
+ {
+ GotoNextMap ();
+ return;
+ }
+
+ intermission_exittime = time + 1;
+ intermission_running = intermission_running + 1;
+
+//
+// run some text if at the end of an episode
+//
+ if (intermission_running == 2)
+ {
+ if (world.model == "maps/e1m7.bsp")
+ {
+ WriteByte (MSG_ALL, SVC_CDTRACK);
+ WriteByte (MSG_ALL, 2);
+ WriteByte (MSG_ALL, 3);
+ if (!cvar("registered"))
+ {
+ WriteByte (MSG_ALL, SVC_FINALE);
+ WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task in the other three\nhaunted lands of Quake. Or are you? If\nyou don't register Quake, you'll never\nknow what awaits you in the Realm of\nBlack Magic, the Netherworld, and the\nElder World!");
+ }
+ else
+ {
+ WriteByte (MSG_ALL, SVC_FINALE);
+ WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task. A Rune of magic\npower lies at the end of each haunted\nland of Quake. Go forth, seek the\ntotality of the four Runes!");
+ }
+ return;
+ }
+ else if (world.model == "maps/e2m6.bsp")
+ {
+ WriteByte (MSG_ALL, SVC_CDTRACK);
+ WriteByte (MSG_ALL, 2);
+ WriteByte (MSG_ALL, 3);
+
+ WriteByte (MSG_ALL, SVC_FINALE);
+ WriteString (MSG_ALL, "The Rune of Black Magic throbs evilly in\nyour hand and whispers dark thoughts\ninto your brain. You learn the inmost\nlore of the Hell-Mother; Shub-Niggurath!\nYou now know that she is behind all the\nterrible plotting which has led to so\nmuch death and horror. But she is not\ninviolate! Armed with this Rune, you\nrealize that once all four Runes are\ncombined, the gate to Shub-Niggurath's\nPit will open, and you can face the\nWitch-Goddess herself in her frightful\notherworld cathedral.");
+ return;
+ }
+ else if (world.model == "maps/e3m6.bsp")
+ {
+ WriteByte (MSG_ALL, SVC_CDTRACK);
+ WriteByte (MSG_ALL, 2);
+ WriteByte (MSG_ALL, 3);
+
+ WriteByte (MSG_ALL, SVC_FINALE);
+ WriteString (MSG_ALL, "The charred viscera of diabolic horrors\nbubble viscously as you seize the Rune\nof Hell Magic. Its heat scorches your\nhand, and its terrible secrets blight\nyour mind. Gathering the shreds of your\ncourage, you shake the devil's shackles\nfrom your soul, and become ever more\nhard and determined to destroy the\nhideous creatures whose mere existence\nthreatens the souls and psyches of all\nthe population of Earth.");
+ return;
+ }
+ else if (world.model == "maps/e4m7.bsp")
+ {
+ WriteByte (MSG_ALL, SVC_CDTRACK);
+ WriteByte (MSG_ALL, 2);
+ WriteByte (MSG_ALL, 3);
+
+ WriteByte (MSG_ALL, SVC_FINALE);
+ WriteString (MSG_ALL, "Despite the awful might of the Elder\nWorld, you have achieved the Rune of\nElder Magic, capstone of all types of\narcane wisdom. Beyond good and evil,\nbeyond life and death, the Rune\npulsates, heavy with import. Patient and\npotent, the Elder Being Shub-Niggurath\nweaves her dire plans to clear off all\nlife from the Earth, and bring her own\nfoul offspring to our world! For all the\ndwellers in these nightmare dimensions\nare her descendants! Once all Runes of\nmagic power are united, the energy\nbehind them will blast open the Gateway\nto Shub-Niggurath, and you can travel\nthere to foil the Hell-Mother's plots\nin person.");
+ return;
+ }
+
+ GotoNextMap();
+ }
+
+ if (intermission_running == 3)
+ {
+ if (!cvar("registered"))
+ { // shareware episode has been completed, go to sell screen
+ WriteByte (MSG_ALL, SVC_SELLSCREEN);
+ return;
+ }
+
+ if ( (serverflags&15) == 15)
+ {
+ WriteByte (MSG_ALL, SVC_FINALE);
+ WriteString (MSG_ALL, "Now, you have all four Runes. You sense\ntremendous invisible forces moving to\nunseal ancient barriers. Shub-Niggurath\nhad hoped to use the Runes Herself to\nclear off the Earth, but now instead,\nyou will use them to enter her home and\nconfront her as an avatar of avenging\nEarth-life. If you defeat her, you will\nbe remembered forever as the savior of\nthe planet. If she conquers, it will be\nas if you had never been born.");
+ return;
+ }
+
+ }
+
+ GotoNextMap();
+};
+
+/*
+============
+IntermissionThink
+
+When the player presses attack or jump, change to the next level
+============
+*/
+void() IntermissionThink =
+{
+ if (time < intermission_exittime)
+ return;
+
+ if (!self.button0 && !self.button1 && !self.button2)
+ return;
+
+ ExitIntermission ();
+};
+
+void() execute_changelevel =
+{
+ local entity pos;
+
+ intermission_running = 1;
+
+// enforce a wait time before allowing changelevel
+ if (deathmatch)
+ intermission_exittime = time + 5;
+ else
+ intermission_exittime = time + 2;
+
+ WriteByte (MSG_ALL, SVC_CDTRACK);
+ WriteByte (MSG_ALL, 3);
+ WriteByte (MSG_ALL, 3);
+
+ pos = FindIntermission ();
+
+ other = find (world, classname, "player");
+ while (other != world)
+ {
+ other.view_ofs = '0 0 0';
+ other.angles = other.v_angle = pos.mangle;
+ other.fixangle = TRUE; // turn this way immediately
+ other.nextthink = time + 0.5;
+ other.takedamage = DAMAGE_NO;
+ other.solid = SOLID_NOT;
+ other.movetype = MOVETYPE_NONE;
+ other.modelindex = 0;
+ setorigin (other, pos.origin);
+ other = find (other, classname, "player");
+ }
+
+ WriteByte (MSG_ALL, SVC_INTERMISSION);
+};
+
+
+void() changelevel_touch =
+{
+
+ if (other.classname != "player")
+ return;
+
+ if ((cvar("noexit") == 1) || ((cvar("noexit") == 2) && (mapname != "start")))
+ {
+ T_Damage (other, self, self, 50000);
+ return;
+ }
+
+ if (coop || deathmatch)
+ {
+ bprint (other.netname);
+ bprint (" exited the level\n");
+ }
+
+ nextmap = self.map;
+
+ SUB_UseTargets ();
+
+ if ( (self.spawnflags & 1) && (deathmatch == 0) )
+ { // NO_INTERMISSION
+ GotoNextMap();
+ return;
+ }
+
+ self.touch = SUB_Null;
+
+// we can't move people right now, because touch functions are called
+// in the middle of C movement code, so set a think time to do it
+ self.think = execute_changelevel;
+ self.nextthink = time + 0.1;
+};
+
+/*QUAKED trigger_changelevel (0.5 0.5 0.5) ? NO_INTERMISSION
+When the player touches this, he gets sent to the map listed in the "map" variable. Unless the NO_INTERMISSION flag is set, the view will go to the info_intermission spot and display stats.
+*/
+void() trigger_changelevel =
+{
+ if (!self.map)
+ objerror ("chagnelevel trigger doesn't have map");
+
+ InitTrigger ();
+ self.touch = changelevel_touch;
+};
+
+
+/*
+=============================================================================
+
+ PLAYER GAME EDGE FUNCTIONS
+
+=============================================================================
+*/
+
+void() set_suicide_frame;
+
+// called by ClientKill and DeadThink
+void() respawn =
+{
+ if (coop)
+ {
+ // get the spawn parms as they were at level start
+ setspawnparms (self);
+ // respawn
+ PutClientInServer ();
+ }
+ else if (deathmatch)
+ {
+ // set default spawn parms
+ SetNewParms ();
+ // respawn
+ PutClientInServer ();
+ }
+ else
+ { // restart the entire server
+ localcmd ("restart\n");
+ }
+};
+
+
+/*
+============
+ClientKill
+
+Player entered the suicide command
+============
+*/
+void() ClientKill =
+{
+ bprint (self.netname);
+ bprint (" suicides\n");
+ set_suicide_frame ();
+ self.modelindex = modelindex_player;
+ self.frags = self.frags - 2; // extra penalty
+ respawn ();
+};
+
+float(vector v) CheckSpawnPoint =
+{
+ return FALSE;
+};
+
+/*
+============
+SelectSpawnPoint
+
+Returns the entity to spawn at
+============
+*/
+entity() SelectSpawnPoint =
+{
+ local entity spot;
+ local entity thing;
+ local float pcount;
+
+// testinfo_player_start is only found in regioned levels
+ spot = find (world, classname, "testplayerstart");
+ if (spot)
+ return spot;
+
+// choose a info_player_deathmatch point
+ if (coop)
+ {
+ lastspawn = find(lastspawn, classname, "info_player_coop");
+ if (lastspawn == world)
+ lastspawn = find (lastspawn, classname, "info_player_start");
+ if (lastspawn != world)
+ return lastspawn;
+ }
+ else if (deathmatch)
+ {
+ spot = lastspawn;
+ while (1)
+ {
+ spot = find(spot, classname, "info_player_deathmatch");
+ if (spot != world)
+ {
+ if (spot == lastspawn)
+ return lastspawn;
+ pcount = 0;
+ thing = findradius(spot.origin, 32);
+ while(thing)
+ {
+ if (thing.classname == "player")
+ pcount = pcount + 1;
+ thing = thing.chain;
+ }
+ if (pcount == 0)
+ {
+ lastspawn = spot;
+ return spot;
+ }
+ }
+ }
+ }
+
+ if (serverflags)
+ { // return with a rune to start
+ spot = find (world, classname, "info_player_start2");
+ if (spot)
+ return spot;
+ }
+
+ spot = find (world, classname, "info_player_start");
+ if (!spot)
+ error ("PutClientInServer: no info_player_start on level");
+
+ return spot;
+};
+
+/*
+===========
+PutClientInServer
+
+called each time a player is spawned
+============
+*/
+void() DecodeLevelParms;
+void() PlayerDie;
+
+
+void() PutClientInServer =
+{
+
+ local entity spot;
+
+ spot = SelectSpawnPoint ();
+ self.currentammo = self.ammo_rockets = 10;
+ self.classname = "player";
+ self.health = self.max_health;
+ self.takedamage = DAMAGE_AIM;
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_WALK;
+ self.show_hostile = 0;
+ if (!deathmatch)
+ {
+ if (self.energy == 0)
+ self.max_health = 99;
+ if (self.energy == 1)
+ self.max_health = 199;
+ if (self.energy == 2)
+ self.max_health = 299;
+ if (self.energy == 3)
+ self.max_health = 399;
+ if (self.energy == 4)
+ self.max_health = 499;
+ if (self.energy == 5)
+ self.max_health = 599;
+ if (self.energy == 6)
+ self.max_health = 699;
+ if (self.energy == 7)
+ self.max_health = 799;
+ if (self.energy == 8)
+ self.max_health = 899;
+ if (self.energy == 9)
+ self.max_health = 999;
+ }
+ else
+ self.max_health = 199;
+ self.flags = FL_CLIENT;
+ self.air_finished = time + 12;
+ self.dmg = 2; // initial water damage
+ self.super_damage_finished = 0;
+ self.radsuit_finished = 0;
+ self.invisible_finished = 0;
+ self.invincible_finished = 0;
+ self.effects = 0;
+ self.invincible_time = 0;
+ self.doublejump_time = 0;
+ self.doublejump_lives = 0;
+ self.mballset = 0;
+ if (self.weapon == IT_MORPHBALL)
+ self.weapon = IT_BLASTER;
+
+ DecodeLevelParms ();
+
+ W_SetCurrentAmmo ();
+
+ Set_FOV (FOV_DEFAULT);
+ self.pfov = FOV_DEFAULT;
+
+ self.attack_finished = time;
+ self.th_pain = player_pain;
+ self.th_die = PlayerDie;
+
+ self.deadflag = DEAD_NO;
+// paustime is set by teleporters to keep the player from moving a while
+ self.pausetime = 0;
+
+// spot = SelectSpawnPoint ();
+
+ self.origin = spot.origin + '0 0 1';
+ self.angles = spot.angles;
+ self.fixangle = TRUE; // turn this way immediately
+
+ stuffcmd (self, "chase_active 0");
+ stuffcmd (self, "cl_mball 0");
+// oh, this is a hack!
+ setmodel (self, "progs/eyes.mdl");
+ modelindex_eyes = self.modelindex;
+
+ setmodel (self, "progs/player.mdl");
+ modelindex_player = self.modelindex;
+
+ setmodel (self,"progs/mball.mdl");
+ modelindex_mball = self.modelindex;
+
+ setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
+
+ self.view_ofs = '0 0 22';
+
+ player_stand1 ();
+
+
+ if (deathmatch || coop)
+ {
+ makevectors(self.angles);
+ spawn_tfog (self.origin + v_forward*20);
+ }
+ //self.doublejump_time = 0;
+ //self.doublejump_lives = 0;
+ spawn_tdeath (self.origin, self);
+};
+
+
+/*
+=============================================================================
+
+ QUAKED FUNCTIONS
+
+=============================================================================
+*/
+
+
+/*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24)
+The normal starting point for a level.
+*/
+void() info_player_start =
+{
+};
+
+
+/*QUAKED info_player_start2 (1 0 0) (-16 -16 -24) (16 16 24)
+Only used on start map for the return point from an episode.
+*/
+void() info_player_start2 =
+{
+};
+
+
+/*
+saved out by quaked in region mode
+*/
+void() testplayerstart =
+{
+};
+
+/*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24)
+potential spawning position for deathmatch games
+*/
+void() info_player_deathmatch =
+{
+};
+
+/*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 24)
+potential spawning position for coop games
+*/
+void() info_player_coop =
+{
+};
+
+/*
+===============================================================================
+
+RULES
+
+===============================================================================
+*/
+
+/*
+go to the next level for deathmatch
+only called if a time or frag limit has expired
+*/
+void() NextLevel =
+{
+ local entity o;
+
+ if (mapname == "start")
+ {
+ if (!cvar("registered"))
+ {
+ mapname = "e1m1";
+ }
+ else if (!(serverflags & 1))
+ {
+ mapname = "e1m1";
+ serverflags = serverflags | 1;
+ }
+ else if (!(serverflags & 2))
+ {
+ mapname = "e2m1";
+ serverflags = serverflags | 2;
+ }
+ else if (!(serverflags & 4))
+ {
+ mapname = "e3m1";
+ serverflags = serverflags | 4;
+ }
+ else if (!(serverflags & 8))
+ {
+ mapname = "e4m1";
+ serverflags = serverflags - 7;
+ }
+
+ o = spawn();
+ o.map = mapname;
+ }
+ else
+ {
+ // find a trigger changelevel
+ o = find(world, classname, "trigger_changelevel");
+
+ // go back to start if no trigger_changelevel
+ if (!o)
+ {
+ mapname = "start";
+ o = spawn();
+ o.map = mapname;
+ }
+ }
+
+ nextmap = o.map;
+ gameover = TRUE;
+
+ if (o.nextthink < time)
+ {
+ o.think = execute_changelevel;
+ o.nextthink = time + 0.1;
+ }
+};
+
+/*
+============
+CheckRules
+
+Exit deathmatch games upon conditions
+============
+*/
+void() CheckRules =
+{
+ local float timelimit;
+ local float fraglimit;
+
+ if (gameover) // someone else quit the game already
+ return;
+
+ timelimit = cvar("timelimit") * 60;
+ fraglimit = cvar("fraglimit");
+
+ if (timelimit && time >= timelimit)
+ {
+ NextLevel ();
+ return;
+ }
+
+ if (fraglimit && self.frags >= fraglimit)
+ {
+ NextLevel ();
+ return;
+ }
+};
+
+//============================================================================
+
+void() PlayerDeathThink =
+{
+ local float forward;
+
+ if ((self.flags & FL_ONGROUND))
+ {
+ forward = vlen (self.velocity);
+ forward = forward - 20;
+ if (forward <= 0)
+ self.velocity = '0 0 0';
+ else
+ self.velocity = forward * normalize(self.velocity);
+ }
+
+// wait for all buttons released
+ if (self.deadflag == DEAD_DEAD)
+ {
+ if (self.button2 || self.button1 || self.button0)
+ return;
+ self.deadflag = DEAD_RESPAWNABLE;
+ return;
+ }
+
+// wait for any button down
+ if (!self.button2 && !self.button1 && !self.button0)
+ return;
+
+ self.button0 = 0;
+ self.button1 = 0;
+ self.button2 = 0;
+ respawn();
+};
+
+// modified PlayerJump:
+//Thanks alot for the Double Jump code Sajt! -Mexicouger
+void() PlayerJump =
+{
+
+ if (self.flags & FL_WATERJUMP)
+ return;
+
+ if (self.waterlevel >= 2)
+ {
+ if (self.watertype == CONTENT_WATER)
+ self.velocity_z = 100;
+ else if (self.watertype == CONTENT_SLIME)
+ self.velocity_z = 80;
+ else
+ self.velocity_z = 50;
+
+// play swiming sound
+ if (self.swim_flag < time)
+ {
+ self.swim_flag = time + 1;
+ if (random() < 0.5)
+ sound (self, CHAN_BODY, "misc/water1.wav", 1, ATTN_NORM);
+ else
+ sound (self, CHAN_BODY, "misc/water2.wav", 1, ATTN_NORM);
+ }
+
+ return;
+ }
+
+ if ( !(self.flags & FL_JUMPRELEASED) )
+ return; // don't pogo stick
+
+ if (self.flags & FL_ONGROUND)
+ {
+ if (self.health <= 20) //Your suit is malfunctioned, has to recharge
+ self.doublejump_lives = 0;
+ else
+ self.doublejump_lives = DOUBLEJUMP_EXTRAJUMPS;
+ self.flags = self.flags - FL_ONGROUND; // don't stairwalk
+ }
+ else if (self.doublejump_lives > 0 && time >= self.doublejump_time && self.velocity_z > -100)
+ {
+ self.doublejump_lives = self.doublejump_lives - 1;
+ }
+ else
+ {
+ // can't jump
+ return;
+ }
+
+ self.doublejump_time = time + DOUBLEJUMP_TIMER;
+
+ self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
+
+ self.button2 = 0;
+// player jumping sound
+ if (self.weapon == IT_MORPHBALL)
+ return;
+ sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
+ self.velocity_z = 350;
+};
+
+// no changes to PlayerPreThink
+
+
+/*
+===========
+WaterMove
+
+============
+*/
+.float dmgtime;
+
+void() WaterMove =
+{
+//dprint (ftos(self.waterlevel));
+ if (self.movetype == MOVETYPE_NOCLIP)
+ return;
+ if (self.health < 0)
+ return;
+
+ if (!self.waterlevel)
+ {
+ if (self.flags & FL_INWATER)
+ {
+ // play leave water sound
+ sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
+ self.flags = self.flags - FL_INWATER;
+ }
+ return;
+ }
+
+ if (self.watertype == CONTENT_LAVA)
+ { // do damage
+ if (self.dmgtime < time && self.radsuit_finished < time)
+ {
+ self.dmgtime = time + 0.25;
+ T_Damage (self, world, world, 1+self.waterlevel);
+ }
+ }
+ else if (self.watertype == CONTENT_SLIME)
+ { // do damage
+ if (self.dmgtime < time && self.radsuit_finished < time)
+ {
+ self.dmgtime = time + 1;
+ T_Damage (self, world, world, 4*self.waterlevel);
+ }
+ }
+
+ if ( !(self.flags & FL_INWATER) )
+ {
+
+// player enter water sound
+
+ if (self.watertype == CONTENT_LAVA)
+ sound (self, CHAN_BODY, "player/inlava.wav", 1, ATTN_NORM);
+ if (self.watertype == CONTENT_WATER)
+ sound (self, CHAN_BODY, "player/inh2o.wav", 1, ATTN_NORM);
+ if (self.watertype == CONTENT_SLIME)
+ sound (self, CHAN_BODY, "player/slimbrn2.wav", 1, ATTN_NORM);
+
+ self.flags = self.flags + FL_INWATER;
+ self.dmgtime = 0;
+ }
+
+ if (! (self.flags & FL_WATERJUMP) )
+ self.velocity = self.velocity - 0.8*self.waterlevel*frametime*self.velocity;
+};
+
+void() CheckWaterJump =
+{
+ local vector start, end;
+
+// check for a jump-out-of-water
+ makevectors (self.angles);
+ start = self.origin;
+ start_z = start_z + 8;
+ v_forward_z = 0;
+ normalize(v_forward);
+ end = start + v_forward*24;
+ traceline (start, end, TRUE, self);
+ if (trace_fraction < 1)
+ { // solid at waist
+ start_z = start_z + self.maxs_z - 8;
+ end = start + v_forward*24;
+ self.movedir = trace_plane_normal * -50;
+ traceline (start, end, TRUE, self);
+ if (trace_fraction == 1)
+ { // open at eye level
+ self.flags = self.flags | FL_WATERJUMP;
+ self.velocity_z = 225;
+ self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
+ self.teleport_time = time + 2; // safety net
+ return;
+ }
+ }
+};
+
+/*
+================
+PlayerPreThink
+
+Called every frame before physics are run
+================
+*/
+void() PlayerPreThink =
+{
+
+if (BotPreFrame()) // FrikBot
+ return;
+
+ if (intermission_running)
+ {
+ IntermissionThink (); // otherwise a button could be missed between
+ return; // the think tics
+ }
+
+ if (self.view_ofs == '0 0 0')
+ return; // intermission or finale
+
+
+ makevectors (self.v_angle); // is this still used
+
+ CheckRules ();
+ WaterMove ();
+ if (self.boostlives != 1)
+ {
+ if (self.boostlives >= 1)
+ return;
+ self.boostlives += 0.01;
+ }
+
+ if (self.waterlevel == 2)
+ CheckWaterJump ();
+
+ if (self.health < BROKENITEMS)
+ {
+ if (self.weapon == IT_MORPHBALL)
+ {
+ if (self.button0 == TRUE)
+ self.button0 = FALSE;
+ self.mballset = 0;
+ setorigin (self, self.origin + v_up * 20);
+ setsize (self, '-16 -16 -24', '16 16 32');
+ stuffcmd (self, "chase_active 0");
+ self.weapon = IT_BLASTER;
+ }
+ }
+
+
+ if (self.health < BROKENITEMS)
+ {
+ if (self.health > CHARGEHEALTH) //Just in case...
+ return;
+ self.health += 0.01;
+ }
+ if (self.deadflag >= DEAD_DEAD)
+ {
+ PlayerDeathThink ();
+ return;
+ }
+
+ if (self.deadflag == DEAD_DYING)
+ return; // dying, so do nothing
+
+ if (self.button2)
+ {
+ PlayerJump ();
+ }
+ else
+ self.flags = self.flags | FL_JUMPRELEASED;
+
+// teleporters can force a non-moving pause time
+ if (time < self.pausetime)
+ self.velocity = '0 0 0';
+
+ if(time > self.attack_finished && self.currentammo == 0 && self.weapon != IT_MORPHBALL)
+ {
+ //self.weapon = W_BestWeapon ();
+ W_SetCurrentAmmo ();
+ }
+};
+
+
+/*
+================
+CheckPowerups
+
+Check for turning off powerups
+================
+*/
+void() CheckPowerups =
+{
+ if (self.health <= 0)
+ return;
+
+// invisibility
+ if (self.invisible_finished)
+ {
+// sound and screen flash when items starts to run out
+ if (self.invisible_sound < time)
+ {
+ sound (self, CHAN_AUTO, "items/inv3.wav", 0.5, ATTN_IDLE);
+ self.invisible_sound = time + ((random() * 3) + 1);
+ }
+
+
+ if (self.invisible_finished < time + 3)
+ {
+ if (self.invisible_time == 1)
+ {
+ sprint (self, "Ring of Shadows magic is fading\n");
+ stuffcmd (self, "bf\n");
+ sound (self, CHAN_AUTO, "items/inv2.wav", 1, ATTN_NORM);
+ self.invisible_time = time + 1;
+ }
+
+ if (self.invisible_time < time)
+ {
+ self.invisible_time = time + 1;
+ stuffcmd (self, "bf\n");
+ }
+ }
+
+ if (self.invisible_finished < time)
+ { // just stopped
+ self.items = self.items - IT_INVISIBILITY;
+ self.invisible_finished = 0;
+ self.invisible_time = 0;
+ }
+
+ // use the eyes
+ self.frame = 0;
+ self.modelindex = modelindex_eyes;
+ }
+ else
+ self.modelindex = modelindex_player; // don't use eyes
+
+// invincibility
+ if (self.invincible_finished)
+ {
+// sound and screen flash when items starts to run out
+ if (self.invincible_finished < time + 3)
+ {
+ if (self.invincible_time == 1)
+ {
+ sprint (self, "Protection is almost burned out\n");
+ stuffcmd (self, "bf\n");
+ sound (self, CHAN_AUTO, "items/protect2.wav", 1, ATTN_NORM);
+ self.invincible_time = time + 1;
+ }
+
+ if (self.invincible_time < time)
+ {
+ self.invincible_time = time + 1;
+ stuffcmd (self, "bf\n");
+ }
+ }
+
+ if (self.invincible_finished < time)
+ { // just stopped
+ self.items = self.items - IT_INVULNERABILITY;
+ self.invincible_time = 0;
+ self.invincible_finished = 0;
+ }
+ if (self.invincible_finished > time)
+ self.effects = self.effects | EF_DIMLIGHT;
+ else
+ self.effects = self.effects - (self.effects & EF_DIMLIGHT);
+ }
+
+// super damage
+ if (self.super_damage_finished)
+ {
+
+// sound and screen flash when items starts to run out
+
+ if (self.super_damage_finished < time + 3)
+ {
+ if (self.super_time == 1)
+ {
+ sprint (self, "Quad Damage is wearing off\n");
+ stuffcmd (self, "bf\n");
+ sound (self, CHAN_AUTO, "items/damage2.wav", 1, ATTN_NORM);
+ self.super_time = time + 1;
+ }
+
+ if (self.super_time < time)
+ {
+ self.super_time = time + 1;
+ stuffcmd (self, "bf\n");
+ }
+ }
+
+ if (self.super_damage_finished < time)
+ { // just stopped
+ self.items = self.items - IT_QUAD;
+ self.super_damage_finished = 0;
+ self.super_time = 0;
+ }
+ if (self.super_damage_finished > time)
+ self.effects = self.effects | EF_DIMLIGHT;
+ else
+ self.effects = self.effects - (self.effects & EF_DIMLIGHT);
+ }
+
+// suit
+ if (self.radsuit_finished)
+ {
+ self.air_finished = time + 12; // don't drown
+
+// sound and screen flash when items starts to run out
+ if (self.radsuit_finished < time + 3)
+ {
+ if (self.rad_time == 1)
+ {
+ sprint (self, "Air supply in Biosuit expiring\n");
+ stuffcmd (self, "bf\n");
+ sound (self, CHAN_AUTO, "items/suit2.wav", 1, ATTN_NORM);
+ self.rad_time = time + 1;
+ }
+
+ if (self.rad_time < time)
+ {
+ self.rad_time = time + 1;
+ stuffcmd (self, "bf\n");
+ }
+ }
+
+ if (self.radsuit_finished < time)
+ { // just stopped
+ self.items = self.items - IT_SUIT;
+ self.rad_time = 0;
+ self.radsuit_finished = 0;
+ }
+ }
+//Morphball --Ghost
+if (self.weapon == IT_MORPHBALL)
+ {
+ self.modelindex = modelindex_mball;
+ }
+};
+
+/*
+================
+PlayerPostThink
+
+Called every frame after physics are run
+================
+*/
+void() PlayerPostThink =
+{
+if (BotPostFrame()) // FrikBot
+ return;
+
+ if (self.view_ofs == '0 0 0')
+ return; // intermission or finale
+ if (self.deadflag)
+ return;
+
+// do weapon stuff
+
+ W_WeaponFrame ();
+
+// check to see if player landed and play landing sound
+ if ((self.jump_flag < -300) && (self.flags & FL_ONGROUND) && (self.health > 0))
+ {
+ if (self.watertype == CONTENT_WATER)
+ sound (self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM);
+ else if (self.jump_flag < -650)
+ {
+ T_Damage (self, world, world, 5);
+ sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
+ self.deathtype = "falling";
+ }
+ else
+ sound (self, CHAN_VOICE, "player/land.wav", 1, ATTN_NORM);
+
+ self.jump_flag = 0;
+ }
+
+ if (!(self.flags & FL_ONGROUND))
+ self.jump_flag = self.velocity_z;
+
+ CheckPowerups ();
+};
+
+
+/*
+===========
+ClientConnect
+
+called when a player connects to a server
+============
+*/
+void() ClientConnect =
+{
+ClientInRankings(); // FrikBot
+
+ bprint (self.netname);
+ bprint (" entered the game\n");
+
+// a client connecting during an intermission can cause problems
+ if (intermission_running)
+ ExitIntermission ();
+};
+
+
+/*
+===========
+ClientDisconnect
+
+called when a player disconnects from a server
+============
+*/
+void() ClientDisconnect =
+{
+ClientDisconnected(); // FrikBot
+
+ if (gameover)
+ return;
+ // if the level end trigger has been activated, just return
+ // since they aren't *really* leaving
+
+ // let everyone else know
+ bprint (self.netname);
+ bprint (" left the game with ");
+ bprint (ftos(self.frags));
+ bprint (" frags\n");
+ sound (self, CHAN_BODY, "player/tornoff2.wav", 1, ATTN_NONE);
+ set_suicide_frame ();
+};
+
+/*
+===========
+ClientObituary
+
+called when a player dies
+============
+*/
+void(entity targ, entity attacker) ClientObituary =
+{
+ local float rnum;
+ local string deathstring, deathstring2;
+ rnum = random();
+
+ if (targ.classname == "player")
+ {
+ if (attacker.classname == "teledeath")
+ {
+ bprint (targ.netname);
+ bprint (" was telefragged by ");
+ bprint (attacker.owner.netname);
+ bprint ("\n");
+
+ attacker.owner.frags = attacker.owner.frags + 1;
+ return;
+ }
+
+ if (attacker.classname == "teledeath2")
+ {
+ bprint ("Satan's power deflects ");
+ bprint (targ.netname);
+ bprint ("'s telefrag\n");
+
+ targ.frags = targ.frags - 1;
+ return;
+ }
+
+ if (attacker.classname == "player")
+ {
+ if (targ == attacker)
+ {
+ // killed self
+ attacker.frags = attacker.frags - 1;
+ bprint (targ.netname);
+
+ if (targ.weapon == 64 && targ.waterlevel > 1)
+ {
+ bprint (" discharges into the water.\n");
+ return;
+ }
+ if (targ.weapon == IT_GRENADE_LAUNCHER)
+ bprint (" tries to put the pin back in\n");
+ else
+ bprint (" becomes bored with life\n");
+ return;
+ }
+ else if ( (teamplay == 2) && (targ.team > 0)&&(targ.team == attacker.team) )
+ {
+ if (rnum < 0.25)
+ deathstring = " mows down a teammate\n";
+ else if (rnum < 0.50)
+ deathstring = " checks his glasses\n";
+ else if (rnum < 0.75)
+ deathstring = " gets a frag for the other team\n";
+ else
+ deathstring = " loses another friend\n";
+ bprint (attacker.netname);
+ bprint (deathstring);
+ attacker.frags = attacker.frags - 1;
+ return;
+ }
+ else
+ {
+ attacker.frags = attacker.frags + 1;
+
+ rnum = attacker.weapon;
+ if (rnum == IT_MORPHBALL)
+ {
+ deathstring = " was ax-murdered by ";
+ deathstring2 = "\n";
+ }
+ if (rnum == IT_BLASTER)
+ {
+ deathstring = " chewed on ";
+ deathstring2 = "'s boomstick\n";
+ }
+ if (rnum == IT_ROCKET)
+ {
+ deathstring = " ate 2 loads of ";
+ deathstring2 = "'s buckshot\n";
+ }
+ if (rnum == IT_SPLASER)
+ {
+ deathstring = " was nailed by ";
+ deathstring2 = "\n";
+ }
+ if (rnum == IT_SNIPER)
+ {
+ deathstring = " was punctured by ";
+ deathstring2 = "\n";
+ }
+ if (rnum == IT_GRENADE_LAUNCHER)
+ {
+ deathstring = " eats ";
+ deathstring2 = "'s pineapple\n";
+ if (targ.health < -40)
+ {
+ deathstring = " was gibbed by ";
+ deathstring2 = "'s grenade\n";
+ }
+ }
+ if (rnum == IT_MAGMA)
+ {
+ deathstring = " rides ";
+ deathstring2 = "'s rocket\n";
+ if (targ.health < -40)
+ {
+ deathstring = " was gibbed by ";
+ deathstring2 = "'s rocket\n" ;
+ }
+ }
+ if (rnum == IT_LIGHTNING)
+ {
+ deathstring = " accepts ";
+ if (attacker.waterlevel > 1)
+ deathstring2 = "'s discharge\n";
+ else
+ deathstring2 = "'s shaft\n";
+ }
+ bprint (targ.netname);
+ bprint (deathstring);
+ bprint (attacker.netname);
+ bprint (deathstring2);
+ }
+ return;
+ }
+ else
+ {
+ targ.frags = targ.frags - 1;
+ bprint (targ.netname);
+
+ // killed by a montser?
+ if (attacker.flags & FL_MONSTER)
+ {
+ if (attacker.classname == "monster_army")
+ bprint (" was shot by a Grunt\n");
+ if (attacker.classname == "monster_demon1")
+ bprint (" was eviscerated by a Fiend\n");
+ if (attacker.classname == "monster_dog")
+ bprint (" was mauled by a Rottweiler\n");
+ if (attacker.classname == "monster_dragon")
+ bprint (" was fried by a Dragon\n");
+ if (attacker.classname == "monster_enforcer")
+ bprint (" was blasted by an Enforcer\n");
+ if (attacker.classname == "monster_fish")
+ bprint (" was fed to the Rotfish\n");
+ if (attacker.classname == "monster_hell_knight")
+ bprint (" was slain by a Death Knight\n");
+ if (attacker.classname == "monster_knight")
+ bprint (" was slashed by a Knight\n");
+ if (attacker.classname == "monster_ogre")
+ bprint (" was destroyed by an Ogre\n");
+ if (attacker.classname == "monster_oldone")
+ bprint (" became one with Shub-Niggurath\n");
+ if (attacker.classname == "monster_shalrath")
+ bprint (" was exploded by a Vore\n");
+ if (attacker.classname == "monster_shambler")
+ bprint (" was smashed by a Shambler\n");
+ if (attacker.classname == "monster_tarbaby")
+ bprint (" was slimed by a Spawn\n");
+ if (attacker.classname == "monster_vomit")
+ bprint (" was vomited on by a Vomitus\n");
+ if (attacker.classname == "monster_wizard")
+ bprint (" was scragged by a Scrag\n");
+ if (attacker.classname == "monster_zombie")
+ bprint (" joins the Zombies\n");
+
+ return;
+ }
+
+ // tricks and traps
+ if (attacker.classname == "explo_box")
+ {
+ bprint (" blew up\n");
+ return;
+ }
+ if (attacker.solid == SOLID_BSP && attacker != world)
+ {
+ bprint (" was squished\n");
+ return;
+ }
+ if (attacker.classname == "trap_shooter" || attacker.classname == "trap_spikeshooter")
+ {
+ bprint (" was spiked\n");
+ return;
+ }
+ if (attacker.classname == "fireball")
+ {
+ bprint (" ate a lavaball\n");
+ return;
+ }
+ if (attacker.classname == "trigger_changelevel")
+ {
+ bprint (" tried to leave\n");
+ return;
+ }
+
+ // in-water deaths
+ rnum = targ.watertype;
+ if (rnum == -3)
+ {
+ if (random() < 0.5)
+ bprint (" sleeps with the fishes\n");
+ else
+ bprint (" sucks it down\n");
+ return;
+ }
+ else if (rnum == -4)
+ {
+ if (random() < 0.5)
+ bprint (" gulped a load of slime\n");
+ else
+ bprint (" can't exist on slime alone\n");
+ return;
+ }
+ else if (rnum == -5)
+ {
+ if (targ.health < -15)
+ {
+ bprint (" burst into flames\n");
+ return;
+ }
+ if (random() < 0.5)
+ bprint (" turned into hot slag\n");
+ else
+ bprint (" visits the Volcano God\n");
+ return;
+ }
+
+ // fell to their death?
+ if (targ.deathtype == "falling")
+ {
+ targ.deathtype = "";
+ bprint (" fell to his death\n");
+ return;
+ }
+
+ // hell if I know; he's just dead!!!
+ bprint (" died\n");
+ }
+ }
+};
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/combat.qc b/r17/Revamped src/Revamped QC/Primeqc4/combat.qc
new file mode 100755
index 00000000..24f6e7cb
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/combat.qc
@@ -0,0 +1,285 @@
+
+void() T_MissileTouch;
+void() info_player_start;
+void(entity targ, entity attacker) ClientObituary;
+
+void() monster_death_use;
+
+//============================================================================
+
+/*
+============
+CanDamage
+
+Returns true if the inflictor can directly damage the target. Used for
+explosions and melee attacks.
+============
+*/
+float(entity targ, entity inflictor) CanDamage =
+{
+// bmodels need special checking because their origin is 0,0,0
+ if (targ.movetype == MOVETYPE_PUSH)
+ {
+ traceline(inflictor.origin, 0.5 * (targ.absmin + targ.absmax), TRUE, self);
+ if (trace_fraction == 1)
+ return TRUE;
+ if (trace_ent == targ)
+ return TRUE;
+ return FALSE;
+ }
+
+ traceline(inflictor.origin, targ.origin, TRUE, self);
+ if (trace_fraction == 1)
+ return TRUE;
+ traceline(inflictor.origin, targ.origin + '15 15 0', TRUE, self);
+ if (trace_fraction == 1)
+ return TRUE;
+ traceline(inflictor.origin, targ.origin + '-15 -15 0', TRUE, self);
+ if (trace_fraction == 1)
+ return TRUE;
+ traceline(inflictor.origin, targ.origin + '-15 15 0', TRUE, self);
+ if (trace_fraction == 1)
+ return TRUE;
+ traceline(inflictor.origin, targ.origin + '15 -15 0', TRUE, self);
+ if (trace_fraction == 1)
+ return TRUE;
+
+ return FALSE;
+};
+
+
+/*
+============
+Killed
+============
+*/
+void(entity targ, entity attacker) Killed =
+{
+ local entity oself;
+
+ oself = self;
+ self = targ;
+
+ if (self.health < -99)
+ self.health = -99; // don't let sbar look bad if a player
+
+ if (self.movetype == MOVETYPE_PUSH || self.movetype == MOVETYPE_NONE)
+ { // doors, triggers, etc
+ self.th_die ();
+ self = oself;
+ return;
+ }
+
+ self.enemy = attacker;
+
+// bump the monster counter
+ if (self.flags & FL_MONSTER)
+ {
+ killed_monsters = killed_monsters + 1;
+ WriteByte (MSG_ALL, SVC_KILLEDMONSTER);
+ }
+
+ ClientObituary(self, attacker);
+
+ self.takedamage = DAMAGE_NO;
+ self.touch = SUB_Null;
+
+ monster_death_use();
+ self.th_die ();
+
+ self = oself;
+};
+
+
+/*
+============
+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_Damage=
+{
+ local vector dir;
+ local entity oldself;
+ local float save;
+ local float take;
+
+ if (!targ.takedamage)
+ return;
+
+// 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;
+
+// save damage based on the target's armor level
+
+ save = ceil(targ.armortype*damage);
+ if (save >= targ.armorvalue)
+ {
+ save = targ.armorvalue;
+ targ.armortype = 0; // lost all armor
+ targ.items = targ.items - (targ.items & (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3));
+ }
+
+ targ.armorvalue = targ.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 (targ.flags & FL_CLIENT)
+ {
+ targ.dmg_take = targ.dmg_take + take;
+ targ.dmg_save = targ.dmg_save + save;
+ targ.dmg_inflictor = inflictor;
+ }
+
+// figure momentum add
+ if ( (inflictor != world) && (targ.movetype == MOVETYPE_WALK) )
+ {
+ dir = targ.origin - (inflictor.absmin + inflictor.absmax) * 0.5;
+ dir = normalize(dir);
+ targ.velocity = targ.velocity + dir*damage*8;
+ }
+
+// check for godmode or invincibility
+ if (targ.flags & FL_GODMODE)
+ return;
+ if (targ.invincible_finished >= time)
+ {
+ if (self.invincible_sound < time)
+ {
+ sound (targ, CHAN_ITEM, "items/protect3.wav", 1, ATTN_NORM);
+ self.invincible_sound = time + 2;
+ }
+ return;
+ }
+
+// team play damage avoidance
+ if ( (teamplay == 1) && (targ.team > 0)&&(targ.team == attacker.team) )
+ return;
+
+// do the damage
+ targ.health = targ.health - take;
+
+ if (targ.health <= 0)
+ {
+ Killed (targ, attacker);
+ return;
+ }
+
+// react to the damage
+ oldself = self;
+ self = targ;
+
+ if ( (self.flags & FL_MONSTER) && attacker != world)
+ {
+ // get mad unless of the same class (except for soldiers)
+ if (self != attacker && attacker != self.enemy)
+ {
+ if ( (self.classname != attacker.classname)
+ || (self.classname == "monster_army" ) )
+ {
+ if (self.enemy.classname == "player")
+ self.oldenemy = self.enemy;
+ self.enemy = attacker;
+ FoundTarget ();
+ }
+ }
+ }
+
+ if (self.th_pain)
+ {
+ self.th_pain (attacker, take);
+ // nightmare mode monsters don't go into pain frames often
+ if (skill == 3)
+ self.pain_finished = time + 5;
+ }
+
+ self = oldself;
+};
+
+/*
+============
+T_RadiusDamage
+============
+*/
+void(entity inflictor, entity attacker, float damage, entity ignore) T_RadiusDamage =
+{
+ local float points;
+ local entity head;
+ local vector org;
+
+ head = findradius(inflictor.origin, damage+40);
+
+ while (head)
+ {
+ if (head != ignore)
+ {
+ if (head.takedamage)
+ {
+ org = head.origin + (head.mins + head.maxs)*0.5;
+ points = 0.5*vlen (inflictor.origin - org);
+ if (points < 0)
+ points = 0;
+ points = damage - points;
+ if (head == attacker)
+ points = points * 0.5;
+ if (points > 0)
+ {
+ if (CanDamage (head, inflictor))
+ { // shambler takes half damage from all explosions
+ if (head.classname == "monster_shambler")
+ T_Damage (head, inflictor, attacker, points*0.5);
+ else
+ T_Damage (head, inflictor, attacker, points);
+ }
+ }
+ }
+ }
+ head = head.chain;
+ }
+};
+
+/*
+============
+T_BeamDamage
+============
+*/
+void(entity attacker, float damage) T_BeamDamage =
+{
+ local float points;
+ local entity head;
+
+ head = findradius(attacker.origin, damage+40);
+
+ while (head)
+ {
+ if (head.takedamage)
+ {
+ points = 0.5*vlen (attacker.origin - head.origin);
+ if (points < 0)
+ points = 0;
+ points = damage - points;
+ if (head == attacker)
+ points = points * 0.5;
+ if (points > 0)
+ {
+ if (CanDamage (head, attacker))
+ {
+ if (head.classname == "monster_shambler")
+ T_Damage (head, attacker, attacker, points*0.5);
+ else
+ T_Damage (head, attacker, attacker, points);
+ }
+ }
+ }
+ head = head.chain;
+ }
+};
+
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/debris.qc b/r17/Revamped src/Revamped QC/Primeqc4/debris.qc
new file mode 100755
index 00000000..60c3f4c8
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/debris.qc
@@ -0,0 +1,96 @@
+
+
+/*
+================
+Debris By Mexicouger (Bounce code from Needler. Not that advanced yet)
+=================
+*/
+vector(entity proj) Debrisbounce = // returns the velocity for bouncing off walls
+{
+ local vector vec;
+ local float backoff, change;
+
+// get the trace_plane_normal of the surface we hit
+ makevectors (proj.angles);
+ v_forward_z = v_forward_z * -1;
+ traceline (proj.origin, proj.origin + v_forward*64, FALSE, proj);
+
+ if (trace_fraction == 1)
+ return proj.velocity;
+
+// the entity's velocity is not what we want, so set default
+ proj.velocity = v_forward * 50;//proj.old_velocity;
+
+// calculate dot product
+ backoff = (proj.velocity * trace_plane_normal);
+ backoff = backoff * 1.5;
+
+// finish
+ change = trace_plane_normal_x * backoff;
+ vec_x = proj.velocity_x - change;
+
+ if (vec_x > -0.1 && vec_x < 0.1)
+ vec_x = 0;
+
+ change = trace_plane_normal_y * backoff;
+ vec_y = proj.velocity_y - change;
+
+ if (vec_y > -0.1 && vec_y < 0.1)
+ vec_y = 0;
+
+ change = trace_plane_normal_z * backoff;
+ vec_z = proj.velocity_z - change;
+
+ if (vec_z > -0.1 && vec_z < 0.1)
+ vec_z = 0;
+
+ if (other.classname == "gun_shells")
+ sound (other, CHAN_AUTO, "weapons/shell.wav", 1, ATTN_NORM);
+// set correct angles of our new velocity
+ proj.angles = vectoangles (vec);
+
+ // this is required to make downward slopes not stop the projectile
+ proj.flags = proj.flags - ( proj.flags & FL_ONGROUND );
+
+ return vec;
+
+};
+
+#define drandom() (2*(random()-0.5))
+
+
+
+void(vector org) debris =
+{
+local entity rock;
+local float rand;
+rand = random();
+rock = spawn ();
+rock.classname = "rock";
+rock.movetype = MOVETYPE_BOUNCE;
+rock.owner = self;
+
+
+// This is all about how fast the debris goes. (My biggest problem)
+makevectors (self.angles);
+rock.velocity = v_forward * v_up * v_right * random();
+
+
+rock.velocity_z = rock.velocity_z + 5 + 20*random();
+rock.velocity_x = rock.velocity_x + 3 + 20*drandom();
+rock.velocity_y = rock.velocity_y + 3 + 20*drandom();
+rock.velocity = (rock.velocity * 12);
+rock.avelocity = '300 300 300' * drandom();
+rock.angles = vectoangles (rock.velocity);
+rock.solid = SOLID_NOT;
+rock.touch = Debrisbounce;
+
+// Rock duration (How long the rocks are alive until they disapear/Explode
+rock.nextthink = time + 2 * rand*4;
+rock.think = SUB_Remove;
+// The whole setting up the model thing. Sets up the sprite and location.
+rock.origin = self.origin + v_forward*8*random() + '0 0 16';
+setorigin (rock, org);
+setsize (rock, '0 0 0', '3 3 3');
+setmodel (rock, "maps/B_f1.bsp");
+};
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/defs.qc b/r17/Revamped src/Revamped QC/Primeqc4/defs.qc
new file mode 100755
index 00000000..2b044a8f
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/defs.qc
@@ -0,0 +1,692 @@
+
+/*
+==============================================================================
+
+ SOURCE FOR GLOBALVARS_T C STRUCTURE
+
+==============================================================================
+*/
+
+//
+// system globals
+//
+entity self;
+entity other;
+entity world;
+float time;
+float frametime;
+
+float force_retouch; // force all entities to touch triggers
+ // next frame. this is needed because
+ // non-moving things don't normally scan
+ // for triggers, and when a trigger is
+ // created (like a teleport trigger), it
+ // needs to catch everything.
+ // decremented each frame, so set to 2
+ // to guarantee everything is touched
+string mapname;
+
+float deathmatch;
+float coop;
+float teamplay;
+
+float serverflags; // propagated from level to level, used to
+ // keep track of completed episodes
+
+float total_secrets;
+float total_monsters;
+
+float found_secrets; // number of secrets found
+float killed_monsters; // number of monsters killed
+
+
+// spawnparms are used to encode information about clients across server
+// level changes
+float parm1, parm2, parm3, parm4, parm5, parm6, parm7, parm8, parm9, parm10, parm11, parm12, parm13, parm14, parm15, parm16;
+
+//
+// global variables set by built in functions
+//
+vector v_forward, v_up, v_right; // set by makevectors()
+
+// set by traceline / tracebox
+float trace_allsolid;
+float trace_startsolid;
+float trace_fraction;
+vector trace_endpos;
+vector trace_plane_normal;
+float trace_plane_dist;
+entity trace_ent;
+float trace_inopen;
+float trace_inwater;
+
+entity msg_entity; // destination of single entity writes
+
+//
+// required prog functions
+//
+void() main; // only for testing
+
+void() StartFrame;
+
+void() PlayerPreThink;
+void() PlayerPostThink;
+
+void() ClientKill;
+void() ClientConnect;
+void() PutClientInServer; // call after setting the parm1... parms
+void() ClientDisconnect;
+
+void() SetNewParms; // called when a client first connects to
+ // a server. sets parms so they can be
+ // saved off for restarts
+
+void() SetChangeParms; // call to set parms for self so they can
+ // be saved for a level transition
+
+
+//================================================
+void end_sys_globals; // flag for structure dumping
+//================================================
+
+/*
+==============================================================================
+
+ SOURCE FOR ENTVARS_T C STRUCTURE
+
+==============================================================================
+*/
+
+//
+// system fields (*** = do not set in prog code, maintained by C code)
+//
+.float modelindex; // *** model index in the precached list
+.vector absmin, absmax; // *** origin + mins / maxs
+
+.float ltime; // local time for entity
+.float movetype;
+.float solid;
+
+.vector origin; // ***
+.vector oldorigin; // ***
+.vector velocity;
+.vector angles;
+.vector avelocity;
+
+.vector punchangle; // temp angle adjust from damage or recoil
+
+.string classname; // spawn function
+.string model;
+.float frame;
+.float skin;
+.float effects;
+
+.vector mins, maxs; // bounding box extents reletive to origin
+.vector size; // maxs - mins
+
+.void() touch;
+.void() use;
+.void() think;
+.void() blocked; // for doors or plats, called when can't push other
+
+.float nextthink;
+.entity groundentity;
+
+// stats
+.float health;
+.float frags;
+.float weapon; // one of the IT_BLASTER, etc flags
+.string weaponmodel;
+.float weaponframe;
+.float currentammo;
+.float ammo_shells, ammo_nails, ammo_rockets, ammo_cells;
+
+.float items; // bit flags
+
+.float takedamage;
+.entity chain;
+.float deadflag;
+
+.vector view_ofs; // add to origin to get eye point
+
+
+.float button0; // fire
+.float button1; // use
+.float button2; // jump
+
+.float impulse; // weapon changes
+
+.float fixangle;
+.vector v_angle; // view / targeting angle for players
+.float idealpitch; // calculated pitch angle for lookup up slopes
+
+
+.string netname;
+
+.entity enemy;
+
+.float flags;
+
+.float colormap;
+.float team;
+
+.float max_health; // players maximum health is stored here
+
+.float teleport_time; // don't back up
+
+.float armortype; // save this fraction of incoming damage
+.float armorvalue;
+
+.float waterlevel; // 0 = not in, 1 = feet, 2 = wast, 3 = eyes
+.float watertype; // a contents value
+
+.float ideal_yaw;
+.float yaw_speed;
+
+.entity aiment;
+
+.entity goalentity; // a movetarget or an enemy
+
+.float spawnflags;
+
+.string target;
+.string targetname;
+
+// damage is accumulated through a frame. and sent as one single
+// message, so the super shotgun doesn't generate huge messages
+.float dmg_take;
+.float dmg_save;
+.entity dmg_inflictor;
+
+.entity owner; // who launched a missile
+.vector movedir; // mostly for doors, but also used for waterjump
+
+.string message; // trigger messages
+
+.float sounds; // either a cd track number or sound number
+
+.string noise, noise1, noise2, noise3; // contains names of wavs to play
+
+//================================================
+void end_sys_fields; // flag for structure dumping
+//================================================
+
+/*
+==============================================================================
+
+ VARS NOT REFERENCED BY C CODE
+
+==============================================================================
+*/
+
+
+//
+// constants
+//
+
+float FALSE = 0;
+float TRUE = 1;
+
+// edict.flags
+float FL_FLY = 1;
+float FL_SWIM = 2;
+float FL_CLIENT = 8; // set for all client edicts
+float FL_INWATER = 16; // for enter / leave water splash
+float FL_MONSTER = 32;
+float FL_GODMODE = 64; // player cheat
+float FL_NOTARGET = 128; // player cheat
+float FL_ITEM = 256; // extra wide size for bonus items
+float FL_ONGROUND = 512; // standing on something
+float FL_PARTIALGROUND = 1024; // not all corners are valid
+float FL_WATERJUMP = 2048; // player jumping out of water
+float FL_JUMPRELEASED = 4096; // for jump debouncing
+
+// edict.movetype values
+float MOVETYPE_NONE = 0; // never moves
+//float MOVETYPE_ANGLENOCLIP = 1;
+//float MOVETYPE_ANGLECLIP = 2;
+float MOVETYPE_WALK = 3; // players only
+float MOVETYPE_STEP = 4; // discrete, not real time unless fall
+float MOVETYPE_FLY = 5;
+float MOVETYPE_TOSS = 6; // gravity
+float MOVETYPE_PUSH = 7; // no clip to world, push and crush
+float MOVETYPE_NOCLIP = 8;
+float MOVETYPE_FLYMISSILE = 9; // fly with extra size against monsters
+float MOVETYPE_BOUNCE = 10;
+float MOVETYPE_BOUNCEMISSILE = 11; // bounce with extra size
+
+// edict.solid values
+float SOLID_NOT = 0; // no interaction with other objects
+float SOLID_TRIGGER = 1; // touch on edge, but not blocking
+float SOLID_BBOX = 2; // touch on edge, block
+float SOLID_SLIDEBOX = 3; // touch on edge, but not an onground
+float SOLID_BSP = 4; // bsp clip, touch on edge, block
+
+// range values
+float RANGE_MELEE = 0;
+float RANGE_NEAR = 1;
+float RANGE_MID = 2;
+float RANGE_FAR = 3;
+
+// deadflag values
+
+float DEAD_NO = 0;
+float DEAD_DYING = 1;
+float DEAD_DEAD = 2;
+float DEAD_RESPAWNABLE = 3;
+
+// takedamage values
+
+float DAMAGE_NO = 0;
+float DAMAGE_YES = 1;
+float DAMAGE_AIM = 2;
+
+// items
+float IT_MORPHBALL = 4096;
+float IT_BLASTER = 1; //Blaster
+float IT_ROCKET = 2; //Rocket Launcher
+float IT_SPLASER = 4; //Splaser
+float IT_SNIPER = 8; //Sniper
+float IT_GRENADE_LAUNCHER = 16;
+float IT_MAGMA = 32; //Magma beam
+float IT_LIGHTNING = 64;
+float IT_RIC = 128; //Richochet beam
+
+float IT_SHELLS = 256;
+float IT_NAILS = 512;
+float IT_ROCKETS = 1024;
+float IT_CELLS = 2048;
+
+float IT_ARMOR1 = 8192;
+float IT_ARMOR2 = 16384;
+float IT_ARMOR3 = 32768;
+float IT_SUPERHEALTH = 65536;
+
+float IT_KEY1 = 131072;
+float IT_KEY2 = 262144;
+
+float IT_INVISIBILITY = 524288;
+float IT_INVULNERABILITY = 1048576;
+float IT_SUIT = 2097152;
+float IT_QUAD = 4194304;
+
+// point content values
+
+float CONTENT_EMPTY = -1;
+float CONTENT_SOLID = -2;
+float CONTENT_WATER = -3;
+float CONTENT_SLIME = -4;
+float CONTENT_LAVA = -5;
+float CONTENT_SKY = -6;
+
+float STATE_TOP = 0;
+float STATE_BOTTOM = 1;
+float STATE_UP = 2;
+float STATE_DOWN = 3;
+
+vector VEC_ORIGIN = '0 0 0';
+vector VEC_HULL_MIN = '-16 -16 -24';
+vector VEC_HULL_MAX = '16 16 32';
+
+vector VEC_HULL2_MIN = '-32 -32 -24';
+vector VEC_HULL2_MAX = '32 32 64';
+
+// protocol bytes
+float SVC_TEMPENTITY = 23;
+float SVC_KILLEDMONSTER = 27;
+float SVC_FOUNDSECRET = 28;
+float SVC_INTERMISSION = 30;
+float SVC_FINALE = 31;
+float SVC_CDTRACK = 32;
+float SVC_SELLSCREEN = 33;
+
+
+float TE_SPIKE = 0;
+float TE_SUPERSPIKE = 1;
+float TE_GUNSHOT = 2;
+float TE_EXPLOSION = 3;
+float TE_TAREXPLOSION = 4;
+float TE_LIGHTNING1 = 5;
+float TE_LIGHTNING2 = 6;
+float TE_WIZSPIKE = 7;
+float TE_KNIGHTSPIKE = 8;
+float TE_LIGHTNING3 = 9;
+float TE_LAVASPLASH = 10;
+float TE_TELEPORT = 11;
+
+// sound channels
+// channel 0 never willingly overrides
+// other channels (1-7) allways override a playing sound on that channel
+float CHAN_AUTO = 0;
+float CHAN_WEAPON = 1;
+float CHAN_VOICE = 2;
+float CHAN_ITEM = 3;
+float CHAN_BODY = 4;
+
+float ATTN_NONE = 0;
+float ATTN_NORM = 1;
+float ATTN_IDLE = 2;
+float ATTN_STATIC = 3;
+
+// update types
+
+float UPDATE_GENERAL = 0;
+float UPDATE_STATIC = 1;
+float UPDATE_BINARY = 2;
+float UPDATE_TEMP = 3;
+
+// entity effects
+
+float EF_BRIGHTFIELD = 1;
+float EF_MUZZLEFLASH = 2;
+float EF_BRIGHTLIGHT = 4;
+float EF_DIMLIGHT = 8;
+
+
+// messages
+float MSG_BROADCAST = 0; // unreliable to all
+float MSG_ONE = 1; // reliable to one (msg_entity)
+float MSG_ALL = 2; // reliable to all
+float MSG_INIT = 3; // write to the init string
+
+//================================================
+
+//
+// globals
+//
+float movedist;
+float gameover; // set when a rule exits
+
+string string_null; // null string, nothing should be held here
+
+entity newmis; // launch_spike sets this after spawning it
+
+entity activator; // the entity that activated a trigger or brush
+
+entity damage_attacker; // set by T_Damage
+float framecount;
+
+float skill;
+
+//================================================
+
+//
+// world fields (FIXME: make globals)
+//
+.string map;
+.float worldtype; // 0=medieval 1=metal 2=base
+
+//================================================
+
+.string killtarget;
+
+//
+// quakeed fields
+//
+.float style;
+
+
+//
+// monster ai
+//
+.void() th_stand;
+.void() th_walk;
+.void() th_run;
+.void() th_missile;
+.void() th_melee;
+.void(entity attacker, float damage) th_pain;
+.void() th_die;
+
+.entity oldenemy; // mad at this player before taking damage
+
+.float speed;
+
+.float lefty;
+
+.float search_time;
+.float attack_state;
+
+float AS_STRAIGHT = 1;
+float AS_SLIDING = 2;
+float AS_MELEE = 3;
+float AS_MISSILE = 4;
+
+//
+// player only fields
+//
+.float walkframe;
+
+.float attack_finished;
+.float pain_finished;
+
+.float invincible_finished;
+.float invisible_finished;
+.float super_damage_finished;
+.float radsuit_finished;
+
+.float invincible_time, invincible_sound;
+.float invisible_time, invisible_sound;
+.float super_time, super_sound;
+.float rad_time;
+.float fly_sound;
+
+.float axhitme;
+
+.float show_hostile; // 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 jump_flag; // player jump flag
+.float swim_flag; // player swimming sound flag
+.float air_finished; // when time > air_finished, start drowning
+.float bubble_count; // keeps track of the number of bubbles
+.string deathtype; // keeps track of how the player died
+
+//
+// object stuff
+//
+.string mdl;
+.vector mangle; // angle at start
+
+.vector oldorigin; // only used by secret door
+
+.float t_length, t_width;
+
+
+//
+// doors, etc
+//
+.vector dest1, dest2;
+.float wait; // time from firing to restarting
+.float delay; // time from activation to firing
+.entity trigger_field; // door's trigger entity
+.string noise4;
+
+//
+// monsters
+//
+.float pausetime;
+.entity movetarget;
+
+
+//
+// doors
+//
+.float aflag;
+.float dmg; // damage done by door when hit
+
+//
+// misc
+//
+.float cnt; // misc flag
+
+//
+// subs
+//
+.void() think1;
+.vector finaldest, finalangle;
+
+//
+// triggers
+//
+.float count; // for counting triggers
+
+
+//
+// plats / doors / buttons
+//
+.float lip;
+.float state;
+.vector pos1, pos2; // top and bottom positions
+.float height;
+
+//
+// sounds
+//
+.float waitmin;
+//.float volume; I can't find a use for this one yet.
+
+
+
+
+//===========================================================================
+
+
+//
+// builtin functions
+//
+
+void(vector ang) makevectors = #1; // sets v_forward, etc globals
+void(entity e, vector o) setorigin = #2;
+void(entity e, string m) setmodel = #3; // set movetype and solid first
+void(entity e, vector min, vector max) setsize = #4;
+// #5 was removed
+void() break = #6;
+float() random = #7; // returns 0 - 1
+//void(entity e, float chan, string samp, float vol, float atten) sound = #8;
+vector(vector v) normalize = #9;
+void(string e) error = #10;
+void(string e) objerror = #11;
+float(vector v) vlen = #12;
+float(vector v) vectoyaw = #13;
+entity() spawn = #14;
+void(entity e) remove = #15;
+
+// sets trace_* globals
+// nomonsters can be:
+// An entity will also be ignored for testing if forent == test,
+// forent->owner == test, or test->owner == forent
+// a forent of world is ignored
+void(vector v1, vector v2, float nomonsters, entity forent) traceline = #16;
+
+entity() checkclient = #17; // returns a client to look for
+entity(entity start, .string fld, string match) find = #18;
+string(string s) precache_sound = #19;
+string(string s) precache_model = #20;
+//void(entity client, string s)stuffcmd = #21;
+entity(vector org, float rad) findradius = #22;
+void(string s) bprint = #23;
+//void(entity client, string s) sprint = #24;
+void(string s) dprint = #25;
+string(float f) ftos = #26;
+string(vector v) vtos = #27;
+void() coredump = #28; // prints all edicts
+void() traceon = #29; // turns statment trace on
+void() traceoff = #30;
+void(entity e) eprint = #31; // prints an entire edict
+float(float yaw, float dist) walkmove = #32; // returns TRUE or FALSE
+// #33 was removed
+float(float yaw, float dist) droptofloor= #34; // TRUE if landed on floor
+void(float style, string value) lightstyle = #35;
+float(float v) rint = #36; // round to nearest int
+float(float v) floor = #37; // largest integer <= v
+float(float v) ceil = #38; // smallest integer >= v
+// #39 was removed
+float(entity e) checkbottom = #40; // true if self is on ground
+float(vector v) pointcontents = #41; // returns a CONTENT_*
+// #42 was removed
+float(float f) fabs = #43;
+//vector(entity e, float speed) aim = #44; // returns the shooting vector
+float(string s) cvar = #45; // return cvar.value
+void(string s) localcmd = #46; // put string into local que
+entity(entity e) nextent = #47; // for looping through all ents
+void(vector o, vector d, float color, float count) particle = #48;// start a particle effect
+void() ChangeYaw = #49; // turn towards self.ideal_yaw
+ // at self.yaw_speed
+// #50 was removed
+vector(vector v) vectoangles = #51;
+
+//
+// direct client message generation
+//
+//void(float to, float f) WriteByte = #52;
+//void(float to, float f) WriteChar = #53;
+//void(float to, float f) WriteShort = #54;
+//void(float to, float f) WriteLong = #55;
+//void(float to, float f) WriteCoord = #56;
+//void(float to, float f) WriteAngle = #57;
+//void(float to, string s) WriteString = #58;
+//void(float to, entity s) WriteEntity = #59;
+
+//
+// broadcast client message generation
+//
+
+// void(float f) bWriteByte = #59;
+// void(float f) bWriteChar = #60;
+// void(float f) bWriteShort = #61;
+// void(float f) bWriteLong = #62;
+// void(float f) bWriteCoord = #63;
+// void(float f) bWriteAngle = #64;
+// void(string s) bWriteString = #65;
+// void(entity e) bWriteEntity = #66;
+
+void(float step) movetogoal = #67;
+
+string(string s) precache_file = #68; // no effect except for -copy
+void(entity e) makestatic = #69;
+void(string s) changelevel = #70;
+
+//#71 was removed
+
+void(string var, string val) cvar_set = #72; // sets cvar.value
+
+//void(entity client, string s) centerprint = #73; // sprint, but in middle
+
+void(vector pos, string samp, float vol, float atten) ambientsound = #74;
+
+string(string s) precache_model2 = #75; // registered version only
+string(string s) precache_sound2 = #76; // registered version only
+string(string s) precache_file2 = #77; // registered version only
+
+//void(entity e) setspawnparms = #78; // set parm1... to the
+ // values at level start
+ // for coop respawn
+
+//============================================================================
+
+//
+// subs.qc
+//
+void(vector tdest, float tspeed, void() func) SUB_CalcMove;
+void(entity ent, vector tdest, float tspeed, void() func) SUB_CalcMoveEnt;
+void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove;
+void() SUB_CalcMoveDone;
+void() SUB_CalcAngleMoveDone;
+void() SUB_Null;
+void() SUB_UseTargets;
+void() SUB_Remove;
+
+//
+// combat.qc
+//
+void(entity targ, entity inflictor, entity attacker, float damage) T_Damage;
+
+
+float (entity e, float healamount, float ignore) T_Heal; // health function
+
+float(entity targ, entity inflictor) CanDamage;
+
+
+.float semi; // Semiauto
+
+
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/demon.qc b/r17/Revamped src/Revamped QC/Primeqc4/demon.qc
new file mode 100755
index 00000000..2c96af3b
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/demon.qc
@@ -0,0 +1,359 @@
+/*
+==============================================================================
+
+DEMON
+
+==============================================================================
+*/
+
+$cd id1/models/demon3
+$scale 0.8
+$origin 0 0 24
+$base base
+$skin base
+
+$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9
+$frame stand10 stand11 stand12 stand13
+
+$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8
+
+$frame run1 run2 run3 run4 run5 run6
+
+$frame leap1 leap2 leap3 leap4 leap5 leap6 leap7 leap8 leap9 leap10
+$frame leap11 leap12
+
+$frame pain1 pain2 pain3 pain4 pain5 pain6
+
+$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
+
+//============================================================================
+
+void() Demon_JumpTouch;
+
+void() demon1_stand1 =[ $stand1, demon1_stand2 ] {ai_stand();};
+void() demon1_stand2 =[ $stand2, demon1_stand3 ] {ai_stand();};
+void() demon1_stand3 =[ $stand3, demon1_stand4 ] {ai_stand();};
+void() demon1_stand4 =[ $stand4, demon1_stand5 ] {ai_stand();};
+void() demon1_stand5 =[ $stand5, demon1_stand6 ] {ai_stand();};
+void() demon1_stand6 =[ $stand6, demon1_stand7 ] {ai_stand();};
+void() demon1_stand7 =[ $stand7, demon1_stand8 ] {ai_stand();};
+void() demon1_stand8 =[ $stand8, demon1_stand9 ] {ai_stand();};
+void() demon1_stand9 =[ $stand9, demon1_stand10 ] {ai_stand();};
+void() demon1_stand10 =[ $stand10, demon1_stand11 ] {ai_stand();};
+void() demon1_stand11 =[ $stand11, demon1_stand12 ] {ai_stand();};
+void() demon1_stand12 =[ $stand12, demon1_stand13 ] {ai_stand();};
+void() demon1_stand13 =[ $stand13, demon1_stand1 ] {ai_stand();};
+
+void() demon1_walk1 =[ $walk1, demon1_walk2 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "demon/idle1.wav", 1, ATTN_IDLE);
+ai_walk(8);
+};
+void() demon1_walk2 =[ $walk2, demon1_walk3 ] {ai_walk(6);};
+void() demon1_walk3 =[ $walk3, demon1_walk4 ] {ai_walk(6);};
+void() demon1_walk4 =[ $walk4, demon1_walk5 ] {ai_walk(7);};
+void() demon1_walk5 =[ $walk5, demon1_walk6 ] {ai_walk(4);};
+void() demon1_walk6 =[ $walk6, demon1_walk7 ] {ai_walk(6);};
+void() demon1_walk7 =[ $walk7, demon1_walk8 ] {ai_walk(10);};
+void() demon1_walk8 =[ $walk8, demon1_walk1 ] {ai_walk(10);};
+
+void() demon1_run1 =[ $run1, demon1_run2 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "demon/idle1.wav", 1, ATTN_IDLE);
+ai_run(20);};
+void() demon1_run2 =[ $run2, demon1_run3 ] {ai_run(15);};
+void() demon1_run3 =[ $run3, demon1_run4 ] {ai_run(36);};
+void() demon1_run4 =[ $run4, demon1_run5 ] {ai_run(20);};
+void() demon1_run5 =[ $run5, demon1_run6 ] {ai_run(15);};
+void() demon1_run6 =[ $run6, demon1_run1 ] {ai_run(36);};
+
+void() demon1_jump1 =[ $leap1, demon1_jump2 ] {ai_face();};
+void() demon1_jump2 =[ $leap2, demon1_jump3 ] {ai_face();};
+void() demon1_jump3 =[ $leap3, demon1_jump4 ] {ai_face();};
+void() demon1_jump4 =[ $leap4, demon1_jump5 ]
+{
+ ai_face();
+
+ self.touch = Demon_JumpTouch;
+ 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;
+};
+void() demon1_jump5 =[ $leap5, demon1_jump6 ] {};
+void() demon1_jump6 =[ $leap6, demon1_jump7 ] {};
+void() demon1_jump7 =[ $leap7, demon1_jump8 ] {};
+void() demon1_jump8 =[ $leap8, demon1_jump9 ] {};
+void() demon1_jump9 =[ $leap9, demon1_jump10 ] {};
+void() demon1_jump10 =[ $leap10, demon1_jump1 ] {
+self.nextthink = time + 3;
+// if three seconds pass, assume demon is stuck and jump again
+};
+
+void() demon1_jump11 =[ $leap11, demon1_jump12 ] {};
+void() demon1_jump12 =[ $leap12, demon1_run1 ] {};
+
+
+void() demon1_atta1 =[ $attacka1, demon1_atta2 ] {ai_charge(4);};
+void() demon1_atta2 =[ $attacka2, demon1_atta3 ] {ai_charge(0);};
+void() demon1_atta3 =[ $attacka3, demon1_atta4 ] {ai_charge(0);};
+void() demon1_atta4 =[ $attacka4, demon1_atta5 ] {ai_charge(1);};
+void() demon1_atta5 =[ $attacka5, demon1_atta6 ] {ai_charge(2); Demon_Melee(200);};
+void() demon1_atta6 =[ $attacka6, demon1_atta7 ] {ai_charge(1);};
+void() demon1_atta7 =[ $attacka7, demon1_atta8 ] {ai_charge(6);};
+void() demon1_atta8 =[ $attacka8, demon1_atta9 ] {ai_charge(8);};
+void() demon1_atta9 =[ $attacka9, demon1_atta10] {ai_charge(4);};
+void() demon1_atta10 =[ $attacka10, demon1_atta11] {ai_charge(2);};
+void() demon1_atta11 =[ $attacka11, demon1_atta12] {Demon_Melee(-200);};
+void() demon1_atta12 =[ $attacka12, demon1_atta13] {ai_charge(5);};
+void() demon1_atta13 =[ $attacka13, demon1_atta14] {ai_charge(8);};
+void() demon1_atta14 =[ $attacka14, demon1_atta15] {ai_charge(4);};
+void() demon1_atta15 =[ $attacka15, demon1_run1] {ai_charge(4);};
+
+void() demon1_pain1 =[ $pain1, demon1_pain2 ] {};
+void() demon1_pain2 =[ $pain2, demon1_pain3 ] {};
+void() demon1_pain3 =[ $pain3, demon1_pain4 ] {};
+void() demon1_pain4 =[ $pain4, demon1_pain5 ] {};
+void() demon1_pain5 =[ $pain5, demon1_pain6 ] {};
+void() demon1_pain6 =[ $pain6, demon1_run1 ] {};
+
+void(entity attacker, float damage) demon1_pain =
+{
+ if (self.touch == Demon_JumpTouch)
+ return;
+
+ if (self.pain_finished > time)
+ return;
+
+ self.pain_finished = time + 1;
+ sound (self, CHAN_VOICE, "demon/dpain1.wav", 1, ATTN_NORM);
+
+ if (random()*200 > damage)
+ return; // didn't flinch
+
+ demon1_pain1 ();
+};
+
+void() demon1_die1 =[ $death1, demon1_die2 ] {
+sound (self, CHAN_VOICE, "demon/ddeath.wav", 1, ATTN_NORM);};
+void() demon1_die2 =[ $death2, demon1_die3 ] {};
+void() demon1_die3 =[ $death3, demon1_die4 ] {};
+void() demon1_die4 =[ $death4, demon1_die5 ] {};
+void() demon1_die5 =[ $death5, demon1_die6 ] {};
+void() demon1_die6 =[ $death6, demon1_die7 ]
+{self.solid = SOLID_NOT;};
+void() demon1_die7 =[ $death7, demon1_die8 ] {};
+void() demon1_die8 =[ $death8, demon1_die9 ] {};
+void() demon1_die9 =[ $death9, demon1_die9 ] {};
+
+void() demon_die =
+{
+// check for gib
+ if (self.health < -80)
+ {
+ sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
+ 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);
+ return;
+ }
+
+// regular death
+ demon1_die1 ();
+};
+
+
+void() Demon_MeleeAttack =
+{
+ demon1_atta1 ();
+};
+
+
+/*QUAKED monster_demon1 (1 0 0) (-32 -32 -24) (32 32 64) Ambush
+
+*/
+void() monster_demon1 =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+ precache_model ("progs/demon.mdl");
+ precache_model ("progs/h_demon.mdl");
+
+ precache_sound ("demon/ddeath.wav");
+ precache_sound ("demon/dhit2.wav");
+ precache_sound ("demon/djump.wav");
+ precache_sound ("demon/dpain1.wav");
+ precache_sound ("demon/idle1.wav");
+ precache_sound ("demon/sight2.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/demon.mdl");
+
+ setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX);
+ self.health = 300;
+
+ self.th_stand = demon1_stand1;
+ self.th_walk = demon1_walk1;
+ self.th_run = demon1_run1;
+ self.th_die = demon_die;
+ self.th_melee = Demon_MeleeAttack; // one of two attacks
+ self.th_missile = demon1_jump1; // jump attack
+ self.th_pain = demon1_pain;
+
+ walkmonster_start();
+};
+
+
+/*
+==============================================================================
+
+DEMON
+
+==============================================================================
+*/
+
+/*
+==============
+CheckDemonMelee
+
+Returns TRUE if a melee attack would hit right now
+==============
+*/
+float() CheckDemonMelee =
+{
+ if (enemy_range == RANGE_MELEE)
+ { // FIXME: check canreach
+ self.attack_state = AS_MELEE;
+ return TRUE;
+ }
+ return FALSE;
+};
+
+/*
+==============
+CheckDemonJump
+
+==============
+*/
+float() CheckDemonJump =
+{
+ local vector dist;
+ local float d;
+
+ if (self.origin_z + self.mins_z > self.enemy.origin_z + self.enemy.mins_z
+ + 0.75 * self.enemy.size_z)
+ return FALSE;
+
+ if (self.origin_z + self.maxs_z < self.enemy.origin_z + self.enemy.mins_z
+ + 0.25 * self.enemy.size_z)
+ return FALSE;
+
+ dist = self.enemy.origin - self.origin;
+ dist_z = 0;
+
+ d = vlen(dist);
+
+ if (d < 100)
+ return FALSE;
+
+ if (d > 200)
+ {
+ if (random() < 0.9)
+ return FALSE;
+ }
+
+ return TRUE;
+};
+
+float() DemonCheckAttack =
+{
+// if close enough for slashing, go for it
+ if (CheckDemonMelee ())
+ {
+ self.attack_state = AS_MELEE;
+ return TRUE;
+ }
+
+ if (CheckDemonJump ())
+ {
+ self.attack_state = AS_MISSILE;
+ sound (self, CHAN_VOICE, "demon/djump.wav", 1, ATTN_NORM);
+ return TRUE;
+ }
+
+ return FALSE;
+};
+
+
+//===========================================================================
+
+void(float side) Demon_Melee =
+{
+ local float ldmg;
+ local vector delta;
+
+ ai_face ();
+ walkmove (self.ideal_yaw, 12); // allow a little closing
+
+ delta = self.enemy.origin - self.origin;
+
+ if (vlen(delta) > 100)
+ return;
+ if (!CanDamage (self.enemy, self))
+ return;
+
+ sound (self, CHAN_WEAPON, "demon/dhit2.wav", 1, ATTN_NORM);
+ ldmg = 10 + 5*random();
+ T_Damage (self.enemy, self, self, ldmg);
+
+};
+
+
+void() Demon_JumpTouch =
+{
+ local float ldmg;
+
+ if (self.health <= 0)
+ return;
+
+ if (other.takedamage)
+ {
+ if ( vlen(self.velocity) > 400 )
+ {
+ ldmg = 40 + 10*random();
+ T_Damage (other, self, self, ldmg);
+ }
+ }
+
+ if (!checkbottom(self))
+ {
+ if (self.flags & FL_ONGROUND)
+ { // jump randomly to not get hung up
+//dprint ("popjump\n");
+ self.touch = SUB_Null;
+ self.think = demon1_jump1;
+ self.nextthink = time + 0.1;
+
+// self.velocity_x = (random() - 0.5) * 600;
+// self.velocity_y = (random() - 0.5) * 600;
+// self.velocity_z = 200;
+// self.flags = self.flags - FL_ONGROUND;
+ }
+ return; // not on ground yet
+ }
+
+ self.touch = SUB_Null;
+ self.think = demon1_jump11;
+ self.nextthink = time + 0.1;
+};
+
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/dog.qc b/r17/Revamped src/Revamped QC/Primeqc4/dog.qc
new file mode 100755
index 00000000..a9e18565
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/dog.qc
@@ -0,0 +1,362 @@
+/*
+==============================================================================
+
+DOG
+
+==============================================================================
+*/
+$cd id1/models/dog
+$origin 0 0 24
+$base base
+$skin skin
+
+$frame attack1 attack2 attack3 attack4 attack5 attack6 attack7 attack8
+
+$frame death1 death2 death3 death4 death5 death6 death7 death8 death9
+
+$frame deathb1 deathb2 deathb3 deathb4 deathb5 deathb6 deathb7 deathb8
+$frame deathb9
+
+$frame pain1 pain2 pain3 pain4 pain5 pain6
+
+$frame painb1 painb2 painb3 painb4 painb5 painb6 painb7 painb8 painb9 painb10
+$frame painb11 painb12 painb13 painb14 painb15 painb16
+
+$frame run1 run2 run3 run4 run5 run6 run7 run8 run9 run10 run11 run12
+
+$frame leap1 leap2 leap3 leap4 leap5 leap6 leap7 leap8 leap9
+
+$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9
+
+$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8
+
+
+void() dog_leap1;
+void() dog_run1;
+
+/*
+================
+dog_bite
+
+================
+*/
+void() dog_bite =
+{
+local vector delta;
+local float ldmg;
+
+ if (!self.enemy)
+ return;
+
+ ai_charge(10);
+
+ if (!CanDamage (self.enemy, self))
+ return;
+
+ delta = self.enemy.origin - self.origin;
+
+ if (vlen(delta) > 100)
+ return;
+
+ ldmg = (random() + random() + random()) * 8;
+ T_Damage (self.enemy, self, self, ldmg);
+};
+
+void() Dog_JumpTouch =
+{
+ local float ldmg;
+
+ if (self.health <= 0)
+ return;
+
+ if (other.takedamage)
+ {
+ if ( vlen(self.velocity) > 300 )
+ {
+ ldmg = 10 + 10*random();
+ T_Damage (other, self, self, ldmg);
+ }
+ }
+
+ if (!checkbottom(self))
+ {
+ if (self.flags & FL_ONGROUND)
+ { // jump randomly to not get hung up
+//dprint ("popjump\n");
+ self.touch = SUB_Null;
+ self.think = dog_leap1;
+ self.nextthink = time + 0.1;
+
+// self.velocity_x = (random() - 0.5) * 600;
+// self.velocity_y = (random() - 0.5) * 600;
+// self.velocity_z = 200;
+// self.flags = self.flags - FL_ONGROUND;
+ }
+ return; // not on ground yet
+ }
+
+ self.touch = SUB_Null;
+ self.think = dog_run1;
+ self.nextthink = time + 0.1;
+};
+
+
+void() dog_stand1 =[ $stand1, dog_stand2 ] {ai_stand();};
+void() dog_stand2 =[ $stand2, dog_stand3 ] {ai_stand();};
+void() dog_stand3 =[ $stand3, dog_stand4 ] {ai_stand();};
+void() dog_stand4 =[ $stand4, dog_stand5 ] {ai_stand();};
+void() dog_stand5 =[ $stand5, dog_stand6 ] {ai_stand();};
+void() dog_stand6 =[ $stand6, dog_stand7 ] {ai_stand();};
+void() dog_stand7 =[ $stand7, dog_stand8 ] {ai_stand();};
+void() dog_stand8 =[ $stand8, dog_stand9 ] {ai_stand();};
+void() dog_stand9 =[ $stand9, dog_stand1 ] {ai_stand();};
+
+void() dog_walk1 =[ $walk1 , dog_walk2 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "wizard/widle2.wav", 1, ATTN_IDLE);
+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);};
+
+void() dog_run1 =[ $run1 , dog_run2 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "wizard/widle1.wav", 1, ATTN_IDLE);
+ai_run(16);};
+void() dog_run2 =[ $run2 , dog_run3 ] {ai_run(32);};
+void() dog_run3 =[ $run3 , dog_run4 ] {ai_run(32);};
+void() dog_run4 =[ $run4 , dog_run5 ] {ai_run(20);};
+void() dog_run5 =[ $run5 , dog_run6 ] {ai_run(64);};
+void() dog_run6 =[ $run6 , dog_run7 ] {ai_run(32);};
+void() dog_run7 =[ $run7 , dog_run8 ] {ai_run(16);};
+void() dog_run8 =[ $run8 , dog_run9 ] {ai_run(32);};
+void() dog_run9 =[ $run9 , dog_run10 ] {ai_run(32);};
+void() dog_run10 =[ $run10 , dog_run11 ] {ai_run(20);};
+void() dog_run11 =[ $run11 , dog_run12 ] {ai_run(64);};
+void() dog_run12 =[ $run12 , dog_run1 ] {ai_run(32);};
+
+void() dog_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 ] {
+sound (self, CHAN_WEAPON, "wizard/wattack.wav", 1, ATTN_NORM);
+dog_bite();};
+void() dog_atta5 =[ $attack5, dog_atta6 ] {ai_charge(10);};
+void() dog_atta6 =[ $attack6, dog_atta7 ] {ai_charge(10);};
+void() dog_atta7 =[ $attack7, dog_atta8 ] {ai_charge(10);};
+void() dog_atta8 =[ $attack8, dog_run1 ] {ai_charge(10);};
+
+void() dog_leap1 =[ $leap1, dog_leap2 ] {ai_face();};
+void() dog_leap2 =[ $leap2, dog_leap3 ]
+{
+ ai_face();
+
+ self.touch = Dog_JumpTouch;
+ 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;
+};
+
+void() dog_leap3 =[ $leap3, dog_leap4 ] {};
+void() dog_leap4 =[ $leap4, dog_leap5 ] {};
+void() dog_leap5 =[ $leap5, dog_leap6 ] {};
+void() dog_leap6 =[ $leap6, dog_leap7 ] {};
+void() dog_leap7 =[ $leap7, dog_leap8 ] {};
+void() dog_leap8 =[ $leap8, dog_leap9 ] {};
+void() dog_leap9 =[ $leap9, dog_leap9 ] {};
+
+void() dog_pain1 =[ $pain1 , dog_pain2 ] {};
+void() dog_pain2 =[ $pain2 , dog_pain3 ] {};
+void() dog_pain3 =[ $pain3 , dog_pain4 ] {};
+void() dog_pain4 =[ $pain4 , dog_pain5 ] {};
+void() dog_pain5 =[ $pain5 , dog_pain6 ] {};
+void() dog_pain6 =[ $pain6 , dog_run1 ] {};
+
+void() dog_painb1 =[ $painb1 , dog_painb2 ] {};
+void() dog_painb2 =[ $painb2 , dog_painb3 ] {};
+void() dog_painb3 =[ $painb3 , dog_painb4 ] {ai_pain(4);};
+void() dog_painb4 =[ $painb4 , dog_painb5 ] {ai_pain(12);};
+void() dog_painb5 =[ $painb5 , dog_painb6 ] {ai_pain(12);};
+void() dog_painb6 =[ $painb6 , dog_painb7 ] {ai_pain(2);};
+void() dog_painb7 =[ $painb7 , dog_painb8 ] {};
+void() dog_painb8 =[ $painb8 , dog_painb9 ] {ai_pain(4);};
+void() dog_painb9 =[ $painb9 , dog_painb10 ] {};
+void() dog_painb10 =[ $painb10 , dog_painb11 ] {ai_pain(10);};
+void() dog_painb11 =[ $painb11 , dog_painb12 ] {};
+void() dog_painb12 =[ $painb12 , dog_painb13 ] {};
+void() dog_painb13 =[ $painb13 , dog_painb14 ] {};
+void() dog_painb14 =[ $painb14 , dog_painb15 ] {};
+void() dog_painb15 =[ $painb15 , dog_painb16 ] {};
+void() dog_painb16 =[ $painb16 , dog_run1 ] {};
+
+void() dog_pain =
+{
+ sound (self, CHAN_VOICE, "wizard/wpain.wav", 1, ATTN_NORM);
+
+ if (random() > 0.5)
+ dog_pain1 ();
+ else
+ dog_painb1 ();
+};
+
+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 ] {};
+
+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 ] {};
+
+
+void() dog_die =
+{
+// check for gib
+ if (self.health < -35)
+ {
+ sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
+ ThrowGib ("progs/gib3.mdl", self.health);
+ ThrowGib ("progs/gib3.mdl", self.health);
+ ThrowGib ("progs/gib3.mdl", self.health);
+ ThrowHead ("progs/h_dog.mdl", self.health);
+ return;
+ }
+
+// regular death
+ sound (self, CHAN_VOICE, "wizard/wdeath.wav", 1, ATTN_NORM);
+ self.solid = SOLID_NOT;
+
+ if (random() > 0.5)
+ dog_die1 ();
+ else
+ dog_dieb1 ();
+};
+
+//============================================================================
+
+/*
+==============
+CheckDogMelee
+
+Returns TRUE if a melee attack would hit right now
+==============
+*/
+float() CheckDogMelee =
+{
+ if (enemy_range == RANGE_MELEE)
+ { // FIXME: check canreach
+ self.attack_state = AS_MELEE;
+ return TRUE;
+ }
+ return FALSE;
+};
+
+/*
+==============
+CheckDogJump
+
+==============
+*/
+float() CheckDogJump =
+{
+ local vector dist;
+ local float d;
+
+ if (self.origin_z + self.mins_z > self.enemy.origin_z + self.enemy.mins_z
+ + 0.75 * self.enemy.size_z)
+ return FALSE;
+
+ if (self.origin_z + self.maxs_z < self.enemy.origin_z + self.enemy.mins_z
+ + 0.25 * self.enemy.size_z)
+ return FALSE;
+
+ dist = self.enemy.origin - self.origin;
+ dist_z = 0;
+
+ d = vlen(dist);
+
+ if (d < 80)
+ return FALSE;
+
+ if (d > 150)
+ return FALSE;
+
+ return TRUE;
+};
+
+float() DogCheckAttack =
+{
+// if close enough for slashing, go for it
+ if (CheckDogMelee ())
+ {
+ self.attack_state = AS_MELEE;
+ return TRUE;
+ }
+
+ if (CheckDogJump ())
+ {
+ self.attack_state = AS_MISSILE;
+ return TRUE;
+ }
+
+ return FALSE;
+};
+
+
+
+//===========================================================================
+
+/*QUAKED monster_dog (1 0 0) (-32 -32 -24) (32 32 40) Ambush
+
+*/
+void(vector org) monster_dog =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+ precache_model ("progs/metroid.mdl");
+
+ precache_sound ("dog/dattack1.wav");
+ precache_sound ("dog/ddeath.wav");
+ precache_sound ("dog/dpain1.wav");
+ precache_sound ("dog/dsight.wav");
+ precache_sound ("dog/idle.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/metroid.mdl");
+
+ setsize (self, '-16 -16 -32', '16 16 20');
+ self.health = 400;
+
+ self.th_stand = dog_stand1;
+ self.th_walk = dog_walk1;
+ self.th_run = dog_run1;
+ self.th_pain = dog_pain;
+ self.th_die = dog_die;
+ self.th_melee = dog_atta1;
+ self.th_missile = dog_leap1;
+
+ walkmonster_start();
+};
+
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/doors.qc b/r17/Revamped src/Revamped QC/Primeqc4/doors.qc
new file mode 100755
index 00000000..5a85ca86
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/doors.qc
@@ -0,0 +1,778 @@
+
+float DOOR_START_OPEN = 1;
+float DOOR_DONT_LINK = 4;
+float DOOR_GOLD_KEY = 8;
+float DOOR_SILVER_KEY = 16;
+float DOOR_TOGGLE = 32;
+
+/*
+
+Doors are similar to buttons, but can spawn a fat trigger field around them
+to open without a touch, and they link together to form simultanious
+double/quad doors.
+
+Door.owner is the master door. If there is only one door, it points to itself.
+If multiple doors, all will point to a single one.
+
+Door.enemy chains from the master door through all doors linked in the chain.
+
+*/
+
+/*
+=============================================================================
+
+THINK FUNCTIONS
+
+=============================================================================
+*/
+
+void() door_go_down;
+void() door_go_up;
+
+void() door_blocked =
+{
+ T_Damage (other, self, self, self.dmg);
+
+// if a door has a negative wait, it would never come back if blocked,
+// so let it just squash the object to death real fast
+ if (self.wait >= 0)
+ {
+ if (self.state == STATE_DOWN)
+ door_go_up ();
+ else
+ door_go_down ();
+ }
+};
+
+
+void() door_hit_top =
+{
+ sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
+ self.state = STATE_TOP;
+ if (self.spawnflags & DOOR_TOGGLE)
+ return; // don't come down automatically
+ self.think = door_go_down;
+ self.nextthink = self.ltime + self.wait;
+};
+
+void() door_hit_bottom =
+{
+ sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
+ self.state = STATE_BOTTOM;
+};
+
+void() door_go_down =
+{
+ sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
+ if (self.max_health)
+ {
+ self.takedamage = DAMAGE_YES;
+ self.health = self.max_health;
+ }
+
+ self.state = STATE_DOWN;
+ SUB_CalcMove (self.pos1, self.speed, door_hit_bottom);
+};
+
+void() door_go_up =
+{
+ if (self.state == STATE_UP)
+ return; // allready going up
+
+ if (self.state == STATE_TOP)
+ { // reset top wait time
+ self.nextthink = self.ltime + self.wait;
+ return;
+ }
+
+ sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
+ self.state = STATE_UP;
+ SUB_CalcMove (self.pos2, self.speed, door_hit_top);
+
+ SUB_UseTargets();
+};
+
+
+/*
+=============================================================================
+
+ACTIVATION FUNCTIONS
+
+=============================================================================
+*/
+
+void() door_fire =
+{
+ local entity oself;
+ local entity starte;
+
+ if (self.owner != self)
+ objerror ("door_fire: self.owner != self");
+
+// play use key sound
+
+ if (self.items)
+ sound (self, CHAN_VOICE, self.noise4, 1, ATTN_NORM);
+
+ self.message = string_null; // no more message
+ oself = self;
+
+ if (self.spawnflags & DOOR_TOGGLE)
+ {
+ if (self.state == STATE_UP || self.state == STATE_TOP)
+ {
+ starte = self;
+ do
+ {
+ door_go_down ();
+ self = self.enemy;
+ } while ( (self != starte) && (self != world) );
+ self = oself;
+ return;
+ }
+ }
+
+// trigger all paired doors
+ starte = self;
+ do
+ {
+ door_go_up ();
+ self = self.enemy;
+ } while ( (self != starte) && (self != world) );
+ self = oself;
+};
+
+
+void() door_use =
+{
+ local entity oself;
+
+ self.message = ""; // door message are for touch only
+ self.owner.message = "";
+ self.enemy.message = "";
+ oself = self;
+ self = self.owner;
+ door_fire ();
+ self = oself;
+};
+
+
+void() door_trigger_touch =
+{
+ if (other.health <= 0)
+ return;
+
+ if (time < self.attack_finished)
+ return;
+ self.attack_finished = time + 1;
+
+ activator = other;
+
+ self = self.owner;
+ door_use ();
+};
+
+
+void() door_killed =
+{
+ local entity oself;
+
+ oself = self;
+ self = self.owner;
+ self.health = self.max_health;
+ self.takedamage = DAMAGE_NO; // wil be reset upon return
+ door_use ();
+ self = oself;
+};
+
+
+/*
+================
+door_touch
+
+Prints messages and opens key doors
+================
+*/
+void() door_touch =
+{
+ if (other.classname != "player")
+ return;
+ if (self.owner.attack_finished > time)
+ return;
+
+ self.owner.attack_finished = time + 2;
+
+ if (self.owner.message != "")
+ {
+ centerprint (other, self.owner.message);
+ sound (other, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM);
+ }
+
+// key door stuff
+ if (!self.items)
+ return;
+
+// FIXME: blink key on player's status bar
+ if ( (self.items & other.items) != self.items )
+ {
+ if (self.owner.items == IT_KEY1)
+ {
+ if (world.worldtype == 2)
+ {
+ centerprint (other, "You need the silver keycard");
+ sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
+ }
+ else if (world.worldtype == 1)
+ {
+ centerprint (other, "You need the silver runekey");
+ sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
+ }
+ else if (world.worldtype == 0)
+ {
+ centerprint (other, "You need the silver key");
+ sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
+ }
+ }
+ else
+ {
+ if (world.worldtype == 2)
+ {
+ centerprint (other, "You need the gold keycard");
+ sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
+ }
+ else if (world.worldtype == 1)
+ {
+ centerprint (other, "You need the gold runekey");
+ sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
+ }
+ else if (world.worldtype == 0)
+ {
+ centerprint (other, "You need the gold key");
+ sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
+ }
+ }
+ return;
+ }
+
+ other.items = other.items - self.items;
+ self.touch = SUB_Null;
+ if (self.enemy)
+ self.enemy.touch = SUB_Null; // get paired door
+ door_use ();
+};
+
+/*
+=============================================================================
+
+SPAWNING FUNCTIONS
+
+=============================================================================
+*/
+
+
+entity(vector fmins, vector fmaxs) spawn_field =
+{
+ local entity trigger;
+ local vector t1, t2;
+
+ trigger = spawn();
+ trigger.movetype = MOVETYPE_NONE;
+ trigger.solid = SOLID_TRIGGER;
+ trigger.owner = self;
+ trigger.touch = door_trigger_touch;
+
+ t1 = fmins;
+ t2 = fmaxs;
+ setsize (trigger, t1 - '60 60 8', t2 + '60 60 8');
+ return (trigger);
+};
+
+
+float (entity e1, entity e2) EntitiesTouching =
+{
+ if (e1.mins_x > e2.maxs_x)
+ return FALSE;
+ if (e1.mins_y > e2.maxs_y)
+ return FALSE;
+ if (e1.mins_z > e2.maxs_z)
+ return FALSE;
+ if (e1.maxs_x < e2.mins_x)
+ return FALSE;
+ if (e1.maxs_y < e2.mins_y)
+ return FALSE;
+ if (e1.maxs_z < e2.mins_z)
+ return FALSE;
+ return TRUE;
+};
+
+
+/*
+=============
+LinkDoors
+
+
+=============
+*/
+void() LinkDoors =
+{
+ local entity t, starte;
+ local vector cmins, cmaxs;
+
+ if (self.enemy)
+ return; // already linked by another door
+ if (self.spawnflags & 4)
+ {
+ self.owner = self.enemy = self;
+ return; // don't want to link this door
+ }
+
+ cmins = self.mins;
+ cmaxs = self.maxs;
+
+ starte = self;
+ t = self;
+
+ do
+ {
+ self.owner = starte; // master door
+
+ if (self.health)
+ starte.health = self.health;
+ if (self.targetname)
+ starte.targetname = self.targetname;
+ if (self.message != "")
+ starte.message = self.message;
+
+ t = find (t, classname, self.classname);
+ if (!t)
+ {
+ self.enemy = starte; // make the chain a loop
+
+ // shootable, fired, or key doors just needed the owner/enemy links,
+ // they don't spawn a field
+
+ self = self.owner;
+
+ if (self.health)
+ return;
+ if (self.targetname)
+ return;
+ if (self.items)
+ return;
+
+ self.owner.trigger_field = spawn_field(cmins, cmaxs);
+
+ return;
+ }
+
+ if (EntitiesTouching(self,t))
+ {
+ if (t.enemy)
+ objerror ("cross connected doors");
+
+ self.enemy = t;
+ self = t;
+
+ if (t.mins_x < cmins_x)
+ cmins_x = t.mins_x;
+ if (t.mins_y < cmins_y)
+ cmins_y = t.mins_y;
+ if (t.mins_z < cmins_z)
+ cmins_z = t.mins_z;
+ if (t.maxs_x > cmaxs_x)
+ cmaxs_x = t.maxs_x;
+ if (t.maxs_y > cmaxs_y)
+ cmaxs_y = t.maxs_y;
+ if (t.maxs_z > cmaxs_z)
+ cmaxs_z = t.maxs_z;
+ }
+ } while (1 );
+
+};
+
+
+/*QUAKED func_door (0 .5 .8) ? START_OPEN x DOOR_DONT_LINK GOLD_KEY SILVER_KEY TOGGLE
+if two doors touch, they are assumed to be connected and operate as a unit.
+
+TOGGLE causes the door to wait in both the start and end states for a trigger event.
+
+START_OPEN causes the door to move to its destination when spawned, and operate in reverse. It is used to temporarily or permanently close off an area when triggered (not usefull for touch or takedamage doors).
+
+Key doors are allways wait -1.
+
+"message" is printed when the door is touched if it is a trigger door and it hasn't been fired yet
+"angle" determines the opening direction
+"targetname" if set, no touch field will be spawned and a remote button or trigger field activates the door.
+"health" if set, door must be shot open
+"speed" movement speed (100 default)
+"wait" wait before returning (3 default, -1 = never return)
+"lip" lip remaining at end of move (8 default)
+"dmg" damage to inflict when blocked (2 default)
+"sounds"
+0) no sound
+1) stone
+2) base
+3) stone chain
+4) screechy metal
+*/
+
+void() func_door =
+
+{
+
+ if (world.worldtype == 0)
+ {
+ precache_sound ("doors/medtry.wav");
+ precache_sound ("doors/meduse.wav");
+ self.noise3 = "doors/medtry.wav";
+ self.noise4 = "doors/meduse.wav";
+ }
+ else if (world.worldtype == 1)
+ {
+ precache_sound ("doors/runetry.wav");
+ precache_sound ("doors/runeuse.wav");
+ self.noise3 = "doors/runetry.wav";
+ self.noise4 = "doors/runeuse.wav";
+ }
+ else if (world.worldtype == 2)
+ {
+ precache_sound ("doors/basetry.wav");
+ precache_sound ("doors/baseuse.wav");
+ self.noise3 = "doors/basetry.wav";
+ self.noise4 = "doors/baseuse.wav";
+ }
+ else
+ {
+ dprint ("no worldtype set!\n");
+ }
+ if (self.sounds == 0)
+ {
+ precache_sound ("misc/null.wav");
+ precache_sound ("misc/null.wav");
+ self.noise1 = "misc/null.wav";
+ self.noise2 = "misc/null.wav";
+ }
+ if (self.sounds == 1)
+ {
+ precache_sound ("doors/drclos4.wav");
+ precache_sound ("doors/doormv1.wav");
+ self.noise1 = "doors/drclos4.wav";
+ self.noise2 = "doors/doormv1.wav";
+ }
+ if (self.sounds == 2)
+ {
+ precache_sound ("doors/hydro1.wav");
+ precache_sound ("doors/hydro2.wav");
+ self.noise2 = "doors/hydro1.wav";
+ self.noise1 = "doors/hydro2.wav";
+ }
+ if (self.sounds == 3)
+ {
+ precache_sound ("doors/stndr1.wav");
+ precache_sound ("doors/stndr2.wav");
+ self.noise2 = "doors/stndr1.wav";
+ self.noise1 = "doors/stndr2.wav";
+ }
+ if (self.sounds == 4)
+ {
+ precache_sound ("doors/ddoor1.wav");
+ precache_sound ("doors/ddoor2.wav");
+ self.noise1 = "doors/ddoor2.wav";
+ self.noise2 = "doors/ddoor1.wav";
+ }
+
+
+ SetMovedir ();
+
+ self.max_health = self.health;
+ self.solid = SOLID_BSP;
+ self.movetype = MOVETYPE_PUSH;
+ setorigin (self, self.origin);
+ setmodel (self, self.model);
+ self.classname = "door";
+
+ self.blocked = door_blocked;
+ self.use = door_use;
+
+ if (self.spawnflags & DOOR_SILVER_KEY)
+ self.items = IT_KEY1;
+ if (self.spawnflags & DOOR_GOLD_KEY)
+ self.items = IT_KEY2;
+
+ if (!self.speed)
+ self.speed = 100;
+ if (!self.wait)
+ self.wait = 3;
+ if (!self.lip)
+ self.lip = 8;
+ if (!self.dmg)
+ self.dmg = 2;
+
+ self.pos1 = self.origin;
+ self.pos2 = self.pos1 + self.movedir*(fabs(self.movedir*self.size) - self.lip);
+
+// DOOR_START_OPEN is to allow an entity to be lighted in the closed position
+// but spawn in the open position
+ if (self.spawnflags & DOOR_START_OPEN)
+ {
+ setorigin (self, self.pos2);
+ self.pos2 = self.pos1;
+ self.pos1 = self.origin;
+ }
+
+ self.state = STATE_BOTTOM;
+
+ if (self.health)
+ {
+ self.takedamage = DAMAGE_YES;
+ self.th_die = door_killed;
+ }
+
+ if (self.items)
+ self.wait = -1;
+
+ self.touch = door_touch;
+
+// LinkDoors can't be done until all of the doors have been spawned, so
+// the sizes can be detected properly.
+ self.think = LinkDoors;
+ self.nextthink = self.ltime + 0.1;
+};
+
+/*
+=============================================================================
+
+SECRET DOORS
+
+=============================================================================
+*/
+
+void() fd_secret_move1;
+void() fd_secret_move2;
+void() fd_secret_move3;
+void() fd_secret_move4;
+void() fd_secret_move5;
+void() fd_secret_move6;
+void() fd_secret_done;
+
+float SECRET_OPEN_ONCE = 1; // stays open
+float SECRET_1ST_LEFT = 2; // 1st move is left of arrow
+float SECRET_1ST_DOWN = 4; // 1st move is down from arrow
+float SECRET_NO_SHOOT = 8; // only opened by trigger
+float SECRET_YES_SHOOT = 16; // shootable even if targeted
+
+
+void () fd_secret_use =
+{
+ local float temp;
+
+ self.health = 10000;
+
+ // exit if still moving around...
+ if (self.origin != self.oldorigin)
+ return;
+
+ self.message = string_null; // no more message
+
+ SUB_UseTargets(); // fire all targets / killtargets
+
+ if (!(self.spawnflags & SECRET_NO_SHOOT))
+ {
+ self.th_pain = SUB_Null;
+ self.takedamage = DAMAGE_NO;
+ }
+ self.velocity = '0 0 0';
+
+ // Make a sound, wait a little...
+
+ sound(self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
+ self.nextthink = self.ltime + 0.1;
+
+ temp = 1 - (self.spawnflags & SECRET_1ST_LEFT); // 1 or -1
+ makevectors(self.mangle);
+
+ if (!self.t_width)
+ {
+ if (self.spawnflags & SECRET_1ST_DOWN)
+ self. t_width = fabs(v_up * self.size);
+ else
+ self. t_width = fabs(v_right * self.size);
+ }
+
+ if (!self.t_length)
+ self. t_length = fabs(v_forward * self.size);
+
+ if (self.spawnflags & SECRET_1ST_DOWN)
+ self.dest1 = self.origin - v_up * self.t_width;
+ else
+ self.dest1 = self.origin + v_right * (self.t_width * temp);
+
+ self.dest2 = self.dest1 + v_forward * self.t_length;
+ SUB_CalcMove(self.dest1, self.speed, fd_secret_move1);
+ sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
+};
+
+// Wait after first movement...
+void () fd_secret_move1 =
+{
+ self.nextthink = self.ltime + 1.0;
+ self.think = fd_secret_move2;
+ sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
+};
+
+// Start moving sideways w/sound...
+void () fd_secret_move2 =
+{
+ sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
+ SUB_CalcMove(self.dest2, self.speed, fd_secret_move3);
+};
+
+// Wait here until time to go back...
+void () fd_secret_move3 =
+{
+ sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
+ if (!(self.spawnflags & SECRET_OPEN_ONCE))
+ {
+ self.nextthink = self.ltime + self.wait;
+ self.think = fd_secret_move4;
+ }
+};
+
+// Move backward...
+void () fd_secret_move4 =
+{
+ sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
+ SUB_CalcMove(self.dest1, self.speed, fd_secret_move5);
+};
+
+// Wait 1 second...
+void () fd_secret_move5 =
+{
+ self.nextthink = self.ltime + 1.0;
+ self.think = fd_secret_move6;
+ sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
+};
+
+void () fd_secret_move6 =
+{
+ sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
+ SUB_CalcMove(self.oldorigin, self.speed, fd_secret_done);
+};
+
+void () fd_secret_done =
+{
+ if (!self.targetname || self.spawnflags&SECRET_YES_SHOOT)
+ {
+ self.health = 10000;
+ self.takedamage = DAMAGE_YES;
+ self.th_pain = fd_secret_use;
+ }
+ sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
+};
+
+void () secret_blocked =
+{
+ if (time < self.attack_finished)
+ return;
+ self.attack_finished = time + 0.5;
+ T_Damage (other, self, self, self.dmg);
+};
+
+/*
+================
+secret_touch
+
+Prints messages
+================
+*/
+void() secret_touch =
+{
+ if (other.classname != "player")
+ return;
+ if (self.attack_finished > time)
+ return;
+
+ self.attack_finished = time + 2;
+
+ if (self.message)
+ {
+ centerprint (other, self.message);
+ sound (other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM);
+ }
+};
+
+
+/*QUAKED func_door_secret (0 .5 .8) ? open_once 1st_left 1st_down no_shoot always_shoot
+Basic secret door. Slides back, then to the side. Angle determines direction.
+wait = # of seconds before coming back
+1st_left = 1st move is left of arrow
+1st_down = 1st move is down from arrow
+always_shoot = even if targeted, keep shootable
+t_width = override WIDTH to move back (or height if going down)
+t_length = override LENGTH to move sideways
+"dmg" damage to inflict when blocked (2 default)
+
+If a secret door has a targetname, it will only be opened by it's botton or trigger, not by damage.
+"sounds"
+1) medieval
+2) metal
+3) base
+*/
+
+void () func_door_secret =
+{
+ if (self.sounds == 0)
+ self.sounds = 3;
+ if (self.sounds == 1)
+ {
+ precache_sound ("doors/latch2.wav");
+ precache_sound ("doors/winch2.wav");
+ precache_sound ("doors/drclos4.wav");
+ self.noise1 = "doors/latch2.wav";
+ self.noise2 = "doors/winch2.wav";
+ self.noise3 = "doors/drclos4.wav";
+ }
+ if (self.sounds == 2)
+ {
+ precache_sound ("doors/airdoor1.wav");
+ precache_sound ("doors/airdoor2.wav");
+ self.noise2 = "doors/airdoor1.wav";
+ self.noise1 = "doors/airdoor2.wav";
+ self.noise3 = "doors/airdoor2.wav";
+ }
+ if (self.sounds == 3)
+ {
+ precache_sound ("doors/basesec1.wav");
+ precache_sound ("doors/basesec2.wav");
+ self.noise2 = "doors/basesec1.wav";
+ self.noise1 = "doors/basesec2.wav";
+ self.noise3 = "doors/basesec2.wav";
+ }
+
+ if (!self.dmg)
+ self.dmg = 2;
+
+ // Magic formula...
+ self.mangle = self.angles;
+ self.angles = '0 0 0';
+ self.solid = SOLID_BSP;
+ self.movetype = MOVETYPE_PUSH;
+ self.classname = "door";
+ setmodel (self, self.model);
+ setorigin (self, self.origin);
+
+ self.touch = secret_touch;
+ self.blocked = secret_blocked;
+ self.speed = 50;
+ self.use = fd_secret_use;
+ if ( !self.targetname || self.spawnflags&SECRET_YES_SHOOT)
+ {
+ self.health = 10000;
+ self.takedamage = DAMAGE_YES;
+ self.th_pain = fd_secret_use;
+ self.th_die = fd_secret_use;
+ }
+ self.oldorigin = self.origin;
+ if (!self.wait)
+ self.wait = 5; // 5 seconds before closing
+};
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/effects.qc b/r17/Revamped src/Revamped QC/Primeqc4/effects.qc
new file mode 100755
index 00000000..293a8f23
Binary files /dev/null and b/r17/Revamped src/Revamped QC/Primeqc4/effects.qc differ
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/enforcer.qc b/r17/Revamped src/Revamped QC/Primeqc4/enforcer.qc
new file mode 100755
index 00000000..2e520190
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/enforcer.qc
@@ -0,0 +1,349 @@
+/*
+==============================================================================
+
+SOLDIER / PLAYER
+
+==============================================================================
+*/
+
+$cd id1/models/enforcer
+$origin 0 -6 24
+$base base
+$skin skin
+
+$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7
+
+$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9 walk10
+$frame walk11 walk12 walk13 walk14 walk15 walk16
+
+$frame run1 run2 run3 run4 run5 run6 run7 run8
+
+$frame attack1 attack2 attack3 attack4 attack5 attack6
+$frame attack7 attack8 attack9 attack10
+
+$frame death1 death2 death3 death4 death5 death6 death7 death8
+$frame death9 death10 death11 death12 death13 death14
+
+$frame fdeath1 fdeath2 fdeath3 fdeath4 fdeath5 fdeath6 fdeath7 fdeath8
+$frame fdeath9 fdeath10 fdeath11
+
+$frame paina1 paina2 paina3 paina4
+
+$frame painb1 painb2 painb3 painb4 painb5
+
+$frame painc1 painc2 painc3 painc4 painc5 painc6 painc7 painc8
+
+$frame paind1 paind2 paind3 paind4 paind5 paind6 paind7 paind8
+$frame paind9 paind10 paind11 paind12 paind13 paind14 paind15 paind16
+$frame paind17 paind18 paind19
+
+
+void() Laser_Touch =
+{
+ local vector org;
+
+ if (other == self.owner)
+ return; // don't explode on owner
+
+ if (pointcontents(self.origin) == CONTENT_SKY)
+ {
+ remove(self);
+ return;
+ }
+
+ sound (self, CHAN_WEAPON, "enforcer/enfstop.wav", 1, ATTN_STATIC);
+ org = self.origin - 8*normalize(self.velocity);
+
+ if (other.health)
+ {
+ SpawnBlood (org, self.velocity*0.2, 15);
+ T_Damage (other, self, self.owner, 15);
+ }
+ else
+ {
+ WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteByte (MSG_BROADCAST, TE_GUNSHOT);
+ WriteCoord (MSG_BROADCAST, org_x);
+ WriteCoord (MSG_BROADCAST, org_y);
+ WriteCoord (MSG_BROADCAST, org_z);
+ }
+
+ remove(self);
+};
+
+void(vector org, vector vec) LaunchLaser =
+{
+ if (self.classname == "monster_enforcer")
+ sound (self, CHAN_WEAPON, "enforcer/enfire.wav", 1, ATTN_NORM);
+
+ vec = normalize(vec);
+
+ newmis = spawn();
+ newmis.owner = self;
+ newmis.movetype = MOVETYPE_FLY;
+ newmis.solid = SOLID_BBOX;
+ newmis.effects = EF_DIMLIGHT;
+
+ setmodel (newmis, "progs/laser.mdl");
+ setsize (newmis, '0 0 0', '0 0 0');
+
+ setorigin (newmis, org);
+
+ newmis.velocity = vec * 600;
+ newmis.angles = vectoangles(newmis.velocity);
+
+ newmis.nextthink = time + 5;
+ newmis.think = SUB_Remove;
+ newmis.touch = Laser_Touch;
+};
+
+
+
+void() enforcer_fire =
+{
+ local vector org;
+
+ self.effects = self.effects | EF_MUZZLEFLASH;
+ makevectors (self.angles);
+
+ org = self.origin + v_forward * 30 + v_right * 8.5 + '0 0 16';
+
+ LaunchLaser(org, self.enemy.origin - self.origin);
+};
+
+//============================================================================
+
+void() enf_stand1 =[ $stand1, enf_stand2 ] {ai_stand();};
+void() enf_stand2 =[ $stand2, enf_stand3 ] {ai_stand();};
+void() enf_stand3 =[ $stand3, enf_stand4 ] {ai_stand();};
+void() enf_stand4 =[ $stand4, enf_stand5 ] {ai_stand();};
+void() enf_stand5 =[ $stand5, enf_stand6 ] {ai_stand();};
+void() enf_stand6 =[ $stand6, enf_stand7 ] {ai_stand();};
+void() enf_stand7 =[ $stand7, enf_stand1 ] {ai_stand();};
+
+void() enf_walk1 =[ $walk1 , enf_walk2 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "enforcer/idle1.wav", 1, ATTN_IDLE);
+ai_walk(2);};
+void() enf_walk2 =[ $walk2 , enf_walk3 ] {ai_walk(4);};
+void() enf_walk3 =[ $walk3 , enf_walk4 ] {ai_walk(4);};
+void() enf_walk4 =[ $walk4 , enf_walk5 ] {ai_walk(3);};
+void() enf_walk5 =[ $walk5 , enf_walk6 ] {ai_walk(1);};
+void() enf_walk6 =[ $walk6 , enf_walk7 ] {ai_walk(2);};
+void() enf_walk7 =[ $walk7 , enf_walk8 ] {ai_walk(2);};
+void() enf_walk8 =[ $walk8 , enf_walk9 ] {ai_walk(1);};
+void() enf_walk9 =[ $walk9 , enf_walk10 ] {ai_walk(2);};
+void() enf_walk10 =[ $walk10, enf_walk11 ] {ai_walk(4);};
+void() enf_walk11 =[ $walk11, enf_walk12 ] {ai_walk(4);};
+void() enf_walk12 =[ $walk12, enf_walk13 ] {ai_walk(1);};
+void() enf_walk13 =[ $walk13, enf_walk14 ] {ai_walk(2);};
+void() enf_walk14 =[ $walk14, enf_walk15 ] {ai_walk(3);};
+void() enf_walk15 =[ $walk15, enf_walk16 ] {ai_walk(4);};
+void() enf_walk16 =[ $walk16, enf_walk1 ] {ai_walk(2);};
+
+void() enf_run1 =[ $run1 , enf_run2 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "enforcer/idle1.wav", 1, ATTN_IDLE);
+ai_run(18);};
+void() enf_run2 =[ $run2 , enf_run3 ] {ai_run(14);};
+void() enf_run3 =[ $run3 , enf_run4 ] {ai_run(7);};
+void() enf_run4 =[ $run4 , enf_run5 ] {ai_run(12);};
+void() enf_run5 =[ $run5 , enf_run6 ] {ai_run(14);};
+void() enf_run6 =[ $run6 , enf_run7 ] {ai_run(14);};
+void() enf_run7 =[ $run7 , enf_run8 ] {ai_run(7);};
+void() enf_run8 =[ $run8 , enf_run1 ] {ai_run(11);};
+
+void() enf_atk1 =[ $attack1, enf_atk2 ] {ai_face();};
+void() enf_atk2 =[ $attack2, enf_atk3 ] {ai_face();};
+void() enf_atk3 =[ $attack3, enf_atk4 ] {ai_face();};
+void() enf_atk4 =[ $attack4, enf_atk5 ] {ai_face();};
+void() enf_atk5 =[ $attack5, enf_atk6 ] {ai_face();};
+void() enf_atk6 =[ $attack6, enf_atk7 ] {enforcer_fire();};
+void() enf_atk7 =[ $attack7, enf_atk8 ] {ai_face();};
+void() enf_atk8 =[ $attack8, enf_atk9 ] {ai_face();};
+void() enf_atk9 =[ $attack5, enf_atk10 ] {ai_face();};
+void() enf_atk10 =[ $attack6, enf_atk11 ] {enforcer_fire();};
+void() enf_atk11 =[ $attack7, enf_atk12 ] {ai_face();};
+void() enf_atk12 =[ $attack8, enf_atk13 ] {ai_face();};
+void() enf_atk13 =[ $attack9, enf_atk14 ] {ai_face();};
+void() enf_atk14 =[ $attack10, enf_run1 ] {ai_face();
+SUB_CheckRefire (enf_atk1);
+};
+
+void() enf_paina1 =[ $paina1, enf_paina2 ] {};
+void() enf_paina2 =[ $paina2, enf_paina3 ] {};
+void() enf_paina3 =[ $paina3, enf_paina4 ] {};
+void() enf_paina4 =[ $paina4, enf_run1 ] {};
+
+void() enf_painb1 =[ $painb1, enf_painb2 ] {};
+void() enf_painb2 =[ $painb2, enf_painb3 ] {};
+void() enf_painb3 =[ $painb3, enf_painb4 ] {};
+void() enf_painb4 =[ $painb4, enf_painb5 ] {};
+void() enf_painb5 =[ $painb5, enf_run1 ] {};
+
+void() enf_painc1 =[ $painc1, enf_painc2 ] {};
+void() enf_painc2 =[ $painc2, enf_painc3 ] {};
+void() enf_painc3 =[ $painc3, enf_painc4 ] {};
+void() enf_painc4 =[ $painc4, enf_painc5 ] {};
+void() enf_painc5 =[ $painc5, enf_painc6 ] {};
+void() enf_painc6 =[ $painc6, enf_painc7 ] {};
+void() enf_painc7 =[ $painc7, enf_painc8 ] {};
+void() enf_painc8 =[ $painc8, enf_run1 ] {};
+
+void() enf_paind1 =[ $paind1, enf_paind2 ] {};
+void() enf_paind2 =[ $paind2, enf_paind3 ] {};
+void() enf_paind3 =[ $paind3, enf_paind4 ] {};
+void() enf_paind4 =[ $paind4, enf_paind5 ] {ai_painforward(2);};
+void() enf_paind5 =[ $paind5, enf_paind6 ] {ai_painforward(1);};
+void() enf_paind6 =[ $paind6, enf_paind7 ] {};
+void() enf_paind7 =[ $paind7, enf_paind8 ] {};
+void() enf_paind8 =[ $paind8, enf_paind9 ] {};
+void() enf_paind9 =[ $paind9, enf_paind10 ] {};
+void() enf_paind10 =[ $paind10, enf_paind11 ] {};
+void() enf_paind11 =[ $paind11, enf_paind12 ] {ai_painforward(1);};
+void() enf_paind12 =[ $paind12, enf_paind13 ] {ai_painforward(1);};
+void() enf_paind13 =[ $paind13, enf_paind14 ] {ai_painforward(1);};
+void() enf_paind14 =[ $paind14, enf_paind15 ] {};
+void() enf_paind15 =[ $paind15, enf_paind16 ] {};
+void() enf_paind16 =[ $paind16, enf_paind17 ] {ai_pain(1);};
+void() enf_paind17 =[ $paind17, enf_paind18 ] {ai_pain(1);};
+void() enf_paind18 =[ $paind18, enf_paind19 ] {};
+void() enf_paind19 =[ $paind19, enf_run1 ] {};
+
+void(entity attacker, float damage) enf_pain =
+{
+ local float r;
+
+ r = random ();
+ if (self.pain_finished > time)
+ return;
+
+
+ if (r < 0.5)
+ sound (self, CHAN_VOICE, "enforcer/pain1.wav", 1, ATTN_NORM);
+ else
+ sound (self, CHAN_VOICE, "enforcer/pain2.wav", 1, ATTN_NORM);
+
+ if (r < 0.2)
+ {
+ self.pain_finished = time + 1;
+ enf_paina1 ();
+ }
+ else if (r < 0.4)
+ {
+ self.pain_finished = time + 1;
+ enf_painb1 ();
+ }
+ else if (r < 0.7)
+ {
+ self.pain_finished = time + 1;
+ enf_painc1 ();
+ }
+ else
+ {
+ self.pain_finished = time + 2;
+ enf_paind1 ();
+ }
+};
+
+//============================================================================
+
+
+
+
+void() enf_die1 =[ $death1, enf_die2 ] {};
+void() enf_die2 =[ $death2, enf_die3 ] {};
+void() enf_die3 =[ $death3, enf_die4 ]
+{self.solid = SOLID_NOT;self.ammo_cells = 5;DropBackpack();};
+void() enf_die4 =[ $death4, enf_die5 ] {ai_forward(14);};
+void() enf_die5 =[ $death5, enf_die6 ] {ai_forward(2);};
+void() enf_die6 =[ $death6, enf_die7 ] {};
+void() enf_die7 =[ $death7, enf_die8 ] {};
+void() enf_die8 =[ $death8, enf_die9 ] {};
+void() enf_die9 =[ $death9, enf_die10 ] {ai_forward(3);};
+void() enf_die10 =[ $death10, enf_die11 ] {ai_forward(5);};
+void() enf_die11 =[ $death11, enf_die12 ] {ai_forward(5);};
+void() enf_die12 =[ $death12, enf_die13 ] {ai_forward(5);};
+void() enf_die13 =[ $death13, enf_die14 ] {};
+void() enf_die14 =[ $death14, enf_die14 ] {};
+
+void() enf_fdie1 =[ $fdeath1, enf_fdie2 ] {
+
+};
+void() enf_fdie2 =[ $fdeath2, enf_fdie3 ] {};
+void() enf_fdie3 =[ $fdeath3, enf_fdie4 ]
+{self.solid = SOLID_NOT;self.ammo_cells = 5;DropBackpack();};
+void() enf_fdie4 =[ $fdeath4, enf_fdie5 ] {};
+void() enf_fdie5 =[ $fdeath5, enf_fdie6 ] {};
+void() enf_fdie6 =[ $fdeath6, enf_fdie7 ] {};
+void() enf_fdie7 =[ $fdeath7, enf_fdie8 ] {};
+void() enf_fdie8 =[ $fdeath8, enf_fdie9 ] {};
+void() enf_fdie9 =[ $fdeath9, enf_fdie10 ] {};
+void() enf_fdie10 =[ $fdeath10, enf_fdie11 ] {};
+void() enf_fdie11 =[ $fdeath11, enf_fdie11 ] {};
+
+
+void() enf_die =
+{
+// check for gib
+ if (self.health < -35)
+ {
+ sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
+ ThrowHead ("progs/h_mega.mdl", self.health);
+ ThrowGib ("progs/gib1.mdl", self.health);
+ ThrowGib ("progs/gib2.mdl", self.health);
+ ThrowGib ("progs/gib3.mdl", self.health);
+ return;
+ }
+
+// regular death
+ sound (self, CHAN_VOICE, "enforcer/death1.wav", 1, ATTN_NORM);
+ if (random() > 0.5)
+ enf_die1 ();
+ else
+ enf_fdie1 ();
+};
+
+
+/*QUAKED monster_enforcer (1 0 0) (-16 -16 -24) (16 16 40) Ambush
+
+*/
+void() monster_enforcer =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+ precache_model2 ("progs/enforcer.mdl");
+ precache_model2 ("progs/h_mega.mdl");
+ precache_model2 ("progs/laser.mdl");
+
+ precache_sound2 ("enforcer/death1.wav");
+ precache_sound2 ("enforcer/enfire.wav");
+ precache_sound2 ("enforcer/enfstop.wav");
+ precache_sound2 ("enforcer/idle1.wav");
+ precache_sound2 ("enforcer/pain1.wav");
+ precache_sound2 ("enforcer/pain2.wav");
+ precache_sound2 ("enforcer/sight1.wav");
+ precache_sound2 ("enforcer/sight2.wav");
+ precache_sound2 ("enforcer/sight3.wav");
+ precache_sound2 ("enforcer/sight4.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/enforcer.mdl");
+
+ setsize (self, '-16 -16 -24', '16 16 40');
+ self.health = 80;
+
+ self.th_stand = enf_stand1;
+ self.th_walk = enf_walk1;
+ self.th_run = enf_run1;
+ self.th_pain = enf_pain;
+ self.th_die = enf_die;
+ self.th_missile = enf_atk1;
+
+ walkmonster_start();
+};
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/fight.qc b/r17/Revamped src/Revamped QC/Primeqc4/fight.qc
new file mode 100755
index 00000000..4a3a4c26
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/fight.qc
@@ -0,0 +1,407 @@
+
+/*
+
+A monster is in fight mode if it thinks it can effectively attack its
+enemy.
+
+When it decides it can't attack, it goes into hunt mode.
+
+*/
+
+float(float v) anglemod;
+
+void() knight_atk1;
+void() knight_runatk1;
+void() ogre_smash1;
+void() ogre_swing1;
+
+void() sham_smash1;
+void() sham_swingr1;
+void() sham_swingl1;
+
+float() DemonCheckAttack;
+void(float side) Demon_Melee;
+
+void(vector dest) ChooseTurn;
+
+void() ai_face;
+
+
+float enemy_vis, enemy_infront, enemy_range;
+float enemy_yaw;
+
+
+void() knight_attack =
+{
+ local float len;
+
+// decide if now is a good swing time
+ len = vlen(self.enemy.origin+self.enemy.view_ofs - (self.origin+self.view_ofs));
+
+ if (len<80)
+ knight_atk1 ();
+ else
+ knight_runatk1 ();
+};
+
+//=============================================================================
+
+/*
+===========
+CheckAttack
+
+The player is in view, so decide to move or launch an attack
+Returns FALSE if movement should continue
+============
+*/
+float() CheckAttack =
+{
+ local vector spot1, spot2;
+ local entity targ;
+ local float chance;
+
+ targ = self.enemy;
+
+// see if any entities are in the way of the shot
+ spot1 = self.origin + self.view_ofs;
+ spot2 = targ.origin + targ.view_ofs;
+
+ traceline (spot1, spot2, FALSE, self);
+
+ if (trace_ent != targ)
+ return FALSE; // don't have a clear shot
+
+ if (trace_inopen && trace_inwater)
+ return FALSE; // sight line crossed contents
+
+ if (enemy_range == RANGE_MELEE)
+ { // melee attack
+ if (self.th_melee)
+ {
+ if (self.classname == "monster_knight")
+ knight_attack ();
+ else
+ self.th_melee ();
+ return TRUE;
+ }
+ }
+
+// missile attack
+ if (!self.th_missile)
+ return FALSE;
+
+ if (time < self.attack_finished)
+ return FALSE;
+
+ if (enemy_range == RANGE_FAR)
+ return FALSE;
+
+ if (enemy_range == RANGE_MELEE)
+ {
+ chance = 0.9;
+ self.attack_finished = 0;
+ }
+ else if (enemy_range == RANGE_NEAR)
+ {
+ if (self.th_melee)
+ chance = 0.2;
+ else
+ chance = 0.4;
+ }
+ else if (enemy_range == RANGE_MID)
+ {
+ if (self.th_melee)
+ chance = 0.05;
+ else
+ chance = 0.1;
+ }
+ else
+ chance = 0;
+
+ if (random () < chance)
+ {
+ self.th_missile ();
+ SUB_AttackFinished (2*random());
+ return TRUE;
+ }
+
+ return FALSE;
+};
+
+
+/*
+=============
+ai_face
+
+Stay facing the enemy
+=============
+*/
+void() ai_face =
+{
+ self.ideal_yaw = vectoyaw(self.enemy.origin - self.origin);
+ ChangeYaw ();
+};
+
+/*
+=============
+ai_charge
+
+The monster is in a melee attack, so get as close as possible to .enemy
+=============
+*/
+float (entity targ) visible;
+float(entity targ) infront;
+float(entity targ) range;
+
+void(float d) ai_charge =
+{
+ ai_face ();
+ movetogoal (d); // done in C code...
+};
+
+void() ai_charge_side =
+{
+ local vector dtemp;
+ local float heading;
+
+// aim to the left of the enemy for a flyby
+
+ self.ideal_yaw = vectoyaw(self.enemy.origin - self.origin);
+ ChangeYaw ();
+
+ makevectors (self.angles);
+ dtemp = self.enemy.origin - 30*v_right;
+ heading = vectoyaw(dtemp - self.origin);
+
+ walkmove(heading, 20);
+};
+
+
+/*
+=============
+ai_melee
+
+=============
+*/
+void() ai_melee =
+{
+ local vector delta;
+ local float ldmg;
+
+ if (!self.enemy)
+ return; // removed before stroke
+
+ delta = self.enemy.origin - self.origin;
+
+ if (vlen(delta) > 60)
+ return;
+
+ ldmg = (random() + random() + random()) * 3;
+ T_Damage (self.enemy, self, self, ldmg);
+};
+
+
+void() ai_melee_side =
+{
+ local vector delta;
+ local float ldmg;
+
+ if (!self.enemy)
+ return; // removed before stroke
+
+ ai_charge_side();
+
+ delta = self.enemy.origin - self.origin;
+
+ if (vlen(delta) > 60)
+ return;
+ if (!CanDamage (self.enemy, self))
+ return;
+ ldmg = (random() + random() + random()) * 3;
+ T_Damage (self.enemy, self, self, ldmg);
+};
+
+
+//=============================================================================
+
+/*
+===========
+SoldierCheckAttack
+
+The player is in view, so decide to move or launch an attack
+Returns FALSE if movement should continue
+============
+*/
+float() SoldierCheckAttack =
+{
+ local vector spot1, spot2;
+ local entity targ;
+ local float chance;
+
+ targ = self.enemy;
+
+// see if any entities are in the way of the shot
+ spot1 = self.origin + self.view_ofs;
+ spot2 = targ.origin + targ.view_ofs;
+
+ traceline (spot1, spot2, FALSE, self);
+
+ if (trace_inopen && trace_inwater)
+ return FALSE; // sight line crossed contents
+
+ if (trace_ent != targ)
+ return FALSE; // don't have a clear shot
+
+
+// missile attack
+ if (time < self.attack_finished)
+ return FALSE;
+
+ if (enemy_range == RANGE_FAR)
+ return FALSE;
+
+ if (enemy_range == RANGE_MELEE)
+ chance = 0.9;
+ else if (enemy_range == RANGE_NEAR)
+ chance = 0.4;
+ else if (enemy_range == RANGE_MID)
+ chance = 0.05;
+ else
+ chance = 0;
+
+ if (random () < chance)
+ {
+ self.th_missile ();
+ SUB_AttackFinished (1 + random());
+ if (random() < 0.3)
+ self.lefty = !self.lefty;
+
+ return TRUE;
+ }
+
+ return FALSE;
+};
+//=============================================================================
+
+/*
+===========
+ShamCheckAttack
+
+The player is in view, so decide to move or launch an attack
+Returns FALSE if movement should continue
+============
+*/
+float() ShamCheckAttack =
+{
+ local vector spot1, spot2;
+ local entity targ;
+
+ if (enemy_range == RANGE_MELEE)
+ {
+ if (CanDamage (self.enemy, self))
+ {
+ self.attack_state = AS_MELEE;
+ return TRUE;
+ }
+ }
+
+ if (time < self.attack_finished)
+ return FALSE;
+
+ if (!enemy_vis)
+ return FALSE;
+
+ targ = self.enemy;
+
+// see if any entities are in the way of the shot
+ spot1 = self.origin + self.view_ofs;
+ spot2 = targ.origin + targ.view_ofs;
+
+ if (vlen(spot1 - spot2) > 600)
+ return FALSE;
+
+ traceline (spot1, spot2, FALSE, self);
+
+ if (trace_inopen && trace_inwater)
+ return FALSE; // sight line crossed contents
+
+ if (trace_ent != targ)
+ {
+ return FALSE; // don't have a clear shot
+ }
+
+// missile attack
+ if (enemy_range == RANGE_FAR)
+ return FALSE;
+
+ self.attack_state = AS_MISSILE;
+ SUB_AttackFinished (2 + 2*random());
+ return TRUE;
+};
+
+//============================================================================
+
+/*
+===========
+OgreCheckAttack
+
+The player is in view, so decide to move or launch an attack
+Returns FALSE if movement should continue
+============
+*/
+float() OgreCheckAttack =
+{
+ local vector spot1, spot2;
+ local entity targ;
+ local float chance;
+
+ if (enemy_range == RANGE_MELEE)
+ {
+ if (CanDamage (self.enemy, self))
+ {
+ self.attack_state = AS_MELEE;
+ return TRUE;
+ }
+ }
+
+ if (time < self.attack_finished)
+ return FALSE;
+
+ if (!enemy_vis)
+ return FALSE;
+
+ targ = self.enemy;
+
+// see if any entities are in the way of the shot
+ spot1 = self.origin + self.view_ofs;
+ spot2 = targ.origin + targ.view_ofs;
+
+ traceline (spot1, spot2, FALSE, self);
+
+ if (trace_inopen && trace_inwater)
+ return FALSE; // sight line crossed contents
+
+ if (trace_ent != targ)
+ {
+ return FALSE; // don't have a clear shot
+ }
+
+// missile attack
+ if (time < self.attack_finished)
+ return FALSE;
+
+ if (enemy_range == RANGE_FAR)
+ return FALSE;
+
+ else if (enemy_range == RANGE_NEAR)
+ chance = 0.10;
+ else if (enemy_range == RANGE_MID)
+ chance = 0.05;
+ else
+ chance = 0;
+
+ self.attack_state = AS_MISSILE;
+ SUB_AttackFinished (1 + 2*random());
+ return TRUE;
+};
+
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/fish.qc b/r17/Revamped src/Revamped QC/Primeqc4/fish.qc
new file mode 100755
index 00000000..ce6e26ee
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/fish.qc
@@ -0,0 +1,186 @@
+$cd id1/models/fish
+$origin 0 0 24
+$base base
+$skin skin
+
+$frame attack1 attack2 attack3 attack4 attack5 attack6
+$frame attack7 attack8 attack9 attack10 attack11 attack12 attack13
+$frame attack14 attack15 attack16 attack17 attack18
+
+$frame death1 death2 death3 death4 death5 death6 death7
+$frame death8 death9 death10 death11 death12 death13 death14 death15
+$frame death16 death17 death18 death19 death20 death21
+
+$frame swim1 swim2 swim3 swim4 swim5 swim6 swim7 swim8
+$frame swim9 swim10 swim11 swim12 swim13 swim14 swim15 swim16 swim17
+$frame swim18
+
+$frame pain1 pain2 pain3 pain4 pain5 pain6 pain7 pain8
+$frame pain9
+
+void() swimmonster_start;
+
+void() f_stand1 =[ $swim1, f_stand2 ] {ai_stand();};
+void() f_stand2 =[ $swim2, f_stand3 ] {ai_stand();};
+void() f_stand3 =[ $swim3, f_stand4 ] {ai_stand();};
+void() f_stand4 =[ $swim4, f_stand5 ] {ai_stand();};
+void() f_stand5 =[ $swim5, f_stand6 ] {ai_stand();};
+void() f_stand6 =[ $swim6, f_stand7 ] {ai_stand();};
+void() f_stand7 =[ $swim7, f_stand8 ] {ai_stand();};
+void() f_stand8 =[ $swim8, f_stand9 ] {ai_stand();};
+void() f_stand9 =[ $swim9, f_stand10 ] {ai_stand();};
+void() f_stand10 =[ $swim10, f_stand11 ] {ai_stand();};
+void() f_stand11 =[ $swim11, f_stand12 ] {ai_stand();};
+void() f_stand12 =[ $swim12, f_stand13 ] {ai_stand();};
+void() f_stand13 =[ $swim13, f_stand14 ] {ai_stand();};
+void() f_stand14 =[ $swim14, f_stand15 ] {ai_stand();};
+void() f_stand15 =[ $swim15, f_stand16 ] {ai_stand();};
+void() f_stand16 =[ $swim16, f_stand17 ] {ai_stand();};
+void() f_stand17 =[ $swim17, f_stand18 ] {ai_stand();};
+void() f_stand18 =[ $swim18, f_stand1 ] {ai_stand();};
+
+void() f_walk1 =[ $swim1, f_walk2 ] {ai_walk(8);};
+void() f_walk2 =[ $swim2, f_walk3 ] {ai_walk(8);};
+void() f_walk3 =[ $swim3, f_walk4 ] {ai_walk(8);};
+void() f_walk4 =[ $swim4, f_walk5 ] {ai_walk(8);};
+void() f_walk5 =[ $swim5, f_walk6 ] {ai_walk(8);};
+void() f_walk6 =[ $swim6, f_walk7 ] {ai_walk(8);};
+void() f_walk7 =[ $swim7, f_walk8 ] {ai_walk(8);};
+void() f_walk8 =[ $swim8, f_walk9 ] {ai_walk(8);};
+void() f_walk9 =[ $swim9, f_walk10 ] {ai_walk(8);};
+void() f_walk10 =[ $swim10, f_walk11 ] {ai_walk(8);};
+void() f_walk11 =[ $swim11, f_walk12 ] {ai_walk(8);};
+void() f_walk12 =[ $swim12, f_walk13 ] {ai_walk(8);};
+void() f_walk13 =[ $swim13, f_walk14 ] {ai_walk(8);};
+void() f_walk14 =[ $swim14, f_walk15 ] {ai_walk(8);};
+void() f_walk15 =[ $swim15, f_walk16 ] {ai_walk(8);};
+void() f_walk16 =[ $swim16, f_walk17 ] {ai_walk(8);};
+void() f_walk17 =[ $swim17, f_walk18 ] {ai_walk(8);};
+void() f_walk18 =[ $swim18, f_walk1 ] {ai_walk(8);};
+
+void() f_run1 =[ $swim1, f_run2 ] {ai_run(12);
+ if (random() < 0.5)
+ sound (self, CHAN_VOICE, "fish/idle.wav", 1, ATTN_NORM);
+};
+void() f_run2 =[ $swim3, f_run3 ] {ai_run(12);};
+void() f_run3 =[ $swim5, f_run4 ] {ai_run(12);};
+void() f_run4 =[ $swim7, f_run5 ] {ai_run(12);};
+void() f_run5 =[ $swim9, f_run6 ] {ai_run(12);};
+void() f_run6 =[ $swim11, f_run7 ] {ai_run(12);};
+void() f_run7 =[ $swim13, f_run8 ] {ai_run(12);};
+void() f_run8 =[ $swim15, f_run9 ] {ai_run(12);};
+void() f_run9 =[ $swim17, f_run1 ] {ai_run(12);};
+
+void() fish_melee =
+{
+ local vector delta;
+ local float ldmg;
+
+ if (!self.enemy)
+ return; // removed before stroke
+
+ delta = self.enemy.origin - self.origin;
+
+ if (vlen(delta) > 60)
+ return;
+
+ sound (self, CHAN_VOICE, "fish/bite.wav", 1, ATTN_NORM);
+ ldmg = (random() + random()) * 3;
+ T_Damage (self.enemy, self, self, ldmg);
+};
+
+void() f_attack1 =[ $attack1, f_attack2 ] {ai_charge(10);};
+void() f_attack2 =[ $attack2, f_attack3 ] {ai_charge(10);};
+void() f_attack3 =[ $attack3, f_attack4 ] {fish_melee();};
+void() f_attack4 =[ $attack4, f_attack5 ] {ai_charge(10);};
+void() f_attack5 =[ $attack5, f_attack6 ] {ai_charge(10);};
+void() f_attack6 =[ $attack6, f_attack7 ] {ai_charge(10);};
+void() f_attack7 =[ $attack7, f_attack8 ] {ai_charge(10);};
+void() f_attack8 =[ $attack8, f_attack9 ] {ai_charge(10);};
+void() f_attack9 =[ $attack9, f_attack10] {fish_melee();};
+void() f_attack10 =[ $attack10, f_attack11] {ai_charge(10);};
+void() f_attack11 =[ $attack11, f_attack12] {ai_charge(10);};
+void() f_attack12 =[ $attack12, f_attack13] {ai_charge(10);};
+void() f_attack13 =[ $attack13, f_attack14] {ai_charge(10);};
+void() f_attack14 =[ $attack14, f_attack15] {ai_charge(10);};
+void() f_attack15 =[ $attack15, f_attack16] {fish_melee();};
+void() f_attack16 =[ $attack16, f_attack17] {ai_charge(10);};
+void() f_attack17 =[ $attack17, f_attack18] {ai_charge(10);};
+void() f_attack18 =[ $attack18, f_run1 ] {ai_charge(10);};
+
+void() f_death1 =[ $death1, f_death2 ] {
+sound (self, CHAN_VOICE, "fish/death.wav", 1, ATTN_NORM);
+};
+void() f_death2 =[ $death2, f_death3 ] {};
+void() f_death3 =[ $death3, f_death4 ] {};
+void() f_death4 =[ $death4, f_death5 ] {};
+void() f_death5 =[ $death5, f_death6 ] {};
+void() f_death6 =[ $death6, f_death7 ] {};
+void() f_death7 =[ $death7, f_death8 ] {};
+void() f_death8 =[ $death8, f_death9 ] {};
+void() f_death9 =[ $death9, f_death10 ] {};
+void() f_death10 =[ $death10, f_death11 ] {};
+void() f_death11 =[ $death11, f_death12 ] {};
+void() f_death12 =[ $death12, f_death13 ] {};
+void() f_death13 =[ $death13, f_death14 ] {};
+void() f_death14 =[ $death14, f_death15 ] {};
+void() f_death15 =[ $death15, f_death16 ] {};
+void() f_death16 =[ $death16, f_death17 ] {};
+void() f_death17 =[ $death17, f_death18 ] {};
+void() f_death18 =[ $death18, f_death19 ] {};
+void() f_death19 =[ $death19, f_death20 ] {};
+void() f_death20 =[ $death20, f_death21 ] {};
+void() f_death21 =[ $death21, f_death21 ] {self.solid = SOLID_NOT;};
+
+void() f_pain1 =[ $pain1, f_pain2 ] {};
+void() f_pain2 =[ $pain2, f_pain3 ] {ai_pain(6);};
+void() f_pain3 =[ $pain3, f_pain4 ] {ai_pain(6);};
+void() f_pain4 =[ $pain4, f_pain5 ] {ai_pain(6);};
+void() f_pain5 =[ $pain5, f_pain6 ] {ai_pain(6);};
+void() f_pain6 =[ $pain6, f_pain7 ] {ai_pain(6);};
+void() f_pain7 =[ $pain7, f_pain8 ] {ai_pain(6);};
+void() f_pain8 =[ $pain8, f_pain9 ] {ai_pain(6);};
+void() f_pain9 =[ $pain9, f_run1 ] {ai_pain(6);};
+
+void(entity attacker, float damage) fish_pain =
+{
+
+// fish allways do pain frames
+ f_pain1 ();
+};
+
+
+
+/*QUAKED monster_fish (1 0 0) (-16 -16 -24) (16 16 24) Ambush
+*/
+void() monster_fish =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+ precache_model2 ("progs/fish.mdl");
+
+ precache_sound2 ("fish/death.wav");
+ precache_sound2 ("fish/bite.wav");
+ precache_sound2 ("fish/idle.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/fish.mdl");
+
+ setsize (self, '-16 -16 -24', '16 16 24');
+ self.health = 25;
+
+ self.th_stand = f_stand1;
+ self.th_walk = f_walk1;
+ self.th_run = f_run1;
+ self.th_die = f_death1;
+ self.th_pain = fish_pain;
+ self.th_melee = f_attack1;
+
+ swimmonster_start ();
+};
+
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/flag.qc b/r17/Revamped src/Revamped QC/Primeqc4/flag.qc
new file mode 100755
index 00000000..44daa003
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/flag.qc
@@ -0,0 +1,8 @@
+/*QUAKED item_deathball (.3 .3 1) (0 0 0) (32 32 32)
+*/
+void() deathball_touch;
+
+void() item_deathball =
+{
+ self.touch = deathball_touch;
+};
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/frikbot/bot.qc b/r17/Revamped src/Revamped QC/Primeqc4/frikbot/bot.qc
new file mode 100755
index 00000000..a14716e6
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/frikbot/bot.qc
@@ -0,0 +1,1219 @@
+
+/*
+======================================
+FrikBot X (Version 0.10.0)
+======================================
+
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2 of the License, or (at your
+option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software Foundation,
+Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+======================================
+These installation instructions only apply to Normal Quake (as does this
+entire file). For QuakeWorld, please refer to bot_qw.qc
+
+--------------------------------------
+To install on a new mod, do all this:
+--------------------------------------
+Place all included bot*.qc files in the subdirectory "frikbot"
+in your source folder, then...
+
+* Add the following lines to progs.src right after the defs.qc line
+frikbot/bot.qc
+frikbot/bot_way.qc
+frikbot/bot_fight.qc
+frikbot/bot_ai.qc
+frikbot/bot_misc.qc
+frikbot/bot_phys.qc
+frikbot/bot_move.qc
+frikbot/bot_ed.qc
+
+--------------------------------------
+* Comment out the following functions in defs.qc
+sound, stuffcmd, sprint, aim, centerprint, setspawnparms
+WriteByte, WriteChar, WriteShort, WriteLong, WriteCoord
+WriteAngle, WriteString, WriteEntity
+--------------------------------------
+* Add this to worldspawn() in world.qc, right at the very top, before InitBodyQue();
+BotInit(); // FrikBot
+--------------------------------------
+* add this line to StartFrame() in world.qc, at the very top
+BotFrame(); // FrikBot
+--------------------------------------
+* Add these two lines to PlayerPreThink in client.qc at the very top
+if (BotPreFrame()) // FrikBot
+ return;
+--------------------------------------
+* Add this line to PlayerPostThink in client.qc at the very top
+if (BotPostFrame()) // FrikBot
+ return;
+--------------------------------------
+* Add the following line to the very top of Client Connect in client.qc
+ClientInRankings(); // FrikBot
+--------------------------------------
+* Add these lines to the very top of ClientDisconnect in client.qc
+ClientDisconnected(); // FrikBot
+--------------------------------------
+*/
+
+void() bot_map_load =
+{
+ // place your qc loaded waypoints here
+/*
+ if (mapname == "dm1")
+ map_dm1();
+ else if (mapname == "dm2")
+ map_dm2();
+ else if (mapname == "dm3")
+ map_dm3();
+ else if (mapname == "dm4")
+ map_dm4();
+ else if (mapname == "dm5")
+ map_dm5();
+ else if (mapname == "dm6")
+ map_dm6();
+*/
+
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Variables and shtuff
+
+bot.qc has become pretty much a header file
+for all variable in the bot...
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+// ----- entity fields ---
+.float wallhug, keys, oldkeys, ishuman;
+.float b_frags, b_clientno, b_shirt, b_pants;
+.float ai_time, b_sound, missile_speed;
+.float portal_time, b_skill, switch_wallhug;
+.float b_aiflags, b_num, b_chattime;
+.float b_menu, b_menu_time, b_menu_value;
+.float route_failed, dyn_flags, dyn_time;
+.float dyn_plat;
+.entity temp_way, last_way, phys_obj;
+.entity target1, target2, target3, target4;
+.entity _next, _last;
+.entity current_way;
+.vector b_angle, mouse_emu, obs_dir;
+.vector movevect, b_dir;
+.vector dyn_dest;
+
+// --------defines-----
+float SVC_UPDATENAME = 13;
+float SVC_UPDATEFRAGS = 14;
+float SVC_UPDATECOLORS = 17;
+
+// used for the physics & movement AI
+float KEY_MOVEUP = 1;
+float KEY_MOVEDOWN = 2;
+float KEY_MOVELEFT = 4;
+float KEY_MOVERIGHT = 8;
+float KEY_MOVEFORWARD = 16;
+float KEY_MOVEBACK = 32;
+float KEY_LOOKUP = 64;
+float KEY_LOOKDOWN = 128;
+float KEY_LOOKLEFT = 256;
+float KEY_LOOKRIGHT = 512;
+
+// these are aiflags for waypoints
+// some overlap to the bot
+float AI_TELELINK_1 = 1; // link type
+float AI_TELELINK_2 = 2; // link type
+float AI_TELELINK_3 = 4; // link type
+float AI_TELELINK_4 = 8; // link type
+float AI_DOORFLAG = 16; // read ahead
+float AI_PRECISION = 32; // read ahead + point
+float AI_SURFACE = 64; // point
+float AI_BLIND = 128; // read ahead + point
+float AI_JUMP = 256; // point + ignore
+float AI_DIRECTIONAL = 512; // read ahead + ignore
+float AI_PLAT_BOTTOM = 1024; // read ahead
+float AI_RIDE_TRAIN = 2048; // read ahead
+float AI_SUPER_JUMP = 4096; // point + ignore + route test
+float AI_SNIPER = 8192; // point type
+float AI_AMBUSH = 16384; // point type
+float AI_DOOR_NO_OPEN = 32768; // read ahead
+float AI_DIFFICULT = 65536; // route test
+float AI_TRACE_TEST = 131072; // route test
+
+// these are flags for bots/players (dynamic/editor flags)
+float AI_OBSTRUCTED = 1;
+float AI_HOLD_SELECT = 2;
+float AI_ROUTE_FAILED = 2;
+float AI_WAIT = 4;
+float AI_DANGER = 8;
+
+
+// addition masks
+float AI_POINT_TYPES = 29152;
+float AI_READAHEAD_TYPES = 36528;
+float AI_IGNORE_TYPES = 4864;
+
+float WM_UNINIT = 0;
+float WM_DYNAMIC = 1;
+float WM_LOADING = 2;
+float WM_LOADED = 3;
+float WM_EDITOR = 4;
+float WM_EDITOR_DYNAMIC = 5;
+float WM_EDITOR_DYNLINK = 6;
+
+
+float OPT_SAVEBOTS = 1;
+float OPT_NOCHAT = 2;
+
+// -------globals-----
+float active_clients;
+float max_clients, real_frametime;
+float bot_count, b_options;
+float waypoint_mode, dump_mode;
+float waypoints, direct_route;
+float sv_friction, sv_gravity;
+float sv_accelerate, sv_maxspeed, sv_stopspeed;
+entity fixer;
+entity route_table;
+entity b_temp1, b_temp2, b_temp3;
+entity player_head, phys_head, way_head;
+float busy_waypoints;
+float saved_bots, saved_skills1, saved_skills2, current_bots;
+
+// -------ProtoTypes------
+// external
+void() ClientConnect;
+void() ClientDisconnect;
+void() SetNewParms;
+
+// rankings
+float(float clientno) ClientBitFlag;
+float() ClientNextAvailable;
+void(float whichteam, float whatbot, float whatskill) BotConnect;
+void(entity bot) BotDisconnect;
+void(float clientno) BotInvalidClientNo;
+void(entity who) UpdateClient;
+
+// waypointing
+void() DynamicWaypoint;
+entity(vector org) make_waypoint;
+void() ClearAllWays;
+void() FixWaypoints;
+float() begin_route;
+void(entity this, float direct) bot_get_path;
+void() WaypointThink;
+entity(entity start) FindWayPoint;
+
+// physics & movement
+float(entity e) bot_can_rj;
+void() bot_jump;
+void() frik_bot_roam;
+float(vector weird) frik_walkmove;
+void() frik_movetogoal;
+void() frik_obstacles;
+float(float flag) frik_recognize_plat;
+float(vector sdir) frik_KeysForDir;
+void(vector whichway, float danger) frik_obstructed;
+void() SV_Physics_Client;
+void() SV_ClientThink;
+void() CL_KeyMove;
+
+// ai & misc
+string() PickARandomName;
+float(entity targ) fov;
+float(float y1, float y2) angcomp;
+float(entity targ1, entity targ2) wisible;
+float(entity targ) sisible;
+float(entity targ) fisible;
+vector(entity ent) realorigin;
+void(entity ent) target_drop;
+void(entity ent) target_add;
+void() KickABot;
+void() BotImpulses;
+void(entity targ, float success) bot_lost;
+string(float r) BotName;
+float(float v) frik_anglemod;
+void() bot_chat;
+void(float tpic) bot_start_topic;
+
+
+// editor stuffs
+
+void() bot_way_edit;
+void() bot_menu_display;
+
+
+// ----------Commands---------
+void(entity e, float chan, string samp, float vol, float atten) frik_sound = #8;
+void(entity client, string s) frik_stuffcmd = #21;
+void(entity client, string s) frik_sprint = #24;
+vector(entity e, float sped) frik_aim = #44;
+void(entity client, string s) frik_centerprint = #73;
+void(entity e) frik_setspawnparms = #78;
+void(float to, float f) frik_WriteByte = #52;
+void(float to, float f) frik_WriteChar = #53;
+void(float to, float f) frik_WriteShort = #54;
+void(float to, float f) frik_WriteLong = #55;
+void(float to, float f) frik_WriteCoord = #56;
+void(float to, float f) frik_WriteAngle = #57;
+void(float to, string s) frik_WriteString = #58;
+void(float to, entity s) frik_WriteEntity = #59;
+
+void(entity client, string s1, string s2, string s3, string s4, string s5, string s6, string s7)
+frik_big_centerprint = #73;
+
+//----------------------------------------------------------------------------
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Function redclarations. These allow function
+designed to work for clients (sprint, so forth)
+to mainly not complain when working with a bot
+
+Although these shouldn't be needed anymore,
+as the bots truly are clients now, if you don't
+stop the SZ_ buffer from filling up by disabling
+direct messages to the bots, it crashes quake :-(
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+void(entity client, string s) stuffcmd =
+{
+ if (client.ishuman == 1)
+ frik_stuffcmd(client, s);
+ b_temp1 = player_head;
+
+ while(b_temp1)
+ {
+ if (b_temp1.classname == "botcam")
+ {
+ if ((b_temp1.enemy == client) && b_temp1.ishuman)
+ frik_stuffcmd(b_temp1, s);
+ }
+ b_temp1 = b_temp1._next;
+ }
+};
+
+void(entity e) setspawnparms =
+{
+ if (e.ishuman == 1)
+ frik_setspawnparms(e);
+ else
+ {
+ b_temp1 = player_head;
+ while(b_temp1)
+ {
+ if (b_temp1.ishuman)
+ {
+ frik_setspawnparms(b_temp1);
+ return;
+ }
+ b_temp1 = b_temp1._next;
+ }
+ SetNewParms();
+ }
+};
+void(entity client, string s) sprint =
+{
+ if (client.ishuman == 1)
+ frik_sprint(client, s);
+ b_temp1 = player_head;
+
+ while(b_temp1)
+ {
+ if (b_temp1.classname == "botcam")
+ {
+ if ((b_temp1.enemy == client) && b_temp1.ishuman)
+ frik_sprint(b_temp1, s);
+ }
+ b_temp1 = b_temp1._next;
+ }
+
+};
+void(entity client, string s) centerprint =
+{
+ if (client.ishuman == 1)
+ frik_centerprint(client, s);
+ b_temp1 = player_head;
+
+ while(b_temp1)
+ {
+ if (b_temp1.classname == "botcam")
+ {
+ if ((b_temp1.enemy == client) && b_temp1.ishuman)
+ frik_centerprint(b_temp1, s);
+ }
+ b_temp1 = b_temp1._next;
+ }
+};
+
+vector(entity e, float sped) aim =
+{
+ e.missile_speed = sped;
+ return frik_aim(e, sped);
+};
+
+void(entity e, float chan, string samp, float vol, float atten) sound =
+{
+
+ frik_sound(e, chan, samp, vol, atten);
+ if (samp == "items/inv3.wav")
+ return;
+ else if (e.classname == "player")
+ e.b_sound = time + 1;
+ else if (other.classname == "player")
+ other.b_sound = time + 1;
+
+};
+void(float to, float f) WriteByte =
+{
+ if ((to == MSG_ONE) && (msg_entity.ishuman != TRUE))
+ return;
+ frik_WriteByte(to, f);
+};
+void(float to, float f) WriteChar =
+{
+ if ((to == MSG_ONE) && (msg_entity.ishuman != TRUE))
+ return;
+ frik_WriteChar(to, f);
+};
+void(float to, float f) WriteShort =
+{
+ if ((to == MSG_ONE) && (msg_entity.ishuman != TRUE))
+ return;
+ frik_WriteShort(to, f);
+};
+void(float to, float f) WriteLong =
+{
+ if ((to == MSG_ONE) && (msg_entity.ishuman != TRUE))
+ return;
+ frik_WriteLong(to, f);
+};
+void(float to, float f) WriteCoord =
+{
+ if ((to == MSG_ONE) && (msg_entity.ishuman != TRUE))
+ return;
+ frik_WriteCoord(to, f);
+};
+void(float to, float f) WriteAngle =
+{
+ if ((to == MSG_ONE) && (msg_entity.ishuman != TRUE))
+ return;
+ frik_WriteAngle(to, f);
+};
+void(float to, string s) WriteString =
+{
+ if ((to == MSG_ONE) && (msg_entity.ishuman != TRUE))
+ return;
+ frik_WriteString(to, s);
+};
+void(float to, entity s) WriteEntity =
+{
+ if ((to == MSG_ONE) && (msg_entity.ishuman != TRUE))
+ return;
+ frik_WriteEntity(to, s);
+};
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Bot Cam, see what the bot sees (or any other player)
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+float() botcam =
+{
+ if (self.classname != "botcam")
+ return FALSE;
+ setorigin(self, self.enemy.origin);
+ self.items = self.enemy.items;
+ self.weapon = self.enemy.weapon;
+ self.weaponmodel = self.enemy.weaponmodel;
+ self.currentammo = self.enemy.currentammo;
+ self.weaponframe = self.enemy.weaponframe;
+ self.ammo_shells = self.enemy.ammo_shells;
+ self.ammo_nails = self.enemy.ammo_nails;
+ self.ammo_rockets= self.enemy.ammo_rockets;
+ self.ammo_cells = self.enemy.ammo_cells;
+ self.view_ofs = self.enemy.view_ofs;
+ self.health = self.enemy.health;
+ self.armorvalue = self.enemy.armorvalue;
+ self.dmg_take = self.enemy.dmg_take;
+ self.dmg_save = self.enemy.dmg_save;
+ self.dmg_inflictor = self.enemy.dmg_inflictor;
+ self.punchangle = self.enemy.punchangle;
+ self.deadflag = self.enemy.deadflag;
+ msg_entity = self;
+ WriteByte (MSG_ONE,5);
+ WriteEntity (MSG_ONE, self.enemy);
+ WriteByte (MSG_ONE, 10);
+ WriteAngle (MSG_ONE,self.enemy.v_angle_x);
+ WriteAngle (MSG_ONE,self.enemy.v_angle_y);
+ WriteAngle (MSG_ONE,self.enemy.v_angle_z);
+ self.modelindex = 0;
+
+ self.impulse = 0;
+ return TRUE;
+
+};
+
+void() botcam_u =
+{
+
+ // sloppy cycling code
+ if (self.classname != "botcam")
+ {
+ self.enemy = player_head;
+ }
+ else
+ {
+ do
+ self.enemy = self.enemy._next;
+ while (self.enemy.classname == "botcam");
+ }
+ if (self.enemy == self)
+ {
+ do
+ self.enemy = self.enemy._next;
+ while (self.enemy.classname == "botcam");
+ }
+
+ self.classname = "botcam";
+ self.solid = SOLID_NOT;
+ self.movetype = MOVETYPE_NONE;
+ self.takedamage = DAMAGE_NO;
+
+
+ if (!self.enemy)
+ {
+ sprint(self, "No one left to track!\n");
+ msg_entity = self;
+ WriteByte (MSG_ONE,5);
+ WriteEntity (MSG_ONE, self);
+ PutClientInServer();
+ return;
+ }
+ if (!self.enemy.ishuman)
+ {
+ self.enemy.dmg_take = 0;
+ self.enemy.dmg_save = 0;
+ }
+ sprint(self, "Now tracking ");
+ sprint(self, self.enemy.netname);
+ sprint(self, "\n");
+};
+
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Stuff mentioned up top
+it just links the bot into the mod
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() ClientFixRankings =
+{
+ local float cno;
+ if (self.switch_wallhug > time)
+ return;
+ self.switch_wallhug = 0;
+
+ b_temp2 = nextent(world);
+ cno = 0;
+
+ while (cno < max_clients)
+ {
+ if ((!b_temp2.ishuman) && (active_clients & ClientBitFlag(cno)))
+ UpdateClient(b_temp2);
+ cno = cno + 1;
+ b_temp2 = nextent(b_temp2);
+ }
+};
+
+void() ClientInRankings =
+{
+ local float cno;
+ if (player_head)
+ player_head._last = self;
+ self._next = player_head;
+ player_head = self;
+
+ if (!self.phys_obj)
+ {
+ b_temp2 = phys_head;
+ while (b_temp2 != world && b_temp2.owner != self)
+ b_temp2 = b_temp2._next;
+ self.phys_obj = b_temp2;
+ }
+
+ if (self.ishuman == 2)
+ {
+ self.ishuman = FALSE;
+ return;
+ }
+ cno = self.colormap - 1;
+ BotInvalidClientNo (cno);
+ active_clients = active_clients | ClientBitFlag(cno);
+
+ self.b_clientno = cno;
+ self.ishuman = TRUE;
+ self.switch_wallhug = time + 1;
+};
+
+
+void() ClientDisconnected =
+{
+ if (player_head == self)
+ player_head = self._next;
+ if (self._next)
+ self._next._last = self._last;
+ if (self._last)
+ self._last._next = self._next;
+ active_clients = active_clients - active_clients & ClientBitFlag(self.b_clientno);
+};
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+BotPreFrame & BotPostFrame, used to make the
+bot easier to install
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+float () BotPreFrame =
+{
+ if (self.b_clientno == -1)
+ return TRUE;
+ if (self.ishuman)
+ {
+ if (self.switch_wallhug)
+ ClientFixRankings();
+ if (self.classname == "botcam")
+ return TRUE;
+ }
+ if (self.b_frags != self.frags)
+ {
+
+ if (self.b_frags > self.frags)
+ {
+ if (pointcontents(self.origin) == CONTENT_LAVA)
+ bot_start_topic(10);
+ else
+ bot_start_topic(9);
+ }
+ else
+ bot_start_topic(2);
+ self.b_frags = self.frags;
+ }
+ DynamicWaypoint();
+ return FALSE;
+};
+float () BotPostFrame =
+{
+ if (self.b_clientno == -1)
+ return TRUE;
+ if (self.ishuman)
+ {
+
+ if (waypoint_mode > WM_LOADED)
+ bot_menu_display();
+
+ BotImpulses();
+
+ if (botcam())
+ return TRUE;
+ }
+ return FALSE;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Bot Chat code
+
+The rest of this code is in bot_misc.qc
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+void(string h) BotSay = // simulate talking by composing a 'chat' message
+{
+ WriteByte(MSG_ALL, 8);
+ WriteByte(MSG_ALL, 1);
+ WriteString(MSG_ALL, self.netname);
+ WriteByte(MSG_ALL, 8);
+ WriteByte(MSG_ALL, 2);
+ WriteString(MSG_ALL, h);
+};
+void() BotSayInit =
+{
+ WriteByte(MSG_ALL, 8);
+ WriteByte(MSG_ALL, 1);
+ WriteString(MSG_ALL, self.netname);
+};
+void(string h) BotSay2 =
+{
+ WriteByte(MSG_ALL, 8);
+ WriteByte(MSG_ALL, 2);
+ WriteString(MSG_ALL, h);
+};
+void(string h) BotSayTeam =
+{
+ local entity t;
+ if (!teamplay)
+ return;
+ t = player_head;
+ while(t)
+ {
+ if (t.team == self.team)
+ {
+ msg_entity = t;
+ WriteByte(MSG_ONE, 8);
+ WriteByte(MSG_ONE, 1);
+ WriteByte(MSG_ONE, 40);
+ WriteString(MSG_ONE, self.netname);
+ WriteByte(MSG_ONE, 8);
+ WriteByte(MSG_ONE, 2);
+ WriteByte(MSG_ONE, 41);
+ WriteString(MSG_ONE, h);
+ }
+ t = t._next;
+ }
+};
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+BotInit
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+
+void() BotInit =
+{
+ local entity ent, fisent;
+ local float numents;
+
+ // spawn entities for the physics
+ ent = nextent(world);
+ max_clients = 0;
+
+ while(ent != world)
+ {
+ max_clients = max_clients + 1;
+ ent = nextent(ent);
+ }
+
+ ent = nextent(world);
+ fisent = world;
+ while (numents < max_clients)
+ {
+
+ phys_head = spawn();
+ if (fisent)
+ fisent._next = phys_head;
+ phys_head._last = fisent;
+ fisent = phys_head;
+ ent.phys_obj = phys_head;
+ phys_head.classname = "phys_obj";
+ phys_head.owner = ent;
+ numents = numents + 1;
+ ent = nextent(ent);
+ }
+ precache_model("progs/s_light.spr");
+ precache_model("progs/s_bubble.spr");
+ // the bots return!
+ b_options = cvar("saved1");
+ if (coop || (b_options & OPT_SAVEBOTS))
+ {
+ saved_bots = cvar("scratch1");
+ saved_skills1 = cvar("scratch2");
+ saved_skills2 = cvar("scratch3");
+ }
+ cvar_set ("saved4", "0");
+ localcmd("exec maps/");
+ localcmd(mapname);
+ localcmd(".way\n");
+ waypoint_mode = WM_DYNAMIC;
+ bot_map_load();
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Rankings 'utilities'. Written by Alan Kivlin,
+this code just fools clients by sending precisely
+the same network messages as when a real player
+signs on to the server.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+
+void(entity who) UpdateClient =
+{
+ WriteByte (MSG_ALL, SVC_UPDATENAME);
+ WriteByte (MSG_ALL, who.b_clientno);
+ WriteString (MSG_ALL, who.netname);
+ WriteByte (MSG_ALL, SVC_UPDATECOLORS);
+ WriteByte (MSG_ALL, who.b_clientno);
+ WriteByte (MSG_ALL, who.b_shirt * 16 + who.b_pants);
+ WriteByte (MSG_ALL, SVC_UPDATEFRAGS);
+ WriteByte (MSG_ALL, who.b_clientno);
+ WriteShort (MSG_ALL, who.frags);
+};
+
+float(float clientno) ClientBitFlag =
+{
+ // bigger, but faster
+ if (clientno == 0)
+ return 1;
+ else if (clientno == 1)
+ return 2;
+ else if (clientno == 2)
+ return 4;
+ else if (clientno == 3)
+ return 8;
+ else if (clientno == 4)
+ return 16;
+ else if (clientno == 5)
+ return 32;
+ else if (clientno == 6)
+ return 64;
+ else if (clientno == 7)
+ return 128;
+ else if (clientno == 8)
+ return 256;
+ else if (clientno == 9)
+ return 512;
+ else if (clientno == 10)
+ return 1024;
+ else if (clientno == 11)
+ return 2048;
+ else if (clientno == 12)
+ return 4096;
+ else if (clientno == 13)
+ return 8192;
+ else if (clientno == 14)
+ return 16384;
+ else if (clientno == 15)
+ return 32768;
+ return 0;
+};
+
+float() ClientNextAvailable =
+{
+ local float clientno;
+
+ clientno = max_clients;
+ while(clientno > 0)
+ {
+ clientno = clientno - 1;
+
+ if(!(active_clients & ClientBitFlag(clientno)))
+ return clientno;
+ }
+
+ return -1;
+};
+
+
+void(entity e1, entity e2, float flag) DeveloperLightning =
+{
+ // used to show waypoint links for debugging
+ WriteByte (MSG_BROADCAST, 23);
+ if (flag)
+ WriteByte (MSG_BROADCAST, 6);
+ else
+ WriteByte (MSG_BROADCAST, 13);
+ WriteEntity (MSG_BROADCAST, e2);
+ WriteCoord (MSG_BROADCAST, e1.origin_x);
+ WriteCoord (MSG_BROADCAST, e1.origin_y);
+ WriteCoord (MSG_BROADCAST, e1.origin_z);
+ WriteCoord (MSG_BROADCAST, e2.origin_x);
+ WriteCoord (MSG_BROADCAST, e2.origin_y);
+ WriteCoord (MSG_BROADCAST, e2.origin_z);
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Find Another Color
+
+Team finding code
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+float(float tcolor) FindAnotherColor =
+{
+ local float bestbet, scolor, pcount, bestp;
+ bestbet = -1;
+ bestp = 16;
+ while(scolor < 14)
+ {
+ if (scolor != tcolor)
+ {
+ b_temp2 = player_head;
+ pcount = 0;
+ while(b_temp2 != world)
+ {
+ if (b_temp2.team == scolor + 1)
+ pcount = pcount + 1;
+ b_temp2 = b_temp2._next;
+ }
+ if ((pcount < bestp) && pcount)
+ {
+ bestbet = scolor;
+ bestp = pcount;
+ }
+ }
+ scolor = scolor + 1;
+ }
+ if (bestbet < 0)
+ {
+ bestbet = tcolor;
+ while (bestbet == tcolor)
+ {
+ bestbet = floor(random() * 13);
+ }
+ }
+ return bestbet;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+BotConnect and related functions.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+entity(float num) GetClientEntity =
+{
+ local entity upsy;
+ upsy = world;
+ num = num + 1;
+ while (num > 0)
+ {
+ num = num - 1;
+ upsy = nextent(upsy);
+ }
+ return upsy;
+};
+
+void(float whichteam, float whatbot, float whatskill) BotConnect =
+{
+ local float f;
+ local string h;
+ local entity uself;
+
+ f = ClientNextAvailable();
+ uself = self;
+ if(f == -1)
+ {
+ bprint("Unable to connect a bot, server is full.\n");
+ return;
+ }
+
+ // chat thing
+
+ active_clients = active_clients | ClientBitFlag(f);
+ bot_count = bot_count + 1;
+ self = GetClientEntity(f);
+ if (!saved_bots)
+ bot_start_topic(1);
+ self.b_clientno = f;
+ self.colormap = f + 1;
+ if (whatbot)
+ self.netname = BotName(whatbot);
+ else
+ self.netname = PickARandomName();
+
+
+ // players can set skill all weird, so leave these checks in
+ whatskill = rint(whatskill);
+ if (whatskill > 3)
+ whatskill = 3;
+ else if (whatskill < 0)
+ whatskill = 0;
+ self.b_skill = whatskill;
+
+ if (teamplay && !coop)
+ {
+ if (whichteam)
+ self.b_pants = FindAnotherColor(uself.team - 1);
+ else
+ self.b_pants = uself.team - 1;
+ self.b_shirt = self.b_pants;
+ }
+
+ self.team = self.b_pants + 1;
+ UpdateClient(self);
+ SetNewParms();
+ self.ishuman = 2;
+ ClientConnect();
+ PutClientInServer();
+
+ // this is risky... could corrupt .way files if done wrong
+ // If you're not the gambling type, comment this out
+
+ f = ClientBitFlag(self.b_num - 1);
+ current_bots = current_bots | f;
+
+ if (self.b_num <= 8)
+ saved_skills1 = (saved_skills1 & (65536 - (3 * f)) | (self.b_skill * f));
+ else
+ {
+ f = ClientBitFlag(self.b_num - 9);
+ saved_skills2 = (saved_skills2 & (65536 - (3 * f)) | (self.b_skill * f));
+ }
+
+ h = ftos(current_bots);
+ cvar_set("scratch1", h);
+ h = ftos(saved_skills1);
+ cvar_set("scratch2", h);
+ h = ftos(saved_skills2);
+ cvar_set("scratch3", h);
+ self = uself;
+
+};
+
+void(entity bot) BotDisconnect =
+{
+ local string h;
+ local entity uself;
+ uself = self;
+ self = bot;
+
+ bot_count = bot_count - 1;
+ current_bots = current_bots - (current_bots & ClientBitFlag(self.b_num));
+ h = ftos(current_bots);
+ cvar_set("scratch1", h);
+
+
+ ClientDisconnect();
+
+ if (self.b_clientno != -1)
+ {
+ // the bot's client number is not in use by a real player so we
+ // must remove it's entry in the rankings
+ // Quake engine sets all fields to 0, can only do the most important here
+ self.b_frags = self.frags = 0;
+ self.netname = "";
+ self.classname = "";
+ self.health = 0;
+ self.items = 0;
+ self.armorvalue = 0;
+ self.weaponmodel = "";
+ self.b_pants = 0;
+ self.b_shirt = 0;
+ self.ammo_shells = self.ammo_nails = self.ammo_rockets = self.ammo_cells = 0;
+ UpdateClient(self);
+ active_clients = active_clients - (active_clients & ClientBitFlag(self.b_clientno));
+ self.b_clientno = -1;
+ }
+ self = uself;
+};
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+BotInvalidClientNo
+kicks a bot if a player connects and takes the bot's space
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void(float clientno) BotInvalidClientNo =
+{
+ local entity bot;
+
+ bot = GetClientEntity(clientno);
+ if(bot.b_clientno > 0)
+ {
+ if (!bot.ishuman)
+ {
+ bot.b_clientno = -1;
+ BotDisconnect(bot);
+ active_clients = active_clients | ClientBitFlag(self.b_clientno);
+ BotConnect(0, bot.b_num, bot.b_skill);
+ return;
+ }
+ }
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Waypoint Loading from file
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+void() LoadWaypoint =
+{
+ local vector org;
+ local entity tep;
+ local float r;
+ org_x = cvar("saved1");
+ org_y = cvar("saved2");
+ org_z = cvar("saved3");
+
+ tep = make_waypoint(org);
+
+ r = cvar("saved4");
+
+ tep.b_aiflags = floor(r / 4);
+ tep.b_pants = cvar("scratch1");
+ tep.b_skill = cvar("scratch2");
+ tep.b_shirt = cvar("scratch3");
+ tep.b_frags = cvar("scratch4");
+};
+
+void() bot_return =
+{
+ if (time > 2)
+ {
+ if ((waypoint_mode == WM_DYNAMIC) || (waypoint_mode == WM_LOADED))
+ {
+ // minor precaution
+
+ if (saved_bots & 1) BotConnect(0, 1, saved_skills1 & 3);
+ if (saved_bots & 2) BotConnect(0, 2, (saved_skills1 & 12) / 4);
+ if (saved_bots & 4) BotConnect(0, 3, (saved_skills1 & 48) / 16);
+ if (saved_bots & 8) BotConnect(0, 4, (saved_skills1 & 192) / 64);
+ if (saved_bots & 16) BotConnect(0, 5, (saved_skills1 & 768) / 256);
+ if (saved_bots & 32) BotConnect(0, 6, (saved_skills1 & 3072) / 1024);
+ if (saved_bots & 64) BotConnect(0, 7, (saved_skills1 & 12288) / 4096);
+ if (saved_bots & 128) BotConnect(0, 8, (saved_skills1 & 49152) / 16384);
+ if (saved_bots & 256) BotConnect(0, 9, saved_skills2 & 3);
+ if (saved_bots & 512) BotConnect(0, 10, (saved_skills2 & 12) / 4);
+ if (saved_bots & 1024) BotConnect(0, 11, (saved_skills2& 48) / 16);
+ if (saved_bots & 2048) BotConnect(0, 12, (saved_skills2 & 192) / 64);
+ if (saved_bots & 4096) BotConnect(0, 13, (saved_skills2 & 768) / 256);
+ if (saved_bots & 8192) BotConnect(0, 14, (saved_skills2 & 3072) / 1024);
+ if (saved_bots & 16384) BotConnect(0, 15, (saved_skills2 & 12288) / 4096);
+ if (saved_bots & 32768) BotConnect(0, 16, (saved_skills2 & 49152) / 16384);
+ saved_bots = 0;
+ }
+ }
+};
+
+
+void() WaypointWatch =
+{
+ // Waypoint Baywatch
+ local float bigboobs;
+ local string h;
+
+ if (max_clients < 2)
+ return;
+ if (waypoint_mode != WM_UNINIT)
+ {
+ bigboobs = cvar("saved4");
+ if (bigboobs != 0)
+ {
+ if ((bigboobs & 3) == 1)
+ ClearAllWays();
+ else if ((bigboobs & 3) == 3)
+ {
+ FixWaypoints();
+ h = ftos(b_options);
+ cvar_set("saved1", h);
+ cvar_set("saved4", "0");
+ cvar_set("scratch1", "0");
+ waypoint_mode = WM_LOADED;
+ return;
+ }
+ LoadWaypoint();
+ waypoint_mode = WM_LOADING;
+ cvar_set("saved4", "0");
+ }
+ }
+};
+void() BotFrame =
+{
+ local float num;
+
+ // for the sake of speed
+ sv_maxspeed = cvar("sv_maxspeed");
+ sv_gravity = cvar("sv_gravity");
+ sv_friction = cvar("sv_friction");
+ sv_accelerate = cvar("sv_accelerate");
+ sv_stopspeed = cvar("sv_stopspeed");
+ real_frametime = frametime; // in NQ this is alright
+
+ self = nextent(world);
+ num = 0;
+ while (num < max_clients)
+ {
+ if (self.ishuman == FALSE)
+ {
+ if (active_clients & ClientBitFlag(num))
+ {
+ frik_obstacles();
+ CL_KeyMove();
+ SV_ClientThink();
+ SV_Physics_Client();
+ }
+ }
+ self = nextent(self);
+ num = num + 1;
+ }
+ WaypointWatch();
+
+ if (saved_bots)
+ bot_return();
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Bot Impulses. Allows the player to perform bot
+related functions.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() BotImpulses =
+{
+ local float f;
+
+ if (self.impulse == 100)
+ {
+ f = cvar("skill");
+ BotConnect(0, 0, f);
+ }
+ else if (self.impulse == 101)
+ {
+ f = cvar("skill");
+ BotConnect(1, 0, f);
+ }
+ else if (self.impulse == 102)
+ KickABot();
+ else if (self.impulse == 103)
+ botcam_u();
+ else if (self.impulse == 104)
+ bot_way_edit();
+ else
+ return;
+
+ self.impulse = 0;
+};
+
+
+
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/frikbot/bot_ai.qc b/r17/Revamped src/Revamped QC/Primeqc4/frikbot/bot_ai.qc
new file mode 100755
index 00000000..17f7dfc1
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/frikbot/bot_ai.qc
@@ -0,0 +1,974 @@
+/***********************************************
+* *
+* FrikBot General AI *
+* "The I'd rather be playing Quake AI" *
+* *
+***********************************************/
+
+/*
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2 of the License, or (at your
+option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software Foundation,
+Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+target_onstack
+
+checks to see if an entity is on the bot's stack
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+float(entity scot) target_onstack =
+{
+ if (scot == world)
+ return FALSE;
+ else if (self.target1 == scot)
+ return 1;
+ else if (self.target2 == scot)
+ return 2;
+ else if (self.target3 == scot)
+ return 3;
+ else if (self.target4 == scot)
+ return 4;
+ else
+ return FALSE;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+target_add
+
+adds a new entity to the stack, since it's a
+LIFO stack, this will be the bot's new target1
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void(entity ent) target_add =
+{
+ if (ent == world)
+ return;
+ if (target_onstack(ent))
+ return;
+ self.target4 = self.target3;
+ self.target3 = self.target2;
+ self.target2 = self.target1;
+ self.target1 = ent;
+ self.search_time = time + 5;
+};
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+target_drop
+
+Removes an entity from the bot's target stack.
+The stack will empty everything up to the object
+So if you have target2 item_health, target1
+waypoint, and you drop the health, the waypoint
+is gone too.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void(entity ent) target_drop =
+{
+ local float tg;
+
+ tg = target_onstack(ent);
+ if (tg == 1)
+ {
+ self.target1 = self.target2;
+ self.target2 = self.target3;
+ self.target3 = self.target4;
+ self.target4 = world;
+ }
+ else if (tg == 2)
+ {
+ self.target1 = self.target3;
+ self.target2 = self.target4;
+ self.target3 = self.target4 = world;
+ }
+ else if (tg == 3)
+ {
+ self.target1 = self.target4;
+ self.target2 = self.target3 = self.target4 = world;
+ }
+ else if (tg == 4)
+ self.target1 = self.target2 = self.target3 = self.target4 = world;
+ self.search_time = time + 5;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+bot_lost
+
+Bot has lost its target.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void(entity targ, float success) bot_lost =
+{
+ if (!targ)
+ return;
+
+ target_drop(targ);
+ if (targ.classname == "waypoint")
+ targ.b_sound = targ.b_sound - (targ.b_sound & ClientBitFlag(self.b_clientno));
+
+ // find a new route
+ if (!success)
+ {
+ self.target1 = self.target2 = self.target3 = self.target4 = world;
+ self.last_way = FindWayPoint(self.current_way);
+ ClearMyRoute();
+ self.b_aiflags = 0;
+ }
+ else
+ {
+ if (targ.classname == "item_artifact_invisibility")
+ if (self.items & 524288)
+ bot_start_topic(3);
+
+ if (targ.flags & FL_ITEM)
+ {
+ if (targ.model == string_null)
+ targ._last = world;
+ else
+ targ._last = self;
+ }
+ }
+
+
+ if (targ.classname != "player")
+ targ.search_time = time + 5;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+bot_check_lost
+
+decide if my most immediate target should be
+removed.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+void(entity targ) bot_check_lost =
+{
+ local vector dist;
+ dist = realorigin(targ) - self.origin;
+ dist_z = 0;
+ if (targ == world)
+ return;
+
+ // waypoints and items are lost if you get close enough to them
+
+ else if (targ.flags & FL_ITEM)
+ {
+ if (vlen(targ.origin - self.origin) < 32)
+ bot_lost(targ, TRUE);
+ else if (targ.model == string_null)
+ bot_lost(targ, TRUE);
+ }
+ else if (targ.classname == "waypoint")
+ {
+ if (!(self.b_aiflags & (AI_SNIPER | AI_AMBUSH)))
+ {
+ if (self.b_aiflags & AI_RIDE_TRAIN)
+ {
+ if (vlen(targ.origin - self.origin) < 48)
+ bot_lost(targ, TRUE);
+ }
+ else if (self.b_aiflags & AI_PRECISION)
+ {
+ if (vlen(targ.origin - self.origin) < 24)
+ bot_lost(targ, TRUE);
+ }
+ else if (vlen(targ.origin - self.origin) < 32)
+ bot_lost(targ, TRUE);
+ }
+ }
+ else if (targ.classname == "temp_waypoint")
+ {
+ if (vlen(targ.origin - self.origin) < 32)
+ bot_lost(targ, TRUE);
+ }
+ else if (targ.classname == "player")
+ {
+ if (targ.health <= 0)
+ bot_lost(targ, TRUE);
+ else if ((coop) || (teamplay && targ.team == self.team))
+ {
+ if (targ.target1.classname == "player")
+ {
+ if (!targ.target1.ishuman)
+ bot_lost(targ, TRUE);
+ }
+ else if (targ.teleport_time > time)
+ {
+ // try not to telefrag teammates
+ self.keys = self.keys & 960;
+ }
+ else if (vlen(targ.origin - self.origin) < 128)
+ {
+ if (vlen(targ.origin - self.origin) < 48)
+ frik_walkmove(self.origin - targ.origin);
+ else
+ {
+ self.keys = self.keys & 960;
+ bot_start_topic(4);
+ }
+ self.search_time = time + 5; // never time out
+ }
+ else if (!fisible(targ))
+ bot_lost(targ, FALSE);
+ }
+ else if (waypoint_mode > WM_LOADED)
+ {
+ if (vlen(targ.origin - self.origin) < 128)
+ {
+ bot_lost(targ, TRUE);
+ }
+ }
+ }
+
+ // buttons are lost of their frame changes
+ else if (targ.classname == "func_button")
+ {
+ if (targ.frame)
+ {
+ bot_lost(targ, TRUE);
+ if (self.enemy == targ)
+ self.enemy = world;
+ //if (self.target1)
+ // bot_get_path(self.target1, TRUE);
+
+ }
+ }
+ // trigger_multiple style triggers are lost if their thinktime changes
+ else if ((targ.movetype == MOVETYPE_NONE) && (targ.solid == SOLID_TRIGGER))
+ {
+ if (targ.nextthink >= time)
+ {
+ bot_lost(targ, TRUE);
+ //if (self.target1)
+ // bot_get_path(self.target1, TRUE);
+ }
+ }
+ // lose any target way above the bot's head
+ // FIXME: if the bot can fly in your mod..
+ if ((targ.origin_z - self.origin_z) > 64)
+ {
+ dist = targ.origin - self.origin;
+ dist_z = 0;
+ if (vlen(dist) < 32)
+ if (self.flags & FL_ONGROUND)
+ if(!frik_recognize_plat(FALSE))
+ bot_lost(targ, FALSE);
+ }
+ else if (targ.classname == "train")
+ {
+ if (frik_recognize_plat(FALSE))
+ bot_lost(targ, TRUE);
+ }
+ // targets are lost if the bot's search time has expired
+ if (time > self.search_time)
+ bot_lost(targ, FALSE);
+};
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+bot_handle_ai
+
+This is a 0.10 addition. Handles any action
+based b_aiflags.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() bot_handle_ai =
+{
+ local entity newt;
+ local vector v;
+
+ // handle ai flags -- note, not all aiflags are handled
+ // here, just those that perform some sort of action
+
+ // wait is used by the ai to stop the bot until his search time expires / or route changes
+
+ if (self.b_aiflags & AI_WAIT)
+ self.keys = self.keys & 960;
+
+ if (self.b_aiflags & AI_DOORFLAG) // was on a door when spawned
+ {
+ b_temp3 = self;
+ self = self.last_way;
+ if (!frik_recognize_plat(FALSE)) // if there is nothing there now
+ {
+ newt = FindThing("door"); // this is likely the door responsible (crossfingers)
+ self = b_temp3;
+
+ if (self.b_aiflags & AI_DOOR_NO_OPEN)
+ {
+ if (newt.nextthink)
+ self.keys = self.keys & 960; // wait until it closes
+ else
+ {
+ bot_lost(self.last_way, FALSE);
+ self.b_aiflags = self.b_aiflags - AI_DOORFLAG;
+ }
+ }
+ else
+ {
+ if (newt.targetname)
+ {
+ newt = find(world, target, newt.targetname);
+ if (newt.health > 0)
+ {
+ self.enemy = newt;
+ bot_weapon_switch(1);
+ }
+ else
+ {
+ // target_drop(self.last_way);
+ target_add(newt);
+ // bot_get_path(newt, TRUE);
+ }
+ }
+ self.b_aiflags = self.b_aiflags - AI_DOORFLAG;
+ }
+ }
+ else
+ self = b_temp3;
+ }
+
+ if (self.b_aiflags & AI_JUMP)
+ {
+ if (self.flags & FL_ONGROUND)
+ {
+ bot_jump();
+ self.b_aiflags = self.b_aiflags - AI_JUMP;
+ }
+ }
+ else if (self.b_aiflags & AI_SUPER_JUMP)
+ {
+ if (self.weapon != 32)
+ self.impulse = 7;
+ else if (self.flags & FL_ONGROUND)
+ {
+ if (bot_can_rj(self))
+ {
+ bot_jump();
+ self.v_angle_x = self.b_angle_x = 80;
+ self.button0 = TRUE;
+ }
+ else
+ bot_lost(self.target1, FALSE);
+ self.b_aiflags = self.b_aiflags - AI_SUPER_JUMP;
+ }
+ }
+ if (self.b_aiflags & AI_SURFACE)
+ {
+ if (self.waterlevel > 2)
+ {
+ self.keys = KEY_MOVEUP;
+ self.button2 = TRUE; // swim!
+ }
+ else
+ self.b_aiflags = self.b_aiflags - AI_SURFACE;
+ }
+ if (self.b_aiflags & AI_RIDE_TRAIN)
+ {
+ // simple, but effective
+ // this can probably be used for a lot of different
+ // things, not just trains (door elevators come to mind)
+ b_temp3 = self;
+ self = self.last_way;
+
+ if (!frik_recognize_plat(FALSE)) // if there is nothing there now
+ {
+ self = b_temp3;
+ self.keys = self.keys & 960;
+ }
+ else
+ {
+ self = b_temp3;
+ if (frik_recognize_plat(FALSE))
+ {
+ v = realorigin(trace_ent) + trace_ent.origin - self.origin;
+ v_z = 0;
+ if (vlen(v) < 24)
+ self.keys = self.keys & 960;
+ else
+ {
+ self.b_aiflags = self.b_aiflags | AI_PRECISION;
+ self.keys = frik_KeysForDir(v);
+ }
+ }
+ }
+ }
+ if (self.b_aiflags & AI_PLAT_BOTTOM)
+ {
+ newt = FindThing("plat");
+ if (newt.state != 1)
+ {
+ v = self.origin - realorigin(newt);
+ v_z = 0;
+ if (vlen(v) > 96)
+ self.keys = self.keys & 960;
+ else
+ frik_walkmove(v);
+ }
+ else
+ self.b_aiflags = self.b_aiflags - AI_PLAT_BOTTOM;
+ }
+ if (self.b_aiflags & AI_DIRECTIONAL)
+ {
+ if ((normalize(self.last_way.origin - self.origin) * self.b_dir) > 0.4)
+ {
+ self.b_aiflags = self.b_aiflags - AI_DIRECTIONAL;
+ bot_lost(self.target1, TRUE);
+ }
+ }
+ if (self.b_aiflags & AI_SNIPER)
+ {
+ self.b_aiflags = (self.b_aiflags | AI_WAIT | AI_PRECISION) - AI_SNIPER;
+ // FIXME: Add a switch to wep command
+ // FIXME: increase delay?
+ }
+ if (self.b_aiflags & AI_AMBUSH)
+ {
+ self.b_aiflags = (self.b_aiflags | AI_WAIT) - AI_AMBUSH;
+ // FIXME: Add a switch to wep command
+ // FIXME: increase delay?
+ }
+
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+bot_path
+
+Bot will follow a route generated by the
+begin_route set of functions in bot_way.qc.
+This code, while it works pretty well, can get
+confused
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() bot_path =
+{
+
+ local entity jj, tele;
+
+ bot_check_lost(self.target1);
+ if (!self.target1)
+ {
+ self.keys=0;
+ return;
+ }
+ if (target_onstack(self.last_way))
+ return; // old waypoint still being hunted
+
+ jj = FindRoute(self.last_way);
+ if (!jj)
+ {
+ // this is an ugly hack
+ if (self.target1.current_way != self.last_way)
+ {
+ if (self.target1.classname != "temp_waypoint")
+ if (self.target1.classname != "player")
+ bot_lost(self.target1, FALSE);
+ }
+
+ return;
+ }
+
+ // update the bot's special ai features
+
+ // Readahed types are AI conditions to perform while heading to a waypoint
+ // point types are AI flags that should be executed once reaching a waypoint
+
+ self.b_aiflags = (jj.b_aiflags & AI_READAHEAD_TYPES) | (self.last_way.b_aiflags & AI_POINT_TYPES);
+ target_add(jj);
+ if (self.last_way)
+ {
+ if (CheckLinked(self.last_way, jj) == 2) // waypoints are telelinked
+ {
+ tele = FindThing("trigger_teleport"); // this is probbly the teleport responsible
+ target_add(tele);
+ }
+ traceline(self.last_way.origin, jj.origin, FALSE, self); // check for blockage
+ if (trace_fraction != 1)
+ {
+ if (trace_ent.classname == "door" && !(self.b_aiflags & AI_DOOR_NO_OPEN)) // a door blocks the way
+ {
+ // linked doors fix
+ if (trace_ent.owner)
+ trace_ent = trace_ent.owner;
+ if ((trace_ent.health > 0) && (self.enemy == world))
+ {
+ self.enemy = trace_ent;
+ bot_weapon_switch(1);
+ self.b_aiflags = self.b_aiflags | AI_BLIND; // nick knack paddy hack
+ }
+ else if (trace_ent.targetname)
+ {
+ tele = find(world, target, trace_ent.targetname);
+ if (tele.health > 0)
+ {
+ self.enemy = tele;
+ bot_weapon_switch(1);
+ }
+ else
+ {
+ // target_drop(jj);
+ target_add(tele);
+ // bot_get_path(tele, TRUE);
+ self.b_aiflags = self.b_aiflags | AI_BLIND; // give a bot a bone
+ return;
+ }
+ }
+ }
+ else if (trace_ent.classname == "func_wall")
+ {
+ // give up
+ bot_lost(self.target1, FALSE);
+ return;
+ }
+ }
+ }
+ // this is used for AI_DRIECTIONAL
+ self.b_dir = normalize(jj.origin - self.last_way.origin);
+
+ self.last_way = jj;
+};
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Bot Priority Look. What a stupid name. This is where
+the bot finds things it wants to kill/grab.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+// priority scale
+// 0 - 10 virtually ignore
+// 10 - 30 normal item range
+// 30 - 50 bot will consider this a target worth changing course for
+// 50 - 90 bot will hunt these as vital items
+
+// *!* Make sure you add code to bot_check_lost to remove the target *!*
+
+float(entity thing) priority_for_thing =
+{
+ local float thisp;
+ thisp = 0;
+ // This is the most executed function in the bot. Careful what you do here.
+
+ if ((thing.flags & FL_ITEM) && thing.model != string_null && thing.search_time < time)
+ {
+ // ugly hack
+ if (thing._last != self)
+ thisp = 20;
+ if (thing.classname == "item_artifact_super_damage")
+ thisp = 65;
+ else if (thing.classname == "item_artifact_invulnerability")
+ thisp = 65;
+ else if (thing.classname == "item_health")
+ {
+ if (thing.spawnflags & 2)
+ thisp = 55;
+ if (self.health < 40)
+ thisp = thisp + 50;
+ }
+ else if (thing.model == "progs/armor.mdl")
+ {
+ if (self.armorvalue < 200)
+ {
+ if (thing.skin == 2)
+ thisp = 60;
+ else if (self.armorvalue < 100)
+ thisp = thisp + 25;
+ }
+ }
+ else if (thing.classname == "weapon_supershotgun")
+ {
+ if (!(self.items & 2)) // IT_SUPER_SHOTGUN
+ thisp = 25;
+ }
+ else if (thing.classname == "weapon_nailgun")
+ {
+ if (!(self.items & 4)) // IT_NAILGUN
+ thisp = 30;
+ }
+ else if (thing.classname == "weapon_supernailgun")
+ {
+ if (!(self.items & 8)) // IT_SUPER_NAILGUN
+ thisp = 35;
+ }
+ else if (thing.classname == "weapon_grenadelauncher")
+ {
+ if (!(self.items & 16)) // IT_GRENADE_LAUNCHER
+ thisp = 45;
+ }
+ else if (thing.classname == "weapon_rocketlauncher")
+ {
+ if (!(self.items & 32)) // IT_ROCKET_LAUNCHER
+ thisp = 60;
+ }
+ else if (thing.classname == "weapon_lightning")
+ {
+ if (!(self.items & 64)) // IT_LIGHTNING
+ thisp = 50;
+ }
+ }
+ else if ((thing.flags & FL_MONSTER) && thing.health > 0)
+ thisp = 45;
+ else if (thing.classname == "player")
+ {
+ if (thing.health > 0)
+ {
+ if (thing == self)
+ return 0;
+ else
+ {
+ if (thing.items & IT_INVISIBILITY) //FIXME
+ thisp = 2;
+ else if (coop)
+ {
+ thisp = 100;
+ if (thing.target1.classname == "player")
+ if (!thing.target1.ishuman)
+ return 0;
+ }
+ else if (teamplay && thing.team == self.team)
+ {
+ thisp = 100;
+ if (thing.target1.classname == "player")
+ return 0;
+ }
+ else thisp = 30;
+ }
+ }
+ }
+ else if (thing.classname == "waypoint")
+ {
+ if (thing.b_aiflags & AI_SNIPER)
+ thisp = 30;
+ else if (thing.b_aiflags & AI_AMBUSH)
+ thisp = 30;
+ }
+ if (pointcontents(thing.origin) < -3)
+ return 0;
+ if (thisp)
+ {
+ if (thing.current_way)
+ {
+ // check to see if it's unreachable
+ if (thing.current_way.items == -1)
+ return 0;
+ else
+ thisp = thisp + (13000 - thing.current_way.items) * 0.05;
+
+ }
+ }
+ return thisp;
+};
+
+void(float scope) bot_look_for_crap =
+{
+ local entity foe, best;
+ local float thatp, bestp, dist;
+
+ if (scope == 1)
+ foe = findradius(self.origin, 13000);
+ else
+ foe = findradius(self.origin, 500);
+
+ bestp = 1;
+ while(foe)
+ {
+ thatp = priority_for_thing(foe);
+ if (thatp)
+ if (!scope)
+ if (!sisible(foe))
+ thatp = 0;
+ if (thatp > bestp)
+ {
+ bestp = thatp;
+ best = foe;
+ dist = vlen(self.origin - foe.origin);
+ }
+ foe = foe.chain;
+ }
+ if (best == world)
+ return;
+ if (!target_onstack(best))
+ {
+ target_add(best);
+ if (scope)
+ {
+ bot_get_path(best, FALSE);
+ self.b_aiflags = self.b_aiflags | AI_WAIT;
+ }
+ }
+};
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+bot_angle_set
+
+Sets the bots look keys & b_angle to point at
+the target - used for fighting and just
+generally making the bot look good.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() bot_angle_set =
+{
+ local float h;
+ local vector view;
+
+ if (self.enemy)
+ {
+ if (self.enemy.items & 524288)
+ if (random() > 0.2)
+ return;
+ if (self.missile_speed == 0)
+ self.missile_speed = 10000;
+ if (self.enemy.solid == SOLID_BSP)
+ {
+ view = (((self.enemy.absmin + self.enemy.absmax) * 0.5) - self.origin);
+ }
+ else
+ {
+ h = vlen(self.enemy.origin - self.origin) / self.missile_speed;
+ if (self.enemy.flags & FL_ONGROUND)
+ view = self.enemy.velocity * h;
+ else
+ view = (self.enemy.velocity - (sv_gravity * '0 0 1') * h) * h;
+ view = self.enemy.origin + view;
+ // FIXME: ?
+ traceline(self.enemy.origin, view, FALSE, self);
+ view = trace_endpos;
+
+ if (self.weapon == 32)
+ view = view - '0 0 22';
+
+ view = normalize(view - self.origin);
+ }
+ view = vectoangles(view);
+ view_x = view_x * -1;
+ self.b_angle = view;
+ }
+ else if (self.target1)
+ {
+ view = realorigin(self.target1);
+ if (self.target1.flags & FL_ITEM)
+ view = view + '0 0 48';
+ view = view - (self.origin + self.view_ofs);
+ view = vectoangles(view);
+ view_x = view_x * -1;
+ self.b_angle = view;
+ }
+ else
+ self.b_angle_x = 0;
+ // HACK HACK HACK HACK
+ // The bot falls off ledges a lot because of "turning around"
+ // so let the bot use instant turn around when not hunting a player
+ if (self.b_skill == 3)
+ {
+ self.keys = self.keys & 63;
+ self.v_angle = self.b_angle;
+ while (self.v_angle_x < -180)
+ self.v_angle_x = self.v_angle_x + 360;
+ while (self.v_angle_x > 180)
+ self.v_angle_x = self.v_angle_x - 360;
+
+ }
+ else if ((self.enemy == world || self.enemy.movetype == MOVETYPE_PUSH) && self.target1.classname != "player")
+ {
+ self.keys = self.keys & 63;
+ self.v_angle = self.b_angle;
+ while (self.v_angle_x < -180)
+ self.v_angle_x = self.v_angle_x + 360;
+ while (self.v_angle_x > 180)
+ self.v_angle_x = self.v_angle_x - 360;
+ }
+ else if (self.b_skill < 2) // skill 2 handled in bot_phys
+ {
+ if (self.b_angle_x > 180)
+ self.b_angle_x = self.b_angle_x - 360;
+ self.keys = self.keys & 63;
+
+ if (angcomp(self.b_angle_y, self.v_angle_y) > 10)
+ self.keys = self.keys | KEY_LOOKLEFT;
+ else if (angcomp(self.b_angle_y, self.v_angle_y) < -10)
+ self.keys = self.keys | KEY_LOOKRIGHT;
+ if (angcomp(self.b_angle_x, self.v_angle_x) < -10)
+ self.keys = self.keys | KEY_LOOKUP;
+ else if (angcomp(self.b_angle_x, self.v_angle_x) > 10)
+ self.keys = self.keys | KEY_LOOKDOWN;
+ }
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+BotAI
+
+This is the main ai loop. Though called every
+frame, the ai_time limits it's actual updating
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+float stagger_think;
+
+void() BotAI =
+{
+ // am I dead? Fire randomly until I respawn
+ // health < 1 is used because fractional healths show up as 0 on normal player
+ // status bars, and the mod probably already compensated for that
+
+ if (self.health < 1)
+ {
+ self.button0 = floor(random() * 2);
+ self.button2 = 0;
+ self.keys = 0;
+ self.b_aiflags = 0;
+ ClearMyRoute();
+ self.target1 = self.target2 = self.target3 = self.target4 = self.enemy = world;
+ self.last_way = world;
+ return;
+ }
+
+ // stagger the bot's AI out so they all don't think at the same time, causing game
+ // 'spikes'
+ if (self.b_skill < 2)
+ {
+ if (self.ai_time > time)
+ return;
+
+ self.ai_time = time + 0.05;
+ if (bot_count > 0)
+ {
+ if ((time - stagger_think) < (0.1 / bot_count))
+ self.ai_time = self.ai_time + 0.1 / (2 * bot_count);
+ }
+ else
+ return;
+ }
+ if (self.view_ofs == '0 0 0')
+ bot_start_topic(7);
+ stagger_think = time;
+
+ // shut the bot's buttons off, various functions will turn them on by AI end
+
+ self.button2 = 0;
+ self.button0 = 0;
+
+
+ // target1 is like goalentity in normal Quake monster AI.
+ // it's the bot's most immediate target
+ if (route_table == self)
+ {
+ if (busy_waypoints <= 0)
+ {
+ if (waypoint_mode < WM_EDITOR)
+ bot_look_for_crap(TRUE);
+ }
+ self.b_aiflags = 0;
+ self.keys = 0;
+ }
+ else if (self.target1)
+ {
+ frik_movetogoal();
+ bot_path();
+ }
+ else
+ {
+ if (waypoint_mode < WM_EDITOR)
+ {
+ if(self.route_failed)
+ {
+ frik_bot_roam();
+ self.route_failed = 0;
+ }
+ else if(!begin_route())
+ {
+ bot_look_for_crap(FALSE);
+ }
+ self.keys = 0;
+ }
+ else
+ {
+ self.b_aiflags = AI_WAIT;
+ self.keys = 0;
+ }
+ }
+
+ // bot_angle_set points the bot at it's goal (self.enemy or target1)
+
+ bot_angle_set();
+
+ // fight my enemy. Enemy is probably a field QC coders will most likely use a lot
+ // for their own needs, since it's unused on a normal player
+ // FIXME
+ if (self.enemy)
+ bot_fight_style();
+ else if (random() < 0.2)
+ if (random() < 0.2)
+ bot_weapon_switch(-1);
+ bot_dodge_stuff();
+
+ // checks to see if bot needs to start going up for air
+ if (self.waterlevel > 2)
+ {
+ if (time > (self.air_finished - 2))
+ {
+ traceline (self.origin, self.origin + '0 0 6800', TRUE, self);
+ if (trace_inopen)
+ {
+ self.keys = KEY_MOVEUP;
+ self.button2 = TRUE; // swim!
+ return; // skip ai flags for now - this is life or death
+ }
+ }
+ }
+
+ // b_aiflags handling
+
+
+ if (self.b_aiflags)
+ bot_handle_ai();
+ else
+ bot_chat(); // don't want chat to screw him up if he's rjing or something
+};
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/frikbot/bot_ed.qc b/r17/Revamped src/Revamped QC/Primeqc4/frikbot/bot_ed.qc
new file mode 100755
index 00000000..44352c27
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/frikbot/bot_ed.qc
@@ -0,0 +1,1334 @@
+/***********************************************
+* *
+* FrikBot Waypoint Editor *
+* "The 'wtf is this doing in my mod' code" *
+* *
+***********************************************/
+
+/*
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2 of the License, or (at your
+option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software Foundation,
+Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+float saved1, saved2, saved3, scratch1, scratch2, scratch3, scratch4;
+float bytecounter, filecount;
+
+float MENU_MAIN = 1;
+float MENU_WAYPOINTS = 2;
+float MENU_LINKS = 3;
+float MENU_FLAGS = 4;
+float MENU_FLAGS2 = 5;
+float MENU_BOTS = 6;
+float MENU_WAYLIST = 7;
+// 8 = link way
+// 9 = telelink way
+// 10 = delete link
+// 11 = create link X2
+// 12 = delete link x2
+// 13 = confirmation of delete all
+// 14 = Teleport to way
+// 15 = confirmation of delete point
+
+void() BSPDumpWaypoints;
+void() QCDumpWaypoints;
+void() DumpWaypoints;
+/*
+// source for the menu strings...
+
+-- Main Menu --\n
+[1] >>Waypoint Management\n
+[2] >>Link Management \n
+[3] >>AI Flag Management \n
+[4] >>Bot Management \n
+[5] >>Waylist Management \n
+[6] [#] Noclip \n
+[7] [#] Godmode \n
+[8] [#] Hold Select \n
+[9] Teleport to Way # \n
+[0] Close Menu \n
+
+// missing from main is show way info
+// iffy on the teleport to way thing being on main...seems like either a bot or way list thing
+
+-- Waypoint Management --\n
+[1] Move Waypoint \n
+[2] Delete Waypoint \n
+[3] Make Waypoint \n
+[4] Make Way + Link \n
+[5] Make Way + Link X2 \n
+[6] Make Way + Telelink \n
+[7] Show waypoint info \n
+[8] >>Link Management \n
+[9] >>AI Flag Management \n
+[0] >>Main Menu \n
+
+-- Link Management --\n
+[1] Unlink Waypoint \n
+[2] Create Link \n
+[3] Create Telelink \n
+[4] Delete Link \n
+[5] Create Link X2 \n
+[6] Delete Link X2 \n
+[7] >Make Waypoint \n
+[8] >>Waypoint Management\n
+[9] >>AI Flag Management \n
+[0] >>Main Menu \n
+
+// Ai flags...ugh
+
+-- AI Flag Management --\n
+[1] [#] Door Flag \n
+[2] [#] Precision \n
+[3] [#] Surface for air \n
+[4] [#] Blind mode \n
+[5] [#] Jump \n
+[6] [#] Dark \n
+[7] [#] Super Jump \n
+\n
+[9] >>AI Flags page 2 \n
+[0] >>Main Menu \n
+
+-- AI Flags pg. 2--\n
+[1] [#] Difficult \n
+[2] [#] Wait for plat \n
+[3] [#] Ride train \n
+[4] [#] Door flag no open\n
+[5] [#] Ambush \n
+[6] [#] Snipe \n
+[7] [#] Trace Test \n
+\n
+[9] >>AI Flag Management \n
+[0] >>Main Menu \n
+
+-- Bot Management --\n
+[1] Add a Test Bot \n
+[2] Order Test Bot here \n
+[3] Remove Test Bot \n
+[4] Stop Test Bot \n
+[5] Teleport Bot here \n
+[6] Teleport to Way # \n
+\n
+\n
+\n
+[0] >>Main Menu \n
+
+-- Waylist Management --\n
+[1] Delete ALL Waypoints \n
+[2] Dump Waypoints \n
+[3] Check For Errors \n
+[4] Save Waypoints \n
+[5] [#] Dynamic Mode \n
+[6] [#] Dynamic Link \n
+[7] [#] WAY output \n
+[8] [#] QC output \n
+[9] [#] BSP ents output \n
+[0] Main Menu \n
+
+*/
+
+void() bot_menu_display =
+{
+// build options
+ local string s1, s2, s3, s4, s5, s6, s7, h;
+ local entity t;
+
+// check impulses
+ if (self.impulse > 0 && self.impulse < 11 && self.b_menu)
+ {
+ if (self.b_menu == MENU_MAIN)
+ {
+ if (self.impulse == 1)
+ {
+ self.b_menu = MENU_WAYPOINTS;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 2)
+ {
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 3)
+ {
+ self.b_menu = MENU_FLAGS;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 4)
+ {
+ self.b_menu = MENU_BOTS;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 5)
+ {
+ self.b_menu = MENU_WAYLIST;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 6)
+ {
+ if (self.movetype == MOVETYPE_NOCLIP)
+ self.movetype = MOVETYPE_WALK;
+ else
+ self.movetype = MOVETYPE_NOCLIP;
+ self.b_menu_time = time;
+
+ }
+ else if (self.impulse == 7)
+ {
+ if (self.flags & FL_GODMODE)
+ self.flags = self.flags - FL_GODMODE;
+ else
+ self.flags = self.flags | FL_GODMODE;
+ self.b_menu_time = time;
+
+ }
+ else if (self.impulse == 8)
+ {
+ if (self.b_aiflags & AI_HOLD_SELECT)
+ self.b_aiflags = self.b_aiflags - AI_HOLD_SELECT;
+ else
+ self.b_aiflags = self.b_aiflags | AI_HOLD_SELECT;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 9)
+ {
+ self.b_menu = 14;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 10)
+ bot_way_edit();
+ }
+ else if (self.b_menu == MENU_WAYPOINTS)
+ {
+ if (self.impulse == 1)
+ {
+ if (self.current_way)
+ setorigin(self.current_way, self.origin + self.view_ofs);
+ }
+ else if (self.impulse == 2)
+ {
+ if (self.current_way)
+ {
+ self.b_menu = 15;
+ self.b_menu_time = time;
+ self.last_way = self.current_way;
+ }
+ }
+ else if (self.impulse == 3)
+ {
+ make_waypoint(self.origin + self.view_ofs);
+ }
+ else if (self.impulse == 4)
+ {
+ t = make_waypoint(self.origin + self.view_ofs);
+ if (!LinkWays(self.current_way, t))
+ sprint(self, "Unable to link them\n");
+ }
+ else if (self.impulse == 5)
+ {
+ t = make_waypoint(self.origin + self.view_ofs);
+ if (!LinkWays(self.current_way, t))
+ sprint(self, "Unable to link old to new\n");
+ LinkWays(t, self.current_way);
+ }
+ else if (self.impulse == 6)
+ {
+ t = make_waypoint(self.origin + self.view_ofs);
+ if (!TeleLinkWays(self.current_way, t))
+ sprint(self, "Unable to link them\n");
+ }
+ else if (self.impulse == 7)
+ {
+ if (self.current_way)
+ {
+ sprint(self, "\nwaypoint info for waypoint #");
+ h = ftos(self.current_way.count);
+ sprint(self, h);
+ sprint(self, "\nAI Flag value: ");
+ h = ftos(self.current_way.b_aiflags);
+ sprint(self, h);
+
+ if (self.current_way.target1)
+ {
+ h = ftos(self.current_way.target1.count);
+ if (self.current_way.b_aiflags & AI_TELELINK_1)
+ sprint(self, "\nTelelink1 to:");
+ else
+ sprint(self, "\nLink1 to:");
+ sprint(self, h);
+ }
+ if (self.current_way.target2)
+ {
+ h = ftos(self.current_way.target2.count);
+ if (self.current_way.b_aiflags & AI_TELELINK_2)
+ sprint(self, "\nTelelink2 to:");
+ else
+ sprint(self, "\nLink2 to:");
+ sprint(self, h);
+ }
+ if (self.current_way.target3)
+ {
+ h = ftos(self.current_way.target3.count);
+ if (self.current_way.b_aiflags & AI_TELELINK_3)
+ sprint(self, "\nTelelink3 to:");
+ else
+ sprint(self, "\nLink3 to:");
+ sprint(self, h);
+ }
+ if (self.current_way.target4)
+ {
+ h = ftos(self.current_way.target4.count);
+ if (self.current_way.b_aiflags & AI_TELELINK_4)
+ sprint(self, "\nTelelink4 to:");
+ else
+ sprint(self, "\nLink4 to:");
+ sprint(self, h);
+ }
+ sprint(self, "\n\n");
+ }
+
+ }
+ if (self.impulse == 8)
+ {
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 9)
+ {
+ self.b_menu = MENU_FLAGS;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 10)
+ {
+ self.b_menu = MENU_MAIN;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.b_menu == MENU_LINKS)
+ {
+ if (self.impulse == 1)
+ {
+ if (self.current_way)
+ self.current_way.target1 = self.current_way.target2 = self.current_way.target3 = self.current_way.target4 = world;
+ }
+ else if (self.impulse == 2)
+ {
+ self.b_menu = 8;
+ self.b_menu_time = time;
+ self.last_way = self.current_way;
+ }
+ else if (self.impulse == 3)
+ {
+ self.b_menu = 9;
+ self.b_menu_time = time;
+ self.last_way = self.current_way;
+ }
+ else if (self.impulse == 4)
+ {
+ self.b_menu = 10;
+ self.b_menu_time = time;
+ self.last_way = self.current_way;
+ }
+ else if (self.impulse == 5)
+ {
+ self.b_menu = 11;
+ self.b_menu_time = time;
+ self.last_way = self.current_way;
+ }
+ else if (self.impulse == 6)
+ {
+ self.b_menu = 12;
+ self.b_menu_time = time;
+ self.last_way = self.current_way;
+ }
+ else if (self.impulse == 7)
+ make_waypoint(self.origin + self.view_ofs);
+ else if (self.impulse == 8)
+ {
+ self.b_menu = MENU_WAYPOINTS;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 9)
+ {
+ self.b_menu = MENU_FLAGS;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 10)
+ {
+ self.b_menu = MENU_MAIN;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.b_menu == MENU_FLAGS)
+ {
+
+ if (self.current_way)
+ {
+ if (self.impulse == 1)
+ {
+ if (self.current_way.b_aiflags & AI_DOORFLAG)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_DOORFLAG);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_DOORFLAG;
+
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 2)
+ {
+ if (self.current_way.b_aiflags & AI_PRECISION)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_PRECISION);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_PRECISION;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 3)
+ {
+ if (self.current_way.b_aiflags & AI_SURFACE)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_SURFACE);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_SURFACE;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 4)
+ {
+ if (self.current_way.b_aiflags & AI_BLIND)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_BLIND);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_BLIND;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 5)
+ {
+ if (self.current_way.b_aiflags & AI_JUMP)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_JUMP);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_JUMP;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 6)
+ {
+ if (self.current_way.b_aiflags & AI_DIRECTIONAL)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_DIRECTIONAL);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_DIRECTIONAL;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 7)
+ {
+ if (self.current_way.b_aiflags & AI_SUPER_JUMP)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_SUPER_JUMP);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_SUPER_JUMP;
+ self.b_menu_time = time;
+ }
+ }
+ if (self.impulse == 9)
+ {
+ self.b_menu = MENU_FLAGS2;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 10)
+ {
+ self.b_menu = MENU_MAIN;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.b_menu == MENU_FLAGS2)
+ {
+
+ if (self.current_way)
+ {
+ if (self.impulse == 1)
+ {
+ if (self.current_way.b_aiflags & AI_DIFFICULT)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_DIFFICULT);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_DIFFICULT; self.b_menu_time = time;
+ }
+ else if (self.impulse == 2)
+ {
+ if (self.current_way.b_aiflags & AI_PLAT_BOTTOM)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_PLAT_BOTTOM);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_PLAT_BOTTOM;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 3)
+ {
+ if (self.current_way.b_aiflags & AI_RIDE_TRAIN)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_RIDE_TRAIN);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_RIDE_TRAIN;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 4)
+ {
+ if (self.current_way.b_aiflags & AI_DOOR_NO_OPEN)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_DOOR_NO_OPEN);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_DOOR_NO_OPEN;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 5)
+ {
+ if (self.current_way.b_aiflags & AI_AMBUSH)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_AMBUSH);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_AMBUSH;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 6)
+ {
+ if (self.current_way.b_aiflags & AI_SNIPER)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_SNIPER);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_SNIPER;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 7)
+ {
+ if (self.current_way.b_aiflags & AI_TRACE_TEST)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_TRACE_TEST);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_TRACE_TEST;
+ self.b_menu_time = time;
+ }
+
+ }
+ if (self.impulse == 9)
+ {
+ self.b_menu = MENU_FLAGS;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 10)
+ {
+ self.b_menu = MENU_MAIN;
+ self.b_menu_time = time;
+ }
+ }
+
+ else if (self.b_menu == MENU_BOTS)
+ {
+ if (self.impulse == 1)
+ {
+ self.impulse = 100;
+ return;
+ }
+ else if (self.impulse == 2)
+ {
+ b_temp3 = self;
+ self = player_head;
+ while(self)
+ {
+ if (!self.ishuman)
+ {
+ target_add(b_temp3);
+ bot_get_path(b_temp3, TRUE);
+ self = world;
+ }
+ else
+ self = self._next;
+ }
+ self = b_temp3;
+ }
+ else if (self.impulse == 3)
+ {
+ self.impulse = 102;
+ return;
+ }
+ else if (self.impulse == 4)
+ {
+ b_temp1 = self;
+ self = player_head;
+ while(self)
+ {
+ if (!self.ishuman)
+ {
+ self.target1 = self.target2 = self.target3 = self.target4 = world;
+ route_table = world;
+ }
+ self = self._next;
+ }
+ self = b_temp1;
+ }
+ else if (self.impulse == 5)
+ {
+ if (self.current_way)
+ {
+ b_temp1 = self;
+ self = player_head;
+ while(self)
+ {
+ if (!self.ishuman)
+ {
+ setorigin(self, b_temp1.current_way.origin);
+ }
+ self = self._next;
+ }
+ self = b_temp1;
+ }
+ else
+ sprint(self, "select a waypoint first\n");
+ }
+ else if (self.impulse == 6)
+ {
+ self.b_menu = 14;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 10)
+ {
+ self.b_menu = MENU_MAIN;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.b_menu == MENU_WAYLIST)
+ {
+ if (self.impulse == 1)
+ {
+ self.b_menu = 13;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 2)
+ {
+ if (dump_mode == 0)
+ DumpWaypoints();
+ else if (dump_mode == 1)
+ QCDumpWaypoints();
+ else if (dump_mode == 2)
+ BSPDumpWaypoints();
+ }
+ else if (self.impulse == 3)
+ {
+ t = way_head;
+ while(t)
+ {
+ if ((t.target1 == world) && (t.target2 == world) && (t.target3 == world) && (t.target4 == world))
+ {
+ sprint(self, "Waypoint #");
+ h = ftos(t.count);
+ sprint(self, h);
+ sprint(self, " has no outbound links\n");
+ }
+ if ((t.target1 == t) || (t.target2 == t) || (t.target3 == t) || (t.target4 == t))
+ {
+ sprint(self, "Waypoint #");
+ h = ftos(t.count);
+ sprint(self, h);
+ sprint(self, " links to itself (??)\n");
+ }
+ t = t._next;
+ }
+ sprint(self, "Error check complete\n");
+ }
+ else if (self.impulse == 4)
+ {
+ sprint(self, "not in this version (FBX 0.10.0)\n");
+ }
+ else if (self.impulse == 5)
+ {
+ if (waypoint_mode == WM_EDITOR_DYNAMIC)
+ waypoint_mode = WM_EDITOR;
+ else
+ waypoint_mode = WM_EDITOR_DYNAMIC;
+ self.b_menu_time = time;
+
+ }
+ else if (self.impulse == 6)
+ {
+ if (waypoint_mode == WM_EDITOR_DYNLINK)
+ waypoint_mode = WM_EDITOR;
+ else
+ waypoint_mode = WM_EDITOR_DYNLINK;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 7)
+ {
+ dump_mode = 0;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 8)
+ {
+ dump_mode = 1;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 9)
+ {
+ dump_mode = 2;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 10)
+ {
+ self.b_menu = MENU_MAIN;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.b_menu == 8)
+ {
+ if (self.impulse == 1)
+ {
+ if (self.current_way)
+ {
+ if (!LinkWays(self.last_way, self.current_way))
+ sprint(self, "Unable to link them\n");
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.impulse == 2)
+ {
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.b_menu == 9)
+ {
+ if (self.impulse == 1)
+ {
+ if (self.current_way)
+ {
+ if (!TeleLinkWays(self.last_way, self.current_way))
+ sprint(self, "Unable to link them\n");
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.impulse == 2)
+ {
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.b_menu == 10)
+ {
+ if (self.impulse == 1)
+ {
+ if (self.current_way)
+ {
+ UnlinkWays(self.last_way, self.current_way);
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.impulse == 2)
+ {
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.b_menu == 11)
+ {
+ if (self.impulse == 1)
+ {
+ if (self.current_way)
+ {
+ if (!LinkWays(self.last_way, self.current_way))
+ sprint(self, "Unable to link 1 to 2\n");
+ if (!LinkWays(self.current_way, self.last_way))
+ sprint(self, "Unable to link 2 to 1\n");
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.impulse == 2)
+ {
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.b_menu == 12)
+ {
+ if (self.impulse == 1)
+ {
+ if (self.current_way)
+ {
+ UnlinkWays(self.last_way, self.current_way);
+ UnlinkWays(self.current_way, self.last_way);
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.impulse == 2)
+ {
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.b_menu == 13)
+ {
+ if (self.impulse == 1)
+ {
+ ClearAllWays();
+ self.b_menu = MENU_WAYLIST;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 2)
+ {
+ self.b_menu = MENU_WAYLIST;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.b_menu == 14)
+ {
+ if (self.impulse == 10)
+ self.impulse = 0;
+ self.b_menu_value = self.b_menu_value * 10 + self.impulse;
+ self.b_menu_time = 0;
+ }
+ else if (self.b_menu == 15)
+ {
+ if (self.impulse == 1)
+ {
+ delete_waypoint(self.last_way);
+ self.b_menu = MENU_WAYPOINTS;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 2)
+ {
+ self.b_menu = MENU_WAYPOINTS;
+ self.b_menu_time = time;
+ }
+ }
+ self.impulse = 0;
+
+ }
+ if (self.b_menu_time < time)
+ {
+ if (self.b_menu == MENU_MAIN)
+ {
+ s1 = "-- Main Menu --\n[1] >>Waypoint Management\n[2] >>Link Management \n[3] >>AI Flag Management \n[4] >>Bot Management \n[5] >>Waylist Management \n";
+ if (self.movetype == MOVETYPE_NOCLIP)
+ s2 = "[6] [#] Noclip \n";
+ else
+ s2 = "[6] [ ] Noclip \n";
+
+ if (self.flags & FL_GODMODE)
+ s3 = "[7] [#] Godmode \n";
+ else
+ s3 = "[7] [ ] Godmode \n";
+ if (self.b_aiflags & AI_HOLD_SELECT)
+ s4 = "[8] [#] Hold Select \n";
+ else
+ s4 = "[8] [ ] Hold Select \n";
+ s5 = "[9] Teleport to Way # \n[0] Close Menu \n";
+ }
+ else if (self.b_menu == MENU_WAYPOINTS)
+ {
+ s1 = "-- Waypoint Management --\n[1] Move Waypoint \n[2] Delete Waypoint \n[3] Make Waypoint \n[4] Make Way + Link \n[5] Make Way + Link X2 \n[6] Make Way + Telelink \n[7] Show waypoint info \n[8] >>Link Management \n[9] >>AI Flag Management \n[0] >>Main Menu \n";
+ }
+ else if (self.b_menu == MENU_LINKS)
+ {
+ s1 = "-- Link Management --\n[1] Unlink Waypoint \n[2] Create Link \n[3] Create Telelink \n[4] Delete Link \n[5] Create Link X2 \n[6] Delete Link X2 \n[7] >Make Waypoint \n[8] >>Waypoint Management\n[9] >>AI Flag Management \n[0] >>Main Menu \n";
+ }
+ else if (self.b_menu == MENU_FLAGS)
+ {
+ if (self.current_way.b_aiflags & AI_DOORFLAG)
+ s1 = "-- AI Flag Management --\n[1] [#] Door Flag \n";
+ else
+ s1 = "-- AI Flag Management --\n[1] [ ] Door Flag \n";
+
+ if (self.current_way.b_aiflags & AI_PRECISION)
+ s2 = "[2] [#] Precision \n";
+ else
+ s2 = "[2] [ ] Precision \n";
+
+ if (self.current_way.b_aiflags & AI_SURFACE)
+ s3 = "[3] [#] Surface for air \n";
+ else
+ s3 = "[3] [ ] Surface for air \n";
+
+ if (self.current_way.b_aiflags & AI_BLIND)
+ s4 = "[4] [#] Blind mode \n";
+ else
+ s4 = "[4] [ ] Blind mode \n";
+
+ if (self.current_way.b_aiflags & AI_JUMP)
+ s5 = "[5] [#] Jump \n";
+ else
+ s5 = "[5] [ ] Jump \n";
+
+ if (self.current_way.b_aiflags & AI_DIRECTIONAL)
+ s6 = "[6] [#] Directional \n";
+ else
+ s6 = "[6] [ ] Directional \n";
+
+ if (self.current_way.b_aiflags & AI_SUPER_JUMP)
+ s7 = "[7] [#] Super Jump \n\n[9] >>AI Flags page 2 \n[0] >>Main Menu \n";
+ else
+ s7 = "[7] [ ] Super Jump \n\n[9] >>AI Flags page 2 \n[0] >>Main Menu \n";
+ }
+ else if (self.b_menu == MENU_FLAGS2)
+ {
+ if (self.current_way.b_aiflags & AI_DIFFICULT)
+ s1 = "-- AI Flags pg. 2--\n[1] [#] Difficult \n";
+ else
+ s1 = "-- AI Flags pg. 2--\n[1] [ ] Difficult \n";
+
+ if (self.current_way.b_aiflags & AI_PLAT_BOTTOM)
+ s2 = "[2] [#] Wait for plat \n";
+ else
+ s2 = "[2] [ ] Wait for plat \n";
+
+ if (self.current_way.b_aiflags & AI_RIDE_TRAIN)
+ s3 = "[3] [#] Ride train \n";
+ else
+ s3 = "[3] [ ] Ride train \n";
+
+ if (self.current_way.b_aiflags & AI_DOOR_NO_OPEN)
+ s4 = "[4] [#] Door flag no open\n";
+ else
+ s4 = "[4] [ ] Door flag no open\n";
+
+ if (self.current_way.b_aiflags & AI_AMBUSH)
+ s5 = "[5] [#] Ambush \n";
+ else
+ s5 = "[5] [ ] Ambush \n";
+
+ if (self.current_way.b_aiflags & AI_SNIPER)
+ s6 = "[6] [#] Snipe \n";
+ else
+ s6 = "[6] [ ] Snipe \n";
+
+ if (self.current_way.b_aiflags & AI_TRACE_TEST)
+ s7 = "[7] [#] Trace Test \n\n[9] >>AI Flag Management \n[0] >>Main Menu \n";
+ else
+ s7 = "[7] [ ] Trace Test \n\n[9] >>AI Flag Management \n[0] >>Main Menu \n";
+
+ }
+ else if (self.b_menu == MENU_BOTS)
+ {
+ s1 = "-- Bot Management --\n[1] Add a Test Bot \n[2] Order Test Bot here \n[3] Remove Test Bot \n[4] Stop Test Bot \n[5] Teleport Bot here \n[6] Teleport to Way # \n\n\n\n[0] >>Main Menu \n";
+ }
+ else if (self.b_menu == MENU_WAYLIST)
+ {
+ s1 = "-- Waylist Management --\n[1] Delete ALL Waypoints \n[2] Dump Waypoints \n[3] Check For Errors \n[4] Save Waypoints \n";
+
+ if (waypoint_mode == WM_EDITOR_DYNAMIC)
+ s2 = "[5] [#] Dynamic Mode \n[6] [#] Dynamic Link \n";
+ else if (waypoint_mode == WM_EDITOR_DYNLINK)
+ s2 = "[5] [ ] Dynamic Mode \n[6] [#] Dynamic Link \n";
+ else
+ s2 = "[5] [ ] Dynamic Mode \n[6] [ ] Dynamic Link \n";
+ if (dump_mode == 0)
+ s3 = "[7] [#] WAY output \n[8] [ ] QC output \n[9] [ ] BSP ents output \n[0] Main Menu \n";
+ else if (dump_mode == 1)
+ s3 = "[7] [ ] WAY output \n[8] [#] QC output \n[9] [ ] BSP ents output \n[0] Main Menu \n";
+ else if (dump_mode == 2)
+ s3 = "[7] [ ] WAY output \n[8] [ ] QC output \n[9] [#] BSP ents output \n[0] Main Menu \n";
+
+ }
+ else if (self.b_menu == 8)
+ s1 = "-- Link Ways --\n\nSelect another way and push 1\nor press 2 to cancel";
+ else if (self.b_menu == 9)
+ s1 = "-- Telelink Ways --\n\nSelect another way and push 1\nor press 2 to cancel";
+ else if (self.b_menu == 10)
+ s1 = "-- Delete Link --\n\nSelect another way and push 1\nor press 2 to cancel";
+ else if (self.b_menu == 11)
+ s1 = "-- Create Link X2 --\n\nSelect another way and push 1\nor press 2 to cancel";
+ else if (self.b_menu == 12)
+ s1 = "-- Delete Link X2 --\n\nSelect another way and push 1\nor press 2 to cancel";
+ else if (self.b_menu == 13)
+ s1 = "-- Delete ALL Ways --\n\nAre you sure? Push 1 to go\nthrough with it, 2 to cancel";
+ else if (self.b_menu == 14)
+ {
+ s1 = "-- Teleport to Way # --\n\nEnter way number and press\nimpulse 104 to warp\n\nWaypoint #";
+ s2 = ftos(self.b_menu_value);
+
+ }
+ else if (self.b_menu == 15)
+ s1 = "-- Delete Waypoint --\n\nAre you sure? Push 1 to go\nthrough with it, 2 to cancel";
+ frik_big_centerprint(self, s1, s2, s3, s4, s5, s6, s7);
+ self.b_menu_time = time + 1.25;
+ }
+};
+
+
+// engage menu
+void() bot_way_edit =
+{
+ local entity t;
+ local float f;
+ if (self.b_menu_value)
+ {
+ if (self.b_menu == 14)
+ {
+ t = WaypointForNum(self.b_menu_value);
+ if (t)
+ setorigin(self, t.origin - self.view_ofs);
+ else
+ sprint(self, "No waypoint with that number\n");
+
+ self.b_menu = MENU_MAIN;
+ self.b_menu_time = time;
+ }
+ self.b_menu_value = 0;
+ return;
+ }
+ if (waypoint_mode < WM_EDITOR)
+ {
+ self.b_menu = MENU_MAIN;
+ waypoint_mode = WM_EDITOR;
+ self.b_menu_time = 0;
+ cvar_set("saved2", "0");
+ WriteByte(MSG_ALL, 8);
+ WriteByte(MSG_ALL, 1);
+ WriteString(MSG_ALL, "MAKE SURE THE FOLLOWING LINE CONTAINS -CONDEBUG BEFORE PROCEEDING\n");
+ localcmd("cmdline\n");
+ t = way_head;
+ while (t)
+ {
+ setmodel(t, "progs/s_bubble.spr"); // show the waypoints
+ t = t._next;
+ }
+ if (self.current_way)
+ setmodel(self.current_way, "progs/s_light.spr");
+ }
+ else
+ {
+ saved2 = cvar("saved2");
+ if (saved2 != 0)
+ {
+ f = self.b_menu;
+ self.b_menu = floor(saved2/16);
+ self.impulse = saved2 & 15;
+ bot_menu_display();
+ self.b_menu = f;
+ cvar_set("saved2", "0");
+ return;
+ }
+ self.b_menu = 0;
+ waypoint_mode = WM_LOADED;
+ t = way_head;
+ while (t)
+ {
+ setmodel(t, string_null); // hide the waypoints
+ t = t._next;
+ }
+ }
+};
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Waypoint Saving to file.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+
+// bytecount is really iffy
+// since there is no true way to determine the length of an ftos
+// it uses an approximate of 5
+// various other things are guesses, but I don't cut it at the absolute
+// max so it should be okay
+
+void() PrintWaypoint =
+{
+ local entity t;
+ local float needcolon;
+ local string h;
+
+ if (self.enemy == world)
+ t = way_head;
+ else
+ t = self.enemy._next;
+ if (bytecounter >= 8000)
+ {
+ bprint("exec maps/");
+ bprint(mapname);
+ bprint(".wa");
+ h = ftos(filecount);
+ bprint(h);
+ filecount = filecount + 1;
+ bprint("\n// **** break here **** \n");
+ bytecounter = 26;
+ }
+ if (t == world)
+ {
+ remove(self);
+ fixer = world;
+ bprint("saved4 3\n// end waypoint dump\n");
+ bytecounter = bytecounter + 27;
+ return;
+ }
+ if ((t.origin_x != saved1) || (t.count == 1))
+ {
+ bprint("saved1 ");
+ h = ftos(t.origin_x);
+ bprint(h);
+ saved1 = t.origin_x;
+ bytecounter = bytecounter + 12;
+ needcolon = TRUE;
+ }
+ if ((t.origin_y != saved2) || (t.count == 1))
+ {
+ if (needcolon)
+ {
+ bprint("; ");
+ bytecounter = bytecounter + 2;
+ }
+ else
+ needcolon = TRUE;
+ bprint("saved2 ");
+ h = ftos(t.origin_y);
+ bprint(h);
+ bytecounter = bytecounter + 12;
+ saved2 = t.origin_y;
+ }
+ if ((t.origin_z != saved3) || (t.count == 1))
+ {
+ if (needcolon)
+ {
+ bprint("; ");
+ bytecounter = bytecounter + 2;
+ }
+ else
+ needcolon = TRUE;
+ bprint("saved3 ");
+ h = ftos(t.origin_z);
+ bprint(h);
+ bytecounter = bytecounter + 12;
+ saved3 = t.origin_z;
+ }
+ bytecounter = bytecounter + 1;
+ bprint("\n");
+ needcolon = FALSE;
+ if ((scratch1 != t.target1.count) || t.count == 1)
+ {
+ needcolon = TRUE;
+ bprint("scratch1 ");
+ bytecounter = bytecounter + 14;
+ h = ftos(t.target1.count);
+ bprint(h);
+ scratch1 = t.target1.count;
+ }
+ if ((scratch2 != t.target2.count) || t.count == 1)
+ {
+ if (needcolon)
+ {
+ bprint("; ");
+ bytecounter = bytecounter + 2;
+ }
+ else
+ needcolon = TRUE;
+ bprint("scratch2 ");
+ bytecounter = bytecounter + 14;
+ h = ftos(t.target2.count);
+ bprint(h);
+ scratch2 = t.target2.count;
+ }
+ if ((scratch3 != t.target3.count) || t.count == 1)
+ {
+ if (needcolon)
+ {
+ bprint("; ");
+ bytecounter = bytecounter + 2;
+ }
+ else
+ needcolon = TRUE;
+ bprint("scratch3 ");
+ bytecounter = bytecounter + 14;
+ h = ftos(t.target3.count);
+ bprint(h);
+ scratch3 = t.target3.count;
+ }
+ if ((scratch4 != t.target4.count) || t.count == 1)
+ {
+ if (needcolon)
+ {
+ bprint("; ");
+ bytecounter = bytecounter + 2;
+ }
+ else
+ needcolon = TRUE;
+ bprint("scratch4 ");
+ bytecounter = bytecounter + 14;
+ h = ftos(t.target4.count);
+ bprint(h);
+ scratch4 = t.target4.count;
+ }
+ bprint("\nsaved4 ");
+ bytecounter = bytecounter + 19;
+ if (t.count != 1)
+ h = ftos(t.b_aiflags * 4 + 2);
+ else
+ h = ftos(t.b_aiflags * 4 + 1);
+ bprint(h);
+ bprint ("; wait\n");
+ self.nextthink = time + 0.01;
+ self.enemy = t;
+};
+
+// to allow for 100+ waypoints, we need to trick the runaway loop counter
+void() DumpWaypoints =
+{
+ bytecounter = 50;
+ filecount = 1;
+
+ bprint("// ");
+ bprint(world.message);
+ bprint("- maps/");
+ bprint(mapname);
+ bprint(".way\n");
+ bprint("// Ways by ");
+ bprint(self.netname);
+ bprint("\n");
+ if (!fixer)
+ {
+ fixer = spawn();
+ fixer.nextthink = time + 0.01;
+ fixer.think = PrintWaypoint;
+ fixer.enemy = world;
+ }
+};
+
+void() PrintQCWaypoint =
+{
+ local entity t;
+ local string h;
+
+ if (self.enemy == world)
+ t = way_head;
+ else
+ t = self.enemy._next;
+
+ if (t == world)
+ {
+ remove(self);
+ fixer = world;
+ bprint("};\n\n// End dump\n");
+ return;
+ }
+ bprint(" make_way(");
+ h = vtos(t.origin);
+ bprint(h);
+ bprint(", '");
+ h = ftos(t.target1.count);
+ bprint(h);
+ bprint(" ");
+ h = ftos(t.target2.count);
+ bprint(h);
+ bprint(" ");
+ h = ftos(t.target3.count);
+ bprint(h);
+ bprint("', ");
+ h = ftos(t.target4.count);
+ bprint(h);
+ bprint(", ");
+ h = ftos(t.b_aiflags);
+ bprint(h);
+ bprint(");\n");
+ self.nextthink = time + 0.01;
+ self.enemy = t;
+
+};
+void() QCDumpWaypoints =
+{
+ bprint("/* QC Waypoint Dump - src/frikbot/map_");
+
+ bprint(mapname);
+ bprint(".qc\nFor instructions please read the\nreadme.html that comes with FrikBot */\n\nvoid(vector org, vector bit1, float bit4, float flargs) make_way;\n");
+ bprint("// Ways by ");
+ bprint(self.netname);
+ bprint("\n\n");
+
+ bprint("void() map_");
+ bprint(mapname);
+ bprint(" =\n{\n");
+
+
+ if (!fixer)
+ {
+ fixer = spawn();
+ fixer.nextthink = time + 0.01;
+ fixer.think = PrintQCWaypoint;
+ fixer.enemy = world;
+ }
+};
+
+void() PrintBSPWaypoint =
+{
+ local entity t;
+ local string h;
+
+ if (self.enemy == world)
+ t = way_head;
+ else
+ t = self.enemy._next;
+
+ if (t == world)
+ {
+ bprint("\n\n// End dump\n");
+ remove(self);
+ fixer = world;
+ return;
+ }
+ bprint("{\n\"classname\" \"waypoint\"\n\"origin\" \"");
+ h = ftos(t.origin_x);
+ bprint(h);
+ bprint(" ");
+ h = ftos(t.origin_y);
+ bprint(h);
+ bprint(" ");
+ h = ftos(t.origin_z);
+ bprint(h);
+ if (t.target1.count)
+ {
+ bprint("\"\n\"b_pants\" \"");
+ h = ftos(t.target1.count);
+ bprint(h);
+ }
+ if (t.target2.count)
+ {
+ bprint("\"\n\"b_skill\" \"");
+ h = ftos(t.target2.count);
+ bprint(h);
+ }
+ if (t.target3.count)
+ {
+ bprint("\"\n\"b_shirt\" \"");
+ h = ftos(t.target3.count);
+ bprint(h);
+ }
+ if (t.target4.count)
+ {
+ bprint("\"\n\"b_frags\" \"");
+ h = ftos(t.target4.count);
+ bprint(h);
+ }
+ if (t.b_aiflags)
+ {
+ bprint("\"\n\"b_aiflags\" \"");
+ h = ftos(t.b_aiflags);
+ bprint(h);
+ }
+ bprint("\"\n}\n");
+ self.nextthink = time + 0.01;
+ self.enemy = t;
+
+};
+void() BSPDumpWaypoints =
+{
+ bprint("/* BSP entities Dump - maps/");
+
+ bprint(mapname);
+ bprint(".ent\nFor instructions please read the\nreadme.html that comes with FrikBot */\n\n\n");
+
+ if (!fixer)
+ {
+ fixer = spawn();
+ fixer.nextthink = time + 0.01;
+ fixer.think = PrintBSPWaypoint;
+ fixer.enemy = world;
+ }
+};
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/frikbot/bot_fight.qc b/r17/Revamped src/Revamped QC/Primeqc4/frikbot/bot_fight.qc
new file mode 100755
index 00000000..bb8d9987
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/frikbot/bot_fight.qc
@@ -0,0 +1,438 @@
+/***********************************************
+* *
+* FrikBot Fight Code *
+* "Because I ain't no Ghandi code" *
+* *
+***********************************************/
+
+/*
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2 of the License, or (at your
+option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software Foundation,
+Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+.entity avoid;
+
+float(entity e) bot_size_player =
+{
+ local float sz;
+
+ sz = e.health + e.armorvalue * e.armortype;
+ if (e.weapon == 32)
+ sz = sz + 60;
+ else if (e.weapon == 64)
+ sz = sz + 60;
+ else if (e.weapon == 16)
+ sz = sz + 50;
+ else if (e.weapon == 8)
+ sz = sz + 50;
+ else if (e.weapon == 4)
+ sz = sz + 40;
+ else if (e.weapon == 2)
+ sz = sz + 40;
+ else if (e.weapon == 1)
+ sz = sz + 10;
+ else if (e.weapon == 4096)
+ sz = sz - 50;
+ if (e.items & 4194304) // Quad
+ sz = sz + 200;
+ if (e.items & 1048576) // Invul
+ sz = sz + 300;
+ if (e.items & 524288) // Invis
+ sz = sz + 250;
+ return sz;
+};
+
+void() bot_dodge_stuff =
+{
+ local entity foe;
+ local float foedist, avdist, foesz, flen, tsz;
+ local vector v;
+
+ if (waypoint_mode > WM_LOADED)
+ return;
+
+ self.avoid = world;
+
+
+ if (self.enemy)
+ {
+ v = self.origin - realorigin(self.enemy);
+ foedist = vlen(v);
+ foesz = bot_size_player(self.enemy);
+ }
+ else
+ {
+ foedist = 3000;
+ foesz = 9999999;
+ }
+ avdist = 256;
+
+ foe = find(world, classname, "grenade");
+ while(foe)
+ {
+ flen = vlen(foe.origin - self.origin);
+ if (flen < avdist)
+ {
+ avdist = flen;
+ self.avoid = foe;
+ }
+ foe = find(foe, classname, "grenade");
+ }
+ if (!self.avoid)
+ {
+ foe = find(world, classname, "missile");
+ while(foe)
+ {
+ if (foe.owner != self)
+ {
+ flen = vlen(foe.origin - self.origin);
+ if (flen < avdist)
+ {
+ avdist = flen;
+ self.avoid = foe;
+ }
+ }
+ foe = find(foe, classname, "missile");
+ }
+ if (!self.avoid)
+ {
+ foe = find(world, classname, "spike");
+ while(foe)
+ {
+ if (foe.owner != self)
+ {
+ flen = vlen(foe.origin - self.origin);
+ if (flen < avdist)
+ {
+ avdist = flen;
+ self.avoid = foe;
+ }
+ }
+ foe = find(foe, classname, "spike");
+ }
+ }
+ }
+ if (coop)
+ {
+ if (!self.enemy)
+ {
+ foe = findradius(self.origin, foedist);
+ while(foe)
+ {
+ if(foe.flags & FL_MONSTER)
+ {
+ if(foe.health > 0)
+ {
+ flen = vlen(foe.origin - self.origin);
+ if (flen < foedist)
+ {
+ tsz = bot_size_player(foe);
+ if (tsz < foesz)
+ {
+ if (fisible(foe))
+ {
+ self.enemy = foe;
+ foedist = flen;
+ foesz = tsz;
+ }
+ }
+ }
+ }
+ }
+ foe = foe.chain;
+ }
+ }
+ }
+ else
+ {
+ foe = player_head;
+ while(foe)
+ {
+ if(foe != self)
+ {
+ if (foe.modelindex != 0)
+ {
+ if (foe.health > 0)
+ {
+ if (!(teamplay && self.team == foe.team))
+ {
+ flen = vlen(foe.origin - self.origin);
+ if (flen < foedist)
+ {
+ tsz = bot_size_player(foe);
+ if (tsz < foesz)
+ {
+ if (fov(foe) || foe.b_sound > time || self.b_skill == 3)
+ {
+ if (fisible(foe))
+ {
+ self.enemy = foe;
+ foedist = vlen(foe.origin - self.origin);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ foe = foe._next;
+ }
+ }
+};
+
+
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+weapon_range
+
+_x "sweet spot range" - try to maintain this range if possible
+_y minimum range bot can be to be effective (rl/gl) (move away)
+_z maximum range bot can be to be effective (lg/axe) (move in)
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+vector(float wep) weapon_range =
+{
+ if (wep == 4096) // IT_AXE
+ return '48 0 64';
+ else if (wep == 1) // IT_SHOTGUN
+ return '128 0 99999';
+ else if (wep == 2) // IT_SUPER_SHOTGUN
+ return '128 0 99999';
+ else if (wep == 4) // IT_NAILGUN
+ return '180 0 3000';
+ else if (wep == 8) // IT_SUPER_NAILGUN
+ return '180 0 3000';
+ else if (wep == 16) // IT_GRENADE_LAUNCHER
+ return '180 48 3000';
+ else if (wep == 32) // IT_ROCKET_LAUNCHER
+ return '180 48 3000';
+ else if (wep == 64) // IT_LIGHTNING
+ return '350 0 512';
+};
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+bot_weapon_switch
+
+Pick a weapon based on range / ammo
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void(float brange) bot_weapon_switch =
+{
+ local float it, flag, pulse;
+ local vector v;
+
+ it = self.items & 127;
+
+ while(it)
+ {
+ if ((self.ammo_rockets >= 1) && (it & 32))
+ {
+ flag = 32;
+ pulse = 7;
+ }
+ else if (self.waterlevel <= 1 && self.ammo_cells >= 1 && (it & 64))
+ {
+ flag = 64;
+ pulse = 8;
+ }
+ else if(self.ammo_nails >= 2 && (it & 8))
+ {
+ flag = 8;
+ pulse = 5;
+ }
+ else if ((self.ammo_rockets >= 1) && (it & 16))
+ {
+ flag = 16;
+ pulse = 6;
+ }
+ else if(self.ammo_shells >= 2 && (it & 2))
+ {
+ flag = 2;
+ pulse = 3;
+ }
+ else if(self.ammo_nails >= 1 && (it & 4))
+ {
+ flag = 4;
+ pulse = 4;
+ }
+ else if(self.ammo_shells >= 1 && (it & 1))
+ {
+ flag = 1;
+ pulse = 2;
+ }
+ else
+ {
+ if (pulse)
+ self.impulse = pulse;
+ return;
+ }
+
+ if (brange == -1)
+ {
+ if (pulse)
+ self.impulse = pulse;
+ return;
+ }
+
+ v = weapon_range(flag);
+ if (brange < v_y || brange > v_z)
+ it = it - flag;
+ else
+ {
+ if (pulse)
+ self.impulse = pulse;
+ return;
+ }
+ }
+};
+
+void() bot_shoot =
+{
+ // quick little function to stop making him shoot the wrong way ! Argh
+ local float g;
+ g = angcomp(self.v_angle_x, self.b_angle_x);
+ if (fabs(g) > 30)
+ return; // argh, too far away
+ g = angcomp(self.v_angle_y, self.b_angle_y);
+ if (fabs(g) > 30)
+ return; // not again!
+ self.button0 = TRUE;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Bot_fight_style
+
+This is the core of the bot's thinking when
+attacking an enemy.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() bot_fight_style =
+{
+ local vector v, v1, v2, org;
+ local float foedist, mysz, foesz;
+
+
+ if (self.enemy.health <= 0)
+ {
+ self.enemy = world;
+ return;
+ }
+ else if (!self.enemy.takedamage)
+ {
+ self.enemy = world;
+ return;
+ }
+ else if (!fisible(self.enemy))
+ {
+ self.enemy = world;
+ return;
+ }
+
+ org = realorigin(self.enemy);
+ makevectors(self.v_angle);
+
+ // decide if I should shoot
+
+ foedist = vlen(org - self.origin);
+ v = weapon_range(self.weapon);
+ if (foedist > v_y && foedist < v_z)
+ {
+ traceline(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * v_z, FALSE, self);
+ if (vlen(trace_endpos - (self.origin + self.view_ofs)) >= v_y)
+ {
+ // try to avoid shooting teammates
+ if (trace_ent.classname == "player")
+ if ((trace_ent.team == self.team && teamplay) || (coop))
+ return;
+ bot_shoot();
+ }
+ }
+ else
+ bot_weapon_switch(foedist);
+
+ if (!(self.b_aiflags & (AI_PRECISION | AI_BLIND | AI_OBSTRUCTED)))
+ {
+ foesz = bot_size_player(self.enemy);
+ mysz = bot_size_player(self) + 5;
+
+ if (foesz > mysz)
+ {
+ if (teamplay)
+ {
+ if (random() < 0.02)
+ {
+ bot_start_topic(5);
+ self.b_chattime = 1;
+ }
+ }
+
+ return;
+ }
+ else if (mysz < 140)
+ return;
+ else if (self.avoid)
+ {
+ if (self.avoid.velocity)
+ v = self.avoid.velocity;
+ else
+ v = normalize(self.avoid.origin - self.origin);
+ v1_x = v_y;
+ v1_y = v_y * -1;
+ v2_x = v_y;
+ v2_y = v_y * -1;
+ foedist = vlen(self.avoid.origin - (self.origin + v1));
+ if (foedist < vlen(self.avoid.origin - (self.origin + v2)))
+ frik_walkmove(v2);
+ else
+ frik_walkmove(v1);
+ }
+ else if (!self.enemy.flags & FL_MONSTER)
+ {
+ if (foedist + 32 < v_x)
+ frik_walkmove(self.origin - org);
+ else if (foedist - 32 > v_x)
+ frik_walkmove(org - self.origin);
+ else if (self.wallhug)
+ frik_walkmove(v_right);
+ else
+ frik_walkmove(v_right * -1);
+ }
+ }
+ else
+ {
+ foesz = bot_size_player(self.enemy);
+ mysz = bot_size_player(self) + 5;
+
+ if (foesz > mysz)
+ return;
+ else if (mysz < 140)
+ return;
+ self.keys = self.keys & 960;
+ }
+};
+
+
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/frikbot/bot_misc.qc b/r17/Revamped src/Revamped QC/Primeqc4/frikbot/bot_misc.qc
new file mode 100755
index 00000000..e177343f
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/frikbot/bot_misc.qc
@@ -0,0 +1,758 @@
+/***********************************************
+* *
+* FrikBot Misc Code *
+* "Because you can't name it anything else" *
+* *
+***********************************************/
+
+/*
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2 of the License, or (at your
+option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software Foundation,
+Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+BotName
+
+Sets bot's name and colors
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+string(float r) BotName =
+{
+ self.b_num = r;
+ if (r == 1)
+ {
+ self.b_pants = 11;
+ self.b_shirt = 0;
+ return "Mexicouger";
+ }
+ else if (r == 2)
+ {
+ self.b_pants = 1;
+ self.b_shirt = 3;
+ return "Nate";
+ }
+ else if (r == 3)
+ {
+ self.b_pants = 13;
+ self.b_shirt = 2;
+ return "DTMidian";
+ }
+ else if (r == 4)
+ {
+ self.b_pants = 7;
+ self.b_shirt = 6;
+ return "Ducksrule";
+ }
+ else if (r == 5)
+ {
+ self.b_pants = 12;
+ self.b_shirt = 6;
+ return "Ghostfang";
+ }
+ else if (r == 6)
+ {
+ self.b_pants = 4;
+ self.b_shirt = 4;
+ return "Shallows";
+ }
+ else if (r == 7)
+ {
+ self.b_pants = 2;
+ self.b_shirt = 5;
+ return "Hypermetal";
+ }
+ else if (r == 8)
+ {
+ self.b_pants = 10;
+ self.b_shirt = 3;
+ return "Kryten";
+ }
+ else if (r == 9)
+ {
+ self.b_pants = 9;
+ self.b_shirt = 4;
+ return "Pimp Bot";
+ }
+ else if (r == 10)
+ {
+ self.b_pants = 4;
+ self.b_shirt = 7;
+ return "Max";
+ }
+ else if (r == 11)
+ {
+ self.b_pants = 3;
+ self.b_shirt = 11;
+ return "Marvin";
+ }
+ else if (r == 12)
+ {
+ self.b_pants = 13;
+ self.b_shirt = 12;
+ return "Erwin";
+ }
+ else if (r == 13)
+ {
+ self.b_pants = 11;
+ self.b_shirt = 2;
+ return "FrikBot";
+ }
+ else if (r == 14)
+ {
+ self.b_pants = 0;
+ self.b_shirt = 2;
+ return "Krosis";
+ }
+ else if (r == 15)
+ {
+ self.b_pants = 8;
+ self.b_shirt = 9;
+ return "Gypsy";
+ }
+ else if (r == 16)
+ {
+ self.b_pants = 5;
+ self.b_shirt = 10;
+ return "Hal";
+ }
+};
+string () PickARandomName =
+{
+ if (bot_count > 16)
+ return "player";
+
+ local float y, test;
+ local string h;
+ local entity t;
+ y = TRUE;
+ while(y)
+ {
+ test = ceil(random() * 16);
+ h = BotName(test);
+ t = find(world, netname, h);
+ if (t == world)
+ y = FALSE;
+ }
+ return h;
+};
+
+
+
+// I didn't like the old code so this is very stripped down
+
+entity b_originator;
+float b_topic;
+/* FBX Topics
+
+b_originator == self
+ 1 - sign on
+ 2 - killed targ
+ 3 - team message "friendly eyes"
+ 4 - team message "on your back"
+ 5 - team message "need back up"
+ 6 - excuses
+ ----
+ 7 - gameover
+ ----
+ 8 - welcoming someone onto server
+ 9 - ridicule lost frag (killed self?)
+ 10 - ridicule lost frag (lava)
+ 11 - lag
+b_originator == targ
+
+
+*/
+void(float tpic) bot_start_topic =
+{
+ if (random() < 0.2)
+ {
+ b_topic = tpic;
+ b_originator = self;
+ }
+ else
+ b_topic = 0;
+};
+
+void() bot_chat =
+{
+ local float r;
+ if (b_options & OPT_NOCHAT)
+ return;
+ r = ceil (random() * 6);
+
+ if (self.b_chattime > time)
+ {
+ if (self.b_skill < 2)
+ self.keys = self.button0 = self.button2 = 0;
+ return;
+ }
+ else if (self.b_chattime)
+ {
+ if (b_topic == 1)
+ {
+ if (b_originator == self)
+ {
+ if (r == 1)
+ {
+ BotSay(": lo all\n");
+ bot_start_topic(8);
+ }
+ else if (r == 2)
+ {
+ BotSay(": hey everyone\n");
+ bot_start_topic(8);
+ }
+ else if (r == 3)
+ {
+ BotSay(": prepare to be fragged!\n");
+ bot_start_topic(0);
+ }
+ else if (r == 4)
+ {
+ BotSay(": boy this is laggy\n");
+ bot_start_topic(11);
+ }
+ else if (r == 5)
+ {
+ BotSay(": #mm getting some lag here\n");
+ bot_start_topic(11);
+ }
+ else
+ {
+ BotSay(": hi everyone\n");
+ bot_start_topic(8);
+ }
+ }
+ }
+ else if (b_topic == 2)
+ {
+ if (b_originator == self)
+ {
+ if (r == 1)
+ BotSay(": take that\n");
+ else if (r == 2)
+ BotSay(": yehaww!\n");
+ else if (r == 3)
+ BotSay(": wh00p\n");
+ else if (r == 4)
+ BotSay(": j00_sawk();\n");
+ else if (r == 5)
+ BotSay(": i rule\n");
+ else
+ BotSay(": eat that\n");
+ bot_start_topic(0);
+ }
+ }
+ else if (b_topic == 3)
+ {
+ if (b_originator == self)
+ {
+ if (r < 3)
+ BotSayTeam(": friendly eyes\n");
+ else
+ BotSayTeam(": team eyes\n");
+ bot_start_topic(0);
+ }
+ }
+ else if (b_topic == 4)
+ {
+ if (b_originator == self)
+ {
+ if (r < 3)
+ BotSayTeam(": on your back\n");
+ else
+ BotSayTeam(": I'm with you\n");
+ bot_start_topic(0);
+ }
+ }
+ else if (b_topic == 5)
+ {
+ if (b_originator == self)
+ {
+ if (r < 3)
+ BotSayTeam(": I need help\n");
+ else
+ BotSayTeam(": need backup\n");
+ bot_start_topic(0);
+ }
+ }
+ else if (b_topic == 6)
+ {
+ if (b_originator == self)
+ {
+ if (r == 1)
+ {
+ BotSay(": sun got in my eyes\n");
+ bot_start_topic(0);
+ }
+ else if (r == 2)
+ {
+ BotSay(": mouse needs cleaning\n");
+ bot_start_topic(0);
+ }
+ else if (r == 3)
+ {
+ BotSay(": i meant to do that\n");
+ bot_start_topic(0);
+ }
+ else if (r == 4)
+ {
+ BotSay(": lag\n");
+ bot_start_topic(11);
+ }
+ else if (r == 5)
+ {
+ BotSay(": killer lag\n");
+ bot_start_topic(11);
+ }
+ else
+ {
+ BotSay(": 100% lag\n");
+ bot_start_topic(11);
+ }
+ }
+ }
+ else if (b_topic == 7)
+ {
+ if (r == 1)
+ BotSay(": gg\n");
+ else if (r == 2)
+ BotSay(": gg all\n");
+ else if (r == 3)
+ BotSay(": that was fun\n");
+ else if (r == 4)
+ BotSay(": good game\n");
+ else if (r == 5)
+ BotSay(": pah\n");
+ else
+ BotSay(": hrm\n");
+ bot_start_topic(0);
+ }
+ else if (b_topic == 8)
+ {
+ if (b_originator != self)
+ {
+ if (r == 1)
+ {
+ BotSay(": heya\n");
+ bot_start_topic(0);
+ }
+ else if (r == 2)
+ {
+ BotSay(": welcome\n");
+ bot_start_topic(0);
+ }
+ else if (r == 3)
+ {
+ BotSayInit();
+ BotSay2(": hi ");
+ BotSay2(b_originator.netname);
+ BotSay2("\n");
+ bot_start_topic(0);
+ }
+ else if (r == 4)
+ {
+ BotSayInit();
+ BotSay2(": hey ");
+ BotSay2(b_originator.netname);
+ BotSay2("\n");
+ bot_start_topic(0);
+ }
+ else if (r == 5)
+ {
+ BotSay(": howdy\n");
+ bot_start_topic(0);
+ }
+ else
+ {
+ BotSay(": lo\n");
+ bot_start_topic(0);
+ }
+ }
+ }
+
+ else if (b_topic == 9)
+ {
+ if (b_originator != self)
+ {
+ if (r == 1)
+ BotSay(": hah\n");
+ else if (r == 2)
+ BotSay(": heheh\n");
+ else if (r == 3)
+ {
+ BotSayInit();
+ BotSay2(": good work ");
+ BotSay2(b_originator.netname);
+ BotSay2("\n");
+ }
+ else if (r == 4)
+ {
+ BotSayInit();
+ BotSay2(": nice1 ");
+ BotSay2(b_originator.netname);
+ BotSay2("\n");
+ }
+ else if (r == 5)
+ BotSay(": lol\n");
+ else
+ BotSay(": :)\n");
+ b_topic = 6;
+ }
+ }
+ else if (b_topic == 10)
+ {
+ if (b_originator != self)
+ {
+ if (r == 1)
+ BotSay(": have a nice dip?\n");
+ else if (r == 2)
+ BotSay(": bah I hate levels with lava\n");
+ else if (r == 3)
+ {
+ BotSayInit();
+ BotSay2(": good job ");
+ BotSay2(b_originator.netname);
+ BotSay2("\n");
+ }
+ else if (r == 4)
+ {
+ BotSayInit();
+ BotSay2(": nice backflip ");
+ BotSay2(b_originator.netname);
+ BotSay2("\n");
+ }
+ else if (r == 5)
+ BotSay(": watch your step\n");
+ else
+ BotSay(": hehe\n");
+ b_topic = 6;
+ }
+ }
+
+ else if (b_topic == 11)
+ {
+ if (b_originator != self)
+ {
+ if (r == 1)
+ {
+ BotSayInit();
+ BotSay2(": yeah right ");
+ BotSay2(b_originator.netname);
+ BotSay2("\n");
+ bot_start_topic(0);
+ }
+ else if (r == 2)
+ {
+ BotSay(": ping\n");
+ bot_start_topic(0);
+ }
+ else if (r == 3)
+ {
+ BotSay(": shuddup, you're an lpb\n");
+ bot_start_topic(0);
+ }
+ else if (r == 4)
+ {
+ BotSay(": lag my eye\n");
+ bot_start_topic(0);
+ }
+ else if (r == 5)
+ {
+ BotSay(": yeah\n");
+ bot_start_topic(11);
+ }
+ else
+ {
+ BotSay(": totally\n");
+ bot_start_topic(11);
+ }
+ }
+ }
+ self.b_chattime = 0;
+ }
+ else if (b_topic)
+ {
+ if (random() < 0.5)
+ {
+ if (self == b_originator)
+ {
+ if (b_topic <= 7)
+ self.b_chattime = time + 2;
+ }
+ else
+ {
+ if (b_topic >= 7)
+ self.b_chattime = time + 2;
+ }
+ }
+ }
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Kick A Bot.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() KickABot =
+{
+ local entity ty;
+ ty = find(world, classname, "player");
+ while (ty != world)
+ {
+ if (!(ty.ishuman))
+ {
+
+ BotDisconnect(ty);
+ ty.ishuman = TRUE;
+ ty = world;
+ }
+ else
+ ty = find(ty, classname, "player");
+ }
+
+};
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Simplified origin checking.
+
+God, I wish I had inline
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+vector(entity ent) realorigin =
+{
+// even more simplified...
+ return (ent.absmin + ent.absmax) * 0.5;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+fisible
+
+a version of visible that checks for corners
+of the bounding boxes
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+float (entity targ) fisible =
+{
+ local vector spot1, org;
+ local float thruwater, pc1, pc2;
+
+ org = realorigin(targ);
+ spot1 = self.origin + self.view_ofs;
+
+ if (targ.solid == SOLID_BSP)
+ {
+ traceline (spot1, org, TRUE, self);
+ if (trace_ent == targ)
+ return TRUE;
+ else if (trace_fraction == 1)
+ return TRUE;
+ return FALSE;
+ }
+ else
+ {
+ pc1 = pointcontents(org);
+ pc2 = pointcontents(spot1);
+ if (targ.classname == "player")
+ thruwater = FALSE;
+ else if (pc1 == CONTENT_LAVA)
+ return FALSE;
+ else
+ thruwater = TRUE;
+ }
+
+ if (pc1 < -1) // targ's origin is in water or other liquid
+ {
+ if (pc2 != pc1)
+ {
+ // look for their head
+ traceline (spot1, org + targ.mins, TRUE, self);
+ // cross the water check
+ if (trace_inopen)
+ if (trace_inwater)
+ if (!thruwater)
+ return FALSE;
+ if (trace_ent == targ)
+ return TRUE;
+ else if (trace_fraction == 1)
+ return TRUE;
+ return FALSE;
+ }
+ }
+ else
+ {
+ if (pc2 != pc1)
+ {
+ traceline (spot1, org + targ.maxs, TRUE, self);
+ if (trace_inopen)
+ if (trace_inwater)
+ if (!thruwater)
+ return FALSE;
+ if (trace_ent == targ)
+ return TRUE;
+ else if (trace_fraction == 1)
+ return TRUE;
+ return FALSE;
+ }
+ }
+ traceline (spot1, org, TRUE, self);
+ if (trace_ent == targ)
+ return TRUE;
+ else if (trace_fraction == 1)
+ return TRUE;
+ traceline (spot1, org + targ.maxs, TRUE, self);
+ if (trace_ent == targ)
+ return TRUE;
+ else if (trace_fraction == 1)
+ return TRUE;
+ traceline (spot1, org + targ.mins, TRUE, self);
+ if (trace_ent == targ)
+ return TRUE;
+ else if (trace_fraction == 1)
+ return TRUE;
+ return FALSE;
+};
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Wisible
+
+goes through movable brushes/entities, used
+for waypoints
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+// this is used for waypoint stuff....
+float (entity targ1, entity targ2) wisible =
+{
+ local vector spot1, spot2;
+ local entity ignore;
+
+ spot1 = targ1.origin;
+ spot2 = realorigin(targ2);
+
+ ignore = self;
+ do
+ {
+ traceline (spot1, spot2, TRUE, ignore);
+ spot1 = realorigin(trace_ent);
+ ignore = trace_ent;
+ } while ((trace_ent != world) && (trace_fraction != 1));
+ if (trace_endpos == spot2)
+ return TRUE;
+ else
+ return FALSE;
+};
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+sisible
+
+Now this is getting ridiculous. Simple visible,
+used when we need just a simple traceline nothing else
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+float (entity targ) sisible =
+{
+ traceline (self.origin, targ.origin, TRUE, self);
+ if (trace_ent == targ)
+ return TRUE;
+ else if (trace_fraction == 1)
+ return TRUE;
+};
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+angcomp
+
+subtracts one angle from another
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+float (float y1, float y2) angcomp =
+{
+ y1 = frik_anglemod(y1);
+ y2 = frik_anglemod(y2);
+
+ local float answer;
+ answer = y1 - y2;
+ if (answer > 180)
+ answer = (360 - answer) * -1;
+ else if (answer < -180)
+ answer = answer + 360;
+ return answer;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+fov
+
+is the entity in the bot's field of view
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+float (entity targ) fov =
+{
+ local vector yawn;
+ local float g;
+ yawn = realorigin(targ);
+ yawn = (yawn + targ.view_ofs) - (self.origin + self.view_ofs);
+ yawn = normalize(yawn);
+ yawn = vectoangles(yawn);
+ g = angcomp(self.v_angle_x, yawn_x);
+ if (fabs(g) > 45)
+ return FALSE;
+ g = angcomp(self.v_angle_y, yawn_y);
+ if (fabs(g) > 60)
+ return FALSE;
+
+ return TRUE;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+frik_anglemod
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+float(float v) frik_anglemod =
+{
+ return v - floor(v/360) * 360;
+}
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/frikbot/bot_move.qc b/r17/Revamped src/Revamped QC/Primeqc4/frikbot/bot_move.qc
new file mode 100755
index 00000000..fd12f77c
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/frikbot/bot_move.qc
@@ -0,0 +1,487 @@
+/***********************************************
+* *
+* FrikBot Movement AI *
+* "The slightly better movement AI" *
+* *
+***********************************************/
+
+/*
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2 of the License, or (at your
+option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software Foundation,
+Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+void() bot_jump =
+{
+ // TODO check for precision, etc.
+ self.button2 = TRUE;
+};
+
+float(entity e) bot_can_rj =
+{
+ // this returns true of the bot can rocket/superjump/hook
+ // if your mod doesn't have an RL you can just return FALSE all the time
+ // if it has a hook or some other means for the bot to get to high places
+ // you can check here for that capability
+
+ // am I dumb?
+ if (e.b_skill == 0)
+ return FALSE;
+
+ // quad = bad
+ if (e.items & 4194304)
+ return FALSE;
+
+ // do I have rockets & RL?
+ if (!((e.items & 32) && (e.ammo_rockets > 0)))
+ return FALSE;
+
+ // do I have pent?
+ if (e.items & 1048576)
+ return TRUE;
+
+ if (e.health > 50)
+ return TRUE;
+ else
+ return FALSE;
+};
+
+float(float flag) frik_recognize_plat =
+{
+ if ((self.classname != "waypoint") && !(self.flags & FL_ONGROUND))
+ return FALSE;
+ traceline(self.origin, self.origin - '0 0 64', TRUE, self);
+ if (trace_ent != world)
+ {
+ if (flag) // afect bot movement too
+ {
+ if (self.keys & KEY_MOVEUP)
+ {
+ if (trace_ent.velocity_z > 0)
+ self.keys = self.keys & 960; // 960 is all view keys
+ }
+ else if (self.keys & KEY_MOVEDOWN)
+ {
+ if (trace_ent.velocity_z < 0)
+ self.keys = self.keys & 960;
+ }
+ }
+ return TRUE;
+ }
+ else
+ return FALSE;
+};
+
+float(vector sdir) frik_KeysForDir =
+{
+
+ local vector keydir;
+ local float outkeys, tang;
+ outkeys = 0;
+ if (sdir_x || sdir_y)
+ {
+ // Everything is tested against 60 degrees,
+ // this allows the bot to overlap the keys
+ // 30 degrees on each diagonal 45 degrees
+ // might look more realistic
+
+ keydir = vectoangles(sdir);
+ tang = angcomp(keydir_y, self.v_angle_y);
+ if ((tang <= 150) && (tang >= 30))
+ outkeys = outkeys + KEY_MOVELEFT;
+ else if ((tang >= -150) && (tang <= -30))
+ outkeys = outkeys + KEY_MOVERIGHT;
+ if (fabs(tang) <= 60)
+ outkeys = outkeys + KEY_MOVEFORWARD;
+ else if (fabs(tang) >= 120)
+ outkeys = outkeys + KEY_MOVEBACK;
+ }
+ if (sdir_z > 0.7)
+ outkeys = outkeys + KEY_MOVEUP;
+ else if (sdir_z < 0.7)
+ outkeys = outkeys + KEY_MOVEDOWN;
+ return outkeys;
+
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+frik_obstructed
+
+Bot has hit a ledge or wall that he should
+manuever around.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void(vector whichway, float danger) frik_obstructed =
+{
+ local float dist;
+ local vector disway, org;
+// TODO: something
+ if (self.b_aiflags & AI_BLIND)
+ return;
+ org = realorigin(self.target1);
+
+ if (danger)
+ {
+ self.b_aiflags = self.b_aiflags | AI_DANGER;
+ self.keys = frik_KeysForDir('0 0 0' - whichway);
+ }
+ if (self.b_aiflags & AI_PRECISION)
+ return;
+
+
+ if (self.target1)
+ {
+ if (self.b_aiflags & AI_OBSTRUCTED)
+ {
+ if (!(self.b_aiflags & AI_DANGER))
+ {
+ self.b_aiflags = self.b_aiflags - AI_OBSTRUCTED;
+ return;
+ }
+ else if (!danger)
+ return;
+ }
+ self.obs_dir = whichway;
+ disway_x = whichway_y * -1;
+ disway_y = whichway_x;
+ dist = vlen(org - (self.origin + disway));
+ disway_x = whichway_y;
+ disway_y = whichway_x * -1;
+ self.wallhug = vlen(org - (self.origin + disway)) > dist;
+ self.b_aiflags = self.b_aiflags | AI_OBSTRUCTED;
+
+ }
+ else
+ {
+ disway_x = whichway_y * -1;
+ disway_y = whichway_x;
+ dist = vlen(disway - self.obs_dir);
+ disway_x = whichway_y;
+ disway_y = whichway_x * -1;
+ self.wallhug = vlen(disway - self.obs_dir) < dist;
+ self.obs_dir = whichway;
+
+ self.b_aiflags = self.b_aiflags | AI_OBSTRUCTED;
+ }
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+frik_obstacles
+
+Detects small bumps the bot needs to jump over
+or ledges the bot should avoid falling in.
+
+Also responsible for jumping gaps.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() frik_obstacles =
+{
+ local vector start, stop, ang;
+ local float test, conts, dist, hgt;
+
+ if (!(self.flags & FL_ONGROUND))
+ return;
+ if (self.b_aiflags & AI_BLIND)
+ return;
+
+ ang = normalize(self.velocity);
+ ang_z = 0;
+ start = self.origin + ang * 32; // ahem
+ start_z = self.origin_z + self.maxs_z;
+ stop = start;
+ stop_z = self.origin_z + self.mins_z;
+ traceline(start, stop - '0 0 256', TRUE, self);
+ if (trace_allsolid || trace_startsolid)
+ return;
+ hgt = trace_endpos_z - stop_z;
+
+ if (hgt > 18)
+ {
+ bot_jump();
+ return;
+ }
+ else if (hgt <= -64) // this might be a gap
+ {
+ conts = pointcontents(trace_endpos + '0 0 4');
+ start = stop - '0 0 8';
+ stop = start + ang * 256;
+ traceline(start, stop, TRUE, self);
+ test = vlen(trace_endpos - start);
+ if (test <= 20)
+ return; // it's a walkable gap, do nothing
+ ang_x = self.velocity_y * -1;
+ ang_y = self.velocity_x;
+ ang = normalize(ang);
+ traceline(start - (ang * 10), start + (ang * 10), TRUE, self);
+ if ((trace_fraction != 1) || trace_startsolid)
+ return; // gap is only 20 wide, walkable
+ ang = self.velocity;
+ ang_z = 0;
+ dist = ((540 / sv_gravity) * vlen(ang))/* + 32*/;
+ if (test > dist) // I can't make it
+ {
+ if (conts < -3) // bad stuff down dare
+ {
+ frik_obstructed(ang, TRUE);
+ return;
+ }
+ else
+ {
+ if (self.target1)
+ {
+ stop = realorigin(self.target1);
+ if ((stop_z - self.origin_z) < -32)
+ return; // safe to fall
+ }
+ frik_obstructed(ang, FALSE);
+ return;
+ }
+ }
+ else
+ {
+ ang = normalize(ang);
+ //look for a ledge
+ traceline(self.origin, self.origin + (ang * (test + 20)), TRUE, self);
+ if (trace_fraction != 1)
+ {
+ if (conts < -3) // bad stuff down dare
+ {
+ frik_obstructed(ang, TRUE);
+ return;
+ }
+ else
+ {
+ if (self.target1)
+ {
+ stop = realorigin(self.target1);
+ if ((stop_z - self.origin_z) < -32)
+ return; // safe to fall
+ }
+ frik_obstructed(ang, FALSE);
+ return;
+ }
+ }
+
+ if (self.target1)
+ {
+ // getting furter away from my target
+ test = vlen(self.target1.origin - (ang + self.origin));
+ if (test > vlen(self.target1.origin - self.origin))
+ {
+ if (conts < -3) // bad stuff down dare
+ {
+ frik_obstructed(ang, TRUE);
+ return;
+ }
+ else
+ {
+ frik_obstructed(ang, FALSE);
+ return;
+ }
+ }
+ }
+ }
+ // go for it
+ bot_jump();
+ }
+ else if (pointcontents(trace_endpos + '0 0 4') < -3)
+ {
+ frik_obstructed(ang, TRUE);
+ return;
+ }
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+After frik_obstructed, the bot uses the
+following funtion to move "around" the obstacle
+
+I have no idea how well it will work
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() frik_dodge_obstruction =
+{
+ local vector way, org;
+ local float oflags, yaw;
+
+ if (!(self.b_aiflags & AI_OBSTRUCTED))
+ return;
+ if ((self.b_aiflags & (AI_BLIND | AI_PRECISION)) || !(self.flags & FL_ONGROUND))
+ {
+ self.b_aiflags = self.b_aiflags - AI_OBSTRUCTED;
+ return;
+ }
+
+ // perform a walkmove check to see if the obs_dir is still obstructed
+ // walkmove is less forgiving than frik_obstacles, so I dunno
+ // how well this will work
+
+ oflags = self.flags;
+ org = self.origin;
+
+ yaw = vectoyaw(self.obs_dir);
+ if (walkmove(yaw, 32))
+ self.b_aiflags = self.b_aiflags - AI_OBSTRUCTED;
+ else
+ {
+ if (self.b_aiflags & AI_DANGER)
+ {
+ way = '0 0 0' - self.obs_dir;
+ }
+ else if (self.wallhug)
+ {
+ way_x = self.obs_dir_y * -1;
+ way_y = self.obs_dir_x;
+ }
+ else
+ {
+ way_x = self.obs_dir_y;
+ way_y = self.obs_dir_x * -1;
+ }
+ self.keys = self.keys & 960 + frik_KeysForDir(way);
+ }
+
+ // fix the bot
+
+ self.origin = org;
+ self.flags = oflags;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+movetogoal and walkmove replacements
+
+blah
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() frik_movetogoal =
+{
+ local vector way;
+ local float g;
+
+ if (self.target1 == world)
+ {
+ makevectors(self.v_angle);
+ frik_walkmove(v_forward);
+ return;
+ }
+ way = realorigin(self.target1) - self.origin;
+ if (vlen(way) < 25)
+ {
+ self.keys = self.keys & 960;
+ return;
+ }
+
+ way = normalize(way);
+ self.keys = self.keys & 960 + frik_KeysForDir(way);
+
+ frik_dodge_obstruction();
+ frik_recognize_plat(TRUE);
+
+ if (self.b_aiflags & AI_PRECISION)
+ {
+ g = angcomp(self.v_angle_x, self.b_angle_x);
+ if (fabs(g) > 10)
+ self.keys = self.keys & 960;
+ g = angcomp(self.v_angle_y, self.b_angle_y);
+ if (fabs(g) > 10)
+ self.keys = self.keys & 960;
+ }
+};
+
+float(vector weird) frik_walkmove =
+{
+ // okay so it's not walkmove
+ // sue me
+ self.keys = self.keys & 960 + frik_KeysForDir(weird);
+
+ frik_dodge_obstruction();
+ frik_recognize_plat(TRUE);
+ if (self.b_aiflags & AI_OBSTRUCTED)
+ return FALSE;
+ else
+ return TRUE;
+};
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+The "hook" method of navigation. This nav
+system is copyrighted 1999 by Ryan "Frika C"
+Smith, keep that in mind when you steal it.
+
+I brought this back because normal roaming
+won't work - the bot gets distracted by it's
+own waypoints.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() frik_bot_roam =
+{
+ local vector org, ang, org1;
+ local float loopcount, flag, dist;
+
+ loopcount = 26;
+ flag = FALSE;
+ while((loopcount > 0) && !flag)
+ {
+ loopcount = loopcount - 1;
+ org = self.origin + self.view_ofs;
+ ang = self.angles;
+ ang_y = frik_anglemod(ang_y - 90 + (random() * 180));
+ ang_x = 0; // avoid upward sloping
+ makevectors(ang);
+ traceline(org, org + v_forward * 2300, TRUE, self);
+ if (trace_fraction != 1)
+ {
+ org1 = trace_endpos;
+ ang = normalize(trace_plane_normal);
+ ang_z = 0; // avoid upward sloping
+ traceline(org1, org1 + (ang * 2300), TRUE, self);
+ if ((trace_fraction != 1) && (vlen(trace_endpos - org1) >= 64))
+ {
+ org = trace_endpos;
+ traceline(org, self.origin + self.view_ofs, TRUE, self);
+ if (trace_fraction != 1)
+ {
+ dist = vlen(org1 - org) /2;
+ org = org1 + (ang * dist);
+ traceline(org, org - '0 0 48', TRUE, self);
+ if (trace_fraction != 1)
+ {
+ SpawnTempWaypoint(org);
+ flag = TRUE;
+ }
+ }
+ }
+ }
+ }
+ self.b_angle_y = self.v_angle_y + 10;
+};
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/frikbot/bot_phys.qc b/r17/Revamped src/Revamped QC/Primeqc4/frikbot/bot_phys.qc
new file mode 100755
index 00000000..cf51766a
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/frikbot/bot_phys.qc
@@ -0,0 +1,658 @@
+/***********************************************
+* *
+* FrikBot Physics *
+* The near-perfect emulation of *
+* Client movement *
+* *
+* Special Thanks to: Asdf, Frog *
+* Alan "Strider" Kivlin *
+* *
+* *
+***********************************************/
+
+/*
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2 of the License, or (at your
+option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software Foundation,
+Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+/*
+=========================================
+
+Stuff mimicking cl_input.c code
+
+=========================================
+*/
+float(float key) CL_KeyState =
+{
+ return ((self.keys & key) > 0);
+};
+
+void() CL_KeyMove = // CL_BaseMove + CL_AdjustAngles
+{
+ local float anglespeed;
+ local vector view;
+ if (self.keys != self.oldkeys)
+ {
+ self.movevect = '0 0 0';
+ self.movevect_y = self.movevect_y + (350 * CL_KeyState(KEY_MOVERIGHT));
+ // 350 is the default cl_sidespeed
+ self.movevect_y = self.movevect_y - (350 * CL_KeyState(KEY_MOVELEFT));
+ // 350 is the default cl_sidespeed
+ self.movevect_x = self.movevect_x + (200 * CL_KeyState(KEY_MOVEFORWARD));
+ // 200 is the default cl_forwardspeed
+ self.movevect_x = self.movevect_x - (200 * CL_KeyState(KEY_MOVEBACK));
+ // 200 is the default cl_backspeed
+ self.movevect_z = self.movevect_z + (200 * CL_KeyState(KEY_MOVEUP));
+ // 200 is the default cl_upspeed
+ self.movevect_z = self.movevect_z - (200 * CL_KeyState(KEY_MOVEDOWN));
+ // 200 is the default cl_upspeed
+ if (!self.b_aiflags & AI_PRECISION)
+ self.movevect = self.movevect * 2;
+ // 2 is the default cl_movespeedkey & bot always has +speed
+ }
+ self.oldkeys = self.keys;
+
+ if (self.b_skill != 2) // use mouse emulation
+ {
+ anglespeed = 1.5 * real_frametime;
+ // 1.5 is the default cl_anglespeedkey & bot always has +speed
+ self.v_angle_y = self.v_angle_y + anglespeed * CL_KeyState(KEY_LOOKLEFT) * 140;
+ // 140 is default cl_yawspeed
+ self.v_angle_y = self.v_angle_y - anglespeed * CL_KeyState(KEY_LOOKRIGHT) * 140;
+ // 140 is default cl_yawspeed
+ self.v_angle_x = self.v_angle_x - anglespeed * CL_KeyState(KEY_LOOKUP) * 150;
+ // 150 is default cl_pitchspeed
+ self.v_angle_x = self.v_angle_x + anglespeed * CL_KeyState(KEY_LOOKDOWN) * 150;
+ // 150 is default cl_pitchspeed
+ }
+ else
+ {
+ view_x = angcomp(self.b_angle_x, self.v_angle_x);
+ view_y = angcomp(self.b_angle_y, self.v_angle_y);
+ if (vlen(view) > 30)
+ {
+ self.mouse_emu = self.mouse_emu + (view * 30);
+ if (vlen(self.mouse_emu) > 180)
+ self.mouse_emu = normalize(self.mouse_emu) * 180;
+ }
+ else
+ self.mouse_emu = view * (1 / real_frametime);
+ self.v_angle = self.v_angle + self.mouse_emu * real_frametime;
+
+
+ }
+ if (self.v_angle_x > 80)
+ self.v_angle_x = 80;
+ else if (self.v_angle_x < -70)
+ self.v_angle_x = -70;
+
+ if (self.v_angle_z > 50)
+ self.v_angle_z = 50;
+ else if (self.v_angle_z < -50)
+ self.v_angle_z = -50;
+ self.v_angle_y = frik_anglemod(self.v_angle_y);
+
+};
+
+/*
+=========================================
+
+Stuff mimicking sv_user.c
+
+=========================================
+*/
+void() SV_UserFriction =
+{
+ local vector vel, start, stop;
+ local float sped, friction, newspeed;
+
+ vel = self.velocity;
+ vel_z =0;
+ sped = vlen(vel);
+ vel = self.velocity;
+
+ if (!sped)
+ return;
+
+// if the leading edge is over a dropoff, increase friction
+
+ start_x = stop_x = self.origin_x + vel_x / (sped * 16);
+ start_y = stop_y = self.origin_y + vel_y / (sped * 16);
+ start_z = self.origin_z + self.mins_z;
+ stop_z = start_z - 34;
+
+ traceline(start, stop, TRUE, self);
+
+ if (trace_fraction == 1)
+ friction = sv_friction * 2; // 2 is default edgefriction, removed for QW compatability
+ else
+ friction = sv_friction;
+ if (sped < sv_stopspeed)
+ newspeed = sped - real_frametime * sv_stopspeed * friction;
+ else
+ newspeed = sped - real_frametime * sped * friction;
+
+ if (newspeed < 0)
+ newspeed = 0;
+ newspeed = newspeed / sped;
+
+ self.velocity_y = vel_y * newspeed;
+ self.velocity_x = vel_x * newspeed;
+};
+void() SV_WaterJump =
+{
+ if (time > self.teleport_time || !self.waterlevel)
+ {
+ self.flags = self.flags - (self.flags & FL_WATERJUMP);
+ self.teleport_time = 0;
+ }
+ self.velocity_x = self.movedir_x;
+ self.velocity_y = self.movedir_y;
+};
+
+void() DropPunchAngle =
+{
+ local float len;
+ len = vlen(self.punchangle);
+ self.punchangle = normalize(self.punchangle);
+ len = len - 10 * real_frametime;
+ if (len < 0)
+ len = 0;
+ self.punchangle = self.punchangle * len;
+};
+
+
+void(vector wishvel) SV_AirAccelerate =
+{
+ local float addspeed, wishspd, accelspeed, currentspeed;
+
+ wishspd = vlen(wishvel);
+ wishvel = normalize(wishvel);
+ if (wishspd > 30)
+ wishspd = 30;
+ currentspeed = self.velocity * wishvel;
+ addspeed = wishspd - currentspeed;
+ if (addspeed <= 0)
+ return;
+ accelspeed = 10 * sv_accelerate * wishspd * real_frametime;
+ if (accelspeed > addspeed)
+ accelspeed = addspeed;
+
+ self.velocity = self.velocity + accelspeed * wishvel;
+};
+
+void(vector wishvel) SV_Accelerate =
+{
+ local float addspeed, wishspd, accelspeed, currentspeed;
+
+ wishspd = vlen(wishvel);
+ wishvel = normalize(wishvel);
+
+ currentspeed = self.velocity * wishvel;
+ addspeed = wishspd - currentspeed;
+ if (addspeed <= 0)
+ return;
+ accelspeed = sv_accelerate * wishspd * real_frametime;
+ if (accelspeed > addspeed)
+ accelspeed = addspeed;
+
+ self.velocity = self.velocity + accelspeed * wishvel;
+};
+void() SV_WaterMove =
+{
+ local vector wishvel;
+ local float wishspeed, addspeed, cspeed, newspeed;
+ makevectors(self.v_angle);
+ wishvel = v_right * self.movevect_y + v_forward * self.movevect_x;
+
+ if (self.movevect == '0 0 0')
+ wishvel_z = wishvel_z - 60;
+ else
+ wishvel_z = wishvel_z + self.movevect_z;
+ wishspeed = vlen(wishvel);
+
+ if (wishspeed > sv_maxspeed)
+ {
+ wishvel = (sv_maxspeed / wishspeed) * wishvel;
+ wishspeed = sv_maxspeed;
+ }
+ wishspeed = wishspeed * 0.7;
+ cspeed = vlen(self.velocity);
+ if (cspeed)
+ {
+ newspeed = cspeed - (real_frametime * cspeed * sv_friction);
+ if (newspeed < 0)
+ newspeed = 0;
+ self.velocity = self.velocity * (newspeed / cspeed);
+
+ }
+ else
+ newspeed = 0;
+
+ if (!wishspeed)
+ return;
+ addspeed = wishspeed - newspeed;
+ if (addspeed <= 0)
+ return;
+ wishvel = normalize(wishvel);
+ cspeed = sv_accelerate * wishspeed * real_frametime;
+ if (cspeed > addspeed)
+ cspeed = addspeed;
+ self.velocity = self.velocity + cspeed * wishvel;
+};
+void() SV_AirMove =
+{
+ local vector wishvel, vangle;
+
+ vangle = self.v_angle;
+ vangle_x = vangle_z = 0;
+ makevectors(vangle);
+ if (time < self.teleport_time && (self.movevect_x < 0))
+ self.movevect_x = 0;
+ wishvel = v_right * self.movevect_y + v_forward * self.movevect_x;
+
+
+ if (self.movetype != MOVETYPE_WALK)
+ wishvel_z = self.movevect_z;
+ else
+ wishvel_z = 0;
+ if (vlen(wishvel) > sv_maxspeed)
+ wishvel = normalize(wishvel) * sv_maxspeed;
+ if (self.movetype == MOVETYPE_NOCLIP)
+ self.velocity = wishvel;
+ else if (self.flags & FL_ONGROUND)
+ {
+ SV_UserFriction();
+ SV_Accelerate(wishvel);
+ }
+ else
+ SV_AirAccelerate (wishvel);
+};
+
+void() SV_ClientThink =
+{
+ local vector vangle;
+
+ if (self.movetype == MOVETYPE_NONE)
+ return;
+ DropPunchAngle();
+ if (self.health <= 0)
+ return;
+ self.v_angle_z = 0; // V_CalcRoll removed, sucks
+ self.angles_z = self.v_angle_z * 4;
+ vangle = self.v_angle + self.punchangle;
+ if (!self.fixangle)
+ {
+ self.angles_x = (vangle_x / -3);
+ self.angles_y = vangle_y;
+ } else
+ {
+ self.v_angle = self.angles;
+ self.fixangle = 0;
+ }
+ if (self.flags & FL_WATERJUMP)
+ {
+ SV_WaterJump();
+ return;
+ }
+ if ((self.waterlevel >= 2) && (self.movetype != MOVETYPE_NOCLIP))
+ {
+ SV_WaterMove();
+ return;
+ }
+ SV_AirMove();
+
+};
+/*
+=========================================
+
+Stuff mimicking sv_phys.c
+
+=========================================
+*/
+
+float() SV_RunThink =
+{
+ local float thinktime, bkuptime;
+ thinktime = self.nextthink;
+ bkuptime = time;
+ if (thinktime <= 0 || thinktime > (time + real_frametime))
+ return TRUE;
+ if (thinktime < time)
+ thinktime = time;
+ self.nextthink = 0;
+ time = thinktime;
+ other = world;
+ makevectors(self.v_angle); // hack
+ self.think();
+ time = bkuptime;
+ return TRUE;
+};
+
+void(float scale) SV_AddGravity =
+{
+ self.velocity_z = self.velocity_z - (scale * sv_gravity * real_frametime);
+};
+
+float() SV_CheckWater =
+{
+ local vector point;
+ local float cont;
+
+ point_x = self.origin_x;
+ point_y = self.origin_y;
+ self.waterlevel = 0;
+ self.watertype = CONTENT_EMPTY;
+ point_z = self.origin_z + self.mins_z + 1;
+ cont = pointcontents(point);
+ if (cont <= CONTENT_WATER)
+ {
+ self.watertype = cont;
+ self.waterlevel = 1;
+ point_z = self.origin_z + (self.mins_z + self.maxs_z) * 0.5;
+ cont = pointcontents(point);
+ if (cont <= CONTENT_WATER)
+ {
+ self.waterlevel = 2;
+ point_z = self.origin_z + self.view_ofs_z;
+ cont = pointcontents(point);
+ if (cont <= CONTENT_WATER)
+ self.waterlevel = 3;
+ }
+ }
+ return (self.waterlevel > 1);
+
+};
+void() RemoveThud = // well sometimes
+{
+ local entity oself;
+ if (other == world)
+ {
+ if (self.flags & FL_ONGROUND)
+ {
+ self.flags = self.flags - FL_ONGROUND;
+ }
+ }
+ else
+ {
+ if (other.solid == SOLID_BSP && (self.flags & FL_ONGROUND))
+ {
+ // RM: Does this break anything?
+ // If not, then some more thuds have been removed.
+ self.flags = self.flags - FL_ONGROUND;
+ }
+ if (other == self.owner)
+ return;
+ if (self.owner.solid == SOLID_NOT)
+ return;
+ oself = other;
+ other = self.owner;
+ self = oself;
+ if (self.solid == SOLID_BSP)
+ if (self.touch)
+ self.touch();
+ }
+
+};
+void() SV_CheckOnGround =
+{
+ local vector org, v;
+ org = self.origin;
+ local float currentflags;
+ currentflags = self.flags;
+ self.flags = self.flags | FL_ONGROUND | FL_PARTIALGROUND;
+ walkmove(0,0); // perform C touch function
+ self.flags = currentflags | FL_ONGROUND;
+ if ((org_x != self.origin_x) || (org_y != self.origin_y))
+ org = self.origin;
+ else
+ self.origin = org;
+ v = org;
+ v_z = self.maxs_z + org_z + 1;
+ traceline (org, v, TRUE, self);
+ if ((self.waterlevel == 3) && (self.movetype == MOVETYPE_WALK))
+ self.flags = self.flags - FL_ONGROUND;
+ else if ((trace_plane_normal_z <= 0.7) && (trace_fraction != 1))
+ self.flags = self.flags - FL_ONGROUND;
+ else if (!droptofloor(0,0))
+ self.flags = self.flags - FL_ONGROUND;
+ else if (org_z - self.origin_z < 2)
+ self.flags = self.flags | FL_ONGROUND;
+ else
+ self.flags = self.flags - FL_ONGROUND;
+ setorigin(self, org);
+};
+// Thanks to Alan Kivlin for this function
+// modified heavily by me
+float(vector dir) botCheckForStep =
+{
+ local vector currentorigin, v;
+ local float currentflags, yaw, stepdistance, movedistance;
+ currentorigin = self.origin;
+ currentflags = self.flags;
+ self.flags = FL_ONGROUND | FL_PARTIALGROUND;
+ dir = normalize(dir);
+ dir_z = 0;
+ yaw = vectoyaw(dir);
+ if(walkmove(yaw, 3))
+ {
+ if(droptofloor(0,0))
+ {
+ stepdistance = self.origin_z - currentorigin_z;
+ v = self.origin - currentorigin;
+ v_z = 0;
+ movedistance = vlen(v);
+ if((stepdistance > 0 && stepdistance <= 16) && movedistance != 0)
+ {
+ self.flags = currentflags | FL_PARTIALGROUND;
+ return 1;
+ }
+ }
+ }
+ self.flags = currentflags;
+ setorigin(self, currentorigin);
+ return 0;
+};
+// this is merely here to fix a problem with e3m5
+void(vector dir) BruteForceStep =
+{
+ local vector currentorigin;
+ local float currentflags, i, len;
+
+ currentorigin = self.origin;
+ currentflags = self.flags;
+ len = vlen(dir);
+ if (len > 16)
+ dir = normalize(dir) * 16;
+
+ setorigin(self, currentorigin + dir);
+
+ while(i < 18 && !walkmove(0, 0))
+ {
+ self.origin_z = currentorigin_z + i;
+ i = i + 2;
+ }
+ self.flags = currentflags;
+ if (i >=18)
+ setorigin(self, currentorigin);
+};
+
+void() PostPhysics =
+{
+ local vector obstr, org;
+ local float back, dst,cflags;
+
+ self = self.owner;
+
+ self.velocity = self.velocity - self.phys_obj.dest1 + self.phys_obj.velocity;
+ if (self.phys_obj.dest2 == self.origin)
+ {
+ setorigin(self, self.phys_obj.origin);
+ // might've been moved during other person's physics
+ // (teleporters / plats)
+
+ if (self.movetype == MOVETYPE_WALK)
+ {
+
+ if (self.phys_obj.dest1_x || self.phys_obj.dest1_y)
+ {
+ if ((self.flags & FL_ONGROUND) || (self.waterlevel <= 2))
+ {
+ obstr = self.phys_obj.movedir - self.origin;
+ obstr_z = 0;
+ if (vlen(obstr) > 0.1)
+ {
+ dst = vlen(obstr);
+ back = vectoyaw(obstr);
+ cflags = self.flags;
+ self.flags = self.flags | FL_PARTIALGROUND;
+ if(walkmove(back, dst))
+ {
+ self.flags = cflags;
+ self.phys_obj.dest1_z = 0;
+ self.velocity = self.velocity + self.phys_obj.dest1 - self.phys_obj.velocity;
+ }
+ else
+ {
+ if (dst > 1)
+ frik_obstructed(obstr, FALSE);
+
+ org = self.origin;
+ self.flags = cflags;
+ obstr = self.phys_obj.dest1;
+ obstr_x = 0;
+ if (!botCheckForStep(obstr))
+ {
+ obstr = self.phys_obj.dest1;
+ obstr_y = 0;
+ if (!botCheckForStep(obstr))
+ {
+ // if no steps were found, bot is really obstucted
+ BruteForceStep(self.phys_obj.dest1);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ SV_CheckOnGround();
+
+ PlayerPostThink();
+ BotAI();
+ self.dmg_take = self.dmg_save = 0;
+
+};
+// Avoid calling BotAI and the physics at the same time
+// Can trip the runaway loop counter
+
+void() SV_FlyMove =
+{
+ // This is nothing like the Quake function.
+
+ if (self.phys_obj == world)
+ {
+ self.phys_obj = find(world,classname,"phys_obj");
+ while (self.phys_obj.owner != self)
+ {
+ self.phys_obj = find(self.phys_obj,classname,"phys_obj");
+ if (self.phys_obj == world)
+ {
+ error("No physics entity spawned!\nMake sure BotInit was called\n");
+ }
+ }
+ }
+
+ setmodel (self.phys_obj, string_null);
+ self.phys_obj.movetype = MOVETYPE_STEP;
+
+ self.phys_obj.solid = SOLID_TRIGGER;
+ self.phys_obj.touch = RemoveThud;
+ setsize(self.phys_obj, self.mins, self.maxs);
+ self.phys_obj.dest2 = self.phys_obj.origin = self.origin;
+ self.phys_obj.watertype = 0;
+ self.phys_obj.movedir = self.origin + real_frametime * self.velocity;
+ self.phys_obj.dest1 = self.phys_obj.velocity = self.velocity;
+ self.phys_obj.velocity_z = self.phys_obj.velocity_z + sv_gravity * real_frametime;
+ self.phys_obj.flags = 0;
+ self.phys_obj.think = PostPhysics;
+ self.phys_obj.nextthink = time;
+};
+
+
+void() SV_Physics_Toss =
+{
+ if (!SV_RunThink())
+ return;
+ if (self.flags & FL_ONGROUND)
+ {
+ self.velocity = '0 0 0';
+ BotAI();
+ return;
+ }
+ if (self.movetype != MOVETYPE_FLY)
+ SV_AddGravity(1);
+ self.angles = self.angles + real_frametime * self.avelocity;
+ SV_FlyMove();
+
+};
+void() SV_Physics_Client =
+{
+
+ PlayerPreThink();
+
+ if (self.movetype == MOVETYPE_NONE)
+ {
+ if (!SV_RunThink())
+ return;
+ PlayerPostThink();
+ BotAI();
+
+ }
+ else if ((self.movetype == MOVETYPE_WALK) || (self.movetype == MOVETYPE_STEP))
+ {
+ if (!SV_RunThink())
+ return;
+ if (!(SV_CheckWater()) && (!(self.flags & FL_WATERJUMP)))
+ SV_AddGravity(1);
+ SV_FlyMove();
+ }
+ else if ((self.movetype == MOVETYPE_TOSS) || (self.movetype == MOVETYPE_BOUNCE))
+ {
+ SV_Physics_Toss();
+ }
+ else if (self.movetype == MOVETYPE_FLY)
+ {
+ if (!SV_RunThink())
+ return;
+ SV_FlyMove();
+ }
+ else if (self.movetype == MOVETYPE_NOCLIP)
+ {
+ if (!SV_RunThink())
+ return;
+ self.origin = self.origin + real_frametime * self.velocity;
+
+ PlayerPostThink();
+ BotAI();
+ }
+ else
+ error ("SV_Physics_Client: Bad Movetype (BOT)");
+
+};
+
+
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/frikbot/bot_way.qc b/r17/Revamped src/Revamped QC/Primeqc4/frikbot/bot_way.qc
new file mode 100755
index 00000000..70946e74
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/frikbot/bot_way.qc
@@ -0,0 +1,981 @@
+ /***********************************************
+* *
+* FrikBot Waypoints *
+* "The better than roaming AI" *
+* *
+***********************************************/
+
+/*
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by the
+Free Software Foundation; either version 2 of the License, or (at your
+option) any later version.
+
+This program is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software Foundation,
+Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Waypoint Linking code
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+
+float (entity e1, entity e2) CheckLinked =
+{
+ if ((e1 == e2) || (e2 == world) || (e1 == world))
+ return FALSE;
+ else if (e1.target1 == e2)
+ {
+ if (e1.b_aiflags & AI_TELELINK_1)
+ return 2;
+ else return TRUE;
+ }
+ else if (e1.target2 == e2)
+ {
+ if (e1.b_aiflags & AI_TELELINK_2)
+ return 2;
+ else return TRUE;
+ }
+ else if (e1.target3 == e2)
+ {
+ if (e1.b_aiflags & AI_TELELINK_3)
+ return 2;
+ else return TRUE;
+ }
+ else if (e1.target4 == e2)
+ {
+ if (e1.b_aiflags & AI_TELELINK_4)
+ return 2;
+ else return TRUE;
+ }
+
+ else return FALSE;
+};
+
+
+float (entity e1, entity e2) LinkWays =
+{
+ if ((e1 == e2) || (e2 == world) || (e1 == world))
+ return FALSE;
+ else if (CheckLinked(e1, e2))
+ return FALSE; // already linked!!!
+
+ if (e1.target1 == world)
+ {
+ e1.target1 = e2;
+ return TRUE;
+ }
+ else if (e1.target2 == world)
+ {
+ e1.target2 = e2;
+ return TRUE;
+ }
+ else if (e1.target3 == world)
+ {
+ e1.target3 = e2;
+ return TRUE;
+ }
+ else if (e1.target4 == world)
+ {
+ e1.target4 = e2;
+ return TRUE;
+ }
+ else return FALSE;
+
+};
+// Link Ways part 2, used only for teleporters
+
+float (entity e1, entity e2) TeleLinkWays =
+{
+ if ((e1 == e2) || (e2 == world) || (e1 == world))
+ return FALSE;
+ else if (CheckLinked(e1, e2))
+ return FALSE; // already linked!!!
+
+ if (e1.target1 == world)
+ {
+ e1.target1 = e2;
+ e1.b_aiflags = e1.b_aiflags | AI_TELELINK_1;
+ return TRUE;
+ }
+ else if (e1.target2 == world)
+ {
+ e1.target2 = e2;
+ e1.b_aiflags = e1.b_aiflags | AI_TELELINK_2;
+ return TRUE;
+ }
+ else if (e1.target3 == world)
+ {
+ e1.target3 = e2;
+ e1.b_aiflags = e1.b_aiflags | AI_TELELINK_3;
+ return TRUE;
+ }
+ else if (e1.target4 == world)
+ {
+ e1.target4 = e2;
+ e1.b_aiflags = e1.b_aiflags | AI_TELELINK_4;
+ return TRUE;
+ }
+ else
+ return FALSE;
+
+};
+
+void (entity e1, entity e2) UnlinkWays =
+{
+ if ((e1 == e2) || (e2 == world) || (e1 == world))
+ return;
+ else if (!CheckLinked(e1, e2))
+ return;
+
+ if (e1.target1 == e2)
+ {
+ e1.b_aiflags = e1.b_aiflags - (e1.b_aiflags & AI_TELELINK_1);
+ e1.target1 = world;
+ }
+ if (e1.target2 == e2)
+ {
+ e1.b_aiflags = e1.b_aiflags - (e1.b_aiflags & AI_TELELINK_2);
+ e1.target2 = world;
+ }
+ if (e1.target3 == e2)
+ {
+ e1.b_aiflags = e1.b_aiflags - (e1.b_aiflags & AI_TELELINK_3);
+ e1.target3 = world;
+ }
+ if (e1.target4 == e2)
+ {
+ e1.b_aiflags = e1.b_aiflags - (e1.b_aiflags & AI_TELELINK_4);
+ e1.target4 = world;
+ }
+
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+FindWaypoint
+
+This is used quite a bit, by many different
+functions big lag causer
+
+Finds the closest, fisible, waypoint to e
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+entity(entity start) FindWayPoint =
+{
+ local entity t;
+ local vector org;
+ local float dst, tdst;
+ local entity best;
+
+ org = realorigin(self);
+
+ t = way_head;
+ if (start != world)
+ {
+ dst = vlen(start.origin - org);
+ best = start;
+ }
+ else
+ {
+ dst = 100000;
+ best = world;
+ }
+ while(t)
+ {
+ // real players cut through ignore types
+ if (dst < 20)
+ return best;
+ if (!(t.b_aiflags & AI_IGNORE_TYPES) || self.ishuman)
+ {
+ tdst = vlen(t.origin - org);
+ if (tdst < dst)
+ {
+ if (sisible(t))
+ {
+ dst = tdst;
+ best = t;
+ }
+ }
+ }
+ t = t._next;
+ }
+ return best;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Waypoint Spawning Code
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+entity way_foot; // Ugh. Do I need a foot for this or not?
+
+entity(vector org) make_waypoint =
+{
+ local entity point;
+ point = spawn();
+ point.classname = "waypoint";
+ point.search_time = time; // don't double back for me;
+ point.solid = SOLID_TRIGGER;
+ point.movetype = MOVETYPE_NONE;
+ point.items = -1;
+ setorigin(point, org);
+
+ setsize(point, VEC_HULL_MIN, VEC_HULL_MAX);
+ waypoints = waypoints + 1;
+ if (!way_head)
+ {
+ way_head = point;
+ way_foot = point;
+ }
+ else
+ {
+ way_foot._next = point;
+ point._last = way_foot;
+ way_foot = point;
+ }
+
+ point.count = waypoints;
+ if (waypoint_mode > WM_LOADED) // editor modes
+ setmodel(point, "progs/s_bubble.spr");
+ return point;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Dynamic Waypoint spawning and linking. Not
+very good all things considered.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() DynamicWaypoint =
+{
+ local entity t;
+ local float dist, dynlink, dynpoint, editor;
+
+ if (self.teleport_time > self.portal_time)
+ {
+ if (!self.flags & FL_WATERJUMP)
+ {
+ self.dyn_flags = 2;
+ if (!self.ishuman)
+ {
+ bot_lost(self.target1, TRUE);
+ self.enemy = world;
+ }
+ }
+ self.portal_time = self.teleport_time;
+ }
+// stacking everything on waypoint_mode might've been good for the editor,
+// but it sucks to beat hell for this code.
+
+
+// convert waypoint_mode to something more usable..
+ if (waypoint_mode > WM_LOADED)
+ {
+ if (self.ishuman)
+ {
+ if (waypoint_mode == WM_EDITOR_DYNLINK)
+ dynlink = 1;
+ else if (waypoint_mode == WM_EDITOR_DYNAMIC)
+ dynlink = dynpoint = 1;
+ editor = 1;
+ }
+ }
+ else if (waypoint_mode == WM_DYNAMIC)
+ dynlink = dynpoint = 1;
+
+// if there's nothing for dynamic to do..
+ if (!dynpoint)
+ {
+ if (!editor)
+ return;
+ }
+// for speed sake, I won't have bots dynamic waypoint in coop
+ if (!self.ishuman)
+ if (coop)
+ return;
+
+// don't waypoint in single player
+ if (max_clients < 2)
+ return;
+// if you're dead
+ else if (self.health <= 0)
+ {
+ if (dynpoint)
+ {
+ if (self.current_way)
+ {
+ if (pointcontents(self.origin) < -4)
+ {
+ if (self.current_way.b_aiflags & AI_BLIND)
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_PRECISION;
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_BLIND;
+ }
+ }
+ }
+ self.dyn_dest = '0 0 0';
+ self.current_way = world;
+ self.dyn_flags = 0;
+ return;
+ }
+
+// you shouldn't be making waypoints mid air
+ if (dynpoint)
+ {
+ if (!((self.flags & FL_ONGROUND) || self.waterlevel == 3))
+ {
+ if (self.dyn_flags != 2)
+ {
+ self.dyn_flags = 1;
+ }
+ return;
+ }
+ }
+// keep from doing the rest of this every frame
+ if (self.dyn_time > time)
+ return;
+ self.dyn_time = time + 0.2;
+
+// display the links for editor mode
+ if (editor)
+ {
+ if (self.current_way)
+ {
+ if (self.current_way.target1)
+ DeveloperLightning(self.current_way, self.current_way.target1, self.current_way.b_aiflags & AI_TELELINK_1);
+ if (self.current_way.target2)
+ DeveloperLightning(self.current_way, self.current_way.target2, self.current_way.b_aiflags & AI_TELELINK_2);
+ if (self.current_way.target3)
+ DeveloperLightning(self.current_way, self.current_way.target3, self.current_way.b_aiflags & AI_TELELINK_3);
+ if (self.current_way.target4)
+ DeveloperLightning(self.current_way, self.current_way.target4, self.current_way.b_aiflags & AI_TELELINK_4);
+ }
+ if (self.b_aiflags & AI_HOLD_SELECT)
+ return;
+ }
+
+ t = FindWayPoint(self.current_way);
+ if (t)
+ {
+ dist = vlen(self.origin - t.origin);
+ if (dist < 192)
+ {
+ if (dist < 64)
+ {
+
+ if (t != self.current_way)
+ {
+ if (dynlink)
+ {
+ if (!self.dyn_flags)
+ {
+ if (wisible(t, self.current_way))
+ LinkWays(t, self.current_way);
+ }
+ if (self.dyn_flags == 2)
+ TeleLinkWays(self.current_way, t);
+ else if (wisible(t, self.current_way))
+ LinkWays(self.current_way, t);
+ }
+ if (editor)
+ {
+ setmodel(t, "progs/s_light.spr");
+ if (self.current_way)
+ setmodel(self.current_way, "progs/s_bubble.spr");
+ }
+ }
+ self.current_way = t;
+ self.dyn_flags = 0;
+ }
+ self.dyn_dest = self.origin + self.view_ofs;
+ return;
+ }
+ }
+
+ if (frik_recognize_plat(FALSE))
+ {
+ if (vlen(trace_ent.velocity) > 0)
+ {
+ if (self.dyn_plat)
+ return;
+ self.dyn_plat = TRUE;
+ if (!self.dyn_flags)
+ self.dyn_flags = 1;
+ //bprint("on a plat!!!!!\n");
+ }
+ else
+ self.dyn_plat = FALSE;
+ }
+ else
+ self.dyn_plat = FALSE;
+
+ if (self.dyn_flags == 2)
+ self.dyn_dest = self.origin + self.view_ofs;
+ else if (self.dyn_dest == '0 0 0')
+ self.dyn_dest = self.origin + self.view_ofs;
+ if (!dynpoint)
+ return;
+ t = make_waypoint(self.dyn_dest);
+
+ if (!self.dyn_flags)
+ {
+ if (wisible(t, self.current_way))
+ LinkWays(t, self.current_way);
+ }
+ if (self.dyn_flags == 2)
+ TeleLinkWays(self.current_way, t);
+ else if (wisible(t, self.current_way))
+ LinkWays(self.current_way, t);
+
+ if (editor)
+ {
+ setmodel(t, "progs/s_light.spr");
+ if (self.current_way)
+ setmodel(self.current_way, "progs/s_bubble.spr");
+ }
+ self.current_way = t;
+ self.dyn_flags = 0;
+
+ self.dyn_dest = self.origin + self.view_ofs;
+
+ if (frik_recognize_plat(FALSE))
+ {
+ if (trace_ent.classname == "door")
+ t.b_aiflags = t.b_aiflags | AI_DOORFLAG;
+ }
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Waypoint Loading from file
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() ClearAllWays =
+{
+
+ local entity t, n;
+ t = way_head;
+ while(t)
+ {
+ n = t._next;
+ remove(t);
+ t = n;
+ }
+ way_head = world;
+ way_foot = world;
+ waypoints = 0;
+};
+
+entity(float num) WaypointForNum =
+{
+ local entity t;
+ if (!num)
+ return world;
+
+ t = way_head;
+ while (t)
+ {
+ if (t.count == num)
+ return t;
+ t = t._next;
+ }
+ return world;
+};
+
+void() FixThisWaypoint =
+{
+ self.enemy.target1 = WaypointForNum(self.enemy.b_pants);
+ self.enemy.target2 = WaypointForNum(self.enemy.b_skill);
+ self.enemy.target3 = WaypointForNum(self.enemy.b_shirt);
+ self.enemy.target4 = WaypointForNum(self.enemy.b_frags);
+ self.enemy = self.enemy._next;
+ self.nextthink = time;
+ if (self.enemy == world)
+ {
+ remove(self);
+ fixer = world;
+ }
+};
+
+void() FixWaypoints =
+{
+ if (!fixer)
+ fixer = spawn();
+ fixer.nextthink = time;
+ fixer.think = FixThisWaypoint;
+ fixer.enemy = way_head;
+};
+
+
+
+void(entity what) delete_waypoint =
+{
+ local entity t;
+
+ if (way_head == what)
+ way_head = what._next;
+ if (way_foot == what)
+ way_foot = what._last;
+ if (what._last)
+ what._last._next = what._next;
+ if (what._next)
+ what._next._last = what._last;
+ waypoints = 0;
+ t = way_head;
+ while(t)
+ {
+ t.count = waypoints = waypoints + 1;
+ if (CheckLinked(t, what))
+ UnlinkWays(t, what);
+ t = t._next;
+ }
+ if (self.current_way == what)
+ self.current_way = world;
+ remove(what);
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+FindRoute & FindThing used by the pathing code
+in bot_ai.qc
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+
+entity(string s) FindThing =
+{
+ local entity t;
+ local float tdst, dst;
+ local entity best;
+ dst = 100000;
+ best = world;
+ t = find (world, classname, s);
+ while (t != world)
+ {
+ tdst = vlen(((t.absmin + t.absmax) * 0.5) - self.origin);
+ if (tdst < dst)
+ {
+ dst = tdst;
+ best = t;
+ }
+ t = find(t, classname, s);
+ }
+ return best;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+FindRoute, this is a key function in the
+pathing. The name is a bit misleading, this
+code finds the closest waypoint that is part
+of a route calculated by the begin_route and
+end_route routines This is a definite path to
+an object.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+entity(entity lastone) FindRoute =
+{
+ // kinda like FindWaypoint, only of this bots route though
+ local entity t, best;
+ local float dst, tdst, flag;
+ flag = ClientBitFlag(self.b_clientno);
+ t = way_head;
+ dst = 100000;
+ best = world;
+ while(t)
+ {
+ tdst = vlen(t.origin - self.origin);
+ if ((tdst < dst) && (t.b_sound & flag))
+ {
+ if ((lastone == world) || (CheckLinked(lastone, t)))
+ {
+ dst = tdst;
+ best = t;
+ }
+ }
+ t = t._next;
+ }
+ return best;
+};
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Route & path table management
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() ClearRouteTable =
+{
+ // cleans up route table
+
+ local entity t;
+ t = way_head;
+ while (t)
+ {
+ t. keys = FALSE;
+ t.enemy = world;
+ t.items = -1; // not in table
+ t = t._next;
+ }
+};
+
+void() ClearMyRoute =
+{
+ local float flag;
+ local entity t;
+
+ flag = ClientBitFlag(self.b_clientno);
+
+ t = way_head;
+ while (t)
+ {
+ t.b_sound = t.b_sound - (t.b_sound & flag);
+ t = t._next;
+ }
+};
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Mark_path
+
+After the route has been found, mark it with
+bitflags so the table can be used for a
+different bot.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+
+void(entity this) mark_path =
+{
+ local entity t, oself;
+ local float flag;
+
+ ClearMyRoute();
+
+ oself = self;
+ self = this;
+ t = FindWayPoint(this.current_way);
+ self = oself;
+ // FIXME
+ // ugh, better way to find players please!!!
+ if (this.classname != "player")
+ this.current_way = t;
+
+ if (t.enemy == world)
+ {
+ bot_lost(this, FALSE);
+ if (waypoint_mode == WM_DYNAMIC)
+ self.route_failed = TRUE;
+ return;
+ }
+
+ flag = ClientBitFlag(self.b_clientno);
+
+ while(t)
+ {
+ if (t.b_sound & flag)
+ return;
+ if (t == self.last_way)
+ return;
+ t.b_sound = t.b_sound | flag;
+ t = t.enemy;
+ }
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+WaypointThink
+
+Calculates the routes. We use thinks to avoid
+tripping the runaway loop counter
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void(entity e2, float b_bit) FollowLink =
+{
+ local float dist;
+
+ if (self.b_aiflags & b_bit)
+ dist = self.items;
+ else
+ dist = vlen(self.origin - e2.origin) + self.items;
+
+ // check if this is an RJ link
+ if (e2.b_aiflags & AI_SUPER_JUMP)
+ {
+ if (!bot_can_rj(route_table))
+ return;
+ }
+ if (e2.b_aiflags & AI_DIFFICULT)
+ dist = dist + 1000;
+
+ dist = dist + random() * 100; // add a little chaos
+
+ if ((dist < e2.items) || (e2.items == -1))
+ {
+ if (!e2.keys)
+ busy_waypoints = busy_waypoints + 1;
+ e2.keys = TRUE;
+ e2.items = dist;
+ e2.think = WaypointThink;
+ e2.nextthink = time;
+ e2.enemy = self;
+ }
+};
+
+void() WaypointThink =
+{
+ local entity oself;
+
+ if (self.items == -1)
+ return;
+ // can you say ugly?
+ if (self.b_aiflags & AI_TRACE_TEST)
+ {
+ if (self.target1)
+ {
+ traceline(self.origin, self.target1.origin, TRUE, self);
+ if (trace_fraction == 1)
+ FollowLink(self.target1, AI_TELELINK_1);
+ }
+ if (self.target2)
+ {
+ traceline(self.origin, self.target2.origin, TRUE, self);
+ if (trace_fraction == 1)
+ FollowLink(self.target2, AI_TELELINK_2);
+ }
+ if (self.target3)
+ {
+ traceline(self.origin, self.target3.origin, TRUE, self);
+ if (trace_fraction == 1)
+ FollowLink(self.target3, AI_TELELINK_3);
+ }
+ if (self.target4)
+ {
+ traceline(self.origin, self.target4.origin, TRUE, self);
+ if (trace_fraction == 1)
+ FollowLink(self.target4, AI_TELELINK_4);
+ }
+ }
+ else
+ {
+ if (self.target1)
+ FollowLink(self.target1, AI_TELELINK_1);
+ if (self.target2)
+ FollowLink(self.target2, AI_TELELINK_2);
+ if (self.target3)
+ FollowLink(self.target3, AI_TELELINK_3);
+ if (self.target4)
+ FollowLink(self.target4, AI_TELELINK_4);
+ }
+
+ busy_waypoints = busy_waypoints - 1;
+ self.keys = FALSE;
+
+ if (busy_waypoints <= 0)
+ {
+ if (direct_route)
+ {
+ oself = self;
+ self = route_table;
+ bot_get_path(self.target1, FALSE);
+ self = oself;
+ direct_route = FALSE;
+ }
+ }
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+begin_route and bot_get_path
+
+PLEASE NOTE: bot_get_path replaces the old
+calls to begin_route.
+
+Routing isn't done all at once now, but in two
+stages, the bot will calc a route *THEN*
+choose a target, *THEN* mark a path.
+
+Boy it's confusing.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+float() begin_route =
+{
+ if (busy_waypoints > 0)
+ return FALSE;
+
+ if (route_table != world)
+ {
+ if (!route_table.ishuman)
+ {
+ if (route_table.b_clientno != -1)
+ return FALSE;
+ }
+ }
+
+ route_table = self;
+ ClearRouteTable();
+ self.last_way = FindWayPoint(self.current_way);
+
+ if (self.last_way != world)
+ {
+ self.last_way.items = vlen(self.last_way.origin - self.origin);
+ self.last_way.nextthink = time;
+ self.last_way.think = WaypointThink;
+ self.last_way.keys = TRUE;
+ busy_waypoints = 1;
+ return TRUE;
+ }
+ else
+ {
+ route_table = world;
+ busy_waypoints = 0;
+ return FALSE;
+ }
+};
+
+void(entity this, float direct) bot_get_path =
+{
+ if (this == world)
+ return;
+
+ if (route_table == self)
+ {
+ if (busy_waypoints <= 0)
+ {
+ route_table = world;
+ mark_path(this);
+ }
+ return;
+ }
+ if (direct)
+ {
+ if(begin_route())
+ direct_route = TRUE;
+ else
+ bot_lost(this, FALSE);
+ return;
+ }
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+BSP/QC Waypoint loading
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() waypoint =
+{
+ self.search_time = time;
+ self.solid = SOLID_TRIGGER;
+ self.movetype = MOVETYPE_NONE;
+ setorigin(self, self.origin);
+
+ setsize(self, VEC_HULL_MIN, VEC_HULL_MAX);
+ waypoints = waypoints + 1;
+ if (!way_head)
+ {
+ way_head = self;
+ way_foot = self;
+ }
+ else
+ {
+ way_foot._next = self;
+ self._last = way_foot;
+ way_foot = self;
+ }
+
+ self.count = waypoints;
+ waypoint_mode = WM_LOADED;
+ if (self.count == 1)
+ {
+ self.think = FixWaypoints; // wait until all bsp loaded points are spawned
+ self.nextthink = time;
+ }
+};
+
+void(vector org, vector bit1, float bit4, float flargs) make_way =
+{
+ local entity y;
+ waypoint_mode = WM_LOADED;
+ y = make_waypoint(org);
+ y.b_aiflags = flargs;
+ y.b_pants = bit1_x;
+ y.b_skill = bit1_y;
+ y.b_shirt = bit1_z;
+ y.b_frags = bit4;
+ if (y.count == 1)
+ {
+ y.think = FixWaypoints; // wait until all qc loaded points are spawned
+ y.nextthink = time;
+ }
+};
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Temporary Marker code
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void(vector org) SpawnTempWaypoint =
+{
+ local entity tep;
+
+ if (!self.temp_way)
+ self.temp_way = tep = spawn();
+ else
+ tep = self.temp_way;
+
+ tep.classname = "temp_waypoint";
+ tep.search_time = 0;
+ tep.solid = SOLID_TRIGGER;
+ tep.movetype = MOVETYPE_NOCLIP;
+ setorigin(tep, org);
+ target_add(tep);
+ setsize(tep, VEC_HULL_MIN, VEC_HULL_MAX); // FIXME: convert these to numerical
+};
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/frikqcc.exe b/r17/Revamped src/Revamped QC/Primeqc4/frikqcc.exe
new file mode 100755
index 00000000..fd9f6b95
Binary files /dev/null and b/r17/Revamped src/Revamped QC/Primeqc4/frikqcc.exe differ
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/fteqccgui.exe b/r17/Revamped src/Revamped QC/Primeqc4/fteqccgui.exe
new file mode 100755
index 00000000..03ae0933
Binary files /dev/null and b/r17/Revamped src/Revamped QC/Primeqc4/fteqccgui.exe differ
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/hknight.qc b/r17/Revamped src/Revamped QC/Primeqc4/hknight.qc
new file mode 100755
index 00000000..0e239e08
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/hknight.qc
@@ -0,0 +1,440 @@
+/*
+==============================================================================
+
+KNIGHT
+
+==============================================================================
+*/
+
+$cd id1/models/knight2
+$origin 0 0 24
+$base base
+$skin skin
+
+$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9
+
+$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9
+$frame walk10 walk11 walk12 walk13 walk14 walk15 walk16 walk17
+$frame walk18 walk19 walk20
+
+$frame run1 run2 run3 run4 run5 run6 run7 run8
+
+$frame pain1 pain2 pain3 pain4 pain5
+
+$frame death1 death2 death3 death4 death5 death6 death7 death8
+$frame death9 death10 death11 death12
+
+$frame deathb1 deathb2 deathb3 deathb4 deathb5 deathb6 deathb7 deathb8
+$frame deathb9
+
+$frame char_a1 char_a2 char_a3 char_a4 char_a5 char_a6 char_a7 char_a8
+$frame char_a9 char_a10 char_a11 char_a12 char_a13 char_a14 char_a15 char_a16
+
+$frame magica1 magica2 magica3 magica4 magica5 magica6 magica7 magica8
+$frame magica9 magica10 magica11 magica12 magica13 magica14
+
+$frame magicb1 magicb2 magicb3 magicb4 magicb5 magicb6 magicb7 magicb8
+$frame magicb9 magicb10 magicb11 magicb12 magicb13
+
+$frame char_b1 char_b2 char_b3 char_b4 char_b5 char_b6
+
+$frame slice1 slice2 slice3 slice4 slice5 slice6 slice7 slice8 slice9 slice10
+
+$frame smash1 smash2 smash3 smash4 smash5 smash6 smash7 smash8 smash9 smash10
+$frame smash11
+
+$frame w_attack1 w_attack2 w_attack3 w_attack4 w_attack5 w_attack6 w_attack7
+$frame w_attack8 w_attack9 w_attack10 w_attack11 w_attack12 w_attack13 w_attack14
+$frame w_attack15 w_attack16 w_attack17 w_attack18 w_attack19 w_attack20
+$frame w_attack21 w_attack22
+
+$frame magicc1 magicc2 magicc3 magicc4 magicc5 magicc6 magicc7 magicc8
+$frame magicc9 magicc10 magicc11
+
+
+void() hknight_char_a1;
+void() hknight_run1;
+void() hk_idle_sound;
+
+void(float offset) hknight_shot =
+{
+ local vector offang;
+ local vector org, vec;
+
+ offang = vectoangles (self.enemy.origin - self.origin);
+ offang_y = offang_y + offset * 6;
+
+ makevectors (offang);
+
+ org = self.origin + self.mins + self.size*0.5 + v_forward * 20;
+
+// set missile speed
+ vec = normalize (v_forward);
+ vec_z = 0 - vec_z + (random() - 0.5)*0.1;
+
+ launch_spike (org, vec);
+ newmis.classname = "knightspike";
+ setmodel (newmis, "progs/k_spike.mdl");
+ setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);
+ newmis.velocity = vec*300;
+ sound (self, CHAN_WEAPON, "hknight/attack1.wav", 1, ATTN_NORM);
+};
+
+void() CheckForCharge =
+{
+// check for mad charge
+if (!enemy_vis)
+ return;
+if (time < self.attack_finished)
+ return;
+if ( fabs(self.origin_z - self.enemy.origin_z) > 20)
+ return; // too much height change
+if ( vlen (self.origin - self.enemy.origin) < 80)
+ return; // use regular attack
+
+// charge
+ SUB_AttackFinished (2);
+ hknight_char_a1 ();
+
+};
+
+void() CheckContinueCharge =
+{
+ if (time > self.attack_finished)
+ {
+ SUB_AttackFinished (3);
+ hknight_run1 ();
+ return; // done charging
+ }
+ if (random() > 0.5)
+ sound (self, CHAN_WEAPON, "knight/sword2.wav", 1, ATTN_NORM);
+ else
+ sound (self, CHAN_WEAPON, "knight/sword1.wav", 1, ATTN_NORM);
+};
+
+//===========================================================================
+
+void() hknight_stand1 =[ $stand1, hknight_stand2 ] {ai_stand();};
+void() hknight_stand2 =[ $stand2, hknight_stand3 ] {ai_stand();};
+void() hknight_stand3 =[ $stand3, hknight_stand4 ] {ai_stand();};
+void() hknight_stand4 =[ $stand4, hknight_stand5 ] {ai_stand();};
+void() hknight_stand5 =[ $stand5, hknight_stand6 ] {ai_stand();};
+void() hknight_stand6 =[ $stand6, hknight_stand7 ] {ai_stand();};
+void() hknight_stand7 =[ $stand7, hknight_stand8 ] {ai_stand();};
+void() hknight_stand8 =[ $stand8, hknight_stand9 ] {ai_stand();};
+void() hknight_stand9 =[ $stand9, hknight_stand1 ] {ai_stand();};
+
+//===========================================================================
+
+void() hknight_walk1 =[ $walk1, hknight_walk2 ] {
+hk_idle_sound();
+ai_walk(2);};
+void() hknight_walk2 =[ $walk2, hknight_walk3 ] {ai_walk(5);};
+void() hknight_walk3 =[ $walk3, hknight_walk4 ] {ai_walk(5);};
+void() hknight_walk4 =[ $walk4, hknight_walk5 ] {ai_walk(4);};
+void() hknight_walk5 =[ $walk5, hknight_walk6 ] {ai_walk(4);};
+void() hknight_walk6 =[ $walk6, hknight_walk7 ] {ai_walk(2);};
+void() hknight_walk7 =[ $walk7, hknight_walk8 ] {ai_walk(2);};
+void() hknight_walk8 =[ $walk8, hknight_walk9 ] {ai_walk(3);};
+void() hknight_walk9 =[ $walk9, hknight_walk10 ] {ai_walk(3);};
+void() hknight_walk10 =[ $walk10, hknight_walk11 ] {ai_walk(4);};
+void() hknight_walk11 =[ $walk11, hknight_walk12 ] {ai_walk(3);};
+void() hknight_walk12 =[ $walk12, hknight_walk13 ] {ai_walk(4);};
+void() hknight_walk13 =[ $walk13, hknight_walk14 ] {ai_walk(6);};
+void() hknight_walk14 =[ $walk14, hknight_walk15 ] {ai_walk(2);};
+void() hknight_walk15 =[ $walk15, hknight_walk16 ] {ai_walk(2);};
+void() hknight_walk16 =[ $walk16, hknight_walk17 ] {ai_walk(4);};
+void() hknight_walk17 =[ $walk17, hknight_walk18 ] {ai_walk(3);};
+void() hknight_walk18 =[ $walk18, hknight_walk19 ] {ai_walk(3);};
+void() hknight_walk19 =[ $walk19, hknight_walk20 ] {ai_walk(3);};
+void() hknight_walk20 =[ $walk20, hknight_walk1 ] {ai_walk(2);};
+
+//===========================================================================
+
+void() hknight_run1 =[ $run1, hknight_run2 ] {
+hk_idle_sound();
+ai_run (20); CheckForCharge (); };
+void() hknight_run2 =[ $run2, hknight_run3 ] {ai_run(25);};
+void() hknight_run3 =[ $run3, hknight_run4 ] {ai_run(18);};
+void() hknight_run4 =[ $run4, hknight_run5 ] {ai_run(16);};
+void() hknight_run5 =[ $run5, hknight_run6 ] {ai_run(14);};
+void() hknight_run6 =[ $run6, hknight_run7 ] {ai_run(25);};
+void() hknight_run7 =[ $run7, hknight_run8 ] {ai_run(21);};
+void() hknight_run8 =[ $run8, hknight_run1 ] {ai_run(13);};
+
+//============================================================================
+
+void() hknight_pain1 =[ $pain1, hknight_pain2 ] {sound (self, CHAN_VOICE, "hknight/pain1.wav", 1, ATTN_NORM);};
+void() hknight_pain2 =[ $pain2, hknight_pain3 ] {};
+void() hknight_pain3 =[ $pain3, hknight_pain4 ] {};
+void() hknight_pain4 =[ $pain4, hknight_pain5 ] {};
+void() hknight_pain5 =[ $pain5, hknight_run1 ] {};
+
+//============================================================================
+
+void() hknight_die1 =[ $death1, hknight_die2 ] {ai_forward(10);};
+void() hknight_die2 =[ $death2, hknight_die3 ] {ai_forward(8);};
+void() hknight_die3 =[ $death3, hknight_die4 ]
+{self.solid = SOLID_NOT; ai_forward(7);};
+void() hknight_die4 =[ $death4, hknight_die5 ] {};
+void() hknight_die5 =[ $death5, hknight_die6 ] {};
+void() hknight_die6 =[ $death6, hknight_die7 ] {};
+void() hknight_die7 =[ $death7, hknight_die8 ] {};
+void() hknight_die8 =[ $death8, hknight_die9 ] {ai_forward(10);};
+void() hknight_die9 =[ $death9, hknight_die10 ] {ai_forward(11);};
+void() hknight_die10 =[ $death10, hknight_die11 ] {};
+void() hknight_die11 =[ $death11, hknight_die12 ] {};
+void() hknight_die12 =[ $death12, hknight_die12 ] {};
+
+void() hknight_dieb1 =[ $deathb1, hknight_dieb2 ] {};
+void() hknight_dieb2 =[ $deathb2, hknight_dieb3 ] {};
+void() hknight_dieb3 =[ $deathb3, hknight_dieb4 ]
+{self.solid = SOLID_NOT;};
+void() hknight_dieb4 =[ $deathb4, hknight_dieb5 ] {};
+void() hknight_dieb5 =[ $deathb5, hknight_dieb6 ] {};
+void() hknight_dieb6 =[ $deathb6, hknight_dieb7 ] {};
+void() hknight_dieb7 =[ $deathb7, hknight_dieb8 ] {};
+void() hknight_dieb8 =[ $deathb8, hknight_dieb9 ] {};
+void() hknight_dieb9 =[ $deathb9, hknight_dieb9 ] {};
+
+void() hknight_die =
+{
+// check for gib
+ if (self.health < -40)
+ {
+ sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
+ ThrowHead ("progs/h_hellkn.mdl", self.health);
+ ThrowGib ("progs/gib1.mdl", self.health);
+ ThrowGib ("progs/gib2.mdl", self.health);
+ ThrowGib ("progs/gib3.mdl", self.health);
+ return;
+ }
+
+// regular death
+ sound (self, CHAN_VOICE, "hknight/death1.wav", 1, ATTN_NORM);
+ if (random() > 0.5)
+ hknight_die1 ();
+ else
+ hknight_dieb1 ();
+};
+
+
+//============================================================================
+
+void() hknight_magica1 =[ $magica1, hknight_magica2 ] {ai_face();};
+void() hknight_magica2 =[ $magica2, hknight_magica3 ] {ai_face();};
+void() hknight_magica3 =[ $magica3, hknight_magica4 ] {ai_face();};
+void() hknight_magica4 =[ $magica4, hknight_magica5 ] {ai_face();};
+void() hknight_magica5 =[ $magica5, hknight_magica6 ] {ai_face();};
+void() hknight_magica6 =[ $magica6, hknight_magica7 ] {ai_face();};
+void() hknight_magica7 =[ $magica7, hknight_magica8 ] {hknight_shot(-2);};
+void() hknight_magica8 =[ $magica8, hknight_magica9 ] {hknight_shot(-1);};
+void() hknight_magica9 =[ $magica9, hknight_magica10] {hknight_shot(0);};
+void() hknight_magica10 =[ $magica10, hknight_magica11] {hknight_shot(1);};
+void() hknight_magica11 =[ $magica11, hknight_magica12] {hknight_shot(2);};
+void() hknight_magica12 =[ $magica12, hknight_magica13] {hknight_shot(3);};
+void() hknight_magica13 =[ $magica13, hknight_magica14] {ai_face();};
+void() hknight_magica14 =[ $magica14, hknight_run1 ] {ai_face();};
+
+//============================================================================
+
+void() hknight_magicb1 =[ $magicb1, hknight_magicb2 ] {ai_face();};
+void() hknight_magicb2 =[ $magicb2, hknight_magicb3 ] {ai_face();};
+void() hknight_magicb3 =[ $magicb3, hknight_magicb4 ] {ai_face();};
+void() hknight_magicb4 =[ $magicb4, hknight_magicb5 ] {ai_face();};
+void() hknight_magicb5 =[ $magicb5, hknight_magicb6 ] {ai_face();};
+void() hknight_magicb6 =[ $magicb6, hknight_magicb7 ] {ai_face();};
+void() hknight_magicb7 =[ $magicb7, hknight_magicb8 ] {hknight_shot(-2);};
+void() hknight_magicb8 =[ $magicb8, hknight_magicb9 ] {hknight_shot(-1);};
+void() hknight_magicb9 =[ $magicb9, hknight_magicb10] {hknight_shot(0);};
+void() hknight_magicb10 =[ $magicb10, hknight_magicb11] {hknight_shot(1);};
+void() hknight_magicb11 =[ $magicb11, hknight_magicb12] {hknight_shot(2);};
+void() hknight_magicb12 =[ $magicb12, hknight_magicb13] {hknight_shot(3);};
+void() hknight_magicb13 =[ $magicb13, hknight_run1] {ai_face();};
+
+//============================================================================
+
+void() hknight_magicc1 =[ $magicc1, hknight_magicc2 ] {ai_face();};
+void() hknight_magicc2 =[ $magicc2, hknight_magicc3 ] {ai_face();};
+void() hknight_magicc3 =[ $magicc3, hknight_magicc4 ] {ai_face();};
+void() hknight_magicc4 =[ $magicc4, hknight_magicc5 ] {ai_face();};
+void() hknight_magicc5 =[ $magicc5, hknight_magicc6 ] {ai_face();};
+void() hknight_magicc6 =[ $magicc6, hknight_magicc7 ] {hknight_shot(-2);};
+void() hknight_magicc7 =[ $magicc7, hknight_magicc8 ] {hknight_shot(-1);};
+void() hknight_magicc8 =[ $magicc8, hknight_magicc9 ] {hknight_shot(0);};
+void() hknight_magicc9 =[ $magicc9, hknight_magicc10] {hknight_shot(1);};
+void() hknight_magicc10 =[ $magicc10, hknight_magicc11] {hknight_shot(2);};
+void() hknight_magicc11 =[ $magicc11, hknight_run1] {hknight_shot(3);};
+
+//===========================================================================
+
+void() hknight_char_a1 =[ $char_a1, hknight_char_a2 ] {ai_charge(20);};
+void() hknight_char_a2 =[ $char_a2, hknight_char_a3 ] {ai_charge(25);};
+void() hknight_char_a3 =[ $char_a3, hknight_char_a4 ] {ai_charge(18);};
+void() hknight_char_a4 =[ $char_a4, hknight_char_a5 ] {ai_charge(16);};
+void() hknight_char_a5 =[ $char_a5, hknight_char_a6 ] {ai_charge(14);};
+void() hknight_char_a6 =[ $char_a6, hknight_char_a7 ] {ai_charge(20); ai_melee();};
+void() hknight_char_a7 =[ $char_a7, hknight_char_a8 ] {ai_charge(21); ai_melee();};
+void() hknight_char_a8 =[ $char_a8, hknight_char_a9 ] {ai_charge(13); ai_melee();};
+void() hknight_char_a9 =[ $char_a9, hknight_char_a10 ] {ai_charge(20); ai_melee();};
+void() hknight_char_a10=[ $char_a10, hknight_char_a11 ] {ai_charge(20); ai_melee();};
+void() hknight_char_a11=[ $char_a11, hknight_char_a12 ] {ai_charge(18); ai_melee();};
+void() hknight_char_a12=[ $char_a12, hknight_char_a13 ] {ai_charge(16);};
+void() hknight_char_a13=[ $char_a13, hknight_char_a14 ] {ai_charge(14);};
+void() hknight_char_a14=[ $char_a14, hknight_char_a15 ] {ai_charge(25);};
+void() hknight_char_a15=[ $char_a15, hknight_char_a16 ] {ai_charge(21);};
+void() hknight_char_a16=[ $char_a16, hknight_run1 ] {ai_charge(13);};
+
+//===========================================================================
+
+void() hknight_char_b1 =[ $char_b1, hknight_char_b2 ]
+{CheckContinueCharge (); ai_charge(23); ai_melee();};
+void() hknight_char_b2 =[ $char_b2, hknight_char_b3 ] {ai_charge(17); ai_melee();};
+void() hknight_char_b3 =[ $char_b3, hknight_char_b4 ] {ai_charge(12); ai_melee();};
+void() hknight_char_b4 =[ $char_b4, hknight_char_b5 ] {ai_charge(22); ai_melee();};
+void() hknight_char_b5 =[ $char_b5, hknight_char_b6 ] {ai_charge(18); ai_melee();};
+void() hknight_char_b6 =[ $char_b6, hknight_char_b1 ] {ai_charge(8); ai_melee();};
+
+//===========================================================================
+
+void() hknight_slice1 =[ $slice1, hknight_slice2 ] {ai_charge(9);};
+void() hknight_slice2 =[ $slice2, hknight_slice3 ] {ai_charge(6);};
+void() hknight_slice3 =[ $slice3, hknight_slice4 ] {ai_charge(13);};
+void() hknight_slice4 =[ $slice4, hknight_slice5 ] {ai_charge(4);};
+void() hknight_slice5 =[ $slice5, hknight_slice6 ] {ai_charge(7); ai_melee();};
+void() hknight_slice6 =[ $slice6, hknight_slice7 ] {ai_charge(15); ai_melee();};
+void() hknight_slice7 =[ $slice7, hknight_slice8 ] {ai_charge(8); ai_melee();};
+void() hknight_slice8 =[ $slice8, hknight_slice9 ] {ai_charge(2); ai_melee();};
+void() hknight_slice9 =[ $slice9, hknight_slice10 ] {ai_melee();};
+void() hknight_slice10 =[ $slice10, hknight_run1 ] {ai_charge(3);};
+
+//===========================================================================
+
+void() hknight_smash1 =[ $smash1, hknight_smash2 ] {ai_charge(1);};
+void() hknight_smash2 =[ $smash2, hknight_smash3 ] {ai_charge(13);};
+void() hknight_smash3 =[ $smash3, hknight_smash4 ] {ai_charge(9);};
+void() hknight_smash4 =[ $smash4, hknight_smash5 ] {ai_charge(11);};
+void() hknight_smash5 =[ $smash5, hknight_smash6 ] {ai_charge(10); ai_melee();};
+void() hknight_smash6 =[ $smash6, hknight_smash7 ] {ai_charge(7); ai_melee();};
+void() hknight_smash7 =[ $smash7, hknight_smash8 ] {ai_charge(12); ai_melee();};
+void() hknight_smash8 =[ $smash8, hknight_smash9 ] {ai_charge(2); ai_melee();};
+void() hknight_smash9 =[ $smash9, hknight_smash10 ] {ai_charge(3); ai_melee();};
+void() hknight_smash10 =[ $smash10, hknight_smash11 ] {ai_charge(0);};
+void() hknight_smash11 =[ $smash11, hknight_run1 ] {ai_charge(0);};
+
+//============================================================================
+
+void() hknight_watk1 =[ $w_attack1, hknight_watk2 ] {ai_charge(2);};
+void() hknight_watk2 =[ $w_attack2, hknight_watk3 ] {ai_charge(0);};
+void() hknight_watk3 =[ $w_attack3, hknight_watk4 ] {ai_charge(0);};
+void() hknight_watk4 =[ $w_attack4, hknight_watk5 ] {ai_melee();};
+void() hknight_watk5 =[ $w_attack5, hknight_watk6 ] {ai_melee();};
+void() hknight_watk6 =[ $w_attack6, hknight_watk7 ] {ai_melee();};
+void() hknight_watk7 =[ $w_attack7, hknight_watk8 ] {ai_charge(1);};
+void() hknight_watk8 =[ $w_attack8, hknight_watk9 ] {ai_charge(4);};
+void() hknight_watk9 =[ $w_attack9, hknight_watk10 ] {ai_charge(5);};
+void() hknight_watk10 =[ $w_attack10, hknight_watk11 ] {ai_charge(3); ai_melee();};
+void() hknight_watk11 =[ $w_attack11, hknight_watk12 ] {ai_charge(2); ai_melee();};
+void() hknight_watk12 =[ $w_attack12, hknight_watk13 ] {ai_charge(2); ai_melee();};
+void() hknight_watk13 =[ $w_attack13, hknight_watk14 ] {ai_charge(0);};
+void() hknight_watk14 =[ $w_attack14, hknight_watk15 ] {ai_charge(0);};
+void() hknight_watk15 =[ $w_attack15, hknight_watk16 ] {ai_charge(0);};
+void() hknight_watk16 =[ $w_attack16, hknight_watk17 ] {ai_charge(1);};
+void() hknight_watk17 =[ $w_attack17, hknight_watk18 ] {ai_charge(1); ai_melee();};
+void() hknight_watk18 =[ $w_attack18, hknight_watk19 ] {ai_charge(3); ai_melee();};
+void() hknight_watk19 =[ $w_attack19, hknight_watk20 ] {ai_charge(4); ai_melee();};
+void() hknight_watk20 =[ $w_attack20, hknight_watk21 ] {ai_charge(6);};
+void() hknight_watk21 =[ $w_attack21, hknight_watk22 ] {ai_charge(7);};
+void() hknight_watk22 =[ $w_attack22, hknight_run1 ] {ai_charge(3);};
+
+//============================================================================
+
+void() hk_idle_sound =
+{
+ if (random() < 0.2)
+ sound (self, CHAN_VOICE, "hknight/idle.wav", 1, ATTN_NORM);
+};
+
+void(entity attacker, float damage) hknight_pain =
+{
+ if (self.pain_finished > time)
+ return;
+
+ sound (self, CHAN_VOICE, "hknight/pain1.wav", 1, ATTN_NORM);
+
+ if (time - self.pain_finished > 5)
+ { // allways go into pain frame if it has been a while
+ hknight_pain1 ();
+ self.pain_finished = time + 1;
+ return;
+ }
+
+ if ((random()*30 > damage) )
+ return; // didn't flinch
+
+ self.pain_finished = time + 1;
+ hknight_pain1 ();
+};
+
+float hknight_type;
+
+void() hknight_melee =
+{
+ hknight_type = hknight_type + 1;
+
+ sound (self, CHAN_WEAPON, "hknight/slash1.wav", 1, ATTN_NORM);
+ if (hknight_type == 1)
+ hknight_slice1 ();
+ else if (hknight_type == 2)
+ hknight_smash1 ();
+ else if (hknight_type == 3)
+ {
+ hknight_watk1 ();
+ hknight_type = 0;
+ }
+};
+
+/*QUAKED monster_hell_knight (1 0 0) (-16 -16 -24) (16 16 40) Ambush
+*/
+void() monster_hell_knight =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+ precache_model2 ("progs/hknight.mdl");
+ precache_model2 ("progs/k_spike.mdl");
+ precache_model2 ("progs/h_hellkn.mdl");
+
+
+ precache_sound2 ("hknight/attack1.wav");
+ precache_sound2 ("hknight/death1.wav");
+ precache_sound2 ("hknight/pain1.wav");
+ precache_sound2 ("hknight/sight1.wav");
+ precache_sound ("hknight/hit.wav"); // used by C code, so don't sound2
+ precache_sound2 ("hknight/slash1.wav");
+ precache_sound2 ("hknight/idle.wav");
+ precache_sound2 ("hknight/grunt.wav");
+
+ precache_sound ("knight/sword1.wav");
+ precache_sound ("knight/sword2.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/hknight.mdl");
+
+ setsize (self, '-16 -16 -24', '16 16 40');
+ self.health = 250;
+
+ self.th_stand = hknight_stand1;
+ self.th_walk = hknight_walk1;
+ self.th_run = hknight_run1;
+ self.th_melee = hknight_melee;
+ self.th_missile = hknight_magicc1;
+ self.th_pain = hknight_pain;
+ self.th_die = hknight_die;
+
+ walkmonster_start ();
+};
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/items.qc b/r17/Revamped src/Revamped QC/Primeqc4/items.qc
new file mode 100755
index 00000000..62ad2a40
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/items.qc
@@ -0,0 +1,1726 @@
+void() W_SetCurrentAmmo;
+/* ALL LIGHTS SHOULD BE 0 1 0 IN COLOR ALL OTHER ITEMS SHOULD
+BE .8 .3 .4 IN COLOR */
+
+void() SUB_regen =
+{
+ self.model = self.mdl; // restore original model
+ self.solid = SOLID_TRIGGER; // allow it to be touched again
+ sound (self, CHAN_VOICE, "items/itembk2.wav", 1, ATTN_NORM); // play respawn sound
+ setorigin (self, self.origin);
+};
+
+
+
+/*QUAKED noclass (0 0 0) (-8 -8 -8) (8 8 8)
+prints a warning message when spawned
+*/
+void() noclass =
+{
+ dprint ("noclass spawned at");
+ dprint (vtos(self.origin));
+ dprint ("\n");
+ remove (self);
+};
+
+
+
+/*
+============
+PlaceItem
+
+plants the object on the floor
+============
+*/
+void() PlaceItem =
+{
+ self.mdl = self.model;
+ self.flags = FL_ITEM;
+ self.solid = SOLID_TRIGGER;
+ self.movetype = MOVETYPE_NONE;
+ self.velocity = '0 0 0';
+ if (self.classname == "etank")
+ setorigin(self, self.origin); //The metroid Float
+ else
+ setorigin(self, self.origin + '0 0 40');
+};
+
+/*
+============
+StartItem
+
+Sets the clipping size and plants the object on the floor
+============
+*/
+void() StartItem =
+{
+ self.nextthink = time + 0.2; // items start after other solids
+ self.think = PlaceItem;
+};
+
+/*
+=========================================================================
+
+HEALTH BOX
+
+=========================================================================
+*/
+//
+// T_Heal: add health to an entity, limiting health to max_health
+// "ignore" will ignore max_health limit
+//
+float (entity e, float healamount, float ignore) T_Heal =
+{
+ if (e.health <= 0)
+ return 0;
+ if ((!ignore) && (e.health >= other.max_health))
+ return 0;
+ healamount = ceil(healamount);
+
+ e.health = e.health + healamount;
+ if ((!ignore) && (e.health >= other.max_health))
+ e.health = other.max_health;
+
+ return 1;
+};
+
+/*QUAKED item_health (.3 .3 1) (0 0 0) (32 32 32) rotten megahealth
+Health box. Normally gives 25 points.
+Rotten box heals 5-10 points,
+megahealth will add 100 health, then
+rot you down to your maximum health limit,
+one point per second.
+*/
+
+float H_ROTTEN = 1;
+float H_MEGA = 2;
+.float healamount, healtype;
+void() health_touch;
+void() item_megahealth_rot;
+
+void() item_health =
+{
+ self.touch = health_touch;
+
+ if (self.spawnflags & H_ROTTEN)
+ {
+ precache_model("maps/b_bh10.bsp");
+
+ precache_sound("items/r_item1.wav");
+ setmodel(self, "maps/b_bh10.bsp");
+ self.noise = "items/r_item1.wav";
+ self.healamount = 15;
+ self.healtype = 0;
+ }
+ else
+ if (self.spawnflags & H_MEGA)
+ {
+ precache_model("maps/b_bh100.bsp");
+ precache_sound("items/r_item2.wav");
+ setmodel(self, "maps/b_bh100.bsp");
+ self.noise = "items/r_item2.wav";
+ self.healamount = 100;
+ self.healtype = 2;
+ }
+ else
+ {
+ precache_model("maps/b_bh25.bsp");
+ precache_sound("items/health1.wav");
+ setmodel(self, "maps/b_bh25.bsp");
+ self.noise = "items/health1.wav";
+ self.healamount = 25;
+ self.healtype = 1;
+ }
+ setsize (self, '0 0 0', '32 32 56');
+ StartItem ();
+};
+//Prime Health 1
+void() item_health1 =
+{
+ precache_model("progs/health3.spr");
+ precache_sound("items/r_item1.wav");
+ setmodel(self, "progs/health3.spr");
+ self.noise = "items/r_item1.wav";
+ self.classname = "health1";
+ self.touch = health_touch;
+ self.healtype = 0;
+ setsize (self, '-7 -7 0', '7 7 7');
+ StartItem ();
+};
+//Prime health2
+void() item_health2 =
+{
+ precache_model("progs/health.spr");
+ precache_sound("items/r_item1.wav");
+ setmodel(self, "progs/health.spr");
+ self.noise = "items/r_item1.wav";
+ self.classname = "health2";
+ self.touch = health_touch;
+ self.healtype = 0;
+ setsize (self, '-7 -7 0', '7 7 7');
+ StartItem ();
+};
+//Prime health3
+void() item_health3 =
+{
+ precache_model("progs/health2.spr");
+ precache_sound("items/r_item1.wav");
+ setmodel(self, "progs/health2.spr");
+ self.noise = "items/r_item1.wav";
+ self.classname = "health3";
+ self.touch = health_touch;
+ self.healtype = 0;
+ setsize (self, '-7 -7 0', '7 7 7');
+ StartItem ();
+};
+void() health_touch =
+{
+ local string s;
+
+ if (other.classname != "player")
+ return;
+
+ if (self.classname == "health1") //Oh my... So much globbered code Just for Health...
+{
+ if (other.energy == 0)
+ {
+ if (other.health >= 99)
+ return;
+ other.health = other.health + 20;
+ if (other.health >= 99)
+ other.health = 99;
+ }
+ if (other.energy == 1)
+ {
+ if (other.health >= 199)
+ return;
+ other.health = other.health + 20;
+ if (other.health >= 199)
+ other.health = 199;
+ }
+ if (other.energy == 2)
+ {
+ if (other.health >= 299)
+ return;
+ other.health = other.health + 20;
+ if (other.health >= 299)
+ other.health = 299;
+ }
+ if (other.energy == 3)
+ {
+ if (other.health >= 399)
+ return;
+ other.health = other.health + 20;
+ if (other.health >= 399)
+ other.health = 399;
+ }
+ if (other.energy == 4)
+ {
+ if (other.health >= 499)
+ return;
+ other.health = other.health + 20;
+ if (other.health >= 499)
+ other.health = 499;
+ }
+ if (other.energy == 5)
+ {
+ if (other.health >= 599)
+ return;
+ other.health = other.health + 20;
+ if (other.health >= 599)
+ other.health = 599;
+ }
+ if (other.energy == 6)
+ {
+ if (other.health >= 699)
+ return;
+ other.health = other.health + 20;
+ if (other.health >= 699)
+ other.health = 699;
+ }
+ if (other.energy == 7)
+ {
+ if (other.health >= 799)
+ return;
+ other.health = other.health + 20;
+ if (other.health >= 799)
+ other.health = 799;
+ }
+ if (other.energy == 8)
+ {
+ if (other.health >= 899)
+ return;
+ other.health = other.health + 20;
+ if (other.health >= 899)
+ other.health = 899;
+ }
+ if (other.energy == 9)
+ {
+ if (other.health >= 999)
+ return;
+ other.health = other.health + 20;
+ if (other.health >= 999)
+ other.health = 999;
+ }
+}
+
+ if (self.classname == "health2")
+{
+ if (other.energy == 0)
+ {
+ if (other.health >= 99)
+ return;
+ other.health = other.health + 50;
+ if (other.health >= 99)
+ other.health = 99;
+ }
+ if (other.energy == 1)
+ {
+ if (other.health >= 199)
+ return;
+ other.health = other.health + 50;
+ if (other.health >= 199)
+ other.health = 199;
+ }
+ if (other.energy == 2)
+ {
+ if (other.health >= 299)
+ return;
+ other.health = other.health + 50;
+ if (other.health >= 299)
+ other.health = 299;
+ }
+ if (other.energy == 3)
+ {
+ if (other.health >= 399)
+ return;
+ other.health = other.health + 50;
+ if (other.health >= 399)
+ other.health = 399;
+ }
+ if (other.energy == 4)
+ {
+ if (other.health >= 499)
+ return;
+ other.health = other.health + 50;
+ if (other.health >= 499)
+ other.health = 499;
+ }
+ if (other.energy == 5)
+ {
+ if (other.health >= 599)
+ return;
+ other.health = other.health + 50;
+ if (other.health >= 599)
+ other.health = 599;
+ }
+ if (other.energy == 6)
+ {
+ if (other.health >= 699)
+ return;
+ other.health = other.health + 50;
+ if (other.health >= 699)
+ other.health = 699;
+ }
+ if (other.energy == 7)
+ {
+ if (other.health >= 799)
+ return;
+ other.health = other.health + 50;
+ if (other.health >= 799)
+ other.health = 799;
+ }
+ if (other.energy == 8)
+ {
+ if (other.health >= 899)
+ return;
+ other.health = other.health + 50;
+ if (other.health >= 899)
+ other.health = 899;
+ }
+ if (other.energy == 9)
+ {
+ if (other.health >= 999)
+ return;
+ other.health = other.health + 50;
+ if (other.health >= 999)
+ other.health = 999;
+ }
+}
+
+ else
+{
+ if (other.energy == 0)
+ {
+ if (other.health >= 99)
+ return;
+ other.health = other.health + 100;
+ if (other.health >= 99)
+ other.health = 99;
+ }
+ if (other.energy == 1)
+ {
+ if (other.health >= 199)
+ return;
+ other.health = other.health + 100;
+ if (other.health >= 199)
+ other.health = 199;
+ }
+ if (other.energy == 2)
+ {
+ if (other.health >= 299)
+ return;
+ other.health = other.health + 100;
+ if (other.health >= 299)
+ other.health = 299;
+ }
+ if (other.energy == 3)
+ {
+ if (other.health >= 399)
+ return;
+ other.health = other.health + 100;
+ if (other.health >= 399)
+ other.health = 399;
+ }
+ if (other.energy == 4)
+ {
+ if (other.health >= 499)
+ return;
+ other.health = other.health + 100;
+ if (other.health >= 499)
+ other.health = 499;
+ }
+ if (other.energy == 5)
+ {
+ if (other.health >= 599)
+ return;
+ other.health = other.health + 100;
+ if (other.health >= 599)
+ other.health = 599;
+ }
+ if (other.energy == 6)
+ {
+ if (other.health >= 699)
+ return;
+ other.health = other.health + 100;
+ if (other.health >= 699)
+ other.health = 699;
+ }
+ if (other.energy == 7)
+ {
+ if (other.health >= 799)
+ return;
+ other.health = other.health + 100;
+ if (other.health >= 799)
+ other.health = 799;
+ }
+ if (other.energy == 8)
+ {
+ if (other.health >= 899)
+ return;
+ other.health = other.health + 100;
+ if (other.health >= 899)
+ other.health = 899;
+ }
+ if (other.energy == 9)
+ {
+ if (other.health >= 999)
+ return;
+ other.health = other.health + 100;
+ if (other.health >= 999)
+ other.health = 999;
+ }
+}
+
+ sprint(other, "You receive ");
+ s = ftos(other.health);
+ sprint(other, s);
+ sprint(other, " health\n");
+
+// health touch sound
+ sound(other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
+
+ stuffcmd (other, "bf\n");
+
+ self.model = string_null;
+ self.solid = SOLID_NOT;
+
+ if (deathmatch != 2) // deathmatch 2 is the silly old rules
+ {
+ if (deathmatch)
+ self.nextthink = time + 20;
+ self.think = SUB_regen;
+ }
+
+ activator = other;
+ SUB_UseTargets(); // fire all targets / killtargets
+};
+
+void() item_megahealth_rot =
+{
+ other = self.owner;
+
+ if (other.health > other.max_health)
+ {
+ other.health = other.health - 1;
+ self.nextthink = time + 1;
+ return;
+ }
+
+// it is possible for a player to die and respawn between rots, so don't
+// just blindly subtract the flag off
+ other.items = other.items - (other.items & IT_SUPERHEALTH);
+
+ if (deathmatch == 1) // deathmatch 2 is silly old rules
+ {
+ self.nextthink = time + 20;
+ self.think = SUB_regen;
+ }
+};
+
+/*
+===============================================================================
+
+ARMOR
+
+===============================================================================
+*/
+
+void() armor_touch;
+
+void() armor_touch =
+{
+ local float type, value, bit;
+
+ if (other.health <= 0)
+ return;
+ if (other.classname != "player")
+ return;
+
+ if (self.classname == "item_armor1")
+ {
+ type = 0.3;
+ value = 100;
+ bit = IT_ARMOR1;
+ }
+ if (self.classname == "item_armor2")
+ {
+ type = 0.6;
+ value = 150;
+ bit = IT_ARMOR2;
+ }
+ if (self.classname == "item_armorInv")
+ {
+ type = 0.8;
+ value = 200;
+ bit = IT_ARMOR3;
+ }
+ if (other.armortype*other.armorvalue >= type*value)
+ return;
+
+ other.armortype = type;
+ other.armorvalue = value;
+ other.items = other.items - (other.items & (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + bit;
+
+ self.solid = SOLID_NOT;
+ self.model = string_null;
+ if (deathmatch == 1)
+ self.nextthink = time + 20;
+ self.think = SUB_regen;
+
+ sprint(other, "You got armor\n");
+// armor touch sound
+ sound(other, CHAN_ITEM, "items/armor1.wav", 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+
+ activator = other;
+ SUB_UseTargets(); // fire all targets / killtargets
+};
+
+
+/*QUAKED item_armor1 (0 .5 .8) (-16 -16 0) (16 16 32)
+*/
+
+void() item_armor1 =
+{
+ self.touch = armor_touch;
+ precache_model ("progs/armor.mdl");
+ setmodel (self, "progs/armor.mdl");
+ self.skin = 0;
+ setsize (self, '-16 -16 0', '16 16 56');
+ StartItem ();
+};
+
+/*QUAKED item_armor2 (0 .5 .8) (-16 -16 0) (16 16 32)
+*/
+
+void() item_armor2 =
+{
+ self.touch = armor_touch;
+ precache_model ("progs/armor.mdl");
+ setmodel (self, "progs/armor.mdl");
+ self.skin = 1;
+ setsize (self, '-16 -16 0', '16 16 56');
+ StartItem ();
+};
+
+/*QUAKED item_armorInv (0 .5 .8) (-16 -16 0) (16 16 32)
+*/
+
+void() item_armorInv =
+{
+ self.touch = armor_touch;
+ precache_model ("progs/armor.mdl");
+ setmodel (self, "progs/armor.mdl");
+ self.skin = 2;
+ setsize (self, '-16 -16 0', '16 16 56');
+ StartItem ();
+};
+
+/*
+===============================================================================
+
+WEAPONS
+
+===============================================================================
+*/
+
+void() bound_other_ammo =
+{
+ if (other.ammo_shells > 100)
+ other.ammo_shells = 100;
+ if (other.ammo_nails > 200)
+ other.ammo_nails = 200;
+ if (other.ammo_rockets > 100)
+ other.ammo_rockets = 100;
+ if (other.ammo_cells > 100)
+ other.ammo_cells = 100;
+};
+
+
+float(float w) RankForWeapon =
+{
+ if (w == IT_LIGHTNING)
+ return 1;
+ if (w == IT_MAGMA)
+ return 2;
+ if (w == IT_SNIPER)
+ return 3;
+ if (w == IT_GRENADE_LAUNCHER)
+ return 4;
+ if (w == IT_ROCKET)
+ return 5;
+ if (w == IT_SPLASER)
+ return 6;
+ return 7;
+};
+
+/*
+=============
+Deathmatch_Weapon
+
+Deathmatch weapon change rules for picking up a weapon
+
+.float ammo_shells, ammo_nails, ammo_rockets, ammo_cells;
+=============
+*/
+void(float old, float new) Deathmatch_Weapon =
+{
+ local float or, nr;
+
+// change self.weapon if desired
+ or = RankForWeapon (self.weapon);
+ nr = RankForWeapon (new);
+ if ( nr < or )
+ self.weapon = new;
+};
+
+/*
+=============
+weapon_touch
+=============
+*/
+//float() W_BestWeapon;
+
+void() weapon_touch =
+{
+ local float hadammo, new, old;
+ local entity stemp;
+ local float leave;
+
+ if (!(other.flags & FL_CLIENT))
+ return;
+
+// if the player was using his best weapon, change up to the new one if better
+ stemp = self;
+ self = other;
+ self = stemp;
+
+ if (deathmatch == 2 || coop)
+ leave = 1;
+ else
+ leave = 0;
+
+ if (self.classname == "weapon_nailgun")
+ {
+ if (leave && (other.items & IT_SPLASER) )
+ return;
+ hadammo = other.ammo_nails;
+ new = IT_SPLASER;
+ if (self.ammo_nails >= 45)
+ return;
+ other.ammo_nails = other.ammo_nails + 8;
+ if (self.ammo_nails >= 45)
+ self.ammo_nails = 45;
+ }
+ else if (self.classname == "weapon_sniper")
+ {
+ if (leave && (other.items & IT_SNIPER) )
+ return;
+ hadammo = other.ammo_rockets;
+ new = IT_SNIPER;
+ if (self.ammo_sniper >= 20)
+ return;
+ other.ammo_sniper = other.ammo_sniper + 4;
+ if (self.ammo_sniper >= 20)
+ self.ammo_sniper = 20;
+ }
+ else if (self.classname == "weapon_supershotgun")
+ {
+ if (leave && (other.items & IT_ROCKET) )
+ return;
+ hadammo = other.ammo_rockets;
+ new = IT_ROCKET;
+ if (other.ammo_rockets >= 25)
+ return;
+ other.ammo_rockets = other.ammo_rockets + 5;
+ if (other.ammo_rockets >= 25)
+ other.ammo_rockets = 25;
+ }
+ else if (self.classname == "weapon_magma")
+ {
+ if (leave && (other.items & IT_MAGMA) )
+ return;
+ hadammo = other.ammo_lava;
+ new = IT_MAGMA;
+ if (other.ammo_lava >= 45)
+ return;
+ other.ammo_lava = other.ammo_lava + 10;
+ if (other.ammo_lava >= 45)
+ other.ammo_rockets = 45;
+ }
+ else if (self.classname == "weapon_grenadelauncher")
+ {
+ if (leave && (other.items & IT_GRENADE_LAUNCHER) )
+ return;
+ hadammo = other.ammo_rockets;
+ new = IT_GRENADE_LAUNCHER;
+ other.ammo_rockets = other.ammo_rockets + 5;
+ }
+ else if (self.classname == "weapon_lightning")
+ {
+ if (leave && (other.items & IT_LIGHTNING) )
+ return;
+ hadammo = other.ammo_rockets;
+ new = IT_LIGHTNING;
+ other.ammo_cells = other.ammo_cells + 15;
+ }
+ else if (self.classname == "weapon_ric")
+ {
+ if (leave && (other.items & IT_RIC) )
+ return;
+ hadammo = other.ammo_rockets;
+ new = IT_RIC;
+ if (other.ammo_ric >= 100)
+ return;
+ other.ammo_ric = other.ammo_ric + 25;
+ if (other.ammo_ric >= 80)
+ other.ammo_ric = 100;
+ }
+
+ else
+ objerror ("weapon_touch: unknown classname");
+
+ sprint (other, "You got the ");
+ sprint (other, self.netname);
+ sprint (other, "\n");
+// weapon touch sound
+ sound (other, CHAN_ITEM, "weapons/pkup.wav", 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+
+ bound_other_ammo ();
+
+// change to the weapon
+ old = other.items;
+ other.items = other.items | new;
+
+ stemp = self;
+ self = other;
+
+ if (!deathmatch)
+ self.weapon = new;
+ else
+ Deathmatch_Weapon (old, new);
+
+ W_SetCurrentAmmo();
+
+ self = stemp;
+
+ if (leave)
+ return;
+
+// remove it in single player, or setup for respawning in deathmatch
+ self.model = string_null;
+ self.solid = SOLID_NOT;
+ if (deathmatch == 1)
+ self.nextthink = time + 30;
+ self.think = SUB_regen;
+
+ activator = other;
+ SUB_UseTargets(); // fire all targets / killtargets
+};
+
+
+/*Prime Weapon Rocket Launcher
+*/
+void() weapon_supershotgun =
+{
+ precache_model ("progs/item_rocket.mdl");
+ setmodel (self, "progs/item_rocket.mdl");
+ self.weapon = IT_ROCKET;
+ self.netname = "Rocket Launcher";
+ self.touch = weapon_touch;
+ self.effects = EF_DIMLIGHT;
+ setsize (self, '-7 -7 0', '7 7 7');
+ StartItem ();
+};
+
+/*Prime Weapon Splaser
+*/
+
+void() weapon_nailgun =
+{
+ precache_model ("progs/item_splaser.spr");
+ setmodel (self, "progs/item_splaser.spr");
+ self.weapon = IT_SPLASER;
+ self.netname = "Splaser";
+ self.touch = weapon_touch;
+ setsize (self, '-7 -7 0', '7 7 7');
+ StartItem ();
+};
+
+/* Prime Weapon SNiper
+*/
+
+void() weapon_sniper =
+{
+ precache_model ("progs/item_sniper.spr");
+ setmodel (self, "progs/item_sniper.spr");
+ self.weapon = IT_SNIPER;
+ self.classname = "weapon_sniper";
+ self.netname = "Sniper";
+ self.touch = weapon_touch;
+ setsize (self, '-7 -7 0', '7 7 7');
+ StartItem ();
+};
+
+/*QUAKED weapon_grenadelauncher (0 .5 .8) (-16 -16 0) (16 16 32)
+*/
+
+void() weapon_grenadelauncher =
+{
+ precache_model ("progs/g_rock.mdl");
+ setmodel (self, "progs/g_rock.mdl");
+ self.weapon = 3;
+ self.netname = "Grenade Launcher";
+ self.touch = weapon_touch;
+ setsize (self, '-16 -16 0', '16 16 56');
+ StartItem ();
+};
+
+/*Prime Weapon Magma beam
+*/
+
+void() weapon_magma =
+{
+ precache_model ("progs/item_magma.spr");
+ setmodel (self, "progs/item_magma.spr");
+ self.weapon = 3;
+ self.classname = "weapon_magma";
+ self.netname = "Magma Beam";
+ self.touch = weapon_touch;
+ setsize (self, '-16 -16 0', '16 16 56');
+ StartItem ();
+};
+
+
+/*QUAKED weapon_lightning (0 .5 .8) (-16 -16 0) (16 16 32)
+*/
+
+void() weapon_lightning =
+{
+ precache_model ("progs/g_light.mdl");
+ setmodel (self, "progs/g_light.mdl");
+ self.weapon = 3;
+ self.netname = "Thunderbolt";
+ self.touch = weapon_touch;
+ setsize (self, '-16 -16 0', '16 16 56');
+ StartItem ();
+};
+
+/*Prime Weapon Richochet beam
+*/
+void() weapon_ric =
+{
+ precache_model ("progs/item_ric.spr");
+ setmodel (self, "progs/item_ric.spr");
+ self.weapon = IT_RIC;
+ self.classname = "weapon_ric";
+ self.netname = "Richochet Beam";
+ self.touch = weapon_touch;
+ setsize (self, '-7 -7 0', '7 7 7');
+ StartItem ();
+};
+
+
+
+/*
+===============================================================================
+
+AMMO
+
+===============================================================================
+*/
+
+void() ammo_touch =
+{
+local entity stemp;
+
+
+ if (other.classname != "player")
+ return;
+ if (other.health <= 0)
+ return;
+
+// if the player was using his best weapon, change up to the new one if better
+ stemp = self;
+ self = other;
+ self = stemp;
+
+
+// shotgun
+ if (self.weapon == 1)
+ {
+ if (other.ammo_shells >= 100)
+ return;
+ other.ammo_shells = other.ammo_shells + self.aflag;
+ }
+
+// rockets
+ if (self.weapon == 3)
+ {
+ if (other.ammo_rockets >= 100)
+ return;
+ other.ammo_rockets = other.ammo_rockets + self.aflag;
+ }
+
+// cells
+ if (self.weapon == 4)
+ {
+ if (other.ammo_cells >= 100)
+ return;
+ other.ammo_cells = other.ammo_cells + self.aflag;
+ }
+
+ bound_other_ammo ();
+
+ sprint (other, "You got the ");
+ sprint (other, self.netname);
+ sprint (other, "\n");
+// ammo touch sound
+ sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+
+
+// if changed current ammo, update it
+ stemp = self;
+ self = other;
+ W_SetCurrentAmmo();
+ self = stemp;
+
+// remove it in single player, or setup for respawning in deathmatch
+ self.model = string_null;
+ self.solid = SOLID_NOT;
+ if (deathmatch == 1)
+ self.nextthink = time + 30;
+ self.think = SUB_regen;
+
+ activator = other;
+ SUB_UseTargets(); // fire all targets / killtargets
+};
+
+
+
+
+float WEAPON_BIG2 = 1;
+
+/*QUAKED item_shells (0 .5 .8) (0 0 0) (32 32 32) big
+*/
+
+void() item_shells =
+{
+ self.touch = ammo_touch;
+
+ if (self.spawnflags & WEAPON_BIG2)
+ {
+ precache_model ("maps/b_shell1.bsp");
+ setmodel (self, "maps/b_shell1.bsp");
+ self.aflag = 40;
+ }
+ else
+ {
+ precache_model ("maps/b_shell0.bsp");
+ setmodel (self, "maps/b_shell0.bsp");
+ self.aflag = 20;
+ }
+ self.weapon = 1;
+ self.netname = "shells";
+ setsize (self, '0 0 0', '32 32 56');
+ StartItem ();
+};
+
+/*QUAKED item_spikes (0 .5 .8) (0 0 0) (32 32 32) big
+*/
+
+void() item_spikes =
+{
+ self.touch = ammo_touch;
+
+ if (self.spawnflags & WEAPON_BIG2)
+ {
+ precache_model ("maps/b_nail1.bsp");
+ setmodel (self, "maps/b_nail1.bsp");
+ self.aflag = 50;
+ }
+ else
+ {
+ precache_model ("maps/b_nail0.bsp");
+ setmodel (self, "maps/b_nail0.bsp");
+ self.aflag = 25;
+ }
+ self.weapon = 2;
+ self.netname = "nails";
+ setsize (self, '0 0 0', '32 32 56');
+ StartItem ();
+};
+
+/*QUAKED item_rockets (0 .5 .8) (0 0 0) (32 32 32) big
+*/
+
+void() item_rockets =
+{
+ self.touch = ammo_touch;
+
+ if (self.spawnflags & WEAPON_BIG2)
+ {
+ precache_model ("maps/b_rock1.bsp");
+ setmodel (self, "maps/b_rock1.bsp");
+ self.aflag = 10;
+ }
+ else
+ {
+ precache_model ("maps/b_rock0.bsp");
+ setmodel (self, "maps/b_rock0.bsp");
+ self.aflag = 5;
+ }
+ self.weapon = 3;
+ self.netname = "rockets";
+ setsize (self, '0 0 0', '32 32 56');
+ StartItem ();
+};
+
+
+/*QUAKED item_cells (0 .5 .8) (0 0 0) (32 32 32) big
+*/
+
+void() item_cells =
+{
+ self.touch = ammo_touch;
+
+ if (self.spawnflags & WEAPON_BIG2)
+ {
+ precache_model ("maps/b_batt1.bsp");
+ setmodel (self, "maps/b_batt1.bsp");
+ self.aflag = 12;
+ }
+ else
+ {
+ precache_model ("maps/b_batt0.bsp");
+ setmodel (self, "maps/b_batt0.bsp");
+ self.aflag = 6;
+ }
+ self.weapon = 4;
+ self.netname = "cells";
+ setsize (self, '0 0 0', '32 32 56');
+ StartItem ();
+};
+
+
+/*QUAKED item_weapon (0 .5 .8) (0 0 0) (32 32 32) shotgun rocket spikes big
+DO NOT USE THIS!!!! IT WILL BE REMOVED!
+*/
+
+float WEAPON_SHOTGUN = 1;
+float WEAPON_ROCKET = 2;
+float WEAPON_SPIKES = 4;
+float WEAPON_BIG = 8;
+void() item_weapon =
+{
+ self.touch = ammo_touch;
+
+ if (self.spawnflags & WEAPON_SHOTGUN)
+ {
+ if (self.spawnflags & WEAPON_BIG)
+ {
+ precache_model ("maps/b_shell1.bsp");
+ setmodel (self, "maps/b_shell1.bsp");
+ self.aflag = 40;
+ }
+ else
+ {
+ precache_model ("maps/b_shell0.bsp");
+ setmodel (self, "maps/b_shell0.bsp");
+ self.aflag = 20;
+ }
+ self.weapon = 1;
+ self.netname = "shells";
+ }
+
+ if (self.spawnflags & WEAPON_SPIKES)
+ {
+ if (self.spawnflags & WEAPON_BIG)
+ {
+ precache_model ("maps/b_nail1.bsp");
+ setmodel (self, "maps/b_nail1.bsp");
+ self.aflag = 40;
+ }
+ else
+ {
+ precache_model ("maps/b_nail0.bsp");
+ setmodel (self, "maps/b_nail0.bsp");
+ self.aflag = 20;
+ }
+ self.weapon = 2;
+ self.netname = "spikes";
+ }
+
+ if (self.spawnflags & WEAPON_ROCKET)
+ {
+ if (self.spawnflags & WEAPON_BIG)
+ {
+ precache_model ("maps/b_rock1.bsp");
+ setmodel (self, "maps/b_rock1.bsp");
+ self.aflag = 10;
+ }
+ else
+ {
+ precache_model ("maps/b_rock0.bsp");
+ setmodel (self, "maps/b_rock0.bsp");
+ self.aflag = 5;
+ }
+ self.weapon = 3;
+ self.netname = "rockets";
+ }
+
+ setsize (self, '0 0 0', '32 32 56');
+ StartItem ();
+};
+
+
+/*
+===============================================================================
+
+KEYS
+
+===============================================================================
+*/
+
+void() key_touch =
+{
+ if (other.classname != "player")
+ return;
+ if (other.health <= 0)
+ return;
+ if (other.items & self.items)
+ return;
+
+ sprint (other, "You got the ");
+ sprint (other, self.netname);
+ sprint (other,"\n");
+
+ sound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+ other.items = other.items | self.items;
+
+ if (!coop)
+ {
+ self.solid = SOLID_NOT;
+ self.model = string_null;
+ }
+
+ activator = other;
+ SUB_UseTargets(); // fire all targets / killtargets
+};
+
+
+void() key_setsounds =
+{
+ if (world.worldtype == 0)
+ {
+ precache_sound ("misc/medkey.wav");
+ self.noise = "misc/medkey.wav";
+ }
+ if (world.worldtype == 1)
+ {
+ precache_sound ("misc/runekey.wav");
+ self.noise = "misc/runekey.wav";
+ }
+ if (world.worldtype == 2)
+ {
+ precache_sound2 ("misc/basekey.wav");
+ self.noise = "misc/basekey.wav";
+ }
+};
+
+/*QUAKED item_key1 (0 .5 .8) (-16 -16 -24) (16 16 32)
+SILVER key
+In order for keys to work
+you MUST set your maps
+worldtype to one of the
+following:
+0: medieval
+1: metal
+2: base
+*/
+
+void() item_key1 =
+{
+ if (world.worldtype == 0)
+ {
+ precache_model ("progs/w_s_key.mdl");
+ setmodel (self, "progs/w_s_key.mdl");
+ self.netname = "silver key";
+ }
+ else if (world.worldtype == 1)
+ {
+ precache_model ("progs/m_s_key.mdl");
+ setmodel (self, "progs/m_s_key.mdl");
+ self.netname = "silver runekey";
+ }
+ else if (world.worldtype == 2)
+ {
+ precache_model2 ("progs/b_s_key.mdl");
+ setmodel (self, "progs/b_s_key.mdl");
+ self.netname = "silver keycard";
+ }
+ key_setsounds();
+ self.touch = key_touch;
+ self.items = IT_KEY1;
+ setsize (self, '-16 -16 -24', '16 16 32');
+ StartItem ();
+};
+
+/*QUAKED item_key2 (0 .5 .8) (-16 -16 -24) (16 16 32)
+GOLD key
+In order for keys to work
+you MUST set your maps
+worldtype to one of the
+following:
+0: medieval
+1: metal
+2: base
+*/
+
+void() item_key2 =
+{
+ if (world.worldtype == 0)
+ {
+ precache_model ("progs/w_g_key.mdl");
+ setmodel (self, "progs/w_g_key.mdl");
+ self.netname = "gold key";
+ }
+ if (world.worldtype == 1)
+ {
+ precache_model ("progs/m_g_key.mdl");
+ setmodel (self, "progs/m_g_key.mdl");
+ self.netname = "gold runekey";
+ }
+ if (world.worldtype == 2)
+ {
+ precache_model2 ("progs/b_g_key.mdl");
+ setmodel (self, "progs/b_g_key.mdl");
+ self.netname = "gold keycard";
+ }
+ key_setsounds();
+ self.touch = key_touch;
+ self.items = IT_KEY2;
+ setsize (self, '-16 -16 -24', '16 16 32');
+ StartItem ();
+};
+
+
+
+/*
+===============================================================================
+
+END OF LEVEL RUNES
+
+===============================================================================
+*/
+
+void() sigil_touch =
+{
+
+ if (other.classname != "player")
+ return;
+ if (other.health <= 0)
+ return;
+
+ centerprint (other, "You got the rune!");
+
+ sound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+ self.solid = SOLID_NOT;
+ self.model = string_null;
+ serverflags = serverflags | (self.spawnflags & 15);
+ self.classname = ""; // so rune doors won't find it
+
+ activator = other;
+ SUB_UseTargets(); // fire all targets / killtargets
+};
+
+
+/*QUAKED item_sigil (0 .5 .8) (-16 -16 -24) (16 16 32) E1 E2 E3 E4
+End of level sigil, pick up to end episode and return to jrstart.
+*/
+
+void() item_sigil =
+{
+ if (!self.spawnflags)
+ objerror ("no spawnflags");
+
+ precache_sound ("misc/runekey.wav");
+ self.noise = "misc/runekey.wav";
+
+ if (self.spawnflags & 1)
+ {
+ precache_model ("progs/end1.mdl");
+ setmodel (self, "progs/end1.mdl");
+ }
+ if (self.spawnflags & 2)
+ {
+ precache_model2 ("progs/end2.mdl");
+ setmodel (self, "progs/end2.mdl");
+ }
+ if (self.spawnflags & 4)
+ {
+ precache_model2 ("progs/end3.mdl");
+ setmodel (self, "progs/end3.mdl");
+ }
+ if (self.spawnflags & 8)
+ {
+ precache_model2 ("progs/end4.mdl");
+ setmodel (self, "progs/end4.mdl");
+ }
+
+ self.touch = sigil_touch;
+ setsize (self, '-16 -16 -24', '16 16 32');
+ StartItem ();
+};
+
+/*
+===============================================================================
+
+POWERUPS
+
+===============================================================================
+*/
+
+void() powerup_touch;
+
+
+void() powerup_touch =
+{
+
+ if (other.classname != "player")
+ return;
+ if (other.health <= 0)
+ return;
+
+ sprint (other, "You got the ");
+ sprint (other, self.netname);
+ sprint (other,"\n");
+
+ if (deathmatch)
+ {
+ self.mdl = self.model;
+
+ if ((self.classname == "item_artifact_invulnerability") ||
+ (self.classname == "item_artifact_invisibility"))
+ self.nextthink = time + 60*5;
+ else
+ self.nextthink = time + 60;
+
+ self.think = SUB_regen;
+ }
+
+ sound (other, CHAN_VOICE, self.noise, 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+ self.solid = SOLID_NOT;
+ other.items = other.items | self.items;
+ self.model = string_null;
+
+// do the apropriate action
+ if (self.classname == "item_artifact_envirosuit")
+ {
+ other.rad_time = 1;
+ other.radsuit_finished = time + 30;
+ }
+
+ if (self.classname == "item_artifact_invulnerability")
+ {
+ other.invincible_time = 1;
+ other.invincible_finished = time + 30;
+ }
+
+ if (self.classname == "item_artifact_invisibility")
+ {
+ other.invisible_time = 1;
+ other.invisible_finished = time + 30;
+ }
+
+ if (self.classname == "item_artifact_super_damage")
+ {
+ other.super_time = 1;
+ other.super_damage_finished = time + 30;
+ }
+
+ activator = other;
+ SUB_UseTargets(); // fire all targets / killtargets
+};
+
+
+
+/*QUAKED item_artifact_invulnerability (0 .5 .8) (-16 -16 -24) (16 16 32)
+Player is invulnerable for 30 seconds
+*/
+void() item_artifact_invulnerability =
+{
+ self.touch = powerup_touch;
+
+ precache_model ("progs/invulner.mdl");
+ precache_sound ("items/protect.wav");
+ precache_sound ("items/protect2.wav");
+ precache_sound ("items/protect3.wav");
+ self.noise = "items/protect.wav";
+ setmodel (self, "progs/invulner.mdl");
+ self.netname = "Pentagram of Protection";
+ self.items = IT_INVULNERABILITY;
+ setsize (self, '-16 -16 -24', '16 16 32');
+ StartItem ();
+};
+
+/*QUAKED item_artifact_envirosuit (0 .5 .8) (-16 -16 -24) (16 16 32)
+Player takes no damage from water or slime for 30 seconds
+*/
+void() item_artifact_envirosuit =
+{
+ self.touch = powerup_touch;
+
+ precache_model ("progs/suit.mdl");
+ precache_sound ("items/suit.wav");
+ precache_sound ("items/suit2.wav");
+ self.noise = "items/suit.wav";
+ setmodel (self, "progs/suit.mdl");
+ self.netname = "Biosuit";
+ self.items = IT_SUIT;
+ setsize (self, '-16 -16 -24', '16 16 32');
+ StartItem ();
+};
+
+
+/*QUAKED item_artifact_invisibility (0 .5 .8) (-16 -16 -24) (16 16 32)
+Player is invisible for 30 seconds
+*/
+void() item_artifact_invisibility =
+{
+ self.touch = powerup_touch;
+
+ precache_model ("progs/invisibl.mdl");
+ precache_sound ("items/inv1.wav");
+ precache_sound ("items/inv2.wav");
+ precache_sound ("items/inv3.wav");
+ self.noise = "items/inv1.wav";
+ setmodel (self, "progs/invisibl.mdl");
+ self.netname = "Ring of Shadows";
+ self.items = IT_INVISIBILITY;
+ setsize (self, '-16 -16 -24', '16 16 32');
+ StartItem ();
+};
+
+
+/*QUAKED item_artifact_super_damage (0 .5 .8) (-16 -16 -24) (16 16 32)
+The next attack from the player will do 4x damage
+*/
+void() item_artifact_super_damage =
+{
+ self.touch = powerup_touch;
+
+ precache_model ("progs/quaddama.mdl");
+ precache_sound ("items/damage.wav");
+ precache_sound ("items/damage2.wav");
+ precache_sound ("items/damage3.wav");
+ self.noise = "items/damage.wav";
+ setmodel (self, "progs/quaddama.mdl");
+ self.netname = "Quad Damage";
+ self.items = IT_QUAD;
+ setsize (self, '-16 -16 -24', '16 16 32');
+ StartItem ();
+};
+
+
+
+/*
+===============================================================================
+
+PLAYER BACKPACKS
+
+===============================================================================
+*/
+
+void() BackpackTouch =
+{
+ local string s;
+ local float old, new;
+ local entity stemp;
+ local float acount;
+
+ if (other.classname != "player")
+ return;
+ if (other.health <= 0)
+ return;
+
+ acount = 0;
+ sprint (other, "You get ");
+
+ if (self.items)
+ if ((other.items & self.items) == 0)
+ {
+ acount = 1;
+ sprint (other, "the ");
+ sprint (other, self.netname);
+ }
+
+// if the player was using his best weapon, change up to the new one if better
+ stemp = self;
+ self = other;
+ //best = W_BestWeapon();
+ self = stemp;
+
+// change weapons
+ other.ammo_shells = other.ammo_shells + self.ammo_shells;
+ other.ammo_nails = other.ammo_nails + self.ammo_nails;
+ other.ammo_rockets = other.ammo_rockets + self.ammo_rockets;
+ other.ammo_cells = other.ammo_cells + self.ammo_cells;
+
+ new = self.items;
+ if (!new)
+ new = other.weapon;
+ old = other.items;
+ other.items = other.items | new;
+
+ bound_other_ammo ();
+
+ if (self.ammo_shells)
+ {
+ if (acount)
+ sprint(other, ", ");
+ acount = 1;
+ s = ftos(self.ammo_shells);
+ sprint (other, s);
+ sprint (other, " shells");
+ }
+ if (self.ammo_nails)
+ {
+ if (acount)
+ sprint(other, ", ");
+ acount = 1;
+ s = ftos(self.ammo_nails);
+ sprint (other, s);
+ sprint (other, " nails");
+ }
+ if (self.ammo_rockets)
+ {
+ if (acount)
+ sprint(other, ", ");
+ acount = 1;
+ s = ftos(self.ammo_rockets);
+ sprint (other, s);
+ sprint (other, " rockets");
+ }
+ if (self.ammo_cells)
+ {
+ if (acount)
+ sprint(other, ", ");
+ acount = 1;
+ s = ftos(self.ammo_cells);
+ sprint (other, s);
+ sprint (other, " cells");
+ }
+
+ sprint (other, "\n");
+// backpack touch sound
+ sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+
+// remove the backpack, change self to the player
+ remove(self);
+ self = other;
+
+// change to the weapon
+ if (!deathmatch)
+ self.weapon = new;
+ else
+ Deathmatch_Weapon (old, new);
+
+ W_SetCurrentAmmo ();
+};
+
+/*
+===============
+DropBackpack
+===============
+*/
+void() DropBackpack =
+{
+ local entity item;
+
+ if (!(self.ammo_shells + self.ammo_nails + self.ammo_rockets + self.ammo_cells))
+ return; // nothing in it
+
+ item = spawn();
+ item.origin = self.origin - '0 0 24';
+
+ item.items = self.weapon;
+ if (item.items == IT_MORPHBALL)
+ item.netname = "Axe";
+ else if (item.items == IT_BLASTER)
+ item.netname = "Shotgun";
+ else if (item.items == IT_ROCKET)
+ item.netname = "Double-barrelled Shotgun";
+ else if (item.items == IT_SPLASER)
+ item.netname = "Nailgun";
+ else if (item.items == IT_SNIPER)
+ item.netname = "Super Nailgun";
+ else if (item.items == IT_GRENADE_LAUNCHER)
+ item.netname = "Grenade Launcher";
+ else if (item.items == IT_MAGMA)
+ item.netname = "Rocket Launcher";
+ else if (item.items == IT_LIGHTNING)
+ item.netname = "Thunderbolt";
+ else
+ item.netname = "";
+
+ item.ammo_shells = self.ammo_shells;
+ item.ammo_nails = self.ammo_nails;
+ item.ammo_rockets = self.ammo_rockets;
+ item.ammo_cells = self.ammo_cells;
+
+ item.velocity_z = 300;
+ item.velocity_x = -100 + (random() * 200);
+ item.velocity_y = -100 + (random() * 200);
+
+ item.flags = FL_ITEM;
+ item.solid = SOLID_TRIGGER;
+ item.movetype = MOVETYPE_TOSS;
+ setmodel (item, "progs/backpack.mdl");
+ setsize (item, '-16 -16 0', '16 16 56');
+ item.touch = BackpackTouch;
+
+ item.nextthink = time + 120; // remove after 2 minutes
+ item.think = SUB_Remove;
+};
+void() energy_touch =
+{
+if (other.classname != "player")
+ return;
+other.energy = other.energy + 1;
+if (other.energy == 1)
+{
+other.health = 199;
+other.max_health = 199;
+}
+else if (other.energy == 2)
+{
+other.health = 299;
+other.max_health = 299;
+}
+else if (other.energy == 3)
+{
+other.health = 399;
+other.max_health = 399;
+}
+else if (other.energy == 4)
+{
+other.health = 499;
+other.max_health = 499;
+}
+else if (other.energy == 5)
+{
+other.health = 599;
+other.max_health = 599;
+}
+else if (other.energy == 6)
+{
+other.health = 699;
+other.max_health = 699;
+}
+else if (other.energy == 7)
+{
+other.health = 799;
+other.max_health = 799;
+}
+else if (other.energy == 8)
+{
+other.health = 899;
+other.max_health = 899;
+}
+else if (other.energy == 9)
+{
+other.health = 999;
+other.max_health = 999;
+}
+else
+other.max_health = 99;
+
+self.model = string_null;
+self.solid = SOLID_NOT;
+
+activator = other;
+SUB_UseTargets(); // fire all targets / killtargets
+};
+void() item_energytank =
+{
+ if (deathmatch)
+ remove(self);
+ precache_model("progs/etank.mdl");
+ precache_sound("items/r_item1.wav");
+ setmodel(self, "progs/etank.mdl");
+ self.noise = "items/r_item1.wav";
+ self.classname = "etank";
+ self.effects = EF_DIMLIGHT;
+ self.healamount = other.max_health;
+ self.touch = energy_touch;
+ setsize (self, '-7 -7 0', '7 7 7');
+ StartItem ();
+};
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/jctest.qc b/r17/Revamped src/Revamped QC/Primeqc4/jctest.qc
new file mode 100755
index 00000000..85a7605f
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/jctest.qc
@@ -0,0 +1,15 @@
+
+void() jctrig =
+{
+dprint ("here\n\n");
+ lightstyle(0, "az");
+};
+
+/*QUAKED trigger_jctest (.5 .5 .5) ?
+*/
+void() trigger_jctest =
+{
+ setsize (self, self.mins, self.maxs);
+ self.solid = SOLID_EDGE;
+ self.touch = jctrig;
+};
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/knight.qc b/r17/Revamped src/Revamped QC/Primeqc4/knight.qc
new file mode 100755
index 00000000..4969750d
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/knight.qc
@@ -0,0 +1,270 @@
+/*
+==============================================================================
+
+KNIGHT
+
+==============================================================================
+*/
+
+$cd id1/models/knight
+$origin 0 0 24
+$base base
+$skin badass3
+
+$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9
+
+$frame runb1 runb2 runb3 runb4 runb5 runb6 runb7 runb8
+
+//frame runc1 runc2 runc3 runc4 runc5 runc6
+
+$frame runattack1 runattack2 runattack3 runattack4 runattack5
+$frame runattack6 runattack7 runattack8 runattack9 runattack10
+$frame runattack11
+
+$frame pain1 pain2 pain3
+
+$frame painb1 painb2 painb3 painb4 painb5 painb6 painb7 painb8 painb9
+$frame painb10 painb11
+
+//frame attack1 attack2 attack3 attack4 attack5 attack6 attack7
+//frame attack8 attack9 attack10 attack11
+
+$frame attackb1 attackb2 attackb3 attackb4 attackb5
+$frame attackb6 attackb7 attackb8 attackb9 attackb10
+
+$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9
+$frame walk10 walk11 walk12 walk13 walk14
+
+$frame kneel1 kneel2 kneel3 kneel4 kneel5
+
+$frame standing2 standing3 standing4 standing5
+
+$frame death1 death2 death3 death4 death5 death6 death7 death8
+$frame death9 death10
+
+$frame deathb1 deathb2 deathb3 deathb4 deathb5 deathb6 deathb7 deathb8
+$frame deathb9 deathb10 deathb11
+
+void() knight_stand1 =[ $stand1, knight_stand2 ] {ai_stand();};
+void() knight_stand2 =[ $stand2, knight_stand3 ] {ai_stand();};
+void() knight_stand3 =[ $stand3, knight_stand4 ] {ai_stand();};
+void() knight_stand4 =[ $stand4, knight_stand5 ] {ai_stand();};
+void() knight_stand5 =[ $stand5, knight_stand6 ] {ai_stand();};
+void() knight_stand6 =[ $stand6, knight_stand7 ] {ai_stand();};
+void() knight_stand7 =[ $stand7, knight_stand8 ] {ai_stand();};
+void() knight_stand8 =[ $stand8, knight_stand9 ] {ai_stand();};
+void() knight_stand9 =[ $stand9, knight_stand1 ] {ai_stand();};
+
+void() knight_walk1 =[ $walk1, knight_walk2 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "knight/idle.wav", 1, ATTN_IDLE);
+ai_walk(3);};
+void() knight_walk2 =[ $walk2, knight_walk3 ] {ai_walk(2);};
+void() knight_walk3 =[ $walk3, knight_walk4 ] {ai_walk(3);};
+void() knight_walk4 =[ $walk4, knight_walk5 ] {ai_walk(4);};
+void() knight_walk5 =[ $walk5, knight_walk6 ] {ai_walk(3);};
+void() knight_walk6 =[ $walk6, knight_walk7 ] {ai_walk(3);};
+void() knight_walk7 =[ $walk7, knight_walk8 ] {ai_walk(3);};
+void() knight_walk8 =[ $walk8, knight_walk9 ] {ai_walk(4);};
+void() knight_walk9 =[ $walk9, knight_walk10 ] {ai_walk(3);};
+void() knight_walk10 =[ $walk10, knight_walk11 ] {ai_walk(3);};
+void() knight_walk11 =[ $walk11, knight_walk12 ] {ai_walk(2);};
+void() knight_walk12 =[ $walk12, knight_walk13 ] {ai_walk(3);};
+void() knight_walk13 =[ $walk13, knight_walk14 ] {ai_walk(4);};
+void() knight_walk14 =[ $walk14, knight_walk1 ] {ai_walk(3);};
+
+
+void() knight_run1 =[ $runb1, knight_run2 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "knight/idle.wav", 1, ATTN_IDLE);
+ai_run(16);};
+void() knight_run2 =[ $runb2, knight_run3 ] {ai_run(20);};
+void() knight_run3 =[ $runb3, knight_run4 ] {ai_run(13);};
+void() knight_run4 =[ $runb4, knight_run5 ] {ai_run(7);};
+void() knight_run5 =[ $runb5, knight_run6 ] {ai_run(16);};
+void() knight_run6 =[ $runb6, knight_run7 ] {ai_run(20);};
+void() knight_run7 =[ $runb7, knight_run8 ] {ai_run(14);};
+void() knight_run8 =[ $runb8, knight_run1 ] {ai_run(6);};
+
+
+void() knight_runatk1 =[ $runattack1, knight_runatk2 ]
+{
+if (random() > 0.5)
+ sound (self, CHAN_WEAPON, "knight/sword2.wav", 1, ATTN_NORM);
+else
+ sound (self, CHAN_WEAPON, "knight/sword1.wav", 1, ATTN_NORM);
+ai_charge(20);
+};
+void() knight_runatk2 =[ $runattack2, knight_runatk3 ] {ai_charge_side();};
+void() knight_runatk3 =[ $runattack3, knight_runatk4 ] {ai_charge_side();};
+void() knight_runatk4 =[ $runattack4, knight_runatk5 ] {ai_charge_side();};
+void() knight_runatk5 =[ $runattack5, knight_runatk6 ] {ai_melee_side();};
+void() knight_runatk6 =[ $runattack6, knight_runatk7 ] {ai_melee_side();};
+void() knight_runatk7 =[ $runattack7, knight_runatk8 ] {ai_melee_side();};
+void() knight_runatk8 =[ $runattack8, knight_runatk9 ] {ai_melee_side();};
+void() knight_runatk9 =[ $runattack9, knight_runatk10 ] {ai_melee_side();};
+void() knight_runatk10 =[ $runattack10, knight_runatk11 ] {ai_charge_side();};
+void() knight_runatk11 =[ $runattack11, knight_run1 ] {ai_charge(10);};
+
+void() knight_atk1 =[ $attackb1, knight_atk2 ]
+{
+sound (self, CHAN_WEAPON, "knight/sword1.wav", 1, ATTN_NORM);
+ai_charge(0);};
+void() knight_atk2 =[ $attackb2, knight_atk3 ] {ai_charge(7);};
+void() knight_atk3 =[ $attackb3, knight_atk4 ] {ai_charge(4);};
+void() knight_atk4 =[ $attackb4, knight_atk5 ] {ai_charge(0);};
+void() knight_atk5 =[ $attackb5, knight_atk6 ] {ai_charge(3);};
+void() knight_atk6 =[ $attackb6, knight_atk7 ] {ai_charge(4); ai_melee();};
+void() knight_atk7 =[ $attackb7, knight_atk8 ] {ai_charge(1); ai_melee();};
+void() knight_atk8 =[ $attackb8, knight_atk9 ] {ai_charge(3);
+ai_melee();};
+void() knight_atk9 =[ $attackb9, knight_atk10] {ai_charge(1);};
+void() knight_atk10=[ $attackb10, knight_run1 ] {ai_charge(5);};
+
+//void() knight_atk9 =[ $attack9, knight_atk10 ] {};
+//void() knight_atk10 =[ $attack10, knight_atk11 ] {};
+//void() knight_atk11 =[ $attack11, knight_run1 ] {};
+
+//===========================================================================
+
+void() knight_pain1 =[ $pain1, knight_pain2 ] {};
+void() knight_pain2 =[ $pain2, knight_pain3 ] {};
+void() knight_pain3 =[ $pain3, knight_run1 ] {};
+
+void() knight_painb1 =[ $painb1, knight_painb2 ] {ai_painforward(0);};
+void() knight_painb2 =[ $painb2, knight_painb3 ] {ai_painforward(3);};
+void() knight_painb3 =[ $painb3, knight_painb4 ] {};
+void() knight_painb4 =[ $painb4, knight_painb5 ] {};
+void() knight_painb5 =[ $painb5, knight_painb6 ] {ai_painforward(2);};
+void() knight_painb6 =[ $painb6, knight_painb7 ] {ai_painforward(4);};
+void() knight_painb7 =[ $painb7, knight_painb8 ] {ai_painforward(2);};
+void() knight_painb8 =[ $painb8, knight_painb9 ] {ai_painforward(5);};
+void() knight_painb9 =[ $painb9, knight_painb10 ] {ai_painforward(5);};
+void() knight_painb10 =[ $painb10, knight_painb11 ] {ai_painforward(0);};
+void() knight_painb11 =[ $painb11, knight_run1 ] {};
+
+void(entity attacker, float damage) knight_pain =
+{
+ local float r;
+
+ if (self.pain_finished > time)
+ return;
+
+ r = random();
+
+ sound (self, CHAN_VOICE, "knight/khurt.wav", 1, ATTN_NORM);
+ if (r < 0.85)
+ {
+ knight_pain1 ();
+ self.pain_finished = time + 1;
+ }
+ else
+ {
+ knight_painb1 ();
+ self.pain_finished = time + 1;
+ }
+
+};
+
+//===========================================================================
+
+void() knight_bow1 =[ $kneel1, knight_bow2 ] {ai_turn();};
+void() knight_bow2 =[ $kneel2, knight_bow3 ] {ai_turn();};
+void() knight_bow3 =[ $kneel3, knight_bow4 ] {ai_turn();};
+void() knight_bow4 =[ $kneel4, knight_bow5 ] {ai_turn();};
+
+void() knight_bow5 =[ $kneel5, knight_bow5 ] {ai_turn();};
+
+void() knight_bow6 =[ $kneel4, knight_bow7 ] {ai_turn();};
+void() knight_bow7 =[ $kneel3, knight_bow8 ] {ai_turn();};
+void() knight_bow8 =[ $kneel2, knight_bow9 ] {ai_turn();};
+void() knight_bow9 =[ $kneel1, knight_bow10 ] {ai_turn();};
+void() knight_bow10 =[ $walk1, knight_walk1 ] {ai_turn();};
+
+
+
+void() knight_die1 =[ $death1, knight_die2 ] {};
+void() knight_die2 =[ $death2, knight_die3 ] {};
+void() knight_die3 =[ $death3, knight_die4 ]
+{self.solid = SOLID_NOT;};
+void() knight_die4 =[ $death4, knight_die5 ] {};
+void() knight_die5 =[ $death5, knight_die6 ] {};
+void() knight_die6 =[ $death6, knight_die7 ] {};
+void() knight_die7 =[ $death7, knight_die8 ] {};
+void() knight_die8 =[ $death8, knight_die9 ] {};
+void() knight_die9 =[ $death9, knight_die10] {};
+void() knight_die10=[ $death10, knight_die10] {};
+
+
+void() knight_dieb1 =[ $deathb1, knight_dieb2 ] {};
+void() knight_dieb2 =[ $deathb2, knight_dieb3 ] {};
+void() knight_dieb3 =[ $deathb3, knight_dieb4 ]
+{self.solid = SOLID_NOT;};
+void() knight_dieb4 =[ $deathb4, knight_dieb5 ] {};
+void() knight_dieb5 =[ $deathb5, knight_dieb6 ] {};
+void() knight_dieb6 =[ $deathb6, knight_dieb7 ] {};
+void() knight_dieb7 =[ $deathb7, knight_dieb8 ] {};
+void() knight_dieb8 =[ $deathb8, knight_dieb9 ] {};
+void() knight_dieb9 =[ $deathb9, knight_dieb10] {};
+void() knight_dieb10 = [ $deathb10, knight_dieb11] {};
+void() knight_dieb11 = [ $deathb11, knight_dieb11] {};
+
+
+void() knight_die =
+{
+// check for gib
+ if (self.health < -40)
+ {
+ sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
+ ThrowHead ("progs/h_knight.mdl", self.health);
+ ThrowGib ("progs/gib1.mdl", self.health);
+ ThrowGib ("progs/gib2.mdl", self.health);
+ ThrowGib ("progs/gib3.mdl", self.health);
+ return;
+ }
+
+// regular death
+ sound (self, CHAN_VOICE, "knight/kdeath.wav", 1, ATTN_NORM);
+ if (random() < 0.5)
+ knight_die1 ();
+ else
+ knight_dieb1 ();
+};
+
+
+/*QUAKED monster_knight (1 0 0) (-16 -16 -24) (16 16 40) Ambush
+*/
+void() monster_wizard =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+ precache_model ("progs/metroid.mdl");
+ precache_model ("progs/h_knight.mdl");
+
+ precache_sound ("knight/kdeath.wav");
+ precache_sound ("knight/khurt.wav");
+ precache_sound ("knight/ksight.wav");
+ precache_sound ("knight/sword1.wav");
+ precache_sound ("knight/sword2.wav");
+ precache_sound ("knight/idle.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/metroid.mdl");
+
+ setsize (self, '-16 -16 -24', '16 16 40');
+ self.health = 75;
+
+ self.th_stand = knight_stand1;
+ self.th_walk = knight_walk1;
+ self.th_run = knight_run1;
+ self.th_melee = knight_atk1;
+ self.th_pain = knight_pain;
+ self.th_die = knight_die;
+
+ flymonster_start ();
+};
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/misc.qc b/r17/Revamped src/Revamped QC/Primeqc4/misc.qc
new file mode 100755
index 00000000..30a4fc90
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/misc.qc
@@ -0,0 +1,715 @@
+
+/*QUAKED info_null (0 0.5 0) (-4 -4 -4) (4 4 4)
+Used as a positional target for spotlights, etc.
+*/
+void() info_null =
+{
+ remove(self);
+};
+
+/*QUAKED info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4)
+Used as a positional target for lightning.
+*/
+void() info_notnull =
+{
+};
+
+//============================================================================
+
+float START_OFF = 1;
+
+void() light_use =
+{
+ if (self.spawnflags & START_OFF)
+ {
+ lightstyle(self.style, "m");
+ self.spawnflags = self.spawnflags - START_OFF;
+ }
+ else
+ {
+ lightstyle(self.style, "a");
+ self.spawnflags = self.spawnflags + START_OFF;
+ }
+};
+
+/*QUAKED light (0 1 0) (-8 -8 -8) (8 8 8) START_OFF
+Non-displayed light.
+Default light value is 300
+Default style is 0
+If targeted, it will toggle between on or off.
+*/
+void() light =
+{
+ if (!self.targetname)
+ { // inert light
+ remove(self);
+ return;
+ }
+
+ if (self.style >= 32)
+ {
+ self.use = light_use;
+ if (self.spawnflags & START_OFF)
+ lightstyle(self.style, "a");
+ else
+ lightstyle(self.style, "m");
+ }
+};
+
+/*QUAKED light_fluoro (0 1 0) (-8 -8 -8) (8 8 8) START_OFF
+Non-displayed light.
+Default light value is 300
+Default style is 0
+If targeted, it will toggle between on or off.
+Makes steady fluorescent humming sound
+*/
+void() light_fluoro =
+{
+ if (self.style >= 32)
+ {
+ self.use = light_use;
+ if (self.spawnflags & START_OFF)
+ lightstyle(self.style, "a");
+ else
+ lightstyle(self.style, "m");
+ }
+
+ precache_sound ("ambience/fl_hum1.wav");
+ ambientsound (self.origin, "ambience/fl_hum1.wav", 0.5, ATTN_STATIC);
+};
+
+/*QUAKED light_fluorospark (0 1 0) (-8 -8 -8) (8 8 8)
+Non-displayed light.
+Default light value is 300
+Default style is 10
+Makes sparking, broken fluorescent sound
+*/
+void() light_fluorospark =
+{
+ if (!self.style)
+ self.style = 10;
+
+ precache_sound ("ambience/buzz1.wav");
+ ambientsound (self.origin, "ambience/buzz1.wav", 0.5, ATTN_STATIC);
+};
+
+/*QUAKED light_globe (0 1 0) (-8 -8 -8) (8 8 8)
+Sphere globe light.
+Default light value is 300
+Default style is 0
+*/
+void() light_globe =
+{
+ precache_model ("progs/s_light.spr");
+ setmodel (self, "progs/s_light.spr");
+ makestatic (self);
+};
+
+void() FireAmbient =
+{
+ precache_sound ("ambience/fire1.wav");
+// attenuate fast
+ ambientsound (self.origin, "ambience/fire1.wav", 0.5, ATTN_STATIC);
+};
+
+/*QUAKED light_torch_small_walltorch (0 .5 0) (-10 -10 -20) (10 10 20)
+Short wall torch
+Default light value is 200
+Default style is 0
+*/
+void() light_torch_small_walltorch =
+{
+ precache_model ("progs/flame.mdl");
+ setmodel (self, "progs/flame.mdl");
+ FireAmbient ();
+ makestatic (self);
+};
+
+/*QUAKED light_flame_large_yellow (0 1 0) (-10 -10 -12) (12 12 18)
+Large yellow flame ball
+*/
+void() light_flame_large_yellow =
+{
+ precache_model ("progs/flame2.mdl");
+ setmodel (self, "progs/flame2.mdl");
+ self.frame = 1;
+ FireAmbient ();
+ makestatic (self);
+};
+
+/*QUAKED light_flame_small_yellow (0 1 0) (-8 -8 -8) (8 8 8) START_OFF
+Small yellow flame ball
+*/
+void() light_flame_small_yellow =
+{
+ precache_model ("progs/flame2.mdl");
+ setmodel (self, "progs/flame2.mdl");
+ FireAmbient ();
+ makestatic (self);
+};
+
+/*QUAKED light_flame_small_white (0 1 0) (-10 -10 -40) (10 10 40) START_OFF
+Small white flame ball
+*/
+void() light_flame_small_white =
+{
+ precache_model ("progs/flame2.mdl");
+ setmodel (self, "progs/flame2.mdl");
+ FireAmbient ();
+ makestatic (self);
+};
+
+//============================================================================
+
+
+/*QUAKED misc_fireball (0 .5 .8) (-8 -8 -8) (8 8 8)
+Lava Balls
+*/
+
+void() fire_fly;
+void() fire_touch;
+void() misc_fireball =
+{
+
+ self.classname = "fireball";
+ self.nextthink = time + (random() * 5);
+ self.think = fire_fly;
+ //if (!self.speed)
+ //self.speed == 1000;
+};
+
+void() fire_fly =
+{
+local entity fireball;
+
+ fireball = spawn();
+ fireball.solid = SOLID_TRIGGER;
+ fireball.movetype = MOVETYPE_TOSS;
+ fireball.velocity = '0 0 1000';
+ fireball.velocity_x = (random() * 100) - 50;
+ fireball.velocity_y = (random() * 100) - 50;
+ fireball.velocity_z = self.speed + (random() * 200);
+ fireball.classname = "fireball";
+ setmodel (fireball, "progs/lavaball.mdl");
+ setsize (fireball, '0 0 0', '0 0 0');
+ setorigin (fireball, self.origin);
+ fireball.nextthink = time + 5;
+ fireball.think = SUB_Remove;
+ fireball.touch = fire_touch;
+
+ self.nextthink = time + (random() * 5) + 3;
+ self.think = fire_fly;
+};
+
+
+void() fire_touch =
+{
+ T_Damage (other, self, self, 20);
+ remove(self);
+};
+
+//============================================================================
+
+
+void() barrel_explode =
+{
+ self.takedamage = DAMAGE_NO;
+ self.classname = "explo_box";
+ // did say self.owner
+ T_RadiusDamage (self, self, 160, world);
+ sound (self, CHAN_VOICE, "weapons/r_exp3.wav", 1, ATTN_NORM);
+ particle (self.origin, '0 0 0', 75, 255);
+
+ self.origin_z = self.origin_z + 32;
+ CreateExplosion(self.origin);
+ remove(self);
+};
+
+
+
+/*QUAKED misc_explobox (0 .5 .8) (0 0 0) (32 32 64)
+TESTING THING
+*/
+
+void() misc_explobox =
+{
+ local float oldz;
+
+ self.solid = SOLID_BBOX;
+ self.movetype = MOVETYPE_NONE;
+ precache_model ("maps/b_explob.bsp");
+ setmodel (self, "maps/b_explob.bsp");
+ precache_sound ("weapons/r_exp3.wav");
+ self.health = 20;
+ self.th_die = barrel_explode;
+ self.takedamage = DAMAGE_AIM;
+
+ self.origin_z = self.origin_z + 2;
+ oldz = self.origin_z;
+ droptofloor(1, 1);
+ if (oldz - self.origin_z > 250)
+ {
+ dprint ("item fell out of level at ");
+ dprint (vtos(self.origin));
+ dprint ("\n");
+ remove(self);
+ }
+};
+
+
+
+
+/*QUAKED misc_explobox2 (0 .5 .8) (0 0 0) (32 32 64)
+Smaller exploding box, REGISTERED ONLY
+*/
+
+void() misc_explobox2 =
+{
+ self.solid = SOLID_BBOX;
+ self.movetype = MOVETYPE_NONE;
+ precache_model2 ("maps/b_exbox2.bsp");
+ setmodel (self, "maps/b_exbox2.bsp");
+ precache_sound ("weapons/r_exp3.wav");
+ self.health = 20;
+ self.th_die = barrel_explode;
+ self.takedamage = DAMAGE_AIM;
+};
+
+//============================================================================
+
+float SPAWNFLAG_SUPERSPIKE = 1;
+float SPAWNFLAG_LASER = 2;
+
+void(vector org, vector vec) LaunchLaser;
+
+void() spikeshooter_use =
+{
+ if (self.spawnflags & SPAWNFLAG_LASER)
+ {
+ sound (self, CHAN_VOICE, "enforcer/enfire.wav", 1, ATTN_NORM);
+ LaunchLaser (self.origin, self.movedir);
+ }
+ else
+ {
+ sound (self, CHAN_VOICE, "weapons/spike2.wav", 1, ATTN_NORM);
+ launch_spike (self.origin, self.movedir);
+ newmis.velocity = self.movedir * 500;
+ if (self.spawnflags & SPAWNFLAG_SUPERSPIKE)
+ newmis.touch = superspike_touch;
+ }
+};
+
+void() shooter_think =
+{
+ spikeshooter_use ();
+ self.nextthink = time + self.wait;
+ newmis.velocity = self.movedir * 500;
+};
+
+
+/*QUAKED trap_spikeshooter (0 .5 .8) (-8 -8 -8) (8 8 8) superspike laser
+When triggered, fires a spike in the direction set in QuakeEd.
+Laser is only for REGISTERED.
+*/
+
+void() trap_spikeshooter =
+{
+ SetMovedir ();
+ self.use = spikeshooter_use;
+ if (self.spawnflags & SPAWNFLAG_LASER)
+ {
+ precache_model2 ("progs/laser.mdl");
+
+ precache_sound2 ("enforcer/enfire.wav");
+ precache_sound2 ("enforcer/enfstop.wav");
+ }
+ else
+ precache_sound ("weapons/spike2.wav");
+};
+
+
+/*QUAKED trap_shooter (0 .5 .8) (-8 -8 -8) (8 8 8) superspike laser
+Continuously fires spikes.
+"wait" time between spike (1.0 default)
+"nextthink" delay before firing first spike, so multiple shooters can be stagered.
+*/
+void() trap_shooter =
+{
+ trap_spikeshooter ();
+
+ if (self.wait == 0)
+ self.wait = 1;
+ self.nextthink = self.nextthink + self.wait + self.ltime;
+ self.think = shooter_think;
+};
+
+
+
+/*
+===============================================================================
+
+
+===============================================================================
+*/
+
+
+void() make_bubbles;
+void() bubble_remove;
+void() bubble_bob;
+
+/*QUAKED air_bubbles (0 .5 .8) (-8 -8 -8) (8 8 8)
+
+testing air bubbles
+*/
+
+void() air_bubbles =
+
+{
+ if (deathmatch)
+ {
+ remove (self);
+ return;
+ }
+ precache_model ("progs/s_bubble.spr");
+ self.nextthink = time + 1;
+ self.think = make_bubbles;
+};
+
+void() make_bubbles =
+{
+local entity bubble;
+
+ bubble = spawn();
+ setmodel (bubble, "progs/s_bubble.spr");
+ setorigin (bubble, self.origin);
+ bubble.movetype = MOVETYPE_NOCLIP;
+ bubble.solid = SOLID_NOT;
+ bubble.velocity = '0 0 15';
+ bubble.nextthink = time + 0.5;
+ bubble.think = bubble_bob;
+ bubble.touch = bubble_remove;
+ bubble.classname = "bubble";
+ bubble.frame = 0;
+ bubble.cnt = 0;
+ setsize (bubble, '-8 -8 -8', '8 8 8');
+ self.nextthink = time + random() + 0.5;
+ self.think = make_bubbles;
+};
+
+void() bubble_split =
+{
+local entity bubble;
+ bubble = spawn();
+ setmodel (bubble, "progs/s_bubble.spr");
+ setorigin (bubble, self.origin);
+ bubble.movetype = MOVETYPE_NOCLIP;
+ bubble.solid = SOLID_NOT;
+ bubble.velocity = self.velocity;
+ bubble.nextthink = time + 0.5;
+ bubble.think = bubble_bob;
+ bubble.touch = bubble_remove;
+ bubble.classname = "bubble";
+ bubble.frame = 1;
+ bubble.cnt = 10;
+ setsize (bubble, '-8 -8 -8', '8 8 8');
+ self.frame = 1;
+ self.cnt = 10;
+ if (self.waterlevel != 3)
+ remove (self);
+};
+
+void() bubble_remove =
+{
+ if (other.classname == self.classname)
+ {
+// dprint ("bump");
+ return;
+ }
+ remove(self);
+};
+
+void() bubble_bob =
+{
+local float rnd1, rnd2, rnd3;
+
+ self.cnt = self.cnt + 1;
+ if (self.cnt == 4)
+ bubble_split();
+ if (self.cnt == 20)
+ remove(self);
+
+ rnd1 = self.velocity_x + (-10 + (random() * 20));
+ rnd2 = self.velocity_y + (-10 + (random() * 20));
+ rnd3 = self.velocity_z + 10 + random() * 10;
+
+ if (rnd1 > 10)
+ rnd1 = 5;
+ if (rnd1 < -10)
+ rnd1 = -5;
+
+ if (rnd2 > 10)
+ rnd2 = 5;
+ if (rnd2 < -10)
+ rnd2 = -5;
+
+ if (rnd3 < 10)
+ rnd3 = 15;
+ if (rnd3 > 30)
+ rnd3 = 25;
+
+ self.velocity_x = rnd1;
+ self.velocity_y = rnd2;
+ self.velocity_z = rnd3;
+
+ self.nextthink = time + 0.5;
+ self.think = bubble_bob;
+};
+
+/*~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>
+~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~*/
+
+/*QUAKED viewthing (0 .5 .8) (-8 -8 -8) (8 8 8)
+
+Just for the debugging level. Don't use
+*/
+
+void() viewthing =
+
+{
+ self.movetype = MOVETYPE_NONE;
+ self.solid = SOLID_NOT;
+ precache_model ("progs/player.mdl");
+ setmodel (self, "progs/player.mdl");
+};
+
+
+/*
+==============================================================================
+
+SIMPLE BMODELS
+
+==============================================================================
+*/
+
+void() func_wall_use =
+{ // change to alternate textures
+ self.frame = 1 - self.frame;
+};
+
+/*QUAKED func_wall (0 .5 .8) ?
+This is just a solid wall if not inhibitted
+*/
+void() func_wall =
+{
+ self.angles = '0 0 0';
+ self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything
+ self.solid = SOLID_BSP;
+ self.use = func_wall_use;
+ setmodel (self, self.model);
+};
+
+
+/*QUAKED func_illusionary (0 .5 .8) ?
+A simple entity that looks solid but lets you walk through it.
+*/
+void() func_illusionary =
+
+{
+ self.angles = '0 0 0';
+ self.movetype = MOVETYPE_NONE;
+ self.solid = SOLID_NOT;
+ setmodel (self, self.model);
+ makestatic (self);
+};
+
+/*QUAKED func_episodegate (0 .5 .8) ? E1 E2 E3 E4
+This bmodel will appear if the episode has allready been completed, so players can't reenter it.
+*/
+void() func_episodegate =
+
+{
+ if (!(serverflags & self.spawnflags))
+ return; // can still enter episode
+
+ self.angles = '0 0 0';
+ self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything
+ self.solid = SOLID_BSP;
+ self.use = func_wall_use;
+ setmodel (self, self.model);
+};
+
+/*QUAKED func_bossgate (0 .5 .8) ?
+This bmodel appears unless players have all of the episode sigils.
+*/
+void() func_bossgate =
+
+{
+ if ( (serverflags & 15) == 15)
+ return; // all episodes completed
+ self.angles = '0 0 0';
+ self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything
+ self.solid = SOLID_BSP;
+ self.use = func_wall_use;
+ setmodel (self, self.model);
+};
+
+//============================================================================
+/*QUAKED ambient_suck_wind (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+*/
+void() ambient_suck_wind =
+{
+ precache_sound ("ambience/suck1.wav");
+ ambientsound (self.origin, "ambience/suck1.wav", 1, ATTN_STATIC);
+};
+
+/*QUAKED ambient_drone (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+*/
+void() ambient_drone =
+{
+ precache_sound ("ambience/drone6.wav");
+ ambientsound (self.origin, "ambience/drone6.wav", 0.5, ATTN_STATIC);
+};
+
+/*QUAKED ambient_flouro_buzz (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+*/
+void() ambient_flouro_buzz =
+{
+ precache_sound ("ambience/buzz1.wav");
+ ambientsound (self.origin, "ambience/buzz1.wav", 1, ATTN_STATIC);
+};
+/*QUAKED ambient_drip (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+*/
+void() ambient_drip =
+{
+ precache_sound ("ambience/drip1.wav");
+ ambientsound (self.origin, "ambience/drip1.wav", 0.5, ATTN_STATIC);
+};
+/*QUAKED ambient_comp_hum (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+*/
+void() ambient_comp_hum =
+{
+ precache_sound ("ambience/comp1.wav");
+ ambientsound (self.origin, "ambience/comp1.wav", 1, ATTN_STATIC);
+};
+/*QUAKED ambient_thunder (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+*/
+void() ambient_thunder =
+{
+ precache_sound ("ambience/thunder1.wav");
+ ambientsound (self.origin, "ambience/thunder1.wav", 0.5, ATTN_STATIC);
+};
+/*QUAKED ambient_light_buzz (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+*/
+void() ambient_light_buzz =
+{
+ precache_sound ("ambience/fl_hum1.wav");
+ ambientsound (self.origin, "ambience/fl_hum1.wav", 0.5, ATTN_STATIC);
+};
+/*QUAKED ambient_swamp1 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+*/
+void() ambient_swamp1 =
+{
+ precache_sound ("ambience/swamp1.wav");
+ ambientsound (self.origin, "ambience/swamp1.wav", 0.5, ATTN_STATIC);
+};
+/*QUAKED ambient_swamp2 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+*/
+void() ambient_swamp2 =
+{
+ precache_sound ("ambience/swamp2.wav");
+ ambientsound (self.origin, "ambience/swamp2.wav", 0.5, ATTN_STATIC);
+};
+
+//============================================================================
+
+void() noise_think =
+{
+ self.nextthink = time + 0.5;
+ sound (self, 1, "enforcer/enfire.wav", 1, ATTN_NORM);
+ sound (self, 2, "enforcer/enfstop.wav", 1, ATTN_NORM);
+ sound (self, 3, "enforcer/sight1.wav", 1, ATTN_NORM);
+ sound (self, 4, "enforcer/sight2.wav", 1, ATTN_NORM);
+ sound (self, 5, "enforcer/sight3.wav", 1, ATTN_NORM);
+ sound (self, 6, "enforcer/sight4.wav", 1, ATTN_NORM);
+ sound (self, 7, "enforcer/pain1.wav", 1, ATTN_NORM);
+};
+
+/*QUAKED misc_noisemaker (1 0.5 0) (-10 -10 -10) (10 10 10)
+
+For optimzation testing, starts a lot of sounds.
+*/
+
+void() misc_noisemaker =
+
+{
+ precache_sound2 ("enforcer/enfire.wav");
+ precache_sound2 ("enforcer/enfstop.wav");
+ precache_sound2 ("enforcer/sight1.wav");
+ precache_sound2 ("enforcer/sight2.wav");
+ precache_sound2 ("enforcer/sight3.wav");
+ precache_sound2 ("enforcer/sight4.wav");
+ precache_sound2 ("enforcer/pain1.wav");
+ precache_sound2 ("enforcer/pain2.wav");
+ precache_sound2 ("enforcer/death1.wav");
+ precache_sound2 ("enforcer/idle1.wav");
+
+ self.nextthink = time + 0.1 + random();
+ self.think = noise_think;
+};
+
+void() misc_model =
+{
+ precache_model( self.model );
+ setmodel( self, self.model );
+ setorigin( self, self.origin );
+
+ self.movetype = MOVETYPE_NONE;
+ self.solid = SOLID_BBOX;
+ setsize(self, '-8 -8 -8', '8 8 8');
+};
+
+/*
+==============================
+
+These are The props for Mapping. They require A special Size, So they must be An actual Function.
+
+==============================
+*/
+
+void() misc_deadtree =
+{
+self.solid = SOLID_BBOX;
+self.movetype = MOVETYPE_NONE;
+self.classname = "deadtree";
+precache_model ("progs/deadtree.mdl");
+setmodel (self, "progs/deadtree.mdl");
+setsize (self, '-18 -18 0', '18 18 100');
+};
+
+void() misc_deadtree2 =
+{
+self.solid = SOLID_BBOX;
+self.movetype = MOVETYPE_NONE;
+self.classname = "deadtree2";
+precache_model ("progs/deadtree2.mdl");
+setmodel (self, "progs/deadtree2.mdl");
+setsize (self, '-18 -18 0', '18 18 100');
+};
+void() misc_boulder =
+{
+self.solid = SOLID_BBOX;
+self.movetype = MOVETYPE_NONE;
+self.classname = "Boulder";
+precache_model ("progs/boulder.mdl");
+setmodel (self, "progs/boulder.mdl");
+setsize (self, '-30 -30 0', '30 30 34');
+};
+void() misc_boulder2 =
+{
+self.solid = SOLID_BBOX;
+self.movetype = MOVETYPE_NONE;
+self.classname = "Boulder";
+precache_model ("progs/boulder2.mdl");
+setmodel (self, "progs/boulder2.mdl");
+setsize (self, '-30 -30 0', '30 30 34');
+}
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/models.qc b/r17/Revamped src/Revamped QC/Primeqc4/models.qc
new file mode 100755
index 00000000..70e273c4
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/models.qc
@@ -0,0 +1,585 @@
+
+/*
+===============================================================================
+
+WORLD WEAPONS
+
+===============================================================================
+*/
+
+$modelname g_shot
+$cd id1/models/g_shot
+$origin 0 0 -24
+$flags 8 // client side rotate
+$base base
+$skin skin
+$frame shot1
+
+
+$modelname g_nail
+$cd id1/models/g_nail
+$flags 8 // client side rotate
+$origin 0 0 -24
+$base base
+$skin skin
+$frame shot1
+
+
+$modelname g_nail2
+$cd id1/models/g_nail2
+$flags 8 // client side rotate
+$origin 0 0 -24
+$base base
+$skin skin
+$frame shot2
+
+
+$modelname g_rock
+$cd id1/models/g_rock
+$flags 8 // client side rotate
+$origin 0 0 -24
+$base base
+$skin skin
+$frame shot1
+
+
+$modelname g_rock2
+$cd id1/models/g_rock2
+$flags 8 // client side rotate
+$origin 0 0 -24
+$base base
+$skin skin
+$frame shot1
+
+$modelname g_light
+$cd id1/models/g_light
+$flags 8 // client side rotate
+$origin 0 0 -24
+$base base
+$skin skin
+$frame shot1
+
+/*
+===============================================================================
+
+VIEW WEAPONS
+
+===============================================================================
+*/
+
+$modelname v_axe
+$cd id1/models/v_axe
+$origin 0 5 54
+$base base
+$skin skin
+$frame frame1 frame2 frame3 frame4 frame5 frame6 frame7 frame8 frame9
+
+
+$modelname v_shot
+$cd id1/models/v_shot
+$origin 0 0 54
+$base base
+$skin skin
+$frame shot1 shot2 shot3 shot4 shot5 shot6 shot7
+
+
+$modelname v_shot2
+$cd id1/models/v_shot2
+$origin 0 0 56
+$base base
+$skin skin
+$frame shot1 shot2 shot3 shot4 shot5 shot6 shot7
+
+
+$modelname v_rock2
+$cd id1/models/v_rock2
+$origin 0 0 54
+$base base
+$skin skin
+$frame shot1 shot2 shot3 shot4 shot5 shot6 shot6
+
+
+$modelname v_rock
+$cd id1/models/v_rock
+$origin 0 0 54
+$base base
+$skin skin
+$frame shot1 shot2 shot3 shot4 shot5 shot6 shot7
+
+
+$modelname v_nail2
+$cd id1/models/v_nail2
+$origin 0 0 54
+$base base
+$skin skin
+$frame shot1 shot2 shot3 shot4 shot5 shot6 shot7 shot8 shot9
+
+
+$modelname v_nail
+$cd id1/models/v_nail
+$origin 0 0 54
+$base base
+$skin skin
+$frame shot1 shot2 shot3 shot4 shot5 shot6 shot7 shot8 shot9
+
+$modelname v_light
+$cd id1/models/v_light
+$origin 0 0 54
+$base base
+$skin skin
+$frame shot1 shot2 shot3 shot4 shot5
+
+
+/*
+===============================================================================
+
+ITEMS
+
+===============================================================================
+*/
+
+$modelname w_g_key
+$cd id1/models/w_g_key
+$flags 8 // client side rotate
+$base base
+$skin skin
+$frame frame1
+
+$modelname w_s_key
+$cd id1/models/w_s_key
+$flags 8 // client side rotate
+$base base
+$skin skin
+$frame frame1
+
+$modelname m_g_key
+$cd id1/models/m_g_key
+$flags 8 // client side rotate
+$base base
+$skin skin
+$frame frame1
+
+$modelname m_s_key
+$cd id1/models/m_s_key
+$flags 8 // client side rotate
+$base base
+$skin skin
+$frame frame1
+
+$modelname b_g_key
+$cd id1/models/b_g_key
+$flags 8 // client side rotate
+$base base
+$skin skin
+$frame frame1
+
+$modelname b_s_key
+$cd id1/models/b_s_key
+$flags 8 // client side rotate
+$base base
+$skin skin
+$frame frame1
+
+
+$modelname quaddama
+$cd id1/models/quaddama
+$flags 8 // client side rotate
+$base base
+$skin skin
+$frame frame1
+
+$modelname invisibl
+$cd id1/models/invisibl
+$flags 8 // client side rotate
+$base base
+$skin skin
+$frame frame1
+
+$modelname invulner
+$flags 8 // client side rotate
+$cd id1/models/invulner
+$base base
+$skin skin
+$frame frame1
+
+//modelname jetpack
+//cd id1/models/jetpack
+//flags 8 // client side rotate
+//base base
+//skin skin
+//frame frame1
+
+$modelname cube
+$cd id1/models/cube
+$flags 8 // client side rotate
+$base base
+$skin skin
+$frame frame1
+
+$modelname suit
+$cd id1/models/suit
+$flags 8 // client side rotate
+$base base
+$skin skin
+$frame frame1
+
+$modelname boots
+$cd id1/models/boots
+$flags 8 // client side rotate
+$base base
+$skin skin
+$frame frame1
+
+$modelname end1
+$cd id1/models/end1
+$flags 8 // client side rotate
+$base base
+$skin skin
+$frame frame1
+
+$modelname end2
+$cd id1/models/end2
+$flags 8 // client side rotate
+$base base
+$skin skin
+$frame frame1
+
+$modelname end3
+$cd id1/models/end3
+$flags 8 // client side rotate
+$base base
+$skin skin
+$frame frame1
+
+$modelname end4
+$cd id1/models/end4
+$flags 8 // client side rotate
+$base base
+$skin skin
+$frame frame1
+
+
+/*
+===============================================================================
+
+GIBS
+
+===============================================================================
+*/
+
+$modelname gib1
+$cd id1/models/gib1
+$flags 4 // EF_GIB
+$origin 0 0 0
+$base base
+$skin skin
+$frame frame1
+
+
+// torso
+$modelname gib2
+$cd id1/models/gib2
+$flags 4 // EF_GIB
+$origin 0 0 0
+$base base
+$skin skin
+$frame frame1
+
+$modelname gib3
+$cd id1/models/gib3
+$flags 4 // EF_GIB
+$origin 0 0 0
+$base base
+$skin skin
+$frame frame1
+
+
+// heads
+
+$modelname h_player
+$cd id1/models/h_player
+$flags 4 // EF_GIB
+$origin 0 0 0
+$base base
+$skin skin
+$frame frame1
+
+$modelname h_dog
+$cd id1/models/h_dog
+$flags 4 // EF_GIB
+$origin 0 0 0
+$base base
+$skin skin
+$frame frame1
+
+$modelname h_mega
+$cd id1/models/h_mega
+$flags 4 // EF_GIB
+$origin 0 0 0
+$base base
+$skin skin
+$frame frame1
+
+$modelname h_guard
+$cd id1/models/h_guard
+$flags 4 // EF_GIB
+$origin 0 0 0
+$base base
+$skin skin
+$frame frame1
+
+$modelname h_wizard
+$cd id1/models/h_wizard
+$flags 4 // EF_GIB
+$origin 0 0 0
+$base base
+$skin skin
+$frame frame1
+
+$modelname h_knight
+$cd id1/models/h_knight
+$flags 4 // EF_GIB
+$origin 0 0 0
+$base base
+$skin skin
+$frame frame1
+
+$modelname h_hellkn
+$cd id1/models/h_hellkn
+$flags 4 // EF_GIB
+$origin 0 0 0
+$base base
+$skin skin
+$frame frame1
+
+$modelname h_zombie
+$cd id1/models/h_zombie
+$flags 4 // EF_GIB
+$origin 0 0 0
+$base base
+$skin skin
+$frame frame1
+
+$modelname h_shams
+$cd id1/models/h_shams
+$flags 4 // EF_GIB
+$origin 0 0 0
+$base base
+$skin skin
+$frame frame1
+
+$modelname h_shal
+$cd id1/models/h_shal
+$flags 4 // EF_GIB
+$origin 0 0 0
+$base base
+$skin skin
+$frame frame1
+
+$modelname h_ogre
+$cd id1/models/h_ogre
+$flags 4 // EF_GIB
+$origin 0 0 0
+$base base
+$skin skin
+$frame frame1
+
+$modelname h_demon
+$cd id1/models/h_demon
+$flags 4 // EF_GIB
+$origin 0 0 0
+$base base
+$skin skin
+$frame frame1
+
+/*
+===============================================================================
+
+MISC
+
+===============================================================================
+*/
+
+$modelname armor
+$cd id1/models/armor
+$flags 8 // client side rotate
+$origin 0 0 -8
+$base base
+$skin skin
+$skin skin2
+$skin skin3
+$frame armor
+
+$modelname s_light // shambler lightning ready
+$cd id1/models/s_light
+$origin 0 0 24
+$base base
+$skin skin
+$frame frame1 frame2 frame3
+
+$modelname bolt3 // lightning towar bolts
+$cd id1/models/bolt2
+$origin 0 0 0
+$base base
+$scale 4
+$skin skin
+$frame light
+
+$modelname bolt2
+$cd id1/models/bolt2
+$origin 0 0 0
+$base base
+$skin skin
+$frame light
+
+$modelname bolt
+$cd id1/models/bolt
+$origin 0 0 0
+$base light
+$skin light
+$frame light
+
+$modelname laser
+$cd id1/models/laser
+$base base
+$skin skin
+$scale 2
+$frame frame1
+
+$modelname flame // with torch
+$cd id1/models/flame
+$origin 0 0 12
+$base base
+$skin skin
+$framegroupstart
+$frame flame1 0.1
+$frame flame2 0.1
+$frame flame3 0.1
+$frame flame4 0.1
+$frame flame5 0.1
+$frame flame6 0.1
+$framegroupend
+
+$modelname flame2 // standing flame, no torch
+$cd id1/models/flame2
+$origin 0 0 12
+$base base
+$skin skin
+$framegroupstart
+$frame flame1 0.1
+$frame flame2 0.1
+$frame flame3 0.1
+$frame flame4 0.1
+$frame flame5 0.1
+$frame flame6 0.1
+$framegroupend
+$framegroupstart
+$frame flameb1
+$frame flameb2
+$frame flameb3
+$frame flameb4
+$frame flameb5
+$frame flameb6
+$frame flameb7
+$frame flameb8
+$frame flameb9
+$frame flameb10
+$frame flameb11
+$framegroupend
+
+$modelname zom_gib
+$cd id1/models/zom_gib
+$flags 32 // EF_ZOMGIB
+$base base
+$skin skin
+$frame frame1
+
+$modelname eyes
+$cd id1/models/eyes
+$origin 0 0 -24
+$base base
+$skin skin
+$frame frame1
+
+$modelname spike
+$cd id1/models/spike
+$origin 0 0 0
+$base spike
+$skin skin
+$frame spike
+
+$modelname s_spike
+$cd id1/models/s_spike
+$origin 0 0 0
+$base spike
+$skin skin
+$frame spike
+
+$modelname v_spike
+$cd id1/models/v_spike
+$flags 128 // EF_TRACER3
+$origin 0 0 0
+$base base
+$skin skin
+$frame frame1
+
+$modelname w_spike
+$cd id1/models/w_spike
+$flags 16 // EF_TRACER
+$origin 0 0 0
+$base base
+$skin skin
+$framegroupstart
+$frame frame1 0.1
+$frame frame2 0.1
+$frame frame3 0.1
+$frame frame4 0.1
+$framegroupend
+
+$modelname k_spike
+$cd id1/models/k_spike
+$flags 64 // EF_TRACER2
+$origin 0 0 0
+$base base
+$skin skin
+$frame frame1
+
+$modelname backpack
+$cd id1/models/backpack
+$flags 8 // EF_ROTATE
+$origin 0 0 0
+$base base
+$skin skin
+$frame frame1
+
+$modelname grenade
+$cd id1/models/grenade2
+$flags 2 // EF_GRENADE
+$origin 0 0 0
+$base base
+$skin skin
+$frame grenade
+
+$modelname missile
+$cd id1/models/missile
+$flags 1 // EF_ROCKET
+$origin 0 0 0
+$base base
+$skin skin
+$frame missile
+
+$modelname lavaball
+$cd id1/models/lavaball
+$flags 1 // EF_ROCKET
+$origin 0 0 0
+$base base
+$skin skin
+$frame frame1
+
+$modelname teleport
+$cd id1/models/teleport
+$origin 0 0 24
+$base base
+$skin skin
+$frame frame1
+
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/monsters.qc b/r17/Revamped src/Revamped QC/Primeqc4/monsters.qc
new file mode 100755
index 00000000..0140dac1
Binary files /dev/null and b/r17/Revamped src/Revamped QC/Primeqc4/monsters.qc differ
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/ogre.qc b/r17/Revamped src/Revamped QC/Primeqc4/ogre.qc
new file mode 100755
index 00000000..76993c18
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/ogre.qc
@@ -0,0 +1,452 @@
+/*
+==============================================================================
+
+OGRE
+
+==============================================================================
+*/
+
+$cd id1/models/ogre_c
+$origin 0 0 24
+$base base
+$skin base
+
+$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9
+
+$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7
+$frame walk8 walk9 walk10 walk11 walk12 walk13 walk14 walk15 walk16
+
+$frame run1 run2 run3 run4 run5 run6 run7 run8
+
+$frame swing1 swing2 swing3 swing4 swing5 swing6 swing7
+$frame swing8 swing9 swing10 swing11 swing12 swing13 swing14
+
+$frame smash1 smash2 smash3 smash4 smash5 smash6 smash7
+$frame smash8 smash9 smash10 smash11 smash12 smash13 smash14
+
+$frame shoot1 shoot2 shoot3 shoot4 shoot5 shoot6
+
+$frame pain1 pain2 pain3 pain4 pain5
+
+$frame painb1 painb2 painb3
+
+$frame painc1 painc2 painc3 painc4 painc5 painc6
+
+$frame paind1 paind2 paind3 paind4 paind5 paind6 paind7 paind8 paind9 paind10
+$frame paind11 paind12 paind13 paind14 paind15 paind16
+
+$frame paine1 paine2 paine3 paine4 paine5 paine6 paine7 paine8 paine9 paine10
+$frame paine11 paine12 paine13 paine14 paine15
+
+$frame death1 death2 death3 death4 death5 death6
+$frame death7 death8 death9 death10 death11 death12
+$frame death13 death14
+
+$frame bdeath1 bdeath2 bdeath3 bdeath4 bdeath5 bdeath6
+$frame bdeath7 bdeath8 bdeath9 bdeath10
+
+$frame pull1 pull2 pull3 pull4 pull5 pull6 pull7 pull8 pull9 pull10 pull11
+
+//=============================================================================
+
+
+void() OgreGrenadeExplode =
+{
+ T_RadiusDamage (self, self.owner, 40, world);
+ sound (self, CHAN_VOICE, "weapons/r_exp3.wav", 1, ATTN_NORM);
+
+ WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteByte (MSG_BROADCAST, TE_EXPLOSION);
+ WriteCoord (MSG_BROADCAST, self.origin_x);
+ WriteCoord (MSG_BROADCAST, self.origin_y);
+ WriteCoord (MSG_BROADCAST, self.origin_z);
+
+ self.velocity = '0 0 0';
+ self.touch = SUB_Null;
+ setmodel (self, "progs/s_explod.spr");
+ self.solid = SOLID_NOT;
+ s_explode1 ();
+};
+
+void() OgreGrenadeTouch =
+{
+ if (other == self.owner)
+ return; // don't explode on owner
+ if (other.takedamage == DAMAGE_AIM)
+ {
+ OgreGrenadeExplode();
+ return;
+ }
+ sound (self, CHAN_VOICE, "weapons/bounce.wav", 1, ATTN_NORM); // bounce sound
+ if (self.velocity == '0 0 0')
+ self.avelocity = '0 0 0';
+};
+
+/*
+================
+OgreFireGrenade
+================
+*/
+void() OgreFireGrenade =
+{
+ local entity missile;
+
+ self.effects = self.effects | EF_MUZZLEFLASH;
+
+ sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
+
+ missile = spawn ();
+ missile.owner = self;
+ missile.movetype = MOVETYPE_BOUNCE;
+ missile.solid = SOLID_BBOX;
+
+// set missile speed
+
+ makevectors (self.angles);
+
+ missile.velocity = normalize(self.enemy.origin - self.origin);
+ missile.velocity = missile.velocity * 600;
+ missile.velocity_z = 200;
+
+ missile.avelocity = '300 300 300';
+
+ missile.angles = vectoangles(missile.velocity);
+
+ missile.touch = OgreGrenadeTouch;
+
+// set missile duration
+ missile.nextthink = time + 2.5;
+ missile.think = OgreGrenadeExplode;
+
+ setmodel (missile, "progs/grenade.mdl");
+ setsize (missile, '0 0 0', '0 0 0');
+ setorigin (missile, self.origin);
+};
+
+
+//=============================================================================
+
+/*
+================
+chainsaw
+
+FIXME
+================
+*/
+void(float side) chainsaw =
+{
+local vector delta;
+local float ldmg;
+
+ if (!self.enemy)
+ return;
+ if (!CanDamage (self.enemy, self))
+ return;
+
+ ai_charge(10);
+
+ delta = self.enemy.origin - self.origin;
+
+ if (vlen(delta) > 100)
+ return;
+
+ ldmg = (random() + random() + random()) * 4;
+ T_Damage (self.enemy, self, self, ldmg);
+
+};
+
+
+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 (self, CHAN_VOICE, "ogre/ogidle.wav", 1, ATTN_IDLE);
+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();};
+
+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 (self, CHAN_VOICE, "ogre/ogidle.wav", 1, ATTN_IDLE);
+};
+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 (self, CHAN_VOICE, "ogre/ogdrag.wav", 1, ATTN_IDLE);
+};
+void() ogre_walk7 =[ $walk7, ogre_walk8 ] {ai_walk(3);};
+void() ogre_walk8 =[ $walk8, ogre_walk9 ] {ai_walk(2);};
+void() ogre_walk9 =[ $walk9, ogre_walk10 ] {ai_walk(3);};
+void() ogre_walk10 =[ $walk10, ogre_walk11 ] {ai_walk(1);};
+void() ogre_walk11 =[ $walk11, ogre_walk12 ] {ai_walk(2);};
+void() ogre_walk12 =[ $walk12, ogre_walk13 ] {ai_walk(3);};
+void() ogre_walk13 =[ $walk13, ogre_walk14 ] {ai_walk(3);};
+void() ogre_walk14 =[ $walk14, ogre_walk15 ] {ai_walk(3);};
+void() ogre_walk15 =[ $walk15, ogre_walk16 ] {ai_walk(3);};
+void() ogre_walk16 =[ $walk16, ogre_walk1 ] {ai_walk(4);};
+
+void() ogre_run1 =[ $run1, ogre_run2 ] {ai_run(9);
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "ogre/ogidle2.wav", 1, ATTN_IDLE);
+};
+void() ogre_run2 =[ $run2, ogre_run3 ] {ai_run(12);};
+void() ogre_run3 =[ $run3, ogre_run4 ] {ai_run(8);};
+void() ogre_run4 =[ $run4, ogre_run5 ] {ai_run(22);};
+void() ogre_run5 =[ $run5, ogre_run6 ] {ai_run(16);};
+void() ogre_run6 =[ $run6, ogre_run7 ] {ai_run(4);};
+void() ogre_run7 =[ $run7, ogre_run8 ] {ai_run(13);};
+void() ogre_run8 =[ $run8, ogre_run1 ] {ai_run(24);};
+
+void() ogre_swing1 =[ $swing1, ogre_swing2 ] {ai_charge(11);
+sound (self, CHAN_WEAPON, "ogre/ogsawatk.wav", 1, ATTN_NORM);
+};
+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); chainsaw(0);self.angles_y = self.angles_y + random()*25;};
+void() ogre_swing6 =[ $swing6, ogre_swing7 ] {chainsaw(200);self.angles_y = self.angles_y + random()* 25;};
+void() ogre_swing7 =[ $swing7, ogre_swing8 ] {chainsaw(0);self.angles_y = self.angles_y + random()* 25;};
+void() ogre_swing8 =[ $swing8, ogre_swing9 ] {chainsaw(0);self.angles_y = self.angles_y + random()* 25;};
+void() ogre_swing9 =[ $swing9, ogre_swing10 ] {chainsaw(0);self.angles_y = self.angles_y + random()* 25;};
+void() ogre_swing10 =[ $swing10, ogre_swing11 ] {chainsaw(-200);self.angles_y = self.angles_y + random()* 25;};
+void() ogre_swing11 =[ $swing11, ogre_swing12 ] {chainsaw(0);self.angles_y = self.angles_y + random()* 25;};
+void() ogre_swing12 =[ $swing12, ogre_swing13 ] {ai_charge(3);};
+void() ogre_swing13 =[ $swing13, ogre_swing14 ] {ai_charge(8);};
+void() ogre_swing14 =[ $swing14, ogre_run1 ] {ai_charge(9);};
+
+void() ogre_smash1 =[ $smash1, ogre_smash2 ] {ai_charge(6);
+sound (self, CHAN_WEAPON, "ogre/ogsawatk.wav", 1, ATTN_NORM);
+};
+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); chainsaw(0);};
+void() ogre_smash7 =[ $smash7, ogre_smash8 ] {ai_charge(4); chainsaw(0);};
+void() ogre_smash8 =[ $smash8, ogre_smash9 ] {ai_charge(10); chainsaw(0);};
+void() ogre_smash9 =[ $smash9, ogre_smash10 ] {ai_charge(13); chainsaw(0);};
+void() ogre_smash10 =[ $smash10, ogre_smash11 ] {chainsaw(1);};
+void() ogre_smash11 =[ $smash11, ogre_smash12 ] {ai_charge(2); chainsaw(0);
+self.nextthink = self.nextthink + random()*0.2;}; // slight variation
+void() ogre_smash12 =[ $smash12, ogre_smash13 ] {ai_charge(0);};
+void() ogre_smash13 =[ $smash13, ogre_smash14 ] {ai_charge(4);};
+void() ogre_smash14 =[ $smash14, ogre_run1 ] {ai_charge(12);};
+
+void() ogre_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();OgreFireGrenade();};
+void() ogre_nail5 =[ $shoot4, ogre_nail6 ] {ai_face();};
+void() ogre_nail6 =[ $shoot5, ogre_nail7 ] {ai_face();};
+void() ogre_nail7 =[ $shoot6, ogre_run1 ] {ai_face();};
+
+void() ogre_pain1 =[ $pain1, ogre_pain2 ] {};
+void() ogre_pain2 =[ $pain2, ogre_pain3 ] {};
+void() ogre_pain3 =[ $pain3, ogre_pain4 ] {};
+void() ogre_pain4 =[ $pain4, ogre_pain5 ] {};
+void() ogre_pain5 =[ $pain5, ogre_run1 ] {};
+
+
+void() ogre_painb1 =[ $painb1, ogre_painb2 ] {};
+void() ogre_painb2 =[ $painb2, ogre_painb3 ] {};
+void() ogre_painb3 =[ $painb3, ogre_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 ] {};
+
+
+void() ogre_paind1 =[ $paind1, ogre_paind2 ] {};
+void() ogre_paind2 =[ $paind2, ogre_paind3 ] {ai_pain(10);};
+void() ogre_paind3 =[ $paind3, ogre_paind4 ] {ai_pain(9);};
+void() ogre_paind4 =[ $paind4, ogre_paind5 ] {ai_pain(4);};
+void() ogre_paind5 =[ $paind5, ogre_paind6 ] {};
+void() ogre_paind6 =[ $paind6, ogre_paind7 ] {};
+void() ogre_paind7 =[ $paind7, ogre_paind8 ] {};
+void() ogre_paind8 =[ $paind8, ogre_paind9 ] {};
+void() ogre_paind9 =[ $paind9, ogre_paind10 ] {};
+void() ogre_paind10=[ $paind10, ogre_paind11 ] {};
+void() ogre_paind11=[ $paind11, ogre_paind12 ] {};
+void() ogre_paind12=[ $paind12, ogre_paind13 ] {};
+void() ogre_paind13=[ $paind13, ogre_paind14 ] {};
+void() ogre_paind14=[ $paind14, ogre_paind15 ] {};
+void() ogre_paind15=[ $paind15, ogre_paind16 ] {};
+void() ogre_paind16=[ $paind16, ogre_run1 ] {};
+
+void() ogre_paine1 =[ $paine1, ogre_paine2 ] {};
+void() ogre_paine2 =[ $paine2, ogre_paine3 ] {ai_pain(10);};
+void() ogre_paine3 =[ $paine3, ogre_paine4 ] {ai_pain(9);};
+void() ogre_paine4 =[ $paine4, ogre_paine5 ] {ai_pain(4);};
+void() ogre_paine5 =[ $paine5, ogre_paine6 ] {};
+void() ogre_paine6 =[ $paine6, ogre_paine7 ] {};
+void() ogre_paine7 =[ $paine7, ogre_paine8 ] {};
+void() ogre_paine8 =[ $paine8, ogre_paine9 ] {};
+void() ogre_paine9 =[ $paine9, ogre_paine10 ] {};
+void() ogre_paine10=[ $paine10, ogre_paine11 ] {};
+void() ogre_paine11=[ $paine11, ogre_paine12 ] {};
+void() ogre_paine12=[ $paine12, ogre_paine13 ] {};
+void() ogre_paine13=[ $paine13, ogre_paine14 ] {};
+void() ogre_paine14=[ $paine14, ogre_paine15 ] {};
+void() ogre_paine15=[ $paine15, ogre_run1 ] {};
+
+
+void(entity attacker, float damage) ogre_pain =
+{
+ local float r;
+
+// don't make multiple pain sounds right after each other
+ if (self.pain_finished > time)
+ return;
+
+ sound (self, CHAN_VOICE, "ogre/ogpain1.wav", 1, ATTN_NORM);
+
+ r = random();
+
+ if (r < 0.25)
+ {
+ ogre_pain1 ();
+ self.pain_finished = time + 1;
+ }
+ else if (r < 0.5)
+ {
+ ogre_painb1 ();
+ self.pain_finished = time + 1;
+ }
+ else if (r < 0.75)
+ {
+ ogre_painc1 ();
+ self.pain_finished = time + 1;
+ }
+ else if (r < 0.88)
+ {
+ ogre_paind1 ();
+ self.pain_finished = time + 2;
+ }
+ else
+ {
+ ogre_paine1 ();
+ self.pain_finished = time + 2;
+ }
+};
+
+void() ogre_die1 =[ $death1, ogre_die2 ] {};
+void() ogre_die2 =[ $death2, ogre_die3 ] {};
+void() ogre_die3 =[ $death3, ogre_die4 ]
+{self.solid = SOLID_NOT;
+self.ammo_rockets = 2;DropBackpack();};
+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 ] {};
+
+void() ogre_bdie1 =[ $bdeath1, ogre_bdie2 ] {};
+void() ogre_bdie2 =[ $bdeath2, ogre_bdie3 ] {ai_forward(5);};
+void() ogre_bdie3 =[ $bdeath3, ogre_bdie4 ]
+{self.solid = SOLID_NOT;
+self.ammo_rockets = 2;DropBackpack();};
+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 ] {};
+
+void() ogre_die =
+{
+// check for gib
+ if (self.health < -80)
+ {
+ sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
+ ThrowHead ("progs/h_ogre.mdl", self.health);
+ ThrowGib ("progs/gib3.mdl", self.health);
+ ThrowGib ("progs/gib3.mdl", self.health);
+ ThrowGib ("progs/gib3.mdl", self.health);
+ return;
+ }
+
+ sound (self, CHAN_VOICE, "ogre/ogdth.wav", 1, ATTN_NORM);
+
+ if (random() < 0.5)
+ ogre_die1 ();
+ else
+ ogre_bdie1 ();
+};
+
+void() ogre_melee =
+{
+ if (random() > 0.5)
+ ogre_smash1 ();
+ else
+ ogre_swing1 ();
+};
+
+
+/*QUAKED monster_ogre (1 0 0) (-32 -32 -24) (32 32 64) Ambush
+
+*/
+void() monster_ogre =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+ precache_model ("progs/ogre.mdl");
+ precache_model ("progs/h_ogre.mdl");
+ precache_model ("progs/grenade.mdl");
+
+ precache_sound ("ogre/ogdrag.wav");
+ precache_sound ("ogre/ogdth.wav");
+ precache_sound ("ogre/ogidle.wav");
+ precache_sound ("ogre/ogidle2.wav");
+ precache_sound ("ogre/ogpain1.wav");
+ precache_sound ("ogre/ogsawatk.wav");
+ precache_sound ("ogre/ogwake.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/ogre.mdl");
+
+ setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX);
+ self.health = 200;
+
+ self.th_stand = ogre_stand1;
+ self.th_walk = ogre_walk1;
+ self.th_run = ogre_run1;
+ self.th_die = ogre_die;
+ self.th_melee = ogre_melee;
+ self.th_missile = ogre_nail1;
+ self.th_pain = ogre_pain;
+
+ walkmonster_start();
+};
+
+void() monster_ogre_marksman =
+{
+ monster_ogre ();
+};
+
+
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/oldone.qc b/r17/Revamped src/Revamped QC/Primeqc4/oldone.qc
new file mode 100755
index 00000000..103d6fb2
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/oldone.qc
@@ -0,0 +1,283 @@
+/*
+==============================================================================
+
+OLD ONE
+
+==============================================================================
+*/
+$cd id1/models/old_one
+$origin 0 0 24
+$base base
+$skin skin
+$scale 1
+
+void() finale_1;
+void() finale_2;
+void() finale_3;
+void() finale_4;
+
+
+entity shub;
+
+$frame old1 old2 old3 old4 old5 old6 old7 old8 old9
+$frame old10 old11 old12 old13 old14 old15 old16 old17 old18 old19
+$frame old20 old21 old22 old23 old24 old25 old26 old27 old28 old29
+$frame old30 old31 old32 old33 old34 old35 old36 old37 old38 old39
+$frame old40 old41 old42 old43 old44 old45 old46
+
+$frame shake1 shake2 shake3 shake4 shake5 shake6 shake7 shake8
+$frame shake9 shake10 shake11 shake12 shake12 shake13 shake14
+$frame shake15 shake16 shake17 shake18 shake19 shake20
+
+//void() old_stand =[ $old1, old_stand ] {};
+
+void() old_idle1 =[ $old1, old_idle2 ] {};
+void() old_idle2 =[ $old2, old_idle3 ] {};
+void() old_idle3 =[ $old3, old_idle4 ] {};
+void() old_idle4 =[ $old4, old_idle5 ] {};
+void() old_idle5 =[ $old5, old_idle6 ] {};
+void() old_idle6 =[ $old6, old_idle7 ] {};
+void() old_idle7 =[ $old7, old_idle8 ] {};
+void() old_idle8 =[ $old8, old_idle9 ] {};
+void() old_idle9 =[ $old9, old_idle10 ] {};
+void() old_idle10 =[ $old10, old_idle11 ] {};
+void() old_idle11 =[ $old11, old_idle12 ] {};
+void() old_idle12 =[ $old12, old_idle13 ] {};
+void() old_idle13 =[ $old13, old_idle14 ] {};
+void() old_idle14 =[ $old14, old_idle15 ] {};
+void() old_idle15 =[ $old15, old_idle16 ] {};
+void() old_idle16 =[ $old16, old_idle17 ] {};
+void() old_idle17 =[ $old17, old_idle18 ] {};
+void() old_idle18 =[ $old18, old_idle19 ] {};
+void() old_idle19 =[ $old19, old_idle20 ] {};
+void() old_idle20 =[ $old20, old_idle21 ] {};
+void() old_idle21 =[ $old21, old_idle22 ] {};
+void() old_idle22 =[ $old22, old_idle23 ] {};
+void() old_idle23 =[ $old23, old_idle24 ] {};
+void() old_idle24 =[ $old24, old_idle25 ] {};
+void() old_idle25 =[ $old25, old_idle26 ] {};
+void() old_idle26 =[ $old26, old_idle27 ] {};
+void() old_idle27 =[ $old27, old_idle28 ] {};
+void() old_idle28 =[ $old28, old_idle29 ] {};
+void() old_idle29 =[ $old29, old_idle30 ] {};
+void() old_idle30 =[ $old30, old_idle31 ] {};
+void() old_idle31 =[ $old31, old_idle32 ] {};
+void() old_idle32 =[ $old32, old_idle33 ] {};
+void() old_idle33 =[ $old33, old_idle34 ] {};
+void() old_idle34 =[ $old34, old_idle35 ] {};
+void() old_idle35 =[ $old35, old_idle36 ] {};
+void() old_idle36 =[ $old36, old_idle37 ] {};
+void() old_idle37 =[ $old37, old_idle38 ] {};
+void() old_idle38 =[ $old38, old_idle39 ] {};
+void() old_idle39 =[ $old39, old_idle40 ] {};
+void() old_idle40 =[ $old40, old_idle41 ] {};
+void() old_idle41 =[ $old41, old_idle42 ] {};
+void() old_idle42 =[ $old42, old_idle43 ] {};
+void() old_idle43 =[ $old43, old_idle44 ] {};
+void() old_idle44 =[ $old44, old_idle45 ] {};
+void() old_idle45 =[ $old45, old_idle46 ] {};
+void() old_idle46 =[ $old46, old_idle1 ] {};
+
+
+void() old_thrash1 =[ $shake1, old_thrash2 ] {lightstyle(0, "m");};
+void() old_thrash2 =[ $shake2, old_thrash3 ] {lightstyle(0, "k");};
+void() old_thrash3 =[ $shake3, old_thrash4 ] {lightstyle(0, "k");};
+void() old_thrash4 =[ $shake4, old_thrash5 ] {lightstyle(0, "i");};
+void() old_thrash5 =[ $shake5, old_thrash6 ] {lightstyle(0, "g");};
+void() old_thrash6 =[ $shake6, old_thrash7 ] {lightstyle(0, "e");};
+void() old_thrash7 =[ $shake7, old_thrash8 ] {lightstyle(0, "c");};
+void() old_thrash8 =[ $shake8, old_thrash9 ] {lightstyle(0, "a");};
+void() old_thrash9 =[ $shake9, old_thrash10 ] {lightstyle(0, "c");};
+void() old_thrash10 =[ $shake10, old_thrash11 ] {lightstyle(0, "e");};
+void() old_thrash11 =[ $shake11, old_thrash12 ] {lightstyle(0, "g");};
+void() old_thrash12 =[ $shake12, old_thrash13 ] {lightstyle(0, "i");};
+void() old_thrash13 =[ $shake13, old_thrash14 ] {lightstyle(0, "k");};
+void() old_thrash14 =[ $shake14, old_thrash15 ] {lightstyle(0, "m");};
+void() old_thrash15 =[ $shake15, old_thrash16 ] {lightstyle(0, "m");
+self.cnt = self.cnt + 1;
+if (self.cnt != 3)
+ self.think = old_thrash1;
+};
+void() old_thrash16 =[ $shake16, old_thrash17 ] {lightstyle(0, "g");};
+void() old_thrash17 =[ $shake17, old_thrash18 ] {lightstyle(0, "c");};
+void() old_thrash18 =[ $shake18, old_thrash19 ] {lightstyle(0, "b");};
+void() old_thrash19 =[ $shake19, old_thrash20 ] {lightstyle(0, "a");};
+void() old_thrash20 =[ $shake20, old_thrash20 ] {finale_4();};
+
+//============================================================================
+
+void() finale_1 =
+{
+ local entity pos, pl;
+ local entity timer;
+
+ intermission_exittime = time + 10000000; // never allow exit
+ intermission_running = 1;
+
+ // find the intermission spot
+ pos = find (world, classname, "info_intermission");
+ if (!pos)
+ error ("no info_intermission");
+ pl = find (world, classname, "misc_teleporttrain");
+ if (!pl)
+ error ("no teleporttrain");
+ remove (pl);
+
+ WriteByte (MSG_ALL, SVC_FINALE);
+ WriteString (MSG_ALL, "");
+
+ pl = find (world, classname, "player");
+ while (pl != world)
+ {
+ pl.view_ofs = '0 0 0';
+ pl.angles = other.v_angle = pos.mangle;
+ pl.fixangle = TRUE; // turn this way immediately
+ pl.map = self.map;
+ pl.nextthink = time + 0.5;
+ pl.takedamage = DAMAGE_NO;
+ pl.solid = SOLID_NOT;
+ pl.movetype = MOVETYPE_NONE;
+ pl.modelindex = 0;
+ setorigin (pl, pos.origin);
+ pl = find (pl, classname, "player");
+ }
+
+ // make fake versions of all players as standins, and move the real
+ // players to the intermission spot
+
+ // wait for 1 second
+ timer = spawn();
+ timer.nextthink = time + 1;
+ timer.think = finale_2;
+};
+
+void() finale_2 =
+{
+ local vector o;
+
+ // start a teleport splash inside shub
+
+ o = shub.origin - '0 100 0';
+ WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteByte (MSG_BROADCAST, TE_TELEPORT);
+ WriteCoord (MSG_BROADCAST, o_x);
+ WriteCoord (MSG_BROADCAST, o_y);
+ WriteCoord (MSG_BROADCAST, o_z);
+
+ sound (shub, CHAN_VOICE, "misc/r_tele1.wav", 1, ATTN_NORM);
+
+ self.nextthink = time + 2;
+ self.think = finale_3;
+};
+
+void() finale_3 =
+{
+ // start shub thrashing wildly
+ shub.think = old_thrash1;
+ sound (shub, CHAN_VOICE, "boss2/death.wav", 1, ATTN_NORM);
+ lightstyle(0, "abcdefghijklmlkjihgfedcb");
+};
+
+void() finale_4 =
+{
+ // throw tons of meat chunks
+ local vector oldo;
+ local float x, y, z;
+ local float r;
+ local entity n;
+
+ sound (self, CHAN_VOICE, "boss2/pop2.wav", 1, ATTN_NORM);
+
+ oldo = self.origin;
+
+ z = 16;
+ while (z <= 144)
+ {
+ x = -64;
+ while (x <= 64)
+ {
+ y = -64;
+ while (y <= 64)
+ {
+ self.origin_x = oldo_x + x;
+ self.origin_y = oldo_y + y;
+ self.origin_z = oldo_z + z;
+
+ r = random();
+ if (r < 0.3)
+ ThrowGib ("progs/gib1.mdl", -999);
+ else if (r < 0.6)
+ ThrowGib ("progs/gib2.mdl", -999);
+ else
+ ThrowGib ("progs/gib3.mdl", -999);
+ y = y + 32;
+ }
+ x = x + 32;
+ }
+ z = z + 96;
+ }
+ // start the end text
+ WriteByte (MSG_ALL, SVC_FINALE);
+ WriteString (MSG_ALL, "Congratulations and well done! You have\nbeaten the hideous Shub-Niggurath, and\nher hundreds of ugly changelings and\nmonsters. You have proven that your\nskill and your cunning are greater than\nall the powers of Quake. You are the\nmaster now. Id Software salutes you.");
+
+// put a player model down
+ n = spawn();
+ setmodel (n, "progs/player.mdl");
+ oldo = oldo - '32 264 0';
+ setorigin (n, oldo);
+ n.angles = '0 290 0';
+ n.frame = 1;
+
+ remove (self);
+
+// switch cd track
+ WriteByte (MSG_ALL, SVC_CDTRACK);
+ WriteByte (MSG_ALL, 3);
+ WriteByte (MSG_ALL, 3);
+ lightstyle(0, "m");
+};
+
+//============================================================================
+
+void () nopain =
+{
+ self.health = 40000;
+};
+
+//============================================================================
+
+
+/*QUAKED monster_oldone (1 0 0) (-16 -16 -24) (16 16 32)
+*/
+void() monster_oldone =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+
+ precache_model2 ("progs/oldone.mdl");
+
+ precache_sound2 ("boss2/death.wav");
+ precache_sound2 ("boss2/idle.wav");
+ precache_sound2 ("boss2/sight.wav");
+ precache_sound2 ("boss2/pop2.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/oldone.mdl");
+ setsize (self, '-160 -128 -24', '160 128 256');
+
+ self.health = 40000; // kill by telefrag
+ self.think = old_idle1;
+ self.nextthink = time + 0.1;
+ self.takedamage = DAMAGE_YES;
+ self.th_pain = nopain;
+ self.th_die = finale_1;
+ shub = self;
+
+ total_monsters = total_monsters + 1;
+};
+
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/plats.qc b/r17/Revamped src/Revamped QC/Primeqc4/plats.qc
new file mode 100755
index 00000000..ffd7ae2c
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/plats.qc
@@ -0,0 +1,362 @@
+
+
+void() plat_center_touch;
+void() plat_outside_touch;
+void() plat_trigger_use;
+void() plat_go_up;
+void() plat_go_down;
+void() plat_crush;
+float PLAT_LOW_TRIGGER = 1;
+
+void() plat_spawn_inside_trigger =
+{
+ local entity trigger;
+ local vector tmin, tmax;
+
+//
+// middle trigger
+//
+ trigger = spawn();
+ trigger.touch = plat_center_touch;
+ trigger.movetype = MOVETYPE_NONE;
+ trigger.solid = SOLID_TRIGGER;
+ trigger.enemy = self;
+
+ tmin = self.mins + '25 25 0';
+ tmax = self.maxs - '25 25 -8';
+ tmin_z = tmax_z - (self.pos1_z - self.pos2_z + 8);
+ if (self.spawnflags & PLAT_LOW_TRIGGER)
+ tmax_z = tmin_z + 8;
+
+ if (self.size_x <= 50)
+ {
+ tmin_x = (self.mins_x + self.maxs_x) / 2;
+ tmax_x = tmin_x + 1;
+ }
+ if (self.size_y <= 50)
+ {
+ tmin_y = (self.mins_y + self.maxs_y) / 2;
+ tmax_y = tmin_y + 1;
+ }
+
+ setsize (trigger, tmin, tmax);
+};
+
+void() plat_hit_top =
+{
+ sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
+ self.state = STATE_TOP;
+ self.think = plat_go_down;
+ self.nextthink = self.ltime + 3;
+};
+
+void() plat_hit_bottom =
+{
+ sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
+ self.state = STATE_BOTTOM;
+};
+
+void() plat_go_down =
+{
+ sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
+ self.state = STATE_DOWN;
+ SUB_CalcMove (self.pos2, self.speed, plat_hit_bottom);
+};
+
+void() plat_go_up =
+{
+ sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
+ self.state = STATE_UP;
+ SUB_CalcMove (self.pos1, self.speed, plat_hit_top);
+};
+
+void() plat_center_touch =
+{
+ if (other.classname != "player")
+ return;
+
+ if (other.health <= 0)
+ return;
+
+ self = self.enemy;
+ if (self.state == STATE_BOTTOM)
+ plat_go_up ();
+ else if (self.state == STATE_TOP)
+ self.nextthink = self.ltime + 1; // delay going down
+};
+
+void() plat_outside_touch =
+{
+ if (other.classname != "player")
+ return;
+
+ if (other.health <= 0)
+ return;
+
+//dprint ("plat_outside_touch\n");
+ self = self.enemy;
+ if (self.state == STATE_TOP)
+ plat_go_down ();
+};
+
+void() plat_trigger_use =
+{
+ if (self.think)
+ return; // allready activated
+ plat_go_down();
+};
+
+
+void() plat_crush =
+{
+//dprint ("plat_crush\n");
+
+ T_Damage (other, self, self, 1);
+
+ if (self.state == STATE_UP)
+ plat_go_down ();
+ else if (self.state == STATE_DOWN)
+ plat_go_up ();
+ else
+ objerror ("plat_crush: bad self.state\n");
+};
+
+void() plat_use =
+{
+ self.use = SUB_Null;
+ if (self.state != STATE_UP)
+ objerror ("plat_use: not in up state");
+ plat_go_down();
+};
+
+
+/*QUAKED func_plat (0 .5 .8) ? PLAT_LOW_TRIGGER
+speed default 150
+
+Plats are always drawn in the extended position, so they will light correctly.
+
+If the plat is the target of another trigger or button, it will start out disabled in the extended position until it is trigger, when it will lower and become a normal plat.
+
+If the "height" key is set, that will determine the amount the plat moves, instead of being implicitly determined by the model's height.
+Set "sounds" to one of the following:
+1) base fast
+2) chain slow
+*/
+
+
+void() func_plat =
+
+{
+ if (!self.t_length)
+ self.t_length = 80;
+ if (!self.t_width)
+ self.t_width = 10;
+
+ if (self.sounds == 0)
+ self.sounds = 2;
+// FIX THIS TO LOAD A GENERIC PLAT SOUND
+
+ if (self.sounds == 1)
+ {
+ precache_sound ("plats/plat1.wav");
+ precache_sound ("plats/plat2.wav");
+ self.noise = "plats/plat1.wav";
+ self.noise1 = "plats/plat2.wav";
+ }
+
+ if (self.sounds == 2)
+ {
+ precache_sound ("plats/medplat1.wav");
+ precache_sound ("plats/medplat2.wav");
+ self.noise = "plats/medplat1.wav";
+ self.noise1 = "plats/medplat2.wav";
+ }
+
+
+ self.mangle = self.angles;
+ self.angles = '0 0 0';
+
+ self.classname = "plat";
+ self.solid = SOLID_BSP;
+ self.movetype = MOVETYPE_PUSH;
+ setorigin (self, self.origin);
+ setmodel (self, self.model);
+ setsize (self, self.mins , self.maxs);
+
+ self.blocked = plat_crush;
+ if (!self.speed)
+ self.speed = 150;
+
+// pos1 is the top position, pos2 is the bottom
+ self.pos1 = self.origin;
+ self.pos2 = self.origin;
+ if (self.height)
+ self.pos2_z = self.origin_z - self.height;
+ else
+ self.pos2_z = self.origin_z - self.size_z + 8;
+
+ self.use = plat_trigger_use;
+
+ plat_spawn_inside_trigger (); // the "start moving" trigger
+
+ if (self.targetname)
+ {
+ self.state = STATE_UP;
+ self.use = plat_use;
+ }
+ else
+ {
+ setorigin (self, self.pos2);
+ self.state = STATE_BOTTOM;
+ }
+};
+
+//============================================================================
+
+void() train_next;
+void() func_train_find;
+
+void() train_blocked =
+{
+ if (time < self.attack_finished)
+ return;
+ self.attack_finished = time + 0.5;
+ T_Damage (other, self, self, self.dmg);
+};
+void() train_use =
+{
+ if (self.think != func_train_find)
+ return; // already activated
+ train_next();
+};
+
+void() train_wait =
+{
+ if (self.wait)
+ {
+ self.nextthink = self.ltime + self.wait;
+ sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
+ }
+ else
+ self.nextthink = self.ltime + 0.1;
+
+ self.think = train_next;
+};
+
+void() train_next =
+{
+ local entity targ;
+
+ targ = find (world, targetname, self.target);
+ self.target = targ.target;
+ if (!self.target)
+ objerror ("train_next: no next target");
+ if (targ.wait)
+ self.wait = targ.wait;
+ else
+ self.wait = 0;
+ sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
+ SUB_CalcMove (targ.origin - self.mins, self.speed, train_wait);
+};
+
+void() func_train_find =
+
+{
+ local entity targ;
+
+ targ = find (world, targetname, self.target);
+ self.target = targ.target;
+ setorigin (self, targ.origin - self.mins);
+ if (!self.targetname)
+ { // not triggered, so start immediately
+ self.nextthink = self.ltime + 0.1;
+ self.think = train_next;
+ }
+};
+
+/*QUAKED func_train (0 .5 .8) ?
+Trains are moving platforms that players can ride.
+The targets origin specifies the min point of the train at each corner.
+The train spawns at the first target it is pointing at.
+If the train is the target of a button or trigger, it will not begin moving until activated.
+speed default 100
+dmg default 2
+sounds
+1) ratchet metal
+
+*/
+void() func_train =
+{
+ if (!self.speed)
+ self.speed = 100;
+ if (!self.target)
+ objerror ("func_train without a target");
+ if (!self.dmg)
+ self.dmg = 2;
+
+ if (self.sounds == 0)
+ {
+ self.noise = ("misc/null.wav");
+ precache_sound ("misc/null.wav");
+ self.noise1 = ("misc/null.wav");
+ precache_sound ("misc/null.wav");
+ }
+
+ if (self.sounds == 1)
+ {
+ self.noise = ("plats/train2.wav");
+ precache_sound ("plats/train2.wav");
+ self.noise1 = ("plats/train1.wav");
+ precache_sound ("plats/train1.wav");
+ }
+
+ self.cnt = 1;
+ self.solid = SOLID_BSP;
+ self.movetype = MOVETYPE_PUSH;
+ self.blocked = train_blocked;
+ self.use = train_use;
+ self.classname = "train";
+
+ setmodel (self, self.model);
+ setsize (self, self.mins , self.maxs);
+ setorigin (self, self.origin);
+
+// start trains on the second frame, to make sure their targets have had
+// a chance to spawn
+ self.nextthink = self.ltime + 0.1;
+ self.think = func_train_find;
+};
+
+/*QUAKED misc_teleporttrain (0 .5 .8) (-8 -8 -8) (8 8 8)
+This is used for the final bos
+*/
+void() misc_teleporttrain =
+{
+ if (!self.speed)
+ self.speed = 100;
+ if (!self.target)
+ objerror ("func_train without a target");
+
+ self.cnt = 1;
+ self.solid = SOLID_NOT;
+ self.movetype = MOVETYPE_PUSH;
+ self.blocked = train_blocked;
+ self.use = train_use;
+ self.avelocity = '100 200 300';
+
+ self.noise = ("misc/null.wav");
+ precache_sound ("misc/null.wav");
+ self.noise1 = ("misc/null.wav");
+ precache_sound ("misc/null.wav");
+
+ precache_model2 ("progs/teleport.mdl");
+ setmodel (self, "progs/teleport.mdl");
+ setsize (self, self.mins , self.maxs);
+ setorigin (self, self.origin);
+
+// start trains on the second frame, to make sure their targets have had
+// a chance to spawn
+ self.nextthink = self.ltime + 0.1;
+ self.think = func_train_find;
+};
+
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/player.qc b/r17/Revamped src/Revamped QC/Primeqc4/player.qc
new file mode 100755
index 00000000..3cdd1b45
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/player.qc
@@ -0,0 +1,618 @@
+
+void() bubble_bob;
+
+/*
+==============================================================================
+
+PLAYER
+
+==============================================================================
+*/
+
+$cd id1/models/player_4
+$origin 0 -6 24
+$base base
+$skin skin
+
+//
+// running
+//
+$frame axrun1 axrun2 axrun3 axrun4 axrun5 axrun6
+
+$frame rockrun1 rockrun2 rockrun3 rockrun4 rockrun5 rockrun6
+
+//
+// standing
+//
+$frame stand1 stand2 stand3 stand4 stand5
+
+$frame axstnd1 axstnd2 axstnd3 axstnd4 axstnd5 axstnd6
+$frame axstnd7 axstnd8 axstnd9 axstnd10 axstnd11 axstnd12
+
+
+//
+// pain
+//
+$frame axpain1 axpain2 axpain3 axpain4 axpain5 axpain6
+
+$frame pain1 pain2 pain3 pain4 pain5 pain6
+
+
+//
+// death
+//
+
+$frame axdeth1 axdeth2 axdeth3 axdeth4 axdeth5 axdeth6
+$frame axdeth7 axdeth8 axdeth9
+
+$frame deatha1 deatha2 deatha3 deatha4 deatha5 deatha6 deatha7 deatha8
+$frame deatha9 deatha10 deatha11
+
+$frame deathb1 deathb2 deathb3 deathb4 deathb5 deathb6 deathb7 deathb8
+$frame deathb9
+
+$frame deathc1 deathc2 deathc3 deathc4 deathc5 deathc6 deathc7 deathc8
+$frame deathc9 deathc10 deathc11 deathc12 deathc13 deathc14 deathc15
+
+$frame deathd1 deathd2 deathd3 deathd4 deathd5 deathd6 deathd7
+$frame deathd8 deathd9
+
+$frame deathe1 deathe2 deathe3 deathe4 deathe5 deathe6 deathe7
+$frame deathe8 deathe9
+
+//
+// attacks
+//
+$frame nailatt1 nailatt2
+
+$frame light1 light2
+
+$frame rockatt1 rockatt2 rockatt3 rockatt4 rockatt5 rockatt6
+
+$frame shotatt1 shotatt2 shotatt3 shotatt4 shotatt5 shotatt6
+
+$frame axatt1 axatt2 axatt3 axatt4 axatt5 axatt6
+
+$frame axattb1 axattb2 axattb3 axattb4 axattb5 axattb6
+
+$frame axattc1 axattc2 axattc3 axattc4 axattc5 axattc6
+
+$frame axattd1 axattd2 axattd3 axattd4 axattd5 axattd6
+
+
+/*
+==============================================================================
+PLAYER
+==============================================================================
+*/
+
+void() player_run;
+
+void() player_stand1 =[ $axstnd1, player_stand1 ]
+{
+ self.weaponframe=0;
+ if (self.velocity_x || self.velocity_y)
+ {
+ self.walkframe=0;
+ player_run();
+ return;
+ }
+ else
+ {
+ if (self.walkframe >= 5)
+ self.walkframe = 0;
+ self.frame = $stand1 + self.walkframe;
+ }
+ self.walkframe = self.walkframe + 1;
+};
+
+void() player_run =[ $rockrun1, player_run ]
+{
+local float r;
+r = random();
+//THis is a HUGE check. I wonder if It is Memory Consuming at all.
+if (checkbottom(self) == TRUE && self.flags & FL_ONGROUND && self.walkframe == 1 || self.walkframe == 4 && self.mballset == 0 && vlen(self.velocity) > 145 && !self.weapon == IT_MORPHBALL)
+{
+if (r >= 0.33)
+ sound (self, CHAN_AUTO, "steps/foot1.wav", 0.5, ATTN_NORM);
+else if (r >= 0.66)
+ sound (self, CHAN_AUTO, "steps/foot2.wav", 0.5, ATTN_NORM);
+if (r >= 0.99)
+ sound (self, CHAN_AUTO, "steps/foot3.wav", 0.5, ATTN_NORM);
+else
+ sound (self, CHAN_AUTO, "steps/foot4.wav", 0.5, ATTN_NORM);
+}
+
+ self.weaponframe=0;
+ if (!self.velocity_x && !self.velocity_y)
+
+ {
+ self.walkframe=0;
+ player_stand1();
+ return;
+ }
+ else
+ {
+ if (self.walkframe == 6)
+ self.walkframe = 0;
+ self.frame = self.frame + self.walkframe;
+ }
+ self.walkframe = self.walkframe + 1;
+};
+
+
+void() player_shot1 = [$shotatt1, player_shot2 ] {self.weaponframe=1;
+self.effects = self.effects | EF_MUZZLEFLASH;};
+void() player_shot2 = [$shotatt2, player_shot3 ] {self.weaponframe=2;};
+void() player_shot3 = [$shotatt3, player_shot4 ] {self.weaponframe=3;};
+void() player_shot4 = [$shotatt4, player_shot5 ] {self.weaponframe=4;};
+void() player_shot5 = [$shotatt5, player_shot6 ] {self.weaponframe=5;};
+void() player_shot6 = [$shotatt6, player_run ] {self.weaponframe=6;};
+
+void() player_axe1 = [$axatt1, player_axe2 ] {self.weaponframe=1;};
+void() player_axe2 = [$axatt2, player_axe3 ] {self.weaponframe=2;};
+void() player_axe3 = [$axatt3, player_axe4 ] {self.weaponframe=3;W_FireAxe();};
+void() player_axe4 = [$axatt4, player_run ] {self.weaponframe=4;};
+
+void() player_axeb1 = [$axattb1, player_axeb2 ] {self.weaponframe=5;};
+void() player_axeb2 = [$axattb2, player_axeb3 ] {self.weaponframe=6;};
+void() player_axeb3 = [$axattb3, player_axeb4 ] {self.weaponframe=7;W_FireAxe();};
+void() player_axeb4 = [$axattb4, player_run ] {self.weaponframe=8;};
+
+void() player_axec1 = [$axattc1, player_axec2 ] {self.weaponframe=1;};
+void() player_axec2 = [$axattc2, player_axec3 ] {self.weaponframe=2;};
+void() player_axec3 = [$axattc3, player_axec4 ] {self.weaponframe=3;W_FireAxe();};
+void() player_axec4 = [$axattc4, player_run ] {self.weaponframe=4;};
+
+void() player_axed1 = [$axattd1, player_axed2 ] {self.weaponframe=5;};
+void() player_axed2 = [$axattd2, player_axed3 ] {self.weaponframe=6;};
+void() player_axed3 = [$axattd3, player_axed4 ] {self.weaponframe=7;W_FireAxe();};
+void() player_axed4 = [$axattd4, player_run ] {self.weaponframe=8;};
+
+
+//============================================================================
+
+void() player_nail1 =[$nailatt1, player_nail2 ]
+{
+ self.effects = self.effects | EF_MUZZLEFLASH;
+
+ if (!self.button0)
+ {player_run ();return;}
+ self.weaponframe = self.weaponframe + 1;
+ if (self.weaponframe == 9)
+ self.weaponframe = 1;
+ SuperDamageSound();
+ W_FireSpikes (4);
+ self.attack_finished = time + 0.2;
+};
+void() player_nail2 =[$nailatt2, player_nail1 ]
+{
+ self.effects = self.effects | EF_MUZZLEFLASH;
+
+ if (!self.button0)
+ {player_run ();return;}
+ self.weaponframe = self.weaponframe + 1;
+ if (self.weaponframe == 9)
+ self.weaponframe = 1;
+ SuperDamageSound();
+ W_FireSpikes (-4);
+ self.attack_finished = time + 0.2;
+};
+
+//============================================================================
+
+void() player_light1 =[$light1, player_light2 ]
+{
+ self.effects = self.effects | EF_MUZZLEFLASH;
+
+ if (!self.button0)
+ {player_run ();return;}
+ self.weaponframe = self.weaponframe + 1;
+ if (self.weaponframe == 5)
+ self.weaponframe = 1;
+ SuperDamageSound();
+ W_FireLightning();
+ self.attack_finished = time + 0.2;
+};
+void() player_light2 =[$light2, player_light1 ]
+{
+ self.effects = self.effects | EF_MUZZLEFLASH;
+
+ if (!self.button0)
+ {player_run ();return;}
+ self.weaponframe = self.weaponframe + 1;
+ if (self.weaponframe == 5)
+ self.weaponframe = 1;
+ SuperDamageSound();
+ W_FireLightning();
+ self.attack_finished = time + 0.2;
+};
+
+//============================================================================
+
+
+void() player_rocket1 =[$rockatt1, player_rocket2 ] {self.weaponframe=1;
+self.effects = self.effects | EF_MUZZLEFLASH;};
+void() player_rocket2 =[$rockatt2, player_rocket3 ] {self.weaponframe=2;};
+void() player_rocket3 =[$rockatt3, player_rocket4 ] {self.weaponframe=3;};
+void() player_rocket4 =[$rockatt4, player_rocket5 ] {self.weaponframe=4;};
+void() player_rocket5 =[$rockatt5, player_rocket6 ] {self.weaponframe=5;};
+void() player_rocket6 =[$rockatt6, player_run ] {self.weaponframe=6;};
+void(float num_bubbles) DeathBubbles;
+
+void() PainSound =
+{
+//local float rs;
+
+ if (self.health < 0)
+ return;
+
+ if (damage_attacker.classname == "teledeath")
+ {
+ sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
+ return;
+ }
+// slime pain sounds
+ if (self.watertype == CONTENT_SLIME)
+ {
+// FIX ME put in some steam here
+ if (random() > 0.5)
+ sound (self, CHAN_VOICE, "player/lburn1.wav", 1, ATTN_NORM);
+ else
+ sound (self, CHAN_VOICE, "player/lburn2.wav", 1, ATTN_NORM);
+ return;
+ }
+ /*
+ if (self.watertype == CONTENT_LAVA)
+ {
+ if (random() > 0.5)
+ sound (self, CHAN_VOICE, "player/lburn1.wav", 1, ATTN_NORM);
+ else
+ sound (self, CHAN_VOICE, "player/lburn2.wav", 1, ATTN_NORM);
+ return;
+ }
+ */
+
+ if (self.pain_finished > time)
+ {
+ self.axhitme = 0;
+ return;
+ }
+ self.pain_finished = time + 0.5;
+
+// don't make multiple pain sounds right after each other
+
+
+ /*
+ rs = rint((random() * 5) + 1);
+
+ self.noise = "";
+ if (rs == 1)
+ self.noise = "player/pain1.wav";
+ else if (rs == 2)
+ self.noise = "player/pain2.wav";
+ else if (rs == 3)
+ self.noise = "player/pain3.wav";
+ else if (rs == 4)
+ self.noise = "player/pain4.wav";
+ else if (rs == 5)
+ self.noise = "player/pain5.wav";
+ else
+ self.noise = "player/pain6.wav";
+
+ sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
+ return;
+ */
+};
+
+void() player_pain1 = [ $pain1, player_pain2 ] {PainSound();self.weaponframe=0;};
+void() player_pain2 = [ $pain2, player_pain3 ] {};
+void() player_pain3 = [ $pain3, player_pain4 ] {};
+void() player_pain4 = [ $pain4, player_pain5 ] {};
+void() player_pain5 = [ $pain5, player_pain6 ] {};
+void() player_pain6 = [ $pain6, player_run ] {};
+
+void() player_axpain1 = [ $axpain1, player_axpain2 ] {PainSound();self.weaponframe=0;};
+void() player_axpain2 = [ $axpain2, player_axpain3 ] {};
+void() player_axpain3 = [ $axpain3, player_axpain4 ] {};
+void() player_axpain4 = [ $axpain4, player_axpain5 ] {};
+void() player_axpain5 = [ $axpain5, player_axpain6 ] {};
+void() player_axpain6 = [ $axpain6, player_run ] {};
+
+void() player_pain =
+{
+ if (self.weaponframe)
+ return;
+
+ if (self.invisible_finished > time)
+ return; // eyes don't have pain frames
+ player_pain1 ();
+};
+
+void() player_diea1;
+void() player_dieb1;
+void() player_diec1;
+void() player_died1;
+void() player_diee1;
+void() DeathBubblesSpawn =
+{
+local entity bubble;
+ if (self.owner.waterlevel != 3)
+ return;
+ bubble = spawn();
+ setmodel (bubble, "progs/s_bubble.spr");
+ setorigin (bubble, self.owner.origin + '0 0 24');
+ bubble.movetype = MOVETYPE_NOCLIP;
+ bubble.solid = SOLID_NOT;
+ bubble.velocity = '0 0 15';
+ bubble.nextthink = time + 0.5;
+ bubble.think = bubble_bob;
+ bubble.classname = "bubble";
+ bubble.frame = 0;
+ bubble.cnt = 0;
+ setsize (bubble, '-8 -8 -8', '8 8 8');
+ self.nextthink = time + 0.1;
+ self.think = DeathBubblesSpawn;
+ self.air_finished = self.air_finished + 1;
+ if (self.air_finished >= self.bubble_count)
+ remove(self);
+};
+
+void(float num_bubbles) DeathBubbles =
+{
+local entity bubble_spawner;
+
+ bubble_spawner = spawn();
+ setorigin (bubble_spawner, self.origin);
+ bubble_spawner.movetype = MOVETYPE_NONE;
+ bubble_spawner.solid = SOLID_NOT;
+ bubble_spawner.nextthink = time + 0.1;
+ bubble_spawner.think = DeathBubblesSpawn;
+ bubble_spawner.air_finished = 0;
+ bubble_spawner.owner = self;
+ bubble_spawner.bubble_count = num_bubbles;
+ return;
+};
+
+
+void() DeathSound =
+{
+local float rs;
+
+ // water death sounds
+ if (self.waterlevel == 3)
+ {
+ DeathBubbles(20);
+ sound (self, CHAN_VOICE, "player/h2odeath.wav", 1, ATTN_NONE);
+ return;
+ }
+
+ rs = rint ((random() * 4) + 1);
+ if (rs == 1)
+ self.noise = "player/death1.wav";
+ if (rs == 2)
+ self.noise = "player/death2.wav";
+ if (rs == 3)
+ self.noise = "player/death3.wav";
+ if (rs == 4)
+ self.noise = "player/death4.wav";
+ if (rs == 5)
+ self.noise = "player/death5.wav";
+
+ sound (self, CHAN_VOICE, self.noise, 1, ATTN_NONE);
+ return;
+};
+
+
+void() PlayerDead =
+{
+ self.nextthink = -1;
+// allow respawn after a certain time
+ self.deadflag = DEAD_DEAD;
+};
+
+vector(float dm) VelocityForDamage =
+{
+ local vector v;
+
+ v_x = 100 * crandom();
+ v_y = 100 * crandom();
+ v_z = 200 + 100 * random();
+
+ if (dm > -50)
+ {
+// dprint ("level 1\n");
+ v = v * 0.7;
+ }
+ else if (dm > -200)
+ {
+// dprint ("level 3\n");
+ v = v * 2;
+ }
+ else
+ v = v * 10;
+
+ return v;
+};
+
+void(string gibname, float dm) ThrowGib =
+{
+ local entity new;
+
+ new = spawn();
+ new.origin = self.origin;
+ setmodel (new, gibname);
+ setsize (new, '0 0 0', '0 0 0');
+ new.velocity = VelocityForDamage (dm);
+ new.movetype = MOVETYPE_BOUNCE;
+ new.solid = SOLID_NOT;
+ new.avelocity_x = random()*600;
+ new.avelocity_y = random()*600;
+ new.avelocity_z = random()*600;
+ new.think = SUB_Remove;
+ new.ltime = time;
+ new.nextthink = time + 10 + random()*10;
+ new.frame = 0;
+ new.flags = 0;
+};
+
+void(string gibname, float dm) ThrowHead =
+{
+ setmodel (self, gibname);
+ self.frame = 0;
+ self.nextthink = -1;
+ self.movetype = MOVETYPE_BOUNCE;
+ self.takedamage = DAMAGE_NO;
+ self.solid = SOLID_NOT;
+ self.view_ofs = '0 0 8';
+ setsize (self, '-16 -16 0', '16 16 56');
+ self.velocity = VelocityForDamage (dm);
+ self.origin_z = self.origin_z - 24;
+ self.flags = self.flags - (self.flags & FL_ONGROUND);
+ self.avelocity = crandom() * '0 600 0';
+};
+
+
+void() GibPlayer =
+{
+ ThrowHead ("progs/h_player.mdl", self.health);
+ ThrowGib ("progs/gib1.mdl", self.health);
+ ThrowGib ("progs/gib2.mdl", self.health);
+ ThrowGib ("progs/gib3.mdl", self.health);
+
+ self.deadflag = DEAD_DEAD;
+
+ if (damage_attacker.classname == "teledeath")
+ {
+ sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
+ return;
+ }
+
+ if (damage_attacker.classname == "teledeath2")
+ {
+ sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
+ return;
+ }
+
+ if (random() < 0.5)
+ sound (self, CHAN_VOICE, "player/gib.wav", 1, ATTN_NONE);
+ else
+ sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NONE);
+};
+
+void() PlayerDie =
+{
+ local float i;
+
+ self.items = self.items - (self.items & IT_INVISIBILITY);
+ self.invisible_finished = 0; // don't die as eyes
+ self.invincible_finished = 0;
+ self.super_damage_finished = 0;
+ self.radsuit_finished = 0;
+ self.modelindex = modelindex_player; // don't use eyes
+ body(self.origin);
+ if (self.mballset == 1)
+ self.mballset = 0;
+
+ self.weaponmodel="";
+ self.view_ofs = '0 0 -8';
+ self.deadflag = DEAD_DYING;
+ self.solid = SOLID_NOT;
+ self.flags = self.flags - (self.flags & FL_ONGROUND);
+ self.movetype = MOVETYPE_TOSS;
+ if (self.velocity_z < 10)
+ self.velocity_z = self.velocity_z + random()*300;
+
+
+ DeathSound();
+
+ self.angles_x = 0;
+ self.angles_z = 0;
+
+ i = cvar("temp1");
+ if (!i)
+ i = 1 + floor(random()*6);
+
+ if (i == 1)
+ player_diea1();
+ else if (i == 2)
+ player_dieb1();
+ else if (i == 3)
+ player_diec1();
+ else if (i == 4)
+ player_died1();
+ else
+ player_diee1();
+
+};
+
+void() set_suicide_frame =
+{ // used by klill command and diconnect command
+ if (self.model != "progs/player.mdl")
+ return; // allready gibbed
+ self.frame = $deatha11;
+ self.solid = SOLID_NOT;
+ self.movetype = MOVETYPE_TOSS;
+ self.deadflag = DEAD_DEAD;
+ self.nextthink = -1;
+};
+
+
+void() player_diea1 = [ $deatha1, player_diea2 ] {};
+void() player_diea2 = [ $deatha2, player_diea3 ] {};
+void() player_diea3 = [ $deatha3, player_diea4 ] {};
+void() player_diea4 = [ $deatha4, player_diea5 ] {};
+void() player_diea5 = [ $deatha5, player_diea6 ] {};
+void() player_diea6 = [ $deatha6, player_diea7 ] {};
+void() player_diea7 = [ $deatha7, player_diea8 ] {};
+void() player_diea8 = [ $deatha8, player_diea9 ] {};
+void() player_diea9 = [ $deatha9, player_diea10 ] {};
+void() player_diea10 = [ $deatha10, player_diea11 ] {};
+void() player_diea11 = [ $deatha11, player_diea11 ] {PlayerDead();};
+
+void() player_dieb1 = [ $deathb1, player_dieb2 ] {};
+void() player_dieb2 = [ $deathb2, player_dieb3 ] {};
+void() player_dieb3 = [ $deathb3, player_dieb4 ] {};
+void() player_dieb4 = [ $deathb4, player_dieb5 ] {};
+void() player_dieb5 = [ $deathb5, player_dieb6 ] {};
+void() player_dieb6 = [ $deathb6, player_dieb7 ] {};
+void() player_dieb7 = [ $deathb7, player_dieb8 ] {};
+void() player_dieb8 = [ $deathb8, player_dieb9 ] {};
+void() player_dieb9 = [ $deathb9, player_dieb9 ] {PlayerDead();};
+
+void() player_diec1 = [ $deathc1, player_diec2 ] {};
+void() player_diec2 = [ $deathc2, player_diec3 ] {};
+void() player_diec3 = [ $deathc3, player_diec4 ] {};
+void() player_diec4 = [ $deathc4, player_diec5 ] {};
+void() player_diec5 = [ $deathc5, player_diec6 ] {};
+void() player_diec6 = [ $deathc6, player_diec7 ] {};
+void() player_diec7 = [ $deathc7, player_diec8 ] {};
+void() player_diec8 = [ $deathc8, player_diec9 ] {};
+void() player_diec9 = [ $deathc9, player_diec10 ] {};
+void() player_diec10 = [ $deathc10, player_diec11 ] {};
+void() player_diec11 = [ $deathc11, player_diec12 ] {};
+void() player_diec12 = [ $deathc12, player_diec13 ] {};
+void() player_diec13 = [ $deathc13, player_diec14 ] {};
+void() player_diec14 = [ $deathc14, player_diec15 ] {};
+void() player_diec15 = [ $deathc15, player_diec15 ] {PlayerDead();};
+
+void() player_died1 = [ $deathd1, player_died2 ] {};
+void() player_died2 = [ $deathd2, player_died3 ] {};
+void() player_died3 = [ $deathd3, player_died4 ] {};
+void() player_died4 = [ $deathd4, player_died5 ] {};
+void() player_died5 = [ $deathd5, player_died6 ] {};
+void() player_died6 = [ $deathd6, player_died7 ] {};
+void() player_died7 = [ $deathd7, player_died8 ] {};
+void() player_died8 = [ $deathd8, player_died9 ] {};
+void() player_died9 = [ $deathd9, player_died9 ] {PlayerDead();};
+
+void() player_diee1 = [ $deathe1, player_diee2 ] {};
+void() player_diee2 = [ $deathe2, player_diee3 ] {};
+void() player_diee3 = [ $deathe3, player_diee4 ] {};
+void() player_diee4 = [ $deathe4, player_diee5 ] {};
+void() player_diee5 = [ $deathe5, player_diee6 ] {};
+void() player_diee6 = [ $deathe6, player_diee7 ] {};
+void() player_diee7 = [ $deathe7, player_diee8 ] {};
+void() player_diee8 = [ $deathe8, player_diee9 ] {};
+void() player_diee9 = [ $deathe9, player_diee9 ] {PlayerDead();};
+
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/primedefs.qc b/r17/Revamped src/Revamped QC/Primeqc4/primedefs.qc
new file mode 100755
index 00000000..114ee3e3
Binary files /dev/null and b/r17/Revamped src/Revamped QC/Primeqc4/primedefs.qc differ
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/progdefs.h b/r17/Revamped src/Revamped QC/Primeqc4/progdefs.h
new file mode 100755
index 00000000..c976cf8e
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/progdefs.h
@@ -0,0 +1,143 @@
+
+/* file generated by qcc, do not modify */
+
+typedef struct
+{ int pad[28];
+ int self;
+ int other;
+ int world;
+ float time;
+ float frametime;
+ float force_retouch;
+ string_t mapname;
+ float deathmatch;
+ float coop;
+ float teamplay;
+ float serverflags;
+ float total_secrets;
+ float total_monsters;
+ float found_secrets;
+ float killed_monsters;
+ float parm1;
+ float parm2;
+ float parm3;
+ float parm4;
+ float parm5;
+ float parm6;
+ float parm7;
+ float parm8;
+ float parm9;
+ float parm10;
+ float parm11;
+ float parm12;
+ float parm13;
+ float parm14;
+ float parm15;
+ float parm16;
+ vec3_t v_forward;
+ vec3_t v_up;
+ vec3_t v_right;
+ float trace_allsolid;
+ float trace_startsolid;
+ float trace_fraction;
+ vec3_t trace_endpos;
+ vec3_t trace_plane_normal;
+ float trace_plane_dist;
+ int trace_ent;
+ float trace_inopen;
+ float trace_inwater;
+ int msg_entity;
+ func_t main;
+ func_t StartFrame;
+ func_t PlayerPreThink;
+ func_t PlayerPostThink;
+ func_t ClientKill;
+ func_t ClientConnect;
+ func_t PutClientInServer;
+ func_t ClientDisconnect;
+ func_t SetNewParms;
+ func_t SetChangeParms;
+} globalvars_t;
+
+typedef struct
+{
+ float modelindex;
+ vec3_t absmin;
+ vec3_t absmax;
+ float ltime;
+ float movetype;
+ float solid;
+ vec3_t origin;
+ vec3_t oldorigin;
+ vec3_t velocity;
+ vec3_t angles;
+ vec3_t avelocity;
+ vec3_t punchangle;
+ string_t classname;
+ string_t model;
+ float frame;
+ float skin;
+ float effects;
+ vec3_t mins;
+ vec3_t maxs;
+ vec3_t size;
+ func_t touch;
+ func_t use;
+ func_t think;
+ func_t blocked;
+ float nextthink;
+ int groundentity;
+ float health;
+ float frags;
+ float weapon;
+ string_t weaponmodel;
+ float weaponframe;
+ float currentammo;
+ float ammo_shells;
+ float ammo_nails;
+ float ammo_rockets;
+ float ammo_cells;
+ float items;
+ float takedamage;
+ int chain;
+ float deadflag;
+ vec3_t view_ofs;
+ float button0;
+ float button1;
+ float button2;
+ float impulse;
+ float fixangle;
+ vec3_t v_angle;
+ float idealpitch;
+ string_t netname;
+ int enemy;
+ float flags;
+ float colormap;
+ float team;
+ float max_health;
+ float teleport_time;
+ float armortype;
+ float armorvalue;
+ float waterlevel;
+ float watertype;
+ float ideal_yaw;
+ float yaw_speed;
+ int aiment;
+ int goalentity;
+ float spawnflags;
+ string_t target;
+ string_t targetname;
+ float dmg_take;
+ float dmg_save;
+ int dmg_inflictor;
+ int owner;
+ vec3_t movedir;
+ string_t message;
+ float sounds;
+ string_t noise;
+ string_t noise1;
+ string_t noise2;
+ string_t noise3;
+} entvars_t;
+
+#define PROGHEADER_CRC 5927
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/progs.src b/r17/Revamped src/Revamped QC/Primeqc4/progs.src
new file mode 100755
index 00000000..4383bd8a
Binary files /dev/null and b/r17/Revamped src/Revamped QC/Primeqc4/progs.src differ
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/shalrath.qc b/r17/Revamped src/Revamped QC/Primeqc4/shalrath.qc
new file mode 100755
index 00000000..adf821ab
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/shalrath.qc
@@ -0,0 +1,239 @@
+/*
+==============================================================================
+
+SHAL-RATH
+
+==============================================================================
+*/
+$cd id1/models/shalrath
+$origin 0 0 24
+$base base
+$skin skin
+$scale 0.7
+
+$frame attack1 attack2 attack3 attack4 attack5 attack6 attack7 attack8
+$frame attack9 attack10 attack11
+
+$frame pain1 pain2 pain3 pain4 pain5
+
+$frame death1 death2 death3 death4 death5 death6 death7
+
+$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9 walk10
+$frame walk11 walk12
+
+void() shalrath_pain;
+void() ShalMissile;
+void() shal_stand =[ $walk1, shal_stand ] {ai_stand();};
+
+void() shal_walk1 =[ $walk2, shal_walk2 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "shalrath/idle.wav", 1, ATTN_IDLE);
+ai_walk(6);};
+void() shal_walk2 =[ $walk3, shal_walk3 ] {ai_walk(4);};
+void() shal_walk3 =[ $walk4, shal_walk4 ] {ai_walk(0);};
+void() shal_walk4 =[ $walk5, shal_walk5 ] {ai_walk(0);};
+void() shal_walk5 =[ $walk6, shal_walk6 ] {ai_walk(0);};
+void() shal_walk6 =[ $walk7, shal_walk7 ] {ai_walk(0);};
+void() shal_walk7 =[ $walk8, shal_walk8 ] {ai_walk(5);};
+void() shal_walk8 =[ $walk9, shal_walk9 ] {ai_walk(6);};
+void() shal_walk9 =[ $walk10, shal_walk10 ] {ai_walk(5);};
+void() shal_walk10 =[ $walk11, shal_walk11 ] {ai_walk(0);};
+void() shal_walk11 =[ $walk12, shal_walk12 ] {ai_walk(4);};
+void() shal_walk12 =[ $walk1, shal_walk1 ] {ai_walk(5);};
+
+void() shal_run1 =[ $walk2, shal_run2 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "shalrath/idle.wav", 1, ATTN_IDLE);
+ai_run(6);};
+void() shal_run2 =[ $walk3, shal_run3 ] {ai_run(4);};
+void() shal_run3 =[ $walk4, shal_run4 ] {ai_run(0);};
+void() shal_run4 =[ $walk5, shal_run5 ] {ai_run(0);};
+void() shal_run5 =[ $walk6, shal_run6 ] {ai_run(0);};
+void() shal_run6 =[ $walk7, shal_run7 ] {ai_run(0);};
+void() shal_run7 =[ $walk8, shal_run8 ] {ai_run(5);};
+void() shal_run8 =[ $walk9, shal_run9 ] {ai_run(6);};
+void() shal_run9 =[ $walk10, shal_run10 ] {ai_run(5);};
+void() shal_run10 =[ $walk11, shal_run11 ] {ai_run(0);};
+void() shal_run11 =[ $walk12, shal_run12 ] {ai_run(4);};
+void() shal_run12 =[ $walk1, shal_run1 ] {ai_run(5);};
+
+void() shal_attack1 =[ $attack1, shal_attack2 ] {
+sound (self, CHAN_VOICE, "shalrath/attack.wav", 1, ATTN_NORM);
+ai_face();
+};
+void() shal_attack2 =[ $attack2, shal_attack3 ] {ai_face();};
+void() shal_attack3 =[ $attack3, shal_attack4 ] {ai_face();};
+void() shal_attack4 =[ $attack4, shal_attack5 ] {ai_face();};
+void() shal_attack5 =[ $attack5, shal_attack6 ] {ai_face();};
+void() shal_attack6 =[ $attack6, shal_attack7 ] {ai_face();};
+void() shal_attack7 =[ $attack7, shal_attack8 ] {ai_face();};
+void() shal_attack8 =[ $attack8, shal_attack9 ] {ai_face();};
+void() shal_attack9 =[ $attack9, shal_attack10 ] {ShalMissile();};
+void() shal_attack10 =[ $attack10, shal_attack11 ] {ai_face();};
+void() shal_attack11 =[ $attack11, shal_run1 ] {};
+
+void() shal_pain1 =[ $pain1, shal_pain2 ] {};
+void() shal_pain2 =[ $pain2, shal_pain3 ] {};
+void() shal_pain3 =[ $pain3, shal_pain4 ] {};
+void() shal_pain4 =[ $pain4, shal_pain5 ] {};
+void() shal_pain5 =[ $pain5, shal_run1 ] {};
+
+void() shal_death1 =[ $death1, shal_death2 ] {};
+void() shal_death2 =[ $death2, shal_death3 ] {};
+void() shal_death3 =[ $death3, shal_death4 ] {};
+void() shal_death4 =[ $death4, shal_death5 ] {};
+void() shal_death5 =[ $death5, shal_death6 ] {};
+void() shal_death6 =[ $death6, shal_death7 ] {};
+void() shal_death7 =[ $death7, shal_death7 ] {};
+
+
+void() shalrath_pain =
+{
+ if (self.pain_finished > time)
+ return;
+
+ sound (self, CHAN_VOICE, "shalrath/pain.wav", 1, ATTN_NORM);
+ shal_pain1();
+ self.pain_finished = time + 3;
+};
+
+void() shalrath_die =
+{
+// check for gib
+ if (self.health < -90)
+ {
+ sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
+ ThrowHead ("progs/h_shal.mdl", self.health);
+ ThrowGib ("progs/gib1.mdl", self.health);
+ ThrowGib ("progs/gib2.mdl", self.health);
+ ThrowGib ("progs/gib3.mdl", self.health);
+ return;
+ }
+
+ sound (self, CHAN_VOICE, "shalrath/death.wav", 1, ATTN_NORM);
+ shal_death1();
+ self.solid = SOLID_NOT;
+ // insert death sounds here
+};
+
+/*
+================
+ShalMissile
+================
+*/
+void() ShalMissileTouch;
+void() ShalHome;
+void() ShalMissile =
+{
+ local entity missile;
+ local vector dir;
+ local float dist, flytime;
+
+ dir = normalize((self.enemy.origin + '0 0 10') - self.origin);
+ dist = vlen (self.enemy.origin - self.origin);
+ flytime = dist * 0.002;
+ if (flytime < 0.1)
+ flytime = 0.1;
+
+ self.effects = self.effects | EF_MUZZLEFLASH;
+ sound (self, CHAN_WEAPON, "shalrath/attack2.wav", 1, ATTN_NORM);
+
+ missile = spawn ();
+ missile.owner = self;
+
+ missile.solid = SOLID_BBOX;
+ missile.movetype = MOVETYPE_FLYMISSILE;
+ setmodel (missile, "progs/v_spike.mdl");
+
+ setsize (missile, '0 0 0', '0 0 0');
+
+ missile.origin = self.origin + '0 0 10';
+ missile.velocity = dir * 400;
+ missile.avelocity = '300 300 300';
+ missile.nextthink = flytime + time;
+ missile.think = ShalHome;
+ missile.enemy = self.enemy;
+ missile.touch = ShalMissileTouch;
+};
+
+void() ShalHome =
+{
+ local vector dir, vtemp;
+ vtemp = self.enemy.origin + '0 0 10';
+ if (self.enemy.health < 1)
+ {
+ remove(self);
+ return;
+ }
+ dir = normalize(vtemp - self.origin);
+ if (skill == 3)
+ self.velocity = dir * 350;
+ else
+ self.velocity = dir * 250;
+ self.nextthink = time + 0.2;
+ self.think = ShalHome;
+};
+
+void() ShalMissileTouch =
+{
+ if (other == self.owner)
+ return; // don't explode on owner
+
+ if (other.classname == "monster_zombie")
+ T_Damage (other, self, self, 110);
+ T_RadiusDamage (self, self.owner, 40, world);
+ sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
+
+ WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteByte (MSG_BROADCAST, TE_EXPLOSION);
+ WriteCoord (MSG_BROADCAST, self.origin_x);
+ WriteCoord (MSG_BROADCAST, self.origin_y);
+ WriteCoord (MSG_BROADCAST, self.origin_z);
+
+ self.velocity = '0 0 0';
+ self.touch = SUB_Null;
+ setmodel (self, "progs/s_explod.spr");
+ self.solid = SOLID_NOT;
+ s_explode1 ();
+};
+
+//=================================================================
+
+/*QUAKED monster_shalrath (1 0 0) (-32 -32 -24) (32 32 48) Ambush
+*/
+void() monster_shalrath =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+ precache_model2 ("progs/shalrath.mdl");
+ precache_model2 ("progs/h_shal.mdl");
+ precache_model2 ("progs/v_spike.mdl");
+
+ precache_sound2 ("shalrath/attack.wav");
+ precache_sound2 ("shalrath/attack2.wav");
+ precache_sound2 ("shalrath/death.wav");
+ precache_sound2 ("shalrath/idle.wav");
+ precache_sound2 ("shalrath/pain.wav");
+ precache_sound2 ("shalrath/sight.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/shalrath.mdl");
+ setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX);
+ self.health = 400;
+
+ self.th_stand = shal_stand;
+ self.th_walk = shal_walk1;
+ self.th_run = shal_run1;
+ self.th_die = shalrath_die;
+ self.th_pain = shalrath_pain;
+ self.th_missile = shal_attack1;
+
+ self.think = walkmonster_start;
+ self.nextthink = time + 0.1 + random ()*0.1;
+
+};
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/shambler.qc b/r17/Revamped src/Revamped QC/Primeqc4/shambler.qc
new file mode 100755
index 00000000..4bd8a969
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/shambler.qc
@@ -0,0 +1,360 @@
+/*
+==============================================================================
+
+SHAMBLER
+
+==============================================================================
+*/
+
+$cd id1/models/shams
+$origin 0 0 24
+$base base
+$skin base
+
+$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9
+$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 smash1 smash2 smash3 smash4 smash5 smash6 smash7
+$frame smash8 smash9 smash10 smash11 smash12
+
+$frame swingr1 swingr2 swingr3 swingr4 swingr5
+$frame swingr6 swingr7 swingr8 swingr9
+
+$frame swingl1 swingl2 swingl3 swingl4 swingl5
+$frame swingl6 swingl7 swingl8 swingl9
+
+$frame magic1 magic2 magic3 magic4 magic5
+$frame magic6 magic7 magic8 magic9 magic10 magic11 magic12
+
+$frame pain1 pain2 pain3 pain4 pain5 pain6
+
+$frame death1 death2 death3 death4 death5 death6
+$frame death7 death8 death9 death10 death11
+
+void() sham_stand1 =[ $stand1, sham_stand2 ] {ai_stand();};
+void() sham_stand2 =[ $stand2, sham_stand3 ] {ai_stand();};
+void() sham_stand3 =[ $stand3, sham_stand4 ] {ai_stand();};
+void() sham_stand4 =[ $stand4, sham_stand5 ] {ai_stand();};
+void() sham_stand5 =[ $stand5, sham_stand6 ] {ai_stand();};
+void() sham_stand6 =[ $stand6, sham_stand7 ] {ai_stand();};
+void() sham_stand7 =[ $stand7, sham_stand8 ] {ai_stand();};
+void() sham_stand8 =[ $stand8, sham_stand9 ] {ai_stand();};
+void() sham_stand9 =[ $stand9, sham_stand10] {ai_stand();};
+void() sham_stand10 =[ $stand10, sham_stand11] {ai_stand();};
+void() sham_stand11 =[ $stand11, sham_stand12] {ai_stand();};
+void() sham_stand12 =[ $stand12, sham_stand13] {ai_stand();};
+void() sham_stand13 =[ $stand13, sham_stand14] {ai_stand();};
+void() sham_stand14 =[ $stand14, sham_stand15] {ai_stand();};
+void() sham_stand15 =[ $stand15, sham_stand16] {ai_stand();};
+void() sham_stand16 =[ $stand16, sham_stand17] {ai_stand();};
+void() sham_stand17 =[ $stand17, sham_stand1 ] {ai_stand();};
+
+void() sham_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 (self, CHAN_VOICE, "shambler/sidle.wav", 1, ATTN_IDLE);};
+
+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 (self, CHAN_VOICE, "shambler/sidle.wav", 1, ATTN_IDLE);
+};
+
+void() sham_smash1 =[ $smash1, sham_smash2 ] {
+sound (self, CHAN_VOICE, "shambler/melee1.wav", 1, ATTN_NORM);
+ai_charge(2);};
+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 (!self.enemy)
+ return;
+ ai_charge(0);
+
+ delta = self.enemy.origin - self.origin;
+
+ if (vlen(delta) > 100)
+ return;
+ if (!CanDamage (self.enemy, self))
+ return;
+
+ ldmg = (random() + random() + random()) * 40;
+ T_Damage (self.enemy, self, self, ldmg);
+ sound (self, CHAN_VOICE, "shambler/smack.wav", 1, ATTN_NORM);
+
+};
+void() sham_smash11 =[ $smash11, sham_smash12 ] {ai_charge(5);};
+void() sham_smash12 =[ $smash12, sham_run1 ] {ai_charge(4);};
+
+void() sham_swingr1;
+
+void(float side) ShamClaw =
+{
+local vector delta;
+local float ldmg;
+
+ if (!self.enemy)
+ return;
+ ai_charge(10);
+
+ delta = self.enemy.origin - self.origin;
+
+ if (vlen(delta) > 100)
+ return;
+
+ ldmg = (random() + random() + random()) * 20;
+ T_Damage (self.enemy, self, self, ldmg);
+ sound (self, CHAN_VOICE, "shambler/smack.wav", 1, ATTN_NORM);
+
+};
+
+void() sham_swingl1 =[ $swingl1, sham_swingl2 ] {
+sound (self, CHAN_VOICE, "shambler/melee2.wav", 1, ATTN_NORM);
+ai_charge(5);};
+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); ShamClaw(250);};
+void() sham_swingl8 =[ $swingl8, sham_swingl9 ] {ai_charge(4);};
+void() sham_swingl9 =[ $swingl9, sham_run1 ] {
+ai_charge(8);
+if (random()<0.5)
+ self.think = sham_swingr1;
+};
+
+void() sham_swingr1 =[ $swingr1, sham_swingr2 ] {
+sound (self, CHAN_VOICE, "shambler/melee1.wav", 1, ATTN_NORM);
+ai_charge(1);};
+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); ShamClaw(-250);};
+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)
+ self.think = sham_swingl1;
+};
+
+void() sham_melee =
+{
+ local float chance;
+
+ chance = random();
+ if (chance > 0.6 || self.health == 600)
+ sham_smash1 ();
+ else if (chance > 0.3)
+ sham_swingr1 ();
+ else
+ sham_swingl1 ();
+};
+
+
+//============================================================================
+
+void() CastLightning =
+{
+ local vector org, dir;
+
+ self.effects = self.effects | EF_MUZZLEFLASH;
+
+ ai_face ();
+
+ org = self.origin + '0 0 40';
+
+ dir = self.enemy.origin + '0 0 16' - org;
+ dir = normalize (dir);
+
+ traceline (org, self.origin + dir*600, TRUE, self);
+
+ WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteByte (MSG_BROADCAST, TE_LIGHTNING1);
+ WriteEntity (MSG_BROADCAST, self);
+ WriteCoord (MSG_BROADCAST, org_x);
+ WriteCoord (MSG_BROADCAST, org_y);
+ WriteCoord (MSG_BROADCAST, org_z);
+ WriteCoord (MSG_BROADCAST, trace_endpos_x);
+ WriteCoord (MSG_BROADCAST, trace_endpos_y);
+ WriteCoord (MSG_BROADCAST, trace_endpos_z);
+
+ LightningDamage (org, trace_endpos, self, 10);
+};
+
+void() sham_magic1 =[ $magic1, sham_magic2 ] {ai_face();
+ sound (self, CHAN_WEAPON, "shambler/sattck1.wav", 1, ATTN_NORM);
+};
+void() sham_magic2 =[ $magic2, sham_magic3 ] {ai_face();};
+void() sham_magic3 =[ $magic3, sham_magic4 ] {ai_face();self.nextthink = self.nextthink + 0.2;
+local entity o;
+
+self.effects = self.effects | EF_MUZZLEFLASH;
+ai_face();
+self.owner = spawn();
+o = self.owner;
+setmodel (o, "progs/s_light.mdl");
+setorigin (o, self.origin);
+o.angles = self.angles;
+o.nextthink = time + 0.7;
+o.think = SUB_Remove;
+};
+void() sham_magic4 =[ $magic4, sham_magic5 ]
+{
+self.effects = self.effects | EF_MUZZLEFLASH;
+self.owner.frame = 1;
+};
+void() sham_magic5 =[ $magic5, sham_magic6 ]
+{
+self.effects = self.effects | EF_MUZZLEFLASH;
+self.owner.frame = 2;
+};
+void() sham_magic6 =[ $magic6, sham_magic9 ]
+{
+remove (self.owner);
+CastLightning();
+sound (self, CHAN_WEAPON, "shambler/sboom.wav", 1, ATTN_NORM);
+};
+void() sham_magic9 =[ $magic9, sham_magic10 ]
+{CastLightning();};
+void() sham_magic10 =[ $magic10, sham_magic11 ]
+{CastLightning();};
+void() sham_magic11 =[ $magic11, sham_magic12 ]
+{
+if (skill == 3)
+ CastLightning();
+};
+void() sham_magic12 =[ $magic12, sham_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 ] {};
+
+void(entity attacker, float damage) sham_pain =
+{
+ sound (self, CHAN_VOICE, "shambler/shurt2.wav", 1, ATTN_NORM);
+
+ if (self.health <= 0)
+ return; // allready dying, don't go into pain frame
+
+ if (random()*400 > damage)
+ return; // didn't flinch
+
+ if (self.pain_finished > time)
+ return;
+ self.pain_finished = time + 2;
+
+ sham_pain1 ();
+};
+
+
+//============================================================================
+
+void() sham_death1 =[ $death1, sham_death2 ] {};
+void() sham_death2 =[ $death2, sham_death3 ] {};
+void() sham_death3 =[ $death3, sham_death4 ] {self.solid = SOLID_NOT;};
+void() sham_death4 =[ $death4, sham_death5 ] {};
+void() sham_death5 =[ $death5, sham_death6 ] {};
+void() sham_death6 =[ $death6, sham_death7 ] {};
+void() sham_death7 =[ $death7, sham_death8 ] {};
+void() sham_death8 =[ $death8, sham_death9 ] {};
+void() sham_death9 =[ $death9, sham_death10 ] {};
+void() sham_death10 =[ $death10, sham_death11 ] {};
+void() sham_death11 =[ $death11, sham_death11 ] {};
+
+void() sham_die =
+{
+// check for gib
+ if (self.health < -60)
+ {
+ sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
+ ThrowHead ("progs/h_shams.mdl", self.health);
+ ThrowGib ("progs/gib1.mdl", self.health);
+ ThrowGib ("progs/gib2.mdl", self.health);
+ ThrowGib ("progs/gib3.mdl", self.health);
+ return;
+ }
+
+// regular death
+ sound (self, CHAN_VOICE, "shambler/sdeath.wav", 1, ATTN_NORM);
+ sham_death1 ();
+};
+
+//============================================================================
+
+
+/*QUAKED monster_shambler (1 0 0) (-32 -32 -24) (32 32 64) Ambush
+*/
+void() monster_shambler =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+ precache_model ("progs/shambler.mdl");
+ precache_model ("progs/s_light.mdl");
+ precache_model ("progs/h_shams.mdl");
+ precache_model ("progs/bolt.mdl");
+
+ precache_sound ("shambler/sattck1.wav");
+ precache_sound ("shambler/sboom.wav");
+ precache_sound ("shambler/sdeath.wav");
+ precache_sound ("shambler/shurt2.wav");
+ precache_sound ("shambler/sidle.wav");
+ precache_sound ("shambler/ssight.wav");
+ precache_sound ("shambler/melee1.wav");
+ precache_sound ("shambler/melee2.wav");
+ precache_sound ("shambler/smack.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+ setmodel (self, "progs/shambler.mdl");
+
+ setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX);
+ self.health = 600;
+
+ self.th_stand = sham_stand1;
+ self.th_walk = sham_walk1;
+ self.th_run = sham_run1;
+ self.th_die = sham_die;
+ self.th_melee = sham_melee;
+ self.th_missile = sham_magic1;
+ self.th_pain = sham_pain;
+
+ walkmonster_start();
+};
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/soldier.qc b/r17/Revamped src/Revamped QC/Primeqc4/soldier.qc
new file mode 100755
index 00000000..f1632f54
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/soldier.qc
@@ -0,0 +1,284 @@
+/*
+==============================================================================
+
+SOLDIER / PLAYER
+
+==============================================================================
+*/
+
+$cd id1/models/soldier3
+$origin 0 -6 24
+$base base
+$skin skin
+
+$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8
+
+$frame death1 death2 death3 death4 death5 death6 death7 death8
+$frame death9 death10
+
+$frame deathc1 deathc2 deathc3 deathc4 deathc5 deathc6 deathc7 deathc8
+$frame deathc9 deathc10 deathc11
+
+$frame load1 load2 load3 load4 load5 load6 load7 load8 load9 load10 load11
+
+$frame pain1 pain2 pain3 pain4 pain5 pain6
+
+$frame painb1 painb2 painb3 painb4 painb5 painb6 painb7 painb8 painb9 painb10
+$frame painb11 painb12 painb13 painb14
+
+$frame painc1 painc2 painc3 painc4 painc5 painc6 painc7 painc8 painc9 painc10
+$frame painc11 painc12 painc13
+
+$frame run1 run2 run3 run4 run5 run6 run7 run8
+
+$frame shoot1 shoot2 shoot3 shoot4 shoot5 shoot6 shoot7 shoot8 shoot9
+
+$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
+
+/*
+==============================================================================
+SOLDIER CODE
+==============================================================================
+*/
+
+void() army_fire;
+
+void() army_stand1 =[ $stand1, army_stand2 ] {ai_stand();};
+void() army_stand2 =[ $stand2, army_stand3 ] {ai_stand();};
+void() army_stand3 =[ $stand3, army_stand4 ] {ai_stand();};
+void() army_stand4 =[ $stand4, army_stand5 ] {ai_stand();};
+void() army_stand5 =[ $stand5, army_stand6 ] {ai_stand();};
+void() army_stand6 =[ $stand6, army_stand7 ] {ai_stand();};
+void() army_stand7 =[ $stand7, army_stand8 ] {ai_stand();};
+void() army_stand8 =[ $stand8, army_stand1 ] {ai_stand();};
+
+void() army_walk1 =[ $prowl_1, army_walk2 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "soldier/idle.wav", 1, ATTN_IDLE);
+ai_walk(1);};
+void() army_walk2 =[ $prowl_2, army_walk3 ] {ai_walk(1);};
+void() army_walk3 =[ $prowl_3, army_walk4 ] {ai_walk(1);};
+void() army_walk4 =[ $prowl_4, army_walk5 ] {ai_walk(1);};
+void() army_walk5 =[ $prowl_5, army_walk6 ] {ai_walk(2);};
+void() army_walk6 =[ $prowl_6, army_walk7 ] {ai_walk(3);};
+void() army_walk7 =[ $prowl_7, army_walk8 ] {ai_walk(4);};
+void() army_walk8 =[ $prowl_8, army_walk9 ] {ai_walk(4);};
+void() army_walk9 =[ $prowl_9, army_walk10 ] {ai_walk(2);};
+void() army_walk10 =[ $prowl_10, army_walk11 ] {ai_walk(2);};
+void() army_walk11 =[ $prowl_11, army_walk12 ] {ai_walk(2);};
+void() army_walk12 =[ $prowl_12, army_walk13 ] {ai_walk(1);};
+void() army_walk13 =[ $prowl_13, army_walk14 ] {ai_walk(0);};
+void() army_walk14 =[ $prowl_14, army_walk15 ] {ai_walk(1);};
+void() army_walk15 =[ $prowl_15, army_walk16 ] {ai_walk(1);};
+void() army_walk16 =[ $prowl_16, army_walk17 ] {ai_walk(1);};
+void() army_walk17 =[ $prowl_17, army_walk18 ] {ai_walk(3);};
+void() army_walk18 =[ $prowl_18, army_walk19 ] {ai_walk(3);};
+void() army_walk19 =[ $prowl_19, army_walk20 ] {ai_walk(3);};
+void() army_walk20 =[ $prowl_20, army_walk21 ] {ai_walk(3);};
+void() army_walk21 =[ $prowl_21, army_walk22 ] {ai_walk(2);};
+void() army_walk22 =[ $prowl_22, army_walk23 ] {ai_walk(1);};
+void() army_walk23 =[ $prowl_23, army_walk24 ] {ai_walk(1);};
+void() army_walk24 =[ $prowl_24, army_walk1 ] {ai_walk(1);};
+
+void() army_run1 =[ $run1, army_run2 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "soldier/idle.wav", 1, ATTN_IDLE);
+ai_run(11);};
+void() army_run2 =[ $run2, army_run3 ] {ai_run(15);};
+void() army_run3 =[ $run3, army_run4 ] {ai_run(10);};
+void() army_run4 =[ $run4, army_run5 ] {ai_run(10);};
+void() army_run5 =[ $run5, army_run6 ] {ai_run(8);};
+void() army_run6 =[ $run6, army_run7 ] {ai_run(15);};
+void() army_run7 =[ $run7, army_run8 ] {ai_run(10);};
+void() army_run8 =[ $run8, army_run1 ] {ai_run(8);};
+
+void() army_atk1 =[ $shoot1, army_atk2 ] {ai_face();};
+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 =[ $shoot5, army_atk6 ] {ai_face();army_fire();
+self.effects = self.effects | EF_MUZZLEFLASH;};
+void() army_atk6 =[ $shoot6, army_atk7 ] {ai_face();};
+void() army_atk7 =[ $shoot7, army_atk8 ] {ai_face();SUB_CheckRefire (army_atk1);};
+void() army_atk8 =[ $shoot8, army_atk9 ] {ai_face();};
+void() army_atk9 =[ $shoot9, army_run1 ] {ai_face();};
+
+
+void() army_pain1 =[ $pain1, army_pain2 ] {};
+void() army_pain2 =[ $pain2, army_pain3 ] {};
+void() army_pain3 =[ $pain3, army_pain4 ] {};
+void() army_pain4 =[ $pain4, army_pain5 ] {};
+void() army_pain5 =[ $pain5, army_pain6 ] {};
+void() army_pain6 =[ $pain6, army_run1 ] {ai_pain(1);};
+
+void() army_painb1 =[ $painb1, army_painb2 ] {};
+void() army_painb2 =[ $painb2, army_painb3 ] {ai_painforward(13);};
+void() army_painb3 =[ $painb3, army_painb4 ] {ai_painforward(9);};
+void() army_painb4 =[ $painb4, army_painb5 ] {};
+void() army_painb5 =[ $painb5, army_painb6 ] {};
+void() army_painb6 =[ $painb6, army_painb7 ] {};
+void() army_painb7 =[ $painb7, army_painb8 ] {};
+void() army_painb8 =[ $painb8, army_painb9 ] {};
+void() army_painb9 =[ $painb9, army_painb10] {};
+void() army_painb10=[ $painb10, army_painb11] {};
+void() army_painb11=[ $painb11, army_painb12] {};
+void() army_painb12=[ $painb12, army_painb13] {ai_pain(2);};
+void() army_painb13=[ $painb13, army_painb14] {};
+void() army_painb14=[ $painb14, army_run1 ] {};
+
+void() army_painc1 =[ $painc1, army_painc2 ] {};
+void() army_painc2 =[ $painc2, army_painc3 ] {ai_pain(1);};
+void() army_painc3 =[ $painc3, army_painc4 ] {};
+void() army_painc4 =[ $painc4, army_painc5 ] {};
+void() army_painc5 =[ $painc5, army_painc6 ] {ai_painforward(1);};
+void() army_painc6 =[ $painc6, army_painc7 ] {ai_painforward(1);};
+void() army_painc7 =[ $painc7, army_painc8 ] {};
+void() army_painc8 =[ $painc8, army_painc9 ] {ai_pain(1);};
+void() army_painc9 =[ $painc9, army_painc10] {ai_painforward(4);};
+void() army_painc10=[ $painc10, army_painc11] {ai_painforward(3);};
+void() army_painc11=[ $painc11, army_painc12] {ai_painforward(6);};
+void() army_painc12=[ $painc12, army_painc13] {ai_painforward(8);};
+void() army_painc13=[ $painc13, army_run1] {};
+
+void(entity attacker, float damage) army_pain =
+{
+ local float r;
+
+ if (self.pain_finished > time)
+ return;
+
+ r = random();
+
+ if (r < 0.2)
+ {
+ self.pain_finished = time + 0.6;
+ army_pain1 ();
+ sound (self, CHAN_VOICE, "soldier/pain1.wav", 1, ATTN_NORM);
+ }
+ else if (r < 0.6)
+ {
+ self.pain_finished = time + 1.1;
+ army_painb1 ();
+ sound (self, CHAN_VOICE, "soldier/pain2.wav", 1, ATTN_NORM);
+ }
+ else
+ {
+ self.pain_finished = time + 1.1;
+ army_painc1 ();
+ sound (self, CHAN_VOICE, "soldier/pain2.wav", 1, ATTN_NORM);
+ }
+};
+
+
+void() army_fire =
+{
+ local vector dir;
+ local entity en;
+
+ ai_face();
+
+ sound (self, CHAN_WEAPON, "soldier/sattck1.wav", 1, ATTN_NORM);
+
+// fire somewhat behind the player, so a dodging player is harder to hit
+ en = self.enemy;
+
+ dir = en.origin - en.velocity*0.2;
+ dir = normalize (dir - self.origin);
+
+ FireBullets (4, dir, '0.1 0.1 0');
+};
+
+
+
+void() army_die1 =[ $death1, army_die2 ] {};
+void() army_die2 =[ $death2, army_die3 ] {};
+void() army_die3 =[ $death3, army_die4 ]
+{self.solid = SOLID_NOT;self.ammo_shells = 5;DropBackpack();};
+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 ]
+{self.solid = SOLID_NOT;self.ammo_shells = 5;DropBackpack();ai_back(4);};
+void() army_cdie4 =[ $deathc4, army_cdie5 ] {ai_back(13);};
+void() army_cdie5 =[ $deathc5, army_cdie6 ] {ai_back(3);};
+void() army_cdie6 =[ $deathc6, army_cdie7 ] {ai_back(4);};
+void() army_cdie7 =[ $deathc7, army_cdie8 ] {};
+void() army_cdie8 =[ $deathc8, army_cdie9 ] {};
+void() army_cdie9 =[ $deathc9, army_cdie10 ] {};
+void() army_cdie10 =[ $deathc10, army_cdie11 ] {};
+void() army_cdie11 =[ $deathc11, army_cdie11 ] {};
+
+
+void() army_die =
+{
+// check for gib
+ if (self.health < -35)
+ {
+ sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
+ ThrowHead ("progs/h_guard.mdl", self.health);
+ ThrowGib ("progs/gib1.mdl", self.health);
+ ThrowGib ("progs/gib2.mdl", self.health);
+ ThrowGib ("progs/gib3.mdl", self.health);
+ return;
+ }
+
+// regular death
+ sound (self, CHAN_VOICE, "soldier/death1.wav", 1, ATTN_NORM);
+ if (random() < 0.5)
+ army_die1 ();
+ else
+ army_cdie1 ();
+};
+
+
+/*QUAKED monster_army (1 0 0) (-16 -16 -24) (16 16 40) Ambush
+*/
+void() monster_army =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+ precache_model ("progs/soldier.mdl");
+ precache_model ("progs/h_guard.mdl");
+ precache_model ("progs/gib1.mdl");
+ precache_model ("progs/gib2.mdl");
+ precache_model ("progs/gib3.mdl");
+
+ precache_sound ("soldier/death1.wav");
+ precache_sound ("soldier/idle.wav");
+ precache_sound ("soldier/pain1.wav");
+ precache_sound ("soldier/pain2.wav");
+ precache_sound ("soldier/sattck1.wav");
+ precache_sound ("soldier/sight1.wav");
+
+ precache_sound ("player/udeath.wav"); // gib death
+
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/soldier.mdl");
+
+ setsize (self, '-16 -16 -24', '16 16 40');
+ self.health = 30;
+
+ self.th_stand = army_stand1;
+ self.th_walk = army_walk1;
+ self.th_run = army_run1;
+ self.th_missile = army_atk1;
+ self.th_pain = army_pain;
+ self.th_die = army_die;
+
+ walkmonster_start ();
+};
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/sprites.qc b/r17/Revamped src/Revamped QC/Primeqc4/sprites.qc
new file mode 100755
index 00000000..6874f595
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/sprites.qc
@@ -0,0 +1,26 @@
+
+// these are the only sprites still in the game...
+
+$spritename s_explod
+$type vp_parallel
+$load id1/gfx/sprites/explod03.lbm
+$frame 24 24 56 56
+$frame 120 24 56 56
+$frame 216 24 56 56
+$frame 24 88 56 56
+$frame 120 88 56 56
+$frame 216 88 56 56
+
+
+$spritename s_bubble
+$type vp_parallel
+$load id1/gfx/sprites/bubble.lbm
+$frame 16 16 16 16
+$frame 40 16 16 16
+
+
+$spritename s_light
+$type vp_parallel
+$load id1/gfx/sprites/light.lbm
+$frame 104 32 32 32
+
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/subs.qc b/r17/Revamped src/Revamped QC/Primeqc4/subs.qc
new file mode 100755
index 00000000..050aa88e
Binary files /dev/null and b/r17/Revamped src/Revamped QC/Primeqc4/subs.qc differ
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/tarbaby.qc b/r17/Revamped src/Revamped QC/Primeqc4/tarbaby.qc
new file mode 100755
index 00000000..15b2b6ec
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/tarbaby.qc
@@ -0,0 +1,222 @@
+/*
+==============================================================================
+
+BLOB
+
+==============================================================================
+*/
+
+$cd id1/models/tarbaby
+$origin 0 0 24
+$base base
+
+$skin skin
+
+$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9 walk10
+$frame walk11 walk12 walk13 walk14 walk15 walk16 walk17 walk18 walk19
+$frame walk20 walk21 walk22 walk23 walk24 walk25
+
+$frame run1 run2 run3 run4 run5 run6 run7 run8 run9 run10 run11 run12 run13
+$frame run14 run15 run16 run17 run18 run19 run20 run21 run22 run23
+$frame run24 run25
+
+$frame jump1 jump2 jump3 jump4 jump5 jump6
+
+$frame fly1 fly2 fly3 fly4
+
+$frame exp
+
+void() tbaby_stand1 =[ $walk1, tbaby_stand1 ] {ai_stand();};
+
+void() tbaby_hang1 =[ $walk1, tbaby_hang1 ] {ai_stand();};
+
+void() tbaby_walk1 =[ $walk1, tbaby_walk2 ] {ai_turn();};
+void() tbaby_walk2 =[ $walk2, tbaby_walk3 ] {ai_turn();};
+void() tbaby_walk3 =[ $walk3, tbaby_walk4 ] {ai_turn();};
+void() tbaby_walk4 =[ $walk4, tbaby_walk5 ] {ai_turn();};
+void() tbaby_walk5 =[ $walk5, tbaby_walk6 ] {ai_turn();};
+void() tbaby_walk6 =[ $walk6, tbaby_walk7 ] {ai_turn();};
+void() tbaby_walk7 =[ $walk7, tbaby_walk8 ] {ai_turn();};
+void() tbaby_walk8 =[ $walk8, tbaby_walk9 ] {ai_turn();};
+void() tbaby_walk9 =[ $walk9, tbaby_walk10 ] {ai_turn();};
+void() tbaby_walk10 =[ $walk10, tbaby_walk11 ] {ai_turn();};
+void() tbaby_walk11 =[ $walk11, tbaby_walk12 ] {ai_walk(2);};
+void() tbaby_walk12 =[ $walk12, tbaby_walk13 ] {ai_walk(2);};
+void() tbaby_walk13 =[ $walk13, tbaby_walk14 ] {ai_walk(2);};
+void() tbaby_walk14 =[ $walk14, tbaby_walk15 ] {ai_walk(2);};
+void() tbaby_walk15 =[ $walk15, tbaby_walk16 ] {ai_walk(2);};
+void() tbaby_walk16 =[ $walk16, tbaby_walk17 ] {ai_walk(2);};
+void() tbaby_walk17 =[ $walk17, tbaby_walk18 ] {ai_walk(2);};
+void() tbaby_walk18 =[ $walk18, tbaby_walk19 ] {ai_walk(2);};
+void() tbaby_walk19 =[ $walk19, tbaby_walk20 ] {ai_walk(2);};
+void() tbaby_walk20 =[ $walk20, tbaby_walk21 ] {ai_walk(2);};
+void() tbaby_walk21 =[ $walk21, tbaby_walk22 ] {ai_walk(2);};
+void() tbaby_walk22 =[ $walk22, tbaby_walk23 ] {ai_walk(2);};
+void() tbaby_walk23 =[ $walk23, tbaby_walk24 ] {ai_walk(2);};
+void() tbaby_walk24 =[ $walk24, tbaby_walk25 ] {ai_walk(2);};
+void() tbaby_walk25 =[ $walk25, tbaby_walk1 ] {ai_walk(2);};
+
+void() tbaby_run1 =[ $run1, tbaby_run2 ] {ai_face();};
+void() tbaby_run2 =[ $run2, tbaby_run3 ] {ai_face();};
+void() tbaby_run3 =[ $run3, tbaby_run4 ] {ai_face();};
+void() tbaby_run4 =[ $run4, tbaby_run5 ] {ai_face();};
+void() tbaby_run5 =[ $run5, tbaby_run6 ] {ai_face();};
+void() tbaby_run6 =[ $run6, tbaby_run7 ] {ai_face();};
+void() tbaby_run7 =[ $run7, tbaby_run8 ] {ai_face();};
+void() tbaby_run8 =[ $run8, tbaby_run9 ] {ai_face();};
+void() tbaby_run9 =[ $run9, tbaby_run10 ] {ai_face();};
+void() tbaby_run10 =[ $run10, tbaby_run11 ] {ai_face();};
+void() tbaby_run11 =[ $run11, tbaby_run12 ] {ai_run(2);};
+void() tbaby_run12 =[ $run12, tbaby_run13 ] {ai_run(2);};
+void() tbaby_run13 =[ $run13, tbaby_run14 ] {ai_run(2);};
+void() tbaby_run14 =[ $run14, tbaby_run15 ] {ai_run(2);};
+void() tbaby_run15 =[ $run15, tbaby_run16 ] {ai_run(2);};
+void() tbaby_run16 =[ $run16, tbaby_run17 ] {ai_run(2);};
+void() tbaby_run17 =[ $run17, tbaby_run18 ] {ai_run(2);};
+void() tbaby_run18 =[ $run18, tbaby_run19 ] {ai_run(2);};
+void() tbaby_run19 =[ $run19, tbaby_run20 ] {ai_run(2);};
+void() tbaby_run20 =[ $run20, tbaby_run21 ] {ai_run(2);};
+void() tbaby_run21 =[ $run21, tbaby_run22 ] {ai_run(2);};
+void() tbaby_run22 =[ $run22, tbaby_run23 ] {ai_run(2);};
+void() tbaby_run23 =[ $run23, tbaby_run24 ] {ai_run(2);};
+void() tbaby_run24 =[ $run24, tbaby_run25 ] {ai_run(2);};
+void() tbaby_run25 =[ $run25, tbaby_run1 ] {ai_run(2);};
+
+
+//============================================================================
+
+
+void() tbaby_jump1;
+
+void() Tar_JumpTouch =
+{
+ local float ldmg;
+
+ if (other.takedamage && other.classname != self.classname)
+ {
+ if ( vlen(self.velocity) > 400 )
+ {
+ ldmg = 10 + 10*random();
+ T_Damage (other, self, self, ldmg);
+ sound (self, CHAN_WEAPON, "blob/hit1.wav", 1, ATTN_NORM);
+ }
+ }
+ else
+ sound (self, CHAN_WEAPON, "blob/land1.wav", 1, ATTN_NORM);
+
+
+ if (!checkbottom(self))
+ {
+ if (self.flags & FL_ONGROUND)
+ { // jump randomly to not get hung up
+//dprint ("popjump\n");
+ self.touch = SUB_Null;
+ self.think = tbaby_run1;
+ self.movetype = MOVETYPE_STEP;
+ self.nextthink = time + 0.1;
+
+// self.velocity_x = (random() - 0.5) * 600;
+// self.velocity_y = (random() - 0.5) * 600;
+// self.velocity_z = 200;
+// self.flags = self.flags - FL_ONGROUND;
+ }
+ return; // not on ground yet
+ }
+
+ self.touch = SUB_Null;
+ self.think = tbaby_jump1;
+ self.nextthink = time + 0.1;
+};
+
+void() tbaby_jump5;
+
+void() tbaby_fly1 =[ $fly1, tbaby_fly2 ] {};
+void() tbaby_fly2 =[ $fly2, tbaby_fly3 ] {};
+void() tbaby_fly3 =[ $fly3, tbaby_fly4 ] {};
+void() tbaby_fly4 =[ $fly4, tbaby_fly1 ] {
+self.cnt = self.cnt + 1;
+if (self.cnt == 4)
+{
+//dprint ("spawn hop\n");
+tbaby_jump5 ();
+}
+};
+
+void() tbaby_jump1 =[ $jump1, tbaby_jump2 ] {ai_face();};
+void() tbaby_jump2 =[ $jump2, tbaby_jump3 ] {ai_face();};
+void() tbaby_jump3 =[ $jump3, tbaby_jump4 ] {ai_face();};
+void() tbaby_jump4 =[ $jump4, tbaby_jump5 ] {ai_face();};
+void() tbaby_jump5 =[ $jump5, tbaby_jump6 ]
+{
+ self.movetype = MOVETYPE_BOUNCE;
+ self.touch = Tar_JumpTouch;
+ makevectors (self.angles);
+ self.origin_z = self.origin_z + 1;
+ self.velocity = v_forward * 600 + '0 0 200';
+ self.velocity_z = self.velocity_z + random()*150;
+ if (self.flags & FL_ONGROUND)
+ self.flags = self.flags - FL_ONGROUND;
+ self.cnt = 0;
+};
+void() tbaby_jump6 =[ $jump6,tbaby_fly1 ] {};
+
+
+
+//=============================================================================
+
+void() tbaby_die1 =[ $exp, tbaby_die2 ] {
+self.takedamage = DAMAGE_NO;
+};
+void() tbaby_die2 =[ $exp, tbaby_run1 ]
+{
+ T_RadiusDamage (self, self, 120, world);
+
+ sound (self, CHAN_VOICE, "blob/death1.wav", 1, ATTN_NORM);
+ self.origin = self.origin - 8*normalize(self.velocity);
+
+ WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteByte (MSG_BROADCAST, TE_TAREXPLOSION);
+ WriteCoord (MSG_BROADCAST, self.origin_x);
+ WriteCoord (MSG_BROADCAST, self.origin_y);
+ WriteCoord (MSG_BROADCAST, self.origin_z);
+
+ CreateExplosion (self.origin);
+};
+
+//=============================================================================
+
+
+/*QUAKED monster_tarbaby (1 0 0) (-16 -16 -24) (16 16 24) Ambush
+*/
+void() monster_tarbaby =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+ precache_model2 ("progs/tarbaby.mdl");
+
+ precache_sound2 ("blob/death1.wav");
+ precache_sound2 ("blob/hit1.wav");
+ precache_sound2 ("blob/land1.wav");
+ precache_sound2 ("blob/sight1.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/tarbaby.mdl");
+
+ setsize (self, '-16 -16 -24', '16 16 40');
+ self.health = 80;
+
+ self.th_stand = tbaby_stand1;
+ self.th_walk = tbaby_walk1;
+ self.th_run = tbaby_run1;
+ self.th_missile = tbaby_jump1;
+ self.th_melee = tbaby_jump1;
+ self.th_die = tbaby_die1;
+
+ walkmonster_start ();
+};
+
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/triggers.qc b/r17/Revamped src/Revamped QC/Primeqc4/triggers.qc
new file mode 100755
index 00000000..03fe4071
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/triggers.qc
@@ -0,0 +1,641 @@
+
+entity s;
+
+
+void() trigger_reactivate =
+{
+ self.solid = SOLID_TRIGGER;
+};
+
+//=============================================================================
+
+float SPAWNFLAG_NOMESSAGE = 1;
+float SPAWNFLAG_NOTOUCH = 1;
+
+// the wait time has passed, so set back up for another activation
+void() multi_wait =
+{
+ if (self.max_health)
+ {
+ self.health = self.max_health;
+ self.takedamage = DAMAGE_YES;
+ self.solid = SOLID_BBOX;
+ }
+};
+
+
+// the trigger was just touched/killed/used
+// self.enemy should be set to the activator so it can be held through a delay
+// so wait for the delay time before firing
+void() multi_trigger =
+{
+ if (self.nextthink > time)
+ {
+ return; // allready been triggered
+ }
+
+ if (self.classname == "trigger_secret")
+ {
+ if (self.enemy.classname != "player")
+ return;
+ found_secrets = found_secrets + 1;
+ WriteByte (MSG_ALL, SVC_FOUNDSECRET);
+ }
+
+ if (self.noise)
+ sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
+
+// don't trigger again until reset
+ self.takedamage = DAMAGE_NO;
+
+ activator = self.enemy;
+
+ SUB_UseTargets();
+
+ if (self.wait > 0)
+ {
+ self.think = multi_wait;
+ self.nextthink = time + self.wait;
+ }
+ else
+ { // we can't just remove (self) here, because this is a touch function
+ // called wheil C code is looping through area links...
+ self.touch = SUB_Null;
+ self.nextthink = time + 0.1;
+ self.think = SUB_Remove;
+ }
+};
+
+void() multi_killed =
+{
+ self.enemy = damage_attacker;
+ multi_trigger();
+};
+
+void() multi_use =
+{
+ self.enemy = activator;
+ multi_trigger();
+};
+
+void() multi_touch =
+{
+ if (other.classname != "player")
+ return;
+
+// if the trigger has an angles field, check player's facing direction
+ if (self.movedir != '0 0 0')
+ {
+ makevectors (other.angles);
+ if (v_forward * self.movedir < 0)
+ return; // not facing the right way
+ }
+
+ self.enemy = other;
+ multi_trigger ();
+};
+
+/*QUAKED trigger_multiple (.5 .5 .5) ? notouch
+Variable sized repeatable trigger. Must be targeted at one or more entities. If "health" is set, the trigger must be killed to activate each time.
+If "delay" is set, the trigger waits some time after activating before firing.
+"wait" : Seconds between triggerings. (.2 default)
+If notouch is set, the trigger is only fired by other entities, not by touching.
+NOTOUCH has been obsoleted by trigger_relay!
+sounds
+1) secret
+2) beep beep
+3) large switch
+4)
+set "message" to text string
+*/
+void() trigger_multiple =
+{
+ if (self.sounds == 1)
+ {
+ precache_sound ("misc/secret.wav");
+ self.noise = "misc/secret.wav";
+ }
+ else if (self.sounds == 2)
+ {
+ precache_sound ("misc/talk.wav");
+ self.noise = "misc/talk.wav";
+ }
+ else if (self.sounds == 3)
+ {
+ precache_sound ("misc/trigger1.wav");
+ self.noise = "misc/trigger1.wav";
+ }
+
+ if (!self.wait)
+ self.wait = 0.2;
+ self.use = multi_use;
+
+ InitTrigger ();
+
+ if (self.health)
+ {
+ if (self.spawnflags & SPAWNFLAG_NOTOUCH)
+ objerror ("health and notouch don't make sense\n");
+ self.max_health = self.health;
+ self.th_die = multi_killed;
+ self.takedamage = DAMAGE_YES;
+ self.solid = SOLID_BBOX;
+ setorigin (self, self.origin); // make sure it links into the world
+ }
+ else
+ {
+ if ( !(self.spawnflags & SPAWNFLAG_NOTOUCH) )
+ {
+ self.touch = multi_touch;
+ }
+ }
+};
+
+
+/*QUAKED trigger_once (.5 .5 .5) ? notouch
+Variable sized trigger. Triggers once, then removes itself. You must set the key "target" to the name of another object in the level that has a matching
+"targetname". If "health" is set, the trigger must be killed to activate.
+If notouch is set, the trigger is only fired by other entities, not by touching.
+if "killtarget" is set, any objects that have a matching "target" will be removed when the trigger is fired.
+if "angle" is set, the trigger will only fire when someone is facing the direction of the angle. Use "360" for an angle of 0.
+sounds
+1) secret
+2) beep beep
+3) large switch
+4)
+set "message" to text string
+*/
+void() trigger_once =
+{
+ self.wait = -1;
+ trigger_multiple();
+};
+
+//=============================================================================
+
+/*QUAKED trigger_relay (.5 .5 .5) (-8 -8 -8) (8 8 8)
+This fixed size trigger cannot be touched, it can only be fired by other events. It can contain killtargets, targets, delays, and messages.
+*/
+void() trigger_relay =
+{
+ self.use = SUB_UseTargets;
+};
+
+
+//=============================================================================
+
+/*QUAKED trigger_secret (.5 .5 .5) ?
+secret counter trigger
+sounds
+1) secret
+2) beep beep
+3)
+4)
+set "message" to text string
+*/
+void() trigger_secret =
+{
+ total_secrets = total_secrets + 1;
+ self.wait = -1;
+ if (!self.message)
+ self.message = "You found a secret area!";
+ if (!self.sounds)
+ self.sounds = 1;
+
+ if (self.sounds == 1)
+ {
+ precache_sound ("misc/secret.wav");
+ self.noise = "misc/secret.wav";
+ }
+ else if (self.sounds == 2)
+ {
+ precache_sound ("misc/talk.wav");
+ self.noise = "misc/talk.wav";
+ }
+
+ trigger_multiple ();
+};
+
+//=============================================================================
+
+
+void() counter_use =
+{
+
+ self.count = self.count - 1;
+ if (self.count < 0)
+ return;
+
+ if (self.count != 0)
+ {
+ if (activator.classname == "player"
+ && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
+ {
+ if (self.count >= 4)
+ centerprint (activator, "There are more to go...");
+ else if (self.count == 3)
+ centerprint (activator, "Only 3 more to go...");
+ else if (self.count == 2)
+ centerprint (activator, "Only 2 more to go...");
+ else
+ centerprint (activator, "Only 1 more to go...");
+ }
+ return;
+ }
+
+ if (activator.classname == "player"
+ && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
+ centerprint(activator, "Sequence completed!");
+ self.enemy = activator;
+ multi_trigger ();
+};
+
+/*QUAKED trigger_counter (.5 .5 .5) ? nomessage
+Acts as an intermediary for an action that takes multiple inputs.
+
+If nomessage is not set, t will print "1 more.. " etc when triggered and "sequence complete" when finished.
+
+After the counter has been triggered "count" times (default 2), it will fire all of it's targets and remove itself.
+*/
+void() trigger_counter =
+{
+ self.wait = -1;
+ if (!self.count)
+ self.count = 2;
+
+ self.use = counter_use;
+};
+
+
+/*
+==============================================================================
+
+TELEPORT TRIGGERS
+
+==============================================================================
+*/
+
+float PLAYER_ONLY = 1;
+float SILENT = 2;
+
+void() play_teleport =
+{
+ local float v;
+ local string tmpstr;
+
+ v = random() * 5;
+ if (v < 1)
+ tmpstr = "misc/r_tele1.wav";
+ else if (v < 2)
+ tmpstr = "misc/r_tele2.wav";
+ else if (v < 3)
+ tmpstr = "misc/r_tele3.wav";
+ else if (v < 4)
+ tmpstr = "misc/r_tele4.wav";
+ else
+ tmpstr = "misc/r_tele5.wav";
+
+ sound (self, CHAN_VOICE, tmpstr, 1, ATTN_NORM);
+ remove (self);
+};
+
+void(vector org) spawn_tfog =
+{
+ s = spawn ();
+ s.origin = org;
+ s.nextthink = time + 0.2;
+ s.think = play_teleport;
+
+ WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteByte (MSG_BROADCAST, TE_TELEPORT);
+ WriteCoord (MSG_BROADCAST, org_x);
+ WriteCoord (MSG_BROADCAST, org_y);
+ WriteCoord (MSG_BROADCAST, org_z);
+};
+
+
+void() tdeath_touch =
+{
+ if (other == self.owner)
+ return;
+
+// frag anyone who teleports in on top of an invincible player
+ if (other.classname == "player")
+ {
+ if (other.invincible_finished > time)
+ self.classname = "teledeath2";
+ if (self.owner.classname != "player")
+ { // other monsters explode themselves
+ T_Damage (self.owner, self, self, 50000);
+ return;
+ }
+
+ }
+
+ if (other.health)
+ {
+ T_Damage (other, self, self, 50000);
+ }
+};
+
+
+void(vector org, entity death_owner) spawn_tdeath =
+{
+local entity death;
+
+ death = spawn();
+ death.classname = "teledeath";
+ death.movetype = MOVETYPE_NONE;
+ death.solid = SOLID_TRIGGER;
+ death.angles = '0 0 0';
+ setsize (death, death_owner.mins - '1 1 1', death_owner.maxs + '1 1 1');
+ setorigin (death, org);
+ death.touch = tdeath_touch;
+ death.nextthink = time + 0.2;
+ death.think = SUB_Remove;
+ death.owner = death_owner;
+
+ force_retouch = 2; // make sure even still objects get hit
+};
+
+void() teleport_touch =
+{
+local entity t;
+local vector org;
+
+ if (self.targetname)
+ {
+ if (self.nextthink < time)
+ {
+ return; // not fired yet
+ }
+ }
+
+ if (self.spawnflags & PLAYER_ONLY)
+ {
+ if (other.classname != "player")
+ return;
+ }
+
+// only teleport living creatures
+ if (other.health <= 0 || other.solid != SOLID_SLIDEBOX)
+ return;
+
+ SUB_UseTargets ();
+
+// put a tfog where the player was
+ spawn_tfog (other.origin);
+
+ t = find (world, targetname, self.target);
+ if (!t)
+ objerror ("couldn't find target");
+
+// spawn a tfog flash in front of the destination
+ makevectors (t.mangle);
+ org = t.origin + 32 * v_forward;
+
+ spawn_tfog (org);
+ spawn_tdeath(t.origin, other);
+
+// move the player and lock him down for a little while
+ if (!other.health)
+ {
+ other.origin = t.origin;
+ other.velocity = (v_forward * other.velocity_x) + (v_forward * other.velocity_y);
+ return;
+ }
+
+ setorigin (other, t.origin);
+ other.angles = t.mangle;
+ if (other.classname == "player")
+ {
+ other.fixangle = 1; // turn this way immediately
+ other.teleport_time = time + 0.7;
+ if (other.flags & FL_ONGROUND)
+ other.flags = other.flags - FL_ONGROUND;
+ other.velocity = v_forward * 300;
+ }
+ other.flags = other.flags - other.flags & FL_ONGROUND;
+};
+
+/*QUAKED info_teleport_destination (.5 .5 .5) (-8 -8 -8) (8 8 32)
+This is the destination marker for a teleporter. It should have a "targetname" field with the same value as a teleporter's "target" field.
+*/
+void() info_teleport_destination =
+{
+// this does nothing, just serves as a target spot
+ self.mangle = self.angles;
+ self.angles = '0 0 0';
+ self.model = "";
+ self.origin = self.origin + '0 0 27';
+ if (!self.targetname)
+ objerror ("no targetname");
+};
+
+void() teleport_use =
+{
+ self.nextthink = time + 0.2;
+ force_retouch = 2; // make sure even still objects get hit
+ self.think = SUB_Null;
+};
+
+/*QUAKED trigger_teleport (.5 .5 .5) ? PLAYER_ONLY SILENT
+Any object touching this will be transported to the corresponding info_teleport_destination entity. You must set the "target" field, and create an object with a "targetname" field that matches.
+
+If the trigger_teleport has a targetname, it will only teleport entities when it has been fired.
+*/
+void() trigger_teleport =
+{
+ local vector o;
+
+ InitTrigger ();
+ self.touch = teleport_touch;
+ // find the destination
+ if (!self.target)
+ objerror ("no target");
+ self.use = teleport_use;
+
+ if (!(self.spawnflags & SILENT))
+ {
+ precache_sound ("ambience/hum1.wav");
+ o = (self.mins + self.maxs)*0.5;
+ ambientsound (o, "ambience/hum1.wav",0.5 , ATTN_STATIC);
+ }
+};
+
+/*
+==============================================================================
+
+trigger_setskill
+
+==============================================================================
+*/
+
+void() trigger_skill_touch =
+{
+ if (other.classname != "player")
+ return;
+
+ cvar_set ("skill", self.message);
+};
+
+/*QUAKED trigger_setskill (.5 .5 .5) ?
+sets skill level to the value of "message".
+Only used on start map.
+*/
+void() trigger_setskill =
+{
+ InitTrigger ();
+ self.touch = trigger_skill_touch;
+};
+
+
+/*
+==============================================================================
+
+ONLY REGISTERED TRIGGERS
+
+==============================================================================
+*/
+
+void() trigger_onlyregistered_touch =
+{
+ if (other.classname != "player")
+ return;
+ if (self.attack_finished > time)
+ return;
+
+ self.attack_finished = time + 2;
+ if (cvar("registered"))
+ {
+ self.message = "";
+ SUB_UseTargets ();
+ remove (self);
+ }
+ else
+ {
+ if (self.message != "")
+ {
+ centerprint (other, self.message);
+ sound (other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM);
+ }
+ }
+};
+
+/*QUAKED trigger_onlyregistered (.5 .5 .5) ?
+Only fires if playing the registered version, otherwise prints the message
+*/
+void() trigger_onlyregistered =
+{
+ precache_sound ("misc/talk.wav");
+ InitTrigger ();
+ self.touch = trigger_onlyregistered_touch;
+};
+
+//============================================================================
+
+void() hurt_on =
+{
+ self.solid = SOLID_TRIGGER;
+ self.nextthink = -1;
+};
+
+void() hurt_touch =
+{
+ if (other.takedamage)
+ {
+ self.solid = SOLID_NOT;
+ T_Damage (other, self, self, self.dmg);
+ self.think = hurt_on;
+ self.nextthink = time + 1;
+ }
+
+ return;
+};
+
+/*QUAKED trigger_hurt (.5 .5 .5) ?
+Any object touching this will be hurt
+set dmg to damage amount
+defalt dmg = 5
+*/
+void() trigger_hurt =
+{
+ InitTrigger ();
+ self.touch = hurt_touch;
+ if (!self.dmg)
+ self.dmg = 5;
+};
+
+//============================================================================
+
+float PUSH_ONCE = 1;
+
+void() trigger_push_touch =
+{
+ if (other.classname == "grenade")
+ other.velocity = self.speed * self.movedir * 10;
+ else if (other.health > 0)
+ {
+ other.velocity = self.speed * self.movedir * 10;
+ if (other.classname == "player")
+ {
+ if (other.fly_sound < time)
+ {
+ other.fly_sound = time + 1.5;
+ sound (other, CHAN_AUTO, "ambience/windfly.wav", 1, ATTN_NORM);
+ }
+ }
+ }
+ if (self.spawnflags & PUSH_ONCE)
+ remove(self);
+};
+
+
+/*QUAKED trigger_push (.5 .5 .5) ? PUSH_ONCE
+Pushes the player
+*/
+void() trigger_push =
+{
+ InitTrigger ();
+ precache_sound ("ambience/windfly.wav");
+ self.touch = trigger_push_touch;
+ if (!self.speed)
+ self.speed = 1000;
+};
+
+//============================================================================
+
+void() trigger_monsterjump_touch =
+{
+ if ( other.flags & (FL_MONSTER | FL_FLY | FL_SWIM) != FL_MONSTER )
+ return;
+
+// set XY even if not on ground, so the jump will clear lips
+ other.velocity_x = self.movedir_x * self.speed;
+ other.velocity_y = self.movedir_y * self.speed;
+
+ if ( !(other.flags & FL_ONGROUND) )
+ return;
+
+ other.flags = other.flags - FL_ONGROUND;
+
+ other.velocity_z = self.height;
+};
+
+/*QUAKED trigger_monsterjump (.5 .5 .5) ?
+Walking monsters that touch this will jump in the direction of the trigger's angle
+"speed" default to 200, the speed thrown forward
+"height" default to 200, the speed thrown upwards
+*/
+void() trigger_monsterjump =
+{
+ if (!self.speed)
+ self.speed = 200;
+ if (!self.height)
+ self.height = 200;
+ if (self.angles == '0 0 0')
+ self.angles = '0 360 0';
+ InitTrigger ();
+ self.touch = trigger_monsterjump_touch;
+};
+
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/v_shot.mdl b/r17/Revamped src/Revamped QC/Primeqc4/v_shot.mdl
new file mode 100755
index 00000000..02195715
Binary files /dev/null and b/r17/Revamped src/Revamped QC/Primeqc4/v_shot.mdl differ
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/weapons.qc b/r17/Revamped src/Revamped QC/Primeqc4/weapons.qc
new file mode 100755
index 00000000..5217499c
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/weapons.qc
@@ -0,0 +1,2478 @@
+/*
+*/
+
+void (entity targ, entity inflictor, entity attacker, float damage) T_Damage;
+void () player_run;
+void(entity inflictor, entity attacker, float radius, entity ignore) T_RadiusDamage;
+void() SuperDamageSound;
+
+// called by worldspawn
+void() W_Precache =
+{
+ precache_sound ("weapons/r_exp3.wav"); // new rocket explosion
+ precache_sound ("weapons/rocket1i.wav"); // spike gun
+ precache_sound ("weapons/sgun1.wav");
+ precache_sound ("weapons/guncock.wav"); // player shotgun
+ //precache_sound ("weapons/ric1.wav"); // ricochet (used in c code)
+ //precache_sound ("weapons/ric2.wav"); // ricochet (used in c code)
+ //precache_sound ("weapons/ric3.wav"); // ricochet (used in c code)
+ //precache_sound ("weapons/spike2.wav"); // super spikes
+ precache_sound ("weapons/tink1.wav"); // spikes tink (used in c code)
+ //precache_sound ("weapons/grenade.wav"); // grenade launcher
+ precache_sound ("weapons/bounce.wav"); // grenade bounce
+ precache_sound ("weapons/shotgn2.wav"); // super shotgun
+ precache_sound ("weapons/sniper.wav"); // sniper
+ precache_model ("progs/blast.spr"); //blaster bullet sprite.
+ precache_model ("progs/sniper.mdl"); //beam for the Sniper blaster
+ precache_model ("progs/ric_beam.mdl"); //Beam for The richochet blaster
+ precache_model ("progs/null.spr");
+ precache_model ("progs/body.spr");
+
+ //Morphball sounds
+ precache_sound ("weapons/boost.wav");
+ precache_sound ("weapons/mb_bomb.wav"); // Morphball lays a bomb
+ precache_sound ("weapons/mb_explode.wav");
+ precache_sound ("weapons/morphball.wav");
+ precache_sound ("weapons/mb_bomb.wav");
+
+ //Footsteps
+ precache_sound ("steps/foot1.wav");
+ precache_sound ("steps/foot2.wav");
+ precache_sound ("steps/foot3.wav");
+ precache_sound ("steps/foot4.wav");
+
+ //Transform Sounds
+ precache_sound ("weapons/blaster_transform.wav");
+ precache_sound ("weapons/rocket_transform.wav");
+
+ //Effects
+ //Muzzleflashes
+ precache_model ("progs/blaster_muzzle.spr");
+ precache_model ("progs/ric_muzzle.spr");
+ precache_model ("progs/sniper_muzzle.spr");
+ precache_model ("progs/splaser_muzzle.spr");
+
+};
+
+float() crandom =
+{
+ return 2*(random() - 0.5);
+};
+
+/*
+================
+W_FireAxe
+================
+*/
+void() W_FireAxe =
+{
+ local vector source;
+ local vector org;
+
+ makevectors (self.v_angle);
+ source = self.origin + '0 0 16';
+ traceline (source, source + v_forward*64, FALSE, self);
+ if (trace_fraction == 1.0)
+ return;
+
+ org = trace_endpos - v_forward*4;
+
+ if (trace_ent.takedamage)
+ {
+ trace_ent.axhitme = 1;
+ SpawnBlood (org, '0 0 0', 20);
+ T_Damage (trace_ent, self, self, 20);
+ }
+ else
+ { // hit wall
+ sound (self, CHAN_WEAPON, "player/axhit2.wav", 1, ATTN_NORM);
+ WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteByte (MSG_BROADCAST, TE_GUNSHOT);
+ WriteCoord (MSG_BROADCAST, org_x);
+ WriteCoord (MSG_BROADCAST, org_y);
+ WriteCoord (MSG_BROADCAST, org_z);
+ }
+};
+
+
+//============================================================================
+
+
+vector() wall_velocity =
+{
+ local vector vel;
+
+ vel = normalize (self.velocity);
+ vel = normalize(vel + v_up*(random()- 0.5) + v_right*(random()- 0.5));
+ vel = vel + 2*trace_plane_normal;
+ vel = vel * 200;
+
+ return vel;
+};
+
+
+/*
+==============================================================================
+
+MULTI-DAMAGE
+
+Collects multiple small damages into a single damage
+
+==============================================================================
+*/
+
+entity multi_ent;
+vector puff_org;
+float multi_damage;
+
+void() ClearMultiDamage =
+{
+ multi_ent = world;
+ multi_damage = 0;
+};
+
+void() ApplyMultiDamage =
+{
+ if (!multi_ent)
+ return;
+ T_Damage (multi_ent, self, self, multi_damage);
+};
+
+void(entity hit, float damage) AddMultiDamage =
+{
+ if (!hit)
+ return;
+
+ if (hit != multi_ent)
+ {
+ ApplyMultiDamage ();
+ multi_damage = damage;
+ multi_ent = hit;
+ }
+ else
+ multi_damage = multi_damage + damage;
+};
+
+/*
+>>>>>>>>>>>>>>>>>>>>>>>>>
+Touch Functions and Exlosions for Damage.
+-I hate how all the Bullet damage functions are strewn around everywhere. This is where you Will find the Bullet-damage
+For All the weapons. And I don't wanna create a new qc because I have do define Crap, and then Go there to edit.
+it is Just fine right here.
+<<<<<<<<<<<<<<<<<<<<<<<<<
+*/
+//For something.... Just Don't care to Go look. Find it yourself in combat.qc
+
+vector(entity proj) bounce_off_wall = // borrowing
+{
+ local vector vec;
+ local float backoff, change;
+// get the trace_plane_normal of the surface we hit
+ makevectors (proj.angles);
+ v_forward_z = v_forward_z * -1;
+ traceline (proj.origin, proj.origin + v_forward*64, FALSE, proj);
+
+ if (trace_fraction == 1)
+ return proj.velocity;
+
+// the entity's velocity is not what we want, so set default
+ proj.velocity = v_forward * 2000;//proj.old_velocity;
+
+// calculate dot product
+ backoff = (proj.velocity * trace_plane_normal);
+ backoff = backoff * 1.5;
+
+// finish
+ change = trace_plane_normal_x * backoff;
+ vec_x = proj.velocity_x - change;
+
+ if (vec_x > -0.1 && vec_x < 0.1)
+ vec_x = 0;
+
+ change = trace_plane_normal_y * backoff;
+ vec_y = proj.velocity_y - change;
+
+ if (vec_y > -0.1 && vec_y < 0.1)
+ vec_y = 0;
+
+ change = trace_plane_normal_z * backoff;
+ vec_z = proj.velocity_z - change;
+
+ if (vec_z > -0.1 && vec_z < 0.1)
+ vec_z = 0;
+// set correct angles of our new velocity
+ sound (self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM);
+ proj.angles = vectoangles (vec);
+ // this is required to make downward slopes not stop the projectile
+ proj.flags = proj.flags - ( proj.flags & FL_ONGROUND );
+ return vec;
+}
+void () bounce_a =
+{
+ self.velocity = bounce_off_wall( self );
+};
+
+void () Bounce_Off_Walls =
+{
+ self.nextthink = time;
+ self.think = bounce_a;
+
+ if (self.velocity == '0 0 0')
+ remove (self);
+};
+
+/*
+=============================
+RIC TOUCH 0
+============================
+*/
+void () ric_touch =
+{
+ if (pointcontents(self.origin) == CONTENT_SKY)
+ {
+ remove(self);
+ return;
+ }
+ else if (other.takedamage) {
+ spawn_touchblood (18);
+ T_Damage (other, self, self.owner, 10);
+ }
+ else if (self.lives > 0) {
+ particle (self.origin, '0 0 0', 179, 20);
+ Bounce_Off_Walls ();
+ self.lives -= 1;
+ return;
+ }
+
+ remove(self);
+};
+/*
+=============================
+RIC TOUCH 1
+============================
+*/
+void () ric_touch_1 =
+{
+ if (pointcontents(self.origin) == CONTENT_SKY)
+ {
+ remove(self);
+ return;
+ }
+ else if (other.takedamage) {
+ spawn_touchblood (20);
+ T_Damage (other, self, self.owner, 15);
+ }
+ else if (self.lives > 0) {
+ particle (self.origin, '0 0 0', 179, 20);
+ Bounce_Off_Walls ();
+ self.lives -= 1;
+ return;
+ }
+
+ remove(self);
+};
+/*
+=============================
+RIC TOUCH 2
+============================
+*/
+void () ric_touch_2 =
+{
+ if (pointcontents(self.origin) == CONTENT_SKY)
+ {
+ remove(self);
+ return;
+ }
+ else if (other.takedamage) {
+ spawn_touchblood (25);
+ T_Damage (other, self, self.owner, 20);
+ }
+ else if (self.lives > 0) {
+ particle (self.origin, '0 0 0', 179, 20);
+ Bounce_Off_Walls ();
+ self.lives -= 1;
+ return;
+ }
+
+ remove(self);
+};
+/*
+=============================
+RIC TOUCH 3
+============================
+*/
+void () ric_touch_3 =
+{
+ if (pointcontents(self.origin) == CONTENT_SKY)
+ {
+ remove(self);
+ return;
+ }
+ else if (other.takedamage) {
+ spawn_touchblood (25);
+ T_Damage (other, self, self.owner, 25);
+ }
+ else if (self.lives > 0) {
+ particle (self.origin, '0 0 0', 179, 20);
+ Bounce_Off_Walls ();
+ self.lives -= 1;
+ return;
+ }
+
+ remove(self);
+};
+/*
+==========================================
+ROCKET LAUNCHER 0
+==========================================
+*/
+void() Rocket_Explode0 =
+{
+
+ if (other == self.owner)
+ return; // don't explode on owner
+
+ if (pointcontents(self.origin) == CONTENT_SKY)
+ {
+ remove(self);
+ return;
+ }
+ T_RadiusDamage (self, self.owner, 120, other);
+
+ self.origin = self.origin - 8*normalize(self.velocity);
+
+
+ CreateExplosion (self.origin);
+ remove(self);
+};
+/*
+==========================================
+ROCKET LAUNCHER 1
+==========================================
+*/
+void() Rocket_Explode1 =
+{
+
+ if (other == self.owner)
+ return; // don't explode on owner
+
+ if (pointcontents(self.origin) == CONTENT_SKY)
+ {
+ remove(self);
+ return;
+ }
+ T_RadiusDamage (self, self.owner, 140, other);
+
+ self.origin = self.origin - 8*normalize(self.velocity);
+
+
+ CreateExplosion (self.origin);
+ remove(self);
+};
+/*
+==========================================
+ROCKET LAUNCHER 2
+==========================================
+*/
+void() Rocket_Explode2 =
+{
+
+ if (other == self.owner)
+ return; // don't explode on owner
+
+ if (pointcontents(self.origin) == CONTENT_SKY)
+ {
+ remove(self);
+ return;
+ }
+ T_RadiusDamage (self, self.owner, 160, other);
+
+ self.origin = self.origin - 8*normalize(self.velocity);
+
+
+ CreateExplosion (self.origin);
+ remove(self);
+};
+/*
+==========================================
+ROCKET LAUNCHER 3
+==========================================
+*/
+void() Rocket_Explode3 =
+{
+
+ if (other == self.owner)
+ return; // don't explode on owner
+
+ if (pointcontents(self.origin) == CONTENT_SKY)
+ {
+ remove(self);
+ return;
+ }
+ T_RadiusDamage (self, self.owner, 190, other);
+
+ self.origin = self.origin - 8*normalize(self.velocity);
+
+
+ CreateExplosion (self.origin);
+ remove(self);
+};
+void() T_MissileTouch =
+{
+ local float damg;
+
+ if (other == self.owner)
+ return; // don't explode on owner
+
+ if (pointcontents(self.origin) == CONTENT_SKY)
+ {
+ remove(self);
+ return;
+ }
+
+ damg = 40 + random()*10;
+
+ if (other.health)
+ {
+ T_Damage (other, self, self.owner, damg );
+ }
+
+ // don't do radius damage to the other, because all the damage
+ // was done in the impact
+ T_RadiusDamage (self, self.owner, 120, other);
+
+// sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
+ self.origin = self.origin - 8*normalize(self.velocity);
+
+
+ CreateExplosion (self.origin);
+ remove(self);
+};
+
+/*
+=============================
+Magma explode
+============================
+*/
+void() magmaexplode =
+{
+ T_RadiusDamage (self, self.owner, 120, other);
+
+// sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
+ self.origin = self.origin - 8*normalize(self.velocity);
+
+
+ CreateExplosion(self.origin);
+ remove(self);
+};
+/*
+=============================
+Splaser Beam touch
+============================
+*/
+void(vector org) SplaserTouch =
+{
+ if (pointcontents(self.origin) == CONTENT_SKY)
+ {
+ remove(self);
+ return;
+ }
+ else if (other.takedamage) {
+ spawn_touchblood (18);
+ T_Damage (other, self, self.owner, 9);
+
+
+ }
+ else
+ {
+ particle (self.origin, '0 0 0', 149, 20);
+ puff_org = self.origin;
+ remove(self);
+ }
+};
+/*
+=============================
+MAGMA TOUCH
+============================
+*/
+void(vector org) magma_touch =
+{
+ if (pointcontents(self.origin) == CONTENT_SKY)
+ {
+ remove(self);
+ return;
+ }
+ else if (other.takedamage) {
+ spawn_touchblood (18);
+ T_Damage (other, self, self.owner, 20);
+ remove(self);
+ }
+ else
+ {
+ puff_org = self.origin;
+ self.think = magmaexplode;
+ self.nextthink = time + 5;
+ }
+};
+/*
+=============================
+BLASTER TOUCH 0
+============================
+*/
+void(vector org) BlasterTouch =
+{
+ self.velocity = '0 0 0';
+
+ if (pointcontents(self.origin) == CONTENT_SKY)
+ {
+ remove(self);
+ return;
+ }
+ else if (other.takedamage) {
+ spawn_touchblood (18);
+ T_Damage (other, self, self.owner, 7);
+
+
+ }
+ else
+ {
+ particle (self.origin, '0 0 0', 214, 20);
+ puff_org = self.origin;
+ }
+ remove(self);
+};
+/*
+=============================
+BLASTER TOUCH 1
+============================
+*/
+void(vector org) BlasterTouch1 =
+{
+ self.velocity = '0 0 0';
+
+ if (pointcontents(self.origin) == CONTENT_SKY)
+ {
+ remove(self);
+ return;
+ }
+ else if (other.takedamage) {
+ spawn_touchblood (18);
+ T_Damage (other, self, self.owner, 15);
+
+
+ }
+ else
+ {
+ particle (self.origin, '0 0 0', 214, 20);
+ puff_org = self.origin;
+ }
+ remove(self);
+};
+/*
+=============================
+BLASTER TOUCH 2
+============================
+*/
+void(vector org) BlasterTouch2 =
+{
+ self.velocity = '0 0 0';
+
+ if (pointcontents(self.origin) == CONTENT_SKY)
+ {
+ remove(self);
+ return;
+ }
+ else if (other.takedamage) {
+ spawn_touchblood (18);
+ T_Damage (other, self, self.owner, 36);
+ }
+ else
+ {
+ particle (self.origin, '0 0 0', 214, 20);
+ puff_org = self.origin;
+ }
+ remove(self);
+};
+//The final Blast product for Blaster. I may fix up into 1 function, But for now, "self" is the projectile.
+//And other doesn't work. Nor does other.owner
+
+void(vector org) BlasterTouch3 =
+{
+ self.velocity = '0 0 0';
+
+ if (pointcontents(self.origin) == CONTENT_SKY)
+ {
+ remove(self);
+ return;
+ }
+ else if (other.takedamage) {
+ spawn_touchblood (18);
+ T_Damage (other, self, self.owner, 30);
+ }
+ else
+ {
+ particle (self.origin, '0 0 0', 214, 20);
+ puff_org = self.origin;
+ }
+ remove(self);
+};
+
+/*
+=============================
+SNIPER TOUCH
+============================
+*/
+void () SniperTouch =
+{
+ local vector p_a, p_b;
+ local float zdif;
+
+ self.velocity = '0 0 0';
+
+ if (pointcontents(self.origin) == CONTENT_SKY)
+ {
+ remove(self);
+ return;
+ }
+ else if (other.takedamage) {
+ p_a_z = self.origin_z;
+ p_b_z = other.origin_z;
+
+ zdif = vlen(p_a - p_b);
+ //_bprint(ftos(zdif),"\n");
+ if (zdif > 20)
+ {
+ T_Damage (other, self, self.owner, 150);
+ spawn_touchblood (18);
+ }
+ else
+ {
+ T_Damage (other, self, self.owner, 40);
+ spawn_touchblood (18);
+ }
+ }
+ else
+ {
+ particle (self.origin, '0 0 0', 251, 40);
+ puff_org = self.origin;
+ }
+ remove(self);
+};
+/*
+=============================
+Morphball Exploding
+============================
+*/
+void() BombExplode =
+{
+ local float damg;
+
+ damg = 16;
+
+ if (other.health)
+ {
+ if (other.classname == "player")
+ damg = damg = 0;
+ T_Damage (other, self, self.owner, damg );
+ }
+
+ T_RadiusDamage (self, self.owner, 50, other);
+ self.origin = self.origin - 8*normalize(self.velocity);
+ CreateExplosion (self.origin);
+ sound (self, CHAN_WEAPON, "weapons/mb_explode.wav", 1, ATTN_NORM);
+ remove(self);
+};
+
+/*
+=====================
+End of Touch Functions
+=====================
+*/
+
+/*
+==============================================================================
+
+BULLETS
+
+==============================================================================
+*/
+
+
+
+/*
+================
+TraceAttack
+================
+*/
+void(float damage, vector dir) TraceAttack =
+{
+ local vector vel, org;
+
+ vel = normalize(dir + v_up*crandom() + v_right*crandom());
+ vel = vel + 2*trace_plane_normal;
+ vel = vel * 200;
+
+ org = trace_endpos - dir*4;
+
+ if (trace_ent.takedamage)
+ {
+ SpawnBlood (org, vel*0.2, damage);
+ AddMultiDamage (trace_ent, damage);
+ }
+ else
+ {
+ WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteByte (MSG_BROADCAST, TE_GUNSHOT);
+ WriteCoord (MSG_BROADCAST, org_x);
+ WriteCoord (MSG_BROADCAST, org_y);
+ WriteCoord (MSG_BROADCAST, org_z);
+ }
+};
+
+/*
+================
+FireBullets
+
+Used by shotgun, super shotgun, and enemy soldier firing
+Go to the trouble of combining multiple pellets into a single damage call.
+================
+*/
+void(float shotcount, vector dir, vector spread) FireBullets =
+{
+ local vector direction;
+ local vector src;
+
+ makevectors(self.v_angle);
+
+ src = self.origin + v_forward*10;
+ src_z = self.absmin_z + self.size_z * 0.7;
+
+ ClearMultiDamage ();
+ while (shotcount > 0)
+ {
+ direction = dir + crandom()*spread_x*v_right + crandom()*spread_y*v_up;
+
+ traceline (src, src + direction*2048, FALSE, self);
+ if (trace_fraction != 1.0)
+ TraceAttack (4, direction);
+
+ shotcount = shotcount - 1;
+ }
+ ApplyMultiDamage ();
+};
+
+
+/*
+========================
+MAGMA
+========================
+*/
+void() W_FireMagma =
+{
+ local entity sniper;
+ blaster_flash();
+ self.currentammo = self.ammo_lava = self.ammo_lava -= 1;
+ sound (self, CHAN_WEAPON, "weapons/sniper.wav", 1, ATTN_NORM);
+ self.punchangle_x = -3;
+
+ sniper = spawn ();
+ sniper.owner = self;
+ sniper.movetype = MOVETYPE_BOUNCE;
+ sniper.solid = SOLID_BBOX;
+ sniper.classname = "Magma";
+
+// Set The Sniper bullets speed
+
+ makevectors (self.v_angle);
+ sniper.velocity = aim(self, 1000);
+ sniper.velocity = sniper.velocity * 1000;
+ sniper.angles = vectoangles(sniper.velocity);
+
+ sniper.touch = magma_touch;
+
+ setmodel (sniper, "progs/lavaball.mdl");
+ setsize (sniper, '0 0 0', '0 0 0');
+ setorigin (sniper, self.origin + v_forward*10 + '0 0 16');
+};
+/*
+========================
+SPLASER
+========================
+*/
+void() W_FireSplaser =
+{
+ local entity sniper;
+ blaster_flash();
+ self.currentammo = self.ammo_nails = self.ammo_nails -= 1;
+ sound (self, CHAN_WEAPON, "weapons/sniper.wav", 1, ATTN_NORM);
+ self.punchangle_x = -3;
+
+ sniper = spawn ();
+ sniper.owner = self;
+ sniper.movetype = MOVETYPE_FLYMISSILE;
+ sniper.solid = SOLID_BBOX;
+ sniper.classname = "splaser";
+
+// Set The Sniper bullets speed
+
+ makevectors (self.v_angle);
+ sniper.velocity = aim(self, 1000);
+ sniper.velocity = sniper.velocity * 2000; //This is so It is fast Like a sniper Projectile
+ sniper.angles = vectoangles(sniper.velocity);
+
+ sniper.touch = SplaserTouch;
+
+// set missile duration
+ sniper.nextthink = time + 5;
+ sniper.think = SUB_Remove;
+ sniper.frame += 1;
+
+ setmodel (sniper, "progs/splaser_muzzle.spr");
+ sniper.effects = EF_DIMLIGHT;
+ setsize (sniper, '0 0 0', '0 0 0');
+ setorigin (sniper, self.origin + v_forward*10 + '0 0 16');
+};
+/*
+========================
+SNIPER
+========================
+*/
+void() W_FireSniper =
+{
+ local entity sniper;
+ blaster_flash();
+ self.currentammo = self.ammo_sniper = self.ammo_sniper - 1;
+ sound (self, CHAN_WEAPON, "weapons/sniper.wav", 1, ATTN_NORM);
+ self.punchangle_x = -3;
+
+ sniper = spawn ();
+ sniper.owner = self;
+ sniper.movetype = MOVETYPE_FLYMISSILE;
+ sniper.solid = SOLID_BBOX;
+ sniper.classname = "Sniper";
+
+// Set The Sniper bullets speed
+
+ makevectors (self.v_angle);
+ sniper.velocity = aim(self, 1000);
+ sniper.velocity = sniper.velocity * 10000; //This is so It is fast Like a sniper Projectile
+ sniper.angles = vectoangles(sniper.velocity);
+
+ sniper.touch = SniperTouch;
+
+// set missile duration
+ sniper.nextthink = time + 5;
+ sniper.think = SUB_Remove;
+ sniper.frame += 1;
+
+ setmodel (sniper, "progs/sniper.mdl");
+ sniper.effects = EF_DIMLIGHT;
+ setsize (sniper, '0 0 0', '0 0 0');
+ setorigin (sniper, self.origin + v_forward*30 + '0 0 16');
+};
+/*
+================
+BLASTER
+================
+*/
+void() W_FireBlaster =
+{
+
+ local entity plasma;
+ blaster_flash();
+ self.currentammo = self.ammo_blaster = self.ammo_blaster - 0;
+ sound (self, CHAN_AUTO, "weapons/guncock.wav", 1, ATTN_NORM);
+ self.punchangle_x = -2;
+
+ plasma = spawn ();
+ plasma.owner = self;
+ plasma.movetype = MOVETYPE_FLYMISSILE;
+ plasma.solid = SOLID_BBOX;
+ plasma.classname = "Plasma";
+
+// Set the speed of the Plasma
+
+ makevectors (self.v_angle);
+ plasma.velocity = aim(self, 1000);
+ if (self.charge >= 10 && self.charge <= 39) // Sets the Velocity for When charging the Blaster
+ plasma.velocity = plasma.velocity * 4200;
+ if (self.charge >= 40 && self.charge <= 69)
+ plasma.velocity = plasma.velocity * 3100;
+ if (self.charge >= 70)
+ plasma.velocity = plasma.velocity * 2000;
+ else
+ plasma.velocity = plasma.velocity * 4500;
+
+ plasma.angles = vectoangles(plasma.velocity);
+
+ if (self.charge >= 10 && self.charge <= 39) // Sets the Different Damages
+ plasma.touch = BlasterTouch1;
+ if (self.charge >= 40 && self.charge <= 69)
+ plasma.touch = BlasterTouch2;
+ if (self.charge >= 70)
+ plasma.touch = BlasterTouch3;
+ else
+ plasma.touch = BlasterTouch;
+ setmodel (plasma, "progs/blast.spr");
+ if (self.charge >= 10 && self.charge <= 49)
+ plasma.frame = 1;
+ else if (self.charge >= 50)
+ plasma.frame = 0;
+ else
+ plasma.frame = 2;
+
+ setsize (plasma, '0 0 0', '0 0 0');
+ setorigin (plasma, self.origin + v_forward*10 + '0 0 16');
+
+// set missile duration
+ plasma.nextthink = time + 5;
+ plasma.think = SUB_Remove;
+ self.charge = 0;
+};
+
+/*
+================
+W_FireRic
+
+Has 3 Functions Because It needs 3 different origins. There are 3 slots in the Richochet beam.
+================
+*/
+void() W_FireRic =
+{
+
+ local entity plasma;
+ blaster_flash();
+ if (self.charge >= 10 && self.charge <= 39) //Sets the amount of ammo lost when CHarging
+ {
+ if (self.ammo_ric <= 6)
+ self.currentammo = self.ammo_ric = self.ammo_ric - 1;
+ else
+ self.currentammo = self.ammo_ric = self.ammo_ric - 4;
+ }
+ else if (self.charge >= 40)
+ {
+ if (self.ammo_ric <= 6)
+ self.currentammo = self.ammo_ric = self.ammo_ric - 1;
+ else
+ self.currentammo = self.ammo_ric = self.ammo_ric - 5;
+ }
+ else
+ {
+ if (self.ammo_ric <= 6)
+ self.currentammo = self.ammo_ric = self.ammo_ric - 1;
+ else
+ self.currentammo = self.ammo_ric = self.ammo_ric - 3;
+ }
+ sound (self, CHAN_AUTO, "weapons/guncock.wav", 1, ATTN_NORM);
+ if (self.charge >= 10 && self.charge <= 39)
+ self.punchangle_x = -4;
+ else if (self.charge >= 40)
+ self.punchangle_x = -6;
+ else
+ self.punchangle_x = -2;
+
+ plasma = spawn ();
+ plasma.owner = self;
+ plasma.movetype = MOVETYPE_FLYMISSILE;
+ plasma.solid = SOLID_BBOX;
+ plasma.classname = "ric";
+
+// Set the speed of the Plasma
+
+ makevectors (self.v_angle);
+ plasma.velocity = aim(self, 1000);
+ if (self.charge >= 10 && self.charge <= 39)
+ plasma.velocity = plasma.velocity * 2300;
+ else if (self.charge >= 40 && self.charge <= 69)
+ plasma.velocity = plasma.velocity * 2500;
+ else if (self.charge >= 70)
+ plasma.velocity = plasma.velocity * 2700;
+ else
+ plasma.velocity = plasma.velocity * 2100;
+ plasma.angles = vectoangles(plasma.velocity);
+
+ if (self.charge >= 10 && self.charge <= 39)
+ plasma.touch = ric_touch_1;
+ else if (self.charge >= 40 && self.charge <= 69)
+ plasma.touch = ric_touch_2;
+ else if (self.charge >= 70)
+ plasma.touch = ric_touch_3;
+ else
+ plasma.touch = ric_touch;
+
+ if (self.charge >= 40)
+ plasma.lives = 2 + 4 * random();
+ else
+ plasma.lives = 2 + 2 * random();
+
+// set missile duration
+ plasma.nextthink = time + 5;
+ plasma.think = SUB_Remove;
+
+ setmodel (plasma, "progs/ric_beam.mdl");
+ setsize (plasma, '0 0 0', '0 0 0');
+ setorigin (plasma, self.origin + v_forward * 22 + v_right * 10.5 + '0 0 7');
+};
+
+void() W_FireRic2 =
+{
+
+ local entity plasma;
+
+ plasma = spawn ();
+ plasma.owner = self;
+ plasma.movetype = MOVETYPE_FLYMISSILE;
+ plasma.solid = SOLID_BBOX;
+ plasma.classname = "ric";
+
+// Set the speed of the Plasma
+
+ makevectors (self.v_angle);
+ plasma.velocity = aim(self, 1000);
+ if (self.charge >= 10 && self.charge <= 39)
+ plasma.velocity = plasma.velocity * 2300;
+ else if (self.charge >= 40 && self.charge <= 69)
+ plasma.velocity = plasma.velocity * 2500;
+ else if (self.charge >= 70)
+ plasma.velocity = plasma.velocity * 2700;
+ else
+ plasma.velocity = plasma.velocity * 2100;
+ plasma.angles = vectoangles(plasma.velocity);
+
+ if (self.charge >= 10 && self.charge <= 39)
+ plasma.touch = ric_touch_1;
+ else if (self.charge >= 40 && self.charge <= 69)
+ plasma.touch = ric_touch_2;
+ else if (self.charge >= 70)
+ plasma.touch = ric_touch_3;
+ else
+ plasma.touch = ric_touch;
+
+ if (self.charge >= 40)
+ plasma.lives = 2 + 4 * random();
+ else
+ plasma.lives = 2 + 2 * random();
+
+// set missile duration
+ plasma.nextthink = time + 5;
+ plasma.think = SUB_Remove;
+
+ setmodel (plasma, "progs/ric_beam.mdl");
+ setsize (plasma, '0 0 0', '0 0 0');
+ setorigin (plasma, self.origin + v_forward * 22 + v_right * 3.5 + '0 0 7');
+};
+
+void() W_FireRic3 =
+{
+
+ local entity plasma;
+
+ plasma = spawn ();
+ plasma.owner = self;
+ plasma.movetype = MOVETYPE_FLYMISSILE;
+ plasma.solid = SOLID_BBOX;
+ plasma.classname = "ric";
+
+// Set the speed of the Plasma
+
+ makevectors (self.v_angle);
+ plasma.velocity = aim(self, 1000);
+ if (self.charge >= 10 && self.charge <= 39)
+ plasma.velocity = plasma.velocity * 2300;
+ else if (self.charge >= 40 && self.charge <= 69)
+ plasma.velocity = plasma.velocity * 2500;
+ else if (self.charge >= 70)
+ plasma.velocity = plasma.velocity * 2700;
+ else
+ plasma.velocity = plasma.velocity * 2100;
+ plasma.angles = vectoangles(plasma.velocity);
+
+ if (self.charge >= 10 && self.charge <= 39)
+ plasma.touch = ric_touch_1;
+ else if (self.charge >= 40 && self.charge <= 69)
+ plasma.touch = ric_touch_2;
+ else if (self.charge >= 70)
+ plasma.touch = ric_touch_3;
+ else
+ plasma.touch = ric_touch;
+
+ if (self.charge >= 40)
+ plasma.lives = 2 + 4 * random();
+ else
+ plasma.lives = 2 + 2 * random();
+
+// set missile duration
+ plasma.nextthink = time + 5;
+ plasma.think = SUB_Remove;
+
+ setmodel (plasma, "progs/ric_beam.mdl");
+ setsize (plasma, '0 0 0', '0 0 0');
+ setorigin (plasma, self.origin + v_forward * 18 + v_right * 17.5 + '0 0 7');
+};
+/*
+==============================================================================
+
+ROCKETS
+
+==============================================================================
+*/
+/*
+================
+W_FireRocket
+================
+*/
+void() W_FireRocket =
+{
+ local entity missile;
+ if (self.charge >= 10 && self.charge < 40)
+ self.currentammo = self.ammo_rockets = self.ammo_rockets - 2;
+ else if (self.charge >= 40 && self.charge < 70)
+ self.currentammo = self.ammo_rockets = self.ammo_rockets - 3;
+ else if (self.charge >= 70)
+ self.currentammo = self.ammo_rockets = self.ammo_rockets - 5;
+ else
+ self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
+ if (self.ammo_rockets == 0)
+ self.weapon = IT_BLASTER;
+
+ sound (self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM);
+ if (self.charge >= 40 && self.charge < 70)
+ self.punchangle_x = -4;
+ else if (self.charge >= 70)
+ self.punchangle_x = -7;
+ else
+ self.punchangle_x = -2;
+
+ missile = spawn ();
+ missile.owner = self;
+ missile.movetype = MOVETYPE_FLYMISSILE;
+ missile.solid = SOLID_BBOX;
+ missile.classname = "missile";
+
+// set missile speed
+
+ if (self.charge >= 10 && self.charge < 40) //Dang, I messed up with making some 39 and 69 :p
+ {
+ makevectors (self.v_angle);
+ missile.velocity = aim(self, 1000);
+ missile.velocity = missile.velocity * 1100;
+ missile.angles = vectoangles(missile.velocity);
+ }
+ else if (self.charge >= 40 && self.charge < 70)
+ {
+ makevectors (self.v_angle);
+ missile.velocity = aim(self, 1000);
+ missile.velocity = missile.velocity * 1200;
+ missile.angles = vectoangles(missile.velocity);
+ }
+ else if (self.charge >= 70)
+ {
+ makevectors (self.v_angle);
+ missile.velocity = aim(self, 1000);
+ missile.velocity = missile.velocity * 1500;
+ missile.angles = vectoangles(missile.velocity);
+ }
+ else
+ {
+ makevectors (self.v_angle);
+ missile.velocity = aim(self, 1000);
+ missile.velocity = missile.velocity * 1000;
+ missile.angles = vectoangles(missile.velocity);
+ }
+
+ if (self.charge >= 10 && self.charge < 40)
+ missile.touch = Rocket_Explode1;
+ else if (self.charge >= 40 && self.charge < 70)
+ missile.touch = Rocket_Explode2;
+ else if (self.charge >= 70)
+ missile.touch = Rocket_Explode3;
+ else
+ missile.touch = Rocket_Explode0;
+
+// set missile duration
+ missile.nextthink = time + 5;
+ missile.think = SUB_Remove;
+
+ setmodel (missile, "progs/missile.mdl");
+ setsize (missile, '0 0 0', '0 0 0');
+ setorigin (missile, self.origin + v_forward*8 + '0 0 16');
+};
+
+/*
+===============================================================================
+
+LIGHTNING
+
+===============================================================================
+*/
+
+/*
+=================
+LightningDamage
+=================
+*/
+void(vector p1, vector p2, entity from, float damage) LightningDamage =
+{
+ local entity e1, e2;
+ local vector f;
+
+ f = p2 - p1;
+ normalize (f);
+ f_x = 0 - f_y;
+ f_y = f_x;
+ f_z = 0;
+ f = f*16;
+
+ e1 = e2 = world;
+
+ traceline (p1, p2, FALSE, self);
+ if (trace_ent.takedamage)
+ {
+ particle (trace_endpos, '0 0 100', 225, damage*4);
+ T_Damage (trace_ent, from, from, damage);
+ if (self.classname == "player")
+ {
+ if (other.classname == "player")
+ trace_ent.velocity_z = trace_ent.velocity_z + 400;
+ }
+ }
+ e1 = trace_ent;
+
+ traceline (p1 + f, p2 + f, FALSE, self);
+ if (trace_ent != e1 && trace_ent.takedamage)
+ {
+ particle (trace_endpos, '0 0 100', 225, damage*4);
+ T_Damage (trace_ent, from, from, damage);
+ }
+ e2 = trace_ent;
+
+ traceline (p1 - f, p2 - f, FALSE, self);
+ if (trace_ent != e1 && trace_ent != e2 && trace_ent.takedamage)
+ {
+ particle (trace_endpos, '0 0 100', 225, damage*4);
+ T_Damage (trace_ent, from, from, damage);
+ }
+};
+
+
+void() W_FireLightning =
+{
+ local vector org;
+ local float cells;
+
+ if (self.ammo_cells < 1)
+ {
+ //self.weapon = W_BestWeapon ();
+ W_SetCurrentAmmo ();
+ return;
+ }
+
+// explode if under water
+ if (self.waterlevel > 1)
+ {
+ cells = self.ammo_cells;
+ self.ammo_cells = 0;
+ W_SetCurrentAmmo ();
+ T_RadiusDamage (self, self, 35*cells, world);
+ return;
+ }
+
+ if (self.t_width < time)
+ {
+ sound (self, CHAN_WEAPON, "weapons/lhit.wav", 1, ATTN_NORM);
+ self.t_width = time + 0.6;
+ }
+ self.punchangle_x = -2;
+
+ self.currentammo = self.ammo_cells = self.ammo_cells - 1;
+
+ org = self.origin + '0 0 16';
+
+ traceline (org, org + v_forward*600, TRUE, self);
+
+ WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteByte (MSG_BROADCAST, TE_LIGHTNING2);
+ WriteEntity (MSG_BROADCAST, self);
+ WriteCoord (MSG_BROADCAST, org_x);
+ WriteCoord (MSG_BROADCAST, org_y);
+ WriteCoord (MSG_BROADCAST, org_z);
+ WriteCoord (MSG_BROADCAST, trace_endpos_x);
+ WriteCoord (MSG_BROADCAST, trace_endpos_y);
+ WriteCoord (MSG_BROADCAST, trace_endpos_z);
+
+ LightningDamage (self.origin, trace_endpos + v_forward*4, self, 30);
+};
+
+
+//=============================================================================
+
+
+void() GrenadeExplode =
+{
+ T_RadiusDamage (self, self.owner, 120, world);
+
+ WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteCoord (MSG_BROADCAST, self.origin_x);
+ WriteCoord (MSG_BROADCAST, self.origin_y);
+ WriteCoord (MSG_BROADCAST, self.origin_z);
+
+ CreateExplosion (self.origin);
+};
+
+void() GrenadeTouch =
+{
+ if (other == self.owner)
+ return; // don't explode on owner
+ if (other.takedamage == DAMAGE_AIM)
+ {
+ GrenadeExplode();
+ return;
+ }
+ sound (self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM); // bounce sound
+ if (self.velocity == '0 0 0')
+ self.avelocity = '0 0 0';
+};
+
+/*
+================
+W_FireGrenade
+================
+*/
+void() W_FireGrenade =
+{
+ local entity missile;
+
+ self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
+
+ sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
+
+ self.punchangle_x = -2;
+
+ missile = spawn ();
+ missile.owner = self;
+ missile.movetype = MOVETYPE_BOUNCE;
+ missile.solid = SOLID_BBOX;
+ missile.classname = "grenade";
+
+// set missile speed
+
+ makevectors (self.v_angle);
+
+ if (self.v_angle_x)
+ missile.velocity = v_forward*600 + v_up * 200 + crandom()*v_right*10 + crandom()*v_up*10;
+ else
+ {
+ missile.velocity = aim(self, 10000);
+ missile.velocity = missile.velocity * 600;
+ missile.velocity_z = 200;
+ }
+
+ missile.avelocity = '300 300 300';
+
+ missile.angles = vectoangles(missile.velocity);
+
+ missile.touch = GrenadeTouch;
+
+// set missile duration
+ missile.nextthink = time + 2.5;
+ missile.think = GrenadeExplode;
+
+ setmodel (missile, "progs/grenade.mdl");
+ setsize (missile, '0 0 0', '0 0 0');
+ setorigin (missile, self.origin);
+};
+//For regenerating Your Bombs
+void() mbomb1 =
+{
+if (self.morphbombs == 3)
+ self.morphbombs += 1;
+if (self.morphbombs == 2)
+ self.morphbombs += 2;
+if (self.morphbombs == 1)
+ self.morphbombs += 3;
+};
+
+void() fire_morphbomb =
+{
+ local entity missile;
+ self.currentammo = self.morphbombs = self.morphbombs - 1;
+ sound (self, CHAN_WEAPON, "weapons/mb_bomb.wav", 1, ATTN_NORM);
+
+ missile = spawn ();
+ missile.owner = self;
+ missile.movetype = MOVETYPE_BOUNCE;
+ missile.solid = SOLID_BBOX;
+ missile.classname = "Mbomb";
+
+// set missile speed
+
+ makevectors (self.v_angle);
+
+ missile.avelocity = '0 0 0';
+
+ missile.angles = vectoangles(missile.velocity);
+
+
+// set missile duration
+ missile.nextthink = time + 2.5;
+ missile.think = BombExplode;
+
+ self.think = mbomb1;
+ self.nextthink = time + 2.5;
+ missile.effects = EF_DIMLIGHT;
+ setmodel (missile, "progs/mbomb.mdl");
+ setsize (missile, '0 0 0', '0 0 0');
+ setorigin (missile, self.origin + v_up * 8);
+};
+
+
+//=============================================================================
+
+void() spike_touch;
+void() superspike_touch;
+
+
+/*
+===============
+launch_spike
+
+Used for both the player and the ogre
+===============
+*/
+void(vector org, vector dir) launch_spike =
+{
+ newmis = spawn ();
+ newmis.owner = self;
+ newmis.movetype = MOVETYPE_FLYMISSILE;
+ newmis.solid = SOLID_BBOX;
+
+ newmis.angles = vectoangles(dir);
+
+ newmis.touch = spike_touch;
+ newmis.classname = "spike";
+ newmis.think = SUB_Remove;
+ newmis.nextthink = time + 6;
+ setmodel (newmis, "progs/spike.mdl");
+ setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);
+ setorigin (newmis, org);
+
+ newmis.velocity = dir * 1000;
+};
+
+void() W_FireSuperSpikes =
+{
+ local vector dir;
+
+ sound (self, CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM);
+ self.attack_finished = time + 0.2;
+ self.currentammo = self.ammo_nails = self.ammo_nails - 2;
+ dir = aim (self, 1000);
+ launch_spike (self.origin + '0 0 16', dir);
+ newmis.touch = superspike_touch;
+ setmodel (newmis, "progs/s_spike.mdl");
+ setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);
+ self.punchangle_x = -2;
+};
+
+void(float ox) W_FireSpikes =
+{
+ local vector dir;
+
+ makevectors (self.v_angle);
+
+ if (self.ammo_nails >= 2 && self.weapon == IT_SNIPER)
+ {
+ W_FireSuperSpikes ();
+ return;
+ }
+
+ if (self.ammo_nails < 1)
+ {
+ //self.weapon = W_BestWeapon ();
+ W_SetCurrentAmmo ();
+ return;
+ }
+
+ sound (self, CHAN_WEAPON, "weapons/rocket1i.wav", 1, ATTN_NORM);
+ self.attack_finished = time + 0.2;
+ self.currentammo = self.ammo_nails = self.ammo_nails - 1;
+ dir = aim (self, 1000);
+ launch_spike (self.origin + '0 0 16' + v_right*ox, dir);
+
+ self.punchangle_x = -2;
+};
+
+
+
+void() spike_touch =
+{
+ if (other == self.owner)
+ return;
+
+ if (other.solid == SOLID_TRIGGER)
+ return; // trigger field, do nothing
+
+ if (pointcontents(self.origin) == CONTENT_SKY)
+ {
+ remove(self);
+ return;
+ }
+
+// hit something that bleeds
+ if (other.takedamage)
+ {
+ spawn_touchblood (18);
+ T_Damage (other, self, self.owner, 18);
+ }
+ else
+ {
+ WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteByte (MSG_BROADCAST, TE_SUPERSPIKE);
+ WriteCoord (MSG_BROADCAST, self.origin_x);
+ WriteCoord (MSG_BROADCAST, self.origin_y);
+ WriteCoord (MSG_BROADCAST, self.origin_z);
+ }
+
+ remove(self);
+
+};
+
+
+void() superspike_touch =
+{
+ if (other == self.owner)
+ return;
+
+ if (other.solid == SOLID_TRIGGER)
+ return; // trigger field, do nothing
+
+ if (pointcontents(self.origin) == CONTENT_SKY)
+ {
+ remove(self);
+ return;
+ }
+
+// hit something that bleeds
+ if (other.takedamage)
+ {
+ spawn_touchblood (18);
+ T_Damage (other, self, self.owner, 18);
+ }
+ else
+ {
+ WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteByte (MSG_BROADCAST, TE_SUPERSPIKE);
+ WriteCoord (MSG_BROADCAST, self.origin_x);
+ WriteCoord (MSG_BROADCAST, self.origin_y);
+ WriteCoord (MSG_BROADCAST, self.origin_z);
+ }
+
+ remove(self);
+
+};
+
+
+/*
+===============================================================================
+
+PLAYER WEAPON USE
+
+===============================================================================
+*/
+
+void() W_SetCurrentAmmo =
+{
+ if (self.weapon == IT_MORPHBALL)
+ return;
+
+{
+ player_run (); // get out of any weapon firing states
+
+ self.items = self.items - ( self.items & (IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS) );
+
+ if (self.weapon == IT_BLASTER)
+ {
+ if (self.weapon == IT_MORPHBALL)
+ {
+ return;
+ }
+ if(!self.semi)
+ {
+ self.currentammo = self.ammo_blaster;
+ self.weaponmodel = "progs/v_shot.mdl";
+ self.weaponframe = 0;
+ sound (self, CHAN_WEAPON, "weapons/blaster_transform.wav", 1, ATTN_NORM);
+ player_missle27();
+ }
+ }
+ else if (self.weapon == IT_RIC)
+ {
+ if (self.weapon == IT_MORPHBALL)
+ {
+ return;
+ }
+ self.currentammo = self.ammo_ric;
+ self.weaponmodel = "progs/v_shot.mdl";
+ player_missle37();
+ self.attack_finished = time + 1.5;
+ }
+ else if (self.weapon == IT_ROCKET)
+ {
+ if (self.weapon == IT_MORPHBALL)
+ {
+ return;
+ }
+ self.currentammo = self.ammo_rockets;
+ self.weaponmodel = "progs/v_shot.mdl";
+ sound (self, CHAN_WEAPON, "weapons/rocket_transform.wav", 1, ATTN_NORM);
+ player_missle1();
+ self.attack_finished = time + 1.5;
+ }
+ else if (self.weapon == IT_SPLASER)
+ {
+ if (self.weapon == IT_MORPHBALL)
+ {
+ return;
+ }
+ self.currentammo = self.ammo_nails;
+ self.weaponmodel = "progs/v_shot.mdl";
+ self.weaponframe = 0;
+ }
+ else if (self.weapon == IT_SNIPER)
+ {
+ if (self.weapon == IT_MORPHBALL)
+ {
+ return;
+ }
+ self.currentammo = self.ammo_sniper;
+ self.weaponmodel = "progs/v_shot.mdl";
+ self.weaponframe = 0;
+ self.items = self.items | IT_NAILS;
+ }
+ else if (self.weapon == IT_GRENADE_LAUNCHER)
+ {
+ //self.currentammo = self.ammo_rockets;
+ //self.weaponmodel = "progs/v_rock.mdl";
+ self.currentammo = self.morphbombs;
+ self.weaponframe = 0;
+ //self.items = self.items | IT_ROCKETS;
+ }
+ else if (self.weapon == IT_MAGMA)
+ {
+ if (self.weapon == IT_MORPHBALL)
+ {
+ return;
+ }
+ self.currentammo = self.ammo_lava;
+ self.weaponmodel = "progs/v_shot.mdl";
+ self.weaponframe = 0;
+ self.items = self.items | IT_ROCKETS;
+ }
+ else if (self.weapon == IT_LIGHTNING)
+ {
+ self.currentammo = self.ammo_cells;
+ self.weaponmodel = "progs/v_light.mdl";
+ self.weaponframe = 0;
+ self.items = self.items | IT_CELLS;
+ }
+ else
+ {
+ self.currentammo = 0;
+ self.weaponframe = 0;
+ }
+ }
+};
+float() W_CheckNoAmmo =
+{
+ if (self.currentammo > 0)
+ return TRUE;
+
+ if (self.weapon == IT_MORPHBALL)
+ return TRUE;
+
+ W_SetCurrentAmmo ();
+
+// drop the weapon down
+ return FALSE;
+};
+
+/*
+============
+W_Attack
+
+An attack impulse can be triggered now
+============
+*/
+void() player_axe1;
+void() player_axeb1;
+void() player_axec1;
+void() player_axed1;
+void() player_shot1;
+void() player_nail1;
+void() player_light1;
+void() player_rocket1;
+void() FireAnimations; //A function that Is becoming less useable as the game goes on...Sigh
+void() player_missle14; //Shooting Animations for Rocket Launcher
+void() player_missle45; //Shooting Animations for Richochet beam
+void() player_missle56; //Shooting Animations for Blaster
+void() W_Attack =
+{
+ if (!W_CheckNoAmmo ())
+ return;
+
+ makevectors (self.v_angle); // calculate forward angle for velocity
+ self.show_hostile = time + 1; // wake monsters up
+
+
+ if (self.weapon == IT_MORPHBALL)
+ {
+ if (self.morphbombs <= 1)
+ return;
+ fire_morphbomb();
+ self.attack_finished = time + 0.6;
+ }
+ else if (self.weapon == IT_BLASTER)
+ {
+ if (self.weapon == IT_MORPHBALL)
+ {
+ return;
+ }
+ else
+ {
+ if (!self.semi)
+ {
+ W_FireBlaster();
+ player_missle56();
+ self.semi = 1;
+ self.attack_finished = time + 0.12;
+ }
+ }
+}
+ else if (self.weapon == IT_RIC)
+ {
+ if (self.weapon == IT_MORPHBALL)
+ {
+ return;
+ }
+ else
+ {
+
+ if(!self.semi)
+ {
+ if (self.ammo_ric <= 6)
+ W_FireRic();
+ else
+ {
+ W_FireRic();
+ W_FireRic2();
+ W_FireRic3();
+ }
+ player_missle45();
+ self.semi = 1; // Semiauto
+ self.attack_finished = time + 0.6; // Faster
+ }
+ }
+ }
+
+
+ else if (self.weapon == IT_ROCKET)
+ {
+ if (self.weapon == IT_MORPHBALL)
+ {
+ return;
+ }
+
+ else
+ {
+ if(!self.semi)
+ {
+ player_missle14();
+ W_FireRocket();
+ self.semi = 1;
+ self.attack_finished = time + 0.7;
+ }
+ }
+ }
+ else if (self.weapon == IT_SPLASER)
+ {
+ if (self.weapon == IT_MORPHBALL)
+ {
+ return;
+ }
+
+ else
+ {
+ if(!self.semi)
+ {
+ FireAnimations();
+ self.semi = 1;
+ self.attack_finished = time + 0.8;
+ }
+ }
+ }
+ else if (self.weapon == IT_SNIPER)
+ {
+ if (self.weapon == IT_MORPHBALL)
+ {
+ return;
+ }
+ FireAnimations();
+ self.attack_finished = time + 1;
+ }
+ else if (self.weapon == IT_GRENADE_LAUNCHER)
+ {
+ fire_morphbomb();
+ self.attack_finished = time + 0.6;
+ }
+ else if (self.weapon == IT_MAGMA)
+ {
+ if (self.weapon == IT_MORPHBALL)
+ {
+ return;
+ }
+ FireAnimations();
+ W_FireMagma();
+ self.attack_finished = time + 0.7;
+ }
+ else if (self.weapon == IT_LIGHTNING)
+ {
+ player_light1();
+ self.attack_finished = time + 0.1;
+ sound (self, CHAN_AUTO, "weapons/lstart.wav", 1, ATTN_NORM);
+ }
+};
+
+/*
+============
+W_ChangeWeapon
+
+============
+*/
+void() W_ChangeWeapon =
+{
+ local float it, am, fl;
+
+ it = self.items;
+ am = 0;
+
+ if (self.impulse == 1)
+ {
+ fl = IT_MORPHBALL;
+ }
+ else if (self.impulse == 2)
+ {
+ //if (self.weapon == IT_RIC | IT_ROCKET | IT_SNIPER | IT_SPLASER | IT_MAGMA);
+ //player_missle27();
+ fl = IT_BLASTER;
+ if (self.ammo_shells < 1)
+ am = 1;
+ }
+ else if (self.impulse == 3)
+ {
+ fl = IT_ROCKET;
+ if (self.ammo_shells < 2)
+ am = 1;
+ }
+ //else if (self.impulse == 4)
+ //{
+ //fl = IT_SPLASER;
+ //if (self.ammo_nails < 1)
+ //am = 1;
+ //}
+ else if (self.impulse == 5)
+ {
+ fl = IT_SNIPER;
+ if (self.ammo_sniper < 2)
+ am = 1;
+ }
+ //else if (self.impulse == 6)
+ //{
+ // fl = IT_GRENADE_LAUNCHER;
+ // if (self.ammo_rockets < 1)
+ // am = 1;
+ //}
+ else if (self.impulse == 7)
+ {
+ fl = IT_MAGMA;
+ if (self.ammo_lava < 1)
+ am = 1;
+ }
+ else if (self.impulse == 8)
+ {
+ fl = IT_LIGHTNING;
+ if (self.ammo_cells < 1)
+ am = 1;
+ }
+ self.impulse = 0;
+
+ if (!(self.items & fl))
+ { // don't have the weapon or the ammo
+ sprint (self, "no weapon.\n");
+ return;
+ }
+
+ if (am)
+ { // don't have the ammo
+ sprint (self, "not enough ammo.\n");
+ return;
+ }
+
+//
+// set weapon, set ammo
+//
+ self.weapon = fl;
+ W_SetCurrentAmmo ();
+
+};
+
+/*
+============
+CheatCommand
+============
+*/
+void() CheatCommand =
+{
+ if (deathmatch || coop)
+ return;
+
+ self.ammo_rockets = 100;
+ self.ammo_nails = 200;
+ self.ammo_shells = 100;
+ self.items = self.items |
+ IT_MORPHBALL |
+ IT_BLASTER |
+ IT_ROCKET |
+ IT_SPLASER |
+ IT_SNIPER |
+ IT_GRENADE_LAUNCHER |
+ IT_MAGMA |
+ IT_RIC |
+ IT_KEY1 | IT_KEY2;
+
+
+ self.ammo_cells = 200;
+ self.items = self.items | IT_LIGHTNING;
+
+ self.weapon = IT_MAGMA;
+ self.impulse = 0;
+ W_SetCurrentAmmo ();
+};
+
+/*
+============
+CycleWeaponCommand
+
+Go to the next weapon with ammo
+============
+*/
+void() CycleWeaponCommand =
+{
+ local float it, am;
+
+ it = self.items;
+ self.impulse = 0;
+
+ while (1)
+ {
+ am = 0;
+
+ if (self.weapon == IT_LIGHTNING)
+ {
+ player_missle27();
+ self.weapon = IT_BLASTER;
+ if (self.ammo_blaster < 1)
+ am = 1;
+ }
+ else if (self.weapon == IT_BLASTER)
+ {
+ self.weapon = IT_RIC;
+ if (self.ammo_ric < 2)
+ am = 1;
+ }
+ else if (self.weapon == IT_RIC)
+ {
+ self.weapon = IT_ROCKET;
+ if (self.ammo_rockets < 1)
+ am = 1;
+ }
+ else if (self.weapon == IT_ROCKET)
+ {
+ self.weapon = IT_SPLASER;
+ if (self.ammo_nails < 1)
+ am = 1;
+ }
+ else if (self.weapon == IT_SPLASER)
+ {
+ self.weapon = IT_SNIPER;
+ if (self.ammo_sniper < 1)
+ am = 1;
+ }
+ else if (self.weapon == IT_SNIPER)
+ {
+ self.weapon = IT_MAGMA;
+ if (self.ammo_lava < 1)
+ am = 1;
+ }
+ //else if (self.weapon == IT_GRENADE_LAUNCHER)
+ //{
+ // self.weapon = IT_MAGMA;
+ // if (self.ammo_lava < 1)
+ // am = 1;
+ //}
+ else if (self.weapon == IT_MAGMA)
+ {
+ self.weapon = IT_LIGHTNING;
+ if (self.ammo_cells < 1)
+ am = 1;
+ }
+
+ if ( (it & self.weapon) && am == 0)
+ {
+ W_SetCurrentAmmo ();
+ return;
+ }
+ }
+
+};
+
+/*
+============
+CycleWeaponReverseCommand
+
+Go to the prev weapon with ammo
+============
+*/
+void() CycleWeaponReverseCommand =
+{
+ local float it, am;
+
+ it = self.items;
+ self.impulse = 0;
+
+ while (1)
+ {
+ am = 0;
+
+ if (self.weapon == IT_LIGHTNING)
+ {
+ self.weapon = IT_MAGMA;
+ if (self.ammo_lava < 1)
+ am = 1;
+ }
+ else if (self.weapon == IT_MAGMA)
+ {
+ self.weapon = IT_SNIPER;
+ if (self.ammo_sniper < 1)
+ am = 1;
+ }
+ //else if (self.weapon == IT_GRENADE_LAUNCHER)
+ //{
+ // self.weapon = IT_SNIPER;
+ // if (self.ammo_sniper < 1)
+ // am = 1;
+ //}
+ else if (self.weapon == IT_SNIPER)
+ {
+ self.weapon = IT_SPLASER;
+ if (self.ammo_nails < 1)
+ am = 1;
+ }
+ else if (self.weapon == IT_SPLASER)
+ {
+ self.weapon = IT_ROCKET;
+ if (self.ammo_shells < 2)
+ am = 1;
+ }
+
+ else if (self.weapon == IT_ROCKET)
+ {
+ self.weapon = IT_BLASTER;
+ if (self.ammo_blaster < 1)
+ am = 1;
+ }
+ else if (self.weapon == IT_BLASTER)
+ {
+ self.weapon = IT_MORPHBALL;
+ }
+ else if (self.weapon == IT_MORPHBALL)
+ {
+ self.weapon = IT_LIGHTNING;
+ if (self.ammo_cells < 1)
+ am = 1;
+ }
+
+ if ( (it & self.weapon) && am == 0)
+ {
+ W_SetCurrentAmmo ();
+ return;
+ }
+ }
+
+};
+
+/*
+============
+ServerflagsCommand
+
+Just for development
+============
+*/
+void() ServerflagsCommand =
+{
+ serverflags = serverflags * 2 + 1;
+};
+
+void() QuadCheat =
+{
+ if (deathmatch || coop)
+ return;
+ self.super_time = 1;
+ self.super_damage_finished = time + 30;
+ self.items = self.items | IT_QUAD;
+ dprint ("quad cheat\n");
+};
+void() PlayerJump;
+/*
+============
+ImpulseCommands
+
+============
+*/
+void() ImpulseCommands =
+{
+ if (self.impulse >= 1 && self.impulse <= 8)
+ W_ChangeWeapon ();
+ if (self.impulse == 9)
+ CheatCommand ();
+ if (self.impulse == 10)
+ {
+ CycleWeaponCommand ();
+ Set_FOV ( FOV_DEFAULT );
+ self.pfov = FOV_DEFAULT;
+ }
+ if (self.impulse == 11)
+ ServerflagsCommand ();
+ if (self.impulse == 12)
+ {
+ CycleWeaponReverseCommand ();
+ Set_FOV ( FOV_DEFAULT );
+ self.pfov = FOV_DEFAULT;
+ }
+ if (self.impulse == 15)
+ {
+ if (self.health < BROKENITEMS || self.button0 || !self.flags & FL_ONGROUND)
+ return;
+ if (self.weapon != IT_MORPHBALL)
+ {
+ self.charge = 0;
+ self.pfov = FOV_DEFAULT;
+ setsize (self, '-10 -10 -24', '10 10 10');
+ self.weapon = IT_MORPHBALL;
+ self.morphbombs = 4;
+ self.mballset = 1;
+ self.currentammo = self.morphbombs;
+ self.boostlives = 1;
+ self.morphbombs = 4;
+ sound (self, CHAN_WEAPON, "weapons/morphball.wav", 1, ATTN_NORM);
+ stuffcmd (self, "chase_active 1");
+ self.attack_finished = time + 1;
+ }
+ else if (self.weapon == IT_MORPHBALL)
+ {
+ self.charge = 0;
+ self.pfov = FOV_DEFAULT;
+ setorigin (self, self.origin + v_up * 20);
+ setsize (self, '-16 -16 -24', '16 16 32');
+ self.mballset = 0;
+ self.weapon = IT_BLASTER;
+ stuffcmd (self, "chase_active 0");
+ W_SetCurrentAmmo ();
+ self.attack_finished = time + 1;
+ }
+ }
+ if (self.impulse == 17)
+ {
+ if (self.weapon == IT_SNIPER)
+ {
+ if (self.weapon == IT_MORPHBALL)
+ return;
+ WeaponZoom();
+ }
+ if (self.weapon == IT_MORPHBALL)
+ boost();
+ }
+ if (self.impulse == 255)
+ QuadCheat ();
+
+ self.impulse = 0;
+};
+/*
+============
+W_WeaponFrame
+
+Called every frame so impulse events can be handled as well as possible
+============
+*/
+void() W_WeaponFrame =
+{
+ if (!self.button0)
+ self.semi = 0;
+
+ if (time < self.attack_finished)
+ return;
+
+ ImpulseCommands (); // check for attack
+
+ //if (self.button0) // Whats funny Is That You don't even need to Press the Button!
+ // {
+ /*
+===============================================
+ BLASTER
+==================================
+ */
+ if (self.weapon == IT_BLASTER)
+ {
+ if (self.charge < 10)
+ {
+ self.charge = self.charge + 1;
+ }
+
+ if (self.charge >= 10)
+ if (self.charge < 20)
+ {
+ self.charge = self.charge + 1;
+ }
+
+ if (self.charge >= 20)
+ if (self.charge < 30)
+ {
+ self.charge = self.charge + 1;
+ }
+ if (self.charge >= 30)
+ if (self.charge < 40)
+ {
+ self.charge = self.charge + 1;
+ }
+ if (self.charge >= 40)
+ if (self.charge < 50)
+ {
+ self.charge = self.charge + 1;
+ }
+ if (self.charge >= 50)
+ if (self.charge < 60)
+ {
+ self.charge = self.charge + 1;
+ }
+ if (self.charge >= 60)
+ if (self.charge < 70)
+ {
+ self.charge = self.charge + 1;
+ }
+ if (self.charge >= 70)
+ {
+ if (self.weapon == IT_MORPHBALL) //If you turn into Morphball, Then Have no Charge
+ {self.charge = 0;}
+ else
+ {
+ self.charge = self.charge + 1;
+ sprint(self, "Fully charged\n");
+ }
+ }
+
+ if (self.charge < 10 && !self.button0)
+ if (self.charge >= 1 && !self.button0) // no rapid fire
+ {
+ self.charge = 0;
+ }
+
+ if (!self.button0 && self.charge >= 10) // you released the button
+ {
+ if (self.weapon == IT_MORPHBALL)
+ return;
+ if (!self.semi)
+ {
+ W_FireBlaster();
+ self.charge = 0;
+ player_missle56();
+ self.semi = 0;
+ self.attack_finished = time + 0.12;
+ }
+ }
+ }
+/*
+===============================================
+ RICHOCHET
+==================================
+*/
+ if (self.weapon == IT_RIC)
+ {
+ if (self.charge < 10)
+ {
+ self.charge = self.charge + 1;
+ }
+
+ if (self.charge >= 10)
+ if (self.charge < 20)
+ {
+ self.charge = self.charge + 1;
+ }
+
+ if (self.charge >= 20)
+ if (self.charge < 30)
+ {
+ self.charge = self.charge + 1;
+ }
+ if (self.charge >= 30)
+ if (self.charge < 40)
+ {
+ self.charge = self.charge + 1;
+ }
+ if (self.charge >= 40)
+ if (self.charge < 50)
+ {
+ self.charge = self.charge + 1;
+ }
+ if (self.charge >= 50)
+ if (self.charge < 60)
+ {
+ self.charge = self.charge + 1;
+ }
+ if (self.charge >= 60)
+ if (self.charge < 70)
+ {
+ self.charge = self.charge + 1;
+ }
+ if (self.charge >= 70)
+ {
+ if (self.weapon == IT_MORPHBALL) //If you turn into Morphball, Then Have no Charge
+ {self.charge = 0;}
+ else
+ {
+ self.charge = self.charge + 1;
+ sprint(self, "Fully charged\n");
+ }
+ }
+
+ if (self.charge < 10 && !self.button0)
+ if (self.charge >= 1 && !self.button0) // no rapid fire
+ {
+ self.charge = 0;
+ }
+
+ if (!self.button0 && self.charge >= 10) // you released the button
+ {
+ if (self.weapon == IT_MORPHBALL)
+ return;
+ if (!self.semi)
+ {
+ W_FireRic();
+ self.charge = 0;
+ player_missle45();
+ self.semi = 0;
+ self.attack_finished = time + 0.7;
+ }
+ }
+ }
+
+/*
+===============================================
+ROCKET LAUNCHER
+==================================
+*/
+ if (self.weapon == IT_ROCKET)
+ {
+ if (self.charge < 10)
+ {
+ self.charge = self.charge + 1;
+ }
+
+ if (self.charge >= 10)
+ if (self.charge < 20)
+ {
+ self.charge = self.charge + 1;
+ }
+
+ if (self.charge >= 20)
+ if (self.charge < 30)
+ {
+ self.charge = self.charge + 1;
+ }
+ if (self.charge >= 30)
+ if (self.charge < 40)
+ {
+ self.charge = self.charge + 1;
+ }
+ if (self.charge >= 40)
+ if (self.charge < 50)
+ {
+ self.charge = self.charge + 1;
+ }
+ if (self.charge >= 50)
+ if (self.charge < 60)
+ {
+ self.charge = self.charge + 1;
+ }
+ if (self.charge >= 60)
+ if (self.charge < 70)
+ {
+ self.charge = self.charge + 1;
+ }
+ if (self.charge >= 70)
+ {
+ if (self.weapon == IT_MORPHBALL) //If you turn into Morphball, Then Have no Charge
+ {self.charge = 0;}
+ else
+ {
+ self.charge = self.charge + 1;
+ sprint(self, "Fully charged\n");
+ }
+ }
+
+ if (self.charge < 10 && !self.button0)
+ if (self.charge >= 1 && !self.button0) // no rapid fire
+ {
+ self.charge = 0;
+ }
+
+ if (!self.button0 && self.charge >= 10) // you released the button
+ {
+ if (self.weapon == IT_MORPHBALL)
+ return;
+ if (!self.semi)
+ {
+ W_FireRocket();
+ self.charge = 0;
+ player_missle14();
+ self.semi = 0;
+ self.attack_finished = time + 0.7;
+ }
+ }
+ }
+
+
+ if (self.button0)
+ {
+ SuperDamageSound ();
+ W_Attack ();
+}
+};
+/*
+========
+SuperDamageSound
+
+Plays sound if needed
+========
+*/
+void() SuperDamageSound =
+{
+ if (self.super_damage_finished > time)
+ {
+ if (self.super_sound < time)
+ {
+ self.super_sound = time + 1;
+ sound (self, CHAN_BODY, "items/damage3.wav", 1, ATTN_NORM);
+ }
+ }
+ return;
+};
+
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/wizard.qc b/r17/Revamped src/Revamped QC/Primeqc4/wizard.qc
new file mode 100755
index 00000000..d6a6e0ed
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/wizard.qc
@@ -0,0 +1,410 @@
+/*
+==============================================================================
+
+WIZARD
+
+==============================================================================
+*/
+
+$cd id1/models/a_wizard
+$origin 0 0 24
+$base wizbase
+$skin wizbase
+
+$frame hover1 hover2 hover3 hover4 hover5 hover6 hover7 hover8
+$frame hover9 hover10 hover11 hover12 hover13 hover14 hover15
+
+$frame fly1 fly2 fly3 fly4 fly5 fly6 fly7 fly8 fly9 fly10
+$frame fly11 fly12 fly13 fly14
+
+$frame magatt1 magatt2 magatt3 magatt4 magatt5 magatt6 magatt7
+$frame magatt8 magatt9 magatt10 magatt11 magatt12 magatt13
+
+$frame pain1 pain2 pain3 pain4
+
+$frame death1 death2 death3 death4 death5 death6 death7 death8
+
+/*
+==============================================================================
+
+WIZARD
+
+If the player moves behind cover before the missile is launched, launch it
+at the last visible spot with no velocity leading, in hopes that the player
+will duck back out and catch it.
+==============================================================================
+*/
+
+/*
+=============
+LaunchMissile
+
+Sets the given entities velocity and angles so that it will hit self.enemy
+if self.enemy maintains it's current velocity
+0.1 is moderately accurate, 0.0 is totally accurate
+=============
+*/
+void(entity missile, float mspeed, float accuracy) LaunchMissile =
+{
+ local vector vec, move;
+ local float fly;
+
+ makevectors (self.angles);
+
+// set missile speed
+ vec = self.enemy.origin + self.enemy.mins + self.enemy.size * 0.7 - missile.origin;
+
+// calc aproximate time for missile to reach vec
+ fly = vlen (vec) / mspeed;
+
+// get the entities xy velocity
+ move = self.enemy.velocity;
+ move_z = 0;
+
+// project the target forward in time
+ vec = vec + move * fly;
+
+ vec = normalize(vec);
+ vec = vec + accuracy*v_up*(random()- 0.5) + accuracy*v_right*(random()- 0.5);
+
+ missile.velocity = vec * mspeed;
+
+ missile.angles = '0 0 0';
+ missile.angles_y = vectoyaw(missile.velocity);
+
+// set missile duration
+ missile.nextthink = time + 5;
+ missile.think = SUB_Remove;
+};
+
+
+void() wiz_run1;
+void() wiz_side1;
+
+/*
+=================
+WizardCheckAttack
+=================
+*/
+float() WizardCheckAttack =
+{
+ local vector spot1, spot2;
+ local entity targ;
+ local float chance;
+
+ if (time < self.attack_finished)
+ return FALSE;
+ if (!enemy_vis)
+ return FALSE;
+
+ if (enemy_range == RANGE_FAR)
+ {
+ if (self.attack_state != AS_STRAIGHT)
+ {
+ self.attack_state = AS_STRAIGHT;
+ wiz_run1 ();
+ }
+ return FALSE;
+ }
+
+ targ = self.enemy;
+
+// see if any entities are in the way of the shot
+ spot1 = self.origin + self.view_ofs;
+ spot2 = targ.origin + targ.view_ofs;
+
+ traceline (spot1, spot2, FALSE, self);
+
+ if (trace_ent != targ)
+ { // don't have a clear shot, so move to a side
+ if (self.attack_state != AS_STRAIGHT)
+ {
+ self.attack_state = AS_STRAIGHT;
+ wiz_run1 ();
+ }
+ return FALSE;
+ }
+
+ if (enemy_range == RANGE_MELEE)
+ chance = 0.9;
+ else if (enemy_range == RANGE_NEAR)
+ chance = 0.6;
+ else if (enemy_range == RANGE_MID)
+ chance = 0.2;
+ else
+ chance = 0;
+
+ if (random () < chance)
+ {
+ self.attack_state = AS_MISSILE;
+ return TRUE;
+ }
+
+ if (enemy_range == RANGE_MID)
+ {
+ if (self.attack_state != AS_STRAIGHT)
+ {
+ self.attack_state = AS_STRAIGHT;
+ wiz_run1 ();
+ }
+ }
+ else
+ {
+ if (self.attack_state != AS_SLIDING)
+ {
+ self.attack_state = AS_SLIDING;
+ wiz_side1 ();
+ }
+ }
+
+ return FALSE;
+};
+
+/*
+=================
+WizardAttackFinished
+=================
+*/
+float() WizardAttackFinished =
+{
+ if (enemy_range >= RANGE_MID || !enemy_vis)
+ {
+ self.attack_state = AS_STRAIGHT;
+ self.think = wiz_run1;
+ }
+ else
+ {
+ self.attack_state = AS_SLIDING;
+ self.think = wiz_side1;
+ }
+};
+
+/*
+==============================================================================
+
+FAST ATTACKS
+
+==============================================================================
+*/
+
+void() Wiz_FastFire =
+{
+ local vector vec;
+ local vector dst;
+
+ if (self.owner.health > 0)
+ {
+ self.owner.effects = self.owner.effects | EF_MUZZLEFLASH;
+
+ makevectors (self.enemy.angles);
+ dst = self.enemy.origin - 13*self.movedir;
+
+ vec = normalize(dst - self.origin);
+ sound (self, CHAN_WEAPON, "wizard/wattack.wav", 1, ATTN_NORM);
+ launch_spike (self.origin, vec);
+ newmis.velocity = vec*600;
+ newmis.owner = self.owner;
+ newmis.classname = "wizspike";
+ setmodel (newmis, "progs/w_spike.mdl");
+ setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);
+ }
+
+ remove (self);
+};
+
+
+void() Wiz_StartFast =
+{
+ local entity missile;
+
+ sound (self, CHAN_WEAPON, "wizard/wattack.wav", 1, ATTN_NORM);
+ self.v_angle = self.angles;
+ makevectors (self.angles);
+
+ missile = spawn ();
+ missile.owner = self;
+ missile.nextthink = time + 0.6;
+ setsize (missile, '0 0 0', '0 0 0');
+ setorigin (missile, self.origin + '0 0 30' + v_forward*14 + v_right*14);
+ missile.enemy = self.enemy;
+ missile.nextthink = time + 0.8;
+ missile.think = Wiz_FastFire;
+ missile.movedir = v_right;
+
+ missile = spawn ();
+ missile.owner = self;
+ missile.nextthink = time + 1;
+ setsize (missile, '0 0 0', '0 0 0');
+ setorigin (missile, self.origin + '0 0 30' + v_forward*14 + v_right* -14);
+ missile.enemy = self.enemy;
+ missile.nextthink = time + 0.3;
+ missile.think = Wiz_FastFire;
+ missile.movedir = VEC_ORIGIN - v_right;
+};
+
+
+
+void() Wiz_idlesound =
+{
+local float wr;
+ wr = random() * 5;
+
+ if (self.waitmin < time)
+ {
+ self.waitmin = time + 2;
+ if (wr > 4.5)
+ sound (self, CHAN_VOICE, "wizard/widle1.wav", 1, ATTN_IDLE);
+ if (wr < 1.5)
+ sound (self, CHAN_VOICE, "wizard/widle2.wav", 1, ATTN_IDLE);
+ }
+ return;
+};
+
+void() wiz_stand1 =[ $hover1, wiz_stand2 ] {ai_stand();};
+void() wiz_stand2 =[ $hover2, wiz_stand3 ] {ai_stand();};
+void() wiz_stand3 =[ $hover3, wiz_stand4 ] {ai_stand();};
+void() wiz_stand4 =[ $hover4, wiz_stand5 ] {ai_stand();};
+void() wiz_stand5 =[ $hover5, wiz_stand6 ] {ai_stand();};
+void() wiz_stand6 =[ $hover6, wiz_stand7 ] {ai_stand();};
+void() wiz_stand7 =[ $hover7, wiz_stand8 ] {ai_stand();};
+void() wiz_stand8 =[ $hover8, wiz_stand1 ] {ai_stand();};
+
+void() wiz_walk1 =[ $hover1, wiz_walk2 ] {ai_walk(8);
+Wiz_idlesound();};
+void() wiz_walk2 =[ $hover2, wiz_walk3 ] {ai_walk(8);};
+void() wiz_walk3 =[ $hover3, wiz_walk4 ] {ai_walk(8);};
+void() wiz_walk4 =[ $hover4, wiz_walk5 ] {ai_walk(8);};
+void() wiz_walk5 =[ $hover5, wiz_walk6 ] {ai_walk(8);};
+void() wiz_walk6 =[ $hover6, wiz_walk7 ] {ai_walk(8);};
+void() wiz_walk7 =[ $hover7, wiz_walk8 ] {ai_walk(8);};
+void() wiz_walk8 =[ $hover8, wiz_walk1 ] {ai_walk(8);};
+
+void() wiz_side1 =[ $hover1, wiz_side2 ] {ai_run(8);
+Wiz_idlesound();};
+void() wiz_side2 =[ $hover2, wiz_side3 ] {ai_run(8);};
+void() wiz_side3 =[ $hover3, wiz_side4 ] {ai_run(8);};
+void() wiz_side4 =[ $hover4, wiz_side5 ] {ai_run(8);};
+void() wiz_side5 =[ $hover5, wiz_side6 ] {ai_run(8);};
+void() wiz_side6 =[ $hover6, wiz_side7 ] {ai_run(8);};
+void() wiz_side7 =[ $hover7, wiz_side8 ] {ai_run(8);};
+void() wiz_side8 =[ $hover8, wiz_side1 ] {ai_run(8);};
+
+void() wiz_run1 =[ $fly1, wiz_run2 ] {ai_run(16);
+Wiz_idlesound();
+};
+void() wiz_run2 =[ $fly2, wiz_run3 ] {ai_run(16);};
+void() wiz_run3 =[ $fly3, wiz_run4 ] {ai_run(16);};
+void() wiz_run4 =[ $fly4, wiz_run5 ] {ai_run(16);};
+void() wiz_run5 =[ $fly5, wiz_run6 ] {ai_run(16);};
+void() wiz_run6 =[ $fly6, wiz_run7 ] {ai_run(16);};
+void() wiz_run7 =[ $fly7, wiz_run8 ] {ai_run(16);};
+void() wiz_run8 =[ $fly8, wiz_run9 ] {ai_run(16);};
+void() wiz_run9 =[ $fly9, wiz_run10 ] {ai_run(16);};
+void() wiz_run10 =[ $fly10, wiz_run11 ] {ai_run(16);};
+void() wiz_run11 =[ $fly11, wiz_run12 ] {ai_run(16);};
+void() wiz_run12 =[ $fly12, wiz_run13 ] {ai_run(16);};
+void() wiz_run13 =[ $fly13, wiz_run14 ] {ai_run(16);};
+void() wiz_run14 =[ $fly14, wiz_run1 ] {ai_run(16);};
+
+void() wiz_fast1 =[ $magatt1, wiz_fast2 ] {ai_face();Wiz_StartFast();};
+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();};
+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);WizardAttackFinished ();};
+
+void() wiz_pain1 =[ $pain1, wiz_pain2 ] {};
+void() wiz_pain2 =[ $pain2, wiz_pain3 ] {};
+void() wiz_pain3 =[ $pain3, wiz_pain4 ] {};
+void() wiz_pain4 =[ $pain4, wiz_run1 ] {};
+
+void() wiz_death1 =[ $death1, wiz_death2 ] {
+
+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 (self, CHAN_VOICE, "wizard/wdeath.wav", 1, ATTN_NORM);
+};
+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 ] {};
+
+void() wiz_die =
+{
+// check for gib
+ if (self.health < -40)
+ {
+ sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
+ ThrowHead ("progs/h_wizard.mdl", self.health);
+ ThrowGib ("progs/gib2.mdl", self.health);
+ ThrowGib ("progs/gib2.mdl", self.health);
+ ThrowGib ("progs/gib2.mdl", self.health);
+ return;
+ }
+
+ wiz_death1 ();
+};
+
+
+void(entity attacker, float damage) Wiz_Pain =
+{
+ sound (self, CHAN_VOICE, "wizard/wpain.wav", 1, ATTN_NORM);
+ if (random()*70 > damage)
+ return; // didn't flinch
+
+ wiz_pain1 ();
+};
+
+
+void() Wiz_Missile =
+{
+ wiz_fast1();
+};
+
+/*QUAKED monster_wizard (1 0 0) (-16 -16 -24) (16 16 40) Ambush
+*/
+void() monster_knight =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+ precache_model ("progs/wizard.mdl");
+ precache_model ("progs/h_wizard.mdl");
+ precache_model ("progs/w_spike.mdl");
+
+ precache_sound ("wizard/hit.wav"); // used by c code
+ precache_sound ("wizard/wattack.wav");
+ precache_sound ("wizard/wdeath.wav");
+ precache_sound ("wizard/widle1.wav");
+ precache_sound ("wizard/widle2.wav");
+ precache_sound ("wizard/wpain.wav");
+ precache_sound ("wizard/wsight.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/wizard.mdl");
+
+ setsize (self, '-16 -16 -24', '16 16 40');
+ self.health = 80;
+
+ self.th_stand = wiz_stand1;
+ self.th_walk = wiz_walk1;
+ self.th_run = wiz_run1;
+ self.th_missile = Wiz_Missile;
+ self.th_pain = Wiz_Pain;
+ self.th_die = wiz_die;
+
+ flymonster_start ();
+};
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/world.qc b/r17/Revamped src/Revamped QC/Primeqc4/world.qc
new file mode 100755
index 00000000..6df99d3f
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/world.qc
@@ -0,0 +1,385 @@
+
+void() InitBodyQue;
+
+
+void() main =
+{
+ dprint ("main function\n");
+
+// these are just commands the the prog compiler to copy these files
+
+ precache_file ("progs.dat");
+ precache_file ("gfx.wad");
+ precache_file ("quake.rc");
+ precache_file ("default.cfg");
+
+ precache_file ("end1.bin");
+ precache_file2 ("end2.bin");
+
+ precache_file ("demo1.dem");
+ precache_file ("demo2.dem");
+ precache_file ("demo3.dem");
+
+//
+// these are all of the lumps from the cached.ls files
+//
+ precache_file ("gfx/palette.lmp");
+ precache_file ("gfx/colormap.lmp");
+
+ precache_file2 ("gfx/pop.lmp");
+
+ precache_file ("gfx/complete.lmp");
+ precache_file ("gfx/inter.lmp");
+
+ precache_file ("gfx/ranking.lmp");
+ precache_file ("gfx/vidmodes.lmp");
+ precache_file ("gfx/finale.lmp");
+ precache_file ("gfx/conback.lmp");
+ precache_file ("gfx/qplaque.lmp");
+
+ precache_file ("gfx/menudot1.lmp");
+ precache_file ("gfx/menudot2.lmp");
+ precache_file ("gfx/menudot3.lmp");
+ precache_file ("gfx/menudot4.lmp");
+ precache_file ("gfx/menudot5.lmp");
+ precache_file ("gfx/menudot6.lmp");
+
+ precache_file ("gfx/menuplyr.lmp");
+ precache_file ("gfx/bigbox.lmp");
+ precache_file ("gfx/dim_modm.lmp");
+ precache_file ("gfx/dim_drct.lmp");
+ precache_file ("gfx/dim_ipx.lmp");
+ precache_file ("gfx/dim_tcp.lmp");
+ precache_file ("gfx/dim_mult.lmp");
+ precache_file ("gfx/mainmenu.lmp");
+
+ precache_file ("gfx/box_tl.lmp");
+ precache_file ("gfx/box_tm.lmp");
+ precache_file ("gfx/box_tr.lmp");
+
+ precache_file ("gfx/box_ml.lmp");
+ precache_file ("gfx/box_mm.lmp");
+ precache_file ("gfx/box_mm2.lmp");
+ precache_file ("gfx/box_mr.lmp");
+
+ precache_file ("gfx/box_bl.lmp");
+ precache_file ("gfx/box_bm.lmp");
+ precache_file ("gfx/box_br.lmp");
+
+ precache_file ("gfx/sp_menu.lmp");
+ precache_file ("gfx/ttl_sgl.lmp");
+ precache_file ("gfx/ttl_main.lmp");
+ precache_file ("gfx/ttl_cstm.lmp");
+
+ precache_file ("gfx/mp_menu.lmp");
+
+ precache_file ("gfx/netmen1.lmp");
+ precache_file ("gfx/netmen2.lmp");
+ precache_file ("gfx/netmen3.lmp");
+ precache_file ("gfx/netmen4.lmp");
+ precache_file ("gfx/netmen5.lmp");
+
+ precache_file ("gfx/sell.lmp");
+
+ precache_file ("gfx/help0.lmp");
+ precache_file ("gfx/help1.lmp");
+ precache_file ("gfx/help2.lmp");
+ precache_file ("gfx/help3.lmp");
+ precache_file ("gfx/help4.lmp");
+ precache_file ("gfx/help5.lmp");
+
+ precache_file ("gfx/pause.lmp");
+ precache_file ("gfx/loading.lmp");
+
+ precache_file ("gfx/p_option.lmp");
+ precache_file ("gfx/p_load.lmp");
+ precache_file ("gfx/p_save.lmp");
+ precache_file ("gfx/p_multi.lmp");
+
+// sounds loaded by C code
+ precache_sound ("misc/menu1.wav");
+ precache_sound ("misc/menu2.wav");
+ precache_sound ("misc/menu3.wav");
+
+ precache_sound ("ambience/water1.wav");
+ precache_sound ("ambience/wind2.wav");
+
+// shareware
+ precache_file ("maps/start.bsp");
+
+ precache_file ("maps/e1m1.bsp");
+ precache_file ("maps/e1m2.bsp");
+ precache_file ("maps/e1m3.bsp");
+ precache_file ("maps/e1m4.bsp");
+ precache_file ("maps/e1m5.bsp");
+ precache_file ("maps/e1m6.bsp");
+ precache_file ("maps/e1m7.bsp");
+ precache_file ("maps/e1m8.bsp");
+
+// registered
+ precache_file2 ("gfx/pop.lmp");
+
+ precache_file2 ("maps/e2m1.bsp");
+ precache_file2 ("maps/e2m2.bsp");
+ precache_file2 ("maps/e2m3.bsp");
+ precache_file2 ("maps/e2m4.bsp");
+ precache_file2 ("maps/e2m5.bsp");
+ precache_file2 ("maps/e2m6.bsp");
+ precache_file2 ("maps/e2m7.bsp");
+
+ precache_file2 ("maps/e3m1.bsp");
+ precache_file2 ("maps/e3m2.bsp");
+ precache_file2 ("maps/e3m3.bsp");
+ precache_file2 ("maps/e3m4.bsp");
+ precache_file2 ("maps/e3m5.bsp");
+ precache_file2 ("maps/e3m6.bsp");
+ precache_file2 ("maps/e3m7.bsp");
+
+ precache_file2 ("maps/e4m1.bsp");
+ precache_file2 ("maps/e4m2.bsp");
+ precache_file2 ("maps/e4m3.bsp");
+ precache_file2 ("maps/e4m4.bsp");
+ precache_file2 ("maps/e4m5.bsp");
+ precache_file2 ("maps/e4m6.bsp");
+ precache_file2 ("maps/e4m7.bsp");
+ precache_file2 ("maps/e4m8.bsp");
+
+ precache_file2 ("maps/end.bsp");
+
+ precache_file2 ("maps/dm1.bsp");
+ precache_file2 ("maps/dm2.bsp");
+ precache_file2 ("maps/dm3.bsp");
+ precache_file2 ("maps/dm4.bsp");
+ precache_file2 ("maps/dm5.bsp");
+ precache_file2 ("maps/dm6.bsp");
+};
+
+
+entity lastspawn;
+
+//=======================
+/*QUAKED worldspawn (0 0 0) ?
+Only used for the world entity.
+Set message to the level name.
+Set sounds to the cd track to play.
+
+World Types:
+0: medieval
+1: metal
+2: base
+*/
+//=======================
+void() worldspawn =
+{
+ BotInit(); // FrikBot
+ lastspawn = world;
+ InitBodyQue ();
+
+// custom map attributes
+ if (self.model == "maps/e1m8.bsp")
+ cvar_set ("sv_gravity", "100");
+ else
+ cvar_set ("sv_gravity", "800");
+
+// the area based ambient sounds MUST be the first precache_sounds
+
+// player precaches
+ W_Precache (); // get weapon precaches
+
+// sounds used from C physics code
+ precache_sound ("demon/dland2.wav"); // landing thud
+ precache_sound ("misc/h2ohit1.wav"); // landing splash
+
+// setup precaches allways needed
+ precache_sound ("items/itembk2.wav"); // item respawn sound
+ precache_sound ("player/plyrjmp8.wav"); // player jump
+ precache_sound ("player/land.wav"); // player landing
+ precache_sound ("player/land2.wav"); // player hurt landing
+ precache_sound ("player/drown1.wav"); // drowning pain
+ precache_sound ("player/drown2.wav"); // drowning pain
+ precache_sound ("player/gasp1.wav"); // gasping for air
+ precache_sound ("player/gasp2.wav"); // taking breath
+ precache_sound ("player/h2odeath.wav"); // drowning death
+
+ precache_sound ("misc/talk.wav"); // talk
+ precache_sound ("player/teledth1.wav"); // telefrag
+ precache_sound ("misc/r_tele1.wav"); // teleport sounds
+ precache_sound ("misc/r_tele2.wav");
+ precache_sound ("misc/r_tele3.wav");
+ precache_sound ("misc/r_tele4.wav");
+ precache_sound ("misc/r_tele5.wav");
+ precache_sound ("weapons/lock4.wav"); // ammo pick up
+ precache_sound ("weapons/pkup.wav"); // weapon up
+ precache_sound ("items/armor1.wav"); // armor up
+ precache_sound ("weapons/lhit.wav"); //lightning
+ precache_sound ("weapons/lstart.wav"); //lightning start
+ precache_sound ("items/damage3.wav");
+
+ precache_sound ("misc/power.wav"); //lightning for boss
+
+// player gib sounds
+ precache_sound ("player/gib.wav"); // player gib sound
+ precache_sound ("player/udeath.wav"); // player gib sound
+ precache_sound ("player/tornoff2.wav"); // gib sound
+
+// player pain sounds
+
+ precache_sound ("player/pain1.wav");
+ precache_sound ("player/pain2.wav");
+ precache_sound ("player/pain3.wav");
+ precache_sound ("player/pain4.wav");
+ precache_sound ("player/pain5.wav");
+ precache_sound ("player/pain6.wav");
+
+// player death sounds
+ precache_sound ("player/death1.wav");
+ precache_sound ("player/death2.wav");
+ precache_sound ("player/death3.wav");
+ precache_sound ("player/death4.wav");
+ precache_sound ("player/death5.wav");
+
+// ax sounds
+ precache_sound ("weapons/ax1.wav"); // ax swoosh
+ precache_sound ("player/axhit1.wav"); // ax hit meat
+ precache_sound ("player/axhit2.wav"); // ax hit world
+
+ precache_sound ("player/h2ojump.wav"); // player jumping into water
+ precache_sound ("player/slimbrn2.wav"); // player enter slime
+ precache_sound ("player/inh2o.wav"); // player enter water
+ precache_sound ("player/inlava.wav"); // player enter lava
+ precache_sound ("misc/outwater.wav"); // leaving water sound
+
+ precache_sound ("player/lburn1.wav"); // lava burn
+ precache_sound ("player/lburn2.wav"); // lava burn
+
+ precache_sound ("misc/water1.wav"); // swimming
+ precache_sound ("misc/water2.wav"); // swimming
+
+ precache_model ("progs/player.mdl");
+ precache_model ("progs/eyes.mdl");
+ precache_model ("progs/h_player.mdl");
+
+ precache_model ("progs/s_bubble.spr"); // drowning bubbles
+ precache_model ("progs/s_explod.spr"); // sprite explosion
+
+ precache_model ("progs/bolt.mdl"); // for lightning gun
+ precache_model ("progs/bolt2.mdl"); // for lightning gun
+ precache_model ("progs/bolt3.mdl"); // for boss shock
+ precache_model ("progs/lavaball.mdl"); // for testing
+
+ precache_model ("progs/missile.mdl");
+ precache_model ("progs/grenade.mdl");
+ precache_model ("progs/spike.mdl");
+ precache_model ("progs/s_spike.mdl");
+ precache_model ("progs/mball.mdl"); //morphball by ghost fang
+ precache_model ("progs/mbomb.mdl");
+
+ precache_model ("progs/backpack.mdl");
+
+ precache_model ("progs/zom_gib.mdl");
+
+ precache_model ("progs/v_light.mdl");
+
+
+//
+// Setup light animation tables. 'a' is total darkness, 'z' is maxbright.
+//
+
+ // 0 normal
+ lightstyle(0, "m");
+
+ // 1 FLICKER (first variety)
+ lightstyle(1, "mmnmmommommnonmmonqnmmo");
+
+ // 2 SLOW STRONG PULSE
+ lightstyle(2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");
+
+ // 3 CANDLE (first variety)
+ lightstyle(3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");
+
+ // 4 FAST STROBE
+ lightstyle(4, "mamamamamama");
+
+ // 5 GENTLE PULSE 1
+ lightstyle(5,"jklmnopqrstuvwxyzyxwvutsrqponmlkj");
+
+ // 6 FLICKER (second variety)
+ lightstyle(6, "nmonqnmomnmomomno");
+
+ // 7 CANDLE (second variety)
+ lightstyle(7, "mmmaaaabcdefgmmmmaaaammmaamm");
+
+ // 8 CANDLE (third variety)
+ lightstyle(8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");
+
+ // 9 SLOW STROBE (fourth variety)
+ lightstyle(9, "aaaaaaaazzzzzzzz");
+
+ // 10 FLUORESCENT FLICKER
+ lightstyle(10, "mmamammmmammamamaaamammma");
+
+ // 11 SLOW PULSE NOT FADE TO BLACK
+ lightstyle(11, "abcdefghijklmnopqrrqponmlkjihgfedcba");
+
+ // styles 32-62 are assigned by the light program for switchable lights
+
+ // 63 testing
+ lightstyle(63, "a");
+};
+
+void() StartFrame =
+{
+ BotFrame(); // FrikBot
+ teamplay = cvar("teamplay");
+ skill = cvar("skill");
+ framecount = framecount + 1;
+};
+
+/*
+==============================================================================
+
+BODY QUE
+
+==============================================================================
+*/
+
+entity bodyque_head;
+
+void() bodyque =
+{ // just here so spawn functions don't complain after the world
+ // creates bodyques
+};
+
+void() InitBodyQue =
+{
+
+ bodyque_head = spawn();
+ bodyque_head.classname = "bodyque";
+ bodyque_head.owner = spawn();
+ bodyque_head.owner.classname = "bodyque";
+ bodyque_head.owner.owner = spawn();
+ bodyque_head.owner.owner.classname = "bodyque";
+ bodyque_head.owner.owner.owner = spawn();
+ bodyque_head.owner.owner.owner.classname = "bodyque";
+ bodyque_head.owner.owner.owner.owner = bodyque_head;
+};
+
+
+// make a body que entry for the given ent so the ent can be
+// respawned elsewhere
+void(entity ent) CopyToBodyQue =
+{
+ bodyque_head.angles = ent.angles;
+ bodyque_head.model = ent.model;
+ bodyque_head.modelindex = ent.modelindex;
+ bodyque_head.frame = ent.frame;
+ bodyque_head.colormap = ent.colormap;
+ bodyque_head.movetype = ent.movetype;
+ bodyque_head.velocity = ent.velocity;
+ bodyque_head.flags = 0;
+ setorigin (bodyque_head, ent.origin);
+ setsize (bodyque_head, ent.mins, ent.maxs);
+ bodyque_head = bodyque_head.owner;
+};
+
+
diff --git a/r17/Revamped src/Revamped QC/Primeqc4/zombie.qc b/r17/Revamped src/Revamped QC/Primeqc4/zombie.qc
new file mode 100755
index 00000000..b431face
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/Primeqc4/zombie.qc
@@ -0,0 +1,515 @@
+/*
+==============================================================================
+
+ZOMBIE
+
+==============================================================================
+*/
+$cd id1/models/zombie
+
+$origin 0 0 24
+
+$base base
+$skin skin
+
+$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8
+$frame stand9 stand10 stand11 stand12 stand13 stand14 stand15
+
+$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9 walk10 walk11
+$frame walk12 walk13 walk14 walk15 walk16 walk17 walk18 walk19
+
+$frame run1 run2 run3 run4 run5 run6 run7 run8 run9 run10 run11 run12
+$frame run13 run14 run15 run16 run17 run18
+
+$frame atta1 atta2 atta3 atta4 atta5 atta6 atta7 atta8 atta9 atta10 atta11
+$frame atta12 atta13
+
+$frame attb1 attb2 attb3 attb4 attb5 attb6 attb7 attb8 attb9 attb10 attb11
+$frame attb12 attb13 attb14
+
+$frame attc1 attc2 attc3 attc4 attc5 attc6 attc7 attc8 attc9 attc10 attc11
+$frame attc12
+
+$frame paina1 paina2 paina3 paina4 paina5 paina6 paina7 paina8 paina9 paina10
+$frame paina11 paina12
+
+$frame painb1 painb2 painb3 painb4 painb5 painb6 painb7 painb8 painb9 painb10
+$frame painb11 painb12 painb13 painb14 painb15 painb16 painb17 painb18 painb19
+$frame painb20 painb21 painb22 painb23 painb24 painb25 painb26 painb27 painb28
+
+$frame painc1 painc2 painc3 painc4 painc5 painc6 painc7 painc8 painc9 painc10
+$frame painc11 painc12 painc13 painc14 painc15 painc16 painc17 painc18
+
+$frame paind1 paind2 paind3 paind4 paind5 paind6 paind7 paind8 paind9 paind10
+$frame paind11 paind12 paind13
+
+$frame paine1 paine2 paine3 paine4 paine5 paine6 paine7 paine8 paine9 paine10
+$frame paine11 paine12 paine13 paine14 paine15 paine16 paine17 paine18 paine19
+$frame paine20 paine21 paine22 paine23 paine24 paine25 paine26 paine27 paine28
+$frame paine29 paine30
+
+$frame cruc_1 cruc_2 cruc_3 cruc_4 cruc_5 cruc_6
+
+float SPAWN_CRUCIFIED = 1;
+
+//=============================================================================
+
+.float inpain;
+
+void() zombie_stand1 =[ $stand1, zombie_stand2 ] {ai_stand();};
+void() zombie_stand2 =[ $stand2, zombie_stand3 ] {ai_stand();};
+void() zombie_stand3 =[ $stand3, zombie_stand4 ] {ai_stand();};
+void() zombie_stand4 =[ $stand4, zombie_stand5 ] {ai_stand();};
+void() zombie_stand5 =[ $stand5, zombie_stand6 ] {ai_stand();};
+void() zombie_stand6 =[ $stand6, zombie_stand7 ] {ai_stand();};
+void() zombie_stand7 =[ $stand7, zombie_stand8 ] {ai_stand();};
+void() zombie_stand8 =[ $stand8, zombie_stand9 ] {ai_stand();};
+void() zombie_stand9 =[ $stand9, zombie_stand10 ] {ai_stand();};
+void() zombie_stand10 =[ $stand10, zombie_stand11 ] {ai_stand();};
+void() zombie_stand11 =[ $stand11, zombie_stand12 ] {ai_stand();};
+void() zombie_stand12 =[ $stand12, zombie_stand13 ] {ai_stand();};
+void() zombie_stand13 =[ $stand13, zombie_stand14 ] {ai_stand();};
+void() zombie_stand14 =[ $stand14, zombie_stand15 ] {ai_stand();};
+void() zombie_stand15 =[ $stand15, zombie_stand1 ] {ai_stand();};
+
+void() zombie_cruc1 = [ $cruc_1, zombie_cruc2 ] {
+if (random() < 0.1)
+ sound (self, CHAN_VOICE, "zombie/idle_w2.wav", 1, ATTN_STATIC);};
+void() zombie_cruc2 = [ $cruc_2, zombie_cruc3 ] {self.nextthink = time + 0.1 + random()*0.1;};
+void() zombie_cruc3 = [ $cruc_3, zombie_cruc4 ] {self.nextthink = time + 0.1 + random()*0.1;};
+void() zombie_cruc4 = [ $cruc_4, zombie_cruc5 ] {self.nextthink = time + 0.1 + random()*0.1;};
+void() zombie_cruc5 = [ $cruc_5, zombie_cruc6 ] {self.nextthink = time + 0.1 + random()*0.1;};
+void() zombie_cruc6 = [ $cruc_6, zombie_cruc1 ] {self.nextthink = time + 0.1 + random()*0.1;};
+
+void() zombie_walk1 =[ $walk1, zombie_walk2 ] {ai_walk(0);};
+void() zombie_walk2 =[ $walk2, zombie_walk3 ] {ai_walk(2);};
+void() zombie_walk3 =[ $walk3, zombie_walk4 ] {ai_walk(3);};
+void() zombie_walk4 =[ $walk4, zombie_walk5 ] {ai_walk(2);};
+void() zombie_walk5 =[ $walk5, zombie_walk6 ] {ai_walk(1);};
+void() zombie_walk6 =[ $walk6, zombie_walk7 ] {ai_walk(0);};
+void() zombie_walk7 =[ $walk7, zombie_walk8 ] {ai_walk(0);};
+void() zombie_walk8 =[ $walk8, zombie_walk9 ] {ai_walk(0);};
+void() zombie_walk9 =[ $walk9, zombie_walk10 ] {ai_walk(0);};
+void() zombie_walk10 =[ $walk10, zombie_walk11 ] {ai_walk(0);};
+void() zombie_walk11 =[ $walk11, zombie_walk12 ] {ai_walk(2);};
+void() zombie_walk12 =[ $walk12, zombie_walk13 ] {ai_walk(2);};
+void() zombie_walk13 =[ $walk13, zombie_walk14 ] {ai_walk(1);};
+void() zombie_walk14 =[ $walk14, zombie_walk15 ] {ai_walk(0);};
+void() zombie_walk15 =[ $walk15, zombie_walk16 ] {ai_walk(0);};
+void() zombie_walk16 =[ $walk16, zombie_walk17 ] {ai_walk(0);};
+void() zombie_walk17 =[ $walk17, zombie_walk18 ] {ai_walk(0);};
+void() zombie_walk18 =[ $walk18, zombie_walk19 ] {ai_walk(0);};
+void() zombie_walk19 =[ $walk19, zombie_walk1 ] {
+ai_walk(0);
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_IDLE);};
+
+void() zombie_run1 =[ $run1, zombie_run2 ] {ai_run(1);self.inpain = 0;};
+void() zombie_run2 =[ $run2, zombie_run3 ] {ai_run(1);};
+void() zombie_run3 =[ $run3, zombie_run4 ] {ai_run(0);};
+void() zombie_run4 =[ $run4, zombie_run5 ] {ai_run(1);};
+void() zombie_run5 =[ $run5, zombie_run6 ] {ai_run(2);};
+void() zombie_run6 =[ $run6, zombie_run7 ] {ai_run(3);};
+void() zombie_run7 =[ $run7, zombie_run8 ] {ai_run(4);};
+void() zombie_run8 =[ $run8, zombie_run9 ] {ai_run(4);};
+void() zombie_run9 =[ $run9, zombie_run10 ] {ai_run(2);};
+void() zombie_run10 =[ $run10, zombie_run11 ] {ai_run(0);};
+void() zombie_run11 =[ $run11, zombie_run12 ] {ai_run(0);};
+void() zombie_run12 =[ $run12, zombie_run13 ] {ai_run(0);};
+void() zombie_run13 =[ $run13, zombie_run14 ] {ai_run(2);};
+void() zombie_run14 =[ $run14, zombie_run15 ] {ai_run(4);};
+void() zombie_run15 =[ $run15, zombie_run16 ] {ai_run(6);};
+void() zombie_run16 =[ $run16, zombie_run17 ] {ai_run(7);};
+void() zombie_run17 =[ $run17, zombie_run18 ] {ai_run(3);};
+void() zombie_run18 =[ $run18, zombie_run1 ] {
+ai_run(8);
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_IDLE);
+if (random() > 0.8)
+ sound (self, CHAN_VOICE, "zombie/z_idle1.wav", 1, ATTN_IDLE);
+};
+
+/*
+=============================================================================
+
+ATTACKS
+
+=============================================================================
+*/
+
+void() ZombieGrenadeTouch =
+{
+ if (other == self.owner)
+ return; // don't explode on owner
+ if (other.takedamage)
+ {
+ T_Damage (other, self, self.owner, 10 );
+ sound (self, CHAN_WEAPON, "zombie/z_hit.wav", 1, ATTN_NORM);
+ remove (self);
+ return;
+ }
+ sound (self, CHAN_WEAPON, "zombie/z_miss.wav", 1, ATTN_NORM); // bounce sound
+ self.velocity = '0 0 0';
+ self.avelocity = '0 0 0';
+ self.touch = SUB_Remove;
+};
+
+/*
+================
+ZombieFireGrenade
+================
+*/
+void(vector st) ZombieFireGrenade =
+{
+ local entity missile;
+ local vector org;
+
+ sound (self, CHAN_WEAPON, "zombie/z_shot1.wav", 1, ATTN_NORM);
+
+ missile = spawn ();
+ missile.owner = self;
+ missile.movetype = MOVETYPE_BOUNCE;
+ missile.solid = SOLID_BBOX;
+
+// calc org
+ org = self.origin + st_x * v_forward + st_y * v_right + (st_z - 24) * v_up;
+
+// set missile speed
+
+ makevectors (self.angles);
+
+ missile.velocity = normalize(self.enemy.origin - org);
+ missile.velocity = missile.velocity * 600;
+ missile.velocity_z = 200;
+
+ missile.avelocity = '3000 1000 2000';
+
+ missile.touch = ZombieGrenadeTouch;
+
+// set missile duration
+ missile.nextthink = time + 2.5;
+ missile.think = SUB_Remove;
+
+ setmodel (missile, "progs/zom_gib.mdl");
+ setsize (missile, '0 0 0', '0 0 0');
+ setorigin (missile, org);
+};
+
+
+void() zombie_atta1 =[ $atta1, zombie_atta2 ] {ai_face();};
+void() zombie_atta2 =[ $atta2, zombie_atta3 ] {ai_face();};
+void() zombie_atta3 =[ $atta3, zombie_atta4 ] {ai_face();};
+void() zombie_atta4 =[ $atta4, zombie_atta5 ] {ai_face();};
+void() zombie_atta5 =[ $atta5, zombie_atta6 ] {ai_face();};
+void() zombie_atta6 =[ $atta6, zombie_atta7 ] {ai_face();};
+void() zombie_atta7 =[ $atta7, zombie_atta8 ] {ai_face();};
+void() zombie_atta8 =[ $atta8, zombie_atta9 ] {ai_face();};
+void() zombie_atta9 =[ $atta9, zombie_atta10 ] {ai_face();};
+void() zombie_atta10 =[ $atta10, zombie_atta11 ] {ai_face();};
+void() zombie_atta11 =[ $atta11, zombie_atta12 ] {ai_face();};
+void() zombie_atta12 =[ $atta12, zombie_atta13 ] {ai_face();};
+void() zombie_atta13 =[ $atta13, zombie_run1 ] {ai_face();ZombieFireGrenade('-10 -22 30');};
+
+void() zombie_attb1 =[ $attb1, zombie_attb2 ] {ai_face();};
+void() zombie_attb2 =[ $attb2, zombie_attb3 ] {ai_face();};
+void() zombie_attb3 =[ $attb3, zombie_attb4 ] {ai_face();};
+void() zombie_attb4 =[ $attb4, zombie_attb5 ] {ai_face();};
+void() zombie_attb5 =[ $attb5, zombie_attb6 ] {ai_face();};
+void() zombie_attb6 =[ $attb6, zombie_attb7 ] {ai_face();};
+void() zombie_attb7 =[ $attb7, zombie_attb8 ] {ai_face();};
+void() zombie_attb8 =[ $attb8, zombie_attb9 ] {ai_face();};
+void() zombie_attb9 =[ $attb9, zombie_attb10 ] {ai_face();};
+void() zombie_attb10 =[ $attb10, zombie_attb11 ] {ai_face();};
+void() zombie_attb11 =[ $attb11, zombie_attb12 ] {ai_face();};
+void() zombie_attb12 =[ $attb12, zombie_attb13 ] {ai_face();};
+void() zombie_attb13 =[ $attb13, zombie_attb14 ] {ai_face();};
+void() zombie_attb14 =[ $attb13, zombie_run1 ] {ai_face();ZombieFireGrenade('-10 -24 29');};
+
+void() zombie_attc1 =[ $attc1, zombie_attc2 ] {ai_face();};
+void() zombie_attc2 =[ $attc2, zombie_attc3 ] {ai_face();};
+void() zombie_attc3 =[ $attc3, zombie_attc4 ] {ai_face();};
+void() zombie_attc4 =[ $attc4, zombie_attc5 ] {ai_face();};
+void() zombie_attc5 =[ $attc5, zombie_attc6 ] {ai_face();};
+void() zombie_attc6 =[ $attc6, zombie_attc7 ] {ai_face();};
+void() zombie_attc7 =[ $attc7, zombie_attc8 ] {ai_face();};
+void() zombie_attc8 =[ $attc8, zombie_attc9 ] {ai_face();};
+void() zombie_attc9 =[ $attc9, zombie_attc10 ] {ai_face();};
+void() zombie_attc10 =[ $attc10, zombie_attc11 ] {ai_face();};
+void() zombie_attc11 =[ $attc11, zombie_attc12 ] {ai_face();};
+void() zombie_attc12 =[ $attc12, zombie_run1 ] {ai_face();ZombieFireGrenade('-12 -19 29');};
+
+void() zombie_missile =
+{
+ local float r;
+
+ r = random();
+
+ if (r < 0.3)
+ zombie_atta1 ();
+ else if (r < 0.6)
+ zombie_attb1 ();
+ else
+ zombie_attc1 ();
+};
+
+
+/*
+=============================================================================
+
+PAIN
+
+=============================================================================
+*/
+
+void() zombie_paina1 =[ $paina1, zombie_paina2 ] {sound (self, CHAN_VOICE, "zombie/z_pain.wav", 1, ATTN_NORM);};
+void() zombie_paina2 =[ $paina2, zombie_paina3 ] {ai_painforward(3);};
+void() zombie_paina3 =[ $paina3, zombie_paina4 ] {ai_painforward(1);};
+void() zombie_paina4 =[ $paina4, zombie_paina5 ] {ai_pain(1);};
+void() zombie_paina5 =[ $paina5, zombie_paina6 ] {ai_pain(3);};
+void() zombie_paina6 =[ $paina6, zombie_paina7 ] {ai_pain(1);};
+void() zombie_paina7 =[ $paina7, zombie_paina8 ] {};
+void() zombie_paina8 =[ $paina8, zombie_paina9 ] {};
+void() zombie_paina9 =[ $paina9, zombie_paina10 ] {};
+void() zombie_paina10 =[ $paina10, zombie_paina11 ] {};
+void() zombie_paina11 =[ $paina11, zombie_paina12 ] {};
+void() zombie_paina12 =[ $paina12, zombie_run1 ] {};
+
+void() zombie_painb1 =[ $painb1, zombie_painb2 ] {sound (self, CHAN_VOICE, "zombie/z_pain1.wav", 1, ATTN_NORM);};
+void() zombie_painb2 =[ $painb2, zombie_painb3 ] {ai_pain(2);};
+void() zombie_painb3 =[ $painb3, zombie_painb4 ] {ai_pain(8);};
+void() zombie_painb4 =[ $painb4, zombie_painb5 ] {ai_pain(6);};
+void() zombie_painb5 =[ $painb5, zombie_painb6 ] {ai_pain(2);};
+void() zombie_painb6 =[ $painb6, zombie_painb7 ] {};
+void() zombie_painb7 =[ $painb7, zombie_painb8 ] {};
+void() zombie_painb8 =[ $painb8, zombie_painb9 ] {};
+void() zombie_painb9 =[ $painb9, zombie_painb10 ] {sound (self, CHAN_BODY, "zombie/z_fall.wav", 1, ATTN_NORM);};
+void() zombie_painb10 =[ $painb10, zombie_painb11 ] {};
+void() zombie_painb11 =[ $painb11, zombie_painb12 ] {};
+void() zombie_painb12 =[ $painb12, zombie_painb13 ] {};
+void() zombie_painb13 =[ $painb13, zombie_painb14 ] {};
+void() zombie_painb14 =[ $painb14, zombie_painb15 ] {};
+void() zombie_painb15 =[ $painb15, zombie_painb16 ] {};
+void() zombie_painb16 =[ $painb16, zombie_painb17 ] {};
+void() zombie_painb17 =[ $painb17, zombie_painb18 ] {};
+void() zombie_painb18 =[ $painb18, zombie_painb19 ] {};
+void() zombie_painb19 =[ $painb19, zombie_painb20 ] {};
+void() zombie_painb20 =[ $painb20, zombie_painb21 ] {};
+void() zombie_painb21 =[ $painb21, zombie_painb22 ] {};
+void() zombie_painb22 =[ $painb22, zombie_painb23 ] {};
+void() zombie_painb23 =[ $painb23, zombie_painb24 ] {};
+void() zombie_painb24 =[ $painb24, zombie_painb25 ] {};
+void() zombie_painb25 =[ $painb25, zombie_painb26 ] {ai_painforward(1);};
+void() zombie_painb26 =[ $painb26, zombie_painb27 ] {};
+void() zombie_painb27 =[ $painb27, zombie_painb28 ] {};
+void() zombie_painb28 =[ $painb28, zombie_run1 ] {};
+
+void() zombie_painc1 =[ $painc1, zombie_painc2 ] {sound (self, CHAN_VOICE, "zombie/z_pain1.wav", 1, ATTN_NORM);};
+void() zombie_painc2 =[ $painc2, zombie_painc3 ] {};
+void() zombie_painc3 =[ $painc3, zombie_painc4 ] {ai_pain(3);};
+void() zombie_painc4 =[ $painc4, zombie_painc5 ] {ai_pain(1);};
+void() zombie_painc5 =[ $painc5, zombie_painc6 ] {};
+void() zombie_painc6 =[ $painc6, zombie_painc7 ] {};
+void() zombie_painc7 =[ $painc7, zombie_painc8 ] {};
+void() zombie_painc8 =[ $painc8, zombie_painc9 ] {};
+void() zombie_painc9 =[ $painc9, zombie_painc10 ] {};
+void() zombie_painc10 =[ $painc10, zombie_painc11 ] {};
+void() zombie_painc11 =[ $painc11, zombie_painc12 ] {ai_painforward(1);};
+void() zombie_painc12 =[ $painc12, zombie_painc13 ] {ai_painforward(1);};
+void() zombie_painc13 =[ $painc13, zombie_painc14 ] {};
+void() zombie_painc14 =[ $painc14, zombie_painc15 ] {};
+void() zombie_painc15 =[ $painc15, zombie_painc16 ] {};
+void() zombie_painc16 =[ $painc16, zombie_painc17 ] {};
+void() zombie_painc17 =[ $painc17, zombie_painc18 ] {};
+void() zombie_painc18 =[ $painc18, zombie_run1 ] {};
+
+void() zombie_paind1 =[ $paind1, zombie_paind2 ] {sound (self, CHAN_VOICE, "zombie/z_pain.wav", 1, ATTN_NORM);};
+void() zombie_paind2 =[ $paind2, zombie_paind3 ] {};
+void() zombie_paind3 =[ $paind3, zombie_paind4 ] {};
+void() zombie_paind4 =[ $paind4, zombie_paind5 ] {};
+void() zombie_paind5 =[ $paind5, zombie_paind6 ] {};
+void() zombie_paind6 =[ $paind6, zombie_paind7 ] {};
+void() zombie_paind7 =[ $paind7, zombie_paind8 ] {};
+void() zombie_paind8 =[ $paind8, zombie_paind9 ] {};
+void() zombie_paind9 =[ $paind9, zombie_paind10 ] {ai_pain(1);};
+void() zombie_paind10 =[ $paind10, zombie_paind11 ] {};
+void() zombie_paind11 =[ $paind11, zombie_paind12 ] {};
+void() zombie_paind12 =[ $paind12, zombie_paind13 ] {};
+void() zombie_paind13 =[ $paind13, zombie_run1 ] {};
+
+void() zombie_paine1 =[ $paine1, zombie_paine2 ] {
+sound (self, CHAN_VOICE, "zombie/z_pain.wav", 1, ATTN_NORM);
+self.health = 60;
+};
+void() zombie_paine2 =[ $paine2, zombie_paine3 ] {ai_pain(8);};
+void() zombie_paine3 =[ $paine3, zombie_paine4 ] {ai_pain(5);};
+void() zombie_paine4 =[ $paine4, zombie_paine5 ] {ai_pain(3);};
+void() zombie_paine5 =[ $paine5, zombie_paine6 ] {ai_pain(1);};
+void() zombie_paine6 =[ $paine6, zombie_paine7 ] {ai_pain(2);};
+void() zombie_paine7 =[ $paine7, zombie_paine8 ] {ai_pain(1);};
+void() zombie_paine8 =[ $paine8, zombie_paine9 ] {ai_pain(1);};
+void() zombie_paine9 =[ $paine9, zombie_paine10 ] {ai_pain(2);};
+void() zombie_paine10 =[ $paine10, zombie_paine11 ] {
+sound (self, CHAN_BODY, "zombie/z_fall.wav", 1, ATTN_NORM);
+self.solid = SOLID_NOT;
+};
+void() zombie_paine11 =[ $paine11, zombie_paine12 ] {self.nextthink = self.nextthink + 5;self.health = 60;};
+void() zombie_paine12 =[ $paine12, zombie_paine13 ]{
+// see if ok to stand up
+self.health = 60;
+sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_IDLE);
+self.solid = SOLID_SLIDEBOX;
+if (!walkmove (0, 0))
+{
+ self.think = zombie_paine11;
+ self.solid = SOLID_NOT;
+ return;
+}
+};
+void() zombie_paine13 =[ $paine13, zombie_paine14 ] {};
+void() zombie_paine14 =[ $paine14, zombie_paine15 ] {};
+void() zombie_paine15 =[ $paine15, zombie_paine16 ] {};
+void() zombie_paine16 =[ $paine16, zombie_paine17 ] {};
+void() zombie_paine17 =[ $paine17, zombie_paine18 ] {};
+void() zombie_paine18 =[ $paine18, zombie_paine19 ] {};
+void() zombie_paine19 =[ $paine19, zombie_paine20 ] {};
+void() zombie_paine20 =[ $paine20, zombie_paine21 ] {};
+void() zombie_paine21 =[ $paine21, zombie_paine22 ] {};
+void() zombie_paine22 =[ $paine22, zombie_paine23 ] {};
+void() zombie_paine23 =[ $paine23, zombie_paine24 ] {};
+void() zombie_paine24 =[ $paine24, zombie_paine25 ] {};
+void() zombie_paine25 =[ $paine25, zombie_paine26 ] {ai_painforward(5);};
+void() zombie_paine26 =[ $paine26, zombie_paine27 ] {ai_painforward(3);};
+void() zombie_paine27 =[ $paine27, zombie_paine28 ] {ai_painforward(1);};
+void() zombie_paine28 =[ $paine28, zombie_paine29 ] {ai_pain(1);};
+void() zombie_paine29 =[ $paine29, zombie_paine30 ] {};
+void() zombie_paine30 =[ $paine30, zombie_run1 ] {};
+
+void() zombie_die =
+{
+ sound (self, CHAN_VOICE, "zombie/z_gib.wav", 1, ATTN_NORM);
+ ThrowHead ("progs/h_zombie.mdl", self.health);
+ ThrowGib ("progs/gib1.mdl", self.health);
+ ThrowGib ("progs/gib2.mdl", self.health);
+ ThrowGib ("progs/gib3.mdl", self.health);
+};
+
+/*
+=================
+zombie_pain
+
+Zombies can only be killed (gibbed) by doing 60 hit points of damage
+in a single frame (rockets, grenades, quad shotgun, quad nailgun).
+
+A hit of 25 points or more (super shotgun, quad nailgun) will allways put it
+down to the ground.
+
+A hit of from 10 to 40 points in one frame will cause it to go down if it
+has been twice in two seconds, otherwise it goes into one of the four
+fast pain frames.
+
+A hit of less than 10 points of damage (winged by a shotgun) will be ignored.
+
+FIXME: don't use pain_finished because of nightmare hack
+=================
+*/
+void(entity attacker, float take) zombie_pain =
+{
+ local float r;
+
+ self.health = 60; // allways reset health
+
+ if (take < 9)
+ return; // totally ignore
+
+ if (self.inpain == 2)
+ return; // down on ground, so don't reset any counters
+
+// go down immediately if a big enough hit
+ if (take >= 25)
+ {
+ self.inpain = 2;
+ zombie_paine1 ();
+ return;
+ }
+
+ if (self.inpain)
+ {
+// if hit again in next gre seconds while not in pain frames, definately drop
+ self.pain_finished = time + 3;
+ return; // currently going through an animation, don't change
+ }
+
+ if (self.pain_finished > time)
+ {
+// hit again, so drop down
+ self.inpain = 2;
+ zombie_paine1 ();
+ return;
+ }
+
+// gp into one of the fast pain animations
+ self.inpain = 1;
+
+ r = random();
+ if (r < 0.25)
+ zombie_paina1 ();
+ else if (r < 0.5)
+ zombie_painb1 ();
+ else if (r < 0.75)
+ zombie_painc1 ();
+ else
+ zombie_paind1 ();
+};
+
+//============================================================================
+
+/*QUAKED monster_zombie (1 0 0) (-16 -16 -24) (16 16 32) Crucified ambush
+
+If crucified, stick the bounding box 12 pixels back into a wall to look right.
+*/
+void() monster_zombie =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+
+ precache_model ("progs/zombie.mdl");
+ precache_model ("progs/h_zombie.mdl");
+ precache_model ("progs/zom_gib.mdl");
+
+ precache_sound ("zombie/z_idle.wav");
+ precache_sound ("zombie/z_idle1.wav");
+ precache_sound ("zombie/z_shot1.wav");
+ precache_sound ("zombie/z_gib.wav");
+ precache_sound ("zombie/z_pain.wav");
+ precache_sound ("zombie/z_pain1.wav");
+ precache_sound ("zombie/z_fall.wav");
+ precache_sound ("zombie/z_miss.wav");
+ precache_sound ("zombie/z_hit.wav");
+ precache_sound ("zombie/idle_w2.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/zombie.mdl");
+
+ setsize (self, '-16 -16 -24', '16 16 40');
+ self.health = 60;
+
+ self.th_stand = zombie_stand1;
+ self.th_walk = zombie_walk1;
+ self.th_run = zombie_run1;
+ self.th_pain = zombie_pain;
+ self.th_die = zombie_die;
+ self.th_missile = zombie_missile;
+
+ if (self.spawnflags & SPAWN_CRUCIFIED)
+ {
+ self.movetype = MOVETYPE_NONE;
+ zombie_cruc1 ();
+ }
+ else
+ walkmonster_start();
+};
diff --git a/r17/Revamped src/Revamped QC/ai.qc b/r17/Revamped src/Revamped QC/ai.qc
new file mode 100755
index 00000000..16169f77
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/ai.qc
@@ -0,0 +1,751 @@
+void() t_movetarget;
+/*
+
+.enemy
+Will be world if not currently angry at anyone.
+
+.movetarget
+The next path spot to walk toward. If .enemy, ignore .movetarget.
+When an enemy is killed, the monster will try to return to it's path.
+
+.huntt_ime
+Set to time + something when the player is in sight, but movement straight for
+him is blocked. This causes the monster to use wall following code for
+movement direction instead of sighting on the player.
+
+.ideal_yaw
+A yaw angle of the intended direction, which will be turned towards at up
+to 45 deg / state. If the enemy is in view and hunt_time is not active,
+this will be the exact line towards the enemy.
+
+.pausetime
+A monster will leave it's stand state and head towards it's .movetarget when
+time > .pausetime.
+
+walkmove(angle, speed) primitive is all or nothing
+*/
+
+//
+// when a monster becomes angry at a player, that monster will be used
+// as the sight target the next frame so that monsters near that one
+// will wake up even if they wouldn't have noticed the player
+//
+entity sight_entity;
+float sight_entity_time;
+
+float(float v) anglemod =
+{
+ while (v >= 360)
+ v = v - 360;
+ while (v < 0)
+ v = v + 360;
+ return v;
+};
+
+/*
+==============================================================================
+
+MOVETARGET CODE
+
+The angle of the movetarget effects standing and bowing direction, but has no effect on movement, which allways heads to the next target.
+
+targetname
+must be present. The name of this movetarget.
+
+target
+the next spot to move to. If not present, stop here for good.
+
+pausetime
+The number of seconds to spend standing or bowing for path_stand or path_bow
+
+==============================================================================
+*/
+
+
+void() movetarget_f =
+{
+ if (!self.targetname)
+ objerror ("monster_movetarget: no targetname");
+
+ self.solid = SOLID_TRIGGER;
+ self.touch = t_movetarget;
+ setsize (self, '-8 -8 -8', '8 8 8');
+
+};
+
+/*QUAKED path_corner (0.5 0.3 0) (-8 -8 -8) (8 8 8)
+Monsters will continue walking towards the next target corner.
+*/
+void() path_corner =
+{
+ movetarget_f ();
+};
+
+
+/*
+=============
+t_movetarget
+
+Something has bumped into a movetarget. If it is a monster
+moving towards it, change the next destination and continue.
+==============
+*/
+void() t_movetarget =
+{
+local entity temp;
+
+ if (other.movetarget != self)
+ return;
+
+ if (other.enemy)
+ return; // fighting, not following a path
+
+ temp = self;
+ self = other;
+ other = temp;
+
+ if (self.classname == "monster_ogre")
+ sound (self, CHAN_VOICE, "ogre/ogdrag.wav", 1, ATTN_IDLE);// play chainsaw drag sound
+
+//dprint ("t_movetarget\n");
+ self.goalentity = self.movetarget = find (world, targetname, other.target);
+ self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
+ if (!self.movetarget)
+ {
+ self.pausetime = time + 999999;
+ self.th_stand ();
+ return;
+ }
+};
+
+
+
+//============================================================================
+
+/*
+=============
+range
+
+returns the range catagorization of an entity reletive to self
+0 melee range, will become hostile even if back is turned
+1 visibility and infront, or visibility and show hostile
+2 infront and show hostile
+3 only triggered by damage
+=============
+*/
+float(entity targ) range =
+{
+ local vector spot1, spot2;
+ local float r;
+
+ spot1 = self.origin + self.view_ofs;
+ spot2 = targ.origin + targ.view_ofs;
+
+ r = vlen (spot1 - spot2);
+ if (r < 120)
+ return RANGE_MELEE;
+ if (r < 500)
+ return RANGE_NEAR;
+ if (r < 1000)
+ return RANGE_MID;
+ return RANGE_FAR;
+};
+
+/*
+=============
+visible
+
+returns 1 if the entity is visible to self, even if not infront ()
+=============
+*/
+BOOL (entity targ) visible =
+{
+ local vector spot1, spot2;
+
+ spot1 = self.origin + self.view_ofs;
+ spot2 = targ.origin + targ.view_ofs;
+ traceline (spot1, spot2, TRUE, self); // see through other monsters
+
+ if (trace_inopen && trace_inwater)
+ return FALSE; // sight line crossed contents
+
+ if (trace_fraction == 1)
+ return TRUE;
+ return FALSE;
+};
+
+
+/*
+=============
+infront
+
+returns 1 if the entity is in front (in sight) of self
+=============
+*/
+BOOL(entity targ) infront =
+{
+ local vector vec;
+ local float dot;
+
+ makevectors (self.angles);
+ vec = normalize (targ.origin - self.origin);
+ dot = vec * v_forward;
+
+ if ( dot > 0.3)
+ {
+ return TRUE;
+ }
+ return FALSE;
+};
+
+
+//============================================================================
+
+/*
+===========
+ChangeYaw
+
+Turns towards self.ideal_yaw at self.yaw_speed
+Sets the global variable current_yaw
+Called every 0.1 sec by monsters
+============
+*/
+/*
+void() ChangeYaw =
+{
+ local float ideal, move, current_yaw;
+
+//current_yaw = self.ideal_yaw;
+// mod down the current angle
+ current_yaw = anglemod( self.angles_y );
+ ideal = self.ideal_yaw;
+
+ if (current_yaw == ideal)
+ return;
+
+ move = ideal - current_yaw;
+ if (ideal > current_yaw)
+ {
+ if (move > 180)
+ move = move - 360;
+ }
+ else
+ {
+ if (move < -180)
+ move = move + 360;
+ }
+
+ if (move > 0)
+ {
+ if (move > self.yaw_speed)
+ move = self.yaw_speed;
+ }
+ else
+ {
+ if (move < 0-self.yaw_speed )
+ move = 0-self.yaw_speed;
+ }
+
+ current_yaw = anglemod (current_yaw + move);
+
+ self.angles_y = current_yaw;
+};
+*/
+
+
+//============================================================================
+
+void() HuntTarget =
+{
+ self.goalentity = self.enemy;
+ self.think = self.th_run;
+ self.ideal_yaw = vectoyaw(self.enemy.origin - self.origin);
+ self.nextthink = time + 0.1;
+ SUB_AttackFinished (1); // wait a while before first attack
+};
+
+void() SightSound =
+{
+ local float rsnd;
+ local string s;
+
+ switch (self.classname)
+ {
+ case "monster_ogre":
+ s = "ogre/ogwake.wav";
+ break;
+ case "monster_knight":
+ s = "knight/ksight.wav";
+ break;
+ case "monster_shambler":
+ s = "shambler/ssight.wav";
+ break;
+ case "monster_demon1":
+ s = "demon/sight2.wav";
+ break;
+ case "monster_wizard":
+ s = "wizard/wsight.wav";
+ break;
+ case "monster_zombie":
+ s = "zombie/z_idle.wav";
+ break;
+ case "monster_dog":
+ s = "dog/dsight.wav";
+ break;
+ case "monster_hell_knight":
+ s = "hknight/sight1.wav";
+ break;
+ case "monster_tarbaby":
+ s = "blob/sight1.wav";
+ break;
+ case "monster_enforcer":
+ rsnd = random();
+ if (rsnd < 0.25)
+ s = "enforcer/sight1.wav";
+ else if (rsnd < 0.5)
+ s = "enforcer/sight2.wav";
+ else if (rsnd < 0.75)
+ s = "enforcer/sight3.wav";
+ else
+ s = "enforcer/sight4.wav";
+ break;
+ case "monster_shalrath":
+ s = "shalrath/sight.wav";
+ break;
+ default:
+ s = "soldier/sight1.wav";
+ }
+
+ sound (self, CHAN_VOICE, s, 1, ATTN_NORM);
+};
+
+void() FoundTarget =
+{
+ if (self.enemy.classname == "player")
+ { // let other monsters see this monster for a while
+ sight_entity = self;
+ sight_entity_time = time;
+ }
+
+ self.show_hostile = time + 1; // wake up other monsters
+
+ SightSound ();
+ HuntTarget ();
+};
+
+/*
+===========
+FindTarget
+
+Self is currently not attacking anything, so try to find a target
+
+Returns TRUE if an enemy was sighted
+
+When a player fires a missile, the point of impact becomes a fakeplayer so
+that monsters that see the impact will respond as if they had seen the
+player.
+
+To avoid spending too much time, only a single client (or fakeclient) is
+checked each frame. This means multi player games will have slightly
+slower noticing monsters.
+============
+*/
+BOOL() FindTarget =
+{
+ local entity client;
+ local float r;
+
+// if the first spawnflag bit is set, the monster will only wake up on
+// really seeing the player, not another monster getting angry
+
+// 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 && !(self.spawnflags & 3) )
+ {
+ client = sight_entity;
+ if (client.enemy == self.enemy)
+ return TRUE;
+ }
+ else
+ {
+ client = checkclient ();
+ if (!client)
+ return FALSE; // current check entity isn't in PVS
+ }
+
+ if (client == self.enemy)
+ return FALSE;
+
+ if (client.flags & FL_NOTARGET)
+ return FALSE;
+ if (client.items & IT_INVISIBILITY)
+ return FALSE;
+
+ r = range (client);
+ if (r == RANGE_FAR)
+ return FALSE;
+
+ if (!visible (client))
+ return FALSE;
+
+ if (r == RANGE_NEAR)
+ {
+ if (client.show_hostile < time && !infront (client))
+ return FALSE;
+ }
+ else if (r == RANGE_MID)
+ {
+ if ( /* client.show_hostile < time || */ !infront (client))
+ return FALSE;
+ }
+
+//
+// got one
+//
+ self.enemy = client;
+ if (self.enemy.classname != "player")
+ {
+ self.enemy = self.enemy.enemy;
+ if (self.enemy.classname != "player")
+ {
+ self.enemy = world;
+ return FALSE;
+ }
+ }
+
+ FoundTarget ();
+
+ return TRUE;
+};
+
+
+//=============================================================================
+
+void(float dist) ai_forward =
+{
+ walkmove (self.angles_y, dist);
+};
+
+void(float dist) ai_back =
+{
+ walkmove ( (self.angles_y+180), dist);
+};
+
+
+/*
+=============
+ai_pain
+
+stagger back a bit
+=============
+*/
+void(float dist) ai_pain =
+{
+ ai_back (dist);
+/*
+ local float away;
+
+ away = anglemod (vectoyaw (self.origin - self.enemy.origin)
+ + 180*(random()- 0.5) );
+
+ walkmove (away, dist);
+*/
+};
+
+/*
+=============
+ai_painforward
+
+stagger back a bit
+=============
+*/
+void(float dist) ai_painforward =
+{
+ walkmove (self.ideal_yaw, dist);
+};
+
+/*
+=============
+ai_walk
+
+The monster is walking it's beat
+=============
+*/
+void(float dist) ai_walk =
+{
+// movedist = dist;
+
+ /*
+ There are no dragons!
+ if (self.classname == "monster_dragon")
+ {
+ movetogoal (dist);
+ return;
+ }
+ */
+
+ // check for noticing a player
+ if (FindTarget ())
+ return;
+
+ movetogoal (dist);
+};
+
+
+/*
+=============
+ai_stand
+
+The monster is staying in one place for a while, with slight angle turns
+=============
+*/
+void() ai_stand =
+{
+ if (FindTarget ())
+ return;
+
+ if (time > self.pausetime)
+ {
+ self.th_walk ();
+ return;
+ }
+
+// change angle slightly
+
+};
+
+/*
+=============
+ai_turn
+
+don't move, but turn towards ideal_yaw
+=============
+*/
+void() ai_turn =
+{
+ if (FindTarget ())
+ return;
+
+ ChangeYaw ();
+};
+
+//=============================================================================
+
+/*
+=============
+ChooseTurn
+=============
+*/
+/*
+void(vector dest3) ChooseTurn =
+{
+ local vector dir, newdir;
+
+ dir = self.origin - dest3;
+
+ newdir_x = trace_plane_normal_y;
+ newdir_y = 0 - trace_plane_normal_x;
+ newdir_z = 0;
+
+ if (dir * newdir > 0)
+ {
+ dir_x = 0 - trace_plane_normal_y;
+ dir_y = trace_plane_normal_x;
+ }
+ else
+ {
+ dir_x = trace_plane_normal_y;
+ dir_y = 0 - trace_plane_normal_x;
+ }
+
+ dir_z = 0;
+ self.ideal_yaw = vectoyaw(dir);
+};
+*/
+
+/*
+============
+FacingIdeal
+
+============
+*/
+BOOL() FacingIdeal =
+{
+ local float delta;
+
+ delta = anglemod(self.angles_y - self.ideal_yaw);
+ if (delta > 45 && delta < 315)
+ return FALSE;
+ return TRUE;
+};
+
+
+//=============================================================================
+BOOL(float enemy_range) DogCheckAttack;
+BOOL(float enemy_range) WizardCheckAttack;
+BOOL(float enemy_range) DemonCheckAttack;
+
+BOOL(float enemy_range) CheckAnyAttack =
+{
+
+ switch (self.classname)
+ {
+ case "monster_army":
+ return SoldierCheckAttack (enemy_range);
+ case "monster_ogre":
+ return OgreCheckAttack (enemy_range);
+ case "monster_shambler":
+ return ShamCheckAttack (enemy_range);
+ case "monster_demon1":
+ return DemonCheckAttack (enemy_range);
+ case "monster_dog":
+ return DogCheckAttack (enemy_range);
+ case "monster_wizard":
+ return WizardCheckAttack (enemy_range);
+ }
+
+ return CheckAttack (enemy_range);
+};
+
+
+/*
+=============
+ai_run_melee
+
+Turn and close until within an angle to launch a melee attack
+=============
+*/
+void(float enemy_yaw) ai_run_melee =
+{
+ self.ideal_yaw = enemy_yaw;
+ ChangeYaw ();
+
+ if (FacingIdeal())
+ {
+ self.th_melee ();
+ self.attack_state = AS_STRAIGHT;
+ }
+};
+
+
+/*
+=============
+ai_run_missile
+
+Turn in place until within an angle to launch a missile attack
+=============
+*/
+void(float enemy_yaw) ai_run_missile =
+{
+ self.ideal_yaw = enemy_yaw;
+ ChangeYaw ();
+ if (FacingIdeal())
+ {
+ self.th_missile ();
+ self.attack_state = AS_STRAIGHT;
+ }
+};
+
+
+/*
+=============
+ai_run_slide
+
+Strafe sideways, but stay at aproximately the same range
+=============
+*/
+void(float enemy_yaw, float movedist) ai_run_slide =
+{
+ local float ofs;
+
+ self.ideal_yaw = enemy_yaw;
+ ChangeYaw ();
+ if (self.lefty)
+ ofs = 90;
+ else
+ ofs = -90;
+
+ if (walkmove (self.ideal_yaw + ofs, movedist))
+ return;
+
+ self.lefty = 1 - self.lefty;
+
+ walkmove (self.ideal_yaw - ofs, movedist);
+};
+
+/*
+=============
+ai_run
+
+The monster has an enemy it is trying to kill
+=============
+*/
+void(float dist) ai_run =
+{
+ local float enemy_vis, enemy_yaw;
+
+// see if the enemy is dead
+ if (self.enemy.health <= 0)
+ {
+ self.enemy = world;
+ // FIXME: look all around for other targets
+ if (self.oldenemy.health > 0)
+ {
+ self.enemy = self.oldenemy;
+ HuntTarget ();
+ }
+ else
+ {
+ if (self.movetarget)
+ self.th_walk ();
+ else
+ self.th_stand ();
+ return;
+ }
+ }
+
+ self.show_hostile = time + 1; // wake up other monsters
+
+// check knowledge of enemy
+ enemy_vis = visible(self.enemy);
+ if (enemy_vis)
+ self.search_time = time + 5;
+
+// look for other coop players
+ if (coop && self.search_time < time)
+ {
+ if (FindTarget ())
+ return;
+ }
+
+ enemy_yaw = vectoyaw(self.enemy.origin - self.origin);
+
+ if (self.attack_state == AS_MISSILE)
+ {
+ ai_run_missile (enemy_yaw);
+ return;
+ }
+ if (self.attack_state == AS_MELEE)
+ {
+ ai_run_melee (enemy_yaw);
+ return;
+ }
+
+ if (!enemy_vis)
+ return;
+
+ if (CheckAnyAttack (range(self.enemy)))
+ return; // beginning an attack
+
+ if (self.attack_state == AS_SLIDING)
+ {
+ ai_run_slide (enemy_yaw, dist);
+ return;
+ }
+
+// head straight in
+ movetogoal (dist); // done in C code...
+};
+
+
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/basemod.txt b/r17/Revamped src/Revamped QC/basemod.txt
new file mode 100755
index 00000000..d93e8ef0
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/basemod.txt
@@ -0,0 +1,42 @@
+Incomplete -
+Triggered kills (explobox, etc)
+Q2/Q3 ents
+HL ents
+
+Done -
+Cleanup warnings
+Fix QW bugs
+Heal decay (over maxhealth)
+INTEGER mod
+Nailgun frame seperation
+Body queue change
+Suicide timer limit
+Suicide backpack/quad/ring drop
+Condense bprint, sprint, centerprints
+te_explode sprite
+NQ/QW cross compatibility
+Track oldbutton presses/weaponstate
+Generic projectile spawning
+Usage of ammo_shells, etc as display
+
+In progress -
+Item fixing for SP
+Add monsters back
+
+Todo -
+Fix ammo_shells, etc for monsters/backpacks
+Samelevel 4 (exit acts as a spawnpoint teleporter)
+Effects/decal system
+Fix weird deathmatch modes, cvar checking
+Rogue/hipnotic weapons/monsters/hud stuffs
+H2 ents
+Coop friendly finale
+Add in shambler resistance in a better way
+
+Stray Ideas -
+Advanced heal decay (only decay health that the megahealth added?)
+Clean up backpack pickup prints?
+Decal system based on visibility from players?
+CSQC?
+Don't use newmis/spawn projectiles in front?
+sv_gravity change?
diff --git a/r17/Revamped src/Revamped QC/bindings.qc b/r17/Revamped src/Revamped QC/bindings.qc
new file mode 100755
index 00000000..120486db
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/bindings.qc
@@ -0,0 +1,42 @@
+void ()
+player_bindings =
+{
+ stuffcmd (self, "r_novis 0\n");
+ stuffcmd (self, "alias r_novis \n");
+ stuffcmd (self, "r_wateralpha 1\n");
+ stuffcmd (self, "alias r_wateralpha echo r_wateralpha has been disabled on this server.\n");
+ stuffcmd (self, "chase_active 0\n");
+ stuffcmd (self, "alias chase_active echo chase_active has been disabled on this server.\n");
+ stuffcmd (self, "r_draworder 0\n");
+ stuffcmd (self, "alias r_draworder echo r_draworder has been disabled on this server.\n");
+ stuffcmd (self, "alias scr_ofsx echo screen offsets have been disabled on this server.\n");
+ stuffcmd (self, "alias scr_ofsy echo screen offsets have been disabled on this server.\n");
+ stuffcmd (self, "alias scr_ofsz echo screen offsets have been disabled on this server.\n");
+
+ vote_aliases ();
+ self.pflag = self.pflag | POQ_BINDINGS_SENT;
+
+ bprint ("Player Bindings Sent\n");
+};
+
+void ()
+player_bindings_think =
+{
+ local entity e;
+
+ e = self;
+ self = e.owner;
+ remove (e);
+ player_bindings ();
+};
+
+void ()
+player_bindings_begin =
+{
+ local entity e;
+
+ e = spawn ();
+ e.owner = self;
+ e.think = player_bindings_think;
+ e.nextthink = time + 2;
+};
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/buttons.qc b/r17/Revamped src/Revamped QC/buttons.qc
new file mode 100755
index 00000000..4e85b3e8
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/buttons.qc
@@ -0,0 +1,138 @@
+// button and multiple button
+
+void() button_wait;
+void() button_return;
+
+void() button_wait =
+{
+ self.state = STATE_TOP;
+ self.nextthink = self.ltime + self.wait;
+ self.think = button_return;
+ activator = self.enemy;
+ SUB_UseTargets();
+ self.frame = 1; // use alternate textures
+};
+
+void() button_done =
+{
+ self.state = STATE_BOTTOM;
+};
+
+void() button_return =
+{
+ self.state = STATE_DOWN;
+ SUB_CalcMove (self.pos1, self.speed, button_done);
+ self.frame = 0; // use normal textures
+ if (self.health)
+ self.takedamage = DAMAGE_YES; // can be shot again
+};
+
+
+void() button_blocked =
+{ // do nothing, just don't ome all the way back out
+};
+
+
+void() button_fire =
+{
+ if (self.state == STATE_UP || self.state == STATE_TOP)
+ return;
+
+ sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
+
+ self.state = STATE_UP;
+ SUB_CalcMove (self.pos2, self.speed, button_wait);
+};
+
+
+void() button_use =
+{
+ self.enemy = activator;
+ button_fire ();
+};
+
+void() button_touch =
+{
+ if (other.classname != "player")
+ return;
+ self.enemy = other;
+ button_fire ();
+};
+
+void() button_killed =
+{
+ self.enemy = damage_attacker;
+ self.health = self.max_health;
+ self.takedamage = DAMAGE_NO; // wil be reset upon return
+ button_fire ();
+};
+
+
+/*QUAKED func_button (0 .5 .8) ?
+When a button is touched, it moves some distance in the direction of it's angle, triggers all of it's targets, waits some time, then returns to it's original position where it can be triggered again.
+
+"angle" determines the opening direction
+"target" all entities with a matching targetname will be used
+"speed" override the default 40 speed
+"wait" override the default 1 second wait (-1 = never return)
+"lip" override the default 4 pixel lip remaining at end of move
+"health" if set, the button must be killed instead of touched
+"sounds"
+0) steam metal
+1) wooden clunk
+2) metallic click
+3) in-out
+*/
+void() func_button =
+{
+ switch (self.sounds)
+ {
+ case 0:
+ precache_sound ("buttons/airbut1.wav");
+ self.noise = "buttons/airbut1.wav";
+ break;
+ case 1:
+ precache_sound ("buttons/switch21.wav");
+ self.noise = "buttons/switch21.wav";
+ break;
+ case 2:
+ precache_sound ("buttons/switch02.wav");
+ self.noise = "buttons/switch02.wav";
+ break;
+ case 3:
+ precache_sound ("buttons/switch04.wav");
+ self.noise = "buttons/switch04.wav";
+ break;
+ }
+
+ SetMovedir ();
+
+ self.movetype = MOVETYPE_PUSH;
+ self.solid = SOLID_BSP;
+ setmodel (self, self.model);
+
+ self.blocked = button_blocked;
+ self.use = button_use;
+
+ if (self.health)
+ {
+ self.max_health = self.health;
+ self.th_die = button_killed;
+ self.takedamage = DAMAGE_YES;
+ }
+ else
+ self.touch = button_touch;
+
+ if (!self.speed)
+ self.speed = 40;
+ if (!self.wait)
+ self.wait = 1;
+ if (!self.lip)
+ self.lip = 4;
+
+ self.state = STATE_BOTTOM;
+
+ self.pos1 = self.origin;
+ self.pos2 = self.pos1 + self.movedir*(fabs(self.movedir*self.size) - self.lip);
+};
+
diff --git a/r17/Revamped src/Revamped QC/client.qc b/r17/Revamped src/Revamped QC/client.qc
new file mode 100755
index 00000000..f20d7e57
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/client.qc
@@ -0,0 +1,1518 @@
+
+// prototypes
+void () W_WeaponFrame;
+void (float weap) W_WeaponSwitch;
+void() player_pain;
+void() player_stand1;
+void (vector org) spawn_tfog;
+void (vector org, entity death_owner) spawn_tdeath;
+
+float modelindex_eyes, modelindex_player;
+
+/*
+=============================================================================
+
+ LEVEL CHANGING / INTERMISSION
+
+=============================================================================
+*/
+
+string nextmap;
+
+/*QUAKED info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16)
+This is the camera point for the intermission.
+Use mangle instead of angle, so you can set pitch or roll as well as yaw. 'pitch roll yaw'
+*/
+void() info_intermission =
+{
+ self.angles = self.mangle; // so C can get at it
+};
+
+
+
+void() SetChangeParms =
+{
+ if (self.health <= 0)
+ {
+ SetNewParms ();
+ return;
+ }
+
+// cap super health
+ if (self.health > 130)
+ self.health = 130;
+ if (self.health < 50)
+ self.health = 50;
+ parm1 = self.items;
+ parm2 = self.health;
+ parm3 = self.armorvalue;
+ parm4 = 12;
+ /*
+ if (self.ammo_shells_real < 25)
+ parm4 = 25;
+ else
+ parm4 = self.ammo_shells_real;
+ */
+ parm5 = self.ammo_nails_real;
+ parm6 = self.ammo_rockets_real;
+ parm7 = self.ammo_cells_real;
+ parm8 = self.weapon;
+ parm9 = self.armortype;
+ // Solitude
+ parm10 = self.exshells;
+ parm11 = self.exnails;
+ parm12 = self.exrockets;
+ parm13 = self.excells;
+ parm14 = self.ammo_shells2;
+ parm15 = self.exshells2;
+ parm16 = self.nade_lives;
+};
+
+void() SetNewParms =
+{
+ parm1 = WEAPON_AR + WEAPON_PPISTOL; // start Assault rifle
+ parm2 = 130;
+ parm3 = 0;
+ parm4 = 0;
+ //parm4 = 25;
+ parm5 = 0;
+ parm6 = 0;
+ parm7 = 0;
+ parm8 = WEAPON_AR; // start Assault rifle
+ parm9 = 0;
+ // Solitude
+ parm10 = 60;
+ parm11 = 560;
+ parm12 = MSG_BROADCAST;
+ parm13 = MSG_BROADCAST;
+ parm14 = SVC_INTERMISSION;
+ parm15 = 60;
+ parm16 = 4;
+};
+
+void() DecodeLevelParms =
+{
+ if (!deathmatch)
+ {
+ if (world.model == "maps/start.bsp")
+ SetNewParms (); // take away all stuff on starting new episode
+ }
+
+ self.items = parm1;
+ self.health = parm2;
+ self.armorvalue = parm3;
+ self.ammo_shells_real = parm4;
+ self.ammo_nails_real = parm5;
+ self.ammo_rockets_real = parm6;
+ self.ammo_cells_real = parm7;
+ self.weapon = parm8;
+ self.armortype = parm9;
+ // solitude
+ self.ammo_hshells = 0;
+ self.exhshells = 0;
+ self.exshells = 0;
+ self.exnails = 0;
+ self.exrockets = 0;
+ self.excells = 0;
+ self.ammo_shells2 = 0;
+ self.exshells2 = 0;
+ self.nade_lives = parm16;
+ self.plasma_lives = parm16;
+ // weapon we start with:
+};
+
+/*
+============
+FindIntermission
+
+Returns the entity to view from
+============
+*/
+entity() FindIntermission =
+{
+ local entity spot;
+ local float cyc;
+
+// look for info_intermission first
+ spot = find (world, classname, "info_intermission");
+ if (spot)
+ { // pick a random one
+ cyc = random() * 4;
+ while (cyc > 1)
+ {
+ spot = find (spot, classname, "info_intermission");
+ if (!spot)
+ spot = find (spot, classname, "info_intermission");
+ cyc = cyc - 1;
+ }
+ return spot;
+ }
+
+// then look for the start position
+ spot = find (world, classname, "info_player_start");
+ if (spot)
+ return spot;
+
+ objerror ("FindIntermission: no spot");
+ return world; // remove warning
+};
+
+void() GotoNextMap =
+{
+ local string newmap;
+
+//ZOID: 12-13-96, samelevel is overloaded, only 1 works for same level
+
+ if (cvar("samelevel") == 1) // if samelevel is set, stay on same level
+ changelevel (mapname);
+ else {
+ // configurable map lists, see if the current map exists as a
+ // serverinfo/localinfo var
+ newmap = stringserverinfokey(mapname);
+ if (newmap != "")
+ changelevel (newmap);
+ else
+ changelevel (nextmap);
+ }
+};
+
+void() ExitIntermission=
+{
+// skip any text in deathmatch
+ if (deathmatch)
+ {
+ GotoNextMap ();
+ return;
+ }
+
+ intermission_exittime = time + 1;
+ intermission_running = intermission_running + 1;
+
+//
+// run some text if at the end of an episode
+//
+ if (intermission_running == 2)
+ {
+ if (world.model == "maps/e1m7.bsp")
+ {
+ ENG_SwitchTrack(2, 3);
+ if (!cvar("registered"))
+ {
+ WriteByte (MSG_ALL, SVC_FINALE);
+ WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task in the other three\nhaunted lands of Quake. Or are you? If\nyou don't register Quake, you'll never\nknow what awaits you in the Realm of\nBlack Magic, the Netherworld, and the\nElder World!");
+ }
+ else
+ {
+ WriteByte (MSG_ALL, SVC_FINALE);
+ WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task. A Rune of magic\npower lies at the end of each haunted\nland of Quake. Go forth, seek the\ntotality of the four Runes!");
+ }
+ return;
+ }
+ else if (world.model == "maps/e2m6.bsp")
+ {
+ ENG_SwitchTrack(2, 3);
+ WriteByte (MSG_ALL, SVC_FINALE);
+ WriteString (MSG_ALL, "The Rune of Black Magic throbs evilly in\nyour hand and whispers dark thoughts\ninto your brain. You learn the inmost\nlore of the Hell-Mother; Shub-Niggurath!\nYou now know that she is behind all the\nterrible plotting which has led to so\nmuch death and horror. But she is not\ninviolate! Armed with this Rune, you\nrealize that once all four Runes are\ncombined, the gate to Shub-Niggurath's\nPit will open, and you can face the\nWitch-Goddess herself in her frightful\notherworld cathedral.");
+ return;
+ }
+ else if (world.model == "maps/e3m6.bsp")
+ {
+ ENG_SwitchTrack(2, 3);
+ WriteByte (MSG_ALL, SVC_FINALE);
+ WriteString (MSG_ALL, "The charred viscera of diabolic horrors\nbubble viscously as you seize the Rune\nof Hell Magic. Its heat scorches your\nhand, and its terrible secrets blight\nyour mind. Gathering the shreds of your\ncourage, you shake the devil's shackles\nfrom your soul, and become ever more\nhard and determined to destroy the\nhideous creatures whose mere existence\nthreatens the souls and psyches of all\nthe population of Earth.");
+ return;
+ }
+ else if (world.model == "maps/e4m7.bsp")
+ {
+ ENG_SwitchTrack(2, 3);
+ WriteByte (MSG_ALL, SVC_FINALE);
+ WriteString (MSG_ALL, "Despite the awful might of the Elder\nWorld, you have achieved the Rune of\nElder Magic, capstone of all types of\narcane wisdom. Beyond good and evil,\nbeyond life and death, the Rune\npulsates, heavy with import. Patient and\npotent, the Elder Being Shub-Niggurath\nweaves her dire plans to clear off all\nlife from the Earth, and bring her own\nfoul offspring to our world! For all the\ndwellers in these nightmare dimensions\nare her descendants! Once all Runes of\nmagic power are united, the energy\nbehind them will blast open the Gateway\nto Shub-Niggurath, and you can travel\nthere to foil the Hell-Mother's plots\nin person.");
+ return;
+ }
+
+ GotoNextMap();
+ }
+
+ if (intermission_running == 3)
+ {
+ if (!cvar("registered"))
+ { // shareware episode has been completed, go to sell screen
+ WriteByte (MSG_ALL, SVC_SELLSCREEN);
+ return;
+ }
+
+ if ( (serverflags&15) == 15)
+ {
+ WriteByte (MSG_ALL, SVC_FINALE);
+ WriteString (MSG_ALL, "Now, you have all four Runes. You sense\ntremendous invisible forces moving to\nunseal ancient barriers. Shub-Niggurath\nhad hoped to use the Runes Herself to\nclear off the Earth, but now instead,\nyou will use them to enter her home and\nconfront her as an avatar of avenging\nEarth-life. If you defeat her, you will\nbe remembered forever as the savior of\nthe planet. If she conquers, it will be\nas if you had never been born.");
+ return;
+ }
+
+ }
+
+ GotoNextMap();
+};
+
+/*
+============
+IntermissionThink
+
+When the player presses attack or jump, change to the next level
+============
+*/
+void() IntermissionThink =
+{
+ if (time < intermission_exittime)
+ return;
+
+ if (!self.button0 && !self.button1 && !self.button2)
+ return;
+
+ ExitIntermission ();
+};
+
+/*
+============
+execute_changelevel
+
+The global "nextmap" has been set previously.
+Take the players to the intermission spot
+============
+*/
+void() execute_changelevel =
+{
+ local entity pos;
+
+ intermission_running = 1;
+
+// enforce a wait time before allowing changelevel
+ if (deathmatch)
+ intermission_exittime = time + 5;
+ else
+ intermission_exittime = time + 2;
+
+ pos = FindIntermission ();
+
+// play intermission music
+ ENG_SwitchTrack(3, 3);
+
+#ifdef NETQUAKE
+ pos = FindIntermission ();
+
+ other = find (world, classname, "player");
+ while (other != world)
+ {
+ other.view_ofs = '0 0 0';
+ other.angles = other.v_angle = pos.mangle;
+ other.fixangle = TRUE; // turn this way immediately
+ other.nextthink = time + 0.5;
+ other.takedamage = DAMAGE_NO;
+ other.solid = SOLID_NOT;
+ other.movetype = MOVETYPE_NONE;
+ other.modelindex = 0;
+ setorigin (other, pos.origin);
+ other = find (other, classname, "player");
+ }
+
+ WriteByte (MSG_ALL, SVC_INTERMISSION);
+#else
+ WriteByte (MSG_ALL, SVC_INTERMISSION);
+ WriteCoord (MSG_ALL, pos.origin_x);
+ WriteCoord (MSG_ALL, pos.origin_y);
+ WriteCoord (MSG_ALL, pos.origin_z);
+ WriteAngle (MSG_ALL, pos.mangle_x);
+ WriteAngle (MSG_ALL, pos.mangle_y);
+ WriteAngle (MSG_ALL, pos.mangle_z);
+
+ other = find (world, classname, "player");
+ while (other != world)
+ {
+ other.takedamage = DAMAGE_NO;
+ other.solid = SOLID_NOT;
+ other.movetype = MOVETYPE_NONE;
+ other.modelindex = 0;
+ other = find (other, classname, "player");
+ }
+#endif
+};
+
+
+void() changelevel_touch =
+{
+ if (other.classname != "player")
+ return;
+
+// if "noexit" is set, blow up the player trying to leave
+//ZOID, 12-13-96, noexit isn't supported in QW. Overload samelevel
+// if ((cvar("noexit") == 1) || ((cvar("noexit") == 2) && (mapname != "start")))
+ if (deathmatch)
+ {
+ if ((cvar("samelevel") == 2) || ((cvar("samelevel") == 3) && (mapname != "start")))
+ {
+ T_Damage (other, self, self, 50000, MOD_EXIT);
+ return;
+ }
+ }
+
+ bprint2 (PRINT_HIGH, other.netname, " exited the level\n");
+
+ nextmap = self.map;
+
+ SUB_UseTargets ();
+
+ self.touch = SUB_Null;
+
+// we can't move people right now, because touch functions are called
+// in the middle of C movement code, so set a think time to do it
+ self.think = execute_changelevel;
+ self.nextthink = time + 0.1;
+};
+
+/*QUAKED trigger_changelevel (0.5 0.5 0.5) ? NO_INTERMISSION
+When the player touches this, he gets sent to the map listed in the "map" variable. Unless the NO_INTERMISSION flag is set, the view will go to the info_intermission spot and display stats.
+*/
+void() trigger_changelevel =
+{
+ if (!self.map)
+ objerror ("chagnelevel trigger doesn't have map");
+
+ InitTrigger ();
+ self.touch = changelevel_touch;
+};
+
+
+/*
+=============================================================================
+
+ PLAYER GAME EDGE FUNCTIONS
+
+=============================================================================
+*/
+
+void() set_suicide_frame;
+
+// create a deadbody ent that is removed over time
+void(entity ent) CopyToDeadbody =
+{
+ local entity deadbody;
+
+ deadbody = spawn();
+ deadbody.angles = ent.angles;
+ deadbody.model = ent.model;
+ deadbody.modelindex = ent.modelindex;
+ deadbody.frame = ent.frame;
+ deadbody.colormap = ent.colormap;
+ deadbody.movetype = ent.movetype;
+ deadbody.velocity = ent.velocity;
+ deadbody.flags = 0;
+ setorigin (deadbody, ent.origin);
+ setsize (deadbody, ent.mins, ent.maxs);
+
+ deadbody.think = SUB_Remove;
+ deadbody.nextthink = time + 5;
+};
+
+// called by ClientKill and DeadThink
+void() respawn =
+{
+ if (self.setup_death == #TRUE) {
+ Player_SetupDeath();
+ }
+};
+
+void () true_respawn =
+{
+ if (coop)
+ {
+ // make a copy of the dead body for appearances sake
+ CopyToDeadbody (self);
+ // get the spawn parms as they were at level start
+ setspawnparms (self);
+ // respawn
+ PutClientInServer ();
+ }
+ else if (deathmatch)
+ {
+ // make a copy of the dead body for appearances sake
+ CopyToDeadbody (self);
+ // set default spawn parms
+ SetNewParms ();
+ // respawn
+ PutClientInServer ();
+ }
+ else
+ { // restart the entire server
+ localcmd ("restart\n");
+ }
+};
+
+/*
+============
+ClientKill
+
+Player entered the suicide command
+============
+*/
+void() PlayerDropStuff;
+
+void() ClientKill =
+{
+ if (intermission_running)
+ return;
+
+ if (self.suicide_time > time)
+ return;
+
+ stuffcmd(self,"chase_active 1\n");
+ self.setup_death = #TRUE;
+ self.health = 0;
+
+ bprint2 (PRINT_MEDIUM, self.netname, " suicides\n");
+ PlayerDropStuff ();
+ set_suicide_frame ();
+CTF_Flag_Drop();
+ self.modelindex = modelindex_player;
+ logfrag (self, self)
+ self.frags = self.frags - 2; // extra penalty
+
+ respawn ();
+};
+
+/*
+============
+SelectSpawnPoint
+
+Returns the entity to spawn at
+============
+*/
+entity() SelectSpawnPoint =
+{
+ local entity spot, thing;
+ local float numspots, totalspots;
+ local float pcount;
+ local entity spots;
+
+ if (coop) // coop spawning
+ {
+ if (!spotspawn)
+ {
+ spotspawn = 1;
+ spot = find (world, classname, "info_player_start");
+ if (spot)
+ return spot;
+ }
+ lastspawn = find(lastspawn, classname, "info_player_coop");
+ if (lastspawn)
+ return lastspawn;
+ }
+
+ if (!deathmatch) // single player spawning
+ {
+ if (serverflags)
+ { // return with a rune to start
+ spot = find (world, classname, "info_player_start2");
+ if (spot)
+ return spot;
+ }
+
+ spot = find (world, classname, "info_player_start");
+ if (spot)
+ return spot;
+ }
+
+ // QuakeWorld style deathmatch spawning
+ numspots = 0;
+ totalspots = 0;
+
+ // choose a info_player_deathmatch point
+ // ok, find all spots that don't have players nearby
+ spots = world;
+ spot = find (world, classname, "info_player_deathmatch");
+ while (spot)
+ {
+ totalspots = totalspots + 1;
+
+ thing=findradius(spot.origin, 84);
+ pcount=0;
+ while (thing)
+ {
+ if (thing.classname == "player")
+ pcount=pcount + 1;
+ thing=thing.chain;
+ }
+ if (pcount == 0) {
+ spot.goalentity = spots;
+ spots = spot;
+ numspots = numspots + 1;
+ }
+
+ // Get the next spot in the chain
+ spot = find (spot, classname, "info_player_deathmatch");
+ }
+ totalspots=totalspots - 1;
+ if (!numspots) {
+ // ack, they are all full, just pick one at random
+ totalspots = rint((random() * totalspots));
+ spot = find (world, classname, "info_player_deathmatch");
+ while (totalspots > 0) {
+ totalspots = totalspots - 1;
+ spot = find (spot, classname, "info_player_deathmatch");
+ }
+ return spot;
+ }
+
+ // We now have the number of spots available on the map in numspots
+ // Generate a random number between 1 and numspots
+ numspots = numspots - 1;
+ numspots = rint((random() * numspots));
+
+ spot = spots;
+ while (numspots > 0) {
+ spot = spot.goalentity;
+ numspots = numspots - 1;
+ }
+ return spot;
+
+};
+void() DecodeLevelParms;
+void() PlayerDie;
+
+/*
+===========
+PutClientInServer
+
+called each time a player enters a new level
+============
+*/
+void() PutClientInServer =
+{
+ local entity spot;
+ local float wtemp;
+
+ self.classname = "player";
+ self.health = 130;
+ self.takedamage = DAMAGE_AIM;
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_WALK;
+ self.show_hostile = 0;
+ self.max_health = 130;
+ self.flags = FL_CLIENT;
+ self.air_finished = time + 12;
+ self.waterdmg = 2; // initial water damage
+ self.super_damage_finished = 0;
+ self.radsuit_finished = 0;
+ self.invisible_finished = 0;
+ self.invincible_finished = 0;
+ self.effects = 0;
+ self.invincible_time = 0;
+ self.suicide_time = time + 3;
+ self.weaponstate = WS_IDLE;
+ DecodeLevelParms ();
+ // dumb hack until I get the real weapon system in
+ wtemp = self.weapon;
+
+ if (deathmatch == 4)
+ {
+ self.ammo_shells_real = 0;
+ if (numberserverinfokey("axe") == 0)
+ {
+ self.ammo_nails_real = 255;
+ self.ammo_shells_real = 255;
+ self.ammo_rockets_real = 255;
+ self.ammo_cells_real = 255;
+ self.items |= IT_NAILGUN
+ | IT_SUPER_NAILGUN
+ | IT_SUPER_SHOTGUN
+ | IT_ROCKET_LAUNCHER
+ | IT_LIGHTNING;
+ }
+ else
+ wtemp = IT_AXE;
+
+ self.items |= IT_ARMOR3 | IT_INVULNERABILITY;
+ self.items = self.items - (self.items & (IT_ARMOR1 | IT_ARMOR2));
+ self.armorvalue = 200;
+ self.armortype = 0.8;
+ self.health = 250;
+ self.invincible_time = 1;
+ self.invincible_finished = time + 3;
+ }
+
+ if (deathmatch == 5)
+ {
+ self.ammo_nails_real = 80;
+ self.ammo_shells_real = 30;
+ self.ammo_rockets_real = 10;
+ self.ammo_cells_real = 30;
+ self.items |= IT_NAILGUN
+ | IT_SUPER_NAILGUN
+ | IT_SUPER_SHOTGUN
+ | IT_ROCKET_LAUNCHER
+ | IT_GRENADE_LAUNCHER
+ | IT_LIGHTNING
+ | IT_ARMOR3
+ | IT_INVULNERABILITY;
+ self.items = self.items - (self.items & (IT_ARMOR1 | IT_ARMOR2));
+ self.armorvalue = 200;
+ self.armortype = 0.8;
+ self.health = 200;
+ self.invincible_time = 1;
+ self.invincible_finished = time + 3;
+ }
+
+ self.weapon = 0;
+ W_WeaponSwitch (wtemp);
+
+ self.attack_finished = time;
+ self.th_pain = player_pain;
+ self.th_die = PlayerDie;
+
+ self.deadflag = DEAD_NO;
+
+ spot = SelectSpawnPoint ();
+
+ self.origin = spot.origin + '0 0 1';
+ self.angles = spot.angles;
+ self.fixangle = TRUE; // turn this way immediately
+
+// oh, this is a hack!
+ setmodel (self, "progs/eyes.mdl");
+ modelindex_eyes = self.modelindex;
+
+ setmodel (self, "progs/player.mdl");
+ modelindex_player = self.modelindex;
+
+ setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
+
+ self.view_ofs = '0 0 22';
+
+// Mod - Xian (May.20.97)
+// Bug where player would have velocity from their last kill
+
+ self.velocity = '0 0 0';
+
+ player_stand1 ();
+
+ makevectors(self.angles);
+ spawn_tfog (self.origin + v_forward*20);
+
+ spawn_tdeath (self.origin, self);
+
+ // Set Rocket Jump Modifiers
+ rj = numberserverinfokey("rj");
+
+ W_StartWeapon ();
+
+ self.needles = 0;
+
+
+ self.pfov = FOV_DEFAULT;
+ Set_FOV( self.pfov );
+
+ self.reset = 0;
+ self.groundwep = 0;
+ self.weaponheat = 0;
+
+ stuffcmd(self,"chase_active 0\n");
+ NadeCounter();
+ AmmoCounter();
+};
+
+
+/*
+=============================================================================
+
+ QUAKED FUNCTIONS
+
+=============================================================================
+*/
+
+
+/*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24)
+The normal starting point for a level.
+*/
+void() info_player_start =
+{
+};
+
+
+/*QUAKED info_player_start2 (1 0 0) (-16 -16 -24) (16 16 24)
+Only used on start map for the return point from an episode.
+*/
+void() info_player_start2 =
+{
+};
+
+/*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24)
+potential spawning position for deathmatch games
+*/
+void() info_player_deathmatch =
+{
+};
+
+/*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 24)
+potential spawning position for coop games
+*/
+void() info_player_coop =
+{
+};
+
+/*
+===============================================================================
+
+RULES
+
+===============================================================================
+*/
+
+/*
+go to the next level for deathmatch
+*/
+void() NextLevel =
+{
+ local entity o;
+
+ if (nextmap != "")
+ return; // already done
+
+ if (mapname == "start")
+ {
+ if (!cvar("registered"))
+ {
+ mapname = "e1m1";
+ }
+ else if (!(serverflags & 1))
+ {
+ mapname = "e1m1";
+ serverflags = serverflags | 1;
+ }
+ else if (!(serverflags & 2))
+ {
+ mapname = "e2m1";
+ serverflags = serverflags | 2;
+ }
+ else if (!(serverflags & 4))
+ {
+ mapname = "e3m1";
+ serverflags = serverflags | 4;
+ }
+ else if (!(serverflags & 8))
+ {
+ mapname = "e4m1";
+ serverflags = serverflags - 7;
+ }
+
+ o = spawn();
+ o.map = mapname;
+ }
+ else
+ {
+ // find a trigger changelevel
+ o = find(world, classname, "trigger_changelevel");
+ if (!o || mapname == "start")
+ { // go back to same map if no trigger_changelevel
+ o = spawn();
+ o.map = mapname;
+ }
+ }
+
+ nextmap = o.map;
+
+ if (o.nextthink < time)
+ {
+ o.think = execute_changelevel;
+ o.nextthink = time + 0.1;
+ }
+};
+
+/*
+============
+CheckRules
+
+Exit deathmatch games upon conditions
+============
+*/
+void() CheckRules =
+{
+ if (deathmatch && timelimit && time >= timelimit)
+ NextLevel ();
+
+ if (deathmatch && fraglimit && self.frags >= fraglimit)
+ NextLevel ();
+};
+
+void () player_respawn_think =
+{
+ local entity oself;
+
+ if (self.owner.classname != "player" || self.owner == world || self.owner.health > 0) {
+ remove(self);
+ return;
+ }
+ self.health -= 1;
+ sprint(self.owner, "You will respawn in ");
+ sprint(self.owner, ftos(self.health));
+ sprint(self.owner, " seconds.\n");
+
+ if (self.health < 1) {
+ oself = self;
+
+ self = self.owner;
+ self.impulse = 0;
+ self.button0 = 0;
+ self.button1 = 0;
+ self.button2 = 0;
+ true_respawn();
+
+ self = oself;
+ remove(self);
+ return;
+ }
+
+ self.nextthink = time + 1;
+};
+
+void () Player_SetupDeath =
+{
+ local entity dt;
+
+ dt = spawn();
+ dt.health = 8;
+ dt.owner = self;
+ dt.think = player_respawn_think;
+ dt.nextthink = time + 1;
+ sprint(self, "You will respawn in ");
+ sprint(self, ftos(dt.health));
+ sprint(self, " seconds.\n");
+ self.setup_death = #FALSE;
+ self.weaponframe = 0;
+};
+
+
+//============================================================================
+
+void() PlayerDeathThink =
+{
+ local float forward;
+
+ if (self.setup_death == #TRUE) {
+ Player_SetupDeath();
+ }
+
+ if ((self.flags & FL_ONGROUND))
+ {
+ forward = vlen (self.velocity);
+ forward = forward - 20;
+ if (forward <= 0)
+ self.velocity = '0 0 0';
+ else
+ self.velocity = forward * normalize(self.velocity);
+ }
+
+// wait for all buttons released
+ if (self.deadflag == DEAD_DEAD)
+ {
+ if (self.button2 || self.button1 || self.button0)
+ return;
+ self.deadflag = DEAD_RESPAWNABLE;
+ return;
+ }
+
+// wait for any button down
+ if (!self.button2 && !self.button1 && !self.button0)
+ return;
+
+ self.button0 = 0;
+ self.button1 = 0;
+ self.button2 = 0;
+ respawn();
+};
+
+
+void() PlayerJump =
+{
+ local float vjump;
+ vjump = cvar("sol_jump");
+
+ if (self.flags & FL_WATERJUMP)
+ return;
+
+ if (self.next_jump_time > time) {
+ stuffcmd( self, "-jump\n" );
+ return;
+ }
+
+ if (self.waterlevel >= 2)
+ {
+// play swiming sound
+ if (self.swim_flag < time)
+ {
+ self.swim_flag = time + 1;
+ if (random() < 0.5)
+ sound (self, CHAN_BODY, "misc/water1.wav", 1, ATTN_NORM);
+ else
+ sound (self, CHAN_BODY, "misc/water2.wav", 1, ATTN_NORM);
+ }
+
+ return;
+ }
+
+if (!(self.flags & FL_ONGROUND))
+ return;
+
+ if ( !(self.flags & FL_JUMPRELEASED) )
+ return; // don't pogo stick
+
+ self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
+ self.button2 = 0;
+
+// player jumping sound
+ sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
+
+ if (vjump) {
+ self.velocity_z = self.velocity_z + vjump;
+ }
+ else {
+#ifdef NETQUAKE
+ self.flags = self.flags - FL_ONGROUND;
+ self.velocity_z = self.velocity_z + 225;
+#endif
+ }
+ self.jump_time = time + .15;
+};
+
+
+/*
+===========
+WaterMove
+
+============
+*/
+void() WaterMove =
+{
+//dprint (ftos(self.waterlevel));
+ if (self.movetype == MOVETYPE_NOCLIP)
+ return;
+ if (self.health < 0)
+ return;
+
+ if (self.waterlevel != 3)
+ {
+ if (self.air_finished < time)
+ sound (self, CHAN_VOICE, "player/gasp2.wav", 1, ATTN_NORM);
+ else if (self.air_finished < time + 9)
+ sound (self, CHAN_VOICE, "player/gasp1.wav", 1, ATTN_NORM);
+ self.air_finished = time + 12;
+ self.waterdmg = 2;
+ }
+ else if (self.air_finished < time)
+ { // drown!
+ if (self.pain_finished < time)
+ {
+ self.waterdmg = self.waterdmg + 2;
+ if (self.waterdmg > 15)
+ self.waterdmg = 10;
+ T_Damage (self, world, world, self.waterdmg, MOD_DROWN);
+ self.pain_finished = time + 1;
+ }
+ }
+
+ if (!self.waterlevel)
+ {
+ if (self.flags & FL_INWATER)
+ {
+ // play leave water sound
+ sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
+ self.flags = self.flags - FL_INWATER;
+ }
+ return;
+ }
+
+ if ( !(self.flags & FL_INWATER) )
+ {
+ // player enter water sound
+ switch (self.watertype)
+ {
+ case CONTENT_LAVA:
+ sound (self, CHAN_BODY, "player/inlava.wav", 1, ATTN_NORM);
+ break;
+ case CONTENT_WATER:
+ sound (self, CHAN_BODY, "player/inh2o.wav", 1, ATTN_NORM);
+ break;
+ case CONTENT_SLIME:
+ sound (self, CHAN_BODY, "player/slimbrn2.wav", 1, ATTN_NORM);
+ break;
+ }
+
+ self.flags = self.flags + FL_INWATER;
+ self.dmgtime = 0;
+ }
+
+ if (self.watertype == CONTENT_LAVA)
+ { // do damage
+ if (self.dmgtime < time)
+ {
+ if (self.radsuit_finished > time)
+ self.dmgtime = time + 1;
+ else
+ self.dmgtime = time + 0.2;
+
+ T_Damage (self, world, world, 10*self.waterlevel, MOD_LAVA);
+ }
+ }
+ else if (self.watertype == CONTENT_SLIME)
+ { // do damage
+ if (self.dmgtime < time && self.radsuit_finished < time)
+ {
+ self.dmgtime = time + 1;
+ T_Damage (self, world, world, 4*self.waterlevel, MOD_SLIME);
+ }
+ }
+
+};
+
+void() CheckWaterJump =
+{
+ local vector start, end;
+
+// check for a jump-out-of-water
+ makevectors (self.angles);
+ start = self.origin;
+ start_z = start_z + 8;
+ v_forward_z = 0;
+ normalize(v_forward);
+ end = start + v_forward*24;
+ traceline (start, end, TRUE, self);
+ if (trace_fraction < 1)
+ { // solid at waist
+ start_z = start_z + self.maxs_z - 8;
+ end = start + v_forward*24;
+ self.movedir = trace_plane_normal * -50;
+ traceline (start, end, TRUE, self);
+ if (trace_fraction == 1)
+ { // open at eye level
+ self.flags = self.flags | FL_WATERJUMP;
+ self.velocity_z = 225;
+ self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
+ self.teleport_time = time + 2; // safety net
+ return;
+ }
+ }
+};
+
+/*
+================
+PlayerPreThink
+
+Called every frame before physics are run
+================
+*/
+void() PlayerPreThink =
+{
+if (self.weapon == IT_SKULL)
+{
+ if (score_lastTic < time)
+ {
+ self.frags = self.frags + 1;
+ score_lastTic = time + 1;
+ }
+}
+ if (BotPreFrame()) // FrikBot
+ return;
+ if (intermission_running)
+ {
+ IntermissionThink (); // otherwise a button could be missed between
+ return; // the think tics
+ }
+
+// if intermission is running what is the point of this?
+// if (self.view_ofs == '0 0 0')
+// return;
+
+ makevectors (self.v_angle); // is this still used
+
+ CheckRules ();
+ WaterMove ();
+/*
+ if (self.waterlevel == 2)
+ CheckWaterJump ();
+*/
+
+ if (self.deadflag >= DEAD_DEAD)
+ {
+ PlayerDeathThink ();
+ return;
+ }
+
+ if (self.deadflag == DEAD_DYING)
+ return; // dying, so do nothing
+
+ if (self.button2)
+ PlayerJump ();
+ else
+ self.flags = self.flags | FL_JUMPRELEASED;
+
+ if(time > self.attack_finished && self.currentammo == 0 && self.weapon != IT_AXE)
+ {
+ W_WeaponSwitch (W_BestWeapon ());
+ }
+self.reset = self.reset + 0.005;
+self.groundwep = self.groundwep - 0.5;
+
+ if (self.groundwep <= 0.0)
+ {
+ stuffcmd (self, "cl_ww 0\n");
+ }
+
+ if (self.reset >= 1.000)
+ {
+ localcmd ("cl_doublek 0\n");
+ localcmd ("cl_triplek 0\n");
+ localcmd ("cl_killt 0\n");
+ localcmd ("cl_killtrocity 0\n");
+ self.reset = 0;
+ }
+
+
+
+};
+
+/*
+================
+CheckPowerups
+
+Check for turning off powerups
+================
+*/
+void() CheckPowerups =
+{
+ if (self.health <= 0)
+ return;
+
+// invisibility
+ if (self.invisible_finished)
+ {
+// sound and screen flash when items starts to run out
+ if (self.invisible_sound < time)
+ {
+ sound (self, CHAN_AUTO, "items/inv3.wav", 0.5, ATTN_IDLE);
+ self.invisible_sound = time + ((random() * 3) + 1);
+ }
+
+
+ if (self.invisible_finished < time + 3)
+ {
+ if (self.invisible_time == 1)
+ {
+ sprint1 (self, PRINT_HIGH, "Ring of Shadows magic is fading\n");
+ stuffcmd (self, "bf\n");
+ sound (self, CHAN_AUTO, "items/inv2.wav", 1, ATTN_NORM);
+ self.invisible_time = time + 1;
+ }
+
+ if (self.invisible_time < time)
+ {
+ self.invisible_time = time + 1;
+ stuffcmd (self, "bf\n");
+ }
+ }
+
+ if (self.invisible_finished < time)
+ { // just stopped
+ self.items = self.items - IT_INVISIBILITY;
+ self.invisible_finished = 0;
+ self.invisible_time = 0;
+ }
+
+ // use the eyes
+ self.frame = 0;
+ self.modelindex = modelindex_eyes;
+ }
+ else
+ self.modelindex = modelindex_player; // don't use eyes
+
+// invincibility
+ if (self.invincible_finished)
+ {
+// sound and screen flash when items starts to run out
+ if (self.invincible_finished < time + 3)
+ {
+ if (self.invincible_time == 1)
+ {
+ sprint1 (self, PRINT_HIGH, "Protection is almost burned out\n");
+ stuffcmd (self, "bf\n");
+ sound (self, CHAN_AUTO, "items/protect2.wav", 1, ATTN_NORM);
+ self.invincible_time = time + 1;
+ }
+
+ if (self.invincible_time < time)
+ {
+ self.invincible_time = time + 1;
+ stuffcmd (self, "bf\n");
+ }
+ }
+
+ if (self.invincible_finished < time)
+ { // just stopped
+ self.items = self.items - IT_INVULNERABILITY;
+ self.invincible_time = 0;
+ self.invincible_finished = 0;
+ }
+ if (self.invincible_finished > time)
+ self.effects = self.effects | ef_pent;
+ else
+ self.effects = self.effects - (self.effects & ef_pent);
+ }
+
+// super damage
+ if (self.super_damage_finished)
+ {
+
+// sound and screen flash when items starts to run out
+
+ if (self.super_damage_finished < time + 3)
+ {
+ if (self.super_time == 1)
+ {
+ if (deathmatch == 4)
+ sprint1 (self, PRINT_HIGH, "OctaPower is wearing off\n");
+ else
+ sprint1 (self, PRINT_HIGH, "Quad Damage is wearing off\n");
+ stuffcmd (self, "bf\n");
+ sound (self, CHAN_AUTO, "items/damage2.wav", 1, ATTN_NORM);
+ self.super_time = time + 1;
+ }
+
+ if (self.super_time < time)
+ {
+ self.super_time = time + 1;
+ stuffcmd (self, "bf\n");
+ }
+ }
+
+ if (self.super_damage_finished < time)
+ { // just stopped
+ self.items = self.items - IT_QUAD;
+ if (deathmatch == 4)
+ {
+ self.ammo_cells_real = 255;
+ W_UpdateAmmoCounts(self);
+ self.armorvalue = 1;
+ self.armortype = 0.8;
+ self.health = 100;
+ }
+ self.super_damage_finished = 0;
+ self.super_time = 0;
+ }
+ if (self.super_damage_finished > time)
+ self.effects = self.effects | ef_quad;
+ else
+ self.effects = self.effects - (self.effects & ef_quad);
+ }
+
+// suit
+ if (self.radsuit_finished)
+ {
+ self.air_finished = time + 12; // don't drown
+
+// sound and screen flash when items starts to run out
+ if (self.radsuit_finished < time + 3)
+ {
+ if (self.rad_time == 1)
+ {
+ sprint1 (self, PRINT_HIGH, "Air supply in Biosuit expiring\n");
+ stuffcmd (self, "bf\n");
+ sound (self, CHAN_AUTO, "items/suit2.wav", 1, ATTN_NORM);
+ self.rad_time = time + 1;
+ }
+
+ if (self.rad_time < time)
+ {
+ self.rad_time = time + 1;
+ stuffcmd (self, "bf\n");
+ }
+ }
+
+ if (self.radsuit_finished < time)
+ { // just stopped
+ self.items = self.items - IT_SUIT;
+ self.rad_time = 0;
+ self.radsuit_finished = 0;
+ }
+ }
+
+};
+
+
+/*
+================
+PlayerPostThink
+
+Called every frame after physics are run
+================
+*/
+void() PlayerPostThink =
+{
+ if (BotPostFrame()) // FrikBot
+ return;
+//dprint ("post think\n");
+ if (intermission_running)
+ return;
+// if (self.view_ofs == '0 0 0')
+// return;
+ if (self.deadflag)
+ return;
+
+ if (!self.flags & FL_ONGROUND)
+ if (self.next_jump_time < time)
+ self.next_jump_time = time + .05;
+
+ self.jump_flag = self.velocity_z;
+
+
+ //CheckPowerups ();
+
+ W_WeaponFrame ();
+
+};
+
+
+/*
+===========
+ClientConnect
+
+called when a player connects to a server
+============
+*/
+void() ClientConnect =
+{
+ ClientInRankings(); // FrikBot
+ bprint2 (PRINT_HIGH, self.netname, " entered the game\n");
+
+// a client connecting during an intermission can cause problems
+ if (intermission_running)
+ GotoNextMap ();
+};
+
+
+void() ClientDisconnect =
+{
+ ClientDisconnected(); // FrikBot
+ // let everyone else know
+ bprint4 (PRINT_HIGH, self.netname, " left the game with ", ftos(self.frags), " frags\n");
+ sound (self, CHAN_BODY, "player/tornoff2.wav", 1, ATTN_NONE);
+ set_suicide_frame ();
+};
+void(entity playermedal, float howmany) killmedals =
+{
+ if (howmany == 10)
+ centerprint(playermedal, "Killpocalypse!\n");
+ else if (howmany == 9)
+ centerprint(playermedal, "Killpocalypse!\n");
+ else if (howmany == 8)
+ centerprint(playermedal, "Killtastrophe!\n");
+ else if (howmany == 7)
+ centerprint(playermedal, "Killimanjaro!\n");
+ else if (howmany == 6)
+ {
+ playermedal.reset = 0.000;
+ stuffcmd (playermedal, "cl_killtrocity 0\n");
+ centerprint(playermedal, "Overkill!\n");
+ }
+ else if (howmany == 5)
+ {
+ playermedal.reset = 0.000;
+ centerprint(playermedal, "Killtrocity!\n");
+ stuffcmd (playermedal, "play killtrocity.wav\n");
+ stuffcmd (playermedal, "cl_killtrocity 1\n");
+ stuffcmd (playermedal, "cl_killt 0\n");
+ stuffcmd (playermedal, "cl_triplek 0\n");
+ stuffcmd (playermedal, "cl_doublek 0\n");
+ }
+ else if (howmany == 4)
+ {
+ playermedal.reset = 0.000;
+ centerprint(playermedal, "KillTacular!\n");
+ stuffcmd (playermedal, "play killtacular.wav\n");
+ stuffcmd (playermedal, "cl_killt 1\n");
+ stuffcmd (playermedal, "cl_killtrocity 0\n");
+ stuffcmd (playermedal, "cl_triplek 0\n");
+ stuffcmd (playermedal, "cl_doublek 0\n");
+ }
+ else if (howmany == 3) {
+ playermedal.reset = 0.000;
+ centerprint(playermedal, "Triple Kill!\n");
+ stuffcmd (playermedal, "play triple.wav\n");
+ stuffcmd (playermedal, "cl_triplek 1\n");
+ stuffcmd (playermedal, "cl_doublek 0\n");
+ stuffcmd (playermedal, "cl_killt 0\n");
+ stuffcmd (playermedal, "cl_killtrocity 0\n");
+ }
+ else if (howmany == 2) {
+ playermedal.reset = 0.000;
+ centerprint(playermedal, "Double Kill!\n");
+ stuffcmd(playermedal,"play double.wav\n");
+ stuffcmd (playermedal, "cl_doublek 1\n");
+ stuffcmd (playermedal, "cl_triplek 0\n");
+ stuffcmd (playermedal, "cl_killt 0\n");
+ stuffcmd (playermedal, "cl_killtrocity 0\n");
+ }
+ else
+ return;
+};
+/*
+===========
+ClientObituary
+
+called when a player dies
+============
+*/
+BOOL(entity targ, entity attacker) OnSameTeam;
+
+void(entity targ, entity attacker, INTEGER mod) ClientObituary =
+{
+ //Kill Medals
+if (attacker.kill_time >= time)
+{
+ attacker.kill_amount = attacker.kill_amount + 1;
+ killmedals (attacker, attacker.kill_amount);
+}
+else
+ attacker.kill_amount = 1;
+if (targ.classname == "player")
+ attacker.kill_time = time + 4;
+
+if (attacker.flags & FL_CLIENT)
+ {
+ if (attacker == targ)
+ {
+ SuicideMessage(targ.netname, mod);
+ targ.frags = targ.frags - 1;
+ logfrag(targ, targ)
+ return;
+ } // else if anything else
+
+ if (OnSameTeam(targ, attacker))
+ {
+ TeamKillMessage(targ.netname, attacker.netname, mod);
+ logfrag(attacker, attacker)
+ attacker.frags = attacker.frags - 1;
+ return;
+ }
+
+ if (targ.flags & FL_CLIENT)
+ {
+ KillMessage(targ.netname, attacker.netname, mod);
+ attacker.frags = attacker.frags + 1;
+ logfrag(attacker, targ)
+ }
+ return;
+ } // else if attacker != player
+
+ if (targ.flags & FL_CLIENT)
+ {
+ WorldKillMessage(targ.netname, mod);
+ targ.frags = targ.frags - 1;
+ logfrag(targ, targ)
+ }
+};
diff --git a/r17/Revamped src/Revamped QC/combat.qc b/r17/Revamped src/Revamped QC/combat.qc
new file mode 100755
index 00000000..88a5a32a
Binary files /dev/null and b/r17/Revamped src/Revamped QC/combat.qc differ
diff --git a/r17/Revamped src/Revamped QC/ctf.qc b/r17/Revamped src/Revamped QC/ctf.qc
new file mode 100755
index 00000000..36118e2d
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/ctf.qc
@@ -0,0 +1,246 @@
+.vector flag_base;
+
+.entity flag_ent;
+
+.float update_print;
+
+.float flag_state;
+float FLAG_STATE_BASE = 0;
+float FLAG_STATE_DROPPED = 1;
+float FLAG_STATE_CARRIED = 2;
+
+float TEAM_BLUE = 14;
+float TEAM_RED = 5;
+
+vector(entity e) realorg =
+{
+ return ((e.absmin + e.absmax) * 0.5);
+};
+
+string(float whichteam) CTF_TeamString =
+{
+ if (whichteam == TEAM_BLUE)
+ return "\bBLUE";
+ else
+ return "\bRED";
+};
+
+void(float st) CTF_Flag_SetState =
+{
+ self.flag_state = st;
+
+ if ( (st == FLAG_STATE_BASE) || (st == FLAG_STATE_DROPPED) )
+ {
+ self.owner = world;
+ self.solid = SOLID_TRIGGER;
+ }
+ else if (st == FLAG_STATE_CARRIED)
+ self.solid = SOLID_NOT;
+};
+
+// go back home
+void() CTF_Flag_SendToBase =
+{
+ if (self.flag_state == FLAG_STATE_DROPPED)
+ {
+ bprint(CTF_TeamString(self.team));
+ bprint(" flag was returned to base!\n");
+ }
+
+ setorigin(self, self.flag_base);
+ CTF_Flag_SetState(FLAG_STATE_BASE);
+
+};
+
+// give the team points!
+void() CTF_Flag_Capture =
+{
+ local entity e, oself;
+
+ bprint(other.netname);
+ bprint(" captured the ");
+ bprint(CTF_TeamString(other.flag_ent.team));
+ bprint(" flag!\n");
+
+ centerprint(other, "\n");
+
+ e = find(world, classname, "player");
+ while (e)
+ {
+ if (e.team == other.team)
+ e.frags = e.frags + 10;
+
+ e = find(e, classname, "player");
+ }
+
+ // todo: play some noise and do happy dance
+
+ oself = self;
+ self = other.flag_ent;
+ CTF_Flag_SendToBase();
+ self = oself;
+
+ other.flag_ent = world;
+};
+
+// braaaaains
+void() CTF_Flag_Think =
+{
+ if (self.flag_state == FLAG_STATE_CARRIED)
+ {
+ // stay tracking with them, behind a little bit
+ makevectors(self.owner.v_angle);
+ setorigin (self, realorg(self.owner) + (v_forward * -14));
+
+ if (self.owner.update_print < time)
+ {
+ centerprint(self.owner, " \n \n \n \n \n \n \n \n \nYou have the flag!\nReturn to your base.");
+ self.owner.update_print = time + 1.5;
+ }
+
+ self.think = CTF_Flag_Think;
+ self.nextthink = time;
+ }
+ else if (self.flag_state == FLAG_STATE_DROPPED)
+ {
+ self.nextthink = time + 30;
+ self.think = CTF_Flag_SendToBase;
+ }
+};
+
+void() CTF_Flag_Drop =
+{
+ local vector deviance;
+ local entity oself;
+
+ if (!self.flag_ent)
+ return;
+
+ bprint(self.netname);
+ bprint(" has dropped the ");
+ bprint(CTF_TeamString(self.flag_ent.team));
+ bprint(" flag!\n");
+
+ // throw it out in the direction of the owners velocity, plus a bit random
+ deviance_x = random() * 20;
+ deviance_y = random() * 20;
+ deviance_z = 200;
+
+ self.flag_ent.velocity = (self.flag_ent.velocity * 0.5) + deviance;
+
+ oself = self;
+ self = self.flag_ent;
+ CTF_Flag_SetState(FLAG_STATE_DROPPED);
+ self = oself;
+
+ self.flag_ent.think = CTF_Flag_Think;
+ self.flag_ent.nextthink = time;
+
+ self.flag_ent = world;
+};
+
+// flag has been touched!
+void() CTF_Flag_Touch =
+{
+ if (other.classname != "player")
+ return;
+ if (other.health <= 0)
+ return;
+
+ // not on my team
+ if (other.team != self.team)
+ {
+ bprint(other.netname);
+ bprint(" has picked up the ");
+ bprint(CTF_TeamString(self.team));
+ bprint(" flag!\n");
+
+ self.owner = other;
+ other.flag_ent = self;
+
+ CTF_Flag_SetState(FLAG_STATE_CARRIED);
+
+ self.think = CTF_Flag_Think;
+ self.nextthink = time;
+ }
+ else
+ {
+ // on my team
+ // dropped, return to base
+ if (self.flag_state == FLAG_STATE_DROPPED)
+ {
+ bprint(other.netname);
+ bprint(" returned the ");
+ bprint(CTF_TeamString(other.team));
+ bprint(" flag\n");
+
+ CTF_Flag_SendToBase();
+ }
+ else if (self.flag_state == FLAG_STATE_BASE)
+ {
+ if (other.flag_ent)
+ CTF_Flag_Capture(); // OH YEAH!
+ }
+ }
+};
+
+void() CTF_Flag_Finalise =
+{
+ self.movetype = MOVETYPE_TOSS;
+
+ CTF_Flag_SetState(FLAG_STATE_BASE);
+};
+
+void(float whichteam) CTF_Flag_Init =
+{
+ local string m, s;
+ local vector v;
+ local entity flag;
+
+ flag = spawn();
+
+ flag.touch = CTF_Flag_Touch;
+ flag.flags = FL_ITEM;
+ flag.team = whichteam;
+
+ if (whichteam == TEAM_BLUE)
+ {
+ m = "progs/b_s_key.mdl";
+ s = "misc/basekey.wav";
+ flag.items = IT_KEY1;
+ }
+ else
+ {
+ m = "progs/b_g_key.mdl";
+ s = "misc/basekey.wav";
+ flag.items = IT_KEY2;
+ }
+
+ precache_model (m);
+ setmodel (flag, m);
+
+ precache_sound (s);
+ flag.noise = s;
+
+ v = self.origin + '0 0 4';
+
+ flag.flag_base = v;
+ flag.owner = world;
+ flag.team = whichteam;
+
+ setsize (flag, VEC_HULL_MIN, VEC_HULL_MAX);
+ setorigin(flag, v);
+
+ flag.nextthink = time + 0.2;
+ flag.think = CTF_Flag_Finalise;
+};
+
+void() info_flag_blue =
+{
+ CTF_Flag_Init(TEAM_BLUE);
+};
+
+void() info_flag_red =
+{
+ CTF_Flag_Init(TEAM_RED);
+};
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/defs.qc b/r17/Revamped src/Revamped QC/defs.qc
new file mode 100755
index 00000000..df662356
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/defs.qc
@@ -0,0 +1,852 @@
+#ifdef FTE
+// use real int if using FTE type progs
+#define INTEGER int
+#else
+#define INTEGER float
+#endif
+
+#define BOOL INTEGER
+
+
+#define FALSE ((BOOL)0)
+#define TRUE ((BOOL)1)
+
+/*
+==============================================================================
+
+ SOURCE FOR GLOBALVARS_T C STRUCTURE
+
+==============================================================================
+*/
+
+//
+// system globals
+//
+entity self;
+entity other;
+entity world;
+float time;
+float frametime;
+
+#ifndef NETQUAKE
+entity newmis; // if this is set, the entity that just
+ // run created a new missile that should
+ // be simulated immediately
+#endif
+
+float force_retouch; // force all entities to touch triggers
+ // next frame. this is needed because
+ // non-moving things don't normally scan
+ // for triggers, and when a trigger is
+ // created (like a teleport trigger), it
+ // needs to catch everything.
+ // decremented each frame, so set to 2
+ // to guarantee everything is touched
+string mapname;
+
+#ifdef NETQUAKE
+float deathmatch;
+float coop;
+float teamplay;
+#endif
+
+float serverflags; // propagated from level to level, used to
+ // keep track of completed episodes
+
+float total_secrets;
+float total_monsters;
+
+float found_secrets; // number of secrets found
+float killed_monsters; // number of monsters killed
+
+
+// spawnparms are used to encode information about clients across server
+// level changes
+float parm1, parm2, parm3, parm4, parm5, parm6, parm7, parm8, parm9, parm10, parm11, parm12, parm13, parm14, parm15, parm16;
+
+//
+// global variables set by built in functions
+//
+vector v_forward, v_up, v_right; // set by makevectors()
+
+// set by traceline / tracebox
+float trace_allsolid;
+float trace_startsolid;
+float trace_fraction;
+vector trace_endpos;
+vector trace_plane_normal;
+float trace_plane_dist;
+entity trace_ent;
+float trace_inopen;
+float trace_inwater;
+
+entity msg_entity; // destination of single entity writes
+
+//
+// required prog functions
+//
+void() main; // only for testing
+
+void() StartFrame;
+
+void() PlayerPreThink;
+void() PlayerPostThink;
+
+void() ClientKill;
+void() ClientConnect;
+void() PutClientInServer; // call after setting the parm1... parms
+void() ClientDisconnect;
+
+void() SetNewParms; // called when a client first connects to
+ // a server. sets parms so they can be
+ // saved off for restarts
+
+void() SetChangeParms; // call to set parms for self so they can
+ // be saved for a level transition
+
+
+//================================================
+void end_sys_globals; // flag for structure dumping
+//================================================
+
+/*
+==============================================================================
+
+ SOURCE FOR ENTVARS_T C STRUCTURE
+
+==============================================================================
+*/
+
+//
+// system fields (*** = do not set in prog code, maintained by C code)
+//
+.float modelindex; // *** model index in the precached list
+.vector absmin, absmax; // *** origin + mins / maxs
+
+.float ltime; // local time for entity
+#ifndef NETQUAKE
+.float lastruntime; // *** to allow entities to run out of sequence
+#endif
+
+.float movetype;
+.float solid;
+
+.vector origin; // ***
+.vector oldorigin; // ***
+.vector velocity;
+.vector angles;
+.vector avelocity;
+
+#ifdef NETQUAKE
+.vector punchangle;
+#endif
+
+.string classname; // spawn function
+.string model;
+.float frame;
+.float skin;
+.float effects;
+
+.vector mins, maxs; // bounding box extents reletive to origin
+.vector size; // maxs - mins
+
+.void() touch;
+.void() use;
+.void() think;
+.void() blocked; // for doors or plats, called when can't push other
+
+.float nextthink;
+.entity groundentity;
+
+// stats
+.float health;
+.float frags;
+.float weapon; // one of the IT_SHOTGUN, etc flags
+.string weaponmodel;
+.float weaponframe;
+.float currentammo;
+.float ammo_shells, ammo_nails, ammo_rockets, ammo_cells;
+
+.float items; // bit flags
+
+.float takedamage;
+.entity chain;
+.float deadflag;
+
+.vector view_ofs; // add to origin to get eye point
+
+
+.float button0; // fire
+.float button1; // use
+.float button2; // jump
+
+.float impulse; // weapon changes
+
+.float fixangle;
+.vector v_angle; // view / targeting angle for players
+
+#ifdef NETQUAKE
+.float idealpitch;
+#endif
+
+.string netname;
+
+.entity enemy;
+
+.float flags;
+
+.float colormap;
+.float team;
+
+.float max_health; // players maximum health is stored here
+
+.float teleport_time; // don't back up
+
+.float armortype; // save this fraction of incoming damage
+.float armorvalue;
+
+.float waterlevel; // 0 = not in, 1 = feet, 2 = wast, 3 = eyes
+.float watertype; // a contents value
+
+.float ideal_yaw;
+.float yaw_speed;
+
+.entity aiment;
+
+.entity goalentity; // a movetarget or an enemy
+
+.float spawnflags;
+
+.string target;
+.string targetname;
+
+// damage is accumulated through a frame. and sent as one single
+// message, so the super shotgun doesn't generate huge messages
+.float dmg_take;
+.float dmg_save;
+.entity dmg_inflictor;
+
+.entity owner; // who launched a missile
+.vector movedir; // mostly for doors, but also used for waterjump
+
+.string message; // trigger messages
+
+.float sounds; // either a cd track number or sound number
+
+.string noise, noise1, noise2, noise3; // contains names of wavs to play
+
+//================================================
+void end_sys_fields; // flag for structure dumping
+//================================================
+
+/*
+==============================================================================
+
+ VARS NOT REFERENCED BY C CODE
+
+==============================================================================
+*/
+
+
+//
+// constants
+//
+
+// edict.flags
+#define FL_FLY 1
+#define FL_SWIM 2
+#define FL_CLIENT 8 // set for all client edicts
+#define FL_INWATER 16 // for enter / leave water splash
+#define FL_MONSTER 32
+#define FL_GODMODE 64 // player cheat
+#define FL_NOTARGET 128 // player cheat
+#define FL_ITEM 256 // extra wide size for bonus items
+#define FL_ONGROUND 512 // standing on something
+#define FL_PARTIALGROUND 1024 // not all corners are valid
+#define FL_WATERJUMP 2048 // player jumping out of water
+#define FL_JUMPRELEASED 4096 // for jump debouncing
+
+// edict.movetype values
+#define MOVETYPE_NONE 0 // never moves
+#define MOVETYPE_WALK 3 // players only
+#define MOVETYPE_STEP 4 // discrete, not real time unless fall
+#define MOVETYPE_FLY 5
+#define MOVETYPE_TOSS 6
+#define MOVETYPE_PUSH 7 // no clip to world, push and crush
+#define MOVETYPE_NOCLIP 8
+#define MOVETYPE_FLYMISSILE 9 // fly with extra size against monsters
+#define MOVETYPE_BOUNCE 10
+
+// edict.solid values
+#define SOLID_NOT 0 // no interaction with other objects
+#define SOLID_TRIGGER 1 // touch on edge, but not blocking
+#define SOLID_BBOX 2 // touch on edge, block
+#define SOLID_SLIDEBOX 3 // touch on edge, but not an onground
+#define SOLID_BSP 4 // bsp clip, touch on edge, block
+
+
+// deadflag values
+#define DEAD_NO 0
+#define DEAD_DYING 1
+#define DEAD_DEAD 2
+#define DEAD_RESPAWNABLE 3
+
+// takedamage values
+#define DAMAGE_NO 0
+#define DAMAGE_YES 1
+#define DAMAGE_AIM 2
+
+// items
+float IT_AXE = 4096;
+float IT_SHOTGUN = 1;
+float IT_SUPER_SHOTGUN = 2;
+float IT_NAILGUN = 4;
+float IT_SUPER_NAILGUN = 8;
+float IT_GRENADE_LAUNCHER = 16;
+float IT_ROCKET_LAUNCHER = 32;
+float IT_LIGHTNING = 64;
+float IT_EXTRA_WEAPON = 128;
+float IT_EXTRA_WEAPON2 = 8388608; // solitude
+float IT_SKULL = 16777216; // solitude
+
+float IT_SHELLS = 256;
+float IT_NAILS = 512;
+float IT_ROCKETS = 1024;
+float IT_CELLS = 2048;
+
+float IT_ARMOR1 = 8192;
+float IT_ARMOR2 = 16384;
+float IT_ARMOR3 = 32768;
+float IT_SUPERHEALTH = 65536;
+
+float IT_KEY1 = 131072;
+float IT_KEY2 = 262144;
+
+float IT_INVISIBILITY = 524288;
+float IT_INVULNERABILITY = 1048576;
+float IT_SUIT = 2097152;
+float IT_QUAD = 4194304;
+
+// point content values
+
+float CONTENT_EMPTY = -1;
+float CONTENT_SOLID = -2;
+float CONTENT_WATER = -3;
+float CONTENT_SLIME = -4;
+float CONTENT_LAVA = -5;
+float CONTENT_SKY = -6;
+
+vector VEC_ORIGIN = '0 0 0';
+vector VEC_HULL_MIN = '-16 -16 -24';
+vector VEC_HULL_MAX = '16 16 32';
+
+vector VEC_HULL2_MIN = '-32 -32 -24';
+vector VEC_HULL2_MAX = '32 32 64';
+
+// protocol bytes
+float SVC_TEMPENTITY = 23;
+float SVC_KILLEDMONSTER = 27;
+float SVC_FOUNDSECRET = 28;
+float SVC_INTERMISSION = 30;
+float SVC_FINALE = 31;
+float SVC_CDTRACK = 32;
+float SVC_SELLSCREEN = 33;
+float SVC_SMALLKICK = 34;
+float SVC_BIGKICK = 35;
+float SVC_MUZZLEFLASH = 39;
+
+float TE_SPIKE = 0;
+float TE_SUPERSPIKE = 1;
+float TE_GUNSHOT = 2;
+float TE_EXPLOSION = 3;
+float TE_TAREXPLOSION = 4;
+float TE_LIGHTNING1 = 5;
+float TE_LIGHTNING2 = 6;
+float TE_WIZSPIKE = 7;
+float TE_KNIGHTSPIKE = 8;
+float TE_LIGHTNING3 = 9;
+float TE_LAVASPLASH = 10;
+float TE_TELEPORT = 11;
+float TE_BLOOD = 12;
+float TE_LIGHTNINGBLOOD = 13;
+
+// sound channels
+// channel 0 never willingly overrides
+// other channels (1-7) allways override a playing sound on that channel
+#define CHAN_AUTO 0
+#define CHAN_WEAPON 1
+#define CHAN_VOICE 2
+#define CHAN_ITEM 3
+#define CHAN_BODY 4
+// chan_no_phs_add is defined in engine.qc
+
+#define ATTN_NONE 0.0 // no volume fall off due to range
+#define ATTN_NORM 1.0 // small volume fall off (1000 range)
+#define ATTN_IDLE 2.0 // medium volume fall off (500 range)
+#define ATTN_STATIC 3.0 // large volume fall off (333 range)
+
+// entity effects
+
+//float EF_BRIGHTFIELD = 1;
+float EF_MUZZLEFLASH = 2;
+float EF_BRIGHTLIGHT = 4;
+float EF_DIMLIGHT = 8;
+float EF_FLAG1 = 16;
+float EF_FLAG2 = 32;
+// GLQuakeWorld Stuff
+// float EF_BLUE = 64; // Blue Globe effect for Quad
+// float EF_RED = 128; // Red Globe effect for Pentagram
+
+// messages
+#define MSG_BROADCAST 0 // unreliable to all
+#define MSG_ONE 1 // reliable to one (msg_entity)
+#define MSG_ALL 2 // reliable to all
+#define MSG_INIT 3 // write to the init string
+#define MSG_MULTICAST 4 // for multicast() call
+
+// message levels
+#define PRINT_LOW 0
+#define PRINT_MEDIUM 1
+#define PRINT_HIGH 2
+#define PRINT_CHAT 3
+
+// multicast sets
+#define MULTICAST_ALL 0 // every client
+#define MULTICAST_PHS 1 // within hearing
+#define MULTICAST_PVS 2 // within sight
+#define MULTICAST_ALL_R 3 // every client, reliable
+#define MULTICAST_PHS_R 4 // within hearing, reliable
+#define MULTICAST_PVS_R 5 // within sight, reliable
+
+
+
+
+//================================================
+
+//
+// globals
+//
+// float movedist;
+
+string string_null; // null string, nothing should be held here
+
+entity activator; // the entity that activated a trigger or brush
+
+entity damage_attacker; // set by T_Damage
+entity damage_inflictor; // set by T_Damage
+INTEGER damage_mod; // set by T_Damage
+
+float framecount;
+
+//
+// cvars checked each frame
+//
+float timelimit;
+float fraglimit;
+float rj;
+
+#ifndef NETQUAKE
+// these variables are not a part of QW's system fields
+float deathmatch;
+float swat;
+float coop;
+float teamplay;
+#endif
+
+float skill;
+
+// coop spawning globals
+entity lastspawn;
+float spotspawn;
+
+entity shub; // boss entity
+
+//================================================
+
+#define WT_MEDIEVAL 0
+#define WT_METAL 1
+#define WT_BASE 2
+
+//================================================
+
+.string killtarget; // used by anything using SUB_UseTargets (items/triggers/etc)
+
+.void(entity attacker, float damage) th_pain; // used by secret doors, monsters, players
+.void() th_die; // used by anything damagable (doors/buttons/players/monsters/explobox/triggermultiple)
+
+.float speed; // used with door/plats/fireball spawner, inherited
+.string map; // used with world/trigger_changelevel, inherited
+
+// used with monsters/players
+.INTEGER ammo_shells_real; // real shells count
+.INTEGER ammo_nails_real; // real nails count
+.INTEGER ammo_rockets_real; // real rockets count
+.INTEGER ammo_cells_real; // real cells count
+
+// Zoid Additions
+noref .float maxspeed; // Used to set Maxspeed on a player
+noref .float gravity; // Gravity Multiplier (0 to 1.0)
+
+.float attack_finished; // used with lots of stuff...
+.float pain_finished; // used with monsters/players
+
+.float invincible_finished; // only used for players but object check needed for T_Damage
+.float super_damage_finished; // only used for players but object check needed for T_Damage
+
+//
+// misc
+//
+.float cnt; // misc flag used by trains/dropped pent and quad/monsters
+
+// intermission
+float intermission_running;
+float intermission_exittime;
+
+#ifdef NETQUAKE
+entity newmis;
+#endif
+
+// extensions
+.float alpha; // DP_ENT_ALPHA
+
+// enums
+// ai ranges
+enum
+{
+ RANGE_MELEE,
+ RANGE_NEAR,
+ RANGE_MID,
+ RANGE_FAR
+};
+
+// monster attack states
+enum
+{
+ AS_NONE,
+ AS_STRAIGHT,
+ AS_SLIDING,
+ AS_MELEE,
+ AS_MISSILE
+};
+
+// door/plat states
+enum {
+ STATE_TOP,
+ STATE_BOTTOM,
+ STATE_UP,
+ STATE_DOWN
+};
+
+// heal defines
+enumflags {
+ H_ROTTEN,
+ H_MEGA
+};
+
+// weaponstate defines
+enum {
+ WS_IDLE,
+ WS_FIRING1,
+ WS_FIRING2 // used with nailgun
+};
+
+// ammo type defines
+enum {
+ AT_NONE,
+ AT_SHELLS,
+ AT_NAILS,
+ AT_ROCKETS,
+ AT_CELLS
+};
+
+// unions
+//floats (includes vectors)
+.union {
+ struct { // fields used with world object
+ float worldtype; // world type, 0=medieval 1=metal 2=base
+ };
+ struct { // fields used with triggers/doors/plats
+ float delay; // time from activation to firing
+ float wait; // time from firing to restarting
+ float t_length; // override length to move sideways
+ float t_width; // override length to move upwards/downwards
+ vector finaldest; // used with SUB_CalcMove
+ vector finalangle; // used with SUB_CalcMove
+ float count; // for counting triggers
+ float dmg; // damage done by door/train/trigger hurt
+ vector mangle; // initial angle (doors/teleporter/intermission)
+ float lip; // position adjustment (func_door/func_button)
+ float state; // object state (doors/buttons/plats)
+ vector pos1; // top position (doors/buttons/plats)
+ vector pos2; // bottom position (doors/buttons/plats)
+ float height; // height (plats/trigger_monsterjump)
+ vector dest1; // passed to CalcMove (doors)
+ vector dest2; // passed to CalcMove (doors)
+ };
+ struct { // fields used with players
+ float weaponframe_time; // weapon frame advance time
+ float suicide_time; // time to allow suicide after spawn
+ float healdecay; // time when health will decay
+ float show_hostile; // used to alert monsters
+ float lightning_sound; // used for lightning sound playback
+ float fly_sound; // used with trigger_push and maintaining wind sound
+ float invincible_time; // pentagram state
+ float invincible_sound; // pentagram sound playback
+ float invisible_time; // ring state
+ float invisible_sound; // ring sound playback
+ float invisible_finished; // ring current duration
+ float super_time; // quad state
+ float super_sound; // quad sound playback
+ float rad_time; // rad suit state
+ float radsuit_finished; // rad suit current duration
+ float dmgtime; // time slime/lava will damage
+ float swim_flag; // swim sound playback
+ float air_finished; // when time > air_finished, start drowning
+ float waterdmg; // damage water will deal when drowning
+ float jump_flag; // last z velocity used for falling damage
+ };
+ struct { // fields used with items
+ float healamount; // amount healed with health item
+ //float ammo_count; // ammo amount
+ };
+ struct { // fields used with generic projectiles
+ float damage_direct; // damage done with a direct hit
+ float damage_exp; // damage done from radius damage
+ float radius_exp; // radius of radius damage
+ float expire_time; // time when projectile dies
+ float proj_think_time; // interval between thinks
+ };
+ struct { // fields used with lights
+ float light_lev; // not used by game, but parsed by light util
+ float style; // lightstyle to use for light
+ };
+ struct { // fields used with monsters
+ float search_time; // search time intervals
+ float attack_state; // current AI attack state
+ float pausetime; // time to pause for monsters
+ float hknightattack; // hell knight attack pattern
+ float lefty; // ai slide move
+ float wizardidle; // wizard idle sound timer
+ float inpain; // zombie in pain
+ };
+ // fields used with ambient sounds?
+ /*
+ struct {
+ float waitmin;
+ float waitmax;
+ float distance;
+ float volume;
+ };
+ */
+};
+
+//integers
+.union {
+
+ struct { // fields used with players
+ INTEGER weaponstate; // firing state of current weapon
+ INTEGER walkframe; // used with walking animation
+ INTEGER ammo_type; // ammo type in use
+ };
+ struct { // fields used with bubbles spawned from drowning
+ INTEGER bubble_count; // keeps track of the number of bubbles
+ INTEGER bubble_state; // associated with bubble progression
+ };
+ struct { // fields used with items
+ INTEGER healtype; // type of health with health item
+ };
+ struct { // fields used with generic projectiles
+ INTEGER mod_direct; // mod type for direct hit
+ INTEGER mod_exp; // mod type for radius damage
+ INTEGER proj_effect; // effect used with projectile
+ INTEGER voided; // projectile has been voided
+ };
+};
+
+//functions
+.union {
+ struct { // fields used with triggers/doors/plats
+ void() think1; // used with SUB_CalcMove
+ };
+ struct { // fields used with generic projectiles
+ void() proj_think; // extra think function used with projectile
+ float() proj_touch; // extra touch function used with projectile
+ };
+ struct { // fields used with monsters
+ void() th_stand; // standing animation
+ void() th_walk; // walking animation
+ void() th_run; // running animation
+ void() th_missile; // ranged animation
+ void() th_melee; // melee animation
+ };
+};
+
+
+//entities
+.union {
+ struct { // fields used with triggers/doors/plats
+ entity trigger_field; // used with linking (doors)
+ };
+
+ struct { // fields used with monsters
+ entity oldenemy; // old enemy
+ entity movetarget; // target entity to move to
+ };
+};
+
+//strings
+.union {
+ struct { // fields used with world object
+ string wad; //mute it
+ };
+ struct { // fields used with triggers/doors/plats
+ string noise4; // extra sound (doors)
+ };
+ struct { // fields used with items
+ string mdl; // model used with SUB_regen
+ };
+};
+
+//mute those warnings (unions/structs do not support noref mid-struct, but a later def will propogate the noref flag)
+noref .string wad;
+noref .float light_lev;
+
+//===========================================================================
+
+
+//
+// builtin functions
+//
+
+void(vector ang) makevectors = #1; // sets v_forward, etc globals
+void(entity e, vector o) setorigin = #2;
+void(entity e, string m) setmodel = #3; // set movetype and solid first
+void(entity e, vector min, vector max) setsize = #4;
+// #5 was removed
+// void() break = #6;
+float() random = #7; // returns 0 - 1
+//void(entity e, float chan, string samp, float vol, float atten) sound = #8; //FBX
+vector(vector v) normalize = #9;
+void(string e) error = #10;
+void(string e) objerror = #11;
+float(vector v) vlen = #12;
+float(vector v) vectoyaw = #13;
+entity() spawn = #14;
+void(entity e) remove = #15;
+
+// sets trace_* globals
+// nomonsters can be:
+// An entity will also be ignored for testing if forent == test,
+// forent->owner == test, or test->owner == forent
+// a forent of world is ignored
+void(vector v1, vector v2, float nomonsters, entity forent) traceline = #16;
+
+entity() checkclient = #17; // returns a client to look for
+entity(entity start, .string fld, string match) find = #18;
+string(string s) precache_sound = #19;
+string(string s) precache_model = #20;
+//void(entity client, string s)stuffcmd = #21; // FBX
+entity(vector org, float rad) findradius = #22;
+// bprint moved to engine.qc
+// sprint moved to engine.qc
+void(string s) dprint = #25;
+string(float f) ftos = #26;
+string(vector v) vtos = #27;
+void() coredump = #28; // prints all edicts
+void() traceon = #29; // turns statment trace on
+void() traceoff = #30;
+void(entity e) eprint = #31; // prints an entire edict
+float(float yaw, float dist) walkmove = #32; // returns TRUE or FALSE
+// #33 was removed
+float() droptofloor= #34; // TRUE if landed on floor
+void(float style, string value) lightstyle = #35;
+float(float v) rint = #36; // round to nearest int
+float(float v) floor = #37; // largest integer <= v
+float(float v) ceil = #38; // smallest integer >= v
+// #39 was removed
+float(entity e) checkbottom = #40; // true if self is on ground
+float(vector v) pointcontents = #41; // returns a CONTENT_*
+// #42 was removed
+float(float f) fabs = #43;
+//vector(entity e, float speed) aim = #44; // returns the shooting vector // FBX
+// cvar moved to engine.qc
+void(string s) localcmd = #46; // put string into local que
+entity(entity e) nextent = #47; // for looping through all ents
+// #48 was removed
+void() ChangeYaw = #49; // turn towards self.ideal_yaw
+ // at self.yaw_speed
+// #50 was removed
+vector(vector v) vectoangles = #51;
+
+//
+// direct client message generation
+//
+/*
+void(float to, float f) WriteByte = #52;
+void(float to, float f) WriteChar = #53;
+void(float to, float f) WriteShort = #54;
+void(float to, float f) WriteLong = #55;
+void(float to, float f) WriteCoord = #56;
+void(float to, float f) WriteAngle = #57;
+void(float to, string s) WriteString = #58;
+void(float to, entity s) WriteEntity = #59;
+// FBX'd
+*/
+// several removed
+
+void(float step) movetogoal = #67;
+
+string(string s) precache_file = #68; // no effect except for -copy
+void(entity e) makestatic = #69;
+void(string s) changelevel = #70;
+
+//#71 was removed
+
+void(string var, string val) cvar_set = #72; // sets cvar.value
+
+//void(entity client, string s) centerprint = #73; // sprint, but in middle // FBX
+
+void(vector pos, string samp, float vol, float atten) ambientsound = #74;
+
+string(string s) precache_model2 = #75; // registered version only
+string(string s) precache_sound2 = #76; // registered version only
+string(string s) precache_file2 = #77; // registered version only
+
+//void(entity e) setspawnparms = #78; // set parm1... to the // FBX
+ // values at level start
+ // for coop respawn
+// logfrag moved to engine.qc
+// infokey moved to engine.qc
+// stof moved to engine.qc
+
+//============================================================================
+
+//
+// subs.qc
+//
+void(vector tdest, float tspeed, void() func) SUB_CalcMove;
+void(entity ent, vector tdest, float tspeed, void() func) SUB_CalcMoveEnt;
+void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove;
+void() SUB_CalcMoveDone;
+void() SUB_CalcAngleMoveDone;
+void() SUB_Null;
+void() SUB_UseTargets;
+void() SUB_Remove;
+
+//
+// combat.qc
+//
+void(entity targ, entity inflictor, entity attacker, float damage, INTEGER mod) T_Damage;
+
+float (entity e, float healamount, float ignore) T_Heal; // health function
+
+BOOL(entity targ, entity inflictor) CanDamage;
+.float crouch;
+float score_lastTic;
+.float alpha;
+.float nade_lives; // The number of Grenades a player has.
+.float plasma_lives;
+.float kill_time;
+.float kill_amount; //For reseting kill medals
+.float groundwep; //For weapon pickup Icons
+.float reset;
diff --git a/r17/Revamped src/Revamped QC/doors.qc b/r17/Revamped src/Revamped QC/doors.qc
new file mode 100755
index 00000000..1d76f425
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/doors.qc
@@ -0,0 +1,770 @@
+
+float DOOR_START_OPEN = 1;
+float DOOR_DONT_LINK = 4;
+float DOOR_GOLD_KEY = 8;
+float DOOR_SILVER_KEY = 16;
+float DOOR_TOGGLE = 32;
+
+/*
+
+Doors are similar to buttons, but can spawn a fat trigger field around them
+to open without a touch, and they link together to form simultanious
+double/quad doors.
+
+Door.owner is the master door. If there is only one door, it points to itself.
+If multiple doors, all will point to a single one.
+
+Door.enemy chains from the master door through all doors linked in the chain.
+
+*/
+
+/*
+=============================================================================
+
+THINK FUNCTIONS
+
+=============================================================================
+*/
+
+void() door_go_down;
+void() door_go_up;
+
+void() door_blocked =
+{
+ T_Damage (other, self, self.goalentity, self.dmg, MOD_SQUISH);
+
+// if a door has a negative wait, it would never come back if blocked,
+// so let it just squash the object to death real fast
+ if (self.wait >= 0)
+ {
+ if (self.state == STATE_DOWN)
+ door_go_up ();
+ else
+ door_go_down ();
+ }
+};
+
+
+void() door_hit_top =
+{
+ sound (self, chan_no_phs_add|CHAN_VOICE, self.noise1, 1, ATTN_NORM);
+ self.state = STATE_TOP;
+ if (self.spawnflags & DOOR_TOGGLE)
+ return; // don't come down automatically
+ self.think = door_go_down;
+ self.nextthink = self.ltime + self.wait;
+};
+
+void() door_hit_bottom =
+{
+ sound (self, chan_no_phs_add|CHAN_VOICE, self.noise1, 1, ATTN_NORM);
+ self.state = STATE_BOTTOM;
+};
+
+void() door_go_down =
+{
+ sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
+ if (self.max_health)
+ {
+ self.takedamage = DAMAGE_YES;
+ self.health = self.max_health;
+ }
+
+ self.state = STATE_DOWN;
+ SUB_CalcMove (self.pos1, self.speed, door_hit_bottom);
+};
+
+void() door_go_up =
+{
+ if (self.state == STATE_UP)
+ return; // allready going up
+
+ if (self.state == STATE_TOP)
+ { // reset top wait time
+ self.nextthink = self.ltime + self.wait;
+ return;
+ }
+
+ sound (self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
+ self.state = STATE_UP;
+ SUB_CalcMove (self.pos2, self.speed, door_hit_top);
+
+ SUB_UseTargets();
+};
+
+
+/*
+=============================================================================
+
+ACTIVATION FUNCTIONS
+
+=============================================================================
+*/
+
+void() door_fire =
+{
+ local entity oself;
+ local entity starte;
+
+ if (self.owner != self)
+ objerror ("door_fire: self.owner != self");
+
+// play use key sound
+
+ if (self.items)
+ sound (self, CHAN_ITEM, self.noise4, 1, ATTN_NORM);
+
+ self.message = string_null; // no more message
+ oself = self;
+
+ if (self.spawnflags & DOOR_TOGGLE)
+ {
+ if (self.state == STATE_UP || self.state == STATE_TOP)
+ {
+ starte = self;
+ do
+ {
+ door_go_down ();
+ self = self.enemy;
+ } while ( (self != starte) && (self != world) );
+ self = oself;
+ return;
+ }
+ }
+
+// trigger all paired doors
+ starte = self;
+
+ do
+ {
+ self.goalentity = activator; // Who fired us
+ door_go_up ();
+ self = self.enemy;
+ } while ( (self != starte) && (self != world) );
+ self = oself;
+};
+
+
+void() door_use =
+{
+ local entity oself;
+
+ self.message = ""; // door message are for touch only
+ self.owner.message = "";
+ self.enemy.message = "";
+
+ oself = self;
+ self = self.owner;
+ door_fire ();
+ self = oself;
+};
+
+
+void() door_trigger_touch =
+{
+ if (other.health <= 0)
+ return;
+
+ if (time < self.attack_finished)
+ return;
+ self.attack_finished = time + 1;
+
+ activator = other;
+
+ self = self.owner;
+ door_use ();
+};
+
+
+void() door_killed =
+{
+ local entity oself;
+
+ oself = self;
+ self = self.owner;
+ self.health = self.max_health;
+ self.takedamage = DAMAGE_NO; // wil be reset upon return
+ door_use ();
+ self = oself;
+};
+
+
+/*
+================
+door_touch
+
+Prints messages and opens key doors
+================
+*/
+void() door_touch =
+{
+ if (other.classname != "player")
+ return;
+ if (self.owner.attack_finished > time)
+ return;
+
+ self.owner.attack_finished = time + 2;
+
+ if (self.owner.message != "")
+ {
+ centerprint (other, self.owner.message);
+ sound (other, CHAN_VOICE, "misc/talk.wav", 1, ATTN_NORM);
+ }
+
+// key door stuff
+ if (!self.items)
+ return;
+
+// FIXME: blink key on player's status bar
+ if ( (self.items & other.items) != self.items )
+ {
+ if (self.owner.items == IT_KEY1)
+ {
+ switch (world.worldtype)
+ {
+ case WT_MEDIEVAL:
+ centerprint (other, "You need the silver key");
+ break;
+ case WT_METAL:
+ centerprint (other, "You need the silver runekey");
+ break;
+ case WT_BASE:
+ centerprint (other, "You need the silver keycard");
+ break;
+ }
+ }
+ else
+ {
+ switch (world.worldtype)
+ {
+ case WT_MEDIEVAL:
+ centerprint (other, "You need the gold key");
+ break;
+ case WT_METAL:
+ centerprint (other, "You need the gold runekey");
+ break;
+ case WT_BASE:
+ centerprint (other, "You need the gold keycard");
+ break;
+ }
+ }
+
+ sound (self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
+ return;
+ }
+
+ other.items = other.items - self.items;
+ self.touch = SUB_Null;
+ if (self.enemy)
+ self.enemy.touch = SUB_Null; // get paired door
+ door_use ();
+};
+
+/*
+=============================================================================
+
+SPAWNING FUNCTIONS
+
+=============================================================================
+*/
+
+
+entity(vector fmins, vector fmaxs) spawn_field =
+{
+ local entity trigger;
+ local vector t1, t2;
+
+ trigger = spawn();
+ trigger.movetype = MOVETYPE_NONE;
+ trigger.solid = SOLID_TRIGGER;
+ trigger.owner = self;
+ trigger.touch = door_trigger_touch;
+
+ t1 = fmins;
+ t2 = fmaxs;
+ setsize (trigger, t1 - '60 60 8', t2 + '60 60 8');
+ return (trigger);
+};
+
+
+BOOL (entity e1, entity e2) EntitiesTouching =
+{
+ if (e1.mins_x > e2.maxs_x)
+ return FALSE;
+ if (e1.mins_y > e2.maxs_y)
+ return FALSE;
+ if (e1.mins_z > e2.maxs_z)
+ return FALSE;
+ if (e1.maxs_x < e2.mins_x)
+ return FALSE;
+ if (e1.maxs_y < e2.mins_y)
+ return FALSE;
+ if (e1.maxs_z < e2.mins_z)
+ return FALSE;
+ return TRUE;
+};
+
+
+/*
+=============
+LinkDoors
+
+
+=============
+*/
+void() LinkDoors =
+{
+ local entity t, starte;
+ local vector cmins, cmaxs;
+
+ if (self.enemy)
+ return; // already linked by another door
+ if (self.spawnflags & 4)
+ {
+ self.owner = self.enemy = self;
+ return; // don't want to link this door
+ }
+
+ cmins = self.mins;
+ cmaxs = self.maxs;
+
+ starte = self;
+ t = self;
+
+ do
+ {
+ self.owner = starte; // master door
+
+ if (self.health)
+ starte.health = self.health;
+ if (self.targetname)
+ starte.targetname = self.targetname;
+ if (self.message != "")
+ starte.message = self.message;
+
+ t = find (t, classname, self.classname);
+ if (!t)
+ {
+ self.enemy = starte; // make the chain a loop
+
+ // shootable, fired, or key doors just needed the owner/enemy links,
+ // they don't spawn a field
+
+ self = self.owner;
+
+ if (self.health)
+ return;
+ if (self.targetname)
+ return;
+ if (self.items)
+ return;
+
+ self.owner.trigger_field = spawn_field(cmins, cmaxs);
+
+ return;
+ }
+
+ if (EntitiesTouching(self,t))
+ {
+ if (t.enemy)
+ objerror ("cross connected doors");
+
+ self.enemy = t;
+ self = t;
+
+ if (t.mins_x < cmins_x)
+ cmins_x = t.mins_x;
+ if (t.mins_y < cmins_y)
+ cmins_y = t.mins_y;
+ if (t.mins_z < cmins_z)
+ cmins_z = t.mins_z;
+ if (t.maxs_x > cmaxs_x)
+ cmaxs_x = t.maxs_x;
+ if (t.maxs_y > cmaxs_y)
+ cmaxs_y = t.maxs_y;
+ if (t.maxs_z > cmaxs_z)
+ cmaxs_z = t.maxs_z;
+ }
+ } while (1 );
+
+};
+
+
+/*QUAKED func_door (0 .5 .8) ? START_OPEN x DOOR_DONT_LINK GOLD_KEY SILVER_KEY TOGGLE
+if two doors touch, they are assumed to be connected and operate as a unit.
+
+TOGGLE causes the door to wait in both the start and end states for a trigger event.
+
+START_OPEN causes the door to move to its destination when spawned, and operate in reverse. It is used to temporarily or permanently close off an area when triggered (not usefull for touch or takedamage doors).
+
+Key doors are allways wait -1.
+
+"message" is printed when the door is touched if it is a trigger door and it hasn't been fired yet
+"angle" determines the opening direction
+"targetname" if set, no touch field will be spawned and a remote button or trigger field activates the door.
+"health" if set, door must be shot open
+"speed" movement speed (100 default)
+"wait" wait before returning (3 default, -1 = never return)
+"lip" lip remaining at end of move (8 default)
+"dmg" damage to inflict when blocked (2 default)
+"sounds"
+0) no sound
+1) stone
+2) base
+3) stone chain
+4) screechy metal
+*/
+
+void() func_door =
+{
+ switch (world.worldtype)
+ {
+ case WT_MEDIEVAL:
+ precache_sound ("doors/medtry.wav");
+ precache_sound ("doors/meduse.wav");
+ self.noise3 = "doors/medtry.wav";
+ self.noise4 = "doors/meduse.wav";
+ break;
+ case WT_METAL:
+ precache_sound ("doors/runetry.wav");
+ precache_sound ("doors/runeuse.wav");
+ self.noise3 = "doors/runetry.wav";
+ self.noise4 = "doors/runeuse.wav";
+ break;
+ case WT_BASE:
+ precache_sound ("doors/basetry.wav");
+ precache_sound ("doors/baseuse.wav");
+ self.noise3 = "doors/basetry.wav";
+ self.noise4 = "doors/baseuse.wav";
+ break;
+ default:
+ dprint ("no worldtype set!\n");
+ }
+
+ switch (self.sounds)
+ {
+ case 0:
+ precache_sound ("misc/null.wav");
+ precache_sound ("misc/null.wav");
+ self.noise1 = "misc/null.wav";
+ self.noise2 = "misc/null.wav";
+ break;
+ case 1:
+ precache_sound ("doors/drclos4.wav");
+ precache_sound ("doors/doormv1.wav");
+ self.noise1 = "doors/drclos4.wav";
+ self.noise2 = "doors/doormv1.wav";
+ break;
+ case 2:
+ precache_sound ("doors/hydro1.wav");
+ precache_sound ("doors/hydro2.wav");
+ self.noise2 = "doors/hydro1.wav";
+ self.noise1 = "doors/hydro2.wav";
+ break;
+ case 3:
+ precache_sound ("doors/stndr1.wav");
+ precache_sound ("doors/stndr2.wav");
+ self.noise2 = "doors/stndr1.wav";
+ self.noise1 = "doors/stndr2.wav";
+ break;
+ case 4:
+ precache_sound ("doors/ddoor1.wav");
+ precache_sound ("doors/ddoor2.wav");
+ self.noise1 = "doors/ddoor2.wav";
+ self.noise2 = "doors/ddoor1.wav";
+ break;
+ }
+
+ SetMovedir ();
+
+ self.max_health = self.health;
+ self.solid = SOLID_BSP;
+ self.movetype = MOVETYPE_PUSH;
+ setorigin (self, self.origin);
+ setmodel (self, self.model);
+ self.classname = "door";
+
+ self.blocked = door_blocked;
+ self.use = door_use;
+
+ if (self.spawnflags & DOOR_SILVER_KEY)
+ self.items = IT_KEY1;
+ if (self.spawnflags & DOOR_GOLD_KEY)
+ self.items = IT_KEY2;
+
+ if (!self.speed)
+ self.speed = 100;
+ if (!self.wait)
+ self.wait = 3;
+ if (!self.lip)
+ self.lip = 8;
+ if (!self.dmg)
+ self.dmg = 2;
+
+ self.pos1 = self.origin;
+ self.pos2 = self.pos1 + self.movedir*(fabs(self.movedir*self.size) - self.lip);
+
+// DOOR_START_OPEN is to allow an entity to be lighted in the closed position
+// but spawn in the open position
+ if (self.spawnflags & DOOR_START_OPEN)
+ {
+ setorigin (self, self.pos2);
+ self.pos2 = self.pos1;
+ self.pos1 = self.origin;
+ }
+
+ self.state = STATE_BOTTOM;
+
+ if (self.health)
+ {
+ self.takedamage = DAMAGE_YES;
+ self.th_die = door_killed;
+ }
+
+ if (self.items)
+ self.wait = -1;
+
+ self.touch = door_touch;
+
+// LinkDoors can't be done until all of the doors have been spawned, so
+// the sizes can be detected properly.
+ self.think = LinkDoors;
+ self.nextthink = self.ltime + 0.1;
+};
+
+/*
+=============================================================================
+
+SECRET DOORS
+
+=============================================================================
+*/
+
+void() fd_secret_move1;
+void() fd_secret_move2;
+void() fd_secret_move3;
+void() fd_secret_move4;
+void() fd_secret_move5;
+void() fd_secret_move6;
+void() fd_secret_done;
+
+float SECRET_OPEN_ONCE = 1; // stays open
+float SECRET_1ST_LEFT = 2; // 1st move is left of arrow
+float SECRET_1ST_DOWN = 4; // 1st move is down from arrow
+float SECRET_NO_SHOOT = 8; // only opened by trigger
+float SECRET_YES_SHOOT = 16; // shootable even if targeted
+
+
+void () fd_secret_use =
+{
+ local float temp;
+
+ self.health = 10000;
+
+ // exit if still moving around...
+ if (self.origin != self.oldorigin)
+ return;
+
+ self.message = string_null; // no more message
+
+ SUB_UseTargets(); // fire all targets / killtargets
+
+ if (!(self.spawnflags & SECRET_NO_SHOOT))
+ {
+ self.th_pain = SUB_Null;
+ self.takedamage = DAMAGE_NO;
+ }
+ self.velocity = '0 0 0';
+
+ // Make a sound, wait a little...
+
+ sound(self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
+ self.nextthink = self.ltime + 0.1;
+
+ temp = 1 - (self.spawnflags & SECRET_1ST_LEFT); // 1 or -1
+ makevectors(self.mangle);
+
+ if (!self.t_width)
+ {
+ if (self.spawnflags & SECRET_1ST_DOWN)
+ self.t_width = fabs(v_up * self.size);
+ else
+ self.t_width = fabs(v_right * self.size);
+ }
+
+ if (!self.t_length)
+ self.t_length = fabs(v_forward * self.size);
+
+ if (self.spawnflags & SECRET_1ST_DOWN)
+ self.dest1 = self.origin - v_up * self.t_width;
+ else
+ self.dest1 = self.origin + v_right * (self.t_width * temp);
+
+ self.dest2 = self.dest1 + v_forward * self.t_length;
+ SUB_CalcMove(self.dest1, self.speed, fd_secret_move1);
+ sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
+};
+
+// Wait after first movement...
+void () fd_secret_move1 =
+{
+ self.nextthink = self.ltime + 1.0;
+ self.think = fd_secret_move2;
+ sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
+};
+
+// Start moving sideways w/sound...
+void () fd_secret_move2 =
+{
+ sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
+ SUB_CalcMove(self.dest2, self.speed, fd_secret_move3);
+};
+
+// Wait here until time to go back...
+void () fd_secret_move3 =
+{
+ sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
+ if (!(self.spawnflags & SECRET_OPEN_ONCE))
+ {
+ self.nextthink = self.ltime + self.wait;
+ self.think = fd_secret_move4;
+ }
+};
+
+// Move backward...
+void () fd_secret_move4 =
+{
+ sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
+ SUB_CalcMove(self.dest1, self.speed, fd_secret_move5);
+};
+
+// Wait 1 second...
+void () fd_secret_move5 =
+{
+ self.nextthink = self.ltime + 1.0;
+ self.think = fd_secret_move6;
+ sound(self, CHAN_VOICE, self.noise3, 1, ATTN_NORM);
+};
+
+void () fd_secret_move6 =
+{
+ sound(self, CHAN_VOICE, self.noise2, 1, ATTN_NORM);
+ SUB_CalcMove(self.oldorigin, self.speed, fd_secret_done);
+};
+
+void () fd_secret_done =
+{
+ if (!self.targetname || self.spawnflags&SECRET_YES_SHOOT)
+ {
+ self.health = 10000;
+ self.takedamage = DAMAGE_YES;
+ self.th_pain = fd_secret_use;
+ self.th_die = fd_secret_use;
+ }
+ sound(self, chan_no_phs_add|CHAN_VOICE, self.noise3, 1, ATTN_NORM);
+};
+
+void () secret_blocked =
+{
+ if (time < self.attack_finished)
+ return;
+ self.attack_finished = time + 0.5;
+ T_Damage (other, self, self, self.dmg, MOD_SQUISH);
+};
+
+/*
+================
+secret_touch
+
+Prints messages
+================
+*/
+void() secret_touch =
+{
+ if (other.classname != "player")
+ return;
+ if (self.attack_finished > time)
+ return;
+
+ self.attack_finished = time + 2;
+
+ if (self.message)
+ {
+ centerprint (other, self.message);
+ sound (other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM);
+ }
+};
+
+
+/*QUAKED func_door_secret (0 .5 .8) ? open_once 1st_left 1st_down no_shoot always_shoot
+Basic secret door. Slides back, then to the side. Angle determines direction.
+wait = # of seconds before coming back
+1st_left = 1st move is left of arrow
+1st_down = 1st move is down from arrow
+always_shoot = even if targeted, keep shootable
+t_width = override WIDTH to move back (or height if going down)
+t_length = override LENGTH to move sideways
+"dmg" damage to inflict when blocked (2 default)
+
+If a secret door has a targetname, it will only be opened by it's botton or trigger, not by damage.
+"sounds"
+1) medieval
+2) metal
+3) base
+*/
+
+void () func_door_secret =
+{
+ switch (self.sounds)
+ {
+ case 0:
+ case 3:
+ precache_sound ("doors/basesec1.wav");
+ precache_sound ("doors/basesec2.wav");
+ self.noise2 = "doors/basesec1.wav";
+ self.noise1 = "doors/basesec2.wav";
+ self.noise3 = "doors/basesec2.wav";
+ break;
+ case 1:
+ precache_sound ("doors/latch2.wav");
+ precache_sound ("doors/winch2.wav");
+ precache_sound ("doors/drclos4.wav");
+ self.noise1 = "doors/latch2.wav";
+ self.noise2 = "doors/winch2.wav";
+ self.noise3 = "doors/drclos4.wav";
+ break;
+ case 2:
+ precache_sound ("doors/airdoor1.wav");
+ precache_sound ("doors/airdoor2.wav");
+ self.noise2 = "doors/airdoor1.wav";
+ self.noise1 = "doors/airdoor2.wav";
+ self.noise3 = "doors/airdoor2.wav";
+ break;
+ }
+
+ if (!self.dmg)
+ self.dmg = 2;
+
+ // Magic formula...
+ self.mangle = self.angles;
+ self.angles = '0 0 0';
+ self.solid = SOLID_BSP;
+ self.movetype = MOVETYPE_PUSH;
+ self.classname = "door";
+ setmodel (self, self.model);
+ setorigin (self, self.origin);
+
+ self.touch = secret_touch;
+ self.blocked = secret_blocked;
+ self.speed = 50;
+ self.use = fd_secret_use;
+ if ( !self.targetname || self.spawnflags&SECRET_YES_SHOOT)
+ {
+ self.health = 10000;
+ self.takedamage = DAMAGE_YES;
+ self.th_pain = fd_secret_use;
+ }
+ self.oldorigin = self.origin;
+ if (!self.wait)
+ self.wait = 5; // 5 seconds before closing
+};
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/effects.qc b/r17/Revamped src/Revamped QC/effects.qc
new file mode 100755
index 00000000..0a5c6b8f
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/effects.qc
@@ -0,0 +1,720 @@
+
+// Effects code (EFF) --
+
+// TE effects/muzzleflash/messages
+
+// modular efs
+var float ef_red = 0; // used for glow on pent item
+var float ef_pent = EF_DIMLIGHT; // used for pent effect on player
+var float ef_blue = 0; // used for glow on quad
+var float ef_quad = EF_DIMLIGHT; // used for quad effect on player
+
+// base te write functions
+void WriteVector (float msg, vector org) =
+{
+ WriteCoord (msg, org_x);
+ WriteCoord (msg, org_y);
+ WriteCoord (msg, org_z);
+};
+
+#ifdef NETQUAKE
+void(vector org, float effect) _EFF_PointEffect =
+{
+ WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteByte (MSG_BROADCAST, effect);
+ WriteVector (MSG_BROADCAST, org);
+};
+
+void(entity ent, vector org, vector org2, float effect) _EFF_BeamEffect =
+{
+ WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteByte (MSG_BROADCAST, effect);
+ WriteEntity (MSG_BROADCAST, ent);
+ WriteVector (MSG_BROADCAST, org);
+ WriteVector (MSG_BROADCAST, org2);
+};
+
+void(vector org, float damage, float effect) _EFF_CountEffect =
+{
+ WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteByte (MSG_BROADCAST, effect);
+ WriteByte (MSG_BROADCAST, damage);
+ WriteVector (MSG_BROADCAST, org);
+};
+
+#define EFF_PointEffect(a,b,c) _EFF_PointEffect(a,b)
+#define EFF_BeamEffect(a,b,c,d,e) _EFF_BeamEffect(a,b,c,d)
+#define EFF_CountEffect(a,b,c,d) _EFF_CountEffect(a,b,c)
+#else
+void(vector org, float effect, float mcast) EFF_PointEffect =
+{
+ WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
+ WriteByte (MSG_MULTICAST, effect);
+ WriteVector (MSG_MULTICAST, org);
+ multicast (org, mcast);
+};
+
+void(entity ent, vector org, vector org2, float effect, float mcast) EFF_BeamEffect =
+{
+ WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
+ WriteByte (MSG_MULTICAST, effect);
+ WriteEntity (MSG_MULTICAST, ent);
+ WriteVector (MSG_MULTICAST, org);
+ WriteVector (MSG_MULTICAST, org2);
+ multicast (org, mcast);
+};
+
+void(vector org, float damage, float effect, float mcast) EFF_CountEffect =
+{
+ WriteByte (MSG_MULTICAST, SVC_TEMPENTITY);
+ WriteByte (MSG_MULTICAST, effect);
+ WriteByte (MSG_MULTICAST, damage);
+ WriteVector (MSG_MULTICAST, org);
+ multicast (org, mcast);
+};
+#endif
+
+/*
+================
+SpawnBlood
+================
+*/
+void(vector org, float damage) _SpawnBlood_TEBlood =
+{
+ te_blood(org, '0 0 0', damage*2);
+};
+
+void(vector org, float damage) _SpawnBlood =
+{
+#ifdef NETQUAKE
+ particle (org, '0 0 0', 73, damage*2);
+#else
+ EFF_CountEffect(org, damage, TE_BLOOD, MULTICAST_PVS);
+#endif
+};
+/*
+void() NadeTouch =
+{
+if (other.nade_lives > 4)
+{
+sprint (other, "Can't pick up anymore grenades/n");
+return;
+}
+other.nade_lives = other.nade_lives + 1;
+};
+
+*/
+void() s_smokee6 = [5, SUB_Remove] {};
+void() s_smokee5 = [4, s_smokee6] {};
+void() s_smokee4 = [3, s_smokee5] {};
+void() s_smokee3 = [2, s_smokee4] {};
+void() s_smokee2 = [1, s_smokee3] {};
+void() s_smokee1 = [0, s_smokee2] {};
+
+void() s_needle3 = [2, SUB_Remove] {};
+void() s_needle2 = [1, s_needle3] {};
+void() s_needle1 = [0, s_needle2] {};
+
+void() s_plasma14 = [13, SUB_Remove] {};
+void() s_plasma13 = [12, s_plasma14] {};
+void() s_plasma12 = [11, s_plasma13] {};
+void() s_plasma11 = [10, s_plasma12] {};
+void() s_plasma10 = [9, s_plasma11] {};
+void() s_plasma9 = [8, s_plasma10] {};
+void() s_plasma8 = [7, s_plasma9] {};
+void() s_plasma7 = [6, s_plasma8] {};
+void() s_plasma6 = [5, s_plasma7] {};
+void() s_plasma5 = [4, s_plasma6] {};
+void() s_plasma4 = [3, s_plasma5] {};
+void() s_plasma3 = [2, s_plasma4] {};
+void() s_plasma2 = [1, s_plasma3] {};
+void() s_plasma1 = [0, s_plasma2] {};
+
+void(vector org) createpinkdust =
+{
+ local entity s;
+
+
+ s = self; // save old self
+
+ self = spawn();
+
+ self.movetype = MOVETYPE_NONE;
+ self.velocity = '0 0 0';
+ self.touch = SUB_Null;
+ setmodel (self, "progs/needler_dust.spr");
+ setorigin (self, org);
+ self.solid = SOLID_NOT;
+ s_needle1();
+ self = s; // restore old self
+
+};
+void(vector org) createplasma =
+{
+ local entity s;
+
+
+ s = self; // save old self
+
+ self = spawn();
+
+ self.movetype = MOVETYPE_NONE;
+ self.velocity = '0 0 0';
+ self.touch = SUB_Null;
+ setmodel (self, "sprites/s_plasma4.spr");
+ setorigin (self, org);
+ self.solid = SOLID_NOT;
+ s_plasma1();
+ self = s; // restore old self
+
+};
+
+void() s_plasmaa5 = [4, SUB_Remove] {};
+void() s_plasmaa4 = [3, s_plasmaa5] {createplasma(self.origin);};
+void() s_plasmaa3 = [2, s_plasmaa4] {};
+void() s_plasmaa2 = [1, s_plasmaa3] {};
+void() s_plasmaa1 = [0, s_plasmaa2] {};
+
+void(vector org) plasmaexplo =
+{
+ local entity s;
+ local float r;
+ r = random();
+
+
+ s = self; // save old self
+
+ self = spawn();
+
+ self.movetype = MOVETYPE_NONE;
+ self.velocity = '0 0 0';
+ self.touch = SUB_Null;
+ setmodel (self, "sprites/plasma3.spr");
+ setorigin (self, org);
+ self.solid = SOLID_NOT;
+
+ // So that debris comes out in random spurts over It coming out in the same number every time --Mexicouger
+
+ s_plasmaa1 ();
+
+ self = s; // restore old self
+};
+void(vector org) pistolsmoke =
+{
+ local entity s;
+
+
+ s = self; // save old self
+
+ self = spawn();
+
+ self.movetype = MOVETYPE_FLY;
+
+
+ self.velocity = v_forward;
+ self.velocity = (self.velocity * 80);
+ self.touch = SUB_Null;
+ setmodel (self, "sprites/s_smoke2.spr");
+ setorigin (self, ((org + (v_forward * 15)) + '0 0 12'));
+ self.solid = SOLID_NOT;
+ s_smokee1();
+ self = s; // restore old self
+};
+
+// #if defined(NETQUAKE) || defined(MONSTERS)
+
+
+void() s_explode14 = [13, SUB_Remove] {};
+void() s_explode13 = [12, s_explode14] {};
+void() s_explode12 = [11, s_explode13] {};
+void() s_explode11 = [10, s_explode12] {};
+void() s_explode10 = [9, s_explode11] {};
+void() s_explode9 = [8, s_explode10] {};
+void() s_explode8 = [7, s_explode9] {};
+void() s_explode7 = [6, s_explode8] {};
+void() s_explode6 = [5, s_explode7] {};
+void() s_explode5 = [4, s_explode6] {};
+void() s_explode4 = [3, s_explode5] {};
+void() s_explode3 = [2, s_explode4] {};
+void() s_explode2 = [1, s_explode3] {};
+void() s_explode1 = [0, s_explode2] {};
+
+void(vector org) CreateExplosion =
+{
+ local entity s;
+ local float r;
+ r = random();
+
+
+ s = self; // save old self
+
+ self = spawn();
+
+ self.movetype = MOVETYPE_NONE;
+ self.velocity = '0 0 0';
+ self.touch = SUB_Null;
+ setmodel (self, "progs/s_explod.spr");
+ setorigin (self, org);
+ self.solid = SOLID_NOT;
+ sound (self, CHAN_WEAPON, "weapons/r_exp3.wav", 1, ATTN_NORM);
+ // So that debris comes out in random spurts over It coming out in the same number every time --Mexicouger
+ s_explode1 ();
+
+ self = s; // restore old self
+};
+// #endif
+
+void(vector org) _TE_explosion =
+{
+ EFF_PointEffect(org, TE_EXPLOSION, MULTICAST_PHS);
+#ifdef NETQUAKE
+ CreateExplosion(org);
+#endif
+};
+
+void(vector org) _TE_gunshot =
+{
+#ifdef NETQUAKE
+ EFF_PointEffect(org, TE_GUNSHOT, MULTICAST_PVS);
+#else
+ EFF_CountEffect(org, 3, TE_GUNSHOT, MULTICAST_PVS);
+#endif
+};
+
+void(vector org) _TE_spike =
+{
+ EFF_PointEffect(org, TE_SPIKE, MULTICAST_PHS);
+};
+
+void(vector org) _TE_knightspike =
+{
+ EFF_PointEffect(org, TE_KNIGHTSPIKE, MULTICAST_PHS);
+};
+
+void(vector org) _TE_wizspike =
+{
+ EFF_PointEffect(org, TE_WIZSPIKE, MULTICAST_PHS);
+};
+
+void(vector org) _TE_superspike =
+{
+ EFF_PointEffect(org, TE_SUPERSPIKE, MULTICAST_PHS);
+};
+
+void(vector org) _TE_teleport =
+{
+ EFF_PointEffect(org, TE_TELEPORT, MULTICAST_PHS);
+};
+
+void(vector org) _TE_lavasplash =
+{
+ EFF_PointEffect(org, TE_LAVASPLASH, MULTICAST_PVS);
+};
+
+void(vector org) _TE_tarexplosion =
+{
+ EFF_PointEffect(org, TE_TAREXPLOSION, MULTICAST_PHS);
+};
+
+void(entity ent, vector start, vector end) _TE_lightning1 =
+{
+ EFF_BeamEffect (ent, start, end, TE_LIGHTNING1, MULTICAST_PHS);
+};
+
+void(entity ent, vector start, vector end) _TE_lightning2 =
+{
+ EFF_BeamEffect (ent, start, end, TE_LIGHTNING2, MULTICAST_PHS);
+};
+
+void(entity ent, vector start, vector end) _TE_lightning3 =
+{
+ EFF_BeamEffect (ent, start, end, TE_LIGHTNING3, MULTICAST_PHS);
+};
+
+void(vector org) TE_lightningblood =
+{
+#ifdef NETQUAKE
+ particle(org, '0 0 100', 225, 120);
+#else
+ EFF_PointEffect(org, TE_LIGHTNINGBLOOD, MULTICAST_PVS);
+#endif
+};
+
+// function pointers for TE calls
+var void(vector org, float damage) SpawnBlood = _SpawnBlood;
+var void(vector org) TE_explosion = _TE_explosion;
+var void(vector org) TE_gunshot = _TE_gunshot;
+var void(vector org) TE_spike = _TE_spike;
+var void(vector org) TE_knightspike = _TE_knightspike;
+var void(vector org) TE_wizspike = _TE_wizspike;
+var void(vector org) TE_superspike = _TE_superspike;
+var void(vector org) TE_teleport = _TE_teleport;
+var void(vector org) TE_lavasplash = _TE_lavasplash;
+var void(vector org) TE_tarexplosion = _TE_tarexplosion;
+var void(entity ent, vector start, vector end) TE_lightning1 = _TE_lightning1;
+var void(entity ent, vector start, vector end) TE_lightning2 = _TE_lightning2;
+var void(entity ent, vector start, vector end) TE_lightning3 = _TE_lightning3;
+
+// set effects function, takes function pointers and assigns them based on detected builtins
+void() EFF_SetEffects =
+{
+ if (eng_support & ENG_EFRED)
+ {
+ ef_pent = 128;
+ ef_red = 128;
+ }
+
+ if (eng_support & ENG_EFBLUE)
+ {
+ ef_blue = 64;
+ ef_quad = 64;
+ }
+
+ if (eng_support & ENG_TEBUILTINS)
+ {
+ // use TE_ builtins instead
+ TE_explosion = _te_explosion;
+ TE_gunshot = _te_gunshot;
+ TE_spike = _te_spike;
+ TE_knightspike = _te_knightspike;
+ TE_wizspike = _te_wizspike;
+ TE_superspike = _te_superspike;
+ TE_teleport = _te_teleport;
+ TE_lavasplash = _te_lavasplash;
+ TE_tarexplosion = _te_tarexplosion;
+ TE_lightning1 = _te_lightning1;
+ TE_lightning2 = _te_lightning2;
+ TE_lightning3 = _te_lightning3;
+ }
+
+ if (eng_support & ENG_TEBLOOD)
+ SpawnBlood = _SpawnBlood_TEBlood; // use TE_Blood builtin instead
+};
+
+// view kicks
+void(entity ent) VK_smallkick =
+{
+#ifdef NETQUAKE
+ self.punchangle_x = -2;
+#else
+ msg_entity = ent;
+ WriteByte (MSG_ONE, SVC_SMALLKICK);
+#endif
+}
+
+void(entity ent) VK_bigkick =
+{
+#ifdef NETQUAKE
+ self.punchangle_x = -4;
+#else
+ msg_entity = ent;
+ WriteByte (MSG_ONE, SVC_BIGKICK);
+#endif
+}
+void(entity ent) VK_hugekick =
+{
+#ifdef NETQUAKE
+ self.punchangle_x = -8;
+#else
+ msg_entity = ent;
+ WriteByte (MSG_ONE, SVC_HUGEKICK);
+#endif
+}
+
+// muzzle flash
+void() muzzleflash =
+{
+#ifdef NETQUAKE
+ self.effects |= EF_MUZZLEFLASH;
+#else
+ WriteByte (MSG_MULTICAST, SVC_MUZZLEFLASH);
+ WriteEntity (MSG_MULTICAST, self);
+ multicast (self.origin, MULTICAST_PVS);
+#endif
+};
+
+// touch blood functions
+void(float damage) spawn_touchblood =
+{
+ local vector vel;
+
+ vel = normalize (self.velocity);
+ vel = normalize(vel + v_up*(random()- 0.5) + v_right*(random()- 0.5));
+ vel = vel + 2*trace_plane_normal;
+ vel = vel * 0.4;
+ SpawnBlood (self.origin + vel, damage);
+};
+/*
+============================================
+HUD weapon ammo counter. Counts ammo and displays
+Number of bullets.
+
+============================================
+*/
+void() AmmoCounter =
+{
+if (self.weapon == IT_SHOTGUN)
+{
+ stuffcmd (self, "cl_ar_ammo 0\n");
+ stuffcmd (self, "cl_shotgun_ammo 0\n");
+ stuffcmd (self, "cl_needler_ammo 0\n");
+ stuffcmd (self, "cl_rocket_ammo 0\n");
+ stuffcmd (self, "cl_weaponhud 0\n");
+
+ if (self.ammo_shells == 12)
+ stuffcmd (self, "cl_pistol_ammo 12\n");
+ if (self.ammo_shells == 11)
+ stuffcmd (self, "cl_pistol_ammo 11\n");
+ if (self.ammo_shells == 10)
+ stuffcmd (self, "cl_pistol_ammo 10\n");
+ if (self.ammo_shells == 9)
+ stuffcmd (self, "cl_pistol_ammo 9\n");
+ if (self.ammo_shells == 8)
+ stuffcmd (self, "cl_pistol_ammo 8\n");
+ if (self.ammo_shells == 7)
+ stuffcmd (self, "cl_pistol_ammo 7\n");
+ if (self.ammo_shells == 6)
+ stuffcmd (self, "cl_pistol_ammo 6\n");
+ if (self.ammo_shells == 5)
+ stuffcmd (self, "cl_pistol_ammo 5\n");
+ if (self.ammo_shells == 4)
+ stuffcmd (self, "cl_pistol_ammo 4\n");
+ if (self.ammo_shells == 3)
+ stuffcmd (self, "cl_pistol_ammo 3\n");
+ if (self.ammo_shells == 2)
+ stuffcmd (self, "cl_pistol_ammo 2\n");
+ if (self.ammo_shells == 1)
+ stuffcmd (self, "cl_pistol_ammo 1\n");
+ if (self.ammo_shells == 0)
+ stuffcmd (self, "cl_pistol_ammo 0\n");
+ }
+ if (self.weapon == IT_SUPER_SHOTGUN)
+ {
+ stuffcmd (self, "cl_ar_ammo 0\n");
+ stuffcmd (self, "cl_pistol_ammo 0\n");
+ stuffcmd (self, "cl_needler_ammo 0\n");
+ stuffcmd (self, "cl_rocket_ammo 0\n");
+ stuffcmd (self, "cl_weaponhud 0\n");
+
+ if (self.ammo_shells2 == 6)
+ stuffcmd (self, "cl_shotgun_ammo 6\n");
+ if (self.ammo_shells2 == 5)
+ stuffcmd (self, "cl_shotgun_ammo 5\n");
+ if (self.ammo_shells2 == 4)
+ stuffcmd (self, "cl_shotgun_ammo 4\n");
+ if (self.ammo_shells2 == 3)
+ stuffcmd (self, "cl_shotgun_ammo 3\n");
+ if (self.ammo_shells2 == 2)
+ stuffcmd (self, "cl_shotgun_ammo 2\n");
+ if (self.ammo_shells2 == 1)
+ stuffcmd (self, "cl_shotgun_ammo 1\n");
+ if (self.ammo_shells2 == 0)
+ stuffcmd (self, "cl_shotgun_ammo 0\n");
+ }
+ if (self.weapon == IT_NAILGUN)
+ {
+ stuffcmd (self, "cl_pistol_ammo 0\n");
+ stuffcmd (self, "cl_shotgun_ammo 0\n");
+ stuffcmd (self, "cl_needler_ammo 0\n");
+ stuffcmd (self, "cl_rocket_ammo 0\n");
+ stuffcmd (self, "cl_weaponhud 0\n");
+
+ if (self.ammo_nails == 32)
+ stuffcmd (self, "cl_ar_ammo 32\n");
+ if (self.ammo_nails == 31)
+ stuffcmd (self, "cl_ar_ammo 31\n");
+ if (self.ammo_nails == 30)
+ stuffcmd (self, "cl_ar_ammo 30\n");
+ if (self.ammo_nails == 29)
+ stuffcmd (self, "cl_ar_ammo 29\n");
+ if (self.ammo_nails == 28)
+ stuffcmd (self, "cl_ar_ammo 28\n");
+ if (self.ammo_nails == 27)
+ stuffcmd (self, "cl_ar_ammo 27\n");
+ if (self.ammo_nails == 26)
+ stuffcmd (self, "cl_ar_ammo 26\n");
+ if (self.ammo_nails == 25)
+ stuffcmd (self, "cl_ar_ammo 25\n");
+ if (self.ammo_nails == 24)
+ stuffcmd (self, "cl_ar_ammo 24\n");
+ if (self.ammo_nails == 23)
+ stuffcmd (self, "cl_ar_ammo 23\n");
+ if (self.ammo_nails == 22)
+ stuffcmd (self, "cl_ar_ammo 22\n");
+ if (self.ammo_nails == 21)
+ stuffcmd (self, "cl_ar_ammo 21\n");
+ if (self.ammo_nails == 20)
+ stuffcmd (self, "cl_ar_ammo 20\n");
+ if (self.ammo_nails == 19)
+ stuffcmd (self, "cl_ar_ammo 19\n");
+ if (self.ammo_nails == 18)
+ stuffcmd (self, "cl_ar_ammo 18\n");
+ if (self.ammo_nails == 17)
+ stuffcmd (self, "cl_ar_ammo 17\n");
+ if (self.ammo_nails == 16)
+ stuffcmd (self, "cl_ar_ammo 16\n");
+ if (self.ammo_nails == 15)
+ stuffcmd (self, "cl_ar_ammo 15\n");
+ if (self.ammo_nails == 14)
+ stuffcmd (self, "cl_ar_ammo 14\n");
+ if (self.ammo_nails == 13)
+ stuffcmd (self, "cl_ar_ammo 13\n");
+ if (self.ammo_nails == 12)
+ stuffcmd (self, "cl_ar_ammo 12\n");
+ if (self.ammo_nails == 11)
+ stuffcmd (self, "cl_ar_ammo 11\n");
+ if (self.ammo_nails == 10)
+ stuffcmd (self, "cl_ar_ammo 10\n");
+ if (self.ammo_nails == 9)
+ stuffcmd (self, "cl_ar_ammo 9\n");
+ if (self.ammo_nails == 8)
+ stuffcmd (self, "cl_ar_ammo 8\n");
+ if (self.ammo_nails == 7)
+ stuffcmd (self, "cl_ar_ammo 7\n");
+ if (self.ammo_nails == 6)
+ stuffcmd (self, "cl_ar_ammo 6\n");
+ if (self.ammo_nails == 5)
+ stuffcmd (self, "cl_ar_ammo 5\n");
+ if (self.ammo_nails == 4)
+ stuffcmd (self, "cl_ar_ammo 4\n");
+ if (self.ammo_nails == 3)
+ stuffcmd (self, "cl_ar_ammo 3\n");
+ if (self.ammo_nails == 2)
+ stuffcmd (self, "cl_ar_ammo 2\n");
+ if (self.ammo_nails == 1)
+ stuffcmd (self, "cl_ar_ammo 1\n");
+ if (self.ammo_nails == 0)
+ stuffcmd (self, "cl_ar_ammo 0\n");
+ }
+ if (self.weapon == IT_ROCKET_LAUNCHER)
+ {
+ stuffcmd (self, "cl_ar_ammo 0\n"); //Turns off other ammo counters
+ stuffcmd (self, "cl_pistol_ammo 0\n");
+ stuffcmd (self, "cl_needler_ammo 0\n");
+ stuffcmd (self, "cl_shotgun_ammo 0\n");
+ stuffcmd (self, "cl_weaponhud 0\n"); //Keeps Needler Weapon Icon off
+
+ if (self.ammo_rockets == 2)
+ stuffcmd (self, "cl_rocket_ammo 2\n");
+ if (self.ammo_rockets == 1)
+ stuffcmd (self, "cl_rocket_ammo 1\n");
+ if (self.ammo_rockets == 0)
+ stuffcmd (self, "cl_rocket_ammo 0\n");
+ }
+ if (self.weapon == IT_LIGHTNING)
+ {
+ stuffcmd (self, "cl_ar_ammo 0\n");
+ stuffcmd (self, "cl_shotgun_ammo 0\n");
+ stuffcmd (self, "cl_needler_ammo 0\n");
+ stuffcmd (self, "cl_rocket_ammo 0\n");
+ stuffcmd (self, "cl_pistol_ammo 0\n");
+ }
+ if (self.weapon == IT_AXE)
+ {
+ stuffcmd (self, "cl_ar_ammo 0\n");
+ stuffcmd (self, "cl_shotgun_ammo 0\n");
+ stuffcmd (self, "cl_needler_ammo 0\n");
+ stuffcmd (self, "cl_rocket_ammo 0\n");
+ stuffcmd (self, "cl_pistol_ammo 0\n");
+ }
+ if (self.weapon == WEAPON_NEEDLER)
+ {
+ stuffcmd (self, "cl_weaponhud 1\n"); //Turns needler Icon on.
+ stuffcmd (self, "cl_pistol_ammo 0\n");
+ stuffcmd (self, "cl_shotgun_ammo 0\n");
+ stuffcmd (self, "cl_ar_ammo 0\n");
+ stuffcmd (self, "cl_rocket_ammo 0\n");
+
+ if (self.ammo_needler == 20)
+ stuffcmd (self, "cl_needler_ammo 20\n");
+ if (self.ammo_needler == 19)
+ stuffcmd (self, "cl_needler_ammo 19\n");
+ if (self.ammo_needler == 18)
+ stuffcmd (self, "cl_needler_ammo 18\n");
+ if (self.ammo_needler == 17)
+ stuffcmd (self, "cl_needler_ammo 17\n");
+ if (self.ammo_needler == 16)
+ stuffcmd (self, "cl_needler_ammo 16\n");
+ if (self.ammo_needler == 15)
+ stuffcmd (self, "cl_needler_ammo 15\n");
+ if (self.ammo_needler == 14)
+ stuffcmd (self, "cl_needler_ammo 14\n");
+ if (self.ammo_needler == 13)
+ stuffcmd (self, "cl_needler_ammo 13\n");
+ if (self.ammo_needler == 12)
+ stuffcmd (self, "cl_needler_ammo 12\n");
+ if (self.ammo_needler == 11)
+ stuffcmd (self, "cl_needler_ammo 11\n");
+ if (self.ammo_needler == 10)
+ stuffcmd (self, "cl_needler_ammo 10\n");
+ if (self.ammo_needler == 9)
+ stuffcmd (self, "cl_needler_ammo 9\n");
+ if (self.ammo_needler == 8)
+ stuffcmd (self, "cl_needler_ammo 8\n");
+ if (self.ammo_needler == 7)
+ stuffcmd (self, "cl_needler_ammo 7\n");
+ if (self.ammo_needler == 6)
+ stuffcmd (self, "cl_needler_ammo 6\n");
+ if (self.ammo_needler == 5)
+ stuffcmd (self, "cl_needler_ammo 5\n");
+ if (self.ammo_needler == 4)
+ stuffcmd (self, "cl_needler_ammo 4\n");
+ if (self.ammo_needler == 3)
+ stuffcmd (self, "cl_needler_ammo 3\n");
+ if (self.ammo_needler == 2)
+ stuffcmd (self, "cl_needler_ammo 2\n");
+ if (self.ammo_needler == 1)
+ stuffcmd (self, "cl_needler_ammo 1\n");
+ if (self.ammo_needler == 0)
+ stuffcmd (self, "cl_needler_ammo 0\n");
+ }
+ if (self.weapon == WEAPON_PRIFLE)
+ {
+ stuffcmd (self, "cl_ar_ammo 0\n");
+ stuffcmd (self, "cl_shotgun_ammo 0\n");
+ stuffcmd (self, "cl_needler_ammo 0\n");
+ stuffcmd (self, "cl_rocket_ammo 0\n");
+ stuffcmd (self, "cl_pistol_ammo 0\n");
+ }
+};
+/*
+==========================================
+
+Gernade counter for the HUD. Displays a players Number
+Of nades.
+
+==========================================
+*/
+void() NadeCounter =
+{
+if (self.selnade == GRENADE_REGULAR)
+ {
+ stuffcmd (self, "cl_plasmanade 2\n");
+ if (self.nade_lives == 4)
+ stuffcmd (self, "cl_nadenum 5\n");
+ if (self.nade_lives == 3)
+ stuffcmd (self, "cl_nadenum 4\n");
+ if (self.nade_lives == 2)
+ stuffcmd (self, "cl_nadenum 3\n");
+ if (self.nade_lives == 1)
+ stuffcmd (self, "cl_nadenum 2\n");
+ if (self.nade_lives == 0)
+ stuffcmd (self, "cl_nadenum 1\n");
+ }
+else if (self.selnade == GRENADE_STICKY)
+ {
+ stuffcmd (self, "cl_plasmanade 1\n");
+ if (self.plasma_lives == 4)
+ stuffcmd (self, "cl_nadenum 5\n");
+ if (self.plasma_lives == 3)
+ stuffcmd (self, "cl_nadenum 4\n");
+ if (self.plasma_lives == 2)
+ stuffcmd (self, "cl_nadenum 3\n");
+ if (self.plasma_lives == 1)
+ stuffcmd (self, "cl_nadenum 2\n");
+ if (self.plasma_lives == 0)
+ stuffcmd (self, "cl_nadenum 1\n");
+ }
+
+
+};
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/engine.qc b/r17/Revamped src/Revamped QC/engine.qc
new file mode 100755
index 00000000..d7e53052
Binary files /dev/null and b/r17/Revamped src/Revamped QC/engine.qc differ
diff --git a/r17/Revamped src/Revamped QC/fight.qc b/r17/Revamped src/Revamped QC/fight.qc
new file mode 100755
index 00000000..84717540
Binary files /dev/null and b/r17/Revamped src/Revamped QC/fight.qc differ
diff --git a/r17/Revamped src/Revamped QC/frikbot/bot.qc b/r17/Revamped src/Revamped QC/frikbot/bot.qc
new file mode 100755
index 00000000..41dcaf0b
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/frikbot/bot.qc
@@ -0,0 +1,1281 @@
+
+/*
+======================================
+FrikBot X (Version 0.10.2)
+======================================
+
+This program is in the Public Domain. My crack legal
+team would like to add:
+
+RYAN "FRIKAC" SMITH IS PROVIDING THIS SOFTWARE "AS IS"
+AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE
+ACCURACY, CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR
+FUNCTIONING OF THIS SOFTWARE AND/OR DOCUMENTATION. IN
+NO EVENT WILL RYAN "FRIKAC" SMITH BE LIABLE FOR ANY
+GENERAL, CONSEQUENTIAL, INDIRECT, INCIDENTAL,
+EXEMPLARY, OR SPECIAL DAMAGES, EVEN IF RYAN "FRIKAC"
+SMITH HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES, IRRESPECTIVE OF THE CAUSE OF SUCH DAMAGES.
+
+You accept this software on the condition that you
+indemnify and hold harmless Ryan "FrikaC" Smith from
+any and all liability or damages to third parties,
+including attorney fees, court costs, and other
+related costs and expenses, arising out of your use
+of this software irrespective of the cause of said
+liability.
+
+The export from the United States or the subsequent
+reexport of this software is subject to compliance
+with United States export control and munitions
+control restrictions. You agree that in the event you
+seek to export this software, you assume full
+responsibility for obtaining all necessary export
+licenses and approvals and for assuring compliance
+with applicable reexport restrictions.
+
+Any reproduction of this software must contain
+this notice in its entirety.
+
+======================================
+These installation instructions only apply to Normal Quake (as does this
+entire file). For QuakeWorld, please refer to bot_qw.qc
+
+--------------------------------------
+To install on a new mod, do all this:
+--------------------------------------
+Place all included bot*.qc files in the subdirectory "frikbot"
+in your source folder, then...
+
+* Add the following lines to progs.src right after the defs.qc line
+frikbot/bot.qc
+frikbot/bot_way.qc
+frikbot/bot_fight.qc
+frikbot/bot_ai.qc
+frikbot/bot_misc.qc
+frikbot/bot_phys.qc
+frikbot/bot_move.qc
+frikbot/bot_ed.qc
+
+--------------------------------------
+* Comment out the following functions in defs.qc
+sound, stuffcmd, sprint, aim, centerprint, setspawnparms
+WriteByte, WriteChar, WriteShort, WriteLong, WriteCoord
+WriteAngle, WriteString, WriteEntity
+--------------------------------------
+* Add this to worldspawn() in world.qc, right at the very top, before InitBodyQue();
+BotInit(); // FrikBot
+--------------------------------------
+* add this line to StartFrame() in world.qc, at the very top
+BotFrame(); // FrikBot
+--------------------------------------
+* Add these two lines to PlayerPreThink in client.qc at the very top
+if (BotPreFrame()) // FrikBot
+ return;
+--------------------------------------
+* Add this line to PlayerPostThink in client.qc at the very top
+if (BotPostFrame()) // FrikBot
+ return;
+--------------------------------------
+* Add the following line to the very top of Client Connect in client.qc
+ClientInRankings(); // FrikBot
+--------------------------------------
+* Add these lines to the very top of ClientDisconnect in client.qc
+ClientDisconnected(); // FrikBot
+--------------------------------------
+
+To install the waypoints:
+
+add
+
+waypoints/map_dm1.qc
+waypoints/map_dm2.qc
+waypoints/map_dm3.qc
+waypoints/map_dm4.qc
+waypoints/map_dm5.qc
+waypoints/map_dm6.qc
+
+To progs.src, immediately after defs.qc
+
+To remove these waypoints:
+
+Delete the code in bot_map_load, located below.
+*/
+
+
+void() bot_map_load =
+{
+/*
+ // place your qc loaded waypoints here
+
+ if (mapname == "dm1")
+ map_dm1();
+ else if (mapname == "dm2")
+ map_dm2();
+ else if (mapname == "dm3")
+ map_dm3();
+ else if (mapname == "dm4")
+ map_dm4();
+ else if (mapname == "dm5")
+ map_dm5();
+ else if (mapname == "dm6")
+ map_dm6();
+*/
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Variables and shtuff
+
+bot.qc has become pretty much a header file
+for all variable in the bot...
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+// ----- entity fields ---
+.float wallhug, keys, oldkeys, ishuman;
+.float b_frags, b_clientno, b_shirt, b_pants;
+.float /*priority, */ai_time, b_sound, missile_speed;
+.float portal_time, b_skill, switch_wallhug;
+.float b_aiflags, b_num, b_chattime;
+.float b_menu, b_menu_time, b_menu_value;
+.float route_failed, dyn_flags, dyn_time;
+.float dyn_plat;
+.entity temp_way, last_way, phys_obj;
+.entity target1, target2, target3, target4;
+.entity _next, _last;
+.entity current_way;
+.vector b_angle/*, b_dest*/, mouse_emu, obs_dir;
+.vector movevect, b_dir;
+.vector dyn_dest;
+
+// --------defines-----
+float SVC_UPDATENAME = 13;
+float SVC_UPDATEFRAGS = 14;
+float SVC_UPDATECOLORS = 17;
+
+// used for the physics & movement AI
+float KEY_MOVEUP = 1;
+float KEY_MOVEDOWN = 2;
+float KEY_MOVELEFT = 4;
+float KEY_MOVERIGHT = 8;
+float KEY_MOVEFORWARD = 16;
+float KEY_MOVEBACK = 32;
+float KEY_LOOKUP = 64;
+float KEY_LOOKDOWN = 128;
+float KEY_LOOKLEFT = 256;
+float KEY_LOOKRIGHT = 512;
+
+// these are aiflags for waypoints
+// some overlap to the bot
+float AI_TELELINK_1 = 1; // link type
+float AI_TELELINK_2 = 2; // link type
+float AI_TELELINK_3 = 4; // link type
+float AI_TELELINK_4 = 8; // link type
+float AI_DOORFLAG = 16; // read ahead
+float AI_PRECISION = 32; // read ahead + point
+float AI_SURFACE = 64; // point
+float AI_BLIND = 128; // read ahead + point
+float AI_JUMP = 256; // point + ignore
+float AI_DIRECTIONAL = 512; // read ahead + ignore
+float AI_PLAT_BOTTOM = 1024; // read ahead
+float AI_RIDE_TRAIN = 2048; // read ahead
+float AI_SUPER_JUMP = 4096; // point + ignore + route test
+float AI_SNIPER = 8192; // point type
+float AI_AMBUSH = 16384; // point type
+float AI_DOOR_NO_OPEN = 32768; // read ahead
+float AI_DIFFICULT = 65536; // route test
+float AI_TRACE_TEST = 131072; // route test
+
+// these are flags for bots/players (dynamic/editor flags)
+float AI_OBSTRUCTED = 1;
+float AI_HOLD_SELECT = 2;
+float AI_ROUTE_FAILED = 2;
+float AI_WAIT = 4;
+float AI_DANGER = 8;
+
+
+// addition masks
+float AI_POINT_TYPES = 29152;
+float AI_READAHEAD_TYPES = 36528;
+float AI_IGNORE_TYPES = 4864;
+
+float WM_UNINIT = 0;
+float WM_DYNAMIC = 1;
+float WM_LOADING = 2;
+float WM_LOADED = 3;
+float WM_EDITOR = 4;
+float WM_EDITOR_DYNAMIC = 5;
+float WM_EDITOR_DYNLINK = 6;
+
+
+float OPT_SAVEBOTS = 1;
+float OPT_NOCHAT = 2;
+
+// -------globals-----
+float active_clients;
+float max_clients, real_frametime;
+float bot_count, b_options;
+float waypoint_mode, dump_mode;
+float waypoints, direct_route;
+float sv_friction, sv_gravity;
+float sv_accelerate, sv_maxspeed, sv_stopspeed;
+entity fixer;
+entity route_table;
+entity b_temp1, b_temp2, b_temp3;
+entity player_head, phys_head, way_head;
+float busy_waypoints;
+float saved_bots, saved_skills1, saved_skills2, current_bots;
+
+// -------ProtoTypes------
+// external
+void() ClientConnect;
+void() ClientDisconnect;
+void() SetNewParms;
+
+// rankings
+float(float clientno) ClientBitFlag;
+float() ClientNextAvailable;
+void(float whichteam, float whatbot, float whatskill) BotConnect;
+void(entity bot) BotDisconnect;
+void(float clientno) BotInvalidClientNo;
+void(entity who) UpdateClient;
+
+// waypointing
+void() DynamicWaypoint;
+entity(vector org) make_waypoint;
+void() ClearAllWays;
+void() FixWaypoints;
+float() begin_route;
+void(entity this, float direct) bot_get_path;
+void() WaypointThink;
+entity(entity start) FindWayPoint;
+
+// physics & movement
+float(entity e) bot_can_rj;
+void() bot_jump;
+void() frik_bot_roam;
+float(vector weird) frik_walkmove;
+void() frik_movetogoal;
+void() frik_obstacles;
+float(float flag) frik_recognize_plat;
+float(vector sdir) frik_KeysForDir;
+void(vector whichway, float danger) frik_obstructed;
+void() SV_Physics_Client;
+void() SV_ClientThink;
+void() CL_KeyMove;
+
+// ai & misc
+string() PickARandomName;
+float(entity targ) fov;
+float(float y1, float y2) angcomp;
+float(entity targ1, entity targ2) wisible;
+float(entity targ) sisible;
+float(entity targ) fisible;
+vector(entity ent) realorigin;
+void(entity ent) target_drop;
+void(entity ent) target_add;
+void() KickABot;
+void() BotImpulses;
+void(entity targ, float success) bot_lost;
+string(float r) BotName;
+float(float v) frik_anglemod;
+void() bot_chat;
+void(float tpic) bot_start_topic;
+
+
+// editor stuffs
+
+void() bot_way_edit;
+void() bot_menu_display;
+
+
+// ----------Commands---------
+void(entity e, float chan, string samp, float vol, float atten) frik_sound = #8;
+void(entity client, string s) frik_stuffcmd = #21;
+void(entity client, string s) frik_sprint = #24;
+vector(entity e, float sped) frik_aim = #44;
+void(entity client, string s) frik_centerprint = #73;
+void(entity e) frik_setspawnparms = #78;
+void(float to, float f) frik_WriteByte = #52;
+void(float to, float f) frik_WriteChar = #53;
+void(float to, float f) frik_WriteShort = #54;
+void(float to, float f) frik_WriteLong = #55;
+void(float to, float f) frik_WriteCoord = #56;
+void(float to, float f) frik_WriteAngle = #57;
+void(float to, string s) frik_WriteString = #58;
+void(float to, entity s) frik_WriteEntity = #59;
+
+void(entity client, string s1, string s2, string s3, string s4, string s5, string s6, string s7)
+frik_big_centerprint = #73;
+
+//----------------------------------------------------------------------------
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Function redclarations. These allow function
+designed to work for clients (sprint, so forth)
+to mainly not complain when working with a bot
+
+Although these shouldn't be needed anymore,
+as the bots truly are clients now, if you don't
+stop the SZ_ buffer from filling up by disabling
+direct messages to the bots, it crashes quake :-(
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+void(entity client, string s) stuffcmd =
+{
+ if (client.ishuman == 1)
+ frik_stuffcmd(client, s);
+ b_temp1 = player_head;
+
+ while(b_temp1)
+ {
+ if (b_temp1.classname == "botcam")
+ {
+ if ((b_temp1.enemy == client) && b_temp1.ishuman)
+ frik_stuffcmd(b_temp1, s);
+ }
+ b_temp1 = b_temp1._next;
+ }
+};
+
+void(entity e) setspawnparms =
+{
+ if (e.ishuman == 1)
+ frik_setspawnparms(e);
+ else
+ {
+ b_temp1 = player_head;
+ while(b_temp1)
+ {
+ if (b_temp1.ishuman)
+ {
+ frik_setspawnparms(b_temp1);
+ return;
+ }
+ b_temp1 = b_temp1._next;
+ }
+ SetNewParms();
+ }
+};
+void(entity client, string s) sprint =
+{
+ if (client.ishuman == 1)
+ frik_sprint(client, s);
+ b_temp1 = player_head;
+
+ while(b_temp1)
+ {
+ if (b_temp1.classname == "botcam")
+ {
+ if ((b_temp1.enemy == client) && b_temp1.ishuman)
+ frik_sprint(b_temp1, s);
+ }
+ b_temp1 = b_temp1._next;
+ }
+
+};
+void( string s ) bprint =
+{
+ _bprint( s );
+
+};
+
+void(entity client, string s) centerprint =
+{
+ if (client.ishuman == 1)
+ frik_centerprint(client, s);
+ b_temp1 = player_head;
+
+ while(b_temp1)
+ {
+ if (b_temp1.classname == "botcam")
+ {
+ if ((b_temp1.enemy == client) && b_temp1.ishuman)
+ frik_centerprint(b_temp1, s);
+ }
+ b_temp1 = b_temp1._next;
+ }
+};
+
+vector(entity e, float sped) aim =
+{
+ e.missile_speed = sped;
+ return frik_aim(e, sped);
+};
+
+void(entity e, float chan, string samp, float vol, float atten) sound =
+{
+
+ frik_sound(e, chan, samp, vol, atten);
+ if (samp == "items/inv3.wav")
+ return;
+ else if (e.classname == "player")
+ e.b_sound = time + 1;
+ else if (other.classname == "player")
+ other.b_sound = time + 1;
+
+};
+void(float to, float f) WriteByte =
+{
+ if ((to == MSG_ONE) && (msg_entity.ishuman != TRUE))
+ return;
+ frik_WriteByte(to, f);
+};
+void(float to, float f) WriteChar =
+{
+ if ((to == MSG_ONE) && (msg_entity.ishuman != TRUE))
+ return;
+ frik_WriteChar(to, f);
+};
+void(float to, float f) WriteShort =
+{
+ if ((to == MSG_ONE) && (msg_entity.ishuman != TRUE))
+ return;
+ frik_WriteShort(to, f);
+};
+void(float to, float f) WriteLong =
+{
+ if ((to == MSG_ONE) && (msg_entity.ishuman != TRUE))
+ return;
+ frik_WriteLong(to, f);
+};
+void(float to, float f) WriteCoord =
+{
+ if ((to == MSG_ONE) && (msg_entity.ishuman != TRUE))
+ return;
+ frik_WriteCoord(to, f);
+};
+void(float to, float f) WriteAngle =
+{
+ if ((to == MSG_ONE) && (msg_entity.ishuman != TRUE))
+ return;
+ frik_WriteAngle(to, f);
+};
+void(float to, string s) WriteString =
+{
+ if ((to == MSG_ONE) && (msg_entity.ishuman != TRUE))
+ return;
+ frik_WriteString(to, s);
+};
+void(float to, entity s) WriteEntity =
+{
+ if ((to == MSG_ONE) && (msg_entity.ishuman != TRUE))
+ return;
+ frik_WriteEntity(to, s);
+};
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Bot Cam, see what the bot sees (or any other player)
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+float() botcam =
+{
+ if (self.classname != "botcam")
+ return FALSE;
+ setorigin(self, self.enemy.origin);
+ self.items = self.enemy.items;
+ self.weapon = self.enemy.weapon;
+ self.weaponmodel = self.enemy.weaponmodel;
+ self.currentammo = self.enemy.currentammo;
+ self.weaponframe = self.enemy.weaponframe;
+ self.ammo_shells = self.enemy.ammo_shells;
+ self.ammo_nails = self.enemy.ammo_nails;
+ self.ammo_rockets= self.enemy.ammo_rockets;
+ self.ammo_cells = self.enemy.ammo_cells;
+ self.view_ofs = self.enemy.view_ofs;
+ self.health = self.enemy.health;
+ self.armorvalue = self.enemy.armorvalue;
+ self.dmg_take = self.enemy.dmg_take;
+ self.dmg_save = self.enemy.dmg_save;
+ self.dmg_inflictor = self.enemy.dmg_inflictor;
+ self.punchangle = self.enemy.punchangle;
+ self.deadflag = self.enemy.deadflag;
+ msg_entity = self;
+ WriteByte (MSG_ONE,5);
+ WriteEntity (MSG_ONE, self.enemy);
+ WriteByte (MSG_ONE, 10);
+ WriteAngle (MSG_ONE,self.enemy.v_angle_x);
+ WriteAngle (MSG_ONE,self.enemy.v_angle_y);
+ WriteAngle (MSG_ONE,self.enemy.v_angle_z);
+ self.modelindex = 0;
+
+ self.impulse = 0;
+ return TRUE;
+
+};
+
+void() botcam_u =
+{
+
+ // sloppy cycling code
+ if (self.classname != "botcam")
+ {
+ self.enemy = player_head;
+ }
+ else
+ {
+ do
+ self.enemy = self.enemy._next;
+ while (self.enemy.classname == "botcam");
+ }
+ if (self.enemy == self)
+ {
+ do
+ self.enemy = self.enemy._next;
+ while (self.enemy.classname == "botcam");
+ }
+
+ self.classname = "botcam";
+ self.solid = SOLID_NOT;
+ self.movetype = MOVETYPE_NONE;
+ self.takedamage = DAMAGE_NO;
+
+
+ if (!self.enemy)
+ {
+ sprint(self, "No one left to track!\n");
+ msg_entity = self;
+ WriteByte (MSG_ONE,5);
+ WriteEntity (MSG_ONE, self);
+ PutClientInServer();
+ return;
+ }
+ if (!self.enemy.ishuman)
+ {
+ self.enemy.dmg_take = 0;
+ self.enemy.dmg_save = 0;
+ }
+ sprint(self, "Now tracking ");
+ sprint(self, self.enemy.netname);
+ sprint(self, "\n");
+};
+
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Stuff mentioned up top
+it just links the bot into the mod
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() ClientFixRankings =
+{
+ local float cno;
+
+ if (self.switch_wallhug > time)
+ return;
+ self.switch_wallhug = 0;
+
+ b_temp2 = nextent(world);
+ cno = 0;
+
+ while (cno < max_clients)
+ {
+ if ((!b_temp2.ishuman) && (active_clients & ClientBitFlag(cno)))
+ UpdateClient(b_temp2);
+ cno = cno + 1;
+ b_temp2 = nextent(b_temp2);
+ }
+};
+
+void() ClientInRankings =
+{
+ local float cno;
+
+ cno = self.colormap - 1;
+ BotInvalidClientNo (cno);
+
+ if (player_head)
+ player_head._last = self;
+
+ self._next = player_head;
+ self._last = world;
+ player_head = self;
+
+ if (!self.phys_obj)
+ {
+ b_temp2 = phys_head;
+ while (b_temp2 != world && b_temp2.owner != self)
+ b_temp2 = b_temp2._next;
+ self.phys_obj = b_temp2;
+ }
+
+ if (self.ishuman == 2)
+ {
+ self.ishuman = FALSE;
+ return;
+ }
+ active_clients = active_clients | ClientBitFlag(cno);
+
+ self.b_clientno = cno;
+ self.ishuman = TRUE;
+ self.switch_wallhug = time + 1;
+};
+
+
+void() ClientDisconnected =
+{
+ if (player_head == self)
+ player_head = self._next;
+ if (self._next)
+ self._next._last = self._last;
+ if (self._last)
+ self._last._next = self._next;
+
+ active_clients = active_clients - active_clients & ClientBitFlag(self.b_clientno);
+};
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+BotPreFrame & BotPostFrame, used to make the
+bot easier to install
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+float () BotPreFrame =
+{
+ if (self.b_clientno == -1)
+ return TRUE;
+ if (self.ishuman)
+ {
+ if (self.switch_wallhug)
+ ClientFixRankings();
+ if (self.classname == "botcam")
+ return TRUE;
+
+ }
+ if (self.b_frags != self.frags)
+ {
+
+ if (self.b_frags > self.frags)
+ {
+ if (pointcontents(self.origin) == CONTENT_LAVA)
+ bot_start_topic(10);
+ else
+ bot_start_topic(9);
+ }
+ else
+ bot_start_topic(2);
+ self.b_frags = self.frags;
+ }
+ DynamicWaypoint();
+ return FALSE;
+};
+float () BotPostFrame =
+{
+ if (self.b_clientno == -1)
+ return TRUE;
+ if (self.ishuman)
+ {
+
+ if (waypoint_mode > WM_LOADED)
+ bot_menu_display();
+
+ BotImpulses();
+
+ if (botcam())
+ return TRUE;
+ }
+ return FALSE;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Bot Chat code
+
+The rest of this code is in bot_misc.qc
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+void(string h) BotSay = // simulate talking by composing a 'chat' message
+{
+ WriteByte(MSG_ALL, 8);
+ WriteByte(MSG_ALL, 1);
+ WriteString(MSG_ALL, self.netname);
+ WriteByte(MSG_ALL, 8);
+ WriteByte(MSG_ALL, 2);
+ WriteString(MSG_ALL, h);
+};
+void() BotSayInit =
+{
+ WriteByte(MSG_ALL, 8);
+ WriteByte(MSG_ALL, 1);
+ WriteString(MSG_ALL, self.netname);
+};
+void(string h) BotSay2 =
+{
+ WriteByte(MSG_ALL, 8);
+ WriteByte(MSG_ALL, 2);
+ WriteString(MSG_ALL, h);
+};
+void(string h) BotSayTeam =
+{
+ local entity t;
+ if (!teamplay)
+ return;
+ t = player_head;
+ while(t)
+ {
+ if (t.team == self.team)
+ {
+ msg_entity = t;
+ WriteByte(MSG_ONE, 8);
+ WriteByte(MSG_ONE, 1);
+ WriteByte(MSG_ONE, 40);
+ WriteString(MSG_ONE, self.netname);
+ WriteByte(MSG_ONE, 8);
+ WriteByte(MSG_ONE, 2);
+ WriteByte(MSG_ONE, 41);
+ WriteString(MSG_ONE, h);
+ }
+ t = t._next;
+ }
+};
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+BotInit
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+
+void() BotInit =
+{
+ local entity ent, fisent;
+ local float numents;
+
+ // spawn entities for the physics
+ ent = nextent(world);
+ max_clients = 0;
+
+ while(ent != world)
+ {
+ max_clients = max_clients + 1;
+ ent = nextent(ent);
+ }
+ if (max_clients > 16)
+ max_clients = 16;
+
+ ent = nextent(world);
+ fisent = world;
+ while (numents < max_clients)
+ {
+
+ phys_head = spawn();
+ if (fisent)
+ fisent._next = phys_head;
+ phys_head._last = fisent;
+ fisent = phys_head;
+ ent.phys_obj = phys_head;
+ phys_head.classname = "phys_obj";
+ phys_head.owner = ent;
+ numents = numents + 1;
+ ent = nextent(ent);
+ }
+ precache_model("progs/s_light.spr");
+ precache_model("progs/s_bubble.spr");
+
+
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Rankings 'utilities'. Written by Alan Kivlin,
+this code just fools clients by sending precisely
+the same network messages as when a real player
+signs on to the server.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+
+void(entity who) UpdateClient =
+{
+ WriteByte (MSG_ALL, SVC_UPDATENAME);
+ WriteByte (MSG_ALL, who.b_clientno);
+ WriteString (MSG_ALL, who.netname);
+ WriteByte (MSG_ALL, SVC_UPDATECOLORS);
+ WriteByte (MSG_ALL, who.b_clientno);
+ WriteByte (MSG_ALL, who.b_shirt * 16 + who.b_pants);
+ WriteByte (MSG_ALL, SVC_UPDATEFRAGS);
+ WriteByte (MSG_ALL, who.b_clientno);
+ WriteShort (MSG_ALL, who.frags);
+};
+
+float(float clientno) ClientBitFlag =
+{
+ // bigger, but faster
+ if (clientno == 0)
+ return 1;
+ else if (clientno == 1)
+ return 2;
+ else if (clientno == 2)
+ return 4;
+ else if (clientno == 3)
+ return 8;
+ else if (clientno == 4)
+ return 16;
+ else if (clientno == 5)
+ return 32;
+ else if (clientno == 6)
+ return 64;
+ else if (clientno == 7)
+ return 128;
+ else if (clientno == 8)
+ return 256;
+ else if (clientno == 9)
+ return 512;
+ else if (clientno == 10)
+ return 1024;
+ else if (clientno == 11)
+ return 2048;
+ else if (clientno == 12)
+ return 4096;
+ else if (clientno == 13)
+ return 8192;
+ else if (clientno == 14)
+ return 16384;
+ else if (clientno == 15)
+ return 32768;
+ return 0;
+};
+
+float() ClientNextAvailable =
+{
+ local float clientno;
+
+ clientno = max_clients;
+ while(clientno > 0)
+ {
+ clientno = clientno - 1;
+
+ if(!(active_clients & ClientBitFlag(clientno)))
+ return clientno;
+ }
+
+ return -1;
+};
+
+
+void(entity e1, entity e2, float flag) DeveloperLightning =
+{
+ // used to show waypoint links for debugging
+ WriteByte (MSG_BROADCAST, 23);
+ if (flag)
+ WriteByte (MSG_BROADCAST, 6);
+ else
+ WriteByte (MSG_BROADCAST, 13);
+ WriteEntity (MSG_BROADCAST, e2);
+ WriteCoord (MSG_BROADCAST, e1.origin_x);
+ WriteCoord (MSG_BROADCAST, e1.origin_y);
+ WriteCoord (MSG_BROADCAST, e1.origin_z);
+ WriteCoord (MSG_BROADCAST, e2.origin_x);
+ WriteCoord (MSG_BROADCAST, e2.origin_y);
+ WriteCoord (MSG_BROADCAST, e2.origin_z);
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Find Another Color
+
+Team finding code
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+float(float tcolor) FindAnotherColor =
+{
+ local float bestbet, scolor, pcount, bestp;
+ bestbet = -1;
+ bestp = 16;
+ while(scolor < 14)
+ {
+ if (scolor != tcolor)
+ {
+ b_temp2 = player_head;
+ pcount = 0;
+ while(b_temp2 != world)
+ {
+ if (b_temp2.team == scolor + 1)
+ pcount = pcount + 1;
+ b_temp2 = b_temp2._next;
+ }
+ if ((pcount < bestp) && pcount)
+ {
+ bestbet = scolor;
+ bestp = pcount;
+ }
+ }
+ scolor = scolor + 1;
+ }
+ if (bestbet < 0)
+ {
+ bestbet = tcolor;
+ while (bestbet == tcolor)
+ {
+ bestbet = floor(random() * 13);
+ }
+ }
+ return bestbet;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+BotConnect and related functions.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+entity(float num) GetClientEntity =
+{
+ local entity upsy;
+ upsy = world;
+ num = num + 1;
+ while (num > 0)
+ {
+ num = num - 1;
+ upsy = nextent(upsy);
+ }
+ return upsy;
+};
+
+void(float whichteam, float whatbot, float whatskill) BotConnect =
+{
+ local float f;
+ local string h;
+ local entity uself;
+
+ f = ClientNextAvailable();
+ uself = self;
+ if(f == -1)
+ {
+ bprint("Unable to connect a bot, server is full.\n");
+ return;
+ }
+
+ // chat thing
+
+ bot_count = bot_count + 1;
+ self = GetClientEntity(f);
+ if (!saved_bots)
+ bot_start_topic(1);
+ self.b_clientno = f;
+ self.colormap = f + 1;
+ if (whatbot)
+ self.netname = BotName(whatbot);
+ else
+ self.netname = PickARandomName();
+
+
+ // players can set skill all weird, so leave these checks in
+ whatskill = rint(whatskill);
+ if (whatskill > 3)
+ whatskill = 3;
+ else if (whatskill < 0)
+ whatskill = 0;
+ self.b_skill = whatskill;
+
+ if (teamplay && !coop)
+ {
+ if (whichteam)
+ self.b_pants = FindAnotherColor(uself.team - 1);
+ else
+ self.b_pants = uself.team - 1;
+ self.b_shirt = self.b_pants;
+ }
+
+ self.team = self.b_pants + 1;
+ UpdateClient(self);
+ SetNewParms();
+ self.ishuman = 2;
+ ClientConnect();
+ PutClientInServer();
+
+ active_clients = active_clients | ClientBitFlag(f);
+
+ // this is risky... could corrupt .way files if done wrong
+ // If you're not the gambling type, comment this out
+
+ f = ClientBitFlag(self.b_num - 1);
+ current_bots = current_bots | f;
+
+ if (self.b_num <= 8)
+ saved_skills1 = (saved_skills1 & (65536 - (3 * f)) | (self.b_skill * f));
+ else
+ {
+ f = ClientBitFlag(self.b_num - 9);
+ saved_skills2 = (saved_skills2 & (65536 - (3 * f)) | (self.b_skill * f));
+ }
+
+ h = ftos(current_bots);
+ cvar_set("scratch1", h);
+ h = ftos(saved_skills1);
+ cvar_set("scratch2", h);
+ h = ftos(saved_skills2);
+ cvar_set("scratch3", h);
+ self = uself;
+
+};
+
+void(entity bot) BotDisconnect =
+{
+ local string h;
+ local entity uself;
+ uself = self;
+ self = bot;
+
+ bot_count = bot_count - 1;
+ current_bots = current_bots - (current_bots & ClientBitFlag(self.b_num - 1));
+ h = ftos(current_bots);
+ cvar_set("scratch1", h);
+
+
+ ClientDisconnect();
+
+ if (self.b_clientno != -1)
+ {
+ // the bot's client number is not in use by a real player so we
+ // must remove it's entry in the rankings
+ // Quake engine sets all fields to 0, can only do the most important here
+ self.b_frags = self.frags = 0;
+ self.netname = "";
+ self.classname = "";
+ self.health = 0;
+ self.items = 0;
+ self.armorvalue = 0;
+ self.weaponmodel = "";
+ self.b_pants = 0;
+ self.b_shirt = 0;
+ self.ammo_shells = self.ammo_nails = self.ammo_rockets = self.ammo_cells = 0;
+ UpdateClient(self);
+ active_clients = active_clients - (active_clients & ClientBitFlag(self.b_clientno));
+ self.b_clientno = -1;
+ }
+ self = uself;
+};
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+BotInvalidClientNo
+kicks a bot if a player connects and takes the bot's space
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void(float clientno) BotInvalidClientNo =
+{
+ local entity bot;
+
+ bot = GetClientEntity(clientno);
+ if(bot.b_clientno > 0)
+ {
+ if (active_clients & ClientBitFlag(self.b_clientno))
+ {
+ bot.b_clientno = -1;
+ BotDisconnect(bot);
+ active_clients = active_clients | ClientBitFlag(self.b_clientno);
+ BotConnect(0, bot.b_num, bot.b_skill);
+ return;
+ }
+ }
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Waypoint Loading from file
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+void() LoadWaypoint =
+{
+ local vector org;
+ local entity tep;
+ local float r;
+ org_x = cvar("saved1");
+ org_y = cvar("saved2");
+ org_z = cvar("saved3");
+
+ tep = make_waypoint(org);
+
+ r = cvar("saved4");
+
+ tep.b_aiflags = floor(r / 4);
+ tep.b_pants = cvar("scratch1");
+ tep.b_skill = cvar("scratch2");
+ tep.b_shirt = cvar("scratch3");
+ tep.b_frags = cvar("scratch4");
+};
+
+void() bot_return =
+{
+ if (time > 2)
+ {
+ if ((waypoint_mode == WM_DYNAMIC) || (waypoint_mode == WM_LOADED))
+ {
+ // minor precaution
+
+ if (saved_bots & 1) BotConnect(0, 1, saved_skills1 & 3);
+ if (saved_bots & 2) BotConnect(0, 2, (saved_skills1 & 12) / 4);
+ if (saved_bots & 4) BotConnect(0, 3, (saved_skills1 & 48) / 16);
+ if (saved_bots & 8) BotConnect(0, 4, (saved_skills1 & 192) / 64);
+ if (saved_bots & 16) BotConnect(0, 5, (saved_skills1 & 768) / 256);
+ if (saved_bots & 32) BotConnect(0, 6, (saved_skills1 & 3072) / 1024);
+ if (saved_bots & 64) BotConnect(0, 7, (saved_skills1 & 12288) / 4096);
+ if (saved_bots & 128) BotConnect(0, 8, (saved_skills1 & 49152) / 16384);
+ if (saved_bots & 256) BotConnect(0, 9, saved_skills2 & 3);
+ if (saved_bots & 512) BotConnect(0, 10, (saved_skills2 & 12) / 4);
+ if (saved_bots & 1024) BotConnect(0, 11, (saved_skills2& 48) / 16);
+ if (saved_bots & 2048) BotConnect(0, 12, (saved_skills2 & 192) / 64);
+ if (saved_bots & 4096) BotConnect(0, 13, (saved_skills2 & 768) / 256);
+ if (saved_bots & 8192) BotConnect(0, 14, (saved_skills2 & 3072) / 1024);
+ if (saved_bots & 16384) BotConnect(0, 15, (saved_skills2 & 12288) / 4096);
+ if (saved_bots & 32768) BotConnect(0, 16, (saved_skills2 & 49152) / 16384);
+ saved_bots = 0;
+ }
+ }
+};
+
+
+void() WaypointWatch =
+{
+ // Waypoint Baywatch
+ local float bigboobs;
+ local string h;
+ if (framecount < 4)
+ return;
+ if (max_clients < 2)
+ return;
+ if (waypoint_mode != WM_UNINIT)
+ {
+ bigboobs = cvar("saved4");
+ if (bigboobs != 0)
+ {
+ if ((bigboobs & 3) == 1)
+ ClearAllWays();
+ else if ((bigboobs & 3) == 3)
+ {
+ FixWaypoints();
+ h = ftos(b_options);
+ cvar_set("saved1", h);
+ cvar_set("saved4", "0");
+ cvar_set("scratch1", "0");
+ waypoint_mode = WM_LOADED;
+ return;
+ }
+ LoadWaypoint();
+ waypoint_mode = WM_LOADING;
+ cvar_set("saved4", "0");
+ }
+ }
+ else
+ {
+ // the bots return!
+ b_options = cvar("saved1");
+ if (coop || (b_options & OPT_SAVEBOTS))
+ {
+ saved_bots = cvar("scratch1");
+ saved_skills1 = cvar("scratch2");
+ saved_skills2 = cvar("scratch3");
+ }
+ cvar_set ("saved4", "0");
+ if (max_clients > 1)
+ {
+ localcmd("exec maps/");
+ localcmd(mapname);
+ localcmd(".way\n");
+ waypoint_mode = WM_DYNAMIC;
+ bot_map_load();
+ }
+ else
+ waypoint_mode = WM_LOADED;
+ }
+};
+void() BotFrame =
+{
+ local float num;
+
+ // for the sake of speed
+ sv_maxspeed = cvar("sv_maxspeed");
+ sv_gravity = cvar("sv_gravity");
+ sv_friction = cvar("sv_friction");
+ sv_accelerate = cvar("sv_accelerate");
+ sv_stopspeed = cvar("sv_stopspeed");
+ real_frametime = frametime; // in NQ this is alright
+
+ self = nextent(world);
+ num = 0;
+ while (num < max_clients)
+ {
+ if (self.ishuman == FALSE)
+ {
+ if (active_clients & ClientBitFlag(num))
+ {
+ frik_obstacles();
+ CL_KeyMove();
+ SV_ClientThink();
+ SV_Physics_Client();
+ }
+ }
+ self = nextent(self);
+ num = num + 1;
+ }
+ WaypointWatch();
+
+ if (saved_bots)
+ bot_return();
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Bot Impulses. Allows the player to perform bot
+related functions.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() BotImpulses =
+{
+ local float f;
+
+ if (self.impulse == 100)
+ {
+ f = cvar("skill");
+ BotConnect(0, 0, f);
+ }
+ else if (self.impulse == 101)
+ {
+ f = cvar("skill");
+ BotConnect(1, 0, f);
+ }
+ else if (self.impulse == 102)
+ KickABot();
+ else if (self.impulse == 103)
+ botcam_u();
+ else if (self.impulse == 104)
+ bot_way_edit();
+ else
+ return;
+
+ self.impulse = 0;
+};
+
+
+
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/frikbot/bot_ai.qc b/r17/Revamped src/Revamped QC/frikbot/bot_ai.qc
new file mode 100755
index 00000000..60fe6730
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/frikbot/bot_ai.qc
@@ -0,0 +1,1017 @@
+/***********************************************
+* *
+* FrikBot General AI *
+* "The I'd rather be playing Quake AI" *
+* *
+***********************************************/
+
+/*
+
+This program is in the Public Domain. My crack legal
+team would like to add:
+
+RYAN "FRIKAC" SMITH IS PROVIDING THIS SOFTWARE "AS IS"
+AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE
+ACCURACY, CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR
+FUNCTIONING OF THIS SOFTWARE AND/OR DOCUMENTATION. IN
+NO EVENT WILL RYAN "FRIKAC" SMITH BE LIABLE FOR ANY
+GENERAL, CONSEQUENTIAL, INDIRECT, INCIDENTAL,
+EXEMPLARY, OR SPECIAL DAMAGES, EVEN IF RYAN "FRIKAC"
+SMITH HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES, IRRESPECTIVE OF THE CAUSE OF SUCH DAMAGES.
+
+You accept this software on the condition that you
+indemnify and hold harmless Ryan "FrikaC" Smith from
+any and all liability or damages to third parties,
+including attorney fees, court costs, and other
+related costs and expenses, arising out of your use
+of this software irrespective of the cause of said
+liability.
+
+The export from the United States or the subsequent
+reexport of this software is subject to compliance
+with United States export control and munitions
+control restrictions. You agree that in the event you
+seek to export this software, you assume full
+responsibility for obtaining all necessary export
+licenses and approvals and for assuring compliance
+with applicable reexport restrictions.
+
+Any reproduction of this software must contain
+this notice in its entirety.
+
+*/
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+target_onstack
+
+checks to see if an entity is on the bot's stack
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+float(entity scot) target_onstack =
+{
+ if (scot == world)
+ return FALSE;
+ else if (self.target1 == scot)
+ return 1;
+ else if (self.target2 == scot)
+ return 2;
+ else if (self.target3 == scot)
+ return 3;
+ else if (self.target4 == scot)
+ return 4;
+ else
+ return FALSE;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+target_add
+
+adds a new entity to the stack, since it's a
+LIFO stack, this will be the bot's new target1
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void(entity ent) target_add =
+{
+ if (ent == world)
+ return;
+ if (target_onstack(ent))
+ return;
+ self.target4 = self.target3;
+ self.target3 = self.target2;
+ self.target2 = self.target1;
+ self.target1 = ent;
+ self.search_time = time + 5;
+};
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+target_drop
+
+Removes an entity from the bot's target stack.
+The stack will empty everything up to the object
+So if you have target2 item_health, target1
+waypoint, and you drop the health, the waypoint
+is gone too.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void(entity ent) target_drop =
+{
+ local float tg;
+
+ tg = target_onstack(ent);
+ if (tg == 1)
+ {
+ self.target1 = self.target2;
+ self.target2 = self.target3;
+ self.target3 = self.target4;
+ self.target4 = world;
+ }
+ else if (tg == 2)
+ {
+ self.target1 = self.target3;
+ self.target2 = self.target4;
+ self.target3 = self.target4 = world;
+ }
+ else if (tg == 3)
+ {
+ self.target1 = self.target4;
+ self.target2 = self.target3 = self.target4 = world;
+ }
+ else if (tg == 4)
+ self.target1 = self.target2 = self.target3 = self.target4 = world;
+ self.search_time = time + 5;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+bot_lost
+
+Bot has lost its target.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void(entity targ, float success) bot_lost =
+{
+ if (!targ)
+ return;
+
+ target_drop(targ);
+ if (targ.classname == "waypoint")
+ targ.b_sound = targ.b_sound - (targ.b_sound & ClientBitFlag(self.b_clientno));
+
+ // find a new route
+ if (!success)
+ {
+ self.target1 = self.target2 = self.target3 = self.target4 = world;
+ self.last_way = FindWayPoint(self.current_way);
+ ClearMyRoute();
+ self.b_aiflags = 0;
+ }
+ else
+ {
+ if (targ.classname == "item_artifact_invisibility")
+ if (self.items & 524288)
+ bot_start_topic(3);
+
+ if (targ.flags & FL_ITEM)
+ {
+ if (targ.model == string_null)
+ targ._last = world;
+ else
+ targ._last = self;
+ }
+ }
+
+
+ if (targ.classname != "player")
+ targ.search_time = time + 5;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+bot_check_lost
+
+decide if my most immediate target should be
+removed.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+void(entity targ) bot_check_lost =
+{
+ local vector dist;
+ dist = realorigin(targ) - self.origin;
+ dist_z = 0;
+ if (targ == world)
+ return;
+
+ // waypoints and items are lost if you get close enough to them
+
+ else if (targ.flags & FL_ITEM)
+ {
+ if (vlen(targ.origin - self.origin) < 32)
+ bot_lost(targ, TRUE);
+ else if (targ.model == string_null)
+ bot_lost(targ, TRUE);
+ }
+ else if (targ.classname == "waypoint")
+ {
+ if (!(self.b_aiflags & (AI_SNIPER | AI_AMBUSH)))
+ {
+ if (self.b_aiflags & AI_RIDE_TRAIN)
+ {
+ if (vlen(targ.origin - self.origin) < 48)
+ bot_lost(targ, TRUE);
+ }
+ else if (self.b_aiflags & AI_PRECISION)
+ {
+ if (vlen(targ.origin - self.origin) < 24)
+ bot_lost(targ, TRUE);
+ }
+ else if (vlen(targ.origin - self.origin) < 32)
+ bot_lost(targ, TRUE);
+ }
+ }
+ else if (targ.classname == "temp_waypoint")
+ {
+ if (vlen(targ.origin - self.origin) < 32)
+ bot_lost(targ, TRUE);
+ }
+ else if (targ.classname == "player")
+ {
+ if (targ.health <= 0)
+ bot_lost(targ, TRUE);
+ else if ((coop) || (teamplay && targ.team == self.team))
+ {
+ if (targ.target1.classname == "player")
+ {
+ if (!targ.target1.ishuman)
+ bot_lost(targ, TRUE);
+ }
+ else if (targ.teleport_time > time)
+ {
+ // try not to telefrag teammates
+ self.keys = self.keys & 960;
+ }
+ else if (vlen(targ.origin - self.origin) < 128)
+ {
+ if (vlen(targ.origin - self.origin) < 48)
+ frik_walkmove(self.origin - targ.origin);
+ else
+ {
+ self.keys = self.keys & 960;
+ bot_start_topic(4);
+ }
+ self.search_time = time + 5; // never time out
+ }
+ else if (!fisible(targ))
+ bot_lost(targ, FALSE);
+ }
+ else if (waypoint_mode > WM_LOADED)
+ {
+ if (vlen(targ.origin - self.origin) < 128)
+ {
+ bot_lost(targ, TRUE);
+ }
+ }
+ }
+
+ // buttons are lost of their frame changes
+ else if (targ.classname == "func_button")
+ {
+ if (targ.frame)
+ {
+ bot_lost(targ, TRUE);
+ if (self.enemy == targ)
+ self.enemy = world;
+ //if (self.target1)
+ // bot_get_path(self.target1, TRUE);
+
+ }
+ }
+ // trigger_multiple style triggers are lost if their thinktime changes
+ else if ((targ.movetype == MOVETYPE_NONE) && (targ.solid == SOLID_TRIGGER))
+ {
+ if (targ.nextthink >= time)
+ {
+ bot_lost(targ, TRUE);
+ //if (self.target1)
+ // bot_get_path(self.target1, TRUE);
+ }
+ }
+ // lose any target way above the bot's head
+ // FIXME: if the bot can fly in your mod..
+ if ((targ.origin_z - self.origin_z) > 64)
+ {
+ dist = targ.origin - self.origin;
+ dist_z = 0;
+ if (vlen(dist) < 32)
+ if (self.flags & FL_ONGROUND)
+ if(!frik_recognize_plat(FALSE))
+ bot_lost(targ, FALSE);
+ }
+ else if (targ.classname == "train")
+ {
+ if (frik_recognize_plat(FALSE))
+ bot_lost(targ, TRUE);
+ }
+ // targets are lost if the bot's search time has expired
+ if (time > self.search_time)
+ bot_lost(targ, FALSE);
+};
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+bot_handle_ai
+
+This is a 0.10 addition. Handles any action
+based b_aiflags.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() bot_handle_ai =
+{
+ local entity newt;
+ local vector v;
+
+ // handle ai flags -- note, not all aiflags are handled
+ // here, just those that perform some sort of action
+
+ // wait is used by the ai to stop the bot until his search time expires / or route changes
+
+ if (self.b_aiflags & AI_WAIT)
+ self.keys = self.keys & 960;
+
+ if (self.b_aiflags & AI_DOORFLAG) // was on a door when spawned
+ {
+ b_temp3 = self;
+ self = self.last_way;
+ if (!frik_recognize_plat(FALSE)) // if there is nothing there now
+ {
+ newt = FindThing("door"); // this is likely the door responsible (crossfingers)
+ self = b_temp3;
+
+ if (self.b_aiflags & AI_DOOR_NO_OPEN)
+ {
+ if (newt.nextthink)
+ self.keys = self.keys & 960; // wait until it closes
+ else
+ {
+ bot_lost(self.last_way, FALSE);
+ }
+ }
+ else
+ {
+ if (newt.targetname)
+ {
+ newt = find(world, target, newt.targetname);
+ if (newt.health > 0)
+ {
+ self.enemy = newt;
+ bot_weapon_switch(1);
+ }
+ else
+ {
+ // target_drop(self.last_way);
+ target_add(newt);
+ // bot_get_path(newt, TRUE);
+ }
+ }
+ self.b_aiflags = self.b_aiflags - AI_DOORFLAG;
+ }
+ }
+ else
+ self = b_temp3;
+ }
+
+ if (self.b_aiflags & AI_JUMP)
+ {
+ if (self.flags & FL_ONGROUND)
+ {
+ bot_jump();
+ self.b_aiflags = self.b_aiflags - AI_JUMP;
+ }
+ }
+ else if (self.b_aiflags & AI_SUPER_JUMP)
+ {
+ if (self.weapon != 32)
+ self.impulse = 7;
+ else if (self.flags & FL_ONGROUND)
+ {
+ self.b_aiflags = self.b_aiflags - AI_SUPER_JUMP;
+ if (bot_can_rj(self))
+ {
+ bot_jump();
+ self.v_angle_x = self.b_angle_x = 80;
+ self.button0 = TRUE;
+ }
+ else
+ bot_lost(self.target1, FALSE);
+
+ }
+ }
+ if (self.b_aiflags & AI_SURFACE)
+ {
+ if (self.waterlevel > 2)
+ {
+ self.keys = KEY_MOVEUP;
+ self.button2 = TRUE; // swim!
+ }
+ else
+ self.b_aiflags = self.b_aiflags - AI_SURFACE;
+ }
+ if (self.b_aiflags & AI_RIDE_TRAIN)
+ {
+ // simple, but effective
+ // this can probably be used for a lot of different
+ // things, not just trains (door elevators come to mind)
+ b_temp3 = self;
+ self = self.last_way;
+
+ if (!frik_recognize_plat(FALSE)) // if there is nothing there now
+ {
+ self = b_temp3;
+ self.keys = self.keys & 960;
+ }
+ else
+ {
+ self = b_temp3;
+ if (frik_recognize_plat(FALSE))
+ {
+ v = realorigin(trace_ent) + trace_ent.origin - self.origin;
+ v_z = 0;
+ if (vlen(v) < 24)
+ self.keys = self.keys & 960;
+ else
+ {
+ self.b_aiflags = self.b_aiflags | AI_PRECISION;
+ self.keys = frik_KeysForDir(v);
+ }
+ }
+ }
+ }
+ if (self.b_aiflags & AI_PLAT_BOTTOM)
+ {
+ newt = FindThing("plat");
+ if (newt.state != 1)
+ {
+ v = self.origin - realorigin(newt);
+ v_z = 0;
+ if (vlen(v) > 96)
+ self.keys = self.keys & 960;
+ else
+ frik_walkmove(v);
+ }
+ else
+ self.b_aiflags = self.b_aiflags - AI_PLAT_BOTTOM;
+ }
+ if (self.b_aiflags & AI_DIRECTIONAL)
+ {
+ if ((normalize(self.last_way.origin - self.origin) * self.b_dir) > 0.4)
+ {
+ self.b_aiflags = self.b_aiflags - AI_DIRECTIONAL;
+ bot_lost(self.target1, TRUE);
+ }
+ }
+ if (self.b_aiflags & AI_SNIPER)
+ {
+ self.b_aiflags = (self.b_aiflags | AI_WAIT | AI_PRECISION) - AI_SNIPER;
+ // FIXME: Add a switch to wep command
+ // FIXME: increase delay?
+ }
+ if (self.b_aiflags & AI_AMBUSH)
+ {
+ self.b_aiflags = (self.b_aiflags | AI_WAIT) - AI_AMBUSH;
+ // FIXME: Add a switch to wep command
+ // FIXME: increase delay?
+ }
+
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+bot_path
+
+Bot will follow a route generated by the
+begin_route set of functions in bot_way.qc.
+This code, while it works pretty well, can get
+confused
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() bot_path =
+{
+
+ local entity jj, tele;
+
+ bot_check_lost(self.target1);
+ if (!self.target1)
+ {
+ self.keys=0;
+ return;
+ }
+ if (target_onstack(self.last_way))
+ return; // old waypoint still being hunted
+
+ jj = FindRoute(self.last_way);
+ if (!jj)
+ {
+ // this is an ugly hack
+ if (self.target1.current_way != self.last_way)
+ {
+ if (self.target1.classname != "temp_waypoint")
+ if (self.target1.classname != "player")
+ bot_lost(self.target1, FALSE);
+ }
+
+ return;
+ }
+
+ // update the bot's special ai features
+
+ // Readahed types are AI conditions to perform while heading to a waypoint
+ // point types are AI flags that should be executed once reaching a waypoint
+
+ self.b_aiflags = (jj.b_aiflags & AI_READAHEAD_TYPES) | (self.last_way.b_aiflags & AI_POINT_TYPES);
+ target_add(jj);
+ if (self.last_way)
+ {
+ if (CheckLinked(self.last_way, jj) == 2) // waypoints are telelinked
+ {
+ tele = FindThing("trigger_teleport"); // this is probbly the teleport responsible
+ target_add(tele);
+ }
+ traceline(self.last_way.origin, jj.origin, FALSE, self); // check for blockage
+ if (trace_fraction != 1)
+ {
+ if (trace_ent.classname == "door" && !(self.b_aiflags & AI_DOOR_NO_OPEN)) // a door blocks the way
+ {
+ // linked doors fix
+ if (trace_ent.owner)
+ trace_ent = trace_ent.owner;
+ if ((trace_ent.health > 0) && (self.enemy == world))
+ {
+ self.enemy = trace_ent;
+ bot_weapon_switch(1);
+ self.b_aiflags = self.b_aiflags | AI_BLIND; // nick knack paddy hack
+ }
+ else if (trace_ent.targetname)
+ {
+ tele = find(world, target, trace_ent.targetname);
+ if (tele.health > 0)
+ {
+ self.enemy = tele;
+ bot_weapon_switch(1);
+ }
+ else
+ {
+ // target_drop(jj);
+ target_add(tele);
+ // bot_get_path(tele, TRUE);
+ self.b_aiflags = self.b_aiflags | AI_BLIND; // give a bot a bone
+ return;
+ }
+ }
+ }
+ else if (trace_ent.classname == "func_wall")
+ {
+ // give up
+ bot_lost(self.target1, FALSE);
+ return;
+ }
+ }
+ }
+ // this is used for AI_DRIECTIONAL
+ self.b_dir = normalize(jj.origin - self.last_way.origin);
+
+ self.last_way = jj;
+};
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Bot Priority Look. What a stupid name. This is where
+the bot finds things it wants to kill/grab.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+// priority scale
+// 0 - 10 virtually ignore
+// 10 - 30 normal item range
+// 30 - 50 bot will consider this a target worth changing course for
+// 50 - 90 bot will hunt these as vital items
+
+// *!* Make sure you add code to bot_check_lost to remove the target *!*
+
+float(entity thing) priority_for_thing =
+{
+ local float thisp;
+ thisp = 0;
+ // This is the most executed function in the bot. Careful what you do here.
+
+ if ((thing.flags & FL_ITEM) && thing.model != string_null && thing.search_time < time)
+ {
+ // ugly hack
+ if (thing._last != self)
+ thisp = 20;
+ if (thing.classname == "item_artifact_super_damage")
+ thisp = 65;
+ else if (thing.classname == "item_artifact_invulnerability")
+ thisp = 65;
+else if (thing.classname == "weapon_skull")
+thisp = 90;
+ else if (thing.classname == "item_health")
+ {
+ if (thing.spawnflags & 2)
+ thisp = 55;
+ if (self.health < 40)
+ thisp = thisp + 50;
+ }
+ else if (thing.model == "progs/armor.mdl")
+ {
+ if (self.armorvalue < 200)
+ {
+ if (thing.skin == 2)
+ thisp = 60;
+ else if (self.armorvalue < 100)
+ thisp = thisp + 25;
+ }
+ }
+ else if (thing.classname == "weapon_pickup")
+ {
+ if (!(self.items & thing.weapon)) { // bot weapon pickup is handled in weapon_pickup
+ //_bprint("SEEK ME WEAPON 2\n");
+ thisp = 75;
+ }
+ }
+ else if (thing.classname == "weapon_supershotgun")
+ {
+ if (!(self.items & 2)) // IT_SUPER_SHOTGUN
+ thisp = 25;
+ }
+ else if (thing.classname == "weapon_nailgun")
+ {
+ if (!(self.items & 4)) // IT_NAILGUN
+ thisp = 30;
+ }
+ else if (thing.classname == "weapon_supernailgun")
+ {
+ if (!(self.items & 8)) // IT_SUPER_NAILGUN
+ thisp = 35;
+ }
+ else if (thing.classname == "weapon_grenadelauncher")
+ {
+ if (!(self.items & 16)) // IT_GRENADE_LAUNCHER
+ thisp = 45;
+ }
+ else if (thing.classname == "weapon_rocketlauncher")
+ {
+ if (!(self.items & 32)) // IT_ROCKET_LAUNCHER
+ thisp = 60;
+ }
+ else if (thing.classname == "weapon_lightning")
+ {
+ if (!(self.items & 64)) // IT_LIGHTNING
+ thisp = 50;
+ }
+else if (thing.classname == "weapon_skull")
+ {
+ if (!(self.items & thing.weapon))// IT_SKULL
+ thisp = 90;
+ }
+ }
+ else if ((thing.flags & FL_MONSTER) && thing.health > 0)
+ thisp = 45;
+ else if (thing.classname == "player")
+ {
+ if (thing.health > 0)
+ {
+ if (thing == self)
+ return 0;
+ else
+ {
+ if (thing.items & IT_INVISIBILITY) //FIXME
+ thisp = 2;
+ else if (coop)
+ {
+ thisp = 200;
+ if (thing.target1.classname == "player")
+ if (!thing.target1.ishuman)
+ return 0;
+ }
+ else if (teamplay && thing.team == self.team)
+ {
+ thisp = 100;
+ if (thing.target1.classname == "player")
+ return 0;
+ }
+ else thisp = 30;
+ }
+ }
+ }
+ else if (thing.classname == "waypoint")
+ {
+ if (thing.b_aiflags & AI_SNIPER)
+ thisp = 30;
+ else if (thing.b_aiflags & AI_AMBUSH)
+ thisp = 30;
+ }
+ if (pointcontents(thing.origin) < -3)
+ return 0;
+ if (thisp)
+ {
+ if (thing.current_way)
+ {
+ // check to see if it's unreachable
+ if (thing.current_way.items == -1)
+ return 0;
+ else
+ thisp = thisp + (13000 - thing.current_way.items) * 0.05;
+ }
+ }
+ return thisp;
+};
+
+void(float scope) bot_look_for_crap =
+{
+ local entity foe, best;
+ local float thatp, bestp, dist;
+
+ if (scope == 1)
+ foe = findradius(self.origin, 13000);
+ else
+ foe = findradius(self.origin, 500);
+
+ bestp = 1;
+ while(foe)
+ {
+ thatp = priority_for_thing(foe);
+ if (thatp)
+ if (!scope)
+ if (!sisible(foe))
+ thatp = 0;
+ if (thatp > bestp)
+ {
+ bestp = thatp;
+ best = foe;
+ dist = vlen(self.origin - foe.origin);
+ }
+ foe = foe.chain;
+ }
+ if (best == world)
+ return;
+ if (!target_onstack(best))
+ {
+ target_add(best);
+ if (scope)
+ {
+ bot_get_path(best, FALSE);
+ self.b_aiflags = self.b_aiflags | AI_WAIT;
+ }
+ }
+};
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+bot_angle_set
+
+Sets the bots look keys & b_angle to point at
+the target - used for fighting and just
+generally making the bot look good.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() bot_angle_set =
+{
+ local float h;
+ local vector view;
+
+ if (self.enemy)
+ {
+ if (self.enemy.items & 524288)
+ if (random() > 0.01)
+ return;
+ if (self.missile_speed == 0)
+ self.missile_speed = 10000;
+ if (self.enemy.solid == SOLID_BSP)
+ {
+ view = (((self.enemy.absmin + self.enemy.absmax) * 0.5) - self.origin);
+ }
+ else
+ {
+
+ local float levels;
+
+ levels = 3;
+
+ view = self.enemy.origin;
+
+ while (levels)
+ {
+ h = vlen(view - self.origin) / self.missile_speed;
+ if (self.enemy.flags & FL_ONGROUND)
+ view = self.enemy.velocity * h + '0 0 -20';
+ else
+ view = (self.enemy.velocity - (sv_gravity * '0 0 1') * h) * h;
+ view = self.enemy.origin + view;
+ traceline(self.enemy.origin, view, FALSE, self);
+ view = trace_endpos;
+ levels = levels - 1;
+ }
+ view = normalize(view - self.origin);
+ }
+ view = vectoangles(view);
+ view_x = view_x * -1;
+ self.b_angle = view;
+ }
+ else if (self.target1)
+ {
+ view = realorigin(self.target1);
+ if (self.target1.flags & FL_ITEM)
+ view = view + '0 0 48';
+ view = view - (self.origin + self.view_ofs);
+ view = vectoangles(view);
+ view_x = view_x * -1;
+ self.b_angle = view;
+ }
+ else
+ self.b_angle_x = 0;
+ // HACK HACK HACK HACK
+ // The bot falls off ledges a lot because of "turning around"
+ // so let the bot use instant turn around when not hunting a player
+ if (self.b_skill == 3)
+ {
+ self.keys = self.keys & 63;
+ self.v_angle = self.b_angle;
+ while (self.v_angle_x < -180)
+ self.v_angle_x = self.v_angle_x + 360;
+ while (self.v_angle_x > 180)
+ self.v_angle_x = self.v_angle_x - 360;
+
+ }
+ else if ((self.enemy == world || self.enemy.movetype == MOVETYPE_PUSH) && self.target1.classname != "player")
+ {
+ self.keys = self.keys & 63;
+ self.v_angle = self.b_angle;
+ while (self.v_angle_x < -180)
+ self.v_angle_x = self.v_angle_x + 360;
+ while (self.v_angle_x > 180)
+ self.v_angle_x = self.v_angle_x - 360;
+ }
+ else if (self.b_skill < 2) // skill 2 handled in bot_phys
+ {
+ if (self.b_angle_x > 180)
+ self.b_angle_x = self.b_angle_x - 360;
+ self.keys = self.keys & 63;
+
+ if (angcomp(self.b_angle_y, self.v_angle_y) > 10)
+ self.keys = self.keys | KEY_LOOKLEFT;
+ else if (angcomp(self.b_angle_y, self.v_angle_y) < -10)
+ self.keys = self.keys | KEY_LOOKRIGHT;
+ if (angcomp(self.b_angle_x, self.v_angle_x) < -10)
+ self.keys = self.keys | KEY_LOOKUP;
+ else if (angcomp(self.b_angle_x, self.v_angle_x) > 10)
+ self.keys = self.keys | KEY_LOOKDOWN;
+ }
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+BotAI
+
+This is the main ai loop. Though called every
+frame, the ai_time limits it's actual updating
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+float stagger_think;
+
+void() BotAI =
+{
+ // am I dead? Fire randomly until I respawn
+ // health < 1 is used because fractional healths show up as 0 on normal player
+ // status bars, and the mod probably already compensated for that
+
+ if (self.health < 1)
+ {
+ self.button0 = floor(random() * 2);
+ self.button2 = 0;
+ self.keys = 0;
+ self.b_aiflags = 0;
+ ClearMyRoute();
+ self.target1 = self.target2 = self.target3 = self.target4 = self.enemy = world;
+ self.last_way = world;
+ return;
+ }
+
+ // stagger the bot's AI out so they all don't think at the same time, causing game
+ // 'spikes'
+ if (self.b_skill < 2)
+ {
+ if (self.ai_time > time)
+ return;
+
+ self.ai_time = time + 0.05;
+ if (bot_count > 0)
+ {
+ if ((time - stagger_think) < (0.1 / bot_count))
+ self.ai_time = self.ai_time + 0.1 / (2 * bot_count);
+ }
+ else
+ return;
+ }
+ if (self.view_ofs == '0 0 0')
+ bot_start_topic(7);
+ stagger_think = time;
+
+ // shut the bot's buttons off, various functions will turn them on by AI end
+
+ self.button2 = 0;
+ self.button0 = 0;
+
+
+ // target1 is like goalentity in normal Quake monster AI.
+ // it's the bot's most immediate target
+ if (route_table == self)
+ {
+ if (busy_waypoints <= 0)
+ {
+ if (waypoint_mode < WM_EDITOR)
+ bot_look_for_crap(TRUE);
+ }
+ self.b_aiflags = 0;
+ self.keys = 0;
+ }
+ else if (self.target1)
+ {
+ frik_movetogoal();
+ bot_path();
+ }
+ else
+ {
+ if (waypoint_mode < WM_EDITOR)
+ {
+ if(self.route_failed)
+ {
+ if (waypoint_mode == WM_DYNAMIC)
+ frik_bot_roam();
+ else
+ self.keys = 0;
+ self.route_failed = 0;
+ }
+ else if(!begin_route())
+ {
+ bot_look_for_crap(FALSE);
+ self.keys = 0;
+ }
+
+ }
+ else
+ {
+ self.b_aiflags = AI_WAIT;
+ self.keys = 0;
+ }
+ }
+
+ // bot_angle_set points the bot at it's goal (self.enemy or target1)
+
+ bot_angle_set();
+
+ // fight my enemy. Enemy is probably a field QC coders will most likely use a lot
+ // for their own needs, since it's unused on a normal player
+ // FIXME
+ if (self.enemy)
+ bot_fight_style();
+ else if (random() < 0.2)
+ if (random() < 0.2)
+ bot_weapon_switch(-1);
+ bot_dodge_stuff();
+
+ // checks to see if bot needs to start going up for air
+ if (self.waterlevel > 2)
+ {
+ if (time > (self.air_finished - 2))
+ {
+ traceline (self.origin, self.origin + '0 0 6800', TRUE, self);
+ if (trace_inopen)
+ {
+ self.keys = KEY_MOVEUP;
+ self.button2 = TRUE; // swim!
+ return; // skip ai flags for now - this is life or death
+ }
+ }
+ }
+
+ // b_aiflags handling
+
+
+ if (self.b_aiflags)
+ bot_handle_ai();
+ else
+ bot_chat(); // don't want chat to screw him up if he's rjing or something
+};
diff --git a/r17/Revamped src/Revamped QC/frikbot/bot_ed.qc b/r17/Revamped src/Revamped QC/frikbot/bot_ed.qc
new file mode 100755
index 00000000..fb2c84a6
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/frikbot/bot_ed.qc
@@ -0,0 +1,1638 @@
+/***********************************************
+* *
+* FrikBot Waypoint Editor *
+* "The 'wtf is this doing in my mod' code" *
+* *
+***********************************************/
+
+/*
+
+This program is in the Public Domain. My crack legal
+team would like to add:
+
+RYAN "FRIKAC" SMITH IS PROVIDING THIS SOFTWARE "AS IS"
+AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE
+ACCURACY, CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR
+FUNCTIONING OF THIS SOFTWARE AND/OR DOCUMENTATION. IN
+NO EVENT WILL RYAN "FRIKAC" SMITH BE LIABLE FOR ANY
+GENERAL, CONSEQUENTIAL, INDIRECT, INCIDENTAL,
+EXEMPLARY, OR SPECIAL DAMAGES, EVEN IF RYAN "FRIKAC"
+SMITH HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES, IRRESPECTIVE OF THE CAUSE OF SUCH DAMAGES.
+
+You accept this software on the condition that you
+indemnify and hold harmless Ryan "FrikaC" Smith from
+any and all liability or damages to third parties,
+including attorney fees, court costs, and other
+related costs and expenses, arising out of your use
+of this software irrespective of the cause of said
+liability.
+
+The export from the United States or the subsequent
+reexport of this software is subject to compliance
+with United States export control and munitions
+control restrictions. You agree that in the event you
+seek to export this software, you assume full
+responsibility for obtaining all necessary export
+licenses and approvals and for assuring compliance
+with applicable reexport restrictions.
+
+Any reproduction of this software must contain
+this notice in its entirety.
+
+*/
+
+float saved1, saved2, saved3, scratch1, scratch2, scratch3, scratch4;
+float bytecounter, filecount;
+
+float MENU_MAIN = 1;
+float MENU_WAYPOINTS = 2;
+float MENU_LINKS = 3;
+float MENU_FLAGS = 4;
+float MENU_FLAGS2 = 5;
+float MENU_BOTS = 6;
+float MENU_WAYLIST = 7;
+// 8 = link way
+// 9 = telelink way
+// 10 = delete link
+// 11 = create link X2
+// 12 = delete link x2
+// 13 = confirmation of delete all
+// 14 = Teleport to way
+// 15 = confirmation of delete point
+
+void() BSPDumpWaypoints;
+void() QCDumpWaypoints;
+void() DumpWaypoints;
+void() SaveWays;
+/*
+// source for the menu strings...
+
+\b-- Main Menu --\b\n
+\[\1\] >>Waypoint Management\n
+\[\2\] >>Link Management \n
+\[\3\] >>AI Flag Management \n
+\[\4\] >>Bot Management \n
+\[\5\] >>Waylist Management \n
+\[\6\] \[\{133}\] Noclip \n
+\[\7\] \[\{133}\] Godmode \n
+\[\8\] \[\{133}\] Hold Select \n
+\[\9\] Teleport to Way # \n
+\[\0\] Close Menu \n
+
+// missing from main is show way info
+// iffy on the teleport to way thing being on main...seems like either a bot or way list thing
+
+\b-- Waypoint Management --\b\n
+\[\1\] Move Waypoint \n
+\[\2\] Delete Waypoint \n
+\[\3\] Make Waypoint \n
+\[\4\] Make Way + Link \n
+\[\5\] Make Way + Link X2 \n
+\[\6\] Make Way + Telelink \n
+\[\7\] Show waypoint info \n
+\[\8\] >>Link Management \n
+\[\9\] >>AI Flag Management \n
+\[\0\] >>Main Menu \n
+
+\b-- Link Management --\b\n
+\[\1\] Unlink Waypoint \n
+\[\2\] Create Link \n
+\[\3\] Create Telelink \n
+\[\4\] Delete Link \n
+\[\5\] Create Link X2 \n
+\[\6\] Delete Link X2 \n
+\[\7\] >Make Waypoint \n
+\[\8\] >>Waypoint Management\n
+\[\9\] >>AI Flag Management \n
+\[\0\] >>Main Menu \n
+
+// Ai flags...ugh
+
+\b-- AI Flag Management --\b\n
+\[\1\] \[\{133}\] Door Flag \n
+\[\2\] \[\{133}\] Precision \n
+\[\3\] \[\{133}\] Surface for air \n
+\[\4\] \[\{133}\] Blind mode \n
+\[\5\] \[\{133}\] Jump \n
+\[\6\] \[\{133}\] Directional \n
+\[\7\] \[\{133}\] Super Jump \n
+\n
+\[\9\] >>AI Flags page 2 \n
+\[\0\] >>Main Menu \n
+
+\b-- AI Flags pg. 2--\b\n
+\[\1\] \[\{133}\] Difficult \n
+\[\2\] \[\{133}\] Wait for plat \n
+\[\3\] \[\{133}\] Ride train \n
+\[\4\] \[\{133}\] Door flag no open\n
+\[\5\] \[\{133}\] Ambush \n
+\[\6\] \[\{133}\] Snipe \n
+\[\7\] \[\{133}\] Trace Test \n
+\n
+\[\9\] >>AI Flag Management \n
+\[\0\] >>Main Menu \n
+
+\b-- Bot Management --\b\n
+\[\1\] Add a Test Bot \n
+\[\2\] Order Test Bot here \n
+\[\3\] Remove Test Bot \n
+\[\4\] Stop Test Bot \n
+\[\5\] Teleport Bot here \n
+\[\6\] Teleport to Way # \n
+\n
+\n
+\n
+\[\0\] >>Main Menu \n
+
+\b-- Waylist Management --\b\n
+\[\1\] Delete ALL Waypoints \n
+\[\2\] Dump Waypoints \n
+\[\3\] Check For Errors \n
+\[\4\] Save Waypoints \n
+\[\5\] \[\{133}\] Dynamic Mode \n
+\[\6\] \[\{133}\] Dynamic Link \n
+\[\7\] \[\{133}\] WAY output \n
+\[\8\] \[\{133}\] QC output \n
+\[\9\] \[\{133}\] BSP ents output \n
+\[\0\] Main Menu \n
+
+\b-- Misc Commands --\b\n
+\[\1\] Teleport to Selected \n
+\[\2\] Select \n
+\[\3\] Swap to old \n
+\[\4\] Trace select \n
+\[\5\] Create way in path \n
+\[\6\] Delete Way from path \n
+
+
+\b-- Editor Memory --\b\n
+\[\1\] Store as slot 1 \n
+\[\2\] Store as slot 2 \n
+\[\3\] Store as slot 3 \n
+\[\4\] Store as slot 4 \n
+\[\5\] Recall slot 1 \n
+\[\6\] Recall slot 2 \n
+\[\7\] Recall slot 3 \n
+\[\8\] Recall slot 4 \n
+
+*/
+
+void() bot_menu_display =
+{
+// build options
+ local string s1, s2, s3, s4, s5, s6, s7, h;
+ local entity t;
+
+// check impulses
+ if (self.impulse > 0 && self.impulse < 11 && self.b_menu)
+ {
+ if (self.b_menu == MENU_MAIN)
+ {
+ if (self.impulse == 1)
+ {
+ self.b_menu = MENU_WAYPOINTS;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 2)
+ {
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 3)
+ {
+ self.b_menu = MENU_FLAGS;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 4)
+ {
+ self.b_menu = MENU_BOTS;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 5)
+ {
+ self.b_menu = MENU_WAYLIST;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 6)
+ {
+ if (self.movetype == MOVETYPE_NOCLIP)
+ self.movetype = MOVETYPE_WALK;
+ else
+ self.movetype = MOVETYPE_NOCLIP;
+ self.b_menu_time = time;
+
+ }
+ else if (self.impulse == 7)
+ {
+ if (self.flags & FL_GODMODE)
+ self.flags = self.flags - FL_GODMODE;
+ else
+ self.flags = self.flags | FL_GODMODE;
+ self.b_menu_time = time;
+
+ }
+ else if (self.impulse == 8)
+ {
+ if (self.b_aiflags & AI_HOLD_SELECT)
+ self.b_aiflags = self.b_aiflags - AI_HOLD_SELECT;
+ else
+ self.b_aiflags = self.b_aiflags | AI_HOLD_SELECT;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 9)
+ {
+ self.b_menu = 14;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 10)
+ bot_way_edit();
+ }
+ else if (self.b_menu == MENU_WAYPOINTS)
+ {
+ if (self.impulse == 1)
+ {
+ if (self.current_way)
+ setorigin(self.current_way, self.origin + self.view_ofs);
+ }
+ else if (self.impulse == 2)
+ {
+ if (self.current_way)
+ {
+ self.b_menu = 15;
+ self.b_menu_time = time;
+ self.last_way = self.current_way;
+ }
+ }
+ else if (self.impulse == 3)
+ {
+ make_waypoint(self.origin + self.view_ofs);
+ }
+ else if (self.impulse == 4)
+ {
+ t = make_waypoint(self.origin + self.view_ofs);
+ if (!LinkWays(self.current_way, t))
+ sprint(self, "Unable to link them\n");
+ }
+ else if (self.impulse == 5)
+ {
+ t = make_waypoint(self.origin + self.view_ofs);
+ if (!LinkWays(self.current_way, t))
+ sprint(self, "Unable to link old to new\n");
+ LinkWays(t, self.current_way);
+ }
+ else if (self.impulse == 6)
+ {
+ t = make_waypoint(self.origin + self.view_ofs);
+ if (!TeleLinkWays(self.current_way, t))
+ sprint(self, "Unable to link them\n");
+ }
+ else if (self.impulse == 7)
+ {
+ if (self.current_way)
+ {
+ sprint(self, "\nwaypoint info for waypoint #");
+ h = ftos(self.current_way.count);
+ sprint(self, h);
+ sprint(self, "\nAI Flag value: ");
+ h = ftos(self.current_way.b_aiflags);
+ sprint(self, h);
+
+ if (self.current_way.target1)
+ {
+ h = ftos(self.current_way.target1.count);
+ if (self.current_way.b_aiflags & AI_TELELINK_1)
+ sprint(self, "\nTelelink1 to:");
+ else
+ sprint(self, "\nLink1 to:");
+ sprint(self, h);
+ }
+ if (self.current_way.target2)
+ {
+ h = ftos(self.current_way.target2.count);
+ if (self.current_way.b_aiflags & AI_TELELINK_2)
+ sprint(self, "\nTelelink2 to:");
+ else
+ sprint(self, "\nLink2 to:");
+ sprint(self, h);
+ }
+ if (self.current_way.target3)
+ {
+ h = ftos(self.current_way.target3.count);
+ if (self.current_way.b_aiflags & AI_TELELINK_3)
+ sprint(self, "\nTelelink3 to:");
+ else
+ sprint(self, "\nLink3 to:");
+ sprint(self, h);
+ }
+ if (self.current_way.target4)
+ {
+ h = ftos(self.current_way.target4.count);
+ if (self.current_way.b_aiflags & AI_TELELINK_4)
+ sprint(self, "\nTelelink4 to:");
+ else
+ sprint(self, "\nLink4 to:");
+ sprint(self, h);
+ }
+ sprint(self, "\n\n");
+ }
+
+ }
+ if (self.impulse == 8)
+ {
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 9)
+ {
+ self.b_menu = MENU_FLAGS;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 10)
+ {
+ self.b_menu = MENU_MAIN;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.b_menu == MENU_LINKS)
+ {
+ if (self.impulse == 1)
+ {
+ self.b_menu = 16;
+ self.b_menu_time = time;
+ self.last_way = self.current_way;
+ }
+ else if (self.impulse == 2)
+ {
+ self.b_menu = 8;
+ self.b_menu_time = time;
+ self.last_way = self.current_way;
+ }
+ else if (self.impulse == 3)
+ {
+ self.b_menu = 9;
+ self.b_menu_time = time;
+ self.last_way = self.current_way;
+ }
+ else if (self.impulse == 4)
+ {
+ self.b_menu = 10;
+ self.b_menu_time = time;
+ self.last_way = self.current_way;
+ }
+ else if (self.impulse == 5)
+ {
+ self.b_menu = 11;
+ self.b_menu_time = time;
+ self.last_way = self.current_way;
+ }
+ else if (self.impulse == 6)
+ {
+ self.b_menu = 12;
+ self.b_menu_time = time;
+ self.last_way = self.current_way;
+ }
+ else if (self.impulse == 7)
+ make_waypoint(self.origin + self.view_ofs);
+ else if (self.impulse == 8)
+ {
+ self.b_menu = MENU_WAYPOINTS;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 9)
+ {
+ self.b_menu = MENU_FLAGS;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 10)
+ {
+ self.b_menu = MENU_MAIN;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.b_menu == MENU_FLAGS)
+ {
+
+ if (self.current_way)
+ {
+ if (self.impulse == 1)
+ {
+ if (self.current_way.b_aiflags & AI_DOORFLAG)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_DOORFLAG);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_DOORFLAG;
+
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 2)
+ {
+ if (self.current_way.b_aiflags & AI_PRECISION)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_PRECISION);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_PRECISION;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 3)
+ {
+ if (self.current_way.b_aiflags & AI_SURFACE)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_SURFACE);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_SURFACE;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 4)
+ {
+ if (self.current_way.b_aiflags & AI_BLIND)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_BLIND);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_BLIND;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 5)
+ {
+ if (self.current_way.b_aiflags & AI_JUMP)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_JUMP);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_JUMP;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 6)
+ {
+ if (self.current_way.b_aiflags & AI_DIRECTIONAL)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_DIRECTIONAL);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_DIRECTIONAL;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 7)
+ {
+ if (self.current_way.b_aiflags & AI_SUPER_JUMP)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_SUPER_JUMP);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_SUPER_JUMP;
+ self.b_menu_time = time;
+ }
+ }
+ if (self.impulse == 9)
+ {
+ self.b_menu = MENU_FLAGS2;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 10)
+ {
+ self.b_menu = MENU_MAIN;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.b_menu == MENU_FLAGS2)
+ {
+
+ if (self.current_way)
+ {
+ if (self.impulse == 1)
+ {
+ if (self.current_way.b_aiflags & AI_DIFFICULT)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_DIFFICULT);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_DIFFICULT; self.b_menu_time = time;
+ }
+ else if (self.impulse == 2)
+ {
+ if (self.current_way.b_aiflags & AI_PLAT_BOTTOM)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_PLAT_BOTTOM);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_PLAT_BOTTOM;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 3)
+ {
+ if (self.current_way.b_aiflags & AI_RIDE_TRAIN)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_RIDE_TRAIN);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_RIDE_TRAIN;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 4)
+ {
+ if (self.current_way.b_aiflags & AI_DOOR_NO_OPEN)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_DOOR_NO_OPEN);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_DOOR_NO_OPEN;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 5)
+ {
+ if (self.current_way.b_aiflags & AI_AMBUSH)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_AMBUSH);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_AMBUSH;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 6)
+ {
+ if (self.current_way.b_aiflags & AI_SNIPER)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_SNIPER);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_SNIPER;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 7)
+ {
+ if (self.current_way.b_aiflags & AI_TRACE_TEST)
+ self.current_way.b_aiflags = self.current_way.b_aiflags - (self.current_way.b_aiflags & AI_TRACE_TEST);
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_TRACE_TEST;
+ self.b_menu_time = time;
+ }
+
+ }
+ if (self.impulse == 9)
+ {
+ self.b_menu = MENU_FLAGS;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 10)
+ {
+ self.b_menu = MENU_MAIN;
+ self.b_menu_time = time;
+ }
+ }
+
+ else if (self.b_menu == MENU_BOTS)
+ {
+ if (self.impulse == 1)
+ {
+ self.impulse = 100;
+ return;
+ }
+ else if (self.impulse == 2)
+ {
+ b_temp3 = self;
+ self = player_head;
+ while(self)
+ {
+ if (!self.ishuman)
+ {
+ target_add(b_temp3);
+ bot_get_path(b_temp3, TRUE);
+ self = world;
+ }
+ else
+ self = self._next;
+ }
+ self = b_temp3;
+ }
+ else if (self.impulse == 3)
+ {
+ self.impulse = 102;
+ return;
+ }
+ else if (self.impulse == 4)
+ {
+ b_temp1 = self;
+ self = player_head;
+ while(self)
+ {
+ if (!self.ishuman)
+ {
+ self.target1 = self.target2 = self.target3 = self.target4 = world;
+ route_table = world;
+ }
+ self = self._next;
+ }
+ self = b_temp1;
+ }
+ else if (self.impulse == 5)
+ {
+ if (self.current_way)
+ {
+ b_temp1 = self;
+ self = player_head;
+ while(self)
+ {
+ if (!self.ishuman)
+ {
+ setorigin(self, b_temp1.current_way.origin);
+ }
+ self = self._next;
+ }
+ self = b_temp1;
+ }
+ else
+ sprint(self, "select a waypoint first\n");
+ }
+ else if (self.impulse == 6)
+ {
+ self.b_menu = 14;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 10)
+ {
+ self.b_menu = MENU_MAIN;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.b_menu == MENU_WAYLIST)
+ {
+ if (self.impulse == 1)
+ {
+ self.b_menu = 13;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 2)
+ {
+ if (dump_mode == 0)
+ DumpWaypoints();
+ else if (dump_mode == 1)
+ QCDumpWaypoints();
+ else if (dump_mode == 2)
+ BSPDumpWaypoints();
+ }
+ else if (self.impulse == 3)
+ {
+ t = way_head;
+ while(t)
+ {
+ if ((t.target1 == world) && (t.target2 == world) && (t.target3 == world) && (t.target4 == world))
+ {
+ sprint(self, "Waypoint #");
+ h = ftos(t.count);
+ sprint(self, h);
+ sprint(self, " has no outbound links\n");
+ }
+ if ((t.target1 == t) || (t.target2 == t) || (t.target3 == t) || (t.target4 == t))
+ {
+ sprint(self, "Waypoint #");
+ h = ftos(t.count);
+ sprint(self, h);
+ sprint(self, " links to itself (??)\n");
+ }
+ t = t._next;
+ }
+ sprint(self, "Error check complete\n");
+ }
+ else if (self.impulse == 4)
+ {
+ // FIXME: detect engine feature and skip prompt
+
+ self.b_menu = 17;
+ self.b_menu_time = time;
+ //SaveWays();
+ }
+ else if (self.impulse == 5)
+ {
+ if (waypoint_mode == WM_EDITOR_DYNAMIC)
+ waypoint_mode = WM_EDITOR;
+ else
+ waypoint_mode = WM_EDITOR_DYNAMIC;
+ self.b_menu_time = time;
+
+ }
+ else if (self.impulse == 6)
+ {
+ if (waypoint_mode == WM_EDITOR_DYNLINK)
+ waypoint_mode = WM_EDITOR;
+ else
+ waypoint_mode = WM_EDITOR_DYNLINK;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 7)
+ {
+ dump_mode = 0;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 8)
+ {
+ dump_mode = 1;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 9)
+ {
+ dump_mode = 2;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 10)
+ {
+ self.b_menu = MENU_MAIN;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.b_menu == 8)
+ {
+ if (self.impulse == 1)
+ {
+ if (self.current_way)
+ {
+ if (!LinkWays(self.last_way, self.current_way))
+ sprint(self, "Unable to link them\n");
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.impulse == 2)
+ {
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.b_menu == 9)
+ {
+ if (self.impulse == 1)
+ {
+ if (self.current_way)
+ {
+ if (!TeleLinkWays(self.last_way, self.current_way))
+ sprint(self, "Unable to link them\n");
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.impulse == 2)
+ {
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.b_menu == 10)
+ {
+ if (self.impulse == 1)
+ {
+ if (self.current_way)
+ {
+ UnlinkWays(self.last_way, self.current_way);
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.impulse == 2)
+ {
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.b_menu == 11)
+ {
+ if (self.impulse == 1)
+ {
+ if (self.current_way)
+ {
+ if (!LinkWays(self.last_way, self.current_way))
+ sprint(self, "Unable to link 1 to 2\n");
+ if (!LinkWays(self.current_way, self.last_way))
+ sprint(self, "Unable to link 2 to 1\n");
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.impulse == 2)
+ {
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.b_menu == 12)
+ {
+ if (self.impulse == 1)
+ {
+ if (self.current_way)
+ {
+ UnlinkWays(self.last_way, self.current_way);
+ UnlinkWays(self.current_way, self.last_way);
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.impulse == 2)
+ {
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.b_menu == 13)
+ {
+ if (self.impulse == 1)
+ {
+ ClearAllWays();
+ self.b_menu = MENU_WAYLIST;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 2)
+ {
+ self.b_menu = MENU_WAYLIST;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.b_menu == 14)
+ {
+ if (self.impulse == 10)
+ self.impulse = 0;
+ self.b_menu_value = self.b_menu_value * 10 + self.impulse;
+ self.b_menu_time = 0;
+ }
+ else if (self.b_menu == 15)
+ {
+ if (self.impulse == 1)
+ {
+ delete_waypoint(self.last_way);
+ self.b_menu = MENU_WAYPOINTS;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 2)
+ {
+ self.b_menu = MENU_WAYPOINTS;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.b_menu == 16)
+ {
+ if (self.impulse == 1)
+ {
+ if (self.last_way)
+ {
+ self.last_way.target1 = self.last_way.target2 = self.last_way.target3 = self.last_way.target4 = world;
+ self.last_way.b_aiflags = self.last_way.b_aiflags - (self.last_way.b_aiflags & 15);
+ }
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ else if (self.impulse == 2)
+ {
+ self.b_menu = MENU_LINKS;
+ self.b_menu_time = time;
+ }
+ }
+ else if (self.b_menu == 17)
+ {
+
+ if (self.impulse == 1)
+ SaveWays();
+ if (self.impulse < 3)
+ {
+ self.b_menu = MENU_WAYLIST;
+ self.b_menu_time = time;
+ }
+ }
+ self.impulse = 0;
+ }
+ if (self.b_menu_time <= time)
+ {
+ if (self.b_menu == MENU_MAIN)
+ {
+ s1 = "\b-- Main Menu --\b\n\[\1\] >>Waypoint Management\n\[\2\] >>Link Management \n\[\3\] >>AI Flag Management \n\[\4\] >>Bot Management \n\[\5\] >>Waylist Management \n";
+ if (self.movetype == MOVETYPE_NOCLIP)
+ s2 = "\[\6\] \[\{133}\] Noclip \n";
+ else
+ s2 = "\[\6\] \[ \] Noclip \n";
+
+ if (self.flags & FL_GODMODE)
+ s3 = "\[\7\] \[\{133}\] Godmode \n";
+ else
+ s3 = "\[\7\] \[ \] Godmode \n";
+ if (self.b_aiflags & AI_HOLD_SELECT)
+ s4 = "\[\8\] \[\{133}\] Hold Select \n";
+ else
+ s4 = "\[\8\] \[ \] Hold Select \n";
+ s5 = "\[\9\] Teleport to Way # \n\[\0\] Close Menu \n";
+ }
+ else if (self.b_menu == MENU_WAYPOINTS)
+ {
+ s1 = "\b-- Waypoint Management --\b\n\[\1\] Move Waypoint \n\[\2\] Delete Waypoint \n\[\3\] Make Waypoint \n\[\4\] Make Way + Link \n\[\5\] Make Way + Link X2 \n\[\6\] Make Way + Telelink \n\[\7\] Show waypoint info \n\[\8\] >>Link Management \n\[\9\] >>AI Flag Management \n\[\0\] >>Main Menu \n";
+ }
+ else if (self.b_menu == MENU_LINKS)
+ {
+ s1 = "\b-- Link Management --\b\n\[\1\] Unlink Waypoint \n\[\2\] Create Link \n\[\3\] Create Telelink \n\[\4\] Delete Link \n\[\5\] Create Link X2 \n\[\6\] Delete Link X2 \n\[\7\] >Make Waypoint \n\[\8\] >>Waypoint Management\n\[\9\] >>AI Flag Management \n\[\0\] >>Main Menu \n";
+ }
+ else if (self.b_menu == MENU_FLAGS)
+ {
+ if (self.current_way.b_aiflags & AI_DOORFLAG)
+ s1 = "\b-- AI Flag Management --\b\n\[\1\] \[\{133}\] Door Flag \n";
+ else
+ s1 = "\b-- AI Flag Management --\b\n\[\1\] \[ \] Door Flag \n";
+
+ if (self.current_way.b_aiflags & AI_PRECISION)
+ s2 = "\[\2\] \[\{133}\] Precision \n";
+ else
+ s2 = "\[\2\] \[ \] Precision \n";
+
+ if (self.current_way.b_aiflags & AI_SURFACE)
+ s3 = "\[\3\] \[\{133}\] Surface for air \n";
+ else
+ s3 = "\[\3\] \[ \] Surface for air \n";
+
+ if (self.current_way.b_aiflags & AI_BLIND)
+ s4 = "\[\4\] \[\{133}\] Blind mode \n";
+ else
+ s4 = "\[\4\] \[ \] Blind mode \n";
+
+ if (self.current_way.b_aiflags & AI_JUMP)
+ s5 = "\[\5\] \[\{133}\] Jump \n";
+ else
+ s5 = "\[\5\] \[ \] Jump \n";
+
+ if (self.current_way.b_aiflags & AI_DIRECTIONAL)
+ s6 = "\[\6\] \[\{133}\] Directional \n";
+ else
+ s6 = "\[\6\] \[ \] Directional \n";
+
+ if (self.current_way.b_aiflags & AI_SUPER_JUMP)
+ s7 = "\[\7\] \[\{133}\] Super Jump \n\n\[\9\] >>AI Flags page 2 \n\[\0\] >>Main Menu \n";
+ else
+ s7 = "\[\7\] \[ \] Super Jump \n\n\[\9\] >>AI Flags page 2 \n\[\0\] >>Main Menu \n";
+ }
+ else if (self.b_menu == MENU_FLAGS2)
+ {
+ if (self.current_way.b_aiflags & AI_DIFFICULT)
+ s1 = "\b-- AI Flags pg. 2--\b\n\[\1\] \[\{133}\] Difficult \n";
+ else
+ s1 = "\b-- AI Flags pg. 2--\b\n\[\1\] \[ \] Difficult \n";
+
+ if (self.current_way.b_aiflags & AI_PLAT_BOTTOM)
+ s2 = "\[\2\] \[\{133}\] Wait for plat \n";
+ else
+ s2 = "\[\2\] \[ \] Wait for plat \n";
+
+ if (self.current_way.b_aiflags & AI_RIDE_TRAIN)
+ s3 = "\[\3\] \[\{133}\] Ride train \n";
+ else
+ s3 = "\[\3\] \[ \] Ride train \n";
+
+ if (self.current_way.b_aiflags & AI_DOOR_NO_OPEN)
+ s4 = "\[\4\] \[\{133}\] Door flag no open\n";
+ else
+ s4 = "\[\4\] \[ \] Door flag no open\n";
+
+ if (self.current_way.b_aiflags & AI_AMBUSH)
+ s5 = "\[\5\] \[\{133}\] Ambush \n";
+ else
+ s5 = "\[\5\] \[ \] Ambush \n";
+
+ if (self.current_way.b_aiflags & AI_SNIPER)
+ s6 = "\[\6\] \[\{133}\] Snipe \n";
+ else
+ s6 = "\[\6\] \[ \] Snipe \n";
+
+ if (self.current_way.b_aiflags & AI_TRACE_TEST)
+ s7 = "\[\7\] \[\{133}\] Trace Test \n\n\[\9\] >>AI Flag Management \n\[\0\] >>Main Menu \n";
+ else
+ s7 = "\[\7\] \[ \] Trace Test \n\n\[\9\] >>AI Flag Management \n\[\0\] >>Main Menu \n";
+
+ }
+ else if (self.b_menu == MENU_BOTS)
+ {
+ s1 = "\b-- Bot Management --\b\n\[\1\] Add a Test Bot \n\[\2\] Order Test Bot here \n\[\3\] Remove Test Bot \n\[\4\] Stop Test Bot \n\[\5\] Teleport Bot here \n\[\6\] Teleport to Way # \n\n\n\n\[\0\] >>Main Menu \n";
+ }
+ else if (self.b_menu == MENU_WAYLIST)
+ {
+ s1 = "\b-- Waylist Management --\b\n\[\1\] Delete ALL Waypoints \n\[\2\] Dump Waypoints \n\[\3\] Check For Errors \n\[\4\] Save Waypoints \n";
+
+ if (waypoint_mode == WM_EDITOR_DYNAMIC)
+ s2 = "\[\5\] \[\{133}\] Dynamic Mode \n\[\6\] \[\{133}\] Dynamic Link \n";
+ else if (waypoint_mode == WM_EDITOR_DYNLINK)
+ s2 = "\[\5\] \[ \] Dynamic Mode \n\[\6\] \[\{133}\] Dynamic Link \n";
+ else
+ s2 = "\[\5\] \[ \] Dynamic Mode \n\[\6\] \[ \] Dynamic Link \n";
+ if (dump_mode == 0)
+ s3 = "\[\7\] \[\{133}\] WAY output \n\[\8\] \[ \] QC output \n\[\9\] \[ \] BSP ents output \n\[\0\] Main Menu \n";
+ else if (dump_mode == 1)
+ s3 = "\[\7\] \[ \] WAY output \n\[\8\] \[\{133}\] QC output \n\[\9\] \[ \] BSP ents output \n\[\0\] Main Menu \n";
+ else if (dump_mode == 2)
+ s3 = "\[\7\] \[ \] WAY output \n\[\8\] \[ \] QC output \n\[\9\] \[\{133}\] BSP ents output \n\[\0\] Main Menu \n";
+
+ }
+ else if (self.b_menu == 8)
+ s1 = "\b-- Link Ways --\b\n\nSelect another way and push 1\nor press 2 to cancel";
+ else if (self.b_menu == 9)
+ s1 = "\b-- Telelink Ways --\b\n\nSelect another way and push 1\nor press 2 to cancel";
+ else if (self.b_menu == 10)
+ s1 = "\b-- Delete Link --\b\n\nSelect another way and push 1\nor press 2 to cancel";
+ else if (self.b_menu == 11)
+ s1 = "\b-- Create Link X2 --\b\n\nSelect another way and push 1\nor press 2 to cancel";
+ else if (self.b_menu == 12)
+ s1 = "\b-- Delete Link X2 --\b\n\nSelect another way and push 1\nor press 2 to cancel";
+ else if (self.b_menu == 13)
+ s1 = "\b-- Delete ALL Ways --\b\n\nAre you sure? Push 1 to go\nthrough with it, 2 to cancel";
+ else if (self.b_menu == 14)
+ {
+ s1 = "\b-- Teleport to Way # --\b\n\nEnter way number and press\nimpulse 104 to warp\n\nWaypoint #";
+ s2 = ftos(self.b_menu_value);
+
+ }
+ else if (self.b_menu == 15)
+ s1 = "\b-- Delete Waypoint --\b\n\nAre you sure? Push 1 to go\nthrough with it, 2 to cancel";
+ else if (self.b_menu == 16)
+ s1 = "\b-- Unlink Waypoint --\b\n\nAre you sure? Push 1 to go\nthrough with it, 2 to cancel";
+ else if (self.b_menu == 17)
+ s1 = "\b-- Save Waypoints --\b\n\nSave Waypoints requires\nFrikaC's file access tutorial from\nwww.quakesrc.org to be present\n in the engine code.\n Push 1 to continue, 2 to cancel";
+
+ frik_big_centerprint(self, s1, s2, s3, s4, s5, s6, s7);
+ self.b_menu_time = time + 1.25;
+ }
+};
+
+
+// engage menu
+void() bot_way_edit =
+{
+ local entity t;
+ local float f;
+ if (self.b_menu_value)
+ {
+ if (self.b_menu == 14)
+ {
+ t = WaypointForNum(self.b_menu_value);
+ if (t)
+ setorigin(self, t.origin - self.view_ofs);
+ else
+ sprint(self, "No waypoint with that number\n");
+
+ self.b_menu = MENU_MAIN;
+ self.b_menu_time = time;
+ }
+ self.b_menu_value = 0;
+ return;
+ }
+ if (waypoint_mode < WM_EDITOR)
+ {
+ self.b_menu = MENU_MAIN;
+ waypoint_mode = WM_EDITOR;
+ self.b_menu_time = 0;
+ cvar_set("saved2", "0");
+ WriteByte(MSG_ALL, 8);
+ WriteByte(MSG_ALL, 1);
+ WriteString(MSG_ALL, "MAKE SURE THE FOLLOWING LINE CONTAINS -CONDEBUG BEFORE PROCEEDING\n");
+ localcmd("cmdline\n");
+ t = way_head;
+ while (t)
+ {
+ setmodel(t, "progs/s_bubble.spr"); // show the waypoints
+ t = t._next;
+ }
+ if (self.current_way)
+ setmodel(self.current_way, "progs/s_light.spr");
+ }
+ else
+ {
+ saved2 = cvar("saved2");
+ if (saved2 != 0)
+ {
+ f = self.b_menu;
+ self.b_menu = floor(saved2/16);
+ self.impulse = saved2 & 15;
+ bot_menu_display();
+ if (self.b_menu == floor(saved2/16))
+ self.b_menu = f;
+ cvar_set("saved2", "0");
+ return;
+ }
+ self.b_menu = 0;
+ waypoint_mode = WM_LOADED;
+ t = way_head;
+ while (t)
+ {
+ setmodel(t, string_null); // hide the waypoints
+ t = t._next;
+ }
+ }
+};
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Waypoint Saving to file.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+
+// bytecount is really iffy
+// since there is no true way to determine the length of an ftos
+// it uses an approximate of 5
+// various other things are guesses, but I don't cut it at the absolute
+// max so it should be okay
+
+void() PrintWaypoint =
+{
+ local entity t;
+ local float needcolon;
+ local string h;
+
+ if (self.enemy == world)
+ t = way_head;
+ else
+ t = self.enemy._next;
+ if (bytecounter >= 8000)
+ {
+ bprint("exec maps/");
+ bprint(mapname);
+ bprint(".wa");
+ h = ftos(filecount);
+ bprint(h);
+ filecount = filecount + 1;
+ bprint("\n// **** break here ****\n"); // 2001-09-10 FrikBot support by FrikaC/Maddes
+ bytecounter = 26;
+ }
+ if (t == world)
+ {
+ remove(self);
+ fixer = world;
+ bprint("saved4 3\n// end waypoint dump\n");
+ bytecounter = bytecounter + 27;
+ return;
+ }
+// 2001-09-10 FrikBot support by FrikaC/Maddes start
+ t.origin_x = rint(t.origin_x);
+ t.origin_y = rint(t.origin_y);
+ t.origin_z = rint(t.origin_z);
+// 2001-09-10 FrikBot support by FrikaC/Maddes end
+ if ((t.origin_x != saved1) || (t.count == 1))
+ {
+ bprint("saved1 ");
+ h = ftos(t.origin_x);
+ bprint(h);
+ saved1 = t.origin_x;
+ bytecounter = bytecounter + 12;
+ needcolon = TRUE;
+ }
+ if ((t.origin_y != saved2) || (t.count == 1))
+ {
+ if (needcolon)
+ {
+ bprint("; ");
+ bytecounter = bytecounter + 2;
+ }
+ else
+ needcolon = TRUE;
+ bprint("saved2 ");
+ h = ftos(t.origin_y);
+ bprint(h);
+ bytecounter = bytecounter + 12;
+ saved2 = t.origin_y;
+ }
+ if ((t.origin_z != saved3) || (t.count == 1))
+ {
+ if (needcolon)
+ {
+ bprint("; ");
+ bytecounter = bytecounter + 2;
+ }
+ else
+ needcolon = TRUE;
+ bprint("saved3 ");
+ h = ftos(t.origin_z);
+ bprint(h);
+ bytecounter = bytecounter + 12;
+ saved3 = t.origin_z;
+ }
+ if (needcolon) // 2001-09-10 FrikBot support by FrikaC/Maddes
+ {
+ bytecounter = bytecounter + 1;
+ bprint("\n");
+ needcolon = FALSE;
+ }
+ if ((scratch1 != t.target1.count) || t.count == 1)
+ {
+ needcolon = TRUE;
+ bprint("scratch1 ");
+ bytecounter = bytecounter + 14;
+ h = ftos(t.target1.count);
+ bprint(h);
+ scratch1 = t.target1.count;
+ }
+ if ((scratch2 != t.target2.count) || t.count == 1)
+ {
+ if (needcolon)
+ {
+ bprint("; ");
+ bytecounter = bytecounter + 2;
+ }
+ else
+ needcolon = TRUE;
+ bprint("scratch2 ");
+ bytecounter = bytecounter + 14;
+ h = ftos(t.target2.count);
+ bprint(h);
+ scratch2 = t.target2.count;
+ }
+ if ((scratch3 != t.target3.count) || t.count == 1)
+ {
+ if (needcolon)
+ {
+ bprint("; ");
+ bytecounter = bytecounter + 2;
+ }
+ else
+ needcolon = TRUE;
+ bprint("scratch3 ");
+ bytecounter = bytecounter + 14;
+ h = ftos(t.target3.count);
+ bprint(h);
+ scratch3 = t.target3.count;
+ }
+ if ((scratch4 != t.target4.count) || t.count == 1)
+ {
+ if (needcolon)
+ {
+ bprint("; ");
+ bytecounter = bytecounter + 2;
+ }
+ else
+ needcolon = TRUE;
+ bprint("scratch4 ");
+ bytecounter = bytecounter + 14;
+ h = ftos(t.target4.count);
+ bprint(h);
+ scratch4 = t.target4.count;
+ }
+ if (needcolon) // 2001-09-10 FrikBot support by FrikaC/Maddes
+ {
+ bprint("\n");
+ needcolon = FALSE;
+ }
+ bprint("saved4 ");
+ bytecounter = bytecounter + 19;
+ if (t.count != 1)
+ h = ftos(t.b_aiflags * 4 + 2);
+ else
+ h = ftos(t.b_aiflags * 4 + 1);
+ bprint(h);
+ bprint ("; wait\n");
+ self.nextthink = time + 0.01;
+ self.enemy = t;
+};
+
+// to allow for 100+ waypoints, we need to trick the runaway loop counter
+void() DumpWaypoints =
+{
+ bytecounter = 50;
+ filecount = 1;
+
+ bprint("// ");
+ bprint(world.message);
+ bprint(" - maps/"); // 2001-09-10 FrikBot support by FrikaC/Maddes
+ bprint(mapname);
+ bprint(".way\n");
+ bprint("// Ways by ");
+ bprint(self.netname);
+ bprint("\n");
+ if (!fixer)
+ {
+ fixer = spawn();
+ fixer.nextthink = time + 0.01;
+ fixer.think = PrintWaypoint;
+ fixer.enemy = world;
+ }
+};
+
+void() PrintQCWaypoint =
+{
+ local entity t;
+ local string h;
+
+ if (self.enemy == world)
+ t = way_head;
+ else
+ t = self.enemy._next;
+
+ if (t == world)
+ {
+ remove(self);
+ fixer = world;
+ bprint("};\n// End dump\n"); // 2001-09-10 FrikBot support by FrikaC/Maddes
+ return;
+ }
+ bprint(" make_way(");
+// 2001-09-10 FrikBot support by FrikaC/Maddes start
+ t.origin_x = rint(t.origin_x);
+ t.origin_y = rint(t.origin_y);
+ t.origin_z = rint(t.origin_z);
+// 2001-09-10 FrikBot support by FrikaC/Maddes end
+ h = vtos(t.origin);
+ bprint(h);
+ bprint(", '");
+ h = ftos(t.target1.count);
+ bprint(h);
+ bprint(" ");
+ h = ftos(t.target2.count);
+ bprint(h);
+ bprint(" ");
+ h = ftos(t.target3.count);
+ bprint(h);
+ bprint("', ");
+ h = ftos(t.target4.count);
+ bprint(h);
+ bprint(", ");
+ h = ftos(t.b_aiflags);
+ bprint(h);
+ bprint(");\n");
+ self.nextthink = time + 0.01;
+ self.enemy = t;
+
+};
+
+void() QCDumpWaypoints =
+{
+ bprint("/* QC Waypoint Dump - src/frikbot/map_");
+
+ bprint(mapname);
+ bprint(".qc\nFor instructions please read the\nreadme.html that comes with FrikBot */\n\nvoid(vector org, vector bit1, float bit4, float flargs) make_way;\n");
+ bprint("// Ways by ");
+ bprint(self.netname);
+ bprint("\n\n");
+
+ bprint("void() map_");
+ bprint(mapname);
+ bprint(" =\n{\n");
+
+ if (!fixer)
+ {
+ fixer = spawn();
+ fixer.nextthink = time + 0.01;
+ fixer.think = PrintQCWaypoint;
+ fixer.enemy = world;
+ }
+};
+
+void() PrintBSPWaypoint =
+{
+ local entity t;
+ local string h;
+
+ if (self.enemy == world)
+ t = way_head;
+ else
+ t = self.enemy._next;
+
+ if (t == world)
+ {
+ bprint("// End dump\n"); // 2001-09-10 FrikBot support by FrikaC/Maddes
+ remove(self);
+ fixer = world;
+ return;
+ }
+ bprint("{\n\"classname\" \"waypoint\"\n\"origin\" \"");
+// 2001-09-10 FrikBot support by FrikaC/Maddes start
+ t.origin_x = rint(t.origin_x);
+ t.origin_y = rint(t.origin_y);
+ t.origin_z = rint(t.origin_z);
+// 2001-09-10 FrikBot support by FrikaC/Maddes end
+ h = ftos(t.origin_x);
+ bprint(h);
+ bprint(" ");
+ h = ftos(t.origin_y);
+ bprint(h);
+ bprint(" ");
+ h = ftos(t.origin_z);
+ bprint(h);
+ if (t.target1.count)
+ {
+ bprint("\"\n\"b_pants\" \"");
+ h = ftos(t.target1.count);
+ bprint(h);
+ }
+ if (t.target2.count)
+ {
+ bprint("\"\n\"b_skill\" \"");
+ h = ftos(t.target2.count);
+ bprint(h);
+ }
+ if (t.target3.count)
+ {
+ bprint("\"\n\"b_shirt\" \"");
+ h = ftos(t.target3.count);
+ bprint(h);
+ }
+ if (t.target4.count)
+ {
+ bprint("\"\n\"b_frags\" \"");
+ h = ftos(t.target4.count);
+ bprint(h);
+ }
+ if (t.b_aiflags)
+ {
+ bprint("\"\n\"b_aiflags\" \"");
+ h = ftos(t.b_aiflags);
+ bprint(h);
+ }
+ bprint("\"\n}\n");
+ self.nextthink = time + 0.01;
+ self.enemy = t;
+
+};
+
+void() BSPDumpWaypoints =
+{
+ bprint("/* BSP entities Dump - maps/");
+
+ bprint(mapname);
+ bprint(".ent\nFor instructions please read the\nreadme.html that comes with FrikBot */\n\n"); // 2001-09-10 FrikBot support by FrikaC/Maddes
+
+ if (!fixer)
+ {
+ fixer = spawn();
+ fixer.nextthink = time + 0.01;
+ fixer.think = PrintBSPWaypoint;
+ fixer.enemy = world;
+ }
+};
+
+
+// FrikaC's file access tutorial...
+string(string s1, string s2) strcat = #82;
+float(string filename, float mode) open = #86;
+string(string s) zone = #79;
+void(string s) unzone = #80;
+void(float handle) close = #87;
+void(float handle, string s) write = #89;
+float file;
+
+void() SaveWaypoint =
+{
+ local entity t;
+ local float needcolon;
+ local string h, j, k, l;
+
+ if (self.enemy == world)
+ t = way_head;
+ else
+ t = self.enemy._next;
+ if (bytecounter >= 8000)
+ {
+ h = "maps/";
+ j = ftos(filecount);
+ k = h = zone(strcat("maps/", mapname));
+ l = h = zone(strcat(h, ".wa"));
+ unzone(k);
+ h = zone(strcat(h, j));
+ unzone(l);
+ write(file, "exec ");
+ write(file, h);
+ write(file, "\n");
+ filecount = filecount + 1;
+ close(file);
+ file = open(h, 2);
+ unzone(h);
+ if (file == -1)
+ {
+ remove(self);
+ fixer = world;
+ bprint("Error: failed to save file\n");
+ return;
+ }
+ bytecounter = 0;
+ }
+ if (t == world)
+ {
+ remove(self);
+ fixer = world;
+ write(file, "saved4 3\n");
+ close(file);
+ bprint("waypoints saved.\n");
+ bytecounter = bytecounter + 27;
+ return;
+ }
+// 2001-09-10 FrikBot support by FrikaC/Maddes start
+ t.origin_x = rint(t.origin_x);
+ t.origin_y = rint(t.origin_y);
+ t.origin_z = rint(t.origin_z);
+// 2001-09-10 FrikBot support by FrikaC/Maddes end
+ if ((t.origin_x != saved1) || (t.count == 1))
+ {
+ write(file, "saved1 ");
+ h = ftos(t.origin_x);
+ write(file, h);
+ saved1 = t.origin_x;
+ bytecounter = bytecounter + 12;
+ needcolon = TRUE;
+ }
+ if ((t.origin_y != saved2) || (t.count == 1))
+ {
+ if (needcolon)
+ {
+ write(file, "; ");
+ bytecounter = bytecounter + 2;
+ }
+ else
+ needcolon = TRUE;
+ write(file, "saved2 ");
+ h = ftos(t.origin_y);
+ write(file, h);
+ bytecounter = bytecounter + 12;
+ saved2 = t.origin_y;
+ }
+ if ((t.origin_z != saved3) || (t.count == 1))
+ {
+ if (needcolon)
+ {
+ write(file, "; ");
+ bytecounter = bytecounter + 2;
+ }
+ else
+ needcolon = TRUE;
+ write(file, "saved3 ");
+ h = ftos(t.origin_z);
+ write(file, h);
+ bytecounter = bytecounter + 12;
+ saved3 = t.origin_z;
+ }
+ if (needcolon) // 2001-09-10 FrikBot support by FrikaC/Maddes
+ {
+ bytecounter = bytecounter + 1;
+ write(file, "\n");
+ needcolon = FALSE;
+ }
+ if ((scratch1 != t.target1.count) || t.count == 1)
+ {
+ needcolon = TRUE;
+ write(file, "scratch1 ");
+ bytecounter = bytecounter + 14;
+ h = ftos(t.target1.count);
+ write(file, h);
+ scratch1 = t.target1.count;
+ }
+ if ((scratch2 != t.target2.count) || t.count == 1)
+ {
+ if (needcolon)
+ {
+ write(file, "; ");
+ bytecounter = bytecounter + 2;
+ }
+ else
+ needcolon = TRUE;
+ write(file, "scratch2 ");
+ bytecounter = bytecounter + 14;
+ h = ftos(t.target2.count);
+ write(file, h);
+ scratch2 = t.target2.count;
+ }
+ if ((scratch3 != t.target3.count) || t.count == 1)
+ {
+ if (needcolon)
+ {
+ write(file, "; ");
+ bytecounter = bytecounter + 2;
+ }
+ else
+ needcolon = TRUE;
+ write(file, "scratch3 ");
+ bytecounter = bytecounter + 14;
+ h = ftos(t.target3.count);
+ write(file, h);
+ scratch3 = t.target3.count;
+ }
+ if ((scratch4 != t.target4.count) || t.count == 1)
+ {
+ if (needcolon)
+ {
+ write(file, "; ");
+ bytecounter = bytecounter + 2;
+ }
+ else
+ needcolon = TRUE;
+ write(file, "scratch4 ");
+ bytecounter = bytecounter + 14;
+ h = ftos(t.target4.count);
+ write(file, h);
+ scratch4 = t.target4.count;
+ }
+ if (needcolon) // 2001-09-10 FrikBot support by FrikaC/Maddes
+ {
+ write(file, "\n");
+ needcolon = FALSE;
+ }
+ write(file, "saved4 ");
+ bytecounter = bytecounter + 19;
+ if (t.count != 1)
+ h = ftos(t.b_aiflags * 4 + 2);
+ else
+ h = ftos(t.b_aiflags * 4 + 1);
+ write(file, h);
+ write(file, "; wait\n");
+ self.nextthink = time + 0.01;
+ self.enemy = t;
+};
+
+// to allow for 100+ waypoints, we need to trick the runaway loop counter
+void() SaveWays =
+{
+ local string h, f;
+ bytecounter = 50;
+ filecount = 1;
+ h = strcat("maps/", mapname);
+ f = h = zone(h);
+ h = strcat(h, ".way");
+ unzone(f);
+ file = open(h, 2);
+ if (file == -1)
+ {
+ bprint("Error: failed to open file\n");
+ return;
+ }
+ if (!fixer)
+ {
+ fixer = spawn();
+ fixer.nextthink = time + 0.01;
+ fixer.think = SaveWaypoint;
+ fixer.enemy = world;
+ }
+};
diff --git a/r17/Revamped src/Revamped QC/frikbot/bot_fight.qc b/r17/Revamped src/Revamped QC/frikbot/bot_fight.qc
new file mode 100755
index 00000000..21eb1e50
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/frikbot/bot_fight.qc
@@ -0,0 +1,472 @@
+/***********************************************
+* *
+* FrikBot Fight Code *
+* "Because I ain't no Ghandi code" *
+* *
+***********************************************/
+
+/*
+
+This program is in the Public Domain. My crack legal
+team would like to add:
+
+RYAN "FRIKAC" SMITH IS PROVIDING THIS SOFTWARE "AS IS"
+AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE
+ACCURACY, CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR
+FUNCTIONING OF THIS SOFTWARE AND/OR DOCUMENTATION. IN
+NO EVENT WILL RYAN "FRIKAC" SMITH BE LIABLE FOR ANY
+GENERAL, CONSEQUENTIAL, INDIRECT, INCIDENTAL,
+EXEMPLARY, OR SPECIAL DAMAGES, EVEN IF RYAN "FRIKAC"
+SMITH HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES, IRRESPECTIVE OF THE CAUSE OF SUCH DAMAGES.
+
+You accept this software on the condition that you
+indemnify and hold harmless Ryan "FrikaC" Smith from
+any and all liability or damages to third parties,
+including attorney fees, court costs, and other
+related costs and expenses, arising out of your use
+of this software irrespective of the cause of said
+liability.
+
+The export from the United States or the subsequent
+reexport of this software is subject to compliance
+with United States export control and munitions
+control restrictions. You agree that in the event you
+seek to export this software, you assume full
+responsibility for obtaining all necessary export
+licenses and approvals and for assuring compliance
+with applicable reexport restrictions.
+
+Any reproduction of this software must contain
+this notice in its entirety.
+
+*/
+
+.entity avoid;
+
+float(entity e) bot_size_player =
+{
+ local float sz;
+
+ sz = e.health + e.armorvalue * e.armortype;
+ if (e.weapon == 32)
+ sz = sz + 60;
+ else if (e.weapon == 64)
+ sz = sz + 60;
+ else if (e.weapon == 16)
+ sz = sz + 50;
+ else if (e.weapon == 8)
+ sz = sz + 50;
+ else if (e.weapon == 4)
+ sz = sz + 40;
+ else if (e.weapon == 2)
+ sz = sz + 40;
+ else if (e.weapon == 1)
+ sz = sz + 10;
+ else if (e.weapon == 4096)
+ sz = sz - 50;
+ if (e.items & 4194304) // Quad
+ sz = sz + 200;
+ if (e.items & 1048576) // Invul
+ sz = sz + 300;
+ if (e.items & 524288) // Invis
+ sz = sz + 250;
+ return sz;
+};
+
+void() bot_dodge_stuff =
+{
+ local entity foe, head;
+ local float avdist, foesz, flen, tsz;
+ local vector v;
+
+ if (waypoint_mode > WM_LOADED)
+ return;
+
+ self.avoid = world;
+
+
+ if (self.enemy)
+ {
+ v = self.origin - realorigin(self.enemy);
+
+ foesz = bot_size_player(self.enemy);
+ foesz = foesz + vlen(v) * 0.5;
+ }
+ else
+ foesz = 9999999;
+ avdist = 256;
+
+ foe = find(world, classname, "grenade");
+ while(foe)
+ {
+ flen = vlen(foe.origin - self.origin);
+ if (flen < avdist)
+ {
+ avdist = flen;
+ self.avoid = foe;
+ }
+ foe = find(foe, classname, "grenade");
+ }
+ if (!self.avoid)
+ {
+ foe = find(world, classname, "missile");
+ while(foe)
+ {
+ if (foe.owner != self)
+ {
+ flen = vlen(foe.origin - self.origin);
+ if (flen < avdist)
+ {
+ avdist = flen;
+ self.avoid = foe;
+ }
+ }
+ foe = find(foe, classname, "missile");
+ }
+ if (!self.avoid)
+ {
+ foe = find(world, classname, "spike");
+ while(foe)
+ {
+ if (foe.owner != self)
+ {
+ flen = vlen(foe.origin - self.origin);
+ if (flen < avdist)
+ {
+ avdist = flen;
+ self.avoid = foe;
+ }
+ }
+ foe = find(foe, classname, "spike");
+ }
+ }
+ }
+ if (coop)
+ {
+ if (!self.enemy)
+ {
+ foe = findradius(self.origin, 9999);
+ while(foe)
+ {
+ if(foe.flags & FL_MONSTER)
+ {
+ if(foe.health > 0)
+ {
+ tsz = bot_size_player(foe) + vlen(foe.origin - self.origin) * 0.5;
+ if (tsz < foesz)
+ {
+ if (fisible(foe))
+ {
+ self.enemy = foe;
+ foesz = tsz;
+ }
+ }
+ }
+ }
+ foe = foe.chain;
+ }
+ }
+ }
+ else
+ {
+ head = findradius(self.origin, 9999);
+while(head)
+{
+ if(head.classname == "Needle-spikes")
+ {
+ if(head.health > 0)
+ {
+ tsz = bot_size_player(head) + vlen(head.origin - self.origin) * 0.5;
+ if (tsz < foesz)
+ {
+ if (fov(head) || head.b_sound > time || self.b_skill == 3)
+ {
+ if (fisible(head))
+ {
+ self.enemy = head;
+ foesz = tsz;
+ }
+ }
+ }
+ }
+ }
+ head = head.chain;
+}
+ foe = player_head;
+ while(foe)
+ {
+ if(foe != self)
+ {
+ if (foe.modelindex != 0)
+ {
+ if (foe.health > 0)
+ {
+ if (!(teamplay && self.team == foe.team))
+ {
+ tsz = bot_size_player(foe) + vlen(foe.origin - self.origin) * 0.5;
+ if (tsz < foesz)
+ {
+ if (fov(foe) || foe.b_sound > time || self.b_skill == 3)
+ {
+ if (fisible(foe))
+ {
+ self.enemy = foe;
+ foesz = tsz;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ foe = foe._next;
+ }
+ }
+};
+
+
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+weapon_range
+
+_x "sweet spot range" - try to maintain this range if possible
+_y minimum range bot can be to be effective (rl/gl) (move away)
+_z maximum range bot can be to be effective (lg/axe) (move in)
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+vector(float wep) weapon_range =
+{
+ if (wep == 4096) // IT_AXE
+ return '48 0 64';
+ else if (wep == 1) // IT_SHOTGUN
+ return '128 0 99999';
+ else if (wep == 2) // IT_SUPER_SHOTGUN
+ return '128 0 99999';
+ else if (wep == 4) // IT_NAILGUN
+ return '180 0 3000';
+ else if (wep == 8) // IT_SUPER_NAILGUN
+ return '180 0 3000';
+ else if (wep == 16) // IT_GRENADE_LAUNCHER
+ return '180 48 3000';
+ else if (wep == 32) // IT_ROCKET_LAUNCHER
+ return '180 48 3000';
+ else if (wep == 64) // IT_LIGHTNING
+ return '350 0 512';
+ return '128 0 99999';
+
+};
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+bot_weapon_switch
+
+Pick a weapon based on range / ammo
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void(float brange) bot_weapon_switch =
+{
+ local float it, flag, pulse;
+ local vector v;
+
+ it = self.items & 127;
+
+ while(it)
+ {
+ if ((self.ammo_rockets >= 1) && (it & 32))
+ {
+ flag = 32;
+ pulse = 7;
+ }
+ else if (self.waterlevel <= 1 && self.ammo_cells >= 1 && (it & 64))
+ {
+ flag = 64;
+ pulse = 8;
+ }
+ else if(self.ammo_nails >= 2 && (it & 8))
+ {
+ flag = 8;
+ pulse = 5;
+ }
+ else if ((self.ammo_rockets >= 1) && (it & 16))
+ {
+ flag = 16;
+ pulse = 6;
+ }
+ else if(self.ammo_shells >= 2 && (it & 2))
+ {
+ flag = 2;
+ pulse = 3;
+ }
+ else if(self.ammo_nails >= 1 && (it & 4))
+ {
+ flag = 4;
+ pulse = 4;
+ }
+ else if(self.ammo_shells >= 1 && (it & 1))
+ {
+ flag = 1;
+ pulse = 2;
+ }
+ else
+ {
+ if (pulse)
+ self.impulse = pulse;
+ return;
+ }
+
+ if (brange == -1)
+ {
+ if (pulse)
+ self.impulse = pulse;
+ return;
+ }
+
+ v = weapon_range(flag);
+ if (brange < v_y || brange > v_z)
+ it = it - flag;
+ else
+ {
+ if (pulse)
+ self.impulse = pulse;
+ return;
+ }
+ }
+};
+
+void() bot_shoot =
+{
+ // quick little function to stop making him shoot the wrong way ! Argh
+ local float g;
+ g = angcomp(self.v_angle_x, self.b_angle_x);
+ if (fabs(g) > 30)
+ return; // argh, too far away
+ g = angcomp(self.v_angle_y, self.b_angle_y);
+ if (fabs(g) > 30)
+ return; // not again!
+ self.button0 = TRUE;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Bot_fight_style
+
+This is the core of the bot's thinking when
+attacking an enemy.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() bot_fight_style =
+{
+ local vector v, v1, v2, org;
+ local float foedist, mysz, foesz;
+
+
+ if (self.enemy.health <= 0)
+ {
+ self.enemy = world;
+ return;
+ }
+ else if (!self.enemy.takedamage)
+ {
+ self.enemy = world;
+ return;
+ }
+ else if (!fisible(self.enemy))
+ {
+ self.enemy = world;
+ return;
+ }
+
+ org = realorigin(self.enemy);
+ makevectors(self.v_angle);
+
+ // decide if I should shoot
+
+ foedist = vlen(org - self.origin);
+ v = weapon_range(self.weapon);
+ if (foedist > v_y && foedist < v_z)
+ {
+ traceline(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * v_z, FALSE, self);
+ if (vlen(trace_endpos - (self.origin + self.view_ofs)) >= v_y)
+ {
+ // try to avoid shooting teammates
+ if (trace_ent.classname == "player")
+ if ((trace_ent.team == self.team && teamplay) || (coop))
+ return;
+ bot_shoot();
+ }
+ }
+ else
+ bot_weapon_switch(foedist);
+
+ if (!(self.b_aiflags & (AI_PRECISION | AI_BLIND | AI_OBSTRUCTED)))
+ {
+ foesz = bot_size_player(self.enemy);
+ mysz = bot_size_player(self) + 5;
+
+ if (foesz > mysz)
+ {
+ if (teamplay)
+ {
+ if (random() < 0.02)
+ {
+ bot_start_topic(5);
+ self.b_chattime = 1;
+ }
+ }
+
+ return;
+ }
+ else if (mysz < 140)
+ return;
+ else if (self.avoid)
+ {
+ if (self.avoid.velocity)
+ v = self.avoid.velocity;
+ else
+ v = normalize(self.avoid.origin - self.origin);
+ v1_x = v_y * -1;
+ v1_y = v_x;
+ v2_x = v_y;
+ v2_y = v_x * -1;
+ foedist = vlen(self.avoid.origin - (self.origin + v1));
+ if (foedist < vlen(self.avoid.origin - (self.origin + v2)))
+ frik_walkmove(v2);
+ else
+ frik_walkmove(v1);
+ }
+ else if (!self.enemy.flags & FL_MONSTER)
+ {
+ if (foedist + 32 < v_x)
+ frik_walkmove(self.origin - org);
+ else if (foedist - 32 > v_x)
+ frik_walkmove(org - self.origin);
+ else if (self.wallhug)
+ frik_walkmove(v_right);
+ else
+ frik_walkmove(v_right * -1);
+ }
+ }
+ else
+ {
+ foesz = bot_size_player(self.enemy);
+ mysz = bot_size_player(self) + 5;
+
+ if (foesz > mysz)
+ return;
+ else if (mysz < 140)
+ return;
+ self.keys = self.keys & 960;
+ }
+};
+
+
diff --git a/r17/Revamped src/Revamped QC/frikbot/bot_misc.qc b/r17/Revamped src/Revamped QC/frikbot/bot_misc.qc
new file mode 100755
index 00000000..7d01b5cf
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/frikbot/bot_misc.qc
@@ -0,0 +1,779 @@
+/***********************************************
+* *
+* FrikBot Misc Code *
+* "Because you can't name it anything else" *
+* *
+***********************************************/
+
+/*
+This program is in the Public Domain. My crack legal
+team would like to add:
+
+RYAN "FRIKAC" SMITH IS PROVIDING THIS SOFTWARE "AS IS"
+AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE
+ACCURACY, CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR
+FUNCTIONING OF THIS SOFTWARE AND/OR DOCUMENTATION. IN
+NO EVENT WILL RYAN "FRIKAC" SMITH BE LIABLE FOR ANY
+GENERAL, CONSEQUENTIAL, INDIRECT, INCIDENTAL,
+EXEMPLARY, OR SPECIAL DAMAGES, EVEN IF RYAN "FRIKAC"
+SMITH HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES, IRRESPECTIVE OF THE CAUSE OF SUCH DAMAGES.
+
+You accept this software on the condition that you
+indemnify and hold harmless Ryan "FrikaC" Smith from
+any and all liability or damages to third parties,
+including attorney fees, court costs, and other
+related costs and expenses, arising out of your use
+of this software irrespective of the cause of said
+liability.
+
+The export from the United States or the subsequent
+reexport of this software is subject to compliance
+with United States export control and munitions
+control restrictions. You agree that in the event you
+seek to export this software, you assume full
+responsibility for obtaining all necessary export
+licenses and approvals and for assuring compliance
+with applicable reexport restrictions.
+
+Any reproduction of this software must contain
+this notice in its entirety.
+
+*/
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+BotName
+
+Sets bot's name and colors
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+string(float r) BotName =
+{
+ self.b_num = r;
+ if (r == 1)
+ {
+ self.b_pants = 11;
+ self.b_shirt = 0;
+ return "Vincent";
+ }
+ else if (r == 2)
+ {
+ self.b_pants = 1;
+ self.b_shirt = 3;
+ return "Bishop";
+ }
+ else if (r == 3)
+ {
+ self.b_pants = 13;
+ self.b_shirt = 2;
+ return "Nomad";
+ }
+ else if (r == 4)
+ {
+ self.b_pants = 7;
+ self.b_shirt = 6;
+ return "Hudson";
+ }
+ else if (r == 5)
+ {
+ self.b_pants = 12;
+ self.b_shirt = 6;
+ return "Lore";
+ }
+ else if (r == 6)
+ {
+ self.b_pants = 4;
+ self.b_shirt = 4;
+ return "Servo";
+ }
+ else if (r == 7)
+ {
+ self.b_pants = 2;
+ self.b_shirt = 5;
+ return "Gort";
+ }
+ else if (r == 8)
+ {
+ self.b_pants = 10;
+ self.b_shirt = 3;
+ return "Kryten";
+ }
+ else if (r == 9)
+ {
+ self.b_pants = 9;
+ self.b_shirt = 4;
+ return "Pimp Bot";
+ }
+ else if (r == 10)
+ {
+ self.b_pants = 4;
+ self.b_shirt = 7;
+ return "Max";
+ }
+ else if (r == 11)
+ {
+ self.b_pants = 3;
+ self.b_shirt = 11;
+ return "Marvin";
+ }
+ else if (r == 12)
+ {
+ self.b_pants = 13;
+ self.b_shirt = 12;
+ return "Erwin";
+ }
+ else if (r == 13)
+ {
+ self.b_pants = 11;
+ self.b_shirt = 2;
+ return "FrikBot";
+ }
+ else if (r == 14)
+ {
+ self.b_pants = 0;
+ self.b_shirt = 2;
+ return "Krosis";
+ }
+ else if (r == 15)
+ {
+ self.b_pants = 8;
+ self.b_shirt = 9;
+ return "Gypsy";
+ }
+ else if (r == 16)
+ {
+ self.b_pants = 5;
+ self.b_shirt = 10;
+ return "Hal";
+ }
+ return "Noname";
+};
+string () PickARandomName =
+{
+ if (bot_count > 16)
+ return "player";
+
+ local float y, test;
+ local string h;
+ local entity t;
+ y = TRUE;
+ while(y)
+ {
+ test = ceil(random() * 16);
+ h = BotName(test);
+ t = find(world, netname, h);
+ if (t == world)
+ y = FALSE;
+ }
+ return h;
+};
+
+
+
+// I didn't like the old code so this is very stripped down
+
+entity b_originator;
+float b_topic;
+/* FBX Topics
+
+b_originator == self
+ 1 - sign on
+ 2 - killed targ
+ 3 - team message "friendly eyes"
+ 4 - team message "on your back"
+ 5 - team message "need back up"
+ 6 - excuses
+ ----
+ 7 - gameover
+ ----
+ 8 - welcoming someone onto server
+ 9 - ridicule lost frag (killed self?)
+ 10 - ridicule lost frag (lava)
+ 11 - lag
+b_originator == targ
+
+
+*/
+void(float tpic) bot_start_topic =
+{
+ if (random() < 0.2)
+ {
+ b_topic = tpic;
+ b_originator = self;
+ }
+ else
+ b_topic = 0;
+};
+
+void() bot_chat =
+{
+ local float r;
+ if (b_options & OPT_NOCHAT)
+ return;
+ r = ceil (random() * 6);
+
+ if (self.b_chattime > time)
+ {
+ if (self.b_skill < 2)
+ self.keys = self.button0 = self.button2 = 0;
+ return;
+ }
+ else if (self.b_chattime)
+ {
+ if (b_topic == 1)
+ {
+ if (b_originator == self)
+ {
+ if (r == 1)
+ {
+ BotSay(": lo all\n");
+ bot_start_topic(8);
+ }
+ else if (r == 2)
+ {
+ BotSay(": hey everyone\n");
+ bot_start_topic(8);
+ }
+ else if (r == 3)
+ {
+ BotSay(": prepare to be fragged!\n");
+ bot_start_topic(0);
+ }
+ else if (r == 4)
+ {
+ BotSay(": boy this is laggy\n");
+ bot_start_topic(11);
+ }
+ else if (r == 5)
+ {
+ BotSay(": #mm getting some lag here\n");
+ bot_start_topic(11);
+ }
+ else
+ {
+ BotSay(": hi everyone\n");
+ bot_start_topic(8);
+ }
+ }
+ }
+ else if (b_topic == 2)
+ {
+ if (b_originator == self)
+ {
+ if (r == 1)
+ BotSay(": take that\n");
+ else if (r == 2)
+ BotSay(": yehaww!\n");
+ else if (r == 3)
+ BotSay(": wh00p\n");
+ else if (r == 4)
+ BotSay(": j00_sawk();\n");
+ else if (r == 5)
+ BotSay(": i rule\n");
+ else
+ BotSay(": eat that\n");
+ bot_start_topic(0);
+ }
+ }
+ else if (b_topic == 3)
+ {
+ if (b_originator == self)
+ {
+ if (r < 3)
+ BotSayTeam(": friendly eyes\n");
+ else
+ BotSayTeam(": team eyes\n");
+ bot_start_topic(0);
+ }
+ }
+ else if (b_topic == 4)
+ {
+ if (b_originator == self)
+ {
+ if (r < 3)
+ BotSayTeam(": on your back\n");
+ else
+ BotSayTeam(": I'm with you\n");
+ bot_start_topic(0);
+ }
+ }
+ else if (b_topic == 5)
+ {
+ if (b_originator == self)
+ {
+ if (r < 3)
+ BotSayTeam(": I need help\n");
+ else
+ BotSayTeam(": need backup\n");
+ bot_start_topic(0);
+ }
+ }
+ else if (b_topic == 6)
+ {
+ if (b_originator == self)
+ {
+ if (r == 1)
+ {
+ BotSay(": sun got in my eyes\n");
+ bot_start_topic(0);
+ }
+ else if (r == 2)
+ {
+ BotSay(": mouse needs cleaning\n");
+ bot_start_topic(0);
+ }
+ else if (r == 3)
+ {
+ BotSay(": i meant to do that\n");
+ bot_start_topic(0);
+ }
+ else if (r == 4)
+ {
+ BotSay(": lag\n");
+ bot_start_topic(11);
+ }
+ else if (r == 5)
+ {
+ BotSay(": killer lag\n");
+ bot_start_topic(11);
+ }
+ else
+ {
+ BotSay(": 100% lag\n");
+ bot_start_topic(11);
+ }
+ }
+ }
+ else if (b_topic == 7)
+ {
+ if (r == 1)
+ BotSay(": gg\n");
+ else if (r == 2)
+ BotSay(": gg all\n");
+ else if (r == 3)
+ BotSay(": that was fun\n");
+ else if (r == 4)
+ BotSay(": good game\n");
+ else if (r == 5)
+ BotSay(": pah\n");
+ else
+ BotSay(": hrm\n");
+ bot_start_topic(0);
+ }
+ else if (b_topic == 8)
+ {
+ if (b_originator != self)
+ {
+ if (r == 1)
+ {
+ BotSay(": heya\n");
+ bot_start_topic(0);
+ }
+ else if (r == 2)
+ {
+ BotSay(": welcome\n");
+ bot_start_topic(0);
+ }
+ else if (r == 3)
+ {
+ BotSayInit();
+ BotSay2(": hi ");
+ BotSay2(b_originator.netname);
+ BotSay2("\n");
+ bot_start_topic(0);
+ }
+ else if (r == 4)
+ {
+ BotSayInit();
+ BotSay2(": hey ");
+ BotSay2(b_originator.netname);
+ BotSay2("\n");
+ bot_start_topic(0);
+ }
+ else if (r == 5)
+ {
+ BotSay(": howdy\n");
+ bot_start_topic(0);
+ }
+ else
+ {
+ BotSay(": lo\n");
+ bot_start_topic(0);
+ }
+ }
+ }
+
+ else if (b_topic == 9)
+ {
+ if (b_originator != self)
+ {
+ if (r == 1)
+ BotSay(": hah\n");
+ else if (r == 2)
+ BotSay(": heheh\n");
+ else if (r == 3)
+ {
+ BotSayInit();
+ BotSay2(": good work ");
+ BotSay2(b_originator.netname);
+ BotSay2("\n");
+ }
+ else if (r == 4)
+ {
+ BotSayInit();
+ BotSay2(": nice1 ");
+ BotSay2(b_originator.netname);
+ BotSay2("\n");
+ }
+ else if (r == 5)
+ BotSay(": lol\n");
+ else
+ BotSay(": :)\n");
+ b_topic = 6;
+ }
+ }
+ else if (b_topic == 10)
+ {
+ if (b_originator != self)
+ {
+ if (r == 1)
+ BotSay(": have a nice dip?\n");
+ else if (r == 2)
+ BotSay(": bah I hate levels with lava\n");
+ else if (r == 3)
+ {
+ BotSayInit();
+ BotSay2(": good job ");
+ BotSay2(b_originator.netname);
+ BotSay2("\n");
+ }
+ else if (r == 4)
+ {
+ BotSayInit();
+ BotSay2(": nice backflip ");
+ BotSay2(b_originator.netname);
+ BotSay2("\n");
+ }
+ else if (r == 5)
+ BotSay(": watch your step\n");
+ else
+ BotSay(": hehe\n");
+ b_topic = 6;
+ }
+ }
+
+ else if (b_topic == 11)
+ {
+ if (b_originator != self)
+ {
+ if (r == 1)
+ {
+ BotSayInit();
+ BotSay2(": yeah right ");
+ BotSay2(b_originator.netname);
+ BotSay2("\n");
+ bot_start_topic(0);
+ }
+ else if (r == 2)
+ {
+ BotSay(": ping\n");
+ bot_start_topic(0);
+ }
+ else if (r == 3)
+ {
+ BotSay(": shuddup, you're an lpb\n");
+ bot_start_topic(0);
+ }
+ else if (r == 4)
+ {
+ BotSay(": lag my eye\n");
+ bot_start_topic(0);
+ }
+ else if (r == 5)
+ {
+ BotSay(": yeah\n");
+ bot_start_topic(11);
+ }
+ else
+ {
+ BotSay(": totally\n");
+ bot_start_topic(11);
+ }
+ }
+ }
+ self.b_chattime = 0;
+ }
+ else if (b_topic)
+ {
+ if (random() < 0.5)
+ {
+ if (self == b_originator)
+ {
+ if (b_topic <= 7)
+ self.b_chattime = time + 2;
+ }
+ else
+ {
+ if (b_topic >= 7)
+ self.b_chattime = time + 2;
+ }
+ }
+ }
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Kick A Bot.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() KickABot =
+{
+ local entity ty;
+ ty = find(world, classname, "player");
+ while (ty != world)
+ {
+ if (!(ty.ishuman))
+ {
+
+ BotDisconnect(ty);
+ ty.ishuman = TRUE;
+ ty = world;
+ }
+ else
+ ty = find(ty, classname, "player");
+ }
+
+};
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Simplified origin checking.
+
+God, I wish I had inline
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+vector(entity ent) realorigin =
+{
+// even more simplified...
+ return (ent.absmin + ent.absmax) * 0.5;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+fisible
+
+a version of visible that checks for corners
+of the bounding boxes
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+float (entity targ) fisible =
+{
+ local vector spot1, org;
+ local float thruwater, pc1, pc2;
+
+ org = realorigin(targ);
+ spot1 = self.origin + self.view_ofs;
+
+ if (targ.solid == SOLID_BSP)
+ {
+ traceline (spot1, org, TRUE, self);
+ if (trace_ent == targ)
+ return TRUE;
+ else if (trace_fraction == 1)
+ return TRUE;
+ return FALSE;
+ }
+ else
+ {
+ pc1 = pointcontents(org);
+ pc2 = pointcontents(spot1);
+ if (targ.classname == "player")
+ thruwater = FALSE;
+ else if (pc1 == CONTENT_LAVA)
+ return FALSE;
+ else
+ thruwater = TRUE;
+ }
+
+ if (pc1 < -1) // targ's origin is in water or other liquid
+ {
+ if (pc2 != pc1)
+ {
+ // look for their head
+ traceline (spot1, org + targ.mins, TRUE, self);
+ // cross the water check
+ if (trace_inopen)
+ if (trace_inwater)
+ if (!thruwater)
+ return FALSE;
+ if (trace_ent == targ)
+ return TRUE;
+ else if (trace_fraction == 1)
+ return TRUE;
+ return FALSE;
+ }
+ }
+ else
+ {
+ if (pc2 != pc1)
+ {
+ traceline (spot1, org + targ.maxs, TRUE, self);
+ if (trace_inopen)
+ if (trace_inwater)
+ if (!thruwater)
+ return FALSE;
+ if (trace_ent == targ)
+ return TRUE;
+ else if (trace_fraction == 1)
+ return TRUE;
+ return FALSE;
+ }
+ }
+ traceline (spot1, org, TRUE, self);
+ if (trace_ent == targ)
+ return TRUE;
+ else if (trace_fraction == 1)
+ return TRUE;
+ traceline (spot1, org + targ.maxs, TRUE, self);
+ if (trace_ent == targ)
+ return TRUE;
+ else if (trace_fraction == 1)
+ return TRUE;
+ traceline (spot1, org + targ.mins, TRUE, self);
+ if (trace_ent == targ)
+ return TRUE;
+ else if (trace_fraction == 1)
+ return TRUE;
+ return FALSE;
+};
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Wisible
+
+goes through movable brushes/entities, used
+for waypoints
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+// this is used for waypoint stuff....
+float (entity targ1, entity targ2) wisible =
+{
+ local vector spot1, spot2;
+ local entity ignore;
+
+ spot1 = targ1.origin;
+ spot2 = realorigin(targ2);
+
+ ignore = self;
+ do
+ {
+ traceline (spot1, spot2, TRUE, ignore);
+ spot1 = realorigin(trace_ent);
+ ignore = trace_ent;
+ } while ((trace_ent != world) && (trace_fraction != 1));
+ if (trace_endpos == spot2)
+ return TRUE;
+ else
+ return FALSE;
+};
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+sisible
+
+Now this is getting ridiculous. Simple visible,
+used when we need just a simple traceline nothing else
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+float (entity targ) sisible =
+{
+ traceline (self.origin, targ.origin, TRUE, self);
+ if (trace_ent == targ)
+ return TRUE;
+ else if (trace_fraction == 1)
+ return TRUE;
+ return TRUE;
+};
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+angcomp
+
+subtracts one angle from another
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+float (float y1, float y2) angcomp =
+{
+ y1 = frik_anglemod(y1);
+ y2 = frik_anglemod(y2);
+
+ local float answer;
+ answer = y1 - y2;
+ if (answer > 180)
+ answer = answer - 360;
+ else if (answer < -180)
+ answer = answer + 360;
+ return answer;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+fov
+
+is the entity in the bot's field of view
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+float (entity targ) fov =
+{
+ local vector yawn;
+ local float g;
+ yawn = realorigin(targ);
+ yawn = (yawn + targ.view_ofs) - (self.origin + self.view_ofs);
+ yawn = normalize(yawn);
+ yawn = vectoangles(yawn);
+ g = angcomp(self.v_angle_x, yawn_x);
+ if (fabs(g) > 45)
+ return FALSE;
+ g = angcomp(self.v_angle_y, yawn_y);
+ if (fabs(g) > 60)
+ return FALSE;
+
+ return TRUE;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+frik_anglemod
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+float(float v) frik_anglemod =
+{
+ return v - floor(v/360) * 360;
+}
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/frikbot/bot_move.qc b/r17/Revamped src/Revamped QC/frikbot/bot_move.qc
new file mode 100755
index 00000000..cc1e3d9c
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/frikbot/bot_move.qc
@@ -0,0 +1,520 @@
+/***********************************************
+* *
+* FrikBot Movement AI *
+* "The slightly better movement AI" *
+* *
+***********************************************/
+
+/*
+
+This program is in the Public Domain. My crack legal
+team would like to add:
+
+RYAN "FRIKAC" SMITH IS PROVIDING THIS SOFTWARE "AS IS"
+AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE
+ACCURACY, CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR
+FUNCTIONING OF THIS SOFTWARE AND/OR DOCUMENTATION. IN
+NO EVENT WILL RYAN "FRIKAC" SMITH BE LIABLE FOR ANY
+GENERAL, CONSEQUENTIAL, INDIRECT, INCIDENTAL,
+EXEMPLARY, OR SPECIAL DAMAGES, EVEN IF RYAN "FRIKAC"
+SMITH HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES, IRRESPECTIVE OF THE CAUSE OF SUCH DAMAGES.
+
+You accept this software on the condition that you
+indemnify and hold harmless Ryan "FrikaC" Smith from
+any and all liability or damages to third parties,
+including attorney fees, court costs, and other
+related costs and expenses, arising out of your use
+of this software irrespective of the cause of said
+liability.
+
+The export from the United States or the subsequent
+reexport of this software is subject to compliance
+with United States export control and munitions
+control restrictions. You agree that in the event you
+seek to export this software, you assume full
+responsibility for obtaining all necessary export
+licenses and approvals and for assuring compliance
+with applicable reexport restrictions.
+
+Any reproduction of this software must contain
+this notice in its entirety.
+
+*/
+
+void() bot_jump =
+{
+ // TODO check for precision, etc.
+ self.button2 = TRUE;
+};
+
+float(entity e) bot_can_rj =
+{
+ // this returns true of the bot can rocket/superjump/hook
+ // if your mod doesn't have an RL you can just return FALSE all the time
+ // if it has a hook or some other means for the bot to get to high places
+ // you can check here for that capability
+
+ // am I dumb?
+ if (e.b_skill == 0)
+ return FALSE;
+
+ // quad = bad
+ if (e.items & 4194304)
+ return FALSE;
+
+ // do I have rockets & RL?
+ if (!((e.items & 32) && (e.ammo_rockets > 0)))
+ return FALSE;
+
+ // do I have pent?
+ if (e.items & 1048576)
+ return TRUE;
+
+ if (e.health > 50)
+ return TRUE;
+ else
+ return FALSE;
+};
+
+float(float flag) frik_recognize_plat =
+{
+ if ((self.classname != "waypoint") && !(self.flags & FL_ONGROUND))
+ return FALSE;
+ traceline(self.origin, self.origin - '0 0 64', TRUE, self);
+ if (trace_ent != world)
+ {
+ if (flag) // afect bot movement too
+ {
+ if (self.keys & KEY_MOVEUP)
+ {
+ if (trace_ent.velocity_z > 0)
+ self.keys = self.keys & 960; // 960 is all view keys
+ }
+ else if (self.keys & KEY_MOVEDOWN)
+ {
+ if (trace_ent.velocity_z < 0)
+ self.keys = self.keys & 960;
+ }
+ }
+ return TRUE;
+ }
+ else
+ return FALSE;
+};
+
+float(vector sdir) frik_KeysForDir =
+{
+
+ local vector keydir;
+ local float outkeys, tang;
+ outkeys = 0;
+ if (sdir_x || sdir_y)
+ {
+ // Everything is tested against 60 degrees,
+ // this allows the bot to overlap the keys
+ // 30 degrees on each diagonal 45 degrees
+ // might look more realistic
+
+ keydir = vectoangles(sdir);
+ tang = angcomp(keydir_y, self.v_angle_y);
+ if ((tang <= 150) && (tang >= 30))
+ outkeys = outkeys + KEY_MOVELEFT;
+ else if ((tang >= -150) && (tang <= -30))
+ outkeys = outkeys + KEY_MOVERIGHT;
+ if (fabs(tang) <= 60)
+ outkeys = outkeys + KEY_MOVEFORWARD;
+ else if (fabs(tang) >= 120)
+ outkeys = outkeys + KEY_MOVEBACK;
+ }
+ if (sdir_z > 0)
+ outkeys = outkeys + KEY_MOVEUP;
+ else if (sdir_z < 0)
+ outkeys = outkeys + KEY_MOVEDOWN;
+ return outkeys;
+
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+frik_obstructed
+
+Bot has hit a ledge or wall that he should
+manuever around.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void(vector whichway, float danger) frik_obstructed =
+{
+ local float dist;
+ local vector disway, org;
+// TODO: something
+ if (self.b_aiflags & AI_BLIND)
+ return;
+ org = realorigin(self.target1);
+
+ if (danger)
+ {
+ self.b_aiflags = self.b_aiflags | AI_DANGER;
+ self.keys = frik_KeysForDir('0 0 0' - whichway);
+ }
+ if (self.b_aiflags & AI_PRECISION)
+ return;
+
+
+ if (self.target1)
+ {
+ if (self.b_aiflags & AI_OBSTRUCTED)
+ {
+ if (!(self.b_aiflags & AI_DANGER))
+ {
+ self.b_aiflags = self.b_aiflags - AI_OBSTRUCTED;
+ return;
+ }
+ else if (!danger)
+ return;
+ }
+ self.obs_dir = whichway;
+ disway_x = whichway_y * -1;
+ disway_y = whichway_x;
+ dist = vlen(org - (self.origin + disway));
+ disway_x = whichway_y;
+ disway_y = whichway_x * -1;
+ self.wallhug = vlen(org - (self.origin + disway)) > dist;
+ self.b_aiflags = self.b_aiflags | AI_OBSTRUCTED;
+
+ }
+ else
+ {
+ disway_x = whichway_y * -1;
+ disway_y = whichway_x;
+ dist = vlen(disway - self.obs_dir);
+ disway_x = whichway_y;
+ disway_y = whichway_x * -1;
+ self.wallhug = vlen(disway - self.obs_dir) < dist;
+ self.obs_dir = whichway;
+
+ self.b_aiflags = self.b_aiflags | AI_OBSTRUCTED;
+ }
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+frik_obstacles
+
+Detects small bumps the bot needs to jump over
+or ledges the bot should avoid falling in.
+
+Also responsible for jumping gaps.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() frik_obstacles =
+{
+ local vector start, stop, ang;
+ local float test, conts, dist, hgt;
+
+ if (!(self.flags & FL_ONGROUND))
+ return;
+ if (self.b_aiflags & AI_BLIND)
+ return;
+
+ ang = normalize(self.velocity);
+ ang_z = 0;
+ start = self.origin + ang * 32; // ahem
+ start_z = self.origin_z + self.maxs_z;
+ stop = start;
+ stop_z = self.origin_z + self.mins_z;
+ traceline(start, stop - '0 0 256', TRUE, self);
+ if (trace_allsolid || trace_startsolid)
+ return;
+ hgt = trace_endpos_z - stop_z;
+
+ if (hgt > 18)
+ {
+ bot_jump();
+ return;
+ }
+ if (hgt >= 0)
+ return;
+
+ conts = pointcontents(trace_endpos + '0 0 4');
+ start = stop - '0 0 8';
+ stop = start + ang * 256;
+ traceline(start, stop, TRUE, self);
+ test = vlen(trace_endpos - start);
+ if (test <= 20)
+ return; // it's a walkable gap, do nothing
+ ang_x = self.velocity_y * -1;
+ ang_y = self.velocity_x;
+ ang = normalize(ang);
+ traceline(start - (ang * 10), start + (ang * 10), TRUE, self);
+ if ((trace_fraction != 1) || trace_startsolid)
+ return; // gap is only 20 wide, walkable
+ ang = self.velocity;
+ ang_z = 0;
+ dist = ((540 / sv_gravity) * vlen(ang))/* + 32*/;
+ if (test > dist) // I can't make it
+ {
+ if (conts < -3) // bad stuff down dare
+ {
+ frik_obstructed(ang, TRUE);
+ return;
+ }
+ else
+ {
+ if (self.target1)
+ {
+ stop = realorigin(self.target1);
+ if ((stop_z - self.origin_z) < -32)
+ return; // safe to fall
+ }
+ frik_obstructed(ang, FALSE);
+ return;
+ }
+ }
+ else
+ {
+ ang = normalize(ang);
+ //look for a ledge
+ traceline(self.origin, self.origin + (ang * (test + 20)), TRUE, self);
+ if (trace_fraction != 1)
+ {
+ if (conts < -3) // bad stuff down dare
+ {
+ frik_obstructed(ang, TRUE);
+ return;
+ }
+ else
+ {
+ if (self.target1)
+ {
+ stop = realorigin(self.target1);
+ if ((stop_z - self.origin_z) < -32)
+ return; // safe to fall
+ }
+ frik_obstructed(ang, FALSE);
+ return;
+ }
+ }
+
+ if (self.target1)
+ {
+ // getting furter away from my target?
+ test = vlen(self.target1.origin - (ang + self.origin));
+ if (test > vlen(self.target1.origin - self.origin))
+ {
+ if (conts < -3) // bad stuff down dare
+ {
+ frik_obstructed(ang, TRUE);
+ return;
+ }
+ else
+ {
+ frik_obstructed(ang, FALSE);
+ return;
+ }
+ }
+ }
+ }
+ if (hgt < -18)
+ {
+ if (conts < -3) // bad stuff down dare
+ {
+ frik_obstructed(ang, TRUE);
+ return;
+ }
+ if (self.target1)
+ {
+ stop = realorigin(self.target1);
+ if ((stop_z - self.origin_z) < -32)
+ {
+
+ return; // safe to fall
+ }
+ }
+ bot_jump();
+ }
+ // go for it
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+After frik_obstructed, the bot uses the
+following funtion to move "around" the obstacle
+
+I have no idea how well it will work
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() frik_dodge_obstruction =
+{
+ local vector way, org;
+ local float oflags, yaw;
+
+ if (!(self.b_aiflags & AI_OBSTRUCTED))
+ return;
+ if ((self.b_aiflags & (AI_BLIND | AI_PRECISION)) || !(self.flags & FL_ONGROUND))
+ {
+ self.b_aiflags = self.b_aiflags - AI_OBSTRUCTED;
+ return;
+ }
+
+ // perform a walkmove check to see if the obs_dir is still obstructed
+ // walkmove is less forgiving than frik_obstacles, so I dunno
+ // how well this will work
+
+ oflags = self.flags;
+ org = self.origin;
+
+ yaw = vectoyaw(self.obs_dir);
+ if (walkmove(yaw, 32))
+ self.b_aiflags = self.b_aiflags - AI_OBSTRUCTED;
+ else
+ {
+ if (self.b_aiflags & AI_DANGER)
+ {
+ way = '0 0 0' - self.obs_dir;
+ }
+ else if (self.wallhug)
+ {
+ way_x = self.obs_dir_y * -1;
+ way_y = self.obs_dir_x;
+ }
+ else
+ {
+ way_x = self.obs_dir_y;
+ way_y = self.obs_dir_x * -1;
+ }
+ self.keys = self.keys & 960 + frik_KeysForDir(way);
+ }
+
+ // fix the bot
+
+ self.origin = org;
+ self.flags = oflags;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+movetogoal and walkmove replacements
+
+blah
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() frik_movetogoal =
+{
+ local vector way/*, start, stop, ang*/;
+ local float g;
+
+ if (self.target1 == world)
+ {
+ makevectors(self.v_angle);
+ frik_walkmove(v_forward);
+ return;
+ }
+ way = realorigin(self.target1) - self.origin;
+ if (vlen(way) < 25)
+ {
+ self.keys = self.keys & 960;
+ return;
+ }
+
+ way = normalize(way);
+ self.keys = self.keys & 960 + frik_KeysForDir(way);
+
+ frik_dodge_obstruction();
+ frik_recognize_plat(TRUE);
+
+ if (self.b_aiflags & AI_PRECISION)
+ {
+ g = angcomp(self.v_angle_x, self.b_angle_x);
+ if (fabs(g) > 10)
+ self.keys = self.keys & 960;
+ g = angcomp(self.v_angle_y, self.b_angle_y);
+ if (fabs(g) > 10)
+ self.keys = self.keys & 960;
+ }
+};
+
+float(vector weird) frik_walkmove =
+{
+ // okay so it's not walkmove
+ // sue me
+ self.keys = self.keys & 960 + frik_KeysForDir(weird);
+
+ frik_dodge_obstruction();
+ frik_recognize_plat(TRUE);
+ if (self.b_aiflags & AI_OBSTRUCTED)
+ return FALSE;
+ else
+ return TRUE;
+};
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+The "hook" method of navigation. This nav
+system is copyrighted 1999 by Ryan "Frika C"
+Smith, keep that in mind when you steal it.
+
+I brought this back because normal roaming
+won't work - the bot gets distracted by it's
+own waypoints.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() frik_bot_roam =
+{
+ local vector org, ang, org1;
+ local float loopcount, flag, dist;
+
+ loopcount = 26;
+ flag = FALSE;
+ while((loopcount > 0) && !flag)
+ {
+ loopcount = loopcount - 1;
+ org = self.origin + self.view_ofs;
+ ang = self.angles;
+ ang_y = frik_anglemod(ang_y - 90 + (random() * 180));
+ ang_x = 0; // avoid upward sloping
+ makevectors(ang);
+ traceline(org, org + v_forward * 2300, TRUE, self);
+ if (trace_fraction != 1)
+ {
+ org1 = trace_endpos;
+ ang = normalize(trace_plane_normal);
+ ang_z = 0; // avoid upward sloping
+ traceline(org1, org1 + (ang * 2300), TRUE, self);
+ if ((trace_fraction != 1) && (vlen(trace_endpos - org1) >= 64))
+ {
+ org = trace_endpos;
+ traceline(org, self.origin + self.view_ofs, TRUE, self);
+ if (trace_fraction != 1)
+ {
+ dist = vlen(org1 - org) /2;
+ org = org1 + (ang * dist);
+ traceline(org, org - '0 0 48', TRUE, self);
+ if (trace_fraction != 1)
+ {
+ SpawnTempWaypoint(org);
+ flag = TRUE;
+ }
+ }
+ }
+ }
+ }
+ self.b_angle_y = self.v_angle_y + 10;
+ frik_walkmove(v_forward);
+};
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/frikbot/bot_phys.qc b/r17/Revamped src/Revamped QC/frikbot/bot_phys.qc
new file mode 100755
index 00000000..3dc3c8d2
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/frikbot/bot_phys.qc
@@ -0,0 +1,681 @@
+/***********************************************
+* *
+* FrikBot Physics *
+* The near-perfect emulation of *
+* Client movement *
+* *
+* Special Thanks to: Asdf, Frog *
+* Alan "Strider" Kivlin *
+* *
+* *
+***********************************************/
+
+/*
+
+This program is in the Public Domain. My crack legal
+team would like to add:
+
+RYAN "FRIKAC" SMITH IS PROVIDING THIS SOFTWARE "AS IS"
+AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE
+ACCURACY, CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR
+FUNCTIONING OF THIS SOFTWARE AND/OR DOCUMENTATION. IN
+NO EVENT WILL RYAN "FRIKAC" SMITH BE LIABLE FOR ANY
+GENERAL, CONSEQUENTIAL, INDIRECT, INCIDENTAL,
+EXEMPLARY, OR SPECIAL DAMAGES, EVEN IF RYAN "FRIKAC"
+SMITH HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES, IRRESPECTIVE OF THE CAUSE OF SUCH DAMAGES.
+
+You accept this software on the condition that you
+indemnify and hold harmless Ryan "FrikaC" Smith from
+any and all liability or damages to third parties,
+including attorney fees, court costs, and other
+related costs and expenses, arising out of your use
+of this software irrespective of the cause of said
+liability.
+
+The export from the United States or the subsequent
+reexport of this software is subject to compliance
+with United States export control and munitions
+control restrictions. You agree that in the event you
+seek to export this software, you assume full
+responsibility for obtaining all necessary export
+licenses and approvals and for assuring compliance
+with applicable reexport restrictions.
+
+Any reproduction of this software must contain
+this notice in its entirety.
+
+*/
+
+/*
+=========================================
+
+Stuff mimicking cl_input.c code
+
+=========================================
+*/
+float(float key) CL_KeyState =
+{
+ return ((self.keys & key) > 0);
+};
+
+void() CL_KeyMove = // CL_BaseMove + CL_AdjustAngles
+{
+ local float anglespeed;
+ local vector view;
+ if (self.keys != self.oldkeys)
+ {
+ self.movevect = '0 0 0';
+ self.movevect_y = self.movevect_y + (350 * CL_KeyState(KEY_MOVERIGHT));
+ // 350 is the default cl_sidespeed
+ self.movevect_y = self.movevect_y - (350 * CL_KeyState(KEY_MOVELEFT));
+ // 350 is the default cl_sidespeed
+ self.movevect_x = self.movevect_x + (200 * CL_KeyState(KEY_MOVEFORWARD));
+ // 200 is the default cl_forwardspeed
+ self.movevect_x = self.movevect_x - (200 * CL_KeyState(KEY_MOVEBACK));
+ // 200 is the default cl_backspeed
+ self.movevect_z = self.movevect_z + (200 * CL_KeyState(KEY_MOVEUP));
+ // 200 is the default cl_upspeed
+ self.movevect_z = self.movevect_z - (200 * CL_KeyState(KEY_MOVEDOWN));
+ // 200 is the default cl_upspeed
+ if (!self.b_aiflags & AI_PRECISION)
+ self.movevect = self.movevect * 2;
+ // 2 is the default cl_movespeedkey & bot always has +speed
+ }
+ self.oldkeys = self.keys;
+
+ if (self.b_skill != 2) // use mouse emulation
+ {
+ anglespeed = 1.5 * real_frametime;
+ // 1.5 is the default cl_anglespeedkey & bot always has +speed
+ self.v_angle_y = self.v_angle_y + anglespeed * CL_KeyState(KEY_LOOKLEFT) * 140;
+ // 140 is default cl_yawspeed
+ self.v_angle_y = self.v_angle_y - anglespeed * CL_KeyState(KEY_LOOKRIGHT) * 140;
+ // 140 is default cl_yawspeed
+ self.v_angle_x = self.v_angle_x - anglespeed * CL_KeyState(KEY_LOOKUP) * 150;
+ // 150 is default cl_pitchspeed
+ self.v_angle_x = self.v_angle_x + anglespeed * CL_KeyState(KEY_LOOKDOWN) * 150;
+ // 150 is default cl_pitchspeed
+ }
+ else
+ {
+ view_x = angcomp(self.b_angle_x, self.v_angle_x);
+ view_y = angcomp(self.b_angle_y, self.v_angle_y);
+ if (vlen(view) > 30)
+ {
+ self.mouse_emu = self.mouse_emu + (view * 30);
+ if (vlen(self.mouse_emu) > 180)
+ self.mouse_emu = normalize(self.mouse_emu) * 180;
+ }
+ else
+ self.mouse_emu = view * (1 / real_frametime);
+ self.v_angle = self.v_angle + self.mouse_emu * real_frametime;
+
+
+ }
+ if (self.v_angle_x > 80)
+ self.v_angle_x = 80;
+ else if (self.v_angle_x < -70)
+ self.v_angle_x = -70;
+
+ if (self.v_angle_z > 50)
+ self.v_angle_z = 50;
+ else if (self.v_angle_z < -50)
+ self.v_angle_z = -50;
+ self.v_angle_y = frik_anglemod(self.v_angle_y);
+
+};
+
+/*
+=========================================
+
+Stuff mimicking sv_user.c
+
+=========================================
+*/
+void() SV_UserFriction =
+{
+ local vector vel, start, stop;
+ local float sped, friction, newspeed;
+
+ vel = self.velocity;
+ vel_z =0;
+ sped = vlen(vel);
+ vel = self.velocity;
+
+ if (!sped)
+ return;
+
+// if the leading edge is over a dropoff, increase friction
+
+ start_x = stop_x = self.origin_x + vel_x / (sped * 16);
+ start_y = stop_y = self.origin_y + vel_y / (sped * 16);
+ start_z = self.origin_z + self.mins_z;
+ stop_z = start_z - 34;
+
+ traceline(start, stop, TRUE, self);
+
+ if (trace_fraction == 1)
+ friction = sv_friction * 2; // 2 is default edgefriction, removed for QW compatability
+ else
+ friction = sv_friction;
+ if (sped < sv_stopspeed)
+ newspeed = sped - real_frametime * sv_stopspeed * friction;
+ else
+ newspeed = sped - real_frametime * sped * friction;
+
+ if (newspeed < 0)
+ newspeed = 0;
+ newspeed = newspeed / sped;
+
+ self.velocity_y = vel_y * newspeed;
+ self.velocity_x = vel_x * newspeed;
+};
+void() SV_WaterJump =
+{
+ if (time > self.teleport_time || !self.waterlevel)
+ {
+ self.flags = self.flags - (self.flags & FL_WATERJUMP);
+ self.teleport_time = 0;
+ }
+ self.velocity_x = self.movedir_x;
+ self.velocity_y = self.movedir_y;
+};
+
+void() DropPunchAngle =
+{
+ local float len;
+ len = vlen(self.punchangle);
+ self.punchangle = normalize(self.punchangle);
+ len = len - 10 * real_frametime;
+ if (len < 0)
+ len = 0;
+ self.punchangle = self.punchangle * len;
+};
+
+
+void(vector wishvel) SV_AirAccelerate =
+{
+ local float addspeed, wishspd, accelspeed, currentspeed;
+
+ wishspd = vlen(wishvel);
+ wishvel = normalize(wishvel);
+ if (wishspd > 30)
+ wishspd = 30;
+ currentspeed = self.velocity * wishvel;
+ addspeed = wishspd - currentspeed;
+ if (addspeed <= 0)
+ return;
+ accelspeed = 10 * sv_accelerate * wishspd * real_frametime;
+ if (accelspeed > addspeed)
+ accelspeed = addspeed;
+
+ self.velocity = self.velocity + accelspeed * wishvel;
+};
+
+void(vector wishvel) SV_Accelerate =
+{
+ local float addspeed, wishspd, accelspeed, currentspeed;
+
+ wishspd = vlen(wishvel);
+ wishvel = normalize(wishvel);
+
+ currentspeed = self.velocity * wishvel;
+ addspeed = wishspd - currentspeed;
+ if (addspeed <= 0)
+ return;
+ accelspeed = sv_accelerate * wishspd * real_frametime;
+ if (accelspeed > addspeed)
+ accelspeed = addspeed;
+
+ self.velocity = self.velocity + accelspeed * wishvel;
+};
+void() SV_WaterMove =
+{
+ local vector wishvel;
+ local float wishspeed, addspeed, cspeed, newspeed;
+ makevectors(self.v_angle);
+ wishvel = v_right * self.movevect_y + v_forward * self.movevect_x;
+
+ if (self.movevect == '0 0 0')
+ wishvel_z = wishvel_z - 60;
+ else
+ wishvel_z = wishvel_z + self.movevect_z;
+ wishspeed = vlen(wishvel);
+
+ if (wishspeed > sv_maxspeed)
+ {
+ wishvel = (sv_maxspeed / wishspeed) * wishvel;
+ wishspeed = sv_maxspeed;
+ }
+ wishspeed = wishspeed * 0.7;
+ cspeed = vlen(self.velocity);
+ if (cspeed)
+ {
+ newspeed = cspeed - (real_frametime * cspeed * sv_friction);
+ if (newspeed < 0)
+ newspeed = 0;
+ self.velocity = self.velocity * (newspeed / cspeed);
+
+ }
+ else
+ newspeed = 0;
+
+ if (!wishspeed)
+ return;
+ addspeed = wishspeed - newspeed;
+ if (addspeed <= 0)
+ return;
+ wishvel = normalize(wishvel);
+ cspeed = sv_accelerate * wishspeed * real_frametime;
+ if (cspeed > addspeed)
+ cspeed = addspeed;
+ self.velocity = self.velocity + cspeed * wishvel;
+};
+void() SV_AirMove =
+{
+ local vector wishvel, vangle;
+
+ vangle = self.v_angle;
+ vangle_x = vangle_z = 0;
+ makevectors(vangle);
+ if (time < self.teleport_time && (self.movevect_x < 0))
+ self.movevect_x = 0;
+ wishvel = v_right * self.movevect_y + v_forward * self.movevect_x;
+
+
+ if (self.movetype != MOVETYPE_WALK)
+ wishvel_z = self.movevect_z;
+ else
+ wishvel_z = 0;
+ if (vlen(wishvel) > sv_maxspeed)
+ wishvel = normalize(wishvel) * sv_maxspeed;
+ if (self.movetype == MOVETYPE_NOCLIP)
+ self.velocity = wishvel;
+ else if (self.flags & FL_ONGROUND)
+ {
+ SV_UserFriction();
+ SV_Accelerate(wishvel);
+ }
+ else
+ SV_AirAccelerate (wishvel);
+};
+
+void() SV_ClientThink =
+{
+ local vector vangle;
+
+ if (self.movetype == MOVETYPE_NONE)
+ return;
+ DropPunchAngle();
+ if (self.health <= 0)
+ return;
+ self.v_angle_z = 0; // V_CalcRoll removed, sucks
+ self.angles_z = self.v_angle_z * 4;
+ vangle = self.v_angle + self.punchangle;
+ if (!self.fixangle)
+ {
+ self.angles_x = (vangle_x / -3);
+ self.angles_y = vangle_y;
+ } else
+ {
+ self.v_angle = self.angles;
+ self.fixangle = 0;
+ }
+ if (self.flags & FL_WATERJUMP)
+ {
+ SV_WaterJump();
+ return;
+ }
+ if ((self.waterlevel >= 2) && (self.movetype != MOVETYPE_NOCLIP))
+ {
+ SV_WaterMove();
+ return;
+ }
+ SV_AirMove();
+
+};
+/*
+=========================================
+
+Stuff mimicking sv_phys.c
+
+=========================================
+*/
+
+float() SV_RunThink =
+{
+ local float thinktime, bkuptime;
+ thinktime = self.nextthink;
+ bkuptime = time;
+ if (thinktime <= 0 || thinktime > (time + real_frametime))
+ return TRUE;
+ if (thinktime < time)
+ thinktime = time;
+ self.nextthink = 0;
+ time = thinktime;
+ other = world;
+ makevectors(self.v_angle); // hack
+ self.think();
+ time = bkuptime;
+ return TRUE;
+};
+
+void(float scale) SV_AddGravity =
+{
+ self.velocity_z = self.velocity_z - (scale * sv_gravity * real_frametime);
+};
+
+float() SV_CheckWater =
+{
+ local vector point;
+ local float cont;
+
+ point_x = self.origin_x;
+ point_y = self.origin_y;
+ self.waterlevel = 0;
+ self.watertype = CONTENT_EMPTY;
+ point_z = self.origin_z + self.mins_z + 1;
+ cont = pointcontents(point);
+ if (cont <= CONTENT_WATER)
+ {
+ self.watertype = cont;
+ self.waterlevel = 1;
+ point_z = self.origin_z + (self.mins_z + self.maxs_z) * 0.5;
+ cont = pointcontents(point);
+ if (cont <= CONTENT_WATER)
+ {
+ self.waterlevel = 2;
+ point_z = self.origin_z + self.view_ofs_z;
+ cont = pointcontents(point);
+ if (cont <= CONTENT_WATER)
+ self.waterlevel = 3;
+ }
+ }
+ return (self.waterlevel > 1);
+
+};
+void() RemoveThud = // well sometimes
+{
+ local entity oself;
+ if (other == world)
+ {
+ if (self.flags & FL_ONGROUND)
+ {
+ self.flags = self.flags - FL_ONGROUND;
+ }
+ }
+ else
+ {
+ if (other.solid == SOLID_BSP && (self.flags & FL_ONGROUND))
+ {
+ // RM: Does this break anything?
+ // If not, then some more thuds have been removed.
+ self.flags = self.flags - FL_ONGROUND;
+ }
+ if (other == self.owner)
+ return;
+ if (self.owner.solid == SOLID_NOT)
+ return;
+ oself = other;
+ other = self.owner;
+ self = oself;
+ if (self.solid == SOLID_BSP)
+ if (self.touch)
+ self.touch();
+ }
+
+};
+void() SV_CheckOnGround =
+{
+ local vector org, v;
+ org = self.origin;
+ local float currentflags;
+ currentflags = self.flags;
+ self.flags = self.flags | FL_ONGROUND | FL_PARTIALGROUND;
+ walkmove(0,0); // perform C touch function
+ self.flags = currentflags | FL_ONGROUND;
+ if ((org_x != self.origin_x) || (org_y != self.origin_y))
+ org = self.origin;
+ else
+ self.origin = org;
+ v = org;
+ v_z = self.maxs_z + org_z + 1;
+ traceline (org, v, TRUE, self);
+ if ((self.waterlevel == 3) && (self.movetype == MOVETYPE_WALK))
+ self.flags = self.flags - FL_ONGROUND;
+ else if ((trace_plane_normal_z <= 0.7) && (trace_fraction != 1))
+ self.flags = self.flags - FL_ONGROUND;
+ else if (!droptofloor(/*0,0*/))
+ self.flags = self.flags - FL_ONGROUND;
+ else if (org_z - self.origin_z < 2)
+ self.flags = self.flags | FL_ONGROUND;
+ else
+ self.flags = self.flags - FL_ONGROUND;
+ setorigin(self, org);
+};
+// Thanks to Alan Kivlin for this function
+// modified heavily by me
+float(vector dir) botCheckForStep =
+{
+ local vector currentorigin, v;
+ local float currentflags, yaw, stepdistance, movedistance;
+ currentorigin = self.origin;
+ currentflags = self.flags;
+ self.flags = FL_ONGROUND | FL_PARTIALGROUND;
+ dir = normalize(dir);
+ dir_z = 0;
+ yaw = vectoyaw(dir);
+ if(walkmove(yaw, 3))
+ {
+ if(droptofloor(/*0,0*/))
+ {
+ stepdistance = self.origin_z - currentorigin_z;
+ v = self.origin - currentorigin;
+ v_z = 0;
+ movedistance = vlen(v);
+ if((stepdistance > 0 && stepdistance <= 16) && movedistance != 0)
+ {
+ self.flags = currentflags | FL_PARTIALGROUND;
+ return 1;
+ }
+ }
+ }
+ self.flags = currentflags;
+ v = currentorigin;
+ v_z = self.origin_z;
+ if (vlen(v - self.origin) <= 4)
+ setorigin(self, currentorigin);
+ return 0;
+};
+// this is merely here to fix a problem with e3m5
+void(vector dir) BruteForceStep =
+{
+ local vector currentorigin;
+ local float currentflags, i, len;
+
+ currentorigin = self.origin;
+ currentflags = self.flags;
+ len = vlen(dir);
+ if (len > 16)
+ dir = normalize(dir) * 16;
+
+ setorigin(self, currentorigin + dir);
+
+ while(i < 18 && !walkmove(0, 0))
+ {
+ self.origin_z = currentorigin_z + i;
+ i = i + 2;
+ }
+ self.flags = currentflags;
+ if (i >=18)
+ setorigin(self, currentorigin);
+};
+
+void() PostPhysics =
+{
+ local vector obstr, org;
+ local float back, dst,cflags;
+
+ self = self.owner;
+
+ self.velocity = self.velocity - self.phys_obj.dest1 + self.phys_obj.velocity;
+ if (self.phys_obj.dest2 == self.origin)
+ {
+ setorigin(self, self.phys_obj.origin);
+ // might've been moved during other person's physics
+ // (teleporters / plats)
+
+ if (self.movetype == MOVETYPE_WALK)
+ {
+
+ if (self.phys_obj.dest1_x || self.phys_obj.dest1_y)
+ {
+ if ((self.flags & FL_ONGROUND) || (self.waterlevel <= 2))
+ {
+ obstr = self.phys_obj.movedir - self.origin;
+ obstr_z = 0;
+ if (vlen(obstr) > 0.1)
+ {
+ dst = vlen(obstr);
+ back = vectoyaw(obstr);
+ cflags = self.flags;
+ self.flags = self.flags | FL_PARTIALGROUND;
+ if(walkmove(back, dst))
+ {
+ self.flags = cflags;
+ self.phys_obj.dest1_z = 0;
+ self.velocity = self.velocity + self.phys_obj.dest1 - self.phys_obj.velocity;
+ }
+ else
+ {
+ if (dst > 1)
+ frik_obstructed(obstr, FALSE);
+
+ org = self.origin;
+ self.flags = cflags;
+ obstr = self.phys_obj.dest1;
+ obstr_x = 0;
+ if (!botCheckForStep(obstr))
+ {
+ obstr = self.phys_obj.dest1;
+ obstr_y = 0;
+ if (!botCheckForStep(obstr))
+ {
+ // if no steps were found, bot is really obstucted
+ BruteForceStep(self.phys_obj.dest1);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ SV_CheckOnGround();
+
+ PlayerPostThink();
+ BotAI();
+ self.dmg_take = self.dmg_save = 0;
+
+};
+// Avoid calling BotAI and the physics at the same time
+// Can trip the runaway loop counter
+
+void() SV_FlyMove =
+{
+ // This is nothing like the Quake function.
+
+ if (self.phys_obj == world)
+ {
+ self.phys_obj = find(world,classname,"phys_obj");
+ while (self.phys_obj.owner != self)
+ {
+ self.phys_obj = find(self.phys_obj,classname,"phys_obj");
+ if (self.phys_obj == world)
+ {
+ error("No physics entity spawned!\nMake sure BotInit was called\n");
+ }
+ }
+ }
+
+ setmodel (self.phys_obj, string_null);
+ self.phys_obj.movetype = MOVETYPE_STEP;
+
+ self.phys_obj.solid = SOLID_TRIGGER;
+ self.phys_obj.touch = RemoveThud;
+ setsize(self.phys_obj, self.mins, self.maxs);
+ self.phys_obj.dest2 = self.phys_obj.origin = self.origin;
+ self.phys_obj.watertype = 0;
+ self.phys_obj.movedir = self.origin + real_frametime * self.velocity;
+ self.phys_obj.dest1 = self.phys_obj.velocity = self.velocity;
+ self.phys_obj.velocity_z = self.phys_obj.velocity_z + sv_gravity * real_frametime;
+ self.phys_obj.flags = 0;
+ self.phys_obj.think = PostPhysics;
+ self.phys_obj.nextthink = time;
+};
+
+
+void() SV_Physics_Toss =
+{
+ if (!SV_RunThink())
+ return;
+ if (self.flags & FL_ONGROUND)
+ {
+ self.velocity = '0 0 0';
+ BotAI();
+ return;
+ }
+ if (self.movetype != MOVETYPE_FLY)
+ SV_AddGravity(1);
+ self.angles = self.angles + real_frametime * self.avelocity;
+ SV_FlyMove();
+
+};
+void() SV_Physics_Client =
+{
+
+ PlayerPreThink();
+
+ if (self.movetype == MOVETYPE_NONE)
+ {
+ if (!SV_RunThink())
+ return;
+ PlayerPostThink();
+ BotAI();
+
+ }
+ else if ((self.movetype == MOVETYPE_WALK) || (self.movetype == MOVETYPE_STEP))
+ {
+ if (!SV_RunThink())
+ return;
+ if (!(SV_CheckWater()) && (!(self.flags & FL_WATERJUMP)))
+ SV_AddGravity(1);
+ SV_FlyMove();
+ }
+ else if ((self.movetype == MOVETYPE_TOSS) || (self.movetype == MOVETYPE_BOUNCE))
+ {
+ SV_Physics_Toss();
+ }
+ else if (self.movetype == MOVETYPE_FLY)
+ {
+ if (!SV_RunThink())
+ return;
+ SV_FlyMove();
+ }
+ else if (self.movetype == MOVETYPE_NOCLIP)
+ {
+ if (!SV_RunThink())
+ return;
+ self.origin = self.origin + real_frametime * self.velocity;
+
+ PlayerPostThink();
+ BotAI();
+ }
+ else
+ error ("SV_Physics_Client: Bad Movetype (BOT)");
+
+};
+
+
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/frikbot/bot_qw.qc b/r17/Revamped src/Revamped QC/frikbot/bot_qw.qc
new file mode 100755
index 00000000..fc5798b6
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/frikbot/bot_qw.qc
@@ -0,0 +1,964 @@
+
+/*
+======================================
+FrikBot X (Version 0.10.2) QW
+======================================
+
+This program is in the Public Domain. My crack legal
+team would like to add:
+
+RYAN "FRIKAC" SMITH IS PROVIDING THIS SOFTWARE "AS IS"
+AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE
+ACCURACY, CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR
+FUNCTIONING OF THIS SOFTWARE AND/OR DOCUMENTATION. IN
+NO EVENT WILL RYAN "FRIKAC" SMITH BE LIABLE FOR ANY
+GENERAL, CONSEQUENTIAL, INDIRECT, INCIDENTAL,
+EXEMPLARY, OR SPECIAL DAMAGES, EVEN IF RYAN "FRIKAC"
+SMITH HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES, IRRESPECTIVE OF THE CAUSE OF SUCH DAMAGES.
+
+You accept this software on the condition that you
+indemnify and hold harmless Ryan "FrikaC" Smith from
+any and all liability or damages to third parties,
+including attorney fees, court costs, and other
+related costs and expenses, arising out of your use
+of this software irrespective of the cause of said
+liability.
+
+The export from the United States or the subsequent
+reexport of this software is subject to compliance
+with United States export control and munitions
+control restrictions. You agree that in the event you
+seek to export this software, you assume full
+responsibility for obtaining all necessary export
+licenses and approvals and for assuring compliance
+with applicable reexport restrictions.
+
+Any reproduction of this software must contain
+this notice in its entirety.
+
+
+======================================
+These installation instructions only apply to QuakeWorld (as does this entire
+file). For Normal Quake, please refer to bot.qc
+
+--------------------------------------
+To install on a new mod, do all this:
+--------------------------------------
+Place all included bot*.qc files in the subdirectory "frikbot"
+in your source folder, then...
+
+* Add the following lines to progs.src right after the defs.qc line
+frikbot/bot_qw.qc
+frikbot/bot_way.qc
+frikbot/bot_fight.qc
+frikbot/bot_ai.qc
+frikbot/bot_misc.qc
+frikbot/bot_phys.qc
+frikbot/bot_move.qc
+--------------------------------------
+* Comment out the following functions in defs.qc
+sound, stuffcmd, sprint, aim, centerprint, setspawnparms
+WriteByte, WriteChar, WriteShort, WriteLong, WriteCoord
+WriteAngle, WriteString, WriteEntity
+--------------------------------------
+* Add this to worldspawn() in world.qc, right at the very top, before InitBodyQue();
+BotInit(); // FrikBot
+--------------------------------------
+* add this line to StartFrame() in world.qc, at the very top
+BotFrame(); // FrikBot
+--------------------------------------
+* Add these two lines to PlayerPreThink in client.qc at the very top
+if (BotPreFrame()) // FrikBot
+ return;
+--------------------------------------
+* Add this line to PlayerPostThink in client.qc at the very top
+if (BotPostFrame()) // FrikBot
+ return;
+--------------------------------------
+* Add the following line to the very top of Client Connect in client.qc
+ClientInRankings(); // FrikBot
+--------------------------------------
+* Add these lines to the very top of ClientDisconnect in client.qc
+ClientDisconnected(); // FrikBot
+--------------------------------------
+* Add these lines to the very top of SpectatorConnect in spectate.qc
+ClientFixRankings(); // FrikBot
+--------------------------------------
+
+To install the waypoints:
+
+add
+
+waypoints/map_dm1.qc
+waypoints/map_dm2.qc
+waypoints/map_dm3.qc
+waypoints/map_dm4.qc
+waypoints/map_dm5.qc
+waypoints/map_dm6.qc
+
+To progs.src, immediately after defs.qc
+
+To remove these waypoints:
+
+Delete the code in bot_map_load, located below.
+*/
+
+void() bot_map_load =
+{
+ // place your qc loaded waypoints here
+
+ if (mapname == "dm1")
+ map_dm1();
+ else if (mapname == "dm2")
+ map_dm2();
+ else if (mapname == "dm3")
+ map_dm3();
+ else if (mapname == "dm4")
+ map_dm4();
+ else if (mapname == "dm5")
+ map_dm5();
+ else if (mapname == "dm6")
+ map_dm6();
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Variables and shtuff
+
+bot.qc has become pretty much a header file
+for all variable in the bot...
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+// ----- entity fields ---
+.float wallhug, keys, oldkeys, ishuman;
+.float b_frags, b_clientno, b_shirt, b_pants;
+.float priority, ai_time, b_sound, missile_speed;
+.float portal_time, b_skill, switch_wallhug;
+.float b_aiflags, b_num, b_chattime;
+.float b_entertime, b_userid; // QW shtuff
+.float b_menu, b_menu_time, b_menu_value;
+.float route_failed, dyn_flags, dyn_time;
+.float dyn_plat;
+.entity temp_way, last_way, phys_obj;
+.entity target1, target2, target3, target4;
+.entity _next, _last;
+.entity current_way;
+.vector b_angle, b_dest, mouse_emu, obs_dir;
+.vector movevect, b_dir;
+.vector dyn_dest;
+.vector punchangle; // HACK - Don't want to screw with bot_phys
+
+// --------defines-----
+float SVC_UPDATENAME = 13;
+float SVC_UPDATEFRAGS = 14;
+float SVC_UPDATECOLORS = 17;
+
+// used for the physics & movement AI
+float KEY_MOVEUP = 1;
+float KEY_MOVEDOWN = 2;
+float KEY_MOVELEFT = 4;
+float KEY_MOVERIGHT = 8;
+float KEY_MOVEFORWARD = 16;
+float KEY_MOVEBACK = 32;
+float KEY_LOOKUP = 64;
+float KEY_LOOKDOWN = 128;
+float KEY_LOOKLEFT = 256;
+float KEY_LOOKRIGHT = 512;
+
+// these are aiflags for waypoints
+// some overlap to the bot
+float AI_TELELINK_1 = 1; // link type
+float AI_TELELINK_2 = 2; // link type
+float AI_TELELINK_3 = 4; // link type
+float AI_TELELINK_4 = 8; // link type
+float AI_DOORFLAG = 16; // read ahead
+float AI_PRECISION = 32; // read ahead + point
+float AI_SURFACE = 64; // point
+float AI_BLIND = 128; // read ahead + point
+float AI_JUMP = 256; // point + ignore
+float AI_DIRECTIONAL = 512; // read ahead + ignore
+float AI_PLAT_BOTTOM = 1024; // read ahead
+float AI_RIDE_TRAIN = 2048; // read ahead
+float AI_SUPER_JUMP = 4096; // point + ignore + route test
+float AI_SNIPER = 8192; // point type
+float AI_AMBUSH = 16384; // point type
+float AI_DOOR_NO_OPEN = 32768; // read ahead
+float AI_DIFFICULT = 65536; // route test
+float AI_TRACE_TEST = 131072; // route test
+
+// these are flags for bots/players (dynamic/editor flags)
+float AI_OBSTRUCTED = 1;
+float AI_HOLD_SELECT = 2;
+float AI_ROUTE_FAILED = 2;
+float AI_WAIT = 4;
+float AI_DANGER = 8;
+
+// addition masks
+float AI_POINT_TYPES = 29152;
+float AI_READAHEAD_TYPES = 36528;
+float AI_IGNORE_TYPES = 4864;
+
+float WM_UNINIT = 0;
+float WM_DYNAMIC = 1;
+float WM_LOADING = 2;
+float WM_LOADED = 3;
+// editor modes aren't available in QW, but we retain support of them
+// since the editor is still built into the AI in places
+float WM_EDITOR = 4;
+float WM_EDITOR_DYNAMIC = 5;
+float WM_EDITOR_DYNLINK = 6;
+
+float OPT_NOCHAT = 2;
+
+// -------globals-----
+float active_clients1, active_clients2;
+float max_clients, real_frametime;
+float bot_count, b_options, lasttime;
+float waypoint_mode, dump_mode;
+float waypoints, direct_route, userid;
+float sv_friction, sv_gravity;
+float sv_accelerate, sv_maxspeed, sv_stopspeed;
+entity fixer;
+entity route_table;
+entity b_temp1, b_temp2, b_temp3;
+entity player_head, phys_head, way_head;
+float busy_waypoints;
+
+float coop = 0; // hack
+
+// -------ProtoTypes------
+// external
+void() ClientConnect;
+void() ClientDisconnect;
+void() SetNewParms;
+
+// rankings
+float(float clientno) ClientBitFlag;
+float() ClientNextAvailable;
+void(float whatbot, float whatskill) BotConnect;
+void(entity bot) BotDisconnect;
+void(float clientno) BotInvalidClientNo;
+void(entity who) UpdateClient;
+
+// waypointing
+void() DynamicWaypoint;
+entity(vector org) make_waypoint;
+void() ClearAllWays;
+void() FixWaypoints;
+float() begin_route;
+void(entity this, float direct) bot_get_path;
+void() WaypointThink;
+entity(entity start) FindWayPoint;
+
+// physics & movement
+float(entity e) bot_can_rj;
+void() bot_jump;
+void() frik_bot_roam;
+float(vector weird) frik_walkmove;
+void() frik_movetogoal;
+void() frik_obstacles;
+float(float flag) frik_recognize_plat;
+float(vector sdir) frik_KeysForDir;
+void(vector whichway, float danger) frik_obstructed;
+void() SV_Physics_Client;
+void() SV_ClientThink;
+void() CL_KeyMove;
+
+// ai & misc
+string() PickARandomName;
+float(entity targ) fov;
+float(float y1, float y2) angcomp;
+float(entity targ1, entity targ2) wisible;
+float(entity targ) sisible;
+float(entity targ) fisible;
+vector(entity ent) realorigin;
+void(entity ent) target_drop;
+void(entity ent) target_add;
+void() KickABot;
+void() BotImpulses;
+void(entity targ, float success) bot_lost;
+string(float r) BotName;
+float(float v) frik_anglemod;
+void() bot_chat;
+void(float tpic) bot_start_topic;
+
+
+// ----------Commands---------
+void(entity e, float chan, string samp, float vol, float atten) frik_sound = #8;
+void(entity client, string s) frik_stuffcmd = #21;
+void(entity client, float level, string s) frik_sprint = #24;
+vector(entity e, float sped) frik_aim = #44;
+void(entity client, string s) frik_centerprint = #73;
+void(entity e) frik_setspawnparms = #78;
+void(float to, float f) frik_WriteByte = #52;
+void(float to, float f) frik_WriteChar = #53;
+void(float to, float f) frik_WriteShort = #54;
+void(float to, float f) frik_WriteLong = #55;
+void(float to, float f) frik_WriteCoord = #56;
+void(float to, float f) frik_WriteAngle = #57;
+void(float to, string s) frik_WriteString = #58;
+void(float to, entity s) frik_WriteEntity = #59;
+
+//----------------------------------------------------------------------------
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Function redclarations. These allow function
+designed to work for clients (sprint, so forth)
+to mainly not complain when working with a bot
+
+Although these shouldn't be needed anymore,
+as the bots truly are clients now, if you don't
+stop the SZ_ buffer from filling up by disabling
+direct messages to the bots, it crashes quake :-(
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+void(entity client, string s) stuffcmd =
+{
+ if (client.ishuman)
+ frik_stuffcmd(client, s);
+};
+
+void(entity e) setspawnparms =
+{
+ if (e.ishuman)
+ frik_setspawnparms(e);
+ else
+ SetNewParms();
+};
+void(entity client, float level, string s) sprint =
+{
+ if (client.ishuman)
+ frik_sprint(client, level, s);
+};
+void(entity client, string s) centerprint =
+{
+ if (client.ishuman)
+ frik_centerprint(client, s);
+};
+
+vector(entity e, float sped) aim =
+{
+ e.missile_speed = sped;
+ return frik_aim(e, sped);
+};
+
+void(entity e, float chan, string samp, float vol, float atten) sound =
+{
+ frik_sound(e, chan, samp, vol, atten);
+ if (samp == "items/inv3.wav")
+ return;
+ else if (e.classname == "player")
+ e.b_sound = time + 1;
+ else if (other.classname == "player")
+ other.b_sound = time + 1;
+};
+void(float to, float f) WriteByte =
+{
+ if ((to == MSG_ONE) && (msg_entity.ishuman != TRUE))
+ return;
+ frik_WriteByte(to, f);
+};
+void(float to, float f) WriteChar =
+{
+ if ((to == MSG_ONE) && (msg_entity.ishuman != TRUE))
+ return;
+ frik_WriteChar(to, f);
+};
+void(float to, float f) WriteShort =
+{
+ if ((to == MSG_ONE) && (msg_entity.ishuman != TRUE))
+ return;
+ frik_WriteShort(to, f);
+};
+void(float to, float f) WriteLong =
+{
+ if ((to == MSG_ONE) && (msg_entity.ishuman != TRUE))
+ return;
+ frik_WriteLong(to, f);
+};
+void(float to, float f) WriteCoord =
+{
+ if ((to == MSG_ONE) && (msg_entity.ishuman != TRUE))
+ return;
+ frik_WriteCoord(to, f);
+};
+void(float to, float f) WriteAngle =
+{
+ if ((to == MSG_ONE) && (msg_entity.ishuman != TRUE))
+ return;
+ frik_WriteAngle(to, f);
+};
+void(float to, string s) WriteString =
+{
+ if ((to == MSG_ONE) && (msg_entity.ishuman != TRUE))
+ return;
+ frik_WriteString(to, s);
+};
+void(float to, entity s) WriteEntity =
+{
+ if ((to == MSG_ONE) && (msg_entity.ishuman != TRUE))
+ return;
+ frik_WriteEntity(to, s);
+};
+
+
+float(float clientno) ClientIsActive =
+{
+ if(clientno > 16)
+ {
+ if(active_clients2 & ClientBitFlag(clientno - 16))
+ return TRUE;
+ else
+ return FALSE;
+ }
+ else
+ {
+ if(active_clients1 & ClientBitFlag(clientno))
+ return TRUE;
+ else
+ return FALSE;
+ }
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Stuff mentioned up top
+it just links the bot into the mod
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() ClientFixRankings =
+{
+ local float cno;
+ if (self.switch_wallhug > time)
+ return;
+ self.switch_wallhug = 0;
+
+ b_temp2 = nextent(world);
+ cno = 0;
+
+ while (cno < max_clients)
+ {
+ if (!b_temp2.ishuman)
+ {
+ if (ClientIsActive(cno))
+ UpdateClient(b_temp2);
+ }
+ cno = cno + 1;
+ b_temp2 = nextent(b_temp2);
+ }
+};
+
+void() ClientInRankings =
+{
+ local float cno;
+
+ cno = self.colormap - 1;
+ BotInvalidClientNo (cno);
+
+ if (player_head)
+ player_head._last = self;
+ self._next = player_head;
+ player_head = self;
+ userid = userid + 1;
+ self.b_userid = userid;
+
+ if (!self.phys_obj)
+ {
+ b_temp2 = phys_head;
+ while (b_temp2 != world && b_temp2.owner != self)
+ b_temp2 = b_temp2._next;
+ self.phys_obj = b_temp2;
+ }
+
+ if (self.ishuman == 2)
+ {
+ self.ishuman = FALSE;
+ return;
+ }
+ if(cno > 16)
+ active_clients2 = active_clients2 | ClientBitFlag(cno - 16);
+ else
+ active_clients1 = active_clients1 | ClientBitFlag(cno);
+ self.b_clientno = cno;
+ self.ishuman = TRUE;
+ self.switch_wallhug = time + 1;
+};
+
+
+void() ClientDisconnected =
+{
+ if (player_head == self)
+ player_head = self._next;
+ if (self._next)
+ self._next._last = self._last;
+ if (self._last)
+ self._last._next = self._next;
+ if(self.b_clientno > 16)
+ active_clients2 = active_clients2 - (active_clients2 & ClientBitFlag(self.b_clientno - 16));
+ else
+ active_clients1 = active_clients1 - (active_clients1 & ClientBitFlag(self.b_clientno));
+};
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+BotPreFrame & BotPostFrame, used to make the
+bot easier to install
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+float () BotPreFrame =
+{
+ if (self.b_clientno == -1)
+ return TRUE;
+ if (self.ishuman)
+ if (self.switch_wallhug)
+ ClientFixRankings();
+ if (self.b_frags != self.frags)
+ {
+ if (self.b_frags > self.frags)
+ {
+ if (pointcontents(self.origin) == CONTENT_LAVA)
+ bot_start_topic(10);
+ else
+ bot_start_topic(9);
+ }
+ else
+ bot_start_topic(2);
+ self.b_frags = self.frags;
+ if (!self.ishuman)
+ {
+ WriteByte(2, 14);
+ WriteByte(2, self.b_clientno);
+ WriteShort(2, self.frags);
+ }
+ }
+ DynamicWaypoint();
+ return FALSE;
+};
+float () BotPostFrame =
+{
+ if (self.b_clientno == -1)
+ return TRUE;
+ if (self.ishuman)
+ BotImpulses();
+ return FALSE;
+};
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Bot Chat code
+
+The rest of this code is in bot_rank.qc
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+void(string h) BotSay = // simulate talking by composing a 'chat' message
+{
+ WriteByte(MSG_ALL, 8);
+ WriteByte(MSG_ALL, 3);
+ WriteByte(MSG_ALL, 1);
+ WriteString(MSG_ALL, self.netname);
+ WriteByte(MSG_ALL, 8);
+ WriteByte(MSG_ALL, 3);
+ WriteByte(MSG_ALL, 2);
+ WriteString(MSG_ALL, h);
+};
+void() BotSayInit =
+{
+ WriteByte(MSG_ALL, 8);
+ WriteByte(MSG_ALL, 3);
+ WriteByte(MSG_ALL, 1);
+ WriteString(MSG_ALL, self.netname);
+};
+void(string h) BotSay2 =
+{
+ WriteByte(MSG_ALL, 8);
+ WriteByte(MSG_ALL, 3);
+ WriteByte(MSG_ALL, 2);
+ WriteString(MSG_ALL, h);
+};
+void(string h) BotSayTeam =
+{
+ // FBX QW doesn't support teamplay...yet
+};
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+BotInit
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+
+void() BotInit =
+{
+ local entity ent, fisent;
+ local float numents;
+
+ // spawn entities for the physics
+ ent = nextent(world);
+ max_clients = 0;
+
+ while(ent != world)
+ {
+ max_clients = max_clients + 1;
+ ent = nextent(ent);
+ }
+
+ ent = nextent(world);
+ fisent = world;
+ while (numents < max_clients)
+ {
+
+ phys_head = spawn();
+ if (fisent)
+ fisent._next = phys_head;
+ phys_head._last = fisent;
+ fisent = phys_head;
+ ent.phys_obj = phys_head;
+ phys_head.classname = "phys_obj";
+ phys_head.owner = ent;
+ numents = numents + 1;
+ ent = nextent(ent);
+ }
+ bot_map_load();
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Rankings 'utilities'. Written by Alan Kivlin,
+this code just fools clients by sending precisely
+the same network messages as when a real player
+signs on to the server.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+
+void(entity who) UpdateClient =
+{
+ WriteByte(2, 14 );
+ WriteByte(2, who.b_clientno);
+ WriteShort(2, who.frags);
+ WriteByte(2, 36);
+ WriteByte(2, who.b_clientno);
+ WriteShort(2, 100 * (3 - who.b_skill));
+ WriteByte(2, 37); // update entertime
+ WriteByte(2, who.b_clientno); // client number
+ WriteLong(2, time - who.b_entertime); // client entertime
+ WriteByte(2, 40 ); // update userinfo
+ WriteByte(2, who.b_clientno); // client number
+ WriteLong(2, who.b_userid); // client userid
+ WriteByte(2, 92); // \
+ WriteByte(2, 98); // b
+ WriteByte(2, 111); // o
+ WriteByte(2, 116); // t
+ WriteByte(2, 116); // t
+ WriteByte(2, 111); // o
+ WriteByte(2, 109); // m
+ WriteByte(2, 99); // c
+ WriteByte(2, 111); // o
+ WriteByte(2, 108); // l
+ WriteByte(2, 111); // o
+ WriteByte(2, 114); // r
+ WriteByte(2, 92); // \
+ if(who.b_pants > 9)
+ {
+ WriteByte(2, 49);
+ WriteByte(2, 38 + who.b_pants);
+ }
+ else
+ WriteByte(2, 48 + who.b_pants);
+ WriteByte(2, 92); // \
+ WriteByte(2, 116); // t
+ WriteByte(2, 111); // o
+ WriteByte(2, 112); // p
+ WriteByte(2, 99); // c
+ WriteByte(2, 111); // o
+ WriteByte(2, 108); // l
+ WriteByte(2, 111); // o
+ WriteByte(2, 114); // r
+ WriteByte(2, 92); // \
+ if(who.b_shirt > 9)
+ {
+ WriteByte(2, 49);
+ WriteByte(2, 38 + who.b_shirt);
+ }
+ else
+ WriteByte(2, 48 + who.b_shirt);
+ WriteByte(2, 92); // \
+ WriteByte(2, 116); // t
+ WriteByte(2, 101); // e
+ WriteByte(2, 97); // a
+ WriteByte(2, 109); // m
+ WriteByte(2, 92); // \
+ WriteByte(2, 98); // b
+ WriteByte(2, 111); // o
+ WriteByte(2, 116); // t
+ // FIXME: do teams properly
+ // note this has no effect on infokey
+ WriteByte(2, 92 ); // \
+ WriteByte(2, 115); // s
+ WriteByte(2, 107); // k
+ WriteByte(2, 105); // i
+ WriteByte(2, 110); // n
+ WriteByte(2, 92); // \
+ WriteByte(2, 98); // b
+ WriteByte(2, 97); // a
+ WriteByte(2, 115); // s
+ WriteByte(2, 101); // e
+ WriteByte(2, 92); // \
+ WriteByte(2, 110); // n
+ WriteByte(2, 97); // a
+ WriteByte(2, 109); // m
+ WriteByte(2, 101); // e
+ WriteByte(2, 92); // \
+ WriteString( 2, who.netname);
+};
+
+float(float clientno) ClientBitFlag =
+{
+ local float bitflag;
+ bitflag = 1;
+ while(clientno > 0)
+ {
+ bitflag = bitflag * 2;
+ clientno = clientno - 1;
+ }
+ return bitflag;
+};
+
+float() ClientNextAvailable =
+{
+ local float clientno;
+ // I want to do this top down, but QW won't let me
+ clientno = 0;
+ while(clientno < max_clients)
+ {
+ clientno = clientno + 1;
+
+ if(!ClientIsActive(clientno))
+ return clientno;
+ }
+ return -1;
+};
+
+
+void(entity e1, entity e2, float flag) DeveloperLightning = {};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+BotConnect and related functions.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+entity(float num) GetClientEntity =
+{
+ local entity upsy;
+ upsy = world;
+ num = num + 1;
+ while (num > 0)
+ {
+ num = num - 1;
+ upsy = nextent(upsy);
+ }
+ return upsy;
+};
+
+void(float whatbot, float whatskill) BotConnect =
+{
+ local float f;
+ local string h;
+ local entity uself;
+
+ f = ClientNextAvailable();
+ uself = self;
+ if(f == -1)
+ {
+ bprint(PRINT_HIGH, "Unable to connect a bot, server is full.\n");
+ return;
+ }
+
+ bot_count = bot_count + 1;
+ self = GetClientEntity(f);
+ bot_start_topic(1);
+ self.b_clientno = f;
+ self.colormap = f + 1;
+ if (whatbot)
+ self.netname = BotName(whatbot);
+ else
+ self.netname = PickARandomName();
+ // players can set skill all weird, so leave these checks in
+ whatskill = rint(whatskill);
+ if (whatskill > 3)
+ whatskill = 3;
+ else if (whatskill < 0)
+ whatskill = 0;
+ self.b_skill = whatskill;
+ self.b_entertime = time;
+ self.team = self.b_pants + 1;
+ UpdateClient(self);
+ SetNewParms();
+ self.ishuman = 2;
+ ClientConnect();
+ PutClientInServer();
+ if(f > 16)
+ active_clients2 = active_clients2 | ClientBitFlag(f - 16);
+ else
+ active_clients1 = active_clients1 | ClientBitFlag(f);
+ self = uself;
+};
+
+void(entity bot) BotDisconnect =
+{
+ local string h;
+ local entity uself;
+ uself = self;
+ self = bot;
+
+ bot_count = bot_count - 1;
+
+ ClientDisconnect();
+
+ //if (self.b_clientno != -1)
+ //{
+ // the bot's client number is not in use by a real player so we
+ // must remove it's entry in the rankings
+ // Quake engine sets all fields to 0, can only do the most important here
+ self.b_frags = self.frags = 0;
+ self.netname = "";
+ self.classname = "";
+ self.health = 0;
+ self.items = 0;
+ self.armorvalue = 0;
+ self.weaponmodel = "";
+ self.b_pants = 0;
+ self.b_shirt = 0;
+ self.ammo_shells = self.ammo_nails = self.ammo_rockets = self.ammo_cells = 0;
+ UpdateClient(self);
+ if(self.b_clientno > 16)
+ active_clients2 = active_clients2 - (active_clients2 & ClientBitFlag(self.b_clientno - 16));
+ else
+ active_clients1 = active_clients1 - (active_clients1 & ClientBitFlag(self.b_clientno));
+ self.b_clientno = -1;
+ //}
+ self = uself;
+};
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+BotInvalidClientNo
+kicks a bot if a player connects and takes the bot's space
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void(float clientno) BotInvalidClientNo =
+{
+ local entity bot;
+
+ if (ClientIsActive(clientno))
+ {
+ bot = GetClientEntity (clientno);
+
+ if (bot.b_clientno == clientno)
+ {
+ bot.b_clientno = -1;
+ BotDisconnect(bot);
+ if(clientno > 16)
+ active_clients2 = active_clients2 | (active_clients2 & ClientBitFlag(clientno - 16));
+ else
+ active_clients1 = active_clients1 | (active_clients1 & ClientBitFlag(clientno));
+ BotConnect(self.b_num, self.b_skill);
+ return;
+ }
+ }
+};
+
+void() BotFrame =
+{
+ local float num;
+ local string h;
+
+ h = infokey(world, "bot_options");
+ b_options = stof(h);
+
+ // for the sake of speed
+ sv_maxspeed = cvar("sv_maxspeed");
+ sv_gravity = cvar("sv_gravity");
+ sv_friction = cvar("sv_friction");
+ sv_accelerate = cvar("sv_accelerate");
+ sv_stopspeed = cvar("sv_stopspeed");
+ real_frametime = time - lasttime; // in QW frametime is fuxx0red
+ lasttime = time;
+
+ self = nextent(world);
+ num = 0;
+ while (num < max_clients)
+ {
+ if (self.ishuman == FALSE)
+ {
+ if (self.b_clientno > 0)
+ {
+ frik_obstacles();
+ CL_KeyMove();
+ SV_ClientThink();
+ SV_Physics_Client();
+ // this is sickening
+ if (self.phys_obj)
+ {
+ if (self.phys_obj.modelindex != self.modelindex)
+ {
+ setmodel(self.phys_obj, "progs/player.mdl");
+ self.phys_obj.modelindex = self.modelindex;
+ }
+ self.phys_obj.frame = self.frame;
+ self.phys_obj.angles = self.angles;
+ self.phys_obj.colormap = self.colormap;
+ self.phys_obj.effects = self.effects;
+ }
+ }
+ }
+ self = nextent(self);
+ num = num + 1;
+ }
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Bot Impulses. Allows the player to perform bot
+related functions.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() BotImpulses =
+{
+ local float f;
+ local string h;
+
+ if (self.impulse == 100)
+ {
+ h = infokey(world, "skill");
+ f = stof(h);
+ BotConnect(0, f);
+ }
+ else if (self.impulse == 102)
+ KickABot();
+ else
+ return;
+ self.impulse = 0;
+};
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/frikbot/bot_way.qc b/r17/Revamped src/Revamped QC/frikbot/bot_way.qc
new file mode 100755
index 00000000..5dfc841e
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/frikbot/bot_way.qc
@@ -0,0 +1,1007 @@
+ /***********************************************
+* *
+* FrikBot Waypoints *
+* "The better than roaming AI" *
+* *
+***********************************************/
+
+/*
+
+This program is in the Public Domain. My crack legal
+team would like to add:
+
+RYAN "FRIKAC" SMITH IS PROVIDING THIS SOFTWARE "AS IS"
+AND MAKES NO WARRANTY, EXPRESS OR IMPLIED, AS TO THE
+ACCURACY, CAPABILITY, EFFICIENCY, MERCHANTABILITY, OR
+FUNCTIONING OF THIS SOFTWARE AND/OR DOCUMENTATION. IN
+NO EVENT WILL RYAN "FRIKAC" SMITH BE LIABLE FOR ANY
+GENERAL, CONSEQUENTIAL, INDIRECT, INCIDENTAL,
+EXEMPLARY, OR SPECIAL DAMAGES, EVEN IF RYAN "FRIKAC"
+SMITH HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES, IRRESPECTIVE OF THE CAUSE OF SUCH DAMAGES.
+
+You accept this software on the condition that you
+indemnify and hold harmless Ryan "FrikaC" Smith from
+any and all liability or damages to third parties,
+including attorney fees, court costs, and other
+related costs and expenses, arising out of your use
+of this software irrespective of the cause of said
+liability.
+
+The export from the United States or the subsequent
+reexport of this software is subject to compliance
+with United States export control and munitions
+control restrictions. You agree that in the event you
+seek to export this software, you assume full
+responsibility for obtaining all necessary export
+licenses and approvals and for assuring compliance
+with applicable reexport restrictions.
+
+Any reproduction of this software must contain
+this notice in its entirety.
+
+*/
+
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Waypoint Linking code
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+
+float (entity e1, entity e2) CheckLinked =
+{
+ if ((e1 == e2) || (e2 == world) || (e1 == world))
+ return FALSE;
+ else if (e1.target1 == e2)
+ {
+ if (e1.b_aiflags & AI_TELELINK_1)
+ return 2;
+ else return TRUE;
+ }
+ else if (e1.target2 == e2)
+ {
+ if (e1.b_aiflags & AI_TELELINK_2)
+ return 2;
+ else return TRUE;
+ }
+ else if (e1.target3 == e2)
+ {
+ if (e1.b_aiflags & AI_TELELINK_3)
+ return 2;
+ else return TRUE;
+ }
+ else if (e1.target4 == e2)
+ {
+ if (e1.b_aiflags & AI_TELELINK_4)
+ return 2;
+ else return TRUE;
+ }
+
+ else return FALSE;
+};
+
+
+float (entity e1, entity e2) LinkWays =
+{
+ if ((e1 == e2) || (e2 == world) || (e1 == world))
+ return FALSE;
+ else if (CheckLinked(e1, e2))
+ return FALSE; // already linked!!!
+
+ if (e1.target1 == world)
+ {
+ e1.target1 = e2;
+ return TRUE;
+ }
+ else if (e1.target2 == world)
+ {
+ e1.target2 = e2;
+ return TRUE;
+ }
+ else if (e1.target3 == world)
+ {
+ e1.target3 = e2;
+ return TRUE;
+ }
+ else if (e1.target4 == world)
+ {
+ e1.target4 = e2;
+ return TRUE;
+ }
+ else return FALSE;
+
+};
+// Link Ways part 2, used only for teleporters
+
+float (entity e1, entity e2) TeleLinkWays =
+{
+ if ((e1 == e2) || (e2 == world) || (e1 == world))
+ return FALSE;
+ else if (CheckLinked(e1, e2))
+ return FALSE; // already linked!!!
+
+ if (e1.target1 == world)
+ {
+ e1.target1 = e2;
+ e1.b_aiflags = e1.b_aiflags | AI_TELELINK_1;
+ return TRUE;
+ }
+ else if (e1.target2 == world)
+ {
+ e1.target2 = e2;
+ e1.b_aiflags = e1.b_aiflags | AI_TELELINK_2;
+ return TRUE;
+ }
+ else if (e1.target3 == world)
+ {
+ e1.target3 = e2;
+ e1.b_aiflags = e1.b_aiflags | AI_TELELINK_3;
+ return TRUE;
+ }
+ else if (e1.target4 == world)
+ {
+ e1.target4 = e2;
+ e1.b_aiflags = e1.b_aiflags | AI_TELELINK_4;
+ return TRUE;
+ }
+ else
+ return FALSE;
+
+};
+
+void (entity e1, entity e2) UnlinkWays =
+{
+ if ((e1 == e2) || (e2 == world) || (e1 == world))
+ return;
+ else if (!CheckLinked(e1, e2))
+ return;
+
+ if (e1.target1 == e2)
+ {
+ e1.b_aiflags = e1.b_aiflags - (e1.b_aiflags & AI_TELELINK_1);
+ e1.target1 = world;
+ }
+ if (e1.target2 == e2)
+ {
+ e1.b_aiflags = e1.b_aiflags - (e1.b_aiflags & AI_TELELINK_2);
+ e1.target2 = world;
+ }
+ if (e1.target3 == e2)
+ {
+ e1.b_aiflags = e1.b_aiflags - (e1.b_aiflags & AI_TELELINK_3);
+ e1.target3 = world;
+ }
+ if (e1.target4 == e2)
+ {
+ e1.b_aiflags = e1.b_aiflags - (e1.b_aiflags & AI_TELELINK_4);
+ e1.target4 = world;
+ }
+
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+FindWaypoint
+
+This is used quite a bit, by many different
+functions big lag causer
+
+Finds the closest, fisible, waypoint to e
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+entity(entity start) FindWayPoint =
+{
+ local entity t;
+ local vector org;
+ local float dst, tdst;
+ local entity best;
+
+ org = realorigin(self);
+
+ t = way_head;
+ if (start != world)
+ {
+ dst = vlen(start.origin - org);
+ best = start;
+ }
+ else
+ {
+ dst = 100000;
+ best = world;
+ }
+ while(t)
+ {
+ // real players cut through ignore types
+ if (dst < 20)
+ return best;
+ if (!(t.b_aiflags & AI_IGNORE_TYPES) || self.ishuman)
+ {
+ tdst = vlen(t.origin - org);
+ if (tdst < dst)
+ {
+ if (sisible(t))
+ {
+ dst = tdst;
+ best = t;
+ }
+ }
+ }
+ t = t._next;
+ }
+ return best;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Waypoint Spawning Code
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+entity way_foot; // Ugh. Do I need a foot for this or not?
+
+entity(vector org) make_waypoint =
+{
+ local entity point;
+ point = spawn();
+ point.classname = "waypoint";
+ point.solid = SOLID_TRIGGER;
+ point.movetype = MOVETYPE_NONE;
+ point.items = -1;
+ setorigin(point, org);
+
+ setsize(point, VEC_HULL_MIN, VEC_HULL_MAX);
+ waypoints = waypoints + 1;
+ if (!way_head)
+ {
+ way_head = point;
+ way_foot = point;
+ }
+ else
+ {
+ way_foot._next = point;
+ point._last = way_foot;
+ way_foot = point;
+ }
+
+ point.count = waypoints;
+ if (waypoint_mode > WM_LOADED) // editor modes
+ setmodel(point, "progs/s_bubble.spr");
+ return point;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Dynamic Waypoint spawning and linking. Not
+very good all things considered.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() DynamicWaypoint =
+{
+ local entity t;
+ local float dist, dynlink, dynpoint, editor;
+
+ if (self.teleport_time > self.portal_time)
+ {
+ if (!self.flags & FL_WATERJUMP)
+ {
+ self.dyn_flags = 2;
+ if (!self.ishuman)
+ {
+ bot_lost(self.target1, TRUE);
+ self.enemy = world;
+ }
+ }
+ self.portal_time = self.teleport_time;
+ }
+// stacking everything on waypoint_mode might've been good for the editor,
+// but it sucks to beat hell for this code.
+
+
+// convert waypoint_mode to something more usable..
+ if (waypoint_mode > WM_LOADED)
+ {
+ if (self.ishuman)
+ {
+ if (waypoint_mode == WM_EDITOR_DYNLINK)
+ dynlink = 1;
+ else if (waypoint_mode == WM_EDITOR_DYNAMIC)
+ dynlink = dynpoint = 1;
+ editor = 1;
+ }
+ }
+ else if (waypoint_mode == WM_DYNAMIC)
+ dynlink = dynpoint = 1;
+
+// if there's nothing for dynamic to do..
+ if (!dynpoint)
+ {
+ if (!editor)
+ return;
+ }
+// for speed sake, I won't have bots dynamic waypoint in coop
+ if (!self.ishuman)
+ if (coop)
+ return;
+
+// don't waypoint in single player
+ if (max_clients < 2)
+ return;
+// if you're dead
+ else if (self.health <= 0)
+ {
+ if (dynpoint)
+ {
+ if (self.current_way)
+ {
+ if (pointcontents(self.origin) < -4)
+ {
+ if (self.current_way.b_aiflags & AI_BLIND)
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_PRECISION;
+ else
+ self.current_way.b_aiflags = self.current_way.b_aiflags | AI_BLIND;
+ }
+ }
+ }
+ self.dyn_dest = '0 0 0';
+ self.current_way = world;
+ self.dyn_flags = 0;
+ return;
+ }
+
+// you shouldn't be making waypoints mid air
+ if (dynpoint)
+ {
+ if (!((self.flags & FL_ONGROUND) || self.waterlevel == 3))
+ {
+ if (self.dyn_flags != 2)
+ {
+ self.dyn_flags = 1;
+ }
+ return;
+ }
+ }
+// keep from doing the rest of this every frame
+ if (self.dyn_time > time)
+ return;
+ self.dyn_time = time + 0.2;
+
+// display the links for editor mode
+ if (editor)
+ {
+ if (self.current_way)
+ {
+ if (self.current_way.target1)
+ DeveloperLightning(self.current_way, self.current_way.target1, self.current_way.b_aiflags & AI_TELELINK_1);
+ if (self.current_way.target2)
+ DeveloperLightning(self.current_way, self.current_way.target2, self.current_way.b_aiflags & AI_TELELINK_2);
+ if (self.current_way.target3)
+ DeveloperLightning(self.current_way, self.current_way.target3, self.current_way.b_aiflags & AI_TELELINK_3);
+ if (self.current_way.target4)
+ DeveloperLightning(self.current_way, self.current_way.target4, self.current_way.b_aiflags & AI_TELELINK_4);
+ }
+ if (self.b_aiflags & AI_HOLD_SELECT)
+ return;
+ }
+
+ t = FindWayPoint(self.current_way);
+ if (t)
+ {
+ dist = vlen(self.origin - t.origin);
+ if (dist < 192)
+ {
+ if (dist < 64)
+ {
+
+ if (t != self.current_way)
+ {
+ if (dynlink)
+ {
+ if (!self.dyn_flags)
+ {
+ if (wisible(t, self.current_way))
+ LinkWays(t, self.current_way);
+ }
+ if (self.dyn_flags == 2)
+ TeleLinkWays(self.current_way, t);
+ else if (wisible(t, self.current_way))
+ LinkWays(self.current_way, t);
+ }
+ if (editor)
+ {
+ setmodel(t, "progs/s_light.spr");
+ if (self.current_way)
+ setmodel(self.current_way, "progs/s_bubble.spr");
+ }
+ }
+ self.current_way = t;
+ self.dyn_flags = 0;
+ }
+ self.dyn_dest = self.origin + self.view_ofs;
+ return;
+ }
+ }
+
+ if (frik_recognize_plat(FALSE))
+ {
+ if (vlen(trace_ent.velocity) > 0)
+ {
+ if (self.dyn_plat)
+ return;
+ self.dyn_plat = TRUE;
+ if (!self.dyn_flags)
+ self.dyn_flags = 1;
+ //bprint("on a plat!!!!!\n");
+ }
+ else
+ self.dyn_plat = FALSE;
+ }
+ else
+ self.dyn_plat = FALSE;
+
+ if (self.dyn_flags == 2)
+ self.dyn_dest = self.origin + self.view_ofs;
+ else if (self.dyn_dest == '0 0 0')
+ self.dyn_dest = self.origin + self.view_ofs;
+ if (!dynpoint)
+ return;
+ t = make_waypoint(self.dyn_dest);
+
+ if (!self.dyn_flags)
+ {
+ if (wisible(t, self.current_way))
+ LinkWays(t, self.current_way);
+ }
+ if (self.dyn_flags == 2)
+ TeleLinkWays(self.current_way, t);
+ else if (wisible(t, self.current_way))
+ LinkWays(self.current_way, t);
+
+ if (editor)
+ {
+ setmodel(t, "progs/s_light.spr");
+ if (self.current_way)
+ setmodel(self.current_way, "progs/s_bubble.spr");
+ }
+ self.current_way = t;
+ self.dyn_flags = 0;
+
+ self.dyn_dest = self.origin + self.view_ofs;
+
+ if (frik_recognize_plat(FALSE))
+ {
+ if (trace_ent.classname == "door")
+ t.b_aiflags = t.b_aiflags | AI_DOORFLAG;
+ }
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Waypoint Loading from file
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() ClearAllWays =
+{
+
+ local entity t, n;
+ t = way_head;
+ while(t)
+ {
+ n = t._next;
+ remove(t);
+ t = n;
+ }
+ way_head = world;
+ way_foot = world;
+ waypoints = 0;
+};
+
+entity(float num) WaypointForNum =
+{
+ local entity t;
+ if (!num)
+ return world;
+
+ t = way_head;
+ while (t)
+ {
+ if (t.count == num)
+ return t;
+ t = t._next;
+ }
+ return world;
+};
+
+void() FixThisWaypoint =
+{
+ self.enemy.target1 = WaypointForNum(self.enemy.b_pants);
+ self.enemy.target2 = WaypointForNum(self.enemy.b_skill);
+ self.enemy.target3 = WaypointForNum(self.enemy.b_shirt);
+ self.enemy.target4 = WaypointForNum(self.enemy.b_frags);
+ self.enemy = self.enemy._next;
+ self.nextthink = time;
+ if (self.enemy == world)
+ {
+ remove(self);
+ fixer = world;
+ }
+};
+
+void() FixWaypoints =
+{
+ if (!fixer)
+ fixer = spawn();
+ fixer.nextthink = time;
+ fixer.think = FixThisWaypoint;
+ fixer.enemy = way_head;
+};
+
+
+
+void(entity what) delete_waypoint =
+{
+ local entity t;
+
+ if (way_head == what)
+ way_head = what._next;
+ if (way_foot == what)
+ way_foot = what._last;
+ if (what._last)
+ what._last._next = what._next;
+ if (what._next)
+ what._next._last = what._last;
+ waypoints = 0;
+ t = way_head;
+ while(t)
+ {
+ t.count = waypoints = waypoints + 1;
+ if (CheckLinked(t, what))
+ UnlinkWays(t, what);
+ t = t._next;
+ }
+ if (self.current_way == what)
+ self.current_way = world;
+ remove(what);
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+FindRoute & FindThing used by the pathing code
+in bot_ai.qc
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+
+entity(string s) FindThing =
+{
+ local entity t;
+ local float tdst, dst;
+ local entity best;
+ dst = 100000;
+ best = world;
+ t = find (world, classname, s);
+ while (t != world)
+ {
+ tdst = vlen(((t.absmin + t.absmax) * 0.5) - self.origin);
+ if (tdst < dst)
+ {
+ dst = tdst;
+ best = t;
+ }
+ t = find(t, classname, s);
+ }
+ return best;
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+FindRoute, this is a key function in the
+pathing. The name is a bit misleading, this
+code finds the closest waypoint that is part
+of a route calculated by the begin_route and
+end_route routines This is a definite path to
+an object.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+entity(entity lastone) FindRoute =
+{
+ // kinda like FindWaypoint, only of this bots route though
+ local entity t, best;
+ local float dst, tdst, flag;
+ flag = ClientBitFlag(self.b_clientno);
+
+ if (lastone)
+ {
+ if (lastone.target1.b_sound & flag)
+ return lastone.target1;
+ else if (lastone.target2.b_sound & flag)
+ return lastone.target2;
+ else if (lastone.target3.b_sound & flag)
+ return lastone.target3;
+ else if (lastone.target4.b_sound & flag)
+ return lastone.target4;
+ }
+
+ t = way_head;
+ dst = 100000;
+ best = world;
+ while(t)
+ {
+ tdst = vlen(t.origin - self.origin);
+ if ((tdst < dst) && (t.b_sound & flag))
+ {
+ dst = tdst;
+ best = t;
+ }
+ t = t._next;
+ }
+ return best;
+};
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Route & path table management
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() ClearRouteTable =
+{
+ // cleans up route table
+
+ local entity t;
+ t = way_head;
+ while (t)
+ {
+ t. keys = FALSE;
+ t.enemy = world;
+ t.items = -1; // not in table
+ t = t._next;
+ }
+};
+
+void() ClearMyRoute =
+{
+ local float flag;
+ local entity t;
+
+ flag = ClientBitFlag(self.b_clientno);
+
+ t = way_head;
+ while (t)
+ {
+ t.b_sound = t.b_sound - (t.b_sound & flag);
+ t = t._next;
+ }
+};
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Mark_path
+
+After the route has been found, mark it with
+bitflags so the table can be used for a
+different bot.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+
+void(entity this) mark_path =
+{
+ local entity t, oself;
+ local float flag;
+
+ ClearMyRoute();
+
+ oself = self;
+ self = this;
+ t = FindWayPoint(this.current_way);
+ self = oself;
+ // FIXME
+ // ugh, better way to find players please!!!
+ if (this.classname != "player")
+ this.current_way = t;
+
+ if (t.enemy == world)
+ {
+ bot_lost(this, FALSE);
+ self.route_failed = TRUE;
+ return;
+ }
+
+ flag = ClientBitFlag(self.b_clientno);
+
+ while(t)
+ {
+ if (t.b_sound & flag)
+ return;
+ if (t == self.last_way)
+ return;
+ t.b_sound = t.b_sound | flag;
+ t = t.enemy;
+ }
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+WaypointThink
+
+Calculates the routes. We use thinks to avoid
+tripping the runaway loop counter
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void(entity e2, float b_bit) FollowLink =
+{
+ local float dist;
+
+ if (self.b_aiflags & b_bit)
+ dist = self.items;
+ else
+ dist = vlen(self.origin - e2.origin) + self.items;
+
+ // check if this is an RJ link
+ if (e2.b_aiflags & AI_SUPER_JUMP)
+ {
+ if (!bot_can_rj(route_table))
+ return;
+ }
+ if (e2.b_aiflags & AI_DIFFICULT)
+ dist = dist + 1000;
+
+ if ((dist < e2.items) || (e2.items == -1))
+ {
+ if (!e2.keys)
+ busy_waypoints = busy_waypoints + 1;
+ e2.keys = TRUE;
+ e2.items = dist;
+ e2.think = WaypointThink;
+ e2.nextthink = time;
+ e2.enemy = self;
+ }
+};
+
+void() WaypointThink =
+{
+ local entity oself;
+
+ if (self.items == -1)
+ return;
+ // can you say ugly?
+ if (self.b_aiflags & AI_TRACE_TEST)
+ {
+ if (self.target1)
+ {
+ traceline(self.origin, self.target1.origin, TRUE, self);
+ if (trace_fraction == 1)
+ FollowLink(self.target1, AI_TELELINK_1);
+ }
+ if (self.target2)
+ {
+ traceline(self.origin, self.target2.origin, TRUE, self);
+ if (trace_fraction == 1)
+ FollowLink(self.target2, AI_TELELINK_2);
+ }
+ if (self.target3)
+ {
+ traceline(self.origin, self.target3.origin, TRUE, self);
+ if (trace_fraction == 1)
+ FollowLink(self.target3, AI_TELELINK_3);
+ }
+ if (self.target4)
+ {
+ traceline(self.origin, self.target4.origin, TRUE, self);
+ if (trace_fraction == 1)
+ FollowLink(self.target4, AI_TELELINK_4);
+ }
+ }
+ else
+ {
+ if (self.target1)
+ FollowLink(self.target1, AI_TELELINK_1);
+ if (self.target2)
+ FollowLink(self.target2, AI_TELELINK_2);
+ if (self.target3)
+ FollowLink(self.target3, AI_TELELINK_3);
+ if (self.target4)
+ FollowLink(self.target4, AI_TELELINK_4);
+ }
+
+ busy_waypoints = busy_waypoints - 1;
+ self.keys = FALSE;
+
+ if (busy_waypoints <= 0)
+ {
+ if (direct_route)
+ {
+ oself = self;
+ self = route_table;
+ bot_get_path(self.target1, FALSE);
+ self = oself;
+ direct_route = FALSE;
+ }
+ }
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+begin_route and bot_get_path
+
+PLEASE NOTE: bot_get_path replaces the old
+calls to begin_route.
+
+Routing isn't done all at once now, but in two
+stages, the bot will calc a route *THEN*
+choose a target, *THEN* mark a path.
+
+Boy it's confusing.
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+float() begin_route =
+{
+ if (busy_waypoints > 0)
+ return FALSE;
+
+ if (route_table != world)
+ {
+ if (!route_table.ishuman)
+ {
+ if (route_table.b_clientno != -1)
+ return FALSE;
+ }
+ }
+
+ route_table = self;
+ ClearRouteTable();
+ self.last_way = FindWayPoint(self.current_way);
+
+ if (self.last_way != world)
+ {
+ self.last_way.items = vlen(self.last_way.origin - self.origin);
+ self.last_way.nextthink = time;
+ self.last_way.think = WaypointThink;
+ self.last_way.keys = TRUE;
+ busy_waypoints = 1;
+ return TRUE;
+ }
+ else
+ {
+ route_table = world;
+ busy_waypoints = 0;
+ return FALSE;
+ }
+};
+
+void(entity this, float direct) bot_get_path =
+{
+ if (this == world)
+ return;
+
+ if (route_table == self)
+ {
+ if (busy_waypoints <= 0)
+ {
+ route_table = world;
+ mark_path(this);
+ }
+ return;
+ }
+ if (direct)
+ {
+ if(begin_route())
+ direct_route = TRUE;
+ else
+ bot_lost(this, FALSE);
+ return;
+ }
+};
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+BSP/QC Waypoint loading
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void() waypoint =
+{
+ self.solid = SOLID_TRIGGER;
+ self.movetype = MOVETYPE_NONE;
+ setorigin(self, self.origin);
+
+ setsize(self, VEC_HULL_MIN, VEC_HULL_MAX);
+ waypoints = waypoints + 1;
+ if (!way_head)
+ {
+ way_head = self;
+ way_foot = self;
+ }
+ else
+ {
+ way_foot._next = self;
+ self._last = way_foot;
+ way_foot = self;
+ }
+
+ self.count = waypoints;
+ waypoint_mode = WM_LOADED;
+ if (self.count == 1)
+ {
+ localcmd("echo BSP waypoints detected\n");
+ self.think = FixWaypoints; // wait until all bsp loaded points are spawned
+ self.nextthink = time;
+ }
+};
+
+void(vector org, vector bit1, float bit4, float flargs) make_way =
+{
+ local entity y;
+ waypoint_mode = WM_LOADED;
+ y = make_waypoint(org);
+ y.b_aiflags = flargs;
+ y.b_pants = bit1_x;
+ y.b_skill = bit1_y;
+ y.b_shirt = bit1_z;
+ y.b_frags = bit4;
+ if (y.count == 1)
+ {
+ localcmd("echo QuakeC waypoints detected\n");
+ y.think = FixWaypoints; // wait until all qc loaded points are spawned
+ y.nextthink = time;
+ }
+};
+
+
+/*
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+Temporary Marker code
+
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+*/
+
+void(vector org) SpawnTempWaypoint =
+{
+ local entity tep;
+
+ if (!self.temp_way)
+ self.temp_way = tep = spawn();
+ else
+ tep = self.temp_way;
+
+ tep.classname = "temp_waypoint";
+ tep.solid = SOLID_TRIGGER;
+ tep.movetype = MOVETYPE_NOCLIP;
+ setorigin(tep, org);
+ target_add(tep);
+ setsize(tep, VEC_HULL_MIN, VEC_HULL_MAX); // FIXME: convert these to numerical
+};
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/fteqccgui.exe b/r17/Revamped src/Revamped QC/fteqccgui.exe
new file mode 100755
index 00000000..03ae0933
Binary files /dev/null and b/r17/Revamped src/Revamped QC/fteqccgui.exe differ
diff --git a/r17/Revamped src/Revamped QC/items.qc b/r17/Revamped src/Revamped QC/items.qc
new file mode 100755
index 00000000..989313ee
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/items.qc
@@ -0,0 +1,1503 @@
+/* ALL LIGHTS SHOULD BE 0 1 0 IN COLOR ALL OTHER ITEMS SHOULD
+BE .8 .3 .4 IN COLOR */
+void () W_SetCurrentAmmo;
+void (float weap) W_WeaponSwitch;
+void (entity ent) W_UpdateAmmoCounts;
+
+void() SUB_regen =
+{
+ self.model = self.mdl; // restore original model
+ self.solid = SOLID_TRIGGER; // allow it to be touched again
+ sound (self, CHAN_VOICE, "items/itembk2.wav", 1, ATTN_NORM); // play respawn sound
+ setorigin (self, self.origin);
+};
+
+
+
+/*QUAKED noclass (0 0 0) (-8 -8 -8) (8 8 8)
+prints a warning message when spawned
+*/
+void() noclass =
+{
+ dprint ("noclass spawned at");
+ dprint (vtos(self.origin));
+ dprint ("\n");
+ remove (self);
+};
+
+// names of weapons function
+string(float weap) I_WeaponName =
+{
+ switch (weap)
+ {
+ case IT_AXE:
+ return "Axe";
+ case IT_SHOTGUN:
+ return "Shotgun";
+ case IT_SUPER_SHOTGUN:
+ return "Double-barrelled Shotgun";
+ case IT_NAILGUN:
+ return "Nailgun";
+ case IT_SUPER_NAILGUN:
+ return "Super Nailgun";
+ case IT_GRENADE_LAUNCHER:
+ return "Grenade Launcher";
+ case IT_ROCKET_LAUNCHER:
+ return "Rocket Launcher";
+ case IT_LIGHTNING:
+ return "Thunderbolt";
+ }
+
+ return "";
+}
+
+
+
+void() q_touch;
+
+void() q_touch =
+{
+ local string s, t;
+
+ if (other.classname != "player")
+ return;
+ if (other.health <= 0)
+ return;
+
+ self.mdl = self.model;
+
+ sound (other, CHAN_VOICE, self.noise, 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+ self.solid = SOLID_NOT;
+ other.items = other.items | IT_QUAD;
+ self.model = string_null;
+ if (deathmatch == 4)
+ {
+ other.armortype = 0;
+ other.armorvalue = 0;
+ other.ammo_cells_real = 0;
+ W_UpdateAmmoCounts(other);
+ }
+
+// do the apropriate action
+ other.super_time = 1;
+ other.super_damage_finished = self.cnt;
+
+ s=ftos(rint(other.super_damage_finished - time));
+ t = " recovered a Quad with ";
+ if (deathmatch == 4)
+ t = " recovered an OctaPower with ";
+
+ bprint4 (PRINT_LOW, other.netname, t, s, " seconds remaining!\n");
+
+ activator = other;
+ SUB_UseTargets(); // fire all targets / killtargets
+};
+
+
+void(float timeleft) DropQuad =
+{
+ local entity item;
+
+ item = spawn();
+ item.origin = self.origin;
+
+ item.velocity_z = 300;
+ item.velocity_x = -100 + (random() * 200);
+ item.velocity_y = -100 + (random() * 200);
+
+ item.flags = FL_ITEM;
+ item.solid = SOLID_TRIGGER;
+ item.movetype = MOVETYPE_TOSS;
+ item.noise = "items/damage.wav";
+ setmodel (item, "progs/quaddama.mdl");
+ setsize (item, '-16 -16 -24', '16 16 32');
+ item.cnt = time + timeleft;
+ item.touch = q_touch;
+ item.nextthink = time + timeleft; // remove it with the time left on it
+ item.think = SUB_Remove;
+};
+
+
+void() r_touch;
+
+void() r_touch =
+{
+local string s;
+
+ if (other.classname != "player")
+ return;
+ if (other.health <= 0)
+ return;
+
+ self.mdl = self.model;
+
+ sound (other, CHAN_VOICE, self.noise, 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+ self.solid = SOLID_NOT;
+ other.items = other.items | IT_INVISIBILITY;
+ self.model = string_null;
+
+// do the apropriate action
+ other.invisible_time = 1;
+ other.invisible_finished = self.cnt;
+ s=ftos(rint(other.invisible_finished - time));
+ bprint4 (PRINT_LOW, other.netname, " recovered a Ring with ", s, " seconds remaining!\n");
+
+
+ activator = other;
+ SUB_UseTargets(); // fire all targets / killtargets
+};
+
+
+void(float timeleft) DropRing =
+{
+ local entity item;
+
+ item = spawn();
+ item.origin = self.origin;
+
+ item.velocity_z = 300;
+ item.velocity_x = -100 + (random() * 200);
+ item.velocity_y = -100 + (random() * 200);
+
+ item.flags = FL_ITEM;
+ item.solid = SOLID_TRIGGER;
+ item.movetype = MOVETYPE_TOSS;
+ item.noise = "items/inv1.wav";
+ setmodel (item, "progs/invisibl.mdl");
+ setsize (item, '-16 -16 -24', '16 16 32');
+ item.cnt = time + timeleft;
+ item.touch = r_touch;
+ item.nextthink = time + timeleft; // remove after 30 seconds
+ item.think = SUB_Remove;
+};
+
+/*
+============
+PlaceItem
+
+plants the object on the floor
+============
+*/
+void() PlaceItem =
+{
+ local float oldz;
+
+ self.mdl = self.model; // so it can be restored on respawn
+ self.flags = FL_ITEM; // make extra wide
+ self.solid = SOLID_TRIGGER;
+ self.movetype = MOVETYPE_TOSS;
+ self.velocity = '0 0 0';
+ self.origin_z = self.origin_z + 6;
+ oldz = self.origin_z;
+ if (!droptofloor())
+ {
+ dprint ("Bonus item fell out of level at ");
+ dprint (vtos(self.origin));
+ dprint ("\n");
+ remove(self);
+ return;
+ }
+};
+
+/*
+============
+StartItem
+
+Sets the clipping size and plants the object on the floor
+============
+*/
+void() StartItem =
+{
+ self.nextthink = time + 0.2; // items start after other solids
+ self.think = PlaceItem;
+};
+
+/*
+=========================================================================
+
+HEALTH BOX
+
+=========================================================================
+*/
+//
+// T_Heal: add health to an entity, limiting health to max_health
+// "ignore" will ignore max_health limit
+//
+float (entity e, float hamount, float ignore) T_Heal =
+{
+ if (e.health <= 0)
+ return 0;
+ if ((!ignore) && (e.health >= other.max_health))
+ return 0;
+ hamount = ceil(hamount);
+
+ e.health = e.health + hamount;
+ if ((!ignore) && (e.health >= other.max_health))
+ e.health = other.max_health;
+
+
+ if (e.health > e.max_health + 150)
+ e.health = e.max_health + 150;
+
+ e.healdecay = time + 5;
+ return 1;
+};
+
+/*QUAKED item_health (.3 .3 1) (0 0 0) (32 32 32) rotten megahealth
+Health box. Normally gives 25 points.
+Rotten box heals 5-10 points,
+megahealth will add 100 health, then
+rot you down to your maximum health limit,
+one point per second.
+*/
+
+void() health_touch;
+
+void() item_health =
+{
+ self.touch = health_touch;
+
+ if (self.spawnflags & H_ROTTEN)
+ {
+ precache_model("progs/health.mdl");
+
+ precache_sound("items/r_item1.wav");
+ setmodel(self, "progs/health.mdl");
+ self.noise = "items/r_item1.wav";
+ self.healamount = 15;
+ self.healtype = 0;
+ }
+ else
+ if (self.spawnflags & H_MEGA)
+ {
+ precache_model("progs/health.mdl");
+ precache_sound("items/r_item2.wav");
+ setmodel(self, "progs/health.mdl");
+ self.noise = "items/r_item2.wav";
+ self.healamount = 100;
+ self.healtype = 2;
+ }
+ else
+ {
+ precache_model("progs/health.mdl");
+ precache_sound("items/health1.wav");
+ setmodel(self, "progs/health.mdl");
+ self.noise = "items/health1.wav";
+ self.healamount = 25;
+ self.healtype = 1;
+ }
+ setsize (self, '0 0 0', '32 32 56');
+ StartItem ();
+};
+
+
+void() health_touch =
+{
+ local string s;
+
+ if (deathmatch == 4)
+ if (other.invincible_time > time)
+ return;
+
+ if (other.classname != "player")
+ return;
+
+ if (self.healtype == H_MEGA) // Megahealth? Ignore max_health...
+ {
+ if (other.health >= other.max_health + 150)
+ return;
+ if (!T_Heal(other, self.healamount, 1))
+ return;
+ }
+ else
+ {
+ if (!T_Heal(other, self.healamount, 0))
+ return;
+ }
+
+ s = ftos(self.healamount);
+ sprint3(other, PRINT_LOW, "You receive ", s, " health\n");
+
+// health touch sound
+ sound(other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
+
+ stuffcmd (other, "bf\n");
+
+ self.model = string_null;
+ self.solid = SOLID_NOT;
+
+ // Megahealth = rot down the player's super health
+ if (deathmatch) // TODO: are these rules right?
+ {
+ if (deathmatch != 2) // deathmatch 2 is the silly old rules
+ {
+ if (self.healtype == H_MEGA)
+ self.nextthink = time + 45; // should I account for health healed instead?
+ else
+ self.nextthink = time + 20;
+ self.think = SUB_regen;
+ }
+ }
+
+ activator = other;
+ SUB_UseTargets(); // fire all targets / killtargets
+};
+
+/*
+===============================================================================
+
+ARMOR
+
+===============================================================================
+*/
+
+void() armor_touch;
+
+void() armor_touch =
+{
+ local float type, value, bit;
+
+ if (other.health <= 0)
+ return;
+ if (other.classname != "player")
+ return;
+
+ if (deathmatch == 4)
+
+ if (other.invincible_time > 0)
+ return;
+
+ switch (self.classname)
+ {
+ case "item_armor1":
+ type = 0.3;
+ value = 100;
+ bit = IT_ARMOR1;
+ break;
+ case "item_armor2":
+ type = 0.6;
+ value = 150;
+ bit = IT_ARMOR2;
+ break;
+ case "item_armorInv":
+ type = 0.8;
+ value = 200;
+ bit = IT_ARMOR3;
+ break;
+ }
+
+ if (other.armortype*other.armorvalue >= type*value)
+ return;
+
+ other.armortype = type;
+ other.armorvalue = value;
+ other.items = other.items - (other.items & (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)) + bit;
+
+ self.solid = SOLID_NOT;
+ self.model = string_null;
+ if (deathmatch && deathmatch != 2)
+ {
+ self.nextthink = time + 20;
+ self.think = SUB_regen;
+ }
+
+ sprint1(other, PRINT_LOW, "You got armor\n");
+// armor touch sound
+ sound(other, CHAN_ITEM, "items/armor1.wav", 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+
+ activator = other;
+ SUB_UseTargets(); // fire all targets / killtargets
+};
+
+
+/*QUAKED item_armor1 (0 .5 .8) (-16 -16 0) (16 16 32)
+*/
+
+void() item_armor1 =
+{
+ self.touch = armor_touch;
+ precache_model ("progs/armor.mdl");
+ setmodel (self, "progs/armor.mdl");
+ self.skin = 0;
+ setsize (self, '-16 -16 0', '16 16 56');
+ StartItem ();
+};
+
+/*QUAKED item_armor2 (0 .5 .8) (-16 -16 0) (16 16 32)
+*/
+
+void() item_armor2 =
+{
+ self.touch = armor_touch;
+ precache_model ("progs/armor.mdl");
+ setmodel (self, "progs/armor.mdl");
+ self.skin = 1;
+ setsize (self, '-16 -16 0', '16 16 56');
+ StartItem ();
+};
+
+/*QUAKED item_armorInv (0 .5 .8) (-16 -16 0) (16 16 32)
+*/
+
+void() item_armorInv =
+{
+ self.touch = armor_touch;
+ precache_model ("progs/armor.mdl");
+ setmodel (self, "progs/armor.mdl");
+ self.skin = 2;
+ setsize (self, '-16 -16 0', '16 16 56');
+ StartItem ();
+};
+
+/*
+===============================================================================
+
+WEAPONS
+
+===============================================================================
+*/
+
+void() bound_other_ammo =
+{
+ if (other.ammo_shells_real > 100)
+ other.ammo_shells_real = 100;
+ if (other.ammo_nails_real > 200)
+ other.ammo_nails_real = 200;
+ if (other.ammo_rockets_real > 100)
+ other.ammo_rockets_real = 100;
+ if (other.ammo_cells_real > 100)
+ other.ammo_cells_real = 100;
+
+ if ((other.exshells > 100))
+ {
+ other.exshells = 100;
+ }
+ if ((other.exnails > 200))
+ {
+ other.exnails = 200;
+ }
+ if ((other.exrockets > 100))
+ {
+ other.exrockets = 100;
+ }
+ if ((other.excells > 100))
+ {
+ other.excells = 100;
+ }
+};
+
+
+float(float w) RankForWeapon =
+{
+ if (w == IT_LIGHTNING)
+ return 1;
+ if (w == IT_ROCKET_LAUNCHER)
+ return 2;
+ if (w == IT_SUPER_NAILGUN)
+ return 3;
+ if (w == IT_GRENADE_LAUNCHER)
+ return 4;
+ if (w == IT_SUPER_SHOTGUN)
+ return 5;
+ if (w == IT_NAILGUN)
+ return 6;
+ return 7;
+};
+
+float (float w) WeaponCode =
+{
+ if (w == IT_SUPER_SHOTGUN)
+ return 3;
+ if (w == IT_NAILGUN)
+ return 4;
+ if (w == IT_SUPER_NAILGUN)
+ return 5;
+ if (w == IT_GRENADE_LAUNCHER)
+ return 6;
+ if (w == IT_ROCKET_LAUNCHER)
+ return 7;
+ if (w == IT_LIGHTNING)
+ return 8;
+ return 1;
+};
+
+/*
+=============
+Deathmatch_Weapon
+
+Deathmatch weapon change rules for picking up a weapon
+
+.float ammo_shells, ammo_nails, ammo_rockets, ammo_cells;
+=============
+*/
+void(float old, float new) Deathmatch_Weapon =
+{
+ local float or, nr;
+
+// change self.weapon if desired
+ or = RankForWeapon (self.weapon);
+ nr = RankForWeapon (new);
+
+ if ( nr == IT_LIGHTNING && self.waterlevel > 1 )
+ return;
+
+ if ( nr < or )
+ W_WeaponSwitch (new);
+};
+
+/*
+=============
+weapon_touch
+=============
+*/
+float() W_BestWeapon;
+void() weapon_touch; // sol_items.qc
+
+
+
+
+/*
+===============================================================================
+
+AMMO
+
+===============================================================================
+*/
+
+void () ammo_touch =
+{
+ local entity stemp;
+ local float best;
+
+ if ((other.classname != "player"))
+ {
+ return;
+ }
+ if ((other.health <= MSG_BROADCAST))
+ {
+ return;
+ }
+ stemp = self;
+ self = other;
+ best = W_BestWeapon ();
+ self = stemp;
+ if ((self.weapon == H_ROTTEN))
+ {
+ if ((other.exshells >= 100))
+ {
+ return;
+ }
+ other.exshells = (other.exshells + self.aflag);
+ }
+ if ((self.weapon == H_MEGA))
+ {
+ if ((other.exnails >= 200))
+ {
+ return;
+ }
+ other.exnails = (other.exnails + self.aflag);
+ }
+ if ((self.weapon == AS_MELEE))
+ {
+ if ((other.exrockets >= 100))
+ {
+ return;
+ }
+ other.exrockets = (other.exrockets + self.aflag);
+ }
+ if ((self.weapon == AS_MISSILE))
+ {
+ if ((other.excells >= 100))
+ {
+ return;
+ }
+ other.excells = (other.excells + self.aflag);
+ }
+ bound_other_ammo ();
+ sprint (other, "You got the ");
+ sprint (other, self.netname);
+ sprint (other, "\n");
+ sound (other, CHAN_ITEM, "weapons/lock4.wav", H_ROTTEN, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+ stemp = self;
+ self = other;
+ self = stemp;
+ self.model = string_null;
+ self.solid = SOLID_NOT;
+ if ((deathmatch == H_ROTTEN))
+ {
+ self.nextthink = (time + SVC_INTERMISSION);
+ }
+ self.think = SUB_regen;
+ activator = other;
+ SUB_UseTargets ();
+};
+/*
+void() ammo_touch =
+{
+local entity stemp;
+local float best;
+
+ if (other.classname != "player")
+ return;
+ if (other.health <= 0)
+ return;
+
+// if the player was using his best weapon, change up to the new one if better
+ stemp = self;
+ self = other;
+ best = W_BestWeapon();
+ self = stemp;
+
+
+ switch (self.weapon)
+ {
+ case 1: // shotgun
+ if (other.ammo_shells_real >= 100)
+ return;
+ other.ammo_shells_real = other.ammo_shells_real + self.ammo_count;
+ break;
+ case 2: // spikes
+ if (other.ammo_nails_real >= 200)
+ return;
+ other.ammo_nails_real = other.ammo_nails_real + self.ammo_count;
+ break;
+ case 3: // rockets
+ if (other.ammo_rockets_real >= 100)
+ return;
+ other.ammo_rockets_real = other.ammo_rockets_real + self.ammo_count;
+ break;
+ case 4: // cells
+ if (other.ammo_cells_real >= 100)
+ return;
+ other.ammo_cells_real = other.ammo_cells_real + self.ammo_count;
+ break;
+ }
+
+ bound_other_ammo ();
+
+ sprint3 (other, PRINT_LOW, "You got the ", self.netname, "\n");
+// ammo touch sound
+ sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+
+// change to a better weapon if appropriate
+
+ stemp = self;
+ self = other;
+
+ if ( self.weapon == best )
+ W_WeaponSwitch (W_BestWeapon ());
+ else
+ W_UpdateAmmoCounts (self);
+
+ self = stemp;
+
+// remove it in single player, or setup for respawning in deathmatch
+ self.model = string_null;
+ self.solid = SOLID_NOT;
+ if (deathmatch)
+ {
+ if (deathmatch != 2)
+ self.nextthink = time + 30;
+
+ // Xian -- If playing in DM 3.0 mode, halve the time ammo respawns
+ if (deathmatch == 3 || deathmatch == 5)
+ self.nextthink = time + 15;
+
+ self.think = SUB_regen;
+ }
+
+ activator = other;
+ SUB_UseTargets(); // fire all targets / killtargets
+};
+*/
+
+
+
+float WEAPON_BIG2 = 1;
+
+void () item_shells =
+{
+ self.touch = ammo_touch;
+ if ((self.spawnflags & WEAPON_BIG2))
+ {
+ precache_model ("maps/b_shell1.bsp");
+ setmodel (self, "maps/b_shell1.bsp");
+ self.aflag = 40;
+ }
+ else
+ {
+ precache_model ("maps/b_shell0.bsp");
+ setmodel (self, "maps/b_shell0.bsp");
+ self.aflag = 20;
+ }
+ self.weapon = WEAPON_BIG2;
+ self.netname = "shells";
+ setsize (self, VEC_ORIGIN, '32 32 56');
+ StartItem ();
+};
+
+void () item_spikes =
+{
+ self.touch = ammo_touch;
+ if ((self.spawnflags & WEAPON_BIG2))
+ {
+ precache_model ("maps/b_nail1.bsp");
+ setmodel (self, "maps/b_nail1.bsp");
+ self.aflag = 50;
+ }
+ else
+ {
+ precache_model ("maps/b_nail0.bsp");
+ setmodel (self, "maps/b_nail0.bsp");
+ self.aflag = 25;
+ }
+ self.weapon = H_MEGA;
+ self.netname = "nails";
+ setsize (self, VEC_ORIGIN, '32 32 56');
+ StartItem ();
+};
+
+void () item_rockets =
+{
+ self.touch = ammo_touch;
+ if ((self.spawnflags & WEAPON_BIG2))
+ {
+ precache_model ("maps/b_rock1.bsp");
+ setmodel (self, "maps/b_rock1.bsp");
+ self.aflag = TE_LAVASPLASH;
+ }
+ else
+ {
+ precache_model ("maps/b_rock0.bsp");
+ setmodel (self, "maps/b_rock0.bsp");
+ self.aflag = TE_LIGHTNING1;
+ }
+ self.weapon = AS_MELEE;
+ self.netname = "rockets";
+ setsize (self, VEC_ORIGIN, '32 32 56');
+ StartItem ();
+};
+
+void () item_cells =
+{
+ self.touch = ammo_touch;
+ if ((self.spawnflags & WEAPON_BIG2))
+ {
+ precache_model ("maps/b_batt1.bsp");
+ setmodel (self, "maps/b_batt1.bsp");
+ self.aflag = 12;
+ }
+ else
+ {
+ precache_model ("maps/b_batt0.bsp");
+ setmodel (self, "maps/b_batt0.bsp");
+ self.aflag = TE_LIGHTNING2;
+ }
+ self.weapon = AS_MISSILE;
+ self.netname = "cells";
+ setsize (self, VEC_ORIGIN, '32 32 56');
+ StartItem ();
+};
+
+
+/*QUAKED item_weapon (0 .5 .8) (0 0 0) (32 32 32) shotgun rocket spikes big
+DO NOT USE THIS!!!! IT WILL BE REMOVED!
+*/
+
+#define WEAPON_SHOTGUN 1
+float WEAPON_ROCKET = 2;
+float WEAPON_SPIKES = 4;
+float WEAPON_MASK = 7;
+float WEAPON_BIG = 8;
+void () item_weapon =
+{
+ self.touch = ammo_touch;
+ if ((self.spawnflags & WEAPON_SHOTGUN))
+ {
+ if ((self.spawnflags & WEAPON_BIG))
+ {
+ precache_model ("maps/b_shell1.bsp");
+ setmodel (self, "maps/b_shell1.bsp");
+ self.aflag = 40;
+ }
+ else
+ {
+ precache_model ("maps/b_shell0.bsp");
+ setmodel (self, "maps/b_shell0.bsp");
+ self.aflag = 20;
+ }
+ self.weapon = WEAPON_SHOTGUN;
+ self.netname = "shells";
+ }
+ if ((self.spawnflags & WEAPON_SPIKES))
+ {
+ if ((self.spawnflags & WEAPON_BIG))
+ {
+ precache_model ("maps/b_nail1.bsp");
+ setmodel (self, "maps/b_nail1.bsp");
+ self.aflag = 40;
+ }
+ else
+ {
+ precache_model ("maps/b_nail0.bsp");
+ setmodel (self, "maps/b_nail0.bsp");
+ self.aflag = 20;
+ }
+ self.weapon = WEAPON_ROCKET;
+ self.netname = "spikes";
+ }
+ if ((self.spawnflags & WEAPON_ROCKET))
+ {
+ if ((self.spawnflags & WEAPON_BIG))
+ {
+ precache_model ("maps/b_rock1.bsp");
+ setmodel (self, "maps/b_rock1.bsp");
+ self.aflag = TE_LAVASPLASH;
+ }
+ else
+ {
+ precache_model ("maps/b_rock0.bsp");
+ setmodel (self, "maps/b_rock0.bsp");
+ self.aflag = TE_LIGHTNING1;
+ }
+ self.weapon = AS_MELEE;
+ self.netname = "rockets";
+ }
+ setsize (self, VEC_ORIGIN, '32 32 56');
+ StartItem ();
+};
+
+
+/*
+===============================================================================
+
+KEYS
+
+===============================================================================
+*/
+
+void() key_touch =
+{
+ if (other.classname != "player")
+ return;
+ if (other.health <= 0)
+ return;
+ if (other.items & self.items)
+ return;
+
+ sprint3 (other, PRINT_LOW, "You got the ", self.netname, "\n");
+
+ sound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+ other.items = other.items | self.items;
+
+ self.solid = SOLID_NOT;
+ self.model = string_null;
+
+ activator = other;
+ SUB_UseTargets(); // fire all targets / killtargets
+};
+
+
+void() key_setsounds =
+{
+ switch (world.worldtype)
+ {
+ case WT_MEDIEVAL:
+ precache_sound ("misc/medkey.wav");
+ self.noise = "misc/medkey.wav";
+ break;
+ case WT_METAL:
+ precache_sound ("misc/runekey.wav");
+ self.noise = "misc/runekey.wav";
+ break;
+ case WT_BASE:
+ precache_sound2 ("misc/basekey.wav");
+ self.noise = "misc/basekey.wav";
+ break;
+ }
+};
+
+/*QUAKED item_key1 (0 .5 .8) (-16 -16 -24) (16 16 32)
+SILVER key
+In order for keys to work
+you MUST set your maps
+worldtype to one of the
+following:
+0: medieval
+1: metal
+2: base
+*/
+
+void() item_key1 =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+
+ switch (world.worldtype)
+ {
+ case WT_MEDIEVAL:
+ precache_model ("progs/w_s_key.mdl");
+ setmodel (self, "progs/w_s_key.mdl");
+ self.netname = "silver key";
+ break;
+ case WT_METAL:
+ precache_model ("progs/m_s_key.mdl");
+ setmodel (self, "progs/m_s_key.mdl");
+ self.netname = "silver runekey";
+ break;
+ case WT_BASE:
+ precache_model2 ("progs/b_s_key.mdl");
+ setmodel (self, "progs/b_s_key.mdl");
+ self.netname = "silver keycard";
+ break;
+ }
+
+ key_setsounds();
+ self.touch = key_touch;
+ self.items = IT_KEY1;
+ setsize (self, '-16 -16 -24', '16 16 32');
+ StartItem ();
+};
+
+/*QUAKED item_key2 (0 .5 .8) (-16 -16 -24) (16 16 32)
+GOLD key
+In order for keys to work
+you MUST set your maps
+worldtype to one of the
+following:
+0: medieval
+1: metal
+2: base
+*/
+
+void() item_key2 =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+
+ switch (world.worldtype)
+ {
+ case WT_MEDIEVAL:
+ precache_model ("progs/w_g_key.mdl");
+ setmodel (self, "progs/w_g_key.mdl");
+ self.netname = "gold key";
+ break;
+ case WT_METAL:
+ precache_model ("progs/m_g_key.mdl");
+ setmodel (self, "progs/m_g_key.mdl");
+ self.netname = "gold runekey";
+ break;
+ case WT_BASE:
+ precache_model2 ("progs/b_g_key.mdl");
+ setmodel (self, "progs/b_g_key.mdl");
+ self.netname = "gold keycard";
+ break;
+ }
+ key_setsounds();
+ self.touch = key_touch;
+ self.items = IT_KEY2;
+ setsize (self, '-16 -16 -24', '16 16 32');
+ StartItem ();
+};
+
+
+
+/*
+===============================================================================
+
+END OF LEVEL RUNES
+
+===============================================================================
+*/
+
+void() sigil_touch =
+{
+ if (other.classname != "player")
+ return;
+ if (other.health <= 0)
+ return;
+
+ centerprint (other, "You got the rune!");
+
+ sound (other, CHAN_ITEM, self.noise, 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+ self.solid = SOLID_NOT;
+ self.model = string_null;
+ serverflags = serverflags | (self.spawnflags & 15);
+ self.classname = ""; // so rune doors won't find it
+
+ activator = other;
+ SUB_UseTargets(); // fire all targets / killtargets
+};
+
+
+/*QUAKED item_sigil (0 .5 .8) (-16 -16 -24) (16 16 32) E1 E2 E3 E4
+End of level sigil, pick up to end episode and return to jrstart.
+*/
+
+void() item_sigil =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+
+ if (!self.spawnflags)
+ objerror ("no spawnflags");
+
+ precache_sound ("misc/runekey.wav");
+ self.noise = "misc/runekey.wav";
+
+ switch (self.spawnflags & 15)
+ {
+ case 1:
+ precache_model ("progs/end1.mdl");
+ setmodel (self, "progs/end1.mdl");
+ break;
+ case 2:
+ precache_model2 ("progs/end2.mdl");
+ setmodel (self, "progs/end2.mdl");
+ break;
+ case 4:
+ precache_model2 ("progs/end3.mdl");
+ setmodel (self, "progs/end3.mdl");
+ break;
+ case 8:
+ precache_model2 ("progs/end4.mdl");
+ setmodel (self, "progs/end4.mdl");
+ break;
+ }
+
+ self.touch = sigil_touch;
+ setsize (self, '-16 -16 -24', '16 16 32');
+ StartItem ();
+};
+
+/*
+===============================================================================
+
+POWERUPS
+
+===============================================================================
+*/
+
+void() powerup_touch =
+{
+ if (other.classname != "player")
+ return;
+ if (other.health <= 0)
+ return;
+
+ sprint3 (other, PRINT_LOW, "You got the ", self.netname, "\n");
+
+ self.mdl = self.model;
+
+ if (deathmatch)
+ {
+ if (self.items & (IT_INVULNERABILITY | IT_INVISIBILITY))
+ self.nextthink = time + 60*5;
+ else
+ self.nextthink = time + 60;
+
+ self.think = SUB_regen;
+ }
+
+ sound (other, CHAN_VOICE, self.noise, 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+ self.solid = SOLID_NOT;
+ other.items = other.items | self.items;
+ self.model = string_null;
+
+// do the apropriate action
+ switch (self.items)
+ {
+ case IT_SUIT:
+ other.rad_time = 1;
+ other.radsuit_finished = time + 30;
+ break;
+ case IT_INVULNERABILITY:
+ other.invincible_time = 1;
+ other.invincible_finished = time + 30;
+ break;
+ case IT_INVISIBILITY:
+ other.invisible_time = 1;
+ other.invisible_finished = time + 30;
+ break;
+ case IT_QUAD:
+ if (deathmatch == 4)
+ {
+ other.armortype = 0;
+ other.armorvalue = 0;
+ other.ammo_cells_real = 0;
+ W_UpdateAmmoCounts(other);
+ }
+ other.super_time = 1;
+ other.super_damage_finished = time + 30;
+ break;
+ }
+
+ activator = other;
+ SUB_UseTargets(); // fire all targets / killtargets
+};
+
+
+
+/*QUAKED item_artifact_invulnerability (0 .5 .8) (-16 -16 -24) (16 16 32)
+Player is invulnerable for 30 seconds
+*/
+void() item_artifact_invulnerability =
+{
+ self.touch = powerup_touch;
+
+ precache_model ("progs/invulner.mdl");
+ precache_sound ("items/protect.wav");
+ precache_sound ("items/protect2.wav");
+ precache_sound ("items/protect3.wav");
+ self.noise = "items/protect.wav";
+ setmodel (self, "progs/invulner.mdl");
+ self.netname = "Pentagram of Protection";
+ self.effects = self.effects | ef_red;
+ self.items = IT_INVULNERABILITY;
+ setsize (self, '-16 -16 -24', '16 16 32');
+ StartItem ();
+};
+
+/*QUAKED item_artifact_envirosuit (0 .5 .8) (-16 -16 -24) (16 16 32)
+Player takes no damage from water or slime for 30 seconds
+*/
+void() item_artifact_envirosuit =
+{
+ self.touch = powerup_touch;
+
+ precache_model ("progs/suit.mdl");
+ precache_sound ("items/suit.wav");
+ precache_sound ("items/suit2.wav");
+ self.noise = "items/suit.wav";
+ setmodel (self, "progs/suit.mdl");
+ self.netname = "Biosuit";
+ self.items = IT_SUIT;
+ setsize (self, '-16 -16 -24', '16 16 32');
+ StartItem ();
+};
+
+
+/*QUAKED item_artifact_invisibility (0 .5 .8) (-16 -16 -24) (16 16 32)
+Player is invisible for 30 seconds
+*/
+void() item_artifact_invisibility =
+{
+ self.touch = powerup_touch;
+
+ precache_model ("progs/invisibl.mdl");
+ precache_sound ("items/inv1.wav");
+ precache_sound ("items/inv2.wav");
+ precache_sound ("items/inv3.wav");
+ self.noise = "items/inv1.wav";
+ setmodel (self, "progs/invisibl.mdl");
+ self.netname = "Ring of Shadows";
+ self.items = IT_INVISIBILITY;
+ setsize (self, '-16 -16 -24', '16 16 32');
+ StartItem ();
+};
+
+
+/*QUAKED item_artifact_super_damage (0 .5 .8) (-16 -16 -24) (16 16 32)
+The next attack from the player will do 4x damage
+*/
+void() item_artifact_super_damage =
+{
+ self.touch = powerup_touch;
+
+ precache_model ("progs/quaddama.mdl");
+ precache_sound ("items/damage.wav");
+ precache_sound ("items/damage2.wav");
+ precache_sound ("items/damage3.wav");
+ self.noise = "items/damage.wav";
+ setmodel (self, "progs/quaddama.mdl");
+ if (deathmatch == 4)
+ self.netname = "OctaPower";
+ else
+ self.netname = "Quad Damage";
+ self.items = IT_QUAD;
+ self.effects = self.effects | ef_blue;
+ setsize (self, '-16 -16 -24', '16 16 32');
+ StartItem ();
+};
+
+
+
+/*
+===============================================================================
+
+PLAYER BACKPACKS
+
+===============================================================================
+*/
+
+void () BackpackTouch =
+{
+ local string s;
+ local float best;
+ local float old;
+ local float new;
+ local entity stemp;
+ local float acount;
+
+ if ((other.classname != "player"))
+ {
+ return;
+ }
+ if ((other.health <= MSG_BROADCAST))
+ {
+ return;
+ }
+ acount = MSG_BROADCAST;
+ sprint (other, "You get ");
+ if (self.items)
+ {
+ if (((other.items & self.items) == MSG_BROADCAST))
+ {
+ acount = WEAPON_SHOTGUN;
+ sprint (other, "the ");
+ sprint (other, self.netname);
+ }
+ }
+ stemp = self;
+ self = other;
+ best = W_BestWeapon ();
+ self = stemp;
+ other.exshells = (other.exshells + self.exshells);
+ other.exnails = (other.exnails + self.exnails);
+ other.exrockets = (other.exrockets + self.exrockets);
+ other.excells = (other.excells + self.excells);
+ new = self.items;
+ if (!new)
+ {
+ new = other.weapon;
+ }
+ old = other.items;
+ other.items = (other.items | new);
+ bound_other_ammo ();
+ if (self.exshells)
+ {
+ if (acount)
+ {
+ sprint (other, ", ");
+ }
+ acount = WEAPON_SHOTGUN;
+ s = ftos (self.exshells);
+ sprint (other, s);
+ sprint (other, " shells");
+ }
+ if (self.exnails)
+ {
+ if (acount)
+ {
+ sprint (other, ", ");
+ }
+ acount = WEAPON_SHOTGUN;
+ s = ftos (self.exnails);
+ sprint (other, s);
+ sprint (other, " nails");
+ }
+ if (self.exrockets)
+ {
+ if (acount)
+ {
+ sprint (other, ", ");
+ }
+ acount = WEAPON_SHOTGUN;
+ s = ftos (self.exrockets);
+ sprint (other, s);
+ sprint (other, " rockets");
+ }
+ if (self.excells)
+ {
+ if (acount)
+ {
+ sprint (other, ", ");
+ }
+ acount = WEAPON_SHOTGUN;
+ s = ftos (self.excells);
+ sprint (other, s);
+ sprint (other, " cells");
+ }
+ sprint (other, "\n");
+ sound (other, CHAN_ITEM, "weapons/lock4.wav", WEAPON_SHOTGUN, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+ remove (self);
+ self = other;
+};
+
+void () DropBackpack =
+{
+ local entity item;
+
+ if (!(((self.exshells + self.exnails) + self.exrockets) + self.excells))
+ {
+ return;
+ }
+ item = spawn ();
+ item.origin = (self.origin - '0 0 24');
+ item.items = self.weapon;
+ if ((item.items == IT_AXE))
+ {
+ item.netname = "Axe";
+ }
+ else
+ {
+ if ((item.items == IT_SHOTGUN))
+ {
+ item.netname = "Pistol";
+ }
+ else
+ {
+ if ((item.items == IT_SUPER_SHOTGUN))
+ {
+ item.netname = "SMG";
+ }
+ else
+ {
+ if ((item.items == IT_NAILGUN))
+ {
+ item.netname = "Rifle";
+ }
+ else
+ {
+ if ((item.items == IT_SUPER_NAILGUN))
+ {
+ item.netname = "Super Nailgun";
+ }
+ else
+ {
+ if ((item.items == IT_GRENADE_LAUNCHER))
+ {
+ item.netname = "Grenade Launcher";
+ }
+ else
+ {
+ if ((item.items == IT_ROCKET_LAUNCHER))
+ {
+ item.netname = "Rocket Launcher";
+ }
+ else
+ {
+ if ((item.items == IT_LIGHTNING))
+ {
+ item.netname = "Thunderbolt";
+ }
+ else
+ {
+ item.netname = "";
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ item.exshells = self.exshells;
+ item.exnails = self.exnails;
+ item.exrockets = self.exrockets;
+ item.excells = self.excells;
+ item.velocity_z = 300;
+ item.velocity_x = (-100 + (random () * 200));
+ item.velocity_y = (-100 + (random () * 200));
+ item.flags = FL_ITEM;
+ item.solid = SOLID_TRIGGER;
+ item.movetype = MOVETYPE_TOSS;
+ setmodel (item, "progs/backpack.mdl");
+ setsize (item, '-16 -16 0', '16 16 56');
+ item.touch = BackpackTouch;
+ item.nextthink = (time + 120);
+ item.think = SUB_Remove;
+};
+
+/*
+========================
+Grenades By mexicouger
+------------------------
+*/
+void() plasma_nade_touch =
+{
+if (other.classname != "player")
+ return;
+
+ if (other.plasma_lives >= 4) {
+ }
+
+ else {
+ other.plasma_lives += 1;
+ sprint (other, "picked up a Plasma grenade\n");
+ sound (self, CHAN_WEAPON, "weapons/pbounce.wav", 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+ self.mdl = self.model;
+ self.model = string_null;
+ self.solid = SOLID_NOT;
+
+ if (deathmatch) {
+ self.nextthink = time + 20;
+ self.think = SUB_regen;
+ }
+ activator = other;
+ SUB_UseTargets();
+}
+};
+
+void() nade_touch =
+{
+if (other.classname != "player")
+ return;
+
+ if (other.nade_lives >= 4) {
+ }
+
+ else {
+ other.nade_lives += 1;
+ sprint (other, "picked up a Frag grenade\n");
+ sound (self, CHAN_WEAPON, "weapons/grenpick.wav", 1, ATTN_NORM);
+ stuffcmd (other, "bf\n");
+ self.mdl = self.model;
+ self.model = string_null;
+ self.solid = SOLID_NOT;
+
+ if (deathmatch) {
+ self.nextthink = time + 20;
+ self.think = SUB_regen;
+ }
+ activator = other;
+ SUB_UseTargets();
+}
+};
+
+void() item_nade =
+{
+ self.touch = nade_touch;
+ setmodel(self, "progs/fraggren.mdl");
+ precache_sound ("weapons/grenpick.wav");
+ setsize (self, '0 0 0', ' 2 2 2');
+ StartItem();
+};
+
+void() item_plasma_nade =
+{
+ self.touch = plasma_nade_touch;
+ setmodel(self, "progs/plasgren.mdl");
+ setsize (self, '0 0 0', ' 2 2 2');
+ StartItem();
+};
+
diff --git a/r17/Revamped src/Revamped QC/misc.qc b/r17/Revamped src/Revamped QC/misc.qc
new file mode 100755
index 00000000..c8bdf218
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/misc.qc
@@ -0,0 +1,612 @@
+
+/*QUAKED info_null (0 0.5 0) (-4 -4 -4) (4 4 4)
+Used as a positional target for spotlights, etc.
+*/
+var void() info_null = SUB_Remove;
+
+/*QUAKED info_notnull (0 0.5 0) (-4 -4 -4) (4 4 4)
+Used as a positional target for lightning.
+*/
+void() info_notnull =
+{
+};
+
+//============================================================================
+
+float START_OFF = 1;
+
+void() light_use =
+{
+ if (self.spawnflags & START_OFF)
+ {
+ lightstyle(self.style, "m");
+ self.spawnflags = self.spawnflags - START_OFF;
+ }
+ else
+ {
+ lightstyle(self.style, "a");
+ self.spawnflags = self.spawnflags | START_OFF;
+ }
+};
+
+/*QUAKED light (0 1 0) (-8 -8 -8) (8 8 8) START_OFF
+Non-displayed light.
+Default light value is 300
+Default style is 0
+If targeted, it will toggle between on or off.
+*/
+void() light =
+{
+ if (!self.targetname)
+ { // inert light
+ remove(self);
+ return;
+ }
+
+ if (self.style >= 32)
+ {
+ self.use = light_use;
+ if (self.spawnflags & START_OFF)
+ lightstyle(self.style, "a");
+ else
+ lightstyle(self.style, "m");
+ }
+};
+
+/*QUAKED light_fluoro (0 1 0) (-8 -8 -8) (8 8 8) START_OFF
+Non-displayed light.
+Default light value is 300
+Default style is 0
+If targeted, it will toggle between on or off.
+Makes steady fluorescent humming sound
+*/
+void() light_fluoro =
+{
+ if (self.style >= 32)
+ {
+ self.use = light_use;
+ if (self.spawnflags & START_OFF)
+ lightstyle(self.style, "a");
+ else
+ lightstyle(self.style, "m");
+ }
+
+ precache_sound ("ambience/fl_hum1.wav");
+ ambientsound (self.origin, "ambience/fl_hum1.wav", 0.5, ATTN_STATIC);
+};
+
+/*QUAKED light_fluorospark (0 1 0) (-8 -8 -8) (8 8 8)
+Non-displayed light.
+Default light value is 300
+Default style is 10
+Makes sparking, broken fluorescent sound
+*/
+void() light_fluorospark =
+{
+ if (!self.style)
+ self.style = 10;
+
+ precache_sound ("ambience/buzz1.wav");
+ ambientsound (self.origin, "ambience/buzz1.wav", 0.5, ATTN_STATIC);
+};
+
+/*QUAKED light_globe (0 1 0) (-8 -8 -8) (8 8 8)
+Sphere globe light.
+Default light value is 300
+Default style is 0
+*/
+void() light_globe =
+{
+ precache_model ("progs/s_light.spr");
+ setmodel (self, "progs/s_light.spr");
+ self.alpha = 0.5;
+ makestatic (self);
+};
+
+void() FireAmbient =
+{
+ precache_sound ("ambience/fire1.wav");
+// attenuate fast
+ ambientsound (self.origin, "ambience/fire1.wav", 0.5, ATTN_STATIC);
+};
+
+/*QUAKED light_torch_small_walltorch (0 .5 0) (-10 -10 -20) (10 10 20)
+Short wall torch
+Default light value is 200
+Default style is 0
+*/
+void() light_torch_small_walltorch =
+{
+ precache_model ("progs/flame.mdl");
+ setmodel (self, "progs/flame.mdl");
+ FireAmbient ();
+ makestatic (self);
+};
+
+/*QUAKED light_flame_large_yellow (0 1 0) (-10 -10 -12) (12 12 18)
+Large yellow flame ball
+*/
+void() light_flame_large_yellow =
+{
+ precache_model ("progs/flame2.mdl");
+ setmodel (self, "progs/flame2.mdl");
+ self.frame = 1;
+ self.alpha = 0.5;
+ FireAmbient ();
+ makestatic (self);
+};
+
+/*QUAKED light_flame_small_yellow (0 1 0) (-8 -8 -8) (8 8 8) START_OFF
+Small yellow flame ball
+*/
+void() light_flame_small_yellow =
+{
+ precache_model ("progs/flame2.mdl");
+ setmodel (self, "progs/flame2.mdl");
+ self.alpha = 0.5;
+ FireAmbient ();
+ makestatic (self);
+};
+
+/*QUAKED light_flame_small_white (0 1 0) (-10 -10 -40) (10 10 40) START_OFF
+Small white flame ball
+*/
+void() light_flame_small_white =
+{
+ precache_model ("progs/flame2.mdl");
+ setmodel (self, "progs/flame2.mdl");
+ self.alpha = 0.5;
+ FireAmbient ();
+ makestatic (self);
+};
+
+//============================================================================
+
+
+/*QUAKED misc_fireball (0 .5 .8) (-8 -8 -8) (8 8 8)
+Lava Balls
+*/
+
+void() fire_fly =
+{
+ local vector vel;
+
+ vel_x = (random() * 100) - 50;
+ vel_y = (random() * 100) - 50;
+ vel_z = self.speed + (random() * 200);
+
+ PRJ_FireProjectile (world, "progs/lavaball.mdl", self.origin, vel, PE_NONE, 20, MOD_FIREBALL, 5);
+ newmis.movetype = MOVETYPE_BOUNCE;
+ newmis.alpha = 0.9;
+
+ self.nextthink = time + (random() * 5) + 3;
+ self.think = fire_fly;
+};
+
+void() misc_fireball =
+{
+
+ precache_model ("progs/lavaball.mdl");
+ self.classname = "fireball";
+ self.nextthink = time + 0.1 + (random() * 4.9);
+ self.think = fire_fly;
+ if (!self.speed)
+ self.speed = 1000;
+};
+
+//============================================================================
+
+
+void() barrel_explode =
+{
+ self.takedamage = DAMAGE_NO;
+ self.classname = "explo_box";
+ // did say self.owner, self.enemy should be set by Killed function
+ T_RadiusDamage (self, self.enemy, 160, 200, self, MOD_EXPLOBOX);
+ TE_explosion(self.origin + '0 0 32');
+ remove (self);
+};
+
+
+
+/*QUAKED misc_explobox (0 .5 .8) (0 0 0) (32 32 64)
+TESTING THING
+*/
+
+void() misc_explobox =
+{
+ local float oldz;
+
+ self.solid = SOLID_BBOX;
+ self.movetype = MOVETYPE_NONE;
+ precache_model ("maps/b_explob.bsp");
+ setmodel (self, "maps/b_explob.bsp");
+ setsize (self, '0 0 0', '32 32 64');
+ precache_sound ("weapons/r_exp3.wav");
+ self.health = 20;
+ self.th_die = barrel_explode;
+ self.takedamage = DAMAGE_AIM;
+
+ self.origin_z = self.origin_z + 2;
+ oldz = self.origin_z;
+ droptofloor();
+ if (oldz - self.origin_z > 250)
+ {
+ dprint ("item fell out of level at ");
+ dprint (vtos(self.origin));
+ dprint ("\n");
+ remove(self);
+ }
+};
+
+
+
+
+/*QUAKED misc_explobox2 (0 .5 .8) (0 0 0) (32 32 64)
+Smaller exploding box, REGISTERED ONLY
+*/
+
+void() misc_explobox2 =
+{
+ local float oldz;
+
+ self.solid = SOLID_BBOX;
+ self.movetype = MOVETYPE_NONE;
+ precache_model2 ("maps/b_exbox2.bsp");
+ setmodel (self, "maps/b_exbox2.bsp");
+ setsize (self, '0 0 0', '32 32 32');
+ precache_sound ("weapons/r_exp3.wav");
+ self.health = 20;
+ self.th_die = barrel_explode;
+ self.takedamage = DAMAGE_AIM;
+
+ self.origin_z = self.origin_z + 2;
+ oldz = self.origin_z;
+ droptofloor();
+ if (oldz - self.origin_z > 250)
+ {
+ dprint ("item fell out of level at ");
+ dprint (vtos(self.origin));
+ dprint ("\n");
+ remove(self);
+ }
+};
+
+//============================================================================
+
+float SPAWNFLAG_SUPERSPIKE = 1;
+float SPAWNFLAG_LASER = 2;
+
+void() spikeshooter_use =
+{
+ if (self.spawnflags & SPAWNFLAG_LASER)
+ {
+ sound (self, CHAN_VOICE, "enforcer/enfire.wav", 1, ATTN_NORM);
+ PRJ_FireProjectile(self,
+ "progs/laser.mdl",
+ self.origin,
+ self.movedir * 600,
+ PE_LASER,
+ 15,
+ MOD_LASER,
+ 5);
+ newmis.effects |= EF_DIMLIGHT;
+ newmis.alpha = 0.5;
+ }
+ else
+ {
+ sound (self, CHAN_VOICE, "weapons/spike2.wav", 1, ATTN_NORM);
+ if (self.spawnflags & SPAWNFLAG_SUPERSPIKE)
+ {
+ PRJ_FireProjectile(self,
+ "progs/s_spike.mdl",
+ self.origin,
+ self.movedir * 500,
+ PE_SUPERSPIKE,
+ 18,
+ MOD_SUPERSPIKE,
+ 6);
+ }
+ else
+ {
+ PRJ_FireProjectile(self,
+ "progs/spike.mdl",
+ self.origin,
+ self.movedir * 500,
+ PE_SPIKE,
+ 9,
+ MOD_SPIKE,
+ 6);
+ }
+ }
+};
+
+void() shooter_think =
+{
+ spikeshooter_use ();
+ self.nextthink = time + self.wait;
+ newmis.velocity = self.movedir * 500;
+};
+
+
+/*QUAKED trap_spikeshooter (0 .5 .8) (-8 -8 -8) (8 8 8) superspike laser
+When triggered, fires a spike in the direction set in QuakeEd.
+Laser is only for REGISTERED.
+*/
+
+void() trap_spikeshooter =
+{
+ SetMovedir ();
+ self.use = spikeshooter_use;
+ if (self.spawnflags & SPAWNFLAG_LASER)
+ {
+ precache_model2 ("progs/laser.mdl");
+
+ precache_sound2 ("enforcer/enfire.wav");
+ precache_sound2 ("enforcer/enfstop.wav");
+ }
+ else
+ precache_sound ("weapons/spike2.wav");
+};
+
+
+/*QUAKED trap_shooter (0 .5 .8) (-8 -8 -8) (8 8 8) superspike laser
+Continuously fires spikes.
+"wait" time between spike (1.0 default)
+"nextthink" delay before firing first spike, so multiple shooters can be stagered.
+*/
+void() trap_shooter =
+{
+ trap_spikeshooter ();
+
+ if (self.wait == 0)
+ self.wait = 1;
+ self.nextthink = time + self.wait;
+ self.think = shooter_think;
+};
+
+
+
+/*
+===============================================================================
+
+
+===============================================================================
+*/
+
+void() make_bubbles;
+void() bubble_bob;
+
+/*QUAKED air_bubbles (0 .5 .8) (-8 -8 -8) (8 8 8)
+
+testing air bubbles
+*/
+
+noref var void() air_bubbles = SUB_Remove;
+
+void() make_bubbles =
+{
+local entity bubble;
+
+ bubble = spawn();
+ setmodel (bubble, "progs/s_bubble.spr");
+ setorigin (bubble, self.origin);
+ bubble.movetype = MOVETYPE_NOCLIP;
+ bubble.solid = SOLID_NOT;
+ bubble.velocity = '0 0 15';
+ bubble.nextthink = time + 0.5;
+ bubble.think = bubble_bob;
+ bubble.classname = "bubble";
+ bubble.frame = 0;
+ bubble.bubble_state = 0;
+ bubble.alpha = 0.4;
+ setsize (bubble, '-8 -8 -8', '8 8 8');
+ self.nextthink = time + random() + 0.5;
+ self.think = make_bubbles;
+};
+
+void() bubble_split =
+{
+local entity bubble;
+ bubble = spawn();
+ setmodel (bubble, "progs/s_bubble.spr");
+ setorigin (bubble, self.origin);
+ bubble.movetype = MOVETYPE_NOCLIP;
+ bubble.solid = SOLID_NOT;
+ bubble.velocity = self.velocity;
+ bubble.nextthink = time + 0.5;
+ bubble.think = bubble_bob;
+ bubble.classname = "bubble";
+ bubble.frame = 1;
+ bubble.bubble_state = 10;
+ setsize (bubble, '-8 -8 -8', '8 8 8');
+ self.frame = 1;
+ self.bubble_state = 10;
+ if (self.waterlevel != 3)
+ remove (self);
+};
+
+void() bubble_bob =
+{
+local float rnd1, rnd2, rnd3;
+
+ self.bubble_state = self.bubble_state + 1;
+ if (self.bubble_state == 4)
+ bubble_split();
+ if (self.bubble_state == 20)
+ remove(self);
+
+ rnd1 = self.velocity_x + (-10 + (random() * 20));
+ rnd2 = self.velocity_y + (-10 + (random() * 20));
+ rnd3 = self.velocity_z + 10 + random() * 10;
+
+ if (rnd1 > 10)
+ rnd1 = 5;
+ if (rnd1 < -10)
+ rnd1 = -5;
+
+ if (rnd2 > 10)
+ rnd2 = 5;
+ if (rnd2 < -10)
+ rnd2 = -5;
+
+ if (rnd3 < 10)
+ rnd3 = 15;
+ if (rnd3 > 30)
+ rnd3 = 25;
+
+ self.velocity_x = rnd1;
+ self.velocity_y = rnd2;
+ self.velocity_z = rnd3;
+
+ self.nextthink = time + 0.5;
+ self.think = bubble_bob;
+};
+
+/*~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>
+~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~<~>~*/
+
+/*QUAKED viewthing (0 .5 .8) (-8 -8 -8) (8 8 8)
+
+Just for the debugging level. Don't use
+*/
+
+noref var void() viewthing = SUB_Remove;
+
+/*
+==============================================================================
+
+SIMPLE BMODELS
+
+==============================================================================
+*/
+
+void() func_wall_use =
+{ // change to alternate textures
+ self.frame = 1 - self.frame;
+};
+
+/*QUAKED func_wall (0 .5 .8) ?
+This is just a solid wall if not inhibitted
+*/
+void() func_wall =
+{
+ self.angles = '0 0 0';
+ self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything
+ self.solid = SOLID_BSP;
+ self.use = func_wall_use;
+ setmodel (self, self.model);
+};
+
+
+/*QUAKED func_illusionary (0 .5 .8) ?
+A simple entity that looks solid but lets you walk through it.
+*/
+void() func_illusionary =
+{
+ self.angles = '0 0 0';
+ self.movetype = MOVETYPE_NONE;
+ self.solid = SOLID_NOT;
+ setmodel (self, self.model);
+ makestatic (self);
+};
+
+/*QUAKED func_episodegate (0 .5 .8) ? E1 E2 E3 E4
+This bmodel will appear if the episode has allready been completed, so players can't reenter it.
+*/
+void() func_episodegate =
+{
+ if (!(serverflags & self.spawnflags))
+ return; // can still enter episode
+
+ self.angles = '0 0 0';
+ self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything
+ self.solid = SOLID_BSP;
+ self.use = func_wall_use;
+ setmodel (self, self.model);
+};
+
+/*QUAKED func_bossgate (0 .5 .8) ?
+This bmodel appears unless players have all of the episode sigils.
+*/
+void() func_bossgate =
+{
+ if ( (serverflags & 15) == 15)
+ {
+ remove(self);
+ return; // all episodes completed
+ }
+ self.angles = '0 0 0';
+ self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything
+ self.solid = SOLID_BSP;
+ self.use = func_wall_use;
+ setmodel (self, self.model);
+};
+
+//============================================================================
+/*QUAKED ambient_suck_wind (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+*/
+void() ambient_suck_wind =
+{
+ precache_sound ("ambience/suck1.wav");
+ ambientsound (self.origin, "ambience/suck1.wav", 1, ATTN_STATIC);
+};
+
+/*QUAKED ambient_drone (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+*/
+void() ambient_drone =
+{
+ precache_sound ("ambience/drone6.wav");
+ ambientsound (self.origin, "ambience/drone6.wav", 0.5, ATTN_STATIC);
+};
+
+/*QUAKED ambient_flouro_buzz (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+*/
+void() ambient_flouro_buzz =
+{
+ precache_sound ("ambience/buzz1.wav");
+ ambientsound (self.origin, "ambience/buzz1.wav", 1, ATTN_STATIC);
+};
+/*QUAKED ambient_drip (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+*/
+void() ambient_drip =
+{
+ precache_sound ("ambience/drip1.wav");
+ ambientsound (self.origin, "ambience/drip1.wav", 0.5, ATTN_STATIC);
+};
+/*QUAKED ambient_comp_hum (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+*/
+void() ambient_comp_hum =
+{
+ precache_sound ("ambience/comp1.wav");
+ ambientsound (self.origin, "ambience/comp1.wav", 1, ATTN_STATIC);
+};
+/*QUAKED ambient_thunder (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+*/
+void() ambient_thunder =
+{
+ precache_sound ("ambience/thunder1.wav");
+ ambientsound (self.origin, "ambience/thunder1.wav", 0.5, ATTN_STATIC);
+};
+/*QUAKED ambient_light_buzz (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+*/
+void() ambient_light_buzz =
+{
+ precache_sound ("ambience/fl_hum1.wav");
+ ambientsound (self.origin, "ambience/fl_hum1.wav", 0.5, ATTN_STATIC);
+};
+/*QUAKED ambient_swamp1 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+*/
+void() ambient_swamp1 =
+{
+ precache_sound ("ambience/swamp1.wav");
+ ambientsound (self.origin, "ambience/swamp1.wav", 0.5, ATTN_STATIC);
+};
+/*QUAKED ambient_swamp2 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
+*/
+void() ambient_swamp2 =
+{
+ precache_sound ("ambience/swamp2.wav");
+ ambientsound (self.origin, "ambience/swamp2.wav", 0.5, ATTN_STATIC);
+};
+
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/monsters.qc b/r17/Revamped src/Revamped QC/monsters.qc
new file mode 100755
index 00000000..9e261688
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/monsters.qc
@@ -0,0 +1,217 @@
+/* ALL MONSTERS SHOULD BE 1 0 0 IN COLOR */
+
+/*
+================
+monster_use
+
+Using a monster makes it angry at the current activator
+================
+*/
+void() monster_use =
+{
+ if (self.enemy)
+ return;
+ if (self.health <= 0)
+ return;
+ if (activator.items & IT_INVISIBILITY)
+ return;
+ if (activator.flags & FL_NOTARGET)
+ return;
+ if (activator.flags & FL_CLIENT)
+ return;
+
+ // delay reaction so if the monster is teleported, its sound is still
+ // heard
+ self.enemy = activator;
+ self.nextthink = time + 0.1;
+ self.think = FoundTarget;
+};
+
+/*
+================
+monster_death_use
+
+When a mosnter dies, it fires all of its targets with the current
+enemy as activator.
+================
+*/
+void() monster_death_use =
+{
+ // fall to ground
+ if (self.flags & FL_FLY)
+ self.flags = self.flags - FL_FLY;
+ if (self.flags & FL_SWIM)
+ self.flags = self.flags - FL_SWIM;
+
+ if (!self.target)
+ return;
+
+ activator = self.enemy;
+ SUB_UseTargets ();
+};
+
+//============================================================================
+
+void() walkmonster_start_go =
+{
+ self.origin_z = self.origin_z + 1; // raise off floor a bit
+ droptofloor();
+
+ if (!walkmove(0,0))
+ {
+ dprint ("walkmonster in wall at: ");
+ dprint (vtos(self.origin));
+ dprint ("\n");
+ }
+
+ 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 = monster_use;
+
+ self.flags = self.flags | FL_MONSTER;
+
+ if (self.target)
+ {
+ self.goalentity = self.movetarget = find(world, targetname, self.target);
+ self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
+ if (!self.movetarget)
+ {
+ dprint ("Monster can't find target at ");
+ dprint (vtos(self.origin));
+ dprint ("\n");
+ }
+// this used to be an objerror
+ if (self.movetarget.classname == "path_corner")
+ self.th_walk ();
+ else
+ self.pausetime = 99999999;
+ self.th_stand ();
+ }
+ else
+ {
+ self.pausetime = 99999999;
+ self.th_stand ();
+ }
+
+// spread think times so they don't all happen at same time
+ self.nextthink = time + 0.1 + random()*0.5;
+};
+
+
+void() walkmonster_start =
+{
+// delay drop to floor to make sure all doors have been spawned
+// spread think times so they don't all happen at same time
+ self.nextthink = time + 0.1 + random()*0.5;
+ self.think = walkmonster_start_go;
+ total_monsters = total_monsters + 1;
+};
+
+
+
+void() flymonster_start_go =
+{
+ self.takedamage = DAMAGE_AIM;
+
+ self.ideal_yaw = self.angles * '0 1 0';
+ if (!self.yaw_speed)
+ self.yaw_speed = 10;
+ self.view_ofs = '0 0 25';
+ self.use = monster_use;
+
+ self.flags = self.flags | FL_FLY | FL_MONSTER;
+
+ if (!walkmove(0,0))
+ {
+ dprint ("flymonster in wall at: ");
+ dprint (vtos(self.origin));
+ dprint ("\n");
+ }
+
+ if (self.target)
+ {
+ self.goalentity = self.movetarget = find(world, targetname, self.target);
+ if (!self.movetarget)
+ {
+ dprint ("Monster can't find target at ");
+ dprint (vtos(self.origin));
+ dprint ("\n");
+ }
+// this used to be an objerror
+ if (self.movetarget.classname == "path_corner")
+ self.th_walk ();
+ else
+ self.pausetime = 99999999;
+ self.th_stand ();
+ }
+ else
+ {
+ self.pausetime = 99999999;
+ self.th_stand ();
+ }
+};
+
+void() flymonster_start =
+{
+// spread think times so they don't all happen at same time
+ self.nextthink = time + 0.1 + random()*0.5;
+ self.think = flymonster_start_go;
+ total_monsters = total_monsters + 1;
+};
+
+
+void() swimmonster_start_go =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+
+ self.takedamage = DAMAGE_AIM;
+// total_monsters = total_monsters + 1;
+
+ self.ideal_yaw = self.angles * '0 1 0';
+ if (!self.yaw_speed)
+ self.yaw_speed = 10;
+ self.view_ofs = '0 0 10';
+ self.use = monster_use;
+
+ self.flags = self.flags | FL_SWIM | FL_MONSTER;
+
+ if (self.target)
+ {
+ self.goalentity = self.movetarget = find(world, targetname, self.target);
+ if (!self.movetarget)
+ {
+ dprint ("Monster can't find target at ");
+ dprint (vtos(self.origin));
+ dprint ("\n");
+ }
+// this used to be an objerror
+ self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin);
+ self.th_walk ();
+ }
+ else
+ {
+ self.pausetime = 99999999;
+ self.th_stand ();
+ }
+
+// spread think times so they don't all happen at same time
+ self.nextthink = time + 0.1 + random()*0.5;
+};
+
+void() swimmonster_start =
+{
+// spread think times so they don't all happen at same time
+ self.nextthink = time + 0.1 + random()*0.5;
+ self.think = swimmonster_start_go;
+ total_monsters = total_monsters + 1;
+};
+
+
diff --git a/r17/Revamped src/Revamped QC/nomonst.qc b/r17/Revamped src/Revamped QC/nomonst.qc
new file mode 100755
index 00000000..21a6d6b2
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/nomonst.qc
@@ -0,0 +1,20 @@
+
+// QC for a monsterless compile
+
+var void() monster_ogre = SUB_Remove;
+var void() monster_demon1 = SUB_Remove;
+var void() monster_shambler = SUB_Remove;
+var void() monster_knight = SUB_Remove;
+var void() monster_army = SUB_Remove;
+var void() monster_wizard = SUB_Remove;
+var void() monster_dog = SUB_Remove;
+var void() monster_zombie = SUB_Remove;
+var void() monster_boss = SUB_Remove;
+var void() monster_tarbaby = SUB_Remove;
+var void() monster_hell_knight = SUB_Remove;
+var void() monster_fish = SUB_Remove;
+var void() monster_shalrath = SUB_Remove;
+var void() monster_enforcer = SUB_Remove;
+var void() monster_oldone = SUB_Remove;
+var void() event_lightning = SUB_Remove;
+var void() path_corner = SUB_Remove;
diff --git a/r17/Revamped src/Revamped QC/obituary.qc b/r17/Revamped src/Revamped QC/obituary.qc
new file mode 100755
index 00000000..d9249cea
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/obituary.qc
@@ -0,0 +1,359 @@
+// client death messages
+enum {
+ MOD_NONE,
+ MOD_AXE,
+ MOD_SHOTGUN,
+ MOD_SUPERSHOTGUN,
+ MOD_SPIKE,
+ MOD_SUPERSPIKE,
+ MOD_GRENADE,
+ MOD_ROCKET,
+ MOD_ROCKETRADIUS,
+ MOD_SHAFT,
+ MOD_SHAFTWATER,
+ MOD_SHAFTSLIME,
+ MOD_SHAFTLAVA,
+ MOD_TELEFRAG,
+ MOD_TELEFRAGDEFLECT,
+ MOD_SQUISH,
+ MOD_DROWN,
+ MOD_SLIME,
+ MOD_LAVA,
+ MOD_EXPLOBOX,
+ MOD_FALL,
+ MOD_FIREBALL,
+ MOD_EXIT,
+ MOD_LASER,
+ MOD_SELFWATER,
+ MOD_HURT,
+ MOD_DOG,
+ MOD_SOLDIER,
+ MOD_ENFORCER,
+ MOD_OGRE,
+ MOD_WIZARD,
+ MOD_DEMON,
+ MOD_KNIGHT,
+ MOD_HKNIGHT,
+ MOD_SHALRATH,
+ MOD_SHAMBLER,
+ MOD_FISH,
+ MOD_TARBABY,
+ MOD_ZOMBIE,
+ MOD_CHTHON
+};
+
+void(string targ, INTEGER mod) SuicideMessage =
+{
+ string s, t, u;
+
+ s = "";
+ t = "";
+ u = "";
+
+ switch (mod)
+ {
+ case MOD_GRENADE:
+ s = targ;
+ t = " tries to put the pin back in";
+ break;
+ case MOD_SHAFTWATER:
+ s = targ;
+ t = " discharges into the water.";
+ break;
+ case MOD_SHAFTSLIME:
+ s = targ;
+ t = " discharges into the slime";
+ break;
+ case MOD_SHAFTLAVA:
+ s = targ;
+ t = " discharges into the lava";
+ break;
+ case MOD_TELEFRAGDEFLECT:
+ s = "Satan's power deflects ";
+ t = targ;
+ u = "'s telefrag";
+ break;
+ case MOD_SELFWATER:
+ s = targ;
+ t = " electrocutes himself.";
+ break;
+ case MOD_EXPLOBOX:
+ s = targ;
+ t = " blew himself up";
+ break;
+ default:
+ s = targ;
+ t = " becomes bored with life";
+ }
+
+ bprint4(PRINT_MEDIUM, s, t, u, "\n");
+}
+
+void(string targ, string attacker, INTEGER mod) KillMessage =
+{
+ string s, t, u, v, w;
+
+ s = "";
+ t = "";
+ u = "";
+ v = "";
+ w = "";
+
+ switch (mod)
+ {
+ case MOD_AXE:
+ s = targ;
+ t = " was ax-murdered by ";
+ u = attacker;
+ break;
+ case MOD_SHOTGUN:
+ s = targ;
+ t = " chewed on ";
+ u = attacker;
+ v = "'s boomstick";
+ break;
+ case MOD_SUPERSHOTGUN:
+ s = targ;
+ t = " ate two loads of ";
+ u = attacker;
+ v = "'s buckshot";
+ break;
+ case MOD_SPIKE:
+ s = targ;
+ t = " was nailed by ";
+ u = attacker;
+ break;
+ case MOD_SUPERSPIKE:
+ s = targ;
+ t = " was punctured by ";
+ u = attacker;
+ break;
+ case MOD_GRENADE:
+ s = targ;
+ t = " eats ";
+ u = attacker;
+ v = "'s pineapple";
+ break;
+ case MOD_ROCKET:
+ case MOD_ROCKETRADIUS:
+ s = targ;
+ t = " rides ";
+ u = attacker;
+ v = "'s rocket";
+ break;
+ case MOD_SHAFT:
+ s = targ;
+ t = " accepts ";
+ u = attacker;
+ v = "'s shaft";
+ break;
+ case MOD_SHAFTWATER:
+ case MOD_SHAFTSLIME:
+ case MOD_SHAFTLAVA:
+ s = targ;
+ t = " accepts ";
+ u = attacker;
+ v = "'s discharge";
+ break;
+ case MOD_TELEFRAG:
+ s = targ;
+ t = " was telefragged by ";
+ u = attacker;
+ break;
+ case MOD_TELEFRAGDEFLECT:
+ s = targ;
+ t = " was telefragged by ";
+ u = attacker;
+ v = "'s Satan's power";
+ break;
+ case MOD_SQUISH:
+ s = attacker;
+ t = " squishes ";
+ u = targ;
+ break;
+ case MOD_EXPLOBOX:
+ s = targ;
+ t = " was blown up by ";
+ u = attacker;
+ break;
+ default:
+ s = targ;
+ t = " was killed by ";
+ u = attacker;
+ }
+
+ bprint6(PRINT_MEDIUM, s, t, u, v, w, "\n");
+}
+
+void(string targ, string attacker, INTEGER mod) TeamKillMessage =
+{
+ string s, t, u, v, w;
+ float rnum;
+
+ s = "";
+ t = "";
+ u = "";
+ v = "";
+ w = "";
+
+ switch (mod)
+ {
+ case MOD_SQUISH:
+ s = attacker;
+ t = " squishes teammate ";
+ u = targ;
+ break;
+ default:
+ rnum = random();
+
+ s = attacker;
+
+ if (rnum < 0.25)
+ t = " mows down teammate ";
+ else if (rnum < 0.5)
+ {
+ t = " checks his glasses and sees ";
+ v = " dead";
+ }
+ else if (rnum < 0.75)
+ {
+ t = " frags ";
+ v = " for the other team";
+ }
+ else
+ t = " loses his friend ";
+
+ u = targ;
+ }
+
+ bprint6(PRINT_MEDIUM, s, t, u, v, w, "\n");
+}
+
+void(string targ, INTEGER mod) WorldKillMessage =
+{
+ string s, t, u;
+
+ s = "";
+ t = "";
+ u = "";
+
+ switch (mod)
+ {
+ case MOD_SPIKE:
+ case MOD_SUPERSPIKE:
+ s = targ;
+ t = " was spiked";
+ break;
+ case MOD_SQUISH:
+ s = targ;
+ t = " was squished";
+ break;
+ case MOD_DROWN:
+ s = targ;
+
+ if (random() < 0.5)
+ t = " sleeps with the fishes";
+ else
+ t = " sucks it down";
+ break;
+ case MOD_SLIME:
+ s = targ;
+
+ if (random() < 0.5)
+ t = " gulped a load of slime";
+ else
+ t = " can't exist on slime alone";
+ break;
+ case MOD_LAVA:
+ s = targ;
+
+ if (random() < 0.5)
+ t = " turned into hot slag";
+ else
+ t = " visits the Volcano God";
+ break;
+ case MOD_EXPLOBOX:
+ s = targ;
+ t = " blew up";
+ break;
+ case MOD_FALL:
+ s = targ;
+ t = " fell to his death";
+ break;
+ case MOD_FIREBALL:
+ s = targ;
+ t = " ate a lavaball";
+ break;
+ case MOD_EXIT:
+ s = targ;
+ t = " tried to leave";
+ break;
+ case MOD_LASER:
+ s = targ;
+ t = " was zapped";
+ break;
+#ifdef MONSTERS
+ case MOD_DOG:
+ s = targ;
+ t = " was mauled by a Rottweiler";
+ break;
+ case MOD_SOLDIER:
+ s = targ;
+ t = " was shot by a Grunt";
+ break;
+ case MOD_ENFORCER:
+ s = targ;
+ t = " was blasted by an Enforcer";
+ break;
+ case MOD_OGRE:
+ s = targ;
+ t = " was destroyed by an Ogre";
+ break;
+ case MOD_WIZARD:
+ s = targ;
+ t = " was scragged by a Scrag";
+ break;
+ case MOD_DEMON:
+ s = targ;
+ t = " was eviscerated by a Fiend";
+ break;
+ case MOD_KNIGHT:
+ s = targ;
+ t = " was slashed by a Knight";
+ break;
+ case MOD_HKNIGHT:
+ s = targ;
+ t = " was slain by a Death Knight";
+ break;
+ case MOD_SHALRATH:
+ s = targ;
+ t = " was exploded by a Vore";
+ break;
+ case MOD_SHAMBLER:
+ s = targ;
+ t = " was smashed by a Shambler";
+ break;
+ case MOD_FISH:
+ s = targ;
+ t = " was fed to the Rotfish";
+ break;
+ case MOD_TARBABY:
+ s = targ;
+ t = " was slimed by a Spawn";
+ break;
+ case MOD_ZOMBIE:
+ s = targ;
+ t = " joins the Zombies";
+ break;
+ case MOD_CHTHON:
+ s = targ;
+ t = " fell to Chthon's wrath";
+ break;
+#endif
+ default:
+ s = targ;
+ t = " died";
+ }
+
+ bprint4(PRINT_MEDIUM, s, t, u, "\n");
+}
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/plats.qc b/r17/Revamped src/Revamped QC/plats.qc
new file mode 100755
index 00000000..1c739d7f
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/plats.qc
@@ -0,0 +1,363 @@
+
+
+void() plat_center_touch;
+void() plat_outside_touch;
+void() plat_trigger_use;
+void() plat_go_up;
+void() plat_go_down;
+void() plat_crush;
+float PLAT_LOW_TRIGGER = 1;
+
+void() plat_spawn_inside_trigger =
+{
+ local entity trigger;
+ local vector tmin, tmax;
+
+//
+// middle trigger
+//
+ trigger = spawn();
+ trigger.touch = plat_center_touch;
+ trigger.movetype = MOVETYPE_NONE;
+ trigger.solid = SOLID_TRIGGER;
+ trigger.enemy = self;
+
+ tmin = self.mins + '25 25 0';
+ tmax = self.maxs - '25 25 -8';
+ tmin_z = tmax_z - (self.pos1_z - self.pos2_z + 8);
+ if (self.spawnflags & PLAT_LOW_TRIGGER)
+ tmax_z = tmin_z + 8;
+
+ if (self.size_x <= 50)
+ {
+ tmin_x = (self.mins_x + self.maxs_x) / 2;
+ tmax_x = tmin_x + 1;
+ }
+ if (self.size_y <= 50)
+ {
+ tmin_y = (self.mins_y + self.maxs_y) / 2;
+ tmax_y = tmin_y + 1;
+ }
+
+ setsize (trigger, tmin, tmax);
+};
+
+void() plat_hit_top =
+{
+ sound (self, chan_no_phs_add|CHAN_VOICE, self.noise1, 1, ATTN_NORM);
+ self.state = STATE_TOP;
+ self.think = plat_go_down;
+ self.nextthink = self.ltime + 3;
+};
+
+void() plat_hit_bottom =
+{
+ sound (self, chan_no_phs_add|CHAN_VOICE, self.noise1, 1, ATTN_NORM);
+ self.state = STATE_BOTTOM;
+};
+
+void() plat_go_down =
+{
+ sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
+ self.state = STATE_DOWN;
+ SUB_CalcMove (self.pos2, self.speed, plat_hit_bottom);
+};
+
+void() plat_go_up =
+{
+ sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
+ self.state = STATE_UP;
+ SUB_CalcMove (self.pos1, self.speed, plat_hit_top);
+};
+
+void() plat_center_touch =
+{
+ if (other.classname != "player")
+ return;
+
+ if (other.health <= 0)
+ return;
+
+ self = self.enemy;
+ if (self.state == STATE_BOTTOM)
+ plat_go_up ();
+ else if (self.state == STATE_TOP)
+ self.nextthink = self.ltime + 1; // delay going down
+};
+
+void() plat_outside_touch =
+{
+ if (other.classname != "player")
+ return;
+
+ if (other.health <= 0)
+ return;
+
+//dprint ("plat_outside_touch\n");
+ self = self.enemy;
+ if (self.state == STATE_TOP)
+ plat_go_down ();
+};
+
+void() plat_trigger_use =
+{
+ if (self.think)
+ return; // allready activated
+ plat_go_down();
+};
+
+
+void() plat_crush =
+{
+//dprint ("plat_crush\n");
+
+ T_Damage (other, self, self, 1, MOD_SQUISH);
+
+ if (self.state == STATE_UP)
+ plat_go_down ();
+ else if (self.state == STATE_DOWN)
+ plat_go_up ();
+ else
+ objerror ("plat_crush: bad self.state\n");
+};
+
+void() plat_use =
+{
+ self.use = SUB_Null;
+ if (self.state != STATE_UP)
+ objerror ("plat_use: not in up state");
+ plat_go_down();
+};
+
+
+/*QUAKED func_plat (0 .5 .8) ? PLAT_LOW_TRIGGER
+speed default 150
+
+Plats are always drawn in the extended position, so they will light correctly.
+
+If the plat is the target of another trigger or button, it will start out disabled in the extended position until it is trigger, when it will lower and become a normal plat.
+
+If the "height" key is set, that will determine the amount the plat moves, instead of being implicitly determined by the model's height.
+Set "sounds" to one of the following:
+1) base fast
+2) chain slow
+*/
+
+
+void() func_plat =
+
+{
+
+ if (!self.t_length)
+ self.t_length = 80;
+ if (!self.t_width)
+ self.t_width = 10;
+
+ if (self.sounds == 0)
+ self.sounds = 2;
+// FIX THIS TO LOAD A GENERIC PLAT SOUND
+
+ if (self.sounds == 1)
+ {
+ precache_sound ("plats/plat1.wav");
+ precache_sound ("plats/plat2.wav");
+ self.noise = "plats/plat1.wav";
+ self.noise1 = "plats/plat2.wav";
+ }
+ else if (self.sounds == 2)
+ {
+ precache_sound ("plats/medplat1.wav");
+ precache_sound ("plats/medplat2.wav");
+ self.noise = "plats/medplat1.wav";
+ self.noise1 = "plats/medplat2.wav";
+ }
+
+
+ self.mangle = self.angles;
+ self.angles = '0 0 0';
+
+ self.classname = "plat";
+ self.solid = SOLID_BSP;
+ self.movetype = MOVETYPE_PUSH;
+ setorigin (self, self.origin);
+ setmodel (self, self.model);
+ setsize (self, self.mins , self.maxs);
+
+ self.blocked = plat_crush;
+ if (!self.speed)
+ self.speed = 150;
+
+// pos1 is the top position, pos2 is the bottom
+ self.pos1 = self.origin;
+ self.pos2 = self.origin;
+ if (self.height)
+ self.pos2_z = self.origin_z - self.height;
+ else
+ self.pos2_z = self.origin_z - self.size_z + 8;
+
+ self.use = plat_trigger_use;
+
+ plat_spawn_inside_trigger (); // the "start moving" trigger
+
+ if (self.targetname)
+ {
+ self.state = STATE_UP;
+ self.use = plat_use;
+ }
+ else
+ {
+ setorigin (self, self.pos2);
+ self.state = STATE_BOTTOM;
+ }
+};
+
+//============================================================================
+
+void() train_next;
+void() func_train_find;
+
+void() train_blocked =
+{
+ if (time < self.attack_finished)
+ return;
+ self.attack_finished = time + 0.5;
+ T_Damage (other, self, self, self.dmg, MOD_SQUISH);
+};
+
+void() train_use =
+{
+ if (self.think != func_train_find)
+ return; // already activated
+ train_next();
+};
+
+void() train_wait =
+{
+ if (self.wait)
+ {
+ self.nextthink = self.ltime + self.wait;
+ sound (self, chan_no_phs_add|CHAN_VOICE, self.noise, 1, ATTN_NORM);
+ }
+ else
+ self.nextthink = self.ltime + 0.1;
+
+ self.think = train_next;
+};
+
+void() train_next =
+{
+ local entity targ;
+
+ targ = find (world, targetname, self.target);
+ self.target = targ.target;
+ if (!self.target)
+ objerror ("train_next: no next target");
+ if (targ.wait)
+ self.wait = targ.wait;
+ else
+ self.wait = 0;
+ sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
+ SUB_CalcMove (targ.origin - self.mins, self.speed, train_wait);
+};
+
+void() func_train_find =
+
+{
+ local entity targ;
+
+ targ = find (world, targetname, self.target);
+ self.target = targ.target;
+ setorigin (self, targ.origin - self.mins);
+ if (!self.targetname)
+ { // not triggered, so start immediately
+ self.nextthink = self.ltime + 0.1;
+ self.think = train_next;
+ }
+};
+
+/*QUAKED func_train (0 .5 .8) ?
+Trains are moving platforms that players can ride.
+The targets origin specifies the min point of the train at each corner.
+The train spawns at the first target it is pointing at.
+If the train is the target of a button or trigger, it will not begin moving until activated.
+speed default 100
+dmg default 2
+sounds
+1) ratchet metal
+
+*/
+void() func_train =
+{
+ if (!self.speed)
+ self.speed = 100;
+ if (!self.target)
+ objerror ("func_train without a target");
+ if (!self.dmg)
+ self.dmg = 2;
+
+ if (self.sounds == 0)
+ {
+ self.noise = ("misc/null.wav");
+ precache_sound ("misc/null.wav");
+ self.noise1 = ("misc/null.wav");
+ precache_sound ("misc/null.wav");
+ }
+
+ if (self.sounds == 1)
+ {
+ self.noise = ("plats/train2.wav");
+ precache_sound ("plats/train2.wav");
+ self.noise1 = ("plats/train1.wav");
+ precache_sound ("plats/train1.wav");
+ }
+
+ self.cnt = 1;
+ self.solid = SOLID_BSP;
+ self.movetype = MOVETYPE_PUSH;
+ self.blocked = train_blocked;
+ self.use = train_use;
+ self.classname = "train";
+
+ setmodel (self, self.model);
+ setsize (self, self.mins , self.maxs);
+ setorigin (self, self.origin);
+
+// start trains on the second frame, to make sure their targets have had
+// a chance to spawn
+ self.nextthink = self.ltime + 0.1;
+ self.think = func_train_find;
+};
+
+/*QUAKED misc_teleporttrain (0 .5 .8) (-8 -8 -8) (8 8 8)
+This is used for the final bos
+*/
+void() misc_teleporttrain =
+{
+ if (!self.speed)
+ self.speed = 100;
+ if (!self.target)
+ objerror ("func_train without a target");
+
+ self.cnt = 1;
+ self.solid = SOLID_NOT;
+ self.movetype = MOVETYPE_PUSH;
+ self.blocked = train_blocked;
+ self.use = train_use;
+ self.avelocity = '100 200 300';
+
+ self.noise = ("misc/null.wav");
+ precache_sound ("misc/null.wav");
+ self.noise1 = ("misc/null.wav");
+ precache_sound ("misc/null.wav");
+
+ precache_model2 ("progs/teleport.mdl");
+ setmodel (self, "progs/teleport.mdl");
+ setsize (self, self.mins , self.maxs);
+ setorigin (self, self.origin);
+
+// start trains on the second frame, to make sure their targets have had
+// a chance to spawn
+ self.nextthink = self.ltime + 0.1;
+ self.think = func_train_find;
+};
+
diff --git a/r17/Revamped src/Revamped QC/player.qc b/r17/Revamped src/Revamped QC/player.qc
new file mode 100755
index 00000000..ceb46cad
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/player.qc
@@ -0,0 +1,1741 @@
+/*
+==============================================================================
+
+SOLITUDE PLAYER ANIMATIONS
+
+==============================================================================
+*/
+
+void() bubble_bob;
+$cd /raid/quake/id1/models/player_4
+$origin 0 -6 24
+$base base
+$skin skin
+
+#define PLAYER_GUN_IDLE 0
+#define PLAYER_RUN 1
+#define PLAYER_ATTACK1 2
+#define PLAYER_DIE1 3
+#define PLAYER_AXE_IDLE 4
+#define PLAYER_WALK 5
+#define PLAYER_SWIM 6
+#define PLAYER_JUMP 7
+#define PLAYER_ATTACK_STAND 8
+#define PLAYER_ATTACK_SIT 9
+#define PLAYER_THROW_NADE 10
+#define PLAYER_ATTACK_MELEE 11
+#define PLAYER_ATTACK_RUN 12
+#define PLAYER_DEATH1 13
+#define PLAYER_DEATH2 14
+#define PLAYER_RELOAD 15
+#define PLAYER_PAIN 16 // HACK!! (uses death 1 anims)
+#define PLAYER_PULL 17
+float (float anim_type, float endframe) Player_GetFrame =
+{
+ switch (anim_type)
+ {
+ case PLAYER_GUN_IDLE:
+ if (endframe)
+ return 8;
+ return 0;
+ break;
+ case PLAYER_AXE_IDLE:
+ return 0;
+ break;
+ case PLAYER_RUN:
+ if (endframe)
+ return 14;
+ return 9;
+ break;
+ case PLAYER_WALK:
+ if (endframe)
+ return 19;
+ return 15;
+ break;
+ case PLAYER_SWIM:
+ if (endframe)
+ return 26;
+ return 19;
+ break;
+ case PLAYER_JUMP:
+ if (endframe)
+ return 22;
+ return 20;
+ break;
+ case PLAYER_ATTACK_STAND:
+ if (endframe)
+ return 25;
+ return 23;
+ break;
+ case PLAYER_ATTACK_SIT:
+ if (endframe)
+ return 28;
+ return 26;
+ break;
+ case PLAYER_THROW_NADE:
+ if (endframe)
+ return 35;
+ return 29;
+ break;
+ case PLAYER_ATTACK_MELEE:
+ if (endframe)
+ return 41;
+ return 36;
+ break;
+ case PLAYER_ATTACK_RUN:
+ if (endframe)
+ return 48;
+ return 42;
+ break;
+ case PLAYER_DEATH1:
+ if (endframe)
+ return 60;
+ return 49;
+ break;
+ case PLAYER_DEATH2:
+ if (endframe)
+ return 71;
+ return 61;
+ break;
+ case PLAYER_RELOAD:
+ if (endframe)
+ return 79;
+ return 70;
+ break;
+ case PLAYER_PAIN:
+ if (endframe)
+ return 51;
+ return 49;
+ break;
+ case PLAYER_PULL:
+ if (endframe)
+ return 79;
+ return 70;
+ break;
+ default:
+ return 0;
+ break;
+ }
+
+ return 0;
+};
+
+void (entity t_plyr, float t_frame) startwframe =
+{
+ if (t_plyr.weaponframe < t_frame)
+ t_plyr.weaponframe = t_frame;
+};
+
+/*
+==============================================================================
+PLAYER
+==============================================================================
+*/
+
+void() player_run;
+
+void() player_stand1 =[ 0, player_stand1 ]
+{
+ player_run (); // player_run handles most animations.
+};
+
+void() player_run =[ 0, player_run ]
+{
+ local float ftype;
+
+ if (vlen(self.velocity) < 150)
+ ftype = PLAYER_WALK;
+ else
+ ftype = PLAYER_RUN;
+
+// if (self.waterlevel > 0)
+// ftype = PLAYER_SWIM;
+
+ if (!self.velocity_x && !self.velocity_y)
+ {
+ ftype = PLAYER_GUN_IDLE;
+ }
+
+ if (self.jump_time > time)
+ ftype = PLAYER_JUMP;
+
+ if (self.pain_time > time)
+ ftype = PLAYER_PAIN;
+
+ if (self.weaponstate == WS_FIRING1 && self.weaponframe > 0) {
+ if (vlen(self.velocity) < 20)
+ ftype = PLAYER_ATTACK_STAND;
+ else
+ ftype = PLAYER_ATTACK_RUN;
+ }
+
+ self.frame = Player_GetFrame(ftype, 0);
+
+
+ if ((self.frame + self.walkframe) > Player_GetFrame(ftype, 1))
+ self.walkframe = 0;
+
+ self.frame = self.frame + self.walkframe;
+
+ self.walkframe = self.walkframe + 1;
+
+ //_bprint(ftos(self.frame)," firing anim\n");
+};
+
+void () player_shot1 = [ 113, player_shot2 ]
+{
+ self.weaponframe = 1;
+ self.effects = (self.effects | EF_MUZZLEFLASH);
+};
+
+void () player_shot2 = [ 114, player_shot3 ]
+{
+ self.weaponframe = 2;
+};
+
+void () player_shot3 = [ 115, player_shot4 ]
+{
+ self.weaponframe = 3;
+};
+
+void () player_shot4 = [ 116, player_run ]
+{
+ self.weaponframe = 0;
+};
+
+void () player_shot5 = [ 117, player_shot6 ]
+{
+ self.weaponframe = 5;
+};
+
+void () player_shot6 = [ 118, player_run ]
+{
+ self.weaponframe = 6;
+};
+
+void () player_pistol_reload =
+{
+ local float amt;
+
+ self.weaponframe = (self.weaponframe + WEAPON_SHOTGUN);
+ if (self.weaponframe == 29)
+ {
+ player_run ();
+ amt = (12 - self.ammo_shells);
+ if ((self.exshells < amt))
+ {
+ amt = self.exshells;
+ }
+ self.exshells = (self.exshells - amt);
+ self.ammo_shells = (self.ammo_shells + amt);
+ self.armorvalue = self.exshells;
+ W_SetCurrentAmmo ();
+ return;
+ }
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+void () player_skull_reload =
+{
+ local float amt;
+
+ self.weaponframe = (self.weaponframe + WEAPON_SKULL);
+ if (self.weaponframe == 29)
+ {
+ player_run ();
+ amt = (12 - self.ammo_shells);
+ if ((self.exshells < amt))
+ {
+ amt = self.exshells;
+ }
+ self.exshells = (self.exshells - amt);
+ self.ammo_shells = (self.ammo_shells + amt);
+ self.armorvalue = self.exshells;
+ W_SetCurrentAmmo ();
+ return;
+ }
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+/*
+void () player_shotgun_drop = [ 143, player_shotgun_drop ]
+{
+ self.weaponframe = (self.weaponframe + WEAPON_SHOTGUN);
+ if ((self.weaponframe == SVC_KILLEDMONSTER))
+ {
+ self.weaponframe = 0;
+ player_run ();
+ return;
+ }
+ self.impulse = MSG_BROADCAST;
+};
+
+void () player_shotgun_reload =
+{
+ self.weaponframe = (self.weaponframe + WEAPON_SHOTGUN);
+
+ if ((self.weaponframe == 17))
+ {
+ self.exshells2 = (self.exshells2 - 1);
+ self.ammo_shells2 = (self.ammo_shells2 + 1);
+ self.armorvalue = self.exshells2;
+ W_SetCurrentAmmo ();
+ if ( ((self.ammo_shells2 < W_GetMaxClip( self.weapon, 1 )) || (self.exshells2 == MSG_BROADCAST)) && self.exshells2 > 0)
+ {
+ self.weaponframe = 13;
+ player_shotgun_reload ();
+ }
+ else
+ {
+ self.weaponframe = 17;
+ player_shotgun_drop ();
+ return;
+ }
+ }
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+*/
+
+void () player_shotgun_reload =
+{
+ if (self.button0 && self.currentammo > 0) { // Interrupt reload
+ player_run ();
+ return;
+ }
+
+ self.weaponframe += 1;
+ if (self.weaponframe == 17)
+ {
+ self.exshells2 = (self.exshells2 - 1);
+ self.ammo_shells2 = (self.ammo_shells2 + 1);
+ self.armorvalue = self.exshells2;
+ W_UpdateAmmoCounts(self);
+ if (self.currentammo == W_GetMaxClip( self.weapon, 1 ) || self.armorvalue == 0) {
+ self.weaponframe = 18;
+ }
+ else {
+
+ self.weaponframe = 13;
+ }
+ }
+ else if (self.weaponframe > 17) {
+ if (self.weaponframe > 20) {
+ player_run ();
+ W_SetCurrentAmmo ();
+ return;
+ }
+ }
+
+ self.attack_finished = (time + 0.2);
+ self.impulse = 0;
+};
+
+void () player_uzi_reload =
+{
+ local float amt;
+
+ self.weaponframe += 1;
+ if ((self.weaponframe > 19))
+ {
+ player_run ();
+ amt = (W_GetMaxClip(self.weapon, 1) - self.ammo_hshells);
+ if ((self.exhshells < amt))
+ {
+ amt = self.exhshells;
+ }
+ self.exhshells = (self.exhshells - amt);
+ self.ammo_hshells = (self.ammo_hshells + amt);
+ self.armorvalue = self.exhshells;
+ W_SetCurrentAmmo ();
+ return;
+ }
+ self.attack_finished = (time + 0.2);
+ self.impulse = 0;
+};
+
+void () player_rl_reload =
+{
+ local float amt;
+
+ self.weaponframe += 1;
+ if ((self.weaponframe > 50))
+ {
+ player_run ();
+ amt = (W_GetMaxClip(self.weapon, 1) - self.ammo_rockets);
+ if ((self.exrockets < amt))
+ {
+ amt = self.exrockets;
+ }
+ self.exrockets = (self.exrockets - amt);
+ self.ammo_rockets = (self.ammo_rockets + amt);
+ self.armorvalue = self.exrockets;
+ W_SetCurrentAmmo ();
+ return;
+ }
+ self.attack_finished = (time + 0.2);
+ self.impulse = 0;
+};
+
+void () player_ar_reload =
+{
+ local float amt;
+
+ self.weaponframe += 1;
+ if ((self.weaponframe == 29))
+ {
+ player_run ();
+ amt = (W_GetMaxClip(self.weapon, 1) - self.ammo_nails);
+ if ((self.exnails < amt))
+ {
+ amt = self.exnails;
+ }
+ self.exnails = (self.exnails - amt);
+ self.ammo_nails = (self.ammo_nails + amt);
+ self.armorvalue = self.exnails;
+ W_SetCurrentAmmo ();
+ return;
+ }
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+
+void () player_sniper_reload =
+{
+ local float amt;
+
+ self.weaponframe += 1;
+ if (self.weaponframe > 27)
+ {
+ player_run ();
+ amt = (W_GetMaxClip(self.weapon, 1) - self.ammo_sniper);
+ if ((self.exsniper < amt))
+ {
+ amt = self.exsniper;
+ }
+ self.exsniper -= amt;
+ self.ammo_sniper += amt;
+ self.armorvalue = self.exsniper;
+ W_SetCurrentAmmo ();
+ return;
+ }
+ self.attack_finished = (time + 0.2);
+ self.impulse = 0;
+};
+
+void () player_ppistol_reload =
+{
+ if (self.weaponframe < 15) // fixme: shouldn't be necessary :\
+ self.weaponframe = 15;
+ self.weaponframe += 1;
+ if (self.weaponframe > 35)
+ {
+ player_run ();
+ self.exppistol = 0;
+ self.weaponheat = 0;
+ W_SetCurrentAmmo ();
+ return;
+ }
+ //self.weaponframe_time = time + 0.1;
+ self.attack_finished = (time + 0.2);
+ self.impulse = 0;
+};
+
+void () player_needler_reload =
+{
+ local float amt;
+
+ self.weaponframe += 1;
+ if (self.weaponframe > 29)
+ {
+ player_run ();
+ amt = (W_GetMaxClip(self.weapon, 1) - self.ammo_needler);
+ if ((self.exneedler < amt))
+ {
+ amt = self.exneedler;
+ }
+ self.exneedler -= amt;
+ self.ammo_needler += amt;
+ self.armorvalue = self.exneedler;
+ W_SetCurrentAmmo ();
+ return;
+ }
+ self.attack_finished = (time + 0.2);
+ self.impulse = 0;
+};
+
+void () player_generic_reload =
+{
+ local float rld_amt;
+ rld_amt = self.armorvalue;
+
+ if ((Player_GetFrame(PLAYER_RELOAD, 0) + self.fireframe) > Player_GetFrame(PLAYER_RELOAD, 1)) {
+
+ rld_amt = (W_GetMaxClip(self.weapon, 1) - self.currentammo);
+ if ((self.armorvalue < rld_amt))
+ {
+ rld_amt = self.armorvalue;
+ }
+ player_run ();
+ SetAmmoFor( self, self.weapon, 1, rld_amt );
+ SetAmmoFor( self, self.weapon, 0, (-1 * rld_amt) );
+ W_SetCurrentAmmo ();
+ return;
+ }
+ self.attack_finished = (time + 0.2);
+ self.impulse = 0;
+};
+
+// Primary player reload function (handles all reloading)
+void () player_reload1 = [ 0, player_reload1 ]
+{
+ // allow players to interrupt reload for melee/nade throw
+ if (self.impulse == 29) {
+ pre_player_melee ();
+ return;
+ }
+ else if (self.impulse == 28) {
+ pre_player_throw_grenade ();
+ return;
+ }
+ else if (self.reload_time == -1) {
+ self.reload_time = 1;
+ player_run();
+ return;
+ }
+
+ switch (self.weapon) {
+ case WEAPON_PISTOL:
+ player_pistol_reload ();
+ break;
+ case WEAPON_SKULL:
+ player_skull_reload ();
+ break;
+ case WEAPON_SHOT:
+ player_shotgun_reload ();
+ break;
+ case WEAPON_AR:
+ player_ar_reload ();
+ break;
+ case WEAPON_UZI:
+ player_uzi_reload ();
+ break;
+ case WEAPON_RL:
+ player_rl_reload ();
+ break;
+ case WEAPON_SNIPER:
+ player_sniper_reload ();
+ break;
+ case WEAPON_PPISTOL:
+ player_ppistol_reload ();
+ break;
+ case WEAPON_NEEDLER:
+ player_needler_reload ();
+ break;
+ default:
+ player_generic_reload ();
+ break;
+ }
+ self.reload_time = time + .1;
+
+ self.frame = Player_GetFrame(PLAYER_RELOAD, 0);
+ if ((self.frame + self.fireframe) > Player_GetFrame(PLAYER_RELOAD, 1)) {
+ if (self.weaponframe == 0) {
+ self.melee_time = 0;
+ self.donefire = 0;
+ self.fireframe = 0;
+ player_run();
+ return;
+ }
+ else {
+ self.fireframe = 5;
+ //self.frame = Player_GetFrame(PLAYER_RELOAD, 0) + 3;
+ }
+
+ }
+
+ self.frame = self.frame + self.fireframe;
+
+ self.fireframe = self.fireframe + 1;
+};
+
+void () player_hshot = [ 103, player_hshot ]
+{
+ if (!W_CheckNoAmmo ())
+ {
+ return;
+ }
+ self.effects = (self.effects | EF_MUZZLEFLASH);
+ self.weaponframe = (self.weaponframe + WEAPON_SHOTGUN);
+ if ((self.weaponframe == TE_LAVASPLASH))
+ {
+ self.weaponframe = WEAPON_SHOTGUN;
+ player_run ();
+ return;
+ }
+ self.attack_finished = (time + 0.5);
+};
+
+void () Melee_Finished =
+{
+ self.donefire = 1;
+ self.weaponframe = 0;
+ player_run ();
+};
+
+void () player_shot_melee =
+{
+ self.weaponframe = (self.weaponframe + WEAPON_SHOTGUN);
+ if ((self.weaponframe >= 41))
+ {
+ Melee_Finished ();
+ return;
+ }
+ if ((self.weaponframe == 33))
+ {
+ W_Melee ();
+ }
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+
+void () player_skull_melee =
+{
+ self.weaponframe = (self.weaponframe + WEAPON_SKULL);
+ if ((self.weaponframe >= 16))
+ {
+ Melee_Finished ();
+ return;
+ }
+ if ((self.weaponframe == 1))
+ {
+ W_Melee ();
+ }
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+
+void () player_rl_melee =
+{
+ self.weaponframe += 1;
+ if ( self.weaponframe > 65 )
+ {
+ Melee_Finished ();
+ return;
+ }
+ if ( self.weaponframe == 62 )
+ {
+ W_Melee ();
+ }
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+
+void () player_hshot_melee =
+{
+ self.weaponframe = (self.weaponframe + WEAPON_SHOTGUN);
+ if ((self.weaponframe >= 26))
+ {
+ Melee_Finished ();
+ return;
+ }
+ if ((self.weaponframe == 23))
+ {
+ W_Melee ();
+ }
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+
+void () player_shot2_melee =
+{
+ self.weaponframe = (self.weaponframe + WEAPON_SHOTGUN);
+ if ((self.weaponframe >= 33))
+ {
+ Melee_Finished ();
+ return;
+ }
+ if ((self.weaponframe == 30))
+ {
+ W_Melee ();
+ }
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+
+void () player_nail_melee =
+{
+ self.weaponframe = (self.weaponframe + WEAPON_SHOTGUN);
+ if ((self.weaponframe >= 34))
+ {
+ Melee_Finished ();
+ return;
+ }
+ if ((self.weaponframe == SVC_FINALE))
+ {
+ W_Melee ();
+ }
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+
+void () player_sniper_melee =
+{
+ self.weaponframe = (self.weaponframe + WEAPON_SHOTGUN);
+ if ((self.weaponframe >= 34))
+ {
+ Melee_Finished ();
+ return;
+ }
+ if ((self.weaponframe == 32))
+ {
+ W_Melee ();
+ }
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+
+void () player_ppistol_melee =
+{
+ self.weaponframe += 1;
+ if ((self.weaponframe >= 43))
+ {
+ Melee_Finished ();
+ return;
+ }
+ if ((self.weaponframe == 38))
+ {
+ W_Melee ();
+ }
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = 0;
+};
+
+void () player_needler_melee =
+{
+ self.weaponframe += 1;
+ if ((self.weaponframe >= 47))
+ {
+ Melee_Finished ();
+ return;
+ }
+ if ((self.weaponframe == 34))
+ {
+ W_Melee ();
+ }
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = 0;
+};
+
+void () player_melee = [ 0, player_melee ]
+{
+ local float ftype;
+ ftype = PLAYER_ATTACK_MELEE;
+
+ self.melee_time = time + .6;
+ switch (self.weapon) {
+ case WEAPON_SHOT:
+ startwframe(self, 28);
+ player_shot2_melee ();
+ break;
+ case WEAPON_PISTOL:
+ startwframe(self, 30);
+ player_shot_melee ();
+ break;
+ case WEAPON_SKULL:
+ startwframe(self, 1);
+ player_skull_melee ();
+ break;
+ case WEAPON_AR:
+ startwframe(self, 29);
+ player_nail_melee ();
+ break;
+ case WEAPON_UZI:
+ startwframe(self, 21);
+ player_hshot_melee ();
+ break;
+ case WEAPON_RL:
+ startwframe(self, 58);
+ player_rl_melee ();
+ break;
+ case WEAPON_SNIPER:
+ startwframe(self, 29);
+ player_sniper_melee ();
+ break;
+ case WEAPON_PPISTOL:
+ startwframe(self, 36);
+ player_ppistol_melee ();
+ break;
+ case WEAPON_NEEDLER:
+ startwframe(self, 30);
+ player_needler_melee ();
+ break;
+ default:
+ self.melee_time = 0;
+ return;
+ }
+
+ self.frame = Player_GetFrame(ftype, 0);
+
+ if ((self.frame + self.fireframe) > Player_GetFrame(ftype, 1)) {
+ if (self.weaponframe == 0) {
+ self.melee_time = 0;
+ self.donefire = 0;
+ self.fireframe = 0;
+ player_run();
+ }
+ else {
+ self.frame = Player_GetFrame(ftype, 1);
+ }
+ return;
+ }
+
+ self.frame = self.frame + self.fireframe;
+
+ self.fireframe = self.fireframe + 1;
+};
+
+void () pre_player_melee =
+{
+ player_melee ();
+ self.weaponframe = 0;
+ self.fireframe = 1;
+ self.frame = Player_GetFrame(PLAYER_ATTACK_MELEE, 0);
+};
+
+void () Throw_Finished =
+{
+ self.donefire = 1;
+ self.weaponframe = 0;
+ player_run ();
+};
+
+void () player_shot_throw =
+{
+ self.weaponframe = (self.weaponframe + WEAPON_SHOTGUN);
+ if ((self.weaponframe >= 51))
+ {
+ Throw_Finished ();
+ return;
+ }
+ if ((self.weaponframe == 47))
+ {
+ W_ThrowGrenade ();
+ }
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+
+void () player_skull_throw =
+{
+ self.weaponframe = (self.weaponframe + WEAPON_SKULL);
+ if ((self.weaponframe >= 16))
+ {
+ Throw_Finished ();
+ return;
+ }
+ //if ((self.weaponframe == 47))
+ //{
+ // W_ThrowGrenade ();
+ //}
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+
+void () player_shot2_throw =
+{
+ self.weaponframe += 1;
+ if (self.weaponframe >= 41)
+ {
+ Throw_Finished ();
+ return;
+ }
+ if (self.weaponframe == 39)
+ {
+ W_ThrowGrenade ();
+ }
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+
+void () player_nail_throw =
+{
+ self.weaponframe = (self.weaponframe + WEAPON_SHOTGUN);
+ if ((self.weaponframe >= 42))
+ {
+ Throw_Finished ();
+ return;
+ }
+ if ((self.weaponframe == 39))
+ {
+ W_ThrowGrenade ();
+ }
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+
+void () player_uzi_throw =
+{
+ self.weaponframe += 1;
+
+ if (self.weaponframe >= 33)
+ {
+ Throw_Finished ();
+ return;
+ }
+ if (self.weaponframe == 30)
+ {
+ W_ThrowGrenade ();
+ }
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+
+void () player_sniper_throw =
+{
+ self.weaponframe += 1;
+
+ if (self.weaponframe >= 42)
+ {
+ Throw_Finished ();
+ return;
+ }
+ if (self.weaponframe == 39)
+ {
+ W_ThrowGrenade ();
+ }
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+
+void () player_rl_throw =
+{
+ self.weaponframe += 1;
+
+ if (self.weaponframe >= 58)
+ {
+ Throw_Finished ();
+ return;
+ }
+ if (self.weaponframe == 55)
+ {
+ W_ThrowGrenade ();
+ }
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+
+void () player_ppistol_throw =
+{
+ self.weaponframe += 1;
+
+ if (self.weaponframe >= 50)
+ {
+ Throw_Finished ();
+ return;
+ }
+ if (self.weaponframe == 46)
+ {
+ W_ThrowGrenade ();
+ }
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+
+void () player_needler_throw =
+{
+ self.weaponframe += 1;
+
+ if (self.weaponframe >= 56)
+ {
+ Throw_Finished ();
+ return;
+ }
+ if (self.weaponframe == 52)
+ {
+ W_ThrowGrenade ();
+ }
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+
+void () player_throw_grenade = [ 0, player_throw_grenade ]
+{
+ local float ftype;
+ ftype = PLAYER_THROW_NADE;
+
+ self.nade_time = time + .8;
+ switch (self.weapon) {
+ case WEAPON_PISTOL:
+ startwframe(self, 44);
+ player_shot_throw ();
+ break;
+ case WEAPON_SHOT:
+ startwframe(self, 34);
+ player_shot2_throw ();
+ break;
+ case WEAPON_AR:
+ startwframe(self, 34);
+ player_nail_throw ();
+ break;
+ case WEAPON_UZI:
+ startwframe(self, 26);
+ player_uzi_throw ();
+ break;
+ case WEAPON_RL:
+ startwframe(self, 51);
+ player_rl_throw ();
+ break;
+ case WEAPON_SNIPER:
+ startwframe(self, 35);
+ player_sniper_throw ();
+ break;
+ case WEAPON_PPISTOL:
+ startwframe(self, 43);
+ player_ppistol_throw ();
+ break;
+ case WEAPON_NEEDLER:
+ startwframe(self, 48);
+ player_needler_throw ();
+ break;
+ default:
+ self.nade_time = 0;
+ return;
+ }
+
+ self.frame = Player_GetFrame(ftype, 0);
+
+ if ((self.frame + self.fireframe) > Player_GetFrame(ftype, 1)) {
+ if (self.weaponframe == 0) {
+ self.donefire = 0;
+ self.fireframe = 0;
+ player_run();
+ }
+ else {
+ self.frame = Player_GetFrame(ftype, 1);
+ }
+ return;
+ }
+
+ self.frame = self.frame + self.fireframe;
+
+ self.fireframe = self.fireframe + 1;
+};
+
+void () pre_player_throw_grenade =
+{
+ player_throw_grenade ();
+ self.weaponframe = 0;
+ self.fireframe = 0;
+ self.frame = Player_GetFrame(PLAYER_THROW_NADE, 0);
+};
+
+//============================================================================
+
+void () player_nail2 = [ 103, player_nail2 ]
+{
+ if (!W_CheckNoAmmo ())
+ {
+ return;
+ }
+ self.effects = (self.effects | EF_MUZZLEFLASH);
+ if (!self.button0)
+ {
+ player_run ();
+ return;
+ }
+ /*
+ self.weaponframe += 1;
+ if (self.weaponframe > 3)
+ {
+ self.weaponframe = 1;
+ }
+ */
+ SuperDamageSound ();
+ W_FireNail2 ();
+ //self.attack_finished = (time + 0.1);
+};
+
+void () player_ar1 = [ 103, player_ar1 ]
+{
+ if (!W_CheckNoAmmo ())
+ {
+ return;
+ }
+ self.effects = (self.effects | EF_MUZZLEFLASH);
+ if (!self.button0)
+ {
+ player_run ();
+ return;
+ }
+
+ self.weaponframe += 1;
+ if (self.weaponframe > 3)
+ {
+ self.weaponframe = 1;
+ }
+
+ SuperDamageSound ();
+ //W_FireNail2 ();
+ //self.attack_finished = (time + 0.1);
+};
+
+void(float num_bubbles) DeathBubbles;
+
+void() PainSound =
+{
+
+
+ if (self.health < 0)
+ return;
+
+ if (self.pain_finished > time)
+ return;
+
+ // change pain sound depending on means of death
+ switch (damage_mod)
+ {
+ case MOD_TELEFRAG:
+ case MOD_TELEFRAGDEFLECT:
+ sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
+ return;
+ case MOD_DROWN:
+ DeathBubbles(1);
+ if (random() > 0.5)
+ sound (self, CHAN_VOICE, "player/drown1.wav", 1, ATTN_NORM);
+ else
+ sound (self, CHAN_VOICE, "player/drown2.wav", 1, ATTN_NORM);
+ return;
+ case MOD_SLIME:
+ // FIX ME: put in some steam here
+ if (self.waterlevel == 3)
+ DeathBubbles(1);
+ case MOD_LAVA:
+ if (random() > 0.5)
+ sound (self, CHAN_VOICE, "player/lburn1.wav", 1, ATTN_NORM);
+ else
+ sound (self, CHAN_VOICE, "player/lburn2.wav", 1, ATTN_NORM);
+ return;
+ default:
+ if (self.health >= 40)
+ stuffcmd(self,"play player/hit1.wav\n");
+ //else
+ //stuffcmd(self,"play player/pain1.wav\n");
+
+ }
+};
+void() Player_PainAnimation =
+{
+ self.pain_time = time + .4;
+ PainSound();
+};
+
+void() player_pain =
+{
+ if (self.weaponstate != WS_IDLE)
+ return;
+
+ if (self.invisible_finished > time)
+ return; // eyes don't have pain frames
+
+ Player_PainAnimation ();
+};
+
+void() DeathBubblesSpawn =
+{
+local entity bubble;
+ if (self.owner.waterlevel != 3)
+ {
+ remove(self);
+ return;
+ }
+ bubble = spawn();
+ setmodel (bubble, "progs/s_bubble.spr");
+ setorigin (bubble, self.owner.origin + '0 0 24');
+ bubble.movetype = MOVETYPE_NOCLIP;
+ bubble.solid = SOLID_NOT;
+ bubble.velocity = '0 0 15';
+ bubble.nextthink = time + 0.5;
+ bubble.think = bubble_bob;
+ bubble.classname = "bubble";
+ bubble.frame = 0;
+ bubble.bubble_state = 0;
+ setsize (bubble, '-8 -8 -8', '8 8 8');
+ self.nextthink = time + 0.1;
+ self.think = DeathBubblesSpawn;
+ self.bubble_count = self.bubble_count - 1;
+ if (self.bubble_count <= 0)
+ remove(self);
+};
+
+void(float num_bubbles) DeathBubbles =
+{
+local entity bubble_spawner;
+
+ bubble_spawner = spawn();
+ setorigin (bubble_spawner, self.origin);
+ bubble_spawner.movetype = MOVETYPE_NONE;
+ bubble_spawner.solid = SOLID_NOT;
+ bubble_spawner.nextthink = time + 0.1;
+ bubble_spawner.think = DeathBubblesSpawn;
+ bubble_spawner.owner = self;
+ bubble_spawner.bubble_count = num_bubbles;
+};
+
+
+void() DeathSound =
+{
+local float rs;
+
+ // water death sounds
+ if (self.waterlevel == 3)
+ {
+ DeathBubbles(5);
+ sound (self, CHAN_VOICE, "player/h2odeath.wav", 1, ATTN_NONE);
+ return;
+ }
+
+ rs = rint ((random() * 1) + 1);
+ if (rs == 1)
+ stuffcmd (self, "play player/death1.wav\n");
+ if (rs == 2)
+ stuffcmd (self, "play player/death1.wav\n");
+
+};
+
+void() PlayerDead =
+{
+ self.nextthink = -1;
+// allow respawn after a certain time
+ self.deadflag = DEAD_DEAD;
+};
+
+vector(float dm) VelocityForDamage =
+{
+ local vector v;
+
+ if (vlen(damage_inflictor.velocity)>0)
+ {
+ v = 0.5 * damage_inflictor.velocity;
+ v = v + (25 * normalize(self.origin-damage_inflictor.origin));
+ v_z = 100 + 240 * random();
+ v_x = v_x + (200 * crandom());
+ v_y = v_y + (200 * crandom());
+ //dprint ("Velocity gib\n");
+ }
+ else
+ {
+ v_x = 100 * crandom();
+ v_y = 100 * crandom();
+ v_z = 200 + 100 * random();
+ }
+
+ //v_x = 100 * crandom();
+ //v_y = 100 * crandom();
+ //v_z = 200 + 100 * random();
+
+ if (dm > -50)
+ {
+ // dprint ("level 1\n");
+ v = v * 0.7;
+ }
+ else if (dm > -200)
+ {
+ // dprint ("level 3\n");
+ v = v * 2;
+ }
+ else
+ v = v * 10;
+
+ return v;
+};
+
+void(string gibname, float dm) ThrowGib =
+{
+ local entity new;
+
+ new = spawn();
+ new.origin = self.origin;
+ setmodel (new, gibname);
+ setsize (new, '0 0 0', '0 0 0');
+ new.velocity = VelocityForDamage (dm);
+ new.movetype = MOVETYPE_BOUNCE;
+ new.solid = SOLID_NOT;
+ new.avelocity_x = random()*600;
+ new.avelocity_y = random()*600;
+ new.avelocity_z = random()*600;
+ new.think = SUB_Remove;
+ new.nextthink = time + 10 + random()*10;
+ new.frame = 0;
+ new.flags = 0;
+};
+
+void(string gibname, float dm) ThrowHead =
+{
+ setmodel (self, gibname);
+ self.frame = 0;
+ self.nextthink = -1;
+ self.movetype = MOVETYPE_BOUNCE;
+ self.takedamage = DAMAGE_NO;
+ self.solid = SOLID_NOT;
+ self.view_ofs = '0 0 8';
+ setsize (self, '-16 -16 0', '16 16 56');
+ self.velocity = VelocityForDamage (dm);
+ self.origin_z = self.origin_z - 24;
+ self.flags = self.flags - (self.flags & FL_ONGROUND);
+ self.avelocity = crandom() * '0 600 0';
+};
+
+
+void() GibPlayer =
+{
+ ThrowHead ("progs/h_player.mdl", self.health);
+ ThrowGib ("progs/gib1.mdl", self.health);
+ ThrowGib ("progs/gib2.mdl", self.health);
+ ThrowGib ("progs/gib3.mdl", self.health);
+
+ self.deadflag = DEAD_DEAD;
+
+ if (damage_attacker.classname == "teledeath")
+ {
+ sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
+ return;
+ }
+
+ if (random() < 0.5)
+ sound (self, CHAN_VOICE, "player/gib.wav", 1, ATTN_NONE);
+ else
+ sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NONE);
+
+ stuffcmd(self,"chase_active 1\n");
+ self.setup_death = #TRUE;
+};
+
+void() PlayerDropStuff =
+{
+ local string s, t;
+
+ if (numberserverinfokey("dq") != 0)
+ {
+ if (self.super_damage_finished > time)
+ {
+ DropQuad (self.super_damage_finished - time);
+ s = ftos(rint(self.super_damage_finished - time));
+ t = " lost a quad with ";
+ if (deathmatch == 4)
+ t = " lost an OctaPower with ";
+ bprint4 (PRINT_LOW, self.netname, t, s, " seconds remaining\n");
+ }
+ }
+
+ if (numberserverinfokey("dr") != 0)
+ {
+ if (self.invisible_finished > time)
+ {
+ s = ftos(rint(self.invisible_finished - time));
+ bprint4 (PRINT_LOW, self.netname, " lost a ring with ", s, " seconds remaining\n");
+ DropRing (self.invisible_finished - time);
+ }
+ }
+
+ //DropBackpack();
+ ThrowWeapon(self.weapon, 1);
+}
+
+void () Player_RunDeath = [ 0, Player_RunDeath ]
+{
+ self.walkframe++;
+ self.frame = (Player_GetFrame(self.death_type, 0) - 1) + self.walkframe;
+ if (self.frame >= (Player_GetFrame(self.death_type, 1) - 1))
+ {
+ PlayerDead();
+ return;
+ }
+};
+
+void () Player_AnimateDeath =
+{
+ local float i, dtype;
+
+ i = random();
+
+ if (i < 0.5)
+ dtype = PLAYER_DEATH1;
+ else
+ dtype = PLAYER_DEATH2;
+
+ self.death_type = dtype;
+ self.walkframe = 0;
+ self.frame = Player_GetFrame(self.death_type, 0) - 1;
+ Player_RunDeath ();
+};
+
+
+void() PlayerDie =
+{
+ self.items = self.items - (self.items & IT_INVISIBILITY);
+
+CTF_Flag_Drop();
+
+ PlayerDropStuff();
+
+ self.invisible_finished = 0; // don't die as eyes
+ self.invincible_finished = 0;
+ self.super_damage_finished = 0;
+ self.radsuit_finished = 0;
+ self.modelindex = modelindex_player; // don't use eyes
+
+ self.weaponmodel="";
+ self.view_ofs = '0 0 -8';
+ self.deadflag = DEAD_DYING;
+ self.solid = SOLID_NOT;
+ self.flags = self.flags - (self.flags & FL_ONGROUND);
+ self.movetype = MOVETYPE_TOSS;
+ if (self.velocity_z < 10)
+ self.velocity_z = self.velocity_z + random()*300;
+ /*
+ if (self.nade_lives == 4)
+ {
+ DeathNade(self.origin)
+ DeathNade(self.origin)
+ DeathNade(self.origin)
+ DeathNade(self.origin)
+ }
+ if (self.nade_lives == 3)
+ {
+ DeathNade(self.origin)
+ DeathNade(self.origin)
+ DeathNade(self.origin)
+ }
+ if (self.nade_lives == 2)
+ {
+ DeathNade(self.origin)
+ DeathNade(self.origin)
+ }
+ if (self.nade_lives == 1)
+ {
+ DeathNade(self.origin)
+ }
+ */
+ DeathSound();
+
+ self.angles_x = 0;
+ self.angles_z = 0;
+
+ Set_FOV( FOV_DEFAULT );
+ self.pfov = FOV_DEFAULT;
+
+ stuffcmd(self,"chase_active 1\n");
+ self.setup_death = #TRUE;
+
+ Player_AnimateDeath ();
+};
+
+void() set_suicide_frame =
+{ // used by klill command and diconnect command
+ PlayerDie();
+
+ /*
+ if (self.model != "progs/player.mdl")
+ return; // allready gibbed
+ self.frame = 0;//$deatha11; // XAVIOR: FIXME
+ self.solid = SOLID_NOT;
+ self.movetype = MOVETYPE_TOSS;
+ self.deadflag = DEAD_DEAD;
+ self.nextthink = -1;
+ */
+}
+
+void () pull_finished =
+{
+ self.donefire = 1;
+ self.weaponframe = 0;
+ player_run ();
+};
+
+void() player_generic_pull =
+{
+self.weaponframe += 1;
+if (self.weaponframe >= 1)
+ {
+ pull_finished();
+ return;
+ }
+if (self.weaponframe == 2)
+ {
+ sound (self, CHAN_WEAPON, "weapons/equip/ppist.wav", 1, ATTN_NORM);
+ }
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+
+void() player_needler_pull =
+{
+self.weaponframe += 1;
+if (self.weaponframe >= 68)
+ {
+ pull_finished();
+ return;
+ }
+if (self.weaponframe == 59)
+ {
+ sound (self, CHAN_WEAPON, "weapons/equip/needler.wav", 1, ATTN_NORM);
+ }
+
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+void() player_ppist_pull =
+{
+self.weaponframe += 1;
+if (self.weaponframe >= 56)
+ {
+ pull_finished();
+ return;
+ }
+if (self.weaponframe == 51)
+ {
+ sound (self, CHAN_WEAPON, "weapons/equip/ppist.wav", 1, ATTN_NORM);
+ }
+
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+void() player_sniper_pull =
+{
+self.weaponframe += 1;
+if (self.weaponframe >= 53)
+ {
+ pull_finished();
+ return;
+ }
+if (self.weaponframe == 46)
+ {
+ sound (self, CHAN_WEAPON, "weapons/equip/sniper.wav", 1, ATTN_NORM);
+ }
+
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+void() player_rl_pull =
+{
+self.weaponframe += 1;
+if (self.weaponframe >= 79)
+ {
+ pull_finished();
+ return;
+ }
+if (self.weaponframe == 70)
+ {
+ sound (self, CHAN_WEAPON, "weapons/equip/rocket.wav", 1, ATTN_NORM);
+ }
+
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+void() player_uzi_pull =
+{
+self.weaponframe += 1;
+if (self.weaponframe >= 40)
+ {
+ pull_finished();
+ return;
+ }
+if (self.weaponframe == 36)
+ {
+ sound (self, CHAN_WEAPON, "weapons/equip/smg.wav", 1, ATTN_NORM);
+ }
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+void() player_shotgun_pull =
+{
+self.weaponframe += 1;
+if (self.weaponframe >= 48)
+ {
+ pull_finished();
+ return;
+ }
+if (self.weaponframe == 46)
+ {
+ sound (self, CHAN_WEAPON, "weapons/equip/shotgun.wav", 1, ATTN_NORM);
+ }
+
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+
+void() player_ar_pull =
+{
+self.weaponframe += 1;
+if (self.weaponframe >= 55)
+ {
+ pull_finished();
+ return;
+ }
+if (self.weaponframe == 46)
+ {
+ sound (self, CHAN_WEAPON, "weapons/equip/ar.wav", 1, ATTN_NORM);
+ }
+
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+void() player_shot_pull =
+{
+
+self.weaponframe += 1;
+
+if (self.weaponframe >= 62)
+ {
+ pull_finished();
+ return;
+ }
+if (self.weaponframe == 53)
+ {
+ sound (self, CHAN_WEAPON, "weapons/equip/pistol.wav", 1, ATTN_NORM);
+ }
+
+ SuperDamageSound ();
+ self.attack_finished = (time + 0.2);
+ self.impulse = MSG_BROADCAST;
+};
+
+void() player_pull = [ 0, player_pull ]
+{
+ local float ftype;
+ ftype = PLAYER_PULL;
+
+ // allow players to interrupt reload for melee/nade throw
+ if (self.impulse == 29) {
+ pre_player_melee ();
+ return;
+ }
+ else if (self.impulse == 28) {
+
+ {
+ Set_FOV ( FOV_DEFAULT );
+ self.pfov = FOV_DEFAULT;
+ if (self.selnade == GRENADE_REGULAR)
+ {
+ if (self.nade_lives > 0) {
+ pre_player_throw_grenade ();
+ self.nade_lives -= 1;
+ sprint (self, ftos(self.nade_lives));
+ sprint (self, " grenades\n");
+ return; }
+ else
+ centerprint (self, "No Grenades\n");
+ }
+ else
+ {
+ if (self.plasma_lives > 0) {
+ pre_player_throw_grenade ();
+ self.plasma_lives -= 1;
+ sprint (self, ftos(self.plasma_lives));
+ sprint (self, " Plasma grenades\n");
+ return; }
+ else
+ centerprint (self, "No Plasma Grenades\n");
+ }
+ }
+}
+ else if (self.pull_time == -1) {
+ self.pull_time = time + .6;
+ player_run();
+ return;
+ }
+
+ switch (self.weapon) {
+ case WEAPON_PISTOL:
+ startwframe(self, 52);
+ player_shot_pull ();
+ break;
+ case WEAPON_SHOT:
+ startwframe(self, 41);
+ player_shotgun_pull ();
+ break;
+ case WEAPON_AR:
+ startwframe(self, 45);
+ player_ar_pull ();
+ break;
+ case WEAPON_UZI:
+ startwframe (self, 34);
+ player_uzi_pull ();
+ break;
+ case WEAPON_RL:
+ startwframe (self, 69);
+ player_rl_pull ();
+ break;
+ case WEAPON_SNIPER:
+ startwframe (self, 43);
+ player_sniper_pull ();
+ break;
+ case WEAPON_PPISTOL:
+ startwframe (self, 50);
+ player_ppist_pull ();
+ break;
+ case WEAPON_NEEDLER:
+ startwframe (self, 58);
+ player_needler_pull ();
+ break;
+ default:
+ startwframe (self, 1);
+ player_generic_pull ();
+ break;
+ }
+
+ self.frame = Player_GetFrame(ftype, 0);
+ if ((self.frame + self.fireframe) > Player_GetFrame(ftype, 1)) {
+ if (self.weaponframe == 0) {
+ self.melee_time = 0;
+ self.donefire = 0;
+ self.fireframe = 0;
+ player_run();
+ return;
+ }
+ else {
+ self.fireframe = 5;
+ //self.frame = Player_GetFrame(ftype, 0) + 3;
+ }
+
+ }
+
+ self.frame = self.frame + self.fireframe;
+
+ self.fireframe = self.fireframe + 1;
+};
+
+void () pre_player_pull =
+{
+ player_pull ();
+ self.weaponframe = 0;
+ self.fireframe = 0;
+ self.frame = Player_GetFrame(PLAYER_PULL, 0);
+};
diff --git a/r17/Revamped src/Revamped QC/progs.src b/r17/Revamped src/Revamped QC/progs.src
new file mode 100755
index 00000000..d37120e0
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/progs.src
@@ -0,0 +1,88 @@
+// First non-comment character must be # to use
+// "new style" progs.src
+#pragma PROGS_DAT ../qwprogs.dat
+
+// uncomment based on desired compile
+#define NETQUAKE
+// #define FTE
+#define MONSTERS
+#define REPLACEMENTS
+
+// compile options
+#ifdef NETQUAKE
+// if netquake, use progs.dat file name
+#pragma PROGS_DAT ../progs.dat
+#endif
+
+#ifdef FTE
+// if FTE, use FTE style progs and use fteprogs.dat file name
+#pragma target fte
+#pragma PROGS_DAT fteprogs.dat
+#endif
+
+// includes
+#include "defs.qc"
+#include "sol_defs.qc"
+#include "engine.qc"
+
+// frikbot
+#include "frikbot/bot.qc"
+#include "frikbot/bot_way.qc"
+#include "frikbot/bot_fight.qc"
+#include "frikbot/bot_ai.qc"
+#include "frikbot/bot_misc.qc"
+#include "frikbot/bot_phys.qc"
+#include "frikbot/bot_move.qc"
+#include "frikbot/bot_ed.qc"
+
+#include "subs.qc"
+#include "effects.qc"
+#include "obituary.qc"
+#include "combat.qc"
+#include "items.qc"
+#include "proj.qc"
+#include "weapons.qc"
+#include "NeedleAI.qc"
+
+
+
+#include "world.qc"
+#include "ctf.qc"
+#include "client.qc"
+#include "spectate.qc"
+#include "player.qc"
+#include "doors.qc"
+#include "buttons.qc"
+#include "triggers.qc"
+#include "plats.qc"
+#include "misc.qc"
+
+#include "sol_items.qc"
+#include "sol_misc.qc"
+
+#ifdef MONSTERS
+#include "fight.qc"
+#include "ai.qc"
+#include "monsters.qc"
+#include "quakemons/dog.qc"
+#include "quakemons/soldier.qc"
+#include "quakemons/enforcer.qc"
+#include "quakemons/ogre.qc"
+#include "quakemons/wizard.qc"
+#include "quakemons/demon.qc"
+#include "quakemons/knight.qc"
+#include "quakemons/hknight.qc"
+#include "quakemons/shalrath.qc"
+#include "quakemons/shambler.qc"
+#include "quakemons/fish.qc"
+#include "quakemons/tarbaby.qc"
+#include "quakemons/zombie.qc"
+#include "quakemons/boss.qc"
+#include "quakemons/oldone.qc"
+#else
+#include "nomonst.qc"
+#endif
+
+#ifdef REPLACEMENTS
+#include "replace.qc"
+#endif
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/proj.qc b/r17/Revamped src/Revamped QC/proj.qc
new file mode 100755
index 00000000..1d2f5e98
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/proj.qc
@@ -0,0 +1,220 @@
+
+// Generic projectile spawning code (PRJ) ---
+// projectile effect enumerator
+enum {
+ PE_NONE,
+ PE_SPIKE,
+ PE_SUPERSPIKE,
+ PE_WIZSPIKE,
+ PE_KNIGHTSPIKE,
+ PE_GUNSHOT,
+ PE_EXPLOSION,
+ PE_EXPLOSIONGROUND,
+ PE_LASER,
+ PE_ZOMBIEGIB
+};
+
+// functions used only by this QC file
+float() _PRJ_Bounce =
+{
+ if (other.takedamage == DAMAGE_AIM)
+ return 0; // explode
+
+ sound (self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM); // bounce sound
+ if (self.velocity == '0 0 0')
+ self.avelocity = '0 0 0';
+
+ return 1; // keep bouncing
+};
+
+float() _PRJ_Remove =
+{
+ remove(self);
+ return 1; // stop execution within touch function
+};
+
+float() _PRJ_Stop =
+{
+ if (other.takedamage)
+ return 0;
+
+ sound (self, CHAN_WEAPON, "zombie/z_miss.wav", 1, ATTN_NORM); // bounce sound
+ self.velocity = '0 0 0';
+ self.avelocity = '0 0 0';
+ self.proj_touch = _PRJ_Remove;
+ return 1; // keep the entity alive
+};
+
+void() _PRJ_Touch =
+{
+ local entity ignore;
+
+ // check validity of projectile
+ if (other == self.owner)
+ return; // don't explode on owner
+
+ if (self.voided) {
+ return;
+ }
+
+ if (pointcontents(self.origin) == CONTENT_SKY)
+ {
+ remove(self);
+ return;
+ }
+
+ // handle custom touch
+ if (other != self) // didn't expire
+ if (self.proj_touch) // is valid function
+ if (self.proj_touch())
+ return;
+
+ // void projectile
+ self.voided = 1;
+
+ // do projectile damage
+ ignore = self;
+
+ if (other.health >= 1 && self.damage_direct)
+ {
+ T_Damage (other, self, self.owner, self.damage_direct, self.mod_direct);
+ ignore = other;
+ }
+
+ if (self.radius_exp)
+ T_RadiusDamage (self, self.owner, self.damage_exp, self.radius_exp, ignore, self.mod_exp);
+
+ // run projectile effect
+ switch (self.proj_effect)
+ {
+ case PE_SPIKE:
+ if (ignore != self) // hit something
+ spawn_touchblood (self.damage_direct);
+ else if (other != self) // didn't expire
+ TE_spike(self.origin);
+ break;
+ case PE_SUPERSPIKE:
+ if (ignore != self) // hit something
+ spawn_touchblood (self.damage_direct);
+ else if (other != self) // didn't expire
+ TE_superspike(self.origin);
+ break;
+ case PE_WIZSPIKE:
+ if (ignore != self) // hit something
+ spawn_touchblood (self.damage_direct);
+ else if (other != self) // didn't expire
+ TE_wizspike(self.origin);
+ break;
+ case PE_KNIGHTSPIKE:
+ if (ignore != self) // hit something
+ spawn_touchblood (self.damage_direct);
+ else if (other != self) // didn't expire
+ TE_knightspike(self.origin);
+ break;
+ case PE_LASER:
+ if (other != self)
+ sound (self, CHAN_WEAPON, "enforcer/enfstop.wav", 1, ATTN_STATIC);
+ self.origin = self.origin - 8 * normalize(self.velocity);
+ case PE_GUNSHOT:
+ if (ignore != self) // hit something
+ spawn_touchblood (self.damage_direct);
+ else if (other != self) // didn't expire
+ TE_gunshot(self.origin);
+ break;
+ case PE_EXPLOSION:
+ self.origin = self.origin - 8 * normalize(self.velocity);
+ case PE_EXPLOSIONGROUND:
+ TE_explosion(self.origin);
+ break;
+ case PE_ZOMBIEGIB:
+ sound (self, CHAN_WEAPON, "zombie/z_hit.wav", 1, ATTN_NORM);
+ break;
+ }
+
+ remove(self);
+};
+
+void() _PRJ_Expire =
+{
+ other = self;
+ _PRJ_Touch();
+};
+
+void() _PRJ_Think =
+{
+ if (self.expire_time > time)
+ {
+ _PRJ_Expire();
+ return;
+ }
+
+ self.nextthink = time + self.proj_think_time;
+ self.proj_think(); // projectile could remove itself here
+};
+
+// functions used by outside QC files
+// set bouncy projectile function
+void() PRJ_SetBouncyProjectile =
+{
+ newmis.proj_touch = _PRJ_Bounce;
+ newmis.movetype = MOVETYPE_BOUNCE;
+ newmis.avelocity = '300 300 300';
+};
+
+// set tossed projectile (zombie gib) function
+void() PRJ_SetTossedProjectile =
+{
+ newmis.proj_touch = _PRJ_Stop;
+ newmis.movetype = MOVETYPE_BOUNCE;
+ newmis.avelocity = '3000 1000 2000';
+};
+
+// set radius damage function
+void(INTEGER damg, INTEGER damgrad, INTEGER damgmod) PRJ_SetRadiusDamage =
+{
+ newmis.damage_exp = damg;
+ newmis.radius_exp = damgrad;
+ newmis.mod_exp = damgmod;
+};
+
+// extra think function, should always be called ONCE after the main spawn function
+void(void() thinkfunc, float thinktimeinit, float thinkres) PRJ_SetThink =
+{
+ newmis.think = _PRJ_Think;
+ newmis.nextthink = time + thinktimeinit;
+ newmis.proj_think = thinkfunc;
+ newmis.proj_think_time = thinkres;
+};
+
+// extra touch function
+void(float() touchfunc) PRJ_SetTouch =
+{
+ newmis.proj_touch = touchfunc;
+};
+
+// main spawning function
+void(entity parent, string modl, vector org, vector vel, INTEGER effect, INTEGER damg, INTEGER damgmod, float expiretime) PRJ_FireProjectile =
+{
+ newmis = spawn ();
+ newmis.owner = parent;
+ newmis.movetype = MOVETYPE_FLYMISSILE;
+ newmis.solid = SOLID_BBOX;
+// newmis.classname = class;
+ newmis.velocity = vel;
+
+ newmis.damage_direct = damg;
+ newmis.mod_direct = damgmod;
+ newmis.proj_effect = effect;
+
+ newmis.touch = _PRJ_Touch;
+ newmis.expire_time = time + expiretime;
+
+ newmis.think = _PRJ_Expire;
+ newmis.nextthink = time + expiretime;
+
+ newmis.angles = vectoangles(newmis.velocity);
+
+ setmodel (newmis, modl);
+ setsize (newmis, VEC_ORIGIN, VEC_ORIGIN);
+ setorigin (newmis, org);
+};
diff --git a/r17/Revamped src/Revamped QC/quakemons/Elite.qc b/r17/Revamped src/Revamped QC/quakemons/Elite.qc
new file mode 100755
index 00000000..7e7aaeae
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/quakemons/Elite.qc
@@ -0,0 +1,83 @@
+
+//Credit to Frag.machine for partial code!
+void () info_elite_think =
+{
+ local float r;
+ r = floor(random()*4);
+
+ if (TOTAL_MONS <= MAX_MONS) //Prevents spawning, so Waves can be set.
+ {
+ if (r == 0)
+ {
+ normal_elite();
+ }
+ else if (r == 1)
+ {
+ normal_grunt();
+ }
+ else if (r == 2)
+ {
+ if (round < 3)
+ normal_elite() || normal_grunt();
+ else
+ red_elite(); //Sets a limitation, so Red Elites don't appear until Round 3
+ }
+ else if (r == 3)
+ {
+ if (round < 4)
+ normal_elite() || normal_grunt() || red_elite(); //Randomly picks an enemy to spawn.
+ else
+ white_elite();
+ }
+ }
+
+ // finally, let's schedule the execution of our "think" function
+ self.think = info_elite_think;
+ self.nextthink = (time + 5);
+};
+
+void () info_elite_start =
+{
+
+ kill_count();
+ FIREFIGHT = 1; //Sets Firefight to 1, so there are lives in play.
+ localcmd ("teamplay 1\n");
+ F_LIVES = 7;
+ localcmd ("cl_life 8\n");
+
+ precache_sound ("firefight.wav");
+
+ precache_model ("progs/elite.mdl");
+ precache_model ("progs/h_elite.mdl");
+ precache_model ("progs/grenade.mdl");
+
+ precache_sound ("elite/ogdrag.wav");
+ precache_sound ("elite/ogdth.wav");
+ precache_sound ("elite/ogpain1.wav");
+ precache_sound ("elite/ogsawatk.wav");
+ precache_sound ("elite/ogwake.wav");
+ precache_sound ("elite/laugh1.wav");
+ precache_sound ("elite/laugh2.wav");
+
+ //Grunts
+ precache_model ("progs/soldier.mdl");
+ precache_model ("progs/h_guard.mdl");
+
+ precache_sound ("soldier/death1.wav");
+ precache_sound ("soldier/idle.wav");
+ precache_sound ("soldier/pain1.wav");
+ precache_sound ("soldier/pain2.wav");
+ precache_sound ("soldier/sight1.wav");
+ precache_sound ("soldier/laugh1.wav");
+ precache_sound ("soldier/laugh2.wav");
+
+ precache_sound ("soldier/unstoppable.wav");
+ precache_sound ("soldier/kill_all.wav");
+
+
+ self.enemy = world;
+
+
+ self.think = info_elite_think;
+ self.nextthink = time + 5;
+};
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/quakemons/Firefight_random.qc b/r17/Revamped src/Revamped QC/quakemons/Firefight_random.qc
new file mode 100755
index 00000000..8ad538cc
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/quakemons/Firefight_random.qc
@@ -0,0 +1,192 @@
+
+
+void() normal_elite =
+{
+ local entity oldself;
+
+ if (self.enemy != world)
+ {
+ if (self.enemy.health <= 0)
+ {
+ self.enemy = world;
+ }
+ }
+
+ if (self.enemy == world)
+ {
+ oldself = self;
+ self = spawn ();
+ self.classname = "Needle-spikes";
+ setorigin (self, oldself.origin);
+ self.origin_z = self.origin_z + 2;
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+ setmodel (self, "progs/elite.mdl");
+ self.skin = 0;
+ setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
+ self.health = 200;
+ self.elite = 0;
+ self.th_stand = elite_stand1;
+ self.th_walk = elite_walk1;
+ self.th_run = elite_run1;
+ self.th_die = elite_die;
+ self.th_melee = elite_melee;
+ self.th_missile = elite_nail1;
+ self.th_pain = elite_pain;
+
+ if (oldself.target != string_null)
+ {
+ self.target = oldself.target;
+ }
+
+ walkmonster_start();
+
+ oldself.enemy = self;
+ self = oldself;
+ TOTAL_MONS += 1; //Adds a monster to the world, so that waves can be set.
+ }
+
+};
+
+void() red_elite =
+{
+ local entity oldself;
+
+ if (self.enemy != world)
+ {
+ if (self.enemy.health <= 0)
+ {
+ self.enemy = world;
+ }
+ }
+
+ if (self.enemy == world)
+ {
+ oldself = self;
+ self = spawn ();
+ self.classname = "Needle-spikes";
+ setorigin (self, oldself.origin);
+ self.origin_z = self.origin_z + 2;
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+ setmodel (self, "progs/elite.mdl");
+ self.skin = 1;
+ setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
+ self.health = 300;
+ self.elite = 1; //States what Elite type it is, so Different stats/weapons can be set.
+ self.th_stand = elite_stand1;
+ self.th_walk = elite_walk1;
+ self.th_run = elite_run1;
+ self.th_die = elite_die;
+ self.th_melee = elite_melee;
+ self.th_missile = elite_nail1;
+ self.th_pain = elite_pain;
+
+ if (oldself.target != string_null)
+ {
+ self.target = oldself.target;
+ }
+
+ walkmonster_start();
+
+ oldself.enemy = self;
+ self = oldself;
+ TOTAL_MONS += 1;
+ }
+
+};
+void() white_elite =
+{
+ local entity oldself;
+
+ if (self.enemy != world)
+ {
+ if (self.enemy.health <= 0)
+ {
+ self.enemy = world;
+ }
+ }
+
+ if (self.enemy == world)
+ {
+ oldself = self;
+ self = spawn ();
+ self.classname = "Needle-spikes";
+ setorigin (self, oldself.origin);
+ self.origin_z = self.origin_z + 2;
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+ setmodel (self, "progs/elite.mdl");
+ self.skin = 3;
+ setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
+ self.health = 400;
+ self.elite = 2;
+ self.th_stand = elite_stand1;
+ self.th_walk = elite_walk1;
+ self.th_run = elite_run1;
+ self.th_die = elite_die;
+ self.th_melee = elite_melee;
+ self.th_missile = elite_nail1;
+ self.th_pain = elite_pain;
+
+ if (oldself.target != string_null)
+ {
+ self.target = oldself.target;
+ }
+
+ walkmonster_start();
+
+ oldself.enemy = self;
+ self = oldself;
+ TOTAL_MONS += 1;
+ }
+
+};
+
+void() normal_grunt =
+{
+ local entity oldself;
+
+ if (self.enemy != world)
+ {
+ if (self.enemy.health <= 0)
+ {
+ self.enemy = world;
+ }
+ }
+
+ if (self.enemy == world)
+ {
+ oldself = self;
+ self = spawn ();
+ self.classname = "Needle-spikes";
+ setorigin (self, oldself.origin);
+ self.origin_z = self.origin_z + 2;
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+ setmodel (self, "progs/soldier.mdl");
+ self.skin = 0;
+ self.elite = 1; //For Melee damage
+ setsize (self, '-16 -16 -24', '16 16 40');
+ self.health = 40 * round/1.5;
+ self.th_stand = army_stand1;
+ self.th_walk = army_walk1;
+ self.th_run = army_run1;
+ self.th_missile = army_atk1;
+ self.th_pain = army_pain;
+ self.th_die = army_die;
+ self.th_melee = grunt_melee1;
+
+ if (oldself.target != string_null)
+ {
+ self.target = oldself.target;
+ }
+
+ walkmonster_start();
+
+ oldself.enemy = self;
+ self = oldself;
+ TOTAL_MONS += 1;
+ }
+
+};
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/quakemons/ai_anims.qc b/r17/Revamped src/Revamped QC/quakemons/ai_anims.qc
new file mode 100755
index 00000000..a4e2b7ce
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/quakemons/ai_anims.qc
@@ -0,0 +1,685 @@
+void() info_elite_think;
+
+void() kill_count =
+{
+if (round_kills == 0)
+{
+localcmd ("cl_round 1\n");
+TOTAL_MONS = 0;
+MAX_MONS = 3; //4 Max Monsters. 0-1-2-3
+round = 1;
+}
+
+if (round_kills == 4)
+{
+localcmd ("cl_round 2\n");
+TOTAL_MONS = 0;
+MAX_MONS = 5;
+round = 2;
+}
+
+if (round_kills == 10)
+{
+localcmd ("cl_round 3\n");
+TOTAL_MONS = 0;
+MAX_MONS = 9;
+round = 3;
+}
+
+if (round_kills == 20)
+{
+localcmd ("skill 2\n");
+localcmd ("cl_round 4\n");
+TOTAL_MONS = 0;
+MAX_MONS = 9;
+round = 4;
+
+}
+
+if (round_kills == 30)
+{
+F_LIVES += 1; //Increase the players life for making it this far.
+localcmd ("cl_round 5\n");
+TOTAL_MONS = 0;
+MAX_MONS = 14;
+round = 5;
+}
+
+if (round_kills == 45)
+{
+localcmd ("cl_round 6\n");
+TOTAL_MONS = 0;
+MAX_MONS = 19;
+round = 6;
+}
+
+if (round_kills == 65)
+{
+localcmd ("skill 3\n");
+localcmd ("cl_round 7\n");
+TOTAL_MONS = 0;
+MAX_MONS = 34;
+round = 7;
+}
+
+if (round_kills == 100)
+{
+TOTAL_MONS = 0;
+MAX_MONS = 34;
+localcmd ("cl_round 8\n");
+round = 8;
+}
+if (round_kills == 150)
+{
+TOTAL_MONS = 0;
+MAX_MONS = 49;
+localcmd ("cl_round 8\n");
+round = 9;
+centerprint (self, "Congrats! You have completed Firefight! Shoot to Retry.\n");
+if (self.button0)
+localcmd ("map spawn\n");
+}
+
+};
+
+/*
+===========================================================
+
+WEAPON SHOOTING
+This Enables Various Weapons to be used by Monster AI
+============================================================
+*/
+//Shoot the Plasma Pistol
+void() Enemy_Fire_PPist =
+{
+ local vector dir;
+ local entity en;
+
+ ai_face();
+
+ //sound (self, CHAN_WEAPON, "soldier/.wav", 1,ATTN_NORM);
+ en = self.enemy;
+ dir = en.origin - en.velocity*0.2;
+ dir = normalize (dir - self.origin);
+
+ W_FirePPistol( self.weaponheat );
+};
+
+//Shoot the Needler
+void() Enemy_Fire_Needler =
+{
+ local vector dir;
+ local entity en;
+
+ ai_face();
+
+ //sound (self, CHAN_WEAPON, "soldier/.wav", 1,ATTN_NORM);
+ en = self.enemy;
+ dir = en.origin - en.velocity*0.2;
+ dir = normalize (dir - self.origin);
+
+ W_FireNeedler();
+};
+/*
+==============================================================================
+
+ELITE
+
+==============================================================================
+*/
+
+$cd id1/models/elite_c
+$origin 0 0 24
+$base base
+$skin base
+
+$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9
+
+$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7
+$frame walk8 walk9 walk10 walk11 walk12 walk13 walk14 walk15 walk16
+
+$frame run1 run2 run3 run4 run5 run6 run7 run8
+
+$frame swing1 swing2 swing3 swing4 swing5 swing6 swing7
+$frame swing8 swing9 swing10 swing11 swing12 swing13 swing14
+
+$frame smash1 smash2 smash3 smash4 smash5 smash6 smash7
+$frame smash8 smash9 smash10 smash11 smash12 smash13 smash14
+
+$frame melee1 melee2 melee3 melee4 melee5 melee6 melee7
+$frame shoot1 shoot2 shoot3 shoot4 shoot5 shoot6 shoot7 shoot8 shoot9
+
+$frame pain1 pain2 pain3 pain4 pain5
+
+$frame painb1 painb2 painb3
+
+$frame painc1 painc2 painc3 painc4 painc5 painc6
+
+$frame paind1 paind2 paind3 paind4 paind5 paind6 paind7 paind8 paind9 paind10
+$frame paind11 paind12 paind13 paind14 paind15 paind16
+
+$frame paine1 paine2 paine3 paine4 paine5 paine6 paine7 paine8 paine9 paine10
+$frame paine11 paine12 paine13 paine14 paine15
+
+$frame death1 death2 death3 death4 death5 death6
+$frame death7 death8 death9 death10 death11 death12
+$frame death13 death14
+
+$frame bdeath1 bdeath2 bdeath3 bdeath4 bdeath5 bdeath6
+$frame bdeath7 bdeath8 bdeath9 bdeath10
+
+$frame pull1 pull2 pull3 pull4 pull5 pull6 pull7 pull8 pull9 pull10 pull11
+
+//=============================================================================
+
+//=============================================================================
+
+void() laugh =
+{
+local float r;
+r = random();
+if (r <= 0.025)
+sound (self, CHAN_AUTO, "elite/laugh1.wav", 1, ATTN_NORM);
+else if ( r <= 0.05)
+sound (self, CHAN_AUTO, "elite/laugh2.wav", 1, ATTN_NORM);
+else
+{}
+};
+/*
+================
+Elite Melee
+
+FIXME
+================
+*/
+void(float side) chainsaw =
+{
+local vector delta;
+local float ldmg;
+
+ if (!self.enemy)
+ return;
+ if (!CanDamage (self.enemy, self))
+ return;
+
+ ai_charge(10);
+
+ delta = self.enemy.origin - self.origin;
+
+ if (vlen(delta) > 100)
+ return;
+
+ if (self.elite == 0)
+ ldmg = (random() + random() + random()) * 10;
+ else if (self.elite == 1)
+ ldmg = (random() + random() + random()) * 15;
+ else if (self.elite == 2)
+ ldmg = (random() + random() + random()) * 20;
+ T_Damage (self.enemy, self, self, ldmg, MOD_OGRE);
+};
+
+
+void() elite_stand1 =[ $stand1, elite_stand2 ] {ai_stand();};
+void() elite_stand2 =[ $stand2, elite_stand3 ] {ai_stand();};
+void() elite_stand3 =[ $stand3, elite_stand4 ] {ai_stand(); laugh();};
+void() elite_stand4 =[ $stand4, elite_stand5 ] {ai_stand();};
+void() elite_stand5 =[ $stand5, elite_stand6 ] {
+ai_stand();
+};
+void() elite_stand6 =[ $stand6, elite_stand7 ] {ai_stand();};
+void() elite_stand7 =[ $stand7, elite_stand8 ] {ai_stand();};
+void() elite_stand8 =[ $stand8, elite_stand9 ] {ai_stand();};
+void() elite_stand9 =[ $stand9, elite_stand1 ] {ai_stand();};
+
+void() elite_walk1 =[ $walk1, elite_walk2 ] {ai_walk(3);};
+void() elite_walk2 =[ $walk2, elite_walk3 ] {ai_walk(2);};
+void() elite_walk3 =[ $walk3, elite_walk4 ] {
+ai_walk(2);
+};
+void() elite_walk4 =[ $walk4, elite_walk5 ] {ai_walk(2);};
+void() elite_walk5 =[ $walk5, elite_walk6 ] {ai_walk(2);};
+void() elite_walk6 =[ $walk6, elite_walk7 ] {
+ai_walk(5);
+if (random() < 0.1)
+ sound (self, CHAN_VOICE, "elite/ogdrag.wav", 1, ATTN_IDLE);
+};
+void() elite_walk7 =[ $walk7, elite_walk8 ] {ai_walk(6);};
+void() elite_walk8 =[ $walk8, elite_walk9 ] {ai_walk(4);};
+void() elite_walk9 =[ $walk9, elite_walk10 ] {ai_walk(6);};
+void() elite_walk10 =[ $walk10, elite_walk11 ] {ai_walk(2);};
+void() elite_walk11 =[ $walk11, elite_walk12 ] {ai_walk(4);};
+void() elite_walk12 =[ $walk12, elite_walk13 ] {ai_walk(6);};
+void() elite_walk13 =[ $walk13, elite_walk14 ] {ai_walk(6);};
+void() elite_walk14 =[ $walk14, elite_walk15 ] {ai_walk(6);};
+void() elite_walk15 =[ $walk15, elite_walk16 ] {ai_walk(6);};
+void() elite_walk16 =[ $walk16, elite_walk1 ] {ai_walk(8);};
+
+void() elite_run1 =[ $run1, elite_run2 ] {ai_run(18);
+};
+void() elite_run2 =[ $run2, elite_run3 ] {ai_run(15);};
+void() elite_run3 =[ $run3, elite_run4 ] {ai_run(15);};
+void() elite_run4 =[ $run4, elite_run5 ] {ai_run(15);};
+void() elite_run5 =[ $run5, elite_run6 ] {ai_run(15);};
+void() elite_run6 =[ $run6, elite_run7 ] {ai_run(15);};
+void() elite_run7 =[ $run7, elite_run8 ] {ai_run(15);};
+void() elite_run8 =[ $run8, elite_run1 ] {ai_run(15);};
+
+void() elite_swing1 =[ $swing1, elite_swing2 ] {ai_charge(11);
+sound (self, CHAN_WEAPON, "elite/ogsawatk.wav", 1, ATTN_NORM);
+};
+void() elite_swing2 =[ $swing2, elite_swing3 ] {ai_charge(1);};
+void() elite_swing3 =[ $swing3, elite_swing4 ] {ai_charge(4);};
+void() elite_swing4 =[ $swing4, elite_swing5 ] {ai_charge(13);};
+void() elite_swing5 =[ $swing5, elite_swing6 ] {ai_charge(9); };
+void() elite_swing6 =[ $swing6, elite_swing7 ] {};
+void() elite_swing7 =[ $swing7, elite_swing8 ] {};
+void() elite_swing8 =[ $swing8, elite_swing9 ] {};
+void() elite_swing9 =[ $swing9, elite_swing10 ] {chainsaw(0);self.angles_y = self.angles_y + random()* 10;};
+void() elite_swing10 =[ $swing10, elite_swing11 ] {chainsaw(0);self.angles_y = self.angles_y + random()* 10;};
+void() elite_swing11 =[ $swing11, elite_swing12 ] {};
+void() elite_swing12 =[ $swing12, elite_swing13 ] {ai_charge(3);};
+void() elite_swing13 =[ $swing13, elite_swing14 ] {ai_charge(8);};
+void() elite_swing14 =[ $swing14, elite_run1 ] {ai_charge(9);};
+
+void() elite_smash1 =[ $smash1, elite_smash2 ] {ai_charge(6);
+sound (self, CHAN_WEAPON, "elite/ogsawatk.wav", 1, ATTN_NORM);
+};
+void() elite_smash2 =[ $smash2, elite_smash3 ] {ai_charge(0);};
+void() elite_smash3 =[ $smash3, elite_smash4 ] {ai_charge(0);};
+void() elite_smash4 =[ $smash4, elite_smash5 ] {ai_charge(1);};
+void() elite_smash5 =[ $smash5, elite_smash6 ] {ai_charge(4);};
+void() elite_smash6 =[ $smash6, elite_smash7 ] {ai_charge(4); chainsaw(0);};
+void() elite_smash7 =[ $smash7, elite_smash8 ] {ai_charge(4);};
+void() elite_smash8 =[ $smash8, elite_smash9 ] {ai_charge(10);};
+void() elite_smash9 =[ $smash9, elite_smash10 ] {ai_charge(13);};
+void() elite_smash10 =[ $smash10, elite_smash11 ] {chainsaw(1);};
+void() elite_smash11 =[ $smash11, elite_smash12 ] {ai_charge(2);
+self.nextthink = time + 0.1 + random()*0.1;}; // slight variation
+//void() elite_smash12 =[ $smash12, elite_smash13 ] {ai_charge();};
+void() elite_smash12 =[$smash12, elite_smash13] {ai_charge(0);};
+void() elite_smash13 =[ $smash13, elite_smash14 ] {ai_charge(4);};
+void() elite_smash14 =[ $smash14, elite_run1 ] {ai_charge(12);};
+
+void() elite_nail1 =[ $run1, elite_nail2 ] {ai_face();};
+void() elite_nail2 =[ $run2, elite_nail3 ] {ai_face();};
+void() elite_nail3 =[ $run2, elite_nail4 ] {ai_face();};
+void() elite_nail4 =[ $run3, elite_nail5 ] {ai_face();
+if (self.elite == 0 || self.elite == 2)
+Enemy_Fire_PPist();
+if (self.elite == 1)
+Enemy_Fire_Needler();
+};
+void() elite_nail5 =[ $run4, elite_nail6 ] {ai_face();};
+void() elite_nail6 =[ $run5, elite_nail7 ] {ai_face();};
+void() elite_nail7 =[ $run6, elite_run1 ] {ai_face();};
+
+void() elite_pain1 =[ $pain1, elite_pain2 ] {};
+void() elite_pain2 =[ $pain2, elite_pain3 ] {};
+void() elite_pain3 =[ $pain3, elite_pain4 ] {};
+void() elite_pain4 =[ $pain4, elite_pain5 ] {};
+void() elite_pain5 =[ $pain5, elite_run1 ] {};
+
+
+void() elite_painb1 =[ $painb1, elite_painb2 ] {};
+void() elite_painb2 =[ $painb2, elite_painb3 ] {};
+void() elite_painb3 =[ $painb3, elite_run1 ] {};
+
+
+void() elite_painc1 =[ $painc1, elite_painc2 ] {};
+void() elite_painc2 =[ $painc2, elite_painc3 ] {};
+void() elite_painc3 =[ $painc3, elite_painc4 ] {};
+void() elite_painc4 =[ $painc4, elite_painc5 ] {};
+void() elite_painc5 =[ $painc5, elite_painc6 ] {};
+void() elite_painc6 =[ $painc6, elite_run1 ] {};
+
+
+void() elite_paind1 =[ $paind1, elite_paind2 ] {};
+void() elite_paind2 =[ $paind2, elite_paind3 ] {ai_pain(10);};
+void() elite_paind3 =[ $paind3, elite_paind4 ] {ai_pain(9);};
+void() elite_paind4 =[ $paind4, elite_paind5 ] {ai_pain(4);};
+void() elite_paind5 =[ $paind5, elite_paind6 ] {};
+void() elite_paind6 =[ $paind6, elite_paind7 ] {};
+void() elite_paind7 =[ $paind7, elite_paind8 ] {};
+void() elite_paind8 =[ $paind8, elite_paind9 ] {};
+void() elite_paind9 =[ $paind9, elite_paind10 ] {};
+void() elite_paind10=[ $paind10, elite_paind11 ] {};
+void() elite_paind11=[ $paind11, elite_paind12 ] {};
+void() elite_paind12=[ $paind12, elite_paind13 ] {};
+void() elite_paind13=[ $paind13, elite_paind14 ] {};
+void() elite_paind14=[ $paind14, elite_paind15 ] {};
+void() elite_paind15=[ $paind15, elite_paind16 ] {};
+void() elite_paind16=[ $paind16, elite_run1 ] {};
+
+void() elite_paine1 =[ $paine1, elite_paine2 ] {};
+void() elite_paine2 =[ $paine2, elite_paine3 ] {ai_pain(10);};
+void() elite_paine3 =[ $paine3, elite_paine4 ] {ai_pain(9);};
+void() elite_paine4 =[ $paine4, elite_paine5 ] {ai_pain(4);};
+void() elite_paine5 =[ $paine5, elite_paine6 ] {};
+void() elite_paine6 =[ $paine6, elite_paine7 ] {};
+void() elite_paine7 =[ $paine7, elite_paine8 ] {};
+void() elite_paine8 =[ $paine8, elite_paine9 ] {};
+void() elite_paine9 =[ $paine9, elite_paine10 ] {};
+void() elite_paine10=[ $paine10, elite_paine11 ] {};
+void() elite_paine11=[ $paine11, elite_paine12 ] {};
+void() elite_paine12=[ $paine12, elite_paine13 ] {};
+void() elite_paine13=[ $paine13, elite_paine14 ] {};
+void() elite_paine14=[ $paine14, elite_paine15 ] {};
+void() elite_paine15=[ $paine15, elite_run1 ] {};
+
+
+void(entity attacker, float damage) elite_pain =
+{
+ local float r;
+
+// don't make multiple pain sounds right after each other
+ if (self.pain_finished > time)
+ return;
+
+ sound (self, CHAN_VOICE, "elite/ogpain1.wav", 1, ATTN_NORM);
+
+ r = random();
+
+ if (r < 0.25)
+ {
+ elite_pain1 ();
+ self.pain_finished = time + 1;
+ }
+ else if (r < 0.5)
+ {
+ elite_painb1 ();
+ self.pain_finished = time + 1;
+ }
+ else if (r < 0.75)
+ {
+ elite_painc1 ();
+ self.pain_finished = time + 1;
+ }
+ else if (r < 0.88)
+ {
+ elite_paind1 ();
+ self.pain_finished = time + 2;
+ }
+ else
+ {
+ elite_paine1 ();
+ self.pain_finished = time + 2;
+ }
+};
+
+void() elite_die1 =[ $death1, elite_die2 ] {};
+void() elite_die2 =[ $death2, elite_die3 ] {};
+void() elite_die3 =[ $death3, elite_die4 ]
+{self.solid = SOLID_NOT;DropBackpack();};
+void() elite_die4 =[ $death4, elite_die5 ] {};
+void() elite_die5 =[ $death5, elite_die6 ] {};
+void() elite_die6 =[ $death6, elite_die7 ] {};
+void() elite_die7 =[ $death7, elite_die8 ] {};
+void() elite_die8 =[ $death8, elite_die9 ] {};
+void() elite_die9 =[ $death9, elite_die10 ] {};
+void() elite_die10 =[ $death10, elite_die11 ] {};
+void() elite_die11 =[ $death11, elite_die12 ] {};
+void() elite_die12 =[ $death12, elite_die13 ] {};
+void() elite_die13 =[ $death13, elite_die14 ] {};
+void() elite_die14 =[ $death14, elite_die14 ] {remove(self); round_kills += 1; kill_count();};
+
+void() elite_bdie1 =[ $bdeath1, elite_bdie2 ] {};
+void() elite_bdie2 =[ $bdeath2, elite_bdie3 ] {ai_forward(5);};
+void() elite_bdie3 =[ $bdeath3, elite_bdie4 ]
+{self.solid = SOLID_NOT;DropBackpack();};
+void() elite_bdie4 =[ $bdeath4, elite_bdie5 ] {ai_forward(1);};
+void() elite_bdie5 =[ $bdeath5, elite_bdie6 ] {ai_forward(3);};
+void() elite_bdie6 =[ $bdeath6, elite_bdie7 ] {ai_forward(7);};
+void() elite_bdie7 =[ $bdeath7, elite_bdie8 ] {ai_forward(25);};
+void() elite_bdie8 =[ $bdeath8, elite_bdie9 ] {};
+void() elite_bdie9 =[ $bdeath9, elite_bdie10 ] {};
+void() elite_bdie10 =[ $bdeath10, elite_bdie10 ] {remove(self); round_kills += 1; kill_count();};
+
+void() elite_die =
+{
+
+ sound (self, CHAN_VOICE, "elite/ogdth.wav", 1, ATTN_NORM);
+
+ if (random() < 0.5)
+ elite_die1 ();
+ else
+ elite_bdie1 ();
+};
+
+void() elite_melee =
+{
+ if (random() > 0.5)
+ elite_smash1 ();
+ else
+ elite_swing1 ();
+};
+
+
+/*
+==============================================================================
+
+SOLDIER / PLAYER
+
+==============================================================================
+*/
+
+$cd id1/models/soldier3
+$origin 0 -6 24
+$base base
+$skin skin
+
+$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
+
+/*
+==============================================================================
+SOLDIER CODE
+==============================================================================
+*/
+
+void() laughs =
+{
+local float r;
+r = random();
+if (r <= 0.025)
+{
+self.attack_finished = time + 0.6;
+sound (self, CHAN_AUTO, "soldier/laugh1.wav", 0.8, ATTN_NORM);
+}
+else if ( r <= 0.05)
+{
+self.attack_finished = time + 0.6;
+sound (self, CHAN_AUTO, "soldier/laugh2.wav", 0.8, ATTN_NORM);
+}
+else
+{}
+};
+//For randomy playing a grunt sound
+void() g_attack =
+{
+local float r;
+r = random();
+if (r <= 0.005)
+{
+self.attack_finished = time + 0.6;
+sound (self, CHAN_AUTO, "soldier/unstoppable.wav", 0.9, ATTN_NORM);
+}
+else if ( r <= 0.01)
+{
+self.attack_finished = time + 0.6;
+sound (self, CHAN_AUTO, "soldier/kill_it.wav", 0.9, ATTN_NORM);
+}
+else {}
+};
+void() army_fire;
+
+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();laughs();};
+void() army_stand7 =[ $stand7, army_stand8 ] {ai_stand();};
+void() army_stand8 =[ $stand8, army_stand1 ] {ai_stand();};
+
+void() army_walk1 =[ $prowl_1, army_walk2 ] {
+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);};
+
+void() army_run1 =[ $run1, army_run2 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "soldier/idle.wav", 1, ATTN_IDLE);
+ai_run(11);};
+void() army_run2 =[ $run2, army_run3 ] {ai_run(15);};
+void() army_run3 =[ $run3, army_run4 ] {ai_run(10);};
+void() army_run4 =[ $run4, army_run5 ] {ai_run(10);};
+void() army_run5 =[ $run5, army_run6 ] {ai_run(8);};
+void() army_run6 =[ $run6, army_run7 ] {ai_run(15);};
+void() army_run7 =[ $run7, army_run8 ] {ai_run(10);};
+void() army_run8 =[ $run8, army_run1 ] {ai_run(8);};
+
+void() army_atk1 =[ $shoot1, army_atk2 ] {ai_face();};
+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 =[ $shoot5, army_atk6 ] {ai_face(); Enemy_Fire_PPist();};
+void() army_atk6 =[ $shoot6, army_atk7 ] {ai_face();};
+void() army_atk7 =[ $shoot7, army_atk8 ] {ai_face();SUB_CheckRefire (army_atk1);};
+void() army_atk8 =[ $shoot8, army_atk9 ] {ai_face();};
+void() army_atk9 =[ $shoot9, army_run1 ] {ai_face();};
+
+void() grunt_melee1 =[ $melee1, grunt_melee2 ] {ai_charge(1); };
+void() grunt_melee2 =[ $melee2, grunt_melee3 ] {ai_charge(1);};
+void() grunt_melee3 =[ $melee3, grunt_melee4 ] {ai_charge(4); chainsaw(0);self.angles_y = self.angles_y + random()* 10;};
+void() grunt_melee4 =[ $melee4, grunt_melee5 ] {ai_charge(13);};
+void() grunt_melee5 =[ $melee5, grunt_melee6 ] {ai_charge(9); };
+void() grunt_melee6 =[ $melee6, grunt_melee7 ] {};
+void() grunt_melee7 =[ $melee7, army_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 ] {g_attack();};
+void() army_pain5 =[ $pain5, army_pain6 ] {};
+void() army_pain6 =[ $pain6, army_run1 ] {ai_pain(1);};
+
+void() army_painb1 =[ $painb1, army_painb2 ] {};
+void() army_painb2 =[ $painb2, army_painb3 ] {ai_painforward(13);};
+void() army_painb3 =[ $painb3, army_painb4 ] {ai_painforward(9);};
+void() army_painb4 =[ $painb4, army_painb5 ] {};
+void() army_painb5 =[ $painb5, army_painb6 ] {};
+void() army_painb6 =[ $painb6, army_painb7 ] {};
+void() army_painb7 =[ $painb7, army_painb8 ] {};
+void() army_painb8 =[ $painb8, army_painb9 ] {};
+void() army_painb9 =[ $painb9, army_painb10] {};
+void() army_painb10=[ $painb10, army_painb11] {};
+void() army_painb11=[ $painb11, army_painb12] {};
+void() army_painb12=[ $painb12, army_painb13] {ai_pain(2);};
+void() army_painb13=[ $painb13, army_painb14] {};
+void() army_painb14=[ $painb14, army_run1 ] {};
+
+void() army_painc1 =[ $painc1, army_painc2 ] {};
+void() army_painc2 =[ $painc2, army_painc3 ] {ai_pain(1);};
+void() army_painc3 =[ $painc3, army_painc4 ] {};
+void() army_painc4 =[ $painc4, army_painc5 ] {};
+void() army_painc5 =[ $painc5, army_painc6 ] {ai_painforward(1);};
+void() army_painc6 =[ $painc6, army_painc7 ] {ai_painforward(1);};
+void() army_painc7 =[ $painc7, army_painc8 ] {};
+void() army_painc8 =[ $painc8, army_painc9 ] {ai_pain(1);};
+void() army_painc9 =[ $painc9, army_painc10] {ai_painforward(4);};
+void() army_painc10=[ $painc10, army_painc11] {ai_painforward(3);};
+void() army_painc11=[ $painc11, army_painc12] {ai_painforward(6);};
+void() army_painc12=[ $painc12, army_painc13] {ai_painforward(8);};
+void() army_painc13=[ $painc13, army_run1] {};
+
+void(entity attacker, float damage) army_pain =
+{
+ local float r;
+
+ if (self.pain_finished > time)
+ return;
+
+ r = random();
+
+ if (r < 0.2)
+ {
+ self.pain_finished = time + 0.6;
+ army_pain1 ();
+ sound (self, CHAN_VOICE, "soldier/pain1.wav", 1, ATTN_NORM);
+ }
+ else if (r < 0.6)
+ {
+ self.pain_finished = time + 1.1;
+ army_painb1 ();
+ sound (self, CHAN_VOICE, "soldier/pain2.wav", 1, ATTN_NORM);
+ }
+ else
+ {
+ self.pain_finished = time + 1.1;
+ army_painc1 ();
+ sound (self, CHAN_VOICE, "soldier/pain2.wav", 1, ATTN_NORM);
+ }
+};
+
+
+void() army_fire =
+{
+ local vector dir;
+ local entity en;
+
+ ai_face();
+
+ sound (self, CHAN_WEAPON, "weapons/ppist.wav", 1, ATTN_NORM);
+
+// fire somewhat behind the player, so a dodging player is harder to hit
+ en = self.enemy;
+
+ dir = en.origin - en.velocity*0.2;
+ dir = normalize (dir - self.origin);
+
+ FireBullets (1, dir, '0.1 0.1 0', MOD_SOLDIER);
+};
+
+
+
+void() army_die1 =[ $death1, army_die2 ] {remove(self); round_kills += 1; kill_count();};
+void() army_die2 =[ $death2, army_die3 ] {};
+void() army_die3 =[ $death3, army_die4 ] {self.solid = SOLID_NOT;DropBackpack();};
+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_die =
+{
+
+// regular death
+ sound (self, CHAN_VOICE, "soldier/death1.wav", 1, ATTN_NORM);
+ army_die1 ();
+};
diff --git a/r17/Revamped src/Revamped QC/quakemons/boss.qc b/r17/Revamped src/Revamped QC/quakemons/boss.qc
new file mode 100755
index 00000000..caebe26f
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/quakemons/boss.qc
@@ -0,0 +1,373 @@
+/*
+==============================================================================
+
+BOSS-ONE
+
+==============================================================================
+*/
+$cd id1/models/boss1
+$origin 0 0 -15
+$base base
+$skin skin
+$scale 5
+
+$frame rise1 rise2 rise3 rise4 rise5 rise6 rise7 rise8 rise9 rise10
+$frame rise11 rise12 rise13 rise14 rise15 rise16 rise17
+
+$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8
+$frame walk9 walk10 walk11 walk12 walk13 walk14 walk15
+$frame walk16 walk17 walk18 walk19 walk20 walk21 walk22
+$frame walk23 walk24 walk25 walk26 walk27 walk28 walk29 walk30 walk31
+
+$frame death1 death2 death3 death4 death5 death6 death7 death8 death9
+
+$frame attack1 attack2 attack3 attack4 attack5 attack6 attack7 attack8
+$frame attack9 attack10 attack11 attack12 attack13 attack14 attack15
+$frame attack16 attack17 attack18 attack19 attack20 attack21 attack22
+$frame attack23
+
+$frame shocka1 shocka2 shocka3 shocka4 shocka5 shocka6 shocka7 shocka8
+$frame shocka9 shocka10
+
+$frame shockb1 shockb2 shockb3 shockb4 shockb5 shockb6
+
+$frame shockc1 shockc2 shockc3 shockc4 shockc5 shockc6 shockc7 shockc8
+$frame shockc9 shockc10
+
+
+void(vector p) boss_missile;
+
+void() boss_face =
+{
+
+// go for another player if multi player
+ if (self.enemy.health <= 0 || random() < 0.02)
+ {
+ self.enemy = find(self.enemy, classname, "player");
+ if (!self.enemy)
+ self.enemy = find(self.enemy, classname, "player");
+ }
+ ai_face();
+};
+
+void() boss_rise1 =[ $rise1, boss_rise2 ] {
+sound (self, CHAN_WEAPON, "boss1/out1.wav", 1, ATTN_NORM);
+};
+void() boss_rise2 =[ $rise2, boss_rise3 ] {
+sound (self, CHAN_VOICE, "boss1/sight1.wav", 1, ATTN_NORM);
+};
+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_missile1 ] {};
+
+void() boss_idle1 =[ $walk1, boss_idle2 ]
+{
+// look for other players
+};
+void() boss_idle2 =[ $walk2, boss_idle3 ] {boss_face();};
+void() boss_idle3 =[ $walk3, boss_idle4 ] {boss_face();};
+void() boss_idle4 =[ $walk4, boss_idle5 ] {boss_face();};
+void() boss_idle5 =[ $walk5, boss_idle6 ] {boss_face();};
+void() boss_idle6 =[ $walk6, boss_idle7 ] {boss_face();};
+void() boss_idle7 =[ $walk7, boss_idle8 ] {boss_face();};
+void() boss_idle8 =[ $walk8, boss_idle9 ] {boss_face();};
+void() boss_idle9 =[ $walk9, boss_idle10 ] {boss_face();};
+void() boss_idle10 =[ $walk10, boss_idle11 ] {boss_face();};
+void() boss_idle11 =[ $walk11, boss_idle12 ] {boss_face();};
+void() boss_idle12 =[ $walk12, boss_idle13 ] {boss_face();};
+void() boss_idle13 =[ $walk13, boss_idle14 ] {boss_face();};
+void() boss_idle14 =[ $walk14, boss_idle15 ] {boss_face();};
+void() boss_idle15 =[ $walk15, boss_idle16 ] {boss_face();};
+void() boss_idle16 =[ $walk16, boss_idle17 ] {boss_face();};
+void() boss_idle17 =[ $walk17, boss_idle18 ] {boss_face();};
+void() boss_idle18 =[ $walk18, boss_idle19 ] {boss_face();};
+void() boss_idle19 =[ $walk19, boss_idle20 ] {boss_face();};
+void() boss_idle20 =[ $walk20, boss_idle21 ] {boss_face();};
+void() boss_idle21 =[ $walk21, boss_idle22 ] {boss_face();};
+void() boss_idle22 =[ $walk22, boss_idle23 ] {boss_face();};
+void() boss_idle23 =[ $walk23, boss_idle24 ] {boss_face();};
+void() boss_idle24 =[ $walk24, boss_idle25 ] {boss_face();};
+void() boss_idle25 =[ $walk25, boss_idle26 ] {boss_face();};
+void() boss_idle26 =[ $walk26, boss_idle27 ] {boss_face();};
+void() boss_idle27 =[ $walk27, boss_idle28 ] {boss_face();};
+void() boss_idle28 =[ $walk28, boss_idle29 ] {boss_face();};
+void() boss_idle29 =[ $walk29, boss_idle30 ] {boss_face();};
+void() boss_idle30 =[ $walk30, boss_idle31 ] {boss_face();};
+void() boss_idle31 =[ $walk31, boss_idle1 ] {boss_face();};
+
+void() boss_missile1 =[ $attack1, boss_missile2 ] {boss_face();};
+void() boss_missile2 =[ $attack2, boss_missile3 ] {boss_face();};
+void() boss_missile3 =[ $attack3, boss_missile4 ] {boss_face();};
+void() boss_missile4 =[ $attack4, boss_missile5 ] {boss_face();};
+void() boss_missile5 =[ $attack5, boss_missile6 ] {boss_face();};
+void() boss_missile6 =[ $attack6, boss_missile7 ] {boss_face();};
+void() boss_missile7 =[ $attack7, boss_missile8 ] {boss_face();};
+void() boss_missile8 =[ $attack8, boss_missile9 ] {boss_face();};
+void() boss_missile9 =[ $attack9, boss_missile10 ] {boss_missile('100 100 200');};
+void() boss_missile10 =[ $attack10, boss_missile11 ] {boss_face();};
+void() boss_missile11 =[ $attack11, boss_missile12 ] {boss_face();};
+void() boss_missile12 =[ $attack12, boss_missile13 ] {boss_face();};
+void() boss_missile13 =[ $attack13, boss_missile14 ] {boss_face();};
+void() boss_missile14 =[ $attack14, boss_missile15 ] {boss_face();};
+void() boss_missile15 =[ $attack15, boss_missile16 ] {boss_face();};
+void() boss_missile16 =[ $attack16, boss_missile17 ] {boss_face();};
+void() boss_missile17 =[ $attack17, boss_missile18 ] {boss_face();};
+void() boss_missile18 =[ $attack18, boss_missile19 ] {boss_face();};
+void() boss_missile19 =[ $attack19, boss_missile20 ] {boss_face();};
+void() boss_missile20 =[ $attack20, boss_missile21 ] {boss_missile('100 -100 200');};
+void() boss_missile21 =[ $attack21, boss_missile22 ] {boss_face();};
+void() boss_missile22 =[ $attack22, boss_missile23 ] {boss_face();};
+void() boss_missile23 =[ $attack23, boss_missile1 ] {boss_face();};
+
+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_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_missile1 ] {};
+
+void() boss_shockc1 =[ $shockc1, boss_shockc2 ] {};
+void() boss_shockc2 =[ $shockc2, boss_shockc3 ] {};
+void() boss_shockc3 =[ $shockc3, boss_shockc4 ] {};
+void() boss_shockc4 =[ $shockc4, boss_shockc5 ] {};
+void() boss_shockc5 =[ $shockc5, boss_shockc6 ] {};
+void() boss_shockc6 =[ $shockc6, boss_shockc7 ] {};
+void() boss_shockc7 =[ $shockc7, boss_shockc8 ] {};
+void() boss_shockc8 =[ $shockc8, boss_shockc9 ] {};
+void() boss_shockc9 =[ $shockc9, boss_shockc10 ] {};
+void() boss_shockc10 =[ $shockc10, boss_death1 ] {};
+
+void() boss_death1 = [$death1, boss_death2] {
+sound (self, CHAN_VOICE, "boss1/death.wav", 1, ATTN_NORM);
+};
+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 (self, CHAN_BODY, "boss1/out1.wav", 1, ATTN_NORM);
+ TE_lavasplash(self.origin);
+};
+
+void() boss_death10 = [$death9, boss_death10]
+{
+ killed_monsters = killed_monsters + 1;
+ WriteByte (MSG_ALL, SVC_KILLEDMONSTER); // FIXME: reliable broadcast
+ SUB_UseTargets ();
+ remove (self);
+};
+
+void(vector p) boss_missile =
+{
+ local vector offang;
+ local vector org, vec, d;
+ local float t;
+
+ offang = vectoangles (self.enemy.origin - self.origin);
+ makevectors (offang);
+
+ 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(self.enemy.origin - org) / 300;
+ vec = self.enemy.velocity;
+ vec_z = 0;
+ d = self.enemy.origin + t * vec;
+ }
+ else
+ {
+ d = self.enemy.origin;
+ }
+
+ vec = normalize(d - org) * 300;
+
+ PRJ_FireProjectile(self, "progs/lavaball.mdl", org, vec, PE_EXPLOSION, 100+random()*20, MOD_CHTHON, 5);
+ PRJ_SetRadiusDamage(120, 160, MOD_CHTHON);
+ newmis.avelocity = '200 100 300';
+
+ sound (self, CHAN_WEAPON, "boss1/throw.wav", 1, ATTN_NORM);
+
+// check for dead enemy
+ if (self.enemy.health <= 0)
+ boss_idle1 ();
+};
+
+
+void() boss_awake =
+{
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+ self.takedamage = DAMAGE_NO;
+
+ setmodel (self, "progs/boss.mdl");
+ setsize (self, '-128 -128 -24', '128 128 256');
+
+ if (skill == 0)
+ self.health = 1;
+ else
+ self.health = 3;
+
+ self.enemy = activator;
+
+ TE_lavasplash(self.origin);
+
+ self.yaw_speed = 20;
+ boss_rise1 ();
+};
+
+
+/*QUAKED monster_boss (1 0 0) (-128 -128 -24) (128 128 256)
+*/
+void() monster_boss =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+ precache_model ("progs/boss.mdl");
+ precache_model ("progs/lavaball.mdl");
+
+ precache_sound ("weapons/rocket1i.wav");
+ precache_sound ("boss1/out1.wav");
+ precache_sound ("boss1/sight1.wav");
+ precache_sound ("misc/power.wav");
+ precache_sound ("boss1/throw.wav");
+ precache_sound ("boss1/pain.wav");
+ precache_sound ("boss1/death.wav");
+
+ total_monsters = total_monsters + 1;
+
+ self.use = boss_awake;
+};
+
+//===========================================================================
+
+entity le1, le2;
+float lightning_end;
+
+void() lightning_fire =
+{
+ local vector p1, p2;
+
+ if (time >= lightning_end)
+ { // done here, put the terminals back up
+ self = le1;
+ door_go_down ();
+ self = 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;
+
+ TE_lightning3(world, p1, p2);
+};
+
+void() lightning_use =
+{
+ 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 != STATE_TOP && le1.state != STATE_BOTTOM)
+ || (le2.state != STATE_TOP && le2.state != STATE_BOTTOM)
+ || (le1.state != le2.state) )
+ {
+// 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
+ self = find (world, classname, "monster_boss");
+ if (!self)
+ return;
+ self.enemy = activator;
+ if (le1.state == STATE_TOP && self.health > 0)
+ {
+ sound (self, CHAN_VOICE, "boss1/pain.wav", 1, ATTN_NORM);
+ self.health = self.health - 1;
+ if (self.health >= 2)
+ boss_shocka1();
+ else if (self.health == 1)
+ boss_shockb1();
+ else if (self.health == 0)
+ boss_shockc1();
+ }
+};
+
+
+/*QUAKED event_lightning (0 1 1) (-16 -16 -16) (16 16 16)
+Just for boss level.
+*/
+void() event_lightning =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+
+ self.use = lightning_use;
+};
+
+
diff --git a/r17/Revamped src/Revamped QC/quakemons/demon.qc b/r17/Revamped src/Revamped QC/quakemons/demon.qc
new file mode 100755
index 00000000..cb1394e9
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/quakemons/demon.qc
@@ -0,0 +1,357 @@
+/*
+==============================================================================
+
+DEMON
+
+==============================================================================
+*/
+
+$cd id1/models/demon3
+$scale 0.8
+$origin 0 0 24
+$base base
+$skin base
+
+$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9
+$frame stand10 stand11 stand12 stand13
+
+$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8
+
+$frame run1 run2 run3 run4 run5 run6
+
+$frame leap1 leap2 leap3 leap4 leap5 leap6 leap7 leap8 leap9 leap10
+$frame leap11 leap12
+
+$frame pain1 pain2 pain3 pain4 pain5 pain6
+
+$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
+
+//============================================================================
+
+void() Demon_JumpTouch;
+void(float side) Demon_Melee;
+
+void() demon1_stand1 =[ $stand1, demon1_stand2 ] {ai_stand();};
+void() demon1_stand2 =[ $stand2, demon1_stand3 ] {ai_stand();};
+void() demon1_stand3 =[ $stand3, demon1_stand4 ] {ai_stand();};
+void() demon1_stand4 =[ $stand4, demon1_stand5 ] {ai_stand();};
+void() demon1_stand5 =[ $stand5, demon1_stand6 ] {ai_stand();};
+void() demon1_stand6 =[ $stand6, demon1_stand7 ] {ai_stand();};
+void() demon1_stand7 =[ $stand7, demon1_stand8 ] {ai_stand();};
+void() demon1_stand8 =[ $stand8, demon1_stand9 ] {ai_stand();};
+void() demon1_stand9 =[ $stand9, demon1_stand10 ] {ai_stand();};
+void() demon1_stand10 =[ $stand10, demon1_stand11 ] {ai_stand();};
+void() demon1_stand11 =[ $stand11, demon1_stand12 ] {ai_stand();};
+void() demon1_stand12 =[ $stand12, demon1_stand13 ] {ai_stand();};
+void() demon1_stand13 =[ $stand13, demon1_stand1 ] {ai_stand();};
+
+void() demon1_walk1 =[ $walk1, demon1_walk2 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "demon/idle1.wav", 1, ATTN_IDLE);
+ai_walk(8);
+};
+void() demon1_walk2 =[ $walk2, demon1_walk3 ] {ai_walk(6);};
+void() demon1_walk3 =[ $walk3, demon1_walk4 ] {ai_walk(6);};
+void() demon1_walk4 =[ $walk4, demon1_walk5 ] {ai_walk(7);};
+void() demon1_walk5 =[ $walk5, demon1_walk6 ] {ai_walk(4);};
+void() demon1_walk6 =[ $walk6, demon1_walk7 ] {ai_walk(6);};
+void() demon1_walk7 =[ $walk7, demon1_walk8 ] {ai_walk(10);};
+void() demon1_walk8 =[ $walk8, demon1_walk1 ] {ai_walk(10);};
+
+void() demon1_run1 =[ $run1, demon1_run2 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "demon/idle1.wav", 1, ATTN_IDLE);
+ai_run(20);};
+void() demon1_run2 =[ $run2, demon1_run3 ] {ai_run(15);};
+void() demon1_run3 =[ $run3, demon1_run4 ] {ai_run(36);};
+void() demon1_run4 =[ $run4, demon1_run5 ] {ai_run(20);};
+void() demon1_run5 =[ $run5, demon1_run6 ] {ai_run(15);};
+void() demon1_run6 =[ $run6, demon1_run1 ] {ai_run(36);};
+
+void() demon1_jump1 =[ $leap1, demon1_jump2 ] {ai_face();};
+void() demon1_jump2 =[ $leap2, demon1_jump3 ] {ai_face();};
+void() demon1_jump3 =[ $leap3, demon1_jump4 ] {ai_face();};
+void() demon1_jump4 =[ $leap4, demon1_jump5 ]
+{
+ ai_face();
+
+ self.touch = Demon_JumpTouch;
+ 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;
+};
+void() demon1_jump5 =[ $leap5, demon1_jump6 ] {};
+void() demon1_jump6 =[ $leap6, demon1_jump7 ] {};
+void() demon1_jump7 =[ $leap7, demon1_jump8 ] {};
+void() demon1_jump8 =[ $leap8, demon1_jump9 ] {};
+void() demon1_jump9 =[ $leap9, demon1_jump10 ] {};
+void() demon1_jump10 =[ $leap10, demon1_jump1 ] {
+self.nextthink = time + 3;
+// if three seconds pass, assume demon is stuck and jump again
+};
+
+void() demon1_jump11 =[ $leap11, demon1_jump12 ] {};
+void() demon1_jump12 =[ $leap12, demon1_run1 ] {};
+
+
+void() demon1_atta1 =[ $attacka1, demon1_atta2 ] {ai_charge(4);};
+void() demon1_atta2 =[ $attacka2, demon1_atta3 ] {ai_charge(0);};
+void() demon1_atta3 =[ $attacka3, demon1_atta4 ] {ai_charge(0);};
+void() demon1_atta4 =[ $attacka4, demon1_atta5 ] {ai_charge(1);};
+void() demon1_atta5 =[ $attacka5, demon1_atta6 ] {ai_charge(2); Demon_Melee(200);};
+void() demon1_atta6 =[ $attacka6, demon1_atta7 ] {ai_charge(1);};
+void() demon1_atta7 =[ $attacka7, demon1_atta8 ] {ai_charge(6);};
+void() demon1_atta8 =[ $attacka8, demon1_atta9 ] {ai_charge(8);};
+void() demon1_atta9 =[ $attacka9, demon1_atta10] {ai_charge(4);};
+void() demon1_atta10 =[ $attacka10, demon1_atta11] {ai_charge(2);};
+void() demon1_atta11 =[ $attacka11, demon1_atta12] {Demon_Melee(-200);};
+void() demon1_atta12 =[ $attacka12, demon1_atta13] {ai_charge(5);};
+void() demon1_atta13 =[ $attacka13, demon1_atta14] {ai_charge(8);};
+void() demon1_atta14 =[ $attacka14, demon1_atta15] {ai_charge(4);};
+void() demon1_atta15 =[ $attacka15, demon1_run1] {ai_charge(4);};
+
+void() demon1_pain1 =[ $pain1, demon1_pain2 ] {};
+void() demon1_pain2 =[ $pain2, demon1_pain3 ] {};
+void() demon1_pain3 =[ $pain3, demon1_pain4 ] {};
+void() demon1_pain4 =[ $pain4, demon1_pain5 ] {};
+void() demon1_pain5 =[ $pain5, demon1_pain6 ] {};
+void() demon1_pain6 =[ $pain6, demon1_run1 ] {};
+
+void(entity attacker, float damage) demon1_pain =
+{
+ if (self.touch == Demon_JumpTouch)
+ return;
+
+ if (self.pain_finished > time)
+ return;
+
+ self.pain_finished = time + 1;
+ sound (self, CHAN_VOICE, "demon/dpain1.wav", 1, ATTN_NORM);
+
+ if (random()*200 > damage)
+ return; // didn't flinch
+
+ demon1_pain1 ();
+};
+
+void() demon1_die1 =[ $death1, demon1_die2 ] {
+sound (self, CHAN_VOICE, "demon/ddeath.wav", 1, ATTN_NORM);};
+void() demon1_die2 =[ $death2, demon1_die3 ] {};
+void() demon1_die3 =[ $death3, demon1_die4 ] {};
+void() demon1_die4 =[ $death4, demon1_die5 ] {};
+void() demon1_die5 =[ $death5, demon1_die6 ] {};
+void() demon1_die6 =[ $death6, demon1_die7 ]
+{self.solid = SOLID_NOT;};
+void() demon1_die7 =[ $death7, demon1_die8 ] {};
+void() demon1_die8 =[ $death8, demon1_die9 ] {};
+void() demon1_die9 =[ $death9, demon1_die9 ] {};
+
+void() demon_die =
+{
+// check for gib
+ if (self.health < -80)
+ {
+ sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
+ 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);
+ return;
+ }
+
+// regular death
+ demon1_die1 ();
+};
+
+
+void() Demon_MeleeAttack =
+{
+ demon1_atta1 ();
+};
+
+
+/*QUAKED monster_demon1 (1 0 0) (-32 -32 -24) (32 32 64) Ambush
+
+*/
+void() monster_demon1 =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+ precache_model ("progs/demon.mdl");
+ precache_model ("progs/h_demon.mdl");
+
+ precache_sound ("demon/ddeath.wav");
+ precache_sound ("demon/dhit2.wav");
+ precache_sound ("demon/djump.wav");
+ precache_sound ("demon/dpain1.wav");
+ precache_sound ("demon/idle1.wav");
+ precache_sound ("demon/sight2.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/demon.mdl");
+
+ setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX);
+ self.health = 300;
+
+ self.th_stand = demon1_stand1;
+ self.th_walk = demon1_walk1;
+ self.th_run = demon1_run1;
+ self.th_die = demon_die;
+ self.th_melee = Demon_MeleeAttack; // one of two attacks
+ self.th_missile = demon1_jump1; // jump attack
+ self.th_pain = demon1_pain;
+
+ walkmonster_start();
+};
+
+
+/*
+==============================================================================
+
+DEMON
+
+==============================================================================
+*/
+
+/*
+==============
+CheckDemonMelee
+
+Returns TRUE if a melee attack would hit right now
+==============
+*/
+BOOL(float enemy_range) CheckDemonMelee =
+{
+ if (enemy_range == RANGE_MELEE)
+ { // FIXME: check canreach
+ self.attack_state = AS_MELEE;
+ return TRUE;
+ }
+ return FALSE;
+};
+
+/*
+==============
+CheckDemonJump
+
+==============
+*/
+BOOL() CheckDemonJump =
+{
+ local vector dist;
+ local float d;
+
+ if (self.origin_z + self.mins_z > self.enemy.origin_z + self.enemy.mins_z
+ + 0.75 * self.enemy.size_z)
+ return FALSE;
+
+ if (self.origin_z + self.maxs_z < self.enemy.origin_z + self.enemy.mins_z
+ + 0.25 * self.enemy.size_z)
+ return FALSE;
+
+ dist = self.enemy.origin - self.origin;
+ dist_z = 0;
+
+ d = vlen(dist);
+
+ if (d < 100)
+ return FALSE;
+
+ if (d > 200)
+ {
+ if (random() < 0.9)
+ return FALSE;
+ }
+
+ return TRUE;
+};
+
+BOOL(float enemy_range) DemonCheckAttack =
+{
+// if close enough for slashing, go for it
+ if (CheckDemonMelee (enemy_range))
+ {
+ self.attack_state = AS_MELEE;
+ return TRUE;
+ }
+
+ if (CheckDemonJump ())
+ {
+ self.attack_state = AS_MISSILE;
+ sound (self, CHAN_VOICE, "demon/djump.wav", 1, ATTN_NORM);
+ return TRUE;
+ }
+
+ return FALSE;
+};
+
+
+//===========================================================================
+
+void(float side) Demon_Melee =
+{
+ local float ldmg;
+ local vector delta;
+
+ ai_face ();
+ walkmove (self.ideal_yaw, 12); // allow a little closing
+
+ delta = self.enemy.origin - self.origin;
+
+ if (vlen(delta) > 100)
+ return;
+ if (!CanDamage (self.enemy, self))
+ return;
+
+ sound (self, CHAN_WEAPON, "demon/dhit2.wav", 1, ATTN_NORM);
+ ldmg = 10 + 5*random();
+ T_Damage (self.enemy, self, self, ldmg, MOD_DEMON);
+
+ makevectors (self.angles);
+ SpawnMeatSpray (self.origin + v_forward*16, side * v_right);
+};
+
+
+void() Demon_JumpTouch =
+{
+ local float ldmg;
+
+ if (self.health <= 0)
+ return;
+
+ if (other.takedamage)
+ {
+ if ( vlen(self.velocity) > 400 )
+ {
+ ldmg = 40 + 10*random();
+ T_Damage (other, self, self, ldmg, MOD_DEMON);
+ }
+ }
+
+ if (!checkbottom(self))
+ {
+ if (self.flags & FL_ONGROUND)
+ { // jump randomly to not get hung up
+ self.touch = SUB_Null;
+ self.think = demon1_jump1;
+ self.nextthink = time + 0.1;
+ }
+ return; // not on ground yet
+ }
+
+ self.touch = SUB_Null;
+ self.think = demon1_jump11;
+ self.nextthink = time + 0.1;
+};
+
+
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/quakemons/dog.qc b/r17/Revamped src/Revamped QC/quakemons/dog.qc
new file mode 100755
index 00000000..155cb850
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/quakemons/dog.qc
@@ -0,0 +1,357 @@
+/*
+==============================================================================
+
+DOG
+
+==============================================================================
+*/
+$cd id1/models/dog
+$origin 0 0 24
+$base base
+$skin skin
+
+$frame attack1 attack2 attack3 attack4 attack5 attack6 attack7 attack8
+
+$frame death1 death2 death3 death4 death5 death6 death7 death8 death9
+
+$frame deathb1 deathb2 deathb3 deathb4 deathb5 deathb6 deathb7 deathb8
+$frame deathb9
+
+$frame pain1 pain2 pain3 pain4 pain5 pain6
+
+$frame painb1 painb2 painb3 painb4 painb5 painb6 painb7 painb8 painb9 painb10
+$frame painb11 painb12 painb13 painb14 painb15 painb16
+
+$frame run1 run2 run3 run4 run5 run6 run7 run8 run9 run10 run11 run12
+
+$frame leap1 leap2 leap3 leap4 leap5 leap6 leap7 leap8 leap9
+
+$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9
+
+$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8
+
+
+void() dog_leap1;
+void() dog_run1;
+
+/*
+================
+dog_bite
+
+================
+*/
+void() dog_bite =
+{
+local vector delta;
+local float ldmg;
+
+ if (!self.enemy)
+ return;
+
+ ai_charge(10);
+
+ if (!CanDamage (self.enemy, self))
+ return;
+
+ delta = self.enemy.origin - self.origin;
+
+ if (vlen(delta) > 100)
+ return;
+
+ ldmg = (random() + random() + random()) * 8;
+ T_Damage (self.enemy, self, self, ldmg, MOD_DOG);
+};
+
+void() Dog_JumpTouch =
+{
+ local float ldmg;
+
+ if (self.health <= 0)
+ return;
+
+ if (other.takedamage)
+ {
+ if ( vlen(self.velocity) > 300 )
+ {
+ ldmg = 10 + 10*random();
+ T_Damage (other, self, self, ldmg, MOD_DOG);
+ }
+ }
+
+ if (!checkbottom(self))
+ {
+ if (self.flags & FL_ONGROUND)
+ {
+ // jump randomly to not get hung up
+ self.touch = SUB_Null;
+ self.think = dog_leap1;
+ self.nextthink = time + 0.1;
+ }
+ return; // not on ground yet
+ }
+
+ self.touch = SUB_Null;
+ self.think = dog_run1;
+ self.nextthink = time + 0.1;
+};
+
+
+void() dog_stand1 =[ $stand1, dog_stand2 ] {ai_stand();};
+void() dog_stand2 =[ $stand2, dog_stand3 ] {ai_stand();};
+void() dog_stand3 =[ $stand3, dog_stand4 ] {ai_stand();};
+void() dog_stand4 =[ $stand4, dog_stand5 ] {ai_stand();};
+void() dog_stand5 =[ $stand5, dog_stand6 ] {ai_stand();};
+void() dog_stand6 =[ $stand6, dog_stand7 ] {ai_stand();};
+void() dog_stand7 =[ $stand7, dog_stand8 ] {ai_stand();};
+void() dog_stand8 =[ $stand8, dog_stand9 ] {ai_stand();};
+void() dog_stand9 =[ $stand9, dog_stand1 ] {ai_stand();};
+
+void() dog_walk1 =[ $walk1 , dog_walk2 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "dog/idle.wav", 1, ATTN_IDLE);
+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);};
+
+void() dog_run1 =[ $run1 , dog_run2 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "dog/idle.wav", 1, ATTN_IDLE);
+ai_run(16);};
+void() dog_run2 =[ $run2 , dog_run3 ] {ai_run(32);};
+void() dog_run3 =[ $run3 , dog_run4 ] {ai_run(32);};
+void() dog_run4 =[ $run4 , dog_run5 ] {ai_run(20);};
+void() dog_run5 =[ $run5 , dog_run6 ] {ai_run(64);};
+void() dog_run6 =[ $run6 , dog_run7 ] {ai_run(32);};
+void() dog_run7 =[ $run7 , dog_run8 ] {ai_run(16);};
+void() dog_run8 =[ $run8 , dog_run9 ] {ai_run(32);};
+void() dog_run9 =[ $run9 , dog_run10 ] {ai_run(32);};
+void() dog_run10 =[ $run10 , dog_run11 ] {ai_run(20);};
+void() dog_run11 =[ $run11 , dog_run12 ] {ai_run(64);};
+void() dog_run12 =[ $run12 , dog_run1 ] {ai_run(32);};
+
+void() dog_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 ] {
+sound (self, CHAN_VOICE, "dog/dattack1.wav", 1, ATTN_NORM);
+dog_bite();};
+void() dog_atta5 =[ $attack5, dog_atta6 ] {ai_charge(10);};
+void() dog_atta6 =[ $attack6, dog_atta7 ] {ai_charge(10);};
+void() dog_atta7 =[ $attack7, dog_atta8 ] {ai_charge(10);};
+void() dog_atta8 =[ $attack8, dog_run1 ] {ai_charge(10);};
+
+void() dog_leap1 =[ $leap1, dog_leap2 ] {ai_face();};
+void() dog_leap2 =[ $leap2, dog_leap3 ]
+{
+ ai_face();
+
+ self.touch = Dog_JumpTouch;
+ 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;
+};
+
+void() dog_leap3 =[ $leap3, dog_leap4 ] {};
+void() dog_leap4 =[ $leap4, dog_leap5 ] {};
+void() dog_leap5 =[ $leap5, dog_leap6 ] {};
+void() dog_leap6 =[ $leap6, dog_leap7 ] {};
+void() dog_leap7 =[ $leap7, dog_leap8 ] {};
+void() dog_leap8 =[ $leap8, dog_leap9 ] {};
+void() dog_leap9 =[ $leap9, dog_leap9 ] {};
+
+void() dog_pain1 =[ $pain1 , dog_pain2 ] {};
+void() dog_pain2 =[ $pain2 , dog_pain3 ] {};
+void() dog_pain3 =[ $pain3 , dog_pain4 ] {};
+void() dog_pain4 =[ $pain4 , dog_pain5 ] {};
+void() dog_pain5 =[ $pain5 , dog_pain6 ] {};
+void() dog_pain6 =[ $pain6 , dog_run1 ] {};
+
+void() dog_painb1 =[ $painb1 , dog_painb2 ] {};
+void() dog_painb2 =[ $painb2 , dog_painb3 ] {};
+void() dog_painb3 =[ $painb3 , dog_painb4 ] {ai_pain(4);};
+void() dog_painb4 =[ $painb4 , dog_painb5 ] {ai_pain(12);};
+void() dog_painb5 =[ $painb5 , dog_painb6 ] {ai_pain(12);};
+void() dog_painb6 =[ $painb6 , dog_painb7 ] {ai_pain(2);};
+void() dog_painb7 =[ $painb7 , dog_painb8 ] {};
+void() dog_painb8 =[ $painb8 , dog_painb9 ] {ai_pain(4);};
+void() dog_painb9 =[ $painb9 , dog_painb10 ] {};
+void() dog_painb10 =[ $painb10 , dog_painb11 ] {ai_pain(10);};
+void() dog_painb11 =[ $painb11 , dog_painb12 ] {};
+void() dog_painb12 =[ $painb12 , dog_painb13 ] {};
+void() dog_painb13 =[ $painb13 , dog_painb14 ] {};
+void() dog_painb14 =[ $painb14 , dog_painb15 ] {};
+void() dog_painb15 =[ $painb15 , dog_painb16 ] {};
+void() dog_painb16 =[ $painb16 , dog_run1 ] {};
+
+void() dog_pain =
+{
+ sound (self, CHAN_VOICE, "dog/dpain1.wav", 1, ATTN_NORM);
+
+ if (random() > 0.5)
+ dog_pain1 ();
+ else
+ dog_painb1 ();
+};
+
+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 ] {};
+
+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 ] {};
+
+
+void() dog_die =
+{
+// check for gib
+ if (self.health < -35)
+ {
+ sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
+ ThrowGib ("progs/gib3.mdl", self.health);
+ ThrowGib ("progs/gib3.mdl", self.health);
+ ThrowGib ("progs/gib3.mdl", self.health);
+ ThrowHead ("progs/h_dog.mdl", self.health);
+ return;
+ }
+
+// regular death
+ sound (self, CHAN_VOICE, "dog/ddeath.wav", 1, ATTN_NORM);
+ self.solid = SOLID_NOT;
+
+ if (random() > 0.5)
+ dog_die1 ();
+ else
+ dog_dieb1 ();
+};
+
+//============================================================================
+
+/*
+==============
+CheckDogMelee
+
+Returns TRUE if a melee attack would hit right now
+==============
+*/
+BOOL(float enemy_range) CheckDogMelee =
+{
+ if (enemy_range == RANGE_MELEE)
+ { // FIXME: check canreach
+ self.attack_state = AS_MELEE;
+ return TRUE;
+ }
+ return FALSE;
+};
+
+/*
+==============
+CheckDogJump
+
+==============
+*/
+BOOL() CheckDogJump =
+{
+ local vector dist;
+ local float d;
+
+ if (self.origin_z + self.mins_z > self.enemy.origin_z + self.enemy.mins_z
+ + 0.75 * self.enemy.size_z)
+ return FALSE;
+
+ if (self.origin_z + self.maxs_z < self.enemy.origin_z + self.enemy.mins_z
+ + 0.25 * self.enemy.size_z)
+ return FALSE;
+
+ dist = self.enemy.origin - self.origin;
+ dist_z = 0;
+
+ d = vlen(dist);
+
+ if (d < 80)
+ return FALSE;
+
+ if (d > 150)
+ return FALSE;
+
+ return TRUE;
+};
+
+BOOL(float enemy_range) DogCheckAttack =
+{
+// if close enough for slashing, go for it
+ if (CheckDogMelee (enemy_range))
+ {
+ self.attack_state = AS_MELEE;
+ return TRUE;
+ }
+
+ if (CheckDogJump ())
+ {
+ self.attack_state = AS_MISSILE;
+ return TRUE;
+ }
+
+ return FALSE;
+};
+
+
+//===========================================================================
+
+/*QUAKED monster_dog (1 0 0) (-32 -32 -24) (32 32 40) Ambush
+
+*/
+void() monster_dog =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+ precache_model ("progs/h_dog.mdl");
+ precache_model ("progs/dog.mdl");
+
+ precache_sound ("dog/dattack1.wav");
+ precache_sound ("dog/ddeath.wav");
+ precache_sound ("dog/dpain1.wav");
+ precache_sound ("dog/dsight.wav");
+ precache_sound ("dog/idle.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/dog.mdl");
+
+ setsize (self, '-32 -32 -24', '32 32 40');
+ self.health = 25;
+
+ self.th_stand = dog_stand1;
+ self.th_walk = dog_walk1;
+ self.th_run = dog_run1;
+ self.th_pain = dog_pain;
+ self.th_die = dog_die;
+ self.th_melee = dog_atta1;
+ self.th_missile = dog_leap1;
+
+ walkmonster_start();
+};
+
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/quakemons/enforcer.qc b/r17/Revamped src/Revamped QC/quakemons/enforcer.qc
new file mode 100755
index 00000000..4f93900d
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/quakemons/enforcer.qc
@@ -0,0 +1,282 @@
+/*
+==============================================================================
+
+SOLDIER / PLAYER
+
+==============================================================================
+*/
+
+$cd id1/models/enforcer
+$origin 0 -6 24
+$base base
+$skin skin
+
+$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7
+
+$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9 walk10
+$frame walk11 walk12 walk13 walk14 walk15 walk16
+
+$frame run1 run2 run3 run4 run5 run6 run7 run8
+
+$frame attack1 attack2 attack3 attack4 attack5 attack6
+$frame attack7 attack8 attack9 attack10
+
+$frame death1 death2 death3 death4 death5 death6 death7 death8
+$frame death9 death10 death11 death12 death13 death14
+
+$frame fdeath1 fdeath2 fdeath3 fdeath4 fdeath5 fdeath6 fdeath7 fdeath8
+$frame fdeath9 fdeath10 fdeath11
+
+$frame paina1 paina2 paina3 paina4
+
+$frame painb1 painb2 painb3 painb4 painb5
+
+$frame painc1 painc2 painc3 painc4 painc5 painc6 painc7 painc8
+
+$frame paind1 paind2 paind3 paind4 paind5 paind6 paind7 paind8
+$frame paind9 paind10 paind11 paind12 paind13 paind14 paind15 paind16
+$frame paind17 paind18 paind19
+
+void() enforcer_fire =
+{
+ local vector org, vec;
+
+ muzzleflash();
+ makevectors (self.angles);
+
+ org = self.origin + v_forward * 30 + v_right * 8.5 + '0 0 16';
+ vec = normalize(self.enemy.origin - self.origin) * 600;
+
+ sound (self, CHAN_VOICE, "enforcer/enfire.wav", 1, ATTN_NORM);
+ PRJ_FireProjectile(self, "progs/laser.mdl", org, vec, PE_LASER, 15, MOD_ENFORCER, 5);
+ newmis.effects |= EF_DIMLIGHT;
+ newmis.alpha = 0.5;
+};
+
+//============================================================================
+
+void() enf_stand1 =[ $stand1, enf_stand2 ] {ai_stand();};
+void() enf_stand2 =[ $stand2, enf_stand3 ] {ai_stand();};
+void() enf_stand3 =[ $stand3, enf_stand4 ] {ai_stand();};
+void() enf_stand4 =[ $stand4, enf_stand5 ] {ai_stand();};
+void() enf_stand5 =[ $stand5, enf_stand6 ] {ai_stand();};
+void() enf_stand6 =[ $stand6, enf_stand7 ] {ai_stand();};
+void() enf_stand7 =[ $stand7, enf_stand1 ] {ai_stand();};
+
+void() enf_walk1 =[ $walk1 , enf_walk2 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "enforcer/idle1.wav", 1, ATTN_IDLE);
+ai_walk(2);};
+void() enf_walk2 =[ $walk2 , enf_walk3 ] {ai_walk(4);};
+void() enf_walk3 =[ $walk3 , enf_walk4 ] {ai_walk(4);};
+void() enf_walk4 =[ $walk4 , enf_walk5 ] {ai_walk(3);};
+void() enf_walk5 =[ $walk5 , enf_walk6 ] {ai_walk(1);};
+void() enf_walk6 =[ $walk6 , enf_walk7 ] {ai_walk(2);};
+void() enf_walk7 =[ $walk7 , enf_walk8 ] {ai_walk(2);};
+void() enf_walk8 =[ $walk8 , enf_walk9 ] {ai_walk(1);};
+void() enf_walk9 =[ $walk9 , enf_walk10 ] {ai_walk(2);};
+void() enf_walk10 =[ $walk10, enf_walk11 ] {ai_walk(4);};
+void() enf_walk11 =[ $walk11, enf_walk12 ] {ai_walk(4);};
+void() enf_walk12 =[ $walk12, enf_walk13 ] {ai_walk(1);};
+void() enf_walk13 =[ $walk13, enf_walk14 ] {ai_walk(2);};
+void() enf_walk14 =[ $walk14, enf_walk15 ] {ai_walk(3);};
+void() enf_walk15 =[ $walk15, enf_walk16 ] {ai_walk(4);};
+void() enf_walk16 =[ $walk16, enf_walk1 ] {ai_walk(2);};
+
+void() enf_run1 =[ $run1 , enf_run2 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "enforcer/idle1.wav", 1, ATTN_IDLE);
+ai_run(18);};
+void() enf_run2 =[ $run2 , enf_run3 ] {ai_run(14);};
+void() enf_run3 =[ $run3 , enf_run4 ] {ai_run(7);};
+void() enf_run4 =[ $run4 , enf_run5 ] {ai_run(12);};
+void() enf_run5 =[ $run5 , enf_run6 ] {ai_run(14);};
+void() enf_run6 =[ $run6 , enf_run7 ] {ai_run(14);};
+void() enf_run7 =[ $run7 , enf_run8 ] {ai_run(7);};
+void() enf_run8 =[ $run8 , enf_run1 ] {ai_run(11);};
+
+void() enf_atk1 =[ $attack1, enf_atk2 ] {ai_face();};
+void() enf_atk2 =[ $attack2, enf_atk3 ] {ai_face();};
+void() enf_atk3 =[ $attack3, enf_atk4 ] {ai_face();};
+void() enf_atk4 =[ $attack4, enf_atk5 ] {ai_face();};
+void() enf_atk5 =[ $attack5, enf_atk6 ] {ai_face();};
+void() enf_atk6 =[ $attack6, enf_atk7 ] {enforcer_fire();};
+void() enf_atk7 =[ $attack7, enf_atk8 ] {ai_face();};
+void() enf_atk8 =[ $attack8, enf_atk9 ] {ai_face();};
+void() enf_atk9 =[ $attack5, enf_atk10 ] {ai_face();};
+void() enf_atk10 =[ $attack6, enf_atk11 ] {enforcer_fire();};
+void() enf_atk11 =[ $attack7, enf_atk12 ] {ai_face();};
+void() enf_atk12 =[ $attack8, enf_atk13 ] {ai_face();};
+void() enf_atk13 =[ $attack9, enf_atk14 ] {ai_face();};
+void() enf_atk14 =[ $attack10, enf_run1 ] {ai_face();
+SUB_CheckRefire (enf_atk1);
+};
+
+void() enf_paina1 =[ $paina1, enf_paina2 ] {};
+void() enf_paina2 =[ $paina2, enf_paina3 ] {};
+void() enf_paina3 =[ $paina3, enf_paina4 ] {};
+void() enf_paina4 =[ $paina4, enf_run1 ] {};
+
+void() enf_painb1 =[ $painb1, enf_painb2 ] {};
+void() enf_painb2 =[ $painb2, enf_painb3 ] {};
+void() enf_painb3 =[ $painb3, enf_painb4 ] {};
+void() enf_painb4 =[ $painb4, enf_painb5 ] {};
+void() enf_painb5 =[ $painb5, enf_run1 ] {};
+
+void() enf_painc1 =[ $painc1, enf_painc2 ] {};
+void() enf_painc2 =[ $painc2, enf_painc3 ] {};
+void() enf_painc3 =[ $painc3, enf_painc4 ] {};
+void() enf_painc4 =[ $painc4, enf_painc5 ] {};
+void() enf_painc5 =[ $painc5, enf_painc6 ] {};
+void() enf_painc6 =[ $painc6, enf_painc7 ] {};
+void() enf_painc7 =[ $painc7, enf_painc8 ] {};
+void() enf_painc8 =[ $painc8, enf_run1 ] {};
+
+void() enf_paind1 =[ $paind1, enf_paind2 ] {};
+void() enf_paind2 =[ $paind2, enf_paind3 ] {};
+void() enf_paind3 =[ $paind3, enf_paind4 ] {};
+void() enf_paind4 =[ $paind4, enf_paind5 ] {ai_painforward(2);};
+void() enf_paind5 =[ $paind5, enf_paind6 ] {ai_painforward(1);};
+void() enf_paind6 =[ $paind6, enf_paind7 ] {};
+void() enf_paind7 =[ $paind7, enf_paind8 ] {};
+void() enf_paind8 =[ $paind8, enf_paind9 ] {};
+void() enf_paind9 =[ $paind9, enf_paind10 ] {};
+void() enf_paind10 =[ $paind10, enf_paind11 ] {};
+void() enf_paind11 =[ $paind11, enf_paind12 ] {ai_painforward(1);};
+void() enf_paind12 =[ $paind12, enf_paind13 ] {ai_painforward(1);};
+void() enf_paind13 =[ $paind13, enf_paind14 ] {ai_painforward(1);};
+void() enf_paind14 =[ $paind14, enf_paind15 ] {};
+void() enf_paind15 =[ $paind15, enf_paind16 ] {};
+void() enf_paind16 =[ $paind16, enf_paind17 ] {ai_pain(1);};
+void() enf_paind17 =[ $paind17, enf_paind18 ] {ai_pain(1);};
+void() enf_paind18 =[ $paind18, enf_paind19 ] {};
+void() enf_paind19 =[ $paind19, enf_run1 ] {};
+
+void(entity attacker, float damage) enf_pain =
+{
+ local float r;
+
+ if (self.pain_finished > time)
+ return;
+
+ r = random ();
+ if (r < 0.5)
+ sound (self, CHAN_VOICE, "enforcer/pain1.wav", 1, ATTN_NORM);
+ else
+ sound (self, CHAN_VOICE, "enforcer/pain2.wav", 1, ATTN_NORM);
+
+ self.pain_finished = time + 1;
+ if (r < 0.2)
+ enf_paina1 ();
+ else if (r < 0.4)
+ enf_painb1 ();
+ else if (r < 0.7)
+ enf_painc1 ();
+ else
+ enf_paind1 ();
+};
+
+//============================================================================
+
+
+
+
+void() enf_die1 =[ $death1, enf_die2 ] {};
+void() enf_die2 =[ $death2, enf_die3 ] {};
+void() enf_die3 =[ $death3, enf_die4 ]
+{self.solid = SOLID_NOT;DropBackpack();};
+void() enf_die4 =[ $death4, enf_die5 ] {ai_forward(14);};
+void() enf_die5 =[ $death5, enf_die6 ] {ai_forward(2);};
+void() enf_die6 =[ $death6, enf_die7 ] {};
+void() enf_die7 =[ $death7, enf_die8 ] {};
+void() enf_die8 =[ $death8, enf_die9 ] {};
+void() enf_die9 =[ $death9, enf_die10 ] {ai_forward(3);};
+void() enf_die10 =[ $death10, enf_die11 ] {ai_forward(5);};
+void() enf_die11 =[ $death11, enf_die12 ] {ai_forward(5);};
+void() enf_die12 =[ $death12, enf_die13 ] {ai_forward(5);};
+void() enf_die13 =[ $death13, enf_die14 ] {};
+void() enf_die14 =[ $death14, enf_die14 ] {};
+
+void() enf_fdie1 =[ $fdeath1, enf_fdie2 ] {
+
+};
+void() enf_fdie2 =[ $fdeath2, enf_fdie3 ] {};
+void() enf_fdie3 =[ $fdeath3, enf_fdie4 ]
+{self.solid = SOLID_NOT;DropBackpack();};
+void() enf_fdie4 =[ $fdeath4, enf_fdie5 ] {};
+void() enf_fdie5 =[ $fdeath5, enf_fdie6 ] {};
+void() enf_fdie6 =[ $fdeath6, enf_fdie7 ] {};
+void() enf_fdie7 =[ $fdeath7, enf_fdie8 ] {};
+void() enf_fdie8 =[ $fdeath8, enf_fdie9 ] {};
+void() enf_fdie9 =[ $fdeath9, enf_fdie10 ] {};
+void() enf_fdie10 =[ $fdeath10, enf_fdie11 ] {};
+void() enf_fdie11 =[ $fdeath11, enf_fdie11 ] {};
+
+
+void() enf_die =
+{
+// check for gib
+ if (self.health < -35)
+ {
+ sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
+ ThrowHead ("progs/h_mega.mdl", self.health);
+ ThrowGib ("progs/gib1.mdl", self.health);
+ ThrowGib ("progs/gib2.mdl", self.health);
+ ThrowGib ("progs/gib3.mdl", self.health);
+ return;
+ }
+
+// regular death
+ sound (self, CHAN_VOICE, "enforcer/death1.wav", 1, ATTN_NORM);
+ if (random() > 0.5)
+ enf_die1 ();
+ else
+ enf_fdie1 ();
+};
+
+
+/*QUAKED monster_enforcer (1 0 0) (-16 -16 -24) (16 16 40) Ambush
+
+*/
+void() monster_enforcer =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+
+ precache_model2 ("progs/enforcer.mdl");
+ precache_model2 ("progs/h_mega.mdl");
+ precache_model2 ("progs/laser.mdl");
+
+ precache_sound2 ("enforcer/death1.wav");
+ precache_sound2 ("enforcer/enfire.wav");
+ precache_sound2 ("enforcer/enfstop.wav");
+ precache_sound2 ("enforcer/idle1.wav");
+ precache_sound2 ("enforcer/pain1.wav");
+ precache_sound2 ("enforcer/pain2.wav");
+ precache_sound2 ("enforcer/sight1.wav");
+ precache_sound2 ("enforcer/sight2.wav");
+ precache_sound2 ("enforcer/sight3.wav");
+ precache_sound2 ("enforcer/sight4.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/enforcer.mdl");
+
+ setsize (self, '-16 -16 -24', '16 16 40');
+ self.health = 80;
+
+ self.th_stand = enf_stand1;
+ self.th_walk = enf_walk1;
+ self.th_run = enf_run1;
+ self.th_pain = enf_pain;
+ self.th_die = enf_die;
+ self.th_missile = enf_atk1;
+
+ self.ammo_cells_real = 5; // drop 5 cells on death
+
+ walkmonster_start();
+};
diff --git a/r17/Revamped src/Revamped QC/quakemons/fish.qc b/r17/Revamped src/Revamped QC/quakemons/fish.qc
new file mode 100755
index 00000000..22d2bc51
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/quakemons/fish.qc
@@ -0,0 +1,186 @@
+$cd id1/models/fish
+$origin 0 0 24
+$base base
+$skin skin
+
+$frame attack1 attack2 attack3 attack4 attack5 attack6
+$frame attack7 attack8 attack9 attack10 attack11 attack12 attack13
+$frame attack14 attack15 attack16 attack17 attack18
+
+$frame death1 death2 death3 death4 death5 death6 death7
+$frame death8 death9 death10 death11 death12 death13 death14 death15
+$frame death16 death17 death18 death19 death20 death21
+
+$frame swim1 swim2 swim3 swim4 swim5 swim6 swim7 swim8
+$frame swim9 swim10 swim11 swim12 swim13 swim14 swim15 swim16 swim17
+$frame swim18
+
+$frame pain1 pain2 pain3 pain4 pain5 pain6 pain7 pain8
+$frame pain9
+
+void() swimmonster_start;
+
+void() f_stand1 =[ $swim1, f_stand2 ] {ai_stand();};
+void() f_stand2 =[ $swim2, f_stand3 ] {ai_stand();};
+void() f_stand3 =[ $swim3, f_stand4 ] {ai_stand();};
+void() f_stand4 =[ $swim4, f_stand5 ] {ai_stand();};
+void() f_stand5 =[ $swim5, f_stand6 ] {ai_stand();};
+void() f_stand6 =[ $swim6, f_stand7 ] {ai_stand();};
+void() f_stand7 =[ $swim7, f_stand8 ] {ai_stand();};
+void() f_stand8 =[ $swim8, f_stand9 ] {ai_stand();};
+void() f_stand9 =[ $swim9, f_stand10 ] {ai_stand();};
+void() f_stand10 =[ $swim10, f_stand11 ] {ai_stand();};
+void() f_stand11 =[ $swim11, f_stand12 ] {ai_stand();};
+void() f_stand12 =[ $swim12, f_stand13 ] {ai_stand();};
+void() f_stand13 =[ $swim13, f_stand14 ] {ai_stand();};
+void() f_stand14 =[ $swim14, f_stand15 ] {ai_stand();};
+void() f_stand15 =[ $swim15, f_stand16 ] {ai_stand();};
+void() f_stand16 =[ $swim16, f_stand17 ] {ai_stand();};
+void() f_stand17 =[ $swim17, f_stand18 ] {ai_stand();};
+void() f_stand18 =[ $swim18, f_stand1 ] {ai_stand();};
+
+void() f_walk1 =[ $swim1, f_walk2 ] {ai_walk(8);};
+void() f_walk2 =[ $swim2, f_walk3 ] {ai_walk(8);};
+void() f_walk3 =[ $swim3, f_walk4 ] {ai_walk(8);};
+void() f_walk4 =[ $swim4, f_walk5 ] {ai_walk(8);};
+void() f_walk5 =[ $swim5, f_walk6 ] {ai_walk(8);};
+void() f_walk6 =[ $swim6, f_walk7 ] {ai_walk(8);};
+void() f_walk7 =[ $swim7, f_walk8 ] {ai_walk(8);};
+void() f_walk8 =[ $swim8, f_walk9 ] {ai_walk(8);};
+void() f_walk9 =[ $swim9, f_walk10 ] {ai_walk(8);};
+void() f_walk10 =[ $swim10, f_walk11 ] {ai_walk(8);};
+void() f_walk11 =[ $swim11, f_walk12 ] {ai_walk(8);};
+void() f_walk12 =[ $swim12, f_walk13 ] {ai_walk(8);};
+void() f_walk13 =[ $swim13, f_walk14 ] {ai_walk(8);};
+void() f_walk14 =[ $swim14, f_walk15 ] {ai_walk(8);};
+void() f_walk15 =[ $swim15, f_walk16 ] {ai_walk(8);};
+void() f_walk16 =[ $swim16, f_walk17 ] {ai_walk(8);};
+void() f_walk17 =[ $swim17, f_walk18 ] {ai_walk(8);};
+void() f_walk18 =[ $swim18, f_walk1 ] {ai_walk(8);};
+
+void() f_run1 =[ $swim1, f_run2 ] {ai_run(12);
+ if (random() < 0.5)
+ sound (self, CHAN_VOICE, "fish/idle.wav", 1, ATTN_NORM);
+};
+void() f_run2 =[ $swim3, f_run3 ] {ai_run(12);};
+void() f_run3 =[ $swim5, f_run4 ] {ai_run(12);};
+void() f_run4 =[ $swim7, f_run5 ] {ai_run(12);};
+void() f_run5 =[ $swim9, f_run6 ] {ai_run(12);};
+void() f_run6 =[ $swim11, f_run7 ] {ai_run(12);};
+void() f_run7 =[ $swim13, f_run8 ] {ai_run(12);};
+void() f_run8 =[ $swim15, f_run9 ] {ai_run(12);};
+void() f_run9 =[ $swim17, f_run1 ] {ai_run(12);};
+
+void() fish_melee =
+{
+ local vector delta;
+ local float ldmg;
+
+ if (!self.enemy)
+ return; // removed before stroke
+
+ delta = self.enemy.origin - self.origin;
+
+ if (vlen(delta) > 60)
+ return;
+
+ sound (self, CHAN_VOICE, "fish/bite.wav", 1, ATTN_NORM);
+ ldmg = (random() + random()) * 3;
+ T_Damage (self.enemy, self, self, ldmg, MOD_FISH);
+};
+
+void() f_attack1 =[ $attack1, f_attack2 ] {ai_charge(10);};
+void() f_attack2 =[ $attack2, f_attack3 ] {ai_charge(10);};
+void() f_attack3 =[ $attack3, f_attack4 ] {fish_melee();};
+void() f_attack4 =[ $attack4, f_attack5 ] {ai_charge(10);};
+void() f_attack5 =[ $attack5, f_attack6 ] {ai_charge(10);};
+void() f_attack6 =[ $attack6, f_attack7 ] {ai_charge(10);};
+void() f_attack7 =[ $attack7, f_attack8 ] {ai_charge(10);};
+void() f_attack8 =[ $attack8, f_attack9 ] {ai_charge(10);};
+void() f_attack9 =[ $attack9, f_attack10] {fish_melee();};
+void() f_attack10 =[ $attack10, f_attack11] {ai_charge(10);};
+void() f_attack11 =[ $attack11, f_attack12] {ai_charge(10);};
+void() f_attack12 =[ $attack12, f_attack13] {ai_charge(10);};
+void() f_attack13 =[ $attack13, f_attack14] {ai_charge(10);};
+void() f_attack14 =[ $attack14, f_attack15] {ai_charge(10);};
+void() f_attack15 =[ $attack15, f_attack16] {fish_melee();};
+void() f_attack16 =[ $attack16, f_attack17] {ai_charge(10);};
+void() f_attack17 =[ $attack17, f_attack18] {ai_charge(10);};
+void() f_attack18 =[ $attack18, f_run1 ] {ai_charge(10);};
+
+void() f_death1 =[ $death1, f_death2 ] {
+sound (self, CHAN_VOICE, "fish/death.wav", 1, ATTN_NORM);
+};
+void() f_death2 =[ $death2, f_death3 ] {};
+void() f_death3 =[ $death3, f_death4 ] {self.solid = SOLID_NOT;};
+void() f_death4 =[ $death4, f_death5 ] {};
+void() f_death5 =[ $death5, f_death6 ] {};
+void() f_death6 =[ $death6, f_death7 ] {};
+void() f_death7 =[ $death7, f_death8 ] {};
+void() f_death8 =[ $death8, f_death9 ] {};
+void() f_death9 =[ $death9, f_death10 ] {};
+void() f_death10 =[ $death10, f_death11 ] {};
+void() f_death11 =[ $death11, f_death12 ] {};
+void() f_death12 =[ $death12, f_death13 ] {};
+void() f_death13 =[ $death13, f_death14 ] {};
+void() f_death14 =[ $death14, f_death15 ] {};
+void() f_death15 =[ $death15, f_death16 ] {};
+void() f_death16 =[ $death16, f_death17 ] {};
+void() f_death17 =[ $death17, f_death18 ] {};
+void() f_death18 =[ $death18, f_death19 ] {};
+void() f_death19 =[ $death19, f_death20 ] {};
+void() f_death20 =[ $death20, f_death21 ] {};
+void() f_death21 =[ $death21, f_death21 ] {};
+
+void() f_pain1 =[ $pain1, f_pain2 ] {};
+void() f_pain2 =[ $pain2, f_pain3 ] {ai_pain(6);};
+void() f_pain3 =[ $pain3, f_pain4 ] {ai_pain(6);};
+void() f_pain4 =[ $pain4, f_pain5 ] {ai_pain(6);};
+void() f_pain5 =[ $pain5, f_pain6 ] {ai_pain(6);};
+void() f_pain6 =[ $pain6, f_pain7 ] {ai_pain(6);};
+void() f_pain7 =[ $pain7, f_pain8 ] {ai_pain(6);};
+void() f_pain8 =[ $pain8, f_pain9 ] {ai_pain(6);};
+void() f_pain9 =[ $pain9, f_run1 ] {ai_pain(6);};
+
+void(entity attacker, float damage) fish_pain =
+{
+
+// fish allways do pain frames
+ f_pain1 ();
+};
+
+
+
+/*QUAKED monster_fish (1 0 0) (-16 -16 -24) (16 16 24) Ambush
+*/
+void() monster_fish =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+ precache_model2 ("progs/fish.mdl");
+
+ precache_sound2 ("fish/death.wav");
+ precache_sound2 ("fish/bite.wav");
+ precache_sound2 ("fish/idle.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/fish.mdl");
+
+ setsize (self, '-16 -16 -24', '16 16 24');
+ self.health = 25;
+
+ self.th_stand = f_stand1;
+ self.th_walk = f_walk1;
+ self.th_run = f_run1;
+ self.th_die = f_death1;
+ self.th_pain = fish_pain;
+ self.th_melee = f_attack1;
+
+ swimmonster_start ();
+};
+
diff --git a/r17/Revamped src/Revamped QC/quakemons/hknight.qc b/r17/Revamped src/Revamped QC/quakemons/hknight.qc
new file mode 100755
index 00000000..84ae0295
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/quakemons/hknight.qc
@@ -0,0 +1,442 @@
+/*
+==============================================================================
+
+KNIGHT
+
+==============================================================================
+*/
+
+$cd id1/models/knight2
+$origin 0 0 24
+$base base
+$skin skin
+
+$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9
+
+$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9
+$frame walk10 walk11 walk12 walk13 walk14 walk15 walk16 walk17
+$frame walk18 walk19 walk20
+
+$frame run1 run2 run3 run4 run5 run6 run7 run8
+
+$frame pain1 pain2 pain3 pain4 pain5
+
+$frame death1 death2 death3 death4 death5 death6 death7 death8
+$frame death9 death10 death11 death12
+
+$frame deathb1 deathb2 deathb3 deathb4 deathb5 deathb6 deathb7 deathb8
+$frame deathb9
+
+$frame char_a1 char_a2 char_a3 char_a4 char_a5 char_a6 char_a7 char_a8
+$frame char_a9 char_a10 char_a11 char_a12 char_a13 char_a14 char_a15 char_a16
+
+$frame magica1 magica2 magica3 magica4 magica5 magica6 magica7 magica8
+$frame magica9 magica10 magica11 magica12 magica13 magica14
+
+$frame magicb1 magicb2 magicb3 magicb4 magicb5 magicb6 magicb7 magicb8
+$frame magicb9 magicb10 magicb11 magicb12 magicb13
+
+$frame char_b1 char_b2 char_b3 char_b4 char_b5 char_b6
+
+$frame slice1 slice2 slice3 slice4 slice5 slice6 slice7 slice8 slice9 slice10
+
+$frame smash1 smash2 smash3 smash4 smash5 smash6 smash7 smash8 smash9 smash10
+$frame smash11
+
+$frame w_attack1 w_attack2 w_attack3 w_attack4 w_attack5 w_attack6 w_attack7
+$frame w_attack8 w_attack9 w_attack10 w_attack11 w_attack12 w_attack13 w_attack14
+$frame w_attack15 w_attack16 w_attack17 w_attack18 w_attack19 w_attack20
+$frame w_attack21 w_attack22
+
+$frame magicc1 magicc2 magicc3 magicc4 magicc5 magicc6 magicc7 magicc8
+$frame magicc9 magicc10 magicc11
+
+
+void() hknight_char_a1;
+void() hknight_run1;
+void() hk_idle_sound;
+
+void(float offset) hknight_shot =
+{
+ local vector offang;
+ local vector org, vec;
+
+ offang = vectoangles (self.enemy.origin - self.origin);
+ offang_y = offang_y + offset * 6;
+
+ makevectors (offang);
+
+ org = self.origin + self.mins + self.size*0.5 + v_forward * 20;
+
+// set missile speed
+ vec = normalize (v_forward);
+ vec_z = 0 - vec_z + (random() - 0.5)*0.1;
+
+ sound (self, CHAN_WEAPON, "hknight/attack1.wav", 1, ATTN_NORM);
+ PRJ_FireProjectile(self, "progs/k_spike.mdl", org, vec * 300, PE_KNIGHTSPIKE, 9, MOD_HKNIGHT, 6);
+};
+
+void() CheckForCharge =
+{
+ // check for mad charge
+ if (!visible(self.enemy))
+ return;
+ if (time < self.attack_finished)
+ return;
+ if ( fabs(self.origin_z - self.enemy.origin_z) > 20)
+ return; // too much height change
+ if ( vlen (self.origin - self.enemy.origin) < 80)
+ return; // use regular attack
+
+ // charge
+ SUB_AttackFinished (2);
+ hknight_char_a1 ();
+};
+
+void() CheckContinueCharge =
+{
+ if (time > self.attack_finished)
+ {
+ SUB_AttackFinished (3);
+ hknight_run1 ();
+ return; // done charging
+ }
+ if (random() > 0.5)
+ sound (self, CHAN_WEAPON, "knight/sword2.wav", 1, ATTN_NORM);
+ else
+ sound (self, CHAN_WEAPON, "knight/sword1.wav", 1, ATTN_NORM);
+};
+
+//===========================================================================
+
+void() hknight_stand1 =[ $stand1, hknight_stand2 ] {ai_stand();};
+void() hknight_stand2 =[ $stand2, hknight_stand3 ] {ai_stand();};
+void() hknight_stand3 =[ $stand3, hknight_stand4 ] {ai_stand();};
+void() hknight_stand4 =[ $stand4, hknight_stand5 ] {ai_stand();};
+void() hknight_stand5 =[ $stand5, hknight_stand6 ] {ai_stand();};
+void() hknight_stand6 =[ $stand6, hknight_stand7 ] {ai_stand();};
+void() hknight_stand7 =[ $stand7, hknight_stand8 ] {ai_stand();};
+void() hknight_stand8 =[ $stand8, hknight_stand9 ] {ai_stand();};
+void() hknight_stand9 =[ $stand9, hknight_stand1 ] {ai_stand();};
+
+//===========================================================================
+
+void() hknight_walk1 =[ $walk1, hknight_walk2 ] {
+hk_idle_sound();
+ai_walk(2);};
+void() hknight_walk2 =[ $walk2, hknight_walk3 ] {ai_walk(5);};
+void() hknight_walk3 =[ $walk3, hknight_walk4 ] {ai_walk(5);};
+void() hknight_walk4 =[ $walk4, hknight_walk5 ] {ai_walk(4);};
+void() hknight_walk5 =[ $walk5, hknight_walk6 ] {ai_walk(4);};
+void() hknight_walk6 =[ $walk6, hknight_walk7 ] {ai_walk(2);};
+void() hknight_walk7 =[ $walk7, hknight_walk8 ] {ai_walk(2);};
+void() hknight_walk8 =[ $walk8, hknight_walk9 ] {ai_walk(3);};
+void() hknight_walk9 =[ $walk9, hknight_walk10 ] {ai_walk(3);};
+void() hknight_walk10 =[ $walk10, hknight_walk11 ] {ai_walk(4);};
+void() hknight_walk11 =[ $walk11, hknight_walk12 ] {ai_walk(3);};
+void() hknight_walk12 =[ $walk12, hknight_walk13 ] {ai_walk(4);};
+void() hknight_walk13 =[ $walk13, hknight_walk14 ] {ai_walk(6);};
+void() hknight_walk14 =[ $walk14, hknight_walk15 ] {ai_walk(2);};
+void() hknight_walk15 =[ $walk15, hknight_walk16 ] {ai_walk(2);};
+void() hknight_walk16 =[ $walk16, hknight_walk17 ] {ai_walk(4);};
+void() hknight_walk17 =[ $walk17, hknight_walk18 ] {ai_walk(3);};
+void() hknight_walk18 =[ $walk18, hknight_walk19 ] {ai_walk(3);};
+void() hknight_walk19 =[ $walk19, hknight_walk20 ] {ai_walk(3);};
+void() hknight_walk20 =[ $walk20, hknight_walk1 ] {ai_walk(2);};
+
+//===========================================================================
+
+void() hknight_run1 =[ $run1, hknight_run2 ] {
+hk_idle_sound();
+ai_run (20); CheckForCharge (); };
+void() hknight_run2 =[ $run2, hknight_run3 ] {ai_run(25);};
+void() hknight_run3 =[ $run3, hknight_run4 ] {ai_run(18);};
+void() hknight_run4 =[ $run4, hknight_run5 ] {ai_run(16);};
+void() hknight_run5 =[ $run5, hknight_run6 ] {ai_run(14);};
+void() hknight_run6 =[ $run6, hknight_run7 ] {ai_run(25);};
+void() hknight_run7 =[ $run7, hknight_run8 ] {ai_run(21);};
+void() hknight_run8 =[ $run8, hknight_run1 ] {ai_run(13);};
+
+//============================================================================
+
+void() hknight_pain1 =[ $pain1, hknight_pain2 ] {sound (self, CHAN_VOICE, "hknight/pain1.wav", 1, ATTN_NORM);};
+void() hknight_pain2 =[ $pain2, hknight_pain3 ] {};
+void() hknight_pain3 =[ $pain3, hknight_pain4 ] {};
+void() hknight_pain4 =[ $pain4, hknight_pain5 ] {};
+void() hknight_pain5 =[ $pain5, hknight_run1 ] {};
+
+//============================================================================
+
+void() hknight_die1 =[ $death1, hknight_die2 ] {ai_forward(10);};
+void() hknight_die2 =[ $death2, hknight_die3 ] {ai_forward(8);};
+void() hknight_die3 =[ $death3, hknight_die4 ]
+{self.solid = SOLID_NOT; ai_forward(7);};
+void() hknight_die4 =[ $death4, hknight_die5 ] {};
+void() hknight_die5 =[ $death5, hknight_die6 ] {};
+void() hknight_die6 =[ $death6, hknight_die7 ] {};
+void() hknight_die7 =[ $death7, hknight_die8 ] {};
+void() hknight_die8 =[ $death8, hknight_die9 ] {ai_forward(10);};
+void() hknight_die9 =[ $death9, hknight_die10 ] {ai_forward(11);};
+void() hknight_die10 =[ $death10, hknight_die11 ] {};
+void() hknight_die11 =[ $death11, hknight_die12 ] {};
+void() hknight_die12 =[ $death12, hknight_die12 ] {};
+
+void() hknight_dieb1 =[ $deathb1, hknight_dieb2 ] {};
+void() hknight_dieb2 =[ $deathb2, hknight_dieb3 ] {};
+void() hknight_dieb3 =[ $deathb3, hknight_dieb4 ]
+{self.solid = SOLID_NOT;};
+void() hknight_dieb4 =[ $deathb4, hknight_dieb5 ] {};
+void() hknight_dieb5 =[ $deathb5, hknight_dieb6 ] {};
+void() hknight_dieb6 =[ $deathb6, hknight_dieb7 ] {};
+void() hknight_dieb7 =[ $deathb7, hknight_dieb8 ] {};
+void() hknight_dieb8 =[ $deathb8, hknight_dieb9 ] {};
+void() hknight_dieb9 =[ $deathb9, hknight_dieb9 ] {};
+
+void() hknight_die =
+{
+// check for gib
+ if (self.health < -40)
+ {
+ sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
+ ThrowHead ("progs/h_hellkn.mdl", self.health);
+ ThrowGib ("progs/gib1.mdl", self.health);
+ ThrowGib ("progs/gib2.mdl", self.health);
+ ThrowGib ("progs/gib3.mdl", self.health);
+ return;
+ }
+
+// regular death
+ sound (self, CHAN_VOICE, "hknight/death1.wav", 1, ATTN_NORM);
+ if (random() > 0.5)
+ hknight_die1 ();
+ else
+ hknight_dieb1 ();
+};
+
+
+//============================================================================
+#ifdef 0
+// Not used
+void() hknight_magica1 =[ $magica1, hknight_magica2 ] {ai_face();};
+void() hknight_magica2 =[ $magica2, hknight_magica3 ] {ai_face();};
+void() hknight_magica3 =[ $magica3, hknight_magica4 ] {ai_face();};
+void() hknight_magica4 =[ $magica4, hknight_magica5 ] {ai_face();};
+void() hknight_magica5 =[ $magica5, hknight_magica6 ] {ai_face();};
+void() hknight_magica6 =[ $magica6, hknight_magica7 ] {ai_face();};
+void() hknight_magica7 =[ $magica7, hknight_magica8 ] {hknight_shot(-2);};
+void() hknight_magica8 =[ $magica8, hknight_magica9 ] {hknight_shot(-1);};
+void() hknight_magica9 =[ $magica9, hknight_magica10] {hknight_shot(0);};
+void() hknight_magica10 =[ $magica10, hknight_magica11] {hknight_shot(1);};
+void() hknight_magica11 =[ $magica11, hknight_magica12] {hknight_shot(2);};
+void() hknight_magica12 =[ $magica12, hknight_magica13] {hknight_shot(3);};
+void() hknight_magica13 =[ $magica13, hknight_magica14] {ai_face();};
+void() hknight_magica14 =[ $magica14, hknight_run1 ] {ai_face();};
+
+//============================================================================
+
+void() hknight_magicb1 =[ $magicb1, hknight_magicb2 ] {ai_face();};
+void() hknight_magicb2 =[ $magicb2, hknight_magicb3 ] {ai_face();};
+void() hknight_magicb3 =[ $magicb3, hknight_magicb4 ] {ai_face();};
+void() hknight_magicb4 =[ $magicb4, hknight_magicb5 ] {ai_face();};
+void() hknight_magicb5 =[ $magicb5, hknight_magicb6 ] {ai_face();};
+void() hknight_magicb6 =[ $magicb6, hknight_magicb7 ] {ai_face();};
+void() hknight_magicb7 =[ $magicb7, hknight_magicb8 ] {hknight_shot(-2);};
+void() hknight_magicb8 =[ $magicb8, hknight_magicb9 ] {hknight_shot(-1);};
+void() hknight_magicb9 =[ $magicb9, hknight_magicb10] {hknight_shot(0);};
+void() hknight_magicb10 =[ $magicb10, hknight_magicb11] {hknight_shot(1);};
+void() hknight_magicb11 =[ $magicb11, hknight_magicb12] {hknight_shot(2);};
+void() hknight_magicb12 =[ $magicb12, hknight_magicb13] {hknight_shot(3);};
+void() hknight_magicb13 =[ $magicb13, hknight_run1] {ai_face();};
+#endif
+
+//============================================================================
+
+void() hknight_magicc1 =[ $magicc1, hknight_magicc2 ] {ai_face();};
+void() hknight_magicc2 =[ $magicc2, hknight_magicc3 ] {ai_face();};
+void() hknight_magicc3 =[ $magicc3, hknight_magicc4 ] {ai_face();};
+void() hknight_magicc4 =[ $magicc4, hknight_magicc5 ] {ai_face();};
+void() hknight_magicc5 =[ $magicc5, hknight_magicc6 ] {ai_face();};
+void() hknight_magicc6 =[ $magicc6, hknight_magicc7 ] {hknight_shot(-2);};
+void() hknight_magicc7 =[ $magicc7, hknight_magicc8 ] {hknight_shot(-1);};
+void() hknight_magicc8 =[ $magicc8, hknight_magicc9 ] {hknight_shot(0);};
+void() hknight_magicc9 =[ $magicc9, hknight_magicc10] {hknight_shot(1);};
+void() hknight_magicc10 =[ $magicc10, hknight_magicc11] {hknight_shot(2);};
+void() hknight_magicc11 =[ $magicc11, hknight_run1] {hknight_shot(3);};
+
+//===========================================================================
+
+void() hknight_char_a1 =[ $char_a1, hknight_char_a2 ] {ai_charge(20);};
+void() hknight_char_a2 =[ $char_a2, hknight_char_a3 ] {ai_charge(25);};
+void() hknight_char_a3 =[ $char_a3, hknight_char_a4 ] {ai_charge(18);};
+void() hknight_char_a4 =[ $char_a4, hknight_char_a5 ] {ai_charge(16);};
+void() hknight_char_a5 =[ $char_a5, hknight_char_a6 ] {ai_charge(14);};
+void() hknight_char_a6 =[ $char_a6, hknight_char_a7 ] {ai_charge(20); ai_melee(MOD_HKNIGHT);};
+void() hknight_char_a7 =[ $char_a7, hknight_char_a8 ] {ai_charge(21); ai_melee(MOD_HKNIGHT);};
+void() hknight_char_a8 =[ $char_a8, hknight_char_a9 ] {ai_charge(13); ai_melee(MOD_HKNIGHT);};
+void() hknight_char_a9 =[ $char_a9, hknight_char_a10 ] {ai_charge(20); ai_melee(MOD_HKNIGHT);};
+void() hknight_char_a10=[ $char_a10, hknight_char_a11 ] {ai_charge(20); ai_melee(MOD_HKNIGHT);};
+void() hknight_char_a11=[ $char_a11, hknight_char_a12 ] {ai_charge(18); ai_melee(MOD_HKNIGHT);};
+void() hknight_char_a12=[ $char_a12, hknight_char_a13 ] {ai_charge(16);};
+void() hknight_char_a13=[ $char_a13, hknight_char_a14 ] {ai_charge(14);};
+void() hknight_char_a14=[ $char_a14, hknight_char_a15 ] {ai_charge(25);};
+void() hknight_char_a15=[ $char_a15, hknight_char_a16 ] {ai_charge(21);};
+void() hknight_char_a16=[ $char_a16, hknight_run1 ] {ai_charge(13);};
+
+//===========================================================================
+
+#ifdef 0
+// Not used
+void() hknight_char_b1 =[ $char_b1, hknight_char_b2 ]
+{CheckContinueCharge (); ai_charge(23); ai_melee(MOD_HKNIGHT);};
+void() hknight_char_b2 =[ $char_b2, hknight_char_b3 ] {ai_charge(17); ai_melee(MOD_HKNIGHT);};
+void() hknight_char_b3 =[ $char_b3, hknight_char_b4 ] {ai_charge(12); ai_melee(MOD_HKNIGHT);};
+void() hknight_char_b4 =[ $char_b4, hknight_char_b5 ] {ai_charge(22); ai_melee(MOD_HKNIGHT);};
+void() hknight_char_b5 =[ $char_b5, hknight_char_b6 ] {ai_charge(18); ai_melee(MOD_HKNIGHT);};
+void() hknight_char_b6 =[ $char_b6, hknight_char_b1 ] {ai_charge(8); ai_melee(MOD_HKNIGHT);};
+#endif
+
+//===========================================================================
+
+void() hknight_slice1 =[ $slice1, hknight_slice2 ] {ai_charge(9);};
+void() hknight_slice2 =[ $slice2, hknight_slice3 ] {ai_charge(6);};
+void() hknight_slice3 =[ $slice3, hknight_slice4 ] {ai_charge(13);};
+void() hknight_slice4 =[ $slice4, hknight_slice5 ] {ai_charge(4);};
+void() hknight_slice5 =[ $slice5, hknight_slice6 ] {ai_charge(7); ai_melee(MOD_HKNIGHT);};
+void() hknight_slice6 =[ $slice6, hknight_slice7 ] {ai_charge(15); ai_melee(MOD_HKNIGHT);};
+void() hknight_slice7 =[ $slice7, hknight_slice8 ] {ai_charge(8); ai_melee(MOD_HKNIGHT);};
+void() hknight_slice8 =[ $slice8, hknight_slice9 ] {ai_charge(2); ai_melee(MOD_HKNIGHT);};
+void() hknight_slice9 =[ $slice9, hknight_slice10 ] {ai_melee(MOD_HKNIGHT);};
+void() hknight_slice10 =[ $slice10, hknight_run1 ] {ai_charge(3);};
+
+//===========================================================================
+
+void() hknight_smash1 =[ $smash1, hknight_smash2 ] {ai_charge(1);};
+void() hknight_smash2 =[ $smash2, hknight_smash3 ] {ai_charge(13);};
+void() hknight_smash3 =[ $smash3, hknight_smash4 ] {ai_charge(9);};
+void() hknight_smash4 =[ $smash4, hknight_smash5 ] {ai_charge(11);};
+void() hknight_smash5 =[ $smash5, hknight_smash6 ] {ai_charge(10); ai_melee(MOD_HKNIGHT);};
+void() hknight_smash6 =[ $smash6, hknight_smash7 ] {ai_charge(7); ai_melee(MOD_HKNIGHT);};
+void() hknight_smash7 =[ $smash7, hknight_smash8 ] {ai_charge(12); ai_melee(MOD_HKNIGHT);};
+void() hknight_smash8 =[ $smash8, hknight_smash9 ] {ai_charge(2); ai_melee(MOD_HKNIGHT);};
+void() hknight_smash9 =[ $smash9, hknight_smash10 ] {ai_charge(3); ai_melee(MOD_HKNIGHT);};
+void() hknight_smash10 =[ $smash10, hknight_smash11 ] {ai_charge(0);};
+void() hknight_smash11 =[ $smash11, hknight_run1 ] {ai_charge(0);};
+
+//============================================================================
+
+void() hknight_watk1 =[ $w_attack1, hknight_watk2 ] {ai_charge(2);};
+void() hknight_watk2 =[ $w_attack2, hknight_watk3 ] {ai_charge(0);};
+void() hknight_watk3 =[ $w_attack3, hknight_watk4 ] {ai_charge(0);};
+void() hknight_watk4 =[ $w_attack4, hknight_watk5 ] {ai_melee(MOD_HKNIGHT);};
+void() hknight_watk5 =[ $w_attack5, hknight_watk6 ] {ai_melee(MOD_HKNIGHT);};
+void() hknight_watk6 =[ $w_attack6, hknight_watk7 ] {ai_melee(MOD_HKNIGHT);};
+void() hknight_watk7 =[ $w_attack7, hknight_watk8 ] {ai_charge(1);};
+void() hknight_watk8 =[ $w_attack8, hknight_watk9 ] {ai_charge(4);};
+void() hknight_watk9 =[ $w_attack9, hknight_watk10 ] {ai_charge(5);};
+void() hknight_watk10 =[ $w_attack10, hknight_watk11 ] {ai_charge(3); ai_melee(MOD_HKNIGHT);};
+void() hknight_watk11 =[ $w_attack11, hknight_watk12 ] {ai_charge(2); ai_melee(MOD_HKNIGHT);};
+void() hknight_watk12 =[ $w_attack12, hknight_watk13 ] {ai_charge(2); ai_melee(MOD_HKNIGHT);};
+void() hknight_watk13 =[ $w_attack13, hknight_watk14 ] {ai_charge(0);};
+void() hknight_watk14 =[ $w_attack14, hknight_watk15 ] {ai_charge(0);};
+void() hknight_watk15 =[ $w_attack15, hknight_watk16 ] {ai_charge(0);};
+void() hknight_watk16 =[ $w_attack16, hknight_watk17 ] {ai_charge(1);};
+void() hknight_watk17 =[ $w_attack17, hknight_watk18 ] {ai_charge(1); ai_melee(MOD_HKNIGHT);};
+void() hknight_watk18 =[ $w_attack18, hknight_watk19 ] {ai_charge(3); ai_melee(MOD_HKNIGHT);};
+void() hknight_watk19 =[ $w_attack19, hknight_watk20 ] {ai_charge(4); ai_melee(MOD_HKNIGHT);};
+void() hknight_watk20 =[ $w_attack20, hknight_watk21 ] {ai_charge(6);};
+void() hknight_watk21 =[ $w_attack21, hknight_watk22 ] {ai_charge(7);};
+void() hknight_watk22 =[ $w_attack22, hknight_run1 ] {ai_charge(3);};
+
+//============================================================================
+
+void() hk_idle_sound =
+{
+ if (random() < 0.2)
+ sound (self, CHAN_VOICE, "hknight/idle.wav", 1, ATTN_NORM);
+};
+
+void(entity attacker, float damage) hknight_pain =
+{
+ if (self.pain_finished > time)
+ return;
+
+ sound (self, CHAN_VOICE, "hknight/pain1.wav", 1, ATTN_NORM);
+
+ if (time - self.pain_finished > 5)
+ { // allways go into pain frame if it has been a while
+ hknight_pain1 ();
+ self.pain_finished = time + 1;
+ return;
+ }
+
+ if ((random()*30 > damage) )
+ return; // didn't flinch
+
+ self.pain_finished = time + 1;
+ hknight_pain1 ();
+};
+
+void() hknight_melee =
+{
+ self.hknightattack += 1;
+
+ sound (self, CHAN_WEAPON, "hknight/slash1.wav", 1, ATTN_NORM);
+ switch (self.hknightattack)
+ {
+ case 1:
+ hknight_slice1 ();
+ break;
+ case 2:
+ hknight_smash1 ();
+ break;
+ default:
+ hknight_watk1 ();
+ self.hknightattack = 0;
+ }
+};
+
+/*QUAKED monster_hell_knight (1 0 0) (-16 -16 -24) (16 16 40) Ambush
+*/
+void() monster_hell_knight =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+ precache_model2 ("progs/hknight.mdl");
+ precache_model2 ("progs/k_spike.mdl");
+ precache_model2 ("progs/h_hellkn.mdl");
+
+ precache_sound2 ("hknight/attack1.wav");
+ precache_sound2 ("hknight/death1.wav");
+ precache_sound2 ("hknight/pain1.wav");
+ precache_sound2 ("hknight/sight1.wav");
+ precache_sound ("hknight/hit.wav"); // used by C code, so don't sound2
+ precache_sound2 ("hknight/slash1.wav");
+ precache_sound2 ("hknight/idle.wav");
+ precache_sound2 ("hknight/grunt.wav");
+
+ precache_sound ("knight/sword1.wav");
+ precache_sound ("knight/sword2.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/hknight.mdl");
+
+ setsize (self, '-16 -16 -24', '16 16 40');
+ self.health = 250;
+
+ self.th_stand = hknight_stand1;
+ self.th_walk = hknight_walk1;
+ self.th_run = hknight_run1;
+ self.th_melee = hknight_melee;
+ self.th_missile = hknight_magicc1;
+ self.th_pain = hknight_pain;
+ self.th_die = hknight_die;
+
+ self.hknightattack = floor(random() * 2.99);
+
+ walkmonster_start ();
+};
diff --git a/r17/Revamped src/Revamped QC/quakemons/knight.qc b/r17/Revamped src/Revamped QC/quakemons/knight.qc
new file mode 100755
index 00000000..257b35bf
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/quakemons/knight.qc
@@ -0,0 +1,278 @@
+/*
+==============================================================================
+
+KNIGHT
+
+==============================================================================
+*/
+
+$cd id1/models/knight
+$origin 0 0 24
+$base base
+$skin badass3
+
+$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9
+
+$frame runb1 runb2 runb3 runb4 runb5 runb6 runb7 runb8
+
+//frame runc1 runc2 runc3 runc4 runc5 runc6
+
+$frame runattack1 runattack2 runattack3 runattack4 runattack5
+$frame runattack6 runattack7 runattack8 runattack9 runattack10
+$frame runattack11
+
+$frame pain1 pain2 pain3
+
+$frame painb1 painb2 painb3 painb4 painb5 painb6 painb7 painb8 painb9
+$frame painb10 painb11
+
+//frame attack1 attack2 attack3 attack4 attack5 attack6 attack7
+//frame attack8 attack9 attack10 attack11
+
+$frame attackb0 attackb1 attackb2 attackb3 attackb4 attackb5
+$frame attackb6 attackb7 attackb8 attackb9 attackb10
+
+$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9
+$frame walk10 walk11 walk12 walk13 walk14
+
+$frame kneel1 kneel2 kneel3 kneel4 kneel5
+
+$frame standing2 standing3 standing4 standing5
+
+$frame death1 death2 death3 death4 death5 death6 death7 death8
+$frame death9 death10
+
+$frame deathb1 deathb2 deathb3 deathb4 deathb5 deathb6 deathb7 deathb8
+$frame deathb9 deathb10 deathb11
+
+void() knight_stand1 =[ $stand1, knight_stand2 ] {ai_stand();};
+void() knight_stand2 =[ $stand2, knight_stand3 ] {ai_stand();};
+void() knight_stand3 =[ $stand3, knight_stand4 ] {ai_stand();};
+void() knight_stand4 =[ $stand4, knight_stand5 ] {ai_stand();};
+void() knight_stand5 =[ $stand5, knight_stand6 ] {ai_stand();};
+void() knight_stand6 =[ $stand6, knight_stand7 ] {ai_stand();};
+void() knight_stand7 =[ $stand7, knight_stand8 ] {ai_stand();};
+void() knight_stand8 =[ $stand8, knight_stand9 ] {ai_stand();};
+void() knight_stand9 =[ $stand9, knight_stand1 ] {ai_stand();};
+
+void() knight_walk1 =[ $walk1, knight_walk2 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "knight/idle.wav", 1, ATTN_IDLE);
+ai_walk(3);};
+void() knight_walk2 =[ $walk2, knight_walk3 ] {ai_walk(2);};
+void() knight_walk3 =[ $walk3, knight_walk4 ] {ai_walk(3);};
+void() knight_walk4 =[ $walk4, knight_walk5 ] {ai_walk(4);};
+void() knight_walk5 =[ $walk5, knight_walk6 ] {ai_walk(3);};
+void() knight_walk6 =[ $walk6, knight_walk7 ] {ai_walk(3);};
+void() knight_walk7 =[ $walk7, knight_walk8 ] {ai_walk(3);};
+void() knight_walk8 =[ $walk8, knight_walk9 ] {ai_walk(4);};
+void() knight_walk9 =[ $walk9, knight_walk10 ] {ai_walk(3);};
+void() knight_walk10 =[ $walk10, knight_walk11 ] {ai_walk(3);};
+void() knight_walk11 =[ $walk11, knight_walk12 ] {ai_walk(2);};
+void() knight_walk12 =[ $walk12, knight_walk13 ] {ai_walk(3);};
+void() knight_walk13 =[ $walk13, knight_walk14 ] {ai_walk(4);};
+void() knight_walk14 =[ $walk14, knight_walk1 ] {ai_walk(3);};
+
+
+void() knight_run1 =[ $runb1, knight_run2 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "knight/idle.wav", 1, ATTN_IDLE);
+ai_run(16);};
+void() knight_run2 =[ $runb2, knight_run3 ] {ai_run(20);};
+void() knight_run3 =[ $runb3, knight_run4 ] {ai_run(13);};
+void() knight_run4 =[ $runb4, knight_run5 ] {ai_run(7);};
+void() knight_run5 =[ $runb5, knight_run6 ] {ai_run(16);};
+void() knight_run6 =[ $runb6, knight_run7 ] {ai_run(20);};
+void() knight_run7 =[ $runb7, knight_run8 ] {ai_run(14);};
+void() knight_run8 =[ $runb8, knight_run1 ] {ai_run(6);};
+
+
+void() knight_runatk1 =[ $runattack1, knight_runatk2 ]
+{
+if (random() > 0.5)
+ sound (self, CHAN_WEAPON, "knight/sword2.wav", 1, ATTN_NORM);
+else
+ sound (self, CHAN_WEAPON, "knight/sword1.wav", 1, ATTN_NORM);
+ai_charge(20);
+};
+void() knight_runatk2 =[ $runattack2, knight_runatk3 ] {ai_charge_side();};
+void() knight_runatk3 =[ $runattack3, knight_runatk4 ] {ai_charge_side();};
+void() knight_runatk4 =[ $runattack4, knight_runatk5 ] {ai_charge_side();};
+void() knight_runatk5 =[ $runattack5, knight_runatk6 ] {ai_melee_side(MOD_KNIGHT);};
+void() knight_runatk6 =[ $runattack6, knight_runatk7 ] {ai_melee_side(MOD_KNIGHT);};
+void() knight_runatk7 =[ $runattack7, knight_runatk8 ] {ai_melee_side(MOD_KNIGHT);};
+void() knight_runatk8 =[ $runattack8, knight_runatk9 ] {ai_melee_side(MOD_KNIGHT);};
+void() knight_runatk9 =[ $runattack9, knight_runatk10 ] {ai_melee_side(MOD_KNIGHT);};
+void() knight_runatk10 =[ $runattack10, knight_runatk11 ] {ai_charge_side();};
+void() knight_runatk11 =[ $runattack11, knight_run1 ] {ai_charge(10);};
+
+void() knight_atk1 =[ $attackb1, knight_atk2 ]
+{
+sound (self, CHAN_WEAPON, "knight/sword1.wav", 1, ATTN_NORM);
+ai_charge(0);};
+void() knight_atk2 =[ $attackb2, knight_atk3 ] {ai_charge(7);};
+void() knight_atk3 =[ $attackb3, knight_atk4 ] {ai_charge(4);};
+void() knight_atk4 =[ $attackb4, knight_atk5 ] {ai_charge(0);};
+void() knight_atk5 =[ $attackb5, knight_atk6 ] {ai_charge(3);};
+void() knight_atk6 =[ $attackb6, knight_atk7 ] {ai_charge(4); ai_melee(MOD_KNIGHT);};
+void() knight_atk7 =[ $attackb7, knight_atk8 ] {ai_charge(1); ai_melee(MOD_KNIGHT);};
+void() knight_atk8 =[ $attackb8, knight_atk9 ] {ai_charge(3); ai_melee(MOD_KNIGHT);};
+void() knight_atk9 =[ $attackb9, knight_atk10] {ai_charge(1);};
+void() knight_atk10=[ $attackb10, knight_run1 ] {ai_charge(5);};
+
+//void() knight_atk9 =[ $attack9, knight_atk10 ] {};
+//void() knight_atk10 =[ $attack10, knight_atk11 ] {};
+//void() knight_atk11 =[ $attack11, knight_run1 ] {};
+
+//===========================================================================
+
+void() knight_pain1 =[ $pain1, knight_pain2 ] {};
+void() knight_pain2 =[ $pain2, knight_pain3 ] {};
+void() knight_pain3 =[ $pain3, knight_run1 ] {};
+
+void() knight_painb1 =[ $painb1, knight_painb2 ] {ai_painforward(0);};
+void() knight_painb2 =[ $painb2, knight_painb3 ] {ai_painforward(3);};
+void() knight_painb3 =[ $painb3, knight_painb4 ] {};
+void() knight_painb4 =[ $painb4, knight_painb5 ] {};
+void() knight_painb5 =[ $painb5, knight_painb6 ] {ai_painforward(2);};
+void() knight_painb6 =[ $painb6, knight_painb7 ] {ai_painforward(4);};
+void() knight_painb7 =[ $painb7, knight_painb8 ] {ai_painforward(2);};
+void() knight_painb8 =[ $painb8, knight_painb9 ] {ai_painforward(5);};
+void() knight_painb9 =[ $painb9, knight_painb10 ] {ai_painforward(5);};
+void() knight_painb10 =[ $painb10, knight_painb11 ] {ai_painforward(0);};
+void() knight_painb11 =[ $painb11, knight_run1 ] {};
+
+void(entity attacker, float damage) knight_pain =
+{
+ local float r;
+
+ if (self.pain_finished > time)
+ return;
+
+ r = random();
+
+ sound (self, CHAN_VOICE, "knight/khurt.wav", 1, ATTN_NORM);
+ self.pain_finished = time + 1;
+
+ if (r < 0.85)
+ knight_pain1 ();
+ else
+ knight_painb1 ();
+
+};
+
+//===========================================================================
+
+#ifdef 0
+// Not used
+void() knight_bow1 =[ $kneel1, knight_bow2 ] {ai_turn();};
+void() knight_bow2 =[ $kneel2, knight_bow3 ] {ai_turn();};
+void() knight_bow3 =[ $kneel3, knight_bow4 ] {ai_turn();};
+void() knight_bow4 =[ $kneel4, knight_bow5 ] {ai_turn();};
+
+void() knight_bow5 =[ $kneel5, knight_bow5 ] {ai_turn();};
+
+void() knight_bow6 =[ $kneel4, knight_bow7 ] {ai_turn();};
+void() knight_bow7 =[ $kneel3, knight_bow8 ] {ai_turn();};
+void() knight_bow8 =[ $kneel2, knight_bow9 ] {ai_turn();};
+void() knight_bow9 =[ $kneel1, knight_bow10 ] {ai_turn();};
+void() knight_bow10 =[ $walk1, knight_walk1 ] {ai_turn();};
+#endif
+
+void() knight_die1 =[ $death1, knight_die2 ] {};
+void() knight_die2 =[ $death2, knight_die3 ] {};
+void() knight_die3 =[ $death3, knight_die4 ]
+{self.solid = SOLID_NOT;};
+void() knight_die4 =[ $death4, knight_die5 ] {};
+void() knight_die5 =[ $death5, knight_die6 ] {};
+void() knight_die6 =[ $death6, knight_die7 ] {};
+void() knight_die7 =[ $death7, knight_die8 ] {};
+void() knight_die8 =[ $death8, knight_die9 ] {};
+void() knight_die9 =[ $death9, knight_die10] {};
+void() knight_die10=[ $death10, knight_die10] {};
+
+
+void() knight_dieb1 =[ $deathb1, knight_dieb2 ] {};
+void() knight_dieb2 =[ $deathb2, knight_dieb3 ] {};
+void() knight_dieb3 =[ $deathb3, knight_dieb4 ]
+{self.solid = SOLID_NOT;};
+void() knight_dieb4 =[ $deathb4, knight_dieb5 ] {};
+void() knight_dieb5 =[ $deathb5, knight_dieb6 ] {};
+void() knight_dieb6 =[ $deathb6, knight_dieb7 ] {};
+void() knight_dieb7 =[ $deathb7, knight_dieb8 ] {};
+void() knight_dieb8 =[ $deathb8, knight_dieb9 ] {};
+void() knight_dieb9 =[ $deathb9, knight_dieb10] {};
+void() knight_dieb10 = [ $deathb10, knight_dieb11] {};
+void() knight_dieb11 = [ $deathb11, knight_dieb11] {};
+
+
+void() knight_die =
+{
+// check for gib
+ if (self.health < -40)
+ {
+ sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
+ ThrowHead ("progs/h_knight.mdl", self.health);
+ ThrowGib ("progs/gib1.mdl", self.health);
+ ThrowGib ("progs/gib2.mdl", self.health);
+ ThrowGib ("progs/gib3.mdl", self.health);
+ return;
+ }
+
+// regular death
+ sound (self, CHAN_VOICE, "knight/kdeath.wav", 1, ATTN_NORM);
+ if (random() < 0.5)
+ knight_die1 ();
+ else
+ knight_dieb1 ();
+};
+
+void() knight_attack =
+{
+ local float len;
+
+// decide if now is a good swing time
+ len = vlen(self.enemy.origin+self.enemy.view_ofs - (self.origin+self.view_ofs));
+
+ if (len<80)
+ knight_atk1 ();
+ else
+ knight_runatk1 ();
+};
+
+/*QUAKED monster_knight (1 0 0) (-16 -16 -24) (16 16 40) Ambush
+*/
+void() monster_knight =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+ precache_model ("progs/knight.mdl");
+ precache_model ("progs/h_knight.mdl");
+
+ precache_sound ("knight/kdeath.wav");
+ precache_sound ("knight/khurt.wav");
+ precache_sound ("knight/ksight.wav");
+ precache_sound ("knight/sword1.wav");
+ precache_sound ("knight/sword2.wav");
+ precache_sound ("knight/idle.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/knight.mdl");
+
+ setsize (self, '-16 -16 -24', '16 16 40');
+ self.health = 75;
+
+ self.th_stand = knight_stand1;
+ self.th_walk = knight_walk1;
+ self.th_run = knight_run1;
+ self.th_melee = knight_attack;
+ self.th_pain = knight_pain;
+ self.th_die = knight_die;
+
+ walkmonster_start ();
+};
diff --git a/r17/Revamped src/Revamped QC/quakemons/ogre.qc b/r17/Revamped src/Revamped QC/quakemons/ogre.qc
new file mode 100755
index 00000000..441a4845
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/quakemons/ogre.qc
@@ -0,0 +1,397 @@
+/*
+==============================================================================
+
+OGRE
+
+==============================================================================
+*/
+
+$cd id1/models/ogre_c
+$origin 0 0 24
+$base base
+$skin base
+
+$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9
+
+$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7
+$frame walk8 walk9 walk10 walk11 walk12 walk13 walk14 walk15 walk16
+
+$frame run1 run2 run3 run4 run5 run6 run7 run8
+
+$frame swing1 swing2 swing3 swing4 swing5 swing6 swing7
+$frame swing8 swing9 swing10 swing11 swing12 swing13 swing14
+
+$frame smash1 smash2 smash3 smash4 smash5 smash6 smash7
+$frame smash8 smash9 smash10 smash11 smash12 smash13 smash14
+
+$frame shoot1 shoot2 shoot3 shoot4 shoot5 shoot6
+
+$frame pain1 pain2 pain3 pain4 pain5
+
+$frame painb1 painb2 painb3
+
+$frame painc1 painc2 painc3 painc4 painc5 painc6
+
+$frame paind1 paind2 paind3 paind4 paind5 paind6 paind7 paind8 paind9 paind10
+$frame paind11 paind12 paind13 paind14 paind15 paind16
+
+$frame paine1 paine2 paine3 paine4 paine5 paine6 paine7 paine8 paine9 paine10
+$frame paine11 paine12 paine13 paine14 paine15
+
+$frame death1 death2 death3 death4 death5 death6
+$frame death7 death8 death9 death10 death11 death12
+$frame death13 death14
+
+$frame bdeath1 bdeath2 bdeath3 bdeath4 bdeath5 bdeath6
+$frame bdeath7 bdeath8 bdeath9 bdeath10
+
+$frame pull1 pull2 pull3 pull4 pull5 pull6 pull7 pull8 pull9 pull10 pull11
+
+//=============================================================================
+
+
+void() ogre_fire =
+{
+ local vector dir;
+ local entity en;
+
+ ai_face();
+
+ sound (self, CHAN_WEAPON, "weapons/ppist.wav", 1, ATTN_NORM);
+
+// fire somewhat behind the player, so a dodging player is harder to hit
+ en = self.enemy;
+
+ dir = en.origin - en.velocity*0.2;
+ dir = normalize (dir - self.origin);
+
+ FireBullets (1, dir, '0.1 0.1 0', MOD_OGRE);
+};
+//=============================================================================
+
+void() laugh =
+{
+local float r;
+r = random();
+if (r <= 0.5)
+sound (self, CHAN_AUTO, "ogre/laugh1.wav", 1, ATTN_NORM);
+else if ( r <= 0.10)
+sound (self, CHAN_AUTO, "ogre/laugh2.wav", 1, ATTN_NORM);
+else
+{}
+};
+/*
+================
+chainsaw
+
+FIXME
+================
+*/
+void(float side) chainsaw =
+{
+local vector delta;
+local float ldmg;
+
+ if (!self.enemy)
+ return;
+ if (!CanDamage (self.enemy, self))
+ return;
+
+ ai_charge(10);
+
+ delta = self.enemy.origin - self.origin;
+
+ if (vlen(delta) > 100)
+ return;
+
+ ldmg = (random() + random() + random()) * 25;
+ T_Damage (self.enemy, self, self, ldmg, MOD_OGRE);
+};
+
+
+void() ogre_stand1 =[ $stand1, ogre_stand2 ] {ai_stand();};
+void() ogre_stand2 =[ $stand2, ogre_stand3 ] {ai_stand();};
+void() ogre_stand3 =[ $stand3, ogre_stand4 ] {ai_stand(); laugh();};
+void() ogre_stand4 =[ $stand4, ogre_stand5 ] {ai_stand();};
+void() ogre_stand5 =[ $stand5, ogre_stand6 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "ogre/ogidle.wav", 1, ATTN_IDLE);
+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();};
+
+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 (self, CHAN_VOICE, "ogre/ogidle.wav", 1, ATTN_IDLE);
+};
+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 (self, CHAN_VOICE, "ogre/ogdrag.wav", 1, ATTN_IDLE);
+};
+void() ogre_walk7 =[ $walk7, ogre_walk8 ] {ai_walk(3);};
+void() ogre_walk8 =[ $walk8, ogre_walk9 ] {ai_walk(2);};
+void() ogre_walk9 =[ $walk9, ogre_walk10 ] {ai_walk(3);};
+void() ogre_walk10 =[ $walk10, ogre_walk11 ] {ai_walk(1);};
+void() ogre_walk11 =[ $walk11, ogre_walk12 ] {ai_walk(2);};
+void() ogre_walk12 =[ $walk12, ogre_walk13 ] {ai_walk(3);};
+void() ogre_walk13 =[ $walk13, ogre_walk14 ] {ai_walk(3);};
+void() ogre_walk14 =[ $walk14, ogre_walk15 ] {ai_walk(3);};
+void() ogre_walk15 =[ $walk15, ogre_walk16 ] {ai_walk(3);};
+void() ogre_walk16 =[ $walk16, ogre_walk1 ] {ai_walk(4);};
+
+void() ogre_run1 =[ $run1, ogre_run2 ] {ai_run(9);
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "ogre/ogidle2.wav", 1, ATTN_IDLE);
+};
+void() ogre_run2 =[ $run2, ogre_run3 ] {ai_run(12);};
+void() ogre_run3 =[ $run3, ogre_run4 ] {ai_run(8);};
+void() ogre_run4 =[ $run4, ogre_run5 ] {ai_run(22);};
+void() ogre_run5 =[ $run5, ogre_run6 ] {ai_run(16);};
+void() ogre_run6 =[ $run6, ogre_run7 ] {ai_run(4);};
+void() ogre_run7 =[ $run7, ogre_run8 ] {ai_run(13);};
+void() ogre_run8 =[ $run8, ogre_run1 ] {ai_run(24);};
+
+void() ogre_swing1 =[ $swing1, ogre_swing2 ] {ai_charge(11);
+sound (self, CHAN_WEAPON, "ogre/ogsawatk.wav", 1, ATTN_NORM);
+};
+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); chainsaw(0);self.angles_y = self.angles_y + random()*25;};
+void() ogre_swing6 =[ $swing6, ogre_swing7 ] {chainsaw(200);self.angles_y = self.angles_y + random()* 25;};
+void() ogre_swing7 =[ $swing7, ogre_swing8 ] {chainsaw(0);self.angles_y = self.angles_y + random()* 25;};
+void() ogre_swing8 =[ $swing8, ogre_swing9 ] {chainsaw(0);self.angles_y = self.angles_y + random()* 25;};
+void() ogre_swing9 =[ $swing9, ogre_swing10 ] {chainsaw(0);self.angles_y = self.angles_y + random()* 25;};
+void() ogre_swing10 =[ $swing10, ogre_swing11 ] {chainsaw(-200);self.angles_y = self.angles_y + random()* 25;};
+void() ogre_swing11 =[ $swing11, ogre_swing12 ] {chainsaw(0);self.angles_y = self.angles_y + random()* 25;};
+void() ogre_swing12 =[ $swing12, ogre_swing13 ] {ai_charge(3);};
+void() ogre_swing13 =[ $swing13, ogre_swing14 ] {ai_charge(8);};
+void() ogre_swing14 =[ $swing14, ogre_run1 ] {ai_charge(9);};
+
+void() ogre_smash1 =[ $smash1, ogre_smash2 ] {ai_charge(6);
+sound (self, CHAN_WEAPON, "ogre/ogsawatk.wav", 1, ATTN_NORM);
+};
+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); chainsaw(0);};
+void() ogre_smash7 =[ $smash7, ogre_smash8 ] {ai_charge(4); chainsaw(0);};
+void() ogre_smash8 =[ $smash8, ogre_smash9 ] {ai_charge(10); chainsaw(0);};
+void() ogre_smash9 =[ $smash9, ogre_smash10 ] {ai_charge(13); chainsaw(0);};
+void() ogre_smash10 =[ $smash10, ogre_smash11 ] {chainsaw(1);};
+void() ogre_smash11 =[ $smash11, ogre_smash12 ] {ai_charge(2); chainsaw(0);
+self.nextthink = time + 0.1 + random()*0.1;}; // slight variation
+//void() ogre_smash12 =[ $smash12, ogre_smash13 ] {ai_charge();};
+void() ogre_smash12 =[$smash12, ogre_smash13] {ai_charge(0);};
+void() ogre_smash13 =[ $smash13, ogre_smash14 ] {ai_charge(4);};
+void() ogre_smash14 =[ $smash14, ogre_run1 ] {ai_charge(12);};
+
+void() ogre_nail1 =[ $run1, ogre_nail2 ] {ai_face();};
+void() ogre_nail2 =[ $run2, ogre_nail3 ] {ai_face();};
+void() ogre_nail3 =[ $run2, ogre_nail4 ] {ai_face();};
+void() ogre_nail4 =[ $run3, ogre_nail5 ] {ai_face(); ogre_fire();};
+void() ogre_nail5 =[ $run4, ogre_nail6 ] {ai_face();};
+void() ogre_nail6 =[ $run5, ogre_nail7 ] {ai_face();};
+void() ogre_nail7 =[ $run6, ogre_run1 ] {ai_face();};
+
+void() ogre_pain1 =[ $pain1, ogre_pain2 ] {};
+void() ogre_pain2 =[ $pain2, ogre_pain3 ] {};
+void() ogre_pain3 =[ $pain3, ogre_pain4 ] {};
+void() ogre_pain4 =[ $pain4, ogre_pain5 ] {};
+void() ogre_pain5 =[ $pain5, ogre_run1 ] {};
+
+
+void() ogre_painb1 =[ $painb1, ogre_painb2 ] {};
+void() ogre_painb2 =[ $painb2, ogre_painb3 ] {};
+void() ogre_painb3 =[ $painb3, ogre_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 ] {};
+
+
+void() ogre_paind1 =[ $paind1, ogre_paind2 ] {};
+void() ogre_paind2 =[ $paind2, ogre_paind3 ] {ai_pain(10);};
+void() ogre_paind3 =[ $paind3, ogre_paind4 ] {ai_pain(9);};
+void() ogre_paind4 =[ $paind4, ogre_paind5 ] {ai_pain(4);};
+void() ogre_paind5 =[ $paind5, ogre_paind6 ] {};
+void() ogre_paind6 =[ $paind6, ogre_paind7 ] {};
+void() ogre_paind7 =[ $paind7, ogre_paind8 ] {};
+void() ogre_paind8 =[ $paind8, ogre_paind9 ] {};
+void() ogre_paind9 =[ $paind9, ogre_paind10 ] {};
+void() ogre_paind10=[ $paind10, ogre_paind11 ] {};
+void() ogre_paind11=[ $paind11, ogre_paind12 ] {};
+void() ogre_paind12=[ $paind12, ogre_paind13 ] {};
+void() ogre_paind13=[ $paind13, ogre_paind14 ] {};
+void() ogre_paind14=[ $paind14, ogre_paind15 ] {};
+void() ogre_paind15=[ $paind15, ogre_paind16 ] {};
+void() ogre_paind16=[ $paind16, ogre_run1 ] {};
+
+void() ogre_paine1 =[ $paine1, ogre_paine2 ] {};
+void() ogre_paine2 =[ $paine2, ogre_paine3 ] {ai_pain(10);};
+void() ogre_paine3 =[ $paine3, ogre_paine4 ] {ai_pain(9);};
+void() ogre_paine4 =[ $paine4, ogre_paine5 ] {ai_pain(4);};
+void() ogre_paine5 =[ $paine5, ogre_paine6 ] {};
+void() ogre_paine6 =[ $paine6, ogre_paine7 ] {};
+void() ogre_paine7 =[ $paine7, ogre_paine8 ] {};
+void() ogre_paine8 =[ $paine8, ogre_paine9 ] {};
+void() ogre_paine9 =[ $paine9, ogre_paine10 ] {};
+void() ogre_paine10=[ $paine10, ogre_paine11 ] {};
+void() ogre_paine11=[ $paine11, ogre_paine12 ] {};
+void() ogre_paine12=[ $paine12, ogre_paine13 ] {};
+void() ogre_paine13=[ $paine13, ogre_paine14 ] {};
+void() ogre_paine14=[ $paine14, ogre_paine15 ] {};
+void() ogre_paine15=[ $paine15, ogre_run1 ] {};
+
+
+void(entity attacker, float damage) ogre_pain =
+{
+ local float r;
+
+// don't make multiple pain sounds right after each other
+ if (self.pain_finished > time)
+ return;
+
+ sound (self, CHAN_VOICE, "ogre/ogpain1.wav", 1, ATTN_NORM);
+
+ r = random();
+
+ if (r < 0.25)
+ {
+ ogre_pain1 ();
+ self.pain_finished = time + 1;
+ }
+ else if (r < 0.5)
+ {
+ ogre_painb1 ();
+ self.pain_finished = time + 1;
+ }
+ else if (r < 0.75)
+ {
+ ogre_painc1 ();
+ self.pain_finished = time + 1;
+ }
+ else if (r < 0.88)
+ {
+ ogre_paind1 ();
+ self.pain_finished = time + 2;
+ }
+ else
+ {
+ ogre_paine1 ();
+ self.pain_finished = time + 2;
+ }
+};
+
+void() ogre_die1 =[ $death1, ogre_die2 ] {};
+void() ogre_die2 =[ $death2, ogre_die3 ] {};
+void() ogre_die3 =[ $death3, ogre_die4 ]
+{self.solid = SOLID_NOT;DropBackpack();};
+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 ] {};
+
+void() ogre_bdie1 =[ $bdeath1, ogre_bdie2 ] {};
+void() ogre_bdie2 =[ $bdeath2, ogre_bdie3 ] {ai_forward(5);};
+void() ogre_bdie3 =[ $bdeath3, ogre_bdie4 ]
+{self.solid = SOLID_NOT;DropBackpack();};
+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 ] {};
+
+void() ogre_die =
+{
+
+ sound (self, CHAN_VOICE, "ogre/ogdth.wav", 1, ATTN_NORM);
+
+ if (random() < 0.5)
+ ogre_die1 ();
+ else
+ ogre_bdie1 ();
+};
+
+void() ogre_melee =
+{
+ if (random() > 0.5)
+ ogre_smash1 ();
+ else
+ ogre_swing1 ();
+};
+
+
+/*QUAKED monster_ogre (1 0 0) (-32 -32 -24) (32 32 64) Ambush
+
+*/
+void() monster_ogre =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ }
+ precache_model ("progs/ogre.mdl");
+ precache_model ("progs/h_ogre.mdl");
+ precache_model ("progs/grenade.mdl");
+
+ precache_sound ("ogre/laugh1.wav");
+ precache_sound ("ogre/laugh2.wav");
+ precache_sound ("ogre/ogdrag.wav");
+ precache_sound ("ogre/ogdth.wav");
+ precache_sound ("ogre/ogidle.wav");
+ precache_sound ("ogre/ogidle2.wav");
+ precache_sound ("ogre/ogpain1.wav");
+ precache_sound ("ogre/ogsawatk.wav");
+ precache_sound ("ogre/ogwake.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/ogre.mdl");
+
+ setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX);
+ self.health = 800;
+
+ self.th_stand = ogre_stand1;
+ self.th_walk = ogre_walk1;
+ self.th_run = ogre_run1;
+ self.th_die = ogre_die;
+ self.th_melee = ogre_melee;
+ self.th_missile = ogre_nail1;
+ self.th_pain = ogre_pain;
+
+ self.ammo_rockets_real = 2; // drop 2 rockets on death
+
+ walkmonster_start();
+};
+
+void() monster_ogre_marksman =
+{
+ monster_ogre ();
+};
+
+
diff --git a/r17/Revamped src/Revamped QC/quakemons/oldone.qc b/r17/Revamped src/Revamped QC/quakemons/oldone.qc
new file mode 100755
index 00000000..386c11ac
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/quakemons/oldone.qc
@@ -0,0 +1,278 @@
+/*
+==============================================================================
+
+OLD ONE
+
+==============================================================================
+*/
+$cd id1/models/old_one
+$origin 0 0 24
+$base base
+$skin skin
+$scale 1
+
+void() finale_1;
+void() finale_2;
+void() finale_3;
+void() finale_4;
+
+$frame old1 old2 old3 old4 old5 old6 old7 old8 old9
+$frame old10 old11 old12 old13 old14 old15 old16 old17 old18 old19
+$frame old20 old21 old22 old23 old24 old25 old26 old27 old28 old29
+$frame old30 old31 old32 old33 old34 old35 old36 old37 old38 old39
+$frame old40 old41 old42 old43 old44 old45 old46
+
+$frame shake1 shake2 shake3 shake4 shake5 shake6 shake7 shake8
+$frame shake9 shake10 shake11 shakex shake12 shake13 shake14
+$frame shake15 shake16 shake17 shake18 shake19 shake20
+
+//void() old_stand =[ $old1, old_stand ] {};
+
+void() old_idle1 =[ $old1, old_idle2 ] {};
+void() old_idle2 =[ $old2, old_idle3 ] {};
+void() old_idle3 =[ $old3, old_idle4 ] {};
+void() old_idle4 =[ $old4, old_idle5 ] {};
+void() old_idle5 =[ $old5, old_idle6 ] {};
+void() old_idle6 =[ $old6, old_idle7 ] {};
+void() old_idle7 =[ $old7, old_idle8 ] {};
+void() old_idle8 =[ $old8, old_idle9 ] {};
+void() old_idle9 =[ $old9, old_idle10 ] {};
+void() old_idle10 =[ $old10, old_idle11 ] {};
+void() old_idle11 =[ $old11, old_idle12 ] {};
+void() old_idle12 =[ $old12, old_idle13 ] {};
+void() old_idle13 =[ $old13, old_idle14 ] {};
+void() old_idle14 =[ $old14, old_idle15 ] {};
+void() old_idle15 =[ $old15, old_idle16 ] {};
+void() old_idle16 =[ $old16, old_idle17 ] {};
+void() old_idle17 =[ $old17, old_idle18 ] {};
+void() old_idle18 =[ $old18, old_idle19 ] {};
+void() old_idle19 =[ $old19, old_idle20 ] {};
+void() old_idle20 =[ $old20, old_idle21 ] {};
+void() old_idle21 =[ $old21, old_idle22 ] {};
+void() old_idle22 =[ $old22, old_idle23 ] {};
+void() old_idle23 =[ $old23, old_idle24 ] {};
+void() old_idle24 =[ $old24, old_idle25 ] {};
+void() old_idle25 =[ $old25, old_idle26 ] {};
+void() old_idle26 =[ $old26, old_idle27 ] {};
+void() old_idle27 =[ $old27, old_idle28 ] {};
+void() old_idle28 =[ $old28, old_idle29 ] {};
+void() old_idle29 =[ $old29, old_idle30 ] {};
+void() old_idle30 =[ $old30, old_idle31 ] {};
+void() old_idle31 =[ $old31, old_idle32 ] {};
+void() old_idle32 =[ $old32, old_idle33 ] {};
+void() old_idle33 =[ $old33, old_idle34 ] {};
+void() old_idle34 =[ $old34, old_idle35 ] {};
+void() old_idle35 =[ $old35, old_idle36 ] {};
+void() old_idle36 =[ $old36, old_idle37 ] {};
+void() old_idle37 =[ $old37, old_idle38 ] {};
+void() old_idle38 =[ $old38, old_idle39 ] {};
+void() old_idle39 =[ $old39, old_idle40 ] {};
+void() old_idle40 =[ $old40, old_idle41 ] {};
+void() old_idle41 =[ $old41, old_idle42 ] {};
+void() old_idle42 =[ $old42, old_idle43 ] {};
+void() old_idle43 =[ $old43, old_idle44 ] {};
+void() old_idle44 =[ $old44, old_idle45 ] {};
+void() old_idle45 =[ $old45, old_idle46 ] {};
+void() old_idle46 =[ $old46, old_idle1 ] {};
+
+
+void() old_thrash1 =[ $shake1, old_thrash2 ] {lightstyle(0, "m");};
+void() old_thrash2 =[ $shake2, old_thrash3 ] {lightstyle(0, "k");};
+void() old_thrash3 =[ $shake3, old_thrash4 ] {lightstyle(0, "k");};
+void() old_thrash4 =[ $shake4, old_thrash5 ] {lightstyle(0, "i");};
+void() old_thrash5 =[ $shake5, old_thrash6 ] {lightstyle(0, "g");};
+void() old_thrash6 =[ $shake6, old_thrash7 ] {lightstyle(0, "e");};
+void() old_thrash7 =[ $shake7, old_thrash8 ] {lightstyle(0, "c");};
+void() old_thrash8 =[ $shake8, old_thrash9 ] {lightstyle(0, "a");};
+void() old_thrash9 =[ $shake9, old_thrash10 ] {lightstyle(0, "c");};
+void() old_thrash10 =[ $shake10, old_thrash11 ] {lightstyle(0, "e");};
+void() old_thrash11 =[ $shake11, old_thrash12 ] {lightstyle(0, "g");};
+void() old_thrash12 =[ $shake12, old_thrash13 ] {lightstyle(0, "i");};
+void() old_thrash13 =[ $shake13, old_thrash14 ] {lightstyle(0, "k");};
+void() old_thrash14 =[ $shake14, old_thrash15 ] {lightstyle(0, "m");};
+void() old_thrash15 =[ $shake15, old_thrash16 ] {lightstyle(0, "m");
+self.cnt = self.cnt + 1;
+if (self.cnt < 3)
+ self.think = old_thrash1;
+};
+void() old_thrash16 =[ $shake16, old_thrash17 ] {lightstyle(0, "g");};
+void() old_thrash17 =[ $shake17, old_thrash18 ] {lightstyle(0, "c");};
+void() old_thrash18 =[ $shake18, old_thrash19 ] {lightstyle(0, "b");};
+void() old_thrash19 =[ $shake19, old_thrash20 ] {lightstyle(0, "a");};
+void() old_thrash20 =[ $shake20, old_thrash20 ] {finale_4();};
+
+//============================================================================
+
+void() finale_1 =
+{
+ local entity pos, pl;
+ local entity timer;
+
+ // TODO: Coop friendly finale goes here
+
+ killed_monsters = killed_monsters + 1;
+ WriteByte (MSG_ALL, SVC_KILLEDMONSTER); // FIXME: reliable broadcast
+
+ intermission_exittime = time + 10000000; // never allow exit
+ intermission_running = 1;
+
+ // find the intermission spot
+ pos = find (world, classname, "info_intermission");
+ if (!pos)
+ error ("no info_intermission");
+ pl = find (world, classname, "misc_teleporttrain");
+ if (!pl)
+ error ("no teleporttrain");
+ remove (pl);
+
+ ENG_Finale("");
+
+ pl = find (world, classname, "player");
+ while (pl != world)
+ {
+ pl.view_ofs = '0 0 0';
+ pl.angles = other.v_angle = pos.mangle;
+ pl.fixangle = TRUE; // turn this way immediately
+ pl.map = self.map;
+ pl.nextthink = time + 0.5;
+ pl.takedamage = DAMAGE_NO;
+ pl.solid = SOLID_NOT;
+ pl.movetype = MOVETYPE_NONE;
+ pl.modelindex = 0;
+ setorigin (pl, pos.origin);
+ pl = find (pl, classname, "player");
+ }
+
+ // make fake versions of all players as standins, and move the real
+ // players to the intermission spot
+
+ // wait for 1 second
+ timer = spawn();
+ timer.nextthink = time + 1;
+ timer.think = finale_2;
+};
+
+void() finale_2 =
+{
+ local vector o;
+
+ // start a teleport splash inside shub
+
+ o = shub.origin - '0 100 0';
+ TE_teleport(o);
+
+ sound (shub, CHAN_VOICE, "misc/r_tele1.wav", 1, ATTN_NORM);
+
+ self.nextthink = time + 2;
+ self.think = finale_3;
+};
+
+void() finale_3 =
+{
+ // start shub thrashing wildly
+ lightstyle(0, "a");
+ shub.think = old_thrash1;
+ sound (shub, CHAN_VOICE, "boss2/death.wav", 1, ATTN_NORM);
+ remove(self);
+};
+
+void() finale_4 =
+{
+ // throw tons of meat chunks
+ local vector oldo;
+ local float x, y, z;
+ local float r;
+ local entity n;
+
+ sound (self, CHAN_VOICE, "boss2/pop2.wav", 1, ATTN_NORM);
+
+ oldo = self.origin;
+
+ z = 16;
+ while (z <= 144)
+ {
+ x = -64;
+ while (x <= 64)
+ {
+ y = -64;
+ while (y <= 64)
+ {
+ self.origin_x = oldo_x + x;
+ self.origin_y = oldo_y + y;
+ self.origin_z = oldo_z + z;
+
+ r = random();
+ if (r < 0.3)
+ ThrowGib ("progs/gib1.mdl", -999);
+ else if (r < 0.6)
+ ThrowGib ("progs/gib2.mdl", -999);
+ else
+ ThrowGib ("progs/gib3.mdl", -999);
+ y = y + 32;
+ }
+ x = x + 32;
+ }
+ z = z + 96;
+ }
+ // start the end text
+ ENG_Finale("Congratulations and well done! You have\nbeaten the hideous Shub-Niggurath, and\nher hundreds of ugly changelings and\nmonsters. You have proven that your\nskill and your cunning are greater than\nall the powers of Quake. You are the\nmaster now. Id Software salutes you.");
+
+// put a player model down
+ n = spawn();
+ setmodel (n, "progs/player.mdl");
+ oldo = oldo - '32 264 0';
+ setorigin (n, oldo);
+ n.angles = '0 290 0';
+ n.frame = 1;
+
+ remove (self);
+
+// switch cd track
+ ENG_SwitchTrack(3, 3);
+ lightstyle(0, "m");
+};
+
+//============================================================================
+
+void () nopain =
+{
+ self.health = 40000;
+};
+
+//============================================================================
+
+
+/*QUAKED monster_oldone (1 0 0) (-16 -16 -24) (16 16 32)
+*/
+void() monster_oldone =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+
+ precache_model2 ("progs/oldone.mdl");
+
+ precache_sound2 ("boss2/death.wav");
+ precache_sound2 ("boss2/idle.wav");
+ precache_sound2 ("boss2/sight.wav");
+ precache_sound2 ("boss2/pop2.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/oldone.mdl");
+ setsize (self, '-160 -128 -24', '160 128 256');
+
+ self.health = 40000; // kill by telefrag
+ self.think = old_idle1;
+ self.nextthink = time + 0.1;
+ self.takedamage = DAMAGE_YES;
+ self.th_pain = nopain;
+ self.th_die = finale_1;
+ shub = self;
+
+ total_monsters = total_monsters + 1;
+};
+
diff --git a/r17/Revamped src/Revamped QC/quakemons/shalrath.qc b/r17/Revamped src/Revamped QC/quakemons/shalrath.qc
new file mode 100755
index 00000000..6629c718
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/quakemons/shalrath.qc
@@ -0,0 +1,219 @@
+/*
+==============================================================================
+
+SHAL-RATH
+
+==============================================================================
+*/
+$cd id1/models/shalrath
+$origin 0 0 24
+$base base
+$skin skin
+$scale 0.7
+
+$frame attack1 attack2 attack3 attack4 attack5 attack6 attack7 attack8
+$frame attack9 attack10 attack11
+
+$frame pain1 pain2 pain3 pain4 pain5
+
+$frame death1 death2 death3 death4 death5 death6 death7
+
+$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9 walk10
+$frame walk11 walk12
+
+void() shalrath_pain;
+void() ShalMissile;
+void() shal_stand =[ $walk1, shal_stand ] {ai_stand();};
+
+void() shal_walk1 =[ $walk2, shal_walk2 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "shalrath/idle.wav", 1, ATTN_IDLE);
+ai_walk(6);};
+void() shal_walk2 =[ $walk3, shal_walk3 ] {ai_walk(4);};
+void() shal_walk3 =[ $walk4, shal_walk4 ] {ai_walk(0);};
+void() shal_walk4 =[ $walk5, shal_walk5 ] {ai_walk(0);};
+void() shal_walk5 =[ $walk6, shal_walk6 ] {ai_walk(0);};
+void() shal_walk6 =[ $walk7, shal_walk7 ] {ai_walk(0);};
+void() shal_walk7 =[ $walk8, shal_walk8 ] {ai_walk(5);};
+void() shal_walk8 =[ $walk9, shal_walk9 ] {ai_walk(6);};
+void() shal_walk9 =[ $walk10, shal_walk10 ] {ai_walk(5);};
+void() shal_walk10 =[ $walk11, shal_walk11 ] {ai_walk(0);};
+void() shal_walk11 =[ $walk12, shal_walk12 ] {ai_walk(4);};
+void() shal_walk12 =[ $walk1, shal_walk1 ] {ai_walk(5);};
+
+void() shal_run1 =[ $walk2, shal_run2 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "shalrath/idle.wav", 1, ATTN_IDLE);
+ai_run(6);};
+void() shal_run2 =[ $walk3, shal_run3 ] {ai_run(4);};
+void() shal_run3 =[ $walk4, shal_run4 ] {ai_run(0);};
+void() shal_run4 =[ $walk5, shal_run5 ] {ai_run(0);};
+void() shal_run5 =[ $walk6, shal_run6 ] {ai_run(0);};
+void() shal_run6 =[ $walk7, shal_run7 ] {ai_run(0);};
+void() shal_run7 =[ $walk8, shal_run8 ] {ai_run(5);};
+void() shal_run8 =[ $walk9, shal_run9 ] {ai_run(6);};
+void() shal_run9 =[ $walk10, shal_run10 ] {ai_run(5);};
+void() shal_run10 =[ $walk11, shal_run11 ] {ai_run(0);};
+void() shal_run11 =[ $walk12, shal_run12 ] {ai_run(4);};
+void() shal_run12 =[ $walk1, shal_run1 ] {ai_run(5);};
+
+void() shal_attack1 =[ $attack1, shal_attack2 ] {
+sound (self, CHAN_VOICE, "shalrath/attack.wav", 1, ATTN_NORM);
+ai_face();
+};
+void() shal_attack2 =[ $attack2, shal_attack3 ] {ai_face();};
+void() shal_attack3 =[ $attack3, shal_attack4 ] {ai_face();};
+void() shal_attack4 =[ $attack4, shal_attack5 ] {ai_face();};
+void() shal_attack5 =[ $attack5, shal_attack6 ] {ai_face();};
+void() shal_attack6 =[ $attack6, shal_attack7 ] {ai_face();};
+void() shal_attack7 =[ $attack7, shal_attack8 ] {ai_face();};
+void() shal_attack8 =[ $attack8, shal_attack9 ] {ai_face();};
+void() shal_attack9 =[ $attack9, shal_attack10 ] {ShalMissile();};
+void() shal_attack10 =[ $attack10, shal_attack11 ] {ai_face();};
+void() shal_attack11 =[ $attack11, shal_run1 ] {};
+
+void() shal_pain1 =[ $pain1, shal_pain2 ] {};
+void() shal_pain2 =[ $pain2, shal_pain3 ] {};
+void() shal_pain3 =[ $pain3, shal_pain4 ] {};
+void() shal_pain4 =[ $pain4, shal_pain5 ] {};
+void() shal_pain5 =[ $pain5, shal_run1 ] {};
+
+void() shal_death1 =[ $death1, shal_death2 ] {};
+void() shal_death2 =[ $death2, shal_death3 ] {};
+void() shal_death3 =[ $death3, shal_death4 ] {};
+void() shal_death4 =[ $death4, shal_death5 ] {};
+void() shal_death5 =[ $death5, shal_death6 ] {};
+void() shal_death6 =[ $death6, shal_death7 ] {};
+void() shal_death7 =[ $death7, shal_death7 ] {};
+
+
+void() shalrath_pain =
+{
+ if (self.pain_finished > time)
+ return;
+
+ sound (self, CHAN_VOICE, "shalrath/pain.wav", 1, ATTN_NORM);
+ shal_pain1();
+ self.pain_finished = time + 3;
+};
+
+void() shalrath_die =
+{
+// check for gib
+ if (self.health < -90)
+ {
+ sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
+ ThrowHead ("progs/h_shal.mdl", self.health);
+ ThrowGib ("progs/gib1.mdl", self.health);
+ ThrowGib ("progs/gib2.mdl", self.health);
+ ThrowGib ("progs/gib3.mdl", self.health);
+ return;
+ }
+
+ sound (self, CHAN_VOICE, "shalrath/death.wav", 1, ATTN_NORM);
+ shal_death1();
+ self.solid = SOLID_NOT;
+ // insert death sounds here
+};
+
+/*
+================
+ShalMissile
+================
+*/
+float() ShalMissileTouch;
+void() ShalHome;
+void() ShalMissile =
+{
+ local vector dir;
+ local float dist, flytime;
+
+ dir = normalize((self.enemy.origin + '0 0 10') - self.origin);
+ dist = vlen (self.enemy.origin - self.origin);
+ flytime = dist * 0.002;
+ if (flytime < 0.1)
+ flytime = 0.1;
+
+ muzzleflash();
+ sound (self, CHAN_WEAPON, "shalrath/attack2.wav", 1, ATTN_NORM);
+
+ PRJ_FireProjectile(self,
+ "progs/v_spike.mdl",
+ self.origin + '0 0 10',
+ dir * 400,
+ PE_EXPLOSION,
+ 0,
+ 0,
+ 30);
+ PRJ_SetRadiusDamage(40, 80, MOD_SHALRATH);
+ PRJ_SetThink(ShalHome, flytime, 0.2);
+ PRJ_SetTouch(ShalMissileTouch);
+ newmis.avelocity = '300 300 300';
+ newmis.enemy = self.enemy;
+};
+
+void() ShalHome =
+{
+ local vector dir, vtemp;
+ vtemp = self.enemy.origin + '0 0 10';
+ if (self.enemy.health < 1)
+ {
+ remove(self);
+ return;
+ }
+
+ dir = normalize(vtemp - self.origin);
+ if (skill > 2)
+ self.velocity = dir * 350;
+ else
+ self.velocity = dir * 250;
+};
+
+float() ShalMissileTouch =
+{
+ if (other.classname == "monster_zombie")
+ T_Damage (other, self, self, 110, MOD_SHALRATH);
+
+ return 0; // always explode on touch
+};
+
+//=================================================================
+
+/*QUAKED monster_shalrath (1 0 0) (-32 -32 -24) (32 32 48) Ambush
+*/
+void() monster_shalrath =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+ precache_model2 ("progs/shalrath.mdl");
+ precache_model2 ("progs/h_shal.mdl");
+ precache_model2 ("progs/v_spike.mdl");
+
+ precache_sound2 ("shalrath/attack.wav");
+ precache_sound2 ("shalrath/attack2.wav");
+ precache_sound2 ("shalrath/death.wav");
+ precache_sound2 ("shalrath/idle.wav");
+ precache_sound2 ("shalrath/pain.wav");
+ precache_sound2 ("shalrath/sight.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/shalrath.mdl");
+ setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX);
+ self.health = 400;
+
+ self.th_stand = shal_stand;
+ self.th_walk = shal_walk1;
+ self.th_run = shal_run1;
+ self.th_die = shalrath_die;
+ self.th_pain = shalrath_pain;
+ self.th_missile = shal_attack1;
+
+ self.think = walkmonster_start;
+ self.nextthink = time + 0.1 + random ()*0.1;
+
+};
diff --git a/r17/Revamped src/Revamped QC/quakemons/shambler.qc b/r17/Revamped src/Revamped QC/quakemons/shambler.qc
new file mode 100755
index 00000000..d90eb38f
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/quakemons/shambler.qc
@@ -0,0 +1,339 @@
+/*
+==============================================================================
+
+SHAMBLER
+
+==============================================================================
+*/
+
+$cd id1/models/shams
+$origin 0 0 24
+$base base
+$skin base
+
+$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9
+$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 smash1 smash2 smash3 smash4 smash5 smash6 smash7
+$frame smash8 smash9 smash10 smash11 smash12
+
+$frame swingr1 swingr2 swingr3 swingr4 swingr5
+$frame swingr6 swingr7 swingr8 swingr9
+
+$frame swingl1 swingl2 swingl3 swingl4 swingl5
+$frame swingl6 swingl7 swingl8 swingl9
+
+$frame magic1 magic2 magic3 magic4 magic5
+$frame magic6 magic7 magic8 magic9 magic10 magic11 magic12
+
+$frame pain1 pain2 pain3 pain4 pain5 pain6
+
+$frame death1 death2 death3 death4 death5 death6
+$frame death7 death8 death9 death10 death11
+
+void(float chrg, float damage, float side, float crnd) ShamClaw =
+{
+local vector delta;
+local float ldmg;
+
+ if (!self.enemy)
+ return;
+ ai_charge(chrg);
+
+ delta = self.enemy.origin - self.origin;
+
+ if (vlen(delta) > 100)
+ return;
+
+ ldmg = (random() + random() + random()) * damage;
+ T_Damage (self.enemy, self, self, ldmg, MOD_SHAMBLER);
+ sound (self, CHAN_VOICE, "shambler/smack.wav", 1, ATTN_NORM);
+
+ if (side)
+ {
+ makevectors (self.angles);
+ SpawnMeatSpray (self.origin + v_forward*16, (crandom() * crnd + side) * v_right);
+ }
+};
+
+
+void() sham_stand1 =[ $stand1, sham_stand2 ] {ai_stand();};
+void() sham_stand2 =[ $stand2, sham_stand3 ] {ai_stand();};
+void() sham_stand3 =[ $stand3, sham_stand4 ] {ai_stand();};
+void() sham_stand4 =[ $stand4, sham_stand5 ] {ai_stand();};
+void() sham_stand5 =[ $stand5, sham_stand6 ] {ai_stand();};
+void() sham_stand6 =[ $stand6, sham_stand7 ] {ai_stand();};
+void() sham_stand7 =[ $stand7, sham_stand8 ] {ai_stand();};
+void() sham_stand8 =[ $stand8, sham_stand9 ] {ai_stand();};
+void() sham_stand9 =[ $stand9, sham_stand10] {ai_stand();};
+void() sham_stand10 =[ $stand10, sham_stand11] {ai_stand();};
+void() sham_stand11 =[ $stand11, sham_stand12] {ai_stand();};
+void() sham_stand12 =[ $stand12, sham_stand13] {ai_stand();};
+void() sham_stand13 =[ $stand13, sham_stand14] {ai_stand();};
+void() sham_stand14 =[ $stand14, sham_stand15] {ai_stand();};
+void() sham_stand15 =[ $stand15, sham_stand16] {ai_stand();};
+void() sham_stand16 =[ $stand16, sham_stand17] {ai_stand();};
+void() sham_stand17 =[ $stand17, sham_stand1 ] {ai_stand();};
+
+void() sham_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 (self, CHAN_VOICE, "shambler/sidle.wav", 1, ATTN_IDLE);};
+
+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 (self, CHAN_VOICE, "shambler/sidle.wav", 1, ATTN_IDLE);
+};
+
+void() sham_smash1 =[ $smash1, sham_smash2 ] {
+sound (self, CHAN_VOICE, "shambler/melee1.wav", 1, ATTN_NORM);
+ai_charge(2);};
+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 ] {ShamClaw(0, 40, 0, 100);};
+void() sham_smash11 =[ $smash11, sham_smash12 ] {ai_charge(5);};
+void() sham_smash12 =[ $smash12, sham_run1 ] {ai_charge(4);};
+
+void() sham_swingr1;
+
+void() sham_swingl1 =[ $swingl1, sham_swingl2 ] {
+sound (self, CHAN_VOICE, "shambler/melee2.wav", 1, ATTN_NORM);
+ai_charge(5);};
+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); ShamClaw(10, 20, 250, 0);};
+void() sham_swingl8 =[ $swingl8, sham_swingl9 ] {ai_charge(4);};
+void() sham_swingl9 =[ $swingl9, sham_run1 ] {
+ai_charge(8);
+if (random()<0.5)
+ self.think = sham_swingr1;
+};
+
+void() sham_swingr1 =[ $swingr1, sham_swingr2 ] {
+sound (self, CHAN_VOICE, "shambler/melee1.wav", 1, ATTN_NORM);
+ai_charge(1);};
+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); ShamClaw(10, 20, -250, 0);};
+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)
+ self.think = sham_swingl1;
+};
+
+void() sham_melee =
+{
+ local float chance;
+
+ chance = random();
+ if (chance > 0.6 || self.health == 600)
+ sham_smash1 ();
+ else if (chance > 0.3)
+ sham_swingr1 ();
+ else
+ sham_swingl1 ();
+};
+
+
+//============================================================================
+
+void() CastLightning =
+{
+ local vector org, dir;
+
+ muzzleflash();
+ ai_face ();
+
+ org = self.origin + '0 0 40';
+
+ dir = self.enemy.origin + '0 0 16' - org;
+ dir = normalize (dir);
+
+ traceline (org, self.origin + dir*600, TRUE, self);
+
+ TE_lightning1(self, org, trace_endpos);
+
+ LightningDamage (org, trace_endpos, self, 10, MOD_SHAMBLER);
+};
+
+void() sham_magic1 =[ $magic1, sham_magic2 ] {ai_face();
+ sound (self, CHAN_WEAPON, "shambler/sattck1.wav", 1, ATTN_NORM);
+};
+void() sham_magic2 =[ $magic2, sham_magic3 ] {ai_face();};
+void() sham_magic3 =[ $magic3, sham_magic4 ] {ai_face();self.nextthink = time + 0.2;
+local entity o;
+
+muzzleflash();
+ai_face();
+// TODO: Spawn as an effect
+self.owner = spawn();
+o = self.owner;
+setmodel (o, "progs/s_light.mdl");
+setorigin (o, self.origin);
+o.angles = self.angles;
+o.nextthink = time + 0.7;
+o.think = SUB_Remove;
+};
+void() sham_magic4 =[ $magic4, sham_magic5 ]
+{
+self.effects = self.effects | EF_MUZZLEFLASH;
+self.owner.frame = 1;
+};
+void() sham_magic5 =[ $magic5, sham_magic6 ]
+{
+self.effects = self.effects | EF_MUZZLEFLASH;
+self.owner.frame = 2;
+};
+void() sham_magic6 =[ $magic6, sham_magic9 ]
+{
+remove (self.owner);
+CastLightning();
+sound (self, CHAN_WEAPON, "shambler/sboom.wav", 1, ATTN_NORM);
+};
+void() sham_magic9 =[ $magic9, sham_magic10 ]
+{CastLightning();};
+void() sham_magic10 =[ $magic10, sham_magic11 ]
+{CastLightning();};
+void() sham_magic11 =[ $magic11, sham_magic12 ]
+{
+if (skill > 2)
+ CastLightning();
+};
+void() sham_magic12 =[ $magic12, sham_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 ] {};
+
+void(entity attacker, float damage) sham_pain =
+{
+ sound (self, CHAN_VOICE, "shambler/shurt2.wav", 1, ATTN_NORM);
+
+ if (self.health <= 0)
+ return; // allready dying, don't go into pain frame
+
+ if (random()*400 > damage)
+ return; // didn't flinch
+
+ if (self.pain_finished > time)
+ return;
+ self.pain_finished = time + 2;
+
+ sham_pain1 ();
+};
+
+
+//============================================================================
+
+void() sham_death1 =[ $death1, sham_death2 ] {};
+void() sham_death2 =[ $death2, sham_death3 ] {};
+void() sham_death3 =[ $death3, sham_death4 ] {self.solid = SOLID_NOT;};
+void() sham_death4 =[ $death4, sham_death5 ] {};
+void() sham_death5 =[ $death5, sham_death6 ] {};
+void() sham_death6 =[ $death6, sham_death7 ] {};
+void() sham_death7 =[ $death7, sham_death8 ] {};
+void() sham_death8 =[ $death8, sham_death9 ] {};
+void() sham_death9 =[ $death9, sham_death10 ] {};
+void() sham_death10 =[ $death10, sham_death11 ] {};
+void() sham_death11 =[ $death11, sham_death11 ] {};
+
+void() sham_die =
+{
+// check for gib
+ if (self.health < -60)
+ {
+ sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
+ ThrowHead ("progs/h_shams.mdl", self.health);
+ ThrowGib ("progs/gib1.mdl", self.health);
+ ThrowGib ("progs/gib2.mdl", self.health);
+ ThrowGib ("progs/gib3.mdl", self.health);
+ return;
+ }
+
+// regular death
+ sound (self, CHAN_VOICE, "shambler/sdeath.wav", 1, ATTN_NORM);
+ sham_death1 ();
+};
+
+//============================================================================
+
+
+/*QUAKED monster_shambler (1 0 0) (-32 -32 -24) (32 32 64) Ambush
+*/
+void() monster_shambler =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+ precache_model ("progs/shambler.mdl");
+ precache_model ("progs/s_light.mdl");
+ precache_model ("progs/h_shams.mdl");
+ precache_model ("progs/bolt.mdl");
+
+ precache_sound ("shambler/sattck1.wav");
+ precache_sound ("shambler/sboom.wav");
+ precache_sound ("shambler/sdeath.wav");
+ precache_sound ("shambler/shurt2.wav");
+ precache_sound ("shambler/sidle.wav");
+ precache_sound ("shambler/ssight.wav");
+ precache_sound ("shambler/melee1.wav");
+ precache_sound ("shambler/melee2.wav");
+ precache_sound ("shambler/smack.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+ setmodel (self, "progs/shambler.mdl");
+
+ setsize (self, VEC_HULL2_MIN, VEC_HULL2_MAX);
+ self.health = 600;
+
+ self.th_stand = sham_stand1;
+ self.th_walk = sham_walk1;
+ self.th_run = sham_run1;
+ self.th_die = sham_die;
+ self.th_melee = sham_melee;
+ self.th_missile = sham_magic1;
+ self.th_pain = sham_pain;
+
+ walkmonster_start();
+};
diff --git a/r17/Revamped src/Revamped QC/quakemons/soldier.qc b/r17/Revamped src/Revamped QC/quakemons/soldier.qc
new file mode 100755
index 00000000..e9e31158
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/quakemons/soldier.qc
@@ -0,0 +1,281 @@
+/*
+==============================================================================
+
+SOLDIER / PLAYER
+
+==============================================================================
+*/
+
+$cd id1/models/soldier3
+$origin 0 -6 24
+$base base
+$skin skin
+
+$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8
+
+$frame death1 death2 death3 death4 death5 death6 death7 death8
+$frame death9 death10
+
+$frame deathc1 deathc2 deathc3 deathc4 deathc5 deathc6 deathc7 deathc8
+$frame deathc9 deathc10 deathc11
+
+$frame load1 load2 load3 load4 load5 load6 load7 load8 load9 load10 load11
+
+$frame pain1 pain2 pain3 pain4 pain5 pain6
+
+$frame painb1 painb2 painb3 painb4 painb5 painb6 painb7 painb8 painb9 painb10
+$frame painb11 painb12 painb13 painb14
+
+$frame painc1 painc2 painc3 painc4 painc5 painc6 painc7 painc8 painc9 painc10
+$frame painc11 painc12 painc13
+
+$frame run1 run2 run3 run4 run5 run6 run7 run8
+
+$frame shoot1 shoot2 shoot3 shoot4 shoot5 shoot6 shoot7 shoot8 shoot9
+
+$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
+
+/*
+==============================================================================
+SOLDIER CODE
+==============================================================================
+*/
+
+void() laughs =
+{
+local float r;
+r = random();
+if (r <= 0.5)
+sound (self, CHAN_AUTO, "soldier/laugh1.wav", 0.8, ATTN_NORM);
+else if ( r <= 0.10)
+sound (self, CHAN_AUTO, "soldier/laugh2.wav", 0.8, ATTN_NORM);
+else
+{}
+};
+void() army_fire;
+
+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();laughs();};
+void() army_stand7 =[ $stand7, army_stand8 ] {ai_stand();};
+void() army_stand8 =[ $stand8, army_stand1 ] {ai_stand();};
+
+void() army_walk1 =[ $prowl_1, army_walk2 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "soldier/idle.wav", 1, ATTN_IDLE);
+ai_walk(1);};
+void() army_walk2 =[ $prowl_2, army_walk3 ] {ai_walk(1);};
+void() army_walk3 =[ $prowl_3, army_walk4 ] {ai_walk(1);};
+void() army_walk4 =[ $prowl_4, army_walk5 ] {ai_walk(1);};
+void() army_walk5 =[ $prowl_5, army_walk6 ] {ai_walk(2);};
+void() army_walk6 =[ $prowl_6, army_walk7 ] {ai_walk(3);};
+void() army_walk7 =[ $prowl_7, army_walk8 ] {ai_walk(4);};
+void() army_walk8 =[ $prowl_8, army_walk9 ] {ai_walk(4);};
+void() army_walk9 =[ $prowl_9, army_walk10 ] {ai_walk(2);};
+void() army_walk10 =[ $prowl_10, army_walk11 ] {ai_walk(2);};
+void() army_walk11 =[ $prowl_11, army_walk12 ] {ai_walk(2);};
+void() army_walk12 =[ $prowl_12, army_walk13 ] {ai_walk(1);};
+void() army_walk13 =[ $prowl_13, army_walk14 ] {ai_walk(0);};
+void() army_walk14 =[ $prowl_14, army_walk15 ] {ai_walk(1);};
+void() army_walk15 =[ $prowl_15, army_walk16 ] {ai_walk(1);};
+void() army_walk16 =[ $prowl_16, army_walk17 ] {ai_walk(1);};
+void() army_walk17 =[ $prowl_17, army_walk18 ] {ai_walk(3);};
+void() army_walk18 =[ $prowl_18, army_walk19 ] {ai_walk(3);};
+void() army_walk19 =[ $prowl_19, army_walk20 ] {ai_walk(3);};
+void() army_walk20 =[ $prowl_20, army_walk21 ] {ai_walk(3);};
+void() army_walk21 =[ $prowl_21, army_walk22 ] {ai_walk(2);};
+void() army_walk22 =[ $prowl_22, army_walk23 ] {ai_walk(1);};
+void() army_walk23 =[ $prowl_23, army_walk24 ] {ai_walk(1);};
+void() army_walk24 =[ $prowl_24, army_walk1 ] {ai_walk(1);};
+
+void() army_run1 =[ $run1, army_run2 ] {
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "soldier/idle.wav", 1, ATTN_IDLE);
+ai_run(11);};
+void() army_run2 =[ $run2, army_run3 ] {ai_run(15);};
+void() army_run3 =[ $run3, army_run4 ] {ai_run(10);};
+void() army_run4 =[ $run4, army_run5 ] {ai_run(10);};
+void() army_run5 =[ $run5, army_run6 ] {ai_run(8);};
+void() army_run6 =[ $run6, army_run7 ] {ai_run(15);};
+void() army_run7 =[ $run7, army_run8 ] {ai_run(10);};
+void() army_run8 =[ $run8, army_run1 ] {ai_run(8);};
+
+void() army_atk1 =[ $shoot1, army_atk2 ] {ai_face();};
+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 =[ $shoot5, army_atk6 ] {ai_face(); army_fire(); muzzleflash();};
+void() army_atk6 =[ $shoot6, army_atk7 ] {ai_face();};
+void() army_atk7 =[ $shoot7, army_atk8 ] {ai_face();SUB_CheckRefire (army_atk1);};
+void() army_atk8 =[ $shoot8, army_atk9 ] {ai_face();};
+void() army_atk9 =[ $shoot9, army_run1 ] {ai_face();};
+
+
+void() army_pain1 =[ $pain1, army_pain2 ] {};
+void() army_pain2 =[ $pain2, army_pain3 ] {};
+void() army_pain3 =[ $pain3, army_pain4 ] {};
+void() army_pain4 =[ $pain4, army_pain5 ] {};
+void() army_pain5 =[ $pain5, army_pain6 ] {};
+void() army_pain6 =[ $pain6, army_run1 ] {ai_pain(1);};
+
+void() army_painb1 =[ $painb1, army_painb2 ] {};
+void() army_painb2 =[ $painb2, army_painb3 ] {ai_painforward(13);};
+void() army_painb3 =[ $painb3, army_painb4 ] {ai_painforward(9);};
+void() army_painb4 =[ $painb4, army_painb5 ] {};
+void() army_painb5 =[ $painb5, army_painb6 ] {};
+void() army_painb6 =[ $painb6, army_painb7 ] {};
+void() army_painb7 =[ $painb7, army_painb8 ] {};
+void() army_painb8 =[ $painb8, army_painb9 ] {};
+void() army_painb9 =[ $painb9, army_painb10] {};
+void() army_painb10=[ $painb10, army_painb11] {};
+void() army_painb11=[ $painb11, army_painb12] {};
+void() army_painb12=[ $painb12, army_painb13] {ai_pain(2);};
+void() army_painb13=[ $painb13, army_painb14] {};
+void() army_painb14=[ $painb14, army_run1 ] {};
+
+void() army_painc1 =[ $painc1, army_painc2 ] {};
+void() army_painc2 =[ $painc2, army_painc3 ] {ai_pain(1);};
+void() army_painc3 =[ $painc3, army_painc4 ] {};
+void() army_painc4 =[ $painc4, army_painc5 ] {};
+void() army_painc5 =[ $painc5, army_painc6 ] {ai_painforward(1);};
+void() army_painc6 =[ $painc6, army_painc7 ] {ai_painforward(1);};
+void() army_painc7 =[ $painc7, army_painc8 ] {};
+void() army_painc8 =[ $painc8, army_painc9 ] {ai_pain(1);};
+void() army_painc9 =[ $painc9, army_painc10] {ai_painforward(4);};
+void() army_painc10=[ $painc10, army_painc11] {ai_painforward(3);};
+void() army_painc11=[ $painc11, army_painc12] {ai_painforward(6);};
+void() army_painc12=[ $painc12, army_painc13] {ai_painforward(8);};
+void() army_painc13=[ $painc13, army_run1] {};
+
+void(entity attacker, float damage) army_pain =
+{
+ local float r;
+
+ if (self.pain_finished > time)
+ return;
+
+ r = random();
+
+ if (r < 0.2)
+ {
+ self.pain_finished = time + 0.6;
+ army_pain1 ();
+ sound (self, CHAN_VOICE, "soldier/pain1.wav", 1, ATTN_NORM);
+ }
+ else if (r < 0.6)
+ {
+ self.pain_finished = time + 1.1;
+ army_painb1 ();
+ sound (self, CHAN_VOICE, "soldier/pain2.wav", 1, ATTN_NORM);
+ }
+ else
+ {
+ self.pain_finished = time + 1.1;
+ army_painc1 ();
+ sound (self, CHAN_VOICE, "soldier/pain2.wav", 1, ATTN_NORM);
+ }
+};
+
+
+void() army_fire =
+{
+ local vector dir;
+ local entity en;
+
+ ai_face();
+
+ sound (self, CHAN_WEAPON, "weapons/ppist.wav", 1, ATTN_NORM);
+
+// fire somewhat behind the player, so a dodging player is harder to hit
+ en = self.enemy;
+
+ dir = en.origin - en.velocity*0.2;
+ dir = normalize (dir - self.origin);
+
+ FireBullets (1, dir, '0.1 0.1 0', MOD_SOLDIER);
+};
+
+
+
+void() army_die1 =[ $death1, army_die2 ] {};
+void() army_die2 =[ $death2, army_die3 ] {};
+void() army_die3 =[ $death3, army_die4 ] {self.solid = SOLID_NOT;DropBackpack();};
+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 ] {self.solid = SOLID_NOT;DropBackpack();ai_back(4);remove(self);};
+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 ] {};
+
+
+void() army_die =
+{
+// check for gib
+
+// regular death
+ sound (self, CHAN_VOICE, "soldier/death1.wav", 1, ATTN_NORM);
+ if (random() < 0.5)
+ army_die1 ();
+ else
+ army_cdie1 ();
+};
+
+
+/*QUAKED monster_army (1 0 0) (-16 -16 -24) (16 16 40) Ambush
+*/
+void() monster_army =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ }
+ precache_model ("progs/soldier.mdl");
+ precache_model ("progs/h_guard.mdl");
+
+ precache_sound ("soldier/laugh1.wav");
+ precache_sound ("soldier/laugh2.wav");
+ precache_sound ("soldier/death1.wav");
+ precache_sound ("soldier/idle.wav");
+ precache_sound ("soldier/pain1.wav");
+ precache_sound ("soldier/pain2.wav");
+ precache_sound ("soldier/sight1.wav");
+
+ precache_sound ("player/udeath.wav"); // gib death
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/soldier.mdl");
+
+ setsize (self, '-16 -16 -24', '16 16 40');
+ self.health = 130;
+
+ self.th_stand = army_stand1;
+ self.th_walk = army_walk1;
+ self.th_run = army_run1;
+ self.th_missile = army_atk1;
+ self.th_pain = army_pain;
+ self.th_die = army_die;
+
+ self.ammo_shells_real = 5; // drop 5 shells on death
+
+ walkmonster_start ();
+};
diff --git a/r17/Revamped src/Revamped QC/quakemons/tarbaby.qc b/r17/Revamped src/Revamped QC/quakemons/tarbaby.qc
new file mode 100755
index 00000000..430bdba2
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/quakemons/tarbaby.qc
@@ -0,0 +1,212 @@
+/*
+==============================================================================
+
+BLOB
+
+==============================================================================
+*/
+
+$cd id1/models/tarbaby
+$origin 0 0 24
+$base base
+
+$skin skin
+
+$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9 walk10
+$frame walk11 walk12 walk13 walk14 walk15 walk16 walk17 walk18 walk19
+$frame walk20 walk21 walk22 walk23 walk24 walk25
+
+$frame run1 run2 run3 run4 run5 run6 run7 run8 run9 run10 run11 run12 run13
+$frame run14 run15 run16 run17 run18 run19 run20 run21 run22 run23
+$frame run24 run25
+
+$frame jump1 jump2 jump3 jump4 jump5 jump6
+
+$frame fly1 fly2 fly3 fly4
+
+$frame exp
+
+void() tbaby_stand1 =[ $walk1, tbaby_stand1 ] {ai_stand();};
+
+void() tbaby_hang1 =[ $walk1, tbaby_hang1 ] {ai_stand();};
+
+void() tbaby_walk1 =[ $walk1, tbaby_walk2 ] {ai_turn();};
+void() tbaby_walk2 =[ $walk2, tbaby_walk3 ] {ai_turn();};
+void() tbaby_walk3 =[ $walk3, tbaby_walk4 ] {ai_turn();};
+void() tbaby_walk4 =[ $walk4, tbaby_walk5 ] {ai_turn();};
+void() tbaby_walk5 =[ $walk5, tbaby_walk6 ] {ai_turn();};
+void() tbaby_walk6 =[ $walk6, tbaby_walk7 ] {ai_turn();};
+void() tbaby_walk7 =[ $walk7, tbaby_walk8 ] {ai_turn();};
+void() tbaby_walk8 =[ $walk8, tbaby_walk9 ] {ai_turn();};
+void() tbaby_walk9 =[ $walk9, tbaby_walk10 ] {ai_turn();};
+void() tbaby_walk10 =[ $walk10, tbaby_walk11 ] {ai_turn();};
+void() tbaby_walk11 =[ $walk11, tbaby_walk12 ] {ai_walk(2);};
+void() tbaby_walk12 =[ $walk12, tbaby_walk13 ] {ai_walk(2);};
+void() tbaby_walk13 =[ $walk13, tbaby_walk14 ] {ai_walk(2);};
+void() tbaby_walk14 =[ $walk14, tbaby_walk15 ] {ai_walk(2);};
+void() tbaby_walk15 =[ $walk15, tbaby_walk16 ] {ai_walk(2);};
+void() tbaby_walk16 =[ $walk16, tbaby_walk17 ] {ai_walk(2);};
+void() tbaby_walk17 =[ $walk17, tbaby_walk18 ] {ai_walk(2);};
+void() tbaby_walk18 =[ $walk18, tbaby_walk19 ] {ai_walk(2);};
+void() tbaby_walk19 =[ $walk19, tbaby_walk20 ] {ai_walk(2);};
+void() tbaby_walk20 =[ $walk20, tbaby_walk21 ] {ai_walk(2);};
+void() tbaby_walk21 =[ $walk21, tbaby_walk22 ] {ai_walk(2);};
+void() tbaby_walk22 =[ $walk22, tbaby_walk23 ] {ai_walk(2);};
+void() tbaby_walk23 =[ $walk23, tbaby_walk24 ] {ai_walk(2);};
+void() tbaby_walk24 =[ $walk24, tbaby_walk25 ] {ai_walk(2);};
+void() tbaby_walk25 =[ $walk25, tbaby_walk1 ] {ai_walk(2);};
+
+void() tbaby_run1 =[ $run1, tbaby_run2 ] {ai_face();};
+void() tbaby_run2 =[ $run2, tbaby_run3 ] {ai_face();};
+void() tbaby_run3 =[ $run3, tbaby_run4 ] {ai_face();};
+void() tbaby_run4 =[ $run4, tbaby_run5 ] {ai_face();};
+void() tbaby_run5 =[ $run5, tbaby_run6 ] {ai_face();};
+void() tbaby_run6 =[ $run6, tbaby_run7 ] {ai_face();};
+void() tbaby_run7 =[ $run7, tbaby_run8 ] {ai_face();};
+void() tbaby_run8 =[ $run8, tbaby_run9 ] {ai_face();};
+void() tbaby_run9 =[ $run9, tbaby_run10 ] {ai_face();};
+void() tbaby_run10 =[ $run10, tbaby_run11 ] {ai_face();};
+void() tbaby_run11 =[ $run11, tbaby_run12 ] {ai_run(2);};
+void() tbaby_run12 =[ $run12, tbaby_run13 ] {ai_run(2);};
+void() tbaby_run13 =[ $run13, tbaby_run14 ] {ai_run(2);};
+void() tbaby_run14 =[ $run14, tbaby_run15 ] {ai_run(2);};
+void() tbaby_run15 =[ $run15, tbaby_run16 ] {ai_run(2);};
+void() tbaby_run16 =[ $run16, tbaby_run17 ] {ai_run(2);};
+void() tbaby_run17 =[ $run17, tbaby_run18 ] {ai_run(2);};
+void() tbaby_run18 =[ $run18, tbaby_run19 ] {ai_run(2);};
+void() tbaby_run19 =[ $run19, tbaby_run20 ] {ai_run(2);};
+void() tbaby_run20 =[ $run20, tbaby_run21 ] {ai_run(2);};
+void() tbaby_run21 =[ $run21, tbaby_run22 ] {ai_run(2);};
+void() tbaby_run22 =[ $run22, tbaby_run23 ] {ai_run(2);};
+void() tbaby_run23 =[ $run23, tbaby_run24 ] {ai_run(2);};
+void() tbaby_run24 =[ $run24, tbaby_run25 ] {ai_run(2);};
+void() tbaby_run25 =[ $run25, tbaby_run1 ] {ai_run(2);};
+
+
+//============================================================================
+
+
+void() tbaby_jump1;
+
+void() Tar_JumpTouch =
+{
+ local float ldmg;
+
+ if (other.takedamage && other.classname != self.classname)
+ {
+ if ( vlen(self.velocity) > 400 )
+ {
+ ldmg = 10 + 10*random();
+ T_Damage (other, self, self, ldmg, MOD_TARBABY);
+ sound (self, CHAN_WEAPON, "blob/hit1.wav", 1, ATTN_NORM);
+ }
+ }
+ else
+ sound (self, CHAN_WEAPON, "blob/land1.wav", 1, ATTN_NORM);
+
+
+ if (!checkbottom(self))
+ {
+ if (self.flags & FL_ONGROUND)
+ { // jump randomly to not get hung up
+ self.touch = SUB_Null;
+ self.think = tbaby_run1;
+ self.movetype = MOVETYPE_STEP;
+ self.nextthink = time + 0.1;
+ }
+ return; // not on ground yet
+ }
+
+ self.touch = SUB_Null;
+ self.think = tbaby_jump1;
+ self.nextthink = time + 0.1;
+};
+
+void() tbaby_jump5;
+
+void() tbaby_fly1 =[ $fly1, tbaby_fly2 ] {};
+void() tbaby_fly2 =[ $fly2, tbaby_fly3 ] {};
+void() tbaby_fly3 =[ $fly3, tbaby_fly4 ] {};
+void() tbaby_fly4 =[ $fly4, tbaby_fly1 ] {
+self.cnt = self.cnt + 1;
+if (self.cnt == 4)
+{
+//dprint ("spawn hop\n");
+tbaby_jump5 ();
+}
+};
+
+void() tbaby_jump1 =[ $jump1, tbaby_jump2 ] {ai_face();};
+void() tbaby_jump2 =[ $jump2, tbaby_jump3 ] {ai_face();};
+void() tbaby_jump3 =[ $jump3, tbaby_jump4 ] {ai_face();};
+void() tbaby_jump4 =[ $jump4, tbaby_jump5 ] {ai_face();};
+void() tbaby_jump5 =[ $jump5, tbaby_jump6 ]
+{
+ self.movetype = MOVETYPE_BOUNCE;
+ self.touch = Tar_JumpTouch;
+ makevectors (self.angles);
+ self.origin_z = self.origin_z + 1;
+ self.velocity = v_forward * 600 + '0 0 200';
+ self.velocity_z = self.velocity_z + random()*150;
+ if (self.flags & FL_ONGROUND)
+ self.flags = self.flags - FL_ONGROUND;
+ self.cnt = 0;
+};
+void() tbaby_jump6 =[ $jump6,tbaby_fly1 ] {};
+
+
+
+//=============================================================================
+
+void() tbaby_die1 =[ $exp, tbaby_die2 ] {
+self.takedamage = DAMAGE_NO;
+};
+void() tbaby_die2 =[ $exp, tbaby_run1 ]
+{
+ T_RadiusDamage (self, self, 120, 160, world, MOD_TARBABY);
+
+ sound (self, CHAN_VOICE, "blob/death1.wav", 1, ATTN_NORM);
+ self.origin = self.origin - 8*normalize(self.velocity);
+
+ TE_tarexplosion(self.origin);
+ CreateExplosion(self.origin);
+ remove(self);
+};
+
+//=============================================================================
+
+
+/*QUAKED monster_tarbaby (1 0 0) (-16 -16 -24) (16 16 24) Ambush
+*/
+void() monster_tarbaby =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+ precache_model2 ("progs/tarbaby.mdl");
+
+ precache_sound2 ("blob/death1.wav");
+ precache_sound2 ("blob/hit1.wav");
+ precache_sound2 ("blob/land1.wav");
+ precache_sound2 ("blob/sight1.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/tarbaby.mdl");
+
+ setsize (self, '-16 -16 -24', '16 16 40');
+ self.health = 80;
+
+ self.th_stand = tbaby_stand1;
+ self.th_walk = tbaby_walk1;
+ self.th_run = tbaby_run1;
+ self.th_missile = tbaby_jump1;
+ self.th_melee = tbaby_jump1;
+ self.th_die = tbaby_die1;
+
+ walkmonster_start ();
+};
+
diff --git a/r17/Revamped src/Revamped QC/quakemons/wizard.qc b/r17/Revamped src/Revamped QC/quakemons/wizard.qc
new file mode 100755
index 00000000..fa38681a
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/quakemons/wizard.qc
@@ -0,0 +1,320 @@
+/*
+==============================================================================
+
+WIZARD
+
+==============================================================================
+*/
+
+$cd id1/models/a_wizard
+$origin 0 0 24
+$base wizbase
+$skin wizbase
+
+$frame hover1 hover2 hover3 hover4 hover5 hover6 hover7 hover8
+$frame hover9 hover10 hover11 hover12 hover13 hover14 hover15
+
+$frame fly1 fly2 fly3 fly4 fly5 fly6 fly7 fly8 fly9 fly10
+$frame fly11 fly12 fly13 fly14
+
+$frame magatt1 magatt2 magatt3 magatt4 magatt5 magatt6 magatt7
+$frame magatt8 magatt9 magatt10 magatt11 magatt12 magatt13
+
+$frame pain1 pain2 pain3 pain4
+
+$frame death1 death2 death3 death4 death5 death6 death7 death8
+
+/*
+==============================================================================
+
+WIZARD
+
+If the player moves behind cover before the missile is launched, launch it
+at the last visible spot with no velocity leading, in hopes that the player
+will duck back out and catch it.
+==============================================================================
+*/
+
+void() wiz_run1;
+void() wiz_side1;
+
+/*
+=================
+WizardCheckAttack
+=================
+*/
+BOOL(float enemy_range) WizardCheckAttack =
+{
+ local vector spot1, spot2;
+ local entity targ;
+ local float chance;
+
+ if (time < self.attack_finished)
+ return FALSE;
+
+ if (enemy_range == RANGE_FAR)
+ {
+ if (self.attack_state != AS_STRAIGHT)
+ {
+ self.attack_state = AS_STRAIGHT;
+ wiz_run1 ();
+ }
+ return FALSE;
+ }
+
+ targ = self.enemy;
+
+// see if any entities are in the way of the shot
+ spot1 = self.origin + self.view_ofs;
+ spot2 = targ.origin + targ.view_ofs;
+
+ traceline (spot1, spot2, FALSE, self);
+
+ if (trace_ent != targ)
+ { // don't have a clear shot, so move to a side
+ if (self.attack_state != AS_STRAIGHT)
+ {
+ self.attack_state = AS_STRAIGHT;
+ wiz_run1 ();
+ }
+ return FALSE;
+ }
+
+ if (enemy_range == RANGE_MELEE)
+ chance = 0.9;
+ else if (enemy_range == RANGE_NEAR)
+ chance = 0.6;
+ else if (enemy_range == RANGE_MID)
+ chance = 0.2;
+ else
+ chance = 0;
+
+ if (random () < chance)
+ {
+ self.attack_state = AS_MISSILE;
+ return TRUE;
+ }
+
+ if (enemy_range == RANGE_MID)
+ {
+ if (self.attack_state != AS_STRAIGHT)
+ {
+ self.attack_state = AS_STRAIGHT;
+ wiz_run1 ();
+ }
+ }
+ else
+ {
+ if (self.attack_state != AS_SLIDING)
+ {
+ self.attack_state = AS_SLIDING;
+ wiz_side1 ();
+ }
+ }
+
+ return FALSE;
+};
+
+/*
+=================
+WizardAttackFinished
+=================
+*/
+void() WizardAttackFinished =
+{
+ if (range(self.enemy) >= RANGE_MID || !visible(self.enemy))
+ {
+ self.attack_state = AS_STRAIGHT;
+ self.think = wiz_run1;
+ }
+ else
+ {
+ self.attack_state = AS_SLIDING;
+ self.think = wiz_side1;
+ }
+};
+
+/*
+==============================================================================
+
+FAST ATTACKS
+
+==============================================================================
+*/
+
+void(float side) Wiz_FastFire =
+{
+ local vector org, vec;
+
+ muzzleflash();
+ sound (self, CHAN_WEAPON, "wizard/wattack.wav", 1, ATTN_NORM);
+
+ makevectors (self.angles);
+ org = self.origin + '0 0 30' + v_forward*14 + v_right*side*14;
+ vec = normalize(self.enemy.origin - v_right*side*13 - org) * 600;
+
+ PRJ_FireProjectile (self, "progs/w_spike.mdl", org, vec, PE_WIZSPIKE, 9, MOD_WIZARD, 6);
+};
+
+void() Wiz_idlesound =
+{
+ local float wr;
+
+ if (self.wizardidle < time)
+ {
+ wr = random();
+
+ if (wr > 0.9)
+ sound (self, CHAN_VOICE, "wizard/widle1.wav", 1, ATTN_IDLE);
+ else if (wr < 0.3)
+ sound (self, CHAN_VOICE, "wizard/widle2.wav", 1, ATTN_IDLE);
+
+ self.wizardidle = time + 2;
+ }
+
+ return;
+};
+
+void() wiz_stand1 =[ $hover1, wiz_stand2 ] {ai_stand();};
+void() wiz_stand2 =[ $hover2, wiz_stand3 ] {ai_stand();};
+void() wiz_stand3 =[ $hover3, wiz_stand4 ] {ai_stand();};
+void() wiz_stand4 =[ $hover4, wiz_stand5 ] {ai_stand();};
+void() wiz_stand5 =[ $hover5, wiz_stand6 ] {ai_stand();};
+void() wiz_stand6 =[ $hover6, wiz_stand7 ] {ai_stand();};
+void() wiz_stand7 =[ $hover7, wiz_stand8 ] {ai_stand();};
+void() wiz_stand8 =[ $hover8, wiz_stand1 ] {ai_stand();};
+
+void() wiz_walk1 =[ $hover1, wiz_walk2 ] {ai_walk(8);
+Wiz_idlesound();};
+void() wiz_walk2 =[ $hover2, wiz_walk3 ] {ai_walk(8);};
+void() wiz_walk3 =[ $hover3, wiz_walk4 ] {ai_walk(8);};
+void() wiz_walk4 =[ $hover4, wiz_walk5 ] {ai_walk(8);};
+void() wiz_walk5 =[ $hover5, wiz_walk6 ] {ai_walk(8);};
+void() wiz_walk6 =[ $hover6, wiz_walk7 ] {ai_walk(8);};
+void() wiz_walk7 =[ $hover7, wiz_walk8 ] {ai_walk(8);};
+void() wiz_walk8 =[ $hover8, wiz_walk1 ] {ai_walk(8);};
+
+void() wiz_side1 =[ $hover1, wiz_side2 ] {ai_run(8);
+Wiz_idlesound();};
+void() wiz_side2 =[ $hover2, wiz_side3 ] {ai_run(8);};
+void() wiz_side3 =[ $hover3, wiz_side4 ] {ai_run(8);};
+void() wiz_side4 =[ $hover4, wiz_side5 ] {ai_run(8);};
+void() wiz_side5 =[ $hover5, wiz_side6 ] {ai_run(8);};
+void() wiz_side6 =[ $hover6, wiz_side7 ] {ai_run(8);};
+void() wiz_side7 =[ $hover7, wiz_side8 ] {ai_run(8);};
+void() wiz_side8 =[ $hover8, wiz_side1 ] {ai_run(8);};
+
+void() wiz_run1 =[ $fly1, wiz_run2 ] {ai_run(16);
+Wiz_idlesound();
+};
+void() wiz_run2 =[ $fly2, wiz_run3 ] {ai_run(16);};
+void() wiz_run3 =[ $fly3, wiz_run4 ] {ai_run(16);};
+void() wiz_run4 =[ $fly4, wiz_run5 ] {ai_run(16);};
+void() wiz_run5 =[ $fly5, wiz_run6 ] {ai_run(16);};
+void() wiz_run6 =[ $fly6, wiz_run7 ] {ai_run(16);};
+void() wiz_run7 =[ $fly7, wiz_run8 ] {ai_run(16);};
+void() wiz_run8 =[ $fly8, wiz_run9 ] {ai_run(16);};
+void() wiz_run9 =[ $fly9, wiz_run10 ] {ai_run(16);};
+void() wiz_run10 =[ $fly10, wiz_run11 ] {ai_run(16);};
+void() wiz_run11 =[ $fly11, wiz_run12 ] {ai_run(16);};
+void() wiz_run12 =[ $fly12, wiz_run13 ] {ai_run(16);};
+void() wiz_run13 =[ $fly13, wiz_run14 ] {ai_run(16);};
+void() wiz_run14 =[ $fly14, wiz_run1 ] {ai_run(16);};
+
+void() wiz_fast1 =[ $magatt1, wiz_fast2 ] {ai_face();};
+void() wiz_fast2 =[ $magatt2, wiz_fast3 ] {ai_face();};
+void() wiz_fast3 =[ $magatt3, wiz_fast4 ] {ai_face();};
+void() wiz_fast4 =[ $magatt4, wiz_fast5 ] {ai_face();Wiz_FastFire(-1);};
+void() wiz_fast5 =[ $magatt5, wiz_fast6 ] {ai_face();};
+void() wiz_fast6 =[ $magatt6, wiz_fast7 ] {ai_face();};
+void() wiz_fast7 =[ $magatt5, wiz_fast8 ] {ai_face();};
+void() wiz_fast8 =[ $magatt4, wiz_fast9 ] {ai_face();};
+void() wiz_fast9 =[ $magatt3, wiz_fast10 ] {ai_face();Wiz_FastFire(1);};
+void() wiz_fast10 =[ $magatt2, wiz_run1 ] {ai_face();SUB_AttackFinished(2);WizardAttackFinished ();};
+
+void() wiz_pain1 =[ $pain1, wiz_pain2 ] {};
+void() wiz_pain2 =[ $pain2, wiz_pain3 ] {};
+void() wiz_pain3 =[ $pain3, wiz_pain4 ] {};
+void() wiz_pain4 =[ $pain4, wiz_run1 ] {};
+
+void() wiz_death1 =[ $death1, wiz_death2 ] {
+
+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 (self, CHAN_VOICE, "wizard/wdeath.wav", 1, ATTN_NORM);
+};
+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 ] {};
+
+void() wiz_die =
+{
+// check for gib
+ if (self.health < -40)
+ {
+ sound (self, CHAN_VOICE, "player/udeath.wav", 1, ATTN_NORM);
+ ThrowHead ("progs/h_wizard.mdl", self.health);
+ ThrowGib ("progs/gib2.mdl", self.health);
+ ThrowGib ("progs/gib2.mdl", self.health);
+ ThrowGib ("progs/gib2.mdl", self.health);
+ return;
+ }
+
+ wiz_death1 ();
+};
+
+
+void(entity attacker, float damage) Wiz_Pain =
+{
+ sound (self, CHAN_VOICE, "wizard/wpain.wav", 1, ATTN_NORM);
+ if (random()*70 > damage)
+ return; // didn't flinch
+
+ wiz_pain1 ();
+};
+
+/*QUAKED monster_wizard (1 0 0) (-16 -16 -24) (16 16 40) Ambush
+*/
+void() monster_wizard =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+ precache_model ("progs/wizard.mdl");
+ precache_model ("progs/h_wizard.mdl");
+ precache_model ("progs/w_spike.mdl");
+
+ precache_sound ("wizard/hit.wav"); // used by c code
+ precache_sound ("wizard/wattack.wav");
+ precache_sound ("wizard/wdeath.wav");
+ precache_sound ("wizard/widle1.wav");
+ precache_sound ("wizard/widle2.wav");
+ precache_sound ("wizard/wpain.wav");
+ precache_sound ("wizard/wsight.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/wizard.mdl");
+
+ setsize (self, '-16 -16 -24', '16 16 40');
+ self.health = 80;
+
+ self.th_stand = wiz_stand1;
+ self.th_walk = wiz_walk1;
+ self.th_run = wiz_run1;
+ self.th_missile = wiz_fast1;
+ self.th_pain = Wiz_Pain;
+ self.th_die = wiz_die;
+
+ flymonster_start ();
+};
+
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/quakemons/zombie.qc b/r17/Revamped src/Revamped QC/quakemons/zombie.qc
new file mode 100755
index 00000000..9a1c0a46
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/quakemons/zombie.qc
@@ -0,0 +1,473 @@
+/*
+==============================================================================
+
+ZOMBIE
+
+==============================================================================
+*/
+$cd id1/models/zombie
+
+$origin 0 0 24
+
+$base base
+$skin skin
+
+$frame stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8
+$frame stand9 stand10 stand11 stand12 stand13 stand14 stand15
+
+$frame walk1 walk2 walk3 walk4 walk5 walk6 walk7 walk8 walk9 walk10 walk11
+$frame walk12 walk13 walk14 walk15 walk16 walk17 walk18 walk19
+
+$frame run1 run2 run3 run4 run5 run6 run7 run8 run9 run10 run11 run12
+$frame run13 run14 run15 run16 run17 run18
+
+$frame atta1 atta2 atta3 atta4 atta5 atta6 atta7 atta8 atta9 atta10 atta11
+$frame atta12 atta13
+
+$frame attb1 attb2 attb3 attb4 attb5 attb6 attb7 attb8 attb9 attb10 attb11
+$frame attb12 attb13 attb14
+
+$frame attc1 attc2 attc3 attc4 attc5 attc6 attc7 attc8 attc9 attc10 attc11
+$frame attc12
+
+$frame paina1 paina2 paina3 paina4 paina5 paina6 paina7 paina8 paina9 paina10
+$frame paina11 paina12
+
+$frame painb1 painb2 painb3 painb4 painb5 painb6 painb7 painb8 painb9 painb10
+$frame painb11 painb12 painb13 painb14 painb15 painb16 painb17 painb18 painb19
+$frame painb20 painb21 painb22 painb23 painb24 painb25 painb26 painb27 painb28
+
+$frame painc1 painc2 painc3 painc4 painc5 painc6 painc7 painc8 painc9 painc10
+$frame painc11 painc12 painc13 painc14 painc15 painc16 painc17 painc18
+
+$frame paind1 paind2 paind3 paind4 paind5 paind6 paind7 paind8 paind9 paind10
+$frame paind11 paind12 paind13
+
+$frame paine1 paine2 paine3 paine4 paine5 paine6 paine7 paine8 paine9 paine10
+$frame paine11 paine12 paine13 paine14 paine15 paine16 paine17 paine18 paine19
+$frame paine20 paine21 paine22 paine23 paine24 paine25 paine26 paine27 paine28
+$frame paine29 paine30
+
+$frame cruc_1 cruc_2 cruc_3 cruc_4 cruc_5 cruc_6
+
+float SPAWN_CRUCIFIED = 1;
+
+//=============================================================================
+
+void() zombie_stand1 =[ $stand1, zombie_stand2 ] {ai_stand();};
+void() zombie_stand2 =[ $stand2, zombie_stand3 ] {ai_stand();};
+void() zombie_stand3 =[ $stand3, zombie_stand4 ] {ai_stand();};
+void() zombie_stand4 =[ $stand4, zombie_stand5 ] {ai_stand();};
+void() zombie_stand5 =[ $stand5, zombie_stand6 ] {ai_stand();};
+void() zombie_stand6 =[ $stand6, zombie_stand7 ] {ai_stand();};
+void() zombie_stand7 =[ $stand7, zombie_stand8 ] {ai_stand();};
+void() zombie_stand8 =[ $stand8, zombie_stand9 ] {ai_stand();};
+void() zombie_stand9 =[ $stand9, zombie_stand10 ] {ai_stand();};
+void() zombie_stand10 =[ $stand10, zombie_stand11 ] {ai_stand();};
+void() zombie_stand11 =[ $stand11, zombie_stand12 ] {ai_stand();};
+void() zombie_stand12 =[ $stand12, zombie_stand13 ] {ai_stand();};
+void() zombie_stand13 =[ $stand13, zombie_stand14 ] {ai_stand();};
+void() zombie_stand14 =[ $stand14, zombie_stand15 ] {ai_stand();};
+void() zombie_stand15 =[ $stand15, zombie_stand1 ] {ai_stand();};
+
+void() zombie_cruc1 = [ $cruc_1, zombie_cruc2 ] {
+if (random() < 0.1)
+ sound (self, CHAN_VOICE, "zombie/idle_w2.wav", 1, ATTN_STATIC);};
+void() zombie_cruc2 = [ $cruc_2, zombie_cruc3 ] {self.nextthink = time + 0.1 + random()*0.1;};
+void() zombie_cruc3 = [ $cruc_3, zombie_cruc4 ] {self.nextthink = time + 0.1 + random()*0.1;};
+void() zombie_cruc4 = [ $cruc_4, zombie_cruc5 ] {self.nextthink = time + 0.1 + random()*0.1;};
+void() zombie_cruc5 = [ $cruc_5, zombie_cruc6 ] {self.nextthink = time + 0.1 + random()*0.1;};
+void() zombie_cruc6 = [ $cruc_6, zombie_cruc1 ] {self.nextthink = time + 0.1 + random()*0.1;};
+
+void() zombie_walk1 =[ $walk1, zombie_walk2 ] {ai_walk(0);};
+void() zombie_walk2 =[ $walk2, zombie_walk3 ] {ai_walk(2);};
+void() zombie_walk3 =[ $walk3, zombie_walk4 ] {ai_walk(3);};
+void() zombie_walk4 =[ $walk4, zombie_walk5 ] {ai_walk(2);};
+void() zombie_walk5 =[ $walk5, zombie_walk6 ] {ai_walk(1);};
+void() zombie_walk6 =[ $walk6, zombie_walk7 ] {ai_walk(0);};
+void() zombie_walk7 =[ $walk7, zombie_walk8 ] {ai_walk(0);};
+void() zombie_walk8 =[ $walk8, zombie_walk9 ] {ai_walk(0);};
+void() zombie_walk9 =[ $walk9, zombie_walk10 ] {ai_walk(0);};
+void() zombie_walk10 =[ $walk10, zombie_walk11 ] {ai_walk(0);};
+void() zombie_walk11 =[ $walk11, zombie_walk12 ] {ai_walk(2);};
+void() zombie_walk12 =[ $walk12, zombie_walk13 ] {ai_walk(2);};
+void() zombie_walk13 =[ $walk13, zombie_walk14 ] {ai_walk(1);};
+void() zombie_walk14 =[ $walk14, zombie_walk15 ] {ai_walk(0);};
+void() zombie_walk15 =[ $walk15, zombie_walk16 ] {ai_walk(0);};
+void() zombie_walk16 =[ $walk16, zombie_walk17 ] {ai_walk(0);};
+void() zombie_walk17 =[ $walk17, zombie_walk18 ] {ai_walk(0);};
+void() zombie_walk18 =[ $walk18, zombie_walk19 ] {ai_walk(0);};
+void() zombie_walk19 =[ $walk19, zombie_walk1 ] {
+ai_walk(0);
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_IDLE);};
+
+void() zombie_run1 =[ $run1, zombie_run2 ] {ai_run(1);self.inpain = 0;};
+void() zombie_run2 =[ $run2, zombie_run3 ] {ai_run(1);};
+void() zombie_run3 =[ $run3, zombie_run4 ] {ai_run(0);};
+void() zombie_run4 =[ $run4, zombie_run5 ] {ai_run(1);};
+void() zombie_run5 =[ $run5, zombie_run6 ] {ai_run(2);};
+void() zombie_run6 =[ $run6, zombie_run7 ] {ai_run(3);};
+void() zombie_run7 =[ $run7, zombie_run8 ] {ai_run(4);};
+void() zombie_run8 =[ $run8, zombie_run9 ] {ai_run(4);};
+void() zombie_run9 =[ $run9, zombie_run10 ] {ai_run(2);};
+void() zombie_run10 =[ $run10, zombie_run11 ] {ai_run(0);};
+void() zombie_run11 =[ $run11, zombie_run12 ] {ai_run(0);};
+void() zombie_run12 =[ $run12, zombie_run13 ] {ai_run(0);};
+void() zombie_run13 =[ $run13, zombie_run14 ] {ai_run(2);};
+void() zombie_run14 =[ $run14, zombie_run15 ] {ai_run(4);};
+void() zombie_run15 =[ $run15, zombie_run16 ] {ai_run(6);};
+void() zombie_run16 =[ $run16, zombie_run17 ] {ai_run(7);};
+void() zombie_run17 =[ $run17, zombie_run18 ] {ai_run(3);};
+void() zombie_run18 =[ $run18, zombie_run1 ] {
+ai_run(8);
+if (random() < 0.2)
+ sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_IDLE);
+if (random() > 0.8)
+ sound (self, CHAN_VOICE, "zombie/z_idle1.wav", 1, ATTN_IDLE);
+};
+
+/*
+=============================================================================
+
+ATTACKS
+
+=============================================================================
+*/
+
+/*
+================
+ZombieFireGrenade
+================
+*/
+void(vector st) ZombieFireGrenade =
+{
+ local vector org, vel;
+
+ sound (self, CHAN_WEAPON, "zombie/z_shot1.wav", 1, ATTN_NORM);
+
+ org = self.origin + st_x * v_forward + st_y * v_right + (st_z - 24) * v_up;
+ vel = normalize(self.enemy.origin - org) * 600;
+ vel_z = 200;
+ PRJ_FireProjectile(self, "progs/zom_gib.mdl", org, vel, PE_ZOMBIEGIB, 10, MOD_ZOMBIE, 2.5);
+ PRJ_SetTossedProjectile();
+};
+
+
+void() zombie_atta1 =[ $atta1, zombie_atta2 ] {ai_face();};
+void() zombie_atta2 =[ $atta2, zombie_atta3 ] {ai_face();};
+void() zombie_atta3 =[ $atta3, zombie_atta4 ] {ai_face();};
+void() zombie_atta4 =[ $atta4, zombie_atta5 ] {ai_face();};
+void() zombie_atta5 =[ $atta5, zombie_atta6 ] {ai_face();};
+void() zombie_atta6 =[ $atta6, zombie_atta7 ] {ai_face();};
+void() zombie_atta7 =[ $atta7, zombie_atta8 ] {ai_face();};
+void() zombie_atta8 =[ $atta8, zombie_atta9 ] {ai_face();};
+void() zombie_atta9 =[ $atta9, zombie_atta10 ] {ai_face();};
+void() zombie_atta10 =[ $atta10, zombie_atta11 ] {ai_face();};
+void() zombie_atta11 =[ $atta11, zombie_atta12 ] {ai_face();};
+void() zombie_atta12 =[ $atta12, zombie_atta13 ] {ai_face();};
+void() zombie_atta13 =[ $atta13, zombie_run1 ] {ai_face();ZombieFireGrenade('-10 -22 30');};
+
+void() zombie_attb1 =[ $attb1, zombie_attb2 ] {ai_face();};
+void() zombie_attb2 =[ $attb2, zombie_attb3 ] {ai_face();};
+void() zombie_attb3 =[ $attb3, zombie_attb4 ] {ai_face();};
+void() zombie_attb4 =[ $attb4, zombie_attb5 ] {ai_face();};
+void() zombie_attb5 =[ $attb5, zombie_attb6 ] {ai_face();};
+void() zombie_attb6 =[ $attb6, zombie_attb7 ] {ai_face();};
+void() zombie_attb7 =[ $attb7, zombie_attb8 ] {ai_face();};
+void() zombie_attb8 =[ $attb8, zombie_attb9 ] {ai_face();};
+void() zombie_attb9 =[ $attb9, zombie_attb10 ] {ai_face();};
+void() zombie_attb10 =[ $attb10, zombie_attb11 ] {ai_face();};
+void() zombie_attb11 =[ $attb11, zombie_attb12 ] {ai_face();};
+void() zombie_attb12 =[ $attb12, zombie_attb13 ] {ai_face();};
+void() zombie_attb13 =[ $attb13, zombie_attb14 ] {ai_face();};
+void() zombie_attb14 =[ $attb13, zombie_run1 ] {ai_face();ZombieFireGrenade('-10 -24 29');};
+
+void() zombie_attc1 =[ $attc1, zombie_attc2 ] {ai_face();};
+void() zombie_attc2 =[ $attc2, zombie_attc3 ] {ai_face();};
+void() zombie_attc3 =[ $attc3, zombie_attc4 ] {ai_face();};
+void() zombie_attc4 =[ $attc4, zombie_attc5 ] {ai_face();};
+void() zombie_attc5 =[ $attc5, zombie_attc6 ] {ai_face();};
+void() zombie_attc6 =[ $attc6, zombie_attc7 ] {ai_face();};
+void() zombie_attc7 =[ $attc7, zombie_attc8 ] {ai_face();};
+void() zombie_attc8 =[ $attc8, zombie_attc9 ] {ai_face();};
+void() zombie_attc9 =[ $attc9, zombie_attc10 ] {ai_face();};
+void() zombie_attc10 =[ $attc10, zombie_attc11 ] {ai_face();};
+void() zombie_attc11 =[ $attc11, zombie_attc12 ] {ai_face();};
+void() zombie_attc12 =[ $attc12, zombie_run1 ] {ai_face();ZombieFireGrenade('-12 -19 29');};
+
+void() zombie_missile =
+{
+ local float r;
+
+ r = random();
+
+ if (r < 0.3)
+ zombie_atta1 ();
+ else if (r < 0.6)
+ zombie_attb1 ();
+ else
+ zombie_attc1 ();
+};
+
+
+/*
+=============================================================================
+
+PAIN
+
+=============================================================================
+*/
+
+void() zombie_paina1 =[ $paina1, zombie_paina2 ] {sound (self, CHAN_VOICE, "zombie/z_pain.wav", 1, ATTN_NORM);};
+void() zombie_paina2 =[ $paina2, zombie_paina3 ] {ai_painforward(3);};
+void() zombie_paina3 =[ $paina3, zombie_paina4 ] {ai_painforward(1);};
+void() zombie_paina4 =[ $paina4, zombie_paina5 ] {ai_pain(1);};
+void() zombie_paina5 =[ $paina5, zombie_paina6 ] {ai_pain(3);};
+void() zombie_paina6 =[ $paina6, zombie_paina7 ] {ai_pain(1);};
+void() zombie_paina7 =[ $paina7, zombie_paina8 ] {};
+void() zombie_paina8 =[ $paina8, zombie_paina9 ] {};
+void() zombie_paina9 =[ $paina9, zombie_paina10 ] {};
+void() zombie_paina10 =[ $paina10, zombie_paina11 ] {};
+void() zombie_paina11 =[ $paina11, zombie_paina12 ] {};
+void() zombie_paina12 =[ $paina12, zombie_run1 ] {};
+
+void() zombie_painb1 =[ $painb1, zombie_painb2 ] {sound (self, CHAN_VOICE, "zombie/z_pain1.wav", 1, ATTN_NORM);};
+void() zombie_painb2 =[ $painb2, zombie_painb3 ] {ai_pain(2);};
+void() zombie_painb3 =[ $painb3, zombie_painb4 ] {ai_pain(8);};
+void() zombie_painb4 =[ $painb4, zombie_painb5 ] {ai_pain(6);};
+void() zombie_painb5 =[ $painb5, zombie_painb6 ] {ai_pain(2);};
+void() zombie_painb6 =[ $painb6, zombie_painb7 ] {};
+void() zombie_painb7 =[ $painb7, zombie_painb8 ] {};
+void() zombie_painb8 =[ $painb8, zombie_painb9 ] {};
+void() zombie_painb9 =[ $painb9, zombie_painb10 ] {sound (self, CHAN_BODY, "zombie/z_fall.wav", 1, ATTN_NORM);};
+void() zombie_painb10 =[ $painb10, zombie_painb11 ] {};
+void() zombie_painb11 =[ $painb11, zombie_painb12 ] {};
+void() zombie_painb12 =[ $painb12, zombie_painb13 ] {};
+void() zombie_painb13 =[ $painb13, zombie_painb14 ] {};
+void() zombie_painb14 =[ $painb14, zombie_painb15 ] {};
+void() zombie_painb15 =[ $painb15, zombie_painb16 ] {};
+void() zombie_painb16 =[ $painb16, zombie_painb17 ] {};
+void() zombie_painb17 =[ $painb17, zombie_painb18 ] {};
+void() zombie_painb18 =[ $painb18, zombie_painb19 ] {};
+void() zombie_painb19 =[ $painb19, zombie_painb20 ] {};
+void() zombie_painb20 =[ $painb20, zombie_painb21 ] {};
+void() zombie_painb21 =[ $painb21, zombie_painb22 ] {};
+void() zombie_painb22 =[ $painb22, zombie_painb23 ] {};
+void() zombie_painb23 =[ $painb23, zombie_painb24 ] {};
+void() zombie_painb24 =[ $painb24, zombie_painb25 ] {};
+void() zombie_painb25 =[ $painb25, zombie_painb26 ] {ai_painforward(1);};
+void() zombie_painb26 =[ $painb26, zombie_painb27 ] {};
+void() zombie_painb27 =[ $painb27, zombie_painb28 ] {};
+void() zombie_painb28 =[ $painb28, zombie_run1 ] {};
+
+void() zombie_painc1 =[ $painc1, zombie_painc2 ] {sound (self, CHAN_VOICE, "zombie/z_pain1.wav", 1, ATTN_NORM);};
+void() zombie_painc2 =[ $painc2, zombie_painc3 ] {};
+void() zombie_painc3 =[ $painc3, zombie_painc4 ] {ai_pain(3);};
+void() zombie_painc4 =[ $painc4, zombie_painc5 ] {ai_pain(1);};
+void() zombie_painc5 =[ $painc5, zombie_painc6 ] {};
+void() zombie_painc6 =[ $painc6, zombie_painc7 ] {};
+void() zombie_painc7 =[ $painc7, zombie_painc8 ] {};
+void() zombie_painc8 =[ $painc8, zombie_painc9 ] {};
+void() zombie_painc9 =[ $painc9, zombie_painc10 ] {};
+void() zombie_painc10 =[ $painc10, zombie_painc11 ] {};
+void() zombie_painc11 =[ $painc11, zombie_painc12 ] {ai_painforward(1);};
+void() zombie_painc12 =[ $painc12, zombie_painc13 ] {ai_painforward(1);};
+void() zombie_painc13 =[ $painc13, zombie_painc14 ] {};
+void() zombie_painc14 =[ $painc14, zombie_painc15 ] {};
+void() zombie_painc15 =[ $painc15, zombie_painc16 ] {};
+void() zombie_painc16 =[ $painc16, zombie_painc17 ] {};
+void() zombie_painc17 =[ $painc17, zombie_painc18 ] {};
+void() zombie_painc18 =[ $painc18, zombie_run1 ] {};
+
+void() zombie_paind1 =[ $paind1, zombie_paind2 ] {sound (self, CHAN_VOICE, "zombie/z_pain.wav", 1, ATTN_NORM);};
+void() zombie_paind2 =[ $paind2, zombie_paind3 ] {};
+void() zombie_paind3 =[ $paind3, zombie_paind4 ] {};
+void() zombie_paind4 =[ $paind4, zombie_paind5 ] {};
+void() zombie_paind5 =[ $paind5, zombie_paind6 ] {};
+void() zombie_paind6 =[ $paind6, zombie_paind7 ] {};
+void() zombie_paind7 =[ $paind7, zombie_paind8 ] {};
+void() zombie_paind8 =[ $paind8, zombie_paind9 ] {};
+void() zombie_paind9 =[ $paind9, zombie_paind10 ] {ai_pain(1);};
+void() zombie_paind10 =[ $paind10, zombie_paind11 ] {};
+void() zombie_paind11 =[ $paind11, zombie_paind12 ] {};
+void() zombie_paind12 =[ $paind12, zombie_paind13 ] {};
+void() zombie_paind13 =[ $paind13, zombie_run1 ] {};
+
+void() zombie_paine1 =[ $paine1, zombie_paine2 ] {
+sound (self, CHAN_VOICE, "zombie/z_pain.wav", 1, ATTN_NORM);
+self.health = 60;
+};
+void() zombie_paine2 =[ $paine2, zombie_paine3 ] {ai_pain(8);};
+void() zombie_paine3 =[ $paine3, zombie_paine4 ] {ai_pain(5);};
+void() zombie_paine4 =[ $paine4, zombie_paine5 ] {ai_pain(3);};
+void() zombie_paine5 =[ $paine5, zombie_paine6 ] {ai_pain(1);};
+void() zombie_paine6 =[ $paine6, zombie_paine7 ] {ai_pain(2);};
+void() zombie_paine7 =[ $paine7, zombie_paine8 ] {ai_pain(1);};
+void() zombie_paine8 =[ $paine8, zombie_paine9 ] {ai_pain(1);};
+void() zombie_paine9 =[ $paine9, zombie_paine10 ] {ai_pain(2);};
+void() zombie_paine10 =[ $paine10, zombie_paine11 ] {
+sound (self, CHAN_BODY, "zombie/z_fall.wav", 1, ATTN_NORM);
+self.solid = SOLID_NOT;
+};
+void() zombie_paine11 =[ $paine11, zombie_paine12 ] {self.nextthink = time + 5;self.health = 60;};
+void() zombie_paine12 =[ $paine12, zombie_paine13 ]{
+// see if ok to stand up
+self.health = 60;
+sound (self, CHAN_VOICE, "zombie/z_idle.wav", 1, ATTN_IDLE);
+self.solid = SOLID_SLIDEBOX;
+if (!walkmove (0, 0))
+{
+ self.think = zombie_paine11;
+ self.solid = SOLID_NOT;
+ return;
+}
+};
+void() zombie_paine13 =[ $paine13, zombie_paine14 ] {};
+void() zombie_paine14 =[ $paine14, zombie_paine15 ] {};
+void() zombie_paine15 =[ $paine15, zombie_paine16 ] {};
+void() zombie_paine16 =[ $paine16, zombie_paine17 ] {};
+void() zombie_paine17 =[ $paine17, zombie_paine18 ] {};
+void() zombie_paine18 =[ $paine18, zombie_paine19 ] {};
+void() zombie_paine19 =[ $paine19, zombie_paine20 ] {};
+void() zombie_paine20 =[ $paine20, zombie_paine21 ] {};
+void() zombie_paine21 =[ $paine21, zombie_paine22 ] {};
+void() zombie_paine22 =[ $paine22, zombie_paine23 ] {};
+void() zombie_paine23 =[ $paine23, zombie_paine24 ] {};
+void() zombie_paine24 =[ $paine24, zombie_paine25 ] {};
+void() zombie_paine25 =[ $paine25, zombie_paine26 ] {ai_painforward(5);};
+void() zombie_paine26 =[ $paine26, zombie_paine27 ] {ai_painforward(3);};
+void() zombie_paine27 =[ $paine27, zombie_paine28 ] {ai_painforward(1);};
+void() zombie_paine28 =[ $paine28, zombie_paine29 ] {ai_pain(1);};
+void() zombie_paine29 =[ $paine29, zombie_paine30 ] {};
+void() zombie_paine30 =[ $paine30, zombie_run1 ] {};
+
+void() zombie_die =
+{
+ sound (self, CHAN_VOICE, "zombie/z_gib.wav", 1, ATTN_NORM);
+ ThrowHead ("progs/h_zombie.mdl", self.health);
+ ThrowGib ("progs/gib1.mdl", self.health);
+ ThrowGib ("progs/gib2.mdl", self.health);
+ ThrowGib ("progs/gib3.mdl", self.health);
+};
+
+/*
+=================
+zombie_pain
+
+Zombies can only be killed (gibbed) by doing 60 hit points of damage
+in a single frame (rockets, grenades, quad shotgun, quad nailgun).
+
+A hit of 25 points or more (super shotgun, quad nailgun) will allways put it
+down to the ground.
+
+A hit of from 10 to 40 points in one frame will cause it to go down if it
+has been twice in two seconds, otherwise it goes into one of the four
+fast pain frames.
+
+A hit of less than 10 points of damage (winged by a shotgun) will be ignored.
+
+FIXME: don't use pain_finished because of nightmare hack
+=================
+*/
+void(entity attacker, float take) zombie_pain =
+{
+ local float r;
+
+ self.health = 60; // allways reset health
+
+ if (take < 9)
+ return; // totally ignore
+
+ if (self.inpain == 2)
+ return; // down on ground, so don't reset any counters
+
+// go down immediately if a big enough hit
+ if (take >= 25)
+ {
+ self.inpain = 2;
+ zombie_paine1 ();
+ return;
+ }
+
+ if (self.inpain)
+ {
+// if hit again in next gre seconds while not in pain frames, definately drop
+ self.pain_finished = time + 3;
+ return; // currently going through an animation, don't change
+ }
+
+ if (self.pain_finished > time)
+ {
+// hit again, so drop down
+ self.inpain = 2;
+ zombie_paine1 ();
+ return;
+ }
+
+// gp into one of the fast pain animations
+ self.inpain = 1;
+
+ r = random();
+ if (r < 0.25)
+ zombie_paina1 ();
+ else if (r < 0.5)
+ zombie_painb1 ();
+ else if (r < 0.75)
+ zombie_painc1 ();
+ else
+ zombie_paind1 ();
+};
+
+//============================================================================
+
+/*QUAKED monster_zombie (1 0 0) (-16 -16 -24) (16 16 32) Crucified ambush
+
+If crucified, stick the bounding box 12 pixels back into a wall to look right.
+*/
+void() monster_zombie =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+
+ precache_model ("progs/zombie.mdl");
+ precache_model ("progs/h_zombie.mdl");
+ precache_model ("progs/zom_gib.mdl");
+
+ precache_sound ("zombie/z_idle.wav");
+ precache_sound ("zombie/z_idle1.wav");
+ precache_sound ("zombie/z_shot1.wav");
+ precache_sound ("zombie/z_gib.wav");
+ precache_sound ("zombie/z_pain.wav");
+ precache_sound ("zombie/z_pain1.wav");
+ precache_sound ("zombie/z_fall.wav");
+ precache_sound ("zombie/z_miss.wav");
+ precache_sound ("zombie/z_hit.wav");
+ precache_sound ("zombie/idle_w2.wav");
+
+ self.solid = SOLID_SLIDEBOX;
+ self.movetype = MOVETYPE_STEP;
+
+ setmodel (self, "progs/zombie.mdl");
+
+ setsize (self, '-16 -16 -24', '16 16 40');
+ self.health = 60;
+
+ self.th_stand = zombie_stand1;
+ self.th_walk = zombie_walk1;
+ self.th_run = zombie_run1;
+ self.th_pain = zombie_pain;
+ self.th_die = zombie_die;
+ self.th_missile = zombie_missile;
+
+ if (self.spawnflags & SPAWN_CRUCIFIED)
+ {
+ self.movetype = MOVETYPE_NONE;
+ zombie_cruc1 ();
+ }
+ else
+ walkmonster_start();
+};
diff --git a/r17/Revamped src/Revamped QC/replace.qc b/r17/Revamped src/Revamped QC/replace.qc
new file mode 100755
index 00000000..849e4406
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/replace.qc
@@ -0,0 +1,129 @@
+
+// Basemod replacement ent defines
+#define ENT_REPLACE(f,t) void(void) f = { self.classname = #t; t(); }
+#define ENT_REPLACE_FUNC(f,t,x) void(void) f = { self.classname = #t; x(); t(); }
+
+// Replacement functions
+void() health_setrotten = { self.spawnflags |= H_ROTTEN; };
+void() health_setmega = { self.spawnflags |= H_MEGA; };
+void() ammo_setlarge = { self.spawnflags |= WEAPON_BIG2; };
+
+// -- Quake 3 entities
+// weapons
+ENT_REPLACE(weapon_gauntlet, weapon_supershotgun); // Gauntlet (not normally used)
+ENT_REPLACE(weapon_machinegun, weapon_nailgun); // Machinegun (not normally used)
+//ENT_REPLACE(weapon_shotgun, weapon_supershotgun); // Shotgun
+ENT_REPLACE(weapon_plasmagun, weapon_supernailgun); // Plasma gun
+ENT_REPLACE(weapon_railgun, weapon_rocketlauncher); // Railgun
+ENT_REPLACE(weapon_bfg, weapon_lightning); // BFG
+// holdables
+ENT_REPLACE(holdable_medikit, item_health); // personal medikit
+ENT_REPLACE(holdable_teleporter, info_null); // personal teleporter
+// armor
+ENT_REPLACE(item_armor_body, item_armorInv); // 100 armor
+ENT_REPLACE(item_armor_combat, item_armor2); // 50 armor
+ENT_REPLACE(item_armor_shard, info_null); // +5 armor shard
+// powerups
+ENT_REPLACE(item_enviro, item_artifact_envirosuit); // enviro powerup
+ENT_REPLACE(item_flight, item_artifact_invisibility); // flight
+ENT_REPLACE(item_haste, item_artifact_super_damage); // haste
+ENT_REPLACE(item_quad, item_artifact_super_damage); // quad damage
+ENT_REPLACE(item_invis, item_artifact_invisibility); // invisibility
+ENT_REPLACE(item_regen, item_health); // regeneration
+// health
+ENT_REPLACE(item_health_large, item_health); // +50 health
+ENT_REPLACE_FUNC(item_health_mega, item_health, health_setmega); // +100 health (ignore max)
+ENT_REPLACE_FUNC(item_health_small, item_health, health_setrotten); // +5 health (ignore max)
+// ammo
+ENT_REPLACE(ammo_bullets, item_spikes); // Machinegun ammo
+ENT_REPLACE(ammo_grenades, item_rockets); // Grenade launcher ammo
+ENT_REPLACE(ammo_lightning, item_cells); // Lightning gun ammo
+ENT_REPLACE_FUNC(ammo_slugs, item_rockets, ammo_setlarge); // Railgun ammo
+ENT_REPLACE_FUNC(ammo_bfg, item_cells, ammo_setlarge); // BFG ammo
+// other ents
+ENT_REPLACE(misc_teleporter_dest, info_teleport_destination); // teleport destination
+ENT_REPLACE(target_position, info_notnull); // "target" entity
+ENT_REPLACE(info_player_intermission, info_intermission); // intermission
+
+// -- Quake 2 entities
+// weapons
+ENT_REPLACE(weapon_chaingun, weapon_supernailgun); // chaingun
+ENT_REPLACE(weapon_hyperblaster, weapon_lightning); // hyperblaster
+// armor
+ENT_REPLACE(item_armor_jacket, item_armor1);
+ENT_REPLACE(item_power_screen, item_armor2); // power screen (not used often)
+ENT_REPLACE(item_power_shield, item_armorInv); // power shield
+ // powerups
+ENT_REPLACE(item_bandolier, item_rockets, ammo_setlarge); // bandolier
+ENT_REPLACE(item_breather, item_artifact_envirosuit); // underwater air breather
+ENT_REPLACE(item_invulnerability, item_artifact_invulnerability); // invulnerable artifact
+ENT_REPLACE(item_pack, item_rockets, ammo_setlarge); // ammo pack
+ENT_REPLACE(item_silencer, item_artifact_invisibility); // weapon silencer
+// health
+ENT_REPLACE_FUNC(item_ancient_head, item_health, health_setmega); // ancient head (+2 max health)
+ENT_REPLACE_FUNC(item_adrenaline, item_health, health_setmega); // adrenaline (+1 max health)
+
+// -- Half-life entities
+// weapons
+ENT_REPLACE(weapon_357, weapon_grenadelauncher); // 357 magnum
+ENT_REPLACE(weapon_9mmAR, weapon_supernailgun); // mp5
+ENT_REPLACE(weapon_9mmhandgun, weapon_nailgun); // handgun
+ENT_REPLACE(weapon_crossbow, weapon_grenadelauncher); // crossbow
+ENT_REPLACE(weapon_crowbar, info_null); // crowbar
+ENT_REPLACE(weapon_egon, weapon_lightning); // ghostbusters gun
+ENT_REPLACE(weapon_gauss, weapon_lightning); // tau cannon
+ENT_REPLACE(weapon_handgrenade, item_rockets); // hand grenades
+ENT_REPLACE(weapon_hornetgun, info_null); // hornet gun
+ENT_REPLACE(weapon_rpg, weapon_rocketlauncher); // rpg
+ENT_REPLACE(weapon_satchel, item_rockets); // satchel charge
+ENT_REPLACE(weapon_snark, item_cells); // snarks
+ENT_REPLACE(weapon_tripmine, item_rockets); // tripmines
+// armor
+ENT_REPLACE(item_battery, info_null); // battery charge
+// powerups
+ENT_REPLACE(item_airtank, item_artifact_envirosuit); // air tank (not used often)
+ENT_REPLACE(item_antidote, item_health); // antidote (not used often)
+ENT_REPLACE(item_longjump, weapon_rocketlauncher); // long jump module
+ENT_REPLACE(item_suit, item_artifact_envirosuit); // HEV suit
+// health
+ENT_REPLACE(item_healthkit, item_health); // floor health kit
+// ammo
+ENT_REPLACE(ammo_357, item_rockets); // 357 ammo
+ENT_REPLACE(ammo_9mmAR, item_spikes); // mp5 clip
+ENT_REPLACE(ammo_9mmbox, item_spikes, ammo_setlarge); // 9mm box
+ENT_REPLACE(ammo_9mmclip, item_spikes); // 9mm clip
+ENT_REPLACE(ammo_ARgrenades, item_rockets); // mp5 grenades
+ENT_REPLACE(ammo_buckshot, item_shells); // shotgun shells
+ENT_REPLACE(ammo_crossbow, item_rockets); // crossbow bolts
+ENT_REPLACE(ammo_gaussclip, item_cells); // cells for gauss/egon
+ENT_REPLACE(ammo_rpgclip, item_rockets, ammo_setlarge); // RPG ammo
+
+// special replace
+void(void() func) CheckSpawn =
+{
+ // these ents conflict with q1 field names
+ switch (self.classname)
+ {
+ case "ammo_shells":
+ self.classname = "item_shells";
+ item_shells();
+ break;
+ case "ammo_nails":
+ self.classname = "item_spikes";
+ item_spikes();
+ break;
+ case "ammo_cells":
+ self.classname = "item_cells";
+ item_cells();
+ break;
+ default:
+ if (func)
+ func();
+ else
+ {
+ dprint("Couldn't find spawn function ");
+ dprint(self.classname);
+ dprint("\n");
+ }
+ }
+};
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/sol_defs.qc b/r17/Revamped src/Revamped QC/sol_defs.qc
new file mode 100755
index 00000000..06bbb88b
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/sol_defs.qc
@@ -0,0 +1,107 @@
+// Solitude defs
+#define DEFAULT_GRAVITY 340
+#define DEFAULT_MAXSPEED 170 // max walk speed on ground
+
+.float next_jump_time; // next time the player can jump (usually after landing)
+.float setup_death; // setup respawn timer on player death
+void () Player_SetupDeath;
+
+.float needles; // how many needler needles a player has in him
+
+void () W_StartWeapon;
+float (float wep, float cliptype) W_GetMaxClip;
+void (float wtype, float ttype) ThrowWeapon;
+void () player_throw_grenade;
+void () pre_player_throw_grenade;
+void () pre_player_melee;
+void ( entity t_ent, float weptype, float cliptype, float newamt ) SetAmmoFor;
+void () NeedlerHome;
+
+.float selnade; // the type of nade being thrown
+#define GRENADE_REGULAR 0
+#define GRENADE_STICKY 1
+
+.float weaponheat;
+
+.entity pp_cooldown;
+
+.float aflag;
+
+.float pickup_time, canpickup_time;
+
+.float lives; // times an item can respawn
+
+.float exshells;
+.float exshells2;
+.float exhshells;
+.float exnails;
+.float exrockets;
+.float excells;
+
+//sniper rifle
+.float ammo_sniper;
+.float exsniper;
+
+// plasma pistol
+.float ammo_ppistol;
+.float exppistol;
+
+// plasma rifle
+.float ammo_prifle;
+.float exprifle;
+.float prifle_heat; // plasma rifle fires faster the longer it's fired
+
+// energy sword
+.float ammo_sword;
+.float exsword;
+
+// needler
+.float ammo_needler;
+.float exneedler;
+.float needler_heat; // needler fires faster the longer it's held down
+
+.float ammo_shells2;
+.float ammo_hshells;
+
+.float axhitme;
+
+.float ohealth; // for regen
+.float regen; ///
+
+
+// animations
+//weapon frame
+.float donefire;
+.float wepanim;
+//player frame
+.float fireframe;
+.float jump_time;
+.float pain_time;
+.float reload_time;
+.float pull_time;
+.float nade_time, melee_time;
+.float death_type;
+
+#define MOD_SOLITUDE 666 // undefined mode of death
+
+// weapons
+#define WEAPON_SWORD IT_AXE
+#define WEAPON_PISTOL IT_SHOTGUN
+#define WEAPON_SHOT IT_SUPER_SHOTGUN
+#define WEAPON_AR IT_NAILGUN
+#define WEAPON_UZI IT_SUPER_NAILGUN
+#define WEAPON_SNIPER IT_GRENADE_LAUNCHER
+#define WEAPON_RL IT_ROCKET_LAUNCHER
+#define WEAPON_PPISTOL IT_LIGHTNING
+#define WEAPON_NEEDLER IT_EXTRA_WEAPON
+#define WEAPON_PRIFLE IT_EXTRA_WEAPON2
+#define WEAPON_SKULL IT_SKULL
+
+// Zooming
+.float pfov;
+#define FOV_DEFAULT 90
+
+// Frikbot
+void(float to, float f) WriteByte;
+void(float to, string s) WriteString;
+void () reload;
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/sol_items.qc b/r17/Revamped src/Revamped QC/sol_items.qc
new file mode 100755
index 00000000..1b067396
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/sol_items.qc
@@ -0,0 +1,565 @@
+// Solitude Items: weapons, ammo, misc.
+
+// GetPlayerWeapons:
+// return how many weapons a player is holding.
+// also used for finding out if the player is holding a certain weapon.
+float (float pweapons) GetPlayerWeapons =
+{
+ local float i;
+
+ if (pweapons & WEAPON_PISTOL)
+ i++;
+ if (pweapons & WEAPON_SKULL)
+ i++;
+ if (pweapons & WEAPON_SHOT)
+ i++;
+ if (pweapons & WEAPON_AR)
+ i++;
+ if (pweapons & WEAPON_UZI)
+ i++;
+ if (pweapons & WEAPON_RL)
+ i++;
+ if (pweapons & WEAPON_SNIPER)
+ i++;
+ if (pweapons & WEAPON_PPISTOL)
+ i++;
+ if (pweapons & WEAPON_SWORD)
+ i++;
+ if (pweapons & WEAPON_NEEDLER)
+ i++;
+ if (pweapons & WEAPON_PRIFLE)
+ i++;
+/*
+ if (pweapons & WEAPON_PISTOL)
+ i++;
+ if (pweapons & WEAPON_PISTOL)
+ i++;
+*/
+ return i;
+};
+
+// Returns the amount of ammo an entity or player has either in the primary or secondary clip
+// PS. It's hackish, but it works :)
+float (entity t_plyr, float t_wep, float cliptype) GetAmmoCount =
+{
+ local float oldweapon, rtval;
+
+ oldweapon = t_plyr.weapon;
+ t_plyr.weapon = t_wep;
+ W_UpdateAmmoCounts( t_plyr );
+ if (cliptype)
+ rtval = t_plyr.currentammo;
+ else
+ rtval = t_plyr.armorvalue;
+
+ t_plyr.weapon = oldweapon;
+ W_UpdateAmmoCounts( t_plyr );
+
+ return rtval;
+};
+
+// Sets the ammo of a new or dropped weapon, as opposed to the function below which...
+void ( entity t_wep, float weptype ) SetWeaponAmmo =
+{
+ local float stammo;
+ stammo = W_GetMaxClip( weptype, 1 );
+
+ switch( weptype ) {
+ case WEAPON_PISTOL:
+ t_wep.exshells = 24;
+ t_wep.ammo_shells = stammo;
+ break;
+ case WEAPON_SKULL:
+ t_wep.exshells = 0;
+ t_wep.ammo_shells = stammo;
+ break;
+ case WEAPON_SHOT:
+ t_wep.exshells2 = 20;
+ t_wep.ammo_shells2 = stammo;
+ break;
+ case WEAPON_AR:
+ t_wep.exnails = 24;
+ t_wep.ammo_nails = stammo;
+ break;
+ case WEAPON_UZI:
+ t_wep.exhshells = 24;
+ t_wep.ammo_hshells = stammo;
+ break;
+ case WEAPON_RL:
+ t_wep.exrockets = 2;
+ t_wep.ammo_rockets = stammo;
+ break;
+ case WEAPON_SNIPER:
+ t_wep.exsniper = 10;
+ t_wep.ammo_sniper = stammo;
+ break;
+ case WEAPON_PPISTOL:
+ t_wep.exppistol = 0;
+ t_wep.ammo_ppistol = stammo;
+ break;
+ case WEAPON_SWORD:
+ t_wep.exppistol = 0;
+ t_wep.ammo_ppistol = stammo;
+ break;
+ case WEAPON_NEEDLER:
+ t_wep.exneedler = 90;
+ t_wep.ammo_needler = stammo;
+ break;
+ case WEAPON_PRIFLE:
+ t_wep.exprifle = 0;
+ t_wep.ammo_prifle = stammo;
+ break;
+ default:
+ break;
+ }
+};
+
+// sets ammo to a specific clip aspect of a weapon (current clip or extended clip)
+void ( entity t_ent, float weptype, float cliptype, float newamt ) SetAmmoFor =
+{
+/*
+_bprint(ftos(GetAmmoCount(t_ent, weptype, cliptype)), "\n");
+_bprint(ftos(newamt), "\n");
+_bprint(ftos(W_GetMaxClip(weptype, cliptype)), "\n");
+*/
+ if ( (GetAmmoCount(t_ent, weptype, cliptype)+newamt) > W_GetMaxClip(weptype, cliptype) ) {
+ newamt = W_GetMaxClip(weptype, cliptype) - GetAmmoCount(t_ent, weptype, cliptype);
+ if (newamt < 0)
+ newamt = 0;
+ }
+
+ switch ( weptype ) {
+ case WEAPON_PISTOL:
+ if (!cliptype || cliptype > 1)
+ t_ent.exshells += newamt;
+ if (cliptype)
+ t_ent.ammo_shells += newamt;
+ break;
+ case WEAPON_SKULL:
+ if (!cliptype || cliptype > 1)
+ t_ent.exshells += newamt;
+ if (cliptype)
+ t_ent.ammo_shells += newamt;
+ break;
+ case WEAPON_SHOT:
+ if (!cliptype || cliptype > 1)
+ t_ent.exshells2 += newamt;
+ if (cliptype)
+ t_ent.ammo_shells2 += newamt;
+ break;
+ case WEAPON_AR:
+ if (!cliptype || cliptype > 1)
+ t_ent.exnails += newamt;
+ if (cliptype)
+ t_ent.ammo_nails += newamt;
+ break;
+ case WEAPON_UZI:
+ if (!cliptype || cliptype > 1)
+ t_ent.exhshells += newamt;
+ if (cliptype)
+ t_ent.ammo_hshells += newamt;
+ break;
+ case WEAPON_RL:
+ if (!cliptype || cliptype > 1)
+ t_ent.exrockets += newamt;
+ if (cliptype)
+ t_ent.ammo_rockets += newamt;
+ break;
+ case WEAPON_SNIPER:
+ if (!cliptype || cliptype > 1)
+ t_ent.exsniper += newamt;
+ if (cliptype)
+ t_ent.ammo_sniper += newamt;
+ break;
+ case WEAPON_PPISTOL:
+ if (!cliptype || cliptype > 1)
+ t_ent.exppistol += newamt;
+ if (cliptype)
+ t_ent.ammo_ppistol += newamt;
+ break;
+ case WEAPON_SWORD:
+ if (!cliptype || cliptype > 1)
+ t_ent.exsword += newamt;
+ if (cliptype)
+ t_ent.ammo_sword += newamt;
+ break;
+ case WEAPON_NEEDLER:
+ if (!cliptype || cliptype > 1)
+ t_ent.exneedler += newamt;
+ if (cliptype)
+ t_ent.ammo_needler += newamt;
+ break;
+ case WEAPON_PRIFLE:
+ if (!cliptype || cliptype > 1)
+ t_ent.exprifle += newamt;
+ if (cliptype)
+ t_ent.ammo_prifle += newamt;
+ break;
+ default:
+ _bprint("SetAmmoFor: invalid weapon type specified\n");
+ break;
+ }
+};
+
+void ( entity t_from, entity t_to, float wtype, float aremove ) CopyAmmo =
+{
+ W_UpdateAmmoCounts( t_from );
+ SetAmmoFor( t_to, wtype, 0, t_from.armorvalue );
+ SetAmmoFor( t_to, wtype, 1, t_from.currentammo );
+
+ if (aremove == 1) {
+ SetAmmoFor( t_from, wtype, 0, (-1 * t_from.armorvalue) );
+ SetAmmoFor( t_from, wtype, 1, (-1 * t_from.currentammo) );
+ }
+};
+
+void () weapon_becometouch =
+{
+ self.think = SUB_Remove;
+ self.nextthink = time + 30;
+ self.touch = weapon_touch;
+};
+
+string ( float wtype ) weapon_getlaymodel =
+{
+ switch (wtype)
+ {
+ case WEAPON_SHOT:
+ return ("progs/g_shot.mdl");
+ break;
+ case WEAPON_PISTOL:
+ return ("progs/g_pistol.mdl");
+ break;
+ case WEAPON_SKULL:
+ //return ("GameTypes/OddBall/g_skull.mdl");
+ break;
+ case WEAPON_AR:
+ return ("progs/g_nail.mdl");
+ break;
+ case WEAPON_UZI:
+ return ("progs/g_uzi.mdl");
+ break;
+ case WEAPON_RL:
+ return ("progs/g_rocket.mdl");
+ break;
+ case WEAPON_SNIPER:
+ return ("progs/g_sniper.mdl");
+ break;
+ case WEAPON_PPISTOL:
+ return ("progs/g_plpist.mdl");
+ break;
+ case WEAPON_SWORD:
+ return ("progs/g_axe.mdl");
+ break;
+ case WEAPON_NEEDLER:
+ return ("progs/g_needler.mdl");
+ break;
+ case WEAPON_PRIFLE:
+ return ("progs/g_plrifl.mdl");
+ break;
+ default:
+ return ("progs/player.mdl");
+ break;
+ }
+};
+
+void (float wtype, float ttype) ThrowWeapon =
+{
+ local entity newthrow;
+ newthrow = spawn();
+ newthrow.owner = self;
+ newthrow.movetype = MOVETYPE_BOUNCE;
+ newthrow.solid = SOLID_BBOX;
+ newthrow.classname = "weapon_pickup";
+ newthrow.flags = FL_ITEM;
+ newthrow.think = weapon_becometouch;
+ newthrow.nextthink = time + 1;
+
+ newthrow.weapon = wtype;
+
+ if (ttype == 1) { // throwing an existing weapon
+ CopyAmmo(self, newthrow, wtype, 1);
+ newthrow.lives = 1;
+ }
+ else
+ SetWeaponAmmo(newthrow, wtype);
+
+ makevectors (self.v_angle);
+ if (self.v_angle_x)
+ {
+ newthrow.velocity = ((((v_forward * 45) + (v_up * 200)) + ((crandom () * v_right) * TE_LAVASPLASH)) + ((crandom () * v_up) * TE_LAVASPLASH));
+ }
+ else
+ {
+ newthrow.velocity = aim (self, 10000);
+ newthrow.velocity = (newthrow.velocity * 45);
+ newthrow.velocity_z = 200;
+ }
+
+ newthrow.gravity = 3;
+ newthrow.solid = SOLID_TRIGGER;
+
+ setsize (newthrow, '-16 -16 0', '16 16 56');
+
+ setmodel( newthrow, weapon_getlaymodel( wtype ) );
+
+ setorigin (newthrow, ((self.origin + '0 0 16') + (v_right * CONTENT_SKY)));
+};
+
+// respawn the weapon
+void () weapon_activate =
+{
+ if (self.lives == 1) {
+ remove( self );
+ return;
+ }
+ if (self.mdl)
+ setmodel(self, self.mdl);
+ self.touch = weapon_touch;
+}
+
+void () weapon_touch =
+{
+ local entity oself;
+ local float addweapon, newweapon;
+
+ oself = self;
+ //
+ if (!(other.flags & FL_CLIENT))
+ return;
+
+ if (other.ishuman != #TRUE)
+ if (other.attack_finished < time)
+ other.canpickup_time = time + .1;
+
+ self.mdl = self.model;
+
+ if ( (other.items & self.weapon) ) {
+ if (self.weapon & WEAPON_PPISTOL || self.weapon & WEAPON_PRIFLE) // weapons that don't have an extended clip
+ if ( W_GetMaxClip(self.weapon, 1) <= GetAmmoCount(other, self.weapon, 1) )
+ return;
+
+ if ( W_GetMaxClip(self.weapon, 0) <= GetAmmoCount(other, self.weapon, 0) )
+ return;
+
+ if (self.weapon & WEAPON_PPISTOL || self.weapon & WEAPON_PRIFLE)
+ SetAmmoFor( other, self.weapon, 1, self.currentammo );
+ else
+ SetAmmoFor( other, self.weapon, 0, self.armorvalue );
+ //SetAmmoFor( other, self.weapon, 1, self.currentammo );
+
+ W_UpdateAmmoCounts( other );
+ self.touch = SUB_Null;
+ setmodel( self, string_null );
+ self.nextthink = time + 30;
+ self.think = weapon_activate;
+ return;
+ }
+
+ if (other.canpickup_time > time) {
+ if (other.weapon == self.weapon || GetPlayerWeapons(other.items) == 2 )
+ addweapon = 2; // drop current weapon and replace it
+ else
+ {
+ addweapon = 1; // add other weapon and switch to it
+ }
+
+ other.canpickup_time = 0;
+ }
+ else {
+ if (time > other.pickup_time) {
+ other.pickup_time = time + .5;
+ return;
+ }
+ }
+
+ if (self.weapon == IT_NAILGUN) //Assault rifle
+ {
+ other.groundwep = 1;
+ stuffcmd (other, "cl_ww 1\n");
+ }
+
+ else if (self.weapon == IT_LIGHTNING)//Plasma Pistol
+ {
+ other.groundwep = 1;
+ stuffcmd (other, "cl_ww 2\n");
+ }
+
+ else if (self.weapon == IT_SUPER_SHOTGUN) //Shootie
+ {
+ other.groundwep = 1;
+ stuffcmd (other, "cl_ww 3\n");
+ }
+
+ else if (self.weapon == IT_EXTRA_WEAPON)
+ {
+ other.groundwep = 1;
+ stuffcmd (other, "cl_ww 4\n");
+ }
+
+ else if (self.weapon == IT_ROCKET_LAUNCHER)
+ {
+ other.groundwep = 1;
+ stuffcmd (other, "cl_ww 5\n");
+ }
+
+ else if (self.weapon == IT_SHOTGUN)
+ {
+ other.groundwep = 1;
+ stuffcmd (other, "cl_ww 6\n");
+ }
+
+ else if (self.weapon == IT_SUPER_NAILGUN)
+ {
+ other.groundwep = 1;
+ stuffcmd (other, "cl_ww 7\n");
+ }
+
+ else if (self.weapon == IT_GRENADE_LAUNCHER)
+ {
+ other.groundwep = 1;
+ stuffcmd (other, "cl_ww 8\n");
+ }
+
+ else
+ stuffcmd (other, "cl_ww 0\n");
+
+ if (addweapon)
+ {
+ other.attack_finished = time + .1; // so the player doesnt reload when picking up a new weapon
+ if (addweapon == 1) {
+ other.items = other.items | self.weapon;
+ sprint(other,"New weapon added to your inv\n");
+ }
+ else if (addweapon == 2) { // replace current weapon
+ newweapon = self.weapon;
+ other.items = other.items - other.weapon;
+ other.items = other.items | self.weapon;
+ self = other;
+ ThrowWeapon(self.weapon, 1);
+ W_WeaponSwitch(newweapon);
+ W_SetCurrentAmmo();
+ self = oself;
+ }
+ CopyAmmo( self, other, self.weapon, 0 );
+ W_UpdateAmmoCounts(other);
+ self.touch = SUB_Null;
+ setmodel( self, string_null );
+ self.nextthink = time + 30;
+ self.think = weapon_activate;
+ return;
+ }
+};
+
+void () weapon_start =
+{
+ if (!self.weapon) {
+ _bprint("weapon_start: weapon with no .weapon set!\n");
+ remove(self);
+ }
+
+ self.classname = "weapon_pickup"; // so bots can recognize it
+ self.flags = FL_ITEM;
+
+ precache_model( weapon_getlaymodel( self.weapon ) );
+ setmodel( self, weapon_getlaymodel( self.weapon ) );
+
+ self.gravity = 3;
+ self.solid = SOLID_TRIGGER;
+
+ setsize (self, '-16 -16 0', '16 16 56');
+
+ SetWeaponAmmo( self, self.weapon );
+ self.touch = weapon_touch;
+};
+
+// WEAPONS
+void () weapon_shotgun =
+{
+ self.weapon = WEAPON_PISTOL;
+ weapon_start ();
+};
+void () weapon_pistol =
+{
+ weapon_shotgun();
+};
+void() weapon_skull =
+{
+ self.weapon = WEAPON_SKULL;
+ weapon_start ();
+};
+void() weapon_supershotgun =
+{
+ self.weapon = WEAPON_SHOT;
+ weapon_start ();
+};
+
+void() weapon_nailgun =
+{
+ self.weapon = WEAPON_AR;
+ weapon_start ();
+};
+void() weapon_ar =
+{
+ weapon_nailgun();
+};
+
+void() weapon_supernailgun =
+{
+ self.weapon = WEAPON_UZI;
+ weapon_start ();
+};
+void() weapon_uzi =
+{
+ weapon_supernailgun ();
+};
+
+void() weapon_grenadelauncher =
+{
+ self.weapon = WEAPON_PPISTOL;
+ weapon_start ();
+};
+void() weapon_ppistol =
+{
+ weapon_grenadelauncher ();
+};
+
+void() weapon_rocketlauncher =
+{
+ self.weapon = WEAPON_RL;
+ weapon_start ();
+};
+
+void() weapon_lightning =
+{
+ self.weapon = WEAPON_SNIPER;
+ weapon_start ();
+};
+void() weapon_sniperrifle =
+{
+ weapon_lightning ();
+};
+
+void() weapon_sword =
+{
+ self.weapon = WEAPON_SWORD;
+ weapon_start ();
+};
+
+void() weapon_plasmapistol =
+{
+ self.weapon = WEAPON_PPISTOL;
+ weapon_start ();
+};
+
+void() weapon_plasmarifle =
+{
+ self.weapon = WEAPON_PRIFLE;
+ weapon_start ();
+};
+
+void() weapon_needler =
+{
+ self.weapon = WEAPON_NEEDLER;
+ weapon_start ();
+};
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/sol_misc.qc b/r17/Revamped src/Revamped QC/sol_misc.qc
new file mode 100755
index 00000000..fa822cd5
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/sol_misc.qc
@@ -0,0 +1,13 @@
+// miscellaneous stuff
+
+// Spawn some model.
+void() func_model =
+{
+ precache_model( self.model );
+ setmodel( self, self.model );
+ setorigin( self, self.origin );
+
+ self.movetype = MOVETYPE_NONE;
+ self.solid = SOLID_BBOX;
+ setsize(self, '-8 -8 -8', '8 8 8');
+};
\ No newline at end of file
diff --git a/r17/Revamped src/Revamped QC/spectate.qc b/r17/Revamped src/Revamped QC/spectate.qc
new file mode 100755
index 00000000..bdb8d58a
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/spectate.qc
@@ -0,0 +1,83 @@
+// Spectator functions
+// Added Aug11'97 by Zoid
+//
+// These functions are called from the server if they exist.
+// Note that Spectators only have one think since they movement code doesn't
+// track them much. Impulse commands work as usual, but don't call
+// the regular ImpulseCommand handler in weapons.qc since Spectators don't
+// have any weapons and things can explode.
+//
+// --- Zoid.
+
+#ifndef NETQUAKE
+
+/*
+===========
+SpectatorConnect
+
+called when a spectator connects to a server
+============
+*/
+void() SpectatorConnect =
+{
+ bprint3 (PRINT_MEDIUM, "Spectator ", self.netname, " entered the game\n");
+
+ self.goalentity = world; // used for impulse 1 below
+};
+
+/*
+===========
+SpectatorDisconnect
+
+called when a spectator disconnects from a server
+============
+*/
+void() SpectatorDisconnect =
+{
+ bprint3 (PRINT_MEDIUM, "Spectator ", self.netname, " left the game\n");
+};
+
+/*
+================
+SpectatorImpulseCommand
+
+Called by SpectatorThink if the spectator entered an impulse
+================
+*/
+void() SpectatorImpulseCommand =
+{
+ if (self.impulse == 1) {
+ // teleport the spectator to the next spawn point
+ // note that if the spectator is tracking, this doesn't do
+ // much
+ self.goalentity = find(self.goalentity, classname, "info_player_deathmatch");
+ if (self.goalentity == world)
+ self.goalentity = find(self.goalentity, classname, "info_player_deathmatch");
+ if (self.goalentity != world) {
+ setorigin(self, self.goalentity.origin);
+ self.angles = self.goalentity.angles;
+ self.fixangle = TRUE; // turn this way immediately
+ }
+ }
+
+ self.impulse = 0;
+};
+
+/*
+================
+SpectatorThink
+
+Called every frame after physics are run
+================
+*/
+void() SpectatorThink =
+{
+ // self.origin, etc contains spectator position, so you could
+ // do some neat stuff here
+
+ if (self.impulse)
+ SpectatorImpulseCommand();
+};
+
+#endif
+
diff --git a/r17/Revamped src/Revamped QC/sprites.qc b/r17/Revamped src/Revamped QC/sprites.qc
new file mode 100755
index 00000000..98fac355
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/sprites.qc
@@ -0,0 +1,26 @@
+
+// these are the only sprites still in the game...
+
+$spritename s_explod
+$type vp_parallel
+$load /raid/quake/id1/gfx/sprites/explod03.lbm
+$frame 24 24 56 56
+$frame 120 24 56 56
+$frame 216 24 56 56
+$frame 24 88 56 56
+$frame 120 88 56 56
+$frame 216 88 56 56
+
+
+$spritename s_bubble
+$type vp_parallel
+$load /raid/quake/id1/gfx/sprites/bubble.lbm
+$frame 16 16 16 16
+$frame 40 16 16 16
+
+
+$spritename s_light
+$type vp_parallel
+$load /raid/quake/id1/gfx/sprites/light.lbm
+$frame 104 32 32 32
+
diff --git a/r17/Revamped src/Revamped QC/subs.qc b/r17/Revamped src/Revamped QC/subs.qc
new file mode 100755
index 00000000..c7a8a1ac
Binary files /dev/null and b/r17/Revamped src/Revamped QC/subs.qc differ
diff --git a/r17/Revamped src/Revamped QC/triggers.qc b/r17/Revamped src/Revamped QC/triggers.qc
new file mode 100755
index 00000000..addf7ed0
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/triggers.qc
@@ -0,0 +1,637 @@
+void() trigger_reactivate =
+{
+ self.solid = SOLID_TRIGGER;
+};
+
+//=============================================================================
+
+float SPAWNFLAG_NOMESSAGE = 1;
+float SPAWNFLAG_NOTOUCH = 1;
+
+// the wait time has passed, so set back up for another activation
+void() multi_wait =
+{
+ if (self.max_health)
+ {
+ self.health = self.max_health;
+ self.takedamage = DAMAGE_YES;
+ self.solid = SOLID_BBOX;
+ }
+};
+
+
+// the trigger was just touched/killed/used
+// self.enemy should be set to the activator so it can be held through a delay
+// so wait for the delay time before firing
+void() multi_trigger =
+{
+ if (self.nextthink > time)
+ {
+ return; // allready been triggered
+ }
+
+ if (self.classname == "trigger_secret")
+ {
+ if (self.enemy.classname != "player")
+ return;
+ found_secrets = found_secrets + 1;
+ WriteByte (MSG_ALL, SVC_FOUNDSECRET);
+ }
+
+ if (self.noise)
+ sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
+
+// don't trigger again until reset
+ self.takedamage = DAMAGE_NO;
+
+ activator = self.enemy;
+
+ SUB_UseTargets();
+
+ if (self.wait > 0)
+ {
+ self.think = multi_wait;
+ self.nextthink = time + self.wait;
+ }
+ else
+ { // we can't just remove (self) here, because this is a touch function
+ // called wheil C code is looping through area links...
+ self.touch = SUB_Null;
+ self.nextthink = time + 0.1;
+ self.think = SUB_Remove;
+ }
+};
+
+void() multi_killed =
+{
+ self.enemy = damage_attacker;
+ multi_trigger();
+};
+
+void() multi_use =
+{
+ self.enemy = activator;
+ multi_trigger();
+};
+
+void() multi_touch =
+{
+ if (other.classname != "player")
+ return;
+
+// if the trigger has an angles field, check player's facing direction
+ if (self.movedir != '0 0 0')
+ {
+ makevectors (other.angles);
+ if (v_forward * self.movedir < 0)
+ return; // not facing the right way
+ }
+
+ self.enemy = other;
+ multi_trigger ();
+};
+
+/*QUAKED trigger_multiple (.5 .5 .5) ? notouch
+Variable sized repeatable trigger. Must be targeted at one or more entities. If "health" is set, the trigger must be killed to activate each time.
+If "delay" is set, the trigger waits some time after activating before firing.
+"wait" : Seconds between triggerings. (.2 default)
+If notouch is set, the trigger is only fired by other entities, not by touching.
+NOTOUCH has been obsoleted by trigger_relay!
+sounds
+1) secret
+2) beep beep
+3) large switch
+4)
+set "message" to text string
+*/
+void() trigger_multiple =
+{
+ switch (self.sounds)
+ {
+ case 1:
+ precache_sound ("misc/secret.wav");
+ self.noise = "misc/secret.wav";
+ break;
+ case 2:
+ precache_sound ("misc/talk.wav");
+ self.noise = "misc/talk.wav";
+ break;
+ case 3:
+ precache_sound ("misc/trigger1.wav");
+ self.noise = "misc/trigger1.wav";
+ break;
+ }
+
+ if (!self.wait)
+ self.wait = 0.2;
+ self.use = multi_use;
+
+ InitTrigger ();
+
+ if (self.health)
+ {
+ if (self.spawnflags & SPAWNFLAG_NOTOUCH)
+ objerror ("health and notouch don't make sense\n");
+ self.max_health = self.health;
+ self.th_die = multi_killed;
+ self.takedamage = DAMAGE_YES;
+ self.solid = SOLID_BBOX;
+ setorigin (self, self.origin); // make sure it links into the world
+ }
+ else
+ {
+ if ( !(self.spawnflags & SPAWNFLAG_NOTOUCH) )
+ {
+ self.touch = multi_touch;
+ }
+ }
+};
+
+
+/*QUAKED trigger_once (.5 .5 .5) ? notouch
+Variable sized trigger. Triggers once, then removes itself. You must set the key "target" to the name of another object in the level that has a matching
+"targetname". If "health" is set, the trigger must be killed to activate.
+If notouch is set, the trigger is only fired by other entities, not by touching.
+if "killtarget" is set, any objects that have a matching "target" will be removed when the trigger is fired.
+if "angle" is set, the trigger will only fire when someone is facing the direction of the angle. Use "360" for an angle of 0.
+sounds
+1) secret
+2) beep beep
+3) large switch
+4)
+set "message" to text string
+*/
+void() trigger_once =
+{
+ self.wait = -1;
+ trigger_multiple();
+};
+
+//=============================================================================
+
+/*QUAKED trigger_relay (.5 .5 .5) (-8 -8 -8) (8 8 8)
+This fixed size trigger cannot be touched, it can only be fired by other events. It can contain killtargets, targets, delays, and messages.
+*/
+void() trigger_relay =
+{
+ self.use = SUB_UseTargets;
+};
+
+
+//=============================================================================
+
+/*QUAKED trigger_secret (.5 .5 .5) ?
+secret counter trigger
+sounds
+1) secret
+2) beep beep
+3)
+4)
+set "message" to text string
+*/
+void() trigger_secret =
+{
+ total_secrets = total_secrets + 1;
+ self.wait = -1;
+ if (!self.message)
+ self.message = "You found a secret area!";
+ if (!self.sounds)
+ self.sounds = 1;
+
+ if (self.sounds == 1)
+ {
+ precache_sound ("misc/secret.wav");
+ self.noise = "misc/secret.wav";
+ }
+ else if (self.sounds == 2)
+ {
+ precache_sound ("misc/talk.wav");
+ self.noise = "misc/talk.wav";
+ }
+
+ trigger_multiple ();
+};
+
+//=============================================================================
+
+
+void() counter_use =
+{
+ self.count = self.count - 1;
+ if (self.count < 0)
+ return;
+
+ if (self.count != 0)
+ {
+ if (activator.classname == "player"
+ && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
+ {
+ if (self.count >= 4)
+ centerprint (activator, "There are more to go...");
+ else if (self.count == 3)
+ centerprint (activator, "Only 3 more to go...");
+ else if (self.count == 2)
+ centerprint (activator, "Only 2 more to go...");
+ else
+ centerprint (activator, "Only 1 more to go...");
+ }
+ return;
+ }
+
+ if (activator.classname == "player"
+ && (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0)
+ centerprint(activator, "Sequence completed!");
+ self.enemy = activator;
+ multi_trigger ();
+};
+
+/*QUAKED trigger_counter (.5 .5 .5) ? nomessage
+Acts as an intermediary for an action that takes multiple inputs.
+
+If nomessage is not set, t will print "1 more.. " etc when triggered and "sequence complete" when finished.
+
+After the counter has been triggered "count" times (default 2), it will fire all of it's targets and remove itself.
+*/
+void() trigger_counter =
+{
+ self.wait = -1;
+ if (!self.count)
+ self.count = 2;
+
+ self.use = counter_use;
+};
+
+
+/*
+==============================================================================
+
+TELEPORT TRIGGERS
+
+==============================================================================
+*/
+
+float PLAYER_ONLY = 1;
+float SILENT = 2;
+
+void() play_teleport =
+{
+ local float v;
+ local string tmpstr;
+
+ v = random();
+ if (v < 0.2)
+ tmpstr = "misc/r_tele1.wav";
+ else if (v < 0.4)
+ tmpstr = "misc/r_tele2.wav";
+ else if (v < 0.6)
+ tmpstr = "misc/r_tele3.wav";
+ else if (v < 0.8)
+ tmpstr = "misc/r_tele4.wav";
+ else
+ tmpstr = "misc/r_tele5.wav";
+
+ sound (self, CHAN_VOICE, tmpstr, 1, ATTN_NORM);
+ remove (self);
+};
+
+void(vector org) spawn_tfog =
+{
+ local entity s;
+ s = spawn ();
+ s.origin = org;
+ s.nextthink = time + 0.2;
+ s.think = play_teleport;
+
+ TE_teleport(org);
+};
+
+
+void() tdeath_touch =
+{
+ if (other == self.owner)
+ return;
+
+// frag anyone who teleports in on top of an invincible player
+ if (other.classname == "player")
+ {
+ if (other.invincible_finished > time &&
+ self.owner.invincible_finished > time) {
+ other.invincible_finished = 0;
+ self.owner.invincible_finished = 0;
+ T_Damage (other, self, self.owner, 50000, MOD_TELEFRAGDEFLECT);
+ T_Damage (self.owner, self, other, 50000, MOD_TELEFRAGDEFLECT);
+ return;
+ }
+
+ if (other.invincible_finished > time)
+ {
+ T_Damage (self.owner, self, self.owner, 50000, MOD_TELEFRAGDEFLECT);
+ return;
+ }
+
+ }
+
+ if (other.health)
+ {
+ T_Damage (other, self, self.owner, 50000, MOD_TELEFRAG);
+ }
+};
+
+
+void(vector org, entity death_owner) spawn_tdeath =
+{
+local entity death;
+
+ death = spawn();
+ death.classname = "teledeath";
+ death.movetype = MOVETYPE_NONE;
+ death.solid = SOLID_TRIGGER;
+ death.angles = '0 0 0';
+ setsize (death, death_owner.mins - '1 1 1', death_owner.maxs + '1 1 1');
+ setorigin (death, org);
+ death.touch = tdeath_touch;
+ death.nextthink = time + 0.2;
+ death.think = SUB_Remove;
+ death.owner = death_owner;
+
+ force_retouch = 2; // make sure even still objects get hit
+};
+
+void() teleport_touch =
+{
+local entity t;
+local vector org;
+
+ if (self.targetname)
+ {
+ if (self.nextthink < time)
+ {
+ return; // not fired yet
+ }
+ }
+
+ if (self.spawnflags & PLAYER_ONLY)
+ {
+ if (other.classname != "player")
+ return;
+ }
+
+// only teleport living creatures
+ if (other.health <= 0 || other.solid != SOLID_SLIDEBOX)
+ return;
+
+ SUB_UseTargets ();
+
+// put a tfog where the player was
+ spawn_tfog (other.origin);
+
+ t = find (world, targetname, self.target);
+ if (!t)
+ objerror ("couldn't find target");
+
+// spawn a tfog flash in front of the destination
+ makevectors (t.mangle);
+ org = t.origin + 32 * v_forward;
+
+ spawn_tfog (org);
+ spawn_tdeath(t.origin, other);
+
+// move the player and lock him down for a little while
+ if (!other.health)
+ {
+ other.origin = t.origin;
+ other.velocity = (v_forward * other.velocity_x) + (v_forward * other.velocity_y);
+ return;
+ }
+
+ setorigin (other, t.origin);
+ other.angles = t.mangle;
+ if (other.classname == "player")
+ {
+ other.fixangle = 1; // turn this way immediately
+ other.teleport_time = time + 0.7;
+ if (other.flags & FL_ONGROUND)
+ other.flags = other.flags - FL_ONGROUND;
+ other.velocity = v_forward * 300;
+ }
+ other.flags = other.flags - other.flags & FL_ONGROUND;
+};
+
+/*QUAKED info_teleport_destination (.5 .5 .5) (-8 -8 -8) (8 8 32)
+This is the destination marker for a teleporter. It should have a "targetname" field with the same value as a teleporter's "target" field.
+*/
+void() info_teleport_destination =
+{
+// this does nothing, just serves as a target spot
+ self.mangle = self.angles;
+ self.angles = '0 0 0';
+ self.model = "";
+ self.origin = self.origin + '0 0 27';
+ if (!self.targetname)
+ objerror ("no targetname");
+};
+
+void() teleport_use =
+{
+ self.nextthink = time + 0.2;
+ force_retouch = 2; // make sure even still objects get hit
+ self.think = SUB_Null;
+};
+
+/*QUAKED trigger_teleport (.5 .5 .5) ? PLAYER_ONLY SILENT
+Any object touching this will be transported to the corresponding info_teleport_destination entity. You must set the "target" field, and create an object with a "targetname" field that matches.
+
+If the trigger_teleport has a targetname, it will only teleport entities when it has been fired.
+*/
+void() trigger_teleport =
+{
+ local vector o;
+
+ InitTrigger ();
+ self.touch = teleport_touch;
+ // find the destination
+ if (!self.target)
+ objerror ("no target");
+ self.use = teleport_use;
+
+ if (!(self.spawnflags & SILENT))
+ {
+ precache_sound ("ambience/hum1.wav");
+ o = (self.mins + self.maxs)*0.5;
+ ambientsound (o, "ambience/hum1.wav",0.5 , ATTN_STATIC);
+ }
+};
+
+/*
+==============================================================================
+
+trigger_setskill
+
+==============================================================================
+*/
+
+/*QUAKED trigger_setskill (.5 .5 .5) ?
+sets skill level to the value of "message".
+Only used on start map.
+*/
+void() trigger_setskill =
+{
+ remove (self);
+};
+
+
+/*
+==============================================================================
+
+ONLY REGISTERED TRIGGERS
+
+==============================================================================
+*/
+
+void() trigger_onlyregistered_touch =
+{
+ if (other.classname != "player")
+ return;
+ if (self.attack_finished > time)
+ return;
+
+ self.attack_finished = time + 2;
+ if (cvar("registered"))
+ {
+ self.message = "";
+ SUB_UseTargets ();
+ remove (self);
+ }
+ else
+ {
+ if (self.message != "")
+ {
+ centerprint (other, self.message);
+ sound (other, CHAN_BODY, "misc/talk.wav", 1, ATTN_NORM);
+ }
+ }
+};
+
+/*QUAKED trigger_onlyregistered (.5 .5 .5) ?
+Only fires if playing the registered version, otherwise prints the message
+*/
+void() trigger_onlyregistered =
+{
+ precache_sound ("misc/talk.wav");
+ InitTrigger ();
+ self.touch = trigger_onlyregistered_touch;
+};
+
+//============================================================================
+
+void() hurt_on =
+{
+ self.solid = SOLID_TRIGGER;
+ self.nextthink = -1;
+};
+
+void() hurt_touch =
+{
+ if (other.takedamage)
+ {
+ self.solid = SOLID_NOT;
+ T_Damage (other, self, self, self.dmg, MOD_HURT);
+ self.think = hurt_on;
+ self.nextthink = time + 1;
+ }
+
+ return;
+};
+
+/*QUAKED trigger_hurt (.5 .5 .5) ?
+Any object touching this will be hurt
+set dmg to damage amount
+defalt dmg = 5
+*/
+void() trigger_hurt =
+{
+ InitTrigger ();
+ self.touch = hurt_touch;
+ if (!self.dmg)
+ self.dmg = 5;
+};
+
+//============================================================================
+
+float PUSH_ONCE = 1;
+
+void() trigger_push_touch =
+{
+ if (other.classname == "grenade")
+ other.velocity = self.speed * self.movedir * 10;
+ else if (other.health > 0)
+ {
+ other.velocity = self.speed * self.movedir * 10;
+ if (other.classname == "player")
+ {
+ if (other.fly_sound < time)
+ {
+ other.fly_sound = time + 1.5;
+ sound (other, CHAN_AUTO, "ambience/windfly.wav", 1, ATTN_NORM);
+ }
+ }
+ }
+ if (self.spawnflags & PUSH_ONCE)
+ remove(self);
+};
+
+
+/*QUAKED trigger_push (.5 .5 .5) ? PUSH_ONCE
+Pushes the player
+*/
+void() trigger_push =
+{
+ InitTrigger ();
+ precache_sound ("ambience/windfly.wav");
+ self.touch = trigger_push_touch;
+ if (!self.speed)
+ self.speed = 1000;
+};
+
+//============================================================================
+
+void() trigger_monsterjump_touch =
+{
+ if ( other.flags & (FL_MONSTER | FL_FLY | FL_SWIM) != FL_MONSTER )
+ return;
+
+// set XY even if not on ground, so the jump will clear lips
+ other.velocity_x = self.movedir_x * self.speed;
+ other.velocity_y = self.movedir_y * self.speed;
+
+ if ( !(other.flags & FL_ONGROUND) )
+ return;
+
+ other.flags = other.flags - FL_ONGROUND;
+
+ other.velocity_z = self.height;
+};
+
+/*QUAKED trigger_monsterjump (.5 .5 .5) ?
+Walking monsters that touch this will jump in the direction of the trigger's angle
+"speed" default to 200, the speed thrown forward
+"height" default to 200, the speed thrown upwards
+*/
+void() trigger_monsterjump =
+{
+ if (deathmatch)
+ {
+ remove(self);
+ return;
+ }
+
+ if (!self.speed)
+ self.speed = 200;
+ if (!self.height)
+ self.height = 200;
+ if (self.angles == '0 0 0')
+ self.angles = '0 360 0';
+ InitTrigger ();
+ self.touch = trigger_monsterjump_touch;
+};
+
diff --git a/r17/Revamped src/Revamped QC/weapons.qc b/r17/Revamped src/Revamped QC/weapons.qc
new file mode 100755
index 00000000..cb5faacb
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/weapons.qc
@@ -0,0 +1,3277 @@
+/*
+*/
+vector puff_org;
+void (entity targ, entity inflictor, entity attacker, float damage, INTEGER mod) T_Damage;
+void () player_run;
+void(entity inflictor, entity attacker, float damage, float radius, entity ignore, INTEGER mod) T_RadiusDamage;
+void(vector org, float damage) SpawnBlood;
+void() SuperDamageSound;
+void () player_reload1;
+void () player_stand1;
+// called by worldspawn
+void() W_Precache =
+{
+ precache_sound ("weapons/r_exp3.wav"); // new rocket explosion
+ precache_sound ("weapons/rocket1i.wav"); // spike gun
+ precache_sound ("weapons/uzi.wav"); // Uzi
+ precache_sound ("weapons/sgun1.wav"); //RL
+ precache_sound ("weapons/pistol.wav"); // player shotgun
+ precache_sound ("weapons/grenade.wav"); // grenade launcher
+ precache_sound ("weapons/bounce.wav"); // grenade bounce
+ precache_sound ("weapons/sniper.wav"); // sniperrifle
+ precache_sound ("weapons/shottie.wav"); // shottie
+ precache_sound ("weapons/shotgn2.wav"); // Ar2
+ precache_sound ("weapons/needler.wav"); // needler
+ precache_sound ("weapons/ar1.wav"); //Sound effects for asault rifle
+ precache_model ("GFX/s_fblood.spr"); //Flood blood
+ precache_model ("progs/PL_BULL.spr"); //Flood blood
+ precache_model ("progs/h_dog.mdl"); // Head for floodpod
+ precache_model ("sprites/s_smoke2.spr"); //Flood blood
+ precache_sound ("weapons/bigneedler.wav"); //
+ precache_model ("progs/needler_dust.spr");
+
+ // Solitude precaches
+
+ // Weapons (first-person)
+ precache_model ("progs/v_shotgun.mdl");
+ precache_model ("progs/v_rocket.mdl");
+ precache_model ("progs/v_uzi.mdl");
+ precache_model ("progs/v_sniper.mdl");
+ precache_model ("progs/v_plpist.mdl");
+ precache_model ("progs/v_needle.mdl");
+ precache_model ("progs/v_plrifle.mdl");
+
+ // Weapons sounds
+ //Reload
+ precache_sound ("weapons/reload/pistol.wav");
+ precache_sound ("weapons/reload/needler.wav");
+ precache_sound ("weapons/reload/ar.wav");
+ precache_sound ("weapons/reload/sniper.wav");
+ precache_sound ("weapons/reload/uzi.wav");
+ precache_sound ("weapons/reload/rocket.wav");
+ precache_sound ("weapons/reload/shottie.wav"); // reload sounds
+
+ //melee
+ precache_sound ("weapons/melee/needler.wav");
+ precache_sound ("weapons/melee/pistol.wav");
+
+ // Grenades
+ precache_model ("progs/fraggren.mdl");
+ precache_model ("progs/plasgren.mdl");
+ precache_model ("sprites/s_plasma4.spr");
+ precache_model ("sprites/plasma3.spr");
+ precache_sound ("weapons/plasma_blow.wav");
+ precache_sound ("weapons/plasma_throw.wav");
+ precache_sound ("weapons/pbounce.wav");
+ precache_model ("progs/s_smoke1.spr"); // Smoke from explosion
+
+
+ // Dropped weapons
+ precache_model ("progs/g_shot.mdl");
+ precache_model ("progs/g_pistol.mdl");
+ precache_model ("progs/g_nail.mdl");
+ precache_model ("progs/g_uzi.mdl");
+ precache_model ("progs/g_rocket.mdl");
+ precache_model ("progs/g_sniper.mdl");
+ precache_model ("progs/g_needler.mdl");
+ precache_model ("progs/g_plpist.mdl");
+ precache_sound ("weapons/ppist.wav");
+
+ // projectiles
+ precache_model ("progs/sniperbullet.mdl");
+ precache_model ("progs/needproy.mdl"); // Needler Projectile
+ precache_model ("progs/Bigneedproy.mdl"); // Needler Projectile
+ precache_model ("progs/needpro2.mdl"); // Embedded needle
+ precache_model ("sprites/muzzleflash.spr");
+ precache_model ("sprites/muzzleflash1.spr"); //ar original flash
+ precache_model ("sprites/muzzleflash2.spr");
+ precache_model ("sprites/pistolmuzzleflash.spr");
+ precache_model ("sprites/muzzleN.spr"); // Needler Muzzle flash
+ precache_model ("progs/plasma.spr");
+
+ //misc precaches
+ precache_sound ("weapons/zoom.wav");
+ precache_sound ("weapons/zoom2.wav");
+ precache_sound ("weapons/coil.wav");
+
+
+ //Needler Extra
+ precache_sound ("weapons/nb.wav");
+ precache_sound ("weapons/crystal.wav");
+ precache_sound ("weapons/coil.wav");
+
+ //Equip sounds
+ precache_sound ("weapons/equip/ar.wav");
+ precache_sound ("weapons/equip/needler.wav");
+ precache_sound ("weapons/equip/rocket.wav");
+ precache_sound ("weapons/equip/pistol.wav");
+ precache_sound ("weapons/equip/shotgun.wav");
+ precache_sound ("weapons/equip/sniper.wav");
+ precache_sound ("weapons/equip/ppist.wav");
+ precache_sound ("weapons/equip/smg.wav");
+
+
+ //Shells
+ precache_model ("progs/shell.mdl");
+ precache_model ("progs/shellshot.mdl");
+
+
+
+
+};
+
+
+
+/*
+===================================
+Muzzle flashes
+==================================
+*/
+
+void() muzzleflash_think = {
+self.frame = self.frame + 1;
+self.think = SUB_Remove;
+self.nextthink = time + 0.02;
+};
+
+void() muzzleflash2 = {
+local entity muzzle;
+muzzle = spawn();
+muzzle.owner = self;
+
+
+muzzle.solid = SOLID_NOT;
+
+setmodel(muzzle,"sprites/muzzleflash1.spr");
+setorigin(muzzle,self.origin + v_forward * 23 + v_right * 6 + '0 0 19');
+muzzle.think = muzzleflash_think;
+muzzle.nextthink = time + 0.01;
+};void() muzzleflash_think1 = {
+self.frame = self.frame + 1;
+self.think = SUB_Remove;
+self.nextthink = time + 0.01;
+};
+
+void() muzzleflash3 = {
+local entity muzzle;
+muzzle = spawn();
+muzzle.owner = self;
+
+
+muzzle.solid = SOLID_NOT;
+muzzle.movetype = MOVETYPE_NONE;
+
+
+setmodel(muzzle,"sprites/muzzleflash.spr");
+setorigin(muzzle,self.origin + v_forward * 35 + v_right * 6 + '0 0 15');
+muzzle.think = muzzleflash_think1;
+muzzle.nextthink = time + 0.01;
+};void() muzzleflash_think2 = {
+self.frame = self.frame + 1;
+self.think = SUB_Remove;
+self.nextthink = time + 0.02;
+};
+
+void() muzzleflash4 = {
+local entity muzzle;
+muzzle = spawn();
+muzzle.owner = self;
+
+
+muzzle.solid = SOLID_NOT;
+muzzle.movetype = MOVETYPE_NONE;
+
+
+setmodel(muzzle,"sprites/muzzleflash2.spr");
+setorigin(muzzle,self.origin + v_forward * 55 + v_right * 10 + '0 0 13');
+muzzle.think = muzzleflash_think1;
+muzzle.nextthink = time + 0.01;
+};
+
+void() muzzleflash5 = {
+local entity muzzle;
+muzzle = spawn();
+muzzle.owner = self;
+
+
+muzzle.solid = SOLID_NOT;
+muzzle.movetype = MOVETYPE_NONE;
+
+
+setmodel(muzzle,"sprites/pistolmuzzleflash.spr");
+setorigin(muzzle,self.origin + v_forward * 30 + v_right * 8 + '0 0 20');
+muzzle.think = muzzleflash_think2;
+muzzle.nextthink = time + 0.01;
+};void() muzzleflash_think3 = {
+self.frame = self.frame + 1;
+self.think = SUB_Remove;
+self.nextthink = time + 0.01;
+};
+void() muzzleflash_think6 = {
+self.frame = self.frame + 2;
+self.think = SUB_Remove;
+self.nextthink = time + 0.02;
+};
+void() muzzleflash6 = {
+local entity muzzle;
+muzzle = spawn();
+muzzle.owner = self;
+
+
+muzzle.solid = SOLID_NOT;
+muzzle.movetype = MOVETYPE_NONE;
+
+
+setmodel(muzzle,"sprites/muzzleN.spr");
+setorigin(muzzle,self.origin + v_forward * 35 + v_right * 10 + '0 0 17');
+muzzle.think = muzzleflash_think6;
+muzzle.nextthink = time + 0.01;
+};
+
+void() muzzleflash7 = {
+local entity muzzle;
+muzzle = spawn();
+muzzle.owner = self;
+
+
+muzzle.solid = SOLID_NOT;
+muzzle.movetype = MOVETYPE_NONE;
+
+
+setmodel(muzzle,"sprites/muzzleflash.spr");
+setorigin(muzzle,self.origin + v_forward * 45 + v_right * 2 + '0 0 17');
+muzzle.think = muzzleflash_think1;
+muzzle.nextthink = time + 0.01;
+};
+
+#define crandom() (2*(random()-0.5))
+
+void() W_UpdateWeapon;
+
+// The weapon the player spawns with
+void () W_StartWeapon =
+{
+ self.items = WEAPON_AR + WEAPON_PPISTOL;
+ self.ammo_nails = W_GetMaxClip(self.weapon, 4);
+ self.exnails = 560;
+ self.ammo_ppistol = 100;
+ self.currentammo = W_GetMaxClip(self.weapon, 4);
+
+ self.weapon = WEAPON_AR;
+ W_UpdateWeapon();
+
+ W_UpdateAmmoCounts(self);
+};
+/*
+Ammo update functions
+*/
+// xavior: FIXME instead of using W_SetCurrentAmmo!
+//Mexicouger: Handle the Ammo count HUD here, rather than PlayerPreThink. It is way more efficient Memory wise.(10-15 fps)
+void(entity ent) W_UpdateAmmoCounts =
+{
+ AmmoCounter();
+ // solitude
+ switch (ent.weapon)
+ {
+ case WEAPON_PISTOL:
+ ent.currentammo = ent.ammo_shells;
+ ent.armorvalue = ent.exshells;
+ break;
+ case WEAPON_SKULL:
+ ent.currentammo = ent.ammo_shells;
+ ent.armorvalue = ent.exshells;
+ break;
+ case WEAPON_SHOT:
+ ent.currentammo = ent.ammo_shells2;
+ ent.armorvalue = ent.exshells2;
+ break;
+ case WEAPON_AR:
+ ent.currentammo = ent.ammo_nails;
+ ent.armorvalue = ent.exnails;
+ break;
+ case WEAPON_UZI:
+ ent.currentammo = ent.ammo_hshells;
+ ent.armorvalue = ent.exhshells;
+ break;
+ case WEAPON_RL:
+ ent.currentammo = ent.ammo_rockets;
+ ent.armorvalue = ent.exrockets;
+ break;
+ case WEAPON_SNIPER:
+ ent.currentammo = ent.ammo_sniper;
+ ent.armorvalue = ent.exsniper;
+ break;
+ case WEAPON_PPISTOL:
+ ent.currentammo = ent.ammo_ppistol;
+ ent.armorvalue = ent.exppistol;
+ break;
+ case WEAPON_SWORD:
+ ent.currentammo = ent.ammo_sword;
+ ent.armorvalue = ent.exsword;
+ break;
+ case WEAPON_NEEDLER:
+ ent.currentammo = ent.ammo_needler;
+ ent.armorvalue = ent.exneedler;
+ break;
+ case WEAPON_PRIFLE:
+ ent.currentammo = ent.ammo_prifle;
+ ent.armorvalue = ent.exprifle;
+ break;
+ default:
+ ent.currentammo = 12;
+ break;
+ }
+};
+
+// Damage per individual bullets
+float (float t_wep) W_BulletDamage =
+{
+ switch (t_wep) {
+ case WEAPON_SHOT:
+ return 8;
+ break;
+ default:
+ return 4;
+ break;
+ }
+ return 4;
+};
+
+// cliptype 1 = max size per clip
+// cliptype 0 = max extra ammo the player can carry
+float (float wep, float cliptype) W_GetMaxClip =
+{
+ // solitude
+ switch (wep)
+ {
+ case WEAPON_PISTOL:
+ if (cliptype)
+ return 12;
+ else
+ return 90;
+ break;
+ case WEAPON_SKULL:
+ if (cliptype)
+ return 12;
+ else
+ return 90;
+ break;
+ case WEAPON_SHOT:
+ if (cliptype)
+ return 6;
+ else
+ return 30;
+ break;
+ case WEAPON_AR:
+ if (cliptype)
+ return 32;
+ else
+ return 560;
+ break;
+ case WEAPON_UZI:
+ if (cliptype)
+ return 60;
+ else
+ return 560;
+ break;
+ case WEAPON_RL:
+ if (cliptype)
+ return 2;
+ else
+ return 6;
+ break;
+ case WEAPON_SNIPER:
+ if (cliptype)
+ return 4;
+ else
+ return 20;
+ break;
+ case WEAPON_PPISTOL:
+ if (cliptype)
+ return 100;
+ else
+ return 90;
+ break;
+ case WEAPON_SWORD:
+ if (cliptype)
+ return 0; // should be 0 - infinite
+ else
+ return 0;
+ break;
+ case WEAPON_NEEDLER:
+ if (cliptype)
+ return 20;
+ else
+ return 80;
+ break;
+ case WEAPON_PRIFLE:
+ if (cliptype)
+ return 100;
+ else
+ return 90;
+ break;
+ default:
+ if (cliptype)
+ return 1;
+ else
+ return 90;
+ break;
+ }
+ return 1;
+};
+
+float (entity ent) W_CanFire =
+{
+ switch (ent.weapon)
+ {
+ case IT_AXE:
+ return TRUE;
+ break;
+ case WEAPON_PISTOL:
+ if (ent.ammo_shells <= 0)
+ return FALSE;
+ break;
+ case WEAPON_SKULL:
+ if (ent.ammo_shells <= 0)
+ return TRUE;
+ break;
+ case WEAPON_SHOT:
+ if (ent.ammo_shells2 <= 0)
+ return FALSE;
+ break;
+ case WEAPON_AR:
+ if (ent.ammo_nails <= 0)
+ return FALSE;
+ break;
+ case WEAPON_UZI:
+ if (ent.ammo_hshells <= 0)
+ return FALSE;
+ break;
+ case WEAPON_RL:
+ if (ent.ammo_rockets <= 0)
+ return FALSE;
+ break;
+ case WEAPON_SNIPER:
+ if (ent.ammo_sniper <= 0)
+ return FALSE;
+ break;
+ case WEAPON_PPISTOL:
+ if (ent.ammo_ppistol <= 0)
+ return FALSE;
+ break;
+ case WEAPON_SWORD:
+ if (ent.ammo_sword <= 0)
+ return FALSE;
+ break;
+ case WEAPON_NEEDLER:
+ if (ent.ammo_needler <= 0)
+ return FALSE;
+ break;
+ case WEAPON_PRIFLE:
+ if (ent.ammo_prifle <= 0)
+ return FALSE;
+ break;
+ default:
+ return TRUE;
+ break;
+ }
+ return TRUE;
+};
+
+void ( float famt ) Set_FOV =
+{
+ stuffcmd( self, "fov " );
+ stuffcmd( self, ftos( famt ) );
+ stuffcmd( self, "\n" );
+};
+
+void () WeaponZoom =
+{
+ float tozoom;
+
+ if (self.health < 1)
+ return;
+
+ switch (self.weapon)
+ {
+ case WEAPON_SNIPER:
+ if (self.pfov < FOV_DEFAULT)
+ { tozoom = 15;
+ sound (self, CHAN_AUTO, "weapons/zoom.wav", 1, ATTN_NORM);
+ }
+ else {
+ tozoom = 45;
+ sound (self, CHAN_AUTO, "weapons/zoom2.wav", 1, ATTN_NORM);
+ }
+ break;
+ default:
+ tozoom = 45;
+ break;
+ }
+ if (self.pfov == tozoom)
+ tozoom = FOV_DEFAULT;
+
+ Set_FOV( tozoom );
+ self.pfov = tozoom;
+};
+
+/*
+================
+W_FireAxe
+================
+*/
+void(float lunge) W_FireSword =
+{
+ local vector source;
+ local vector org;
+
+ makevectors (self.v_angle);
+ source = self.origin + '0 0 16';
+ traceline (source, source + v_forward*64, FALSE, self);
+
+ if (trace_fraction == 1.0)
+ return;
+
+ org = trace_endpos - v_forward*4;
+
+ if (trace_ent.takedamage)
+ {
+ SpawnBlood (org, 20);
+ if (lunge)
+ T_Damage (trace_ent, self, self, 150, MOD_AXE);
+ else
+ T_Damage (trace_ent, self, self, 75, MOD_AXE);
+
+ }
+ else
+ { // hit wall
+
+ sound (self, CHAN_WEAPON, "player/axhit2.wav", 1, ATTN_NORM);
+
+ TE_gunshot(org);
+ }
+};
+
+
+//============================================================================
+
+/*
+================
+SpawnMeatSpray
+================
+*/
+void(vector org, vector vel) SpawnMeatSpray =
+{
+ local entity missile;
+
+ missile = spawn ();
+ missile.owner = self;
+ missile.movetype = MOVETYPE_BOUNCE;
+ missile.solid = SOLID_NOT;
+
+ makevectors (self.angles);
+
+ missile.velocity = vel;
+ missile.velocity_z = missile.velocity_z + 250 + 50*random();
+
+ missile.avelocity = '3000 1000 2000';
+
+// set missile duration
+ missile.nextthink = time + 1;
+ missile.think = SUB_Remove;
+
+ setmodel (missile, "progs/zom_gib.mdl");
+ setsize (missile, '0 0 0', '0 0 0');
+ setorigin (missile, org);
+};
+
+/*
+==============================================================================
+
+MULTI-DAMAGE
+
+Collects multiple small damages into a single damage
+
+==============================================================================
+*/
+
+entity multi_ent;
+float multi_damage;
+INTEGER multi_mod;
+
+vector blood_org;
+float blood_count;
+
+
+float puff_count;
+
+void() ClearMultiDamage =
+{
+ multi_ent = world;
+ multi_damage = 0;
+ blood_count = 0;
+ puff_count = 0;
+ multi_mod = MOD_NONE;
+};
+
+void() ApplyMultiDamage =
+{
+ if (!multi_ent)
+ return;
+ T_Damage (multi_ent, self, self, multi_damage, multi_mod);
+};
+
+void(entity hit, float damage, INTEGER mod) AddMultiDamage =
+{
+ if (!hit)
+ return;
+
+ if (hit != multi_ent || mod != multi_mod)
+ {
+ ApplyMultiDamage ();
+ multi_damage = damage;
+ multi_ent = hit;
+ }
+ else
+ multi_damage = multi_damage + damage;
+};
+
+void() Multi_Finish =
+{
+ if (puff_count)
+ TE_gunshot(puff_org);
+
+ if (blood_count)
+ SpawnBlood(blood_org, blood_count);
+};
+
+/*
+==============================================================================
+BULLETS
+==============================================================================
+*/
+
+/*
+================
+TraceAttack
+================
+*/
+void(float damage, vector dir, INTEGER mod) TraceAttack =
+{
+ local vector vel, org;
+
+ vel = normalize(dir + v_up*crandom() + v_right*crandom());
+ vel = vel + 2*trace_plane_normal;
+ vel = vel * 200;
+
+ org = trace_endpos - dir*4;
+
+ if (trace_ent.takedamage)
+ {
+ blood_count = blood_count + 1;
+ blood_org = org;
+ AddMultiDamage (trace_ent, damage, mod);
+ }
+ else
+ {
+ puff_count = puff_count + 1;
+ }
+};
+
+/*
+================
+FireBullets
+
+Used by shotgun, super shotgun, and enemy soldier firing
+Go to the trouble of combining multiple pellets into a single damage call.
+================
+*/
+void(float shotcount, vector dir, vector spread, INTEGER mod) FireBullets =
+{
+ local vector direction;
+ local vector src;
+
+ makevectors(self.v_angle);
+
+ src = self.origin + v_forward*10;
+ src_z = self.absmin_z + self.size_z * 0.7;
+
+ ClearMultiDamage ();
+
+ traceline (src, src + dir*2048, FALSE, self);
+ puff_org = trace_endpos - dir*4;
+
+ while (shotcount > 0)
+ {
+ direction = dir + crandom()*spread_x*v_right + crandom()*spread_y*v_up;
+ traceline (src, src + direction*2048, FALSE, self);
+ if (trace_fraction != 1.0)
+ TraceAttack (W_BulletDamage(self.weapon), direction, mod);
+
+ shotcount = shotcount - 1;
+ }
+ ApplyMultiDamage ();
+ Multi_Finish ();
+};
+
+/*
+========================================
+###################################################
+
+Touch Functions (explosions, Bullets, etc)
+
+##################################################
+========================================
+*/
+/*
+==============================
+
+Rocket Launcher Explosion
+
+==============================
+*/
+void() Rocket_Explode0 =
+{
+
+ if (other == self.owner)
+ return; // don't explode on owner
+
+ if (pointcontents(self.origin) == CONTENT_SKY)
+ {
+ remove(self);
+ return;
+ }
+ T_RadiusDamage (self, self.owner, 190, 160, world, MOD_ROCKET);
+
+ self.origin = self.origin - 8*normalize(self.velocity);
+
+
+ CreateExplosion (self.origin);
+ remove(self);
+};
+/*
+==============================
+
+Pistol Touch
+
+==============================
+*/
+void(vector org) PistolTouch =
+{
+ self.velocity = '0 0 0';
+
+ if (pointcontents(self.origin) == CONTENT_SKY)
+ {
+ remove(self);
+ return;
+ }
+ else if (other.takedamage) {
+ if (other.health >= 30)
+ {
+ particle (self.origin, '0 4 5', 110, 6);
+ particle (self.origin, '0 4 5', 109, 6);
+ }
+ else
+ spawn_touchblood (8);
+ if (other.health <= 30)
+ T_Damage (other, self, self.owner, 15);
+ else
+ T_Damage (other, self, self.owner, 20);
+
+
+ }
+ else
+ {
+ particle (self.origin, '0 0 0', 6, 8);
+ particle (self.origin, '0 0 0', 11, 8);
+ puff_org = self.origin;
+ }
+ remove(self);
+};
+/*
+==============================
+
+Assault rifle Touch
+
+==============================
+*/
+void(vector org) ARTouch =
+{
+ self.velocity = '0 0 0';
+
+ if (pointcontents(self.origin) == CONTENT_SKY)
+ {
+ remove(self);
+ return;
+ }
+ else if (other.takedamage) {
+ if (other.health >= 30)
+ {
+ particle (self.origin, '0 4 5', 110, 6);
+ particle (self.origin, '0 4 5', 109, 6);
+ }
+ else
+ spawn_touchblood (8);
+ if (other.health <= 30)
+ T_Damage (other, self, self.owner, 5);
+ else
+ T_Damage (other, self, self.owner, 5.3);
+
+
+ }
+ else
+ {
+ //particle (self.origin, '0 0 0', 6, 8);
+ particle (self.origin, '0 0 0', 11, 6);
+ puff_org = self.origin;
+ }
+
+ remove(self);
+};
+
+/*
+==============================
+
+SMG Touch
+
+==============================
+*/
+void(vector org) SMGTouch =
+{
+ self.velocity = '0 0 0';
+
+ if (pointcontents(self.origin) == CONTENT_SKY)
+ {
+ remove(self);
+ return;
+ }
+ else if (other.takedamage) {
+ if (other.health >= 30)
+ {
+ particle (self.origin, '0 4 5', 110, 6);
+ particle (self.origin, '0 4 5', 109, 6);
+ }
+ else
+ spawn_touchblood (8);
+ if (other.health <= 30)
+ T_Damage (other, self, self.owner, 4);
+ else
+ T_Damage (other, self, self.owner, 4.8);
+
+
+ }
+ else
+ {
+ particle (self.origin, '0 0 0', 6, 8);
+ particle (self.origin, '0 0 0', 11, 8);
+ puff_org = self.origin;
+ }
+ remove(self);
+};
+
+void(vector org) shotshells =
+{
+local entity rock;
+local float rand;
+local vector dir;
+rand = random();
+rock = spawn ();
+rock.classname = "gun_shells";
+rock.movetype = MOVETYPE_BOUNCE;
+rock.owner = self;
+// This is all about how fast the debris goes. (My biggest problem)
+makevectors (self.v_angle);
+rock.velocity = v_right;
+rock.velocity = (rock.velocity * 50);
+
+
+rock.angles = vectoangles (rock.velocity);
+rock.avelocity = '300 300 300' * random();
+
+rock.solid = SOLID_NOT;
+
+dir = aim (self, 1000);
+// Rock duration (How long the rocks are alive until they disapear
+//rock.touch = Debrisbounce;
+rock.nextthink = time + 3;
+rock.think = SUB_Remove;
+
+// The whole setting up the model thing. Sets up the sprite and location.
+setorigin (rock, ((org + (v_forward * 5)) + '0 0 12'));
+if (self.weapon == WEAPON_SHOT) {
+setmodel (rock, "progs/shellshot.mdl");
+}
+else
+setmodel (rock, "progs/shell.mdl");
+};
+void() player_pull;
+/*
+================
+W_FirePistol
+================
+*/
+void() W_FirePistol =
+{
+ local vector dir;
+ local entity missile;
+
+ sound (self, CHAN_WEAPON, "weapons/pistol.wav", 1, ATTN_NORM);
+
+ VK_smallkick(self);
+
+ self.ammo_shells -= 1;
+ W_UpdateAmmoCounts(self);
+ shotshells(self.origin + (v_forward * 13) + '0 0 12');
+
+ dir = aim (self, 1000);
+ pistolsmoke (self.origin);
+
+ missile = spawn ();
+ missile.owner = self;
+ missile.movetype = MOVETYPE_FLYMISSILE;
+ missile.solid = SOLID_BBOX;
+ missile.classname = "Pistol";
+
+// set missile speed
+
+ makevectors (self.v_angle);
+ missile.velocity = aim(self, 1000);
+ missile.velocity = v_forward;
+ missile.velocity = missile.velocity * 100000;
+ missile.angles = vectoangles(missile.velocity);
+
+ missile.touch = PistolTouch;
+
+// set missile duration
+ missile.nextthink = time + 5;
+ missile.think = SUB_Remove;
+
+ setsize (missile, '0 0 0', '0 0 0');
+ setorigin (missile, self.origin + v_forward*8 + '0 0 16');
+
+
+
+};
+/*
+================
+W_FireSkull
+================
+*/
+void() W_FireSkull =
+{
+ local vector dir;
+
+ sound (self, CHAN_WEAPON, "weapons/oddball.wav", 1, ATTN_NORM);
+
+ VK_smallkick(self);
+
+ self.ammo_shells -= 1;
+ W_UpdateAmmoCounts(self);
+
+ dir = aim (self, 100000);
+ FireBullets (1, dir, '0 0 0', MOD_SOLITUDE);
+};
+
+void () Cooldown_Think =
+{
+ local entity oself;
+ oself = self;
+
+ if (self.owner == world || self.owner.classname != "player") {
+ remove(self);
+ return;
+ }
+ if (self.owner.items & WEAPON_PPISTOL) {
+ if (self.owner.exppistol > 0) {
+ self.owner.exppistol -= 1;
+ W_UpdateAmmoCounts(self.owner);
+ }
+ }
+ if (self.owner.items & WEAPON_PRIFLE) {
+ if (self.owner.exprifle > 0) {
+ self.owner.exprifle -= 1;
+ W_UpdateAmmoCounts(self.owner);
+ }
+ }
+
+ self.nextthink = time + .05;
+};
+
+void ( float t_weap, float w_heat ) W_AddHeat =
+{
+ if (self.pp_cooldown == world) {
+ self.pp_cooldown = spawn();
+ self.pp_cooldown.owner = self;
+ self.pp_cooldown.weapon = t_weap;
+ self.pp_cooldown.think = Cooldown_Think;
+ self.pp_cooldown.nextthink = time + .05;
+ }
+
+ switch ( t_weap ) {
+ case WEAPON_PPISTOL:
+ self.exppistol += w_heat;
+ break;
+ case WEAPON_PRIFLE:
+ self.exprifle += w_heat;
+ break;
+ }
+};
+
+void () Plasma_Diffuse =
+{
+ self.velocity = '0 0 0';
+ self.think = SUB_Remove;
+ self.nextthink = time + .3;
+ self.touch = SUB_Null;
+ if (other.classname == "player")
+ {
+ if (other.health >= 30)
+ {
+ particle (self.origin, '0 0 0', 110, 6);
+ particle (self.origin, '0 0 0', 109, 6);
+ }
+ else
+ spawn_touchblood (8);
+ T_Damage (other, self, self.owner, 10*self.health, MOD_SOLITUDE);
+ self.nextthink = time + .15;
+ }
+};
+
+void( float w_heat ) W_FirePPistol =
+{
+ local entity plasma;
+ local float ptake;
+ local vector dir;
+ muzzleflash4();
+ sound (self, CHAN_WEAPON, "weapons/ppist.wav", 1, ATTN_NORM);
+
+ VK_smallkick(self);
+
+ if (w_heat < 3)
+ ptake = 1;
+ else if (w_heat < 7)
+ ptake = 2;
+ else if (w_heat < 12)
+ ptake = 3;
+ else if (w_heat < 15)
+ ptake = 4;
+ else
+ ptake = 6;
+
+ self.ammo_ppistol -= ptake;
+ if (self.ammo_ppistol < 0)
+ self.ammo_ppistol = 0;
+ W_UpdateAmmoCounts(self);
+
+ plasma = spawn ();
+ plasma.health = ptake;
+ plasma.owner = self;
+ plasma.movetype = 9;
+ plasma.solid = 2;
+ makevectors (self.v_angle);
+ plasma.velocity = v_forward;
+ plasma.velocity = (plasma.velocity * 3000); // Note: needs sv_maxvelocity set to something like 10,000 at least!
+ plasma.angles = vectoangles (plasma.velocity);
+ plasma.touch = Plasma_Diffuse;
+ plasma.nextthink = (time + 5);
+ plasma.think = Plasma_Diffuse;
+ setmodel (plasma, "progs/plasma.spr");
+ setsize (plasma, '0 0 0', '0 0 0');
+ setorigin (plasma, ((self.origin + (v_forward * 8)) + '0 0 16')); //setorigin (plasma, ((self.origin + (v_forward * 8)) + '0 0 16'));
+ FireBullets(1, dir, '0.01 0.01 0', MOD_SOLITUDE);
+ if (ptake > 5)
+ ptake = 10;
+
+ W_AddHeat ( self.weapon, ptake * 10);
+};
+
+/*
+==================================
+Fire The Shotgun
+=================================
+*/
+void () W_FireShotgun =
+{
+ local vector dir;
+
+ sound (self, CHAN_WEAPON, "weapons/shottie.wav", 1, ATTN_NORM);
+ muzzleflash3(); // shottie flash
+ //self.punchangle_x = CONTENT_EMPTY;
+ self.ammo_shells2 -= 1;
+ self.currentammo -= 1;
+ W_UpdateAmmoCounts(self);
+ dir = aim (self, 100000);
+ FireBullets (10, dir, '0.15 0.15 0', MOD_SOLITUDE);
+ shotshells(self.origin);
+ pistolsmoke (self.origin + (v_forward * 13) + '0 0 14');
+};
+
+/*
+===============================
+Fire the Assault rifle
+=================================
+*/
+void () W_FireAR =
+{
+ local vector spread;
+ local entity missile;
+ local float r;
+ spread = '0.05 0.05 0.02';
+ r = random();
+ muzzleflash2(); //ar flash
+
+ self.ammo_nails -= 1;
+ W_UpdateAmmoCounts(self);
+ if (r <= 0.5)
+sound (self, CHAN_WEAPON, "weapons/ar1.wav", 1, ATTN_NORM);
+ else if (r <= 1)
+sound (self, CHAN_WEAPON, "weapons/shotgn2.wav", 1, ATTN_NORM);
+ self.punchangle_x = -2;
+
+ missile = spawn ();
+ missile.owner = self;
+ missile.movetype = MOVETYPE_FLYMISSILE;
+ missile.solid = SOLID_BBOX;
+ missile.classname = "AR";
+
+// set missile speed
+
+ makevectors (self.v_angle);
+ missile.velocity = aim(self, 1000);
+ missile.velocity = v_forward + crandom()*spread_x*v_right + crandom()*spread_y*v_up;
+ missile.velocity = missile.velocity * 100000;
+ missile.angles = vectoangles(missile.velocity);
+
+ missile.touch = ARTouch;
+
+// set missile duration
+ missile.nextthink = time + 5;
+ missile.think = SUB_Remove;
+
+ setsize (missile, '0 0 0', '0 0 0');
+ setorigin (missile, self.origin + v_forward*8 + '0 0 16');
+
+};
+
+
+void (float int) W_FireSpikes;
+/*
+====================================
+Fire the SMG
+====================================
+*/
+void() W_FireUzi =
+{
+ local vector dir, spread;
+ local float r;
+ local entity missile;
+ spread = '0.06 0.06 0.02';
+
+ r = random();
+ muzzleflash3();
+ sound (self, CHAN_WEAPON, "weapons/uzi.wav", 1, ATTN_NORM);
+ VK_smallkick(self);
+ self.punchangle_x = CONTENT_EMPTY;
+ self.ammo_hshells -= 1;
+ self.currentammo = self.ammo_hshells;
+ W_UpdateAmmoCounts(self);
+ dir = aim (self, 1000);
+if (r <= 0.33) {
+}
+else if (r <= 0.66) {
+}
+else if (r <= 0.99) {
+shotshells(self.origin);
+}
+else{}
+
+ missile = spawn ();
+ missile.owner = self;
+ missile.movetype = MOVETYPE_FLYMISSILE;
+ missile.solid = SOLID_BBOX;
+ missile.classname = "SMG";
+
+// set missile speed
+
+ makevectors (self.v_angle);
+ missile.velocity = aim(self, 1000);
+ missile.velocity = v_forward + crandom()*spread_x*v_right + crandom()*spread_y*v_up;
+ missile.velocity = missile.velocity * 100000;
+ missile.angles = vectoangles(missile.velocity);
+
+ missile.touch = SMGTouch;
+
+// set missile duration
+ missile.nextthink = time + 5;
+ missile.think = SUB_Remove;
+
+ setsize (missile, '0 0 0', '0 0 0');
+ setorigin (missile, self.origin + v_forward*8 + '0 0 16');
+};
+
+void () W_FireNail2 =
+{
+ local vector dir;
+
+ sound (self, CHAN_WEAPON, "weapons/shotgn2.wav", WEAPON_SHOTGUN, ATTN_NORM);
+ self.punchangle_x = CONTENT_EMPTY;
+ self.ammo_shells2 = (self.ammo_shells2 - WEAPON_SHOTGUN);
+ self.currentammo = (self.ammo_shells2 - WEAPON_SHOTGUN);
+ dir = aim (self, 100000);
+ FireBullets (WEAPON_SHOTGUN, dir, '0.07 0.07 0', MOD_SOLITUDE);
+};
+
+/*
+============================
+What happens when the sniper bullet touches something
+=============================
+*/
+void () SB_Touch =
+{
+ local vector p_a, p_b;
+ local float zdif;
+
+ self.velocity = '0 0 0';
+
+ if (other.takedamage) {
+ p_a_z = self.origin_z;
+ p_b_z = other.origin_z;
+
+ zdif = vlen(p_a - p_b);
+ //_bprint(ftos(zdif),"\n");
+ if (zdif > 20) {
+ T_Damage (other, self, self.owner, 150, MOD_SOLITUDE);
+ centerprint (self, "Headshot!\n"); }
+ else
+ {
+ if (other.health >= 30)
+ {
+ particle (self.origin, '0 0 0', 110, 6);
+ particle (self.origin, '0 0 0', 109, 6);
+ }
+ else
+ spawn_touchblood (8);
+ T_Damage (other, self, self.owner, 70, MOD_SOLITUDE);
+ }
+ }
+ else
+ {
+ particle (self.origin, '0 0 0', 6, 6);
+ particle (self.origin, '0 0 0', 11, 6);
+ puff_org = self.origin;
+ }
+ remove(self);
+};
+
+/*
+====================================
+Fire the Sniper Rifle
+=====================================
+*/
+void() W_FireSniper =
+{
+ local entity fshell;
+
+ sound (self, CHAN_WEAPON, "weapons/sniper.wav", 1, ATTN_NORM);
+
+ VK_bigkick(self);
+ shotshells(self.origin + (v_forward * 13) + '0 0 16');
+ self.ammo_sniper -= 1;
+ W_UpdateAmmoCounts(self);
+
+ muzzleflash2();
+ fshell = spawn ();
+ fshell.owner = self;
+ fshell.movetype = 9;
+ fshell.solid = 2;
+ makevectors (self.v_angle);
+ fshell.velocity = v_forward;
+ fshell.velocity = (fshell.velocity * 999999); // Note: needs sv_maxvelocity set to something like 10,000 at least!
+ fshell.angles = vectoangles (fshell.velocity);
+ fshell.touch = SB_Touch;
+ fshell.nextthink = (time + 5);
+ fshell.think = SUB_Remove;
+ setmodel (fshell, "progs/sniperbullet.mdl");
+ setsize (fshell, '0 0 0', '0 0 0');
+ setorigin (fshell, ((self.origin + (v_forward * 8)) + '0 0 16')); //setorigin (fshell, ((self.origin + (v_forward * 8)) + '0 0 16'));
+ pistolsmoke (self.origin + (v_forward * 13) + '0 0 8');
+};
+
+void () NeedleExplode =
+{
+ self.enemy.needles -= 1;
+ T_Damage (self.enemy, self, self.owner, 4, MOD_SOLITUDE);
+ sound (self, CHAN_WEAPON, "weapons/crystal.wav", 1, ATTN_NORM);
+ particle (self.origin, '6 6 6', 149, 20);
+ particle (self.origin, '12 12 0', 149, 20);
+ particle (self.origin, '-12 -12 0', 149, 20);
+ particle (self.origin, '-6 -6 -6', 149, 20);
+ createpinkdust(self.origin);
+ remove(self);
+};
+
+void () NeedlePreExplode =
+{
+ local vector m_height;
+ m_height_x = self.armorvalue;
+
+ if (self.enemy.health <= 0) {
+ remove(self);
+ return;
+ }
+
+ if (time > self.health) {
+ NeedleExplode();
+ return;
+ }
+
+ self.origin = self.enemy.origin + m_height;
+
+ self.nextthink = time + .02;
+};
+
+void ( entity f_plyr, entity t_plyr, float at_height ) Add_Needle =
+{
+ local entity needle;
+ local float f_p_height;
+ f_p_height = at_height - t_plyr.origin_x;
+
+ if (other == world) {
+ _bprint( "Add_Needle: Cannot assign to world! FIX!!\n");
+ return;
+ }
+
+ if (other.health <= 0)
+ return;
+
+ t_plyr.needles += 1;
+
+ if (t_plyr.needles >= 12) {
+ t_plyr.needles -= 7;
+ sound (self, CHAN_WEAPON, "weapons/crystal.wav", 1, ATTN_NORM);
+ particle (self.origin, '0 0 8', 149, 60);
+ createpinkdust(self.origin);
+ T_Damage (t_plyr, self, f_plyr, 150, MOD_SOLITUDE);
+ remove(self);
+ return;
+ }
+
+ needle = spawn();
+ needle.classname = "needle";
+ needle.touch = SUB_Null;
+ needle.solid = SOLID_NOT;
+ needle.movetype = MOVETYPE_FLY;
+ needle.health = time + 3;
+ needle.armorvalue = f_p_height;
+ needle.enemy = t_plyr;
+ needle.owner = f_plyr;
+ setmodel (needle, "progs/needpro2.mdl");
+ needle.think = NeedlePreExplode;
+ needle.nextthink = time;
+};
+
+
+vector(entity proj) bounce_off_wall = // returns the velocity for bouncing off walls
+{
+ local vector vec;
+ local float backoff, change;
+
+// get the trace_plane_normal of the surface we hit
+ makevectors (proj.angles);
+ v_forward_z = v_forward_z * -1;
+ traceline (proj.origin, proj.origin + v_forward*64, FALSE, proj);
+
+ if (trace_fraction == 1)
+ return proj.velocity;
+
+// the entity's velocity is not what we want, so set default
+ proj.velocity = v_forward * 500;//proj.old_velocity;
+
+// calculate dot product
+ backoff = (proj.velocity * trace_plane_normal);
+ backoff = backoff * 1.5;
+
+// finish
+ change = trace_plane_normal_x * backoff;
+ vec_x = proj.velocity_x - change;
+
+ if (vec_x > -0.1 && vec_x < 0.1)
+ vec_x = 0;
+
+ change = trace_plane_normal_y * backoff;
+ vec_y = proj.velocity_y - change;
+
+ if (vec_y > -0.1 && vec_y < 0.1)
+ vec_y = 0;
+
+ change = trace_plane_normal_z * backoff;
+ vec_z = proj.velocity_z - change;
+
+ if (vec_z > -0.1 && vec_z < 0.1)
+ vec_z = 0;
+ sound (self, CHAN_WEAPON, "weapons/nb.wav", 1, ATTN_NORM);
+// set correct angles of our new velocity
+ proj.angles = vectoangles (vec);
+ // this is required to make downward slopes not stop the projectile
+ proj.flags = proj.flags - ( proj.flags & FL_ONGROUND );
+ return vec;
+}
+
+void () bounce_a =
+{
+ self.velocity = bounce_off_wall( self );
+
+ self.nextthink = (time + 0.2);
+ self.think = NeedlerHome;
+};
+
+void () Bounce_Off_Walls =
+{
+ self.nextthink = time;
+ self.think = bounce_a;
+
+ if (self.velocity == '0 0 0')
+ remove (self);
+};
+
+
+void () Needler_Touch =
+{
+ if (other.takedamage != FALSE && other.health > 0) {
+ T_Damage (other, self, self.owner, 7, MOD_SOLITUDE);
+ Add_Needle(self.owner, other, self.origin_x);
+ }
+ else if (self.lives > 0) {
+ Bounce_Off_Walls ();
+ self.lives -= 1;
+ return;
+ }
+
+ remove(self);
+};
+
+void() NeedlerHome =
+{
+ local vector dir, vtemp, wantdir;
+ local entity te;
+ local float maxmove;
+ maxmove = 55; // maximum xyz value we're allowed to change in mid-air
+
+ if (self.enemy != world && self.enemy.health > 0) {
+ vtemp = (self.enemy.origin + '0 0 10');
+ dir = normalize ((vtemp - self.origin));
+ wantdir = (dir * 550);
+ wantdir_x = wantdir_x - self.velocity_x;
+ if (wantdir_x > maxmove)
+ wantdir_x = maxmove;
+ if (wantdir_x < -maxmove)
+ wantdir_x = -maxmove;
+ wantdir_y = wantdir_y - self.velocity_y;
+ if (wantdir_y > maxmove)
+ wantdir_y = maxmove;
+ if (wantdir_y < -maxmove)
+ wantdir_y = -maxmove;
+ wantdir_z = wantdir_z - self.velocity_z;
+ if (wantdir_z > maxmove)
+ wantdir_z = maxmove;
+ if (wantdir_z < -maxmove)
+ wantdir_z = -maxmove;
+
+
+ self.velocity += wantdir;//(dir * 550);
+ }
+ else {
+ te = findradius(self.origin, 950);
+ while (te)
+ {
+ if ( (te.classname == "player" || te.flags & FL_MONSTER) && te.health > 0 && te != self.owner)
+ {
+ self.enemy = te;
+ //bprint("found enemy!\n");
+ }
+ te = te.chain;
+ }
+ }
+ self.angles = vectoangles (self.velocity);
+
+ self.nextthink = (time + 0.5);
+ self.think = NeedlerHome;
+};
+
+void() W_FireNeedler =
+{
+ local entity fshell;
+ local float r;
+ local vector spread;
+ r = random();
+ muzzleflash6();
+ sound (self, CHAN_WEAPON, "weapons/needler.wav", 1, ATTN_NORM);
+
+ spread = '0.04 0.04 0';
+
+ VK_smallkick(self);
+
+ self.needler_heat += 1;
+ self.ammo_needler -= 1;
+ W_UpdateAmmoCounts(self);
+
+ fshell = spawn ();
+ fshell.owner = self;
+ fshell.movetype = 9;
+ fshell.solid = 2;
+ makevectors (self.v_angle);
+ fshell.velocity = v_forward + crandom()*spread_x*v_right + crandom()*spread_y*v_up;
+ fshell.velocity = (fshell.velocity * 550);
+ fshell.angles = vectoangles (fshell.velocity);
+ fshell.touch = Needler_Touch;
+ fshell.armorvalue = time + 15; // amount of time the needler projectile should stay alive
+ fshell.nextthink = (time + 0.2);
+ fshell.think = NeedlerHome;
+ fshell.lives = 1;
+
+ setmodel (fshell, "progs/needproy.mdl");
+ setsize (fshell, '0 0 0', '0 0 0');
+ setorigin (fshell, ((self.origin + (v_forward * 8)) + '0 0 16')); //setorigin (fshell, ((self.origin + (v_forward * 8)) + '0 0 16'));
+ if (pointcontents(self.origin) == CONTENT_SKY) {
+ remove(self);
+ return;
+ }
+};
+
+void () W_FirePlasmaRifle =
+{
+ local entity plasma;
+ local vector spread;
+ spread = '0.02 0.02 0';
+
+ self.prifle_heat += 1;
+ sound (self, CHAN_WEAPON, "weapons/tink1.wav", 1, ATTN_NORM);
+
+
+ //VK_smallkick(self);
+
+ self.ammo_prifle -= 1;
+ if (self.ammo_prifle < 0)
+ self.ammo_prifle = 0;
+ W_UpdateAmmoCounts(self);
+
+ plasma = spawn ();
+ plasma.health = 1;
+ plasma.owner = self;
+ plasma.movetype = 9;
+ plasma.solid = 2;
+ makevectors (self.v_angle);
+ plasma.velocity = v_forward + crandom()*spread_x*v_right + crandom()*spread_y*v_up;
+ plasma.velocity = (plasma.velocity * 6000); // Note: needs sv_maxvelocity set to something like 10,000 at least!
+ plasma.angles = vectoangles (plasma.velocity);
+ plasma.touch = Plasma_Diffuse;
+ plasma.nextthink = (time + 5);
+ plasma.think = Plasma_Diffuse;
+ setmodel (plasma, "progs/PL_BULL.spr");
+ setsize (plasma, '0 0 0', '0 0 0');
+ setorigin (plasma, ((self.origin + (v_forward * 8)) + '0 0 16')); //setorigin (plasma, ((self.origin + (v_forward * 8)) + '0 0 16'));
+
+ W_AddHeat ( self.weapon, 10);
+};
+
+float(vector veca, vector vecb) crossproduct =
+{
+ local float result;
+ result = veca_x * vecb_y - vecb_x * veca_y;
+ return result;
+};
+
+void () W_Melee =
+{
+ local vector source; local vector org;
+ local vector def;
+
+ makevectors (self.v_angle);
+ source = (self.origin + '0 0 16');
+ traceline (source, (source + (v_forward * IT_LIGHTNING)), FALSE, self);
+ if ((trace_fraction == 1))
+ {
+ self.punchangle_x = -2;
+ return;
+ }
+ self.punchangle_x = CONTENT_SOLID;
+ org = (trace_endpos - (v_forward * 2));
+
+ makevectors (trace_ent.v_angle);
+ def = v_right;
+
+ if (trace_ent.takedamage)
+ {
+ trace_ent.axhitme = 1;
+ SpawnBlood (org, 20);
+
+ makevectors (self.v_angle);
+ if (crossproduct (def, v_forward) > 0)
+ T_Damage (trace_ent, self, self, 100, MOD_SOLITUDE);
+ else
+ T_Damage (trace_ent, self, self, 50, MOD_SOLITUDE);
+ }
+
+};
+
+/*
+==============================================================================
+
+ROCKETS
+
+==============================================================================
+*/
+
+/*
+================
+W_FireRocket
+================
+*/
+void() W_FireRocket =
+{
+
+ local entity missile;
+
+ self.ammo_rockets -= 1;
+ W_UpdateAmmoCounts(self);
+ muzzleflash3();
+ sound (self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM);
+
+ self.punchangle_x = -2;
+
+ missile = spawn ();
+ missile.owner = self;
+ missile.movetype = MOVETYPE_FLYMISSILE;
+ missile.solid = SOLID_BBOX;
+ missile.classname = "Rocket";
+
+// set missile speed
+
+ makevectors (self.v_angle);
+ missile.velocity = aim(self, 1000);
+ missile.velocity = missile.velocity * 1000;
+ missile.angles = vectoangles(missile.velocity);
+
+ missile.touch = Rocket_Explode0;
+
+// set missile duration
+ missile.nextthink = time + 5;
+ missile.think = SUB_Remove;
+
+ setmodel (missile, "progs/missile.mdl");
+ setsize (missile, '0 0 0', '0 0 0');
+ setorigin (missile, self.origin + v_forward*8 + '0 0 16');
+
+};
+
+/*
+===============================================================================
+LIGHTNING
+===============================================================================
+*/
+
+void(entity from, float damage, INTEGER lmod) LightningHit =
+{
+ TE_lightningblood(trace_endpos);
+
+ T_Damage (trace_ent, from, from, damage, lmod);
+};
+
+/*
+=================
+LightningDamage
+=================
+*/
+void(vector p1, vector p2, entity from, float damage, INTEGER lmod) LightningDamage =
+{
+ local entity e1, e2;
+ local vector f;
+
+ f = p2 - p1;
+ f = normalize(f);
+ f_x = 0 - f_y;
+ f_y = f_x;
+ f_z = 0;
+ f = f*16;
+
+ e1 = e2 = world;
+
+ traceline (p1, p2, FALSE, self);
+
+ if (trace_ent.takedamage)
+ LightningHit (from, damage, lmod);
+ e1 = trace_ent;
+
+ traceline (p1 + f, p2 + f, FALSE, self);
+ if (trace_ent != e1 && trace_ent.takedamage)
+ LightningHit (from, damage, lmod);
+ e2 = trace_ent;
+
+ traceline (p1 - f, p2 - f, FALSE, self);
+ if (trace_ent != e1 && trace_ent != e2 && trace_ent.takedamage)
+ LightningHit (from, damage, lmod);
+};
+
+
+void() W_FireLightning =
+{
+ local vector org;
+ local float cells;
+ local INTEGER expmod;
+
+ if (self.ammo_cells_real < 1)
+ {
+ W_WeaponSwitch (W_BestWeapon ());
+ return;
+ }
+
+// explode if under water
+ if (self.waterlevel > 1)
+ {
+ if (deathmatch > 3)
+ {
+ if (random() <= 0.5)
+ {
+ T_Damage (self, self, self.owner, 4000, MOD_SELFWATER);
+ return;
+ }
+ }
+
+ cells = self.ammo_cells_real;
+ self.ammo_cells_real = 0;
+ W_WeaponSwitch (W_BestWeapon ());
+ expmod = MOD_SHAFTWATER;
+ if (self.watertype == CONTENT_SLIME)
+ expmod = MOD_SHAFTSLIME;
+ else if (self.watertype == CONTENT_LAVA)
+ expmod = MOD_SHAFTLAVA;
+ T_RadiusDamage (self, self, 35*cells, 40+35*cells, world, expmod);
+ return;
+ }
+
+ if (self.lightning_sound < time)
+ {
+ sound (self, CHAN_WEAPON, "weapons/lhit.wav", 1, ATTN_NORM);
+ self.lightning_sound = time + 0.6;
+ }
+ VK_smallkick(self);
+
+ if (deathmatch != 4)
+ {
+ self.ammo_cells_real -= 1;
+ W_UpdateAmmoCounts(self);
+ }
+
+ org = self.origin + '0 0 16';
+
+ traceline (org, org + v_forward*600, TRUE, self);
+
+ TE_lightning2(self, org, trace_endpos);
+
+ LightningDamage (self.origin, trace_endpos + v_forward*4, self, 30, MOD_SHAFT);
+};
+
+void () GrenadeExplode =
+{
+ if (self.selnade == GRENADE_REGULAR)
+ CreateExplosion(self.origin);
+
+ else {
+ plasmaexplo(self.origin);
+ sound (self, CHAN_WEAPON, "weapons/plasma_blow.wav", 1, ATTN_NORM);
+ }
+
+ T_RadiusDamage (self, self.owner, 190, 160, world, MOD_SOLITUDE);
+
+ remove(self);
+};
+
+void () Stick =
+{
+ if (((self.enemy != world) && (self.enemy.health > 1)))
+ {
+ self.think = Stick;
+ self.touch = Stick;
+ self.origin = self.enemy.origin;
+ }
+ else
+ {
+ GrenadeExplode ();
+ return;
+ }
+ self.exshells = (self.exshells + 1);
+ if ((self.exshells > 15))
+ {
+ GrenadeExplode ();
+ return;
+ }
+ self.nextthink = (time + 0.1);
+};
+void () StickyTouch =
+{
+ if (((other == self.owner) || (other == world)))
+ {
+ return;
+ }
+ self.exshells = MSG_BROADCAST;
+ self.movetype = MOVETYPE_NOCLIP;
+ self.think = Stick;
+ self.touch = Stick;
+ self.nextthink = (time + 0.1);
+ self.avelocity = VEC_ORIGIN;
+ self.velocity = VEC_ORIGIN;
+ self.enemy = other;
+};
+
+float (entity p1, entity p2) Get_ZDiff =
+{
+ local vector p_a, p_b;
+ local float zdif;
+
+ p_a_z = p1.origin_z;
+
+ p_b_z = p2.origin_z;
+
+ zdif = vlen(p_a - p_b);
+
+ return (zdif);
+}
+
+void () StickyNade_Stick =
+{
+ local vector zd;
+
+ if (self.enemy != world && self.enemy.health > 0) {
+ zd_z = self.armorvalue;
+
+ self.origin = self.enemy.origin + zd;
+ }
+
+ if (self.weapon < time) {
+ GrenadeExplode();
+ return;
+ }
+
+ self.nextthink = time + 0.1;
+};
+
+void () GrenadeBounce =
+{
+ local vector spot1;
+ local vector spot2;
+
+ if (self.selnade == GRENADE_STICKY)
+ {
+ if ((pointcontents (self.origin) == -6.000000))
+ {
+ remove (self);
+ return;
+ }
+ if (other.takedamage)
+ {
+ if (other.origin != '0 0 0') {
+ self.armorvalue = Get_ZDiff( self, other );
+ self.weapon = self.nextthink;
+ self.think = StickyNade_Stick;
+ self.enemy = other;
+ self.nextthink = time;
+ }
+ else {
+ sound (self, 1, "effects/bodyhit2.wav", 1, 1);
+ }
+ return;
+ }
+ if (other.speed)
+ {
+ sound (self, 1, "weapons/bounce.wav", 1, 1);
+ return;
+ }
+ else
+ {
+ if (self.selnade == GRENADE_REGULAR)
+ sound (self, 1, "weapons/bounce.wav", 1, 1);
+ else
+ sound (self, 1, "weapons/pbounce.wav", 1, 1);
+ self.movetype = 0.000000;
+// self.solid = 0.000000;
+ self.solid = 2.000000; // so they can be EMP'd
+ spot1 = self.origin - (normalize (self.velocity) * 20.000000);
+ spot2 = self.origin + (normalize (self.velocity) * 20.000000);
+ traceline (spot1, spot2, 0.000000, self);
+ self.angles = (vectoangles (trace_plane_normal) + '90.000000 0.000000 0.000000');
+ setorigin (self, (self.origin + (trace_plane_normal * 6.000000)));
+ }
+ }
+ else
+ {
+ sound (self, 1.000000, "weapons/bounce.wav", 1.000000, 1.000000);
+ }
+ if ((self.velocity == '0.000000 0.000000 0.000000'))
+ {
+ self.avelocity = '0.000000 0.000000 0.000000';
+ }
+ self.nextthink = (time + 1.5);
+ self.think = GrenadeExplode;
+};
+void () W_ThrowGrenade =
+{
+ local entity missile;
+ //local entity mpuff;
+ local float vel_up;
+ if (self.selnade == GRENADE_REGULAR)
+ sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
+ else
+ sound (self, CHAN_WEAPON, "weapons/plasma_throw.wav", 1, ATTN_NORM);
+ missile = spawn ();
+ missile.owner = self;
+ missile.movetype = MOVETYPE_BOUNCE;
+ missile.solid = SOLID_BBOX;
+ missile.classname = "grenade";
+ makevectors (self.v_angle);
+ // looking straight up, don't do "up" velocity
+ if (self.v_angle_x <= -80)
+ vel_up = 150 + (self.v_angle_x * 2);
+ else
+ vel_up = 130;
+
+ missile.velocity = (v_forward * 320) + (v_up * vel_up) + (v_right * 5);
+
+ missile.avelocity = '300 300 300'; // FIXME: position your grenade model properly! it orbits instead of spinning!
+ missile.angles = vectoangles (missile.velocity);
+ missile.selnade = self.selnade;
+ missile.touch = GrenadeBounce;
+ //missile.nextthink = (time + 1.5);
+ //missile.think = GrenadeExplode;
+ if (self.selnade == GRENADE_STICKY)
+ setmodel (missile, "progs/plasgren.mdl");
+ else
+ setmodel (missile, "progs/fraggren.mdl");
+
+ setsize (missile, VEC_ORIGIN, VEC_ORIGIN);
+ setorigin (missile, ((self.origin + '0 0 16') + (v_right * CONTENT_SKY)));
+};
+
+//=============================================================================
+void(float ox) W_FireSpikes =
+{
+ if (self.ammo_nails_real < 1)
+ {
+ W_WeaponSwitch (W_BestWeapon ());
+ return;
+ }
+
+ sound (self, CHAN_WEAPON, "weapons/rocket1i.wav", 1, ATTN_NORM);
+ if (deathmatch != 4)
+ {
+ self.ammo_nails_real -= 1;
+ W_UpdateAmmoCounts(self);
+ }
+
+ VK_smallkick(self);
+ PRJ_FireProjectile(self,
+ "progs/spike.mdl",
+ self.origin + '0 0 16' + v_right*ox,
+ aim(self, 1000) * 1000,
+ PE_SPIKE,
+ 9,
+ MOD_SPIKE,
+ 6);
+};
+
+void() W_FireSuperSpikes22 =
+{
+ if (self.ammo_nails_real < 2)
+ {
+ W_FireSpikes(0);
+ return;
+ }
+
+ sound (self, CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM);
+ if (deathmatch != 4)
+ {
+ //self.ammo_nails_real -= 2;
+ self.ammo_hshells -= 2;
+ W_UpdateAmmoCounts(self);
+ }
+
+ VK_smallkick(self);
+ PRJ_FireProjectile(self,
+ "progs/s_spike.mdl",
+ self.origin + '0 0 16',
+ aim(self, 1000) * 1000,
+ PE_SUPERSPIKE,
+ 18,
+ MOD_SUPERSPIKE,
+ 6);
+};
+
+/*
+===============================================================================
+
+PLAYER WEAPON USE
+
+===============================================================================
+*/
+// different from W_CheckNoAmmo due to SSG/SNG being able to fire 1 shot instead of 2...
+BOOL(float wep) W_HasAmmo =
+{
+ switch (wep)
+ {
+ case IT_SHOTGUN:
+ return self.ammo_shells_real >= 1;
+ case IT_SUPER_SHOTGUN:
+ return self.ammo_shells_real >= 2;
+ case IT_NAILGUN:
+ return self.ammo_nails_real >= 1;
+ case IT_SUPER_NAILGUN:
+ return self.ammo_nails_real >= 2;
+ case IT_GRENADE_LAUNCHER:
+ case IT_ROCKET_LAUNCHER:
+ return self.ammo_rockets_real >= 1;
+ case IT_LIGHTNING:
+ return self.ammo_cells_real >= 1;
+ }
+
+ return TRUE;
+};
+
+void() W_UpdateWeapon =
+{
+ player_run (); // get out of any weapon firing states
+
+ self.items = self.items - ( self.items & (IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS) );
+
+ switch (self.weapon)
+ {
+ case WEAPON_PISTOL:
+ self.weaponmodel = "progs/v_shot.mdl";
+ self.items = self.items | IT_SHELLS;
+ self.ammo_type = AT_SHELLS;
+ break;
+ case WEAPON_SKULL:
+ self.weaponmodel = "GameTypes/OddBall/v_skull.mdl";
+ self.items = self.items | IT_SHELLS;
+ self.ammo_type = AT_SHELLS;
+ break;
+ case WEAPON_SHOT:
+ self.weaponmodel = "progs/v_shot2.mdl";
+ self.items = self.items | IT_SHELLS;
+ self.ammo_type = AT_SHELLS;
+ break;
+ case WEAPON_AR:
+ self.weaponmodel = "progs/v_nail.mdl";
+ self.items = self.items | IT_NAILS;
+ self.ammo_type = AT_NAILS;
+ break;
+ case WEAPON_UZI:
+ self.weaponmodel = "progs/v_uzi.mdl";
+ self.items = self.items | IT_NAILS;
+ self.ammo_type = AT_NAILS; // solitude: ammo_hshells
+ break;
+ case WEAPON_SNIPER:
+ self.weaponmodel = "progs/v_sniper.mdl";
+ self.items = self.items | IT_SHELLS;
+ self.ammo_type = AT_SHELLS;
+ break;
+ case WEAPON_RL:
+ self.weaponmodel = "progs/v_rocket.mdl";
+ self.items = self.items | IT_ROCKETS;
+ self.ammo_type = AT_ROCKETS;
+ break;
+ case WEAPON_PPISTOL:
+ self.weaponmodel = "progs/v_plpist.mdl";
+ self.items = self.items | IT_CELLS;
+ self.ammo_type = AT_CELLS;
+ break;
+ case WEAPON_SWORD:
+ self.weaponmodel = "progs/v_axe.mdl";
+ self.items = self.items | IT_CELLS;
+ self.ammo_type = AT_CELLS;
+ break;
+ case WEAPON_NEEDLER:
+ self.weaponmodel = "progs/v_needle.mdl";
+ self.items = self.items | IT_CELLS;
+ self.ammo_type = AT_CELLS;
+ break;
+ case WEAPON_PRIFLE:
+ self.weaponmodel = "progs/v_plrifle.mdl";
+ self.items = self.items | IT_CELLS;
+ self.ammo_type = AT_CELLS;
+ break;
+ default:
+ self.weaponmodel = "";
+ }
+
+ self.weaponframe = 0;
+};
+
+void(float weap) W_WeaponSwitch =
+{
+ if (self.weaponmodel != "" && self.weaponframe > 0 && self.weaponframe < 4) // xavior: hackish - may need other checks in the future (frames 1 - 4 are generally firing frames)
+ return;
+
+ // skip weapon model/ammo_type update if this isn't a new weapon
+ if (self.weapon != weap)
+ {
+ self.weapon = weap;
+ W_UpdateWeapon();
+ }
+
+ // always update ammo count
+ W_UpdateAmmoCounts(self);
+
+ Set_FOV ( FOV_DEFAULT );
+ self.pfov = FOV_DEFAULT;
+};
+
+float() W_BestWeapon =
+{
+ float fl;
+
+ if (cvar("nobest") == 0) // solitude: debug
+ return (self.weapon);
+
+ if (self.waterlevel <= 1)
+ fl = IT_LIGHTNING;
+ else
+ fl = IT_SUPER_NAILGUN;
+
+ while (1)
+ {
+ if ( (self.items & fl) && W_HasAmmo(fl) )
+ return fl;
+
+ // best weapon order
+ switch (fl)
+ {
+ case IT_SKULL:
+ fl = IT_LIGHTNING;
+ break;
+ case IT_LIGHTNING:
+ fl = IT_SUPER_NAILGUN;
+ break;
+ case IT_SUPER_NAILGUN:
+ fl = IT_SUPER_SHOTGUN;
+ break;
+ case IT_SUPER_SHOTGUN:
+ fl = IT_NAILGUN;
+ break;
+ case IT_NAILGUN:
+ fl = IT_SHOTGUN;
+ break;
+ case IT_SHOTGUN:
+ default:
+ return IT_AXE; // so we don't get an infinite loop with certain engines
+ }
+ }
+};
+
+BOOL() W_CheckNoAmmo =
+{
+ if (self.currentammo > 0)
+ return TRUE;
+
+ if (self.weapon == IT_AXE)
+ return TRUE;
+
+ W_WeaponSwitch (W_BestWeapon ());
+
+// drop the weapon down
+ return FALSE;
+};
+
+/*
+============
+W_Attack
+
+An attack impulse can be triggered now
+============
+*/
+void() player_shot1;
+
+// Solitude stuff
+void () player_hshot;
+void () player_hshot_melee;
+void () player_uzi_reload;
+void () player_shot_melee;
+void () player_shot2_melee;
+void () player_nail_melee;
+void () player_shot_throw;
+void () player_shot2_throw;
+void () player_nail_throw;
+
+void () player_rl_reload;
+void () player_rl_throw;
+void () player_rl_melee;
+
+void () player_uzi_throw;
+
+void () player_sniper_melee;
+void () player_sniper_throw;
+
+//void() player_nail1;
+void() player_nail2;
+void() muzzleflash;
+
+void() W_Attack =
+{
+ float r;
+ local float heat_multi, i;
+ local vector source;
+
+ if (!W_CanFire (self)) {
+ if (self.currentammo == 0) {
+ if (self.reload_time > time)
+ return;
+ reload ();
+ if (self.needler_heat > 0)
+ self.needler_heat = 0;
+ if (self.prifle_heat > 0)
+ self.prifle_heat = 0;
+ }
+ return;
+ }
+
+ makevectors (self.v_angle); // calculate forward angle for velocity
+ self.show_hostile = time + 1; // wake monsters up
+
+ if (self.weaponstate == WS_IDLE) // start delay
+ self.delay = time + 0.1;
+
+ // animations are dealt with here
+ switch (self.weapon)
+ {
+ case WEAPON_PISTOL:
+ muzzleflash();
+ //_bprint(ftos(self.weaponframe), "\n");
+ self.weaponframe = 1;
+ self.wepanim = 1;
+ self.weaponframe_time = time + 0.1;
+ break;
+ case IT_SKULL:
+ muzzleflash();
+ self.weaponframe = 1;
+ self.wepanim = 1;
+ break;
+ case IT_NAILGUN:
+ muzzleflash();
+ self.weaponframe = 1;
+ self.wepanim = 1;
+ break;
+ case IT_SUPER_NAILGUN:
+ self.weaponframe = WEAPON_SHOTGUN;
+ player_nail2();
+ /*
+ muzzleflash();
+ if (self.weaponframe == 0)
+ self.weaponframe = 1;
+
+ if (self.weaponframe & 1)
+ player_nail1();
+ else
+ player_nail2();
+ break;
+ */
+ case IT_GRENADE_LAUNCHER:
+ case IT_ROCKET_LAUNCHER:
+ self.weaponframe = 1;
+ muzzleflash();
+ //player_rocket1();
+ break;
+ case WEAPON_PPISTOL:
+ heat_multi = 1;
+
+ i = 0;
+ while (i < 8) {
+ i++;
+ if (self.weaponheat < i*heat_multi) {
+ self.weaponframe = 4 + i;
+ break;
+ }
+ }
+
+ self.weaponheat++;
+ if (i >= 8) {
+ if (self.weaponframe > 13)
+ self.weaponframe = 12;
+ else
+ self.weaponframe++;
+ }
+
+ if (self.weaponheat > 14)
+ self.weaponheat = 15;
+ if (!self.button0 || self.weaponheat > 15) {
+ muzzleflash();
+ W_FirePPistol ( self.weaponheat );
+ self.weaponheat = 0;
+ self.weaponframe_time = time + 0.1;
+
+ if (self.exppistol >= 100) {
+ self.wepanim = 0;
+ self.exppistol = 99;
+ W_UpdateAmmoCounts(self);
+ self.weaponframe = 16;
+ player_reload1();
+ }
+ else {
+ self.weaponframe = 1;
+ self.wepanim = 1;
+ }
+ }
+ else
+ self.weaponframe_time = time + 0.2;
+
+ break;
+ case WEAPON_SWORD:
+ // See if we should perform a lunge
+ makevectors (self.v_angle);
+ source = self.origin + '0 0 16';
+ traceline (source, source + v_forward*120, FALSE, self);
+
+ if (trace_ent.classname == "player" && trace_ent.health > 0) {
+ self.weaponframe = 9;
+ self.velocity = v_forward*620;
+ }
+ else {
+ r = random();
+
+ if (r < 0.5)
+ self.weaponframe = 19;
+ else
+ self.weaponframe = 26;
+ }
+ self.wepanim = 1;
+ self.weaponframe_time = time + 0.1;
+ break;
+ case WEAPON_PRIFLE:
+ muzzleflash();
+ self.weaponframe = 1;
+ self.wepanim = 1;
+ self.weaponframe_time = time + 0.065;
+ break;
+ case WEAPON_PISTOL:
+ muzzleflash();
+ self.weaponframe = 1;
+ self.wepanim = 1;
+ self.weaponframe_time = time + 0.1;
+ break;
+ case WEAPON_SKULL:
+ muzzleflash();
+ self.weaponframe = 1;
+ self.wepanim = 1;
+ self.weaponframe_time = time + 0.1;
+ break;
+ default:
+ muzzleflash();
+ self.weaponframe = 1;
+ self.wepanim = 1;
+ self.weaponframe_time = time + 0.1;
+ break;
+ }
+
+ SuperDamageSound();
+
+ // firing is done here (r is used for round time instead of a temp here)
+ switch (self.weapon)
+ {
+ case WEAPON_PISTOL:
+ W_FirePistol ();
+ r = 0.3;
+ break;
+ case WEAPON_SKULL:
+ W_FireSkull ();
+ r = 0.3;
+ break;
+ case WEAPON_SHOT:
+ W_FireShotgun ();
+ r = 0.65;
+ break;
+ case WEAPON_AR:
+ W_FireAR();
+ r = 0.11;
+ break;
+ case WEAPON_RL:
+ W_FireRocket();
+ r = 1.6;
+ break;
+ case WEAPON_UZI:
+ W_FireUzi();
+ r = 0.06;
+ break;
+ case WEAPON_SNIPER:
+ W_FireSniper();
+ r = 0.8;
+ break;
+ case WEAPON_PPISTOL:
+ //W_FirePPistol();
+ r = 0.15;
+ break;
+ case WEAPON_SWORD:
+ //W_FireSword(0);
+ r = 0.6;
+ break;
+ case WEAPON_NEEDLER:
+ W_FireNeedler();
+ if (self.needler_heat > 10)
+ r = 0.07;
+ else if (self.needler_heat > 5)
+ r = 0.12;
+ else
+ r = 0.17;
+ break;
+ case WEAPON_PRIFLE:
+ W_FirePlasmaRifle();
+ if (self.prifle_heat > 8)
+ r = 0.125;
+ else if (self.prifle_heat > 3)
+ r = 0.15;
+ else
+ r = 0.175;
+ break;
+ }
+
+
+ if (self.weaponstate == WS_IDLE)
+ self.weaponstate = WS_FIRING1;
+
+ // advance attack time
+ if (self.attack_finished <= time)
+ self.attack_finished = self.attack_finished + r;
+
+ // Frikbot - reloading
+ if (self.ishuman != TRUE) {
+ //_bprint(ftos(self.currentammo),"\n");
+ if (self.currentammo <= 0) {
+ reload ();
+ self.currentammo = 1; // so he doesn't run to the player
+ return;
+ }
+ }
+};
+
+/*
+============
+W_ChangeWeapon
+
+============
+*/
+void() W_ChangeWeapon =
+{
+ local float fl;
+
+ switch (self.impulse)
+ {
+ case 1:
+ fl = IT_AXE;
+ break;
+ case 2:
+ fl = IT_SHOTGUN;
+ break;
+ case 3:
+ fl = IT_SUPER_SHOTGUN;
+ break;
+ case 4:
+ fl = IT_NAILGUN;
+ break;
+ case 5:
+ fl = IT_SUPER_NAILGUN;
+ break;
+ case 6:
+ fl = IT_GRENADE_LAUNCHER;
+ break;
+ case 7:
+ fl = IT_ROCKET_LAUNCHER;
+ break;
+ case 8:
+ fl = IT_LIGHTNING;
+ break;
+ }
+
+
+ if (!(self.items & fl))
+ { // don't have the weapon or the ammo
+ sprint1 (self, PRINT_HIGH, "no weapon.\n");
+ return;
+ }
+
+/* if (!W_HasAmmo(fl))
+ { // don't have the ammo
+ sprint1 (self, PRINT_HIGH, "not enough ammo.\n");
+ return;
+ }*/
+
+//
+// set weapon, set ammo
+//
+ W_WeaponSwitch (fl);
+};
+
+/*
+============
+CheatCommand
+============
+*/
+void() CheatCommand =
+{
+ if (deathmatch || coop)
+ return;
+
+#ifndef IMPULSE9
+ bprint("Impulse 9 disabled. Use Impulses 14 through 26 to spawn all weapons.\n");
+#else
+ self.ammo_rockets_real = 100;
+ self.ammo_nails_real = 200;
+ self.ammo_shells_real = 100;
+ self.ammo_cells_real = 100;
+ self.items |= IT_AXE |
+ IT_SHOTGUN |
+ IT_SUPER_SHOTGUN |
+ IT_NAILGUN |
+ IT_SUPER_NAILGUN |
+ IT_GRENADE_LAUNCHER |
+ IT_ROCKET_LAUNCHER |
+ IT_LIGHTNING |
+ IT_AXE |
+ WEAPON_NEEDLER |
+ WEAPON_PRIFLE |
+ WEAPON_SKULL |
+ IT_KEY1 | IT_KEY2;
+ W_WeaponSwitch (IT_ROCKET_LAUNCHER);
+#endif
+};
+
+/*
+============
+CycleWeaponCommand
+
+Go to the next weapon with ammo
+============
+*/
+void() CycleWeaponCommand =
+{
+ local float w;
+ w = self.weapon;
+
+ while (1)
+ {
+ switch (w)
+ {
+ case IT_LIGHTNING:
+ w = IT_AXE;
+ break;
+ case IT_AXE:
+ w = IT_SHOTGUN;
+ break;
+ case IT_SHOTGUN:
+ w = IT_SUPER_SHOTGUN;
+ break;
+ case IT_SUPER_SHOTGUN:
+ w = IT_NAILGUN;
+ break;
+ case IT_NAILGUN:
+ w = IT_SUPER_NAILGUN;
+ break;
+ case IT_SUPER_NAILGUN:
+ w = IT_GRENADE_LAUNCHER;
+ break;
+ case IT_GRENADE_LAUNCHER:
+ w = IT_ROCKET_LAUNCHER;
+ break;
+ case IT_ROCKET_LAUNCHER:
+ w = WEAPON_NEEDLER;
+ break;
+ case WEAPON_NEEDLER:
+ w = WEAPON_PRIFLE;
+ break;
+ case WEAPON_PRIFLE:
+ w = WEAPON_SKULL;
+ break;
+ case WEAPON_SKULL:
+ w = IT_LIGHTNING;
+ break;
+ }
+
+ if ( (self.items & w) /*&& W_HasAmmo(w)*/ )
+ {
+ W_WeaponSwitch (w);
+ return;
+ }
+ }
+
+};
+
+
+/*
+============
+CycleWeaponReverseCommand
+
+Go to the prev weapon with ammo
+============
+*/
+void() CycleWeaponReverseCommand =
+{
+ local float w;
+ w = self.weapon;
+
+ while (1)
+ {
+ switch (w)
+ {
+ case IT_LIGHTNING:
+ w = IT_ROCKET_LAUNCHER;
+ break;
+ case IT_ROCKET_LAUNCHER:
+ w = IT_GRENADE_LAUNCHER;
+ break;
+ case IT_GRENADE_LAUNCHER:
+ w = IT_SUPER_NAILGUN;
+ break;
+ case IT_SUPER_NAILGUN:
+ w = IT_NAILGUN;
+ break;
+ case IT_NAILGUN:
+ w = IT_SUPER_SHOTGUN;
+ break;
+ case IT_SUPER_SHOTGUN:
+ w = IT_SHOTGUN;
+ break;
+ case IT_SHOTGUN:
+ w = IT_AXE;
+ break;
+ case IT_AXE:
+ w = IT_LIGHTNING;
+ break;
+ }
+
+ if ( (self.items & w) && W_HasAmmo(w) )
+ {
+ W_WeaponSwitch (w);
+ return;
+ }
+ }
+
+};
+
+
+/*
+============
+ServerflagsCommand
+
+Just for development
+============
+*/
+void() ServerflagsCommand =
+{
+ if (deathmatch || coop)
+ return;
+
+ serverflags = serverflags * 2 + 1;
+};
+
+// self heal
+void () Heal =
+{
+if (self.health >= 120)
+particle (self.origin, '0 0 15',110, 10);
+else
+particle (self.origin, '0 0 10', 110, 1);
+ self.health = (self.health + 0.5);
+};
+
+// Solitude Reload
+void () reload =
+{
+ if (self.reload_time > time)
+ return;
+ if ( (self.weapon == WEAPON_SHOT) && (self.weaponframe != 0) )
+ return;
+ if (self.armorvalue > 0 && self.currentammo != W_GetMaxClip(self.weapon, 1)) {
+ switch (self.weapon) {
+ case WEAPON_PISTOL:
+ {
+ sound (self, CHAN_WEAPON, "weapons/reload/pistol.wav", 1, ATTN_NORM);
+ self.weaponframe = WEAPON_BIG;
+ break;
+ }
+ case WEAPON_SHOT:
+ {
+ sound (self, CHAN_WEAPON, "weapons/reload/shottie.wav", 1, ATTN_NORM);
+ self.weaponframe = 10;
+ break;
+ }
+ case WEAPON_AR:
+ {
+ sound (self, CHAN_WEAPON, "weapons/reload/ar.wav", 1, ATTN_NORM);
+ self.weaponframe = 5;
+ break;
+ }
+ case WEAPON_SNIPER:
+ {
+ sound (self, CHAN_WEAPON, "weapons/reload/sniper.wav", 1, ATTN_NORM);
+ self.weaponframe = 7;
+ break;
+ }
+ case WEAPON_RL:
+ {
+ sound (self, CHAN_WEAPON, "weapons/reload/rocket.wav", 1, ATTN_NORM);
+ self.weaponframe = 11;
+ break;
+ }
+ case WEAPON_NEEDLER:
+ {
+ sound (self, CHAN_WEAPON, "weapons/reload/needler.wav", 1, ATTN_NORM);
+ self.weaponframe = 5;
+ break;
+ }
+ case WEAPON_PPISTOL:
+ {
+ return; // No manual reload
+ }
+ default:
+ {
+ sound (self, CHAN_WEAPON, "weapons/reload/uzi.wav", 1, ATTN_NORM);
+ self.weaponframe = 4;
+ break;
+ }
+ }
+ self.attack_finished = (time + 0.2);
+ player_reload1 (); // now that we set the start frame, begin the reload
+ }
+};
+
+/*
+============
+ImpulseCommands
+
+============
+*/
+void() ImpulseCommands =
+{
+ if (self.impulse == 106)
+ {
+ if (self.crouch == 0)
+ {
+ self.crouch = 1;
+ setsize (self, '-16 -16 -24', '16 16 0');
+ self.view_ofs = '0 0 10';
+ stuffcmd(self,"cl_forwardspeed 100 \n");
+ stuffcmd(self,"cl_backspeed 90 \n");
+ stuffcmd(self,"cl_sidespeed 100 \n");
+ }
+ else if (self.crouch== 1)
+ {
+ self.crouch= 0;
+ setsize (self, '-16 -16 -24', '16 16 32');
+ self.view_ofs = '0 0 22';
+ stuffcmd(self,"cl_forwardspeed 200 \n");
+ stuffcmd(self,"cl_backspeed 200 \n");
+ stuffcmd(self,"cl_sidespeed 200 \n");
+ player_stand1 ();
+ }
+ }
+ if (self.weaponheat)
+ return;
+
+ switch (self.impulse) {
+ case 1 .. 8:
+ W_ChangeWeapon ();
+ break;
+ case 9:
+ CheatCommand ();
+ break;
+ case 10:
+ CycleWeaponCommand();
+ player_pull();
+ break;
+ case 11:
+ WeaponZoom ();
+ break;
+ case 13:
+ W_UpdateAmmoCounts(self);
+ if (self.pickup_time > time) {
+ self.canpickup_time = time + .1;
+ return;
+ }
+ if (self.pickup_time > time) {
+ self.canpickup_time = time + .1;
+ return;
+ }
+// if (time < self.attack_finished)
+// return;
+ Set_FOV ( FOV_DEFAULT );
+ self.pfov = FOV_DEFAULT;
+ reload ();
+ break;
+ case 14:
+ ThrowWeapon(WEAPON_PISTOL, 0);
+ break;
+ case 30:
+ ThrowWeapon(WEAPON_SKULL, 0);
+ break;
+ case 15:
+ ThrowWeapon(WEAPON_SHOT, 0);
+ break;
+ case 16:
+ ThrowWeapon(WEAPON_AR, 0);
+ break;
+ case 17:
+ ThrowWeapon(WEAPON_UZI, 0);
+ break;
+ case 18:
+ ThrowWeapon(WEAPON_RL, 0);
+ break;
+ case 19:
+ ThrowWeapon(WEAPON_SNIPER, 0);
+ break;
+ case 20:
+ ThrowWeapon(WEAPON_PPISTOL, 0);
+ break;
+ case 21:
+ ThrowWeapon(WEAPON_SWORD, 0);
+ break;
+ case 22:
+ ThrowWeapon(WEAPON_NEEDLER, 0);
+ break;
+ case 23:
+ ThrowWeapon(WEAPON_PRIFLE, 0);
+ break;
+ case 25:
+ ThrowWeapon(666, 0);
+ break;
+ case 26:
+ ThrowWeapon(667, 0);
+ break;
+ case 50:
+ stuffcmd( self, "play sound/music/Solitude_MainTheme_Low.wav\n" );
+ break;
+ case 29:
+ {
+ Set_FOV ( FOV_DEFAULT );
+ self.pfov = FOV_DEFAULT;
+ pre_player_melee ();
+ break;
+ }
+ case 29:
+ {
+ Set_FOV ( FOV_DEFAULT );
+ self.pfov = FOV_DEFAULT;
+ pre_player_melee ();
+ break;
+ }
+ case 27:
+ {
+ if (self.selnade == 1)
+ {
+ if (self.nade_lives <= 0)
+ return;
+ self.nade_lives = self.nade_lives;
+ self.selnade = 0;
+ NadeCounter();
+ sound (self, CHAN_WEAPON, "weapons/grenpick.wav", 1, ATTN_NORM);
+
+ }
+ else
+ {
+ if (self.selnade == 0)
+ {
+ if (self.plasma_lives <= 0)
+ return;
+ self.plasma_lives = self.plasma_lives;
+ self.selnade = 1;
+ NadeCounter();
+ sound (self, CHAN_WEAPON, "weapons/pbounce.wav", 1, ATTN_NORM);
+ }
+ }
+ break;
+ }
+ case 28: //Limiter for stopping a Nade throw if you don't have enough nades.
+ {
+ Set_FOV ( FOV_DEFAULT );
+ self.pfov = FOV_DEFAULT;
+ if (self.selnade == GRENADE_REGULAR)
+ {
+ if (self.nade_lives > 0)
+ {
+ pre_player_throw_grenade ();
+ self.nade_lives -= 1;
+ NadeCounter();
+ return;
+ }
+ else
+ centerprint (self, "No Grenades\n");
+ }
+ else
+ {
+ if (self.plasma_lives > 0) {
+ pre_player_throw_grenade ();
+ self.plasma_lives -= 1;
+ NadeCounter();
+ return; }
+ else
+ centerprint (self, "No Plasma Grenades\n");
+ }
+ break;
+ }
+ }
+
+
+ self.impulse = 0;
+};
+
+/*
+============
+W_HandlePlayerFrame
+
+Handle player weapon model
+============
+*/
+// ADDME: This function is actually very useful, but my lazy self is not making full use out of it.
+// what shoudl be done in the future is allow this function to handle ALL first-person weapon anims
+// including melee, throwgren, fire, etc. Right now it only handles a few weapons firing. The rest
+// is done in player.qc >.<
+// - avirox
+void() W_HandlePlayerFrame =
+{
+ if (!self.weaponframe && !self.wepanim)
+ return;
+
+ if (self.weaponframe_time >= time)
+ return;
+
+ switch (self.weapon)
+ {
+ case WEAPON_PISTOL:
+ if (self.weaponframe > 3) // assume that we're not firing and that animations should be handled in player.qc or elsewhere
+ return;
+ self.weaponframe = self.weaponframe + 1;
+ self.weaponframe_time = time + 0.1;
+ if (self.weaponframe > 3)
+ self.weaponframe = 0;
+
+ //_bprint(ftos(self.weaponframe),"\n");
+ break;
+ case WEAPON_SKULL:
+ self.wepanim = 0; // No Current Animations
+ self.weaponframe = self.weaponframe + 1;
+ self.weaponframe_time = time + 0.1;
+ if (self.weaponframe > 16)
+ self.weaponframe = 0;
+ break;
+ case WEAPON_SHOT:
+ if (self.weaponframe > 9) // assume that we're not firing and that animations should be handled in player.qc or elsewhere
+ return;
+ self.weaponframe = self.weaponframe + 1;
+ self.weaponframe_time = time + 0.1;
+ if (self.weaponframe > 9)
+ self.weaponframe = 0;
+
+ //_bprint(ftos(self.weaponframe),"\n");
+ break;
+ case WEAPON_AR:
+ if (self.weaponframe > 3)
+ return;
+ self.weaponframe = self.weaponframe + 1;
+ self.weaponframe_time = time + 0.1;
+ if (self.weaponframe > 3)
+ self.weaponframe = 0;
+ break;
+
+ case WEAPON_UZI:
+ // cycle until fire button is released
+ if (self.weaponframe > 3)
+ return;
+ if (self.currentammo == 0) {
+ self.weaponframe = 0;
+ return;
+ }
+ if (self.weaponstate != WS_IDLE)
+ {
+ self.weaponframe_time = time + 0.1;
+ self.weaponframe = self.weaponframe + 1;
+ if (self.weaponframe > 2)
+ self.weaponframe = 1;
+ }
+ else
+ self.weaponframe = 0;
+
+ break;
+ case WEAPON_RL:
+ if (self.weaponframe > 11) // assume that we're not firing and that animations should be handled in player.qc or elsewhere
+ return;
+ self.weaponframe = self.weaponframe + 1;
+ self.weaponframe_time = time + 0.1;
+ if (self.weaponframe > 10)
+ self.weaponframe = 0;
+ break;
+ case WEAPON_SNIPER:
+ if (self.weaponframe > 3) // assume that we're not firing and that animations should be handled in player.qc or elsewhere
+ return;
+ self.weaponframe = self.weaponframe + 1;
+ self.weaponframe_time = time + 0.1;
+ if (self.weaponframe > 3)
+ self.weaponframe = 0;
+ break;
+ case WEAPON_PPISTOL:
+ if (self.weaponframe > 3) // assume that we're not firing and that animations should be handled in player.qc or elsewhere
+ return;
+ self.weaponframe = self.weaponframe + 1;
+ self.weaponframe_time = time + 0.1;
+ if (self.weaponframe > 3)
+ self.weaponframe = 0;
+ break;
+ case WEAPON_SWORD:
+ if (self.weaponframe > 18 && self.weaponframe < 25) { // Lunge attack
+ self.weaponframe = self.weaponframe + 1;
+ self.weaponframe_time = time + 0.1;
+ if (self.weaponframe == 21)
+ W_FireSword(1);
+ if (self.weaponframe > 24)
+ self.weaponframe = 0;
+ }
+ else if (self.weaponframe > 25 && self.weaponframe < 32) {
+ self.weaponframe = self.weaponframe + 1;
+ self.weaponframe_time = time + 0.1;
+ if (self.weaponframe == 29)
+ W_FireSword(0);
+ if (self.weaponframe > 31)
+ self.weaponframe = 0;
+ }
+ else {
+ self.weaponframe = self.weaponframe + 1;
+ self.weaponframe_time = time + 0.1;
+ if (self.weaponframe == 15)
+ W_FireSword(0);
+ if (self.weaponframe > 18)
+ self.weaponframe = 0;
+ }
+ break;
+ case WEAPON_NEEDLER:
+ if (self.weaponframe > 3) // assume that we're not firing and that animations should be handled in player.qc or elsewhere
+ return;
+ self.weaponframe = self.weaponframe + 1;
+ self.weaponframe_time = time + 0.1;
+ if (self.weaponframe > 3)
+ self.weaponframe = 0;
+ break;
+ case WEAPON_PRIFLE:
+ if (self.weaponframe > 3) // assume that we're not firing and that animations should be handled in player.qc or elsewhere
+ return;
+ self.weaponframe = self.weaponframe + 1;
+ self.weaponframe_time = time + 0.1;
+ if (self.weaponframe > 3)
+ self.weaponframe = 0;
+ break;
+ default:
+ // Solitude
+ if (self.weaponframe > 4) // assume that we're not firing and that animations should be handled in player.qc or elsewhere
+ return;
+ self.weaponframe = self.weaponframe + 1;
+ self.weaponframe_time = time + 0.1;
+ if (self.weaponframe > 6)
+ self.weaponframe = 0;
+ }
+
+ self.wepanim = 0; // turn hack off
+};
+
+/*
+============
+W_WeaponFrame
+
+Called every frame so impulse events can be handled as well as possible
+============
+*/
+void() W_WeaponFrame =
+{
+ local INTEGER scount;
+
+ W_HandlePlayerFrame();
+
+
+ if ((self.health < self.ohealth))
+ {
+ self.regen = (time + 3);
+ }
+ self.ohealth = self.health;
+ if (((time > self.regen) && (self.health < 130)))
+ {
+ Heal ();
+ }
+
+ if (time < self.attack_finished)
+ return;
+
+ if (self.impulse)
+ ImpulseCommands ();
+
+
+
+// check for attack
+ if (self.button0)
+ {
+ scount = 0;
+ // play catchup but don't allow more than 4 shots per frame
+ while (self.attack_finished <= time)
+ {
+ if (scount >= 4)
+ {
+ self.attack_finished = time;
+ break;
+ }
+
+ W_Attack();
+ scount++;
+ }
+ }
+ else
+ {
+ if (self.weaponheat > 0) {
+ W_Attack();
+ }
+ if (self.needler_heat > 0)
+ self.needler_heat = 0;
+ if (self.prifle_heat > 0)
+ self.prifle_heat = 0;
+ self.attack_finished = time;
+ self.weaponstate = WS_IDLE;
+ }
+};
+
+/*
+========
+SuperDamageSound
+
+Plays sound if needed
+========
+*/
+void() SuperDamageSound =
+{
+ if (self.super_damage_finished > time)
+ {
+ if (self.super_sound < time)
+ {
+ self.super_sound = time + 1;
+ sound (self, CHAN_BODY, "items/damage3.wav", 1, ATTN_NORM);
+ }
+ }
+ return;
+};
+
+/*
+void() testfunction =
+{
+ local vector v;
+ local float a, b, c;
+
+ a = 2;
+ b = 4;
+ c = 6;
+ a *= 2;
+ b *= 2;
+ c *= 2;
+ v = '2 4 6';
+ v *= 2;
+ if (!a && !b && !c)
+ return;
+
+ if (!v)
+ return;
+
+ v_x = 23;
+
+ if (self.health && self.ammo_shells && self.ammo_cells)
+ return;
+};
+*/
+
+// GOLD: this is now a wrapper for W_UpdateAmmoCounts
+void () W_SetCurrentAmmo =
+{
+ self.weaponframe = 0;
+ W_UpdateAmmoCounts(self);
+/*
+ player_run ();
+ self.items = (self.items - (self.items & (((IT_SHELLS | IT_NAILS) | IT_ROCKETS) | IT_CELLS)));
+ if ((self.weapon == IT_AXE))
+ {
+ self.currentammo = MSG_BROADCAST;
+ self.weaponmodel = "progs/v_axe.mdl";
+ self.weaponframe = MSG_BROADCAST;
+ }
+ else
+ {
+ if ((self.weapon == IT_SHOTGUN))
+ {
+ self.currentammo = self.ammo_shells;
+ self.weaponmodel = "progs/v_shot.mdl";
+ self.weaponframe = MSG_BROADCAST;
+ self.items = (self.items | IT_SHELLS);
+ }
+ else
+ {
+ if ((self.weapon == IT_SUPER_SHOTGUN))
+ {
+ self.currentammo = self.ammo_shells2;
+ self.weaponmodel = "progs/v_shot2.mdl";
+ self.weaponframe = MSG_BROADCAST;
+ }
+ else
+ {
+ if ((self.weapon == IT_NAILGUN))
+ {
+ self.currentammo = self.ammo_nails;
+ self.weaponmodel = "progs/v_nail.mdl";
+ self.weaponframe = MSG_BROADCAST;
+ }
+ else
+ {
+ if ((self.weapon == IT_SUPER_NAILGUN))
+ {
+ self.currentammo = self.ammo_hshells;
+ self.weaponmodel = "progs/v_shotgun.mdl";
+ self.weaponframe = MSG_BROADCAST;
+ }
+ else
+ {
+ if ((self.weapon == IT_GRENADE_LAUNCHER))
+ {
+ self.currentammo = self.ammo_rockets;
+ self.weaponmodel = "progs/v_rock.mdl";
+ self.weaponframe = MSG_BROADCAST;
+ self.items = (self.items | IT_ROCKETS);
+ }
+ else
+ {
+ if ((self.weapon == IT_ROCKET_LAUNCHER))
+ {
+ self.currentammo = self.ammo_rockets;
+ self.weaponmodel = "progs/v_rocket.mdl";
+ self.weaponframe = MSG_BROADCAST;
+ self.items = (self.items | IT_ROCKETS);
+ }
+ else
+ {
+ if ((self.weapon == IT_LIGHTNING))
+ {
+ self.currentammo = self.ammo_cells;
+ self.weaponmodel = "progs/v_light.mdl";
+ self.weaponframe = MSG_BROADCAST;
+ self.items = (self.items | IT_CELLS);
+ }
+ else
+ {
+ self.currentammo = MSG_BROADCAST;
+ self.weaponmodel = "";
+ self.weaponframe = MSG_BROADCAST;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ */
+}
+
+
diff --git a/r17/Revamped src/Revamped QC/world.qc b/r17/Revamped src/Revamped QC/world.qc
new file mode 100755
index 00000000..3f2c31a7
--- /dev/null
+++ b/r17/Revamped src/Revamped QC/world.qc
@@ -0,0 +1,387 @@
+
+void() main =
+{
+// these are just commands the the prog compiler to copy these files
+
+ precache_file ("progs.dat");
+ precache_file ("gfx.wad");
+ precache_file ("quake.rc");
+ precache_file ("default.cfg");
+
+ precache_file ("end1.bin");
+ precache_file2 ("end2.bin");
+
+ precache_file ("demo1.dem");
+ precache_file ("demo2.dem");
+ precache_file ("demo3.dem");
+
+//
+// these are all of the lumps from the cached.ls files
+//
+ precache_file ("gfx/palette.lmp");
+ precache_file ("gfx/colormap.lmp");
+
+ precache_file2 ("gfx/pop.lmp");
+
+ precache_file ("gfx/complete.lmp");
+ precache_file ("gfx/inter.lmp");
+
+ precache_file ("gfx/ranking.lmp");
+ precache_file ("gfx/vidmodes.lmp");
+ precache_file ("gfx/finale.lmp");
+ precache_file ("gfx/conback.lmp");
+ precache_file ("gfx/qplaque.lmp");
+
+ precache_file ("gfx/menudot1.lmp");
+ precache_file ("gfx/menudot2.lmp");
+ precache_file ("gfx/menudot3.lmp");
+ precache_file ("gfx/menudot4.lmp");
+ precache_file ("gfx/menudot5.lmp");
+ precache_file ("gfx/menudot6.lmp");
+
+ precache_file ("gfx/menuplyr.lmp");
+ precache_file ("gfx/bigbox.lmp");
+ precache_file ("gfx/dim_modm.lmp");
+ precache_file ("gfx/dim_drct.lmp");
+ precache_file ("gfx/dim_ipx.lmp");
+ precache_file ("gfx/dim_tcp.lmp");
+ precache_file ("gfx/dim_mult.lmp");
+ precache_file ("gfx/mainmenu.lmp");
+
+ precache_file ("gfx/box_tl.lmp");
+ precache_file ("gfx/box_tm.lmp");
+ precache_file ("gfx/box_tr.lmp");
+
+ precache_file ("gfx/box_ml.lmp");
+ precache_file ("gfx/box_mm.lmp");
+ precache_file ("gfx/box_mm2.lmp");
+ precache_file ("gfx/box_mr.lmp");
+
+ precache_file ("gfx/box_bl.lmp");
+ precache_file ("gfx/box_bm.lmp");
+ precache_file ("gfx/box_br.lmp");
+
+ precache_file ("gfx/sp_menu.lmp");
+ precache_file ("gfx/ttl_sgl.lmp");
+ precache_file ("gfx/ttl_main.lmp");
+ precache_file ("gfx/ttl_cstm.lmp");
+
+ precache_file ("gfx/mp_menu.lmp");
+
+ precache_file ("gfx/netmen1.lmp");
+ precache_file ("gfx/netmen2.lmp");
+ precache_file ("gfx/netmen3.lmp");
+ precache_file ("gfx/netmen4.lmp");
+ precache_file ("gfx/netmen5.lmp");
+
+ precache_file ("gfx/sell.lmp");
+
+ precache_file ("gfx/help0.lmp");
+ precache_file ("gfx/help1.lmp");
+ precache_file ("gfx/help2.lmp");
+ precache_file ("gfx/help3.lmp");
+ precache_file ("gfx/help4.lmp");
+ precache_file ("gfx/help5.lmp");
+
+ precache_file ("gfx/pause.lmp");
+ precache_file ("gfx/loading.lmp");
+
+ precache_file ("gfx/p_option.lmp");
+ precache_file ("gfx/p_load.lmp");
+ precache_file ("gfx/p_save.lmp");
+ precache_file ("gfx/p_multi.lmp");
+
+
+
+
+// sounds loaded by C code
+ precache_sound ("misc/menu1.wav");
+ precache_sound ("misc/menu2.wav");
+ precache_sound ("misc/menu3.wav");
+
+ precache_sound ("ambience/water1.wav");
+ precache_sound ("ambience/wind2.wav");
+
+// shareware
+ precache_file ("maps/start.bsp");
+
+// registered
+ precache_file2 ("gfx/pop.lmp");
+
+ };
+
+//=======================
+/*QUAKED worldspawn (0 0 0) ?
+Only used for the world entity.
+Set message to the level name.
+Set sounds to the cd track to play.
+
+World Types:
+0: medieval
+1: metal
+2: base
+*/
+//=======================
+void() worldspawn =
+{
+ local float sol_grav, sol_ms;
+
+ lastspawn = world;
+ spotspawn = 0;
+
+ BotInit(); // FrikBot
+ ENG_Check();
+
+ sol_grav = cvar("sol_gravity");
+ sol_ms = cvar("sol_maxspeed");
+
+ if (sol_grav)
+ cvar_set ("sv_gravity", ftos(sol_grav));
+ else
+ cvar_set ("sv_gravity", "#DEFAULT_GRAVITY");
+
+ if (sol_ms)
+ cvar_set ("sv_maxspeed", ftos(sol_ms));
+ else
+ cvar_set ("sv_maxspeed", "#DEFAULT_MAXSPEED");
+
+ cvar_set ("sv_maxvelocity", "10000"); // for the sniper projectile
+#ifndef NETQUAKE
+// custom map attributes
+ if (self.model == "maps/e1m8.bsp")
+ cvar_set ("sv_gravity", "100");
+#endif
+
+// the area based ambient sounds MUST be the first precache_sounds
+
+// player precaches
+ W_Precache (); // get weapon precaches
+
+// sounds used from C physics code
+ precache_sound ("demon/dland2.wav"); // landing thud
+ precache_sound ("misc/h2ohit1.wav"); // landing splash
+
+// setup precaches allways needed
+ precache_sound ("items/itembk2.wav"); // item respawn sound
+ precache_sound ("player/plyrjmp8.wav"); // player jump
+ precache_sound ("player/land.wav"); // player landing
+ precache_sound ("player/land2.wav"); // player hurt landing
+ precache_sound ("player/drown1.wav"); // drowning pain
+ precache_sound ("player/drown2.wav"); // drowning pain
+ precache_sound ("player/gasp1.wav"); // gasping for air
+ precache_sound ("player/gasp2.wav"); // taking breath
+ precache_sound ("player/h2odeath.wav"); // drowning death
+
+ precache_sound ("misc/talk.wav"); // talk
+ precache_sound ("player/teledth1.wav"); // telefrag
+ precache_sound ("misc/r_tele1.wav"); // teleport sounds
+ precache_sound ("misc/r_tele4.wav"); // teleport sounds
+ precache_sound ("misc/r_tele5.wav"); // teleport sounds
+ precache_sound ("misc/r_tele2.wav"); // teleport sounds
+ precache_sound ("misc/r_tele3.wav"); // teleport sounds
+ precache_sound ("weapons/lock4.wav"); // ammo pick up
+ precache_sound ("weapons/pkup.wav"); // weapon up
+ precache_sound ("items/armor1.wav"); // armor up
+ precache_sound ("weapons/lhit.wav"); //lightning
+ precache_sound ("weapons/lstart.wav"); //lightning start
+ precache_sound ("items/damage3.wav");
+
+ precache_sound ("misc/power.wav"); //lightning for boss
+
+// player pain sounds
+
+ precache_sound ("player/pain1.wav");
+
+// player death sounds
+ precache_sound ("player/death1.wav");
+
+ precache_sound ("boss1/sight1.wav");
+
+// ax sounds
+ precache_sound ("weapons/ax1.wav"); // ax swoosh
+ precache_sound ("player/axhit1.wav"); // ax hit meat
+ precache_sound ("player/axhit2.wav"); // ax hit world
+
+ precache_sound ("player/h2ojump.wav"); // player jumping into water
+ precache_sound ("player/slimbrn2.wav"); // player enter slime
+ precache_sound ("player/inh2o.wav"); // player enter water
+ precache_sound ("player/inlava.wav"); // player enter lava
+ precache_sound ("misc/outwater.wav"); // leaving water sound
+
+ precache_sound ("player/lburn1.wav"); // lava burn
+ precache_sound ("player/lburn2.wav"); // lava burn
+
+ precache_sound ("misc/water1.wav"); // swimming
+ precache_sound ("misc/water2.wav"); // swimming
+
+// Invulnerability sounds
+ precache_sound ("items/protect.wav");
+ precache_sound ("items/protect2.wav");
+ precache_sound ("items/protect3.wav");
+
+
+ precache_model ("progs/player.mdl");
+ precache_model ("progs/eyes.mdl");
+ precache_model ("progs/h_player.mdl");
+ precache_sound ("player/tornoff2.wav");
+
+ precache_model ("progs/s_bubble.spr"); // drowning bubbles
+ precache_model ("progs/s_explod.spr"); // sprite explosion
+
+ precache_model ("progs/v_axe.mdl");
+ precache_model ("progs/v_shot.mdl");
+ precache_model ("progs/v_nail.mdl");
+ precache_model ("progs/v_rock.mdl");
+ precache_model ("progs/v_shot2.mdl");
+ precache_model ("progs/v_nail2.mdl");
+
+ precache_model ("progs/bolt.mdl"); // for lightning gun
+ precache_model ("progs/bolt2.mdl"); // for lightning gun
+ precache_model ("progs/bolt3.mdl"); // for boss shock
+ precache_model ("progs/lavaball.mdl"); // for testing
+
+ precache_model ("progs/missile.mdl");
+ precache_model ("progs/grenade.mdl");
+ precache_model ("progs/spike.mdl");
+ precache_model ("progs/s_spike.mdl");
+
+ precache_model ("progs/backpack.mdl");
+
+ precache_model ("progs/zom_gib.mdl");
+
+ precache_model ("progs/v_light.mdl");
+
+
+//
+// Setup light animation tables. 'a' is total darkness, 'z' is maxbright.
+//
+
+ // 0 normal
+ lightstyle(0, "m");
+
+ // 1 FLICKER (first variety)
+ lightstyle(1, "mmnmmommommnonmmonqnmmo");
+
+ // 2 SLOW STRONG PULSE
+ lightstyle(2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");
+
+ // 3 CANDLE (first variety)
+ lightstyle(3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");
+
+ // 4 FAST STROBE
+ lightstyle(4, "mamamamamama");
+
+ // 5 GENTLE PULSE 1
+ lightstyle(5,"jklmnopqrstuvwxyzyxwvutsrqponmlkj");
+
+ // 6 FLICKER (second variety)
+ lightstyle(6, "nmonqnmomnmomomno");
+
+ // 7 CANDLE (second variety)
+ lightstyle(7, "mmmaaaabcdefgmmmmaaaammmaamm");
+
+ // 8 CANDLE (third variety)
+ lightstyle(8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");
+
+ // 9 SLOW STROBE (fourth variety)
+ lightstyle(9, "aaaaaaaazzzzzzzz");
+
+ // 10 FLUORESCENT FLICKER
+ lightstyle(10, "mmamammmmammamamaaamammma");
+
+ // 11 SLOW PULSE NOT FADE TO BLACK
+ lightstyle(11, "abcdefghijklmnopqrrqponmlkjihgfedcba");
+
+ // styles 32-62 are assigned by the light program for switchable lights
+
+ // 63 testing
+ lightstyle(63, "a");
+};
+
+void() StartFrame =
+{
+ BotFrame(); // FrikBot
+ timelimit = cvar("timelimit") * 60;
+ fraglimit = cvar("fraglimit");
+#ifdef NETQUAKE
+ deathmatch = cvar("deathmatch");
+ coop = cvar("coop");
+ teamplay = cvar("teamplay");
+#endif
+ skill = cvar("skill");
+
+ framecount = framecount + 1;
+};
+void() func_rotating =
+
+{
+
+ self.solid = SOLID_BSP;
+
+ self.movetype = MOVETYPE_PUSH;
+
+ setorigin (self, self.origin);
+
+ setmodel (self, self.model);
+
+ self.classname = "func_rotating";
+
+ setsize (self, self.mins, self.maxs);
+
+
+
+ if (!self.speed)
+
+ self.speed = 100;
+
+
+
+ if (self.spawnflags & 2) // reverse direction
+
+ self.speed = 0 - self.speed;
+
+
+
+ if (self.spawnflags & 64) // not solid
+
+ self.solid = SOLID_NOT;
+
+
+
+ if (self.spawnflags & 4)
+
+ {
+
+ self.avelocity_z = self.speed;
+
+ self.avelocity_x = 0;
+
+ self.avelocity_y = 0;
+
+ }
+
+ else if (self.spawnflags & 8)
+
+ {
+
+ self.avelocity_z = 0;
+
+ self.avelocity_x = self.speed;
+
+ self.avelocity_y = 0;
+
+ }
+
+ else
+
+ {
+
+ self.avelocity_z = 0;
+
+ self.avelocity_x = 0;
+
+ self.avelocity_y = self.speed;
+
+ }
+
+};
diff --git a/r17/Revamped src/revamped_src/Makefile b/r17/Revamped src/revamped_src/Makefile
new file mode 100755
index 00000000..f9555d32
--- /dev/null
+++ b/r17/Revamped src/revamped_src/Makefile
@@ -0,0 +1,196 @@
+#=================
+# ZQuake Makefile
+#=================
+
+#==============================================================================
+# Here are the targets:
+
+.PHONY: default all server gl soft null
+
+default: gl server soft
+all: server gl soft null
+
+#==============================================================================
+# Architecture detection
+#
+# MACHINE = i686-linux-gnu, etc
+# ARCH = mingw32 x86-linux ppc-linux x86-darwin ppc-darwin
+# OS = windows linux darwin
+
+MACHINE = $(shell $(CC) -dumpmachine)
+ARCH = $(shell echo $(MACHINE) | sed -e 's/.*mingw32.*/mingw32/g' \
+ -e 's/i.86/x86/g' -e 's/-gnu//' -e 's/powerpc/ppc/')
+ # -e 's/\-.*//g' -
+
+OS = $(shell echo $(ARCH) | sed -e 's/.*-//')
+ifeq ($(OS),mingw32)
+OS = windows
+endif
+
+#==============================================================================
+
+
+CC = gcc
+
+
+PRODUCT_DIR=release
+GL_OBJ_DIR=release/gl
+SOFT_OBJ_DIR=release/soft
+SERVER_OBJ_DIR=release/server
+NULL_OBJ_DIR=release/null
+
+
+#------------------------------------------------------------------------------
+
+CFLAGS = -DVWEP_TEST -DHALFLIFEBSP
+CFLAGS += -Wall -Wno-format-y2k
+
+# optimizations (should be only for release)
+CFLAGS +=-ffast-math -fomit-frame-pointer -fexpensive-optimizations
+
+ifeq ($(ARCH),mingw32)
+ CFLAGS += -D_WIN32 -DMINGW32
+endif
+ifeq ($(OS),linux)
+ CFLAGS += -DUSE_ALSA -DUSE_VMODE -DUSE_DGA
+endif
+ifeq ($(ARCH),ppc-linux)
+ CFLAGS += -DBIGENDIAN
+endif
+ifeq ($(OS),darwin)
+ CFLAGS += -DHAVE_STRLCPY -DHAVE_STRLCAT
+endif
+ifeq ($(ARCH),ppc-darwin)
+ CFLAGS += -DBIGENDIAN
+endif
+
+SERVER_CFLAGS = -DSERVERONLY
+GL_CFLAGS = -DGLQUAKE
+SW_CFLAGS =
+NULL_CFLAGS =
+
+#------------------------------------------------------------------------------
+
+LDFLAGS =
+GL_LDFLAGS =
+SW_LDFLAGS =
+ifeq ($(ARCH),mingw32)
+ LDFLAGS +=-lws2_32 -luser32 -lwinmm -ldxguid -lgdi32
+ GL_LDFLAGS =-mwindows -lopengl32
+ SW_LDFLAGS =-mwindows -lddraw
+endif
+ifeq ($(OS),darwin)
+ LDFLAGS +=-framework "CoreAudio" -framework OpenGL
+endif
+ifeq ($(OS),linux)
+ LDFLAGS +=-lm -lGL -lXxf86vm -lXxf86dga
+ # -L/usr/X11R6/lib -lX11 -lXext
+endif
+
+#==============================================================================
+
+CLIENT_C_FILES = cl_cam cl_cmd cl_demo cl_draw cl_effects cl_ents cl_input \
+ cl_main cl_nqdemo cl_parse cl_pred cl_sbar cl_screen cl_tent cl_view \
+ console keys menu teamplay textencoding
+GL_C_FILES = sv_save skin rc_wad rc_image rc_pixops \
+ gl_draw gl_mesh gl_model gl_ngraph gl_ralias gl_refrag gl_rlight \
+ gl_rmain gl_rmisc gl_rsprite gl_rsurf gl_texture gl_warp gl_sky
+SW_C_FILES = sv_save skin rc_wad rc_image rc_pixops nonintel \
+ d_edge d_fill d_init d_modech d_polyse d_sky d_sprite d_surf d_vars \
+ d_zpoint r_aclip r_alias r_bsp r_draw r_edge r_efrag r_light r_main \
+ r_misc r_model r_part r_rast r_scan r_sky r_sprite r_surf r_vars
+SERVER_C_FILES = sv_bot sv_ccmds sv_ents sv_init sv_main sv_master \
+ sv_move sv_nchan sv_phys sv_send sv_user sv_world \
+ pr_cmds pr_edict pr_exec
+COMMON_C_FILES = cmd cmodel com_msg com_mapcheck common crc cvar host mathlib mdfour \
+ net_chan pmove pmovetst qlib q_shared version zone
+NULL_C_FILES = sv_save rc_null vid_null snd_null cd_null in_null sys_null
+ifeq ($(ARCH),mingw32)
+ZQDS_PLATFORM_C_FILES = sys_win net_wins
+ZQGL_PLATFORM_C_FILES = sys_win net_wins snd_dma snd_mem snd_mix snd_win cd_win in_win vid_wgl
+ZQSW_PLATFORM_C_FILES = sys_win net_wins snd_dma snd_mem snd_mix snd_win cd_win in_win vid_ddraw
+NULL_C_FILES += net_wins
+else
+ZQDS_PLATFORM_C_FILES = sv_sys_unix net_udp
+ZQGL_PLATFORM_C_FILES = net_udp
+ZQSW_PLATFORM_C_FILES = net_udp
+NULL_C_FILES += net_udp
+endif
+ifeq ($(OS),darwin)
+ZQGL_PLATFORM_C_FILES += snd_null cd_null
+ZQSW_PLATFORM_C_FILES += snd_null cd_null
+endif
+ifeq ($(OS),linux)
+ZQGL_PLATFORM_C_FILES += sys_linux cd_linux snd_dma snd_mem snd_mix snd_linux snd_oss snd_alsa vid_glx
+ZQSW_PLATFORM_C_FILES += sys_linux cd_linux snd_dma snd_mem snd_mix snd_linux snd_oss snd_alsa vid_x
+endif
+ZQDS_C_FILES = $(SERVER_C_FILES) $(COMMON_C_FILES) $(ZQDS_PLATFORM_C_FILES) cl_null
+ZQSW_C_FILES = $(CLIENT_C_FILES) $(ZQSW_PLATFORM_C_FILES) $(SW_C_FILES) $(SERVER_C_FILES) $(COMMON_C_FILES)
+ZQGL_C_FILES = $(CLIENT_C_FILES) $(ZQGL_PLATFORM_C_FILES) $(GL_C_FILES) $(SERVER_C_FILES) $(COMMON_C_FILES)
+ZQNULL_C_FILES = $(CLIENT_C_FILES) $(SERVER_C_FILES) $(COMMON_C_FILES) $(NULL_C_FILES)
+ZQDS_C_OBJS = $(addprefix $(SERVER_OBJ_DIR)/, $(addsuffix .o, $(ZQDS_C_FILES)))
+ZQGL_C_OBJS = $(addprefix $(GL_OBJ_DIR)/, $(addsuffix .o, $(ZQGL_C_FILES)))
+ZQSW_C_OBJS = $(addprefix $(SOFT_OBJ_DIR)/, $(addsuffix .o, $(ZQSW_C_FILES)))
+ZQNULL_C_OBJS = $(addprefix $(NULL_OBJ_DIR)/, $(addsuffix .o, $(ZQNULL_C_FILES)))
+
+#==============================================================================
+
+printvars:
+ @echo "MACHINE = $(MACHINE)"
+ @echo "ARCH = $(ARCH)"
+ @echo "OS = $(OS)"
+ @echo ""
+ @echo "PRODUCT_DIR = $(PRODUCT_DIR)"
+ @echo ""
+ @echo "CFLAGS = $(CFLAGS)"
+ @echo "LDFLAGS = $(LDFLAGS)"
+
+#.PHONY: server
+#server:
+# @echo [MAKE] server
+# @make server_do
+#server_do: $(PRODUCT_DIR)/zqds
+server: $(PRODUCT_DIR)/zqds
+$(PRODUCT_DIR)/zqds: $(ZQDS_C_OBJS)
+ @echo [LINK] $@
+ @$(CC) -o $@ $(ZQDS_C_OBJS) $(LDFLAGS)
+$(ZQDS_C_OBJS): $(SERVER_OBJ_DIR)/%.o: %.c
+ @-mkdir -p $(SERVER_OBJ_DIR)
+ @echo [CC] $<
+ @$(CC) $(CFLAGS) $(SERVER_CFLAGS) -c -o $@ $<
+#------------------------------------------------------------------------------
+gl: $(PRODUCT_DIR)/zquake-gl
+$(PRODUCT_DIR)/zquake-gl: $(ZQGL_C_OBJS)
+ @echo [LINK] $@
+ @$(CC) -o $@ $(ZQGL_C_OBJS) $(LDFLAGS) $(GL_LDFLAGS)
+$(ZQGL_C_OBJS): $(GL_OBJ_DIR)/%.o: %.c
+ @-mkdir -p $(GL_OBJ_DIR)
+ @echo [CC] $<
+ @$(CC) $(CFLAGS) $(GL_CFLAGS) -c -o $@ $<
+#------------------------------------------------------------------------------
+soft: $(PRODUCT_DIR)/zquake
+$(PRODUCT_DIR)/zquake: $(ZQSW_C_OBJS)
+ @echo [LINK] $@
+ @$(CC) -o $@ $(ZQSW_C_OBJS) $(LDFLAGS) $(SW_LDFLAGS)
+$(ZQSW_C_OBJS): $(SOFT_OBJ_DIR)/%.o: %.c
+ @-mkdir -p $(SOFT_OBJ_DIR)
+ @echo [CC] $<
+ @$(CC) $(CFLAGS) $(SW_CFLAGS) -c -o $@ $<
+#------------------------------------------------------------------------------
+null: $(PRODUCT_DIR)/zquake-null
+$(PRODUCT_DIR)/zquake-null: $(ZQNULL_C_OBJS)
+ @echo [LINK] $@
+ @$(CC) -o $@ $(ZQNULL_C_OBJS) $(LDFLAGS)
+$(ZQNULL_C_OBJS): $(NULL_OBJ_DIR)/%.o: %.c
+ @-mkdir -p $(NULL_OBJ_DIR)
+ @echo [CC] $<
+ @$(CC) $(CFLAGS) $(NULL_CFLAGS) -c -o $@ $<
+#------------------------------------------------------------------------------
+clean:
+ @echo [CLEAN]
+ @-rm $(SERVER_OBJ_DIR)/*.o $(SOFT_OBJ_DIR)/*.o $(GL_OBJ_DIR)/*.o $(NULL_OBJ_DIR)/*.o 2>/dev/null
+ @-rmdir $(SERVER_OBJ_DIR) $(SOFT_OBJ_DIR) $(GL_OBJ_DIR) $(NULL_OBJ_DIR) 2>/dev/null
+ @-rm $(PRODUCT_DIR)/zqds $(PRODUCT_DIR)/zquake $(PRODUCT_DIR)/zquake-gl $(PRODUCT_DIR)/zquake-null 2>/dev/null
+ @-rm $(PRODUCT_DIR) 2>/dev/null
+
+#==============================================================================
diff --git a/r17/Revamped src/revamped_src/Quake.sln b/r17/Revamped src/revamped_src/Quake.sln
new file mode 100755
index 00000000..68f74fbc
--- /dev/null
+++ b/r17/Revamped src/revamped_src/Quake.sln
@@ -0,0 +1,28 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual C++ Express 2010
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Quake_PSP", "psp\Quake_PSP.vcxproj", "{38B817AB-88C4-4ADA-8750-4187AB435363}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Quake_Win32Stubs", "win32_stubs\Quake_Win32Stubs.vcxproj", "{D94197A6-9EAA-452A-AA05-652C940D70A3}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Win32 = Debug|Win32
+ PSP|Win32 = PSP|Win32
+ Release|Win32 = Release|Win32
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {38B817AB-88C4-4ADA-8750-4187AB435363}.Debug|Win32.ActiveCfg = PSP|Win32
+ {38B817AB-88C4-4ADA-8750-4187AB435363}.PSP|Win32.ActiveCfg = PSP|Win32
+ {38B817AB-88C4-4ADA-8750-4187AB435363}.PSP|Win32.Build.0 = PSP|Win32
+ {38B817AB-88C4-4ADA-8750-4187AB435363}.Release|Win32.ActiveCfg = PSP|Win32
+ {D94197A6-9EAA-452A-AA05-652C940D70A3}.Debug|Win32.ActiveCfg = Debug|Win32
+ {D94197A6-9EAA-452A-AA05-652C940D70A3}.Debug|Win32.Build.0 = Debug|Win32
+ {D94197A6-9EAA-452A-AA05-652C940D70A3}.PSP|Win32.ActiveCfg = Debug|Win32
+ {D94197A6-9EAA-452A-AA05-652C940D70A3}.Release|Win32.ActiveCfg = Release|Win32
+ {D94197A6-9EAA-452A-AA05-652C940D70A3}.Release|Win32.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/r17/Revamped src/revamped_src/Quake.suo b/r17/Revamped src/revamped_src/Quake.suo
new file mode 100755
index 00000000..034a2b86
Binary files /dev/null and b/r17/Revamped src/revamped_src/Quake.suo differ
diff --git a/r17/Revamped src/revamped_src/UpgradeLog.XML b/r17/Revamped src/revamped_src/UpgradeLog.XML
new file mode 100755
index 00000000..78359ca9
--- /dev/null
+++ b/r17/Revamped src/revamped_src/UpgradeLog.XML
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/r17/Revamped src/revamped_src/_UpgradeReport_Files/UpgradeReport.css b/r17/Revamped src/revamped_src/_UpgradeReport_Files/UpgradeReport.css
new file mode 100755
index 00000000..3411f632
--- /dev/null
+++ b/r17/Revamped src/revamped_src/_UpgradeReport_Files/UpgradeReport.css
@@ -0,0 +1,207 @@
+BODY
+{
+ BACKGROUND-COLOR: white;
+ FONT-FAMILY: "Verdana", sans-serif;
+ FONT-SIZE: 100%;
+ MARGIN-LEFT: 0px;
+ MARGIN-TOP: 0px
+}
+P
+{
+ FONT-FAMILY: "Verdana", sans-serif;
+ FONT-SIZE: 70%;
+ LINE-HEIGHT: 12pt;
+ MARGIN-BOTTOM: 0px;
+ MARGIN-LEFT: 10px;
+ MARGIN-TOP: 10px
+}
+.note
+{
+ BACKGROUND-COLOR: #ffffff;
+ COLOR: #336699;
+ FONT-FAMILY: "Verdana", sans-serif;
+ FONT-SIZE: 100%;
+ MARGIN-BOTTOM: 0px;
+ MARGIN-LEFT: 0px;
+ MARGIN-TOP: 0px;
+ PADDING-RIGHT: 10px
+}
+.infotable
+{
+ BACKGROUND-COLOR: #f0f0e0;
+ BORDER-BOTTOM: #ffffff 0px solid;
+ BORDER-COLLAPSE: collapse;
+ BORDER-LEFT: #ffffff 0px solid;
+ BORDER-RIGHT: #ffffff 0px solid;
+ BORDER-TOP: #ffffff 0px solid;
+ FONT-SIZE: 70%;
+ MARGIN-LEFT: 10px
+}
+.issuetable
+{
+ BACKGROUND-COLOR: #ffffe8;
+ BORDER-COLLAPSE: collapse;
+ COLOR: #000000;
+ FONT-SIZE: 100%;
+ MARGIN-BOTTOM: 10px;
+ MARGIN-LEFT: 13px;
+ MARGIN-TOP: 0px
+}
+.issuetitle
+{
+ BACKGROUND-COLOR: #ffffff;
+ BORDER-BOTTOM: #dcdcdc 1px solid;
+ BORDER-TOP: #dcdcdc 1px;
+ COLOR: #003366;
+ FONT-WEIGHT: normal
+}
+.header
+{
+ BACKGROUND-COLOR: #cecf9c;
+ BORDER-BOTTOM: #ffffff 1px solid;
+ BORDER-LEFT: #ffffff 1px solid;
+ BORDER-RIGHT: #ffffff 1px solid;
+ BORDER-TOP: #ffffff 1px solid;
+ COLOR: #000000;
+ FONT-WEIGHT: bold
+}
+.issuehdr
+{
+ BACKGROUND-COLOR: #E0EBF5;
+ BORDER-BOTTOM: #dcdcdc 1px solid;
+ BORDER-TOP: #dcdcdc 1px solid;
+ COLOR: #000000;
+ FONT-WEIGHT: normal
+}
+.issuenone
+{
+ BACKGROUND-COLOR: #ffffff;
+ BORDER-BOTTOM: 0px;
+ BORDER-LEFT: 0px;
+ BORDER-RIGHT: 0px;
+ BORDER-TOP: 0px;
+ COLOR: #000000;
+ FONT-WEIGHT: normal
+}
+.content
+{
+ BACKGROUND-COLOR: #e7e7ce;
+ BORDER-BOTTOM: #ffffff 1px solid;
+ BORDER-LEFT: #ffffff 1px solid;
+ BORDER-RIGHT: #ffffff 1px solid;
+ BORDER-TOP: #ffffff 1px solid;
+ PADDING-LEFT: 3px
+}
+.issuecontent
+{
+ BACKGROUND-COLOR: #ffffff;
+ BORDER-BOTTOM: #dcdcdc 1px solid;
+ BORDER-TOP: #dcdcdc 1px solid;
+ PADDING-LEFT: 3px
+}
+A:link
+{
+ COLOR: #cc6633;
+ TEXT-DECORATION: underline
+}
+A:visited
+{
+ COLOR: #cc6633;
+}
+A:active
+{
+ COLOR: #cc6633;
+}
+A:hover
+{
+ COLOR: #cc3300;
+ TEXT-DECORATION: underline
+}
+H1
+{
+ BACKGROUND-COLOR: #003366;
+ BORDER-BOTTOM: #336699 6px solid;
+ COLOR: #ffffff;
+ FONT-SIZE: 130%;
+ FONT-WEIGHT: normal;
+ MARGIN: 0em 0em 0em -20px;
+ PADDING-BOTTOM: 8px;
+ PADDING-LEFT: 30px;
+ PADDING-TOP: 16px
+}
+H2
+{
+ COLOR: #000000;
+ FONT-SIZE: 80%;
+ FONT-WEIGHT: bold;
+ MARGIN-BOTTOM: 3px;
+ MARGIN-LEFT: 10px;
+ MARGIN-TOP: 20px;
+ PADDING-LEFT: 0px
+}
+H3
+{
+ COLOR: #000000;
+ FONT-SIZE: 80%;
+ FONT-WEIGHT: bold;
+ MARGIN-BOTTOM: -5px;
+ MARGIN-LEFT: 10px;
+ MARGIN-TOP: 20px
+}
+H4
+{
+ COLOR: #000000;
+ FONT-SIZE: 70%;
+ FONT-WEIGHT: bold;
+ MARGIN-BOTTOM: 0px;
+ MARGIN-TOP: 15px;
+ PADDING-BOTTOM: 0px
+}
+UL
+{
+ COLOR: #000000;
+ FONT-SIZE: 70%;
+ LIST-STYLE: square;
+ MARGIN-BOTTOM: 0pt;
+ MARGIN-TOP: 0pt
+}
+OL
+{
+ COLOR: #000000;
+ FONT-SIZE: 70%;
+ LIST-STYLE: square;
+ MARGIN-BOTTOM: 0pt;
+ MARGIN-TOP: 0pt
+}
+LI
+{
+ LIST-STYLE: square;
+ MARGIN-LEFT: 0px
+}
+.expandable
+{
+ CURSOR: hand
+}
+.expanded
+{
+ color: black
+}
+.collapsed
+{
+ DISPLAY: none
+}
+.foot
+{
+BACKGROUND-COLOR: #ffffff;
+BORDER-BOTTOM: #cecf9c 1px solid;
+BORDER-TOP: #cecf9c 2px solid
+}
+.settings
+{
+MARGIN-LEFT: 25PX;
+}
+.help
+{
+TEXT-ALIGN: right;
+margin-right: 10px;
+}
diff --git a/r17/Revamped src/revamped_src/_UpgradeReport_Files/UpgradeReport.xslt b/r17/Revamped src/revamped_src/_UpgradeReport_Files/UpgradeReport.xslt
new file mode 100755
index 00000000..02de9d0e
--- /dev/null
+++ b/r17/Revamped src/revamped_src/_UpgradeReport_Files/UpgradeReport.xslt
@@ -0,0 +1,232 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | : |
+
+
+
+
+
+
+
+
+ Conversion Report
+
+
+
+
+
+
+
+ Conversion Report -
+
+
+ Time of Conversion:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+ Conversion Settings
+ |
+
+
+
+
+
+
+
diff --git a/r17/Revamped src/revamped_src/_UpgradeReport_Files/UpgradeReport_Minus.gif b/r17/Revamped src/revamped_src/_UpgradeReport_Files/UpgradeReport_Minus.gif
new file mode 100755
index 00000000..17751cb2
Binary files /dev/null and b/r17/Revamped src/revamped_src/_UpgradeReport_Files/UpgradeReport_Minus.gif differ
diff --git a/r17/Revamped src/revamped_src/_UpgradeReport_Files/UpgradeReport_Plus.gif b/r17/Revamped src/revamped_src/_UpgradeReport_Files/UpgradeReport_Plus.gif
new file mode 100755
index 00000000..f6009ca3
Binary files /dev/null and b/r17/Revamped src/revamped_src/_UpgradeReport_Files/UpgradeReport_Plus.gif differ
diff --git a/r17/Revamped src/revamped_src/adivtab.h b/r17/Revamped src/revamped_src/adivtab.h
new file mode 100755
index 00000000..57169066
--- /dev/null
+++ b/r17/Revamped src/revamped_src/adivtab.h
@@ -0,0 +1,1077 @@
+/*
+Copyright (C) 1996-1997 Id Software, Inc.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+// table of quotients and remainders for [-15...16] / [-15...16]
+
+// numerator = -15
+{1, 0},
+{1, -1},
+{1, -2},
+{1, -3},
+{1, -4},
+{1, -5},
+{1, -6},
+{1, -7},
+{2, -1},
+{2, -3},
+{3, 0},
+{3, -3},
+{5, 0},
+{7, -1},
+{15, 0},
+{0, 0},
+{-15, 0},
+{-8, 1},
+{-5, 0},
+{-4, 1},
+{-3, 0},
+{-3, 3},
+{-3, 6},
+{-2, 1},
+{-2, 3},
+{-2, 5},
+{-2, 7},
+{-2, 9},
+{-2, 11},
+{-2, 13},
+{-1, 0},
+{-1, 1},
+// numerator = -14
+{0, -14},
+{1, 0},
+{1, -1},
+{1, -2},
+{1, -3},
+{1, -4},
+{1, -5},
+{1, -6},
+{2, 0},
+{2, -2},
+{2, -4},
+{3, -2},
+{4, -2},
+{7, 0},
+{14, 0},
+{0, 0},
+{-14, 0},
+{-7, 0},
+{-5, 1},
+{-4, 2},
+{-3, 1},
+{-3, 4},
+{-2, 0},
+{-2, 2},
+{-2, 4},
+{-2, 6},
+{-2, 8},
+{-2, 10},
+{-2, 12},
+{-1, 0},
+{-1, 1},
+{-1, 2},
+// numerator = -13
+{0, -13},
+{0, -13},
+{1, 0},
+{1, -1},
+{1, -2},
+{1, -3},
+{1, -4},
+{1, -5},
+{1, -6},
+{2, -1},
+{2, -3},
+{3, -1},
+{4, -1},
+{6, -1},
+{13, 0},
+{0, 0},
+{-13, 0},
+{-7, 1},
+{-5, 2},
+{-4, 3},
+{-3, 2},
+{-3, 5},
+{-2, 1},
+{-2, 3},
+{-2, 5},
+{-2, 7},
+{-2, 9},
+{-2, 11},
+{-1, 0},
+{-1, 1},
+{-1, 2},
+{-1, 3},
+// numerator = -12
+{0, -12},
+{0, -12},
+{0, -12},
+{1, 0},
+{1, -1},
+{1, -2},
+{1, -3},
+{1, -4},
+{1, -5},
+{2, 0},
+{2, -2},
+{3, 0},
+{4, 0},
+{6, 0},
+{12, 0},
+{0, 0},
+{-12, 0},
+{-6, 0},
+{-4, 0},
+{-3, 0},
+{-3, 3},
+{-2, 0},
+{-2, 2},
+{-2, 4},
+{-2, 6},
+{-2, 8},
+{-2, 10},
+{-1, 0},
+{-1, 1},
+{-1, 2},
+{-1, 3},
+{-1, 4},
+// numerator = -11
+{0, -11},
+{0, -11},
+{0, -11},
+{0, -11},
+{1, 0},
+{1, -1},
+{1, -2},
+{1, -3},
+{1, -4},
+{1, -5},
+{2, -1},
+{2, -3},
+{3, -2},
+{5, -1},
+{11, 0},
+{0, 0},
+{-11, 0},
+{-6, 1},
+{-4, 1},
+{-3, 1},
+{-3, 4},
+{-2, 1},
+{-2, 3},
+{-2, 5},
+{-2, 7},
+{-2, 9},
+{-1, 0},
+{-1, 1},
+{-1, 2},
+{-1, 3},
+{-1, 4},
+{-1, 5},
+// numerator = -10
+{0, -10},
+{0, -10},
+{0, -10},
+{0, -10},
+{0, -10},
+{1, 0},
+{1, -1},
+{1, -2},
+{1, -3},
+{1, -4},
+{2, 0},
+{2, -2},
+{3, -1},
+{5, 0},
+{10, 0},
+{0, 0},
+{-10, 0},
+{-5, 0},
+{-4, 2},
+{-3, 2},
+{-2, 0},
+{-2, 2},
+{-2, 4},
+{-2, 6},
+{-2, 8},
+{-1, 0},
+{-1, 1},
+{-1, 2},
+{-1, 3},
+{-1, 4},
+{-1, 5},
+{-1, 6},
+// numerator = -9
+{0, -9},
+{0, -9},
+{0, -9},
+{0, -9},
+{0, -9},
+{0, -9},
+{1, 0},
+{1, -1},
+{1, -2},
+{1, -3},
+{1, -4},
+{2, -1},
+{3, 0},
+{4, -1},
+{9, 0},
+{0, 0},
+{-9, 0},
+{-5, 1},
+{-3, 0},
+{-3, 3},
+{-2, 1},
+{-2, 3},
+{-2, 5},
+{-2, 7},
+{-1, 0},
+{-1, 1},
+{-1, 2},
+{-1, 3},
+{-1, 4},
+{-1, 5},
+{-1, 6},
+{-1, 7},
+// numerator = -8
+{0, -8},
+{0, -8},
+{0, -8},
+{0, -8},
+{0, -8},
+{0, -8},
+{0, -8},
+{1, 0},
+{1, -1},
+{1, -2},
+{1, -3},
+{2, 0},
+{2, -2},
+{4, 0},
+{8, 0},
+{0, 0},
+{-8, 0},
+{-4, 0},
+{-3, 1},
+{-2, 0},
+{-2, 2},
+{-2, 4},
+{-2, 6},
+{-1, 0},
+{-1, 1},
+{-1, 2},
+{-1, 3},
+{-1, 4},
+{-1, 5},
+{-1, 6},
+{-1, 7},
+{-1, 8},
+// numerator = -7
+{0, -7},
+{0, -7},
+{0, -7},
+{0, -7},
+{0, -7},
+{0, -7},
+{0, -7},
+{0, -7},
+{1, 0},
+{1, -1},
+{1, -2},
+{1, -3},
+{2, -1},
+{3, -1},
+{7, 0},
+{0, 0},
+{-7, 0},
+{-4, 1},
+{-3, 2},
+{-2, 1},
+{-2, 3},
+{-2, 5},
+{-1, 0},
+{-1, 1},
+{-1, 2},
+{-1, 3},
+{-1, 4},
+{-1, 5},
+{-1, 6},
+{-1, 7},
+{-1, 8},
+{-1, 9},
+// numerator = -6
+{0, -6},
+{0, -6},
+{0, -6},
+{0, -6},
+{0, -6},
+{0, -6},
+{0, -6},
+{0, -6},
+{0, -6},
+{1, 0},
+{1, -1},
+{1, -2},
+{2, 0},
+{3, 0},
+{6, 0},
+{0, 0},
+{-6, 0},
+{-3, 0},
+{-2, 0},
+{-2, 2},
+{-2, 4},
+{-1, 0},
+{-1, 1},
+{-1, 2},
+{-1, 3},
+{-1, 4},
+{-1, 5},
+{-1, 6},
+{-1, 7},
+{-1, 8},
+{-1, 9},
+{-1, 10},
+// numerator = -5
+{0, -5},
+{0, -5},
+{0, -5},
+{0, -5},
+{0, -5},
+{0, -5},
+{0, -5},
+{0, -5},
+{0, -5},
+{0, -5},
+{1, 0},
+{1, -1},
+{1, -2},
+{2, -1},
+{5, 0},
+{0, 0},
+{-5, 0},
+{-3, 1},
+{-2, 1},
+{-2, 3},
+{-1, 0},
+{-1, 1},
+{-1, 2},
+{-1, 3},
+{-1, 4},
+{-1, 5},
+{-1, 6},
+{-1, 7},
+{-1, 8},
+{-1, 9},
+{-1, 10},
+{-1, 11},
+// numerator = -4
+{0, -4},
+{0, -4},
+{0, -4},
+{0, -4},
+{0, -4},
+{0, -4},
+{0, -4},
+{0, -4},
+{0, -4},
+{0, -4},
+{0, -4},
+{1, 0},
+{1, -1},
+{2, 0},
+{4, 0},
+{0, 0},
+{-4, 0},
+{-2, 0},
+{-2, 2},
+{-1, 0},
+{-1, 1},
+{-1, 2},
+{-1, 3},
+{-1, 4},
+{-1, 5},
+{-1, 6},
+{-1, 7},
+{-1, 8},
+{-1, 9},
+{-1, 10},
+{-1, 11},
+{-1, 12},
+// numerator = -3
+{0, -3},
+{0, -3},
+{0, -3},
+{0, -3},
+{0, -3},
+{0, -3},
+{0, -3},
+{0, -3},
+{0, -3},
+{0, -3},
+{0, -3},
+{0, -3},
+{1, 0},
+{1, -1},
+{3, 0},
+{0, 0},
+{-3, 0},
+{-2, 1},
+{-1, 0},
+{-1, 1},
+{-1, 2},
+{-1, 3},
+{-1, 4},
+{-1, 5},
+{-1, 6},
+{-1, 7},
+{-1, 8},
+{-1, 9},
+{-1, 10},
+{-1, 11},
+{-1, 12},
+{-1, 13},
+// numerator = -2
+{0, -2},
+{0, -2},
+{0, -2},
+{0, -2},
+{0, -2},
+{0, -2},
+{0, -2},
+{0, -2},
+{0, -2},
+{0, -2},
+{0, -2},
+{0, -2},
+{0, -2},
+{1, 0},
+{2, 0},
+{0, 0},
+{-2, 0},
+{-1, 0},
+{-1, 1},
+{-1, 2},
+{-1, 3},
+{-1, 4},
+{-1, 5},
+{-1, 6},
+{-1, 7},
+{-1, 8},
+{-1, 9},
+{-1, 10},
+{-1, 11},
+{-1, 12},
+{-1, 13},
+{-1, 14},
+// numerator = -1
+{0, -1},
+{0, -1},
+{0, -1},
+{0, -1},
+{0, -1},
+{0, -1},
+{0, -1},
+{0, -1},
+{0, -1},
+{0, -1},
+{0, -1},
+{0, -1},
+{0, -1},
+{0, -1},
+{1, 0},
+{0, 0},
+{-1, 0},
+{-1, 1},
+{-1, 2},
+{-1, 3},
+{-1, 4},
+{-1, 5},
+{-1, 6},
+{-1, 7},
+{-1, 8},
+{-1, 9},
+{-1, 10},
+{-1, 11},
+{-1, 12},
+{-1, 13},
+{-1, 14},
+{-1, 15},
+// numerator = 0
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+{0, 0},
+// numerator = 1
+{-1, -14},
+{-1, -13},
+{-1, -12},
+{-1, -11},
+{-1, -10},
+{-1, -9},
+{-1, -8},
+{-1, -7},
+{-1, -6},
+{-1, -5},
+{-1, -4},
+{-1, -3},
+{-1, -2},
+{-1, -1},
+{-1, 0},
+{0, 0},
+{1, 0},
+{0, 1},
+{0, 1},
+{0, 1},
+{0, 1},
+{0, 1},
+{0, 1},
+{0, 1},
+{0, 1},
+{0, 1},
+{0, 1},
+{0, 1},
+{0, 1},
+{0, 1},
+{0, 1},
+{0, 1},
+// numerator = 2
+{-1, -13},
+{-1, -12},
+{-1, -11},
+{-1, -10},
+{-1, -9},
+{-1, -8},
+{-1, -7},
+{-1, -6},
+{-1, -5},
+{-1, -4},
+{-1, -3},
+{-1, -2},
+{-1, -1},
+{-1, 0},
+{-2, 0},
+{0, 0},
+{2, 0},
+{1, 0},
+{0, 2},
+{0, 2},
+{0, 2},
+{0, 2},
+{0, 2},
+{0, 2},
+{0, 2},
+{0, 2},
+{0, 2},
+{0, 2},
+{0, 2},
+{0, 2},
+{0, 2},
+{0, 2},
+// numerator = 3
+{-1, -12},
+{-1, -11},
+{-1, -10},
+{-1, -9},
+{-1, -8},
+{-1, -7},
+{-1, -6},
+{-1, -5},
+{-1, -4},
+{-1, -3},
+{-1, -2},
+{-1, -1},
+{-1, 0},
+{-2, -1},
+{-3, 0},
+{0, 0},
+{3, 0},
+{1, 1},
+{1, 0},
+{0, 3},
+{0, 3},
+{0, 3},
+{0, 3},
+{0, 3},
+{0, 3},
+{0, 3},
+{0, 3},
+{0, 3},
+{0, 3},
+{0, 3},
+{0, 3},
+{0, 3},
+// numerator = 4
+{-1, -11},
+{-1, -10},
+{-1, -9},
+{-1, -8},
+{-1, -7},
+{-1, -6},
+{-1, -5},
+{-1, -4},
+{-1, -3},
+{-1, -2},
+{-1, -1},
+{-1, 0},
+{-2, -2},
+{-2, 0},
+{-4, 0},
+{0, 0},
+{4, 0},
+{2, 0},
+{1, 1},
+{1, 0},
+{0, 4},
+{0, 4},
+{0, 4},
+{0, 4},
+{0, 4},
+{0, 4},
+{0, 4},
+{0, 4},
+{0, 4},
+{0, 4},
+{0, 4},
+{0, 4},
+// numerator = 5
+{-1, -10},
+{-1, -9},
+{-1, -8},
+{-1, -7},
+{-1, -6},
+{-1, -5},
+{-1, -4},
+{-1, -3},
+{-1, -2},
+{-1, -1},
+{-1, 0},
+{-2, -3},
+{-2, -1},
+{-3, -1},
+{-5, 0},
+{0, 0},
+{5, 0},
+{2, 1},
+{1, 2},
+{1, 1},
+{1, 0},
+{0, 5},
+{0, 5},
+{0, 5},
+{0, 5},
+{0, 5},
+{0, 5},
+{0, 5},
+{0, 5},
+{0, 5},
+{0, 5},
+{0, 5},
+// numerator = 6
+{-1, -9},
+{-1, -8},
+{-1, -7},
+{-1, -6},
+{-1, -5},
+{-1, -4},
+{-1, -3},
+{-1, -2},
+{-1, -1},
+{-1, 0},
+{-2, -4},
+{-2, -2},
+{-2, 0},
+{-3, 0},
+{-6, 0},
+{0, 0},
+{6, 0},
+{3, 0},
+{2, 0},
+{1, 2},
+{1, 1},
+{1, 0},
+{0, 6},
+{0, 6},
+{0, 6},
+{0, 6},
+{0, 6},
+{0, 6},
+{0, 6},
+{0, 6},
+{0, 6},
+{0, 6},
+// numerator = 7
+{-1, -8},
+{-1, -7},
+{-1, -6},
+{-1, -5},
+{-1, -4},
+{-1, -3},
+{-1, -2},
+{-1, -1},
+{-1, 0},
+{-2, -5},
+{-2, -3},
+{-2, -1},
+{-3, -2},
+{-4, -1},
+{-7, 0},
+{0, 0},
+{7, 0},
+{3, 1},
+{2, 1},
+{1, 3},
+{1, 2},
+{1, 1},
+{1, 0},
+{0, 7},
+{0, 7},
+{0, 7},
+{0, 7},
+{0, 7},
+{0, 7},
+{0, 7},
+{0, 7},
+{0, 7},
+// numerator = 8
+{-1, -7},
+{-1, -6},
+{-1, -5},
+{-1, -4},
+{-1, -3},
+{-1, -2},
+{-1, -1},
+{-1, 0},
+{-2, -6},
+{-2, -4},
+{-2, -2},
+{-2, 0},
+{-3, -1},
+{-4, 0},
+{-8, 0},
+{0, 0},
+{8, 0},
+{4, 0},
+{2, 2},
+{2, 0},
+{1, 3},
+{1, 2},
+{1, 1},
+{1, 0},
+{0, 8},
+{0, 8},
+{0, 8},
+{0, 8},
+{0, 8},
+{0, 8},
+{0, 8},
+{0, 8},
+// numerator = 9
+{-1, -6},
+{-1, -5},
+{-1, -4},
+{-1, -3},
+{-1, -2},
+{-1, -1},
+{-1, 0},
+{-2, -7},
+{-2, -5},
+{-2, -3},
+{-2, -1},
+{-3, -3},
+{-3, 0},
+{-5, -1},
+{-9, 0},
+{0, 0},
+{9, 0},
+{4, 1},
+{3, 0},
+{2, 1},
+{1, 4},
+{1, 3},
+{1, 2},
+{1, 1},
+{1, 0},
+{0, 9},
+{0, 9},
+{0, 9},
+{0, 9},
+{0, 9},
+{0, 9},
+{0, 9},
+// numerator = 10
+{-1, -5},
+{-1, -4},
+{-1, -3},
+{-1, -2},
+{-1, -1},
+{-1, 0},
+{-2, -8},
+{-2, -6},
+{-2, -4},
+{-2, -2},
+{-2, 0},
+{-3, -2},
+{-4, -2},
+{-5, 0},
+{-10, 0},
+{0, 0},
+{10, 0},
+{5, 0},
+{3, 1},
+{2, 2},
+{2, 0},
+{1, 4},
+{1, 3},
+{1, 2},
+{1, 1},
+{1, 0},
+{0, 10},
+{0, 10},
+{0, 10},
+{0, 10},
+{0, 10},
+{0, 10},
+// numerator = 11
+{-1, -4},
+{-1, -3},
+{-1, -2},
+{-1, -1},
+{-1, 0},
+{-2, -9},
+{-2, -7},
+{-2, -5},
+{-2, -3},
+{-2, -1},
+{-3, -4},
+{-3, -1},
+{-4, -1},
+{-6, -1},
+{-11, 0},
+{0, 0},
+{11, 0},
+{5, 1},
+{3, 2},
+{2, 3},
+{2, 1},
+{1, 5},
+{1, 4},
+{1, 3},
+{1, 2},
+{1, 1},
+{1, 0},
+{0, 11},
+{0, 11},
+{0, 11},
+{0, 11},
+{0, 11},
+// numerator = 12
+{-1, -3},
+{-1, -2},
+{-1, -1},
+{-1, 0},
+{-2, -10},
+{-2, -8},
+{-2, -6},
+{-2, -4},
+{-2, -2},
+{-2, 0},
+{-3, -3},
+{-3, 0},
+{-4, 0},
+{-6, 0},
+{-12, 0},
+{0, 0},
+{12, 0},
+{6, 0},
+{4, 0},
+{3, 0},
+{2, 2},
+{2, 0},
+{1, 5},
+{1, 4},
+{1, 3},
+{1, 2},
+{1, 1},
+{1, 0},
+{0, 12},
+{0, 12},
+{0, 12},
+{0, 12},
+// numerator = 13
+{-1, -2},
+{-1, -1},
+{-1, 0},
+{-2, -11},
+{-2, -9},
+{-2, -7},
+{-2, -5},
+{-2, -3},
+{-2, -1},
+{-3, -5},
+{-3, -2},
+{-4, -3},
+{-5, -2},
+{-7, -1},
+{-13, 0},
+{0, 0},
+{13, 0},
+{6, 1},
+{4, 1},
+{3, 1},
+{2, 3},
+{2, 1},
+{1, 6},
+{1, 5},
+{1, 4},
+{1, 3},
+{1, 2},
+{1, 1},
+{1, 0},
+{0, 13},
+{0, 13},
+{0, 13},
+// numerator = 14
+{-1, -1},
+{-1, 0},
+{-2, -12},
+{-2, -10},
+{-2, -8},
+{-2, -6},
+{-2, -4},
+{-2, -2},
+{-2, 0},
+{-3, -4},
+{-3, -1},
+{-4, -2},
+{-5, -1},
+{-7, 0},
+{-14, 0},
+{0, 0},
+{14, 0},
+{7, 0},
+{4, 2},
+{3, 2},
+{2, 4},
+{2, 2},
+{2, 0},
+{1, 6},
+{1, 5},
+{1, 4},
+{1, 3},
+{1, 2},
+{1, 1},
+{1, 0},
+{0, 14},
+{0, 14},
+// numerator = 15
+{-1, 0},
+{-2, -13},
+{-2, -11},
+{-2, -9},
+{-2, -7},
+{-2, -5},
+{-2, -3},
+{-2, -1},
+{-3, -6},
+{-3, -3},
+{-3, 0},
+{-4, -1},
+{-5, 0},
+{-8, -1},
+{-15, 0},
+{0, 0},
+{15, 0},
+{7, 1},
+{5, 0},
+{3, 3},
+{3, 0},
+{2, 3},
+{2, 1},
+{1, 7},
+{1, 6},
+{1, 5},
+{1, 4},
+{1, 3},
+{1, 2},
+{1, 1},
+{1, 0},
+{0, 15},
+// numerator = 16
+{-2, -14},
+{-2, -12},
+{-2, -10},
+{-2, -8},
+{-2, -6},
+{-2, -4},
+{-2, -2},
+{-2, 0},
+{-3, -5},
+{-3, -2},
+{-4, -4},
+{-4, 0},
+{-6, -2},
+{-8, 0},
+{-16, 0},
+{0, 0},
+{16, 0},
+{8, 0},
+{5, 1},
+{4, 0},
+{3, 1},
+{2, 4},
+{2, 2},
+{2, 0},
+{1, 7},
+{1, 6},
+{1, 5},
+{1, 4},
+{1, 3},
+{1, 2},
+{1, 1},
+{1, 0},
diff --git a/r17/Revamped src/revamped_src/anorm_dots.h b/r17/Revamped src/revamped_src/anorm_dots.h
new file mode 100755
index 00000000..2abea606
--- /dev/null
+++ b/r17/Revamped src/revamped_src/anorm_dots.h
@@ -0,0 +1,37 @@
+/*
+Copyright (C) 1996-1997 Id Software, Inc.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+{
+{1.23,1.30,1.47,1.35,1.56,1.71,1.37,1.38,1.59,1.60,1.79,1.97,1.88,1.92,1.79,1.02,0.93,1.07,0.82,0.87,0.88,0.94,0.96,1.14,1.11,0.82,0.83,0.89,0.89,0.86,0.94,0.91,1.00,1.21,0.98,1.48,1.30,1.57,0.96,1.07,1.14,1.60,1.61,1.40,1.37,1.72,1.78,1.79,1.93,1.99,1.90,1.68,1.71,1.86,1.60,1.68,1.78,1.86,1.93,1.99,1.97,1.44,1.22,1.49,0.93,0.99,0.99,1.23,1.22,1.44,1.49,0.89,0.89,0.97,0.91,0.98,1.19,0.82,0.76,0.82,0.71,0.72,0.73,0.76,0.79,0.86,0.83,0.72,0.76,0.76,0.89,0.82,0.89,0.82,0.89,0.91,0.83,0.96,1.14,0.97,1.40,1.19,0.98,0.94,1.00,1.07,1.37,1.21,1.48,1.30,1.57,1.61,1.37,0.86,0.83,0.91,0.82,0.82,0.88,0.89,0.96,1.14,0.98,0.87,0.93,0.94,1.02,1.30,1.07,1.35,1.38,1.11,1.56,1.92,1.79,1.79,1.59,1.60,1.72,1.90,1.79,0.80,0.85,0.79,0.93,0.80,0.85,0.77,0.74,0.72,0.77,0.74,0.72,0.70,0.70,0.71,0.76,0.73,0.79,0.79,0.73,0.76,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
+{1.26,1.26,1.48,1.23,1.50,1.71,1.14,1.19,1.38,1.46,1.64,1.94,1.87,1.84,1.71,1.02,0.92,1.00,0.79,0.85,0.84,0.91,0.90,0.98,0.99,0.77,0.77,0.83,0.82,0.79,0.86,0.84,0.92,0.99,0.91,1.24,1.03,1.33,0.88,0.94,0.97,1.41,1.39,1.18,1.11,1.51,1.61,1.59,1.80,1.91,1.76,1.54,1.65,1.76,1.70,1.70,1.85,1.85,1.97,1.99,1.93,1.28,1.09,1.39,0.92,0.97,0.99,1.18,1.26,1.52,1.48,0.83,0.85,0.90,0.88,0.93,1.00,0.77,0.73,0.78,0.72,0.71,0.74,0.75,0.79,0.86,0.81,0.75,0.81,0.79,0.96,0.88,0.94,0.86,0.93,0.92,0.85,1.08,1.33,1.05,1.55,1.31,1.01,1.05,1.27,1.31,1.60,1.47,1.70,1.54,1.76,1.76,1.57,0.93,0.90,0.99,0.88,0.88,0.95,0.97,1.11,1.39,1.20,0.92,0.97,1.01,1.10,1.39,1.22,1.51,1.58,1.32,1.64,1.97,1.85,1.91,1.77,1.74,1.88,1.99,1.91,0.79,0.86,0.80,0.94,0.84,0.88,0.74,0.74,0.71,0.82,0.77,0.76,0.70,0.73,0.72,0.73,0.70,0.74,0.85,0.77,0.82,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
+{1.34,1.27,1.53,1.17,1.46,1.71,0.98,1.05,1.20,1.34,1.48,1.86,1.82,1.71,1.62,1.09,0.94,0.99,0.79,0.85,0.82,0.90,0.87,0.93,0.96,0.76,0.74,0.79,0.76,0.74,0.79,0.78,0.85,0.92,0.85,1.00,0.93,1.06,0.81,0.86,0.89,1.16,1.12,0.97,0.95,1.28,1.38,1.35,1.60,1.77,1.57,1.33,1.50,1.58,1.69,1.63,1.82,1.74,1.91,1.92,1.80,1.04,0.97,1.21,0.90,0.93,0.97,1.05,1.21,1.48,1.37,0.77,0.80,0.84,0.85,0.88,0.92,0.73,0.71,0.74,0.74,0.71,0.75,0.73,0.79,0.84,0.78,0.79,0.86,0.81,1.05,0.94,0.99,0.90,0.95,0.92,0.86,1.24,1.44,1.14,1.59,1.34,1.02,1.27,1.50,1.49,1.80,1.69,1.86,1.72,1.87,1.80,1.69,1.00,0.98,1.23,0.95,0.96,1.09,1.16,1.37,1.63,1.46,0.99,1.10,1.25,1.24,1.51,1.41,1.67,1.77,1.55,1.72,1.95,1.89,1.98,1.91,1.86,1.97,1.99,1.94,0.81,0.89,0.85,0.98,0.90,0.94,0.75,0.78,0.73,0.89,0.83,0.82,0.72,0.77,0.76,0.72,0.70,0.71,0.91,0.83,0.89,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
+{1.46,1.34,1.60,1.16,1.46,1.71,0.94,0.99,1.05,1.26,1.33,1.74,1.76,1.57,1.54,1.23,0.98,1.05,0.83,0.89,0.84,0.92,0.87,0.91,0.96,0.78,0.74,0.79,0.72,0.72,0.75,0.76,0.80,0.88,0.83,0.94,0.87,0.95,0.76,0.80,0.82,0.97,0.96,0.89,0.88,1.08,1.11,1.10,1.37,1.59,1.37,1.07,1.27,1.34,1.57,1.45,1.69,1.55,1.77,1.79,1.60,0.93,0.90,0.99,0.86,0.87,0.93,0.96,1.07,1.35,1.18,0.73,0.76,0.77,0.81,0.82,0.85,0.70,0.71,0.72,0.78,0.73,0.77,0.73,0.79,0.82,0.76,0.83,0.90,0.84,1.18,0.98,1.03,0.92,0.95,0.90,0.86,1.32,1.45,1.15,1.53,1.27,0.99,1.42,1.65,1.58,1.93,1.83,1.94,1.81,1.88,1.74,1.70,1.19,1.17,1.44,1.11,1.15,1.36,1.41,1.61,1.81,1.67,1.22,1.34,1.50,1.42,1.65,1.61,1.82,1.91,1.75,1.80,1.89,1.89,1.98,1.99,1.94,1.98,1.92,1.87,0.86,0.95,0.92,1.14,0.98,1.03,0.79,0.84,0.77,0.97,0.90,0.89,0.76,0.82,0.82,0.74,0.72,0.71,0.98,0.89,0.97,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
+{1.60,1.44,1.68,1.22,1.49,1.71,0.93,0.99,0.99,1.23,1.22,1.60,1.68,1.44,1.49,1.40,1.14,1.19,0.89,0.96,0.89,0.97,0.89,0.91,0.98,0.82,0.76,0.82,0.71,0.72,0.73,0.76,0.79,0.86,0.83,0.91,0.83,0.89,0.72,0.76,0.76,0.89,0.89,0.82,0.82,0.98,0.96,0.97,1.14,1.40,1.19,0.94,1.00,1.07,1.37,1.21,1.48,1.30,1.57,1.61,1.37,0.86,0.83,0.91,0.82,0.82,0.88,0.89,0.96,1.14,0.98,0.70,0.72,0.73,0.77,0.76,0.79,0.70,0.72,0.71,0.82,0.77,0.80,0.74,0.79,0.80,0.74,0.87,0.93,0.85,1.23,1.02,1.02,0.93,0.93,0.87,0.85,1.30,1.35,1.07,1.38,1.11,0.94,1.47,1.71,1.56,1.97,1.88,1.92,1.79,1.79,1.59,1.60,1.30,1.35,1.56,1.37,1.38,1.59,1.60,1.79,1.92,1.79,1.48,1.57,1.72,1.61,1.78,1.79,1.93,1.99,1.90,1.86,1.78,1.86,1.93,1.99,1.97,1.90,1.79,1.72,0.94,1.07,1.00,1.37,1.21,1.30,0.86,0.91,0.83,1.14,0.98,0.96,0.82,0.88,0.89,0.79,0.76,0.73,1.07,0.94,1.11,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
+{1.74,1.57,1.76,1.33,1.54,1.71,0.94,1.05,0.99,1.26,1.16,1.46,1.60,1.34,1.46,1.59,1.37,1.37,0.97,1.11,0.96,1.10,0.95,0.94,1.08,0.89,0.82,0.88,0.72,0.76,0.75,0.80,0.80,0.88,0.87,0.91,0.83,0.87,0.72,0.76,0.74,0.83,0.84,0.78,0.79,0.96,0.89,0.92,0.98,1.23,1.05,0.86,0.92,0.95,1.11,0.98,1.22,1.03,1.34,1.42,1.14,0.79,0.77,0.84,0.78,0.76,0.82,0.82,0.89,0.97,0.90,0.70,0.71,0.71,0.73,0.72,0.74,0.73,0.76,0.72,0.86,0.81,0.82,0.76,0.79,0.77,0.73,0.90,0.95,0.86,1.18,1.03,0.98,0.92,0.90,0.83,0.84,1.19,1.17,0.98,1.15,0.97,0.89,1.42,1.65,1.44,1.93,1.83,1.81,1.67,1.61,1.36,1.41,1.32,1.45,1.58,1.57,1.53,1.74,1.70,1.88,1.94,1.81,1.69,1.77,1.87,1.79,1.89,1.92,1.98,1.99,1.98,1.89,1.65,1.80,1.82,1.91,1.94,1.75,1.61,1.50,1.07,1.34,1.27,1.60,1.45,1.55,0.93,0.99,0.90,1.35,1.18,1.07,0.87,0.93,0.96,0.85,0.82,0.77,1.15,0.99,1.27,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
+{1.86,1.71,1.82,1.48,1.62,1.71,0.98,1.20,1.05,1.34,1.17,1.34,1.53,1.27,1.46,1.77,1.60,1.57,1.16,1.38,1.12,1.35,1.06,1.00,1.28,0.97,0.89,0.95,0.76,0.81,0.79,0.86,0.85,0.92,0.93,0.93,0.85,0.87,0.74,0.78,0.74,0.79,0.82,0.76,0.79,0.96,0.85,0.90,0.94,1.09,0.99,0.81,0.85,0.89,0.95,0.90,0.99,0.94,1.10,1.24,0.98,0.75,0.73,0.78,0.74,0.72,0.77,0.76,0.82,0.89,0.83,0.73,0.71,0.71,0.71,0.70,0.72,0.77,0.80,0.74,0.90,0.85,0.84,0.78,0.79,0.75,0.73,0.92,0.95,0.86,1.05,0.99,0.94,0.90,0.86,0.79,0.81,1.00,0.98,0.91,0.96,0.89,0.83,1.27,1.50,1.23,1.80,1.69,1.63,1.46,1.37,1.09,1.16,1.24,1.44,1.49,1.69,1.59,1.80,1.69,1.87,1.86,1.72,1.82,1.91,1.94,1.92,1.95,1.99,1.98,1.91,1.97,1.89,1.51,1.72,1.67,1.77,1.86,1.55,1.41,1.25,1.33,1.58,1.50,1.80,1.63,1.74,1.04,1.21,0.97,1.48,1.37,1.21,0.93,0.97,1.05,0.92,0.88,0.84,1.14,1.02,1.34,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
+{1.94,1.84,1.87,1.64,1.71,1.71,1.14,1.38,1.19,1.46,1.23,1.26,1.48,1.26,1.50,1.91,1.80,1.76,1.41,1.61,1.39,1.59,1.33,1.24,1.51,1.18,0.97,1.11,0.82,0.88,0.86,0.94,0.92,0.99,1.03,0.98,0.91,0.90,0.79,0.84,0.77,0.79,0.84,0.77,0.83,0.99,0.85,0.91,0.92,1.02,1.00,0.79,0.80,0.86,0.88,0.84,0.92,0.88,0.97,1.10,0.94,0.74,0.71,0.74,0.72,0.70,0.73,0.72,0.76,0.82,0.77,0.77,0.73,0.74,0.71,0.70,0.73,0.83,0.85,0.78,0.92,0.88,0.86,0.81,0.79,0.74,0.75,0.92,0.93,0.85,0.96,0.94,0.88,0.86,0.81,0.75,0.79,0.93,0.90,0.85,0.88,0.82,0.77,1.05,1.27,0.99,1.60,1.47,1.39,1.20,1.11,0.95,0.97,1.08,1.33,1.31,1.70,1.55,1.76,1.57,1.76,1.70,1.54,1.85,1.97,1.91,1.99,1.97,1.99,1.91,1.77,1.88,1.85,1.39,1.64,1.51,1.58,1.74,1.32,1.22,1.01,1.54,1.76,1.65,1.93,1.70,1.85,1.28,1.39,1.09,1.52,1.48,1.26,0.97,0.99,1.18,1.00,0.93,0.90,1.05,1.01,1.31,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
+{1.97,1.92,1.88,1.79,1.79,1.71,1.37,1.59,1.38,1.60,1.35,1.23,1.47,1.30,1.56,1.99,1.93,1.90,1.60,1.78,1.61,1.79,1.57,1.48,1.72,1.40,1.14,1.37,0.89,0.96,0.94,1.07,1.00,1.21,1.30,1.14,0.98,0.96,0.86,0.91,0.83,0.82,0.88,0.82,0.89,1.11,0.87,0.94,0.93,1.02,1.07,0.80,0.79,0.85,0.82,0.80,0.87,0.85,0.93,1.02,0.93,0.77,0.72,0.74,0.71,0.70,0.70,0.71,0.72,0.77,0.74,0.82,0.76,0.79,0.72,0.73,0.76,0.89,0.89,0.82,0.93,0.91,0.86,0.83,0.79,0.73,0.76,0.91,0.89,0.83,0.89,0.89,0.82,0.82,0.76,0.72,0.76,0.86,0.83,0.79,0.82,0.76,0.73,0.94,1.00,0.91,1.37,1.21,1.14,0.98,0.96,0.88,0.89,0.96,1.14,1.07,1.60,1.40,1.61,1.37,1.57,1.48,1.30,1.78,1.93,1.79,1.99,1.92,1.90,1.79,1.59,1.72,1.79,1.30,1.56,1.35,1.38,1.60,1.11,1.07,0.94,1.68,1.86,1.71,1.97,1.68,1.86,1.44,1.49,1.22,1.44,1.49,1.22,0.99,0.99,1.23,1.19,0.98,0.97,0.97,0.98,1.19,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
+{1.94,1.97,1.87,1.91,1.85,1.71,1.60,1.77,1.58,1.74,1.51,1.26,1.48,1.39,1.64,1.99,1.97,1.99,1.70,1.85,1.76,1.91,1.76,1.70,1.88,1.55,1.33,1.57,0.96,1.08,1.05,1.31,1.27,1.47,1.54,1.39,1.20,1.11,0.93,0.99,0.90,0.88,0.95,0.88,0.97,1.32,0.92,1.01,0.97,1.10,1.22,0.84,0.80,0.88,0.79,0.79,0.85,0.86,0.92,1.02,0.94,0.82,0.76,0.77,0.72,0.73,0.70,0.72,0.71,0.74,0.74,0.88,0.81,0.85,0.75,0.77,0.82,0.94,0.93,0.86,0.92,0.92,0.86,0.85,0.79,0.74,0.79,0.88,0.85,0.81,0.82,0.83,0.77,0.78,0.73,0.71,0.75,0.79,0.77,0.74,0.77,0.73,0.70,0.86,0.92,0.84,1.14,0.99,0.98,0.91,0.90,0.84,0.83,0.88,0.97,0.94,1.41,1.18,1.39,1.11,1.33,1.24,1.03,1.61,1.80,1.59,1.91,1.84,1.76,1.64,1.38,1.51,1.71,1.26,1.50,1.23,1.19,1.46,0.99,1.00,0.91,1.70,1.85,1.65,1.93,1.54,1.76,1.52,1.48,1.26,1.28,1.39,1.09,0.99,0.97,1.18,1.31,1.01,1.05,0.90,0.93,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
+{1.86,1.95,1.82,1.98,1.89,1.71,1.80,1.91,1.77,1.86,1.67,1.34,1.53,1.51,1.72,1.92,1.91,1.99,1.69,1.82,1.80,1.94,1.87,1.86,1.97,1.59,1.44,1.69,1.05,1.24,1.27,1.49,1.50,1.69,1.72,1.63,1.46,1.37,1.00,1.23,0.98,0.95,1.09,0.96,1.16,1.55,0.99,1.25,1.10,1.24,1.41,0.90,0.85,0.94,0.79,0.81,0.85,0.89,0.94,1.09,0.98,0.89,0.82,0.83,0.74,0.77,0.72,0.76,0.73,0.75,0.78,0.94,0.86,0.91,0.79,0.83,0.89,0.99,0.95,0.90,0.90,0.92,0.84,0.86,0.79,0.75,0.81,0.85,0.80,0.78,0.76,0.77,0.73,0.74,0.71,0.71,0.73,0.74,0.74,0.71,0.76,0.72,0.70,0.79,0.85,0.78,0.98,0.92,0.93,0.85,0.87,0.82,0.79,0.81,0.89,0.86,1.16,0.97,1.12,0.95,1.06,1.00,0.93,1.38,1.60,1.35,1.77,1.71,1.57,1.48,1.20,1.28,1.62,1.27,1.46,1.17,1.05,1.34,0.96,0.99,0.90,1.63,1.74,1.50,1.80,1.33,1.58,1.48,1.37,1.21,1.04,1.21,0.97,0.97,0.93,1.05,1.34,1.02,1.14,0.84,0.88,0.92,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
+{1.74,1.89,1.76,1.98,1.89,1.71,1.93,1.99,1.91,1.94,1.82,1.46,1.60,1.65,1.80,1.79,1.77,1.92,1.57,1.69,1.74,1.87,1.88,1.94,1.98,1.53,1.45,1.70,1.18,1.32,1.42,1.58,1.65,1.83,1.81,1.81,1.67,1.61,1.19,1.44,1.17,1.11,1.36,1.15,1.41,1.75,1.22,1.50,1.34,1.42,1.61,0.98,0.92,1.03,0.83,0.86,0.89,0.95,0.98,1.23,1.14,0.97,0.89,0.90,0.78,0.82,0.76,0.82,0.77,0.79,0.84,0.98,0.90,0.98,0.83,0.89,0.97,1.03,0.95,0.92,0.86,0.90,0.82,0.86,0.79,0.77,0.84,0.81,0.76,0.76,0.72,0.73,0.70,0.72,0.71,0.73,0.73,0.72,0.74,0.71,0.78,0.74,0.72,0.75,0.80,0.76,0.94,0.88,0.91,0.83,0.87,0.84,0.79,0.76,0.82,0.80,0.97,0.89,0.96,0.88,0.95,0.94,0.87,1.11,1.37,1.10,1.59,1.57,1.37,1.33,1.05,1.08,1.54,1.34,1.46,1.16,0.99,1.26,0.96,1.05,0.92,1.45,1.55,1.27,1.60,1.07,1.34,1.35,1.18,1.07,0.93,0.99,0.90,0.93,0.87,0.96,1.27,0.99,1.15,0.77,0.82,0.85,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
+{1.60,1.78,1.68,1.93,1.86,1.71,1.97,1.99,1.99,1.97,1.93,1.60,1.68,1.78,1.86,1.61,1.57,1.79,1.37,1.48,1.59,1.72,1.79,1.92,1.90,1.38,1.35,1.60,1.23,1.30,1.47,1.56,1.71,1.88,1.79,1.92,1.79,1.79,1.30,1.56,1.35,1.37,1.59,1.38,1.60,1.90,1.48,1.72,1.57,1.61,1.79,1.21,1.00,1.30,0.89,0.94,0.96,1.07,1.14,1.40,1.37,1.14,0.96,0.98,0.82,0.88,0.82,0.89,0.83,0.86,0.91,1.02,0.93,1.07,0.87,0.94,1.11,1.02,0.93,0.93,0.82,0.87,0.80,0.85,0.79,0.80,0.85,0.77,0.72,0.74,0.71,0.70,0.70,0.71,0.72,0.77,0.74,0.72,0.76,0.73,0.82,0.79,0.76,0.73,0.79,0.76,0.93,0.86,0.91,0.83,0.89,0.89,0.82,0.72,0.76,0.76,0.89,0.82,0.89,0.82,0.89,0.91,0.83,0.96,1.14,0.97,1.40,1.44,1.19,1.22,0.99,0.98,1.49,1.44,1.49,1.22,0.99,1.23,0.98,1.19,0.97,1.21,1.30,1.00,1.37,0.94,1.07,1.14,0.98,0.96,0.86,0.91,0.83,0.88,0.82,0.89,1.11,0.94,1.07,0.73,0.76,0.79,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
+{1.46,1.65,1.60,1.82,1.80,1.71,1.93,1.91,1.99,1.94,1.98,1.74,1.76,1.89,1.89,1.42,1.34,1.61,1.11,1.22,1.36,1.50,1.61,1.81,1.75,1.15,1.17,1.41,1.18,1.19,1.42,1.44,1.65,1.83,1.67,1.94,1.81,1.88,1.32,1.58,1.45,1.57,1.74,1.53,1.70,1.98,1.69,1.87,1.77,1.79,1.92,1.45,1.27,1.55,0.97,1.07,1.11,1.34,1.37,1.59,1.60,1.35,1.07,1.18,0.86,0.93,0.87,0.96,0.90,0.93,0.99,1.03,0.95,1.15,0.90,0.99,1.27,0.98,0.90,0.92,0.78,0.83,0.77,0.84,0.79,0.82,0.86,0.73,0.71,0.73,0.72,0.70,0.73,0.72,0.76,0.81,0.76,0.76,0.82,0.77,0.89,0.85,0.82,0.75,0.80,0.80,0.94,0.88,0.94,0.87,0.95,0.96,0.88,0.72,0.74,0.76,0.83,0.78,0.84,0.79,0.87,0.91,0.83,0.89,0.98,0.92,1.23,1.34,1.05,1.16,0.99,0.96,1.46,1.57,1.54,1.33,1.05,1.26,1.08,1.37,1.10,0.98,1.03,0.92,1.14,0.86,0.95,0.97,0.90,0.89,0.79,0.84,0.77,0.82,0.76,0.82,0.97,0.89,0.98,0.71,0.72,0.74,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
+{1.34,1.51,1.53,1.67,1.72,1.71,1.80,1.77,1.91,1.86,1.98,1.86,1.82,1.95,1.89,1.24,1.10,1.41,0.95,0.99,1.09,1.25,1.37,1.63,1.55,0.96,0.98,1.16,1.05,1.00,1.27,1.23,1.50,1.69,1.46,1.86,1.72,1.87,1.24,1.49,1.44,1.69,1.80,1.59,1.69,1.97,1.82,1.94,1.91,1.92,1.99,1.63,1.50,1.74,1.16,1.33,1.38,1.58,1.60,1.77,1.80,1.48,1.21,1.37,0.90,0.97,0.93,1.05,0.97,1.04,1.21,0.99,0.95,1.14,0.92,1.02,1.34,0.94,0.86,0.90,0.74,0.79,0.75,0.81,0.79,0.84,0.86,0.71,0.71,0.73,0.76,0.73,0.77,0.74,0.80,0.85,0.78,0.81,0.89,0.84,0.97,0.92,0.88,0.79,0.85,0.86,0.98,0.92,1.00,0.93,1.06,1.12,0.95,0.74,0.74,0.78,0.79,0.76,0.82,0.79,0.87,0.93,0.85,0.85,0.94,0.90,1.09,1.27,0.99,1.17,1.05,0.96,1.46,1.71,1.62,1.48,1.20,1.34,1.28,1.57,1.35,0.90,0.94,0.85,0.98,0.81,0.89,0.89,0.83,0.82,0.75,0.78,0.73,0.77,0.72,0.76,0.89,0.83,0.91,0.71,0.70,0.72,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00},
+{1.26,1.39,1.48,1.51,1.64,1.71,1.60,1.58,1.77,1.74,1.91,1.94,1.87,1.97,1.85,1.10,0.97,1.22,0.88,0.92,0.95,1.01,1.11,1.39,1.32,0.88,0.90,0.97,0.96,0.93,1.05,0.99,1.27,1.47,1.20,1.70,1.54,1.76,1.08,1.31,1.33,1.70,1.76,1.55,1.57,1.88,1.85,1.91,1.97,1.99,1.99,1.70,1.65,1.85,1.41,1.54,1.61,1.76,1.80,1.91,1.93,1.52,1.26,1.48,0.92,0.99,0.97,1.18,1.09,1.28,1.39,0.94,0.93,1.05,0.92,1.01,1.31,0.88,0.81,0.86,0.72,0.75,0.74,0.79,0.79,0.86,0.85,0.71,0.73,0.75,0.82,0.77,0.83,0.78,0.85,0.88,0.81,0.88,0.97,0.90,1.18,1.00,0.93,0.86,0.92,0.94,1.14,0.99,1.24,1.03,1.33,1.39,1.11,0.79,0.77,0.84,0.79,0.77,0.84,0.83,0.90,0.98,0.91,0.85,0.92,0.91,1.02,1.26,1.00,1.23,1.19,0.99,1.50,1.84,1.71,1.64,1.38,1.46,1.51,1.76,1.59,0.84,0.88,0.80,0.94,0.79,0.86,0.82,0.77,0.76,0.74,0.74,0.71,0.73,0.70,0.72,0.82,0.77,0.85,0.74,0.70,0.73,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00,1.00}
+}
diff --git a/r17/Revamped src/revamped_src/anorms.h b/r17/Revamped src/revamped_src/anorms.h
new file mode 100755
index 00000000..88042267
--- /dev/null
+++ b/r17/Revamped src/revamped_src/anorms.h
@@ -0,0 +1,181 @@
+/*
+Copyright (C) 1996-1997 Id Software, Inc.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+{-0.525731, 0.000000, 0.850651},
+{-0.442863, 0.238856, 0.864188},
+{-0.295242, 0.000000, 0.955423},
+{-0.309017, 0.500000, 0.809017},
+{-0.162460, 0.262866, 0.951056},
+{0.000000, 0.000000, 1.000000},
+{0.000000, 0.850651, 0.525731},
+{-0.147621, 0.716567, 0.681718},
+{0.147621, 0.716567, 0.681718},
+{0.000000, 0.525731, 0.850651},
+{0.309017, 0.500000, 0.809017},
+{0.525731, 0.000000, 0.850651},
+{0.295242, 0.000000, 0.955423},
+{0.442863, 0.238856, 0.864188},
+{0.162460, 0.262866, 0.951056},
+{-0.681718, 0.147621, 0.716567},
+{-0.809017, 0.309017, 0.500000},
+{-0.587785, 0.425325, 0.688191},
+{-0.850651, 0.525731, 0.000000},
+{-0.864188, 0.442863, 0.238856},
+{-0.716567, 0.681718, 0.147621},
+{-0.688191, 0.587785, 0.425325},
+{-0.500000, 0.809017, 0.309017},
+{-0.238856, 0.864188, 0.442863},
+{-0.425325, 0.688191, 0.587785},
+{-0.716567, 0.681718, -0.147621},
+{-0.500000, 0.809017, -0.309017},
+{-0.525731, 0.850651, 0.000000},
+{0.000000, 0.850651, -0.525731},
+{-0.238856, 0.864188, -0.442863},
+{0.000000, 0.955423, -0.295242},
+{-0.262866, 0.951056, -0.162460},
+{0.000000, 1.000000, 0.000000},
+{0.000000, 0.955423, 0.295242},
+{-0.262866, 0.951056, 0.162460},
+{0.238856, 0.864188, 0.442863},
+{0.262866, 0.951056, 0.162460},
+{0.500000, 0.809017, 0.309017},
+{0.238856, 0.864188, -0.442863},
+{0.262866, 0.951056, -0.162460},
+{0.500000, 0.809017, -0.309017},
+{0.850651, 0.525731, 0.000000},
+{0.716567, 0.681718, 0.147621},
+{0.716567, 0.681718, -0.147621},
+{0.525731, 0.850651, 0.000000},
+{0.425325, 0.688191, 0.587785},
+{0.864188, 0.442863, 0.238856},
+{0.688191, 0.587785, 0.425325},
+{0.809017, 0.309017, 0.500000},
+{0.681718, 0.147621, 0.716567},
+{0.587785, 0.425325, 0.688191},
+{0.955423, 0.295242, 0.000000},
+{1.000000, 0.000000, 0.000000},
+{0.951056, 0.162460, 0.262866},
+{0.850651, -0.525731, 0.000000},
+{0.955423, -0.295242, 0.000000},
+{0.864188, -0.442863, 0.238856},
+{0.951056, -0.162460, 0.262866},
+{0.809017, -0.309017, 0.500000},
+{0.681718, -0.147621, 0.716567},
+{0.850651, 0.000000, 0.525731},
+{0.864188, 0.442863, -0.238856},
+{0.809017, 0.309017, -0.500000},
+{0.951056, 0.162460, -0.262866},
+{0.525731, 0.000000, -0.850651},
+{0.681718, 0.147621, -0.716567},
+{0.681718, -0.147621, -0.716567},
+{0.850651, 0.000000, -0.525731},
+{0.809017, -0.309017, -0.500000},
+{0.864188, -0.442863, -0.238856},
+{0.951056, -0.162460, -0.262866},
+{0.147621, 0.716567, -0.681718},
+{0.309017, 0.500000, -0.809017},
+{0.425325, 0.688191, -0.587785},
+{0.442863, 0.238856, -0.864188},
+{0.587785, 0.425325, -0.688191},
+{0.688191, 0.587785, -0.425325},
+{-0.147621, 0.716567, -0.681718},
+{-0.309017, 0.500000, -0.809017},
+{0.000000, 0.525731, -0.850651},
+{-0.525731, 0.000000, -0.850651},
+{-0.442863, 0.238856, -0.864188},
+{-0.295242, 0.000000, -0.955423},
+{-0.162460, 0.262866, -0.951056},
+{0.000000, 0.000000, -1.000000},
+{0.295242, 0.000000, -0.955423},
+{0.162460, 0.262866, -0.951056},
+{-0.442863, -0.238856, -0.864188},
+{-0.309017, -0.500000, -0.809017},
+{-0.162460, -0.262866, -0.951056},
+{0.000000, -0.850651, -0.525731},
+{-0.147621, -0.716567, -0.681718},
+{0.147621, -0.716567, -0.681718},
+{0.000000, -0.525731, -0.850651},
+{0.309017, -0.500000, -0.809017},
+{0.442863, -0.238856, -0.864188},
+{0.162460, -0.262866, -0.951056},
+{0.238856, -0.864188, -0.442863},
+{0.500000, -0.809017, -0.309017},
+{0.425325, -0.688191, -0.587785},
+{0.716567, -0.681718, -0.147621},
+{0.688191, -0.587785, -0.425325},
+{0.587785, -0.425325, -0.688191},
+{0.000000, -0.955423, -0.295242},
+{0.000000, -1.000000, 0.000000},
+{0.262866, -0.951056, -0.162460},
+{0.000000, -0.850651, 0.525731},
+{0.000000, -0.955423, 0.295242},
+{0.238856, -0.864188, 0.442863},
+{0.262866, -0.951056, 0.162460},
+{0.500000, -0.809017, 0.309017},
+{0.716567, -0.681718, 0.147621},
+{0.525731, -0.850651, 0.000000},
+{-0.238856, -0.864188, -0.442863},
+{-0.500000, -0.809017, -0.309017},
+{-0.262866, -0.951056, -0.162460},
+{-0.850651, -0.525731, 0.000000},
+{-0.716567, -0.681718, -0.147621},
+{-0.716567, -0.681718, 0.147621},
+{-0.525731, -0.850651, 0.000000},
+{-0.500000, -0.809017, 0.309017},
+{-0.238856, -0.864188, 0.442863},
+{-0.262866, -0.951056, 0.162460},
+{-0.864188, -0.442863, 0.238856},
+{-0.809017, -0.309017, 0.500000},
+{-0.688191, -0.587785, 0.425325},
+{-0.681718, -0.147621, 0.716567},
+{-0.442863, -0.238856, 0.864188},
+{-0.587785, -0.425325, 0.688191},
+{-0.309017, -0.500000, 0.809017},
+{-0.147621, -0.716567, 0.681718},
+{-0.425325, -0.688191, 0.587785},
+{-0.162460, -0.262866, 0.951056},
+{0.442863, -0.238856, 0.864188},
+{0.162460, -0.262866, 0.951056},
+{0.309017, -0.500000, 0.809017},
+{0.147621, -0.716567, 0.681718},
+{0.000000, -0.525731, 0.850651},
+{0.425325, -0.688191, 0.587785},
+{0.587785, -0.425325, 0.688191},
+{0.688191, -0.587785, 0.425325},
+{-0.955423, 0.295242, 0.000000},
+{-0.951056, 0.162460, 0.262866},
+{-1.000000, 0.000000, 0.000000},
+{-0.850651, 0.000000, 0.525731},
+{-0.955423, -0.295242, 0.000000},
+{-0.951056, -0.162460, 0.262866},
+{-0.864188, 0.442863, -0.238856},
+{-0.951056, 0.162460, -0.262866},
+{-0.809017, 0.309017, -0.500000},
+{-0.864188, -0.442863, -0.238856},
+{-0.951056, -0.162460, -0.262866},
+{-0.809017, -0.309017, -0.500000},
+{-0.681718, 0.147621, -0.716567},
+{-0.681718, -0.147621, -0.716567},
+{-0.850651, 0.000000, -0.525731},
+{-0.688191, 0.587785, -0.425325},
+{-0.587785, 0.425325, -0.688191},
+{-0.425325, 0.688191, -0.587785},
+{-0.425325, -0.688191, -0.587785},
+{-0.587785, -0.425325, -0.688191},
+{-0.688191, -0.587785, -0.425325},
diff --git a/r17/Revamped src/revamped_src/asm_i386.h b/r17/Revamped src/revamped_src/asm_i386.h
new file mode 100755
index 00000000..c7c7ca99
--- /dev/null
+++ b/r17/Revamped src/revamped_src/asm_i386.h
@@ -0,0 +1,97 @@
+/*
+Copyright (C) 1996-1997 Id Software, Inc.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __ASM_I386__
+#define __ASM_I386__
+
+#ifdef ELF
+#define C(label) label
+#else
+#define C(label) _##label
+#endif
+
+//
+// !!! note that this file must match the corresponding C structures at all
+// times !!!
+//
+
+// plane_t structure
+// !!! if this is changed, it must be changed in model.h too !!!
+// !!! if the size of this is changed, the array lookup in SV_HullPointContents
+// must be changed too !!!
+#define pl_normal 0
+#define pl_dist 12
+#define pl_type 16
+#define pl_signbits 17
+#define pl_pad 18
+#define pl_size 20
+
+// hull_t structure
+// !!! if this is changed, it must be changed in model.h too !!!
+#define hu_clipnodes 0
+#define hu_planes 4
+#define hu_firstclipnode 8
+#define hu_lastclipnode 12
+#define hu_clip_mins 16
+#define hu_clip_maxs 28
+#define hu_size 40
+
+// dnode_t structure
+// !!! if this is changed, it must be changed in bspfile.h too !!!
+#define nd_planenum 0
+#define nd_children 4
+#define nd_mins 8
+#define nd_maxs 20
+#define nd_firstface 32
+#define nd_numfaces 36
+#define nd_size 40
+
+// sfxcache_t structure
+// !!! if this is changed, it much be changed in sound.h too !!!
+#define sfxc_length 0
+#define sfxc_loopstart 4
+#define sfxc_speed 8
+#define sfxc_width 12
+#define sfxc_stereo 16
+#define sfxc_data 20
+
+// channel_t structure
+// !!! if this is changed, it much be changed in sound.h too !!!
+#define ch_sfx 0
+#define ch_leftvol 4
+#define ch_rightvol 8
+#define ch_end 12
+#define ch_pos 16
+#define ch_looping 20
+#define ch_entnum 24
+#define ch_entchannel 28
+#define ch_origin 32
+#define ch_dist_mult 44
+#define ch_master_vol 48
+#define ch_size 52
+
+// portable_samplepair_t structure
+// !!! if this is changed, it much be changed in sound.h too !!!
+#define psp_left 0
+#define psp_right 4
+#define psp_size 8
+
+#endif
+
diff --git a/r17/Revamped src/revamped_src/block16.h b/r17/Revamped src/revamped_src/block16.h
new file mode 100755
index 00000000..facc9329
--- /dev/null
+++ b/r17/Revamped src/revamped_src/block16.h
@@ -0,0 +1,142 @@
+/*
+Copyright (C) 1996-1997 Id Software, Inc.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+LEnter16_16:
+ movb (%esi),%al
+ movb (%esi,%ebx,),%cl
+ movb %dh,%ah
+ addl %ebp,%edx
+ movb %dh,%ch
+ leal (%esi,%ebx,2),%esi
+ movw 0x12345678(,%eax,2),%ax
+LBPatch0:
+ addl %ebp,%edx
+ movw %ax,(%edi)
+ movw 0x12345678(,%ecx,2),%cx
+LBPatch1:
+ movw %cx,2(%edi)
+ addl $0x4,%edi
+
+ movb (%esi),%al
+ movb (%esi,%ebx,),%cl
+ movb %dh,%ah
+ addl %ebp,%edx
+ movb %dh,%ch
+ leal (%esi,%ebx,2),%esi
+ movw 0x12345678(,%eax,2),%ax
+LBPatch2:
+ addl %ebp,%edx
+ movw %ax,(%edi)
+ movw 0x12345678(,%ecx,2),%cx
+LBPatch3:
+ movw %cx,2(%edi)
+ addl $0x4,%edi
+
+ movb (%esi),%al
+ movb (%esi,%ebx,),%cl
+ movb %dh,%ah
+ addl %ebp,%edx
+ movb %dh,%ch
+ leal (%esi,%ebx,2),%esi
+ movw 0x12345678(,%eax,2),%ax
+LBPatch4:
+ addl %ebp,%edx
+ movw %ax,(%edi)
+ movw 0x12345678(,%ecx,2),%cx
+LBPatch5:
+ movw %cx,2(%edi)
+ addl $0x4,%edi
+
+ movb (%esi),%al
+ movb (%esi,%ebx,),%cl
+ movb %dh,%ah
+ addl %ebp,%edx
+ movb %dh,%ch
+ leal (%esi,%ebx,2),%esi
+ movw 0x12345678(,%eax,2),%ax
+LBPatch6:
+ addl %ebp,%edx
+ movw %ax,(%edi)
+ movw 0x12345678(,%ecx,2),%cx
+LBPatch7:
+ movw %cx,2(%edi)
+ addl $0x4,%edi
+
+LEnter8_16:
+ movb (%esi),%al
+ movb (%esi,%ebx,),%cl
+ movb %dh,%ah
+ addl %ebp,%edx
+ movb %dh,%ch
+ leal (%esi,%ebx,2),%esi
+ movw 0x12345678(,%eax,2),%ax
+LBPatch8:
+ addl %ebp,%edx
+ movw %ax,(%edi)
+ movw 0x12345678(,%ecx,2),%cx
+LBPatch9:
+ movw %cx,2(%edi)
+ addl $0x4,%edi
+
+ movb (%esi),%al
+ movb (%esi,%ebx,),%cl
+ movb %dh,%ah
+ addl %ebp,%edx
+ movb %dh,%ch
+ leal (%esi,%ebx,2),%esi
+ movw 0x12345678(,%eax,2),%ax
+LBPatch10:
+ addl %ebp,%edx
+ movw %ax,(%edi)
+ movw 0x12345678(,%ecx,2),%cx
+LBPatch11:
+ movw %cx,2(%edi)
+ addl $0x4,%edi
+
+LEnter4_16:
+ movb (%esi),%al
+ movb (%esi,%ebx,),%cl
+ movb %dh,%ah
+ addl %ebp,%edx
+ movb %dh,%ch
+ leal (%esi,%ebx,2),%esi
+ movw 0x12345678(,%eax,2),%ax
+LBPatch12:
+ addl %ebp,%edx
+ movw %ax,(%edi)
+ movw 0x12345678(,%ecx,2),%cx
+LBPatch13:
+ movw %cx,2(%edi)
+ addl $0x4,%edi
+
+LEnter2_16:
+ movb (%esi),%al
+ movb (%esi,%ebx,),%cl
+ movb %dh,%ah
+ addl %ebp,%edx
+ movb %dh,%ch
+ leal (%esi,%ebx,2),%esi
+ movw 0x12345678(,%eax,2),%ax
+LBPatch14:
+ addl %ebp,%edx
+ movw %ax,(%edi)
+ movw 0x12345678(,%ecx,2),%cx
+LBPatch15:
+ movw %cx,2(%edi)
+ addl $0x4,%edi
diff --git a/r17/Revamped src/revamped_src/bspfile.h b/r17/Revamped src/revamped_src/bspfile.h
new file mode 100755
index 00000000..91499c8a
--- /dev/null
+++ b/r17/Revamped src/revamped_src/bspfile.h
@@ -0,0 +1,324 @@
+/*
+Copyright (C) 1996-1997 Id Software, Inc.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+
+// upper design bounds
+
+#define MAX_MAP_HULLS 4
+
+#define MAX_MAP_MODELS 256
+#define MAX_MAP_BRUSHES 4096
+#define MAX_MAP_ENTITIES 1024
+#define MAX_MAP_ENTSTRING 65536
+
+#define MAX_MAP_PLANES 32767
+#define MAX_MAP_NODES 32767 // because negative shorts are contents
+#define MAX_MAP_CLIPNODES 32767 //
+#define MAX_MAP_LEAFS 8192
+#define MAX_MAP_VERTS 65535
+#define MAX_MAP_FACES 65535
+#define MAX_MAP_MARKSURFACES 65535
+#define MAX_MAP_TEXINFO 4096
+#define MAX_MAP_EDGES 256000
+#define MAX_MAP_SURFEDGES 512000
+#define MAX_MAP_TEXTURES 512
+#define MAX_MAP_MIPTEX 0x200000
+#define MAX_MAP_LIGHTING 0x100000
+#define MAX_MAP_VISIBILITY 0x100000
+
+#define MAX_MAP_PORTALS 65536
+
+// key / value pair sizes
+
+#define MAX_KEY 32
+#define MAX_VALUE 1024
+
+//=============================================================================
+
+
+#define BSPVERSION 29
+#define TOOLVERSION 2
+
+typedef struct
+{
+ int fileofs, filelen;
+} lump_t;
+
+#define LUMP_ENTITIES 0
+#define LUMP_PLANES 1
+#define LUMP_TEXTURES 2
+#define LUMP_VERTEXES 3
+#define LUMP_VISIBILITY 4
+#define LUMP_NODES 5
+#define LUMP_TEXINFO 6
+#define LUMP_FACES 7
+#define LUMP_LIGHTING 8
+#define LUMP_CLIPNODES 9
+#define LUMP_LEAFS 10
+#define LUMP_MARKSURFACES 11
+#define LUMP_EDGES 12
+#define LUMP_SURFEDGES 13
+#define LUMP_MODELS 14
+
+#define HEADER_LUMPS 15
+
+typedef struct
+{
+ float mins[3], maxs[3];
+ float origin[3];
+ int headnode[MAX_MAP_HULLS];
+ int visleafs; // not including the solid leaf 0
+ int firstface, numfaces;
+} dmodel_t;
+
+typedef struct
+{
+ int version;
+ lump_t lumps[HEADER_LUMPS];
+} dheader_t;
+
+typedef struct
+{
+ int nummiptex;
+ int dataofs[4]; // [nummiptex]
+} dmiptexlump_t;
+
+#define MIPLEVELS 4
+typedef struct miptex_s
+{
+ char name[16];
+ unsigned width, height;
+ unsigned offsets[MIPLEVELS]; // four mip maps stored
+} miptex_t;
+
+
+typedef struct
+{
+ float point[3];
+} dvertex_t;
+
+
+// 0-2 are axial planes
+#define PLANE_X 0
+#define PLANE_Y 1
+#define PLANE_Z 2
+
+// 3-5 are non-axial planes snapped to the nearest
+#define PLANE_ANYX 3
+#define PLANE_ANYY 4
+#define PLANE_ANYZ 5
+
+typedef struct
+{
+ float normal[3];
+ float dist;
+ int type; // PLANE_X - PLANE_ANYZ ?remove? trivial to regenerate
+} dplane_t;
+
+
+
+#define CONTENTS_EMPTY -1
+#define CONTENTS_SOLID -2
+#define CONTENTS_WATER -3
+#define CONTENTS_SLIME -4
+#define CONTENTS_LAVA -5
+#define CONTENTS_SKY -6
+#define CONTENTS_ORIGIN -7 // removed at csg time
+#define CONTENTS_CLIP -8 // changed to contents_solid
+
+#define CONTENTS_CURRENT_0 -9
+#define CONTENTS_CURRENT_90 -10
+#define CONTENTS_CURRENT_180 -11
+#define CONTENTS_CURRENT_270 -12
+#define CONTENTS_CURRENT_UP -13
+#define CONTENTS_CURRENT_DOWN -14
+
+
+// !!! if this is changed, it must be changed in asm_i386.h too !!!
+typedef struct
+{
+ int planenum;
+ short children[2]; // negative numbers are -(leafs+1), not nodes
+ short mins[3]; // for sphere culling
+ short maxs[3];
+ unsigned short firstface;
+ unsigned short numfaces; // counting both sides
+} dnode_t;
+
+typedef struct
+{
+ int planenum;
+ short children[2]; // negative numbers are contents
+} dclipnode_t;
+
+
+typedef struct texinfo_s
+{
+ float vecs[2][4]; // [s/t][xyz offset]
+ int miptex;
+ int flags;
+} texinfo_t;
+#define TEX_SPECIAL 1 // sky or slime, no lightmap or 256 subdivision
+
+// note that edge 0 is never used, because negative edge nums are used for
+// counterclockwise use of the edge in a face
+typedef struct
+{
+ unsigned short v[2]; // vertex numbers
+} dedge_t;
+
+#define MAXLIGHTMAPS 4
+typedef struct
+{
+ short planenum;
+ short side;
+
+ int firstedge; // we must support > 64k edges
+ short numedges;
+ short texinfo;
+
+// lighting info
+ byte styles[MAXLIGHTMAPS];
+ int lightofs; // start of [numstyles*surfsize] samples
+} dface_t;
+
+
+
+#define AMBIENT_WATER 0
+#define AMBIENT_SKY 1
+#define AMBIENT_SLIME 2
+#define AMBIENT_LAVA 3
+
+#define NUM_AMBIENTS 4 // automatic ambient sounds
+
+// leaf 0 is the generic CONTENTS_SOLID leaf, used for all solid areas
+// all other leafs need visibility info
+typedef struct
+{
+ int contents;
+ int visofs; // -1 = no visibility info
+
+ short mins[3]; // for frustum culling
+ short maxs[3];
+
+ unsigned short firstmarksurface;
+ unsigned short nummarksurfaces;
+
+ byte ambient_level[NUM_AMBIENTS];
+} dleaf_t;
+
+
+//============================================================================
+
+#ifndef QUAKE_GAME
+
+#define ANGLE_UP -1
+#define ANGLE_DOWN -2
+
+
+// the utilities get to be lazy and just use large static arrays
+
+extern int nummodels;
+extern dmodel_t dmodels[MAX_MAP_MODELS];
+
+extern int visdatasize;
+extern byte dvisdata[MAX_MAP_VISIBILITY];
+
+extern int lightdatasize;
+extern byte dlightdata[MAX_MAP_LIGHTING];
+
+extern int texdatasize;
+extern byte dtexdata[MAX_MAP_MIPTEX]; // (dmiptexlump_t)
+
+extern int entdatasize;
+extern char dentdata[MAX_MAP_ENTSTRING];
+
+extern int numleafs;
+extern dleaf_t dleafs[MAX_MAP_LEAFS];
+
+extern int numplanes;
+extern dplane_t dplanes[MAX_MAP_PLANES];
+
+extern int numvertexes;
+extern dvertex_t dvertexes[MAX_MAP_VERTS];
+
+extern int numnodes;
+extern dnode_t dnodes[MAX_MAP_NODES];
+
+extern int numtexinfo;
+extern texinfo_t texinfo[MAX_MAP_TEXINFO];
+
+extern int numfaces;
+extern dface_t dfaces[MAX_MAP_FACES];
+
+extern int numclipnodes;
+extern dclipnode_t dclipnodes[MAX_MAP_CLIPNODES];
+
+extern int numedges;
+extern dedge_t dedges[MAX_MAP_EDGES];
+
+extern int nummarksurfaces;
+extern unsigned short dmarksurfaces[MAX_MAP_MARKSURFACES];
+
+extern int numsurfedges;
+extern int dsurfedges[MAX_MAP_SURFEDGES];
+
+
+void DecompressVis (byte *in, byte *decompressed);
+int CompressVis (byte *vis, byte *dest);
+
+void LoadBSPFile (char *filename);
+void WriteBSPFile (char *filename);
+void PrintBSPFileSizes (void);
+
+//===============
+
+
+typedef struct epair_s
+{
+ struct epair_s *next;
+ char *key;
+ char *value;
+} epair_t;
+
+typedef struct
+{
+ vec3_t origin;
+ int firstbrush;
+ int numbrushes;
+ epair_t *epairs;
+} entity_t;
+
+extern int num_entities;
+extern entity_t entities[MAX_MAP_ENTITIES];
+
+void ParseEntities (void);
+void UnparseEntities (void);
+
+void SetKeyValue (entity_t *ent, char *key, char *value);
+char *ValueForKey (entity_t *ent, char *key);
+// will return "" if not present
+
+vec_t FloatForKey (entity_t *ent, char *key);
+void GetVectorForKey (entity_t *ent, char *key, vec3_t vec);
+
+epair_t *ParseEpair (void);
+
+#endif
diff --git a/r17/Revamped src/revamped_src/build.bat b/r17/Revamped src/revamped_src/build.bat
new file mode 100755
index 00000000..8b033928
--- /dev/null
+++ b/r17/Revamped src/revamped_src/build.bat
@@ -0,0 +1,4 @@
+rem set PATH=C:/cygwin/usr/local/pspdev/bin;%PATH%
+set PSPSDK=C:/cygwin/usr/local/pspdev
+set PSP_MOUNT=/cygdrive/p
+c:\cygwin\bin\bash -c 'export VS_PATH=`pwd`; /bin/bash --login -c "cd \"$VS_PATH\"; ./sed_make.sh %1 %2 %3 %4 %5 %6"'
diff --git a/r17/Revamped src/revamped_src/cd_null.c b/r17/Revamped src/revamped_src/cd_null.c
new file mode 100755
index 00000000..c78da42d
--- /dev/null
+++ b/r17/Revamped src/revamped_src/cd_null.c
@@ -0,0 +1,55 @@
+/*
+Copyright (C) 1996-1997 Id Software, Inc.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+#include "quakedef.h"
+
+void CDAudio_Play(byte track, qboolean looping)
+{
+}
+
+
+void CDAudio_Stop(void)
+{
+}
+
+
+void CDAudio_Pause(void)
+{
+}
+
+
+void CDAudio_Resume(void)
+{
+}
+
+
+void CDAudio_Update(void)
+{
+}
+
+
+int CDAudio_Init(void)
+{
+ return 0;
+}
+
+
+void CDAudio_Shutdown(void)
+{
+}
diff --git a/r17/Revamped src/revamped_src/cdaudio.h b/r17/Revamped src/revamped_src/cdaudio.h
new file mode 100755
index 00000000..30dfd30a
--- /dev/null
+++ b/r17/Revamped src/revamped_src/cdaudio.h
@@ -0,0 +1,27 @@
+/*
+Copyright (C) 1996-1997 Id Software, Inc.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+int CDAudio_Init(void);
+void CDAudio_Play(byte track, qboolean looping);
+void CDAudio_Stop(void);
+void CDAudio_Pause(void);
+void CDAudio_Resume(void);
+void CDAudio_Shutdown(void);
+void CDAudio_Update(void);
diff --git a/r17/Revamped src/revamped_src/chase.c b/r17/Revamped src/revamped_src/chase.c
new file mode 100755
index 00000000..5a47c9f5
--- /dev/null
+++ b/r17/Revamped src/revamped_src/chase.c
@@ -0,0 +1,125 @@
+/*
+Copyright (C) 1996-1997 Id Software, Inc.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+// chase.c -- chase camera code
+
+#include "quakedef.h"
+
+cvar_t chase_back = {"chase_back", "100", true};
+cvar_t chase_up = {"chase_up", "16", true};
+cvar_t chase_right = {"chase_right", "0", true};
+cvar_t chase_active = {"chase_active", "0", false};
+cvar_t chase_roll = {"chase_roll", "0"};
+cvar_t chase_yaw = {"chase_yaw", "180"};
+cvar_t chase_pitch = {"chase_pitch", "45"};
+
+vec3_t chase_pos;
+vec3_t chase_angles;
+
+vec3_t chase_dest;
+vec3_t chase_dest_angles;
+
+
+void Chase_Init (void)
+{
+ Cvar_RegisterVariable (&chase_back);
+ Cvar_RegisterVariable (&chase_up);
+ Cvar_RegisterVariable (&chase_right);
+ Cvar_RegisterVariable (&chase_active);
+ Cvar_RegisterVariable (&chase_roll);
+ Cvar_RegisterVariable (&chase_yaw);
+ Cvar_RegisterVariable (&chase_pitch);
+
+}
+
+void Chase_Reset (void)
+{
+ // for respawning and teleporting
+// start position 12 units behind head
+}
+
+void TraceLine (vec3_t start, vec3_t end, vec3_t impact)
+{
+ trace_t trace;
+
+ memset (&trace, 0, sizeof(trace));
+ SV_RecursiveHullCheck (cl.worldmodel->hulls, 0, 0, 1, start, end, &trace);
+
+ VectorCopy (trace.endpos, impact);
+}
+
+
+void Chase_Update (void)
+{
+ int i;
+ float dist;
+ vec3_t forward, up, right;
+ vec3_t dest, stop;
+
+ if ((int)chase_active.value != 2)
+ {
+ // if can't see player, reset
+ AngleVectors (cl.viewangles, forward, right, up);
+
+ // calc exact destination
+ for (i=0 ; i<3 ; i++)
+ chase_dest[i] = r_refdef.vieworg[i]
+ - forward[i]*chase_back.value
+ - right[i]*chase_right.value;
+ chase_dest[2] = r_refdef.vieworg[2] + chase_up.value;
+
+ // find the spot the player is looking at
+ VectorMA (r_refdef.vieworg, 4096, forward, dest);
+ TraceLine (r_refdef.vieworg, dest, stop);
+
+ // calculate pitch to look at the same spot from camera
+ VectorSubtract (stop, r_refdef.vieworg, stop);
+ dist = DotProduct (stop, forward);
+ if (dist < 1)
+ dist = 1;
+
+ r_refdef.viewangles[PITCH] = -atan(stop[2] / dist) / M_PI * 180;
+
+ TraceLine(r_refdef.vieworg, chase_dest, stop);
+ if (Length(stop) != 0)
+ VectorCopy(stop, chase_dest);
+
+ // move towards destination
+ VectorCopy (chase_dest, r_refdef.vieworg);
+ }
+ else
+ {
+ chase_dest[0] = r_refdef.vieworg[0] + chase_back.value;
+ chase_dest[1] = r_refdef.vieworg[1] + chase_right.value;
+ chase_dest[2] = r_refdef.vieworg[2] + chase_up.value;
+
+ // this is from the chasecam fix - start
+ TraceLine (r_refdef.vieworg, chase_dest, stop);
+ if (Length (stop) != 0)
+ {
+ VectorCopy (stop, chase_dest);
+ }
+ // this is from the chasecam fix - end
+
+ VectorCopy (chase_dest, r_refdef.vieworg);
+ r_refdef.viewangles[ROLL] = chase_roll.value;
+ r_refdef.viewangles[YAW] = chase_yaw.value;
+ r_refdef.viewangles[PITCH] = chase_pitch.value;
+ }
+}
\ No newline at end of file
diff --git a/r17/Revamped src/revamped_src/cl_demo.c b/r17/Revamped src/revamped_src/cl_demo.c
new file mode 100755
index 00000000..b82147f8
--- /dev/null
+++ b/r17/Revamped src/revamped_src/cl_demo.c
@@ -0,0 +1,380 @@
+/*
+Copyright (C) 1996-1997 Id Software, Inc.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+#include "quakedef.h"
+
+void CL_FinishTimeDemo (void);
+
+/*
+==============================================================================
+
+DEMO CODE
+
+When a demo is playing back, all NET_SendMessages are skipped, and
+NET_GetMessages are read from the demo file.
+
+Whenever cl.time gets past the last received message, another message is
+read from the demo file.
+==============================================================================
+*/
+
+/*
+==============
+CL_StopPlayback
+
+Called when a demo file runs out, or the user starts a game
+==============
+*/
+void CL_StopPlayback (void)
+{
+ if (!cls.demoplayback)
+ return;
+
+ Sys_FileClose(cls.demofile);
+ cls.demoplayback = false;
+ cls.demofile = -1;
+ cls.state = ca_disconnected;
+
+ if (cls.timedemo)
+ CL_FinishTimeDemo ();
+}
+
+/*
+====================
+CL_WriteDemoMessage
+
+Dumps the current net message, prefixed by the length and view angles
+====================
+*/
+void CL_WriteDemoMessage (void)
+{
+ int len;
+ int i;
+ float f;
+
+ len = LittleLong (net_message.cursize);
+ Sys_FileWrite(cls.demofile, &len, 4);
+ for (i=0 ; i<3 ; i++)
+ {
+ f = LittleFloat (cl.viewangles[i]);
+ Sys_FileWrite(cls.demofile, &f, 4);
+ }
+ Sys_FileWrite(cls.demofile, net_message.data, net_message.cursize);
+}
+
+/*
+====================
+CL_GetMessage
+
+Handles recording and playback of demos, on top of NET_ code
+====================
+*/
+int CL_GetMessage (void)
+{
+ int r, i;
+ float f;
+
+ if (cls.demoplayback)
+ {
+ // decide if it is time to grab the next message
+ if (cls.signon == SIGNONS) // allways grab until fully connected
+ {
+ if (cls.timedemo)
+ {
+ if (host_framecount == cls.td_lastframe)
+ return 0; // allready read this frame's message
+ cls.td_lastframe = host_framecount;
+ // if this is the second frame, grab the real td_starttime
+ // so the bogus time on the first frame doesn't count
+ if (host_framecount == cls.td_startframe + 1)
+ cls.td_starttime = realtime;
+ }
+ else if ( /* cl.time > 0 && */ cl.time <= cl.mtime[0])
+ {
+ return 0; // don't need another message yet
+ }
+ }
+
+ // get the next message
+ Sys_FileRead(cls.demofile, &net_message.cursize, 4);
+ VectorCopy (cl.mviewangles[0], cl.mviewangles[1]);
+ for (i=0 ; i<3 ; i++)
+ {
+ r = Sys_FileRead(cls.demofile, &f, 4) / 4;
+ cl.mviewangles[0][i] = LittleFloat (f);
+ }
+
+ net_message.cursize = LittleLong (net_message.cursize);
+ if (net_message.cursize > MAX_MSGLEN)
+ Sys_Error ("Demo message (0x%08x) > MAX_MSGLEN (%d)", net_message.cursize, MAX_MSGLEN);
+ r = Sys_FileRead(cls.demofile, net_message.data, net_message.cursize) / net_message.cursize;
+ if (r != 1)
+ {
+ CL_StopPlayback ();
+ return 0;
+ }
+
+ return 1;
+ }
+
+ while (1)
+ {
+ r = NET_GetMessage (cls.netcon);
+
+ if (r != 1 && r != 2)
+ return r;
+
+ // discard nop keepalive message
+ if (net_message.cursize == 1 && net_message.data[0] == svc_nop)
+ Con_Printf ("<-- server to client keepalive\n");
+ else
+ break;
+ }
+
+ if (cls.demorecording)
+ CL_WriteDemoMessage ();
+
+ return r;
+}
+
+
+/*
+====================
+CL_Stop_f
+
+stop recording a demo
+====================
+*/
+void CL_Stop_f (void)
+{
+ if (cmd_source != src_command)
+ return;
+
+ if (!cls.demorecording)
+ {
+ Con_Printf ("Not recording a demo.\n");
+ return;
+ }
+
+// write a disconnect message to the demo file
+ SZ_Clear (&net_message);
+ MSG_WriteByte (&net_message, svc_disconnect);
+ CL_WriteDemoMessage ();
+
+// finish up
+ Sys_FileClose(cls.demofile);
+ cls.demofile = -1;
+ cls.demorecording = false;
+ Con_Printf ("Completed demo\n");
+}
+
+/*
+====================
+CL_Record_f
+
+record