- cd gmqcc && make -j $(nproc) && export QCC="$PWD/gmqcc"
- cd ..
+test_compilation_units:
+ stage: test
+ script:
+ - ./qcsrc/tools/compilationunits.sh
+
test_sv_game:
stage: test
script:
- wget -O data/g-23.pk3 http://beta.xonotic.org/autobuild-bsp/latest/g-23.pk3
- make
- - EXPECT=8573348372f9b9f82183b01598950eb5
+ - EXPECT=07fdfd9a19025920a599995730eb2a78
- HASH=$(${ENGINE} -noconfig -nohome +exec serverbench.cfg
| tee /dev/stderr
| grep '^:'
done < <(${ENGINE} +developer 1 +map gitlab-ci +sv_cmd runtest +exit)
- exit 1
-test_compilation_units:
- stage: test
- script:
- - ./qcsrc/tools/compilationunits.sh
-
doxygen: # rename to 'pages' when gitlab.com allows pages to exceed 100MiB
stage: deploy
script:
set g_balance_shotgun_reload_ammo 0
set g_balance_shotgun_reload_time 2
set g_balance_shotgun_secondary 2
-set g_balance_shotgun_secondary_animtime 1
+set g_balance_shotgun_secondary_animtime 1.15
set g_balance_shotgun_secondary_damage 80
set g_balance_shotgun_secondary_force 200
set g_balance_shotgun_secondary_melee_delay 0.25
set g_balance_shotgun_secondary 1
set g_balance_shotgun_secondary_alt_animtime 0.2
set g_balance_shotgun_secondary_alt_refire 1.2
-set g_balance_shotgun_secondary_animtime 1
+set g_balance_shotgun_secondary_animtime 1.15
set g_balance_shotgun_secondary_damage 70
set g_balance_shotgun_secondary_force 200
set g_balance_shotgun_secondary_melee_delay 0.25
set g_balance_shotgun_reload_ammo 0
set g_balance_shotgun_reload_time 2
set g_balance_shotgun_secondary 1
-set g_balance_shotgun_secondary_animtime 1
+set g_balance_shotgun_secondary_animtime 1.15
set g_balance_shotgun_secondary_damage 80
set g_balance_shotgun_secondary_force 200
set g_balance_shotgun_secondary_melee_delay 0.25
set g_balance_shotgun_reload_ammo 0
set g_balance_shotgun_reload_time 2
set g_balance_shotgun_secondary 1
-set g_balance_shotgun_secondary_animtime 1
+set g_balance_shotgun_secondary_animtime 1.15
set g_balance_shotgun_secondary_damage 80
set g_balance_shotgun_secondary_force 200
set g_balance_shotgun_secondary_melee_delay 0.25
set g_balance_shotgun_reload_ammo 0
set g_balance_shotgun_reload_time 2
set g_balance_shotgun_secondary 1
-set g_balance_shotgun_secondary_animtime 1
+set g_balance_shotgun_secondary_animtime 1.15
set g_balance_shotgun_secondary_damage 70
set g_balance_shotgun_secondary_force 200
set g_balance_shotgun_secondary_melee_delay 0.25
set g_balance_shotgun_reload_ammo 0
set g_balance_shotgun_reload_time 2
set g_balance_shotgun_secondary 1
-set g_balance_shotgun_secondary_animtime 1
+set g_balance_shotgun_secondary_animtime 1.15
set g_balance_shotgun_secondary_damage 70
set g_balance_shotgun_secondary_force 200
set g_balance_shotgun_secondary_melee_delay 0.25
set g_frozen_force 0.6 "How much to multiply the force on a frozen player with"
// player statistics server URI
-set g_playerstats_uri "" "Output player statistics information to either: URL (with ://), console (with a dash like this: -), or supply a filename to output to data directory."
+set g_playerstats_gamereport_uri "http://stats.xonotic.org/stats/submit" "Output player statistics information to either: URL (with ://), console (with a dash like this: -), or supply a filename to output to data directory."
// autoscreenshots
set g_max_info_autoscreenshot 3 "how many info_autoscreenshot entities are allowed"
PROGS_OUT ?= $(CURDIR)/..
WORKDIR ?= ../.tmp
-QCCFLAGS_WATERMARK ?= $(shell git describe --tags --dirty='*')
+QCCFLAGS_WATERMARK ?= $(shell git describe --tags --dirty='~')
VER = $(subst *,\*,$(QCCFLAGS_WATERMARK))
NDEBUG ?= 1
BUILD_MOD ?= 0
--- /dev/null
+// generated file; do not modify
+#include "announcer.qc"
+#include "bgmscript.qc"
+#include "csqcmodel_hooks.qc"
+#include "main.qc"
+#include "mapvoting.qc"
+#include "miscfunctions.qc"
+#include "player_skeleton.qc"
+#include "scoreboard.qc"
+#include "shownames.qc"
+#include "teamradar.qc"
+#include "view.qc"
+#include "wall.qc"
float autocvar_cl_vehicles_hudscale = 0.5;
float autocvar_cl_vehicles_notify_time = 15;
float autocvar_cl_vehicles_crosshair_size = 0.5;
+bool autocvar_cl_vehicles_crosshair_colorize = true;
bool autocvar__vehicles_shownchasemessage;
bool autocvar_cl_velocityzoom_enabled;
float autocvar_cl_velocityzoom_factor;
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
+#include "cl_cmd.qc"
#include "all.qh"
#include <common/command/all.qc>
-
-#include "cl_cmd.qc"
--- /dev/null
+// generated file; do not modify
+#include "hud.qc"
+#include "hud_config.qc"
+++ /dev/null
-#include "all.qh"
-#include "hud.qc"
-#include "hud_config.qc"
return eX * best_columns + eY * best_rows;
}
-// return the string of the onscreen race timer
-string MakeRaceString(int cp, float mytime, float theirtime, float lapdelta, string theirname)
-{
- TC(int, cp);
- string col;
- string timestr;
- string cpname;
- string lapstr;
- lapstr = "";
-
- if(theirtime == 0) // goal hit
- {
- if(mytime > 0)
- {
- timestr = strcat("+", ftos_decimals(+mytime, TIME_DECIMALS));
- col = "^1";
- }
- else if(mytime == 0)
- {
- timestr = "+0.0";
- col = "^3";
- }
- else
- {
- timestr = strcat("-", ftos_decimals(-mytime, TIME_DECIMALS));
- col = "^2";
- }
-
- if(lapdelta > 0)
- {
- lapstr = sprintf(_(" (-%dL)"), lapdelta);
- col = "^2";
- }
- else if(lapdelta < 0)
- {
- lapstr = sprintf(_(" (+%dL)"), -lapdelta);
- col = "^1";
- }
- }
- else if(theirtime > 0) // anticipation
- {
- if(mytime >= theirtime)
- timestr = strcat("+", ftos_decimals(mytime - theirtime, TIME_DECIMALS));
- else
- timestr = TIME_ENCODED_TOSTRING(TIME_ENCODE(theirtime));
- col = "^3";
- }
- else
- {
- col = "^7";
- timestr = "";
- }
-
- if(cp == 254)
- cpname = _("Start line");
- else if(cp == 255)
- cpname = _("Finish line");
- else if(cp)
- cpname = sprintf(_("Intermediate %d"), cp);
- else
- cpname = _("Finish line");
-
- if(theirtime < 0)
- return strcat(col, cpname);
- else if(theirname == "")
- return strcat(col, sprintf("%s (%s)", cpname, timestr));
- else
- return strcat(col, sprintf("%s (%s %s)", cpname, timestr, strcat(theirname, col, lapstr)));
-}
-
-// Check if the given name already exist in race rankings? In that case, where? (otherwise return 0)
-int race_CheckName(string net_name)
-{
- int i;
- for (i=RANKINGS_CNT-1;i>=0;--i)
- if(grecordholder[i] == net_name)
- return i+1;
- return 0;
-}
-
/*
==================
HUD panels
--- /dev/null
+// generated file; do not modify
+#include "ammo.qc"
+#include "centerprint.qc"
+#include "chat.qc"
+#include "engineinfo.qc"
+#include "healtharmor.qc"
+#include "infomessages.qc"
+#include "minigame.qc"
+#include "modicons.qc"
+#include "notify.qc"
+#include "physics.qc"
+#include "powerups.qc"
+#include "pressedkeys.qc"
+#include "quickmenu.qc"
+#include "racetimer.qc"
+#include "radar.qc"
+#include "score.qc"
+#include "timer.qc"
+#include "vote.qc"
+#include "weapons.qc"
float race_status_time;
int race_status_prev;
string race_status_name_prev;
+
+// Check if the given name already exist in race rankings? In that case, where? (otherwise return 0)
+int race_CheckName(string net_name)
+{
+ int i;
+ for (i=RANKINGS_CNT-1;i>=0;--i)
+ if(grecordholder[i] == net_name)
+ return i+1;
+ return 0;
+}
+
+void race_showTime(string text, vector pos, vector timeText_ofs, float theTime, vector textSize, float f)
+{
+ drawstring_aspect(pos, text, textSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+ drawstring_aspect(pos + timeText_ofs, TIME_ENCODED_TOSTRING(theTime), textSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+ if (f < 1) {
+ drawstring_aspect_expanding(pos, text, textSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
+ drawstring_aspect_expanding(pos + timeText_ofs, TIME_ENCODED_TOSTRING(theTime), textSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
+ }
+}
+
void HUD_Mod_Race(vector pos, vector mySize)
{
mod_active = 1; // race should never hide the mod icons panel
entity me;
me = playerslots[player_localnum];
float score;
- float f; // yet another function has this
score = me.(scores[ps_primary]);
if(!(scores_flags[ps_primary] & SFL_TIME) || teamplay) // race/cts record display on HUD
db_put(ClientProgsDB, strcat(shortmapname, rr, "time"), ftos(score));
if(autocvar_cl_autodemo_delete_keeprecords)
{
- f = autocvar_cl_autodemo_delete;
+ float f = autocvar_cl_autodemo_delete;
f &= ~1;
cvar_set("cl_autodemo_delete", ftos(f)); // don't delete demo with new record!
}
textPos = pos + eY * 0.5 * max(0, mySize.y/2 - squareSize) + eX * 0.5 * (mySize.x - squareSize);
medalPos = pos + eY * 0.5 * max(0, mySize.y/2 - squareSize) + eY * 0.5 * mySize.y + eX * 0.5 * (mySize.x - squareSize);
}
+ vector textSize = eX * squareSize + eY * 0.25 * squareSize;
- f = time - crecordtime_change_time;
-
- if (f > 1) {
- drawstring_aspect(textPos, _("Personal best"), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect(textPos + eY * 0.25 * squareSize, TIME_ENCODED_TOSTRING(t), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- } else {
- drawstring_aspect(textPos, _("Personal best"), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect(textPos + eY * 0.25 * squareSize, TIME_ENCODED_TOSTRING(t), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect_expanding(pos, _("Personal best"), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
- drawstring_aspect_expanding(pos + eY * 0.25 * squareSize, TIME_ENCODED_TOSTRING(t), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
- }
+ race_showTime(_("Personal best"), textPos, eY * 0.25 * squareSize, t, textSize, time - crecordtime_change_time);
// server record
t = race_server_record;
srecordtime_prev = t;
srecordtime_change_time = time;
}
- f = time - srecordtime_change_time;
- if (f > 1) {
- drawstring_aspect(textPos + eY * 0.5 * squareSize, _("Server best"), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect(textPos + eY * 0.75 * squareSize, TIME_ENCODED_TOSTRING(t), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- } else {
- drawstring_aspect(textPos + eY * 0.5 * squareSize, _("Server best"), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect(textPos + eY * 0.75 * squareSize, TIME_ENCODED_TOSTRING(t), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
- drawstring_aspect_expanding(textPos + eY * 0.5 * squareSize, _("Server best"), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
- drawstring_aspect_expanding(textPos + eY * 0.75 * squareSize, TIME_ENCODED_TOSTRING(t), eX * squareSize + eY * 0.25 * squareSize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL, f);
- }
+ textPos += eY * 0.5 * squareSize;
+ race_showTime(_("Server best"), textPos, eY * 0.25 * squareSize, t, textSize, time - srecordtime_change_time);
if (race_status != race_status_prev || race_status_name != race_status_name_prev) {
race_status_time = time + 5;
#include "quickmenu.qh"
// QuickMenu (#23)
-#include <client/quickmenu.qc>
+#include <common/ent_cs.qh>
+#include <client/hud/all.qh>
+#include <client/mapvoting.qh>
+
+// QUICKMENU_MAXLINES must be <= 10
+const int QUICKMENU_MAXLINES = 10;
+// visible entries are loaded from QuickMenu_Buffer into QuickMenu_Page_* arrays
+string QuickMenu_Page_Command[QUICKMENU_MAXLINES];
+string QuickMenu_Page_Description[QUICKMENU_MAXLINES];
+int QuickMenu_Page_Command_Type[QUICKMENU_MAXLINES];
+int QuickMenu_Page_Entries;
+int QuickMenu_Page;
+int QuickMenu_Page_ActivatedEntry = -1;
+bool QuickMenu_Page_ActivatedEntry_Close;
+float QuickMenu_Page_ActivatedEntry_Time;
+bool QuickMenu_IsLastPage;
+// all the entries are loaded into QuickMenu_Buffer
+// each entry (submenu or command) is composed of 2 entries
+const int QUICKMENU_MAXENTRIES = 256;
+const int QUICKMENU_BUFFER_MAXENTRIES = 2 * QUICKMENU_MAXENTRIES;
+int QuickMenu_Buffer = -1;
+int QuickMenu_Buffer_Size;
+int QuickMenu_Buffer_Index;
+string QuickMenu_CurrentSubMenu;
+float QuickMenu_TimeOut;
+
+// QuickMenu_Buffer are labeled with these tags
+#define QM_TAG_TITLE "T"
+#define QM_TAG_SUBMENU "S"
+#define QM_TAG_COMMAND "C"
+#define QM_TAG_PLCOMMAND "P"
+
+#define QuickMenu_Buffer_Set(tag, string) bufstr_set(QuickMenu_Buffer, QuickMenu_Buffer_Size, strcat(tag, string))
+#define QuickMenu_Buffer_Get() bufstr_get(QuickMenu_Buffer, QuickMenu_Buffer_Index)
+
+// if s1 is not empty s will be displayed as command otherwise as submenu
+void QuickMenu_Page_LoadEntry(int i, string s, string s1)
+{
+ TC(int, i);
+ //printf("^xc80 entry %d: %s, %s\n", i, s, s1);
+ if (QuickMenu_Page_Description[i])
+ strunzone(QuickMenu_Page_Description[i]);
+ QuickMenu_Page_Description[i] = strzone(s);
+ if (QuickMenu_Page_Command[i])
+ strunzone(QuickMenu_Page_Command[i]);
+ QuickMenu_Page_Command[i] = strzone(s1);
+}
+
+void QuickMenu_Page_ClearEntry(int i)
+{
+ TC(int, i);
+ if (QuickMenu_Page_Description[i])
+ strunzone(QuickMenu_Page_Description[i]);
+ QuickMenu_Page_Description[i] = string_null;
+ if (QuickMenu_Page_Command[i])
+ strunzone(QuickMenu_Page_Command[i]);
+ QuickMenu_Page_Command[i] = string_null;
+}
+
+float QuickMenu_Page_Load(string target_submenu, float new_page);
+void QuickMenu_Default(string submenu);
+bool QuickMenu_Open(string mode, string submenu)
+{
+ int fh = -1;
+ string s;
+
+ if(mode == "")
+ {
+ if(autocvar_hud_panel_quickmenu_file == "" || autocvar_hud_panel_quickmenu_file == "0")
+ mode = "default";
+ else
+ mode = "file";
+ }
+
+ if(mode == "file")
+ {
+ if(autocvar_hud_panel_quickmenu_file == "" || autocvar_hud_panel_quickmenu_file == "0")
+ LOG_INFO("No file name is set in hud_panel_quickmenu_file, loading default quickmenu\n");
+ else
+ {
+ fh = fopen(autocvar_hud_panel_quickmenu_file, FILE_READ);
+ if(fh < 0)
+ LOG_INFOF("Couldn't open file \"%s\", loading default quickmenu\n", autocvar_hud_panel_quickmenu_file);
+ }
+ if(fh < 0)
+ mode = "default";
+ }
+
+ if(mode == "default")
+ {
+ QuickMenu_Buffer = buf_create();
+ if(QuickMenu_Buffer < 0)
+ return false;
+
+ QuickMenu_Default(submenu);
+ }
+ else if(mode == "file")
+ {
+ QuickMenu_Buffer = buf_create();
+ if(QuickMenu_Buffer < 0)
+ {
+ fclose(fh);
+ return false;
+ }
+
+ QuickMenu_Buffer_Size = 0;
+ while((s = fgets(fh)) && QuickMenu_Buffer_Size < QUICKMENU_BUFFER_MAXENTRIES)
+ {
+ // first skip invalid entries, so we don't check them anymore
+ float argc;
+ argc = tokenize_console(s);
+ if(argc == 0 || argv(0) == "")
+ continue;
+ if(argc == 1)
+ QuickMenu_Buffer_Set(QM_TAG_SUBMENU, argv(0));
+ else if(argc == 2)
+ {
+ if(argv(1) == "")
+ continue;
+ QuickMenu_Buffer_Set(QM_TAG_TITLE, argv(0));
+ ++QuickMenu_Buffer_Size;
+ QuickMenu_Buffer_Set(QM_TAG_COMMAND, argv(1));
+ }
+ else if(argc == 3)
+ {
+ // check for special keywords
+ float teamplayers = 0, without_me = 0;
+ switch(argv(2))
+ {
+ case "ALLPLAYERS_BUT_ME": without_me = 1; // fall through
+ case "ALLPLAYERS": teamplayers = 0; break;
+ case "OWNTEAMPLAYERS_BUT_ME": without_me = 1; // fall through
+ case "OWNTEAMPLAYERS": teamplayers = 1; break;
+ case "ENEMYTEAMPLAYERS": teamplayers = 2; break;
+ default: continue;
+ }
+
+ if(QuickMenu_Buffer_Size + 3 < QUICKMENU_BUFFER_MAXENTRIES)
+ {
+ QuickMenu_Buffer_Set(QM_TAG_SUBMENU, argv(0));
+ ++QuickMenu_Buffer_Size;
+ QuickMenu_Buffer_Set(QM_TAG_TITLE, strcat(ftos(teamplayers), ftos(without_me))); // put PLCOMMAND arguments in the title string
+ ++QuickMenu_Buffer_Size;
+ QuickMenu_Buffer_Set(QM_TAG_PLCOMMAND, argv(1));
+ ++QuickMenu_Buffer_Size;
+ QuickMenu_Buffer_Set(QM_TAG_SUBMENU, argv(0));
+ }
+ }
+ ++QuickMenu_Buffer_Size;
+ }
+ fclose(fh);
+ }
+ else
+ {
+ LOG_WARNINGF("Unrecognized mode %s\n", mode);
+ return false;
+ }
+
+ if (QuickMenu_Buffer_Size <= 0)
+ {
+ buf_del(QuickMenu_Buffer);
+ QuickMenu_Buffer = -1;
+ return false;
+ }
+
+ if(mode == "file")
+ QuickMenu_Page_Load(submenu, 0);
+ else
+ QuickMenu_Page_Load("", 0);
+
+ hud_panel_quickmenu = 1;
+ if(autocvar_hud_cursormode)
+ setcursormode(1);
+ hudShiftState = 0;
+
+ QuickMenu_TimeOut = ((autocvar_hud_panel_quickmenu_time > 0) ? time + autocvar_hud_panel_quickmenu_time : 0);
+ return true;
+}
+
+void QuickMenu_Buffer_Close()
+{
+ if (QuickMenu_Buffer >= 0)
+ {
+ buf_del(QuickMenu_Buffer);
+ QuickMenu_Buffer = -1;
+ QuickMenu_Buffer_Size = 0;
+ }
+}
+
+void QuickMenu_Close()
+{
+ if (QuickMenu_CurrentSubMenu)
+ strunzone(QuickMenu_CurrentSubMenu);
+ QuickMenu_CurrentSubMenu = string_null;
+ int i;
+ for (i = 0; i < QUICKMENU_MAXLINES; ++i)
+ QuickMenu_Page_ClearEntry(i);
+ QuickMenu_Page_Entries = 0;
+ hud_panel_quickmenu = 0;
+ mouseClicked = 0;
+ prevMouseClicked = 0;
+ QuickMenu_Buffer_Close();
+
+ if(autocvar_hud_cursormode)
+ if(!mv_active)
+ setcursormode(0);
+}
+
+// It assumes submenu open tag is already detected
+void QuickMenu_skip_submenu(string submenu)
+{
+ string s, z_submenu;
+ z_submenu = strzone(submenu);
+ for(++QuickMenu_Buffer_Index ; QuickMenu_Buffer_Index < QuickMenu_Buffer_Size; ++QuickMenu_Buffer_Index)
+ {
+ s = QuickMenu_Buffer_Get();
+ if(substring(s, 0, 1) != QM_TAG_SUBMENU)
+ continue;
+ if(substring(s, 1, -1) == z_submenu) // submenu end
+ break;
+ QuickMenu_skip_submenu(substring(s, 1, -1));
+ }
+ strunzone(z_submenu);
+}
+
+bool QuickMenu_IsOpened()
+{
+ return (QuickMenu_Page_Entries > 0);
+}
+
+void HUD_Quickmenu_PlayerListEntries(string cmd, int teamplayers, bool without_me);
+bool HUD_Quickmenu_PlayerListEntries_Create(string cmd, int teamplayers, bool without_me)
+{
+ TC(int, teamplayers); TC(bool, without_me);
+ int i;
+ for(i = 0; i < QUICKMENU_MAXLINES; ++i)
+ QuickMenu_Page_ClearEntry(i);
+ QuickMenu_Buffer_Close();
+
+ QuickMenu_Buffer = buf_create();
+ if(QuickMenu_Buffer < 0)
+ return false;
+
+ HUD_Quickmenu_PlayerListEntries(cmd, teamplayers, without_me);
+
+ if(QuickMenu_Buffer_Size <= 0)
+ {
+ buf_del(QuickMenu_Buffer);
+ QuickMenu_Buffer = -1;
+ return false;
+ }
+ return true;
+}
+
+// new_page 0 means page 0, new_page != 0 means next page
+int QuickMenu_Buffer_Index_Prev;
+bool QuickMenu_Page_Load(string target_submenu, bool new_page)
+{
+ TC(bool, new_page);
+ string s = string_null, cmd = string_null, z_submenu;
+
+ if (new_page == 0)
+ QuickMenu_Page = 0;
+ else
+ ++QuickMenu_Page;
+
+ z_submenu = strzone(target_submenu);
+ if (QuickMenu_CurrentSubMenu)
+ strunzone(QuickMenu_CurrentSubMenu);
+ QuickMenu_CurrentSubMenu = strzone(z_submenu);
+
+ QuickMenu_IsLastPage = true;
+ QuickMenu_Page_Entries = 0;
+
+ QuickMenu_Buffer_Index = 0;
+ if (z_submenu != "")
+ {
+ // skip everything until the submenu open tag is found
+ for( ; QuickMenu_Buffer_Index < QuickMenu_Buffer_Size; ++QuickMenu_Buffer_Index)
+ {
+ s = QuickMenu_Buffer_Get();
+ if(substring(s, 0, 1) == QM_TAG_SUBMENU && substring(s, 1, -1) == z_submenu)
+ {
+ // printf("^3 beginning of %s\n", z_submenu);
+ ++QuickMenu_Buffer_Index;
+ break; // target_submenu found!
+ }
+ // printf("^1 skipping %s\n", s);
+ }
+ if(QuickMenu_Buffer_Index == QuickMenu_Buffer_Size)
+ LOG_WARNINGF("Couldn't find submenu \"%s\"\n", z_submenu);
+ }
+
+ // only the last page can contain up to QUICKMENU_MAXLINES entries
+ // the other ones contain only (QUICKMENU_MAXLINES - 2) entries
+ // so that the panel can show an empty row and "Continue..."
+ float first_entry = QuickMenu_Page * (QUICKMENU_MAXLINES - 2);
+ int entry_num = 0; // counts entries in target_submenu
+ for( ; QuickMenu_Buffer_Index < QuickMenu_Buffer_Size; ++QuickMenu_Buffer_Index)
+ {
+ s = QuickMenu_Buffer_Get();
+
+ if(z_submenu != "" && substring(s, 1, -1) == z_submenu)
+ {
+ // printf("^3 end of %s\n", z_submenu);
+ break;
+ }
+
+ if(entry_num >= first_entry)
+ {
+ ++QuickMenu_Page_Entries;
+ if(QuickMenu_Page_Entries == QUICKMENU_MAXLINES - 2)
+ QuickMenu_Buffer_Index_Prev = QuickMenu_Buffer_Index;
+ else if(QuickMenu_Page_Entries == QUICKMENU_MAXLINES)
+ {
+ QuickMenu_Page_ClearEntry(QUICKMENU_MAXLINES - 1);
+ QuickMenu_Buffer_Index = QuickMenu_Buffer_Index_Prev;
+ QuickMenu_IsLastPage = false;
+ break;
+ }
+ }
+
+ // NOTE: entries are loaded starting from 1, not from 0
+ if(substring(s, 0, 1) == QM_TAG_SUBMENU)
+ {
+ if(entry_num >= first_entry)
+ QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, substring(s, 1, -1), "");
+ QuickMenu_skip_submenu(substring(s, 1, -1));
+ }
+ else if(entry_num >= first_entry && substring(s, 0, 1) == QM_TAG_TITLE)
+ {
+ ++QuickMenu_Buffer_Index;
+ cmd = QuickMenu_Buffer_Get();
+ string command_code = substring(cmd, 0, 1);
+ if(command_code == QM_TAG_COMMAND)
+ cmd = substring(cmd, 1, -1);
+ else if(command_code == QM_TAG_PLCOMMAND)
+ {
+ // throw away the current quickmenu buffer and load a new one
+ cmd = substring(cmd, 1, -1);
+ strunzone(z_submenu);
+ if(HUD_Quickmenu_PlayerListEntries_Create(cmd, stof(substring(s, 1, 1)), stof(substring(s, 2, 1))))
+ return QuickMenu_Page_Load("", 0);
+ QuickMenu_Close();
+ return false;
+ }
+
+ tokenize_console(cmd);
+ QuickMenu_Page_Command_Type[QuickMenu_Page_Entries] = (argv(1) && argv(0) == "toggle");
+
+ QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, substring(s, 1, -1), cmd);
+ }
+
+ ++entry_num;
+ }
+ strunzone(z_submenu);
+ if (QuickMenu_Page_Entries == 0)
+ {
+ QuickMenu_Close();
+ return false;
+ }
+ QuickMenu_TimeOut = ((autocvar_hud_panel_quickmenu_time > 0) ? time + autocvar_hud_panel_quickmenu_time : 0);
+ return true;
+}
+
+bool QuickMenu_ActionForNumber(int num)
+{
+ TC(int, num);
+ if (!QuickMenu_IsLastPage)
+ {
+ if (num < 0 || num >= QUICKMENU_MAXLINES)
+ return false;
+ if (num == QUICKMENU_MAXLINES - 1)
+ return false;
+ if (num == 0)
+ {
+ QuickMenu_Page_Load(QuickMenu_CurrentSubMenu, +1);
+ return false;
+ }
+ } else if (num <= 0 || num > QuickMenu_Page_Entries)
+ return false;
+
+ if (QuickMenu_Page_Command[num] != "")
+ {
+ localcmd(strcat("\n", QuickMenu_Page_Command[num], "\n"));
+ QuickMenu_TimeOut = ((autocvar_hud_panel_quickmenu_time > 0) ? time + autocvar_hud_panel_quickmenu_time : 0);
+ return true;
+ }
+ if (QuickMenu_Page_Description[num] != "")
+ QuickMenu_Page_Load(QuickMenu_Page_Description[num], 0);
+ return false;
+}
+
+void QuickMenu_Page_ActiveEntry(int entry_num)
+{
+ TC(int, entry_num);
+ QuickMenu_Page_ActivatedEntry = entry_num;
+ QuickMenu_Page_ActivatedEntry_Time = time + 0.1;
+ if(QuickMenu_Page_Command[QuickMenu_Page_ActivatedEntry])
+ {
+ bool f = QuickMenu_ActionForNumber(QuickMenu_Page_ActivatedEntry);
+ // toggle commands don't close the quickmenu
+ if(QuickMenu_Page_Command_Type[QuickMenu_Page_ActivatedEntry] == 1)
+ QuickMenu_Page_ActivatedEntry_Close = false;
+ else
+ QuickMenu_Page_ActivatedEntry_Close = (f && !(hudShiftState & S_CTRL));
+ }
+ else
+ QuickMenu_Page_ActivatedEntry_Close = (!(hudShiftState & S_CTRL));
+}
+
+bool QuickMenu_InputEvent(int bInputType, float nPrimary, float nSecondary)
+{
+ TC(int, bInputType);
+ // we only care for keyboard events
+ if(bInputType == 2)
+ return false;
+
+ if(!QuickMenu_IsOpened() || autocvar__hud_configure || mv_active)
+ return false;
+
+ if(bInputType == 3)
+ {
+ mousepos.x = nPrimary;
+ mousepos.y = nSecondary;
+ return true;
+ }
+
+ // allow console bind to work
+ string con_keys;
+ float keys;
+ con_keys = findkeysforcommand("toggleconsole", 0);
+ keys = tokenize(con_keys); // findkeysforcommand returns data for this
+
+ bool hit_con_bind = false;
+ int i;
+ for (i = 0; i < keys; ++i)
+ {
+ if(nPrimary == stof(argv(i)))
+ hit_con_bind = true;
+ }
+
+ if(bInputType == 0) {
+ if(nPrimary == K_ALT) hudShiftState |= S_ALT;
+ if(nPrimary == K_CTRL) hudShiftState |= S_CTRL;
+ if(nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
+ }
+ else if(bInputType == 1) {
+ if(nPrimary == K_ALT) hudShiftState -= (hudShiftState & S_ALT);
+ if(nPrimary == K_CTRL) hudShiftState -= (hudShiftState & S_CTRL);
+ if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT);
+ }
+
+ if(nPrimary == K_ESCAPE)
+ {
+ if (bInputType == 1)
+ return true;
+ QuickMenu_Close();
+ }
+ else if(nPrimary >= '0' && nPrimary <= '9')
+ {
+ if (bInputType == 1)
+ return true;
+ QuickMenu_Page_ActiveEntry(stof(chr2str(nPrimary)));
+ }
+ if(nPrimary == K_MOUSE1)
+ {
+ if(bInputType == 0) // key pressed
+ mouseClicked |= S_MOUSE1;
+ else if(bInputType == 1) // key released
+ mouseClicked -= (mouseClicked & S_MOUSE1);
+ }
+ else if(nPrimary == K_MOUSE2)
+ {
+ if(bInputType == 0) // key pressed
+ mouseClicked |= S_MOUSE2;
+ else if(bInputType == 1) // key released
+ mouseClicked -= (mouseClicked & S_MOUSE2);
+ }
+ else if(hit_con_bind)
+ return false;
+
+ return true;
+}
+
+void QuickMenu_Mouse()
+{
+ if(mv_active) return;
+
+ if(!mouseClicked)
+ if(prevMouseClicked & S_MOUSE2)
+ {
+ QuickMenu_Close();
+ return;
+ }
+
+ if(!autocvar_hud_cursormode)
+ {
+ mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
+
+ mousepos.x = bound(0, mousepos.x, vid_conwidth);
+ mousepos.y = bound(0, mousepos.y, vid_conheight);
+ }
+
+ HUD_Panel_UpdateCvars();
+
+ if(panel_bg_padding)
+ {
+ panel_pos += '1 1 0' * panel_bg_padding;
+ panel_size -= '2 2 0' * panel_bg_padding;
+ }
+
+ float first_entry_pos, entries_height;
+ vector fontsize;
+ fontsize = '1 1 0' * (panel_size.y / QUICKMENU_MAXLINES);
+ first_entry_pos = panel_pos.y + ((QUICKMENU_MAXLINES - QuickMenu_Page_Entries) * fontsize.y) / 2;
+ entries_height = panel_size.y - ((QUICKMENU_MAXLINES - QuickMenu_Page_Entries) * fontsize.y);
+
+ if (mousepos.x >= panel_pos.x && mousepos.y >= first_entry_pos && mousepos.x <= panel_pos.x + panel_size.x && mousepos.y <= first_entry_pos + entries_height)
+ {
+ float entry_num;
+ entry_num = floor((mousepos.y - first_entry_pos) / fontsize.y);
+ if (QuickMenu_IsLastPage || entry_num != QUICKMENU_MAXLINES - 2)
+ {
+ panel_pos.y = first_entry_pos + entry_num * fontsize.y;
+ vector color;
+ if(mouseClicked & S_MOUSE1)
+ color = '0.5 1 0.5';
+ else if(hudShiftState & S_CTRL)
+ color = '1 1 0.3';
+ else
+ color = '1 1 1';
+ drawfill(panel_pos, eX * panel_size.x + eY * fontsize.y, color, .2, DRAWFLAG_NORMAL);
+
+ if(!mouseClicked && (prevMouseClicked & S_MOUSE1))
+ QuickMenu_Page_ActiveEntry((entry_num < QUICKMENU_MAXLINES - 1) ? entry_num + 1 : 0);
+ }
+ }
+
+ draw_cursor_normal(mousepos, '1 1 1', 0.8);
+
+ prevMouseClicked = mouseClicked;
+}
+
+void HUD_Quickmenu_DrawEntry(vector pos, string desc, string option, vector fontsize)
+{
+ string entry;
+ float offset;
+ float desc_width = panel_size.x;
+ if(option)
+ {
+ string pic = strcat(hud_skin_path, "/", option);
+ if(precache_pic(pic) == "")
+ pic = strcat("gfx/hud/default/", option);
+ vector option_size = '1 1 0' * fontsize.y * 0.8;
+ desc_width -= option_size.x;
+ drawpic(pos + eX * desc_width + eY * (fontsize.y - option_size.y) / 2, pic, option_size, '1 1 1', panel_fg_alpha, DRAWFLAG_ADDITIVE);
+ desc_width -= fontsize.x / 4;
+ }
+ entry = textShortenToWidth(desc, desc_width, fontsize, stringwidth_colors);
+ if (autocvar_hud_panel_quickmenu_align > 0)
+ {
+ float real_desc_width = stringwidth_colors(entry, fontsize);
+ offset = (desc_width - real_desc_width) * min(autocvar_hud_panel_quickmenu_align, 1);
+
+ if(option)
+ {
+ // when there's enough room align description regardless the checkbox
+ float extra_offset = (panel_size.x - desc_width) * min(autocvar_hud_panel_quickmenu_align, 1);
+ if(offset + real_desc_width + extra_offset < desc_width)
+ offset += extra_offset;
+ else
+ offset = max(0, desc_width - real_desc_width);
+ }
+ drawcolorcodedstring(pos + eX * offset, entry, fontsize, panel_fg_alpha, DRAWFLAG_ADDITIVE);
+ }
+ else
+ drawcolorcodedstring(pos, entry, fontsize, panel_fg_alpha, DRAWFLAG_ADDITIVE);
+}
+
+void HUD_QuickMenu()
+{
+ if(!autocvar__hud_configure)
+ {
+ if (hud_configure_prev && hud_configure_prev != -1)
+ QuickMenu_Close();
+
+ if(!hud_draw_maximized) return;
+ if(mv_active) return;
+ //if(!autocvar_hud_panel_quickmenu) return;
+ if(!hud_panel_quickmenu) return;
+
+ if(QuickMenu_TimeOut)
+ if(time > QuickMenu_TimeOut)
+ {
+ QuickMenu_Close();
+ return;
+ }
+ }
+ else
+ {
+ if(!QuickMenu_IsOpened())
+ {
+ QuickMenu_Page_Entries = 1;
+ QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, sprintf(_("Submenu%d"), QuickMenu_Page_Entries), "");
+ ++QuickMenu_Page_Entries;
+ QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, sprintf(_("Submenu%d"), QuickMenu_Page_Entries), "");
+ ++QuickMenu_Page_Entries;
+ // although real command doesn't matter here, it must not be empty
+ // otherwise the entry is displayed like a submenu
+ for (; QuickMenu_Page_Entries < QUICKMENU_MAXLINES - 1; ++QuickMenu_Page_Entries)
+ QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, sprintf(_("Command%d"), QuickMenu_Page_Entries), "-");
+ ++QuickMenu_Page_Entries;
+ QuickMenu_Page_ClearEntry(QuickMenu_Page_Entries);
+ QuickMenu_IsLastPage = false;
+ }
+ }
+
+ HUD_Panel_UpdateCvars();
+
+ HUD_Scale_Enable();
+ HUD_Panel_DrawBg(1);
+
+ if(panel_bg_padding)
+ {
+ panel_pos += '1 1 0' * panel_bg_padding;
+ panel_size -= '2 2 0' * panel_bg_padding;
+ }
+
+ int i;
+ vector fontsize;
+ string color;
+ fontsize = '1 1 0' * (panel_size.y / QUICKMENU_MAXLINES);
+
+ if (!QuickMenu_IsLastPage)
+ {
+ color = "^5";
+ HUD_Quickmenu_DrawEntry(panel_pos + eY * (panel_size.y - fontsize.y), sprintf("%d: %s%s", 0, color, _("Continue...")), string_null, fontsize);
+ }
+ else
+ panel_pos.y += ((QUICKMENU_MAXLINES - QuickMenu_Page_Entries) * fontsize.y) / 2;
+
+ for (i = 1; i <= QuickMenu_Page_Entries; ++i) {
+ if (QuickMenu_Page_Description[i] == "")
+ break;
+ string option = string_null;
+ if (QuickMenu_Page_Command[i] == "")
+ color = "^4";
+ else
+ {
+ color = "^3";
+ if(QuickMenu_Page_Command_Type[i] == 1) // toggle command
+ {
+ int end = strstrofs(QuickMenu_Page_Command[i], ";", 0);
+ if(end < 0)
+ tokenize_console(QuickMenu_Page_Command[i]);
+ else
+ tokenize_console(substring(QuickMenu_Page_Command[i], 0, end));
+
+ //if(argv(1) && argv(0) == "toggle") // already checked
+ {
+ // "enable feature xxx" "toggle xxx" (or "toggle xxx 1 0")
+ // "disable feature xxx" "toggle xxx 0 1"
+ float ON_value = 1, OFF_value = 0;
+ if(argv(2))
+ ON_value = stof(argv(2));
+
+ if(argv(3))
+ OFF_value = stof(argv(3));
+ else
+ OFF_value = !ON_value;
+
+ float value = cvar(argv(1));
+ if(value == ON_value)
+ option = "checkbox_checked";
+ else if(value == OFF_value)
+ option = "checkbox_empty";
+ else
+ option = "checkbox_undefined";
+ }
+ }
+ }
+ HUD_Quickmenu_DrawEntry(panel_pos, sprintf("%d: %s%s", i, color, QuickMenu_Page_Description[i]), option, fontsize);
+
+ if(QuickMenu_Page_ActivatedEntry_Time && time < QuickMenu_Page_ActivatedEntry_Time
+ && QuickMenu_Page_ActivatedEntry == i)
+ drawfill(panel_pos, eX * panel_size.x + eY * fontsize.y, '0.5 1 0.5', .2, DRAWFLAG_NORMAL);
+
+ panel_pos.y += fontsize.y;
+ }
+
+ if(QuickMenu_Page_ActivatedEntry >= 0 && time >= QuickMenu_Page_ActivatedEntry_Time)
+ {
+ if(!QuickMenu_Page_Command[QuickMenu_Page_ActivatedEntry])
+ {
+ bool f = QuickMenu_ActionForNumber(QuickMenu_Page_ActivatedEntry);
+ if(f && QuickMenu_Page_ActivatedEntry_Close)
+ QuickMenu_Close();
+ }
+ else if(QuickMenu_Page_ActivatedEntry_Close)
+ QuickMenu_Close();
+ QuickMenu_Page_ActivatedEntry = -1;
+ QuickMenu_Page_ActivatedEntry_Time = 0;
+ }
+}
+
+
+#define QUICKMENU_SMENU(submenu,eng_submenu) { \
+ if(target_submenu == eng_submenu && target_submenu_found) \
+ return; /* target_submenu entries are now loaded, exit */ \
+ if(QuickMenu_Buffer_Size < QUICKMENU_BUFFER_MAXENTRIES) \
+ QuickMenu_Buffer_Set(QM_TAG_SUBMENU, submenu); \
+ ++QuickMenu_Buffer_Size; \
+ if(target_submenu == eng_submenu && !target_submenu_found) { \
+ QuickMenu_Buffer_Size = 0; /* enable load of next entries */ \
+ target_submenu_found = true; \
+ } \
+}
+
+#define QUICKMENU_ENTRY(title,command) { \
+ if(QuickMenu_Buffer_Size + 1 < QUICKMENU_BUFFER_MAXENTRIES) \
+ { \
+ QuickMenu_Buffer_Set(QM_TAG_TITLE, title); \
+ ++QuickMenu_Buffer_Size; \
+ QuickMenu_Buffer_Set(QM_TAG_COMMAND, command); \
+ } \
+ ++QuickMenu_Buffer_Size; \
+}
+
+#define QUICKMENU_SMENU_PL(submenu,eng_submenu,command,teamplayers,without_me) { \
+ if(QuickMenu_Buffer_Size + 3 < QUICKMENU_BUFFER_MAXENTRIES) {\
+ QUICKMENU_SMENU(submenu,eng_submenu) \
+ QuickMenu_Buffer_Set(QM_TAG_TITLE, strcat(ftos(teamplayers), ftos(without_me))); \
+ ++QuickMenu_Buffer_Size; \
+ QuickMenu_Buffer_Set(QM_TAG_PLCOMMAND, command); \
+ ++QuickMenu_Buffer_Size; \
+ QUICKMENU_SMENU(submenu,eng_submenu) \
+ } \
+}
+
+
+
+// useful to Translate a string inside the Command
+#define QUICKMENU_ENTRY_TC(title,command,text,translated_text) {\
+ if(prvm_language == "en") \
+ QUICKMENU_ENTRY(title, sprintf(command, text)) \
+ else if(!autocvar_hud_panel_quickmenu_translatecommands || translated_text == text) \
+ QUICKMENU_ENTRY(strcat("(en)", title), sprintf(command, text)) \
+ else \
+ QUICKMENU_ENTRY(strcat("(", prvm_language, ")", title), sprintf(command, translated_text)) \
+}
+
+void HUD_Quickmenu_PlayerListEntries(string cmd, int teamplayers, bool without_me)
+{
+ TC(int, teamplayers); TC(bool, without_me);
+ entity pl;
+ if(teamplayers && !team_count)
+ return;
+
+ for(pl = players.sort_next; pl; pl = pl.sort_next)
+ {
+ if(teamplayers == 1 && (pl.team != myteam || pl.team == NUM_SPECTATOR)) // only own team players
+ continue;
+ if(teamplayers == 2 && (pl.team == myteam || pl.team == NUM_SPECTATOR)) // only enemy team players
+ continue;
+ if(without_me && pl.sv_entnum == player_localnum)
+ continue;
+ QUICKMENU_ENTRY(entcs_GetName(pl.sv_entnum), sprintf(cmd, entcs_GetName(pl.sv_entnum)))
+ }
+
+ return;
+}
+
+
+// Specifying target_submenu, this function only loads entries inside target_submenu
+// NOTE: alternatively we could have loaded the whole default quickmenu and
+// then called QuickMenu_Page_Load(target_submenu, 0);
+// but this sytem is more reliable since we can always refer to target_submenu
+// with the English title even if a translation is active
+void QuickMenu_Default(string target_submenu)
+{
+ bool target_submenu_found = false;
+ if(target_submenu != "")
+ QuickMenu_Buffer_Size = QUICKMENU_BUFFER_MAXENTRIES; // forbids load of next entries until target_submenu
+
+ QUICKMENU_SMENU(CTX(_("QMCMD^Chat")), "Chat")
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^nice one")), "say %s", ":-) / nice one", CTX(_("QMCMD^:-) / nice one")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^good game")), "say %s", "good game", CTX(_("QMCMD^good game")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^hi / good luck")), "say %s", "hi / good luck and have fun", CTX(_("QMCMD^hi / good luck and have fun")))
+ QUICKMENU_SMENU(CTX(_("QMCMD^Chat")), "Chat")
+
+ if(teamplay)
+ {
+ QUICKMENU_SMENU(CTX(_("QMCMD^Team chat")), "Team chat")
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^quad soon")), "say_team %s", "quad soon", CTX(_("QMCMD^quad soon")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^free item, icon")), "say_team %s; g_waypointsprite_team_here_p", "free item %x^7 (l:%y^7)", CTX(_("QMCMD^free item %x^7 (l:%y^7)")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^took item, icon")), "say_team %s; g_waypointsprite_team_here", "took item (l:%l^7)", CTX(_("QMCMD^took item (l:%l^7)")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^negative")), "say_team %s", "negative", CTX(_("QMCMD^negative")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^positive")), "say_team %s", "positive", CTX(_("QMCMD^positive")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^need help, icon")), "say_team %s; g_waypointsprite_team_helpme; cmd voice needhelp", "need help (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)", CTX(_("QMCMD^need help (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^enemy seen, icon")), "say_team %s; g_waypointsprite_team_danger_p; cmd voice incoming", "enemy seen (l:%y^7)", CTX(_("QMCMD^enemy seen (l:%y^7)")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^flag seen, icon")), "say_team %s; g_waypointsprite_team_here_p; cmd voice seenflag", "flag seen (l:%y^7)", CTX(_("QMCMD^flag seen (l:%y^7)")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^defending, icon")), "say_team %s; g_waypointsprite_team_here", "defending (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)", CTX(_("QMCMD^defending (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^roaming, icon")), "say_team %s; g_waypointsprite_team_here", "roaming (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)", CTX(_("QMCMD^roaming (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^attacking, icon")), "say_team %s; g_waypointsprite_team_here", "attacking (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)", CTX(_("QMCMD^attacking (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^killed flag, icon")), "say_team %s; g_waypointsprite_team_here_p", "killed flagcarrier (l:%y^7)", CTX(_("QMCMD^killed flagcarrier (l:%y^7)")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^dropped flag, icon")), "say_team %s; g_waypointsprite_team_here_d", "dropped flag (l:%d^7)", CTX(_("QMCMD^dropped flag (l:%d^7)")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^drop gun, icon")), "say_team %s; g_waypointsprite_team_here; wait; dropweapon", "dropped gun %w^7 (l:%l^7)", CTX(_("QMCMD^dropped gun %w^7 (l:%l^7)")))
+ QUICKMENU_ENTRY_TC(CTX(_("QMCMD^drop flag/key, icon")), "say_team %s; g_waypointsprite_team_here; wait; use", "dropped flag/key %w^7 (l:%l^7)", CTX(_("QMCMD^dropped flag/key %w^7 (l:%l^7)")))
+ QUICKMENU_SMENU(CTX(_("QMCMD^Team chat")), "Team chat")
+ }
+
+ QUICKMENU_SMENU_PL(CTX(_("QMCMD^Send private message to")), "Send private message to", "commandmode tell \"%s^7\"", 0, 1)
+
+ QUICKMENU_SMENU(CTX(_("QMCMD^Settings")), "Settings")
+ QUICKMENU_SMENU(CTX(_("QMCMD^View/HUD settings")), "View/HUD settings")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^3rd person view")), "toggle chase_active")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Player models like mine")), "toggle cl_forceplayermodels")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Names above players")), "toggle hud_shownames")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Crosshair per weapon")), "toggle crosshair_per_weapon")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^FPS")), "toggle hud_panel_engineinfo")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Net graph")), "toggle shownetgraph")
+ QUICKMENU_SMENU(CTX(_("QMCMD^View/HUD settings")), "View/HUD settings")
+
+ QUICKMENU_SMENU(CTX(_("QMCMD^Sound settings")), "Sound settings")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Hit sound")), "toggle cl_hitsound")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Chat sound")), "toggle con_chatsound")
+ QUICKMENU_SMENU(CTX(_("QMCMD^Sound settings")), "Sound settings")
+
+ if(spectatee_status > 0)
+ {
+ QUICKMENU_SMENU(CTX(_("QMCMD^Spectator camera")), "Spectator camera")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^1st person")), "chase_active 0; -use")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^3rd person around player")), "chase_active 1; +use")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^3rd person behind")), "chase_active 1; -use")
+ QUICKMENU_SMENU(CTX(_("QMCMD^Spectator camera")), "Spectator camera")
+ }
+
+ if(spectatee_status == -1)
+ {
+ QUICKMENU_SMENU(CTX(_("QMCMD^Observer camera")), "Observer camera")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Increase speed")), "weapnext")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Decrease speed")), "weapprev")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Wall collision off")), "+use")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Wall collision on")), "-use")
+ QUICKMENU_SMENU(CTX(_("QMCMD^Observer camera")), "Observer camera")
+ }
+
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Fullscreen")), "toggle vid_fullscreen; vid_restart")
+ if(prvm_language != "en")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Translate chat messages")), "toggle hud_panel_quickmenu_translatecommands")
+ QUICKMENU_SMENU(CTX(_("QMCMD^Settings")), "Settings")
+
+ QUICKMENU_SMENU(CTX(_("QMCMD^Call a vote")), "Call a vote")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Restart the map")), "vcall restart")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^End match")), "vcall endmatch")
+ if(STAT(TIMELIMIT) > 0)
+ {
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Reduce match time")), "vcall reducematchtime")
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Extend match time")), "vcall extendmatchtime")
+ }
+ if(teamplay)
+ QUICKMENU_ENTRY(CTX(_("QMCMD^Shuffle teams")), "vcall shuffleteams")
+ QUICKMENU_SMENU(CTX(_("QMCMD^Call a vote")), "Call a vote")
+
+ if(target_submenu != "" && !target_submenu_found)
+ {
+ LOG_WARNINGF("Couldn't find submenu \"%s\"\n", target_submenu);
+ if(prvm_language != "en")
+ LOG_WARNINGF("^3Warning: submenu must be in English\n", target_submenu);
+ QuickMenu_Buffer_Size = 0;
+ }
+}
+#undef QUICKMENU_SMENU
+#undef QUICKMENU_ENTRY
+#undef QUICKMENU_ENTRY_TC
#pragma once
#include "../panel.qh"
+
+bool QuickMenu_InputEvent(float bInputType, float nPrimary, float nSecondary);
+bool QuickMenu_IsOpened();
+void QuickMenu_Mouse();
#include <common/mapinfo.qh>
/** Race timer (#8) */
+
+// return the string of the onscreen race timer
+string MakeRaceString(int cp, float mytime, float theirtime, float lapdelta, string theirname)
+{
+ TC(int, cp);
+ string col;
+ string timestr;
+ string cpname;
+ string lapstr;
+ lapstr = "";
+
+ if(theirtime == 0) // goal hit
+ {
+ if(mytime > 0)
+ {
+ timestr = strcat("+", ftos_decimals(+mytime, TIME_DECIMALS));
+ col = "^1";
+ }
+ else if(mytime == 0)
+ {
+ timestr = "+0.0";
+ col = "^3";
+ }
+ else
+ {
+ timestr = strcat("-", ftos_decimals(-mytime, TIME_DECIMALS));
+ col = "^2";
+ }
+
+ if(lapdelta > 0)
+ {
+ lapstr = sprintf(_(" (-%dL)"), lapdelta);
+ col = "^2";
+ }
+ else if(lapdelta < 0)
+ {
+ lapstr = sprintf(_(" (+%dL)"), -lapdelta);
+ col = "^1";
+ }
+ }
+ else if(theirtime > 0) // anticipation
+ {
+ if(mytime >= theirtime)
+ timestr = strcat("+", ftos_decimals(mytime - theirtime, TIME_DECIMALS));
+ else
+ timestr = TIME_ENCODED_TOSTRING(TIME_ENCODE(theirtime));
+ col = "^3";
+ }
+ else
+ {
+ col = "^7";
+ timestr = "";
+ }
+
+ if(cp == 254)
+ cpname = _("Start line");
+ else if(cp == 255)
+ cpname = _("Finish line");
+ else if(cp)
+ cpname = sprintf(_("Intermediate %d"), cp);
+ else
+ cpname = _("Finish line");
+
+ if(theirtime < 0)
+ return strcat(col, cpname);
+ else if(theirname == "")
+ return strcat(col, sprintf("%s (%s)", cpname, timestr));
+ else
+ return strcat(col, sprintf("%s (%s %s)", cpname, timestr, strcat(theirname, col, lapstr)));
+}
+
void HUD_RaceTimer ()
{
if(!autocvar__hud_configure)
#include "hud/all.qh"
#include "mapvoting.qh"
#include "mutators/events.qh"
-#include "quickmenu.qh"
+#include "hud/panel/quickmenu.qh"
#include "scoreboard.qh"
#include "shownames.qh"
#include <common/t_items.qh>
--- /dev/null
+// generated file; do not modify
-#include "../lib/_all.inc"
+#include <lib/_all.inc>
#include "_all.qh"
-#include "../common/effects/qc/all.qc"
+#include "_mod.inc"
+#include "commands/_mod.inc"
+#include "hud/_mod.inc"
+#include "mutators/_mod.inc"
+#include "weapons/_mod.inc"
-#include "announcer.qc"
-#include "bgmscript.qc"
-#include "csqcmodel_hooks.qc"
-#include "hud/all.qc"
-#include "main.qc"
-#include "mapvoting.qc"
-#include "miscfunctions.qc"
-#include "player_skeleton.qc"
-#include "scoreboard.qc"
-#include "shownames.qc"
-#include "teamradar.qc"
-#include "view.qc"
-#include "wall.qc"
+#include <common/_all.inc>
+#include <common/effects/qc/all.qc>
-#include "commands/all.qc"
+#include <lib/csqcmodel/cl_model.qc>
+#include <lib/csqcmodel/cl_player.qc>
+#include <lib/csqcmodel/interpolate.qc>
-#include "weapons/projectile.qc" // TODO
-
-#include "../common/_all.inc"
-
-#include "../lib/csqcmodel/cl_model.qc"
-#include "../lib/csqcmodel/cl_player.qc"
-#include "../lib/csqcmodel/interpolate.qc"
-
-#include "../lib/warpzone/anglestransform.qc"
-#include "../lib/warpzone/client.qc"
-#include "../lib/warpzone/common.qc"
-#include "../lib/warpzone/server.qc"
-#include "../lib/warpzone/util_server.qc"
+#include <lib/warpzone/anglestransform.qc>
+#include <lib/warpzone/common.qc>
+#include <lib/warpzone/client.qc>
+#include <lib/warpzone/server.qc>
+#include <lib/warpzone/util_server.qc>
#if BUILD_MOD
#include "../../mod/client/progs.inc"
+++ /dev/null
-#include "quickmenu.qh"
-
-#include <common/ent_cs.qh>
-#include "hud/all.qh"
-#include "mapvoting.qh"
-
-// QUICKMENU_MAXLINES must be <= 10
-const int QUICKMENU_MAXLINES = 10;
-// visible entries are loaded from QuickMenu_Buffer into QuickMenu_Page_* arrays
-string QuickMenu_Page_Command[QUICKMENU_MAXLINES];
-string QuickMenu_Page_Description[QUICKMENU_MAXLINES];
-int QuickMenu_Page_Command_Type[QUICKMENU_MAXLINES];
-int QuickMenu_Page_Entries;
-int QuickMenu_Page;
-int QuickMenu_Page_ActivatedEntry = -1;
-bool QuickMenu_Page_ActivatedEntry_Close;
-float QuickMenu_Page_ActivatedEntry_Time;
-bool QuickMenu_IsLastPage;
-// all the entries are loaded into QuickMenu_Buffer
-// each entry (submenu or command) is composed of 2 entries
-const int QUICKMENU_MAXENTRIES = 256;
-const int QUICKMENU_BUFFER_MAXENTRIES = 2 * QUICKMENU_MAXENTRIES;
-int QuickMenu_Buffer = -1;
-int QuickMenu_Buffer_Size;
-int QuickMenu_Buffer_Index;
-string QuickMenu_CurrentSubMenu;
-float QuickMenu_TimeOut;
-
-// QuickMenu_Buffer are labeled with these tags
-#define QM_TAG_TITLE "T"
-#define QM_TAG_SUBMENU "S"
-#define QM_TAG_COMMAND "C"
-#define QM_TAG_PLCOMMAND "P"
-
-#define QuickMenu_Buffer_Set(tag, string) bufstr_set(QuickMenu_Buffer, QuickMenu_Buffer_Size, strcat(tag, string))
-#define QuickMenu_Buffer_Get() bufstr_get(QuickMenu_Buffer, QuickMenu_Buffer_Index)
-
-// if s1 is not empty s will be displayed as command otherwise as submenu
-void QuickMenu_Page_LoadEntry(int i, string s, string s1)
-{
- TC(int, i);
- //printf("^xc80 entry %d: %s, %s\n", i, s, s1);
- if (QuickMenu_Page_Description[i])
- strunzone(QuickMenu_Page_Description[i]);
- QuickMenu_Page_Description[i] = strzone(s);
- if (QuickMenu_Page_Command[i])
- strunzone(QuickMenu_Page_Command[i]);
- QuickMenu_Page_Command[i] = strzone(s1);
-}
-
-void QuickMenu_Page_ClearEntry(int i)
-{
- TC(int, i);
- if (QuickMenu_Page_Description[i])
- strunzone(QuickMenu_Page_Description[i]);
- QuickMenu_Page_Description[i] = string_null;
- if (QuickMenu_Page_Command[i])
- strunzone(QuickMenu_Page_Command[i]);
- QuickMenu_Page_Command[i] = string_null;
-}
-
-float QuickMenu_Page_Load(string target_submenu, float new_page);
-void QuickMenu_Default(string submenu);
-bool QuickMenu_Open(string mode, string submenu)
-{
- int fh = -1;
- string s;
-
- if(mode == "")
- {
- if(autocvar_hud_panel_quickmenu_file == "" || autocvar_hud_panel_quickmenu_file == "0")
- mode = "default";
- else
- mode = "file";
- }
-
- if(mode == "file")
- {
- if(autocvar_hud_panel_quickmenu_file == "" || autocvar_hud_panel_quickmenu_file == "0")
- LOG_INFO("No file name is set in hud_panel_quickmenu_file, loading default quickmenu\n");
- else
- {
- fh = fopen(autocvar_hud_panel_quickmenu_file, FILE_READ);
- if(fh < 0)
- LOG_INFOF("Couldn't open file \"%s\", loading default quickmenu\n", autocvar_hud_panel_quickmenu_file);
- }
- if(fh < 0)
- mode = "default";
- }
-
- if(mode == "default")
- {
- QuickMenu_Buffer = buf_create();
- if(QuickMenu_Buffer < 0)
- return false;
-
- QuickMenu_Default(submenu);
- }
- else if(mode == "file")
- {
- QuickMenu_Buffer = buf_create();
- if(QuickMenu_Buffer < 0)
- {
- fclose(fh);
- return false;
- }
-
- QuickMenu_Buffer_Size = 0;
- while((s = fgets(fh)) && QuickMenu_Buffer_Size < QUICKMENU_BUFFER_MAXENTRIES)
- {
- // first skip invalid entries, so we don't check them anymore
- float argc;
- argc = tokenize_console(s);
- if(argc == 0 || argv(0) == "")
- continue;
- if(argc == 1)
- QuickMenu_Buffer_Set(QM_TAG_SUBMENU, argv(0));
- else if(argc == 2)
- {
- if(argv(1) == "")
- continue;
- QuickMenu_Buffer_Set(QM_TAG_TITLE, argv(0));
- ++QuickMenu_Buffer_Size;
- QuickMenu_Buffer_Set(QM_TAG_COMMAND, argv(1));
- }
- else if(argc == 3)
- {
- // check for special keywords
- float teamplayers = 0, without_me = 0;
- switch(argv(2))
- {
- case "ALLPLAYERS_BUT_ME": without_me = 1; // fall through
- case "ALLPLAYERS": teamplayers = 0; break;
- case "OWNTEAMPLAYERS_BUT_ME": without_me = 1; // fall through
- case "OWNTEAMPLAYERS": teamplayers = 1; break;
- case "ENEMYTEAMPLAYERS": teamplayers = 2; break;
- default: continue;
- }
-
- if(QuickMenu_Buffer_Size + 3 < QUICKMENU_BUFFER_MAXENTRIES)
- {
- QuickMenu_Buffer_Set(QM_TAG_SUBMENU, argv(0));
- ++QuickMenu_Buffer_Size;
- QuickMenu_Buffer_Set(QM_TAG_TITLE, strcat(ftos(teamplayers), ftos(without_me))); // put PLCOMMAND arguments in the title string
- ++QuickMenu_Buffer_Size;
- QuickMenu_Buffer_Set(QM_TAG_PLCOMMAND, argv(1));
- ++QuickMenu_Buffer_Size;
- QuickMenu_Buffer_Set(QM_TAG_SUBMENU, argv(0));
- }
- }
- ++QuickMenu_Buffer_Size;
- }
- fclose(fh);
- }
- else
- {
- LOG_WARNINGF("Unrecognized mode %s\n", mode);
- return false;
- }
-
- if (QuickMenu_Buffer_Size <= 0)
- {
- buf_del(QuickMenu_Buffer);
- QuickMenu_Buffer = -1;
- return false;
- }
-
- if(mode == "file")
- QuickMenu_Page_Load(submenu, 0);
- else
- QuickMenu_Page_Load("", 0);
-
- hud_panel_quickmenu = 1;
- if(autocvar_hud_cursormode)
- setcursormode(1);
- hudShiftState = 0;
-
- QuickMenu_TimeOut = ((autocvar_hud_panel_quickmenu_time > 0) ? time + autocvar_hud_panel_quickmenu_time : 0);
- return true;
-}
-
-void QuickMenu_Buffer_Close()
-{
- if (QuickMenu_Buffer >= 0)
- {
- buf_del(QuickMenu_Buffer);
- QuickMenu_Buffer = -1;
- QuickMenu_Buffer_Size = 0;
- }
-}
-
-void QuickMenu_Close()
-{
- if (QuickMenu_CurrentSubMenu)
- strunzone(QuickMenu_CurrentSubMenu);
- QuickMenu_CurrentSubMenu = string_null;
- int i;
- for (i = 0; i < QUICKMENU_MAXLINES; ++i)
- QuickMenu_Page_ClearEntry(i);
- QuickMenu_Page_Entries = 0;
- hud_panel_quickmenu = 0;
- mouseClicked = 0;
- prevMouseClicked = 0;
- QuickMenu_Buffer_Close();
-
- if(autocvar_hud_cursormode)
- if(!mv_active)
- setcursormode(0);
-}
-
-// It assumes submenu open tag is already detected
-void QuickMenu_skip_submenu(string submenu)
-{
- string s, z_submenu;
- z_submenu = strzone(submenu);
- for(++QuickMenu_Buffer_Index ; QuickMenu_Buffer_Index < QuickMenu_Buffer_Size; ++QuickMenu_Buffer_Index)
- {
- s = QuickMenu_Buffer_Get();
- if(substring(s, 0, 1) != QM_TAG_SUBMENU)
- continue;
- if(substring(s, 1, -1) == z_submenu) // submenu end
- break;
- QuickMenu_skip_submenu(substring(s, 1, -1));
- }
- strunzone(z_submenu);
-}
-
-bool QuickMenu_IsOpened()
-{
- return (QuickMenu_Page_Entries > 0);
-}
-
-void HUD_Quickmenu_PlayerListEntries(string cmd, int teamplayers, bool without_me);
-bool HUD_Quickmenu_PlayerListEntries_Create(string cmd, int teamplayers, bool without_me)
-{
- TC(int, teamplayers); TC(bool, without_me);
- int i;
- for(i = 0; i < QUICKMENU_MAXLINES; ++i)
- QuickMenu_Page_ClearEntry(i);
- QuickMenu_Buffer_Close();
-
- QuickMenu_Buffer = buf_create();
- if(QuickMenu_Buffer < 0)
- return false;
-
- HUD_Quickmenu_PlayerListEntries(cmd, teamplayers, without_me);
-
- if(QuickMenu_Buffer_Size <= 0)
- {
- buf_del(QuickMenu_Buffer);
- QuickMenu_Buffer = -1;
- return false;
- }
- return true;
-}
-
-// new_page 0 means page 0, new_page != 0 means next page
-int QuickMenu_Buffer_Index_Prev;
-bool QuickMenu_Page_Load(string target_submenu, bool new_page)
-{
- TC(bool, new_page);
- string s = string_null, cmd = string_null, z_submenu;
-
- if (new_page == 0)
- QuickMenu_Page = 0;
- else
- ++QuickMenu_Page;
-
- z_submenu = strzone(target_submenu);
- if (QuickMenu_CurrentSubMenu)
- strunzone(QuickMenu_CurrentSubMenu);
- QuickMenu_CurrentSubMenu = strzone(z_submenu);
-
- QuickMenu_IsLastPage = true;
- QuickMenu_Page_Entries = 0;
-
- QuickMenu_Buffer_Index = 0;
- if (z_submenu != "")
- {
- // skip everything until the submenu open tag is found
- for( ; QuickMenu_Buffer_Index < QuickMenu_Buffer_Size; ++QuickMenu_Buffer_Index)
- {
- s = QuickMenu_Buffer_Get();
- if(substring(s, 0, 1) == QM_TAG_SUBMENU && substring(s, 1, -1) == z_submenu)
- {
- // printf("^3 beginning of %s\n", z_submenu);
- ++QuickMenu_Buffer_Index;
- break; // target_submenu found!
- }
- // printf("^1 skipping %s\n", s);
- }
- if(QuickMenu_Buffer_Index == QuickMenu_Buffer_Size)
- LOG_WARNINGF("Couldn't find submenu \"%s\"\n", z_submenu);
- }
-
- // only the last page can contain up to QUICKMENU_MAXLINES entries
- // the other ones contain only (QUICKMENU_MAXLINES - 2) entries
- // so that the panel can show an empty row and "Continue..."
- float first_entry = QuickMenu_Page * (QUICKMENU_MAXLINES - 2);
- int entry_num = 0; // counts entries in target_submenu
- for( ; QuickMenu_Buffer_Index < QuickMenu_Buffer_Size; ++QuickMenu_Buffer_Index)
- {
- s = QuickMenu_Buffer_Get();
-
- if(z_submenu != "" && substring(s, 1, -1) == z_submenu)
- {
- // printf("^3 end of %s\n", z_submenu);
- break;
- }
-
- if(entry_num >= first_entry)
- {
- ++QuickMenu_Page_Entries;
- if(QuickMenu_Page_Entries == QUICKMENU_MAXLINES - 2)
- QuickMenu_Buffer_Index_Prev = QuickMenu_Buffer_Index;
- else if(QuickMenu_Page_Entries == QUICKMENU_MAXLINES)
- {
- QuickMenu_Page_ClearEntry(QUICKMENU_MAXLINES - 1);
- QuickMenu_Buffer_Index = QuickMenu_Buffer_Index_Prev;
- QuickMenu_IsLastPage = false;
- break;
- }
- }
-
- // NOTE: entries are loaded starting from 1, not from 0
- if(substring(s, 0, 1) == QM_TAG_SUBMENU)
- {
- if(entry_num >= first_entry)
- QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, substring(s, 1, -1), "");
- QuickMenu_skip_submenu(substring(s, 1, -1));
- }
- else if(entry_num >= first_entry && substring(s, 0, 1) == QM_TAG_TITLE)
- {
- ++QuickMenu_Buffer_Index;
- cmd = QuickMenu_Buffer_Get();
- string command_code = substring(cmd, 0, 1);
- if(command_code == QM_TAG_COMMAND)
- cmd = substring(cmd, 1, -1);
- else if(command_code == QM_TAG_PLCOMMAND)
- {
- // throw away the current quickmenu buffer and load a new one
- cmd = substring(cmd, 1, -1);
- strunzone(z_submenu);
- if(HUD_Quickmenu_PlayerListEntries_Create(cmd, stof(substring(s, 1, 1)), stof(substring(s, 2, 1))))
- return QuickMenu_Page_Load("", 0);
- QuickMenu_Close();
- return false;
- }
-
- tokenize_console(cmd);
- QuickMenu_Page_Command_Type[QuickMenu_Page_Entries] = (argv(1) && argv(0) == "toggle");
-
- QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, substring(s, 1, -1), cmd);
- }
-
- ++entry_num;
- }
- strunzone(z_submenu);
- if (QuickMenu_Page_Entries == 0)
- {
- QuickMenu_Close();
- return false;
- }
- QuickMenu_TimeOut = ((autocvar_hud_panel_quickmenu_time > 0) ? time + autocvar_hud_panel_quickmenu_time : 0);
- return true;
-}
-
-bool QuickMenu_ActionForNumber(int num)
-{
- TC(int, num);
- if (!QuickMenu_IsLastPage)
- {
- if (num < 0 || num >= QUICKMENU_MAXLINES)
- return false;
- if (num == QUICKMENU_MAXLINES - 1)
- return false;
- if (num == 0)
- {
- QuickMenu_Page_Load(QuickMenu_CurrentSubMenu, +1);
- return false;
- }
- } else if (num <= 0 || num > QuickMenu_Page_Entries)
- return false;
-
- if (QuickMenu_Page_Command[num] != "")
- {
- localcmd(strcat("\n", QuickMenu_Page_Command[num], "\n"));
- QuickMenu_TimeOut = ((autocvar_hud_panel_quickmenu_time > 0) ? time + autocvar_hud_panel_quickmenu_time : 0);
- return true;
- }
- if (QuickMenu_Page_Description[num] != "")
- QuickMenu_Page_Load(QuickMenu_Page_Description[num], 0);
- return false;
-}
-
-void QuickMenu_Page_ActiveEntry(int entry_num)
-{
- TC(int, entry_num);
- QuickMenu_Page_ActivatedEntry = entry_num;
- QuickMenu_Page_ActivatedEntry_Time = time + 0.1;
- if(QuickMenu_Page_Command[QuickMenu_Page_ActivatedEntry])
- {
- bool f = QuickMenu_ActionForNumber(QuickMenu_Page_ActivatedEntry);
- // toggle commands don't close the quickmenu
- if(QuickMenu_Page_Command_Type[QuickMenu_Page_ActivatedEntry] == 1)
- QuickMenu_Page_ActivatedEntry_Close = false;
- else
- QuickMenu_Page_ActivatedEntry_Close = (f && !(hudShiftState & S_CTRL));
- }
- else
- QuickMenu_Page_ActivatedEntry_Close = (!(hudShiftState & S_CTRL));
-}
-
-bool QuickMenu_InputEvent(int bInputType, float nPrimary, float nSecondary)
-{
- TC(int, bInputType);
- // we only care for keyboard events
- if(bInputType == 2)
- return false;
-
- if(!QuickMenu_IsOpened() || autocvar__hud_configure || mv_active)
- return false;
-
- if(bInputType == 3)
- {
- mousepos.x = nPrimary;
- mousepos.y = nSecondary;
- return true;
- }
-
- // allow console bind to work
- string con_keys;
- float keys;
- con_keys = findkeysforcommand("toggleconsole", 0);
- keys = tokenize(con_keys); // findkeysforcommand returns data for this
-
- bool hit_con_bind = false;
- int i;
- for (i = 0; i < keys; ++i)
- {
- if(nPrimary == stof(argv(i)))
- hit_con_bind = true;
- }
-
- if(bInputType == 0) {
- if(nPrimary == K_ALT) hudShiftState |= S_ALT;
- if(nPrimary == K_CTRL) hudShiftState |= S_CTRL;
- if(nPrimary == K_SHIFT) hudShiftState |= S_SHIFT;
- }
- else if(bInputType == 1) {
- if(nPrimary == K_ALT) hudShiftState -= (hudShiftState & S_ALT);
- if(nPrimary == K_CTRL) hudShiftState -= (hudShiftState & S_CTRL);
- if(nPrimary == K_SHIFT) hudShiftState -= (hudShiftState & S_SHIFT);
- }
-
- if(nPrimary == K_ESCAPE)
- {
- if (bInputType == 1)
- return true;
- QuickMenu_Close();
- }
- else if(nPrimary >= '0' && nPrimary <= '9')
- {
- if (bInputType == 1)
- return true;
- QuickMenu_Page_ActiveEntry(stof(chr2str(nPrimary)));
- }
- if(nPrimary == K_MOUSE1)
- {
- if(bInputType == 0) // key pressed
- mouseClicked |= S_MOUSE1;
- else if(bInputType == 1) // key released
- mouseClicked -= (mouseClicked & S_MOUSE1);
- }
- else if(nPrimary == K_MOUSE2)
- {
- if(bInputType == 0) // key pressed
- mouseClicked |= S_MOUSE2;
- else if(bInputType == 1) // key released
- mouseClicked -= (mouseClicked & S_MOUSE2);
- }
- else if(hit_con_bind)
- return false;
-
- return true;
-}
-
-void QuickMenu_Mouse()
-{
- if(mv_active) return;
-
- if(!mouseClicked)
- if(prevMouseClicked & S_MOUSE2)
- {
- QuickMenu_Close();
- return;
- }
-
- if(!autocvar_hud_cursormode)
- {
- mousepos = mousepos + getmousepos() * autocvar_menu_mouse_speed;
-
- mousepos.x = bound(0, mousepos.x, vid_conwidth);
- mousepos.y = bound(0, mousepos.y, vid_conheight);
- }
-
- HUD_Panel_UpdateCvars();
-
- if(panel_bg_padding)
- {
- panel_pos += '1 1 0' * panel_bg_padding;
- panel_size -= '2 2 0' * panel_bg_padding;
- }
-
- float first_entry_pos, entries_height;
- vector fontsize;
- fontsize = '1 1 0' * (panel_size.y / QUICKMENU_MAXLINES);
- first_entry_pos = panel_pos.y + ((QUICKMENU_MAXLINES - QuickMenu_Page_Entries) * fontsize.y) / 2;
- entries_height = panel_size.y - ((QUICKMENU_MAXLINES - QuickMenu_Page_Entries) * fontsize.y);
-
- if (mousepos.x >= panel_pos.x && mousepos.y >= first_entry_pos && mousepos.x <= panel_pos.x + panel_size.x && mousepos.y <= first_entry_pos + entries_height)
- {
- float entry_num;
- entry_num = floor((mousepos.y - first_entry_pos) / fontsize.y);
- if (QuickMenu_IsLastPage || entry_num != QUICKMENU_MAXLINES - 2)
- {
- panel_pos.y = first_entry_pos + entry_num * fontsize.y;
- vector color;
- if(mouseClicked & S_MOUSE1)
- color = '0.5 1 0.5';
- else if(hudShiftState & S_CTRL)
- color = '1 1 0.3';
- else
- color = '1 1 1';
- drawfill(panel_pos, eX * panel_size.x + eY * fontsize.y, color, .2, DRAWFLAG_NORMAL);
-
- if(!mouseClicked && (prevMouseClicked & S_MOUSE1))
- QuickMenu_Page_ActiveEntry((entry_num < QUICKMENU_MAXLINES - 1) ? entry_num + 1 : 0);
- }
- }
-
- draw_cursor_normal(mousepos, '1 1 1', 0.8);
-
- prevMouseClicked = mouseClicked;
-}
-
-void HUD_Quickmenu_DrawEntry(vector pos, string desc, string option, vector fontsize)
-{
- string entry;
- float offset;
- float desc_width = panel_size.x;
- if(option)
- {
- string pic = strcat(hud_skin_path, "/", option);
- if(precache_pic(pic) == "")
- pic = strcat("gfx/hud/default/", option);
- vector option_size = '1 1 0' * fontsize.y * 0.8;
- desc_width -= option_size.x;
- drawpic(pos + eX * desc_width + eY * (fontsize.y - option_size.y) / 2, pic, option_size, '1 1 1', panel_fg_alpha, DRAWFLAG_ADDITIVE);
- desc_width -= fontsize.x / 4;
- }
- entry = textShortenToWidth(desc, desc_width, fontsize, stringwidth_colors);
- if (autocvar_hud_panel_quickmenu_align > 0)
- {
- float real_desc_width = stringwidth_colors(entry, fontsize);
- offset = (desc_width - real_desc_width) * min(autocvar_hud_panel_quickmenu_align, 1);
-
- if(option)
- {
- // when there's enough room align description regardless the checkbox
- float extra_offset = (panel_size.x - desc_width) * min(autocvar_hud_panel_quickmenu_align, 1);
- if(offset + real_desc_width + extra_offset < desc_width)
- offset += extra_offset;
- else
- offset = max(0, desc_width - real_desc_width);
- }
- drawcolorcodedstring(pos + eX * offset, entry, fontsize, panel_fg_alpha, DRAWFLAG_ADDITIVE);
- }
- else
- drawcolorcodedstring(pos, entry, fontsize, panel_fg_alpha, DRAWFLAG_ADDITIVE);
-}
-
-void HUD_QuickMenu()
-{
- if(!autocvar__hud_configure)
- {
- if (hud_configure_prev && hud_configure_prev != -1)
- QuickMenu_Close();
-
- if(!hud_draw_maximized) return;
- if(mv_active) return;
- //if(!autocvar_hud_panel_quickmenu) return;
- if(!hud_panel_quickmenu) return;
-
- if(QuickMenu_TimeOut)
- if(time > QuickMenu_TimeOut)
- {
- QuickMenu_Close();
- return;
- }
- }
- else
- {
- if(!QuickMenu_IsOpened())
- {
- QuickMenu_Page_Entries = 1;
- QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, sprintf(_("Submenu%d"), QuickMenu_Page_Entries), "");
- ++QuickMenu_Page_Entries;
- QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, sprintf(_("Submenu%d"), QuickMenu_Page_Entries), "");
- ++QuickMenu_Page_Entries;
- // although real command doesn't matter here, it must not be empty
- // otherwise the entry is displayed like a submenu
- for (; QuickMenu_Page_Entries < QUICKMENU_MAXLINES - 1; ++QuickMenu_Page_Entries)
- QuickMenu_Page_LoadEntry(QuickMenu_Page_Entries, sprintf(_("Command%d"), QuickMenu_Page_Entries), "-");
- ++QuickMenu_Page_Entries;
- QuickMenu_Page_ClearEntry(QuickMenu_Page_Entries);
- QuickMenu_IsLastPage = false;
- }
- }
-
- HUD_Panel_UpdateCvars();
-
- HUD_Scale_Enable();
- HUD_Panel_DrawBg(1);
-
- if(panel_bg_padding)
- {
- panel_pos += '1 1 0' * panel_bg_padding;
- panel_size -= '2 2 0' * panel_bg_padding;
- }
-
- int i;
- vector fontsize;
- string color;
- fontsize = '1 1 0' * (panel_size.y / QUICKMENU_MAXLINES);
-
- if (!QuickMenu_IsLastPage)
- {
- color = "^5";
- HUD_Quickmenu_DrawEntry(panel_pos + eY * (panel_size.y - fontsize.y), sprintf("%d: %s%s", 0, color, _("Continue...")), string_null, fontsize);
- }
- else
- panel_pos.y += ((QUICKMENU_MAXLINES - QuickMenu_Page_Entries) * fontsize.y) / 2;
-
- for (i = 1; i <= QuickMenu_Page_Entries; ++i) {
- if (QuickMenu_Page_Description[i] == "")
- break;
- string option = string_null;
- if (QuickMenu_Page_Command[i] == "")
- color = "^4";
- else
- {
- color = "^3";
- if(QuickMenu_Page_Command_Type[i] == 1) // toggle command
- {
- int end = strstrofs(QuickMenu_Page_Command[i], ";", 0);
- if(end < 0)
- tokenize_console(QuickMenu_Page_Command[i]);
- else
- tokenize_console(substring(QuickMenu_Page_Command[i], 0, end));
-
- //if(argv(1) && argv(0) == "toggle") // already checked
- {
- // "enable feature xxx" "toggle xxx" (or "toggle xxx 1 0")
- // "disable feature xxx" "toggle xxx 0 1"
- float ON_value = 1, OFF_value = 0;
- if(argv(2))
- ON_value = stof(argv(2));
-
- if(argv(3))
- OFF_value = stof(argv(3));
- else
- OFF_value = !ON_value;
-
- float value = cvar(argv(1));
- if(value == ON_value)
- option = "checkbox_checked";
- else if(value == OFF_value)
- option = "checkbox_empty";
- else
- option = "checkbox_undefined";
- }
- }
- }
- HUD_Quickmenu_DrawEntry(panel_pos, sprintf("%d: %s%s", i, color, QuickMenu_Page_Description[i]), option, fontsize);
-
- if(QuickMenu_Page_ActivatedEntry_Time && time < QuickMenu_Page_ActivatedEntry_Time
- && QuickMenu_Page_ActivatedEntry == i)
- drawfill(panel_pos, eX * panel_size.x + eY * fontsize.y, '0.5 1 0.5', .2, DRAWFLAG_NORMAL);
-
- panel_pos.y += fontsize.y;
- }
-
- if(QuickMenu_Page_ActivatedEntry >= 0 && time >= QuickMenu_Page_ActivatedEntry_Time)
- {
- if(!QuickMenu_Page_Command[QuickMenu_Page_ActivatedEntry])
- {
- bool f = QuickMenu_ActionForNumber(QuickMenu_Page_ActivatedEntry);
- if(f && QuickMenu_Page_ActivatedEntry_Close)
- QuickMenu_Close();
- }
- else if(QuickMenu_Page_ActivatedEntry_Close)
- QuickMenu_Close();
- QuickMenu_Page_ActivatedEntry = -1;
- QuickMenu_Page_ActivatedEntry_Time = 0;
- }
-}
-
-
-#define QUICKMENU_SMENU(submenu,eng_submenu) { \
- if(target_submenu == eng_submenu && target_submenu_found) \
- return; /* target_submenu entries are now loaded, exit */ \
- if(QuickMenu_Buffer_Size < QUICKMENU_BUFFER_MAXENTRIES) \
- QuickMenu_Buffer_Set(QM_TAG_SUBMENU, submenu); \
- ++QuickMenu_Buffer_Size; \
- if(target_submenu == eng_submenu && !target_submenu_found) { \
- QuickMenu_Buffer_Size = 0; /* enable load of next entries */ \
- target_submenu_found = true; \
- } \
-}
-
-#define QUICKMENU_ENTRY(title,command) { \
- if(QuickMenu_Buffer_Size + 1 < QUICKMENU_BUFFER_MAXENTRIES) \
- { \
- QuickMenu_Buffer_Set(QM_TAG_TITLE, title); \
- ++QuickMenu_Buffer_Size; \
- QuickMenu_Buffer_Set(QM_TAG_COMMAND, command); \
- } \
- ++QuickMenu_Buffer_Size; \
-}
-
-#define QUICKMENU_SMENU_PL(submenu,eng_submenu,command,teamplayers,without_me) { \
- if(QuickMenu_Buffer_Size + 3 < QUICKMENU_BUFFER_MAXENTRIES) {\
- QUICKMENU_SMENU(submenu,eng_submenu) \
- QuickMenu_Buffer_Set(QM_TAG_TITLE, strcat(ftos(teamplayers), ftos(without_me))); \
- ++QuickMenu_Buffer_Size; \
- QuickMenu_Buffer_Set(QM_TAG_PLCOMMAND, command); \
- ++QuickMenu_Buffer_Size; \
- QUICKMENU_SMENU(submenu,eng_submenu) \
- } \
-}
-
-
-
-// useful to Translate a string inside the Command
-#define QUICKMENU_ENTRY_TC(title,command,text,translated_text) {\
- if(prvm_language == "en") \
- QUICKMENU_ENTRY(title, sprintf(command, text)) \
- else if(!autocvar_hud_panel_quickmenu_translatecommands || translated_text == text) \
- QUICKMENU_ENTRY(strcat("(en)", title), sprintf(command, text)) \
- else \
- QUICKMENU_ENTRY(strcat("(", prvm_language, ")", title), sprintf(command, translated_text)) \
-}
-
-void HUD_Quickmenu_PlayerListEntries(string cmd, int teamplayers, bool without_me)
-{
- TC(int, teamplayers); TC(bool, without_me);
- entity pl;
- if(teamplayers && !team_count)
- return;
-
- for(pl = players.sort_next; pl; pl = pl.sort_next)
- {
- if(teamplayers == 1 && (pl.team != myteam || pl.team == NUM_SPECTATOR)) // only own team players
- continue;
- if(teamplayers == 2 && (pl.team == myteam || pl.team == NUM_SPECTATOR)) // only enemy team players
- continue;
- if(without_me && pl.sv_entnum == player_localnum)
- continue;
- QUICKMENU_ENTRY(entcs_GetName(pl.sv_entnum), sprintf(cmd, entcs_GetName(pl.sv_entnum)))
- }
-
- return;
-}
-
-
-// Specifying target_submenu, this function only loads entries inside target_submenu
-// NOTE: alternatively we could have loaded the whole default quickmenu and
-// then called QuickMenu_Page_Load(target_submenu, 0);
-// but this sytem is more reliable since we can always refer to target_submenu
-// with the English title even if a translation is active
-void QuickMenu_Default(string target_submenu)
-{
- bool target_submenu_found = false;
- if(target_submenu != "")
- QuickMenu_Buffer_Size = QUICKMENU_BUFFER_MAXENTRIES; // forbids load of next entries until target_submenu
-
- QUICKMENU_SMENU(CTX(_("QMCMD^Chat")), "Chat")
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^nice one")), "say %s", ":-) / nice one", CTX(_("QMCMD^:-) / nice one")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^good game")), "say %s", "good game", CTX(_("QMCMD^good game")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^hi / good luck")), "say %s", "hi / good luck and have fun", CTX(_("QMCMD^hi / good luck and have fun")))
- QUICKMENU_SMENU(CTX(_("QMCMD^Chat")), "Chat")
-
- if(teamplay)
- {
- QUICKMENU_SMENU(CTX(_("QMCMD^Team chat")), "Team chat")
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^quad soon")), "say_team %s", "quad soon", CTX(_("QMCMD^quad soon")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^free item, icon")), "say_team %s; g_waypointsprite_team_here_p", "free item %x^7 (l:%y^7)", CTX(_("QMCMD^free item %x^7 (l:%y^7)")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^took item, icon")), "say_team %s; g_waypointsprite_team_here", "took item (l:%l^7)", CTX(_("QMCMD^took item (l:%l^7)")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^negative")), "say_team %s", "negative", CTX(_("QMCMD^negative")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^positive")), "say_team %s", "positive", CTX(_("QMCMD^positive")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^need help, icon")), "say_team %s; g_waypointsprite_team_helpme; cmd voice needhelp", "need help (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)", CTX(_("QMCMD^need help (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^enemy seen, icon")), "say_team %s; g_waypointsprite_team_danger_p; cmd voice incoming", "enemy seen (l:%y^7)", CTX(_("QMCMD^enemy seen (l:%y^7)")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^flag seen, icon")), "say_team %s; g_waypointsprite_team_here_p; cmd voice seenflag", "flag seen (l:%y^7)", CTX(_("QMCMD^flag seen (l:%y^7)")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^defending, icon")), "say_team %s; g_waypointsprite_team_here", "defending (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)", CTX(_("QMCMD^defending (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^roaming, icon")), "say_team %s; g_waypointsprite_team_here", "roaming (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)", CTX(_("QMCMD^roaming (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^attacking, icon")), "say_team %s; g_waypointsprite_team_here", "attacking (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)", CTX(_("QMCMD^attacking (l:%l^7) (h:%h^7 a:%a^7 w:%w^7)")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^killed flag, icon")), "say_team %s; g_waypointsprite_team_here_p", "killed flagcarrier (l:%y^7)", CTX(_("QMCMD^killed flagcarrier (l:%y^7)")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^dropped flag, icon")), "say_team %s; g_waypointsprite_team_here_d", "dropped flag (l:%d^7)", CTX(_("QMCMD^dropped flag (l:%d^7)")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^drop gun, icon")), "say_team %s; g_waypointsprite_team_here; wait; dropweapon", "dropped gun %w^7 (l:%l^7)", CTX(_("QMCMD^dropped gun %w^7 (l:%l^7)")))
- QUICKMENU_ENTRY_TC(CTX(_("QMCMD^drop flag/key, icon")), "say_team %s; g_waypointsprite_team_here; wait; use", "dropped flag/key %w^7 (l:%l^7)", CTX(_("QMCMD^dropped flag/key %w^7 (l:%l^7)")))
- QUICKMENU_SMENU(CTX(_("QMCMD^Team chat")), "Team chat")
- }
-
- QUICKMENU_SMENU_PL(CTX(_("QMCMD^Send private message to")), "Send private message to", "commandmode tell \"%s^7\"", 0, 1)
-
- QUICKMENU_SMENU(CTX(_("QMCMD^Settings")), "Settings")
- QUICKMENU_SMENU(CTX(_("QMCMD^View/HUD settings")), "View/HUD settings")
- QUICKMENU_ENTRY(CTX(_("QMCMD^3rd person view")), "toggle chase_active")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Player models like mine")), "toggle cl_forceplayermodels")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Names above players")), "toggle hud_shownames")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Crosshair per weapon")), "toggle crosshair_per_weapon")
- QUICKMENU_ENTRY(CTX(_("QMCMD^FPS")), "toggle hud_panel_engineinfo")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Net graph")), "toggle shownetgraph")
- QUICKMENU_SMENU(CTX(_("QMCMD^View/HUD settings")), "View/HUD settings")
-
- QUICKMENU_SMENU(CTX(_("QMCMD^Sound settings")), "Sound settings")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Hit sound")), "toggle cl_hitsound")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Chat sound")), "toggle con_chatsound")
- QUICKMENU_SMENU(CTX(_("QMCMD^Sound settings")), "Sound settings")
-
- if(spectatee_status > 0)
- {
- QUICKMENU_SMENU(CTX(_("QMCMD^Spectator camera")), "Spectator camera")
- QUICKMENU_ENTRY(CTX(_("QMCMD^1st person")), "chase_active 0; -use")
- QUICKMENU_ENTRY(CTX(_("QMCMD^3rd person around player")), "chase_active 1; +use")
- QUICKMENU_ENTRY(CTX(_("QMCMD^3rd person behind")), "chase_active 1; -use")
- QUICKMENU_SMENU(CTX(_("QMCMD^Spectator camera")), "Spectator camera")
- }
-
- if(spectatee_status == -1)
- {
- QUICKMENU_SMENU(CTX(_("QMCMD^Observer camera")), "Observer camera")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Increase speed")), "weapnext")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Decrease speed")), "weapprev")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Wall collision off")), "+use")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Wall collision on")), "-use")
- QUICKMENU_SMENU(CTX(_("QMCMD^Observer camera")), "Observer camera")
- }
-
- QUICKMENU_ENTRY(CTX(_("QMCMD^Fullscreen")), "toggle vid_fullscreen; vid_restart")
- if(prvm_language != "en")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Translate chat messages")), "toggle hud_panel_quickmenu_translatecommands")
- QUICKMENU_SMENU(CTX(_("QMCMD^Settings")), "Settings")
-
- QUICKMENU_SMENU(CTX(_("QMCMD^Call a vote")), "Call a vote")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Restart the map")), "vcall restart")
- QUICKMENU_ENTRY(CTX(_("QMCMD^End match")), "vcall endmatch")
- if(STAT(TIMELIMIT) > 0)
- {
- QUICKMENU_ENTRY(CTX(_("QMCMD^Reduce match time")), "vcall reducematchtime")
- QUICKMENU_ENTRY(CTX(_("QMCMD^Extend match time")), "vcall extendmatchtime")
- }
- if(teamplay)
- QUICKMENU_ENTRY(CTX(_("QMCMD^Shuffle teams")), "vcall shuffleteams")
- QUICKMENU_SMENU(CTX(_("QMCMD^Call a vote")), "Call a vote")
-
- if(target_submenu != "" && !target_submenu_found)
- {
- LOG_WARNINGF("Couldn't find submenu \"%s\"\n", target_submenu);
- if(prvm_language != "en")
- LOG_WARNINGF("^3Warning: submenu must be in English\n", target_submenu);
- QuickMenu_Buffer_Size = 0;
- }
-}
-#undef QUICKMENU_SMENU
-#undef QUICKMENU_ENTRY
-#undef QUICKMENU_ENTRY_TC
+++ /dev/null
-#pragma once
-
-bool QuickMenu_InputEvent(float bInputType, float nPrimary, float nSecondary);
-bool QuickMenu_IsOpened();
-void QuickMenu_Mouse();
#include "scoreboard.qh"
-#include "quickmenu.qh"
+#include "hud/panel/quickmenu.qh"
#include "hud/all.qh"
#include <common/ent_cs.qh>
pos.y += sb_heading_fontsize.y + hud_fontsize.y * 0.25;
// Draw the scoreboard
- vector bg_size = draw_getimagesize("gfx/scoreboard/scoreboard_bg") * autocvar_scoreboard_bg_scale;
+ vector bg_size = draw_getimagesize("gfx/scoreboard/scoreboard_bg") * ((autocvar_scoreboard_bg_scale > 0) ? autocvar_scoreboard_bg_scale : 0.25);
if(teamplay)
{
}
make_impure(it);
assert(entcs.think, eprint(entcs));
- WITH(entity, self, entcs, entcs.think());
+ WITHSELF(entcs, entcs.think());
if (!entcs.has_origin) continue;
if (entcs.m_entcs_private)
{
#include "mapvoting.qh"
#include "scoreboard.qh"
#include "shownames.qh"
-#include "quickmenu.qh"
+#include "hud/panel/quickmenu.qh"
#include "mutators/events.qh"
}
}
-void HUD_Crosshair()
-{SELFPARAM();
+vector crosshair_getcolor(entity this, float health_stat)
+{
static float rainbow_last_flicker;
static vector rainbow_prev_color;
+ vector wcross_color = '0 0 0';
+ switch(autocvar_crosshair_color_special)
+ {
+ case 1: // crosshair_color_per_weapon
+ {
+ if(this)
+ {
+ wcross_color = this.wpcolor;
+ break;
+ }
+ else { goto normalcolor; }
+ }
+
+ case 2: // crosshair_color_by_health
+ {
+ float x = health_stat;
+
+ //x = red
+ //y = green
+ //z = blue
+
+ wcross_color.z = 0;
+
+ if(x > 200)
+ {
+ wcross_color.x = 0;
+ wcross_color.y = 1;
+ }
+ else if(x > 150)
+ {
+ wcross_color.x = 0.4 - (x-150)*0.02 * 0.4;
+ wcross_color.y = 0.9 + (x-150)*0.02 * 0.1;
+ }
+ else if(x > 100)
+ {
+ wcross_color.x = 1 - (x-100)*0.02 * 0.6;
+ wcross_color.y = 1 - (x-100)*0.02 * 0.1;
+ wcross_color.z = 1 - (x-100)*0.02;
+ }
+ else if(x > 50)
+ {
+ wcross_color.x = 1;
+ wcross_color.y = 1;
+ wcross_color.z = 0.2 + (x-50)*0.02 * 0.8;
+ }
+ else if(x > 20)
+ {
+ wcross_color.x = 1;
+ wcross_color.y = (x-20)*90/27/100;
+ wcross_color.z = (x-20)*90/27/100 * 0.2;
+ }
+ else
+ {
+ wcross_color.x = 1;
+ wcross_color.y = 0;
+ }
+ break;
+ }
+
+ case 3: // crosshair_color_rainbow
+ {
+ if(time >= rainbow_last_flicker)
+ {
+ rainbow_prev_color = randomvec() * autocvar_crosshair_color_special_rainbow_brightness;
+ rainbow_last_flicker = time + autocvar_crosshair_color_special_rainbow_delay;
+ }
+ wcross_color = rainbow_prev_color;
+ break;
+ }
+LABEL(normalcolor)
+ default: { wcross_color = stov(autocvar_crosshair_color); break; }
+ }
+
+ return wcross_color;
+}
+
+void HUD_Crosshair()
+{SELFPARAM();
entity e = this;
float f, i, j;
vector v;
wcross_name = strcat("gfx/crosshair", wcross_style);
// MAIN CROSSHAIR COLOR DECISION
- switch(autocvar_crosshair_color_special)
- {
- case 1: // crosshair_color_per_weapon
- {
- if(e)
- {
- wcross_color = e.wpcolor;
- break;
- }
- else { goto normalcolor; }
- }
-
- case 2: // crosshair_color_by_health
- {
- float x = STAT(HEALTH);
-
- //x = red
- //y = green
- //z = blue
-
- wcross_color.z = 0;
-
- if(x > 200)
- {
- wcross_color.x = 0;
- wcross_color.y = 1;
- }
- else if(x > 150)
- {
- wcross_color.x = 0.4 - (x-150)*0.02 * 0.4;
- wcross_color.y = 0.9 + (x-150)*0.02 * 0.1;
- }
- else if(x > 100)
- {
- wcross_color.x = 1 - (x-100)*0.02 * 0.6;
- wcross_color.y = 1 - (x-100)*0.02 * 0.1;
- wcross_color.z = 1 - (x-100)*0.02;
- }
- else if(x > 50)
- {
- wcross_color.x = 1;
- wcross_color.y = 1;
- wcross_color.z = 0.2 + (x-50)*0.02 * 0.8;
- }
- else if(x > 20)
- {
- wcross_color.x = 1;
- wcross_color.y = (x-20)*90/27/100;
- wcross_color.z = (x-20)*90/27/100 * 0.2;
- }
- else
- {
- wcross_color.x = 1;
- wcross_color.y = 0;
- }
- break;
- }
-
- case 3: // crosshair_color_rainbow
- {
- if(time >= rainbow_last_flicker)
- {
- rainbow_prev_color = randomvec() * autocvar_crosshair_color_special_rainbow_brightness;
- rainbow_last_flicker = time + autocvar_crosshair_color_special_rainbow_delay;
- }
- wcross_color = rainbow_prev_color;
- break;
- }
-LABEL(normalcolor)
- default: { wcross_color = stov(autocvar_crosshair_color); break; }
- }
+ wcross_color = crosshair_getcolor(e, STAT(HEALTH));
if(autocvar_crosshair_effect_scalefade)
{
if(!gen)
ons_roundlost = false; // don't enforce the 3rd person camera if there is no dead generator to show
}
- if(WantEventchase(self) || (!autocvar_cl_orthoview && ons_roundlost))
+ if(WantEventchase(this) || (!autocvar_cl_orthoview && ons_roundlost))
{
eventchase_running = true;
entity local_player = ((csqcplayer) ? csqcplayer : CSQCModel_server2csqc(player_localentnum - 1));
if(!local_player)
- local_player = self; // fall back!
+ local_player = this; // fall back!
// make special vector since we can't use view_origin (It is one frame old as of this code, it gets set later with the results this code makes.)
vector current_view_origin = (csqcplayer ? csqcplayer.origin : pmove_org);
if(view_offset)
{
- WarpZone_TraceLine(current_view_origin, current_view_origin + view_offset + ('0 0 1' * autocvar_cl_eventchase_maxs.z), MOVE_WORLDONLY, self);
+ WarpZone_TraceLine(current_view_origin, current_view_origin + view_offset + ('0 0 1' * autocvar_cl_eventchase_maxs.z), MOVE_WORLDONLY, this);
if(trace_fraction == 1) { current_view_origin += view_offset; }
else { current_view_origin.z += max(0, (trace_endpos.z - current_view_origin.z) - autocvar_cl_eventchase_maxs.z); }
}
makevectors(view_angles);
vector eventchase_target_origin = (current_view_origin - (v_forward * eventchase_current_distance));
- WarpZone_TraceBox(current_view_origin, autocvar_cl_eventchase_mins, autocvar_cl_eventchase_maxs, eventchase_target_origin, MOVE_WORLDONLY, self);
+ WarpZone_TraceBox(current_view_origin, autocvar_cl_eventchase_mins, autocvar_cl_eventchase_maxs, eventchase_target_origin, MOVE_WORLDONLY, this);
// If the boxtrace fails, revert back to line tracing.
if(!local_player.viewloc)
if(trace_startsolid)
{
eventchase_target_origin = (current_view_origin - (v_forward * eventchase_current_distance));
- WarpZone_TraceLine(current_view_origin, eventchase_target_origin, MOVE_WORLDONLY, self);
+ WarpZone_TraceLine(current_view_origin, eventchase_target_origin, MOVE_WORLDONLY, this);
setproperty(VF_ORIGIN, (trace_endpos - (v_forward * autocvar_cl_eventchase_mins.z)));
}
else { setproperty(VF_ORIGIN, trace_endpos); }
#pragma once
+
+vector crosshair_getcolor(entity this, float health_stat);
--- /dev/null
+// generated file; do not modify
+#include "projectile.qc"
#include "t_items.qc"
#endif
-#include "items/all.qc"
+#include "items/_mod.inc"
#include "weapons/all.qc"
#include "monsters/all.qc"
#include "turrets/all.qc"
#include "vehicles/all.qc"
-#include "mutators/all.qc"
- #include "gamemodes/all.qc"
+#include "mutators/_mod.inc"
+ #include "gamemodes/_mod.inc"
--- /dev/null
+// generated file; do not modify
+#include "anim.qc"
+#include "animdecide.qc"
+#include "campaign_file.qc"
+#include "campaign_setup.qc"
+#include "ent_cs.qc"
+#include "mapinfo.qc"
+#include "net_notice.qc"
+#include "playerstats.qc"
+#include "state.qc"
+#include "t_items.qc"
+#include "util.qc"
+#include "viewloc.qc"
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
+#include "generic.qc"
+#include "markup.qc"
+#include "rpn.qc"
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
+#include "effectinfo.qc"
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
+#include "casings.qc"
+#include "damageeffects.qc"
+#include "gibs.qc"
+#include "globalsound.qc"
+#include "lightningarc.qc"
+#include "modeleffects.qc"
+#ifdef SVQC
+void SpawnCasing(vector vel, float randomvel, vector ang, vector avel, float randomavel, int casingtype, entity casingowner);
+#endif
+
#ifdef IMPLEMENTATION
#include <common/util.qh>
{SELFPARAM();
// if particle distribution is enabled, slow ticrate by total number of damages
if(autocvar_cl_damageeffect_distribute)
- self.nextthink = time + autocvar_cl_damageeffect_ticrate * self.owner.total_damages;
+ this.nextthink = time + autocvar_cl_damageeffect_ticrate * this.owner.total_damages;
else
- self.nextthink = time + autocvar_cl_damageeffect_ticrate;
+ this.nextthink = time + autocvar_cl_damageeffect_ticrate;
- if(time >= self.cnt || !self.owner || !self.owner.modelindex || !self.owner.drawmask)
+ if(time >= this.cnt || !this.owner || !this.owner.modelindex || !this.owner.drawmask)
{
// time is up or the player got gibbed / disconnected
- self.owner.total_damages = max(0, self.owner.total_damages - 1);
- remove(self);
+ this.owner.total_damages = max(0, this.owner.total_damages - 1);
+ remove(this);
return;
}
- if(self.state && !self.owner.csqcmodel_isdead)
+ if(this.state && !this.owner.csqcmodel_isdead)
{
// if the player was dead but is now alive, it means he respawned
// if so, clear his damage effects, or damages from his dead body will be copied back
- self.owner.total_damages = max(0, self.owner.total_damages - 1);
- remove(self);
+ this.owner.total_damages = max(0, this.owner.total_damages - 1);
+ remove(this);
return;
}
- self.state = self.owner.csqcmodel_isdead;
- if(self.owner.isplayermodel && (self.owner.entnum == player_localentnum) && !autocvar_chase_active)
+ this.state = this.owner.csqcmodel_isdead;
+ if(this.owner.isplayermodel && (this.owner.entnum == player_localentnum) && !autocvar_chase_active)
return; // if we aren't using a third person camera, hide our own effects
// now generate the particles
vector org;
- org = gettaginfo(self, 0); // origin at attached location
- __pointparticles(self.team, org, '0 0 0', 1);
+ org = gettaginfo(this, 0); // origin at attached location
+ __pointparticles(this.team, org, '0 0 0', 1);
}
string species_prefix(int specnum)
}
}
-void DamageEffect(vector hitorg, float thedamage, int type, int specnum)
-{SELFPARAM();
+void DamageEffect(entity this, vector hitorg, float thedamage, int type, int specnum)
+{
// particle effects for players and objects damaged by weapons (eg: flames coming out of victims shot with rockets)
int nearestbone = 0;
if(!autocvar_cl_damageeffect || autocvar_cl_gentle || autocvar_cl_gentle_damage)
return;
- if(!self || !self.modelindex || !self.drawmask)
+ if(!this || !this.modelindex || !this.drawmask)
return;
// if this is a rigged mesh, the effect will show on the bone where damage was dealt
// we do this by choosing the skeletal bone closest to the impact, and attaching our entity to it
// if there's no skeleton, object origin will automatically be selected
- FOR_EACH_TAG(self)
+ FOR_EACH_TAG(this)
{
if(!tagnum)
continue; // skip empty bones
continue; // player model bone blacklist
// now choose the bone closest to impact origin
- if(nearestbone == 0 || vlen2(hitorg - gettaginfo(self, tagnum)) <= vlen2(hitorg - gettaginfo(self, nearestbone)))
+ if(nearestbone == 0 || vlen2(hitorg - gettaginfo(this, tagnum)) <= vlen2(hitorg - gettaginfo(this, nearestbone)))
nearestbone = tagnum;
}
- gettaginfo(self, nearestbone); // set gettaginfo_name
+ gettaginfo(this, nearestbone); // set gettaginfo_name
// return if we reached our damage effect limit or damages are disabled
// TODO: When the limit is reached, it would be better if the oldest damage was removed instead of not adding a new one
if(nearestbone)
{
- if(self.total_damages >= autocvar_cl_damageeffect_bones)
+ if(this.total_damages >= autocvar_cl_damageeffect_bones)
return; // allow multiple damages on skeletal models
}
else
{
- if(autocvar_cl_damageeffect < 2 || self.total_damages)
+ if(autocvar_cl_damageeffect < 2 || this.total_damages)
return; // allow a single damage on non-skeletal models
}
if(substring(effectname, strlen(effectname) - 5, 5) == "BLOOD")
{
- if(self.isplayermodel)
+ if(this.isplayermodel)
{
specstr = species_prefix(specnum);
specstr = substring(specstr, 0, strlen(specstr) - 1);
e = new(damage);
setmodel(e, MDL_Null); // necessary to attach and read origin
- setattachment(e, self, gettaginfo_name); // attach to the given bone
- e.owner = self;
+ setattachment(e, this, gettaginfo_name); // attach to the given bone
+ e.owner = this;
e.cnt = time + life;
e.team = _particleeffectnum(effectname);
e.think = DamageEffect_Think;
e.nextthink = time;
- self.total_damages += 1;
+ this.total_damages += 1;
}
NET_HANDLE(ENT_CLIENT_DAMAGEINFO, bool isNew)
{
- make_pure(this);
+ const float ATTEN_LOW = 0.2;
float thedamage, rad, edge, thisdmg;
bool hitplayer = false;
int species, forcemul;
forcemul = 1;
FOREACH_ENTITY_RADIUS(w_org, rad + MAX_DAMAGEEXTRARADIUS, !it.tag_entity, {
- setself(it);
- vector nearest = NearestPointOnBox(self, w_org);
+ vector nearest = NearestPointOnBox(it, w_org);
if (rad)
{
- thisdmg = ((vlen (nearest - w_org) - bound(MIN_DAMAGEEXTRARADIUS, self.damageextraradius, MAX_DAMAGEEXTRARADIUS)) / rad);
+ thisdmg = ((vlen (nearest - w_org) - bound(MIN_DAMAGEEXTRARADIUS, it.damageextraradius, MAX_DAMAGEEXTRARADIUS)) / rad);
if(thisdmg >= 1)
continue;
if(thisdmg < 0)
if(thedamage)
{
thisdmg = thedamage + (edge - thedamage) * thisdmg;
- thisforce = forcemul * vlen(force) * (thisdmg / thedamage) * normalize(self.origin - w_org);
+ thisforce = forcemul * vlen(force) * (thisdmg / thedamage) * normalize(it.origin - w_org);
}
else
{
thisdmg = 0;
- thisforce = forcemul * vlen(force) * normalize(self.origin - w_org);
+ thisforce = forcemul * vlen(force) * normalize(it.origin - w_org);
}
}
else
{
- if(vdist((nearest - w_org), >, bound(MIN_DAMAGEEXTRARADIUS, self.damageextraradius, MAX_DAMAGEEXTRARADIUS)))
+ if(vdist((nearest - w_org), >, bound(MIN_DAMAGEEXTRARADIUS, it.damageextraradius, MAX_DAMAGEEXTRARADIUS)))
continue;
thisdmg = thedamage;
thisforce = forcemul * force;
}
- if(self.damageforcescale)
+ if(it.damageforcescale)
if(vdist(thisforce, !=, 0))
{
- self.move_velocity = self.move_velocity + damage_explosion_calcpush(self.damageforcescale * thisforce, self.move_velocity, autocvar_g_balance_damagepush_speedfactor);
- self.move_flags &= ~FL_ONGROUND;
+ it.move_velocity = it.move_velocity + damage_explosion_calcpush(it.damageforcescale * thisforce, it.move_velocity, autocvar_g_balance_damagepush_speedfactor);
+ it.move_flags &= ~FL_ONGROUND;
}
if(w_issilent)
- self.silent = 1;
+ it.silent = 1;
- if(self.event_damage)
- self.event_damage(self, thisdmg, w_deathtype, w_org, thisforce);
+ if(it.event_damage)
+ it.event_damage(it, thisdmg, w_deathtype, w_org, thisforce);
- DamageEffect(w_org, thisdmg, w_deathtype, species);
+ DamageEffect(it, w_org, thisdmg, w_deathtype, species);
- if(self.isplayermodel)
+ if(it.isplayermodel)
hitplayer = true; // this impact damaged a player
});
- setself(this);
if(DEATH_ISVEHICLE(w_deathtype))
{
else
w_backoff = -1 * normalize(w_org - (w_org + normalize(force) * 16));
- setorigin(self, w_org + w_backoff * 2); // for sound() calls
+ setorigin(this, w_org + w_backoff * 2); // for sound() calls
switch(DEATH_ENT(w_deathtype))
{
// spiderbot
case DEATH_VH_SPID_MINIGUN:
- sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_SPIDERBOT_MINIGUN_IMPACT, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_SPIDERBOT_MINIGUN_IMPACT, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_SPID_ROCKET:
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_SPIDERBOT_ROCKET_EXPLODE, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_SPIDERBOT_ROCKET_EXPLODE, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_SPID_DEATH:
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_MIN);
- pointparticles(EFFECT_EXPLOSION_BIG, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_LOW);
+ pointparticles(EFFECT_EXPLOSION_BIG, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_WAKI_GUN:
- sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_RACER_IMPACT, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_RACER_IMPACT, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_WAKI_ROCKET:
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_RACER_ROCKET_EXPLODE, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_RACER_ROCKET_EXPLODE, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_WAKI_DEATH:
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_MIN);
- pointparticles(EFFECT_EXPLOSION_BIG, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_LOW);
+ pointparticles(EFFECT_EXPLOSION_BIG, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_RAPT_CANNON:
- sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_RAPTOR_CANNON_IMPACT, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_RAPTOR_CANNON_IMPACT, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_RAPT_FRAGMENT:
float i;
ang = vectoangles(vel);
RaptorCBShellfragToss(w_org, vel, ang + '0 0 1' * (120 * i));
}
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_RAPTOR_BOMB_SPREAD, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_RAPTOR_BOMB_SPREAD, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_RAPT_BOMB:
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_RAPTOR_BOMB_IMPACT, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_RAPTOR_BOMB_IMPACT, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_RAPT_DEATH:
- sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_MIN);
- pointparticles(EFFECT_EXPLOSION_BIG, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_LOW);
+ pointparticles(EFFECT_EXPLOSION_BIG, this.origin, w_backoff * 1000, 1);
break;
case DEATH_VH_BUMB_GUN:
- sound(self, CH_SHOTS, SND_FIREBALL_IMPACT2, VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_BIGPLASMA_IMPACT, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_FIREBALL_IMPACT2, VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_BIGPLASMA_IMPACT, this.origin, w_backoff * 1000, 1);
break;
}
}
else
w_backoff = -1 * normalize(w_org - (w_org + normalize(force) * 16));
- setorigin(self, w_org + w_backoff * 2); // for sound() calls
+ setorigin(this, w_org + w_backoff * 2); // for sound() calls
switch(DEATH_ENT(w_deathtype))
{
case DEATH_TURRET_EWHEEL:
- sound(self, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_MIN);
- pointparticles(EFFECT_BLASTER_IMPACT, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_LASERIMPACT, VOL_BASE, ATTEN_LOW);
+ pointparticles(EFFECT_BLASTER_IMPACT, this.origin, w_backoff * 1000, 1);
break;
case DEATH_TURRET_FLAC:
pointparticles(EFFECT_HAGAR_EXPLODE, w_org, '0 0 0', 1);
- sound(self, CH_SHOTS, SND_HAGEXP_RANDOM(), VOL_BASE, ATTEN_NORM);
+ sound(this, CH_SHOTS, SND_HAGEXP_RANDOM(), VOL_BASE, ATTEN_NORM);
break;
case DEATH_TURRET_MLRS:
case DEATH_TURRET_HK:
case DEATH_TURRET_WALK_ROCKET:
case DEATH_TURRET_HELLION:
- sound(self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_MIN);
- pointparticles(EFFECT_ROCKET_EXPLODE, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_LOW);
+ pointparticles(EFFECT_ROCKET_EXPLODE, this.origin, w_backoff * 1000, 1);
break;
case DEATH_TURRET_MACHINEGUN:
case DEATH_TURRET_WALK_GUN:
- sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
- pointparticles(EFFECT_MACHINEGUN_IMPACT, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_NORM);
+ pointparticles(EFFECT_MACHINEGUN_IMPACT, this.origin, w_backoff * 1000, 1);
break;
case DEATH_TURRET_PLASMA:
- sound(self, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_MIN);
- pointparticles(EFFECT_ELECTRO_IMPACT, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_ELECTRO_IMPACT, VOL_BASE, ATTEN_LOW);
+ pointparticles(EFFECT_ELECTRO_IMPACT, this.origin, w_backoff * 1000, 1);
break;
case DEATH_TURRET_WALK_MELEE:
- sound(self, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_MIN);
- pointparticles(EFFECT_TE_SPARK, self.origin, w_backoff * 1000, 1);
+ sound(this, CH_SHOTS, SND_RIC_RANDOM(), VOL_BASE, ATTEN_LOW);
+ pointparticles(EFFECT_TE_SPARK, this.origin, w_backoff * 1000, 1);
break;
case DEATH_TURRET_PHASER:
break;
case DEATH_TURRET_TESLA:
- te_smallflash(self.origin);
+ te_smallflash(this.origin);
break;
}
w_backoff = trace_plane_normal;
else
w_backoff = -1 * normalize(force);
- setorigin(self, w_org + w_backoff * 2); // for sound() calls
+ setorigin(this, w_org + w_backoff * 2); // for sound() calls
if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY))
{
#undef X
this.iflags |= IFLAG_ORIGIN;
InterpolateOrigin_Note(this);
- WITH(entity, self, this, this.think());
+ WITHSELF(this, this.think());
return true;
}
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
--- /dev/null
+// generated file; do not modify
--- /dev/null
+// generated file; do not modify
+#include "nexball.qc"
+#include "weapon.qc"
--- /dev/null
+// generated file; do not modify
+#include "cl_controlpoint.qc"
+#include "cl_generator.qc"
+#include "onslaught.qc"
+#include "sv_controlpoint.qc"
+#include "sv_generator.qc"
// Use targets now (somebody make sure this is in the right place..)
setself(this.owner);
activator = this;
- WITH(entity, self, this, SUB_UseTargets());
+ WITHSELF(this, SUB_UseTargets());
setself(this);
this.owner.waslinked = this.owner.islinked;
FOREACH_CLIENT(IS_PLAYER(it), {
it.ons_roundlost = false;
it.ons_deathloc = '0 0 0';
- WITH(entity, self, it, PutClientInServer());
+ WITHSELF(it, PutClientInServer());
});
return false;
}
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
+++ /dev/null
-/** If you register a new item, make sure to add it to this list */
-#include "item/ammo.qc"
-#include "item/armor.qc"
-#include "item/health.qc"
-#include "item/jetpack.qc"
-#include "item/pickup.qc"
-#include "item/powerup.qc"
#define ITEMS_ALL_C
#include "all.qh"
-#include "all.inc"
+#include "item/_mod.inc"
void Dump_Items()
{
REGISTRY(Items, BITS(5))
#define Items_from(i) _Items_from(i, NULL)
REGISTER_REGISTRY(Items)
-/** If you register a new item, make sure to add it to all.inc */
#define REGISTER_ITEM(id, class) REGISTER(Items, ITEM, id, m_id, NEW(class))
REGISTRY_SORT(Items)
#include "all.qh"
#include "item/pickup.qh"
-entityclass(Inventory);
-/** Stores counts of items, the id being the index */
-class(Inventory) .int inv_items[Items_MAX];
+CLASS(Inventory, Object)
+ /** Stores counts of items, the id being the index */
+ ATTRIBARRAY(Inventory, inv_items, int, Items_MAX)
+ /** Previous state */
+ ATTRIB(Inventory, inventory, Inventory, NULL)
+ENDCLASS(Inventory)
-/** Player inventory; Inventories also have one inventory for storing the previous state */
+/** Player inventory */
.Inventory inventory;
REGISTER_NET_LINKED(ENT_CLIENT_INVENTORY)
#ifdef SVQC
void Inventory_Write(Inventory data)
{
+ if (!data) {
+ WriteInt24_t(MSG_ENTITY, 0);
+ return;
+ }
+ TC(Inventory, data);
int bits = 0;
FOREACH(Items, true, {
.int fld = inv_items[it.m_id];
#endif
#ifdef SVQC
-bool Inventory_Send(entity this, entity to, int sf)
+bool Inventory_Send(Inventory this, Client to, int sf)
{
+ TC(Inventory, this);
WriteHeader(MSG_ENTITY, ENT_CLIENT_INVENTORY);
- entity e = self.owner;
+ entity e = this.owner;
if (IS_SPEC(e)) e = e.enemy;
+ TC(Player, e);
Inventory data = e.inventory;
Inventory_Write(data);
return true;
void Inventory_new(entity e)
{
- Inventory inv = new_pure(Inventory), bak = new_pure(Inventory);
+ Inventory inv = NEW(Inventory), bak = NEW(Inventory);
inv.inventory = bak;
inv.drawonlytoclient = e;
Net_LinkEntity((inv.owner = e).inventory = inv, false, 0, Inventory_Send);
const int IT_PICKUPMASK = IT_UNLIMITED_AMMO | IT_JETPACK | IT_FUEL_REGEN; // strength and invincible are handled separately
#define ITEM_HANDLE(signal, ...) __Item_Send_##signal(__VA_ARGS__)
-/** If you register a new item, make sure to add it to all.inc */
CLASS(GameItem, Object)
ATTRIB(GameItem, m_id, int, 0)
ATTRIB(GameItem, m_name, string, string_null)
--- /dev/null
+// generated file; do not modify
+#include "ammo.qc"
+#include "armor.qc"
+#include "health.qc"
+#include "jetpack.qc"
+#include "pickup.qc"
+#include "powerup.qc"
--- /dev/null
+// generated file; do not modify
+#include "cl_minigames.qc"
+#include "cl_minigames_hud.qc"
+#include "minigames.qc"
+#include "sv_minigames.qc"
{SELFPARAM();
if ( menuitem )
{
- WITH(entity, self, menuitem, menuitem.use());
+ WITHSELF(menuitem, menuitem.use());
}
}
--- /dev/null
+// generated file; do not modify
+#include "bd.qc"
+#include "c4.qc"
+#include "nmm.qc"
+#include "pong.qc"
+#include "pp.qc"
+#include "ps.qc"
+#include "snake.qc"
+#include "ttt.qc"
if ( !IS_OBSERVER(player) && autocvar_sv_minigames_observer )
{
- WITH(entity, self, player, PutObserverInServer());
+ WITHSELF(player, PutObserverInServer());
}
if ( autocvar_sv_minigames_observer == 2 )
player.team_forced = -1;
--- /dev/null
+// generated file; do not modify
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
+#include "spawn.qc"
+#include "sv_monsters.qc"
+++ /dev/null
-#ifndef MENUQC
-#include "../animdecide.qh"
-#include "../anim.qh"
-vector animfixfps(entity e, vector a, vector b);
-#endif
-
-#include "monster/mage.qc"
-#include "monster/shambler.qc"
-#include "monster/spider.qc"
-#include "monster/wyvern.qc"
-#include "monster/zombie.qc"
#include "all.qh"
#define IMPLEMENTATION
-#include "all.inc"
+#include "monster/_mod.inc"
#undef IMPLEMENTATION
#ifdef SVQC
REGISTRY_CHECK(Monsters)
const int MON_FIRST = 1;
#define MON_LAST (Monsters_COUNT - 1)
-/** If you register a new monster, make sure to add it to all.inc */
#define REGISTER_MONSTER(id, inst) REGISTER(Monsters, MON, id, monsterid, inst)
REGISTER_MONSTER(Null, NEW(Monster));
-#include "all.inc"
+#include "monster/_mod.inc"
#endif
#include <lib/warpzone/server.qh>
#endif
+#ifndef MENUQC
+#include "../animdecide.qh"
+#include "../anim.qh"
+vector animfixfps(entity e, vector a, vector b);
+#endif
+
// special spawn flags
const int MONSTER_RESPAWN_DEATHPOINT = 16; // re-spawn where we died
const int MONSTER_TYPE_FLY = 32;
.vector anim_walk;
.vector anim_spawn;
-/** If you register a new monster, make sure to add it to all.inc */
CLASS(Monster, Object)
ATTRIB(Monster, monsterid, int, 0)
/** attributes */
--- /dev/null
+// generated file; do not modify
+#include "mage.qc"
+#include "shambler.qc"
+#include "spider.qc"
+#include "wyvern.qc"
+#include "zombie.qc"
this.health = this.health - damage;
if (this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.use));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.use));
}
void M_Shambler_Attack_Lightning_Touch()
MUTATOR_HOOKFUNCTION(spiderweb, PlayerPhysics)
{
SELFPARAM();
- if (time >= self.spider_slowness)
+ if (time >= this.spider_slowness)
return false;
- PHYS_MAXSPEED(self) *= 0.5; // half speed while slow from spider
- PHYS_MAXAIRSPEED(self) *= 0.5;
- PHYS_AIRSPEEDLIMIT_NONQW(self) *= 0.5;
- PHYS_AIRSTRAFEACCELERATE(self) *= 0.5;
+ PHYS_MAXSPEED(this) *= 0.5; // half speed while slow from spider
+ PHYS_MAXAIRSPEED(this) *= 0.5;
+ PHYS_AIRSPEEDLIMIT_NONQW(this) *= 0.5;
+ PHYS_AIRSTRAFEACCELERATE(this) *= 0.5;
return false;
}
if(e && e.monster_loot)
{
e.noalign = true;
- WITH(entity, self, e, e.monster_loot(e));
+ WITHSELF(e, e.monster_loot(e));
e.gravity = 1;
e.movetype = MOVETYPE_TOSS;
e.reset = SUB_Remove;
void Monster_Remove(entity this)
{
+ if(IS_CLIENT(this))
+ return; // don't remove it?
+
.entity weaponentity = weaponentities[0];
if(!this) { return; }
// TODO: fix this?
activator = attacker;
other = this.enemy;
- WITH(entity, self, this, SUB_UseTargets());
+ WITHSELF(this, SUB_UseTargets());
this.target2 = this.oldtarget2; // reset to original target on death, incase we respawn
Monster_Dead(this, attacker, (this.health <= -100 || deathtype == DEATH_KILL.m_id));
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
--- /dev/null
+// generated file; do not modify
+#include "itemstime.qc"
--- /dev/null
+// generated file; do not modify
+#include "bloodloss.qc"
--- /dev/null
+// generated file; do not modify
+#include "breakablehook.qc"
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
+#include "buffs.qc"
{
entity oldother = other;
other = self;
- WITH(entity, self, it, it.touch());
+ WITHSELF(it, it.touch());
other = oldother;
}
--- /dev/null
+// generated file; do not modify
+#include "bugrigs.qc"
--- /dev/null
+// generated file; do not modify
+#include "campcheck.qc"
--- /dev/null
+// generated file; do not modify
+#include "cloaked.qc"
--- /dev/null
+// generated file; do not modify
+#include "damagetext.qc"
--- /dev/null
+// generated file; do not modify
+#include "dodging.qc"
--- /dev/null
+// generated file; do not modify
+#include "doublejump.qc"
--- /dev/null
+// generated file; do not modify
+#include "hook.qc"
--- /dev/null
+// generated file; do not modify
+#include "instagib.qc"
+#include "items.qc"
{
if(frag_deathtype & HITTYPE_SECONDARY)
{
- if(!autocvar_g_instagib_blaster_keepdamage)
+ if(!autocvar_g_instagib_blaster_keepdamage || frag_attacker == frag_target)
frag_damage = frag_mirrordamage = 0;
if(frag_target != frag_attacker)
e.cnt = self.cnt;
e.team = self.team;
e.spawnfunc_checked = true;
- WITH(entity, self, e, spawnfunc_item_minst_cells(e));
+ WITHSELF(e, spawnfunc_item_minst_cells(e));
return true;
}
--- /dev/null
+// generated file; do not modify
+#include "invincibleproj.qc"
--- /dev/null
+// generated file; do not modify
+#include "melee_only.qc"
--- /dev/null
+// generated file; do not modify
+#include "midair.qc"
--- /dev/null
+// generated file; do not modify
+#include "multijump.qc"
{
SELFPARAM();
#ifdef CSQC
- self.multijump_count = PHYS_MULTIJUMP_COUNT(self);
+ this.multijump_count = PHYS_MULTIJUMP_COUNT(this);
#endif
if(!PHYS_MULTIJUMP) { return; }
- if(IS_ONGROUND(self))
- self.multijump_count = 0;
+ if(IS_ONGROUND(this))
+ this.multijump_count = 0;
return false;
}
MUTATOR_HOOKFUNCTION(multijump, PlayerJump)
{
SELFPARAM();
- return PM_multijump_checkjump(self);
+ return PM_multijump_checkjump(this);
}
#ifdef SVQC
--- /dev/null
+// generated file; do not modify
+#include "nades.qc"
+#include "net.qc"
if(ITEM_DAMAGE_NEEDKILL(deathtype))
{
this.takedamage = DAMAGE_NO;
- WITH(entity, self, this, nade_boom());
+ WITHSELF(this, nade_boom());
return;
}
this.realowner = attacker;
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, nade_boom));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, nade_boom));
else
nade_burn_spawn(this);
}
--- /dev/null
+// generated file; do not modify
+#include "new_toys.qc"
--- /dev/null
+// generated file; do not modify
+#include "nix.qc"
--- /dev/null
+// generated file; do not modify
+#include "hmg.qc"
+#include "overkill.qc"
+#include "rpc.qc"
}
float hmg_spread = bound(WEP_CVAR(hmg, spread_min), WEP_CVAR(hmg, spread_min) + (WEP_CVAR(hmg, spread_add) * actor.misc_bulletcounter), WEP_CVAR(hmg, spread_max));
- fireBullet(w_shotorg, w_shotdir, hmg_spread, WEP_CVAR(hmg, solidpenetration), WEP_CVAR(hmg, damage), WEP_CVAR(hmg, force), WEP_HMG.m_id, 0);
+ fireBullet(actor, w_shotorg, w_shotdir, hmg_spread, WEP_CVAR(hmg, solidpenetration), WEP_CVAR(hmg, damage), WEP_CVAR(hmg, force), WEP_HMG.m_id, 0);
actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
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 - frag_target.origin) * 500;
- SUB_SetFade(e, time + 5, 1);
+ if (!wasfreed(e)) { // might have been blocked by a mutator
+ 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 - frag_target.origin) * 500;
+ SUB_SetFade(e, time + 5, 1);
+ }
frag_target.ok_lastwep = PS(frag_target).m_switchweapon.m_id;
this.health = this.health - damage;
if (this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_RocketPropelledChainsaw_Explode));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_RocketPropelledChainsaw_Explode));
}
void W_RocketPropelledChainsaw_Think()
--- /dev/null
+// generated file; do not modify
+#include "physical_items.qc"
setorigin(wep, wep.origin + '0 0 1');
entity oldself;
oldself = self;
- WITH(entity, self, wep, builtin_droptofloor());
+ WITHSELF(wep, builtin_droptofloor());
}
wep.spawn_origin = wep.origin;
--- /dev/null
+// generated file; do not modify
+#include "pinata.qc"
--- /dev/null
+// generated file; do not modify
+#include "random_gravity.qc"
--- /dev/null
+// generated file; do not modify
+#include "rocketflying.qc"
--- /dev/null
+// generated file; do not modify
+#include "rocketminsta.qc"
--- /dev/null
+// generated file; do not modify
+#include "running_guns.qc"
--- /dev/null
+// generated file; do not modify
+#include "sandbox.qc"
--- /dev/null
+// generated file; do not modify
+#include "spawn_near_teammate.qc"
--- /dev/null
+// generated file; do not modify
+#include "superspec.qc"
--- /dev/null
+// generated file; do not modify
+#include "touchexplode.qc"
--- /dev/null
+// generated file; do not modify
+#include "vampire.qc"
--- /dev/null
+// generated file; do not modify
+#include "vampirehook.qc"
--- /dev/null
+// generated file; do not modify
+#include "waypointsprites.qc"
--- /dev/null
+// generated file; do not modify
+#include "weaponarena_random.qc"
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
--- /dev/null
+// generated file; do not modify
+#include "movelib.qc"
+#include "player.qc"
**/
#endif
-void movelib_groundalign4point(float spring_length, float spring_up, float blendrate, float _max)
-{SELFPARAM();
+void movelib_groundalign4point(entity this, float spring_length, float spring_up, float blendrate, float _max)
+{
vector a, b, c, d, e, r, push_angle, ahead, side;
push_angle.y = 0;
- r = (self.absmax + self.absmin) * 0.5 + (v_up * spring_up);
+ r = (this.absmax + this.absmin) * 0.5 + (v_up * spring_up);
e = v_up * spring_length;
// Put springs slightly inside bbox
- ahead = v_forward * (self.maxs.x * 0.8);
- side = v_right * (self.maxs.y * 0.8);
+ ahead = v_forward * (this.maxs.x * 0.8);
+ side = v_right * (this.maxs.y * 0.8);
a = r + ahead + side;
b = r + ahead - side;
c = r - ahead + side;
d = r - ahead - side;
- traceline(a, a - e,MOVE_NORMAL,self);
+ traceline(a, a - e,MOVE_NORMAL,this);
a.z = (1 - trace_fraction);
r = trace_endpos;
- traceline(b, b - e,MOVE_NORMAL,self);
+ traceline(b, b - e,MOVE_NORMAL,this);
b.z = (1 - trace_fraction);
r += trace_endpos;
- traceline(c, c - e,MOVE_NORMAL,self);
+ traceline(c, c - e,MOVE_NORMAL,this);
c.z = (1 - trace_fraction);
r += trace_endpos;
- traceline(d, d - e,MOVE_NORMAL,self);
+ traceline(d, d - e,MOVE_NORMAL,this);
d.z = (1 - trace_fraction);
r += trace_endpos;
a.x = r.z;
- r = self.origin;
+ r = this.origin;
r.z = r.z;
push_angle.x = (a.z - c.z) * _max;
push_angle.z = (b.z - a.z) * _max;
push_angle.z += (d.z - c.z) * _max;
- //self.angles_x += push_angle_x * 0.95;
- //self.angles_z += push_angle_z * 0.95;
+ //this.angles_x += push_angle_x * 0.95;
+ //this.angles_z += push_angle_z * 0.95;
- self.angles_x = ((1-blendrate) * self.angles.x) + (push_angle.x * blendrate);
- self.angles_z = ((1-blendrate) * self.angles.z) + (push_angle.z * blendrate);
+ this.angles_x = ((1-blendrate) * this.angles.x) + (push_angle.x * blendrate);
+ this.angles_z = ((1-blendrate) * this.angles.z) + (push_angle.z * blendrate);
- //a = self.origin;
- setorigin(self,r);
+ //a = this.origin;
+ setorigin(this,r);
}
**/
#endif
-void movelib_groundalign4point(float spring_length, float spring_up, float blendrate, float _max);
+void movelib_groundalign4point(entity this, float spring_length, float spring_up, float blendrate, float _max);
#endif
--- /dev/null
+// generated file; do not modify
+#include "follow.qc"
+#include "movetypes.qc"
+#include "push.qc"
+#include "step.qc"
+#include "toss.qc"
+#include "walk.qc"
{
other = oth;
- WITH(entity, self, this, this.move_touch());
+ WITHSELF(this, this.move_touch());
other = oldother;
}
{
other = this;
- WITH(entity, self, oth, oth.move_touch());
+ WITHSELF(oth, oth.move_touch());
other = oldother;
}
trace_plane_dist = 0;
trace_ent = this;
- WITH(entity, self, it, it.move_touch());
+ WITHSELF(it, it.move_touch());
}
});
this.move_nextthink = 0;
this.move_time = time;
other = world;
- WITH(entity, self, this, this.move_think());
+ WITHSELF(this, this.move_think());
}
}
PM_ClientMovement_Unstick(this);
// set crouched
- if (PHYS_INPUT_BUTTON_CROUCH(this))
+ bool do_crouch = PHYS_INPUT_BUTTON_CROUCH(this);
+ if(this.hook && !wasfreed(this.hook))
+ do_crouch = false;
+ if(hud != HUD_NORMAL)
+ do_crouch = false;
+ if(STAT(FROZEN, this))
+ do_crouch = false;
+ if((activeweapon == WEP_SHOCKWAVE || activeweapon == WEP_SHOTGUN) && viewmodel.animstate_startframe == viewmodel.anim_fire2_x && time < viewmodel.weapon_nextthink)
+ do_crouch = false;
+
+ if (do_crouch)
{
// wants to crouch, this always works
if (!IS_DUCKED(this)) SET_DUCKED(this);
#ifdef SVQC
- WarpZone_PlayerPhysics_FixVAngle();
+ WarpZone_PlayerPhysics_FixVAngle(this);
#endif
float maxspeed_mod = 1;
maxspeed_mod *= PHYS_HIGHSPEED(this);
#define ITEMS_STAT(s) ((s).items)
+.float teleport_time;
+
#ifdef CSQC
string autocvar_cl_jumpspeedcap_min;
.vector movement;
.vector v_angle;
+ .entity hook;
+
// TODO
#define IS_CLIENT(s) ((s).isplayermodel)
#define IS_PLAYER(s) ((s).isplayermodel)
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
void PlayerState_detach(entity this)
{
- if (!PS(this)) return; // initial connect
- FOREACH_CLIENT(PS(it) == PS(this), { PS(it) = NULL; });
- remove(PS(this));
- this._ps = NULL;
-
- Inventory_delete(self);
+ PlayerState ps = PS(this);
+ if (!ps) return; // initial connect
+ PS(this) = NULL;
+ if (ps.m_client != this) return; // don't own state, spectator
+ FOREACH_CLIENT(PS(it) == ps, { PS(it) = NULL; });
+ remove(ps);
+
+ Inventory_delete(this);
}
void GetCvars(entity this, int);
void Item_Damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
{
if(ITEM_DAMAGE_NEEDKILL(deathtype))
- WITH(entity, self, this, RemoveItem());
+ WITHSELF(this, RemoveItem());
}
void _StartItem(entity this, entity def, float defaultrespawntime, float defaultrespawntimejitter)
this.SendFlags |= ISF_SIZE;
// note droptofloor returns false if stuck/or would fall too far
if (!this.noalign)
- WITH(entity, self, this, droptofloor());
+ WITHSELF(this, droptofloor());
waypoint_spawnforitem(this);
}
--- /dev/null
+// generated file; do not modify
+#include "include.qc"
+#include "platforms.qc"
+#include "subs.qc"
+#include "teleporters.qc"
+#include "triggers.qc"
--- /dev/null
+// generated file; do not modify
+#include "bobbing.qc"
+#include "breakable.qc"
+#include "button.qc"
+#include "conveyor.qc"
+#include "door.qc"
+#include "door_rotating.qc"
+#include "door_secret.qc"
+#include "fourier.qc"
+#include "include.qc"
+#include "ladder.qc"
+#include "pendulum.qc"
+#include "plat.qc"
+#include "pointparticles.qc"
+#include "rainsnow.qc"
+#include "rotating.qc"
+#include "stardust.qc"
+#include "train.qc"
+#include "vectormamamam.qc"
WaypointSprite_Ping(this.sprite);
WaypointSprite_UpdateHealth(this.sprite, this.health);
}
- WITH(entity, self, this, func_breakable_colormod());
+ WITHSELF(this, func_breakable_colormod());
if(this.health <= 0)
{
if (this.health <= 0)
{
this.enemy = damage_attacker;
- WITH(entity, self, this, button_fire());
+ WITHSELF(this, button_fire());
}
}
#elif defined(CSQC)
-void conveyor_draw(entity this) { WITH(entity, self, this, conveyor_think()); }
+void conveyor_draw(entity this) { WITHSELF(this, conveyor_think()); }
void conveyor_init()
{SELFPARAM();
if (self.owner)
{
- WITH(entity, self, self.owner, door_fire());
+ WITHSELF(self.owner, door_fire());
}
}
{
this.owner.health = this.owner.max_health;
this.owner.takedamage = DAMAGE_NO; // wil be reset upon return
- WITH(entity, self, this.owner, door_use());
+ WITHSELF(this.owner, door_use());
}
}
void fd_secret_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
{
- WITH(entity, self, this, fd_secret_use());
+ WITHSELF(this, fd_secret_use());
}
// Wait after first movement...
#endif
void train_wait()
{SELFPARAM();
- WITH(entity, self, self.enemy, SUB_UseTargets());
+ WITHSELF(self.enemy, SUB_UseTargets());
self.enemy = world;
// if turning is enabled, the train will turn toward the next point while waiting
--- /dev/null
+// generated file; do not modify
+#include "corner.qc"
+#include "follow.qc"
+#include "include.qc"
+#include "laser.qc"
+#include "teleport_dest.qc"
self.count = 1;
activator = self.enemy.pusher;
- WITH(entity, self, self.enemy, SUB_UseTargets());
+ WITHSELF(self.enemy, SUB_UseTargets());
}
}
else
self.count = 0;
activator = self.enemy.pusher;
- WITH(entity, self, self.enemy, SUB_UseTargets());
+ WITHSELF(self.enemy, SUB_UseTargets());
}
}
}
void SUB_SetFade_Think ()
{SELFPARAM();
- if(self.alpha == 0)
- self.alpha = 1;
- self.SUB_THINK = SUB_SetFade_Think;
- self.SUB_NEXTTHINK = time;
- self.alpha -= frametime * self.fade_rate;
- if (self.alpha < 0.01)
- SUB_VanishOrRemove(self);
+ if(this.alpha == 0)
+ this.alpha = 1;
+ this.SUB_THINK = SUB_SetFade_Think;
+ this.SUB_NEXTTHINK = time;
+ this.alpha -= frametime * this.fade_rate;
+ if (this.alpha < 0.01)
+ SUB_VanishOrRemove(this);
else
- self.SUB_NEXTTHINK = time;
+ this.SUB_NEXTTHINK = time;
}
/*
void SUB_CalcMoveEnt (entity ent, vector tdest, float tspeedtype, float tspeed, void() func)
{SELFPARAM();
- WITH(entity, self, ent, SUB_CalcMove(tdest, tspeedtype, tspeed, func));
+ WITHSELF(ent, SUB_CalcMove(tdest, tspeedtype, tspeed, func));
}
/*
void SUB_CalcAngleMoveEnt (entity ent, vector destangle, float tspeedtype, float tspeed, void() func)
{SELFPARAM();
- WITH(entity, self, ent, SUB_CalcAngleMove (destangle, tspeedtype, tspeed, func));
+ WITHSELF(ent, SUB_CalcAngleMove (destangle, tspeedtype, tspeed, func));
}
--- /dev/null
+// generated file; do not modify
+#include "changelevel.qc"
+#include "include.qc"
+#include "location.qc"
+#include "music.qc"
+#include "spawn.qc"
+#include "speaker.qc"
+#include "voicescript.qc"
}
void target_music_kill()
{
- SELFPARAM();
- for(self = world; (self = find(self, classname, "target_music")); )
- {
- self.volume = 0;
- if(self.targetname == "")
- target_music_sendto(MSG_ALL, 1);
- else
- target_music_sendto(MSG_ALL, 0);
- }
+ FOREACH_ENTITY_CLASS("target_music", true, {
+ it.volume = 0;
+ if (it.targetname == "")
+ WITHSELF(it, target_music_sendto(MSG_ALL, 1));
+ else
+ WITHSELF(it, target_music_sendto(MSG_ALL, 0));
+ });
}
void target_music_use()
{
oldactivator = activator;
activator = act;
- WITH(entity, self, e, e.target_spawn_spawnfunc(e));
+ WITHSELF(e, e.target_spawn_spawnfunc(e));
activator = oldactivator;
// We called an external function, so we have to re-tokenize msg.
--- /dev/null
+// generated file; do not modify
+#include "counter.qc"
+#include "delay.qc"
+#include "disablerelay.qc"
+#include "flipflop.qc"
+#include "gamestart.qc"
+#include "gravity.qc"
+#include "heal.qc"
+#include "hurt.qc"
+#include "impulse.qc"
+#include "include.qc"
+#include "jumppads.qc"
+#include "keylock.qc"
+#include "magicear.qc"
+#include "monoflop.qc"
+#include "multi.qc"
+#include "multivibrator.qc"
+#include "relay.qc"
+#include "relay_activators.qc"
+#include "relay_if.qc"
+#include "relay_teamcheck.qc"
+#include "secret.qc"
+#include "swamp.qc"
+#include "teleport.qc"
+#include "viewloc.qc"
#elif defined(CSQC)
NET_HANDLE(ENT_CLIENT_TRIGGER_IMPULSE, bool isnew)
{
- self.spawnflags = ReadInt24_t();
- self.radius = ReadCoord();
- self.strength = ReadCoord();
- self.falloff = ReadByte();
- self.active = ReadByte();
+ this.spawnflags = ReadInt24_t();
+ this.radius = ReadCoord();
+ this.strength = ReadCoord();
+ this.falloff = ReadByte();
+ this.active = ReadByte();
trigger_common_read(true);
return = true;
- self.classname = "trigger_impulse";
- self.solid = SOLID_TRIGGER;
- self.entremove = trigger_remove_generic;
- //self.draw = trigger_draw_generic;
- self.drawmask = MASK_NORMAL;
- self.move_time = time;
+ this.classname = "trigger_impulse";
+ this.solid = SOLID_TRIGGER;
+ this.entremove = trigger_remove_generic;
+ //this.draw = trigger_draw_generic;
+ this.drawmask = MASK_NORMAL;
+ this.move_time = time;
- if(self.radius) { self.move_touch = trigger_impulse_touch3; }
- else if(self.target) { self.move_touch = trigger_impulse_touch1; }
- else { self.move_touch = trigger_impulse_touch2; }
+ if(this.radius) { this.move_touch = trigger_impulse_touch3; }
+ else if(this.target) { this.move_touch = trigger_impulse_touch1; }
+ else { this.move_touch = trigger_impulse_touch2; }
}
#endif
if(this.enemy.target)
{
activator = other;
- WITH(entity, self, this.enemy, SUB_UseTargets());
+ WITHSELF(this.enemy, SUB_UseTargets());
}
if (other.flags & FL_PROJECTILE)
vector org;
// first calculate a typical start point for the jump
- org = (self.absmin + self.absmax) * 0.5;
- org_z = self.absmax.z - STAT(PL_MIN, NULL).z;
+ org = (this.absmin + this.absmax) * 0.5;
+ org_z = this.absmax.z - STAT(PL_MIN, NULL).z;
- if (self.target)
+ if (this.target)
{
float n = 0;
- for(t = world; (t = find(t, targetname, self.target)); )
+ for(t = world; (t = find(t, targetname, this.target)); )
{
++n;
#ifdef SVQC
entity e = spawn();
setorigin(e, org);
setsize(e, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL));
- e.velocity = trigger_push_calculatevelocity(org, t, self.height);
+ e.velocity = trigger_push_calculatevelocity(org, t, this.height);
tracetoss(e, e);
if(e.movetype == MOVETYPE_NONE)
- waypoint_spawnforteleporter(self, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity));
+ waypoint_spawnforteleporter(this, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity));
remove(e);
#endif
}
else if(n == 1)
{
// exactly one dest - bots love that
- self.enemy = find(world, targetname, self.target);
+ this.enemy = find(world, targetname, this.target);
}
else
{
// have to use random selection every single time
- self.enemy = world;
+ this.enemy = world;
}
}
#ifdef SVQC
entity e = spawn();
setorigin(e, org);
setsize(e, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL));
- e.velocity = self.movedir;
+ e.velocity = this.movedir;
tracetoss(e, e);
- waypoint_spawnforteleporter(self, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity));
+ waypoint_spawnforteleporter(this, trace_endpos, vlen(trace_endpos - org) / vlen(e.velocity));
remove(e);
}
trigger_push_link();
- defer(self, 0.1, trigger_push_updatelink);
+ defer(this, 0.1, trigger_push_updatelink);
#endif
}
{
WriteHeader(MSG_ENTITY, ENT_CLIENT_TRIGGER_PUSH);
- WriteByte(MSG_ENTITY, self.team);
- WriteInt24_t(MSG_ENTITY, self.spawnflags);
- WriteByte(MSG_ENTITY, self.active);
- WriteCoord(MSG_ENTITY, self.height);
+ WriteByte(MSG_ENTITY, this.team);
+ WriteInt24_t(MSG_ENTITY, this.spawnflags);
+ WriteByte(MSG_ENTITY, this.active);
+ WriteCoord(MSG_ENTITY, this.height);
- trigger_common_write(self, true);
+ trigger_common_write(this, true);
return true;
}
void trigger_push_updatelink()
{SELFPARAM();
- self.SendFlags |= 1;
+ this.SendFlags |= 1;
}
void trigger_push_link()
{
SELFPARAM();
- trigger_link(self, trigger_push_send);
+ trigger_link(this, trigger_push_send);
}
/*
*/
spawnfunc(trigger_push)
{
- SetMovedir(self);
+ SetMovedir(this);
- trigger_init(self);
+ trigger_init(this);
- self.active = ACTIVE_ACTIVE;
- self.use = trigger_push_use;
- self.touch = trigger_push_touch;
+ this.active = ACTIVE_ACTIVE;
+ this.use = trigger_push_use;
+ this.touch = trigger_push_touch;
// normal push setup
- if (!self.speed)
- self.speed = 1000;
- self.movedir = self.movedir * self.speed * 10;
+ if (!this.speed)
+ this.speed = 1000;
+ this.movedir = this.movedir * this.speed * 10;
- if (!self.noise)
- self.noise = "misc/jumppad.wav";
- precache_sound (self.noise);
+ if (!this.noise)
+ this.noise = "misc/jumppad.wav";
+ precache_sound (this.noise);
// this must be called to spawn the teleport waypoints for bots
- InitializeEntity(self, trigger_push_findtarget, INITPRIO_FINDTARGET);
+ InitializeEntity(this, trigger_push_findtarget, INITPRIO_FINDTARGET);
}
{
WriteHeader(MSG_ENTITY, ENT_CLIENT_TARGET_PUSH);
- WriteByte(MSG_ENTITY, self.cnt);
- WriteString(MSG_ENTITY, self.targetname);
- WriteCoord(MSG_ENTITY, self.origin_x);
- WriteCoord(MSG_ENTITY, self.origin_y);
- WriteCoord(MSG_ENTITY, self.origin_z);
+ WriteByte(MSG_ENTITY, this.cnt);
+ WriteString(MSG_ENTITY, this.targetname);
+ WriteCoord(MSG_ENTITY, this.origin_x);
+ WriteCoord(MSG_ENTITY, this.origin_y);
+ WriteCoord(MSG_ENTITY, this.origin_z);
- WriteAngle(MSG_ENTITY, self.angles_x);
- WriteAngle(MSG_ENTITY, self.angles_y);
- WriteAngle(MSG_ENTITY, self.angles_z);
+ WriteAngle(MSG_ENTITY, this.angles_x);
+ WriteAngle(MSG_ENTITY, this.angles_y);
+ WriteAngle(MSG_ENTITY, this.angles_z);
return true;
}
{
make_pure(this);
- self.classname = "jumppad";
- int mytm = ReadByte(); if(mytm) { self.team = mytm - 1; }
- self.spawnflags = ReadInt24_t();
- self.active = ReadByte();
- self.height = ReadCoord();
+ this.classname = "jumppad";
+ int mytm = ReadByte(); if(mytm) { this.team = mytm - 1; }
+ this.spawnflags = ReadInt24_t();
+ this.active = ReadByte();
+ this.height = ReadCoord();
trigger_common_read(true);
- self.entremove = trigger_remove_generic;
- self.solid = SOLID_TRIGGER;
- //self.draw = trigger_draw_generic;
- self.move_touch = trigger_push_touch;
- self.drawmask = MASK_NORMAL;
- self.move_time = time;
- defer(self, 0.25, trigger_push_findtarget);
+ this.entremove = trigger_remove_generic;
+ this.solid = SOLID_TRIGGER;
+ //this.draw = trigger_draw_generic;
+ this.move_touch = trigger_push_touch;
+ this.drawmask = MASK_NORMAL;
+ this.move_time = time;
+ defer(this, 0.25, trigger_push_findtarget);
return true;
}
NET_HANDLE(ENT_CLIENT_TARGET_PUSH, bool isnew)
{
- self.classname = "push_target";
- self.cnt = ReadByte();
- self.targetname = strzone(ReadString());
- self.origin_x = ReadCoord();
- self.origin_y = ReadCoord();
- self.origin_z = ReadCoord();
+ this.classname = "push_target";
+ this.cnt = ReadByte();
+ this.targetname = strzone(ReadString());
+ this.origin_x = ReadCoord();
+ this.origin_y = ReadCoord();
+ this.origin_z = ReadCoord();
- self.angles_x = ReadAngle();
- self.angles_y = ReadAngle();
- self.angles_z = ReadAngle();
+ this.angles_x = ReadAngle();
+ this.angles_y = ReadAngle();
+ this.angles_z = ReadAngle();
return = true;
- setorigin(self, self.origin);
+ setorigin(this, this.origin);
- self.drawmask = MASK_NORMAL;
- self.entremove = target_push_remove;
+ this.drawmask = MASK_NORMAL;
+ this.entremove = target_push_remove;
}
#endif
{
this.enemy = attacker;
this.goalentity = inflictor;
- WITH(entity, self, this, multi_trigger());
+ WITHSELF(this, multi_trigger());
}
}
void secrets_setstatus()
{SELFPARAM();
- self.stat_secrets_total = secrets_total;
- self.stat_secrets_found = secrets_found;
+ this.stat_secrets_total = secrets_total;
+ this.stat_secrets_found = secrets_found;
}
/**
SUB_UseTargets();
if (!self.target) self.target = s;
- WITH(entity, self, e, SUB_UseTargets());
+ WITHSELF(e, SUB_UseTargets());
#endif
}
void DelayThink()
{SELFPARAM();
- activator = self.enemy;
+ activator = this.enemy;
SUB_UseTargets ();
- remove(self);
+ remove(this);
}
void FixSize(entity e)
void trigger_init(entity this)
{
string m = this.model;
- WITH(entity, self, this, WarpZoneLib_ExactTrigger_Init());
+ WITHSELF(this, WarpZoneLib_ExactTrigger_Init());
if(m != "")
{
precache_model(m);
void trigger_common_read(bool withtarget)
{SELFPARAM();
int f = ReadByte();
- self.warpzone_isboxy = (f & 1);
+ this.warpzone_isboxy = (f & 1);
if(withtarget)
{
- if(self.target) { strunzone(self.target); }
- self.target = strzone(ReadString());
- if(self.target2) { strunzone(self.target2); }
- self.target2 = strzone(ReadString());
- if(self.target3) { strunzone(self.target3); }
- self.target3 = strzone(ReadString());
- if(self.target4) { strunzone(self.target4); }
- self.target4 = strzone(ReadString());
- if(self.targetname) { strunzone(self.targetname); }
- self.targetname = strzone(ReadString());
- if(self.killtarget) { strunzone(self.killtarget); }
- self.killtarget = strzone(ReadString());
+ if(this.target) { strunzone(this.target); }
+ this.target = strzone(ReadString());
+ if(this.target2) { strunzone(this.target2); }
+ this.target2 = strzone(ReadString());
+ if(this.target3) { strunzone(this.target3); }
+ this.target3 = strzone(ReadString());
+ if(this.target4) { strunzone(this.target4); }
+ this.target4 = strzone(ReadString());
+ if(this.targetname) { strunzone(this.targetname); }
+ this.targetname = strzone(ReadString());
+ if(this.killtarget) { strunzone(this.killtarget); }
+ this.killtarget = strzone(ReadString());
}
if(f & 4)
{
- self.origin_x = ReadCoord();
- self.origin_y = ReadCoord();
- self.origin_z = ReadCoord();
+ this.origin_x = ReadCoord();
+ this.origin_y = ReadCoord();
+ this.origin_z = ReadCoord();
}
else
- self.origin = '0 0 0';
- setorigin(self, self.origin);
-
- self.modelindex = ReadShort();
- self.mins_x = ReadCoord();
- self.mins_y = ReadCoord();
- self.mins_z = ReadCoord();
- self.maxs_x = ReadCoord();
- self.maxs_y = ReadCoord();
- self.maxs_z = ReadCoord();
- self.scale = ReadByte() / 16;
- setsize(self, self.mins, self.maxs);
-
- self.movedir_x = ReadCoord();
- self.movedir_y = ReadCoord();
- self.movedir_z = ReadCoord();
-
- self.angles_x = ReadCoord();
- self.angles_y = ReadCoord();
- self.angles_z = ReadCoord();
+ this.origin = '0 0 0';
+ setorigin(this, this.origin);
+
+ this.modelindex = ReadShort();
+ this.mins_x = ReadCoord();
+ this.mins_y = ReadCoord();
+ this.mins_z = ReadCoord();
+ this.maxs_x = ReadCoord();
+ this.maxs_y = ReadCoord();
+ this.maxs_z = ReadCoord();
+ this.scale = ReadByte() / 16;
+ setsize(this, this.mins, this.maxs);
+
+ this.movedir_x = ReadCoord();
+ this.movedir_y = ReadCoord();
+ this.movedir_z = ReadCoord();
+
+ this.angles_x = ReadCoord();
+ this.angles_y = ReadCoord();
+ this.angles_z = ReadCoord();
}
void trigger_remove_generic(entity this)
//
// check for a delay
//
- if (self.delay)
+ if (this.delay)
{
// create a temp object to fire at a later time
t = new(DelayedUse);
- t.nextthink = time + self.delay;
+ t.nextthink = time + this.delay;
t.think = DelayThink;
t.enemy = activator;
- t.message = self.message;
- t.killtarget = self.killtarget;
- t.target = self.target;
- t.target2 = self.target2;
- t.target3 = self.target3;
- t.target4 = self.target4;
+ t.message = this.message;
+ t.killtarget = this.killtarget;
+ t.target = this.target;
+ t.target2 = this.target2;
+ t.target3 = this.target3;
+ t.target4 = this.target4;
return;
}
// print the message
//
#ifdef SVQC
- if(self)
- if(IS_PLAYER(activator) && self.message != "")
+ if(this)
+ if(IS_PLAYER(activator) && this.message != "")
if(IS_REAL_CLIENT(activator))
{
- centerprint(activator, self.message);
- if (self.noise == "")
+ centerprint(activator, this.message);
+ if (this.noise == "")
play2(activator, SND(TALK));
}
//
// kill the killtagets
//
- s = self.killtarget;
+ s = this.killtarget;
if (s != "")
{
for(t = world; (t = find(t, targetname, s)); )
{
// Flag to set func_clientwall state
// 1 == deactivate, 2 == activate, 0 == do nothing
- float aw_flag = self.antiwall_flag;
+ float aw_flag = this.antiwall_flag;
for(t = world; (t = find(t, targetname, s)); )
if(t.use)
{
if(WarpZoneLib_BoxTouchesBrush(emin, emax, this, e)) // accurate
{
other = e;
- WITH(entity, self, this, touchfunc());
+ WITHSELF(this, touchfunc());
}
}
}
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
+#include "checkpoint.qc"
+#include "cl_turrets.qc"
+#include "config.qc"
+#include "sv_turrets.qc"
+#include "targettrigger.qc"
+#include "util.qc"
+++ /dev/null
-#include "turret/ewheel.qc"
-#include "turret/flac.qc"
-#include "turret/fusionreactor.qc"
-#include "turret/hellion.qc"
-#include "turret/hk.qc"
-#include "turret/machinegun.qc"
-#include "turret/mlrs.qc"
-#include "turret/phaser.qc"
-#include "turret/plasma.qc"
-#include "turret/plasma_dual.qc"
-#include "turret/tesla.qc"
-#include "turret/walker.qc"
#endif
#define IMPLEMENTATION
-#include "all.inc"
+#include "turret/_mod.inc"
#undef IMPLEMENTATION
#ifdef CSQC
REGISTER_TURRET(Null, NEW(Turret));
-#include "all.inc"
+#include "turret/_mod.inc"
#endif
this.health -= damage;
//this.realowner = attacker; // Dont change realowner, it does not make much sense for turrets
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(this.owner, turret_projectile_explode));
+ WITHSELF(this, W_PrepareExplosionByDamage(this.owner, turret_projectile_explode));
}
entity turret_projectile(Sound _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim)
--- /dev/null
+// generated file; do not modify
+#include "ewheel.qc"
+#include "ewheel_weapon.qc"
+#include "flac.qc"
+#include "flac_weapon.qc"
+#include "fusionreactor.qc"
+#include "hellion.qc"
+#include "hellion_weapon.qc"
+#include "hk.qc"
+#include "hk_weapon.qc"
+#include "machinegun.qc"
+#include "machinegun_weapon.qc"
+#include "mlrs.qc"
+#include "mlrs_weapon.qc"
+#include "phaser.qc"
+#include "phaser_weapon.qc"
+#include "plasma.qc"
+#include "plasma_dual.qc"
+#include "plasma_weapon.qc"
+#include "tesla.qc"
+#include "tesla_weapon.qc"
+#include "walker.qc"
+#include "walker_weapon.qc"
//#define EWHEEL_FANCYPATH
-#include "ewheel_weapon.qc"
+#include "ewheel_weapon.qh"
CLASS(EWheel, Turret)
/* spawnflags */ ATTRIB(EWheel, spawnflags, int, TUR_FLAG_PLAYER | TUR_FLAG_MOVE | TUR_FLAG_ROAM);
#ifdef IMPLEMENTATION
-#include "ewheel_weapon.qc"
-
#ifdef SVQC
float autocvar_g_turrets_unit_ewheel_speed_fast;
-#ifndef TURRET_EWHEEL_WEAPON_H
-#define TURRET_EWHEEL_WEAPON_H
-
-CLASS(EWheelAttack, PortoLaunch)
-/* flags */ ATTRIB(EWheelAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(EWheelAttack, impulse, int, 5);
-/* refname */ ATTRIB(EWheelAttack, netname, string, "turret_ewheel");
-/* wepname */ ATTRIB(EWheelAttack, m_name, string, _("eWheel"));
-ENDCLASS(EWheelAttack)
-REGISTER_WEAPON(EWHEEL, NEW(EWheelAttack));
-
-#endif
+#include "ewheel_weapon.qh"
#ifdef IMPLEMENTATION
--- /dev/null
+#pragma once
+
+CLASS(EWheelAttack, PortoLaunch)
+/* flags */ ATTRIB(EWheelAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(EWheelAttack, impulse, int, 5);
+/* refname */ ATTRIB(EWheelAttack, netname, string, "turret_ewheel");
+/* wepname */ ATTRIB(EWheelAttack, m_name, string, _("eWheel"));
+ENDCLASS(EWheelAttack)
+REGISTER_WEAPON(EWHEEL, NEW(EWheelAttack));
#ifndef TURRET_FLAC_H
#define TURRET_FLAC_H
-#include "flac_weapon.qc"
+#include "flac_weapon.qh"
CLASS(Flac, Turret)
/* spawnflags */ ATTRIB(Flac, spawnflags, int, TUR_FLAG_SPLASH | TUR_FLAG_FASTPROJ | TUR_FLAG_MISSILE);
#ifdef IMPLEMENTATION
-#include "flac_weapon.qc"
-
#ifdef SVQC
spawnfunc(turret_flac) { if (!turret_initialize(TUR_FLAC)) remove(self); }
-#ifndef TURRET_FLAC_WEAPON_H
-#define TURRET_FLAC_WEAPON_H
-
-CLASS(FlacAttack, PortoLaunch)
-/* flags */ ATTRIB(FlacAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(FlacAttack, impulse, int, 5);
-/* refname */ ATTRIB(FlacAttack, netname, string, "turret_flac");
-/* wepname */ ATTRIB(FlacAttack, m_name, string, _("FLAC"));
-ENDCLASS(FlacAttack)
-REGISTER_WEAPON(FLAC, NEW(FlacAttack));
-
-#endif
+#include "flac_weapon.qh"
#ifdef IMPLEMENTATION
--- /dev/null
+#pragma once
+
+CLASS(FlacAttack, PortoLaunch)
+/* flags */ ATTRIB(FlacAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(FlacAttack, impulse, int, 5);
+/* refname */ ATTRIB(FlacAttack, netname, string, "turret_flac");
+/* wepname */ ATTRIB(FlacAttack, m_name, string, _("FLAC"));
+ENDCLASS(FlacAttack)
+REGISTER_WEAPON(FLAC, NEW(FlacAttack));
#ifndef TURRET_HELLION_H
#define TURRET_HELLION_H
-#include "hellion_weapon.qc"
+#include "hellion_weapon.qh"
CLASS(Hellion, Turret)
/* spawnflags */ ATTRIB(Hellion, spawnflags, int, TUR_FLAG_SPLASH | TUR_FLAG_FASTPROJ | TUR_FLAG_PLAYER | TUR_FLAG_MISSILE);
#ifdef IMPLEMENTATION
-#include "hellion_weapon.qc"
-
#ifdef SVQC
spawnfunc(turret_hellion) { if (!turret_initialize(TUR_HELLION)) remove(self); }
-#ifndef TURRET_HELLION_WEAPON_H
-#define TURRET_HELLION_WEAPON_H
-
-CLASS(HellionAttack, PortoLaunch)
-/* flags */ ATTRIB(HellionAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(HellionAttack, impulse, int, 9);
-/* refname */ ATTRIB(HellionAttack, netname, string, "turret_hellion");
-/* wepname */ ATTRIB(HellionAttack, m_name, string, _("Hellion"));
-ENDCLASS(HellionAttack)
-REGISTER_WEAPON(HELLION, NEW(HellionAttack));
-
-#endif
+#include "hellion_weapon.qh"
#ifdef IMPLEMENTATION
--- /dev/null
+#pragma once
+
+CLASS(HellionAttack, PortoLaunch)
+/* flags */ ATTRIB(HellionAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(HellionAttack, impulse, int, 9);
+/* refname */ ATTRIB(HellionAttack, netname, string, "turret_hellion");
+/* wepname */ ATTRIB(HellionAttack, m_name, string, _("Hellion"));
+ENDCLASS(HellionAttack)
+REGISTER_WEAPON(HELLION, NEW(HellionAttack));
//#define TURRET_DEBUG_HK
-#include "hk_weapon.qc"
+#include "hk_weapon.qh"
CLASS(HunterKiller, Turret)
/* spawnflags */ ATTRIB(HunterKiller, spawnflags, int, TUR_FLAG_SPLASH | TUR_FLAG_MEDPROJ | TUR_FLAG_PLAYER | TUR_FLAG_RECIEVETARGETS);
#ifdef IMPLEMENTATION
-#include "hk_weapon.qc"
-
#ifdef SVQC
#ifdef TURRET_DEBUG_HK
-#ifndef TURRET_HK_WEAPON_H
-#define TURRET_HK_WEAPON_H
-
-CLASS(HunterKillerAttack, PortoLaunch)
-/* flags */ ATTRIB(HunterKillerAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(HunterKillerAttack, impulse, int, 9);
-/* refname */ ATTRIB(HunterKillerAttack, netname, string, "turret_hk");
-/* wepname */ ATTRIB(HunterKillerAttack, m_name, string, _("Hunter-Killer"));
-ENDCLASS(HunterKillerAttack)
-REGISTER_WEAPON(HK, NEW(HunterKillerAttack));
-
-#endif
+#include "hk_weapon.qh"
#ifdef IMPLEMENTATION
--- /dev/null
+#pragma once
+
+CLASS(HunterKillerAttack, PortoLaunch)
+/* flags */ ATTRIB(HunterKillerAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(HunterKillerAttack, impulse, int, 9);
+/* refname */ ATTRIB(HunterKillerAttack, netname, string, "turret_hk");
+/* wepname */ ATTRIB(HunterKillerAttack, m_name, string, _("Hunter-Killer"));
+ENDCLASS(HunterKillerAttack)
+REGISTER_WEAPON(HK, NEW(HunterKillerAttack));
#ifndef TURRET_MACHINEGUN_H
#define TURRET_MACHINEGUN_H
-#include "machinegun_weapon.qc"
+#include "machinegun_weapon.qh"
CLASS(MachineGunTurret, Turret)
/* spawnflags */ ATTRIB(MachineGunTurret, spawnflags, int, TUR_FLAG_PLAYER);
#ifdef IMPLEMENTATION
-#include "machinegun_weapon.qc"
-
#ifdef SVQC
spawnfunc(turret_machinegun) { if (!turret_initialize(TUR_MACHINEGUN)) remove(self); }
-#ifndef TURRET_MACHINEGUN_WEAPON_H
-#define TURRET_MACHINEGUN_WEAPON_H
-
-CLASS(MachineGunTurretAttack, PortoLaunch)
-/* flags */ ATTRIB(MachineGunTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(MachineGunTurretAttack, impulse, int, 9);
-/* refname */ ATTRIB(MachineGunTurretAttack, netname, string, "turret_machinegun");
-/* wepname */ ATTRIB(MachineGunTurretAttack, m_name, string, _("Machinegun"));
-ENDCLASS(MachineGunTurretAttack)
-REGISTER_WEAPON(TUR_MACHINEGUN, NEW(MachineGunTurretAttack));
-
-#endif
+#include "machinegun_weapon.qh"
#ifdef IMPLEMENTATION
actor.tur_head = actor;
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, 0, w_ready);
}
- fireBullet (actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_MACHINEGUN.m_id, 0);
+ fireBullet (actor, actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_MACHINEGUN.m_id, 0);
W_MachineGun_MuzzleFlash();
setattachment(actor.muzzle_flash, actor.tur_head, "tag_fire");
}
--- /dev/null
+#pragma once
+
+CLASS(MachineGunTurretAttack, PortoLaunch)
+/* flags */ ATTRIB(MachineGunTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(MachineGunTurretAttack, impulse, int, 9);
+/* refname */ ATTRIB(MachineGunTurretAttack, netname, string, "turret_machinegun");
+/* wepname */ ATTRIB(MachineGunTurretAttack, m_name, string, _("Machinegun"));
+ENDCLASS(MachineGunTurretAttack)
+REGISTER_WEAPON(TUR_MACHINEGUN, NEW(MachineGunTurretAttack));
#ifndef TURRET_MLRS_H
#define TURRET_MLRS_H
-#include "mlrs_weapon.qc"
+#include "mlrs_weapon.qh"
CLASS(MLRSTurret, Turret)
/* spawnflags */ ATTRIB(MLRSTurret, spawnflags, int, TUR_FLAG_SPLASH | TUR_FLAG_MEDPROJ | TUR_FLAG_PLAYER);
#ifdef IMPLEMENTATION
-#include "mlrs_weapon.qc"
-
#ifdef SVQC
spawnfunc(turret_mlrs) { if (!turret_initialize(TUR_MLRS)) remove(self); }
-#ifndef TURRET_MLRS_WEAPON_H
-#define TURRET_MLRS_WEAPON_H
-
-CLASS(MLRSTurretAttack, PortoLaunch)
-/* flags */ ATTRIB(MLRSTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(MLRSTurretAttack, impulse, int, 9);
-/* refname */ ATTRIB(MLRSTurretAttack, netname, string, "turret_mlrs");
-/* wepname */ ATTRIB(MLRSTurretAttack, m_name, string, _("MLRS"));
-ENDCLASS(MLRSTurretAttack)
-REGISTER_WEAPON(TUR_MLRS, NEW(MLRSTurretAttack));
-
-#endif
+#include "mlrs_weapon.qh"
#ifdef IMPLEMENTATION
--- /dev/null
+#pragma once
+
+CLASS(MLRSTurretAttack, PortoLaunch)
+/* flags */ ATTRIB(MLRSTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(MLRSTurretAttack, impulse, int, 9);
+/* refname */ ATTRIB(MLRSTurretAttack, netname, string, "turret_mlrs");
+/* wepname */ ATTRIB(MLRSTurretAttack, m_name, string, _("MLRS"));
+ENDCLASS(MLRSTurretAttack)
+REGISTER_WEAPON(TUR_MLRS, NEW(MLRSTurretAttack));
#ifndef TURRET_PHASER_H
#define TURRET_PHASER_H
-#include "phaser_weapon.qc"
+#include "phaser_weapon.qh"
CLASS(PhaserTurret, Turret)
/* spawnflags */ ATTRIB(PhaserTurret, spawnflags, int, TUR_FLAG_SNIPER | TUR_FLAG_HITSCAN | TUR_FLAG_PLAYER);
#ifdef IMPLEMENTATION
-#include "phaser_weapon.qc"
-
#ifdef SVQC
spawnfunc(turret_phaser) { if (!turret_initialize(TUR_PHASER)) remove(self); }
+.int fireflag;
+
METHOD(PhaserTurret, tr_think, void(PhaserTurret thistur, entity it))
{
SELFPARAM();
-#ifndef TURRET_PHASER_WEAPON_H
-#define TURRET_PHASER_WEAPON_H
-
-CLASS(PhaserTurretAttack, PortoLaunch)
-/* flags */ ATTRIB(PhaserTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(PhaserTurretAttack, impulse, int, 9);
-/* refname */ ATTRIB(PhaserTurretAttack, netname, string, "turret_phaser");
-/* wepname */ ATTRIB(PhaserTurretAttack, m_name, string, _("Phaser"));
-ENDCLASS(PhaserTurretAttack)
-REGISTER_WEAPON(PHASER, NEW(PhaserTurretAttack));
-
-#endif
+#include "phaser_weapon.qh"
#ifdef IMPLEMENTATION
--- /dev/null
+#pragma once
+
+CLASS(PhaserTurretAttack, PortoLaunch)
+/* flags */ ATTRIB(PhaserTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(PhaserTurretAttack, impulse, int, 9);
+/* refname */ ATTRIB(PhaserTurretAttack, netname, string, "turret_phaser");
+/* wepname */ ATTRIB(PhaserTurretAttack, m_name, string, _("Phaser"));
+ENDCLASS(PhaserTurretAttack)
+REGISTER_WEAPON(PHASER, NEW(PhaserTurretAttack));
#ifndef TURRET_PLASMA_H
#define TURRET_PLASMA_H
-#include "plasma_weapon.qc"
+#include "plasma_weapon.qh"
CLASS(PlasmaTurret, Turret)
/* spawnflags */ ATTRIB(PlasmaTurret, spawnflags, int, TUR_FLAG_SPLASH | TUR_FLAG_MEDPROJ | TUR_FLAG_PLAYER);
#ifdef IMPLEMENTATION
-#include "plasma_weapon.qc"
-
#ifdef SVQC
spawnfunc(turret_plasma) { if (!turret_initialize(TUR_PLASMA)) remove(self); }
#ifndef TURRET_PLASMA_DUAL_H
#define TURRET_PLASMA_DUAL_H
+#include "plasma_weapon.qh"
+
CLASS(PlasmaDualAttack, PlasmaAttack)
/* refname */ ATTRIB(PlasmaDualAttack, netname, string, "turret_plasma_dual");
/* wepname */ ATTRIB(PlasmaDualAttack, m_name, string, _("Dual plasma"));
-#ifndef TURRET_PLASMA_WEAPON_H
-#define TURRET_PLASMA_WEAPON_H
-
-CLASS(PlasmaAttack, PortoLaunch)
-/* flags */ ATTRIB(PlasmaAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(PlasmaAttack, impulse, int, 5);
-/* refname */ ATTRIB(PlasmaAttack, netname, string, "turret_plasma");
-/* wepname */ ATTRIB(PlasmaAttack, m_name, string, _("Plasma"));
-ENDCLASS(PlasmaAttack)
-REGISTER_WEAPON(PLASMA, NEW(PlasmaAttack));
-
-#endif
+#include "plasma_weapon.qh"
#ifdef IMPLEMENTATION
--- /dev/null
+#pragma once
+
+CLASS(PlasmaAttack, PortoLaunch)
+/* flags */ ATTRIB(PlasmaAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(PlasmaAttack, impulse, int, 5);
+/* refname */ ATTRIB(PlasmaAttack, netname, string, "turret_plasma");
+/* wepname */ ATTRIB(PlasmaAttack, m_name, string, _("Plasma"));
+ENDCLASS(PlasmaAttack)
+REGISTER_WEAPON(PLASMA, NEW(PlasmaAttack));
#ifndef TURRET_TESLA_H
#define TURRET_TESLA_H
-#include "tesla_weapon.qc"
+#include "tesla_weapon.qh"
CLASS(TeslaCoil, Turret)
/* spawnflags */ ATTRIB(TeslaCoil, spawnflags, int, TUR_FLAG_HITSCAN | TUR_FLAG_PLAYER | TUR_FLAG_MISSILE);
#ifdef IMPLEMENTATION
-#include "tesla_weapon.qc"
-
#ifdef SVQC
spawnfunc(turret_tesla) { if (!turret_initialize(TUR_TESLA)) remove(self); }
-#ifndef TURRET_TESLA_WEAPON_H
-#define TURRET_TESLA_WEAPON_H
-
-CLASS(TeslaCoilTurretAttack, PortoLaunch)
-/* flags */ ATTRIB(TeslaCoilTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(TeslaCoilTurretAttack, impulse, int, 9);
-/* refname */ ATTRIB(TeslaCoilTurretAttack, netname, string, "turret_tesla");
-/* wepname */ ATTRIB(TeslaCoilTurretAttack, m_name, string, _("Tesla Coil"));
-ENDCLASS(TeslaCoilTurretAttack)
-REGISTER_WEAPON(TESLA, NEW(TeslaCoilTurretAttack));
-
-#endif
+#include "tesla_weapon.qh"
#ifdef IMPLEMENTATION
--- /dev/null
+#pragma once
+
+CLASS(TeslaCoilTurretAttack, PortoLaunch)
+/* flags */ ATTRIB(TeslaCoilTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(TeslaCoilTurretAttack, impulse, int, 9);
+/* refname */ ATTRIB(TeslaCoilTurretAttack, netname, string, "turret_tesla");
+/* wepname */ ATTRIB(TeslaCoilTurretAttack, m_name, string, _("Tesla Coil"));
+ENDCLASS(TeslaCoilTurretAttack)
+REGISTER_WEAPON(TESLA, NEW(TeslaCoilTurretAttack));
//#define WALKER_FANCYPATHING
-#include "walker_weapon.qc"
+#include "walker_weapon.qh"
CLASS(WalkerTurret, Turret)
/* spawnflags */ ATTRIB(WalkerTurret, spawnflags, int, TUR_FLAG_PLAYER | TUR_FLAG_MOVE);
#ifdef IMPLEMENTATION
-#include "walker_weapon.qc"
-
#ifdef SVQC
float autocvar_g_turrets_unit_walker_melee_damage;
this.velocity = this.velocity + vforce;
if (this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(this.owner, walker_rocket_explode));
+ WITHSELF(this, W_PrepareExplosionByDamage(this.owner, walker_rocket_explode));
}
#define WALKER_ROCKET_MOVE movelib_move_simple(self, newdir, (autocvar_g_turrets_unit_walker_rocket_speed), (autocvar_g_turrets_unit_walker_rocket_turnrate)); UpdateCSQCProjectile(self)
return;
fixedmakevectors(this.angles);
- movelib_groundalign4point(300, 100, 0.25, 45);
+ movelib_groundalign4point(this, 300, 100, 0.25, 45);
setorigin(this, this.origin + this.velocity * dt);
this.tur_head.angles += dt * this.tur_head.move_avelocity;
this.angles_y = this.move_angles_y;
-#ifndef TURRET_WALKER_WEAPON_H
-#define TURRET_WALKER_WEAPON_H
-
-CLASS(WalkerTurretAttack, PortoLaunch)
-/* flags */ ATTRIB(WalkerTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(WalkerTurretAttack, impulse, int, 5);
-/* refname */ ATTRIB(WalkerTurretAttack, netname, string, "turret_walker");
-/* wepname */ ATTRIB(WalkerTurretAttack, m_name, string, _("Walker"));
-ENDCLASS(WalkerTurretAttack)
-REGISTER_WEAPON(WALKER, NEW(WalkerTurretAttack));
-
-#endif
+#include "walker_weapon.qh"
#ifdef IMPLEMENTATION
weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(electro, animtime), w_ready);
}
sound (actor, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM);
- fireBullet (actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_WALK_GUN.m_id, 0);
+ fireBullet (actor, actor.tur_shotorg, actor.tur_shotdir_updated, actor.shot_spread, 0, actor.shot_dmg, actor.shot_force, DEATH_TURRET_WALK_GUN.m_id, 0);
Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, actor.tur_shotorg, actor.tur_shotdir_updated * 1000, 1);
}
}
--- /dev/null
+#pragma once
+
+CLASS(WalkerTurretAttack, PortoLaunch)
+/* flags */ ATTRIB(WalkerTurretAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(WalkerTurretAttack, impulse, int, 5);
+/* refname */ ATTRIB(WalkerTurretAttack, netname, string, "turret_walker");
+/* wepname */ ATTRIB(WalkerTurretAttack, m_name, string, _("Walker"));
+ENDCLASS(WalkerTurretAttack)
+REGISTER_WEAPON(WALKER, NEW(WalkerTurretAttack));
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
+#include "cl_vehicles.qc"
+#include "sv_vehicles.qc"
+++ /dev/null
-#include "vehicle/spiderbot.qc"
-#include "vehicle/raptor.qc"
-#include "vehicle/racer.qc"
-#ifndef VEHICLES_NO_UNSTABLE
- #include "vehicle/bumblebee.qc"
-#endif
#endif
#define IMPLEMENTATION
-#include "all.inc"
+#include "vehicle/_mod.inc"
#undef IMPLEMENTATION
#endif
const int VEH_FIRST = 1;
#define VEH_LAST (Vehicles_COUNT - 1)
-/** If you register a new vehicle, make sure to add it to all.inc */
#define REGISTER_VEHICLE(id, inst) REGISTER(Vehicles, VEH, id, vehicleid, inst)
#if defined(SVQC)
REGISTER_VEHICLE(Null, NEW(Vehicle));
-#include "all.inc"
+#include "vehicle/_mod.inc"
#endif
tmpPos.x = (vid_conwidth - tmpSize.x) / 2;
tmpPos.y = (vid_conheight - tmpSize.y) / 2;
- drawpic(tmpPos, crosshair, tmpSize, '1 1 1', autocvar_crosshair_alpha, DRAWFLAG_NORMAL);
+ vector wcross_color = '1 1 1';
+ if(autocvar_cl_vehicles_crosshair_colorize)
+ wcross_color = crosshair_getcolor(NULL, STAT(VEHICLESTAT_HEALTH));
+
+ drawpic(tmpPos, crosshair, tmpSize, wcross_color, autocvar_crosshair_alpha, DRAWFLAG_NORMAL);
}
}
self.nextthink = time + 0.1;
}
-entity vehicle_tossgib(entity _template, vector _vel, string _tag, bool _burn, bool _explode, float _maxtime, vector _rot)
-{SELFPARAM();
+entity vehicle_tossgib(entity this, entity _template, vector _vel, string _tag, bool _burn, bool _explode, float _maxtime, vector _rot)
+{
entity _gib = spawn();
_setmodel(_gib, _template.model);
- vector org = gettaginfo(self, gettagindex(self, _tag));
+ vector org = gettaginfo(this, gettagindex(this, _tag));
setorigin(_gib, org);
_gib.velocity = _vel;
_gib.movetype = MOVETYPE_TOSS;
bool vehicle_addplayerslot( entity _owner,
entity _slot,
int _hud,
- string _hud_model,
+ Model _hud_model,
bool(entity) _framefunc,
- void(bool) _exitfunc, float() _enterfunc)
+ void(bool) _exitfunc, float(entity, entity) _enterfunc)
{
if(!(_owner.vehicle_flags & VHF_MULTISLOT))
_owner.vehicle_flags |= VHF_MULTISLOT;
_slot.vehicle_hudmodel.viewmodelforclient = _slot;
_slot.vehicle_viewport.effects = (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NOGUNBOB | EF_NOSHADOW | EF_LOWPRECISION | EF_SELECTABLE | EF_TELEPORT_BIT);
- _setmodel(_slot.vehicle_hudmodel, _hud_model);
+ setmodel(_slot.vehicle_hudmodel, _hud_model);
setmodel(_slot.vehicle_viewport, MDL_Null);
setattachment(_slot.vehicle_hudmodel, _slot, "");
return vtag;
}
-void vehicles_reset_colors()
-{SELFPARAM();
- entity e;
- float _effects = 0, _colormap;
- vector _glowmod, _colormod;
-
+void vehicles_reset_colors(entity this)
+{
+ int eff = 0, cmap;
+ const vector cmod = '0 0 0';
+ if(this.team && teamplay)
+ cmap = 1024 + (this.team - 1) * 17;
+ else
+ cmap = 1024;
if(autocvar_g_nodepthtestplayers)
- _effects |= EF_NODEPTHTEST;
-
+ eff |= EF_NODEPTHTEST;
if(autocvar_g_fullbrightplayers)
- _effects |= EF_FULLBRIGHT;
-
- if(self.team)
- _colormap = 1024 + (self.team - 1) * 17;
- else
- _colormap = 1024;
-
- _glowmod = '0 0 0';
- _colormod = '0 0 0';
+ eff |= EF_FULLBRIGHT;
// Find all ents attacked to main model and setup effects, colormod etc.
- e = findchainentity(tag_entity, self);
- while(e)
+ FOREACH_ENTITY_ENT(tag_entity, this,
{
- if(e != self.vehicle_shieldent)
+ if(it != this.vehicle_shieldent)
{
- e.effects = _effects; // | EF_LOWPRECISION;
- e.colormod = _colormod;
- e.colormap = _colormap;
- e.alpha = 1;
+ it.effects = eff;
+ it.colormod = cmod;
+ it.colormap = cmap;
+ it.alpha = 1;
}
- e = e.chain;
- }
+ });
+
// Also check head tags
- e = findchainentity(tag_entity, self.tur_head);
- while(e)
+ FOREACH_ENTITY_ENT(tag_entity, this.tur_head,
{
- if(e != self.vehicle_shieldent)
+ if(it != this.vehicle_shieldent)
{
- e.effects = _effects; // | EF_LOWPRECISION;
- e.colormod = _colormod;
- e.colormap = _colormap;
- e.alpha = 1;
+ it.effects = eff;
+ it.colormod = cmod;
+ it.colormap = cmap;
+ it.alpha = 1;
}
- e = e.chain;
- }
+ });
- self.vehicle_hudmodel.effects = self.effects = _effects; // | EF_LOWPRECISION;
- self.vehicle_hudmodel.colormod = self.colormod = _colormod;
- self.vehicle_hudmodel.colormap = self.colormap = _colormap;
- self.vehicle_viewport.effects = (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NOGUNBOB | EF_NOSHADOW | EF_LOWPRECISION | EF_SELECTABLE | EF_TELEPORT_BIT);
+ this.vehicle_hudmodel.effects = this.effects = eff; // | EF_LOWPRECISION;
+ this.vehicle_hudmodel.colormod = this.colormod = cmod;
+ this.vehicle_hudmodel.colormap = this.colormap = cmap;
+ this.vehicle_viewport.effects = (EF_ADDITIVE | EF_DOUBLESIDED | EF_FULLBRIGHT | EF_NODEPTHTEST | EF_NOGUNBOB | EF_NOSHADOW | EF_LOWPRECISION | EF_SELECTABLE | EF_TELEPORT_BIT);
- self.alpha = 1;
- self.avelocity = '0 0 0';
- self.velocity = '0 0 0';
- self.effects = _effects;
+ this.alpha = 1;
+ this.avelocity = '0 0 0';
+ this.velocity = '0 0 0';
+ this.effects = eff;
}
void vehicles_clearreturn(entity veh)
else
{
vehicles_setreturn(self);
- vehicles_reset_colors();
+ vehicles_reset_colors(self);
}
}
}
{
if(this.owner)
if(this.vehicle_flags & VHF_DEATHEJECT)
- WITH(entity, self, this, vehicles_exit(VHEF_EJECT));
+ WITHSELF(this, vehicles_exit(VHEF_EJECT));
else
- WITH(entity, self, this, vehicles_exit(VHEF_RELEASE));
+ WITHSELF(this, vehicles_exit(VHEF_RELEASE));
antilag_clear(this, this);
return false;
}
-void vehicles_impact(float _minspeed, float _speedfac, float _maxpain)
-{SELFPARAM();
+void vehicles_impact(entity this, float _minspeed, float _speedfac, float _maxpain)
+{
if (trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT)
return;
- if(self.play_time < time)
+ if(this.play_time < time)
{
- float wc = vlen(self.velocity - self.oldvelocity);
- //dprint("oldvel: ", vtos(self.oldvelocity), "\n");
- //dprint("vel: ", vtos(self.velocity), "\n");
+ float wc = vlen(this.velocity - this.oldvelocity);
+ //dprint("oldvel: ", vtos(this.oldvelocity), "\n");
+ //dprint("vel: ", vtos(this.velocity), "\n");
if(_minspeed < wc)
{
float take = min(_speedfac * wc, _maxpain);
- Damage (self, world, world, take, DEATH_FALL.m_id, self.origin, '0 0 0');
- self.play_time = time + 0.25;
+ Damage (this, world, world, take, DEATH_FALL.m_id, this.origin, '0 0 0');
+ this.play_time = time + 0.25;
//dprint("wc: ", ftos(wc), "\n");
//dprint("take: ", ftos(take), "\n");
_vehicle.vehicle_exit(eject);
vehicles_setreturn(_vehicle);
- vehicles_reset_colors();
+ vehicles_reset_colors(_vehicle);
_vehicle.owner = world;
CSQCMODEL_AUTOINIT(self);
}
void vehicles_enter(entity pl, entity veh)
-{SELFPARAM();
+{
+ SELFPARAM();
+ entity oldself = self;
+
// Remove this when bots know how to use vehicles
if((IS_BOT_CLIENT(pl) && !autocvar_g_vehicles_allow_bots))
return;
if(veh.vehicle_flags & VHF_MULTISLOT)
if(veh.owner)
{
- setself(veh);
- other = pl; // TODO: fix
-
if(!veh.gunner1)
if(time >= veh.gun1.phase)
if(veh.gun1.vehicle_enter)
- if(veh.gun1.vehicle_enter())
- {
- setself(this);
+ if(veh.gun1.vehicle_enter(veh, pl))
return;
- }
if(!veh.gunner2)
if(time >= veh.gun2.phase)
if(veh.gun2.vehicle_enter)
- if(veh.gun2.vehicle_enter())
- {
- setself(this);
+ if(veh.gun2.vehicle_enter(veh, pl))
return;
- }
-
- setself(this);
}
if(teamplay)
CSQCModel_UnlinkEntity(veh);
Vehicle info = Vehicles_from(veh.vehicleid);
info.vr_enter(info, veh);
- setself(this);
+ setself(oldself);
antilag_clear(pl, CS(pl));
}
FOREACH_CLIENT(IS_PLAYER(it) && it.hook.aiment == self, RemoveGrapplingHook(it));
- vehicles_reset_colors();
+ vehicles_reset_colors(self);
Vehicle info = Vehicles_from(self.vehicleid);
info.vr_spawn(info, self);
CSQCMODEL_AUTOINIT(self);
}
-bool vehicle_initialize(entity veh, bool nodrop)
-{SELFPARAM();
+bool vehicle_initialize(entity this, Vehicle info, bool nodrop)
+{
if(!autocvar_g_vehicles)
return false;
- if(!veh.vehicleid)
+ if(!info.vehicleid)
return false;
- if(!veh.tur_head) {
- Vehicle info = Vehicles_from(veh.vehicleid);
+ if(!this.tur_head)
info.vr_precache(info);
- }
- if(self.targetname && self.targetname != "")
+ if(this.targetname && this.targetname != "")
{
- self.vehicle_controller = find(world, target, self.targetname);
- if(!self.vehicle_controller)
+ this.vehicle_controller = find(world, target, this.targetname);
+ if(!this.vehicle_controller)
{
bprint("^1WARNING: ^7Vehicle with invalid .targetname\n");
- self.active = ACTIVE_ACTIVE;
+ this.active = ACTIVE_ACTIVE;
}
else
{
- self.team = self.vehicle_controller.team;
- self.use = vehicle_use;
+ this.team = this.vehicle_controller.team;
+ this.use = vehicle_use;
if(teamplay)
{
- if(self.vehicle_controller.team == 0)
- self.active = ACTIVE_NOT;
+ if(this.vehicle_controller.team == 0)
+ this.active = ACTIVE_NOT;
else
- self.active = ACTIVE_ACTIVE;
+ this.active = ACTIVE_ACTIVE;
}
}
}
- else { self.active = ACTIVE_ACTIVE; }
+ else { this.active = ACTIVE_ACTIVE; }
- if(self.team && (!teamplay || !autocvar_g_vehicles_teams))
- self.team = 0;
+ if(this.team && (!teamplay || !autocvar_g_vehicles_teams))
+ this.team = 0;
- if(self.mdl == "" || !self.mdl)
- _setmodel(self, veh.model);
+ if(this.mdl == "" || !this.mdl)
+ _setmodel(this, info.model);
else
- _setmodel(self, self.mdl);
-
- self.vehicle_flags |= VHF_ISVEHICLE;
-
- self.vehicle_viewport = new(vehicle_viewport);
- self.vehicle_hudmodel = new(vehicle_hudmodel);
- self.tur_head = new(tur_head);
- self.tur_head.owner = self;
- self.takedamage = DAMAGE_NO;
- self.bot_attack = true;
- self.iscreature = true;
- self.teleportable = false; // no teleporting for vehicles, too buggy
- self.damagedbycontents = true;
- self.vehicleid = veh.vehicleid;
- self.PlayerPhysplug = veh.PlayerPhysplug;
- self.event_damage = func_null;
- self.touch = vehicles_touch;
- self.think = vehicles_spawn;
- self.nextthink = time;
- self.effects = EF_NODRAW;
- self.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_SOLID;
+ _setmodel(this, this.mdl);
+
+ this.vehicle_flags |= VHF_ISVEHICLE;
+
+ this.vehicle_viewport = new(vehicle_viewport);
+ this.vehicle_hudmodel = new(vehicle_hudmodel);
+ this.tur_head = new(tur_head);
+ this.tur_head.owner = this;
+ this.takedamage = DAMAGE_NO;
+ this.bot_attack = true;
+ this.iscreature = true;
+ this.teleportable = false; // no teleporting for vehicles, too buggy
+ this.damagedbycontents = true;
+ this.vehicleid = info.vehicleid;
+ this.PlayerPhysplug = info.PlayerPhysplug;
+ this.event_damage = func_null;
+ this.touch = vehicles_touch;
+ this.think = vehicles_spawn;
+ this.nextthink = time;
+ this.effects = EF_NODRAW;
+ this.dphitcontentsmask = DPCONTENTS_BODY | DPCONTENTS_SOLID;
if(autocvar_g_playerclip_collisions)
- self.dphitcontentsmask |= DPCONTENTS_PLAYERCLIP;
+ this.dphitcontentsmask |= DPCONTENTS_PLAYERCLIP;
if(autocvar_g_nodepthtestplayers)
- self.effects |= EF_NODEPTHTEST;
+ this.effects |= EF_NODEPTHTEST;
if(autocvar_g_fullbrightplayers)
- self.effects |= EF_FULLBRIGHT;
+ this.effects |= EF_FULLBRIGHT;
- _setmodel(self.vehicle_hudmodel, veh.hud_model);
- setmodel(self.vehicle_viewport, MDL_Null);
+ _setmodel(this.vehicle_hudmodel, info.hud_model);
+ setmodel(this.vehicle_viewport, MDL_Null);
- if(veh.head_model != "")
+ if(info.head_model != "")
{
- _setmodel(self.tur_head, veh.head_model);
- setattachment(self.tur_head, self, veh.tag_head);
- setattachment(self.vehicle_hudmodel, self.tur_head, veh.tag_hud);
- setattachment(self.vehicle_viewport, self.vehicle_hudmodel, veh.tag_view);
+ _setmodel(this.tur_head, info.head_model);
+ setattachment(this.tur_head, this, info.tag_head);
+ setattachment(this.vehicle_hudmodel, this.tur_head, info.tag_hud);
+ setattachment(this.vehicle_viewport, this.vehicle_hudmodel, info.tag_view);
}
else
{
- setattachment(self.tur_head, self, "");
- setattachment(self.vehicle_hudmodel, self, veh.tag_hud);
- setattachment(self.vehicle_viewport, self.vehicle_hudmodel, veh.tag_view);
+ setattachment(this.tur_head, this, "");
+ setattachment(this.vehicle_hudmodel, this, info.tag_hud);
+ setattachment(this.vehicle_viewport, this.vehicle_hudmodel, info.tag_view);
}
- setsize(self, veh.mins, veh.maxs);
+ setsize(this, info.mins, info.maxs);
if(!nodrop)
{
- setorigin(self, self.origin);
- tracebox(self.origin + '0 0 100', veh.mins, veh.maxs, self.origin - '0 0 10000', MOVE_WORLDONLY, self);
- setorigin(self, trace_endpos);
+ setorigin(this, this.origin);
+ tracebox(this.origin + '0 0 100', info.mins, info.maxs, this.origin - '0 0 10000', MOVE_WORLDONLY, this);
+ setorigin(this, trace_endpos);
}
- self.pos1 = self.origin;
- self.pos2 = self.angles;
- self.tur_head.team = self.team;
+ this.pos1 = this.origin;
+ this.pos2 = this.angles;
+ this.tur_head.team = this.team;
- Vehicle info = Vehicles_from(veh.vehicleid);
- info.vr_setup(info, veh);
+ info.vr_setup(info, this);
- if(self.active == ACTIVE_NOT)
- self.nextthink = 0; // wait until activated
+ if(this.active == ACTIVE_NOT)
+ this.nextthink = 0; // wait until activated
else if(autocvar_g_vehicles_delayspawn)
- self.nextthink = time + self.respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter);
+ this.nextthink = time + this.respawntime + (random() * autocvar_g_vehicles_delayspawn_jitter);
else
- self.nextthink = time + game_starttime;
+ this.nextthink = time + game_starttime;
- if(MUTATOR_CALLHOOK(VehicleSpawn))
+ if(MUTATOR_CALLHOOK(VehicleSpawn, this))
return false;
return true;
#ifdef SVQC
#include <common/turrets/sv_turrets.qh>
+#include "vehicle.qh"
// vehicle cvars
bool autocvar_g_vehicles = true;
.bool(int _imp) vehicles_impulse;
.int vehicle_weapon2mode = _STAT(VEHICLESTAT_W2MODE);
.void(int exit_flags) vehicle_exit;
-.bool() vehicle_enter;
+.bool(entity this, entity player) vehicle_enter;
const int VHEF_NORMAL = 0; /// User pressed exit key
const int VHEF_EJECT = 1; /// User pressed exit key 3 times fast (not implemented) or vehile is dying
const int VHEF_RELEASE = 2; /// Release ownership, client possibly allready dissconnected / went spec / changed team / used "kill" (not implemented)
.float vehicle_enter_delay; // prevent players jumping to and from vehicles instantly
void vehicles_exit(float eject);
-float vehicle_initialize(entity vehicle, float nodrop);
+bool vehicle_initialize(entity this, Vehicle info, float nodrop);
bool vehicle_impulse(entity this, int imp);
bool vehicles_crushable(entity e);
--- /dev/null
+// generated file; do not modify
+#include "bumblebee.qc"
+#include "bumblebee_weapons.qc"
+#include "racer.qc"
+#include "racer_weapon.qc"
+#include "raptor.qc"
+#include "raptor_weapons.qc"
+#include "spiderbot.qc"
+#include "spiderbot_weapons.qc"
#define VEHICLE_BUMBLEBEE
#include "bumblebee.qh"
-#include "bumblebee_weapons.qc"
+#include "bumblebee_weapons.qh"
CLASS(Bumblebee, Vehicle)
/* spawnflags */ ATTRIB(Bumblebee, spawnflags, int, VHF_DMGSHAKE);
ENDCLASS(Bumblebee)
REGISTER_VEHICLE(BUMBLEBEE, NEW(Bumblebee));
+#ifndef MENUQC
+ MODEL(VEH_BUMBLEBEE_GUNCOCKPIT, "models/vehicles/wakizashi_cockpit.dpm");
+#endif
+
#endif
#ifdef IMPLEMENTATION
const float BRG_START = 4;
const float BRG_END = 8;
-#include "bumblebee_weapons.qc"
-
#ifdef SVQC
float autocvar_g_vehicle_bumblebee_respawntime = 60;
player.vehicle = world;
}
-bool bumblebee_gunner_enter()
-{SELFPARAM();
- entity vehic = self;
- entity player = other;
+bool bumblebee_gunner_enter(entity this, entity player)
+{
+ entity vehic = this;
entity gunner = world;
if(!vehic.gunner1 && !vehic.gunner2 && ((time >= vehic.gun1.phase) + (time >= vehic.gun2.phase)) == 2)
float phase_time = (time >= self.gun1.phase) + (time >= self.gun2.phase);
if(time >= other.vehicle_enter_delay && phase_time)
- if(bumblebee_gunner_enter())
+ if(bumblebee_gunner_enter(self, other))
return;
}
spawnfunc(vehicle_bumblebee)
{
- if(!autocvar_g_vehicle_bumblebee) { remove(self); return; }
- if(!vehicle_initialize(VEH_BUMBLEBEE, false)) { remove(self); return; }
+ if(!autocvar_g_vehicle_bumblebee) { remove(this); return; }
+ if(!vehicle_initialize(this, VEH_BUMBLEBEE, false)) { remove(this); return; }
}
METHOD(Bumblebee, vr_impact, void(Bumblebee thisveh, entity instance))
{
if(autocvar_g_vehicle_bumblebee_bouncepain)
- vehicles_impact(autocvar_g_vehicle_bumblebee_bouncepain_x, autocvar_g_vehicle_bumblebee_bouncepain_y, autocvar_g_vehicle_bumblebee_bouncepain_z);
+ vehicles_impact(instance, autocvar_g_vehicle_bumblebee_bouncepain_x, autocvar_g_vehicle_bumblebee_bouncepain_y, autocvar_g_vehicle_bumblebee_bouncepain_z);
}
METHOD(Bumblebee, vr_enter, void(Bumblebee thisveh, entity instance))
{
self.vehicle_exit(VHEF_EJECT);
fixedmakevectors(self.angles);
- vehicle_tossgib(self.gun1, self.velocity + v_right * 300 + v_up * 100 + randomvec() * 200, "cannon_right", rint(random()), rint(random()), 6, randomvec() * 200);
- vehicle_tossgib(self.gun2, self.velocity + v_right * -300 + v_up * 100 + randomvec() * 200, "cannon_left", rint(random()), rint(random()), 6, randomvec() * 200);
- vehicle_tossgib(self.gun3, self.velocity + v_forward * 300 + v_up * -100 + randomvec() * 200, "raygun", rint(random()), rint(random()), 6, randomvec() * 300);
+ vehicle_tossgib(instance, self.gun1, self.velocity + v_right * 300 + v_up * 100 + randomvec() * 200, "cannon_right", rint(random()), rint(random()), 6, randomvec() * 200);
+ vehicle_tossgib(instance, self.gun2, self.velocity + v_right * -300 + v_up * 100 + randomvec() * 200, "cannon_left", rint(random()), rint(random()), 6, randomvec() * 200);
+ vehicle_tossgib(instance, self.gun3, self.velocity + v_forward * 300 + v_up * -100 + randomvec() * 200, "raygun", rint(random()), rint(random()), 6, randomvec() * 300);
- entity _body = vehicle_tossgib(self, self.velocity + randomvec() * 200, "", rint(random()), rint(random()), 6, randomvec() * 100);
+ entity _body = vehicle_tossgib(instance, self, self.velocity + randomvec() * 200, "", rint(random()), rint(random()), 6, randomvec() * 100);
if(random() > 0.5)
_body.touch = bumblebee_blowup;
setorigin(self.gun3, ofs);
self.angles = self.gun3.pos1;
- vehicle_addplayerslot(self, self.gun1, HUD_BUMBLEBEE_GUN, "models/vehicles/wakizashi_cockpit.dpm", bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
- vehicle_addplayerslot(self, self.gun2, HUD_BUMBLEBEE_GUN, "models/vehicles/wakizashi_cockpit.dpm", bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
+ vehicle_addplayerslot(self, self.gun1, HUD_BUMBLEBEE_GUN, MDL_VEH_BUMBLEBEE_GUNCOCKPIT, bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
+ vehicle_addplayerslot(self, self.gun2, HUD_BUMBLEBEE_GUN, MDL_VEH_BUMBLEBEE_GUNCOCKPIT, bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
setorigin(self.vehicle_hudmodel, '50 0 -5'); // Move cockpit forward - down.
setorigin(self.vehicle_viewport, '5 0 2'); // Move camera forward up
}
METHOD(Bumblebee, vr_setup, void(Bumblebee thisveh, entity instance))
{
- SELFPARAM();
if(autocvar_g_vehicle_bumblebee_energy)
if(autocvar_g_vehicle_bumblebee_energy_regen)
- self.vehicle_flags |= VHF_ENERGYREGEN;
+ instance.vehicle_flags |= VHF_ENERGYREGEN;
if(autocvar_g_vehicle_bumblebee_shield)
- self.vehicle_flags |= VHF_HASSHIELD;
+ instance.vehicle_flags |= VHF_HASSHIELD;
if(autocvar_g_vehicle_bumblebee_shield_regen)
- self.vehicle_flags |= VHF_SHIELDREGEN;
+ instance.vehicle_flags |= VHF_SHIELDREGEN;
if(autocvar_g_vehicle_bumblebee_health_regen)
- self.vehicle_flags |= VHF_HEALTHREGEN;
+ instance.vehicle_flags |= VHF_HEALTHREGEN;
- self.vehicle_exit = bumblebee_exit;
- self.respawntime = autocvar_g_vehicle_bumblebee_respawntime;
- self.vehicle_health = autocvar_g_vehicle_bumblebee_health;
- self.max_health = self.vehicle_health;
- self.vehicle_shield = autocvar_g_vehicle_bumblebee_shield;
+ instance.vehicle_exit = bumblebee_exit;
+ instance.respawntime = autocvar_g_vehicle_bumblebee_respawntime;
+ instance.vehicle_health = autocvar_g_vehicle_bumblebee_health;
+ instance.max_health = instance.vehicle_health;
+ instance.vehicle_shield = autocvar_g_vehicle_bumblebee_shield;
}
#endif // SVQC
void CSQC_BUMBLE_GUN_HUD();
#endif
+#ifdef SVQC
+float raptor_altitude(float amax);
+#endif
+
#endif
-#ifndef VEHICLE_BUMBLEBEE_WEAPONS_H
-#define VEHICLE_BUMBLEBEE_WEAPONS_H
-
-#include <common/weapons/all.qh>
-
-#endif
+#include "bumblebee_weapons.qh"
#ifdef IMPLEMENTATION
#ifdef SVQC
-float autocvar_g_vehicle_bumblebee_cannon_cost = 2;
-float autocvar_g_vehicle_bumblebee_cannon_damage = 60;
-float autocvar_g_vehicle_bumblebee_cannon_radius = 225;
-float autocvar_g_vehicle_bumblebee_cannon_refire = 0.2;
-float autocvar_g_vehicle_bumblebee_cannon_speed = 20000;
-float autocvar_g_vehicle_bumblebee_cannon_spread = 0.02;
-float autocvar_g_vehicle_bumblebee_cannon_force = -35;
-
-bool bumble_raygun_send(entity this, entity to, int sf);
-
void bumblebee_fire_cannon(entity this, entity _gun, string _tagname, entity _owner)
{
vector v = gettaginfo(_gun, gettagindex(_gun, _tagname));
--- /dev/null
+#pragma once
+
+#include <common/weapons/all.qh>
+
+float autocvar_g_vehicle_bumblebee_cannon_cost = 2;
+float autocvar_g_vehicle_bumblebee_cannon_damage = 60;
+float autocvar_g_vehicle_bumblebee_cannon_radius = 225;
+float autocvar_g_vehicle_bumblebee_cannon_refire = 0.2;
+float autocvar_g_vehicle_bumblebee_cannon_speed = 20000;
+float autocvar_g_vehicle_bumblebee_cannon_spread = 0.02;
+float autocvar_g_vehicle_bumblebee_cannon_force = -35;
+
+#ifdef SVQC
+void bumblebee_fire_cannon(entity this, entity _gun, string _tagname, entity _owner);
+bool bumble_raygun_send(entity this, entity to, int sf);
+#endif
#ifndef VEHICLE_RACER
#define VEHICLE_RACER
-#include "racer_weapon.qc"
+#include "racer_weapon.qh"
CLASS(Racer, Vehicle)
/* spawnflags */ ATTRIB(Racer, spawnflags, int, VHF_DMGSHAKE | VHF_DMGROLL);
#ifdef IMPLEMENTATION
-#include "racer_weapon.qc"
-
#ifdef SVQC
#include <common/triggers/trigger/impulse.qh>
this.movement = vehic.velocity += df * PHYS_INPUT_TIMELENGTH;
#ifdef SVQC
+ setself(vehic);
+
Weapon wep1 = WEP_RACER;
if (!forbidWeaponUse(this))
if (PHYS_INPUT_BUTTON_ATCK(this))
wep1.wr_think(wep1, vehic, weaponentity, 1);
}
+ setself(this);
+
if(autocvar_g_vehicle_racer_rocket_locktarget)
{
vehicles_locktarget(vehic, (1 / autocvar_g_vehicle_racer_rocket_locking_time) * frametime,
spawnfunc(vehicle_racer)
{
- if(!autocvar_g_vehicle_racer) { remove(self); return; }
- if(!vehicle_initialize(VEH_RACER, false)) { remove(self); return; }
+ if(!autocvar_g_vehicle_racer) { remove(this); return; }
+ if(!vehicle_initialize(this, VEH_RACER, false)) { remove(this); return; }
}
#endif // SVQC
{
#ifdef SVQC
if(autocvar_g_vehicle_racer_bouncepain)
- vehicles_impact(autocvar_g_vehicle_racer_bouncepain_x, autocvar_g_vehicle_racer_bouncepain_y, autocvar_g_vehicle_racer_bouncepain_z);
+ vehicles_impact(instance, autocvar_g_vehicle_racer_bouncepain_x, autocvar_g_vehicle_racer_bouncepain_y, autocvar_g_vehicle_racer_bouncepain_z);
#endif
}
METHOD(Racer, vr_setup, void(Racer thisveh, entity instance))
{
#ifdef SVQC
- SELFPARAM();
- self.vehicle_exit = racer_exit;
-#endif
+ instance.vehicle_exit = racer_exit;
-#ifdef SVQC
// we have no need to network energy
if(autocvar_g_vehicle_racer_energy)
if(autocvar_g_vehicle_racer_energy_regen)
- self.vehicle_flags |= VHF_ENERGYREGEN;
+ instance.vehicle_flags |= VHF_ENERGYREGEN;
if(autocvar_g_vehicle_racer_shield)
- self.vehicle_flags |= VHF_HASSHIELD;
+ instance.vehicle_flags |= VHF_HASSHIELD;
if(autocvar_g_vehicle_racer_shield_regen)
- self.vehicle_flags |= VHF_SHIELDREGEN;
+ instance.vehicle_flags |= VHF_SHIELDREGEN;
if(autocvar_g_vehicle_racer_health_regen)
- self.vehicle_flags |= VHF_HEALTHREGEN;
+ instance.vehicle_flags |= VHF_HEALTHREGEN;
- self.respawntime = autocvar_g_vehicle_racer_respawntime;
- self.vehicle_health = autocvar_g_vehicle_racer_health;
- self.vehicle_shield = autocvar_g_vehicle_racer_shield;
- self.max_health = self.vehicle_health;
+ instance.respawntime = autocvar_g_vehicle_racer_respawntime;
+ instance.vehicle_health = autocvar_g_vehicle_racer_health;
+ instance.vehicle_shield = autocvar_g_vehicle_racer_shield;
+ instance.max_health = instance.vehicle_health;
#endif
#ifdef CSQC
-#ifndef VEHICLE_RACER_WEAPON_H
-#define VEHICLE_RACER_WEAPON_H
-
-#include <common/weapons/all.qh>
-
-CLASS(RacerAttack, PortoLaunch)
-/* flags */ ATTRIB(RacerAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(RacerAttack, impulse, int, 3);
-/* refname */ ATTRIB(RacerAttack, netname, string, "racercannon");
-/* wepname */ ATTRIB(RacerAttack, m_name, string, _("Racer cannon"));
-ENDCLASS(RacerAttack)
-REGISTER_WEAPON(RACER, NEW(RacerAttack));
-
-// TODO: move into implementation
-#ifdef SVQC
-void racer_fire_rocket(entity player, vector org, vector dir, entity trg);
-#endif
-
-#endif
+#include "racer_weapon.qh"
#ifdef IMPLEMENTATION
#ifdef SVQC
-float autocvar_g_vehicle_racer_cannon_cost = 2;
-float autocvar_g_vehicle_racer_cannon_damage = 15;
-float autocvar_g_vehicle_racer_cannon_radius = 100;
-float autocvar_g_vehicle_racer_cannon_refire = 0.05;
-float autocvar_g_vehicle_racer_cannon_speed = 15000;
-float autocvar_g_vehicle_racer_cannon_spread = 0.0125;
-float autocvar_g_vehicle_racer_cannon_force = 50;
-
-float autocvar_g_vehicle_racer_rocket_accel = 1600;
-float autocvar_g_vehicle_racer_rocket_damage = 100;
-float autocvar_g_vehicle_racer_rocket_radius = 125;
-float autocvar_g_vehicle_racer_rocket_force = 350;
-float autocvar_g_vehicle_racer_rocket_speed = 900;
-float autocvar_g_vehicle_racer_rocket_turnrate = 0.2;
-float autocvar_g_vehicle_racer_rocket_refire = 3;
-
-float autocvar_g_vehicle_racer_rocket_climbspeed = 1600;
-float autocvar_g_vehicle_racer_rocket_locked_maxangle = 1.8;
-
void racer_fire_rocket(entity player, vector org, vector dir, entity trg);
METHOD(RacerAttack, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire))
{
--- /dev/null
+#pragma once
+
+#include <common/weapons/all.qh>
+
+CLASS(RacerAttack, PortoLaunch)
+/* flags */ ATTRIB(RacerAttack, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(RacerAttack, impulse, int, 3);
+/* refname */ ATTRIB(RacerAttack, netname, string, "racercannon");
+/* wepname */ ATTRIB(RacerAttack, m_name, string, _("Racer cannon"));
+ENDCLASS(RacerAttack)
+REGISTER_WEAPON(RACER, NEW(RacerAttack));
+
+// TODO: move into implementation
+#ifdef SVQC
+void racer_fire_rocket(entity player, vector org, vector dir, entity trg);
+#endif
+
+float autocvar_g_vehicle_racer_cannon_cost = 2;
+float autocvar_g_vehicle_racer_cannon_damage = 15;
+float autocvar_g_vehicle_racer_cannon_radius = 100;
+float autocvar_g_vehicle_racer_cannon_refire = 0.05;
+float autocvar_g_vehicle_racer_cannon_speed = 15000;
+float autocvar_g_vehicle_racer_cannon_spread = 0.0125;
+float autocvar_g_vehicle_racer_cannon_force = 50;
+
+float autocvar_g_vehicle_racer_rocket_accel = 1600;
+float autocvar_g_vehicle_racer_rocket_damage = 100;
+float autocvar_g_vehicle_racer_rocket_radius = 125;
+float autocvar_g_vehicle_racer_rocket_force = 350;
+float autocvar_g_vehicle_racer_rocket_speed = 900;
+float autocvar_g_vehicle_racer_rocket_turnrate = 0.2;
+float autocvar_g_vehicle_racer_rocket_refire = 3;
+
+float autocvar_g_vehicle_racer_rocket_climbspeed = 1600;
+float autocvar_g_vehicle_racer_rocket_locked_maxangle = 1.8;
#define VEHICLE_RAPTOR
#include "raptor.qh"
-#include "raptor_weapons.qc"
+#include "raptor_weapons.qh"
CLASS(Raptor, Vehicle)
/* spawnflags */ ATTRIB(Raptor, spawnflags, int, VHF_DMGSHAKE | VHF_DMGROLL);
#ifdef IMPLEMENTATION
-#include "raptor_weapons.qc"
-
#ifdef SVQC
bool autocvar_g_vehicle_raptor = true;
if(IS_DEAD(vehic))
{
PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
- return 1;
+ return;
}
crosshair_trace(this);
UpdateAuxiliaryXhair(this, trace_endpos, '0 1 0', 0);
*/
+ // TODO: fix wr_checkammo and its use of self!
+ setself(vehic);
+
Weapon wep1 = WEP_RAPTOR;
if(!forbidWeaponUse(this))
if(PHYS_INPUT_BUTTON_ATCK(this))
}
}
+ setself(this);
+
vehic.bomb1.alpha = vehic.bomb2.alpha = (time - vehic.lip) / (vehic.delay - vehic.lip);
this.vehicle_reload2 = bound(0, vehic.bomb1.alpha * 100, 100);
this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0;
if(vehic.bomb1.cnt < time)
{
- entity _missile = findchainentity(enemy, vehic);
- float _incomming = 0;
- while(_missile)
+ bool incoming = false;
+ FOREACH_ENTITY_ENT(enemy, vehic,
{
- if(_missile.flags & FL_PROJECTILE)
- if(MISSILE_IS_TRACKING(_missile))
- if(vdist(vehic.origin - _missile.origin, <, 2 * autocvar_g_vehicle_raptor_flare_range))
- ++_incomming;
+ if(it.flags & FL_PROJECTILE)
+ if(MISSILE_IS_TRACKING(it))
+ if(vdist(vehic.origin - it.origin, <, 2 * autocvar_g_vehicle_raptor_flare_range))
+ {
+ incoming = true;
+ break;
+ }
+ });
- _missile = _missile.chain;
+ if(incoming)
+ {
+ msg_entity = this;
+ soundto(MSG_ONE, vehic, CH_PAIN_SINGLE, SND(VEH_MISSILE_ALARM), VOL_BASE, ATTEN_NONE);
}
- if(_incomming)
- sound(vehic, CH_PAIN_SINGLE, SND_VEH_MISSILE_ALARM, VOL_BASE, ATTEN_NONE);
-
vehic.bomb1.cnt = time + 1;
}
spawnfunc(vehicle_raptor)
{
- if(!autocvar_g_vehicle_raptor) { remove(self); return; }
- if(!vehicle_initialize(VEH_RAPTOR, false)) { remove(self); return; }
+ if(!autocvar_g_vehicle_raptor) { remove(this); return; }
+ if(!vehicle_initialize(this, VEH_RAPTOR, false)) { remove(this); return; }
}
METHOD(Raptor, vr_impact, void(Raptor thisveh, entity instance))
{
if(autocvar_g_vehicle_raptor_bouncepain)
- vehicles_impact(autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
+ vehicles_impact(instance, autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
}
METHOD(Raptor, vr_enter, void(Raptor thisveh, entity instance))
{
}
METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
{
- SELFPARAM();
if(autocvar_g_vehicle_raptor_shield)
- self.vehicle_flags |= VHF_HASSHIELD;
+ instance.vehicle_flags |= VHF_HASSHIELD;
if(autocvar_g_vehicle_raptor_shield_regen)
- self.vehicle_flags |= VHF_SHIELDREGEN;
+ instance.vehicle_flags |= VHF_SHIELDREGEN;
if(autocvar_g_vehicle_raptor_health_regen)
- self.vehicle_flags |= VHF_HEALTHREGEN;
+ instance.vehicle_flags |= VHF_HEALTHREGEN;
if(autocvar_g_vehicle_raptor_energy_regen)
- self.vehicle_flags |= VHF_ENERGYREGEN;
+ instance.vehicle_flags |= VHF_ENERGYREGEN;
- self.vehicle_exit = raptor_exit;
- self.respawntime = autocvar_g_vehicle_raptor_respawntime;
- self.vehicle_health = autocvar_g_vehicle_raptor_health;
- self.vehicle_shield = autocvar_g_vehicle_raptor_shield;
- self.max_health = self.vehicle_health;
+ instance.vehicle_exit = raptor_exit;
+ instance.respawntime = autocvar_g_vehicle_raptor_respawntime;
+ instance.vehicle_health = autocvar_g_vehicle_raptor_health;
+ instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
+ instance.max_health = instance.vehicle_health;
}
#endif
-#ifndef VEHICLE_RAPTOR_WEAPONS_H
-#define VEHICLE_RAPTOR_WEAPONS_H
-
-#include <common/weapons/all.qh>
-
-CLASS(RaptorCannon, PortoLaunch)
-/* flags */ ATTRIB(RaptorCannon, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(RaptorCannon, impulse, int, 3);
-/* refname */ ATTRIB(RaptorCannon, netname, string, "raptorcannon");
-/* wepname */ ATTRIB(RaptorCannon, m_name, string, _("Raptor cannon"));
-ENDCLASS(RaptorCannon)
-REGISTER_WEAPON(RAPTOR, NEW(RaptorCannon));
-
-CLASS(RaptorBomb, PortoLaunch)
-/* flags */ ATTRIB(RaptorBomb, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(RaptorBomb, impulse, int, 3);
-/* refname */ ATTRIB(RaptorBomb, netname, string, "raptorbomb");
-/* wepname */ ATTRIB(RaptorBomb, m_name, string, _("Raptor bomb"));
-ENDCLASS(RaptorBomb)
-REGISTER_WEAPON(RAPTOR_BOMB, NEW(RaptorBomb));
-
-CLASS(RaptorFlare, PortoLaunch)
-/* flags */ ATTRIB(RaptorFlare, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
-/* impulse */ ATTRIB(RaptorFlare, impulse, int, 3);
-/* refname */ ATTRIB(RaptorFlare, netname, string, "raptorflare");
-/* wepname */ ATTRIB(RaptorFlare, m_name, string, _("Raptor flare"));
-ENDCLASS(RaptorFlare)
-REGISTER_WEAPON(RAPTOR_FLARE, NEW(RaptorFlare));
-
-#endif
+#include "raptor_weapons.qh"
#ifdef IMPLEMENTATION
#ifdef SVQC
-float autocvar_g_vehicle_raptor_cannon_cost = 1;
-float autocvar_g_vehicle_raptor_cannon_damage = 10;
-float autocvar_g_vehicle_raptor_cannon_radius = 60;
-float autocvar_g_vehicle_raptor_cannon_refire = 0.03;
-float autocvar_g_vehicle_raptor_cannon_speed = 24000;
-float autocvar_g_vehicle_raptor_cannon_spread = 0.01;
-float autocvar_g_vehicle_raptor_cannon_force = 25;
-
-float autocvar_g_vehicle_raptor_bomblets = 8;
-float autocvar_g_vehicle_raptor_bomblet_alt = 750;
-float autocvar_g_vehicle_raptor_bomblet_time = 0.5;
-float autocvar_g_vehicle_raptor_bomblet_damage = 55;
-float autocvar_g_vehicle_raptor_bomblet_spread = 0.4;
-float autocvar_g_vehicle_raptor_bomblet_edgedamage = 25;
-float autocvar_g_vehicle_raptor_bomblet_radius = 350;
-float autocvar_g_vehicle_raptor_bomblet_force = 150;
-float autocvar_g_vehicle_raptor_bomblet_explode_delay = 0.4;
-
METHOD(RaptorCannon, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) {
bool isPlayer = IS_PLAYER(actor);
entity player = isPlayer ? actor : actor.owner;
return isPlayer || veh.vehicle_energy >= autocvar_g_vehicle_raptor_cannon_cost;
}
-float autocvar_g_vehicle_raptor_bombs_refire = 5;
void raptor_bombdrop();
METHOD(RaptorBomb, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) {
}
}
-float autocvar_g_vehicle_raptor_flare_refire = 5;
-float autocvar_g_vehicle_raptor_flare_lifetime = 10;
-float autocvar_g_vehicle_raptor_flare_chase = 0.9;
-float autocvar_g_vehicle_raptor_flare_range = 2000;
-
void raptor_flare_think();
void raptor_flare_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force);
void raptor_flare_touch();
--- /dev/null
+#pragma once
+
+#include <common/weapons/all.qh>
+
+CLASS(RaptorCannon, PortoLaunch)
+/* flags */ ATTRIB(RaptorCannon, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(RaptorCannon, impulse, int, 3);
+/* refname */ ATTRIB(RaptorCannon, netname, string, "raptorcannon");
+/* wepname */ ATTRIB(RaptorCannon, m_name, string, _("Raptor cannon"));
+ENDCLASS(RaptorCannon)
+REGISTER_WEAPON(RAPTOR, NEW(RaptorCannon));
+
+CLASS(RaptorBomb, PortoLaunch)
+/* flags */ ATTRIB(RaptorBomb, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(RaptorBomb, impulse, int, 3);
+/* refname */ ATTRIB(RaptorBomb, netname, string, "raptorbomb");
+/* wepname */ ATTRIB(RaptorBomb, m_name, string, _("Raptor bomb"));
+ENDCLASS(RaptorBomb)
+REGISTER_WEAPON(RAPTOR_BOMB, NEW(RaptorBomb));
+
+CLASS(RaptorFlare, PortoLaunch)
+/* flags */ ATTRIB(RaptorFlare, spawnflags, int, WEP_TYPE_OTHER | WEP_FLAG_HIDDEN | WEP_FLAG_MUTATORBLOCKED);
+/* impulse */ ATTRIB(RaptorFlare, impulse, int, 3);
+/* refname */ ATTRIB(RaptorFlare, netname, string, "raptorflare");
+/* wepname */ ATTRIB(RaptorFlare, m_name, string, _("Raptor flare"));
+ENDCLASS(RaptorFlare)
+REGISTER_WEAPON(RAPTOR_FLARE, NEW(RaptorFlare));
+
+
+float autocvar_g_vehicle_raptor_cannon_cost = 1;
+float autocvar_g_vehicle_raptor_cannon_damage = 10;
+float autocvar_g_vehicle_raptor_cannon_radius = 60;
+float autocvar_g_vehicle_raptor_cannon_refire = 0.03;
+float autocvar_g_vehicle_raptor_cannon_speed = 24000;
+float autocvar_g_vehicle_raptor_cannon_spread = 0.01;
+float autocvar_g_vehicle_raptor_cannon_force = 25;
+
+float autocvar_g_vehicle_raptor_bomblets = 8;
+float autocvar_g_vehicle_raptor_bomblet_alt = 750;
+float autocvar_g_vehicle_raptor_bomblet_time = 0.5;
+float autocvar_g_vehicle_raptor_bomblet_damage = 55;
+float autocvar_g_vehicle_raptor_bomblet_spread = 0.4;
+float autocvar_g_vehicle_raptor_bomblet_edgedamage = 25;
+float autocvar_g_vehicle_raptor_bomblet_radius = 350;
+float autocvar_g_vehicle_raptor_bomblet_force = 150;
+float autocvar_g_vehicle_raptor_bomblet_explode_delay = 0.4;
+
+float autocvar_g_vehicle_raptor_bombs_refire = 5;
+
+float autocvar_g_vehicle_raptor_flare_refire = 5;
+float autocvar_g_vehicle_raptor_flare_lifetime = 10;
+float autocvar_g_vehicle_raptor_flare_chase = 0.9;
+float autocvar_g_vehicle_raptor_flare_range = 2000;
#ifndef VEHICLE_SPIDERBOT
#define VEHICLE_SPIDERBOT
-#include "spiderbot_weapons.qc"
+#include "spiderbot_weapons.qh"
CLASS(Spiderbot, Vehicle)
/* spawnflags */ ATTRIB(Spiderbot, spawnflags, int, VHF_DMGSHAKE);
const int SBRM_ARTILLERY = 3;
const int SBRM_LAST = 3;
-#include "spiderbot_weapons.qc"
-
#ifdef SVQC
bool autocvar_g_vehicle_spiderbot = true;
if(intermission_running)
{
- self.vehicle.velocity = '0 0 0';
- self.vehicle.avelocity = '0 0 0';
+ vehic.velocity = '0 0 0';
+ vehic.avelocity = '0 0 0';
return;
}
//fixedmakevectors(vehic.angles);
makevectors(vehic.angles + '-2 0 0' * vehic.angles_x);
- WITH(entity, self, vehic, movelib_groundalign4point(autocvar_g_vehicle_spiderbot_springlength, autocvar_g_vehicle_spiderbot_springup, autocvar_g_vehicle_spiderbot_springblend, autocvar_g_vehicle_spiderbot_tiltlimit));
+ movelib_groundalign4point(vehic, autocvar_g_vehicle_spiderbot_springlength, autocvar_g_vehicle_spiderbot_springup, autocvar_g_vehicle_spiderbot_springblend, autocvar_g_vehicle_spiderbot_tiltlimit);
if(IS_ONGROUND(vehic))
vehic.jump_delay = time; // reset now so movement can begin
v_forward = normalize(v_forward);
v += v_forward * 50;
- WITH(entity, self, this, fireBullet(v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_solidpenetration,
- autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN.m_id, 0));
+ fireBullet(this, v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_solidpenetration,
+ autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN.m_id, 0);
sound (gun, CH_WEAPON_A, SND_UZI_FIRE, VOL_BASE, ATTEN_NORM);
//trailparticles(self, _particleeffectnum("spiderbot_minigun_trail"), v, trace_endpos);
autocvar_g_vehicle_spiderbot_minigun_ammo_regen, frametime, false);
- WITH(entity, self, vehic, spiderbot_rocket_do());
+ spiderbot_rocket_do(vehic);
if(vehic.vehicle_flags & VHF_SHIELDREGEN)
vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_spiderbot_shield, autocvar_g_vehicle_spiderbot_shield_regen_pause, autocvar_g_vehicle_spiderbot_shield_regen, frametime, true);
spawnfunc(vehicle_spiderbot)
{
- if(!autocvar_g_vehicle_spiderbot) { remove(self); return; }
- if(!vehicle_initialize(VEH_SPIDERBOT, false)) { remove(self); return; }
+ if(!autocvar_g_vehicle_spiderbot) { remove(this); return; }
+ if(!vehicle_initialize(this, VEH_SPIDERBOT, false)) { remove(this); return; }
}
METHOD(Spiderbot, vr_impact, void(Spiderbot thisveh, entity instance))
{
if(autocvar_g_vehicle_spiderbot_bouncepain)
- vehicles_impact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
+ vehicles_impact(instance, autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
}
METHOD(Spiderbot, vr_enter, void(Spiderbot thisveh, entity instance))
{
}
METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
{
- SELFPARAM();
if(autocvar_g_vehicle_spiderbot_shield)
- self.vehicle_flags |= VHF_HASSHIELD;
+ instance.vehicle_flags |= VHF_HASSHIELD;
if(autocvar_g_vehicle_spiderbot_shield_regen)
- self.vehicle_flags |= VHF_SHIELDREGEN;
+ instance.vehicle_flags |= VHF_SHIELDREGEN;
if(autocvar_g_vehicle_spiderbot_health_regen)
- self.vehicle_flags |= VHF_HEALTHREGEN;
+ instance.vehicle_flags |= VHF_HEALTHREGEN;
- self.respawntime = autocvar_g_vehicle_spiderbot_respawntime;
- self.vehicle_health = autocvar_g_vehicle_spiderbot_health;
- self.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
- self.max_health = self.vehicle_health;
- self.pushable = true; // spiderbot can use jumppads
+ instance.respawntime = autocvar_g_vehicle_spiderbot_respawntime;
+ instance.vehicle_health = autocvar_g_vehicle_spiderbot_health;
+ instance.vehicle_shield = autocvar_g_vehicle_spiderbot_shield;
+ instance.max_health = instance.vehicle_health;
+ instance.pushable = true; // spiderbot can use jumppads
}
#endif // SVQC
-#ifndef VEHICLE_SPIDERBOT_WEAPONS_H
-#define VEHICLE_SPIDERBOT_WEAPONS_H
-
-#include <common/weapons/all.qh>
-
-#endif
+#include "spiderbot_weapons.qh"
#ifdef IMPLEMENTATION
#ifdef SVQC
-// 400 (x2) DPS
-float autocvar_g_vehicle_spiderbot_minigun_damage = 24;
-float autocvar_g_vehicle_spiderbot_minigun_refire = 0.06;
-float autocvar_g_vehicle_spiderbot_minigun_spread = 0.015;
-int autocvar_g_vehicle_spiderbot_minigun_ammo_cost = 1;
-int autocvar_g_vehicle_spiderbot_minigun_ammo_max = 100;
-int autocvar_g_vehicle_spiderbot_minigun_ammo_regen = 40;
-float autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause = 1;
-float autocvar_g_vehicle_spiderbot_minigun_force = 9;
-float autocvar_g_vehicle_spiderbot_minigun_solidpenetration = 32;
-
-float autocvar_g_vehicle_spiderbot_rocket_damage = 50;
-float autocvar_g_vehicle_spiderbot_rocket_force = 150;
-float autocvar_g_vehicle_spiderbot_rocket_radius = 250;
-float autocvar_g_vehicle_spiderbot_rocket_speed = 3500;
-float autocvar_g_vehicle_spiderbot_rocket_spread = 0.05;
-float autocvar_g_vehicle_spiderbot_rocket_refire = 0.1;
-// volley
-float autocvar_g_vehicle_spiderbot_rocket_refire2 = 0.025;
-float autocvar_g_vehicle_spiderbot_rocket_reload = 4;
-float autocvar_g_vehicle_spiderbot_rocket_health = 100;
-float autocvar_g_vehicle_spiderbot_rocket_noise = 0.2;
-float autocvar_g_vehicle_spiderbot_rocket_turnrate = 0.25;
-float autocvar_g_vehicle_spiderbot_rocket_lifetime = 20;
-
void spiderbot_rocket_artillery()
{SELFPARAM();
self.nextthink = time;
self.use();
}
-void spiderbot_guide_release()
-{SELFPARAM();
+void spiderbot_guide_release(entity this)
+{
entity rkt;
- rkt = findchainentity(realowner, self.owner);
+ rkt = findchainentity(realowner, this.owner);
if(!rkt)
return;
- crosshair_trace(self.owner);
+ crosshair_trace(this.owner);
while(rkt)
{
if(rkt.think == spiderbot_rocket_guided)
return sdir * vs + '0 0 1' * vz;
}
-void spiderbot_rocket_do()
-{SELFPARAM();
+void spiderbot_rocket_do(entity this)
+{;
vector v;
entity rocket = world;
- if (self.wait != -10)
+ if (this.wait != -10)
{
- if (PHYS_INPUT_BUTTON_ATCK2(self.owner) && self.vehicle_weapon2mode == SBRM_GUIDE)
+ if (PHYS_INPUT_BUTTON_ATCK2(this.owner) && this.vehicle_weapon2mode == SBRM_GUIDE)
{
- if (self.wait == 1)
- if (self.tur_head.frame == 9 || self.tur_head.frame == 1)
+ if (this.wait == 1)
+ if (this.tur_head.frame == 9 || this.tur_head.frame == 1)
{
- if(self.gun2.cnt < time && self.tur_head.frame == 9)
- self.tur_head.frame = 1;
+ if(this.gun2.cnt < time && this.tur_head.frame == 9)
+ this.tur_head.frame = 1;
return;
}
- self.wait = 1;
+ this.wait = 1;
}
else
{
- if(self.wait)
- spiderbot_guide_release();
+ if(this.wait)
+ spiderbot_guide_release(this);
- self.wait = 0;
+ this.wait = 0;
}
}
- if(self.gun2.cnt > time)
+ if(this.gun2.cnt > time)
return;
- if (self.tur_head.frame >= 9)
+ if (this.tur_head.frame >= 9)
{
- self.tur_head.frame = 1;
- self.wait = 0;
+ this.tur_head.frame = 1;
+ this.wait = 0;
}
- if(self.wait != -10)
- if(!PHYS_INPUT_BUTTON_ATCK2(self.owner))
+ if(this.wait != -10)
+ if(!PHYS_INPUT_BUTTON_ATCK2(this.owner))
return;
- if(forbidWeaponUse(self.owner))
+ if(forbidWeaponUse(this.owner))
return;
- v = gettaginfo(self.tur_head,gettagindex(self.tur_head,"tag_fire"));
+ v = gettaginfo(this.tur_head,gettagindex(this.tur_head,"tag_fire"));
- switch(self.vehicle_weapon2mode)
+ switch(this.vehicle_weapon2mode)
{
case SBRM_VOLLY:
- rocket = vehicles_projectile(self, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
+ rocket = vehicles_projectile(this, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
v, normalize(randomvec() * autocvar_g_vehicle_spiderbot_rocket_spread + v_forward) * autocvar_g_vehicle_spiderbot_rocket_speed,
autocvar_g_vehicle_spiderbot_rocket_damage, autocvar_g_vehicle_spiderbot_rocket_radius, autocvar_g_vehicle_spiderbot_rocket_force, 1,
- DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, self.owner);
- crosshair_trace(self.owner);
+ DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, this.owner);
+ crosshair_trace(this.owner);
float _dist = (random() * autocvar_g_vehicle_spiderbot_rocket_radius) + vlen(v - trace_endpos);
_dist -= (random() * autocvar_g_vehicle_spiderbot_rocket_radius) ;
rocket.nextthink = time + (_dist / autocvar_g_vehicle_spiderbot_rocket_speed);
rocket.think = vehicles_projectile_explode;
- if(PHYS_INPUT_BUTTON_ATCK2(self.owner) && self.tur_head.frame == 1)
- self.wait = -10;
+ if(PHYS_INPUT_BUTTON_ATCK2(this.owner) && this.tur_head.frame == 1)
+ this.wait = -10;
break;
case SBRM_GUIDE:
- rocket = vehicles_projectile(self, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
+ rocket = vehicles_projectile(this, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
v, normalize(v_forward) * autocvar_g_vehicle_spiderbot_rocket_speed,
autocvar_g_vehicle_spiderbot_rocket_damage, autocvar_g_vehicle_spiderbot_rocket_radius, autocvar_g_vehicle_spiderbot_rocket_force, 1,
- DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, false, self.owner);
- crosshair_trace(self.owner);
+ DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, false, this.owner);
+ crosshair_trace(this.owner);
rocket.pos1 = trace_endpos;
rocket.nextthink = time;
rocket.think = spiderbot_rocket_guided;
break;
case SBRM_ARTILLERY:
- rocket = vehicles_projectile(self, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
+ rocket = vehicles_projectile(this, EFFECT_SPIDERBOT_ROCKETLAUNCH.eent_eff_name, SND_ROCKET_FIRE,
v, normalize(v_forward) * autocvar_g_vehicle_spiderbot_rocket_speed,
autocvar_g_vehicle_spiderbot_rocket_damage, autocvar_g_vehicle_spiderbot_rocket_radius, autocvar_g_vehicle_spiderbot_rocket_force, 1,
- DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, self.owner);
+ DEATH_VH_SPID_ROCKET.m_id, PROJECTILE_SPIDERROCKET, autocvar_g_vehicle_spiderbot_rocket_health, false, true, this.owner);
- crosshair_trace(self.owner);
+ crosshair_trace(this.owner);
rocket.pos1 = trace_endpos + randomvec() * (0.75 * autocvar_g_vehicle_spiderbot_rocket_radius);
rocket.pos1_z = trace_endpos_z;
- traceline(v, v + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, self);
+ traceline(v, v + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, this);
float h1 = 0.75 * vlen(v - trace_endpos);
//v = trace_endpos;
- traceline(v , rocket.pos1 + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, self);
+ traceline(v , rocket.pos1 + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, this);
float h2 = 0.75 * vlen(rocket.pos1 - v);
rocket.velocity = spiberbot_calcartillery(v, rocket.pos1, ((h1 < h2) ? h1 : h2));
rocket.cnt = time + autocvar_g_vehicle_spiderbot_rocket_lifetime;
- self.tur_head.frame += 1;
- if (self.tur_head.frame == 9)
- self.attack_finished_single[0] = autocvar_g_vehicle_spiderbot_rocket_reload;
+ this.tur_head.frame += 1;
+ if (this.tur_head.frame == 9)
+ this.attack_finished_single[0] = autocvar_g_vehicle_spiderbot_rocket_reload;
else
- self.attack_finished_single[0] = ((self.vehicle_weapon2mode == SBRM_VOLLY) ? autocvar_g_vehicle_spiderbot_rocket_refire2 : autocvar_g_vehicle_spiderbot_rocket_refire);
+ this.attack_finished_single[0] = ((this.vehicle_weapon2mode == SBRM_VOLLY) ? autocvar_g_vehicle_spiderbot_rocket_refire2 : autocvar_g_vehicle_spiderbot_rocket_refire);
- self.gun2.cnt = time + self.attack_finished_single[0];
+ this.gun2.cnt = time + this.attack_finished_single[0];
}
#endif
--- /dev/null
+#pragma once
+
+#include <common/weapons/all.qh>
+
+#ifdef SVQC
+void spiderbot_rocket_do(entity this);
+#endif
+
+// 400 (x2) DPS
+float autocvar_g_vehicle_spiderbot_minigun_damage = 24;
+float autocvar_g_vehicle_spiderbot_minigun_refire = 0.06;
+float autocvar_g_vehicle_spiderbot_minigun_spread = 0.015;
+int autocvar_g_vehicle_spiderbot_minigun_ammo_cost = 1;
+int autocvar_g_vehicle_spiderbot_minigun_ammo_max = 100;
+int autocvar_g_vehicle_spiderbot_minigun_ammo_regen = 40;
+float autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause = 1;
+float autocvar_g_vehicle_spiderbot_minigun_force = 9;
+float autocvar_g_vehicle_spiderbot_minigun_solidpenetration = 32;
+
+float autocvar_g_vehicle_spiderbot_rocket_damage = 50;
+float autocvar_g_vehicle_spiderbot_rocket_force = 150;
+float autocvar_g_vehicle_spiderbot_rocket_radius = 250;
+float autocvar_g_vehicle_spiderbot_rocket_speed = 3500;
+float autocvar_g_vehicle_spiderbot_rocket_spread = 0.05;
+float autocvar_g_vehicle_spiderbot_rocket_refire = 0.1;
+// volley
+float autocvar_g_vehicle_spiderbot_rocket_refire2 = 0.025;
+float autocvar_g_vehicle_spiderbot_rocket_reload = 4;
+float autocvar_g_vehicle_spiderbot_rocket_health = 100;
+float autocvar_g_vehicle_spiderbot_rocket_noise = 0.2;
+float autocvar_g_vehicle_spiderbot_rocket_turnrate = 0.25;
+float autocvar_g_vehicle_spiderbot_rocket_lifetime = 20;
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
+#include "calculations.qc"
+#include "config.qc"
{
SELFPARAM();
entity e = W_PROP_reloader = new_pure(W_PROP_reloader);
- WITH(entity, self, e, (e.think = W_PROP_think)());
+ WITHSELF(e, (e.think = W_PROP_think)());
}
#endif
#include <common/items/item/pickup.qh>
#include <common/stats.qh>
+#ifdef SVQC
+#include <common/effects/qc/all.qh>
+#endif
+
const int MAX_WEAPONSLOTS = 2;
.entity weaponentities[MAX_WEAPONSLOTS];
--- /dev/null
+// generated file; do not modify
+#include "arc.qc"
+#include "blaster.qc"
+#include "crylink.qc"
+#include "devastator.qc"
+#include "electro.qc"
+#include "fireball.qc"
+#include "hagar.qc"
+#include "hlac.qc"
+#include "hook.qc"
+#include "machinegun.qc"
+#include "minelayer.qc"
+#include "mortar.qc"
+#include "porto.qc"
+#include "rifle.qc"
+#include "seeker.qc"
+#include "shockwave.qc"
+#include "shotgun.qc"
+#include "tuba.qc"
+#include "vaporizer.qc"
+#include "vortex.qc"
this.angles = vectoangles(this.velocity);
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.think));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.think));
}
void W_Arc_Bolt_Touch()
beam.beam_bursting = burst;
Net_LinkEntity(beam, false, 0, W_Arc_Beam_Send);
- WITH(entity, self, beam, beam.think());
+ WITHSELF(beam, beam.think());
}
void Arc_Smoke()
if (time >= missile.nextthink)
{
- WITH(entity, self, missile, missile.think());
+ WITHSELF(missile, missile.think());
}
}
this.angles = vectoangles(this.velocity);
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_Devastator_Explode));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_Devastator_Explode));
}
void W_Devastator_Attack(Weapon thiswep)
if(this.health <= 0)
{
this.cnt = 1;
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_Fireball_Explode));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_Fireball_Explode));
}
}
this.angles = vectoangles(this.velocity);
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.think));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.think));
}
void W_Hagar_Touch()
this.health = this.health - damage;
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(this.realowner, W_Hook_Explode2));
+ WITHSELF(this, W_PrepareExplosionByDamage(this.realowner, W_Hook_Explode2));
}
void W_Hook_Touch2()
{
if (actor.hook)
RemoveGrapplingHook(actor);
- WITH(entity, self, actor, FireGrapplingHook());
+ WITHSELF(actor, FireGrapplingHook());
actor.hook_state &= ~HOOK_FIRING;
actor.hook_refire = max(actor.hook_refire, time + autocvar_g_balance_grapplehook_refire * W_WeaponRateFactor());
}
void Remove_GrapplingHook(entity this)
{
sound (this, CH_SHOTS_SINGLE, SND_Null, VOL_BASE, ATTEN_NORM);
+
+ if(csqcplayer && csqcplayer.hook == this)
+ csqcplayer.hook = NULL;
}
NET_HANDLE(ENT_CLIENT_HOOK, bool bIsNew)
int myowner = ReadByte();
self.owner = playerslots[myowner - 1];
self.sv_entnum = myowner;
+ if(csqcplayer && myowner == player_localentnum)
+ csqcplayer.hook = self;
switch(self.HookType)
{
default:
ATTACK_FINISHED(self, slot) = time + WEP_CVAR(machinegun, first_refire) * W_WeaponRateFactor();
if(self.misc_bulletcounter == 1)
- fireBullet(w_shotorg, w_shotdir, WEP_CVAR(machinegun, first_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, first_damage), WEP_CVAR(machinegun, first_force), deathtype, 0);
+ fireBullet(self, w_shotorg, w_shotdir, WEP_CVAR(machinegun, first_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, first_damage), WEP_CVAR(machinegun, first_force), deathtype, 0);
else
- fireBullet(w_shotorg, w_shotdir, WEP_CVAR(machinegun, sustained_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), deathtype, 0);
+ fireBullet(self, w_shotorg, w_shotdir, WEP_CVAR(machinegun, sustained_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), deathtype, 0);
Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
}
machinegun_spread = bound(WEP_CVAR(machinegun, spread_min), WEP_CVAR(machinegun, spread_min) + (WEP_CVAR(machinegun, spread_add) * actor.misc_bulletcounter), WEP_CVAR(machinegun, spread_max));
- fireBullet(w_shotorg, w_shotdir, machinegun_spread, WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN.m_id, 0);
+ fireBullet(actor, w_shotorg, w_shotdir, machinegun_spread, WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN.m_id, 0);
actor.misc_bulletcounter = actor.misc_bulletcounter + 1;
actor.punchangle_y = random() - 0.5;
}
- fireBullet(w_shotorg, w_shotdir, WEP_CVAR(machinegun, burst_speed), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN.m_id, 0);
+ fireBullet(actor, w_shotorg, w_shotdir, WEP_CVAR(machinegun, burst_speed), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), WEP_MACHINEGUN.m_id, 0);
Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
this.angles = vectoangles(this.velocity);
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_MineLayer_Explode));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_MineLayer_Explode));
}
void W_MineLayer_Attack(Weapon thiswep)
this.health = this.health - damage;
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, this.use));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, this.use));
}
void W_Mortar_Grenade_Think1()
{SELFPARAM();
if(p.porto_current.realowner == p && p.porto_current.classname == "porto")
{
- WITH(entity, self, p.porto_current, W_Porto_Fail(1));
+ WITHSELF(p.porto_current, W_Porto_Fail(1));
}
}
}
for(i = 0; i < pShots; ++i)
- fireBullet(w_shotorg, w_shotdir, pSpread, pSolidPenetration, pDamage, pForce, deathtype, (pTracer ? EF_RED : EF_BLUE));
+ fireBullet(self, w_shotorg, w_shotdir, pSpread, pSolidPenetration, pDamage, pForce, deathtype, (pTracer ? EF_RED : EF_BLUE));
if(autocvar_g_casings >= 2)
SpawnCasing(((random() * 50 + 50) * v_right) - (v_forward * (random() * 25 + 25)) - ((random() * 5 - 70) * v_up), 2, vectoangles(v_forward),'0 250 0', 100, 3, self);
this.health = this.health - damage;
if(this.health <= 0)
- WITH(entity, self, this, W_PrepareExplosionByDamage(attacker, W_Seeker_Missile_Explode));
+ WITHSELF(this, W_PrepareExplosionByDamage(attacker, W_Seeker_Missile_Explode));
}
/*
W_SetupShot(self, true, 5, SND_SHOTGUN_FIRE, ((isprimary) ? CH_WEAPON_A : CH_WEAPON_SINGLE), WEP_CVAR_PRI(shotgun, damage) * WEP_CVAR_PRI(shotgun, bullets));
for(sc = 0;sc < WEP_CVAR_PRI(shotgun, bullets);sc = sc + 1)
- fireBullet(w_shotorg, w_shotdir, WEP_CVAR_PRI(shotgun, spread), WEP_CVAR_PRI(shotgun, solidpenetration), WEP_CVAR_PRI(shotgun, damage), WEP_CVAR_PRI(shotgun, force), WEP_SHOTGUN.m_id, 0);
+ fireBullet(self, w_shotorg, w_shotdir, WEP_CVAR_PRI(shotgun, spread), WEP_CVAR_PRI(shotgun, solidpenetration), WEP_CVAR_PRI(shotgun, damage), WEP_CVAR_PRI(shotgun, force), WEP_SHOTGUN.m_id, 0);
Send_Effect(EFFECT_SHOTGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, WEP_CVAR_PRI(shotgun, ammo));
MUTATOR_HOOKFUNCTION(vortex_charge, GetPressedKeys)
{SELFPARAM();
// WEAPONTODO
- float xyspeed = vlen(vec2(self.velocity));
- if (PS(self).m_weapon == WEP_VORTEX && WEP_CVAR(vortex, charge) && WEP_CVAR(vortex, charge_velocity_rate) && xyspeed > WEP_CVAR(vortex, charge_minspeed))
+ float xyspeed = vlen(vec2(this.velocity));
+ if (PS(this).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));
float f = (xyspeed - WEP_CVAR(vortex, charge_minspeed)) / (WEP_CVAR(vortex, charge_maxspeed) - WEP_CVAR(vortex, charge_minspeed));
// add the extra charge
- self.vortex_charge = min(1, self.vortex_charge + WEP_CVAR(vortex, charge_velocity_rate) * f * PHYS_INPUT_TIMELENGTH);
+ this.vortex_charge = min(1, this.vortex_charge + WEP_CVAR(vortex, charge_velocity_rate) * f * PHYS_INPUT_TIMELENGTH);
}
}
vector org2 = w_org + w_backoff * 6;
pointparticles(EFFECT_VORTEX_IMPACT, org2, '0 0 0', 1);
if(!w_issilent)
- sound(self, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM);
+ sound(this, CH_SHOTS, SND_NEXIMPACT, VOL_BASE, ATTN_NORM);
}
METHOD(Vortex, wr_init, void(entity thiswep))
{
#define TC(T, sym) MACRO_BEGIN MACRO_END
#else
#define TC(T, sym) MACRO_BEGIN \
- if (!is_##T(sym)) LOG_WARNINGF("Type check failed: " #sym " :: " #T); \
+ if (!is_##T(sym)) { \
+ LOG_WARNINGF("Type check failed: " #sym " :: " #T); \
+ isnt_##T(sym); \
+ } \
MACRO_END
#endif
-bool is_float (float this) { return true; }
-bool is_vector(vector this) { return true; }
-bool is_string(string this) { return true; }
-bool is_entity(entity this) { return true; }
-bool is_int (float this) { return this == floor(this); }
-bool is_bool (float this) { return this == true || this == false; }
+#define is_float( this) (true || ftoe(this))
+#define isnt_float( this)
+#define is_vector( this) (true || vtos(this))
+#define isnt_vector( this)
+#define is_string( this) (true || stof(this))
+#define isnt_string( this)
+#define is_entity( this) (true || etof(this))
+#define isnt_entity( this)
+bool is_int( float this) { return this == floor(this); }
+void isnt_int( float this) { print(ftos(this)); }
+bool is_bool( float this) { return this == true || this == false; }
+void isnt_bool( float this) { print(ftos(this)); }
#include "warpzone/mathlib.qc"
--- /dev/null
+// generated file; do not modify
+#include "angle.qc"
+#include "p2mathlib.qc"
+#include "random.qc"
+#include "sortlist.qc"
+#include "test.qc"
+#include "urllib.qc"
--- /dev/null
+// generated file; do not modify
+#include "cl_model.qc"
+#include "cl_player.qc"
+#include "interpolate.qc"
+#include "sv_model.qc"
SELFPARAM();
this.think = SUB_Remove_self;
this.nextthink = time;
- WITH(entity, self, this.owner, this.use());
+ WITHSELF(this.owner, this.use());
}
/*
} MACRO_END
#if defined(CSQC)
+ entity(entity start, .string fld, string match) _findstring = #18;
entity(.string fld, string match, .entity tofield) _findchainstring_tofield = #402;
+
+ entity(entity start, .entity fld, entity match) _findentity = #98;
entity(.entity fld, entity match, .entity tofield) _findchainentity_tofield = #403;
+
+ entity(entity start, .float fld, float match) _findfloat = #98;
entity(.float fld, float match, .entity tofield) _findchainfloat_tofield = #403;
+
+ entity(entity start, .float fld, float match) _findflags = #449;
entity(.float fld, float match, .entity tofield) _findchainflags_tofield = #450;
#elif defined(SVQC)
+ entity(entity start, .string fld, string match) _findstring = #18;
entity(.string fld, string match, .entity tofield) _findchainstring_tofield = #402;
+
+ entity(entity start, .entity fld, entity match) _findentity = #98;
entity(.entity fld, entity match, .entity tofield) _findchainentity_tofield = #403;
+
+ entity(entity start, .float fld, float match) _findfloat = #98;
entity(.float fld, float match, .entity tofield) _findchainfloat_tofield = #403;
+
+ entity(entity start, .float fld, float match) _findflags = #449;
entity(.float fld, float match, .entity tofield) _findchainflags_tofield = #450;
#elif defined(MENUQC)
+ entity(entity start, .string fld, string match) _findstring = #24;
entity(.string fld, string match, .entity tofield) _findchainstring_tofield = #26;
+
+ entity(entity start, .entity fld, entity match) _findentity = #25;
entity(.entity fld, entity match, .entity tofield) _findchainentity_tofield = #27;
+
+ entity(entity start, .float fld, float match) _findfloat = #25;
entity(.float fld, float match, .entity tofield) _findchainfloat_tofield = #27;
+
+ entity(entity start, .float fld, float match) _findflags = #87;
entity(.float fld, float match, .entity tofield) _findchainflags_tofield = #88;
#endif
#define ORDERED(F) F##_UNORDERED
+#define _FOREACH_ENTITY_FIND_ORDERED(T, fld, match, cond, body) \
+ MACRO_BEGIN { \
+ int _i = 0; \
+ for (entity _it = NULL; (_it = _find##T(_it, fld, match)); ++_i) \
+ { \
+ const noref int i = _i; \
+ ITER_CONST noref entity it = _it; \
+ if (cond) LAMBDA(body) \
+ } \
+ } MACRO_END
+#define _FOREACH_ENTITY_FIND_UNORDERED(id, T, fld, match, cond, body) \
+ MACRO_BEGIN { \
+ if (_FOREACH_ENTITY_FIND_##T##_##id##mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_FIND_##T##_##id##mutex); \
+ _FOREACH_ENTITY_FIND_##T##_##id##mutex = __FUNC__; \
+ entity _foundchain_first = _findchain##T##_tofield(fld, match, _FOREACH_ENTITY_FIND_##T##_next##id); \
+ FOREACH_LIST(_foundchain, _FOREACH_ENTITY_FIND_##T##_next##id, cond, body); \
+ _FOREACH_ENTITY_FIND_##T##_##id##mutex = string_null; \
+ } MACRO_END
#define FOREACH_ENTITY(cond, body) ORDERED(FOREACH_ENTITY)(cond, body)
#define FOREACH_ENTITY_ORDERED(cond, body) \
{ \
const noref int i = _i; \
ITER_CONST noref entity it = _it; \
- if (cond) { LAMBDA(body) } \
+ if (cond) LAMBDA(body) \
} \
} MACRO_END
/** marker field, always NULL */
.entity _FOREACH_ENTITY_fld;
+.entity _FOREACH_ENTITY_FIND_entity_nextall; noref string _FOREACH_ENTITY_FIND_entity_allmutex;
+#define FOREACH_ENTITY_UNORDERED(cond, body) _FOREACH_ENTITY_FIND_UNORDERED(all, entity, _FOREACH_ENTITY_fld, NULL, cond, body)
-.entity _FOREACH_ENTITY_next;
-noref string _FOREACH_ENTITY_mutex;
-#define FOREACH_ENTITY_UNORDERED(cond, body) \
- MACRO_BEGIN { \
- if (_FOREACH_ENTITY_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_mutex); \
- _FOREACH_ENTITY_mutex = __FUNC__; \
- entity _foundchain_first = _findchainentity_tofield(_FOREACH_ENTITY_fld, NULL, _FOREACH_ENTITY_next); \
- FOREACH_LIST(_foundchain, _FOREACH_ENTITY_next, cond, body); \
- _FOREACH_ENTITY_mutex = string_null; \
- } MACRO_END
-
+#define FOREACH_ENTITY_FLAGS(fld, match, body) ORDERED(FOREACH_ENTITY_FLAGS)(fld, match, body)
+#define FOREACH_ENTITY_FLAGS_ORDERED(fld, match, body) _FOREACH_ENTITY_FIND_ORDERED(flags, fld, match, true, body)
+.entity _FOREACH_ENTITY_FIND_flags_next; noref string _FOREACH_ENTITY_FIND_flags_mutex;
+#define FOREACH_ENTITY_FLAGS_UNORDERED(fld, match, body) _FOREACH_ENTITY_FIND_UNORDERED(, flags, fld, match, true, body)
#ifndef MENUQC
-entity(vector org, float rad, .entity tofield) _findradius_tofield = #22;
+entity(vector org, float rad, .entity tofield) _findchainradius_tofield = #22;
#define FOREACH_ENTITY_RADIUS(org, dist, cond, body) FOREACH_ENTITY_RADIUS_UNORDERED(org, dist, cond, body)
-.entity _FOREACH_ENTITY_RADIUS_next;
-noref string _FOREACH_ENTITY_RADIUS_mutex;
-#define FOREACH_ENTITY_RADIUS_UNORDERED(org, dist, cond, body) \
- MACRO_BEGIN { \
- if (_FOREACH_ENTITY_RADIUS_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_RADIUS_mutex); \
- _FOREACH_ENTITY_RADIUS_mutex = __FUNC__; \
- entity _foundchain_first = _findradius_tofield(org, dist, _FOREACH_ENTITY_RADIUS_next); \
- FOREACH_LIST(_foundchain, _FOREACH_ENTITY_RADIUS_next, cond, body); \
- _FOREACH_ENTITY_RADIUS_mutex = string_null; \
- } MACRO_END
+.entity _FOREACH_ENTITY_FIND_radius_next; noref string _FOREACH_ENTITY_FIND_radius_mutex;
+#define FOREACH_ENTITY_RADIUS_UNORDERED(org, dist, cond, body) _FOREACH_ENTITY_FIND_UNORDERED(, radius, org, dist, cond, body)
#endif
-
-#define FOREACH_ENTITY_CLASS(class, cond, body) ORDERED(FOREACH_ENTITY_CLASS)(class, cond, body)
-#define FOREACH_ENTITY_CLASS_ORDERED(class, cond, body) FOREACH_ENTITY_ORDERED(it.classname == class && (cond), body)
-.entity _FOREACH_ENTITY_CLASS_next;
-noref string _FOREACH_ENTITY_CLASS_mutex;
-#define FOREACH_ENTITY_CLASS_UNORDERED(class, cond, body) \
- MACRO_BEGIN { \
- if (_FOREACH_ENTITY_CLASS_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_CLASS_mutex); \
- _FOREACH_ENTITY_CLASS_mutex = __FUNC__; \
- entity _foundchain_first = _findchainstring_tofield(classname, class, _FOREACH_ENTITY_CLASS_next); \
- FOREACH_LIST(_foundchain, _FOREACH_ENTITY_CLASS_next, cond, body); \
- _FOREACH_ENTITY_CLASS_mutex = string_null; \
- } MACRO_END
-
-
-
#define FOREACH_ENTITY_FLOAT(fld, match, body) ORDERED(FOREACH_ENTITY_FLOAT)(fld, match, body)
-#define FOREACH_ENTITY_FLOAT_ORDERED(fld, match, body) FOREACH_ENTITY_ORDERED(it.fld == match, body)
-.entity _FOREACH_ENTITY_FLOAT_next;
-noref string _FOREACH_ENTITY_FLOAT_mutex;
-#define FOREACH_ENTITY_FLOAT_UNORDERED(fld, match, body) \
- MACRO_BEGIN { \
- if (_FOREACH_ENTITY_FLOAT_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_FLOAT_mutex); \
- _FOREACH_ENTITY_FLOAT_mutex = __FUNC__; \
- entity _foundchain_first = _findchainfloat_tofield(fld, match, _FOREACH_ENTITY_FLOAT_next); \
- FOREACH_LIST(_foundchain, _FOREACH_ENTITY_FLOAT_next, true, body); \
- _FOREACH_ENTITY_FLOAT_mutex = string_null; \
- } MACRO_END
-
-
-
-#define FOREACH_ENTITY_FLAGS(fld, match, body) ORDERED(FOREACH_ENTITY_FLAGS)(fld, match, body)
-#define FOREACH_ENTITY_FLAGS_ORDERED(fld, match, body) FOREACH_ENTITY_ORDERED(it.fld & match, body)
-.entity _FOREACH_ENTITY_FLAGS_next;
-noref string _FOREACH_ENTITY_FLAGS_mutex;
-#define FOREACH_ENTITY_FLAGS_UNORDERED(fld, match, body) \
- MACRO_BEGIN { \
- if (_FOREACH_ENTITY_FLAGS_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_FLAGS_mutex); \
- _FOREACH_ENTITY_FLAGS_mutex = __FUNC__; \
- entity _foundchain_first = _findchainflags_tofield(fld, match, _FOREACH_ENTITY_FLAGS_next); \
- FOREACH_LIST(_foundchain, _FOREACH_ENTITY_FLAGS_next, true, body); \
- _FOREACH_ENTITY_FLAGS_mutex = string_null; \
- } MACRO_END
-
-
+#define FOREACH_ENTITY_FLOAT_ORDERED(fld, match, body) _FOREACH_ENTITY_FIND_ORDERED(float, fld, match, true, body)
+.entity _FOREACH_ENTITY_FIND_float_next; noref string _FOREACH_ENTITY_FIND_float_mutex;
+#define FOREACH_ENTITY_FLOAT_UNORDERED(fld, match, body) _FOREACH_ENTITY_FIND_UNORDERED(, float, fld, match, true, body)
#define FOREACH_ENTITY_ENT(fld, match, body) ORDERED(FOREACH_ENTITY_ENT)(fld, match, body)
-#define FOREACH_ENTITY_ENT_ORDERED(fld, match, body) FOREACH_ENTITY_ORDERED(it.fld == match, body)
-.entity _FOREACH_ENTITY_ENT_next;
-noref string _FOREACH_ENTITY_ENT_mutex;
-#define FOREACH_ENTITY_ENT_UNORDERED(fld, match, body) \
- MACRO_BEGIN { \
- if (_FOREACH_ENTITY_ENT_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_ENT_mutex); \
- _FOREACH_ENTITY_ENT_mutex = __FUNC__; \
- entity _foundchain_first = _findchainentity_tofield(fld, match, _FOREACH_ENTITY_ENT_next); \
- FOREACH_LIST(_foundchain, _FOREACH_ENTITY_ENT_next, true, body); \
- _FOREACH_ENTITY_ENT_mutex = string_null; \
- } MACRO_END
-
-
+#define FOREACH_ENTITY_ENT_ORDERED(fld, match, body) _FOREACH_ENTITY_FIND_ORDERED(entity, fld, match, true, body)
+.entity _FOREACH_ENTITY_FIND_entity_next; noref string _FOREACH_ENTITY_FIND_entity_mutex;
+#define FOREACH_ENTITY_ENT_UNORDERED(fld, match, body) _FOREACH_ENTITY_FIND_UNORDERED(, entity, fld, match, true, body)
#define FOREACH_ENTITY_STRING(fld, match, body) ORDERED(FOREACH_ENTITY_STRING)(fld, match, body)
-#define FOREACH_ENTITY_STRING_ORDERED(fld, match, body) FOREACH_ENTITY_ORDERED(it.fld == match, body)
-.entity _FOREACH_ENTITY_STRING_next;
-noref string _FOREACH_ENTITY_STRING_mutex;
-#define FOREACH_ENTITY_STRING_UNORDERED(fld, match, body) \
- MACRO_BEGIN { \
- if (_FOREACH_ENTITY_STRING_mutex) LOG_SEVEREF("Loop mutex held by %s", _FOREACH_ENTITY_STRING_mutex); \
- _FOREACH_ENTITY_STRING_mutex = __FUNC__; \
- entity _foundchain_first = _findchainstring_tofield(fld, match, _FOREACH_ENTITY_STRING_next); \
- FOREACH_LIST(_foundchain, _FOREACH_ENTITY_STRING_next, true, body); \
- _FOREACH_ENTITY_STRING_mutex = string_null; \
- } MACRO_END
+#define FOREACH_ENTITY_STRING_ORDERED(fld, match, body) _FOREACH_ENTITY_FIND_ORDERED(string, fld, match, true, body)
+.entity _FOREACH_ENTITY_FIND_string_next; noref string _FOREACH_ENTITY_FIND_string_mutex;
+#define FOREACH_ENTITY_STRING_UNORDERED(fld, match, body) _FOREACH_ENTITY_FIND_UNORDERED(, string, fld, match, true, body)
+
+#define FOREACH_ENTITY_CLASS(class, cond, body) ORDERED(FOREACH_ENTITY_CLASS)(class, cond, body)
+#define FOREACH_ENTITY_CLASS_ORDERED(class, cond, body) _FOREACH_ENTITY_FIND_ORDERED(string, classname, class, cond, body)
+.entity _FOREACH_ENTITY_FIND_string_nextclazz; noref string _FOREACH_ENTITY_FIND_string_clazzmutex;
+#define FOREACH_ENTITY_CLASS_UNORDERED(class, cond, body) _FOREACH_ENTITY_FIND_UNORDERED(clazz, string, classname, class, cond, body)
string(string...) strcat0n = #115;
#endif
+#define __SOURCELOC__ (sprintf("^9"__FILE__"^7" ":" "^9%s^7" ":" "^9"STR(__LINE__)"^7", __FUNC__))
+
#define _LOG(f, level, s) \
MACRO_BEGIN { \
- f(sprintf("^9[::^7" PROGNAME "^9::" level "^9] [" __FILE__ "^7:^9%s^7:^9" STR(__LINE__) "] \n^7%s\n", __FUNC__, s)); \
+ f(sprintf("^9[::^7" PROGNAME "^9::" level "^9] [%s^9]\n^7%s\n", __SOURCELOC__, s)); \
} MACRO_END
#define LOG_FATAL(...) _LOG_FATAL(strcat0n(__VA_ARGS__))
#define REGISTER_NET_LINKED(id) \
[[accumulate]] NET_HANDLE(id, bool isnew) \
{ \
- this = self; \
+ this = __self; \
this.sourceLoc = __FILE__ ":" STR(__LINE__); \
if (!this) isnew = true; \
} \
void UncustomizeEntitiesRun()
{
- SELFPARAM();
- FOREACH_ENTITY_FLOAT(uncustomizeentityforclient_set, true, WITH(entity, self, it, it.uncustomizeentityforclient()));
+ FOREACH_ENTITY_FLOAT(uncustomizeentityforclient_set, true, WITHSELF(it, it.uncustomizeentityforclient()));
}
STRING_ITERATOR(g_buf, string_null, 0);
#ifdef MENUQC
#define NULL (0, null_entity)
+ #define world NULL
#else
#define NULL (0, world)
#endif
entityclass(cname, base); \
class(cname).bool instanceOf##cname; \
bool is_##cname(entity e) { return e.instanceOf##cname; } \
+ void isnt_##cname(entity e) { eprint(e); } \
VTBL(cname, base) \
_INIT_STATIC(cname) \
{ \
FOREACH(id, true, s = strcat(s, join, it.registered_id)); \
s = substring(s, strlen(join), -1); \
string h = REGISTRY_HASH(id) = strzone(digest_hex(algo, s)); \
- LOG_TRACEF(#id ": %s\n[%s]\n", h, s); \
+ LOG_DEBUGF(#id ": %s\n[%s]\n", h, s); \
} \
void Registry_check(string r, string sv) \
{ \
// Transition from global 'self' to local 'this'
-[[alias("self")]] entity __self;
-
// Step 1: auto oldself
#if 1
- #define SELFPARAM() noref entity this = __self
- #define setself(s) (__self = s)
- #define self __self
+ #define SELFPARAM() noref const entity this = self
#endif
-// Step 2: check SELFPARAM() is present for functions that use self
-#if 0
- #define SELFPARAM() [[alias("__self")]] noref entity this = __self
- #define setself(s) (__self = s)
- #define self this
+// Step 2: const self
+#if 1
+ #define self (0, self)
+ [[alias("self")]] entity __self;
+ #define setself(s) (__self = s)
+ #define WITHSELF(value, block) WITH(entity, __self, value, (0, block))
#endif
-// Step 3: const self
+// Step 3: propagate SELFPARAM()
+#if 1
+ #undef self
+ #define self (this, self)
+#endif
+
+// Step 4: kill unstructured setself
#if 0
- #define SELFPARAM() noref const entity this = __self
- entity setself(entity e) { return self = e; }
- entity getself() { return self; }
- #define self getself()
+ #undef setself
#endif
-// Step 4: enable when possible
-// TODO: Remove SELFPARAM in favor of a parameter
+// Step 5: this should work
#if 0
- #define SELFPARAM() noref const entity this = __self
- #define self this
+ #define self (0, this)
#endif
+
+// Step 6: Remove SELFPARAM in favor of a parameter
void __spawnfunc_##id(entity this); \
[[accumulate]] void spawnfunc_##id(entity this) \
{ \
- if (self == __spawnfunc_expect) \
+ if (__self == __spawnfunc_expect) \
{ \
/* engine call */ \
__spawnfunc_expect = NULL; \
- this = self; \
+ this = __self; \
} \
else \
{ \
--- /dev/null
+// generated file; do not modify
+#include "anglestransform.qc"
+#include "client.qc"
+#include "common.qc"
+#include "mathlib.qc"
+#include "server.qc"
+#include "util_server.qc"
NET_HANDLE(ENT_CLIENT_WARPZONE, bool isnew)
{
warpzone_warpzones_exist = 1;
- if (!self.enemy)
+ if (!this.enemy)
{
- self.enemy = new(warpzone_from);
+ this.enemy = new(warpzone_from);
}
- self.classname = "trigger_warpzone";
+ this.classname = "trigger_warpzone";
int f = ReadByte();
- self.warpzone_isboxy = (f & 1);
+ this.warpzone_isboxy = (f & 1);
if(f & 4)
{
- self.origin_x = ReadCoord();
- self.origin_y = ReadCoord();
- self.origin_z = ReadCoord();
+ this.origin_x = ReadCoord();
+ this.origin_y = ReadCoord();
+ this.origin_z = ReadCoord();
}
else
- self.origin = '0 0 0';
- self.modelindex = ReadShort();
- self.mins_x = ReadCoord();
- self.mins_y = ReadCoord();
- self.mins_z = ReadCoord();
- self.maxs_x = ReadCoord();
- self.maxs_y = ReadCoord();
- self.maxs_z = ReadCoord();
- self.scale = ReadByte() / 16;
- self.enemy.oldorigin_x = ReadCoord();
- self.enemy.oldorigin_y = ReadCoord();
- self.enemy.oldorigin_z = ReadCoord();
- self.enemy.avelocity_x = ReadCoord();
- self.enemy.avelocity_y = ReadCoord();
- self.enemy.avelocity_z = ReadCoord();
- self.oldorigin_x = ReadCoord();
- self.oldorigin_y = ReadCoord();
- self.oldorigin_z = ReadCoord();
- self.avelocity_x = ReadCoord();
- self.avelocity_y = ReadCoord();
- self.avelocity_z = ReadCoord();
+ this.origin = '0 0 0';
+ this.modelindex = ReadShort();
+ this.mins_x = ReadCoord();
+ this.mins_y = ReadCoord();
+ this.mins_z = ReadCoord();
+ this.maxs_x = ReadCoord();
+ this.maxs_y = ReadCoord();
+ this.maxs_z = ReadCoord();
+ this.scale = ReadByte() / 16;
+ this.enemy.oldorigin_x = ReadCoord();
+ this.enemy.oldorigin_y = ReadCoord();
+ this.enemy.oldorigin_z = ReadCoord();
+ this.enemy.avelocity_x = ReadCoord();
+ this.enemy.avelocity_y = ReadCoord();
+ this.enemy.avelocity_z = ReadCoord();
+ this.oldorigin_x = ReadCoord();
+ this.oldorigin_y = ReadCoord();
+ this.oldorigin_z = ReadCoord();
+ this.avelocity_x = ReadCoord();
+ this.avelocity_y = ReadCoord();
+ this.avelocity_z = ReadCoord();
if(f & 2)
{
- self.warpzone_fadestart = ReadShort();
- self.warpzone_fadeend = max(self.warpzone_fadestart + 1, ReadShort());
+ this.warpzone_fadestart = ReadShort();
+ this.warpzone_fadeend = max(this.warpzone_fadestart + 1, ReadShort());
}
else
{
- self.warpzone_fadestart = 0;
- self.warpzone_fadeend = 0;
+ this.warpzone_fadestart = 0;
+ this.warpzone_fadeend = 0;
}
// common stuff
- WarpZone_SetUp(self, self.enemy.oldorigin, self.enemy.avelocity, self.oldorigin, self.avelocity);
+ WarpZone_SetUp(this, this.enemy.oldorigin, this.enemy.avelocity, this.oldorigin, this.avelocity);
// link me
- //setmodel(self, self.model);
- setorigin(self, self.origin);
- setsize(self, self.mins, self.maxs);
+ //setmodel(this, this.model);
+ setorigin(this, this.origin);
+ setsize(this, this.mins, this.maxs);
// how to draw
// engine currently wants this
- setpredraw(self, WarpZone_Fade_PreDraw);
+ setpredraw(this, WarpZone_Fade_PreDraw);
- //self.move_touch = WarpZone_Touch;
+ //this.move_touch = WarpZone_Touch;
return true;
}
NET_HANDLE(ENT_CLIENT_WARPZONE_CAMERA, bool isnew)
{
warpzone_cameras_exist = 1;
- self.classname = "func_warpzone_camera";
+ this.classname = "func_warpzone_camera";
int f = ReadByte();
if(f & 4)
{
- self.origin_x = ReadCoord();
- self.origin_y = ReadCoord();
- self.origin_z = ReadCoord();
+ this.origin_x = ReadCoord();
+ this.origin_y = ReadCoord();
+ this.origin_z = ReadCoord();
}
else
- self.origin = '0 0 0';
- self.modelindex = ReadShort();
- self.mins_x = ReadCoord();
- self.mins_y = ReadCoord();
- self.mins_z = ReadCoord();
- self.maxs_x = ReadCoord();
- self.maxs_y = ReadCoord();
- self.maxs_z = ReadCoord();
- self.scale = ReadByte() / 16;
- self.oldorigin_x = ReadCoord();
- self.oldorigin_y = ReadCoord();
- self.oldorigin_z = ReadCoord();
- self.avelocity_x = ReadCoord();
- self.avelocity_y = ReadCoord();
- self.avelocity_z = ReadCoord();
+ this.origin = '0 0 0';
+ this.modelindex = ReadShort();
+ this.mins_x = ReadCoord();
+ this.mins_y = ReadCoord();
+ this.mins_z = ReadCoord();
+ this.maxs_x = ReadCoord();
+ this.maxs_y = ReadCoord();
+ this.maxs_z = ReadCoord();
+ this.scale = ReadByte() / 16;
+ this.oldorigin_x = ReadCoord();
+ this.oldorigin_y = ReadCoord();
+ this.oldorigin_z = ReadCoord();
+ this.avelocity_x = ReadCoord();
+ this.avelocity_y = ReadCoord();
+ this.avelocity_z = ReadCoord();
if(f & 2)
{
- self.warpzone_fadestart = ReadShort();
- self.warpzone_fadeend = max(self.warpzone_fadestart + 1, ReadShort());
+ this.warpzone_fadestart = ReadShort();
+ this.warpzone_fadeend = max(this.warpzone_fadestart + 1, ReadShort());
}
else
{
- self.warpzone_fadestart = 0;
- self.warpzone_fadeend = 0;
+ this.warpzone_fadestart = 0;
+ this.warpzone_fadeend = 0;
}
// common stuff
- WarpZone_Camera_SetUp(self, self.oldorigin, self.avelocity);
+ WarpZone_Camera_SetUp(this, this.oldorigin, this.avelocity);
// engine currently wants this
- self.drawmask = MASK_NORMAL;
+ this.drawmask = MASK_NORMAL;
// link me
- //setmodel(self, self.model);
- setorigin(self, self.origin);
- setsize(self, self.mins, self.maxs);
+ //setmodel(this, this.model);
+ setorigin(this, this.origin);
+ setsize(this, this.mins, this.maxs);
// how to draw
// engine currently wants this
- setpredraw(self, WarpZone_Fade_PreDraw);
+ setpredraw(this, WarpZone_Fade_PreDraw);
return true;
}
void CL_RotateMoves(vector ang) = #638;
NET_HANDLE(ENT_CLIENT_WARPZONE_TELEPORTED, bool isnew)
{
- self.classname = "warpzone_teleported";
+ this.classname = "warpzone_teleported";
vector v;
v.x = ReadCoord();
v.y = ReadCoord();
v.z = ReadCoord();
return = true;
if (!isnew) return;
- self.warpzone_transform = v;
- setproperty(VF_CL_VIEWANGLES, WarpZone_TransformVAngles(self, getpropertyvec(VF_CL_VIEWANGLES)));
+ this.warpzone_transform = v;
+ setproperty(VF_CL_VIEWANGLES, WarpZone_TransformVAngles(this, getpropertyvec(VF_CL_VIEWANGLES)));
if(checkextension("DP_CSQC_ROTATEMOVES"))
CL_RotateMoves(v);
//CL_RotateMoves('0 90 0');
void WarpZone_FixPMove()
{
- entity e;
- e = WarpZone_Find(pmove_org, pmove_org);
+ entity e = WarpZone_Find(pmove_org, pmove_org);
if(e)
{
pmove_org = WarpZone_TransformOrigin(e, pmove_org);
vector WarpZone_camera_transform(vector org, vector ang)
{SELFPARAM();
vector vf, vr, vu;
- if(self.warpzone_fadestart)
- if(vdist(org - self.origin - 0.5 * (self.mins + self.maxs), >, self.warpzone_fadeend + 400))
+ if(this.warpzone_fadestart)
+ if(vdist(org - this.origin - 0.5 * (this.mins + this.maxs), >, this.warpzone_fadeend + 400))
return org;
// don't transform if zone faded out (plus 400qu safety margin for typical speeds and latencies)
// unneeded on client, on server this helps a lot
vf = v_forward;
vr = v_right;
vu = v_up;
- org = WarpZone_TransformOrigin(self, org);
- vf = WarpZone_TransformVelocity(self, vf);
- vr = WarpZone_TransformVelocity(self, vr);
- vu = WarpZone_TransformVelocity(self, vu);
+ org = WarpZone_TransformOrigin(this, org);
+ vf = WarpZone_TransformVelocity(this, vf);
+ vr = WarpZone_TransformVelocity(this, vr);
+ vu = WarpZone_TransformVelocity(this, vu);
if(autocvar_cl_warpzone_usetrace)
- traceline(self.warpzone_targetorigin, org, MOVE_NOMONSTERS, world);
+ traceline(this.warpzone_targetorigin, org, MOVE_NOMONSTERS, world);
else
- trace_endpos = self.warpzone_targetorigin;
+ trace_endpos = this.warpzone_targetorigin;
v_forward = vf;
v_right = vr;
v_up = vu;
vector WarpZone_Camera_camera_transform(vector org, vector ang)
{SELFPARAM();
// a fixed camera view
- if(self.warpzone_fadestart)
- if(vdist(org - self.origin - 0.5 * (self.mins + self.maxs), >, self.warpzone_fadeend + 400))
+ if(this.warpzone_fadestart)
+ if(vdist(org - this.origin - 0.5 * (this.mins + this.maxs), >, this.warpzone_fadeend + 400))
return org;
// don't transform if zone faded out (plus 400qu safety margin for typical speeds and latencies)
// unneeded on client, on server this helps a lot
- trace_endpos = self.warpzone_origin;
- makevectors(self.warpzone_angles);
- return self.warpzone_origin;
+ trace_endpos = this.warpzone_origin;
+ makevectors(this.warpzone_angles);
+ return this.warpzone_origin;
}
void WarpZone_Camera_SetUp(entity e, vector my_org, vector my_ang) // we assume that e.oldorigin and e.avelocity point to view origin and direction
void WarpZone_RefSys_GC()
{SELFPARAM();
// garbage collect unused reference systems
- self.nextthink = time + 1;
- if(self.owner.WarpZone_refsys != self)
- remove(self);
+ this.nextthink = time + 1;
+ if(this.owner.WarpZone_refsys != this)
+ remove(this);
}
void WarpZone_RefSys_CheckCreate(entity me)
{
float WarpZoneLib_ExactTrigger_Touch()
{SELFPARAM();
- return !WarpZoneLib_BoxTouchesBrush(other.absmin, other.absmax, self, other);
+ return !WarpZoneLib_BoxTouchesBrush(other.absmin, other.absmax, this, other);
}
}
#ifdef SVQC
-bool WarpZone_Teleported_Send(entity to, int sf)
-{SELFPARAM();
+bool WarpZone_Teleported_Send(entity this, entity to, int sf)
+{
WriteHeader(MSG_ENTITY, ENT_CLIENT_WARPZONE_TELEPORTED);
- WriteCoord(MSG_ENTITY, self.angles.x);
- WriteCoord(MSG_ENTITY, self.angles.y);
- WriteCoord(MSG_ENTITY, self.angles.z);
+ WriteCoord(MSG_ENTITY, this.angles.x);
+ WriteCoord(MSG_ENTITY, this.angles.y);
+ WriteCoord(MSG_ENTITY, this.angles.z);
return true;
}
#endif
entity ts = new(warpzone_teleported);
setmodel(ts, MDL_Null);
- ts.SendEntity = WarpZone_Teleported_Send;
+ ts.SendEntity = SendEntity_self;
+ ts.SendEntity3 = WarpZone_Teleported_Send;
ts.SendFlags = 0xFFFFFF;
ts.drawonlytoclient = player;
ts.think = SUB_Remove_self;
return;
#ifdef SVQC
- if(WarpZone_PlaneDist(self, other.origin + other.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet)
+ if(WarpZone_PlaneDist(this, other.origin + other.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet)
#elif defined(CSQC)
- if(WarpZone_PlaneDist(self, other.move_origin + other.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet)
+ if(WarpZone_PlaneDist(this, other.move_origin + other.view_ofs) >= 0) // wrong side of the trigger_warpzone (don't teleport yet)
#endif
return;
#endif
else
f = -1;
- if(WarpZone_Teleport(self, other, f, 0))
+ if(WarpZone_Teleport(this, other, f, 0))
{
#ifdef SVQC
string save1, save2;
activator = other;
- save1 = self.target; self.target = string_null;
- save2 = self.target3; self.target3 = string_null;
+ save1 = this.target; this.target = string_null;
+ save2 = this.target3; this.target3 = string_null;
SUB_UseTargets();
- if (!self.target) self.target = save1;
- if (!self.target3) self.target3 = save2;
+ if (!this.target) this.target = save1;
+ if (!this.target3) this.target3 = save2;
- setself(self.enemy);
- save1 = self.target; self.target = string_null;
- save2 = self.target2; self.target2 = string_null;
+ setself(this.enemy);
+ save1 = this.target; this.target = string_null;
+ save2 = this.target2; this.target2 = string_null;
SUB_UseTargets();
- if (!self.target) self.target = save1;
- if (!self.target2) self.target2 = save2;
+ if (!this.target) this.target = save1;
+ if (!this.target2) this.target2 = save2;
setself(this);
#endif
}
}
#ifdef SVQC
-bool WarpZone_Send(entity to, int sendflags)
-{SELFPARAM();
+bool WarpZone_Send(entity this, entity to, int sendflags)
+{
WriteHeader(MSG_ENTITY, ENT_CLIENT_WARPZONE);
// we must send this flag for clientside to match properly too
int f = 0;
- if(self.warpzone_isboxy)
+ if(this.warpzone_isboxy)
BITSET_ASSIGN(f, 1);
- if(self.warpzone_fadestart)
+ if(this.warpzone_fadestart)
BITSET_ASSIGN(f, 2);
- if(self.origin != '0 0 0')
+ if(this.origin != '0 0 0')
BITSET_ASSIGN(f, 4);
WriteByte(MSG_ENTITY, f);
// we need THESE to render the warpzone (and cull properly)...
if(f & 4)
{
- WriteCoord(MSG_ENTITY, self.origin.x);
- WriteCoord(MSG_ENTITY, self.origin.y);
- WriteCoord(MSG_ENTITY, self.origin.z);
+ WriteCoord(MSG_ENTITY, this.origin.x);
+ WriteCoord(MSG_ENTITY, this.origin.y);
+ WriteCoord(MSG_ENTITY, this.origin.z);
}
- WriteShort(MSG_ENTITY, self.modelindex);
- WriteCoord(MSG_ENTITY, self.mins.x);
- WriteCoord(MSG_ENTITY, self.mins.y);
- WriteCoord(MSG_ENTITY, self.mins.z);
- WriteCoord(MSG_ENTITY, self.maxs.x);
- WriteCoord(MSG_ENTITY, self.maxs.y);
- WriteCoord(MSG_ENTITY, self.maxs.z);
- WriteByte(MSG_ENTITY, bound(1, self.scale * 16, 255));
+ WriteShort(MSG_ENTITY, this.modelindex);
+ WriteCoord(MSG_ENTITY, this.mins.x);
+ WriteCoord(MSG_ENTITY, this.mins.y);
+ WriteCoord(MSG_ENTITY, this.mins.z);
+ WriteCoord(MSG_ENTITY, this.maxs.x);
+ WriteCoord(MSG_ENTITY, this.maxs.y);
+ WriteCoord(MSG_ENTITY, this.maxs.z);
+ WriteByte(MSG_ENTITY, bound(1, this.scale * 16, 255));
// we need THESE to calculate the proper transform
- WriteCoord(MSG_ENTITY, self.warpzone_origin.x);
- WriteCoord(MSG_ENTITY, self.warpzone_origin.y);
- WriteCoord(MSG_ENTITY, self.warpzone_origin.z);
- WriteCoord(MSG_ENTITY, self.warpzone_angles.x);
- WriteCoord(MSG_ENTITY, self.warpzone_angles.y);
- WriteCoord(MSG_ENTITY, self.warpzone_angles.z);
- WriteCoord(MSG_ENTITY, self.warpzone_targetorigin.x);
- WriteCoord(MSG_ENTITY, self.warpzone_targetorigin.y);
- WriteCoord(MSG_ENTITY, self.warpzone_targetorigin.z);
- WriteCoord(MSG_ENTITY, self.warpzone_targetangles.x);
- WriteCoord(MSG_ENTITY, self.warpzone_targetangles.y);
- WriteCoord(MSG_ENTITY, self.warpzone_targetangles.z);
+ WriteCoord(MSG_ENTITY, this.warpzone_origin.x);
+ WriteCoord(MSG_ENTITY, this.warpzone_origin.y);
+ WriteCoord(MSG_ENTITY, this.warpzone_origin.z);
+ WriteCoord(MSG_ENTITY, this.warpzone_angles.x);
+ WriteCoord(MSG_ENTITY, this.warpzone_angles.y);
+ WriteCoord(MSG_ENTITY, this.warpzone_angles.z);
+ WriteCoord(MSG_ENTITY, this.warpzone_targetorigin.x);
+ WriteCoord(MSG_ENTITY, this.warpzone_targetorigin.y);
+ WriteCoord(MSG_ENTITY, this.warpzone_targetorigin.z);
+ WriteCoord(MSG_ENTITY, this.warpzone_targetangles.x);
+ WriteCoord(MSG_ENTITY, this.warpzone_targetangles.y);
+ WriteCoord(MSG_ENTITY, this.warpzone_targetangles.z);
if(f & 2)
{
- WriteShort(MSG_ENTITY, self.warpzone_fadestart);
- WriteShort(MSG_ENTITY, self.warpzone_fadeend);
+ WriteShort(MSG_ENTITY, this.warpzone_fadestart);
+ WriteShort(MSG_ENTITY, this.warpzone_fadeend);
}
return true;
}
-bool WarpZone_Camera_Send(entity to, int sendflags)
-{SELFPARAM();
+bool WarpZone_Camera_Send(entity this, entity to, int sendflags)
+{
int f = 0;
WriteHeader(MSG_ENTITY, ENT_CLIENT_WARPZONE_CAMERA);
- if(self.warpzone_fadestart)
+ if(this.warpzone_fadestart)
BITSET_ASSIGN(f, 2);
- if(self.origin != '0 0 0')
+ if(this.origin != '0 0 0')
BITSET_ASSIGN(f, 4);
WriteByte(MSG_ENTITY, f);
// we need THESE to render the warpzone (and cull properly)...
if(f & 4)
{
- WriteCoord(MSG_ENTITY, self.origin.x);
- WriteCoord(MSG_ENTITY, self.origin.y);
- WriteCoord(MSG_ENTITY, self.origin.z);
+ WriteCoord(MSG_ENTITY, this.origin.x);
+ WriteCoord(MSG_ENTITY, this.origin.y);
+ WriteCoord(MSG_ENTITY, this.origin.z);
}
- WriteShort(MSG_ENTITY, self.modelindex);
- WriteCoord(MSG_ENTITY, self.mins.x);
- WriteCoord(MSG_ENTITY, self.mins.y);
- WriteCoord(MSG_ENTITY, self.mins.z);
- WriteCoord(MSG_ENTITY, self.maxs.x);
- WriteCoord(MSG_ENTITY, self.maxs.y);
- WriteCoord(MSG_ENTITY, self.maxs.z);
- WriteByte(MSG_ENTITY, bound(1, self.scale * 16, 255));
+ WriteShort(MSG_ENTITY, this.modelindex);
+ WriteCoord(MSG_ENTITY, this.mins.x);
+ WriteCoord(MSG_ENTITY, this.mins.y);
+ WriteCoord(MSG_ENTITY, this.mins.z);
+ WriteCoord(MSG_ENTITY, this.maxs.x);
+ WriteCoord(MSG_ENTITY, this.maxs.y);
+ WriteCoord(MSG_ENTITY, this.maxs.z);
+ WriteByte(MSG_ENTITY, bound(1, this.scale * 16, 255));
// we need THESE to calculate the proper transform
- WriteCoord(MSG_ENTITY, self.enemy.origin.x);
- WriteCoord(MSG_ENTITY, self.enemy.origin.y);
- WriteCoord(MSG_ENTITY, self.enemy.origin.z);
- WriteCoord(MSG_ENTITY, self.enemy.angles.x);
- WriteCoord(MSG_ENTITY, self.enemy.angles.y);
- WriteCoord(MSG_ENTITY, self.enemy.angles.z);
+ WriteCoord(MSG_ENTITY, this.enemy.origin.x);
+ WriteCoord(MSG_ENTITY, this.enemy.origin.y);
+ WriteCoord(MSG_ENTITY, this.enemy.origin.z);
+ WriteCoord(MSG_ENTITY, this.enemy.angles.x);
+ WriteCoord(MSG_ENTITY, this.enemy.angles.y);
+ WriteCoord(MSG_ENTITY, this.enemy.angles.z);
if(f & 2)
{
- WriteShort(MSG_ENTITY, self.warpzone_fadestart);
- WriteShort(MSG_ENTITY, self.warpzone_fadeend);
+ WriteShort(MSG_ENTITY, this.warpzone_fadestart);
+ WriteShort(MSG_ENTITY, this.warpzone_fadeend);
}
return true;
// engine now aborts moves on teleport, so this SHOULD not happen any more
// but if this is called from TouchAreaGrid of the projectile moving,
// then this won't do
- if(time == self.warpzone_teleport_time)
+ if(time == this.warpzone_teleport_time)
return true;
#ifdef SVQC
save_inopen = trace_inopen;
save_inwater = trace_inwater;
float f;
- if((f = WarpZone_CheckProjectileImpact(self)) != 0)
+ if((f = WarpZone_CheckProjectileImpact(this)) != 0)
return (f > 0);
trace_dpstartcontents = save_dpstartcontents;
trace_dphitcontents = save_dphitcontents;
void WarpZone_InitStep_FindOriginTarget()
{SELFPARAM();
- if(self.killtarget != "")
+ if(this.killtarget != "")
{
- self.aiment = find(world, targetname, self.killtarget);
- if(self.aiment == world)
+ this.aiment = find(world, targetname, this.killtarget);
+ if(this.aiment == world)
{
error("Warp zone with nonexisting killtarget");
return;
}
- self.killtarget = string_null;
+ this.killtarget = string_null;
}
}
void WarpZonePosition_InitStep_FindTarget()
{SELFPARAM();
- if(self.target == "")
+ if(this.target == "")
{
error("Warp zone position with no target");
return;
}
- self.enemy = find(world, targetname, self.target);
- if(self.enemy == world)
+ this.enemy = find(world, targetname, this.target);
+ if(this.enemy == world)
{
error("Warp zone position with nonexisting target");
return;
}
- if(self.enemy.aiment)
+ if(this.enemy.aiment)
{
// already is positioned
error("Warp zone position targeting already oriented warpzone");
return;
}
- self.enemy.aiment = self;
+ this.enemy.aiment = this;
}
void WarpZoneCamera_Think()
{SELFPARAM();
- if(self.warpzone_save_origin != self.origin
- || self.warpzone_save_angles != self.angles
- || self.warpzone_save_eorigin != self.enemy.origin
- || self.warpzone_save_eangles != self.enemy.angles)
+ if(this.warpzone_save_origin != this.origin
+ || this.warpzone_save_angles != this.angles
+ || this.warpzone_save_eorigin != this.enemy.origin
+ || this.warpzone_save_eangles != this.enemy.angles)
{
- WarpZone_Camera_SetUp(self, self.enemy.origin, self.enemy.angles);
- self.warpzone_save_origin = self.origin;
- self.warpzone_save_angles = self.angles;
- self.warpzone_save_eorigin = self.enemy.origin;
- self.warpzone_save_eangles = self.enemy.angles;
+ WarpZone_Camera_SetUp(this, this.enemy.origin, this.enemy.angles);
+ this.warpzone_save_origin = this.origin;
+ this.warpzone_save_angles = this.angles;
+ this.warpzone_save_eorigin = this.enemy.origin;
+ this.warpzone_save_eangles = this.enemy.angles;
}
- self.nextthink = time;
+ this.nextthink = time;
}
void WarpZoneCamera_InitStep_FindTarget()
{SELFPARAM();
entity e;
float i;
- if(self.target == "")
+ if(this.target == "")
{
error("Camera with no target");
return;
}
- self.enemy = world;
- for(e = world, i = 0; (e = find(e, targetname, self.target)); )
+ this.enemy = world;
+ for(e = world, i = 0; (e = find(e, targetname, this.target)); )
if(random() * ++i < 1)
- self.enemy = e;
- if(self.enemy == world)
+ this.enemy = e;
+ if(this.enemy == world)
{
error("Camera with nonexisting target");
return;
}
warpzone_cameras_exist = 1;
- WarpZone_Camera_SetUp(self, self.enemy.origin, self.enemy.angles);
- self.SendFlags = 0xFFFFFF;
- if(self.spawnflags & 1)
+ WarpZone_Camera_SetUp(this, this.enemy.origin, this.enemy.angles);
+ this.SendFlags = 0xFFFFFF;
+ if(this.spawnflags & 1)
{
- self.think = WarpZoneCamera_Think;
- self.nextthink = time;
+ this.think = WarpZoneCamera_Think;
+ this.nextthink = time;
}
else
- self.nextthink = 0;
+ this.nextthink = 0;
}
void WarpZone_InitStep_UpdateTransform()
float i_s, i_t, n_t;
string tex;
- org = self.origin;
+ org = this.origin;
if(org == '0 0 0')
- org = 0.5 * (self.mins + self.maxs);
+ org = 0.5 * (this.mins + this.maxs);
norm = point = '0 0 0';
area = 0;
for(i_s = 0; ; ++i_s)
{
- tex = getsurfacetexture(self, i_s);
+ tex = getsurfacetexture(this, i_s);
if (!tex)
break; // this is beyond the last one
if(tex == "textures/common/trigger" || tex == "trigger")
continue;
- n_t = getsurfacenumtriangles(self, i_s);
+ n_t = getsurfacenumtriangles(this, i_s);
for(i_t = 0; i_t < n_t; ++i_t)
{
- tri = getsurfacetriangle(self, i_s, i_t);
- a = getsurfacepoint(self, i_s, tri.x);
- b = getsurfacepoint(self, i_s, tri.y);
- c = getsurfacepoint(self, i_s, tri.z);
+ tri = getsurfacetriangle(this, i_s, i_t);
+ a = getsurfacepoint(this, i_s, tri.x);
+ b = getsurfacepoint(this, i_s, tri.y);
+ c = getsurfacepoint(this, i_s, tri.z);
n = cross(c - a, b - a);
area = area + vlen(n);
norm = norm + n;
point = point * (1 / (3 * area));
if(vdist(norm, <, 0.99))
{
- LOG_INFO("trigger_warpzone near ", vtos(self.aiment.origin), " is nonplanar. BEWARE.\n");
+ LOG_INFO("trigger_warpzone near ", vtos(this.aiment.origin), " is nonplanar. BEWARE.\n");
area = 0; // no autofixing in this case
}
norm = normalize(norm);
}
ang = '0 0 0';
- if(self.aiment)
+ if(this.aiment)
{
- org = self.aiment.origin;
- ang = self.aiment.angles;
+ org = this.aiment.origin;
+ ang = this.aiment.angles;
if(area > 0)
{
org = org - ((org - point) * norm) * norm; // project to plane
makevectors(ang);
if(norm * v_forward < 0)
{
- LOG_INFO("Position target of trigger_warpzone near ", vtos(self.aiment.origin), " points into trigger_warpzone. BEWARE.\n");
+ LOG_INFO("Position target of trigger_warpzone near ", vtos(this.aiment.origin), " points into trigger_warpzone. BEWARE.\n");
norm = -1 * norm;
}
ang = vectoangles2(norm, v_up); // keep rotation, but turn exactly against plane
ang.x = -ang.x;
if(norm * v_forward < 0.99)
- LOG_INFO("trigger_warpzone near ", vtos(self.aiment.origin), " has been turned to match plane orientation (", vtos(self.aiment.angles), " -> ", vtos(ang), "\n");
- if(vdist(org - self.aiment.origin, >, 0.5))
- LOG_INFO("trigger_warpzone near ", vtos(self.aiment.origin), " has been moved to match the plane (", vtos(self.aiment.origin), " -> ", vtos(org), ").\n");
+ LOG_INFO("trigger_warpzone near ", vtos(this.aiment.origin), " has been turned to match plane orientation (", vtos(this.aiment.angles), " -> ", vtos(ang), "\n");
+ if(vdist(org - this.aiment.origin, >, 0.5))
+ LOG_INFO("trigger_warpzone near ", vtos(this.aiment.origin), " has been moved to match the plane (", vtos(this.aiment.origin), " -> ", vtos(org), ").\n");
}
}
else if(area > 0)
else
error("cannot infer origin/angles for this warpzone, please use a killtarget or a trigger_warpzone_position");
- self.warpzone_origin = org;
- self.warpzone_angles = ang;
+ this.warpzone_origin = org;
+ this.warpzone_angles = ang;
}
void WarpZone_InitStep_ClearTarget()
{SELFPARAM();
- if(self.enemy)
- self.enemy.enemy = world;
- self.enemy = world;
+ if(this.enemy)
+ this.enemy.enemy = world;
+ this.enemy = world;
}
entity warpzone_first; .entity warpzone_next;
float i;
entity e, e2;
- if(self.enemy)
+ if(this.enemy)
return;
// this way only one of the two ents needs to target
- if(self.target != "")
+ if(this.target != "")
{
- self.enemy = self; // so the if(!e.enemy) check also skips self, saves one IF
+ this.enemy = this; // so the if(!e.enemy) check also skips this, saves one IF
e2 = world;
- for(e = world, i = 0; (e = find(e, targetname, self.target)); )
+ for(e = world, i = 0; (e = find(e, targetname, this.target)); )
if(!e.enemy)
- if(e.classname == self.classname) // possibly non-warpzones may use the same targetname!
+ if(e.classname == this.classname) // possibly non-warpzones may use the same targetname!
if(random() * ++i < 1)
e2 = e;
if(!e2)
{
- self.enemy = world;
+ this.enemy = world;
error("Warpzone with non-existing target");
return;
}
- self.enemy = e2;
- e2.enemy = self;
+ this.enemy = e2;
+ e2.enemy = this;
}
}
void WarpZone_Think();
void WarpZone_InitStep_FinalizeTransform()
{SELFPARAM();
- if(!self.enemy || self.enemy.enemy != self)
+ if(!this.enemy || this.enemy.enemy != this)
{
error("Invalid warp zone detected. Killed.");
return;
}
warpzone_warpzones_exist = 1;
- WarpZone_SetUp(self, self.warpzone_origin, self.warpzone_angles, self.enemy.warpzone_origin, self.enemy.warpzone_angles);
- self.touch = WarpZone_Touch;
- self.SendFlags = 0xFFFFFF;
- if(self.spawnflags & 1)
+ WarpZone_SetUp(this, this.warpzone_origin, this.warpzone_angles, this.enemy.warpzone_origin, this.enemy.warpzone_angles);
+ this.touch = WarpZone_Touch;
+ this.SendFlags = 0xFFFFFF;
+ if(this.spawnflags & 1)
{
- self.think = WarpZone_Think;
- self.nextthink = time;
+ this.think = WarpZone_Think;
+ this.nextthink = time;
}
else
- self.nextthink = 0;
+ this.nextthink = 0;
}
float warpzone_initialized;
spawnfunc(misc_warpzone_position)
{
// "target", "angles", "origin"
- self.warpzone_next = warpzone_position_first;
- warpzone_position_first = self;
+ this.warpzone_next = warpzone_position_first;
+ warpzone_position_first = this;
}
spawnfunc(trigger_warpzone_position)
{
// the map, with another killtarget to designate its
// orientation
- if(!self.scale)
- self.scale = self.modelscale;
- if(!self.scale)
- self.scale = 1;
+ if(!this.scale)
+ this.scale = this.modelscale;
+ if(!this.scale)
+ this.scale = 1;
string m;
- m = self.model;
+ m = this.model;
WarpZoneLib_ExactTrigger_Init();
if(m != "")
{
precache_model(m);
- _setmodel(self, m); // no precision needed
+ _setmodel(this, m); // no precision needed
}
- setorigin(self, self.origin);
- if(self.scale)
- setsize(self, self.mins * self.scale, self.maxs * self.scale);
+ setorigin(this, this.origin);
+ if(this.scale)
+ setsize(this, this.mins * this.scale, this.maxs * this.scale);
else
- setsize(self, self.mins, self.maxs);
- self.SendEntity = WarpZone_Send;
- self.SendFlags = 0xFFFFFF;
- BITSET_ASSIGN(self.effects, EF_NODEPTHTEST);
- self.warpzone_next = warpzone_first;
- warpzone_first = self;
+ setsize(this, this.mins, this.maxs);
+ this.SendEntity = SendEntity_self;
+ this.SendEntity3 = WarpZone_Send;
+ this.SendFlags = 0xFFFFFF;
+ BITSET_ASSIGN(this.effects, EF_NODEPTHTEST);
+ this.warpzone_next = warpzone_first;
+ warpzone_first = this;
}
spawnfunc(func_camera)
{
- if(!self.scale)
- self.scale = self.modelscale;
- if(!self.scale)
- self.scale = 1;
- if(self.model != "")
+ if(!this.scale)
+ this.scale = this.modelscale;
+ if(!this.scale)
+ this.scale = 1;
+ if(this.model != "")
{
- precache_model(self.model);
- _setmodel(self, self.model); // no precision needed
+ precache_model(this.model);
+ _setmodel(this, this.model); // no precision needed
}
- setorigin(self, self.origin);
- if(self.scale)
- setsize(self, self.mins * self.scale, self.maxs * self.scale);
+ setorigin(this, this.origin);
+ if(this.scale)
+ setsize(this, this.mins * this.scale, this.maxs * this.scale);
else
- setsize(self, self.mins, self.maxs);
- if(!self.solid)
- self.solid = SOLID_BSP;
- else if(self.solid < 0)
- self.solid = SOLID_NOT;
- self.SendEntity = WarpZone_Camera_Send;
- self.SendFlags = 0xFFFFFF;
- self.warpzone_next = warpzone_camera_first;
- warpzone_camera_first = self;
+ setsize(this, this.mins, this.maxs);
+ if(!this.solid)
+ this.solid = SOLID_BSP;
+ else if(this.solid < 0)
+ this.solid = SOLID_NOT;
+ this.SendEntity = SendEntity_self;
+ this.SendEntity3 = WarpZone_Camera_Send;
+ this.SendFlags = 0xFFFFFF;
+ this.warpzone_next = warpzone_camera_first;
+ warpzone_camera_first = this;
}
void WarpZones_Reconnect()
{SELFPARAM();
if(warpzone_warpzones_exist)
WarpZone_StoreProjectileData(it);
- if((IS_OBSERVER(it) || it.solid == SOLID_NOT))
+ if(IS_OBSERVER(it) || it.solid == SOLID_NOT)
if(IS_CLIENT(it)) // we don't care about it being a bot
{
other = it; // player
}
// teleporters
- setself(Teleport_Find(it.origin + it.mins, it.origin + it.maxs));
- if (self)
- if (!WarpZoneLib_ExactTrigger_Touch())
- Simple_TeleportPlayer(self, other); // NOT triggering targets by this!
+ if(other.teleportable)
+ {
+ setself(Teleport_Find(it.origin + it.mins, it.origin + it.maxs));
+ if (self)
+ if (!WarpZoneLib_ExactTrigger_Touch())
+ Simple_TeleportPlayer(self, other); // NOT triggering targets by this!
+ }
}
});
setself(this);
spawnfunc(trigger_warpzone_reconnect)
{
- self.use = trigger_warpzone_reconnect_use;
+ this.use = trigger_warpzone_reconnect_use;
}
spawnfunc(target_warpzone_reconnect)
spawnfunc_trigger_warpzone_reconnect(this); // both names make sense here :(
}
-void WarpZone_PlayerPhysics_FixVAngle()
-{SELFPARAM();
+void WarpZone_PlayerPhysics_FixVAngle(entity this)
+{
#ifndef WARPZONE_DONT_FIX_VANGLE
- if(IS_REAL_CLIENT(self))
- if(self.v_angle.z <= 360) // if not already adjusted
- if(time - self.ping * 0.001 < self.warpzone_teleport_time)
+ if(IS_REAL_CLIENT(this))
+ if(this.v_angle.z <= 360) // if not already adjusted
+ if(time - this.ping * 0.001 < this.warpzone_teleport_time)
{
- self.v_angle = WarpZone_TransformVAngles(self.warpzone_teleport_zone, self.v_angle);
- self.v_angle_z += 720; // mark as adjusted
+ this.v_angle = WarpZone_TransformVAngles(this.warpzone_teleport_zone, this.v_angle);
+ this.v_angle_z += 720; // mark as adjusted
}
#endif
}
//const float ENT_CLIENT_WARPZONE;
//const float ENT_CLIENT_WARPZONE_CAMERA;
-void WarpZone_PlayerPhysics_FixVAngle();
+void WarpZone_PlayerPhysics_FixVAngle(entity this);
void WarpZone_PostInitialize_Callback();
#endif
void WarpZoneLib_ExactTrigger_Init()
{SELFPARAM();
vector mi, ma;
- if (self.movedir == '0 0 0')
- if (self.angles != '0 0 0')
+ if (this.movedir == '0 0 0')
+ if (this.angles != '0 0 0')
{
- makevectors (self.angles);
- self.movedir = v_forward;
+ makevectors (this.angles);
+ this.movedir = v_forward;
}
- if(self.model == "")
+ if(this.model == "")
{
// It's a box! No need to match with exacttriggers.
- self.warpzone_isboxy = 1;
+ this.warpzone_isboxy = 1;
}
else
{
- mi = self.mins;
- ma = self.maxs;
- precache_model(self.model);
- _setmodel(self, self.model);
+ mi = this.mins;
+ ma = this.maxs;
+ precache_model(this.model);
+ _setmodel(this, this.model);
// let mapper-set mins/maxs override the model's bounds if set
if(mi != '0 0 0' || ma != '0 0 0')
{
// It's a box! No need to match with exacttriggers.
- self.mins = mi;
- self.maxs = ma;
- self.warpzone_isboxy = 1;
+ this.mins = mi;
+ this.maxs = ma;
+ this.warpzone_isboxy = 1;
}
}
- setorigin(self, self.origin);
- if(self.scale)
- setsize(self, self.mins * self.scale, self.maxs * self.scale);
+ setorigin(this, this.origin);
+ if(this.scale)
+ setsize(this, this.mins * this.scale, this.maxs * this.scale);
else
- setsize(self, self.mins, self.maxs);
- self.movetype = MOVETYPE_NONE;
- self.solid = SOLID_TRIGGER;
- self.model = "";
+ setsize(this, this.mins, this.maxs);
+ this.movetype = MOVETYPE_NONE;
+ this.solid = SOLID_TRIGGER;
+ this.model = "";
}
--- /dev/null
+// generated file; do not modify
+#include "draw.qc"
+#include "item.qc"
+#include "menu.qc"
--- /dev/null
+// generated file; do not modify
+#include "animation.qc"
+#include "animhost.qc"
+#include "easing.qc"
+#include "keyframe.qc"
-#include "anim/animation.qc"
-#include "anim/animhost.qc"
-#include "anim/easing.qc"
-#include "anim/keyframe.qc"
-#include "item.qc"
-#include "item/borderimage.qc"
-#include "item/button.qc"
-#include "item/checkbox.qc"
-#include "item/container.qc"
-#include "item/dialog.qc"
-#include "item/image.qc"
-#include "item/inputbox.qc"
-#include "item/inputcontainer.qc"
-#include "item/label.qc"
-#include "item/listbox.qc"
-#include "item/modalcontroller.qc"
-#include "item/nexposee.qc"
-#include "item/radiobutton.qc"
-#include "item/slider.qc"
-#include "item/tab.qc"
-#include "item/textslider.qc"
-
-#include "xonotic/bigbutton.qc"
-#include "xonotic/bigcommandbutton.qc"
-#include "xonotic/button.qc"
-#include "xonotic/campaign.qc"
-#include "xonotic/charmap.qc"
-#include "xonotic/checkbox.qc"
-#include "xonotic/checkbox_slider_invalid.qc"
-#include "xonotic/checkbox_string.qc"
-#include "xonotic/colorbutton.qc"
-#include "xonotic/colorpicker.qc"
-#include "xonotic/colorpicker_string.qc"
-#include "xonotic/commandbutton.qc"
-#include "xonotic/credits.qc"
-#include "xonotic/crosshairpicker.qc"
-#include "xonotic/crosshairpreview.qc"
-#include "xonotic/cvarlist.qc"
-#include "xonotic/datasource.qc"
-#include "xonotic/demolist.qc"
-#include "xonotic/dialog.qc"
-#include "xonotic/dialog_credits.qc"
-#include "xonotic/dialog_firstrun.qc"
-#include "xonotic/dialog_hudpanel_ammo.qc"
-#include "xonotic/dialog_hudpanel_centerprint.qc"
-#include "xonotic/dialog_hudpanel_chat.qc"
-#include "xonotic/dialog_hudpanel_engineinfo.qc"
-#include "xonotic/dialog_hudpanel_healtharmor.qc"
-#include "xonotic/dialog_hudpanel_infomessages.qc"
-#include "xonotic/dialog_hudpanel_itemstime.qc"
-#include "xonotic/dialog_hudpanel_modicons.qc"
-#include "xonotic/dialog_hudpanel_notification.qc"
-#include "xonotic/dialog_hudpanel_physics.qc"
-#include "xonotic/dialog_hudpanel_powerups.qc"
-#include "xonotic/dialog_hudpanel_pressedkeys.qc"
-#include "xonotic/dialog_hudpanel_quickmenu.qc"
-#include "xonotic/dialog_hudpanel_racetimer.qc"
-#include "xonotic/dialog_hudpanel_radar.qc"
-#include "xonotic/dialog_hudpanel_score.qc"
-#include "xonotic/dialog_hudpanel_timer.qc"
-#include "xonotic/dialog_hudpanel_vote.qc"
-#include "xonotic/dialog_hudpanel_weapons.qc"
-#include "xonotic/dialog_hudsetup_exit.qc"
-#include "xonotic/dialog_monstertools.qc"
-#include "xonotic/dialog_multiplayer.qc"
-#include "xonotic/dialog_multiplayer_create.qc"
-#include "xonotic/dialog_multiplayer_create_mapinfo.qc"
-#include "xonotic/dialog_multiplayer_create_mutators.qc"
-#include "xonotic/dialog_multiplayer_join.qc"
-#include "xonotic/dialog_multiplayer_join_serverinfo.qc"
-#include "xonotic/dialog_multiplayer_media.qc"
-#include "xonotic/dialog_multiplayer_media_demo.qc"
-#include "xonotic/dialog_multiplayer_media_demo_startconfirm.qc"
-#include "xonotic/dialog_multiplayer_media_demo_timeconfirm.qc"
-#include "xonotic/dialog_multiplayer_media_musicplayer.qc"
-#include "xonotic/dialog_multiplayer_media_screenshot.qc"
-#include "xonotic/dialog_multiplayer_media_screenshot_viewer.qc"
-#include "xonotic/dialog_multiplayer_profile.qc"
-#include "xonotic/dialog_quit.qc"
-#include "xonotic/dialog_sandboxtools.qc"
-#include "xonotic/dialog_settings.qc"
-#include "xonotic/dialog_settings_audio.qc"
-#include "xonotic/dialog_settings_effects.qc"
-#include "xonotic/dialog_settings_game.qc"
-#include "xonotic/dialog_settings_game_crosshair.qc"
-#include "xonotic/dialog_settings_game_hudconfirm.qc"
-#include "xonotic/dialog_settings_game_hud.qc"
-#include "xonotic/dialog_settings_game_messages.qc"
-#include "xonotic/dialog_settings_game_model.qc"
-#include "xonotic/dialog_settings_game_view.qc"
-#include "xonotic/dialog_settings_game_weapons.qc"
-#include "xonotic/dialog_settings_input.qc"
-#include "xonotic/dialog_settings_input_userbind.qc"
-#include "xonotic/dialog_settings_misc.qc"
-#include "xonotic/dialog_settings_misc_cvars.qc"
-#include "xonotic/dialog_settings_misc_reset.qc"
-#include "xonotic/dialog_settings_user.qc"
-#include "xonotic/dialog_settings_user_languagewarning.qc"
-#include "xonotic/dialog_settings_video.qc"
-#include "xonotic/dialog_singleplayer.qc"
-#include "xonotic/dialog_singleplayer_winner.qc"
-#include "xonotic/dialog_teamselect.qc"
-#include "xonotic/gametypelist.qc"
-#include "xonotic/hudskinlist.qc"
-#include "xonotic/image.qc"
-#include "xonotic/inputbox.qc"
-#include "xonotic/keybinder.qc"
-#include "xonotic/languagelist.qc"
-#include "xonotic/listbox.qc"
-#include "xonotic/mainwindow.qc"
-#include "xonotic/maplist.qc"
-#include "xonotic/nexposee.qc"
-#include "xonotic/picker.qc"
-#include "xonotic/playerlist.qc"
-#include "xonotic/playermodel.qc"
-#include "xonotic/playlist.qc"
-#include "xonotic/radiobutton.qc"
-#include "xonotic/rootdialog.qc"
-#include "xonotic/screenshotimage.qc"
-#include "xonotic/screenshotlist.qc"
-#include "xonotic/serverlist.qc"
-#include "xonotic/skinlist.qc"
-#include "xonotic/slider.qc"
-#include "xonotic/slider_decibels.qc"
-#include "xonotic/slider_particles.qc"
-#include "xonotic/slider_picmip.qc"
-#include "xonotic/slider_resolution.qc"
-#include "xonotic/slider_sbfadetime.qc"
-#include "xonotic/soundlist.qc"
-#include "xonotic/statslist.qc"
-#include "xonotic/tabcontroller.qc"
-#include "xonotic/tab.qc"
-#include "xonotic/textlabel.qc"
-#include "xonotic/textslider.qc"
-#include "xonotic/weaponarenacheckbox.qc"
-#include "xonotic/weaponslist.qc"
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
+#include "menu_cmd.qc"
--- /dev/null
+#include <common/command/all.qc>
{
LOG_INFO(_("Available options:\n"));
- FOREACH_ENTITY_ORDERED(it.name != "", LAMBDA(
+ FOREACH_ENTITY_ORDERED(it.name != "", {
if (it.classname == "vtbl") continue;
string s = it.name;
if (filter)
s = substring(s, strlen(filter), strlen(s) - strlen(filter));
}
LOG_INFOF(" %s\n", s);
- ));
+ });
}
else if (argc == 2 && !isdemo()) // don't allow this command in demos
{
return 0; // unhandled
}
+ void m_play_focus_sound();
+
METHOD(Item, focusEnter, void(Item this))
{
if (this.allowFocusSound) m_play_focus_sound();
--- /dev/null
+// generated file; do not modify
+#include "borderimage.qc"
+#include "button.qc"
+#include "checkbox.qc"
+#include "container.qc"
+#include "dialog.qc"
+#include "image.qc"
+#include "inputbox.qc"
+#include "inputcontainer.qc"
+#include "label.qc"
+#include "listbox.qc"
+#include "modalcontroller.qc"
+#include "nexposee.qc"
+#include "radiobutton.qc"
+#include "slider.qc"
+#include "tab.qc"
+#include "textslider.qc"
void m_draw(float width, float height)
{
+ if (clientstate() == CS_DISCONNECTED) m_toggle(true);
m_gamestatus();
execute_next_frame();
void Shutdown()
{
m_hide();
- FOREACH_ENTITY_ORDERED(it.destroy, LAMBDA(
+ FOREACH_ENTITY_ORDERED(it.destroy, {
if (it.classname == "vtbl") continue;
it.destroy(it);
- ));
+ });
}
void m_focus_item_chain(entity outermost, entity innermost)
--- /dev/null
+// generated file; do not modify
-#include "../lib/_all.inc"
-
-#define world NULL
-
-#include "classes.inc"
-
-#include "draw.qc"
-#include "menu.qc"
-
-#include <common/command/all.qc>
-#include "command/menu_cmd.qc"
-
-#include "xonotic/util.qc"
+#include <lib/_all.inc>
+
+#include "_mod.inc"
+#include "anim/_mod.inc"
+#include "command/_mod.inc"
+#include "item/_mod.inc"
+#include "mutators/_mod.inc"
+#include "xonotic/_mod.inc"
#include <common/_all.inc>
--- /dev/null
+// generated file; do not modify
+#include "bigbutton.qc"
+#include "bigcommandbutton.qc"
+#include "button.qc"
+#include "campaign.qc"
+#include "charmap.qc"
+#include "checkbox.qc"
+#include "checkbox_slider_invalid.qc"
+#include "checkbox_string.qc"
+#include "colorbutton.qc"
+#include "colorpicker.qc"
+#include "colorpicker_string.qc"
+#include "commandbutton.qc"
+#include "credits.qc"
+#include "crosshairpicker.qc"
+#include "crosshairpreview.qc"
+#include "cvarlist.qc"
+#include "datasource.qc"
+#include "demolist.qc"
+#include "dialog.qc"
+#include "dialog_credits.qc"
+#include "dialog_firstrun.qc"
+#include "dialog_hudpanel_ammo.qc"
+#include "dialog_hudpanel_centerprint.qc"
+#include "dialog_hudpanel_chat.qc"
+#include "dialog_hudpanel_engineinfo.qc"
+#include "dialog_hudpanel_healtharmor.qc"
+#include "dialog_hudpanel_infomessages.qc"
+#include "dialog_hudpanel_itemstime.qc"
+#include "dialog_hudpanel_modicons.qc"
+#include "dialog_hudpanel_notification.qc"
+#include "dialog_hudpanel_physics.qc"
+#include "dialog_hudpanel_powerups.qc"
+#include "dialog_hudpanel_pressedkeys.qc"
+#include "dialog_hudpanel_quickmenu.qc"
+#include "dialog_hudpanel_racetimer.qc"
+#include "dialog_hudpanel_radar.qc"
+#include "dialog_hudpanel_score.qc"
+#include "dialog_hudpanel_timer.qc"
+#include "dialog_hudpanel_vote.qc"
+#include "dialog_hudpanel_weapons.qc"
+#include "dialog_hudsetup_exit.qc"
+#include "dialog_monstertools.qc"
+#include "dialog_multiplayer.qc"
+#include "dialog_multiplayer_create.qc"
+#include "dialog_multiplayer_create_mapinfo.qc"
+#include "dialog_multiplayer_create_mutators.qc"
+#include "dialog_multiplayer_join.qc"
+#include "dialog_multiplayer_join_serverinfo.qc"
+#include "dialog_multiplayer_media.qc"
+#include "dialog_multiplayer_media_demo.qc"
+#include "dialog_multiplayer_media_demo_startconfirm.qc"
+#include "dialog_multiplayer_media_demo_timeconfirm.qc"
+#include "dialog_multiplayer_media_musicplayer.qc"
+#include "dialog_multiplayer_media_screenshot.qc"
+#include "dialog_multiplayer_media_screenshot_viewer.qc"
+#include "dialog_multiplayer_profile.qc"
+#include "dialog_quit.qc"
+#include "dialog_sandboxtools.qc"
+#include "dialog_settings.qc"
+#include "dialog_settings_audio.qc"
+#include "dialog_settings_effects.qc"
+#include "dialog_settings_game.qc"
+#include "dialog_settings_game_crosshair.qc"
+#include "dialog_settings_game_hud.qc"
+#include "dialog_settings_game_hudconfirm.qc"
+#include "dialog_settings_game_messages.qc"
+#include "dialog_settings_game_model.qc"
+#include "dialog_settings_game_view.qc"
+#include "dialog_settings_game_weapons.qc"
+#include "dialog_settings_input.qc"
+#include "dialog_settings_input_userbind.qc"
+#include "dialog_settings_misc.qc"
+#include "dialog_settings_misc_cvars.qc"
+#include "dialog_settings_misc_reset.qc"
+#include "dialog_settings_user.qc"
+#include "dialog_settings_user_languagewarning.qc"
+#include "dialog_settings_video.qc"
+#include "dialog_singleplayer.qc"
+#include "dialog_singleplayer_winner.qc"
+#include "dialog_teamselect.qc"
+#include "gametypelist.qc"
+#include "hudskinlist.qc"
+#include "image.qc"
+#include "inputbox.qc"
+#include "keybinder.qc"
+#include "languagelist.qc"
+#include "listbox.qc"
+#include "mainwindow.qc"
+#include "maplist.qc"
+#include "nexposee.qc"
+#include "picker.qc"
+#include "playerlist.qc"
+#include "playermodel.qc"
+#include "playlist.qc"
+#include "radiobutton.qc"
+#include "rootdialog.qc"
+#include "screenshotimage.qc"
+#include "screenshotlist.qc"
+#include "serverlist.qc"
+#include "skinlist.qc"
+#include "slider.qc"
+#include "slider_decibels.qc"
+#include "slider_particles.qc"
+#include "slider_picmip.qc"
+#include "slider_resolution.qc"
+#include "slider_sbfadetime.qc"
+#include "soundlist.qc"
+#include "statslist.qc"
+#include "tab.qc"
+#include "tabcontroller.qc"
+#include "textlabel.qc"
+#include "textslider.qc"
+#include "util.qc"
+#include "weaponarenacheckbox.qc"
+#include "weaponslist.qc"
#define IS_OBSERVER(v) ((v).classname == STR_OBSERVER)
#define IS_CLIENT(v) (v.flags & FL_CLIENT)
+/** want: (IS_CLIENT(v) && !IS_REAL_CLIENT(v)) */
#define IS_BOT_CLIENT(v) (clienttype(v) == CLIENTTYPE_BOT)
+#define IS_FAKE_CLIENT(v) (clienttype(v) == CLIENTTYPE_NOTACLIENT)
#define IS_REAL_CLIENT(v) (clienttype(v) == CLIENTTYPE_REAL)
-#define IS_NOT_A_CLIENT(v) (clienttype(v) == CLIENTTYPE_NOTACLIENT)
+/** was: (clienttype(v) == CLIENTTYPE_NOTACLIENT) */
+#define IS_NOT_A_CLIENT(v) (!IS_CLIENT(v))
#define IS_MONSTER(v) (v.flags & FL_MONSTER)
#define IS_VEHICLE(v) (v.vehicle_flags & VHF_ISVEHICLE)
--- /dev/null
+// generated file; do not modify
+#include "anticheat.qc"
+#include "antilag.qc"
+#include "campaign.qc"
+#include "cheats.qc"
+#include "cl_client.qc"
+#include "cl_impulse.qc"
+#include "cl_player.qc"
+#include "g_damage.qc"
+#include "g_hook.qc"
+#include "g_lights.qc"
+#include "g_models.qc"
+#include "g_subs.qc"
+#include "g_world.qc"
+#include "ipban.qc"
+#include "item_key.qc"
+#include "mapvoting.qc"
+#include "miscfunctions.qc"
+#include "playerdemo.qc"
+#include "portals.qc"
+#include "race.qc"
+#include "round_handler.qc"
+#include "scores.qc"
+#include "scores_rules.qc"
+#include "spawnpoints.qc"
+#include "steerlib.qc"
+#include "sv_main.qc"
+#include "teamplay.qc"
+#include "tests.qc"
+#include "t_halflife.qc"
+#include "t_quake.qc"
+#include "t_quake3.qc"
{
if (e.vehicle) {
if (e.vehicle.vehicle_flags == VHF_PLAYERSLOT) return;
- antilag_takeback(e.vehicle, store, t);
+ antilag_takeback(e.vehicle, e.vehicle, t);
}
if (!store.antilag_takenback)
+++ /dev/null
-#include "aim.qc"
-#include "bot.qc"
-#include "navigation.qc"
-#include "scripting.qc"
-#include "waypoints.qc"
-
-#include "havocbot/_all.inc"
--- /dev/null
+// generated file; do not modify
+#include "aim.qc"
+#include "bot.qc"
+#include "navigation.qc"
+#include "scripting.qc"
+#include "waypoints.qc"
{
currentbots = currentbots + 1;
bot_setnameandstuff(bot);
- WITH(entity, self, bot, ClientConnect());
- WITH(entity, self, bot, PutClientInServer());
+ WITHSELF(bot, ClientConnect());
+ WITHSELF(bot, PutClientInServer());
}
return bot;
}
+++ /dev/null
-#include "havocbot.qc"
-#include "roles.qc"
--- /dev/null
+// generated file; do not modify
+#include "havocbot.qc"
+#include "roles.qc"
void SV_ParseClientCommand(string s);
float bot_cmd_cc(entity this)
{
- WITH(entity, self, this, SV_ParseClientCommand(bot_cmd.bot_cmd_parm_string));
+ WITHSELF(this, SV_ParseClientCommand(bot_cmd.bot_cmd_parm_string));
return CMD_STATUS_FINISHED;
}
cheatcount_total += n; \
e.cheatcount += n
#define END_CHEAT_FUNCTION() \
- ADD_CHEATS(self,cheating); \
+ ADD_CHEATS(this, cheating); \
return attempting
#define IS_CHEAT(i,argc,fr) \
if((++attempting, !CheatsAllowed(i,argc,fr))) \
e.angles = fixedvectoangles2(trace_plane_normal, v_forward);
e.angles = AnglesTransform_ApplyToAngles(e.angles, '-90 0 0'); // so unrotated models work
}
- WITH(entity, self, e, spawnfunc_func_breakable(e));
+ WITHSELF(e, spawnfunc_func_breakable(e));
// now, is it valid?
if(f == 0)
{
switch(0)
{
default:
- if(self.maycheat || (gamestart_sv_cheats && autocvar_sv_cheats))
+ if(this.maycheat || (gamestart_sv_cheats && autocvar_sv_cheats))
{
// use cheat dragging if cheats are enabled
- crosshair_trace_plusvisibletriggers(self);
+ crosshair_trace_plusvisibletriggers(this);
Drag(true, true);
}
else
switch(0)
{
default:
- if(Drag_IsDragging(self))
+ if(Drag_IsDragging(this))
{
- if(PHYS_INPUT_BUTTON_DRAG(self))
+ if(PHYS_INPUT_BUTTON_DRAG(this))
{
- if(self.impulse == 10 || self.impulse == 15 || self.impulse == 18)
+ if(this.impulse == 10 || this.impulse == 15 || this.impulse == 18)
{
- Drag_MoveForward(self);
- self.impulse = 0;
+ Drag_MoveForward(this);
+ this.impulse = 0;
}
- else if(self.impulse == 12 || self.impulse == 16 || self.impulse == 19)
+ else if(this.impulse == 12 || this.impulse == 16 || this.impulse == 19)
{
- Drag_MoveBackward(self);
- self.impulse = 0;
+ Drag_MoveBackward(this);
+ this.impulse = 0;
}
- else if(self.impulse >= 1 && self.impulse <= 9)
+ else if(this.impulse >= 1 && this.impulse <= 9)
{
- Drag_SetSpeed(self, self.impulse - 1);
+ Drag_SetSpeed(this, this.impulse - 1);
}
- else if(self.impulse == 14)
+ else if(this.impulse == 14)
{
- Drag_SetSpeed(self, 9);
+ Drag_SetSpeed(this, 9);
}
if(frametime)
- Drag_Update(self);
+ Drag_Update(this);
}
else
{
- Drag_Finish(self);
+ Drag_Finish(this);
}
}
else
{
- if(Drag_CanDrag(self))
- if(PHYS_INPUT_BUTTON_DRAG(self))
+ if(Drag_CanDrag(this))
+ if(PHYS_INPUT_BUTTON_DRAG(this))
{
- crosshair_trace_plusvisibletriggers(self);
+ crosshair_trace_plusvisibletriggers(this);
entity e = trace_ent;
float pick = force_allow_pick;
if (e && !pick)
// This also makes sure that an object can only pe picked up if in range, but does not get dropped if
// it goes out of range while slinging it around.
- if(vlen(self.origin - e.origin) <= autocvar_g_grab_range)
+ if(vlen(this.origin - e.origin) <= autocvar_g_grab_range)
{
switch(e.grab)
{
case 0: // can't grab
break;
case 1: // owner can grab
- if(e.owner == self || e.realowner == self)
+ if(e.owner == this || e.realowner == this)
pick = true;
break;
case 2: // owner and team mates can grab
- if(SAME_TEAM(e.owner, self) || SAME_TEAM(e.realowner, self) || e.team == self.team)
+ if(SAME_TEAM(e.owner, this) || SAME_TEAM(e.realowner, this) || e.team == this.team)
pick = true;
break;
case 3: // anyone can grab
Drag_Finish(e.draggedby);
if(e.tag_entity)
detach_sameorigin(e);
- Drag_Begin(self, e, trace_endpos);
+ Drag_Begin(this, e, trace_endpos);
if(ischeat)
DID_CHEAT();
return true;
void DragBox_Think()
{SELFPARAM();
- if(self.aiment && self.enemy)
+ if(this.aiment && this.enemy)
{
- self.origin_x = (self.aiment.origin.x + self.enemy.origin.x) * 0.5;
- self.origin_y = (self.aiment.origin.y + self.enemy.origin.y) * 0.5;
- self.origin_z = (self.aiment.origin.z + self.enemy.origin.z) * 0.5;
- self.maxs_x = fabs(self.aiment.origin.x - self.enemy.origin.x) * 0.5;
- self.maxs_y = fabs(self.aiment.origin.y - self.enemy.origin.y) * 0.5;
- self.maxs_z = fabs(self.aiment.origin.z - self.enemy.origin.z) * 0.5;
- self.mins = -1 * self.maxs;
- setorigin(self, self.origin);
- setsize(self, self.mins, self.maxs); // link edict
+ this.origin_x = (this.aiment.origin.x + this.enemy.origin.x) * 0.5;
+ this.origin_y = (this.aiment.origin.y + this.enemy.origin.y) * 0.5;
+ this.origin_z = (this.aiment.origin.z + this.enemy.origin.z) * 0.5;
+ this.maxs_x = fabs(this.aiment.origin.x - this.enemy.origin.x) * 0.5;
+ this.maxs_y = fabs(this.aiment.origin.y - this.enemy.origin.y) * 0.5;
+ this.maxs_z = fabs(this.aiment.origin.z - this.enemy.origin.z) * 0.5;
+ this.mins = -1 * this.maxs;
+ setorigin(this, this.origin);
+ setsize(this, this.mins, this.maxs); // link edict
}
- if(self.cnt == -1) // actually race_place -1
+ if(this.cnt == -1) // actually race_place -1
{
// show "10 10" for qualifying spawns
- setmodel(self.killindicator, MDL_NUM(10));
- setmodel(self.killindicator.killindicator, MDL_NUM(10));
+ setmodel(this.killindicator, MDL_NUM(10));
+ setmodel(this.killindicator.killindicator, MDL_NUM(10));
}
- else if(self.cnt == -2) // actually race_place 0
+ else if(this.cnt == -2) // actually race_place 0
{
// show "10 0" for loser spawns
- setmodel(self.killindicator, MDL_NUM(10));
- setmodel(self.killindicator.killindicator, MDL_NUM(0));
+ setmodel(this.killindicator, MDL_NUM(10));
+ setmodel(this.killindicator.killindicator, MDL_NUM(0));
}
else
{
- setmodel(self.killindicator, MDL_NUM(self.cnt % 10));
- setmodel(self.killindicator.killindicator, MDL_NUM(floor(self.cnt / 10)));
+ setmodel(this.killindicator, MDL_NUM(this.cnt % 10));
+ setmodel(this.killindicator.killindicator, MDL_NUM(floor(this.cnt / 10)));
}
- self.nextthink = time;
+ this.nextthink = time;
}
#endif
STATIC_METHOD(Client, Add, void(Client this, int _team))
{
- WITH(entity, self, this, ClientConnect());
+ WITHSELF(this, ClientConnect());
TRANSMUTE(Player, this);
this.frame = 12; // 7
this.team = _team;
- WITH(entity, self, this, PutClientInServer());
+ WITHSELF(this, PutClientInServer());
}
void PutObserverInServer();
STATIC_METHOD(Client, Remove, void(Client this))
{
TRANSMUTE(Observer, this);
- WITH(entity, self, this, PutClientInServer(); ClientDisconnect());
+ WITHSELF(this, PutClientInServer());
+ WITHSELF(this, ClientDisconnect());
}
void send_CSQC_teamnagger() {
string s = spot.target;
spot.target = string_null;
WITH(entity, activator, this, LAMBDA(
- WITH(entity, self, spot, SUB_UseTargets())
+ WITHSELF(spot, SUB_UseTargets())
));
spot.target = s;
}
WriteString(channel, world.fog);
else
WriteString(channel, "");
- WriteByte(channel, self.count * 255.0); // g_balance_armor_blockpercent
+ WriteByte(channel, this.count * 255.0); // g_balance_armor_blockpercent
WriteByte(channel, serverflags); // client has to know if it should zoom or not
WriteCoord(channel, autocvar_g_trueaim_minrange);
}
void ClientInit_CheckUpdate()
{SELFPARAM();
- self.nextthink = time;
- if(self.count != autocvar_g_balance_armor_blockpercent)
+ this.nextthink = time;
+ if(this.count != autocvar_g_balance_armor_blockpercent)
{
- self.count = autocvar_g_balance_armor_blockpercent;
- self.SendFlags |= 1;
+ this.count = autocvar_g_balance_armor_blockpercent;
+ this.SendFlags |= 1;
}
}
e.think = ClientInit_CheckUpdate;
Net_LinkEntity(e, false, 0, ClientInit_SendEntity);
- WITH(entity, self, e, ClientInit_CheckUpdate());
+ WITHSELF(e, ClientInit_CheckUpdate());
}
/*
void SetChangeParms ()
{SELFPARAM();
// save parms for level change
- parm1 = self.parm_idlesince - time;
+ parm1 = this.parm_idlesince - time;
MUTATOR_CALLHOOK(SetChangeParms);
}
{
if(blockSpectators)
Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
- WITH(entity, self, this, PutObserverInServer());
+ WITHSELF(this, PutObserverInServer());
}
else
- WITH(entity, self, this, SV_ChangeTeam(this.killindicator_teamchange - 1));
+ WITHSELF(this, SV_ChangeTeam(this.killindicator_teamchange - 1));
this.killindicator_teamchange = 0;
}
void ClientKill_Now()
{SELFPARAM();
- if(self.vehicle)
+ if(this.vehicle)
{
vehicles_exit(VHEF_RELEASE);
- if(!self.killindicator_teamchange)
+ if(!this.killindicator_teamchange)
{
- self.vehicle_health = -1;
- Damage(self, self, self, 1 , DEATH_KILL.m_id, self.origin, '0 0 0');
+ this.vehicle_health = -1;
+ Damage(this, this, this, 1 , DEATH_KILL.m_id, this.origin, '0 0 0');
}
}
- if(self.killindicator && !wasfreed(self.killindicator))
- remove(self.killindicator);
+ if(this.killindicator && !wasfreed(this.killindicator))
+ remove(this.killindicator);
- self.killindicator = world;
+ this.killindicator = world;
- if(self.killindicator_teamchange)
- ClientKill_Now_TeamChange(self);
+ if(this.killindicator_teamchange)
+ ClientKill_Now_TeamChange(this);
- if(IS_PLAYER(self))
- Damage(self, self, self, 100000, DEATH_KILL.m_id, self.origin, '0 0 0');
+ if(IS_PLAYER(this))
+ Damage(this, this, this, 100000, DEATH_KILL.m_id, this.origin, '0 0 0');
// now I am sure the player IS dead
}
{SELFPARAM();
if (gameover)
{
- self.owner.killindicator = world;
- remove(self);
+ this.owner.killindicator = world;
+ remove(this);
return;
}
- if (self.owner.alpha < 0 && !self.owner.vehicle)
+ if (this.owner.alpha < 0 && !this.owner.vehicle)
{
- self.owner.killindicator = world;
- remove(self);
+ this.owner.killindicator = world;
+ remove(this);
return;
}
- if(self.cnt <= 0)
+ if(this.cnt <= 0)
{
- WITH(entity, self, self.owner, ClientKill_Now());
+ WITHSELF(this.owner, ClientKill_Now());
return;
}
- else if(g_cts && self.health == 1) // health == 1 means that it's silent
+ else if(g_cts && this.health == 1) // health == 1 means that it's silent
{
- self.nextthink = time + 1;
- self.cnt -= 1;
+ this.nextthink = time + 1;
+ this.cnt -= 1;
}
else
{
- if(self.cnt <= 10)
- setmodel(self, MDL_NUM(self.cnt));
- if(IS_REAL_CLIENT(self.owner))
+ if(this.cnt <= 10)
+ setmodel(this, MDL_NUM(this.cnt));
+ if(IS_REAL_CLIENT(this.owner))
{
- if(self.cnt <= 10)
- { Send_Notification(NOTIF_ONE, self.owner, MSG_ANNCE, Announcer_PickNumber(CNT_KILL, self.cnt)); }
+ if(this.cnt <= 10)
+ { Send_Notification(NOTIF_ONE, this.owner, MSG_ANNCE, Announcer_PickNumber(CNT_KILL, this.cnt)); }
}
- self.nextthink = time + 1;
- self.cnt -= 1;
+ this.nextthink = time + 1;
+ this.cnt -= 1;
}
}
if(g_race_qualifying || g_cts)
killtime = 0;
- if(MUTATOR_CALLHOOK(ClientKill, self, killtime))
+ if(MUTATOR_CALLHOOK(ClientKill, this, killtime))
return;
- self.killindicator_teamchange = targetteam;
+ this.killindicator_teamchange = targetteam;
- if(!self.killindicator)
+ if(!this.killindicator)
{
- if(!IS_DEAD(self))
+ if(!IS_DEAD(this))
{
- killtime = max(killtime, self.clientkill_nexttime - time);
- self.clientkill_nexttime = time + killtime + autocvar_g_balance_kill_antispam;
+ killtime = max(killtime, this.clientkill_nexttime - time);
+ this.clientkill_nexttime = time + killtime + autocvar_g_balance_kill_antispam;
}
- if(killtime <= 0 || !IS_PLAYER(self) || IS_DEAD(self))
+ if(killtime <= 0 || !IS_PLAYER(this) || IS_DEAD(this))
{
ClientKill_Now();
}
{
starttime = max(time, clientkilltime);
- self.killindicator = spawn();
- self.killindicator.owner = self;
- self.killindicator.scale = 0.5;
- setattachment(self.killindicator, self, "");
- setorigin(self.killindicator, '0 0 52');
- self.killindicator.think = KillIndicator_Think;
- self.killindicator.nextthink = starttime + (self.lip) * 0.05;
- clientkilltime = max(clientkilltime, self.killindicator.nextthink + 0.05);
- self.killindicator.cnt = ceil(killtime);
- self.killindicator.count = bound(0, ceil(killtime), 10);
- //sprint(self, strcat("^1You'll be dead in ", ftos(self.killindicator.cnt), " seconds\n"));
+ this.killindicator = spawn();
+ this.killindicator.owner = this;
+ this.killindicator.scale = 0.5;
+ setattachment(this.killindicator, this, "");
+ setorigin(this.killindicator, '0 0 52');
+ this.killindicator.think = KillIndicator_Think;
+ this.killindicator.nextthink = starttime + (this.lip) * 0.05;
+ clientkilltime = max(clientkilltime, this.killindicator.nextthink + 0.05);
+ this.killindicator.cnt = ceil(killtime);
+ this.killindicator.count = bound(0, ceil(killtime), 10);
+ //sprint(this, strcat("^1You'll be dead in ", ftos(this.killindicator.cnt), " seconds\n"));
for(e = world; (e = find(e, classname, "body")) != world; )
{
- if(e.enemy != self)
+ if(e.enemy != this)
continue;
e.killindicator = spawn();
e.killindicator.owner = e;
clientkilltime = max(clientkilltime, e.killindicator.nextthink + 0.05);
e.killindicator.cnt = ceil(killtime);
}
- self.lip = 0;
+ this.lip = 0;
}
}
- if(self.killindicator)
+ if(this.killindicator)
{
if(targetteam == 0) // just die
{
- self.killindicator.colormod = '0 0 0';
- if(IS_REAL_CLIENT(self))
- if(self.killindicator.cnt > 0)
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_TEAMCHANGE_SUICIDE, self.killindicator.cnt);
+ this.killindicator.colormod = '0 0 0';
+ if(IS_REAL_CLIENT(this))
+ if(this.killindicator.cnt > 0)
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_TEAMCHANGE_SUICIDE, this.killindicator.cnt);
}
else if(targetteam == -1) // auto
{
- self.killindicator.colormod = '0 1 0';
- if(IS_REAL_CLIENT(self))
- if(self.killindicator.cnt > 0)
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_TEAMCHANGE_AUTO, self.killindicator.cnt);
+ this.killindicator.colormod = '0 1 0';
+ if(IS_REAL_CLIENT(this))
+ if(this.killindicator.cnt > 0)
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_TEAMCHANGE_AUTO, this.killindicator.cnt);
}
else if(targetteam == -2) // spectate
{
- self.killindicator.colormod = '0.5 0.5 0.5';
- if(IS_REAL_CLIENT(self))
- if(self.killindicator.cnt > 0)
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_TEAMCHANGE_SPECTATE, self.killindicator.cnt);
+ this.killindicator.colormod = '0.5 0.5 0.5';
+ if(IS_REAL_CLIENT(this))
+ if(this.killindicator.cnt > 0)
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_TEAMCHANGE_SPECTATE, this.killindicator.cnt);
}
else
{
- self.killindicator.colormod = Team_ColorRGB(targetteam);
- if(IS_REAL_CLIENT(self))
- if(self.killindicator.cnt > 0)
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, APP_TEAM_NUM(targetteam, CENTER_TEAMCHANGE), self.killindicator.cnt);
+ this.killindicator.colormod = Team_ColorRGB(targetteam);
+ if(IS_REAL_CLIENT(this))
+ if(this.killindicator.cnt > 0)
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, APP_TEAM_NUM(targetteam, CENTER_TEAMCHANGE), this.killindicator.cnt);
}
}
void ClientKill ()
{SELFPARAM();
if(gameover) return;
- if(self.player_blocked) return;
- if(STAT(FROZEN, self)) return;
+ if(this.player_blocked) return;
+ if(STAT(FROZEN, this)) return;
ClientKill_TeamChange(0);
}
if(autocvar_sv_eventlog)
{
GameLogEcho(sprintf(":connect:%d:%d:%s",
- self.playerid,
- etof(self),
- ((IS_REAL_CLIENT(self)) ? self.netaddress : "bot")
+ this.playerid,
+ etof(this),
+ ((IS_REAL_CLIENT(this)) ? this.netaddress : "bot")
));
}
}
sv_notice_join(this);
FOREACH_ENTITY_FLOAT(init_for_player_needed, true, {
- WITH(entity, self, it, it.init_for_player(it));
+ WITHSELF(it, it.init_for_player(it));
});
MUTATOR_CALLHOOK(ClientConnect, this);
ClientState_detach(this);
- Portal_ClearAll(self);
+ Portal_ClearAll(this);
- Unfreeze(self);
+ Unfreeze(this);
- RemoveGrapplingHook(self);
+ RemoveGrapplingHook(this);
// Here, everything has been done that requires this player to be a client.
- self.flags &= ~FL_CLIENT;
+ this.flags &= ~FL_CLIENT;
if (this.chatbubbleentity) remove(this.chatbubbleentity);
if (this.killindicator) remove(this.killindicator);
bot_relinkplayerlist();
- if (self.netname_previous) strunzone(self.netname_previous);
- if (self.clientstatus) strunzone(self.clientstatus);
- if (self.weaponorder_byimpulse) strunzone(self.weaponorder_byimpulse);
- if (self.personal) remove(self.personal);
+ if (this.netname_previous) strunzone(this.netname_previous);
+ if (this.clientstatus) strunzone(this.clientstatus);
+ if (this.weaponorder_byimpulse) strunzone(this.weaponorder_byimpulse);
+ if (this.personal) remove(this.personal);
this.playerid = 0;
ReadyCount();
void ChatBubbleThink()
{SELFPARAM();
- self.nextthink = time;
- if ((self.owner.alpha < 0) || self.owner.chatbubbleentity != self)
+ this.nextthink = time;
+ if ((this.owner.alpha < 0) || this.owner.chatbubbleentity != this)
{
- if(self.owner) // but why can that ever be world?
- self.owner.chatbubbleentity = world;
- remove(self);
+ if(this.owner) // but why can that ever be world?
+ this.owner.chatbubbleentity = world;
+ remove(this);
return;
}
- self.mdl = "";
+ this.mdl = "";
- if ( !IS_DEAD(self.owner) && IS_PLAYER(self.owner) )
+ if ( !IS_DEAD(this.owner) && IS_PLAYER(this.owner) )
{
- if ( self.owner.active_minigame )
- self.mdl = "models/sprites/minigame_busy.iqm";
- else if (PHYS_INPUT_BUTTON_CHAT(self.owner))
- self.mdl = "models/misc/chatbubble.spr";
+ if ( this.owner.active_minigame )
+ this.mdl = "models/sprites/minigame_busy.iqm";
+ else if (PHYS_INPUT_BUTTON_CHAT(this.owner))
+ this.mdl = "models/misc/chatbubble.spr";
}
- if ( self.model != self.mdl )
- _setmodel(self, self.mdl);
+ if ( this.model != this.mdl )
+ _setmodel(this, this.mdl);
}
void UpdateChatBubble()
{SELFPARAM();
- if (self.alpha < 0)
+ if (this.alpha < 0)
return;
// spawn a chatbubble entity if needed
- if (!self.chatbubbleentity)
- {
- self.chatbubbleentity = new(chatbubbleentity);
- self.chatbubbleentity.owner = self;
- self.chatbubbleentity.exteriormodeltoclient = self;
- self.chatbubbleentity.think = ChatBubbleThink;
- self.chatbubbleentity.nextthink = time;
- setmodel(self.chatbubbleentity, MDL_CHAT); // precision set below
- //setorigin(self.chatbubbleentity, self.origin + '0 0 15' + self.maxs_z * '0 0 1');
- setorigin(self.chatbubbleentity, '0 0 15' + self.maxs_z * '0 0 1');
- setattachment(self.chatbubbleentity, self, ""); // sticks to moving player better, also conserves bandwidth
- self.chatbubbleentity.mdl = self.chatbubbleentity.model;
- //self.chatbubbleentity.model = "";
- self.chatbubbleentity.effects = EF_LOWPRECISION;
+ if (!this.chatbubbleentity)
+ {
+ this.chatbubbleentity = new(chatbubbleentity);
+ this.chatbubbleentity.owner = this;
+ this.chatbubbleentity.exteriormodeltoclient = this;
+ this.chatbubbleentity.think = ChatBubbleThink;
+ this.chatbubbleentity.nextthink = time;
+ setmodel(this.chatbubbleentity, MDL_CHAT); // precision set below
+ //setorigin(this.chatbubbleentity, this.origin + '0 0 15' + this.maxs_z * '0 0 1');
+ setorigin(this.chatbubbleentity, '0 0 15' + this.maxs_z * '0 0 1');
+ setattachment(this.chatbubbleentity, this, ""); // sticks to moving player better, also conserves bandwidth
+ this.chatbubbleentity.mdl = this.chatbubbleentity.model;
+ //this.chatbubbleentity.model = "";
+ this.chatbubbleentity.effects = EF_LOWPRECISION;
}
}
/*void UpdateColorModHack()
{
float c;
- c = self.clientcolors & 15;
+ c = this.clientcolors & 15;
// LordHavoc: only bothering to support white, green, red, yellow, blue
- if (!teamplay) self.colormod = '0 0 0';
- else if (c == 0) self.colormod = '1.00 1.00 1.00';
- else if (c == 3) self.colormod = '0.10 1.73 0.10';
- else if (c == 4) self.colormod = '1.73 0.10 0.10';
- else if (c == 12) self.colormod = '1.22 1.22 0.10';
- else if (c == 13) self.colormod = '0.10 0.10 1.73';
- else self.colormod = '1 1 1';
+ if (!teamplay) this.colormod = '0 0 0';
+ else if (c == 0) this.colormod = '1.00 1.00 1.00';
+ else if (c == 3) this.colormod = '0.10 1.73 0.10';
+ else if (c == 4) this.colormod = '1.73 0.10 0.10';
+ else if (c == 12) this.colormod = '1.22 1.22 0.10';
+ else if (c == 13) this.colormod = '0.10 0.10 1.73';
+ else this.colormod = '1 1 1';
}*/
void respawn()
{SELFPARAM();
- if(self.alpha >= 0 && autocvar_g_respawn_ghosts)
- {
- self.solid = SOLID_NOT;
- self.takedamage = DAMAGE_NO;
- self.movetype = MOVETYPE_FLY;
- self.velocity = '0 0 1' * autocvar_g_respawn_ghosts_speed;
- self.avelocity = randomvec() * autocvar_g_respawn_ghosts_speed * 3 - randomvec() * autocvar_g_respawn_ghosts_speed * 3;
- self.effects |= CSQCMODEL_EF_RESPAWNGHOST;
- Send_Effect(EFFECT_RESPAWN_GHOST, self.origin, '0 0 0', 1);
+ if(this.alpha >= 0 && autocvar_g_respawn_ghosts)
+ {
+ this.solid = SOLID_NOT;
+ this.takedamage = DAMAGE_NO;
+ this.movetype = MOVETYPE_FLY;
+ this.velocity = '0 0 1' * autocvar_g_respawn_ghosts_speed;
+ this.avelocity = randomvec() * autocvar_g_respawn_ghosts_speed * 3 - randomvec() * autocvar_g_respawn_ghosts_speed * 3;
+ this.effects |= CSQCMODEL_EF_RESPAWNGHOST;
+ Send_Effect(EFFECT_RESPAWN_GHOST, this.origin, '0 0 0', 1);
if(autocvar_g_respawn_ghosts_maxtime)
- SUB_SetFade (self, time + autocvar_g_respawn_ghosts_maxtime / 2 + random () * (autocvar_g_respawn_ghosts_maxtime - autocvar_g_respawn_ghosts_maxtime / 2), 1.5);
+ SUB_SetFade (this, time + autocvar_g_respawn_ghosts_maxtime / 2 + random () * (autocvar_g_respawn_ghosts_maxtime - autocvar_g_respawn_ghosts_maxtime / 2), 1.5);
}
- CopyBody(self, 1);
+ CopyBody(this, 1);
- self.effects |= EF_NODRAW; // prevent another CopyBody
+ this.effects |= EF_NODRAW; // prevent another CopyBody
PutClientInServer();
}
void play_countdown(float finished, Sound samp)
{SELFPARAM();
TC(Sound, samp);
- if(IS_REAL_CLIENT(self))
+ if(IS_REAL_CLIENT(this))
if(floor(finished - time - frametime) != floor(finished - time))
if(finished - time < 6)
- sound (self, CH_INFO, samp, VOL_BASE, ATTEN_NORM);
+ sound (this, CH_INFO, samp, VOL_BASE, ATTEN_NORM);
}
void player_powerups ()
{SELFPARAM();
// add a way to see what the items were BEFORE all of these checks for the mutator hook
- int items_prev = self.items;
+ int items_prev = this.items;
- if((self.items & IT_USING_JETPACK) && !IS_DEAD(self) && !gameover)
- self.modelflags |= MF_ROCKET;
+ if((this.items & IT_USING_JETPACK) && !IS_DEAD(this) && !gameover)
+ this.modelflags |= MF_ROCKET;
else
- self.modelflags &= ~MF_ROCKET;
+ this.modelflags &= ~MF_ROCKET;
- self.effects &= ~(EF_RED | EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT | EF_FLAME | EF_NODEPTHTEST);
+ this.effects &= ~(EF_RED | EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT | EF_FLAME | EF_NODEPTHTEST);
- if((self.alpha < 0 || IS_DEAD(self)) && !self.vehicle) // don't apply the flags if the player is gibbed
+ if((this.alpha < 0 || IS_DEAD(this)) && !this.vehicle) // don't apply the flags if the player is gibbed
return;
- Fire_ApplyDamage(self);
- Fire_ApplyEffect(self);
+ Fire_ApplyDamage(this);
+ Fire_ApplyEffect(this);
if (!g_instagib)
{
- if (self.items & ITEM_Strength.m_itemid)
+ if (this.items & ITEM_Strength.m_itemid)
{
- play_countdown(self.strength_finished, SND_POWEROFF);
- self.effects = self.effects | (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT);
- if (time > self.strength_finished)
+ play_countdown(this.strength_finished, SND_POWEROFF);
+ this.effects = this.effects | (EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT);
+ if (time > this.strength_finished)
{
- self.items = self.items - (self.items & ITEM_Strength.m_itemid);
- //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_STRENGTH, self.netname);
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_STRENGTH);
+ this.items = this.items - (this.items & ITEM_Strength.m_itemid);
+ //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_STRENGTH, this.netname);
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_POWERDOWN_STRENGTH);
}
}
else
{
- if (time < self.strength_finished)
+ if (time < this.strength_finished)
{
- self.items = self.items | ITEM_Strength.m_itemid;
- Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_STRENGTH, self.netname);
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_STRENGTH);
+ this.items = this.items | ITEM_Strength.m_itemid;
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_STRENGTH, this.netname);
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_POWERUP_STRENGTH);
}
}
- if (self.items & ITEM_Shield.m_itemid)
+ if (this.items & ITEM_Shield.m_itemid)
{
- play_countdown(self.invincible_finished, SND_POWEROFF);
- self.effects = self.effects | (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT);
- if (time > self.invincible_finished)
+ play_countdown(this.invincible_finished, SND_POWEROFF);
+ this.effects = this.effects | (EF_RED | EF_ADDITIVE | EF_FULLBRIGHT);
+ if (time > this.invincible_finished)
{
- self.items = self.items - (self.items & ITEM_Shield.m_itemid);
- //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_SHIELD, self.netname);
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERDOWN_SHIELD);
+ this.items = this.items - (this.items & ITEM_Shield.m_itemid);
+ //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERDOWN_SHIELD, this.netname);
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_POWERDOWN_SHIELD);
}
}
else
{
- if (time < self.invincible_finished)
+ if (time < this.invincible_finished)
{
- self.items = self.items | ITEM_Shield.m_itemid;
- Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SHIELD, self.netname);
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_POWERUP_SHIELD);
+ this.items = this.items | ITEM_Shield.m_itemid;
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_POWERUP_SHIELD, this.netname);
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_POWERUP_SHIELD);
}
}
- if (self.items & IT_SUPERWEAPON)
+ if (this.items & IT_SUPERWEAPON)
{
- if (!(self.weapons & WEPSET_SUPERWEAPONS))
+ if (!(this.weapons & WEPSET_SUPERWEAPONS))
{
- self.superweapons_finished = 0;
- self.items = self.items - (self.items & IT_SUPERWEAPON);
- //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_LOST, self.netname);
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_SUPERWEAPON_LOST);
+ this.superweapons_finished = 0;
+ this.items = this.items - (this.items & IT_SUPERWEAPON);
+ //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_LOST, this.netname);
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_SUPERWEAPON_LOST);
}
- else if (self.items & IT_UNLIMITED_SUPERWEAPONS)
+ else if (this.items & IT_UNLIMITED_SUPERWEAPONS)
{
// don't let them run out
}
else
{
- play_countdown(self.superweapons_finished, SND_POWEROFF);
- if (time > self.superweapons_finished)
+ play_countdown(this.superweapons_finished, SND_POWEROFF);
+ if (time > this.superweapons_finished)
{
- self.items = self.items - (self.items & IT_SUPERWEAPON);
- self.weapons &= ~WEPSET_SUPERWEAPONS;
- //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_BROKEN, self.netname);
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_SUPERWEAPON_BROKEN);
+ this.items = this.items - (this.items & IT_SUPERWEAPON);
+ this.weapons &= ~WEPSET_SUPERWEAPONS;
+ //Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_BROKEN, this.netname);
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_SUPERWEAPON_BROKEN);
}
}
}
- else if(self.weapons & WEPSET_SUPERWEAPONS)
+ else if(this.weapons & WEPSET_SUPERWEAPONS)
{
- if (time < self.superweapons_finished || (self.items & IT_UNLIMITED_SUPERWEAPONS))
+ if (time < this.superweapons_finished || (this.items & IT_UNLIMITED_SUPERWEAPONS))
{
- self.items = self.items | IT_SUPERWEAPON;
- Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_PICKUP, self.netname);
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_SUPERWEAPON_PICKUP);
+ this.items = this.items | IT_SUPERWEAPON;
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_SUPERWEAPON_PICKUP, this.netname);
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_SUPERWEAPON_PICKUP);
}
else
{
- self.superweapons_finished = 0;
- self.weapons &= ~WEPSET_SUPERWEAPONS;
+ this.superweapons_finished = 0;
+ this.weapons &= ~WEPSET_SUPERWEAPONS;
}
}
else
{
- self.superweapons_finished = 0;
+ this.superweapons_finished = 0;
}
}
if(autocvar_g_nodepthtestplayers)
- self.effects = self.effects | EF_NODEPTHTEST;
+ this.effects = this.effects | EF_NODEPTHTEST;
if(autocvar_g_fullbrightplayers)
- self.effects = self.effects | EF_FULLBRIGHT;
+ this.effects = this.effects | EF_FULLBRIGHT;
if (time >= game_starttime)
- if (time < self.spawnshieldtime)
- self.effects = self.effects | (EF_ADDITIVE | EF_FULLBRIGHT);
+ if (time < this.spawnshieldtime)
+ this.effects = this.effects | (EF_ADDITIVE | EF_FULLBRIGHT);
- MUTATOR_CALLHOOK(PlayerPowerups, self, items_prev);
+ MUTATOR_CALLHOOK(PlayerPowerups, this, items_prev);
}
float CalcRegen(float current, float stable, float regenfactor, float regenframetime)
regen_health_stable = autocvar_g_balance_health_regenstable;
regen_health_rotstable = autocvar_g_balance_health_rotstable;
if(!MUTATOR_CALLHOOK(PlayerRegen))
- if(!STAT(FROZEN, self))
+ if(!STAT(FROZEN, this))
{
float mina, maxa, limith, limita;
maxa = autocvar_g_balance_armor_rotstable;
limith = limith * limit_mod;
limita = limita * limit_mod;
- self.armorvalue = CalcRotRegen(self.armorvalue, mina, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear, regen_mod * frametime * (time > self.pauseregen_finished), maxa, autocvar_g_balance_armor_rot, autocvar_g_balance_armor_rotlinear, rot_mod * frametime * (time > self.pauserotarmor_finished), limita);
- self.health = CalcRotRegen(self.health, regen_health_stable, regen_health, regen_health_linear, regen_mod * frametime * (time > self.pauseregen_finished), regen_health_rotstable, regen_health_rot, regen_health_rotlinear, rot_mod * frametime * (time > self.pauserothealth_finished), limith);
+ this.armorvalue = CalcRotRegen(this.armorvalue, mina, autocvar_g_balance_armor_regen, autocvar_g_balance_armor_regenlinear, regen_mod * frametime * (time > this.pauseregen_finished), maxa, autocvar_g_balance_armor_rot, autocvar_g_balance_armor_rotlinear, rot_mod * frametime * (time > this.pauserotarmor_finished), limita);
+ this.health = CalcRotRegen(this.health, regen_health_stable, regen_health, regen_health_linear, regen_mod * frametime * (time > this.pauseregen_finished), regen_health_rotstable, regen_health_rot, regen_health_rotlinear, rot_mod * frametime * (time > this.pauserothealth_finished), limith);
}
// if player rotted to death... die!
// check this outside above checks, as player may still be able to rot to death
- if(self.health < 1)
+ if(this.health < 1)
{
- if(self.vehicle)
+ if(this.vehicle)
vehicles_exit(VHEF_RELEASE);
- if(self.event_damage)
- self.event_damage(self, self, self, 1, DEATH_ROT.m_id, self.origin, '0 0 0');
+ if(this.event_damage)
+ this.event_damage(this, this, this, 1, DEATH_ROT.m_id, this.origin, '0 0 0');
}
- if (!(self.items & IT_UNLIMITED_WEAPON_AMMO))
+ if (!(this.items & IT_UNLIMITED_WEAPON_AMMO))
{
float minf, maxf, limitf;
minf = autocvar_g_balance_fuel_regenstable;
limitf = autocvar_g_balance_fuel_limit;
- self.ammo_fuel = CalcRotRegen(self.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > self.pauseregen_finished) * ((self.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > self.pauserotfuel_finished), limitf);
+ this.ammo_fuel = CalcRotRegen(this.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > this.pauseregen_finished) * ((this.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > this.pauserotfuel_finished), limitf);
}
}
-float zoomstate_set;
+bool zoomstate_set;
void SetZoomState(float z)
{SELFPARAM();
- if(z != self.zoomstate)
+ if(z != this.zoomstate)
{
- self.zoomstate = z;
- ClientData_Touch(self);
+ this.zoomstate = z;
+ ClientData_Touch(this);
}
- zoomstate_set = 1;
+ zoomstate_set = true;
}
void GetPressedKeys()
bool SpectateUpdate()
{SELFPARAM();
- if(!self.enemy)
+ if(!this.enemy)
return false;
- if(!IS_PLAYER(self.enemy) || self == self.enemy)
+ if(!IS_PLAYER(this.enemy) || this == this.enemy)
{
- SetSpectatee(self, NULL);
+ SetSpectatee(this, NULL);
return false;
}
bool SpectateSet()
{SELFPARAM();
- if(!IS_PLAYER(self.enemy))
+ if(!IS_PLAYER(this.enemy))
return false;
- msg_entity = self;
+ msg_entity = this;
WriteByte(MSG_ONE, SVC_SETVIEW);
- WriteEntity(MSG_ONE, self.enemy);
- self.movetype = MOVETYPE_NONE;
- accuracy_resend(self);
+ WriteEntity(MSG_ONE, this.enemy);
+ this.movetype = MOVETYPE_NONE;
+ accuracy_resend(this);
if(!SpectateUpdate())
PutObserverInServer();
bool Spectate(entity pl)
{SELFPARAM();
- if(MUTATOR_CALLHOOK(SpectateSet, self, pl))
+ if(MUTATOR_CALLHOOK(SpectateSet, this, pl))
return false;
pl = spec_player;
- SetSpectatee(self, pl);
+ SetSpectatee(this, pl);
return SpectateSet();
}
bool SpectateNext()
{SELFPARAM();
- other = find(self.enemy, classname, STR_PLAYER);
+ other = find(this.enemy, classname, STR_PLAYER);
- if (MUTATOR_CALLHOOK(SpectateNext, self, other))
+ if (MUTATOR_CALLHOOK(SpectateNext, this, other))
other = spec_player;
else if (!other)
other = find(other, classname, STR_PLAYER);
- if(other) { SetSpectatee(self, other); }
+ if(other) { SetSpectatee(this, other); }
return SpectateSet();
}
entity first = other;
// skip players until current spectated player
- if(self.enemy)
- while(other && other != self.enemy)
+ if(this.enemy)
+ while(other && other != this.enemy)
other = other.chain;
- switch (MUTATOR_CALLHOOK(SpectatePrev, self, other, first))
+ switch (MUTATOR_CALLHOOK(SpectatePrev, this, other, first))
{
case MUT_SPECPREV_FOUND:
other = spec_player;
}
}
- SetSpectatee(self, other);
+ SetSpectatee(this, other);
return SpectateSet();
}
void ShowRespawnCountdown()
{SELFPARAM();
float number;
- if(!IS_DEAD(self)) // just respawned?
+ if(!IS_DEAD(this)) // just respawned?
return;
else
{
- number = ceil(self.respawn_time - time);
+ number = ceil(this.respawn_time - time);
if(number <= 0)
return;
- if(number <= self.respawn_countdown)
+ if(number <= this.respawn_countdown)
{
- self.respawn_countdown = number - 1;
- if(ceil(self.respawn_time - (time + 0.5)) == number) // only say it if it is the same number even in 0.5s; to prevent overlapping sounds
- { Send_Notification(NOTIF_ONE, self, MSG_ANNCE, Announcer_PickNumber(CNT_RESPAWN, number)); }
+ this.respawn_countdown = number - 1;
+ if(ceil(this.respawn_time - (time + 0.5)) == number) // only say it if it is the same number even in 0.5s; to prevent overlapping sounds
+ { Send_Notification(NOTIF_ONE, this, MSG_ANNCE, Announcer_PickNumber(CNT_RESPAWN, number)); }
}
}
}
void LeaveSpectatorMode()
{SELFPARAM();
- if(self.caplayer)
+ if(this.caplayer)
return;
- if(nJoinAllowed(self, self))
+ if(nJoinAllowed(this, this))
{
- if(!teamplay || autocvar_g_campaign || autocvar_g_balance_teams || (self.wasplayer && autocvar_g_changeteam_banned) || self.team_forced > 0)
+ if(!teamplay || autocvar_g_campaign || autocvar_g_balance_teams || (this.wasplayer && autocvar_g_changeteam_banned) || this.team_forced > 0)
{
- TRANSMUTE(Player, self);
+ TRANSMUTE(Player, this);
if(autocvar_g_campaign || autocvar_g_balance_teams)
- { JoinBestTeam(self, false, true); }
+ { JoinBestTeam(this, false, true); }
if(autocvar_g_campaign)
{ campaign_bots_may_start = true; }
- Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_PREVENT_JOIN);
+ Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_PREVENT_JOIN);
PutClientInServer();
- if(IS_PLAYER(self)) { Send_Notification(NOTIF_ALL, world, MSG_INFO, ((teamplay && this.team != -1) ? APP_TEAM_ENT(this, INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), self.netname); }
+ if(IS_PLAYER(this)) { Send_Notification(NOTIF_ALL, world, MSG_INFO, ((teamplay && this.team != -1) ? APP_TEAM_ENT(this, INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), this.netname); }
}
else
- stuffcmd(self, "menu_showteamselect\n");
+ stuffcmd(this, "menu_showteamselect\n");
}
else
{
// Player may not join because g_maxplayers is set
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_JOIN_PREVENT);
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_JOIN_PREVENT);
}
}
*/
void checkSpectatorBlock()
{SELFPARAM();
- if(IS_SPEC(self) || IS_OBSERVER(self))
- if(!self.caplayer)
- if(IS_REAL_CLIENT(self))
+ if(IS_SPEC(this) || IS_OBSERVER(this))
+ if(!this.caplayer)
+ if(IS_REAL_CLIENT(this))
{
- if( time > (self.spectatortime + autocvar_g_maxplayers_spectator_blocktime) ) {
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_QUIT_KICK_SPECTATING);
- dropclient(self);
+ if( time > (this.spectatortime + autocvar_g_maxplayers_spectator_blocktime) ) {
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_QUIT_KICK_SPECTATING);
+ dropclient(this);
}
}
}
-void PrintWelcomeMessage()
-{SELFPARAM();
- if(self.motd_actived_time == 0)
+void PrintWelcomeMessage(entity this)
+{
+ if(this.motd_actived_time == 0)
{
if (autocvar_g_campaign) {
- if ((IS_PLAYER(self) && PHYS_INPUT_BUTTON_INFO(self)) || (!IS_PLAYER(self))) {
- self.motd_actived_time = time;
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD, campaign_message);
+ if ((IS_PLAYER(this) && PHYS_INPUT_BUTTON_INFO(this)) || (!IS_PLAYER(this))) {
+ this.motd_actived_time = time;
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, campaign_message);
}
} else {
- if (PHYS_INPUT_BUTTON_INFO(self)) {
- self.motd_actived_time = time;
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_MOTD, getwelcomemessage());
+ if (PHYS_INPUT_BUTTON_INFO(this)) {
+ this.motd_actived_time = time;
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_MOTD, getwelcomemessage());
}
}
}
- else if(self.motd_actived_time > 0) // showing MOTD or campaign message
+ else if(this.motd_actived_time > 0) // showing MOTD or campaign message
{
if (autocvar_g_campaign) {
- if (PHYS_INPUT_BUTTON_INFO(self))
- self.motd_actived_time = time;
- else if ((time - self.motd_actived_time > 2) && IS_PLAYER(self)) { // hide it some seconds after BUTTON_INFO has been released
- self.motd_actived_time = 0;
- Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_MOTD);
+ if (PHYS_INPUT_BUTTON_INFO(this))
+ this.motd_actived_time = time;
+ else if ((time - this.motd_actived_time > 2) && IS_PLAYER(this)) { // hide it some seconds after BUTTON_INFO has been released
+ this.motd_actived_time = 0;
+ Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD);
}
} else {
- if (PHYS_INPUT_BUTTON_INFO(self))
- self.motd_actived_time = time;
- else if (time - self.motd_actived_time > 2) { // hide it some seconds after BUTTON_INFO has been released
- self.motd_actived_time = 0;
- Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_MOTD);
+ if (PHYS_INPUT_BUTTON_INFO(this))
+ this.motd_actived_time = time;
+ else if (time - this.motd_actived_time > 2) { // hide it some seconds after BUTTON_INFO has been released
+ this.motd_actived_time = 0;
+ Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD);
}
}
}
- else //if(self.motd_actived_time < 0) // just connected, motd is active
+ else //if(this.motd_actived_time < 0) // just connected, motd is active
{
- if(PHYS_INPUT_BUTTON_INFO(self)) // BUTTON_INFO hides initial MOTD
- self.motd_actived_time = -2; // wait until BUTTON_INFO gets released
- else if(self.motd_actived_time == -2 || IS_PLAYER(self) || IS_SPEC(self))
+ if(PHYS_INPUT_BUTTON_INFO(this)) // BUTTON_INFO hides initial MOTD
+ this.motd_actived_time = -2; // wait until BUTTON_INFO gets released
+ else if(this.motd_actived_time == -2 || IS_PLAYER(this) || IS_SPEC(this))
{
// instanctly hide MOTD
- self.motd_actived_time = 0;
- Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_MOTD);
+ this.motd_actived_time = 0;
+ Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_MOTD);
}
}
}
void ObserverThink()
{SELFPARAM();
- if ( self.impulse )
+ if ( this.impulse )
{
- MinigameImpulse(self, self.impulse);
- self.impulse = 0;
+ MinigameImpulse(this, this.impulse);
+ this.impulse = 0;
}
float prefered_movetype;
- if (self.flags & FL_JUMPRELEASED) {
- if (PHYS_INPUT_BUTTON_JUMP(self) && !self.version_mismatch) {
- self.flags &= ~FL_JUMPRELEASED;
- self.flags |= FL_SPAWNING;
- } else if(PHYS_INPUT_BUTTON_ATCK(self) && !self.version_mismatch) {
- self.flags &= ~FL_JUMPRELEASED;
+ if (this.flags & FL_JUMPRELEASED) {
+ if (PHYS_INPUT_BUTTON_JUMP(this) && !this.version_mismatch) {
+ this.flags &= ~FL_JUMPRELEASED;
+ this.flags |= FL_SPAWNING;
+ } else if(PHYS_INPUT_BUTTON_ATCK(this) && !this.version_mismatch) {
+ this.flags &= ~FL_JUMPRELEASED;
if(SpectateNext()) {
- TRANSMUTE(Spectator, self);
+ TRANSMUTE(Spectator, this);
}
} else {
- prefered_movetype = ((!PHYS_INPUT_BUTTON_USE(self) ? self.cvar_cl_clippedspectating : !self.cvar_cl_clippedspectating) ? MOVETYPE_FLY_WORLDONLY : MOVETYPE_NOCLIP);
- if (self.movetype != prefered_movetype)
- self.movetype = prefered_movetype;
+ prefered_movetype = ((!PHYS_INPUT_BUTTON_USE(this) ? this.cvar_cl_clippedspectating : !this.cvar_cl_clippedspectating) ? MOVETYPE_FLY_WORLDONLY : MOVETYPE_NOCLIP);
+ if (this.movetype != prefered_movetype)
+ this.movetype = prefered_movetype;
}
} else {
- if (!(PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_JUMP(self))) {
- self.flags |= FL_JUMPRELEASED;
- if(self.flags & FL_SPAWNING)
+ if (!(PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_JUMP(this))) {
+ this.flags |= FL_JUMPRELEASED;
+ if(this.flags & FL_SPAWNING)
{
- self.flags &= ~FL_SPAWNING;
+ this.flags &= ~FL_SPAWNING;
LeaveSpectatorMode();
return;
}
void SpectatorThink()
{SELFPARAM();
- if ( self.impulse )
+ if ( this.impulse )
{
- if(MinigameImpulse(self, self.impulse))
- self.impulse = 0;
- }
- if (self.flags & FL_JUMPRELEASED) {
- if (PHYS_INPUT_BUTTON_JUMP(self) && !self.version_mismatch) {
- self.flags &= ~FL_JUMPRELEASED;
- self.flags |= FL_SPAWNING;
- } else if(PHYS_INPUT_BUTTON_ATCK(self) || self.impulse == 10 || self.impulse == 15 || self.impulse == 18 || (self.impulse >= 200 && self.impulse <= 209)) {
- self.flags &= ~FL_JUMPRELEASED;
+ if(MinigameImpulse(this, this.impulse))
+ this.impulse = 0;
+ }
+ if (this.flags & FL_JUMPRELEASED) {
+ if (PHYS_INPUT_BUTTON_JUMP(this) && !this.version_mismatch) {
+ this.flags &= ~FL_JUMPRELEASED;
+ this.flags |= FL_SPAWNING;
+ } else if(PHYS_INPUT_BUTTON_ATCK(this) || this.impulse == 10 || this.impulse == 15 || this.impulse == 18 || (this.impulse >= 200 && this.impulse <= 209)) {
+ this.flags &= ~FL_JUMPRELEASED;
if(SpectateNext()) {
- TRANSMUTE(Spectator, self);
+ TRANSMUTE(Spectator, this);
} else {
- TRANSMUTE(Observer, self);
+ TRANSMUTE(Observer, this);
PutClientInServer();
}
- self.impulse = 0;
- } else if(self.impulse == 12 || self.impulse == 16 || self.impulse == 19 || (self.impulse >= 220 && self.impulse <= 229)) {
- self.flags &= ~FL_JUMPRELEASED;
+ this.impulse = 0;
+ } else if(this.impulse == 12 || this.impulse == 16 || this.impulse == 19 || (this.impulse >= 220 && this.impulse <= 229)) {
+ this.flags &= ~FL_JUMPRELEASED;
if(SpectatePrev()) {
- TRANSMUTE(Spectator, self);
+ TRANSMUTE(Spectator, this);
} else {
- TRANSMUTE(Observer, self);
+ TRANSMUTE(Observer, this);
PutClientInServer();
}
- self.impulse = 0;
- } else if (PHYS_INPUT_BUTTON_ATCK2(self)) {
- self.flags &= ~FL_JUMPRELEASED;
- TRANSMUTE(Observer, self);
+ this.impulse = 0;
+ } else if (PHYS_INPUT_BUTTON_ATCK2(this)) {
+ this.flags &= ~FL_JUMPRELEASED;
+ TRANSMUTE(Observer, this);
PutClientInServer();
} else {
if(!SpectateUpdate())
PutObserverInServer();
}
} else {
- if (!(PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_ATCK2(self))) {
- self.flags |= FL_JUMPRELEASED;
- if(self.flags & FL_SPAWNING)
+ if (!(PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_ATCK2(this))) {
+ this.flags |= FL_JUMPRELEASED;
+ if(this.flags & FL_SPAWNING)
{
- self.flags &= ~FL_SPAWNING;
+ this.flags &= ~FL_SPAWNING;
LeaveSpectatorMode();
return;
}
PutObserverInServer();
}
- self.flags |= FL_CLIENT | FL_NOTARGET;
+ this.flags |= FL_CLIENT | FL_NOTARGET;
}
void vehicles_enter (entity pl, entity veh);
void PlayerUseKey()
{SELFPARAM();
- if (!IS_PLAYER(self))
+ if (!IS_PLAYER(this))
return;
- if(self.vehicle)
+ if(this.vehicle)
{
if(!gameover)
{
}
else if(autocvar_g_vehicles_enter)
{
- if(!STAT(FROZEN, self))
- if(!IS_DEAD(self))
+ if(!STAT(FROZEN, this))
+ if(!IS_DEAD(this))
if(!gameover)
{
entity head, closest_target = world;
- head = WarpZone_FindRadius(self.origin, autocvar_g_vehicles_enter_radius, true);
+ head = WarpZone_FindRadius(this.origin, autocvar_g_vehicles_enter_radius, true);
while(head) // find the closest acceptable target to enter
{
if(head.vehicle_flags & VHF_ISVEHICLE)
if(!IS_DEAD(head))
- if(!head.owner || ((head.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(head.owner, self)))
+ if(!head.owner || ((head.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(head.owner, this)))
if(head.takedamage != DAMAGE_NO)
{
if(closest_target)
{
- if(vlen(self.origin - head.origin) < vlen(self.origin - closest_target.origin))
+ if(vlen(this.origin - head.origin) < vlen(this.origin - closest_target.origin))
{ closest_target = head; }
}
else { closest_target = head; }
head = head.chain;
}
- if(closest_target) { vehicles_enter(self, closest_target); return; }
+ if(closest_target) { vehicles_enter(this, closest_target); return; }
}
}
.float last_vehiclecheck;
.int items_added;
void PlayerPreThink ()
-{SELFPARAM();
- WarpZone_PlayerPhysics_FixVAngle();
+{
+ SELFPARAM();
+ WarpZone_PlayerPhysics_FixVAngle(this);
- self.stat_game_starttime = game_starttime;
- self.stat_round_starttime = round_starttime;
- self.stat_allow_oldvortexbeam = autocvar_g_allow_oldvortexbeam;
- self.stat_leadlimit = autocvar_leadlimit;
+ STAT(GAMESTARTTIME, this) = game_starttime;
+ STAT(ROUNDSTARTTIME, this) = round_starttime;
+ STAT(ALLOW_OLDVORTEXBEAM, this) = autocvar_g_allow_oldvortexbeam;
+ STAT(LEADLIMIT, this) = autocvar_leadlimit;
- self.weaponsinmap = weaponsInMap;
+ STAT(WEAPONSINMAP, this) = weaponsInMap;
- if(frametime)
- {
+ if (frametime) {
// physics frames: update anticheat stuff
- anticheat_prethink(self);
+ anticheat_prethink(this);
}
- if(blockSpectators && frametime)
- // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero).
+ if (blockSpectators && frametime) {
+ // WORKAROUND: only use dropclient in server frames (frametime set).
+ // Never use it in cl_movement frames (frametime zero).
checkSpectatorBlock();
+ }
- zoomstate_set = 0;
-
- // Savage: Check for nameless players
- if (isInvisibleString(self.netname)) {
- string new_name = strzone(strcat("Player@", ftos(self.playerid)));
- if(autocvar_sv_eventlog)
- GameLogEcho(strcat(":name:", ftos(self.playerid), ":", new_name));
- if(self.netname_previous)
- strunzone(self.netname_previous);
- self.netname_previous = strzone(new_name);
- self.netname = self.netname_previous;
- // stuffcmd(self, strcat("name ", self.netname, "\n"));
- } else if(self.netname_previous != self.netname) {
- if(autocvar_sv_eventlog)
- GameLogEcho(strcat(":name:", ftos(self.playerid), ":", self.netname));
- if(self.netname_previous)
- strunzone(self.netname_previous);
- self.netname_previous = strzone(self.netname);
+ zoomstate_set = false;
+
+ // Check for nameless players
+ if (isInvisibleString(this.netname)) {
+ this.netname = strzone(sprintf("Player#%d", this.playerid));
+ // stuffcmd(this, strcat("name ", this.netname, "\n")); // maybe?
+ }
+ if (this.netname != this.netname_previous) {
+ if (autocvar_sv_eventlog) {
+ GameLogEcho(strcat(":name:", ftos(this.playerid), ":", this.netname));
+ }
+ if (this.netname_previous) strunzone(this.netname_previous);
+ this.netname_previous = strzone(this.netname);
}
// version nagging
- if(self.version_nagtime)
- if(self.cvar_g_xonoticversion)
- if(time > self.version_nagtime)
- {
- // don't notify git users
- if(strstrofs(self.cvar_g_xonoticversion, "git", 0) < 0 && strstrofs(self.cvar_g_xonoticversion, "autobuild", 0) < 0)
- {
- if(strstrofs(autocvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(autocvar_g_xonoticversion, "autobuild", 0) >= 0)
- {
- // notify release users if connecting to git
- LOG_TRACE("^1NOTE^7 to ", self.netname, "^7 - the server is running ^3Xonotic ", autocvar_g_xonoticversion, " (beta)^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n");
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_VERSION_BETA, autocvar_g_xonoticversion, self.cvar_g_xonoticversion);
- }
- else
- {
- float r;
- r = vercmp(self.cvar_g_xonoticversion, autocvar_g_xonoticversion);
- if(r < 0)
- {
- // give users new version
- LOG_TRACE("^1NOTE^7 to ", self.netname, "^7 - ^3Xonotic ", autocvar_g_xonoticversion, "^7 is out, and you still have ^3Xonotic ", self.cvar_g_xonoticversion, "^1 - get the update from ^4http://www.xonotic.org/^1!\n");
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_VERSION_OUTDATED, autocvar_g_xonoticversion, self.cvar_g_xonoticversion);
- }
- else if(r > 0)
- {
- // notify users about old server version
- LOG_INFO("^1NOTE^7 to ", self.netname, "^7 - the server is running ^3Xonotic ", autocvar_g_xonoticversion, "^7, you have ^3Xonotic ", self.cvar_g_xonoticversion, "^1\n");
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_VERSION_OLD, autocvar_g_xonoticversion, self.cvar_g_xonoticversion);
- }
- }
- }
- self.version_nagtime = 0;
- }
+ if (this.version_nagtime && this.cvar_g_xonoticversion && time > this.version_nagtime) {
+ this.version_nagtime = 0;
+ if (strstrofs(this.cvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(this.cvar_g_xonoticversion, "autobuild", 0) >= 0) {
+ // git client
+ } else if (strstrofs(autocvar_g_xonoticversion, "git", 0) >= 0 || strstrofs(autocvar_g_xonoticversion, "autobuild", 0) >= 0) {
+ // git server
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_BETA, autocvar_g_xonoticversion, this.cvar_g_xonoticversion);
+ } else {
+ int r = vercmp(this.cvar_g_xonoticversion, autocvar_g_xonoticversion);
+ if (r < 0) { // old client
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OUTDATED, autocvar_g_xonoticversion, this.cvar_g_xonoticversion);
+ } else if (r > 0) { // old server
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_VERSION_OLD, autocvar_g_xonoticversion, this.cvar_g_xonoticversion);
+ }
+ }
+ }
// GOD MODE info
- if(!(self.flags & FL_GODMODE)) if(self.max_armorvalue)
+ if (!(this.flags & FL_GODMODE) && this.max_armorvalue)
{
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_GODMODE_OFF, self.max_armorvalue);
- self.max_armorvalue = 0;
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_INFO, INFO_GODMODE_OFF, this.max_armorvalue);
+ this.max_armorvalue = 0;
}
- if(STAT(FROZEN, self) == 2)
+ if (STAT(FROZEN, this) == 2)
{
- self.revive_progress = bound(0, self.revive_progress + frametime * self.revive_speed, 1);
- self.health = max(1, self.revive_progress * start_health);
- self.iceblock.alpha = bound(0.2, 1 - self.revive_progress, 1);
+ this.revive_progress = bound(0, this.revive_progress + frametime * this.revive_speed, 1);
+ this.health = max(1, this.revive_progress * start_health);
+ this.iceblock.alpha = bound(0.2, 1 - this.revive_progress, 1);
- if(self.revive_progress >= 1)
- Unfreeze(self);
+ if (this.revive_progress >= 1)
+ Unfreeze(this);
}
- else if(STAT(FROZEN, self) == 3)
+ else if (STAT(FROZEN, this) == 3)
{
- self.revive_progress = bound(0, self.revive_progress - frametime * self.revive_speed, 1);
- self.health = max(0, autocvar_g_nades_ice_health + (start_health-autocvar_g_nades_ice_health) * self.revive_progress );
+ this.revive_progress = bound(0, this.revive_progress - frametime * this.revive_speed, 1);
+ this.health = max(0, autocvar_g_nades_ice_health + (start_health-autocvar_g_nades_ice_health) * this.revive_progress );
- if(self.health < 1)
+ if (this.health < 1)
{
- if(self.vehicle)
+ if (this.vehicle)
vehicles_exit(VHEF_RELEASE);
- self.event_damage(self, self, self.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, self.origin, '0 0 0');
+ this.event_damage(this, this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, this.origin, '0 0 0');
}
- else if ( self.revive_progress <= 0 )
- Unfreeze(self);
+ else if (this.revive_progress <= 0)
+ Unfreeze(this);
}
MUTATOR_CALLHOOK(PlayerPreThink);
if(autocvar_g_vehicles_enter)
- if(time > self.last_vehiclecheck)
- if(IS_PLAYER(self))
+ if(time > this.last_vehiclecheck)
+ if(IS_PLAYER(this))
if(!gameover)
- if(!STAT(FROZEN, self))
- if(!self.vehicle)
- if(!IS_DEAD(self))
+ if(!STAT(FROZEN, this))
+ if(!this.vehicle)
+ if(!IS_DEAD(this))
{
entity veh;
for(veh = world; (veh = findflags(veh, vehicle_flags, VHF_ISVEHICLE)); )
- if(vlen(veh.origin - self.origin) < autocvar_g_vehicles_enter_radius)
+ if(vlen(veh.origin - this.origin) < autocvar_g_vehicles_enter_radius)
if(!IS_DEAD(veh))
if(veh.takedamage != DAMAGE_NO)
- if((veh.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(veh.owner, self))
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_VEHICLE_ENTER_GUNNER);
+ if((veh.vehicle_flags & VHF_MULTISLOT) && SAME_TEAM(veh.owner, this))
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER_GUNNER);
else if(!veh.owner)
- if(!veh.team || SAME_TEAM(self, veh))
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_VEHICLE_ENTER);
+ if(!veh.team || SAME_TEAM(this, veh))
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER);
else if(autocvar_g_vehicles_steal)
- Send_Notification(NOTIF_ONE, self, MSG_CENTER, CENTER_VEHICLE_ENTER_STEAL);
+ Send_Notification(NOTIF_ONE, this, MSG_CENTER, CENTER_VEHICLE_ENTER_STEAL);
- self.last_vehiclecheck = time + 1;
+ this.last_vehiclecheck = time + 1;
}
- if(!self.cvar_cl_newusekeysupported) // FIXME remove this - it was a stupid idea to begin with, we can JUST use the button
+ if(!this.cvar_cl_newusekeysupported) // FIXME remove this - it was a stupid idea to begin with, we can JUST use the button
{
- if(PHYS_INPUT_BUTTON_USE(self) && !self.usekeypressed)
+ if(PHYS_INPUT_BUTTON_USE(this) && !this.usekeypressed)
PlayerUseKey();
- self.usekeypressed = PHYS_INPUT_BUTTON_USE(self);
+ this.usekeypressed = PHYS_INPUT_BUTTON_USE(this);
}
- if(IS_REAL_CLIENT(self))
- PrintWelcomeMessage();
-
- if(IS_PLAYER(self))
- {
+ if (IS_REAL_CLIENT(this))
+ PrintWelcomeMessage(this);
+ if (IS_PLAYER(this)) {
CheckRules_Player();
- if (intermission_running)
- {
- IntermissionThink (); // otherwise a button could be missed between
- return; // the think tics
+ if (intermission_running) {
+ IntermissionThink();
+ return;
}
- //don't allow the player to turn around while game is paused!
- if(timeout_status == TIMEOUT_ACTIVE) {
+ if (timeout_status == TIMEOUT_ACTIVE) {
+ // don't allow the player to turn around while game is paused
// FIXME turn this into CSQC stuff
- self.v_angle = self.lastV_angle;
- self.angles = self.lastV_angle;
- self.fixangle = true;
+ this.v_angle = this.lastV_angle;
+ this.angles = this.lastV_angle;
+ this.fixangle = true;
}
- if(frametime)
- {
- player_powerups();
- }
+ if (frametime) player_powerups();
- if (IS_DEAD(self))
- {
- if(self.personal && g_race_qualifying)
- {
- if(time > self.respawn_time)
- {
- self.respawn_time = time + 1; // only retry once a second
- self.stat_respawn_time = self.respawn_time;
+ if (IS_DEAD(this)) {
+ if (this.personal && g_race_qualifying) {
+ if (time > this.respawn_time) {
+ STAT(RESPAWN_TIME, this) = this.respawn_time = time + 1; // only retry once a second
respawn();
- self.impulse = 141;
- }
- }
- else
- {
- float button_pressed;
- if(frametime)
- player_anim();
- button_pressed = (PHYS_INPUT_BUTTON_ATCK(self) || PHYS_INPUT_BUTTON_JUMP(self) || PHYS_INPUT_BUTTON_ATCK2(self) || PHYS_INPUT_BUTTON_HOOK(self) || PHYS_INPUT_BUTTON_USE(self));
-
- if (self.deadflag == DEAD_DYING)
- {
- if((self.respawn_flags & RESPAWN_FORCE) && !autocvar_g_respawn_delay_max)
- self.deadflag = DEAD_RESPAWNING;
- else if(!button_pressed)
- self.deadflag = DEAD_DEAD;
- }
- else if (self.deadflag == DEAD_DEAD)
- {
- if(button_pressed)
- self.deadflag = DEAD_RESPAWNABLE;
- else if(time >= self.respawn_time_max && (self.respawn_flags & RESPAWN_FORCE))
- self.deadflag = DEAD_RESPAWNING;
- }
- else if (self.deadflag == DEAD_RESPAWNABLE)
- {
- if(!button_pressed)
- self.deadflag = DEAD_RESPAWNING;
+ this.impulse = CHIMPULSE_SPEEDRUN.impulse;
}
- else if (self.deadflag == DEAD_RESPAWNING)
- {
- if(time > self.respawn_time)
- {
- self.respawn_time = time + 1; // only retry once a second
- self.respawn_time_max = self.respawn_time;
+ } else {
+ if (frametime) player_anim();
+ bool button_pressed = (PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_JUMP(this) || PHYS_INPUT_BUTTON_ATCK2(this) || PHYS_INPUT_BUTTON_HOOK(this) || PHYS_INPUT_BUTTON_USE(this));
+
+ if (this.deadflag == DEAD_DYING) {
+ if ((this.respawn_flags & RESPAWN_FORCE) && !autocvar_g_respawn_delay_max) {
+ this.deadflag = DEAD_RESPAWNING;
+ } else if (!button_pressed) {
+ this.deadflag = DEAD_DEAD;
+ }
+ } else if (this.deadflag == DEAD_DEAD) {
+ if (button_pressed) {
+ this.deadflag = DEAD_RESPAWNABLE;
+ } else if (time >= this.respawn_time_max && (this.respawn_flags & RESPAWN_FORCE)) {
+ this.deadflag = DEAD_RESPAWNING;
+ }
+ } else if (this.deadflag == DEAD_RESPAWNABLE) {
+ if (!button_pressed) {
+ this.deadflag = DEAD_RESPAWNING;
+ }
+ } else if (this.deadflag == DEAD_RESPAWNING) {
+ if (time > this.respawn_time) {
+ this.respawn_time = time + 1; // only retry once a second
+ this.respawn_time_max = this.respawn_time;
respawn();
}
}
ShowRespawnCountdown();
- if(self.respawn_flags & RESPAWN_SILENT)
- self.stat_respawn_time = 0;
- else if((self.respawn_flags & RESPAWN_FORCE) && autocvar_g_respawn_delay_max)
- self.stat_respawn_time = self.respawn_time_max;
+ if (this.respawn_flags & RESPAWN_SILENT)
+ STAT(RESPAWN_TIME, this) = 0;
+ else if ((this.respawn_flags & RESPAWN_FORCE) && autocvar_g_respawn_delay_max)
+ STAT(RESPAWN_TIME, this) = this.respawn_time_max;
else
- self.stat_respawn_time = self.respawn_time;
+ STAT(RESPAWN_TIME, this) = this.respawn_time;
}
// if respawning, invert stat_respawn_time to indicate this, the client translates it
- if(self.deadflag == DEAD_RESPAWNING && self.stat_respawn_time > 0)
- self.stat_respawn_time *= -1;
+ if (this.deadflag == DEAD_RESPAWNING && STAT(RESPAWN_TIME, this) > 0)
+ STAT(RESPAWN_TIME, this) *= -1;
return;
}
- self.prevorigin = self.origin;
-
- float do_crouch = PHYS_INPUT_BUTTON_CROUCH(self);
- if(self.hook.state)
- do_crouch = 0;
- if(self.vehicle)
- do_crouch = 0;
- if(STAT(FROZEN, self))
- do_crouch = 0;
+ this.prevorigin = this.origin;
- // WEAPONTODO: THIS SHIT NEEDS TO GO EVENTUALLY
- // It cannot be predicted by the engine!
- .entity weaponentity = weaponentities[0]; // TODO: unhardcode
- 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;
+ bool do_crouch = PHYS_INPUT_BUTTON_CROUCH(this);
+ .entity weaponentity = weaponentities[0]; // TODO: unhardcode
+ if (this.hook.state) {
+ do_crouch = false;
+ } else if (this.vehicle) {
+ do_crouch = false;
+ } else if (STAT(FROZEN, this)) {
+ do_crouch = false;
+ } else if ((PS(this).m_weapon == WEP_SHOTGUN || PS(this).m_weapon == WEP_SHOCKWAVE) && this.(weaponentity).wframe == WFRAME_FIRE2 && time < this.(weaponentity).weapon_nextthink) {
+ // WEAPONTODO: predict
+ do_crouch = false;
+ }
- if (do_crouch)
- {
- if (!self.crouch)
- {
- self.crouch = true;
- self.view_ofs = STAT(PL_CROUCH_VIEW_OFS, self);
- setsize (self, STAT(PL_CROUCH_MIN, self), STAT(PL_CROUCH_MAX, self));
- // setanim(self, self.anim_duck, false, true, true); // this anim is BROKEN anyway
- }
- }
- else
- {
- if (self.crouch)
- {
- tracebox(self.origin, STAT(PL_MIN, self), STAT(PL_MAX, self), self.origin, false, self);
- if (!trace_startsolid)
- {
- self.crouch = false;
- self.view_ofs = STAT(PL_VIEW_OFS, self);
- setsize (self, STAT(PL_MIN, self), STAT(PL_MAX, self));
- }
+ if (do_crouch) {
+ if (!this.crouch) {
+ this.crouch = true;
+ this.view_ofs = STAT(PL_CROUCH_VIEW_OFS, this);
+ setsize(this, STAT(PL_CROUCH_MIN, this), STAT(PL_CROUCH_MAX, this));
+ // setanim(this, this.anim_duck, false, true, true); // this anim is BROKEN anyway
}
+ } else if (this.crouch) {
+ tracebox(this.origin, STAT(PL_MIN, this), STAT(PL_MAX, this), this.origin, false, this);
+ if (!trace_startsolid) {
+ this.crouch = false;
+ this.view_ofs = STAT(PL_VIEW_OFS, this);
+ setsize(this, STAT(PL_MIN, this), STAT(PL_MAX, this));
+ }
}
- FixPlayermodel(self);
+ FixPlayermodel(this);
// LordHavoc: allow firing on move frames (sub-ticrate), this gives better timing on slow servers
//if(frametime)
{
- self.items &= ~self.items_added;
+ this.items &= ~this.items_added;
- W_WeaponFrame(self);
+ W_WeaponFrame(this);
- self.items_added = 0;
- if(self.items & ITEM_Jetpack.m_itemid)
- if(self.items & ITEM_JetpackRegen.m_itemid || self.ammo_fuel >= 0.01)
- self.items_added |= IT_FUEL;
+ this.items_added = 0;
+ if (this.items & ITEM_Jetpack.m_itemid && (this.items & ITEM_JetpackRegen.m_itemid || this.ammo_fuel >= 0.01))
+ this.items_added |= IT_FUEL;
- self.items |= self.items_added;
+ this.items |= this.items_added;
}
player_regen();
// WEAPONTODO: Add a weapon request for this
// rot vortex charge to the charge limit
- if(WEP_CVAR(vortex, charge_rot_rate) && self.vortex_charge > WEP_CVAR(vortex, charge_limit) && self.vortex_charge_rottime < time)
- self.vortex_charge = bound(WEP_CVAR(vortex, charge_limit), self.vortex_charge - WEP_CVAR(vortex, charge_rot_rate) * frametime / W_TICSPERFRAME, 1);
+ if (WEP_CVAR(vortex, charge_rot_rate) && this.vortex_charge > WEP_CVAR(vortex, charge_limit) && this.vortex_charge_rottime < time)
+ this.vortex_charge = bound(WEP_CVAR(vortex, charge_limit), this.vortex_charge - WEP_CVAR(vortex, charge_rot_rate) * frametime / W_TICSPERFRAME, 1);
- if(frametime)
- player_anim();
+ if (frametime) player_anim();
// secret status
secrets_setstatus();
// monsters status
- monsters_setstatus(self);
-
- self.dmg_team = max(0, self.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
+ monsters_setstatus(this);
- //self.angles_y=self.v_angle_y + 90; // temp
- } else if(gameover) {
- if (intermission_running)
- IntermissionThink (); // otherwise a button could be missed between
+ this.dmg_team = max(0, this.dmg_team - autocvar_g_teamdamage_resetspeed * frametime);
+ }
+ else if (gameover) {
+ if (intermission_running) IntermissionThink();
return;
- } else if(IS_OBSERVER(self)) {
+ }
+ else if (IS_OBSERVER(this)) {
ObserverThink();
- } else if(IS_SPEC(self)) {
+ }
+ else if (IS_SPEC(this)) {
SpectatorThink();
}
// WEAPONTODO: Add weapon request for this
- if(!zoomstate_set)
+ if (!zoomstate_set) {
SetZoomState(
- PHYS_INPUT_BUTTON_ZOOM(self)
- || PHYS_INPUT_BUTTON_ZOOMSCRIPT(self)
- || (PHYS_INPUT_BUTTON_ATCK2(self) && PS(self).m_weapon == WEP_VORTEX)
- || (PHYS_INPUT_BUTTON_ATCK2(self) && 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 = etof(self.enemy);
- else if(IS_OBSERVER(self))
- self.spectatee_status = etof(self);
- else
- self.spectatee_status = 0;
- if(self.spectatee_status != oldspectatee_status)
- {
- ClientData_Touch(self);
- if(g_race || g_cts)
- race_InitSpectator();
+ PHYS_INPUT_BUTTON_ZOOM(this) || PHYS_INPUT_BUTTON_ZOOMSCRIPT(this)
+ || (PHYS_INPUT_BUTTON_ATCK2(this) && PS(this).m_weapon == WEP_VORTEX)
+ || (PHYS_INPUT_BUTTON_ATCK2(this) && PS(this).m_weapon == WEP_RIFLE && WEP_CVAR(rifle, secondary) == 0)
+ );
+ }
+
+ int oldspectatee_status = this.spectatee_status;
+ if (IS_SPEC(this)) {
+ this.spectatee_status = etof(this.enemy);
+ } else if (IS_OBSERVER(this)) {
+ this.spectatee_status = etof(this);
+ } else {
+ this.spectatee_status = 0;
+ }
+ if (this.spectatee_status != oldspectatee_status) {
+ ClientData_Touch(this);
+ if (g_race || g_cts) race_InitSpectator();
}
- if(self.teamkill_soundtime)
- if(time > self.teamkill_soundtime)
+ if (this.teamkill_soundtime && time > this.teamkill_soundtime)
{
- self.teamkill_soundtime = 0;
+ this.teamkill_soundtime = 0;
- entity e = self.teamkill_soundsource;
+ entity e = this.teamkill_soundsource;
entity oldpusher = e.pusher;
e.pusher = this;
PlayerSound(e, playersound_teamshoot, CH_VOICE, VOICETYPE_LASTATTACKER_ONLY);
e.pusher = oldpusher;
}
- if(self.taunt_soundtime)
- if(time > self.taunt_soundtime)
- {
- self.taunt_soundtime = 0;
- PlayerSound(self, playersound_taunt, CH_VOICE, VOICETYPE_AUTOTAUNT);
+ if (this.taunt_soundtime && time > this.taunt_soundtime) {
+ this.taunt_soundtime = 0;
+ PlayerSound(this, playersound_taunt, CH_VOICE, VOICETYPE_AUTOTAUNT);
}
- target_voicescript_next(self);
+ target_voicescript_next(this);
// 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 (PS(self).m_weapon == WEP_Null)
- self.clip_load = self.clip_size = 0;
+ if (PS(this).m_weapon == WEP_Null)
+ this.clip_load = this.clip_size = 0;
}
void DrownPlayer(entity this)
*/
.float idlekick_lasttimeleft;
void PlayerPostThink ()
-{SELFPARAM();
- if(sv_maxidle > 0 && frametime) // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero).
- if(IS_REAL_CLIENT(self))
- if(IS_PLAYER(self) || sv_maxidle_spectatorsareidle)
+{
+ SELFPARAM();
+ if (sv_maxidle > 0)
+ if (frametime) // WORKAROUND: only use dropclient in server frames (frametime set). Never use it in cl_movement frames (frametime zero).
+ if (IS_REAL_CLIENT(this))
+ if (IS_PLAYER(this) || sv_maxidle_spectatorsareidle)
{
- if (time - self.parm_idlesince < 1) // instead of (time == self.parm_idlesince) to support sv_maxidle <= 10
+ if (time - this.parm_idlesince < 1) // instead of (time == this.parm_idlesince) to support sv_maxidle <= 10
{
- if(self.idlekick_lasttimeleft)
+ if (this.idlekick_lasttimeleft)
{
- self.idlekick_lasttimeleft = 0;
- Kill_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CPID_IDLING);
+ this.idlekick_lasttimeleft = 0;
+ Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_IDLING);
}
}
else
{
- float timeleft;
- timeleft = ceil(sv_maxidle - (time - self.parm_idlesince));
- if(timeleft == min(10, sv_maxidle - 1)) // - 1 to support sv_maxidle <= 10
- {
- if(!self.idlekick_lasttimeleft)
- Send_Notification(NOTIF_ONE_ONLY, self, MSG_CENTER, CENTER_DISCONNECT_IDLING, timeleft);
+ float timeleft = ceil(sv_maxidle - (time - this.parm_idlesince));
+ if (timeleft == min(10, sv_maxidle - 1)) { // - 1 to support sv_maxidle <= 10
+ if (!this.idlekick_lasttimeleft)
+ Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_DISCONNECT_IDLING, timeleft);
}
- if(timeleft <= 0)
- {
- Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_KICK_IDLING, self.netname);
- dropclient(self);
+ if (timeleft <= 0) {
+ Send_Notification(NOTIF_ALL, world, MSG_INFO, INFO_QUIT_KICK_IDLING, this.netname);
+ dropclient(this);
return;
}
- else if(timeleft <= 10)
- {
- if(timeleft != self.idlekick_lasttimeleft)
- { Send_Notification(NOTIF_ONE, self, MSG_ANNCE, Announcer_PickNumber(CNT_IDLE, timeleft)); }
- self.idlekick_lasttimeleft = timeleft;
+ else if (timeleft <= 10) {
+ if (timeleft != this.idlekick_lasttimeleft) {
+ Send_Notification(NOTIF_ONE, this, MSG_ANNCE, Announcer_PickNumber(CNT_IDLE, timeleft));
+ }
+ this.idlekick_lasttimeleft = timeleft;
}
}
}
//CheckPlayerJump();
- if(IS_PLAYER(self)) {
- DrownPlayer(self);
+ if (IS_PLAYER(this)) {
+ DrownPlayer(this);
CheckRules_Player();
UpdateChatBubble();
- if (self.impulse)
- ImpulseCommands(self);
- if (intermission_running)
- return; // intermission or finale
+ if (this.impulse) ImpulseCommands(this);
+ if (intermission_running) return; // intermission or finale
GetPressedKeys();
}
- /*
- float i;
- for(i = 0; i < 1000; ++i)
- {
- vector end;
- end = self.origin + '0 0 1024' + 512 * randomvec();
- tracebox(self.origin, self.mins, self.maxs, end, MOVE_NORMAL, self);
- if(trace_fraction < 1)
- if(!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
- {
- print("I HIT SOLID: ", vtos(self.origin), " -> ", vtos(end), "\n");
- break;
- }
- }
- */
-
- if(self.waypointsprite_attachedforcarrier)
- WaypointSprite_UpdateHealth(self.waypointsprite_attachedforcarrier, '1 0 0' * healtharmor_maxdamage(self.health, self.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id));
+ if (this.waypointsprite_attachedforcarrier) {
+ vector v = healtharmor_maxdamage(this.health, this.armorvalue, autocvar_g_balance_armor_blockpercent, DEATH_WEAPON.m_id);
+ WaypointSprite_UpdateHealth(this.waypointsprite_attachedforcarrier, '1 0 0' * v);
+ }
playerdemo_write();
- CSQCMODEL_AUTOUPDATE(self);
+ CSQCMODEL_AUTOUPDATE(this);
}
void CopyBody_Think()
{SELFPARAM();
- if(self.CopyBody_nextthink && time > self.CopyBody_nextthink)
+ if(this.CopyBody_nextthink && time > this.CopyBody_nextthink)
{
- self.CopyBody_think();
- if(wasfreed(self))
+ this.CopyBody_think();
+ if(wasfreed(this))
return;
- self.CopyBody_nextthink = self.nextthink;
- self.CopyBody_think = self.think;
- self.think = CopyBody_Think;
+ this.CopyBody_nextthink = this.nextthink;
+ this.CopyBody_think = this.think;
+ this.think = CopyBody_Think;
}
- CSQCMODEL_AUTOUPDATE(self);
- self.nextthink = time;
+ CSQCMODEL_AUTOUPDATE(this);
+ this.nextthink = time;
}
void CopyBody(entity this, float keepvelocity)
{
void player_anim ()
{SELFPARAM();
- int deadbits = (self.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
- if(IS_DEAD(self)) {
+ int deadbits = (this.anim_state & (ANIMSTATE_DEAD1 | ANIMSTATE_DEAD2));
+ if(IS_DEAD(this)) {
if (!deadbits) {
// Decide on which death animation to use.
if(random() < 0.5)
deadbits = 0;
}
int animbits = deadbits;
- if(STAT(FROZEN, self))
+ if(STAT(FROZEN, this))
animbits |= ANIMSTATE_FROZEN;
- if(self.movetype == MOVETYPE_FOLLOW)
+ if(this.movetype == MOVETYPE_FOLLOW)
animbits |= ANIMSTATE_FOLLOW;
- if(self.crouch)
+ if(this.crouch)
animbits |= ANIMSTATE_DUCK;
- animdecide_setstate(self, animbits, false);
- animdecide_setimplicitstate(self, IS_ONGROUND(self));
+ animdecide_setstate(this, animbits, false);
+ animdecide_setimplicitstate(this, IS_ONGROUND(this));
}
void PlayerCorpseDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force)
excess = frag_damage;
Weapon wep = PS(this).m_weapon;
- WITH(entity, self, this, wep.wr_playerdeath(wep));
+ WITHSELF(this, wep.wr_playerdeath(wep));
RemoveGrapplingHook(this);
// reset fields the weapons may use just in case
FOREACH(Weapons, it != WEP_Null, LAMBDA(
- WITH(entity, self, this, it.wr_resetplayer(it));
+ WITHSELF(this, it.wr_resetplayer(it));
for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
{
ATTACK_FINISHED_FOR(this, it.m_id, slot) = 0;
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
+#include "banning.qc"
+#include "cmd.qc"
+#include "common.qc"
+#include "getreplies.qc"
+#include "radarmap.qc"
+#include "sv_cmd.qc"
+#include "vote.qc"
#include "all.qh"
#include <common/command/all.qc>
-
-#include "sv_cmd.qc"
-
-#include "banning.qc"
-#include "cmd.qc"
-#include "common.qc"
-#include "getreplies.qc"
-#include "radarmap.qc"
-#include "vote.qc"
if (command != command2) return;
// if we're banned, don't even parse the command
- if (Ban_MaybeEnforceBanOnce(self)) return;
+ if (Ban_MaybeEnforceBanOnce(this)) return;
float argc = tokenize_console(command);
{
if (argc == 1)
{
- sprint(self, "\nClient networked commands:\n");
+ sprint(this, "\nClient networked commands:\n");
ClientCommand_macro_help();
- sprint(self, "\nCommon networked commands:\n");
- CommonCommand_macro_help(self);
+ sprint(this, "\nCommon networked commands:\n");
+ CommonCommand_macro_help(this);
- sprint(self, "\nUsage:^3 cmd COMMAND...^7, where possible commands are listed above.\n");
- sprint(self, "For help about a specific command, type cmd help COMMAND\n");
+ sprint(this, "\nUsage:^3 cmd COMMAND...^7, where possible commands are listed above.\n");
+ sprint(this, "For help about a specific command, type cmd help COMMAND\n");
return;
}
- else if (CommonCommand_macro_usage(argc, self)) // Instead of trying to call a command, we're going to see detailed information about it
+ else if (CommonCommand_macro_usage(argc, this)) // Instead of trying to call a command, we're going to see detailed information about it
{
return;
}
{
return; // handled by server/cheats.qc
}
- else if (CommonCommand_macro_command(argc, self, command))
+ else if (CommonCommand_macro_command(argc, this, command))
{
return; // handled by server/command/common.qc
}
}
else
{
- clientcommand(self, command);
+ clientcommand(this, command);
}
}
int n = 0;
FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
if (it.caplayer) it.caplayer = 0;
- WITH(entity, self, it, PutObserverInServer());
+ WITHSELF(it, PutObserverInServer());
++n;
));
if (n) bprint(strcat("Successfully forced all (", ftos(n), ") players to spectate", (reason ? strcat(" for reason: '", reason, "'") : ""), ".\n"));
if (!IS_SPEC(client) && !IS_OBSERVER(client))
{
if (client.caplayer) client.caplayer = 0;
- WITH(entity, self, client, PutObserverInServer());
+ WITHSELF(client, PutObserverInServer());
successful = strcat(successful, (successful ? ", " : ""), client.netname);
}
return;
}
- WITH(entity, self, client, playerdemo_open_read(argv(next_token)));
+ WITHSELF(client, playerdemo_open_read(argv(next_token)));
return;
}
return;
}
- WITH(entity, self, client, playerdemo_open_write(argv(next_token)));
+ WITHSELF(client, playerdemo_open_write(argv(next_token)));
return;
}
MUTATOR_CALLHOOK(reset_map_global);
- FOREACH_ENTITY_ORDERED(IS_NOT_A_CLIENT(it), LAMBDA(
+ FOREACH_ENTITY_ORDERED(IS_NOT_A_CLIENT(it), {
if (it.reset)
{
- WITH(entity, self, it, it.reset(it));
+ WITHSELF(it, it.reset(it));
continue;
}
if (it.team_saved) it.team = it.team_saved;
if (it.flags & FL_PROJECTILE) remove(it); // remove any projectiles left
- ));
+ });
// Waypoints and assault start come LAST
- FOREACH_ENTITY_ORDERED(IS_NOT_A_CLIENT(it), LAMBDA(
- if (it.reset2) WITH(entity, self, it, it.reset2());
- ));
+ FOREACH_ENTITY_ORDERED(IS_NOT_A_CLIENT(it), {
+ if (it.reset2) WITHSELF(it, it.reset2());
+ });
- FOREACH_CLIENT(IS_PLAYER(it) && STAT(FROZEN, it), LAMBDA(WITH(entity, self, it, Unfreeze(it))));
+ FOREACH_CLIENT(IS_PLAYER(it) && STAT(FROZEN, it), LAMBDA(WITHSELF(it, Unfreeze(it))));
// Moving the player reset code here since the player-reset depends
// on spawnpoint entities which have to be reset first --blub
WepSet weaponsInMap;
#define weapons _STAT(WEAPONS)
-#define weaponsinmap _STAT(WEAPONSINMAP)
.float respawn_countdown; // next number to count
float game_starttime; //point in time when the countdown to game start is over
float round_starttime; //point in time when the countdown to round start is over
-.float stat_game_starttime = _STAT(GAMESTARTTIME);
-.float stat_round_starttime = _STAT(ROUNDSTARTTIME);
void W_Porto_Remove (entity p);
.string message2;
-.bool stat_allow_oldvortexbeam = _STAT(ALLOW_OLDVORTEXBEAM);
-
// reset to 0 on weapon switch
// may be useful to all weapons
.float bulletcounter;
.float damage_dealt_total = _STAT(DAMAGE_DEALT_TOTAL);
-.float stat_leadlimit = _STAT(LEADLIMIT);
-
bool radar_showennemies;
#ifdef PROFILING
targ.iceblock = ice;
targ.revival_time = 0;
- WITH(entity, self, ice, Ice_Think());
+ WITHSELF(ice, Ice_Think());
RemoveGrapplingHook(targ);
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, Weapon w);
+void W_SwitchWeapon_Force(Player this, Weapon w);
entity GiveFrags_randomweapons;
void GiveFrags (entity attacker, entity targ, float f, int deathtype);
*/
void dynlight_think()
{
+ SELFPARAM();
if(!self.owner)
remove(self);
}
void dynlight_find_aiment()
{
+ SELFPARAM();
entity targ;
if (!self.target)
objerror ("dynlight: no target to follow");
}
void dynlight_find_path()
{
+ SELFPARAM();
entity targ;
if (!self.target)
objerror ("dynlight: no target to follow");
}
void dynlight_find_target()
{
+ SELFPARAM();
entity targ;
if (!self.target)
objerror ("dynlight: no target to follow");
}
void dynlight_use()
{
+ SELFPARAM();
if (self.light_lev == 0)
self.light_lev = self.lefty;
else
{
int d = autocvar_loddebug;
if(d == 1)
- self.modelindex = self.lodmodelindex0;
- else if(d == 2 || !self.lodmodelindex2)
- self.modelindex = self.lodmodelindex1;
+ this.modelindex = this.lodmodelindex0;
+ else if(d == 2 || !this.lodmodelindex2)
+ this.modelindex = this.lodmodelindex1;
else // if(d == 3)
- self.modelindex = self.lodmodelindex2;
+ this.modelindex = this.lodmodelindex2;
return true;
}
// TODO csqc network this so it only gets sent once
- vector near_point = NearestPointOnBox(self, other.origin);
- if(vdist(near_point - other.origin, <, self.loddistance1))
- self.modelindex = self.lodmodelindex0;
- else if(!self.lodmodelindex2 || vdist(near_point - other.origin, <, self.loddistance2))
- self.modelindex = self.lodmodelindex1;
+ vector near_point = NearestPointOnBox(this, other.origin);
+ if(vdist(near_point - other.origin, <, this.loddistance1))
+ this.modelindex = this.lodmodelindex0;
+ else if(!this.lodmodelindex2 || vdist(near_point - other.origin, <, this.loddistance2))
+ this.modelindex = this.lodmodelindex1;
else
- self.modelindex = self.lodmodelindex2;
+ this.modelindex = this.lodmodelindex2;
return true;
}
void LOD_uncustomize()
{SELFPARAM();
- self.modelindex = self.lodmodelindex0;
+ this.modelindex = this.lodmodelindex0;
}
void LODmodel_attach()
{SELFPARAM();
entity e;
- if(!self.loddistance1)
- self.loddistance1 = 1000;
- if(!self.loddistance2)
- self.loddistance2 = 2000;
- self.lodmodelindex0 = self.modelindex;
+ if(!this.loddistance1)
+ this.loddistance1 = 1000;
+ if(!this.loddistance2)
+ this.loddistance2 = 2000;
+ this.lodmodelindex0 = this.modelindex;
- if(self.lodtarget1 != "")
+ if(this.lodtarget1 != "")
{
- e = find(world, targetname, self.lodtarget1);
+ e = find(world, targetname, this.lodtarget1);
if(e)
{
- self.lodmodel1 = e.model;
+ this.lodmodel1 = e.model;
remove(e);
}
}
- if(self.lodtarget2 != "")
+ if(this.lodtarget2 != "")
{
- e = find(world, targetname, self.lodtarget2);
+ e = find(world, targetname, this.lodtarget2);
if(e)
{
- self.lodmodel2 = e.model;
+ this.lodmodel2 = e.model;
remove(e);
}
}
if(autocvar_loddebug < 0)
{
- self.lodmodel1 = self.lodmodel2 = ""; // don't even initialize
+ this.lodmodel1 = this.lodmodel2 = ""; // don't even initialize
}
- if(self.lodmodel1 != "")
+ if(this.lodmodel1 != "")
{
vector mi, ma;
- mi = self.mins;
- ma = self.maxs;
+ mi = this.mins;
+ ma = this.maxs;
- precache_model(self.lodmodel1);
- _setmodel(self, self.lodmodel1);
- self.lodmodelindex1 = self.modelindex;
+ precache_model(this.lodmodel1);
+ _setmodel(this, this.lodmodel1);
+ this.lodmodelindex1 = this.modelindex;
- if(self.lodmodel2 != "")
+ if(this.lodmodel2 != "")
{
- precache_model(self.lodmodel2);
- _setmodel(self, self.lodmodel2);
- self.lodmodelindex2 = self.modelindex;
+ precache_model(this.lodmodel2);
+ _setmodel(this, this.lodmodel2);
+ this.lodmodelindex2 = this.modelindex;
}
- self.modelindex = self.lodmodelindex0;
- setsize(self, mi, ma);
+ this.modelindex = this.lodmodelindex0;
+ setsize(this, mi, ma);
}
- if(self.lodmodelindex1)
- if (!self.SendEntity)
- SetCustomizer(self, LOD_customize, LOD_uncustomize);
+ if(this.lodmodelindex1)
+ if (!this.SendEntity)
+ SetCustomizer(this, LOD_customize, LOD_uncustomize);
}
void ApplyMinMaxScaleAngles(entity e)
delta = 3 / maxclients;
if(delta < sys_frametime)
delta = 0;
- self.nextthink = time + delta;
+ this.nextthink = time + delta;
- e = edict_num(self.cnt + 1);
+ e = edict_num(this.cnt + 1);
if(IS_REAL_CLIENT(e))
{
WriteHeader(MSG_BROADCAST, TE_CSQC_PINGPLREPORT);
- WriteByte(MSG_BROADCAST, self.cnt);
+ WriteByte(MSG_BROADCAST, this.cnt);
WriteShort(MSG_BROADCAST, max(1, e.ping));
WriteByte(MSG_BROADCAST, ceil(e.ping_packetloss * 255));
WriteByte(MSG_BROADCAST, ceil(e.ping_movementloss * 255));
else
{
WriteHeader(MSG_BROADCAST, TE_CSQC_PINGPLREPORT);
- WriteByte(MSG_BROADCAST, self.cnt);
+ WriteByte(MSG_BROADCAST, this.cnt);
WriteShort(MSG_BROADCAST, 0);
WriteByte(MSG_BROADCAST, 0);
WriteByte(MSG_BROADCAST, 0);
}
- self.cnt = (self.cnt + 1) % maxclients;
+ this.cnt = (this.cnt + 1) % maxclients;
}
void PingPLReport_Spawn()
{
bool RandomSeed_Send(entity this, entity to, int sf)
{
WriteHeader(MSG_ENTITY, ENT_CLIENT_RANDOMSEED);
- WriteShort(MSG_ENTITY, self.cnt);
+ WriteShort(MSG_ENTITY, this.cnt);
return true;
}
void RandomSeed_Think()
{SELFPARAM();
- self.cnt = bound(0, floor(random() * 65536), 65535);
- self.nextthink = time + 5;
+ this.cnt = bound(0, floor(random() * 65536), 65535);
+ this.nextthink = time + 5;
- self.SendFlags |= 1;
+ this.SendFlags |= 1;
}
void RandomSeed_Spawn()
{SELFPARAM();
randomseed.think = RandomSeed_Think;
Net_LinkEntity(randomseed, false, 0, RandomSeed_Send);
- WITH(entity, self, randomseed, randomseed.think()); // sets random seed and nextthink
+ WITHSELF(randomseed, randomseed.think()); // sets random seed and nextthink
}
spawnfunc(__init_dedicated_server)
bprint(it.netname, " ^7wins.\n");
));
- entity oldself = self;
- target_music_kill();
- self = oldself;
+ WITHSELF(NULL, target_music_kill());
if(autocvar_g_campaign)
CampaignPreIntermission();
if (gameover) // someone else quit the game already
return;
- if(!IS_DEAD(self))
- self.play_time += frametime;
+ if(!IS_DEAD(this))
+ this.play_time += frametime;
// fixme: don't check players; instead check spawnfunc_dom_team and spawnfunc_ctf_team entities
// (div0: and that in CheckRules_World please)
//dprint("Delayed initialization: ", e.classname, "\n");
if (func)
{
- WITH(entity, self, e, func());
+ WITHSELF(e, func());
}
else
{
--- /dev/null
+// generated file; do not modify
+#include "all.qc"
* called when a vehicle initializes
* return true to remove the vehicle
*/
-MUTATOR_HOOKABLE(VehicleSpawn, EV_NO_ARGS);
+#define EV_VehicleSpawn(i, o) \
+ /**/ i(entity, __self) \
+ /**/
+MUTATOR_HOOKABLE(VehicleSpawn, EV_VehicleSpawn);
/**
* called when a player enters a vehicle
--- /dev/null
+// generated file; do not modify
+#include "gamemode_assault.qc"
+#include "gamemode_ca.qc"
+#include "gamemode_ctf.qc"
+#include "gamemode_cts.qc"
+#include "gamemode_deathmatch.qc"
+#include "gamemode_domination.qc"
+#include "gamemode_freezetag.qc"
+#include "gamemode_invasion.qc"
+#include "gamemode_keepaway.qc"
+#include "gamemode_keyhunt.qc"
+#include "gamemode_lms.qc"
+#include "gamemode_race.qc"
+#include "gamemode_tdm.qc"
{
if (e.classname == "target_objective_decrease")
{
- WITH(entity, self, e, target_objective_decrease_activate());
+ WITHSELF(e, target_objective_decrease_activate());
}
}
it.team = NUM_TEAM_1;
// Dubbles as teamchange
- WITH(entity, self, it, turret_respawn());
+ WITHSELF(it, turret_respawn());
));
}
//bprint("ASSAULT: new round\n");
// Eject players from vehicles
- FOREACH_CLIENT(IS_PLAYER(it) && it.vehicle, LAMBDA(WITH(entity, self, it, vehicles_exit(VHEF_RELEASE))));
+ FOREACH_CLIENT(IS_PLAYER(it) && it.vehicle, WITHSELF(it, vehicles_exit(VHEF_RELEASE)));
FOREACH_ENTITY_FLAGS(vehicle_flags, VHF_ISVEHICLE, LAMBDA(
setself(it);
}
else
{
- WITH(entity, self, ent, assault_new_round());
+ WITHSELF(ent, assault_new_round());
}
}
}
{
TRANSMUTE(Player, it);
it.caplayer = 1;
- WITH(entity, self, it, PutClientInServer());
+ WITHSELF(it, PutClientInServer());
}
});
return true;
this.netname = teamname;
this.cnt = teamcolor;
this.spawnfunc_checked = true;
- WITH(entity, self, this, spawnfunc_ctf_team(this));
+ WITHSELF(this, spawnfunc_ctf_team(this));
}
void ctf_DelayedInit() // Do this check with a delay so we can wait for teams to be set up.
if(round_handler_CountdownRunning())
{
if(STAT(FROZEN, frag_target))
- WITH(entity, self, frag_target, freezetag_Unfreeze(world));
+ WITHSELF(frag_target, freezetag_Unfreeze(world));
freezetag_count_alive_players();
return 1; // let the player die so that he can respawn whenever he wants
}
freezetag_LastPlayerForTeam_Notify();
}
else
- WITH(entity, self, frag_target, freezetag_Unfreeze(world)); // remove ice
+ WITHSELF(frag_target, freezetag_Unfreeze(world)); // remove ice
frag_target.health = 0; // Unfreeze resets health
frag_target.freezetag_frozen_timeout = -2; // freeze on respawn
return 1;
if(STAT(FROZEN, frag_target))
return 1;
- WITH(entity, self, frag_target, freezetag_Freeze(frag_attacker));
+ WITHSELF(frag_target, freezetag_Freeze(frag_attacker));
freezetag_LastPlayerForTeam_Notify();
if(frag_attacker == frag_target || frag_attacker == world)
MUTATOR_HOOKFUNCTION(lms, PlayerPreThink)
{SELFPARAM();
- if(self.deadflag == DEAD_DYING)
- self.deadflag = DEAD_RESPAWNING;
+ if(this.deadflag == DEAD_DYING)
+ this.deadflag = DEAD_RESPAWNING;
return false;
}
this.netname = teamname;
this.cnt = teamcolor;
this.spawnfunc_checked = true;
- WITH(entity, self, this, spawnfunc_tdm_team(this));
+ WITHSELF(this, spawnfunc_tdm_team(this));
}
void tdm_DelayedInit()
--- /dev/null
+// generated file; do not modify
+#include "costs.qc"
+#include "debug.qc"
+#include "expandnode.qc"
+#include "main.qc"
+#include "movenode.qc"
+#include "path_waypoint.qc"
+#include "utility.qc"
}
void playerdemo_write()
{SELFPARAM();
- if(self.playerdemo_mode != PLAYERDEMO_MODE_WRITING)
+ if(this.playerdemo_mode != PLAYERDEMO_MODE_WRITING)
return;
- fputs(self.playerdemo_fh, strcat(ftos(time - self.playerdemo_starttime), "\n"));
+ fputs(this.playerdemo_fh, strcat(ftos(time - this.playerdemo_starttime), "\n"));
PLAYERDEMO_FIELDS(playerdemo_write_)
}
void playerdemo_read_originvector(.vector f, string name)
PLAYERDEMO_FIELDS(playerdemo_read_)
{
time = this.playerdemo_time;
- WITH(entity, self, this, PlayerPreThink());
+ WITHSELF(this, PlayerPreThink());
// not running physics though... this is just so we can run weapon stuff
- WITH(entity, self, this, PlayerPostThink());
+ WITHSELF(this, PlayerPostThink());
}
this.playerdemo_time = stof(fgets(this.playerdemo_fh));
if(this.playerdemo_time == 0)
-#include "../lib/_all.inc"
-#include "_all.qh"
-
-#include "../common/effects/qc/all.qc"
-
-#include "anticheat.qc"
-#include "antilag.qc"
-#include "campaign.qc"
-#include "cheats.qc"
-#include "cl_client.qc"
-#include "cl_impulse.qc"
-#include "cl_player.qc"
-#include "g_damage.qc"
-#include "g_hook.qc"
-// #include "g_lights.qc" // TODO: was never used
-#include "g_models.qc"
-#include "g_subs.qc"
-#include "g_world.qc"
-#include "ipban.qc"
-#include "item_key.qc"
-#include "mapvoting.qc"
-#include "miscfunctions.qc"
-#include "playerdemo.qc"
-#include "portals.qc"
-#include "race.qc"
-#include "round_handler.qc"
-#include "scores.qc"
-#include "scores_rules.qc"
-#include "spawnpoints.qc"
-#include "steerlib.qc"
-#include "sv_main.qc"
-#include "teamplay.qc"
-#include "t_halflife.qc"
-#include "t_quake3.qc"
-#include "t_quake.qc"
-
-#include "tests.qc"
-
-#include "bot/_all.inc"
+#ifndef DEBUGPATHING
+ #define DEBUGPATHING 0
+#endif
-#include "command/all.qc"
+#include <lib/_all.inc>
+#include "_all.qh"
+#include "_mod.inc"
+#include "bot/_mod.inc"
+#include "bot/havocbot/_mod.inc"
+#include "command/_mod.inc"
+#include "mutators/_mod.inc"
#include "pathlib/_all.inc"
+#include "weapons/_mod.inc"
-#include "weapons/accuracy.qc"
-#include "weapons/common.qc"
-#include "weapons/csqcprojectile.qc" // TODO
-#include "weapons/hitplot.qc"
-#include "weapons/selection.qc"
-#include "weapons/spawning.qc"
-#include "weapons/throwing.qc"
-#include "weapons/tracing.qc"
-#include "weapons/weaponstats.qc"
-#include "weapons/weaponsystem.qc"
-
-#include "../common/_all.inc"
-#include "mutators/all.qc"
+#include <common/_all.inc>
+#include <common/effects/qc/all.qc>
-#include "../lib/csqcmodel/sv_model.qc"
+#include <lib/csqcmodel/sv_model.qc>
-#include "../lib/warpzone/anglestransform.qc"
-#include "../lib/warpzone/common.qc"
-#include "../lib/warpzone/server.qc"
-#include "../lib/warpzone/util_server.qc"
+#include <lib/warpzone/anglestransform.qc>
+#include <lib/warpzone/common.qc>
+#include <lib/warpzone/server.qc>
+#include <lib/warpzone/util_server.qc>
#if BUILD_MOD
#include "../../mod/server/progs.inc"
FOREACH_CLIENT(true, LAMBDA(
float p = it.race_place;
- WITH(entity, self, it, race_PreparePlayer());
+ WITHSELF(it, race_PreparePlayer());
it.race_place = p;
));
}
void spawnpoint_think()
{
SELFPARAM();
- self.nextthink = time + 0.1;
- if(self.origin != self.spawnpoint_prevorigin)
+ this.nextthink = time + 0.1;
+ if(this.origin != this.spawnpoint_prevorigin)
{
- self.spawnpoint_prevorigin = self.origin;
- self.SendFlags |= 1;
+ this.spawnpoint_prevorigin = this.origin;
+ this.SendFlags |= 1;
}
}
++found;
if(ent.spawn_evalfunc)
{
- WITH(entity, self, ent, {
- spawn_score = ent.spawn_evalfunc(this, spot, spawn_score);
- });
+ WITHSELF(ent, spawn_score = ent.spawn_evalfunc(this, spot, spawn_score));
if(spawn_score.x < 0)
return spawn_score;
}
void CreatureFrame_All()
{
- FOREACH_ENTITY_FLOAT(damagedbycontents, true, LAMBDA(
- if(it.movetype == MOVETYPE_NOCLIP) continue;
+ FOREACH_ENTITY_FLOAT(damagedbycontents, true, {
+ if (it.movetype == MOVETYPE_NOCLIP) continue;
CreatureFrame_Liquids(it);
CreatureFrame_FallDamage(it);
it.oldvelocity = it.velocity;
- ));
+ });
}
void Pause_TryPause(bool ispaused)
void StartFrame()
{
// TODO: if move is more than 50ms, split it into two moves (this matches QWSV behavior and the client prediction)
- FOREACH_ENTITY_CLASS(STR_PLAYER, IS_NOT_A_CLIENT(it), PM_Main(it));
- FOREACH_ENTITY_CLASS(STR_PLAYER, IS_NOT_A_CLIENT(it), WITH(entity, self, it, PlayerPreThink()));
+ FOREACH_ENTITY_CLASS(STR_PLAYER, IS_FAKE_CLIENT(it), PM_Main(it));
+ FOREACH_ENTITY_CLASS(STR_PLAYER, IS_FAKE_CLIENT(it), WITHSELF(it, PlayerPreThink()));
execute_next_frame();
if (autocvar_sv_autopause && !server_is_dedicated) Pause_TryPause(true);
}
#endif
- FOREACH_ENTITY_FLOAT(csqcprojectile_clientanimate, true, LAMBDA(CSQCProjectile_Check(it)));
+ FOREACH_ENTITY_FLOAT(csqcprojectile_clientanimate, true, CSQCProjectile_Check(it));
- if(RedirectionThink())
- return;
+ if (RedirectionThink()) return;
UncustomizeEntitiesRun();
InitializeEntitiesRun();
WarpZone_StartFrame();
sys_frametime = autocvar_sys_ticrate * autocvar_slowmo;
- if(sys_frametime <= 0)
- sys_frametime = 1.0 / 60.0; // somewhat safe fallback
+ if (sys_frametime <= 0) sys_frametime = 1.0 / 60.0; // somewhat safe fallback
if (timeout_status == TIMEOUT_LEADTIME) // just before the timeout (when timeout_status will be TIMEOUT_ACTIVE)
orig_slowmo = autocvar_slowmo; // slowmo will be restored after the timeout
// detect when the pre-game countdown (if any) has ended and the game has started
game_delay = (time < game_starttime);
- if(autocvar_sv_eventlog && game_delay_last && !game_delay)
+ if (autocvar_sv_eventlog && game_delay_last && !game_delay)
GameLogEcho(":startdelay_ended");
game_delay_last = game_delay;
CreatureFrame_All();
CheckRules_World();
- if(warmup_stage && !gameover && warmup_limit > 0 && time >= warmup_limit)
- {
+ if (warmup_stage && !gameover && warmup_limit > 0 && time >= warmup_limit) {
ReadyRestart();
return;
}
anticheat_startframe();
MUTATOR_CALLHOOK(SV_StartFrame);
- FOREACH_CLIENT(true, LAMBDA(GlobalStats_update(it)));
- FOREACH_ENTITY_CLASS(STR_PLAYER, IS_NOT_A_CLIENT(it), WITH(entity, self, it, PlayerPostThink()));
+ FOREACH_CLIENT(true, GlobalStats_update(it));
+ FOREACH_ENTITY_CLASS(STR_PLAYER, IS_FAKE_CLIENT(it), WITHSELF(it, PlayerPostThink()));
}
.vector originjitter;
{
entity it;
- Client a = it = NEW(Client, "A");
+ noref Client a = it = NEW(Client, "A");
WITH(float, autocvar_g_spawnshieldtime, 0, Client_Add(it, NUM_TEAM_1));
it.origin = '-100 0 0';
it.angles = '0 0 0';
- Client b = it = NEW(Client, "B");
+ noref Client b = it = NEW(Client, "B");
WITH(float, autocvar_g_spawnshieldtime, 0, Client_Add(it, NUM_TEAM_2));
it.origin = '100 0 0';
it.angles = '0 180 0';
SUCCEED();
}
+
+TEST(Vehicles, Spawn)
+{
+ entity it;
+
+ noref Client bot = it = NEW(Client, "Rider");
+ Client_Add(it, NUM_TEAM_1);
+ it.origin = '0 0 100';
+
+ noref entity v = it = new(vehicle);
+ Vehicle veh = VEH_BUMBLEBEE;
+ it.active = ACTIVE_NOT;
+ vehicle_initialize(it, veh, false);
+ it.nextthink = time;
+
+ SUCCEED();
+}
#include <common/items/item.qh>
#include <common/physics/player.qh>
#include <common/weapons/all.qh>
+#include <common/vehicles/all.qh>
--- /dev/null
+// generated file; do not modify
+#include "accuracy.qc"
+#include "common.qc"
+#include "csqcprojectile.qc"
+#include "hitplot.qc"
+#include "selection.qc"
+#include "spawning.qc"
+#include "throwing.qc"
+#include "tracing.qc"
+#include "weaponstats.qc"
+#include "weaponsystem.qc"
}
else
{
- WITH(entity, self, cl, f = wpn.wr_checkammo1(wpn) + wpn.wr_checkammo2(wpn));
+ WITHSELF(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
if(wpn == WEP_MINE_LAYER)
return 0;
}
-void W_SwitchWeapon_Force(entity e, Weapon wep)
+void W_SwitchWeapon_Force(Player this, Weapon wep)
{
- e.cnt = PS(e).m_switchweapon.m_id;
- PS(e).m_switchweapon = wep;
- e.selectweapon = wep.m_id;
+ TC(Player, this); TC(Weapon, wep);
+ this.cnt = PS(this).m_switchweapon.m_id;
+ PS(this).m_switchweapon = wep;
+ this.selectweapon = wep.m_id;
}
// perform weapon to attack (weaponstate and attack_finished check is here)
#define w_getbestweapon(ent) Weapons_from(W_GetCycleWeapon(ent, ent.cvar_cl_weaponpriority, 0, -1, false, true))
-void W_SwitchWeapon_Force(entity e, Weapon w);
+void W_SwitchWeapon_Force(Player this, Weapon w);
// perform weapon to attack (weaponstate and attack_finished check is here)
void W_SwitchToOtherWeapon(entity pl);
fireBullet_last_hit = world;
}
-void fireBullet(vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, int tracereffects)
-{SELFPARAM();
+void fireBullet(entity this, vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, int tracereffects)
+{
vector end;
dir = normalize(dir + randomvec() * spread);
else
fireBullet_trace_callback_eff = EFFECT_BULLET;
- float lag = ANTILAG_LATENCY(self);
+ float lag = ANTILAG_LATENCY(this);
if(lag < 0.001)
lag = 0;
- if (!IS_REAL_CLIENT(self))
+ if (!IS_REAL_CLIENT(this))
lag = 0;
- if(autocvar_g_antilag == 0 || self.cvar_cl_noantilag)
+ if(autocvar_g_antilag == 0 || this.cvar_cl_noantilag)
lag = 0; // only do hitscan, but no antilag
if(lag)
{
- FOREACH_CLIENT(IS_PLAYER(it) && it != self, antilag_takeback(it, CS(it), time - lag));
+ FOREACH_CLIENT(IS_PLAYER(it) && it != this, antilag_takeback(it, CS(it), time - lag));
FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, {
- if (it != self)
+ if (it != this)
antilag_takeback(it, it, time - lag);
});
}
// change shooter to SOLID_BBOX so the shot can hit corpses
- int oldsolid = self.dphitcontentsmask;
- if(self)
- self.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
+ int oldsolid = this.dphitcontentsmask;
+ if(this)
+ this.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE;
- WarpZone_trace_forent = self;
+ WarpZone_trace_forent = this;
for (;;)
{
is_weapclip = true;
if(!hit || hit.solid == SOLID_BSP || hit.solid == SOLID_SLIDEBOX)
- Damage_DamageInfo(start, damage * solid_penetration_left, 0, 0, max(1, force) * dir * solid_penetration_left, dtype, hit.species, self);
+ Damage_DamageInfo(start, damage * solid_penetration_left, 0, 0, max(1, force) * dir * solid_penetration_left, dtype, hit.species, this);
if (hit && hit != WarpZone_trace_forent && hit != fireBullet_last_hit) // Avoid self-damage (except after going through a warp); avoid hitting the same entity twice (engine bug).
{
fireBullet_last_hit = hit;
yoda = 0;
- MUTATOR_CALLHOOK(FireBullet_Hit, self, hit, start, end, damage);
+ MUTATOR_CALLHOOK(FireBullet_Hit, this, hit, start, end, damage);
damage = frag_damage;
- float g = accuracy_isgooddamage(self, hit);
- Damage(hit, self, self, damage * solid_penetration_left, dtype, start, force * dir * solid_penetration_left);
+ float g = accuracy_isgooddamage(this, hit);
+ Damage(hit, this, this, damage * solid_penetration_left, dtype, start, force * dir * solid_penetration_left);
// calculate hits for ballistic weapons
if(g)
{
// do not exceed 100%
float added_damage = min(damage - total_damage, damage * solid_penetration_left);
total_damage += damage * solid_penetration_left;
- accuracy_add(self, PS(self).m_weapon.m_id, 0, added_damage);
+ accuracy_add(this, PS(this).m_weapon.m_id, 0, added_damage);
}
}
// Only show effect when going through a player (invisible otherwise)
if (hit && (hit.solid != SOLID_BSP))
if(vdist(trace_endpos - start, >, 4))
- trailparticles(self, fireBullet_trace_callback_eff, start, trace_endpos);
+ trailparticles(this, fireBullet_trace_callback_eff, start, trace_endpos);
start = trace_endpos;
if(hit.solid == SOLID_BSP)
- Damage_DamageInfo(start, 0, 0, 0, max(1, force) * normalize(dir) * -solid_penetration_left, dtype, 0, self);
+ Damage_DamageInfo(start, 0, 0, 0, max(1, force) * normalize(dir) * -solid_penetration_left, dtype, 0, this);
}
if(lag)
{
- FOREACH_CLIENT(IS_PLAYER(it) && it != self, antilag_restore(it, CS(it)));
+ FOREACH_CLIENT(IS_PLAYER(it) && it != this, antilag_restore(it, CS(it)));
FOREACH_ENTITY_FLAGS(flags, FL_MONSTER, {
- if (it != self)
+ if (it != this)
antilag_restore(it, it);
});
}
// restore shooter solid type
- if(self)
- self.dphitcontentsmask = oldsolid;
+ if(this)
+ this.dphitcontentsmask = oldsolid;
}
entity fireBullet_trace_callback_eff;
entity fireBullet_last_hit;
void fireBullet_trace_callback(vector start, vector hit, vector end);
-void fireBullet(vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, int tracereffects);
+void fireBullet(entity this, vector start, vector dir, float spread, float max_solid_penetration, float damage, float force, float dtype, int tracereffects);
remove(this);
return;
}
- if (IS_DEAD(self.owner))
+ if (IS_DEAD(this.owner))
{
// owner died; disappear
this.model = "";
remove(this);
return;
}
- if (IS_DEAD(self.owner))
+ if (IS_DEAD(this.owner))
{
this.model = "";
return;
SELFPARAM();
if ((actor.items & IT_UNLIMITED_WEAPON_AMMO)) return true;
bool ammo = false;
- if (secondary) WITH(entity, self, actor, ammo = thiswep.wr_checkammo2(thiswep));
- else WITH(entity, self, actor, ammo = thiswep.wr_checkammo1(thiswep));
+ if (secondary) WITHSELF(actor, ammo = thiswep.wr_checkammo2(thiswep));
+ else WITHSELF(actor, ammo = thiswep.wr_checkammo1(thiswep));
if (ammo) return true;
// always keep the Mine Layer if we placed mines, so that we can detonate them
if (thiswep == WEP_MINE_LAYER)
// check if the other firing mode has enough ammo
bool ammo_other = false;
- if (secondary) WITH(entity, self, actor, ammo_other = thiswep.wr_checkammo1(thiswep));
- else WITH(entity, self, actor, ammo_other = thiswep.wr_checkammo2(thiswep));
+ if (secondary) WITHSELF(actor, ammo_other = thiswep.wr_checkammo1(thiswep));
+ else WITHSELF(actor, ammo_other = thiswep.wr_checkammo2(thiswep));
if (ammo_other)
{
if (time - actor.prevwarntime > 1)
.bool hook_switchweapon;
-void W_WeaponFrame(entity actor)
+void W_WeaponFrame(Player actor)
{
+ TC(Player, actor);
+ TC(PlayerState, PS(actor));
.entity weaponentity = weaponentities[0]; // TODO: unhardcode
entity this = actor.(weaponentity);
if (frametime) actor.weapon_frametime = frametime;
if (!block_weapon)
{
Weapon e = PS(actor).m_weapon;
+ TC(Weapon, e);
if (w != WEP_Null)
{
e.wr_think(e, actor, weaponentity, PHYS_INPUT_BUTTON_ATCK(actor) | (PHYS_INPUT_BUTTON_ATCK2(actor) << 1));
}
- else
+ else if (e)
{
e.wr_gonethink(e);
}
SELFPARAM();
Weapon w = Weapons_from(weapon_type);
weapon_dropevent_item = weapon_item;
- WITH(entity, self, player, w.event(w));
+ WITHSELF(player, w.event(w));
}
void W_Reload(entity actor, float sent_ammo_min, Sound sent_sound);
-void W_WeaponFrame(entity actor);
+void W_WeaponFrame(Player actor);
float W_WeaponRateFactor();
declare -a QCCDEFS=(
-DNDEBUG=1
- -DWATERMARK="\"$(git describe --tags --dirty='*')\""
+ -DWATERMARK="\"$(git describe --tags --dirty='~')\""
-DDEBUGPATHING=0
)
QCCDEFS="${QCCDEFS[@]}"
--- /dev/null
+#!/bin/bash
+set -eu
+cd "$(dirname "$0")"
+cd ..
+
+MOD=_mod.inc
+
+function genmod() {
+ echo '// generated file; do not modify' > ${MOD}
+ for f in $(ls | sort -k 1,1 -t .); do
+ if [[ "$f" == *.qc ]]; then echo "#include \"$f\"" >> ${MOD}; fi
+ done
+ # echo >> ${MOD}
+ for f in *; do if [ -d "$f" ]; then
+ (cd -- "$f" && genmod)
+ # echo "#include \"$f/MOD\"" >> ${MOD}
+ fi; done
+}
+
+(cd lib; genmod)
+(cd common; genmod)
+(cd client; genmod)
+(cd server; genmod)
+(cd menu; genmod)
set g_turrets_unit_ewheel_track_type 1
set g_turrets_unit_ewheel_track_accel_pitch 0
set g_turrets_unit_ewheel_track_accel_rot 0
+
+set g_turrets_unit_ewheel_track_blendrate 0
// }}}
// {{{ #2: FLAC Cannon
set g_turrets_unit_flac_health 700
set g_turrets_unit_tesla_ammo_max 1000
set g_turrets_unit_tesla_ammo 200
set g_turrets_unit_tesla_ammo_recharge 15
+
+set g_turrets_unit_tesla_shot_radius 0
+set g_turrets_unit_tesla_shot_speed 0
+set g_turrets_unit_tesla_shot_spread 0
+set g_turrets_unit_tesla_target_range_optimal 0
+set g_turrets_unit_tesla_target_select_rangebias 0
+set g_turrets_unit_tesla_target_select_samebias 0
+set g_turrets_unit_tesla_target_select_anglebias 0
+set g_turrets_unit_tesla_aim_firetolerance_dist 0
+set g_turrets_unit_tesla_aim_speed 0
+set g_turrets_unit_tesla_aim_maxrot 0
+set g_turrets_unit_tesla_aim_maxpitch 0
+set g_turrets_unit_tesla_track_type 0
+set g_turrets_unit_tesla_track_accel_pitch 0
+set g_turrets_unit_tesla_track_accel_rot 0
+set g_turrets_unit_tesla_track_blendrate 0
// }}}
// {{{ #12: Walker Turret
set g_turrets_unit_walker_health 500