Commit 0e11fe37 authored by Mario's avatar Mario

Merge branch 'master' into Mario/buff_updates

# Conflicts:
#	_hud_descriptions.cfg
#	hud_luma.cfg
#	hud_luminos.cfg
#	hud_luminos_minimal.cfg
#	hud_luminos_minimal_xhair.cfg
#	hud_luminos_old.cfg
#	hud_nexuiz.cfg
#	qcsrc/client/hud.qc
#	qcsrc/client/hud.qh
parents 7ecebcae b6b2f6f6
......@@ -300,3 +300,13 @@ seta hud_panel_centerprint_fade_subsequent_passtwo "" "division factor for the s
seta hud_panel_centerprint_fade_subsequent_passtwo_minalpha "" "minimum factor that the second pass can fade to"
seta hud_panel_centerprint_fade_subsequent_minfontsize "" "minimum factor for the font size from the subsequent fading effects"
seta hud_panel_centerprint_fade_minfontsize "" "minimum factor for the font size from the fading in/out effects"
seta hud_panel_mapvote "" "enable/disable this panel"
seta hud_panel_mapvote_pos "" "position of this panel"
seta hud_panel_mapvote_size "" "size of this panel"
seta hud_panel_mapvote_bg "" "if set to something else than \"\" = override default background"
seta hud_panel_mapvote_bg_color "" "if set to something else than \"\" = override default panel background color"
seta hud_panel_mapvote_bg_color_team "" "override panel color with team color in team based games"
seta hud_panel_mapvote_bg_alpha "" "if set to something else than \"\" = override default panel background alpha"
seta hud_panel_mapvote_bg_border "" "if set to something else than \"\" = override default size of border around the background"
seta hud_panel_mapvote_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
......@@ -26,7 +26,7 @@ seta hud_progressbar_acceleration_neg_color "0.86 0.35 0"
seta hud_progressbar_vehicles_ammo1_color "0.77 0.67 0"
seta hud_progressbar_vehicles_ammo2_color "0.86 0.35 0"
seta _hud_panelorder "15 12 9 5 10 6 14 0 7 4 11 2 1 3 8 13 16 "
seta _hud_panelorder "17 15 12 9 5 10 6 14 0 7 4 11 2 1 3 8 13 16 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.005000"
......@@ -299,4 +299,14 @@ seta hud_panel_centerprint_fade_subsequent_passtwo_minalpha "0.5"
seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75"
seta hud_panel_centerprint_fade_minfontsize "0"
seta hud_panel_mapvote 1
seta hud_panel_mapvote_pos "0 0"
seta hud_panel_mapvote_size "1 1"
seta hud_panel_mapvote_bg "border_default"
seta hud_panel_mapvote_bg_color ""
seta hud_panel_mapvote_bg_color_team ""
seta hud_panel_mapvote_bg_alpha ""
seta hud_panel_mapvote_bg_border ""
seta hud_panel_mapvote_bg_padding ""
menu_sync
......@@ -26,7 +26,7 @@ seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
seta _hud_panelorder "15 12 9 10 5 6 14 0 7 4 11 2 1 3 8 13 16 "
seta _hud_panelorder "17 15 12 9 10 5 6 14 0 7 4 11 2 1 3 8 13 16 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.010000"
......@@ -299,4 +299,14 @@ seta hud_panel_centerprint_fade_subsequent_passtwo_minalpha "0.5"
seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75"
seta hud_panel_centerprint_fade_minfontsize "0"
seta hud_panel_mapvote 1
seta hud_panel_mapvote_pos "0 0"
seta hud_panel_mapvote_size "1 1"
seta hud_panel_mapvote_bg "0"
seta hud_panel_mapvote_bg_color ""
seta hud_panel_mapvote_bg_color_team ""
seta hud_panel_mapvote_bg_alpha ""
seta hud_panel_mapvote_bg_border ""
seta hud_panel_mapvote_bg_padding ""
menu_sync
......@@ -26,7 +26,7 @@ seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
seta _hud_panelorder "10 3 0 14 6 9 13 4 1 2 11 12 7 5 8 15 16 "
seta _hud_panelorder "17 10 3 0 14 6 9 13 4 1 2 11 12 7 5 8 15 16 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.010000"
......@@ -299,4 +299,14 @@ seta hud_panel_centerprint_fade_subsequent_passtwo_minalpha "0.5"
seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75"
seta hud_panel_centerprint_fade_minfontsize "0"
seta hud_panel_mapvote 1
seta hud_panel_mapvote_pos "0 0"
seta hud_panel_mapvote_size "1 1"
seta hud_panel_mapvote_bg "0"
seta hud_panel_mapvote_bg_color ""
seta hud_panel_mapvote_bg_color_team ""
seta hud_panel_mapvote_bg_alpha ""
seta hud_panel_mapvote_bg_border ""
seta hud_panel_mapvote_bg_padding ""
menu_sync
......@@ -26,7 +26,7 @@ seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
seta _hud_panelorder "15 3 1 2 11 10 0 14 6 9 13 4 12 7 5 8 16 "
seta _hud_panelorder "17 15 3 1 2 11 10 0 14 6 9 13 4 12 7 5 8 16 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.010000"
......@@ -299,4 +299,14 @@ seta hud_panel_centerprint_fade_subsequent_passtwo_minalpha "0.5"
seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75"
seta hud_panel_centerprint_fade_minfontsize "0"
seta hud_panel_mapvote 1
seta hud_panel_mapvote_pos "0 0"
seta hud_panel_mapvote_size "1 1"
seta hud_panel_mapvote_bg "0"
seta hud_panel_mapvote_bg_color ""
seta hud_panel_mapvote_bg_color_team ""
seta hud_panel_mapvote_bg_alpha ""
seta hud_panel_mapvote_bg_border ""
seta hud_panel_mapvote_bg_padding ""
menu_sync
......@@ -26,7 +26,7 @@ seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
seta _hud_panelorder "15 10 9 6 8 14 5 0 4 13 2 7 1 3 11 12 16 "
seta _hud_panelorder "17 15 10 9 6 8 14 5 0 4 13 2 7 1 3 11 12 16 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.010000"
......@@ -299,4 +299,14 @@ seta hud_panel_centerprint_fade_subsequent_passtwo_minalpha "0.5"
seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75"
seta hud_panel_centerprint_fade_minfontsize "0"
seta hud_panel_mapvote 1
seta hud_panel_mapvote_pos "0 0"
seta hud_panel_mapvote_size "1 1"
seta hud_panel_mapvote_bg "0"
seta hud_panel_mapvote_bg_color ""
seta hud_panel_mapvote_bg_color_team ""
seta hud_panel_mapvote_bg_alpha ""
seta hud_panel_mapvote_bg_border ""
seta hud_panel_mapvote_bg_padding ""
menu_sync
......@@ -26,7 +26,7 @@ seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
seta _hud_panelorder "15 0 11 8 5 6 14 9 13 7 2 3 1 10 12 4 16 "
seta _hud_panelorder "17 15 0 11 8 5 6 14 9 13 7 2 3 1 10 12 4 16 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.01"
......@@ -299,4 +299,14 @@ seta hud_panel_centerprint_fade_subsequent_passtwo_minalpha "0.5"
seta hud_panel_centerprint_fade_subsequent_minfontsize "0.75"
seta hud_panel_centerprint_fade_minfontsize "0"
seta hud_panel_mapvote 1
seta hud_panel_mapvote_pos "0 0"
seta hud_panel_mapvote_size "1 1"
seta hud_panel_mapvote_bg "0"
seta hud_panel_mapvote_bg_color ""
seta hud_panel_mapvote_bg_color_team ""
seta hud_panel_mapvote_bg_alpha ""
seta hud_panel_mapvote_bg_border ""
seta hud_panel_mapvote_bg_padding ""
menu_sync
......@@ -94,7 +94,6 @@ bool autocvar_cl_unpress_zoom_on_death = 1;
bool autocvar_cl_unpress_zoom_on_weapon_switch = 1;
bool autocvar_cl_unpress_attack_on_weapon_switch = 1;
bool autocvar_con_chat;
float autocvar_con_chatpos;
bool autocvar_con_chatrect;
float autocvar_con_chatsize;
float autocvar_con_chattime;
......
......@@ -10,6 +10,7 @@
#include "../common/animdecide.qh"
#include "../common/csqcmodel_settings.qh"
#include "../common/teams.qh"
#include "../common/triggers/trigger/viewloc.qh"
#include "../csqcmodellib/cl_model.qh"
#include "../csqcmodellib/cl_player.qh"
......@@ -400,6 +401,12 @@ void CSQCModel_AutoTagIndex_Apply(void)
if(self.tag_entity && wasfreed(self.tag_entity))
self.tag_entity = world;
if(self.viewloc && wasfreed(self.viewloc))
self.viewloc = world;
if(self.viewloc.entnum != self.tag_networkviewloc)
self.viewloc = findfloat(world, entnum, self.tag_networkviewloc);
if(self.tag_networkentity)
{
// we are ATTACHED!
......
......@@ -162,7 +162,7 @@ float HUD_GetRowCount(int item_count, vector size, float item_aspect)
return bound(1, floor((sqrt(4 * item_aspect * aspect * item_count + aspect * aspect) + aspect + 0.5) / 2), item_count);
}
vector HUD_GetTableSize(int item_count, vector psize, float item_aspect)
vector HUD_GetTableSize_BestItemAR(int item_count, vector psize, float item_aspect)
{
float columns, rows;
float ratio, best_ratio = 0;
......@@ -507,7 +507,8 @@ void HUD_Weapons(void)
vector color;
// check to see if we want to continue
if(hud != HUD_NORMAL) { return; }
if(intermission == 2) return;
if(hud != HUD_NORMAL) return;
if(!autocvar__hud_configure)
{
......@@ -599,7 +600,7 @@ void HUD_Weapons(void)
vector padded_panel_size = panel_size - '2 2 0' * panel_bg_padding;
// get the all-weapons layout
vector table_size = HUD_GetTableSize(WEP_COUNT, padded_panel_size, aspect);
vector table_size = HUD_GetTableSize_BestItemAR(WEP_COUNT, padded_panel_size, aspect);
columns = table_size.x;
rows = table_size.y;
weapon_size.x = padded_panel_size.x / columns;
......@@ -759,7 +760,7 @@ void HUD_Weapons(void)
if(!rows) // if rows is > 0 onlyowned code has already updated these vars
{
vector table_size = HUD_GetTableSize(WEP_COUNT, panel_size, aspect);
vector table_size = HUD_GetTableSize_BestItemAR(WEP_COUNT, panel_size, aspect);
columns = table_size.x;
rows = table_size.y;
weapon_size.x = panel_size.x / columns;
......@@ -1084,6 +1085,7 @@ int nade_prevframe;
float nade_statuschange_time;
void HUD_Ammo(void)
{
if(intermission == 2) return;
if(hud != HUD_NORMAL) return;
if(!autocvar__hud_configure)
{
......@@ -1358,6 +1360,8 @@ int getPowerupItemAlign(int align, int column, int row, int columns, int rows, b
void HUD_Powerups(void)
{
if(intermission == 2) return;
int allItems = getstati(STAT_ITEMS, 0, 24);
int allBuffs = getstati(STAT_BUFFS, 0, 24);
int strengthTime, shieldTime, superTime;
......@@ -1522,6 +1526,7 @@ void HUD_Powerups(void)
void HUD_HealthArmor(void)
{
int armor, health, fuel;
if(intermission == 2) return;
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_healtharmor) return;
......@@ -1828,6 +1833,7 @@ void HUD_Notify_Push(string icon, string attacker, string victim)
void HUD_Notify(void)
{
if(intermission == 2) return;
if (!autocvar__hud_configure)
if (!autocvar_hud_panel_notify)
return;
......@@ -1953,6 +1959,7 @@ string seconds_tostring(float sec)
void HUD_Timer(void)
{
if(intermission == 2) return;
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_timer) return;
......@@ -2012,6 +2019,7 @@ void HUD_Timer(void)
//
void HUD_Radar(void)
{
if(intermission == 2) return;
if (!autocvar__hud_configure)
{
if (hud_panel_radar_maximized)
......@@ -2323,6 +2331,7 @@ void HUD_Score_Rankings(vector pos, vector mySize, entity me)
void HUD_Score(void)
{
if(intermission == 2) return;
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_score) return;
......@@ -2506,6 +2515,7 @@ void HUD_Score(void)
//
void HUD_RaceTimer (void)
{
if(intermission == 2) return;
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_racetimer) return;
......@@ -2656,6 +2666,7 @@ void HUD_RaceTimer (void)
void HUD_Vote(void)
{
if(intermission == 2) return;
if(autocvar_cl_allow_uid2name == -1 && (gametype == MAPINFO_TYPE_CTS || gametype == MAPINFO_TYPE_RACE || (serverflags & SERVERFLAG_PLAYERSTATS)))
{
vote_active = 1;
......@@ -3532,6 +3543,7 @@ float mod_change; // "time" when mod_active changed
void HUD_ModIcons(void)
{
if(intermission == 2) return;
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_modicons) return;
......@@ -3573,6 +3585,7 @@ void HUD_ModIcons(void)
//
void HUD_PressedKeys(void)
{
if(intermission == 2) return;
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_pressedkeys) return;
......@@ -3659,6 +3672,15 @@ void HUD_Chat(void)
HUD_Panel_UpdateCvars();
if(intermission == 2)
{
// reserve some more space to the mapvote panel
// by resizing and moving chat panel to the bottom
panel_size.y = min(panel_size.y, vid_conheight * 0.2);
panel_pos.y = vid_conheight - panel_size.y - panel_bg_border * 2;
chat_posy = panel_pos.y;
chat_sizey = panel_size.y;
}
if(autocvar__con_chat_maximized && !autocvar__hud_configure) // draw at full screen height if maximized
{
panel_pos.y = panel_bg_border;
......@@ -3727,6 +3749,7 @@ float frametimeavg1; // 1 frame ago
float frametimeavg2; // 2 frames ago
void HUD_EngineInfo(void)
{
//if(intermission == 2) return;
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_engineinfo) return;
......@@ -3788,6 +3811,7 @@ void HUD_EngineInfo(void)
} while(0)
void HUD_InfoMessages(void)
{
if(intermission == 2) return;
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_infomessages) return;
......@@ -3969,6 +3993,7 @@ float acc_prevtime, acc_avg, top_speed, top_speed_time;
float physics_update_time, discrete_speed, discrete_acceleration;
void HUD_Physics(void)
{
if(intermission == 2) return;
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_physics) return;
......@@ -4360,6 +4385,7 @@ void reset_centerprint_messages(void)
float hud_configure_cp_generation_time;
void HUD_CenterPrint (void)
{
if(intermission == 2) return;
if(!autocvar__hud_configure)
{
if(!autocvar_hud_panel_centerprint) return;
......@@ -4578,7 +4604,6 @@ void HUD_CenterPrint (void)
}
}
/*
==================
Main HUD system
......@@ -4606,9 +4631,6 @@ void HUD_Main (void)
HUD_Configure_Frame();
if(intermission == 2) // no hud during mapvote
hud_fade_alpha = 0;
// panels that we want to be active together with the scoreboard
// they must fade only when the menu does
if(scoreboard_fade_alpha == 1)
......@@ -4715,7 +4737,7 @@ void HUD_Main (void)
}
hud_draw_maximized = 0;
// draw panels in order specified by panel_order array
// draw panels in the order specified by panel_order array
for(i = HUD_PANEL_NUM - 1; i >= 0; --i)
(panel = hud_panel[panel_order[i]]).panel_draw();
......
......@@ -113,6 +113,11 @@ string panel_bg_padding_str;
class(HUDPanel) .void() panel_draw;
// chat panel can be reduced / moved while the mapvote is active
// let know the mapvote panel about chat pos and size
float chat_posy;
float chat_sizey;
float current_player;
float GetPlayerColorForce(int i);
......@@ -137,24 +142,26 @@ float old_p_healthtime, old_p_armortime;
int prev_p_health, prev_p_armor;
#define HUD_PANELS(HUD_PANEL) \
HUD_PANEL(WEAPONS , HUD_Weapons , weapons) \
HUD_PANEL(AMMO , HUD_Ammo , ammo) \
HUD_PANEL(POWERUPS , HUD_Powerups , powerups) \
HUD_PANEL(HEALTHARMOR , HUD_HealthArmor , healtharmor) \
HUD_PANEL(NOTIFY , HUD_Notify , notify) \
HUD_PANEL(TIMER , HUD_Timer , timer) \
HUD_PANEL(RADAR , HUD_Radar , radar) \
HUD_PANEL(SCORE , HUD_Score , score) \
HUD_PANEL(RACETIMER , HUD_RaceTimer , racetimer) \
HUD_PANEL(VOTE , HUD_Vote , vote) \
HUD_PANEL(MODICONS , HUD_ModIcons , modicons) \
HUD_PANEL(PRESSEDKEYS , HUD_PressedKeys , pressedkeys) \
HUD_PANEL(CHAT , HUD_Chat , chat) \
HUD_PANEL(ENGINEINFO , HUD_EngineInfo , engineinfo) \
HUD_PANEL(INFOMESSAGES , HUD_InfoMessages , infomessages) \
HUD_PANEL(PHYSICS , HUD_Physics , physics) \
HUD_PANEL(CENTERPRINT , HUD_CenterPrint , centerprint)
#define HUD_PANELS(HUD_PANEL) \
HUD_PANEL(WEAPONS , HUD_Weapons , weapons) \
HUD_PANEL(AMMO , HUD_Ammo , ammo) \
HUD_PANEL(POWERUPS , HUD_Powerups , powerups) \
HUD_PANEL(HEALTHARMOR , HUD_HealthArmor , healtharmor) \
HUD_PANEL(NOTIFY , HUD_Notify , notify) \
HUD_PANEL(TIMER , HUD_Timer , timer) \
HUD_PANEL(RADAR , HUD_Radar , radar) \
HUD_PANEL(SCORE , HUD_Score , score) \
HUD_PANEL(RACETIMER , HUD_RaceTimer , racetimer) \
HUD_PANEL(VOTE , HUD_Vote , vote) \
HUD_PANEL(MODICONS , HUD_ModIcons , modicons) \
HUD_PANEL(PRESSEDKEYS , HUD_PressedKeys , pressedkeys) \
HUD_PANEL(CHAT , HUD_Chat , chat) \
HUD_PANEL(ENGINEINFO , HUD_EngineInfo , engineinfo) \
HUD_PANEL(INFOMESSAGES , HUD_InfoMessages , infomessages) \
HUD_PANEL(PHYSICS , HUD_Physics , physics) \
HUD_PANEL(CENTERPRINT , HUD_CenterPrint , centerprint) \
HUD_PANEL(MAPVOTE , MapVote_Draw , mapvote) \
// always add new panels to the end of list
#define HUD_PANEL(NAME, draw_func, name) \
int HUD_PANEL_##NAME; \
......
......@@ -230,6 +230,7 @@ vector HUD_Panel_CheckMove(vector myPos, vector mySize)
int i;
for (i = 0; i < HUD_PANEL_NUM; ++i) {
panel = hud_panel[i];
if(panel == HUD_PANEL(MAPVOTE)) continue;
if(panel == highlightedPanel) continue;
HUD_Panel_UpdatePosSize();
if(!panel_enabled) continue;
......@@ -326,6 +327,7 @@ vector HUD_Panel_CheckResize(vector mySize, vector resizeorigin) {
int i;
for (i = 0; i < HUD_PANEL_NUM; ++i) {
panel = hud_panel[i];
if(panel == HUD_PANEL(MAPVOTE)) continue;
if(panel == highlightedPanel) continue;
HUD_Panel_UpdatePosSize();
if(!panel_enabled) continue;
......@@ -785,6 +787,8 @@ float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
for(i = 0; i < HUD_PANEL_NUM; ++i)
{
panel = hud_panel[i];
if(panel == HUD_PANEL(MAPVOTE))
continue;
if (panel == tab_panels[i] || panel == starting_panel)
continue;
HUD_Panel_UpdatePosSize();
......@@ -932,6 +936,7 @@ float HUD_Panel_Check_Mouse_Pos(float allow_move)
j += 1;
panel = hud_panel[i];
if(panel == HUD_PANEL(MAPVOTE)) continue;
HUD_Panel_UpdatePosSize();
float border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
......@@ -1013,6 +1018,8 @@ void HUD_Panel_Highlight(float allow_move)
j += 1;
panel = hud_panel[i];
if(panel == HUD_PANEL(MAPVOTE))
continue;
HUD_Panel_UpdatePosSize();
float border = max(8, panel_bg_border); // FORCED border so a small border size doesn't mean you can't resize
......
......@@ -873,6 +873,8 @@ void CSQC_Ent_Update(float bIsNewEntity)
case ENT_CLIENT_SPAWNEVENT: Ent_ReadSpawnEvent(bIsNewEntity); break;
case ENT_CLIENT_NOTIFICATION: Read_Notification(bIsNewEntity); break;
case ENT_CLIENT_HEALING_ORB: ent_healer(); break;
case ENT_CLIENT_VIEWLOC: ent_viewloc(); break;
case ENT_CLIENT_VIEWLOC_TRIGGER: ent_viewloc_trigger(); break;
case ENT_CLIENT_LADDER: ent_func_ladder(); break;
case ENT_CLIENT_TRIGGER_PUSH: ent_trigger_push(); break;
case ENT_CLIENT_TARGET_PUSH: ent_target_push(); break;
......
This diff is collapsed.
......@@ -47,7 +47,7 @@ void skeleton_loadinfo(entity e)
}
else
dprint("No model parameters for ", e.model, "\n");
dprint(e.model, " uses ", ftos(e.bone_upperbody), " ", ftos(e.fixbone), "\n");
//dprint(e.model, " uses ", ftos(e.bone_upperbody), " ", ftos(e.fixbone), "\n");
get_model_parameters(string_null, 0);
e.skeleton_info_modelindex = e.modelindex;
e.skeleton_info_skin = e.skin;
......
......@@ -50,10 +50,13 @@ weapons/projectile.qc // TODO
../common/notifications.qc
../common/physics.qc
../common/playerstats.qc
../common/p2mathlib.qc
../common/test.qc
../common/urllib.qc
../common/util.qc
../common/viewloc.qc
../common/items/all.qc
../common/monsters/all.qc
......
......@@ -978,6 +978,7 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
{
WepSet weapons_stat = WepSet_GetFromStat();
WepSet weapons_inmap = WepSet_GetFromStat_InMap();
float initial_posx = pos.x;
int i;
float weapon_stats;
int disownedcnt = 0;
......@@ -1003,12 +1004,12 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
rows = 2;
else
rows = 1;
int count_perrow = rint(weapon_cnt / rows);
int columnns = ceil(weapon_cnt / rows);
float height = 40;
float fontsize = height * 1/3;
float weapon_height = height * 2/3;
float weapon_width = sbwidth / weapon_cnt / rows;
bool g_instagib = false;
float weapon_width = sbwidth / columnns / rows;
drawstring(pos, sprintf(_("Accuracy stats (average %d%%)"), average_accuracy), hud_fontsize, '1 1 1', scoreboard_alpha_fg, DRAWFLAG_NORMAL);
pos.y += 1.25 * hud_fontsize.y + autocvar_scoreboard_border_thickness;
......@@ -1023,7 +1024,7 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
drawborderlines(autocvar_scoreboard_border_thickness, pos, tmp, '0 0 0', scoreboard_alpha_bg * 0.75, DRAWFLAG_NORMAL);
// column highlighting
for(i = 0; i < count_perrow; ++i)
for(i = 0; i < columnns; ++i)
{
if(!(i % 2))
drawfill(pos + '1 0 0' * weapon_width * rows * i, '0 1 0' * height * rows + '1 0 0' * weapon_width * rows, '0 0 0', scoreboard_alpha_bg * 0.2, DRAWFLAG_NORMAL);
......@@ -1040,9 +1041,6 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
if(rows == 2)
pos.x += weapon_width / 2;
if(switchweapon == WEP_VAPORIZER)
g_instagib = true; // TODO: real detection for instagib?
if(autocvar_scoreboard_accuracy_nocolors)
rgb = '1 1 1';
else
......@@ -1051,7 +1049,8 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
float oldposx = pos.x;
vector tmpos = pos;
for(i = WEP_FIRST; i <= WEP_LAST; ++i)
int column;
for(i = WEP_FIRST, column = 0; i <= WEP_LAST; ++i)
{
self = get_weaponinfo(i);
if (!self.weapon)
......@@ -1087,22 +1086,20 @@ vector HUD_DrawScoreboardAccuracyStats(vector pos, vector rgb, vector bg_size)
}
tmpos.x += weapon_width * rows;
pos.x += weapon_width * rows;
if(rows == 2 && i == count_perrow) {
if(rows == 2 && column == columnns - 1) {
tmpos.x = oldposx;
tmpos.y += height;
pos.y += height;
}
++column;
}
if(weapons_with_stats)
average_accuracy = floor((average_accuracy * 100 / weapons_with_stats) + 0.5);
if(rows == 2)
pos.x -= weapon_width / 2;
pos.x -= sbwidth;
pos.y += height;
pos.y += 1.25 * hud_fontsize.y;
pos.x = initial_posx;
return pos;
}
......
......@@ -228,6 +228,15 @@ vector GetCurrentFov(float fov)
return '1 0 0' * fovx + '0 1 0' * fovy;
}
vector GetViewLocationFOV(float fov)
{
float frustumy = tan(fov * M_PI / 360.0) * 0.75;
float frustumx = frustumy * vid_width / vid_height / vid_pixelheight;
float fovx = atan2(frustumx, 1) / M_PI * 360.0;
float fovy = atan2(frustumy, 1) / M_PI * 360.0;
return '1 0 0' * fovx + '0 1 0' * fovy;
}
vector GetOrthoviewFOV(vector ov_worldmin, vector ov_worldmax, vector ov_mid, vector ov_org)
{
float fovx, fovy;
......@@ -420,12 +429,14 @@ vector liquidcolor_prev;
float eventchase_current_distance;
float eventchase_running;
float WantEventchase()
bool WantEventchase()
{
if(autocvar_cl_orthoview)
return false;
if(intermission)
return true;
if(self.viewloc)
return true;
if(spectatee_status >= 0)
{
if(autocvar_cl_eventchase_nexball && gametype == MAPINFO_TYPE_NEXBALL && !(WepSet_GetFromStat() & WepSet_FromWeapon(WEP_PORTO)))
......@@ -550,7 +561,7 @@ void UpdateCrosshair()
CSQC_common_hud();
// crosshair goes VERY LAST
if(!scoreboard_active && !camera_active && intermission != 2 && spectatee_status != -1 && hud == HUD_NORMAL)
if(!scoreboard_active && !camera_active && intermission != 2 && spectatee_status != -1 && hud == HUD_NORMAL && !csqcplayer.viewloc)
{
if (!autocvar_crosshair_enabled) // main toggle for crosshair rendering
return;
......@@ -1123,6 +1134,7 @@ void CSQC_UpdateView(float w, float h)
WarpZone_TraceBox(current_view_origin, autocvar_cl_eventchase_mins, autocvar_cl_eventchase_maxs, eventchase_target_origin, MOVE_WORLDONLY, self);
// If the boxtrace fails, revert back to line tracing.
if(!self.viewloc)
if(trace_startsolid)
{
eventchase_target_origin = (current_view_origin - (v_forward * eventchase_current_distance));
......@@ -1131,7 +1143,8 @@ void CSQC_UpdateView(float w, float h)
}
else { setproperty(VF_ORIGIN, trace_endpos); }
setproperty(VF_ANGLES, WarpZone_TransformVAngles(WarpZone_trace_transform, view_angles));
if(!self.viewloc)
setproperty(VF_ANGLES, WarpZone_TransformVAngles(WarpZone_trace_transform, view_angles));
}
else if(autocvar_chase_active < 0) // time to disable chase_active if it was set by this code
{
......@@ -1353,6 +1366,7 @@ void CSQC_UpdateView(float w, float h)
vid_pixelheight = autocvar_vid_pixelheight;
if(autocvar_cl_orthoview) { setproperty(VF_FOV, GetOrthoviewFOV(ov_worldmin, ov_worldmax, ov_mid, ov_org)); }
else if(csqcplayer.viewloc) { setproperty(VF_FOV, GetViewLocationFOV(110)); } // enforce 110 fov, so things dont look odd
else { setproperty(VF_FOV, GetCurrentFov(fov)); }
// Camera for demo playback
......@@ -1815,13 +1829,9 @@ void CSQC_common_hud(void)
HUD_Main(); // always run these functions for alpha checks
HUD_DrawScoreboard();
if (scoreboard_active) // scoreboard/accuracy
HUD_Reset();
else if (intermission == 2) // map voting screen
{
MapVote_Draw();
// scoreboard/accuracy, map/gametype voting screen
if (scoreboard_active || intermission == 2)
HUD_Reset();
}
}
......
......@@ -115,6 +115,8 @@ const int ENT_CLIENT_TRIGGER_IMPULSE = 68;
const int ENT_CLIENT_SWAMP = 69;
const int ENT_CLIENT_CORNER = 70;
const int ENT_CLIENT_KEYLOCK = 71;
const int ENT_CLIENT_VIEWLOC = 78;
const int ENT_CLIENT_VIEWLOC_TRIGGER = 79;
const int ENT_CLIENT_HEALING_ORB = 80;
......
......@@ -15,9 +15,16 @@
# define TAG_ENTITY_NAME tag_networkentity
# define TAG_ENTITY_TYPE float
.float tag_networkentity;
# define TAG_VIEWLOC_NAME tag_networkviewloc
# define TAG_VIEWLOC_TYPE int
.float tag_networkviewloc;
#else
# define TAG_ENTITY_NAME tag_entity
# define TAG_ENTITY_TYPE entity
# define TAG_VIEWLOC_NAME viewloc
# define TAG_VIEWLOC_TYPE entity
#endif
// new fields
......@@ -53,7 +60,8 @@
CSQCMODEL_ENDIF \
CSQCMODEL_PROPERTY(1024, float, ReadAngle, WriteAngle, v_angle_x) \
CSQCMODEL_PROPERTY_SCALED(4096, float, ReadByte, WriteByte, scale, 16, 0, 255) \
CSQCMODEL_PROPERTY(8192, int, ReadInt24_t, WriteInt24_t, dphitcontentsmask)
CSQCMODEL_PROPERTY(8192, int, ReadInt24_t, WriteInt24_t, dphitcontentsmask) \
CSQCMODEL_PROPERTY(16384, TAG_VIEWLOC_TYPE, ReadShort, WriteEntity, TAG_VIEWLOC_NAME)
// TODO get rid of colormod/glowmod here, find good solution for vortex charge glowmod hack; also get rid of some useless properties on non-players that only exist for CopyBody
// add hook function calls here
......@@ -63,7 +71,8 @@
CSQCModel_Hook_PostUpdate(isnew, isplayer, islocalplayer);
#define CSQCMODEL_HOOK_PREDRAW \
CSQCModel_Hook_PreDraw(isplayer);
#define CSQCPLAYER_HOOK_POSTCAMERASETUP
#define CSQCPLAYER_HOOK_POSTCAMERASETUP \
CSQCPlayer_SetViewLocation();
// force updates of player entities that often even if unchanged
#define CSQCPLAYER_FORCE_UPDATES 0.25
......
......@@ -187,6 +187,32 @@ float MapInfo_FilterGametype(int pGametype, int pFeatures, int pFlagsRequired, i
return 1;
}
void MapInfo_FilterString(string sf)
{
// this function further filters _MapInfo_filtered, which is prepared by MapInfo_FilterGametype by string
float i, j;
string title;
for(i = 0, j = -1; i < MapInfo_count; ++i)
{
if (MapInfo_Get_ByID(i))
{
// prepare for keyword filter
if (MapInfo_Map_title && strstrofs(MapInfo_Map_title, "<TITLE>", 0) == -1)
title = MapInfo_Map_title;
else
title = MapInfo_Map_bspname;
// keyword filter
if((strstrofs(strtolower(title), strtolower(sf), 0)) >= 0)
bufstr_set(_MapInfo_filtered, ++j, bufstr_get(_MapInfo_filtered, i));
}
}
MapInfo_count = j + 1;
MapInfo_ClearTemps();
// sometimes the glob isn't sorted nicely, so fix it here...
heapsort(MapInfo_count, _MapInfo_FilterList_swap, _MapInfo_FilterList_cmp, world);
}
void MapInfo_Filter_Free()
{
......
......@@ -120,6 +120,7 @@ void MapInfo_Enumerate();
// filter the info by game type mask (updates MapInfo_count)
float MapInfo_progress;
float MapInfo_FilterGametype(float gametype, float features, float pFlagsRequired, float pFlagsForbidden, float pAbortOnGenerate); // 1 on success, 0 on temporary failure (call it again next frame then; use MapInfo_progress as progress indicator)
void MapInfo_FilterString(string sf); // filter _MapInfo_filtered (created by MapInfo_FilterGametype) with keyword
int MapInfo_CurrentFeatures(); // retrieves currently required features from cvars
int MapInfo_CurrentGametype(); // retrieves current gametype from cvars
int MapInfo_ForbiddenFlags(); // retrieves current flags from cvars
......
/*
Copyright (C) 2015 Micah Talkiewicz.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License