mirror of
https://git.code.sf.net/p/quake/game-source
synced 2024-11-22 20:11:49 +00:00
Whitespace, codingstyle, and other QFisms.
This commit is contained in:
parent
12b2ce3787
commit
88fcbcbcfd
34 changed files with 1004 additions and 769 deletions
|
@ -9,7 +9,7 @@ CPP=cpp
|
||||||
CPPFLAGS=-I. -Iweapons -Imdl -Iact -Imapents
|
CPPFLAGS=-I. -Iweapons -Imdl -Iact -Imapents
|
||||||
|
|
||||||
QFCC=qfcc
|
QFCC=qfcc
|
||||||
QFCCFLAGS=-q --warn all,error --code v6only $(CPPFLAGS)
|
QFCCFLAGS=-q --warn all,error $(CPPFLAGS)
|
||||||
|
|
||||||
###############################################
|
###############################################
|
||||||
|
|
||||||
|
|
|
@ -11,46 +11,53 @@
|
||||||
float _bodyque_current;
|
float _bodyque_current;
|
||||||
entity bodyque_head;
|
entity bodyque_head;
|
||||||
|
|
||||||
void() bodyque_init = {
|
void ()
|
||||||
|
bodyque_init =
|
||||||
|
{
|
||||||
local float i;
|
local float i;
|
||||||
local entity e;
|
local entity e;
|
||||||
|
|
||||||
e = bodyque_head = spawn("BODYQUE");
|
e = bodyque_head = spawn ("BODYQUE");
|
||||||
bodyque_head.owner = bodyque_head;
|
bodyque_head.owner = bodyque_head;
|
||||||
for (i = 1; i < CONFIG_BODYQUE_MAX; i = i + 1) {
|
for (i = 1; i < CONFIG_BODYQUE_MAX; i++) {
|
||||||
bodyque_head.owner = spawn("BODYQUE");
|
bodyque_head.owner = spawn ("BODYQUE");
|
||||||
bodyque_head.owner.chain = bodyque_head;
|
bodyque_head.owner.chain = bodyque_head;
|
||||||
bodyque_head = bodyque_head.owner;
|
bodyque_head = bodyque_head.owner;
|
||||||
}
|
}
|
||||||
e.chain = bodyque_head;
|
e.chain = bodyque_head;
|
||||||
bodyque_head.owner = e;
|
bodyque_head.owner = e;
|
||||||
|
|
||||||
precache_sound("zombie/z_miss.wav");
|
precache_sound ("zombie/z_miss.wav");
|
||||||
|
|
||||||
precache_sound("player/gib.wav");
|
precache_sound ("player/gib.wav");
|
||||||
precache_sound("player/udeath.wav");
|
precache_sound ("player/udeath.wav");
|
||||||
};
|
};
|
||||||
|
|
||||||
void() _bodyque_fade_think = {
|
void ()
|
||||||
|
_bodyque_fade_think =
|
||||||
|
{
|
||||||
local vector org;
|
local vector org;
|
||||||
|
|
||||||
if (self.mdl_think) {
|
if (self.mdl_think) {
|
||||||
if (!self.mdl_thought) self.mdl_think();
|
if (!self.mdl_thought)
|
||||||
|
self.mdl_think ();
|
||||||
self.mdl_thought = FALSE;
|
self.mdl_thought = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
org = self.origin;
|
org = self.origin;
|
||||||
org_z = org_z + self.maxs_z;
|
org_z = org_z + self.maxs_z;
|
||||||
if (pointcontents(org) == CONTENT_SOLID) {
|
if (pointcontents (org) == CONTENT_SOLID) {
|
||||||
_bodyque_current = _bodyque_current - 1;
|
_bodyque_current = _bodyque_current - 1;
|
||||||
remove(self);
|
remove (self);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.nextthink = time + 0.1;
|
self.nextthink = time + 0.1;
|
||||||
};
|
};
|
||||||
|
|
||||||
void() _bodyque_fade_from_reality = {
|
void ()
|
||||||
|
_bodyque_fade_from_reality =
|
||||||
|
{
|
||||||
local entity new_bodyque;
|
local entity new_bodyque;
|
||||||
|
|
||||||
if (_bodyque_current >= CONFIG_BODYQUE_FADE_MAX)
|
if (_bodyque_current >= CONFIG_BODYQUE_FADE_MAX)
|
||||||
|
@ -81,20 +88,25 @@ void() _bodyque_fade_from_reality = {
|
||||||
_bodyque_current = _bodyque_current + 1;
|
_bodyque_current = _bodyque_current + 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
void() _bodyque_think = {
|
void ()
|
||||||
|
_bodyque_think =
|
||||||
|
{
|
||||||
if (self.mdl_think) {
|
if (self.mdl_think) {
|
||||||
if (!self.mdl_thought) self.mdl_think();
|
if (!self.mdl_thought)
|
||||||
|
self.mdl_think ();
|
||||||
self.mdl_thought = FALSE;
|
self.mdl_thought = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.nextthink = time + 0.1;
|
self.nextthink = time + 0.1;
|
||||||
};
|
};
|
||||||
|
|
||||||
entity(entity body) bodyque_que = {
|
entity (entity body)
|
||||||
|
bodyque_que =
|
||||||
|
{
|
||||||
local entity ret;
|
local entity ret;
|
||||||
|
|
||||||
if (bodyque_head.count)
|
if (bodyque_head.count)
|
||||||
_bodyque_fade_from_reality();
|
_bodyque_fade_from_reality ();
|
||||||
|
|
||||||
ret = bodyque_head;
|
ret = bodyque_head;
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,8 @@
|
||||||
#define BODYQUE_qh 1
|
#define BODYQUE_qh 1
|
||||||
|
|
||||||
@extern {
|
@extern {
|
||||||
|
void () bodyque_init;
|
||||||
void() bodyque_init;
|
entity (entity body) bodyque_que;
|
||||||
entity(entity body) bodyque_que;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
176
klik/client.qc
176
klik/client.qc
|
@ -22,36 +22,44 @@
|
||||||
|
|
||||||
#include "teleport.qh"
|
#include "teleport.qh"
|
||||||
|
|
||||||
void() client_init = {
|
void ()
|
||||||
precache_model("progs/player.mdl");
|
client_init =
|
||||||
precache_model("progs/eyes.mdl");
|
{
|
||||||
|
precache_model ("progs/player.mdl");
|
||||||
|
precache_model ("progs/eyes.mdl");
|
||||||
};
|
};
|
||||||
|
|
||||||
// This is the first function called by C code for a new player.
|
// This is the first function called by C code for a new player.
|
||||||
void() SetNewParms = {
|
void ()
|
||||||
|
SetNewParms =
|
||||||
|
{
|
||||||
parm1 = CONFIG_START_CURRENCY;
|
parm1 = CONFIG_START_CURRENCY;
|
||||||
|
|
||||||
parm2 = parm3 = parm4 = parm5 = 0;
|
parm2 = parm3 = parm4 = parm5 = 0;
|
||||||
|
|
||||||
parm6 = CONFIG_START_HEALTH + CONFIG_START_ARMOR*999;
|
parm6 = CONFIG_START_HEALTH + CONFIG_START_ARMOR * 999;
|
||||||
parm7 = CONFIG_START_ARMOR_TYPE;
|
parm7 = CONFIG_START_ARMOR_TYPE;
|
||||||
parm8 = CONFIG_MAX_HEALTH + CONFIG_MAX_ARMOR*999;
|
parm8 = CONFIG_MAX_HEALTH + CONFIG_MAX_ARMOR * 999;
|
||||||
|
|
||||||
parm9 = CONFIG_START_SHELLS + CONFIG_START_NAILS*999;
|
parm9 = CONFIG_START_SHELLS + CONFIG_START_NAILS * 999;
|
||||||
parm10 = CONFIG_START_ROCKETS + CONFIG_START_CELLS*999;
|
parm10 = CONFIG_START_ROCKETS + CONFIG_START_CELLS * 999;
|
||||||
parm11 = CONFIG_MAX_SHELLS + CONFIG_MAX_NAILS*999;
|
parm11 = CONFIG_MAX_SHELLS + CONFIG_MAX_NAILS * 999;
|
||||||
parm12 = CONFIG_MAX_ROCKETS + CONFIG_MAX_CELLS*999;
|
parm12 = CONFIG_MAX_ROCKETS + CONFIG_MAX_CELLS * 999;
|
||||||
|
|
||||||
parm15 = weapon_player_parm1_default();
|
parm15 = weapon_player_parm1_default ();
|
||||||
parm16 = EQUIP_STATE_CHOOSE;
|
parm16 = EQUIP_STATE_CHOOSE;
|
||||||
};
|
};
|
||||||
|
|
||||||
void() SetDeadParms = {
|
void ()
|
||||||
|
SetDeadParms =
|
||||||
|
{
|
||||||
SetNewParms();
|
SetNewParms();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Called when about to change maps
|
// Called when about to change maps
|
||||||
void() SetChangeParms = {
|
void ()
|
||||||
|
SetChangeParms =
|
||||||
|
{
|
||||||
/* Currency */
|
/* Currency */
|
||||||
parm1 = self.currency;
|
parm1 = self.currency;
|
||||||
|
|
||||||
|
@ -62,28 +70,31 @@ void() SetChangeParms = {
|
||||||
parm5 = self.itemfield_4;
|
parm5 = self.itemfield_4;
|
||||||
|
|
||||||
/* Health and such */
|
/* Health and such */
|
||||||
if (self.health < 0) self.health = 0;
|
if (self.health < 0)
|
||||||
|
self.health = 0;
|
||||||
|
|
||||||
parm6 = self.health + self.armorvalue*999;
|
parm6 = self.health + self.armorvalue * 999;
|
||||||
parm7 = self.armortype;
|
parm7 = self.armortype;
|
||||||
parm8 = self.max_health + self.max_armor*999;
|
parm8 = self.max_health + self.max_armor * 999;
|
||||||
|
|
||||||
/* Ammo */
|
/* Ammo */
|
||||||
parm9 = self.ammo_shells + self.ammo_nails*999;
|
parm9 = self.ammo_shells + self.ammo_nails * 999;
|
||||||
parm10 = self.ammo_rockets + self.ammo_cells*999;
|
parm10 = self.ammo_rockets + self.ammo_cells * 999;
|
||||||
parm11 = self.max_ammo_shells + self.max_ammo_nails*999;
|
parm11 = self.max_ammo_shells + self.max_ammo_nails * 999;
|
||||||
parm12 = self.max_ammo_rockets + self.max_ammo_cells*999;
|
parm12 = self.max_ammo_rockets + self.max_ammo_cells * 999;
|
||||||
|
|
||||||
/* Wheeee */
|
/* Wheeee */
|
||||||
parm15 = weapon_player_parm1();
|
parm15 = weapon_player_parm1 ();
|
||||||
parm16 = self.equip_state;
|
parm16 = self.equip_state;
|
||||||
|
|
||||||
/* H4x0r */
|
/* H4x0r */
|
||||||
if (self.deadflag)
|
if (self.deadflag)
|
||||||
SetDeadParms();
|
SetDeadParms ();
|
||||||
};
|
};
|
||||||
|
|
||||||
void() DecodeParms = {
|
void ()
|
||||||
|
DecodeParms =
|
||||||
|
{
|
||||||
/* Currency */
|
/* Currency */
|
||||||
self.currency = parm1;
|
self.currency = parm1;
|
||||||
|
|
||||||
|
@ -96,52 +107,56 @@ void() DecodeParms = {
|
||||||
equip_grant(self, EQUIPID_SHOTGUN);
|
equip_grant(self, EQUIPID_SHOTGUN);
|
||||||
|
|
||||||
/* Health and such */
|
/* Health and such */
|
||||||
self.armorvalue = floor(parm6 / 999);
|
self.armorvalue = floor (parm6 / 999);
|
||||||
self.armortype = parm7;
|
self.armortype = parm7;
|
||||||
|
|
||||||
self.health = parm6 - self.armorvalue*999;
|
self.health = parm6 - self.armorvalue * 999;
|
||||||
|
|
||||||
self.max_armor = floor(parm8 / 999);
|
self.max_armor = floor (parm8 / 999);
|
||||||
self.max_health = parm8 - self.max_armor*999;
|
self.max_health = parm8 - self.max_armor * 999;
|
||||||
|
|
||||||
/* Ammo */
|
/* Ammo */
|
||||||
self.ammo_nails = floor(parm9 / 999);
|
self.ammo_nails = floor (parm9 / 999);
|
||||||
self.ammo_shells = parm9 - self.ammo_nails*999;
|
self.ammo_shells = parm9 - self.ammo_nails * 999;
|
||||||
|
|
||||||
self.ammo_rockets = floor(parm10 / 999);
|
self.ammo_rockets = floor (parm10 / 999);
|
||||||
self.ammo_cells = parm10 - self.ammo_rockets*999;
|
self.ammo_cells = parm10 - self.ammo_rockets * 999;
|
||||||
|
|
||||||
self.max_ammo_nails = floor(parm11 / 999);
|
self.max_ammo_nails = floor (parm11 / 999);
|
||||||
self.max_ammo_shells = parm11 - self.max_ammo_nails*999;
|
self.max_ammo_shells = parm11 - self.max_ammo_nails * 999;
|
||||||
|
|
||||||
self.max_ammo_rockets = floor(parm12 / 999);
|
self.max_ammo_rockets = floor (parm12 / 999);
|
||||||
self.max_ammo_cells = parm12 - self.max_ammo_rockets*999;
|
self.max_ammo_cells = parm12 - self.max_ammo_rockets * 999;
|
||||||
|
|
||||||
/* Wheeee */
|
/* Wheeee */
|
||||||
weapon_player_parm1_decode(parm15);
|
weapon_player_parm1_decode (parm15);
|
||||||
self.equip_state = parm16;
|
self.equip_state = parm16;
|
||||||
|
|
||||||
SetDeadParms();
|
SetDeadParms ();
|
||||||
};
|
};
|
||||||
|
|
||||||
void() RemoveClientFromGame = {
|
void ()
|
||||||
|
RemoveClientFromGame =
|
||||||
|
{
|
||||||
self.classname = "player_outofgame";
|
self.classname = "player_outofgame";
|
||||||
mdl_setup_void();
|
mdl_setup_void ();
|
||||||
act_setup_dead();
|
act_setup_dead ();
|
||||||
};
|
};
|
||||||
|
|
||||||
void() PutClientInGame = {
|
void ()
|
||||||
|
PutClientInGame =
|
||||||
|
{
|
||||||
local entity ent;
|
local entity ent;
|
||||||
local float spawncount;
|
local float spawncount;
|
||||||
|
|
||||||
menu_set(NOTHING_function);
|
menu_set (NOTHING_function);
|
||||||
|
|
||||||
self.classname = "player";
|
self.classname = "player";
|
||||||
|
|
||||||
DecodeParms();
|
DecodeParms ();
|
||||||
|
|
||||||
mdl_setup_player();
|
mdl_setup_player ();
|
||||||
act_setup_player();
|
act_setup_player ();
|
||||||
|
|
||||||
self.velocity = '0 0 0';
|
self.velocity = '0 0 0';
|
||||||
self.flags &= ~FL_INWATER;
|
self.flags &= ~FL_INWATER;
|
||||||
|
@ -151,8 +166,8 @@ void() PutClientInGame = {
|
||||||
|
|
||||||
/* Select a spawn point.. */
|
/* Select a spawn point.. */
|
||||||
for (spawncount = 5; spawncount > 0; spawncount--) {
|
for (spawncount = 5; spawncount > 0; spawncount--) {
|
||||||
spawn_head = random_enemy_chain(spawn_head);
|
spawn_head = random_enemy_chain (spawn_head);
|
||||||
ent = findradius(spawn_head.origin, 100);
|
ent = findradius (spawn_head.origin, 100);
|
||||||
while (ent) {
|
while (ent) {
|
||||||
if (ent.classname == "player")
|
if (ent.classname == "player")
|
||||||
break;
|
break;
|
||||||
|
@ -163,70 +178,87 @@ void() PutClientInGame = {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
teleport(self, spawn_head);
|
teleport (self, spawn_head);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Called right after ClientConnect, and on new maps.
|
// Called right after ClientConnect, and on new maps.
|
||||||
void() PutClientInServer = {
|
void ()
|
||||||
|
PutClientInServer =
|
||||||
|
{
|
||||||
local entity spot;
|
local entity spot;
|
||||||
|
|
||||||
/* Hack to get pmodel for servers that check it */
|
/* Hack to get pmodel for servers that check it */
|
||||||
self.model = "progs/player.mdl";
|
self.model = "progs/player.mdl";
|
||||||
self.modelindex = 0;
|
self.modelindex = 0;
|
||||||
|
|
||||||
intermission_head = spot = random_enemy_chain(intermission_head);
|
intermission_head = spot = random_enemy_chain (intermission_head);
|
||||||
self.origin = spot.origin;
|
self.origin = spot.origin;
|
||||||
self.angles = spot.angles;
|
self.angles = spot.angles;
|
||||||
self.fixangle = TRUE;
|
self.fixangle = TRUE;
|
||||||
|
|
||||||
self.velocity = '0 0 0';
|
self.velocity = '0 0 0';
|
||||||
|
|
||||||
weapon_player_init();
|
weapon_player_init ();
|
||||||
|
|
||||||
menu_set(menu_intro);
|
menu_set (menu_intro);
|
||||||
|
|
||||||
RemoveClientFromGame();
|
RemoveClientFromGame ();
|
||||||
};
|
};
|
||||||
|
|
||||||
void() _deathmsg_suicide = {
|
void ()
|
||||||
|
_deathmsg_suicide =
|
||||||
|
{
|
||||||
local float r;
|
local float r;
|
||||||
local string nname;
|
local string nname;
|
||||||
|
|
||||||
nname = name(self);
|
nname = name (self);
|
||||||
|
|
||||||
r = random();
|
r = random();
|
||||||
if (r < 0.25) bprint(PRINT_DEATH, nname, " says good bye to this cruel world.\n");
|
if (r < 0.25)
|
||||||
else if (r < 0.5) bprint(PRINT_DEATH, nname, " takes the easy way out.\n");
|
bprint (PRINT_DEATH, nname, " says good bye to this cruel world.\n");
|
||||||
else if (r < 0.75) bprint(PRINT_DEATH, nname, " suicides.\n");
|
else if (r < 0.5)
|
||||||
else bprint(PRINT_DEATH, nname, " stands at the wrong end of his shotgun.\n");
|
bprint (PRINT_DEATH, nname, " takes the easy way out.\n");
|
||||||
|
else if (r < 0.75)
|
||||||
|
bprint (PRINT_DEATH, nname, " suicides.\n");
|
||||||
|
else
|
||||||
|
bprint (PRINT_DEATH, nname,
|
||||||
|
" stands at the wrong end of his shotgun.\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
// C Code calls this when the player issues a 'kill' command.
|
// C Code calls this when the player issues a 'kill' command.
|
||||||
void()
|
void ()
|
||||||
ClientKill = {
|
ClientKill = {
|
||||||
damage(self, self, self, DAMAGE_MUSTDIE, _deathmsg_suicide);
|
damage (self, self, self, DAMAGE_MUSTDIE, _deathmsg_suicide);
|
||||||
};
|
};
|
||||||
|
|
||||||
void() _client_th_kill = {
|
void ()
|
||||||
if (other == self) self.frags--;
|
_client_th_kill =
|
||||||
else self.frags++;
|
{
|
||||||
logfrag(self, other);
|
if (other == self)
|
||||||
|
self.frags--;
|
||||||
|
else
|
||||||
|
self.frags++;
|
||||||
|
logfrag (self, other);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Called after the client is fully connected
|
// Called after the client is fully connected
|
||||||
void() ClientConnect = {
|
void ()
|
||||||
bprint(PRINT_HIGH, name(self), " connected\n");
|
ClientConnect = {
|
||||||
|
bprint (PRINT_HIGH, name (self), " connected\n");
|
||||||
self.flags |= FL_CLIENT;
|
self.flags |= FL_CLIENT;
|
||||||
|
|
||||||
override_set_th_kill(self, _client_th_kill);
|
override_set_th_kill (self, _client_th_kill);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Called when the client disconnects
|
// Called when the client disconnects
|
||||||
void() ClientDisconnect = {
|
void ()
|
||||||
|
ClientDisconnect =
|
||||||
|
{
|
||||||
self.flags = 0;
|
self.flags = 0;
|
||||||
bprint(PRINT_HIGH, name(self), " disconnected with ", ftos(self.frags), " frags\n");
|
bprint (PRINT_HIGH, name(self), " disconnected with ", ftos(self.frags),
|
||||||
|
" frags\n");
|
||||||
|
|
||||||
override_set_th_kill(self, NOTHING_function);
|
override_set_th_kill (self, NOTHING_function);
|
||||||
self.deathmsg1 = NIL;
|
self.deathmsg1 = NIL;
|
||||||
damage(self, self, self, DAMAGE_MUSTDIE, NOTHING_function);
|
damage (self, self, self, DAMAGE_MUSTDIE, NOTHING_function);
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,15 +2,13 @@
|
||||||
#define CLIENT_qh 1
|
#define CLIENT_qh 1
|
||||||
|
|
||||||
@extern {
|
@extern {
|
||||||
|
void () client_init;
|
||||||
|
|
||||||
void() client_init;
|
void () RemoveClientFromGame;
|
||||||
|
void () PutClientInGame;
|
||||||
void() RemoveClientFromGame;
|
|
||||||
void() PutClientInGame;
|
|
||||||
|
|
||||||
void() ClientConnect;
|
|
||||||
void() ClientDisconnect;
|
|
||||||
|
|
||||||
|
void () ClientConnect;
|
||||||
|
void () ClientDisconnect;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
151
klik/damage.qc
151
klik/damage.qc
|
@ -7,33 +7,37 @@
|
||||||
|
|
||||||
.entity dmg_attacker;
|
.entity dmg_attacker;
|
||||||
|
|
||||||
.void() deathmsg;
|
.void () deathmsg;
|
||||||
.string deathmsg1, deathmsg2, deathmsg3, deathmsg4, deathmsg5, deathmsg6;
|
.string deathmsg1, deathmsg2, deathmsg3, deathmsg4, deathmsg5, deathmsg6;
|
||||||
|
|
||||||
// You _MUST_ have th_takedamage if you .takedamage!
|
// You _MUST_ have th_takedamage if you .takedamage!
|
||||||
// Return TRUE if you were damaged, FALSE otherwise.
|
// Return TRUE if you were damaged, FALSE otherwise.
|
||||||
.float(float dmg) th_takedamage;
|
.float (float dmg) th_takedamage;
|
||||||
|
|
||||||
/* Allows you to globally override damage you deal */
|
/* Allows you to globally override damage you deal */
|
||||||
/* self = you, other = target */
|
/* self = you, other = target */
|
||||||
/* returns new amount of damage, or < 0 for don't */
|
/* returns new amount of damage, or < 0 for don't */
|
||||||
.float(float dmg) th_dealdamage;
|
.float (float dmg) th_dealdamage;
|
||||||
|
|
||||||
.void(entity missile) th_attack;
|
.void (entity missile) th_attack;
|
||||||
|
|
||||||
/* Update frags in these. */
|
/* Update frags in these. */
|
||||||
.void() th_die;
|
.void () th_die;
|
||||||
.void() th_kill;
|
.void () th_kill;
|
||||||
|
|
||||||
.float(entity missile) th_projectile;
|
.float (entity missile) th_projectile;
|
||||||
|
|
||||||
entity ghost_inflictor;
|
entity ghost_inflictor;
|
||||||
|
|
||||||
void() damage_init = {
|
void ()
|
||||||
ghost_inflictor = spawn("GHOST_INFLICTOR");
|
damage_init =
|
||||||
|
{
|
||||||
|
ghost_inflictor = spawn ("GHOST_INFLICTOR");
|
||||||
};
|
};
|
||||||
|
|
||||||
void(entity from, entity to) deathmsg_copy = {
|
void (entity from, entity to)
|
||||||
|
deathmsg_copy =
|
||||||
|
{
|
||||||
to.deathmsg1 = from.deathmsg1;
|
to.deathmsg1 = from.deathmsg1;
|
||||||
to.deathmsg2 = from.deathmsg2;
|
to.deathmsg2 = from.deathmsg2;
|
||||||
to.deathmsg3 = from.deathmsg3;
|
to.deathmsg3 = from.deathmsg3;
|
||||||
|
@ -42,42 +46,56 @@ void(entity from, entity to) deathmsg_copy = {
|
||||||
to.deathmsg6 = from.deathmsg6;
|
to.deathmsg6 = from.deathmsg6;
|
||||||
};
|
};
|
||||||
|
|
||||||
string(entity e, string s) _deathmsg_custom_str = {
|
string (entity e, string s) _deathmsg_custom_str = {
|
||||||
if (s == "name(self)") return name(self);
|
if (s == "name(self)")
|
||||||
if (s == "name(attacker)") return name(self.dmg_attacker);
|
return name(self);
|
||||||
if (s == "name(inflictor)") return name(self.dmg_inflictor);
|
if (s == "name(attacker)")
|
||||||
|
return name (self.dmg_attacker);
|
||||||
|
if (s == "name(inflictor)")
|
||||||
|
return name (self.dmg_inflictor);
|
||||||
return s;
|
return s;
|
||||||
};
|
};
|
||||||
|
|
||||||
void() _deathmsg_custom = {
|
void ()
|
||||||
|
_deathmsg_custom =
|
||||||
|
{
|
||||||
local string s1, s2, s3, s4, s5, s6;
|
local string s1, s2, s3, s4, s5, s6;
|
||||||
|
|
||||||
s1 = s2 = s3 = s4 = s5 = s6 = "";
|
s1 = s2 = s3 = s4 = s5 = s6 = "";
|
||||||
|
|
||||||
s1 = _deathmsg_custom_str(self, self.deathmsg1);
|
s1 = _deathmsg_custom_str (self, self.deathmsg1);
|
||||||
if (s1) s2 = _deathmsg_custom_str(self, self.deathmsg2);
|
if (s1)
|
||||||
if (s2) s3 = _deathmsg_custom_str(self, self.deathmsg3);
|
s2 = _deathmsg_custom_str (self, self.deathmsg2);
|
||||||
if (s3) s4 = _deathmsg_custom_str(self, self.deathmsg4);
|
if (s2)
|
||||||
if (s4) s5 = _deathmsg_custom_str(self, self.deathmsg5);
|
s3 = _deathmsg_custom_str (self, self.deathmsg3);
|
||||||
if (s5) s6 = _deathmsg_custom_str(self, self.deathmsg6);
|
if (s3)
|
||||||
|
s4 = _deathmsg_custom_str (self, self.deathmsg4);
|
||||||
|
if (s4)
|
||||||
|
s5 = _deathmsg_custom_str (self, self.deathmsg5);
|
||||||
|
if (s5)
|
||||||
|
s6 = _deathmsg_custom_str (self, self.deathmsg6);
|
||||||
|
|
||||||
// I don't use separate bprints, because iD in all its wisdom
|
// I don't use separate bprints, because iD in all its wisdom
|
||||||
// made them unreliable -- I'd rather lose the whole thing than parts.
|
// made them unreliable -- I'd rather lose the whole thing than parts.
|
||||||
bprint(PRINT_DEATH, s1, s2, s3, s4, s5, s6);
|
bprint (PRINT_DEATH, s1, s2, s3, s4, s5, s6);
|
||||||
};
|
};
|
||||||
|
|
||||||
void() deathmsg_nodisplay = {
|
void ()
|
||||||
//XXX refcount_dec(self.dmg_attacker);
|
deathmsg_nodisplay =
|
||||||
//XXX refcount_dec(self.dmg_inflictor);
|
{
|
||||||
|
// refcount_dec (self.dmg_attacker);
|
||||||
|
// refcount_dec (self.dmg_inflictor);
|
||||||
self.dmg_attacker = world;
|
self.dmg_attacker = world;
|
||||||
self.dmg_inflictor = world;
|
self.dmg_inflictor = world;
|
||||||
|
|
||||||
self.deathmsg = NOTHING_function;
|
self.deathmsg = NOTHING_function;
|
||||||
};
|
};
|
||||||
|
|
||||||
void() deathmsg_display = {
|
void ()
|
||||||
|
deathmsg_display =
|
||||||
|
{
|
||||||
if (self.th_die)
|
if (self.th_die)
|
||||||
self.th_die();
|
self.th_die ();
|
||||||
|
|
||||||
if (other.th_kill) {
|
if (other.th_kill) {
|
||||||
local entity oldself, oldother;
|
local entity oldself, oldother;
|
||||||
|
@ -88,17 +106,18 @@ void() deathmsg_display = {
|
||||||
self = oldother;
|
self = oldother;
|
||||||
other = oldself;
|
other = oldself;
|
||||||
|
|
||||||
self.th_kill();
|
self.th_kill ();
|
||||||
|
|
||||||
self = oldself;
|
self = oldself;
|
||||||
other = oldother;
|
other = oldother;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.deathmsg();
|
self.deathmsg ();
|
||||||
deathmsg_nodisplay();
|
deathmsg_nodisplay ();
|
||||||
};
|
};
|
||||||
|
|
||||||
float(float d) damage_armor = {
|
float (float d)
|
||||||
|
damage_armor = {
|
||||||
local float adamg, rest;
|
local float adamg, rest;
|
||||||
|
|
||||||
adamg = d * self.armortype;
|
adamg = d * self.armortype;
|
||||||
|
@ -116,20 +135,22 @@ float(float d) damage_armor = {
|
||||||
return rest;
|
return rest;
|
||||||
};
|
};
|
||||||
|
|
||||||
void(float d) damage_push = {
|
void (float d)
|
||||||
|
damage_push =
|
||||||
|
{
|
||||||
local vector vel;
|
local vector vel;
|
||||||
|
|
||||||
if (self.mass == 0) {
|
if (self.mass == 0) {
|
||||||
d = 0;
|
d = 0;
|
||||||
} else {
|
} else {
|
||||||
if (self.dmg_attacker == self)
|
if (self.dmg_attacker == self)
|
||||||
d = (self.dmg_inflictor.mass + d*rocket_jump) / self.mass;
|
d = (self.dmg_inflictor.mass + d * rocket_jump) / self.mass;
|
||||||
else
|
else
|
||||||
d = self.dmg_inflictor.mass / self.mass;
|
d = self.dmg_inflictor.mass / self.mass;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.dmg_inflictor.velocity == '0 0 0') {
|
if (self.dmg_inflictor.velocity == '0 0 0') {
|
||||||
vel = normalize(self.origin - self.dmg_inflictor.origin);
|
vel = normalize (self.origin - self.dmg_inflictor.origin);
|
||||||
vel *= self.dmg_inflictor.speed;
|
vel *= self.dmg_inflictor.speed;
|
||||||
} else {
|
} else {
|
||||||
vel = self.dmg_inflictor.velocity;
|
vel = self.dmg_inflictor.velocity;
|
||||||
|
@ -139,8 +160,10 @@ void(float d) damage_push = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// deathmessage _IS_ overridden if inflictor.deathmsg1
|
// deathmessage _IS_ overridden if inflictor.deathmsg1
|
||||||
float(entity ent, entity attacker, entity inflictor, float d, void() deathmessage)
|
float (entity ent, entity attacker, entity inflictor, float d,
|
||||||
damage = {
|
void() deathmessage)
|
||||||
|
damage =
|
||||||
|
{
|
||||||
local entity oldself, oldother;
|
local entity oldself, oldother;
|
||||||
local float wasdamaged;
|
local float wasdamaged;
|
||||||
|
|
||||||
|
@ -153,8 +176,8 @@ damage = {
|
||||||
ent.dmg_attacker = attacker;
|
ent.dmg_attacker = attacker;
|
||||||
ent.dmg_inflictor = inflictor;
|
ent.dmg_inflictor = inflictor;
|
||||||
|
|
||||||
//XXX refcount_inc(ent.dmg_attacker);
|
// refcount_inc (ent.dmg_attacker);
|
||||||
//XXX refcount_inc(ent.dmg_inflictor);
|
// refcount_inc (ent.dmg_inflictor);
|
||||||
|
|
||||||
if (inflictor.deathmsg1)
|
if (inflictor.deathmsg1)
|
||||||
ent.deathmsg = _deathmsg_custom;
|
ent.deathmsg = _deathmsg_custom;
|
||||||
|
@ -170,7 +193,8 @@ damage = {
|
||||||
self = oldself;
|
self = oldself;
|
||||||
other = oldother;
|
other = oldother;
|
||||||
|
|
||||||
if (d < 0) return FALSE;
|
if (d < 0)
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
self = ent;
|
self = ent;
|
||||||
|
@ -184,52 +208,59 @@ damage = {
|
||||||
return wasdamaged;
|
return wasdamaged;
|
||||||
};
|
};
|
||||||
|
|
||||||
float(vector org, entity e) _damage_radius_can_hit = {
|
float (vector org, entity e)
|
||||||
|
_damage_radius_can_hit =
|
||||||
|
{
|
||||||
if (e.movetype == MOVETYPE_PUSH) {
|
if (e.movetype == MOVETYPE_PUSH) {
|
||||||
traceline(org, center(e), TRUE, world);
|
traceline (org, center (e), TRUE, world);
|
||||||
|
|
||||||
if (trace_fraction == 1 || trace_ent == e)
|
if (trace_fraction == 1 || trace_ent == e)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
traceline(org, e.origin, TRUE, self);
|
traceline (org, e.origin, TRUE, self);
|
||||||
if (trace_fraction == 1) return TRUE;
|
if (trace_fraction == 1)
|
||||||
traceline(org, e.origin + '15 15 0', TRUE, self);
|
return TRUE;
|
||||||
if (trace_fraction == 1) return TRUE;
|
traceline (org, e.origin + '15 15 0', TRUE, self);
|
||||||
traceline(org, e.origin + '15 -15 0', TRUE, self);
|
if (trace_fraction == 1)
|
||||||
if (trace_fraction == 1) return TRUE;
|
return TRUE;
|
||||||
traceline(org, e.origin + '-15 15 0', TRUE, self);
|
traceline (org, e.origin + '15 -15 0', TRUE, self);
|
||||||
if (trace_fraction == 1) return TRUE;
|
if (trace_fraction == 1)
|
||||||
traceline(org, e.origin + '-15 -15 0', TRUE, self);
|
return TRUE;
|
||||||
if (trace_fraction == 1) return TRUE;
|
traceline (org, e.origin + '-15 15 0', TRUE, self);
|
||||||
|
if (trace_fraction == 1)
|
||||||
|
return TRUE;
|
||||||
|
traceline (org, e.origin + '-15 -15 0', TRUE, self);
|
||||||
|
if (trace_fraction == 1)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
};
|
};
|
||||||
|
|
||||||
void(entity ignore, entity attacker, entity inflictor, void() deathmessage)
|
void (entity ignore, entity attacker, entity inflictor, void () deathmessage)
|
||||||
damage_radius = {
|
damage_radius =
|
||||||
|
{
|
||||||
local entity head;
|
local entity head;
|
||||||
local vector iorg, org;
|
local vector iorg, org;
|
||||||
local float points;
|
local float points, d, m, r;
|
||||||
local float d, m, r;
|
|
||||||
|
|
||||||
d = inflictor.dmg;
|
d = inflictor.dmg;
|
||||||
m = inflictor.mass;
|
m = inflictor.mass;
|
||||||
r = inflictor.lip;
|
r = inflictor.lip;
|
||||||
|
|
||||||
iorg = center(inflictor);
|
iorg = center (inflictor);
|
||||||
|
|
||||||
for (head = findradius(iorg, r + 40); head; head = head.chain) {
|
for (head = findradius (iorg, r + 40); head; head = head.chain) {
|
||||||
if (head == ignore)
|
if (head == ignore)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!_damage_radius_can_hit(iorg, head))
|
if (!_damage_radius_can_hit (iorg, head))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
org = center(head);
|
org = center(head);
|
||||||
|
|
||||||
points = r - (0.5 * vlen(iorg - org));
|
points = r - (0.5 * vlen (iorg - org));
|
||||||
if (points <= 0)
|
if (points <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -239,6 +270,6 @@ damage_radius = {
|
||||||
inflictor.dmg = (points * d) / r;
|
inflictor.dmg = (points * d) / r;
|
||||||
inflictor.mass = (points * m) / r;
|
inflictor.mass = (points * m) / r;
|
||||||
|
|
||||||
damage(head, attacker, inflictor, inflictor.dmg, deathmessage);
|
damage (head, attacker, inflictor, inflictor.dmg, deathmessage);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,35 +2,34 @@
|
||||||
#define DAMAGE_qh 1
|
#define DAMAGE_qh 1
|
||||||
|
|
||||||
@extern {
|
@extern {
|
||||||
|
|
||||||
#define DAMAGE_SHOULDDIE 16777214
|
#define DAMAGE_SHOULDDIE 16777214
|
||||||
#define DAMAGE_MUSTDIE 16777215
|
#define DAMAGE_MUSTDIE 16777215
|
||||||
|
|
||||||
.entity dmg_attacker;
|
.entity dmg_attacker;
|
||||||
|
|
||||||
.void() deathmsg;
|
.void () deathmsg;
|
||||||
.string deathmsg1, deathmsg2, deathmsg3, deathmsg4, deathmsg5, deathmsg6;
|
.string deathmsg1, deathmsg2, deathmsg3, deathmsg4, deathmsg5, deathmsg6;
|
||||||
|
|
||||||
// You _MUST_ have th_takedamage if you .takedamage!
|
// You _MUST_ have th_takedamage if you .takedamage!
|
||||||
// Return TRUE if you were damaged, FALSE otherwise.
|
// Return TRUE if you were damaged, FALSE otherwise.
|
||||||
.float(float dmg) th_takedamage;
|
.float (float dmg) th_takedamage;
|
||||||
|
|
||||||
/* Allows you to globally override damage you deal */
|
/* Allows you to globally override damage you deal */
|
||||||
/* self = you, other = target */
|
/* self = you, other = target */
|
||||||
/* returns new amount of damage, or < 0 for don't */
|
/* returns new amount of damage, or < 0 for don't */
|
||||||
.float(float dmg) th_dealdamage;
|
.float (float dmg) th_dealdamage;
|
||||||
|
|
||||||
/* Use this when you attack something. It may modify missile. */
|
/* Use this when you attack something. It may modify missile. */
|
||||||
/* You should have at least classname, velocity, dmg, and mass */
|
/* You should have at least classname, velocity, dmg, and mass */
|
||||||
#define damage_attack(missile) do{ if (self.th_attack) self.th_attack(missile); }while(0)
|
#define damage_attack(missile) do { if (self.th_attack) self.th_attack (missile); } while (0)
|
||||||
|
|
||||||
.void(entity missile) th_attack;
|
.void (entity missile) th_attack;
|
||||||
|
|
||||||
/* Update frags in these. */
|
/* Update frags in these. */
|
||||||
.void() th_die;
|
.void () th_die;
|
||||||
.void() th_kill;
|
.void () th_kill;
|
||||||
|
|
||||||
.float(entity missile) th_projectile;
|
.float (entity missile) th_projectile;
|
||||||
|
|
||||||
/* ghost_inflictor is for radius and bullets...
|
/* ghost_inflictor is for radius and bullets...
|
||||||
Only guaranteed to have:
|
Only guaranteed to have:
|
||||||
|
@ -40,21 +39,20 @@
|
||||||
*/
|
*/
|
||||||
entity ghost_inflictor;
|
entity ghost_inflictor;
|
||||||
|
|
||||||
void() damage_init;
|
void () damage_init;
|
||||||
|
|
||||||
void(entity from, entity to) deathmsg_copy;
|
void (entity from, entity to) deathmsg_copy;
|
||||||
void() deathmsg_display;
|
void () deathmsg_display;
|
||||||
void() deathmsg_nodisplay;
|
void () deathmsg_nodisplay;
|
||||||
|
|
||||||
float(float d) damage_armor;
|
float (float d) damage_armor;
|
||||||
void(float d) damage_push;
|
void (float d) damage_push;
|
||||||
float(entity ent, entity attacker, entity inflictor, float d, void() deathmessage) damage;
|
float (entity ent, entity attacker, entity inflictor, float d, void () deathmessage) damage;
|
||||||
|
|
||||||
/* Fill in appropriate fields, inflictor _WILL_ be modified. */
|
/* Fill in appropriate fields, inflictor _WILL_ be modified. */
|
||||||
void(entity ignore, entity attacker, entity inflictor, void() deathmessage) damage_radius;
|
void (entity ignore, entity attacker, entity inflictor, void () deathmessage) damage_radius;
|
||||||
|
|
||||||
float(vector org, entity e) _damage_radius_can_hit;
|
|
||||||
|
|
||||||
|
float (vector org, entity e) _damage_radius_can_hit;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
#include "common.qh"
|
#include "common.qh"
|
||||||
#include "debug.qh"
|
#include "debug.qh"
|
||||||
|
|
||||||
void() debug_impulse = {
|
void ()
|
||||||
|
debug_impulse =
|
||||||
|
{
|
||||||
local float imp;
|
local float imp;
|
||||||
|
|
||||||
imp = self.impulse;
|
imp = self.impulse;
|
||||||
self.impulse = 0;
|
self.impulse = 0;
|
||||||
|
|
||||||
{
|
{
|
||||||
self.impulse = imp;
|
self.impulse = imp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,7 @@
|
||||||
#define DEBUG_qh 1
|
#define DEBUG_qh 1
|
||||||
|
|
||||||
@extern {
|
@extern {
|
||||||
|
void () debug_impulse;
|
||||||
void() debug_impulse;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
82
klik/defs.qh
82
klik/defs.qh
|
@ -14,37 +14,37 @@
|
||||||
// edict.flags
|
// edict.flags
|
||||||
#define FL_FLY 1
|
#define FL_FLY 1
|
||||||
#define FL_SWIM 2
|
#define FL_SWIM 2
|
||||||
#define FL_CLIENT 8 /* set for all client edicts */
|
#define FL_CLIENT 8 /* set for all client edicts */
|
||||||
#define FL_INWATER 16 /* for enter / leave water splash */
|
#define FL_INWATER 16 /* for enter / leave water splash */
|
||||||
#define FL_MONSTER 32
|
#define FL_MONSTER 32
|
||||||
#define FL_GODMODE 64 /* player cheat */
|
#define FL_GODMODE 64 /* player cheat */
|
||||||
#define FL_NOTARGET 128 /* player cheat */
|
#define FL_NOTARGET 128 /* player cheat */
|
||||||
#define FL_ITEM 256 /* extra wide size for bonus items */
|
#define FL_ITEM 256 /* extra wide size for bonus items */
|
||||||
#define FL_ONGROUND 512 /* standing on something */
|
#define FL_ONGROUND 512 /* standing on something */
|
||||||
#define FL_PARTIALGROUND 1024 /* not all corners are valid */
|
#define FL_PARTIALGROUND 1024 /* not all corners are valid */
|
||||||
#define FL_WATERJUMP 2048 /* player jumping out of water */
|
#define FL_WATERJUMP 2048 /* player jumping out of water */
|
||||||
#define FL_JUMPRELEASED 4096 /* for jump debouncing */
|
#define FL_JUMPRELEASED 4096 /* for jump debouncing */
|
||||||
|
|
||||||
// edict.movetype values
|
// edict.movetype values
|
||||||
#define MOVETYPE_NONE 0 /* never moves */
|
#define MOVETYPE_NONE 0 /* never moves */
|
||||||
#define MOVETYPE_ANGLENOCLIP 1 /* NO LONGER SUPPORTED. */
|
#define MOVETYPE_ANGLENOCLIP 1 /* NO LONGER SUPPORTED. */
|
||||||
#define MOVETYPE_ANGLECLIP 2 /* NO LONGER SUPPORTED. */
|
#define MOVETYPE_ANGLECLIP 2 /* NO LONGER SUPPORTED. */
|
||||||
#define MOVETYPE_WALK 3 /* players only */
|
#define MOVETYPE_WALK 3 /* players only */
|
||||||
#define MOVETYPE_STEP 4 /* discrete, not real time unless fall */
|
#define MOVETYPE_STEP 4 /* discrete, not real time unless fall */
|
||||||
#define MOVETYPE_FLY 5
|
#define MOVETYPE_FLY 5
|
||||||
#define MOVETYPE_TOSS 6 /* gravity */
|
#define MOVETYPE_TOSS 6 /* gravity */
|
||||||
#define MOVETYPE_PUSH 7 /* no clip to world, push and crush */
|
#define MOVETYPE_PUSH 7 /* no clip to world, push and crush */
|
||||||
#define MOVETYPE_NOCLIP 8
|
#define MOVETYPE_NOCLIP 8
|
||||||
#define MOVETYPE_FLYMISSILE 9 /* fly with extra size against monsters */
|
#define MOVETYPE_FLYMISSILE 9 /* fly with extra size against monsters */
|
||||||
#define MOVETYPE_BOUNCE 10
|
#define MOVETYPE_BOUNCE 10
|
||||||
#define MOVETYPE_BOUNCEMISSILE 11 /* bounce with extra size */
|
#define MOVETYPE_BOUNCEMISSILE 11 /* bounce with extra size */
|
||||||
|
|
||||||
// edict.solid values
|
// edict.solid values
|
||||||
#define SOLID_NOT 0 /* no interaction with other objects */
|
#define SOLID_NOT 0 /* no interaction with other objects */
|
||||||
#define SOLID_TRIGGER 1 /* touch on edge, but not blocking */
|
#define SOLID_TRIGGER 1 /* touch on edge, but not blocking */
|
||||||
#define SOLID_BBOX 2 /* touch on edge, block */
|
#define SOLID_BBOX 2 /* touch on edge, block */
|
||||||
#define SOLID_SLIDEBOX 3 /* touch on edge, but not an onground */
|
#define SOLID_SLIDEBOX 3 /* touch on edge, but not an onground */
|
||||||
#define SOLID_BSP 4 /* bsp clip, touch on edge, block */
|
#define SOLID_BSP 4 /* bsp clip, touch on edge, block */
|
||||||
|
|
||||||
// items
|
// items
|
||||||
#define IT_AXE 4096
|
#define IT_AXE 4096
|
||||||
|
@ -99,7 +99,7 @@
|
||||||
#define CHAN_VOICE 2
|
#define CHAN_VOICE 2
|
||||||
#define CHAN_ITEM 3
|
#define CHAN_ITEM 3
|
||||||
#define CHAN_BODY 4
|
#define CHAN_BODY 4
|
||||||
#define CHAN_NO_PHS_ADD 8 /* ie: CHAN_BODY | CHAN_NO_PHS_ADD */
|
#define CHAN_NO_PHS_ADD 8 /* ie: CHAN_BODY | CHAN_NO_PHS_ADD */
|
||||||
|
|
||||||
#define ATTN_NONE 0
|
#define ATTN_NONE 0
|
||||||
#define ATTN_NORM 1
|
#define ATTN_NORM 1
|
||||||
|
@ -114,33 +114,33 @@
|
||||||
#define EF_FLAG1 16
|
#define EF_FLAG1 16
|
||||||
#define EF_FLAG2 32
|
#define EF_FLAG2 32
|
||||||
// GLQuakeWorld Stuff
|
// GLQuakeWorld Stuff
|
||||||
#define EF_BLUE 64 /* Blue Globe effect for Quad */
|
#define EF_BLUE 64 /* Blue Globe effect for Quad */
|
||||||
#define EF_RED 128 /* Red Globe effect for Pentagram */
|
#define EF_RED 128 /* Red Globe effect for Pentagram */
|
||||||
|
|
||||||
// messages
|
// messages
|
||||||
#define MSG_BROADCAST 0 /* unreliable to all */
|
#define MSG_BROADCAST 0 /* unreliable to all */
|
||||||
#define MSG_ONE 1 /* reliable to one (msg_entity) */
|
#define MSG_ONE 1 /* reliable to one (msg_entity) */
|
||||||
#define MSG_ALL 2 /* reliable to all */
|
#define MSG_ALL 2 /* reliable to all */
|
||||||
#define MSG_INIT 3 /* write to the init string */
|
#define MSG_INIT 3 /* write to the init string */
|
||||||
#define MSG_MULTICAST 4 /* for multicast() call */
|
#define MSG_MULTICAST 4 /* for multicast () call */
|
||||||
|
|
||||||
// message levels
|
// message levels
|
||||||
#define PRINT_LOW 0 /* pickup messages */
|
#define PRINT_LOW 0 /* pickup messages */
|
||||||
#define PRINT_MEDIUM 1
|
#define PRINT_MEDIUM 1
|
||||||
#define PRINT_DEATH 1 /* death messages */
|
#define PRINT_DEATH 1 /* death messages */
|
||||||
#define PRINT_HIGH 2 /* critical messages */
|
#define PRINT_HIGH 2 /* critical messages */
|
||||||
#define PRINT_CHAT 3 /* also goes to chat console */
|
#define PRINT_CHAT 3 /* also goes to chat console */
|
||||||
|
|
||||||
// multicast sets
|
// multicast sets
|
||||||
#define MULTICAST_ALL 0 /* every client */
|
#define MULTICAST_ALL 0 /* every client */
|
||||||
#define MULTICAST_PHS 1 /* within hearing */
|
#define MULTICAST_PHS 1 /* within hearing */
|
||||||
#define MULTICAST_PVS 2 /* within sight */
|
#define MULTICAST_PVS 2 /* within sight */
|
||||||
#define MULTICAST_ALL_R 3 /* every client, reliable */
|
#define MULTICAST_ALL_R 3 /* every client, reliable */
|
||||||
#define MULTICAST_PHS_R 4 /* within hearing, reliable */
|
#define MULTICAST_PHS_R 4 /* within hearing, reliable */
|
||||||
#define MULTICAST_PVS_R 5 /* within sight, reliable */
|
#define MULTICAST_PVS_R 5 /* within sight, reliable */
|
||||||
|
|
||||||
// ========================================================================== //
|
// ========================================================================= //
|
||||||
// ========================================================================== //
|
// ========================================================================= //
|
||||||
|
|
||||||
// takedamage values
|
// takedamage values
|
||||||
#define DAMAGE_NO 0
|
#define DAMAGE_NO 0
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
.float delay_time, delay_last_change;
|
.float delay_time, delay_last_change;
|
||||||
|
|
||||||
#define all_func(func) \
|
#define all_func(func) \
|
||||||
void() func##_all = { \
|
void () func##_all = { \
|
||||||
local entity oldself; \
|
local entity oldself; \
|
||||||
local float i; \
|
local float i; \
|
||||||
\
|
\
|
||||||
|
@ -22,19 +22,17 @@ void() func##_all = { \
|
||||||
\
|
\
|
||||||
self = world; \
|
self = world; \
|
||||||
for (i = 0; i < max_clients; i++) { \
|
for (i = 0; i < max_clients; i++) { \
|
||||||
self = nextent(self); \
|
self = nextent (self); \
|
||||||
\
|
\
|
||||||
if (!is_cl(self)) \
|
if (!is_cl (self)) \
|
||||||
continue; \
|
continue; \
|
||||||
\
|
\
|
||||||
func(); \
|
func (); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
self = oldself; \
|
self = oldself; \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define do_fields() \
|
#define do_fields() \
|
||||||
do_(health); \
|
do_(health); \
|
||||||
do_(armorvalue); \
|
do_(armorvalue); \
|
||||||
|
@ -44,29 +42,33 @@ void() func##_all = { \
|
||||||
do_(ammo_shells); \
|
do_(ammo_shells); \
|
||||||
do_(ammo_nails); \
|
do_(ammo_nails); \
|
||||||
do_(ammo_rockets); \
|
do_(ammo_rockets); \
|
||||||
do_(ammo_cells)
|
do_(ammo_cells);
|
||||||
|
|
||||||
void() delays_swapin_stats = {
|
void ()
|
||||||
|
delays_swapin_stats =
|
||||||
|
{
|
||||||
local float tmp;
|
local float tmp;
|
||||||
|
|
||||||
#define do_(field) \
|
#define do_(field) \
|
||||||
tmp = self.field; \
|
tmp = self.field; \
|
||||||
self.field = self.delay_##field; \
|
self.field = self.delay_##field; \
|
||||||
self.delay_##field = tmp
|
self.delay_##field = tmp;
|
||||||
|
|
||||||
do_fields();
|
do_fields ();
|
||||||
#undef do_
|
#undef do_
|
||||||
};
|
};
|
||||||
|
|
||||||
all_func(delays_swapin_stats);
|
all_func (delays_swapin_stats);
|
||||||
|
|
||||||
// ===================================================================== //
|
// ===================================================================== //
|
||||||
|
|
||||||
float() delays_changed = {
|
float ()
|
||||||
|
delays_changed =
|
||||||
|
{
|
||||||
#define do_(field) \
|
#define do_(field) \
|
||||||
if (floor(self.field) != floor(self.delay_##field)) \
|
if (floor (self.field) != floor (self.delay_##field)) \
|
||||||
return TRUE
|
return TRUE
|
||||||
do_fields();
|
do_fields ();
|
||||||
#undef do_
|
#undef do_
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -74,39 +76,47 @@ float() delays_changed = {
|
||||||
|
|
||||||
// ===================================================================== //
|
// ===================================================================== //
|
||||||
|
|
||||||
void() delays_force_update = {
|
void ()
|
||||||
|
delays_force_update =
|
||||||
|
{
|
||||||
self.delay_time = 0;
|
self.delay_time = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
all_func (delays_force_update);
|
||||||
all_func(delays_force_update);
|
|
||||||
|
|
||||||
// ===================================================================== //
|
// ===================================================================== //
|
||||||
|
|
||||||
void() delays_swapout_stats = {
|
void ()
|
||||||
if (delays_changed())
|
delays_swapout_stats =
|
||||||
|
{
|
||||||
|
if (delays_changed ())
|
||||||
self.delay_last_change = time;
|
self.delay_last_change = time;
|
||||||
|
|
||||||
self.delay_dmg_take += self.dmg_take; self.dmg_take = 0;
|
self.delay_dmg_take += self.dmg_take;
|
||||||
self.delay_dmg_save += self.dmg_save; self.dmg_save = 0;
|
self.dmg_take = 0;
|
||||||
|
self.delay_dmg_save += self.dmg_save;
|
||||||
|
self.dmg_save = 0;
|
||||||
|
|
||||||
if (time < self.delay_time) {
|
if (time < self.delay_time) {
|
||||||
delays_swapin_stats();
|
delays_swapin_stats ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define do_(field) self.delay_##field = self.field
|
#define do_(field) self.delay_##field = self.field
|
||||||
do_fields();
|
do_fields ();
|
||||||
#undef do_
|
#undef do_
|
||||||
|
|
||||||
self.dmg_take = ceil(self.delay_dmg_take); self.delay_dmg_take = 0;
|
self.dmg_take = ceil (self.delay_dmg_take);
|
||||||
if (self.dmg_take > 255) self.dmg_take = 255;
|
self.delay_dmg_take = 0;
|
||||||
|
if (self.dmg_take > 255)
|
||||||
|
self.dmg_take = 255;
|
||||||
|
|
||||||
self.dmg_save = ceil(self.delay_dmg_save); self.delay_dmg_save = 0;
|
self.dmg_save = ceil(self.delay_dmg_save); self.delay_dmg_save = 0;
|
||||||
if (self.dmg_save > 255) self.dmg_save = 255;
|
if (self.dmg_save > 255)
|
||||||
|
self.dmg_save = 255;
|
||||||
|
|
||||||
if ((self.delay_last_change - time) >= -CONFIG_STATS_DELAY)
|
if ((self.delay_last_change - time) >= -CONFIG_STATS_DELAY)
|
||||||
self.delay_time = time + CONFIG_STATS_DELAY;
|
self.delay_time = time + CONFIG_STATS_DELAY;
|
||||||
};
|
};
|
||||||
|
|
||||||
all_func(delays_swapout_stats);
|
all_func (delays_swapout_stats);
|
||||||
|
|
|
@ -2,16 +2,14 @@
|
||||||
#define DELAYS_qh 1
|
#define DELAYS_qh 1
|
||||||
|
|
||||||
@extern {
|
@extern {
|
||||||
|
void () delays_swapin_stats;
|
||||||
|
void () delays_swapout_stats;
|
||||||
|
|
||||||
void() delays_swapin_stats;
|
void () delays_force_update;
|
||||||
void() delays_swapout_stats;
|
|
||||||
|
|
||||||
void() delays_force_update;
|
|
||||||
|
|
||||||
void() delays_swapin_stats_all;
|
|
||||||
void() delays_swapout_stats_all;
|
|
||||||
void() delays_force_update_all;
|
|
||||||
|
|
||||||
|
void () delays_swapin_stats_all;
|
||||||
|
void () delays_swapout_stats_all;
|
||||||
|
void () delays_force_update_all;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,16 +2,14 @@
|
||||||
#define EFFECT_qh 1
|
#define EFFECT_qh 1
|
||||||
|
|
||||||
@extern {
|
@extern {
|
||||||
|
void () effect_muzzleflash;
|
||||||
void() effect_muzzleflash;
|
void (entity e) effect_smallkick;
|
||||||
void(entity e) effect_smallkick;
|
void (vector org, vector dir, float d) effect_blood;
|
||||||
void(vector org, vector dir, float d) effect_blood;
|
void (vector org, vector vel, float d) effect_gun_spark;
|
||||||
void(vector org, vector vel, float d) effect_gun_spark;
|
void (vector org, vector vel) effect_nail_spark;
|
||||||
void(vector org, vector vel) effect_nail_spark;
|
void (vector org) effect_explosion;
|
||||||
void(vector org) effect_explosion;
|
void (vector org) effect_teleport_fog;
|
||||||
void(vector org) effect_teleport_fog;
|
void (entity from, vector p1, vector p2) effect_lightning2;
|
||||||
void(entity from, vector p1, vector p2) effect_lightning2;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -10,7 +10,9 @@
|
||||||
.float itemfield_3;
|
.float itemfield_3;
|
||||||
.float itemfield_4;
|
.float itemfield_4;
|
||||||
|
|
||||||
float(entity e, float eid) equip_flag = {
|
float (entity e, float eid)
|
||||||
|
equip_flag =
|
||||||
|
{
|
||||||
if (eid < 24) {
|
if (eid < 24) {
|
||||||
e.itemfield = itemfield_1;
|
e.itemfield = itemfield_1;
|
||||||
} else if (eid < 48) {
|
} else if (eid < 48) {
|
||||||
|
@ -24,11 +26,13 @@ float(entity e, float eid) equip_flag = {
|
||||||
eid -= 72;
|
eid -= 72;
|
||||||
}
|
}
|
||||||
|
|
||||||
return shl(1, eid); /* FIXME: use (1 << eid) when the compiler isn't b0rk */
|
return (1 << eid);
|
||||||
};
|
};
|
||||||
|
|
||||||
float(entity e, float eid) equip_query = {
|
float (entity e, float eid)
|
||||||
eid = equip_flag(e, eid);
|
equip_query =
|
||||||
|
{
|
||||||
|
eid = equip_flag (e, eid);
|
||||||
|
|
||||||
if (e.(e.itemfield) & eid)
|
if (e.(e.itemfield) & eid)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -36,8 +40,10 @@ float(entity e, float eid) equip_query = {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
};
|
};
|
||||||
|
|
||||||
float(entity e, float eid) equip_grant = {
|
float (entity e, float eid)
|
||||||
eid = equip_flag(e, eid);
|
equip_grant =
|
||||||
|
{
|
||||||
|
eid = equip_flag (e, eid);
|
||||||
|
|
||||||
if (e.(e.itemfield) & eid)
|
if (e.(e.itemfield) & eid)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -47,8 +53,10 @@ float(entity e, float eid) equip_grant = {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
};
|
};
|
||||||
|
|
||||||
float(entity e, float eid) equip_remove = {
|
float (entity e, float eid)
|
||||||
eid = equip_flag(e, eid);
|
equip_remove =
|
||||||
|
{
|
||||||
|
eid = equip_flag (e, eid);
|
||||||
|
|
||||||
if (e.(e.itemfield) & eid) {
|
if (e.(e.itemfield) & eid) {
|
||||||
e.(e.itemfield) -= eid;
|
e.(e.itemfield) -= eid;
|
||||||
|
@ -60,7 +68,9 @@ float(entity e, float eid) equip_remove = {
|
||||||
|
|
||||||
float _equip_iter_id;
|
float _equip_iter_id;
|
||||||
/* Returns EQUIPID_* or -1 when done */
|
/* Returns EQUIPID_* or -1 when done */
|
||||||
float(entity iteme) equip_iter = {
|
float (entity iteme)
|
||||||
|
equip_iter =
|
||||||
|
{
|
||||||
local float ret, flag;
|
local float ret, flag;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
@ -69,7 +79,7 @@ float(entity iteme) equip_iter = {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
flag = equip_flag(iteme, _equip_iter_id);
|
flag = equip_flag (iteme, _equip_iter_id);
|
||||||
|
|
||||||
ret = _equip_iter_id;
|
ret = _equip_iter_id;
|
||||||
_equip_iter_id++;
|
_equip_iter_id++;
|
||||||
|
|
|
@ -4,28 +4,26 @@
|
||||||
#include "equipid.qh"
|
#include "equipid.qh"
|
||||||
|
|
||||||
@extern {
|
@extern {
|
||||||
|
#define EQUIP_STATE_CHOOSE 0
|
||||||
|
#define EQUIP_STATE_CHOSEN 1
|
||||||
|
|
||||||
#define EQUIP_STATE_CHOOSE 0
|
.float equip_state;
|
||||||
#define EQUIP_STATE_CHOSEN 1
|
|
||||||
|
|
||||||
.float equip_state;
|
..float itemfield;
|
||||||
|
.float itemfield_1;
|
||||||
|
.float itemfield_2;
|
||||||
|
.float itemfield_3;
|
||||||
|
.float itemfield_4;
|
||||||
|
|
||||||
..float itemfield;
|
float (entity e, float eid) equip_flag;
|
||||||
.float itemfield_1;
|
|
||||||
.float itemfield_2;
|
|
||||||
.float itemfield_3;
|
|
||||||
.float itemfield_4;
|
|
||||||
|
|
||||||
float(entity e, float eid) equip_flag;
|
float (entity e, float eid) equip_query;
|
||||||
|
float (entity e, float eid) equip_grant;
|
||||||
|
float (entity e, float eid) equip_remove;
|
||||||
|
|
||||||
float(entity e, float eid) equip_query;
|
float (entity iteme) equip_iter;
|
||||||
float(entity e, float eid) equip_grant;
|
|
||||||
float(entity e, float eid) equip_remove;
|
|
||||||
|
|
||||||
float(entity iteme) equip_iter;
|
|
||||||
|
|
||||||
string(float eid) equip_id_to_string;
|
|
||||||
|
|
||||||
|
string (float eid) equip_id_to_string;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
58
klik/math.qc
58
klik/math.qc
|
@ -2,20 +2,52 @@
|
||||||
#include "builtins.qh"
|
#include "builtins.qh"
|
||||||
|
|
||||||
/* Ugh. QuakeC doesn't include these ops. */
|
/* Ugh. QuakeC doesn't include these ops. */
|
||||||
float(float num, float bits) shl = {
|
float (float num, float bits)
|
||||||
if (bits >= 16) { num *= 65536; bits -= 16; }
|
shl =
|
||||||
if (bits >= 8) { num *= 256; bits -= 8; }
|
{
|
||||||
if (bits >= 4) { num *= 16; bits -= 4; }
|
if (bits >= 16) {
|
||||||
if (bits >= 2) { num *= 4; bits -= 2; }
|
num *= 65536;
|
||||||
if (bits >= 1) { num *= 2; }
|
bits -= 16;
|
||||||
|
}
|
||||||
|
if (bits >= 8) {
|
||||||
|
num *= 256;
|
||||||
|
bits -= 8;
|
||||||
|
}
|
||||||
|
if (bits >= 4) {
|
||||||
|
num *= 16;
|
||||||
|
bits -= 4;
|
||||||
|
}
|
||||||
|
if (bits >= 2) {
|
||||||
|
num *= 4;
|
||||||
|
bits -= 2;
|
||||||
|
}
|
||||||
|
if (bits >= 1) {
|
||||||
|
num *= 2;
|
||||||
|
}
|
||||||
return num;
|
return num;
|
||||||
};
|
};
|
||||||
|
|
||||||
float(float num, float bits) shr = {
|
float (float num, float bits)
|
||||||
if (bits >= 16) { num /= 65536; bits -= 16; }
|
shr =
|
||||||
if (bits >= 8) { num /= 256; bits -= 8; }
|
{
|
||||||
if (bits >= 4) { num /= 16; bits -= 4; }
|
if (bits >= 16) {
|
||||||
if (bits >= 2) { num /= 4; bits -= 2; }
|
num /= 65536;
|
||||||
if (bits >= 1) { num /= 2; }
|
bits -= 16;
|
||||||
return floor(num);
|
}
|
||||||
|
if (bits >= 8) {
|
||||||
|
num /= 256;
|
||||||
|
bits -= 8;
|
||||||
|
}
|
||||||
|
if (bits >= 4) {
|
||||||
|
num /= 16;
|
||||||
|
bits -= 4;
|
||||||
|
}
|
||||||
|
if (bits >= 2) {
|
||||||
|
num /= 4;
|
||||||
|
bits -= 2;
|
||||||
|
}
|
||||||
|
if (bits >= 1) {
|
||||||
|
num /= 2;
|
||||||
|
}
|
||||||
|
return floor (num);
|
||||||
};
|
};
|
||||||
|
|
10
klik/math.qh
10
klik/math.qh
|
@ -2,13 +2,11 @@
|
||||||
#define MATH_qh 1
|
#define MATH_qh 1
|
||||||
|
|
||||||
@extern {
|
@extern {
|
||||||
|
float (float num, float bits) shl;
|
||||||
|
float (float num, float bits) shr;
|
||||||
|
|
||||||
float(float num, float bits) shl;
|
#define min(a, b) ((a)>(b)?(b):(a))
|
||||||
float(float num, float bits) shr;
|
#define max(a, b) ((a)>(b)?(a):(b))
|
||||||
|
|
||||||
#define min(a, b) ((a)>(b)?(b):(a))
|
|
||||||
#define max(a, b) ((a)>(b)?(a):(b))
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
10
klik/menu.qc
10
klik/menu.qc
|
@ -3,15 +3,19 @@
|
||||||
|
|
||||||
.float menu_state;
|
.float menu_state;
|
||||||
.float menu_time;
|
.float menu_time;
|
||||||
.void() menu_think;
|
.void () menu_think;
|
||||||
|
|
||||||
void(void() menu_func) menu_set = {
|
void (void () menu_func)
|
||||||
|
menu_set =
|
||||||
|
{
|
||||||
self.menu_state = 0;
|
self.menu_state = 0;
|
||||||
self.menu_time = 0;
|
self.menu_time = 0;
|
||||||
self.menu_think = menu_func;
|
self.menu_think = menu_func;
|
||||||
};
|
};
|
||||||
|
|
||||||
float() util_menu_needs_print = {
|
float ()
|
||||||
|
util_menu_needs_print =
|
||||||
|
{
|
||||||
if (time > self.menu_time) {
|
if (time > self.menu_time) {
|
||||||
self.menu_time = time + 1.4;
|
self.menu_time = time + 1.4;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -5,9 +5,9 @@
|
||||||
|
|
||||||
@extern .float menu_state;
|
@extern .float menu_state;
|
||||||
@extern .float menu_time;
|
@extern .float menu_time;
|
||||||
@extern .void() menu_think;
|
@extern .void () menu_think;
|
||||||
|
|
||||||
@extern void(void() menu_func) menu_set;
|
@extern void (void() menu_func) menu_set;
|
||||||
@extern float() util_menu_needs_print;
|
@extern float () util_menu_needs_print;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -4,27 +4,29 @@
|
||||||
#include "misc.qh"
|
#include "misc.qh"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void() menu_team = {
|
void ()
|
||||||
if (team_ischosen(self))
|
menu_team =
|
||||||
menu_set(menu_equip);
|
{
|
||||||
|
if (team_ischosen (self))
|
||||||
|
menu_set (menu_equip);
|
||||||
|
|
||||||
if (util_menu_needs_print() && is_cl(self)) {
|
if (util_menu_needs_print () && is_cl (self)) {
|
||||||
centerprint(self,
|
centerprint (self,
|
||||||
"Team\n"
|
"Team\n"
|
||||||
"\<\-\-\-\-\>\n"
|
"\<\-\-\-\-\>\n"
|
||||||
"1\b.\b Red\n"
|
"1\b.\b Red\n"
|
||||||
"2\b.\b Blue\n"
|
"2\b.\b Blue\n"
|
||||||
"\n"
|
"\n"
|
||||||
"0\b.\b Auto\n"
|
"0\b.\b Auto\n");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.impulse == 1) {
|
if (self.impulse == 1) {
|
||||||
team_join(TEAM_RED);
|
team_join (TEAM_RED);
|
||||||
} else if (self.impulse == 2) {
|
} else if (self.impulse == 2) {
|
||||||
team_join(TEAM_BLUE);
|
team_join (TEAM_BLUE);
|
||||||
} else if (self.impulse == 10 || self.button0 || self.button1 || self.button2) {
|
} else if (self.impulse == 10 || self.button0 || self.button1
|
||||||
team_join_auto();
|
|| self.button2) {
|
||||||
|
team_join_auto ();
|
||||||
}
|
}
|
||||||
|
|
||||||
self.impulse = 0;
|
self.impulse = 0;
|
||||||
|
@ -36,20 +38,19 @@ void() menu_intro = {
|
||||||
if (!self.menu_state)
|
if (!self.menu_state)
|
||||||
self.menu_state = time + 3;
|
self.menu_state = time + 3;
|
||||||
else if (time >= self.menu_state) {
|
else if (time >= self.menu_state) {
|
||||||
if (is_cl(self))
|
if (is_cl (self))
|
||||||
centerprint(self, "");
|
centerprint (self, "");
|
||||||
PutClientInGame();
|
PutClientInGame ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (util_menu_needs_print()) {
|
if (util_menu_needs_print ()) {
|
||||||
if (is_cl(self))
|
if (is_cl (self))
|
||||||
centerprint(self,
|
centerprint (self,
|
||||||
"\[ This server is running Klik 0.0.7 \]\n"
|
"\[ This server is running Klik 0.0.7 \]\n"
|
||||||
"\[ by Zinx Verituse \]\n"
|
"\[ by Zinx Verituse \]\n"
|
||||||
"\[ http://staff.xmms.org/zinx/klik \]\n"
|
"\[ http://staff.xmms.org/zinx/klik \]\n"
|
||||||
"\n"
|
"\n"
|
||||||
"\<[ It's a Quake World. ]\>\n"
|
"\<[ It's a Quake World. ]\>\n");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#ifndef MENUS_qh
|
#ifndef MENUS_qh
|
||||||
#define MENUS_qh 1
|
#define MENUS_qh 1
|
||||||
|
|
||||||
@extern void() menu_intro;
|
@extern void () menu_intro;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
227
klik/misc.qc
227
klik/misc.qc
|
@ -9,10 +9,12 @@
|
||||||
|
|
||||||
// ===================================================================== //
|
// ===================================================================== //
|
||||||
|
|
||||||
entity(string clname) spawn = {
|
entity (string clname)
|
||||||
|
spawn =
|
||||||
|
{
|
||||||
local entity e;
|
local entity e;
|
||||||
|
|
||||||
e = BUILTIN_spawn();
|
e = BUILTIN_spawn ();
|
||||||
e.classname = clname;
|
e.classname = clname;
|
||||||
|
|
||||||
return e;
|
return e;
|
||||||
|
@ -20,9 +22,15 @@ entity(string clname) spawn = {
|
||||||
|
|
||||||
// ===================================================================== //
|
// ===================================================================== //
|
||||||
|
|
||||||
void() SUB_remove = { remove(self); };
|
void ()
|
||||||
|
SUB_remove =
|
||||||
|
{
|
||||||
|
remove (self);
|
||||||
|
};
|
||||||
|
|
||||||
void(entity e) safe_remove = {
|
void (entity e)
|
||||||
|
safe_remove =
|
||||||
|
{
|
||||||
e.takedamage = DAMAGE_NO;
|
e.takedamage = DAMAGE_NO;
|
||||||
e.solid = SOLID_NOT;
|
e.solid = SOLID_NOT;
|
||||||
e.model = NIL;
|
e.model = NIL;
|
||||||
|
@ -34,11 +42,17 @@ void(entity e) safe_remove = {
|
||||||
|
|
||||||
// ===================================================================== //
|
// ===================================================================== //
|
||||||
|
|
||||||
void() SUB_makestatic = { makestatic(self); };
|
void ()
|
||||||
|
SUB_makestatic =
|
||||||
|
{
|
||||||
|
makestatic (self);
|
||||||
|
};
|
||||||
|
|
||||||
void(entity e) safe_makestatic = {
|
void (entity e)
|
||||||
|
safe_makestatic =
|
||||||
|
{
|
||||||
if (sv_spawning) {
|
if (sv_spawning) {
|
||||||
makestatic(self);
|
makestatic (self);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,11 +65,16 @@ void(entity e) safe_makestatic = {
|
||||||
|
|
||||||
// ===================================================================== //
|
// ===================================================================== //
|
||||||
|
|
||||||
void() _sound_vector_think = {
|
void ()
|
||||||
sound(self, CHAN_VOICE, self.noise1, self.volume, self.attenuation);
|
_sound_vector_think =
|
||||||
remove(self);
|
{
|
||||||
|
sound (self, CHAN_VOICE, self.noise1, self.volume, self.attenuation);
|
||||||
|
remove (self);
|
||||||
};
|
};
|
||||||
void(vector org, string samp, float vol, float atten) sound_vector = {
|
|
||||||
|
void (vector org, string samp, float vol, float atten)
|
||||||
|
sound_vector =
|
||||||
|
{
|
||||||
local entity e;
|
local entity e;
|
||||||
|
|
||||||
e = spawn("SOUND");
|
e = spawn("SOUND");
|
||||||
|
@ -70,47 +89,60 @@ void(vector org, string samp, float vol, float atten) sound_vector = {
|
||||||
|
|
||||||
// ===================================================================== //
|
// ===================================================================== //
|
||||||
|
|
||||||
float(vector org) _missile_th_teleport = {
|
float (vector org)
|
||||||
|
_missile_th_teleport =
|
||||||
|
{
|
||||||
self.owner = world;
|
self.owner = world;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
};
|
};
|
||||||
|
|
||||||
void(entity mis) missile_check_teleport;
|
void (entity mis) missile_check_teleport;
|
||||||
void() _missile_always_trigger = {
|
|
||||||
|
void ()
|
||||||
|
_missile_always_trigger =
|
||||||
|
{
|
||||||
self.think = SUB_remove;
|
self.think = SUB_remove;
|
||||||
self.nextthink = self.attack_finished;
|
self.nextthink = self.attack_finished;
|
||||||
|
|
||||||
if (self.movetype != MOVETYPE_FLYMISSILE && self.movetype != MOVETYPE_FLY)
|
if ((self.movetype != MOVETYPE_FLYMISSILE)
|
||||||
|
&& (self.movetype != MOVETYPE_FLY))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tl_proj_begin();
|
tl_proj_begin ();
|
||||||
/* Make sure we're still going to hit the thing */
|
/* Make sure we're still going to hit the thing */
|
||||||
traceline(self.origin, self.origin + self.velocity * sv_maxtic*2, FALSE, self);
|
traceline (self.origin, self.origin + self.velocity * sv_maxtic * 2, FALSE,
|
||||||
if (trace_ent == self.enemy) tl_touch(trace_ent, self);
|
self);
|
||||||
else self.enemy = world;
|
if (trace_ent == self.enemy)
|
||||||
tl_proj_end();
|
tl_touch (trace_ent, self);
|
||||||
|
else
|
||||||
|
self.enemy = world;
|
||||||
|
tl_proj_end ();
|
||||||
|
|
||||||
missile_check_teleport(self);
|
missile_check_teleport (self);
|
||||||
};
|
};
|
||||||
|
|
||||||
void(entity mis) missile_check_teleport = {
|
void (entity mis)
|
||||||
|
missile_check_teleport =
|
||||||
|
{
|
||||||
local float duration;
|
local float duration;
|
||||||
|
|
||||||
tl_proj_begin();
|
tl_proj_begin ();
|
||||||
|
|
||||||
trace_ent = mis;
|
trace_ent = mis;
|
||||||
trace_endpos = mis.origin;
|
trace_endpos = mis.origin;
|
||||||
duration = mis.attack_finished - time;
|
duration = mis.attack_finished - time;
|
||||||
|
|
||||||
while (duration > sv_maxtic) {
|
while (duration > sv_maxtic) {
|
||||||
traceline(trace_endpos, trace_endpos + mis.velocity*duration, FALSE, trace_ent);
|
traceline (trace_endpos, trace_endpos + mis.velocity * duration,
|
||||||
|
FALSE, trace_ent);
|
||||||
|
|
||||||
if (!trace_ent || trace_ent.solid == SOLID_BSP) {
|
if (!trace_ent || trace_ent.solid == SOLID_BSP) {
|
||||||
/* Don't bother tracing through BSP, it won't happen. */
|
/* Don't bother tracing through BSP, it won't happen. */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tl_issolid(trace_ent) || mis.enemy == trace_ent || (duration*trace_fraction) <= sv_maxtic) {
|
if (tl_issolid (trace_ent) || mis.enemy == trace_ent
|
||||||
|
|| (duration * trace_fraction) <= sv_maxtic) {
|
||||||
/* We hit a triggered trigger,
|
/* We hit a triggered trigger,
|
||||||
a solid ent, or something we _just_ hit */
|
a solid ent, or something we _just_ hit */
|
||||||
if (trace_fraction == 0) {
|
if (trace_fraction == 0) {
|
||||||
|
@ -118,22 +150,24 @@ void(entity mis) missile_check_teleport = {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* Trace on past it. */
|
/* Trace on past it. */
|
||||||
duration -= duration*trace_fraction;
|
duration -= duration * trace_fraction;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reached a [new] trigger */
|
/* Reached a [new] trigger */
|
||||||
mis.enemy = trace_ent;
|
mis.enemy = trace_ent;
|
||||||
mis.think = _missile_always_trigger;
|
mis.think = _missile_always_trigger;
|
||||||
mis.nextthink = time + duration*trace_fraction - sv_maxtic;
|
mis.nextthink = time + duration * trace_fraction - sv_maxtic;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
tl_proj_end();
|
tl_proj_end ();
|
||||||
};
|
};
|
||||||
|
|
||||||
entity(string clname, string mod, vector org, vector dir, float spd) spawn_missile = {
|
entity (string clname, string mod, vector org, vector dir, float spd)
|
||||||
newmis = spawn(clname);
|
spawn_missile =
|
||||||
|
{
|
||||||
|
newmis = spawn (clname);
|
||||||
|
|
||||||
newmis.owner = self;
|
newmis.owner = self;
|
||||||
newmis.goalentity = self;
|
newmis.goalentity = self;
|
||||||
|
@ -144,11 +178,11 @@ entity(string clname, string mod, vector org, vector dir, float spd) spawn_missi
|
||||||
|
|
||||||
newmis.th_teleport = _missile_th_teleport;
|
newmis.th_teleport = _missile_th_teleport;
|
||||||
|
|
||||||
setmodel(newmis, mod);
|
setmodel (newmis, mod);
|
||||||
setsize(newmis, '0 0 0', '0 0 0');
|
setsize (newmis, '0 0 0', '0 0 0');
|
||||||
setorigin(newmis, org);
|
setorigin (newmis, org);
|
||||||
|
|
||||||
newmis.angles = vectoangles(dir);
|
newmis.angles = vectoangles (dir);
|
||||||
newmis.speed = spd;
|
newmis.speed = spd;
|
||||||
newmis.velocity = dir * spd;
|
newmis.velocity = dir * spd;
|
||||||
|
|
||||||
|
@ -157,7 +191,7 @@ entity(string clname, string mod, vector org, vector dir, float spd) spawn_missi
|
||||||
newmis.think = SUB_remove;
|
newmis.think = SUB_remove;
|
||||||
newmis.nextthink = newmis.attack_finished;
|
newmis.nextthink = newmis.attack_finished;
|
||||||
|
|
||||||
missile_check_teleport(newmis);
|
missile_check_teleport (newmis);
|
||||||
|
|
||||||
return newmis;
|
return newmis;
|
||||||
};
|
};
|
||||||
|
@ -166,11 +200,13 @@ entity(string clname, string mod, vector org, vector dir, float spd) spawn_missi
|
||||||
|
|
||||||
entity tl_first;
|
entity tl_first;
|
||||||
.entity tl_next;
|
.entity tl_next;
|
||||||
void() tl_proj_begin = {
|
void ()
|
||||||
|
tl_proj_begin =
|
||||||
|
{
|
||||||
local entity walk;
|
local entity walk;
|
||||||
|
|
||||||
tl_first = world;
|
tl_first = world;
|
||||||
for (walk = nextent(world); walk; walk = nextent(walk)) {
|
for (walk = nextent (world); walk; walk = nextent (walk)) {
|
||||||
if (walk.solid != SOLID_TRIGGER)
|
if (walk.solid != SOLID_TRIGGER)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -179,27 +215,31 @@ void() tl_proj_begin = {
|
||||||
|
|
||||||
walk.solid = SOLID_BBOX;
|
walk.solid = SOLID_BBOX;
|
||||||
walk.tl_notsolid = TRUE;
|
walk.tl_notsolid = TRUE;
|
||||||
setorigin(walk, walk.origin); // relink
|
setorigin (walk, walk.origin); // relink
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void() tl_proj_end = {
|
void ()
|
||||||
|
tl_proj_end =
|
||||||
|
{
|
||||||
local entity walk;
|
local entity walk;
|
||||||
|
|
||||||
for (walk = tl_first; walk; walk = walk.tl_next) {
|
for (walk = tl_first; walk; walk = walk.tl_next) {
|
||||||
walk.solid = SOLID_TRIGGER;
|
walk.solid = SOLID_TRIGGER;
|
||||||
walk.tl_notsolid = FALSE;
|
walk.tl_notsolid = FALSE;
|
||||||
setorigin(walk, walk.origin); // relink
|
setorigin (walk, walk.origin); // relink
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void(entity trigger, entity fake_proj) tl_touch = {
|
void (entity trigger, entity fake_proj)
|
||||||
|
tl_touch =
|
||||||
|
{
|
||||||
local entity oldself, oldother;
|
local entity oldself, oldother;
|
||||||
|
|
||||||
if (!trigger.touch)
|
if (!trigger.touch)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tl_proj_end();
|
tl_proj_end ();
|
||||||
|
|
||||||
oldself = self;
|
oldself = self;
|
||||||
oldother = other;
|
oldother = other;
|
||||||
|
@ -207,19 +247,23 @@ void(entity trigger, entity fake_proj) tl_touch = {
|
||||||
self = trigger;
|
self = trigger;
|
||||||
other = fake_proj;
|
other = fake_proj;
|
||||||
|
|
||||||
self.touch();
|
self.touch ();
|
||||||
|
|
||||||
self = oldself;
|
self = oldself;
|
||||||
other = oldother;
|
other = oldother;
|
||||||
|
|
||||||
tl_proj_begin();
|
tl_proj_begin ();
|
||||||
};
|
};
|
||||||
|
|
||||||
// ===================================================================== //
|
// ===================================================================== //
|
||||||
|
|
||||||
string(entity e) name = {
|
string (entity e)
|
||||||
if (e.netname) return e.netname;
|
name =
|
||||||
if (e.classname) return e.classname;
|
{
|
||||||
|
if (e.netname)
|
||||||
|
return e.netname;
|
||||||
|
if (e.classname)
|
||||||
|
return e.classname;
|
||||||
|
|
||||||
if (e.velocity)
|
if (e.velocity)
|
||||||
return "an unidentified flying object";
|
return "an unidentified flying object";
|
||||||
|
@ -228,33 +272,39 @@ string(entity e) name = {
|
||||||
|
|
||||||
// ===================================================================== //
|
// ===================================================================== //
|
||||||
|
|
||||||
void(.string fld, string match, void(entity e) func) foreach = {
|
void (.string fld, string match, void (entity e) func)
|
||||||
|
foreach =
|
||||||
|
{
|
||||||
local entity ent;
|
local entity ent;
|
||||||
|
|
||||||
ent = world;
|
ent = world;
|
||||||
while ((ent = find(ent, fld, match))) {
|
while ((ent = find (ent, fld, match))) {
|
||||||
if (!func) {
|
if (!func) {
|
||||||
dprint("NULL function in foreach, classname: ", ent.classname, "\n");
|
dprint ("NULL function in foreach, classname: ", ent.classname,
|
||||||
|
"\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
func(ent);
|
func (ent);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void(.string fld, string match, .void() func) foreach_field = {
|
void (.string fld, string match, .void () func)
|
||||||
|
foreach_field =
|
||||||
|
{
|
||||||
local entity oldself;
|
local entity oldself;
|
||||||
|
|
||||||
oldself = self;
|
oldself = self;
|
||||||
|
|
||||||
self = world;
|
self = world;
|
||||||
while ((self = find(self, fld, match))) {
|
while ((self = find (self, fld, match))) {
|
||||||
if (!self.func) {
|
if (!self.func) {
|
||||||
dprint("NULL function in foreach_field, classname: ", self.classname, "\n");
|
dprint ("NULL function in foreach_field, classname: ",
|
||||||
|
self.classname, "\n");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.func();
|
self.func ();
|
||||||
}
|
}
|
||||||
|
|
||||||
self = oldself;
|
self = oldself;
|
||||||
|
@ -262,7 +312,8 @@ void(.string fld, string match, .void() func) foreach_field = {
|
||||||
|
|
||||||
// ===================================================================== //
|
// ===================================================================== //
|
||||||
|
|
||||||
float(entity newself, entity newother, float() func) switcheroo = {
|
float (entity newself, entity newother, float () func)
|
||||||
|
switcheroo = {
|
||||||
local entity oldself, oldother;
|
local entity oldself, oldother;
|
||||||
local float ret;
|
local float ret;
|
||||||
|
|
||||||
|
@ -272,7 +323,7 @@ float(entity newself, entity newother, float() func) switcheroo = {
|
||||||
self = newself;
|
self = newself;
|
||||||
other = newother;
|
other = newother;
|
||||||
|
|
||||||
ret = func();
|
ret = func ();
|
||||||
|
|
||||||
self = oldself;
|
self = oldself;
|
||||||
other = oldother;
|
other = oldother;
|
||||||
|
@ -282,19 +333,25 @@ float(entity newself, entity newother, float() func) switcheroo = {
|
||||||
|
|
||||||
// ===================================================================== //
|
// ===================================================================== //
|
||||||
|
|
||||||
float(float current, float increment, float max) increase_bound = {
|
float (float current, float increment, float max)
|
||||||
|
increase_bound =
|
||||||
|
{
|
||||||
local float diff;
|
local float diff;
|
||||||
|
|
||||||
diff = max - current;
|
diff = max - current;
|
||||||
if (diff <= 0) return current;
|
if (diff <= 0)
|
||||||
if (diff > increment) diff = increment;
|
return current;
|
||||||
|
if (diff > increment)
|
||||||
|
diff = increment;
|
||||||
return current + diff;
|
return current + diff;
|
||||||
};
|
};
|
||||||
|
|
||||||
float(.float fld, float increment, float max) increase_field = {
|
float (.float fld, float increment, float max)
|
||||||
|
increase_field =
|
||||||
|
{
|
||||||
local float new;
|
local float new;
|
||||||
|
|
||||||
new = increase_bound(self.fld, increment, max);
|
new = increase_bound (self.fld, increment, max);
|
||||||
if (new == self.fld)
|
if (new == self.fld)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -306,7 +363,9 @@ float(.float fld, float increment, float max) increase_field = {
|
||||||
// ===================================================================== //
|
// ===================================================================== //
|
||||||
|
|
||||||
/* Not to be confused with maxspeed */
|
/* Not to be confused with maxspeed */
|
||||||
float(entity e) calc_max_speed = {
|
float (entity e)
|
||||||
|
calc_max_speed =
|
||||||
|
{
|
||||||
local float spd;
|
local float spd;
|
||||||
|
|
||||||
spd = e.maxspeed;
|
spd = e.maxspeed;
|
||||||
|
@ -325,41 +384,48 @@ float(entity e) calc_max_speed = {
|
||||||
|
|
||||||
entity _xprint_client;
|
entity _xprint_client;
|
||||||
float _xprint_level;
|
float _xprint_level;
|
||||||
void(entity client, float level) xprint_start = {
|
void (entity client, float level)
|
||||||
|
xprint_start =
|
||||||
|
{
|
||||||
_xprint_client = client;
|
_xprint_client = client;
|
||||||
_xprint_level = level;
|
_xprint_level = level;
|
||||||
};
|
};
|
||||||
|
|
||||||
void(string str) xprint_str = {
|
void (string str)
|
||||||
|
xprint_str =
|
||||||
|
{
|
||||||
msg_entity = _xprint_client;
|
msg_entity = _xprint_client;
|
||||||
WriteByte(MSG_ONE, SVC_PRINT);
|
WriteBytes (MSG_ONE, (float) SVC_PRINT, _xprint_level);
|
||||||
WriteByte(MSG_ONE, _xprint_level);
|
WriteString (MSG_ONE, str);
|
||||||
WriteString(MSG_ONE, str);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// ===================================================================== //
|
// ===================================================================== //
|
||||||
|
|
||||||
entity(.string fld, string str) find_random = {
|
entity (.string fld, string str)
|
||||||
|
find_random =
|
||||||
|
{
|
||||||
local float r, numents;
|
local float r, numents;
|
||||||
local entity ent;
|
local entity ent;
|
||||||
|
|
||||||
numents = 0;
|
numents = 0;
|
||||||
r = floor(random() * 512);
|
r = floor (random () * 512);
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
ent = find(world, fld, str);
|
ent = find (world, fld, str);
|
||||||
if (!ent) return world;
|
if (!ent)
|
||||||
|
return world;
|
||||||
|
|
||||||
while (ent) {
|
while (ent) {
|
||||||
numents++;
|
numents++;
|
||||||
|
|
||||||
r--;
|
r--;
|
||||||
if (r <= 0) return ent;
|
if (r <= 0)
|
||||||
|
return ent;
|
||||||
|
|
||||||
ent = find(ent, fld, str);
|
ent = find (ent, fld, str);
|
||||||
}
|
}
|
||||||
|
|
||||||
r -= numents * floor(r / numents);
|
r -= numents * floor (r / numents);
|
||||||
}
|
}
|
||||||
|
|
||||||
return world;
|
return world;
|
||||||
|
@ -367,11 +433,13 @@ entity(.string fld, string str) find_random = {
|
||||||
|
|
||||||
// ===================================================================== //
|
// ===================================================================== //
|
||||||
|
|
||||||
entity(entity ech) random_enemy_chain = {
|
entity (entity ech)
|
||||||
|
random_enemy_chain =
|
||||||
|
{
|
||||||
local entity walk;
|
local entity walk;
|
||||||
local float tot, r;
|
local float tot, r;
|
||||||
|
|
||||||
r = floor(random()*64) + 1;
|
r = floor (random () * 64) + 1;
|
||||||
|
|
||||||
tot = 1;
|
tot = 1;
|
||||||
for (walk = ech.enemy; walk != ech; walk = walk.enemy) {
|
for (walk = ech.enemy; walk != ech; walk = walk.enemy) {
|
||||||
|
@ -386,7 +454,7 @@ entity(entity ech) random_enemy_chain = {
|
||||||
return ech;
|
return ech;
|
||||||
|
|
||||||
/* Ok, only look at half the remaining ones */
|
/* Ok, only look at half the remaining ones */
|
||||||
tot = floor(tot * 0.5);
|
tot = floor (tot * 0.5);
|
||||||
if (!tot)
|
if (!tot)
|
||||||
return ech.enemy;
|
return ech.enemy;
|
||||||
|
|
||||||
|
@ -401,6 +469,3 @@ entity(entity ech) random_enemy_chain = {
|
||||||
|
|
||||||
return world;
|
return world;
|
||||||
};
|
};
|
||||||
|
|
||||||
// ===================================================================== //
|
|
||||||
|
|
||||||
|
|
86
klik/misc.qh
86
klik/misc.qh
|
@ -4,70 +4,68 @@
|
||||||
/* Random miscellaneous functions */
|
/* Random miscellaneous functions */
|
||||||
|
|
||||||
@extern {
|
@extern {
|
||||||
|
entity (string clname) spawn;
|
||||||
|
|
||||||
entity(string clname) spawn;
|
string (entity e) name; /* Returns the pretty entity name */
|
||||||
|
|
||||||
string(entity e) name; /* Returns the pretty entity name */
|
#define crandom() (2.0 * (random () - 0.5))
|
||||||
|
|
||||||
#define crandom() (2.0*(random() - 0.5))
|
void (entity e) makestatic;
|
||||||
|
void (vector pos, string samp, float vol, float atten) ambientsound;
|
||||||
|
|
||||||
void(entity e) makestatic;
|
void () SUB_remove;
|
||||||
void(vector pos, string samp, float vol, float atten) ambientsound;
|
void (entity e) safe_remove;
|
||||||
|
|
||||||
void() SUB_remove;
|
void () SUB_makestatic;
|
||||||
void(entity e) safe_remove;
|
void (entity e) safe_makestatic;
|
||||||
|
|
||||||
void() SUB_makestatic;
|
void (vector org, string samp, float vol, float atten) sound_vector;
|
||||||
void(entity e) safe_makestatic;
|
entity (string clname, string mod, vector org, vector dir, float speed) spawn_missile;
|
||||||
|
|
||||||
void(vector org, string samp, float vol, float atten) sound_vector;
|
/* :) */
|
||||||
entity(string clname, string mod, vector org, vector dir, float speed) spawn_missile;
|
void (.string fld, string match, void (entity e) func) foreach;
|
||||||
|
void (.string fld, string match, .void () func) foreach_field;
|
||||||
|
|
||||||
/* :) */
|
/* swaps self/other temporarily */
|
||||||
void(.string fld, string match, void(entity e) func) foreach;
|
float (entity newself, entity newother, float() func) switcheroo;
|
||||||
void(.string fld, string match, .void() func) foreach_field;
|
|
||||||
|
|
||||||
/* swaps self/other temporarily */
|
/* Returns new value */
|
||||||
float(entity newself, entity newother, float() func) switcheroo;
|
float (float current, float increment, float max) increase_bound;
|
||||||
|
|
||||||
/* Returns new value */
|
/* Returns FALSE if not increased */
|
||||||
float(float current, float increment, float max) increase_bound;
|
float (.float fld, float increment, float max) increase_field;
|
||||||
|
|
||||||
/* Returns FALSE if not increased */
|
/* Calculate the player's current maximum speed, taking water/air in to account */
|
||||||
float(.float fld, float increment, float max) increase_field;
|
float (entity e) calc_max_speed;
|
||||||
|
|
||||||
/* Calculate the player's current maximum speed, taking water/air in to account */
|
/* sprint one string at a time, and get them all to the destination */
|
||||||
float(entity e) calc_max_speed;
|
void (entity client, float level) xprint_start;
|
||||||
|
void (string str) xprint_str;
|
||||||
|
|
||||||
/* sprint one string at a time, and get them all to the destination */
|
#define is_activeplayer(e) (e.flags & FL_CLIENT)
|
||||||
void(entity client, float level) xprint_start;
|
|
||||||
void(string str) xprint_str;
|
|
||||||
|
|
||||||
#define is_activeplayer(e) (e.flags & FL_CLIENT)
|
#define is_cl(e) (e.flags & FL_CLIENT)
|
||||||
|
#define is_autothink(e) (e.flags & FL_AUTOTHINK)
|
||||||
|
|
||||||
#define is_cl(e) (e.flags & FL_CLIENT)
|
/* Return a random entity that matches, or world */
|
||||||
#define is_autothink(e) (e.flags & FL_AUTOTHINK)
|
entity (.string fld, string str) find_random;
|
||||||
|
|
||||||
/* Return a random entity that matches, or world */
|
/* Return something from the .enemy chain */
|
||||||
entity(.string fld, string str) find_random;
|
entity (entity ech) random_enemy_chain;
|
||||||
|
|
||||||
/* Return something from the .enemy chain */
|
#define vieworigin(e) (e.origin + e.view_ofs)
|
||||||
entity(entity ech) random_enemy_chain;
|
#define center(e) ((e.absmin + e.absmax) * 0.5)
|
||||||
|
|
||||||
#define vieworigin(e) (e.origin + e.view_ofs)
|
/* FIXME: Make this an mdl func? */
|
||||||
#define center(e) ((e.absmin + e.absmax) * 0.5)
|
#define shootorigin(e) (vieworigin(e) - '0 0 6')
|
||||||
|
|
||||||
/* FIXME: Make this an mdl func? */
|
/* Stuff for traceline "projectiles" to hit triggers like normal projectiles */
|
||||||
#define shootorigin(e) (vieworigin(e) - '0 0 6')
|
void () tl_proj_begin;
|
||||||
|
void () tl_proj_end;
|
||||||
/* Stuff for traceline "projectiles" to hit triggers like normal projectiles */
|
void (entity trigger, entity fake_proj) tl_touch;
|
||||||
void() tl_proj_begin;
|
|
||||||
void() tl_proj_end;
|
|
||||||
void(entity trigger, entity fake_proj) tl_touch;
|
|
||||||
|
|
||||||
.float tl_notsolid;
|
|
||||||
#define tl_issolid(ent) (!ent.tl_notsolid)
|
|
||||||
|
|
||||||
|
.float tl_notsolid;
|
||||||
|
#define tl_issolid(ent) (!ent.tl_notsolid)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
103
klik/override.qc
103
klik/override.qc
|
@ -16,32 +16,32 @@
|
||||||
|
|
||||||
/* Let's make my life simpler when I add new ones, mmmkay? */
|
/* Let's make my life simpler when I add new ones, mmmkay? */
|
||||||
#define all_funcs() \
|
#define all_funcs() \
|
||||||
one_func(float(), f_v, th_takeitem, (), return, FALSE); \
|
one_func(float (), f_v, th_takeitem, (), return, FALSE); \
|
||||||
\
|
\
|
||||||
one_func(void(entity missile), v_e, th_attack, (missile), , ); \
|
one_func(void (entity missile), v_e, th_attack, (missile), , ); \
|
||||||
\
|
\
|
||||||
one_func(float(float dmg), f_f, th_takedamage, (dmg), return, FALSE); \
|
one_func(float (float dmg), f_f, th_takedamage, (dmg), return, FALSE); \
|
||||||
one_func(float(float dmg), f_f, th_dealdamage, (dmg), return, dmg); \
|
one_func(float (float dmg), f_f, th_dealdamage, (dmg), return, dmg); \
|
||||||
\
|
\
|
||||||
one_func(void(), v_v, th_die, (), , ); \
|
one_func(void (), v_v, th_die, (), , ); \
|
||||||
one_func(void(), v_v, th_kill, (), , ); \
|
one_func(void (), v_v, th_kill, (), , ); \
|
||||||
\
|
\
|
||||||
one_func(void(), v_v, prethink, (), , ); \
|
one_func(void (), v_v, prethink, (), , ); \
|
||||||
one_func(void(), v_v, actthink, (), , ); \
|
one_func(void (), v_v, actthink, (), , ); \
|
||||||
one_func(void(), v_v, postthink, (), , ); \
|
one_func(void (), v_v, postthink, (), , ); \
|
||||||
\
|
\
|
||||||
one_func(float(vector org), f_c, th_teleport, (org), return, TRUE); \
|
one_func(float (vector org), f_c, th_teleport, (org), return, TRUE); \
|
||||||
\
|
\
|
||||||
one_func(float(entity missile), f_e, th_projectile, (missile), return, TRUE)
|
one_func(float (entity missile), f_e, th_projectile, (missile), return, TRUE)
|
||||||
|
|
||||||
|
|
||||||
#define all_types() \
|
#define all_types() \
|
||||||
one_type(void(), v_v); \
|
one_type (void (), v_v); \
|
||||||
one_type(float(), f_v); \
|
one_type (float (), f_v); \
|
||||||
one_type(void(entity ent), v_e); \
|
one_type (void (entity ent), v_e); \
|
||||||
one_type(float(float flt), f_f); \
|
one_type (float (float flt), f_f); \
|
||||||
one_type(float(vector vec), f_c); \
|
one_type (float (vector vec), f_c); \
|
||||||
one_type(float(entity ent), f_e)
|
one_type (float (entity ent), f_e)
|
||||||
|
|
||||||
// ===================================================================== //
|
// ===================================================================== //
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@
|
||||||
#define one_func(type1,type2,func,args,return,val) \
|
#define one_func(type1,type2,func,args,return,val) \
|
||||||
type1 _passthru_##func = { \
|
type1 _passthru_##func = { \
|
||||||
local entity ovr; \
|
local entity ovr; \
|
||||||
ovr = override_findself(); \
|
ovr = override_findself (); \
|
||||||
if (ovr.func) \
|
if (ovr.func) \
|
||||||
return ovr.func args; \
|
return ovr.func args; \
|
||||||
return val; \
|
return val; \
|
||||||
|
@ -61,45 +61,49 @@ all_funcs();
|
||||||
|
|
||||||
/* for the override_set_FUNCTION macros in override.qh */
|
/* for the override_set_FUNCTION macros in override.qh */
|
||||||
#define one_type(type1,type2) \
|
#define one_type(type1,type2) \
|
||||||
void(entity e, .type1 fld, type1 func) override_set_##type2 = {\
|
void(entity e, .type1 fld, type1 func) override_set_##type2 = { \
|
||||||
if (e.overrider) \
|
if (e.overrider) \
|
||||||
e.overrider.fld = func; \
|
e.overrider.fld = func; \
|
||||||
else \
|
else \
|
||||||
e.fld = func; \
|
e.fld = func; \
|
||||||
}
|
}
|
||||||
|
|
||||||
all_types();
|
all_types ();
|
||||||
|
|
||||||
#undef one_type
|
#undef one_type
|
||||||
|
|
||||||
// ===================================================================== //
|
// ===================================================================== //
|
||||||
|
|
||||||
void(entity e1, entity e2) _override_swap = {
|
void (entity e1, entity e2)
|
||||||
|
_override_swap =
|
||||||
|
{
|
||||||
#define one_type(type1,type2) local type1 t_##type2
|
#define one_type(type1,type2) local type1 t_##type2
|
||||||
all_types();
|
all_types();
|
||||||
#undef one_type
|
#undef one_type
|
||||||
|
|
||||||
/* Swap all the functions */
|
/* Swap all the functions */
|
||||||
#define one_func(type1,type2,func,args,return,val) \
|
#define one_func(type1,type2,func,args,return,val) \
|
||||||
t_##type2 = e1.func; \
|
t_##type2 = e1.func; \
|
||||||
e1.func = e2.func; \
|
e1.func = e2.func; \
|
||||||
e2.func = t_##type2
|
e2.func = t_##type2
|
||||||
|
|
||||||
all_funcs();
|
all_funcs();
|
||||||
|
|
||||||
#undef one_func
|
#undef one_func
|
||||||
};
|
};
|
||||||
|
|
||||||
// ===================================================================== //
|
// ===================================================================== //
|
||||||
|
|
||||||
entity(entity e, string override_class, float priority) override_create = {
|
entity (entity e, string override_class, float priority)
|
||||||
|
override_create =
|
||||||
|
{
|
||||||
local entity ovr, ovr2;
|
local entity ovr, ovr2;
|
||||||
|
|
||||||
for (ovr = e.overrider; ovr; ovr = ovr.overrider) {
|
for (ovr = e.overrider; ovr; ovr = ovr.overrider) {
|
||||||
if (ovr.classname == override_class) {
|
if (ovr.classname == override_class) {
|
||||||
ovr2 = ovr.overrider;
|
ovr2 = ovr.overrider;
|
||||||
if (!ovr2) ovr2 = e;
|
if (!ovr2)
|
||||||
_override_swap(ovr, ovr2);
|
ovr2 = e;
|
||||||
|
_override_swap (ovr, ovr2);
|
||||||
return ovr;
|
return ovr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,9 +118,11 @@ entity(entity e, string override_class, float priority) override_create = {
|
||||||
ovr.overrider = spawn(override_class);
|
ovr.overrider = spawn(override_class);
|
||||||
ovr.overrider.owner = ovr;
|
ovr.overrider.owner = ovr;
|
||||||
ovr.overrider.overrider = ovr2;
|
ovr.overrider.overrider = ovr2;
|
||||||
if (ovr2) ovr2.owner = ovr.overrider;
|
|
||||||
|
|
||||||
if (!ovr2) ovr2 = e;
|
if (ovr2)
|
||||||
|
ovr2.owner = ovr.overrider;
|
||||||
|
if (!ovr2)
|
||||||
|
ovr2 = e;
|
||||||
|
|
||||||
ovr = ovr.overrider;
|
ovr = ovr.overrider;
|
||||||
ovr.overrider_priority = priority;
|
ovr.overrider_priority = priority;
|
||||||
|
@ -124,26 +130,30 @@ entity(entity e, string override_class, float priority) override_create = {
|
||||||
|
|
||||||
/* Set default passthru funcs for ovr */
|
/* Set default passthru funcs for ovr */
|
||||||
#define one_func(type1,type2,func,args,return,val) \
|
#define one_func(type1,type2,func,args,return,val) \
|
||||||
ovr.func = _passthru_##func
|
ovr.func = _passthru_##func
|
||||||
|
|
||||||
all_funcs();
|
|
||||||
|
|
||||||
|
all_funcs ();
|
||||||
#undef one_func
|
#undef one_func
|
||||||
|
|
||||||
return ovr;
|
return ovr;
|
||||||
};
|
};
|
||||||
|
|
||||||
void(entity ovr) override_finalize = {
|
void (entity ovr)
|
||||||
_override_swap(ovr, ovr.goalentity);
|
override_finalize =
|
||||||
|
{
|
||||||
|
_override_swap (ovr, ovr.goalentity);
|
||||||
};
|
};
|
||||||
|
|
||||||
entity() override_findself = {
|
entity ()
|
||||||
|
override_findself =
|
||||||
|
{
|
||||||
local entity ovrself;
|
local entity ovrself;
|
||||||
|
|
||||||
ovrself = self.overrider_self;
|
ovrself = self.overrider_self;
|
||||||
if (!ovrself) {
|
if (!ovrself) {
|
||||||
/* Move to the end of the list */
|
/* Move to the end of the list */
|
||||||
for (ovrself = self.overrider; ovrself.overrider; ovrself = ovrself.overrider) ;
|
for (ovrself = self.overrider; ovrself.overrider;
|
||||||
|
ovrself = ovrself.overrider);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.overrider_self = ovrself.owner;
|
self.overrider_self = ovrself.owner;
|
||||||
|
@ -153,25 +163,30 @@ entity() override_findself = {
|
||||||
return ovrself;
|
return ovrself;
|
||||||
};
|
};
|
||||||
|
|
||||||
void() override_halt = {
|
void ()
|
||||||
|
override_halt =
|
||||||
|
{
|
||||||
self.overrider_self = world;
|
self.overrider_self = world;
|
||||||
};
|
};
|
||||||
|
|
||||||
void(entity e, entity ovr) override_destroy = {
|
void (entity e, entity ovr)
|
||||||
|
override_destroy =
|
||||||
|
{
|
||||||
local entity ovr2;
|
local entity ovr2;
|
||||||
|
|
||||||
ovr2 = ovr.overrider;
|
ovr2 = ovr.overrider;
|
||||||
if (!ovr2) ovr2 = e;
|
if (!ovr2)
|
||||||
|
ovr2 = e;
|
||||||
|
|
||||||
/* Copy the funcs from ovr to ovr2 */
|
/* Copy the funcs from ovr to ovr2 */
|
||||||
#define one_func(type1,type2,func,args,return,val) \
|
#define one_func(type1,type2,func,args,return,val) \
|
||||||
ovr2.func = ovr.func
|
ovr2.func = ovr.func
|
||||||
|
|
||||||
all_funcs();
|
all_funcs();
|
||||||
|
|
||||||
#undef one_func
|
#undef one_func
|
||||||
|
|
||||||
if (ovr.overrider) ovr.overrider.owner = ovr.owner;
|
if (ovr.overrider)
|
||||||
|
ovr.overrider.owner = ovr.owner;
|
||||||
ovr.owner.overrider = ovr.overrider;
|
ovr.owner.overrider = ovr.overrider;
|
||||||
|
|
||||||
ovr.think = SUB_remove;
|
ovr.think = SUB_remove;
|
||||||
|
|
|
@ -2,48 +2,40 @@
|
||||||
#define OVERRIDE_qh 1
|
#define OVERRIDE_qh 1
|
||||||
|
|
||||||
@extern {
|
@extern {
|
||||||
|
/* Returns an overrider with matching class, creating one if needed */
|
||||||
|
entity (entity e, string override_class, float priority) override_create;
|
||||||
|
|
||||||
/* Returns an overrider with matching class, creating one if needed */
|
/* Finalizes the above, call this once you set what you want to override. */
|
||||||
entity(entity e, string override_class, float priority) override_create;
|
void (entity ovr) override_finalize;
|
||||||
|
|
||||||
/* Finalizes the above, call this once you set what you want to override. */
|
/* Use this in your overrider to get your entity. Call it _EXACTLY ONCE_ per overrider */
|
||||||
void(entity ovr) override_finalize;
|
entity () override_findself;
|
||||||
|
|
||||||
/* Use this in your overrider to get your entity. Call it _EXACTLY ONCE_ per overrider */
|
/* This _MUST_ be called if you don't continue down the chain! */
|
||||||
entity() override_findself;
|
void () override_halt;
|
||||||
|
|
||||||
/* This _MUST_ be called if you don't continue down the chain! */
|
/* Guess. */
|
||||||
void() override_halt;
|
void (entity e, entity ovr) override_destroy;
|
||||||
|
|
||||||
/* Guess. */
|
/* FIXME: Use 'any' type when compiler supports it */
|
||||||
void(entity e, entity ovr) override_destroy;
|
void (entity e, .void () fld, void () func) override_set_v_v;
|
||||||
|
void (entity e, .float (entity ent) fld, float (entity ent) func) override_set_f_e;
|
||||||
/* FIXME: Use 'any' type when compiler supports it */
|
void (entity e, .float (float flt) fld, float (float flt) func) override_set_f_f;
|
||||||
void(entity e, .void() fld, void() func) override_set_v_v;
|
void (entity e, .float () fld, float () func) override_set_f_v;
|
||||||
void(entity e, .float(entity ent) fld, float(entity ent) func) override_set_f_e;
|
void (entity e, .float (vector vec) fld, float (vector vec) func) override_set_f_c;
|
||||||
void(entity e, .float(float flt) fld, float(float flt) func) override_set_f_f;
|
void (entity e, .float (entity ent) fld, float (entity ent) func) override_set_f_e;
|
||||||
void(entity e, .float() fld, float() func) override_set_f_v;
|
|
||||||
void(entity e, .float(vector vec) fld, float(vector vec) func) override_set_f_c;
|
|
||||||
void(entity e, .float(entity ent) fld, float(entity ent) func) override_set_f_e;
|
|
||||||
|
|
||||||
#define override_set_th_takeitem(e, func) override_set_f_v(e, th_takeitem, func)
|
|
||||||
|
|
||||||
#define override_set_th_attack(e, func) override_set_f_e(e, th_attack, func)
|
|
||||||
|
|
||||||
#define override_set_th_takedamage(e, func) override_set_f_f(e, th_takedamage, func)
|
|
||||||
#define override_set_th_dealdamage(e, func) override_set_f_f(e, th_dealdamage, func)
|
|
||||||
|
|
||||||
#define override_set_th_die(e, func) override_set_v_v(e, th_die, func)
|
|
||||||
#define override_set_th_kill(e, func) override_set_v_v(e, th_kill, func)
|
|
||||||
|
|
||||||
#define override_set_prethink(e, func) override_set_v_v(e, prethink, func)
|
|
||||||
#define override_set_actthink(e, func) override_set_v_v(e, actthink, func)
|
|
||||||
#define override_set_postthink(e, func) override_set_v_v(e, postthink, func)
|
|
||||||
|
|
||||||
#define override_set_th_teleport(e, func) override_set_f_c(e, th_teleport, func)
|
|
||||||
|
|
||||||
#define override_set_th_projectile(e, func) override_set_f_e(e, th_projectile, func)
|
|
||||||
|
|
||||||
|
#define override_set_th_takeitem(e, func) override_set_f_v(e, th_takeitem, func)
|
||||||
|
#define override_set_th_attack(e, func) override_set_f_e(e, th_attack, func)
|
||||||
|
#define override_set_th_takedamage(e, func) override_set_f_f(e, th_takedamage, func)
|
||||||
|
#define override_set_th_dealdamage(e, func) override_set_f_f(e, th_dealdamage, func)
|
||||||
|
#define override_set_th_die(e, func) override_set_v_v(e, th_die, func)
|
||||||
|
#define override_set_th_kill(e, func) override_set_v_v(e, th_kill, func)
|
||||||
|
#define override_set_prethink(e, func) override_set_v_v(e, prethink, func)
|
||||||
|
#define override_set_actthink(e, func) override_set_v_v(e, actthink, func)
|
||||||
|
#define override_set_postthink(e, func) override_set_v_v(e, postthink, func)
|
||||||
|
#define override_set_th_teleport(e, func) override_set_f_c(e, th_teleport, func)
|
||||||
|
#define override_set_th_projectile(e, func) override_set_f_e(e, th_projectile, func)
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,96 +1,99 @@
|
||||||
/* Builtin functions */
|
/* Builtin functions */
|
||||||
|
|
||||||
entity() BUILTIN_spawn = #14;
|
entity () BUILTIN_spawn = #14;
|
||||||
void(entity e) remove = #15;
|
void (entity e) remove = #15;
|
||||||
|
|
||||||
void(entity e, vector o) setorigin = #2;
|
void (entity e, vector o) setorigin = #2;
|
||||||
void(entity e, string m) setmodel = #3; // set movetype and solid first
|
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 min, vector max) setsize = #4;
|
||||||
|
|
||||||
string(string s) precache_sound = #19;
|
string (string s) precache_sound = #19;
|
||||||
string(string s) precache_model = #20;
|
string (string s) precache_model = #20;
|
||||||
string(string s) precache_file = #68; // no effect except for -copy
|
string (string s) precache_file = #68; // no effect except for -copy
|
||||||
string(string s) precache_sound2 = #76; // registered version only
|
string (string s) precache_sound2 = #76; // registered version only
|
||||||
string(string s) precache_model2 = #75; // 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_file2 = #77; // registered version only
|
||||||
void(float style, string value) lightstyle = #35;
|
void (float style, string value) lightstyle = #35;
|
||||||
|
|
||||||
// debug functions
|
// debug functions
|
||||||
void() BUILTIN_break = #6; // shatter progs
|
void () BUILTIN_break = #6; // shatter progs
|
||||||
void(string e, ...) error = #10;
|
void (string e, ...) error = #10;
|
||||||
void(string e, ...) objerror = #11;
|
void (string e, ...) objerror = #11;
|
||||||
void() coredump = #28; // prints all edicts
|
void () coredump = #28; // prints all edicts
|
||||||
void() traceon = #29; // turns statment trace on
|
void () traceon = #29; // turns statment trace on
|
||||||
void() traceoff = #30;
|
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
|
void (vector ang) makevectors = #1; // sets v_forward, etc globals
|
||||||
vector(vector v) normalize = #9;
|
vector (vector v) normalize = #9;
|
||||||
float(vector v) vlen = #12;
|
float (vector v) vlen = #12;
|
||||||
float(vector v) vectoyaw = #13;
|
float (vector v) vectoyaw = #13;
|
||||||
vector(vector v) vectoangles = #51;
|
vector (vector v) vectoangles = #51;
|
||||||
vector(entity e, float speed) aim = #44; // returns the shooting vector
|
vector (entity e, float speed) aim = #44; // returns the shooting vector
|
||||||
|
|
||||||
float() random = #7; // returns 0 - 1
|
float () random = #7; // returns 0 - 1
|
||||||
string(float f) ftos = #26;
|
string (float f) ftos = #26;
|
||||||
float(string s) stof = #81; // convert string to float
|
float (string s) stof = #81; // convert string to float
|
||||||
string(vector v) vtos = #27;
|
string (vector v) vtos = #27;
|
||||||
float(float v) rint = #36; // round to nearest int
|
float (float v) rint = #36; // round to nearest int
|
||||||
float(float v) floor = #37; // largest integer <= v
|
float (float v) floor = #37; // largest integer <= v
|
||||||
float(float v) ceil = #38; // smallest integer >= v
|
float (float v) ceil = #38; // smallest integer >= v
|
||||||
float(float f) fabs = #43;
|
float (float f) fabs = #43;
|
||||||
|
|
||||||
// sets trace_* globals
|
// sets trace_* globals
|
||||||
// nomonsters can be:
|
// nomonsters can be:
|
||||||
// An entity will also be ignored for testing if forent == test,
|
// An entity will also be ignored for testing if forent == test,
|
||||||
// forent->owner == test, or test->owner == forent
|
// forent->owner == test, or test->owner == forent
|
||||||
// a forent of world is ignored
|
// a forent of world is ignored
|
||||||
void(vector v1, vector v2, float nomonsters, entity forent) traceline = #16;
|
void (vector v1, vector v2, float nomonsters, entity forent) traceline = #16;
|
||||||
float(vector v) pointcontents = #41; // returns a CONTENT_*
|
float (vector v) pointcontents = #41; // returns a CONTENT_*
|
||||||
float(entity e) checkbottom = #40; // true if self is on ground
|
float (entity e) checkbottom = #40; // true if self is on ground
|
||||||
float() droptofloor = #34; // TRUE if landed on floor
|
float () droptofloor = #34; // TRUE if landed on floor
|
||||||
float(float yaw, float dist) walkmove = #32; // returns TRUE or FALSE
|
float (float yaw, float dist) walkmove = #32; // returns TRUE or FALSE
|
||||||
void(float step) movetogoal = #67;
|
void (float step) movetogoal = #67;
|
||||||
|
|
||||||
entity() checkclient = #17; // returns a client to look for
|
entity () checkclient = #17; // returns a client to look for
|
||||||
entity(entity start, .string fld, string match) find = #18;
|
entity (entity start, .string fld, string match) find = #18;
|
||||||
entity(vector org, float rad) findradius = #22;
|
entity (vector org, float rad) findradius = #22;
|
||||||
entity(entity e) nextent = #47; // for looping through all ents
|
entity (entity e) nextent = #47; // for looping through all ents
|
||||||
|
|
||||||
void(float level, string s, ...) bprint = #23;
|
void (float level, string s, ...) bprint = #23;
|
||||||
void(entity client, float level, string s, ...) sprint = #24;
|
void (entity client, float level, string s, ...) sprint = #24;
|
||||||
void(entity client, string s, ...) centerprint = #73; // sprint, but in middle
|
void (entity client, string s, ...) centerprint = #73; // sprint, but centered
|
||||||
void(string s, ...) dprint = #25;
|
void (string s, ...) dprint = #25;
|
||||||
void(entity e) eprint = #31; // prints an entire edict
|
void (entity e) eprint = #31; // prints an entire edict
|
||||||
|
|
||||||
float(string s) cvar = #45; // return cvar.value
|
float (string s) cvar = #45; // return cvar.value
|
||||||
void(string var, string val) cvar_set = #72; // sets 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)
|
string (entity e, string key) infokey = #80; // get a key value (world = serverinfo)
|
||||||
void(string s1, ...) localcmd = #46; // put string into local que
|
void (string s1, ...) localcmd = #46; // put string into local que
|
||||||
void(entity client, string s) stuffcmd = #21;
|
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
|
// at self.yaw_speed
|
||||||
// direct client message generation
|
// direct client message generation
|
||||||
void(float to, float f) WriteByte = #52;
|
void (float to, vector v) WriteAngleV = #0;
|
||||||
void(float to, float f) WriteChar = #53;
|
void (float to, vector v) WriteCoordV = #0;
|
||||||
void(float to, float f) WriteShort = #54;
|
void (float to, ...) WriteBytes = #0;
|
||||||
void(float to, float f) WriteLong = #55;
|
void (float to, float f) WriteByte = #52;
|
||||||
void(float to, float f) WriteCoord = #56;
|
void (float to, float f) WriteChar = #53;
|
||||||
void(float to, float f) WriteAngle = #57;
|
void (float to, float f) WriteShort = #54;
|
||||||
void(float to, string s) WriteString = #58;
|
void (float to, float f) WriteLong = #55;
|
||||||
void(float to, entity s) WriteEntity = #59;
|
void (float to, float f) WriteCoord = #56;
|
||||||
void(vector where, float set) multicast = #82; // sends the temp message to a set
|
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 (entity e) BUILTIN_makestatic = #69;
|
||||||
void(string s) changelevel = #70;
|
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
|
// values at level start
|
||||||
// for coop respawn
|
// for coop respawn
|
||||||
|
|
||||||
void(entity killer, entity killee) logfrag = #79; // add to stats
|
void (entity killer, entity killee) logfrag = #79; // add to stats
|
||||||
|
|
|
@ -33,73 +33,81 @@ float cl_rollangle, cl_rollspeed;
|
||||||
|
|
||||||
#define SV_FRAMES_BEFORE_SPAWN 3
|
#define SV_FRAMES_BEFORE_SPAWN 3
|
||||||
|
|
||||||
void() main = {
|
void ()
|
||||||
|
main =
|
||||||
|
{
|
||||||
local entity walk;
|
local entity walk;
|
||||||
|
|
||||||
/* Must be first. */
|
/* Must be first. */
|
||||||
max_clients = 0;
|
max_clients = 0;
|
||||||
walk = world;
|
walk = world;
|
||||||
while ((walk = nextent(walk))) max_clients++;
|
while ((walk = nextent(walk)))
|
||||||
|
max_clients++;
|
||||||
|
|
||||||
sv_spawning = SV_FRAMES_BEFORE_SPAWN;
|
sv_spawning = SV_FRAMES_BEFORE_SPAWN;
|
||||||
|
|
||||||
damage_init();
|
damage_init ();
|
||||||
bodyque_init();
|
bodyque_init ();
|
||||||
weapon_init();
|
weapon_init ();
|
||||||
client_init();
|
client_init ();
|
||||||
SZ_init();
|
SZ_init ();
|
||||||
|
|
||||||
mdl_player_init();
|
mdl_player_init ();
|
||||||
mdl_eyes_init();
|
mdl_eyes_init ();
|
||||||
|
|
||||||
act_player_init();
|
act_player_init ();
|
||||||
};
|
};
|
||||||
|
|
||||||
float players_frame_started;
|
float players_frame_started;
|
||||||
void() StartFrame = {
|
void ()
|
||||||
|
StartFrame =
|
||||||
|
{
|
||||||
if (sv_spawning) {
|
if (sv_spawning) {
|
||||||
sv_spawning = sv_spawning - 1;
|
sv_spawning--;
|
||||||
if (!sv_spawning) {
|
if (!sv_spawning) {
|
||||||
if (!intermission_head)
|
if (!intermission_head)
|
||||||
intermission_head = spawn_head;
|
intermission_head = spawn_head;
|
||||||
|
|
||||||
if (!spawn_head)
|
if (!spawn_head)
|
||||||
error("Unable to find a spawn point.\n");
|
error ("Unable to find a spawn point.\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SZ_frame();
|
SZ_frame ();
|
||||||
|
|
||||||
rocket_jump = stof(infokey(world, "rj"));
|
rocket_jump = stof (infokey (world, "rj"));
|
||||||
if (rocket_jump <= 1) rocket_jump = 0;
|
if (rocket_jump <= 1)
|
||||||
|
rocket_jump = 0;
|
||||||
|
|
||||||
sv_mintic = cvar("sv_mintic");
|
sv_mintic = cvar ("sv_mintic");
|
||||||
sv_maxtic = cvar("sv_maxtic");
|
sv_maxtic = cvar ("sv_maxtic");
|
||||||
|
|
||||||
sv_gravity = cvar("sv_gravity");
|
sv_gravity = cvar ("sv_gravity");
|
||||||
|
|
||||||
sv_stopspeed = cvar("sv_stopspeed");
|
sv_stopspeed = cvar ("sv_stopspeed");
|
||||||
sv_maxspeed = cvar("sv_maxspeed");
|
sv_maxspeed = cvar ("sv_maxspeed");
|
||||||
sv_spectatormaxspeed = cvar("sv_spectatormaxspeed");
|
sv_spectatormaxspeed = cvar ("sv_spectatormaxspeed");
|
||||||
|
|
||||||
sv_accelerate = cvar("sv_accelerate");
|
sv_accelerate = cvar ("sv_accelerate");
|
||||||
sv_airaccelerate = cvar("sv_airaccelerate");
|
sv_airaccelerate = cvar ("sv_airaccelerate");
|
||||||
sv_wateraccelerate = cvar("sv_wateraccelerate");
|
sv_wateraccelerate = cvar ("sv_wateraccelerate");
|
||||||
|
|
||||||
sv_friction = cvar("sv_friction");
|
sv_friction = cvar ("sv_friction");
|
||||||
sv_waterfriction = cvar("sv_waterfriction");
|
sv_waterfriction = cvar ("sv_waterfriction");
|
||||||
|
|
||||||
cl_rollangle = cvar("cl_rollangle");
|
cl_rollangle = cvar ("cl_rollangle");
|
||||||
cl_rollspeed = cvar("cl_rollspeed");
|
cl_rollspeed = cvar ("cl_rollspeed");
|
||||||
|
|
||||||
PlayerStartFrame();
|
PlayerStartFrame ();
|
||||||
players_frame_started = -1;
|
players_frame_started = -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* This is really called by QSG engines */
|
/* This is really called by QSG engines */
|
||||||
// void() EndFrame = { };
|
// void () EndFrame = {};
|
||||||
|
|
||||||
void() PlayerStartFrame = {
|
void ()
|
||||||
|
PlayerStartFrame =
|
||||||
|
{
|
||||||
if (players_frame_started == -1) {
|
if (players_frame_started == -1) {
|
||||||
/* First player after StartFrame */
|
/* First player after StartFrame */
|
||||||
players_frame_started = TRUE;
|
players_frame_started = TRUE;
|
||||||
|
@ -111,17 +119,19 @@ void() PlayerStartFrame = {
|
||||||
|
|
||||||
players_frame_started = TRUE;
|
players_frame_started = TRUE;
|
||||||
|
|
||||||
delays_swapin_stats_all();
|
delays_swapin_stats_all ();
|
||||||
};
|
};
|
||||||
|
|
||||||
void() PlayerEndFrame = {
|
void ()
|
||||||
|
PlayerEndFrame =
|
||||||
|
{
|
||||||
/* Unfortunately, a newmis can us damage this frame,
|
/* Unfortunately, a newmis can us damage this frame,
|
||||||
after our postthink has been called. Damn. */
|
after our postthink has been called. Damn. */
|
||||||
/* We just force an update this frame for now. */
|
/* We just force an update this frame for now. */
|
||||||
if (newmis) {
|
if (newmis) {
|
||||||
delays_force_update_all();
|
delays_force_update_all ();
|
||||||
} else {
|
} else {
|
||||||
players_frame_started = FALSE;
|
players_frame_started = FALSE;
|
||||||
delays_swapout_stats_all();
|
delays_swapout_stats_all ();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,26 +2,24 @@
|
||||||
#define SERVER_qh 1
|
#define SERVER_qh 1
|
||||||
|
|
||||||
@extern {
|
@extern {
|
||||||
|
float max_clients;
|
||||||
|
|
||||||
float max_clients;
|
// Various cvars [possibly] referenced by QC
|
||||||
|
float rocket_jump;
|
||||||
|
|
||||||
// Various cvars [possibly] referenced by QC
|
float sv_mintic, sv_maxtic;
|
||||||
float rocket_jump;
|
|
||||||
|
|
||||||
float sv_mintic, sv_maxtic;
|
float sv_gravity;
|
||||||
|
float sv_stopspeed, sv_maxspeed, sv_spectatormaxspeed;
|
||||||
|
float sv_accelerate, sv_airaccelerate, sv_wateraccelerate;
|
||||||
|
float sv_friction, sv_waterfriction;
|
||||||
|
|
||||||
float sv_gravity;
|
float cl_rollangle, cl_rollspeed;
|
||||||
float sv_stopspeed, sv_maxspeed, sv_spectatormaxspeed;
|
|
||||||
float sv_accelerate, sv_airaccelerate, sv_wateraccelerate;
|
|
||||||
float sv_friction, sv_waterfriction;
|
|
||||||
|
|
||||||
float cl_rollangle, cl_rollspeed;
|
void () StartFrame;
|
||||||
|
|
||||||
void() StartFrame;
|
|
||||||
|
|
||||||
void() PlayerStartFrame;
|
|
||||||
void() PlayerEndFrame;
|
|
||||||
|
|
||||||
|
void () PlayerStartFrame;
|
||||||
|
void () PlayerEndFrame;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,16 +1,22 @@
|
||||||
#include "common.qh"
|
#include "common.qh"
|
||||||
|
|
||||||
// Called when a spectator connects
|
// Called when a spectator connects
|
||||||
void() SpectatorConnect = {
|
void ()
|
||||||
bprint(PRINT_MEDIUM, "Spectator ", self.netname, " entered the game.\n");
|
SpectatorConnect =
|
||||||
|
{
|
||||||
|
bprint (PRINT_MEDIUM, "Spectator ", self.netname, " entered the game.\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
// Called when a spectator disconnects
|
// Called when a spectator disconnects
|
||||||
void() SpectatorDisconnect = {
|
void ()
|
||||||
bprint(PRINT_MEDIUM, "Spectator ", self.netname, " left the game.\n");
|
SpectatorDisconnect =
|
||||||
|
{
|
||||||
|
bprint (PRINT_MEDIUM, "Spectator ", self.netname, " left the game.\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
// Called around the same time as player thinks?
|
// Called around the same time as player thinks?
|
||||||
void() SpectatorThink = {
|
void ()
|
||||||
|
SpectatorThink =
|
||||||
|
{
|
||||||
self.impulse = 0;
|
self.impulse = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
void() NOTHING_function = {};
|
void () NOTHING_function = {};
|
||||||
|
|
||||||
// ========================================================================== //
|
// ========================================================================= //
|
||||||
// ========================================================================== //
|
// ========================================================================= //
|
||||||
|
|
||||||
/* Fields in maps */
|
/* Fields in maps */
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@ void() NOTHING_function = {};
|
||||||
.string noise5, noise6; // can't activate, can activate.
|
.string noise5, noise6; // can't activate, can activate.
|
||||||
.string noise7; // for items, respawn
|
.string noise7; // for items, respawn
|
||||||
|
|
||||||
// ========================================================================== //
|
// ========================================================================= //
|
||||||
// ========================================================================== //
|
// ========================================================================= //
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// used by QSG engines
|
// used by QSG engines
|
||||||
|
@ -61,8 +61,8 @@ void() NOTHING_function = {};
|
||||||
.float gravity; // Gravity Multiplier (0 to 1.0)
|
.float gravity; // Gravity Multiplier (0 to 1.0)
|
||||||
.float maxspeed; // Used to set Maxspeed on a player
|
.float maxspeed; // Used to set Maxspeed on a player
|
||||||
|
|
||||||
// ========================================================================== //
|
// ========================================================================= //
|
||||||
// ========================================================================== //
|
// ========================================================================= //
|
||||||
|
|
||||||
.float mass; // for projectile collisions
|
.float mass; // for projectile collisions
|
||||||
|
|
||||||
|
@ -79,5 +79,5 @@ void() NOTHING_function = {};
|
||||||
.float water_finished; // swim sound
|
.float water_finished; // swim sound
|
||||||
.float pain_finished; // pain sound
|
.float pain_finished; // pain sound
|
||||||
|
|
||||||
// ========================================================================== //
|
// ========================================================================= //
|
||||||
// ========================================================================== //
|
// ========================================================================= //
|
||||||
|
|
|
@ -5,21 +5,27 @@
|
||||||
#include "misc.qh"
|
#include "misc.qh"
|
||||||
#include "teleport.qh"
|
#include "teleport.qh"
|
||||||
|
|
||||||
.float(vector org) th_teleport;
|
.float (vector org) th_teleport;
|
||||||
|
|
||||||
void() _deathmsg_teleport = {
|
void ()
|
||||||
|
_deathmsg_teleport =
|
||||||
|
{
|
||||||
local string att_nname, def_nname;
|
local string att_nname, def_nname;
|
||||||
|
|
||||||
def_nname = name(self);
|
def_nname = name (self);
|
||||||
att_nname = name(self.dmg_attacker);
|
att_nname = name (self.dmg_attacker);
|
||||||
|
|
||||||
if (self.dmg_inflictor.owner == self)
|
if (self.dmg_inflictor.owner == self)
|
||||||
bprint(PRINT_DEATH, "Satan's power deflects ", att_nname, "'s telefrag.\n");
|
bprint (PRINT_DEATH, "Satan's power deflects ", att_nname,
|
||||||
|
"'s telefrag.\n");
|
||||||
else
|
else
|
||||||
bprint(PRINT_DEATH, def_nname, " was telefragged by ", att_nname, ".\n");
|
bprint (PRINT_DEATH, def_nname, " was telefragged by ", att_nname,
|
||||||
|
".\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
void() _teleport_death_touch = {
|
void ()
|
||||||
|
_teleport_death_touch =
|
||||||
|
{
|
||||||
if (self.owner == other)
|
if (self.owner == other)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -33,17 +39,20 @@ void() _teleport_death_touch = {
|
||||||
ghost_inflictor.speed = 1000;
|
ghost_inflictor.speed = 1000;
|
||||||
ghost_inflictor.owner = self.owner;
|
ghost_inflictor.owner = self.owner;
|
||||||
|
|
||||||
damage(other, self.owner, ghost_inflictor, DAMAGE_SHOULDDIE, _deathmsg_teleport);
|
damage (other, self.owner, ghost_inflictor, DAMAGE_SHOULDDIE,
|
||||||
|
_deathmsg_teleport);
|
||||||
};
|
};
|
||||||
|
|
||||||
void(vector org, entity death_owner) _teleport_death_spawn = {
|
void (vector org, entity death_owner)
|
||||||
|
_teleport_death_spawn =
|
||||||
|
{
|
||||||
local entity death;
|
local entity death;
|
||||||
|
|
||||||
death = spawn("TELEDEATH");
|
death = spawn ("TELEDEATH");
|
||||||
death.owner = death_owner;
|
death.owner = death_owner;
|
||||||
death.solid = SOLID_TRIGGER;
|
death.solid = SOLID_TRIGGER;
|
||||||
setsize(death, death_owner.mins - '1 1 1', death_owner.maxs + '1 1 1');
|
setsize (death, death_owner.mins - '1 1 1', death_owner.maxs + '1 1 1');
|
||||||
setorigin(death, org);
|
setorigin (death, org);
|
||||||
|
|
||||||
death.touch = _teleport_death_touch;
|
death.touch = _teleport_death_touch;
|
||||||
|
|
||||||
|
@ -53,7 +62,9 @@ void(vector org, entity death_owner) _teleport_death_spawn = {
|
||||||
force_retouch = 2;
|
force_retouch = 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
void(entity e, entity spot) teleport = {
|
void (entity e, entity spot)
|
||||||
|
teleport =
|
||||||
|
{
|
||||||
local float spd;
|
local float spd;
|
||||||
|
|
||||||
if (e.th_teleport) {
|
if (e.th_teleport) {
|
||||||
|
@ -66,7 +77,7 @@ void(entity e, entity spot) teleport = {
|
||||||
self = e;
|
self = e;
|
||||||
other = spot;
|
other = spot;
|
||||||
|
|
||||||
do_teleport = self.th_teleport(other.origin);
|
do_teleport = self.th_teleport (other.origin);
|
||||||
|
|
||||||
self = oldself;
|
self = oldself;
|
||||||
other = oldother;
|
other = oldother;
|
||||||
|
@ -75,20 +86,20 @@ void(entity e, entity spot) teleport = {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
spd = vlen(e.velocity);
|
spd = vlen (e.velocity);
|
||||||
if (spd < 200)
|
if (spd < 200)
|
||||||
spd = 200;
|
spd = 200;
|
||||||
|
|
||||||
setorigin(e, spot.origin);
|
setorigin (e, spot.origin);
|
||||||
e.angles = spot.angles;
|
e.angles = spot.angles;
|
||||||
e.fixangle = TRUE;
|
e.fixangle = TRUE;
|
||||||
e.teleport_time = 0.1;
|
e.teleport_time = 0.1;
|
||||||
|
|
||||||
makevectors(e.angles);
|
makevectors (e.angles);
|
||||||
e.velocity = v_forward*spd;
|
e.velocity = v_forward*spd;
|
||||||
|
|
||||||
if (is_living(e))
|
if (is_living (e))
|
||||||
_teleport_death_spawn(spot.origin, e);
|
_teleport_death_spawn (spot.origin, e);
|
||||||
|
|
||||||
effect_teleport_fog(spot.origin);
|
effect_teleport_fog (spot.origin);
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,11 +2,9 @@
|
||||||
#define TELEPORT_qh 1
|
#define TELEPORT_qh 1
|
||||||
|
|
||||||
@extern {
|
@extern {
|
||||||
|
.float(vector org) th_teleport;
|
||||||
|
|
||||||
.float(vector org) th_teleport;
|
void (entity e, entity spot) teleport;
|
||||||
|
|
||||||
void(entity e, entity spot) teleport;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -6,48 +6,62 @@
|
||||||
|
|
||||||
#include "effect.qh"
|
#include "effect.qh"
|
||||||
|
|
||||||
void() _w_axe_deathmsg = {
|
void ()
|
||||||
|
_w_axe_deathmsg =
|
||||||
|
{
|
||||||
local float r;
|
local float r;
|
||||||
local string att_nname, def_nname;
|
local string att_nname, def_nname;
|
||||||
|
|
||||||
r = random();
|
r = random ();
|
||||||
|
|
||||||
def_nname = name(self);
|
def_nname = name (self);
|
||||||
att_nname = name(self.dmg_attacker);
|
att_nname = name (self.dmg_attacker);
|
||||||
|
|
||||||
if (r < 0.25) bprint(PRINT_DEATH, def_nname, " gets chopped down to size by ", att_nname, ".\n");
|
if (r < 0.25)
|
||||||
else if (r < 0.5) bprint(PRINT_DEATH, att_nname, " mames ", def_nname, " with a rusty axe.\n");
|
bprint (PRINT_DEATH, def_nname, " gets chopped down to size by ",
|
||||||
else if (r < 0.75) bprint(PRINT_DEATH, def_nname, " loses his scalp to ", att_nname, ".\n");
|
att_nname, ".\n");
|
||||||
else bprint(PRINT_DEATH, att_nname, "'s axe penetrates ", def_nname, " straight to the bone.\n");
|
else if (r < 0.5)
|
||||||
|
bprint (PRINT_DEATH, att_nname, " mames ", def_nname,
|
||||||
|
" with a rusty axe.\n");
|
||||||
|
else if (r < 0.75)
|
||||||
|
bprint (PRINT_DEATH, def_nname, " loses his scalp to ", att_nname,
|
||||||
|
".\n");
|
||||||
|
else
|
||||||
|
bprint (PRINT_DEATH, att_nname, "'s axe penetrates ", def_nname,
|
||||||
|
" straight to the bone.\n");
|
||||||
};
|
};
|
||||||
|
|
||||||
void() _w_axe_fire =
|
void ()
|
||||||
|
_w_axe_fire =
|
||||||
{
|
{
|
||||||
local vector source;
|
local vector source;
|
||||||
|
|
||||||
source = shootorigin(self);
|
source = shootorigin (self);
|
||||||
|
|
||||||
makevectors (self.v_angle);
|
makevectors (self.v_angle);
|
||||||
traceline (source, source + v_forward*64, FALSE, self);
|
traceline (source, source + v_forward * 64, FALSE, self);
|
||||||
if (trace_fraction == 1.0)
|
if (trace_fraction == 1.0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ghost_inflictor.classname = "AXE";
|
ghost_inflictor.classname = "AXE";
|
||||||
ghost_inflictor.dmg = 20;
|
ghost_inflictor.dmg = 20;
|
||||||
ghost_inflictor.mass = ghost_inflictor.mass * 8;
|
ghost_inflictor.mass = ghost_inflictor.mass * 8;
|
||||||
ghost_inflictor.velocity = v_forward*1000;
|
ghost_inflictor.velocity = v_forward * 1000;
|
||||||
|
|
||||||
damage_attack(ghost_inflictor);
|
damage_attack (ghost_inflictor);
|
||||||
|
|
||||||
if (!damage(trace_ent, self, ghost_inflictor, ghost_inflictor.dmg, _w_axe_deathmsg)) {
|
if (!damage (trace_ent, self, ghost_inflictor, ghost_inflictor.dmg,
|
||||||
|
_w_axe_deathmsg)) {
|
||||||
/* We hit the world. */
|
/* We hit the world. */
|
||||||
sound(self, CHAN_WEAPON, "player/axhit2.wav", 1, ATTN_NORM);
|
sound (self, CHAN_WEAPON, "player/axhit2.wav", 1, ATTN_NORM);
|
||||||
effect_gun_spark(trace_endpos, v_forward * 250, 3);
|
effect_gun_spark (trace_endpos, v_forward * 250, 3);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void() _w_axe_think_1 = {
|
void ()
|
||||||
self.weaponframe = self.weaponframe + 1;
|
_w_axe_think_1 =
|
||||||
|
{
|
||||||
|
self.weaponframe++;
|
||||||
if (self.weaponframe == 3)
|
if (self.weaponframe == 3)
|
||||||
_w_axe_fire();
|
_w_axe_fire();
|
||||||
if (self.weaponframe <= 1 || self.weaponframe > 4) {
|
if (self.weaponframe <= 1 || self.weaponframe > 4) {
|
||||||
|
@ -56,8 +70,10 @@ void() _w_axe_think_1 = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void() _w_axe_think_2 = {
|
void ()
|
||||||
self.weaponframe = self.weaponframe + 1;
|
_w_axe_think_2 =
|
||||||
|
{
|
||||||
|
self.weaponframe++;
|
||||||
if (self.weaponframe == 7)
|
if (self.weaponframe == 7)
|
||||||
_w_axe_fire();
|
_w_axe_fire();
|
||||||
if (self.weaponframe <= 5 || self.weaponframe > 8) {
|
if (self.weaponframe <= 5 || self.weaponframe > 8) {
|
||||||
|
@ -67,15 +83,17 @@ void() _w_axe_think_2 = {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* WEAPON 1 axe */
|
/* WEAPON 1 axe */
|
||||||
float(float action)
|
float (float action)
|
||||||
w_axe = {
|
w_axe =
|
||||||
if (action == WEAPON_AMMO) {
|
{
|
||||||
|
switch (action) {
|
||||||
|
case WEAPON_AMMO:
|
||||||
return 0;
|
return 0;
|
||||||
} else if (action == WEAPON_WEIGHT) {
|
case WEAPON_WEIGHT:
|
||||||
return 1;
|
return 1;
|
||||||
} else if (action == WEAPON_SELECTABLE) {
|
case WEAPON_SELECTABLE:
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else if (action == WEAPON_FIRE) {
|
case WEAPON_FIRE:
|
||||||
self.attack_finished = time + 0.5;
|
self.attack_finished = time + 0.5;
|
||||||
sound (self, CHAN_WEAPON, "weapons/ax1.wav", 1, ATTN_NORM);
|
sound (self, CHAN_WEAPON, "weapons/ax1.wav", 1, ATTN_NORM);
|
||||||
|
|
||||||
|
@ -88,18 +106,20 @@ w_axe = {
|
||||||
}
|
}
|
||||||
self.w_thought = TRUE;
|
self.w_thought = TRUE;
|
||||||
|
|
||||||
self.mdl_func(MDL_FUNC_FIRE, 0);
|
self.mdl_func (MDL_FUNC_FIRE, 0);
|
||||||
} else if (action == WEAPON_SELECT) {
|
break;
|
||||||
|
case WEAPON_SELECT:
|
||||||
self.weaponmodel = "progs/v_axe.mdl";
|
self.weaponmodel = "progs/v_axe.mdl";
|
||||||
self.weaponframe = 0;
|
self.weaponframe = 0;
|
||||||
self.mdl_mod = (self.mdl_mod & ~MDL_MOD_WEP_MASK) | MDL_MOD_WEP_AXE;
|
self.mdl_mod = (self.mdl_mod & ~MDL_MOD_WEP_MASK) | MDL_MOD_WEP_AXE;
|
||||||
|
weaponprint ("Axe");
|
||||||
weaponprint("Axe");
|
break;
|
||||||
} else if (action == WEAPON_INIT) {
|
case WEAPON_INIT:
|
||||||
precache_model("progs/v_axe.mdl");
|
precache_model ("progs/v_axe.mdl");
|
||||||
precache_sound("player/axhit1.wav");
|
precache_sound ("player/axhit1.wav");
|
||||||
precache_sound("player/axhit2.wav");
|
precache_sound ("player/axhit2.wav");
|
||||||
precache_sound("weapons/ax1.wav");
|
precache_sound ("weapons/ax1.wav");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1,57 +1,59 @@
|
||||||
#include "common.qh"
|
#include "common.qh"
|
||||||
|
|
||||||
void() worldspawn = {
|
void ()
|
||||||
|
worldspawn =
|
||||||
|
{
|
||||||
/* These are used be the server C code, but not precached. Bad iD. */
|
/* These are used be the server C code, but not precached. Bad iD. */
|
||||||
precache_sound("misc/h2ohit1.wav");
|
precache_sound ("misc/h2ohit1.wav");
|
||||||
precache_sound("demon/dland2.wav");
|
precache_sound ("demon/dland2.wav");
|
||||||
precache_sound("misc/r_tele1.wav");
|
precache_sound ("misc/r_tele1.wav");
|
||||||
precache_sound("misc/r_tele2.wav");
|
precache_sound ("misc/r_tele2.wav");
|
||||||
precache_sound("misc/r_tele3.wav");
|
precache_sound ("misc/r_tele3.wav");
|
||||||
precache_sound("misc/r_tele4.wav");
|
precache_sound ("misc/r_tele4.wav");
|
||||||
precache_sound("misc/r_tele5.wav");
|
precache_sound ("misc/r_tele5.wav");
|
||||||
|
|
||||||
/* Compatibility :) */
|
/* Compatibility :) */
|
||||||
if (self.model == "maps/e1m8.bsp")
|
if (self.model == "maps/e1m8.bsp")
|
||||||
cvar_set("sv_gravity", "100");
|
cvar_set ("sv_gravity", "100");
|
||||||
|
|
||||||
// Setup light animation tables. 'a' is total darkness, 'z' is maxbright.
|
// Setup light animation tables. 'a' is total darkness, 'z' is maxbright.
|
||||||
// 0 normal
|
// 0 normal
|
||||||
lightstyle(0, "m");
|
lightstyle (0, "m");
|
||||||
|
|
||||||
// 1 FLICKER (first variety)
|
// 1 FLICKER (first variety)
|
||||||
lightstyle(1, "mmnmmommommnonmmonqnmmo");
|
lightstyle (1, "mmnmmommommnonmmonqnmmo");
|
||||||
|
|
||||||
// 2 SLOW STRONG PULSE
|
// 2 SLOW STRONG PULSE
|
||||||
lightstyle(2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");
|
lightstyle (2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba");
|
||||||
|
|
||||||
// 3 CANDLE (first variety)
|
// 3 CANDLE (first variety)
|
||||||
lightstyle(3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");
|
lightstyle (3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg");
|
||||||
|
|
||||||
// 4 FAST STROBE
|
// 4 FAST STROBE
|
||||||
lightstyle(4, "ma");
|
lightstyle (4, "ma");
|
||||||
|
|
||||||
// 5 GENTLE PULSE 1
|
// 5 GENTLE PULSE 1
|
||||||
lightstyle(5,"jklmnopqrstuvwxyzyxwvutsrqponmlkj");
|
lightstyle (5,"jklmnopqrstuvwxyzyxwvutsrqponmlkj");
|
||||||
|
|
||||||
// 6 FLICKER (second variety)
|
// 6 FLICKER (second variety)
|
||||||
lightstyle(6, "nmonqnmomnmomomno");
|
lightstyle (6, "nmonqnmomnmomomno");
|
||||||
|
|
||||||
// 7 CANDLE (second variety)
|
// 7 CANDLE (second variety)
|
||||||
lightstyle(7, "mmmaaaabcdefgmmmmaaaammmaamm");
|
lightstyle (7, "mmmaaaabcdefgmmmmaaaammmaamm");
|
||||||
|
|
||||||
// 8 CANDLE (third variety)
|
// 8 CANDLE (third variety)
|
||||||
lightstyle(8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");
|
lightstyle (8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa");
|
||||||
|
|
||||||
// 9 SLOW STROBE (fourth variety)
|
// 9 SLOW STROBE (fourth variety)
|
||||||
lightstyle(9, "aaaaaaaazzzzzzzz");
|
lightstyle (9, "aaaaaaaazzzzzzzz");
|
||||||
|
|
||||||
// 10 FLUORESCENT FLICKER
|
// 10 FLUORESCENT FLICKER
|
||||||
lightstyle(10, "mmamammmmammamamaaamammma");
|
lightstyle (10, "mmamammmmammamamaaamammma");
|
||||||
|
|
||||||
// 11 SLOW PULSE NOT FADE TO BLACK
|
// 11 SLOW PULSE NOT FADE TO BLACK
|
||||||
lightstyle(11, "abcdefghijklmnopqrrqponmlkjihgfedcba");
|
lightstyle (11, "abcdefghijklmnopqrrqponmlkjihgfedcba");
|
||||||
|
|
||||||
// styles 32-62 are assigned by the light program for switchable lights
|
// styles 32-62 are assigned by the light program for switchable lights
|
||||||
|
|
||||||
main();
|
main ();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue