$(RM) qccversion.*
echo This file intentionally left blank. > $@
-FILES_CSPROGS = $(shell find client common warpzonelib csqcmodellib -type f -not -name fteqcc.log -not -name qc.asm)
+FILES_CSPROGS = $(shell find client lib common warpzonelib csqcmodellib -type f -not -name fteqcc.log -not -name qc.asm)
../csprogs.dat: $(FILES_CSPROGS) $(QCCVERSIONFILE)
@echo make[1]: Entering directory \`$(PWD)/client\'
cd client && $(QCC) $(QCCFLAGS) -DCSQC
server/precache-for-csqc.inc: $(FILES_CSPROGS)
sh collect-precache.sh
-FILES_PROGS = $(shell find server common warpzonelib csqcmodellib -type f -not -name fteqcc.log -not -name qc.asm)
+FILES_PROGS = $(shell find server lib common warpzonelib csqcmodellib -type f -not -name fteqcc.log -not -name qc.asm)
../progs.dat: $(FILES_PROGS) $(QCCVERSIONFILE) server/precache-for-csqc.inc
@echo make[1]: Entering directory \`$(PWD)/server\'
cd server && $(QCC) $(QCCFLAGS) -DSVQC
-FILES_MENU = $(shell find menu common warpzonelib -type f -not -name fteqcc.log -not -name qc.asm)
+FILES_MENU = $(shell find menu lib common warpzonelib -type f -not -name fteqcc.log -not -name qc.asm)
../menu.dat: $(FILES_MENU) $(QCCVERSIONFILE)
@echo make[1]: Entering directory \`$(PWD)/menu\'
cd menu && $(QCC) $(QCCFLAGS) -DMENUQC
hud_panelent.panel_showflags = showflags; \
HUD_PANEL_NUM++; \
} \
- ACCUMULATE_FUNCTION(RegisterHUD_Panels, RegisterHUD_Panel_##NAME);
+ ACCUMULATE_FUNCTION(RegisterHUD_Panels, RegisterHUD_Panel_##NAME)
HUD_PANELS(HUD_PANEL)
#undef HUD_PANEL
--- /dev/null
+#include "../common/util-pre.qh"
+#include "../dpdefs/csprogsdefs.qh"
+#include "../common/util-post.qh"
+
+#include "../lib/_all.inc"
+
+#include "announcer.qc"
+#include "bgmscript.qc"
+#include "controlpoint.qc"
+#include "csqcmodel_hooks.qc"
+#include "damage.qc"
+#include "effects.qc"
+#include "generator.qc"
+#include "gibs.qc"
+#include "hook.qc"
+#include "hud.qc"
+#include "hud_config.qc"
+#include "main.qc"
+#include "mapvoting.qc"
+#include "miscfunctions.qc"
+#include "modeleffects.qc"
+#include "movelib.qc"
+#include "particles.qc"
+#include "player_skeleton.qc"
+#include "rubble.qc"
+#include "scoreboard.qc"
+#include "shownames.qc"
+#include "teamradar.qc"
+#include "tuba.qc"
+#include "t_items.qc"
+#include "view.qc"
+#include "wall.qc"
+
+#include "command/all.qc"
+
+#include "weapons/projectile.qc" // TODO
+
+#include "../common/animdecide.qc"
+#include "../common/buffs.qc"
+#include "../common/effects.qc"
+#include "../common/mapinfo.qc"
+#include "../common/movetypes/include.qc"
+#include "../common/nades.qc"
+#include "../common/net_notice.qc"
+#include "../common/notifications.qc"
+#include "../common/physics.qc"
+#include "../common/playerstats.qc"
+#include "../common/util.qc"
+
+#include "../common/viewloc.qc"
+
+#include "../common/minigames/minigames.qc"
+#include "../common/minigames/cl_minigames.qc"
+
+#include "../common/items/all.qc"
+#include "../common/monsters/all.qc"
+#include "../common/mutators/all.qc"
+#include "../common/vehicles/all.qc"
+#include "../common/weapons/all.qc"
+
+#include "../common/turrets/cl_turrets.qc"
+#include "../common/turrets/turrets.qc"
+
+#include "../common/triggers/include.qc"
+
+#include "../csqcmodellib/cl_model.qc"
+#include "../csqcmodellib/cl_player.qc"
+#include "../csqcmodellib/interpolate.qc"
+
+#include "../server/mutators/mutator_multijump.qc"
+
+#include "../warpzonelib/anglestransform.qc"
+#include "../warpzonelib/client.qc"
+#include "../warpzonelib/common.qc"
+#include "../warpzonelib/util_server.qc"
+
+#include "../mod/client/progs.inc"
../../csprogs.dat
-
-../common/util-pre.qh
-../dpdefs/csprogsdefs.qh
-../common/util-post.qh
-
-../lib/_all.inc
-
-announcer.qc
-bgmscript.qc
-controlpoint.qc
-csqcmodel_hooks.qc
-damage.qc
-effects.qc
-generator.qc
-gibs.qc
-hook.qc
-hud.qc
-hud_config.qc
-main.qc
-mapvoting.qc
-miscfunctions.qc
-modeleffects.qc
-movelib.qc
-particles.qc
-player_skeleton.qc
-rubble.qc
-scoreboard.qc
-shownames.qc
-teamradar.qc
-tuba.qc
-t_items.qc
-view.qc
-wall.qc
-
-command/all.qc
-
-weapons/projectile.qc // TODO
-
-../common/animdecide.qc
-../common/buffs.qc
-../common/effects.qc
-../common/mapinfo.qc
-../common/movetypes/include.qc
-../common/nades.qc
-../common/net_notice.qc
-../common/notifications.qc
-../common/physics.qc
-../common/playerstats.qc
-../common/util.qc
-
-../common/viewloc.qc
-
-../common/minigames/minigames.qc
-../common/minigames/cl_minigames.qc
-
-../common/items/all.qc
-../common/monsters/all.qc
-../common/mutators/all.qc
-../common/vehicles/all.qc
-../common/weapons/all.qc
-
-../common/turrets/cl_turrets.qc
-../common/turrets/turrets.qc
-
-../common/triggers/include.qc
-
-../csqcmodellib/cl_model.qc
-../csqcmodellib/cl_player.qc
-../csqcmodellib/interpolate.qc
-
-../server/mutators/mutator_multijump.qc
-
-../warpzonelib/anglestransform.qc
-../warpzonelib/client.qc
-../warpzonelib/common.qc
-../warpzonelib/util_server.qc
-
-../mod/client/progs.inc
+progs.inc
break;
}
- if(Nade_FromProjectile(self.cnt) != NADE_TYPE_NULL)
+ if(Nade_FromProjectile(self.cnt) != NADE_TYPE_Null)
rot = self.avelocity;
self.angles = AnglesTransform_ToAngles(AnglesTransform_Multiply(AnglesTransform_FromAngles(self.angles), rot * (t - self.spawntime)));
break;
}
- if(Nade_FromProjectile(self.cnt) != NADE_TYPE_NULL)
+ if(Nade_FromProjectile(self.cnt) != NADE_TYPE_Null)
trailorigin += v_up * 4;
if(drawn)
case PROJECTILE_GRENADE: setmodel(self, "models/grenademodel.md3");self.traileffect = particleeffectnum(EFFECT_TR_GRENADE); break;
case PROJECTILE_GRENADE_BOUNCING: setmodel(self, "models/grenademodel.md3");self.traileffect = particleeffectnum(EFFECT_TR_GRENADE); break;
case PROJECTILE_MINE: setmodel(self, "models/mine.md3");self.traileffect = particleeffectnum(EFFECT_TR_GRENADE); break;
- case PROJECTILE_BLASTER: setmodel(self, "models/laser.mdl");self.traileffect = particleeffectnum(EFFECT_NULL); break;
- case PROJECTILE_HLAC: setmodel(self, "models/hlac_bullet.md3");self.traileffect = particleeffectnum(EFFECT_NULL); break;
+ case PROJECTILE_BLASTER: setmodel(self, "models/laser.mdl");self.traileffect = particleeffectnum(EFFECT_Null); break;
+ case PROJECTILE_HLAC: setmodel(self, "models/hlac_bullet.md3");self.traileffect = particleeffectnum(EFFECT_Null); break;
case PROJECTILE_PORTO_RED: setmodel(self, "models/grenademodel.md3");self.traileffect = particleeffectnum(EFFECT_TR_WIZSPIKE); self.scale = 4; break;
case PROJECTILE_PORTO_BLUE: setmodel(self, "models/grenademodel.md3");self.traileffect = particleeffectnum(EFFECT_TR_WIZSPIKE); self.scale = 4; break;
case PROJECTILE_HOOKBOMB: setmodel(self, "models/grenademodel.md3");self.traileffect = particleeffectnum(EFFECT_TR_KNIGHTSPIKE); break;
case PROJECTILE_MAGE_SPIKE: setmodel(self, "models/ebomb.mdl"); self.traileffect = particleeffectnum(EFFECT_TR_VORESPIKE); break;
case PROJECTILE_SHAMBLER_LIGHTNING: setmodel(self, "models/ebomb.mdl"); self.traileffect = particleeffectnum(EFFECT_TR_NEXUIZPLASMA); break;
- case PROJECTILE_RAPTORBOMB: setmodel(self, "models/vehicles/clusterbomb.md3"); self.gravity = 1; self.avelocity = '0 0 180'; self.traileffect = particleeffectnum(EFFECT_NULL); break;
- case PROJECTILE_RAPTORBOMBLET: setmodel(self, "models/vehicles/bomblet.md3"); self.gravity = 1; self.avelocity = '0 0 180'; self.traileffect = particleeffectnum(EFFECT_NULL); break;
+ case PROJECTILE_RAPTORBOMB: setmodel(self, "models/vehicles/clusterbomb.md3"); self.gravity = 1; self.avelocity = '0 0 180'; self.traileffect = particleeffectnum(EFFECT_Null); break;
+ case PROJECTILE_RAPTORBOMBLET: setmodel(self, "models/vehicles/bomblet.md3"); self.gravity = 1; self.avelocity = '0 0 180'; self.traileffect = particleeffectnum(EFFECT_Null); break;
case PROJECTILE_RAPTORCANNON: setmodel(self, "models/plasmatrail.mdl"); self.traileffect = particleeffectnum(EFFECT_TR_CRYLINKPLASMA); break;
case PROJECTILE_SPIDERROCKET: setmodel(self, "models/vehicles/rocket02.md3"); self.traileffect = particleeffectnum(EFFECT_SPIDERBOT_ROCKET_TRAIL); break;
case PROJECTILE_WAKIROCKET: setmodel(self, "models/vehicles/rocket01.md3"); self.traileffect = particleeffectnum(EFFECT_RACER_ROCKET_TRAIL); break;
- case PROJECTILE_WAKICANNON: setmodel(self, "models/laser.mdl"); self.traileffect = particleeffectnum(EFFECT_NULL); break;
+ case PROJECTILE_WAKICANNON: setmodel(self, "models/laser.mdl"); self.traileffect = particleeffectnum(EFFECT_Null); break;
case PROJECTILE_BUMBLE_GUN: setmodel(self, "models/elaser.mdl");self.traileffect = particleeffectnum(EFFECT_TR_NEXUIZPLASMA); break;
case PROJECTILE_BUMBLE_BEAM: setmodel(self, "models/elaser.mdl");self.traileffect = particleeffectnum(EFFECT_TR_NEXUIZPLASMA); break;
if(MUTATOR_CALLHOOK(Ent_Projectile, self))
break;
- if (Nade_FromProjectile(self.cnt) != NADE_TYPE_NULL)
+ if (Nade_FromProjectile(self.cnt) != NADE_TYPE_Null)
{
setmodel(self, W_Model("v_ok_grenade.md3"));
self.traileffect = _particleeffectnum(Nade_TrailEffect(self.cnt, self.team));
break;
}
- if(Nade_FromProjectile(self.cnt) != NADE_TYPE_NULL)
+ if(Nade_FromProjectile(self.cnt) != NADE_TYPE_Null)
{
entity nade_type = Nade_FromProjectile(self.cnt);
self.mins = '-16 -16 -16';
#endif
ENDCLASS(Buff)
-REGISTER_BUFF(NULL);
+REGISTER_BUFF(Null);
REGISTER_BUFF(AMMO) {
this.m_prettyName = _("Ammo");
BUFF_SPAWNFUNCS(inferno, BUFF_INFERNO)
BUFF_SPAWNFUNCS(swapper, BUFF_SWAPPER)
BUFF_SPAWNFUNCS(magnet, BUFF_MAGNET)
-BUFF_SPAWNFUNCS(random, BUFF_NULL)
+BUFF_SPAWNFUNCS(random, BUFF_Null)
BUFF_SPAWNFUNC_Q3TA_COMPAT(doubler, BUFF_MEDIC)
BUFF_SPAWNFUNC_Q3TA_COMPAT(resistance, BUFF_RESISTANCE)
if (msg_death_by != NO_MSG) \
deathent.death_msgmurder = msg_multi_notifs[msg_death_by - 1]; \
} \
- ACCUMULATE_FUNCTION(RegisterDeathtypes, RegisterDeathtype_##name);
+ ACCUMULATE_FUNCTION(RegisterDeathtypes, RegisterDeathtype_##name)
DEATHTYPES
#undef DEATHTYPE
}
// NOW we actually activate the declarations
-ACCUMULATE_FUNCTION(RegisterEffects, RegisterEffects_First);
-EFFECT(0, NULL, string_null)
+ACCUMULATE_FUNCTION(RegisterEffects, RegisterEffects_First)
+EFFECT(0, Null, string_null)
#include "effects.inc"
-ACCUMULATE_FUNCTION(RegisterEffects, RegisterEffects_Done);
+ACCUMULATE_FUNCTION(RegisterEffects, RegisterEffects_Done)
#endif
[[accumulate]] void RegisterCallbacks() { CALLBACK_##name = NEW(Callback, func); }
#define MUTATOR_HOOKFUNCTION(...) \
- OVERLOAD(MUTATOR_HOOKFUNCTION, __VA_ARGS__)
+ EVAL(OVERLOAD(MUTATOR_HOOKFUNCTION, __VA_ARGS__))
#define MUTATOR_HOOKFUNCTION_1(name) \
_MUTATOR_CALLBACK(name, HOOKFUNCTION_##name) \
bool HOOKFUNCTION_##name()
#define MUTATOR_HOOKFUNCTION_2(mut, cb) \
- MUTATOR_HOOKFUNCTION(mut, cb, CBC_ORDER_ANY)
+ MUTATOR_HOOKFUNCTION_3(mut, cb, CBC_ORDER_ANY)
#define MUTATOR_HOOKFUNCTION_3(mut, cb, order) \
_MUTATOR_CALLBACK(mut##_##cb, mut##_##cb) \
}
ENDCLASS(Nade)
-REGISTER_NADE(NULL);
+REGISTER_NADE(Null);
#define NADE_PROJECTILE(i, projectile, trail) do { \
this.m_projectile[i] = projectile; \
if (it.m_projectile[j] == proj) return it;
}
));
- return NADE_TYPE_NULL;
+ return NADE_TYPE_Null;
}
string Nade_TrailEffect(float proj, float nade_team)
{
// check supplied type and name for errors
string checkargs = "";
- #define CHECKARG_TYPENAME(type) case MSG_##type##: \
+ #define CHECKARG_TYPENAME(type) case MSG_##type: \
{ if(!net_name || (net_name > NOTIF_##type##_COUNT)) \
{ checkargs = sprintf("Improper name: %d!", net_name); } break; }
switch(net_type)
NO_MSG, /* optiona */ \
NO_MSG); /* optionb */ \
} \
- ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name);
+ ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name)
#define MSG_INFO_NOTIF(default,name,strnum,flnum,args,hudargs,icon,normal,gentle) \
NOTIF_ADD_AUTOCVAR(name, default) \
NO_MSG, /* optiona */ \
NO_MSG); /* optionb */ \
} \
- ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name);
+ ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name)
.string nent_iconargs;
#define MULTIICON_INFO(default,name,strnum,flnum,args,hudargs,iconargs,icon,normal,gentle) \
NO_MSG); /* optionb */ \
msg_info_notifs[name - 1].nent_iconargs = iconargs; \
} \
- ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name);
+ ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name)
#define MSG_CENTER_NOTIF(default,name,strnum,flnum,args,cpid,durcnt,normal,gentle) \
NOTIF_ADD_AUTOCVAR(name, default) \
NO_MSG, /* optiona */ \
NO_MSG); /* optionb */ \
} \
- ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name);
+ ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name)
#define MSG_MULTI_NOTIF(default,name,anncename,infoname,centername) \
NOTIF_ADD_AUTOCVAR(name, default) \
NO_MSG, /* optiona */ \
NO_MSG); /* optionb */ \
} \
- ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name);
+ ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name)
#define ACVNN(name) autocvar_notification_##name
optiona, /* optiona */ \
optionb); /* optionb */ \
} \
- ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name);
+ ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotification_##name)
void RegisterNotifications_First()
{
}
// NOW we actually activate the declarations
-ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotifications_First);
+ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotifications_First)
#include "notifications.inc"
-ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotifications_Done);
+ACCUMULATE_FUNCTION(RegisterNotifications, RegisterNotifications_Done)
#endif
{
if(Physics_Valid(pl.cvar_cl_physics))
{
- string var = sprintf("g_physics_%s_%s", pl.cvar_cl_physics, option);
- if(cvar_type(var) & CVAR_TYPEFLAG_EXISTS)
- return cvar(var);
+ string s = sprintf("g_physics_%s_%s", pl.cvar_cl_physics, option);
+ if(cvar_type(s) & CVAR_TYPEFLAG_EXISTS)
+ return cvar(s);
}
if(autocvar_g_physics_clientselect && autocvar_g_physics_clientselect_default)
{
- string var = sprintf("g_physics_%s_%s", autocvar_g_physics_clientselect_default, option);
- if(cvar_type(var) & CVAR_TYPEFLAG_EXISTS)
- return cvar(var);
+ string s = sprintf("g_physics_%s_%s", autocvar_g_physics_clientselect_default, option);
+ if(cvar_type(s) & CVAR_TYPEFLAG_EXISTS)
+ return cvar(s);
}
return cvar(strcat("sv_", option));
}
#endif
#ifdef CSQC
-/*
- * FIXME - crypto_* builtin functions missing in CSQC (csprogsdefs.qh:885)
+// FIXME - crypto_* builtin functions missing in CSQC (csprogsdefs.qh:885)
void PlayerInfo_Details()
{
print("-- Getting detailed PlayerInfo for local player (CSQC)\n");
#include "../../../server/g_subs.qh"
#include "../../../server/g_damage.qh"
#include "../../../server/bot/bot.qh"
-#include "../../common/csqcmodel_settings.qh"
+#include "../../../common/csqcmodel_settings.qh"
#include "../../../csqcmodellib/sv_model.qh"
#include "../../../server/weapons/common.qh"
destangle_x = -destangle_x; // flip up / down orientation
// take the shortest distance for the angles
- SUB_ANGLES(self.owner)_x -= 360 * floor((SUB_ANGLES(self.owner)_x - destangle_x) / 360 + 0.5);
- SUB_ANGLES(self.owner)_y -= 360 * floor((SUB_ANGLES(self.owner)_y - destangle_y) / 360 + 0.5);
- SUB_ANGLES(self.owner)_z -= 360 * floor((SUB_ANGLES(self.owner)_z - destangle_z) / 360 + 0.5);
+ vector v = SUB_ANGLES(self.owner);
+ v.x -= 360 * floor((v.x - destangle_x) / 360 + 0.5);
+ v.y -= 360 * floor((v.y - destangle_y) / 360 + 0.5);
+ v.z -= 360 * floor((v.z - destangle_z) / 360 + 0.5);
+ SUB_ANGLES(self.owner) = v;
angloc = destangle - SUB_ANGLES(self.owner);
angloc = angloc * (1 / PHYS_INPUT_FRAMETIME); // so it arrives for the next frame
self.owner.SUB_AVELOCITY = angloc;
string snd;
if(substring(self.noise, 0, 1) == "*")
{
- var .string sample;
- sample = GetVoiceMessageSampleField(substring(self.noise, 1, -1));
+ var .string sample = GetVoiceMessageSampleField(substring(self.noise, 1, -1));
if(GetPlayerSoundSampleField_notFound)
snd = "misc/null.wav";
- else if(activator.sample == "")
+ else if(activator.(sample) == "")
snd = "misc/null.wav";
else
{
- tokenize_console(activator.sample);
+ tokenize_console(activator.(sample));
float n;
n = stof(argv(1));
if(n > 0)
string snd;
if(substring(self.noise, 0, 1) == "*")
{
- var .string sample;
- sample = GetVoiceMessageSampleField(substring(self.noise, 1, -1));
+ var .string sample = GetVoiceMessageSampleField(substring(self.noise, 1, -1));
if(GetPlayerSoundSampleField_notFound)
snd = "misc/null.wav";
- else if(activator.sample == "")
+ else if(activator.(sample) == "")
snd = "misc/null.wav";
else
{
- tokenize_console(activator.sample);
+ tokenize_console(activator.(sample));
float n;
n = stof(argv(1));
if(n > 0)
float tur_config_file;
float tur_config_alsoprint;
-#define MAX_TUR_CONFIG 256
+const int MAX_TUR_CONFIG = 256;
float TUR_CONFIG_COUNT;
string tur_config_queue[MAX_TUR_CONFIG];
-#define TUR_CONFIG_QUEUE(a) { \
- tur_config_queue[TUR_CONFIG_COUNT] = a; \
- ++TUR_CONFIG_COUNT; }
-
#define TUR_CONFIG_WRITETOFILE(a) { \
fputs(tur_config_file, a); \
if(tur_config_alsoprint) { LOG_INFO(a); } }
-#define TUR_CONFIG_WRITE_CVARS(turret,name) \
- { TUR_CONFIG_QUEUE( \
- sprintf("set g_turrets_unit_%s_%s %g\n", #turret, #name, \
- cvar(sprintf("g_turrets_unit_%s_%s", #turret, #name)))) } \
-
-#define TUR_CONFIG_SETTINGS(tursettings) \
- #define TUR_ADD_CVAR(turret,name) TUR_CONFIG_WRITE_CVARS(turret,name) \
- tursettings \
- #undef TUR_ADD_CVAR
#endif
void register_turrets_done();
const float TUR_MAXCOUNT = 24;
-#define TUR_FIRST 1
+const int TUR_FIRST = 1;
float TUR_COUNT;
float TUR_LAST;
REGISTER_TURRET_2(TUR_##id,func,turretflags,min_s,max_s,modelname,headmodelname,shortname,mname)
#endif
-#define TUR_DUPECHECK(dupecheck,cvar) \
- #ifndef dupecheck \
- #define dupecheck \
- float cvar; \
- #else \
- #error DUPLICATE TURRET CVAR: cvar \
- #endif
-
-#define TUR_ADD_CVAR(turret,name) \
- TUR_DUPECHECK(TUR_CVAR_##turret##_##name, autocvar_g_turrets_unit_##turret##_##name)
-
-#define TUR_CVAR(turret,name) autocvar_g_turrets_unit_##turret##_##name
-
#include "all.qh"
-#undef TUR_ADD_CVAR
#undef REGISTER_TURRET
-ACCUMULATE_FUNCTION(RegisterTurrets, register_turrets_done);
+ACCUMULATE_FUNCTION(RegisterTurrets, register_turrets_done)
#endif
#ifndef QCC_SUPPORT_NIL
#ifdef GMQCC
- #define QCC_SUPPORT_NIL
+ #define QCC_SUPPORT_NIL 1
#endif
#endif
#define FOREACH(list, cond, body) FOREACH_LIST(list, enemy, cond, body)
#ifdef GMQCC
- #define OVERLOAD(F, ...) F##_##__VA_COUNT__(__VA_ARGS__)
+ #define EVAL(...) __VA_ARGS__
+
+ #define OVERLOAD_(F, ...) F##_##__VA_COUNT__(__VA_ARGS__)
+ #define OVERLOAD(F, ...) F##_##__VA_COUNT__(__VA_ARGS__)
#else
- #define OVERLOAD_(F,_9,_8,_7,_6,_5,_4,_3,_2,_1,n,...) F##_##n
- #define OVERLOAD(F, ...) OVERLOAD_(F,__VA_ARGS__,9,8,7,6,5,4,3,2,1)(__VA_ARGS__)
+ #define EMPTY()
+ #define DEFER(id) id EMPTY()
+
+ #define EVAL(...) EVAL1(EVAL1(EVAL1(__VA_ARGS__)))
+ #define EVAL1(...) EVAL2(EVAL2(EVAL2(__VA_ARGS__)))
+ #define EVAL2(...) EVAL3(EVAL3(EVAL3(__VA_ARGS__)))
+ #define EVAL3(...) EVAL4(EVAL4(EVAL4(__VA_ARGS__)))
+ #define EVAL4(...) EVAL5(EVAL5(EVAL5(__VA_ARGS__)))
+ #define EVAL5(...) __VA_ARGS__
+
+ #define OVERLOAD___(F,_16,_15,_14,_13,_12,_11,_10,_9,_8,_7,_6,_5,_4,_3,_2,_1,n,...) F##_##n
+ #define OVERLOAD__(F, ...) OVERLOAD___(F,##__VA_ARGS__,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0)
+ #define OVERLOAD_(...) DEFER(OVERLOAD__(__VA_ARGS__))
+ #define OVERLOAD(F, ...) OVERLOAD_(F,##__VA_ARGS__)(__VA_ARGS__)
#endif
#define LAMBDA(...) { __VA_ARGS__ ; }
-#define MAP(f, ...) OVERLOAD(MAP, f, __VA_ARGS__)
+#define MAP(f, ...) EVAL(OVERLOAD(MAP, f, __VA_ARGS__))
#define MAP_2(f, it) f(it)
#define MAP_3(f, it, ...) f(it)MAP_2(f, __VA_ARGS__)
#define MAP_4(f, it, ...) f(it)MAP_3(f, __VA_ARGS__)
entity get_vehicleinfo(int id)
{
- if (id < VEH_FIRST || id > VEH_LAST) return VEH_NULL;
+ if (id < VEH_FIRST || id > VEH_LAST) return VEH_Null;
entity m = vehicle_info[id];
- return m ? m : VEH_NULL;
+ return m ? m : VEH_Null;
}
#endif
REGISTER_INIT(VEH, id)
REGISTER_REGISTRY(RegisterVehicles)
-REGISTER_VEHICLE(NULL, Vehicle);
+REGISTER_VEHICLE(Null, Vehicle);
#include "all.inc"
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(self.(regen_field) < field_max)
if(timer + rpause < time)
{
if(_healthscale)
regen = regen * (self.vehicle_health / self.max_health);
- self.regen_field = min(self.regen_field + regen * delta_time, field_max);
+ self.(regen_field) = min(self.(regen_field) + regen * delta_time, field_max);
if(self.owner)
- self.owner.regen_field = (self.regen_field / field_max) * 100;
+ self.owner.(regen_field) = (self.(regen_field) / field_max) * 100;
}
}
#undef WEP_ADD_CVAR
#undef WEP_ADD_PROP
void register_weapons_done();
-ACCUMULATE_FUNCTION(RegisterWeapons, register_weapons_done);
+ACCUMULATE_FUNCTION(RegisterWeapons, register_weapons_done)
#endif
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
-#include "../triggers/trigger/jumppads.qh"
+#include "../../triggers/trigger/jumppads.qh"
void spawnfunc_weapon_porto(void) { weapon_defaultspawnfunc(WEP_PORTO.m_id); }
+++ /dev/null
-#ifndef ACCUMULATE_H
-#define ACCUMULATE_H
-
-#ifdef QCC_SUPPORT_ACCUMULATE
-# define ACCUMULATE_FUNCTION(func, otherfunc) \
- [[accumulate]] void func() { otherfunc(); }
-# define CALL_ACCUMULATED_FUNCTION(func) \
- func()
-#else
-#ifdef HAVE_YO_DAWG_CPP
-// TODO make ascii art pic of xzibit
-// YO DAWG!
-// I HERD YO LIEK MACROS
-// SO I PUT A MACRO DEFINITION IN YO MACRO DEFINITION
-// SO YO CAN EXPAND MACROS WHILE YO EXPAND MACROS
-# define ACCUMULATE_FUNCTION(func,otherfunc) \
- #ifdef func \
- void __merge__##otherfunc() { func(); otherfunc(); } \
- #undef func \
- #define func __merge__##otherfunc \
- #else \
- #define func otherfunc \
- #endif
-# define CALL_ACCUMULATED_FUNCTION(func) \
- func()
-#else
-# define ACCUMULATE_FUNCTION(func,otherfunc) \
- .float _ACCUMULATE_##func##__##otherfunc
-void ACCUMULATE_call(string func)
-{
- float i;
- float n = numentityfields();
- string funcprefix = strcat("_ACCUMULATE_", func, "__");
- float funcprefixlen = strlen(funcprefix);
- for(i = 0; i < n; ++i)
- {
- string name = entityfieldname(i);
- if(substring(name, 0, funcprefixlen) == funcprefix)
- callfunction(substring(name, funcprefixlen, -1));
- }
-}
-# define CALL_ACCUMULATED_FUNCTION(func) \
- ACCUMULATE_call(#func)
-#endif
-#endif
-
-// used for simplifying ACCUMULATE_FUNCTIONs
-#define SET_FIRST_OR_LAST(input,first,count) if(!input) { input = (first + count); }
-#define SET_FIELD_COUNT(field,first,count) if(!field) { field = (first + count); ++count; }
-#define CHECK_MAX_COUNT(name,max,count,type) if(count > max) { error(strcat("Maximum ", type, " hit: ", #name, ": ", ftos(count), ".\n")); }
-
-#endif
+++ /dev/null
-#ifndef BOOL_H
-#define BOOL_H
-
-#ifndef QCC_SUPPORT_BOOL
- #define bool float
-
- // Boolean Constants
- const int true = 1;
- const int false = 0;
-#endif
-
-// Transitional aliases
-[[deprecated("use true")]] [[alias("true")]] const bool TRUE;
-[[deprecated("use false")]] [[alias("false")]] const bool FALSE;
-
-// get true/false value of a string with multiple different inputs
-float InterpretBoolean(string input)
-{
- switch (strtolower(input))
- {
- case "yes":
- case "true":
- case "on":
- return true;
-
- case "no":
- case "false":
- case "off":
- return false;
-
- default: return stof(input);
- }
-}
-
-float boolean(float value) { // if value is 0 return false (0), otherwise return true (1)
- return (value == 0) ? false : true;
-}
-
-#endif
+++ /dev/null
-#ifndef COUNTING_H
-#define COUNTING_H
-
-#include "I18N.qh"
-
-// ===============================================
-// Time processing and counting functions/macros
-// ===============================================
-
-#define count_years_decs(time,decs) sprintf(ZCTX(_("CI_DEC^%s years")), ftos_decimals(time, decs))
-#define count_years(time) count_fill(time, \
- ZCTX(_("CI_ZER^%d years")), /* zeroth */ \
- ZCTX(_("CI_FIR^%d year")), /* first */ \
- ZCTX(_("CI_SEC^%d years")), /* year */ \
- ZCTX(_("CI_THI^%d years")), /* third */ \
- ZCTX(_("CI_MUL^%d years"))) /* multi */
-
-#define count_weeks_decs(time,decs) sprintf(ZCTX(_("CI_DEC^%s weeks")), ftos_decimals(time, decs))
-#define count_weeks(time) count_fill(time, \
- ZCTX(_("CI_ZER^%d weeks")), /* zeroth */ \
- ZCTX(_("CI_FIR^%d week")), /* first */ \
- ZCTX(_("CI_SEC^%d weeks")), /* week */ \
- ZCTX(_("CI_THI^%d weeks")), /* third */ \
- ZCTX(_("CI_MUL^%d weeks"))) /* multi */
-
-#define count_days_decs(time,decs) sprintf(ZCTX(_("CI_DEC^%s days")), ftos_decimals(time, decs))
-#define count_days(time) count_fill(time, \
- ZCTX(_("CI_ZER^%d days")), /* zeroth */ \
- ZCTX(_("CI_FIR^%d day")), /* first */ \
- ZCTX(_("CI_SEC^%d days")), /* day */ \
- ZCTX(_("CI_THI^%d days")), /* third */ \
- ZCTX(_("CI_MUL^%d days"))) /* multi */
-
-#define count_hours_decs(time,decs) sprintf(ZCTX(_("CI_DEC^%s hours")), ftos_decimals(time, decs))
-#define count_hours(time) count_fill(time, \
- ZCTX(_("CI_ZER^%d hours")), /* zeroth */ \
- ZCTX(_("CI_FIR^%d hour")), /* first */ \
- ZCTX(_("CI_SEC^%d hours")), /* hour */ \
- ZCTX(_("CI_THI^%d hours")), /* third */ \
- ZCTX(_("CI_MUL^%d hours"))) /* multi */
-
-
-#define count_minutes_decs(time,decs) sprintf(ZCTX(_("CI_DEC^%s minutes")), ftos_decimals(time, decs))
-#define count_minutes(time) count_fill(time, \
- ZCTX(_("CI_ZER^%d minutes")), /* zeroth */ \
- ZCTX(_("CI_FIR^%d minute")), /* first */ \
- ZCTX(_("CI_SEC^%d minutes")), /* minute */ \
- ZCTX(_("CI_THI^%d minutes")), /* third */ \
- ZCTX(_("CI_MUL^%d minutes"))) /* multi */
-
-#define count_seconds_decs(time,decs) sprintf(ZCTX(_("CI_DEC^%s seconds")), ftos_decimals(time, decs))
-#define count_seconds(time) count_fill(time, \
- ZCTX(_("CI_ZER^%d seconds")), /* zeroth */ \
- ZCTX(_("CI_FIR^%d second")), /* first */ \
- ZCTX(_("CI_SEC^%d seconds")), /* second */ \
- ZCTX(_("CI_THI^%d seconds")), /* third */ \
- ZCTX(_("CI_MUL^%d seconds"))) /* multi */
-
-string count_ordinal(int interval)
-{
- // This function is designed primarily for the English language, it's impossible
- // to accomodate all languages unless we do a specific function for each one...
- // and since that's not technically feasible/practical, this is all we've got folks.
-
- // Basically, it just allows you to represent a number or count in different ways
- // depending on the number... like, with count_ordinal you can provide integers
- // and retrieve 1st, 2nd, 3rd, nth ordinal numbers in a clean and simple way.
- if(floor((interval % 100)/10) * 10 != 10) // examples: 12th, 111th, 213th will not execute this block
- {
- // otherwise, check normally for 1st,2nd,3rd insertions
- switch(interval % 10)
- {
- case 1: return sprintf(_("%dst"), interval);
- case 2: return sprintf(_("%dnd"), interval);
- case 3: return sprintf(_("%drd"), interval);
- default: return sprintf(_("%dth"), interval);
- }
- }
- else { return sprintf(_("%dth"), interval); }
-
- return "";
-}
-
-string count_fill(float interval, string zeroth, string first, string second, string third, string multi)
-{
- // This function is designed primarily for the English language, it's impossible
- // to accomodate all languages unless we do a specific function for each one...
- // and since that's not technically feasible/practical, this is all we've got folks.
-
- // Here you can insert specific strings based on the interval number, so you could do
- // i.e. count_seconds which outputs like this:
- // 0 seconds
- // 1 second
- // 2 seconds
- // 3 seconds
- // etc... minutes, hours, days, etc.
-
- switch(floor(interval))
- {
- case 0: return sprintf(zeroth, interval);
- case 1:
- {
- if(interval == 1) // EXACTLY value of 1
- return sprintf(first, interval);
- else
- return sprintf(multi, interval);
- }
- case 2: return sprintf(second, interval);
- case 3: return sprintf(third, interval);
- default: return sprintf(multi, interval);
- }
- return "";
-}
-
-string process_time(float outputtype, float seconds)
-{
- float tmp_hours = 0, tmp_minutes = 0, tmp_seconds = 0;
- float tmp_years = 0, tmp_weeks = 0, tmp_days = 0;
-
- tmp_seconds = floor(seconds);
-
- if(tmp_seconds)
- {
- tmp_minutes = floor(tmp_seconds / 60);
-
- if(tmp_minutes)
- {
- tmp_seconds -= (tmp_minutes * 60);
- tmp_hours = floor(tmp_minutes / 60);
-
- if(tmp_hours)
- {
- tmp_minutes -= (tmp_hours * 60);
- tmp_days = floor(tmp_hours / 24);
-
- if(tmp_days)
- {
- tmp_hours -= (tmp_days * 24);
- tmp_weeks = floor(tmp_days / 7);
-
- if(tmp_weeks)
- {
- tmp_days -= (tmp_weeks * 7);
- tmp_years = floor(tmp_weeks / 52);
- }
- }
- }
- }
- }
-
- switch(outputtype)
- {
- case 1: return sprintf("%02d:%02d:%02d", tmp_hours, tmp_minutes, tmp_seconds);
- case 2:
- {
- string output = "";
-
- output = count_seconds(tmp_seconds);
-
- if(tmp_minutes)
- {
- output = sprintf(
- "%s%s",
- count_minutes(tmp_minutes),
- ((output != "") ? sprintf(", %s", output) : ""));
- }
-
- if(tmp_hours)
- {
- output = sprintf(
- "%s%s",
- count_hours(tmp_hours),
- ((output != "") ? sprintf(", %s", output) : ""));
- }
-
- if(tmp_days)
- {
- output = sprintf(
- "%s%s",
- count_days(tmp_days),
- ((output != "") ? sprintf(", %s", output) : ""));
- }
-
- if(tmp_weeks)
- {
- output = sprintf(
- "%s%s",
- count_weeks(tmp_weeks),
- ((output != "") ? sprintf(", %s", output) : ""));
- }
-
- if(tmp_years)
- {
- output = sprintf(
- "%s%s",
- count_years(tmp_years),
- ((output != "") ? sprintf(", %s", output) : ""));
- }
-
- return output;
- }
- case 3:
- {
- string output = "";
-
- output = count_hours(tmp_hours);
-
- if(tmp_weeks) { tmp_days += (tmp_weeks * 7); }
- if(tmp_years) { tmp_days += (tmp_years * 365); }
- if(tmp_days)
- {
- output = sprintf(
- "%s%s",
- count_days(tmp_days),
- ((output != "") ? sprintf(", %s", output) : ""));
- }
-
- return output;
- }
- }
- return "";
-}
-#endif
+++ /dev/null
-#ifndef CVAR_H
-#define CVAR_H
-
-#include "Static.qh"
-
-void RegisterCvars(void(string name, string desc, bool archive, string file) f) { }
-
-void RegisterCvars_Set(string name, string desc, bool archive, string file)
-{
- localcmd(sprintf("\n%1$s %2$s \"$%2$s\" \"%3$s\"\n", (archive ? "seta" : "set"), name, desc));
-}
-
-STATIC_INIT_LATE(Cvars) { RegisterCvars(RegisterCvars_Set); }
-
-#define AUTOCVAR_5(file, archive, var, type, desc) \
- [[accumulate]] void RegisterCvars(void(string, string, bool, string) f) { f(#var, desc, archive, file); } \
- type autocvar_##var
-#define AUTOCVAR_6(file, archive, var, type, default, desc) \
- AUTOCVAR_5(file, archive, var, type, desc) = default
-#define _AUTOCVAR(...) OVERLOAD(AUTOCVAR, __FILE__, __VA_ARGS__)
-#define AUTOCVAR_SAVE(...) _AUTOCVAR(true, __VA_ARGS__)
-#define AUTOCVAR(...) _AUTOCVAR(false, __VA_ARGS__)
-
-#endif
+++ /dev/null
-#ifndef MENUQC
-#ifndef DEFER_H
-#define DEFER_H
-#include "OO.qh"
-
-entityclass(Defer);
-class(Defer) .entity owner;
-class(Defer) .void() think;
-class(Defer) .float nextthink;
-
-/*
-==================
-SUB_Remove
-
-Remove self
-==================
-*/
-void SUB_Remove()
-{SELFPARAM();
- remove (self);
-}
-
-void defer_think()
-{SELFPARAM();
- self.think = SUB_Remove;
- self.nextthink = time;
- WITH(entity, self, self.owner, self.use());
-}
-
-/*
- Execute func() after time + fdelay.
- self when func is executed = self when defer is called
-*/
-void defer(float fdelay, void() func)
-{SELFPARAM();
- entity e;
-
- e = spawn();
- e.owner = self;
- e.use = func;
- e.think = defer_think;
- e.nextthink = time + fdelay;
-}
-
-#endif
-#endif
+++ /dev/null
-#ifdef CSQC
-#ifndef DRAW_H
-#define DRAW_H
-
-#include "I18N.qh"
-#include "Vector.qh"
-
-#include "../client/defs.qh"
-
-void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float theAlpha, float drawflag, vector vieworg)
-{
- // I want to draw a quad...
- // from and to are MIDPOINTS.
-
- vector axis, thickdir, A, B, C, D;
- float length_tex;
-
- axis = normalize(to - from);
- length_tex = aspect * vlen(to - from) / thickness;
-
- // direction is perpendicular to the view normal, and perpendicular to the axis
- thickdir = normalize(cross(axis, vieworg - from));
-
- A = from - thickdir * (thickness / 2);
- B = from + thickdir * (thickness / 2);
- C = to + thickdir * (thickness / 2);
- D = to - thickdir * (thickness / 2);
-
- R_BeginPolygon(texture, drawflag);
- R_PolygonVertex(A, '0 0 0' + shift * '1 0 0', rgb, theAlpha);
- R_PolygonVertex(B, '0 1 0' + shift * '1 0 0', rgb, theAlpha);
- R_PolygonVertex(C, '0 1 0' + (shift + length_tex) * '1 0 0', rgb, theAlpha);
- R_PolygonVertex(D, '0 0 0' + (shift + length_tex) * '1 0 0', rgb, theAlpha);
- R_EndPolygon();
-}
-
-// a border picture is a texture containing nine parts:
-// 1/4 width: left part
-// 1/2 width: middle part (stretched)
-// 1/4 width: right part
-// divided into
-// 1/4 height: top part
-// 1/2 height: middle part (stretched)
-// 1/4 height: bottom part
-void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector theColor, float theAlpha, vector theBorderSize)
-{
- if (theBorderSize.x < 0 && theBorderSize.y < 0) // draw whole image as it is
- {
- drawpic(theOrigin, pic, theSize, theColor, theAlpha, 0);
- return;
- }
- if (theBorderSize.x == 0 && theBorderSize.y == 0) // no border
- {
- // draw only the central part
- drawsubpic(theOrigin, theSize, pic, '0.25 0.25 0', '0.5 0.5 0', theColor, theAlpha, 0);
- return;
- }
-
- vector dX, dY;
- vector width, height;
- vector bW, bH;
- //pic = draw_UseSkinFor(pic);
- width = eX * theSize.x;
- height = eY * theSize.y;
- if(theSize.x <= theBorderSize.x * 2)
- {
- // not wide enough... draw just left and right then
- bW = eX * (0.25 * theSize.x / (theBorderSize.x * 2));
- if(theSize.y <= theBorderSize.y * 2)
- {
- // not high enough... draw just corners
- bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2));
- drawsubpic(theOrigin, width * 0.5 + height * 0.5, pic, '0 0 0', bW + bH, theColor, theAlpha, 0);
- drawsubpic(theOrigin + width * 0.5, width * 0.5 + height * 0.5, pic, eX - bW, bW + bH, theColor, theAlpha, 0);
- drawsubpic(theOrigin + height * 0.5, width * 0.5 + height * 0.5, pic, eY - bH, bW + bH, theColor, theAlpha, 0);
- drawsubpic(theOrigin + theSize * 0.5, width * 0.5 + height * 0.5, pic, eX + eY - bW - bH, bW + bH, theColor, theAlpha, 0);
- }
- else
- {
- dY = theBorderSize.x * eY;
- drawsubpic(theOrigin, width * 0.5 + dY, pic, '0 0 0', '0 0.25 0' + bW, theColor, theAlpha, 0);
- drawsubpic(theOrigin + width * 0.5, width * 0.5 + dY, pic, '0 0 0' + eX - bW, '0 0.25 0' + bW, theColor, theAlpha, 0);
- drawsubpic(theOrigin + dY, width * 0.5 + height - 2 * dY, pic, '0 0.25 0', '0 0.5 0' + bW, theColor, theAlpha, 0);
- drawsubpic(theOrigin + width * 0.5 + dY, width * 0.5 + height - 2 * dY, pic, '0 0.25 0' + eX - bW, '0 0.5 0' + bW, theColor, theAlpha, 0);
- drawsubpic(theOrigin + height - dY, width * 0.5 + dY, pic, '0 0.75 0', '0 0.25 0' + bW, theColor, theAlpha, 0);
- drawsubpic(theOrigin + width * 0.5 + height - dY, width * 0.5 + dY, pic, '0 0.75 0' + eX - bW, '0 0.25 0' + bW, theColor, theAlpha, 0);
- }
- }
- else
- {
- if(theSize.y <= theBorderSize.y * 2)
- {
- // not high enough... draw just top and bottom then
- bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2));
- dX = theBorderSize.x * eX;
- drawsubpic(theOrigin, dX + height * 0.5, pic, '0 0 0', '0.25 0 0' + bH, theColor, theAlpha, 0);
- drawsubpic(theOrigin + dX, width - 2 * dX + height * 0.5, pic, '0.25 0 0', '0.5 0 0' + bH, theColor, theAlpha, 0);
- drawsubpic(theOrigin + width - dX, dX + height * 0.5, pic, '0.75 0 0', '0.25 0 0' + bH, theColor, theAlpha, 0);
- drawsubpic(theOrigin + height * 0.5, dX + height * 0.5, pic, '0 0 0' + eY - bH, '0.25 0 0' + bH, theColor, theAlpha, 0);
- drawsubpic(theOrigin + dX + height * 0.5, width - 2 * dX + height * 0.5, pic, '0.25 0 0' + eY - bH, '0.5 0 0' + bH, theColor, theAlpha, 0);
- drawsubpic(theOrigin + width - dX + height * 0.5, dX + height * 0.5, pic, '0.75 0 0' + eY - bH, '0.25 0 0' + bH, theColor, theAlpha, 0);
- }
- else
- {
- dX = theBorderSize.x * eX;
- dY = theBorderSize.x * eY;
- drawsubpic(theOrigin, dX + dY, pic, '0 0 0', '0.25 0.25 0', theColor, theAlpha, 0);
- drawsubpic(theOrigin + dX, width - 2 * dX + dY, pic, '0.25 0 0', '0.5 0.25 0', theColor, theAlpha, 0);
- drawsubpic(theOrigin + width - dX, dX + dY, pic, '0.75 0 0', '0.25 0.25 0', theColor, theAlpha, 0);
- drawsubpic(theOrigin + dY, dX + height - 2 * dY, pic, '0 0.25 0', '0.25 0.5 0', theColor, theAlpha, 0);
- drawsubpic(theOrigin + dY + dX, width - 2 * dX + height - 2 * dY, pic, '0.25 0.25 0', '0.5 0.5 0', theColor, theAlpha, 0);
- drawsubpic(theOrigin + dY + width - dX, dX + height - 2 * dY, pic, '0.75 0.25 0', '0.25 0.5 0', theColor, theAlpha, 0);
- drawsubpic(theOrigin + height - dY, dX + dY, pic, '0 0.75 0', '0.25 0.25 0', theColor, theAlpha, 0);
- drawsubpic(theOrigin + height - dY + dX, width - 2 * dX + dY, pic, '0.25 0.75 0', '0.5 0.25 0', theColor, theAlpha, 0);
- drawsubpic(theOrigin + height - dY + width - dX, dX + dY, pic, '0.75 0.75 0', '0.25 0.25 0', theColor, theAlpha, 0);
- }
- }
-}
-
-void drawstringright(vector position, string text, vector theScale, vector rgb, float theAlpha, int flag)
-{
- position.x -= 2 / 3 * strlen(text) * theScale.x;
- drawstring(position, text, theScale, rgb, theAlpha, flag);
-}
-
-void drawstringcenter(vector position, string text, vector theScale, vector rgb, float theAlpha, int flag)
-{
- position.x = 0.5 * (vid_conwidth - 0.6025 * strlen(text) * theScale.x);
- drawstring(position, text, theScale, rgb, theAlpha, flag);
-}
-
-#endif
-#endif
+++ /dev/null
-#ifndef I18N_H
-#define I18N_H
-
-// translation helpers
-string prvm_language;
-
-string language_filename(string s)
-{
- string fn = prvm_language;
- if (fn == "" || fn == "dump")
- return s;
- fn = strcat(s, ".", fn);
- int fh = fopen(fn, FILE_READ);
- if (fh >= 0)
- {
- fclose(fh);
- return fn;
- }
- return s;
-}
-
-string CTX(string s)
-{
- int p = strstrofs(s, "^", 0);
- if (p < 0)
- return s;
- return substring(s, p + 1, -1);
-}
-
-#define ZCTX(s) strzone(CTX(s))
-
-#endif
+++ /dev/null
-#ifndef LAZY_H
-#define LAZY_H
-
-#include "OO.qh"
-
-CLASS(Lazy, Object)
- ATTRIB(Lazy, m_get, entity(), func_null);
- CONSTRUCTOR(Lazy, entity() _compute) { this.m_get = _compute; }
-ENDCLASS(Lazy)
-
-#define LAZY(id) __lazy_##id
-#define LAZY_NEW(id, compute) entity LAZY(id)() { \
- static bool done; \
- static entity it; \
- if (!done) { it = compute; done = true; } \
- return it; \
-}
-#endif
+++ /dev/null
-#ifndef LOG_H
-#define LOG_H
-
-#define _printferr(...) error(sprintf(__VA_ARGS__))
-#define _printfbt(...) backtrace(sprintf(__VA_ARGS__))
-#define printf(...) print(sprintf(__VA_ARGS__))
-#define dprintf(...) dprint(sprintf(__VA_ARGS__))
-#define _dprintf2(...) do { if (autocvar_developer > 1) dprintf(__VA_ARGS__); } while (0)
-
-#define assert(expr, ...) do { if (!(expr)) LOG_WARNINGF(__VA_ARGS__); } while (0)
-
-#define _LOG(f, level, s) f("[::"level"] ["__FILE__":%s:%.0f] %s", __FUNC__, __LINE__, s)
-
-#define LOG_FATAL(...) _LOG_FATAL(strcat("", __VA_ARGS__))
-#define LOG_FATALF(...) _LOG_FATAL(sprintf(__VA_ARGS__))
-#define _LOG_FATAL(s) _LOG(_printferr, "FATAL", s)
-
-#define LOG_SEVERE(...) _LOG_SEVERE(strcat("", __VA_ARGS__))
-#define LOG_SEVEREF(...) _LOG_SEVERE(sprintf(__VA_ARGS__))
-#define _LOG_SEVERE(s) _LOG(_printfbt, "SEVERE", s)
-
-#define LOG_WARNING(...) _LOG_WARNING(strcat("", __VA_ARGS__))
-#define LOG_WARNINGF(...) _LOG_WARNING(sprintf(__VA_ARGS__))
-#define _LOG_WARNING(s) _LOG(printf, "WARNING", s)
-
-#define LOG_INFO(...) do { if (autocvar_developer) _LOG_INFO(strcat("", __VA_ARGS__)); else print (__VA_ARGS__); } while (0)
-#define LOG_INFOF(...) do { if (autocvar_developer) _LOG_INFO(sprintf(__VA_ARGS__)); else printf(__VA_ARGS__); } while (0)
-#define _LOG_INFO(s) _LOG(printf, "INFO", s)
-
-#define LOG_TRACE(...) _LOG_TRACE(strcat("", __VA_ARGS__))
-#define LOG_TRACEF(...) _LOG_TRACE(sprintf(__VA_ARGS__))
-#define _LOG_TRACE(s) _LOG(dprintf, "TRACE", s)
-
-#define LOG_DEBUG(...) _LOG_DEBUG(strcat("", __VA_ARGS__))
-#define LOG_DEBUGF(...) _LOG_DEBUG(sprintf(__VA_ARGS__))
-#define _LOG_DEBUG(s) _LOG(_dprintf2, "DEBUG", s)
-
-// TODO: this sucks, lets find a better way to do backtraces?
-#ifdef SVQC
-void builtin_remove(entity);
-#define _backtrace() builtin_remove(NULL)
-#else
-void remove(entity);
-#define _backtrace() remove(NULL)
-#endif
-
-noref int autocvar_developer;
-noref bool autocvar_prvm_backtraceforwarnings;
-
-#define backtrace(msg) do { \
- int dev = autocvar_developer; \
- bool war = autocvar_prvm_backtraceforwarnings; \
- cvar_set("developer", "1"); \
- cvar_set("prvm_backtraceforwarnings", "1"); \
- print("\n--- CUT HERE ---\n", msg, "\n"); \
- _backtrace(); \
- print("\n--- CUT UNTIL HERE ---\n"); \
- cvar_set("developer", ftos(dev)); \
- cvar_set("prvm_backtraceforwarnings", ftos(war)); \
-} while (0)
-
-#endif
+++ /dev/null
-#ifndef MATH_H
-#define MATH_H
-
-void mean_accumulate(entity e, .float a, .float c, float mean, float value, float weight)
-{
- if (weight == 0)
- return;
- if (mean == 0)
- e.(a) *= pow(value, weight);
- else
- e.(a) += pow(value, mean) * weight;
- e.(c) += weight;
-}
-
-float mean_evaluate(entity e, .float a, .float c, float mean)
-{
- if (e.(c) == 0)
- return 0;
- if (mean == 0)
- return pow(e.(a), 1.0 / e.(c));
- else
- return pow(e.(a) / e.(c), 1.0 / mean);
-}
-
-#define MEAN_ACCUMULATE(prefix,v,w) mean_accumulate(self,prefix##_accumulator,prefix##_count,prefix##_mean,v,w)
-#define MEAN_EVALUATE(prefix) mean_evaluate(self,prefix##_accumulator,prefix##_count,prefix##_mean)
-#define MEAN_DECLARE(prefix,m) float prefix##_mean = m; .float prefix##_count, prefix##_accumulator
-
-/*
-==================
-crandom
-
-Returns a random number between -1.0 and 1.0
-==================
-*/
-float crandom (void)
-{
- return 2 * (random () - 0.5);
-}
-
-
-/*
-==================
-Angc used for animations
-==================
-*/
-
-
-float angc (float a1, float a2)
-{
- float a;
-
- while (a1 > 180)
- a1 = a1 - 360;
- while (a1 < -179)
- a1 = a1 + 360;
-
- while (a2 > 180)
- a2 = a2 - 360;
- while (a2 < -179)
- a2 = a2 + 360;
-
- a = a1 - a2;
- while (a > 180)
- a = a - 360;
- while (a < -179)
- a = a + 360;
-
- return a;
-}
-
-float fsnap(float val,float fsize)
-{
- return rint(val / fsize) * fsize;
-}
-
-vector vsnap(vector point,float fsize)
-{
- vector vret;
-
- vret.x = rint(point.x / fsize) * fsize;
- vret.y = rint(point.y / fsize) * fsize;
- vret.z = ceil(point.z / fsize) * fsize;
-
- return vret;
-}
-
-vector lerpv(float t0, vector v0, float t1, vector v1, float t)
-{
- return v0 + (v1 - v0) * ((t - t0) / (t1 - t0));
-}
-
-#endif
+++ /dev/null
-#ifndef NIL_H
-#define NIL_H
-
-#ifdef QCC_SUPPORT_NIL
-#define func_null nil
-#define string_null nil
-#else
-// the NULL function
-var void func_null(void);
-string string_null;
-#endif
-
-#endif
+++ /dev/null
-#ifndef OO_H
-#define OO_H
-
-#include "Nil.qh"
-#include "Registry.qh"
-
-#ifdef MENUQC
- #define NULL (null_entity)
-#else
- #define NULL (world)
-#endif
-
-.string classname;
-/** Location entity was spawned from in source */
-.string sourceLocFile;
-.int sourceLocLine;
-entity _spawn();
-entity __spawn(string _classname, string _sourceFile, int _sourceLine) {
- entity this = _spawn();
- this.classname = _classname;
- this.sourceLocFile = _sourceFile;
- this.sourceLocLine = _sourceLine;
- return this;
-}
-
-
-
-#define entityclass(...) OVERLOAD(entityclass, __VA_ARGS__)
-#define entityclass_1(name) entityclass_2(name, Object)
-#ifndef QCC_SUPPORT_ENTITYCLASS
- #define entityclass_2(name, base) typedef entity name
- #define class(name)
- #define new(class) __spawn(#class, __FILE__, __LINE__)
-#else
- #define entityclass_2(name, base) entityclass name : base {}
- #define class(name) [[class(name)]]
- #define new(class) ((class) __spawn(#class, __FILE__, __LINE__))
-#endif
-
-// Classes have a `spawn##cname(entity)` constructor
-// The parameter is used across [[accumulate]] functions
-
-// Macro to hide this implementation detail
-#define NEW(cname, ...) \
- OVERLOAD(spawn##cname, new(cname), ##__VA_ARGS__)
-
-#define CONSTRUCT(cname, ...) \
- OVERLOAD(spawn##cname, this, ##__VA_ARGS__)
-
-#define CONSTRUCTOR(cname, ...) \
- cname OVERLOAD(spawn##cname, cname this, __VA_ARGS__) { return = this; } \
- [[accumulate]] cname OVERLOAD(spawn##cname, cname this, __VA_ARGS__)
-
-.string vtblname;
-.entity vtblbase;
-
-void RegisterClasses() { }
-STATIC_INIT(RegisterClasses) { RegisterClasses(); }
-
-#define VTBL(cname, base) \
- INIT_STATIC(cname); \
- entity cname##_vtbl; \
- void cname##_vtbl_init() { \
- cname e = new(vtbl); \
- spawn##cname##_static(e); \
- e.vtblname = #cname; \
- /* Top level objects refer to themselves */ \
- e.vtblbase = base##_vtbl ? base##_vtbl : e; \
- cname##_vtbl = e; \
- } \
- ACCUMULATE_FUNCTION(RegisterClasses, cname##_vtbl_init)
-
-#define INIT_STATIC(cname) [[accumulate]] void spawn##cname##_static(cname this)
-#define INIT(cname) [[accumulate]] cname spawn##cname##_1(cname this)
-
-#define CLASS(cname, base) \
- entityclass(cname, base); \
- class(cname) .bool instanceOf##cname; \
- VTBL(cname, base) \
- INIT_STATIC(cname) { \
- if (cname##_vtbl) { \
- copyentity(cname##_vtbl, this); \
- return; \
- } \
- spawn##base##_static(this); \
- this.instanceOf##cname = true; \
- } \
- INIT(cname) { \
- /* Only statically initialize the current class, it contains everything it inherits */ \
- if (cname##_vtbl.vtblname == this.classname) { \
- spawn##cname##_static(this); \
- this.classname = #cname; \
- this.vtblname = string_null; \
- this.vtblbase = cname##_vtbl; \
- } \
- spawn##base##_1(this); \
- }
-
-#define METHOD(cname, name, prototype) \
- class(cname) .prototype name; \
- prototype cname##_##name; \
- INIT_STATIC(cname) { this.name = cname##_##name; } \
- prototype cname##_##name
-
-#define ATTRIB(cname, name, type, val) \
- class(cname) .type name; \
- INIT(cname) { this.name = val; }
-
-#define ATTRIBARRAY(cname, name, type, cnt) \
- class(cname) .type name[cnt];
-
-#define ENDCLASS(cname) \
- [[last]] INIT(cname) { return this; }
-
-#define SUPER(cname) (cname##_vtbl.vtblbase)
-#define super (this.vtblbase.vtblbase)
-
-#define spawn_static(this)
-#define spawn_1(this)
-#define _vtbl NULL
-CLASS(Object, );
- METHOD(Object, describe, string(entity this)) {
- string s = _("No description");
- if (cvar("developer")) {
- for (int i = 0, n = numentityfields(); i < n; ++i) {
- string value = getentityfieldstring(i, this);
- if (value != "") s = sprintf("%s\n%s = %s", s, entityfieldname(i), value);
- }
- }
- return s;
- }
- METHOD(Object, display, void(entity this, void(string name, string icon) returns)) {
- returns(sprintf("entity %i", this), "nopreview_map");
- }
-ENDCLASS(Object)
-#undef spawn_static
-#undef spawn_1
-#undef _vtbl
-
-#endif
+++ /dev/null
-#ifdef CSQC
-#ifndef PLAYER_H
-#define PLAYER_H
-
-#include "String.qh"
-
-#include "../client/main.qh"
-#include "../common/teams.qh"
-
-int GetPlayerColorForce(int i)
-{
- if(!teamplay)
- return 0;
- else
- return stof(getplayerkeyvalue(i, "colors")) & 15;
-}
-
-int GetPlayerColor(int i)
-{
- if(!playerslots[i].gotscores) // unconnected
- return NUM_SPECTATOR;
- else if(stof(getplayerkeyvalue(i, "frags")) == FRAGS_SPECTATOR)
- return NUM_SPECTATOR;
- else
- return GetPlayerColorForce(i);
-}
-
-string GetPlayerName(int i)
-{
- return ColorTranslateRGB(getplayerkeyvalue(i, "name"));
-}
-
-#endif
-#endif
+++ /dev/null
-#ifndef PROGNAME_H
-#define PROGNAME_H
-
-#if defined(MENUQC)
- #define PROGNAME "MENUQC"
-#elif defined(SVQC)
- #define PROGNAME "SVQC"
-#elif defined(CSQC)
- #define PROGNAME "CSQC"
-#else
- #error "Unable to detect PROGNAME"
-#endif
-
-#endif
+++ /dev/null
-#ifndef REGISTRY_H
-#define REGISTRY_H
-
-#include "OO.qh"
-
-#define REGISTER_INIT(ns, id) [[accumulate]] void Register_##ns##_##id##_init(entity this)
-#define REGISTER_INIT_POST(ns, id) [[accumulate]] void Register_##ns##_##id##_init_post(entity this)
-
-#define REGISTER(initfunc, ns, array, counter, id, fld, inst) \
- entity ns##_##id; \
- REGISTER_INIT(ns, id) { } \
- REGISTER_INIT_POST(ns, id) { } \
- .entity enemy; /* internal next pointer */ \
- void Register_##ns##_##id() { \
- entity this = inst; \
- ns##_##id = this; \
- this.fld = counter; \
- array[counter++] = this; \
- if (!array##_first) array##_first = this; \
- if ( array##_last) array##_last.enemy = this; \
- array##_last = this; \
- Register_##ns##_##id##_init(this); \
- Register_##ns##_##id##_init_post(this); \
- } \
- ACCUMULATE_FUNCTION(initfunc, Register_##ns##_##id) \
- REGISTER_INIT(ns, id)
-
-#endif
+++ /dev/null
-#ifndef STATIC_H
-#define STATIC_H
-
-void __static_init_early() { }
-void __static_init() { CALL_ACCUMULATED_FUNCTION(__static_init_early); }
-#define static_init() CALL_ACCUMULATED_FUNCTION(__static_init)
-#define REGISTER_REGISTRY(func) ACCUMULATE_FUNCTION(__static_init_early, func)
-
-#define _STATIC_INIT(where, func) \
- void _static_##func(); \
- ACCUMULATE_FUNCTION(where, _static_##func) \
- void _static_##func()
-
-#define STATIC_INIT(func) _STATIC_INIT(__static_init_early, func##_early)
-#define STATIC_INIT_LATE(func) _STATIC_INIT(__static_init, func)
-
-#endif
+++ /dev/null
-#ifndef STRING_H
-#define STRING_H
-
-#ifndef SVQC
-float stringwidth_colors(string s, vector theSize)
-{
- return stringwidth(s, true, theSize);
-}
-
-float stringwidth_nocolors(string s, vector theSize)
-{
- return stringwidth(s, false, theSize);
-}
-#endif
-
-// Timer (#5)
-//
-// TODO: macro
-string seconds_tostring(float sec)
-{
- float minutes;
- minutes = floor(sec / 60);
-
- sec -= minutes * 60;
- return sprintf("%d:%02d", minutes, sec);
-}
-
-int ColorTranslateMode;
-
-string ColorTranslateRGB(string s)
-{
- if(ColorTranslateMode & 1)
- return strdecolorize(s);
- else
- return s;
-}
-
-#endif
+++ /dev/null
-#ifndef STRUCT_H
-#define STRUCT_H
-
-#ifndef QCC_SUPPORT_STRUCT
- #define _STRUCT_DECLARE(x, id, type, END) noref type x ##_## id ;
- #define STRUCT_DECLARE(id, s) s(_STRUCT_DECLARE, id)
-
- #define _STRUCT_PARAM_(x, id, type) type x ##_## id ,
- #define _STRUCT_PARAM_END(x, id, type) type x ##_## id
- #define _STRUCT_PARAM(x, id, type, isend) _STRUCT_PARAM_##isend(x, id, type)
- #define STRUCT_PARAM(id, s) s(_STRUCT_PARAM, id)
-
- #define _STRUCT_PASS_(x, id, type) x ##_## id ,
- #define _STRUCT_PASS_END(x, id, type) x ##_## id
- #define _STRUCT_PASS(x, id, type, END) _STRUCT_PASS_##END(x, id, type)
- #define STRUCT_PASS(id, s) s(_STRUCT_PASS, id)
-
- #define _STRUCT_STORE_DST(_, it) it
- #define _STRUCT_STORE_SRC(it, _) it
- #define _CONCAT3_(a, b, c) a ## b ## c
- #define _CONCAT3(a, b, c) _CONCAT3_(a, b, c)
- #define _STRUCT_STORE(x, id, type, END) _CONCAT3(_STRUCT_STORE_DST x, _, id) = _CONCAT3(_STRUCT_STORE_SRC x, _, id);
- #define STRUCT_STORE(from, to, s) s(_STRUCT_STORE, (from, to))
-
- #define STRUCT(id, ...)
-#else
- #define STRUCT_DECLARE(id, type) type id;
- #define STRUCT_PARAM(id, type) type id
- #define STRUCT_PASS(id, type) id
- #define STRUCT_STORE(from, to, s) to = from
- #define _STRUCT_MEMBER(my, id, type, END) type id;
- #define STRUCT(id, s) struct STRUCT_##id { s(_STRUCT_MEMBER, ) };
-#endif
-
-#endif
+++ /dev/null
-#ifndef VECTOR_H
-#define VECTOR_H
-
-const vector eX = '1 0 0';
-const vector eY = '0 1 0';
-const vector eZ = '0 0 1';
-
-vector randompos(vector m1, vector m2)
-{
- vector v;
- m2 = m2 - m1;
- v_x = m2_x * random() + m1_x;
- v_y = m2_y * random() + m1_y;
- v_z = m2_z * random() + m1_z;
- return v;
-}
-
-float vlen2d(vector v)
-{
- return sqrt(v.x * v.x + v.y * v.y);
-}
-
-float vlen_maxnorm2d(vector v)
-{
- return max(v.x, v.y, -v.x, -v.y);
-}
-
-float vlen_minnorm2d(vector v)
-{
- return min(max(v.x, -v.x), max(v.y, -v.y));
-}
-
-
-#endif
-#include "Bool.qh"
+#include "bool.qh"
#include "../warpzonelib/mathlib.qc"
-#include "Accumulate.qh"
-#include "Counting.qh"
-#include "Cvar.qh"
-#include "Defer.qh"
-#include "Draw.qh"
-#include "I18N.qh"
-#include "Lazy.qh"
-#include "Log.qh"
-#include "Math.qh"
-#include "Nil.qh"
+#include "accumulate.qh"
+#include "counting.qh"
+#include "cvar.qh"
+#include "defer.qh"
+#include "draw.qh"
+#include "i18n.qh"
+#include "lazy.qh"
+#include "log.qh"
+#include "math.qh"
+#include "nil.qh"
#include "noise.qc"
-#include "OO.qh"
+#include "oo.qh"
#include "p2mathlib.qc"
-#include "Player.qh"
+#include "player.qh"
#include "prandom.qc"
-#include "Progname.qh"
-#include "Registry.qh"
+#include "progname.qh"
+#include "registry.qh"
#include "sortlist.qc"
-#include "Static.qh"
-#include "String.qh"
-#include "Struct.qh"
+#include "static.qh"
+#include "string.qh"
+#include "struct.qh"
#include "test.qc"
#include "urllib.qc"
-#include "Vector.qh"
+#include "vector.qh"
--- /dev/null
+#ifndef ACCUMULATE_H
+#define ACCUMULATE_H
+
+#ifdef QCC_SUPPORT_ACCUMULATE
+# define ACCUMULATE_FUNCTION(func, otherfunc) \
+ [[accumulate]] void func() { otherfunc(); }
+# define CALL_ACCUMULATED_FUNCTION(func) \
+ func()
+#else
+#ifdef HAVE_YO_DAWG_CPP
+// TODO make ascii art pic of xzibit
+// YO DAWG!
+// I HERD YO LIEK MACROS
+// SO I PUT A MACRO DEFINITION IN YO MACRO DEFINITION
+// SO YO CAN EXPAND MACROS WHILE YO EXPAND MACROS
+# define ACCUMULATE_FUNCTION(func,otherfunc) \
+ #ifdef func \
+ void __merge__##otherfunc() { func(); otherfunc(); } \
+ #undef func \
+ #define func __merge__##otherfunc \
+ #else \
+ #define func otherfunc \
+ #endif
+# define CALL_ACCUMULATED_FUNCTION(func) \
+ func()
+#else
+# define ACCUMULATE_FUNCTION(func,otherfunc) \
+ .float _ACCUMULATE_##func##__##otherfunc;
+void ACCUMULATE_call(string func)
+{
+ float i;
+ float n = numentityfields();
+ string funcprefix = strcat("_ACCUMULATE_", func, "__");
+ float funcprefixlen = strlen(funcprefix);
+ for(i = 0; i < n; ++i)
+ {
+ string name = entityfieldname(i);
+ if(substring(name, 0, funcprefixlen) == funcprefix)
+ callfunction(substring(name, funcprefixlen, -1));
+ }
+}
+# define CALL_ACCUMULATED_FUNCTION(func) \
+ ACCUMULATE_call(#func)
+#endif
+#endif
+
+// used for simplifying ACCUMULATE_FUNCTIONs
+#define SET_FIRST_OR_LAST(input,first,count) if(!input) { input = (first + count); }
+#define SET_FIELD_COUNT(field,first,count) if(!field) { field = (first + count); ++count; }
+#define CHECK_MAX_COUNT(name,max,count,type) if(count > max) { error(strcat("Maximum ", type, " hit: ", #name, ": ", ftos(count), ".\n")); }
+
+#endif
--- /dev/null
+#ifndef BOOL_H
+#define BOOL_H
+
+#ifndef QCC_SUPPORT_BOOL
+ #define bool float
+
+ // Boolean Constants
+ const int true = 1;
+ const int false = 0;
+#endif
+
+// Transitional aliases
+[[deprecated("use true")]] [[alias("true")]] const bool TRUE;
+[[deprecated("use false")]] [[alias("false")]] const bool FALSE;
+
+// get true/false value of a string with multiple different inputs
+float InterpretBoolean(string input)
+{
+ switch (strtolower(input))
+ {
+ case "yes":
+ case "true":
+ case "on":
+ return true;
+
+ case "no":
+ case "false":
+ case "off":
+ return false;
+
+ default: return stof(input);
+ }
+}
+
+float boolean(float value) { // if value is 0 return false (0), otherwise return true (1)
+ return (value == 0) ? false : true;
+}
+
+#endif
--- /dev/null
+#ifndef COUNTING_H
+#define COUNTING_H
+
+#include "i18n.qh"
+
+// ===============================================
+// Time processing and counting functions/macros
+// ===============================================
+
+#define count_years_decs(time,decs) sprintf(ZCTX(_("CI_DEC^%s years")), ftos_decimals(time, decs))
+#define count_years(time) count_fill(time, \
+ ZCTX(_("CI_ZER^%d years")), /* zeroth */ \
+ ZCTX(_("CI_FIR^%d year")), /* first */ \
+ ZCTX(_("CI_SEC^%d years")), /* year */ \
+ ZCTX(_("CI_THI^%d years")), /* third */ \
+ ZCTX(_("CI_MUL^%d years"))) /* multi */
+
+#define count_weeks_decs(time,decs) sprintf(ZCTX(_("CI_DEC^%s weeks")), ftos_decimals(time, decs))
+#define count_weeks(time) count_fill(time, \
+ ZCTX(_("CI_ZER^%d weeks")), /* zeroth */ \
+ ZCTX(_("CI_FIR^%d week")), /* first */ \
+ ZCTX(_("CI_SEC^%d weeks")), /* week */ \
+ ZCTX(_("CI_THI^%d weeks")), /* third */ \
+ ZCTX(_("CI_MUL^%d weeks"))) /* multi */
+
+#define count_days_decs(time,decs) sprintf(ZCTX(_("CI_DEC^%s days")), ftos_decimals(time, decs))
+#define count_days(time) count_fill(time, \
+ ZCTX(_("CI_ZER^%d days")), /* zeroth */ \
+ ZCTX(_("CI_FIR^%d day")), /* first */ \
+ ZCTX(_("CI_SEC^%d days")), /* day */ \
+ ZCTX(_("CI_THI^%d days")), /* third */ \
+ ZCTX(_("CI_MUL^%d days"))) /* multi */
+
+#define count_hours_decs(time,decs) sprintf(ZCTX(_("CI_DEC^%s hours")), ftos_decimals(time, decs))
+#define count_hours(time) count_fill(time, \
+ ZCTX(_("CI_ZER^%d hours")), /* zeroth */ \
+ ZCTX(_("CI_FIR^%d hour")), /* first */ \
+ ZCTX(_("CI_SEC^%d hours")), /* hour */ \
+ ZCTX(_("CI_THI^%d hours")), /* third */ \
+ ZCTX(_("CI_MUL^%d hours"))) /* multi */
+
+
+#define count_minutes_decs(time,decs) sprintf(ZCTX(_("CI_DEC^%s minutes")), ftos_decimals(time, decs))
+#define count_minutes(time) count_fill(time, \
+ ZCTX(_("CI_ZER^%d minutes")), /* zeroth */ \
+ ZCTX(_("CI_FIR^%d minute")), /* first */ \
+ ZCTX(_("CI_SEC^%d minutes")), /* minute */ \
+ ZCTX(_("CI_THI^%d minutes")), /* third */ \
+ ZCTX(_("CI_MUL^%d minutes"))) /* multi */
+
+#define count_seconds_decs(time,decs) sprintf(ZCTX(_("CI_DEC^%s seconds")), ftos_decimals(time, decs))
+#define count_seconds(time) count_fill(time, \
+ ZCTX(_("CI_ZER^%d seconds")), /* zeroth */ \
+ ZCTX(_("CI_FIR^%d second")), /* first */ \
+ ZCTX(_("CI_SEC^%d seconds")), /* second */ \
+ ZCTX(_("CI_THI^%d seconds")), /* third */ \
+ ZCTX(_("CI_MUL^%d seconds"))) /* multi */
+
+string count_ordinal(int interval)
+{
+ // This function is designed primarily for the English language, it's impossible
+ // to accomodate all languages unless we do a specific function for each one...
+ // and since that's not technically feasible/practical, this is all we've got folks.
+
+ // Basically, it just allows you to represent a number or count in different ways
+ // depending on the number... like, with count_ordinal you can provide integers
+ // and retrieve 1st, 2nd, 3rd, nth ordinal numbers in a clean and simple way.
+ if(floor((interval % 100)/10) * 10 != 10) // examples: 12th, 111th, 213th will not execute this block
+ {
+ // otherwise, check normally for 1st,2nd,3rd insertions
+ switch(interval % 10)
+ {
+ case 1: return sprintf(_("%dst"), interval);
+ case 2: return sprintf(_("%dnd"), interval);
+ case 3: return sprintf(_("%drd"), interval);
+ default: return sprintf(_("%dth"), interval);
+ }
+ }
+ else { return sprintf(_("%dth"), interval); }
+
+ return "";
+}
+
+string count_fill(float interval, string zeroth, string first, string second, string third, string multi)
+{
+ // This function is designed primarily for the English language, it's impossible
+ // to accomodate all languages unless we do a specific function for each one...
+ // and since that's not technically feasible/practical, this is all we've got folks.
+
+ // Here you can insert specific strings based on the interval number, so you could do
+ // i.e. count_seconds which outputs like this:
+ // 0 seconds
+ // 1 second
+ // 2 seconds
+ // 3 seconds
+ // etc... minutes, hours, days, etc.
+
+ switch(floor(interval))
+ {
+ case 0: return sprintf(zeroth, interval);
+ case 1:
+ {
+ if(interval == 1) // EXACTLY value of 1
+ return sprintf(first, interval);
+ else
+ return sprintf(multi, interval);
+ }
+ case 2: return sprintf(second, interval);
+ case 3: return sprintf(third, interval);
+ default: return sprintf(multi, interval);
+ }
+ return "";
+}
+
+string process_time(float outputtype, float seconds)
+{
+ float tmp_hours = 0, tmp_minutes = 0, tmp_seconds = 0;
+ float tmp_years = 0, tmp_weeks = 0, tmp_days = 0;
+
+ tmp_seconds = floor(seconds);
+
+ if(tmp_seconds)
+ {
+ tmp_minutes = floor(tmp_seconds / 60);
+
+ if(tmp_minutes)
+ {
+ tmp_seconds -= (tmp_minutes * 60);
+ tmp_hours = floor(tmp_minutes / 60);
+
+ if(tmp_hours)
+ {
+ tmp_minutes -= (tmp_hours * 60);
+ tmp_days = floor(tmp_hours / 24);
+
+ if(tmp_days)
+ {
+ tmp_hours -= (tmp_days * 24);
+ tmp_weeks = floor(tmp_days / 7);
+
+ if(tmp_weeks)
+ {
+ tmp_days -= (tmp_weeks * 7);
+ tmp_years = floor(tmp_weeks / 52);
+ }
+ }
+ }
+ }
+ }
+
+ switch(outputtype)
+ {
+ case 1: return sprintf("%02d:%02d:%02d", tmp_hours, tmp_minutes, tmp_seconds);
+ case 2:
+ {
+ string output = "";
+
+ output = count_seconds(tmp_seconds);
+
+ if(tmp_minutes)
+ {
+ output = sprintf(
+ "%s%s",
+ count_minutes(tmp_minutes),
+ ((output != "") ? sprintf(", %s", output) : ""));
+ }
+
+ if(tmp_hours)
+ {
+ output = sprintf(
+ "%s%s",
+ count_hours(tmp_hours),
+ ((output != "") ? sprintf(", %s", output) : ""));
+ }
+
+ if(tmp_days)
+ {
+ output = sprintf(
+ "%s%s",
+ count_days(tmp_days),
+ ((output != "") ? sprintf(", %s", output) : ""));
+ }
+
+ if(tmp_weeks)
+ {
+ output = sprintf(
+ "%s%s",
+ count_weeks(tmp_weeks),
+ ((output != "") ? sprintf(", %s", output) : ""));
+ }
+
+ if(tmp_years)
+ {
+ output = sprintf(
+ "%s%s",
+ count_years(tmp_years),
+ ((output != "") ? sprintf(", %s", output) : ""));
+ }
+
+ return output;
+ }
+ case 3:
+ {
+ string output = "";
+
+ output = count_hours(tmp_hours);
+
+ if(tmp_weeks) { tmp_days += (tmp_weeks * 7); }
+ if(tmp_years) { tmp_days += (tmp_years * 365); }
+ if(tmp_days)
+ {
+ output = sprintf(
+ "%s%s",
+ count_days(tmp_days),
+ ((output != "") ? sprintf(", %s", output) : ""));
+ }
+
+ return output;
+ }
+ }
+ return "";
+}
+#endif
--- /dev/null
+#ifndef CVAR_H
+#define CVAR_H
+
+#include "static.qh"
+
+void RegisterCvars(void(string name, string desc, bool archive, string file) f) { }
+
+void RegisterCvars_Set(string name, string desc, bool archive, string file)
+{
+ localcmd(sprintf("\n%1$s %2$s \"$%2$s\" \"%3$s\"\n", (archive ? "seta" : "set"), name, desc));
+}
+
+STATIC_INIT_LATE(Cvars) { RegisterCvars(RegisterCvars_Set); }
+
+#define AUTOCVAR_5(file, archive, var, type, desc) \
+ [[accumulate]] void RegisterCvars(void(string, string, bool, string) f) { f(#var, desc, archive, file); } \
+ type autocvar_##var
+#define AUTOCVAR_6(file, archive, var, type, default, desc) \
+ AUTOCVAR_5(file, archive, var, type, desc) = default
+#define _AUTOCVAR(...) EVAL(OVERLOAD(AUTOCVAR, __FILE__, __VA_ARGS__))
+#define AUTOCVAR_SAVE(...) _AUTOCVAR(true, __VA_ARGS__)
+#define AUTOCVAR(...) _AUTOCVAR(false, __VA_ARGS__)
+
+#endif
--- /dev/null
+#ifndef MENUQC
+#ifndef DEFER_H
+#define DEFER_H
+#include "oo.qh"
+
+entityclass(Defer);
+class(Defer) .entity owner;
+class(Defer) .void() think;
+class(Defer) .float nextthink;
+
+/*
+==================
+SUB_Remove
+
+Remove self
+==================
+*/
+void SUB_Remove()
+{SELFPARAM();
+ remove (self);
+}
+
+void defer_think()
+{SELFPARAM();
+ self.think = SUB_Remove;
+ self.nextthink = time;
+ WITH(entity, self, self.owner, self.use());
+}
+
+/*
+ Execute func() after time + fdelay.
+ self when func is executed = self when defer is called
+*/
+void defer(float fdelay, void() func)
+{SELFPARAM();
+ entity e;
+
+ e = spawn();
+ e.owner = self;
+ e.use = func;
+ e.think = defer_think;
+ e.nextthink = time + fdelay;
+}
+
+#endif
+#endif
--- /dev/null
+#ifdef CSQC
+#ifndef DRAW_H
+#define DRAW_H
+
+#include "i18n.qh"
+#include "vector.qh"
+
+#include "../client/defs.qh"
+
+void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float theAlpha, float drawflag, vector vieworg)
+{
+ // I want to draw a quad...
+ // from and to are MIDPOINTS.
+
+ vector axis, thickdir, A, B, C, D;
+ float length_tex;
+
+ axis = normalize(to - from);
+ length_tex = aspect * vlen(to - from) / thickness;
+
+ // direction is perpendicular to the view normal, and perpendicular to the axis
+ thickdir = normalize(cross(axis, vieworg - from));
+
+ A = from - thickdir * (thickness / 2);
+ B = from + thickdir * (thickness / 2);
+ C = to + thickdir * (thickness / 2);
+ D = to - thickdir * (thickness / 2);
+
+ R_BeginPolygon(texture, drawflag);
+ R_PolygonVertex(A, '0 0 0' + shift * '1 0 0', rgb, theAlpha);
+ R_PolygonVertex(B, '0 1 0' + shift * '1 0 0', rgb, theAlpha);
+ R_PolygonVertex(C, '0 1 0' + (shift + length_tex) * '1 0 0', rgb, theAlpha);
+ R_PolygonVertex(D, '0 0 0' + (shift + length_tex) * '1 0 0', rgb, theAlpha);
+ R_EndPolygon();
+}
+
+// a border picture is a texture containing nine parts:
+// 1/4 width: left part
+// 1/2 width: middle part (stretched)
+// 1/4 width: right part
+// divided into
+// 1/4 height: top part
+// 1/2 height: middle part (stretched)
+// 1/4 height: bottom part
+void draw_BorderPicture(vector theOrigin, string pic, vector theSize, vector theColor, float theAlpha, vector theBorderSize)
+{
+ if (theBorderSize.x < 0 && theBorderSize.y < 0) // draw whole image as it is
+ {
+ drawpic(theOrigin, pic, theSize, theColor, theAlpha, 0);
+ return;
+ }
+ if (theBorderSize.x == 0 && theBorderSize.y == 0) // no border
+ {
+ // draw only the central part
+ drawsubpic(theOrigin, theSize, pic, '0.25 0.25 0', '0.5 0.5 0', theColor, theAlpha, 0);
+ return;
+ }
+
+ vector dX, dY;
+ vector width, height;
+ vector bW, bH;
+ //pic = draw_UseSkinFor(pic);
+ width = eX * theSize.x;
+ height = eY * theSize.y;
+ if(theSize.x <= theBorderSize.x * 2)
+ {
+ // not wide enough... draw just left and right then
+ bW = eX * (0.25 * theSize.x / (theBorderSize.x * 2));
+ if(theSize.y <= theBorderSize.y * 2)
+ {
+ // not high enough... draw just corners
+ bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2));
+ drawsubpic(theOrigin, width * 0.5 + height * 0.5, pic, '0 0 0', bW + bH, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + width * 0.5, width * 0.5 + height * 0.5, pic, eX - bW, bW + bH, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + height * 0.5, width * 0.5 + height * 0.5, pic, eY - bH, bW + bH, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + theSize * 0.5, width * 0.5 + height * 0.5, pic, eX + eY - bW - bH, bW + bH, theColor, theAlpha, 0);
+ }
+ else
+ {
+ dY = theBorderSize.x * eY;
+ drawsubpic(theOrigin, width * 0.5 + dY, pic, '0 0 0', '0 0.25 0' + bW, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + width * 0.5, width * 0.5 + dY, pic, '0 0 0' + eX - bW, '0 0.25 0' + bW, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + dY, width * 0.5 + height - 2 * dY, pic, '0 0.25 0', '0 0.5 0' + bW, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + width * 0.5 + dY, width * 0.5 + height - 2 * dY, pic, '0 0.25 0' + eX - bW, '0 0.5 0' + bW, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + height - dY, width * 0.5 + dY, pic, '0 0.75 0', '0 0.25 0' + bW, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + width * 0.5 + height - dY, width * 0.5 + dY, pic, '0 0.75 0' + eX - bW, '0 0.25 0' + bW, theColor, theAlpha, 0);
+ }
+ }
+ else
+ {
+ if(theSize.y <= theBorderSize.y * 2)
+ {
+ // not high enough... draw just top and bottom then
+ bH = eY * (0.25 * theSize.y / (theBorderSize.y * 2));
+ dX = theBorderSize.x * eX;
+ drawsubpic(theOrigin, dX + height * 0.5, pic, '0 0 0', '0.25 0 0' + bH, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + dX, width - 2 * dX + height * 0.5, pic, '0.25 0 0', '0.5 0 0' + bH, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + width - dX, dX + height * 0.5, pic, '0.75 0 0', '0.25 0 0' + bH, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + height * 0.5, dX + height * 0.5, pic, '0 0 0' + eY - bH, '0.25 0 0' + bH, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + dX + height * 0.5, width - 2 * dX + height * 0.5, pic, '0.25 0 0' + eY - bH, '0.5 0 0' + bH, theColor, theAlpha, 0);
+ drawsubpic(theOrigin + width - dX + height * 0.5, dX + height * 0.5, pic, '0.75 0 0' + eY - bH, '0.25 0 0' + bH, theColor, theAlpha, 0);
+ }
+ else
+ {
+ dX = theBorderSize.x * eX;
+ dY = theBorderSize.x * eY;
+ drawsubpic(theOrigin, dX + dY, pic, '0 0 0', '0.25 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + dX, width - 2 * dX + dY, pic, '0.25 0 0', '0.5 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + width - dX, dX + dY, pic, '0.75 0 0', '0.25 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + dY, dX + height - 2 * dY, pic, '0 0.25 0', '0.25 0.5 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + dY + dX, width - 2 * dX + height - 2 * dY, pic, '0.25 0.25 0', '0.5 0.5 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + dY + width - dX, dX + height - 2 * dY, pic, '0.75 0.25 0', '0.25 0.5 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + height - dY, dX + dY, pic, '0 0.75 0', '0.25 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + height - dY + dX, width - 2 * dX + dY, pic, '0.25 0.75 0', '0.5 0.25 0', theColor, theAlpha, 0);
+ drawsubpic(theOrigin + height - dY + width - dX, dX + dY, pic, '0.75 0.75 0', '0.25 0.25 0', theColor, theAlpha, 0);
+ }
+ }
+}
+
+void drawstringright(vector position, string text, vector theScale, vector rgb, float theAlpha, int flag)
+{
+ position.x -= 2 / 3 * strlen(text) * theScale.x;
+ drawstring(position, text, theScale, rgb, theAlpha, flag);
+}
+
+void drawstringcenter(vector position, string text, vector theScale, vector rgb, float theAlpha, int flag)
+{
+ position.x = 0.5 * (vid_conwidth - 0.6025 * strlen(text) * theScale.x);
+ drawstring(position, text, theScale, rgb, theAlpha, flag);
+}
+
+#endif
+#endif
--- /dev/null
+#ifndef I18N_H
+#define I18N_H
+
+#include "log.qh"
+
+// translation helpers
+string prvm_language;
+
+string language_filename(string s)
+{
+ string fn = prvm_language;
+ if (fn == "" || fn == "dump")
+ return s;
+ fn = strcat(s, ".", fn);
+ int fh = fopen(fn, FILE_READ);
+ if (fh >= 0)
+ {
+ fclose(fh);
+ return fn;
+ }
+ return s;
+}
+
+string CTX(string s)
+{
+ int p = strstrofs(s, "^", 0);
+ if (p < 0)
+ return s;
+ return substring(s, p + 1, -1);
+}
+
+#define ZCTX(s) strzone(CTX(s))
+
+#endif
--- /dev/null
+#ifndef LAZY_H
+#define LAZY_H
+
+#include "oo.qh"
+
+CLASS(Lazy, Object)
+ ATTRIB(Lazy, m_get, entity(), func_null);
+ CONSTRUCTOR(Lazy, entity() _compute) { this.m_get = _compute; }
+ENDCLASS(Lazy)
+
+#define LAZY(id) __lazy_##id
+#define LAZY_NEW(id, compute) entity LAZY(id)() { \
+ static bool done; \
+ static entity it; \
+ if (!done) { it = compute; done = true; } \
+ return it; \
+}
+#endif
--- /dev/null
+#ifndef LOG_H
+#define LOG_H
+
+#define _printferr(...) error(sprintf(__VA_ARGS__))
+#define _printfbt(...) backtrace(sprintf(__VA_ARGS__))
+#define printf(...) print(sprintf(__VA_ARGS__))
+#define dprintf(...) dprint(sprintf(__VA_ARGS__))
+#define _dprintf2(...) do { if (autocvar_developer > 1) dprintf(__VA_ARGS__); } while (0)
+
+#define assert(expr, ...) do { if (!(expr)) LOG_WARNINGF(__VA_ARGS__); } while (0)
+
+#define _LOG(f, level, s) f("[::"level"] ["__FILE__":%s:%.0f] %s", __FUNC__, __LINE__, s)
+
+#define LOG_FATAL(...) _LOG_FATAL(strcat("", __VA_ARGS__))
+#define LOG_FATALF(...) _LOG_FATAL(sprintf(__VA_ARGS__))
+#define _LOG_FATAL(s) _LOG(_printferr, "FATAL", s)
+
+#define LOG_SEVERE(...) _LOG_SEVERE(strcat("", __VA_ARGS__))
+#define LOG_SEVEREF(...) _LOG_SEVERE(sprintf(__VA_ARGS__))
+#define _LOG_SEVERE(s) _LOG(_printfbt, "SEVERE", s)
+
+#define LOG_WARNING(...) _LOG_WARNING(strcat("", __VA_ARGS__))
+#define LOG_WARNINGF(...) _LOG_WARNING(sprintf(__VA_ARGS__))
+#define _LOG_WARNING(s) _LOG(printf, "WARNING", s)
+
+#define LOG_INFO(...) do { if (autocvar_developer) _LOG_INFO(strcat("", __VA_ARGS__)); else print (__VA_ARGS__); } while (0)
+#define LOG_INFOF(...) do { if (autocvar_developer) _LOG_INFO(sprintf(__VA_ARGS__)); else printf(__VA_ARGS__); } while (0)
+#define _LOG_INFO(s) _LOG(printf, "INFO", s)
+
+#define LOG_TRACE(...) _LOG_TRACE(strcat("", __VA_ARGS__))
+#define LOG_TRACEF(...) _LOG_TRACE(sprintf(__VA_ARGS__))
+#define _LOG_TRACE(s) _LOG(dprintf, "TRACE", s)
+
+#define LOG_DEBUG(...) _LOG_DEBUG(strcat("", __VA_ARGS__))
+#define LOG_DEBUGF(...) _LOG_DEBUG(sprintf(__VA_ARGS__))
+#define _LOG_DEBUG(s) _LOG(_dprintf2, "DEBUG", s)
+
+// TODO: this sucks, lets find a better way to do backtraces?
+#ifdef SVQC
+void builtin_remove(entity);
+#define _backtrace() builtin_remove(NULL)
+#else
+void remove(entity);
+#define _backtrace() remove(NULL)
+#endif
+
+noref int autocvar_developer;
+noref bool autocvar_prvm_backtraceforwarnings;
+
+#define backtrace(msg) do { \
+ int dev = autocvar_developer; \
+ bool war = autocvar_prvm_backtraceforwarnings; \
+ cvar_set("developer", "1"); \
+ cvar_set("prvm_backtraceforwarnings", "1"); \
+ print("\n--- CUT HERE ---\n", msg, "\n"); \
+ _backtrace(); \
+ print("\n--- CUT UNTIL HERE ---\n"); \
+ cvar_set("developer", ftos(dev)); \
+ cvar_set("prvm_backtraceforwarnings", ftos(war)); \
+} while (0)
+
+#endif
--- /dev/null
+#ifndef MATH_H
+#define MATH_H
+
+void mean_accumulate(entity e, .float a, .float c, float mean, float value, float weight)
+{
+ if (weight == 0)
+ return;
+ if (mean == 0)
+ e.(a) *= pow(value, weight);
+ else
+ e.(a) += pow(value, mean) * weight;
+ e.(c) += weight;
+}
+
+float mean_evaluate(entity e, .float a, .float c, float mean)
+{
+ if (e.(c) == 0)
+ return 0;
+ if (mean == 0)
+ return pow(e.(a), 1.0 / e.(c));
+ else
+ return pow(e.(a) / e.(c), 1.0 / mean);
+}
+
+#define MEAN_ACCUMULATE(prefix,v,w) mean_accumulate(self,prefix##_accumulator,prefix##_count,prefix##_mean,v,w)
+#define MEAN_EVALUATE(prefix) mean_evaluate(self,prefix##_accumulator,prefix##_count,prefix##_mean)
+#define MEAN_DECLARE(prefix,m) float prefix##_mean = m; .float prefix##_count, prefix##_accumulator
+
+/*
+==================
+crandom
+
+Returns a random number between -1.0 and 1.0
+==================
+*/
+float crandom (void)
+{
+ return 2 * (random () - 0.5);
+}
+
+
+/*
+==================
+Angc used for animations
+==================
+*/
+
+
+float angc (float a1, float a2)
+{
+ float a;
+
+ while (a1 > 180)
+ a1 = a1 - 360;
+ while (a1 < -179)
+ a1 = a1 + 360;
+
+ while (a2 > 180)
+ a2 = a2 - 360;
+ while (a2 < -179)
+ a2 = a2 + 360;
+
+ a = a1 - a2;
+ while (a > 180)
+ a = a - 360;
+ while (a < -179)
+ a = a + 360;
+
+ return a;
+}
+
+float fsnap(float val,float fsize)
+{
+ return rint(val / fsize) * fsize;
+}
+
+vector vsnap(vector point,float fsize)
+{
+ vector vret;
+
+ vret.x = rint(point.x / fsize) * fsize;
+ vret.y = rint(point.y / fsize) * fsize;
+ vret.z = ceil(point.z / fsize) * fsize;
+
+ return vret;
+}
+
+vector lerpv(float t0, vector v0, float t1, vector v1, float t)
+{
+ return v0 + (v1 - v0) * ((t - t0) / (t1 - t0));
+}
+
+#endif
--- /dev/null
+#ifndef NIL_H
+#define NIL_H
+
+#if QCC_SUPPORT_NIL
+#define func_null nil
+#define string_null nil
+#else
+// the NULL function
+var void func_null(void);
+string string_null;
+#endif
+
+#endif
--- /dev/null
+#ifndef OO_H
+#define OO_H
+
+#include "nil.qh"
+#include "registry.qh"
+
+#ifdef MENUQC
+ #define NULL (null_entity)
+#else
+ #define NULL (world)
+#endif
+
+.string classname;
+/** Location entity was spawned from in source */
+.string sourceLocFile;
+.int sourceLocLine;
+entity _spawn();
+entity __spawn(string _classname, string _sourceFile, int _sourceLine) {
+ entity this = _spawn();
+ this.classname = _classname;
+ this.sourceLocFile = _sourceFile;
+ this.sourceLocLine = _sourceLine;
+ return this;
+}
+
+
+
+#define entityclass(...) EVAL(OVERLOAD(entityclass, __VA_ARGS__))
+#define entityclass_1(name) entityclass_2(name, Object)
+#ifndef QCC_SUPPORT_ENTITYCLASS
+ #define entityclass_2(name, base) typedef entity name
+ #define class(name)
+ #define new(class) __spawn(#class, __FILE__, __LINE__)
+#else
+ #define entityclass_2(name, base) entityclass name : base {}
+ #define class(name) [[class(name)]]
+ #define new(class) ((class) __spawn(#class, __FILE__, __LINE__))
+#endif
+
+// Classes have a `spawn##cname(entity)` constructor
+// The parameter is used across [[accumulate]] functions
+
+// Macros to hide this implementation detail:
+#ifdef GMQCC
+#define NEW(cname, ...) \
+ OVERLOAD(spawn##cname, new(cname), ##__VA_ARGS__)
+
+#define CONSTRUCT(cname, ...) \
+ OVERLOAD(spawn##cname, this, ##__VA_ARGS__)
+#else
+#define NEW_(cname, ...) \
+ OVERLOAD_(spawn##cname, __VA_ARGS__)
+#define NEW(cname, ...) \
+ NEW_(cname, new(cname), ##__VA_ARGS__)(new(cname), ##__VA_ARGS__)
+
+#define CONSTRUCT_(cname, ...) \
+ OVERLOAD_(spawn##cname, __VA_ARGS__)
+#define CONSTRUCT(cname, ...) \
+ CONSTRUCT_(cname, this, ##__VA_ARGS__)(this, ##__VA_ARGS__)
+#endif
+
+#define CONSTRUCTOR(cname, ...) \
+ cname OVERLOAD(spawn##cname, cname this, __VA_ARGS__) { return = this; } \
+ [[accumulate]] cname OVERLOAD(spawn##cname, cname this, __VA_ARGS__)
+
+.string vtblname;
+.entity vtblbase;
+
+void RegisterClasses() { }
+STATIC_INIT(RegisterClasses) { RegisterClasses(); }
+
+#define VTBL(cname, base) \
+ INIT_STATIC(cname); \
+ entity cname##_vtbl; \
+ void cname##_vtbl_init() { \
+ cname e = new(vtbl); \
+ spawn##cname##_static(e); \
+ e.vtblname = #cname; \
+ /* Top level objects refer to themselves */ \
+ e.vtblbase = base##_vtbl ? base##_vtbl : e; \
+ cname##_vtbl = e; \
+ } \
+ ACCUMULATE_FUNCTION(RegisterClasses, cname##_vtbl_init)
+
+#define INIT_STATIC(cname) [[accumulate]] void spawn##cname##_static(cname this)
+#define INIT(cname) [[accumulate]] cname spawn##cname##_1(cname this)
+
+#define CLASS(cname, base) \
+ entityclass(cname, base); \
+ class(cname) .bool instanceOf##cname; \
+ VTBL(cname, base) \
+ INIT_STATIC(cname) { \
+ if (cname##_vtbl) { \
+ copyentity(cname##_vtbl, this); \
+ return; \
+ } \
+ spawn##base##_static(this); \
+ this.instanceOf##cname = true; \
+ } \
+ INIT(cname) { \
+ /* Only statically initialize the current class, it contains everything it inherits */ \
+ if (cname##_vtbl.vtblname == this.classname) { \
+ spawn##cname##_static(this); \
+ this.classname = #cname; \
+ this.vtblname = string_null; \
+ this.vtblbase = cname##_vtbl; \
+ } \
+ spawn##base##_1(this); \
+ }
+
+#define METHOD(cname, name, prototype) \
+ class(cname) .prototype name; \
+ prototype cname##_##name; \
+ INIT_STATIC(cname) { this.name = cname##_##name; } \
+ prototype cname##_##name
+
+#define ATTRIB(cname, name, type, val) \
+ class(cname) .type name; \
+ INIT(cname) { this.name = val; }
+
+#define ATTRIBARRAY(cname, name, type, cnt) \
+ class(cname) .type name[cnt];
+
+#define ENDCLASS(cname) \
+ [[last]] INIT(cname) { return this; }
+
+#define SUPER(cname) (cname##_vtbl.vtblbase)
+#define super (this.vtblbase.vtblbase)
+
+#define spawn_static(this)
+#define spawn_1(this)
+#define _vtbl NULL
+CLASS(Object, );
+ METHOD(Object, describe, string(entity this)) {
+ string s = _("No description");
+ if (cvar("developer")) {
+ for (int i = 0, n = numentityfields(); i < n; ++i) {
+ string value = getentityfieldstring(i, this);
+ if (value != "") s = sprintf("%s\n%s = %s", s, entityfieldname(i), value);
+ }
+ }
+ return s;
+ }
+ METHOD(Object, display, void(entity this, void(string name, string icon) returns)) {
+ returns(sprintf("entity %i", this), "nopreview_map");
+ }
+ENDCLASS(Object)
+#undef spawn_static
+#undef spawn_1
+#undef _vtbl
+
+#endif
--- /dev/null
+#ifdef CSQC
+#ifndef PLAYER_H
+#define PLAYER_H
+
+#include "string.qh"
+
+#include "../client/main.qh"
+#include "../common/teams.qh"
+
+int GetPlayerColorForce(int i)
+{
+ if(!teamplay)
+ return 0;
+ else
+ return stof(getplayerkeyvalue(i, "colors")) & 15;
+}
+
+int GetPlayerColor(int i)
+{
+ if(!playerslots[i].gotscores) // unconnected
+ return NUM_SPECTATOR;
+ else if(stof(getplayerkeyvalue(i, "frags")) == FRAGS_SPECTATOR)
+ return NUM_SPECTATOR;
+ else
+ return GetPlayerColorForce(i);
+}
+
+string GetPlayerName(int i)
+{
+ return ColorTranslateRGB(getplayerkeyvalue(i, "name"));
+}
+
+#endif
+#endif
--- /dev/null
+#ifndef PROGNAME_H
+#define PROGNAME_H
+
+#if defined(MENUQC)
+ #define PROGNAME "MENUQC"
+#elif defined(SVQC)
+ #define PROGNAME "SVQC"
+#elif defined(CSQC)
+ #define PROGNAME "CSQC"
+#else
+ #error "Unable to detect PROGNAME"
+#endif
+
+#endif
--- /dev/null
+#ifndef REGISTRY_H
+#define REGISTRY_H
+
+#include "oo.qh"
+
+#define REGISTER_INIT(ns, id) [[accumulate]] void Register_##ns##_##id##_init(entity this)
+#define REGISTER_INIT_POST(ns, id) [[accumulate]] void Register_##ns##_##id##_init_post(entity this)
+
+#define REGISTER(initfunc, ns, array, counter, id, fld, inst) \
+ entity ns##_##id; \
+ REGISTER_INIT(ns, id) { } \
+ REGISTER_INIT_POST(ns, id) { } \
+ .entity enemy; /* internal next pointer */ \
+ void Register_##ns##_##id() { \
+ entity this = inst; \
+ ns##_##id = this; \
+ this.fld = counter; \
+ array[counter++] = this; \
+ if (!array##_first) array##_first = this; \
+ if ( array##_last) array##_last.enemy = this; \
+ array##_last = this; \
+ Register_##ns##_##id##_init(this); \
+ Register_##ns##_##id##_init_post(this); \
+ } \
+ ACCUMULATE_FUNCTION(initfunc, Register_##ns##_##id) \
+ REGISTER_INIT(ns, id)
+
+#endif
--- /dev/null
+#ifndef STATIC_H
+#define STATIC_H
+
+void __static_init_early() { }
+void __static_init() { CALL_ACCUMULATED_FUNCTION(__static_init_early); }
+#define static_init() CALL_ACCUMULATED_FUNCTION(__static_init)
+#define REGISTER_REGISTRY(func) ACCUMULATE_FUNCTION(__static_init_early, func)
+
+#define _STATIC_INIT(where, func) \
+ void _static_##func(); \
+ ACCUMULATE_FUNCTION(where, _static_##func) \
+ void _static_##func()
+
+#define STATIC_INIT(func) _STATIC_INIT(__static_init_early, func##_early)
+#define STATIC_INIT_LATE(func) _STATIC_INIT(__static_init, func)
+
+#endif
--- /dev/null
+#ifndef STRING_H
+#define STRING_H
+
+#ifndef SVQC
+float stringwidth_colors(string s, vector theSize)
+{
+ return stringwidth(s, true, theSize);
+}
+
+float stringwidth_nocolors(string s, vector theSize)
+{
+ return stringwidth(s, false, theSize);
+}
+#endif
+
+// Timer (#5)
+//
+// TODO: macro
+string seconds_tostring(float sec)
+{
+ float minutes;
+ minutes = floor(sec / 60);
+
+ sec -= minutes * 60;
+ return sprintf("%d:%02d", minutes, sec);
+}
+
+int ColorTranslateMode;
+
+string ColorTranslateRGB(string s)
+{
+ if(ColorTranslateMode & 1)
+ return strdecolorize(s);
+ else
+ return s;
+}
+
+#endif
--- /dev/null
+#ifndef STRUCT_H
+#define STRUCT_H
+
+#ifndef QCC_SUPPORT_STRUCT
+ #define _STRUCT_DECLARE(x, id, type, END) noref type x ##_## id ;
+ #define STRUCT_DECLARE(id, s) s(_STRUCT_DECLARE, id)
+
+ #define _STRUCT_PARAM_(x, id, type) type x ##_## id ,
+ #define _STRUCT_PARAM_END(x, id, type) type x ##_## id
+ #define _STRUCT_PARAM(x, id, type, isend) _STRUCT_PARAM_##isend(x, id, type)
+ #define STRUCT_PARAM(id, s) s(_STRUCT_PARAM, id)
+
+ #define _STRUCT_PASS_(x, id, type) x ##_## id ,
+ #define _STRUCT_PASS_END(x, id, type) x ##_## id
+ #define _STRUCT_PASS(x, id, type, END) _STRUCT_PASS_##END(x, id, type)
+ #define STRUCT_PASS(id, s) s(_STRUCT_PASS, id)
+
+ #define _STRUCT_STORE_DST(_, it) it
+ #define _STRUCT_STORE_SRC(it, _) it
+ #define _CONCAT3_(a, b, c) a ## b ## c
+ #define _CONCAT3(a, b, c) _CONCAT3_(a, b, c)
+ #define _STRUCT_STORE(x, id, type, END) _CONCAT3(_STRUCT_STORE_DST x, _, id) = _CONCAT3(_STRUCT_STORE_SRC x, _, id);
+ #define STRUCT_STORE(from, to, s) s(_STRUCT_STORE, (from, to))
+
+ #define STRUCT(id, ...)
+#else
+ #define STRUCT_DECLARE(id, type) type id;
+ #define STRUCT_PARAM(id, type) type id
+ #define STRUCT_PASS(id, type) id
+ #define STRUCT_STORE(from, to, s) to = from
+ #define _STRUCT_MEMBER(my, id, type, END) type id;
+ #define STRUCT(id, s) struct STRUCT_##id { s(_STRUCT_MEMBER, ) };
+#endif
+
+#endif
--- /dev/null
+#ifndef VECTOR_H
+#define VECTOR_H
+
+const vector eX = '1 0 0';
+const vector eY = '0 1 0';
+const vector eZ = '0 0 1';
+
+vector randompos(vector m1, vector m2)
+{
+ vector v;
+ m2 = m2 - m1;
+ v_x = m2_x * random() + m1_x;
+ v_y = m2_y * random() + m1_y;
+ v_z = m2_z * random() + m1_z;
+ return v;
+}
+
+float vlen2d(vector v)
+{
+ return sqrt(v.x * v.x + v.y * v.y);
+}
+
+float vlen_maxnorm2d(vector v)
+{
+ return max(v.x, v.y, -v.x, -v.y);
+}
+
+float vlen_minnorm2d(vector v)
+{
+ return min(max(v.x, -v.x), max(v.y, -v.y));
+}
+
+
+#endif
--- /dev/null
+#include "../common/util-pre.qh"
+#include "../dpdefs/menudefs.qh"
+#include "../dpdefs/keycodes.qh"
+#include "../common/util-post.qh"
+
+#include "../lib/_all.inc"
+
+#include "oo/classes.qc"
+
+#include "draw.qc"
+#include "menu.qc"
+
+#include "command/all.qc"
+
+#include "xonotic/util.qc"
+
+#include "../common/campaign_file.qc"
+#include "../common/campaign_setup.qc"
+#include "../common/mapinfo.qc"
+#include "../common/playerstats.qc"
+#include "../common/util.qc"
+
+#include "../common/items/all.qc"
+#include "../common/monsters/all.qc"
+#include "../common/mutators/all.qc"
+#include "../common/vehicles/all.qc"
+#include "../common/weapons/all.qc"
+
+#include "../mod/menu/progs.inc"
../../menu.dat
-
-../common/util-pre.qh
-../dpdefs/menudefs.qh
-../dpdefs/keycodes.qh
-../common/util-post.qh
-
-../lib/_all.inc
-
-oo/classes.qc
-
-draw.qc
-menu.qc
-
-command/all.qc
-
-xonotic/util.qc
-
-../common/campaign_file.qc
-../common/campaign_setup.qc
-../common/mapinfo.qc
-../common/playerstats.qc
-../common/util.qc
-
-../common/items/all.qc
-../common/monsters/all.qc
-../common/mutators/all.qc
-../common/vehicles/all.qc
-../common/weapons/all.qc
-
-
-../mod/menu/progs.inc
+progs.inc
ATTRIB(XonoticGameSettingsTab, intendedWidth, float, 0.9)
ATTRIB(XonoticGameSettingsTab, rows, float, 15.5)
ATTRIB(XonoticGameSettingsTab, columns, float, 6.5)
- ATTRIB(XonoticGameSettingsTab, topicList, entity, NEW(XonoticRegisteredSettingsList, NEW(SettingSource)))
+ ATTRIB(XonoticGameSettingsTab, source, DataSource, NEW(SettingSource))
+ ATTRIB(XonoticGameSettingsTab, topicList, entity, NEW(XonoticRegisteredSettingsList, this.source))
ATTRIB(XonoticGameSettingsTab, currentPanel, entity, NEW(XonoticTab))
ATTRIB(XonoticGameSettingsTab, currentItem, entity, NULL)
METHOD(XonoticGameSettingsTab, topicChangeNotify, void(entity, entity this))
GAMETYPE(MAPINFO_TYPE_ASSAULT) \
if (cvar("developer")) GAMETYPE(MAPINFO_TYPE_RACE) \
GAMETYPE(MAPINFO_TYPE_CTS) \
- //GAMETYPE(MAPINFO_TYPE_INVASION) \
- /* nothing */
+ /* GAMETYPE(MAPINFO_TYPE_INVASION) */ \
+ /**/
int GameType_GetID(int cnt)
{
void VoiceMessage(string type, string msg)
{SELFPARAM();
- var .string sample;
float voicetype, ownteam;
float flood;
- sample = GetVoiceMessageSampleField(type);
+ var .string sample = GetVoiceMessageSampleField(type);
if(GetPlayerSoundSampleField_notFound)
{
void set_flag_string(entity flag, .string field, string value, string teamname)
{
- if(flag.field == "")
- flag.field = strzone(sprintf(value,teamname));
+ if(flag.(field) == "")
+ flag.(field) = strzone(sprintf(value,teamname));
}
void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag entity on the map as a spawnfunc
{
FOREACH(BUFFS, it.m_itemid & _buffs, LAMBDA(return it));
}
- return BUFF_NULL;
+ return BUFF_Null;
}
bool buffs_BuffModel_Customize()
float buff_Available(entity buff)
{
- if (buff == BUFF_NULL)
+ if (buff == BUFF_Null)
return false;
if (buff == BUFF_AMMO && ((start_items & IT_UNLIMITED_WEAPON_AMMO) || (start_items & IT_UNLIMITED_AMMO) || (cvar("g_melee_only"))))
return false;
if(self.buffs != self.oldbuffs)
{
entity buff = buff_FirstFromFlags(self.buffs);
- float bufftime = buff != BUFF_NULL ? buff.m_time(buff) : 0;
+ float bufftime = buff != BUFF_Null ? buff.m_time(buff) : 0;
self.buff_time = (bufftime) ? time + bufftime : 0;
BUFF_ONADD(BUFF_AMMO)
--- /dev/null
+#include "../common/util-pre.qh"
+#include "sys-pre.qh"
+#include "../dpdefs/progsdefs.qh"
+#include "../dpdefs/dpextensions.qh"
+#include "sys-post.qh"
+#include "../common/util-post.qh"
+
+#include "../lib/_all.inc"
+
+#include "anticheat.qc"
+#include "antilag.qc"
+#include "campaign.qc"
+#include "cheats.qc"
+#include "cl_client.qc"
+#include "cl_impulse.qc"
+#include "cl_player.qc"
+#include "controlpoint.qc"
+#include "csqceffects.qc"
+#include "ent_cs.qc"
+#include "g_damage.qc"
+#include "g_hook.qc"
+// #include "g_lights.qc" // TODO: was never used
+#include "g_models.qc"
+#include "g_subs.qc"
+#include "g_violence.qc"
+#include "g_world.qc"
+#include "generator.qc"
+#include "ipban.qc"
+#include "item_key.qc"
+#include "mapvoting.qc"
+#include "miscfunctions.qc"
+#include "movelib.qc"
+// #include "pathlib.qc" // TODO: was never used. Seems to duplicate `pathlib/`
+#include "playerdemo.qc"
+#include "portals.qc"
+#include "race.qc"
+#include "round_handler.qc"
+#include "scores.qc"
+#include "scores_rules.qc"
+#include "spawnpoints.qc"
+#include "steerlib.qc"
+#include "sv_main.qc"
+#include "teamplay.qc"
+#include "t_halflife.qc"
+#include "t_items.qc"
+#include "t_quake3.qc"
+#include "t_quake.qc"
+
+#include "bot/aim.qc"
+#include "bot/bot.qc"
+#include "bot/navigation.qc"
+#include "bot/scripting.qc"
+#include "bot/waypoints.qc"
+
+#include "bot/havocbot/havocbot.qc"
+#include "bot/havocbot/role_keyhunt.qc"
+#include "bot/havocbot/roles.qc"
+
+#include "command/all.qc"
+
+#include "mutators/mutators_include.qc"
+#include "mutators/mutators.qc"
+
+#include "pathlib/costs.qc"
+#include "pathlib/expandnode.qc"
+#include "pathlib/main.qc"
+#include "pathlib/movenode.qc"
+#include "pathlib/path_waypoint.qc"
+#include "pathlib/utility.qc"
+
+#include "weapons/accuracy.qc"
+#include "weapons/common.qc"
+#include "weapons/csqcprojectile.qc" // TODO
+#include "weapons/hitplot.qc"
+#include "weapons/selection.qc"
+#include "weapons/spawning.qc"
+#include "weapons/throwing.qc"
+#include "weapons/tracing.qc"
+#include "weapons/weaponstats.qc"
+#include "weapons/weaponsystem.qc"
+
+#include "../common/animdecide.qc"
+#include "../common/buffs.qc"
+#include "../common/campaign_file.qc"
+#include "../common/campaign_setup.qc"
+#include "../common/effects.qc"
+#include "../common/mapinfo.qc"
+#include "../common/monsters/spawn.qc"
+#include "../common/monsters/sv_monsters.qc"
+#include "../common/minigames/minigames.qc"
+#include "../common/minigames/sv_minigames.qc"
+#include "../common/movetypes/include.qc"
+#include "../common/nades.qc"
+#include "../common/net_notice.qc"
+#include "../common/notifications.qc"
+#include "../common/physics.qc"
+#include "../common/playerstats.qc"
+#include "../common/viewloc.qc"
+#include "../common/triggers/include.qc"
+#include "../common/util.qc"
+
+#include "../common/items/all.qc"
+#include "../common/monsters/all.qc"
+#include "../common/mutators/all.qc"
+#include "../common/vehicles/all.qc"
+#include "../common/weapons/all.qc" // TODO
+
+#include "../common/turrets/sv_turrets.qc"
+#include "../common/turrets/config.qc"
+#include "../common/turrets/util.qc"
+#include "../common/turrets/turrets.qc"
+#include "../common/turrets/checkpoint.qc"
+#include "../common/turrets/targettrigger.qc"
+#include "../common/weapons/config.qc"
+
+#include "../csqcmodellib/sv_model.qc"
+
+#include "../warpzonelib/anglestransform.qc"
+#include "../warpzonelib/common.qc"
+#include "../warpzonelib/server.qc"
+#include "../warpzonelib/util_server.qc"
+
+#include "../mod/server/progs.inc"
../../progs.dat
-
-../common/util-pre.qh
-sys-pre.qh
-../dpdefs/progsdefs.qh
-../dpdefs/dpextensions.qh
-sys-post.qh
-../common/util-post.qh
-
-../lib/_all.inc
-
-anticheat.qc
-antilag.qc
-campaign.qc
-cheats.qc
-cl_client.qc
-cl_impulse.qc
-cl_player.qc
-controlpoint.qc
-csqceffects.qc
-ent_cs.qc
-g_damage.qc
-g_hook.qc
-// g_lights.qc // TODO: was never used
-g_models.qc
-g_subs.qc
-g_violence.qc
-g_world.qc
-generator.qc
-ipban.qc
-item_key.qc
-mapvoting.qc
-miscfunctions.qc
-movelib.qc
-// pathlib.qc // TODO: was never used. Seems to duplicate `pathlib/`
-playerdemo.qc
-portals.qc
-race.qc
-round_handler.qc
-scores.qc
-scores_rules.qc
-spawnpoints.qc
-steerlib.qc
-sv_main.qc
-teamplay.qc
-t_halflife.qc
-t_items.qc
-t_quake3.qc
-t_quake.qc
-
-bot/aim.qc
-bot/bot.qc
-bot/navigation.qc
-bot/scripting.qc
-bot/waypoints.qc
-
-bot/havocbot/havocbot.qc
-bot/havocbot/role_keyhunt.qc
-bot/havocbot/roles.qc
-
-command/all.qc
-
-mutators/mutators_include.qc
-mutators/mutators.qc
-
-pathlib/costs.qc
-pathlib/expandnode.qc
-pathlib/main.qc
-pathlib/movenode.qc
-pathlib/path_waypoint.qc
-pathlib/utility.qc
-
-weapons/accuracy.qc
-weapons/common.qc
-weapons/csqcprojectile.qc // TODO
-weapons/hitplot.qc
-weapons/selection.qc
-weapons/spawning.qc
-weapons/throwing.qc
-weapons/tracing.qc
-weapons/weaponstats.qc
-weapons/weaponsystem.qc
-
-../common/animdecide.qc
-../common/buffs.qc
-../common/campaign_file.qc
-../common/campaign_setup.qc
-../common/effects.qc
-../common/mapinfo.qc
-../common/monsters/spawn.qc
-../common/monsters/sv_monsters.qc
-../common/minigames/minigames.qc
-../common/minigames/sv_minigames.qc
-../common/movetypes/include.qc
-../common/nades.qc
-../common/net_notice.qc
-../common/notifications.qc
-../common/physics.qc
-../common/playerstats.qc
-../common/viewloc.qc
-../common/triggers/include.qc
-../common/util.qc
-
-../common/items/all.qc
-../common/monsters/all.qc
-../common/mutators/all.qc
-../common/vehicles/all.qc
-../common/weapons/all.qc // TODO
-
-../common/turrets/sv_turrets.qc
-../common/turrets/config.qc
-../common/turrets/util.qc
-../common/turrets/turrets.qc
-../common/turrets/checkpoint.qc
-../common/turrets/targettrigger.qc
-../common/weapons/config.qc
-
-../csqcmodellib/sv_model.qc
-
-../warpzonelib/anglestransform.qc
-../warpzonelib/common.qc
-../warpzonelib/server.qc
-../warpzonelib/util_server.qc
-
-../mod/server/progs.inc
+progs.inc
#!/usr/bin/env bash
cd ${0%[\\/]*}
-find . -name .git -prune -o -type f -print0 | \
+find . -name .git -prune -o -type f -print0 | \
xargs -0 sed -i \
`# strip trailing spaces` \
-e 's/[[:space:]]*$//' \