Compare commits

...

2 Commits

Author SHA1 Message Date
an 6857946b1a fix various weapon and item functions 2019-09-19 11:40:41 -04:00
an 661307339e move enums and constants around 2019-09-19 10:16:20 -04:00
20 changed files with 271 additions and 358 deletions

View File

@ -22,7 +22,7 @@ void() SetChangeParms = {
} }
// remove items // remove items
self.items = self.items - (self.items & (IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD)); self.items &= ~(IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD);
// cap super health // cap super health
if(self.health > 100) { if(self.health > 100) {
@ -55,7 +55,7 @@ void() SetNewParms = {
parm5 = 0; parm5 = 0;
parm6 = 0; parm6 = 0;
parm7 = 0; parm7 = 0;
parm8 = 1; parm8 = IT_SHOTGUN;
parm9 = 0; parm9 = 0;
}; };
@ -93,13 +93,11 @@ entity() FindIntermission = {
spot = find(world, classname, "info_intermission"); spot = find(world, classname, "info_intermission");
if(spot) { if(spot) {
// pick a random one // pick a random one
cyc = random() * 4; for(cyc = random() * 4; cyc > 1; cyc--) {
while(cyc > 1) {
spot = find(spot, classname, "info_intermission"); spot = find(spot, classname, "info_intermission");
if(!spot) { if(!spot) {
spot = find(spot, classname, "info_intermission"); spot = find(spot, classname, "info_intermission");
} }
cyc = cyc - 1;
} }
return spot; return spot;
} }
@ -233,7 +231,7 @@ void() execute_changelevel = {
other = find(world, classname, "player"); other = find(world, classname, "player");
while(other != world) { while(other != world) {
other.view_ofs = '0 0 0'; other.view_ofs = VEC_ORIGIN;
other.angles = other.v_angle = pos.mangle; other.angles = other.v_angle = pos.mangle;
other.fixangle = TRUE; // turn this way immediately other.fixangle = TRUE; // turn this way immediately
other.nextthink = time + 0.5; other.nextthink = time + 0.5;
@ -283,7 +281,7 @@ void() changelevel_touch = {
}; };
/*QUAKED trigger_changelevel(0.5 0.5 0.5) ? NO_INTERMISSION /*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. When the player touches this, they get 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 = { void() trigger_changelevel = {
if(!self.map) { if(!self.map) {
@ -449,7 +447,7 @@ void() PutClientInServer = {
setmodel(self, "progs/player.mdl"); setmodel(self, "progs/player.mdl");
modelindex_player = self.modelindex; modelindex_player = self.modelindex;
setsize(self, VEC_HULL_MIN, VEC_HULL_MAX); setsize(self, '-16 -16 -24', '16 16 32');
self.view_ofs = '0 0 22'; self.view_ofs = '0 0 22';
@ -593,7 +591,7 @@ void() PlayerDeathThink = {
forward = vlen(self.velocity); forward = vlen(self.velocity);
forward = forward - 20; forward = forward - 20;
if(forward <= 0) { if(forward <= 0) {
self.velocity = '0 0 0'; self.velocity = VEC_ORIGIN;
} else { } else {
self.velocity = forward * normalize(self.velocity); self.velocity = forward * normalize(self.velocity);
} }
@ -782,15 +780,12 @@ Called every frame before physics are run
================ ================
*/ */
void() PlayerPreThink = { void() PlayerPreThink = {
float mspeed, aspeed;
float r;
if(intermission_running) { if(intermission_running) {
IntermissionThink(); // otherwise a button could be missed between IntermissionThink(); // otherwise a button could be missed between
return; // the think tics return; // the think tics
} }
if(self.view_ofs == '0 0 0') { if(self.view_ofs == VEC_ORIGIN) {
return; // intermission or finale return; // intermission or finale
} }
@ -820,7 +815,7 @@ void() PlayerPreThink = {
// teleporters can force a non-moving pause time // teleporters can force a non-moving pause time
if(time < self.pausetime) { if(time < self.pausetime) {
self.velocity = '0 0 0'; self.velocity = VEC_ORIGIN;
} }
if(time > self.attack_finished && self.currentammo == 0 && self.weapon != IT_AXE) { if(time > self.attack_finished && self.currentammo == 0 && self.weapon != IT_AXE) {
@ -952,7 +947,6 @@ void() CheckPowerups = {
self.radsuit_finished = 0; self.radsuit_finished = 0;
} }
} }
}; };
/* /*
@ -963,11 +957,8 @@ Called every frame after physics are run
================ ================
*/ */
void() PlayerPostThink = { void() PlayerPostThink = {
float mspeed, aspeed; if(self.view_ofs == VEC_ORIGIN) {
float r; return; // intermission, finale or spectating
if(self.view_ofs == '0 0 0') {
return; // intermission or finale
} }
if(self.deadflag) { if(self.deadflag) {
return; return;

View File

@ -53,10 +53,7 @@ float(entity targ) visible = {
return FALSE; // sight line crossed contents return FALSE; // sight line crossed contents
} }
if(trace_fraction == 1) { return trace_fraction == 1;
return TRUE;
}
return FALSE;
}; };
// returns 1 if the entity is in front(in sight) of self // returns 1 if the entity is in front(in sight) of self
@ -68,10 +65,7 @@ float(entity targ) infront = {
vec = normalize(targ.origin - self.origin); vec = normalize(targ.origin - self.origin);
dot = vec * v_forward; dot = vec * v_forward;
if(dot > 0.3) { return dot > 0.3;
return TRUE;
}
return FALSE;
}; };
// EOF // EOF

View File

@ -20,8 +20,8 @@ float deathmatch;
float coop; float coop;
float teamplay; float teamplay;
float serverflags; // propagated from level to level, used to // propagated from level to level, used to keep track of completed episodes
// keep track of completed episodes float serverflags;
float total_secrets; float total_secrets;
float total_monsters; float total_monsters;
@ -272,11 +272,15 @@ void(entity e) setspawnparms = #78;
// constants -----------------------------------------------------------------| // constants -----------------------------------------------------------------|
const vector VEC_ORIGIN = '0 0 0'; const vector VEC_ORIGIN = '0 0 0';
const vector VEC_HULL_MIN = '-16 -16 -24';
const vector VEC_HULL_MAX = '16 16 32';
const vector VEC_HULL2_MIN = '-32 -32 -24'; const string WEPNAME_AXE = "Axe";
const vector VEC_HULL2_MAX = '32 32 64'; const string WEPNAME_SHOTGUN = "Shotgun";
const string WEPNAME_SUPER_SHOTGUN = "Double-barrelled Shotgun";
const string WEPNAME_NAILGUN = "Nailgun";
const string WEPNAME_SUPER_NAILGUN = "Super Nailgun";
const string WEPNAME_GRENADE_LAUNCHER = "Grenade Launcher";
const string WEPNAME_ROCKET_LAUNCHER = "Rocket Launcher";
const string WEPNAME_LIGHTNING = "Thunderbolt";
enum { enum {
FALSE, FALSE,
@ -302,8 +306,6 @@ enum {
// edict.movetype values // edict.movetype values
enum { enum {
MOVETYPE_NONE, // never moves MOVETYPE_NONE, // never moves
//MOVETYPE_ANGLENOCLIP,
//MOVETYPE_ANGLECLIP,
MOVETYPE_WALK = 3, // players only MOVETYPE_WALK = 3, // players only
MOVETYPE_STEP, // discrete, not real time unless fall MOVETYPE_STEP, // discrete, not real time unless fall
MOVETYPE_FLY, MOVETYPE_FLY,
@ -489,6 +491,72 @@ enum {
PRO_MAX, PRO_MAX,
}; };
enum {
DOOR_START_OPEN = 1,
DOOR_DONT_LINK = 4,
DOOR_GOLD_KEY = 8,
DOOR_SILVER_KEY = 16,
DOOR_TOGGLE = 32,
};
enum {
SECRET_OPEN_ONCE = 1, // stays open
SECRET_1ST_LEFT = 2, // 1st move is left of arrow
SECRET_1ST_DOWN = 4, // 1st move is down from arrow
SECRET_NO_SHOOT = 8, // only opened by trigger
SECRET_YES_SHOOT = 16, // shootable even if targeted
};
enum {
COUNTER_NOMESSAGE = 1,
};
enum {
MULTIPLE_NOTOUCH = 1,
};
enum {
TELE_PLAYER_ONLY = 1,
TELE_SILENT = 2,
};
enum {
PUSH_ONCE = 1,
};
enum {
ZOMBIE_SPAWN_CRUCIFIED = 1,
};
enum {
PLAT_LOW_TRIGGER = 1,
};
enum {
LIGHT_START_OFF = 1,
};
enum {
SPIKESHOOTER_SUPER = 1,
SPIKESHOOTER_LASER = 2,
};
enum {
HEALTH_ROTTEN = 1,
HEALTH_MEGA = 2,
};
enum {
AMMO_BIG = 1,
};
enum {
WEAPON_SHOTGUN = 1,
WEAPON_ROCKET = 2,
WEAPON_SPIKES = 4,
WEAPON_BIG = 8,
};
#pragma noref 0 #pragma noref 0
// globals -------------------------------------------------------------------| // globals -------------------------------------------------------------------|

View File

@ -189,7 +189,7 @@ void() monster_demon1 = {
setmodel(self, "progs/demon.mdl"); setmodel(self, "progs/demon.mdl");
setsize(self, VEC_HULL2_MIN, VEC_HULL2_MAX); setsize(self, '-32 -32 -24', '32 32 64');
self.health = 300; self.health = 300;
self.th_stand = demon1_stand1; self.th_stand = demon1_stand1;

View File

@ -1,13 +1,5 @@
// doors.qc: player-triggered moving brush entities // doors.qc: player-triggered moving brush entities
enum {
DOOR_START_OPEN = 1,
DOOR_DONT_LINK = 4,
DOOR_GOLD_KEY = 8,
DOOR_SILVER_KEY = 16,
DOOR_TOGGLE = 32,
};
/* /*
Doors are similar to buttons, but can spawn a fat trigger field around them Doors are similar to buttons, but can spawn a fat trigger field around them
@ -492,14 +484,6 @@ SECRET DOORS
============================================================================= =============================================================================
*/ */
enum {
SECRET_OPEN_ONCE = 1, // stays open
SECRET_1ST_LEFT = 2, // 1st move is left of arrow
SECRET_1ST_DOWN = 4, // 1st move is down from arrow
SECRET_NO_SHOOT = 8, // only opened by trigger
SECRET_YES_SHOOT = 16, // shootable even if targeted
};
void() fd_secret_use = { void() fd_secret_use = {
float temp; float temp;
@ -518,7 +502,7 @@ void() fd_secret_use = {
self.th_pain = SUB_PainNull; self.th_pain = SUB_PainNull;
self.takedamage = DAMAGE_NO; self.takedamage = DAMAGE_NO;
} }
self.velocity = '0 0 0'; self.velocity = VEC_ORIGIN;
// Make a sound, wait a little... // Make a sound, wait a little...
@ -682,7 +666,7 @@ void() func_door_secret = {
// Magic formula... // Magic formula...
self.mangle = self.angles; self.mangle = self.angles;
self.angles = '0 0 0'; self.angles = VEC_ORIGIN;
self.solid = SOLID_BSP; self.solid = SOLID_BSP;
self.movetype = MOVETYPE_PUSH; self.movetype = MOVETYPE_PUSH;
self.classname = "door"; self.classname = "door";

View File

@ -76,7 +76,7 @@ void(vector org, vector vec) LaunchLaser = {
newmis.effects = EF_DIMLIGHT; newmis.effects = EF_DIMLIGHT;
setmodel(newmis, "progs/laser.mdl"); setmodel(newmis, "progs/laser.mdl");
setsize(newmis, '0 0 0', '0 0 0'); setsize(newmis, VEC_ORIGIN, VEC_ORIGIN);
setorigin(newmis, org); setorigin(newmis, org);

View File

@ -1,14 +1,5 @@
// items.qc: items the player can pick up // items.qc: items the player can pick up
const string WEPNAME_AXE = "Axe";
const string WEPNAME_SHOTGUN = "Shotgun";
const string WEPNAME_SUPER_SHOTGUN = "Double-barrelled Shotgun";
const string WEPNAME_NAILGUN = "Nailgun";
const string WEPNAME_SUPER_NAILGUN = "Super Nailgun";
const string WEPNAME_GRENADE_LAUNCHER = "Grenade Launcher";
const string WEPNAME_ROCKET_LAUNCHER = "Rocket Launcher";
const string WEPNAME_LIGHTNING = "Thunderbolt";
string() Key1Name = { string() Key1Name = {
switch(world.worldtype) { switch(world.worldtype) {
case WORLD_MEDIEVAL: case WORLD_MEDIEVAL:
@ -72,7 +63,7 @@ void() PlaceItem = {
self.flags = FL_ITEM; // make extra wide self.flags = FL_ITEM; // make extra wide
self.solid = SOLID_TRIGGER; self.solid = SOLID_TRIGGER;
self.movetype = MOVETYPE_TOSS; self.movetype = MOVETYPE_TOSS;
self.velocity = '0 0 0'; self.velocity = VEC_ORIGIN;
self.origin_z = self.origin_z + 6; self.origin_z = self.origin_z + 6;
oldz = self.origin_z; oldz = self.origin_z;
if(!droptofloor()) { if(!droptofloor()) {
@ -133,22 +124,17 @@ rot you down to your maximum health limit,
one point per second. one point per second.
*/ */
enum {
H_ROTTEN = 1,
H_MEGA = 2,
};
void() item_health = { void() item_health = {
self.touch = health_touch; self.touch = health_touch;
if(self.spawnflags & H_ROTTEN) { if(self.spawnflags & HEALTH_ROTTEN) {
precache_model("maps/b_bh10.bsp"); precache_model("maps/b_bh10.bsp");
precache_sound("items/r_item1.wav"); precache_sound("items/r_item1.wav");
setmodel(self, "maps/b_bh10.bsp"); setmodel(self, "maps/b_bh10.bsp");
self.noise = "items/r_item1.wav"; self.noise = "items/r_item1.wav";
self.healamount = 15; self.healamount = 15;
self.healtype = 0; self.healtype = 0;
} else if(self.spawnflags & H_MEGA) { } else if(self.spawnflags & HEALTH_MEGA) {
precache_model("maps/b_bh100.bsp"); precache_model("maps/b_bh100.bsp");
precache_sound("items/r_item2.wav"); precache_sound("items/r_item2.wav");
setmodel(self, "maps/b_bh100.bsp"); setmodel(self, "maps/b_bh100.bsp");
@ -163,7 +149,7 @@ void() item_health = {
self.healamount = 25; self.healamount = 25;
self.healtype = 1; self.healtype = 1;
} }
setsize(self, '0 0 0', '32 32 56'); setsize(self, VEC_ORIGIN, '32 32 56');
StartItem(); StartItem();
}; };
@ -680,20 +666,12 @@ void() ammo_touch = {
SUB_UseTargets(); // fire all targets / killtargets SUB_UseTargets(); // fire all targets / killtargets
}; };
enum {
WEAPON_BIG2 = 1,
};
/*QUAKED item_shells(0 .5 .8) (0 0 0) (32 32 32) big /*QUAKED item_shells(0 .5 .8) (0 0 0) (32 32 32) big
*/ */
void() item_shells = { void() item_shells = {
self.touch = ammo_touch; self.touch = ammo_touch;
if(self.spawnflags & WEAPON_BIG2) { if(self.spawnflags & AMMO_BIG) {
precache_model("maps/b_shell1.bsp"); precache_model("maps/b_shell1.bsp");
setmodel(self, "maps/b_shell1.bsp"); setmodel(self, "maps/b_shell1.bsp");
self.aflag = 40; self.aflag = 40;
@ -704,17 +682,16 @@ void() item_shells = {
} }
self.weapon = 1; self.weapon = 1;
self.netname = "shells"; self.netname = "shells";
setsize(self, '0 0 0', '32 32 56'); setsize(self, VEC_ORIGIN, '32 32 56');
StartItem(); StartItem();
}; };
/*QUAKED item_spikes(0 .5 .8) (0 0 0) (32 32 32) big /*QUAKED item_spikes(0 .5 .8) (0 0 0) (32 32 32) big
*/ */
void() item_spikes = { void() item_spikes = {
self.touch = ammo_touch; self.touch = ammo_touch;
if(self.spawnflags & WEAPON_BIG2) { if(self.spawnflags & AMMO_BIG) {
precache_model("maps/b_nail1.bsp"); precache_model("maps/b_nail1.bsp");
setmodel(self, "maps/b_nail1.bsp"); setmodel(self, "maps/b_nail1.bsp");
self.aflag = 50; self.aflag = 50;
@ -725,17 +702,16 @@ void() item_spikes = {
} }
self.weapon = 2; self.weapon = 2;
self.netname = "nails"; self.netname = "nails";
setsize(self, '0 0 0', '32 32 56'); setsize(self, VEC_ORIGIN, '32 32 56');
StartItem(); StartItem();
}; };
/*QUAKED item_rockets(0 .5 .8) (0 0 0) (32 32 32) big /*QUAKED item_rockets(0 .5 .8) (0 0 0) (32 32 32) big
*/ */
void() item_rockets = { void() item_rockets = {
self.touch = ammo_touch; self.touch = ammo_touch;
if(self.spawnflags & WEAPON_BIG2) { if(self.spawnflags & AMMO_BIG) {
precache_model("maps/b_rock1.bsp"); precache_model("maps/b_rock1.bsp");
setmodel(self, "maps/b_rock1.bsp"); setmodel(self, "maps/b_rock1.bsp");
self.aflag = 10; self.aflag = 10;
@ -746,7 +722,7 @@ void() item_rockets = {
} }
self.weapon = 3; self.weapon = 3;
self.netname = "rockets"; self.netname = "rockets";
setsize(self, '0 0 0', '32 32 56'); setsize(self, VEC_ORIGIN, '32 32 56');
StartItem(); StartItem();
}; };
@ -757,7 +733,7 @@ void() item_rockets = {
void() item_cells = { void() item_cells = {
self.touch = ammo_touch; self.touch = ammo_touch;
if(self.spawnflags & WEAPON_BIG2) { if(self.spawnflags & AMMO_BIG) {
precache_model("maps/b_batt1.bsp"); precache_model("maps/b_batt1.bsp");
setmodel(self, "maps/b_batt1.bsp"); setmodel(self, "maps/b_batt1.bsp");
self.aflag = 12; self.aflag = 12;
@ -768,71 +744,10 @@ void() item_cells = {
} }
self.weapon = 4; self.weapon = 4;
self.netname = "cells"; self.netname = "cells";
setsize(self, '0 0 0', '32 32 56'); setsize(self, VEC_ORIGIN, '32 32 56');
StartItem(); 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!
*/
enum {
WEAPON_SHOTGUN = 1,
WEAPON_ROCKET = 2,
WEAPON_SPIKES = 4,
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();
};
/* /*
=============================================================================== ===============================================================================

View File

@ -15,17 +15,13 @@ void() info_notnull = {
//============================================================================ //============================================================================
enum {
START_OFF = 1,
};
void() light_use = { void() light_use = {
if(self.spawnflags & START_OFF) { if(self.spawnflags & LIGHT_START_OFF) {
lightstyle(self.style, "m"); lightstyle(self.style, "m");
self.spawnflags = self.spawnflags - START_OFF; self.spawnflags = self.spawnflags - LIGHT_START_OFF;
} else { } else {
lightstyle(self.style, "a"); lightstyle(self.style, "a");
self.spawnflags = self.spawnflags + START_OFF; self.spawnflags = self.spawnflags + LIGHT_START_OFF;
} }
}; };
@ -44,7 +40,7 @@ void() light = {
if(self.style >= 32) { if(self.style >= 32) {
self.use = light_use; self.use = light_use;
if(self.spawnflags & START_OFF) { if(self.spawnflags & LIGHT_START_OFF) {
lightstyle(self.style, "a"); lightstyle(self.style, "a");
} else { } else {
lightstyle(self.style, "m"); lightstyle(self.style, "m");
@ -62,7 +58,7 @@ Makes steady fluorescent humming sound
void() light_fluoro = { void() light_fluoro = {
if(self.style >= 32) { if(self.style >= 32) {
self.use = light_use; self.use = light_use;
if(self.spawnflags & START_OFF) { if(self.spawnflags & LIGHT_START_OFF) {
lightstyle(self.style, "a"); lightstyle(self.style, "a");
} else { } else {
lightstyle(self.style, "m"); lightstyle(self.style, "m");
@ -176,7 +172,7 @@ void() fire_fly = {
fireball.velocity_z = self.speed + (random() * 200); fireball.velocity_z = self.speed + (random() * 200);
fireball.classname = "fireball"; fireball.classname = "fireball";
setmodel(fireball, "progs/lavaball.mdl"); setmodel(fireball, "progs/lavaball.mdl");
setsize(fireball, '0 0 0', '0 0 0'); setsize(fireball, VEC_ORIGIN, VEC_ORIGIN);
setorigin(fireball, self.origin); setorigin(fireball, self.origin);
fireball.nextthink = time + 5; fireball.nextthink = time + 5;
fireball.think = SUB_Remove; fireball.think = SUB_Remove;
@ -199,7 +195,7 @@ void() barrel_explode = {
// did say self.owner // did say self.owner
T_RadiusDamage(self, self, 160, world); T_RadiusDamage(self, self, 160, world);
sound(self, CHAN_VOICE, "weapons/r_exp3.wav", 1, ATTN_NORM); sound(self, CHAN_VOICE, "weapons/r_exp3.wav", 1, ATTN_NORM);
particle(self.origin, '0 0 0', 75, 255); particle(self.origin, VEC_ORIGIN, 75, 255);
self.origin_z = self.origin_z + 32; self.origin_z = self.origin_z + 32;
BecomeExplosion(); BecomeExplosion();
@ -260,20 +256,15 @@ void() misc_explobox2 = {
//============================================================================ //============================================================================
enum {
SPAWNFLAG_SUPERSPIKE = 1,
SPAWNFLAG_LASER = 2,
};
void() spikeshooter_use = { void() spikeshooter_use = {
if(self.spawnflags & SPAWNFLAG_LASER) { if(self.spawnflags & SPIKESHOOTER_LASER) {
sound(self, CHAN_VOICE, "enforcer/enfire.wav", 1, ATTN_NORM); sound(self, CHAN_VOICE, "enforcer/enfire.wav", 1, ATTN_NORM);
LaunchLaser(self.origin, self.movedir); LaunchLaser(self.origin, self.movedir);
} else { } else {
sound(self, CHAN_VOICE, "weapons/spike2.wav", 1, ATTN_NORM); sound(self, CHAN_VOICE, "weapons/spike2.wav", 1, ATTN_NORM);
launch_spike(self.origin, self.movedir); launch_spike(self.origin, self.movedir);
newmis.velocity = self.movedir * 500; newmis.velocity = self.movedir * 500;
if(self.spawnflags & SPAWNFLAG_SUPERSPIKE) { if(self.spawnflags & SPIKESHOOTER_SUPER) {
newmis.touch = superspike_touch; newmis.touch = superspike_touch;
} }
} }
@ -293,7 +284,7 @@ Laser is only for REGISTERED.
void() trap_spikeshooter = { void() trap_spikeshooter = {
SetMovedir(); SetMovedir();
self.use = spikeshooter_use; self.use = spikeshooter_use;
if(self.spawnflags & SPAWNFLAG_LASER) { if(self.spawnflags & SPIKESHOOTER_LASER) {
precache_model2("progs/laser.mdl"); precache_model2("progs/laser.mdl");
precache_sound2("enforcer/enfire.wav"); precache_sound2("enforcer/enfire.wav");
precache_sound2("enforcer/enfstop.wav"); precache_sound2("enforcer/enfstop.wav");
@ -442,9 +433,7 @@ void() bubble_bob = {
Just for the debugging level. Don't use Just for the debugging level. Don't use
*/ */
void() viewthing = void() viewthing = {
{
self.movetype = MOVETYPE_NONE; self.movetype = MOVETYPE_NONE;
self.solid = SOLID_NOT; self.solid = SOLID_NOT;
precache_model("progs/player.mdl"); precache_model("progs/player.mdl");
@ -468,7 +457,7 @@ void() func_wall_use = {
This is just a solid wall if not inhibitted This is just a solid wall if not inhibitted
*/ */
void() func_wall = { void() func_wall = {
self.angles = '0 0 0'; self.angles = VEC_ORIGIN;
self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything
self.solid = SOLID_BSP; self.solid = SOLID_BSP;
self.use = func_wall_use; self.use = func_wall_use;
@ -479,7 +468,7 @@ void() func_wall = {
A simple entity that looks solid but lets you walk through it. A simple entity that looks solid but lets you walk through it.
*/ */
void() func_illusionary = { void() func_illusionary = {
self.angles = '0 0 0'; self.angles = VEC_ORIGIN;
self.movetype = MOVETYPE_NONE; self.movetype = MOVETYPE_NONE;
self.solid = SOLID_NOT; self.solid = SOLID_NOT;
setmodel(self, self.model); setmodel(self, self.model);
@ -489,14 +478,12 @@ void() func_illusionary = {
/*QUAKED func_episodegate(0 .5 .8) ? E1 E2 E3 E4 /*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. This bmodel will appear if the episode has allready been completed, so players can't reenter it.
*/ */
void() func_episodegate = void() func_episodegate = {
{
if(!(serverflags & self.spawnflags)) { if(!(serverflags & self.spawnflags)) {
return; // can still enter episode return; // can still enter episode
} }
self.angles = '0 0 0'; self.angles = VEC_ORIGIN;
self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything
self.solid = SOLID_BSP; self.solid = SOLID_BSP;
self.use = func_wall_use; self.use = func_wall_use;
@ -506,13 +493,11 @@ void() func_episodegate =
/*QUAKED func_bossgate(0 .5 .8) ? /*QUAKED func_bossgate(0 .5 .8) ?
This bmodel appears unless players have all of the episode sigils. This bmodel appears unless players have all of the episode sigils.
*/ */
void() func_bossgate = void() func_bossgate = {
{
if((serverflags & 15) == 15) { if((serverflags & 15) == 15) {
return; // all episodes completed return; // all episodes completed
} }
self.angles = '0 0 0'; self.angles = VEC_ORIGIN;
self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything self.movetype = MOVETYPE_PUSH; // so it doesn't get pushed by anything
self.solid = SOLID_BSP; self.solid = SOLID_BSP;
self.use = func_wall_use; self.use = func_wall_use;

View File

@ -53,7 +53,7 @@ void() OgreGrenadeExplode = {
WriteCoord(MSG_BROADCAST, self.origin_y); WriteCoord(MSG_BROADCAST, self.origin_y);
WriteCoord(MSG_BROADCAST, self.origin_z); WriteCoord(MSG_BROADCAST, self.origin_z);
self.velocity = '0 0 0'; self.velocity = VEC_ORIGIN;
self.touch = SUB_Null; self.touch = SUB_Null;
setmodel(self, "progs/s_explod.spr"); setmodel(self, "progs/s_explod.spr");
self.solid = SOLID_NOT; self.solid = SOLID_NOT;
@ -69,8 +69,8 @@ void() OgreGrenadeTouch = {
return; return;
} }
sound(self, CHAN_VOICE, "weapons/bounce.wav", 1, ATTN_NORM); // bounce sound sound(self, CHAN_VOICE, "weapons/bounce.wav", 1, ATTN_NORM); // bounce sound
if(self.velocity == '0 0 0') { if(self.velocity == VEC_ORIGIN) {
self.avelocity = '0 0 0'; self.avelocity = VEC_ORIGIN;
} }
}; };
@ -110,7 +110,7 @@ void() OgreFireGrenade = {
missile.think = OgreGrenadeExplode; missile.think = OgreGrenadeExplode;
setmodel(missile, "progs/grenade.mdl"); setmodel(missile, "progs/grenade.mdl");
setsize(missile, '0 0 0', '0 0 0'); setsize(missile, VEC_ORIGIN, VEC_ORIGIN);
setorigin(missile, self.origin); setorigin(missile, self.origin);
}; };
@ -422,7 +422,7 @@ void() monster_ogre = {
setmodel(self, "progs/ogre.mdl"); setmodel(self, "progs/ogre.mdl");
setsize(self, VEC_HULL2_MIN, VEC_HULL2_MAX); setsize(self, '-32 -32 -24', '32 32 64');
self.health = 200; self.health = 200;
self.th_stand = ogre_stand1; self.th_stand = ogre_stand1;

View File

@ -116,7 +116,7 @@ void() finale_1 = {
pl = find(world, classname, "player"); pl = find(world, classname, "player");
while(pl != world) { while(pl != world) {
pl.view_ofs = '0 0 0'; pl.view_ofs = VEC_ORIGIN;
pl.angles = other.v_angle = pos.mangle; pl.angles = other.v_angle = pos.mangle;
pl.fixangle = TRUE; // turn this way immediately pl.fixangle = TRUE; // turn this way immediately
pl.map = self.map; pl.map = self.map;

View File

@ -1,9 +1,5 @@
// plats.qc: moving platforms // plats.qc: moving platforms
enum {
PLAT_LOW_TRIGGER = 1,
};
void() plat_spawn_inside_trigger = { void() plat_spawn_inside_trigger = {
entity trigger; entity trigger;
vector tmin, tmax; vector tmin, tmax;
@ -165,7 +161,7 @@ void() func_plat = {
} }
self.mangle = self.angles; self.mangle = self.angles;
self.angles = '0 0 0'; self.angles = VEC_ORIGIN;
self.classname = "plat"; self.classname = "plat";
self.solid = SOLID_BSP; self.solid = SOLID_BSP;

View File

@ -436,7 +436,7 @@ void(string gibname, float dm) ThrowGib = {
new = spawn(); new = spawn();
new.origin = self.origin; new.origin = self.origin;
setmodel(new, gibname); setmodel(new, gibname);
setsize(new, '0 0 0', '0 0 0'); setsize(new, VEC_ORIGIN, VEC_ORIGIN);
new.velocity = VelocityForDamage(dm); new.velocity = VelocityForDamage(dm);
new.movetype = MOVETYPE_BOUNCE; new.movetype = MOVETYPE_BOUNCE;
new.solid = SOLID_NOT; new.solid = SOLID_NOT;

View File

@ -137,7 +137,7 @@ void() ShalMissile = {
missile.movetype = MOVETYPE_FLYMISSILE; missile.movetype = MOVETYPE_FLYMISSILE;
setmodel(missile, "progs/v_spike.mdl"); setmodel(missile, "progs/v_spike.mdl");
setsize(missile, '0 0 0', '0 0 0'); setsize(missile, VEC_ORIGIN, VEC_ORIGIN);
missile.origin = self.origin + '0 0 10'; missile.origin = self.origin + '0 0 10';
missile.velocity = dir * 400; missile.velocity = dir * 400;
@ -182,7 +182,7 @@ void() ShalMissileTouch = {
WriteCoord(MSG_BROADCAST, self.origin_y); WriteCoord(MSG_BROADCAST, self.origin_y);
WriteCoord(MSG_BROADCAST, self.origin_z); WriteCoord(MSG_BROADCAST, self.origin_z);
self.velocity = '0 0 0'; self.velocity = VEC_ORIGIN;
self.touch = SUB_Null; self.touch = SUB_Null;
setmodel(self, "progs/s_explod.spr"); setmodel(self, "progs/s_explod.spr");
self.solid = SOLID_NOT; self.solid = SOLID_NOT;
@ -213,7 +213,7 @@ void() monster_shalrath = {
self.movetype = MOVETYPE_STEP; self.movetype = MOVETYPE_STEP;
setmodel(self, "progs/shalrath.mdl"); setmodel(self, "progs/shalrath.mdl");
setsize(self, VEC_HULL2_MIN, VEC_HULL2_MAX); setsize(self, '-32 -32 -24', '32 32 64');
self.health = 400; self.health = 400;
self.th_stand = shal_stand; self.th_stand = shal_stand;

View File

@ -346,7 +346,7 @@ void() monster_shambler = {
self.movetype = MOVETYPE_STEP; self.movetype = MOVETYPE_STEP;
setmodel(self, "progs/shambler.mdl"); setmodel(self, "progs/shambler.mdl");
setsize(self, VEC_HULL2_MIN, VEC_HULL2_MAX); setsize(self, '-32 -32 -24', '32 32 64');
self.health = 600; self.health = 600;
self.th_stand = sham_stand1; self.th_stand = sham_stand1;

View File

@ -18,7 +18,7 @@ void() SetMovedir = {
self.movedir = v_forward; self.movedir = v_forward;
} }
self.angles = '0 0 0'; self.angles = VEC_ORIGIN;
}; };
/* /*
@ -29,7 +29,7 @@ InitTrigger
void() InitTrigger = { void() InitTrigger = {
// trigger angles are used for one-way touches. An angle of 0 is assumed // trigger angles are used for one-way touches. An angle of 0 is assumed
// to mean no restrictions, so use a yaw of 360 instead. // to mean no restrictions, so use a yaw of 360 instead.
if(self.angles != '0 0 0') { if(self.angles != VEC_ORIGIN) {
SetMovedir(); SetMovedir();
} }
self.solid = SOLID_TRIGGER; self.solid = SOLID_TRIGGER;
@ -69,7 +69,7 @@ void(vector tdest, float tspeed, void() func) SUB_CalcMove = {
self.think = SUB_CalcMoveDone; self.think = SUB_CalcMoveDone;
if(tdest == self.origin) { if(tdest == self.origin) {
self.velocity = '0 0 0'; self.velocity = VEC_ORIGIN;
self.nextthink = self.ltime + 0.1; self.nextthink = self.ltime + 0.1;
return; return;
} }
@ -84,7 +84,7 @@ void(vector tdest, float tspeed, void() func) SUB_CalcMove = {
traveltime = len / tspeed; traveltime = len / tspeed;
if(traveltime < 0.1) { if(traveltime < 0.1) {
self.velocity = '0 0 0'; self.velocity = VEC_ORIGIN;
self.nextthink = self.ltime + 0.1; self.nextthink = self.ltime + 0.1;
return; return;
} }
@ -103,7 +103,7 @@ After moving, set origin to exact final destination
*/ */
void() SUB_CalcMoveDone = { void() SUB_CalcMoveDone = {
setorigin(self, self.finaldest); setorigin(self, self.finaldest);
self.velocity = '0 0 0'; self.velocity = VEC_ORIGIN;
self.nextthink = -1; self.nextthink = -1;
if(self.think1) { if(self.think1) {
self.think1(); self.think1();
@ -163,7 +163,7 @@ After rotating, set angle to exact final angle
*/ */
void() SUB_CalcAngleMoveDone = { void() SUB_CalcAngleMoveDone = {
self.angles = self.finalangle; self.angles = self.finalangle;
self.avelocity = '0 0 0'; self.avelocity = VEC_ORIGIN;
self.nextthink = -1; self.nextthink = -1;
if(self.think1) { if(self.think1) {
self.think1(); self.think1();

View File

@ -6,14 +6,6 @@ void() trigger_reactivate = {
//============================================================================= //=============================================================================
enum {
SPAWNFLAG_NOMESSAGE = 1,
};
enum {
SPAWNFLAG_NOTOUCH = 1,
};
// the wait time has passed, so set back up for another activation // the wait time has passed, so set back up for another activation
void() multi_wait = { void() multi_wait = {
if(self.max_health) { if(self.max_health) {
@ -78,7 +70,7 @@ void() multi_touch = {
} }
// if the trigger has an angles field, check player's facing direction // if the trigger has an angles field, check player's facing direction
if(self.movedir != '0 0 0') { if(self.movedir != VEC_ORIGIN) {
makevectors(other.angles); makevectors(other.angles);
if(v_forward * self.movedir < 0) { if(v_forward * self.movedir < 0) {
return; // not facing the right way return; // not facing the right way
@ -122,7 +114,7 @@ void() trigger_multiple = {
InitTrigger(); InitTrigger();
if(self.health) { if(self.health) {
if(self.spawnflags & SPAWNFLAG_NOTOUCH) { if(self.spawnflags & MULTIPLE_NOTOUCH) {
objerror("health and notouch don't make sense\n"); objerror("health and notouch don't make sense\n");
} }
self.max_health = self.health; self.max_health = self.health;
@ -131,7 +123,7 @@ void() trigger_multiple = {
self.solid = SOLID_BBOX; self.solid = SOLID_BBOX;
setorigin(self, self.origin); // make sure it links into the world setorigin(self, self.origin); // make sure it links into the world
} else { } else {
if(!(self.spawnflags & SPAWNFLAG_NOTOUCH)) { if(!(self.spawnflags & MULTIPLE_NOTOUCH)) {
self.touch = multi_touch; self.touch = multi_touch;
} }
} }
@ -199,8 +191,6 @@ void() trigger_secret = {
//============================================================================= //=============================================================================
void() counter_use = { void() counter_use = {
string junk;
self.count = self.count - 1; self.count = self.count - 1;
if(self.count < 0) { if(self.count < 0) {
return; return;
@ -208,7 +198,7 @@ void() counter_use = {
if(self.count != 0) { if(self.count != 0) {
if(activator.classname == "player" if(activator.classname == "player"
&& (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0) { && (self.spawnflags & COUNTER_NOMESSAGE) == 0) {
if(self.count >= 4) { if(self.count >= 4) {
centerprint(activator, "There are more to go..."); centerprint(activator, "There are more to go...");
} else if(self.count == 3) { } else if(self.count == 3) {
@ -222,8 +212,7 @@ void() counter_use = {
return; return;
} }
if(activator.classname == "player" if(activator.classname == "player" && (self.spawnflags & COUNTER_NOMESSAGE) == 0) {
&& (self.spawnflags & SPAWNFLAG_NOMESSAGE) == 0) {
centerprint(activator, "Sequence completed!"); centerprint(activator, "Sequence completed!");
} }
self.enemy = activator; self.enemy = activator;
@ -254,11 +243,6 @@ TELEPORT TRIGGERS
============================================================================== ==============================================================================
*/ */
enum {
PLAYER_ONLY = 1,
SILENT = 2,
};
void() play_teleport = { void() play_teleport = {
float v; float v;
string tmpstr; string tmpstr;
@ -324,7 +308,7 @@ void(vector org, entity death_owner) spawn_tdeath = {
death.classname = "teledeath"; death.classname = "teledeath";
death.movetype = MOVETYPE_NONE; death.movetype = MOVETYPE_NONE;
death.solid = SOLID_TRIGGER; death.solid = SOLID_TRIGGER;
death.angles = '0 0 0'; death.angles = VEC_ORIGIN;
setsize(death, death_owner.mins - '1 1 1', death_owner.maxs + '1 1 1'); setsize(death, death_owner.mins - '1 1 1', death_owner.maxs + '1 1 1');
setorigin(death, org); setorigin(death, org);
death.touch = tdeath_touch; death.touch = tdeath_touch;
@ -345,7 +329,7 @@ void() teleport_touch = {
} }
} }
if(self.spawnflags & PLAYER_ONLY) { if(self.spawnflags & TELE_PLAYER_ONLY) {
if(other.classname != "player") { if(other.classname != "player") {
return; return;
} }
@ -373,7 +357,7 @@ void() teleport_touch = {
spawn_tfog(org); spawn_tfog(org);
spawn_tdeath(t.origin, other); spawn_tdeath(t.origin, other);
// move the player and lock him down for a little while // move the player and lock them down for a little while
if(!other.health) { if(!other.health) {
other.origin = t.origin; other.origin = t.origin;
other.velocity = (v_forward * other.velocity_x) + (v_forward * other.velocity_y); other.velocity = (v_forward * other.velocity_x) + (v_forward * other.velocity_y);
@ -399,7 +383,7 @@ This is the destination marker for a teleporter. It should have a "targetname" f
void() info_teleport_destination = { void() info_teleport_destination = {
// this does nothing, just serves as a target spot // this does nothing, just serves as a target spot
self.mangle = self.angles; self.mangle = self.angles;
self.angles = '0 0 0'; self.angles = VEC_ORIGIN;
self.model = ""; self.model = "";
self.origin = self.origin + '0 0 27'; self.origin = self.origin + '0 0 27';
if(!self.targetname) { if(!self.targetname) {
@ -429,7 +413,7 @@ void() trigger_teleport = {
} }
self.use = teleport_use; self.use = teleport_use;
if(!(self.spawnflags & SILENT)) { if(!(self.spawnflags & TELE_SILENT)) {
precache_sound("ambience/hum1.wav"); precache_sound("ambience/hum1.wav");
o = (self.mins + self.maxs) * 0.5; o = (self.mins + self.maxs) * 0.5;
ambientsound(o, "ambience/hum1.wav", 0.5, ATTN_STATIC); ambientsound(o, "ambience/hum1.wav", 0.5, ATTN_STATIC);
@ -532,10 +516,6 @@ void() trigger_hurt = {
//============================================================================ //============================================================================
enum {
PUSH_ONCE = 1,
};
void() trigger_push_touch = { void() trigger_push_touch = {
if(other.classname == "grenade") { if(other.classname == "grenade") {
other.velocity = self.speed * self.movedir * 10; other.velocity = self.speed * self.movedir * 10;
@ -597,7 +577,7 @@ void() trigger_monsterjump = {
if(!self.height) { if(!self.height) {
self.height = 200; self.height = 200;
} }
if(self.angles == '0 0 0') { if(self.angles == VEC_ORIGIN) {
self.angles = '0 360 0'; self.angles = '0 360 0';
} }
InitTrigger(); InitTrigger();

View File

@ -36,7 +36,7 @@ void() W_FireAxe = {
if(trace_ent.takedamage) { if(trace_ent.takedamage) {
trace_ent.axhitme = 1; trace_ent.axhitme = 1;
SpawnBlood(org, '0 0 0', 20); SpawnBlood(org, VEC_ORIGIN, 20);
T_Damage(trace_ent, self, self, 20); T_Damage(trace_ent, self, self, 20);
} else { } else {
// hit wall // hit wall
@ -88,7 +88,7 @@ void(vector org, vector vel) SpawnMeatSpray = {
missile.think = SUB_Remove; missile.think = SUB_Remove;
setmodel(missile, "progs/zom_gib.mdl"); setmodel(missile, "progs/zom_gib.mdl");
setsize(missile, '0 0 0', '0 0 0'); setsize(missile, VEC_ORIGIN, VEC_ORIGIN);
setorigin(missile, org); setorigin(missile, org);
}; };
@ -277,7 +277,7 @@ void() s_explode6 = [5, SUB_Remove] {};
void() BecomeExplosion = { void() BecomeExplosion = {
self.movetype = MOVETYPE_NONE; self.movetype = MOVETYPE_NONE;
self.velocity = '0 0 0'; self.velocity = VEC_ORIGIN;
self.touch = SUB_Null; self.touch = SUB_Null;
setmodel(self, "progs/s_explod.spr"); setmodel(self, "progs/s_explod.spr");
self.solid = SOLID_NOT; self.solid = SOLID_NOT;
@ -356,7 +356,7 @@ void() W_FireRocket = {
missile.think = SUB_Remove; missile.think = SUB_Remove;
setmodel(missile, "progs/missile.mdl"); setmodel(missile, "progs/missile.mdl");
setsize(missile, '0 0 0', '0 0 0'); setsize(missile, VEC_ORIGIN, VEC_ORIGIN);
setorigin(missile, self.origin + v_forward * 8 + '0 0 16'); setorigin(missile, self.origin + v_forward * 8 + '0 0 16');
}; };
@ -479,8 +479,8 @@ void() GrenadeTouch = {
return; return;
} }
sound(self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM); // bounce sound sound(self, CHAN_WEAPON, "weapons/bounce.wav", 1, ATTN_NORM); // bounce sound
if(self.velocity == '0 0 0') { if(self.velocity == VEC_ORIGIN) {
self.avelocity = '0 0 0'; self.avelocity = VEC_ORIGIN;
} }
}; };
@ -527,7 +527,7 @@ void() W_FireGrenade = {
missile.think = GrenadeExplode; missile.think = GrenadeExplode;
setmodel(missile, "progs/grenade.mdl"); setmodel(missile, "progs/grenade.mdl");
setsize(missile, '0 0 0', '0 0 0'); setsize(missile, VEC_ORIGIN, VEC_ORIGIN);
setorigin(missile, self.origin); setorigin(missile, self.origin);
}; };
@ -679,51 +679,61 @@ PLAYER WEAPON USE
void() W_SetCurrentAmmo = { void() W_SetCurrentAmmo = {
player_run(); // get out of any weapon firing states player_run(); // get out of any weapon firing states
self.items = self.items - (self.items & (IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS)); self.items &= ~(IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS);
if(self.weapon == IT_AXE) { switch(self.weapon) {
self.currentammo = 0; case IT_AXE:
self.weaponmodel = "progs/v_axe.mdl"; self.currentammo = 0;
self.weaponframe = 0; self.weaponmodel = "progs/v_axe.mdl";
} else if(self.weapon == IT_SHOTGUN) { self.weaponframe = 0;
self.currentammo = self.ammo_shells; break;
self.weaponmodel = "progs/v_shot.mdl"; case IT_SHOTGUN:
self.weaponframe = 0; self.currentammo = self.ammo_shells;
self.items = self.items | IT_SHELLS; self.weaponmodel = "progs/v_shot.mdl";
} else if(self.weapon == IT_SUPER_SHOTGUN) { self.weaponframe = 0;
self.currentammo = self.ammo_shells; self.items |= IT_SHELLS;
self.weaponmodel = "progs/v_shot2.mdl"; break;
self.weaponframe = 0; case IT_SUPER_SHOTGUN:
self.items = self.items | IT_SHELLS; self.currentammo = self.ammo_shells;
} else if(self.weapon == IT_NAILGUN) { self.weaponmodel = "progs/v_shot2.mdl";
self.currentammo = self.ammo_nails; self.weaponframe = 0;
self.weaponmodel = "progs/v_nail.mdl"; self.items |= IT_SHELLS;
self.weaponframe = 0; break;
self.items = self.items | IT_NAILS; case IT_NAILGUN:
} else if(self.weapon == IT_SUPER_NAILGUN) { self.currentammo = self.ammo_nails;
self.currentammo = self.ammo_nails; self.weaponmodel = "progs/v_nail.mdl";
self.weaponmodel = "progs/v_nail2.mdl"; self.weaponframe = 0;
self.weaponframe = 0; self.items |= IT_NAILS;
self.items = self.items | IT_NAILS; break;
} else if(self.weapon == IT_GRENADE_LAUNCHER) { case IT_SUPER_NAILGUN:
self.currentammo = self.ammo_rockets; self.currentammo = self.ammo_nails;
self.weaponmodel = "progs/v_rock.mdl"; self.weaponmodel = "progs/v_nail2.mdl";
self.weaponframe = 0; self.weaponframe = 0;
self.items = self.items | IT_ROCKETS; self.items |= IT_NAILS;
} else if(self.weapon == IT_ROCKET_LAUNCHER) { break;
self.currentammo = self.ammo_rockets; case IT_GRENADE_LAUNCHER:
self.weaponmodel = "progs/v_rock2.mdl"; self.currentammo = self.ammo_rockets;
self.weaponframe = 0; self.weaponmodel = "progs/v_rock.mdl";
self.items = self.items | IT_ROCKETS; self.weaponframe = 0;
} else if(self.weapon == IT_LIGHTNING) { self.items |= IT_ROCKETS;
self.currentammo = self.ammo_cells; break;
self.weaponmodel = "progs/v_light.mdl"; case IT_ROCKET_LAUNCHER:
self.weaponframe = 0; self.currentammo = self.ammo_rockets;
self.items = self.items | IT_CELLS; self.weaponmodel = "progs/v_rock2.mdl";
} else { self.weaponframe = 0;
self.currentammo = 0; self.items |= IT_ROCKETS;
self.weaponmodel = ""; break;
self.weaponframe = 0; case IT_LIGHTNING:
self.currentammo = self.ammo_cells;
self.weaponmodel = "progs/v_light.mdl";
self.weaponframe = 0;
self.items |= IT_CELLS;
break;
default:
self.currentammo = 0;
self.weaponmodel = "";
self.weaponframe = 0;
break;
} }
}; };
@ -750,23 +760,6 @@ float() W_BestWeapon = {
return IT_AXE; return IT_AXE;
}; };
float() W_CheckNoAmmo = {
if(self.currentammo > 0) {
return TRUE;
}
if(self.weapon == IT_AXE) {
return TRUE;
}
self.weapon = W_BestWeapon();
W_SetCurrentAmmo();
// drop the weapon down
return FALSE;
};
/* /*
============ ============
W_Attack W_Attack
@ -777,50 +770,59 @@ An attack impulse can be triggered now
void() W_Attack = { void() W_Attack = {
float r; float r;
if(!W_CheckNoAmmo()) { if(self.currentammo <= 0 && self.weapon != IT_AXE) {
self.weapon = W_BestWeapon();
W_SetCurrentAmmo();
return; return;
} }
makevectors(self.v_angle); // calculate forward angle for velocity makevectors(self.v_angle); // calculate forward angle for velocity
self.show_hostile = time + 1; // wake monsters up self.show_hostile = time + 1; // wake monsters up
if(self.weapon == IT_AXE) { switch(self.weapon) {
sound(self, CHAN_WEAPON, "weapons/ax1.wav", 1, ATTN_NORM); case IT_AXE:
r = random(); sound(self, CHAN_WEAPON, "weapons/ax1.wav", 1, ATTN_NORM);
if(r < 0.25) { r = random();
player_axe1(); if(r < 0.25) {
} else if(r < 0.5) { player_axe1();
player_axeb1(); } else if(r < 0.5) {
} else if(r < 0.75) { player_axeb1();
player_axec1(); } else if(r < 0.75) {
} else { player_axec1();
player_axed1(); } else {
} player_axed1();
self.attack_finished = time + 0.5; }
} else if(self.weapon == IT_SHOTGUN) { self.attack_finished = time + 0.5;
player_shot1(); break;
W_FireShotgun(); case IT_SHOTGUN:
self.attack_finished = time + 0.5; player_shot1();
} else if(self.weapon == IT_SUPER_SHOTGUN) { W_FireShotgun();
player_shot1(); self.attack_finished = time + 0.5;
W_FireSuperShotgun(); break;
self.attack_finished = time + 0.7; case IT_SUPER_SHOTGUN:
} else if(self.weapon == IT_NAILGUN) { player_shot1();
player_nail1(); W_FireSuperShotgun();
} else if(self.weapon == IT_SUPER_NAILGUN) { self.attack_finished = time + 0.7;
player_nail1(); break;
} else if(self.weapon == IT_GRENADE_LAUNCHER) { case IT_NAILGUN:
player_rocket1(); case IT_SUPER_NAILGUN:
W_FireGrenade(); player_nail1();
self.attack_finished = time + 0.6; break;
} else if(self.weapon == IT_ROCKET_LAUNCHER) { case IT_GRENADE_LAUNCHER:
player_rocket1(); player_rocket1();
W_FireRocket(); W_FireGrenade();
self.attack_finished = time + 0.8; self.attack_finished = time + 0.6;
} else if(self.weapon == IT_LIGHTNING) { break;
player_light1(); case IT_ROCKET_LAUNCHER:
self.attack_finished = time + 0.1; player_rocket1();
sound(self, CHAN_AUTO, "weapons/lstart.wav", 1, ATTN_NORM); W_FireRocket();
self.attack_finished = time + 0.8;
break;
case IT_LIGHTNING:
player_light1();
self.attack_finished = time + 0.1;
sound(self, CHAN_AUTO, "weapons/lstart.wav", 1, ATTN_NORM);
break;
} }
}; };
@ -961,13 +963,14 @@ void() W_CycleWeapon = {
am = 1; am = 1;
} }
break; break;
default:
return;
} }
if((it & self.weapon) && am == 0) { if((it & self.weapon) && am == 0) {
W_SetCurrentAmmo(); W_SetCurrentAmmo();
return; return;
} }
} }
}; };
/* /*
@ -1030,13 +1033,14 @@ void() W_CycleWeaponReverse = {
am = 1; am = 1;
} }
break; break;
default:
return;
} }
if((it & self.weapon) && am == 0) { if((it & self.weapon) && am == 0) {
W_SetCurrentAmmo(); W_SetCurrentAmmo();
return; return;
} }
} }
}; };
/* /*

View File

@ -62,7 +62,7 @@ void(entity missile, float mspeed, float accuracy) LaunchMissile = {
missile.velocity = vec * mspeed; missile.velocity = vec * mspeed;
missile.angles = '0 0 0'; missile.angles = VEC_ORIGIN;
missile.angles_y = vectoyaw(missile.velocity); missile.angles_y = vectoyaw(missile.velocity);
// set missile duration // set missile duration
@ -196,7 +196,7 @@ void() Wiz_StartFast = {
missile = spawn(); missile = spawn();
missile.owner = self; missile.owner = self;
missile.nextthink = time + 0.6; missile.nextthink = time + 0.6;
setsize(missile, '0 0 0', '0 0 0'); setsize(missile, VEC_ORIGIN, VEC_ORIGIN);
setorigin(missile, self.origin + '0 0 30' + v_forward * 14 + v_right * 14); setorigin(missile, self.origin + '0 0 30' + v_forward * 14 + v_right * 14);
missile.enemy = self.enemy; missile.enemy = self.enemy;
missile.nextthink = time + 0.8; missile.nextthink = time + 0.8;
@ -206,7 +206,7 @@ void() Wiz_StartFast = {
missile = spawn(); missile = spawn();
missile.owner = self; missile.owner = self;
missile.nextthink = time + 1; missile.nextthink = time + 1;
setsize(missile, '0 0 0', '0 0 0'); setsize(missile, VEC_ORIGIN, VEC_ORIGIN);
setorigin(missile, self.origin + '0 0 30' + v_forward * 14 + v_right * -14); setorigin(missile, self.origin + '0 0 30' + v_forward * 14 + v_right * -14);
missile.enemy = self.enemy; missile.enemy = self.enemy;
missile.nextthink = time + 0.3; missile.nextthink = time + 0.3;

View File

@ -45,10 +45,6 @@ $frame paine29 paine30
$frame cruc_1 cruc_2 cruc_3 cruc_4 cruc_5 cruc_6 $frame cruc_1 cruc_2 cruc_3 cruc_4 cruc_5 cruc_6
enum {
SPAWN_CRUCIFIED = 1,
};
//============================================================================= //=============================================================================
void() zombie_stand1 = [ $stand1, zombie_stand2 ] {ai_stand();}; void() zombie_stand1 = [ $stand1, zombie_stand2 ] {ai_stand();};
@ -149,8 +145,8 @@ void() ZombieGrenadeTouch = {
return; return;
} }
sound(self, CHAN_WEAPON, "zombie/z_miss.wav", 1, ATTN_NORM); // bounce sound sound(self, CHAN_WEAPON, "zombie/z_miss.wav", 1, ATTN_NORM); // bounce sound
self.velocity = '0 0 0'; self.velocity = VEC_ORIGIN;
self.avelocity = '0 0 0'; self.avelocity = VEC_ORIGIN;
self.touch = SUB_Remove; self.touch = SUB_Remove;
}; };
@ -190,7 +186,7 @@ void(vector st) ZombieFireGrenade = {
missile.think = SUB_Remove; missile.think = SUB_Remove;
setmodel(missile, "progs/zom_gib.mdl"); setmodel(missile, "progs/zom_gib.mdl");
setsize(missile, '0 0 0', '0 0 0'); setsize(missile, VEC_ORIGIN, VEC_ORIGIN);
setorigin(missile, org); setorigin(missile, org);
}; };
@ -497,7 +493,7 @@ void() monster_zombie = {
self.th_die = zombie_die; self.th_die = zombie_die;
self.th_missile = zombie_missile; self.th_missile = zombie_missile;
if(self.spawnflags & SPAWN_CRUCIFIED) { if(self.spawnflags & ZOMBIE_SPAWN_CRUCIFIED) {
self.movetype = MOVETYPE_NONE; self.movetype = MOVETYPE_NONE;
zombie_cruc1(); zombie_cruc1();
} else { } else {

2
todo
View File

@ -5,7 +5,6 @@ rename all functions to be lower_underscore
core features: core features:
custom pronouns
distributed ammo distributed ammo
lives counting lives counting
@ -27,4 +26,5 @@ third person player weapon models
done: done:
corpse pickups have keys corpse pickups have keys
custom pronouns
no friendly fire no friendly fire