bool announcer_1min;
bool announcer_5min;
void Announcer_Countdown()
-{
+{SELFPARAM();
float starttime = getstatf(STAT_GAMESTARTTIME);
float roundstarttime = getstatf(STAT_ROUNDSTARTTIME);
if(roundstarttime == -1)
#include "../../common/command/generic.qh"
void DrawDebugModel()
-{
+{SELFPARAM();
if(time - floor(time) > 0.5)
{
PolyDrawModel(self);
}
void cpicon_draw()
-{
+{SELFPARAM();
if(time < self.move_time) { return; }
if(self.cp_bob_dmg_z > 0)
}
void cpicon_damage(float hp)
-{
+{SELFPARAM();
if(!self.iscaptured) { return; }
if(hp < self.max_health * 0.25)
}
void cpicon_construct()
-{
+{SELFPARAM();
self.netname = "Control Point Icon";
setmodel(self, "models/onslaught/controlpoint_icon.md3");
.vector glowmod;
void cpicon_changeteam()
-{
+{SELFPARAM();
if(self.team)
{
self.glowmod = Team_ColorRGB(self.team - 1);
}
void ent_cpicon()
-{
+{SELFPARAM();
int sf = ReadByte();
if(sf & CPSF_SETUP)
.int lodmodelindex1;
.int lodmodelindex2;
void CSQCPlayer_LOD_Apply(void)
-{
+{SELFPARAM();
// LOD model loading
if(self.lodmodelindex0 != self.modelindex)
{
.vector old_glowmod;
void CSQCPlayer_ModelAppearance_PreUpdate(void)
-{
+{SELFPARAM();
self.model = self.forceplayermodels_savemodel;
self.modelindex = self.forceplayermodels_savemodelindex;
self.skin = self.forceplayermodels_saveskin;
self.colormap = self.forceplayermodels_savecolormap;
}
void CSQCPlayer_ModelAppearance_PostUpdate(void)
-{
+{SELFPARAM();
self.forceplayermodels_savemodel = self.model;
self.forceplayermodels_savemodelindex = self.modelindex;
self.forceplayermodels_saveskin = self.skin;
}
}
void CSQCPlayer_ModelAppearance_Apply(bool islocalplayer)
-{
+{SELFPARAM();
// FORCEMODEL
// which one is ALWAYS good?
if (!forceplayermodels_goodmodel)
#define IS_DEAD_FRAME(f) ((f) == 0 || (f) == 1)
void CSQCPlayer_FallbackFrame_PreUpdate(void)
-{
+{SELFPARAM();
self.frame = self.csqcmodel_saveframe;
self.frame2 = self.csqcmodel_saveframe2;
#ifdef CSQCMODEL_HAVE_TWO_FRAMES
#endif
}
void CSQCPlayer_FallbackFrame_PostUpdate(bool isnew)
-{
+{SELFPARAM();
self.csqcmodel_saveframe = self.frame;
self.csqcmodel_saveframe2 = self.frame2;
#ifdef CSQCMODEL_HAVE_TWO_FRAMES
self.csqcmodel_isdead = IS_DEAD_FRAME(self.frame);
}
void CSQCPlayer_AnimDecide_PostUpdate(bool isnew)
-{
+{SELFPARAM();
self.csqcmodel_isdead = !!(self.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
}
int CSQCPlayer_FallbackFrame(int f)
-{
+{SELFPARAM();
if(frameduration(self.modelindex, f) > 0)
return f; // goooooood
if(frameduration(self.modelindex, 1) <= 0)
return f;
}
void CSQCPlayer_FallbackFrame_Apply(void)
-{
+{SELFPARAM();
self.frame = CSQCPlayer_FallbackFrame(self.frame);
self.frame2 = CSQCPlayer_FallbackFrame(self.frame2);
#ifdef CSQCMODEL_HAVE_TWO_FRAMES
.int tag_entity_lastmodelindex;
.int tag_index;
void CSQCModel_AutoTagIndex_Apply(void)
-{
+{SELFPARAM();
if(self.tag_entity && wasfreed(self.tag_entity))
self.tag_entity = world;
// recursive predraw call to fix issues with forcemodels and LOD if bone indexes mismatch
if(self.tag_entity.classname == "csqcmodel")
{
- entity oldself = self;
- self = self.tag_entity;
- CSQCModel_Hook_PreDraw((self.entnum >= 1 && self.entnum <= maxclients));
- self = oldself;
+ SELFCALL(self.tag_entity, CSQCModel_Hook_PreDraw((self.entnum >= 1 && self.entnum <= maxclients)));
+ SELFCALL_DONE();
}
if(self.tag_entity.modelindex != self.tag_entity_lastmodelindex)
.int csqcmodel_effects;
.int csqcmodel_modelflags;
void CSQCModel_Effects_PreUpdate(void)
-{
+{SELFPARAM();
self.effects = self.csqcmodel_effects;
self.modelflags = self.csqcmodel_modelflags;
}
void Reset_ArcBeam(void);
void CSQCModel_Effects_PostUpdate(void)
-{
+{SELFPARAM();
if (self == csqcplayer) {
if (self.csqcmodel_teleported) {
Reset_ArcBeam();
}
.int snd_looping;
void CSQCModel_Effects_Apply(void)
-{
+{SELFPARAM();
int eff = self.csqcmodel_effects & ~CSQCMODEL_EF_RESPAWNGHOST;
self.renderflags &= ~(RF_DEPTHHACK | RF_ADDITIVE | RF_FULLBRIGHT | EF_NOSHADOW | RF_USEAXIS);
.int anim_saveframe2time;
.int anim_prev_pmove_flags;
void CSQCModel_Hook_PreDraw(bool isplayer)
-{
+{SELFPARAM();
if(self.csqcmodel_predraw_run == framecount)
return;
self.csqcmodel_predraw_run = framecount;
}
void CSQCModel_Hook_PreUpdate(bool isnew, bool isplayer, bool islocalplayer)
-{
+{SELFPARAM();
// interpolate v_angle
self.iflags |= IFLAG_V_ANGLE_X;
// revert to values from server
}
void CSQCModel_Hook_PostUpdate(bool isnew, bool isplayer, bool islocalplayer)
-{
+{SELFPARAM();
// is it a player model? (shared state)
self.isplayermodel = (substring(self.model, 0, 14) == "models/player/" || substring(self.model, 0, 17) == "models/ok_player/" || (substring(self.model, 0, 16) == "models/monsters/" && (self.entnum >= 1 && self.entnum <= maxclients)));
.bool isplayermodel;
void DamageEffect_Think()
-{
+{SELFPARAM();
// if particle distribution is enabled, slow ticrate by total number of damages
if(autocvar_cl_damageeffect_distribute)
self.nextthink = time + autocvar_cl_damageeffect_ticrate * self.owner.total_damages;
}
void DamageEffect(vector hitorg, float thedamage, int type, int specnum)
-{
+{SELFPARAM();
// particle effects for players and objects damaged by weapons (eg: flames coming out of victims shot with rockets)
int nearestbone = 0;
}
void Ent_DamageInfo(float isNew)
-{
+{SELFPARAM();
float thedamage, rad, edge, thisdmg;
bool hitplayer = false;
int species, forcemul;
}
void ons_generator_ray_draw()
-{
+{SELFPARAM();
if(time < self.move_time)
return;
}
void generator_draw()
-{
+{SELFPARAM();
if(time < self.move_time)
return;
}
void generator_damage(float hp)
-{
+{SELFPARAM();
if(hp <= 0)
setmodel(self, "models/onslaught/generator_dead.md3");
else if(hp < self.max_health * 0.10)
}
void generator_construct()
-{
+{SELFPARAM();
self.netname = "Generator";
self.classname = "onslaught_generator";
.vector glowmod;
void generator_changeteam()
-{
+{SELFPARAM();
if(self.team)
{
self.glowmod = Team_ColorRGB(self.team - 1);
}
void ent_generator()
-{
+{SELFPARAM();
int sf = ReadByte();
if(sf & GSF_SETUP)
.float gravity;
void Gib_Delete()
-{
+{SELFPARAM();
remove(self);
}
}
void Gib_Touch()
-{
+{SELFPARAM();
// TODO maybe bounce of walls, make more gibs, etc.
if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
}
void Gib_Draw()
-{
+{SELFPARAM();
vector oldorg;
oldorg = self.origin;
}
void Ent_GibSplash(bool isNew)
-{
+{SELFPARAM();
int amount, type, specnum;
vector org, vel;
string specstr;
class(Hook) .float teleport_time;
void Draw_GrapplingHook()
-{
+{SELFPARAM();
vector a, b, atrans;
string tex;
vector rgb;
}
void Remove_GrapplingHook()
-{
+{SELFPARAM();
sound (self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTEN_NORM);
}
void Ent_ReadHook(float bIsNew, float type)
-{
+{SELFPARAM();
self.HookType = type;
int sf = ReadByte();
}
void HUD_Weapons(void)
-{
+{SELFPARAM();
// declarations
WepSet weapons_stat = WepSet_GetFromStat();
int i;
}
void Playerchecker_Think()
-{
+{SELFPARAM();
int i;
entity e;
for(i = 0; i < maxclients; ++i)
// BEGIN OPTIONAL CSQC FUNCTIONS
void Ent_RemoveEntCS()
-{
+{SELFPARAM();
entcs_receiver[self.sv_entnum] = world;
}
void Ent_ReadEntCS()
-{
+{SELFPARAM();
int sf;
InterpolateOrigin_Undo();
void Ent_Remove();
void Ent_RemovePlayerScore()
-{
+{SELFPARAM();
if(self.owner) {
SetTeam(self.owner, -1);
self.owner.gotscores = 0;
}
void Ent_ReadPlayerScore()
-{
+{SELFPARAM();
int i, n;
bool isNew;
entity o;
}
void Ent_ReadTeamScore()
-{
+{SELFPARAM();
int i;
entity o;
}
void Spawn_Draw(void)
-{
+{SELFPARAM();
pointparticles(self.cnt, self.origin + '0 0 28', '0 0 2', bound(0, frametime, 0.1));
}
void Ent_ReadSpawnPoint(float is_new) // entity for spawnpoint
-{
+{SELFPARAM();
float teamnum = (ReadByte() - 1);
vector spn_origin;
spn_origin.x = ReadShort();
}
void Ent_ReadSpawnEvent(float is_new)
-{
+{SELFPARAM();
// If entnum is 0, ONLY do the local spawn actions
// this way the server can disable the sending of
// spawn origin or such to clients if wanted.
void Ent_Init();
void Ent_ScoresInfo();
void CSQC_Ent_Update(float bIsNewEntity)
-{
+{SELFPARAM();
float t;
float savetime;
t = ReadByte();
// used when an entity changes its type. For an entity that someone interacts
// with others, make sure it can no longer do so.
void Ent_Remove()
-{
+{SELFPARAM();
if(self.entremove)
self.entremove();
}
// CSQC_Ent_Remove : Called when the server requests a SSQC / CSQC entity to be removed. Essentially call remove(self) as well.
void CSQC_Ent_Remove()
-{
+{SELFPARAM();
if(autocvar_developer_csqcentities)
LOG_INFOF("CSQC_Ent_Remove() with self=%i self.entnum=%d self.enttype=%d\n", self, self.entnum, self.enttype);
void Gamemode_Init();
void Ent_ScoresInfo()
-{
+{SELFPARAM();
int i;
self.classname = "ent_client_scores_info";
gametype = ReadInt24_t();
}
void Ent_Init()
-{
+{SELFPARAM();
self.classname = "ent_client_init";
nb_pb_period = ReadByte() / 32; //Accuracy of 1/32th
.float alpha;
void ModelEffect_Draw()
-{
+{SELFPARAM();
self.angles = self.angles + frametime * self.avelocity;
setorigin(self, self.origin + frametime * self.velocity);
self.scale = self.scale1 + (self.scale2 - self.scale1) * (time - self.teleport_time) / (self.lifetime + self.fadetime - self.teleport_time);
}
void Ent_ModelEffect(bool isNew)
-{
+{SELFPARAM();
self.classname = "modeleffect_spawner";
int f = ReadByte();
/** Called when a projectile is linked with CSQC */
#define EV_Ent_Projectile(i, o) \
- /** entity id */ i(entity, self) \
+ /** entity id */ i(entity, __self) \
/**/
MUTATOR_HOOKABLE(Ent_Projectile, EV_Ent_Projectile);
/** Called when a projectile's properties are being modified */
#define EV_EditProjectile(i, o) \
- /** entity id */ i(entity, self) \
+ /** entity id */ i(entity, __self) \
/**/
MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile);
/** Called when updating the attached tags index */
#define EV_TagIndex_Update(i, o) \
- /** entity id */ i(entity, self) \
+ /** entity id */ i(entity, __self) \
/**/
MUTATOR_HOOKABLE(TagIndex_Update, EV_TagIndex_Update);
/** Called when setting the attached tags */
#define EV_TagIndex_Apply(i, o) \
- /** entity id */ i(entity, self) \
+ /** entity id */ i(entity, __self) \
/**/
MUTATOR_HOOKABLE(TagIndex_Apply, EV_TagIndex_Apply);
/** Called when setting up skeleton bones */
#define EV_Skeleton_CheckBones(i, o) \
- /** entity id */ i(entity, self) \
+ /** entity id */ i(entity, __self) \
/**/
MUTATOR_HOOKABLE(Skeleton_CheckBones, EV_Skeleton_CheckBones);
/** Called when setting up bones from the loaded model */
#define EV_Skeleton_CheckModel(i, o) \
- /** entity id */ i(entity, self) \
+ /** entity id */ i(entity, __self) \
/**/
MUTATOR_HOOKABLE(Skeleton_CheckModel, EV_Skeleton_CheckModel);
/** Called checking if 3rd person mode should be forced on */
#define EV_WantEventchase(i, o) \
- /** entity id */ i(entity, self) \
+ /** entity id */ i(entity, __self) \
/**/
MUTATOR_HOOKABLE(WantEventchase, EV_WantEventchase);
}
void skeleton_from_frames(entity e, float is_dead)
-{
+{SELFPARAM();
float m = e.modelindex;
if(!e.skeletonindex)
{
// LordHavoc: rewrote this file, it was really bad code
void RubbleLimit(string cname, float limit, void() deleteproc)
-{
+{SELFPARAM();
entity e;
entity oldest;
entity oldself;
float average_accuracy;
vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
-{
+{SELFPARAM();
WepSet weapons_stat = WepSet_GetFromStat();
WepSet weapons_inmap = WepSet_GetFromStat_InMap();
float initial_posx = pos.x;
// radar links
void Ent_RadarLink()
-{
+{SELFPARAM();
int sendflags = ReadByte();
InterpolateOrigin_Undo();
}
void Ent_TubaNote_Think()
-{
+{SELFPARAM();
float f = autocvar_g_balance_tuba_fadetime;
if (f > 0) {
self.tuba_volume -= frametime * self.tuba_volume_initial / f;
}
void Ent_TubaNote_UpdateSound()
-{
+{SELFPARAM();
self.enemy.tuba_volume = bound(0, VOL_BASE * autocvar_g_balance_tuba_volume, 1);
self.enemy.tuba_volume_initial = self.enemy.tuba_volume;
self.enemy.note = self.note;
}
void Ent_TubaNote_StopSound()
-{
+{SELFPARAM();
self.enemy.nextthink = time;
self.enemy = world;
}
void Ent_TubaNote(bool isNew)
-{
+{SELFPARAM();
bool upd = false;
int f = ReadByte();
if (f & 1) {
float eventchase_current_distance;
float eventchase_running;
bool WantEventchase()
-{
+{SELFPARAM();
if(autocvar_cl_orthoview)
return false;
if(intermission)
}
void UpdateCrosshair()
-{
+{SELFPARAM();
static float rainbow_last_flicker;
static vector rainbow_prev_color;
entity e = self;
float vh_notice_time;
void WaypointSprite_Load();
void CSQC_UpdateView(float w, float h)
-{
+{SELFPARAM();
entity e;
float fov;
float f;
.vector movedir;
void Ent_Wall_PreDraw()
-{
+{SELFPARAM();
if (self.inactive)
{
self.alpha = 0;
}
void Ent_Wall_Draw()
-{
+{SELFPARAM();
float f;
var .vector fld;
}
void Ent_Wall_Remove()
-{
+{SELFPARAM();
if(self.bgmscript)
strunzone(self.bgmscript);
self.bgmscript = string_null;
}
void Ent_Wall()
-{
+{SELFPARAM();
int f;
var .vector fld;
.vector colormod;
void SUB_Stop()
-{
+{SELFPARAM();
self.move_velocity = self.move_avelocity = '0 0 0';
self.move_movetype = MOVETYPE_NONE;
}
void Projectile_ResetTrail(vector to)
-{
+{SELFPARAM();
self.trail_oldorigin = to;
self.trail_oldtime = time;
}
void Projectile_DrawTrail(vector to)
-{
+{SELFPARAM();
vector from;
float t0;
}
void Projectile_Draw()
-{
+{SELFPARAM();
vector rot;
vector trailorigin;
int f;
}
void loopsound(entity e, int ch, string samp, float vol, float attn)
-{
+{SELFPARAM();
if(self.silent)
return;
}
void Ent_RemoveProjectile()
-{
+{SELFPARAM();
if(self.count & 0x80)
{
tracebox(self.origin, self.mins, self.maxs, self.origin + self.velocity * 0.05, MOVE_NORMAL, self);
}
void Ent_Projectile()
-{
+{SELFPARAM();
int f;
// projectile properties:
void buff_Init_Compat(entity ent, entity replacement);
#define BUFF_SPAWNFUNC(e, b, t) void spawnfunc_item_buff_##e() { \
+ SELFPARAM(); \
self.buffs = b.m_itemid; \
self.team = t; \
buff_Init(self); \
BUFF_SPAWNFUNC(e##_team2, b, NUM_TEAM_2) \
BUFF_SPAWNFUNC(e##_team3, b, NUM_TEAM_3) \
BUFF_SPAWNFUNC(e##_team4, b, NUM_TEAM_4)
-#define BUFF_SPAWNFUNC_Q3TA_COMPAT(o, r) void spawnfunc_item_##o() { buff_Init_Compat(self, r); }
+#define BUFF_SPAWNFUNC_Q3TA_COMPAT(o, r) void spawnfunc_item_##o() { SELFPARAM(); buff_Init_Compat(self, r); }
BUFF_SPAWNFUNCS(resistance, BUFF_RESISTANCE)
BUFF_SPAWNFUNCS(ammo, BUFF_AMMO)
//vector PL_CROUCH_VIEW_OFS = ...;
#ifdef SVQC
-# define CSQCMODEL_AUTOINIT() CSQCModel_LinkEntity()
-# define CSQCMODEL_AUTOUPDATE() CSQCModel_CheckUpdate()
+# define CSQCMODEL_AUTOINIT(e) CSQCModel_LinkEntity(e)
+# define CSQCMODEL_AUTOUPDATE(e) CSQCModel_CheckUpdate(e)
#endif
#define CSQCMODEL_EF_RESPAWNGHOST EF_SELECTABLE
#ifdef SVQC
bool Net_Write_Effect(entity client, int sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_EFFECT);
#if EFFECTS_COUNT >= 255
WriteShort(MSG_ENTITY, self.m_id);
#ifdef SVQC
bool Inventory_Send(entity to, int sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_INVENTORY);
entity e = self.owner;
if (IS_SPEC(e)) e = e.enemy;
#define MSLE_CLEAN_Vector2D(x)
#define MSLE(Name,Fields) \
- void msle_entremove_##Name() { strunzone(self.netname); Fields }
+ void msle_entremove_##Name() { SELFPARAM(); strunzone(self.netname); Fields }
MINIGAME_SIMPLELINKED_ENTITIES
#undef MSLE
#undef FIELD
}
void minigame_entremove()
-{
+{SELFPARAM();
if ( self == active_minigame )
deactivate_minigame();
}
}
void minigame_player_entremove()
-{
+{SELFPARAM();
if ( self.owner == active_minigame && self.minigame_playerslot == player_localentnum )
deactivate_minigame();
}
Fields \
}
void minigame_read_owner()
-{
+{SELFPARAM();
string owner_name = ReadString_Raw();
self.owner = world;
do
LOG_TRACE("Got a minigame entity without a minigame!\n");
}
void ent_read_minigame()
-{
+{SELFPARAM();
float sf = ReadByte();
if ( sf & MINIG_SF_CREATE )
{
// Click the given item
void HUD_MinigameMenu_Click(entity menuitem)
-{
+{SELFPARAM();
if ( menuitem )
{
entity e = self;
// Click action for Create sub-entries
void HUD_MinigameMenu_ClickCreate_Entry()
-{
+{SELFPARAM();
minigame_cmd("create ",self.netname);
}
// Helper click action for collapsible entries
// returns true when you have to create the sub-entries
bool HUD_MinigameMenu_Click_ExpandCollapse()
-{
+{SELFPARAM();
entity e;
if ( self.flags & 2 )
{
// Click action for the Create menu
void HUD_MinigameMenu_ClickCreate()
-{
+{SELFPARAM();
if ( HUD_MinigameMenu_Click_ExpandCollapse() )
{
entity e;
// Click action for Join sub-entries
void HUD_MinigameMenu_ClickJoin_Entry()
-{
+{SELFPARAM();
minigame_cmd("join ",self.netname);
HUD_MinigameMenu_EraseEntry(self);
}
// Click action for the Join menu
void HUD_MinigameMenu_ClickJoin()
-{
+{SELFPARAM();
if ( HUD_MinigameMenu_Click_ExpandCollapse() )
{
entity e = world;
// Click action for Invite sub-entries
void HUD_MinigameMenu_ClickInvite_Entry()
-{
+{SELFPARAM();
minigame_cmd("invite #",self.netname);
}
// Click action for the Invite menu
void HUD_MinigameMenu_ClickInvite()
-{
+{SELFPARAM();
if ( HUD_MinigameMenu_Click_ExpandCollapse() )
{
entity e;
}
void HUD_MinigameMenu_ClickCustomEntry()
-{
+{SELFPARAM();
if ( active_minigame )
active_minigame.minigame_event(active_minigame,"menu_click",self.netname);
}
// Click action for the Current Game menu
void HUD_MinigameMenu_ClickCurrentGame()
-{
+{SELFPARAM();
if ( HUD_MinigameMenu_Click_ExpandCollapse() )
{
HUD_MinigameMenu_InsertEntry( HUD_MinigameMenu_SpawnSubEntry(
// Required function, handle client events
int nmm_client_event(entity minigame, string event, ...)
-{
+{SELFPARAM();
if ( event == "activate" )
{
nmm_fromtile = world;
// Think equivalent of pong_ball_throw, used to delay throws
void pong_ball_throwthink()
-{
+{SELFPARAM();
pong_ball_throw(self);
}
// Moves the ball around
void pong_ball_think()
-{
+{SELFPARAM();
float think_speed = autocvar_sys_ticrate;
self.nextthink = time + think_speed;
// AI action
void pong_ai_think()
-{
+{SELFPARAM();
float think_speed = autocvar_sv_minigames_pong_ai_thinkspeed;
self.nextthink = time + think_speed;
// Moves the paddle
void pong_paddle_think()
-{
+{SELFPARAM();
float think_speed = autocvar_sys_ticrate;
self.nextthink = time + think_speed;
// Send an entity to a client
// only use on minigame entities or entities with a minigame owner
bool minigame_SendEntity(entity to, int sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_MINIGAME);
WriteByte(MSG_ENTITY, sf);
}
bool minigame_CheckSend()
-{
+{SELFPARAM();
entity e;
for ( e = self.owner.minigame_players; e != world; e = e.list_next )
if ( e.minigame_players == other )
}
int minigame_addplayer(entity minigame_session, entity player)
-{
+{SELFPARAM();
if ( player.active_minigame )
{
if ( player.active_minigame == minigame_session )
}
bool MinigameImpulse(int imp)
-{
+{SELFPARAM();
entity e = minigame_find_player(self);
if ( imp && self.active_minigame && e )
{
void ClientCommand_minigame(int request, int argc, string command)
-{
+{SELFPARAM();
if ( !autocvar_sv_minigames )
{
sprint(self,"Minigames are not enabled!\n");
.float mage_shield_time;
float M_Mage_Defend_Heal_Check(entity e)
-{
+{SELFPARAM();
if(e == world)
return false;
if(e.health <= 0)
}
void M_Mage_Attack_Spike_Explode()
-{
+{SELFPARAM();
self.event_damage = func_null;
sound(self, CH_SHOTS, W_Sound("grenade_impact"), VOL_BASE, ATTEN_NORM);
// copied from W_Seeker_Think
void M_Mage_Attack_Spike_Think()
-{
+{SELFPARAM();
entity e;
vector desireddir, olddir, newdir, eorg;
float turnrate;
}
void M_Mage_Attack_Spike()
-{
+{SELFPARAM();
entity missile;
vector dir = normalize((self.enemy.origin + '0 0 10') - self.origin);
}
void M_Mage_Defend_Heal()
-{
+{SELFPARAM();
entity head;
float washealed = false;
}
void M_Mage_Attack_Push()
-{
+{SELFPARAM();
sound(self, CH_SHOTS, W_Sound("tagexp1"), 1, ATTEN_NORM);
RadiusDamage (self, self, (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_damage), (autocvar_g_monster_mage_attack_push_radius), world, world, (autocvar_g_monster_mage_attack_push_force), DEATH_MONSTER_MAGE, self.enemy);
Send_Effect(EFFECT_TE_EXPLOSION, self.origin, '0 0 0', 1);
}
void M_Mage_Attack_Teleport()
-{
+{SELFPARAM();
if(vlen(self.enemy.origin - self.origin) >= 500)
return;
}
void M_Mage_Defend_Shield_Remove()
-{
+{SELFPARAM();
self.effects &= ~(EF_ADDITIVE | EF_BLUE);
self.armorvalue = autocvar_g_monsters_armor_blockpercent;
}
void M_Mage_Defend_Shield()
-{
+{SELFPARAM();
self.effects |= (EF_ADDITIVE | EF_BLUE);
self.mage_shield_delay = time + (autocvar_g_monster_mage_shield_delay);
self.armorvalue = (autocvar_g_monster_mage_shield_blockpercent);
}
float M_Mage_Attack(float attack_type)
-{
+{SELFPARAM();
switch(attack_type)
{
case MONSTER_ATTACK_MELEE:
#endif // SVQC
bool M_Mage(int req)
-{
+{SELFPARAM();
switch(req)
{
#ifdef SVQC
.float shambler_lastattack; // delay attacks separately
void M_Shambler_Attack_Smash()
-{
+{SELFPARAM();
makevectors(self.angles);
Send_Effect(EFFECT_EXPLOSION_MEDIUM, (self.origin + (v_forward * 150)) - ('0 0 1' * self.maxs.z), '0 0 0', 1);
sound(self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM);
}
void M_Shambler_Attack_Swing()
-{
+{SELFPARAM();
float r = (random() < 0.5);
if(r && Monster_Attack_Melee(self.enemy, (autocvar_g_monster_shambler_attack_claw_damage), ((r) ? self.anim_melee2 : self.anim_melee3), self.attack_range, 0.8, DEATH_MONSTER_SHAMBLER_CLAW, true))
{
}
void M_Shambler_Attack_Lightning_Explode()
-{
+{SELFPARAM();
entity head;
sound(self, CH_SHOTS, W_Sound("electro_impact"), VOL_BASE, ATTEN_NORM);
}
void M_Shambler_Attack_Lightning_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
if (self.health <= 0)
return;
}
void M_Shambler_Attack_Lightning_Touch()
-{
+{SELFPARAM();
PROJECTILE_TOUCH;
self.use ();
}
void M_Shambler_Attack_Lightning_Think()
-{
+{SELFPARAM();
self.nextthink = time;
if (time > self.cnt)
{
}
void M_Shambler_Attack_Lightning()
-{
+{SELFPARAM();
entity gren;
monster_makevectors(self.enemy);
}
float M_Shambler_Attack(float attack_type)
-{
+{SELFPARAM();
switch(attack_type)
{
case MONSTER_ATTACK_MELEE:
#endif // SVQC
bool M_Shambler(int req)
-{
+{SELFPARAM();
switch(req)
{
#ifdef SVQC
.float spider_web_delay;
void M_Spider_Attack_Web_Explode()
-{
+{SELFPARAM();
entity e;
if(self)
{
}
void M_Spider_Attack_Web()
-{
+{SELFPARAM();
monster_makevectors(self.enemy);
sound(self, CH_SHOTS, W_Sound("electro_fire2"), VOL_BASE, ATTEN_NORM);
}
bool M_Spider_Attack(int attack_type)
-{
+{SELFPARAM();
switch(attack_type)
{
case MONSTER_ATTACK_MELEE:
#endif // SVQC
bool M_Spider(int req)
-{
+{SELFPARAM();
switch(req)
{
#ifdef SVQC
*/
void M_Wyvern_Attack_Fireball_Explode()
-{
+{SELFPARAM();
entity e;
if(self)
{
}
void M_Wyvern_Attack_Fireball()
-{
+{SELFPARAM();
entity missile = spawn();
vector dir = normalize((self.enemy.origin + '0 0 10') - self.origin);
}
float M_Wyvern_Attack(float attack_type)
-{
+{SELFPARAM();
switch(attack_type)
{
case MONSTER_ATTACK_MELEE:
#endif // SVQC
bool M_Wyvern(int req)
-{
+{SELFPARAM();
switch(req)
{
#ifdef SVQC
*/
void M_Zombie_Attack_Leap_Touch()
-{
+{SELFPARAM();
if (self.health <= 0)
return;
}
void M_Zombie_Defend_Block_End()
-{
+{SELFPARAM();
if(self.health <= 0)
return;
}
float M_Zombie_Defend_Block()
-{
+{SELFPARAM();
self.armorvalue = 0.9;
self.state = MONSTER_ATTACK_MELEE; // freeze monster
self.attack_finished_single = time + 2.1;
}
float M_Zombie_Attack(float attack_type)
-{
+{SELFPARAM();
switch(attack_type)
{
case MONSTER_ATTACK_MELEE:
#endif // SVQC
bool M_Zombie(int req)
-{
+{SELFPARAM();
switch(req)
{
#ifdef SVQC
#include "../../server/defs.qh"
#endif
entity spawnmonster (string monster, float monster_id, entity spawnedby, entity own, vector orig, float respwn, float invincible, float moveflag)
-{
+{SELFPARAM();
float i;
entity e = spawn();
#endif
void monsters_setstatus()
-{
+{SELFPARAM();
self.stat_monsters_total = monsters_total;
self.stat_monsters_killed = monsters_killed;
}
void monster_dropitem()
-{
+{SELFPARAM();
if(!self.candrop || !self.monster_loot)
return;
}
void monster_makevectors(entity e)
-{
+{SELFPARAM();
if(IS_MONSTER(self))
{
vector v;
// ===============
bool Monster_ValidTarget(entity mon, entity player)
-{
+{SELFPARAM();
// ensure we're not checking nonexistent monster/target
if(!mon || !player) { return false; }
}
void Monster_Delay_Action()
-{
+{SELFPARAM();
entity oldself = self;
self = self.owner;
if(Monster_ValidTarget(self, self.enemy)) { oldself.use(); }
}
void Monster_Delay(float repeat_count, float repeat_defer, float defer_amnt, void() func)
-{
+{SELFPARAM();
// deferred attacking, checks if monster is still alive and target is still valid before attacking
entity e = spawn();
}
void Monster_Sounds_Precache()
-{
+{SELFPARAM();
string m = (get_monsterinfo(self.monsterid)).model;
float globhandle, n, i;
string f;
}
void Monster_Sounds_Clear()
-{
+{SELFPARAM();
#define _MSOUND(m) if(self.monstersound_##m) { strunzone(self.monstersound_##m); self.monstersound_##m = string_null; }
ALLMONSTERSOUNDS
#undef _MSOUND
}
bool Monster_Sounds_Load(string f, int first)
-{
+{SELFPARAM();
float fh;
string s;
var .string field;
.int skin_for_monstersound;
void Monster_Sounds_Update()
-{
+{SELFPARAM();
if(self.skin == self.skin_for_monstersound) { return; }
self.skin_for_monstersound = self.skin;
}
void Monster_Sound(.string samplefield, float sound_delay, float delaytoo, float chan)
-{
+{SELFPARAM();
if(!autocvar_g_monsters_sounds) { return; }
if(delaytoo)
// =======================
float Monster_Attack_Melee(entity targ, float damg, vector anim, float er, float animtime, int deathtype, float dostop)
-{
+{SELFPARAM();
if(dostop && (self.flags & FL_MONSTER)) { self.state = MONSTER_ATTACK_MELEE; }
setanim(self, anim, false, true, false);
}
float Monster_Attack_Leap_Check(vector vel)
-{
+{SELFPARAM();
if(self.state && (self.flags & FL_MONSTER))
return false; // already attacking
if(!(self.flags & FL_ONGROUND))
}
bool Monster_Attack_Leap(vector anm, void() touchfunc, vector vel, float animtime)
-{
+{SELFPARAM();
if(!Monster_Attack_Leap_Check(vel))
return false;
// ======================
void Monster_UpdateModel()
-{
+{SELFPARAM();
// assume some defaults
/*self.anim_idle = animfixfps(self, '0 1 0.01', '0 0 0');
self.anim_walk = animfixfps(self, '1 1 0.01', '0 0 0');
}
void Monster_Touch()
-{
+{SELFPARAM();
if(other == world) { return; }
if(other.monster_attack)
}
void Monster_Miniboss_Check()
-{
+{SELFPARAM();
if(MUTATOR_CALLHOOK(MonsterCheckBossFlag))
return;
}
bool Monster_Respawn_Check()
-{
+{SELFPARAM();
if(self.deadflag == DEAD_DEAD) // don't call when monster isn't dead
if(MUTATOR_CALLHOOK(MonsterRespawn, self))
return true; // enabled by a mutator
return true;
}
-void Monster_Respawn() { Monster_Spawn(self.monsterid); }
+void Monster_Respawn() { SELFPARAM(); Monster_Spawn(self.monsterid); }
void Monster_Dead_Fade()
-{
+{SELFPARAM();
if(Monster_Respawn_Check())
{
self.spawnflags |= MONSTERFLAG_RESPAWNED;
}
void Monster_Use()
-{
+{SELFPARAM();
if(Monster_ValidTarget(self, activator)) { self.enemy = activator; }
}
vector Monster_Move_Target(entity targ)
-{
+{SELFPARAM();
// enemy is always preferred target
if(self.enemy)
{
}
void Monster_CalculateVelocity(entity mon, vector to, vector from, float turnrate, float movespeed)
-{
+{SELFPARAM();
float current_distance = vlen((('1 0 0' * to.x) + ('0 1 0' * to.y)) - (('1 0 0' * from.x) + ('0 1 0' * from.y))); // for the sake of this check, exclude Z axis
float initial_height = 0; //min(50, (targ_distance * tanh(20)));
float current_height = (initial_height * min(1, (self.pass_distance) ? (current_distance / self.pass_distance) : current_distance));
}
void Monster_Move(float runspeed, float walkspeed, float stpspeed)
-{
+{SELFPARAM();
if(self.target2) { self.goalentity = find(world, targetname, self.target2); }
entity targ;
}
void Monster_Dead_Think()
-{
+{SELFPARAM();
self.nextthink = time + self.ticrate;
if(self.monster_lifetime != 0)
}
void Monster_Appear()
-{
+{SELFPARAM();
self.enemy = activator;
self.spawnflags &= ~MONSTERFLAG_APPEAR; // otherwise, we get an endless loop
Monster_Spawn(self.monsterid);
}
void Monster_Reset()
-{
+{SELFPARAM();
setorigin(self, self.pos1);
self.angles = self.pos2;
}
void Monster_Dead_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
self.health -= damage;
Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, self, attacker);
}
void Monster_Dead(entity attacker, float gibbed)
-{
+{SELFPARAM();
self.think = Monster_Dead_Think;
self.nextthink = time;
self.monster_lifetime = time + 5;
}
void Monster_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
if((self.spawnflags & MONSTERFLAG_INVINCIBLE) && deathtype != DEATH_KILL)
return;
// don't check for enemies, just keep walking in a straight line
void Monster_Move_2D(float mspeed, float allow_jumpoff)
-{
+{SELFPARAM();
if(gameover || (round_handler_IsActive() && !round_handler_IsRoundStarted()) || self.draggedby != world || time < game_starttime || (autocvar_g_campaign && !campaign_bots_may_start) || time < self.spawn_time)
{
mspeed = 0;
}
void Monster_Anim()
-{
+{SELFPARAM();
int deadbits = (self.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
if(self.deadflag)
{
}
void Monster_Think()
-{
+{SELFPARAM();
self.think = Monster_Think;
self.nextthink = self.ticrate;
Monster_Anim();
- CSQCMODEL_AUTOUPDATE();
+ CSQCMODEL_AUTOUPDATE(self);
}
float Monster_Spawn_Setup()
-{
+{SELFPARAM();
MON_ACTION(self.monsterid, MR_SETUP);
// ensure some basic needs are met
}
bool Monster_Spawn(int mon_id)
-{
+{SELFPARAM();
// setup the basic required properties for a monster
entity mon = get_monsterinfo(mon_id);
if(!mon.monsterid) { return false; } // invalid monster
if(!(self.spawnflags & MONSTERFLAG_RESPAWNED))
monster_setupcolors(self);
- CSQCMODEL_AUTOINIT();
+ CSQCMODEL_AUTOINIT(self);
return true;
}
void _Movetype_Physics_Follow() // SV_Physics_Follow
-{
+{SELFPARAM();
entity e = self.move_aiment; // TODO: networking?
// LordHavoc: implemented rotation on MOVETYPE_FOLLOW objects
vector planes[MAX_CLIP_PLANES];
int _Movetype_FlyMove(float dt, bool applygravity, vector stepnormal, float stepheight) // SV_FlyMove
-{
+{SELFPARAM();
int blocked = 0, bumpcount;
int i, j, numplanes = 0;
float time_left = dt, grav = 0;
}
void _Movetype_Impact(entity oth) // SV_Impact
-{
+{SELFPARAM();
entity oldself = self;
entity oldother = other;
}
void _Movetype_LinkEdict_TouchAreaGrid() // SV_LinkEdict_TouchAreaGrid
-{
+{SELFPARAM();
entity oldself = self;
entity oldother = other;
}
void _Movetype_LinkEdict(bool touch_triggers) // SV_LinkEdict
-{
+{SELFPARAM();
vector mi, ma;
if(self.solid == SOLID_BSP)
{
}
bool _Movetype_TestEntityPosition(vector ofs) // SV_TestEntityPosition
-{
+{SELFPARAM();
// vector org = self.move_origin + ofs;
int cont = self.dphitcontentsmask;
}
bool _Movetype_UnstickEntity() // SV_UnstickEntity
-{
+{SELFPARAM();
if(!_Movetype_TestEntityPosition('0 0 0')) return true;
if(!_Movetype_TestEntityPosition('-1 0 0')) goto success;
if(!_Movetype_TestEntityPosition('1 0 0')) goto success;
}
void _Movetype_PushEntityTrace(vector push)
-{
+{SELFPARAM();
vector end = self.move_origin + push;
int type;
if(self.move_nomonsters)
}
float _Movetype_PushEntity(vector push, bool failonstartsolid) // SV_PushEntity
-{
+{SELFPARAM();
_Movetype_PushEntityTrace(push);
if(trace_startsolid && failonstartsolid)
}
void _Movetype_Physics_Frame(float movedt)
-{
+{SELFPARAM();
self.move_didgravity = -1;
switch (self.move_movetype)
{
}
void Movetype_Physics_NoMatchServer() // optimized
-{
+{SELFPARAM();
float movedt = time - self.move_time;
self.move_time = time;
}
void Movetype_Physics_MatchTicrate(float tr, bool sloppy) // SV_Physics_Entity
-{
+{SELFPARAM();
if(tr <= 0)
{
Movetype_Physics_NoMatchServer();
void _Movetype_PushMove(float dt) // SV_PushMove
-{
+{SELFPARAM();
if (self.move_velocity == '0 0 0' && self.move_avelocity == '0 0 0')
{
self.move_ltime += dt;
}
void _Movetype_Physics_Pusher(float dt) // SV_Physics_Pusher
-{
+{SELFPARAM();
float oldltime = self.move_ltime;
float thinktime = self.move_nextthink;
float movetime;
void _Movetype_Physics_Step(float dt) // SV_Physics_Step
-{
+{SELFPARAM();
if(self.move_flags & FL_ONGROUND)
{
if(self.velocity_z >= (1.0 / 32.0) && UPWARD_VELOCITY_CLEARS_ONGROUND)
#include "../physics.qh"
void _Movetype_Physics_Toss(float dt) // SV_Physics_Toss
-{
+{SELFPARAM();
if (self.move_flags & FL_ONGROUND)
{
if (self.move_velocity.z >= 1 / 32)
void _Movetype_Physics_Walk(float dt) // SV_WalkMove
-{
+{SELFPARAM();
vector stepnormal = '0 0 0';
// if frametime is 0 (due to client sending the same timestamp twice), don't move
#ifdef SVQC
void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float randomavel, int casingtype, entity casingowner)
-{
+{SELFPARAM();
vector org = self.origin + self.view_ofs + self.weaponentity.spawnorigin.x * v_forward - self.weaponentity.spawnorigin.y * v_right + self.weaponentity.spawnorigin.z * v_up;
if (!sound_allowed(MSG_BROADCAST, casingowner))
class(Casing) .float cnt;
void Casing_Delete()
-{
+{SELFPARAM();
remove(self);
}
void Casing_Draw()
-{
+{SELFPARAM();
if (self.move_flags & FL_ONGROUND)
{
self.move_angles_x = 0;
}
void Casing_Touch()
-{
+{SELFPARAM();
if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
{
Casing_Delete();
}
void Casing_Damage(float thisdmg, int hittype, vector org, vector thisforce)
-{
+{SELFPARAM();
if (thisforce.z < 0)
thisforce.z = 0;
self.move_velocity = self.move_velocity + thisforce + '0 0 100';
ATTRIB(DamageText, time_prev, float, time)
void DamageText_draw() {
- entity this = self;
+ SELFPARAM();
float dt = time - this.time_prev;
this.time_prev = time;
setorigin(this, this.origin + dt * this.velocity);
return t;
}
-MUTATOR_HOOKFUNCTION(itemstime, reset_map_global) {
+MUTATOR_HOOKFUNCTION(itemstime, reset_map_global)
+{SELFPARAM();
Item_ItemsTime_ResetTimes();
// ALL the times need to be reset before .reset()ing each item
// since Item_Reset schedules respawn of superweapons and powerups
Item_ItemsTime_SetTimesForAllPlayers();
}
-MUTATOR_HOOKFUNCTION(itemstime, MakePlayerObserver) {
+MUTATOR_HOOKFUNCTION(itemstime, MakePlayerObserver)
+{SELFPARAM();
Item_ItemsTime_SetTimesForPlayer(self);
}
-MUTATOR_HOOKFUNCTION(itemstime, PlayerSpawn) {
+MUTATOR_HOOKFUNCTION(itemstime, PlayerSpawn)
+{SELFPARAM();
if (warmup_stage) return;
Item_ItemsTime_ResetTimesForPlayer(self);
}
#ifdef SVQC
/** flags origin [team displayrule] [spritename] [spritename2] [spritename3] [lifetime maxdistance hideable] */
float WaypointSprite_SendEntity(entity to, float sendflags)
-{
+{SELFPARAM();
WriteMutator(MSG_ENTITY, waypointsprites);
sendflags = sendflags & 0x7F;
}
void Ent_RemoveWaypointSprite()
-{
+{SELFPARAM();
if (self.netname) strunzone(self.netname);
if (self.netname2) strunzone(self.netname2);
if (self.netname3) strunzone(self.netname3);
/** flags origin [team displayrule] [spritename] [spritename2] [spritename3] [lifetime maxdistance hideable] */
void Ent_WaypointSprite()
-{
+{SELFPARAM();
int sendflags = ReadByte();
self.wp_extra = ReadByte();
#ifdef CSQC
float spritelookupblinkvalue(string s)
-{
+{SELFPARAM();
if (s == WP_Weapon.netname) {
if (get_weaponinfo(self.wp_extra).spawnflags & WEP_FLAG_SUPERWEAPON)
return 2;
}
vector spritelookupcolor(string s, vector def)
-{
+{SELFPARAM();
if (s == WP_Weapon.netname) return get_weaponinfo(self.wp_extra).wpcolor;
if (s == WP_Item.netname) return ITEMS[self.wp_extra].m_color;
if (s == WP_Buff.netname) return BUFFS[self.wp_extra].m_color;
}
string spritelookuptext(string s)
-{
+{SELFPARAM();
if (s == WP_RaceStartFinish.netname) return (race_checkpointtime || race_mycheckpointtime) ? _("Finish") : _("Start");
if (s == WP_Weapon.netname) return get_weaponinfo(self.wp_extra).message;
if (s == WP_Item.netname) return ITEMS[self.wp_extra].m_waypoint;
}
void Draw_WaypointSprite()
-{
+{SELFPARAM();
if (self.lifetime)
self.alpha = pow(bound(0, (self.fadetime - time) / self.lifetime, 1), waypointsprite_timealphaexponent);
else
}
void WaypointSprite_Think()
-{
+{SELFPARAM();
bool doremove = false;
if (self.fade_time && time >= self.teleport_time)
}
float WaypointSprite_visible_for_player(entity e)
-{
+{SELFPARAM();
// personal waypoints
if (self.enemy && self.enemy != e)
return false;
}
float WaypointSprite_Customize()
-{
+{SELFPARAM();
// this is not in SendEntity because it shall run every frame, not just every update
// make spectators see what the player would see
float WaypointSprite_SendEntity(entity to, float sendflags);
void WaypointSprite_Reset()
-{
+{SELFPARAM();
// if a WP wants to time out, let it time out immediately; other WPs ought to be reset/killed by their owners
if (self.fade_time) // there was there before: || g_keyhunt, do we really need this?
vector ofs,
float icon // initial icon
)
-{
+{SELFPARAM();
float t;
if (teamplay)
t = self.team;
vector ofs,
float icon // initial icon
)
-{
+{SELFPARAM();
return WaypointSprite_Spawn(spr, 0, 0, world, ofs, world, 0, self, waypointsprite_deployed_personal, false, icon);
}
float limited_range,
float icon // initial icon
)
-{
+{SELFPARAM();
float t;
if (self.waypointsprite_attachedforcarrier)
return world; // can't attach to FC
}
void WaypointSprite_ClearPersonal()
-{
+{SELFPARAM();
WaypointSprite_Kill(self.waypointsprite_deployed_personal);
}
void WaypointSprite_ClearOwned()
-{
+{SELFPARAM();
WaypointSprite_Kill(self.waypointsprite_deployed_fixed);
WaypointSprite_Kill(self.waypointsprite_deployed_personal);
WaypointSprite_Kill(self.waypointsprite_attached);
}
void WaypointSprite_PlayerDead()
-{
+{SELFPARAM();
WaypointSprite_Disown(self.waypointsprite_attached, waypointsprite_deadlifetime);
WaypointSprite_DetachCarrier(self);
}
void WaypointSprite_PlayerGone()
-{
+{SELFPARAM();
WaypointSprite_Disown(self.waypointsprite_deployed_fixed, waypointsprite_deadlifetime);
WaypointSprite_Kill(self.waypointsprite_deployed_personal);
WaypointSprite_Disown(self.waypointsprite_attached, waypointsprite_deadlifetime);
#ifdef SVQC
float healer_send(entity to, int sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_HEALING_ORB);
WriteByte(MSG_ENTITY, sf);
#ifdef CSQC
.float ltime;
void healer_draw()
-{
+{SELFPARAM();
float dt = time - self.move_time;
self.move_time = time;
if(dt <= 0)
}
void healer_setup()
-{
+{SELFPARAM();
setmodel(self, "models/ctf/shield.md3");
setorigin(self, self.origin);
}
void ent_healer()
-{
+{SELFPARAM();
int sf = ReadByte();
if(sf & TNSF_SETUP)
#ifdef SVQC
void sv_notice_join_think()
-{
+{SELFPARAM();
//NextLevel();
float argc = tokenizebyseparator(autocvar_sv_join_notices, "|");
if(argc > 0)
}
void sv_notice_join()
-{
+{SELFPARAM();
// to-do: make sv_join_notices support per-entry times
if(autocvar_sv_join_notices == "")
return;
#ifdef SVQC
void Net_Notification_Remove()
-{
+{SELFPARAM();
if (!self) { backtrace(sprintf("Net_Notification_Remove() at %f: Missing self!?\n", time)); return; }
#ifdef NOTIFICATIONS_DEBUG
}
float Net_Write_Notification(entity client, int sf)
-{
+{SELFPARAM();
if(Notification_ShouldSend(self.nent_broadcast, client, self.nent_client))
{
WriteByte(MSG_ENTITY, ENT_CLIENT_NOTIFICATION);
}
void Physics_UpdateStats(float maxspd_mod)
-{
+{SELFPARAM();
// blah
self.stat_pl_view_ofs = PL_VIEW_OFS;
self.stat_pl_crouch_view_ofs = PL_CROUCH_VIEW_OFS;
};
void PM_ClientMovement_Unstick()
-{
+{SELFPARAM();
float i;
for (i = 0; i < unstick_count; i++)
{
}
void PM_ClientMovement_UpdateStatus(bool ground)
-{
+{SELFPARAM();
// make sure player is not stuck
PM_ClientMovement_Unstick();
}
void PM_ClientMovement_Move()
-{
+{SELFPARAM();
#ifdef CSQC
int bump;
float t;
}
void CPM_PM_Aircontrol(vector wishdir, float wishspeed)
-{
+{SELFPARAM();
float k = 32 * (2 * IsMoveInDirection(self.movement, 0) - 1);
if (k <= 0)
return;
// prvm_globalset server speedclamp_mode 1
// (or 2)
void PM_Accelerate(vector wishdir, float wishspeed, float wishspeed0, float accel, float accelqw, float stretchfactor, float sidefric, float speedlimit)
-{
+{SELFPARAM();
float speedclamp = stretchfactor > 0 ? stretchfactor
: accelqw < 0 ? 1 // full clamping, no stretch
: -1; // no clamping
}
void PM_AirAccelerate(vector wishdir, float wishspeed)
-{
+{SELFPARAM();
if (wishspeed == 0)
return;
=============
*/
bool PlayerJump (void)
-{
+{SELFPARAM();
if (PHYS_FROZEN(self))
return true; // no jumping in freezetag when frozen
}
void CheckWaterJump()
-{
+{SELFPARAM();
// check for a jump-out-of-water
makevectors(self.v_angle);
vector start = self.origin;
// Hack: shouldn't need to know about this
.float multijump_count;
void CheckPlayerJump()
-{
+{SELFPARAM();
#ifdef SVQC
float was_flying = ITEMS_STAT(self) & IT_USING_JETPACK;
#endif
}
void RaceCarPhysics()
-{
+{SELFPARAM();
#ifdef SVQC
// using this move type for "big rigs"
// the engine does not push the entity!
}
void PM_check_race_movetime(void)
-{
+{SELFPARAM();
#ifdef SVQC
self.race_movetime_frac += PHYS_INPUT_TIMELENGTH;
float f = floor(self.race_movetime_frac);
}
float PM_check_specialcommand(float buttons)
-{
+{SELFPARAM();
#ifdef SVQC
string c;
if (!buttons)
}
void PM_check_nickspam(void)
-{
+{SELFPARAM();
#ifdef SVQC
if (time >= self.nickspamtime)
return;
}
void PM_check_punch()
-{
+{SELFPARAM();
#ifdef SVQC
if (self.punchangle != '0 0 0')
{
}
void PM_check_spider(void)
-{
+{SELFPARAM();
#ifdef SVQC
if (time >= self.spider_slowness)
return;
// predict frozen movement, as frozen players CAN move in some cases
void PM_check_frozen(void)
-{
+{SELFPARAM();
if (!PHYS_FROZEN(self))
return;
if (PHYS_DODGING_FROZEN
}
void PM_check_hitground()
-{
+{SELFPARAM();
#ifdef SVQC
if (IS_ONGROUND(self))
if (IS_PLAYER(self)) // no fall sounds for observers thank you very much
}
void PM_check_blocked(void)
-{
+{SELFPARAM();
#ifdef SVQC
if (!self.player_blocked)
return;
float speedaward_lastupdate;
#endif
void PM_check_race(void)
-{
+{SELFPARAM();
#ifdef SVQC
if(!(g_cts || g_race))
return;
}
void PM_check_vortex(void)
-{
+{SELFPARAM();
#ifdef SVQC
// WEAPONTODO
float xyspeed = vlen(vec2(self.velocity));
}
void PM_fly(float maxspd_mod)
-{
+{SELFPARAM();
// noclipping or flying
UNSET_ONGROUND(self);
}
void PM_swim(float maxspd_mod)
-{
+{SELFPARAM();
// swimming
UNSET_ONGROUND(self);
}
void PM_ladder(float maxspd_mod)
-{
+{SELFPARAM();
// on a spawnfunc_func_ladder or swimming in spawnfunc_func_water
UNSET_ONGROUND(self);
}
void PM_jetpack(float maxspd_mod)
-{
+{SELFPARAM();
//makevectors(self.v_angle.y * '0 1 0');
makevectors(self.v_angle);
vector wishvel = v_forward * self.movement_x
}
void PM_walk(float buttons_prev, float maxspd_mod)
-{
+{SELFPARAM();
if (!WAS_ONGROUND(self))
{
#ifdef SVQC
}
void PM_air(float buttons_prev, float maxspd_mod)
-{
+{SELFPARAM();
makevectors(self.v_angle.y * '0 1 0');
vector wishvel = v_forward * self.movement.x
+ v_right * self.movement.y;
}
void PM_Main()
-{
+{SELFPARAM();
int buttons = PHYS_INPUT_BUTTON_MASK(self);
#ifdef CSQC
self.items = getstati(STAT_ITEMS, 0, 24);
#elif defined(CSQC)
void CSQC_ClientMovement_PlayerMove_Frame(void)
#endif
-{
+{SELFPARAM();
PM_Main();
#ifdef CSQC
#ifdef SVQC
.float height;
void func_bobbing_controller_think()
-{
+{SELFPARAM();
vector v;
self.nextthink = time + 0.1;
dmgtime : See above.
*/
void spawnfunc_func_bobbing()
-{
+{SELFPARAM();
entity controller;
if (self.noise != "")
{
// - basically func_assault_destructible for general gameplay use
//
void LaunchDebris (string debrisname, vector force)
-{
+{SELFPARAM();
entity dbr = spawn();
setorigin(dbr, self.absmin
+ '1 0 0' * random() * (self.absmax.x - self.absmin.x)
}
void func_breakable_colormod()
-{
+{SELFPARAM();
float h;
if (!(self.spawnflags & 2))
return;
else
self.colormod = '1 1 1';
- CSQCMODEL_AUTOUPDATE();
+ CSQCMODEL_AUTOUPDATE(self);
}
void func_breakable_look_destroyed()
-{
+{SELFPARAM();
float floorZ;
if(self.solid == SOLID_BSP) // in case a misc_follow moved me, save the current origin first
self.effects &= ~EF_NODRAW;
}
- CSQCMODEL_AUTOUPDATE();
+ CSQCMODEL_AUTOUPDATE(self);
self.solid = SOLID_NOT;
}
void func_breakable_look_restore()
-{
+{SELFPARAM();
setmodel(self, self.mdl);
self.effects &= ~EF_NODRAW;
if(self.mdl_dead != "") // only do this if we use mdl_dead, to behave better with misc_follow
setorigin(self, self.dropped_origin);
- CSQCMODEL_AUTOUPDATE();
+ CSQCMODEL_AUTOUPDATE(self);
self.solid = SOLID_BSP;
}
void func_breakable_behave_destroyed()
-{
+{SELFPARAM();
self.health = self.max_health;
self.takedamage = DAMAGE_NO;
self.bot_attack = false;
}
void func_breakable_behave_restore()
-{
+{SELFPARAM();
self.health = self.max_health;
if(self.sprite)
{
}
void func_breakable_init_for_player(entity player)
-{
+{SELFPARAM();
if (self.noise1 && self.state == 0 && clienttype(player) == CLIENTTYPE_REAL)
{
msg_entity = player;
}
void func_breakable_destroyed()
-{
+{SELFPARAM();
func_breakable_look_destroyed();
func_breakable_behave_destroyed();
- CSQCMODEL_AUTOUPDATE();
+ CSQCMODEL_AUTOUPDATE(self);
}
void func_breakable_restore()
-{
+{SELFPARAM();
func_breakable_look_restore();
func_breakable_behave_restore();
- CSQCMODEL_AUTOUPDATE();
+ CSQCMODEL_AUTOUPDATE(self);
}
vector debrisforce; // global, set before calling this
-void func_breakable_destroy() {
+void func_breakable_destroy()
+{SELFPARAM();
float n, i;
string oldmsg;
}
void func_breakable_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
if(self.state == 1)
return;
if(self.spawnflags & DOOR_NOSPLASH)
}
void func_breakable_reset()
-{
+{SELFPARAM();
self.team = self.team_saved;
func_breakable_look_restore();
if(self.spawnflags & 1)
else
func_breakable_behave_restore();
- CSQCMODEL_AUTOUPDATE();
+ CSQCMODEL_AUTOUPDATE(self);
}
// destructible walls that can be used to trigger target_objective_decrease
void spawnfunc_func_breakable()
-{
+{SELFPARAM();
float n, i;
if(!self.health)
self.health = 100;
self.init_for_player_needed = 1;
self.init_for_player = func_breakable_init_for_player;
- CSQCMODEL_AUTOINIT();
+ CSQCMODEL_AUTOINIT(self);
}
// for use in maps with a "model" key set
void() button_return;
void button_wait()
-{
+{SELFPARAM();
self.state = STATE_TOP;
self.SUB_NEXTTHINK = self.SUB_LTIME + self.wait;
self.SUB_THINK = button_return;
}
void button_done()
-{
+{SELFPARAM();
self.state = STATE_BOTTOM;
}
void button_return()
-{
+{SELFPARAM();
self.state = STATE_DOWN;
SUB_CalcMove (self.pos1, TSPEED_LINEAR, self.speed, button_done);
self.frame = 0; // use normal textures
void button_fire()
-{
+{SELFPARAM();
self.health = self.max_health;
self.takedamage = DAMAGE_NO; // will be reset upon return
}
void button_reset()
-{
+{SELFPARAM();
self.health = self.max_health;
setorigin(self, self.pos1);
self.frame = 0; // use normal textures
}
void button_use()
-{
+{SELFPARAM();
if(self.active != ACTIVE_ACTIVE)
return;
}
void button_touch()
-{
+{SELFPARAM();
if (!other)
return;
if (!other.iscreature)
}
void button_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
if(self.spawnflags & DOOR_NOSPLASH)
if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH))
return;
3) in-out
*/
void spawnfunc_func_button()
-{
+{SELFPARAM();
SetMovedir ();
if (!InitMovingBrushTrigger())
void conveyor_think()
-{
+{SELFPARAM();
#ifdef CSQC
// TODO: check if this is what is causing the glitchiness when switching between them
float dt = time - self.move_time;
#ifdef SVQC
void conveyor_use()
-{
+{SELFPARAM();
self.state = !self.state;
self.SendFlags |= 2;
}
void conveyor_reset()
-{
+{SELFPARAM();
self.state = (self.spawnflags & 1);
self.SendFlags |= 2;
}
bool conveyor_send(entity to, int sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_CONVEYOR);
WriteByte(MSG_ENTITY, sf);
}
void conveyor_init()
-{
+{SELFPARAM();
if (!self.speed)
self.speed = 200;
self.movedir = self.movedir * self.speed;
}
void spawnfunc_func_conveyor()
-{
+{SELFPARAM();
SetMovedir();
InitMovingBrushTrigger();
self.movetype = MOVETYPE_NONE;
#elif defined(CSQC)
void conveyor_init()
-{
+{SELFPARAM();
self.draw = conveyor_think;
self.drawmask = MASK_NORMAL;
}
void ent_conveyor()
-{
+{SELFPARAM();
float sf = ReadByte();
if(sf & 1)
void() door_rotating_go_up;
void door_blocked()
-{
+{SELFPARAM();
if((self.spawnflags & 8)
#ifdef SVQC
&& (other.takedamage != DAMAGE_NO)
}
void door_hit_top()
-{
+{SELFPARAM();
if (self.noise1 != "")
sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
self.state = STATE_TOP;
}
void door_hit_bottom()
-{
+{SELFPARAM();
if (self.noise1 != "")
sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
self.state = STATE_BOTTOM;
}
void door_go_down()
-{
+{SELFPARAM();
if (self.noise2 != "")
sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
if (self.max_health)
}
void door_go_up()
-{
+{SELFPARAM();
if (self.state == STATE_UP)
return; // already going up
*/
float door_check_keys(void)
-{
+{SELFPARAM();
local entity door;
}
void door_fire()
-{
+{SELFPARAM();
entity oself;
entity starte;
}
void door_use()
-{
+{SELFPARAM();
entity oself;
//dprint("door_use (model: ");dprint(self.model);dprint(")\n");
}
void door_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
entity oself;
if(self.spawnflags & DOOR_NOSPLASH)
if(!(DEATH_ISSPECIAL(deathtype)) && (deathtype & HITTYPE_SPLASH))
*/
void door_touch()
-{
+{SELFPARAM();
if (!IS_PLAYER(other))
return;
if (self.owner.attack_finished_single > time)
}
void door_generic_plat_blocked()
-{
+{SELFPARAM();
if((self.spawnflags & 8) && (other.takedamage != DAMAGE_NO)) { // KIll Kill Kill!!
#ifdef SVQC
}
void door_rotating_hit_top()
-{
+{SELFPARAM();
if (self.noise1 != "")
sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
self.state = STATE_TOP;
}
void door_rotating_hit_bottom()
-{
+{SELFPARAM();
if (self.noise1 != "")
sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
if (self.lip==666) // self.lip is used to remember reverse opening direction for door_rotating
}
void door_rotating_go_down()
-{
+{SELFPARAM();
if (self.noise2 != "")
sound (self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
if (self.max_health)
}
void door_rotating_go_up()
-{
+{SELFPARAM();
if (self.state == STATE_UP)
return; // already going up
*/
void door_trigger_touch()
-{
+{SELFPARAM();
if (other.health < 1)
#ifdef SVQC
if (!((other.iscreature || (other.flags & FL_PROJECTILE)) && !PHYS_DEAD(other)))
}
void spawn_field(vector fmins, vector fmaxs)
-{
+{SELFPARAM();
entity trigger;
vector t1 = fmins, t2 = fmaxs;
*/
entity LinkDoors_nextent(entity cur, entity near, entity pass)
-{
+{SELFPARAM();
while((cur = find(cur, classname, self.classname)) && ((cur.spawnflags & 4) || cur.enemy))
{
}
void door_link();
#endif
void LinkDoors()
-{
+{SELFPARAM();
entity t;
vector cmins, cmaxs;
*/
float door_send(entity to, float sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_DOOR);
WriteByte(MSG_ENTITY, sf);
#endif
void door_init_startopen()
-{
+{SELFPARAM();
SUB_SETORIGIN(self, self.pos2);
self.pos2 = self.pos1;
self.pos1 = self.origin;
}
void door_reset()
-{
+{SELFPARAM();
SUB_SETORIGIN(self, self.pos1);
self.SUB_VELOCITY = '0 0 0';
self.state = STATE_BOTTOM;
// spawnflags require key (for now only func_door)
void spawnfunc_func_door()
-{
+{SELFPARAM();
// Quake 1 keys compatibility
if (self.spawnflags & SPAWNFLAGS_GOLD_KEY)
self.itemkeys |= ITEM_KEY_BIT(0);
}
void ent_door()
-{
+{SELFPARAM();
float sf = ReadByte();
if(sf & SF_TRIGGER_INIT)
*/
void door_rotating_reset()
-{
+{SELFPARAM();
self.angles = self.pos1;
self.avelocity = '0 0 0';
self.state = STATE_BOTTOM;
}
void door_rotating_init_startopen()
-{
+{SELFPARAM();
self.angles = self.movedir;
self.pos2 = '0 0 0';
self.pos1 = self.movedir;
void spawnfunc_func_door_rotating()
-{
+{SELFPARAM();
//if (!self.deathtype) // map makers can override this
// self.deathtype = " got in the way";
const float SECRET_YES_SHOOT = 16; // shootable even if targeted
void fd_secret_use()
-{
+{SELFPARAM();
float temp;
string message_save;
// Wait after first movement...
void fd_secret_move1()
-{
+{SELFPARAM();
self.SUB_NEXTTHINK = self.SUB_LTIME + 1.0;
self.think = fd_secret_move2;
if (self.noise3 != "")
// Start moving sideways w/sound...
void fd_secret_move2()
-{
+{SELFPARAM();
if (self.noise2 != "")
sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
SUB_CalcMove(self.dest2, TSPEED_LINEAR, self.speed, fd_secret_move3);
// Wait here until time to go back...
void fd_secret_move3()
-{
+{SELFPARAM();
if (self.noise3 != "")
sound(self, CH_TRIGGER_SINGLE, self.noise3, VOL_BASE, ATTEN_NORM);
if (!(self.spawnflags & SECRET_OPEN_ONCE))
// Move backward...
void fd_secret_move4()
-{
+{SELFPARAM();
if (self.noise2 != "")
sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
SUB_CalcMove(self.dest1, TSPEED_LINEAR, self.speed, fd_secret_move5);
// Wait 1 second...
void fd_secret_move5()
-{
+{SELFPARAM();
self.SUB_NEXTTHINK = self.SUB_LTIME + 1.0;
self.think = fd_secret_move6;
if (self.noise3 != "")
}
void fd_secret_move6()
-{
+{SELFPARAM();
if (self.noise2 != "")
sound(self, CH_TRIGGER_SINGLE, self.noise2, VOL_BASE, ATTEN_NORM);
SUB_CalcMove(self.oldorigin, TSPEED_LINEAR, self.speed, fd_secret_done);
}
void fd_secret_done()
-{
+{SELFPARAM();
if (self.spawnflags&SECRET_YES_SHOOT)
{
self.health = 10000;
}
void secret_blocked()
-{
+{SELFPARAM();
if (time < self.attack_finished_single)
return;
self.attack_finished_single = time + 0.5;
================
*/
void secret_touch()
-{
+{SELFPARAM();
if (!other.iscreature)
return;
if (self.attack_finished_single > time)
}
void secret_reset()
-{
+{SELFPARAM();
if (self.spawnflags&SECRET_YES_SHOOT)
{
self.health = 10000;
*/
void spawnfunc_func_door_secret()
-{
+{SELFPARAM();
/*if (!self.deathtype) // map makers can override this
self.deathtype = " got in the way";*/
*/
void func_fourier_controller_think()
-{
+{SELFPARAM();
vector v;
float n, i, t;
}
void spawnfunc_func_fourier()
-{
+{SELFPARAM();
entity controller;
if (self.noise != "")
{
void func_ladder_touch()
-{
+{SELFPARAM();
#ifdef SVQC
if (!other.iscreature)
return;
#ifdef SVQC
float func_ladder_send(entity to, float sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_LADDER);
WriteString(MSG_ENTITY, self.classname);
}
void spawnfunc_func_ladder()
-{
+{SELFPARAM();
self.mdl = self.model;
EXACTTRIGGER_INIT;
self.touch = func_ladder_touch;
}
void spawnfunc_func_water()
-{
+{SELFPARAM();
self.mdl = self.model;
EXACTTRIGGER_INIT;
self.touch = func_ladder_touch;
.float speed;
void ent_func_ladder()
-{
+{SELFPARAM();
self.classname = strzone(ReadString());
self.skin = ReadByte();
self.speed = ReadByte();
#ifdef SVQC
.float freq;
void func_pendulum_controller_think()
-{
+{SELFPARAM();
float v;
self.nextthink = time + 0.1;
}
void spawnfunc_func_pendulum()
-{
+{SELFPARAM();
entity controller;
if (self.noise != "")
{
}
float plat_send(entity to, float sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_PLAT);
WriteByte(MSG_ENTITY, sf);
}
void spawnfunc_func_plat()
-{
+{SELFPARAM();
if (self.sounds == 0)
self.sounds = 2;
}
void ent_plat()
-{
+{SELFPARAM();
float sf = ReadByte();
if(sf & SF_TRIGGER_INIT)
// NOTE: also contains func_sparks
float pointparticles_SendEntity(entity to, float fl)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_POINTPARTICLES);
// optional features to save space
}
void pointparticles_use()
-{
+{SELFPARAM();
self.state = !self.state;
self.SendFlags |= 2;
}
void pointparticles_think()
-{
+{SELFPARAM();
if(self.origin != self.oldorigin)
{
self.SendFlags |= 4;
}
void pointparticles_reset()
-{
+{SELFPARAM();
if(self.spawnflags & 1)
self.state = 1;
else
}
void spawnfunc_func_pointparticles()
-{
+{SELFPARAM();
if(self.model != "")
setmodel(self, self.model);
if(self.noise != "")
}
void spawnfunc_func_sparks()
-{
+{SELFPARAM();
// self.cnt is the amount of sparks that one burst will spawn
if(self.cnt < 1) {
self.cnt = 25.0; // nice default value
#elif defined(CSQC)
void Draw_PointParticles()
-{
+{SELFPARAM();
float n, i, fail;
vector p;
vector sz;
}
void Ent_PointParticles_Remove()
-{
+{SELFPARAM();
if(self.noise)
strunzone(self.noise);
self.noise = string_null;
}
void Ent_PointParticles()
-{
+{SELFPARAM();
float i;
vector v;
int f = ReadByte();
#ifdef SVQC
float rainsnow_SendEntity(entity to, float sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_RAINSNOW);
WriteByte(MSG_ENTITY, self.state);
WriteCoord(MSG_ENTITY, self.origin_x + self.mins_x);
adjusts density, this many particles fall every second for a 1024x1024 area, default is 2000
*/
void spawnfunc_func_rain()
-{
+{SELFPARAM();
self.dest = self.velocity;
self.velocity = '0 0 0';
if (!self.dest)
adjusts density, this many particles fall every second for a 1024x1024 area, default is 2000
*/
void spawnfunc_func_snow()
-{
+{SELFPARAM();
self.dest = self.velocity;
self.velocity = '0 0 0';
if (!self.dest)
}
#elif defined(CSQC)
void Draw_Rain()
-{
+{SELFPARAM();
te_particlerain(self.origin + self.mins, self.origin + self.maxs, self.velocity, floor(self.count * drawframetime + random()), self.glow_color);
}
void Draw_Snow()
-{
+{SELFPARAM();
te_particlesnow(self.origin + self.mins, self.origin + self.maxs, self.velocity, floor(self.count * drawframetime + random()), self.glow_color);
}
void Ent_RainOrSnow()
-{
+{SELFPARAM();
self.impulse = ReadByte(); // Rain, Snow, or Whatever
self.origin_x = ReadCoord();
self.origin_y = ReadCoord();
#ifdef SVQC
void func_rotating_setactive(float astate)
-{
+{SELFPARAM();
if (astate == ACTIVE_TOGGLE)
{
*/
void spawnfunc_func_rotating()
-{
+{SELFPARAM();
if (self.noise != "")
{
precache_sound(self.noise);
#ifdef SVQC
void spawnfunc_func_stardust()
-{
+{SELFPARAM();
self.effects = EF_STARDUST;
- CSQCMODEL_AUTOINIT();
+ CSQCMODEL_AUTOINIT(self);
}
#endif
.float train_wait_turning;
void() train_next;
void train_wait()
-{
+{SELFPARAM();
entity oldself;
oldself = self;
self = self.enemy;
}
void train_next()
-{
+{SELFPARAM();
entity targ, cp = world;
vector cp_org = '0 0 0';
#ifdef SVQC
float train_send(entity to, float sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_TRAIN);
WriteByte(MSG_ENTITY, sf);
}
void func_train_find()
-{
+{SELFPARAM();
entity targ;
targ = find(world, targetname, self.target);
self.target = targ.target;
*/
#ifdef SVQC
void spawnfunc_func_train()
-{
+{SELFPARAM();
if (self.noise != "")
precache_sound(self.noise);
}
void ent_train()
-{
+{SELFPARAM();
float sf = ReadByte();
if(sf & SF_TRIGGER_INIT)
}
void func_vectormamamam_controller_think()
-{
+{SELFPARAM();
self.nextthink = time + 0.1;
if(self.owner.active != ACTIVE_ACTIVE)
}
void func_vectormamamam_findtarget()
-{
+{SELFPARAM();
if(self.target != "")
self.wp00 = find(world, targetname, self.target);
}
void spawnfunc_func_vectormamamam()
-{
+{SELFPARAM();
if (self.noise != "")
{
precache_sound(self.noise);
#ifdef SVQC
bool corner_send(entity to, int sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_CORNER);
WriteString(MSG_ENTITY, self.platmovetype);
}
void spawnfunc_path_corner()
-{
+{SELFPARAM();
// setup values for overriding train movement
// if a second value does not exist, both start and end speeds are the single value specified
set_platmovetype(self, self.platmovetype);
#elif defined(CSQC)
void corner_remove()
-{
+{SELFPARAM();
if(self.target) { strunzone(self.target); }
self.target = string_null;
}
void ent_corner()
-{
+{SELFPARAM();
self.platmovetype = strzone(ReadString());
self.origin_x = ReadCoord();
#ifdef SVQC
void follow_init()
-{
+{SELFPARAM();
entity src, dst;
src = world;
dst = world;
}
void spawnfunc_misc_follow()
-{
+{SELFPARAM();
InitializeEntity(self, follow_init, INITPRIO_FINDTARGET);
}
#endif
#ifdef SVQC
.float modelscale;
void misc_laser_aim()
-{
+{SELFPARAM();
vector a;
if(self.enemy)
{
}
void misc_laser_init()
-{
+{SELFPARAM();
if(self.target != "")
self.enemy = find(world, targetname, self.target);
}
.entity pusher;
void misc_laser_think()
-{
+{SELFPARAM();
vector o;
entity oldself;
entity hitent;
}
float laser_SendEntity(entity to, float fl)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_LASER);
fl = fl - (fl & 0xF0); // use that bit to indicate finite length laser
if(self.spawnflags & 2)
damage per second (-1 for a laser that kills immediately)
*/
void laser_use()
-{
+{SELFPARAM();
self.state = !self.state;
self.SendFlags |= 4;
misc_laser_aim();
}
void laser_reset()
-{
+{SELFPARAM();
if(self.spawnflags & 1)
self.state = 1;
else
}
void spawnfunc_misc_laser()
-{
+{SELFPARAM();
if(self.mdl)
{
if(self.mdl == "none")
class(Laser) .float modelscale; // scaling factor of the dlight
void Draw_Laser()
-{
+{SELFPARAM();
if(!self.state)
return;
InterpolateOrigin_Do();
}
void Ent_Laser()
-{
+{SELFPARAM();
InterpolateOrigin_Undo();
// 30 bytes, or 13 bytes for just moving
#ifdef SVQC
void spawnfunc_info_teleport_destination (void)
-{
+{SELFPARAM();
self.classname = "info_teleport_destination";
self.mangle = self.angles;
void generic_plat_blocked()
-{
+{SELFPARAM();
#ifdef SVQC
if(self.dmg && other.takedamage != DAMAGE_NO)
{
}
void plat_spawn_inside_trigger()
-{
+{SELFPARAM();
entity trigger;
vector tmin, tmax;
}
void plat_hit_top()
-{
+{SELFPARAM();
sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
self.state = 1;
}
void plat_hit_bottom()
-{
+{SELFPARAM();
sound (self, CH_TRIGGER_SINGLE, self.noise1, VOL_BASE, ATTEN_NORM);
self.state = 2;
}
void plat_go_down()
-{
+{SELFPARAM();
sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM);
self.state = 3;
SUB_CalcMove (self.pos2, TSPEED_LINEAR, self.speed, plat_hit_bottom);
}
void plat_go_up()
-{
+{SELFPARAM();
sound (self, CH_TRIGGER_SINGLE, self.noise, VOL_BASE, ATTEN_NORM);
self.state = 4;
SUB_CalcMove (self.pos1, TSPEED_LINEAR, self.speed, plat_hit_top);
}
void plat_center_touch()
-{
+{SELFPARAM();
#ifdef SVQC
if (!other.iscreature)
return;
}
void plat_outside_touch()
-{
+{SELFPARAM();
#ifdef SVQC
if (!other.iscreature)
return;
}
void plat_trigger_use()
-{
+{SELFPARAM();
#ifdef SVQC
if (self.think)
return; // already activated
void plat_crush()
-{
+{SELFPARAM();
if((self.spawnflags & 4) && (other.takedamage != DAMAGE_NO))
{ // KIll Kill Kill!!
#ifdef SVQC
}
void plat_use()
-{
+{SELFPARAM();
self.use = func_null;
if (self.state != 4)
objerror ("plat_use: not in up state");
.string sound1, sound2;
void plat_reset()
-{
+{SELFPARAM();
IFTARGETED
{
setorigin (self, self.pos1);
*/
.float friction;
void SUB_Friction (void)
-{
+{SELFPARAM();
self.SUB_NEXTTHINK = time;
if(self.SUB_FLAGS & FL_ONGROUND)
self.SUB_VELOCITY = self.SUB_VELOCITY * (1 - frametime * self.friction);
}
void SUB_SetFade_Think (void)
-{
+{SELFPARAM();
if(self.alpha == 0)
self.alpha = 1;
self.SUB_THINK = SUB_SetFade_Think;
===============
*/
void SUB_CalcMoveDone (void)
-{
+{SELFPARAM();
// After moving, set origin to exact final destination
SUB_SETORIGIN (self, self.finaldest);
.float platmovetype_turn;
void SUB_CalcMove_controller_think (void)
-{
+{SELFPARAM();
entity oldself;
float traveltime;
float phasepos;
// TODO average too?
void SUB_CalcMove_Bezier (vector tcontrol, vector tdest, float tspeedtype, float tspeed, void() func)
-{
+{SELFPARAM();
float traveltime;
entity controller;
}
void SUB_CalcMove (vector tdest, float tspeedtype, float tspeed, void() func)
-{
+{SELFPARAM();
vector delta;
float traveltime;
}
void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, void() func)
-{
+{SELFPARAM();
entity oldself;
oldself = self;
===============
*/
void SUB_CalcAngleMoveDone (void)
-{
+{SELFPARAM();
// After rotating, set angle to exact final angle
self.angles = self.finalangle;
self.SUB_AVELOCITY = '0 0 0';
// FIXME: I fixed this function only for rotation around the main axes
void SUB_CalcAngleMove (vector destangle, float tspeedtype, float tspeed, void() func)
-{
+{SELFPARAM();
vector delta;
float traveltime;
}
void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float tspeed, void() func)
-{
+{SELFPARAM();
entity oldself;
oldself = self;
#define SUB_FLAGS move_flags
void SUB_SETORIGIN(entity s, vector v)
- {
+ {SELFPARAM();
s.move_origin = v;
entity oldself = self;
self = s;
void spawnfunc_target_changelevel_use()
-{
+{SELFPARAM();
if(self.spawnflags & 2)
{
// simply don't react if a non-player triggers it
}
void spawnfunc_target_changelevel()
-{
+{SELFPARAM();
self.use = spawnfunc_target_changelevel_use;
if(!self.count) { self.count = 0.7; }
#ifdef SVQC
void spawnfunc_target_location()
-{
+{SELFPARAM();
self.classname = "target_location";
// location name in netname
// eventually support: count, teamgame selectors, line of sight?
}
void spawnfunc_info_location()
-{
+{SELFPARAM();
self.classname = "target_location";
self.message = self.netname;
}
// when triggered, the music is overridden for activator until lifetime (or forever, if lifetime is 0)
// when targetname is not set, THIS ONE is default
void target_music_sendto(float to, float is)
-{
+{SELFPARAM();
WriteByte(to, SVC_TEMPENTITY);
WriteByte(to, TE_CSQC_TARGET_MUSIC);
WriteShort(to, num_for_edict(self));
WriteString(to, self.noise);
}
void target_music_reset()
-{
+{SELFPARAM();
if(self.targetname == "")
target_music_sendto(MSG_ALL, 1);
}
FOR_EACH_SPEC(head) if(head.enemy == activator) { msg_entity = head; target_music_sendto(MSG_ONE, 1); }
}
void spawnfunc_target_music()
-{
+{SELFPARAM();
self.use = target_music_use;
self.reset = target_music_reset;
if(!self.volume)
target_music_sendto(MSG_INIT, 0);
}
void TargetMusic_RestoreGame()
-{
+{SELFPARAM();
for(self = world; (self = find(self, classname, "target_music")); )
{
if(self.targetname == "")
// 1 = START_OFF
// when triggered, it is disabled/enabled for everyone
float trigger_music_SendEntity(entity to, float sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_TRIGGER_MUSIC);
sf &= ~0x80;
if(self.cnt)
return 1;
}
void trigger_music_reset()
-{
+{SELFPARAM();
self.cnt = !(self.spawnflags & 1);
self.SendFlags |= 0x80;
}
void trigger_music_use()
-{
+{SELFPARAM();
self.cnt = !self.cnt;
self.SendFlags |= 0x80;
}
void spawnfunc_trigger_music()
-{
+{SELFPARAM();
if(self.model != "")
setmodel(self, self.model);
if(!self.volume)
}
void Ent_TriggerMusic_Think()
-{
+{SELFPARAM();
if(WarpZoneLib_BoxTouchesBrush(view_origin, view_origin, self, world))
{
music_trigger = self;
}
void Ent_TriggerMusic_Remove()
-{
+{SELFPARAM();
if(self.noise)
strunzone(self.noise);
self.noise = string_null;
}
void Ent_ReadTriggerMusic()
-{
+{SELFPARAM();
int f = ReadByte();
if(f & 4)
{
float target_spawn_count;
void target_spawn_helper_setmodel()
-{
+{SELFPARAM();
setmodel(self, self.model);
}
void target_spawn_helper_setsize()
-{
+{SELFPARAM();
setsize(self, self.mins, self.maxs);
}
void target_spawn_edit_entity(entity e, string msg, entity kt, entity t2, entity t3, entity t4, entity act)
-{
+{SELFPARAM();
float i, n, valuefieldpos;
string key, value, valuefield, valueoffset, valueoffsetrandom;
entity valueent;
}
void target_spawn_useon(entity e)
-{
+{SELFPARAM();
self.target_spawn_activator = activator;
target_spawn_edit_entity(
e,
}
float target_spawn_cancreate()
-{
+{SELFPARAM();
float c;
entity e;
}
void target_spawn_use()
-{
+{SELFPARAM();
entity e;
if(self.target == "")
}
void target_spawn_spawnfirst()
-{
+{SELFPARAM();
activator = self.target_spawn_activator;
if(self.spawnflags & 2)
target_spawn_use();
}
void spawnfunc_target_spawn()
-{
+{SELFPARAM();
initialize_field_db();
self.use = target_spawn_use;
self.message = strzone(strreplace("'", "\"", self.message));
// TODO add a way to do looped sounds with sound(); then complete this entity
void target_speaker_use_off();
void target_speaker_use_activator()
-{
+{SELFPARAM();
if (!IS_REAL_CLIENT(activator))
return;
string snd;
soundto(MSG_ONE, self, CH_TRIGGER, snd, VOL_BASE * self.volume, self.atten);
}
void target_speaker_use_on()
-{
+{SELFPARAM();
string snd;
if(substring(self.noise, 0, 1) == "*")
{
self.use = target_speaker_use_off;
}
void target_speaker_use_off()
-{
+{SELFPARAM();
sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASE * self.volume, self.atten);
self.use = target_speaker_use_on;
}
void target_speaker_reset()
-{
+{SELFPARAM();
if(self.spawnflags & 1) // LOOPED_ON
{
if(self.use == target_speaker_use_on)
}
void spawnfunc_target_speaker()
-{
+{SELFPARAM();
// TODO: "*" prefix to sound file name
// TODO: wait and random (just, HOW? random is not a field)
if(self.noise)
}
void target_voicescript_use()
-{
+{SELFPARAM();
if(activator.voicescript != self)
{
activator.voicescript = self;
}
void spawnfunc_target_voicescript()
-{
+{SELFPARAM();
// netname: directory of the sound files
// message: list of "sound file" duration "sound file" duration, a *, and again a list
// foo1 4.1 foo2 4.0 foo3 -3.1 * fool1 1.1 fool2 7.1 fool3 9.1 fool4 3.7
}
void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angles, vector to_velocity, vector telefragmin, vector telefragmax, float tflags)
-{
+{SELFPARAM();
entity telefragger;
vector from;
}
void teleport_findtarget (void)
-{
+{SELFPARAM();
entity e;
float n;
}
void WarpZone_PostTeleportPlayer_Callback(entity pl)
-{
+{SELFPARAM();
makevectors(pl.angles);
Reset_ArcBeam(pl, v_forward);
UpdateCSQCProjectileAfterTeleport(pl);
#ifdef SVQC
void counter_use()
-{
+{SELFPARAM();
self.count -= 1;
if (self.count < 0)
return;
}
void counter_reset()
-{
+{SELFPARAM();
self.count = self.cnt;
multi_reset();
}
After the counter has been triggered "count" times (default 2), it will fire all of it's targets and remove itself.
*/
void spawnfunc_trigger_counter()
-{
+{SELFPARAM();
self.wait = -1;
if (!self.count)
self.count = 2;
#ifdef SVQC
void delay_use()
-{
+{SELFPARAM();
self.think = SUB_UseTargets;
self.nextthink = self.wait;
}
void delay_reset()
-{
+{SELFPARAM();
self.think = func_null;
self.nextthink = 0;
}
void spawnfunc_trigger_delay()
-{
+{SELFPARAM();
if(!self.wait)
self.wait = 1;
#ifdef SVQC
void trigger_disablerelay_use()
-{
+{SELFPARAM();
entity e;
float a, b;
}
void spawnfunc_trigger_disablerelay()
-{
+{SELFPARAM();
self.use = trigger_disablerelay_use;
}
#endif
"Flip-flop" trigger gate... lets only every second trigger event through
*/
void flipflop_use()
-{
+{SELFPARAM();
self.state = !self.state;
if(self.state)
SUB_UseTargets();
}
void spawnfunc_trigger_flipflop()
-{
+{SELFPARAM();
if(self.spawnflags & 1)
self.state = 1;
self.use = flipflop_use;
#ifdef SVQC
void gamestart_use()
-{
+{SELFPARAM();
activator = self;
SUB_UseTargets();
remove(self);
}
void spawnfunc_trigger_gamestart()
-{
+{SELFPARAM();
self.use = gamestart_use;
self.reset2 = spawnfunc_trigger_gamestart;
own.trigger_gravity_check = world;
}
void trigger_gravity_check_think()
-{
+{SELFPARAM();
// This spawns when a player enters the gravity zone and checks if he left.
// Each frame, self.count is set to 2 by trigger_gravity_touch() and decreased by 1 here.
// It the player has left the gravity trigger, this will be allowed to reach 0 and indicate that.
}
void trigger_gravity_use()
-{
+{SELFPARAM();
self.state = !self.state;
}
void trigger_gravity_touch()
-{
+{SELFPARAM();
float g;
if(self.state != true)
}
void spawnfunc_trigger_gravity()
-{
+{SELFPARAM();
if(self.gravity == 1)
return;
#ifdef SVQC
.float triggerhealtime;
void trigger_heal_touch()
-{
+{SELFPARAM();
if (self.active != ACTIVE_ACTIVE)
return;
}
void spawnfunc_trigger_heal()
-{
+{SELFPARAM();
self.active = ACTIVE_ACTIVE;
EXACTTRIGGER_INIT;
#ifdef SVQC
void trigger_hurt_use()
-{
+{SELFPARAM();
if(IS_PLAYER(activator))
self.enemy = activator;
else
.float triggerhurttime;
void trigger_hurt_touch()
-{
+{SELFPARAM();
if (self.active != ACTIVE_ACTIVE)
return;
entity trigger_hurt_last;
entity trigger_hurt_first;
void spawnfunc_trigger_hurt()
-{
+{SELFPARAM();
EXACTTRIGGER_INIT;
self.active = ACTIVE_ACTIVE;
self.touch = trigger_hurt_touch;
// targeted (directional) mode
void trigger_impulse_touch1()
-{
+{SELFPARAM();
entity targ;
float pushdeltatime;
float str;
// Directionless (accelerator/decelerator) mode
void trigger_impulse_touch2()
-{
+{SELFPARAM();
float pushdeltatime;
if (self.active != ACTIVE_ACTIVE)
// Spherical (gravity/repulsor) mode
void trigger_impulse_touch3()
-{
+{SELFPARAM();
float pushdeltatime;
float str;
*/
#ifdef SVQC
bool trigger_impulse_send(entity to, int sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_TRIGGER_IMPULSE);
WriteCoord(MSG_ENTITY, self.radius);
}
void spawnfunc_trigger_impulse()
-{
+{SELFPARAM();
self.active = ACTIVE_ACTIVE;
EXACTTRIGGER_INIT;
}
#elif defined(CSQC)
void ent_trigger_impulse()
-{
+{SELFPARAM();
self.radius = ReadCoord();
self.strength = ReadCoord();
self.falloff = ReadByte();
#include "../../movetypes/movetypes.qh"
void trigger_push_use()
-{
+{SELFPARAM();
if(teamplay)
{
self.team = activator.team;
}
void trigger_push_touch()
-{
+{SELFPARAM();
if (self.active == ACTIVE_NOT)
return;
void trigger_push_updatelink();
#endif
void trigger_push_findtarget()
-{
+{SELFPARAM();
entity t;
vector org;
#ifdef SVQC
float trigger_push_send(entity to, float sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_TRIGGER_PUSH);
WriteByte(MSG_ENTITY, sf);
}
void trigger_push_updatelink()
-{
+{SELFPARAM();
self.SendFlags |= 1;
}
* movedir: if target is not set, this * speed * 10 is the velocity to be reached.
*/
void spawnfunc_trigger_push()
-{
+{SELFPARAM();
SetMovedir ();
EXACTTRIGGER_INIT;
float target_push_send(entity to, float sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_TARGET_PUSH);
WriteByte(MSG_ENTITY, self.cnt);
}
void target_push_link()
-{
+{SELFPARAM();
Net_LinkEntity(self, false, 0, target_push_send);
self.SendFlags |= 1; // update
}
#ifdef CSQC
void ent_trigger_push()
-{
+{SELFPARAM();
float sf = ReadByte();
if(sf & 1)
}
void target_push_remove()
-{
+{SELFPARAM();
if(self.classname)
strunzone(self.classname);
self.classname = string_null;
}
void ent_target_push()
-{
+{SELFPARAM();
self.classname = "push_target";
self.cnt = ReadByte();
self.targetname = strzone(ReadString());
* trigger given targets
*/
void trigger_keylock_trigger(string s)
-{
+{SELFPARAM();
entity stemp = self;
entity otemp = other;
entity atemp = activator;
}
void trigger_keylock_touch()
-{
+{SELFPARAM();
bool key_used = false;
bool started_delay = false;
#ifdef SVQC
bool trigger_keylock_send(entity to, int sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_KEYLOCK);
WriteInt24_t(MSG_ENTITY, self.itemkeys);
message2 and noise2 will be resent to the player every 2 seconds while he is in the trigger zone.
*/
void spawnfunc_trigger_keylock(void)
-{
+{SELFPARAM();
if(!self.itemkeys) { remove(self); return; }
// set unlocked message
}
#elif defined(CSQC)
void keylock_remove()
-{
+{SELFPARAM();
if(self.target) { strunzone(self.target); }
self.target = string_null;
}
void ent_keylock()
-{
+{SELFPARAM();
self.itemkeys = ReadInt24_t();
self.height = ReadByte();
float magicear_matched;
float W_Tuba_HasPlayed(entity pl, string melody, float instrument, float ignorepitch, float mintempo, float maxtempo);
string trigger_magicear_processmessage(entity ear, entity source, float teamsay, entity privatesay, string msgin)
-{
+{SELFPARAM();
float domatch, dotrigger, matchstart, l;
string s, msg;
entity oldself;
}
void spawnfunc_trigger_magicear()
-{
+{SELFPARAM();
self.enemy = magicears;
magicears = self;
"Mono-flop" trigger gate... turns one trigger event into one "on" and one "off" event, separated by a delay of "wait"
*/
void monoflop_use()
-{
+{SELFPARAM();
self.nextthink = time + self.wait;
self.enemy = activator;
if(self.state)
SUB_UseTargets();
}
void monoflop_fixed_use()
-{
+{SELFPARAM();
if(self.state)
return;
self.nextthink = time + self.wait;
}
void monoflop_think()
-{
+{SELFPARAM();
self.state = 0;
activator = self.enemy;
SUB_UseTargets();
}
void monoflop_reset()
-{
+{SELFPARAM();
self.state = 0;
self.nextthink = 0;
}
void spawnfunc_trigger_monoflop()
-{
+{SELFPARAM();
if(!self.wait)
self.wait = 1;
if(self.spawnflags & 1)
#ifdef SVQC
// the wait time has passed, so set back up for another activation
void multi_wait()
-{
+{SELFPARAM();
if (self.max_health)
{
self.health = self.max_health;
// self.enemy should be set to the activator so it can be held through a delay
// so wait for the delay time before firing
void multi_trigger()
-{
+{SELFPARAM();
if (self.nextthink > time)
{
return; // allready been triggered
}
void multi_use()
-{
+{SELFPARAM();
self.goalentity = other;
self.enemy = activator;
multi_trigger();
}
void multi_touch()
-{
+{SELFPARAM();
if(!(self.spawnflags & 2))
if(!other.iscreature)
return;
}
void multi_eventdamage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
if (!self.takedamage)
return;
if(self.spawnflags & DOOR_NOSPLASH)
}
void multi_reset()
-{
+{SELFPARAM();
if ( !(self.spawnflags & SPAWNFLAG_NOTOUCH) )
self.touch = multi_touch;
if (self.max_health)
set "message" to text string
*/
void spawnfunc_trigger_multiple()
-{
+{SELFPARAM();
self.reset = multi_reset;
if (self.sounds == 1)
{
set "message" to text string
*/
void spawnfunc_trigger_once()
-{
+{SELFPARAM();
self.wait = -1;
spawnfunc_trigger_multiple();
}
#ifdef SVQC
void multivibrator_send()
-{
+{SELFPARAM();
float newstate;
float cyclestart;
}
void multivibrator_toggle()
-{
+{SELFPARAM();
if(self.nextthink == 0)
{
multivibrator_send();
}
void multivibrator_reset()
-{
+{SELFPARAM();
if(!(self.spawnflags & 1))
self.nextthink = 0; // wait for a trigger event
else
START_ON: assume it is already turned on (when targeted)
*/
void spawnfunc_trigger_multivibrator()
-{
+{SELFPARAM();
if(!self.wait)
self.wait = 1;
if(!self.respawntime)
This fixed size trigger cannot be touched, it can only be fired by other events. It can contain killtargets, targets, delays, and messages.
*/
void spawnfunc_trigger_relay()
-{
+{SELFPARAM();
self.use = SUB_UseTargets;
self.reset = spawnfunc_trigger_relay; // this spawnfunc resets fully
}
#ifdef SVQC
void relay_activators_use()
-{
+{SELFPARAM();
entity trg, os;
os = self;
}
void spawnfunc_relay_activate()
-{
+{SELFPARAM();
self.cnt = ACTIVE_ACTIVE;
self.use = relay_activators_use;
}
void spawnfunc_relay_deactivate()
-{
+{SELFPARAM();
self.cnt = ACTIVE_NOT;
self.use = relay_activators_use;
}
void spawnfunc_relay_activatetoggle()
-{
+{SELFPARAM();
self.cnt = ACTIVE_TOGGLE;
self.use = relay_activators_use;
}
#ifdef SVQC
void trigger_relay_if_use()
-{
+{SELFPARAM();
float n;
n = self.count;
}
void spawnfunc_trigger_relay_if()
-{
+{SELFPARAM();
self.use = trigger_relay_if_use;
}
#endif
#ifdef SVQC
void trigger_relay_teamcheck_use()
-{
+{SELFPARAM();
if(activator.team)
{
if(self.spawnflags & 2)
}
void trigger_relay_teamcheck_reset()
-{
+{SELFPARAM();
self.team = self.team_saved;
}
void spawnfunc_trigger_relay_teamcheck()
-{
+{SELFPARAM();
self.team_saved = self.team;
self.use = trigger_relay_teamcheck_use;
self.reset = trigger_relay_teamcheck_reset;
#ifdef SVQC
-void secrets_setstatus() {
+void secrets_setstatus()
+{SELFPARAM();
self.stat_secrets_total = secrets_total;
self.stat_secrets_found = secrets_found;
}
/**
* A secret has been found (maybe :P)
*/
-void trigger_secret_touch() {
+void trigger_secret_touch()
+{SELFPARAM();
// only a player can trigger this
if (!IS_PLAYER(other))
return;
You should create a common/trigger textured brush covering the entrance to a secret room/area.
Trigger secret can only be trigger by a player's touch and can not be a target itself.
*/
-void spawnfunc_trigger_secret() {
+void spawnfunc_trigger_secret()
+{SELFPARAM();
// FIXME: should it be disabled in most modes?
// update secrets count
* I do it this way becuz there is no "untouch" event.
*/
void swampslug_think(void)
-{
+{SELFPARAM();
//Slowly kill the slug
self.health = self.health - 1;
}
void swamp_touch(void)
-{
+{SELFPARAM();
// If whatever thats touching the swamp is not a player
// or if its a dead player, just dont care abt it.
if(!IS_PLAYER(other) || PHYS_DEAD(other))
#ifdef SVQC
float swamp_send(entity to, float sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_LADDER);
WriteByte(MSG_ENTITY, self.dmg); // can probably get away with using a single byte here
}
void swamp_link()
-{
+{SELFPARAM();
Net_LinkEntity(self, false, 0, func_ladder_send);
}
get slowd down and damaged
*/
void spawnfunc_trigger_swamp(void)
-{
+{SELFPARAM();
// Init stuff
EXACTTRIGGER_INIT;
self.touch = swamp_touch;
#elif defined(CSQC)
void ent_swamp()
-{
+{SELFPARAM();
self.dmg = ReadByte();
self.swamp_slowdown = ReadByte();
self.swamp_interval = ReadByte();
#ifdef SVQC
void trigger_teleport_use()
-{
+{SELFPARAM();
if(teamplay)
self.team = activator.team;
#ifdef SVQC
}
void Teleport_Touch (void)
-{
+{SELFPARAM();
entity oldself;
string s;
}
void spawnfunc_trigger_teleport()
-{
+{SELFPARAM();
self.angles = '0 0 0';
EXACTTRIGGER_INIT;
#ifdef SVQC
void viewloc_think()
-{
+{SELFPARAM();
entity e;
// we abuse this method, rather than using normal .touch, because touch isn't reliable with multiple clients inside the same trigger, and can't "untouch" entities
}
bool trigger_viewloc_send(entity to, int sf)
-{
+{SELFPARAM();
// CSQC doesn't need to know our origin (yet), as we're only available for referencing
WriteByte(MSG_ENTITY, ENT_CLIENT_VIEWLOC_TRIGGER);
}
void viewloc_init()
-{
+{SELFPARAM();
entity e;
for(e = world; (e = find(e, targetname, self.target)); )
if(e.classname == "target_viewlocation_start")
}
void spawnfunc_trigger_viewlocation()
-{
+{SELFPARAM();
// we won't check target2 here yet, as it may not even need to exist
if(self.target == "") { LOG_INFO("^1FAIL!\n"); remove(self); return; }
}
bool viewloc_send(entity to, int sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_VIEWLOC);
WriteByte(MSG_ENTITY, self.cnt);
.float angle;
void viewloc_link()
-{
+{SELFPARAM();
if(self.angle)
self.angles_y = self.angle;
Net_LinkEntity(self, false, 0, viewloc_send);
}
void spawnfunc_target_viewlocation_start()
-{
+{SELFPARAM();
self.classname = "target_viewlocation_start";
self.cnt = 1;
viewloc_link();
}
void spawnfunc_target_viewlocation_end()
-{
+{SELFPARAM();
self.classname = "target_viewlocation_end";
self.cnt = 2;
viewloc_link();
#elif defined(CSQC)
void trigger_viewloc_updatelink()
-{
+{SELFPARAM();
self.enemy = findfloat(world, entnum, self.cnt);
self.goalentity = findfloat(world, entnum, self.count);
}
void ent_viewloc_trigger()
-{
+{SELFPARAM();
float point1 = ReadShort();
float point2 = ReadShort();
}
void ent_viewloc()
-{
+{SELFPARAM();
self.cnt = ReadByte();
self.origin_x = ReadCoord();
void() SUB_UseTargets;
void DelayThink()
-{
+{SELFPARAM();
activator = self.enemy;
SUB_UseTargets ();
remove(self);
#ifdef SVQC
void trigger_common_write(bool withtarget)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, self.warpzone_isboxy);
WriteByte(MSG_ENTITY, self.scale);
#elif defined(CSQC)
void trigger_common_read(bool withtarget)
-{
+{SELFPARAM();
self.warpzone_isboxy = ReadByte();
self.scale = ReadByte();
}
void trigger_remove_generic()
-{
+{SELFPARAM();
if(self.target) { strunzone(self.target); }
self.target = string_null;
==============================
*/
void SUB_UseTargets()
-{
+{SELFPARAM();
entity t, stemp, otemp, act;
string s;
float i;
#ifdef CSQC
void trigger_touch_generic(void() touchfunc)
-{
+{SELFPARAM();
entity e;
for(e = findradius((self.absmin + self.absmax) * 0.5, vlen(self.absmax - self.absmin) * 0.5 + 1); e; e = e.chain)
if(e.isplayermodel || e.classname == "csqcprojectile")
}
}
void trigger_draw_generic()
-{
+{SELFPARAM();
float dt = time - self.move_time;
self.move_time = time;
if(dt <= 0) { return; }
#if 0
void turret_checkpoint_think()
-{
+{SELFPARAM();
if(self.enemy)
te_lightning1(self,self.origin, self.enemy.origin);
*/
//float tc_acum;
void turret_checkpoint_init()
-{
+{SELFPARAM();
traceline(self.origin + '0 0 16', self.origin - '0 0 1024', MOVE_WORLDONLY, self);
setorigin(self, trace_endpos + '0 0 32');
}
void spawnfunc_turret_checkpoint()
-{
+{SELFPARAM();
setorigin(self,self.origin);
self.think = turret_checkpoint_init;
self.nextthink = time + 0.2;
// Compat.
void spawnfunc_walker_checkpoint()
-{
+{SELFPARAM();
self.classname = "turret_checkpoint";
spawnfunc_turret_checkpoint();
}
void turret_remove()
-{
+{SELFPARAM();
remove(self.tur_head);
//remove(self.enemy);
self.tur_head = world;
.vector glowmod;
void turret_changeteam()
-{
+{SELFPARAM();
self.glowmod = Team_ColorRGB(self.team - 1) * 2;
self.teamradar_color = Team_ColorRGB(self.team - 1);
}
void turret_head_draw()
-{
+{SELFPARAM();
self.drawmask = MASK_NORMAL;
}
void turret_draw()
-{
+{SELFPARAM();
float dt;
dt = time - self.move_time;
}
void turret_draw2d()
-{
+{SELFPARAM();
if(self.netname == "")
return;
}
void turret_construct()
-{
+{SELFPARAM();
entity tur = get_turretinfo(self.turretid);
if(self.tur_head == world)
entity turret_gibtoss(string _model, vector _from, vector _to, vector _cmod, float _explode);
void turret_gibboom();
void turret_gib_draw()
-{
+{SELFPARAM();
Movetype_Physics_MatchTicrate(autocvar_cl_gibs_ticrate, autocvar_cl_gibs_sloppy);
self.drawmask = MASK_NORMAL;
}
void turret_gibboom()
-{
+{SELFPARAM();
float i;
sound (self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM);
}
void turret_die()
-{
+{SELFPARAM();
sound (self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM);
pointparticles(particleeffectnum(EFFECT_ROCKET_EXPLODE), self.origin, '0 0 0', 1);
if (!autocvar_cl_nogibs)
}
void ent_turret()
-{
+{SELFPARAM();
float sf;
sf = ReadByte();
// Generic aiming
vector turret_aim_generic()
-{
+{SELFPARAM();
vector pre_pos, prep;
float distance, impact_time = 0, i, mintime;
// Generic damage handling
void turret_hide()
-{
+{SELFPARAM();
self.effects |= EF_NODRAW;
self.nextthink = time + self.respawntime - 0.2;
self.think = turret_respawn;
}
void turret_die()
-{
+{SELFPARAM();
self.deadflag = DEAD_DEAD;
self.tur_head.deadflag = self.deadflag;
}
void turret_damage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector vforce)
-{
+{SELFPARAM();
// Enough already!
if(self.deadflag == DEAD_DEAD)
return;
void() turret_think;
void turret_respawn()
-{
+{SELFPARAM();
// Make sure all parts belong to the same team since
// this function doubles as "teamchange" function.
self.tur_head.team = self.team;
#define cvar_base "g_turrets_unit_"
.float clientframe;
void turrets_setframe(float _frame, float client_only)
-{
+{SELFPARAM();
if((client_only ? self.clientframe : self.frame ) != _frame)
{
self.SendFlags |= TNSF_ANIM;
}
float turret_send(entity to, float sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_TURRET);
WriteByte(MSG_ENTITY, sf);
}
void load_unit_settings(entity ent, string unitname, float is_reload)
-{
+{SELFPARAM();
string sbase;
if (ent == world)
}
void turret_projectile_explode()
-{
+{SELFPARAM();
self.takedamage = DAMAGE_NO;
self.event_damage = func_null;
}
void turret_projectile_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector vforce)
-{
+{SELFPARAM();
self.velocity += vforce;
self.health -= damage;
//self.realowner = attacker; // Dont change realowner, it does not make much sense for turrets
}
entity turret_projectile(string _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim)
-{
+{SELFPARAM();
entity proj;
sound (self, CH_WEAPON_A, _snd, VOL_BASE, ATTEN_NORM);
** and updated aim<->predict impact distance.
**/
void turret_do_updates(entity t_turret)
-{
+{SELFPARAM();
vector enemy_pos;
entity oldself;
**/
.float turret_framecounter;
void turret_track()
-{
+{SELFPARAM();
vector target_angle; // This is where we want to aim
vector move_angle; // This is where we can aim
float f_tmp;
}
entity turret_select_target()
-{
+{SELFPARAM();
entity e; // target looper entity
float score; // target looper entity score
entity e_enemy; // currently best scoreing target
** Preforms pre-fire checks based on the uints firecheck_flags
**/
float turret_firecheck()
-{
+{SELFPARAM();
// This one just dont care =)
if (self.firecheck_flags & TFL_FIRECHECK_NO)
return 1;
}
bool turret_checkfire()
-{
+{SELFPARAM();
bool ret = false; // dummy
if(MUTATOR_CALLHOOK(Turret_CheckFire, ret))
return ret_bool;
}
void turret_fire()
-{
+{SELFPARAM();
if (autocvar_g_turrets_nofire != 0)
return;
}
void turret_think()
-{
+{SELFPARAM();
entity e;
self.nextthink = time + self.ticrate;
If activator is world, the turret go inactive.
*/
void turret_use()
-{
+{SELFPARAM();
LOG_TRACE("Turret ",self.netname, " used by ", activator.classname, "\n");
self.team = activator.team;
}
void turret_link()
-{
+{SELFPARAM();
Net_LinkEntity(self, true, 0, turret_send);
self.think = turret_think;
self.nextthink = time;
}
void turrets_manager_think()
-{
+{SELFPARAM();
self.nextthink = time + 1;
entity e;
}
float turret_initialize(float tur_id)
-{
+{SELFPARAM();
if(!autocvar_g_turrets)
return false;
void turret_targettrigger_touch();
void turret_targettrigger_touch()
-{
+{SELFPARAM();
entity e;
if (self.cnt > time) return;
entity oldself;
/*QUAKED turret_targettrigger (.5 .5 .5) ?
*/
void spawnfunc_turret_targettrigger()
-{
+{SELFPARAM();
if(!autocvar_g_turrets) { remove(self); return; }
InitTrigger ();
//#define EWHEEL_FANCYPATH
void ewheel_move_path()
-{
+{SELFPARAM();
#ifdef EWHEEL_FANCYPATH
// Are we close enougth to a path node to switch to the next?
if (vlen(self.origin - self.pathcurrent.origin) < 64)
}
void ewheel_move_enemy()
-{
+{SELFPARAM();
float newframe;
self.steerto = steerlib_arrive(self.enemy.origin,self.target_range_optimal);
}
void ewheel_move_idle()
-{
+{SELFPARAM();
if(self.frame != 0)
{
self.SendFlags |= TNSF_ANIM;
movelib_beak_simple((autocvar_g_turrets_unit_ewheel_speed_stop));
}
-void spawnfunc_turret_ewheel() { if(!turret_initialize(TUR_EWHEEL)) remove(self); }
+void spawnfunc_turret_ewheel() { SELFPARAM(); if(!turret_initialize(TUR_EWHEEL)) remove(self); }
float t_ewheel(float req)
-{
+{SELFPARAM();
switch(req)
{
case TR_ATTACK:
#ifdef CSQC
void ewheel_draw()
-{
+{SELFPARAM();
float dt;
dt = time - self.move_time;
}
float t_ewheel(float req)
-{
+{SELFPARAM();
switch(req)
{
case TR_SETUP:
#else
#ifdef SVQC
void turret_flac_projectile_think_explode()
-{
+{SELFPARAM();
if(self.enemy != world)
if(vlen(self.origin - self.enemy.origin) < self.owner.shot_radius * 3)
setorigin(self,self.enemy.origin + randomvec() * self.owner.shot_radius);
remove(self);
}
-void spawnfunc_turret_flac() { if(!turret_initialize(TUR_FLAC)) remove(self); }
+void spawnfunc_turret_flac() { SELFPARAM(); if(!turret_initialize(TUR_FLAC)) remove(self); }
float t_flac(float req)
-{
+{SELFPARAM();
switch(req)
{
case TR_ATTACK:
#else
#ifdef SVQC
bool turret_fusionreactor_firecheck()
-{
+{SELFPARAM();
if (self.attack_finished_single > time)
return false;
return true;
}
-void spawnfunc_turret_fusionreactor() { if(!turret_initialize(TUR_FUSIONREACTOR)) remove(self); }
+void spawnfunc_turret_fusionreactor() { SELFPARAM(); if(!turret_initialize(TUR_FUSIONREACTOR)) remove(self); }
float t_fusionreactor(float req)
-{
+{SELFPARAM();
switch(req)
{
case TR_ATTACK:
float autocvar_g_turrets_unit_hellion_shot_speed_max;
void turret_hellion_missile_think()
-{
+{SELFPARAM();
vector olddir,newdir;
vector pre_pos;
float itime;
UpdateCSQCProjectile(self);
}
-void spawnfunc_turret_hellion() { if(!turret_initialize(TUR_HELLION)) remove(self); }
+void spawnfunc_turret_hellion() { SELFPARAM(); if(!turret_initialize(TUR_HELLION)) remove(self); }
float t_hellion(float req)
-{
+{SELFPARAM();
switch(req)
{
case TR_ATTACK:
#endif
float hk_is_valid_target(entity e_target)
-{
+{SELFPARAM();
if (e_target == world)
return 0;
}
void turret_hk_missile_think()
-{
+{SELFPARAM();
vector vu, vd, vf, vl, vr, ve; // Vector (direction)
float fu, fd, ff, fl, fr, fe; // Fraction to solid
vector olddir,wishdir,newdir; // Final direction
}
float turret_hk_addtarget(entity e_target,entity e_sender)
-{
+{SELFPARAM();
if (e_target)
{
if (turret_validate_target(self,e_target,self.target_validate_flags) > 0)
return 0;
}
-void spawnfunc_turret_hk() { if(!turret_initialize(TUR_HK)) remove(self); }
+void spawnfunc_turret_hk() { SELFPARAM(); if(!turret_initialize(TUR_HK)) remove(self); }
float t_hk(float req)
-{
+{SELFPARAM();
switch(req)
{
case TR_ATTACK:
);
#else
#ifdef SVQC
-void spawnfunc_turret_machinegun() { if(!turret_initialize(TUR_MACHINEGUN)) remove(self); }
+void spawnfunc_turret_machinegun() { SELFPARAM(); if(!turret_initialize(TUR_MACHINEGUN)) remove(self); }
void W_MachineGun_MuzzleFlash(void);
float t_machinegun(float req)
-{
+{SELFPARAM();
switch(req)
{
case TR_ATTACK:
);
#else
#ifdef SVQC
-void spawnfunc_turret_mlrs() { if(!turret_initialize(TUR_MLRS)) remove(self); }
+void spawnfunc_turret_mlrs() { SELFPARAM(); if(!turret_initialize(TUR_MLRS)) remove(self); }
float t_mlrs(float req)
-{
+{SELFPARAM();
switch(req)
{
case TR_ATTACK:
.float fireflag;
float turret_phaser_firecheck()
-{
+{SELFPARAM();
if (self.fireflag != 0) return 0;
return turret_firecheck();
}
void beam_think()
-{
+{SELFPARAM();
if ((time > self.cnt) || (self.owner.deadflag != DEAD_NO))
{
self.owner.attack_finished_single = time + self.owner.shot_refire;
}
-void spawnfunc_turret_phaser() { if(!turret_initialize(TUR_PHASER)) remove(self); }
+void spawnfunc_turret_phaser() { SELFPARAM(); if(!turret_initialize(TUR_PHASER)) remove(self); }
float t_phaser(float req)
-{
+{SELFPARAM();
switch(req)
{
case TR_ATTACK:
);
#else
#ifdef SVQC
-void spawnfunc_turret_plasma() { if(!turret_initialize(TUR_PLASMA)) remove(self); }
+void spawnfunc_turret_plasma() { SELFPARAM(); if(!turret_initialize(TUR_PLASMA)) remove(self); }
float t_plasma(float req)
-{
+{SELFPARAM();
switch(req)
{
case TR_ATTACK:
);
#else
#ifdef SVQC
-void spawnfunc_turret_plasma_dual() { if(!turret_initialize(TUR_PLASMA_DUAL)) remove(self); }
+void spawnfunc_turret_plasma_dual() { SELFPARAM(); if(!turret_initialize(TUR_PLASMA_DUAL)) remove(self); }
float t_plasma_dual(float req)
-{
+{SELFPARAM();
switch(req)
{
case TR_ATTACK:
#else
#ifdef SVQC
entity toast(entity from, float range, float damage)
-{
+{SELFPARAM();
entity e;
entity etarget = world;
float d,dd;
}
float turret_tesla_firecheck()
-{
+{SELFPARAM();
// g_turrets_targetscan_maxdelay forces a target re-scan at least this often
float do_target_scan = 0;
return 0;
}
-void spawnfunc_turret_tesla() { if(!turret_initialize(TUR_TESLA)) remove(self); }
+void spawnfunc_turret_tesla() { SELFPARAM(); if(!turret_initialize(TUR_TESLA)) remove(self); }
float t_tesla(float req)
-{
+{SELFPARAM();
switch(req)
{
case TR_ATTACK:
#define WALKER_PATH(s,e) pathlib_astar(s,e)
float walker_firecheck()
-{
+{SELFPARAM();
if (self.animflag == ANIM_MELEE)
return 0;
}
void walker_melee_do_dmg()
-{
+{SELFPARAM();
vector where;
entity e;
}
void walker_setnoanim()
-{
+{SELFPARAM();
turrets_setframe(ANIM_NO, false);
self.animflag = self.frame;
}
void walker_rocket_explode()
-{
+{SELFPARAM();
RadiusDamage (self, self.owner, (autocvar_g_turrets_unit_walker_rocket_damage), 0, (autocvar_g_turrets_unit_walker_rocket_radius), self, world, (autocvar_g_turrets_unit_walker_rocket_force), DEATH_TURRET_WALK_ROCKET, world);
remove (self);
}
void walker_rocket_damage (entity inflictor, entity attacker, float damage, float deathtype, vector hitloc, vector vforce)
-{
+{SELFPARAM();
self.health = self.health - damage;
self.velocity = self.velocity + vforce;
#define WALKER_ROCKET_MOVE movelib_move_simple(newdir, (autocvar_g_turrets_unit_walker_rocket_speed), (autocvar_g_turrets_unit_walker_rocket_turnrate)); UpdateCSQCProjectile(self)
void walker_rocket_loop();
void walker_rocket_think()
-{
+{SELFPARAM();
vector newdir;
float edist;
float itime;
}
void walker_rocket_loop3()
-{
+{SELFPARAM();
vector newdir;
self.nextthink = time;
}
void walker_rocket_loop2()
-{
+{SELFPARAM();
vector newdir;
self.nextthink = time;
}
void walker_rocket_loop()
-{
+{SELFPARAM();
self.nextthink = time;
self.tur_shotorg = self.origin + '0 0 300';
self.think = walker_rocket_loop2;
}
void walker_fire_rocket(vector org)
-{
+{SELFPARAM();
entity rocket;
fixedmakevectors(self.angles);
.vector enemy_last_loc;
.float enemy_last_time;
void walker_move_to(vector _target, float _dist)
-{
+{SELFPARAM();
switch (self.waterlevel)
{
case WATERLEVEL_NONE:
//#define WALKER_FANCYPATHING
void walker_move_path()
-{
+{SELFPARAM();
#ifdef WALKER_FANCYPATHING
// Are we close enougth to a path node to switch to the next?
if (vlen(self.origin - self.pathcurrent.origin) < 64)
#endif
}
-void spawnfunc_turret_walker() { if(!turret_initialize(TUR_WALKER)) remove(self); }
+void spawnfunc_turret_walker() { SELFPARAM(); if(!turret_initialize(TUR_WALKER)) remove(self); }
float t_walker(float req)
-{
+{SELFPARAM();
switch(req)
{
case TR_ATTACK:
#include "../../../server/movelib.qh"
void walker_draw()
-{
+{SELFPARAM();
float dt;
dt = time - self.move_time;
}
float t_walker(float req)
-{
+{SELFPARAM();
switch(req)
{
case TR_SETUP:
* NOTICE this func overwrites the global v_forward, v_right and v_up vectors.
*/
float turret_tag_fire_update()
-{
+{SELFPARAM();
if(!self.tur_head)
{
error("Call to turret_tag_fire_update with self.tur_head missing!\n");
void FireImoBeam (vector start, vector end, vector smin, vector smax,
float bforce, float f_dmg, float f_velfactor, int deathtype)
-{
+{SELFPARAM();
vector hitloc, force, endpoint, dir;
entity ent;
#ifdef TURRET_DEBUG
void SUB_Remove();
void marker_think()
-{
+{SELFPARAM();
if(self.cnt)
if(self.cnt < time)
{
#ifndef UTIL_POST_H
#define UTIL_POST_H
+[[alias("self")]] entity __self;
+
+// Step 1: auto oldself
+#if 1
+#define SELFPARAM() noref entity this = __self
+#define self __self
+#define SELFCALL(s, f) (__self = s, f)
+#define SELFCALL_DONE() (__self = this)
+#endif
+
+// Step 2: check SELFPARAM() is present for functions that use self
+#if 0
+#define SELFPARAM() [[alias("__self")]] noref entity this = __self
+#define self this
+#define SELFCALL(s, f) (this = s, f)
+#define SELFCALL_DONE() (this = this)
+#endif
+
+// Step 3: const self
+#if 0
+#define SELFPARAM() noref const entity this = __self
+entity setself(entity e) { return self = e; }
+entity getself() { return self; }
+#define self getself()
+#define SELFCALL(s, f) (__self = s, f)
+#define SELFCALL_DONE() (__self = this)
+#endif
+
+// Step 4: enable when possible
+#if 0
+#define SELFPARAM() noref const entity this = __self
+#define self this
+#define SELFCALL(s, f) (__self = s, f)
+#define SELFCALL_DONE() (__self = this)
+#endif
+
#define spawn() new(entity)
#endif
#ifndef MENUQC
#ifndef CSQC
void wordwrap_buffer_sprint(string s)
-{
+{SELFPARAM();
wordwrap_buffer = strcat(wordwrap_buffer, s);
if(s == "\n")
{
}
void wordwrap_sprint(string s, float l)
-{
+{SELFPARAM();
wordwrap_buffer = "";
wordwrap_cb(s, l, wordwrap_buffer_sprint);
if(wordwrap_buffer != "")
}
void AuxiliaryXhair_Draw2D()
-{
+{SELFPARAM();
if (scoreboard_showscores)
return;
}
void Net_VehicleSetup()
-{
+{SELFPARAM();
int hud_id = ReadByte();
// hud_id == 0 means we exited a vehicle, so stop alarm sound/s
string iconAmmo2,
vector colorAmmo2,
string crosshair)
-{
+{SELFPARAM();
if(autocvar_r_letterbox)
return;
#endif
bool SendAuxiliaryXhair(entity to, int sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_AUXILIARYXHAIR);
}
vector targetdrone_getnewspot()
-{
+{SELFPARAM();
vector spot;
int i;
for(i = 0; i < 100; ++i)
}
void vehicles_locktarget(float incr, float decr, float _lock_time)
-{
+{SELFPARAM();
if(self.lock_target && self.lock_target.deadflag != DEAD_NO)
{
self.lock_target = world;
}
vector vehicles_force_fromtag_hover(string tag_name, float spring_length, float max_power)
-{
+{SELFPARAM();
force_fromtag_origin = gettaginfo(self, gettagindex(self, tag_name));
v_forward = normalize(v_forward) * -1;
traceline(force_fromtag_origin, force_fromtag_origin - (v_forward * spring_length), MOVE_NORMAL, self);
}
vector vehicles_force_fromtag_maglev(string tag_name, float spring_length, float max_power)
-{
+{SELFPARAM();
force_fromtag_origin = gettaginfo(self, gettagindex(self, tag_name));
v_forward = normalize(v_forward) * -1;
// projectile handling
void vehicles_projectile_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
// Ignore damage from oterh projectiles from my owner (dont mess up volly's)
if(inflictor.owner == self.owner)
return;
}
void vehicles_projectile_explode()
-{
+{SELFPARAM();
if(self.owner && other != world)
{
if(other == self.owner.vehicle)
float _dmg, float _radi, float _force, float _size,
int _deahtype, float _projtype, float _health,
bool _cull, bool _clianim, entity _owner)
-{
+{SELFPARAM();
entity proj;
proj = spawn();
}
void vehicles_gib_explode()
-{
+{SELFPARAM();
sound (self, CH_SHOTS, W_Sound("rocket_impact"), VOL_BASE, ATTEN_NORM);
Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1);
Send_Effect(EFFECT_EXPLOSION_SMALL, self.wp00.origin + '0 0 64', '0 0 0', 1);
}
void vehicles_gib_think()
-{
+{SELFPARAM();
self.alpha -= 0.1;
if(self.cnt >= time)
remove(self);
}
entity vehicle_tossgib(entity _template, vector _vel, string _tag, bool _burn, bool _explode, float _maxtime, vector _rot)
-{
+{SELFPARAM();
entity _gib = spawn();
setmodel(_gib, _template.model);
setorigin(_gib, gettaginfo(self, gettagindex(self, _tag)));
}
void vehicles_reset_colors()
-{
+{SELFPARAM();
entity e;
float _effects = 0, _colormap;
vector _glowmod, _colormod;
void vehicles_spawn();
void vehicles_return()
-{
+{SELFPARAM();
Send_Effect(EFFECT_TELEPORT, self.wp00.origin + '0 0 64', '0 0 0', 1);
self.wp00.think = vehicles_spawn;
}
void vehicles_showwp_goaway()
-{
+{SELFPARAM();
if(self.waypointsprite_attached)
WaypointSprite_Kill(self.waypointsprite_attached);
}
void vehicles_showwp()
-{
+{SELFPARAM();
entity oldself = world;
vector rgb;
}
void vehicle_use()
-{
+{SELFPARAM();
LOG_TRACE("vehicle ",self.netname, " used by ", activator.classname, "\n");
self.tur_head.team = activator.team;
}
void vehicles_regen(float timer, .float regen_field, float field_max, float rpause, float regen, float delta_time, float _healthscale)
-{
+{SELFPARAM();
if(self.regen_field < field_max)
if(timer + rpause < time)
{
}
void shieldhit_think()
-{
+{SELFPARAM();
self.alpha -= 0.1;
if (self.alpha <= 0)
{
}
void vehicles_painframe()
-{
+{SELFPARAM();
if(self.owner.vehicle_health <= 50)
if(self.pain_frame < time)
{
}
void vehicles_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
self.dmg_time = time;
// WEAPONTODO
}
void vehicles_impact(float _minspeed, float _speedfac, float _maxpain)
-{
+{SELFPARAM();
if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
return;
// vehicle enter/exit handling
vector vehicles_findgoodexit(vector prefer_spot)
-{
+{SELFPARAM();
//vector exitspot;
float mysize;
}
void vehicles_exit(bool eject)
-{
+{SELFPARAM();
entity _vehicle;
entity _player;
entity _oldself = self;
vehicles_reset_colors();
_vehicle.owner = world;
- CSQCMODEL_AUTOINIT();
+ CSQCMODEL_AUTOINIT(self);
self = _oldself;
}
void vehicles_touch()
-{
+{SELFPARAM();
if(MUTATOR_CALLHOOK(VehicleTouch, self, other))
return;
}
bool vehicle_impulse(int imp)
-{
+{SELFPARAM();
switch(imp)
{
case 17:
}
void vehicles_enter(entity pl, entity veh)
-{
+{SELFPARAM();
// Remove this when bots know how to use vehicles
if((IS_BOT_CLIENT(pl) && !autocvar_g_vehicles_allow_bots))
return;
}
void vehicles_think()
-{
+{SELFPARAM();
self.nextthink = time;
if(self.owner)
VEH_ACTION(self.vehicleid, VR_THINK);
- CSQCMODEL_AUTOUPDATE();
+ CSQCMODEL_AUTOUPDATE(self);
}
// initialization
void vehicles_spawn()
-{
+{SELFPARAM();
LOG_TRACE("Spawning vehicle: ", self.classname, "\n");
// disown & reset
VEH_ACTION(self.vehicleid, VR_SPAWN);
- CSQCMODEL_AUTOINIT();
+ CSQCMODEL_AUTOINIT(self);
}
bool vehicle_initialize(entity veh, bool nodrop)
-{
+{SELFPARAM();
if(!autocvar_g_vehicles)
return false;
}
float bumblebee_gunner_frame()
-{
+{SELFPARAM();
entity vehic = self.vehicle.owner;
entity gun = self.vehicle;
entity gunner = self;
}
void bumblebee_gunner_exit(int _exitflag)
-{
+{SELFPARAM();
entity player = self;
entity gunner = player.vehicle;
entity vehic = gunner.owner;
}
bool bumblebee_gunner_enter()
-{
+{SELFPARAM();
entity vehic = self;
entity player = other;
entity gunner = world;
}
bool vehicles_valid_pilot()
-{
+{SELFPARAM();
if(IS_BOT_CLIENT(other) && !autocvar_g_vehicles_allow_bots)
return false;
}
void bumblebee_touch()
-{
+{SELFPARAM();
if(autocvar_g_vehicles_enter) { return; }
if(self.gunner1 != world && self.gunner2 != world)
}
void bumblebee_regen()
-{
+{SELFPARAM();
if(self.gun1.delay + autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause < time)
self.gun1.vehicle_energy = min(autocvar_g_vehicle_bumblebee_cannon_ammo,
self.gun1.vehicle_energy + autocvar_g_vehicle_bumblebee_cannon_ammo_regen * frametime);
}
float bumblebee_pilot_frame()
-{
+{SELFPARAM();
entity pilot, vehic;
vector newvel;
}
void bumblebee_land()
-{
+{SELFPARAM();
float hgt;
hgt = raptor_altitude(512);
self.nextthink = time;
- CSQCMODEL_AUTOUPDATE();
+ CSQCMODEL_AUTOUPDATE(self);
}
void bumblebee_exit(float eject)
-{
+{SELFPARAM();
if(self.owner.vehicleid == VEH_BUMBLEBEE.vehicleid)
{
bumblebee_gunner_exit(eject);
}
void bumblebee_blowup()
-{
+{SELFPARAM();
RadiusDamage(self, self.enemy, autocvar_g_vehicle_bumblebee_blowup_coredamage,
autocvar_g_vehicle_bumblebee_blowup_edgedamage,
autocvar_g_vehicle_bumblebee_blowup_radius, self, world,
}
void bumblebee_diethink()
-{
+{SELFPARAM();
if(time >= self.wait)
self.think = bumblebee_blowup;
}
float bumble_raygun_send(entity to, float sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_BUMBLE_RAYGUN);
WriteByte(MSG_ENTITY, sf);
}
void spawnfunc_vehicle_bumblebee()
-{
+{SELFPARAM();
if(!autocvar_g_vehicle_bumblebee) { remove(self); return; }
if(!vehicle_initialize(VEH_BUMBLEBEE, false)) { remove(self); return; }
}
float v_bumblebee(float req)
-{
+{SELFPARAM();
switch(req)
{
case VR_IMPACT:
}
void bumble_raygun_draw()
-{
+{SELFPARAM();
float _len;
vector _dir;
vector _vtmp1, _vtmp2;
}
void bumble_raygun_read(bool bIsNew)
-{
+{SELFPARAM();
int sf = ReadByte();
if(sf & BRG_SETUP)
var vector racer_force_from_tag(string tag_name, float spring_length, float max_power);
void racer_align4point(float _delta)
-{
+{SELFPARAM();
vector push_vector;
float fl_push, fr_push, bl_push, br_push;
}
void racer_fire_cannon(string tagname)
-{
+{SELFPARAM();
vector v;
entity bolt;
}
void racer_rocket_groundhugger()
-{
+{SELFPARAM();
vector olddir, newdir;
float oldvel, newvel;
}
void racer_rocket_tracker()
-{
+{SELFPARAM();
vector olddir, newdir;
float oldvel, newvel;
}
void racer_fire_rocket(string tagname, entity trg)
-{
+{SELFPARAM();
vector v = gettaginfo(self, gettagindex(self, tagname));
entity rocket = vehicles_projectile(EFFECT_RACER_ROCKETLAUNCH.eent_eff_name, W_Sound("rocket_fire"),
v, v_forward * autocvar_g_vehicle_racer_rocket_speed,
}
float racer_frame()
-{
+{SELFPARAM();
entity player, racer;
vector df;
float ftmp;
}
void racer_think()
-{
+{SELFPARAM();
self.nextthink = time;
float pushdeltatime = time - self.lastpushtime;
self.angles_x *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * pushdeltatime);
self.angles_z *= 1 - (autocvar_g_vehicle_racer_anglestabilizer * pushdeltatime);
- CSQCMODEL_AUTOUPDATE();
+ CSQCMODEL_AUTOUPDATE(self);
}
void racer_exit(float eject)
-{
+{SELFPARAM();
vector spot;
self.think = racer_think;
}
void racer_blowup()
-{
+{SELFPARAM();
self.deadflag = DEAD_DEAD;
self.vehicle_exit(VHEF_NORMAL);
}
void racer_blowup_think()
-{
+{SELFPARAM();
self.nextthink = time;
if(time >= self.delay)
racer_blowup();
- CSQCMODEL_AUTOUPDATE();
+ CSQCMODEL_AUTOUPDATE(self);
}
void racer_deadtouch()
-{
+{SELFPARAM();
self.avelocity_x *= 0.7;
self.cnt -= 1;
if(self.cnt <= 0)
}
void spawnfunc_vehicle_racer()
-{
+{SELFPARAM();
if(!autocvar_g_vehicle_racer) { remove(self); return; }
if(!vehicle_initialize(VEH_RACER, false)) { remove(self); return; }
}
#ifdef CSQC
#if 0
void racer_draw()
-{
+{SELFPARAM();
float pushdeltatime = time - self.lastpushtime;
if (pushdeltatime > 0.15) pushdeltatime = 0;
self.lastpushtime = time;
#endif
bool v_racer(int req)
-{
+{SELFPARAM();
switch(req)
{
case VR_IMPACT:
.entity bomb2;
float raptor_altitude(float amax)
-{
+{SELFPARAM();
tracebox(self.origin, self.mins, self.maxs, self.origin - ('0 0 1' * amax), MOVE_WORLDONLY, self);
return vlen(self.origin - trace_endpos);
}
void raptor_bomblet_boom()
-{
+{SELFPARAM();
RadiusDamage (self, self.realowner, autocvar_g_vehicle_raptor_bomblet_damage,
autocvar_g_vehicle_raptor_bomblet_edgedamage,
autocvar_g_vehicle_raptor_bomblet_radius, world, world,
}
void raptor_bomblet_touch()
-{
+{SELFPARAM();
if(other == self.owner)
return;
}
void raptor_bomb_burst()
-{
+{SELFPARAM();
if(self.cnt > time)
if(autocvar_g_vehicle_raptor_bomblet_alt)
{
}
void raptor_bombdrop()
-{
+{SELFPARAM();
entity bomb_1, bomb_2;
bomb_1 = spawn();
void raptor_fire_cannon(entity gun, string tagname)
-{
+{SELFPARAM();
vehicles_projectile(EFFECT_RAPTOR_MUZZLEFLASH.eent_eff_name, W_Sound("lasergun_fire"),
gettaginfo(gun, gettagindex(gun, tagname)), normalize(v_forward + randomvec() * autocvar_g_vehicle_raptor_cannon_spread) * autocvar_g_vehicle_raptor_cannon_speed,
autocvar_g_vehicle_raptor_cannon_damage, autocvar_g_vehicle_raptor_cannon_radius, autocvar_g_vehicle_raptor_cannon_force, 0,
}
void raptor_land()
-{
+{SELFPARAM();
float hgt;
hgt = raptor_altitude(512);
self.nextthink = time;
- CSQCMODEL_AUTOUPDATE();
+ CSQCMODEL_AUTOUPDATE(self);
}
void raptor_exit(float eject)
-{
+{SELFPARAM();
vector spot;
self.tur_head.exteriormodeltoclient = world;
}
void raptor_flare_touch()
-{
+{SELFPARAM();
remove(self);
}
void raptor_flare_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
self.health -= damage;
if(self.health <= 0)
remove(self);
}
void raptor_flare_think()
-{
+{SELFPARAM();
self.nextthink = time + 0.1;
entity _missile = findchainentity(enemy, self.owner);
while(_missile)
}
float raptor_frame()
-{
+{SELFPARAM();
entity player, raptor;
float ftmp = 0;
vector df;
}
float raptor_takeoff()
-{
+{SELFPARAM();
entity player, raptor;
player = self;
self = raptor;
self.nextthink = time;
- CSQCMODEL_AUTOUPDATE();
+ CSQCMODEL_AUTOUPDATE(self);
self.nextthink = 0; // will this work?
if(self.sound_nexttime < time)
}
void raptor_blowup()
-{
+{SELFPARAM();
self.deadflag = DEAD_DEAD;
self.vehicle_exit(VHEF_NORMAL);
RadiusDamage (self, self.enemy, 250, 15, 250, world, world, 250, DEATH_VH_RAPT_DEATH, world);
}
void raptor_diethink()
-{
+{SELFPARAM();
if(time >= self.wait)
self.think = raptor_blowup;
}
self.nextthink = time;
- CSQCMODEL_AUTOUPDATE();
+ CSQCMODEL_AUTOUPDATE(self);
}
// If we dont do this ever now and then, the raptors rotors
// stop working, presumably due to angle overflow. cute.
void raptor_rotor_anglefix()
-{
+{SELFPARAM();
self.gun1.angles_y = anglemods(self.gun1.angles_y);
self.gun2.angles_y = anglemods(self.gun2.angles_y);
self.nextthink = time + 15;
}
float raptor_impulse(float _imp)
-{
+{SELFPARAM();
switch(_imp)
{
case 1:
}
void spawnfunc_vehicle_raptor()
-{
+{SELFPARAM();
if(!autocvar_g_vehicle_raptor) { remove(self); return; }
if(!vehicle_initialize(VEH_RAPTOR, false)) { remove(self); return; }
}
float v_raptor(float req)
-{
+{SELFPARAM();
switch(req)
{
case VR_IMPACT:
#ifdef CSQC
void RaptorCBShellfragDraw()
-{
+{SELFPARAM();
if(wasfreed(self))
return;
}
void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang)
-{
+{SELFPARAM();
entity sfrag;
sfrag = spawn();
vector autocvar_g_vehicle_spiderbot_bouncepain;
void spiderbot_rocket_artillery()
-{
+{SELFPARAM();
self.nextthink = time;
UpdateCSQCProjectile(self);
}
void spiderbot_rocket_unguided()
-{
+{SELFPARAM();
vector newdir, olddir;
self.nextthink = time;
}
void spiderbot_rocket_guided()
-{
+{SELFPARAM();
vector newdir, olddir;
self.nextthink = time;
}
void spiderbot_guide_release()
-{
+{SELFPARAM();
entity rkt;
rkt = findchainentity(realowner, self.owner);
if(!rkt)
}
void spiderbot_rocket_do()
-{
+{SELFPARAM();
vector v;
entity rocket = world;
.float jump_delay;
float spiderbot_frame()
-{
+{SELFPARAM();
vector ad, vf;
entity player, spider;
float ftmp;
}
void spiderbot_exit(float eject)
-{
+{SELFPARAM();
entity e;
vector spot;
}
void spiderbot_headfade()
-{
+{SELFPARAM();
self.think = spiderbot_headfade;
self.nextthink = self.fade_time;
self.alpha = 1 - (time - self.fade_time) * self.fade_rate;
}
void spiderbot_blowup()
-{
+{SELFPARAM();
if(self.cnt > time)
{
if(random() < 0.1)
}
bool spiderbot_impulse(int _imp)
-{
+{SELFPARAM();
switch(_imp)
{
case 1:
}
void spawnfunc_vehicle_spiderbot()
-{
+{SELFPARAM();
if(!autocvar_g_vehicle_spiderbot) { remove(self); return; }
if(!vehicle_initialize(VEH_SPIDERBOT, false)) { remove(self); return; }
}
float v_spiderbot(float req)
-{
+{SELFPARAM();
switch(req)
{
case VR_IMPACT:
// client movement
void viewloc_PlayerPhysics()
-{
+{SELFPARAM();
if(self.viewloc)
{
vector oldmovement = self.movement;
#ifdef CSQC
void viewloc_SetTags()
-{
+{SELFPARAM();
if(self.viewloc && wasfreed(self.viewloc))
self.viewloc = world;
void spawnfunc_weapon_arc(void) { weapon_defaultspawnfunc(WEP_ARC.m_id); }
float W_Arc_Beam_Send(entity to, int sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_ARC_BEAM);
// Truncate information when this beam is displayed to the owner client
}
void W_Arc_Beam_Think(void)
-{
+{SELFPARAM();
if(self != self.owner.arc_beam)
{
remove(self);
}
void W_Arc_Beam(float burst)
-{
+{SELFPARAM();
// only play fire sound if 1 sec has passed since player let go the fire button
if(time - self.beam_prev > 1)
}
void Arc_Smoke()
-{
+{SELFPARAM();
makevectors(self.v_angle);
W_SetupShot_Range(self,true,0,"",0,0,0);
}
bool W_Arc(int req)
-{
+{SELFPARAM();
switch(req)
{
case WR_AIM:
}
void Draw_ArcBeam(void)
-{
+{SELFPARAM();
float dt = time - self.move_time;
self.move_time = time;
if(dt <= 0) { return; }
}
void Remove_ArcBeam(void)
-{
+{SELFPARAM();
remove(self.beam_muzzleentity);
sound(self, CH_SHOTS_SINGLE, "misc/null.wav", VOL_BASE, ATTEN_NORM);
}
void Ent_ReadArcBeam(float isnew)
-{
+{SELFPARAM();
int sf = ReadByte();
entity flash;
}
bool W_Arc(int req)
-{
+{SELFPARAM();
switch(req)
{
case WR_IMPACTEFFECT:
void spawnfunc_weapon_laser(void) { spawnfunc_weapon_blaster(); }
void W_Blaster_Touch(void)
-{
+{SELFPARAM();
PROJECTILE_TOUCH;
self.event_damage = func_null;
}
void W_Blaster_Think(void)
-{
+{SELFPARAM();
self.movetype = MOVETYPE_FLY;
self.think = SUB_Remove;
self.nextthink = time + self.blaster_lifetime;
float atk_spread,
float atk_delay,
float atk_lifetime)
-{
+{SELFPARAM();
vector s_forward = v_forward * cos(atk_shotangle * DEG2RAD) + v_up * sin(atk_shotangle * DEG2RAD);
W_SetupShot_Dir(self, s_forward, false, 3, W_Sound("lasergun_fire"), CH_WEAPON_B, atk_damage);
}
}
bool W_Blaster(int request)
-{
+{SELFPARAM();
switch(request)
{
case WR_AIM:
#endif
#ifdef CSQC
bool W_Blaster(int request)
-{
+{SELFPARAM();
switch(request)
{
case WR_IMPACTEFFECT:
}
void W_Crylink_Reset(void)
-{
+{SELFPARAM();
W_Crylink_Dequeue(self);
remove(self);
}
}
void W_Crylink_LinkJoinEffect_Think(void)
-{
+{SELFPARAM();
// is there at least 2 projectiles very close?
entity e, p;
float n;
// NO bounce protection, as bounces are limited!
void W_Crylink_Touch(void)
-{
+{SELFPARAM();
float finalhit;
float f;
float isprimary = !(self.projectiledeathtype & HITTYPE_SECONDARY);
}
void W_Crylink_Fadethink(void)
-{
+{SELFPARAM();
W_Crylink_Dequeue(self);
remove(self);
}
void W_Crylink_Attack(void)
-{
+{SELFPARAM();
float counter, shots;
entity proj, prevproj, firstproj;
vector s;
}
void W_Crylink_Attack2(void)
-{
+{SELFPARAM();
float counter, shots;
entity proj, prevproj, firstproj;
vector s;
}
bool W_Crylink(int req)
-{
+{SELFPARAM();
float ammo_amount;
switch(req)
{
#endif
#ifdef CSQC
bool W_Crylink(int req)
-{
+{SELFPARAM();
switch(req)
{
case WR_IMPACTEFFECT:
void spawnfunc_weapon_rocketlauncher(void) { spawnfunc_weapon_devastator(); }
void W_Devastator_Unregister(void)
-{
+{SELFPARAM();
if(self.realowner && self.realowner.lastrocket == self)
{
self.realowner.lastrocket = world;
}
void W_Devastator_Explode(void)
-{
+{SELFPARAM();
W_Devastator_Unregister();
if(other.takedamage == DAMAGE_AIM)
}
void W_Devastator_DoRemoteExplode(void)
-{
+{SELFPARAM();
W_Devastator_Unregister();
self.event_damage = func_null;
}
void W_Devastator_RemoteExplode(void)
-{
+{SELFPARAM();
if(self.realowner.deadflag == DEAD_NO)
if(self.realowner.lastrocket)
{
// normalize(0)
void W_Devastator_Think(void)
-{
+{SELFPARAM();
vector desireddir, olddir, newdir, desiredorigin, goal;
float velspeed, f;
self.nextthink = time;
}
void W_Devastator_Touch(void)
-{
+{SELFPARAM();
if(WarpZone_Projectile_Touch())
{
if(wasfreed(self))
}
void W_Devastator_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
if(self.health <= 0)
return;
}
void W_Devastator_Attack(void)
-{
+{SELFPARAM();
entity missile;
entity flash;
}
bool W_Devastator(int req)
-{
+{SELFPARAM();
entity rock;
float rockfound;
float ammo_amount;
#endif
#ifdef CSQC
bool W_Devastator(int req)
-{
+{SELFPARAM();
switch(req)
{
case WR_IMPACTEFFECT:
}
void W_Electro_ExplodeCombo(void)
-{
+{SELFPARAM();
W_Electro_TriggerCombo(self.origin, WEP_CVAR(electro, combo_comboradius), self.realowner);
self.event_damage = func_null;
}
void W_Electro_Explode(void)
-{
+{SELFPARAM();
if(other.takedamage == DAMAGE_AIM)
if(IS_PLAYER(other))
if(DIFF_TEAM(self.realowner, other))
}
void W_Electro_Bolt_Think(void)
-{
+{SELFPARAM();
if(time >= self.ltime)
{
self.use();
}
void W_Electro_Attack_Bolt(void)
-{
+{SELFPARAM();
entity proj;
W_DecreaseAmmo(WEP_CVAR_PRI(electro, ammo));
}
void W_Electro_Orb_Touch(void)
-{
+{SELFPARAM();
PROJECTILE_TOUCH;
if(other.takedamage == DAMAGE_AIM)
{ if(WEP_CVAR_SEC(electro, touchexplode)) { W_Electro_Explode(); } }
}
void W_Electro_Orb_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
if(self.health <= 0)
return;
}
void W_Electro_Attack_Orb(void)
-{
+{SELFPARAM();
W_DecreaseAmmo(WEP_CVAR_SEC(electro, ammo));
W_SetupShot_ProjectileSize(
}
void W_Electro_CheckAttack(void)
-{
+{SELFPARAM();
if(self.electro_count > 1)
if(self.BUTTON_ATCK2)
if(weapon_prepareattack(1, -1))
.float bot_secondary_electromooth;
bool W_Electro(int req)
-{
+{SELFPARAM();
float ammo_amount;
switch(req)
{
#endif
#ifdef CSQC
bool W_Electro(int req)
-{
+{SELFPARAM();
switch(req)
{
case WR_IMPACTEFFECT:
void spawnfunc_weapon_fireball(void) { weapon_defaultspawnfunc(WEP_FIREBALL.m_id); }
void W_Fireball_Explode(void)
-{
+{SELFPARAM();
entity e;
float dist;
float points;
}
void W_Fireball_LaserPlay(float dt, float dist, float damage, float edgedamage, float burntime)
-{
+{SELFPARAM();
entity e;
float d;
vector p;
}
void W_Fireball_Think(void)
-{
+{SELFPARAM();
if(time > self.pushltime)
{
self.cnt = 1;
}
void W_Fireball_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
if(self.health <= 0)
return;
}
void W_Fireball_Attack1(void)
-{
+{SELFPARAM();
entity proj;
W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', false, 2, W_Sound("fireball_fire2"), CH_WEAPON_A, WEP_CVAR_PRI(fireball, damage) + WEP_CVAR_PRI(fireball, bfgdamage));
}
void W_Fireball_AttackEffect(float i, vector f_diff)
-{
+{SELFPARAM();
W_SetupShot_ProjectileSize(self, '-16 -16 -16', '16 16 16', false, 0, "", 0, 0);
w_shotorg += f_diff.x * v_up + f_diff.y * v_right;
Send_Effect(EFFECT_FIREBALL_PRE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
}
void W_Fireball_Attack1_Frame0(void)
-{
+{SELFPARAM();
W_Fireball_AttackEffect(0, '-1.25 -3.75 0');
sound(self, CH_WEAPON_SINGLE, W_Sound("fireball_prefire2"), VOL_BASE, ATTEN_NORM);
weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_PRI(fireball, animtime), W_Fireball_Attack1_Frame1);
}
void W_Fireball_Firemine_Think(void)
-{
+{SELFPARAM();
if(time > self.pushltime)
{
remove(self);
}
void W_Fireball_Firemine_Touch(void)
-{
+{SELFPARAM();
PROJECTILE_TOUCH;
if(other.takedamage == DAMAGE_AIM)
if(Fire_AddDamage(other, self.realowner, WEP_CVAR_SEC(fireball, damage), WEP_CVAR_SEC(fireball, damagetime), self.projectiledeathtype) >= 0)
}
void W_Fireball_Attack2(void)
-{
+{SELFPARAM();
entity proj;
vector f_diff;
float c;
}
bool W_Fireball(int req)
-{
+{SELFPARAM();
switch(req)
{
case WR_AIM:
#endif
#ifdef CSQC
bool W_Fireball(int req)
-{
+{SELFPARAM();
switch(req)
{
case WR_IMPACTEFFECT:
// NO bounce protection, as bounces are limited!
void W_Hagar_Explode(void)
-{
+{SELFPARAM();
self.event_damage = func_null;
RadiusDamage(self, self.realowner, WEP_CVAR_PRI(hagar, damage), WEP_CVAR_PRI(hagar, edgedamage), WEP_CVAR_PRI(hagar, radius), world, world, WEP_CVAR_PRI(hagar, force), self.projectiledeathtype, other);
}
void W_Hagar_Explode2(void)
-{
+{SELFPARAM();
self.event_damage = func_null;
RadiusDamage(self, self.realowner, WEP_CVAR_SEC(hagar, damage), WEP_CVAR_SEC(hagar, edgedamage), WEP_CVAR_SEC(hagar, radius), world, world, WEP_CVAR_SEC(hagar, force), self.projectiledeathtype, other);
}
void W_Hagar_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
if(self.health <= 0)
return;
}
void W_Hagar_Touch(void)
-{
+{SELFPARAM();
PROJECTILE_TOUCH;
self.use();
}
void W_Hagar_Touch2(void)
-{
+{SELFPARAM();
PROJECTILE_TOUCH;
if(self.cnt > 0 || other.takedamage == DAMAGE_AIM) {
}
void W_Hagar_Attack(void)
-{
+{SELFPARAM();
entity missile;
W_DecreaseAmmo(WEP_CVAR_PRI(hagar, ammo));
}
void W_Hagar_Attack2(void)
-{
+{SELFPARAM();
entity missile;
W_DecreaseAmmo(WEP_CVAR_SEC(hagar, ammo));
.float hagar_loadstep, hagar_loadblock, hagar_loadbeep, hagar_warning;
void W_Hagar_Attack2_Load_Release(void)
-{
+{SELFPARAM();
// time to release the rockets we've loaded
entity missile;
}
void W_Hagar_Attack2_Load(void)
-{
+{SELFPARAM();
// loadable hagar secondary attack, must always run each frame
if(time < game_starttime)
}
bool W_Hagar(int req)
-{
+{SELFPARAM();
float ammo_amount;
switch(req)
{
#endif
#ifdef CSQC
bool W_Hagar(int req)
-{
+{SELFPARAM();
switch(req)
{
case WR_IMPACTEFFECT:
void spawnfunc_weapon_hlac(void) { weapon_defaultspawnfunc(WEP_HLAC.m_id); }
void W_HLAC_Touch(void)
-{
+{SELFPARAM();
float isprimary;
PROJECTILE_TOUCH;
}
void W_HLAC_Attack(void)
-{
+{SELFPARAM();
entity missile;
float spread;
}
void W_HLAC_Attack2(void)
-{
+{SELFPARAM();
entity missile;
float spread;
// weapon frames
void W_HLAC_Attack_Frame(void)
-{
+{SELFPARAM();
if(self.weapon != self.switchweapon) // abort immediately if switching
{
w_ready();
}
void W_HLAC_Attack2_Frame(void)
-{
+{SELFPARAM();
float i;
W_DecreaseAmmo(WEP_CVAR_SEC(hlac, ammo));
}
bool W_HLAC(int req)
-{
+{SELFPARAM();
float ammo_amount;
switch(req)
{
#endif
#ifdef CSQC
bool W_HLAC(int req)
-{
+{SELFPARAM();
switch(req)
{
case WR_IMPACTEFFECT:
void spawnfunc_weapon_hmg() { weapon_defaultspawnfunc(WEP_HMG.m_id); }
void W_HeavyMachineGun_Attack_Auto()
-{
+{SELFPARAM();
if (!self.BUTTON_ATCK)
{
w_ready();
}
bool W_HeavyMachineGun(int req)
-{
+{SELFPARAM();
float ammo_amount;
switch(req)
{
#endif
#ifdef CSQC
bool W_HeavyMachineGun(int req)
-{
+{SELFPARAM();
switch(req)
{
case WR_IMPACTEFFECT:
#ifdef SVQC
void spawnfunc_weapon_hook(void)
-{
+{SELFPARAM();
if(g_grappling_hook) // offhand hook
{
startitem_failed = true;
}
void W_Hook_ExplodeThink(void)
-{
+{SELFPARAM();
float dt, dmg_remaining_next, f;
dt = time - self.teleport_time;
}
void W_Hook_Explode2(void)
-{
+{SELFPARAM();
self.event_damage = func_null;
self.touch = func_null;
self.effects |= EF_NODRAW;
}
void W_Hook_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
if(self.health <= 0)
return;
}
void W_Hook_Touch2(void)
-{
+{SELFPARAM();
PROJECTILE_TOUCH;
self.use();
}
void W_Hook_Attack2(void)
-{
+{SELFPARAM();
entity gren;
//W_DecreaseAmmo(WEP_CVAR_SEC(hook, ammo)); // WEAPONTODO: Figure out how to handle ammo with hook secondary (gravitybomb)
}
bool W_Hook(int req)
-{
+{SELFPARAM();
float hooked_time_max, hooked_fuel;
switch(req)
#endif
#ifdef CSQC
bool W_Hook(int req)
-{
+{SELFPARAM();
switch(req)
{
case WR_IMPACTEFFECT:
#ifdef SVQC
void spawnfunc_weapon_machinegun(void)
-{
+{SELFPARAM();
if(autocvar_sv_q3acompat_machineshotgunswap)
if(self.classname != "droppedweapon")
{
void spawnfunc_weapon_uzi(void) { spawnfunc_weapon_machinegun(); }
void W_MachineGun_MuzzleFlash_Think(void)
-{
+{SELFPARAM();
self.frame = self.frame + 2;
self.scale = self.scale * 0.5;
self.alpha = self.alpha - 0.25;
}
void W_MachineGun_MuzzleFlash(void)
-{
+{SELFPARAM();
if(self.muzzle_flash == world)
self.muzzle_flash = spawn();
}
void W_MachineGun_Attack(int deathtype)
-{
+{SELFPARAM();
W_SetupShot(self, true, 0, W_Sound("uzi_fire"), CH_WEAPON_A, ((self.misc_bulletcounter == 1) ? WEP_CVAR(machinegun, first_damage) : WEP_CVAR(machinegun, sustained_damage)));
if(!autocvar_g_norecoil)
{
// weapon frames
void W_MachineGun_Attack_Frame(void)
-{
+{SELFPARAM();
if(self.weapon != self.switchweapon) // abort immediately if switching
{
w_ready();
void W_MachineGun_Attack_Auto(void)
-{
+{SELFPARAM();
float machinegun_spread;
if(!self.BUTTON_ATCK)
}
void W_MachineGun_Attack_Burst(void)
-{
+{SELFPARAM();
W_SetupShot(self, true, 0, W_Sound("uzi_fire"), CH_WEAPON_A, WEP_CVAR(machinegun, sustained_damage));
if(!autocvar_g_norecoil)
{
}
bool W_MachineGun(int req)
-{
+{SELFPARAM();
float ammo_amount;
switch(req)
{
#endif
#ifdef CSQC
bool W_MachineGun(int req)
-{
+{SELFPARAM();
switch(req)
{
case WR_IMPACTEFFECT:
void spawnfunc_weapon_minelayer(void) { weapon_defaultspawnfunc(WEP_MINE_LAYER.m_id); }
void W_MineLayer_Stick(entity to)
-{
+{SELFPARAM();
spamsound(self, CH_SHOTS, W_Sound("mine_stick"), VOL_BASE, ATTN_NORM);
// in order for mines to face properly when sticking to the ground, they must be a server side entity rather than a csqc projectile
}
void W_MineLayer_Explode(void)
-{
+{SELFPARAM();
if(other.takedamage == DAMAGE_AIM)
if(IS_PLAYER(other))
if(DIFF_TEAM(self.realowner, other))
}
void W_MineLayer_DoRemoteExplode(void)
-{
+{SELFPARAM();
self.event_damage = func_null;
self.takedamage = DAMAGE_NO;
}
void W_MineLayer_RemoteExplode(void)
-{
+{SELFPARAM();
if(self.realowner.deadflag == DEAD_NO)
if((self.spawnshieldtime >= 0)
? (time >= self.spawnshieldtime) // timer
}
void W_MineLayer_ProximityExplode(void)
-{
+{SELFPARAM();
// make sure no friend is in the mine's radius. If there is any, explosion is delayed until he's at a safe distance
if(WEP_CVAR(minelayer, protection) && self.mine_explodeanyway == 0)
{
}
void W_MineLayer_Think(void)
-{
+{SELFPARAM();
entity head;
self.nextthink = time;
}
void W_MineLayer_Touch(void)
-{
+{SELFPARAM();
if(self.movetype == MOVETYPE_NONE || self.movetype == MOVETYPE_FOLLOW)
return; // we're already a stuck mine, why do we get called? TODO does this even happen?
}
void W_MineLayer_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
if(self.health <= 0)
return;
}
void W_MineLayer_Attack(void)
-{
+{SELFPARAM();
entity mine;
entity flash;
}
float W_MineLayer_PlacedMines(float detonate)
-{
+{SELFPARAM();
entity mine;
float minfound = 0;
}
bool W_MineLayer(int req)
-{
+{SELFPARAM();
entity mine;
float ammo_amount;
switch(req)
#endif
#ifdef CSQC
bool W_MineLayer(int req)
-{
+{SELFPARAM();
switch(req)
{
case WR_IMPACTEFFECT:
void spawnfunc_weapon_grenadelauncher(void) { spawnfunc_weapon_mortar(); }
void W_Mortar_Grenade_Explode(void)
-{
+{SELFPARAM();
if(other.takedamage == DAMAGE_AIM)
if(IS_PLAYER(other))
if(DIFF_TEAM(self.realowner, other))
}
void W_Mortar_Grenade_Explode2(void)
-{
+{SELFPARAM();
if(other.takedamage == DAMAGE_AIM)
if(IS_PLAYER(other))
if(DIFF_TEAM(self.realowner, other))
void W_Mortar_Grenade_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
if(self.health <= 0)
return;
}
void W_Mortar_Grenade_Think1(void)
-{
+{SELFPARAM();
self.nextthink = time;
if(time > self.cnt)
{
}
void W_Mortar_Grenade_Touch1(void)
-{
+{SELFPARAM();
PROJECTILE_TOUCH;
if(other.takedamage == DAMAGE_AIM || WEP_CVAR_PRI(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile
{
}
void W_Mortar_Grenade_Touch2(void)
-{
+{SELFPARAM();
PROJECTILE_TOUCH;
if(other.takedamage == DAMAGE_AIM || WEP_CVAR_SEC(mortar, type) == 0) // always explode when hitting a player, or if normal mortar projectile
{
}
void W_Mortar_Attack(void)
-{
+{SELFPARAM();
entity gren;
W_DecreaseAmmo(WEP_CVAR_PRI(mortar, ammo));
}
void W_Mortar_Attack2(void)
-{
+{SELFPARAM();
entity gren;
W_DecreaseAmmo(WEP_CVAR_SEC(mortar, ammo));
.float bot_secondary_grenademooth;
bool W_Mortar(int req)
-{
+{SELFPARAM();
entity nade;
float nadefound;
float ammo_amount;
#endif
#ifdef CSQC
bool W_Mortar(int req)
-{
+{SELFPARAM();
switch(req)
{
case WR_IMPACTEFFECT:
void spawnfunc_weapon_porto(void) { weapon_defaultspawnfunc(WEP_PORTO.m_id); }
void W_Porto_Success(void)
-{
+{SELFPARAM();
if(self.realowner == world)
{
objerror("Cannot succeed successfully: no owner\n");
string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo);
void W_Porto_Fail(float failhard)
-{
+{SELFPARAM();
if(self.realowner == world)
{
objerror("Cannot fail successfully: no owner\n");
}
void W_Porto_Remove(entity p)
-{
+{SELFPARAM();
if(p.porto_current.realowner == p && p.porto_current.classname == "porto")
{
entity oldself;
}
void W_Porto_Think(void)
-{
+{SELFPARAM();
trace_plane_normal = '0 0 0';
if(self.realowner.playerid != self.playerid)
remove(self);
}
void W_Porto_Touch(void)
-{
+{SELFPARAM();
vector norm;
// do not use PROJECTILE_TOUCH here
}
void W_Porto_Attack(float type)
-{
+{SELFPARAM();
entity gren;
W_SetupShot(self, false, 4, "porto/fire.wav", CH_WEAPON_A, 0);
bool w_nexball_weapon(int req); // WEAPONTODO
bool W_Porto(int req)
-{
+{SELFPARAM();
//vector v_angle_save;
if(g_nexball) { return w_nexball_weapon(req); }
#endif
#ifdef CSQC
bool W_Porto(int req)
-{
+{SELFPARAM();
switch(req)
{
case WR_IMPACTEFFECT:
void spawnfunc_weapon_sniperrifle(void) { spawnfunc_weapon_rifle(); }
void W_Rifle_FireBullet(float pSpread, float pDamage, float pForce, float pSolidPenetration, float pAmmo, int deathtype, float pTracer, float pShots, string pSound)
-{
+{SELFPARAM();
float i;
W_DecreaseAmmo(pAmmo);
.float rifle_bullethail_animtime;
.float rifle_bullethail_refire;
void W_Rifle_BulletHail_Continue(void)
-{
+{SELFPARAM();
float r, sw, af;
sw = self.switchweapon; // make it not detect weapon changes as reason to abort firing
}
void W_Rifle_BulletHail(float mode, void(void) AttackFunc, float fr, float animtime, float refire)
-{
+{SELFPARAM();
// if we get here, we have at least one bullet to fire
AttackFunc();
if(mode)
.float bot_secondary_riflemooth;
bool W_Rifle(int req)
-{
+{SELFPARAM();
float ammo_amount;
switch(req)
#endif
#ifdef CSQC
bool W_Rifle(int req)
-{
+{SELFPARAM();
switch(req)
{
case WR_IMPACTEFFECT:
void spawnfunc_weapon_rpc() { weapon_defaultspawnfunc(WEP_RPC.m_id); }
void W_RocketPropelledChainsaw_Explode()
-{
+{SELFPARAM();
self.event_damage = func_null;
self.takedamage = DAMAGE_NO;
}
void W_RocketPropelledChainsaw_Touch (void)
-{
+{SELFPARAM();
if(WarpZone_Projectile_Touch())
if(wasfreed(self))
return;
}
void W_RocketPropelledChainsaw_Damage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
if (self.health <= 0)
return;
}
void W_RocketPropelledChainsaw_Think()
-{
+{SELFPARAM();
if(self.cnt <= time)
{
remove(self);
}
void W_RocketPropelledChainsaw_Attack (void)
-{
+{SELFPARAM();
entity missile = spawn(); //WarpZone_RefSys_SpawnSameRefSys(self);
entity flash = spawn ();
}
bool W_RocketPropelledChainsaw(int req)
-{
+{SELFPARAM();
float ammo_amount = false;
switch(req)
{
#ifdef CSQC
bool W_RocketPropelledChainsaw(int req)
-{
+{SELFPARAM();
switch(req)
{
case WR_IMPACTEFFECT:
// Begin: Missile functions, these are general functions to be manipulated by other code
// ============================
void W_Seeker_Missile_Explode(void)
-{
+{SELFPARAM();
self.event_damage = func_null;
RadiusDamage(self, self.realowner, WEP_CVAR(seeker, missile_damage), WEP_CVAR(seeker, missile_edgedamage), WEP_CVAR(seeker, missile_radius), world, world, WEP_CVAR(seeker, missile_force), self.projectiledeathtype, other);
}
void W_Seeker_Missile_Think(void)
-{
+{SELFPARAM();
entity e;
vector desireddir, olddir, newdir, eorg;
float turnrate;
void W_Seeker_Missile_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
if(self.health <= 0)
return;
*/
void W_Seeker_Fire_Missile(vector f_diff, entity m_target)
-{
+{SELFPARAM();
entity missile;
W_DecreaseAmmo(WEP_CVAR(seeker, missile_ammo));
// Begin: FLAC, close range attack meant for defeating rockets which are coming at you.
// ============================
void W_Seeker_Flac_Explode(void)
-{
+{SELFPARAM();
self.event_damage = func_null;
RadiusDamage(self, self.realowner, WEP_CVAR(seeker, flac_damage), WEP_CVAR(seeker, flac_edgedamage), WEP_CVAR(seeker, flac_radius), world, world, WEP_CVAR(seeker, flac_force), self.projectiledeathtype, other);
}
void W_Seeker_Fire_Flac(void)
-{
+{SELFPARAM();
entity missile;
vector f_diff;
float c;
}
void W_Seeker_Attack(void)
-{
+{SELFPARAM();
entity tracker, closest_target;
closest_target = world;
}
void W_Seeker_Vollycontroller_Think(void) // TODO: Merge this with W_Seeker_Attack
-{
+{SELFPARAM();
float c;
entity oldself,oldenemy;
self.cnt = self.cnt - 1;
}
void W_Seeker_Tracker_Think(void)
-{
+{SELFPARAM();
// commit suicide if: You die OR target dies OR you switch away from the seeker OR commit suicide if lifetime is up
if((self.realowner.deadflag != DEAD_NO) || (self.tag_target.deadflag != DEAD_NO) || (self.realowner.switchweapon != WEP_SEEKER.m_id)
|| (time > self.tag_time + WEP_CVAR(seeker, tag_tracker_lifetime)))
// Begin: Tag projectile
// ============================
void W_Seeker_Tag_Explode(void)
-{
+{SELFPARAM();
//if(other==self.realowner)
// return;
Damage_DamageInfo(self.origin, 0, 0, 0, self.velocity, WEP_SEEKER.m_id | HITTYPE_BOUNCE, other.species, self);
}
void W_Seeker_Tag_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
if(self.health <= 0)
return;
self.health = self.health - damage;
}
void W_Seeker_Tag_Touch(void)
-{
+{SELFPARAM();
vector dir;
vector org2;
entity e;
}
void W_Seeker_Fire_Tag(void)
-{
+{SELFPARAM();
entity missile;
W_DecreaseAmmo(WEP_CVAR(seeker, tag_ammo));
// ============================
bool W_Seeker(int req)
-{
+{SELFPARAM();
float ammo_amount;
switch(req)
#endif
#ifdef CSQC
bool W_Seeker(int req)
-{
+{SELFPARAM();
switch(req)
{
case WR_IMPACTEFFECT:
#ifdef IMPLEMENTATION
#ifdef SVQC
void spawnfunc_weapon_shockwave(void)
-{
+{SELFPARAM();
//if(autocvar_sv_q3acompat_machineshockwaveswap) // WEAPONTODO
if(autocvar_sv_q3acompat_machineshotgunswap)
if(self.classname != "droppedweapon")
// MELEE ATTACK MODE
void W_Shockwave_Melee_Think(void)
-{
+{SELFPARAM();
// declarations
float i, f, swing, swing_factor, swing_damage, meleetime, is_player;
entity target_victim;
}
void W_Shockwave_Melee(void)
-{
+{SELFPARAM();
sound(self, CH_WEAPON_A, W_Sound("shotgun_melee"), VOL_BASE, ATTN_NORM);
weapon_thinkf(WFRAME_FIRE2, WEP_CVAR(shockwave, melee_animtime), w_ready);
vector nearest_on_line,
vector sw_shotorg,
vector attack_endpos)
-{
+{SELFPARAM();
vector nearest_to_attacker = head.WarpZone_findradius_nearest;
vector center = (head.origin + (head.mins + head.maxs) * 0.5);
vector corner;
}
void W_Shockwave_Send(void)
-{
+{SELFPARAM();
WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
WriteByte(MSG_BROADCAST, TE_CSQC_SHOCKWAVEPARTICLE);
WriteCoord(MSG_BROADCAST, w_shotorg.x);
}
void W_Shockwave_Attack(void)
-{
+{SELFPARAM();
// declarations
float multiplier, multiplier_from_accuracy, multiplier_from_distance;
float final_damage;
}
bool W_Shockwave(int req)
-{
+{SELFPARAM();
switch(req)
{
case WR_AIM:
const float SW_FADETIME = 0.4;
const float SW_DISTTOMIN = 200;
void Draw_Shockwave()
-{
+{SELFPARAM();
// fading/removal control
float a = bound(0, (SW_MAXALPHA - ((time - self.sw_time) / SW_FADETIME)), SW_MAXALPHA);
if(a < ALPHA_MIN_VISIBLE) { remove(self); }
}
bool W_Shockwave(int req)
-{
+{SELFPARAM();
switch(req)
{
case WR_IMPACTEFFECT:
void spawnfunc_weapon_shotgun(void) { weapon_defaultspawnfunc(WEP_SHOTGUN.m_id); }
void W_Shotgun_Attack(float isprimary)
-{
+{SELFPARAM();
float sc;
entity flash;
.float swing_prev;
.entity swing_alreadyhit;
void W_Shotgun_Melee_Think(void)
-{
+{SELFPARAM();
// declarations
float i, f, swing, swing_factor, swing_damage, meleetime, is_player;
entity target_victim;
}
void W_Shotgun_Attack2(void)
-{
+{SELFPARAM();
sound(self, CH_WEAPON_A, W_Sound("shotgun_melee"), VOL_BASE, ATTEN_NORM);
weapon_thinkf(WFRAME_FIRE2, WEP_CVAR_SEC(shotgun, animtime), w_ready);
// alternate secondary weapon frames
void W_Shotgun_Attack3_Frame2()
-{
+{SELFPARAM();
if (!WEP_ACTION(self.weapon, WR_CHECKAMMO2))
if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
{
weapon_thinkf(WFRAME_FIRE1, WEP_CVAR_SEC(shotgun, alt_animtime), w_ready);
}
void W_Shotgun_Attack3_Frame1()
-{
+{SELFPARAM();
if (!WEP_ACTION(self.weapon, WR_CHECKAMMO2))
if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
{
.float shotgun_primarytime;
float W_Shotgun(float req)
-{
+{SELFPARAM();
float ammo_amount;
switch(req)
{
#ifdef CSQC
.float prevric;
float W_Shotgun(float req)
-{
+{SELFPARAM();
switch(req)
{
case WR_IMPACTEFFECT:
}
void W_Tuba_NoteOff(void)
-{
+{SELFPARAM();
// we have a note:
// on: self.spawnshieldtime
// off: time
}
bool W_Tuba_NoteSendEntity(entity to, int sf)
-{
+{SELFPARAM();
int f;
msg_entity = to;
}
void W_Tuba_NoteThink(void)
-{
+{SELFPARAM();
float dist_mult;
float vol0, vol1;
vector dir0, dir1;
}
void W_Tuba_NoteOn(float hittype)
-{
+{SELFPARAM();
vector o;
float n;
}
bool W_Tuba(int req)
-{
+{SELFPARAM();
switch(req)
{
case WR_AIM:
#endif
#ifdef CSQC
bool W_Tuba(int req)
-{
+{SELFPARAM();
// nothing to do here; particles of tuba are handled differently
// WEAPONTODO
void spawnfunc_weapon_minstanex(void) { spawnfunc_weapon_vaporizer(); }
void W_RocketMinsta_Explosion(vector loc)
-{
+{SELFPARAM();
if(accuracy_canbegooddamage(self))
accuracy_add(self, WEP_DEVASTATOR.m_id, autocvar_g_rm_damage, 0);
entity dmgent = spawn();
}
void W_Vaporizer_Attack(void)
-{
+{SELFPARAM();
float flying;
flying = IsFlying(self); // do this BEFORE to make the trace values from FireRailgunBullet last
}
void W_RocketMinsta_Laser_Explode (void)
-{
+{SELFPARAM();
if(other.takedamage == DAMAGE_AIM)
if(IS_PLAYER(other))
if(DIFF_TEAM(self.realowner, other))
}
void W_RocketMinsta_Laser_Touch (void)
-{
+{SELFPARAM();
PROJECTILE_TOUCH;
//W_RocketMinsta_Laser_Explode ();
RadiusDamage (self, self.realowner, self.rm_damage, self.rm_edmg, autocvar_g_rm_laser_radius, world, world, self.rm_force, self.projectiledeathtype, other);
}
void W_RocketMinsta_Attack2(void)
-{
+{SELFPARAM();
makevectors(self.v_angle);
entity proj;
}
void W_RocketMinsta_Attack3 (void)
-{
+{SELFPARAM();
makevectors(self.v_angle);
entity proj;
}
float W_Vaporizer(float req)
-{
+{SELFPARAM();
float ammo_amount;
float vaporizer_ammo;
float rapid = autocvar_g_rm_laser_rapid;
#endif
#ifdef CSQC
float W_Vaporizer(float req)
-{
+{SELFPARAM();
switch(req)
{
case WR_IMPACTEFFECT:
}
void W_Vortex_Attack(float issecondary)
-{
+{SELFPARAM();
float mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, myammo, charge;
mydmg = WEP_CVAR_BOTH(vortex, !issecondary, damage);
.float vortex_chargepool_pauseregen_finished;
bool W_Vortex(int req)
-{
+{SELFPARAM();
float dt;
float ammo_amount;
switch(req)
#ifdef CSQC
float autocvar_g_balance_vortex_secondary = 0; // WEAPONTODO
bool W_Vortex(int req)
-{
+{SELFPARAM();
switch(req)
{
case WR_IMPACTEFFECT:
.float csqcmodel_lerpfrac2time;
void CSQCModel_InterpolateAnimation_2To4_PreNote(int sf)
-{
+{SELFPARAM();
if(sf & CSQCMODEL_PROPERTY_FRAME)
{
self.frame3 = self.frame;
}
}
void CSQCModel_InterpolateAnimation_1To2_PreNote(int sf)
-{
+{SELFPARAM();
if(sf & CSQCMODEL_PROPERTY_FRAME)
{
self.frame2 = self.frame;
}
void CSQCModel_InterpolateAnimation_2To4_Note(int sf, float set_times)
-{
+{SELFPARAM();
if(sf & CSQCMODEL_PROPERTY_FRAME)
{
if(set_times)
}
}
void CSQCModel_InterpolateAnimation_1To2_Note(int sf, float set_times)
-{
+{SELFPARAM();
if(sf & CSQCMODEL_PROPERTY_FRAME)
{
if(set_times)
}
void CSQCModel_InterpolateAnimation_2To4_Do()
-{
+{SELFPARAM();
if(autocvar_cl_nolerp || (autocvar_cl_lerpanim_maxdelta_framegroups == 0))
{
self.lerpfrac = self.csqcmodel_lerpfrac;
}
}
void CSQCModel_InterpolateAnimation_1To2_Do()
-{
+{SELFPARAM();
if(autocvar_cl_nolerp || (autocvar_cl_lerpanim_maxdelta_framegroups == 0))
{
self.lerpfrac = 0;
}
void CSQCModel_Draw()
-{
+{SELFPARAM();
// some nice flags for CSQCMODEL_IF and the hooks
bool isplayer = (self.entnum >= 1 && self.entnum <= maxclients);
noref bool islocalplayer = (self.entnum == player_localnum + 1);
}
void CSQCModel_Read(bool isnew)
-{
+{SELFPARAM();
int sf = ReadInt24_t();
// some nice flags for CSQCMODEL_IF and the hooks
}
void CSQCPlayer_Unpredict()
-{
+{SELFPARAM();
if(csqcplayer_status == CSQCPLAYERSTATUS_UNPREDICTED)
return;
if(csqcplayer_status != CSQCPLAYERSTATUS_PREDICTED)
}
void CSQCPlayer_SetMinsMaxs()
-{
+{SELFPARAM();
if(self.flags & FL_DUCKED)
{
self.mins = PL_CROUCH_MIN;
}
void CSQCPlayer_SavePrediction()
-{
+{SELFPARAM();
player_pmflags = self.flags;
csqcplayer_origin = self.origin;
csqcplayer_velocity = self.velocity;
void CSQC_ClientMovement_PlayerMove_Frame();
void PM_Movement_Move()
-{
+{SELFPARAM();
runstandardplayerphysics(self);
#ifdef CSQC
self.flags =
}
void CSQCPlayer_PredictTo(float endframe, float apply_error)
-{
+{SELFPARAM();
CSQCPlayer_Unpredict();
if(apply_error)
{
}
bool CSQCPlayer_IsLocalPlayer()
-{
+{SELFPARAM();
return (self == csqcplayer);
}
}
void CSQCPlayer_SetCamera()
-{
+{SELFPARAM();
vector v0;
v0 = pmove_vel; // TRICK: pmove_vel is set by the engine when we get here. No need to network velocity
}
float CSQCPlayer_PreUpdate()
-{
+{SELFPARAM();
if(self != csqcplayer)
return 0;
if(csqcplayer_status != CSQCPLAYERSTATUS_FROMSERVER)
}
float CSQCPlayer_PostUpdate()
-{
+{SELFPARAM();
if(self.entnum != player_localnum + 1)
return 0;
csqcplayer = self;
.vector ivup1, ivup2;
.float itime1, itime2;
void InterpolateOrigin_Reset()
-{
+{SELFPARAM();
self.iflags &= ~IFLAG_INTERNALMASK;
self.itime1 = self.itime2 = 0;
}
void InterpolateOrigin_Note()
-{
+{SELFPARAM();
float dt;
int f0;
}
}
void InterpolateOrigin_Do()
-{
+{SELFPARAM();
vector forward, up;
if(self.itime1 && self.itime2 && self.itime1 != self.itime2)
{
}
}
void InterpolateOrigin_Undo()
-{
+{SELFPARAM();
if(self.iflags & IFLAG_ORIGIN)
setorigin(self, self.iorigin2);
if(self.iflags & IFLAG_ANGLES)
// generic CSQC model code
bool CSQCModel_Send(entity to, int sf)
-{
+{SELFPARAM();
// some nice flags for CSQCMODEL_IF
float isplayer = (IS_CLIENT(self));
float islocalplayer = (self == to);
#ifdef CSQCPLAYER_FORCE_UPDATES
.float csqcmodel_nextforcedupdate;
#endif
-void CSQCModel_CheckUpdate()
+void CSQCModel_CheckUpdate(entity e)
{
// some nice flags for CSQCMODEL_IF
- float isplayer = (IS_CLIENT(self));
+ float isplayer = (IS_CLIENT(e));
float islocalplayer = isplayer; // we set BOTH to 1 here as we need the sendflags
float isnolocalplayer = isplayer; // we set BOTH to 1 here as we need the sendflags
unused_float = isnolocalplayer;
#ifdef CSQCPLAYER_FORCE_UPDATES
- if(isplayer && time > self.csqcmodel_nextforcedupdate)
+ if(isplayer && time > e.csqcmodel_nextforcedupdate)
{
- self.SendFlags |= CSQCMODEL_PROPERTY_ORIGIN;
- self.csqcmodel_nextforcedupdate = time + CSQCPLAYER_FORCE_UPDATES * (0.5 + random()); // ensure about 4 origin sends per sec
+ e.SendFlags |= CSQCMODEL_PROPERTY_ORIGIN;
+ e.csqcmodel_nextforcedupdate = time + CSQCPLAYER_FORCE_UPDATES * (0.5 + random()); // ensure about 4 origin sends per sec
}
#endif
- if(self.effects & EF_RESTARTANIM_BIT)
+ if(e.effects & EF_RESTARTANIM_BIT)
{
- self.SendFlags |= CSQCMODEL_PROPERTY_FRAME | CSQCMODEL_PROPERTY_FRAME2; // full anim resend please
- self.effects &= ~EF_RESTARTANIM_BIT;
+ e.SendFlags |= CSQCMODEL_PROPERTY_FRAME | CSQCMODEL_PROPERTY_FRAME2; // full anim resend please
+ e.effects &= ~EF_RESTARTANIM_BIT;
}
- if(self.effects & EF_TELEPORT_BIT)
+ if(e.effects & EF_TELEPORT_BIT)
{
- self.SendFlags |= CSQCMODEL_PROPERTY_TELEPORTED; // no interpolation please
- self.effects &= ~EF_TELEPORT_BIT;
+ e.SendFlags |= CSQCMODEL_PROPERTY_TELEPORTED; // no interpolation please
+ e.effects &= ~EF_TELEPORT_BIT;
}
#define CSQCMODEL_IF(cond) if(cond) {
#define CSQCMODEL_ENDIF }
#define CSQCMODEL_PROPERTY(flag,t,r,w,f) \
{ \
- t tmp = self.f; \
- if(tmp != self.csqcmodel_##f) \
+ t tmp = e.f; \
+ if(tmp != e.csqcmodel_##f) \
{ \
- self.csqcmodel_##f = tmp; \
- self.SendFlags |= flag; \
+ e.csqcmodel_##f = tmp; \
+ e.SendFlags |= flag; \
} \
}
#define CSQCMODEL_PROPERTY_SCALED(flag,t,r,w,f,s,mi,ma) \
{ \
- t tmp = rint(bound(mi, s * self.f, ma) - mi); \
- if(tmp != self.csqcmodel_##f) \
+ t tmp = rint(bound(mi, s * e.f, ma) - mi); \
+ if(tmp != e.csqcmodel_##f) \
{ \
- self.csqcmodel_##f = tmp; \
- self.SendFlags |= flag; \
+ e.csqcmodel_##f = tmp; \
+ e.SendFlags |= flag; \
} \
}
ALLPROPERTIES
#undef CSQCMODEL_IF
}
-void CSQCModel_LinkEntity()
+void CSQCModel_LinkEntity(entity e)
{
- self.SendEntity = CSQCModel_Send;
- self.SendFlags = 0xFFFFFF;
- CSQCModel_CheckUpdate();
+ e.SendEntity = CSQCModel_Send;
+ e.SendFlags = 0xFFFFFF;
+ CSQCModel_CheckUpdate(e);
}
void CSQCModel_UnlinkEntity()
-{
+{SELFPARAM();
self.SendEntity = func_null;
}
// generic CSQC model code
-void CSQCModel_CheckUpdate();
-void CSQCModel_LinkEntity();
+void CSQCModel_CheckUpdate(entity e);
+void CSQCModel_LinkEntity(entity e);
void CSQCModel_UnlinkEntity();
#define CSQCMODEL_IF(cond)
==================
*/
void SUB_Remove()
-{
+{SELFPARAM();
remove (self);
}
void defer_think()
-{
- entity oself;
-
- oself = self;
- self = self.owner;
- oself.think = SUB_Remove;
- oself.nextthink = time;
-
- oself.use();
+{SELFPARAM();
+ self.think = SUB_Remove;
+ self.nextthink = time;
+ SELFCALL(self.owner, self.use());
+ SELFCALL_DONE();
}
/*
self when func is executed = self when defer is called
*/
void defer(float fdelay, void() func)
-{
+{SELFPARAM();
entity e;
e = spawn();
}
void anticheat_physics()
-{
+{SELFPARAM();
float f;
// div0_evade -> SPECTATORS
}
void anticheat_spectatecopy(entity spectatee)
-{
+{SELFPARAM();
// div0_evade -> SPECTATORS
self.angles = spectatee.anticheat_div0_evade_v_angle;
}
void anticheat_prethink()
-{
+{SELFPARAM();
// div0_evade -> SPECTATORS
self.anticheat_div0_evade_offset = 0;
}
}
void anticheat_report()
-{
+{SELFPARAM();
if(!autocvar_sv_eventlog)
return;
// TODO(divVerent): Use xonstat to acquire good thresholds.
}
float anticheat_getvalue(string id)
-{
+{SELFPARAM();
switch(id) {
case "_time": return servertime - self.anticheat_jointime;
case "speedhack": return MEAN_EVALUATE(anticheat_speedhack);
}
void anticheat_fixangle()
-{
+{SELFPARAM();
self.anticheat_fixangle_endtime = servertime + ANTILAG_LATENCY(self) + 0.2;
}
void anticheat_endframe()
-{
+{SELFPARAM();
entity oldself = self;
FOR_EACH_CLIENT(self)
if (self.fixangle)
}
void anticheat_init()
-{
+{SELFPARAM();
self.anticheat_speedhack_offset = 0;
self.anticheat_jointime = servertime;
}
}
void lag_update()
-{
+{SELFPARAM();
if (self.lag1_time) if (time > self.lag1_time) {self.lag_func(self.lag1_time, self.lag1_float1, self.lag1_float2, self.lag1_entity1, self.lag1_vec1, self.lag1_vec2, self.lag1_vec3, self.lag1_vec4);self.lag1_time = 0;}
if (self.lag2_time) if (time > self.lag2_time) {self.lag_func(self.lag2_time, self.lag2_float1, self.lag2_float2, self.lag2_entity1, self.lag2_vec1, self.lag2_vec2, self.lag2_vec3, self.lag2_vec4);self.lag2_time = 0;}
if (self.lag3_time) if (time > self.lag3_time) {self.lag_func(self.lag3_time, self.lag3_float1, self.lag3_float2, self.lag3_entity1, self.lag3_vec1, self.lag3_vec2, self.lag3_vec3, self.lag3_vec4);self.lag3_time = 0;}
}
float lag_additem(float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4)
-{
+{SELFPARAM();
if (self.lag1_time == 0) {self.lag1_time = t;self.lag1_float1 = f1;self.lag1_float2 = f2;self.lag1_entity1 = e1;self.lag1_vec1 = v1;self.lag1_vec2 = v2;self.lag1_vec3 = v3;self.lag1_vec4 = v4;return true;}
if (self.lag2_time == 0) {self.lag2_time = t;self.lag2_float1 = f1;self.lag2_float2 = f2;self.lag2_entity1 = e1;self.lag2_vec1 = v1;self.lag2_vec2 = v2;self.lag2_vec3 = v3;self.lag2_vec4 = v4;return true;}
if (self.lag3_time == 0) {self.lag3_time = t;self.lag3_float1 = f1;self.lag3_float2 = f2;self.lag3_entity1 = e1;self.lag3_vec1 = v1;self.lag3_vec2 = v2;self.lag3_vec3 = v3;self.lag3_vec4 = v4;return true;}
}
float bot_shouldattack(entity e)
-{
+{SELFPARAM();
if (e.team == self.team)
{
if (e == self)
}
void bot_lagfunc(float t, float f1, float f2, entity e1, vector v1, vector v2, vector v3, vector v4)
-{
+{SELFPARAM();
if(self.flags & FL_INWATER)
{
self.bot_aimtarg = world;
}
float bot_aimdir(vector v, float maxfiredeviation)
-{
+{SELFPARAM();
float dist, delta_t, blend;
vector desiredang, diffang;
}
float bot_aim(float shotspeed, float shotspeedupward, float maxshottime, float applygravity)
-{
+{SELFPARAM();
float f, r, hf, distanceratio;
vector v;
/*
#include "../../warpzonelib/util_server.qh"
entity bot_spawn()
-{
+{SELFPARAM();
entity oldself, bot;
bot = spawnclient();
if (bot)
}
void bot_think()
-{
+{SELFPARAM();
if (self.bot_nextthink > time)
return;
}
void bot_setnameandstuff()
-{
+{SELFPARAM();
string readfile, s;
float file, tokens, prio;
entity p;
}
void bot_clientdisconnect()
-{
+{SELFPARAM();
if (!IS_BOT_CLIENT(self))
return;
bot_clearqueue(self);
}
void bot_clientconnect()
-{
+{SELFPARAM();
if (!IS_BOT_CLIENT(self))
return;
self.bot_preferredcolors = self.clientcolors;
#include "../../../warpzonelib/common.qh"
void havocbot_ai()
-{
+{SELFPARAM();
if(self.draggedby)
return;
}
void havocbot_keyboard_movement(vector destorg)
-{
+{SELFPARAM();
vector keyboard;
float blend, maxspeed;
float sk;
}
void havocbot_bunnyhop(vector dir)
-{
+{SELFPARAM();
float bunnyhopdistance;
vector deviation;
float maxspeed;
}
void havocbot_movetogoal()
-{
+{SELFPARAM();
vector destorg;
vector diff;
vector dir;
}
void havocbot_chooseenemy()
-{
+{SELFPARAM();
entity head, best, head2;
float rating, bestrating, i, hf;
vector eye, v;
}
float havocbot_chooseweapon_checkreload(int new_weapon)
-{
+{SELFPARAM();
// bots under this skill cannot find unloaded weapons to reload idly when not in combat,
// so skip this for them, or they'll never get to reload their weapons at all.
// this also allows bots under this skill to be more stupid, and reload more often during combat :)
}
void havocbot_chooseweapon()
-{
+{SELFPARAM();
int i;
// ;)
}
void havocbot_aim()
-{
+{SELFPARAM();
vector selfvel, enemyvel;
// if(self.flags & FL_INWATER)
// return;
}
float havocbot_moveto_refresh_route()
-{
+{SELFPARAM();
// Refresh path to goal if necessary
entity wp;
wp = self.havocbot_personal_waypoint;
}
float havocbot_moveto(vector pos)
-{
+{SELFPARAM();
entity wp;
if(self.aistatus & AI_STATUS_WAYPOINT_PERSONAL_GOING)
}
void havocbot_setupbot()
-{
+{SELFPARAM();
self.bot_ai = havocbot_ai;
self.cmd_moveto = havocbot_moveto;
self.cmd_resetgoal = havocbot_resetgoal;
}
vector havocbot_dodge()
-{
+{SELFPARAM();
// LordHavoc: disabled because this is too expensive
return '0 0 0';
#if 0
void havocbot_goalrating_kh(float ratingscale_team, float ratingscale_dropped, float ratingscale_enemy)
-{
+{SELFPARAM();
entity head;
for (head = kh_worldkeylist; head; head = head.kh_worldkeynext)
{
}
void havocbot_role_kh_carrier()
-{
+{SELFPARAM();
if(self.deadflag != DEAD_NO)
return;
}
void havocbot_role_kh_defense()
-{
+{SELFPARAM();
if(self.deadflag != DEAD_NO)
return;
}
void havocbot_role_kh_offense()
-{
+{SELFPARAM();
if(self.deadflag != DEAD_NO)
return;
}
void havocbot_role_kh_freelancer()
-{
+{SELFPARAM();
if(self.deadflag != DEAD_NO)
return;
}
void havocbot_chooserole_kh()
-{
+{SELFPARAM();
float r;
if(self.deadflag != DEAD_NO)
.void() havocbot_role;
void havocbot_goalrating_items(float ratingscale, vector org, float sradius)
-{
+{SELFPARAM();
entity head;
entity player;
float rating, d, discard, distance, friend_distance, enemy_distance;
}
void havocbot_goalrating_controlpoints(float ratingscale, vector org, float sradius)
-{
+{SELFPARAM();
entity head;
head = findchain(classname, "dom_controlpoint");
while (head)
}
void havocbot_goalrating_enemyplayers(float ratingscale, vector org, float sradius)
-{
+{SELFPARAM();
entity head;
int t;
float distance;
// legacy bot role for standard gamemodes
// go to best items
void havocbot_role_generic()
-{
+{SELFPARAM();
if(self.deadflag != DEAD_NO)
return;
}
void havocbot_chooserole_generic()
-{
+{SELFPARAM();
self.havocbot_role = havocbot_role_generic;
}
void havocbot_chooserole()
-{
+{SELFPARAM();
LOG_TRACE("choosing a role...\n");
self.bot_strategytime = 0;
if (MUTATOR_CALLHOOK(HavocBot_ChooseRole, self))
// can be traveled, used for waypoint linking and havocbot
float tracewalk(entity e, vector start, vector m1, vector m2, vector end, float movemode)
-{
+{SELFPARAM();
vector org;
vector move;
vector dir;
// completely empty the goal stack, used when deciding where to go
void navigation_clearroute()
-{
+{SELFPARAM();
//print("bot ", etos(self), " clear\n");
self.navigation_hasgoals = false;
self.goalcurrent = world;
// That means, if the stack overflows, the bot will know how to do the FIRST 32
// steps to the goal, and then recalculate the path.
void navigation_pushroute(entity e)
-{
+{SELFPARAM();
//print("bot ", etos(self), " push ", etos(e), "\n");
self.goalstack31 = self.goalstack30;
self.goalstack30 = self.goalstack29;
// (in other words: remove a prerequisite for reaching the later goals)
// (used when a spawnfunc_waypoint is reached)
void navigation_poproute()
-{
+{SELFPARAM();
//print("bot ", etos(self), " pop\n");
self.goalcurrent = self.goalstack01;
self.goalstack01 = self.goalstack02;
// finds the waypoints near the bot initiating a navigation query
float navigation_markroutes_nearestwaypoints(entity waylist, float maxdist)
-{
+{SELFPARAM();
entity head;
vector v, m1, m2, diff;
float c;
// queries the entire spawnfunc_waypoint network for pathes leading away from the bot
void navigation_markroutes(entity fixed_source_waypoint)
-{
+{SELFPARAM();
entity w, wp, waylist;
float searching, cost, cost2;
vector p;
// updates the best goal according to a weighted calculation of travel cost and item value of a new proposed item
void navigation_routerating(entity e, float f, float rangebias)
-{
+{SELFPARAM();
entity nwp;
vector o;
if (!e)
// adds an item to the the goal stack with the path to a given item
float navigation_routetogoal(entity e, vector startposition)
-{
+{SELFPARAM();
self.goalentity = e;
// if there is no goal, just exit
// removes any currently touching waypoints from the goal stack
// (this is how bots detect if they reached a goal)
void navigation_poptouchedgoals()
-{
+{SELFPARAM();
vector org, m1, m2;
org = self.origin;
m1 = org + self.mins;
// begin a goal selection session (queries spawnfunc_waypoint network)
void navigation_goalrating_start()
-{
+{SELFPARAM();
if(self.aistatus & AI_STATUS_STUCK)
return;
// ends a goal selection session (updates goal stack to the best goal)
void navigation_goalrating_end()
-{
+{SELFPARAM();
if(self.aistatus & AI_STATUS_STUCK)
return;
}
void navigation_unstuck()
-{
+{SELFPARAM();
float search_radius = 1000;
if (!autocvar_bot_wander_enable)
}
void debugnode(vector node)
-{
+{SELFPARAM();
if (!IS_PLAYER(self))
return;
// Debug the goal stack visually
void debuggoalstack()
-{
+{SELFPARAM();
entity goal;
vector org, go;
.entity bot_places[MAX_BOT_PLACES];
.string bot_placenames[MAX_BOT_PLACES];
entity bot_getplace(string placename)
-{
+{SELFPARAM();
entity e;
if(substring(placename, 0, 1) == "@")
{
}
float bot_cmd_impulse()
-{
+{SELFPARAM();
self.impulse = bot_cmd.bot_cmd_parm_float;
return CMD_STATUS_FINISHED;
}
float bot_cmd_continue()
-{
+{SELFPARAM();
self.bot_exec_status &= ~BOT_EXEC_STATUS_PAUSED;
return CMD_STATUS_FINISHED;
}
.float bot_cmd_wait_time;
float bot_cmd_wait()
-{
+{SELFPARAM();
if(self.bot_exec_status & BOT_EXEC_STATUS_WAITING)
{
if(time>=self.bot_cmd_wait_time)
}
float bot_cmd_wait_until()
-{
+{SELFPARAM();
if(time < bot_cmd.bot_cmd_parm_float + bot_barriertime)
{
self.bot_exec_status |= BOT_EXEC_STATUS_WAITING;
}
float bot_cmd_barrier()
-{
+{SELFPARAM();
entity cl;
// 0 = no barrier, 1 = waiting, 2 = waiting finished
}
float bot_cmd_turn()
-{
+{SELFPARAM();
self.v_angle_y = self.v_angle.y + bot_cmd.bot_cmd_parm_float;
self.v_angle_y = self.v_angle.y - floor(self.v_angle.y / 360) * 360;
return CMD_STATUS_FINISHED;
}
float bot_cmd_select_weapon()
-{
+{SELFPARAM();
float id;
id = bot_cmd.bot_cmd_parm_float;
const int CMD_CONDITION_false_BLOCK = 8;
float bot_cmd_eval(string expr)
-{
+{SELFPARAM();
// Search for numbers
if(strstrofs("0123456789", substring(expr, 0, 1), 0) >= 0)
{
}
float bot_cmd_if()
-{
+{SELFPARAM();
string expr, val_a, val_b;
float cmpofs;
}
float bot_cmd_else()
-{
+{SELFPARAM();
self.bot_cmd_condition_status &= ~CMD_CONDITION_true_BLOCK;
self.bot_cmd_condition_status |= CMD_CONDITION_false_BLOCK;
return CMD_STATUS_FINISHED;
}
float bot_cmd_fi()
-{
+{SELFPARAM();
self.bot_cmd_condition_status = CMD_CONDITION_NONE;
return CMD_STATUS_FINISHED;
}
float bot_cmd_resetaim()
-{
+{SELFPARAM();
self.v_angle = '0 0 0';
return CMD_STATUS_FINISHED;
}
.vector bot_cmd_aim_end;
float bot_cmd_aim()
-{
+{SELFPARAM();
// Current direction
if(self.bot_cmd_aim_endtime)
{
}
float bot_cmd_aimtarget()
-{
+{SELFPARAM();
if(self.bot_cmd_aim_endtime)
{
return bot_cmd_aim();
const int BOT_CMD_KEY_CHAT = 1024;
float bot_presskeys()
-{
+{SELFPARAM();
self.movement = '0 0 0';
self.BUTTON_JUMP = false;
self.BUTTON_CROUCH = false;
float bot_cmd_keypress_handler(string key, float enabled)
-{
+{SELFPARAM();
switch(key)
{
case "all":
}
float bot_cmd_pause()
-{
+{SELFPARAM();
self.button1 = 0;
self.button8 = 0;
self.BUTTON_USE = 0;
}
float bot_cmd_moveto()
-{
+{SELFPARAM();
return self.cmd_moveto(bot_cmd.bot_cmd_parm_vector);
}
float bot_cmd_movetotarget()
-{
+{SELFPARAM();
entity e;
e = bot_getplace(bot_cmd.bot_cmd_parm_string);
if(!e)
}
float bot_cmd_resetgoal()
-{
+{SELFPARAM();
return self.cmd_resetgoal();
}
float bot_cmd_sound()
-{
+{SELFPARAM();
string f;
f = bot_cmd.bot_cmd_parm_string;
.entity tuba_note;
float bot_cmd_debug_assert_canfire()
-{
+{SELFPARAM();
float f;
f = bot_cmd.bot_cmd_parm_float;
//
void bot_command_executed(float rm)
-{
+{SELFPARAM();
entity cmd;
cmd = bot_cmd;
}
void bot_setcurrentcommand()
-{
+{SELFPARAM();
bot_cmd = world;
if(!self.bot_cmd_current)
// Here we map commands to functions and deal with complex interactions between commands and execution states
// NOTE: Of course you need to include your commands here too :)
float bot_execute_commands_once()
-{
+{SELFPARAM();
float status, ispressingkey;
// Find command
// (precompile a list of all reachable waypoints from this spawnfunc_waypoint)
// (SLOW!)
void waypoint_think()
-{
+{SELFPARAM();
entity e;
vector sv, sm1, sm2, ev, em1, em2, dv;
// spawnfunc_waypoint map entity
void spawnfunc_waypoint()
-{
+{SELFPARAM();
setorigin(self, self.origin);
// schedule a relink after other waypoints have had a chance to spawn
waypoint_clearlinks(self);
}
entity waypoint_spawnpersonal(vector position)
-{
+{SELFPARAM();
entity w;
// drop the waypoint to a proper location:
}
float CheatsAllowed(float i, float argc, float fr) // the cheat gets passed as argument for possible future ACL checking
-{
+{SELFPARAM();
// dead people cannot cheat
if(self.deadflag != DEAD_NO)
return 0;
float num_autoscreenshot;
void info_autoscreenshot_findtarget()
-{
+{SELFPARAM();
entity e;
e = find(world, targetname, self.target);
if(!e)
// we leave Rick Roll alone
}
void spawnfunc_info_autoscreenshot()
-{
+{SELFPARAM();
if(++num_autoscreenshot > autocvar_g_max_info_autoscreenshot)
{
objerror("Too many info_autoscreenshot entitites. FAIL!");
}
float CheatImpulse(float i)
-{
+{SELFPARAM();
BEGIN_CHEAT_FUNCTION();
switch(i)
{
void DragBox_Think();
float drag_lastcnt;
float CheatCommand(float argc)
-{
+{SELFPARAM();
BEGIN_CHEAT_FUNCTION();
string cmd;
cmd = argv(0);
.entity dragentity;
float CheatFrame()
-{
+{SELFPARAM();
BEGIN_CHEAT_FUNCTION();
// Dragging can be used as either a cheat, or a function for some objects. If sv_cheats is active,
.float dragmovetype;
float Drag(float force_allow_pick, float ischeat)
-{
+{SELFPARAM();
BEGIN_CHEAT_FUNCTION();
// returns true when an entity has been picked up
}
void DragBox_Think()
-{
+{SELFPARAM();
if(self.aiment && self.enemy)
{
self.origin_x = (self.aiment.origin.x + self.enemy.origin.x) * 0.5;
}
float ClientData_Send(entity to, int sf)
-{
+{SELFPARAM();
if(to != self.owner)
{
error("wtf");
}
void ClientData_Attach()
-{
+{SELFPARAM();
Net_LinkEntity(self.clientdata = spawn(), false, 0, ClientData_Send);
self.clientdata.drawonlytoclient = self;
self.clientdata.owner = self;
}
void ClientData_Detach()
-{
+{SELFPARAM();
remove(self.clientdata);
self.clientdata = world;
}
*/
void FixPlayermodel();
void PutObserverInServer (void)
-{
+{SELFPARAM();
entity spot;
self.hud = HUD_NORMAL;
.float model_randomizer;
void FixPlayermodel()
-{
+{SELFPARAM();
string defaultmodel;
float defaultskin, chmdl, oldskin, n, i;
vector m1, m2;
setcolor(self, stof(autocvar_sv_defaultplayercolors));
}
-/*
-=============
-PutClientInServer
-Called when a client spawns in the server
-=============
-*/
-void PutClientInServer (void)
+/** Called when a client spawns in the server */
+void PutClientInServer()
{
+ SELFPARAM();
if(IS_BOT_CLIENT(self))
self.classname = "player";
else if(IS_REAL_CLIENT(self))
self.killcount = 0;
}
- CL_SpawnWeaponentity();
+ CL_SpawnWeaponentity(self);
self.alpha = default_player_alpha;
self.colormod = '1 1 1' * autocvar_g_player_brightness;
self.exteriorweaponentity.alpha = default_weapon_alpha;
// TODO do we need all these fields, or should we stop autodetecting runtime
// changes and just have a console command to update this?
float ClientInit_SendEntity(entity to, int sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_INIT);
WriteByte(MSG_ENTITY, g_nexball_meter_period * 32);
WriteInt24_t(MSG_ENTITY, compressShotOrigin(hook_shotorigin[0]));
}
void ClientInit_CheckUpdate()
-{
+{SELFPARAM();
self.nextthink = time;
if(self.count != autocvar_g_balance_armor_blockpercent)
{
}
void ClientInit_Spawn()
-{
+{SELFPARAM();
entity o;
entity e;
e = spawn();
=============
*/
void SetChangeParms (void)
-{
+{SELFPARAM();
// save parms for level change
parm1 = self.parm_idlesince - time;
}
=============
*/
void DecodeLevelParms (void)
-{
+{SELFPARAM();
// load parms
self.parm_idlesince = parm1;
if(self.parm_idlesince == -(86400 * 366))
.float clientkill_nexttime;
void ClientKill_Now_TeamChange()
-{
+{SELFPARAM();
if(self.killindicator_teamchange == -1)
{
JoinBestTeam( self, false, true );
}
void ClientKill_Now()
-{
+{SELFPARAM();
if(self.vehicle)
{
vehicles_exit(VHEF_RELEASE);
// now I am sure the player IS dead
}
void KillIndicator_Think()
-{
+{SELFPARAM();
if (gameover)
{
self.owner.killindicator = world;
float clientkilltime;
void ClientKill_TeamChange (float targetteam) // 0 = don't change, -1 = auto, -2 = spec
-{
+{SELFPARAM();
float killtime;
float starttime;
entity e;
}
void ClientKill (void)
-{
+{SELFPARAM();
if(gameover) return;
if(self.player_blocked) return;
if(self.frozen) return;
=============
*/
void ClientPreConnect (void)
-{
+{SELFPARAM();
if(autocvar_sv_eventlog)
{
GameLogEcho(sprintf(":connect:%d:%d:%s",
*/
void DecodeLevelParms (void);
void ClientConnect (void)
-{
+{SELFPARAM();
float t;
if(IS_CLIENT(self))
CheatInitClient();
- CSQCMODEL_AUTOINIT();
+ CSQCMODEL_AUTOINIT(self);
self.model_randomizer = random();
.entity chatbubbleentity;
void ReadyCount();
void ClientDisconnect (void)
-{
+{SELFPARAM();
if(self.vehicle)
vehicles_exit(VHEF_RELEASE);
.float BUTTON_CHAT;
void ChatBubbleThink()
-{
+{SELFPARAM();
self.nextthink = time;
if ((self.owner.alpha < 0) || self.owner.chatbubbleentity != self)
{
}
void UpdateChatBubble()
-{
+{SELFPARAM();
if (self.alpha < 0)
return;
// spawn a chatbubble entity if needed
}*/
void respawn(void)
-{
+{SELFPARAM();
if(self.alpha >= 0 && autocvar_g_respawn_ghosts)
{
self.solid = SOLID_NOT;
}
void play_countdown(float finished, string samp)
-{
+{SELFPARAM();
if(IS_REAL_CLIENT(self))
if(floor(finished - time - frametime) != floor(finished - time))
if(finished - time < 6)
}
void player_powerups (void)
-{
+{SELFPARAM();
// add a way to see what the items were BEFORE all of these checks for the mutator hook
int items_prev = self.items;
}
void player_regen (void)
-{
+{SELFPARAM();
float max_mod, regen_mod, rot_mod, limit_mod;
max_mod = regen_mod = rot_mod = limit_mod = 1;
regen_mod_max = max_mod;
float zoomstate_set;
void SetZoomState(float z)
-{
+{SELFPARAM();
if(z != self.zoomstate)
{
self.zoomstate = z;
zoomstate_set = 1;
}
-void GetPressedKeys(void) {
+void GetPressedKeys()
+{SELFPARAM();
MUTATOR_CALLHOOK(GetPressedKeys);
#define X(var,bit,flag) (flag ? var |= bit : var &= ~bit)
X(self.pressedkeys, KEY_FORWARD, self.movement_x > 0);
======================
*/
-void SpectateCopy(entity spectatee) {
+void SpectateCopy(entity spectatee)
+{SELFPARAM();
MUTATOR_CALLHOOK(SpectateCopy, spectatee, self);
self.armortype = spectatee.armortype;
self.armorvalue = spectatee.armorvalue;
}
bool SpectateUpdate()
-{
+{SELFPARAM();
if(!self.enemy)
return false;
}
bool SpectateSet()
-{
+{SELFPARAM();
if(!IS_PLAYER(self.enemy))
return false;
}
bool Spectate(entity pl)
-{
+{SELFPARAM();
if(g_ca && !autocvar_g_ca_spectate_enemies && self.caplayer)
if(DIFF_TEAM(pl, self))
return false;
// Returns next available player to spectate if g_ca_spectate_enemies == 0
entity CA_SpectateNext(entity start)
-{
+{SELFPARAM();
if(SAME_TEAM(start, self))
return start;
}
bool SpectateNext()
-{
+{SELFPARAM();
other = find(self.enemy, classname, "player");
if (g_ca && !autocvar_g_ca_spectate_enemies && self.caplayer)
}
bool SpectatePrev()
-{
+{SELFPARAM();
// NOTE: chain order is from the highest to the lower entnum (unlike find)
other = findchain(classname, "player");
if (!other) // no player
=============
*/
void ShowRespawnCountdown()
-{
+{SELFPARAM();
float number;
if(self.deadflag == DEAD_NO) // just respawned?
return;
}
void LeaveSpectatorMode()
-{
+{SELFPARAM();
if(self.caplayer)
return;
if(nJoinAllowed(self))
* it checks whether the number of currently playing players exceeds g_maxplayers.
* @return int number of free slots for players, 0 if none
*/
-float nJoinAllowed(entity ignore) {
+float nJoinAllowed(entity ignore)
+{SELFPARAM();
if(!ignore)
// this is called that way when checking if anyone may be able to join (to build qcstatus)
// so report 0 free slots if restricted
* Checks whether the client is an observer or spectator, if so, he will get kicked after
* g_maxplayers_spectator_blocktime seconds
*/
-void checkSpectatorBlock() {
+void checkSpectatorBlock()
+{SELFPARAM();
if(IS_SPEC(self) || IS_OBSERVER(self))
if(!self.caplayer)
if(IS_REAL_CLIENT(self))
}
void PrintWelcomeMessage()
-{
+{SELFPARAM();
if(self.motd_actived_time == 0)
{
if (autocvar_g_campaign) {
}
void ObserverThink()
-{
+{SELFPARAM();
if ( self.impulse )
{
MinigameImpulse(self.impulse);
}
void SpectatorThink()
-{
+{SELFPARAM();
if ( self.impulse )
{
if(MinigameImpulse(self.impulse))
void vehicles_enter (entity pl, entity veh);
void PlayerUseKey()
-{
+{SELFPARAM();
if (!IS_PLAYER(self))
return;
.float last_vehiclecheck;
.int items_added;
void PlayerPreThink (void)
-{
+{SELFPARAM();
WarpZone_PlayerPhysics_FixVAngle();
self.stat_game_starttime = game_starttime;
*/
.float idlekick_lasttimeleft;
void PlayerPostThink (void)
-{
+{SELFPARAM();
if(sv_maxidle > 0 && frametime) // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero).
if(IS_PLAYER(self) || sv_maxidle_spectatorsareidle)
{
playerdemo_write();
- CSQCMODEL_AUTOUPDATE();
+ CSQCMODEL_AUTOUPDATE(self);
}
*/
void ImpulseCommands (void)
-{
+{SELFPARAM();
int imp;
vector org;
float i;
#include "../common/animdecide.qh"
void CopyBody_Think(void)
-{
+{SELFPARAM();
if(self.CopyBody_nextthink && time > self.CopyBody_nextthink)
{
self.CopyBody_think();
self.CopyBody_think = self.think;
self.think = CopyBody_Think;
}
- CSQCMODEL_AUTOUPDATE();
+ CSQCMODEL_AUTOUPDATE(self);
self.nextthink = time;
}
void CopyBody(float keepvelocity)
-{
+{SELFPARAM();
entity oldself;
if (self.effects & EF_NODRAW)
return;
if(self.colormap <= maxclients && self.colormap > 0)
self.colormap = 1024 + oldself.clientcolors;
- CSQCMODEL_AUTOINIT();
+ CSQCMODEL_AUTOINIT(self);
self.CopyBody_nextthink = oldself.nextthink;
self.CopyBody_think = oldself.think;
self.nextthink = time;
}
float player_getspecies()
-{
+{SELFPARAM();
float s;
get_model_parameters(self.model, self.skin);
s = get_model_parameters_species;
}
void player_setupanimsformodel()
-{
+{SELFPARAM();
// load animation info
animdecide_load_if_needed(self);
animdecide_setstate(self, 0, false);
}
void player_anim (void)
-{
+{SELFPARAM();
int deadbits = (self.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
if(self.deadflag) {
if (!deadbits) {
}
void PlayerCorpseDamage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
float take, save;
vector v;
Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, self, attacker);
}
void calculate_player_respawn_time()
-{
+{SELFPARAM();
if(g_ca)
return;
}
void PlayerDamage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
float take, save, dh, da;
int j;
vector v;
}
void ClearPlayerSounds()
-{
+{SELFPARAM();
#define _VOICEMSG(m) if(self.playersound_##m) { strunzone(self.playersound_##m); self.playersound_##m = string_null; }
ALLPLAYERSOUNDS
ALLVOICEMSGS
}
float LoadPlayerSounds(string f, float first)
-{
+{SELFPARAM();
float fh;
string s;
var .string field;
}
void UpdatePlayerSounds()
-{
+{SELFPARAM();
if(self.modelindex == self.modelindex_for_playersound)
if(self.skin == self.skin_for_playersound)
return;
}
void FakeGlobalSound(string sample, float chan, float voicetype)
-{
+{SELFPARAM();
float n;
float tauntrand;
}
void GlobalSound(string sample, float chan, float voicetype)
-{
+{SELFPARAM();
float n;
float tauntrand;
}
void PlayerSound(.string samplefield, float chan, float voicetype)
-{
+{SELFPARAM();
GlobalSound(self.(samplefield), chan, voicetype);
}
void VoiceMessage(string type, string msg)
-{
+{SELFPARAM();
var .string sample;
float voicetype, ownteam;
float flood;
// =========================================================
float SV_ParseClientCommand_floodcheck()
-{
+{SELFPARAM();
if (!timeout_status) // not while paused
{
if(time <= (self.cmd_floodtime + autocvar_sv_clientcommand_antispam_time))
// =======================
void ClientCommand_autoswitch(float request, float argc)
-{
+{SELFPARAM();
switch(request)
{
case CMD_REQUEST_COMMAND:
}
void ClientCommand_clientversion(float request, float argc) // internal command, used only by code
-{
+{SELFPARAM();
switch(request)
{
case CMD_REQUEST_COMMAND:
}
void ClientCommand_mv_getpicture(float request, float argc) // internal command, used only by code
-{
+{SELFPARAM();
switch(request)
{
case CMD_REQUEST_COMMAND:
}
void ClientCommand_join(float request)
-{
+{SELFPARAM();
switch(request)
{
case CMD_REQUEST_COMMAND:
}
void ClientCommand_physics(float request, float argc)
-{
+{SELFPARAM();
switch(request)
{
case CMD_REQUEST_COMMAND:
}
void ClientCommand_ready(float request) // todo: anti-spam for toggling readyness
-{
+{SELFPARAM();
switch(request)
{
case CMD_REQUEST_COMMAND:
}
void ClientCommand_say(float request, float argc, string command)
-{
+{SELFPARAM();
switch(request)
{
case CMD_REQUEST_COMMAND:
}
void ClientCommand_say_team(float request, float argc, string command)
-{
+{SELFPARAM();
switch(request)
{
case CMD_REQUEST_COMMAND:
}
void ClientCommand_selectteam(float request, float argc)
-{
+{SELFPARAM();
switch(request)
{
case CMD_REQUEST_COMMAND:
}
void ClientCommand_selfstuff(float request, string command)
-{
+{SELFPARAM();
switch(request)
{
case CMD_REQUEST_COMMAND:
}
void ClientCommand_sentcvar(float request, float argc, string command)
-{
+{SELFPARAM();
switch(request)
{
case CMD_REQUEST_COMMAND:
}
void ClientCommand_spectate(float request)
-{
+{SELFPARAM();
switch(request)
{
case CMD_REQUEST_COMMAND:
}
void ClientCommand_suggestmap(float request, float argc)
-{
+{SELFPARAM();
switch(request)
{
case CMD_REQUEST_COMMAND:
}
void ClientCommand_tell(float request, float argc, string command)
-{
+{SELFPARAM();
switch(request)
{
case CMD_REQUEST_COMMAND:
}
void ClientCommand_voice(float request, float argc, string command)
-{
+{SELFPARAM();
switch(request)
{
case CMD_REQUEST_COMMAND:
/* nothing */
void ClientCommand_macro_help()
-{
+{SELFPARAM();
#define CLIENT_COMMAND(name,function,description) \
{ sprint(self, " ^2", name, "^7: ", description, "\n"); }
// If this function exists, server game code parses clientcommand before the engine code gets it.
void SV_ParseClientCommand(string command)
-{
+{SELFPARAM();
// If invalid UTF-8, don't even parse it
string command2 = "";
float len = strlen(command);
// used by CommonCommand_timeout() and CommonCommand_timein() to handle game pausing and messaging and such.
void timeout_handler_reset()
-{
+{SELFPARAM();
timeout_caller = world;
timeout_time = 0;
timeout_leadtime = 0;
}
void timeout_handler_think()
-{
+{SELFPARAM();
entity tmp_player;
switch(timeout_status)
}
void CommonCommand_editmob(int request, entity caller, int argc)
-{
+{SELFPARAM();
switch(request)
{
case CMD_REQUEST_COMMAND:
radarmapper = world;
}
void RadarMap_Think()
-{
+{SELFPARAM();
// rough map entity
// cnt: current line
// size: pixel width/height
// used by GameCommand_make_mapinfo()
void make_mapinfo_Think()
-{
+{SELFPARAM();
if(MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0, 0, 0, 1))
{
LOG_INFO("Done rebuiling mapinfos.\n");
}
void GameCommand_allspec(float request, float argc)
-{
+{SELFPARAM();
switch(request)
{
case CMD_REQUEST_COMMAND:
}
void GameCommand_anticheat(float request, float argc)
-{
+{SELFPARAM();
switch(request)
{
case CMD_REQUEST_COMMAND:
}
void GameCommand_moveplayer(float request, float argc)
-{
+{SELFPARAM();
switch(request)
{
case CMD_REQUEST_COMMAND:
}
void GameCommand_playerdemo(float request, float argc)
-{
+{SELFPARAM();
switch(request)
{
case CMD_REQUEST_COMMAND:
}
void GameCommand_shuffleteams(float request)
-{
+{SELFPARAM();
switch(request)
{
case CMD_REQUEST_COMMAND:
// Resets the state of all clients, items, weapons, waypoints, ... of the map.
void reset_map(float dorespawn)
-{
+{SELFPARAM();
entity oldself;
oldself = self;
// Restarts the map after the countdown is over (and cvar sv_ready_restart_after_countdown is set)
void ReadyRestart_think()
-{
+{SELFPARAM();
restart_mapalreadyrestarted = 1;
reset_map(true);
Score_ClearAll();
#include "controlpoint.qh"
bool cpicon_send(entity to, int sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_CONTROLPOINT_ICON);
WriteByte(MSG_ENTITY, sf);
if(sf & CPSF_SETUP)
}
float entcs_customize()
-{
+{SELFPARAM();
entity o;
o = self.owner;
if(o.deadflag != DEAD_NO)
}
float entcs_send(entity to, int sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_ENTCS);
WriteByte(MSG_ENTITY, sf);
if(sf & 1)
}
void entcs_think()
-{
+{SELFPARAM();
self.nextthink = time + 0.033333333333; // increase this to like 0.15 once the client can do smoothing
entity o;
}
entity attach_entcs()
-{
+{SELFPARAM();
entity ent;
ent = spawn();
}
void detach_entcs()
-{
+{SELFPARAM();
remove(self.entcs);
self.entcs = world;
}
#include "../warpzonelib/common.qh"
float Damage_DamageInfo_SendEntity(entity to, int sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_DAMAGEINFO);
WriteShort(MSG_ENTITY, self.projectiledeathtype);
WriteCoord(MSG_ENTITY, floor(self.origin.x));
}
void GiveFrags (entity attacker, entity targ, float f, int deathtype)
-{
+{SELFPARAM();
// TODO route through PlayerScores instead
if(gameover) return;
}
void Ice_Think()
-{
+{SELFPARAM();
if(!self.owner.frozen || self.owner.iceblock != self)
{
remove(self);
}
void Freeze (entity targ, float freeze_time, float frozen_type, float show_waypoint)
-{
+{SELFPARAM();
if(!IS_PLAYER(targ) && !IS_MONSTER(targ)) // only specified entities can be freezed
return;
}
void Damage (entity targ, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
float mirrordamage;
float mirrorforce;
float complainteamdamage = 0;
}
void fireburner_think()
-{
+{SELFPARAM();
// for players, this is done in the regular loop
if(wasfreed(self.owner))
{
}
void GrapplingHookReset(void)
-{
+{SELFPARAM();
if(self.realowner.hook == self)
RemoveGrapplingHook(self.owner);
else // in any case:
void GrapplingHookThink();
void GrapplingHook_Stop()
-{
+{SELFPARAM();
Send_Effect(EFFECT_HOOK_IMPACT, self.origin, '0 0 0', 1);
sound (self, CH_SHOTS, W_Sound("hook_impact"), VOL_BASE, ATTEN_NORM);
.vector hook_start, hook_end;
float GrapplingHookSend(entity to, int sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_HOOK);
sf = sf & 0x7F;
if(sound_allowed(MSG_BROADCAST, self.realowner))
}
void GrapplingHookThink()
-{
+{SELFPARAM();
float spd, dist, minlength, pullspeed, ropestretch, ropeairfriction, rubberforce, newlength, rubberforce_overstretch;
vector dir, org, end, v0, dv, v, myorg, vs;
if(self.realowner.hook != self) // how did that happen?
}
void GrapplingHookTouch (void)
-{
+{SELFPARAM();
if(other.movetype == MOVETYPE_FOLLOW)
return;
PROJECTILE_TOUCH;
}
void GrapplingHook_Damage (entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
if(self.health <= 0)
return;
}
void FireGrapplingHook (void)
-{
+{SELFPARAM();
entity missile;
vector org;
vector vs;
// if((self.hook == world || !self.hook.state) && self.movetype == MOVETYPE_FLY)
void GrapplingHookFrame()
-{
+{SELFPARAM();
if(g_grappling_hook && timeout_status != TIMEOUT_ACTIVE && self.weapon != WEP_HOOK.m_id && !self.vehicle)
{
// offhand hook controls
}
void SetGrappleHookBindings()
-{
+{SELFPARAM();
// this function has been modified for Xonotic
// don't remove these lines! old server or demos coud overwrite the new aliases
stuffcmd(self, "alias +hook +button6\n");
.float modelscale;
void g_model_setcolormaptoactivator (void)
-{
+{SELFPARAM();
if(teamplay)
{
if(activator.team)
}
void g_clientmodel_setcolormaptoactivator (void)
-{
+{SELFPARAM();
g_model_setcolormaptoactivator();
self.SendFlags |= (8 | 1);
}
void g_clientmodel_use(void)
-{
+{SELFPARAM();
if (self.antiwall_flag == 1)
{
self.inactive = 1;
}
void g_model_dropbyspawnflags()
-{
+{SELFPARAM();
if((self.spawnflags & 3) == 1) // ALIGN_ORIGIN
{
traceline(self.origin, self.origin - '0 0 4096', MOVE_NOMONSTERS, self);
}
void g_clientmodel_dropbyspawnflags()
-{
+{SELFPARAM();
vector o0;
o0 = self.origin;
g_model_dropbyspawnflags();
}
float g_clientmodel_genericsendentity (entity to, int sf)
-{
+{SELFPARAM();
sf = sf & 0x0F;
if(self.angles != '0 0 0')
sf |= 0x10;
self.default_solid = sol;
// non-solid model entities:
-void spawnfunc_misc_gamemodel() { self.angles_x = -self.angles.x; G_MODEL_INIT (SOLID_NOT) } // model entity
-void spawnfunc_misc_clientmodel() { self.angles_x = -self.angles.x; G_CLIENTMODEL_INIT(SOLID_NOT) } // model entity
-void spawnfunc_misc_models() { self.angles_x = -self.angles.x; G_MODEL_INIT (SOLID_NOT) } // DEPRECATED old compat entity with confusing name, do not use
+void spawnfunc_misc_gamemodel() { SELFPARAM(); self.angles_x = -self.angles.x; G_MODEL_INIT (SOLID_NOT) } // model entity
+void spawnfunc_misc_clientmodel() { SELFPARAM(); self.angles_x = -self.angles.x; G_CLIENTMODEL_INIT(SOLID_NOT) } // model entity
+void spawnfunc_misc_models() { SELFPARAM(); self.angles_x = -self.angles.x; G_MODEL_INIT (SOLID_NOT) } // DEPRECATED old compat entity with confusing name, do not use
// non-solid brush entities:
-void spawnfunc_func_illusionary() { G_MODEL_INIT (SOLID_NOT) } // Q1 name (WARNING: MISPREDICTED)
-void spawnfunc_func_clientillusionary() { G_CLIENTMODEL_INIT(SOLID_NOT) } // brush entity
-void spawnfunc_func_static() { G_MODEL_INIT (SOLID_NOT) } // DEPRECATED old alias name from some other game
+void spawnfunc_func_illusionary() { SELFPARAM(); G_MODEL_INIT (SOLID_NOT) } // Q1 name (WARNING: MISPREDICTED)
+void spawnfunc_func_clientillusionary() { SELFPARAM(); G_CLIENTMODEL_INIT(SOLID_NOT) } // brush entity
+void spawnfunc_func_static() { SELFPARAM(); G_MODEL_INIT (SOLID_NOT) } // DEPRECATED old alias name from some other game
// solid brush entities
-void spawnfunc_func_wall() { G_MODEL_INIT (SOLID_BSP) } // Q1 name
-void spawnfunc_func_clientwall() { G_CLIENTMODEL_INIT(SOLID_BSP) } // brush entity (WARNING: MISPREDICTED)
+void spawnfunc_func_wall() { SELFPARAM(); G_MODEL_INIT (SOLID_BSP) } // Q1 name
+void spawnfunc_func_clientwall() { SELFPARAM(); G_CLIENTMODEL_INIT(SOLID_BSP) } // brush entity (WARNING: MISPREDICTED)
#include "../warpzonelib/common.qh"
void spawnfunc_info_null (void)
-{
+{SELFPARAM();
remove(self);
// if anything breaks, tell the mapper to fix his map! info_null is meant to remove itself immediately.
}
}
float LOD_customize()
-{
+{SELFPARAM();
float d;
if(autocvar_loddebug)
}
void LOD_uncustomize()
-{
+{SELFPARAM();
self.modelindex = self.lodmodelindex0;
}
void LODmodel_attach()
-{
+{SELFPARAM();
entity e;
if(!self.loddistance1)
}
void ApplyMinMaxScaleAngles(entity e)
-{
+{SELFPARAM();
if(e.angles.x != 0 || e.angles.z != 0 || self.avelocity.x != 0 || self.avelocity.z != 0) // "weird" rotation
{
e.maxs = '1 1 1' * vlen(
}
void SetBrushEntityModel()
-{
+{SELFPARAM();
if(self.model != "")
{
precache_model(self.model);
}
void SetBrushEntityModelNoLOD()
-{
+{SELFPARAM();
if(self.model != "")
{
precache_model(self.model);
*/
void SetMovedir()
-{
+{SELFPARAM();
if (self.movedir != '0 0 0')
self.movedir = normalize(self.movedir);
else
}
void InitTrigger()
-{
+{SELFPARAM();
// trigger angles are used for one-way touches. An angle of 0 is assumed
// to mean no restrictions, so use a yaw of 360 instead.
SetMovedir ();
}
void InitSolidBSPTrigger()
-{
+{SELFPARAM();
// trigger angles are used for one-way touches. An angle of 0 is assumed
// to mean no restrictions, so use a yaw of 360 instead.
SetMovedir ();
}
float InitMovingBrushTrigger()
-{
+{SELFPARAM();
// trigger angles are used for one-way touches. An angle of 0 is assumed
// to mean no restrictions, so use a yaw of 360 instead.
self.solid = SOLID_BSP;
#include "_all.qh"
float Violence_GibSplash_SendEntity(entity to, int sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_GIBSPLASH);
WriteByte(MSG_ENTITY, self.state); // actually type
WriteByte(MSG_ENTITY, bound(1, self.cnt * 16, 255)); // gibbage amount multiplier
// TODO maybe convert this to a TE?
void Violence_GibSplash_At(vector org, vector dir, float type, float amount, entity gibowner, entity attacker)
-{
+{SELFPARAM();
if(g_cts) // no gibs in CTS
return;
.float latency_time;
entity pingplreport;
void PingPLReport_Think()
-{
+{SELFPARAM();
float delta;
entity e;
}
void GotoFirstMap()
-{
+{SELFPARAM();
float n;
if(autocvar__sv_init)
{
entity randomseed;
float RandomSeed_Send(entity to, int sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_RANDOMSEED);
WriteShort(MSG_ENTITY, self.cnt);
return true;
}
void RandomSeed_Think()
-{
+{SELFPARAM();
self.cnt = bound(0, floor(random() * 65536), 65535);
self.nextthink = time + 5;
self.SendFlags |= 1;
}
void RandomSeed_Spawn()
-{
+{SELFPARAM();
randomseed = spawn();
randomseed.think = RandomSeed_Think;
Net_LinkEntity(randomseed, false, 0, RandomSeed_Send);
}
void spawnfunc___init_dedicated_server(void)
-{
+{SELFPARAM();
// handler for _init/_init map (only for dedicated server initialization)
world_initialized = -1; // don't complain
void WeaponStats_Shutdown();
void Physics_AddStats();
void spawnfunc_worldspawn (void)
-{
+{SELFPARAM();
float fd, l, j, n;
string s;
}
void spawnfunc_light (void)
-{
+{SELFPARAM();
//makestatic (self); // Who the f___ did that?
remove(self);
}
*/
.float autoscreenshot;
void IntermissionThink()
-{
+{SELFPARAM();
FixIntermissionClient(self);
float server_screenshot = (autocvar_sv_autoscreenshot && self.cvar_cl_autoscreenshot);
============
*/
void CheckRules_Player()
-{
+{SELFPARAM();
if (gameover) // someone else quit the game already
return;
// they win. Otherwise the defending team wins once the timelimit passes.
void assault_new_round();
float WinningCondition_Assault()
-{
+{SELFPARAM();
float status;
WinningConditionHelper(); // set worldstatus
void EndFrame()
-{
+{SELFPARAM();
anticheat_endframe();
float altime;
float redirection_timeout;
float redirection_nextthink;
float RedirectionThink()
-{
+{SELFPARAM();
float clients_found;
if(redirection_target == "")
#include "generator.qh"
bool generator_send(entity to, int sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_GENERATOR);
WriteByte(MSG_ENTITY, sf);
if(sf & GSF_SETUP)
}
void generator_link(void() spawnproc)
-{
+{SELFPARAM();
Net_LinkEntity(self, true, 0, generator_send);
self.think = spawnproc;
self.nextthink = time;
}
void OnlineBanList_Think()
-{
+{SELFPARAM();
float argc;
string uri;
float i, n;
/**
* Key touch handler.
*/
-void item_key_touch(void) {
+void item_key_touch()
+{SELFPARAM();
if (!IS_PLAYER(other))
return;
/**
* Spawn a key with given model, key code and color.
*/
-void spawn_item_key() {
+void spawn_item_key()
+{SELFPARAM();
precache_model(self.model);
if (self.spawnflags & 1) // FLOATING
itemkeys MUST always have exactly one bit set.
*/
-void spawnfunc_item_key() {
+void spawnfunc_item_key()
+{SELFPARAM();
string _netname;
vector _colormod;
---------NOTES----------
Don't use this entity on new maps! Use item_key instead.
*/
-void spawnfunc_item_key1(void) {
+void spawnfunc_item_key1(void)
+{SELFPARAM();
self.classname = "item_key";
self.itemkeys = ITEM_KEY_BIT(1);
spawnfunc_item_key();
---------NOTES----------
Don't use this entity on new maps! Use item_key instead.
*/
-void spawnfunc_item_key2(void) {
+void spawnfunc_item_key2(void)
+{SELFPARAM();
self.classname = "item_key";
self.itemkeys = ITEM_KEY_BIT(0);
spawnfunc_item_key();
}
string MapVote_Suggest(string m)
-{
+{SELFPARAM();
float i;
if(m == "")
return "That's not how to use this command.";
}
void MapVote_SendPicture(float id)
-{
+{SELFPARAM();
msg_entity = self;
WriteByte(MSG_ONE, SVC_TEMPENTITY);
WriteByte(MSG_ONE, TE_CSQC_PICTURE);
}
string formatmessage(string msg)
-{
+{SELFPARAM();
float p, p1, p2;
float n;
vector cursor;
>0: receives a cvar from name=argv(f) value=argv(f+1)
*/
void GetCvars_handleString(string thisname, float f, .string field, string name)
-{
+{SELFPARAM();
if (f < 0)
{
if (self.(field))
stuffcmd(self, strcat("cl_cmd sendcvar ", name, "\n"));
}
void GetCvars_handleString_Fixup(string thisname, float f, .string field, string name, string(string) func)
-{
+{SELFPARAM();
GetCvars_handleString(thisname, f, field, name);
if (f >= 0) // also initialize to the fitting value for "" when sending cvars out
if (thisname == name)
}
}
void GetCvars_handleFloat(string thisname, float f, .float field, string name)
-{
+{SELFPARAM();
if (f < 0)
{
}
stuffcmd(self, strcat("cl_cmd sendcvar ", name, "\n"));
}
void GetCvars_handleFloatOnce(string thisname, float f, .float field, string name)
-{
+{SELFPARAM();
if (f < 0)
{
}
}
}
string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(string wo)
-{
+{SELFPARAM();
string o;
o = W_FixWeaponOrder_ForceComplete(wo);
if(self.weaponorder_byimpulse)
return o;
}
void GetCvars(float f)
-{
+{SELFPARAM();
string s = string_null;
if (f > 0)
}
void precache()
-{
+{SELFPARAM();
// gamemode related things
precache_model ("models/misc/chatbubble.spr");
precache_model("models/ice/ice.md3");
}
void objerror(string s)
-{
+{SELFPARAM();
make_safe_for_remove(self);
builtin_objerror(s);
}
}
}
void InitializeEntitiesRun()
-{
+{SELFPARAM();
entity startoflist;
startoflist = initialize_entity_first;
initialize_entity_first = world;
}
void UncustomizeEntitiesRun()
-{
+{SELFPARAM();
entity oldself;
oldself = self;
for (self = world; (self = findfloat(self, uncustomizeentityforclient_set, 1)); )
}
void Net_LinkEntity(entity e, bool docull, float dt, bool(entity, int) sendfunc)
-{
+{SELFPARAM();
vector mi, ma;
if (e.classname == "")
void adaptor_think2touch()
-{
+{SELFPARAM();
entity o;
o = other;
other = world;
}
void adaptor_think2use()
-{
+{SELFPARAM();
entity o, a;
o = other;
a = activator;
}
void adaptor_think2use_hittype_splash() // for timed projectile detonation
-{
+{SELFPARAM();
if(!(self.flags & FL_ONGROUND)) // if onground, we ARE touching something, but HITTYPE_SPLASH is to be networked if the damage causing projectile is not touching ANYTHING
self.projectiledeathtype |= HITTYPE_SPLASH;
adaptor_think2use();
// deferred dropping
void DropToFloor_Handler()
-{
+{SELFPARAM();
builtin_droptofloor();
self.dropped_origin = self.origin;
}
void droptofloor()
-{
+{SELFPARAM();
InitializeEntity(self, DropToFloor_Handler, INITPRIO_DROPTOFLOOR);
}
}
float SUB_NoImpactCheck()
-{
+{SELFPARAM();
// zero hitcontents = this is not the real impact, but either the
// mirror-impact of something hitting the projectile instead of the
// projectile hitting the something, or a touchareagrid one. Neither of
void W_Crylink_Dequeue(entity e);
float WarpZone_Projectile_Touch_ImpactFilter_Callback()
-{
+{SELFPARAM();
if(SUB_OwnerCheck())
return true;
if(SUB_NoImpactCheck())
}
vector shotorg_adjust(vector vecs, float y_is_right, float visual)
-{
+{SELFPARAM();
return shotorg_adjust_values(vecs, y_is_right, visual, self.owner.cvar_cl_gunalign);
}
.float scale2;
float modeleffect_SendEntity(entity to, int sf)
-{
+{SELFPARAM();
float f;
WriteByte(MSG_ENTITY, ENT_CLIENT_MODELEFFECT);
self.velocity = movelib_dragvec(self.velocity,0.02,0.5);
**/
vector movelib_dragvec(float drag, float exp_)
-{
+{SELFPARAM();
float lspeed,ldrag;
lspeed = vlen(self.velocity);
self.velocity = movelib_inertmove_byspeed(self.velocity,newvel,1000,0.1,0.9);
**/
vector movelib_inertmove_byspeed(vector vel_new, float vel_max,float newmin,float oldmax)
-{
+{SELFPARAM();
float influense;
influense = vlen(self.velocity) * (1 / vel_max);
}
vector movelib_inertmove(vector new_vel,float new_bias)
-{
+{SELFPARAM();
return new_vel * new_bias + self.velocity * (1-new_bias);
}
void movelib_move(vector force,float max_velocity,float drag,float theMass,float breakforce)
-{
+{SELFPARAM();
float deltatime;
float acceleration;
float mspeed;
*/
void movelib_beak_simple(float force)
-{
+{SELFPARAM();
float mspeed;
vector mdir;
float vz;
#endif
void movelib_groundalign4point(float spring_length, float spring_up, float blendrate, float _max)
-{
+{SELFPARAM();
vector a, b, c, d, e, r, push_angle, ahead, side;
push_angle.y = 0;
/** */
#define EV_PutClientInServer(i, o) \
- /** client wanting to spawn */ i(entity, self) \
+ /** client wanting to spawn */ i(entity, __self) \
/**/
MUTATOR_HOOKABLE(PutClientInServer, EV_PutClientInServer);
/** copies variables for spectating "other" to "self" */
#define EV_SpectateCopy(i, o) \
/**/ i(entity, other) \
- /**/ i(entity, self) \
+ /**/ i(entity, __self) \
/**/
MUTATOR_HOOKABLE(SpectateCopy, EV_SpectateCopy);
/** called every frame. customizes the waypoint for spectators */
#define EV_CustomizeWaypoint(i, o) \
- /** waypoint */ i(entity, self) \
+ /** waypoint */ i(entity, __self) \
/** player; other.enemy = spectator */ i(entity, other) \
/**/
MUTATOR_HOOKABLE(CustomizeWaypoint, EV_CustomizeWaypoint);
/** return error to request removal */
#define EV_TurretSpawn(i, o) \
- /** turret */ i(entity, self) \
+ /** turret */ i(entity, __self) \
/**/
MUTATOR_HOOKABLE(TurretSpawn, EV_TurretSpawn);
/** return error to not attack */
#define EV_TurretFire(i, o) \
- /** turret */ i(entity, self) \
+ /** turret */ i(entity, __self) \
/**/
MUTATOR_HOOKABLE(TurretFire, EV_TurretFire);
/** can edit any "just fired" projectile */
#define EV_EditProjectile(i, o) \
- /**/ i(entity, self) \
+ /**/ i(entity, __self) \
/**/ i(entity, other) \
/**/
MUTATOR_HOOKABLE(EditProjectile, EV_EditProjectile);
/** called at the end of player_powerups() in cl_client.qc, used for manipulating the values which are set by powerup items. */
#define EV_PlayerPowerups(i, o) \
- /**/ i(entity, self) \
+ /**/ i(entity, __self) \
/**/ i(int, olditems) \
/**/
int olditems;
* return 1 to make the spawnpoint unusable
*/
#define EV_Spawn_Score(i, o) \
- /** player wanting to spawn */ i(entity, self) \
+ /** player wanting to spawn */ i(entity, __self) \
/** spot to be evaluated */ i(entity, spawn_spot) \
/** _x is priority, _y is "distance" */ i(vector, spawn_score) \
/**/ o(vector, spawn_score) \
* return 1 to remove an item
*/
#define EV_Item_Spawn(i, o) \
- /** the item */ i(entity, self) \
+ /** the item */ i(entity, __self) \
/**/
MUTATOR_HOOKABLE(Item_Spawn, EV_Item_Spawn);
#define EV_SetWeaponreplace(i, o) \
- /** map entity */ i(entity, self) \
+ /** map entity */ i(entity, __self) \
/** weapon info */ i(entity, other) \
/**/ i(string, ret_string) \
/**/ o(string, ret_string) \
* allows you to strip a player of an item if they go through the teleporter to help prevent cheating
*/
#define EV_PortalTeleport(i, o) \
- /**/ i(entity, self) \
+ /**/ i(entity, __self) \
/**/
MUTATOR_HOOKABLE(PortalTeleport, EV_PortalTeleport);
* in a special manner using this hook
*/
#define EV_HelpMePing(i, o) \
- /** the player who pressed impulse 33 */ i(entity, self) \
+ /** the player who pressed impulse 33 */ i(entity, __self) \
/**/
MUTATOR_HOOKABLE(HelpMePing, EV_HelpMePing);
* return true to stop player from entering the vehicle
*/
#define EV_VehicleTouch(i, o) \
- /** vehicle */ i(entity, self) \
+ /** vehicle */ i(entity, __self) \
/** player */ i(entity, other) \
/**/
MUTATOR_HOOKABLE(VehicleTouch, EV_VehicleTouch);
/** called when a speedrun is aborted and the player is teleported back to start position */
#define EV_AbortSpeedrun(i, o) \
- /** player */ i(entity, self) \
+ /** player */ i(entity, __self) \
/**/
MUTATOR_HOOKABLE(AbortSpeedrun, EV_AbortSpeedrun);
/** called at when a item is touched. Called early, can edit item properties. */
#define EV_ItemTouch(i, o) \
- /** item */ i(entity, self) \
+ /** item */ i(entity, __self) \
/** player */ i(entity, other) \
/**/
MUTATOR_HOOKABLE(ItemTouch, EV_ItemTouch);
/** called at when a player connect */
#define EV_ClientConnect(i, o) \
- /** player */ i(entity, self) \
+ /** player */ i(entity, __self) \
/**/
MUTATOR_HOOKABLE(ClientConnect, EV_ClientConnect);
#define EV_HavocBot_ChooseRole(i, o) \
- /**/ i(entity, self) \
+ /**/ i(entity, __self) \
/**/
MUTATOR_HOOKABLE(HavocBot_ChooseRole, EV_HavocBot_ChooseRole);
/** called when a bullet has hit a target */
#define EV_FireBullet_Hit(i, o) \
- /**/ i(entity, self) \
+ /**/ i(entity, __self) \
/**/ i(entity, bullet_hit) \
/**/ i(vector, bullet_startpos) \
/**/ i(vector, bullet_endpos) \
MUTATOR_HOOKABLE(Scores_CountFragsRemaining, EV_NO_ARGS);
#define EV_GrappleHookThink(i, o) \
- /**/ i(entity, self) \
+ /**/ i(entity, __self) \
/**/ i(int, hook_tarzan) \
/**/ o(int, hook_tarzan) \
/**/ i(entity, hook_pullentity) \
MUTATOR_HOOKABLE(GrappleHookThink, EV_GrappleHookThink);
#define EV_BuffModel_Customize(i, o) \
- /**/ i(entity, self) \
+ /**/ i(entity, __self) \
/**/ i(entity, buff_player) \
/**/
entity buff_player;
/** called at when a buff is touched. Called early, can edit buff properties. */
#define EV_BuffTouch(i, o) \
- /** item */ i(entity, self) \
+ /** item */ i(entity, __self) \
/** player */ i(entity, other) \
/**/
MUTATOR_HOOKABLE(BuffTouch, EV_BuffTouch);
// random functions
void assault_objective_use()
-{
+{SELFPARAM();
// activate objective
self.health = 100;
//print("^2Activated objective ", self.targetname, "=", etos(self), "\n");
}
vector target_objective_spawn_evalfunc(entity player, entity spot, vector current)
-{
+{SELFPARAM();
if(self.health < 0 || self.health >= ASSAULT_VALUE_INACTIVE)
return '-1 0 0';
return current;
// reset this objective. Used when spawning an objective
// and when a new round starts
void assault_objective_reset()
-{
+{SELFPARAM();
self.health = ASSAULT_VALUE_INACTIVE;
}
// decrease the health of targeted objectives
void assault_objective_decrease_use()
-{
+{SELFPARAM();
if(activator.team != assault_attacker_team)
{
// wrong team triggered decrease
}
void assault_setenemytoobjective()
-{
+{SELFPARAM();
entity objective;
for(objective = world; (objective = find(objective, targetname, self.target)); )
{
}
float assault_decreaser_sprite_visible(entity e)
-{
+{SELFPARAM();
entity decreaser;
decreaser = self.assault_decreaser;
}
void target_objective_decrease_activate()
-{
+{SELFPARAM();
entity ent, spr;
self.owner = world;
for(ent = world; (ent = find(ent, target, self.targetname)); )
}
void target_assault_roundend_reset()
-{
+{SELFPARAM();
//print("round end reset\n");
self.cnt = self.cnt + 1; // up round counter
self.winning = 0; // up round
}
void target_assault_roundend_use()
-{
+{SELFPARAM();
self.winning = 1; // round has been won by attackers
}
void assault_roundstart_use()
-{
+{SELFPARAM();
activator = self;
SUB_UseTargets();
}
void assault_wall_think()
-{
+{SELFPARAM();
if(self.enemy.health < 0)
{
self.model = "";
void vehicles_clearreturn(entity veh);
void vehicles_spawn();
void assault_new_round()
-{
+{SELFPARAM();
entity oldself;
//bprint("ASSAULT: new round\n");
// spawnfuncs
void spawnfunc_info_player_attacker()
-{
+{SELFPARAM();
if (!g_assault) { remove(self); return; }
self.team = NUM_TEAM_1; // red, gets swapped every round
}
void spawnfunc_info_player_defender()
-{
+{SELFPARAM();
if (!g_assault) { remove(self); return; }
self.team = NUM_TEAM_2; // blue, gets swapped every round
}
void spawnfunc_target_objective()
-{
+{SELFPARAM();
if (!g_assault) { remove(self); return; }
self.classname = "target_objective";
}
void spawnfunc_target_objective_decrease()
-{
+{SELFPARAM();
if (!g_assault) { remove(self); return; }
self.classname = "target_objective_decrease";
// destructible walls that can be used to trigger target_objective_decrease
void spawnfunc_func_assault_destructible()
-{
+{SELFPARAM();
if (!g_assault) { remove(self); return; }
self.spawnflags = 3;
}
void spawnfunc_func_assault_wall()
-{
+{SELFPARAM();
if (!g_assault) { remove(self); return; }
self.classname = "func_assault_wall";
}
void spawnfunc_target_assault_roundend()
-{
+{SELFPARAM();
if (!g_assault) { remove(self); return; }
self.winning = 0; // round not yet won by attackers
}
void spawnfunc_target_assault_roundstart()
-{
+{SELFPARAM();
if (!g_assault) { remove(self); return; }
assault_attacker_team = NUM_TEAM_1;
// legacy bot code
void havocbot_goalrating_ast_targets(float ratingscale)
-{
+{SELFPARAM();
entity ad, best, wp, tod;
float radius, found, bestvalue;
vector p;
}
void havocbot_role_ast_offense()
-{
+{SELFPARAM();
if(self.deadflag != DEAD_NO)
{
self.havocbot_attack_time = 0;
}
void havocbot_role_ast_defense()
-{
+{SELFPARAM();
if(self.deadflag != DEAD_NO)
{
self.havocbot_attack_time = 0;
}
void havocbot_ast_reset_role(entity bot)
-{
+{SELFPARAM();
if(self.deadflag != DEAD_NO)
return;
// mutator hooks
MUTATOR_HOOKFUNCTION(assault_PlayerSpawn)
-{
+{SELFPARAM();
if(self.team == assault_attacker_team)
Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_ASSAULT_ATTACKING);
else
}
MUTATOR_HOOKFUNCTION(assault_TurretSpawn)
-{
+{SELFPARAM();
if(!self.team || self.team == MAX_SHOT_DISTANCE)
self.team = 5; // this gets reversed when match starts?
}
MUTATOR_HOOKFUNCTION(assault_VehicleSpawn)
-{
+{SELFPARAM();
self.nextthink = time + 0.5;
return false;
}
MUTATOR_HOOKFUNCTION(assault_BotRoles)
-{
+{SELFPARAM();
havocbot_ast_reset_role(self);
return true;
}
}
MUTATOR_HOOKFUNCTION(ca_PlayerSpawn)
-{
+{SELFPARAM();
self.caplayer = 1;
if(!warmup_stage)
eliminatedPlayers.SendFlags |= 1;
}
MUTATOR_HOOKFUNCTION(ca_PutClientInServer)
-{
+{SELFPARAM();
if(!allowed_to_spawn)
if(IS_PLAYER(self)) // this is true even when player is trying to join
{
}
MUTATOR_HOOKFUNCTION(ca_reset_map_players)
-{
+{SELFPARAM();
FOR_EACH_CLIENT(self)
{
self.killcount = 0;
}
MUTATOR_HOOKFUNCTION(ca_ClientConnect)
-{
+{SELFPARAM();
self.classname = "observer";
return 1;
}
}
entity ca_LastPlayerForTeam()
-{
+{SELFPARAM();
entity pl, last_pl = world;
FOR_EACH_PLAYER(pl)
{
}
MUTATOR_HOOKFUNCTION(ca_PlayerDies)
-{
+{SELFPARAM();
ca_LastPlayerForTeam_Notify();
if(!allowed_to_spawn)
self.respawn_flags = RESPAWN_SILENT;
}
MUTATOR_HOOKFUNCTION(ca_ClientDisconnect)
-{
+{SELFPARAM();
if(self.caplayer == 1)
ca_LastPlayerForTeam_Notify();
return 1;
}
MUTATOR_HOOKFUNCTION(ca_MakePlayerObserver)
-{
+{SELFPARAM();
if(self.caplayer == 1)
ca_LastPlayerForTeam_Notify();
if(self.killindicator_teamchange == -2)
}
MUTATOR_HOOKFUNCTION(ca_FilterItem)
-{
+{SELFPARAM();
if(autocvar_g_powerups <= 0)
if(self.flags & FL_POWERUP)
return true;
}
bool ctf_CaptureShield_Customize()
-{
+{SELFPARAM();
if(!other.ctf_captureshielded) { return false; }
if(CTF_SAMETEAM(self, other)) { return false; }
}
void ctf_CaptureShield_Touch()
-{
+{SELFPARAM();
if(!other.ctf_captureshielded) { return; }
if(CTF_SAMETEAM(self, other)) { return; }
}
void ctf_CaptureShield_Spawn(entity flag)
-{
+{SELFPARAM();
entity shield = spawn();
shield.enemy = self;
}
bool ctf_Stalemate_Customize()
-{
+{SELFPARAM();
// make spectators see what the player would see
entity e, wp_owner;
e = WaypointSprite_getviewentity(other);
}
void ctf_FlagDamage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
if(ITEM_DAMAGE_NEEDKILL(deathtype))
{
if(autocvar_g_ctf_flag_return_damage_delay)
}
void ctf_FlagThink()
-{
+{SELFPARAM();
// declarations
entity tmp_entity;
}
void ctf_FlagTouch()
-{
+{SELFPARAM();
if(gameover) { return; }
if(trace_dphitcontents & (DPCONTENTS_PLAYERCLIP | DPCONTENTS_MONSTERCLIP)) { return; }
}
void ctf_Reset()
-{
+{SELFPARAM();
if(self.owner)
if(IS_PLAYER(self.owner))
ctf_Handle_Throw(self.owner, world, DROP_RESET);
}
void ctf_DelayedFlagSetup(void) // called after a flag is placed on a map by ctf_FlagSetup()
-{
+{SELFPARAM();
// bot waypoints
waypoint_spawnforitem_force(self, self.origin);
self.nearestwaypointtimeout = 0; // activate waypointing again
}
void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag entity on the map as a spawnfunc
-{
+{SELFPARAM();
// declarations
string teamname = Static_Team_ColorName_Lower(teamnumber);
self = flag; // for later usage with droptofloor()
}
void havocbot_goalrating_ctf_ourflag(float ratingscale)
-{
+{SELFPARAM();
entity head;
head = ctf_worldflaglist;
while (head)
}
void havocbot_goalrating_ctf_ourbase(float ratingscale)
-{
+{SELFPARAM();
entity head;
head = ctf_worldflaglist;
while (head)
}
void havocbot_goalrating_ctf_enemyflag(float ratingscale)
-{
+{SELFPARAM();
entity head;
head = ctf_worldflaglist;
while (head)
}
void havocbot_goalrating_ctf_enemybase(float ratingscale)
-{
+{SELFPARAM();
if (!bot_waypoints_for_items)
{
havocbot_goalrating_ctf_enemyflag(ratingscale);
}
void havocbot_goalrating_ctf_ourstolenflag(float ratingscale)
-{
+{SELFPARAM();
entity mf;
mf = havocbot_ctf_find_flag(self);
}
void havocbot_goalrating_ctf_carrieritems(float ratingscale, vector org, float sradius)
-{
+{SELFPARAM();
entity head;
float t;
head = findchainfloat(bot_pickup, true);
}
void havocbot_role_ctf_carrier()
-{
+{SELFPARAM();
if(self.deadflag != DEAD_NO)
{
havocbot_ctf_reset_role(self);
}
void havocbot_role_ctf_escort()
-{
+{SELFPARAM();
entity mf, ef;
if(self.deadflag != DEAD_NO)
}
void havocbot_role_ctf_offense()
-{
+{SELFPARAM();
entity mf, ef;
vector pos;
// Retriever (temporary role):
void havocbot_role_ctf_retriever()
-{
+{SELFPARAM();
entity mf;
if(self.deadflag != DEAD_NO)
}
void havocbot_role_ctf_middle()
-{
+{SELFPARAM();
entity mf;
if(self.deadflag != DEAD_NO)
}
void havocbot_role_ctf_defense()
-{
+{SELFPARAM();
entity mf;
if(self.deadflag != DEAD_NO)
// ==============
MUTATOR_HOOKFUNCTION(ctf_PlayerPreThink)
-{
+{SELFPARAM();
entity flag;
int t = 0, t2 = 0, t3 = 0;
}
MUTATOR_HOOKFUNCTION(ctf_RemovePlayer)
-{
+{SELFPARAM();
entity flag; // temporary entity for the search method
if(self.flagcarried)
}
MUTATOR_HOOKFUNCTION(ctf_PortalTeleport)
-{
+{SELFPARAM();
if(self.flagcarried)
if(!autocvar_g_ctf_portalteleport)
{ ctf_Handle_Throw(self, world, DROP_NORMAL); }
}
MUTATOR_HOOKFUNCTION(ctf_PlayerUseKey)
-{
+{SELFPARAM();
if(MUTATOR_RETURNVALUE || gameover) { return false; }
entity player = self;
}
MUTATOR_HOOKFUNCTION(ctf_HelpMePing)
-{
+{SELFPARAM();
if(self.wps_flagcarrier) // update the flagcarrier waypointsprite with "NEEDING HELP" notification
{
self.wps_helpme_time = time;
}
MUTATOR_HOOKFUNCTION(ctf_AbortSpeedrun)
-{
+{SELFPARAM();
if(self.flagcarried)
{
Send_Notification(NOTIF_ALL, world, MSG_INFO, ((self.flagcarried.team) ? APP_TEAM_ENT_4(self.flagcarried, INFO_CTF_FLAGRETURN_ABORTRUN_) : INFO_CTF_FLAGRETURN_ABORTRUN_NEUTRAL));
}
MUTATOR_HOOKFUNCTION(ctf_BotRoles)
-{
+{SELFPARAM();
havocbot_ctf_reset_role(self);
return true;
}
}
MUTATOR_HOOKFUNCTION(ctf_SpectateCopy)
-{
+{SELFPARAM();
self.ctf_flagstatus = other.ctf_flagstatus;
return false;
}
"noise4" sound played when flag is dropped by a player...
"noise5" sound played when flag touches the ground... */
void spawnfunc_item_flag_team1()
-{
+{SELFPARAM();
if(!g_ctf) { remove(self); return; }
ctf_FlagSetup(NUM_TEAM_1, self);
"noise4" sound played when flag is dropped by a player...
"noise5" sound played when flag touches the ground... */
void spawnfunc_item_flag_team2()
-{
+{SELFPARAM();
if(!g_ctf) { remove(self); return; }
ctf_FlagSetup(NUM_TEAM_2, self);
"noise4" sound played when flag is dropped by a player...
"noise5" sound played when flag touches the ground... */
void spawnfunc_item_flag_team3()
-{
+{SELFPARAM();
if(!g_ctf) { remove(self); return; }
ctf_FlagSetup(NUM_TEAM_3, self);
"noise4" sound played when flag is dropped by a player...
"noise5" sound played when flag touches the ground... */
void spawnfunc_item_flag_team4()
-{
+{SELFPARAM();
if(!g_ctf) { remove(self); return; }
ctf_FlagSetup(NUM_TEAM_4, self);
"noise4" sound played when flag is dropped by a player...
"noise5" sound played when flag touches the ground... */
void spawnfunc_item_flag_neutral()
-{
+{SELFPARAM();
if(!g_ctf) { remove(self); return; }
if(!cvar("g_ctf_oneflag")) { remove(self); return; }
"netname" Name of the team (for example Red, Blue, Green, Yellow, Life, Death, Offense, Defense, etc)...
"cnt" Scoreboard color of the team (for example 4 is red and 13 is blue)... */
void spawnfunc_ctf_team()
-{
+{SELFPARAM();
if(!g_ctf) { remove(self); return; }
self.classname = "ctf_team";
// code from here on is just to support maps that don't have flag and team entities
void ctf_SpawnTeam (string teamname, int teamcolor)
-{
+{SELFPARAM();
entity oldself;
oldself = self;
self = spawn();
// legacy bot roles
.float race_checkpoint;
void havocbot_role_cts()
-{
+{SELFPARAM();
if(self.deadflag != DEAD_NO)
return;
}
MUTATOR_HOOKFUNCTION(cts_PlayerPhysics)
-{
+{SELFPARAM();
// force kbd movement for fairness
float wishspeed;
vector wishvel;
}
MUTATOR_HOOKFUNCTION(cts_PlayerPreThink)
-{
+{SELFPARAM();
if(IS_SPEC(self) || IS_OBSERVER(self))
if(g_race_qualifying)
if(msg_entity.enemy.race_laptime)
}
MUTATOR_HOOKFUNCTION(cts_ClientConnect)
-{
+{SELFPARAM();
race_PreparePlayer();
self.race_checkpoint = -1;
}
MUTATOR_HOOKFUNCTION(cts_MakePlayerObserver)
-{
+{SELFPARAM();
if(PlayerScore_Add(self, SP_RACE_FASTEST, 0))
self.frags = FRAGS_LMS_LOSER;
else
}
MUTATOR_HOOKFUNCTION(cts_PlayerSpawn)
-{
+{SELFPARAM();
if(spawn_spot.target == "")
// Emergency: this wasn't a real spawnpoint. Can this ever happen?
race_PreparePlayer();
}
MUTATOR_HOOKFUNCTION(cts_PutClientInServer)
-{
+{SELFPARAM();
if(IS_PLAYER(self))
if(!gameover)
{
}
MUTATOR_HOOKFUNCTION(cts_PlayerDies)
-{
+{SELFPARAM();
self.respawn_flags |= RESPAWN_FORCE;
race_AbandonRaceCheck(self);
return false;
}
MUTATOR_HOOKFUNCTION(cts_BotRoles)
-{
+{SELFPARAM();
self.havocbot_role = havocbot_role_cts;
return true;
}
MUTATOR_HOOKFUNCTION(cts_PlayerPostThink)
-{
+{SELFPARAM();
if(self.cvar_cl_allow_uidtracking == 1 && self.cvar_cl_allow_uid2name == 1)
{
if (!self.stored_netname)
}
MUTATOR_HOOKFUNCTION(cts_FilterItem)
-{
+{SELFPARAM();
if(self.classname == "droppedweapon")
return true;
}
void dompoint_captured ()
-{
+{SELFPARAM();
entity head;
float old_delay, old_team, real_team;
}
void AnimateDomPoint()
-{
+{SELFPARAM();
if(self.pain_finished > time)
return;
self.pain_finished = time + self.t_width;
}
void dompointthink()
-{
+{SELFPARAM();
float fragamt;
self.nextthink = time + 0.1;
}
void dompointtouch()
-{
+{SELFPARAM();
entity head;
if (!IS_PLAYER(other))
return;
}
void dom_controlpoint_setup()
-{
+{SELFPARAM();
entity head;
// find the spawnfunc_dom_team representing unclaimed points
head = find(world, classname, "dom_team");
//go to best items, or control points you don't own
void havocbot_role_dom()
-{
+{SELFPARAM();
if(self.deadflag != DEAD_NO)
return;
}
MUTATOR_HOOKFUNCTION(dom_ResetMap)
-{
+{SELFPARAM();
total_pps = 0, pps_red = 0, pps_blue = 0, pps_yellow = 0, pps_pink = 0;
FOR_EACH_PLAYER(self)
{
}
MUTATOR_HOOKFUNCTION(dom_PlayerSpawn)
-{
+{SELFPARAM();
if(domination_roundbased)
if(!round_handler_IsRoundStarted())
self.player_blocked = 1;
}
MUTATOR_HOOKFUNCTION(dom_ClientConnect)
-{
+{SELFPARAM();
set_dom_state(self);
return false;
}
MUTATOR_HOOKFUNCTION(dom_BotRoles)
-{
+{SELFPARAM();
self.havocbot_role = havocbot_role_dom;
return true;
}
Control point for Domination gameplay.
*/
void spawnfunc_dom_controlpoint()
-{
+{SELFPARAM();
if(!g_domination)
{
remove(self);
*/
void spawnfunc_dom_team()
-{
+{SELFPARAM();
if(!g_domination || autocvar_g_domination_teams_override >= 2)
{
remove(self);
// code from here on is just to support maps that don't have control point and team entities
void dom_spawnteam (string teamname, float teamcolor, string pointmodel, float pointskin, string capsound, string capnarration, string capmessage)
-{
+{SELFPARAM();
entity oldself;
oldself = self;
self = spawn();
}
void dom_spawnpoint(vector org)
-{
+{SELFPARAM();
entity oldself;
oldself = self;
self = spawn();
}
entity freezetag_LastPlayerForTeam()
-{
+{SELFPARAM();
entity pl, last_pl = world;
FOR_EACH_PLAYER(pl)
{
}
void freezetag_Add_Score(entity attacker)
-{
+{SELFPARAM();
if(attacker == self)
{
// you froze your own dumb self
}
void freezetag_Freeze(entity attacker)
-{
+{SELFPARAM();
if(self.frozen)
return;
}
void freezetag_Unfreeze(entity attacker)
-{
+{SELFPARAM();
self.freezetag_frozen_time = 0;
self.freezetag_frozen_timeout = 0;
void() havocbot_role_ft_offense;
void havocbot_goalrating_freeplayers(float ratingscale, vector org, float sradius)
-{
+{SELFPARAM();
entity head;
float distance;
}
void havocbot_role_ft_offense()
-{
+{SELFPARAM();
entity head;
float unfrozen;
}
void havocbot_role_ft_freeing()
-{
+{SELFPARAM();
if(self.deadflag != DEAD_NO)
return;
// ==============
MUTATOR_HOOKFUNCTION(freezetag_RemovePlayer)
-{
+{SELFPARAM();
self.health = 0; // neccessary to update correctly alive stats
if(!self.frozen)
freezetag_LastPlayerForTeam_Notify();
}
MUTATOR_HOOKFUNCTION(freezetag_PlayerDies)
-{
+{SELFPARAM();
if(round_handler_IsActive())
if(round_handler_CountdownRunning())
{
}
MUTATOR_HOOKFUNCTION(freezetag_PlayerSpawn)
-{
+{SELFPARAM();
if(self.freezetag_frozen_timeout == -1) // if PlayerSpawn is called by reset_map_players
return 1; // do nothing, round is starting right now
}
MUTATOR_HOOKFUNCTION(freezetag_reset_map_players)
-{
+{SELFPARAM();
FOR_EACH_PLAYER(self)
{
self.killcount = 0;
}
MUTATOR_HOOKFUNCTION(freezetag_PlayerPreThink)
-{
+{SELFPARAM();
float n;
if(gameover)
}
MUTATOR_HOOKFUNCTION(freezetag_BotRoles)
-{
+{SELFPARAM();
if (!self.deadflag)
{
if (random() < 0.5)
#include "../../common/monsters/sv_monsters.qh"
void spawnfunc_invasion_spawnpoint()
-{
+{SELFPARAM();
if(!g_invasion) { remove(self); return; }
self.classname = "invasion_spawnpoint";
}
MUTATOR_HOOKFUNCTION(invasion_MonsterDies)
-{
+{SELFPARAM();
if(!(self.spawnflags & MONSTERFLAG_RESPAWNED))
{
inv_numkilled += 1;
}
MUTATOR_HOOKFUNCTION(invasion_MonsterSpawn)
-{
+{SELFPARAM();
if(!(self.spawnflags & MONSTERFLAG_SPAWNED))
return true;
}
MUTATOR_HOOKFUNCTION(invasion_OnEntityPreSpawn)
-{
+{SELFPARAM();
if(startsWith(self.classname, "monster_"))
if(!(self.spawnflags & MONSTERFLAG_SPAWNED))
return true;
}
MUTATOR_HOOKFUNCTION(invasion_PlayerSpawn)
-{
+{SELFPARAM();
self.bot_attack = false;
return false;
}
}
MUTATOR_HOOKFUNCTION(invasion_PlayerCommand)
-{
+{SELFPARAM();
if(MUTATOR_RETURNVALUE) // command was already handled?
return false;
void ka_TouchEvent();
void ka_RespawnBall() // runs whenever the ball needs to be relocated
-{
+{SELFPARAM();
if(gameover) { return; }
vector oldballorigin = self.origin;
}
void ka_TimeScoring()
-{
+{SELFPARAM();
if(self.owner.ballcarried)
{ // add points for holding the ball after a certain amount of time
if(autocvar_g_keepaway_score_timepoints)
}
void ka_TouchEvent() // runs any time that the ball comes in contact with something
-{
+{SELFPARAM();
if(gameover) { return; }
if(!self) { return; }
if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
}
void ka_Reset() // used to clear the ballcarrier whenever the match switches from warmup to normal
-{
+{SELFPARAM();
if((self.owner) && (IS_PLAYER(self.owner)))
ka_DropEvent(self.owner);
// ================
void havocbot_goalrating_ball(float ratingscale, vector org)
-{
+{SELFPARAM();
float t;
entity ball_owner;
ball_owner = ka_ball.owner;
}
void havocbot_role_ka_carrier()
-{
+{SELFPARAM();
if (self.deadflag != DEAD_NO)
return;
}
void havocbot_role_ka_collector()
-{
+{SELFPARAM();
if (self.deadflag != DEAD_NO)
return;
// ==============
MUTATOR_HOOKFUNCTION(ka_Scoring)
-{
+{SELFPARAM();
if((frag_attacker != frag_target) && (IS_PLAYER(frag_attacker)))
{
if(frag_target.ballcarried) { // add to amount of times killing carrier
}
MUTATOR_HOOKFUNCTION(ka_PlayerPreThink)
-{
+{SELFPARAM();
// clear the item used for the ball in keepaway
self.items &= ~IT_KEY1;
}
MUTATOR_HOOKFUNCTION(ka_PlayerUseKey)
-{
+{SELFPARAM();
if(MUTATOR_RETURNVALUE == 0)
if(self.ballcarried)
{
}
MUTATOR_HOOKFUNCTION(ka_RemovePlayer)
-{
+{SELFPARAM();
if(self.ballcarried) { ka_DropEvent(self); } // a player with the ball has left the match, drop it
return 0;
}
MUTATOR_HOOKFUNCTION(ka_PlayerPowerups)
-{
+{SELFPARAM();
// In the future this hook is supposed to allow me to do some extra stuff with waypointsprites and invisibility powerup
// So bare with me until I can fix a certain bug with ka_ballcarrier_waypointsprite_visible_for_player()
}
MUTATOR_HOOKFUNCTION(ka_PlayerPhysics)
-{
+{SELFPARAM();
if(self.ballcarried)
{
self.stat_sv_airspeedlimit_nonqw *= autocvar_g_keepaway_ballcarrier_highspeed;
}
MUTATOR_HOOKFUNCTION(ka_BotShouldAttack)
-{
+{SELFPARAM();
// if neither player has ball then don't attack unless the ball is on the ground
if(!checkentity.ballcarried && !self.ballcarried && ka_ball.owner)
return true;
}
MUTATOR_HOOKFUNCTION(ka_BotRoles)
-{
+{SELFPARAM();
if (self.ballcarried)
self.havocbot_role = havocbot_role_ka_carrier;
else
}
float kh_KeyCarrier_waypointsprite_visible_for_player(entity e) // runs all the time
-{
+{SELFPARAM();
if(!IS_PLAYER(e) || self.team != e.team)
if(!kh_tracking_enabled)
return false;
}
float kh_Key_waypointsprite_visible_for_player(entity e) // ??
-{
+{SELFPARAM();
if(!kh_tracking_enabled)
return false;
if(!self.owner)
}
void kh_WaitForPlayers();
void kh_Controller_Think() // called a lot
-{
+{SELFPARAM();
if(intermission_running)
return;
if(self.cnt > 0)
}
void kh_Key_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
if(self.owner)
return;
if(ITEM_DAMAGE_NEEDKILL(deathtype))
}
void kh_Key_Touch() // runs many, many times when a key has been dropped and can be picked up
-{
+{SELFPARAM();
if(intermission_running)
return;
}
void kh_Key_Think() // runs all the time
-{
+{SELFPARAM();
entity head;
//entity player; // needed by FOR_EACH_PLAYER
}
void key_reset()
-{
+{SELFPARAM();
kh_Key_AssignTo(self, world);
kh_Key_Remove(self);
}
// register this as a mutator
MUTATOR_HOOKFUNCTION(kh_Key_DropAll)
-{
+{SELFPARAM();
kh_Key_DropAll(self, true);
return 0;
}
MUTATOR_HOOKFUNCTION(kh_PlayerDies)
-{
+{SELFPARAM();
if(self == other)
kh_Key_DropAll(self, true);
else if(IS_PLAYER(other))
}
MUTATOR_HOOKFUNCTION(kh_SpectateCopy)
-{
+{SELFPARAM();
self.kh_state = other.kh_state;
return 0;
}
MUTATOR_HOOKFUNCTION(kh_PlayerUseKey)
-{
+{SELFPARAM();
if(MUTATOR_RETURNVALUE == 0)
{
entity k;
}
MUTATOR_HOOKFUNCTION(lms_ResetPlayers)
-{
+{SELFPARAM();
if(restart_mapalreadyrestarted || (time < game_starttime))
FOR_EACH_CLIENT(self)
if(IS_PLAYER(self))
}
MUTATOR_HOOKFUNCTION(lms_PlayerPreSpawn)
-{
+{SELFPARAM();
// player is dead and becomes observer
// FIXME fix LMS scoring for new system
if(PlayerScore_Add(self, SP_LMS_RANK, 0) > 0)
}
MUTATOR_HOOKFUNCTION(lms_PlayerDies)
-{
+{SELFPARAM();
self.respawn_flags |= RESPAWN_FORCE;
return false;
}
MUTATOR_HOOKFUNCTION(lms_RemovePlayer)
-{
+{SELFPARAM();
// Only if the player cannot play at all
if(PlayerScore_Add(self, SP_LMS_RANK, 0) == 666)
self.frags = FRAGS_SPECTATOR;
}
MUTATOR_HOOKFUNCTION(lms_ClientConnect)
-{
+{SELFPARAM();
self.classname = "player";
campaign_bots_may_start = 1;
}
MUTATOR_HOOKFUNCTION(lms_PlayerThink)
-{
+{SELFPARAM();
if(self.deadflag == DEAD_DYING)
self.deadflag = DEAD_RESPAWNING;
}
MUTATOR_HOOKFUNCTION(lms_FilterItem)
-{
+{SELFPARAM();
if(autocvar_g_lms_extra_lives)
if(self.itemdef == ITEM_HealthMega)
{
}
MUTATOR_HOOKFUNCTION(lms_ItemTouch)
-{
+{SELFPARAM();
// give extra lives for mega health
if (self.items & ITEM_HealthMega.m_itemid)
{
}
void ball_restart(void)
-{
+{SELFPARAM();
if(self.owner)
DropBall(self, self.owner.origin, '0 0 0');
ResetBall();
}
void nexball_setstatus(void)
-{
+{SELFPARAM();
entity oldself;
self.items &= ~IT_KEY1;
if(self.ballcarried)
}
void relocate_nexball(void)
-{
+{SELFPARAM();
tracebox(self.origin, BALL_MINS, BALL_MAXS, self.origin, true, self);
if(trace_startsolid)
{
}
void DropOwner(void)
-{
+{SELFPARAM();
entity ownr;
ownr = self.owner;
DropBall(self, ownr.origin, ownr.velocity);
}
void GiveBall(entity plyr, entity ball)
-{
+{SELFPARAM();
entity ownr;
if((ownr = ball.owner))
}
void InitBall(void)
-{
+{SELFPARAM();
if(gameover) return;
self.flags &= ~FL_ONGROUND;
self.movetype = MOVETYPE_BOUNCE;
}
void ResetBall(void)
-{
+{SELFPARAM();
if(self.cnt < 2) // step 1
{
if(time == self.teamtime)
}
void football_touch(void)
-{
+{SELFPARAM();
if(other.solid == SOLID_BSP)
{
if(time > self.lastground + 0.1)
}
void basketball_touch(void)
-{
+{SELFPARAM();
if(other.ballcarried)
{
football_touch();
}
void GoalTouch(void)
-{
+{SELFPARAM();
entity ball;
float isclient, pscore, otherteam;
string pname;
// team ents //
//=======================//
void spawnfunc_nexball_team(void)
-{
+{SELFPARAM();
if(!g_nexball)
{
remove(self);
//=======================//
void SpawnBall(void)
-{
+{SELFPARAM();
if(!g_nexball) { remove(self); return; }
// balls += 4; // using the remaining bits to count balls will leave more than the max edict count, so it's fine
}
void spawnfunc_nexball_basketball(void)
-{
+{SELFPARAM();
nexball_mode |= NBM_BASKETBALL;
self.classname = "nexball_basketball";
if (!(balls & BALL_BASKET))
}
void spawnfunc_nexball_football(void)
-{
+{SELFPARAM();
nexball_mode |= NBM_FOOTBALL;
self.classname = "nexball_football";
self.solid = SOLID_TRIGGER;
}
float nb_Goal_Customize()
-{
+{SELFPARAM();
entity e, wp_owner;
e = WaypointSprite_getviewentity(other);
wp_owner = self.owner;
}
void SpawnGoal(void)
-{
+{SELFPARAM();
if(!g_nexball) { remove(self); return; }
EXACTTRIGGER_INIT;
}
void spawnfunc_nexball_redgoal(void)
-{
+{SELFPARAM();
self.team = NUM_TEAM_1;
SpawnGoal();
}
void spawnfunc_nexball_bluegoal(void)
-{
+{SELFPARAM();
self.team = NUM_TEAM_2;
SpawnGoal();
}
void spawnfunc_nexball_yellowgoal(void)
-{
+{SELFPARAM();
self.team = NUM_TEAM_3;
SpawnGoal();
}
void spawnfunc_nexball_pinkgoal(void)
-{
+{SELFPARAM();
self.team = NUM_TEAM_4;
SpawnGoal();
}
void spawnfunc_nexball_fault(void)
-{
+{SELFPARAM();
self.team = GOAL_FAULT;
if(self.noise == "")
self.noise = "misc/typehit.wav";
}
void spawnfunc_nexball_out(void)
-{
+{SELFPARAM();
self.team = GOAL_OUT;
if(self.noise == "")
self.noise = "misc/typehit.wav";
void W_Nexball_Think()
-{
+{SELFPARAM();
//dprint("W_Nexball_Think\n");
//vector new_dir = steerlib_arrive(self.enemy.origin, 2500);
vector new_dir = normalize(self.enemy.origin + '0 0 50' - self.origin);
}
void W_Nexball_Touch(void)
-{
+{SELFPARAM();
entity ball, attacker;
attacker = self.owner;
//self.think = func_null;
}
void W_Nexball_Attack(float t)
-{
+{SELFPARAM();
entity ball;
float mul, mi, ma;
if(!(ball = self.ballcarried))
}
void W_Nexball_Attack2(void)
-{
+{SELFPARAM();
if(self.ballcarried.enemy)
{
entity _ball = self.ballcarried;
}
float ball_customize()
-{
+{SELFPARAM();
if(!self.owner)
{
self.effects &= ~EF_FLAME;
}
float w_nexball_weapon(float req)
-{
+{SELFPARAM();
if(req == WR_THINK)
{
if(self.BUTTON_ATCK)
}
MUTATOR_HOOKFUNCTION(nexball_BallDrop)
-{
+{SELFPARAM();
if(self.ballcarried && g_nexball)
DropBall(self.ballcarried, self.origin, self.velocity);
}
MUTATOR_HOOKFUNCTION(nexball_PlayerPreThink)
-{
+{SELFPARAM();
makevectors(self.v_angle);
if(nexball_mode & NBM_BASKETBALL)
{
}
MUTATOR_HOOKFUNCTION(nexball_PlayerSpawn)
-{
+{SELFPARAM();
self.weaponentity.weapons = '0 0 0';
if(nexball_mode & NBM_BASKETBALL)
}
MUTATOR_HOOKFUNCTION(nexball_PlayerPhysics)
-{
+{SELFPARAM();
if(self.ballcarried)
{
self.stat_sv_airspeedlimit_nonqw *= autocvar_g_nexball_basketball_carrier_highspeed;
}
MUTATOR_HOOKFUNCTION(nexball_ForbidThrowing)
-{
+{SELFPARAM();
if(self.weapon == WEP_MORTAR.m_id)
return true;
}
MUTATOR_HOOKFUNCTION(nexball_FilterItem)
-{
+{SELFPARAM();
if(self.classname == "droppedweapon")
if(self.weapon == WEP_MORTAR.m_id)
return true;
// =======================
bool ons_CaptureShield_Customize()
-{
+{SELFPARAM();
entity e = WaypointSprite_getviewentity(other);
if(!self.enemy.isshielded && (ons_ControlPoint_Attackable(self.enemy, e.team) > 0 || self.enemy.classname != "onslaught_controlpoint")) { return false; }
}
void ons_CaptureShield_Touch()
-{
+{SELFPARAM();
if(!self.enemy.isshielded && (ons_ControlPoint_Attackable(self.enemy, other.team) > 0 || self.enemy.classname != "onslaught_controlpoint")) { return; }
if(!IS_PLAYER(other)) { return; }
if(SAME_TEAM(other, self)) { return; }
}
void ons_CaptureShield_Reset()
-{
+{SELFPARAM();
self.colormap = self.enemy.colormap;
self.team = self.enemy.team;
}
// ===================
bool ons_Link_Send(entity to, int sendflags)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_RADARLINK);
WriteByte(MSG_ENTITY, sendflags);
if(sendflags & 1)
}
void ons_Link_CheckUpdate()
-{
+{SELFPARAM();
// TODO check if the two sides have moved (currently they won't move anyway)
float cc = 0, cc1 = 0, cc2 = 0;
}
void ons_DelayedLinkSetup()
-{
+{SELFPARAM();
self.goalentity = find(world, targetname, self.target);
self.enemy = find(world, targetname, self.target2);
if(!self.goalentity) { objerror("can not find target\n"); }
}
void ons_ControlPoint_Icon_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
entity oself;
if(damage <= 0) { return; }
}
void ons_ControlPoint_Icon_Think()
-{
+{SELFPARAM();
entity oself;
self.nextthink = time + ONS_CP_THINKRATE;
}
void ons_ControlPoint_Icon_BuildThink()
-{
+{SELFPARAM();
entity oself;
int a;
}
void ons_ControlPoint_Touch()
-{
+{SELFPARAM();
entity toucher = other;
int attackable;
}
void ons_ControlPoint_Think()
-{
+{SELFPARAM();
self.nextthink = time + ONS_CP_THINKRATE;
- CSQCMODEL_AUTOUPDATE();
+ CSQCMODEL_AUTOUPDATE(self);
}
void ons_ControlPoint_Reset()
-{
+{SELFPARAM();
if(self.goalentity)
remove(self.goalentity);
activator = self;
SUB_UseTargets(); // to reset the structures, playerspawns etc.
- CSQCMODEL_AUTOUPDATE();
+ CSQCMODEL_AUTOUPDATE(self);
}
void ons_DelayedControlPoint_Setup(void)
-{
+{SELFPARAM();
onslaught_updatelinks();
// captureshield setup
ons_CaptureShield_Spawn(self, false);
- CSQCMODEL_AUTOINIT();
+ CSQCMODEL_AUTOINIT(self);
}
void ons_ControlPoint_Setup(entity cp)
-{
+{SELFPARAM();
// declarations
self = cp; // for later usage with droptofloor()
}
void ons_GeneratorDamage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
if(damage <= 0) { return; }
if(warmup_stage || gameover) { return; }
if(!round_handler_IsRoundStarted()) { return; }
}
void ons_GeneratorThink()
-{
+{SELFPARAM();
entity e;
self.nextthink = time + GEN_THINKRATE;
if (!gameover)
}
void ons_GeneratorReset()
-{
+{SELFPARAM();
self.team = self.team_saved;
self.lasthealth = self.max_health = self.health = autocvar_g_onslaught_gen_health;
self.takedamage = DAMAGE_AIM;
}
void ons_DelayedGeneratorSetup()
-{
+{SELFPARAM();
// bot waypoints
waypoint_spawnforitem_force(self, self.origin);
self.nearestwaypointtimeout = 0; // activate waypointing again
void onslaught_generator_touch()
-{
+{SELFPARAM();
if ( IS_PLAYER(other) )
if ( SAME_TEAM(self,other) )
if ( self.iscaptured )
}
void ons_GeneratorSetup(entity gen) // called when spawning a generator entity on the map as a spawnfunc
-{
+{SELFPARAM();
// declarations
int teamnumber = gen.team;
self = gen; // for later usage with droptofloor()
// NOTE: LEGACY CODE, needs to be re-written!
void havocbot_goalrating_ons_offenseitems(float ratingscale, vector org, float sradius)
-{
+{SELFPARAM();
entity head;
float t, c;
int i;
}
int havocbot_ons_teamcount(entity bot, int role)
-{
+{SELFPARAM();
int c = 0;
entity head;
}
void havocbot_goalrating_ons_controlpoints_attack(float ratingscale)
-{
+{SELFPARAM();
entity cp, cp1, cp2, best, pl, wp;
float radius, bestvalue;
int c;
}
bool havocbot_goalrating_ons_generator_attack(float ratingscale)
-{
+{SELFPARAM();
entity g, wp, bestwp;
bool found;
int best;
}
void havocbot_role_ons_offense()
-{
+{SELFPARAM();
if(self.deadflag != DEAD_NO)
{
self.havocbot_attack_time = 0;
}
void havocbot_role_ons_assistant()
-{
+{SELFPARAM();
havocbot_ons_reset_role(self);
}
void havocbot_role_ons_defense()
-{
+{SELFPARAM();
havocbot_ons_reset_role(self);
}
void havocbot_ons_reset_role(entity bot)
-{
+{SELFPARAM();
entity head;
int c = 0;
* if max_dist is positive, only control points within this range will be considered
*/
entity ons_Nearest_ControlPoint(vector pos, float max_dist)
-{
+{SELFPARAM();
entity tmp_entity, closest_target = world;
tmp_entity = findchain(classname, "onslaught_controlpoint");
while(tmp_entity)
* This function only check distances on the XY plane, disregarding Z
*/
entity ons_Nearest_ControlPoint_2D(vector pos, float max_dist)
-{
+{SELFPARAM();
entity tmp_entity, closest_target = world;
vector delta;
float smallest_distance = 0, distance;
* find the number of control points and generators in the same team as self
*/
int ons_Count_SelfControlPoints()
-{
+{SELFPARAM();
entity tmp_entity;
tmp_entity = findchain(classname, "onslaught_controlpoint");
int n = 0;
// ==============
MUTATOR_HOOKFUNCTION(ons_ResetMap)
-{
+{SELFPARAM();
FOR_EACH_PLAYER(self)
{
self.ons_roundlost = false;
}
MUTATOR_HOOKFUNCTION(ons_RemovePlayer)
-{
+{SELFPARAM();
self.ons_deathloc = '0 0 0';
return false;
}
MUTATOR_HOOKFUNCTION(ons_PlayerSpawn)
-{
+{SELFPARAM();
if(!round_handler_IsRoundStarted())
{
self.player_blocked = true;
}
MUTATOR_HOOKFUNCTION(ons_PlayerDies)
-{
+{SELFPARAM();
frag_target.ons_deathloc = frag_target.origin;
entity l;
for(l = ons_worldgeneratorlist; l; l = l.ons_worldgeneratornext)
}
MUTATOR_HOOKFUNCTION(ons_MonsterThink)
-{
+{SELFPARAM();
entity e = find(world, targetname, self.target);
if (e != world)
self.team = e.team;
}
void ons_MonsterSpawn_Delayed()
-{
+{SELFPARAM();
entity e, own = self.owner;
if(!own) { remove(self); return; }
}
MUTATOR_HOOKFUNCTION(ons_MonsterSpawn)
-{
+{SELFPARAM();
entity e = spawn();
e.owner = self;
InitializeEntity(e, ons_MonsterSpawn_Delayed, INITPRIO_FINDTARGET);
}
void ons_TurretSpawn_Delayed()
-{
+{SELFPARAM();
entity e, own = self.owner;
if(!own) { remove(self); return; }
}
MUTATOR_HOOKFUNCTION(ons_TurretSpawn)
-{
+{SELFPARAM();
entity e = spawn();
e.owner = self;
InitializeEntity(e, ons_TurretSpawn_Delayed, INITPRIO_FINDTARGET);
}
MUTATOR_HOOKFUNCTION(ons_BotRoles)
-{
+{SELFPARAM();
havocbot_ons_reset_role(self);
return true;
}
}
MUTATOR_HOOKFUNCTION(ons_SpectateCopy)
-{
+{SELFPARAM();
self.ons_roundlost = other.ons_roundlost; // make spectators see it too
return false;
}
MUTATOR_HOOKFUNCTION(ons_SV_ParseClientCommand)
-{
+{SELFPARAM();
if(MUTATOR_RETURNVALUE) // command was already handled?
return false;
}
MUTATOR_HOOKFUNCTION(ons_PlayerUseKey)
-{
+{SELFPARAM();
if(MUTATOR_RETURNVALUE || gameover) { return false; }
if((time > self.teleport_antispam) && (self.deadflag == DEAD_NO) && !self.vehicle)
"target2" - second control point.
*/
void spawnfunc_onslaught_link()
-{
+{SELFPARAM();
if(!g_onslaught) { remove(self); return; }
if (self.target == "" || self.target2 == "")
*/
void spawnfunc_onslaught_controlpoint()
-{
+{SELFPARAM();
if(!g_onslaught) { remove(self); return; }
ons_ControlPoint_Setup(self);
"targetname" - name that spawnfunc_onslaught_link entities will use to target this.
*/
void spawnfunc_onslaught_generator()
-{
+{SELFPARAM();
if(!g_onslaught) { remove(self); return; }
if(!self.team) { objerror("team must be set"); }
// legacy bot roles
.float race_checkpoint;
void havocbot_role_race()
-{
+{SELFPARAM();
if(self.deadflag != DEAD_NO)
return;
}
MUTATOR_HOOKFUNCTION(race_PlayerPhysics)
-{
+{SELFPARAM();
// force kbd movement for fairness
float wishspeed;
vector wishvel;
}
MUTATOR_HOOKFUNCTION(race_PlayerPreThink)
-{
+{SELFPARAM();
if(IS_SPEC(self) || IS_OBSERVER(self))
if(g_race_qualifying)
if(msg_entity.enemy.race_laptime)
}
MUTATOR_HOOKFUNCTION(race_ClientConnect)
-{
+{SELFPARAM();
race_PreparePlayer();
self.race_checkpoint = -1;
}
MUTATOR_HOOKFUNCTION(race_MakePlayerObserver)
-{
+{SELFPARAM();
if(g_race_qualifying)
if(PlayerScore_Add(self, SP_RACE_FASTEST, 0))
self.frags = FRAGS_LMS_LOSER;
}
MUTATOR_HOOKFUNCTION(race_PlayerSpawn)
-{
+{SELFPARAM();
if(spawn_spot.target == "")
// Emergency: this wasn't a real spawnpoint. Can this ever happen?
race_PreparePlayer();
}
MUTATOR_HOOKFUNCTION(race_PutClientInServer)
-{
+{SELFPARAM();
if(IS_PLAYER(self))
if(!gameover)
{
}
MUTATOR_HOOKFUNCTION(race_PlayerDies)
-{
+{SELFPARAM();
self.respawn_flags |= RESPAWN_FORCE;
race_AbandonRaceCheck(self);
return false;
}
MUTATOR_HOOKFUNCTION(race_BotRoles)
-{
+{SELFPARAM();
self.havocbot_role = havocbot_role_race;
return true;
}
MUTATOR_HOOKFUNCTION(race_PlayerPostThink)
-{
+{SELFPARAM();
if(self.cvar_cl_allow_uidtracking == 1 && self.cvar_cl_allow_uid2name == 1)
{
if (!self.stored_netname)
"netname" Name of the team (for example Red, Blue, Green, Yellow, Life, Death, Offense, Defense, etc)...
"cnt" Scoreboard color of the team (for example 4 is red and 13 is blue)... */
void spawnfunc_tdm_team()
-{
+{SELFPARAM();
if(!g_tdm) { remove(self); return; }
self.classname = "tdm_team";
// code from here on is just to support maps that don't have team entities
void tdm_SpawnTeam (string teamname, float teamcolor)
-{
+{SELFPARAM();
entity oldself;
oldself = self;
self = spawn();
.float bloodloss_timer;
MUTATOR_HOOKFUNCTION(bloodloss_PlayerThink)
-{
+{SELFPARAM();
if(IS_PLAYER(self))
if(self.health <= autocvar_g_bloodloss && self.deadflag == DEAD_NO)
{
}
MUTATOR_HOOKFUNCTION(bloodloss_PlayerJump)
-{
+{SELFPARAM();
if(self.health <= autocvar_g_bloodloss)
return true;
}
bool buffs_BuffModel_Customize()
-{
+{SELFPARAM();
entity player, myowner;
bool same_team;
}
void buff_Effect(entity player, string eff)
-{
+{SELFPARAM();
if(!autocvar_g_buffs_effects) { return; }
if(time >= self.buff_effect_delay)
// buff item
float buff_Waypoint_visible_for_player(entity plr)
-{
+{SELFPARAM();
if(!self.owner.buff_active && !self.owner.buff_activetime)
return false;
}
void buff_SetCooldown(float cd)
-{
+{SELFPARAM();
cd = max(0, cd);
if(!self.buff_waypoint)
}
void buff_Respawn(entity ent)
-{
+{SELFPARAM();
if(gameover) { return; }
vector oldbufforigin = ent.origin;
}
void buff_Touch()
-{
+{SELFPARAM();
if(gameover) { return; }
if(ITEM_TOUCH_NEEDKILL())
}
void buff_Think()
-{
+{SELFPARAM();
if(self.buffs != self.oldbuffs)
{
entity buff = buff_FirstFromFlags(self.buffs);
}
void buff_Waypoint_Reset()
-{
+{SELFPARAM();
WaypointSprite_Kill(self.buff_waypoint);
if(self.buff_activetime) { buff_Waypoint_Spawn(self); }
}
void buff_Reset()
-{
+{SELFPARAM();
if(autocvar_g_buffs_randomize)
buff_NewType(self, self.buffs);
self.owner = world;
}
float buff_Customize()
-{
+{SELFPARAM();
entity player = WaypointSprite_getviewentity(other);
if(!self.buff_active || (self.team && DIFF_TEAM(player, self)))
{
}
void buff_Init(entity ent)
-{
+{SELFPARAM();
if(!cvar("g_buffs")) { remove(ent); return; }
if(!teamplay && ent.team) { ent.team = 0; }
}
void buff_Vengeance_DelayedDamage()
-{
+{SELFPARAM();
if(self.enemy)
Damage(self.enemy, self.owner, self.owner, self.dmg, DEATH_BUFF, self.enemy.origin, '0 0 0');
}
MUTATOR_HOOKFUNCTION(buffs_PlayerSpawn)
-{
+{SELFPARAM();
self.buffs = 0;
// reset timers here to prevent them continuing after re-spawn
self.buff_disability_time = 0;
}
MUTATOR_HOOKFUNCTION(buffs_PlayerPhysics)
-{
+{SELFPARAM();
if(self.buffs & BUFF_SPEED.m_itemid)
{
self.stat_sv_maxspeed *= autocvar_g_buffs_speed_speed;
}
MUTATOR_HOOKFUNCTION(buffs_PlayerJump)
-{
+{SELFPARAM();
if(self.buffs & BUFF_JUMP.m_itemid)
player_jumpheight = autocvar_g_buffs_jump_height;
}
MUTATOR_HOOKFUNCTION(buffs_MonsterMove)
-{
+{SELFPARAM();
if(time < self.buff_disability_time)
{
monster_speed_walk *= autocvar_g_buffs_disability_speed;
}
MUTATOR_HOOKFUNCTION(buffs_PlayerDies)
-{
+{SELFPARAM();
if(self.buffs)
{
int buffid = buff_FirstFromFlags(self.buffs).m_id;
}
MUTATOR_HOOKFUNCTION(buffs_PlayerUseKey)
-{
+{SELFPARAM();
if(MUTATOR_RETURNVALUE || gameover) { return false; }
if(self.buffs)
{
}
MUTATOR_HOOKFUNCTION(buffs_PlayerThrowKey)
-{
+{SELFPARAM();
if(MUTATOR_RETURNVALUE || gameover) { return false; }
if(self.buffs & BUFF_SWAPPER.m_itemid)
}
MUTATOR_HOOKFUNCTION(buffs_RemovePlayer)
-{
+{SELFPARAM();
if(self.buff_model)
{
remove(self.buff_model);
}
MUTATOR_HOOKFUNCTION(buffs_CustomizeWaypoint)
-{
+{SELFPARAM();
entity e = WaypointSprite_getviewentity(other);
// if you have the invisibility powerup, sprites ALWAYS are restricted to your team
}
MUTATOR_HOOKFUNCTION(buffs_OnEntityPreSpawn)
-{
+{SELFPARAM();
if(autocvar_g_buffs_replace_powerups)
switch(self.classname)
{
}
MUTATOR_HOOKFUNCTION(buffs_WeaponRate)
-{
+{SELFPARAM();
if(self.buffs & BUFF_SPEED.m_itemid)
weapon_rate *= autocvar_g_buffs_speed_rate;
}
MUTATOR_HOOKFUNCTION(buffs_WeaponSpeed)
-{
+{SELFPARAM();
if(self.buffs & BUFF_SPEED.m_itemid)
ret_float *= autocvar_g_buffs_speed_weaponspeed;
.float buff_time;
MUTATOR_HOOKFUNCTION(buffs_PlayerThink)
-{
+{SELFPARAM();
if(gameover || self.deadflag != DEAD_NO) { return false; }
if(time < self.buff_disability_time)
}
MUTATOR_HOOKFUNCTION(buffs_SpectateCopy)
-{
+{SELFPARAM();
self.buffs = other.buffs;
return false;
}
}
MUTATOR_HOOKFUNCTION(buffs_PlayerRegen)
-{
+{SELFPARAM();
if(self.buffs & BUFF_MEDIC.m_itemid)
{
regen_mod_rot = autocvar_g_buffs_medic_rot;
.float campcheck_traveled_distance;
MUTATOR_HOOKFUNCTION(campcheck_PlayerDies)
-{
+{SELFPARAM();
Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER_CPID, CPID_CAMPCHECK);
return false;
}
MUTATOR_HOOKFUNCTION(campcheck_PlayerThink)
-{
+{SELFPARAM();
if(IS_PLAYER(self))
if(self.deadflag == DEAD_NO)
if(!self.frozen)
}
MUTATOR_HOOKFUNCTION(campcheck_PlayerSpawn)
-{
+{SELFPARAM();
self.campcheck_nextcheck = time + autocvar_g_campcheck_interval * 2;
self.campcheck_traveled_distance = 0;
#elif defined(SVQC)
void dodging_UpdateStats()
-{
+{SELFPARAM();
self.stat_dodging = PHYS_DODGING;
self.stat_dodging_delay = PHYS_DODGING_DELAY;
self.stat_dodging_horiz_speed_frozen = PHYS_DODGING_HORIZ_SPEED_FROZEN;
// returns 1 if the player is close to a wall
bool check_close_to_wall(float threshold)
-{
+{SELFPARAM();
if (PHYS_DODGING_WALL == 0) { return false; }
#define X(OFFSET) \
}
bool check_close_to_ground(float threshold)
-{
+{SELFPARAM();
return IS_ONGROUND(self) ? true : false;
}
float PM_dodging_checkpressedkeys()
-{
+{SELFPARAM();
if(!PHYS_DODGING)
return false;
}
void PM_dodging()
-{
+{SELFPARAM();
if (!PHYS_DODGING)
return;
#include "../../common/items/all.qc"
void spawnfunc_item_minst_cells (void)
-{
+{SELFPARAM();
if (!g_instagib) { remove(self); return; }
if (!self.ammo_cells)
self.ammo_cells = autocvar_g_instagib_ammo_drop;
}
void instagib_health_mega()
-{
+{SELFPARAM();
self.max_health = 1;
StartItemA (ITEM_ExtraLife);
}
e.instagib_needammo = false;
}
void instagib_ammocheck()
-{
+{SELFPARAM();
if(time < self.instagib_nextthink)
return;
if(!IS_PLAYER(self))
}
MUTATOR_HOOKFUNCTION(instagib_MonsterSpawn)
-{
+{SELFPARAM();
// always refill ammo
if(self.monsterid == MON_MAGE.monsterid)
self.skin = 1;
}
MUTATOR_HOOKFUNCTION(instagib_MakePlayerObserver)
-{
+{SELFPARAM();
instagib_stop_countdown(self);
return false;
}
MUTATOR_HOOKFUNCTION(instagib_PlayerSpawn)
-{
+{SELFPARAM();
self.effects |= EF_FULLBRIGHT;
return false;
}
}
MUTATOR_HOOKFUNCTION(instagib_PlayerPowerups)
-{
+{SELFPARAM();
if (!(self.effects & EF_FULLBRIGHT))
self.effects |= EF_FULLBRIGHT;
}
MUTATOR_HOOKFUNCTION(instagib_PlayerPhysics)
-{
+{SELFPARAM();
if(self.items & ITEM_Shield.m_itemid)
self.stat_sv_maxspeed = self.stat_sv_maxspeed * autocvar_g_instagib_speed_highspeed;
}
MUTATOR_HOOKFUNCTION(instagib_FilterItem)
-{
+{SELFPARAM();
if(self.classname == "item_cells")
return true; // no normal cells?
}
MUTATOR_HOOKFUNCTION(instagib_CustomizeWaypoint)
-{
+{SELFPARAM();
entity e = WaypointSprite_getviewentity(other);
// if you have the invisibility powerup, sprites ALWAYS are restricted to your team
}
MUTATOR_HOOKFUNCTION(instagib_ItemCountdown)
-{
+{SELFPARAM();
switch (self.items)
{
case ITEM_Strength.m_itemid: item_name = "item-invis"; item_color = '0 0 1'; break;
}
MUTATOR_HOOKFUNCTION(instagib_ItemTouch)
-{
+{SELFPARAM();
if(self.ammo_cells)
{
// play some cool sounds ;)
}
MUTATOR_HOOKFUNCTION(instagib_OnEntityPreSpawn)
-{
+{SELFPARAM();
if (!autocvar_g_powerups) { return false; }
if (!(self.classname == "item_strength" || self.classname == "item_invincible" || self.itemdef == ITEM_HealthMega))
return false;
}
MUTATOR_HOOKFUNCTION(melee_FilterItem)
-{
+{SELFPARAM();
switch (self.items)
{
case ITEM_HealthSmall.m_itemid:
.float midair_shieldtime;
MUTATOR_HOOKFUNCTION(midair_PlayerDamage)
-{
+{SELFPARAM();
if(IS_PLAYER(frag_attacker))
if(IS_PLAYER(frag_target))
if(time < self.midair_shieldtime)
}
MUTATOR_HOOKFUNCTION(midair_PlayerPowerups)
-{
+{SELFPARAM();
if(time >= game_starttime)
if(self.flags & FL_ONGROUND)
{
}
MUTATOR_HOOKFUNCTION(midair_PlayerSpawn)
-{
+{SELFPARAM();
if(IS_BOT_CLIENT(self))
self.bot_moveskill = 0; // disable bunnyhopping
.float stat_multijump_add;
void multijump_UpdateStats()
-{
+{SELFPARAM();
self.stat_multijump = PHYS_MULTIJUMP;
self.stat_multijump_speed = PHYS_MULTIJUMP_SPEED;
self.stat_multijump_add = PHYS_MULTIJUMP_ADD;
#endif
void PM_multijump()
-{
+{SELFPARAM();
if(!PHYS_MULTIJUMP) { return; }
if(IS_ONGROUND(self))
}
float PM_multijump_checkjump()
-{
+{SELFPARAM();
if(!PHYS_MULTIJUMP) { return false; }
if (!IS_JUMP_HELD(self) && !IS_ONGROUND(self)) // jump button pressed this frame and we are in midair
.entity nade_spawnloc;
void nade_timer_think()
-{
+{SELFPARAM();
self.skin = 8 - (self.owner.wait - time) / (autocvar_g_nades_nade_lifetime / 10);
self.nextthink = time;
if(!self.owner || wasfreed(self.owner))
}
void napalm_damage(float dist, float damage, float edgedamage, float burntime)
-{
+{SELFPARAM();
entity e;
float d;
vector p;
void napalm_ball_think()
-{
+{SELFPARAM();
if(round_handler_IsActive())
if(!round_handler_IsRoundStarted())
{
void nade_napalm_ball()
-{
+{SELFPARAM();
entity proj;
vector kick;
void napalm_fountain_think()
-{
+{SELFPARAM();
if(round_handler_IsActive())
if(!round_handler_IsRoundStarted())
}
void nade_napalm_boom()
-{
+{SELFPARAM();
entity fountain;
int c;
for (c = 0; c < autocvar_g_nades_napalm_ball_count; c++)
}
void nade_ice_think()
-{
+{SELFPARAM();
if(round_handler_IsActive())
if(!round_handler_IsRoundStarted())
}
void nade_ice_boom()
-{
+{SELFPARAM();
entity fountain;
fountain = spawn();
fountain.owner = self.owner;
}
void nade_translocate_boom()
-{
+{SELFPARAM();
if(self.realowner.vehicle)
return;
}
void nade_spawn_boom()
-{
+{SELFPARAM();
entity spawnloc = spawn();
setorigin(spawnloc, self.origin);
setsize(spawnloc, self.realowner.mins, self.realowner.maxs);
}
void nade_heal_think()
-{
+{SELFPARAM();
if(time >= self.ltime)
{
remove(self);
}
void nade_heal_touch()
-{
+{SELFPARAM();
float maxhealth;
float health_factor;
if(IS_PLAYER(other) || IS_MONSTER(other))
}
void nade_heal_boom()
-{
+{SELFPARAM();
entity healer;
healer = spawn();
healer.owner = self.owner;
}
void nade_monster_boom()
-{
+{SELFPARAM();
entity e = spawnmonster(self.pokenade_type, 0, self.realowner, self.realowner, self.origin, false, false, 1);
if(autocvar_g_nades_pokenade_monster_lifetime > 0)
}
void nade_boom()
-{
+{SELFPARAM();
entity expef = NULL;
bool nade_blast = true;
}
void nade_touch()
-{
+{SELFPARAM();
/*float is_weapclip = 0;
if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODRAW)
if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID))
}
void nade_beep()
-{
+{SELFPARAM();
sound(self, CH_SHOTS_SINGLE, "overkill/grenadebip.ogg", VOL_BASE, 0.5 *(ATTEN_LARGE + ATTEN_MAX));
self.think = nade_boom;
self.nextthink = max(self.wait, time);
}
void nade_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
if(ITEM_DAMAGE_NEEDKILL(deathtype))
{
self.takedamage = DAMAGE_NO;
}
void toss_nade(entity e, vector _velocity, float _time)
-{
+{SELFPARAM();
if(e.nade == world)
return;
}
float nade_customize()
-{
+{SELFPARAM();
//if(IS_SPEC(other)) { return false; }
if(other == self.realowner || (IS_SPEC(other) && other.enemy == self.realowner))
{
}
void nade_prime()
-{
+{SELFPARAM();
if(self.nade)
remove(self.nade);
}
float CanThrowNade()
-{
+{SELFPARAM();
if(self.vehicle)
return false;
}
void nades_CheckThrow()
-{
+{SELFPARAM();
if(!CanThrowNade())
return;
}
MUTATOR_HOOKFUNCTION(nades_PlayerPreThink)
-{
+{SELFPARAM();
if(!IS_PLAYER(self)) { return false; }
float key_pressed = self.BUTTON_HOOK;
}
MUTATOR_HOOKFUNCTION(nades_PlayerSpawn)
-{
+{SELFPARAM();
if(autocvar_g_nades_spawn)
self.nade_refire = time + autocvar_g_spawnshieldtime;
else
}
MUTATOR_HOOKFUNCTION(nades_MonsterDies)
-{
+{SELFPARAM();
if(IS_PLAYER(frag_attacker))
if(DIFF_TEAM(frag_attacker, self))
if(!(self.spawnflags & MONSTERFLAG_SPAWNED))
}
MUTATOR_HOOKFUNCTION(nades_RemovePlayer)
-{
+{SELFPARAM();
nades_Clear(self);
nades_RemoveBonus(self);
return false;
}
MUTATOR_HOOKFUNCTION(nades_SpectateCopy)
-{
+{SELFPARAM();
self.nade_timer = other.nade_timer;
self.nade_type = other.nade_type;
self.pokenade_type = other.pokenade_type;
}
MUTATOR_HOOKFUNCTION(nt_SetWeaponreplace)
-{
+{SELFPARAM();
// otherwise, we do replace
if(self.new_toys)
{
}
MUTATOR_HOOKFUNCTION(nt_FilterItem)
-{
+{SELFPARAM();
if(nt_IsNewToy(self.weapon))
self.item_pickupsound = W_Sound("weaponpickup_new_toys");
return 0;
}
void NIX_GiveCurrentWeapon()
-{
+{SELFPARAM();
float dt;
if(!nix_nextweapon)
}
MUTATOR_HOOKFUNCTION(nix_FilterItem)
-{
+{SELFPARAM();
switch (self.items)
{
case ITEM_HealthSmall.m_itemid:
}
MUTATOR_HOOKFUNCTION(nix_OnEntityPreSpawn)
-{
+{SELFPARAM();
if(self.classname == "target_items") // items triggers cannot work in nix (as they change weapons/ammo)
return 1;
return 0;
}
MUTATOR_HOOKFUNCTION(nix_PlayerPreThink)
-{
+{SELFPARAM();
if(!intermission_running)
if(self.deadflag == DEAD_NO)
if(IS_PLAYER(self))
}
MUTATOR_HOOKFUNCTION(nix_PlayerSpawn)
-{
+{SELFPARAM();
self.nix_lastchange_id = -1;
NIX_GiveCurrentWeapon(); // overrides the weapons you got when spawning
self.items |= IT_UNLIMITED_SUPERWEAPONS;
}
MUTATOR_DEFINITION(mutator_nix)
-{
+{SELFPARAM();
entity e;
MUTATOR_HOOK(ForbidThrowCurrentWeapon, nix_ForbidThrowCurrentWeapon, CBC_ORDER_ANY);
}
MUTATOR_HOOKFUNCTION(ok_PlayerDamage_SplitHealthArmor)
-{
+{SELFPARAM();
if(damage_take)
self.ok_pauseregen_finished = max(self.ok_pauseregen_finished, time + 2);
return false;
}
MUTATOR_HOOKFUNCTION(ok_PlayerDies)
-{
+{SELFPARAM();
entity oldself = self;
entity targ = ((frag_attacker) ? frag_attacker : frag_target);
}
MUTATOR_HOOKFUNCTION(ok_PlayerRegen)
-{
+{SELFPARAM();
// overkill's values are different, so use custom regen
if(!self.frozen)
{
}
MUTATOR_HOOKFUNCTION(ok_PlayerPreThink)
-{
+{SELFPARAM();
if(intermission_running || gameover)
return false;
}
MUTATOR_HOOKFUNCTION(ok_PlayerSpawn)
-{
+{SELFPARAM();
if(autocvar_g_overkill_ammo_charge)
{
for(int i = WEP_FIRST; i <= WEP_LAST; ++i)
}
MUTATOR_HOOKFUNCTION(ok_OnEntityPreSpawn)
-{
+{SELFPARAM();
if(autocvar_g_powerups)
if(autocvar_g_overkill_powerups_replace)
{
}
MUTATOR_HOOKFUNCTION(ok_ItemRemove)
-{
+{SELFPARAM();
if(self.ok_item)
return false;
}
MUTATOR_HOOKFUNCTION(ok_SpectateCopy)
-{
+{SELFPARAM();
self.ammo_charge[self.weapon] = other.ammo_charge[other.weapon];
self.ok_use_ammocharge = other.ok_use_ammocharge;
.vector spawn_origin, spawn_angles;
void physical_item_think()
-{
+{SELFPARAM();
self.nextthink = time;
self.alpha = self.owner.alpha; // apply fading and ghosting
}
void physical_item_touch()
-{
+{SELFPARAM();
if(!self.cnt) // not for dropped items
if (ITEM_TOUCH_NEEDKILL())
{
}
void physical_item_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
if(!self.cnt) // not for dropped items
if(ITEM_DAMAGE_NEEDKILL(deathtype))
{
}
MUTATOR_HOOKFUNCTION(item_spawning)
-{
+{SELFPARAM();
if(self.owner == world && autocvar_g_physical_items <= 1)
return false;
if (self.spawnflags & 1) // floating item
#include "mutator.qh"
MUTATOR_HOOKFUNCTION(pinata_PlayerDies)
-{
+{SELFPARAM();
float j;
for(j = WEP_FIRST; j <= WEP_LAST; ++j)
if(self.weapons & WepSet_FromWeapon(j))
.vector msnt_deathloc;
MUTATOR_HOOKFUNCTION(msnt_Spawn_Score)
-{
+{SELFPARAM();
if(autocvar_g_spawn_near_teammate_ignore_spawnpoint)
return 0;
}
MUTATOR_HOOKFUNCTION(msnt_PlayerSpawn)
-{
+{SELFPARAM();
// Note: when entering this, fixangle is already set.
if(autocvar_g_spawn_near_teammate_ignore_spawnpoint)
{
}
MUTATOR_HOOKFUNCTION(msnt_PlayerDies)
-{
+{SELFPARAM();
self.msnt_deathloc = self.origin;
return 0;
}
.string superspec_itemfilter; //"classname1 classname2 ..."
float _spectate(entity _player)
-{
+{SELFPARAM();
if(Spectate(_player) == 1)
self.classname = "spectator";
}
void superspec_save_client_conf()
-{
+{SELFPARAM();
string fn = "superspec-local.options";
float fh;
}
MUTATOR_HOOKFUNCTION(superspec_ItemTouch)
-{
+{SELFPARAM();
entity _oldself = self;
entity _item = self;
}
MUTATOR_HOOKFUNCTION(superspec_SV_ParseClientCommand)
-{
+{SELFPARAM();
#define OPTIONINFO(flag,var,test,text,long,short) \
var = strcat(var, ((flag & test) ? "^2[ON] ^7" : "^1[OFF] ^7")); \
var = strcat(var, text," ^7(^3 ", long, "^7 | ^3", short, " ^7)\n")
}
void superspec_hello()
-{
+{SELFPARAM();
if(self.enemy.crypto_idfp == "")
Send_Notification(NOTIF_ONE_ONLY, self.enemy, MSG_INFO, INFO_SUPERSPEC_MISSING_UID);
}
MUTATOR_HOOKFUNCTION(superspec_ClientConnect)
-{
+{SELFPARAM();
if(!IS_REAL_CLIENT(self))
return false;
}
MUTATOR_HOOKFUNCTION(superspec_PlayerDies)
-{
+{SELFPARAM();
entity _old_self = self;
FOR_EACH_SPEC(self)
.float touchexplode_time;
void PlayerTouchExplode(entity p1, entity p2)
-{
+{SELFPARAM();
vector org;
org = (p1.origin + p2.origin) * 0.5;
org.z += (p1.mins.z + p2.mins.z) * 0.5;
}
MUTATOR_HOOKFUNCTION(touchexplode_PlayerThink)
-{
+{SELFPARAM();
if(time > self.touchexplode_time)
if(!gameover)
if(!self.frozen)
.float last_dmg;
MUTATOR_HOOKFUNCTION(vh, GrappleHookThink)
-{
+{SELFPARAM();
entity dmgent = ((SAME_TEAM(self.owner, self.aiment) && autocvar_g_vampirehook_teamheal) ? self.owner : self.aiment);
if(IS_PLAYER(self.aiment))
.float touch_timer;
void sandbox_ObjectFunction_Touch()
-{
+{SELFPARAM();
// apply material impact effects
if(!self.material)
}
void sandbox_ObjectFunction_Think()
-{
+{SELFPARAM();
entity e;
// decide if and how this object can be grabbed
self.nextthink = time;
- CSQCMODEL_AUTOUPDATE();
+ CSQCMODEL_AUTOUPDATE(self);
}
.float old_solid, old_movetype;
entity sandbox_ObjectEdit_Get(float permissions)
-{
+{SELFPARAM();
// Returns the traced entity if the player can edit it, and world if not.
// If permissions if false, the object is returned regardless of editing rights.
// Attached objects are SOLID_NOT and do not get traced.
}
entity sandbox_ObjectSpawn(float database)
-{
+{SELFPARAM();
// spawn a new object with default properties
entity e, oldself;
oldself = self;
self = e;
- CSQCMODEL_AUTOINIT();
+ CSQCMODEL_AUTOINIT(self);
self = oldself;
object_count += 1;
}
MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand)
-{
+{SELFPARAM();
if(MUTATOR_RETURNVALUE) // command was already handled?
return false;
if(cmd_name == "g_sandbox")
}
void path_dbg_think()
-{
+{SELFPARAM();
pathlib_showpath(self);
self.nextthink = time + 1;
}
void __showpath2_think()
-{
+{SELFPARAM();
#ifdef TURRET_DEBUG
mark_info(self.origin,1);
#endif
}
entity pathlib_astar(vector from,vector to)
-{
+{SELFPARAM();
entity path, start, end, open, n, ln;
float ptime, ftime, ctime;
#include "utility.qh"
vector pathlib_wateroutnode(vector start,vector end, float doedge)
-{
+{SELFPARAM();
vector surface;
pathlib_movenode_goodnode = 0;
}
vector pathlib_swimnode(vector start,vector end, float doedge)
-{
+{SELFPARAM();
pathlib_movenode_goodnode = 0;
if(pointcontents(start) != CONTENT_WATER)
}
vector pathlib_flynode(vector start,vector end, float doedge)
-{
+{SELFPARAM();
pathlib_movenode_goodnode = 0;
end.x = fsnap(end.x, pathlib_gridsize);
}
void a_think()
-{
+{SELFPARAM();
te_lightning1(self,self.origin, self.pos1);
if(self.cnt < time)
remove(self);
}
vector pathlib_walknode(vector start,vector end,float doedge)
-{
+{SELFPARAM();
vector direction,point,last_point,s,e;
float steps, distance, i;
return world;
}
void plas_think()
-{
+{SELFPARAM();
pathlib_waypointpath_step();
if(pathlib_foundgoal)
return;
}
float tile_check_cross(vector where)
-{
+{SELFPARAM();
vector p,f,r;
f = PLIB_FORWARD * tile_check_size;
}
float tile_check_plus(vector where)
-{
+{SELFPARAM();
vector p,f,r;
f = PLIB_FORWARD * tile_check_size;
}
float tile_check_plus2(vector where)
-{
+{SELFPARAM();
vector p,f,r;
float i = 0, e = 0;
const float PLAYERDEMO_MODE_READING = 1;
const float PLAYERDEMO_MODE_WRITING = 2;
void playerdemo_init()
-{
+{SELFPARAM();
self.playerdemo_mode = PLAYERDEMO_MODE_OFF;
}
void playerdemo_shutdown()
-{
+{SELFPARAM();
if(self.playerdemo_mode != PLAYERDEMO_MODE_OFF)
{
LOG_INFO("playerdemo: ", self.netname, " closed\n");
self.playerdemo_mode = 0;
}
void playerdemo_open_read(string f)
-{
+{SELFPARAM();
playerdemo_shutdown();
self.playerdemo_mode = PLAYERDEMO_MODE_READING;
self.playerdemo_fh = fopen(f, FILE_READ);
LOG_INFO("playerdemo: ", self.netname, " reading from ", f, "\n");
}
void playerdemo_open_write(string f)
-{
+{SELFPARAM();
playerdemo_shutdown();
self.playerdemo_mode = PLAYERDEMO_MODE_WRITING;
self.playerdemo_fh = fopen(f, FILE_WRITE);
// end of list
void playerdemo_write_originvector(.vector f, string name)
-{
+{SELFPARAM();
fputs(self.playerdemo_fh, strcat(vtos(self.(f)), "\n"));
}
void playerdemo_write_sizevector(.vector f, string name)
-{
+{SELFPARAM();
fputs(self.playerdemo_fh, strcat(vtos(self.(f)), "\n"));
}
void playerdemo_write_vector(.vector f, string name)
-{
+{SELFPARAM();
fputs(self.playerdemo_fh, strcat(vtos(self.(f)), "\n"));
}
void playerdemo_write_string(.string f, string name)
-{
+{SELFPARAM();
fputs(self.playerdemo_fh, strcat(self.(f), "\n"));
}
void playerdemo_write_modelstring(.string f, string name)
-{
+{SELFPARAM();
fputs(self.playerdemo_fh, strcat(self.(f), "\n"));
}
void playerdemo_write_float(.float f, string name)
-{
+{SELFPARAM();
fputs(self.playerdemo_fh, strcat(ftos(self.(f)), "\n"));
}
void playerdemo_write()
-{
+{SELFPARAM();
if(self.playerdemo_mode != PLAYERDEMO_MODE_WRITING)
return;
fputs(self.playerdemo_fh, strcat(ftos(time - self.playerdemo_starttime), "\n"));
PLAYERDEMO_FIELDS(playerdemo_write_)
}
void playerdemo_read_originvector(.vector f, string name)
-{
+{SELFPARAM();
setorigin(self, stov(fgets(self.playerdemo_fh)));
}
void playerdemo_read_sizevector(.vector f, string name)
-{
+{SELFPARAM();
self.(f) = stov(fgets(self.playerdemo_fh));
setsize(self, self.mins, self.maxs);
}
void playerdemo_read_vector(.vector f, string name)
-{
+{SELFPARAM();
self.(f) = stov(fgets(self.playerdemo_fh));
}
void playerdemo_read_string(.string f, string name)
-{
+{SELFPARAM();
string s = fgets(self.playerdemo_fh);
if (s != self.(f))
{
}
}
void playerdemo_read_modelstring(.string f, string name)
-{
+{SELFPARAM();
string s = fgets(self.playerdemo_fh);
if (s != self.(f))
setmodel(self, s);
}
void playerdemo_read_float(.float f, string name)
-{
+{SELFPARAM();
self.(f) = stof(fgets(self.playerdemo_fh));
}
float playerdemo_read()
-{
+{SELFPARAM();
if(self.playerdemo_mode != PLAYERDEMO_MODE_READING)
return 0;
if(self.playerdemo_time < 0)
}
void Portal_Touch()
-{
+{SELFPARAM();
vector g;
#ifdef PORTALS_ARE_NOT_SOLID
}
void Portal_Damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
-{
+{SELFPARAM();
if(deathtype == DEATH_TELEFRAG)
return;
if(attacker != self.aiment)
}
void Portal_Think_TryTeleportPlayer(entity e, vector g)
-{
+{SELFPARAM();
if(!Portal_WillHitPlane(e.origin, e.mins, e.maxs, e.velocity + g, self.origin, v_forward, self.maxs.x))
return;
}
void Portal_Think()
-{
+{SELFPARAM();
entity e, o;
vector g;
}
float Portal_Customize()
-{
+{SELFPARAM();
if(IS_SPEC(other))
other = other.enemy;
if(other == self.aiment)
W_Porto_Remove(own);
}
void Portal_RemoveLater_Think()
-{
+{SELFPARAM();
Portal_Remove(self, self.cnt);
}
void Portal_RemoveLater(entity portal, float kill)
}
void checkpoint_passed()
-{
+{SELFPARAM();
string oldmsg;
entity cp;
}
float race_waypointsprite_visible_for_player(entity e)
-{
+{SELFPARAM();
if(e.race_checkpoint == -1 || self.owner.race_checkpoint == -2)
return true;
else if(e.race_checkpoint == self.owner.race_checkpoint)
float have_verified;
void trigger_race_checkpoint_verify()
-{
+{SELFPARAM();
entity oldself, cp;
float i, p;
float qual;
}
vector trigger_race_checkpoint_spawn_evalfunc(entity player, entity spot, vector current)
-{
+{SELFPARAM();
if(g_race_qualifying)
{
// spawn at first
}
void spawnfunc_trigger_race_checkpoint()
-{
+{SELFPARAM();
vector o;
if(!g_race && !g_cts) { remove(self); return; }
}
void spawnfunc_target_checkpoint() // defrag entity
-{
+{SELFPARAM();
vector o;
if(!g_race && !g_cts) { remove(self); return; }
defrag_ents = 1;
}
void race_PreparePlayer()
-{
+{SELFPARAM();
race_ClearTime(self);
self.race_place = 0;
self.race_started = 0;
}
void race_RetractPlayer()
-{
+{SELFPARAM();
if(!g_race && !g_cts)
return;
if(self.race_respawn_checkpoint == 0 || self.race_respawn_checkpoint == race_timed_checkpoint)
}
void spawnfunc_info_player_race (void)
-{
+{SELFPARAM();
if(!g_race && !g_cts) { remove(self); return; }
++race_spawns;
spawnfunc_info_player_deathmatch();
}
void race_ClearRecords()
-{
+{SELFPARAM();
float i;
entity e;
}
void penalty_touch()
-{
+{SELFPARAM();
EXACTTRIGGER_TOUCH;
if(other.race_lastpenalty != self)
{
}
void penalty_use()
-{
+{SELFPARAM();
race_ImposePenaltyTime(activator, self.race_penalty, self.race_penalty_reason);
}
void spawnfunc_trigger_race_penalty()
-{
+{SELFPARAM();
EXACTTRIGGER_INIT;
self.use = penalty_use;
#include "../common/util.qh"
void round_handler_Think()
-{
+{SELFPARAM();
float f;
if(time < game_starttime)
*/
float TeamScore_SendEntity(entity to, float sendflags)
-{
+{SELFPARAM();
float i, p, longflags;
WriteByte(MSG_ENTITY, ENT_CLIENT_TEAMSCORES);
*/
float PlayerScore_SendEntity(entity to, float sendflags)
-{
+{SELFPARAM();
float i, p, longflags;
WriteByte(MSG_ENTITY, ENT_CLIENT_SCORES);
#include "../warpzonelib/util_server.qh"
float SpawnPoint_Send(entity to, int sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_SPAWNPOINT);
WriteByte(MSG_ENTITY, self.team);
}
float SpawnEvent_Send(entity to, int sf)
-{
+{SELFPARAM();
float send;
WriteByte(MSG_ENTITY, ENT_CLIENT_SPAWNEVENT);
}
void spawnpoint_use()
-{
+{SELFPARAM();
if(teamplay)
if(have_team_spawns > 0)
{
}
void relocate_spawnpoint()
-{
+{SELFPARAM();
// nudge off the floor
setorigin(self, self.origin + '0 0 1');
}
void spawnfunc_info_player_deathmatch (void)
-{
+{SELFPARAM();
self.classname = "info_player_deathmatch";
relocate_spawnpoint();
}
Starting point for a player in team one (Red).
Keys: "angle" viewing angle when spawning. */
void spawnfunc_info_player_team1()
-{
+{SELFPARAM();
if(g_assault) { remove(self); return; }
self.team = NUM_TEAM_1; // red
Starting point for a player in team two (Blue).
Keys: "angle" viewing angle when spawning. */
void spawnfunc_info_player_team2()
-{
+{SELFPARAM();
if(g_assault) { remove(self); return; }
self.team = NUM_TEAM_2; // blue
Starting point for a player in team three (Yellow).
Keys: "angle" viewing angle when spawning. */
void spawnfunc_info_player_team3()
-{
+{SELFPARAM();
if(g_assault) { remove(self); return; }
self.team = NUM_TEAM_3; // yellow
Starting point for a player in team four (Purple).
Keys: "angle" viewing angle when spawning. */
void spawnfunc_info_player_team4()
-{
+{SELFPARAM();
if(g_assault) { remove(self); return; }
self.team = NUM_TEAM_4; // purple
// _x: prio (-1 if unusable)
// _y: weight
vector Spawn_Score(entity spot, float mindist, float teamcheck)
-{
+{SELFPARAM();
float shortest, thisdist;
float prio;
entity player;
=============
*/
entity SelectSpawnPoint (float anypoint)
-{
+{SELFPARAM();
float teamcheck;
entity spot, firstspot;
Uniform pull towards a point
**/
vector steerlib_pull(vector point)
-{
+{SELFPARAM();
return normalize(point - self.origin);
}
Pull toward a point, The further away, the stronger the pull.
**/
vector steerlib_arrive(vector point,float maximal_distance)
-{
+{SELFPARAM();
float distance;
vector direction;
Pull toward a point increasing the pull the closer we get
**/
vector steerlib_attract(vector point, float maximal_distance)
-{
+{SELFPARAM();
float distance;
vector direction;
}
vector steerlib_attract2(vector point, float min_influense,float max_distance,float max_influense)
-{
+{SELFPARAM();
float distance;
vector direction;
float influense;
Move away from a point.
**/
vector steerlib_repell(vector point,float maximal_distance)
-{
+{SELFPARAM();
float distance;
vector direction;
Try to keep at ideal_distance away from point
**/
vector steerlib_standoff(vector point,float ideal_distance)
-{
+{SELFPARAM();
float distance;
vector direction;
where range is the cicrle radius and tresh is how close we need to be to pick a new heading.
**/
vector steerlib_wander(float range,float tresh,vector oldpoint)
-{
+{SELFPARAM();
vector wander_point;
wander_point = v_forward - oldpoint;
Dodge a point. dont work to well.
**/
vector steerlib_dodge(vector point,vector dodge_dir,float min_distance)
-{
+{SELFPARAM();
float distance;
distance = max(vlen(self.origin - point),min_distance);
**/
.float flock_id;
vector steerlib_flock(float _radius, float standoff,float separation_force,float flock_force)
-{
+{SELFPARAM();
entity flock_member;
vector push = '0 0 0', pull = '0 0 0';
float ccount = 0;
xy only version (for ground movers).
**/
vector steerlib_flock2d(float _radius, float standoff,float separation_force,float flock_force)
-{
+{SELFPARAM();
entity flock_member;
vector push = '0 0 0', pull = '0 0 0';
float ccount = 0;
This results in a aligned movement (?!) much like flocking.
**/
vector steerlib_swarm(float _radius, float standoff,float separation_force,float swarm_force)
-{
+{SELFPARAM();
entity swarm_member;
vector force = '0 0 0', center = '0 0 0';
float ccount = 0;
You need to call makevectors() (or equivalent) before this function to set v_forward and v_right
**/
vector steerlib_traceavoid(float pitch,float length)
-{
+{SELFPARAM();
vector vup_left,vup_right,vdown_left,vdown_right;
float fup_left,fup_right,fdown_left,fdown_right;
vector upwish,downwish,leftwish,rightwish;
Run tracelines in a forward trident, bias each direction negative if something is found there.
**/
vector steerlib_traceavoid_flat(float pitch, float length, vector vofs)
-{
+{SELFPARAM();
vector vt_left, vt_right,vt_front;
float f_left, f_right,f_front;
vector leftwish, rightwish,frontwish, v_left;
//#define BEAMSTEER_VISUAL
float beamsweep(vector from, vector dir,float length, float step,float step_up, float step_down)
-{
+{SELFPARAM();
float i;
vector a,b,u,d;
}
vector steerlib_beamsteer(vector dir, float length, float step, float step_up, float step_down)
-{
+{SELFPARAM();
float bm_forward, bm_right, bm_left,p;
vector vr,vl;
//#define TLIBS_TETSLIBS
#ifdef TLIBS_TETSLIBS
void flocker_die()
-{
+{SELFPARAM();
Send_Effect(EFFECT_ROCKET_EXPLODE, self.origin, '0 0 0', 1);
self.owner.cnt += 1;
void flocker_think()
-{
+{SELFPARAM();
vector dodgemove,swarmmove;
vector reprellmove,wandermove,newmove;
void spawn_flocker()
-{
+{SELFPARAM();
entity flocker;
flocker = spawn ();
}
void flockerspawn_think()
-{
+{SELFPARAM();
if(self.cnt > 0)
}
void flocker_hunter_think()
-{
+{SELFPARAM();
vector dodgemove,attractmove,newmove;
entity e,ee;
float d,bd;
float globflockcnt;
void spawnfunc_flockerspawn()
-{
+{SELFPARAM();
precache_model ( "models/turrets/rocket.md3");
precache_model("models/turrets/c512.md3");
++globflockcnt;
.float lastground;
void CreatureFrame (void)
-{
+{SELFPARAM();
entity oldself;
float dm;
float RedirectionThink();
void StartFrame (void)
-{
+{SELFPARAM();
execute_next_frame();
remove = remove_unsafely; // not during spawning!
.string cvarfilter;
float DoesQ3ARemoveThisEntity();
void SV_OnEntityPreSpawnFunction()
-{
+{SELFPARAM();
if (self)
if (self.gametypefilter != "")
if (!isGametypeInFilter(MapInfo_LoadedGametype, teamplay, have_team_spawns, self.gametypefilter))
#ifdef CSQC
void ItemDraw()
-{
+{SELFPARAM();
if(self.gravity)
{
Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
}
void ItemDrawSimple()
-{
+{SELFPARAM();
if(self.gravity)
{
Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
}
void ItemRead(float _IsNew)
-{
+{SELFPARAM();
int sf = ReadByte();
if(sf & ISF_LOCATION)
#ifdef SVQC
bool ItemSend(entity to, int sf)
-{
+{SELFPARAM();
if(self.gravity)
sf |= ISF_DROP;
else
}
float have_pickup_item(void)
-{
+{SELFPARAM();
if(self.flags & FL_POWERUP)
{
if(autocvar_g_powerups > 0)
}
void Item_Think()
-{
+{SELFPARAM();
self.nextthink = time;
if(self.origin != self.oldorigin)
{
void Item_ItemsTime_SetTimesForAllPlayers();
void Item_Respawn (void)
-{
+{SELFPARAM();
Item_Show(self, 1);
// this is ugly...
if(self.items == ITEM_Strength.m_itemid)
}
void Item_RespawnCountdown (void)
-{
+{SELFPARAM();
if(self.count >= ITEM_RESPAWN_TICKS)
{
if(self.waypointsprite_attached)
}
void Item_RespawnThink()
-{
+{SELFPARAM();
self.nextthink = time;
if(self.origin != self.oldorigin)
{
}
void Item_Touch (void)
-{
+{SELFPARAM();
entity e, head;
// remove the item if it's currnetly in a NODROP brush or hits a NOIMPACT surface (such as sky)
}
void Item_Reset()
-{
+{SELFPARAM();
Item_Show(self, !self.state);
setorigin (self, self.origin);
}
void Item_FindTeam()
-{
+{SELFPARAM();
entity head, e;
if(self.effects & EF_NODRAW)
// Savage: used for item garbage-collection
// TODO: perhaps nice special effect?
void RemoveItem(void)
-{
+{SELFPARAM();
Send_Effect(EFFECT_ITEM_PICKUP, CENTER_OR_VIEWOFS(self), '0 0 0', 1);
remove(self);
}
}
void StartItem (string itemmodel, string pickupsound, float defaultrespawntime, float defaultrespawntimejitter, string itemname, float itemid, float weaponid, float itemflags, float(entity player, entity item) pickupevalfunc, float pickupbasevalue)
-{
+{SELFPARAM();
startitem_failed = false;
if(self.model == "")
}
void StartItemA (entity a)
-{
+{SELFPARAM();
self.itemdef = a;
StartItem(Item_Model(a.m_model), a.m_sound, a.m_respawntime(), a.m_respawntimejitter(), a.m_name, a.m_itemid, 0, a.m_itemflags, a.m_pickupevalfunc, a.m_botvalue);
}
-void spawnfunc_item_rockets (void) {
+void spawnfunc_item_rockets()
+{SELFPARAM();
if(!self.ammo_rockets)
self.ammo_rockets = g_pickup_rockets;
if(!self.pickup_anyway)
StartItemA (ITEM_Rockets);
}
-void spawnfunc_item_bullets (void) {
+void spawnfunc_item_bullets()
+{SELFPARAM();
if(!weaponswapping)
if(autocvar_sv_q3acompat_machineshotgunswap)
if(self.classname != "droppedweapon")
StartItemA (ITEM_Bullets);
}
-void spawnfunc_item_cells (void) {
+void spawnfunc_item_cells()
+{SELFPARAM();
if(!self.ammo_cells)
self.ammo_cells = g_pickup_cells;
if(!self.pickup_anyway)
}
void spawnfunc_item_plasma()
-{
+{SELFPARAM();
if(!self.ammo_plasma)
self.ammo_plasma = g_pickup_plasma;
if(!self.pickup_anyway)
StartItemA (ITEM_Plasma);
}
-void spawnfunc_item_shells (void) {
+void spawnfunc_item_shells()
+{SELFPARAM();
if(!weaponswapping)
if(autocvar_sv_q3acompat_machineshotgunswap)
if(self.classname != "droppedweapon")
StartItemA (ITEM_Shells);
}
-void spawnfunc_item_armor_small (void) {
+void spawnfunc_item_armor_small()
+{SELFPARAM();
if(!self.armorvalue)
self.armorvalue = g_pickup_armorsmall;
if(!self.max_armorvalue)
StartItemA (ITEM_ArmorSmall);
}
-void spawnfunc_item_armor_medium (void) {
+void spawnfunc_item_armor_medium()
+{SELFPARAM();
if(!self.armorvalue)
self.armorvalue = g_pickup_armormedium;
if(!self.max_armorvalue)
StartItemA (ITEM_ArmorMedium);
}
-void spawnfunc_item_armor_big (void) {
+void spawnfunc_item_armor_big()
+{SELFPARAM();
if(!self.armorvalue)
self.armorvalue = g_pickup_armorbig;
if(!self.max_armorvalue)
StartItemA (ITEM_ArmorLarge);
}
-void spawnfunc_item_armor_large (void) {
+void spawnfunc_item_armor_large()
+{SELFPARAM();
if(!self.armorvalue)
self.armorvalue = g_pickup_armorlarge;
if(!self.max_armorvalue)
StartItemA (ITEM_ArmorMega);
}
-void spawnfunc_item_health_small (void) {
+void spawnfunc_item_health_small()
+{SELFPARAM();
if(!self.max_health)
self.max_health = g_pickup_healthsmall_max;
if(!self.health)
StartItemA (ITEM_HealthSmall);
}
-void spawnfunc_item_health_medium (void) {
+void spawnfunc_item_health_medium()
+{SELFPARAM();
if(!self.max_health)
self.max_health = g_pickup_healthmedium_max;
if(!self.health)
StartItemA (ITEM_HealthMedium);
}
-void spawnfunc_item_health_large (void) {
+void spawnfunc_item_health_large()
+{SELFPARAM();
if(!self.max_health)
self.max_health = g_pickup_healthlarge_max;
if(!self.health)
StartItemA (ITEM_HealthLarge);
}
-void spawnfunc_item_health_mega (void) {
+void spawnfunc_item_health_mega()
+{SELFPARAM();
if(!self.max_health)
self.max_health = g_pickup_healthmega_max;
if(!self.health)
void spawnfunc_item_health25() { spawnfunc_item_health_medium(); }
void spawnfunc_item_health100() { spawnfunc_item_health_mega(); }
-void spawnfunc_item_strength (void) {
+void spawnfunc_item_strength()
+{SELFPARAM();
precache_sound("weapons/strength_fire.wav");
if(!self.strength_finished)
self.strength_finished = autocvar_g_balance_powerup_strength_time;
StartItemA (ITEM_Strength);
}
-void spawnfunc_item_invincible (void) {
+void spawnfunc_item_invincible()
+{SELFPARAM();
if(!self.invincible_finished)
self.invincible_finished = autocvar_g_balance_powerup_invincible_time;
StartItemA (ITEM_Shield);
}
// compatibility:
-void spawnfunc_item_quad (void) {self.classname = "item_strength";spawnfunc_item_strength();}
+void spawnfunc_item_quad() {SELFPARAM(); self.classname = "item_strength";spawnfunc_item_strength();}
-void target_items_use (void)
-{
+void target_items_use()
+{SELFPARAM();
if(activator.classname == "droppedweapon")
{
EXACTTRIGGER_TOUCH;
}
void spawnfunc_target_items (void)
-{
+{SELFPARAM();
float n, i, j;
entity e;
string s;
}
void spawnfunc_item_fuel(void)
-{
+{SELFPARAM();
if(!self.ammo_fuel)
self.ammo_fuel = g_pickup_fuel;
if(!self.pickup_anyway)
}
void spawnfunc_item_jetpack(void)
-{
+{SELFPARAM();
if(!self.ammo_fuel)
self.ammo_fuel = g_pickup_fuel_jetpack;
if(start_items & ITEM_Jetpack.m_itemid)
e.(regenfield) = max(e.(regenfield), time + regentime);
}
float GiveItems(entity e, float beginarg, float endarg)
-{
+{SELFPARAM();
float got, i, j, val, op;
float _switchweapon;
entity wi;
//***********************
//QUAKE 1 ENTITIES - So people can play quake1 maps with the xonotic weapons
//***********************
-void spawnfunc_weapon_nailgun (void) {spawnfunc_weapon_electro();}
-void spawnfunc_weapon_supernailgun (void) {spawnfunc_weapon_hagar();}
-void spawnfunc_weapon_supershotgun (void) {spawnfunc_weapon_machinegun();}
-
-void spawnfunc_item_spikes (void) {spawnfunc_item_bullets();}
-//void spawnfunc_item_armor1 (void) {spawnfunc_item_armor_medium;} // FIXME: in Quake this is green armor, in Xonotic maps it is an armor shard
-void spawnfunc_item_armor2 (void) {spawnfunc_item_armor_large();}
-void item_armorInv (void) {spawnfunc_item_armor_large();}
-void spawnfunc_item_health (void) {if (self.spawnflags & 2) spawnfunc_item_health_mega();else spawnfunc_item_health_medium();}
+void spawnfunc_weapon_nailgun() {spawnfunc_weapon_electro();}
+void spawnfunc_weapon_supernailgun() {spawnfunc_weapon_hagar();}
+void spawnfunc_weapon_supershotgun() {spawnfunc_weapon_machinegun();}
+
+void spawnfunc_item_spikes() {spawnfunc_item_bullets();}
+//void spawnfunc_item_armor1() {spawnfunc_item_armor_medium;} // FIXME: in Quake this is green armor, in Xonotic maps it is an armor shard
+void spawnfunc_item_armor2() {spawnfunc_item_armor_large();}
+void item_armorInv() {spawnfunc_item_armor_large();}
+void spawnfunc_item_health() {SELFPARAM();if (self.spawnflags & 2) spawnfunc_item_health_mega();else spawnfunc_item_health_medium();}
//spawnfunc_item_spikes
//spawnfunc_item_health
}
void spawnfunc_target_init()
-{
+{SELFPARAM();
self.spawnflags = 0; // remove all weapons except the ones listed below
self.netname = "shotgun"; // keep these weapons through the remove trigger
spawnfunc_target_items();
// weapon give ent from defrag
void target_give_init()
-{
+{SELFPARAM();
entity targ;
for (targ = world; (targ = find(targ, targetname, self.target)); ) {
if (targ.classname == "weapon_rocketlauncher" || targ.classname == "weapon_devastator") {
}
void spawnfunc_target_give()
-{
+{SELFPARAM();
InitializeEntity(self, target_give_init, INITPRIO_FINDTARGET);
}
// CTF spawnfuncs handled in mutators/gamemode_ctf.qc now
void spawnfunc_item_flight()
-{
+{SELFPARAM();
if(!cvar("g_buffs") || !cvar("g_buffs_flight"))
spawnfunc_item_jetpack();
else
.float notta;
.string gametype;
float DoesQ3ARemoveThisEntity()
-{
+{SELFPARAM();
// Q3 style filters (DO NOT USE, THIS IS COMPAT ONLY)
if(self.notq3a)
InitializeEntity(world, default_delayedinit, INITPRIO_GAMETYPE_FALLBACK);
}
-string GetClientVersionMessage() {
+string GetClientVersionMessage()
+{SELFPARAM();
string versionmsg;
if (self.version_mismatch) {
if(self.version < autocvar_gameversion) {
// set c1...c4 to show what teams are allowed
void CheckAllowedTeams (entity for_whom)
-{
+{SELFPARAM();
float dm;
entity head;
string teament_name;
}
float JoinBestTeam(entity pl, float only_return_best, float forcebestteam)
-{
+{SELFPARAM();
float smallest, selectedteam;
// don't join a team if we're not playing a team game
//void() ctf_playerchanged;
void SV_ChangeTeam(float _color)
-{
+{SELFPARAM();
float scolor, dcolor, steam, dteam; //, dbotcount, scount, dcount;
// in normal deathmatch we can just apply the color and we're done
}
float accuracy_send(entity to, int sf)
-{
+{SELFPARAM();
int w, f;
entity a;
WriteByte(MSG_ENTITY, ENT_CLIENT_ACCURACY);
#include "../../common/weapons/all.qh"
void W_GiveWeapon (entity e, float wep)
-{
+{SELFPARAM();
entity oldself;
if (!wep)
}
void W_PrepareExplosionByDamage(entity attacker, void() explode)
-{
+{SELFPARAM();
self.takedamage = DAMAGE_NO;
self.event_damage = func_null;
.float csqcprojectile_type;
bool CSQCProjectile_SendEntity(entity to, int sf)
-{
+{SELFPARAM();
float ft, fr;
// note: flag 0x08 = no trail please (teleport bit)
}
float client_hasweapon(entity cl, float wpn, float andammo, float complain)
-{
+{SELFPARAM();
float f;
entity oldself;
}
float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, float complain, float skipmissing)
-{
+{SELFPARAM();
// We cannot tokenize in this function, as GiveItems calls this
// function. Thus we must use car/cdr.
float weaponwant, first_valid, prev_valid, switchtonext, switchtolast;
}
void W_SwitchWeapon(float imp)
-{
+{SELFPARAM();
if (self.switchweapon != imp)
{
if (client_hasweapon(self, imp, true, true))
}
void W_CycleWeapon(string weaponorder, float dir)
-{
+{SELFPARAM();
float w;
w = W_GetCycleWeapon(self, weaponorder, dir, -1, 1, true);
if(w > 0)
}
void W_NextWeaponOnImpulse(float imp)
-{
+{SELFPARAM();
float w;
w = W_GetCycleWeapon(self, self.cvar_cl_weaponpriority, +1, imp, 1, (self.cvar_cl_weaponimpulsemode == 0));
if(w > 0)
// next weapon
void W_NextWeapon(float list)
-{
+{SELFPARAM();
if(list == 0)
W_CycleWeapon(weaponorder_byid, -1);
else if(list == 1)
// prev weapon
void W_PreviousWeapon(float list)
-{
+{SELFPARAM();
if(list == 0)
W_CycleWeapon(weaponorder_byid, +1);
else if(list == 1)
// previously used if exists and has ammo, (second) best otherwise
void W_LastWeapon(void)
-{
+{SELFPARAM();
if(client_hasweapon(self, self.cnt, true, false))
W_SwitchWeapon(self.cnt);
else
}
void weapon_defaultspawnfunc(float wpn)
-{
+{SELFPARAM();
entity e;
float t;
string s;
#include "../../common/weapons/all.qh"
void thrown_wep_think()
-{
+{SELFPARAM();
self.nextthink = time;
if(self.oldorigin != self.origin)
{
// returns amount of ammo used as string, or -1 for failure, or 0 for no ammo count
string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo)
-{
+{SELFPARAM();
entity oldself, wep;
float thisammo, i;
string s;
// toss current weapon
void W_ThrowWeapon(vector velo, vector delta, float doreduce)
-{
+{SELFPARAM();
float w;
string a;
}
void SpawnThrownWeapon(vector org, float w)
-{
+{SELFPARAM();
if(self.weapons & WepSet_FromWeapon(self.weapon))
if(W_IsWeaponThrowable(self.weapon))
W_ThrowNewWeapon(self, self.weapon, false, org, randomvec() * 125 + '0 0 200');
// ====================
void FireRailgunBullet (vector start, vector end, float bdamage, float bforce, float mindist, float maxdist, float halflifedist, float forcehalflifedist, int deathtype)
-{
+{SELFPARAM();
vector hitloc, force, endpoint, dir;
entity ent, endent;
float endq3surfaceflags;
}
void fireBullet(vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, int tracereffects)
-{
+{SELFPARAM();
vector end;
dir = normalize(dir + randomvec() * spread);
void(float fr, float t, void() func) weapon_thinkf;
float CL_Weaponentity_CustomizeEntityForClient()
-{
+{SELFPARAM();
self.viewmodelforclient = self.owner;
if(IS_SPEC(other))
if(other.enemy == self.owner)
// call again with ""
// remove the ent
void CL_WeaponEntity_SetModel(string name)
-{
+{SELFPARAM();
float v_shot_idx;
if (name != "")
{
}
vector CL_Weapon_GetShotOrg(float wpn)
-{
+{SELFPARAM();
entity wi, oldself;
vector ret;
wi = get_weaponinfo(wpn);
}
void CL_Weaponentity_Think()
-{
+{SELFPARAM();
int tb;
self.nextthink = time;
if (intermission_running)
}
void CL_ExteriorWeaponentity_Think()
-{
+{SELFPARAM();
float tag_found;
self.nextthink = time;
if (self.owner.exteriorweaponentity != self)
self.glowmod = self.owner.weaponentity_glowmod;
self.colormap = self.owner.colormap;
- CSQCMODEL_AUTOUPDATE();
+ CSQCMODEL_AUTOUPDATE(self);
}
// spawning weaponentity for client
-void CL_SpawnWeaponentity()
+void CL_SpawnWeaponentity(entity e)
{
- self.weaponentity = spawn();
- self.weaponentity.classname = "weaponentity";
- self.weaponentity.solid = SOLID_NOT;
- self.weaponentity.owner = self;
- setmodel(self.weaponentity, ""); // precision set when changed
- setorigin(self.weaponentity, '0 0 0');
- self.weaponentity.angles = '0 0 0';
- self.weaponentity.viewmodelforclient = self;
- self.weaponentity.flags = 0;
- self.weaponentity.think = CL_Weaponentity_Think;
- self.weaponentity.customizeentityforclient = CL_Weaponentity_CustomizeEntityForClient;
- self.weaponentity.nextthink = time;
-
- self.exteriorweaponentity = spawn();
- self.exteriorweaponentity.classname = "exteriorweaponentity";
- self.exteriorweaponentity.solid = SOLID_NOT;
- self.exteriorweaponentity.exteriorweaponentity = self.exteriorweaponentity;
- self.exteriorweaponentity.owner = self;
- setorigin(self.exteriorweaponentity, '0 0 0');
- self.exteriorweaponentity.angles = '0 0 0';
- self.exteriorweaponentity.think = CL_ExteriorWeaponentity_Think;
- self.exteriorweaponentity.nextthink = time;
-
- {
- entity oldself = self;
- self = self.exteriorweaponentity;
- CSQCMODEL_AUTOINIT();
- self = oldself;
- }
+ entity view = e.weaponentity = spawn();
+ view.classname = "weaponentity";
+ view.solid = SOLID_NOT;
+ view.owner = e;
+ setmodel(view, ""); // precision set when changed
+ setorigin(view, '0 0 0');
+ view.angles = '0 0 0';
+ view.viewmodelforclient = e;
+ view.flags = 0;
+ view.think = CL_Weaponentity_Think;
+ view.customizeentityforclient = CL_Weaponentity_CustomizeEntityForClient;
+ view.nextthink = time;
+
+ entity exterior = e.exteriorweaponentity = spawn();
+ exterior.classname = "exteriorweaponentity";
+ exterior.solid = SOLID_NOT;
+ exterior.exteriorweaponentity = exterior;
+ exterior.owner = e;
+ setorigin(exterior, '0 0 0');
+ exterior.angles = '0 0 0';
+ exterior.think = CL_ExteriorWeaponentity_Think;
+ exterior.nextthink = time;
+
+ CSQCMODEL_AUTOINIT(exterior);
}
// Weapon subs
void w_clear()
-{
+{SELFPARAM();
if (self.weapon != -1)
{
self.weapon = 0;
}
void w_ready()
-{
+{SELFPARAM();
if (self.weaponentity)
self.weaponentity.state = WS_READY;
weapon_thinkf(WFRAME_IDLE, 1000000, w_ready);
.float prevdryfire;
.float prevwarntime;
float weapon_prepareattack_checkammo(float secondary)
-{
+{SELFPARAM();
if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
if (!WEP_ACTION(self.weapon, WR_CHECKAMMO1 + secondary))
{
}
.float race_penalty;
float weapon_prepareattack_check(float secondary, float attacktime)
-{
+{SELFPARAM();
if(!weapon_prepareattack_checkammo(secondary))
return false;
return true;
}
float weapon_prepareattack_do(float secondary, float attacktime)
-{
+{SELFPARAM();
self.weaponentity.state = WS_INUSE;
self.spawnshieldtime = min(self.spawnshieldtime, time); // kill spawn shield when you fire
}
void weapon_thinkf(float fr, float t, void() func)
-{
+{SELFPARAM();
vector a;
vector of, or, ou;
float restartanim;
}
void W_WeaponFrame()
-{
+{SELFPARAM();
vector fo, ri, up;
if (frametime)
}
void W_AttachToShotorg(entity flash, vector offset)
-{
+{SELFPARAM();
entity xflash;
flash.owner = self;
flash.angles_z = random() * 360;
}
void W_DecreaseAmmo(float ammo_use)
-{
+{SELFPARAM();
entity wep = get_weaponinfo(self.weapon);
if(cvar("g_overkill"))
.string reload_sound;
void W_ReloadedAndReady()
-{
+{SELFPARAM();
// finish the reloading process, and do the ammo transfer
self.clip_load = self.old_clip_load; // restore the ammo counter, in case we still had ammo in the weapon before reloading
}
void W_Reload(float sent_ammo_min, string sent_sound)
-{
+{SELFPARAM();
// set global values to work with
entity e;
e = get_weaponinfo(self.weapon);
}
void W_DropEvent(float event, entity player, float weapon_type, entity weapon_item)
-{
+{SELFPARAM();
entity oldself = self;
self = player;
weapon_dropevent_item = weapon_item;
const float WFRAME_IDLE = 2;
const float WFRAME_RELOAD = 3;
-void CL_SpawnWeaponentity();
+void CL_SpawnWeaponentity(entity e);
vector CL_Weapon_GetShotOrg(float wpn);
#endif
void WarpZone_Fade_PreDraw()
-{
+{SELFPARAM();
vector org;
org = getpropertyvec(VF_ORIGIN);
if(!checkpvs(org, self)) // this makes sense as long as we don't support recursive warpzones
}
void WarpZone_Read(float isnew)
-{
+{SELFPARAM();
warpzone_warpzones_exist = 1;
if (!self.enemy)
{
}
void WarpZone_Camera_Read(float isnew)
-{
+{SELFPARAM();
warpzone_cameras_exist = 1;
self.classname = "func_warpzone_camera";
void CL_RotateMoves(vector ang) = #638;
void WarpZone_Teleported_Read(float isnew)
-{
+{SELFPARAM();
vector v;
self.classname = "warpzone_teleported";
v.x = ReadCoord();
.vector(vector, vector) camera_transform;
float autocvar_cl_warpzone_usetrace = 1;
vector WarpZone_camera_transform(vector org, vector ang)
-{
+{SELFPARAM();
vector vf, vr, vu;
if(self.warpzone_fadestart)
if(vlen(org - self.origin - 0.5 * (self.mins + self.maxs)) > self.warpzone_fadeend + 400)
}
vector WarpZone_Camera_camera_transform(vector org, vector ang)
-{
+{SELFPARAM();
// a fixed camera view
if(self.warpzone_fadestart)
if(vlen(org - self.origin - 0.5 * (self.mins + self.maxs)) > self.warpzone_fadeend + 400)
.entity WarpZone_refsys;
void WarpZone_RefSys_GC()
-{
+{SELFPARAM();
// garbage collect unused reference systems
self.nextthink = time + 1;
if(self.owner.WarpZone_refsys != self)
}
float WarpZoneLib_ExactTrigger_Touch()
-{
+{SELFPARAM();
return !WarpZoneLib_BoxTouchesBrush(other.absmin, other.absmax, self, other);
}
}
bool WarpZone_Teleported_Send(entity to, int sf)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE_TELEPORTED);
WriteCoord(MSG_ENTITY, self.angles.x);
WriteCoord(MSG_ENTITY, self.angles.y);
}
void WarpZone_Touch (void)
-{
+{SELFPARAM();
entity oldself;
if(other.classname == "trigger_warpzone")
}
bool WarpZone_Send(entity to, int sendflags)
-{
+{SELFPARAM();
WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE);
// we must send this flag for clientside to match properly too
}
bool WarpZone_Camera_Send(entity to, int sendflags)
-{
+{SELFPARAM();
int f = 0;
WriteByte(MSG_ENTITY, ENT_CLIENT_WARPZONE_CAMERA);
#ifdef WARPZONELIB_KEEPDEBUG
float WarpZone_CheckProjectileImpact(entity player)
-{
+{SELFPARAM();
vector o0, v0;
o0 = player.origin + player.view_ofs;
#endif
float WarpZone_Projectile_Touch()
-{
+{SELFPARAM();
if(other.classname == "trigger_warpzone")
return true;
}
void WarpZone_InitStep_FindOriginTarget()
-{
+{SELFPARAM();
if(self.killtarget != "")
{
self.aiment = find(world, targetname, self.killtarget);
}
void WarpZonePosition_InitStep_FindTarget()
-{
+{SELFPARAM();
if(self.target == "")
{
error("Warp zone position with no target");
}
void WarpZoneCamera_Think(void)
-{
+{SELFPARAM();
if(self.warpzone_save_origin != self.origin
|| self.warpzone_save_angles != self.angles
|| self.warpzone_save_eorigin != self.enemy.origin
}
void WarpZoneCamera_InitStep_FindTarget()
-{
+{SELFPARAM();
entity e;
float i;
if(self.target == "")
}
void WarpZone_InitStep_UpdateTransform()
-{
+{SELFPARAM();
vector org, ang, norm, point;
float area;
vector tri, a, b, c, n;
}
void WarpZone_InitStep_ClearTarget()
-{
+{SELFPARAM();
if(self.enemy)
self.enemy.enemy = world;
self.enemy = world;
entity warpzone_first; .entity warpzone_next;
void WarpZone_InitStep_FindTarget()
-{
+{SELFPARAM();
float i;
entity e, e2;
void WarpZone_Think();
void WarpZone_InitStep_FinalizeTransform()
-{
+{SELFPARAM();
if(!self.enemy || self.enemy.enemy != self)
{
error("Invalid warp zone detected. Killed.");
entity warpzone_camera_first;
.entity warpzone_next;
void spawnfunc_misc_warpzone_position(void)
-{
+{SELFPARAM();
// "target", "angles", "origin"
self.warpzone_next = warpzone_position_first;
warpzone_position_first = self;
spawnfunc_misc_warpzone_position();
}
void spawnfunc_trigger_warpzone(void)
-{
+{SELFPARAM();
// warp zone entities must have:
// "killtarget" pointing to a target_position with a direction arrow
// that points AWAY from the warp zone, and that is inside
warpzone_first = self;
}
void spawnfunc_func_camera(void)
-{
+{SELFPARAM();
if(!self.scale)
self.scale = self.modelscale;
if(!self.scale)
warpzone_camera_first = self;
}
void WarpZones_Reconnect()
-{
+{SELFPARAM();
entity e;
e = self;
for(self = warpzone_first; self; self = self.warpzone_next)
}
void WarpZone_Think()
-{
+{SELFPARAM();
if(self.warpzone_save_origin != self.origin
|| self.warpzone_save_angles != self.angles
|| self.warpzone_save_eorigin != self.enemy.origin
}
void WarpZone_StartFrame()
-{
+{SELFPARAM();
entity e;
if(warpzone_initialized == 0)
{
return 0;
}
void trigger_warpzone_reconnect_use()
-{
+{SELFPARAM();
entity e;
e = self;
// NOTE: this matches for target, not targetname, but of course
}
void spawnfunc_trigger_warpzone_reconnect()
-{
+{SELFPARAM();
self.use = trigger_warpzone_reconnect_use;
}
}
void WarpZone_PlayerPhysics_FixVAngle(void)
-{
+{SELFPARAM();
#ifndef WARPZONE_DONT_FIX_VANGLE
if(IS_REAL_CLIENT(self))
if(self.v_angle.z <= 360) // if not already adjusted
#include "common.qh"
void WarpZoneLib_ExactTrigger_Init()
-{
+{SELFPARAM();
vector mi, ma;
if (self.movedir == '0 0 0')
if (self.angles != '0 0 0')