mirror of
https://git.code.sf.net/p/quake/game-source
synced 2024-11-25 13:21:30 +00:00
Beware. klik of death.
This commit is contained in:
parent
cf14b40c95
commit
1cb1b902f9
14 changed files with 889 additions and 655 deletions
|
@ -6,55 +6,63 @@
|
|||
#include "mdl.qh"
|
||||
#include "weapon.qh"
|
||||
|
||||
.void() prethink;
|
||||
.void() actthink;
|
||||
.void() postthink;
|
||||
.void () prethink;
|
||||
.void () actthink;
|
||||
.void () postthink;
|
||||
|
||||
void() PlayerPreThink = {
|
||||
if (is_cl(self))
|
||||
PlayerStartFrame();
|
||||
void ()
|
||||
PlayerPreThink =
|
||||
{
|
||||
if (is_cl (self))
|
||||
PlayerStartFrame ();
|
||||
|
||||
if (self.prethink)
|
||||
self.prethink();
|
||||
self.prethink ();
|
||||
};
|
||||
|
||||
void() act_think = {
|
||||
if (!is_autothink(self)) {
|
||||
void ()
|
||||
act_think =
|
||||
{
|
||||
if (!is_autothink (self)) {
|
||||
frametime = 0.1;
|
||||
PlayerPreThink();
|
||||
PlayerPreThink ();
|
||||
}
|
||||
|
||||
/*if (0.1 seconds have passed) {*/
|
||||
if (self.actthink)
|
||||
self.actthink();
|
||||
self.actthink ();
|
||||
|
||||
if (self.menu_think)
|
||||
self.menu_think();
|
||||
self.menu_think ();
|
||||
|
||||
if (self.mdl_think && !self.mdl_thought)
|
||||
self.mdl_think();
|
||||
self.mdl_think ();
|
||||
self.mdl_thought = FALSE;
|
||||
|
||||
if (self.w_think && !self.w_thought)
|
||||
self.w_think();
|
||||
self.w_think ();
|
||||
self.w_thought = FALSE;
|
||||
/*}*/
|
||||
|
||||
self.nextthink = time + 0.1; /* FIXME: Use sv_mintic here when non-client? */
|
||||
|
||||
if (!is_autothink(self))
|
||||
PlayerPostThink();
|
||||
if (!is_autothink (self))
|
||||
PlayerPostThink ();
|
||||
};
|
||||
|
||||
void() PlayerPostThink = {
|
||||
void ()
|
||||
PlayerPostThink =
|
||||
{
|
||||
if (self.postthink)
|
||||
self.postthink();
|
||||
self.postthink ();
|
||||
|
||||
if (is_cl(self))
|
||||
PlayerEndFrame();
|
||||
if (is_cl (self))
|
||||
PlayerEndFrame ();
|
||||
};
|
||||
|
||||
void() act_setup = {
|
||||
void ()
|
||||
act_setup =
|
||||
{
|
||||
self.think = act_think;
|
||||
self.nextthink = time;
|
||||
};
|
||||
|
|
|
@ -5,13 +5,11 @@
|
|||
#include "damage.qh"
|
||||
|
||||
@extern {
|
||||
.void () prethink;
|
||||
.void () actthink;
|
||||
.void () postthink;
|
||||
|
||||
.void() prethink;
|
||||
.void() actthink;
|
||||
.void() postthink;
|
||||
|
||||
void() act_setup;
|
||||
|
||||
void () act_setup;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -17,8 +17,10 @@
|
|||
|
||||
#define STOP_EPSILON 0.1
|
||||
|
||||
void() dead_prethink = {
|
||||
if (vlen(self.movedir) > vlen(self.velocity)) {
|
||||
void ()
|
||||
dead_prethink =
|
||||
{
|
||||
if (vlen (self.movedir) > vlen (self.velocity)) {
|
||||
self.velocity = '0 0 0';
|
||||
} else {
|
||||
/* FIXME: Use e, decay per frame. */
|
||||
|
@ -27,11 +29,14 @@ void() dead_prethink = {
|
|||
self.pain_finished = time + 0.1;
|
||||
}
|
||||
|
||||
if (self.velocity_x > -STOP_EPSILON && self.velocity_x < STOP_EPSILON)
|
||||
if ((self.velocity_x > -STOP_EPSILON)
|
||||
&& (self.velocity_x < STOP_EPSILON))
|
||||
self.velocity_x = 0;
|
||||
if (self.velocity_y > -STOP_EPSILON && self.velocity_y < STOP_EPSILON)
|
||||
if ((self.velocity_y > -STOP_EPSILON)
|
||||
&& (self.velocity_y < STOP_EPSILON))
|
||||
self.velocity_y = 0;
|
||||
if (self.velocity_z > -STOP_EPSILON && self.velocity_z < STOP_EPSILON)
|
||||
if ((self.velocity_z > -STOP_EPSILON)
|
||||
&& (self.velocity_z < STOP_EPSILON))
|
||||
self.velocity_z = 0;
|
||||
}
|
||||
|
||||
|
@ -48,28 +53,42 @@ void() dead_prethink = {
|
|||
self.movedir = self.velocity;
|
||||
};
|
||||
|
||||
void() dead_postthink = {
|
||||
void ()
|
||||
dead_postthink =
|
||||
{
|
||||
local vector vieworg;
|
||||
|
||||
self.dmg_take = 0;
|
||||
self.dmg_save = 0;
|
||||
|
||||
vieworg = vieworigin(self);
|
||||
vieworg = vieworigin (self);
|
||||
|
||||
if (pointcontents(vieworg + self.velocity*sv_maxtic) != pointcontents(vieworg)) {
|
||||
if (pointcontents (vieworg + self.velocity * sv_maxtic)
|
||||
!= pointcontents (vieworg)) {
|
||||
self.movetype = MOVETYPE_NONE;
|
||||
self.velocity = '0 0 0';
|
||||
setorigin(self, self.origin);
|
||||
}
|
||||
};
|
||||
|
||||
float() dead_takeitem = { return FALSE; };
|
||||
float(float d) dead_takedamage = { return FALSE; };
|
||||
float ()
|
||||
dead_takeitem =
|
||||
{
|
||||
return FALSE;
|
||||
};
|
||||
|
||||
void() act_setup_dead = {
|
||||
act_setup();
|
||||
float (float d)
|
||||
dead_takedamage =
|
||||
{
|
||||
return FALSE;
|
||||
};
|
||||
|
||||
weapon_select_by_impulse(0);
|
||||
void ()
|
||||
act_setup_dead =
|
||||
{
|
||||
act_setup ();
|
||||
|
||||
weapon_select_by_impulse (0);
|
||||
|
||||
self.solid = SOLID_NOT;
|
||||
self.takedamage = DAMAGE_NO;
|
||||
|
@ -105,16 +124,16 @@ void() act_setup_dead = {
|
|||
self.mass = 0;
|
||||
|
||||
self.movedir = self.velocity;
|
||||
self.movedir_z -= sv_gravity * sv_maxtic; /* Gravity hack. */
|
||||
self.movedir_z -= sv_gravity * sv_maxtic; // Gravity hack.
|
||||
self.pain_finished = time + 0.1;
|
||||
self.air_finished = time + 2;
|
||||
|
||||
override_set_th_takeitem(self, dead_takeitem);
|
||||
override_set_th_takedamage(self, dead_takedamage);
|
||||
override_set_th_takeitem (self, dead_takeitem);
|
||||
override_set_th_takedamage (self, dead_takedamage);
|
||||
|
||||
override_set_prethink(self, dead_prethink);
|
||||
override_set_actthink(self, NOTHING_function);
|
||||
override_set_postthink(self, dead_postthink);
|
||||
override_set_prethink (self, dead_prethink);
|
||||
override_set_actthink (self, NOTHING_function);
|
||||
override_set_postthink (self, dead_postthink);
|
||||
|
||||
dead_postthink(); /* make sure we don't noclip when near walls */
|
||||
dead_postthink (); // make sure we don't noclip when near walls
|
||||
};
|
||||
|
|
|
@ -2,9 +2,7 @@
|
|||
#define ACT_DEAD_qh 1
|
||||
|
||||
@extern {
|
||||
|
||||
void() act_setup_dead;
|
||||
|
||||
void () act_setup_dead;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -15,75 +15,79 @@
|
|||
|
||||
#include "override.qh"
|
||||
|
||||
void() act_player_init = {
|
||||
precache_sound("player/plyrjmp8.wav");
|
||||
precache_sound("player/h2ojump.wav");
|
||||
void ()
|
||||
act_player_init =
|
||||
{
|
||||
precache_sound ("player/plyrjmp8.wav");
|
||||
precache_sound ("player/h2ojump.wav");
|
||||
|
||||
precache_sound("player/land.wav");
|
||||
precache_sound("player/land2.wav");
|
||||
precache_sound ("player/land.wav");
|
||||
precache_sound ("player/land2.wav");
|
||||
|
||||
precache_sound("player/inh2o.wav");
|
||||
precache_sound("player/slimbrn2.wav");
|
||||
precache_sound("player/inlava.wav");
|
||||
precache_sound ("player/inh2o.wav");
|
||||
precache_sound ("player/slimbrn2.wav");
|
||||
precache_sound ("player/inlava.wav");
|
||||
|
||||
precache_sound("misc/water1.wav");
|
||||
precache_sound("misc/water2.wav");
|
||||
precache_sound ("misc/water1.wav");
|
||||
precache_sound ("misc/water2.wav");
|
||||
|
||||
precache_sound("player/drown1.wav");
|
||||
precache_sound("player/drown2.wav");
|
||||
precache_sound ("player/drown1.wav");
|
||||
precache_sound ("player/drown2.wav");
|
||||
|
||||
precache_sound("player/lburn1.wav");
|
||||
precache_sound("player/lburn2.wav");
|
||||
precache_sound ("player/lburn1.wav");
|
||||
precache_sound ("player/lburn2.wav");
|
||||
|
||||
precache_sound("player/gasp1.wav");
|
||||
precache_sound("player/gasp2.wav");
|
||||
precache_sound ("player/gasp1.wav");
|
||||
precache_sound ("player/gasp2.wav");
|
||||
|
||||
precache_sound("misc/outwater.wav");
|
||||
precache_sound ("misc/outwater.wav");
|
||||
|
||||
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");
|
||||
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");
|
||||
|
||||
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");
|
||||
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");
|
||||
|
||||
precache_sound("player/gib.wav");
|
||||
precache_sound("player/udeath.wav");
|
||||
precache_sound ("player/gib.wav");
|
||||
precache_sound ("player/udeath.wav");
|
||||
|
||||
precache_sound("player/h2odeath.wav");
|
||||
precache_sound ("player/h2odeath.wav");
|
||||
|
||||
precache_model("progs/backpack.mdl");
|
||||
precache_sound("weapons/lock4.wav");
|
||||
precache_sound("items/itembk2.wav");
|
||||
precache_model ("progs/backpack.mdl");
|
||||
precache_sound ("weapons/lock4.wav");
|
||||
precache_sound ("items/itembk2.wav");
|
||||
};
|
||||
|
||||
// ========================================================================
|
||||
|
||||
void(float scl) player_throw_ammo = {
|
||||
void (float scl)
|
||||
player_throw_ammo =
|
||||
{
|
||||
local entity player;
|
||||
|
||||
player = self;
|
||||
|
||||
self = spawn("BACKPACK");
|
||||
self = spawn ("BACKPACK");
|
||||
|
||||
if (scl > 1) {
|
||||
/* FIXME: This is actually a hack to avoid powerups */
|
||||
#define qg(eid) \
|
||||
if (equip_query(player, eid)) \
|
||||
equip_grant(self, eid) \
|
||||
if (equip_query (player, eid)) \
|
||||
equip_grant (self, eid) \
|
||||
|
||||
qg(EQUIPID_SUPER_SHOTGUN);
|
||||
qg(EQUIPID_NAILGUN);
|
||||
qg(EQUIPID_SUPER_NAILGUN);
|
||||
qg(EQUIPID_GRENADE_LAUNCHER);
|
||||
qg(EQUIPID_ROCKET_LAUNCHER);
|
||||
qg(EQUIPID_LIGHTNING_GUN);
|
||||
qg (EQUIPID_SUPER_SHOTGUN);
|
||||
qg (EQUIPID_NAILGUN);
|
||||
qg (EQUIPID_SUPER_NAILGUN);
|
||||
qg (EQUIPID_GRENADE_LAUNCHER);
|
||||
qg (EQUIPID_ROCKET_LAUNCHER);
|
||||
qg (EQUIPID_LIGHTNING_GUN);
|
||||
#undef qg
|
||||
|
||||
player.itemfield_1 = 0;
|
||||
|
@ -103,18 +107,19 @@ void(float scl) player_throw_ammo = {
|
|||
self.ammo_cells = player.ammo_cells * scl;
|
||||
player.ammo_cells -= self.ammo_cells;
|
||||
|
||||
if (!self.ammo_shells && !self.ammo_nails && !self.ammo_rockets && !self.ammo_cells
|
||||
&& !self.itemfield_1 && !self.itemfield_2 && !self.itemfield_3 && !self.itemfield_4) {
|
||||
remove(self);
|
||||
if (!self.ammo_shells && !self.ammo_nails && !self.ammo_rockets
|
||||
&& !self.ammo_cells && !self.itemfield_1 && !self.itemfield_2
|
||||
&& !self.itemfield_3 && !self.itemfield_4) {
|
||||
remove (self);
|
||||
self = player;
|
||||
return;
|
||||
}
|
||||
|
||||
self.origin = center(player);
|
||||
self.origin = center (player);
|
||||
|
||||
self.movetype = MOVETYPE_TOSS;
|
||||
self.velocity_x = crandom()*100;
|
||||
self.velocity_y = crandom()*100;
|
||||
self.velocity_x = crandom () * 100;
|
||||
self.velocity_y = crandom () * 100;
|
||||
self.velocity_z = 200;
|
||||
|
||||
self.mins = '-16 -16 0';
|
||||
|
@ -127,42 +132,51 @@ void(float scl) player_throw_ammo = {
|
|||
self.wait = -1;
|
||||
|
||||
self.think = SUB_remove;
|
||||
self.nextthink = time + 20 + random()*20;
|
||||
self.nextthink = time + 20 + random () *20;
|
||||
|
||||
item_generic();
|
||||
item_generic ();
|
||||
|
||||
self = player;
|
||||
};
|
||||
|
||||
void() player_die = {
|
||||
void ()
|
||||
player_die =
|
||||
{
|
||||
local float r;
|
||||
|
||||
if (self.health > CONFIG_GIB_HEALTH) {
|
||||
if (self.waterlevel >= 3) {
|
||||
self.noise = "player/h2odeath.wav";
|
||||
} else {
|
||||
r = random()*5;
|
||||
if (r < 1) self.noise = "player/death1.wav";
|
||||
else if (r < 2) self.noise = "player/death2.wav";
|
||||
else if (r < 3) self.noise = "player/death3.wav";
|
||||
else if (r < 4) self.noise = "player/death4.wav";
|
||||
else self.noise = "player/death5.wav";
|
||||
r = random () * 5;
|
||||
if (r < 1)
|
||||
self.noise = "player/death1.wav";
|
||||
else if (r < 2)
|
||||
self.noise = "player/death2.wav";
|
||||
else if (r < 3)
|
||||
self.noise = "player/death3.wav";
|
||||
else if (r < 4)
|
||||
self.noise = "player/death4.wav";
|
||||
else
|
||||
self.noise = "player/death5.wav";
|
||||
}
|
||||
sound(self, CHAN_VOICE, self.noise, 1, ATTN_NONE);
|
||||
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NONE);
|
||||
|
||||
player_throw_ammo(2);
|
||||
mdl_bodyque_and_func(MDL_FUNC_DIE, floor(random()*5));
|
||||
player_throw_ammo (2);
|
||||
mdl_bodyque_and_func (MDL_FUNC_DIE, floor (random () * 5));
|
||||
} else {
|
||||
r = random()*2;
|
||||
if (r < 1) self.noise = "player/gib.wav";
|
||||
else self.noise = "player/udeath.wav";
|
||||
r = random () * 2;
|
||||
if (r < 1)
|
||||
self.noise = "player/gib.wav";
|
||||
else
|
||||
self.noise = "player/udeath.wav";
|
||||
|
||||
sound(self, CHAN_VOICE, self.noise, 1, ATTN_NONE);
|
||||
mdl_bodyque_and_func(MDL_FUNC_GIB, 0);
|
||||
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NONE);
|
||||
mdl_bodyque_and_func (MDL_FUNC_GIB, 0);
|
||||
}
|
||||
|
||||
makevectors(self.angles); /* Not v_angle! */
|
||||
self.velocity = (v_forward*-200) + (v_up*100);
|
||||
makevectors (self.angles); /* Not v_angle! */
|
||||
self.velocity = (v_forward * -200) + (v_up * 100);
|
||||
|
||||
if (self.v_angle_x < 75 && self.v_angle_x > -75) {
|
||||
self.angles = self.v_angle;
|
||||
|
@ -171,155 +185,199 @@ void() player_die = {
|
|||
}
|
||||
|
||||
/* FIXME: Hack. */
|
||||
setorigin(self, vieworigin(self));
|
||||
RemoveClientFromGame();
|
||||
setorigin (self, vieworigin (self));
|
||||
RemoveClientFromGame ();
|
||||
};
|
||||
|
||||
// ========================================================================
|
||||
|
||||
float(float d) _player_takedamage_core = {
|
||||
float (float d)
|
||||
_player_takedamage_core =
|
||||
{
|
||||
self.health -= d;
|
||||
self.dmg_take += d;
|
||||
|
||||
if (floor(self.health) <= 0) {
|
||||
deathmsg_display();
|
||||
player_die();
|
||||
if (floor (self.health) <= 0) {
|
||||
deathmsg_display ();
|
||||
player_die ();
|
||||
} else {
|
||||
deathmsg_nodisplay();
|
||||
self.mdl_func(MDL_FUNC_PAIN, d);
|
||||
deathmsg_nodisplay ();
|
||||
self.mdl_func (MDL_FUNC_PAIN, d);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
};
|
||||
|
||||
float(float d) player_takedamage = {
|
||||
local float r, taked;
|
||||
float (float d)
|
||||
player_takedamage =
|
||||
{
|
||||
local float taked, r;
|
||||
|
||||
damage_push(d);
|
||||
damage_push (d);
|
||||
|
||||
taked = damage_armor(d);
|
||||
self.dmg_save = self.dmg_save + (d - taked);
|
||||
taked = damage_armor (d);
|
||||
self.dmg_save += (d - taked);
|
||||
|
||||
if (taked <= 0)
|
||||
return FALSE;
|
||||
|
||||
if (self.pain_finished < time) {
|
||||
if ((self.mdl_mod & MDL_MOD_SWIM_IN) && self.air_finished < (time + random()*9)) {
|
||||
r = random()*2;
|
||||
if (r < 1) self.noise = "player/drown2.wav";
|
||||
else self.noise = "player/drown1.wav";
|
||||
if ((self.mdl_mod & MDL_MOD_SWIM_IN) && self.air_finished < (time + random () * 9)) {
|
||||
r = random () * 2;
|
||||
if (r < 1)
|
||||
self.noise = "player/drown2.wav";
|
||||
else
|
||||
self.noise = "player/drown1.wav";
|
||||
} else {
|
||||
r = random()*5;
|
||||
if (r < 1) self.noise = "player/pain1.wav";
|
||||
else if (r < 2) self.noise = "player/pain2.wav";
|
||||
else if (r < 3) self.noise = "player/pain3.wav";
|
||||
else if (r < 4) self.noise = "player/pain4.wav";
|
||||
else if (r < 5) self.noise = "player/pain5.wav";
|
||||
else self.noise = "player/pain6.wav";
|
||||
r = random () * 5;
|
||||
if (r < 1)
|
||||
self.noise = "player/pain1.wav";
|
||||
else if (r < 2)
|
||||
self.noise = "player/pain2.wav";
|
||||
else if (r < 3)
|
||||
self.noise = "player/pain3.wav";
|
||||
else if (r < 4)
|
||||
self.noise = "player/pain4.wav";
|
||||
else if (r < 5)
|
||||
self.noise = "player/pain5.wav";
|
||||
else
|
||||
self.noise = "player/pain6.wav";
|
||||
}
|
||||
sound(self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
|
||||
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
|
||||
|
||||
self.pain_finished = time + 1;
|
||||
}
|
||||
|
||||
return _player_takedamage_core(taked);
|
||||
return _player_takedamage_core (taked);
|
||||
};
|
||||
|
||||
// ========================================================================
|
||||
|
||||
float(float d) _player_takedamage_drown = {
|
||||
float (float d)
|
||||
_player_takedamage_drown =
|
||||
{
|
||||
local float r;
|
||||
|
||||
if (d <= 0)
|
||||
return FALSE;
|
||||
|
||||
if (self.pain_finished < time) {
|
||||
r = random()*2;
|
||||
if (r < 1) self.noise = self.noise3;
|
||||
else self.noise = self.noise4;
|
||||
r = random () * 2;
|
||||
if (r < 1)
|
||||
self.noise = self.noise3;
|
||||
else
|
||||
self.noise = self.noise4;
|
||||
|
||||
sound(self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
|
||||
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
|
||||
|
||||
self.pain_finished = time + 1;
|
||||
}
|
||||
|
||||
return _player_takedamage_core(d);
|
||||
return _player_takedamage_core (d);
|
||||
};
|
||||
|
||||
float(float d) _player_takedamage_melt = {
|
||||
local float r, taked;
|
||||
float (float d)
|
||||
_player_takedamage_melt =
|
||||
{
|
||||
local float taked, r;
|
||||
|
||||
taked = damage_armor(d);
|
||||
taked = damage_armor (d);
|
||||
self.dmg_save += d - taked;
|
||||
|
||||
if (taked <= 0)
|
||||
return FALSE;
|
||||
|
||||
if (self.pain_finished < time) {
|
||||
r = random()*2;
|
||||
if (r < 1) self.noise = self.noise3;
|
||||
else self.noise = self.noise4;
|
||||
r = random () * 2;
|
||||
if (r < 1)
|
||||
self.noise = self.noise3;
|
||||
else
|
||||
self.noise = self.noise4;
|
||||
|
||||
sound(self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
|
||||
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
|
||||
|
||||
self.pain_finished = time + 1;
|
||||
}
|
||||
|
||||
return _player_takedamage_core(taked);
|
||||
return _player_takedamage_core (taked);
|
||||
};
|
||||
|
||||
float(float d, float(float d) damg_func, void() deathmessage) _player_damage_custom = {
|
||||
float (float d, float (float d) damg_func, void () deathmessage)
|
||||
_player_damage_custom =
|
||||
{
|
||||
local float ret;
|
||||
|
||||
override_set_th_takedamage(self, damg_func);
|
||||
ret = damage(self, self, world, d, deathmessage);
|
||||
override_set_th_takedamage(self, player_takedamage);
|
||||
override_set_th_takedamage (self, damg_func);
|
||||
ret = damage (self, self, world, d, deathmessage);
|
||||
override_set_th_takedamage (self, player_takedamage);
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
// ========================================================================
|
||||
|
||||
void() _deathmsg_player_liquid = {
|
||||
void ()
|
||||
_deathmsg_player_liquid =
|
||||
{
|
||||
local string def_nname;
|
||||
local float r;
|
||||
|
||||
def_nname = name(self);
|
||||
def_nname = name (self);
|
||||
|
||||
if (self.watertype == CONTENT_WATER) {
|
||||
r = random()*2;
|
||||
if (r < 1) bprint(PRINT_DEATH, def_nname, " sleeps with the fishes.\n");
|
||||
else bprint(PRINT_DEATH, def_nname, " hunts for air.\n");
|
||||
} else if (self.watertype == CONTENT_SLIME) {
|
||||
r = random()*2;
|
||||
if (r < 1) bprint(PRINT_DEATH, def_nname, " can't exist on slime alone.\n");
|
||||
else bprint(PRINT_DEATH, def_nname, " floats in slime.\n");
|
||||
} else if (self.watertype == CONTENT_LAVA) {
|
||||
r = random()*3;
|
||||
if (r < 1) bprint(PRINT_DEATH, def_nname, " swam in a volcano.\n");
|
||||
else if (r < 2) bprint(PRINT_DEATH, def_nname, " turned into hot slag.\n");
|
||||
else bprint(PRINT_DEATH, def_nname, " parties with Chthon.\n");
|
||||
} else {
|
||||
bprint(PRINT_DEATH, def_nname, " gulps it down.\n");
|
||||
switch (self.watertype) {
|
||||
case CONTENT_WATER:
|
||||
r = random () * 2;
|
||||
if (r < 1)
|
||||
bprint (PRINT_DEATH, def_nname, " sleeps with the fishes.\n");
|
||||
else
|
||||
bprint (PRINT_DEATH, def_nname, " hunts for air.\n");
|
||||
break;
|
||||
case CONTENT_SLIME:
|
||||
r = random () * 2;
|
||||
if (r < 1)
|
||||
bprint (PRINT_DEATH, def_nname, " can't exist on slime alone.\n");
|
||||
else
|
||||
bprint (PRINT_DEATH, def_nname, " floats in slime.\n");
|
||||
break;
|
||||
case CONTENT_LAVA:
|
||||
r = random () * 3;
|
||||
if (r < 1)
|
||||
bprint (PRINT_DEATH, def_nname, " swam in a volcano.\n");
|
||||
else if (r < 2)
|
||||
bprint (PRINT_DEATH, def_nname, " turned into hot slag.\n");
|
||||
else
|
||||
bprint (PRINT_DEATH, def_nname, " parties with Chthon.\n");
|
||||
break;
|
||||
default:
|
||||
bprint (PRINT_DEATH, def_nname, " gulps it down.\n");
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
void() _deathmsg_player_fall = {
|
||||
void ()
|
||||
_deathmsg_player_fall =
|
||||
{
|
||||
local string def_name;
|
||||
local float r;
|
||||
|
||||
def_name = name(self);
|
||||
def_name = name (self);
|
||||
|
||||
r = random()*3;
|
||||
if (r < 1) bprint(PRINT_DEATH, def_name, " landed head-first.\n");
|
||||
else if (r < 2) bprint(PRINT_DEATH, def_name, " cratered.\n");
|
||||
else bprint(PRINT_DEATH, def_name, " took a nose dive into the ground.\n");
|
||||
r = random () * 3;
|
||||
if (r < 1)
|
||||
bprint (PRINT_DEATH, def_name, " landed head-first.\n");
|
||||
else if (r < 2)
|
||||
bprint (PRINT_DEATH, def_name, " cratered.\n");
|
||||
else
|
||||
bprint (PRINT_DEATH, def_name,
|
||||
" took a nose dive into the ground.\n");
|
||||
};
|
||||
|
||||
// ========================================================================
|
||||
|
||||
/* This is so stupid. */
|
||||
float() _player_jump = {
|
||||
float ()
|
||||
_player_jump =
|
||||
{
|
||||
if (!self.button2) {
|
||||
self.flags |= FL_JUMPRELEASED;
|
||||
return FALSE;
|
||||
|
@ -331,7 +389,7 @@ float() _player_jump = {
|
|||
if (!(self.flags & FL_JUMPRELEASED))
|
||||
return FALSE;
|
||||
|
||||
self.mdl_func(MDL_FUNC_JUMP, 0);
|
||||
self.mdl_func (MDL_FUNC_JUMP, 0);
|
||||
|
||||
self.flags &= ~FL_JUMPRELEASED;
|
||||
self.button2 = 0;
|
||||
|
@ -339,39 +397,43 @@ float() _player_jump = {
|
|||
return TRUE;
|
||||
};
|
||||
|
||||
void() _player_water_jump = {
|
||||
void ()
|
||||
_player_water_jump =
|
||||
{
|
||||
if (self.waterlevel <= 1) {
|
||||
if (_player_jump())
|
||||
sound(self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
|
||||
sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.waterlevel <= 2) {
|
||||
if (_player_jump())
|
||||
sound(self, CHAN_BODY, "misc/water2.wav", 1, ATTN_NORM);
|
||||
if (_player_jump ())
|
||||
sound (self, CHAN_BODY, "misc/water2.wav", 1, ATTN_NORM);
|
||||
}
|
||||
|
||||
/* Yeah. The engine is a piece of crap. */
|
||||
if (self.button2) {
|
||||
if (self.flags & FL_ONGROUND) {
|
||||
self.flags = self.flags - FL_ONGROUND;
|
||||
self.origin_z = self.origin_z + 1;
|
||||
self.flags &= ~FL_ONGROUND;
|
||||
self.origin_z++;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/* This is called every frame... */
|
||||
void() player_prethink = {
|
||||
void ()
|
||||
player_prethink =
|
||||
{
|
||||
/* Gasp for air if we weren't swimming..
|
||||
/* Checking here rather than later, with mdl_mod is a HACK */
|
||||
/* It avoids the gasp when the player hasn't communicated
|
||||
with the server in a while (it happens..) */
|
||||
if (self.waterlevel < 3) {
|
||||
if (self.mdl_mod&MDL_MOD_SWIM_IN) {
|
||||
if (self.mdl_mod & MDL_MOD_SWIM_IN) {
|
||||
if (self.air_finished < time)
|
||||
sound(self, CHAN_VOICE, "player/gasp2.wav", 1, ATTN_NORM);
|
||||
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);
|
||||
sound (self, CHAN_VOICE, "player/gasp1.wav", 1, ATTN_NORM);
|
||||
}
|
||||
|
||||
self.air_finished = time + 12;
|
||||
|
@ -388,11 +450,15 @@ void() player_prethink = {
|
|||
if (self.watertype == CONTENT_SLIME) {
|
||||
self.noise3 = "player/lburn1.wav";
|
||||
self.noise4 = "player/lburn2.wav";
|
||||
_player_damage_custom(4*self.waterlevel*frametime, _player_takedamage_melt, _deathmsg_player_liquid);
|
||||
_player_damage_custom (4 * self.waterlevel * frametime,
|
||||
_player_takedamage_melt,
|
||||
_deathmsg_player_liquid);
|
||||
} else if (self.watertype == CONTENT_LAVA) {
|
||||
self.noise3 = "player/lburn1.wav";
|
||||
self.noise4 = "player/lburn2.wav";
|
||||
_player_damage_custom(50*self.waterlevel*frametime, _player_takedamage_melt, _deathmsg_player_liquid);
|
||||
_player_damage_custom (50 * self.waterlevel * frametime,
|
||||
_player_takedamage_melt,
|
||||
_deathmsg_player_liquid);
|
||||
}
|
||||
|
||||
/* Try to breathe :) */
|
||||
|
@ -400,22 +466,24 @@ void() player_prethink = {
|
|||
local float damg;
|
||||
|
||||
damg = (time - self.air_finished) * 0.2;
|
||||
if (damg > 1.5) damg = 1.5;
|
||||
if (damg > 1.5)
|
||||
damg = 1.5;
|
||||
|
||||
self.noise3 = "player/drown1.wav";
|
||||
self.noise4 = "player/drown2.wav";
|
||||
_player_damage_custom(damg, _player_takedamage_drown, _deathmsg_player_liquid);
|
||||
_player_damage_custom (damg, _player_takedamage_drown,
|
||||
_deathmsg_player_liquid);
|
||||
}
|
||||
|
||||
/* Enter/exit water, swim sound */
|
||||
if (!self.waterlevel) {
|
||||
if (self.flags & FL_INWATER) {
|
||||
sound(self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
|
||||
self.flags = self.flags - FL_INWATER;
|
||||
sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
|
||||
self.flags &= ~FL_INWATER;
|
||||
}
|
||||
|
||||
if (_player_jump())
|
||||
sound(self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
|
||||
sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
|
||||
} else {
|
||||
if (!(self.flags & FL_INWATER)) {
|
||||
if (self.watertype == CONTENT_WATER)
|
||||
|
@ -424,7 +492,7 @@ void() player_prethink = {
|
|||
self.noise = "player/slimbrn2.wav";
|
||||
else if (self.watertype == CONTENT_LAVA)
|
||||
self.noise = "player/inlava.wav";
|
||||
sound(self, CHAN_BODY, self.noise, 1, ATTN_NORM);
|
||||
sound (self, CHAN_BODY, self.noise, 1, ATTN_NORM);
|
||||
|
||||
self.flags = (self.flags & ~FL_JUMPRELEASED) | FL_INWATER;
|
||||
|
||||
|
@ -434,39 +502,44 @@ void() player_prethink = {
|
|||
if (self.mdl_mod&MDL_MOD_SWIM) {
|
||||
local float increment, mxspeed;
|
||||
|
||||
increment = vlen(self.origin - self.pos1);
|
||||
mxspeed = calc_max_speed(self);
|
||||
increment = vlen (self.origin - self.pos1);
|
||||
mxspeed = calc_max_speed (self);
|
||||
if (increment > mxspeed)
|
||||
increment = mxspeed;
|
||||
|
||||
self.water_finished += increment;
|
||||
if (self.water_finished >= mxspeed) {
|
||||
self.water_finished = 0;
|
||||
if (random() < 0.5) self.noise = "misc/water1.wav";
|
||||
else self.noise = "misc/water2.wav";
|
||||
sound(self, CHAN_BODY, self.noise, 1, ATTN_NORM);
|
||||
if (random () < 0.5)
|
||||
self.noise = "misc/water1.wav";
|
||||
else
|
||||
self.noise = "misc/water2.wav";
|
||||
sound (self, CHAN_BODY, self.noise, 1, ATTN_NORM);
|
||||
}
|
||||
}
|
||||
|
||||
_player_water_jump();
|
||||
_player_water_jump ();
|
||||
}
|
||||
|
||||
self.pos1 = self.origin;
|
||||
|
||||
#if DEBUG
|
||||
debug_impulse();
|
||||
debug_impulse ();
|
||||
#endif
|
||||
weapon_player_impulse();
|
||||
weapon_player_impulse ();
|
||||
};
|
||||
|
||||
/* This is not called every frame */
|
||||
void() player_think = {
|
||||
/* The player does not think. */
|
||||
void ()
|
||||
player_think =
|
||||
{ // The player does not think.
|
||||
};
|
||||
|
||||
/* FIXME: We should check to see if we actually collided.
|
||||
I don't know how to at the moment... */
|
||||
void() player_velocity_damage = {
|
||||
void ()
|
||||
player_velocity_damage =
|
||||
{
|
||||
local vector vel, dir;
|
||||
local float v1, v2;
|
||||
|
||||
|
@ -478,45 +551,47 @@ void() player_velocity_damage = {
|
|||
return;
|
||||
|
||||
/* Did we slow down a lot? */
|
||||
v1 = vlen(vel);
|
||||
v2 = vlen(self.velocity);
|
||||
v1 = vlen (vel);
|
||||
v2 = vlen (self.velocity);
|
||||
if (v2 >= v1)
|
||||
return;
|
||||
|
||||
vel = vel - self.velocity;
|
||||
vel_z = vel_z * 2;
|
||||
v1 = vlen(vel);
|
||||
v1 = vlen (vel);
|
||||
|
||||
/* Find the largest magnitude dir */
|
||||
vel_x = fabs(vel_x);
|
||||
vel_y = fabs(vel_y);
|
||||
vel_z = fabs(vel_z);
|
||||
vel_x = fabs (vel_x);
|
||||
vel_y = fabs (vel_y);
|
||||
vel_z = fabs (vel_z);
|
||||
|
||||
dir = '0 0 1';
|
||||
if (vel_y > (vel*dir))
|
||||
if (vel_y > (vel * dir))
|
||||
dir = '0 1 0';
|
||||
if (vel_x > (vel*dir))
|
||||
if (vel_x > (vel * dir))
|
||||
dir = '1 0 0';
|
||||
|
||||
/* Play sounds, apply damage */
|
||||
if (v1 > CONFIG_LAND_SOUND) {
|
||||
if (dir_z && self.watertype == CONTENT_WATER) {
|
||||
if (dir_z && (self.watertype == CONTENT_WATER)) {
|
||||
self.noise = "player/h2ojump.wav";
|
||||
} else if (v1 > CONFIG_LAND_HURT) {
|
||||
self.noise = "player/land2.wav";
|
||||
self.pain_finished = time + 1;
|
||||
damage(self, self, world, 5, _deathmsg_player_fall);
|
||||
damage (self, self, world, 5, _deathmsg_player_fall);
|
||||
} else {
|
||||
self.noise = "player/land.wav";
|
||||
}
|
||||
|
||||
sound(self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
|
||||
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
|
||||
}
|
||||
};
|
||||
|
||||
/* This is also called every frame... */
|
||||
void() player_postthink = {
|
||||
player_velocity_damage();
|
||||
void ()
|
||||
player_postthink =
|
||||
{
|
||||
player_velocity_damage ();
|
||||
|
||||
self.items &= ~(IT_ARMOR1|IT_ARMOR2|IT_ARMOR3);
|
||||
if (self.armortype >= 0.8)
|
||||
|
@ -526,100 +601,119 @@ void() player_postthink = {
|
|||
else if (self.armortype >= 0.3)
|
||||
self.items |= IT_ARMOR1;
|
||||
|
||||
update_weapon_flags();
|
||||
weapon_set_ammo();
|
||||
update_weapon_flags ();
|
||||
weapon_set_ammo ();
|
||||
};
|
||||
|
||||
// ========================================================================
|
||||
|
||||
void(float nitem, string str1, string str2) _item_xprint_strs = {
|
||||
if (!is_cl(self))
|
||||
void (float nitem, string str1, string str2)
|
||||
_item_xprint_strs =
|
||||
{
|
||||
if (!is_cl (self))
|
||||
return;
|
||||
if (!str1)
|
||||
return;
|
||||
|
||||
if (!str1) return;
|
||||
|
||||
if (nitem == 1) {
|
||||
stuffcmd(self, "bf\n");
|
||||
xprint_start(self, PRINT_LOW);
|
||||
xprint_str("You get ");
|
||||
} else if (nitem > 1) xprint_str(", ");
|
||||
stuffcmd (self, "bf\n");
|
||||
xprint_start (self, PRINT_LOW);
|
||||
xprint_str ("You get ");
|
||||
} else if (nitem > 1)
|
||||
xprint_str (", ");
|
||||
|
||||
xprint_str(str1);
|
||||
if (str2) xprint_str(str2);
|
||||
xprint_str (str1);
|
||||
if (str2)
|
||||
xprint_str (str2);
|
||||
};
|
||||
|
||||
void(float nitem, string str1, string str2) _item_xprint_strs_last = {
|
||||
void (float nitem, string str1, string str2)
|
||||
_item_xprint_strs_last =
|
||||
{
|
||||
if (!is_cl(self))
|
||||
return;
|
||||
|
||||
if (!str1) return;
|
||||
if (!str1)
|
||||
return;
|
||||
|
||||
if (nitem == 1) {
|
||||
stuffcmd(self, "bf\n");
|
||||
xprint_start(self, PRINT_LOW);
|
||||
xprint_str("You get ");
|
||||
stuffcmd (self, "bf\n");
|
||||
xprint_start (self, PRINT_LOW);
|
||||
xprint_str ("You get ");
|
||||
}
|
||||
|
||||
if (nitem == 2) xprint_str(" and ");
|
||||
else if (nitem > 2) xprint_str(", and ");
|
||||
if (nitem == 2)
|
||||
xprint_str (" and ");
|
||||
else if (nitem > 2)
|
||||
xprint_str (", and ");
|
||||
|
||||
xprint_str(str1);
|
||||
if (str2) xprint_str(str2);
|
||||
xprint_str (str1);
|
||||
if (str2)
|
||||
xprint_str (str2);
|
||||
|
||||
xprint_str("\n");
|
||||
xprint_str ("\n");
|
||||
};
|
||||
|
||||
float nitem;
|
||||
string str1, str2;
|
||||
void(.float fld, float max, string sing, string plur) _player_takefield = {
|
||||
void (.float fld, float max, string sing, string plur)
|
||||
_player_takefield =
|
||||
{
|
||||
local float new, diff;
|
||||
|
||||
new = increase_bound(self.fld, other.fld, max);
|
||||
if (new > 999) new = 999;
|
||||
new = increase_bound (self.fld, other.fld, max);
|
||||
if (new > 999)
|
||||
new = 999;
|
||||
if (new > self.fld) {
|
||||
diff = floor(new) - floor(self.fld);
|
||||
if (!diff) diff = new - self.fld;
|
||||
diff = floor (new) - floor (self.fld);
|
||||
if (!diff)
|
||||
diff = new - self.fld;
|
||||
|
||||
_item_xprint_strs(nitem, str1, str2);
|
||||
str1 = ftos(diff);
|
||||
if (diff == 1) str2 = sing;
|
||||
else str2 = plur;
|
||||
_item_xprint_strs (nitem, str1, str2);
|
||||
str1 = ftos (diff);
|
||||
if (diff == 1)
|
||||
str2 = sing;
|
||||
else
|
||||
str2 = plur;
|
||||
nitem++;
|
||||
|
||||
self.fld = new;
|
||||
}
|
||||
};
|
||||
|
||||
float() player_takeitem = {
|
||||
float ()
|
||||
player_takeitem =
|
||||
{
|
||||
local float eid;
|
||||
|
||||
nitem = 0;
|
||||
str1 = NIL;
|
||||
str2 = NIL;
|
||||
|
||||
while ((eid = equip_iter(other)) != -1) {
|
||||
if (equip_query(self, eid))
|
||||
while ((eid = equip_iter (other)) != -1) {
|
||||
if (equip_query (self, eid))
|
||||
continue;
|
||||
|
||||
equip_grant(self, eid);
|
||||
equip_grant (self, eid);
|
||||
|
||||
_item_xprint_strs(nitem, str1, str2);
|
||||
_item_xprint_strs (nitem, str1, str2);
|
||||
str1 = "the ";
|
||||
str2 = equip_id_to_string(eid);
|
||||
str2 = equip_id_to_string (eid);
|
||||
nitem++;
|
||||
}
|
||||
|
||||
_player_takefield(ammo_shells, self.max_ammo_shells, " shell", " shells");
|
||||
_player_takefield(ammo_nails, self.max_ammo_nails, " nail", " nails");
|
||||
_player_takefield(ammo_rockets, self.max_ammo_rockets, " rocket", " rockets");
|
||||
_player_takefield(ammo_cells, self.max_ammo_cells, " cell", " cells");
|
||||
_player_takefield (ammo_shells, self.max_ammo_shells, " shell", " shells");
|
||||
_player_takefield (ammo_nails, self.max_ammo_nails, " nail", " nails");
|
||||
_player_takefield (ammo_rockets, self.max_ammo_rockets, " rocket",
|
||||
" rockets");
|
||||
_player_takefield (ammo_cells, self.max_ammo_cells, " cell", " cells");
|
||||
|
||||
if (other.armorvalue <= self.max_armor) {
|
||||
if ((other.armorvalue*other.armortype) > (self.armorvalue*self.armortype)) {
|
||||
if ((other.armorvalue * other.armortype)
|
||||
> (self.armorvalue * self.armortype)) {
|
||||
self.armorvalue = other.armorvalue;
|
||||
self.armortype = other.armortype;
|
||||
|
||||
_item_xprint_strs(nitem, str1, str2);
|
||||
_item_xprint_strs (nitem, str1, str2);
|
||||
str2 = NIL;
|
||||
if (self.armortype >= 0.8)
|
||||
str1 = "strong armor";
|
||||
|
@ -633,18 +727,20 @@ float() player_takeitem = {
|
|||
}
|
||||
}
|
||||
|
||||
_player_takefield(health, self.max_health, " health", " health");
|
||||
_player_takefield (health, self.max_health, " health", " health");
|
||||
|
||||
_item_xprint_strs_last(nitem, str1, str2);
|
||||
_item_xprint_strs_last (nitem, str1, str2);
|
||||
|
||||
if (nitem) return TRUE;
|
||||
if (nitem)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
};
|
||||
|
||||
// ===================================================================== //
|
||||
|
||||
void() act_setup_player = {
|
||||
act_setup();
|
||||
void ()
|
||||
act_setup_player ={
|
||||
act_setup ();
|
||||
|
||||
self.movedir = '0 0 0';
|
||||
|
||||
|
@ -662,11 +758,11 @@ void() act_setup_player = {
|
|||
self.pain_finished = 0;
|
||||
self.water_finished = 0;
|
||||
|
||||
override_set_th_takeitem(self, player_takeitem);
|
||||
override_set_th_takeitem (self, player_takeitem);
|
||||
|
||||
override_set_th_takedamage(self, player_takedamage);
|
||||
override_set_th_takedamage (self, player_takedamage);
|
||||
|
||||
override_set_prethink(self, player_prethink);
|
||||
override_set_actthink(self, player_think);
|
||||
override_set_postthink(self, player_postthink);
|
||||
override_set_prethink (self, player_prethink);
|
||||
override_set_actthink (self, player_think);
|
||||
override_set_postthink (self, player_postthink);
|
||||
};
|
||||
|
|
|
@ -2,10 +2,8 @@
|
|||
#define ACT_PLAYER_qh 1
|
||||
|
||||
@extern {
|
||||
|
||||
void() act_player_init;
|
||||
void() act_setup_player;
|
||||
|
||||
void () act_player_init;
|
||||
void () act_setup_player;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -15,7 +15,11 @@
|
|||
/*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); };
|
||||
void ()
|
||||
info_null =
|
||||
{
|
||||
remove (self);
|
||||
};
|
||||
|
||||
// ===============================================================
|
||||
|
||||
|
@ -26,9 +30,11 @@ Default style is 0
|
|||
If targeted, it will toggle between on or off.
|
||||
Makes steady fluorescent humming sound
|
||||
*/
|
||||
void() light_fluoro = {
|
||||
void ()
|
||||
light_fluoro =
|
||||
{
|
||||
self.noise = "ambience/fl_hum1.wav";
|
||||
light();
|
||||
light ();
|
||||
};
|
||||
|
||||
/*QUAKED light_fluorospark (0 1 0) (-8 -8 -8) (8 8 8)
|
||||
|
@ -37,7 +43,9 @@ Default light value is 300
|
|||
Default style is 10
|
||||
Makes sparking, broken fluorescent sound
|
||||
*/
|
||||
void() light_fluorospark = {
|
||||
void ()
|
||||
light_fluorospark =
|
||||
{
|
||||
if (!self.style)
|
||||
self.style = 10;
|
||||
|
||||
|
@ -50,7 +58,9 @@ Sphere globe light.
|
|||
Default light value is 300
|
||||
Default style is 0
|
||||
*/
|
||||
void() light_globe = {
|
||||
void ()
|
||||
light_globe =
|
||||
{
|
||||
self.model = "progs/s_light.spr";
|
||||
light();
|
||||
};
|
||||
|
@ -60,38 +70,46 @@ Short wall torch
|
|||
Default light value is 200
|
||||
Default style is 0
|
||||
*/
|
||||
void() light_torch_small_walltorch = {
|
||||
void ()
|
||||
light_torch_small_walltorch =
|
||||
{
|
||||
self.model = "progs/flame.mdl";
|
||||
self.noise = "ambience/fire1.wav";
|
||||
light();
|
||||
light ();
|
||||
};
|
||||
|
||||
/*QUAKED light_flame_large_yellow (0 1 0) (-10 -10 -12) (12 12 18)
|
||||
Large yellow flame ball
|
||||
*/
|
||||
void() light_flame_large_yellow = {
|
||||
void ()
|
||||
light_flame_large_yellow =
|
||||
{
|
||||
self.model = "progs/flame2.mdl";
|
||||
self.frame = 1;
|
||||
self.noise = "ambience/fire1.wav";
|
||||
light();
|
||||
light ();
|
||||
};
|
||||
|
||||
/*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 = {
|
||||
void ()
|
||||
light_flame_small_yellow =
|
||||
{
|
||||
self.model = "progs/flame2.mdl";
|
||||
self.noise = "ambience/fire1.wav";
|
||||
light();
|
||||
light ();
|
||||
};
|
||||
|
||||
/*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 = {
|
||||
void ()
|
||||
light_flame_small_white =
|
||||
{
|
||||
self.model = "progs/flame2.mdl";
|
||||
self.noise = "ambience/fire1.wav";
|
||||
light();
|
||||
light ();
|
||||
};
|
||||
|
||||
// ====================================================================
|
||||
|
@ -99,7 +117,9 @@ void() light_flame_small_white = {
|
|||
/*QUAKED misc_explobox2 (0 .5 .8) (0 0 0) (32 32 64)
|
||||
Smaller exploding box, REGISTERED ONLY
|
||||
*/
|
||||
void() misc_explobox2 = {
|
||||
void ()
|
||||
misc_explobox2 =
|
||||
{
|
||||
self.model = "maps/b_exbox2.bsp";
|
||||
self.noise = "weapons/r_exp3.wav";
|
||||
self.dmg = 160;
|
||||
|
@ -109,80 +129,102 @@ void() misc_explobox2 = {
|
|||
self.maxs = '32 32 32';
|
||||
}
|
||||
|
||||
misc_explobox();
|
||||
misc_explobox ();
|
||||
};
|
||||
|
||||
// ====================================================================
|
||||
|
||||
/*QUAKED ambient_suck_wind (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
|
||||
*/
|
||||
void() ambient_suck_wind = {
|
||||
void ()
|
||||
ambient_suck_wind =
|
||||
{
|
||||
self.noise = "ambience/suck1.wav";
|
||||
self.volume = 1.0;
|
||||
info_notnull();
|
||||
info_notnull ();
|
||||
};
|
||||
|
||||
/*QUAKED ambient_drone (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
|
||||
*/
|
||||
void() ambient_drone = {
|
||||
void ()
|
||||
ambient_drone =
|
||||
{
|
||||
self.noise = "ambience/drone6.wav";
|
||||
info_notnull();
|
||||
info_notnull ();
|
||||
};
|
||||
|
||||
/*QUAKED ambient_flouro_buzz (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
|
||||
*/
|
||||
void() ambient_flouro_buzz = {
|
||||
void ()
|
||||
ambient_flouro_buzz =
|
||||
{
|
||||
self.noise = "ambience/buzz1.wav";
|
||||
self.volume = 1.0;
|
||||
info_notnull();
|
||||
info_notnull ();
|
||||
};
|
||||
|
||||
/*QUAKED ambient_drip (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
|
||||
*/
|
||||
void() ambient_drip = {
|
||||
void ()
|
||||
ambient_drip =
|
||||
{
|
||||
self.noise = "ambience/drip1.wav";
|
||||
info_notnull();
|
||||
info_notnull ();
|
||||
};
|
||||
|
||||
/*QUAKED ambient_comp_hum (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
|
||||
*/
|
||||
void() ambient_comp_hum = {
|
||||
void ()
|
||||
ambient_comp_hum =
|
||||
{
|
||||
self.noise = "ambience/comp1.wav";
|
||||
self.volume = 1.0;
|
||||
info_notnull();
|
||||
info_notnull ();
|
||||
};
|
||||
|
||||
/*QUAKED ambient_thunder (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
|
||||
*/
|
||||
void() ambient_thunder = {
|
||||
void ()
|
||||
ambient_thunder =
|
||||
{
|
||||
self.noise = "ambience/thunder1.wav";
|
||||
info_notnull();
|
||||
info_notnull ();
|
||||
};
|
||||
|
||||
/*QUAKED ambient_light_buzz (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
|
||||
*/
|
||||
void() ambient_light_buzz = {
|
||||
void ()
|
||||
ambient_light_buzz =
|
||||
{
|
||||
self.noise = "ambience/fl_hum1.wav";
|
||||
info_notnull();
|
||||
info_notnull ();
|
||||
};
|
||||
|
||||
/*QUAKED ambient_swamp1 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
|
||||
*/
|
||||
void() ambient_swamp1 = {
|
||||
void ()
|
||||
ambient_swamp1 =
|
||||
{
|
||||
self.noise = "ambience/swamp1.wav";
|
||||
info_notnull();
|
||||
info_notnull ();
|
||||
};
|
||||
|
||||
/*QUAKED ambient_swamp2 (0.3 0.1 0.6) (-10 -10 -8) (10 10 8)
|
||||
*/
|
||||
void() ambient_swamp2 = {
|
||||
void ()
|
||||
ambient_swamp2 =
|
||||
{
|
||||
self.noise = "ambience/swamp2.wav";
|
||||
info_notnull();
|
||||
info_notnull ();
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
void() path_corner = { info_notnull(); };
|
||||
void ()
|
||||
path_corner =
|
||||
{
|
||||
info_notnull ();
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
|
@ -200,54 +242,71 @@ sounds
|
|||
4)
|
||||
set "message" to text string
|
||||
*/
|
||||
void() trigger_multiple = {
|
||||
if (self.sounds == 1) self.noise1 = "misc/secret.wav";
|
||||
else if (self.sounds == 2) self.noise1 = "misc/talk.wav";
|
||||
else if (self.sounds == 3) self.noise1 = "misc/trigger1.wav";
|
||||
void ()
|
||||
trigger_multiple =
|
||||
{
|
||||
switch (self.sounds) {
|
||||
case 1:
|
||||
self.noise1 = "misc/secret.wav";
|
||||
break;
|
||||
case 2:
|
||||
self.noise1 = "misc/talk.wav";
|
||||
break;
|
||||
case 3:
|
||||
self.noise1 = "misc/trigger1.wav";
|
||||
break;
|
||||
}
|
||||
|
||||
trigger_generic();
|
||||
trigger_generic ();
|
||||
|
||||
if (!self.wait) self.wait = 0.2;
|
||||
if (!self.wait)
|
||||
self.wait = 0.2;
|
||||
|
||||
self.count = 0;
|
||||
};
|
||||
|
||||
/*QUAKED trigger_once (.5 .5 .5) ? notouch
|
||||
*/
|
||||
void() trigger_once = {
|
||||
trigger_multiple();
|
||||
void ()
|
||||
trigger_once =
|
||||
{
|
||||
trigger_multiple ();
|
||||
self.count = 1;
|
||||
};
|
||||
|
||||
/*QUAKED trigger_relay (.5 .5 .5) (-8 -8 -8) (8 8 8)
|
||||
*/
|
||||
void() trigger_relay = {
|
||||
void ()
|
||||
trigger_relay =
|
||||
{
|
||||
self.spawnflags |= SPAWNFLAGS_TRIGGER_NOTOUCH;
|
||||
trigger_multiple();
|
||||
trigger_multiple ();
|
||||
};
|
||||
|
||||
#define SPAWNFLAGS_NOMESSAGE 1
|
||||
void() _trigger_counter_use = {
|
||||
void ()
|
||||
_trigger_counter_use =
|
||||
{
|
||||
local float doprint;
|
||||
|
||||
doprint = !(self.spawnflags & SPAWNFLAGS_NOMESSAGE) && is_cl(other);
|
||||
doprint = !(self.spawnflags & SPAWNFLAGS_NOMESSAGE) && is_cl (other);
|
||||
|
||||
self.count--;
|
||||
if (self.count <= 0) {
|
||||
if (doprint) centerprint(other, "Sequence completed!");
|
||||
if (doprint) centerprint (other, "Sequence completed!");
|
||||
|
||||
self.count = self.max_health;
|
||||
util_use_targets();
|
||||
util_use_targets ();
|
||||
} else {
|
||||
if (doprint) {
|
||||
if (self.count > 3)
|
||||
centerprint(other, "There are more to go...");
|
||||
centerprint (other, "There are more to go...");
|
||||
else if (self.count > 2)
|
||||
centerprint(other, "Only 3 more to go...");
|
||||
centerprint (other, "Only 3 more to go...");
|
||||
else if (self.count > 1)
|
||||
centerprint(other, "Only 2 more to go...");
|
||||
centerprint (other, "Only 2 more to go...");
|
||||
else
|
||||
centerprint(other, "Only 1 more to go...");
|
||||
centerprint (other, "Only 1 more to go...");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -255,8 +314,10 @@ void() _trigger_counter_use = {
|
|||
/*QUAKED trigger_counter (.5 .5 .5) ? SPAWNFLAGS_NOMESSAGE
|
||||
Wait decrease count by 1 until it reaches 0, then activate targets.
|
||||
*/
|
||||
void() trigger_counter = {
|
||||
util_map_entity_init();
|
||||
void ()
|
||||
trigger_counter =
|
||||
{
|
||||
util_map_entity_init ();
|
||||
|
||||
self.model = NIL;
|
||||
self.modelindex = 0;
|
||||
|
@ -272,12 +333,17 @@ void() trigger_counter = {
|
|||
|
||||
/*QUAKED trigger_secret (.5 .5 .5) ?
|
||||
*/
|
||||
void() trigger_secret = {
|
||||
if (!self.message) self.message = "You found a secret area!";
|
||||
if (!self.sounds) self.sounds = 1;
|
||||
if (self.sounds > 2) self.sounds = 0;
|
||||
void ()
|
||||
trigger_secret =
|
||||
{
|
||||
if (!self.message)
|
||||
self.message = "You found a secret area!";
|
||||
if (!self.sounds)
|
||||
self.sounds = 1;
|
||||
if (self.sounds > 2)
|
||||
self.sounds = 0;
|
||||
|
||||
trigger_multiple();
|
||||
trigger_multiple ();
|
||||
|
||||
self.count = 1;
|
||||
};
|
||||
|
@ -286,15 +352,21 @@ void() trigger_secret = {
|
|||
sets skill level to the value of "message".
|
||||
Only used on start map.
|
||||
*/
|
||||
void() trigger_setskill = { remove(self); };
|
||||
void ()
|
||||
trigger_setskill =
|
||||
{
|
||||
remove (self);
|
||||
};
|
||||
|
||||
/*QUAKED trigger_onlyregistered (.5 .5 .5) ?
|
||||
Only fires if playing the registered version, otherwise prints the message
|
||||
*/
|
||||
void() trigger_onlyregistered = {
|
||||
void ()
|
||||
trigger_onlyregistered =
|
||||
{
|
||||
self.message = "";
|
||||
self.wait = -1;
|
||||
trigger_generic();
|
||||
trigger_generic ();
|
||||
};
|
||||
|
||||
/*QUAKED trigger_monsterjump (.5 .5 .5) ?
|
||||
|
@ -302,55 +374,66 @@ Walking monsters that touch this will jump in the direction of the trigger's ang
|
|||
"speed" default to 200, the speed thrown forward
|
||||
"height" default to 200, the speed thrown upwards
|
||||
*/
|
||||
void() trigger_monsterjump = { remove(self); };
|
||||
void ()
|
||||
trigger_monsterjump =
|
||||
{
|
||||
remove (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 = {
|
||||
void ()
|
||||
func_episodegate =
|
||||
{
|
||||
if (!(serverflags & self.spawnflags)) {
|
||||
remove(self);
|
||||
remove (self);
|
||||
return;
|
||||
}
|
||||
|
||||
func_wall();
|
||||
func_wall ();
|
||||
};
|
||||
|
||||
/*QUAKED func_bossgate (0 .5 .8) ?
|
||||
This bmodel appears unless players have all of the episode sigils.
|
||||
*/
|
||||
void() func_bossgate = {
|
||||
void ()
|
||||
func_bossgate =
|
||||
{
|
||||
if ((serverflags & 15) == 15) {
|
||||
remove(self);
|
||||
remove (self);
|
||||
return;
|
||||
}
|
||||
|
||||
func_wall();
|
||||
func_wall ();
|
||||
};
|
||||
|
||||
|
||||
/* Monsters */
|
||||
void() monster_boss = { remove(self); };
|
||||
void() monster_demon1 = { remove(self); };
|
||||
void() monster_dog = { remove(self); };
|
||||
void() monster_enforcer = { remove(self); };
|
||||
void() monster_fish = { remove(self); };
|
||||
void() monster_hell_knight = { remove(self); };
|
||||
void() monster_knight = { remove(self); };
|
||||
void() monster_ogre = { remove(self); };
|
||||
void() monster_ogre_marksman = { remove(self); };
|
||||
void() monster_oldone = { remove(self); };
|
||||
void() monster_shalrath = { remove(self); };
|
||||
void() monster_shambler = { remove(self); };
|
||||
void() monster_army = { remove(self); };
|
||||
void() monster_tarbaby = { remove(self); };
|
||||
void() monster_wizard = { remove(self); };
|
||||
void() monster_zombie = { remove(self); };
|
||||
void () monster_boss = { remove(self); };
|
||||
void () monster_demon1 = { remove(self); };
|
||||
void () monster_dog = { remove(self); };
|
||||
void () monster_enforcer = { remove(self); };
|
||||
void () monster_fish = { remove(self); };
|
||||
void () monster_hell_knight = { remove(self); };
|
||||
void () monster_knight = { remove(self); };
|
||||
void () monster_ogre = { remove(self); };
|
||||
void () monster_ogre_marksman = { remove(self); };
|
||||
void () monster_oldone = { remove(self); };
|
||||
void () monster_shalrath = { remove(self); };
|
||||
void () monster_shambler = { remove(self); };
|
||||
void () monster_army = { remove(self); };
|
||||
void () monster_tarbaby = { remove(self); };
|
||||
void () monster_wizard = { remove(self); };
|
||||
void () monster_zombie = { remove(self); };
|
||||
|
||||
// =========================================================================
|
||||
|
||||
void() item_weapon = {
|
||||
if (!self.noise2) self.noise2 = "weapons/pkup.wav";
|
||||
void ()
|
||||
item_weapon =
|
||||
{
|
||||
if (!self.noise2)
|
||||
self.noise2 = "weapons/pkup.wav";
|
||||
if (!self.mins && !self.maxs) {
|
||||
self.mins = '-16 -16 0';
|
||||
self.maxs = '16 16 56';
|
||||
|
@ -359,67 +442,91 @@ void() item_weapon = {
|
|||
self.wait = 25;
|
||||
self.delay = 10;
|
||||
}
|
||||
item_generic();
|
||||
item_generic ();
|
||||
};
|
||||
|
||||
/*QUAKED weapon_supershotgun (0 .5 .8) (-16 -16 0) (16 16 32)
|
||||
*/
|
||||
void() weapon_supershotgun = {
|
||||
void ()
|
||||
weapon_supershotgun =
|
||||
{
|
||||
self.netname = STR_EQUIPID_SUPER_SHOTGUN;
|
||||
if (!self.model) self.model = "progs/g_shot.mdl";
|
||||
if (!self.ammo_shells) self.ammo_shells = 5;
|
||||
equip_grant(self, EQUIPID_SUPER_SHOTGUN);
|
||||
item_weapon();
|
||||
if (!self.model)
|
||||
self.model = "progs/g_shot.mdl";
|
||||
if (!self.ammo_shells)
|
||||
self.ammo_shells = 5;
|
||||
equip_grant (self, EQUIPID_SUPER_SHOTGUN);
|
||||
item_weapon ();
|
||||
};
|
||||
|
||||
/*QUAKED weapon_nailgun (0 .5 .8) (-16 -16 0) (16 16 32)
|
||||
*/
|
||||
void() weapon_nailgun = {
|
||||
void ()
|
||||
weapon_nailgun =
|
||||
{
|
||||
self.netname = STR_EQUIPID_NAILGUN;
|
||||
if (!self.model) self.model = "progs/g_nail.mdl";
|
||||
if (!self.ammo_nails) self.ammo_nails = 30;
|
||||
equip_grant(self, EQUIPID_NAILGUN);
|
||||
item_weapon();
|
||||
if (!self.model)
|
||||
self.model = "progs/g_nail.mdl";
|
||||
if (!self.ammo_nails)
|
||||
self.ammo_nails = 30;
|
||||
equip_grant (self, EQUIPID_NAILGUN);
|
||||
item_weapon ();
|
||||
};
|
||||
|
||||
/*QUAKED weapon_supernailgun (0 .5 .8) (-16 -16 0) (16 16 32)
|
||||
*/
|
||||
void() weapon_supernailgun = {
|
||||
void ()
|
||||
weapon_supernailgun =
|
||||
{
|
||||
self.netname = STR_EQUIPID_SUPER_NAILGUN;
|
||||
if (!self.model) self.model = "progs/g_nail2.mdl";
|
||||
if (!self.ammo_nails) self.ammo_nails = 30;
|
||||
equip_grant(self, EQUIPID_SUPER_NAILGUN);
|
||||
item_weapon();
|
||||
if (!self.model)
|
||||
self.model = "progs/g_nail2.mdl";
|
||||
if (!self.ammo_nails)
|
||||
self.ammo_nails = 30;
|
||||
equip_grant (self, EQUIPID_SUPER_NAILGUN);
|
||||
item_weapon ();
|
||||
};
|
||||
|
||||
/*QUAKED weapon_grenadelauncher (0 .5 .8) (-16 -16 0) (16 16 32)
|
||||
*/
|
||||
void() weapon_grenadelauncher = {
|
||||
void ()
|
||||
weapon_grenadelauncher =
|
||||
{
|
||||
self.netname = STR_EQUIPID_GRENADE_LAUNCHER;
|
||||
if (!self.model) self.model = "progs/g_rock.mdl";
|
||||
if (!self.ammo_rockets) self.ammo_rockets = 5;
|
||||
equip_grant(self, EQUIPID_GRENADE_LAUNCHER);
|
||||
item_weapon();
|
||||
if (!self.model)
|
||||
self.model = "progs/g_rock.mdl";
|
||||
if (!self.ammo_rockets)
|
||||
self.ammo_rockets = 5;
|
||||
equip_grant (self, EQUIPID_GRENADE_LAUNCHER);
|
||||
item_weapon ();
|
||||
};
|
||||
|
||||
/*QUAKED weapon_rocketlauncher (0 .5 .8) (-16 -16 0) (16 16 32)
|
||||
*/
|
||||
void() weapon_rocketlauncher = {
|
||||
void ()
|
||||
weapon_rocketlauncher =
|
||||
{
|
||||
self.netname = STR_EQUIPID_ROCKET_LAUNCHER;
|
||||
if (!self.model) self.model = "progs/g_rock2.mdl";
|
||||
if (!self.ammo_rockets) self.ammo_rockets = 5;
|
||||
equip_grant(self, EQUIPID_ROCKET_LAUNCHER);
|
||||
item_weapon();
|
||||
if (!self.model)
|
||||
self.model = "progs/g_rock2.mdl";
|
||||
if (!self.ammo_rockets)
|
||||
self.ammo_rockets = 5;
|
||||
equip_grant (self, EQUIPID_ROCKET_LAUNCHER);
|
||||
item_weapon ();
|
||||
};
|
||||
|
||||
/*QUAKED weapon_lightning (0 .5 .8) (-16 -16 0) (16 16 32)
|
||||
*/
|
||||
void() weapon_lightning = {
|
||||
void ()
|
||||
weapon_lightning =
|
||||
{
|
||||
self.netname = STR_EQUIPID_LIGHTNING_GUN;
|
||||
if (!self.model) self.model = "progs/g_light.mdl";
|
||||
if (!self.ammo_cells) self.ammo_cells = 15;
|
||||
equip_grant(self, EQUIPID_LIGHTNING_GUN);
|
||||
item_weapon();
|
||||
if (!self.model)
|
||||
self.model = "progs/g_light.mdl";
|
||||
if (!self.ammo_cells)
|
||||
self.ammo_cells = 15;
|
||||
equip_grant (self, EQUIPID_LIGHTNING_GUN);
|
||||
item_weapon ();
|
||||
};
|
||||
|
||||
// ========================================================================
|
||||
|
@ -428,7 +535,9 @@ void() weapon_lightning = {
|
|||
|
||||
/*QUAKED item_shells (0 .5 .8) (0 0 0) (32 32 32) BIG
|
||||
*/
|
||||
void() item_shells = {
|
||||
void ()
|
||||
item_shells =
|
||||
{
|
||||
if (self.spawnflags & SPAWNFLAGS_AMMO_BIG) {
|
||||
self.model = "maps/b_shell1.bsp";
|
||||
self.ammo_shells = 40;
|
||||
|
@ -436,12 +545,14 @@ void() item_shells = {
|
|||
self.model = "maps/b_shell0.bsp";
|
||||
self.ammo_shells = 20;
|
||||
}
|
||||
item_ammo();
|
||||
item_ammo ();
|
||||
};
|
||||
|
||||
/*QUAKED item_spikes (0 .5 .8) (0 0 0) (32 32 32) BIG
|
||||
*/
|
||||
void() item_spikes = {
|
||||
void ()
|
||||
item_spikes =
|
||||
{
|
||||
if (self.spawnflags & SPAWNFLAGS_AMMO_BIG) {
|
||||
self.model = "maps/b_nail1.bsp";
|
||||
self.ammo_nails = 50;
|
||||
|
@ -449,12 +560,14 @@ void() item_spikes = {
|
|||
self.model = "maps/b_nail0.bsp";
|
||||
self.ammo_nails = 25;
|
||||
}
|
||||
item_ammo();
|
||||
item_ammo ();
|
||||
};
|
||||
|
||||
/*QUAKED item_rockets (0 .5 .8) (0 0 0) (32 32 32) BIG
|
||||
*/
|
||||
void() item_rockets = {
|
||||
void ()
|
||||
item_rockets =
|
||||
{
|
||||
if (self.spawnflags & SPAWNFLAGS_AMMO_BIG) {
|
||||
self.model = "maps/b_rock1.bsp";
|
||||
self.ammo_rockets = 10;
|
||||
|
@ -462,12 +575,14 @@ void() item_rockets = {
|
|||
self.model = "maps/b_rock0.bsp";
|
||||
self.ammo_rockets = 5;
|
||||
}
|
||||
item_ammo();
|
||||
item_ammo ();
|
||||
};
|
||||
|
||||
/*QUAKED item_cells (0 .5 .8) (0 0 0) (32 32 32) BIG
|
||||
*/
|
||||
void() item_cells = {
|
||||
void ()
|
||||
item_cells =
|
||||
{
|
||||
if (self.spawnflags & SPAWNFLAGS_AMMO_BIG) {
|
||||
self.model = "maps/b_batt1.bsp";
|
||||
self.ammo_cells = 12;
|
||||
|
@ -475,7 +590,7 @@ void() item_cells = {
|
|||
self.model = "maps/b_batt0.bsp";
|
||||
self.ammo_cells = 6;
|
||||
}
|
||||
item_ammo();
|
||||
item_ammo ();
|
||||
};
|
||||
|
||||
|
||||
|
@ -483,40 +598,48 @@ void() item_cells = {
|
|||
|
||||
/*QUAKED item_armor1 (0 .5 .8) (-16 -16 0) (16 16 32)
|
||||
*/
|
||||
void() item_armor1 = {
|
||||
void ()
|
||||
item_armor1 =
|
||||
{
|
||||
self.skin = 0;
|
||||
self.armorvalue = 100;
|
||||
self.armortype = 0.3;
|
||||
item_armor();
|
||||
item_armor ();
|
||||
};
|
||||
|
||||
/*QUAKED item_armor2 (0 .5 .8) (-16 -16 0) (16 16 32)
|
||||
*/
|
||||
void() item_armor2 = {
|
||||
void ()
|
||||
item_armor2 =
|
||||
{
|
||||
self.skin = 1;
|
||||
self.armorvalue = 150;
|
||||
self.armortype = 0.6;
|
||||
item_armor();
|
||||
item_armor ();
|
||||
};
|
||||
|
||||
/*QUAKED item_armorInv (0 .5 .8) (-16 -16 0) (16 16 32)
|
||||
*/
|
||||
void() item_armorInv = {
|
||||
void ()
|
||||
item_armorInv =
|
||||
{
|
||||
self.skin = 2;
|
||||
self.armorvalue = 200;
|
||||
self.armortype = 0.8;
|
||||
item_armor();
|
||||
item_armor ();
|
||||
};
|
||||
|
||||
// ========================================================================
|
||||
|
||||
/*QUAKED misc_teleporttrain (0 .5 .8) (-8 -8 -8) (8 8 8)
|
||||
*/
|
||||
void() misc_teleporttrain = {
|
||||
void ()
|
||||
misc_teleporttrain =
|
||||
{
|
||||
self.model = "progs/teleport.mdl";
|
||||
self.dmg = -1;
|
||||
|
||||
self.avelocity = '100 200 300';
|
||||
|
||||
func_train();
|
||||
func_train ();
|
||||
};
|
||||
|
|
|
@ -395,7 +395,7 @@ void (string str)
|
|||
xprint_str =
|
||||
{
|
||||
msg_entity = _xprint_client;
|
||||
WriteBytes (MSG_ONE, (float) SVC_PRINT, _xprint_level);
|
||||
WriteBytes (MSG_ONE, SVC_PRINT, _xprint_level);
|
||||
WriteString (MSG_ONE, str);
|
||||
};
|
||||
|
||||
|
|
|
@ -1,99 +1,99 @@
|
|||
/* Builtin functions */
|
||||
|
||||
entity () BUILTIN_spawn = #14;
|
||||
void (entity e) remove = #15;
|
||||
entity() BUILTIN_spawn = #14;
|
||||
void(entity e) remove = #15;
|
||||
|
||||
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;
|
||||
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;
|
||||
|
||||
string (string s) precache_sound = #19;
|
||||
string (string s) precache_model = #20;
|
||||
string (string s) precache_file = #68; // no effect except for -copy
|
||||
string (string s) precache_sound2 = #76; // registered version only
|
||||
string (string s) precache_model2 = #75; // registered version only
|
||||
string (string s) precache_file2 = #77; // registered version only
|
||||
string(string s) precache_sound = #19;
|
||||
string(string s) precache_model = #20;
|
||||
string(string s) precache_file = #68; // no effect except for -copy
|
||||
string(string s) precache_sound2 = #76; // registered version only
|
||||
string(string s) precache_model2 = #75; // registered version only
|
||||
string(string s) precache_file2 = #77; // registered version only
|
||||
void (float style, string value) lightstyle = #35;
|
||||
|
||||
// debug functions
|
||||
void () BUILTIN_break = #6; // shatter progs
|
||||
void (string e, ...) error = #10;
|
||||
void (string e, ...) objerror = #11;
|
||||
void () coredump = #28; // prints all edicts
|
||||
void () traceon = #29; // turns statment trace on
|
||||
void () traceoff = #30;
|
||||
void() BUILTIN_break = #6; // shatter progs
|
||||
void(string e, ...) error = #10;
|
||||
void(string e, ...) objerror = #11;
|
||||
void() coredump = #28; // prints all edicts
|
||||
void() traceon = #29; // turns statment trace on
|
||||
void() traceoff = #30;
|
||||
|
||||
void (entity e, float chan, string samp, float vol, float atten) sound = #8;
|
||||
void(entity e, float chan, string samp, float vol, float atten) sound = #8;
|
||||
|
||||
void (vector ang) makevectors = #1; // sets v_forward, etc globals
|
||||
vector (vector v) normalize = #9;
|
||||
float (vector v) vlen = #12;
|
||||
float (vector v) vectoyaw = #13;
|
||||
vector (vector v) vectoangles = #51;
|
||||
vector (entity e, float speed) aim = #44; // returns the shooting vector
|
||||
void(vector ang) makevectors = #1; // sets v_forward, etc globals
|
||||
vector(vector v) normalize = #9;
|
||||
float(vector v) vlen = #12;
|
||||
float(vector v) vectoyaw = #13;
|
||||
vector(vector v) vectoangles = #51;
|
||||
vector(entity e, float speed) aim = #44; // returns the shooting vector
|
||||
|
||||
float () random = #7; // returns 0 - 1
|
||||
string (float f) ftos = #26;
|
||||
float (string s) stof = #81; // convert string to float
|
||||
string (vector v) vtos = #27;
|
||||
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
|
||||
float (float f) fabs = #43;
|
||||
float() random = #7; // returns 0 - 1
|
||||
string(float f) ftos = #26;
|
||||
float(string s) stof = #81; // convert string to float
|
||||
string(vector v) vtos = #27;
|
||||
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
|
||||
float(float f) fabs = #43;
|
||||
|
||||
// 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;
|
||||
float (vector v) pointcontents = #41; // returns a CONTENT_*
|
||||
float (entity e) checkbottom = #40; // true if self is on ground
|
||||
float () droptofloor = #34; // TRUE if landed on floor
|
||||
float (float yaw, float dist) walkmove = #32; // returns TRUE or FALSE
|
||||
void (float step) movetogoal = #67;
|
||||
void(vector v1, vector v2, float nomonsters, entity forent) traceline = #16;
|
||||
float(vector v) pointcontents = #41; // returns a CONTENT_*
|
||||
float(entity e) checkbottom = #40; // true if self is on ground
|
||||
float() droptofloor = #34; // TRUE if landed on floor
|
||||
float(float yaw, float dist) walkmove = #32; // returns TRUE or FALSE
|
||||
void(float step) movetogoal = #67;
|
||||
|
||||
entity () checkclient = #17; // returns a client to look for
|
||||
entity (entity start, .string fld, string match) find = #18;
|
||||
entity (vector org, float rad) findradius = #22;
|
||||
entity (entity e) nextent = #47; // for looping through all ents
|
||||
entity() checkclient = #17; // returns a client to look for
|
||||
entity(entity start, .string fld, string match) find = #18;
|
||||
entity(vector org, float rad) findradius = #22;
|
||||
entity(entity e) nextent = #47; // for looping through all ents
|
||||
|
||||
void (float level, string s, ...) bprint = #23;
|
||||
void (entity client, float level, string s, ...) sprint = #24;
|
||||
void (entity client, string s, ...) centerprint = #73; // sprint, but centered
|
||||
void (string s, ...) dprint = #25;
|
||||
void (entity e) eprint = #31; // prints an entire edict
|
||||
void(float level, string s, ...) bprint = #23;
|
||||
void(entity client, float level, string s, ...) sprint = #24;
|
||||
void(entity client, string s, ...) centerprint = #73; // sprint, but centered
|
||||
void(string s, ...) dprint = #25;
|
||||
void(entity e) eprint = #31; // prints an entire edict
|
||||
|
||||
float (string s) cvar = #45; // return cvar.value
|
||||
void (string var, string val) cvar_set = #72; // sets cvar.value
|
||||
string (entity e, string key) infokey = #80; // get a key value (world = serverinfo)
|
||||
void (string s1, ...) localcmd = #46; // put string into local que
|
||||
void (entity client, string s) stuffcmd = #21;
|
||||
float(string s) cvar = #45; // return cvar.value
|
||||
void(string var, string val) cvar_set = #72; // sets cvar.value
|
||||
string(entity e, string key) infokey = #80; // get a key value (world = serverinfo)
|
||||
void(string s1, ...) localcmd = #46; // put string into local que
|
||||
void(entity client, string s) stuffcmd = #21;
|
||||
|
||||
void () ChangeYaw = #49; // turn towards self.ideal_yaw
|
||||
void() ChangeYaw = #49; // turn towards self.ideal_yaw
|
||||
// at self.yaw_speed
|
||||
// direct client message generation
|
||||
void (float to, vector v) WriteAngleV = #0;
|
||||
void (float to, vector v) WriteCoordV = #0;
|
||||
void (float to, ...) WriteBytes = #0;
|
||||
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;
|
||||
void (vector where, float set) multicast = #82; // sends the temp message to a set
|
||||
void(float to, vector v) WriteAngleV = #0;
|
||||
void(float to, vector v) WriteCoordV = #0;
|
||||
void(float to, ...) WriteBytes = #0;
|
||||
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;
|
||||
void(vector where, float set) multicast = #82; // sends the temp message to a set
|
||||
|
||||
void (entity e) BUILTIN_makestatic = #69;
|
||||
void (string s) changelevel = #70;
|
||||
void(entity e) BUILTIN_makestatic = #69;
|
||||
void(string s) changelevel = #70;
|
||||
|
||||
|
||||
void (vector pos, string samp, float vol, float atten) BUILTIN_ambientsound = #74;
|
||||
void(vector pos, string samp, float vol, float atten) BUILTIN_ambientsound = #74;
|
||||
|
||||
void (entity e) setspawnparms = #78; // set parm1... to the
|
||||
void(entity e) setspawnparms = #78; // set parm1... to the
|
||||
// values at level start
|
||||
// for coop respawn
|
||||
|
||||
void (entity killer, entity killee) logfrag = #79; // add to stats
|
||||
void(entity killer, entity killee) logfrag = #79; // add to stats
|
||||
|
|
|
@ -5,92 +5,93 @@
|
|||
|
||||
#include "misc.qh"
|
||||
|
||||
void() effect_muzzleflash = {
|
||||
WriteByte(MSG_MULTICAST, SVC_MUZZLEFLASH);
|
||||
WriteEntity(MSG_MULTICAST, self);
|
||||
multicast(self.origin, MULTICAST_PVS);
|
||||
void ()
|
||||
effect_muzzleflash =
|
||||
{
|
||||
WriteByte (MSG_MULTICAST, SVC_MUZZLEFLASH);
|
||||
WriteEntity (MSG_MULTICAST, self);
|
||||
multicast (self.origin, MULTICAST_PVS);
|
||||
};
|
||||
|
||||
void(entity e) effect_smallkick = {
|
||||
void (entity e)
|
||||
effect_smallkick =
|
||||
{
|
||||
if (!is_cl(e))
|
||||
return;
|
||||
|
||||
msg_entity = e;
|
||||
WriteByte(MSG_ONE, SVC_SMALLKICK);
|
||||
WriteByte (MSG_ONE, SVC_SMALLKICK);
|
||||
};
|
||||
|
||||
void(vector org, vector dir, float d) effect_blood = {
|
||||
void (vector org, vector dir, float d)
|
||||
effect_blood =
|
||||
{
|
||||
d = d / 5;
|
||||
if (d < 3) d = 3;
|
||||
if (d > 255) d = 255;
|
||||
if (d < 3)
|
||||
d = 3;
|
||||
if (d > 255)
|
||||
d = 255;
|
||||
|
||||
WriteByte(MSG_MULTICAST, SVC_TEMPENTITY);
|
||||
WriteByte(MSG_MULTICAST, TE_BLOOD);
|
||||
WriteByte(MSG_MULTICAST, d);
|
||||
WriteCoord(MSG_MULTICAST, org_x);
|
||||
WriteCoord(MSG_MULTICAST, org_y);
|
||||
WriteCoord(MSG_MULTICAST, org_z);
|
||||
multicast(org, MULTICAST_PVS);
|
||||
WriteBytes (MSG_MULTICAST, SVC_TEMPENTITY, TE_BLOOD, d);
|
||||
WriteCoordV (MSG_MULTICAST, org);
|
||||
multicast (org, MULTICAST_PVS);
|
||||
};
|
||||
|
||||
void(vector org, vector vel, float d) effect_gun_spark = {
|
||||
WriteByte(MSG_MULTICAST, SVC_TEMPENTITY);
|
||||
WriteByte(MSG_MULTICAST, TE_GUNSHOT);
|
||||
WriteByte(MSG_MULTICAST, d);
|
||||
WriteCoord(MSG_MULTICAST, org_x);
|
||||
WriteCoord(MSG_MULTICAST, org_y);
|
||||
WriteCoord(MSG_MULTICAST, org_z);
|
||||
multicast(org, MULTICAST_PVS);
|
||||
void (vector org, vector vel, float d)
|
||||
effect_gun_spark =
|
||||
{
|
||||
WriteBytes (MSG_MULTICAST, SVC_TEMPENTITY, TE_GUNSHOT, d);
|
||||
WriteCoordV (MSG_MULTICAST, org);
|
||||
multicast (org, MULTICAST_PVS);
|
||||
};
|
||||
|
||||
void(vector org, vector vel) effect_nail_spark = {
|
||||
WriteByte(MSG_MULTICAST, SVC_TEMPENTITY);
|
||||
WriteByte(MSG_MULTICAST, TE_SPIKE);
|
||||
WriteCoord(MSG_MULTICAST, org_x);
|
||||
WriteCoord(MSG_MULTICAST, org_y);
|
||||
WriteCoord(MSG_MULTICAST, org_z);
|
||||
multicast(org, MULTICAST_PHS);
|
||||
void (vector org, vector vel)
|
||||
effect_nail_spark =
|
||||
{
|
||||
WriteBytes (MSG_MULTICAST, SVC_TEMPENTITY, TE_SPIKE);
|
||||
WriteCoordV (MSG_MULTICAST, org);
|
||||
multicast (org, MULTICAST_PHS);
|
||||
};
|
||||
|
||||
void(vector org) effect_explosion = {
|
||||
WriteByte(MSG_MULTICAST, SVC_TEMPENTITY);
|
||||
WriteByte(MSG_MULTICAST, TE_EXPLOSION);
|
||||
WriteCoord(MSG_MULTICAST, org_x);
|
||||
WriteCoord(MSG_MULTICAST, org_y);
|
||||
WriteCoord(MSG_MULTICAST, org_z);
|
||||
multicast(org, MULTICAST_PHS);
|
||||
void (vector org)
|
||||
effect_explosion =
|
||||
{
|
||||
WriteBytes (MSG_MULTICAST, SVC_TEMPENTITY, TE_EXPLOSION);
|
||||
WriteCoordV (MSG_MULTICAST, org);
|
||||
multicast (org, MULTICAST_PHS);
|
||||
};
|
||||
|
||||
void(vector org) effect_teleport_fog = {
|
||||
void (vector org)
|
||||
effect_teleport_fog =
|
||||
{
|
||||
local float r;
|
||||
local string snd;
|
||||
|
||||
r = random() * 5;
|
||||
if (r < 1) snd = "misc/r_tele1.wav";
|
||||
else if (r < 2) snd = "misc/r_tele2.wav";
|
||||
else if (r < 3) snd = "misc/r_tele3.wav";
|
||||
else if (r < 4) snd = "misc/r_tele4.wav";
|
||||
else snd = "misc/r_tele5.wav";
|
||||
r = random () * 5;
|
||||
if (r < 1)
|
||||
snd = "misc/r_tele1.wav";
|
||||
else if (r < 2)
|
||||
snd = "misc/r_tele2.wav";
|
||||
else if (r < 3)
|
||||
snd = "misc/r_tele3.wav";
|
||||
else if (r < 4)
|
||||
snd = "misc/r_tele4.wav";
|
||||
else
|
||||
snd = "misc/r_tele5.wav";
|
||||
|
||||
WriteByte(MSG_MULTICAST, SVC_TEMPENTITY);
|
||||
WriteByte(MSG_MULTICAST, TE_TELEPORT);
|
||||
WriteCoord(MSG_MULTICAST, org_x);
|
||||
WriteCoord(MSG_MULTICAST, org_y);
|
||||
WriteCoord(MSG_MULTICAST, org_z);
|
||||
multicast(org, MULTICAST_PHS);
|
||||
WriteBytes (MSG_MULTICAST, SVC_TEMPENTITY, TE_TELEPORT);
|
||||
WriteCoordV (MSG_MULTICAST, org);
|
||||
multicast (org, MULTICAST_PHS);
|
||||
|
||||
sound_vector(org, snd, 1, ATTN_NORM);
|
||||
sound_vector (org, snd, 1, ATTN_NORM);
|
||||
};
|
||||
|
||||
void(entity from, vector p1, vector p2) effect_lightning2 = {
|
||||
WriteByte(MSG_MULTICAST, SVC_TEMPENTITY);
|
||||
WriteByte(MSG_MULTICAST, TE_LIGHTNING2);
|
||||
WriteEntity(MSG_MULTICAST, from);
|
||||
WriteCoord(MSG_MULTICAST, p1_x);
|
||||
WriteCoord(MSG_MULTICAST, p1_y);
|
||||
WriteCoord(MSG_MULTICAST, p1_z);
|
||||
WriteCoord(MSG_MULTICAST, p2_x);
|
||||
WriteCoord(MSG_MULTICAST, p2_y);
|
||||
WriteCoord(MSG_MULTICAST, p2_z);
|
||||
multicast(p1, MULTICAST_PHS);
|
||||
void (entity from, vector p1, vector p2)
|
||||
effect_lightning2 =
|
||||
{
|
||||
WriteBytes (MSG_MULTICAST, SVC_TEMPENTITY, TE_LIGHTNING2);
|
||||
WriteEntity (MSG_MULTICAST, from);
|
||||
WriteCoordV (MSG_MULTICAST, p1);
|
||||
WriteCoordV (MSG_MULTICAST, p2);
|
||||
multicast (p1, MULTICAST_PHS);
|
||||
};
|
||||
|
|
|
@ -2,39 +2,39 @@
|
|||
#define QW_PROTOCOL_qh 1
|
||||
|
||||
// protocol bytes
|
||||
#define SVC_PRINT 8
|
||||
#define SVC_UPDATEFRAGS 14
|
||||
#define SVC_MAKESTATIC 20
|
||||
#define SVC_TEMPENTITY 23
|
||||
#define SVC_CENTERPRINT 26
|
||||
#define SVC_KILLEDMONSTER 27
|
||||
#define SVC_FOUNDSECRET 28
|
||||
#define SVC_INTERMISSION 30
|
||||
#define SVC_FINALE 31
|
||||
#define SVC_CDTRACK 32
|
||||
#define SVC_SELLSCREEN 33
|
||||
#define SVC_SMALLKICK 34
|
||||
#define SVC_BIGKICK 35
|
||||
#define SVC_UPDATEPING 36
|
||||
#define SVC_UPDATEENTERTIME 37
|
||||
#define SVC_MUZZLEFLASH 39
|
||||
#define SVC_UPDATEUSERINFO 40
|
||||
#define SVC_UPDATEPL 53
|
||||
#define SVC_PRINT 8.0
|
||||
#define SVC_UPDATEFRAGS 14.0
|
||||
#define SVC_MAKESTATIC 20.0
|
||||
#define SVC_TEMPENTITY 23.0
|
||||
#define SVC_CENTERPRINT 26.0
|
||||
#define SVC_KILLEDMONSTER 27.0
|
||||
#define SVC_FOUNDSECRET 28.0
|
||||
#define SVC_INTERMISSION 30.0
|
||||
#define SVC_FINALE 31.0
|
||||
#define SVC_CDTRACK 32.0
|
||||
#define SVC_SELLSCREEN 33.0
|
||||
#define SVC_SMALLKICK 34.0
|
||||
#define SVC_BIGKICK 35.0
|
||||
#define SVC_UPDATEPING 36.0
|
||||
#define SVC_UPDATEENTERTIME 37.0
|
||||
#define SVC_MUZZLEFLASH 39.0
|
||||
#define SVC_UPDATEUSERINFO 40.0
|
||||
#define SVC_UPDATEPL 53.0
|
||||
|
||||
// temp entities
|
||||
#define TE_SPIKE 0
|
||||
#define TE_SUPERSPIKE 1
|
||||
#define TE_GUNSHOT 2
|
||||
#define TE_EXPLOSION 3
|
||||
#define TE_TAREXPLOSION 4
|
||||
#define TE_LIGHTNING1 5
|
||||
#define TE_LIGHTNING2 6
|
||||
#define TE_WIZSPIKE 7
|
||||
#define TE_KNIGHTSPIKE 8
|
||||
#define TE_LIGHTNING3 9
|
||||
#define TE_LAVASPLASH 10
|
||||
#define TE_TELEPORT 11
|
||||
#define TE_BLOOD 12
|
||||
#define TE_LIGHTNINGBLOOD 13
|
||||
#define TE_SPIKE 0.0
|
||||
#define TE_SUPERSPIKE 1.0
|
||||
#define TE_GUNSHOT 2.0
|
||||
#define TE_EXPLOSION 3.0
|
||||
#define TE_TAREXPLOSION 4.0
|
||||
#define TE_LIGHTNING1 5.0
|
||||
#define TE_LIGHTNING2 6.0
|
||||
#define TE_WIZSPIKE 7.0
|
||||
#define TE_KNIGHTSPIKE 8.0
|
||||
#define TE_LIGHTNING3 9.0
|
||||
#define TE_LAVASPLASH 10.0
|
||||
#define TE_TELEPORT 11.0
|
||||
#define TE_BLOOD 12.0
|
||||
#define TE_LIGHTNINGBLOOD 13.0
|
||||
|
||||
#endif
|
||||
|
|
|
@ -62,25 +62,22 @@ entity msg_entity; // destination of single entity writes
|
|||
#ifndef QW_SYSTEM_qh
|
||||
@system {
|
||||
#endif
|
||||
void() main; // only for testing
|
||||
void () main; // only for testing
|
||||
|
||||
void() StartFrame;
|
||||
void () StartFrame;
|
||||
|
||||
void() PlayerPreThink;
|
||||
void() PlayerPostThink;
|
||||
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 () 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
|
||||
#ifndef QW_SYSTEM_qh
|
||||
|
@ -88,8 +85,8 @@ void end_sys_globals; // flag for structure dumping
|
|||
#endif
|
||||
/* End of system globals */
|
||||
|
||||
// ========================================================================== //
|
||||
// ========================================================================== //
|
||||
// ========================================================================= //
|
||||
// ========================================================================= //
|
||||
|
||||
/* Do not change. These are the system fields required by C code */
|
||||
/* (*** = do not set in prog code, maintained by C code) */
|
||||
|
@ -117,16 +114,15 @@ void end_sys_globals; // flag for structure dumping
|
|||
.vector mins, maxs; // bounding box extents reletive to origin
|
||||
.vector size; // *** maxs - mins, use setsize
|
||||
|
||||
.void() touch;
|
||||
.void() use;
|
||||
.void() think;
|
||||
.void() blocked; // for doors or plats, called when can't push other
|
||||
.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;
|
||||
|
@ -144,7 +140,6 @@ void end_sys_globals; // flag for structure dumping
|
|||
|
||||
.vector view_ofs; // add to origin to get eye point
|
||||
|
||||
|
||||
.float button0; // fire
|
||||
.float button1; // use
|
||||
.float button2; // jump
|
||||
|
@ -203,5 +198,5 @@ void end_sys_globals; // flag for structure dumping
|
|||
void end_sys_fields; // flag for structure dumping
|
||||
/* End of system fields */
|
||||
|
||||
// ========================================================================== //
|
||||
// ========================================================================== //
|
||||
// ========================================================================= //
|
||||
// ========================================================================= //
|
||||
|
|
|
@ -21,11 +21,10 @@ float sv_spawning;
|
|||
#define SV_SIGNON_BUFFERS 8
|
||||
#define SV_SIGNON_BUFFER_SWAP 512
|
||||
|
||||
// QF == 1, twilight/stock == 0
|
||||
#define SV_FLUSHSIGNON_BREAKS 1
|
||||
#define SV_FLUSHSIGNON_BREAKS 1 // QF == 1, twilight/stock == 0
|
||||
|
||||
#define SV_MAX_DATAGRAM 1450
|
||||
#define SV_FRAME_OVERHEAD 725 /* Wild guess. */
|
||||
#define SV_FRAME_OVERHEAD 725 // Wild guess.
|
||||
|
||||
#define SIZEOF_BASELINE 22
|
||||
#define SIZEOF_AMBIENTSOUND 16
|
||||
|
@ -39,7 +38,9 @@ float sv_frame_remaining;
|
|||
|
||||
// =================
|
||||
|
||||
float(float space) SZ_GetSpace_frame = {
|
||||
float (float space)
|
||||
SZ_GetSpace_frame =
|
||||
{
|
||||
if (sv_frame_remaining < space)
|
||||
return FALSE;
|
||||
|
||||
|
@ -48,7 +49,10 @@ float(float space) SZ_GetSpace_frame = {
|
|||
};
|
||||
|
||||
entity SZ_self;
|
||||
float(float space) SZ_GetSpace_signon = {
|
||||
|
||||
float (float space)
|
||||
SZ_GetSpace_signon =
|
||||
{
|
||||
if (sv_spawning || !SV_FLUSHSIGNON_BREAKS) {
|
||||
if (self != SZ_self) {
|
||||
SZ_self = self;
|
||||
|
@ -72,66 +76,62 @@ float(float space) SZ_GetSpace_signon = {
|
|||
|
||||
// =================
|
||||
|
||||
void() SZ_init = {
|
||||
void ()
|
||||
SZ_init =
|
||||
{
|
||||
sv_signon_buf_remaining = SV_SIGNON_BUFFERS;
|
||||
sv_signon_remaining = SV_MAX_DATAGRAM;
|
||||
|
||||
while ((self = nextent(self)))
|
||||
SZ_GetSpace_signon(SIZEOF_BASELINE);
|
||||
while ((self = nextent (self)))
|
||||
SZ_GetSpace_signon (SIZEOF_BASELINE);
|
||||
self = world;
|
||||
};
|
||||
|
||||
void() SZ_frame = {
|
||||
void ()
|
||||
SZ_frame =
|
||||
{
|
||||
sv_frame_remaining = SV_MAX_DATAGRAM - SV_FRAME_OVERHEAD;
|
||||
};
|
||||
|
||||
// =================
|
||||
|
||||
void(entity e) makestatic = {
|
||||
void (entity e)
|
||||
makestatic =
|
||||
{
|
||||
e.solid = SOLID_NOT;
|
||||
e.movetype = MOVETYPE_NONE;
|
||||
e.velocity = '0 0 0';
|
||||
e.avelocity = '0 0 0';
|
||||
e.nextthink = -1;
|
||||
|
||||
/* No more space? Just let it be... */
|
||||
if (!SZ_GetSpace_signon(SIZEOF_MAKESTATIC))
|
||||
// No more space? Just let it be...
|
||||
if (!SZ_GetSpace_signon (SIZEOF_MAKESTATIC))
|
||||
return;
|
||||
|
||||
if (!sv_spawning) {
|
||||
if (!SZ_GetSpace_frame(SIZEOF_MAKESTATIC)) {
|
||||
if (!SZ_GetSpace_frame (SIZEOF_MAKESTATIC)) {
|
||||
self.think = SUB_makestatic;
|
||||
self.nextthink = time + sv_mintic;
|
||||
return;
|
||||
}
|
||||
|
||||
WriteByte(MSG_ALL, SVC_MAKESTATIC);
|
||||
|
||||
WriteByte(MSG_ALL, e.modelindex);
|
||||
|
||||
WriteByte(MSG_ALL, e.frame);
|
||||
WriteByte(MSG_ALL, e.colormap);
|
||||
WriteByte(MSG_ALL, e.skin);
|
||||
|
||||
WriteCoord(MSG_ALL, e.origin_x);
|
||||
WriteCoord(MSG_ALL, e.origin_y);
|
||||
WriteCoord(MSG_ALL, e.origin_z);
|
||||
|
||||
WriteAngle(MSG_ALL, e.angles_x);
|
||||
WriteAngle(MSG_ALL, e.angles_y);
|
||||
WriteAngle(MSG_ALL, e.angles_z);
|
||||
WriteBytes (MSG_ALL, SVC_MAKESTATIC, e.modelindex, e.frame,
|
||||
e.colormap, e.skin);
|
||||
WriteCoordV (MSG_ALL, e.origin);
|
||||
WriteAngleV (MSG_ALL, e.angles);
|
||||
}
|
||||
|
||||
BUILTIN_makestatic(e);
|
||||
BUILTIN_makestatic (e);
|
||||
};
|
||||
|
||||
void(vector pos, string samp, float vol, float atten) ambientsound = {
|
||||
void (vector pos, string samp, float vol, float atten)
|
||||
ambientsound =
|
||||
{
|
||||
if (!sv_spawning)
|
||||
error("ambientsound after spawn functions\n");
|
||||
error ("ambientsound after spawn functions\n");
|
||||
|
||||
SZ_GetSpace_signon(SIZEOF_AMBIENTSOUND);
|
||||
SZ_GetSpace_signon (SIZEOF_AMBIENTSOUND);
|
||||
|
||||
/* Do it anyway */
|
||||
BUILTIN_ambientsound(pos, samp, vol, atten);
|
||||
// Do it anyway
|
||||
BUILTIN_ambientsound (pos, samp, vol, atten);
|
||||
};
|
||||
|
||||
|
|
|
@ -2,15 +2,13 @@
|
|||
#define SZ_WATCH_qh 1
|
||||
|
||||
@extern {
|
||||
float sv_spawning;
|
||||
|
||||
float sv_spawning;
|
||||
|
||||
void() SZ_init;
|
||||
void() SZ_frame;
|
||||
|
||||
void(entity e) makestatic;
|
||||
void(vector pos, string samp, float vol, float atten) ambientsound;
|
||||
void () SZ_init;
|
||||
void () SZ_frame;
|
||||
|
||||
void (entity e) makestatic;
|
||||
void (vector pos, string samp, float vol, float atten) ambientsound;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue