seta cl_weaponpriority "vaporizer vortex fireball mortar machinegun hagar rifle arc electro devastator crylink minelayer shotgun hlac tuba blaster porto seeker hook" "weapon priority list"
seta cl_weaponpriority_useforcycling 0 "when set, weapon cycling by the mouse wheel makes use of the weapon priority list (the special value 2 uses the weapon ID list for cycling)"
-seta cl_weaponpriority0 "devastator mortar hagar seeker fireball" "use impulse 200 for prev gun from this list, 210 for best gun, 220 for next gun. Default value: explosives"
-seta cl_weaponpriority1 "vaporizer vortex crylink hlac arc electro blaster shockwave" "use impulse 201 for prev gun from this list, 211 for best gun, 221 for next gun. Default value: energy"
-seta cl_weaponpriority2 "vaporizer vortex rifle" "use impulse 202 for prev gun from this list, 212 for best gun, 222 for next gun. Default value: hitscan exact"
-seta cl_weaponpriority3 "vaporizer vortex rifle machinegun shotgun" "use impulse 203 for prev gun from this list, 213 for best gun, 223 for next gun. Default value: hitscan all"
-seta cl_weaponpriority4 "mortar minelayer hlac hagar crylink seeker shotgun" "use impulse 204 for prev gun from this list, 214 for best gun, 224 for next gun. Default value: spam weapons"
-seta cl_weaponpriority5 "blaster shockwave hook porto" "use impulse 205 for prev gun from this list, 215 for best gun, 225 for next gun. Default value: weapons for moving"
-seta cl_weaponpriority6 "" "use impulse 206 for prev gun from this list, 216 for best gun, 226 for next gun"
-seta cl_weaponpriority7 "" "use impulse 207 for prev gun from this list, 217 for best gun, 227 for next gun"
-seta cl_weaponpriority8 "" "use impulse 208 for prev gun from this list, 218 for best gun, 228 for next gun"
-seta cl_weaponpriority9 "" "use impulse 209 for prev gun from this list, 219 for best gun, 229 for next gun"
+seta cl_weaponpriority0 "devastator mortar hagar seeker fireball" "use weapon_priority_0_prev for prev gun from this list, weapon_priority_0_best for best gun, weapon_priority_0_next for next gun. Default value: explosives"
+seta cl_weaponpriority1 "vaporizer vortex crylink hlac arc electro blaster shockwave" "use weapon_priority_1_prev for prev gun from this list, weapon_priority_1_best for best gun, weapon_priority_1_next for next gun. Default value: energy"
+seta cl_weaponpriority2 "vaporizer vortex rifle" "use weapon_priority_2_prev for prev gun from this list, weapon_priority_2_best for best gun, weapon_priority_2_next for next gun. Default value: hitscan exact"
+seta cl_weaponpriority3 "vaporizer vortex rifle machinegun shotgun" "use weapon_priority_3_prev for prev gun from this list, weapon_priority_3_best for best gun, weapon_priority_3_next for next gun. Default value: hitscan all"
+seta cl_weaponpriority4 "mortar minelayer hlac hagar crylink seeker shotgun" "use weapon_priority_4_prev for prev gun from this list, weapon_priority_4_best for best gun, weapon_priority_4_next for next gun. Default value: spam weapons"
+seta cl_weaponpriority5 "blaster shockwave hook porto" "use weapon_priority_5_prev for prev gun from this list, weapon_priority_5_best for best gun, weapon_priority_5_next for next gun. Default value: weapons for moving"
+seta cl_weaponpriority6 "" "use weapon_priority_6_prev for prev gun from this list, weapon_priority_6_best for best gun, weapon_priority_6_next for next gun"
+seta cl_weaponpriority7 "" "use weapon_priority_7_prev for prev gun from this list, weapon_priority_7_best for best gun, weapon_priority_7_next for next gun"
+seta cl_weaponpriority8 "" "use weapon_priority_8_prev for prev gun from this list, weapon_priority_8_best for best gun, weapon_priority_8_next for next gun"
+seta cl_weaponpriority9 "" "use weapon_priority_9_prev for prev gun from this list, weapon_priority_9_best for best gun, weapon_priority_9_next for next gun"
seta cl_weaponimpulsemode 0 "0: only cycle between currently usable weapons in weapon priority order; 1: cycle between all possible weapons on a key in weapon priority order"
set g_maplist_allow_hidden 0 "allow hidden maps to be, e.g., voted for and in the maplist"
-// bulldozer storage "level4" last updated 16-11-2015 04:16:07
-nextlevel = "level1"
-"e15" 3 "0 0 0"
-"f14" 3 "0 0 0"
-"g13" 3 "0 0 0"
-"k13" 3 "0 0 0"
-"b14" 4 "0 0 0"
-"a14" 4 "0 0 0"
-"a13" 4 "0 0 0"
-"b13" 4 "0 0 0"
-"i13" 3 "0 0 0"
-"m13" 3 "0 0 0"
-"n14" 3 "0 0 0"
-"o15" 3 "0 0 0"
-"h17" 2 "0 0 0"
-"l17" 2 "0 0 0"
-"c12" 2 "0 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 -1 0"
+"s9" 6 "0 -1 0"
+"t9" 6 "0 -1 0"
+"t18" 6 "0 -1 0"
+"t19" 6 "0 -1 0"
+"t20" 6 "0 -1 0"
+"s20" 6 "0 -1 0"
+"r20" 6 "0 -1 0"
+"q20" 6 "0 -1 0"
+"p20" 6 "0 -1 0"
+"o20" 6 "0 -1 0"
+"n20" 6 "0 -1 0"
+"m20" 6 "0 -1 0"
+"l20" 6 "0 -1 0"
+"k20" 6 "0 -1 0"
+"j20" 6 "0 -1 0"
+"i20" 6 "0 -1 0"
+"h20" 6 "0 -1 0"
+"g20" 6 "0 -1 0"
+"f20" 6 "0 -1 0"
+"e20" 6 "0 -1 0"
+"d20" 6 "0 -1 0"
+"c20" 6 "0 -1 0"
+"b20" 6 "0 -1 0"
+"a20" 6 "0 -1 0"
+"a19" 6 "0 -1 0"
+"a18" 6 "0 -1 0"
+"d19" 6 "0 -1 0"
+"e19" 6 "0 -1 0"
+"f19" 6 "0 -1 0"
+"g19" 6 "0 -1 0"
+"h19" 6 "0 -1 0"
+"i19" 6 "0 -1 0"
+"j19" 6 "0 -1 0"
+"k19" 6 "0 -1 0"
+"l19" 6 "0 -1 0"
+"m19" 6 "0 -1 0"
+"n19" 6 "0 -1 0"
+"o19" 6 "0 -1 0"
+"p19" 6 "0 -1 0"
+"q19" 6 "0 -1 0"
+"q18" 6 "0 -1 0"
+"p18" 6 "0 -1 0"
+"o18" 6 "0 -1 0"
+"n18" 6 "0 -1 0"
+"m18" 6 "0 -1 0"
+"l18" 6 "0 -1 0"
+"k18" 6 "0 -1 0"
+"j18" 6 "0 -1 0"
+"i18" 6 "0 -1 0"
+"h18" 6 "0 -1 0"
+"g18" 6 "0 -1 0"
+"f18" 6 "0 -1 0"
+"e18" 6 "0 -1 0"
+"d18" 6 "0 -1 0"
--- /dev/null
+// bulldozer storage "level7" last updated 06-12-2015 16:19:03
+nextlevel = "level8"
+"g10" 5 "0 -1 0"
+"g9" 5 "0 -1 0"
+"g8" 5 "0 -1 0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 0"
+"m19" 4 "0 -1 0"
+"n19" 4 "0 -1 0"
+"o19" 4 "0 -1 0"
+"p19" 4 "0 -1 0"
+"q19" 4 "0 -1 0"
+"r19" 4 "0 -1 0"
+"s19" 4 "0 -1 0"
+"t19" 4 "0 -1 0"
+"t18" 4 "0 -1 0"
+"s18" 4 "0 -1 0"
+"r18" 4 "0 -1 0"
+"q18" 4 "0 -1 0"
+"p18" 4 "0 -1 0"
+"o18" 4 "0 -1 0"
+"n18" 4 "0 -1 0"
+"m18" 4 "0 -1 0"
+"l18" 4 "0 -1 0"
+"k18" 4 "0 -1 0"
+"j18" 4 "0 -1 0"
+"s17" 4 "0 -1 0"
+"t17" 4 "0 -1 0"
+"t20" 4 "0 -1 0"
+"s20" 4 "0 -1 0"
+"r20" 4 "0 -1 0"
+"q20" 4 "0 -1 0"
+"p20" 4 "0 -1 0"
+"o20" 4 "0 -1 0"
+"n20" 4 "0 -1 0"
+"m20" 4 "0 -1 0"
+"l20" 4 "0 -1 0"
+"k20" 4 "0 -1 0"
+"j20" 4 "0 -1 0"
+"i20" 4 "0 -1 0"
+"h20" 4 "0 -1 0"
+"g20" 4 "0 -1 0"
+"f20" 4 "0 -1 0"
+"e20" 4 "0 -1 0"
+"d20" 4 "0 -1 0"
+"c20" 4 "0 -1 0"
+"b20" 4 "0 -1 0"
+"a20" 4 "0 -1 0"
+"p14" 4 "0 -1 0"
--- /dev/null
+// bulldozer storage "level4" last updated 16-11-2015 04:16:07
+nextlevel = "level1"
+"e15" 3 "0 0 0"
+"f14" 3 "0 0 0"
+"g13" 3 "0 0 0"
+"k13" 3 "0 0 0"
+"b14" 4 "0 0 0"
+"a14" 4 "0 0 0"
+"a13" 4 "0 0 0"
+"b13" 4 "0 0 0"
+"i13" 3 "0 0 0"
+"m13" 3 "0 0 0"
+"n14" 3 "0 0 0"
+"o15" 3 "0 0 0"
+"h17" 2 "0 0 0"
+"l17" 2 "0 0 0"
+"c12" 2 "0 0 0"
+"c13" 2 "0 0 0"
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
+"m19" 4 "0 0 0"
+"l19" 4 "0 0 0"
+"k19" 4 "0 0 0"
+"j19" 4 "0 0 0"
+"i19" 4 "0 0 0"
+"h19" 4 "0 0 0"
+"g19" 4 "0 0 0"
+"f19" 4 "0 0 0"
+"e19" 4 "0 0 0"
+"d19" 4 "0 0 0"
+"c19" 4 "0 0 0"
+"b19" 4 "0 0 0"
+"a19" 4 "0 0 0"
+"a20" 4 "0 0 0"
+"b20" 4 "0 0 0"
+"c20" 4 "0 0 0"
+"d20" 4 "0 0 0"
+"e20" 4 "0 0 0"
+"f20" 4 "0 0 0"
+"g20" 4 "0 0 0"
+"h20" 4 "0 0 0"
+"i20" 4 "0 0 0"
+"j20" 4 "0 0 0"
+"k20" 4 "0 0 0"
+"l20" 4 "0 0 0"
+"m20" 4 "0 0 0"
+"n20" 4 "0 0 0"
+"o20" 4 "0 0 0"
+"p20" 4 "0 0 0"
+"q20" 4 "0 0 0"
+"r20" 4 "0 0 0"
+"s20" 4 "0 0 0"
+"t20" 4 "0 0 0"
-sprite,models/ok_nade_counter/ok_nade_counter_10
\ No newline at end of file
+sprite,models/ok_nade_counter/ok_nade_counter_09
\ No newline at end of file
PERL ?= perl
QCCFLAGS_WATERMARK ?= -DWATERMARK='"$(shell git describe)"'
QCC ?= gmqcc
+NDEBUG ?= 1
QCCVERSIONFILE := qccversion.$(shell (cd server && $(QCC) --version) > qccversion.txt && git hash-object qccversion.txt)
-fftepp -flno -futf8 -fno-bail-on-werror -fftepp-predefs \
-frelaxed-switch -freturn-assignments \
$(QCCFLAGS_WATERMARK) \
- -DNDEBUG=1 \
+ -DNDEBUG=$(NDEBUG) \
$(QCCFLAGS_FEATURES) \
$(QCCFLAGS_EXTRA)
FILES_CSPROGS = $(shell find lib common client -type f)
../csprogs.dat: $(FILES_CSPROGS) $(QCCVERSIONFILE)
@echo make[1]: Entering directory \`$(PWD)/client\'
- cd client && $(QCC) $(QCCFLAGS) -DCSQC
+ cd client && $(QCC) $(QCCFLAGS) -DCSQC -o ../../csprogs.dat progs.inc
FILES_PROGS = $(shell find lib common server -type f)
../progs.dat: $(FILES_PROGS) $(QCCVERSIONFILE)
@echo make[1]: Entering directory \`$(PWD)/server\'
- cd server && $(QCC) $(QCCFLAGS) -DSVQC
+ cd server && $(QCC) $(QCCFLAGS) -DSVQC -o ../../progs.dat progs.inc
FILES_MENU = $(shell find lib common menu -type f)
../menu.dat: $(FILES_MENU) $(QCCVERSIONFILE)
@echo make[1]: Entering directory \`$(PWD)/menu\'
- cd menu && $(QCC) $(QCCFLAGS) -DMENUQC
+ cd menu && $(QCC) $(QCCFLAGS) -DMENUQC -o ../../menu.dat progs.inc
.PHONY: testcase
testcase:
int autocvar_ekg;
float autocvar_fov;
float autocvar_g_balance_damagepush_speedfactor;
-float autocvar_g_balance_tuba_attenuation;
-float autocvar_g_balance_tuba_fadetime;
-float autocvar_g_balance_tuba_volume;
-int autocvar_g_balance_tuba_pitchstep;
float autocvar_g_warmup_limit;
bool autocvar_hud_cursormode = true;
float autocvar_hud_colorflash_alpha;
// player "pops in"
if(isnew)
{
-#define FIX_FRAMETIME(f,ft) do { \
+#define FIX_FRAMETIME(f,ft) MACRO_BEGIN { \
if(IS_DEAD_FRAME(self.f) && self.ft != 0 && self.death_time != 0) \
self.ft = self.death_time; \
-} while(0)
+} MACRO_END
FIX_FRAMETIME(frame, frame1time);
FIX_FRAMETIME(frame2, frame2time);
#ifdef CSQCMODEL_HAVE_TWO_FRAMES
float w_issilent, w_random;
vector w_org, w_backoff;
-float rifle_scope;
-float vortex_scope;
-
-float minelayer_maxmines;
-
-float hagar_maxrockets;
-
float bgmtime;
string weaponorder_byimpulse;
#define player_currententnum (spectatee_status > 0 ? spectatee_status : player_localnum + 1)
-float g_balance_porto_secondary;
#endif
#define HUD_PANEL(NAME) HUD_PANEL_##NAME
// draw the background/borders
-#define HUD_Panel_DrawBg(theAlpha) do { \
+#define HUD_Panel_DrawBg(theAlpha) MACRO_BEGIN { \
if(panel.current_panel_bg != "0" && panel.current_panel_bg != "") \
draw_BorderPicture(panel_pos - '1 1 0' * panel_bg_border, panel.current_panel_bg, panel_size + '1 1 0' * 2 * panel_bg_border, panel_bg_color, panel_bg_alpha * theAlpha, '1 1 0' * (panel_bg_border/BORDER_MULTIPLIER));\
-} while(0)
+} MACRO_END
int panel_order[hud_panels_MAX];
string hud_panelorder_prev;
// Get value for panel.current_panel_bg: if "" fetch default, else use panel_bg_str
// comment on last line of macro: // we probably want to see a background in config mode at all times...
-#define HUD_Panel_GetBg() do { \
+#define HUD_Panel_GetBg() MACRO_BEGIN { \
string panel_bg; \
if (!autocvar__hud_configure && panel_bg_str == "0") { \
panel_bg = "0"; \
if (panel.current_panel_bg) \
strunzone(panel.current_panel_bg); \
panel.current_panel_bg = strzone(panel_bg); \
-} while(0)
+} MACRO_END
// Get value for panel_bg_color: if "" fetch default, else use panel_bg_color. Convert pants, shirt or teamcolor into a vector.
-#define HUD_Panel_GetColor() do { \
+#define HUD_Panel_GetColor() MACRO_BEGIN { \
if ((teamplay) && panel_bg_color_team) { \
if (autocvar__hud_configure && myteam == NUM_SPECTATOR) \
panel_bg_color = '1 0 0' * panel_bg_color_team; \
} \
} \
} \
-} while(0)
+} MACRO_END
// Get value for panel_bg_color_team: if "" fetch default, else use panel_bg_color_team_str
-#define HUD_Panel_GetColorTeam() do { \
+#define HUD_Panel_GetColorTeam() MACRO_BEGIN { \
if (panel_bg_color_team_str == "") { \
panel_bg_color_team = autocvar_hud_panel_bg_color_team; \
} else { \
panel_bg_color_team = stof(panel_bg_color_team_str); \
} \
-} while(0)
+} MACRO_END
// Get value for panel_bg_alpha: if "" fetch default, else use panel_bg_alpha. Also do various menu dialog fadeout/in checks, and minalpha checks
// comment on line 3 of macro: // do not set a minalpha cap when showing the config dialog for this panel
-#define HUD_Panel_GetBgAlpha() do { \
+#define HUD_Panel_GetBgAlpha() MACRO_BEGIN { \
if (panel_bg_alpha_str == "") { \
panel_bg_alpha_str = ftos(autocvar_hud_panel_bg_alpha); \
} \
else \
panel_bg_alpha = max(cvar("hud_configure_bg_minalpha"), panel_bg_alpha); \
} \
-} while(0)
+} MACRO_END
// Get value for panel_fg_alpha. Also do various minalpha checks
// comment on line 2 of macro: // ALWAYS show disabled panels at 0.25 alpha when in config mode
-#define HUD_Panel_GetFgAlpha() do { \
+#define HUD_Panel_GetFgAlpha() MACRO_BEGIN { \
panel_fg_alpha = autocvar_hud_panel_fg_alpha; \
if (autocvar__hud_configure && !panel_enabled) \
panel_fg_alpha = 0.25; \
-} while(0)
+} MACRO_END
// Get border. See comments above, it's similar.
-#define HUD_Panel_GetBorder() do { \
+#define HUD_Panel_GetBorder() MACRO_BEGIN { \
if (panel_bg_border_str == "") { \
panel_bg_border = autocvar_hud_panel_bg_border; \
} else { \
panel_bg_border = stof(panel_bg_border_str); \
} \
-} while(0)
+} MACRO_END
// Get padding. See comments above, it's similar.
// last line is a port of the old function, basically always make sure the panel contents are at least 5 pixels tall/wide, to disallow extreme padding values
-#define HUD_Panel_GetPadding() do { \
+#define HUD_Panel_GetPadding() MACRO_BEGIN { \
if (panel_bg_padding_str == "") { \
panel_bg_padding = autocvar_hud_panel_bg_padding; \
} else { \
panel_bg_padding = stof(panel_bg_padding_str); \
} \
panel_bg_padding = min(min(panel_size.x, panel_size.y)/2 - 5, panel_bg_padding); \
-} while(0)
+} MACRO_END
// return smoothly faded pos and size of given panel when a dialog is active
// don't center too wide panels, it doesn't work with different resolutions
-#define HUD_Panel_UpdatePosSize_ForMenu() do { \
+#define HUD_Panel_UpdatePosSize_ForMenu() MACRO_BEGIN { \
vector menu_enable_size = panel_size; \
float max_panel_width = 0.52 * vid_conwidth; \
if(panel_size.x > max_panel_width) \
vector menu_enable_pos = eX * (panel_bg_border + 0.5 * max_panel_width) + eY * 0.5 * vid_conheight - 0.5 * menu_enable_size; \
panel_pos = (1 - autocvar__menu_alpha) * panel_pos + (autocvar__menu_alpha) * menu_enable_pos; \
panel_size = (1 - autocvar__menu_alpha) * panel_size + (autocvar__menu_alpha) * menu_enable_size; \
-} while(0)
+} MACRO_END
// Scale the pos and size vectors to absolute coordinates
-#define HUD_Panel_ScalePosSize() do { \
+#define HUD_Panel_ScalePosSize() MACRO_BEGIN { \
panel_pos.x *= vid_conwidth; panel_pos.y *= vid_conheight; \
panel_size.x *= vid_conwidth; panel_size.y *= vid_conheight; \
-} while(0)
+} MACRO_END
// NOTE: in hud_configure mode cvars must be reloaded every frame
-#define HUD_Panel_UpdateCvars() do { \
+#define HUD_Panel_UpdateCvars() MACRO_BEGIN { \
if (panel.update_time <= time) { \
if (autocvar__hud_configure) panel_enabled = cvar(strcat("hud_panel_", panel.panel_name)); \
panel_pos = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_pos"))); \
panel_bg_padding = panel.current_panel_bg_padding; \
panel_fg_alpha = panel.current_panel_fg_alpha * hud_fade_alpha; \
} \
-} while(0)
+} MACRO_END
-#define HUD_Panel_UpdatePosSize() do { \
+#define HUD_Panel_UpdatePosSize() MACRO_BEGIN { \
panel_enabled = cvar(strcat("hud_panel_", panel.panel_name)); \
panel_pos = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_pos"))); \
panel_size = stov(cvar_string(strcat("hud_panel_", panel.panel_name, "_size"))); \
} \
panel_bg_border_str = cvar_string(strcat("hud_panel_", panel.panel_name, "_bg_border")); \
HUD_Panel_GetBorder(); \
-} while(0)
+} MACRO_END
const int NOTIFY_MAX_ENTRIES = 10;
const float NOTIFY_ICON_MARGIN = 0.02;
Weapon wep = switchweapon;
int i;
- bool infinite_ammo = (getstati(STAT_ITEMS, 0, 24) & IT_UNLIMITED_WEAPON_AMMO);
+ bool infinite_ammo = (STAT(ITEMS) & IT_UNLIMITED_WEAPON_AMMO);
row = column = 0;
if(autocvar_hud_panel_ammo_onlycurrent)
{
if(hud != HUD_NORMAL) return;
if(spectatee_status == -1) return;
- health = getstati(STAT_HEALTH);
+ health = STAT(HEALTH);
if(health <= 0)
{
prev_health = -1;
return;
}
- armor = getstati(STAT_ARMOR);
+ armor = STAT(ARMOR);
// code to check for spectatee_status changes is in Ent_ClientData()
// prev_p_health and prev_health can be set to -1 there
// Info messages panel (#14)
-#define drawInfoMessage(s) do { \
+#define drawInfoMessage(s) MACRO_BEGIN { \
if(autocvar_hud_panel_infomessages_flip) \
o.x = pos.x + mySize.x - stringwidth(s, true, fontsize); \
drawcolorcodedstring(o, s, fontsize, a, DRAWFLAG_NORMAL); \
o.y += fontsize.y; \
-} while(0)
+} MACRO_END
void HUD_InfoMessages()
{
if(!autocvar__hud_configure)
}
// when status CHANGES, set old status into prevstatus and current status into status
- #define X(team) do { \
+ #define X(team) MACRO_BEGIN { \
if (team##flag != team##flag_prevframe) { \
team##flag_statuschange_time = time; \
team##flag_prevstatus = team##flag_prevframe; \
team##flag_prevframe = team##flag; \
} \
team##flag_statuschange_elapsedtime = time - team##flag_statuschange_time; \
- } while (0)
+ } MACRO_END
X(red);
X(blue);
X(yellow);
string team##_icon, team##_icon_prevstatus; \
int team##_alpha, team##_alpha_prevstatus; \
team##_alpha = team##_alpha_prevstatus = 1; \
- do { \
+ MACRO_BEGIN { \
switch (team##flag) { \
case 1: team##_icon = "flag_" #team "_taken"; break; \
case 2: team##_icon = "flag_" #team "_lost"; break; \
} \
break; \
} \
- } while (0)
+ } MACRO_END
X(red, myteam != NUM_TEAM_1);
X(blue, myteam != NUM_TEAM_2);
X(yellow, myteam != NUM_TEAM_3);
neutralflag_pos = pos;
flag_size = e1 * fs * size1 + e2 * size2;
- #define X(team) do { \
+ #define X(team) MACRO_BEGIN { \
f = bound(0, team##flag_statuschange_elapsedtime * 2, 1); \
if (team##_icon_prevstatus && f < 1) \
drawpic_aspect_skin_expanding(team##flag_pos, team##_icon_prevstatus, flag_size, '1 1 1', panel_fg_alpha * team##_alpha_prevstatus, DRAWFLAG_NORMAL, f); \
if (team##_icon) \
drawpic_aspect_skin(team##flag_pos, team##_icon, flag_size, '1 1 1', panel_fg_alpha * team##_alpha * f, DRAWFLAG_NORMAL); \
- } while (0)
+ } MACRO_END
X(red);
X(blue);
X(yellow);
float BLINK_FREQ = 5;
float kaball_alpha = BLINK_BASE + BLINK_FACTOR * cos(time * BLINK_FREQ);
- int stat_items = getstati(STAT_ITEMS, 0, 24);
+ int stat_items = STAT(ITEMS);
int kaball = (stat_items/IT_KEY1) & 1;
if(kaball != kaball_prevstatus)
float nb_pb_starttime, dt, p;
int stat_items;
- stat_items = getstati(STAT_ITEMS, 0, 24);
+ stat_items = STAT(ITEMS);
nb_pb_starttime = STAT(NB_METERSTART);
if (stat_items & IT_KEY1)
void HUD_Powerups()
{
- int allItems = getstati(STAT_ITEMS, 0, 24);
+ int allItems = STAT(ITEMS);
int allBuffs = STAT(BUFFS);
int strengthTime, shieldTime, superTime;
{
if(!autocvar_hud_panel_powerups) return;
if(spectatee_status == -1) return;
- if(getstati(STAT_HEALTH) <= 0) return;
+ if(STAT(HEALTH) <= 0) return;
if(!(allItems & (ITEM_Strength.m_itemid | ITEM_Shield.m_itemid | IT_SUPERWEAPON)) && !allBuffs) return;
strengthTime = bound(0, STAT(STRENGTH_FINISHED) - time, 99);
return false;
}
- if ( getstati(STAT_HEALTH) <= 0 )
+ if ( STAT(HEALTH) <= 0 )
{
// Show scoreboard
if ( bInputType < 2 )
{
string message = "Click to select teleport destination";
- if ( getstati(STAT_HEALTH) <= 0 )
+ if ( STAT(HEALTH) <= 0 )
{
message = "Click to select spawn location";
}
string weaponorder_cmp_str;
int weaponorder_cmp(int i, int j, entity pass)
{
- int ai, aj;
- ai = strstrofs(weaponorder_cmp_str, sprintf(" %d ", weaponorder[i].weapon), 0);
- aj = strstrofs(weaponorder_cmp_str, sprintf(" %d ", weaponorder[j].weapon), 0);
+ int ai = strstrofs(weaponorder_cmp_str, sprintf(" %d ", weaponorder[i].m_id), 0);
+ int aj = strstrofs(weaponorder_cmp_str, sprintf(" %d ", weaponorder[j].m_id), 0);
return aj - ai; // the string is in REVERSE order (higher prio at the right is what we want, but higher prio first is the string)
}
// do we own this weapon?
weapon_count = 0;
for(i = 0; i <= WEP_LAST-WEP_FIRST; ++i)
- if((weapons_stat & WepSet_FromWeapon(Weapons_from(weaponorder[i].weapon))) || (weaponorder[i].weapon == complain_weapon))
+ if((weapons_stat & WepSet_FromWeapon(weaponorder[i])) || (weaponorder[i].m_id == complain_weapon))
++weapon_count;
// retrieve information about the current weapon to be drawn
setself(weaponorder[i]);
weapon_id = self.impulse;
- isCurrent = (self.weapon == switchweapon.m_id);
+ isCurrent = (self == switchweapon);
// skip if this weapon doesn't exist
if(!self || weapon_id < 0) { continue; }
// skip this weapon if we don't own it (and onlyowned is enabled)-- or if weapons_complainbubble is showing for this weapon
if(autocvar_hud_panel_weapons_onlyowned)
- if (!((weapons_stat & WepSet_FromWeapon(Weapons_from(self.weapon))) || (self.weapon == complain_weapon)))
+ if (!((weapons_stat & WepSet_FromWeapon(self)) || (self.m_id == complain_weapon)))
continue;
// figure out the drawing position of weapon
// draw the weapon accuracy
if(autocvar_hud_panel_weapons_accuracy)
{
- float panel_weapon_accuracy = weapon_accuracy[self.weapon-WEP_FIRST];
+ float panel_weapon_accuracy = weapon_accuracy[self.m_id-WEP_FIRST];
if(panel_weapon_accuracy >= 0)
{
color = Accuracy_GetColor(panel_weapon_accuracy);
}
// drawing all the weapon items
- if(weapons_stat & WepSet_FromWeapon(Weapons_from(self.weapon)))
+ if(weapons_stat & WepSet_FromWeapon(self))
{
// draw the weapon image
if(isCurrent)
}
// draw the complain message
- if(self.weapon == complain_weapon)
+ if(self.m_id == complain_weapon)
{
if(fadetime)
a = ((complain_weapon_time + when > time) ? 1 : bound(0, (complain_weapon_time + when + fadetime - time) / fadetime, 1));
LOG_INFOF("^4CSQC Build information: ^1%s\n", WATERMARK);
#endif
+ // needs to be done so early because of the constants they create
+ static_init();
+ static_init_late();
+ static_init_precache();
+
binddb = db_create();
tempdb = db_create();
ClientProgsDB = db_load("client.db");
GetTeam(NUM_SPECTATOR, true); // add specs first
- // needs to be done so early because of the constants they create
- static_init();
- static_init_late();
- static_init_precache();
-
// precaches
if(autocvar_cl_reticle)
.float has_team;
float SetTeam(entity o, int Team)
{
+ assert_once(Team);
entity tm;
if(teamplay)
{
e.ping_packetloss = 0;
e.ping_movementloss = 0;
//e.gotscores = 0; // we might already have the scores...
- SetTeam(e, entcs_GetTeam(i)); // will not hurt; later updates come with HUD_UpdatePlayerTeams
+ int t = entcs_GetScoreTeam(i);
+ if (t) SetTeam(e, t); // will not hurt; later updates come with HUD_UpdatePlayerTeams
RegisterPlayer(e);
HUD_UpdatePlayerPos(e);
}
if(!isNew && n != this.sv_entnum)
{
//print("A CSQC entity changed its owner!\n");
- LOG_INFOF("A CSQC entity changed its owner! (edict: %d, classname: %s)\n", num_for_edict(this), this.classname);
+ LOG_INFOF("A CSQC entity changed its owner! (edict: %d, classname: %s)\n", etof(this), this.classname);
isNew = true;
Ent_Remove();
}
{
if (t != this.enttype || isnew)
{
- LOG_INFOF("A CSQC entity changed its type! (edict: %d, server: %d, type: %d -> %d)\n", num_for_edict(this), this.entnum, this.enttype, t);
+ LOG_INFOF("A CSQC entity changed its type! (edict: %d, server: %d, type: %d -> %d)\n", etof(this), this.entnum, this.enttype, t);
Ent_Remove();
clearentity(this);
isnew = true;
{
if (!isnew)
{
- LOG_INFOF("A CSQC entity appeared out of nowhere! (edict: %d, server: %d, type: %d)\n", num_for_edict(this), this.entnum, t);
+ LOG_INFOF("A CSQC entity appeared out of nowhere! (edict: %d, server: %d, type: %d)\n", etof(this), this.entnum, t);
isnew = true;
}
}
armorblockpercent = ReadByte() / 255.0;
- g_balance_mortar_bouncefactor = ReadCoord();
- g_balance_mortar_bouncestop = ReadCoord();
- g_balance_electro_secondary_bouncefactor = ReadCoord();
- g_balance_electro_secondary_bouncestop = ReadCoord();
-
- vortex_scope = !ReadByte();
- rifle_scope = !ReadByte();
-
serverflags = ReadByte();
- minelayer_maxmines = ReadByte();
-
- hagar_maxrockets = ReadByte();
-
g_trueaim_minrange = ReadCoord();
- g_balance_porto_secondary = ReadByte();
+
return = true;
MUTATOR_CALLHOOK(Ent_Init);
{
complain_weapon = ReadByte();
if (complain_weapon_name) strunzone(complain_weapon_name);
- complain_weapon_name = strzone(WEP_NAME(complain_weapon));
+ complain_weapon_name = strzone(Weapons_from(complain_weapon).m_name);
complain_weapon_type = ReadByte();
return = true;
.float ping, ping_packetloss, ping_movementloss;
-float g_balance_mortar_bouncefactor;
-float g_balance_mortar_bouncestop;
-float g_balance_electro_secondary_bouncefactor;
-float g_balance_electro_secondary_bouncestop;
float g_trueaim_minrange;
float hud;
float RegisterTeam(entity Team)
{
+ assert_once(Team.team, eprint(Team));
entity tm;
AuditLists();
for(tm = teams.sort_next; tm; tm = tm.sort_next)
vector project_3d_to_2d(vector vec);
-#define draw_beginBoldFont() do { drawfont = FONT_USER + 2; } while (0)
-#define draw_endBoldFont() do { drawfont = FONT_USER + 1; } while (0)
+#define draw_beginBoldFont() MACRO_BEGIN { drawfont = FONT_USER + 2; } MACRO_END
+#define draw_endBoldFont() MACRO_BEGIN { drawfont = FONT_USER + 1; } MACRO_END
float expandingbox_sizefactor_from_fadelerp(float fadelerp);
float _drawpic_oldsz;
string _drawpic_picpath;
#define drawpic_aspect(pos,pic,mySize,color,theAlpha,drawflag)\
- do {\
+ MACRO_BEGIN {\
_drawpic_imgsize = draw_getimagesize(pic);\
if(_drawpic_imgsize != '0 0 0') {\
_drawpic_imgaspect = _drawpic_imgsize.x/_drawpic_imgsize.y;\
drawpic(pos + eY * (_drawpic_oldsz - _drawpic_sz.y) * 0.5, pic, _drawpic_sz, color, theAlpha, drawflag);\
}\
}\
- } while(0)
+ } MACRO_END
// draw HUD element with image from gfx/hud/hud_skin/foo.tga if it exists, otherwise gfx/hud/default/foo.tga
#define drawpic_aspect_skin(pos,pic,sz,color,theAlpha,drawflag)\
- do{\
+ MACRO_BEGIN {\
_drawpic_picpath = strcat(hud_skin_path, "/", pic);\
if(precache_pic(_drawpic_picpath) == "") {\
_drawpic_picpath = strcat("gfx/hud/default/", pic);\
}\
drawpic_aspect(pos, _drawpic_picpath, sz, color, theAlpha, drawflag);\
_drawpic_picpath = string_null;\
- } while(0)
+ } MACRO_END
// draw HUD element with image from gfx/hud/hud_skin/foo.tga if it exists, otherwise gfx/hud/default/foo.tga
#define drawpic_skin(pos,pic,sz,color,theAlpha,drawflag)\
- do{\
+ MACRO_BEGIN {\
_drawpic_picpath = strcat(hud_skin_path, "/", pic);\
if(precache_pic(_drawpic_picpath) == "") {\
_drawpic_picpath = strcat("gfx/hud/default/", pic);\
}\
drawpic(pos, _drawpic_picpath, sz, color, theAlpha, drawflag);\
_drawpic_picpath = string_null;\
- } while(0)
+ } MACRO_END
void drawpic_aspect_skin_expanding(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp);
void drawpic_aspect_skin_expanding_two(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp);
-#define SET_POS_AND_SZ_Y_ASPECT(allow_colors) do { \
+#define SET_POS_AND_SZ_Y_ASPECT(allow_colors) MACRO_BEGIN { \
float textaspect, oldsz; \
textaspect = stringwidth(text, allow_colors, '1 1 1' * sz.y) / sz.y; \
if(sz.x/sz.y > textaspect) { \
sz.y = sz.x / textaspect; \
pos.y += (oldsz - sz.y) * 0.5; \
} \
-} while(0)
+} MACRO_END
// drawstring wrapper to draw a string as large as possible with preserved aspect ratio into a box
void drawstring_aspect(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag);
#include "../common/deathtypes/all.qc"
#include "../common/effects/all.qc"
#include "../common/gamemodes/all.qc"
+#include "../common/impulses/all.qc"
#include "../common/items/all.qc"
#include "../common/monsters/all.qc"
#include "../common/mutators/all.qc"
+++ /dev/null
-../../csprogs.dat
-progs.inc
for(pl = players.sort_next; pl; pl = pl.sort_next)
{
num += 1;
- Team = entcs_GetTeam(pl.sv_entnum);
+ Team = entcs_GetScoreTeam(pl.sv_entnum);
if(SetTeam(pl, Team))
{
tmp = pl.sort_prev;
return 1;
else if (intermission == 2)
return 0;
- else if (spectatee_status != -1 && getstati(STAT_HEALTH) <= 0 && autocvar_cl_deathscoreboard && gametype != MAPINFO_TYPE_CTS && !active_minigame)
+ else if (spectatee_status != -1 && STAT(HEALTH) <= 0 && autocvar_cl_deathscoreboard && gametype != MAPINFO_TYPE_CTS && !active_minigame)
return 1;
else if (scoreboard_showscores_force)
return 1;
float initial_posx = pos.x;
int disownedcnt = 0;
FOREACH(Weapons, it != WEP_Null, LAMBDA(
- if (!it.weapon) continue;
-
int weapon_stats = weapon_accuracy[i - WEP_FIRST];
WepSet set = it.m_wepset;
int column = 0;
FOREACH(Weapons, it != WEP_Null, LAMBDA(
- if (!it.weapon) continue;
int weapon_stats = weapon_accuracy[i - WEP_FIRST];
WepSet set = it.m_wepset;
float autocvar_cl_leanmodel_up_lowpass;
float autocvar_cl_leanmodel_up_limit;
-#define lowpass(value, frac, ref_store, ret) do \
+#define lowpass(value, frac, ref_store, ret) MACRO_BEGIN \
{ \
float __frac = bound(0, frac, 1); \
ret = ref_store = ref_store * (1 - __frac) + (value) * __frac; \
-} while (0)
+} MACRO_END
-#define lowpass_limited(value, frac, limit, ref_store, ret) do \
+#define lowpass_limited(value, frac, limit, ref_store, ret) MACRO_BEGIN \
{ \
float __ignore; lowpass(value, frac, ref_store, __ignore); \
ret = ref_store = bound((value) - (limit), ref_store, (value) + (limit)); \
-} while (0)
+} MACRO_END
-#define highpass(value, frac, ref_store, ret) do \
+#define highpass(value, frac, ref_store, ret) MACRO_BEGIN \
{ \
float __f; lowpass(value, frac, ref_store, __f); \
ret = (value) - __f; \
-} while (0)
+} MACRO_END
-#define highpass_limited(value, frac, limit, ref_store, ret) do \
+#define highpass_limited(value, frac, limit, ref_store, ret) MACRO_BEGIN \
{ \
float __f; lowpass_limited(value, frac, limit, ref_store, __f); \
ret = (value) - __f; \
-} while (0)
+} MACRO_END
-#define lowpass3(value, fracx, fracy, fracz, ref_store, ref_out) do \
+#define lowpass3(value, fracx, fracy, fracz, ref_store, ref_out) MACRO_BEGIN \
{ \
lowpass(value.x, fracx, ref_store.x, ref_out.x); \
lowpass(value.y, fracy, ref_store.y, ref_out.y); \
lowpass(value.z, fracz, ref_store.z, ref_out.z); \
-} while (0)
+} MACRO_END
-#define highpass3(value, fracx, fracy, fracz, ref_store, ref_out) do \
+#define highpass3(value, fracx, fracy, fracz, ref_store, ref_out) MACRO_BEGIN \
{ \
highpass(value.x, fracx, ref_store.x, ref_out.x); \
highpass(value.y, fracy, ref_store.y, ref_out.y); \
highpass(value.z, fracz, ref_store.z, ref_out.z); \
-} while (0)
+} MACRO_END
-#define highpass3_limited(value, fracx, limitx, fracy, limity, fracz, limitz, ref_store, ref_out) do \
+#define highpass3_limited(value, fracx, limitx, fracy, limity, fracz, limitz, ref_store, ref_out) MACRO_BEGIN \
{ \
highpass_limited(value.x, fracx, limitx, ref_store.x, ref_out.x); \
highpass_limited(value.y, fracy, limity, ref_store.y, ref_out.y); \
highpass_limited(value.z, fracz, limitz, ref_store.z, ref_out.z); \
-} while (0)
+} MACRO_END
void viewmodel_animate(entity this)
{
prevtime = time;
if (autocvar_chase_active) return;
- if (getstati(STAT_HEALTH) <= 0) return;
+ if (STAT(HEALTH) <= 0) return;
entity view = CSQCModel_server2csqc(player_localentnum - 1);
void viewmodel_draw(entity this)
{
- int mask = (intermission || (getstati(STAT_HEALTH) <= 0) || autocvar_chase_active) ? 0 : MASK_NORMAL;
+ int mask = (intermission || (STAT(HEALTH) <= 0) || autocvar_chase_active) ? 0 : MASK_NORMAL;
float a = this.alpha;
int c = stof(getplayerkeyvalue(current_player, "colors"));
vector g;
if(activeweapon != WEP_PORTO || spectatee_status || gametype == MAPINFO_TYPE_NEXBALL)
return;
- if(g_balance_porto_secondary)
+ if(WEP_CVAR(porto, secondary))
return;
if(intermission == 1)
return;
if(intermission == 2)
return;
- if (getstati(STAT_HEALTH) <= 0)
+ if (STAT(HEALTH) <= 0)
return;
dir = view_forward;
zoomdir = button_zoom;
if(hud == HUD_NORMAL)
if(switchweapon == activeweapon)
- if((activeweapon == WEP_VORTEX && vortex_scope) || (activeweapon == WEP_RIFLE && rifle_scope)) // do NOT use switchweapon here
+ if((activeweapon == WEP_VORTEX && !WEP_CVAR(vortex, secondary)) || (activeweapon == WEP_RIFLE && !WEP_CVAR(rifle, secondary))) // do NOT use switchweapon here
zoomdir += button_attack2;
if(spectatee_status > 0 || isdemo())
{
break;
}
- vector traceorigin = entcs_receiver(player_localentnum - 1).origin + (eZ * getstati(STAT_VIEWHEIGHT));
+ vector traceorigin = entcs_receiver(player_localentnum - 1).origin + (eZ * STAT(VIEWHEIGHT));
vecs = decompressShotOrigin(STAT(SHOTORG));
return true;
if(autocvar_cl_eventchase_nexball && gametype == MAPINFO_TYPE_NEXBALL && !(WepSet_GetFromStat() & WEPSET(NEXBALL)))
return true;
- if(autocvar_cl_eventchase_death && (getstati(STAT_HEALTH) <= 0))
+ if(autocvar_cl_eventchase_death && (STAT(HEALTH) <= 0))
{
if(autocvar_cl_eventchase_death == 2)
{
case 2: // crosshair_color_by_health
{
- float x = getstati(STAT_HEALTH);
+ float x = STAT(HEALTH);
//x = red
//y = green
ring_rgb = wcross_color;
ring_image = "gfx/crosshair_ring_nexgun.tga";
}
- else if (autocvar_crosshair_ring && activeweapon == WEP_MINE_LAYER && minelayer_maxmines && autocvar_crosshair_ring_minelayer)
+ else if (autocvar_crosshair_ring && activeweapon == WEP_MINE_LAYER && WEP_CVAR(minelayer, limit) && autocvar_crosshair_ring_minelayer)
{
- ring_value = bound(0, STAT(LAYED_MINES) / minelayer_maxmines, 1); // if you later need to use the count of bullets in another place, then add a float for it. For now, no need to.
+ ring_value = bound(0, STAT(LAYED_MINES) / WEP_CVAR(minelayer, limit), 1); // if you later need to use the count of bullets in another place, then add a float for it. For now, no need to.
ring_alpha = autocvar_crosshair_ring_minelayer_alpha;
ring_rgb = wcross_color;
ring_image = "gfx/crosshair_ring.tga";
}
else if (activeweapon == WEP_HAGAR && STAT(HAGAR_LOAD) && autocvar_crosshair_ring_hagar)
{
- ring_value = bound(0, STAT(HAGAR_LOAD) / hagar_maxrockets, 1);
+ ring_value = bound(0, STAT(HAGAR_LOAD) / WEP_CVAR_SEC(hagar, load_max), 1);
ring_alpha = autocvar_crosshair_ring_hagar_alpha;
ring_rgb = wcross_color;
ring_image = "gfx/crosshair_ring.tga";
}
#define CROSSHAIR_DO_BLUR(M,sz,wcross_name,wcross_alpha) \
- do \
- { \
+ MACRO_BEGIN { \
if(wcross_blur > 0) \
{ \
for(i = -2; i <= 2; ++i) \
{ \
M(0,0,sz,wcross_name,wcross_alpha); \
} \
- } \
- while(0)
+ } MACRO_END
#define CROSSHAIR_DRAW_SINGLE(i,j,sz,wcross_name,wcross_alpha) \
drawpic(wcross_origin - ('0.5 0 0' * (sz * wcross_size.x + i * wcross_blur) + '0 0.5 0' * (sz * wcross_size.y + j * wcross_blur)), wcross_name, sz * wcross_size, wcross_color, wcross_alpha, DRAWFLAG_NORMAL)
ticrate = STAT(MOVEVARS_TICRATE) * STAT(MOVEVARS_TIMESCALE);
- float is_dead = (getstati(STAT_HEALTH) <= 0);
+ float is_dead = (STAT(HEALTH) <= 0);
// FIXME do we need this hack?
if(isdemo())
switchingweapon = Weapons_from(STAT(SWITCHINGWEAPON));
// actually active weapon (for zoom)
- activeweapon = Weapons_from(getstati(STAT_ACTIVEWEAPON));
+ activeweapon = Weapons_from(STAT(ACTIVEWEAPON));
switchweapon = Weapons_from(STAT(SWITCHWEAPON));
splash_pos.y = (vid_conheight - splash_size.y) / 2;
float myhealth_flash_temp;
- myhealth = getstati(STAT_HEALTH);
+ myhealth = STAT(HEALTH);
// fade out
myhealth_flash = max(0, myhealth_flash - autocvar_hud_damage_fade_rate * frametime);
if (strength_finished - time > 0) { sharpen_intensity += (strength_finished - time); }
if (invincible_finished - time > 0) { sharpen_intensity += (invincible_finished - time); }
- sharpen_intensity = bound(0, ((getstati(STAT_HEALTH) > 0) ? sharpen_intensity : 0), 5); // Check to see if player is alive (if not, set 0) - also bound to fade out starting at 5 seconds.
+ sharpen_intensity = bound(0, ((STAT(HEALTH) > 0) ? sharpen_intensity : 0), 5); // Check to see if player is alive (if not, set 0) - also bound to fade out starting at 5 seconds.
if(autocvar_hud_powerup && sharpen_intensity > 0)
{
self.maxs = '0 0 -4';
self.move_movetype = MOVETYPE_BOUNCE;
self.move_touch = func_null;
- self.move_bounce_factor = g_balance_electro_secondary_bouncefactor;
- self.move_bounce_stopspeed = g_balance_electro_secondary_bouncestop;
+ self.move_bounce_factor = WEP_CVAR_SEC(electro, bouncefactor);
+ self.move_bounce_stopspeed = WEP_CVAR_SEC(electro, bouncestop);
break;
case PROJECTILE_RPC:
case PROJECTILE_ROCKET:
self.maxs = '3 3 3';
self.move_movetype = MOVETYPE_BOUNCE;
self.move_touch = func_null;
- self.move_bounce_factor = g_balance_mortar_bouncefactor;
- self.move_bounce_stopspeed = g_balance_mortar_bouncestop;
+ self.move_bounce_factor = WEP_CVAR(mortar, bouncefactor);
+ self.move_bounce_stopspeed = WEP_CVAR(mortar, bouncestop);
break;
case PROJECTILE_SHAMBLER_LIGHTNING:
self.mins = '-8 -8 -8';
self.maxs = '0 0 -4';
self.move_movetype = MOVETYPE_BOUNCE;
self.move_touch = func_null;
- self.move_bounce_factor = g_balance_electro_secondary_bouncefactor;
- self.move_bounce_stopspeed = g_balance_electro_secondary_bouncestop;
+ self.move_bounce_factor = WEP_CVAR_SEC(electro, bouncefactor);
+ self.move_bounce_stopspeed = WEP_CVAR_SEC(electro, bouncestop);
break;
*/
default:
void animdecide_load_if_needed(entity e)
{
- if(e.modelindex == e.animdecide_modelindex)
- return;
- e.animdecide_modelindex = e.modelindex;
+ int mdlidx = e.modelindex;
+ if (mdlidx == e.animdecide_modelindex) return;
+ e.animdecide_modelindex = mdlidx;
if(substring(e.model, 0, 16) == "models/monsters/")
{
return;
}
+#define ANIM_VEC(a, frames, rate) anim_vec(ANIM_##a, mdlidx, frames, rate)
+
vector none = '0 0 0';
- e.anim_die1 = animfixfps(e, '0 1 0.5', none); // 2 seconds
- e.anim_die2 = animfixfps(e, '1 1 0.5', none); // 2 seconds
- e.anim_draw = animfixfps(e, '2 1 3', none);
- e.anim_duckwalk = animfixfps(e, '4 1 1', none);
- e.anim_duckjump = animfixfps(e, '5 1 10', none);
- e.anim_duckidle = animfixfps(e, '6 1 1', none);
- e.anim_idle = animfixfps(e, '7 1 1', none);
- e.anim_jump = animfixfps(e, '8 1 10', none);
- e.anim_pain1 = animfixfps(e, '9 1 2', none); // 0.5 seconds
- e.anim_pain2 = animfixfps(e, '10 1 2', none); // 0.5 seconds
- e.anim_shoot = animfixfps(e, '11 1 5', none); // analyze models and set framerate
- e.anim_taunt = animfixfps(e, '12 1 0.33', none);
- e.anim_run = animfixfps(e, '13 1 1', none);
- e.anim_runbackwards = animfixfps(e, '14 1 1', none);
- e.anim_strafeleft = animfixfps(e, '15 1 1', none);
- e.anim_straferight = animfixfps(e, '16 1 1', none);
- e.anim_forwardright = animfixfps(e, '19 1 1', '16 1 1');
- e.anim_forwardleft = animfixfps(e, '20 1 1', '15 1 1');
- e.anim_backright = animfixfps(e, '21 1 1', '16 1 1');
- e.anim_backleft = animfixfps(e, '22 1 1', '15 1 1');
- e.anim_melee = animfixfps(e, '23 1 1', '11 1 1');
- e.anim_duckwalkbackwards = animfixfps(e, '24 1 1', '4 1 1');
- e.anim_duckwalkstrafeleft = animfixfps(e, '25 1 1', '4 1 1');
- e.anim_duckwalkstraferight = animfixfps(e, '26 1 1', '4 1 1');
- e.anim_duckwalkforwardright = animfixfps(e, '27 1 1', '4 1 1');
- e.anim_duckwalkforwardleft = animfixfps(e, '28 1 1', '4 1 1');
- e.anim_duckwalkbackright = animfixfps(e, '29 1 1', '4 1 1');
- e.anim_duckwalkbackleft = animfixfps(e, '30 1 1', '4 1 1');
+ e.anim_die1 = animfixfps(e, ANIM_VEC(die1, 1, 0.5), none); // 2 seconds
+ e.anim_die2 = animfixfps(e, ANIM_VEC(die2, 1, 0.5), none); // 2 seconds
+ e.anim_draw = animfixfps(e, ANIM_VEC(draw, 1, 3), none);
+ e.anim_duckwalk = animfixfps(e, ANIM_VEC(duckwalk, 1, 1), none);
+ e.anim_duckjump = animfixfps(e, ANIM_VEC(duckjump, 1, 10), none);
+ e.anim_duckidle = animfixfps(e, ANIM_VEC(duckidle, 1, 1), none);
+ e.anim_idle = animfixfps(e, ANIM_VEC(idle, 1, 1), none);
+ e.anim_jump = animfixfps(e, ANIM_VEC(jump, 1, 10), none);
+ e.anim_pain1 = animfixfps(e, ANIM_VEC(pain1, 1, 2), none); // 0.5 seconds
+ e.anim_pain2 = animfixfps(e, ANIM_VEC(pain2, 1, 2), none); // 0.5 seconds
+ e.anim_shoot = animfixfps(e, ANIM_VEC(shoot, 1, 5), none); // analyze models and set framerate
+ e.anim_taunt = animfixfps(e, ANIM_VEC(taunt, 1, 0.33), none);
+ e.anim_run = animfixfps(e, ANIM_VEC(run, 1, 1), none);
+ e.anim_runbackwards = animfixfps(e, ANIM_VEC(runbackwards, 1, 1), none);
+ e.anim_strafeleft = animfixfps(e, ANIM_VEC(strafeleft, 1, 1), none);
+ e.anim_straferight = animfixfps(e, ANIM_VEC(straferight, 1, 1), none);
+ e.anim_forwardright = animfixfps(e, ANIM_VEC(forwardright, 1, 1), ANIM_VEC(straferight, 1, 1));
+ e.anim_forwardleft = animfixfps(e, ANIM_VEC(forwardleft, 1, 1), ANIM_VEC(strafeleft, 1, 1));
+ e.anim_backright = animfixfps(e, ANIM_VEC(backright, 1, 1), ANIM_VEC(straferight, 1, 1));
+ e.anim_backleft = animfixfps(e, ANIM_VEC(backleft , 1, 1), ANIM_VEC(strafeleft, 1, 1));
+ e.anim_melee = animfixfps(e, ANIM_VEC(melee, 1, 1), ANIM_VEC(shoot, 1, 1));
+ e.anim_duckwalkbackwards = animfixfps(e, ANIM_VEC(duckwalkbackwards, 1, 1), ANIM_VEC(duckwalk, 1, 1));
+ e.anim_duckwalkstrafeleft = animfixfps(e, ANIM_VEC(duckwalkstrafeleft, 1, 1), ANIM_VEC(duckwalk, 1, 1));
+ e.anim_duckwalkstraferight = animfixfps(e, ANIM_VEC(duckwalkstraferight, 1, 1), ANIM_VEC(duckwalk, 1, 1));
+ e.anim_duckwalkforwardright = animfixfps(e, ANIM_VEC(duckwalkforwardright, 1, 1), ANIM_VEC(duckwalk, 1, 1));
+ e.anim_duckwalkforwardleft = animfixfps(e, ANIM_VEC(duckwalkforwardleft, 1, 1), ANIM_VEC(duckwalk, 1, 1));
+ e.anim_duckwalkbackright = animfixfps(e, ANIM_VEC(duckwalkbackright, 1, 1), ANIM_VEC(duckwalk, 1, 1));
+ e.anim_duckwalkbackleft = animfixfps(e, ANIM_VEC(duckwalkbackleft , 1, 1), ANIM_VEC(duckwalk, 1, 1));
+
+#undef ANIM_VEC
// these anims ought to stay until stopped explicitly by weaponsystem
e.anim_shoot_z = 0.001;
void animdecide_setimplicitstate(entity e, float onground);
void animdecide_setframes(entity e, bool support_blending, .int fld_frame, .int fld_frame1time, .int fld_frame2, .int fld_frame2time);
+CLASS(Animation, Object)
+ ATTRIB(Animation, m_framenames, string, string_null)
+ STATIC_METHOD(Animation, getframe, int(Animation this, int mdlidx))
+ {
+ FOREACH_WORD(this.m_framenames, true, {
+ int f = frameforname(mdlidx, it);
+ if (f != -1) return f;
+ });
+#ifdef CSQC
+ LOG_DEBUGF("Missing animation for %s: %s\n", modelnameforindex(mdlidx), this.registered_id);
+#endif
+ return -1;
+ }
+ENDCLASS(Animation)
+
+REGISTRY(Animations, BITS(8))
+REGISTER_REGISTRY(Animations)
+#define Animations_from(id) _Animations_from(id, NULL)
+#define WriteAnimation(to, it) WriteRegistry(Animations, to, it)
+#define ReadAnimation() ReadRegistry(Animations)
+#define REGISTER_ANIMATION(id, framenames) \
+ .vector anim_##id; \
+ REGISTER(Animations, ANIM_##id, m_id, NEW(Animation)) { \
+ this.m_framenames = framenames; \
+ }
+
+vector anim_vec(Animation anim, int mdlidx, int numframes, float framerate)
+{
+ vector v;
+ v.x = Animation_getframe(anim, mdlidx);
+ v.y = numframes;
+ v.z = framerate;
+ return v;
+}
+
// player animation data for this model
// each vector is as follows:
// _x = startframe
// _y = numframes
// _z = framerate
-.vector anim_die1; // player dies
-.vector anim_die2; // player dies differently
-.vector anim_draw; // player pulls out a weapon
-.vector anim_duckwalk; // player walking while crouching
-.vector anim_duckjump; // player jumping from a crouch
-.vector anim_duckidle; // player idling while crouching
-.vector anim_idle; // player standing
-.vector anim_jump; // player jump
-.vector anim_pain1; // player flinches from pain
-.vector anim_pain2; // player flinches from pain, differently
-.vector anim_shoot; // player shoots
-.vector anim_taunt; // player taunts others (FIXME: no code references this)
-.vector anim_run; // player running forward
-.vector anim_runbackwards; // player running backward
-.vector anim_strafeleft; // player shuffling left quickly
-.vector anim_straferight; // player shuffling right quickly
-.vector anim_forwardright; // player running forward and right
-.vector anim_forwardleft; // player running forward and left
-.vector anim_backright; // player running backward and right
-.vector anim_backleft; // player running back and left
-.vector anim_melee; // player doing the melee action
-.vector anim_duck; // player doing the melee action
-.vector anim_duckwalkbackwards;
-.vector anim_duckwalkstrafeleft;
-.vector anim_duckwalkstraferight;
-.vector anim_duckwalkforwardright;
-.vector anim_duckwalkforwardleft;
-.vector anim_duckwalkbackright;
-.vector anim_duckwalkbackleft;
+/** player dies */
+REGISTER_ANIMATION(die1, "dieone groupified_0_anim");
+/** player dies differently */
+REGISTER_ANIMATION(die2, "dietwo groupified_1_anim");
+/** player pulls out a weapon */
+REGISTER_ANIMATION(draw, "draw groupified_2_anim");
+REGISTER_ANIMATION(duck, "duck groupified_3_anim");
+/** player walking while crouching */
+REGISTER_ANIMATION(duckwalk, "duckwalk groupified_4_anim");
+/** player jumping from a crouch */
+REGISTER_ANIMATION(duckjump, "duckjump groupified_5_anim");
+/** player idling while crouching */
+REGISTER_ANIMATION(duckidle, "duckidle groupified_6_anim");
+/** player standing */
+REGISTER_ANIMATION(idle, "idle groupified_7_anim");
+/** player jump */
+REGISTER_ANIMATION(jump, "jump groupified_8_anim");
+/** player flinches from pain */
+REGISTER_ANIMATION(pain1, "painone groupified_9_anim");
+/** player flinches from pain, differently */
+REGISTER_ANIMATION(pain2, "paintwo groupified_10_anim");
+/** player shoots */
+REGISTER_ANIMATION(shoot, "shoot groupified_11_anim");
+/** player taunts others (FIXME: no code references this) */
+REGISTER_ANIMATION(taunt, "taunt groupified_12_anim");
+/** player running forward */
+REGISTER_ANIMATION(run, "run groupified_13_anim");
+/** player running backward */
+REGISTER_ANIMATION(runbackwards, "runbackwards groupified_14_anim");
+/** player shuffling left quickly */
+REGISTER_ANIMATION(strafeleft, "strafeleft groupified_15_anim");
+/** player shuffling right quickly */
+REGISTER_ANIMATION(straferight, "straferight groupified_16_anim");
+/** */
+REGISTER_ANIMATION(dead1, "deadone groupified_17_anim");
+/** */
+REGISTER_ANIMATION(dead2, "deadtwo groupified_18_anim");
+/** player running forward and right */
+REGISTER_ANIMATION(forwardright, "forwardright groupified_19_anim");
+/** player running forward and left */
+REGISTER_ANIMATION(forwardleft, "forwardleft groupified_20_anim");
+/** player running backward and right */
+REGISTER_ANIMATION(backright, "backright groupified_21_anim");
+/** player running back and left */
+REGISTER_ANIMATION(backleft, "backleft groupified_22_anim");
+/** player doing the melee action */
+REGISTER_ANIMATION(melee, "melee groupified_23_anim");
+REGISTER_ANIMATION(duckwalkbackwards, "duckwalkbackwards groupified_24_anim");
+REGISTER_ANIMATION(duckwalkstrafeleft, "duckwalkstrafeleft duckstrafeleft groupified_25_anim");
+REGISTER_ANIMATION(duckwalkstraferight, "duckwalkstraferight duckstraferight groupified_26_anim");
+REGISTER_ANIMATION(duckwalkforwardright, "duckwalkforwardright duckforwardright groupified_27_anim");
+REGISTER_ANIMATION(duckwalkforwardleft, "duckwalkforwardleft groupified_28_anim");
+REGISTER_ANIMATION(duckwalkbackright, "duckwalkbackright duckbackwardright groupified_29_anim");
+REGISTER_ANIMATION(duckwalkbackleft, "duckwalkbackleft duckbackwardleft groupified_30_anim");
.float animdecide_modelindex;
// please network this one
ATTRIB(genericcommand_##id, m_description, string, description); \
ENDCLASS(genericcommand_##id) \
REGISTER(GENERIC_COMMANDS, CMD_G, id, m_id, NEW(genericcommand_##id)); \
- METHOD(genericcommand_##id, m_invokecmd, void(int request, int arguments, string command))
+ METHOD(genericcommand_##id, m_invokecmd, void(int request, entity caller, int arguments, string command))
STATIC_INIT(GENERIC_COMMANDS_aliases) {
FOREACH(GENERIC_COMMANDS, true, LAMBDA(localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_svmenu"))));
CLASS(Command, Object)
ATTRIB(Command, m_name, string, string_null);
ATTRIB(Command, m_description, string, string_null);
- METHOD(Command, m_invokecmd, void(int request, int arguments, string command)) { }
+ METHOD(Command, m_invokecmd, void(int request, entity caller, int arguments, string command)) { }
ENDCLASS(Command)
#endif
{
MapInfo_Enumerate();
MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0);
- argc = tokenizebyseparator(cvar_string("g_maplist"), " ");
-
- tmp_string = "";
- for(i = 0; i < argc; ++i)
- if(MapInfo_CheckMap(argv(i)))
- tmp_string = strcat(tmp_string, " ", argv(i));
-
- tmp_string = substring(tmp_string, 1, strlen(tmp_string) - 1);
- cvar_set("g_maplist", tmp_string);
-
+ string filtered = "";
+ FOREACH_WORD(cvar_string("g_maplist"), MapInfo_CheckMap(it), filtered = cons(filtered, it));
+ cvar_set("g_maplist", filtered);
return;
}
{
string c = strtolower(argv(0));
FOREACH(GENERIC_COMMANDS, it.m_name == c, LAMBDA(
- it.m_invokecmd(CMD_REQUEST_COMMAND, argc, command);
+ it.m_invokecmd(CMD_REQUEST_COMMAND, NULL, argc, command);
return true;
));
return false;
{
string c = strtolower(argv(1));
FOREACH(GENERIC_COMMANDS, it.m_name == c, LAMBDA(
- it.m_invokecmd(CMD_REQUEST_USAGE, argc, "");
+ it.m_invokecmd(CMD_REQUEST_USAGE, NULL, argc, "");
return true;
));
return false;
int channel = MSG_ONE;
msg_entity = to;
WriteHeader(channel, net_debug);
- WriteShort(channel, num_for_edict(this));
+ WriteShort(channel, etof(this));
WriteByte(channel, is_pure(this));
WriteCoord(channel, this.origin.x);
WriteCoord(channel, this.origin.y);
pos.z = 0;
pos.y += ofs * size;
drawcolorcodedstring2(pos,
- sprintf("%d: '%s'@%s:%d", (e.debug ? e.sv_entnum : num_for_edict(e)),
+ sprintf("%d: '%s'@%s:%d", (e.debug ? e.sv_entnum : etof(e)),
e.classname, e.sourceLocFile, e.sourceLocLine),
size * '1 1 0', rgb, 0.5, DRAWFLAG_NORMAL);
++ofs;
#endif
#ifdef SVQC
- GENERIC_COMMAND(debugdraw_sv, "Dump all server entities")
+ COMMON_COMMAND(debugdraw_sv, "Dump all server entities")
{
switch (request)
{
#define EFFECTINFO_PARSER(on) \
on(type, MY(type) \
- ,{ ASSERT(n == 1 && "type"); MY(type) = strzone(argv(1)); \
+ ,{ demand(n == 1 && "type"); MY(type) = strzone(argv(1)); \
}, sprintf(" %s", (MY(type)) \
)) \
on(airfriction, MY(airfriction) \
- ,{ ASSERT(n == 1 && "airfriction"); MY(airfriction) = stof(argv(1)); \
+ ,{ demand(n == 1 && "airfriction"); MY(airfriction) = stof(argv(1)); \
}, sprintf(" %s", ftos(MY(airfriction)) \
)) \
on(alpha, MY(alpha_min) || MY(alpha_max) || MY(alpha_fade) \
- ,{ ASSERT(n == 3 && "alpha"); MY(alpha_min) = stof(argv(1)); MY(alpha_max) = stof(argv(2)); MY(alpha_fade) = stof(argv(3)); \
+ ,{ demand(n == 3 && "alpha"); MY(alpha_min) = stof(argv(1)); MY(alpha_max) = stof(argv(2)); MY(alpha_fade) = stof(argv(3)); \
}, sprintf(" %s %s %s", ftos(MY(alpha_min)), ftos(MY(alpha_max)), ftos(MY(alpha_fade)) \
)) \
on(blend, MY(blend) \
- ,{ ASSERT(n == 1 && "blend"); MY(blend) = strzone(argv(1)); \
+ ,{ demand(n == 1 && "blend"); MY(blend) = strzone(argv(1)); \
}, sprintf(" %s", (MY(blend)) \
)) \
on(bounce, MY(bounce) \
- ,{ ASSERT(n == 1 && "bounce"); MY(bounce) = stof(argv(1)); \
+ ,{ demand(n == 1 && "bounce"); MY(bounce) = stof(argv(1)); \
}, sprintf(" %s", ftos(MY(bounce)) \
)) \
on(color, MY(color_min) || MY(color_max) \
- ,{ ASSERT(n == 2 && "color"); MY(color_min) = strzone(argv(1)); MY(color_max) = strzone(argv(2)); \
+ ,{ demand(n == 2 && "color"); MY(color_min) = strzone(argv(1)); MY(color_max) = strzone(argv(2)); \
}, sprintf(" %s %s", (MY(color_min)), (MY(color_max)) \
)) \
on(countabsolute, MY(countabsolute) \
- ,{ ASSERT(n == 1 && "countabsolute"); MY(countabsolute) = stof(argv(1)); \
+ ,{ demand(n == 1 && "countabsolute"); MY(countabsolute) = stof(argv(1)); \
}, sprintf(" %s", ftos(MY(countabsolute)) \
)) \
on(count, MY(count) \
- ,{ ASSERT(n == 1 && "count"); MY(count) = stof(argv(1)); \
+ ,{ demand(n == 1 && "count"); MY(count) = stof(argv(1)); \
}, sprintf(" %s", ftos(MY(count)) \
)) \
on(gravity, MY(gravity) \
- ,{ ASSERT(n == 1 && "gravity"); MY(gravity) = stof(argv(1)); \
+ ,{ demand(n == 1 && "gravity"); MY(gravity) = stof(argv(1)); \
}, sprintf(" %s", ftos(MY(gravity)) \
)) \
on(lightcolor, MY(lightcolor) \
- ,{ ASSERT(n == 3 && "lightcolor"); MY(lightcolor) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
+ ,{ demand(n == 3 && "lightcolor"); MY(lightcolor) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
}, sprintf(" %v", (MY(lightcolor)) \
)) \
on(lightradiusfade, MY(lightradiusfade) \
- ,{ ASSERT(n == 1 && "lightradiusfade"); MY(lightradiusfade) = stof(argv(1)); \
+ ,{ demand(n == 1 && "lightradiusfade"); MY(lightradiusfade) = stof(argv(1)); \
}, sprintf(" %s", ftos(MY(lightradiusfade)) \
)) \
on(lightradius, MY(lightradius) \
- ,{ ASSERT(n == 1 && "lightradius"); MY(lightradius) = stof(argv(1)); \
+ ,{ demand(n == 1 && "lightradius"); MY(lightradius) = stof(argv(1)); \
}, sprintf(" %s", ftos(MY(lightradius)) \
)) \
on(lighttime, MY(lighttime) \
- ,{ ASSERT(n == 1 && "lighttime"); MY(lighttime) = stof(argv(1)); \
+ ,{ demand(n == 1 && "lighttime"); MY(lighttime) = stof(argv(1)); \
}, sprintf(" %s", ftos(MY(lighttime)) \
)) \
on(liquidfriction, MY(liquidfriction) \
- ,{ ASSERT(n == 1 && "liquidfriction"); MY(liquidfriction) = stof(argv(1)); \
+ ,{ demand(n == 1 && "liquidfriction"); MY(liquidfriction) = stof(argv(1)); \
}, sprintf(" %s", ftos(MY(liquidfriction)) \
)) \
on(notunderwater, MY(notunderwater) \
- ,{ ASSERT(n == 0 && "notunderwater"); MY(notunderwater) = true; \
+ ,{ demand(n == 0 && "notunderwater"); MY(notunderwater) = true; \
}, "" \
) \
on(orientation, MY(orientation) \
- ,{ ASSERT(n == 1 && "orientation"); MY(orientation) = strzone(argv(1)); \
+ ,{ demand(n == 1 && "orientation"); MY(orientation) = strzone(argv(1)); \
}, sprintf(" %s", (MY(orientation)) \
)) \
on(originjitter, MY(originjitter) \
- ,{ ASSERT(n == 3 && "originjitter"); MY(originjitter) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
+ ,{ demand(n == 3 && "originjitter"); MY(originjitter) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
}, sprintf(" %v", (MY(originjitter)) \
)) \
on(originoffset, MY(originoffset) \
- ,{ ASSERT(n == 3 && "originoffset"); MY(originoffset) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
+ ,{ demand(n == 3 && "originoffset"); MY(originoffset) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
}, sprintf(" %v", (MY(originoffset)) \
)) \
on(relativeoriginoffset, MY(relativeoriginoffset) \
- ,{ ASSERT(n == 3 && "relativeoriginoffset"); MY(relativeoriginoffset) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
+ ,{ demand(n == 3 && "relativeoriginoffset"); MY(relativeoriginoffset) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
}, sprintf(" %v", (MY(relativeoriginoffset)) \
)) \
on(relativevelocityoffset, MY(relativevelocityoffset) \
- ,{ ASSERT(n == 3 && "relativevelocityoffset"); MY(relativevelocityoffset) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
+ ,{ demand(n == 3 && "relativevelocityoffset"); MY(relativevelocityoffset) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
}, sprintf(" %v", (MY(relativevelocityoffset)) \
)) \
on(rotate, MY(startangle_min) || MY(startangle_max) || MY(spin_min) || MY(spin_max) \
- ,{ ASSERT(n == 4 && "rotate"); MY(startangle_min) = stof(argv(1)); MY(startangle_max) = stof(argv(2)); MY(spin_min) = stof(argv(3)); MY(spin_max) = stof(argv(4)); \
+ ,{ demand(n == 4 && "rotate"); MY(startangle_min) = stof(argv(1)); MY(startangle_max) = stof(argv(2)); MY(spin_min) = stof(argv(3)); MY(spin_max) = stof(argv(4)); \
}, sprintf(" %s %s %s %s", ftos(MY(startangle_min)), ftos(MY(startangle_max)), ftos(MY(spin_min)), ftos(MY(spin_max)) \
)) \
on(sizeincrease, MY(sizeincrease) \
- ,{ ASSERT(n == 1 && "sizeincrease"); MY(sizeincrease) = stof(argv(1)); \
+ ,{ demand(n == 1 && "sizeincrease"); MY(sizeincrease) = stof(argv(1)); \
}, sprintf(" %s", ftos(MY(sizeincrease)) \
)) \
on(size, MY(size_min) || MY(size_max) \
- ,{ ASSERT(n == 2 && "size"); MY(size_min) = stof(argv(1)); MY(size_max) = stof(argv(2)); \
+ ,{ demand(n == 2 && "size"); MY(size_min) = stof(argv(1)); MY(size_max) = stof(argv(2)); \
}, sprintf(" %s %s", ftos(MY(size_min)), ftos(MY(size_max)) \
)) \
on(staincolor, MY(staincolor_min) || MY(staincolor_max) \
- ,{ ASSERT(n == 2 && "staincolor"); MY(staincolor_min) = strzone(argv(1)); MY(staincolor_max) = strzone(argv(2)); \
+ ,{ demand(n == 2 && "staincolor"); MY(staincolor_min) = strzone(argv(1)); MY(staincolor_max) = strzone(argv(2)); \
}, sprintf(" %s %s", (MY(staincolor_min)), (MY(staincolor_max)) \
)) \
on(stainsize, MY(stainsize_min) || MY(stainsize_max) \
- ,{ ASSERT(n == 2 && "stainsize"); MY(stainsize_min) = stof(argv(1)); MY(stainsize_max) = stof(argv(2)); \
+ ,{ demand(n == 2 && "stainsize"); MY(stainsize_min) = stof(argv(1)); MY(stainsize_max) = stof(argv(2)); \
}, sprintf(" %s %s", ftos(MY(stainsize_min)), ftos(MY(stainsize_max)) \
)) \
on(staintex, MY(staintex_min) || MY(staintex_max) \
- ,{ ASSERT(n == 2 && "staintex"); MY(staintex_min) = stof(argv(1)); MY(staintex_max) = stof(argv(2)); \
+ ,{ demand(n == 2 && "staintex"); MY(staintex_min) = stof(argv(1)); MY(staintex_max) = stof(argv(2)); \
}, sprintf(" %s %s", ftos(MY(staintex_min)), ftos(MY(staintex_max)) \
)) \
on(stretchfactor, MY(stretchfactor) \
- ,{ ASSERT(n == 1 && "stretchfactor"); MY(stretchfactor) = stof(argv(1)); \
+ ,{ demand(n == 1 && "stretchfactor"); MY(stretchfactor) = stof(argv(1)); \
}, sprintf(" %s", ftos(MY(stretchfactor)) \
)) \
on(tex, MY(tex_min) || MY(tex_max) \
- ,{ ASSERT(n == 2 && "tex"); MY(tex_min) = stof(argv(1)); MY(tex_max) = stof(argv(2)); \
+ ,{ demand(n == 2 && "tex"); MY(tex_min) = stof(argv(1)); MY(tex_max) = stof(argv(2)); \
}, sprintf(" %s %s", ftos(MY(tex_min)), ftos(MY(tex_max)) \
)) \
on(time, MY(time_min) || MY(time_max) \
- ,{ ASSERT(n == 2 && "time"); MY(time_min) = stof(argv(1)); MY(time_max) = stof(argv(2)); \
+ ,{ demand(n == 2 && "time"); MY(time_min) = stof(argv(1)); MY(time_max) = stof(argv(2)); \
}, sprintf(" %s %s", ftos(MY(time_min)), ftos(MY(time_max)) \
)) \
on(trailspacing, MY(trailspacing) \
- ,{ ASSERT(n == 1 && "trailspacing"); MY(trailspacing) = stof(argv(1)); \
+ ,{ demand(n == 1 && "trailspacing"); MY(trailspacing) = stof(argv(1)); \
}, sprintf(" %s", ftos(MY(trailspacing)) \
)) \
on(underwater, MY(underwater) \
- ,{ ASSERT(n == 0 && "underwater"); MY(underwater) = true; \
+ ,{ demand(n == 0 && "underwater"); MY(underwater) = true; \
}, "" \
) \
on(velocityjitter, MY(velocityjitter) \
- ,{ ASSERT(n == 3 && "velocityjitter"); MY(velocityjitter) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
+ ,{ demand(n == 3 && "velocityjitter"); MY(velocityjitter) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
}, sprintf(" %v", (MY(velocityjitter)) \
)) \
on(velocitymultiplier, MY(velocitymultiplier) \
- ,{ ASSERT(n == 1 && "velocitymultiplier"); MY(velocitymultiplier) = stof(argv(1)); \
+ ,{ demand(n == 1 && "velocitymultiplier"); MY(velocitymultiplier) = stof(argv(1)); \
}, sprintf(" %s", ftos(MY(velocitymultiplier)) \
)) \
on(velocityoffset, MY(velocityoffset) \
- ,{ ASSERT(n == 3 && "velocityoffset"); MY(velocityoffset) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
+ ,{ demand(n == 3 && "velocityoffset"); MY(velocityoffset) = vec3(stof(argv(1)), stof(argv(2)), stof(argv(3))); \
}, sprintf(" %v", (MY(velocityoffset)) \
)) \
/**/
n--;
string k = argv(0);
if (k == "effect") {
- ASSERT(n == 1);
+ demand(n == 1);
info = NEW(EffectInfo, strzone(argv(1)));
continue;
}
- ASSERT(info != NULL);
+ demand(info != NULL);
switch (k) {
#define MY(f) info.effectinfo_##f
#define p(k, isset, parse, unparse) case #k: parse break;
void effectinfo_dump(int fh, bool alsoprint)
{
- #define WRITE(s) do { \
+ #define WRITE(s) MACRO_BEGIN { \
fputs(fh, s); \
if (alsoprint) LOG_INFO(s); \
- } while (0)
+ } MACRO_END
WRITE("// ********************************************** //\n");
WRITE("// ** WARNING - DO NOT MANUALLY EDIT THIS FILE ** //\n");
WRITE("// ** ** //\n");
// if this is a copied dead body, send the num of its player instead
// TODO: remove this field, read from model txt files
if(self.classname == "body")
- e.team = num_for_edict(self.enemy);
+ e.team = etof(self.enemy);
else
- e.team = num_for_edict(self);
+ e.team = etof(self);
setorigin(e, org);
e.velocity = dir;
#include "globalsound.qh"
-#include "../common/ent_cs.qh"
+#include "../../ent_cs.qh"
#ifdef IMPLEMENTATION
#include "../../animdecide.qh"
string sample = GlobalSound_sample(gs.m_globalsoundstr, r);
int who = ReadByte();
entity e = entcs_receiver(who - 1);
- int chan = ReadByte();
- chan = (chan & BIT(7) ? -1 : 1) * (chan & BITS(7));
+ int chan = ReadSByte();
float vol = ReadByte() / 255;
float atten = ReadByte() / 64;
vector o;
UpdatePlayerSounds(e);
string s = e.(ps.m_playersoundfld);
string sample = GlobalSound_sample(s, r);
- int chan = ReadByte();
- chan = (chan & BIT(7) ? -1 : 1) * (chan & BITS(7));
+ int chan = ReadSByte();
float vol = ReadByte() / 255;
float atten = ReadByte() / 64;
vector o;
case VOICETYPE_TEAMRADIO:
{
#define X() \
- do \
+ MACRO_BEGIN \
{ \
float atten = (msg_entity.cvar_cl_voice_directional == 1) ? ATTEN_MIN : ATTEN_NONE; \
if (gs) globalsound(MSG_ONE, this, gs, r, chan, VOL_BASEVOICE, atten); \
else if (ps) playersound(MSG_ONE, this, ps, r, chan, VOL_BASEVOICE, atten); \
else soundto(MSG_ONE, this, chan, sample, VOL_BASEVOICE, atten); \
- } \
- while (0)
+ } MACRO_END
if (fake) { msg_entity = this; X(); }
else
float tauntrand = 0;
if (voicetype == VOICETYPE_AUTOTAUNT) tauntrand = random();
#define X() \
- do \
+ MACRO_BEGIN \
{ \
if (voicetype != VOICETYPE_AUTOTAUNT || tauntrand < msg_entity.cvar_cl_autotaunt) \
{ \
else if (ps) playersound(MSG_ONE, this, ps, r, chan, VOL_BASEVOICE, atten); \
else soundto(MSG_ONE, this, chan, sample, VOL_BASEVOICE, atten); \
} \
- } \
- while (0)
+ } MACRO_END
if (fake)
{
msg_entity = this;
void _GlobalSound(entity this, entity gs, entity ps, string sample, float chan, float voicetype, bool fake);
#define GlobalSound(this, def, chan, voicetype) _GlobalSound(this, def, NULL, string_null, chan, voicetype, false)
#define GlobalSound_string(this, def, chan, voicetype) _GlobalSound(this, NULL, NULL, def, chan, voicetype, false)
- #define PlayerSound(thise, def, chan, voicetype) _GlobalSound(this, NULL, def, string_null, chan, voicetype, false)
+ #define PlayerSound(this, def, chan, voicetype) _GlobalSound(this, NULL, def, string_null, chan, voicetype, false)
#define VoiceMessage(this, def, msg) \
- do \
+ MACRO_BEGIN \
{ \
entity VM = def; \
int voicetype = VM.m_playersoundvt; \
else if (flood > 0) fake = false; \
else break; \
_GlobalSound(this, NULL, VM, string_null, CH_VOICE, voicetype, fake); \
- } \
- while (0)
+ } MACRO_END
#endif
return entcs_IsSpectating(i) ? NUM_SPECTATOR : entcs_GetTeamColor(i);
}
+ /**
+ * Same as `entcs_GetTeam`, but returns -1 for no team in teamplay
+ */
+ int entcs_GetScoreTeam(int i)
+ {
+ int t = entcs_GetTeam(i);
+ if (teamplay && !t) t = -1;
+ return t;
+ }
+
/**
* @param i zero indexed player
*/
}
plyr.(weaponentity).weapons = plyr.weapons;
- plyr.(weaponentity).switchweapon = plyr.weapon;
+ plyr.(weaponentity).m_switchweapon = PS(plyr).m_weapon;
plyr.weapons = WEPSET(NEXBALL);
setself(plyr);
Weapon w = WEP_NEXBALL;
w.wr_resetplayer(w);
- plyr.switchweapon = WEP_NEXBALL.m_id;
- W_SwitchWeapon(WEP_NEXBALL.m_id);
+ PS(plyr).m_switchweapon = WEP_NEXBALL;
+ W_SwitchWeapon(WEP_NEXBALL);
setself(this);
}
self.weapons = self.(weaponentity).weapons;
Weapon w = WEP_NEXBALL;
w.wr_resetplayer(w);
- self.switchweapon = self.(weaponentity).switchweapon;
- W_SwitchWeapon(self.switchweapon);
+ PS(self).m_switchweapon = self.(weaponentity).m_switchweapon;
+ W_SwitchWeapon(PS(self).m_switchweapon);
self.(weaponentity).weapons = '0 0 0';
}
MUTATOR_HOOKFUNCTION(nb, ForbidThrowCurrentWeapon)
{SELFPARAM();
- return self.weapon == WEP_NEXBALL.m_id;
+ return PS(self).m_weapon == WEP_NEXBALL;
}
MUTATOR_HOOKFUNCTION(nb, ForbidDropCurrentWeapon)
{SELFPARAM();
- return self.weapon == WEP_MORTAR.m_id; // TODO: what is this for?
+ return PS(self).m_weapon == WEP_MORTAR; // TODO: what is this for?
}
MUTATOR_HOOKFUNCTION(nb, FilterItem)
--- /dev/null
+#include "all.qh"
--- /dev/null
+#ifndef IMPULSES_ALL_H
+#define IMPULSES_ALL_H
+
+REGISTRY(IMPULSES, 255)
+REGISTER_REGISTRY(IMPULSES)
+REGISTRY_SORT(IMPULSES)
+STATIC_INIT(IMPULSES_renumber)
+{
+ FOREACH(IMPULSES, true, LAMBDA(it.m_id = i));
+}
+REGISTRY_CHECK(IMPULSES)
+
+.void(entity this) impulse_handle;
+
+#if defined(CSQC)
+#define IMPULSE_ALIAS(alias, id) localcmd("\nalias " #alias " \"", id ,"\"\n")
+#else
+#define IMPULSE_ALIAS(alias, id)
+#endif
+
+#define REGISTER_IMPULSE(id, n) _REGISTER_IMPULSE(IMP_##id, id, n)
+#define _REGISTER_IMPULSE(id, alias, n) \
+ REGISTER(IMPULSES, id, m_id, new(Impulse)) \
+ { \
+ make_pure(this); \
+ this.impulse = n; \
+ IMPULSE_ALIAS(alias, "impulse " #n); \
+ }
+
+#define LEGACY_IMPULSE_ID(alias, id) LEGACY_IMPULSE(alias, id, sprintf("impulse %d", IMP_##alias.impulse))
+
+#define LEGACY_IMPULSE(alias, id, new) \
+ STATIC_INIT(legacy_##alias) { \
+ string s = new; \
+ if (s == #alias) LOG_FATALF("LEGACY_IMPULSE: would define a recursive alias for '%s', use LEGACY_IMPULSE_ID instead", s); \
+ IMPULSE_ALIAS(alias, s); \
+ } \
+ SHUTDOWN(legacy_##alias) { IMPULSE_ALIAS(alias, "impulse " #id); }
+
+#define X(slot, imp) \
+ REGISTER_IMPULSE(weapon_group_##slot, imp) \
+ LEGACY_IMPULSE(weapon_group_##slot, imp, "impulse " #imp)
+X(1, 1)
+X(2, 2)
+X(3, 3)
+X(4, 4)
+X(5, 5)
+X(6, 6)
+X(7, 7)
+X(8, 8)
+X(9, 9)
+X(0, 14)
+#undef X
+
+#define X(slot, dir, imp) \
+ REGISTER_IMPULSE(weapon_priority_##slot##_##dir, imp) \
+ LEGACY_IMPULSE(weapon_priority_##slot##_##dir, imp, "impulse " #imp)
+X(0, prev, 200)
+X(1, prev, 201)
+X(2, prev, 202)
+X(3, prev, 203)
+X(4, prev, 204)
+X(5, prev, 205)
+X(6, prev, 206)
+X(7, prev, 207)
+X(8, prev, 208)
+X(9, prev, 209)
+
+X(0, best, 210)
+X(1, best, 211)
+X(2, best, 212)
+X(3, best, 213)
+X(4, best, 214)
+X(5, best, 215)
+X(6, best, 216)
+X(7, best, 217)
+X(8, best, 218)
+X(9, best, 219)
+
+X(0, next, 220)
+X(1, next, 221)
+X(2, next, 222)
+X(3, next, 223)
+X(4, next, 224)
+X(5, next, 225)
+X(6, next, 226)
+X(7, next, 227)
+X(8, next, 228)
+X(9, next, 229)
+#undef X
+
+// direct weapons
+
+#define X(i, imp) \
+ REGISTER_IMPULSE(weapon_byid_##i, imp)
+X(0, 230)
+X(1, 231)
+X(2, 232)
+X(3, 233)
+X(4, 234)
+X(5, 235)
+X(6, 236)
+X(7, 237)
+X(8, 238)
+X(9, 239)
+X(10, 240)
+X(11, 241)
+X(12, 242)
+X(13, 243)
+X(14, 244)
+X(15, 245)
+X(16, 246)
+X(17, 247)
+X(18, 248)
+X(19, 249)
+X(20, 250)
+X(21, 251)
+X(22, 252)
+X(23, 253)
+#undef X
+
+REGISTER_IMPULSE(weapon_next_byid, 10)
+LEGACY_IMPULSE(_weapnext_2, 10, "weapon_next_byid")
+
+REGISTER_IMPULSE(weapon_prev_byid, 12)
+LEGACY_IMPULSE(_weapprev_2, 12, "weapon_prev_byid")
+
+REGISTER_IMPULSE(weapon_next_bygroup, 18)
+LEGACY_IMPULSE(_weapnext_0, 18, "weapon_next_bygroup")
+
+REGISTER_IMPULSE(weapon_prev_bygroup, 19)
+LEGACY_IMPULSE(_weapprev_0, 19, "weapon_prev_bygroup")
+
+REGISTER_IMPULSE(weapon_next_bypriority, 15)
+LEGACY_IMPULSE(_weapnext_1, 15, "weapon_next_bypriority")
+
+REGISTER_IMPULSE(weapon_prev_bypriority, 16)
+LEGACY_IMPULSE(_weapprev_1, 16, "weapon_prev_bypriority")
+
+REGISTER_IMPULSE(weapon_last, 11)
+LEGACY_IMPULSE(weaplast, 11, "weapon_last")
+
+REGISTER_IMPULSE(weapon_best, 13)
+LEGACY_IMPULSE(weapbest, 13, "weapon_best")
+
+REGISTER_IMPULSE(weapon_drop, 17)
+LEGACY_IMPULSE(dropweapon, 17, "weapon_drop")
+
+REGISTER_IMPULSE(weapon_reload, 20)
+LEGACY_IMPULSE(reload, 20, "weapon_reload")
+
+REGISTER_IMPULSE(use, 21)
+LEGACY_IMPULSE_ID(use, 21)
+
+REGISTER_IMPULSE(waypoint_personal_here, 30)
+LEGACY_IMPULSE(g_waypointsprite_personal, 30, "waypoint_personal_here")
+
+REGISTER_IMPULSE(waypoint_personal_crosshair, 31)
+LEGACY_IMPULSE(g_waypointsprite_personal_p, 31, "waypoint_personal_crosshair")
+
+REGISTER_IMPULSE(waypoint_personal_death, 32)
+LEGACY_IMPULSE(g_waypointsprite_personal_d, 32, "waypoint_personal_death")
+
+REGISTER_IMPULSE(waypoint_here_follow, 33)
+LEGACY_IMPULSE(g_waypointsprite_team_helpme, 33, "waypoint_here_follow")
+
+REGISTER_IMPULSE(waypoint_here_here, 34)
+LEGACY_IMPULSE(g_waypointsprite_team_here, 34, "waypoint_here_here")
+
+REGISTER_IMPULSE(waypoint_here_crosshair, 35)
+LEGACY_IMPULSE(g_waypointsprite_team_here_p, 35, "waypoint_here_crosshair")
+
+REGISTER_IMPULSE(waypoint_here_death, 36)
+LEGACY_IMPULSE(g_waypointsprite_team_here_d, 36, "waypoint_here_death")
+
+REGISTER_IMPULSE(waypoint_danger_here, 37)
+LEGACY_IMPULSE(g_waypointsprite_team_danger, 37, "waypoint_danger_here")
+
+REGISTER_IMPULSE(waypoint_danger_crosshair, 38)
+LEGACY_IMPULSE(g_waypointsprite_team_danger_p, 38, "waypoint_danger_crosshair")
+
+REGISTER_IMPULSE(waypoint_danger_death, 39)
+LEGACY_IMPULSE(g_waypointsprite_team_danger_d, 39, "waypoint_danger_death")
+
+REGISTER_IMPULSE(waypoint_clear_personal, 47)
+LEGACY_IMPULSE(g_waypointsprite_clear_personal, 47, "waypoint_clear_personal")
+
+REGISTER_IMPULSE(waypoint_clear, 48)
+LEGACY_IMPULSE(g_waypointsprite_clear, 48, "waypoint_clear")
+
+REGISTER_IMPULSE(navwaypoint_spawn, 103)
+LEGACY_IMPULSE(g_waypointeditor_spawn, 103, "navwaypoint_spawn")
+
+REGISTER_IMPULSE(navwaypoint_remove, 104)
+LEGACY_IMPULSE(g_waypointeditor_remove, 104, "navwaypoint_remove")
+
+REGISTER_IMPULSE(navwaypoint_relink, 105)
+LEGACY_IMPULSE(g_waypointeditor_relinkall, 105, "navwaypoint_relink")
+
+REGISTER_IMPULSE(navwaypoint_save, 106)
+LEGACY_IMPULSE(g_waypointeditor_saveall, 106, "navwaypoint_save")
+
+REGISTER_IMPULSE(navwaypoint_unreachable, 107)
+LEGACY_IMPULSE(g_waypointeditor_unreachable, 107, "navwaypoint_unreachable")
+
+#define CHIMPULSE(id, n) _CHIMPULSE(CHIMPULSE_##id, n)
+#define _CHIMPULSE(id, n) \
+ REGISTER(IMPULSES, id, m_id, new(Impulse)) \
+ { \
+ make_pure(this); \
+ this.impulse = n; \
+ }
+
+CHIMPULSE(SPEEDRUN_INIT, 30)
+CHIMPULSE(GIVE_ALL, 99)
+CHIMPULSE(CLONE_MOVING, 140)
+CHIMPULSE(SPEEDRUN, 141)
+CHIMPULSE(CLONE_STANDING, 142)
+CHIMPULSE(TELEPORT, 143)
+CHIMPULSE(R00T, 148)
+
+#endif
#include "mapinfo.qh"
#endif
+bool autocvar_developer_mapper;
+
+#define LOG_MAPWARN(...) MACRO_BEGIN { if (autocvar_developer_mapper) LOG_WARNING(__VA_ARGS__); } MACRO_END
+#define LOG_MAPWARNF(...) MACRO_BEGIN { if (autocvar_developer_mapper) LOG_WARNINGF(__VA_ARGS__); } MACRO_END
+
// generic string stuff
int _MapInfo_Cache_Active;
}
if(inWorldspawn)
{
- LOG_INFO(fn, " ended still in worldspawn, BUG\n");
+ LOG_MAPWARN(fn, " ended still in worldspawn, BUG\n");
return 0;
}
diameter = vlen(mapMaxs - mapMins);
if (sa == "") continue;
int p = strstrofs(sa, "=", 0);
if (p < 0) {
- LOG_WARNINGF("Invalid gametype setting in mapinfo for gametype %s: %s\n", MapInfo_Type_ToString(pWantedType), sa);
+ LOG_MAPWARNF("Invalid gametype setting in mapinfo for gametype %s: %s\n", MapInfo_Type_ToString(pWantedType), sa);
continue;
}
string k = substring(sa, 0, p);
}
FOREACH(Gametypes, true, LAMBDA(handled |= it.m_parse_mapinfo(k, v)));
if (!handled)
- LOG_WARNINGF("Invalid gametype setting in mapinfo for gametype %s: %s\n", MapInfo_Type_ToString(pWantedType), sa);
+ LOG_MAPWARNF("Invalid gametype setting in mapinfo for gametype %s: %s\n", MapInfo_Type_ToString(pWantedType), sa);
}
if (pWantedType == MAPINFO_TYPE_RACE && cvar("g_race_teams") >= 2)
int MapInfo_Type_FromString(string t)
{
-#define deprecate(from, to) do { \
+#define deprecate(from, to) MACRO_BEGIN { \
if (t == #from) { \
string replacement = #to; \
- LOG_WARNINGF("MapInfo_Type_FromString (probably %s): using deprecated name '%s'. Should use '%s'.\n", MapInfo_Map_bspname, t, replacement); \
+ LOG_MAPWARNF("MapInfo_Type_FromString (probably %s): using deprecated name '%s'. Should use '%s'.\n", MapInfo_Map_bspname, t, replacement); \
t = replacement; \
} \
-} while (0)
+} MACRO_END
deprecate(nexball, nb);
deprecate(freezetag, ft);
deprecate(keepaway, ka);
{
fh = fopen(s, FILE_READ);
if(fh < 0)
- LOG_INFO("Map ", pFilename, " references not existing config file ", s, "\n");
+ LOG_MAPWARN("Map ", pFilename, " references not existing config file ", s, "\n");
else
{
for (;;)
}
}
else
- LOG_INFO("Map ", pFilename, " uses too many levels of inclusion\n");
+ LOG_MAPWARN("Map ", pFilename, " uses too many levels of inclusion\n");
}
else if(t == "")
- LOG_INFO("Map ", pFilename, " contains a potentially harmful setting, ignored\n");
+ LOG_MAPWARN("Map ", pFilename, " contains a potentially harmful setting, ignored\n");
else if (!cvar_value_issafe(t))
- LOG_INFO("Map ", pFilename, " contains a potentially harmful setting, ignored\n");
+ LOG_MAPWARN("Map ", pFilename, " contains a potentially harmful setting, ignored\n");
else if (!cvar_value_issafe(s))
- LOG_INFO("Map ", pFilename, " contains a potentially harmful setting, ignored\n");
+ LOG_MAPWARN("Map ", pFilename, " contains a potentially harmful setting, ignored\n");
else if(matchacl(MAPINFO_SETTEMP_ACL_SYSTEM, t) <= 0)
- LOG_INFO("Map ", pFilename, " contains a potentially harmful setting, ignored\n");
+ LOG_MAPWARN("Map ", pFilename, " contains a potentially harmful setting, ignored\n");
else if(matchacl(acl, t) <= 0)
- LOG_INFO("Map ", pFilename, " contains a denied setting, ignored\n");
+ LOG_MAPWARN("Map ", pFilename, " contains a denied setting, ignored\n");
else
{
if(type == 0) // server set
if(strstrofs(pFilename, "/", 0) >= 0)
{
- LOG_INFO("Invalid character in map name, ignored\n");
+ LOG_MAPWARN("Invalid character in map name, ignored\n");
return 0;
}
error("... but I just wrote it!");
}
- LOG_INFO("WARNING: autogenerated mapinfo file ", fn, " has been loaded; please edit that file and move it to maps/", pFilename, ".mapinfo\n");
+ LOG_MAPWARN("autogenerated mapinfo file ", fn, " has been loaded; please edit that file and move it to maps/", pFilename, ".mapinfo\n");
}
_MapInfo_Map_Reset();
else if(t == "monsters") MapInfo_Map_supportedFeatures |= MAPINFO_FEATURE_MONSTERS;
else if(t == "new_toys") MapInfo_Map_supportedFeatures |= MAPINFO_FEATURE_WEAPONS;
else
- LOG_TRACE("Map ", pFilename, " supports unknown feature ", t, ", ignored\n");
+ LOG_MAPWARN("Map ", pFilename, " supports unknown feature ", t, ", ignored\n");
}
else if(t == "hidden")
{
{
t = car(s); s = cdr(s);
f = MapInfo_Type_FromString(t);
- LOG_WARNING("Map ", pFilename, " contains the legacy 'type' keyword which is deprecated and will be removed in the future. Please migrate the mapinfo file to 'gametype'.\n");
+ LOG_MAPWARN("Map ", pFilename, " contains the legacy 'type' keyword which is deprecated and will be removed in the future. Please migrate the mapinfo file to 'gametype'.\n");
if(f)
_MapInfo_Map_ApplyGametype (s, pGametypeToSet, f, true);
else
- LOG_TRACE("Map ", pFilename, " supports unknown game type ", t, ", ignored\n");
+ LOG_MAPWARN("Map ", pFilename, " supports unknown game type ", t, ", ignored\n");
}
else if(t == "gametype")
{
if(f)
_MapInfo_Map_ApplyGametypeEx (s, pGametypeToSet, f);
else
- LOG_TRACE("Map ", pFilename, " supports unknown game type ", t, ", ignored\n");
+ LOG_MAPWARN("Map ", pFilename, " supports unknown game type ", t, ", ignored\n");
}
else if(t == "size")
{
t = car(s); s = cdr(s); d = stof(t);
t = car(s); s = cdr(s); e = stof(t);
if(s == "")
- LOG_INFO("Map ", pFilename, " contains an incorrect size line (not enough params), syntax: size mins_x mins_y mins_z maxs_x maxs_y maxs_z\n");
+ LOG_MAPWARN("Map ", pFilename, " contains an incorrect size line (not enough params), syntax: size mins_x mins_y mins_z maxs_x maxs_y maxs_z\n");
else
{
t = car(s); s = cdr(s); f = stof(t);
if(s != "")
- LOG_INFO("Map ", pFilename, " contains an incorrect size line (too many params), syntax: size mins_x mins_y mins_z maxs_x maxs_y maxs_z\n");
+ LOG_MAPWARN("Map ", pFilename, " contains an incorrect size line (too many params), syntax: size mins_x mins_y mins_z maxs_x maxs_y maxs_z\n");
else
{
if(a >= d || b >= e || c >= f)
- LOG_INFO("Map ", pFilename, " contains an incorrect size line, mins have to be < maxs\n");
+ LOG_MAPWARN("Map ", pFilename, " contains an incorrect size line, mins have to be < maxs\n");
else
{
MapInfo_Map_mins.x = a;
}
else
{
- LOG_TRACE("Map ", pFilename, " has a setting for unknown game type ", t, ", ignored\n");
+ LOG_MAPWARN("Map ", pFilename, " has a setting for unknown game type ", t, ", ignored\n");
}
}
else if(t == "clientsettemp_for_type")
}
else
{
- LOG_TRACE("Map ", pFilename, " has a client setting for unknown game type ", t, ", ignored\n");
+ LOG_MAPWARN("Map ", pFilename, " has a client setting for unknown game type ", t, ", ignored\n");
}
}
else if(t == "fog")
{
if (!cvar_value_issafe(s))
- LOG_INFO("Map ", pFilename, " contains a potentially harmful fog setting, ignored\n");
+ LOG_MAPWARN("Map ", pFilename, " contains a potentially harmful fog setting, ignored\n");
else
MapInfo_Map_fog = s;
}
if(pGametypeToSet)
{
if (!cvar_value_issafe(t))
- LOG_INFO("Map ", pFilename, " contains a potentially harmful cdtrack, ignored\n");
+ LOG_MAPWARN("Map ", pFilename, " contains a potentially harmful cdtrack, ignored\n");
else
MapInfo_Map_clientstuff = strcat(
MapInfo_Map_clientstuff, "cd loop \"", t, "\"\n"
}
}
else
- LOG_TRACE("Map ", pFilename, " provides unknown info item ", t, ", ignored\n");
+ LOG_MAPWARN("Map ", pFilename, " provides unknown info item ", t, ", ignored\n");
}
fclose(fh);
MapInfo_Cache_Store();
if(MapInfo_Map_supportedGametypes != 0)
return r;
- LOG_TRACE("Map ", pFilename, " supports no game types, ignored\n");
+ LOG_MAPWARN("Map ", pFilename, " supports no game types, ignored\n");
return 0;
}
float MapInfo_Get_ByName(string pFilename, float pAllowGenerate, int pGametypeToSet)
{
if(cvar("g_mapinfo_allow_unsupported_modes_and_let_stuff_break"))
{
- LOG_INFO("EMERGENCY: can't play the selected map in the given game mode. Working with only the override settings.\n");
+ LOG_SEVERE("can't play the selected map in the given game mode. Working with only the override settings.\n");
_MapInfo_Map_ApplyGametypeEx("", t, t);
return; // do not call Get_ByName!
}
if(MapInfo_Map_supportedGametypes == 0)
{
- LOG_INFO("Mapinfo system is not functional at all. Assuming deathmatch.\n");
+ LOG_SEVERE("Mapinfo system is not functional at all. Assuming deathmatch.\n");
MapInfo_Map_supportedGametypes = MAPINFO_TYPE_DEATHMATCH;
MapInfo_LoadMapSettings_SaveGameType(MAPINFO_TYPE_DEATHMATCH);
_MapInfo_Map_ApplyGametypeEx("", MAPINFO_TYPE_DEATHMATCH, MAPINFO_TYPE_DEATHMATCH);
}
// t is now a supported mode!
- LOG_INFO("EMERGENCY: can't play the selected map in the given game mode. Falling back to a supported mode.\n");
+ LOG_WARNING("can't play the selected map in the given game mode. Falling back to a supported mode.\n");
MapInfo_LoadMapSettings_SaveGameType(t);
}
MapInfo_Get_ByName(s, 1, t);
void minigame_autoclean_entity(entity e)
{
- LOG_DEBUG("CL Auto-cleaned: ",ftos(num_for_edict(e)), " (",e.classname,")\n");
+ LOG_DEBUG("CL Auto-cleaned: ",ftos(etof(e)), " (",e.classname,")\n");
remove(e);
}
if ( sf & MINIG_SF_CREATE )
{
- LOG_DEBUG("CL Reading entity: ",ftos(num_for_edict(self)),
+ LOG_DEBUG("CL Reading entity: ",ftos(etof(self)),
" classname:",self.classname," enttype:",ftos(self.enttype) );
LOG_DEBUG(" sf:",ftos(sf)," netname:",self.netname,"\n\n");
}
}
minigame_session.minigame_event(minigame_session,"part",player);
GameLogEcho(strcat(":minigame:part:",minigame_session.netname,":",
- ftos(num_for_edict(player)),":",player.netname));
+ ftos(etof(player)),":",player.netname));
minigame_session.minigame_players = p.list_next;
remove ( p );
player_clear_minigame(player);
{
minigame_session.minigame_event(minigame_session,"part",player);
GameLogEcho(strcat(":minigame:part:",minigame_session.netname,":",
- ftos(num_for_edict(player)),":",player.netname));
+ ftos(etof(player)),":",player.netname));
p.list_next = e.list_next;
remove(e);
player_clear_minigame(player);
if ( sf & MINIG_SF_CREATE )
{
WriteString(MSG_ENTITY,self.owner.netname);
- WriteLong(MSG_ENTITY,num_for_edict(self.minigame_players));
+ WriteLong(MSG_ENTITY,etof(self.minigame_players));
}
if ( sf & MINIG_SF_UPDATE )
WriteByte(MSG_ENTITY,self.team);
}
else { remove(player_pointer); }
GameLogEcho(strcat(":minigame:join",(mgteam?"":"fail"),":",minigame_session.netname,":",
- ftos(num_for_edict(player)),":",player.netname));
+ ftos(etof(player)),":",player.netname));
return mgteam;
}
if ( e )
{
entity minig = new(minigame);
- minig.netname = strzone(strcat(e.netname,"_",ftos(num_for_edict(minig))));
+ minig.netname = strzone(strcat(e.netname,"_",ftos(etof(minig))));
minig.descriptor = e;
minig.minigame_event = e.minigame_event;
minig.minigame_event(minig,"start");
while( (e = findentity(e, owner, minigame_session)) )
if ( e.minigame_autoclean )
{
- LOG_TRACE("SV Auto-cleaned: ",ftos(num_for_edict(e)), " (",e.classname,")\n");
+ LOG_TRACE("SV Auto-cleaned: ",ftos(etof(e)), " (",e.classname,")\n");
remove(e);
}
inviter.active_minigame.netname, inviter.netname );
GameLogEcho(strcat(":minigame:invite:",inviter.active_minigame.netname,":",
- ftos(num_for_edict(player)),":",player.netname));
+ ftos(etof(player)),":",player.netname));
return "";
}
return world;
}
-bool MinigameImpulse(int imp)
-{SELFPARAM();
- entity e = minigame_find_player(self);
- if ( imp && self.active_minigame && e )
+bool MinigameImpulse(entity this, int imp)
+{
+ if (!this.active_minigame) return false;
+ entity e = minigame_find_player(this);
+ if ( imp && this.active_minigame && e )
{
- return self.active_minigame.minigame_event(self.active_minigame,"impulse",e,imp);
+ return this.active_minigame.minigame_event(this.active_minigame,"impulse",e,imp);
}
return false;
}
bool minigame_CheckSend();
// Check for minigame impulses
-bool MinigameImpulse(int imp);
+bool MinigameImpulse(entity this, int imp);
// Parse a client command ( cmd minigame ... )
void ClientCommand_minigame(int request, int argc, string command);
if(!_Movetype_TestEntityPosition(this, '0 0 -1' * i)) goto success;
if(!_Movetype_TestEntityPosition(this, '0 0 1' * i)) goto success;
}
- LOG_DEBUG("Can't unstick an entity (edict: %d, classname: %s, origin: %s)\n",
- num_for_edict(this), this.classname, vtos(this.move_origin));
+ LOG_DEBUGF("Can't unstick an entity (edict: %d, classname: %s, origin: %s)\n",
+ etof(this), this.classname, vtos(this.move_origin));
return false;
: success;
- LOG_DEBUG("Sucessfully unstuck an entity (edict: %d, classname: %s, origin: %s)\n",
- num_for_edict(this), this.classname, vtos(this.move_origin));
+ LOG_DEBUGF("Sucessfully unstuck an entity (edict: %d, classname: %s, origin: %s)\n",
+ etof(this), this.classname, vtos(this.move_origin));
_Movetype_LinkEdict(this, true);
return true;
}
bool mut##_##cb() { return = false; } \
[[accumulate]] bool mut##_##cb()
-#define MUTATOR_HOOK(cb, func, order) do { \
+#define MUTATOR_HOOK(cb, func, order) MACRO_BEGIN { \
MUTATOR_ONADD { \
if (!CallbackChain_Add(HOOK_##cb, CALLBACK_##func, order)) { \
LOG_INFO("HOOK FAILED: ", #cb, ":", #func, "\n"); \
MUTATOR_ONROLLBACK_OR_REMOVE { \
CallbackChain_Remove(HOOK_##cb, CALLBACK_##func); \
} \
-} while (0)
+} MACRO_END
#include "events.qh"
if(self.buffs & BUFF_AMMO.m_itemid)
if(self.clip_size)
- self.clip_load = self.(weapon_load[self.switchweapon]) = self.clip_size;
+ self.clip_load = self.(weapon_load[PS(self).m_switchweapon.m_id]) = self.clip_size;
if((self.buffs & BUFF_INVISIBLE.m_itemid) && (self.oldbuffs & BUFF_INVISIBLE.m_itemid))
if(self.alpha != autocvar_g_buffs_invisible_alpha)
if(self.clip_load)
self.buff_ammo_prev_clipload = self.clip_load;
- self.clip_load = self.(weapon_load[self.switchweapon]) = self.clip_size;
+ self.clip_load = self.(weapon_load[PS(self).m_switchweapon.m_id]) = self.clip_size;
}
BUFF_ONREM(BUFF_AMMO)
#ifndef MENUQC
-#define NADE_PROJECTILE(i, projectile, trail) do { \
+#define NADE_PROJECTILE(i, projectile, trail) MACRO_BEGIN { \
this.m_projectile[i] = projectile; \
this.m_trail[i] = trail; \
-} while (0)
+} MACRO_END
#else
#define NADE_PROJECTILE(i, projectile, trail)
#endif
void nade_touch()
{SELFPARAM();
+ if(other)
+ UpdateCSQCProjectile(self);
+
+ if(other == self.realowner)
+ return; // no self impacts
/*float is_weapclip = 0;
if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NODRAW)
if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NONSOLID))
for(i = WEP_FIRST; i <= WEP_LAST; ++i)
{
entity e = Weapons_from(i);
- if(!e.weapon)
- continue;
+ if(e == WEP_Null) continue;
n = tokenize_console(nt_GetReplacement(e.netname, autocvar_g_new_toys_autoreplace));
e.ammo_rockets = start_ammo_rockets;
e.ammo_fuel = start_ammo_fuel;
e.weapons = start_weapons;
- if(!client_hasweapon(e, e.weapon, true, false))
- e.switchweapon = w_getbestweapon(self);
+ if(!client_hasweapon(e, PS(e).m_weapon, true, false))
+ PS(e).m_switchweapon = w_getbestweapon(self);
}
}
bool NIX_CanChooseWeapon(int wpn)
{
entity e = Weapons_from(wpn);
- if(!e.weapon) // skip dummies
- return false;
+ if (e == WEP_Null) return false; // skip dummies
if(g_weaponarena)
{
if(!(g_weaponarena_weapons & e.m_wepset))
self.weapons |= WEPSET(BLASTER);
self.weapons |= e.m_wepset;
- if(self.switchweapon != nix_weapon)
- if(!client_hasweapon(self, self.switchweapon, true, false))
- if(client_hasweapon(self, nix_weapon, true, false))
- W_SwitchWeapon(nix_weapon);
+ Weapon w = Weapons_from(nix_weapon);
+ if(PS(self).m_switchweapon != w)
+ if(!client_hasweapon(self, PS(self).m_switchweapon, true, false))
+ {
+ if(client_hasweapon(self, w, true, false))
+ W_SwitchWeapon(w);
+ }
}
MUTATOR_HOOKFUNCTION(nix, ForbidThrowCurrentWeapon)
/* wepimg */ ATTRIB(HeavyMachineGun, model2, string, "weaponhmg");
/* refname */ ATTRIB(HeavyMachineGun, netname, string, "hmg");
/* wepname */ ATTRIB(HeavyMachineGun, m_name, string, _("Heavy Machine Gun"));
+
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, ammo, float, NONE) \
+ P(class, prefix, damage, float, NONE) \
+ P(class, prefix, force, float, NONE) \
+ P(class, prefix, refire, float, NONE) \
+ P(class, prefix, reload_ammo, float, NONE) \
+ P(class, prefix, reload_time, float, NONE) \
+ P(class, prefix, solidpenetration, float, NONE) \
+ P(class, prefix, spread_add, float, NONE) \
+ P(class, prefix, spread_max, float, NONE) \
+ P(class, prefix, spread_min, float, NONE) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, weaponreplace, string, NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ END()
+ W_PROPS(X, HeavyMachineGun, hmg)
+#undef X
+
ENDCLASS(HeavyMachineGun)
-REGISTER_WEAPON(HMG, NEW(HeavyMachineGun));
-
-#define HMG_SETTINGS(w_cvar,w_prop) HMG_SETTINGS_LIST(w_cvar, w_prop, HMG, hmg)
-#define HMG_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
- w_cvar(id, sn, NONE, spread_min) \
- w_cvar(id, sn, NONE, spread_max) \
- w_cvar(id, sn, NONE, spread_add) \
- w_cvar(id, sn, NONE, solidpenetration) \
- w_cvar(id, sn, NONE, damage) \
- w_cvar(id, sn, NONE, force) \
- w_cvar(id, sn, NONE, refire) \
- w_cvar(id, sn, NONE, ammo) \
- w_prop(id, sn, float, reloading_ammo, reload_ammo) \
- w_prop(id, sn, float, reloading_time, reload_time) \
- w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
- w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
- w_prop(id, sn, string, weaponreplace, weaponreplace) \
- w_prop(id, sn, float, weaponstart, weaponstart) \
- w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
- w_prop(id, sn, float, weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(HMG, hmg, NEW(HeavyMachineGun));
-#ifdef SVQC
-HMG_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
-#endif
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
}
}
}
- METHOD(HeavyMachineGun, wr_init, void(entity thiswep))
- {
- HMG_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
- }
METHOD(HeavyMachineGun, wr_checkammo1, bool(entity thiswep))
{
float ammo_amount = self.ammo_nails >= WEP_CVAR(hmg, ammo);
return ammo_amount;
}
- METHOD(HeavyMachineGun, wr_config, void(entity thiswep))
- {
- HMG_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
- }
METHOD(HeavyMachineGun, wr_reload, void(entity thiswep))
{
W_Reload(self, WEP_CVAR(hmg, ammo), SND(RELOAD));
entity actor = MUTATOR_ARGV(0, entity);
if (actor.ok_use_ammocharge)
{
- ok_DecreaseCharge(actor, actor.weapon);
+ ok_DecreaseCharge(actor, PS(actor).m_weapon.m_id);
return true;
}
}
entity wepent = Weapons_from(wep);
- if(wepent.weapon == 0)
- return; // dummy
+ if (wepent == WEP_Null) return; // dummy
ent.ammo_charge[wep] -= max(0, cvar(sprintf("g_overkill_ammo_decharge_%s", wepent.netname)));
}
{
entity wepent = Weapons_from(wep);
- if(wepent.weapon == 0)
- return; // dummy
+ if (wepent == WEP_Null) return; // dummy
if(ent.ok_use_ammocharge)
if(!ent.BUTTON_ATCK) // not while attacking?
entity wepent = Weapons_from(wep);
- if(wepent.weapon == 0)
- return 0; // dummy
+ if(wepent == WEP_Null) return 0; // dummy
return (ent.ammo_charge[wep] >= cvar(sprintf("g_overkill_ammo_decharge_%s", wepent.netname)));
}
}
MUTATOR_HOOKFUNCTION(ok, PlayerDies)
-{SELFPARAM();
+{
+ SELFPARAM();
entity targ = ((frag_attacker) ? frag_attacker : frag_target);
- if(IS_MONSTER(self))
+ if(IS_MONSTER(this))
{
remove(other); // remove default item
- other = world;
+ other = NULL;
}
- setself(new(droppedweapon)); // hax
- self.ok_item = true;
- self.noalign = true;
- self.pickup_anyway = true;
- spawnfunc_item_armor_small(this);
- self.movetype = MOVETYPE_TOSS;
- self.gravity = 1;
- self.reset = SUB_Remove;
- setorigin(self, frag_target.origin + '0 0 32');
- self.velocity = '0 0 200' + normalize(targ.origin - self.origin) * 500;
- SUB_SetFade(self, time + 5, 1);
- setself(this);
-
- self.ok_lastwep = self.switchweapon;
+ entity e = new(droppedweapon); // hax
+ e.ok_item = true;
+ e.noalign = true;
+ e.pickup_anyway = true;
+ e.spawnfunc_checked = true;
+ spawnfunc_item_armor_small(e);
+ e.movetype = MOVETYPE_TOSS;
+ e.gravity = 1;
+ e.reset = SUB_Remove;
+ setorigin(e, frag_target.origin + '0 0 32');
+ e.velocity = '0 0 200' + normalize(targ.origin - self.origin) * 500;
+ SUB_SetFade(e, time + 5, 1);
+
+ this.ok_lastwep = PS(this).m_switchweapon.m_id;
return false;
}
if(self.ok_lastwep)
{
- self.switchweapon = self.ok_lastwep;
+ PS(self).m_switchweapon = Weapons_from(self.ok_lastwep);
self.ok_lastwep = 0;
}
- ok_IncreaseCharge(self, self.weapon);
+ ok_IncreaseCharge(self, PS(self).m_weapon.m_id);
if(self.BUTTON_ATCK2)
if(!forbidWeaponUse(self) || self.weapon_blocked) // allow if weapon is blocked
self.jump_interval = time + WEP_CVAR_PRI(blaster, refire) * W_WeaponRateFactor();
makevectors(self.v_angle);
- int oldwep = self.weapon;
- self.weapon = WEP_BLASTER.m_id;
+ Weapon oldwep = PS(self).m_weapon;
+ PS(self).m_weapon = WEP_BLASTER;
W_Blaster_Attack(
self,
WEP_BLASTER.m_id | HITTYPE_SECONDARY,
WEP_CVAR_SEC(vaporizer, delay),
WEP_CVAR_SEC(vaporizer, lifetime)
);
- self.weapon = oldwep;
+ PS(self).m_weapon = oldwep;
}
self.weapon_blocked = false;
- self.ok_ammo_charge = self.ammo_charge[self.weapon];
+ self.ok_ammo_charge = self.ammo_charge[PS(self).m_weapon.m_id];
if(self.ok_use_ammocharge)
- if(!ok_CheckWeaponCharge(self, self.weapon))
+ if(!ok_CheckWeaponCharge(self, PS(self).m_weapon.m_id))
{
- if(autocvar_g_overkill_ammo_charge_notice && time > self.ok_notice_time && self.BUTTON_ATCK && IS_REAL_CLIENT(self) && self.weapon == self.switchweapon)
+ if(autocvar_g_overkill_ammo_charge_notice && time > self.ok_notice_time && self.BUTTON_ATCK && IS_REAL_CLIENT(self) && PS(self).m_weapon == PS(self).m_switchweapon)
{
//Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_OVERKILL_CHARGE);
self.ok_notice_time = time + 2;
play2(self, SND(DRYFIRE));
}
- Weapon wpn = Weapons_from(self.weapon);
+ Weapon wpn = PS(self).m_weapon;
.entity weaponentity = weaponentities[0]; // TODO: unhardcode
if(self.(weaponentity).state != WS_CLEAR)
w_ready(wpn, self, weaponentity, (self.BUTTON_ATCK ? 1 : 0) | (self.BUTTON_ATCK2 ? 2 : 0));
wep.team = self.team;
wep.respawntime = autocvar_g_overkill_superguns_respawn_time;
wep.pickup_anyway = true;
+ wep.spawnfunc_checked = true;
wep.think = self_spawnfunc_weapon_hmg;
wep.nextthink = time + 0.1;
return true;
wep.team = self.team;
wep.respawntime = autocvar_g_overkill_superguns_respawn_time;
wep.pickup_anyway = true;
+ wep.spawnfunc_checked = true;
wep.think = self_spawnfunc_weapon_rpc;
wep.nextthink = time + 0.1;
return true;
MUTATOR_HOOKFUNCTION(ok, SpectateCopy)
{SELFPARAM();
- self.ammo_charge[self.weapon] = other.ammo_charge[other.weapon];
+ self.ammo_charge[PS(self).m_weapon.m_id] = other.ammo_charge[PS(other).m_weapon.m_id];
self.ok_use_ammocharge = other.ok_use_ammocharge;
return false;
/* wepimg */ ATTRIB(RocketPropelledChainsaw, model2, string, "weaponrpc");
/* refname */ ATTRIB(RocketPropelledChainsaw, netname, string, "rpc");
/* wepname */ ATTRIB(RocketPropelledChainsaw, m_name, string, _("Rocket Propelled Chainsaw"));
+
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, ammo, float, NONE) \
+ P(class, prefix, animtime, float, NONE) \
+ P(class, prefix, damage2, float, NONE) \
+ P(class, prefix, damageforcescale, float, NONE) \
+ P(class, prefix, damage, float, NONE) \
+ P(class, prefix, edgedamage, float, NONE) \
+ P(class, prefix, force, float, NONE) \
+ P(class, prefix, health, float, NONE) \
+ P(class, prefix, lifetime, float, NONE) \
+ P(class, prefix, radius, float, NONE) \
+ P(class, prefix, refire, float, NONE) \
+ P(class, prefix, reload_ammo, float, NONE) \
+ P(class, prefix, reload_time, float, NONE) \
+ P(class, prefix, speedaccel, float, NONE) \
+ P(class, prefix, speed, float, NONE) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, weaponreplace, string, NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ END()
+ W_PROPS(X, RocketPropelledChainsaw, rpc)
+#undef X
+
ENDCLASS(RocketPropelledChainsaw)
-REGISTER_WEAPON(RPC, NEW(RocketPropelledChainsaw));
-
-#define RPC_SETTINGS(w_cvar,w_prop) RPC_SETTINGS_LIST(w_cvar, w_prop, RPC, rpc)
-#define RPC_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
- w_cvar(id, sn, NONE, ammo) \
- w_cvar(id, sn, NONE, animtime) \
- w_cvar(id, sn, NONE, damage) \
- w_cvar(id, sn, NONE, damage2) \
- w_cvar(id, sn, NONE, damageforcescale) \
- w_cvar(id, sn, NONE, edgedamage) \
- w_cvar(id, sn, NONE, force) \
- w_cvar(id, sn, NONE, health) \
- w_cvar(id, sn, NONE, lifetime) \
- w_cvar(id, sn, NONE, radius) \
- w_cvar(id, sn, NONE, refire) \
- w_cvar(id, sn, NONE, speed) \
- w_cvar(id, sn, NONE, speedaccel) \
- w_prop(id, sn, float, reloading_ammo, reload_ammo) \
- w_prop(id, sn, float, reloading_time, reload_time) \
- w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
- w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
- w_prop(id, sn, string, weaponreplace, weaponreplace) \
- w_prop(id, sn, float, weaponstart, weaponstart) \
- w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
- w_prop(id, sn, float, weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(RPC, rpc, NEW(RocketPropelledChainsaw));
-#ifdef SVQC
-RPC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
-#endif
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
}
}
}
- METHOD(RocketPropelledChainsaw, wr_init, void(entity thiswep))
- {
- RPC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
- }
METHOD(RocketPropelledChainsaw, wr_checkammo1, bool(entity thiswep))
{
- float ammo_amount = self.WEP_AMMO(RPC) >= WEP_CVAR(rpc, ammo);
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(rpc, ammo);
ammo_amount += self.(weapon_load[WEP_RPC.m_id]) >= WEP_CVAR(rpc, ammo);
return ammo_amount;
}
{
return false;
}
- METHOD(RocketPropelledChainsaw, wr_config, void(entity thiswep))
- {
- RPC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
- }
METHOD(RocketPropelledChainsaw, wr_reload, void(entity thiswep))
{
W_Reload(self, WEP_CVAR(rpc, ammo), SND(RELOAD));
{SELFPARAM();
for(int j = WEP_FIRST; j <= WEP_LAST; ++j)
if(self.weapons & WepSet_FromWeapon(Weapons_from(j)))
- if(self.switchweapon != j)
+ if(PS(self).m_switchweapon.m_id != j)
if(W_IsWeaponThrowable(j))
W_ThrowNewWeapon(self, j, false, self.origin + (self.mins + self.maxs) * 0.5, randomvec() * 175 + '0 0 325');
drawfill(v1, v2, '0.5 0.5 0.5', 0.5, DRAWFLAG_NORMAL);
vector v3 = v1 + '10 10 0';
- #define OUT(s, z) do { drawcolorcodedstring(v3, s, '1 1 0' * z, 1, DRAWFLAG_NORMAL); v3.y += z + 4; } while (0)
+ #define OUT(s, z) MACRO_BEGIN { drawcolorcodedstring(v3, s, '1 1 0' * z, 1, DRAWFLAG_NORMAL); v3.y += z + 4; } MACRO_END
OUT(_("^1Server notices:"), 32);
LL_EACH(cl_notices, it.alpha > time, LAMBDA(
entity notif;
int i;
- #define DESTROY_LOOP(type,count) do { \
+ #define DESTROY_LOOP(type,count) MACRO_BEGIN { \
for(i = 1; i <= count; ++i) \
{ \
notif = Get_Notif_Ent(type, i); \
if (!notif) { backtrace("Destroy_All_Notifications(): Missing notification entity!\n"); return; } \
Destroy_Notification_Entity(notif); \
} \
- } while(0)
+ } MACRO_END
// kill all networked notifications and centerprints
#ifdef SVQC
// ======================
// Process Notif String
// ======================
- #define SET_NOTIF_STRING(string,stringname) do { \
+ #define SET_NOTIF_STRING(string,stringname) MACRO_BEGIN { \
notif.nent_string = strzone(CCR( \
Process_Notif_Line( \
typeId, \
stringname \
)) \
); \
- } while(0)
+ } MACRO_END
if(GENTLE)
{
// 2. Manually handling each separate call on per-usage basis (See old CTF usage of verbose)
entity found_choice;
- #define RECURSE_FROM_CHOICE(ent,action) do { \
+ #define RECURSE_FROM_CHOICE(ent,action) MACRO_BEGIN { \
if(notif.nent_challow_var && (warmup_stage || (notif.nent_challow_var == 2))) \
{ \
switch(ent.msg_choice_choices[net_name - 1]) \
found_choice.nent_floatcount, \
s1, s2, s3, s4, \
f1, f2, f3, f4); \
- } while(0)
+ } MACRO_END
switch(broadcast)
{
ARG_CASE(ARG_CS_SV, "spree_inf", (autocvar_notification_show_sprees ? notif_arg_spree_inf(1, input, s2, f2) : "")) \
ARG_CASE(ARG_CS_SV, "spree_end", (autocvar_notification_show_sprees ? notif_arg_spree_inf(-1, "", "", f1) : "")) \
ARG_CASE(ARG_CS_SV, "spree_lost", (autocvar_notification_show_sprees ? notif_arg_spree_inf(-2, "", "", f1) : "")) \
- ARG_CASE(ARG_CS_SV, "item_wepname", WEP_NAME(f1)) \
+ ARG_CASE(ARG_CS_SV, "item_wepname", Weapons_from(f1).m_name) \
ARG_CASE(ARG_CS_SV, "item_buffname", BUFF_NAME(f1)) \
ARG_CASE(ARG_CS_SV, "f3buffname", BUFF_NAME(f3)) \
ARG_CASE(ARG_CS_SV, "item_wepammo", (s1 != "" ? sprintf(_(" with %s"), s1) : "")) \
ARG_CASE(ARG_CS_SV_HA, "minigame1_name",find(world,netname,s1).descriptor.message) \
ARG_CASE(ARG_CS_SV_HA, "minigame1_d", find(world,netname,s1).descriptor.netname)
-#define NOTIF_HIT_MAX(count,funcname) do { \
+#define NOTIF_HIT_MAX(count,funcname) MACRO_BEGIN { \
if(sel_num == count) { backtrace(sprintf("%s: Hit maximum arguments!\n", funcname)); break; } \
-} while(0)
+} MACRO_END
#define NOTIF_HIT_UNKNOWN(token,funcname) { backtrace(sprintf("%s: Hit unknown token in selected string! '%s'\n", funcname, selected)); break; }
#define KILL_SPREE_LIST \
void RegisterNotifications_First()
{
notif_global_error = false;
-
- #ifdef SVQC
- #define dedi (server_is_dedicated ? "a dedicated " : "")
- #else
- #define dedi ""
- #endif
-
- LOG_INFOF("Beginning notification initialization on %s%s program...\n", dedi, PROGNAME);
- #undef dedi
-
- // maybe do another implementation of this with checksums? for now, we don't need versioning
- /*if(autocvar_notification_version != NOTIF_VERSION)
- {
- #ifdef CSQC
- if(autocvar_notification_version_mismatch_client_error)
- #else
- if(autocvar_notification_version_mismatch_server_error)
- #endif
- notif_global_error = true;
-
- printf("^1NOTIFICATION VERSION MISMATCH: ^7program = %s, config = %d, code = %d.\n",
- PROGNAME, autocvar_notification_version, NOTIF_VERSION);
- }*/
}
void RegisterNotifications_Done()
{
// shit happened... stop the loading of the program now if this is unacceptable
if(autocvar_notification_errors_are_fatal)
- error("Notification initialization failed! Read above and fix the errors!\n");
+ LOG_FATAL("Notification initialization failed! Read above and fix the errors!\n");
else
- LOG_INFO("Notification initialization failed! Read above and fix the errors!\n");
+ LOG_SEVERE("Notification initialization failed! Read above and fix the errors!\n");
}
- else { LOG_INFO("Notification initialization successful!\n"); }
}
// NOW we actually activate the declarations
void SpecialCommand()
{
#ifdef SVQC
- if (!CheatImpulse(99))
+ if (!CheatImpulse(CHIMPULSE_GIVE_ALL.impulse))
LOG_INFO("A hollow voice says \"Plugh\".\n");
#endif
}
{
int buttons = PHYS_INPUT_BUTTON_MASK(this);
#ifdef CSQC
- this.items = getstati(STAT_ITEMS, 0, 24);
+ this.items = STAT(ITEMS);
this.movement = PHYS_INPUT_MOVEVALUES(this);
void stopsoundto(int _dest, entity e, int chan)
{
if (!sound_allowed(_dest, e)) return;
- int entno = num_for_edict(e);
+ int entno = etof(e);
if (entno >= 8192 || chan < 0 || chan > 7)
{
int idx = precache_sound_index(SND(Null));
// Otherwise, channels 8 to 15 would be blocked for a weird QW feature.
#ifdef SVQC
#define _sound(e, c, s, v, a) \
- do \
+ MACRO_BEGIN \
{ \
entity __e = e; \
- if (!sound_allowed(MSG_BROADCAST, __e)) break; \
- sound7(__e, c, s, v, a, 0, 0); \
- } \
- while (0)
+ if (sound_allowed(MSG_BROADCAST, __e)) \
+ sound7(__e, c, s, v, a, 0, 0); \
+ } MACRO_END
#else
#define _sound(e, c, s, v, a) sound7(e, c, s, v, a, 0, 0)
#endif
* @param sf
*/
#define sound8(e, o, chan, samp, vol, atten, speed, sf) \
- do \
+ MACRO_BEGIN \
{ \
entity __e; \
int __chan = chan; \
setorigin(__e, o); \
setsize(__e, '0 0 0', '0 0 0'); \
sound7(__e, __chan, __samp, vol, atten, speed, sf); \
- if (auto) break; \
- setorigin(__e, old_origin); \
- setsize(__e, old_mins, old_maxs); \
- } \
- while (0)
+ if (!auto) \
+ { \
+ setorigin(__e, old_origin); \
+ setsize(__e, old_mins, old_maxs); \
+ } \
+ } MACRO_END
CLASS(Sound, Object)
ATTRIB(Sound, m_id, int, 0)
--- /dev/null
+/**
+ * Purpose: common player state, usable on client and server
+ * Client: singleton representing the viewed player
+ * Server: instance per client, clients decoupled from players
+ */
+CLASS(PlayerState, Object)
+ ATTRIB(PlayerState, m_client, entity, NULL)
+ CONSTRUCTOR(PlayerState, entity client)
+ {
+ CONSTRUCT(PlayerState);
+ this.m_client = client;
+ }
+ ATTRIB(PlayerState, m_switchingweapon, Weapon, Weapons_from(-1))
+ ATTRIB(PlayerState, m_switchweapon, Weapon, Weapons_from(-1))
+ ATTRIB(PlayerState, m_weapon, Weapon, Weapons_from(-1))
+ METHOD(PlayerState, ps_push, void(PlayerState this, entity cl))
+ {
+ STAT(ACTIVEWEAPON, cl) = this.m_weapon.m_id;
+ STAT(SWITCHINGWEAPON, cl) = this.m_switchingweapon.m_id;
+ STAT(SWITCHWEAPON, cl) = this.m_switchweapon.m_id;
+ }
+ENDCLASS(PlayerState)
+
+.PlayerState _ps;
+#if NDEBUG
+ #define PS(this) (this._ps)
+#else
+ PlayerState PS(entity this) { assert(IS_CLIENT(this)); return this._ps; }
+#endif
+
+void PlayerState_attach(entity this)
+{
+ // TODO: dynamic
+ // this._ps = NEW(PlayerState, this);
+}
+
+void PlayerState_detach(entity this)
+{
+ // TODO: dynamic
+ // if (!PS(this)) return; // initial connect
+ // remove(PS(this));
+ // this._ps = NULL;
+}
+
+/**
+ * Purpose: common client state, usable on client and server
+ * Client: singleton representing the viewed player
+ * Server: instance per client
+ */
+CLASS(ClientState, Object)
+ ATTRIB(ClientState, m_client, entity, NULL)
+ CONSTRUCTOR(ClientState, entity client)
+ {
+ CONSTRUCT(ClientState);
+ this.m_client = client;
+ }
+ENDCLASS(ClientState)
+
+.ClientState _cs;
+
+#if NDEBUG
+ #define CS(this) (this._cs)
+#else
+ ClientState CS(entity this) { assert(IS_CLIENT(this)); assert(this._cs); return this._cs; }
+#endif
+
+void ClientState_attach(entity this)
+{
+ this._cs = NEW(ClientState, this);
+ this._ps = NEW(PlayerState, this); // TODO: dynamic
+}
+
+void ClientState_detach(entity this)
+{
+ remove(CS(this));
+ this._cs = NULL;
+ this._ps = NULL; // TODO: dynamic
+}
// 255 is the current limit (MAX_CL_STATS - 1), engine will need to be modified if you wish to add more stats
const int MAX_CL_STATS = 256;
-#ifndef CSQC
-const int STAT_HEALTH = 0; // .health
-const int STAT_ARMOR = 4; // .armorvalue
-const int STAT_SHELLS = 6; // .ammo_shells
-const int STAT_NAILS = 7; // .ammo_nails
-const int STAT_ROCKETS = 8; // .ammo_rockets
-const int STAT_CELLS = 9; // .ammo_cells
-const int STAT_ACTIVEWEAPON = 10; // .weapon
-const int STAT_ITEMS = 15; // .items | .items2 << 23 | serverflags << 28
-const int STAT_VIEWHEIGHT = 16; // .view_ofs_z
+
+// const int STAT_HEALTH = 0;
+// const int STAT_ARMOR = 4;
+// const int STAT_SHELLS = 6;
+// const int STAT_NAILS = 7;
+// const int STAT_ROCKETS = 8;
+// const int STAT_CELLS = 9;
+// const int STAT_ACTIVEWEAPON = 10;
+// const int STAT_ITEMS = 15; // .items | .items2 << 23 | serverflags << 28
+// const int STAT_VIEWHEIGHT = 16;
+
+#if defined(CSQC)
+ #define g_stat_HEALTH getstati(STAT_HEALTH)
+ #define g_stat_ARMOR getstat_int(STAT_ARMOR)
+ #define g_stat_SHELLS getstat_int(STAT_SHELLS)
+ #define g_stat_NAILS getstat_int(STAT_NAILS)
+ #define g_stat_ROCKETS getstat_int(STAT_ROCKETS)
+ #define g_stat_CELLS getstat_int(STAT_CELLS)
+ #define g_stat_ACTIVEWEAPON getstat_int(STAT_ACTIVEWEAPON)
+ #define g_stat_ITEMS getstat_int(STAT_ITEMS)
+ #define g_stat_VIEWHEIGHT getstati(STAT_VIEWHEIGHT)
+#elif defined(SVQC)
+ #define stat_HEALTH health
+ #define stat_ARMOR armorvalue
+ #define stat_SHELLS ammo_shells
+ #define stat_NAILS ammo_nails
+ #define stat_ROCKETS ammo_rockets
+ #define stat_CELLS ammo_cells
+ #define stat_ACTIVEWEAPON weapon
+ #define stat_ITEMS items
+ #define stat_VIEWHEIGHT view_ofs_z
#endif
REGISTER_STAT(WEAPONS, vectori)
#define TCR(input,teamcolor,teamtext) strreplace("^TC", teamcolor, strreplace("^TT", teamtext, input))
// safe team comparisons
-#define SAME_TEAM(a,b) (teamplay ? ((a.team == b.team) ? 1 : 0) : ((a == b) ? 1 : 0))
-#define DIFF_TEAM(a,b) (teamplay ? ((a.team != b.team) ? 1 : 0) : ((a != b) ? 1 : 0))
+#define SAME_TEAM(a,b) (teamplay ? (a.team == b.team) : (a == b))
+#define DIFF_TEAM(a,b) (teamplay ? (a.team != b.team) : (a != b))
// used for notification system multi-team identifiers
#define APP_TEAM_NUM_2(num,prefix) ((num == NUM_TEAM_1) ? prefix##RED : prefix##BLUE)
void target_music_sendto(float to, float is)
{SELFPARAM();
WriteHeader(to, TE_CSQC_TARGET_MUSIC);
- WriteShort(to, num_for_edict(self));
+ WriteShort(to, etof(self));
WriteByte(to, self.volume * 255.0 * is);
WriteByte(to, self.fade_time * 16.0);
WriteByte(to, self.fade_rate * 16.0);
if(valuefield == "")
{
if(value == "")
- value = ftos(num_for_edict(valueent));
+ value = ftos(etof(valueent));
}
else
{
// multi-frame anim: keep as-is
if(a.y == 1)
{
- float dur;
- dur = frameduration(e.modelindex, a.x);
- if(dur <= 0 && b.y)
+ float dur = frameduration(e.modelindex, a.x);
+ if (dur <= 0 && b.y)
{
a = b;
dur = frameduration(e.modelindex, a.x);
}
- if(dur > 0)
+ if (dur > 0)
a.z = 1.0 / dur;
}
return a;
_player.view_ofs = PL_VIEW_OFS;
_player.event_damage = PlayerDamage;
_player.hud = HUD_NORMAL;
- _player.switchweapon = _vehicle.switchweapon;
+ PS(_player).m_switchweapon = _vehicle.m_switchweapon;
_player.last_vehiclecheck = time + 3;
_player.vehicle_enter_delay = time + 2;
vehicles_enter(other, self);
}
-bool vehicle_impulse(int imp)
-{SELFPARAM();
- switch(imp)
+bool vehicle_impulse(entity this, int imp)
+{
+ entity v = this.vehicle;
+ if (!v) return false;
+ if (v.deadflag != DEAD_NO) return false;
+ bool(int) f = v.vehicles_impulse;
+ if (f && f(imp)) return true;
+ switch (imp)
{
- case 17:
+ case IMP_weapon_drop.impulse:
{
stuffcmd(self, "\ntoggle cl_eventchase_vehicle\nset _vehicles_shownchasemessage 1\n");
return true;
}
}
-
return false;
}
veh.colormap = pl.colormap;
if(veh.tur_head)
veh.tur_head.colormap = pl.colormap;
- veh.switchweapon = pl.switchweapon;
+ veh.m_switchweapon = PS(pl).m_switchweapon;
pl.hud = veh.vehicleid;
pl.PlayerPhysplug = veh.PlayerPhysplug;
void vehicles_exit(float eject);
float vehicle_initialize(entity vehicle, float nodrop);
-bool vehicle_impulse(int imp);
+bool vehicle_impulse(entity this, int imp);
bool vehicles_crushable(entity e);
#endif
player.event_damage = PlayerDamage;
player.hud = HUD_NORMAL;
player.teleportable = TELEPORT_NORMAL;
- player.switchweapon = gunner.switchweapon;
+ PS(player).m_switchweapon = gunner.m_switchweapon;
player.vehicle_enter_delay = time + 2;
fixedmakevectors(vehic.angles);
RemoveGrapplingHook(player);
- gunner.switchweapon = player.switchweapon;
+ gunner.m_switchweapon = PS(player).m_switchweapon;
gunner.vehicle_exit = bumblebee_gunner_exit;
gunner.vehicle_hudmodel.viewmodelforclient = player;
WriteByte(MSG_ENTITY, sf);
if(sf & BRG_SETUP)
{
- WriteByte(MSG_ENTITY, num_for_edict(self.realowner));
+ WriteByte(MSG_ENTITY, etof(self.realowner));
WriteByte(MSG_ENTITY, self.realowner.team);
WriteByte(MSG_ENTITY, self.cnt);
}
self.lastpushtime = time;
if(!pushdeltatime) return;
- tracebox(self.move_origin, self.mins, self.maxs, self.move_origin - ('0 0 1' * getstatf(STAT_VEH_RACER_SPRINGLENGTH)), MOVE_NOMONSTERS, self);
+ tracebox(self.move_origin, self.mins, self.maxs, self.move_origin - ('0 0 1' * STAT(VEH_RACER_SPRINGLENGTH)), MOVE_NOMONSTERS, self);
- vector df = self.move_velocity * -getstatf(STAT_VEH_RACER_FRICTION);
- df_z += (1 - trace_fraction) * getstatf(STAT_VEH_RACER_HOVERPOWER) + sin(time * 2) * (getstatf(STAT_VEH_RACER_SPRINGLENGTH) * 2);
+ vector df = self.move_velocity * -STAT(VEH_RACER_FRICTION);
+ df_z += (1 - trace_fraction) * STAT(VEH_RACER_HOVERPOWER) + sin(time * 2) * (STAT(VEH_RACER_SPRINGLENGTH) * 2);
- float forced = getstatf(STAT_VEH_RACER_UPFORCEDAMPER);
+ float forced = STAT(VEH_RACER_UPFORCEDAMPER);
int cont = pointcontents(self.move_origin - '0 0 64');
if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME)
{
- forced = getstatf(STAT_VEH_RACER_WATER_UPFORCEDAMPER);
+ forced = STAT(VEH_RACER_WATER_UPFORCEDAMPER);
self.move_velocity_z += 200;
}
if(self.move_velocity_z > 0)
self.move_velocity_z *= 1 - forced * pushdeltatime;
- self.move_angles_x *= 1 - (getstatf(STAT_VEH_RACER_ANGLESTABILIZER) * pushdeltatime);
- self.move_angles_z *= 1 - (getstatf(STAT_VEH_RACER_ANGLESTABILIZER) * pushdeltatime);
+ self.move_angles_x *= 1 - (STAT(VEH_RACER_ANGLESTABILIZER) * pushdeltatime);
+ self.move_angles_z *= 1 - (STAT(VEH_RACER_ANGLESTABILIZER) * pushdeltatime);
Movetype_Physics_MatchServer(false);
}
{SELFPARAM();
switch(_imp)
{
- case 1:
+ case IMP_weapon_group_1.impulse:
self.vehicle.vehicle_weapon2mode = RSM_BOMB;
CSQCVehicleSetup(self, 0);
return true;
- case 2:
+ case IMP_weapon_group_2.impulse:
self.vehicle.vehicle_weapon2mode = RSM_FLARE;
CSQCVehicleSetup(self, 0);
return true;
- case 10:
- case 15:
- case 18:
+ case IMP_weapon_next_byid.impulse:
+ case IMP_weapon_next_bypriority.impulse:
+ case IMP_weapon_next_bygroup.impulse:
self.vehicle.vehicle_weapon2mode += 1;
if(self.vehicle.vehicle_weapon2mode > RSM_LAST)
self.vehicle.vehicle_weapon2mode = RSM_FIRST;
CSQCVehicleSetup(self, 0);
return true;
- case 11:
- case 12:
- case 16:
- case 19:
+ case IMP_weapon_last.impulse:
+ case IMP_weapon_prev_byid.impulse:
+ case IMP_weapon_prev_bypriority.impulse:
+ case IMP_weapon_prev_bygroup.impulse:
self.vehicle.vehicle_weapon2mode -= 1;
if(self.vehicle.vehicle_weapon2mode < RSM_FIRST)
self.vehicle.vehicle_weapon2mode = RSM_LAST;
return true;
/*
- case 17: // toss gun, could be used to exit?
+ case IMP_weapon_drop.impulse: // toss gun, could be used to exit?
break;
- case 20: // Manual minigun reload?
+ case IMP_weapon_reload.impulse: // Manual minigun reload?
break;
*/
}
player.BUTTON_ZOOM = 0;
player.BUTTON_CROUCH = 0;
- player.switchweapon = 0;
+ PS(player).m_switchweapon = WEP_Null;
player.vehicle_weapon2mode = spider.vehicle_weapon2mode;
{SELFPARAM();
switch(_imp)
{
- case 1:
+ case IMP_weapon_group_1.impulse:
self.vehicle.vehicle_weapon2mode = SBRM_VOLLY;
CSQCVehicleSetup(self, 0);
return true;
- case 2:
+ case IMP_weapon_group_2.impulse:
self.vehicle.vehicle_weapon2mode = SBRM_GUIDE;
CSQCVehicleSetup(self, 0);
return true;
- case 3:
+ case IMP_weapon_group_3.impulse:
self.vehicle.vehicle_weapon2mode = SBRM_ARTILLERY;
CSQCVehicleSetup(self, 0);
return true;
- case 10:
- case 15:
- case 18:
+ case IMP_weapon_next_byid.impulse:
+ case IMP_weapon_next_bypriority.impulse:
+ case IMP_weapon_next_bygroup.impulse:
self.vehicle.vehicle_weapon2mode += 1;
if(self.vehicle.vehicle_weapon2mode > SBRM_LAST)
self.vehicle.vehicle_weapon2mode = SBRM_FIRST;
//centerprint(self, strcat("Rocket mode is ", ftos(self.vehicle.vehicle_weapon2mode)));
CSQCVehicleSetup(self, 0);
return true;
- case 11:
- case 12:
- case 16:
- case 19:
+ case IMP_weapon_last.impulse:
+ case IMP_weapon_prev_byid.impulse:
+ case IMP_weapon_prev_bypriority.impulse:
+ case IMP_weapon_prev_bygroup.impulse:
self.vehicle.vehicle_weapon2mode -= 1;
if(self.vehicle.vehicle_weapon2mode < SBRM_FIRST)
self.vehicle.vehicle_weapon2mode = SBRM_LAST;
return true;
/*
- case 17: // toss gun, could be used to exit?
+ case IMP_weapon_drop.impulse: // toss gun, could be used to exit?
break;
- case 20: // Manual minigun reload?
+ case IMP_weapon_reload.impulse: // Manual minigun reload?
break;
*/
}
switch (viewmodel.state)
{
case WS_RAISE:
+ viewmodel.weapon_switchdelay = activeweapon.switchdelay_raise;
+ break;
case WS_DROP:
- viewmodel.weapon_switchdelay = ReadFloat();
+ viewmodel.weapon_switchdelay = activeweapon.switchdelay_drop;
break;
default:
viewmodel.weapon_switchdelay = 0;
WriteByte(channel, weaponentity.state);
WriteFloat(channel, weaponentity.weapon_nextthink);
WriteByte(channel, weaponentity.m_alpha * 255);
- Weapon w = Weapons_from(actor.weapon);
- switch (weaponentity.state)
- {
- case WS_RAISE:
- WriteFloat(channel, w.switchdelay_raise);
- break;
- case WS_DROP:
- WriteFloat(channel, w.switchdelay_drop);
- break;
- }
}
#endif
#define WEPSET(id) (WEP_##id.m_wepset)
#define WepSet_FromWeapon(it) ((it).m_wepset)
WepSet _WepSet_FromWeapon(int i);
-STATIC_INIT(WepSets)
-{
- FOREACH(Weapons, true, LAMBDA(it.m_wepset = _WepSet_FromWeapon(it.m_id)));
-}
+STATIC_INIT(WepSets) { FOREACH(Weapons, true, LAMBDA(it.m_wepset = _WepSet_FromWeapon(it.m_id))); }
GENERIC_COMMAND(dumpweapons, "Dump all weapons into weapons_dump.txt") // WEAPONTODO: make this work with other progs than just server
{
}
}
-#define REGISTER_WEAPON(id, inst) \
- /* WepSet WEPSET_##id; */ \
- REGISTER(Weapons, WEP, id, m_id, inst)
+#ifdef SVQC
+entity W_PROP_reloader;
+float autocvar_w_prop_interval = 0;
+.void(Weapon this, int) wr_net;
+void W_PROP_reload(int chan, entity to)
+{
+ W_PROP_reloader.nextthink = time + autocvar_w_prop_interval;
+ msg_entity = to;
+ FOREACH(Weapons, true, {
+ it.wr_update(it);
+ void(Weapon, int) f = it.wr_net;
+ if (f) f(it, chan);
+ });
+}
+void W_PROP_think()
+{
+ W_PROP_reload(MSG_ALL, NULL);
+}
+STATIC_INIT_LATE(W_PROP_reloader)
+{
+ entity e = W_PROP_reloader = new(W_PROP_reloader);
+ make_pure(e);
+ WITH(entity, self, e, (e.think = W_PROP_think)());
+}
+#endif
-// create cvars for weapon settings
-#define WEP_ADD_CVAR_NONE(wepname,name) [[last]] float autocvar_g_balance_##wepname##_##name;
+#define REGISTER_WEAPON(...) EVAL(OVERLOAD(REGISTER_WEAPON, __VA_ARGS__))
+#define REGISTER_WEAPON_2(id, inst) REGISTER(Weapons, WEP, id, m_id, inst)
+/** TODO: deprecated - remove */
+#define REGISTER_WEAPON_3(id, sname, inst) \
+ REGISTER_WEAPON_2(id, inst); \
+ [[alias("WEP_" #id)]] Weapon _wep_##sname
-#define WEP_ADD_CVAR_PRI(wepname,name) WEP_ADD_CVAR_NONE(wepname, primary_##name)
-#define WEP_ADD_CVAR_SEC(wepname,name) WEP_ADD_CVAR_NONE(wepname, secondary_##name)
-#define WEP_ADD_CVAR_BOTH(wepname,name) \
- WEP_ADD_CVAR_PRI(wepname, name) \
- WEP_ADD_CVAR_SEC(wepname, name)
+REGISTER_WEAPON(Null, NEW(Weapon));
-#define WEP_ADD_CVAR(wepid,wepname,mode,name) WEP_ADD_CVAR_##mode(wepname, name)
+Weapon Weapons_fromstr(string s)
+{
+ FOREACH(Weapons, it != WEP_Null && it.netname == s, return it);
+ return NULL;
+}
-// create properties for weapon settings
-#define WEP_ADD_PROP(wepid,wepname,type,prop,name) \
- .type prop; \
- [[last]] type autocvar_g_balance_##wepname##_##name;
-// read cvars from weapon settings
-#define WEP_CVAR(wepname,name) autocvar_g_balance_##wepname##_##name
-#define WEP_CVAR_PRI(wepname,name) WEP_CVAR(wepname, primary_##name)
-#define WEP_CVAR_SEC(wepname,name) WEP_CVAR(wepname, secondary_##name)
-#define WEP_CVAR_BOTH(wepname,isprimary,name) ((isprimary) ? WEP_CVAR_PRI(wepname, name) : WEP_CVAR_SEC(wepname, name))
+// legacy w_prop mappings
+#define X(fld, T) .T fld; .T wepvar_##fld = fld;
+X(switchdelay_drop, float)
+X(switchdelay_raise, float)
+X(weaponreplace, string)
+X(weaponstartoverride, float)
+X(weaponstart, float)
+X(weaponthrowable, float)
+X(reload_ammo, float)
+.float reloading_ammo = reload_ammo;
+X(reload_time, float)
+.float reloading_time = reload_time;
+#undef X
+
+
+
+#define W_PROPS(L, class, prefix) \
+ L(W_PROP_BEGIN, W_PROP, W_PROP_END, class, prefix) \
+ L(W_CONFIG_BEGIN, W_CONFIG, W_CONFIG_END, class, prefix) \
+ L(W_UPDATE_BEGIN, W_UPDATE, W_UPDATE_END, class, prefix) \
+ L(W_NET_BEGIN, W_NET, W_NET_END, class, prefix) \
+ /**/ \
+
+
+ #define W_PROP(class, wepname, fld, T, m) W_PROP_##m(class, fld, T, wepname)
+ #define W_PROP_NONE(class, fld, T, wepname) _W_PROP(class, fld, T, wepname)
+ #define W_PROP_PRI(class, fld, T, wepname) _W_PROP(class, primary_##fld, T, wepname)
+ #define W_PROP_SEC(class, fld, T, wepname) _W_PROP(class, secondary_##fld, T, wepname)
+ #define W_PROP_BOTH(class, fld, T, wepname) \
+ W_PROP_PRI(class, fld, T, wepname) \
+ W_PROP_SEC(class, fld, T, wepname)
+ #define W_PROP_BEGIN(class)
+ #define _W_PROP(class, fld, T, wepname) \
+ /* static */ T _W_PROP_CVAR(wepname, fld); \
+ ATTRIB(class, wepvar_##fld, T, _W_PROP_CVAR(wepname, fld));
+ #define _W_PROP_CVAR(wepname, fld) autocvar_g_balance_##wepname##_##fld
+ #define W_PROP_END()
+
+
+
+ #define W_CONFIG(class, wepname, fld, T, m) W_CONFIG_##m(class, fld, T, wepname)
+ #define W_CONFIG_NONE(class, fld, T, wepname) _W_CONFIG(class, fld, T, wepname)
+ #define W_CONFIG_PRI(class, fld, T, wepname) _W_CONFIG(class, primary_##fld, T, wepname)
+ #define W_CONFIG_SEC(class, fld, T, wepname) _W_CONFIG(class, secondary_##fld, T, wepname)
+ #define W_CONFIG_BOTH(class, fld, T, wepname) \
+ W_CONFIG_PRI(class, fld, T, wepname) \
+ W_CONFIG_SEC(class, fld, T, wepname)
+ #define W_CONFIG_BEGIN(class) METHOD(class, wr_config, void(class this)) {
+ #ifdef SVQC
+ #define _W_CONFIG(class, fld, T, wepname) if (#wepname == this.netname) WEP_CONFIG_WRITE_CVARS(wepname, fld, T);
+ #else
+ #define _W_CONFIG(class, fld, T, wepname)
+ #endif
+ #define W_CONFIG_END() }
+
+
+ #define W_UPDATE(class, wepname, fld, T, m) W_UPDATE_##m(class, fld, T, wepname)
+ #define W_UPDATE_NONE(class, fld, T, wepname) _W_UPDATE(class, fld, T, wepname)
+ #define W_UPDATE_PRI(class, fld, T, wepname) _W_UPDATE(class, primary_##fld, T, wepname)
+ #define W_UPDATE_SEC(class, fld, T, wepname) _W_UPDATE(class, secondary_##fld, T, wepname)
+ #define W_UPDATE_BOTH(class, fld, T, wepname) \
+ W_UPDATE_PRI(class, fld, T, wepname) \
+ W_UPDATE_SEC(class, fld, T, wepname)
+ .entity baseline, baseline_target;
+ #define W_UPDATE_BEGIN(class) \
+ METHOD(class, wr_update, void(class this)) \
+ { \
+ noref entity b = this.baseline; \
+ if (!b) \
+ { \
+ b = this.baseline = new(baseline); \
+ make_pure(b); \
+ b.baseline_target = this; \
+ }
+ #ifdef SVQC
+ #define _W_UPDATE(class, fld, T, wepname) \
+ { \
+ T it = _W_PROP_CVAR(wepname, fld); \
+ b.wepvar_##fld = this.wepvar_##fld; \
+ this.wepvar_##fld = it; \
+ }
+ #else
+ #define _W_UPDATE(class, fld, T, wepname)
+ #endif
+ #define W_UPDATE_END() }
+
+
+ #define W_NET(class, wepname, fld, T, m) W_NET_##m(class, fld, T, wepname)
+ #define W_NET_NONE(class, fld, T, wepname) _W_NET(class, fld, T, wepname)
+ #define W_NET_PRI(class, fld, T, wepname) _W_NET(class, primary_##fld, T, wepname)
+ #define W_NET_SEC(class, fld, T, wepname) _W_NET(class, secondary_##fld, T, wepname)
+ #define W_NET_BOTH(class, fld, T, wepname) \
+ W_NET_PRI(class, fld, T, wepname) \
+ W_NET_SEC(class, fld, T, wepname)
+ REGISTER_NET_TEMP(WeaponUpdate)
+ #if defined(CSQC)
+ #define W_NET_BEGIN(class) METHOD(class, wr_net, void(class this, int i)) { int n = 0;
+ #define _W_NET(class, fld, T, wepname) \
+ { \
+ if (++n == i) this.wepvar_##fld = Read_##T(); \
+ }
+ .void(Weapon this, int i) wr_net;
+ NET_HANDLE(WeaponUpdate, bool isnew)
+ {
+ Weapon w = Weapons_from(ReadByte());
+ for (int i; (i = ReadByte()); )
+ {
+ w.wr_net(w, i);
+ }
+ return true;
+ }
+ #define W_NET_END() }
+ #elif defined(SVQC)
+ #define W_NET_BEGIN(class) \
+ METHOD(class, wr_net, void(class this, int chan)) \
+ { \
+ bool commit = false; \
+ int i = 0;
+ #define _W_NET(class, fld, T, wepname) \
+ { \
+ ++i; \
+ T it = this.wepvar_##fld; \
+ if (chan == MSG_ONE || it != this.baseline.wepvar_##fld) \
+ { \
+ if (!commit) { commit = true; WriteHeader(chan, WeaponUpdate); WriteByte(chan, this.m_id); } \
+ WriteByte(chan, i); Write_##T(chan, it); \
+ } \
+ }
+ #define W_NET_END() \
+ if (commit) WriteByte(chan, 0); \
+ }
+ #else
+ #define W_NET_BEGIN(class)
+ #define _W_NET(class, fld, T, wepname)
+ #define W_NET_END()
+ #endif
+
-// set initialization values for weapon settings
-#define WEP_SKIP_CVAR(unuseda,unusedb,unusedc,unusedd) /* skip cvars */
-#define WEP_SET_PROP(wepid,wepname,type,prop,name) WEP_##wepid.prop = autocvar_g_balance_##wepname##_##name;
+
+// read cvars from weapon settings
+#define WEP_CVAR(wepname, name) (_wep_##wepname.wepvar_##name)
+#define WEP_CVAR_PRI(wepname, name) WEP_CVAR(wepname, primary_##name)
+#define WEP_CVAR_SEC(wepname, name) WEP_CVAR(wepname, secondary_##name)
+#define WEP_CVAR_BOTH(wepname, isprimary, name) ((isprimary) ? WEP_CVAR_PRI(wepname, name) : WEP_CVAR_SEC(wepname, name))
const int WEP_FIRST = 1;
#define WEP_LAST (Weapons_COUNT - 1)
WepSet WEPSET_ALL;
WepSet WEPSET_SUPERWEAPONS;
-REGISTER_WEAPON(Null, NEW(Weapon));
-
#include "all.inc"
// TODO: remove after 0.8.2. Retains impulse number compatibility because 0.8.1 clients don't reload the weapons.cfg
WepSet set = it.m_wepset;
WEPSET_ALL |= set;
if ((it.spawnflags) & WEP_FLAG_SUPERWEAPON) WEPSET_SUPERWEAPONS |= set;
- it.weapon = it.m_id;
it.weapons = set;
+ if (it == WEP_Null) continue;
int imp = WEP_IMPULSE_BEGIN + it.m_id - 1;
if (imp <= WEP_IMPULSE_END)
localcmd(sprintf("alias weapon_%s \"impulse %d\"\n", it.netname, imp));
else
- LOG_TRACEF(_("Impulse limit exceeded, weapon will not be directly accessible: %s\n"), it.netname);
+ LOG_TRACEF("Impulse limit exceeded, weapon will not be directly accessible: %s\n", it.netname);
));
#ifdef CSQC
FOREACH(Weapons, true, LAMBDA(it.wr_init(it)));
.vector weaponentity_glowmod;
//.int weapon; // current weapon
-#ifdef SVQC
-.int switchweapon = _STAT(SWITCHWEAPON);
-.int switchingweapon = _STAT(SWITCHINGWEAPON);
-#endif
.string weaponname; // name of .weapon
.vector spawnorigin; // for casings
wep_config_queue[WEP_CONFIG_COUNT] = a; \
++WEP_CONFIG_COUNT; }
-#define WEP_CONFIG_WRITETOFILE(a) do { \
+#define WEP_CONFIG_WRITETOFILE(a) MACRO_BEGIN { \
fputs(wep_config_file, a); \
if(wep_config_alsoprint) { LOG_INFO(a); } \
-} while(0)
+} MACRO_END
-#define WEP_CONFIG_WRITE_CVARS_NONE(wepname,name) \
- { WEP_CONFIG_QUEUE( \
- sprintf("set g_balance_%s_%s %g\n", #wepname, #name, \
- cvar(sprintf("g_balance_%s_%s", #wepname, #name)))) }
-
-#define WEP_CONFIG_WRITE_CVARS_PRI(wepname,name) WEP_CONFIG_WRITE_CVARS_NONE(wepname, primary_##name)
-#define WEP_CONFIG_WRITE_CVARS_SEC(wepname,name) WEP_CONFIG_WRITE_CVARS_NONE(wepname, secondary_##name)
-#define WEP_CONFIG_WRITE_CVARS_BOTH(wepname,name) \
- WEP_CONFIG_WRITE_CVARS_PRI(wepname, name) \
- WEP_CONFIG_WRITE_CVARS_SEC(wepname, name)
-#define WEP_CONFIG_WRITE_CVARS(wepid,wepname,mode,name) WEP_CONFIG_WRITE_CVARS_##mode(wepname, name)
+#define WEP_CONFIG_WRITE_CVARS(wepname, name, T) WEP_CONFIG_WRITE_PROPS_##T(wepname, name)
-#define WEP_CONFIG_WRITE_PROPS_string(wepname,name) \
+#define WEP_CONFIG_WRITE_PROPS_string(wepname, name) \
{ WEP_CONFIG_QUEUE( \
sprintf("set g_balance_%s_%s \"%s\"\n", #wepname, #name, \
cvar_string(sprintf("g_balance_%s_%s", #wepname, #name)))) }
-#define WEP_CONFIG_WRITE_PROPS_float(wepname,name) \
+#define WEP_CONFIG_WRITE_PROPS_float(wepname, name) \
{ WEP_CONFIG_QUEUE( \
sprintf("set g_balance_%s_%s %g\n", #wepname, #name, \
cvar(sprintf("g_balance_%s_%s", #wepname, #name)))) }
-#define WEP_CONFIG_WRITE_PROPS(wepid,wepname,type,prop,name) WEP_CONFIG_WRITE_PROPS_##type(wepname,name)
#endif
#endif
/** fields which are explicitly/manually set are marked with "M", fields set automatically are marked with "A" */
CLASS(Weapon, Object)
ATTRIB(Weapon, m_id, int, 0)
- /**
- * M: WEP_id : WEP_...
- * you can recognize dummies when this == 0
- */
- ATTRIB(Weapon, weapon, int, 0);
/** A: WEPSET_id : WEPSET_... */
ATTRIB(Weapon, weapons, WepSet, '0 0 0');
/** M: ammotype : main ammo field */
METHOD(Weapon, wr_drop, void(Weapon this)) {}
/** (SERVER) a weapon is picked up */
METHOD(Weapon, wr_pickup, void(Weapon this)) {}
-
+ /** (SERVER) update cvar based properties */
+ METHOD(Weapon, wr_update, void(Weapon this)) {}
METHOD(Weapon, display, void(entity this, void(string name, string icon) returns)) {
returns(this.m_name, this.model2 ? sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.model2) : string_null);
}
string W_Sound(string w_snd);
string W_Model(string w_mdl);
-
-// other useful macros
-#define WEP_AMMO(wpn) (WEP_##wpn.ammo_field) // only used inside weapon files/with direct name, don't duplicate prefix
-#define WEP_NAME(wpn) ((Weapons_from(wpn)).m_name)
-
#endif
/* wepimg */ ATTRIB(Arc, model2, string, "weaponarc");
/* refname */ ATTRIB(Arc, netname, string, "arc");
/* wepname */ ATTRIB(Arc, m_name, string, _("Arc"));
+
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, beam_ammo, float, NONE) \
+ P(class, prefix, beam_animtime, float, NONE) \
+ P(class, prefix, beam_botaimlifetime, float, NONE) \
+ P(class, prefix, beam_botaimspeed, float, NONE) \
+ P(class, prefix, beam_damage, float, NONE) \
+ P(class, prefix, beam_degreespersegment, float, NONE) \
+ P(class, prefix, beam_distancepersegment, float, NONE) \
+ P(class, prefix, beam_falloff_halflifedist, float, NONE) \
+ P(class, prefix, beam_falloff_maxdist, float, NONE) \
+ P(class, prefix, beam_falloff_mindist, float, NONE) \
+ P(class, prefix, beam_force, float, NONE) \
+ P(class, prefix, beam_healing_amax, float, NONE) \
+ P(class, prefix, beam_healing_aps, float, NONE) \
+ P(class, prefix, beam_healing_hmax, float, NONE) \
+ P(class, prefix, beam_healing_hps, float, NONE) \
+ P(class, prefix, beam_heat, float, NONE) /* heat increase per second (primary) */ \
+ P(class, prefix, beam_maxangle, float, NONE) \
+ P(class, prefix, beam_nonplayerdamage, float, NONE) \
+ P(class, prefix, beam_range, float, NONE) \
+ P(class, prefix, beam_refire, float, NONE) \
+ P(class, prefix, beam_returnspeed, float, NONE) \
+ P(class, prefix, beam_tightness, float, NONE) \
+ P(class, prefix, burst_ammo, float, NONE) \
+ P(class, prefix, burst_damage, float, NONE) \
+ P(class, prefix, burst_healing_aps, float, NONE) \
+ P(class, prefix, burst_healing_hps, float, NONE) \
+ P(class, prefix, burst_heat, float, NONE) /* heat increase per second (secondary) */ \
+ P(class, prefix, cooldown, float, NONE) /* heat decrease per second when resting */ \
+ P(class, prefix, overheat_max, float, NONE) /* maximum heat before jamming */ \
+ P(class, prefix, overheat_min, float, NONE) /* minimum heat to wait for cooldown */ \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, weaponreplace, string, NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ END()
+ W_PROPS(X, Arc, arc)
+#undef X
+
ENDCLASS(Arc)
-REGISTER_WEAPON(ARC, NEW(Arc));
-
-#define ARC_SETTINGS(w_cvar,w_prop) ARC_SETTINGS_LIST(w_cvar, w_prop, ARC, arc)
-#define ARC_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
- w_cvar(id, sn, NONE, beam_ammo) \
- w_cvar(id, sn, NONE, beam_animtime) \
- w_cvar(id, sn, NONE, beam_botaimspeed) \
- w_cvar(id, sn, NONE, beam_botaimlifetime) \
- w_cvar(id, sn, NONE, beam_damage) \
- w_cvar(id, sn, NONE, beam_degreespersegment) \
- w_cvar(id, sn, NONE, beam_distancepersegment) \
- w_cvar(id, sn, NONE, beam_falloff_halflifedist) \
- w_cvar(id, sn, NONE, beam_falloff_maxdist) \
- w_cvar(id, sn, NONE, beam_falloff_mindist) \
- w_cvar(id, sn, NONE, beam_force) \
- w_cvar(id, sn, NONE, beam_healing_amax) \
- w_cvar(id, sn, NONE, beam_healing_aps) \
- w_cvar(id, sn, NONE, beam_healing_hmax) \
- w_cvar(id, sn, NONE, beam_healing_hps) \
- w_cvar(id, sn, NONE, beam_maxangle) \
- w_cvar(id, sn, NONE, beam_nonplayerdamage) \
- w_cvar(id, sn, NONE, beam_range) \
- w_cvar(id, sn, NONE, beam_refire) \
- w_cvar(id, sn, NONE, beam_returnspeed) \
- w_cvar(id, sn, NONE, beam_tightness) \
- w_cvar(id, sn, NONE, burst_ammo) \
- w_cvar(id, sn, NONE, burst_damage) \
- w_cvar(id, sn, NONE, burst_healing_aps) \
- w_cvar(id, sn, NONE, burst_healing_hps) \
- w_cvar(id, sn, NONE, overheat_max)/* maximum heat before jamming */ \
- w_cvar(id, sn, NONE, overheat_min)/* minimum heat to wait for cooldown */ \
- w_cvar(id, sn, NONE, beam_heat) /* heat increase per second (primary) */ \
- w_cvar(id, sn, NONE, burst_heat) /* heat increase per second (secondary) */ \
- w_cvar(id, sn, NONE, cooldown) /* heat decrease per second when resting */ \
- w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
- w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
- w_prop(id, sn, string, weaponreplace, weaponreplace) \
- w_prop(id, sn, float, weaponstart, weaponstart) \
- w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
- w_prop(id, sn, float, weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(ARC, arc, NEW(Arc));
+
#ifndef MENUQC
const float ARC_MAX_SEGMENTS = 20;
const int ARC_SF_LOCALMASK = ARC_SF_START | ARC_SF_WANTDIR | ARC_SF_BEAMDIR;
#endif
#ifdef SVQC
-ARC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
.entity arc_beam;
.bool arc_BUTTON_ATCK_prev; // for better animation control
.float beam_prev;
burst = ARC_BT_BURSTMASK;
}
+ Weapon thiswep = WEP_ARC;
+
if(
!IS_PLAYER(self.owner)
||
- (self.owner.WEP_AMMO(ARC) <= 0 && !(self.owner.items & IT_UNLIMITED_WEAPON_AMMO))
+ (self.owner.(thiswep.ammo_field) <= 0 && !(self.owner.items & IT_UNLIMITED_WEAPON_AMMO))
||
self.owner.deadflag != DEAD_NO
||
if(rootammo)
{
- coefficient = min(coefficient, self.owner.WEP_AMMO(ARC) / rootammo);
- self.owner.WEP_AMMO(ARC) = max(0, self.owner.WEP_AMMO(ARC) - (rootammo * frametime));
+ coefficient = min(coefficient, self.owner.(thiswep.ammo_field) / rootammo);
+ self.owner.(thiswep.ammo_field) = max(0, self.owner.(thiswep.ammo_field) - (rootammo * frametime));
}
}
float heat_speed = burst ? WEP_CVAR(arc, burst_heat) : WEP_CVAR(arc, beam_heat);
}
if ( self.arc_smoke_sound && ( self.arc_overheat <= time ||
- !( self.BUTTON_ATCK || self.BUTTON_ATCK2 ) ) || self.switchweapon != WEP_ARC.m_id )
+ !( self.BUTTON_ATCK || self.BUTTON_ATCK2 ) ) || PS(self).m_switchweapon != WEP_ARC )
{
self.arc_smoke_sound = 0;
sound(self, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
arc_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 3);
arc_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ARC.m_id), false, false, 4);
}
- ARC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
}
METHOD(Arc, wr_checkammo1, bool(entity thiswep))
{
SELFPARAM();
- return ((!WEP_CVAR(arc, beam_ammo)) || (self.WEP_AMMO(ARC) > 0));
+ return ((!WEP_CVAR(arc, beam_ammo)) || (self.(thiswep.ammo_field) > 0));
}
METHOD(Arc, wr_checkammo2, bool(entity thiswep))
{
SELFPARAM();
return WEP_CVAR(arc, overheat_max) > 0 &&
- ((!WEP_CVAR(arc, burst_ammo)) || (self.WEP_AMMO(ARC) > 0));
- }
- METHOD(Arc, wr_config, void(entity thiswep))
- {
- ARC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
+ ((!WEP_CVAR(arc, burst_ammo)) || (self.(thiswep.ammo_field) > 0));
}
METHOD(Arc, wr_killmessage, int(entity thiswep))
{
}
METHOD(Arc, wr_pickup, void(entity thiswep))
{
- if ( !client_hasweapon(self, WEP_ARC.m_id, false, false) &&
+ if ( !client_hasweapon(self, thiswep, false, false) &&
weapon_dropevent_item.arc_overheat > time )
{
self.arc_overheat = weapon_dropevent_item.arc_overheat;
else
{
// use player origin so that third person display still works
- self.origin = entcs_receiver(player_localnum).origin + ('0 0 1' * getstati(STAT_VIEWHEIGHT));
+ self.origin = entcs_receiver(player_localnum).origin + ('0 0 1' * STAT(VIEWHEIGHT));
}
}
/* wepimg */ ATTRIB(Blaster, model2, string, "weaponlaser");
/* refname */ ATTRIB(Blaster, netname, string, "blaster");
/* wepname */ ATTRIB(Blaster, m_name, string, _("Blaster"));
-ENDCLASS(Blaster)
-REGISTER_WEAPON(BLASTER, NEW(Blaster));
-#define BLASTER_SETTINGS(w_cvar,w_prop) BLASTER_SETTINGS_LIST(w_cvar, w_prop, BLASTER, blaster)
-#define BLASTER_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
- w_cvar(id, sn, BOTH, animtime) \
- w_cvar(id, sn, BOTH, damage) \
- w_cvar(id, sn, BOTH, delay) \
- w_cvar(id, sn, BOTH, edgedamage) \
- w_cvar(id, sn, BOTH, force) \
- w_cvar(id, sn, BOTH, force_zscale) \
- w_cvar(id, sn, BOTH, lifetime) \
- w_cvar(id, sn, BOTH, radius) \
- w_cvar(id, sn, BOTH, refire) \
- w_cvar(id, sn, BOTH, shotangle) \
- w_cvar(id, sn, BOTH, speed) \
- w_cvar(id, sn, BOTH, spread) \
- w_cvar(id, sn, NONE, secondary) \
- w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
- w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
- w_prop(id, sn, string, weaponreplace, weaponreplace) \
- w_prop(id, sn, float, weaponstart, weaponstart) \
- w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
- w_prop(id, sn, float, weaponthrowable, weaponthrowable)
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, animtime, float, BOTH) \
+ P(class, prefix, damage, float, BOTH) \
+ P(class, prefix, delay, float, BOTH) \
+ P(class, prefix, edgedamage, float, BOTH) \
+ P(class, prefix, force, float, BOTH) \
+ P(class, prefix, force_zscale, float, BOTH) \
+ P(class, prefix, lifetime, float, BOTH) \
+ P(class, prefix, radius, float, BOTH) \
+ P(class, prefix, refire, float, BOTH) \
+ P(class, prefix, secondary, float, NONE) \
+ P(class, prefix, shotangle, float, BOTH) \
+ P(class, prefix, speed, float, BOTH) \
+ P(class, prefix, spread, float, BOTH) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, weaponreplace, string, NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ END()
+ W_PROPS(X, Blaster, blaster)
+#undef X
+
+ENDCLASS(Blaster)
+REGISTER_WEAPON(BLASTER, blaster, NEW(Blaster));
#ifdef SVQC
-BLASTER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
.float blaster_damage;
.float blaster_edgedamage;
.float blaster_radius;
{
case 0: // switch to last used weapon
{
- if(actor.switchweapon == WEP_BLASTER.m_id) // don't do this if already switching
+ if(PS(actor).m_switchweapon == WEP_BLASTER) // don't do this if already switching
W_LastWeapon();
break;
}
}
}
- METHOD(Blaster, wr_init, void(entity thiswep))
- {
- BLASTER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
- }
-
METHOD(Blaster, wr_setup, void(entity thiswep))
{
self.ammo_field = ammo_none;
return true; // blaster has infinite ammo
}
- METHOD(Blaster, wr_config, void(entity thiswep))
- {
- BLASTER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
- }
-
METHOD(Blaster, wr_suicidemessage, int(entity thiswep))
{
return WEAPON_BLASTER_SUICIDE;
/* wepimg */ ATTRIB(Crylink, model2, string, "weaponcrylink");
/* refname */ ATTRIB(Crylink, netname, string, "crylink");
/* wepname */ ATTRIB(Crylink, m_name, string, _("Crylink"));
+
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, ammo, float, BOTH) \
+ P(class, prefix, animtime, float, BOTH) \
+ P(class, prefix, bouncedamagefactor, float, BOTH) \
+ P(class, prefix, bounces, float, BOTH) \
+ P(class, prefix, damage, float, BOTH) \
+ P(class, prefix, edgedamage, float, BOTH) \
+ P(class, prefix, force, float, BOTH) \
+ P(class, prefix, joindelay, float, BOTH) \
+ P(class, prefix, joinexplode, float, BOTH) \
+ P(class, prefix, joinexplode_damage, float, BOTH) \
+ P(class, prefix, joinexplode_edgedamage, float, BOTH) \
+ P(class, prefix, joinexplode_force, float, BOTH) \
+ P(class, prefix, joinexplode_radius, float, BOTH) \
+ P(class, prefix, joinspread, float, BOTH) \
+ P(class, prefix, linkexplode, float, BOTH) \
+ P(class, prefix, middle_fadetime, float, BOTH) \
+ P(class, prefix, middle_lifetime, float, BOTH) \
+ P(class, prefix, other_fadetime, float, BOTH) \
+ P(class, prefix, other_lifetime, float, BOTH) \
+ P(class, prefix, radius, float, BOTH) \
+ P(class, prefix, refire, float, BOTH) \
+ P(class, prefix, reload_ammo, float, NONE) \
+ P(class, prefix, reload_time, float, NONE) \
+ P(class, prefix, secondary, float, NONE) \
+ P(class, prefix, shots, float, BOTH) \
+ P(class, prefix, speed, float, BOTH) \
+ P(class, prefix, spreadtype, float, SEC) \
+ P(class, prefix, spread, float, BOTH) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, weaponreplace, string, NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ END()
+ W_PROPS(X, Crylink, crylink)
+#undef X
+
ENDCLASS(Crylink)
-REGISTER_WEAPON(CRYLINK, NEW(Crylink));
-
-#define CRYLINK_SETTINGS(w_cvar,w_prop) CRYLINK_SETTINGS_LIST(w_cvar, w_prop, CRYLINK, crylink)
-#define CRYLINK_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
- w_cvar(id, sn, BOTH, ammo) \
- w_cvar(id, sn, BOTH, animtime) \
- w_cvar(id, sn, BOTH, damage) \
- w_cvar(id, sn, BOTH, edgedamage) \
- w_cvar(id, sn, BOTH, radius) \
- w_cvar(id, sn, BOTH, force) \
- w_cvar(id, sn, BOTH, spread) \
- w_cvar(id, sn, BOTH, refire) \
- w_cvar(id, sn, BOTH, speed) \
- w_cvar(id, sn, BOTH, shots) \
- w_cvar(id, sn, BOTH, bounces) \
- w_cvar(id, sn, BOTH, bouncedamagefactor) \
- w_cvar(id, sn, BOTH, middle_lifetime) \
- w_cvar(id, sn, BOTH, middle_fadetime) \
- w_cvar(id, sn, BOTH, other_lifetime) \
- w_cvar(id, sn, BOTH, other_fadetime) \
- w_cvar(id, sn, BOTH, linkexplode) \
- w_cvar(id, sn, BOTH, joindelay) \
- w_cvar(id, sn, BOTH, joinspread) \
- w_cvar(id, sn, BOTH, joinexplode) \
- w_cvar(id, sn, BOTH, joinexplode_damage) \
- w_cvar(id, sn, BOTH, joinexplode_edgedamage) \
- w_cvar(id, sn, BOTH, joinexplode_radius) \
- w_cvar(id, sn, BOTH, joinexplode_force) \
- w_cvar(id, sn, SEC, spreadtype) \
- w_cvar(id, sn, NONE, secondary) \
- w_prop(id, sn, float, reloading_ammo, reload_ammo) \
- w_prop(id, sn, float, reloading_time, reload_time) \
- w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
- w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
- w_prop(id, sn, string, weaponreplace, weaponreplace) \
- w_prop(id, sn, float, weaponstart, weaponstart) \
- w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
- w_prop(id, sn, float, weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(CRYLINK, crylink, NEW(Crylink));
#ifdef SVQC
-CRYLINK_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
.float gravity;
.float crylink_waitrelease;
.entity crylink_lastgroup;
{
// ran out of ammo!
actor.cnt = WEP_CRYLINK.m_id;
- actor.switchweapon = w_getbestweapon(actor);
+ PS(actor).m_switchweapon = w_getbestweapon(actor);
}
}
}
}
- METHOD(Crylink, wr_init, void(entity thiswep))
- {
- CRYLINK_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
- }
METHOD(Crylink, wr_checkammo1, bool(entity thiswep))
{
SELFPARAM();
if(self.crylink_lastgroup && self.crylink_waitrelease)
return true;
- float ammo_amount = self.WEP_AMMO(CRYLINK) >= WEP_CVAR_PRI(crylink, ammo);
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(crylink, ammo);
ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_PRI(crylink, ammo);
return ammo_amount;
}
if(self.crylink_lastgroup && self.crylink_waitrelease)
return true;
- float ammo_amount = self.WEP_AMMO(CRYLINK) >= WEP_CVAR_SEC(crylink, ammo);
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(crylink, ammo);
ammo_amount += self.(weapon_load[WEP_CRYLINK.m_id]) >= WEP_CVAR_SEC(crylink, ammo);
return ammo_amount;
}
- METHOD(Crylink, wr_config, void(entity thiswep))
- {
- CRYLINK_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
- }
METHOD(Crylink, wr_reload, void(entity thiswep))
{
W_Reload(self, min(WEP_CVAR_PRI(crylink, ammo), WEP_CVAR_SEC(crylink, ammo)), SND(RELOAD));
/* wepimg */ ATTRIB(Devastator, model2, string, "weaponrocketlauncher");
/* refname */ ATTRIB(Devastator, netname, string, "devastator");
/* wepname */ ATTRIB(Devastator, m_name, string, _("Devastator"));
+
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, ammo, float, NONE) \
+ P(class, prefix, animtime, float, NONE) \
+ P(class, prefix, damageforcescale, float, NONE) \
+ P(class, prefix, damage, float, NONE) \
+ P(class, prefix, detonatedelay, float, NONE) \
+ P(class, prefix, edgedamage, float, NONE) \
+ P(class, prefix, force, float, NONE) \
+ P(class, prefix, guidedelay, float, NONE) \
+ P(class, prefix, guidegoal, float, NONE) \
+ P(class, prefix, guideratedelay, float, NONE) \
+ P(class, prefix, guiderate, float, NONE) \
+ P(class, prefix, guidestop, float, NONE) \
+ P(class, prefix, health, float, NONE) \
+ P(class, prefix, lifetime, float, NONE) \
+ P(class, prefix, radius, float, NONE) \
+ P(class, prefix, refire, float, NONE) \
+ P(class, prefix, reload_ammo, float, NONE) \
+ P(class, prefix, reload_time, float, NONE) \
+ P(class, prefix, remote_damage, float, NONE) \
+ P(class, prefix, remote_edgedamage, float, NONE) \
+ P(class, prefix, remote_force, float, NONE) \
+ P(class, prefix, remote_jump_damage, float, NONE) \
+ P(class, prefix, remote_jump_radius, float, NONE) \
+ P(class, prefix, remote_jump_velocity_z_add, float, NONE) \
+ P(class, prefix, remote_jump_velocity_z_max, float, NONE) \
+ P(class, prefix, remote_jump_velocity_z_min, float, NONE) \
+ P(class, prefix, remote_radius, float, NONE) \
+ P(class, prefix, speedaccel, float, NONE) \
+ P(class, prefix, speedstart, float, NONE) \
+ P(class, prefix, speed, float, NONE) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, weaponreplace, string,NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ END()
+ W_PROPS(X, Devastator, devastator)
+#undef X
+
ENDCLASS(Devastator)
-REGISTER_WEAPON(DEVASTATOR, NEW(Devastator));
-
-#define DEVASTATOR_SETTINGS(w_cvar,w_prop) DEVASTATOR_SETTINGS_LIST(w_cvar, w_prop, DEVASTATOR, devastator)
-#define DEVASTATOR_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
- w_cvar(id, sn, NONE, ammo) \
- w_cvar(id, sn, NONE, animtime) \
- w_cvar(id, sn, NONE, damage) \
- w_cvar(id, sn, NONE, damageforcescale) \
- w_cvar(id, sn, NONE, detonatedelay) \
- w_cvar(id, sn, NONE, edgedamage) \
- w_cvar(id, sn, NONE, force) \
- w_cvar(id, sn, NONE, guidedelay) \
- w_cvar(id, sn, NONE, guidegoal) \
- w_cvar(id, sn, NONE, guiderate) \
- w_cvar(id, sn, NONE, guideratedelay) \
- w_cvar(id, sn, NONE, guidestop) \
- w_cvar(id, sn, NONE, health) \
- w_cvar(id, sn, NONE, lifetime) \
- w_cvar(id, sn, NONE, radius) \
- w_cvar(id, sn, NONE, refire) \
- w_cvar(id, sn, NONE, remote_damage) \
- w_cvar(id, sn, NONE, remote_edgedamage) \
- w_cvar(id, sn, NONE, remote_force) \
- w_cvar(id, sn, NONE, remote_jump_damage) \
- w_cvar(id, sn, NONE, remote_jump_radius) \
- w_cvar(id, sn, NONE, remote_jump_velocity_z_add) \
- w_cvar(id, sn, NONE, remote_jump_velocity_z_max) \
- w_cvar(id, sn, NONE, remote_jump_velocity_z_min) \
- w_cvar(id, sn, NONE, remote_radius) \
- w_cvar(id, sn, NONE, speed) \
- w_cvar(id, sn, NONE, speedaccel) \
- w_cvar(id, sn, NONE, speedstart) \
- w_prop(id, sn, float, reloading_ammo, reload_ammo) \
- w_prop(id, sn, float, reloading_time, reload_time) \
- w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
- w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
- w_prop(id, sn, string, weaponreplace, weaponreplace) \
- w_prop(id, sn, float, weaponstart, weaponstart) \
- w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
- w_prop(id, sn, float, weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(DEVASTATOR, devastator, NEW(Devastator));
#ifdef SVQC
-DEVASTATOR_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
.float rl_release;
.float rl_detonate_later;
#endif
other
);
- if(self.realowner.weapon == WEP_DEVASTATOR.m_id)
+ Weapon thiswep = WEP_DEVASTATOR;
+ if(PS(self.realowner).m_weapon == thiswep)
{
- if(self.realowner.WEP_AMMO(DEVASTATOR) < WEP_CVAR(devastator, ammo))
+ if(self.realowner.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo))
if(!(self.realowner.items & IT_UNLIMITED_WEAPON_AMMO))
{
self.realowner.cnt = WEP_DEVASTATOR.m_id;
int slot = 0; // TODO: unhardcode
ATTACK_FINISHED(self.realowner, slot) = time;
- self.realowner.switchweapon = w_getbestweapon(self.realowner);
+ PS(self.realowner).m_switchweapon = w_getbestweapon(self.realowner);
}
}
remove(self);
world
);
- if(self.realowner.weapon == WEP_DEVASTATOR.m_id)
+ Weapon thiswep = WEP_DEVASTATOR;
+ if(PS(self.realowner).m_weapon == thiswep)
{
- if(self.realowner.WEP_AMMO(DEVASTATOR) < WEP_CVAR(devastator, ammo))
+ if(self.realowner.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo))
if(!(self.realowner.items & IT_UNLIMITED_WEAPON_AMMO))
{
self.realowner.cnt = WEP_DEVASTATOR.m_id;
int slot = weaponslot(weaponentity);
ATTACK_FINISHED(self.realowner, slot) = time;
- self.realowner.switchweapon = w_getbestweapon(self.realowner);
+ PS(self.realowner).m_switchweapon = w_getbestweapon(self.realowner);
}
}
remove(self);
self.velocity = self.velocity + v_forward * min(WEP_CVAR(devastator, speedaccel) * W_WeaponSpeedFactor() * frametime, velspeed);
// laser guided, or remote detonation
- if(self.realowner.weapon == WEP_DEVASTATOR.m_id)
+ if(PS(self.realowner).m_weapon == WEP_DEVASTATOR)
{
if(self == self.realowner.lastrocket)
if(!self.realowner.rl_release)
actor.rl_release = 1;
if(fire & 2)
- if(actor.switchweapon == WEP_DEVASTATOR.m_id)
+ if(PS(actor).m_switchweapon == WEP_DEVASTATOR)
{
entity rock;
bool rockfound = false;
}
}
}
- METHOD(Devastator, wr_init, void(entity thiswep))
- {
- DEVASTATOR_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
- }
METHOD(Devastator, wr_setup, void(entity thiswep))
{
self.rl_release = 1;
{
#if 0
// don't switch while guiding a missile
- if(ATTACK_FINISHED(self, slot) <= time || self.weapon != WEP_DEVASTATOR.m_id)
+ if(ATTACK_FINISHED(self, slot) <= time || PS(self).m_weapon != WEP_DEVASTATOR)
{
ammo_amount = false;
if(WEP_CVAR(devastator, reload_ammo))
{
- if(self.WEP_AMMO(DEVASTATOR) < WEP_CVAR(devastator, ammo) && self.(weapon_load[WEP_DEVASTATOR.m_id]) < WEP_CVAR(devastator, ammo))
+ if(self.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo) && self.(weapon_load[WEP_DEVASTATOR.m_id]) < WEP_CVAR(devastator, ammo))
ammo_amount = true;
}
- else if(self.WEP_AMMO(DEVASTATOR) < WEP_CVAR(devastator, ammo))
+ else if(self.(thiswep.ammo_field) < WEP_CVAR(devastator, ammo))
ammo_amount = true;
return !ammo_amount;
}
#if 0
if(self.rl_release == 0)
{
- LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE\n", self.rl_release, self.WEP_AMMO(DEVASTATOR), WEP_CVAR(devastator, ammo));
+ LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE\n", self.rl_release, self.(thiswep.ammo_field), WEP_CVAR(devastator, ammo));
return true;
}
else
{
- ammo_amount = self.WEP_AMMO(DEVASTATOR) >= WEP_CVAR(devastator, ammo);
+ ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
ammo_amount += self.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
- LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s\n", self.rl_release, self.WEP_AMMO(DEVASTATOR), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE"));
+ LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s\n", self.rl_release, self.(thiswep.ammo_field), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE"));
return ammo_amount;
}
#else
- float ammo_amount = self.WEP_AMMO(DEVASTATOR) >= WEP_CVAR(devastator, ammo);
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
ammo_amount += self.(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
return ammo_amount;
#endif
{
return false;
}
- METHOD(Devastator, wr_config, void(entity thiswep))
- {
- DEVASTATOR_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
- }
METHOD(Devastator, wr_resetplayer, void(entity thiswep))
{
self.lastrocket = NULL; // stop rocket guiding, no revenge from the grave!
/* wepimg */ ATTRIB(Electro, model2, string, "weaponelectro");
/* refname */ ATTRIB(Electro, netname, string, "electro");
/* wepname */ ATTRIB(Electro, m_name, string, _("Electro"));
+
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, ammo, float, BOTH) \
+ P(class, prefix, animtime, float, BOTH) \
+ P(class, prefix, bouncefactor, float, SEC) \
+ P(class, prefix, bouncestop, float, SEC) \
+ P(class, prefix, comboradius, float, PRI) \
+ P(class, prefix, combo_comboradius, float, NONE) \
+ P(class, prefix, combo_comboradius_thruwall, float, NONE) \
+ P(class, prefix, combo_damage, float, NONE) \
+ P(class, prefix, combo_edgedamage, float, NONE) \
+ P(class, prefix, combo_force, float, NONE) \
+ P(class, prefix, combo_radius, float, NONE) \
+ P(class, prefix, combo_safeammocheck, float, NONE) \
+ P(class, prefix, combo_speed, float, NONE) \
+ P(class, prefix, count, float, SEC) \
+ P(class, prefix, damagedbycontents, float, SEC) \
+ P(class, prefix, damageforcescale, float, SEC) \
+ P(class, prefix, damage, float, BOTH) \
+ P(class, prefix, edgedamage, float, BOTH) \
+ P(class, prefix, force, float, BOTH) \
+ P(class, prefix, health, float, SEC) \
+ P(class, prefix, lifetime, float, BOTH) \
+ P(class, prefix, midaircombo_explode, float, PRI) \
+ P(class, prefix, midaircombo_interval, float, PRI) \
+ P(class, prefix, midaircombo_radius, float, PRI) \
+ P(class, prefix, radius, float, BOTH) \
+ P(class, prefix, refire2, float, SEC) \
+ P(class, prefix, refire, float, BOTH) \
+ P(class, prefix, reload_ammo, float, NONE) \
+ P(class, prefix, reload_time, float, NONE) \
+ P(class, prefix, speed, float, BOTH) \
+ P(class, prefix, speed_up, float, SEC) \
+ P(class, prefix, speed_z, float, SEC) \
+ P(class, prefix, spread, float, BOTH) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, touchexplode, float, SEC) \
+ P(class, prefix, weaponreplace, string,NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ END()
+ W_PROPS(X, Electro, electro)
+#undef X
+
ENDCLASS(Electro)
-REGISTER_WEAPON(ELECTRO, NEW(Electro));
-
-#define ELECTRO_SETTINGS(w_cvar,w_prop) ELECTRO_SETTINGS_LIST(w_cvar, w_prop, ELECTRO, electro)
-#define ELECTRO_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
- w_cvar(id, sn, BOTH, ammo) \
- w_cvar(id, sn, BOTH, animtime) \
- w_cvar(id, sn, BOTH, damage) \
- w_cvar(id, sn, BOTH, edgedamage) \
- w_cvar(id, sn, BOTH, force) \
- w_cvar(id, sn, BOTH, radius) \
- w_cvar(id, sn, BOTH, refire) \
- w_cvar(id, sn, BOTH, speed) \
- w_cvar(id, sn, BOTH, spread) \
- w_cvar(id, sn, BOTH, lifetime) \
- w_cvar(id, sn, PRI, comboradius) \
- w_cvar(id, sn, PRI, midaircombo_explode) \
- w_cvar(id, sn, PRI, midaircombo_interval) \
- w_cvar(id, sn, PRI, midaircombo_radius) \
- w_cvar(id, sn, SEC, bouncefactor) \
- w_cvar(id, sn, SEC, bouncestop) \
- w_cvar(id, sn, SEC, count) \
- w_cvar(id, sn, SEC, damageforcescale) \
- w_cvar(id, sn, SEC, damagedbycontents) \
- w_cvar(id, sn, SEC, health) \
- w_cvar(id, sn, SEC, refire2) \
- w_cvar(id, sn, SEC, speed_up) \
- w_cvar(id, sn, SEC, speed_z) \
- w_cvar(id, sn, SEC, touchexplode) \
- w_cvar(id, sn, NONE, combo_comboradius) \
- w_cvar(id, sn, NONE, combo_comboradius_thruwall) \
- w_cvar(id, sn, NONE, combo_damage) \
- w_cvar(id, sn, NONE, combo_edgedamage) \
- w_cvar(id, sn, NONE, combo_force) \
- w_cvar(id, sn, NONE, combo_radius) \
- w_cvar(id, sn, NONE, combo_speed) \
- w_cvar(id, sn, NONE, combo_safeammocheck) \
- w_prop(id, sn, float, reloading_ammo, reload_ammo) \
- w_prop(id, sn, float, reloading_time, reload_time) \
- w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
- w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
- w_prop(id, sn, string, weaponreplace, weaponreplace) \
- w_prop(id, sn, float, weaponstart, weaponstart) \
- w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
- w_prop(id, sn, float, weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(ELECTRO, electro, NEW(Electro));
+
#ifdef SVQC
-ELECTRO_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
.float electro_count;
.float electro_secondarytime;
void W_Electro_ExplodeCombo();
}
}
}
- METHOD(Electro, wr_init, void(entity thiswep))
- {
- ELECTRO_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
- }
METHOD(Electro, wr_checkammo1, bool(entity thiswep))
{
- float ammo_amount = self.WEP_AMMO(ELECTRO) >= WEP_CVAR_PRI(electro, ammo);
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(electro, ammo);
ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_PRI(electro, ammo);
return ammo_amount;
}
float ammo_amount;
if(WEP_CVAR(electro, combo_safeammocheck)) // true if you can fire at least one secondary blob AND one primary shot after it, otherwise false.
{
- ammo_amount = self.WEP_AMMO(ELECTRO) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
+ ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo) + WEP_CVAR_PRI(electro, ammo);
}
else
{
- ammo_amount = self.WEP_AMMO(ELECTRO) >= WEP_CVAR_SEC(electro, ammo);
+ ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(electro, ammo);
ammo_amount += self.(weapon_load[WEP_ELECTRO.m_id]) >= WEP_CVAR_SEC(electro, ammo);
}
return ammo_amount;
}
- METHOD(Electro, wr_config, void(entity thiswep))
- {
- ELECTRO_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
- }
METHOD(Electro, wr_resetplayer, void(entity thiswep))
{
self.electro_secondarytime = time;
/* wepimg */ ATTRIB(Fireball, model2, string, "weaponfireball");
/* refname */ ATTRIB(Fireball, netname, string, "fireball");
/* wepname */ ATTRIB(Fireball, m_name, string, _("Fireball"));
+
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, animtime, float, BOTH) \
+ P(class, prefix, bfgdamage, float, PRI) \
+ P(class, prefix, bfgforce, float, PRI) \
+ P(class, prefix, bfgradius, float, PRI) \
+ P(class, prefix, damageforcescale, float, BOTH) \
+ P(class, prefix, damagetime, float, SEC) \
+ P(class, prefix, damage, float, BOTH) \
+ P(class, prefix, edgedamage, float, PRI) \
+ P(class, prefix, force, float, PRI) \
+ P(class, prefix, health, float, PRI) \
+ P(class, prefix, laserburntime, float, BOTH) \
+ P(class, prefix, laserdamage, float, BOTH) \
+ P(class, prefix, laseredgedamage, float, BOTH) \
+ P(class, prefix, laserradius, float, BOTH) \
+ P(class, prefix, lifetime, float, BOTH) \
+ P(class, prefix, radius, float, PRI) \
+ P(class, prefix, refire2, float, PRI) \
+ P(class, prefix, refire, float, BOTH) \
+ P(class, prefix, speed, float, BOTH) \
+ P(class, prefix, speed_up, float, SEC) \
+ P(class, prefix, speed_z, float, SEC) \
+ P(class, prefix, spread, float, BOTH) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, weaponreplace, string,NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ END()
+ W_PROPS(X, Fireball, fireball)
+#undef X
+
ENDCLASS(Fireball)
-REGISTER_WEAPON(FIREBALL, NEW(Fireball));
-
-#define FIREBALL_SETTINGS(w_cvar,w_prop) FIREBALL_SETTINGS_LIST(w_cvar, w_prop, FIREBALL, fireball)
-#define FIREBALL_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
- w_cvar(id, sn, BOTH, animtime) \
- w_cvar(id, sn, BOTH, refire) \
- w_cvar(id, sn, BOTH, damage) \
- w_cvar(id, sn, BOTH, damageforcescale) \
- w_cvar(id, sn, BOTH, speed) \
- w_cvar(id, sn, BOTH, spread) \
- w_cvar(id, sn, BOTH, lifetime) \
- w_cvar(id, sn, BOTH, laserburntime) \
- w_cvar(id, sn, BOTH, laserdamage) \
- w_cvar(id, sn, BOTH, laseredgedamage) \
- w_cvar(id, sn, BOTH, laserradius) \
- w_cvar(id, sn, PRI, edgedamage) \
- w_cvar(id, sn, PRI, force) \
- w_cvar(id, sn, PRI, radius) \
- w_cvar(id, sn, PRI, health) \
- w_cvar(id, sn, PRI, refire2) \
- w_cvar(id, sn, PRI, bfgdamage) \
- w_cvar(id, sn, PRI, bfgforce) \
- w_cvar(id, sn, PRI, bfgradius) \
- w_cvar(id, sn, SEC, damagetime) \
- w_cvar(id, sn, SEC, speed_up) \
- w_cvar(id, sn, SEC, speed_z) \
- w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
- w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
- w_prop(id, sn, string, weaponreplace, weaponreplace) \
- w_prop(id, sn, float, weaponstart, weaponstart) \
- w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
- w_prop(id, sn, float, weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(FIREBALL, fireball, NEW(Fireball));
#ifdef SVQC
-FIREBALL_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
.float bot_primary_fireballmooth; // whatever a mooth is
.vector fireball_impactvec;
.float fireball_primarytime;
}
}
}
- METHOD(Fireball, wr_init, void(entity thiswep))
- {
- FIREBALL_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
- }
METHOD(Fireball, wr_setup, void(entity thiswep))
{
self.ammo_field = ammo_none;
{
return true; // fireball has infinite ammo
}
- METHOD(Fireball, wr_config, void(entity thiswep))
- {
- FIREBALL_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
- }
METHOD(Fireball, wr_resetplayer, void(entity thiswep))
{
self.fireball_primarytime = time;
/* wepimg */ ATTRIB(Hagar, model2, string, "weaponhagar");
/* refname */ ATTRIB(Hagar, netname, string, "hagar");
/* wepname */ ATTRIB(Hagar, m_name, string, _("Hagar"));
+
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, ammo, float, BOTH) \
+ P(class, prefix, damageforcescale, float, BOTH) \
+ P(class, prefix, damage, float, BOTH) \
+ P(class, prefix, edgedamage, float, BOTH) \
+ P(class, prefix, force, float, BOTH) \
+ P(class, prefix, health, float, BOTH) \
+ P(class, prefix, lifetime, float, PRI) \
+ P(class, prefix, lifetime_min, float, SEC) \
+ P(class, prefix, lifetime_rand, float, SEC) \
+ P(class, prefix, load, float, SEC) \
+ P(class, prefix, load_abort, float, SEC) \
+ P(class, prefix, load_animtime, float, SEC) \
+ P(class, prefix, load_hold, float, SEC) \
+ P(class, prefix, load_linkexplode, float, SEC) \
+ P(class, prefix, load_max, float, SEC) \
+ P(class, prefix, load_releasedeath, float, SEC) \
+ P(class, prefix, load_speed, float, SEC) \
+ P(class, prefix, load_spread, float, SEC) \
+ P(class, prefix, load_spread_bias, float, SEC) \
+ P(class, prefix, radius, float, BOTH) \
+ P(class, prefix, refire, float, BOTH) \
+ P(class, prefix, reload_ammo, float, NONE) \
+ P(class, prefix, reload_time, float, NONE) \
+ P(class, prefix, secondary, float, NONE) \
+ P(class, prefix, speed, float, BOTH) \
+ P(class, prefix, spread, float, BOTH) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, weaponreplace, string,NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ END()
+ W_PROPS(X, Hagar, hagar)
+#undef X
+
ENDCLASS(Hagar)
-REGISTER_WEAPON(HAGAR, NEW(Hagar));
-
-#define HAGAR_SETTINGS(w_cvar,w_prop) HAGAR_SETTINGS_LIST(w_cvar, w_prop, HAGAR, hagar)
-#define HAGAR_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
- w_cvar(id, sn, BOTH, ammo) \
- w_cvar(id, sn, BOTH, damage) \
- w_cvar(id, sn, BOTH, edgedamage) \
- w_cvar(id, sn, BOTH, force) \
- w_cvar(id, sn, BOTH, radius) \
- w_cvar(id, sn, BOTH, refire) \
- w_cvar(id, sn, BOTH, speed) \
- w_cvar(id, sn, BOTH, spread) \
- w_cvar(id, sn, BOTH, damageforcescale) \
- w_cvar(id, sn, BOTH, health) \
- w_cvar(id, sn, PRI, lifetime) \
- w_cvar(id, sn, SEC, load) \
- w_cvar(id, sn, SEC, load_max) \
- w_cvar(id, sn, SEC, load_abort) \
- w_cvar(id, sn, SEC, load_animtime) \
- w_cvar(id, sn, SEC, load_hold) \
- w_cvar(id, sn, SEC, load_speed) \
- w_cvar(id, sn, SEC, load_releasedeath) \
- w_cvar(id, sn, SEC, load_spread) \
- w_cvar(id, sn, SEC, load_spread_bias) \
- w_cvar(id, sn, SEC, load_linkexplode) \
- w_cvar(id, sn, SEC, lifetime_min) \
- w_cvar(id, sn, SEC, lifetime_rand) \
- w_cvar(id, sn, NONE, secondary) \
- w_prop(id, sn, float, reloading_ammo, reload_ammo) \
- w_prop(id, sn, float, reloading_time, reload_time) \
- w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
- w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
- w_prop(id, sn, string, weaponreplace, weaponreplace) \
- w_prop(id, sn, float, weaponstart, weaponstart) \
- w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
- w_prop(id, sn, float, weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(HAGAR, hagar, NEW(Hagar));
-#ifdef SVQC
-HAGAR_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
-#endif
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
else if(autocvar_g_balance_hagar_reload_ammo)
enough_ammo = self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
else
- enough_ammo = self.WEP_AMMO(HAGAR) >= WEP_CVAR_SEC(hagar, ammo);
+ enough_ammo = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(hagar, ammo);
bool stopped = loaded || !enough_ammo;
W_Hagar_Attack2_Load_Release(weaponentity);
}
}
- METHOD(Hagar, wr_init, void(entity thiswep))
- {
- HAGAR_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
- }
METHOD(Hagar, wr_setup, void(entity thiswep))
{
self.hagar_loadblock = false;
}
METHOD(Hagar, wr_checkammo1, bool(entity thiswep))
{
- float ammo_amount = self.WEP_AMMO(HAGAR) >= WEP_CVAR_PRI(hagar, ammo);
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(hagar, ammo);
ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_PRI(hagar, ammo);
return ammo_amount;
}
METHOD(Hagar, wr_checkammo2, bool(entity thiswep))
{
- float ammo_amount = self.WEP_AMMO(HAGAR) >= WEP_CVAR_SEC(hagar, ammo);
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(hagar, ammo);
ammo_amount += self.(weapon_load[WEP_HAGAR.m_id]) >= WEP_CVAR_SEC(hagar, ammo);
return ammo_amount;
}
- METHOD(Hagar, wr_config, void(entity thiswep))
- {
- HAGAR_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
- }
METHOD(Hagar, wr_resetplayer, void(entity thiswep))
{
self.hagar_load = 0;
/* wepimg */ ATTRIB(HLAC, model2, string, "weaponhlac");
/* refname */ ATTRIB(HLAC, netname, string, "hlac");
/* wepname */ ATTRIB(HLAC, m_name, string, _("Heavy Laser Assault Cannon"));
+
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, ammo, float, BOTH) \
+ P(class, prefix, animtime, float, BOTH) \
+ P(class, prefix, damage, float, BOTH) \
+ P(class, prefix, edgedamage, float, BOTH) \
+ P(class, prefix, force, float, BOTH) \
+ P(class, prefix, lifetime, float, BOTH) \
+ P(class, prefix, radius, float, BOTH) \
+ P(class, prefix, refire, float, BOTH) \
+ P(class, prefix, reload_ammo, float, NONE) \
+ P(class, prefix, reload_time, float, NONE) \
+ P(class, prefix, secondary, float, NONE) \
+ P(class, prefix, shots, float, SEC) \
+ P(class, prefix, speed, float, BOTH) \
+ P(class, prefix, spread, float, SEC) \
+ P(class, prefix, spread_add, float, PRI) \
+ P(class, prefix, spread_crouchmod, float, BOTH) \
+ P(class, prefix, spread_max, float, PRI) \
+ P(class, prefix, spread_min, float, PRI) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, weaponreplace, string,NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ END()
+ W_PROPS(X, HLAC, hlac)
+#undef X
+
ENDCLASS(HLAC)
-REGISTER_WEAPON(HLAC, NEW(HLAC));
-
-#define HLAC_SETTINGS(w_cvar,w_prop) HLAC_SETTINGS_LIST(w_cvar, w_prop, HLAC, hlac)
-#define HLAC_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
- w_cvar(id, sn, BOTH, ammo) \
- w_cvar(id, sn, BOTH, animtime) \
- w_cvar(id, sn, BOTH, damage) \
- w_cvar(id, sn, BOTH, edgedamage) \
- w_cvar(id, sn, BOTH, force) \
- w_cvar(id, sn, BOTH, lifetime) \
- w_cvar(id, sn, BOTH, radius) \
- w_cvar(id, sn, BOTH, refire) \
- w_cvar(id, sn, BOTH, speed) \
- w_cvar(id, sn, BOTH, spread_crouchmod) \
- w_cvar(id, sn, PRI, spread_add) \
- w_cvar(id, sn, PRI, spread_max) \
- w_cvar(id, sn, PRI, spread_min) \
- w_cvar(id, sn, NONE, secondary) \
- w_cvar(id, sn, SEC, shots) \
- w_cvar(id, sn, SEC, spread) \
- w_prop(id, sn, float, reloading_ammo, reload_ammo) \
- w_prop(id, sn, float, reloading_time, reload_time) \
- w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
- w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
- w_prop(id, sn, string, weaponreplace, weaponreplace) \
- w_prop(id, sn, float, weaponstart, weaponstart) \
- w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
- w_prop(id, sn, float, weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(HLAC, hlac, NEW(HLAC));
+
-#ifdef SVQC
-HLAC_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
-#endif
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
// weapon frames
void W_HLAC_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentity, int fire)
{
- if(actor.weapon != actor.switchweapon) // abort immediately if switching
+ if(PS(actor).m_weapon != PS(actor).m_switchweapon) // abort immediately if switching
{
w_ready(thiswep, actor, weaponentity, fire);
return;
}
}
}
- METHOD(HLAC, wr_init, void(entity thiswep))
- {
- HLAC_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
- }
METHOD(HLAC, wr_checkammo1, bool(entity thiswep))
{
- float ammo_amount = self.WEP_AMMO(HLAC) >= WEP_CVAR_PRI(hlac, ammo);
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(hlac, ammo);
ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_PRI(hlac, ammo);
return ammo_amount;
}
METHOD(HLAC, wr_checkammo2, bool(entity thiswep))
{
- float ammo_amount = self.WEP_AMMO(HLAC) >= WEP_CVAR_SEC(hlac, ammo);
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(hlac, ammo);
ammo_amount += self.(weapon_load[WEP_HLAC.m_id]) >= WEP_CVAR_SEC(hlac, ammo);
return ammo_amount;
}
- METHOD(HLAC, wr_config, void(entity thiswep))
- {
- HLAC_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
- }
METHOD(HLAC, wr_reload, void(entity thiswep))
{
W_Reload(self, min(WEP_CVAR_PRI(hlac, ammo), WEP_CVAR_SEC(hlac, ammo)), SND(RELOAD));
/* refname */ ATTRIB(Hook, netname, string, "hook");
/* wepname */ ATTRIB(Hook, m_name, string, _("Grappling Hook"));
ATTRIB(Hook, ammo_factor, float, 1)
+
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, ammo, float, PRI) \
+ P(class, prefix, animtime, float, BOTH) \
+ P(class, prefix, damageforcescale, float, SEC) \
+ P(class, prefix, damage, float, SEC) \
+ P(class, prefix, duration, float, SEC) \
+ P(class, prefix, edgedamage, float, SEC) \
+ P(class, prefix, force, float, SEC) \
+ P(class, prefix, gravity, float, SEC) \
+ P(class, prefix, health, float, SEC) \
+ P(class, prefix, hooked_ammo, float, PRI) \
+ P(class, prefix, hooked_time_free, float, PRI) \
+ P(class, prefix, hooked_time_max, float, PRI) \
+ P(class, prefix, lifetime, float, SEC) \
+ P(class, prefix, power, float, SEC) \
+ P(class, prefix, radius, float, SEC) \
+ P(class, prefix, refire, float, BOTH) \
+ P(class, prefix, speed, float, SEC) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, weaponreplace, string, NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ END()
+ W_PROPS(X, Hook, hook)
+#undef X
+
ENDCLASS(Hook)
-REGISTER_WEAPON(HOOK, NEW(Hook));
+REGISTER_WEAPON(HOOK, hook, NEW(Hook));
CLASS(OffhandHook, OffhandWeapon)
#ifdef SVQC
ENDCLASS(OffhandHook)
OffhandHook OFFHAND_HOOK; STATIC_INIT(OFFHAND_HOOK) { OFFHAND_HOOK = NEW(OffhandHook); }
-#define HOOK_SETTINGS(w_cvar,w_prop) HOOK_SETTINGS_LIST(w_cvar, w_prop, HOOK, hook)
-#define HOOK_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
- w_cvar(id, sn, BOTH, animtime) \
- w_cvar(id, sn, BOTH, refire) \
- w_cvar(id, sn, PRI, ammo) \
- w_cvar(id, sn, PRI, hooked_ammo) \
- w_cvar(id, sn, PRI, hooked_time_free) \
- w_cvar(id, sn, PRI, hooked_time_max) \
- w_cvar(id, sn, SEC, damage) \
- w_cvar(id, sn, SEC, duration) \
- w_cvar(id, sn, SEC, edgedamage) \
- w_cvar(id, sn, SEC, force) \
- w_cvar(id, sn, SEC, gravity) \
- w_cvar(id, sn, SEC, lifetime) \
- w_cvar(id, sn, SEC, power) \
- w_cvar(id, sn, SEC, radius) \
- w_cvar(id, sn, SEC, speed) \
- w_cvar(id, sn, SEC, health) \
- w_cvar(id, sn, SEC, damageforcescale) \
- w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
- w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
- w_prop(id, sn, string, weaponreplace, weaponreplace) \
- w_prop(id, sn, float, weaponstart, weaponstart) \
- w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
- w_prop(id, sn, float, weaponthrowable, weaponthrowable)
-
#ifdef SVQC
-HOOK_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
.float dmg;
.float dmg_edge;
actor.hook_state &= ~HOOK_REMOVING;
}
}
- METHOD(Hook, wr_init, void(entity thiswep))
- {
- HOOK_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
- }
METHOD(Hook, wr_setup, void(entity thiswep))
{
self.hook_state &= ~HOOK_WAITING_FOR_RELEASE;
// infinite ammo for now
return true; // self.ammo_cells >= WEP_CVAR_SEC(hook, ammo); // WEAPONTODO: see above
}
- METHOD(Hook, wr_config, void(entity thiswep))
- {
- HOOK_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
- }
METHOD(Hook, wr_resetplayer, void(entity thiswep))
{
RemoveGrapplingHook(self);
/* wepimg */ ATTRIB(MachineGun, model2, string, "weaponuzi");
/* refname */ ATTRIB(MachineGun, netname, string, "machinegun");
/* wepname */ ATTRIB(MachineGun, m_name, string, _("MachineGun"));
+
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, burst, float, NONE) \
+ P(class, prefix, burst_ammo, float, NONE) \
+ P(class, prefix, burst_animtime, float, NONE) \
+ P(class, prefix, burst_refire2, float, NONE) \
+ P(class, prefix, burst_refire, float, NONE) \
+ P(class, prefix, burst_speed, float, NONE) \
+ P(class, prefix, first, float, NONE) \
+ P(class, prefix, first_ammo, float, NONE) \
+ P(class, prefix, first_damage, float, NONE) \
+ P(class, prefix, first_force, float, NONE) \
+ P(class, prefix, first_refire, float, NONE) \
+ P(class, prefix, first_spread, float, NONE) \
+ P(class, prefix, mode, float, NONE) \
+ P(class, prefix, reload_ammo, float, NONE) \
+ P(class, prefix, reload_time, float, NONE) \
+ P(class, prefix, solidpenetration, float, NONE) \
+ P(class, prefix, spread_add, float, NONE) \
+ P(class, prefix, spread_max, float, NONE) \
+ P(class, prefix, spread_min, float, NONE) \
+ P(class, prefix, sustained_ammo, float, NONE) \
+ P(class, prefix, sustained_damage, float, NONE) \
+ P(class, prefix, sustained_force, float, NONE) \
+ P(class, prefix, sustained_refire, float, NONE) \
+ P(class, prefix, sustained_spread, float, NONE) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, weaponreplace, string,NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ END()
+ W_PROPS(X, MachineGun, machinegun)
+#undef X
+
ENDCLASS(MachineGun)
-REGISTER_WEAPON(MACHINEGUN, NEW(MachineGun));
-
-#define MACHINEGUN_SETTINGS(w_cvar,w_prop) MACHINEGUN_SETTINGS_LIST(w_cvar, w_prop, MACHINEGUN, machinegun)
-#define MACHINEGUN_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
- w_cvar(id, sn, NONE, spread_min) \
- w_cvar(id, sn, NONE, spread_max) \
- w_cvar(id, sn, NONE, spread_add) \
- w_cvar(id, sn, NONE, mode) \
- w_cvar(id, sn, NONE, first) \
- w_cvar(id, sn, NONE, first_damage) \
- w_cvar(id, sn, NONE, first_force) \
- w_cvar(id, sn, NONE, first_refire) \
- w_cvar(id, sn, NONE, first_spread) \
- w_cvar(id, sn, NONE, first_ammo) \
- w_cvar(id, sn, NONE, solidpenetration) \
- w_cvar(id, sn, NONE, sustained_damage) \
- w_cvar(id, sn, NONE, sustained_force) \
- w_cvar(id, sn, NONE, sustained_refire) \
- w_cvar(id, sn, NONE, sustained_spread) \
- w_cvar(id, sn, NONE, sustained_ammo) \
- w_cvar(id, sn, NONE, burst) \
- w_cvar(id, sn, NONE, burst_refire) \
- w_cvar(id, sn, NONE, burst_refire2) \
- w_cvar(id, sn, NONE, burst_animtime) \
- w_cvar(id, sn, NONE, burst_speed) \
- w_cvar(id, sn, NONE, burst_ammo) \
- w_prop(id, sn, float, reloading_ammo, reload_ammo) \
- w_prop(id, sn, float, reloading_time, reload_time) \
- w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
- w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
- w_prop(id, sn, string, weaponreplace, weaponreplace) \
- w_prop(id, sn, float, weaponstart, weaponstart) \
- w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
- w_prop(id, sn, float, weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(MACHINEGUN, machinegun, NEW(MachineGun));
+
-#ifdef SVQC
-MACHINEGUN_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
-#endif
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
// weapon frames
void W_MachineGun_Attack_Frame(Weapon thiswep, entity actor, .entity weaponentity, int fire)
{
- if(actor.weapon != actor.switchweapon) // abort immediately if switching
+ if(PS(actor).m_weapon != PS(actor).m_switchweapon) // abort immediately if switching
{
w_ready(thiswep, actor, weaponentity, fire);
return;
}
}
}
- METHOD(MachineGun, wr_init, void(entity thiswep))
- {
- MACHINEGUN_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
- }
METHOD(MachineGun, wr_checkammo1, bool(entity thiswep))
{
float ammo_amount;
if(WEP_CVAR(machinegun, mode) == 1)
- ammo_amount = self.WEP_AMMO(MACHINEGUN) >= WEP_CVAR(machinegun, sustained_ammo);
+ ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, sustained_ammo);
else
- ammo_amount = self.WEP_AMMO(MACHINEGUN) >= WEP_CVAR(machinegun, first_ammo);
+ ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, first_ammo);
if(WEP_CVAR(machinegun, reload_ammo))
{
{
float ammo_amount;
if(WEP_CVAR(machinegun, mode) == 1)
- ammo_amount = self.WEP_AMMO(MACHINEGUN) >= WEP_CVAR(machinegun, burst_ammo);
+ ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, burst_ammo);
else
- ammo_amount = self.WEP_AMMO(MACHINEGUN) >= WEP_CVAR(machinegun, first_ammo);
+ ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(machinegun, first_ammo);
if(WEP_CVAR(machinegun, reload_ammo))
{
}
return ammo_amount;
}
- METHOD(MachineGun, wr_config, void(entity thiswep))
- {
- MACHINEGUN_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
- }
METHOD(MachineGun, wr_reload, void(entity thiswep))
{
W_Reload(self, min(max(WEP_CVAR(machinegun, sustained_ammo), WEP_CVAR(machinegun, first_ammo)), WEP_CVAR(machinegun, burst_ammo)), SND(RELOAD));
/* wepimg */ ATTRIB(MineLayer, model2, string, "weaponminelayer");
/* refname */ ATTRIB(MineLayer, netname, string, "minelayer");
/* wepname */ ATTRIB(MineLayer, m_name, string, _("Mine Layer"));
+
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, ammo, float, NONE) \
+ P(class, prefix, animtime, float, NONE) \
+ P(class, prefix, damageforcescale, float, NONE) \
+ P(class, prefix, damage, float, NONE) \
+ P(class, prefix, detonatedelay, float, NONE) \
+ P(class, prefix, edgedamage, float, NONE) \
+ P(class, prefix, force, float, NONE) \
+ P(class, prefix, health, float, NONE) \
+ P(class, prefix, lifetime, float, NONE) \
+ P(class, prefix, lifetime_countdown, float, NONE) \
+ P(class, prefix, limit, float, NONE) \
+ P(class, prefix, protection, float, NONE) \
+ P(class, prefix, proximityradius, float, NONE) \
+ P(class, prefix, radius, float, NONE) \
+ P(class, prefix, refire, float, NONE) \
+ P(class, prefix, reload_ammo, float, NONE) \
+ P(class, prefix, reload_time, float, NONE) \
+ P(class, prefix, remote_damage, float, NONE) \
+ P(class, prefix, remote_edgedamage, float, NONE) \
+ P(class, prefix, remote_force, float, NONE) \
+ P(class, prefix, remote_radius, float, NONE) \
+ P(class, prefix, speed, float, NONE) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, time, float, NONE) \
+ P(class, prefix, weaponreplace, string, NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ END()
+ W_PROPS(X, MineLayer, minelayer)
+#undef X
ENDCLASS(MineLayer)
-REGISTER_WEAPON(MINE_LAYER, NEW(MineLayer));
-
-#define MINELAYER_SETTINGS(w_cvar,w_prop) MINELAYER_SETTINGS_LIST(w_cvar, w_prop, MINE_LAYER, minelayer)
-#define MINELAYER_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
- w_cvar(id, sn, NONE, ammo) \
- w_cvar(id, sn, NONE, animtime) \
- w_cvar(id, sn, NONE, damage) \
- w_cvar(id, sn, NONE, damageforcescale) \
- w_cvar(id, sn, NONE, detonatedelay) \
- w_cvar(id, sn, NONE, edgedamage) \
- w_cvar(id, sn, NONE, force) \
- w_cvar(id, sn, NONE, health) \
- w_cvar(id, sn, NONE, lifetime) \
- w_cvar(id, sn, NONE, lifetime_countdown) \
- w_cvar(id, sn, NONE, limit) \
- w_cvar(id, sn, NONE, protection) \
- w_cvar(id, sn, NONE, proximityradius) \
- w_cvar(id, sn, NONE, radius) \
- w_cvar(id, sn, NONE, refire) \
- w_cvar(id, sn, NONE, remote_damage) \
- w_cvar(id, sn, NONE, remote_edgedamage) \
- w_cvar(id, sn, NONE, remote_force) \
- w_cvar(id, sn, NONE, remote_radius) \
- w_cvar(id, sn, NONE, speed) \
- w_cvar(id, sn, NONE, time) \
- w_prop(id, sn, float, reloading_ammo, reload_ammo) \
- w_prop(id, sn, float, reloading_time, reload_time) \
- w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
- w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
- w_prop(id, sn, string, weaponreplace, weaponreplace) \
- w_prop(id, sn, float, weaponstart, weaponstart) \
- w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
- w_prop(id, sn, float, weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(MINE_LAYER, minelayer, NEW(MineLayer));
#ifdef SVQC
-MINELAYER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
void W_MineLayer_Think();
.float minelayer_detonate, mine_explodeanyway;
.float mine_time;
RadiusDamage(self, self.realowner, WEP_CVAR(minelayer, damage), WEP_CVAR(minelayer, edgedamage), WEP_CVAR(minelayer, radius), world, world, WEP_CVAR(minelayer, force), self.projectiledeathtype, other);
- if(self.realowner.weapon == WEP_MINE_LAYER.m_id)
+ if(PS(self.realowner).m_weapon == WEP_MINE_LAYER)
{
setself(self.realowner);
Weapon w = WEP_MINE_LAYER;
self.cnt = WEP_MINE_LAYER.m_id;
int slot = 0; // TODO: unhardcode
ATTACK_FINISHED(self, slot) = time;
- self.switchweapon = w_getbestweapon(self);
+ PS(self).m_switchweapon = w_getbestweapon(self);
}
setself(this);
}
RadiusDamage(self, self.realowner, WEP_CVAR(minelayer, remote_damage), WEP_CVAR(minelayer, remote_edgedamage), WEP_CVAR(minelayer, remote_radius), world, world, WEP_CVAR(minelayer, remote_force), self.projectiledeathtype | HITTYPE_BOUNCE, world);
- if(self.realowner.weapon == WEP_MINE_LAYER.m_id)
+ if(PS(self.realowner).m_weapon == WEP_MINE_LAYER)
{
setself(self.realowner);
Weapon w = WEP_MINE_LAYER;
self.cnt = WEP_MINE_LAYER.m_id;
int slot = 0; // TODO: unhardcode
ATTACK_FINISHED(self, slot) = time;
- self.switchweapon = w_getbestweapon(self);
+ PS(self).m_switchweapon = w_getbestweapon(self);
}
setself(this);
}
}
// remote detonation
- if(self.realowner.weapon == WEP_MINE_LAYER.m_id)
+ if(PS(self.realowner).m_weapon == WEP_MINE_LAYER)
if(self.realowner.deadflag == DEAD_NO)
if(self.minelayer_detonate)
W_MineLayer_RemoteExplode();
if(autocvar_g_balance_minelayer_reload_ammo && actor.clip_load < WEP_CVAR(minelayer, ammo)) // forced reload
{
// not if we're holding the minelayer without enough ammo, but can detonate existing mines
- if(!(W_MineLayer_PlacedMines(false) && actor.WEP_AMMO(MINE_LAYER) < WEP_CVAR(minelayer, ammo))) {
+ if(!(W_MineLayer_PlacedMines(false) && actor.(thiswep.ammo_field) < WEP_CVAR(minelayer, ammo))) {
thiswep.wr_reload(thiswep);
}
}
sound(actor, CH_WEAPON_B, SND_MINE_DET, VOL_BASE, ATTN_NORM);
}
}
- METHOD(MineLayer, wr_init, void(entity thiswep))
- {
- MINELAYER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
- }
METHOD(MineLayer, wr_checkammo1, bool(entity thiswep))
{
int slot = 0; // TODO: unhardcode
// don't switch while placing a mine
- if(ATTACK_FINISHED(self, slot) <= time || self.weapon != WEP_MINE_LAYER.m_id)
+ if(ATTACK_FINISHED(self, slot) <= time || PS(self).m_weapon != WEP_MINE_LAYER)
{
- float ammo_amount = self.WEP_AMMO(MINE_LAYER) >= WEP_CVAR(minelayer, ammo);
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(minelayer, ammo);
ammo_amount += self.(weapon_load[WEP_MINE_LAYER.m_id]) >= WEP_CVAR(minelayer, ammo);
return ammo_amount;
}
else
return false;
}
- METHOD(MineLayer, wr_config, void(entity thiswep))
- {
- MINELAYER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
- }
METHOD(MineLayer, wr_resetplayers, void(entity thiswep))
{
self.minelayer_mines = 0;
/* wepimg */ ATTRIB(Mortar, model2, string, "weapongrenadelauncher");
/* refname */ ATTRIB(Mortar, netname, string, "mortar");
/* wepname */ ATTRIB(Mortar, m_name, string, _("Mortar"));
+
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, ammo, float, BOTH) \
+ P(class, prefix, animtime, float, BOTH) \
+ P(class, prefix, bouncefactor, float, NONE) \
+ P(class, prefix, bouncestop, float, NONE) \
+ P(class, prefix, damageforcescale, float, BOTH) \
+ P(class, prefix, damage, float, BOTH) \
+ P(class, prefix, edgedamage, float, BOTH) \
+ P(class, prefix, force, float, BOTH) \
+ P(class, prefix, health, float, BOTH) \
+ P(class, prefix, lifetime, float, BOTH) \
+ P(class, prefix, lifetime_bounce, float, SEC) \
+ P(class, prefix, lifetime_stick, float, BOTH) \
+ P(class, prefix, radius, float, BOTH) \
+ P(class, prefix, refire, float, BOTH) \
+ P(class, prefix, reload_ammo, float, NONE) \
+ P(class, prefix, reload_time, float, NONE) \
+ P(class, prefix, remote_detonateprimary, float, SEC) \
+ P(class, prefix, remote_minbouncecnt, float, PRI) \
+ P(class, prefix, speed, float, BOTH) \
+ P(class, prefix, speed_up, float, BOTH) \
+ P(class, prefix, speed_z, float, BOTH) \
+ P(class, prefix, spread, float, BOTH) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, type, float, BOTH) \
+ P(class, prefix, weaponreplace, string, NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ END()
+ W_PROPS(X, Mortar, mortar)
+#undef X
ENDCLASS(Mortar)
-REGISTER_WEAPON(MORTAR, NEW(Mortar));
-
-#define MORTAR_SETTINGS(w_cvar,w_prop) MORTAR_SETTINGS_LIST(w_cvar, w_prop, MORTAR, mortar)
-#define MORTAR_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
- w_cvar(id, sn, BOTH, ammo) \
- w_cvar(id, sn, BOTH, animtime) \
- w_cvar(id, sn, NONE, bouncefactor) \
- w_cvar(id, sn, NONE, bouncestop) \
- w_cvar(id, sn, BOTH, damage) \
- w_cvar(id, sn, BOTH, damageforcescale) \
- w_cvar(id, sn, BOTH, edgedamage) \
- w_cvar(id, sn, BOTH, force) \
- w_cvar(id, sn, BOTH, health) \
- w_cvar(id, sn, BOTH, lifetime) \
- w_cvar(id, sn, SEC, lifetime_bounce) \
- w_cvar(id, sn, BOTH, lifetime_stick) \
- w_cvar(id, sn, BOTH, radius) \
- w_cvar(id, sn, BOTH, refire) \
- w_cvar(id, sn, SEC, remote_detonateprimary) \
- w_cvar(id, sn, PRI, remote_minbouncecnt) \
- w_cvar(id, sn, BOTH, speed) \
- w_cvar(id, sn, BOTH, speed_up) \
- w_cvar(id, sn, BOTH, speed_z) \
- w_cvar(id, sn, BOTH, spread) \
- w_cvar(id, sn, BOTH, type) \
- w_prop(id, sn, float, reloading_ammo, reload_ammo) \
- w_prop(id, sn, float, reloading_time, reload_time) \
- w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
- w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
- w_prop(id, sn, string, weaponreplace, weaponreplace) \
- w_prop(id, sn, float, weaponstart, weaponstart) \
- w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
- w_prop(id, sn, float, weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(MORTAR, mortar, NEW(Mortar));
+
#ifdef SVQC
-MORTAR_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
.float gl_detonate_later;
.float gl_bouncecnt;
#endif
}
}
}
- METHOD(Mortar, wr_init, void(entity thiswep))
- {
- MORTAR_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
- }
METHOD(Mortar, wr_checkammo1, bool(entity thiswep))
{
- float ammo_amount = self.WEP_AMMO(MORTAR) >= WEP_CVAR_PRI(mortar, ammo);
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(mortar, ammo);
ammo_amount += self.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_PRI(mortar, ammo);
return ammo_amount;
}
METHOD(Mortar, wr_checkammo2, bool(entity thiswep))
{
- float ammo_amount = self.WEP_AMMO(MORTAR) >= WEP_CVAR_SEC(mortar, ammo);
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(mortar, ammo);
ammo_amount += self.(weapon_load[WEP_MORTAR.m_id]) >= WEP_CVAR_SEC(mortar, ammo);
return ammo_amount;
}
- METHOD(Mortar, wr_config, void(entity thiswep))
- {
- MORTAR_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
- }
METHOD(Mortar, wr_reload, void(entity thiswep))
{
W_Reload(self, min(WEP_CVAR_PRI(mortar, ammo), WEP_CVAR_SEC(mortar, ammo)), SND(RELOAD)); // WEAPONTODO
/* wepimg */ ATTRIB(PortoLaunch, model2, string, "weaponporto");
/* refname */ ATTRIB(PortoLaunch, netname, string, "porto");
/* wepname */ ATTRIB(PortoLaunch, m_name, string, _("Port-O-Launch"));
+
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, animtime, float, BOTH) \
+ P(class, prefix, lifetime, float, BOTH) \
+ P(class, prefix, refire, float, BOTH) \
+ P(class, prefix, secondary, float, NONE) \
+ P(class, prefix, speed, float, BOTH) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, weaponreplace, string,NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ END()
+ W_PROPS(X, PortoLaunch, porto)
+#undef X
ENDCLASS(PortoLaunch)
-REGISTER_WEAPON(PORTO, NEW(PortoLaunch));
-
-#define PORTO_SETTINGS(w_cvar,w_prop) PORTO_SETTINGS_LIST(w_cvar, w_prop, PORTO, porto)
-#define PORTO_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
- w_cvar(id, sn, BOTH, animtime) \
- w_cvar(id, sn, BOTH, lifetime) \
- w_cvar(id, sn, BOTH, refire) \
- w_cvar(id, sn, BOTH, speed) \
- w_cvar(id, sn, NONE, secondary) \
- w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
- w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
- w_prop(id, sn, string, weaponreplace, weaponreplace) \
- w_prop(id, sn, float, weaponstart, weaponstart) \
- w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
- w_prop(id, sn, float, weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(PORTO, porto, NEW(PortoLaunch));
#ifdef SVQC
-PORTO_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
.entity porto_current;
.vector porto_v_angle; // holds "held" view angles
.float porto_v_angle_held;
if(bot_aim(WEP_CVAR_PRI(porto, speed), 0, WEP_CVAR_PRI(porto, lifetime), false))
self.BUTTON_ATCK = true;
}
- METHOD(PortoLaunch, wr_config, void(entity this))
- {
- PORTO_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
- }
METHOD(PortoLaunch, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
{
if(WEP_CVAR(porto, secondary))
// always allow infinite ammo
return true;
}
- METHOD(PortoLaunch, wr_init, void(entity this))
- {
- PORTO_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
- }
METHOD(PortoLaunch, wr_setup, void(entity thiswep))
{
SELFPARAM();
/* wepimg */ ATTRIB(Rifle, model2, string, "weaponrifle");
/* refname */ ATTRIB(Rifle, netname, string, "rifle");
/* wepname */ ATTRIB(Rifle, m_name, string, _("Rifle"));
+
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, ammo, float, BOTH) \
+ P(class, prefix, animtime, float, BOTH) \
+ P(class, prefix, bullethail, float, BOTH) \
+ P(class, prefix, burstcost, float, BOTH) \
+ P(class, prefix, bursttime, float, NONE) \
+ P(class, prefix, damage, float, BOTH) \
+ P(class, prefix, force, float, BOTH) \
+ P(class, prefix, refire, float, BOTH) \
+ P(class, prefix, reload, float, SEC) \
+ P(class, prefix, reload_ammo, float, NONE) \
+ P(class, prefix, reload_time, float, NONE) \
+ P(class, prefix, secondary, float, NONE) \
+ P(class, prefix, shots, float, BOTH) \
+ P(class, prefix, solidpenetration, float, BOTH) \
+ P(class, prefix, spread, float, BOTH) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, tracer, float, BOTH) \
+ P(class, prefix, weaponreplace, string, NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ END()
+ W_PROPS(X, Rifle, rifle)
+#undef X
ENDCLASS(Rifle)
-REGISTER_WEAPON(RIFLE, NEW(Rifle));
+REGISTER_WEAPON(RIFLE, rifle, NEW(Rifle));
-#define RIFLE_SETTINGS(w_cvar,w_prop) RIFLE_SETTINGS_LIST(w_cvar, w_prop, RIFLE, rifle)
-#define RIFLE_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
- w_cvar(id, sn, BOTH, ammo) \
- w_cvar(id, sn, BOTH, animtime) \
- w_cvar(id, sn, BOTH, bullethail) \
- w_cvar(id, sn, BOTH, burstcost) \
- w_cvar(id, sn, BOTH, damage) \
- w_cvar(id, sn, BOTH, force) \
- w_cvar(id, sn, BOTH, refire) \
- w_cvar(id, sn, BOTH, shots) \
- w_cvar(id, sn, BOTH, solidpenetration) \
- w_cvar(id, sn, BOTH, spread) \
- w_cvar(id, sn, BOTH, tracer) \
- w_cvar(id, sn, NONE, bursttime) \
- w_cvar(id, sn, NONE, secondary) \
- w_cvar(id, sn, SEC, reload) \
- w_prop(id, sn, float, reloading_ammo, reload_ammo) \
- w_prop(id, sn, float, reloading_time, reload_time) \
- w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
- w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
- w_prop(id, sn, string, weaponreplace, weaponreplace) \
- w_prop(id, sn, float, weaponstart, weaponstart) \
- w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
- w_prop(id, sn, float, weaponthrowable, weaponthrowable)
#ifdef SVQC
-RIFLE_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
.float rifle_accumulator;
#endif
#endif
.float rifle_bullethail_refire;
void W_Rifle_BulletHail_Continue(Weapon thiswep, entity actor, .entity weaponentity, int fire)
{
- float r, sw, af;
+ float r, af;
- sw = actor.switchweapon; // make it not detect weapon changes as reason to abort firing
+ Weapon sw = PS(actor).m_switchweapon; // make it not detect weapon changes as reason to abort firing
int slot = weaponslot(weaponentity);
af = ATTACK_FINISHED(actor, slot);
- actor.switchweapon = actor.weapon;
+ PS(actor).m_switchweapon = PS(actor).m_weapon;
ATTACK_FINISHED(actor, slot) = time;
r = weapon_prepareattack(thiswep, actor, weaponentity, actor.rifle_bullethail_frame == WFRAME_FIRE2, actor.rifle_bullethail_refire);
- if(actor.switchweapon == actor.weapon)
- actor.switchweapon = sw;
+ if(PS(actor).m_switchweapon == PS(actor).m_weapon)
+ PS(actor).m_switchweapon = sw;
if(r)
{
actor.rifle_bullethail_attackfunc();
}
}
}
- METHOD(Rifle, wr_init, void(entity thiswep))
- {
- RIFLE_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
- }
METHOD(Rifle, wr_checkammo1, bool(entity thiswep))
{
- float ammo_amount = self.WEP_AMMO(RIFLE) >= WEP_CVAR_PRI(rifle, ammo);
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(rifle, ammo);
ammo_amount += self.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_PRI(rifle, ammo);
return ammo_amount;
}
METHOD(Rifle, wr_checkammo2, bool(entity thiswep))
{
- float ammo_amount = self.WEP_AMMO(RIFLE) >= WEP_CVAR_SEC(rifle, ammo);
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(rifle, ammo);
ammo_amount += self.(weapon_load[WEP_RIFLE.m_id]) >= WEP_CVAR_SEC(rifle, ammo);
return ammo_amount;
}
- METHOD(Rifle, wr_config, void(entity thiswep))
- {
- RIFLE_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
- }
METHOD(Rifle, wr_resetplayer, void(entity thiswep))
{
self.rifle_accumulator = time - WEP_CVAR(rifle, bursttime);
/* wepimg */ ATTRIB(Seeker, model2, string, "weaponseeker");
/* refname */ ATTRIB(Seeker, netname, string, "seeker");
/* wepname */ ATTRIB(Seeker, m_name, string, _("T.A.G. Seeker"));
+
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, flac_ammo, float, NONE) \
+ P(class, prefix, flac_animtime, float, NONE) \
+ P(class, prefix, flac_damage, float, NONE) \
+ P(class, prefix, flac_edgedamage, float, NONE) \
+ P(class, prefix, flac_force, float, NONE) \
+ P(class, prefix, flac_lifetime, float, NONE) \
+ P(class, prefix, flac_lifetime_rand, float, NONE) \
+ P(class, prefix, flac_radius, float, NONE) \
+ P(class, prefix, flac_refire, float, NONE) \
+ P(class, prefix, flac_speed, float, NONE) \
+ P(class, prefix, flac_speed_up, float, NONE) \
+ P(class, prefix, flac_speed_z, float, NONE) \
+ P(class, prefix, flac_spread, float, NONE) \
+ P(class, prefix, missile_accel, float, NONE) \
+ P(class, prefix, missile_ammo, float, NONE) \
+ P(class, prefix, missile_animtime, float, NONE) \
+ P(class, prefix, missile_count, float, NONE) \
+ P(class, prefix, missile_damageforcescale, float, NONE) \
+ P(class, prefix, missile_damage, float, NONE) \
+ P(class, prefix, missile_decel, float, NONE) \
+ P(class, prefix, missile_delay, float, NONE) \
+ P(class, prefix, missile_edgedamage, float, NONE) \
+ P(class, prefix, missile_force, float, NONE) \
+ P(class, prefix, missile_health, float, NONE) \
+ P(class, prefix, missile_lifetime, float, NONE) \
+ P(class, prefix, missile_proxy, float, NONE) \
+ P(class, prefix, missile_proxy_delay, float, NONE) \
+ P(class, prefix, missile_proxy_maxrange, float, NONE) \
+ P(class, prefix, missile_radius, float, NONE) \
+ P(class, prefix, missile_refire, float, NONE) \
+ P(class, prefix, missile_smart, float, NONE) \
+ P(class, prefix, missile_smart_mindist, float, NONE) \
+ P(class, prefix, missile_smart_trace_max, float, NONE) \
+ P(class, prefix, missile_smart_trace_min, float, NONE) \
+ P(class, prefix, missile_speed, float, NONE) \
+ P(class, prefix, missile_speed_max, float, NONE) \
+ P(class, prefix, missile_speed_up, float, NONE) \
+ P(class, prefix, missile_speed_z, float, NONE) \
+ P(class, prefix, missile_spread, float, NONE) \
+ P(class, prefix, missile_turnrate, float, NONE) \
+ P(class, prefix, reload_ammo, float, NONE) \
+ P(class, prefix, reload_time, float, NONE) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, tag_ammo, float, NONE) \
+ P(class, prefix, tag_animtime, float, NONE) \
+ P(class, prefix, tag_damageforcescale, float, NONE) \
+ P(class, prefix, tag_health, float, NONE) \
+ P(class, prefix, tag_lifetime, float, NONE) \
+ P(class, prefix, tag_refire, float, NONE) \
+ P(class, prefix, tag_speed, float, NONE) \
+ P(class, prefix, tag_spread, float, NONE) \
+ P(class, prefix, tag_tracker_lifetime, float, NONE) \
+ P(class, prefix, type, float, NONE) \
+ P(class, prefix, weaponreplace, string, NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ END()
+ W_PROPS(X, Seeker, seeker)
+#undef X
ENDCLASS(Seeker)
-REGISTER_WEAPON(SEEKER, NEW(Seeker));
-
-#define SEEKER_SETTINGS(w_cvar,w_prop) SEEKER_SETTINGS_LIST(w_cvar, w_prop, SEEKER, seeker)
-#define SEEKER_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
- w_cvar(id, sn, NONE, type) \
- w_cvar(id, sn, NONE, flac_ammo) \
- w_cvar(id, sn, NONE, flac_animtime) \
- w_cvar(id, sn, NONE, flac_damage) \
- w_cvar(id, sn, NONE, flac_edgedamage) \
- w_cvar(id, sn, NONE, flac_force) \
- w_cvar(id, sn, NONE, flac_lifetime) \
- w_cvar(id, sn, NONE, flac_lifetime_rand) \
- w_cvar(id, sn, NONE, flac_radius) \
- w_cvar(id, sn, NONE, flac_refire) \
- w_cvar(id, sn, NONE, flac_speed) \
- w_cvar(id, sn, NONE, flac_speed_up) \
- w_cvar(id, sn, NONE, flac_speed_z) \
- w_cvar(id, sn, NONE, flac_spread) \
- w_cvar(id, sn, NONE, missile_accel) \
- w_cvar(id, sn, NONE, missile_ammo) \
- w_cvar(id, sn, NONE, missile_animtime) \
- w_cvar(id, sn, NONE, missile_count) \
- w_cvar(id, sn, NONE, missile_damage) \
- w_cvar(id, sn, NONE, missile_damageforcescale) \
- w_cvar(id, sn, NONE, missile_decel) \
- w_cvar(id, sn, NONE, missile_delay) \
- w_cvar(id, sn, NONE, missile_edgedamage) \
- w_cvar(id, sn, NONE, missile_force) \
- w_cvar(id, sn, NONE, missile_health) \
- w_cvar(id, sn, NONE, missile_lifetime) \
- w_cvar(id, sn, NONE, missile_proxy) \
- w_cvar(id, sn, NONE, missile_proxy_delay) \
- w_cvar(id, sn, NONE, missile_proxy_maxrange) \
- w_cvar(id, sn, NONE, missile_radius) \
- w_cvar(id, sn, NONE, missile_refire) \
- w_cvar(id, sn, NONE, missile_smart) \
- w_cvar(id, sn, NONE, missile_smart_mindist) \
- w_cvar(id, sn, NONE, missile_smart_trace_max) \
- w_cvar(id, sn, NONE, missile_smart_trace_min) \
- w_cvar(id, sn, NONE, missile_speed) \
- w_cvar(id, sn, NONE, missile_speed_max) \
- w_cvar(id, sn, NONE, missile_speed_up) \
- w_cvar(id, sn, NONE, missile_speed_z) \
- w_cvar(id, sn, NONE, missile_spread) \
- w_cvar(id, sn, NONE, missile_turnrate) \
- w_cvar(id, sn, NONE, tag_ammo) \
- w_cvar(id, sn, NONE, tag_animtime) \
- w_cvar(id, sn, NONE, tag_damageforcescale) \
- w_cvar(id, sn, NONE, tag_health) \
- w_cvar(id, sn, NONE, tag_lifetime) \
- w_cvar(id, sn, NONE, tag_refire) \
- w_cvar(id, sn, NONE, tag_speed) \
- w_cvar(id, sn, NONE, tag_spread) \
- w_cvar(id, sn, NONE, tag_tracker_lifetime) \
- w_prop(id, sn, float, reloading_ammo, reload_ammo) \
- w_prop(id, sn, float, reloading_time, reload_time) \
- w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
- w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
- w_prop(id, sn, string, weaponreplace, weaponreplace) \
- w_prop(id, sn, float, weaponstart, weaponstart) \
- w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
- w_prop(id, sn, float, weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(SEEKER, seeker, NEW(Seeker));
+
#ifdef SVQC
-SEEKER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
.entity tag_target, wps_tag_tracker;
.float tag_time;
#endif
entity oldenemy;
self.cnt = self.cnt - 1;
- if((!(self.realowner.items & IT_UNLIMITED_AMMO) && self.realowner.WEP_AMMO(SEEKER) < WEP_CVAR(seeker, missile_ammo)) || (self.cnt <= -1) || (self.realowner.deadflag != DEAD_NO) || (self.realowner.switchweapon != WEP_SEEKER.m_id))
+ Weapon thiswep = WEP_SEEKER;
+ if((!(self.realowner.items & IT_UNLIMITED_AMMO) && self.realowner.(thiswep.ammo_field) < WEP_CVAR(seeker, missile_ammo)) || (self.cnt <= -1) || (self.realowner.deadflag != DEAD_NO) || (PS(self.realowner).m_switchweapon != WEP_SEEKER))
{
remove(self);
return;
void W_Seeker_Tracker_Think()
{SELFPARAM();
// commit suicide if: You die OR target dies OR you switch away from the seeker OR commit suicide if lifetime is up
- if((self.realowner.deadflag != DEAD_NO) || (self.tag_target.deadflag != DEAD_NO) || (self.realowner.switchweapon != WEP_SEEKER.m_id)
+ if((self.realowner.deadflag != DEAD_NO) || (self.tag_target.deadflag != DEAD_NO) || (PS(self.realowner).m_switchweapon != WEP_SEEKER)
|| (time > self.tag_time + WEP_CVAR(seeker, tag_tracker_lifetime)))
{
if(self)
}
}
}
- METHOD(Seeker, wr_init, void(entity thiswep))
- {
- SEEKER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
- }
METHOD(Seeker, wr_checkammo1, bool(entity thiswep))
{
float ammo_amount;
if(WEP_CVAR(seeker, type) == 1)
{
- ammo_amount = self.WEP_AMMO(SEEKER) >= WEP_CVAR(seeker, missile_ammo);
+ ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, missile_ammo);
ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, missile_ammo);
}
else
{
- ammo_amount = self.WEP_AMMO(SEEKER) >= WEP_CVAR(seeker, tag_ammo);
+ ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, tag_ammo);
ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, tag_ammo);
}
return ammo_amount;
float ammo_amount;
if(WEP_CVAR(seeker, type) == 1)
{
- ammo_amount = self.WEP_AMMO(SEEKER) >= WEP_CVAR(seeker, tag_ammo);
+ ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, tag_ammo);
ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, tag_ammo);
}
else
{
- ammo_amount = self.WEP_AMMO(SEEKER) >= WEP_CVAR(seeker, flac_ammo);
+ ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR(seeker, flac_ammo);
ammo_amount += self.(weapon_load[WEP_SEEKER.m_id]) >= WEP_CVAR(seeker, flac_ammo);
}
return ammo_amount;
}
- METHOD(Seeker, wr_config, void(entity thiswep))
- {
- SEEKER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
- }
METHOD(Seeker, wr_reload, void(entity thiswep))
{
W_Reload(self, min(WEP_CVAR(seeker, missile_ammo), WEP_CVAR(seeker, tag_ammo)), SND(RELOAD));
/* wepimg */ ATTRIB(Shockwave, model2, string, "weaponshotgun");
/* refname */ ATTRIB(Shockwave, netname, string, "shockwave");
/* wepname */ ATTRIB(Shockwave, m_name, string, _("Shockwave"));
+
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, blast_animtime, float, NONE) \
+ P(class, prefix, blast_damage, float, NONE) \
+ P(class, prefix, blast_distance, float, NONE) \
+ P(class, prefix, blast_edgedamage, float, NONE) \
+ P(class, prefix, blast_force, float, NONE) \
+ P(class, prefix, blast_force_forwardbias, float, NONE) \
+ P(class, prefix, blast_force_zscale, float, NONE) \
+ P(class, prefix, blast_jump_damage, float, NONE) \
+ P(class, prefix, blast_jump_edgedamage, float, NONE) \
+ P(class, prefix, blast_jump_force, float, NONE) \
+ P(class, prefix, blast_jump_force_velocitybias, float, NONE) \
+ P(class, prefix, blast_jump_force_zscale, float, NONE) \
+ P(class, prefix, blast_jump_multiplier_accuracy, float, NONE) \
+ P(class, prefix, blast_jump_multiplier_distance, float, NONE) \
+ P(class, prefix, blast_jump_multiplier_min, float, NONE) \
+ P(class, prefix, blast_jump_radius, float, NONE) \
+ P(class, prefix, blast_multiplier_accuracy, float, NONE) \
+ P(class, prefix, blast_multiplier_distance, float, NONE) \
+ P(class, prefix, blast_multiplier_min, float, NONE) \
+ P(class, prefix, blast_refire, float, NONE) \
+ P(class, prefix, blast_splash_damage, float, NONE) \
+ P(class, prefix, blast_splash_edgedamage, float, NONE) \
+ P(class, prefix, blast_splash_force, float, NONE) \
+ P(class, prefix, blast_splash_force_forwardbias, float, NONE) \
+ P(class, prefix, blast_splash_multiplier_accuracy, float, NONE) \
+ P(class, prefix, blast_splash_multiplier_distance, float, NONE) \
+ P(class, prefix, blast_splash_multiplier_min, float, NONE) \
+ P(class, prefix, blast_splash_radius, float, NONE) \
+ P(class, prefix, blast_spread_max, float, NONE) \
+ P(class, prefix, blast_spread_min, float, NONE) \
+ P(class, prefix, melee_animtime, float, NONE) \
+ P(class, prefix, melee_damage, float, NONE) \
+ P(class, prefix, melee_delay, float, NONE) \
+ P(class, prefix, melee_force, float, NONE) \
+ P(class, prefix, melee_multihit, float, NONE) \
+ P(class, prefix, melee_no_doubleslap, float, NONE) \
+ P(class, prefix, melee_nonplayerdamage, float, NONE) \
+ P(class, prefix, melee_range, float, NONE) \
+ P(class, prefix, melee_refire, float, NONE) \
+ P(class, prefix, melee_swing_side, float, NONE) \
+ P(class, prefix, melee_swing_up, float, NONE) \
+ P(class, prefix, melee_time, float, NONE) \
+ P(class, prefix, melee_traces, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, weaponreplace, string, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ END()
+ W_PROPS(X, Shockwave, shockwave)
+#undef X
+
ENDCLASS(Shockwave)
-REGISTER_WEAPON(SHOCKWAVE, NEW(Shockwave));
-
-#define SHOCKWAVE_SETTINGS(w_cvar,w_prop) SHOCKWAVE_SETTINGS_LIST(w_cvar, w_prop, SHOCKWAVE, shockwave)
-#define SHOCKWAVE_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
- w_cvar(id, sn, NONE, blast_animtime) \
- w_cvar(id, sn, NONE, blast_damage) \
- w_cvar(id, sn, NONE, blast_distance) \
- w_cvar(id, sn, NONE, blast_edgedamage) \
- w_cvar(id, sn, NONE, blast_force) \
- w_cvar(id, sn, NONE, blast_force_forwardbias) \
- w_cvar(id, sn, NONE, blast_force_zscale) \
- w_cvar(id, sn, NONE, blast_jump_damage) \
- w_cvar(id, sn, NONE, blast_jump_edgedamage) \
- w_cvar(id, sn, NONE, blast_jump_force) \
- w_cvar(id, sn, NONE, blast_jump_force_velocitybias) \
- w_cvar(id, sn, NONE, blast_jump_force_zscale) \
- w_cvar(id, sn, NONE, blast_jump_multiplier_accuracy) \
- w_cvar(id, sn, NONE, blast_jump_multiplier_distance) \
- w_cvar(id, sn, NONE, blast_jump_multiplier_min) \
- w_cvar(id, sn, NONE, blast_jump_radius) \
- w_cvar(id, sn, NONE, blast_multiplier_accuracy) \
- w_cvar(id, sn, NONE, blast_multiplier_distance) \
- w_cvar(id, sn, NONE, blast_multiplier_min) \
- w_cvar(id, sn, NONE, blast_refire) \
- w_cvar(id, sn, NONE, blast_splash_damage) \
- w_cvar(id, sn, NONE, blast_splash_edgedamage) \
- w_cvar(id, sn, NONE, blast_splash_force) \
- w_cvar(id, sn, NONE, blast_splash_force_forwardbias) \
- w_cvar(id, sn, NONE, blast_splash_multiplier_accuracy) \
- w_cvar(id, sn, NONE, blast_splash_multiplier_distance) \
- w_cvar(id, sn, NONE, blast_splash_multiplier_min) \
- w_cvar(id, sn, NONE, blast_splash_radius) \
- w_cvar(id, sn, NONE, blast_spread_max) \
- w_cvar(id, sn, NONE, blast_spread_min) \
- w_cvar(id, sn, NONE, melee_animtime) \
- w_cvar(id, sn, NONE, melee_damage) \
- w_cvar(id, sn, NONE, melee_delay) \
- w_cvar(id, sn, NONE, melee_force) \
- w_cvar(id, sn, NONE, melee_multihit) \
- w_cvar(id, sn, NONE, melee_no_doubleslap) \
- w_cvar(id, sn, NONE, melee_nonplayerdamage) \
- w_cvar(id, sn, NONE, melee_range) \
- w_cvar(id, sn, NONE, melee_refire) \
- w_cvar(id, sn, NONE, melee_swing_side) \
- w_cvar(id, sn, NONE, melee_swing_up) \
- w_cvar(id, sn, NONE, melee_time) \
- w_cvar(id, sn, NONE, melee_traces) \
- w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
- w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
- w_prop(id, sn, string, weaponreplace, weaponreplace) \
- w_prop(id, sn, float, weaponstart, weaponstart) \
- w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
- w_prop(id, sn, float, weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(SHOCKWAVE, shockwave, NEW(Shockwave));
+
-#ifdef SVQC
-SHOCKWAVE_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
-#endif
#ifdef CSQC
void Net_ReadShockwaveParticle();
.vector sw_shotorg;
WriteShort(MSG_BROADCAST, WEP_CVAR(shockwave, blast_distance));
WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_max), 255));
WriteByte(MSG_BROADCAST, bound(0, WEP_CVAR(shockwave, blast_spread_min), 255));
- WriteByte(MSG_BROADCAST, num_for_edict(self));
+ WriteByte(MSG_BROADCAST, etof(self));
}
void W_Shockwave_Attack()
}
}
}
- METHOD(Shockwave, wr_init, void(entity thiswep))
- {
- SHOCKWAVE_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
- }
METHOD(Shockwave, wr_checkammo1, bool(entity thiswep))
{
return true; // infinite ammo
// shockwave has infinite ammo
return true;
}
- METHOD(Shockwave, wr_config, void(entity thiswep))
- {
- SHOCKWAVE_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
- }
METHOD(Shockwave, wr_suicidemessage, int(entity thiswep))
{
return WEAPON_THINKING_WITH_PORTALS;
/* wepimg */ ATTRIB(Shotgun, model2, string, "weaponshotgun");
/* refname */ ATTRIB(Shotgun, netname, string, "shotgun");
/* wepname */ ATTRIB(Shotgun, m_name, string, _("Shotgun"));
+
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, alt_animtime, float, SEC) \
+ P(class, prefix, alt_refire, float, SEC) \
+ P(class, prefix, ammo, float, PRI) \
+ P(class, prefix, animtime, float, BOTH) \
+ P(class, prefix, bullets, float, PRI) \
+ P(class, prefix, damage, float, BOTH) \
+ P(class, prefix, force, float, BOTH) \
+ P(class, prefix, melee_delay, float, SEC) \
+ P(class, prefix, melee_multihit, float, SEC) \
+ P(class, prefix, melee_nonplayerdamage, float, SEC) \
+ P(class, prefix, melee_no_doubleslap, float, SEC) \
+ P(class, prefix, melee_range, float, SEC) \
+ P(class, prefix, melee_swing_side, float, SEC) \
+ P(class, prefix, melee_swing_up, float, SEC) \
+ P(class, prefix, melee_time, float, SEC) \
+ P(class, prefix, melee_traces, float, SEC) \
+ P(class, prefix, refire, float, BOTH) \
+ P(class, prefix, reload_ammo, float, NONE) \
+ P(class, prefix, reload_time, float, NONE) \
+ P(class, prefix, secondary, float, NONE) \
+ P(class, prefix, solidpenetration, float, PRI) \
+ P(class, prefix, spread, float, PRI) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, weaponreplace, string,NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ END()
+ W_PROPS(X, Shotgun, shotgun)
+#undef X
+
ENDCLASS(Shotgun)
-REGISTER_WEAPON(SHOTGUN, NEW(Shotgun));
-
-#define SHOTGUN_SETTINGS(w_cvar,w_prop) SHOTGUN_SETTINGS_LIST(w_cvar, w_prop, SHOTGUN, shotgun)
-#define SHOTGUN_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
- w_cvar(id, sn, PRI, ammo) \
- w_cvar(id, sn, BOTH, animtime) \
- w_cvar(id, sn, BOTH, refire) \
- w_cvar(id, sn, PRI, bullets) \
- w_cvar(id, sn, BOTH, damage) \
- w_cvar(id, sn, BOTH, force) \
- w_cvar(id, sn, PRI, solidpenetration) \
- w_cvar(id, sn, PRI, spread) \
- w_cvar(id, sn, NONE, secondary) \
- w_cvar(id, sn, SEC, melee_time) \
- w_cvar(id, sn, SEC, melee_no_doubleslap) \
- w_cvar(id, sn, SEC, melee_traces) \
- w_cvar(id, sn, SEC, melee_swing_up) \
- w_cvar(id, sn, SEC, melee_swing_side) \
- w_cvar(id, sn, SEC, melee_nonplayerdamage) \
- w_cvar(id, sn, SEC, melee_multihit) \
- w_cvar(id, sn, SEC, melee_delay) \
- w_cvar(id, sn, SEC, melee_range) \
- w_cvar(id, sn, SEC, alt_animtime) \
- w_cvar(id, sn, SEC, alt_refire) \
- w_prop(id, sn, float, reloading_ammo, reload_ammo) \
- w_prop(id, sn, float, reloading_time, reload_time) \
- w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
- w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
- w_prop(id, sn, string, weaponreplace, weaponreplace) \
- w_prop(id, sn, float, weaponstart, weaponstart) \
- w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
- w_prop(id, sn, float, weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(SHOTGUN, shotgun, NEW(Shotgun));
+
-#ifdef SVQC
-SHOTGUN_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
-#endif
#endif
#ifdef IMPLEMENTATION
#ifdef SVQC
if(actor.clip_load >= 0) // we are not currently reloading
if(!actor.crouch) // no crouchmelee please
if(WEP_CVAR(shotgun, secondary) == 1)
- if(((fire & 1) && actor.WEP_AMMO(SHOTGUN) <= 0 && !(actor.items & IT_UNLIMITED_WEAPON_AMMO)) || (fire & 2))
+ if(((fire & 1) && actor.(thiswep.ammo_field) <= 0 && !(actor.items & IT_UNLIMITED_WEAPON_AMMO)) || (fire & 2))
if(weapon_prepareattack(thiswep, actor, weaponentity, true, WEP_CVAR_SEC(shotgun, refire)))
{
// attempt forcing playback of the anim by switching to another anim (that we never play) here...
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, W_Shotgun_Attack2);
}
}
- METHOD(Shotgun, wr_init, void(entity thiswep))
- {
- SHOTGUN_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
- }
METHOD(Shotgun, wr_setup, void(entity thiswep))
{
self.ammo_field = ammo_none;
}
METHOD(Shotgun, wr_checkammo1, bool(entity thiswep))
{
- float ammo_amount = self.WEP_AMMO(SHOTGUN) >= WEP_CVAR_PRI(shotgun, ammo);
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(shotgun, ammo);
ammo_amount += self.(weapon_load[WEP_SHOTGUN.m_id]) >= WEP_CVAR_PRI(shotgun, ammo);
return ammo_amount;
}
case 1: return true; // melee does not use ammo
case 2: // secondary triple shot
{
- float ammo_amount = self.WEP_AMMO(SHOTGUN) >= WEP_CVAR_PRI(shotgun, ammo);
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(shotgun, ammo);
ammo_amount += self.(weapon_load[WEP_SHOTGUN.m_id]) >= WEP_CVAR_PRI(shotgun, ammo);
return ammo_amount;
}
default: return false; // secondary unavailable
}
}
- METHOD(Shotgun, wr_config, void(entity thiswep))
- {
- SHOTGUN_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
- }
METHOD(Shotgun, wr_reload, void(entity thiswep))
{
W_Reload(self, WEP_CVAR_PRI(shotgun, ammo), SND(RELOAD)); // WEAPONTODO
/* refname */ ATTRIB(Tuba, netname, string, "tuba");
/* xgettext:no-c-format */
/* wepname */ ATTRIB(Tuba, m_name, string, _("@!#%'n Tuba"));
+
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, animtime, float, NONE) \
+ P(class, prefix, attenuation, float, NONE) \
+ P(class, prefix, damage, float, NONE) \
+ P(class, prefix, edgedamage, float, NONE) \
+ P(class, prefix, fadetime, float, NONE) \
+ P(class, prefix, force, float, NONE) \
+ P(class, prefix, pitchstep, float, NONE) \
+ P(class, prefix, radius, float, NONE) \
+ P(class, prefix, refire, float, NONE) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, volume, float, NONE) \
+ P(class, prefix, weaponreplace, string, NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ END()
+ W_PROPS(X, Tuba, tuba)
+#undef X
+
ENDCLASS(Tuba)
-REGISTER_WEAPON(TUBA, NEW(Tuba));
-
-#define TUBA_SETTINGS(w_cvar,w_prop) TUBA_SETTINGS_LIST(w_cvar, w_prop, TUBA, tuba)
-#define TUBA_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
- w_cvar(id, sn, NONE, animtime) \
- w_cvar(id, sn, NONE, attenuation) \
- w_cvar(id, sn, NONE, damage) \
- w_cvar(id, sn, NONE, edgedamage) \
- w_cvar(id, sn, NONE, fadetime) \
- w_cvar(id, sn, NONE, force) \
- w_cvar(id, sn, NONE, pitchstep) \
- w_cvar(id, sn, NONE, radius) \
- w_cvar(id, sn, NONE, refire) \
- w_cvar(id, sn, NONE, volume) \
- w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
- w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
- w_prop(id, sn, string, weaponreplace, weaponreplace) \
- w_prop(id, sn, float, weaponstart, weaponstart) \
- w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
- w_prop(id, sn, float, weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(TUBA, tuba, NEW(Tuba));
+
#ifdef SVQC
-TUBA_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
-float W_Tuba_MarkClientOnlyFieldsAsUsed() {
- // These variables are only used by client/tuba.qc. TODO: move client/tuba.qc code here.
- return WEP_CVAR(tuba, fadetime) + WEP_CVAR(tuba, pitchstep) + WEP_CVAR(tuba, volume);
-}
.entity tuba_note;
.float tuba_smoketime;
}
}
}
- METHOD(Tuba, wr_init, void(entity thiswep))
- {
- TUBA_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
- }
METHOD(Tuba, wr_setup, void(entity thiswep))
{
self.ammo_field = ammo_none;
{
return true; // tuba has infinite ammo
}
- METHOD(Tuba, wr_config, void(entity thiswep))
- {
- TUBA_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
- }
METHOD(Tuba, wr_suicidemessage, int(entity thiswep))
{
if(w_deathtype & HITTYPE_BOUNCE)
/* wepimg */ ATTRIB(Vaporizer, model2, string, "weaponminstanex");
/* refname */ ATTRIB(Vaporizer, netname, string, "vaporizer");
/* wepname */ ATTRIB(Vaporizer, m_name, string, _("Vaporizer"));
+
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, ammo, float, PRI) \
+ P(class, prefix, animtime, float, PRI) \
+ P(class, prefix, damage, float, PRI) \
+ P(class, prefix, refire, float, PRI) \
+ P(class, prefix, ammo, float, SEC) \
+ P(class, prefix, animtime, float, SEC) \
+ P(class, prefix, damage, float, SEC) \
+ P(class, prefix, delay, float, SEC) \
+ P(class, prefix, edgedamage, float, SEC) \
+ P(class, prefix, force, float, SEC) \
+ P(class, prefix, lifetime, float, SEC) \
+ P(class, prefix, radius, float, SEC) \
+ P(class, prefix, refire, float, SEC) \
+ P(class, prefix, shotangle, float, SEC) \
+ P(class, prefix, speed, float, SEC) \
+ P(class, prefix, spread, float, SEC) \
+ P(class, prefix, reload_ammo, float, NONE) \
+ P(class, prefix, reload_time, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, weaponreplace, string, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ END()
+ W_PROPS(X, Vaporizer, vaporizer)
+#undef X
+
ENDCLASS(Vaporizer)
-REGISTER_WEAPON(VAPORIZER, NEW(Vaporizer));
-
-#define VAPORIZER_SETTINGS(w_cvar,w_prop) VAPORIZER_SETTINGS_LIST(w_cvar, w_prop, VAPORIZER, vaporizer)
-#define VAPORIZER_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
- w_cvar(id, sn, PRI, ammo) \
- w_cvar(id, sn, PRI, animtime) \
- w_cvar(id, sn, PRI, damage) \
- w_cvar(id, sn, PRI, refire) \
- w_cvar(id, sn, SEC, ammo) \
- w_cvar(id, sn, SEC, animtime) \
- w_cvar(id, sn, SEC, damage) \
- w_cvar(id, sn, SEC, delay) \
- w_cvar(id, sn, SEC, edgedamage) \
- w_cvar(id, sn, SEC, force) \
- w_cvar(id, sn, SEC, lifetime) \
- w_cvar(id, sn, SEC, radius) \
- w_cvar(id, sn, SEC, refire) \
- w_cvar(id, sn, SEC, shotangle) \
- w_cvar(id, sn, SEC, speed) \
- w_cvar(id, sn, SEC, spread) \
- w_prop(id, sn, float, reloading_ammo, reload_ammo) \
- w_prop(id, sn, float, reloading_time, reload_time) \
- w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
- w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
- w_prop(id, sn, string, weaponreplace, weaponreplace) \
- w_prop(id, sn, float, weaponstart, weaponstart) \
- w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
- w_prop(id, sn, float, weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(VAPORIZER, vaporizer, NEW(Vaporizer));
+
#ifdef SVQC
-VAPORIZER_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
.float vaporizer_lasthit;
.float jump_interval;
.float jump_interval2;
WriteCoord(MSG_BROADCAST, v.y);
WriteCoord(MSG_BROADCAST, v.z);
WriteByte(MSG_BROADCAST, hit);
- WriteByte(MSG_BROADCAST, num_for_edict(player));
+ WriteByte(MSG_BROADCAST, etof(player));
WriteByte(MSG_BROADCAST, player.team);
}
#elif defined(CSQC)
Draw_VaporizerBeam_trace_callback_tex = string_null;
/*if(!MUTATOR_CALLHOOK(Particles_VaporizerBeam, this.vorg1, this.vorg2))
- if(autocvar_cl_particles_oldvortexbeam && (getstati(STAT_ALLOW_OLDVORTEXBEAM) || isdemo()))
+ if(autocvar_cl_particles_oldvortexbeam && (STAT(ALLOW_OLDVORTEXBEAM) || isdemo()))
WarpZone_TrailParticles_WithMultiplier(world, particleeffectnum(EFFECT_VORTEX_BEAM_OLD), this.vorg1, this.vorg2, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE);
else
WarpZone_TrailParticles_WithMultiplier(world, particleeffectnum(EFFECT_VORTEX_BEAM), this.vorg1, this.vorg2, 1, PARTICLES_USEALPHA | PARTICLES_USEFADE);*/
float spread = autocvar_g_rm_laser_spread;
float rndspread = autocvar_g_rm_laser_spread_random;
- float w = self.weapon;
- self.weapon = WEP_ELECTRO.m_id;
+ Weapon w = PS(self).m_weapon;
+ PS(self).m_weapon = WEP_ELECTRO;
W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, SND(CRYLINK_FIRE), CH_WEAPON_A, autocvar_g_rm_laser_damage);
- self.weapon = w;
+ PS(self).m_weapon = w;
Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
float counter = 0;
float total = 1;
- int w = self.weapon;
- self.weapon = WEP_ELECTRO.m_id;
+ Weapon w = PS(self).m_weapon;
+ PS(self).m_weapon = WEP_ELECTRO;
W_SetupShot_ProjectileSize (self, '0 0 -3', '0 0 -3', false, 2, SND(ELECTRO_FIRE2), CH_WEAPON_A, autocvar_g_rm_laser_damage);
- self.weapon = w;
+ PS(self).m_weapon = w;
Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
METHOD(Vaporizer, wr_aim, void(entity thiswep))
{
- if(self.WEP_AMMO(VAPORIZER) > 0)
+ if(self.(thiswep.ammo_field) > 0)
self.BUTTON_ATCK = bot_aim(1000000, 0, 1, false);
else
self.BUTTON_ATCK2 = bot_aim(WEP_CVAR_SEC(vaporizer, speed), 0, WEP_CVAR_SEC(vaporizer, lifetime), false); // WEAPONTODO: replace with proper vaporizer cvars
// ugly instagib hack to reuse the fire mode of the laser
makevectors(actor.v_angle);
- int oldwep = actor.weapon; // we can't avoid this hack
- actor.weapon = WEP_BLASTER.m_id;
+ Weapon oldwep = PS(actor).m_weapon; // we can't avoid this hack
+ PS(actor).m_weapon = WEP_BLASTER;
W_Blaster_Attack(
actor,
WEP_BLASTER.m_id | HITTYPE_SECONDARY,
WEP_CVAR_SEC(vaporizer, delay),
WEP_CVAR_SEC(vaporizer, lifetime)
);
- actor.weapon = oldwep;
+ PS(actor).m_weapon = oldwep;
// now do normal refire
weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, WEP_CVAR_SEC(vaporizer, animtime), w_ready);
else
actor.held_down = false;
}
- METHOD(Vaporizer, wr_init, void(entity thiswep))
- {
- //W_Blaster(WR_INIT); // Samual: Is this really the proper thing to do? Didn't we already run this previously?
- VAPORIZER_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
- }
METHOD(Vaporizer, wr_setup, void(entity thiswep))
{
- self.ammo_field = WEP_AMMO(VAPORIZER);
+ self.ammo_field = (thiswep.ammo_field);
self.vaporizer_lasthit = 0;
}
METHOD(Vaporizer, wr_checkammo1, bool(entity thiswep))
{
float vaporizer_ammo = ((g_instagib) ? 1 : WEP_CVAR_PRI(vaporizer, ammo));
- float ammo_amount = self.WEP_AMMO(VAPORIZER) >= vaporizer_ammo;
+ float ammo_amount = self.(thiswep.ammo_field) >= vaporizer_ammo;
ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= vaporizer_ammo;
return ammo_amount;
}
{
if(!WEP_CVAR_SEC(vaporizer, ammo))
return true;
- float ammo_amount = self.WEP_AMMO(VAPORIZER) >= WEP_CVAR_SEC(vaporizer, ammo);
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(vaporizer, ammo);
ammo_amount += self.(weapon_load[WEP_VAPORIZER.m_id]) >= WEP_CVAR_SEC(vaporizer, ammo);
return ammo_amount;
}
- METHOD(Vaporizer, wr_config, void(entity thiswep))
- {
- VAPORIZER_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
- }
METHOD(Vaporizer, wr_resetplayer, void(entity thiswep))
{
self.vaporizer_lasthit = 0;
/* wepimg */ ATTRIB(Vortex, model2, string, "weaponnex");
/* refname */ ATTRIB(Vortex, netname, string, "vortex");
/* wepname */ ATTRIB(Vortex, m_name, string, _("Vortex"));
+
+#define X(BEGIN, P, END, class, prefix) \
+ BEGIN(class) \
+ P(class, prefix, ammo, float, BOTH) \
+ P(class, prefix, animtime, float, BOTH) \
+ P(class, prefix, chargepool, float, SEC) \
+ P(class, prefix, chargepool_pause_regen, float, SEC) \
+ P(class, prefix, chargepool_regen, float, SEC) \
+ P(class, prefix, charge, float, NONE) \
+ P(class, prefix, charge_animlimit, float, NONE) \
+ P(class, prefix, charge_limit, float, NONE) \
+ P(class, prefix, charge_maxspeed, float, NONE) \
+ P(class, prefix, charge_mindmg, float, NONE) \
+ P(class, prefix, charge_minspeed, float, NONE) \
+ P(class, prefix, charge_rate, float, NONE) \
+ P(class, prefix, charge_rot_pause, float, NONE) \
+ P(class, prefix, charge_rot_rate, float, NONE) \
+ P(class, prefix, charge_shot_multiplier, float, NONE) \
+ P(class, prefix, charge_start, float, NONE) \
+ P(class, prefix, charge_velocity_rate, float, NONE) \
+ P(class, prefix, damagefalloff_forcehalflife, float, BOTH) \
+ P(class, prefix, damagefalloff_halflife, float, BOTH) \
+ P(class, prefix, damagefalloff_maxdist, float, BOTH) \
+ P(class, prefix, damagefalloff_mindist, float, BOTH) \
+ P(class, prefix, damage, float, BOTH) \
+ P(class, prefix, force, float, BOTH) \
+ P(class, prefix, refire, float, BOTH) \
+ P(class, prefix, secondary, float, NONE) \
+ P(class, prefix, reload_ammo, float, NONE) \
+ P(class, prefix, reload_time, float, NONE) \
+ P(class, prefix, switchdelay_raise, float, NONE) \
+ P(class, prefix, switchdelay_drop, float, NONE) \
+ P(class, prefix, weaponreplace, string, NONE) \
+ P(class, prefix, weaponstart, float, NONE) \
+ P(class, prefix, weaponstartoverride, float, NONE) \
+ P(class, prefix, weaponthrowable, float, NONE) \
+ END()
+ W_PROPS(X, Vortex, vortex)
+#undef X
+
ENDCLASS(Vortex)
-REGISTER_WEAPON(VORTEX, NEW(Vortex));
-
-#define VORTEX_SETTINGS(w_cvar,w_prop) VORTEX_SETTINGS_LIST(w_cvar, w_prop, VORTEX, vortex)
-#define VORTEX_SETTINGS_LIST(w_cvar,w_prop,id,sn) \
- w_cvar(id, sn, BOTH, ammo) \
- w_cvar(id, sn, BOTH, animtime) \
- w_cvar(id, sn, BOTH, damage) \
- w_cvar(id, sn, BOTH, force) \
- w_cvar(id, sn, BOTH, damagefalloff_mindist) \
- w_cvar(id, sn, BOTH, damagefalloff_maxdist) \
- w_cvar(id, sn, BOTH, damagefalloff_halflife) \
- w_cvar(id, sn, BOTH, damagefalloff_forcehalflife) \
- w_cvar(id, sn, BOTH, refire) \
- w_cvar(id, sn, NONE, charge) \
- w_cvar(id, sn, NONE, charge_mindmg) \
- w_cvar(id, sn, NONE, charge_shot_multiplier) \
- w_cvar(id, sn, NONE, charge_animlimit) \
- w_cvar(id, sn, NONE, charge_limit) \
- w_cvar(id, sn, NONE, charge_rate) \
- w_cvar(id, sn, NONE, charge_rot_rate) \
- w_cvar(id, sn, NONE, charge_rot_pause) \
- w_cvar(id, sn, NONE, charge_start) \
- w_cvar(id, sn, NONE, charge_minspeed) \
- w_cvar(id, sn, NONE, charge_maxspeed) \
- w_cvar(id, sn, NONE, charge_velocity_rate) \
- w_cvar(id, sn, NONE, secondary) \
- w_cvar(id, sn, SEC, chargepool) \
- w_cvar(id, sn, SEC, chargepool_regen) \
- w_cvar(id, sn, SEC, chargepool_pause_regen) \
- w_prop(id, sn, float, reloading_ammo, reload_ammo) \
- w_prop(id, sn, float, reloading_time, reload_time) \
- w_prop(id, sn, float, switchdelay_raise, switchdelay_raise) \
- w_prop(id, sn, float, switchdelay_drop, switchdelay_drop) \
- w_prop(id, sn, string, weaponreplace, weaponreplace) \
- w_prop(id, sn, float, weaponstart, weaponstart) \
- w_prop(id, sn, float, weaponstartoverride, weaponstartoverride) \
- w_prop(id, sn, float, weaponthrowable, weaponthrowable)
+REGISTER_WEAPON(VORTEX, vortex, NEW(Vortex));
+
#ifdef SVQC
-VORTEX_SETTINGS(WEP_ADD_CVAR, WEP_ADD_PROP)
.float vortex_lasthit;
#endif
{SELFPARAM();
// WEAPONTODO
float xyspeed = vlen(vec2(self.velocity));
- if (self.weapon == WEP_VORTEX.m_id && WEP_CVAR(vortex, charge) && WEP_CVAR(vortex, charge_velocity_rate) && xyspeed > WEP_CVAR(vortex, charge_minspeed))
+ if (PS(self).m_weapon == WEP_VORTEX && WEP_CVAR(vortex, charge) && WEP_CVAR(vortex, charge_velocity_rate) && xyspeed > WEP_CVAR(vortex, charge_minspeed))
{
// add a maximum of charge_velocity_rate when going fast (f = 1), gradually increasing from minspeed (f = 0) to maxspeed
xyspeed = min(xyspeed, WEP_CVAR(vortex, charge_maxspeed));
}
else
{
- dt = min(dt, (actor.WEP_AMMO(VORTEX) - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
+ dt = min(dt, (actor.(thiswep.ammo_field) - WEP_CVAR_PRI(vortex, ammo)) / WEP_CVAR_SEC(vortex, ammo));
dt = max(0, dt);
if(dt > 0)
{
- actor.WEP_AMMO(VORTEX) = max(WEP_CVAR_SEC(vortex, ammo), actor.WEP_AMMO(VORTEX) - WEP_CVAR_SEC(vortex, ammo) * dt);
+ actor.(thiswep.ammo_field) = max(WEP_CVAR_SEC(vortex, ammo), actor.(thiswep.ammo_field) - WEP_CVAR_SEC(vortex, ammo) * dt);
}
}
}
}
}
}
- METHOD(Vortex, wr_init, void(entity thiswep))
- {
- VORTEX_SETTINGS(WEP_SKIP_CVAR, WEP_SET_PROP);
- }
METHOD(Vortex, wr_setup, void(entity thiswep))
{
self.vortex_lasthit = 0;
}
METHOD(Vortex, wr_checkammo1, bool(entity thiswep))
{
- float ammo_amount = self.WEP_AMMO(VORTEX) >= WEP_CVAR_PRI(vortex, ammo);
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_PRI(vortex, ammo);
ammo_amount += (autocvar_g_balance_vortex_reload_ammo && self.(weapon_load[WEP_VORTEX.m_id]) >= WEP_CVAR_PRI(vortex, ammo));
return ammo_amount;
}
if(WEP_CVAR(vortex, secondary))
{
// don't allow charging if we don't have enough ammo
- float ammo_amount = self.WEP_AMMO(VORTEX) >= WEP_CVAR_SEC(vortex, ammo);
+ float ammo_amount = self.(thiswep.ammo_field) >= WEP_CVAR_SEC(vortex, ammo);
ammo_amount += self.(weapon_load[WEP_VORTEX.m_id]) >= WEP_CVAR_SEC(vortex, ammo);
return ammo_amount;
}
return false; // zoom is not a fire mode
}
}
- METHOD(Vortex, wr_config, void(entity thiswep))
- {
- VORTEX_SETTINGS(WEP_CONFIG_WRITE_CVARS, WEP_CONFIG_WRITE_PROPS);
- }
METHOD(Vortex, wr_resetplayer, void(entity thiswep))
{
if (WEP_CVAR(vortex, charge)) {
#endif
#ifdef CSQC
-float autocvar_g_balance_vortex_secondary = 0; // WEAPONTODO
METHOD(Vortex, wr_impacteffect, void(entity thiswep))
{
#include "../dpdefs/keycodes.qh"
#endif
+#include "macro.qh"
+
#include "warpzone/mathlib.qc"
#include "accumulate.qh"
.int al_len;
#define AL_NEW(this, n, default, T) \
- do \
+ MACRO_BEGIN \
{ \
ArrayList _al = this = new(ArrayList); \
make_pure(_al); \
const _AL_type__##T() it = default; \
AL_set##T(this, i, it); \
} \
- } \
- while (0)
+ } MACRO_END
#define AL_DELETE(this) \
- do \
+ MACRO_BEGIN \
{ \
buf_del(this.al_buf); \
remove(this); \
this = NULL; \
- } \
- while (0)
+ } MACRO_END
#define _AL_type__s() string
#define AL_gets(this, idx) bufstr_get(this.al_buf, idx)
#define AL_sete(this, idx, val) AL_setf(this, idx, etof(val))
#define AL_EACH(this, T, cond, body) \
- do \
+ MACRO_BEGIN \
{ \
const noref ArrayList _al = this; \
for (int i = 0, n = _al.al_len; i < n; ++i) \
const noref _AL_type__##T() it = AL_get##T(_al, i); \
if (cond) { body } \
} \
- } \
- while (0)
+ } MACRO_END
#endif
#if 0
// we don't need this
// darkplaces makes servercommandframe == 0 in these cases anyway
- if (getstatf(STAT_HEALTH) <= 0)
+ if (STAT(HEALTH) <= 0)
{
csqcplayer_moveframe = clientcommandframe;
getinputstate(csqcplayer_moveframe-1);
void CSQCPlayer_SetCamera()
{
const vector v0 = pmove_vel; // TRICK: pmove_vel is set by the engine when we get here. No need to network velocity
- const float vh = getstati(STAT_VIEWHEIGHT);
+ const float vh = STAT(VIEWHEIGHT);
const vector pl_viewofs = PL_VIEW_OFS;
const vector pl_viewofs_crouch = PL_CROUCH_VIEW_OFS;
const entity e = csqcplayer;
if (view.csqcmodel_teleported) refdefflags |= REFDEFFLAG_TELEPORTED;
if (input_buttons & BIT(1)) refdefflags |= REFDEFFLAG_JUMPING;
// note: these two only work in WIP2, but are harmless in WIP1
- if (getstati(STAT_HEALTH) <= 0) refdefflags |= REFDEFFLAG_DEAD;
+ if (STAT(HEALTH) <= 0) refdefflags |= REFDEFFLAG_DEAD;
if (intermission) refdefflags |= REFDEFFLAG_INTERMISSION;
V_CalcRefdef(view, refdefflags);
}
// translation helpers
string prvm_language;
+/**
+ * @deprecated prefer _("translated")
+ */
string language_filename(string s)
{
string fn = prvm_language;
#define ITER_H
#define FOREACH_ARRAY(arr, start, end, cond, body) \
- do \
+ MACRO_BEGIN \
{ \
for (int i = start; i < end; ++i) \
{ \
const noref entity it = arr[i]; \
- if (cond) { body } \
+ if (cond) { LAMBDA(body) } \
} \
- } \
- while (0)
+ } MACRO_END
#define FOREACH_LIST(list, next, cond, body) \
- do \
+ MACRO_BEGIN \
{ \
int i = 0; \
for (entity it = list##_first; it; (it = it.next, ++i)) \
{ \
- if (cond) { body } \
+ if (cond) { LAMBDA(body) } \
} \
- } \
- while (0)
+ } MACRO_END
#define FOREACH_WORD(words, cond, body) \
- do \
+ MACRO_BEGIN \
{ \
string _words = words; \
int i = 0; \
for (string _it; (_it = car(_words)); (_words = cdr(_words), ++i)) \
{ \
const noref string it = _it; \
- if (cond) { body } \
+ if (cond) { LAMBDA(body) } \
} \
- } \
- while (0)
+ } MACRO_END
#if defined(CSQC)
entity(.string fld, string match, .entity tofield) _findchainstring_tofield = #402;
.entity _FOREACH_ENTITY_next;
#define FOREACH_ENTITY_UNORDERED(cond, body) \
- do { \
+ MACRO_BEGIN { \
int i = 0; \
for (entity it = findchainentity_tofield(_FOREACH_ENTITY_fld, NULL, _FOREACH_ENTITY_next); it; (it = it._FOREACH_ENTITY_next, ++i)) \
{ \
- if (cond) { body } \
+ if (cond) { LAMBDA(body) } \
} \
- } \
- while (0)
+ } MACRO_END
#define FOREACH_ENTITY_ORDERED(cond, body) \
- do { \
+ MACRO_BEGIN { \
int i = 0; \
for (entity it = NULL; (it = nextent(it)); ++i) \
{ \
- if (cond) { body } \
+ if (cond) { LAMBDA(body) } \
} \
- } \
- while (0)
+ } MACRO_END
#define FOREACH_ENTITY_FLAGS(fld, flags, body) \
- do { \
+ MACRO_BEGIN { \
int i = 0; \
for (entity it = _findchainflags_tofield(fld, flags, _FOREACH_ENTITY_next); it; (it = it._FOREACH_ENTITY_next, ++i)) \
{ \
- body \
+ LAMBDA(body) \
} \
- } \
- while (0)
+ } MACRO_END
#define FOREACH_ENTITY_CLASS(class, cond, body) \
- do { \
+ MACRO_BEGIN { \
int i = 0; \
for (entity it = _findchainstring_tofield(classname, class, _FOREACH_ENTITY_next); it; (it = it._FOREACH_ENTITY_next, ++i)) \
{ \
- if (cond) { body } \
+ if (cond) { LAMBDA(body) } \
} \
- } \
- while (0)
+ } MACRO_END
#define FOREACH_ENTITY(cond, body) FOREACH_ENTITY_UNORDERED(cond, body)
#define LL_CLEAR(...) EVAL(OVERLOAD(LL_CLEAR, __VA_ARGS__))
#define LL_CLEAR_1(this) LL_CLEAR_2(this, LAMBDA())
#define LL_CLEAR_2(this, dtor) \
- do \
+ MACRO_BEGIN \
{ \
LinkedList _ll = this; \
assert(_ll); \
dtor \
remove(it); \
} \
- } \
- while (0)
+ } MACRO_END
#define LL_DELETE(...) EVAL(OVERLOAD(LL_DELETE, __VA_ARGS__))
#define LL_DELETE_1(this) LL_DELETE_2(this, LAMBDA())
#define LL_DELETE_2(this, dtor) \
- do \
+ MACRO_BEGIN \
{ \
LL_CLEAR(this, dtor); \
remove(this); \
this = NULL; \
- } \
- while (0)
+ } MACRO_END
#define LL_EACH(list, cond, body) \
- do \
+ MACRO_BEGIN \
{ \
noref int i = 0; \
for (entity _it = list.ll_head; _it; (_it = _it.ll_next, ++i)) \
noref entity it = _it.ll_data; \
if (cond) { body } \
} \
- } \
- while (0)
+ } MACRO_END
#endif
#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, ...) _assert(LOG_SEVERE, expr, __VA_ARGS__)
-#define ASSERT(expr, ...) _assert(LOG_FATAL, expr, __VA_ARGS__)
+#define assert_once(expr, ...) \
+ MACRO_BEGIN { \
+ static bool __once; \
+ if (!__once) \
+ { \
+ assert(expr, __VA_ARGS__); \
+ __once = true; \
+ } \
+ } MACRO_END
+#define demand(expr, ...) _assert(LOG_FATAL, expr, __VA_ARGS__)
#define _assert(f, expr, then) \
- do \
+ MACRO_BEGIN \
{ \
if (!(expr)) \
{ \
f("assertion failed: `" #expr "`\n"); \
then; \
} \
- } \
- while (0)
+ } MACRO_END
#define ASSERT_LESS(name, var, const) noref int name[(const - var + 1)];
-#define _LOG(f, level, s) f("[::"level "] ["__FILE__ ":%s:%.0f] %s", __FUNC__, __LINE__, s)
-#define LOG_FATAL(...) _LOG_FATAL(strcat("", __VA_ARGS__))
+#if defined(MENUQC)
+string(string...) strcat0n = #53;
+#else
+string(string...) strcat0n = #115;
+#endif
+
+#define _LOG(f, level, s) \
+ MACRO_BEGIN { \
+ f(sprintf("^9[::"level "^9] ["__FILE__ "^7:^9%s^7:^9%d] \n^7%s\n", __FUNC__, __LINE__, s)); \
+ } MACRO_END
+
+#define LOG_FATAL(...) _LOG_FATAL(strcat0n(__VA_ARGS__))
#define LOG_FATALF(...) _LOG_FATAL(sprintf(__VA_ARGS__))
-#define _LOG_FATAL(s) _LOG(_printferr, "FATAL", s)
+#define _LOG_FATAL(s) _LOG(error, "^1FATAL", s)
-#define LOG_SEVERE(...) _LOG_SEVERE(strcat("", __VA_ARGS__))
+#define LOG_SEVERE(...) _LOG_SEVERE(strcat0n(__VA_ARGS__))
#define LOG_SEVEREF(...) _LOG_SEVERE(sprintf(__VA_ARGS__))
-#define _LOG_SEVERE(s) _LOG(_printfbt, "SEVERE", s)
+#define _LOG_SEVERE(s) _LOG(backtrace, "^1SEVERE", s)
-#define LOG_WARNING(...) _LOG_WARNING(strcat("", __VA_ARGS__))
+#define LOG_WARNING(...) _LOG_WARNING(strcat0n(__VA_ARGS__))
#define LOG_WARNINGF(...) _LOG_WARNING(sprintf(__VA_ARGS__))
-#define _LOG_WARNING(s) _LOG(printf, "WARNING", s)
+#define _LOG_WARNING(s) _LOG(print, "^3WARNING", 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_INFO(...) _LOG_INFO(strcat0n(__VA_ARGS__))
+#define LOG_INFOF(...) _LOG_INFO(sprintf(__VA_ARGS__))
+#define _LOG_INFO(s) \
+ MACRO_BEGIN { \
+ string ___s = s; \
+ if (autocvar_developer) \
+ _LOG(print, "^5INFO", ___s); \
+ else \
+ print(___s); \
+ } MACRO_END
-#define LOG_TRACE(...) _LOG_TRACE(strcat("", __VA_ARGS__))
+#define LOG_TRACE(...) _LOG_TRACE(strcat0n(__VA_ARGS__))
#define LOG_TRACEF(...) _LOG_TRACE(sprintf(__VA_ARGS__))
-#define _LOG_TRACE(s) _LOG(dprintf, "TRACE", s)
+#define _LOG_TRACE(s) _LOG(dprint, "^6TRACE", s)
-#define LOG_DEBUG(...) _LOG_DEBUG(strcat("", __VA_ARGS__))
+#define LOG_DEBUG(...) _LOG_DEBUG(strcat0n(__VA_ARGS__))
#define LOG_DEBUGF(...) _LOG_DEBUG(sprintf(__VA_ARGS__))
-#define _LOG_DEBUG(s) _LOG(_dprintf2, "DEBUG", s)
+#define _LOG_DEBUG(s) _LOG(dprint2, "^2DEBUG", s)
+
+#define dprint2(msg) \
+ MACRO_BEGIN { \
+ if (autocvar_developer > 1) dprint(msg); \
+ } MACRO_END
// TODO: this sucks, lets find a better way to do backtraces?
#ifdef SVQC
noref int autocvar_developer;
noref bool autocvar_prvm_backtraceforwarnings;
+#ifdef SVQC
+#define bt_cvar_set(cvar, value) builtin_cvar_set(cvar, value)
+#else
+#define bt_cvar_set(cvar, value) cvar_set(cvar, value)
+#endif
+
#define backtrace(msg) \
- do \
+ MACRO_BEGIN \
{ \
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"); \
+ bt_cvar_set("developer", "1"); \
+ bt_cvar_set("prvm_backtraceforwarnings", "1"); \
+ print("\n--- CUT HERE ---\n", msg); \
_backtrace(); \
print("\n--- CUT UNTIL HERE ---\n"); \
- cvar_set("developer", ftos(dev)); \
- cvar_set("prvm_backtraceforwarnings", ftos(war)); \
- } \
- while (0)
+ bt_cvar_set("developer", ftos(dev)); \
+ bt_cvar_set("prvm_backtraceforwarnings", ftos(war)); \
+ } MACRO_END
#endif
--- /dev/null
+#ifndef MACRO_H
+#define MACRO_H
+
+#if 1
+ void voidfunc() { error("voidfunc"); }
+ #define MACRO_BEGIN if (1) {
+ #define MACRO_END } else voidfunc()
+#else
+ #define MACRO_BEGIN do {
+ #define MACRO_END } while (0)
+#endif
+
+#define _CAT(a, b) a ## b
+#define CAT(a, b) _CAT(a, b)
+
+#endif
// already defined
#endif
-#undef etof
-// avoid bounds checks
-#define etof(e) stof(sprintf("%i", e))
-
#define GET(name) name##get
#define GETTER(type, name) type GET(name)() { return name; }
#define PROPERTY(type, name) type name; GETTER(type, name)
// With block may not contain continue or break
#define WITH(type, name, value, block) \
- do \
+ MACRO_BEGIN \
{ \
type __with_save = (name); \
name = (value); \
LAMBDA(block) \
name = __with_save; \
- } \
- while (0)
+ } MACRO_END
#endif
#ifdef CSQC
#define Net_Accept(classname) \
- do \
+ MACRO_BEGIN \
{ \
if (!this) this = new(classname); \
- } \
- while (0)
+ } MACRO_END
#define Net_Reject() \
- do \
+ MACRO_BEGIN \
{ \
if (this) remove(this); \
- } \
- while (0)
+ } MACRO_END
#define NET_HANDLE(id, param) \
bool Net_Handle_##id(entity this, param)
#else
#define WriteHeader(to, id) \
- do \
+ MACRO_BEGIN \
{ \
if (NET_##id##_istemp) WriteByte(to, SVC_TEMPENTITY); \
WriteByte(to, NET_##id.m_id); \
- } \
- while (0)
+ } MACRO_END
#endif
#ifdef CSQC
#define APPROXPASTTIME_MAX (16384 * APPROXPASTTIME_ACCURACY_REQUIREMENT)
#define APPROXPASTTIME_RANGE (64 * APPROXPASTTIME_ACCURACY_REQUIREMENT)
+ #if defined(CSQC)
+ #define Read_float() ReadFloat()
+ #define Read_int() ReadInt24_t()
+ #define Read_string() ReadString()
+ #elif defined(SVQC)
+ #define Write_float(to, f) WriteFloat(to, f)
+ #define Write_int(to, f) WriteInt24_t(to, f)
+ #define Write_string(to, f) WriteString(to, f)
+ #endif
+
#ifdef CSQC
+ #define ReadRegistry(r) r##_from(ReadByte())
+
entity ReadCSQCEntity()
{
int f = ReadShort();
return v;
}
+ int _ReadSByte;
+ #define ReadSByte() (_ReadSByte = ReadByte(), (_ReadSByte & BIT(7) ? -128 : 0) + (_ReadSByte & BITS(7)))
#define ReadFloat() ReadCoord()
vector ReadVector() { vector v; v.x = ReadFloat(); v.y = ReadFloat(); v.z = ReadFloat(); return v; }
vector ReadVector2D() { vector v; v.x = ReadFloat(); v.y = ReadFloat(); v.z = 0; return v; }
#else
const int MSG_ENTITY = 5;
+ #define WriteRegistry(r, to, it) WriteByte(to, it.m_id)
+
void WriteInt24_t(float dst, float val)
{
float v;
}
#define WriteFloat(to, f) WriteCoord(to, f)
- #define WriteVector(to, v) do { WriteFloat(to, v.x); WriteFloat(to, v.y); WriteFloat(to, v.z); } while (0)
- #define WriteVector2D(to, v) do { WriteFloat(to, v.x); WriteFloat(to, v.y); } while (0)
+ #define WriteVector(to, v) MACRO_BEGIN { WriteFloat(to, v.x); WriteFloat(to, v.y); WriteFloat(to, v.z); } MACRO_END
+ #define WriteVector2D(to, v) MACRO_BEGIN { WriteFloat(to, v.x); WriteFloat(to, v.y); } MACRO_END
// this will use the value:
// 128
if (msg_entity == varname || (msg_entity.classname == STR_SPECTATOR && msg_entity.enemy == varname)) \
statement msg_entity = varname
#define WRITESPECTATABLE_MSG_ONE(statement) \
- do \
+ MACRO_BEGIN \
{ \
WRITESPECTATABLE_MSG_ONE_VARNAME(oldmsg_entity, statement); \
- } \
- while (0)
+ } MACRO_END
#define WRITESPECTATABLE(msg, statement) \
if (msg == MSG_ONE) WRITESPECTATABLE_MSG_ONE(statement); \
else \
.vector origin;
.bool pure_data;
#define make_pure(e) \
- do \
+ MACRO_BEGIN \
{ \
(e).pure_data = true; \
- } \
- while (0)
+ } MACRO_END
#define make_impure(e) \
- do \
+ MACRO_BEGIN \
{ \
(e).pure_data = false; \
- } \
- while (0)
+ } MACRO_END
#define is_pure(e) ((e).pure_data)
.string classname;
spawn##base##_1(this); \
}
-#define METHOD(cname, name, prototype) \
- class(cname).prototype name; \
- prototype cname##_##name; \
+#define METHOD_REFERENCE(cname, name) \
+ cname##_##name
+
+#define STATIC_METHOD(cname, name, prototype) \
+ prototype METHOD_REFERENCE(cname, name)
+
+#define METHOD(cname, name, prototype) \
+ STATIC_METHOD(cname, name, prototype); \
+ class(cname) .prototype name; \
INIT_STATIC(cname) \
{ \
- this.name = cname##_##name; \
+ this.name = METHOD_REFERENCE(cname, name); \
} \
- prototype cname##_##name
+ STATIC_METHOD(cname, name, prototype)
#define ATTRIB(cname, name, type, val) \
class(cname).type name; \
ACCUMULATE_FUNCTION(Register##registry, Register_##id) \
REGISTER_INIT(id)
-#define REGISTRY_PUSH(registry, fld, it) do { \
+#define REGISTRY_PUSH(registry, fld, it) MACRO_BEGIN { \
it.fld = registry##_COUNT; \
_R_SET(_##registry, registry##_COUNT, it); \
++registry##_COUNT; \
if (!registry##_first) registry##_first = it; \
if (registry##_last) registry##_last.REGISTRY_NEXT = it; \
registry##_last = it; \
-} while (0)
+} MACRO_END
-#define REGISTRY_RESERVE(registry, fld, id, suffix) do { \
+#define REGISTRY_RESERVE(registry, fld, id, suffix) MACRO_BEGIN { \
entity e = new(registry_reserved); \
make_pure(e); \
e.registered_id = #id "/" #suffix; \
REGISTRY_PUSH(registry, fld, e); \
-} while (0)
+} MACRO_END
#define REGISTER_INIT(id) [[accumulate]] void Register_##id##_init(entity this)
#define REGISTER_INIT_POST(id) [[accumulate]] void Register_##id##_init_post(entity this)
void heapsort(int n, swapfunc_t swap, comparefunc_t cmp, entity pass)
{
#define heapify(_count) \
- do \
+ MACRO_BEGIN \
{ \
for (int start = floor(((_count) - 2) / 2); start >= 0; --start) \
{ \
siftdown(start, (_count) - 1); \
} \
- } \
- while (0)
+ } MACRO_END
#define siftdown(_start, _end) \
- do \
+ MACRO_BEGIN \
{ \
for (int root = (_start); root * 2 + 1 <= (_end); ) \
{ \
swap(root, child, pass); \
root = child; \
} \
- } \
- while (0)
+ } MACRO_END
heapify(n);
int end = n - 1;
#define _spawnfunc_check(fld) \
if (fieldname == #fld) continue;
+ noref entity __spawnfunc_expect;
bool __spawnfunc_unreachable_workaround = true;
#define spawnfunc_1(id) spawnfunc_2(id, FIELDS_UNION)
void __spawnfunc_##id(entity this); \
[[accumulate]] void spawnfunc_##id(entity this) \
{ \
- this = self; \
+ if (self == __spawnfunc_expect) \
+ { \
+ /* engine call */ \
+ __spawnfunc_expect = NULL; \
+ this = self; \
+ } \
+ else \
+ { \
+ assert(this); \
+ } \
if (!this.sourceLocFile) \
{ \
this.sourceLocFile = __FILE__; \
#define _STAT(id) g_stat_##id
#define REGISTER_STAT_2(id, T) \
T _STAT(id); \
+ T CAT(_STAT(id), _prev); \
REGISTER(Stats, STAT_##id, m_id, new(stat)) \
{ \
make_pure(this); \
} \
[[accumulate]] void stats_get() \
{ \
- _STAT(id) = getstat_##T(STAT_##id.m_id); \
+ T it = getstat_##T(STAT_##id.m_id); \
+ if (it != CAT(_STAT(id), _prev)) \
+ CAT(_STAT(id), _prev) = _STAT(id) = it; \
}
#define REGISTER_STAT_3(x, T, expr) REGISTER_STAT(x, T)
#elif defined(SVQC)
#define addstat_int(id, fld) addstat(id, AS_INT, fld)
#define addstat_bool(id, fld) addstat(id, AS_INT, fld)
#define addstat_float(id, fld) addstat(id, AS_FLOAT, fld)
- #define addstat_vector(id, fld) do { \
+ #define addstat_vector(id, fld) MACRO_BEGIN { \
addstat_float(id + 0, fld##_x); \
addstat_float(id + 1, fld##_y); \
addstat_float(id + 2, fld##_z); \
- } while (0)
- #define addstat_vectori(id, fld) do { \
+ } MACRO_END
+ #define addstat_vectori(id, fld) MACRO_BEGIN { \
addstat_int(id + 0, fld##_x); \
addstat_int(id + 1, fld##_y); \
addstat_int(id + 2, fld##_z); \
- } while (0)
+ } MACRO_END
const int AS_STRING = 1;
const int AS_INT = 2;
const int AS_FLOAT = 8;
return substring(s, o + 1, strlen(s) - (o + 1));
}
+string cons(string a, string b)
+{
+ if (a == "") return b;
+ if (b == "") return a;
+ return strcat(a, " ", b);
+}
+
string substring_range(string s, float b, float e)
{
return substring(s, b, e - b);
#define TEST_H
#define TEST_Check(cond) \
- do \
+ MACRO_BEGIN \
{ \
if (!(cond)) TEST_Fail( #cond); \
- } \
- while (0)
+ } MACRO_END
void TEST_OK();
void TEST_Fail(string cond);
#define reinterpret_cast(T, it) _unsafe_cast_##T(0, it)
#define X(T) T _unsafe_cast_##T(int dummy, ...) { return ...(0, T); }
+X(bool)
+X(int)
X(float)
X(entity)
X(string)
X(rawfunc)
#undef X
-#define strid(s) etof(reinterpret_cast(entity, s))
+#define strid(s) ITOF(reinterpret_cast(int, s))
+
+.int _unsafe_fld1, _unsafe_fld2;
+int INTEGER_ONE;
+
+#define FTOI(f) ((f) * INTEGER_ONE)
+#define ITOF(i) ((i) / INTEGER_ONE)
+
+STATIC_INIT(INTEGER_ONE)
+{
+ INTEGER_ONE = reinterpret_cast(int, _unsafe_fld2) - reinterpret_cast(int, _unsafe_fld1);
+}
#endif
#define YAW(v) ((v).y)
#define ROLL(v) ((v).z)
-#define MAKEVECTORS(f, angles, forward, right, up) do { \
+#define MAKEVECTORS(f, angles, forward, right, up) MACRO_BEGIN { \
f(angles); \
forward = v_forward; \
right = v_right; \
up = v_up; \
-} while (0)
+} MACRO_END
noref vector _vec2;
#define vec2(v) (_vec2 = (v), _vec2.z = 0, _vec2)
float draw_alpha;
void draw_reset(float cw, float ch, float ox, float oy);
-#define draw_beginBoldFont() do { drawfont = FONT_USER + 3; } while (0)
-#define draw_endBoldFont() do { drawfont = FONT_USER + 0; } while (0)
+#define draw_beginBoldFont() MACRO_BEGIN { drawfont = FONT_USER + 3; } MACRO_END
+#define draw_endBoldFont() MACRO_BEGIN { drawfont = FONT_USER + 0; } MACRO_END
void draw_setMousePointer(string pic, vector theSize, vector theOffset);
void draw_drawMousePointer(vector where);
if (cvar_string("menu_skin") != "")
{
draw_currentSkin = strcat("gfx/menu/", cvar_string("menu_skin"));
- fh = fopen(language_filename(strcat(draw_currentSkin, "/skinvalues.txt")), FILE_READ);
+ fh = fopen(strcat(draw_currentSkin, "/skinvalues.txt"), FILE_READ);
}
if (fh < 0 && cvar_defstring("menu_skin") != "")
{
cvar_set("menu_skin", cvar_defstring("menu_skin"));
draw_currentSkin = strcat("gfx/menu/", cvar_string("menu_skin"));
- fh = fopen(language_filename(strcat(draw_currentSkin, "/skinvalues.txt")), FILE_READ);
+ fh = fopen(strcat(draw_currentSkin, "/skinvalues.txt"), FILE_READ);
}
if (fh < 0)
{
draw_currentSkin = "gfx/menu/default";
- fh = fopen(language_filename(strcat(draw_currentSkin, "/skinvalues.txt")), FILE_READ);
+ fh = fopen(strcat(draw_currentSkin, "/skinvalues.txt"), FILE_READ);
}
if (fh < 0) error("cannot load any menu skin\n");
draw_currentSkin = strzone(draw_currentSkin);
+++ /dev/null
-../../menu.dat
-progs.inc
#ifndef CREDITS_H
#define CREDITS_H
+
+#define CREDITS(TITLE, FUNCTION, PERSON, PERSON_, NL) \
+ TITLE(_("Core Team")) \
+ PERSON(Rudolf "divVerent" Polzer) \
+ PERSON(Ant "Antibody" Zucaro) \
+ PERSON(Marvin "Mirio" Beck) \
+ PERSON(Merlijn Hofstra) \
+ PERSON(Peter "Morphed" Pielak) \
+ PERSON(Ruszkai "CuBe0wL" Ákos) \
+ PERSON(Samual "Ares" Lenks) \
+ PERSON(TimePath) \
+ PERSON(Tyler "-z-" Mulligan) \
+ PERSON(Zac "Mario" Jardine) \
+ NL() \
+ TITLE(_("Extended Team")) \
+ PERSON(Antonio "terencehill" Piu) \
+ PERSON(Archer) \
+ PERSON(BuddyFriendGuy) \
+ PERSON(Debugger) \
+ PERSON(GATTS) \
+ PERSON(Halogene) \
+ PERSON(IDWMaster) \
+ PERSON(Jan "zykure" Behrens) \
+ PERSON(JH0nny) \
+ PERSON(Luigi) \
+ PERSON(Łukasz "kuniu the frogg" Polek) \
+ PERSON(Matthias "matthiaskrgr" Krüger) \
+ PERSON(Mattia "Melanosuchus" Basaglia) \
+ PERSON(MrBougo) \
+ PERSON(Nick "bitbomb" Lucca) \
+ PERSON(nilyt/nyov) \
+ PERSON(Nitroxis) \
+ PERSON(packer) \
+ PERSON(Pearce "theShadow" Michal) \
+ PERSON(Rasmus "FruitieX" Eskola) \
+ PERSON(s1lence) \
+ PERSON(Severin "sev" Meyer) \
+ PERSON(Soelen) \
+ PERSON(Sydes) \
+ PERSON(unfa) \
+ NL() \
+ NL() \
+ FUNCTION(_("Website")) \
+ PERSON(Ant "Antibody" Zucaro (web)) \
+ PERSON(Merlijn Hofstra) \
+ PERSON(Tyler "-z-" Mulligan (web / game)) \
+ NL() \
+ FUNCTION(_("Stats")) \
+ PERSON(Ant "Antibody" Zucaro) \
+ PERSON(Jan "zykure" Behrens) \
+ NL() \
+ FUNCTION(_("Art")) \
+ PERSON(Severin "sev" Meyer) \
+ PERSON(Sahil "DiaboliK" Singhal) \
+ PERSON(Peter "Morphed" Pielak) \
+ PERSON(Sam "LJFHutch" Hutchinson) \
+ PERSON(Pearce "theShadow" Michal) \
+ NL() \
+ FUNCTION(_("Animation")) \
+ PERSON(Sahil "DiaboliK" Singhal) \
+ PERSON(nifrek) \
+ NL() \
+ FUNCTION(_("Level Design")) \
+ PERSON(Amadeusz "amade/proraide" Sławiński) \
+ PERSON(Ben "MooKow" Banker) \
+ PERSON(Calinou) \
+ PERSON(Cortez) \
+ PERSON(Cuinn "Cuinnton" Herrick) \
+ PERSON(Debugger) \
+ PERSON(Jakob "tZork" Markström Gröhn) \
+ PERSON(Konrad "Justin" Slawinski) \
+ PERSON(Maddin) \
+ PERSON(L0) \
+ PERSON(Łukasz "kuniu the frogg" Polek) \
+ PERSON(Maik "SavageX" Merten) \
+ PERSON(Marvin "Mirio" Beck) \
+ PERSON(MintOX) \
+ PERSON(packer) \
+ PERSON(Pearce "theShadow" Michal) \
+ PERSON(Rasmus "FruitieX" Eskola) \
+ PERSON(Ruszkai "CuBe0wL" Ákos) \
+ PERSON(Severin "sev" Meyer) \
+ PERSON(ShadoW) \
+ NL() \
+ FUNCTION(_("Music / Sound FX")) \
+ PERSON(AquaNova (Archer)) \
+ PERSON(blkrbt) \
+ PERSON(chooksta) \
+ PERSON(Independent.nu) \
+ PERSON([master]mind) \
+ PERSON(Merlijn Hofstra) \
+ PERSON(Mick Rippon) \
+ PERSON(Nick "bitbomb" Lucca) \
+ PERSON(remaxim) \
+ PERSON(Saulo "mand1nga" Gil) \
+ PERSON({SC0RP} - Ian "ID" Dorrell) \
+ PERSON(Stephan) \
+ PERSON(unfa) \
+ NL() \
+ FUNCTION(_("Game Code")) \
+ PERSON(Samual "Ares" Lenks) \
+ PERSON(Rudolf "divVerent" Polzer) \
+ PERSON(Jakob "tZork" Markström Gröhn) \
+ PERSON(Rasmus "FruitieX" Eskola) \
+ PERSON(TimePath) \
+ PERSON(Zac "Mario" Jardine) \
+ NL() \
+ FUNCTION(_("Marketing / PR")) \
+ PERSON(Tyler "-z-" Mulligan) \
+ PERSON(Ruszkai "CuBe0wL" Ákos) \
+ PERSON(Samual "Ares" Lenks) \
+ PERSON(Saulo "mand1nga" Gil) \
+ NL() \
+ FUNCTION(_("Legal")) \
+ PERSON(Rudolf "divVerent" Polzer) \
+ PERSON(Merlijn Hofstra) \
+ NL() \
+ NL() \
+ TITLE(_("Game Engine")) \
+ FUNCTION(_("DarkPlaces")) \
+ PERSON(Forest "LordHavoc" Hale) \
+ NL() \
+ FUNCTION(_("Engine Additions")) \
+ PERSON(Rudolf "divVerent" Polzer) \
+ PERSON(Samual "Ares" Lenks) \
+ NL() \
+ NL() \
+ TITLE(_("Compiler")) \
+ FUNCTION(_("GMQCC")) \
+ PERSON(Wolfgang "Blub\0" Bumiller) \
+ PERSON(Dale "graphitemaster" Weiler) \
+ NL() \
+ NL() \
+ TITLE(_("Other Active Contributors")) \
+ PERSON(Erik "Ablu" Schilling) \
+ PERSON(Mircea "Taoki" Kitsune) \
+ PERSON(Penguinum) \
+ NL() \
+ NL() \
+ TITLE(_("Translators")) \
+ NL() \
+ FUNCTION(_("Asturian")) \
+ PERSON(Llumex03) \
+ PERSON(Tornes "Tornes.Llume" Ḷḷume) \
+ PERSON(Ximielga) \
+ NL() \
+ FUNCTION(_("Belarusian")) \
+ PERSON(Mihail "meequz" Varantsou) \
+ NL() \
+ FUNCTION(_("Bulgarian")) \
+ PERSON(lokster) \
+ PERSON(set_killer) \
+ NL() \
+ FUNCTION(_("Chinese (China)")) \
+ PERSON(Antonidas) \
+ PERSON(kalawore) \
+ PERSON(sapphireliu) \
+ NL() \
+ FUNCTION(_("Czech")) \
+ PERSON(shogun assassin/woky) \
+ PERSON(Superovoce) \
+ PERSON(Tomáš "CZHeron" Volavka) \
+ NL() \
+ FUNCTION(_("Dutch")) \
+ PERSON(Alexander "freefang" van Dam) \
+ PERSON(PinkRobot) \
+ PERSON(vegiburger) \
+ NL() \
+ FUNCTION(_("English (Australia)")) \
+ PERSON(Laurene "sunflowers" Albrand) \
+ PERSON(Zac "Mario" Jardine) \
+ NL() \
+ FUNCTION(_("Finnish")) \
+ PERSON(Henry "Exitium" Sanmark) \
+ PERSON(Rasmus "FruitieX" Eskola) \
+ NL() \
+ FUNCTION(_("French")) \
+ PERSON(Calinou) \
+ PERSON(Maxime "Taximus" Paradis) \
+ PERSON(RedGuff) \
+ PERSON(Yannick "SpiKe" Le Guen) \
+ NL() \
+ FUNCTION(_("German")) \
+ PERSON(Brot) \
+ PERSON(cvcxc) \
+ PERSON(Erik "Ablu" Schilling) \
+ PERSON(Jope "Sless" Withers) \
+ PERSON(Marvin "Mirio" Beck) \
+ PERSON(Rudolf "divVerent" Polzer) \
+ PERSON(Yepoleb) \
+ NL() \
+ FUNCTION(_("Greek")) \
+ PERSON_("Γιάννης \"Evropi\" Ανθυμίδης") \
+ PERSON(Konstantinos "LDinos" Mihalenas) \
+ PERSON(Savoritias) \
+ PERSON(Vindex) \
+ NL() \
+ FUNCTION(_("Hungarian")) \
+ PERSON(Ruszkai "CuBe0wL" Ákos) \
+ PERSON(xaN1C4n3) \
+ NL() \
+ FUNCTION(_("Italian")) \
+ PERSON(Antonio "terencehill" Piu) \
+ PERSON(Felice "MaidenBeast" Sallustio) \
+ PERSON(stdi) \
+ PERSON(XCostaX) \
+ NL() \
+ FUNCTION(_("Polish")) \
+ PERSON(4m) \
+ PERSON(Alex "tiprogrammierer.alex" Progger) \
+ PERSON(Amadeusz "amade/proraide" Sławiński) \
+ NL() \
+ FUNCTION(_("Portuguese")) \
+ PERSON(Ricardo Manuel "Hellgardia" da Cruz Coelho da Silva) \
+ PERSON(xXxCHAOTICxXx) \
+ NL() \
+ FUNCTION(_("Romanian")) \
+ PERSON(Adrian-Ciprian "adrian.tinjala" Tînjală) \
+ PERSON(BusterDBK) \
+ PERSON(Mircea "Taoki" Kitsune) \
+ PERSON(Tudor "TropiKo" Ionel) \
+ NL() \
+ FUNCTION(_("Russian")) \
+ PERSON(Alex "alextalker7" Talker) \
+ PERSON(Alexandr "zrg") \
+ PERSON(Andrei "adem4ik" Stepanov) \
+ PERSON(gravicappa) \
+ PERSON(Hot Dog) \
+ PERSON(Lord Canistra) \
+ PERSON(Nikoli) \
+ PERSON(Sergej "Clearness High" Lutsyk) \
+ NL() \
+ FUNCTION(_("Serbian")) \
+ PERSON_("Саша \"salepetronije\" Петровић") \
+ PERSON(Pendulla) \
+ PERSON(Rafael "Ristovski") \
+ NL() \
+ FUNCTION(_("Spanish")) \
+ PERSON_("0000simon") \
+ PERSON(Alan "aagp" Garcia) \
+ PERSON(Ari_tent) \
+ PERSON(brunodeleo) \
+ PERSON(Kammy) \
+ PERSON(roader_gentoo) \
+ PERSON(Rodrigo Mouton Laudin) \
+ PERSON(SouL) \
+ NL() \
+ FUNCTION(_("Swedish")) \
+ PERSON(Karl-Oskar "machine" Rikås) \
+ PERSON(marcus256) \
+ NL() \
+ FUNCTION(_("Ukrainian")) \
+ PERSON(Oleh "BlaXpirit" Prypin) \
+ PERSON(Vasyl "Harmata" Melnyk) \
+ PERSON(Yuriy "herrniemand" Ackermann) \
+ NL() \
+ NL() \
+ TITLE(_("Past Contributors")) \
+ PERSON(Akari) \
+ PERSON(Alexander "naryl" Suhoverhov) \
+ PERSON(Alexander "motorsep" Zubov) \
+ PERSON(Amos "torus" Dudley) \
+ PERSON(Andreas "Black" Kirsch) \
+ PERSON(Attila "WW3" Houtkooper) \
+ PERSON(BigMac) \
+ PERSON(Braden "meoblast001" Walters) \
+ PERSON(Brain Younds) \
+ PERSON(Chris "amethyst7" Matz) \
+ PERSON(Christian Ice) \
+ PERSON(Clinton "Kaziganthe" Freeman) \
+ PERSON(Dan "Digger" Korostelev) \
+ PERSON(Dan "Wazat" Hale) \
+ PERSON(Dokujisan) \
+ PERSON(Donkey) \
+ PERSON(dstrek) \
+ PERSON(Dustin Geeraert) \
+ PERSON(Edgenetwork) \
+ PERSON(Edward "Ed" Holness) \
+ PERSON(Eric "Munyul Verminard" Sambach) \
+ PERSON(Fabien "H. Reaper" Tschirhart) \
+ PERSON(Florian Paul "lda17h" Schmidt) \
+ PERSON(FrikaC) \
+ PERSON(Garth "Zombie" Hendy) \
+ PERSON(Gerd "Elysis" Raudenbusch) \
+ PERSON(Gottfried "Toddd" Hofmann) \
+ PERSON(Henning "Tymo" Janssen) \
+ PERSON(Innovati) \
+ PERSON(Jitspoe) \
+ PERSON(Jody Gallagher) \
+ PERSON(Jope "Sless" Withers) \
+ PERSON(Juergen "LowDragon" Timm) \
+ PERSON(KadaverJack) \
+ PERSON(Kevin "Tyrann" Shanahan) \
+ PERSON(Kristian "morfar" Johansson) \
+ PERSON(Kurt Dereli) \
+ PERSON(lcatlnx) \
+ PERSON(Lee David Ash) \
+ PERSON(Lee Vermeulen) \
+ PERSON(leileilol) \
+ PERSON(magorian) \
+ PERSON(Marius "GreEn`mArine" Shekow) \
+ PERSON(Marko "Urre" Permanto) \
+ PERSON(Mathieu "Elric" Olivier) \
+ PERSON(Mattrew "Tronyn" Rye) \
+ PERSON(MauveBib) \
+ PERSON(Mephisto) \
+ PERSON(michaelb) \
+ PERSON(Michael "Tenshihan" Quinn) \
+ PERSON(Mepper) \
+ PERSON(Munyul) \
+ PERSON(Netzwerg) \
+ PERSON(NoelCower) \
+ PERSON(Parapraxis) \
+ PERSON(parasti) \
+ PERSON(Paul "Strahlemann" Evers) \
+ PERSON(Paul Scott) \
+ PERSON(Petithomme) \
+ PERSON(PlasmaSheep) \
+ PERSON(Przemysław "atheros" Grzywacz) \
+ PERSON(Q1 Retexturing Project) \
+ PERSON(Qantourisc) \
+ PERSON(Oleh "BlaXpirit" Prypin) \
+ PERSON(Rick "Rat" Kelley) \
+ PERSON(Robert "ai" Kuroto) \
+ PERSON(Ronan) \
+ PERSON(Sajt) \
+ PERSON(Saulo "mand1nga" Gil) \
+ PERSON(Shaggy) \
+ PERSON(Shank) \
+ PERSON(Simon O’Callaghan) \
+ PERSON(SomeGuy) \
+ PERSON(SoulKeeper_p) \
+ PERSON(Spike) \
+ PERSON(Spirit) \
+ PERSON(Stephan "esteel" Stahl) \
+ PERSON(Steve Vermeulen) \
+ PERSON(Supajoe) \
+ PERSON(Tei) \
+ PERSON(The player with the unnecessarily long name) \
+ PERSON(Tomaz) \
+ PERSON(Ulrich Galbraith) \
+ PERSON(Vortex) \
+ PERSON(William Libert) \
+ PERSON(William "Willis" Weilep) \
+ PERSON(Yves "EviLair" Allaire) \
+ PERSON(Zenex) \
+ /**/
+
+int credits_get()
+{
+ int n = buf_create();
+ #define CREDITS_TITLE(t) bufstr_add(n, strcat("**", t), 0);
+ #define CREDITS_FUNCTION(f) bufstr_add(n, strcat("*", f), 0);
+ #define CREDITS_PERSON(p) bufstr_add(n, p, 0);
+ #define _CREDITS_PERSON(p) CREDITS_PERSON(#p)
+ #define CREDITS_NL() bufstr_add(n, "", 0);
+ CREDITS(CREDITS_TITLE, CREDITS_FUNCTION, _CREDITS_PERSON, CREDITS_PERSON, CREDITS_NL)
+ #undef CREDITS_TITLE
+ #undef CREDITS_FUNCTION
+ #undef CREDITS_PERSON
+ #undef _CREDITS_PERSON
+ #undef CREDITS_NL
+ return n;
+}
+
+#undef CREDITS
+
#include "listbox.qc"
CLASS(XonoticCreditsList, XonoticListBox)
METHOD(XonoticCreditsList, configureXonoticCreditsList, void(entity));
void XonoticCreditsList_configureXonoticCreditsList(entity me)
{
me.configureXonoticListBox(me);
- // load the file
- me.bufferIndex = buf_load(language_filename("xonotic-credits.txt"));
+ me.bufferIndex = credits_get();
me.nItems = buf_getsize(me.bufferIndex);
}
void XonoticCreditsList_destroy(entity me)
{
Xonotic_KeyBinds_Count = 0;
- #define KEYBIND_DEF(func, desc) do { \
+ #define KEYBIND_DEF(func, desc) MACRO_BEGIN { \
if((Xonotic_KeyBinds_Count < MAX_KEYBINDS)) { \
Xonotic_KeyBinds_Functions[Xonotic_KeyBinds_Count] = strzone(func); \
Xonotic_KeyBinds_Descriptions[Xonotic_KeyBinds_Count] = strzone(desc); \
++Xonotic_KeyBinds_Count; \
} \
- } while(0)
+ } MACRO_END
KEYBIND_DEF("" , _("Moving"));
KEYBIND_DEF("+forward" , _("forward"));
bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_PREVIEW, "nopreview_menuskin");
else
bufstr_set(buf, i * SKINPARM_COUNT + SKINPARM_PREVIEW, strcat("/gfx/menu/", substring(s, 9, strlen(s) - 24), "/skinpreview"));
- fh = fopen(language_filename(s), FILE_READ);
+ fh = fopen(s, FILE_READ);
if(fh < 0)
{
LOG_INFO("Warning: can't open skinvalues.txt file\n");
#define IS_VEHICLE(v) (v.vehicle_flags & VHF_ISVEHICLE)
#define IS_TURRET(v) (v.turret_flags & TUR_FLAG_ISTURRET)
-#define FOR_EACH_CLIENTSLOT(v) for (v = world; (v = nextent(v)) && (num_for_edict(v) <= maxclients); )
+#define FOR_EACH_CLIENTSLOT(v) for (v = world; (v = nextent(v)) && (etof(v) <= maxclients); )
#define FOR_EACH_CLIENT(v) FOR_EACH_CLIENTSLOT(v) if (IS_CLIENT(v))
#define FOR_EACH_REALCLIENT(v) FOR_EACH_CLIENT(v) if (IS_REAL_CLIENT(v))
#define FOR_EACH_OBSERVER(v) FOR_EACH_CLIENT(v) if (IS_OBSERVER(v))
#define FOR_EACH_REALPLAYER(v) FOR_EACH_REALCLIENT(v) if (IS_PLAYER(v))
+#define FOREACH_CLIENT(cond, body) \
+ MACRO_BEGIN { \
+ int i = 0; \
+ for (entity it = NULL; (it = nextent(it)) && (etof(it) <= maxclients); ++i) \
+ { \
+ if (!IS_CLIENT(it)) continue; \
+ if (cond) { LAMBDA(body) } \
+ } \
+ } MACRO_END
+
#define FOR_EACH_MONSTER(v) for (v = world; (v = findflags(v, flags, FL_MONSTER)) != world; )
#include "../common/effects/all.qh"
bool autocvar_bot_wander_enable;
int autocvar_captureleadlimit_override;
#define autocvar_capturelimit_override cvar("capturelimit_override")
-#define autocvar_developer cvar("developer")
float autocvar_ekg;
#define autocvar_fraglimit cvar("fraglimit")
#define autocvar_fraglimit_override cvar("fraglimit_override")
shotspeedupward *= W_WeaponSpeedFactor();
if (!shotspeed)
{
- LOG_TRACE("bot_aim: WARNING: weapon ", WEP_NAME(self.weapon), " shotspeed is zero!\n");
+ LOG_TRACE("bot_aim: WARNING: weapon ", PS(self).m_weapon.m_name, " shotspeed is zero!\n");
shotspeed = 1000000;
}
if (!maxshottime)
{
- LOG_TRACE("bot_aim: WARNING: weapon ", WEP_NAME(self.weapon), " maxshottime is zero!\n");
+ LOG_TRACE("bot_aim: WARNING: weapon ", PS(self).m_weapon.m_name, " maxshottime is zero!\n");
maxshottime = 1;
}
makevectors(self.v_angle);
if(self.weapons)
{
- Weapon w = Weapons_from(self.weapon);
+ Weapon w = PS(self).m_weapon;
w.wr_aim(w);
if (autocvar_bot_nofire || IS_INDEPENDENT_PLAYER(self))
{
else
{
if(self.BUTTON_ATCK||self.BUTTON_ATCK2)
- self.lastfiredweapon = self.weapon;
+ self.lastfiredweapon = PS(self).m_weapon.m_id;
}
}
else
{
entity e = Weapons_from(i);
if ((self.weapons & (e.m_wepset)) && (e.spawnflags & WEP_FLAG_RELOADABLE) && (self.weapon_load[i] < e.reloading_ammo))
- self.switchweapon = i;
+ PS(self).m_switchweapon = Weapons_from(i);
}
}
}
else if(self.health>WEP_CVAR(devastator, damage)*0.5)
{
if(self.velocity.z < 0)
- if(client_hasweapon(self, WEP_DEVASTATOR.m_id, true, false))
+ if(client_hasweapon(self, WEP_DEVASTATOR, true, false))
{
self.movement_x = maxspeed;
return;
}
- self.switchweapon = WEP_DEVASTATOR.m_id;
+ PS(self).m_switchweapon = WEP_DEVASTATOR;
self.v_angle_x = 90;
self.BUTTON_ATCK = true;
self.rocketjumptime = time + WEP_CVAR(devastator, detonatedelay);
// ;)
if(g_weaponarena_weapons == WEPSET(TUBA))
{
- self.switchweapon = WEP_TUBA.m_id;
+ PS(self).m_switchweapon = WEP_TUBA;
return;
}
if(self.enemy==world)
{
// If no weapon was chosen get the first available weapon
- if(self.weapon==0)
+ if(PS(self).m_weapon==WEP_Null)
for(i = WEP_FIRST; i <= WEP_LAST; ++i) if(i != WEP_BLASTER.m_id)
{
- if(client_hasweapon(self, i, true, false))
+ if(client_hasweapon(self, Weapons_from(i), true, false))
{
- self.switchweapon = i;
+ PS(self).m_switchweapon = Weapons_from(i);
return;
}
}
combo = false;
if(autocvar_bot_ai_weapon_combo)
- if(self.weapon == self.lastfiredweapon)
+ if(PS(self).m_weapon.m_id == self.lastfiredweapon)
if(af > combo_time)
{
combo = true;
if ( distance > bot_distance_far ) {
for(i=0; i < Weapons_COUNT && bot_weapons_far[i] != -1 ; ++i){
w = bot_weapons_far[i];
- if ( client_hasweapon(self, w, true, false) )
+ if ( client_hasweapon(self, Weapons_from(w), true, false) )
{
- if ((self.weapon == w && combo) || havocbot_chooseweapon_checkreload(w))
+ if ((PS(self).m_weapon.m_id == w && combo) || havocbot_chooseweapon_checkreload(w))
continue;
- self.switchweapon = w;
+ PS(self).m_switchweapon = Weapons_from(w);
return;
}
}
if ( distance > bot_distance_close) {
for(i=0; i < Weapons_COUNT && bot_weapons_mid[i] != -1 ; ++i){
w = bot_weapons_mid[i];
- if ( client_hasweapon(self, w, true, false) )
+ if ( client_hasweapon(self, Weapons_from(w), true, false) )
{
- if ((self.weapon == w && combo) || havocbot_chooseweapon_checkreload(w))
+ if ((PS(self).m_weapon.m_id == w && combo) || havocbot_chooseweapon_checkreload(w))
continue;
- self.switchweapon = w;
+ PS(self).m_switchweapon = Weapons_from(w);
return;
}
}
// Choose weapons for close distance
for(i=0; i < Weapons_COUNT && bot_weapons_close[i] != -1 ; ++i){
w = bot_weapons_close[i];
- if ( client_hasweapon(self, w, true, false) )
+ if ( client_hasweapon(self, Weapons_from(w), true, false) )
{
- if ((self.weapon == w && combo) || havocbot_chooseweapon_checkreload(w))
+ if ((PS(self).m_weapon.m_id == w && combo) || havocbot_chooseweapon_checkreload(w))
continue;
- self.switchweapon = w;
+ PS(self).m_switchweapon = Weapons_from(w);
return;
}
}
float bot_cmd_select_weapon()
{SELFPARAM();
- float id;
-
- id = bot_cmd.bot_cmd_parm_float;
+ float id = bot_cmd.bot_cmd_parm_float;
if(id < WEP_FIRST || id > WEP_LAST)
return CMD_STATUS_ERROR;
- if(client_hasweapon(self, id, true, false))
- self.switchweapon = id;
+ if(client_hasweapon(self, Weapons_from(id), true, false))
+ PS(self).m_switchweapon = Weapons_from(id);
else
return CMD_STATUS_ERROR;
fclose(file);
- LOG_TRACE("loaded ");
- LOG_TRACE(ftos(c));
- LOG_TRACE(" waypoint links from maps/");
- LOG_TRACE(mapname);
- LOG_TRACE(".waypoints.cache\n");
+ LOG_TRACE("loaded ", ftos(c), " waypoint links from maps/", mapname, ".waypoints.cache\n");
botframe_cachedwaypointlinks = true;
return true;
if (file < 0)
{
- LOG_TRACE("waypoint links load from ");
- LOG_TRACE(filename);
- LOG_TRACE(" failed\n");
+ LOG_TRACE("waypoint links load from ", filename, " failed\n");
return;
}
fclose(file);
- LOG_TRACE("loaded ");
- LOG_TRACE(ftos(c));
- LOG_TRACE(" waypoint links from maps/");
- LOG_TRACE(mapname);
- LOG_TRACE(".waypoints.hardwired\n");
+ LOG_TRACE("loaded ", ftos(c), " waypoint links from maps/", mapname, ".waypoints.hardwired\n");
}
entity waypoint_get_link(entity w, float i)
cwb = cwb + 1;
}
fclose(file);
- LOG_TRACE("loaded ");
- LOG_TRACE(ftos(cwp));
- LOG_TRACE(" waypoints and ");
- LOG_TRACE(ftos(cwb));
- LOG_TRACE(" wayboxes from maps/");
- LOG_TRACE(mapname);
- LOG_TRACE(".waypoints\n");
+ LOG_TRACE("loaded ", ftos(cwp), " waypoints and ", ftos(cwb), " wayboxes from maps/", mapname, ".waypoints\n");
}
else
{
- LOG_TRACE("waypoint load from ");
- LOG_TRACE(filename);
- LOG_TRACE(" failed\n");
+ LOG_TRACE("waypoint load from ", filename, " failed\n");
}
return cwp + cwb;
}
return 0;
// sv_clones
- if(i == CHIMPULSE_CLONE_MOVING || i == CHIMPULSE_CLONE_STANDING)
+ if(i == CHIMPULSE_CLONE_MOVING.impulse || i == CHIMPULSE_CLONE_STANDING.impulse)
if(self.lip < sv_clones)
return 1;
{
entity e, e2;
- case CHIMPULSE_SPEEDRUN_INIT: // deploy personal waypoint
+ case CHIMPULSE_SPEEDRUN_INIT.impulse: // deploy personal waypoint
// shared with regular waypoint init, so this is not a cheat by itself
if(!self.personal)
{
self.personal.invincible_finished = self.invincible_finished;
self.personal.teleport_time = time;
break; // this part itself doesn't cheat, so let's not count this
- case CHIMPULSE_CLONE_MOVING:
+ case CHIMPULSE_CLONE_MOVING.impulse:
IS_CHEAT(i, 0, 0);
makevectors (self.v_angle);
self.velocity = self.velocity + v_forward * 300;
self.velocity = self.velocity - v_forward * 300;
DID_CHEAT();
break;
- case CHIMPULSE_CLONE_STANDING:
+ case CHIMPULSE_CLONE_STANDING.impulse:
IS_CHEAT(i, 0, 0);
CopyBody(0);
self.lip += 1;
DID_CHEAT();
break;
- case CHIMPULSE_GIVE_ALL:
+ case CHIMPULSE_GIVE_ALL.impulse:
IS_CHEAT(i, 0, 0);
CheatCommand(tokenize_console("give all"));
break; // already counted as cheat
- case CHIMPULSE_SPEEDRUN:
+ case CHIMPULSE_SPEEDRUN.impulse:
IS_CHEAT(i, 0, 0);
if(self.personal)
{
else
sprint(self, "No waypoint set, cheater (use g_waypointsprite_personal to set one)\n");
break;
- case CHIMPULSE_TELEPORT:
+ case CHIMPULSE_TELEPORT.impulse:
IS_CHEAT(i, 0, 0);
if(self.movetype == MOVETYPE_NOCLIP)
{
}
sprint(self, "Emergency teleport could not find a good location, forget it!\n");
break;
- case CHIMPULSE_R00T:
+ case CHIMPULSE_R00T.impulse:
IS_CHEAT(i, 0, 0);
RandomSelection_Init();
FOR_EACH_PLAYER(e)
{
if(vlen(oldself.origin - start) < vlen(e.origin - start))
++effectnum;
- else if(vlen(oldself.origin - start) == vlen(e.origin - start) && num_for_edict(oldself) < num_for_edict(e))
+ else if(vlen(oldself.origin - start) == vlen(e.origin - start) && etof(oldself) < etof(e))
++effectnum;
}
fputs(f, strcat("\"race_place\" \"", ftos(effectnum), "\"\n"));
#ifndef CHEATS_H
#define CHEATS_H
+#include "../common/impulses/all.qh"
+
//float autocvar_sv_cheats; // must... declare... global
float cheatcount_total;
float CheatCommand(float argc);
float CheatFrame();
-const float CHIMPULSE_SPEEDRUN_INIT = 30;
-const float CHIMPULSE_GIVE_ALL = 99;
-const float CHIMPULSE_CLONE_MOVING = 140;
-const float CHIMPULSE_SPEEDRUN = 141;
-const float CHIMPULSE_CLONE_STANDING = 142;
-const float CHIMPULSE_TELEPORT = 143;
-const float CHIMPULSE_R00T = 148;
-
const float CHRAME_DRAG = 8;
void Drag_MoveDrag(entity from, entity to); // call this from CopyBody
#include "bot/navigation.qh"
#include "../common/ent_cs.qh"
-#include "../common/vehicles/all.qh"
+#include "../common/state.qh"
+
#include "../common/triggers/teleporters.qh"
+#include "../common/vehicles/all.qh"
+
#include "weapons/hitplot.qh"
#include "weapons/weaponsystem.qh"
*/
void FixPlayermodel(entity player);
void PutObserverInServer()
-{SELFPARAM();
+{
+ SELFPARAM();
+ PlayerState_detach(this);
entity spot;
self.hud = HUD_NORMAL;
setsize (self, PL_CROUCH_MIN, PL_CROUCH_MAX); // give the spectator some space between walls for MOVETYPE_FLY_WORLDONLY
self.view_ofs = '0 0 0'; // so that your view doesn't go into the ceiling with MOVETYPE_FLY_WORLDONLY, previously "PL_VIEW_OFS"
- self.weapon = 0;
+ PS(self).m_weapon = WEP_Null;
self.weaponname = "";
- self.switchingweapon = 0;
+ PS(self).m_switchingweapon = WEP_Null;
self.weaponmodel = "";
for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
if (IS_OBSERVER(this)) {
PutObserverInServer();
} else if (IS_PLAYER(this)) {
+ PlayerState_attach(this);
accuracy_resend(this);
if (this.team < 0)
remove(spot); // usefull for checking if there are spawnpoints, that let drop through the floor
}
- this.switchweapon = w_getbestweapon(this);
+ PS(this).m_switchweapon = w_getbestweapon(this);
this.cnt = -1; // W_LastWeapon will not complain
- this.weapon = 0;
+ PS(this).m_weapon = WEP_Null;
this.weaponname = "";
- this.switchingweapon = 0;
+ PS(this).m_switchingweapon = WEP_Null;
if (!warmup_stage && !this.alivetime)
this.alivetime = time;
}
}
+void ClientInit_misc();
+
.float ebouncefactor, ebouncestop; // electro's values
// TODO do we need all these fields, or should we stop autodetecting runtime
// changes and just have a console command to update this?
WriteHeader(MSG_ENTITY, _ENT_CLIENT_INIT);
return = true;
msg_entity = to;
+ // MSG_INIT replacement
+ // TODO: make easier to use
Registry_send_all();
+ W_PROP_reload(MSG_ONE, to);
+ ClientInit_misc();
+ MUTATOR_CALLHOOK(Ent_Init);
+}
+void ClientInit_misc()
+{
int channel = MSG_ONE;
WriteHeader(channel, ENT_CLIENT_INIT);
WriteByte(channel, g_nexball_meter_period * 32);
else
WriteString(channel, "");
WriteByte(channel, self.count * 255.0); // g_balance_armor_blockpercent
- WriteCoord(channel, self.bouncefactor); // g_balance_mortar_bouncefactor // WEAPONTODO
- WriteCoord(channel, self.bouncestop); // g_balance_mortar_bouncestop
- WriteCoord(channel, self.ebouncefactor); // g_balance_mortar_bouncefactor
- WriteCoord(channel, self.ebouncestop); // g_balance_mortar_bouncestop
- WriteByte(channel, WEP_CVAR(vortex, secondary)); // client has to know if it should zoom or not // WEAPONTODO
- WriteByte(channel, WEP_CVAR(rifle, secondary)); // client has to know if it should zoom or not // WEAPONTODO
WriteByte(channel, serverflags); // client has to know if it should zoom or not
- WriteByte(channel, WEP_CVAR(minelayer, limit)); // minelayer max mines // WEAPONTODO
- WriteByte(channel, WEP_CVAR_SEC(hagar, load_max)); // hagar max loadable rockets // WEAPONTODO
WriteCoord(channel, autocvar_g_trueaim_minrange);
- WriteByte(channel, WEP_CVAR(porto, secondary)); // WEAPONTODO
-
- MUTATOR_CALLHOOK(Ent_Init);
}
void ClientInit_CheckUpdate()
self.count = autocvar_g_balance_armor_blockpercent;
self.SendFlags |= 1;
}
- if(self.bouncefactor != autocvar_g_balance_mortar_bouncefactor) // WEAPONTODO
- {
- self.bouncefactor = autocvar_g_balance_mortar_bouncefactor;
- self.SendFlags |= 1;
- }
- if(self.bouncestop != autocvar_g_balance_mortar_bouncestop)
- {
- self.bouncestop = autocvar_g_balance_mortar_bouncestop;
- self.SendFlags |= 1;
- }
- if(self.ebouncefactor != autocvar_g_balance_electro_secondary_bouncefactor)
- {
- self.ebouncefactor = autocvar_g_balance_electro_secondary_bouncefactor;
- self.SendFlags |= 1;
- }
- if(self.ebouncestop != autocvar_g_balance_electro_secondary_bouncestop)
- {
- self.ebouncestop = autocvar_g_balance_electro_secondary_bouncestop;
- self.SendFlags |= 1;
- }
}
void ClientInit_Spawn()
{
GameLogEcho(sprintf(":connect:%d:%d:%s",
self.playerid,
- num_for_edict(self),
+ etof(self),
((IS_REAL_CLIENT(self)) ? self.netaddress : "bot")
));
}
*/
void DecodeLevelParms ();
void ClientConnect ()
-{SELFPARAM();
+{
+ SELFPARAM();
+ ClientState_attach(this);
float t;
if(IS_CLIENT(self))
player_count = 0;
}
- if(IS_REAL_CLIENT(self)) { PlayerStats_PlayerBasic_CheckUpdate(self); }
+ // TODO: xonstat elo.txt support, until then just 404s
+ if(false && IS_REAL_CLIENT(self)) { PlayerStats_PlayerBasic_CheckUpdate(self); }
PlayerScore_Attach(self);
ClientData_Attach();
PlayerStats_GameReport_AddPlayer(self);
if(autocvar_sv_eventlog)
- GameLogEcho(strcat(":join:", ftos(self.playerid), ":", ftos(num_for_edict(self)), ":", ((IS_REAL_CLIENT(self)) ? self.netaddress : "bot"), ":", self.netname));
+ GameLogEcho(strcat(":join:", ftos(self.playerid), ":", ftos(etof(self)), ":", ((IS_REAL_CLIENT(self)) ? self.netaddress : "bot"), ":", self.netname));
LogTeamchange(self.playerid, self.team, 1);
.entity chatbubbleentity;
void ReadyCount();
void ClientDisconnect ()
-{SELFPARAM();
+{
+ SELFPARAM();
+ ClientState_detach(this);
if(self.vehicle)
vehicles_exit(VHEF_RELEASE);
{
if(self.vehicle)
vehicles_exit(VHEF_RELEASE);
- self.event_damage(self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0');
+ if(self.event_damage)
+ self.event_damage(self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0');
}
if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
self.invincible_finished = spectatee.invincible_finished;
self.pressedkeys = spectatee.pressedkeys;
self.weapons = spectatee.weapons;
- self.switchweapon = spectatee.switchweapon;
- self.switchingweapon = spectatee.switchingweapon;
- self.weapon = spectatee.weapon;
+ PS(self).m_switchweapon = PS(spectatee).m_switchweapon;
+ PS(self).m_switchingweapon = PS(spectatee).m_switchingweapon;
+ PS(self).m_weapon = PS(spectatee).m_weapon;
self.vortex_charge = spectatee.vortex_charge;
self.vortex_chargepool_ammo = spectatee.vortex_chargepool_ammo;
self.hagar_load = spectatee.hagar_load;
{SELFPARAM();
if ( self.impulse )
{
- MinigameImpulse(self.impulse);
+ MinigameImpulse(self, self.impulse);
self.impulse = 0;
}
float prefered_movetype;
{SELFPARAM();
if ( self.impulse )
{
- if(MinigameImpulse(self.impulse))
+ if(MinigameImpulse(self, self.impulse))
self.impulse = 0;
}
if (self.flags & FL_JUMPRELEASED) {
// WEAPONTODO: THIS SHIT NEEDS TO GO EVENTUALLY
// It cannot be predicted by the engine!
.entity weaponentity = weaponentities[0]; // TODO: unhardcode
- if((self.weapon == WEP_SHOCKWAVE.m_id || self.weapon == WEP_SHOTGUN.m_id) && self.(weaponentity).wframe == WFRAME_FIRE2 && time < self.(weaponentity).weapon_nextthink)
+ if((PS(self).m_weapon == WEP_SHOCKWAVE || PS(self).m_weapon == WEP_SHOTGUN) && self.(weaponentity).wframe == WFRAME_FIRE2 && time < self.(weaponentity).weapon_nextthink)
do_crouch = 0;
if (do_crouch)
// WEAPONTODO: Add weapon request for this
if(!zoomstate_set)
- SetZoomState(self.BUTTON_ZOOM || self.BUTTON_ZOOMSCRIPT || (self.BUTTON_ATCK2 && self.weapon == WEP_VORTEX.m_id) || (self.BUTTON_ATCK2 && self.weapon == WEP_RIFLE.m_id && WEP_CVAR(rifle, secondary) == 0)); // WEAPONTODO
+ SetZoomState(
+ self.BUTTON_ZOOM
+ || self.BUTTON_ZOOMSCRIPT
+ || (self.BUTTON_ATCK2 && PS(self).m_weapon == WEP_VORTEX)
+ || (self.BUTTON_ATCK2 && PS(self).m_weapon == WEP_RIFLE && WEP_CVAR(rifle, secondary) == 0)
+ ); // WEAPONTODO
float oldspectatee_status;
oldspectatee_status = self.spectatee_status;
if(IS_SPEC(self))
- self.spectatee_status = num_for_edict(self.enemy);
+ self.spectatee_status = etof(self.enemy);
else if(IS_OBSERVER(self))
- self.spectatee_status = num_for_edict(self);
+ self.spectatee_status = etof(self);
else
self.spectatee_status = 0;
if(self.spectatee_status != oldspectatee_status)
// WEAPONTODO: Move into weaponsystem somehow
// if a player goes unarmed after holding a loaded weapon, empty his clip size and remove the crosshair ammo ring
- if(!self.weapon)
+ if (PS(self).m_weapon == WEP_Null)
self.clip_load = self.clip_size = 0;
}
CheckRules_Player();
UpdateChatBubble();
if (self.impulse)
- ImpulseCommands();
+ ImpulseCommands(self);
if (intermission_running)
return; // intermission or finale
GetPressedKeys();
.entity vehicle;
+#define IMPULSE(id) _IMPULSE(IMP_##id)
+#define _IMPULSE(id) \
+ void id##_handle(entity this); \
+ STATIC_INIT_LATE(id) \
+ { \
+ id.impulse_handle = id##_handle; \
+ } \
+ void id##_handle(entity this)
+
/**
* Impulse map:
*
* 0 reserved (no input)
- * 1 to 9, 14: weapon shortcuts
- * 10: next weapon according to linear list
- * 11: most recently used weapon
- * 12: previous weapon according to linear list
- * 13: best weapon according to priority list
- * 15: next weapon according to priority list
- * 16: previous weapon according to priority list
- * 17: throw weapon
- * 18: next weapon according to sbar_hudselector 1 list
- * 19: previous weapon according to sbar_hudselector 1 list
- * 20: reload if needed
- *
- * 30 to 39: create waypoints
- * 47: clear personal waypoints
- * 48: clear team waypoints
*
* 99: loaded
*
* 230 to 253: individual weapons (up to 24)
*/
-void ImpulseCommands ()
-{SELFPARAM();
- int imp;
- vector org;
- float i;
- float m;
- entity e, e2;
+// weapon switching impulses
- imp = self.impulse;
- if (!imp || gameover)
- return;
- self.impulse = 0;
+#define X(slot) \
+ IMPULSE(weapon_group_##slot) \
+ { \
+ if (this.deadflag != DEAD_NO) return; \
+ W_NextWeaponOnImpulse(slot); \
+ }
+X(1)
+X(2)
+X(3)
+X(4)
+X(5)
+X(6)
+X(7)
+X(8)
+X(9)
+X(0)
+#undef X
- if ( self.active_minigame )
- if ( MinigameImpulse(imp) )
- return;
+// custom order weapon cycling
+
+#define X(slot, dir) \
+ IMPULSE(weapon_priority_##slot##_##dir) \
+ { \
+ if (this.vehicle) return; \
+ if (this.deadflag != DEAD_NO) return; \
+ noref int prev = -1; \
+ noref int best = 0; \
+ noref int next = +1; \
+ W_CycleWeapon(this.cvar_cl_weaponpriorities[slot], dir); \
+ }
+X(0, prev)
+X(1, prev)
+X(2, prev)
+X(3, prev)
+X(4, prev)
+X(5, prev)
+X(6, prev)
+X(7, prev)
+X(8, prev)
+X(9, prev)
+
+X(0, best)
+X(1, best)
+X(2, best)
+X(3, best)
+X(4, best)
+X(5, best)
+X(6, best)
+X(7, best)
+X(8, best)
+X(9, best)
+
+X(0, next)
+X(1, next)
+X(2, next)
+X(3, next)
+X(4, next)
+X(5, next)
+X(6, next)
+X(7, next)
+X(8, next)
+X(9, next)
+#undef X
+
+// direct weapons
+
+#define X(i) \
+ IMPULSE(weapon_byid_##i) \
+ { \
+ if (this.vehicle) return; \
+ if (this.deadflag != DEAD_NO) return; \
+ W_SwitchWeapon(Weapons_from(WEP_FIRST + i)); \
+ }
+X(0)
+X(1)
+X(2)
+X(3)
+X(4)
+X(5)
+X(6)
+X(7)
+X(8)
+X(9)
+X(10)
+X(11)
+X(12)
+X(13)
+X(14)
+X(15)
+X(16)
+X(17)
+X(18)
+X(19)
+X(20)
+X(21)
+X(22)
+X(23)
+#undef X
+
+IMPULSE(weapon_next_byid)
+{
+ if (this.vehicle) return;
+ if (this.deadflag != DEAD_NO) return;
+ W_NextWeapon(0);
+}
+
+IMPULSE(weapon_prev_byid)
+{
+ if (this.vehicle) return;
+ if (this.deadflag != DEAD_NO) return;
+ W_PreviousWeapon(0);
+}
+
+IMPULSE(weapon_next_bygroup)
+{
+ if (this.vehicle) return;
+ if (this.deadflag != DEAD_NO) return;
+ W_NextWeapon(1);
+}
+
+IMPULSE(weapon_prev_bygroup)
+{
+ if (this.vehicle) return;
+ if (this.deadflag != DEAD_NO) return;
+ W_PreviousWeapon(1);
+}
+
+IMPULSE(weapon_next_bypriority)
+{
+ if (this.vehicle) return;
+ if (this.deadflag != DEAD_NO) return;
+ W_NextWeapon(2);
+}
+
+IMPULSE(weapon_prev_bypriority)
+{
+ if (this.vehicle) return;
+ if (this.deadflag != DEAD_NO) return;
+ W_PreviousWeapon(2);
+}
+
+IMPULSE(weapon_last)
+{
+ if (this.vehicle) return;
+ if (this.deadflag != DEAD_NO) return;
+ W_LastWeapon();
+}
+
+IMPULSE(weapon_best)
+{
+ if (this.vehicle) return;
+ if (this.deadflag != DEAD_NO) return;
+ W_SwitchWeapon(w_getbestweapon(this));
+}
+
+IMPULSE(weapon_drop)
+{
+ if (this.vehicle) return;
+ if (this.deadflag != DEAD_NO) return;
+ W_ThrowWeapon(W_CalculateProjectileVelocity(this.velocity, v_forward * 750, false), '0 0 0', true);
+}
+
+IMPULSE(weapon_reload)
+{
+ if (this.vehicle) return;
+ if (this.deadflag != DEAD_NO) return;
+ if (forbidWeaponUse(this)) return;
+ Weapon w = PS(this).m_weapon;
+ w.wr_reload(w);
+}
+
+void ImpulseCommands(entity this)
+{
+ if (gameover) return;
+
+ int imp = this.impulse;
+ if (!imp) return;
+ this.impulse = 0;
+
+ if (MinigameImpulse(this, imp)) return;
+
+ if (timeout_status == TIMEOUT_ACTIVE) return; // don't allow any impulses while the game is paused
// allow only weapon change impulses when not in round time
- if(round_handler_IsActive() && !round_handler_IsRoundStarted())
- if(imp == 17 || (imp >= 20 && imp < 200) || imp > 253)
- return;
+ if (round_handler_IsActive() && !round_handler_IsRoundStarted())
+ {
+ #define X(id) case IMP_##id.impulse:
+ switch (imp)
+ {
+ X(weapon_group_0)
+ X(weapon_group_1)
+ X(weapon_group_2)
+ X(weapon_group_3)
+ X(weapon_group_4)
+ X(weapon_group_5)
+ X(weapon_group_6)
+ X(weapon_group_7)
+ X(weapon_group_8)
+ X(weapon_group_9)
+ X(weapon_next_byid)
+ X(weapon_prev_byid)
+ X(weapon_next_bygroup)
+ X(weapon_prev_bygroup)
+ X(weapon_next_bypriority)
+ X(weapon_prev_bypriority)
+ X(weapon_last)
+ X(weapon_best)
+ X(weapon_reload)
+ X(weapon_priority_0_prev)
+ X(weapon_priority_1_prev)
+ X(weapon_priority_2_prev)
+ X(weapon_priority_3_prev)
+ X(weapon_priority_4_prev)
+ X(weapon_priority_5_prev)
+ X(weapon_priority_6_prev)
+ X(weapon_priority_7_prev)
+ X(weapon_priority_8_prev)
+ X(weapon_priority_9_prev)
+ X(weapon_priority_0_next)
+ X(weapon_priority_1_next)
+ X(weapon_priority_2_next)
+ X(weapon_priority_3_next)
+ X(weapon_priority_4_next)
+ X(weapon_priority_5_next)
+ X(weapon_priority_6_next)
+ X(weapon_priority_7_next)
+ X(weapon_priority_8_next)
+ X(weapon_priority_9_next)
+ X(weapon_priority_0_best)
+ X(weapon_priority_1_best)
+ X(weapon_priority_2_best)
+ X(weapon_priority_3_best)
+ X(weapon_priority_4_best)
+ X(weapon_priority_5_best)
+ X(weapon_priority_6_best)
+ X(weapon_priority_7_best)
+ X(weapon_priority_8_best)
+ X(weapon_priority_9_best)
+ X(weapon_byid_0)
+ X(weapon_byid_1)
+ X(weapon_byid_2)
+ X(weapon_byid_3)
+ X(weapon_byid_4)
+ X(weapon_byid_5)
+ X(weapon_byid_6)
+ X(weapon_byid_7)
+ X(weapon_byid_8)
+ X(weapon_byid_9)
+ X(weapon_byid_10)
+ X(weapon_byid_11)
+ X(weapon_byid_12)
+ X(weapon_byid_13)
+ X(weapon_byid_14)
+ X(weapon_byid_15)
+ X(weapon_byid_16)
+ X(weapon_byid_17)
+ X(weapon_byid_18)
+ X(weapon_byid_19)
+ X(weapon_byid_20)
+ X(weapon_byid_21)
+ X(weapon_byid_22)
+ X(weapon_byid_23)
+ break;
+ default: return;
+ }
+#undef X
+ }
+
+ if (vehicle_impulse(this, imp)) return;
- if (timeout_status == TIMEOUT_ACTIVE) //don't allow any impulses while the game is paused
+ if (CheatImpulse(imp)) return;
+
+ FOREACH(IMPULSES, it.impulse == imp, {
+ void(entity) f = it.impulse_handle;
+ if (!f) continue;
+ f(this);
return;
+ });
+}
- if(self.vehicle)
- if(self.vehicle.deadflag == DEAD_NO)
+IMPULSE(use)
+{
+ PlayerUseKey();
+}
+
+IMPULSE(waypoint_personal_here)
+{
+ entity wp = WaypointSprite_DeployPersonal(WP_Waypoint, this.origin, RADARICON_WAYPOINT);
+ if (wp) WaypointSprite_Ping(wp);
+ sprint(this, "personal waypoint spawned at location\n");
+}
+
+IMPULSE(waypoint_personal_crosshair)
+{
+ WarpZone_crosshair_trace(this);
+ entity wp = WaypointSprite_DeployPersonal(WP_Waypoint, trace_endpos, RADARICON_WAYPOINT);
+ if (wp) WaypointSprite_Ping(wp);
+ sprint(this, "personal waypoint spawned at crosshair\n");
+}
+
+IMPULSE(waypoint_personal_death)
+{
+ if (!this.death_origin) return;
+ entity wp = WaypointSprite_DeployPersonal(WP_Waypoint, this.death_origin, RADARICON_WAYPOINT);
+ if (wp) WaypointSprite_Ping(wp);
+ sprint(this, "personal waypoint spawned at death location\n");
+}
+
+IMPULSE(waypoint_here_follow)
+{
+ if (!teamplay) return;
+ if (this.deadflag != DEAD_NO) return;
+ if (!MUTATOR_CALLHOOK(HelpMePing, this))
{
- if(self.vehicle.vehicles_impulse)
- if(self.vehicle.vehicles_impulse(imp))
- return;
- if(vehicle_impulse(imp))
- return;
+ entity wp = WaypointSprite_Attach(WP_Helpme, true, RADARICON_HELPME);
+ if (!wp) WaypointSprite_HelpMePing(this.waypointsprite_attachedforcarrier);
+ else WaypointSprite_Ping(wp);
}
+ sprint(this, "HELP ME attached\n");
+}
+
+IMPULSE(waypoint_here_here)
+{
+ entity wp = WaypointSprite_DeployFixed(WP_Here, false, this.origin, RADARICON_HERE);
+ if (wp) WaypointSprite_Ping(wp);
+ sprint(this, "HERE spawned at location\n");
+}
+
+IMPULSE(waypoint_here_crosshair)
+{
+ WarpZone_crosshair_trace(this);
+ entity wp = WaypointSprite_DeployFixed(WP_Here, false, trace_endpos, RADARICON_HERE);
+ if (wp) WaypointSprite_Ping(wp);
+ sprint(this, "HERE spawned at crosshair\n");
+}
+
+IMPULSE(waypoint_here_death)
+{
+ if (!this.death_origin) return;
+ entity wp = WaypointSprite_DeployFixed(WP_Here, false, this.death_origin, RADARICON_HERE);
+ if (wp) WaypointSprite_Ping(wp);
+ sprint(this, "HERE spawned at death location\n");
+}
- if(CheatImpulse(imp))
+IMPULSE(waypoint_danger_here)
+{
+ entity wp = WaypointSprite_DeployFixed(WP_Danger, false, this.origin, RADARICON_DANGER);
+ if (wp) WaypointSprite_Ping(wp);
+ sprint(this, "DANGER spawned at location\n");
+}
+
+IMPULSE(waypoint_danger_crosshair)
+{
+ WarpZone_crosshair_trace(this);
+ entity wp = WaypointSprite_DeployFixed(WP_Danger, false, trace_endpos, RADARICON_DANGER);
+ if (wp) WaypointSprite_Ping(wp);
+ sprint(this, "DANGER spawned at crosshair\n");
+}
+
+IMPULSE(waypoint_danger_death)
+{
+ if (!this.death_origin) return;
+ entity wp = WaypointSprite_DeployFixed(WP_Danger, false, this.death_origin, RADARICON_DANGER);
+ if (wp) WaypointSprite_Ping(wp);
+ sprint(this, "DANGER spawned at death location\n");
+}
+
+IMPULSE(waypoint_clear_personal)
+{
+ WaypointSprite_ClearPersonal();
+ if (this.personal)
{
+ remove(this.personal);
+ this.personal = NULL;
}
- else if (imp >= 1 && imp <= 9)
+ sprint(this, "personal waypoint cleared\n");
+}
+
+IMPULSE(waypoint_clear)
+{
+ WaypointSprite_ClearOwned();
+ if (this.personal)
+ {
+ remove(this.personal);
+ this.personal = NULL;
+ }
+ sprint(this, "all waypoints cleared\n");
+}
+
+IMPULSE(navwaypoint_spawn)
+{
+ if (!autocvar_g_waypointeditor) return;
+ waypoint_schedulerelink(waypoint_spawn(this.origin, this.origin, 0));
+ bprint(strcat("Waypoint spawned at ", vtos(this.origin), "\n"));
+}
+
+IMPULSE(navwaypoint_remove)
+{
+ if (!autocvar_g_waypointeditor) return;
+ entity e = navigation_findnearestwaypoint(this, false);
+ if (!e) return;
+ if (e.wpflags & WAYPOINTFLAG_GENERATED) return;
+ bprint(strcat("Waypoint removed at ", vtos(e.origin), "\n"));
+ waypoint_remove(e);
+}
+
+IMPULSE(navwaypoint_relink)
+{
+ if (!autocvar_g_waypointeditor) return;
+ waypoint_schedulerelinkall();
+}
+
+IMPULSE(navwaypoint_save)
+{
+ if (!autocvar_g_waypointeditor) return;
+ waypoint_saveall();
+}
+
+IMPULSE(navwaypoint_unreachable)
+{
+ if (!autocvar_g_waypointeditor) return;
+ for (entity e = findchain(classname, "waypoint"); e; e = e.chain)
{
- // weapon switching impulses
- if(self.deadflag == DEAD_NO)
- W_NextWeaponOnImpulse(imp);
- //else // don't retry, as this can break weaplast bind
- // self.impulse = imp; // retry in next frame
+ e.colormod = '0.5 0.5 0.5';
+ e.effects &= ~(EF_NODEPTHTEST | EF_RED | EF_BLUE);
}
- else if(imp >= 10 && imp <= 20)
+ entity e2 = navigation_findnearestwaypoint(this, false);
+ navigation_markroutes(e2);
+
+ int i, m;
+
+ i = 0;
+ m = 0;
+ for (entity e = findchain(classname, "waypoint"); e; e = e.chain)
{
- if(!self.vehicle)
- if(self.deadflag == DEAD_NO)
- {
- switch(imp)
- {
- case 10:
- W_NextWeapon(0);
- break;
- case 11:
- W_LastWeapon();
- break;
- case 12:
- W_PreviousWeapon(0);
- break;
- case 13:
- W_SwitchWeapon(w_getbestweapon(self));
- break;
- case 14:
- W_NextWeaponOnImpulse(0);
- break;
- case 15:
- W_NextWeapon(2);
- break;
- case 16:
- W_PreviousWeapon(2);
- break;
- case 17:
- W_ThrowWeapon(W_CalculateProjectileVelocity(self.velocity, v_forward * 750, false), '0 0 0', true);
- break;
- case 18:
- W_NextWeapon(1);
- break;
- case 19:
- W_PreviousWeapon(1);
- break;
- case 20:
- if(!forbidWeaponUse(self)) {
- Weapon w = Weapons_from(self.weapon);
- w.wr_reload(w);
- }
- break;
- }
- }
- //else // don't retry, as this can break weaplast bind
- //self.impulse = imp; // retry in next frame
+ if (e.wpcost < 10000000) continue;
+ LOG_INFO("unreachable: ", etos(e), " ", vtos(e.origin), "\n");
+ e.colormod_z = 8;
+ e.effects |= EF_NODEPTHTEST | EF_BLUE;
+ ++i;
+ ++m;
}
- else if(imp == 21)
+ if (i) LOG_INFOF("%d waypoints cannot be reached from here in any way (marked with blue light)\n", i);
+ navigation_markroutes_inverted(e2);
+
+ i = 0;
+ for (entity e = findchain(classname, "waypoint"); e; e = e.chain)
{
- PlayerUseKey ();
+ if (e.wpcost < 10000000) continue;
+ LOG_INFO("cannot reach me: ", etos(e), " ", vtos(e.origin), "\n");
+ e.colormod_x = 8;
+ if (!(e.effects & EF_NODEPTHTEST)) // not already reported before
+ ++m;
+ e.effects |= EF_NODEPTHTEST | EF_RED;
+ ++i;
}
- else if(imp >= 200 && imp <= 229)
+ if (i) LOG_INFOF("%d waypoints cannot walk to here in any way (marked with red light)\n", i);
+ if (m) LOG_INFOF("%d waypoints have been marked total\n", m);
+
+ i = 0;
+ for (entity e = findchain(classname, "info_player_deathmatch"); e; e = e.chain)
{
- if(!self.vehicle)
- if(self.deadflag == DEAD_NO)
+ vector org = e.origin;
+ tracebox(e.origin, PL_MIN, PL_MAX, e.origin - '0 0 512', MOVE_NOMONSTERS, world);
+ setorigin(e, trace_endpos);
+ if (navigation_findnearestwaypoint(e, false))
{
- // custom order weapon cycling
- int i = imp % 10;
- m = (imp - (210 + i)); // <0 for prev, =0 for best, >0 for next
- W_CycleWeapon(self.(cvar_cl_weaponpriorities[i]), m);
+ setorigin(e, org);
+ e.effects &= ~EF_NODEPTHTEST;
+ e.model = "";
+ }
+ else
+ {
+ setorigin(e, org);
+ LOG_INFO("spawn without waypoint: ", etos(e), " ", vtos(e.origin), "\n");
+ e.effects |= EF_NODEPTHTEST;
+ _setmodel(e, this.model);
+ e.frame = this.frame;
+ e.skin = this.skin;
+ e.colormod = '8 0.5 8';
+ setsize(e, '0 0 0', '0 0 0');
+ ++i;
}
- //else // don't retry, as this can break weaplast bind
- //self.impulse = imp; // retry in next frame
}
- else if(imp >= WEP_IMPULSE_BEGIN && imp <= WEP_IMPULSE_END)
+ if (i) LOG_INFOF("%d spawnpoints have no nearest waypoint (marked by player model)\n", i);
+
+ i = 0;
+ entity start = findchainflags(flags, FL_ITEM);
+ for (entity e = start; e; e = e.chain)
{
- if(!self.vehicle)
- if(self.deadflag == DEAD_NO)
- W_SwitchWeapon (imp - WEP_IMPULSE_BEGIN + WEP_FIRST);
- //else // don't retry, as this can break weaplast bind
- //self.impulse = imp; // retry in next frame
+ e.effects &= ~(EF_NODEPTHTEST | EF_RED | EF_BLUE);
+ e.colormod = '0.5 0.5 0.5';
}
- // deploy waypoints
- else if (imp >= 30 && imp <= 49)
+ for (entity e = start; e; e = e.chain)
{
- entity wp;
- switch(imp)
- {
- case 30:
- wp = WaypointSprite_DeployPersonal(WP_Waypoint, self.origin, RADARICON_WAYPOINT);
- if(wp)
- WaypointSprite_Ping(wp);
- sprint(self, "personal waypoint spawned at location\n");
- break;
- case 31:
- WarpZone_crosshair_trace(self);
- wp = WaypointSprite_DeployPersonal(WP_Waypoint, trace_endpos, RADARICON_WAYPOINT);
- if(wp)
- WaypointSprite_Ping(wp);
- sprint(self, "personal waypoint spawned at crosshair\n");
- break;
- case 32:
- if(vlen(self.death_origin))
- {
- wp = WaypointSprite_DeployPersonal(WP_Waypoint, self.death_origin, RADARICON_WAYPOINT);
- if(wp)
- WaypointSprite_Ping(wp);
- sprint(self, "personal waypoint spawned at death location\n");
- }
- break;
- case 33:
- if(self.deadflag == DEAD_NO && teamplay)
- {
- if (!MUTATOR_CALLHOOK(HelpMePing, self))
- {
- wp = WaypointSprite_Attach(WP_Helpme, true, RADARICON_HELPME);
- if(!wp)
- WaypointSprite_HelpMePing(self.waypointsprite_attachedforcarrier);
- else
- WaypointSprite_Ping(wp);
- }
- sprint(self, "HELP ME attached\n");
- }
- break;
- case 34:
- wp = WaypointSprite_DeployFixed(WP_Here, false, self.origin, RADARICON_HERE);
- if(wp)
- WaypointSprite_Ping(wp);
- sprint(self, "HERE spawned at location\n");
- break;
- case 35:
- WarpZone_crosshair_trace(self);
- wp = WaypointSprite_DeployFixed(WP_Here, false, trace_endpos, RADARICON_HERE);
- if(wp)
- WaypointSprite_Ping(wp);
- sprint(self, "HERE spawned at crosshair\n");
- break;
- case 36:
- if(vlen(self.death_origin))
- {
- wp = WaypointSprite_DeployFixed(WP_Here, false, self.death_origin, RADARICON_HERE);
- if(wp)
- WaypointSprite_Ping(wp);
- sprint(self, "HERE spawned at death location\n");
- }
- break;
- case 37:
- wp = WaypointSprite_DeployFixed(WP_Danger, false, self.origin, RADARICON_DANGER);
- if(wp)
- WaypointSprite_Ping(wp);
- sprint(self, "DANGER spawned at location\n");
- break;
- case 38:
- WarpZone_crosshair_trace(self);
- wp = WaypointSprite_DeployFixed(WP_Danger, false, trace_endpos, RADARICON_DANGER);
- if(wp)
- WaypointSprite_Ping(wp);
- sprint(self, "DANGER spawned at crosshair\n");
- break;
- case 39:
- if(vlen(self.death_origin))
- {
- wp = WaypointSprite_DeployFixed(WP_Danger, false, self.death_origin, RADARICON_DANGER);
- if(wp)
- WaypointSprite_Ping(wp);
- sprint(self, "DANGER spawned at death location\n");
- }
- break;
- case 47:
- WaypointSprite_ClearPersonal();
- if(self.personal)
- {
- remove(self.personal);
- self.personal = world;
- }
- sprint(self, "personal waypoint cleared\n");
- break;
- case 48:
- WaypointSprite_ClearOwned();
- if(self.personal)
- {
- remove(self.personal);
- self.personal = world;
- }
- sprint(self, "all waypoints cleared\n");
- break;
- }
+ if (navigation_findnearestwaypoint(e, false)) continue;
+ LOG_INFO("item without waypoint: ", etos(e), " ", vtos(e.origin), "\n");
+ e.effects |= EF_NODEPTHTEST | EF_RED;
+ e.colormod_x = 8;
+ ++i;
}
- else if(imp >= 103 && imp <= 107)
+ if (i) LOG_INFOF("%d items have no nearest waypoint and cannot be walked away from (marked with red light)\n", i);
+
+ i = 0;
+ for (entity e = start; e; e = e.chain)
{
- if(autocvar_g_waypointeditor)
- {
- switch(imp)
- {
- case 103:
- waypoint_schedulerelink(waypoint_spawn(self.origin, self.origin, 0));
- bprint(strcat("Waypoint spawned at ",vtos(self.origin),"\n"));
- break;
- case 104:
- e = navigation_findnearestwaypoint(self, false);
- if (e)
- if (!(e.wpflags & WAYPOINTFLAG_GENERATED))
- {
- bprint(strcat("Waypoint removed at ",vtos(e.origin),"\n"));
- waypoint_remove(e);
- }
- break;
- case 105:
- waypoint_schedulerelinkall();
- break;
- case 106:
- waypoint_saveall();
- break;
- case 107:
- for(e = findchain(classname, "waypoint"); e; e = e.chain)
- {
- e.colormod = '0.5 0.5 0.5';
- e.effects &= ~(EF_NODEPTHTEST | EF_RED | EF_BLUE);
- }
- e2 = navigation_findnearestwaypoint(self, false);
- navigation_markroutes(e2);
- i = 0;
- m = 0;
- for(e = findchain(classname, "waypoint"); e; e = e.chain)
- {
- if(e.wpcost >= 10000000)
- {
- LOG_INFO("unreachable: ", etos(e), " ", vtos(e.origin), "\n");
- e.colormod_z = 8;
- e.effects |= EF_NODEPTHTEST | EF_BLUE;
- ++i;
- ++m;
- }
- }
- if(i)
- LOG_INFO(ftos(i), " waypoints cannot be reached from here in any way (marked with blue light)\n");
- navigation_markroutes_inverted(e2);
- i = 0;
- for(e = findchain(classname, "waypoint"); e; e = e.chain)
- {
- if(e.wpcost >= 10000000)
- {
- LOG_INFO("cannot reach me: ", etos(e), " ", vtos(e.origin), "\n");
- e.colormod_x = 8;
- if(!(e.effects & EF_NODEPTHTEST)) // not already reported before
- ++m;
- e.effects |= EF_NODEPTHTEST | EF_RED;
- ++i;
- }
- }
- if(i)
- LOG_INFO(ftos(i), " waypoints cannot walk to here in any way (marked with red light)\n");
- if(m)
- LOG_INFO(ftos(m), " waypoints have been marked total\n");
- i = 0;
- for(e = findchain(classname, "info_player_deathmatch"); e; e = e.chain)
- {
- org = e.origin;
- tracebox(e.origin, PL_MIN, PL_MAX, e.origin - '0 0 512', MOVE_NOMONSTERS, world);
- setorigin(e, trace_endpos);
- if(navigation_findnearestwaypoint(e, false))
- {
- setorigin(e, org);
- e.effects &= ~EF_NODEPTHTEST;
- e.model = "";
- }
- else
- {
- setorigin(e, org);
- LOG_INFO("spawn without waypoint: ", etos(e), " ", vtos(e.origin), "\n");
- e.effects |= EF_NODEPTHTEST;
- _setmodel(e, self.model);
- e.frame = self.frame;
- e.skin = self.skin;
- e.colormod = '8 0.5 8';
- setsize(e, '0 0 0', '0 0 0');
- ++i;
- }
- }
- if(i)
- LOG_INFO(ftos(i), " spawnpoints have no nearest waypoint (marked by player model)\n");
- i = 0;
- entity start;
- start = findchainflags(flags, FL_ITEM);
- for(e = start; e; e = e.chain)
- {
- e.effects &= ~(EF_NODEPTHTEST | EF_RED | EF_BLUE);
- e.colormod = '0.5 0.5 0.5';
- }
- for(e = start; e; e = e.chain)
- {
- if(navigation_findnearestwaypoint(e, false))
- {
- }
- else
- {
- LOG_INFO("item without waypoint: ", etos(e), " ", vtos(e.origin), "\n");
- e.effects |= EF_NODEPTHTEST | EF_RED;
- e.colormod_x = 8;
- ++i;
- }
- }
- if(i)
- LOG_INFO(ftos(i), " items have no nearest waypoint and cannot be walked away from (marked with red light)\n");
- i = 0;
- for(e = start; e; e = e.chain)
- {
- org = e.origin;
- if(navigation_findnearestwaypoint(e, true))
- {
- }
- else
- {
- LOG_INFO("item without waypoint: ", etos(e), " ", vtos(e.origin), "\n");
- e.effects |= EF_NODEPTHTEST | EF_BLUE;
- e.colormod_z = 8;
- ++i;
- }
- }
- if(i)
- LOG_INFO(ftos(i), " items have no nearest waypoint and cannot be walked to (marked with blue light)\n");
- break;
- }
- }
+ if (navigation_findnearestwaypoint(e, true)) continue;
+ LOG_INFO("item without waypoint: ", etos(e), " ", vtos(e.origin), "\n");
+ e.effects |= EF_NODEPTHTEST | EF_BLUE;
+ e.colormod_z = 8;
+ ++i;
}
+ if (i) LOG_INFOF("%d items have no nearest waypoint and cannot be walked to (marked with blue light)\n", i);
}
#ifndef CL_IMPULSE_H
#define CL_IMPULSE_H
-/*
- * Impulse map:
- *
- * 0 reserved (no input)
- * 1 to 9, 14: weapon shortcuts
- * 10: next weapon according to linear list
- * 11: most recently used weapon
- * 12: previous weapon according to linear list
- * 13: best weapon according to priority list
- * 15: next weapon according to priority list
- * 16: previous weapon according to priority list
- * 17: throw weapon
- * 18: next weapon according to sbar_hudselector 1 list
- * 19: previous weapon according to sbar_hudselector 1 list
- * 20: reload if needed
- *
- * 30 to 39: create waypoints
- * 47: clear personal waypoints
- * 48: clear team waypoints
- *
- * 99: loaded
- *
- * 140: moving clone
- * 141: ctf speedrun
- * 142: fixed clone
- * 143: emergency teleport
- * 148: unfairly eliminate
- *
- * TODO:
- * 200 to 209: prev weapon shortcuts
- * 210 to 219: best weapon shortcuts
- * 220 to 229: next weapon shortcuts
- * 230 to 253: individual weapons (up to 24)
- */
-
-void ImpulseCommands ();
+void ImpulseCommands(entity this);
#endif
if(DIFF_TEAM(self, attacker))
{
if(DEATH_ISSPECIAL(deathtype))
- awep = Weapons_from(attacker.weapon);
+ awep = PS(attacker).m_weapon;
else
awep = DEATH_WEAPONOF(deathtype);
valid_damage_for_weaponstats = 1;
{
dh = dh - max(self.health, 0);
da = da - max(self.armorvalue, 0);
- WeaponStats_LogDamage(awep.m_id, abot, self.weapon, vbot, dh + da);
+ WeaponStats_LogDamage(awep.m_id, abot, PS(self).m_weapon.m_id, vbot, dh + da);
MUTATOR_CALLHOOK(PlayerDamaged, attacker, self, dh, da, hitloc, deathtype);
}
}
if(valid_damage_for_weaponstats)
- WeaponStats_LogKill(awep.m_id, abot, self.weapon, vbot);
+ WeaponStats_LogKill(awep.m_id, abot, PS(self).m_weapon.m_id, vbot);
if(autocvar_sv_gentle < 1) // TODO make a "gentle" version?
if(sound_allowed(MSG_BROADCAST, attacker))
MUTATOR_CALLHOOK(PlayerDies, inflictor, attacker, self, deathtype);
excess = frag_damage;
- Weapon wep = Weapons_from(self.weapon);
+ Weapon wep = PS(self).m_weapon;
wep.wr_playerdeath(wep);
RemoveGrapplingHook(self);
// clear waypoints
WaypointSprite_PlayerDead();
// throw a weapon
- SpawnThrownWeapon (self.origin + (self.mins + self.maxs) * 0.5, self.switchweapon);
+ SpawnThrownWeapon (self.origin + (self.mins + self.maxs) * 0.5, PS(self).m_switchweapon.m_id);
// become fully visible
self.alpha = default_player_alpha;
#ifndef SERVER_COMMANDS_ALL_H
#define SERVER_COMMANDS_ALL_H
-#include "../../common/command/commands.qh"
+#include "../../common/command/command.qh"
+REGISTRY(SERVER_COMMANDS, BITS(7))
+#define SERVER_COMMANDS_from(i) _SERVER_COMMANDS_from(i, NULL)
+REGISTER_REGISTRY(SERVER_COMMANDS)
+REGISTRY_SORT(SERVER_COMMANDS)
+
+#define SERVER_COMMAND(id, description) \
+ CLASS(servercommand_##id, Command) \
+ ATTRIB(servercommand_##id, m_name, string, #id); \
+ ATTRIB(servercommand_##id, m_description, string, description); \
+ ENDCLASS(servercommand_##id) \
+ REGISTER(SERVER_COMMANDS, CMD_SV, id, m_id, NEW(servercommand_##id)); \
+ METHOD(servercommand_##id, m_invokecmd, void(int request, entity caller, int arguments, string command))
+
+STATIC_INIT(SERVER_COMMANDS_aliases) {
+ FOREACH(SERVER_COMMANDS, true, LAMBDA(localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_svcmd"))));
+}
#include "sv_cmd.qh"
entity selection = GetFilteredEntity(input);
float output;
- output = num_for_edict(selection);
+ output = etof(selection);
return output;
}
}
print_to(caller, sprintf(strreplace(" ", separator, " #%-3d %-20.20s %-5d %-3d %-9s %-16s %s "),
- num_for_edict(tmp_player),
+ etof(tmp_player),
tmp_player.netname,
tmp_player.ping,
tmp_player.ping_packetloss,
#ifndef COMMAND_COMMON_H
#define COMMAND_COMMON_H
+#include "../../common/command/command.qh"
+REGISTRY(COMMON_COMMANDS, BITS(7))
+#define COMMON_COMMANDS_from(i) _COMMON_COMMANDS_from(i, NULL)
+REGISTER_REGISTRY(COMMON_COMMANDS)
+REGISTRY_SORT(COMMON_COMMANDS)
+
+#define COMMON_COMMAND(id, description) \
+ CLASS(commoncommand_##id, Command) \
+ ATTRIB(commoncommand_##id, m_name, string, #id); \
+ ATTRIB(commoncommand_##id, m_description, string, description); \
+ ENDCLASS(commoncommand_##id) \
+ REGISTER(COMMON_COMMANDS, CMD_SV, id, m_id, NEW(commoncommand_##id)); \
+ METHOD(commoncommand_##id, m_invokecmd, void(int request, entity caller, int arguments, string command))
+
+STATIC_INIT(COMMON_COMMANDS_aliases) {
+ FOREACH(COMMON_COMMANDS, true, LAMBDA(localcmd(sprintf("alias %1$s \"%2$s %1$s ${* ?}\"\n", it.m_name, "qc_cmd_svcmd"))));
+}
+
#include "vote.qh"
#include "../../common/monsters/spawn.qh"
// ==================================
// Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;)
-#define COMMON_COMMANDS(request, caller, arguments, command) \
- COMMON_COMMAND("cvar_changes", CommonCommand_cvar_changes(request, caller), "Prints a list of all changed server cvars") \
- COMMON_COMMAND("cvar_purechanges", CommonCommand_cvar_purechanges(request, caller), "Prints a list of all changed gameplay cvars") \
- COMMON_COMMAND("editmob", CommonCommand_editmob(request, caller, arguments), "Modifies a monster or all monsters") \
- COMMON_COMMAND("info", CommonCommand_info(request, caller, arguments), "Request for unique server information set up by admin") \
- COMMON_COMMAND("ladder", CommonCommand_ladder(request, caller), "Get information about top players if supported") \
- COMMON_COMMAND("lsmaps", CommonCommand_lsmaps(request, caller), "List maps which can be used with the current game mode") \
- COMMON_COMMAND("printmaplist", CommonCommand_printmaplist(request, caller), "Display full server maplist reply") \
- COMMON_COMMAND("rankings", CommonCommand_rankings(request, caller), "Print information about rankings") \
- COMMON_COMMAND("records", CommonCommand_records(request, caller), "List top 10 records for the current map") \
- COMMON_COMMAND("teamstatus", CommonCommand_teamstatus(request, caller), "Show information about player and team scores") \
- COMMON_COMMAND("time", CommonCommand_time(request, caller), "Print different formats/readouts of time") \
- COMMON_COMMAND("timein", CommonCommand_timein(request, caller), "Resume the game from being paused with a timeout") \
- COMMON_COMMAND("timeout", CommonCommand_timeout(request, caller), "Call a timeout which pauses the game for certain amount of time unless unpaused") \
- COMMON_COMMAND("vote", VoteCommand(request, caller, arguments, command), "Request an action to be voted upon by players") \
- COMMON_COMMAND("who", CommonCommand_who(request, caller, arguments), "Display detailed client information about all players") \
- /* nothing */
+COMMON_COMMAND(cvar_changes, "Prints a list of all changed server cvars") { CommonCommand_cvar_changes(request, caller); }
+COMMON_COMMAND(cvar_purechanges, "Prints a list of all changed gameplay cvars") { CommonCommand_cvar_purechanges(request, caller); }
+COMMON_COMMAND(editmob, "Modifies a monster or all monsters") { CommonCommand_editmob(request, caller, arguments); }
+COMMON_COMMAND(info, "Request for unique server information set up by admin") { CommonCommand_info(request, caller, arguments); }
+COMMON_COMMAND(ladder, "Get information about top players if supported") { CommonCommand_ladder(request, caller); }
+COMMON_COMMAND(lsmaps, "List maps which can be used with the current game mode") { CommonCommand_lsmaps(request, caller); }
+COMMON_COMMAND(printmaplist, "Display full server maplist reply") { CommonCommand_printmaplist(request, caller); }
+COMMON_COMMAND(rankings, "Print information about rankings") { CommonCommand_rankings(request, caller); }
+COMMON_COMMAND(records, "List top 10 records for the current map") { CommonCommand_records(request, caller); }
+COMMON_COMMAND(teamstatus, "Show information about player and team scores") { CommonCommand_teamstatus(request, caller); }
+COMMON_COMMAND(time, "Print different formats/readouts of time") { CommonCommand_time(request, caller); }
+COMMON_COMMAND(timein, "Resume the game from being paused with a timeout") { CommonCommand_timein(request, caller); }
+COMMON_COMMAND(timeout, "Call a timeout which pauses the game for certain amount of time unless unpaused") { CommonCommand_timeout(request, caller); }
+COMMON_COMMAND(vote, "Request an action to be voted upon by players") { VoteCommand(request, caller, arguments, command); }
+COMMON_COMMAND(who, "Display detailed client information about all players") { CommonCommand_who(request, caller, arguments);}
void CommonCommand_macro_help(entity caller)
{
- #define COMMON_COMMAND(name, function, description) \
- { print_to(caller, strcat(" ^2", name, "^7: ", description)); }
-
- COMMON_COMMANDS(0, caller, 0, "");
-#undef COMMON_COMMAND
+ FOREACH(COMMON_COMMANDS, true, LAMBDA(print_to(caller, sprintf(" ^2%s^7: %s\n", it.m_name, it.m_description))));
}
float CommonCommand_macro_command(float argc, entity caller, string command)
{
- #define COMMON_COMMAND(name, function, description) \
- { if (name == strtolower(argv(0))) { function; return true; } }
-
- COMMON_COMMANDS(CMD_REQUEST_COMMAND, caller, argc, command);
-#undef COMMON_COMMAND
-
+ string c = strtolower(argv(0));
+ FOREACH(COMMON_COMMANDS, it.m_name == c, LAMBDA(
+ it.m_invokecmd(CMD_REQUEST_COMMAND, caller, argc, command);
+ return true;
+ ));
return false;
}
float CommonCommand_macro_usage(float argc, entity caller)
{
- #define COMMON_COMMAND(name, function, description) \
- { if (name == strtolower(argv(1))) { function; return true; } }
-
- COMMON_COMMANDS(CMD_REQUEST_USAGE, caller, argc, "");
-#undef COMMON_COMMAND
-
+ string c = strtolower(argv(1));
+ FOREACH(COMMON_COMMANDS, it.m_name == c, LAMBDA(
+ it.m_invokecmd(CMD_REQUEST_USAGE, caller, argc, "");
+ return true;
+ ));
return false;
}
void CommonCommand_macro_write_aliases(float fh)
{
- #define COMMON_COMMAND(name, function, description) \
- { CMD_Write_Alias("qc_cmd_svcmd", name, description); }
-
- COMMON_COMMANDS(0, world, 0, "");
-#undef COMMON_COMMAND
+ FOREACH(COMMON_COMMANDS, true, LAMBDA(CMD_Write_Alias("qc_cmd_svcmd", it.m_name, it.m_description)));
}
-#include "../../common/command/command.qh"
-#include "sv_cmd.qh"
+#include "all.qh"
#include "banning.qh"
#include "cmd.qh"
FOR_EACH_CLIENT(client)
{
- argc = tokenize_console(strcat("defer_clear ", ftos(num_for_edict(client))));
+ argc = tokenize_console(strcat("defer_clear ", ftos(etof(client))));
GameCommand_defer_clear(CMD_REQUEST_COMMAND, argc);
++i;
}
}
else
{
- shuffleteams_players[i] = num_for_edict(tmp_player);
+ shuffleteams_players[i] = etof(tmp_player);
break;
}
}
if (argc >= 2)
{
CampaignLevelWarp(stof(argv(1)));
- LOG_INFO("Successfully warped to campaign level ", stof(argv(1)), ".\n");
+ LOG_INFO("Successfully warped to campaign level ", argv(1), ".\n");
}
else
{
// ==================================
// Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;)
-#define SERVER_COMMANDS(request, arguments, command) \
- SERVER_COMMAND("adminmsg", GameCommand_adminmsg(request, arguments), "Send an admin message to a client directly") \
- SERVER_COMMAND("allready", GameCommand_allready(request), "Restart the server and reset the players") \
- SERVER_COMMAND("allspec", GameCommand_allspec(request, arguments), "Force all players to spectate") \
- SERVER_COMMAND("anticheat", GameCommand_anticheat(request, arguments), "Create an anticheat report for a client") \
- SERVER_COMMAND("animbench", GameCommand_animbench(request, arguments), "Benchmark model animation (LAGS)") \
- SERVER_COMMAND("bbox", GameCommand_bbox(request), "Print detailed information about world size") \
- SERVER_COMMAND("bot_cmd", GameCommand_bot_cmd(request, arguments, command), "Control and send commands to bots") \
- SERVER_COMMAND("cointoss", GameCommand_cointoss(request, arguments), "Flip a virtual coin and give random result") \
- SERVER_COMMAND("database", GameCommand_database(request, arguments), "Extra controls of the serverprogs database") \
- SERVER_COMMAND("defer_clear", GameCommand_defer_clear(request, arguments), "Clear all queued defer commands for a specific client") \
- SERVER_COMMAND("defer_clear_all", GameCommand_defer_clear_all(request), "Clear all queued defer commands for all clients") \
- SERVER_COMMAND("delrec", GameCommand_delrec(request, arguments), "Delete race time record for a map") \
- SERVER_COMMAND("effectindexdump", GameCommand_effectindexdump(request), "Dump list of effects from code and effectinfo.txt") \
- SERVER_COMMAND("extendmatchtime", GameCommand_extendmatchtime(request), "Increase the timelimit value incrementally") \
- SERVER_COMMAND("find", GameCommand_find(request, arguments), "Search through entities for matching classname") \
- SERVER_COMMAND("gametype", GameCommand_gametype(request, arguments), "Simple command to change the active gametype") \
- SERVER_COMMAND("gettaginfo", GameCommand_gettaginfo(request, arguments), "Get specific information about a weapon model") \
- SERVER_COMMAND("gotomap", GameCommand_gotomap(request, arguments), "Simple command to switch to another map") \
- SERVER_COMMAND("lockteams", GameCommand_lockteams(request), "Disable the ability for players to switch or enter teams") \
- SERVER_COMMAND("make_mapinfo", GameCommand_make_mapinfo(request), "Automatically rebuild mapinfo files") \
- SERVER_COMMAND("moveplayer", GameCommand_moveplayer(request, arguments), "Change the team/status of a player") \
- SERVER_COMMAND("nospectators", GameCommand_nospectators(request), "Automatically remove spectators from a match") \
- SERVER_COMMAND("playerdemo", GameCommand_playerdemo(request, arguments), "Control the ability to save demos of players") \
- SERVER_COMMAND("printstats", GameCommand_printstats(request), "Dump eventlog player stats and other score information") \
- SERVER_COMMAND("radarmap", GameCommand_radarmap(request, arguments), "Generate a radar image of the map") \
- SERVER_COMMAND("reducematchtime", GameCommand_reducematchtime(request), "Decrease the timelimit value incrementally") \
- SERVER_COMMAND("setbots", GameCommand_setbots(request, arguments), "Adjust how many bots are in the match") \
- SERVER_COMMAND("shuffleteams", GameCommand_shuffleteams(request), "Randomly move players to different teams") \
- SERVER_COMMAND("stuffto", GameCommand_stuffto(request, arguments), "Send a command to be executed on a client") \
- SERVER_COMMAND("trace", GameCommand_trace(request, arguments), "Various debugging tools with tracing") \
- SERVER_COMMAND("unlockteams", GameCommand_unlockteams(request), "Enable the ability for players to switch or enter teams") \
- SERVER_COMMAND("warp", GameCommand_warp(request, arguments), "Choose different level in campaign") \
- /* nothing */
+SERVER_COMMAND(adminmsg, "Send an admin message to a client directly") { GameCommand_adminmsg(request, arguments); }
+SERVER_COMMAND(allready, "Restart the server and reset the players") { GameCommand_allready(request); }
+SERVER_COMMAND(allspec, "Force all players to spectate") { GameCommand_allspec(request, arguments); }
+SERVER_COMMAND(anticheat, "Create an anticheat report for a client") { GameCommand_anticheat(request, arguments); }
+SERVER_COMMAND(animbench, "Benchmark model animation (LAGS)") { GameCommand_animbench(request, arguments); }
+SERVER_COMMAND(bbox, "Print detailed information about world size") { GameCommand_bbox(request); }
+SERVER_COMMAND(bot_cmd, "Control and send commands to bots") { GameCommand_bot_cmd(request, arguments, command); }
+SERVER_COMMAND(cointoss, "Flip a virtual coin and give random result") { GameCommand_cointoss(request, arguments); }
+SERVER_COMMAND(database, "Extra controls of the serverprogs database") { GameCommand_database(request, arguments); }
+SERVER_COMMAND(defer_clear, "Clear all queued defer commands for a specific client") { GameCommand_defer_clear(request, arguments); }
+SERVER_COMMAND(defer_clear_all, "Clear all queued defer commands for all clients") { GameCommand_defer_clear_all(request); }
+SERVER_COMMAND(delrec, "Delete race time record for a map") { GameCommand_delrec(request, arguments); }
+SERVER_COMMAND(effectindexdump, "Dump list of effects from code and effectinfo.txt") { GameCommand_effectindexdump(request); }
+SERVER_COMMAND(extendmatchtime, "Increase the timelimit value incrementally") { GameCommand_extendmatchtime(request); }
+SERVER_COMMAND(find, "Search through entities for matching classname") { GameCommand_find(request, arguments); }
+SERVER_COMMAND(gametype, "Simple command to change the active gametype") { GameCommand_gametype(request, arguments); }
+SERVER_COMMAND(gettaginfo, "Get specific information about a weapon model") { GameCommand_gettaginfo(request, arguments); }
+SERVER_COMMAND(gotomap, "Simple command to switch to another map") { GameCommand_gotomap(request, arguments); }
+SERVER_COMMAND(lockteams, "Disable the ability for players to switch or enter teams") { GameCommand_lockteams(request); }
+SERVER_COMMAND(make_mapinfo, "Automatically rebuild mapinfo files") { GameCommand_make_mapinfo(request); }
+SERVER_COMMAND(moveplayer, "Change the team/status of a player") { GameCommand_moveplayer(request, arguments); }
+SERVER_COMMAND(nospectators, "Automatically remove spectators from a match") { GameCommand_nospectators(request); }
+SERVER_COMMAND(playerdemo, "Control the ability to save demos of players") { GameCommand_playerdemo(request, arguments); }
+SERVER_COMMAND(printstats, "Dump eventlog player stats and other score information") { GameCommand_printstats(request); }
+SERVER_COMMAND(radarmap, "Generate a radar image of the map") { GameCommand_radarmap(request, arguments); }
+SERVER_COMMAND(reducematchtime, "Decrease the timelimit value incrementally") { GameCommand_reducematchtime(request); }
+SERVER_COMMAND(setbots, "Adjust how many bots are in the match") { GameCommand_setbots(request, arguments); }
+SERVER_COMMAND(shuffleteams, "Randomly move players to different teams") { GameCommand_shuffleteams(request); }
+SERVER_COMMAND(stuffto, "Send a command to be executed on a client") { GameCommand_stuffto(request, arguments); }
+SERVER_COMMAND(trace, "Various debugging tools with tracing") { GameCommand_trace(request, arguments); }
+SERVER_COMMAND(unlockteams, "Enable the ability for players to switch or enter teams") { GameCommand_unlockteams(request); }
+SERVER_COMMAND(warp, "Choose different level in campaign") { GameCommand_warp(request, arguments); }
void GameCommand_macro_help()
{
- #define SERVER_COMMAND(name, function, description) \
- { LOG_INFO(" ^2", name, "^7: ", description, "\n"); }
-
- SERVER_COMMANDS(0, 0, "");
-#undef SERVER_COMMAND
+ FOREACH(SERVER_COMMANDS, true, LAMBDA(LOG_INFOF(" ^2%s^7: %s\n", it.m_name, it.m_description)));
}
float GameCommand_macro_command(float argc, string command)
{
- #define SERVER_COMMAND(name, function, description) \
- { if (name == strtolower(argv(0))) { function; return true; } }
-
- SERVER_COMMANDS(CMD_REQUEST_COMMAND, argc, command);
-#undef SERVER_COMMAND
-
+ string c = strtolower(argv(0));
+ FOREACH(SERVER_COMMANDS, it.m_name == c, LAMBDA(
+ it.m_invokecmd(CMD_REQUEST_COMMAND, NULL, argc, command);
+ return true;
+ ));
return false;
}
float GameCommand_macro_usage(float argc)
{
- #define SERVER_COMMAND(name, function, description) \
- { if (name == strtolower(argv(1))) { function; return true; } }
-
- SERVER_COMMANDS(CMD_REQUEST_USAGE, argc, "");
-#undef SERVER_COMMAND
-
+ string c = strtolower(argv(1));
+ FOREACH(SERVER_COMMANDS, it.m_name == c, LAMBDA(
+ it.m_invokecmd(CMD_REQUEST_USAGE, NULL, argc, "");
+ return true;
+ ));
return false;
}
void GameCommand_macro_write_aliases(float fh)
{
- #define SERVER_COMMAND(name, function, description) \
- { CMD_Write_Alias("qc_cmd_sv", name, description); }
-
- SERVER_COMMANDS(0, 0, "");
-#undef SERVER_COMMAND
+ FOREACH(SERVER_COMMANDS, true, LAMBDA(CMD_Write_Alias("qc_cmd_sv", it.m_name, it.m_description)));
}
if (first_command == "kickban") command_arguments = strcat(ftos(autocvar_g_ban_default_bantime), " ", ftos(autocvar_g_ban_default_masksize), " ~");
else command_arguments = reason;
- vote_parsed_command = strcat(first_command, " # ", ftos(num_for_edict(victim)), " ", command_arguments);
+ vote_parsed_command = strcat(first_command, " # ", ftos(etof(victim)), " ", command_arguments);
vote_parsed_display = strcat("^1", vote_command, " (^7", victim.netname, "^1): ", reason);
}
else { print_to(caller, strcat("vcall: ", GetClientErrorString(accepted, argv(startpos + 1)), ".\n")); return false; }
// WEAPONTODO
.float autoswitch;
-float client_hasweapon(entity cl, float wpn, float andammo, float complain);
+bool client_hasweapon(entity cl, Weapon wpn, float andammo, bool complain);
void w_clear(Weapon thiswep, entity actor, .entity weaponentity, int fire);
void w_ready(Weapon thiswep, entity actor, .entity weaponentity, int fire);
// VorteX: standalone think for weapons, so normal think on weaponentity can be reserved by weaponflashes (which needs update even player dies)
#else
#define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).attack_finished_single[slot])
#endif
-#define ATTACK_FINISHED(ent, slot) ATTACK_FINISHED_FOR(ent, (ent).weapon, slot)
+#define ATTACK_FINISHED(ent, slot) ATTACK_FINISHED_FOR(ent, PS(ent).m_weapon.m_id, slot)
// assault game mode: Which team is attacking in this round?
float assault_attacker_team;
{
// after a frag, exchange the current weapon (or the culprit, if detectable) by a new random weapon
Weapon culprit = DEATH_WEAPONOF(deathtype);
- if(!culprit) culprit = Weapons_from(attacker.weapon);
- else if(!(attacker.weapons & (culprit.m_wepset))) culprit = Weapons_from(attacker.weapon);
+ if(!culprit) culprit = PS(attacker).m_weapon;
+ else if(!(attacker.weapons & (culprit.m_wepset))) culprit = PS(attacker).m_weapon;
if(g_weaponarena_random_with_blaster && culprit == WEP_BLASTER) // WEAPONTODO: Shouldn't this be in a mutator?
{
}
// after a frag, choose another random weapon set
- if (!(attacker.weapons & WepSet_FromWeapon(Weapons_from(attacker.weapon))))
+ if (!(attacker.weapons & WepSet_FromWeapon(PS(attacker).m_weapon)))
W_SwitchWeapon_Force(attacker, w_getbestweapon(attacker));
}
string AppendItemcodes(string s, entity player)
{
- float w;
- w = player.weapon;
+ int w = PS(player).m_weapon.m_id;
//if(w == 0)
// w = player.switchweapon;
if(w == 0)
void UpdateFrags(entity player, float f);
// NOTE: f=0 means still count as a (positive) kill, but count no frags for it
-void W_SwitchWeapon_Force(entity e, float w);
+void W_SwitchWeapon_Force(entity e, Weapon w);
entity GiveFrags_randomweapons;
void GiveFrags (entity attacker, entity targ, float f, int deathtype);
WriteByte(MSG_ENTITY, sf);
if(sf & 1)
{
- WriteByte(MSG_ENTITY, num_for_edict(self.realowner));
+ WriteByte(MSG_ENTITY, etof(self.realowner));
}
if(sf & 2)
{
setself(e_);
antilag_record(e_, altime);
}
+ FOREACH_CLIENT(PS(it), {
+ PlayerState s = PS(it);
+ s.ps_push(s, it);
+ });
}
if(world_initialized > 0)
{
world_initialized = 0;
- LOG_INFO("Saving persistent data...\n");
+ LOG_TRACE("Saving persistent data...\n");
Ban_SaveBans();
// playerstats with unfinished match
CheatShutdown(); // must be after cheatcount check
db_close(ServerProgsDB);
db_close(TemporaryDB);
- LOG_INFO("done!\n");
+ LOG_TRACE("Saving persistent data... done!\n");
// tell the bot system the game is ending now
bot_endgame();
case "l": replacement = NearestLocation(self.origin); break;
case "y": replacement = NearestLocation(cursor); break;
case "d": replacement = NearestLocation(self.death_origin); break;
- case "w": replacement = WEP_NAME(((!self.weapon) ? (!self.switchweapon ? self.cnt : self.switchweapon) : self.weapon)); break;
+ case "w": replacement = ((PS(self).m_weapon == WEP_Null) ? ((PS(self).m_switchweapon == WEP_Null) ? Weapons_from(self.cnt) : PS(self).m_switchweapon) : PS(self).m_weapon).m_name; break;
case "W": replacement = ammoitems; break;
case "x": replacement = ((cursor_ent.netname == "" || !cursor_ent) ? "nothing" : cursor_ent.netname); break;
case "s": replacement = ftos(vlen(self.velocity - self.velocity_z * '0 0 1')); break;
self.weaponorder_byimpulse = strzone(W_FixWeaponOrder_BuildImpulseList(o));
return o;
}
-void GetCvars(float f)
+
+/**
+ * @param f -1: cleanup, 0: request, 1: receive
+ */
+void GetCvars(int f)
{SELFPARAM();
string s = string_null;
if (f > 0)
{
if (s == "cl_weaponpriority")
- self.switchweapon = w_getbestweapon(self);
+ if (PS(self)) PS(self).m_switchweapon = w_getbestweapon(self);
if (s == "cl_allow_uidtracking")
PlayerStats_GameReport_AddPlayer(self);
}
float want_weapon(entity weaponinfo, float allguns) // WEAPONTODO: what still needs done?
{
- int i = weaponinfo.weapon;
+ int i = weaponinfo.m_id;
int d = 0;
bool allow_mutatorblocked = false;
}
void precache_all_playermodels(string pattern)
{
- float globhandle, i, n;
- string f;
-
- globhandle = search_begin(pattern, true, false);
- if (globhandle < 0)
- return;
- n = search_getsize(globhandle);
- for (i = 0; i < n; ++i)
+ int globhandle = search_begin(pattern, true, false);
+ if (globhandle < 0) return;
+ int n = search_getsize(globhandle);
+ for (int i = 0; i < n; ++i)
{
- //print(search_getfilename(globhandle, i), "\n");
- f = search_getfilename(globhandle, i);
- precache_playermodel(f);
+ string s = search_getfilename(globhandle, i);
+ precache_playermodel(s);
}
search_end(globhandle);
}
void precache_playermodels(string s)
{
- if(s != "")
- {
- int n = tokenize_console(s);
- precache_playermodel(argv(0));
-
- for (int i = 1; i < n; ++i)
- precache_model(argv(i));
- }
+ FOREACH_WORD(s, true, LAMBDA(precache_playermodel(it)));
}
void precache()
if(trace_dphitcontents == 0)
{
//dprint("A hit happened with zero hit contents... DEBUG THIS, this should never happen for projectiles! Projectile will self-destruct.\n");
- LOG_TRACEF("A hit from a projectile happened with no hit contents! DEBUG THIS, this should never happen for projectiles! Profectile will self-destruct. (edict: %d, classname: %s, origin: %s)\n", num_for_edict(self), self.classname, vtos(self.origin));
+ LOG_TRACEF("A hit from a projectile happened with no hit contents! DEBUG THIS, this should never happen for projectiles! Profectile will self-destruct. (edict: %d, classname: %s, origin: %s)\n", etof(self), self.classname, vtos(self.origin));
checkclient();
}
if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
ctf_CheckFlagReturn(self, RETURN_SPEEDRUN);
setself(self.owner);
- self.impulse = CHIMPULSE_SPEEDRUN; // move the player back to the waypoint they set
- ImpulseCommands();
+ self.impulse = CHIMPULSE_SPEEDRUN.impulse; // move the player back to the waypoint they set
+ ImpulseCommands(self);
setself(this);
}
if(autocvar_g_ctf_stalemate)
// if no teams are found, spawn defaults
if(find(world, classname, "ctf_team") == world)
{
- LOG_INFO("No \"ctf_team\" entities found on this map, creating them anyway.\n");
+ LOG_TRACE("No \"ctf_team\" entities found on this map, creating them anyway.\n");
ctf_SpawnTeam("Red", NUM_TEAM_1 - 1);
ctf_SpawnTeam("Blue", NUM_TEAM_2 - 1);
if(ctf_teams >= 3)
MUTATOR_HOOKFUNCTION(cts, WantWeapon)
{
- ret_float = (want_weaponinfo.weapon == WEP_SHOTGUN.m_id);
+ ret_float = (want_weaponinfo == WEP_SHOTGUN);
want_mutatorblocked = true;
return true;
}
// if no teams are found, spawn defaults
if(find(world, classname, "dom_team") == world || autocvar_g_domination_teams_override >= 2)
{
- LOG_INFO("No \"dom_team\" entities found on this map, creating them anyway.\n");
+ LOG_TRACE("No \"dom_team\" entities found on this map, creating them anyway.\n");
domination_teams = bound(2, ((autocvar_g_domination_teams_override < 2) ? autocvar_g_domination_default_teams : autocvar_g_domination_teams_override), 4);
dom_spawnteams(domination_teams);
}
// if no teams are found, spawn defaults
if(find(world, classname, "tdm_team") == world)
{
- LOG_INFO("No \"tdm_team\" entities found on this map, creating them anyway.\n");
+ LOG_TRACE("No \"tdm_team\" entities found on this map, creating them anyway.\n");
int numteams = min(4, autocvar_g_tdm_teams_override);
PLAYERDEMO_FIELD(func,string,playerskin) \
PLAYERDEMO_FIELD(func,float,frame) \
PLAYERDEMO_FIELD(func,float,effects) \
- PLAYERDEMO_FIELD(func,float,switchweapon) \
+ /* PLAYERDEMO_FIELD(func,float,switchweapon) */ \
PLAYERDEMO_FIELD(func,float,BUTTON_ATCK) \
PLAYERDEMO_FIELD(func,float,BUTTON_ATCK2) \
PLAYERDEMO_FIELD(func,float,BUTTON_CROUCH) \
#include "../common/deathtypes/all.qc"
#include "../common/effects/all.qc"
#include "../common/gamemodes/all.qc"
+#include "../common/impulses/all.qc"
#include "../common/items/all.qc"
#include "../common/monsters/all.qc"
#include "../common/turrets/all.qc"
+++ /dev/null
-../../progs.dat
-progs.inc
float i, p, longflags;
WriteHeader(MSG_ENTITY, ENT_CLIENT_TEAMSCORES);
- WriteByte(MSG_ENTITY, self.team - 1);
+ int t = this.team - 1;
+ assert(t, eprint(this));
+ WriteByte(MSG_ENTITY, t);
longflags = 0;
for(i = 0, p = 1; i < MAX_TEAMSCORE; ++i, p *= 2)
float i, p, longflags;
WriteHeader(MSG_ENTITY, ENT_CLIENT_SCORES);
- WriteByte(MSG_ENTITY, num_for_edict(self.owner));
+ WriteByte(MSG_ENTITY, etof(self.owner));
longflags = 0;
for(i = 0, p = 1; i < MAX_SCORE; ++i, p *= 2)
}
if (result.x == 0 && strict)
- result.x = num_for_edict(t1.owner) - num_for_edict(t2.owner);
+ result.x = etof(t1.owner) - etof(t2.owner);
return result.x;
}
if(autocvar_g_spawn_alloweffects)
{
- WriteByte(MSG_ENTITY, num_for_edict(self.owner));
+ WriteByte(MSG_ENTITY, etof(self.owner));
WriteShort(MSG_ENTITY, self.owner.origin.x);
WriteShort(MSG_ENTITY, self.owner.origin.y);
WriteShort(MSG_ENTITY, self.owner.origin.z);
float DoesQ3ARemoveThisEntity();
void SV_OnEntityPreSpawnFunction()
{SELFPARAM();
+ __spawnfunc_expect = this;
if (self)
if (self.gametypefilter != "")
if (!isGametypeInFilter(MapInfo_LoadedGametype, teamplay, have_team_spawns, self.gametypefilter))
do {
{
entity wi = Weapons_from(self.weapon);
- if (wi.m_id) {
+ if (wi != WEP_Null) {
entity wp = WaypointSprite_Spawn(WP_Weapon, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_Weapon);
wp.wp_extra = wi.m_id;
break;
}
{
entity ii = self.itemdef;
- if (ii.m_id) {
+ if (ii != NULL) {
entity wp = WaypointSprite_Spawn(WP_Item, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_Item);
wp.wp_extra = ii.m_id;
break;
// if the player is using their best weapon before items are given, they
// probably want to switch to an even better weapon after items are given
if (player.autoswitch)
- if (player.switchweapon == w_getbestweapon(player))
+ if (PS(player).m_switchweapon == w_getbestweapon(player))
_switchweapon = true;
- if (!(player.weapons & WepSet_FromWeapon(Weapons_from(player.switchweapon))))
+ if (!(player.weapons & WepSet_FromWeapon(PS(player).m_switchweapon)))
_switchweapon = true;
pickedup |= Item_GiveAmmoTo(item, player, ammo_fuel, g_pickup_fuel_max, ITEM_MODE_FUEL);
// crude hack to enforce switching weapons
if(g_cts && item.itemdef.instanceOfWeaponPickup)
{
- W_SwitchWeapon_Force(player, item.weapon);
+ W_SwitchWeapon_Force(player, Weapons_from(item.weapon));
return 1;
}
if (_switchweapon)
- if (player.switchweapon != w_getbestweapon(player))
+ if (PS(player).m_switchweapon != w_getbestweapon(player))
W_SwitchWeapon_Force(player, w_getbestweapon(player));
return 1;
spawnfunc(item_rockets)
{
- if(!self.ammo_rockets)
- self.ammo_rockets = g_pickup_rockets;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_ammo_anyway;
+ if(!this.ammo_rockets)
+ this.ammo_rockets = g_pickup_rockets;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_ammo_anyway;
StartItem(this, ITEM_Rockets);
}
{
if(!weaponswapping)
if(autocvar_sv_q3acompat_machineshotgunswap)
- if(self.classname != "droppedweapon")
+ if(this.classname != "droppedweapon")
{
weaponswapping = true;
spawnfunc_item_shells(this);
return;
}
- if(!self.ammo_nails)
- self.ammo_nails = g_pickup_nails;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_ammo_anyway;
+ if(!this.ammo_nails)
+ this.ammo_nails = g_pickup_nails;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_ammo_anyway;
StartItem(this, ITEM_Bullets);
}
spawnfunc(item_cells)
{
- if(!self.ammo_cells)
- self.ammo_cells = g_pickup_cells;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_ammo_anyway;
+ if(!this.ammo_cells)
+ this.ammo_cells = g_pickup_cells;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_ammo_anyway;
StartItem(this, ITEM_Cells);
}
spawnfunc(item_plasma)
{
- if(!self.ammo_plasma)
- self.ammo_plasma = g_pickup_plasma;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_ammo_anyway;
+ if(!this.ammo_plasma)
+ this.ammo_plasma = g_pickup_plasma;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_ammo_anyway;
StartItem(this, ITEM_Plasma);
}
{
if(!weaponswapping)
if(autocvar_sv_q3acompat_machineshotgunswap)
- if(self.classname != "droppedweapon")
+ if(this.classname != "droppedweapon")
{
weaponswapping = true;
spawnfunc_item_bullets(this);
return;
}
- if(!self.ammo_shells)
- self.ammo_shells = g_pickup_shells;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_ammo_anyway;
+ if(!this.ammo_shells)
+ this.ammo_shells = g_pickup_shells;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_ammo_anyway;
StartItem(this, ITEM_Shells);
}
spawnfunc(item_armor_small)
{
- if(!self.armorvalue)
- self.armorvalue = g_pickup_armorsmall;
- if(!self.max_armorvalue)
- self.max_armorvalue = g_pickup_armorsmall_max;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_armorsmall_anyway;
+ if(!this.armorvalue)
+ this.armorvalue = g_pickup_armorsmall;
+ if(!this.max_armorvalue)
+ this.max_armorvalue = g_pickup_armorsmall_max;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_armorsmall_anyway;
StartItem(this, ITEM_ArmorSmall);
}
spawnfunc(item_armor_medium)
{
- if(!self.armorvalue)
- self.armorvalue = g_pickup_armormedium;
- if(!self.max_armorvalue)
- self.max_armorvalue = g_pickup_armormedium_max;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_armormedium_anyway;
+ if(!this.armorvalue)
+ this.armorvalue = g_pickup_armormedium;
+ if(!this.max_armorvalue)
+ this.max_armorvalue = g_pickup_armormedium_max;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_armormedium_anyway;
StartItem(this, ITEM_ArmorMedium);
}
spawnfunc(item_armor_big)
{
- if(!self.armorvalue)
- self.armorvalue = g_pickup_armorbig;
- if(!self.max_armorvalue)
- self.max_armorvalue = g_pickup_armorbig_max;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_armorbig_anyway;
+ if(!this.armorvalue)
+ this.armorvalue = g_pickup_armorbig;
+ if(!this.max_armorvalue)
+ this.max_armorvalue = g_pickup_armorbig_max;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_armorbig_anyway;
StartItem(this, ITEM_ArmorLarge);
}
spawnfunc(item_armor_large)
{
- if(!self.armorvalue)
- self.armorvalue = g_pickup_armorlarge;
- if(!self.max_armorvalue)
- self.max_armorvalue = g_pickup_armorlarge_max;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_armorlarge_anyway;
+ if(!this.armorvalue)
+ this.armorvalue = g_pickup_armorlarge;
+ if(!this.max_armorvalue)
+ this.max_armorvalue = g_pickup_armorlarge_max;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_armorlarge_anyway;
StartItem(this, ITEM_ArmorMega);
}
spawnfunc(item_health_small)
{
- if(!self.max_health)
- self.max_health = g_pickup_healthsmall_max;
- if(!self.health)
- self.health = g_pickup_healthsmall;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_healthsmall_anyway;
+ if(!this.max_health)
+ this.max_health = g_pickup_healthsmall_max;
+ if(!this.health)
+ this.health = g_pickup_healthsmall;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_healthsmall_anyway;
StartItem(this, ITEM_HealthSmall);
}
spawnfunc(item_health_medium)
{
- if(!self.max_health)
- self.max_health = g_pickup_healthmedium_max;
- if(!self.health)
- self.health = g_pickup_healthmedium;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_healthmedium_anyway;
+ if(!this.max_health)
+ this.max_health = g_pickup_healthmedium_max;
+ if(!this.health)
+ this.health = g_pickup_healthmedium;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_healthmedium_anyway;
StartItem(this, ITEM_HealthMedium);
}
spawnfunc(item_health_large)
{
- if(!self.max_health)
- self.max_health = g_pickup_healthlarge_max;
- if(!self.health)
- self.health = g_pickup_healthlarge;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_healthlarge_anyway;
+ if(!this.max_health)
+ this.max_health = g_pickup_healthlarge_max;
+ if(!this.health)
+ this.health = g_pickup_healthlarge;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_healthlarge_anyway;
StartItem(this, ITEM_HealthLarge);
}
spawnfunc(item_health_mega)
{
- if(!self.max_health)
- self.max_health = g_pickup_healthmega_max;
- if(!self.health)
- self.health = g_pickup_healthmega;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_healthmega_anyway;
+ if(!this.max_health)
+ this.max_health = g_pickup_healthmega_max;
+ if(!this.health)
+ this.health = g_pickup_healthmega;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_healthmega_anyway;
StartItem(this, ITEM_HealthMega);
}
spawnfunc(item_strength)
{
- if(!self.strength_finished)
- self.strength_finished = autocvar_g_balance_powerup_strength_time;
+ if(!this.strength_finished)
+ this.strength_finished = autocvar_g_balance_powerup_strength_time;
StartItem(this, ITEM_Strength);
}
spawnfunc(item_invincible)
{
- if(!self.invincible_finished)
- self.invincible_finished = autocvar_g_balance_powerup_invincible_time;
+ if(!this.invincible_finished)
+ this.invincible_finished = autocvar_g_balance_powerup_invincible_time;
StartItem(this, ITEM_Shield);
}
// compatibility:
-spawnfunc(item_quad) { self.classname = "item_strength";spawnfunc_item_strength(this);}
+spawnfunc(item_quad) { this.classname = "item_strength";spawnfunc_item_strength(this);}
void target_items_use()
{SELFPARAM();
{
self.weapons |= (e.m_wepset);
if(self.spawnflags == 0 || self.spawnflags == 2) {
- Weapon w = Weapons_from(e.weapon);
- w.wr_init(w);
+ e.wr_init(e);
}
break;
}
for(j = WEP_FIRST; j <= WEP_LAST; ++j)
{
e = Weapons_from(j);
- if(e.weapon)
- self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, !!(self.weapons & (e.m_wepset)), e.netname);
+ if(e == WEP_Null) continue;
+ self.netname = sprintf("%s %s%d %s", self.netname, itemprefix, !!(self.weapons & (e.m_wepset)), e.netname);
}
}
self.netname = strzone(self.netname);
e = Weapons_from(j);
if(argv(i) == e.netname)
{
- Weapon w = Weapons_from(e.weapon);
- w.wr_init(w);
+ e.wr_init(e);
break;
}
}
spawnfunc(item_fuel)
{
- if(!self.ammo_fuel)
- self.ammo_fuel = g_pickup_fuel;
- if(!self.pickup_anyway)
- self.pickup_anyway = g_pickup_ammo_anyway;
+ if(!this.ammo_fuel)
+ this.ammo_fuel = g_pickup_fuel;
+ if(!this.pickup_anyway)
+ this.pickup_anyway = g_pickup_ammo_anyway;
StartItem(this, ITEM_JetpackFuel);
}
spawnfunc(item_jetpack)
{
- if(!self.ammo_fuel)
- self.ammo_fuel = g_pickup_fuel_jetpack;
+ if(!this.ammo_fuel)
+ this.ammo_fuel = g_pickup_fuel_jetpack;
if(start_items & ITEM_Jetpack.m_itemid)
{
spawnfunc_item_fuel(this);
_switchweapon = false;
if (e.autoswitch)
- if (e.switchweapon == w_getbestweapon(e))
+ if (PS(e).m_switchweapon == w_getbestweapon(e))
_switchweapon = true;
e.strength_finished = max(0, e.strength_finished - time);
for(j = WEP_FIRST; j <= WEP_LAST; ++j)
{
wi = Weapons_from(j);
- if(wi.weapon)
- if (!(wi.spawnflags & WEP_FLAG_MUTATORBLOCKED))
- got += GiveWeapon(e, j, op, val);
+ if(wi == WEP_Null) continue;
+ if (!(wi.spawnflags & WEP_FLAG_MUTATORBLOCKED))
+ got += GiveWeapon(e, j, op, val);
}
case "allammo":
got += GiveValue(e, ammo_cells, op, val);
for(j = WEP_FIRST; j <= WEP_LAST; ++j)
{
wi = Weapons_from(j);
- if(wi.weapon)
- {
- POSTGIVE_WEAPON(e, Weapons_from(j), SND(WEAPONPICKUP), string_null);
- if (!(save_weapons & (wi.m_wepset)))
- if(e.weapons & (wi.m_wepset)) {
- Weapon w = Weapons_from(wi.weapon);
- w.wr_init(w);
- }
- }
+ if (wi == WEP_Null) continue;
+ POSTGIVE_WEAPON(e, Weapons_from(j), SND(WEAPONPICKUP), string_null);
+ if (!(save_weapons & (wi.m_wepset)))
+ if(e.weapons & (wi.m_wepset)) {
+ wi.wr_init(wi);
+ }
}
POSTGIVE_VALUE(e, strength_finished, 1, SND(POWERUP), SND(POWEROFF));
POSTGIVE_VALUE(e, invincible_finished, 1, "misc/powerup_shield.wav", SND(POWEROFF));
else
e.superweapons_finished += time;
- if (!(e.weapons & WepSet_FromWeapon(Weapons_from(e.switchweapon))))
+ if (!(e.weapons & WepSet_FromWeapon(PS(e).m_switchweapon)))
_switchweapon = true;
if(_switchweapon)
W_SwitchWeapon_Force(e, w_getbestweapon(e));
antilag_takeback(trace_ent, time - lag);
hitplot = W_HitPlotNormalizedUntransform(org, trace_ent, screenforward, screenright, screenup, trace_endpos);
antilag_restore(trace_ent);
- fputs(player.hitplotfh, strcat(ftos(hitplot.x), " ", ftos(hitplot.y), " ", ftos(hitplot.z), " ", ftos(player.switchweapon), "\n"));
+ fputs(player.hitplotfh, strcat(ftos(hitplot.x), " ", ftos(hitplot.y), " ", ftos(hitplot.z), " ", ftos(PS(player).m_switchweapon.m_id), "\n"));
//print(strcat(ftos(hitplot_x), " ", ftos(hitplot_y), " ", ftos(hitplot_z), "\n"));
}
}
WriteByte(MSG_ONE, type);
}
-float client_hasweapon(entity cl, float wpn, float andammo, float complain)
-{SELFPARAM();
+bool client_hasweapon(entity cl, Weapon wpn, float andammo, bool complain)
+{
float f;
- if(time < self.hasweapon_complain_spam)
+ if (time < cl.hasweapon_complain_spam)
complain = 0;
// ignore hook button when using other offhand equipment
if (cl.offhand != OFFHAND_HOOK)
- if (wpn == WEP_HOOK.m_id && !((cl.weapons | weaponsInMap) & WepSet_FromWeapon(Weapons_from(wpn))))
+ if (wpn == WEP_HOOK && !((cl.weapons | weaponsInMap) & WepSet_FromWeapon(wpn)))
complain = 0;
- if(complain)
- self.hasweapon_complain_spam = time + 0.2;
+ if (complain)
+ cl.hasweapon_complain_spam = time + 0.2;
- if (wpn < WEP_FIRST || wpn > WEP_LAST)
+ if (wpn == WEP_Null)
{
if (complain)
- sprint(self, "Invalid weapon\n");
+ sprint(cl, "Invalid weapon\n");
return false;
}
- if (cl.weapons & WepSet_FromWeapon(Weapons_from(wpn)))
+ if (cl.weapons & WepSet_FromWeapon(wpn))
{
if (andammo)
{
}
else
{
- setself(cl);
- Weapon w = Weapons_from(wpn);
- f = w.wr_checkammo1(w) + w.wr_checkammo2(w);
+ WITH(entity, self, cl, f = wpn.wr_checkammo1(wpn) + wpn.wr_checkammo2(wpn));
// always allow selecting the Mine Layer if we placed mines, so that we can detonate them
entity mine;
- if(wpn == WEP_MINE_LAYER.m_id)
- for(mine = world; (mine = find(mine, classname, "mine")); ) if(mine.owner == self)
+ if(wpn == WEP_MINE_LAYER)
+ for(mine = world; (mine = find(mine, classname, "mine")); ) if(mine.owner == cl)
f = 1;
- setself(this);
}
if (!f)
{
if(IS_REAL_CLIENT(cl))
{
play2(cl, SND(UNAVAILABLE));
- Send_WeaponComplain (cl, wpn, 0);
+ Send_WeaponComplain (cl, wpn.m_id, 0);
}
return false;
}
{
// DRESK - 3/16/07
// Report Proper Weapon Status / Modified Weapon Ownership Message
- if (weaponsInMap & WepSet_FromWeapon(Weapons_from(wpn)))
+ if (weaponsInMap & WepSet_FromWeapon(wpn))
{
- Send_WeaponComplain(cl, wpn, 1);
+ Send_WeaponComplain(cl, wpn.m_id, 1);
if(autocvar_g_showweaponspawns)
{
- entity e;
-
- for(e = world; (e = findfloat(e, weapon, wpn)); )
+ for(entity e = world; (e = findfloat(e, weapon, wpn.m_id)); )
{
if(e.classname == "droppedweapon" && autocvar_g_showweaponspawns < 2)
continue;
WP_Weapon,
1, 0,
world, e.origin + ('0 0 1' * e.maxs.z) * 1.2,
- self, 0,
+ cl, 0,
world, enemy,
0,
RADARICON_NONE
);
- wp.wp_extra = wpn;
+ wp.wp_extra = wpn.m_id;
}
}
}
else
{
- Send_WeaponComplain (cl, wpn, 2);
+ Send_WeaponComplain (cl, wpn.m_id, 2);
}
play2(cl, SND(UNAVAILABLE));
entity wep;
if(skipmissing || pl.selectweapon == 0)
- weaponcur = pl.switchweapon;
+ weaponcur = PS(pl).m_switchweapon.m_id;
else
weaponcur = pl.selectweapon;
if(wep.impulse != imp)
continue;
- float i, have_other = false;
- for(i = WEP_FIRST; i <= WEP_LAST; ++i)
- {
- Weapon e = Weapons_from(i);
+ bool have_other = false;
+ FOREACH(Weapons, it != WEP_Null, {
if(i != weaponwant)
- if(e.impulse == imp || imp < 0)
- if((pl.weapons & (e.m_wepset)) || (weaponsInMap & (e.m_wepset)))
+ if(it.impulse == imp || imp < 0)
+ if((pl.weapons & (it.m_wepset)) || (weaponsInMap & (it.m_wepset)))
have_other = true;
- }
+ });
// skip weapons we don't own that aren't normal and aren't in the map
if(!(pl.weapons & wepset))
++c;
- if(!skipmissing || client_hasweapon(pl, weaponwant, true, false))
+ if(!skipmissing || client_hasweapon(pl, wep, true, false))
{
if(switchtonext)
return weaponwant;
if(wep.impulse != imp)
continue;
- float i, have_other = false;
- for(i = WEP_FIRST; i <= WEP_LAST; ++i)
- {
- Weapon w = Weapons_from(i);
+ bool have_other = false;
+ FOREACH(Weapons, it != WEP_Null, {
if(i != weaponwant)
- if(w.impulse == imp || imp < 0)
- if((pl.weapons & (w.m_wepset)) || (weaponsInMap & (w.m_wepset)))
+ if(it.impulse == imp || imp < 0)
+ if((pl.weapons & (it.m_wepset)) || (weaponsInMap & (it.m_wepset)))
have_other = true;
- }
+ });
// skip weapons we don't own that aren't normal and aren't in the map
if(!(pl.weapons & wepset))
--c;
if(c == 0)
{
- client_hasweapon(pl, weaponwant, true, true);
+ client_hasweapon(pl, wep, true, true);
break;
}
}
return 0;
}
-void W_SwitchWeapon_Force(entity e, float w)
+void W_SwitchWeapon_Force(entity e, Weapon wep)
{
- e.cnt = e.switchweapon;
- e.switchweapon = w;
- e.selectweapon = w;
+ e.cnt = PS(e).m_switchweapon.m_id;
+ PS(e).m_switchweapon = wep;
+ e.selectweapon = wep.m_id;
}
// perform weapon to attack (weaponstate and attack_finished check is here)
void W_SwitchToOtherWeapon(entity pl)
{
// hack to ensure it switches to an OTHER weapon (in case the other fire mode still has ammo, we want that anyway)
- int ww;
- WepSet set = WepSet_FromWeapon(Weapons_from(pl.weapon));
+ Weapon ww;
+ WepSet set = WepSet_FromWeapon(PS(pl).m_weapon);
if(pl.weapons & set)
{
pl.weapons &= ~set;
W_SwitchWeapon_Force(pl, ww);
}
-void W_SwitchWeapon(float imp)
+void W_SwitchWeapon(Weapon w)
{SELFPARAM();
- if (self.switchweapon != imp)
+ if (PS(self).m_switchweapon != w)
{
- if (client_hasweapon(self, imp, true, true))
- W_SwitchWeapon_Force(self, imp);
+ if (client_hasweapon(self, w, true, true))
+ W_SwitchWeapon_Force(self, w);
else
- self.selectweapon = imp; // update selectweapon ANYWAY
+ self.selectweapon = w.m_id; // update selectweapon ANYWAY
}
else if(!forbidWeaponUse(self)) {
- Weapon w = Weapons_from(self.weapon);
w.wr_reload(w);
}
}
float w;
w = W_GetCycleWeapon(self, weaponorder, dir, -1, 1, true);
if(w > 0)
- W_SwitchWeapon(w);
+ W_SwitchWeapon(Weapons_from(w));
}
void W_NextWeaponOnImpulse(float imp)
float w;
w = W_GetCycleWeapon(self, self.cvar_cl_weaponpriority, +1, imp, 1, (self.cvar_cl_weaponimpulsemode == 0));
if(w > 0)
- W_SwitchWeapon(w);
+ W_SwitchWeapon(Weapons_from(w));
}
// next weapon
// previously used if exists and has ammo, (second) best otherwise
void W_LastWeapon()
{SELFPARAM();
- if(client_hasweapon(self, self.cnt, true, false))
- W_SwitchWeapon(self.cnt);
+ Weapon wep = Weapons_from(self.cnt);
+ if(client_hasweapon(self, wep, true, false))
+ W_SwitchWeapon(wep);
else
W_SwitchToOtherWeapon(self);
}
void Send_WeaponComplain(entity e, float wpn, float type);
.float hasweapon_complain_spam;
-float client_hasweapon(entity cl, float wpn, float andammo, float complain);
+bool client_hasweapon(entity cl, Weapon wpn, float andammo, bool complain);
.int weaponcomplainindex;
float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, float complain, float skipmissing);
-#define w_getbestweapon(ent) W_GetCycleWeapon(ent, ent.cvar_cl_weaponpriority, 0, -1, false, true)
+#define w_getbestweapon(ent) Weapons_from(W_GetCycleWeapon(ent, ent.cvar_cl_weaponpriority, 0, -1, false, true))
-void W_SwitchWeapon_Force(entity e, float w);
+void W_SwitchWeapon_Force(entity e, Weapon w);
// perform weapon to attack (weaponstate and attack_finished check is here)
void W_SwitchToOtherWeapon(entity pl);
-void W_SwitchWeapon(float imp);
+void W_SwitchWeapon(Weapon imp);
void W_CycleWeapon(string weaponorder, float dir);
string W_Apply_Weaponreplace(string in)
{
- float n = tokenize_console(in);
- string out = "", s, replacement;
- float i, j;
- entity e;
- for(i = 0; i < n; ++i)
- {
- replacement = "";
- s = argv(i);
-
- for(j = WEP_FIRST; j <= WEP_LAST; ++j)
+ string out = "";
+ FOREACH_WORD(in, true, {
+ string replacement = "";
+ Weapon w = Weapons_fromstr(it);
+ if (w)
{
- e = Weapons_from(j);
- if(e.netname == s)
- {
- replacement = e.weaponreplace;
- }
+ replacement = w.weaponreplace;
+ if (replacement == "") replacement = it;
}
-
- if(replacement == "")
- out = strcat(out, " ", s);
- else if(replacement != "0")
- out = strcat(out, " ", replacement);
- }
- return substring(out, 1, -1);
+ if (replacement == "0") continue;
+ out = cons(out, replacement);
+ });
+ return out;
}
void weapon_defaultspawnfunc(entity this, Weapon e)
if (e.spawnflags & WEP_FLAG_SUPERWEAPON)
if (!this.superweapons_finished)
- {
this.superweapons_finished = autocvar_g_balance_superweapons_time;
- LOG_INFO("Setting it to ", ftos(this.superweapons_finished), " on ", e.mdl, "\n");
- }
// if we don't already have ammo, give us some ammo
if (!this.(e.ammo_field))
if(doreduce && g_weapon_stay == 2)
{
// if our weapon is loaded, give its load back to the player
- if(self.(weapon_load[self.weapon]) > 0)
+ int i = PS(self).m_weapon.m_id;
+ if(self.(weapon_load[i]) > 0)
{
- own.(ammotype) += self.(weapon_load[self.weapon]);
- self.(weapon_load[self.weapon]) = -1; // schedule the weapon for reloading
+ own.(ammotype) += self.(weapon_load[i]);
+ self.(weapon_load[i]) = -1; // schedule the weapon for reloading
}
wep.(ammotype) = 0;
else if(doreduce)
{
// if our weapon is loaded, give its load back to the player
- if(self.(weapon_load[self.weapon]) > 0)
+ int i = PS(self).m_weapon.m_id;
+ if(self.(weapon_load[i]) > 0)
{
- own.(ammotype) += self.(weapon_load[self.weapon]);
- self.(weapon_load[self.weapon]) = -1; // schedule the weapon for reloading
+ own.(ammotype) += self.(weapon_load[i]);
+ self.(weapon_load[i]) = -1; // schedule the weapon for reloading
}
thisammo = min(own.(ammotype), wep.(ammotype));
// toss current weapon
void W_ThrowWeapon(vector velo, vector delta, float doreduce)
{SELFPARAM();
- int w = self.weapon;
- if (w == WEP_Null.m_id)
+ Weapon w = PS(self).m_weapon;
+ if (w == WEP_Null)
return; // just in case
if(MUTATOR_CALLHOOK(ForbidThrowCurrentWeapon))
return;
.entity weaponentity = weaponentities[0]; // TODO: unhardcode
if(self.(weaponentity).state != WS_READY)
return;
- if(!W_IsWeaponThrowable(w))
+ if(!W_IsWeaponThrowable(w.m_id))
return;
- WepSet set = WepSet_FromWeapon(Weapons_from(w));
+ WepSet set = WepSet_FromWeapon(w);
if(!(self.weapons & set)) return;
self.weapons &= ~set;
W_SwitchWeapon_Force(self, w_getbestweapon(self));
- string a = W_ThrowNewWeapon(self, w, doreduce, self.origin + delta, velo);
+ string a = W_ThrowNewWeapon(self, w.m_id, doreduce, self.origin + delta, velo);
if(!a) return;
- Send_Notification(NOTIF_ONE, self, MSG_MULTI, ITEM_WEAPON_DROP, a, w);
+ Send_Notification(NOTIF_ONE, self, MSG_MULTI, ITEM_WEAPON_DROP, a, w.m_id);
}
void SpawnThrownWeapon(vector org, float w)
{SELFPARAM();
- if(self.weapons & WepSet_FromWeapon(Weapons_from(self.weapon)))
- if(W_IsWeaponThrowable(self.weapon))
- W_ThrowNewWeapon(self, self.weapon, false, org, randomvec() * 125 + '0 0 200');
+ if(self.weapons & WepSet_FromWeapon(PS(self).m_weapon))
+ if(W_IsWeaponThrowable(PS(self).m_weapon.m_id))
+ W_ThrowNewWeapon(self, PS(self).m_weapon.m_id, false, org, randomvec() * 125 + '0 0 200');
}
float oldsolid;
vector vecs, dv;
oldsolid = ent.dphitcontentsmask;
- if(ent.weapon == WEP_RIFLE.m_id)
+ if(PS(ent).m_weapon == WEP_RIFLE)
ent.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_CORPSE;
else
ent.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
// track max damage
if(accuracy_canbegooddamage(ent))
- accuracy_add(ent, ent.weapon, maxdamage, 0);
+ accuracy_add(ent, PS(ent).m_weapon.m_id, maxdamage, 0);
W_HitPlotAnalysis(ent, v_forward, v_right, v_up);
}
// calculate hits and fired shots for hitscan
- accuracy_add(self, self.weapon, 0, min(bdamage, totaldmg));
+ accuracy_add(self, PS(self).m_weapon.m_id, 0, min(bdamage, totaldmg));
trace_endpos = endpoint;
trace_ent = endent;
// do not exceed 100%
float added_damage = min(damage - total_damage, damage * solid_penetration_left);
total_damage += damage * solid_penetration_left;
- accuracy_add(self, self.weapon, 0, added_damage);
+ accuracy_add(self, PS(self).m_weapon.m_id, 0, added_damage);
}
}
// Weapon subs
void w_clear(Weapon thiswep, entity actor, .entity weaponentity, int fire)
{
- if (actor.weapon != -1)
- {
- actor.weapon = 0;
- actor.switchingweapon = 0;
- }
+ PS(actor).m_weapon = WEP_Null;
+ PS(actor).m_switchingweapon = WEP_Null;
entity this = actor.(weaponentity);
if (this)
{
if (thiswep == WEP_SHOTGUN)
if (!secondary && WEP_CVAR(shotgun, secondary) == 1) return false; // no clicking, just allow
- if (thiswep == Weapons_from(actor.switchweapon) && time - actor.prevdryfire > 1) // only play once BEFORE starting to switch weapons
+ if (thiswep == PS(actor).m_switchweapon && time - actor.prevdryfire > 1) // only play once BEFORE starting to switch weapons
{
sound(actor, CH_WEAPON_A, SND_DRYFIRE, VOL_BASE, ATTEN_NORM);
actor.prevdryfire = time;
return false;
// do not even think about shooting if switching
- if (actor.switchweapon != actor.weapon) return false;
+ if (PS(actor).m_switchweapon != PS(actor).m_weapon) return false;
if (attacktime >= 0)
{
if ((fr == WFRAME_FIRE1 || fr == WFRAME_FIRE2) && t)
{
- int act = (fr == WFRAME_FIRE2 && (actor.weapon == WEP_SHOCKWAVE.m_id || actor.weapon == WEP_SHOTGUN.m_id))
+ int act = (fr == WFRAME_FIRE2 && (PS(actor).m_weapon == WEP_SHOCKWAVE || PS(actor).m_weapon == WEP_SHOTGUN))
? ANIMACTION_MELEE
: ANIMACTION_SHOOT
;
{
if (actor.(weaponentity).state != WS_CLEAR)
{
- Weapon wpn = Weapons_from(actor.weapon);
+ Weapon wpn = PS(actor).m_weapon;
w_ready(wpn, actor, weaponentity, (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0));
return;
}
}
- if (actor.switchweapon == 0)
+ if (PS(actor).m_switchweapon == WEP_Null)
{
- actor.weapon = 0;
- actor.switchingweapon = 0;
+ PS(actor).m_weapon = WEP_Null;
+ PS(actor).m_switchingweapon = WEP_Null;
this.state = WS_CLEAR;
actor.weaponname = "";
// actor.items &= ~IT_AMMO;
vector up = v_up;
// Change weapon
- if (actor.weapon != actor.switchweapon)
+ if (PS(actor).m_weapon != PS(actor).m_switchweapon)
{
switch (this.state)
{
case WS_CLEAR:
{
// end switching!
- actor.switchingweapon = actor.switchweapon;
- entity newwep = Weapons_from(actor.switchweapon);
+ Weapon newwep = PS(actor).m_switchweapon;
+ PS(actor).m_switchingweapon = newwep;
// the two weapon entities will notice this has changed and update their models
- actor.weapon = actor.switchweapon;
+ PS(actor).m_weapon = newwep;
actor.weaponname = newwep.mdl;
actor.bulletcounter = 0;
actor.ammo_field = newwep.ammo_field;
// set our clip load to the load of the weapon we switched to, if it's reloadable
if ((newwep.spawnflags & WEP_FLAG_RELOADABLE) && newwep.reloading_ammo) // prevent accessing undefined cvars
{
- actor.clip_load = actor.(weapon_load[actor.switchweapon]);
+ actor.clip_load = actor.(weapon_load[PS(actor).m_switchweapon.m_id]);
actor.clip_size = newwep.reloading_ammo;
}
else
case WS_DROP:
{
// in dropping phase we can switch at any time
- actor.switchingweapon = actor.switchweapon;
+ PS(actor).m_switchingweapon = PS(actor).m_switchweapon;
break;
}
case WS_READY:
{
// start switching!
- actor.switchingweapon = actor.switchweapon;
- entity oldwep = Weapons_from(actor.weapon);
+ PS(actor).m_switchingweapon = PS(actor).m_switchweapon;
+ entity oldwep = PS(actor).m_weapon;
// set up weapon switch think in the future, and start drop anim
if (INDEPENDENT_ATTACK_FINISHED || ATTACK_FINISHED(actor, weaponslot(weaponentity)) <= time + actor.weapon_frametime * 0.5)
// if (actor.button0)
// print(ftos(frametime), " ", ftos(time), " >= ", ftos(ATTACK_FINISHED(actor, slot)), " >= ", ftos(this.weapon_nextthink), "\n");
- int w = actor.weapon;
+ int w = PS(actor).m_weapon.m_id;
// call the think code which may fire the weapon
// and do so multiple times to resolve framerate dependency issues if the
{
if (w && !(actor.weapons & WepSet_FromWeapon(Weapons_from(w))))
{
- if (actor.weapon == actor.switchweapon) W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
+ if (PS(actor).m_weapon == PS(actor).m_switchweapon) W_SwitchWeapon_Force(actor, w_getbestweapon(actor));
w = 0;
}
}
else
{
- if (key_pressed && actor.switchweapon != WEP_HOOK.m_id && !actor.hook_switchweapon) W_SwitchWeapon(
- WEP_HOOK.m_id);
+ if (key_pressed && PS(actor).m_switchweapon != WEP_HOOK && !actor.hook_switchweapon)
+ W_SwitchWeapon(WEP_HOOK);
actor.hook_switchweapon = key_pressed;
Weapon h = WEP_HOOK;
- block_weapon = (actor.weapon == h.m_id && (actor.BUTTON_ATCK || key_pressed));
+ block_weapon = (PS(actor).m_weapon == h && (actor.BUTTON_ATCK || key_pressed));
h.wr_think(h, actor, weaponentity, block_weapon ? 1 : 0);
}
}
{
if (w)
{
- Weapon e = Weapons_from(actor.weapon);
+ Weapon e = PS(actor).m_weapon;
e.wr_think(e, actor, weaponentity, (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0));
}
else
{
- Weapon w = Weapons_from(actor.weapon);
+ Weapon w = PS(actor).m_weapon;
w.wr_gonethink(w);
}
}
v_forward = fo;
v_right = ri;
v_up = up;
- Weapon wpn = Weapons_from(actor.weapon);
+ Weapon wpn = PS(actor).m_weapon;
this.weapon_think(wpn, actor, weaponentity,
(actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0));
}
if (wep.reloading_ammo)
{
actor.clip_load -= ammo_use;
- actor.(weapon_load[actor.weapon]) = actor.clip_load;
+ actor.(weapon_load[PS(actor).m_weapon.m_id]) = actor.clip_load;
}
else if (wep.ammo_field != ammo_none)
{
actor.clip_load += load;
actor.(actor.ammo_field) -= load;
}
- actor.(weapon_load[actor.weapon]) = actor.clip_load;
+ actor.(weapon_load[PS(actor).m_weapon.m_id]) = actor.clip_load;
// do not set ATTACK_FINISHED in reload code any more. This causes annoying delays if eg: You start reloading a weapon,
// then quickly switch to another weapon and back. Reloading is canceled, but the reload delay is still there,
// ATTACK_FINISHED(actor, slot) -= actor.reload_time - 1;
- Weapon wpn = Weapons_from(actor.weapon);
+ Weapon wpn = Weapons_from(PS(actor).m_weapon.m_id);
w_ready(wpn, actor, weaponentity, (actor.BUTTON_ATCK ? 1 : 0) | (actor.BUTTON_ATCK2 ? 2 : 0));
}
{
.entity weaponentity = weaponentities[0];
// set global values to work with
- entity e = Weapons_from(actor.weapon);
+ Weapon e = PS(actor).m_weapon;
if (MUTATOR_CALLHOOK(W_Reload, actor)) return;
if (IS_REAL_CLIENT(actor) && actor.reload_complain < time)
{
play2(actor, SND(UNAVAILABLE));
- sprint(actor, strcat("You don't have enough ammo to reload the ^2", WEP_NAME(actor.weapon), "\n"));
+ sprint(actor, strcat("You don't have enough ammo to reload the ^2", PS(actor).m_weapon.m_name, "\n"));
actor.reload_complain = time + 1;
}
// switch away if the amount of ammo is not enough to keep using this weapon
- Weapon w = Weapons_from(actor.weapon);
+ Weapon w = PS(actor).m_weapon;
if (!(w.wr_checkammo1(w) + w.wr_checkammo2(w)))
{
actor.clip_load = -1; // reload later
if (actor.clip_load < 0) actor.clip_load = 0;
actor.old_clip_load = actor.clip_load;
- actor.clip_load = actor.(weapon_load[actor.weapon]) = -1;
+ actor.clip_load = actor.(weapon_load[PS(actor).m_weapon.m_id]) = -1;
}
void W_DropEvent(.void(Weapon) event, entity player, float weapon_type, entity weapon_item)
+++ /dev/null
-**Core Team
-Rudolf "divVerent" Polzer
-Ant "Antibody" Zucaro
-Marvin "Mirio" Beck
-Merlijn Hofstra
-Peter "Morphed" Pielak
-Ruszkai "CuBe0wL" Ákos
-Samual "Ares" Lenks
-Tyler "-z-" Mulligan
-Zac "Mario" Jardine
-
-**Extended Team
-Antonio "terencehill" Piu
-Archer
-BuddyFriendGuy
-Debugger
-GATTS
-Halogene
-IDWMaster
-Jan "zykure" Behrens
-JH0nny
-Luigi
-Łukasz "kuniu the frogg" Polek
-Matthias "matthiaskrgr" Krüger
-Mattia "Melanosuchus" Basaglia
-MrBougo
-Nick "bitbomb" Lucca
-nilyt/nyov
-Nitroxis
-packer
-Pearce "theShadow" Michal
-Rasmus "FruitieX" Eskola
-s1lence
-Severin "sev" Meyer
-Soelen
-Sydes
-unfa
-TimePath
-
-
-*Website
-Ant "Antibody" Zucaro (web)
-Merlijn Hofstra
-Tyler "-z-" Mulligan (web / game)
-
-*Stats
-Ant "Antibody" Zucaro
-Jan "zykure" Behrens
-
-*Art
-Severin "sev" Meyer
-Sahil "DiaboliK" Singhal
-Peter "Morphed" Pielak
-Sam "LJFHutch" Hutchinson
-Pearce "theShadow" Michal
-
-*Animation
-Sahil "DiaboliK" Singhal
-nifrek
-
-*Level Design
-Amadeusz "amade/proraide" Sławiński
-Ben "MooKow" Banker
-Calinou
-Cortez
-Cuinn "Cuinnton" Herrick
-Debugger
-Jakob "tZork" Markström Gröhn
-Konrad "Justin" Slawinski
-Maddin
-L0
-Łukasz "kuniu the frogg" Polek
-Maik "SavageX" Merten
-Marvin "Mirio" Beck
-MintOX
-packer
-Pearce "theShadow" Michal
-Rasmus "FruitieX" Eskola
-Ruszkai "CuBe0wL" Ákos
-Severin "sev" Meyer
-ShadoW
-
-*Music / Sound FX
-AquaNova (Archer)
-blkrbt
-chooksta
-Independent.nu
-[master]mind
-Merlijn Hofstra
-Mick Rippon
-Nick "bitbomb" Lucca
-remaxim
-Saulo "mand1nga" Gil
-{SC0RP} - Ian "ID" Dorrell
-Stephan
-unfa
-
-*Game Code
-Samual "Ares" Lenks
-Rudolf "divVerent" Polzer
-Jakob "tZork" Markström Gröhn
-Rasmus "FruitieX" Eskola
-Zac "Mario" Jardine
-
-*Marketing / PR
-Tyler "-z-" Mulligan
-Ruszkai "CuBe0wL" Ákos
-Samual "Ares" Lenks
-Saulo "mand1nga" Gil
-
-*Legal
-Rudolf "divVerent" Polzer
-Merlijn Hofstra
-
-
-**Game Engine
-*DarkPlaces
-Forest "LordHavoc" Hale
-
-*Engine Additions
-Rudolf "divVerent" Polzer
-Samual "Ares" Lenks
-
-
-**Compiler
-*GMQCC
-Wolfgang "Blub\0" Bumiller
-Dale "graphitemaster" Weiler
-
-
-**Other Active Contributors
-Erik "Ablu" Schilling
-Mircea "Taoki" Kitsune
-Penguinum
-
-
-**Translators
-
-*Asturian
-Llumex03
-Tornes "Tornes.Llume" Ḷḷume
-Ximielga
-
-*Belarusian
-Mihail "meequz" Varantsou
-
-*Bulgarian
-lokster
-set_killer
-
-*Chinese (China)
-Antonidas
-kalawore
-sapphireliu
-
-*Czech
-shogun assassin/woky
-Superovoce
-Tomáš "CZHeron" Volavka
-
-*Dutch
-Alexander "freefang" van Dam
-PinkRobot
-vegiburger
-
-*English (Australia)
-Laurene "sunflowers" Albrand
-Zac "Mario" Jardine
-
-*Finnish
-Henry "Exitium" Sanmark
-Rasmus "FruitieX" Eskola
-
-*French
-Calinou
-Maxime "Taximus" Paradis
-RedGuff
-Yannick "SpiKe" Le Guen
-
-*German
-Brot
-cvcxc
-Erik "Ablu" Schilling
-Jope "Sless" Withers
-Marvin "Mirio" Beck
-Rudolf "divVerent" Polzer
-Yepoleb
-
-*Greek
-Γιάννης "Evropi" Ανθυμίδης
-Konstantinos "LDinos" Mihalenas
-Savoritias
-Vindex
-
-*Hungarian
-Ruszkai "CuBe0wL" Ákos
-xaN1C4n3
-
-*Italian
-Antonio "terencehill" Piu
-Felice "MaidenBeast" Sallustio
-stdi
-XCostaX
-
-*Polish
-4m
-Alex "tiprogrammierer.alex" Progger
-Amadeusz "amade/proraide" Sławiński
-
-*Portuguese
-Ricardo Manuel "Hellgardia" da Cruz Coelho da Silva
-xXxCHAOTICxXx
-
-*Romanian
-Adrian-Ciprian "adrian.tinjala" Tînjală
-BusterDBK
-Mircea "Taoki" Kitsune
-Tudor "TropiKo" Ionel
-
-*Russian
-Alex "alextalker7" Talker
-Alexandr "zrg"
-Andrei "adem4ik" Stepanov
-gravicappa
-Hot Dog
-Lord Canistra
-Nikoli
-Sergej "Clearness High" Lutsyk
-
-*Serbian
-Саша "salepetronije" Петровић
-Pendulla
-Rafael "Ristovski"
-
-*Spanish
-0000simon
-Alan "aagp" Garcia
-Ari_tent
-brunodeleo
-Kammy
-roader_gentoo
-Rodrigo Mouton Laudin
-SouL
-
-*Swedish
-Karl-Oskar "machine" Rikås
-marcus256
-
-*Ukrainian
-Oleh "BlaXpirit" Prypin
-Vasyl "Harmata" Melnyk
-Yuriy "herrniemand" Ackermann
-
-
-**Past Contributors
-Akari
-Alexander "naryl" Suhoverhov
-Alexander "motorsep" Zubov
-Amos "torus" Dudley
-Andreas "Black" Kirsch
-Attila "WW3" Houtkooper
-BigMac
-Braden "meoblast001" Walters
-Brain Younds
-Chris "amethyst7" Matz
-Christian Ice
-Clinton "Kaziganthe" Freeman
-Dan "Digger" Korostelev
-Dan "Wazat" Hale
-Dokujisan
-Donkey
-dstrek
-Dustin Geeraert
-Edgenetwork
-Edward "Ed" Holness
-Eric "Munyul Verminard" Sambach
-Fabien "H. Reaper" Tschirhart
-Florian Paul "lda17h" Schmidt
-FrikaC
-Garth "Zombie" Hendy
-Gerd "Elysis" Raudenbusch
-Gottfried "Toddd" Hofmann
-Henning "Tymo" Janssen
-Innovati
-Jitspoe
-Jody Gallagher
-Jope "Sless" Withers
-Juergen "LowDragon" Timm
-KadaverJack
-Kevin "Tyrann" Shanahan
-Kristian "morfar" Johansson
-Kurt Dereli
-lcatlnx
-Lee David Ash
-Lee Vermeulen
-leileilol
-magorian
-Marius "GreEn`mArine" Shekow
-Marko "Urre" Permanto
-Mathieu "Elric" Olivier
-Mattrew "Tronyn" Rye
-MauveBib
-Mephisto
-michaelb
-Michael "Tenshihan" Quinn
-Mepper
-Munyul
-Netzwerg
-NoelCower
-Parapraxis
-parasti
-Paul "Strahlemann" Evers
-Paul Scott
-Petithomme
-PlasmaSheep
-Przemysław "atheros" Grzywacz
-Q1 Retexturing Project
-Qantourisc
-Oleh "BlaXpirit" Prypin
-Rick "Rat" Kelley
-Robert "ai" Kuroto
-Ronan
-Sajt
-Saulo "mand1nga" Gil
-Shaggy
-Shank
-Simon O'Callaghan
-SomeGuy
-SoulKeeper_p
-Spike
-Spirit
-Stephan "esteel" Stahl
-Steve Vermeulen
-Supajoe
-Tei
-The player with the unnecessarily long name
-Tomaz
-Ulrich Galbraith
-Vortex
-William Libert
-William "Willis" Weilep
-Yves "EviLair" Allaire
-Zenex