djcev.com

//

Git Repos / fte_dogmode / qc / monsters / oldone.qc

Last update to this file was on 2024-06-15 at 19:50.

Show oldone.qc

//==============================================================================
// OLD ONE
//==============================================================================

//======================================================================
// forward declarations
//======================================================================

// monster_oldone
void(vector dir) monster_oldone_finale1;// endgame
void() monster_oldone_finale2;
void() monster_oldone_finale3;
void() monster_oldone_finale4;
// void() old_stand; // animation & thinking
void() old_idle1; void() old_idle2; void() old_idle3; void() old_idle4;
void() old_idle5; void() old_idle6; void() old_idle7; void() old_idle8;
void() old_idle9; void() old_idle10; void() old_idle11; void() old_idle12;
void() old_idle13; void() old_idle14; void() old_idle15; void() old_idle16;
void() old_idle17; void() old_idle18; void() old_idle19; void() old_idle20;
void() old_idle21; void() old_idle22; void() old_idle23; void() old_idle24;
void() old_idle25; void() old_idle26; void() old_idle27; void() old_idle28;
void() old_idle29; void() old_idle30; void() old_idle31; void() old_idle32;
void() old_idle33; void() old_idle34; void() old_idle35; void() old_idle36;
void() old_idle37; void() old_idle38; void() old_idle39; void() old_idle40;
void() old_idle41; void() old_idle42; void() old_idle43; void() old_idle44;
void() old_idle45; void() old_idle46;
void() old_thrash1; void() old_thrash2; void() old_thrash3; void() old_thrash4;
void() old_thrash5; void() old_thrash6; void() old_thrash7; void() old_thrash8;
void() old_thrash9; void() old_thrash10; void() old_thrash11;
void() old_thrash12; void() old_thrash13; void() old_thrash14;
void() old_thrash15; void() old_thrash16; void() old_thrash17;
void() old_thrash18; void() old_thrash19; void() old_thrash20;
void(entity attacker, float damage) monster_oldone_pain; // interaction
void(vector dir) monster_oldone_destroy;
void(entity e) monster_oldone_init;
void() monster_oldone;

//======================================================================
// frame macros
//======================================================================

$cd id1/models/old_one
$origin 0 0 24
$base base
$skin skin
$scale 1

$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 shake13 shake14
$frame shake15 shake16 shake17 shake18 shake19 shake20

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

/*QUAKED monster_oldone (1 0 0) (-160 -128 -24) (160 128 256)
*/
//----------------------------------------------------------------------
// class monster_oldone: base_walkmonster
// {
//--------------------------------------------------------------
void(vector dir) monster_oldone_finale1 =
{
local entity pos, pl;
local entity timer;

// 1998-07-30 Shub kill count fix by Maddes start
killed_monsters = killed_monsters + 1;
// FIXME: reliable broadcast
WriteByte (MSG_ALL, SVC_KILLEDMONSTER);
// 1998-07-30 Shub kill count fix by Maddes end

// never allow exit
intermission_exittime = time + 10000000;
intermission = 1;
WriteIntermission ();

// find the intermission spot
pos = findfloat (world, classtype, CT_INFO_INTERMISSION);
if (!pos)
error ("no info_intermission");
pl = findfloat (world, classtype, CT_MISC_TELEPORTTRAIN);
if (!pl)
error ("no teleporttrain");
remove (pl);

WriteByte (MSG_ALL, SVC_FINALE);
WriteString (MSG_ALL, "");

pl = findfloat (world, classtype, CT_PLAYER);
while (pl != world)
{
pl.view_ofs = '0 0 0';
pl.angles = other.v_angle = pos.mangle;
// turn this way immediately
pl.fixangle = TRUE;
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 = findfloat (pl, classtype, CT_PLAYER);
}

// make fake versions of all players as standins, and
// move the real players to the intermission spot

// wait for 1 second
// TODO CEV rework into a class outside of moster_oldone?
timer = spawn ();
timer.enemy = self;
setorigin (timer, self.origin);
timer.think = monster_oldone_finale2;
timer.nextthink = time + 1;
};

//--------------------------------------------------------------
void() monster_oldone_finale2 =
{
local vector o;

// start a teleport splash inside shub

o = self.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 (self.enemy, CHAN_VOICE, "misc/r_tele1.wav",
VOL_HIGH, ATTN_NORM);

self.nextthink = time + 2;
self.think = monster_oldone_finale3;
};

//--------------------------------------------------------------
void() monster_oldone_finale3 =
{
// start shub thrashing wildly
self.enemy.think = old_thrash1;
sound_death (self.enemy, CHAN_VOICE, "boss2/death.wav",
VOL_HIGH, ATTN_NORM);
lightstyle (0, "abcdefghijklmlkjihgfedcb");
};

//--------------------------------------------------------------
void() monster_oldone_finale4 =
{
// throw tons of meat chunks
local vector oldo;
local vector dir = '0 0 0';
local float x, y, z;
local float r;
local entity n;

sound_misc (self, CHAN_VOICE, "boss2/pop2.wav",
VOL_HIGH, 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)
throw_gib_1 (self, dir, -999);
else if (r < 0.6)
throw_gib_2 (self, dir, -999);
else
throw_gib_3 (self, dir, -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\n"
"her hundreds of ugly changelings and\n"
"monsters. You have proven that your\n"
"skill and your cunning are greater than\n"
"all the powers of Quake. You are the\n"
"master 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;

// switch cd track
WriteByte (MSG_ALL, SVC_CDTRACK);
WriteByte (MSG_ALL, 3);
WriteByte (MSG_ALL, 3);
lightstyle (0, "m");

remove (self);
};

//--------------------------------------------------------------
// Shub Stand function
//--------------------------------------------------------------
// void() old_stand = [$old1, old_stand] { };

//--------------------------------------------------------------
// Shub Idle functions
//--------------------------------------------------------------
void() old_idle1 = [$old1, old_idle2] { };
void() old_idle2 = [$old2, old_idle3] { };
void() old_idle3 = [$old3, old_idle4] { };
void() old_idle4 = [$old4, old_idle5] { };
void() old_idle5 = [$old5, old_idle6] { };
void() old_idle6 = [$old6, old_idle7] { };
void() old_idle7 = [$old7, old_idle8] { };
void() old_idle8 = [$old8, old_idle9] { };
void() old_idle9 = [$old9, old_idle10] { };
void() old_idle10 = [$old10, old_idle11] { };
void() old_idle11 = [$old11, old_idle12] { };
void() old_idle12 = [$old12, old_idle13] { };
void() old_idle13 = [$old13, old_idle14] { };
void() old_idle14 = [$old14, old_idle15] { };
void() old_idle15 = [$old15, old_idle16] { };
void() old_idle16 = [$old16, old_idle17] { };
void() old_idle17 = [$old17, old_idle18] { };
void() old_idle18 = [$old18, old_idle19] { };
void() old_idle19 = [$old19, old_idle20] { };
void() old_idle20 = [$old20, old_idle21] { };
void() old_idle21 = [$old21, old_idle22] { };
void() old_idle22 = [$old22, old_idle23] { };
void() old_idle23 = [$old23, old_idle24] { };
void() old_idle24 = [$old24, old_idle25] { };
void() old_idle25 = [$old25, old_idle26] { };
void() old_idle26 = [$old26, old_idle27] { };
void() old_idle27 = [$old27, old_idle28] { };
void() old_idle28 = [$old28, old_idle29] { };
void() old_idle29 = [$old29, old_idle30] { };
void() old_idle30 = [$old30, old_idle31] { };
void() old_idle31 = [$old31, old_idle32] { };
void() old_idle32 = [$old32, old_idle33] { };
void() old_idle33 = [$old33, old_idle34] { };
void() old_idle34 = [$old34, old_idle35] { };
void() old_idle35 = [$old35, old_idle36] { };
void() old_idle36 = [$old36, old_idle37] { };
void() old_idle37 = [$old37, old_idle38] { };
void() old_idle38 = [$old38, old_idle39] { };
void() old_idle39 = [$old39, old_idle40] { };
void() old_idle40 = [$old40, old_idle41] { };
void() old_idle41 = [$old41, old_idle42] { };
void() old_idle42 = [$old42, old_idle43] { };
void() old_idle43 = [$old43, old_idle44] { };
void() old_idle44 = [$old44, old_idle45] { };
void() old_idle45 = [$old45, old_idle46] { };
void() old_idle46 = [$old46, old_idle1] { };

//--------------------------------------------------------------
// Shub Thrashing
//--------------------------------------------------------------
void() old_thrash1 = [$shake1, old_thrash2] { lightstyle (0, "m"); };
void() old_thrash2 = [$shake2, old_thrash3] { lightstyle (0, "k"); };
void() old_thrash3 = [$shake3, old_thrash4] { lightstyle (0, "k"); };
void() old_thrash4 = [$shake4, old_thrash5] { lightstyle (0, "i"); };
void() old_thrash5 = [$shake5, old_thrash6] { lightstyle (0, "g"); };
void() old_thrash6 = [$shake6, old_thrash7] { lightstyle (0, "e"); };
void() old_thrash7 = [$shake7, old_thrash8] { lightstyle (0, "c"); };
void() old_thrash8 = [$shake8, old_thrash9] { lightstyle (0, "a"); };
void() old_thrash9 = [$shake9, old_thrash10] { lightstyle (0, "c"); };
void() old_thrash10 = [$shake10, old_thrash11] { lightstyle (0, "e"); };
void() old_thrash11 = [$shake11, old_thrash12] { lightstyle (0, "g"); };
void() old_thrash12 = [$shake12, old_thrash13] { lightstyle (0, "i"); };
void() old_thrash13 = [$shake13, old_thrash14] { lightstyle (0, "k"); };
void() old_thrash14 = [$shake14, old_thrash15] { lightstyle (0, "m"); };
void() old_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]
{
monster_oldone_finale4 ();
};

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

//--------------------------------------------------------------
// nopain
//--------------------------------------------------------------
void(entity attacker, float damage) monster_oldone_pain =
{
self.health = 40000;
};

//--------------------------------------------------------------
// shub_death
//
// The next function is from Than's Deathmatch Dimensions; I've
// cut-and-pasted it in here so I can play dmd8.bsp -- CEV
//
// Shub death treated more like a standard monster death for
// Deathmatch Dimension; Customised intermission message is
// handled in client.qc -- comment from DMD's QC source
//--------------------------------------------------------------
void(vector dir) monster_oldone_destroy =
{
self.solid = SOLID_NOT;
killed_monsters = killed_monsters + 1;
WriteByte (MSG_ALL, SVC_KILLEDMONSTER);

// Remove any teleporttrain in the map (will need one for
// vanilla progs to avoid error)
local entity tt;
tt = findfloat (world, classtype, CT_MISC_TELEPORTTRAIN);
if (tt)
remove (tt);

// throw tons of meat chunks
local vector oldo;
local float x, y, z;
local float r;
local float gibpow;

sound (self, CHAN_VOICE, "boss2/pop2.wav",
VOL_HIGH, ATTN_NORM);

oldo = self.origin;
gibpow = -160;

z = 16;
while (z <= 144)
{
x = -64;
while (x <= 64)
{
y = -64;
while (y <= 64)
{
self.origin_x = oldo_x + x;
self.origin_y = oldo_y + y;
self.origin_z = oldo_z + z;

r = random ();
if (r < 0.3)
throw_gib_1 (self, dir, gibpow);
else if (r < 0.6)
throw_gib_2 (self, dir, gibpow);
else
throw_gib_3 (self, dir, gibpow);
y = y + 32;
}
x = x + 32;
}
z = z + 96;
}

remove (self);
};

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

//--------------------------------------------------------------
void(entity e) monster_oldone_init =
{
if (e.spawnflags & I_AM_TURRET)
objerror ("Incompatible spawnflag: TURRET_MODE\n");

if (deathmatch)
{
remove (e);
return;
}

e.classname = "monster_oldone";
e.classtype = CT_MONSTER_BOSS_OLDONE;
e.classgroup |= CG_MONSTER;
e.touch = base_monster_touch;
base_mapentity_init (e);

precache_body_model2 (e, "progs/oldone.mdl");
// precache_model2 ("progs/oldone.mdl");

precache_sound2_death (e, "boss2/death.wav");
// precache_sound2_idle ("boss2/idle.wav");
precache_sound2_sight (e, "boss2/sight.wav");
// next line silences a compiler warning -- CEV
precache_sound2 ("boss2/pop2.wav");
precache_sound2_misc (e, "boss2/pop2.wav");

e.solid = SOLID_SLIDEBOX;
e.movetype = MOVETYPE_STEP;

// custom_mdls dumptruck_ds
body_model (e, "progs/oldone.mdl");
// setmodel (e, "progs/oldone.mdl");
setsize (e, '-160 -128 -24', '160 128 256');

// kill by telefrag
e.health = 40000;
e.takedamage = DAMAGE_YES;
e.th_pain = monster_oldone_pain;
if (e.spawnflags & 2)
e.destroy = monster_oldone_destroy;
else
e.destroy = monster_oldone_finale1;

total_monsters = total_monsters + 1;
e.think = old_idle1;
e.nextthink = time + 0.1;
};

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

monster_oldone_init (self);
};
// };

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

Log oldone.qc

Date Commit Message Author + -
2024-06-15 Major update, committing as-is, will have bugs cev +8 -5
2024-04-12 Moveable gibs, heads, some bugfixes cev +11 -16
2024-04-08 Registered monsters, projectile bugfixes cev +188 -139
2024-01-31 Class based monster refactor & start projectiles cev +359 -320
2024-01-13 Refactored items into classes, fix teleporttrain cev +68 -7
2024-01-09 Continue OO / Class-based refactor cev +7 -1
2023-11-16 pmove bug fixes, moved q3 compat code, cleanup cev +3 -2
2023-10-13 New movement code based on SV_RunClientCommand cev +296 -296
2023-10-13 Rename "qc-server" dir to "qc" cev +296  

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