mirror of
https://git.code.sf.net/p/quake/game-source
synced 2025-02-18 01:41:41 +00:00
Beware. klik of death.
This commit is contained in:
parent
cf14b40c95
commit
1cb1b902f9
14 changed files with 889 additions and 655 deletions
|
@ -10,7 +10,9 @@
|
|||
.void () actthink;
|
||||
.void () postthink;
|
||||
|
||||
void() PlayerPreThink = {
|
||||
void ()
|
||||
PlayerPreThink =
|
||||
{
|
||||
if (is_cl (self))
|
||||
PlayerStartFrame ();
|
||||
|
||||
|
@ -18,7 +20,9 @@ void() PlayerPreThink = {
|
|||
self.prethink ();
|
||||
};
|
||||
|
||||
void() act_think = {
|
||||
void ()
|
||||
act_think =
|
||||
{
|
||||
if (!is_autothink (self)) {
|
||||
frametime = 0.1;
|
||||
PlayerPreThink ();
|
||||
|
@ -46,7 +50,9 @@ void() act_think = {
|
|||
PlayerPostThink ();
|
||||
};
|
||||
|
||||
void() PlayerPostThink = {
|
||||
void ()
|
||||
PlayerPostThink =
|
||||
{
|
||||
if (self.postthink)
|
||||
self.postthink ();
|
||||
|
||||
|
@ -54,7 +60,9 @@ void() PlayerPostThink = {
|
|||
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 () act_setup;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
|
||||
#define STOP_EPSILON 0.1
|
||||
|
||||
void() dead_prethink = {
|
||||
void ()
|
||||
dead_prethink =
|
||||
{
|
||||
if (vlen (self.movedir) > vlen (self.velocity)) {
|
||||
self.velocity = '0 0 0';
|
||||
} else {
|
||||
|
@ -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,7 +53,9 @@ void() dead_prethink = {
|
|||
self.movedir = self.velocity;
|
||||
};
|
||||
|
||||
void() dead_postthink = {
|
||||
void ()
|
||||
dead_postthink =
|
||||
{
|
||||
local vector vieworg;
|
||||
|
||||
self.dmg_take = 0;
|
||||
|
@ -56,17 +63,29 @@ void() dead_postthink = {
|
|||
|
||||
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 = {
|
||||
float (float d)
|
||||
dead_takedamage =
|
||||
{
|
||||
return FALSE;
|
||||
};
|
||||
|
||||
void ()
|
||||
act_setup_dead =
|
||||
{
|
||||
act_setup ();
|
||||
|
||||
weapon_select_by_impulse (0);
|
||||
|
@ -105,7 +124,7 @@ 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;
|
||||
|
||||
|
@ -116,5 +135,5 @@ void() act_setup_dead = {
|
|||
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;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
|
||||
#include "override.qh"
|
||||
|
||||
void() act_player_init = {
|
||||
void ()
|
||||
act_player_init =
|
||||
{
|
||||
precache_sound ("player/plyrjmp8.wav");
|
||||
precache_sound ("player/h2ojump.wav");
|
||||
|
||||
|
@ -65,7 +67,9 @@ void() act_player_init = {
|
|||
|
||||
// ========================================================================
|
||||
|
||||
void(float scl) player_throw_ammo = {
|
||||
void (float scl)
|
||||
player_throw_ammo =
|
||||
{
|
||||
local entity player;
|
||||
|
||||
player = self;
|
||||
|
@ -103,8 +107,9 @@ 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) {
|
||||
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;
|
||||
|
@ -134,7 +139,9 @@ void(float scl) player_throw_ammo = {
|
|||
self = player;
|
||||
};
|
||||
|
||||
void() player_die = {
|
||||
void ()
|
||||
player_die =
|
||||
{
|
||||
local float r;
|
||||
|
||||
if (self.health > CONFIG_GIB_HEALTH) {
|
||||
|
@ -142,11 +149,16 @@ void() player_die = {
|
|||
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";
|
||||
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);
|
||||
|
||||
|
@ -154,8 +166,10 @@ void() player_die = {
|
|||
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";
|
||||
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);
|
||||
|
@ -177,7 +191,9 @@ void() player_die = {
|
|||
|
||||
// ========================================================================
|
||||
|
||||
float(float d) _player_takedamage_core = {
|
||||
float (float d)
|
||||
_player_takedamage_core =
|
||||
{
|
||||
self.health -= d;
|
||||
self.dmg_take += d;
|
||||
|
||||
|
@ -192,13 +208,15 @@ float(float d) _player_takedamage_core = {
|
|||
return TRUE;
|
||||
};
|
||||
|
||||
float(float d) player_takedamage = {
|
||||
local float r, taked;
|
||||
float (float d)
|
||||
player_takedamage =
|
||||
{
|
||||
local float taked, r;
|
||||
|
||||
damage_push (d);
|
||||
|
||||
taked = damage_armor (d);
|
||||
self.dmg_save = self.dmg_save + (d - taked);
|
||||
self.dmg_save += (d - taked);
|
||||
|
||||
if (taked <= 0)
|
||||
return FALSE;
|
||||
|
@ -206,16 +224,24 @@ float(float d) player_takedamage = {
|
|||
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 (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";
|
||||
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);
|
||||
|
||||
|
@ -227,7 +253,9 @@ float(float d) player_takedamage = {
|
|||
|
||||
// ========================================================================
|
||||
|
||||
float(float d) _player_takedamage_drown = {
|
||||
float (float d)
|
||||
_player_takedamage_drown =
|
||||
{
|
||||
local float r;
|
||||
|
||||
if (d <= 0)
|
||||
|
@ -235,8 +263,10 @@ float(float d) _player_takedamage_drown = {
|
|||
|
||||
if (self.pain_finished < time) {
|
||||
r = random () * 2;
|
||||
if (r < 1) self.noise = self.noise3;
|
||||
else self.noise = self.noise4;
|
||||
if (r < 1)
|
||||
self.noise = self.noise3;
|
||||
else
|
||||
self.noise = self.noise4;
|
||||
|
||||
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
|
||||
|
||||
|
@ -246,8 +276,10 @@ float(float d) _player_takedamage_drown = {
|
|||
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);
|
||||
self.dmg_save += d - taked;
|
||||
|
@ -257,8 +289,10 @@ float(float d) _player_takedamage_melt = {
|
|||
|
||||
if (self.pain_finished < time) {
|
||||
r = random () * 2;
|
||||
if (r < 1) self.noise = self.noise3;
|
||||
else self.noise = self.noise4;
|
||||
if (r < 1)
|
||||
self.noise = self.noise3;
|
||||
else
|
||||
self.noise = self.noise4;
|
||||
|
||||
sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
|
||||
|
||||
|
@ -268,7 +302,9 @@ float(float d) _player_takedamage_melt = {
|
|||
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);
|
||||
|
@ -280,46 +316,68 @@ float(float d, float(float d) damg_func, void() deathmessage) _player_damage_cus
|
|||
|
||||
// ========================================================================
|
||||
|
||||
void() _deathmsg_player_liquid = {
|
||||
void ()
|
||||
_deathmsg_player_liquid =
|
||||
{
|
||||
local string def_nname;
|
||||
local float r;
|
||||
|
||||
def_nname = name (self);
|
||||
|
||||
if (self.watertype == CONTENT_WATER) {
|
||||
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");
|
||||
} else if (self.watertype == CONTENT_SLIME) {
|
||||
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");
|
||||
} else if (self.watertype == CONTENT_LAVA) {
|
||||
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");
|
||||
} else {
|
||||
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);
|
||||
|
||||
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");
|
||||
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;
|
||||
|
@ -339,7 +397,9 @@ 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);
|
||||
|
@ -354,14 +414,16 @@ void() _player_water_jump = {
|
|||
/* 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
|
||||
|
@ -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,18 +466,20 @@ 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;
|
||||
self.flags &= ~FL_INWATER;
|
||||
}
|
||||
|
||||
if (_player_jump())
|
||||
|
@ -442,8 +510,10 @@ void() player_prethink = {
|
|||
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";
|
||||
if (random () < 0.5)
|
||||
self.noise = "misc/water1.wav";
|
||||
else
|
||||
self.noise = "misc/water2.wav";
|
||||
sound (self, CHAN_BODY, self.noise, 1, ATTN_NORM);
|
||||
}
|
||||
}
|
||||
|
@ -460,13 +530,16 @@ void() player_prethink = {
|
|||
};
|
||||
|
||||
/* 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;
|
||||
|
||||
|
@ -500,7 +573,7 @@ void() player_velocity_damage = {
|
|||
|
||||
/* 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";
|
||||
|
@ -515,7 +588,9 @@ void() player_velocity_damage = {
|
|||
};
|
||||
|
||||
/* This is also called every frame... */
|
||||
void() player_postthink = {
|
||||
void ()
|
||||
player_postthink =
|
||||
{
|
||||
player_velocity_damage ();
|
||||
|
||||
self.items &= ~(IT_ARMOR1|IT_ARMOR2|IT_ARMOR3);
|
||||
|
@ -532,27 +607,33 @@ void() player_postthink = {
|
|||
|
||||
// ========================================================================
|
||||
|
||||
void(float nitem, string str1, string str2) _item_xprint_strs = {
|
||||
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(", ");
|
||||
} else if (nitem > 1)
|
||||
xprint_str (", ");
|
||||
|
||||
xprint_str (str1);
|
||||
if (str2) xprint_str(str2);
|
||||
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");
|
||||
|
@ -560,37 +641,48 @@ void(float nitem, string str1, string str2) _item_xprint_strs_last = {
|
|||
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);
|
||||
if (str2)
|
||||
xprint_str (str2);
|
||||
|
||||
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;
|
||||
if (new > 999)
|
||||
new = 999;
|
||||
if (new > self.fld) {
|
||||
diff = floor (new) - floor (self.fld);
|
||||
if (!diff) diff = new - 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;
|
||||
if (diff == 1)
|
||||
str2 = sing;
|
||||
else
|
||||
str2 = plur;
|
||||
nitem++;
|
||||
|
||||
self.fld = new;
|
||||
}
|
||||
};
|
||||
|
||||
float() player_takeitem = {
|
||||
float ()
|
||||
player_takeitem =
|
||||
{
|
||||
local float eid;
|
||||
|
||||
nitem = 0;
|
||||
|
@ -611,11 +703,13 @@ float() player_takeitem = {
|
|||
|
||||
_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_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;
|
||||
|
||||
|
@ -637,13 +731,15 @@ float() player_takeitem = {
|
|||
|
||||
_item_xprint_strs_last (nitem, str1, str2);
|
||||
|
||||
if (nitem) return TRUE;
|
||||
if (nitem)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
};
|
||||
|
||||
// ===================================================================== //
|
||||
|
||||
void() act_setup_player = {
|
||||
void ()
|
||||
act_setup_player ={
|
||||
act_setup ();
|
||||
|
||||
self.movedir = '0 0 0';
|
||||
|
|
|
@ -2,10 +2,8 @@
|
|||
#define ACT_PLAYER_qh 1
|
||||
|
||||
@extern {
|
||||
|
||||
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,7 +30,9 @@ 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 ();
|
||||
};
|
||||
|
@ -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,7 +70,9 @@ 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 ();
|
||||
|
@ -69,7 +81,9 @@ void() light_torch_small_walltorch = {
|
|||
/*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";
|
||||
|
@ -79,7 +93,9 @@ void() light_flame_large_yellow = {
|
|||
/*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 ();
|
||||
|
@ -88,7 +104,9 @@ void() light_flame_small_yellow = {
|
|||
/*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 ();
|
||||
|
@ -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;
|
||||
|
@ -116,7 +136,9 @@ void() misc_explobox2 = {
|
|||
|
||||
/*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 ();
|
||||
|
@ -124,14 +146,18 @@ void() ambient_suck_wind = {
|
|||
|
||||
/*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 ();
|
||||
};
|
||||
|
||||
/*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 ();
|
||||
|
@ -139,14 +165,18 @@ void() ambient_flouro_buzz = {
|
|||
|
||||
/*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 ();
|
||||
};
|
||||
|
||||
/*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 ();
|
||||
|
@ -154,35 +184,47 @@ void() ambient_comp_hum = {
|
|||
|
||||
/*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 ();
|
||||
};
|
||||
|
||||
/*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 ();
|
||||
};
|
||||
|
||||
/*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 ();
|
||||
};
|
||||
|
||||
/*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 ();
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
void() path_corner = { info_notnull(); };
|
||||
void ()
|
||||
path_corner =
|
||||
{
|
||||
info_notnull ();
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
|
@ -200,34 +242,51 @@ 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 ();
|
||||
|
||||
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 = {
|
||||
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 ();
|
||||
};
|
||||
|
||||
#define SPAWNFLAGS_NOMESSAGE 1
|
||||
void() _trigger_counter_use = {
|
||||
void ()
|
||||
_trigger_counter_use =
|
||||
{
|
||||
local float doprint;
|
||||
|
||||
doprint = !(self.spawnflags & SPAWNFLAGS_NOMESSAGE) && is_cl (other);
|
||||
|
@ -255,7 +314,9 @@ 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 = {
|
||||
void ()
|
||||
trigger_counter =
|
||||
{
|
||||
util_map_entity_init ();
|
||||
|
||||
self.model = NIL;
|
||||
|
@ -272,10 +333,15 @@ 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 ();
|
||||
|
||||
|
@ -286,12 +352,18 @@ 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 ();
|
||||
|
@ -302,12 +374,18 @@ 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);
|
||||
return;
|
||||
|
@ -319,7 +397,9 @@ void() func_episodegate = {
|
|||
/*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);
|
||||
return;
|
||||
|
@ -349,8 +429,11 @@ 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';
|
||||
|
@ -364,60 +447,84 @@ void() item_weapon = {
|
|||
|
||||
/*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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
|
@ -441,7 +550,9 @@ void() item_shells = {
|
|||
|
||||
/*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;
|
||||
|
@ -454,7 +565,9 @@ void() item_spikes = {
|
|||
|
||||
/*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;
|
||||
|
@ -467,7 +580,9 @@ void() item_rockets = {
|
|||
|
||||
/*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;
|
||||
|
@ -483,7 +598,9 @@ 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;
|
||||
|
@ -492,7 +609,9 @@ void() item_armor1 = {
|
|||
|
||||
/*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;
|
||||
|
@ -501,7 +620,9 @@ void() item_armor2 = {
|
|||
|
||||
/*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;
|
||||
|
@ -512,7 +633,9 @@ void() item_armorInv = {
|
|||
|
||||
/*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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
||||
|
|
|
@ -5,13 +5,17 @@
|
|||
|
||||
#include "misc.qh"
|
||||
|
||||
void() effect_muzzleflash = {
|
||||
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;
|
||||
|
||||
|
@ -19,78 +23,75 @@ void(entity e) effect_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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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";
|
||||
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);
|
||||
WriteBytes (MSG_MULTICAST, SVC_TEMPENTITY, TE_TELEPORT);
|
||||
WriteCoordV (MSG_MULTICAST, org);
|
||||
multicast (org, MULTICAST_PHS);
|
||||
|
||||
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);
|
||||
void (entity from, vector p1, vector p2)
|
||||
effect_lightning2 =
|
||||
{
|
||||
WriteBytes (MSG_MULTICAST, SVC_TEMPENTITY, 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);
|
||||
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
|
||||
|
|
|
@ -74,22 +74,19 @@ 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 () 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
|
||||
};
|
||||
#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) */
|
||||
|
@ -126,7 +123,6 @@ void end_sys_globals; // flag for structure dumping
|
|||
.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,7 +76,9 @@ 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;
|
||||
|
||||
|
@ -81,20 +87,24 @@ void() SZ_init = {
|
|||
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... */
|
||||
// No more space? Just let it be...
|
||||
if (!SZ_GetSpace_signon (SIZEOF_MAKESTATIC))
|
||||
return;
|
||||
|
||||
|
@ -105,33 +115,23 @@ void(entity e) makestatic = {
|
|||
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);
|
||||
};
|
||||
|
||||
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");
|
||||
|
||||
SZ_GetSpace_signon (SIZEOF_AMBIENTSOUND);
|
||||
|
||||
/* Do it anyway */
|
||||
// Do it anyway
|
||||
BUILTIN_ambientsound (pos, samp, vol, atten);
|
||||
};
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#define SZ_WATCH_qh 1
|
||||
|
||||
@extern {
|
||||
|
||||
float sv_spawning;
|
||||
|
||||
void () SZ_init;
|
||||
|
@ -10,7 +9,6 @@ void() SZ_frame;
|
|||
|
||||
void (entity e) makestatic;
|
||||
void (vector pos, string samp, float vol, float atten) ambientsound;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue