Commit 9462b11f authored by Marios Fanourakis's avatar Marios Fanourakis
Browse files

updated base source files from xonotic official repository

parent 932f7885
......@@ -3,6 +3,11 @@
To use this logging system just replace the original qcsrc folder in:
xonotic\data\xonotic-data.pk3dir\qcsrc with the one in this repository.
To enable the event logging, edit the file data/xonotic-data.pk3dir/xonotic-server.cfg as follows:
set sv_eventlog 1
qcsrc/server/miscfunctions.qc contains support for LSL, it is commented out by default
# Code Reference For Parsing
This is a reference for the logging codes we obtain from Xonotic just to make sure once analysing the markers everything is correct.
......@@ -107,3 +112,20 @@ Example
4 = Machine Gun Ammo
5 = Mortar / Devastator Ammo
6 = Electro / Crylink / Vortex (Sniper) Ammo
# Notes
This code has been edited from https://gitlab.com/xonotic/xonotic-data.pk3dir repository at revision `d4bf1b512a56e647007f5a35d68613b5b1121dd3`.
Below are the changes made by UniGe:
Modified files:
server/client.qc
qcsrc/server/g_damage.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/resources.qc
qcsrc/server/weapons/common.qc
qcsrc/server/weapons/weaponsystem.qc
New files:
qcsrc/server/liblsl64.dll
qcsrc/server/lsl_c.qh
\ No newline at end of file
/html/
/*.pk3
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
......@@ -93,8 +93,8 @@ pk3: csprogs-$(VER).pk3
$(eval DAT=$(PROG)-$(VER).dat)
$(eval LNO=$(PROG)-$(VER).lno)
@ echo "http://xonotic.org" > $(TXT)
@ ln -f $(PROGS_OUT)/$(PROG).dat $(DAT)
@ ln -f $(PROGS_OUT)/$(PROG).lno $(LNO)
@ cp -f $(PROGS_OUT)/$(PROG).dat $(DAT)
@ cp -f $(PROGS_OUT)/$(PROG).lno $(LNO)
@ $(RM) *.pk3
$(ZIP) $(PK3) $(TXT) $(DAT) $(LNO)
@ $(RM) $(TXT) $(DAT) $(LNO)
......
......@@ -115,7 +115,7 @@ void Announcer_Gamestart()
previous_game_starttime = startTime;
}
#define ANNOUNCER_CHECKMINUTE(minute) MACRO_BEGIN { \
#define ANNOUNCER_CHECKMINUTE(minute) MACRO_BEGIN \
if(announcer_##minute##min) { \
if(timeleft > minute * 60) \
announcer_##minute##min = false; \
......@@ -125,7 +125,7 @@ void Announcer_Gamestart()
Local_Notification(MSG_ANNCE, ANNCE_REMAINING_MIN_##minute); \
} \
} \
} MACRO_END
MACRO_END
void Announcer_Time()
{
......
......@@ -25,7 +25,6 @@ float autocvar_cl_announcer_antispam = 2;
float autocvar_cl_announcer_maptime = 3;
bool autocvar_cl_autodemo_delete;
bool autocvar_cl_autodemo_delete_keeprecords;
bool autocvar_cl_casings;
float autocvar_cl_casings_bronze_time;
int autocvar_cl_casings_maxcount = 100;
float autocvar_cl_casings_shell_time;
......@@ -39,13 +38,13 @@ float autocvar_cl_effects_lightningarc_drift_end;
float autocvar_cl_effects_lightningarc_drift_start;
float autocvar_cl_effects_lightningarc_segmentlength;
bool autocvar_cl_effects_lightningarc_simple;
int autocvar_cl_gentle;
bool autocvar_cl_gentle;
int autocvar_cl_gentle_damage;
int autocvar_cl_gentle_gibs;
int autocvar_cl_gentle_messages;
float autocvar_cl_gibs_damageforcescale = 3.5;
float autocvar_cl_gibs_lifetime = 14;
float autocvar_cl_gibs_maxcount = 100;
int autocvar_cl_gibs_maxcount = 100;
bool autocvar_cl_gibs_sloppy = 1;
float autocvar_cl_gibs_ticrate = 0.1;
float autocvar_cl_gibs_velocity_random = 1;
......@@ -71,13 +70,13 @@ bool autocvar_cl_spawn_event_particles;
bool autocvar_cl_spawn_event_sound = 1;
// float autocvar_cl_spawn_point_model;
bool autocvar_cl_spawn_point_particles;
float autocvar_cl_spawn_point_dist_min = 1200;
float autocvar_cl_spawn_point_dist_max = 1600;
float autocvar_cl_spawn_point_dist_min = 800;
float autocvar_cl_spawn_point_dist_max = 1200;
bool autocvar_cl_spawnzoom = 1;
float autocvar_cl_spawnzoom_speed = 1;
float autocvar_cl_spawnzoom_factor = 2;
bool autocvar_cl_stripcolorcodes;
bool autocvar_cl_vehicles_alarm = true;
bool autocvar_cl_vehicles_alarm = false;
bool autocvar_cl_vehicles_hud_tactical = true;
float autocvar_cl_vehicles_hudscale = 0.5;
float autocvar_cl_vehicles_notify_time = 15;
......@@ -151,6 +150,8 @@ bool autocvar_crosshair_ring_reload;
float autocvar_crosshair_ring_reload_alpha;
float autocvar_crosshair_ring_reload_size;
float autocvar_crosshair_size;
bool autocvar_crosshair_chase = true;
float crosshair_chase_playeralpha = 0.25;
int autocvar_ekg;
float autocvar_fov;
bool autocvar_hud_cursormode = true;
......@@ -268,7 +269,6 @@ bool autocvar_hud_panel_infomessages_flip;
float autocvar_hud_panel_mapvote_highlight_border = 1;
bool autocvar_hud_panel_modicons;
int autocvar_hud_panel_modicons_ca_layout;
int autocvar_hud_panel_modicons_dom_layout;
int autocvar_hud_panel_modicons_freezetag_layout;
bool autocvar_hud_panel_notify;
float autocvar_hud_panel_notify_fadetime;
......@@ -351,6 +351,7 @@ float autocvar_hud_panel_weapons_selection_radius = 0;
float autocvar_hud_panel_weapons_selection_speed = 10;
float autocvar_hud_panel_weapons_timeout;
int autocvar_hud_panel_weapons_timeout_effect;
bool autocvar_hud_panel_weapons_orderbyimpulse = true;
float autocvar_hud_panel_weapons_timeout_fadebgmin;
float autocvar_hud_panel_weapons_timeout_fadefgmin;
float autocvar_hud_panel_weapons_timeout_speed_in = 0.25;
......@@ -381,6 +382,7 @@ float autocvar_hud_shownames_crosshairdistance_antioverlap;
bool autocvar_hud_shownames_self;
bool autocvar_hud_shownames_status;
float autocvar_hud_shownames_statusbar_height;
float autocvar_hud_shownames_statusbar_highlight = 1;
float autocvar_hud_shownames_aspect;
float autocvar_hud_shownames_fontsize;
int autocvar_hud_shownames_decolorize;
......@@ -395,12 +397,12 @@ string autocvar_hud_skin;
float autocvar_menu_mouse_speed;
string autocvar_menu_skin;
int autocvar_r_fakelight;
int autocvar_r_fullbright;
bool autocvar_r_fullbright;
float autocvar_r_letterbox;
string autocvar_scoreboard_columns;
bool autocvar_v_flipped;
float autocvar_vid_conheight;
float autocvar_vid_conwidth;
int autocvar_vid_conheight;
int autocvar_vid_conwidth;
float autocvar_vid_pixelheight;
float autocvar_viewsize;
bool autocvar_cl_eventchase_vehicle = 1;
......@@ -411,6 +413,8 @@ float autocvar_cl_hitsound_min_pitch = 0.75;
float autocvar_cl_hitsound_max_pitch = 1.5;
float autocvar_cl_hitsound_nom_damage = 25;
float autocvar_cl_hitsound_antispam_time;
int autocvar_cl_eventchase_spectated_change = 1;
float autocvar_cl_eventchase_spectated_change_time = 1;
int autocvar_cl_eventchase_death = 1;
float autocvar_cl_eventchase_distance = 140;
bool autocvar_cl_eventchase_frozen = false;
......
......@@ -325,6 +325,7 @@ void LocalCommand_hud(int request, int argc)
case "clickradar":
{
if(!isdemo())
HUD_Radar_Show_Maximized(!hud_panel_radar_mouse, 1);
return;
}
......@@ -433,7 +434,7 @@ void LocalCommand_sendcvar(int request, int argc)
case CMD_REQUEST_USAGE:
{
LOG_INFO("Usage:^3 cl_cmd sendcvar <cvar>");
LOG_INFO(" Where 'cvar' is the cvar plus arguments to send to the server.");
LOG_INFO(" Where 'cvar' is the cvar to send to the server.");
return;
}
}
......@@ -476,7 +477,7 @@ CLIENT_COMMAND(handlevote, "System to handle selecting a vote or option") { Loca
CLIENT_COMMAND(hud, "Commands regarding/controlling the HUD system") { LocalCommand_hud(request, arguments); }
CLIENT_COMMAND(localprint, "Create your own centerprint sent to yourself") { LocalCommand_localprint(request, arguments); }
CLIENT_COMMAND(mv_download, "Retrieve mapshot picture from the server") { LocalCommand_mv_download(request, arguments); }
CLIENT_COMMAND(sendcvar, "Send a cvar to the server (like weaponpriority)") { LocalCommand_sendcvar(request, arguments); }
CLIENT_COMMAND(sendcvar, "Send a cvar to the server (like cl_weaponpriority)") { LocalCommand_sendcvar(request, arguments); }
void LocalCommand_macro_help()
{
......@@ -564,11 +565,12 @@ void GameCommand(string command)
// These functions are here specifically to add special + - commands to the game, and are not really normal commands.
// Please add client commands to the function above this, as this is only for special reasons.
// NOTE: showaccuracy is kept as legacy command
#define CONSOLE_COMMANDS_NORMAL() \
CONSOLE_COMMAND("+showscores", { scoreboard_showscores = true; }) \
CONSOLE_COMMAND("-showscores", { scoreboard_showscores = false; }) \
CONSOLE_COMMAND("+showaccuracy", { scoreboard_showaccuracy = true; }) \
CONSOLE_COMMAND("-showaccuracy", { scoreboard_showaccuracy = false; }) \
CONSOLE_COMMAND("+showaccuracy", { }) \
CONSOLE_COMMAND("-showaccuracy", { }) \
/* nothing */
#define CONSOLE_COMMANDS_MOVEMENT() \
......
......@@ -18,8 +18,6 @@
.float death_time;
.int modelflags;
.bool isplayermodel;
// FEATURE: LOD
.int lodmodelindex0;
.int lodmodelindex1;
......@@ -343,10 +341,10 @@ void CSQCPlayer_FallbackFrame_PostUpdate(entity this, bool isnew)
// player "pops in"
if(isnew)
{
#define FIX_FRAMETIME(f,ft) MACRO_BEGIN { \
#define FIX_FRAMETIME(f,ft) MACRO_BEGIN \
if(IS_DEAD_FRAME(this.f) && this.ft != 0 && this.death_time != 0) \
this.ft = this.death_time; \
} MACRO_END
MACRO_END
FIX_FRAMETIME(frame, frame1time);
FIX_FRAMETIME(frame2, frame2time);
#ifdef CSQCMODEL_HAVE_TWO_FRAMES
......@@ -415,7 +413,7 @@ void CSQCModel_AutoTagIndex_Apply(entity this)
// recursive predraw call to fix issues with forcemodels and LOD if bone indexes mismatch
if(this.tag_entity.classname == "csqcmodel")
{
CSQCModel_Hook_PreDraw(this.tag_entity, (this.tag_entity.entnum >= 1 && this.tag_entity.entnum <= maxclients));
CSQCModel_Hook_PreDraw(this.tag_entity, (this.tag_entity.isplayermodel & ISPLAYER_CLIENT));
}
if(this.tag_entity.modelindex != this.tag_entity_lastmodelindex)
......@@ -443,7 +441,7 @@ void CSQCModel_AutoTagIndex_Apply(entity this)
LOG_TRACE("h_ model lacks weapon attachment, but v_ model is attached to it");
}
}
else if(this.tag_entity.isplayermodel)
else if((this.tag_entity.isplayermodel & ISPLAYER_MODEL))
{
skeleton_loadinfo(this.tag_entity);
this.tag_index = this.tag_entity.bone_weapon;
......@@ -542,6 +540,9 @@ void CSQCModel_Effects_Apply(entity this)
tref = EFFECT_TR_BLOOD.m_id;
if(this.csqcmodel_modelflags & MF_ROTATE)
{
// This will be hard to replace with MAKE_VECTORS because it's called as part of the predraw function
// as documented in csprogs.h in the engine. The globals can then be read in many places in the engine.
// However MF_ROTATE is currently only used in one place - might be possible to get rid of it entirely.
this.renderflags |= RF_USEAXIS;
makevectors(this.angles + '0 100 0' * fmod(time, 3.6));
}
......@@ -600,17 +601,22 @@ void CSQCModel_Hook_PreDraw(entity this, bool isplayer)
return;
this.csqcmodel_predraw_run = framecount;
if(!this.modelindex || this.model == "null")
if(!this.modelindex || this.model == "null" || this.alpha < 0)
{
this.drawmask = 0;
if(this.snd_looping > 0)
{
sound(this, this.snd_looping, SND_Null, VOL_BASE, autocvar_cl_jetpack_attenuation);
this.snd_looping = 0;
}
return;
}
else
this.drawmask = MASK_NORMAL;
if(this.isplayermodel) // this checks if it's a player MODEL!
if((this.isplayermodel & ISPLAYER_MODEL) && this.drawmask) // this checks if it's a player MODEL!
{
CSQCPlayer_ModelAppearance_Apply(this, this.entnum == player_localnum + 1);
CSQCPlayer_ModelAppearance_Apply(this, (this.isplayermodel & ISPLAYER_LOCAL));
CSQCPlayer_LOD_Apply(this);
if(!isplayer)
......@@ -699,7 +705,7 @@ void CSQCModel_Hook_PreUpdate(entity this, bool isnew, bool isplayer, bool isloc
this.iflags |= IFLAG_V_ANGLE_X;
// revert to values from server
CSQCModel_Effects_PreUpdate(this);
if(this.isplayermodel)
if((this.isplayermodel & ISPLAYER_MODEL))
{
if(!isplayer)
CSQCPlayer_FallbackFrame_PreUpdate(this);
......@@ -710,10 +716,12 @@ void CSQCModel_Hook_PreUpdate(entity this, bool isnew, bool isplayer, bool isloc
void CSQCModel_Hook_PostUpdate(entity this, bool isnew, bool isplayer, bool islocalplayer)
{
// is it a player model? (shared state)
this.isplayermodel = (substring(this.model, 0, 14) == "models/player/" || substring(this.model, 0, 17) == "models/ok_player/" || (substring(this.model, 0, 16) == "models/monsters/" && (this.entnum >= 1 && this.entnum <= maxclients)));
bool is_playermodel = (substring(this.model, 0, 14) == "models/player/" || substring(this.model, 0, 17) == "models/ok_player/" ||
(substring(this.model, 0, 16) == "models/monsters/" && (this.isplayermodel & BIT(1))));
this.isplayermodel = BITSET(this.isplayermodel, ISPLAYER_MODEL, is_playermodel);
// save values set by server
if(this.isplayermodel)
if((this.isplayermodel & ISPLAYER_MODEL))
{
CSQCPlayer_ModelAppearance_PostUpdate(this);
if(isplayer)
......
......@@ -23,6 +23,8 @@ const int MF_TRACER3 = BIT(7); // purple trail
.int csqcmodel_modelflags;
.int csqcmodel_traileffect;
.int isplayermodel;
void CSQCModel_Effects_Apply(entity this);
void CSQCModel_Hook_PreDraw(entity this, bool isplayer);
......@@ -3,9 +3,8 @@
// Additional OPTIONAL Fields and Globals
//float intermission;
float scoreboard_showscores;
float scoreboard_showaccuracy;
.string message;
.int renderflags;
.float renderflags;
// float coop;
// float deathmatch;
......@@ -16,7 +15,6 @@ float dmg_take;
// Darkplaces Render Modifications
#if 0
.float alpha;
.float renderflags;
.vector colormod;
.float scale;
#endif
......@@ -78,6 +76,7 @@ float nb_pb_period;
// 0 - playing
// >0 - id of spectated player
float spectatee_status;
float spectatee_status_changed_time;
// short mapname
string shortmapname;
......@@ -110,10 +109,73 @@ int w_deathtype;
float w_issilent, w_random;
vector w_org, w_backoff;
float autoswitch;
bool cvar_cl_allow_uid2name;
bool cvar_cl_allow_uidranking;
float cvar_cl_autoscreenshot;
float cvar_cl_autotaunt;
float cvar_cl_clippedspectating;
int cvar_cl_gunalign;
float cvar_cl_handicap;
float cvar_cl_jetpack_jump;
float cvar_cl_movement_track_canjump;
float cvar_cl_noantilag;
string cvar_cl_physics;
float cvar_cl_voice_directional;
float cvar_cl_voice_directional_taunt_attenuation;
float cvar_cl_weaponimpulsemode;
string cvar_g_xonoticversion;
float cvar_cl_cts_noautoswitch;
bool cvar_cl_weapon_switch_reload;
bool cvar_cl_weapon_switch_fallback_to_impulse;
REPLICATE(autoswitch, bool, "cl_autoswitch");
REPLICATE(cvar_cl_allow_uid2name, bool, "cl_allow_uid2name");
REPLICATE(cvar_cl_allow_uidranking, bool, "cl_allow_uidranking");
REPLICATE(cvar_cl_autoscreenshot, int, "cl_autoscreenshot");
REPLICATE(cvar_cl_autotaunt, float, "cl_autotaunt");
REPLICATE(cvar_cl_clippedspectating, bool, "cl_clippedspectating");
REPLICATE(cvar_cl_gunalign, int, "cl_gunalign");
REPLICATE(cvar_cl_handicap, float, "cl_handicap");
REPLICATE(cvar_cl_jetpack_jump, bool, "cl_jetpack_jump");
REPLICATE(cvar_cl_movement_track_canjump, bool, "cl_movement_track_canjump");
REPLICATE(cvar_cl_noantilag, bool, "cl_noantilag");
REPLICATE(cvar_cl_physics, string, "cl_physics");
REPLICATE(cvar_cl_voice_directional, int, "cl_voice_directional");
REPLICATE(cvar_cl_voice_directional_taunt_attenuation, float, "cl_voice_directional_taunt_attenuation");
REPLICATE(cvar_cl_weaponimpulsemode, int, "cl_weaponimpulsemode");
REPLICATE(cvar_g_xonoticversion, string, "g_xonoticversion");
REPLICATE(cvar_cl_cts_noautoswitch, bool, "cl_cts_noautoswitch");
REPLICATE(cvar_cl_weapon_switch_reload, bool, "cl_weapon_switch_reload");
REPLICATE(cvar_cl_weapon_switch_fallback_to_impulse, bool, "cl_weapon_switch_fallback_to_impulse");
/*
// cvar cl_newusekeysupported doesn't exist
float cvar_cl_newusekeysupported;
REPLICATE(cvar_cl_newusekeysupported, bool, "cl_newusekeysupported");
*/
string cvar_cl_allow_uidtracking;
REPLICATE(cvar_cl_allow_uidtracking, string, "cl_allow_uidtracking");
string cvar_cl_weaponpriority;
REPLICATE(cvar_cl_weaponpriority, string, "cl_weaponpriority");
string cvar_cl_weaponpriorities[10];
REPLICATE(cvar_cl_weaponpriorities[0], string, "cl_weaponpriority0");
REPLICATE(cvar_cl_weaponpriorities[1], string, "cl_weaponpriority1");
REPLICATE(cvar_cl_weaponpriorities[2], string, "cl_weaponpriority2");
REPLICATE(cvar_cl_weaponpriorities[3], string, "cl_weaponpriority3");
REPLICATE(cvar_cl_weaponpriorities[4], string, "cl_weaponpriority4");
REPLICATE(cvar_cl_weaponpriorities[5], string, "cl_weaponpriority5");
REPLICATE(cvar_cl_weaponpriorities[6], string, "cl_weaponpriority6");
REPLICATE(cvar_cl_weaponpriorities[7], string, "cl_weaponpriority7");
REPLICATE(cvar_cl_weaponpriorities[8], string, "cl_weaponpriority8");
REPLICATE(cvar_cl_weaponpriorities[9], string, "cl_weaponpriority9");
float bgmtime;
string weaponorder_byimpulse;
string weaponorder_byimpulse; // NOTE: this is a misnomer, weapon order is not always sorted by impulse
string weaponorder_bypriority;
bool weapons_orderbyimpulse; // update priority list when toggling this
float vortex_charge_movingavg;
......
......@@ -398,6 +398,8 @@ Main HUD system
==================
*/
float lasthud;
float vh_notice_time;
void HUD_Vehicle()
{
if(autocvar__hud_configure) return;
......@@ -409,6 +411,11 @@ void HUD_Vehicle()
Vehicle info = Vehicles_from(hud);
info.vr_hud(info);
}
if(hud != HUD_NORMAL && lasthud == HUD_NORMAL)
vh_notice_time = time + autocvar_cl_vehicles_notify_time;
lasthud = hud;
}
void HUD_Panel_Draw(entity panent)
......@@ -425,7 +432,11 @@ void HUD_Panel_Draw(entity panent)
}
bool draw_allowed = false;
if (active_minigame && HUD_MinigameMenu_IsOpened())
if (scoreboard_fade_alpha && panel.panel_showflags & PANEL_SHOW_WITH_SB)
{
draw_allowed = true;
}
else if (active_minigame && HUD_MinigameMenu_IsOpened())
{
if (panel.panel_showflags & PANEL_SHOW_MINIGAME)
draw_allowed = true;
......@@ -441,7 +452,12 @@ void HUD_Panel_Draw(entity panent)
if (draw_allowed)
{
if (panel.panel_showflags & PANEL_SHOW_WITH_SB)
{
if (scoreboard_fade_alpha && intermission == 2 && !(panel.panel_showflags & PANEL_SHOW_MAPVOTE))
panel_fade_alpha = scoreboard_fade_alpha;
else
panel_fade_alpha = 1;
}
else
{
panel_fade_alpha = 1 - scoreboard_fade_alpha;
......@@ -561,6 +577,25 @@ void Hud_Dynamic_Frame()
HUD_Scale_Disable();
}
bool HUD_WouldShowCursor()
{
if(autocvar__hud_configure)
return true;
if(mv_active)
return true;
//entity local_player = ((csqcplayer) ? csqcplayer : CSQCModel_server2csqc(player_localentnum - 1)); // TODO: doesn't use regular cursor handling
//if(local_player.viewloc && (local_player.viewloc.spawnflags & VIEWLOC_FREEAIM))
//return true;
if(HUD_Radar_Clickable())
return true;
if(HUD_MinigameMenu_IsOpened())
return true;
if(QuickMenu_IsOpened())
return true;
return false;
}
float prev_myteam;
void HUD_Main()
{
int i;
......@@ -569,6 +604,13 @@ void HUD_Main()
else
hud_fade_alpha = 1 - autocvar__menu_alpha;
if(myteam != prev_myteam)
{
myteamcolors = colormapPaletteColor(myteam, 1);
FOREACH(hud_panels, true, it.update_time = time);
prev_myteam = myteam;
}
HUD_Configure_Frame();
if(scoreboard_fade_alpha == 1)
......@@ -676,10 +718,20 @@ void HUD_Main()
HUD_Panel_Draw(HUD_PANEL(RADAR));
if(autocvar__con_chat_maximized)
HUD_Panel_Draw(HUD_PANEL(CHAT));
if(hud_panel_quickmenu)
if (QuickMenu_IsOpened())
HUD_Panel_Draw(HUD_PANEL(QUICKMENU));
HUD_Panel_Draw(HUD_PANEL(SCOREBOARD));
int cursor_active_prev = cursor_active;
cursor_active = HUD_WouldShowCursor();
if (cursor_active_prev != cursor_active && autocvar_hud_cursormode)
{
setcursormode(cursor_active);
// cursor inactive this frame, will be set to 1 the next frame
if (cursor_active)
cursor_active = -1;
}
if (intermission == 2)
HUD_Reset();
......
......@@ -7,6 +7,8 @@ void Hud_Dynamic_Frame();
bool HUD_Radar_Clickable();
void HUD_Radar_Mouse();
bool HUD_WouldShowCursor();
bool QuickMenu_IsOpened();
REGISTRY(hud_panels, BITS(6))
#define hud_panels_from(i) _hud_panels_from(i, NULL)
......@@ -25,7 +27,7 @@ REGISTER_REGISTRY(hud_panels)
#define HUD_PANEL(NAME) HUD_PANEL_##NAME
// draw the background/borders
#define HUD_Panel_DrawBg() MACRO_BEGIN { \
#define HUD_Panel_DrawBg() MACRO_BEGIN \
if(panel.current_panel_bg != "0" && panel.current_panel_bg != "") \
draw_BorderPicture( \
HUD_Shift(panel_pos - '1 1 0' * panel_bg_border), \
......@@ -34,7 +36,7 @@ REGISTER_REGISTRY(hud_panels)
panel_bg_color, panel_bg_alpha, \
HUD_Scale('1 1 0' * BORDER_MULTIPLIER * panel_bg_border) \
); \
} MACRO_END
MACRO_END
int panel_order[hud_panels_MAX];
string hud_panelorder_prev;
......@@ -73,8 +75,6 @@ int vote_prev; // previous state of vote_active to check for a change
float vote_alpha;
float vote_change; // "time" when vote_active changed
float hud_panel_quickmenu;
vector mousepos;
vector panel_click_distance; // mouse cursor distance from the top left corner of the panel (saved only upon a click)
vector panel_click_resizeorigin; // coordinates for opposite point when resizing
......@@ -178,12 +178,10 @@ vector hud_scale_center;
void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, float length_ratio, bool vertical, float baralign, vector theColor, float theAlpha, int drawflag);
.int panel_showflags;
const int PANEL_SHOW_NEVER = 0x00;
const int PANEL_SHOW_MAINGAME = 0x01;
const int PANEL_SHOW_MINIGAME = 0x02;
const int PANEL_SHOW_MAPVOTE = 0x04;
const int PANEL_SHOW_WITH_SB = 0x08;
const int PANEL_SHOW_ALWAYS = 0xff;
const int PANEL_SHOW_MAINGAME = BIT(0); // show in the main HUD
const int PANEL_SHOW_MINIGAME = BIT(1); // show when minigames panels are shown
const int PANEL_SHOW_MAPVOTE = BIT(2); // show during map vote
const int PANEL_SHOW_WITH_SB = BIT(3); // show when scoreboard is on
.int panel_configflags;
const int PANEL_CONFIG_NO = 0x00;
......@@ -225,10 +223,10 @@ REGISTER_HUD_PANEL(CENTERPRINT, HUD_CenterPrint, PANEL_CONFIG_MAIN | PANE
REGISTER_HUD_PANEL(MINIGAMEBOARD, HUD_MinigameBoard, PANEL_CONFIG_NO , PANEL_SHOW_MINIGAME | PANEL_SHOW_WITH_SB) // MINIGAMEBOARD
REGISTER_HUD_PANEL(MINIGAMESTATUS, HUD_MinigameStatus, PANEL_CONFIG_NO , PANEL_SHOW_MINIGAME | PANEL_SHOW_WITH_SB) // MINIGAMESTATUS
REGISTER_HUD_PANEL(MINIGAMEHELP, HUD_MinigameHelp, PANEL_CONFIG_NO , PANEL_SHOW_MINIGAME | PANEL_SHOW_WITH_SB) // MINIGAMEHELP
REGISTER_HUD_PANEL(MINIGAMEMENU, HUD_MinigameMenu, PANEL_CONFIG_NO , PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME | PANEL_SHOW_MAPVOTE | PANEL_SHOW_WITH_SB) // MINIGAMEMENU
REGISTER_HUD_PANEL(MINIGAMEMENU, HUD_MinigameMenu, PANEL_CONFIG_NO , PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME | PANEL_SHOW_WITH_SB) // MINIGAMEMENU
REGISTER_HUD_PANEL(MAPVOTE, MapVote_Draw, PANEL_CONFIG_NO , PANEL_SHOW_MAPVOTE ) // MAPVOTE
REGISTER_HUD_PANEL(ITEMSTIME, HUD_ItemsTime, PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME ) // ITEMSTIME
REGISTER_HUD_PANEL(QUICKMENU, HUD_QuickMenu, PANEL_CONFIG_MAIN , PANEL_SHOW_MAINGAME ) // QUICKMENU
REGISTER_HUD_PANEL(QUICKMENU, HUD_QuickMenu, PANEL_CONFIG_MAIN , PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME ) // QUICKMENU
REGISTER_HUD_PANEL(SCOREBOARD, Scoreboard_Draw, PANEL_CONFIG_NO , PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME | PANEL_SHOW_MAPVOTE | PANEL_SHOW_WITH_SB) // SCOREBOARD
// always add new panels to the end of list
......@@ -240,7 +238,7 @@ REGISTER_HUD_PANEL(SCOREBOARD, Scoreboard_Draw, PANEL_CONFIG_NO
// Get value for panel.current_panel_bg: if "" fetch default, else use panel_bg_str
// comment on last line of macro: // we probably want to see a background in config mode at all times...
#define HUD_Panel_GetBg() MACRO_BEGIN { \
#define HUD_Panel_GetBg() MACRO_BEGIN \
string panel_bg; \
if (!autocvar__hud_configure && panel_bg_str == "0") { \
panel_bg = "0"; \
......@@ -263,10 +261,10 @@ REGISTER_HUD_PANEL(SCOREBOARD, Scoreboard_Draw, PANEL_CONFIG_NO
} \
} \
strcpy(panel.current_panel_bg, panel_bg); \
} MACRO_END
MACRO_END
// Get value for panel_bg_color: if "" fetch default, else use panel_bg_color. Convert pants, shirt or teamcolor into a vector.
#define HUD_Panel_GetColor() MACRO_BEGIN { \
#define HUD_Panel_GetColor() MACRO_BEGIN \
if ((teamplay) && panel_bg_color_team > 0) { \
if (autocvar__hud_configure && myteam == NUM_SPECTATOR) \
panel_bg_color = '1 0 0' * panel_bg_color_team; \
......@@ -287,20 +285,20 @@ REGISTER_HUD_PANEL(SCOREBOARD, Scoreboard_Draw, PANEL_CONFIG_NO
} \
} \
} \
} MACRO_END
MACRO_END
// Get value for panel_bg_color_team: if "" fetch default, else use panel_bg_color_team_str
#define HUD_Panel_GetColorTeam() MACRO_BEGIN { \
#define HUD_Panel_GetColorTeam() MACRO_BEGIN \
if (panel_bg_color_team_str == "") { \
panel_bg_color_team = autocvar_hud_panel_bg_color_team; \
} else { \
panel_bg_color_team = stof(panel_bg_color_team_str); \
} \
} MACRO_END
MACRO_END
// Get value for panel_bg_alpha: if "" fetch default, else use panel_bg_alpha. Also do various menu dialog fadeout/in checks, and minalpha checks
// comment on line 3 of macro: // do not set a minalpha cap when showing the config dialog for this panel
#define HUD_Panel_GetBgAlpha() MACRO_BEGIN { \
#define HUD_Panel_GetBgAlpha() MACRO_BEGIN \
if (panel_bg_alpha_str == "") { \
panel_bg_alpha_str = ftos(autocvar_hud_panel_bg_alpha); \
} \
......@@ -313,39 +311,39 @@ REGISTER_HUD_PANEL(SCOREBOARD, Scoreboard_Draw, PANEL_CONFIG_NO
else \
panel_bg_alpha = max(cvar("hud_configure_bg_minalpha"), panel_bg_alpha); \
} \
} MACRO_END
MACRO_END
// Get value for panel_fg_alpha. Also do various minalpha checks
// comment on line 2 of macro: // ALWAYS show disabled panels at 0.25 alpha when in config mode
#define HUD_Panel_GetFgAlpha() MACRO_BEGIN { \
#define HUD_Panel_GetFgAlpha() MACRO_BEGIN \
panel_fg_alpha = autocvar_hud_panel_fg_alpha; \
if (autocvar__hud_configure && !panel_enabled) \
panel_fg_alpha = 0.25; \
} MACRO_END
MACRO_END
// Get border. See comments above, it's similar.
#define HUD_Panel_GetBorder() MACRO_BEGIN { \
#define HUD_Panel_GetBorder() MACRO_BEGIN \
if (panel_bg_border_str == "") { \
panel_bg_border = autocvar_hud_panel_bg_border; \
} else { \
panel_bg_border = stof(panel_bg_border_str); \
} \
} MACRO_END
MACRO_END