ew-progs/ew/compatibility.qc

485 lines
9.6 KiB
C++

/*
=============================
Compatibility.qc
coded by
Michael Rogers a.k.a Xsniper
ssj_xsniper@yahoo.com
xsniper.virtualave.net
Description:
This file's main purpose is to maintain compatibility with original quake 1 levels,
replacing their monsters with the new ones in Eternal War.
=============================
*/
//preprocessor directives <-- I think thats what its called ;)
void() monster_agath;
void() monster_apprentice;
void() monster_necromancer;
void() monster_captain;
void() monster_torment;
void() monster_carnivore;
void() monster_dweller;
void() monster_hhound;
void() monster_merca;
void() monster_mercs;
void() monster_mercx;
void() monster_outrider;
void() monster_scout;
void() monster_teneb;
void() monster_wraith;
//new precache functions
void() apprentice_precache;
void() necro_precache;
void() captain_precache;
void() torment_precache;
void() merca_precache;
void() mercs_precache;
void() outrider_precache;
void() scout_precache;
//ammo compatibility
void() ammo_update =
{
//update the vars used by the engine to display amount of ammo
self.ammo_shells = self.ammo_bolts;
self.ammo_nails = self.ammo_mana_blue;
self.ammo_rockets = self.ammo_mana_green;
self.ammo_cells = self.ammo_mana_grey;
};
void() monster_boss =
{
remove(self);
return;
};
void() monster_oldone =
{
remove(self);
return;
};
void() monster_shambler =
{
monster_agath();
};
void() monster_wizard =
{
//precache graphics and sounds for both monsters to avoid save game bug
apprentice_precache();
necro_precache();
//pick at random whether monster will be apprentice or necromancer
if (random() > 0.5)
monster_apprentice();
else
monster_necromancer();
};
void() monster_hell_knight =
{
//precache graphics and sounds for both monsters to avoid save game bug
captain_precache();
torment_precache();
//pick at random whether monster will be captain or torment
if (random() > 0.5)
monster_captain();
else
monster_torment();
};
void() monster_ogre =
{
monster_carnivore();
};
void() monster_zombie =
{
monster_dweller();
};
void() monster_dog =
{
monster_hhound();
};
void() monster_knight =
{
//precache graphics and sounds for both monsters to avoid save game bug
merca_precache();
mercs_precache();
//pick at random whether monster will be merca or mercs
if (random() > 0.5)
monster_merca();
else
monster_mercs();
};
void() monster_enforcer =
{
monster_mercx();
};
void() monster_army =
{
//precache graphics and sounds for both monsters to avoid save game bug
outrider_precache();
scout_precache();
//pick at random whether monster will be outrider or scout
if (random() > 0.5)
monster_outrider();
else
monster_scout();
};
void() monster_demon1 =
{
monster_teneb();
};
void() monster_shalrath =
{
monster_wraith();
};
void() monster_fish =
{
remove(self);
return;
};
void() monster_tarbaby =
{
remove(self);
return;
};
//laser stuff kept in here for original quake 1 trap compatibility
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 =
{
local vector vec;
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;
};
//Koolio, some stuff used for traps etc
/*
===============
launch_spike
Used for both the player and the ogre
===============
*/
void() spike_touch =
{
local float rand;
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 (9);
T_Damage (other, self, self.owner, 9);
}
else
{
WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
if (self.classname == "wizspike")
WriteByte (MSG_BROADCAST, TE_WIZSPIKE);
else if (self.classname == "knightspike")
WriteByte (MSG_BROADCAST, TE_KNIGHTSPIKE);
else
WriteByte (MSG_BROADCAST, TE_SPIKE);
WriteCoord (MSG_BROADCAST, self.origin_x);
WriteCoord (MSG_BROADCAST, self.origin_y);
WriteCoord (MSG_BROADCAST, self.origin_z);
}
remove(self);
};
void() superspike_touch =
{
local float rand;
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(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;
};
//noticed you removed this and I need it lol - Xsniper
/*
=================
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)
{
spawn_touchblood (18);
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)
{
spawn_touchblood (18);
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)
{
spawn_touchblood (18);
T_Damage (trace_ent, from, from, damage);
}
};
//Koolio, weapon pickup compatibility
void() weapon_supershotgun = { weapon_trinityblast();};
void() weapon_nailgun = { weapon_frozenshards();};
void() weapon_supernailgun = { weapon_lightningarc();};
void() weapon_grenadelauncher = { weapon_smite();};
void() weapon_rocketlauncher = { weapon_souldisc();};
void() weapon_lightning = { weapon_sword(); };
/*
Koolio, ammo compatibility
*/
/*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 ("models/items/g_bolt.md2");
setmodel (self, "models/items/g_bolt.md2");
self.aflag = 40;
self.scale = 1.5;
}
else
{
precache_model ("models/items/g_bolt.md2");
setmodel (self, "models/items/g_bolt.md2");
self.aflag = 20;
}
self.weapon = 1;
self.skin = 0;
self.netname = "crossbow bolts";
}
if (self.spawnflags & WEAPON_SPIKES)
{
if (self.spawnflags & WEAPON_BIG)
{
precache_model ("models/items/mana/flask.md2");
setmodel (self, "models/items/mana/flask.md2");
self.aflag = 50;
self.scale = 1.5;
}
else
{
precache_model ("models/items/mana/flask.md2");
setmodel (self, "models/items/mana/flask.md2");
self.aflag = 25;
}
self.skin = 1;
self.weapon = 2;
self.netname = "blue mana";
}
if (self.spawnflags & WEAPON_ROCKET)
{
if (self.spawnflags & WEAPON_BIG)
{
precache_model ("models/items/mana/flask.md2");
setmodel (self, "models/items/mana/flask.md2");
self.aflag = 10;
}
else
{
precache_model ("models/items/mana/flask.md2");
setmodel (self, "models/items/mana/flask.md2");
self.aflag = 5;
}
self.skin = 2;
self.weapon = 3;
self.netname = "green mana";
}
setsize (self, '0 0 0', '32 32 56');
StartItem ();
};
void() item_shells = { item_crossbow_ammo(); };
void() item_spikes = { item_mana_blue(); };
void() item_rockets = { item_mana_green(); };
void() item_cells = { item_mana_grey(); };