...
 
Commits (112)
Tue Nov 27 07:24:07 CET 2018
Thu Feb 7 07:24:09 CET 2019
......@@ -186,6 +186,7 @@ seta hud_shownames_crosshairdistance_antioverlap 0 "allow antioverlap to work as
seta hud_shownames_self 0 "also include your own name to be shown when third person camera mode is on (chase_active/cl_eventchase)"
seta hud_shownames_status 1 "1 = draw health/armor status of teammates"
seta hud_shownames_statusbar_height 4 "height of status bar"
seta hud_shownames_statusbar_highlight 1 "Always highlight values of health and armor from 0 to half status bar"
seta hud_shownames_aspect 8 "aspect ratio of total drawing area per name"
seta hud_shownames_fontsize 12 "font size"
seta hud_shownames_decolorize 1 "1 = decolorize name in team games, 2 = decolorize always"
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -207,7 +207,7 @@ seta hud_panel_pressedkeys_bg_color_team ""
seta hud_panel_pressedkeys_bg_alpha ""
seta hud_panel_pressedkeys_bg_border ""
seta hud_panel_pressedkeys_bg_padding "1"
seta hud_panel_pressedkeys_aspect "1.6"
seta hud_panel_pressedkeys_aspect "1.8"
seta hud_panel_pressedkeys_attack "0"
seta hud_panel_chat_pos "0.010000 0.700000"
......
......@@ -207,7 +207,7 @@ seta hud_panel_pressedkeys_bg_color_team ""
seta hud_panel_pressedkeys_bg_alpha ""
seta hud_panel_pressedkeys_bg_border ""
seta hud_panel_pressedkeys_bg_padding ""
seta hud_panel_pressedkeys_aspect "1.6"
seta hud_panel_pressedkeys_aspect "1.8"
seta hud_panel_pressedkeys_attack "0"
seta hud_panel_chat_pos "0.010000 0.700000"
......
......@@ -207,7 +207,7 @@ seta hud_panel_pressedkeys_bg_color_team ""
seta hud_panel_pressedkeys_bg_alpha ""
seta hud_panel_pressedkeys_bg_border ""
seta hud_panel_pressedkeys_bg_padding ""
seta hud_panel_pressedkeys_aspect "1.6"
seta hud_panel_pressedkeys_aspect "1.8"
seta hud_panel_pressedkeys_attack "0"
seta hud_panel_chat_pos "0 0.775000"
......
......@@ -207,7 +207,7 @@ seta hud_panel_pressedkeys_bg_color_team ""
seta hud_panel_pressedkeys_bg_alpha ""
seta hud_panel_pressedkeys_bg_border ""
seta hud_panel_pressedkeys_bg_padding ""
seta hud_panel_pressedkeys_aspect "1.6"
seta hud_panel_pressedkeys_aspect "1.8"
seta hud_panel_pressedkeys_attack "0"
seta hud_panel_chat_pos "0 0.775000"
......
......@@ -207,7 +207,7 @@ seta hud_panel_pressedkeys_bg_color_team ""
seta hud_panel_pressedkeys_bg_alpha ""
seta hud_panel_pressedkeys_bg_border ""
seta hud_panel_pressedkeys_bg_padding ""
seta hud_panel_pressedkeys_aspect "1.6"
seta hud_panel_pressedkeys_aspect "1.8"
seta hud_panel_pressedkeys_attack "0"
seta hud_panel_chat_pos "0.020000 0.780000"
......
......@@ -207,7 +207,7 @@ seta hud_panel_pressedkeys_bg_color_team ""
seta hud_panel_pressedkeys_bg_alpha ""
seta hud_panel_pressedkeys_bg_border ""
seta hud_panel_pressedkeys_bg_padding ""
seta hud_panel_pressedkeys_aspect "1.6"
seta hud_panel_pressedkeys_aspect "1.8"
seta hud_panel_pressedkeys_attack "0"
seta hud_panel_chat_pos "0 0.760000"
......
ast "Asturian" "Asturianu" 73%
de "German" "Deutsch" 99%
de_CH "German (Switzerland)" "Deutsch (Schweiz)" 99%
ast "Asturian" "Asturianu" 68%
de "German" "Deutsch" 91%
de_CH "German (Switzerland)" "Deutsch (Schweiz)" 91%
en "English" "English" 100%
en_AU "English (Australia)" "English (Australia)" 86%
es "Spanish" "Español" 99%
en_AU "English (Australia)" "English (Australia)" 80%
es "Spanish" "Español" 91%
fr "French" "Français" 99%
ga "Irish" "Irish" 35%
it "Italian" "Italiano" 99%
hu "Hungarian" "Magyar" 57%
nl "Dutch" "Nederlands" 70%
pl "Polish" "Polski" 81%
pt "Portuguese" "Português" 98%
pt_BR "Portuguese (Brazil)" "Português (Brasil)" 99%
ro "Romanian" "Romana" 83%
fi "Finnish" "Suomi" 33%
el "Greek" "Ελληνική" 43%
be "Belarusian" "Беларуская" 61%
bg "Bulgarian" "Български" 68%
ru "Russian" "Русский" 99%
sr "Serbian" "Српски" 71%
uk "Ukrainian" "Українська" 57%
zh_CN "Chinese (China)" "中文" 63%
zh_TW "Chinese (Taiwan)" "國語" 68%
ko "Korean" "한국의" 33%
ga "Irish" "Irish" 34%
it "Italian" "Italiano" 100%
hu "Hungarian" "Magyar" 51%
nl "Dutch" "Nederlands" 66%
pl "Polish" "Polski" 76%
pt "Portuguese" "Português" 90%
pt_BR "Portuguese (Brazil)" "Português (Brasil)" 100%
ro "Romanian" "Romana" 78%
fi "Finnish" "Suomi" 31%
el "Greek" "Ελληνική" 48%
be "Belarusian" "Беларуская" 58%
bg "Bulgarian" "Български" 63%
ru "Russian" "Русский" 100%
sr "Serbian" "Српски" 66%
uk "Ukrainian" "Українська" 53%
zh_CN "Chinese (China)" "中文" 59%
zh_TW "Chinese (Taiwan)" "國語" 65%
ko "Korean" "한국의" 32%
......@@ -235,7 +235,7 @@ seta notification_INFO_ITEM_WEAPON_PRIMORSEC "0" "0 = off, 1 = print to console,
seta notification_INFO_ITEM_WEAPON_UNAVAILABLE "0" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
seta notification_INFO_JETPACK_NOFUEL "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
seta notification_INFO_JOIN_CONNECT "2" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
seta notification_INFO_JOIN_PLAY "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
seta notification_INFO_JOIN_PLAY "2" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
seta notification_INFO_JOIN_PLAY_TEAM "2" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
seta notification_INFO_KEEPAWAY_DROPPED "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
seta notification_INFO_KEEPAWAY_PICKUP "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
......@@ -245,7 +245,7 @@ seta notification_INFO_KEYHUNT_DROP "1" "0 = off, 1 = print to console, 2 = prin
seta notification_INFO_KEYHUNT_LOST "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
seta notification_INFO_KEYHUNT_PICKUP "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
seta notification_INFO_KEYHUNT_PUSHED "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
seta notification_INFO_LMS_FORFEIT "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
seta notification_INFO_LMS_FORFEIT "2" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
seta notification_INFO_LMS_NOLIVES "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
seta notification_INFO_MINIGAME_INVITE "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
seta notification_INFO_MONSTERS_DISABLED "1" "0 = off, 1 = print to console, 2 = print to console and chatbox (if notification_allow_chatboxprint is enabled)"
......
......@@ -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()
{
......
......@@ -381,6 +381,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;
......
......@@ -341,10 +341,10 @@ void CSQCPlayer_FallbackFrame_PostUpdate(entity this, bool isnew)
// player "pops in"
if(isnew)
{
#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
#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
FIX_FRAMETIME(frame, frame1time);
FIX_FRAMETIME(frame2, frame2time);
#ifdef CSQCMODEL_HAVE_TWO_FRAMES
......@@ -441,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;
......@@ -606,7 +606,7 @@ void CSQCModel_Hook_PreDraw(entity this, bool isplayer)
else
this.drawmask = MASK_NORMAL;
if(this.isplayermodel && this.drawmask) // 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.isplayermodel & ISPLAYER_LOCAL));
CSQCPlayer_LOD_Apply(this);
......@@ -697,7 +697,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);
......@@ -713,7 +713,7 @@ void CSQCModel_Hook_PostUpdate(entity this, bool isnew, bool isplayer, bool islo
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)
......
......@@ -565,8 +565,6 @@ bool HUD_WouldShowCursor()
{
if(autocvar__hud_configure)
return true;
if(hud_panel_radar_mouse)
return true;
if(mv_active)
return true;
//entity local_player = ((csqcplayer) ? csqcplayer : CSQCModel_server2csqc(player_localentnum - 1)); // TODO: doesn't use regular cursor handling
......@@ -700,10 +698,15 @@ void HUD_Main()
HUD_Panel_Draw(HUD_PANEL(QUICKMENU));
HUD_Panel_Draw(HUD_PANEL(SCOREBOARD));
bool cursor_active_prev = cursor_active;
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();
......
This diff is collapsed.
......@@ -23,7 +23,7 @@ void DrawNadeProgressBar(vector myPos, vector mySize, float progress, vector col
void DrawAmmoItem(vector myPos, vector mySize, int ammoType, bool isCurrent, bool isInfinite)
{
TC(bool, isCurrent); TC(bool, isInfinite);
if(ammoType == RESOURCE_NONE)
if(ammoType == RES_NONE)
return;
// Initialize variables
......@@ -31,7 +31,7 @@ void DrawAmmoItem(vector myPos, vector mySize, int ammoType, bool isCurrent, boo
int ammo;
if(autocvar__hud_configure)
{
isCurrent = (ammoType == RESOURCE_ROCKETS); // Rockets always current
isCurrent = (ammoType == RES_ROCKETS); // Rockets always current
ammo = 60;
}
else
......@@ -183,7 +183,7 @@ void HUD_Ammo()
{
if(autocvar__hud_configure)
{
DrawAmmoItem(pos, ammo_size, RESOURCE_ROCKETS, true, false);
DrawAmmoItem(pos, ammo_size, RES_ROCKETS, true, false);
}
else
{
......
......@@ -86,9 +86,7 @@ void HUD_HealthArmor()
int maxarmor = autocvar_hud_panel_healtharmor_maxarmor;
if(autocvar_hud_panel_healtharmor_combined) // combined health and armor display
{
vector v;
v = healtharmor_maxdamage(health, armor, armorblockpercent, DEATH_WEAPON.m_id);
vector v = healtharmor_maxdamage(health, armor, armorblockpercent, DEATH_WEAPON.m_id);
float hp = floor(v.x + 1);
float maxtotal = maxhealth + maxarmor;
......
......@@ -50,10 +50,10 @@ vector InfoMessages_drawstring(string s, vector pos, vector sz, float a, vector
return pos;
}
#define InfoMessage(s) MACRO_BEGIN { \
#define InfoMessage(s) MACRO_BEGIN \
pos = InfoMessages_drawstring(s, pos, mySize, ((img_curr_group >= 0) ? panel_fg_alpha * img_fade[img_curr_group] : panel_fg_alpha), fontsize); \
img_curr_group = -1; \
} MACRO_END
MACRO_END
void HUD_InfoMessages()
{
......
......@@ -41,8 +41,8 @@ void DrawCAItem(vector myPos, vector mySize, float aspect_ratio, int layout, int
if(layout)
{
drawpic_aspect_skin(myPos, pic, vec2(0.7 * mySize.x, mySize.y), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
drawstring_aspect(myPos + eX * 0.7 * mySize.x, ftos(stat), vec2(0.3 * mySize.x, mySize.y), color, panel_fg_alpha, DRAWFLAG_NORMAL);
drawpic_aspect_skin(myPos, pic, vec2(0.5 * mySize.x, mySize.y), '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
drawstring_aspect(myPos + eX * 0.5 * mySize.x, ftos(stat), vec2(0.5 * mySize.x, mySize.y), color, panel_fg_alpha, DRAWFLAG_NORMAL);
}
else
drawstring_aspect(myPos, ftos(stat), mySize, color, panel_fg_alpha, DRAWFLAG_NORMAL);
......@@ -136,14 +136,14 @@ void HUD_Mod_CTF(vector pos, vector mySize)
}
// when status CHANGES, set old status into prevstatus and current status into status
#define X(team) MACRO_BEGIN { \
if (team##flag != team##flag_prevframe) { \
team##flag_statuschange_time = time; \
team##flag_prevstatus = team##flag_prevframe; \
team##flag_prevframe = team##flag; \
} \
team##flag_statuschange_elapsedtime = time - team##flag_statuschange_time; \
} MACRO_END
#define X(team) MACRO_BEGIN \
if (team##flag != team##flag_prevframe) { \
team##flag_statuschange_time = time; \
team##flag_prevstatus = team##flag_prevframe; \
team##flag_prevframe = team##flag; \
} \
team##flag_statuschange_elapsedtime = time - team##flag_statuschange_time; \
MACRO_END
X(red);
X(blue);
X(yellow);
......@@ -164,7 +164,7 @@ void HUD_Mod_CTF(vector pos, vector mySize)
string team##_icon = string_null, team##_icon_prevstatus = string_null; \
int team##_alpha, team##_alpha_prevstatus; \
team##_alpha = team##_alpha_prevstatus = 1; \
MACRO_BEGIN { \
MACRO_BEGIN \
switch (team##flag) { \
case 1: team##_icon = "flag_" #team "_taken"; break; \
case 2: team##_icon = "flag_" #team "_lost"; break; \
......@@ -191,7 +191,7 @@ void HUD_Mod_CTF(vector pos, vector mySize)
} \
break; \
} \
} MACRO_END
MACRO_END
X(red, myteam != NUM_TEAM_1 && (nteams & BIT(0)));
X(blue, myteam != NUM_TEAM_2 && (nteams & BIT(1)));
X(yellow, myteam != NUM_TEAM_3 && (nteams & BIT(2)));
......@@ -262,7 +262,7 @@ void HUD_Mod_CTF(vector pos, vector mySize)
neutralflag_pos = pos;
flag_size = e1 * fs * size1 + e2 * size2;
#define X(team) MACRO_BEGIN { \
#define X(team) MACRO_BEGIN \
f = bound(0, team##flag_statuschange_elapsedtime * 2, 1); \
if (team##_icon && ctf_stalemate) \
drawpic_aspect_skin(team##flag_pos, "flag_stalemate", flag_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); \
......@@ -270,7 +270,7 @@ void HUD_Mod_CTF(vector pos, vector mySize)
drawpic_aspect_skin_expanding(team##flag_pos, team##_icon_prevstatus, flag_size, '1 1 1', panel_fg_alpha * team##_alpha_prevstatus, DRAWFLAG_NORMAL, f); \
if (team##_icon) \
drawpic_aspect_skin(team##flag_pos, team##_icon, flag_size, '1 1 1', panel_fg_alpha * team##_alpha * f, DRAWFLAG_NORMAL); \
} MACRO_END
MACRO_END
X(red);
X(blue);
X(yellow);
......@@ -496,11 +496,16 @@ 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(strdecolorize(grecordholder[i]) == strdecolorize(net_name))
return i+1;
return 0;
int rank = 0;
string zoned_name = strzone(strdecolorize(entcs_GetName(player_localnum)));
for (int i = RANKINGS_CNT - 1; i >= 0; --i)
if (strdecolorize(grecordholder[i]) == zoned_name)
{
rank = i + 1;
break;
}
strfree(zoned_name);
return rank;
}
void race_showTime(string text, vector pos, vector timeText_ofs, float theTime, vector textSize, float f)
......
......@@ -52,21 +52,21 @@ void HUD_PressedKeys()
mySize = newSize;
}
vector keysize = vec2(mySize.x / 3, mySize.y / (3 - !autocvar_hud_panel_pressedkeys_attack));
vector keysize = vec2(mySize.x / (14/4), mySize.y / (3 - !autocvar_hud_panel_pressedkeys_attack));
int pressedkeys = STAT(PRESSED_KEYS);
if(autocvar_hud_panel_pressedkeys_attack)
{
drawpic_aspect_skin(pos + eX * keysize.x * 0.5, ((pressedkeys & KEY_ATCK) ? "key_atck_inv.tga" : "key_atck.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
drawpic_aspect_skin(pos + eX * keysize.x * 1.5, ((pressedkeys & KEY_ATCK2) ? "key_atck_inv.tga" : "key_atck.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
drawpic_aspect_skin(pos + eX * (3/4 * keysize.x), ((pressedkeys & KEY_ATCK) ? "key_atck_inv.tga" : "key_atck.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
drawpic_aspect_skin(pos + eX * (7/4 * keysize.x), ((pressedkeys & KEY_ATCK2) ? "key_atck2_inv.tga" : "key_atck2.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
pos.y += keysize.y;
}
drawpic_aspect_skin(pos, ((pressedkeys & KEY_CROUCH) ? "key_crouch_inv.tga" : "key_crouch.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
drawpic_aspect_skin(pos + eX * keysize.x, ((pressedkeys & KEY_FORWARD) ? "key_forward_inv.tga" : "key_forward.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
drawpic_aspect_skin(pos + eX * keysize.x * 2, ((pressedkeys & KEY_JUMP) ? "key_jump_inv.tga" : "key_jump.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
drawpic_aspect_skin(pos + eX * (5/4 * keysize.x), ((pressedkeys & KEY_FORWARD) ? "key_forward_inv.tga" : "key_forward.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
drawpic_aspect_skin(pos + eX * (10/4 * keysize.x), ((pressedkeys & KEY_JUMP) ? "key_jump_inv.tga" : "key_jump.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
pos.y += keysize.y;
drawpic_aspect_skin(pos, ((pressedkeys & KEY_LEFT) ? "key_left_inv.tga" : "key_left.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
drawpic_aspect_skin(pos + eX * keysize.x, ((pressedkeys & KEY_BACKWARD) ? "key_backward_inv.tga" : "key_backward.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
drawpic_aspect_skin(pos + eX * keysize.x * 2, ((pressedkeys & KEY_RIGHT) ? "key_right_inv.tga" : "key_right.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
drawpic_aspect_skin(pos + eX * (1/4 * keysize.x), ((pressedkeys & KEY_LEFT) ? "key_left_inv.tga" : "key_left.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
drawpic_aspect_skin(pos + eX * (5/4 * keysize.x), ((pressedkeys & KEY_BACKWARD) ? "key_backward_inv.tga" : "key_backward.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
drawpic_aspect_skin(pos + eX * (9/4 * keysize.x), ((pressedkeys & KEY_RIGHT) ? "key_right_inv.tga" : "key_right.tga"), keysize, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
}
......@@ -259,6 +259,7 @@ bool QuickMenu_Page_Load(string target_submenu, bool new_page)
TC(bool, new_page);
string s = string_null, cmd = string_null, z_submenu;
QuickMenu_Page_ActivatedEntry = -1;
if (new_page == 0)
QuickMenu_Page = 0;
else
......@@ -384,6 +385,7 @@ bool QuickMenu_ActionForNumber(int num)
if (QuickMenu_Page_Command[num] != "")
{
QuickMenu_Page_ActivatedEntry_Time = time + 0.1;
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;
......@@ -397,7 +399,6 @@ 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);
......@@ -513,19 +514,22 @@ void QuickMenu_Mouse()
int entry_num = min(QuickMenu_Page_Entries - 1, floor((mousepos.y - first_entry_pos) / fontsize.y));
if (QuickMenu_IsLastPage || entry_num != QUICKMENU_MAXLINES - 2)
{
// recycling panel_pos as entry_pos
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, vec2(panel_size.x, fontsize.y), color, .2, DRAWFLAG_NORMAL);
if(!mouseClicked && (prevMouseClicked & S_MOUSE1))
QuickMenu_Page_ActiveEntry((entry_num < QUICKMENU_MAXLINES - 1) ? entry_num + 1 : 0);
if (time > QuickMenu_Page_ActivatedEntry_Time)
{
vector entry_pos = panel_pos;
entry_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(entry_pos, vec2(panel_size.x, fontsize.y), color, .2, DRAWFLAG_NORMAL);
}
}
}
}
......@@ -664,8 +668,7 @@ void HUD_QuickMenu()
}
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)
if (time < QuickMenu_Page_ActivatedEntry_Time && QuickMenu_Page_ActivatedEntry == i)
drawfill(panel_pos, vec2(panel_size.x, fontsize.y), '0.5 1 0.5', .2, DRAWFLAG_NORMAL);
panel_pos.y += fontsize.y;
......@@ -776,6 +779,7 @@ void QuickMenu_Default(string target_submenu)
string tc_cmd;
QUICKMENU_SMENU(_("Chat"), "Chat")
QUICKMENU_SMENU_PL(CTX(_("QMCMD^Send public message to")), "Send public message to", "commandmode say %s:^7", 0, 1)
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")))
......
......@@ -342,7 +342,7 @@ void HUD_Radar()
IL_EACH(g_radaricons, it.teamradar_icon, {
if ( hud_panel_radar_mouse )
if ( GetResourceAmount(it, RESOURCE_HEALTH) >= 0 )
if ( GetResource(it, RES_HEALTH) >= 0 )
if ( it.team == myteam + 1 || ISGAMETYPE(RACE) || !teamplay )
{
vector coord = teamradar_texcoord_to_2dcoord(teamradar_3dcoord_to_texcoord(it.origin));
......
This diff is collapsed.
......@@ -26,7 +26,7 @@ int weaponorder_cmp(int i, int j, entity pass)
return aj - ai; // the string is in REVERSE order (higher prio at the right is what we want, but higher prio first is the string)
}
#define HUD_WEAPONS_GET_FULL_LAYOUT() MACRO_BEGIN { \
#define HUD_WEAPONS_GET_FULL_LAYOUT() MACRO_BEGIN \
int nHidden = 0; \
FOREACH(Weapons, it != WEP_Null, { \
if (weapons_stat & WepSet_FromWeapon(it)) continue; \
......@@ -37,7 +37,7 @@ int weaponorder_cmp(int i, int j, entity pass)
rows = table_size.y; \
weapon_size.x = panel_size.x / columns; \
weapon_size.y = panel_size.y / rows; \
} MACRO_END
MACRO_END
void HUD_Weapons()
{
......@@ -490,7 +490,7 @@ void HUD_Weapons()
}
// draw ammo status bar
if(!infinite_ammo && autocvar_hud_panel_weapons_ammo && (it.ammo_type != RESOURCE_NONE))
if(!infinite_ammo && autocvar_hud_panel_weapons_ammo && (it.ammo_type != RES_NONE))
{
float ammo_full;
a = getstati(GetAmmoStat(it.ammo_type)); // how much ammo do we have?
......@@ -499,12 +499,12 @@ void HUD_Weapons()
{
switch (it.ammo_type)
{
case RESOURCE_SHELLS: ammo_full = autocvar_hud_panel_weapons_ammo_full_shells; break;
case RESOURCE_BULLETS: ammo_full = autocvar_hud_panel_weapons_ammo_full_nails; break;
case RESOURCE_ROCKETS: ammo_full = autocvar_hud_panel_weapons_ammo_full_rockets; break;
case RESOURCE_CELLS: ammo_full = autocvar_hud_panel_weapons_ammo_full_cells; break;
case RESOURCE_PLASMA: ammo_full = autocvar_hud_panel_weapons_ammo_full_plasma; break;
case RESOURCE_FUEL: ammo_full = autocvar_hud_panel_weapons_ammo_full_fuel; break;
case RES_SHELLS: ammo_full = autocvar_hud_panel_weapons_ammo_full_shells; break;
case RES_BULLETS: ammo_full = autocvar_hud_panel_weapons_ammo_full_nails; break;
case RES_ROCKETS: ammo_full = autocvar_hud_panel_weapons_ammo_full_rockets; break;
case RES_CELLS: ammo_full = autocvar_hud_panel_weapons_ammo_full_cells; break;
case RES_PLASMA: ammo_full = autocvar_hud_panel_weapons_ammo_full_plasma; break;
case RES_FUEL: ammo_full = autocvar_hud_panel_weapons_ammo_full_fuel; break;
default: ammo_full = 60;
}
......
......@@ -322,6 +322,7 @@ float MapVote_Selection(vector topleft, vector cellsize, float rows, float colum
}
vector prev_mousepos;
// draws map vote or gametype vote
void MapVote_Draw()
{
string map;
......@@ -359,6 +360,11 @@ void MapVote_Draw()
ymax -= chat_sizey;
hud_fontsize = HUD_GetFontsize("hud_fontsize");
if (gametypevote)
{
gtv_text_size = hud_fontsize * 1.4;
gtv_text_size_small = hud_fontsize * 1.1;
}
pos.y = ymin;
pos.z = 0;
......@@ -459,7 +465,7 @@ void MapVote_Draw()
mv_selection = MapVote_Selection(pos, dist, rows, mv_columns);
if (mv_top2_time)
mv_top2_alpha = max(0.2, 1 - (time - mv_top2_time)*(time - mv_top2_time));
mv_top2_alpha = max(0.2, 1 - (time - mv_top2_time) ** 2);
void (vector, float, float, string, string, float, float) DrawItem;
......@@ -680,9 +686,6 @@ void MapVote_Init()
mapvote_chosenmap = strzone(ReadString());
if ( gametypevote == 2 )
gametypevote = 0;
gtv_text_size = hud_fontsize*1.4;
gtv_text_size_small = hud_fontsize*1.1;
}
MapVote_ReadMask();
......@@ -778,8 +781,8 @@ int MapVote_MoveDown(int pos)
float MapVote_InputEvent(int bInputType, float nPrimary, float nSecondary)
{
TC(int, bInputType);
float imp;
static int first_digit = 0;
if (!mv_active)
return false;
......@@ -791,29 +794,28 @@ float MapVote_InputEvent(int bInputType, float nPrimary, float nSecondary)
return 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_CTRL)
first_digit = 0;
}
if (bInputType != 0)
return false;
if ('0' <= nPrimary && nPrimary <= '9')
{
imp = nPrimary - '0';
if (imp == 0) imp = 10;
localcmd(strcat("\nimpulse ", ftos(imp), "\n"));
return true;
}
int imp = 0;
switch(nPrimary)
{
case K_KP_1: localcmd("\nimpulse 1\n"); return true;
case K_KP_2: localcmd("\nimpulse 2\n"); return true;
case K_KP_3: localcmd("\nimpulse 3\n"); return true;
case K_KP_4: localcmd("\nimpulse 4\n"); return true;
case K_KP_5: localcmd("\nimpulse 5\n"); return true;
case K_KP_6: localcmd("\nimpulse 6\n"); return true;
case K_KP_7: localcmd("\nimpulse 7\n"); return true;
case K_KP_8: localcmd("\nimpulse 8\n"); return true;
case K_KP_9: localcmd("\nimpulse 9\n"); return true;
case K_KP_0: localcmd("\nimpulse 10\n"); return true;
case K_RIGHTARROW:
mv_selection_keyboard = 1;
mv_selection = MapVote_MoveRight(mv_selection);
......@@ -836,6 +838,27 @@ float MapVote_InputEvent(int bInputType, float nPrimary, float nSecondary)
if ( mv_selection_keyboard )
MapVote_SendChoice(mv_selection);
return true;
case '1': case K_KP_1: imp = 1; break;
case '2': case K_KP_2: imp = 2; break;
case '3': case K_KP_3: imp = 3; break;
case '4': case K_KP_4: imp = 4; break;
case '5': case K_KP_5: imp = 5; break;
case '6': case K_KP_6: imp = 6; break;
case '7': case K_KP_7: imp = 7; break;
case '8': case K_KP_8: imp = 8; break;
case '9': case K_KP_9: imp = 9; break;
case '0': case K_KP_0: imp = 10; break;
}
if (imp && hudShiftState & S_CTRL)
{
if (!first_digit)
{
first_digit = imp % 10;
return true;
}
else
imp = first_digit * 10 + (imp % 10);
}
if (nPrimary == K_MOUSE1)
......@@ -843,11 +866,14 @@ float MapVote_InputEvent(int bInputType, float nPrimary, float nSecondary)
mv_selection_keyboard = 0;
mv_selection = mv_mouse_selection;
if (mv_selection >= 0)
{
imp = min(mv_selection + 1, mv_num_maps);
}
if (imp)
{
if (imp <= mv_num_maps)
localcmd(strcat("\nimpulse ", ftos(imp), "\n"));
return true;
}
return true;
}
return false;
......
......@@ -34,7 +34,7 @@ float PreviewExists(string name);
vector Rotate(vector v, float a);
#define IS_DEAD(s) (((s).classname == "csqcmodel") ? (s).csqcmodel_isdead : (GetResourceAmount((s), RESOURCE_HEALTH) <= 0))
#define IS_DEAD(s) (((s).classname == "csqcmodel") ? (s).csqcmodel_isdead : (GetResource((s), RES_HEALTH) <= 0))
// decolorizes and team colors the player name when needed
......@@ -110,7 +110,7 @@ vector _drawpic_sz;
float _drawpic_oldsz;
string _drawpic_picpath;
#define drawpic_aspect(pos,pic,mySize,color,theAlpha,drawflag)\
MACRO_BEGIN {\
MACRO_BEGIN \
_drawpic_imgsize = draw_getimagesize(pic);\
if(_drawpic_imgsize != '0 0 0') {\
_drawpic_imgaspect = _drawpic_imgsize.x/_drawpic_imgsize.y;\
......@@ -127,35 +127,35 @@ string _drawpic_picpath;
drawpic(pos + eY * 0.5 * (_drawpic_oldsz - _drawpic_sz.y), pic, _drawpic_sz, color, theAlpha, drawflag);\
}\
}\
} MACRO_END
MACRO_END
// draw HUD element with image from gfx/hud/hud_skin/foo.tga if it exists, otherwise gfx/hud/default/foo.tga
#define drawpic_aspect_skin(pos,pic,sz,color,theAlpha,drawflag)\
MACRO_BEGIN {\
MACRO_BEGIN \
_drawpic_picpath = strcat(hud_skin_path, "/", pic);\
if(precache_pic(_drawpic_picpath) == "") {\
_drawpic_picpath = strcat("gfx/hud/default/", pic);\
}\
drawpic_aspect(pos, _drawpic_picpath, sz, color, theAlpha, drawflag);\
_drawpic_picpath = string_null;\
} MACRO_END
MACRO_END
// draw HUD element with image from gfx/hud/hud_skin/foo.tga if it exists, otherwise gfx/hud/default/foo.tga
#define drawpic_skin(pos,pic,sz,color,theAlpha,drawflag)\
MACRO_BEGIN {\
MACRO_BEGIN \
_drawpic_picpath = strcat(hud_skin_path, "/", pic);\
if(precache_pic(_drawpic_picpath) == "") {\
_drawpic_picpath = strcat("gfx/hud/default/", pic);\
}\
drawpic(pos, _drawpic_picpath, sz, color, theAlpha, drawflag);\
_drawpic_picpath = string_null;\
} MACRO_END
MACRO_END
void drawpic_aspect_skin_expanding(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp);
void drawpic_aspect_skin_expanding_two(vector position, string pic, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp);
#define SET_POS_AND_SZ_Y_ASPECT(allow_colors) MACRO_BEGIN { \
#define SET_POS_AND_SZ_Y_ASPECT(allow_colors) MACRO_BEGIN \
float textaspect, oldsz; \
vector dfs = drawfontscale; \
drawfontscale = '1 1 0'; \
......@@ -170,7 +170,7 @@ void drawpic_aspect_skin_expanding_two(vector position, string pic, vector theSc
sz.y = sz.x / textaspect; \
pos.y += (oldsz - sz.y) * 0.5; \
} \
} MACRO_END
MACRO_END
// drawstring wrapper to draw a string as large as possible with preserved aspect ratio into a box
void drawstring_aspect(vector pos, string text, vector sz, vector color, float theAlpha, float drawflag);
......
......@@ -5,82 +5,79 @@
/// \brief Source file that contains implementation of the resource system.
/// \copyright GNU GPLv2 or any later version.
float GetResourceAmount(entity e, int resource_type)
float GetResource(entity e, int res_type)
{
.float resource_field = GetResourceField(resource_type);
return e.(resource_field);
return e.(GetResourceField(res_type));
}
bool SetResourceAmountExplicit(entity e, int resource_type, float amount)
bool SetResourceExplicit(entity e, int res_type, float amount)
{
.float resource_field = GetResourceField(resource_type);
if (e.(resource_field) != amount)
.float res_field = GetResourceField(res_type);
if (e.(res_field) != amount)
{
e.(resource_field) = amount;
e.(res_field) = amount;
return true;
}
return false;
}
void SetResourceAmount(entity e, int resource_type, float amount)
void SetResource(entity e, int res_type, float amount)
{
SetResourceAmountExplicit(e, resource_type, amount);
SetResourceExplicit(e, res_type, amount);
}
void TakeResource(entity receiver, int resource_type, float amount)
void TakeResource(entity receiver, int res_type, float amount)
{
if (amount == 0)
{
return;
}
SetResourceAmount(receiver, resource_type,
GetResourceAmount(receiver, resource_type) - amount);
SetResource(receiver, res_type, GetResource(receiver, res_type) - amount);
}
void TakeResourceWithLimit(entity receiver, int resource_type, float amount,
float limit)
void TakeResourceWithLimit(entity receiver, int res_type, float amount, float limit)
{
if (amount == 0)
{
return;
}
float current_amount = GetResourceAmount(receiver, resource_type);
float current_amount = GetResource(receiver, res_type);
if (current_amount - amount < limit)
{
amount = limit + current_amount;
}
TakeResource(receiver, resource_type, amount);
TakeResource(receiver, res_type, amount);
}
int GetResourceType(.float resource_field)
int GetResourceType(.float res_field)
{
switch (resource_field)
switch (res_field)
{
case health: { return RESOURCE_HEALTH; }
case armorvalue: { return RESOURCE_ARMOR; }
case ammo_shells: { return RESOURCE_SHELLS; }
case ammo_nails: { return RESOURCE_BULLETS; }
case ammo_rockets: { return RESOURCE_ROCKETS; }
case ammo_cells: { return RESOURCE_CELLS; }
case ammo_plasma: { return RESOURCE_PLASMA; }
case ammo_fuel: { return RESOURCE_FUEL; }
case health: { return RES_HEALTH; }
case armorvalue: { return RES_ARMOR; }
case ammo_shells: { return RES_SHELLS; }
case ammo_nails: { return RES_BULLETS; }
case ammo_rockets: { return RES_ROCKETS; }
case ammo_cells: { return RES_CELLS; }
case ammo_plasma: { return RES_PLASMA; }
case ammo_fuel: { return RES_FUEL; }
}
error("GetResourceType: Invalid field.");
return 0;
}
.float GetResourceField(int resource_type)
.float GetResourceField(int res_type)
{
switch (resource_type)
switch (res_type)
{
case RESOURCE_HEALTH: { return health; }
case RESOURCE_ARMOR: { return armorvalue; }
case RESOURCE_SHELLS: { return ammo_shells; }
case RESOURCE_BULLETS: { return ammo_nails; }
case RESOURCE_ROCKETS: { return ammo_rockets; }
case RESOURCE_CELLS: { return ammo_cells; }
case RESOURCE_PLASMA: { return ammo_plasma; }
case RESOURCE_FUEL: { return ammo_fuel; }
case RES_HEALTH: { return health; }
case RES_ARMOR: { return armorvalue; }
case RES_SHELLS: { return ammo_shells; }
case RES_BULLETS: { return ammo_nails; }
case RES_ROCKETS: { return ammo_rockets; }
case RES_CELLS: { return ammo_cells; }
case RES_PLASMA: { return ammo_plasma; }
case RES_FUEL: { return ammo_fuel; }
}
error("GetResourceField: Invalid resource type.");
return health;
......
......@@ -10,51 +10,50 @@
/// \brief Returns the current amount of resource the given entity has.
/// \param[in] e Entity to check.
/// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
/// \param[in] res_type Type of the resource (a RES_* constant).
/// \return Current amount of resource the given entity has.
float GetResourceAmount(entity e, int resource_type);
float GetResource(entity e, int res_type);
/// \brief Sets the resource amount of an entity without calling any hooks.
/// \param[in,out] e Entity to adjust.
/// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
/// \param[in] res_type Type of the resource (a RES_* constant).
/// \param[in] amount Amount of resource to set.
/// \return Boolean for whether the ammo amount was changed
bool SetResourceAmountExplicit(entity e, int resource_type, float amount);
bool SetResourceExplicit(entity e, int res_type, float amount);
/// \brief Sets the current amount of resource the given entity will have.
/// \param[in,out] e Entity to adjust.
/// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
/// \param[in] res_type Type of the resource (a RES_* constant).
/// \param[in] amount Amount of resource to set.
/// \return No return.
void SetResourceAmount(entity e, int resource_type, float amount);
void SetResource(entity e, int res_type, float amount);
/// \brief Takes an entity some resource.
/// \param[in,out] receiver Entity to take resource from.
/// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
/// \param[in] res_type Type of the resource (a RES_* constant).
/// \param[in] amount Amount of resource to take.
/// \return No return.
void TakeResource(entity receiver, int resource_type, float amount);
void TakeResource(entity receiver, int res_type, float amount);
/// \brief Takes an entity some resource but not less than a limit.
/// \param[in,out] receiver Entity to take resource from.
/// \param[in] resource_type Type of the resource (a RESOURCE_* constant).
/// \param[in] res_type Type of the resource (a RES_* constant).
/// \param[in] amount Amount of resource to take.
/// \param[in] limit Limit of resources to take.
/// \return No return.
void TakeResourceWithLimit(entity receiver, int resource_type, float amount,
float limit);
void TakeResourceWithLimit(entity receiver, int res_type, float amount, float limit);
// ===================== Legacy and/or internal API ===========================
/// \brief Converts an entity field to resource type.
/// \param[in] resource_field Entity field to convert.
/// \return Resource type (a RESOURCE_* constant).
int GetResourceType(.float resource_field);
/// \param[in] res_field Entity field to convert.
/// \return Resource type (a RES_* constant).
int GetResourceType(.float res_field);
/// \brief Converts resource type (a RESOURCE_* constant) to entity field.
/// \param[in] resource_type Type of the resource.
/// \brief Converts resource type (a RES_* constant) to entity field.
/// \param[in] res_type Type of the resource.
/// \return Entity field for that resource.
.float GetResourceField(int resource_type);
.float GetResourceField(int res_type);
/// \brief Legacy fields for the resources. To be removed.
.float health;
......
......@@ -162,16 +162,18 @@ void Draw_ShowNames(entity this)
{
vector pos = namepos + eY * autocvar_hud_shownames_fontsize * resize;
vector sz = vec2(0.5 * mySize.x, resize * autocvar_hud_shownames_statusbar_height);
if (autocvar_hud_shownames_statusbar_highlight)
drawfill(pos + eX * 0.25 * mySize.x, sz, '0.7 0.7 0.7', a / 2, DRAWFLAG_NORMAL);
if (this.healthvalue > 0)
{
HUD_Panel_DrawProgressBar(pos, sz, "nametag_statusbar",
this.healthvalue / autocvar_hud_panel_healtharmor_maxhealth, false, 1, '1 0 0', a,
DRAWFLAG_NORMAL);
}
if (GetResourceAmount(this, RESOURCE_ARMOR) > 0)
if (GetResource(this, RES_ARMOR) > 0)
{
HUD_Panel_DrawProgressBar(pos + eX * 0.5 * mySize.x, sz, "nametag_statusbar",
GetResourceAmount(this, RESOURCE_ARMOR) / autocvar_hud_panel_healtharmor_maxarmor, false, 0, '0 1 0', a,
GetResource(this, RES_ARMOR) / autocvar_hud_panel_healtharmor_maxarmor, false, 0, '0 1 0', a,
DRAWFLAG_NORMAL);
}
}
......@@ -204,13 +206,13 @@ void Draw_ShowNames_All()
if (entcs.m_entcs_private)
{
it.healthvalue = entcs.healthvalue;
SetResourceAmountExplicit(it, RESOURCE_ARMOR, GetResourceAmount(entcs, RESOURCE_ARMOR));
SetResourceExplicit(it, RES_ARMOR, GetResource(entcs, RES_ARMOR));
it.sameteam = true;
}
else
{
it.healthvalue = 0;
SetResourceAmountExplicit(it, RESOURCE_ARMOR, 0);
SetResourceExplicit(it, RES_ARMOR, 0);
it.sameteam = false;
}
bool dead = entcs_IsDead(i) || entcs_IsSpectating(i);
......
......@@ -76,54 +76,46 @@ float autocvar_cl_leanmodel_lowpass = 0.05;
ret = ref_store = ref_store * (1 - frac) + (value) * frac;
#define lowpass_limited(value, frac, limit, ref_store, ret) MACRO_BEGIN \
{ \
float __ignore; lowpass(value, frac, ref_store, __ignore); \
ret = ref_store = bound((value) - (limit), ref_store, (value) + (limit)); \
} MACRO_END
MACRO_END
#define highpass(value, frac, ref_store, ret) MACRO_BEGIN \
{ \
float __f = 0; lowpass(value, frac, ref_store, __f); \
ret = (value) - __f; \
} MACRO_END
MACRO_END
#define highpass_limited(value, frac, limit, ref_store, ret) MACRO_BEGIN \
{ \
float __f = 0; lowpass_limited(value, frac, limit, ref_store, __f); \
ret = (value) - __f; \
} MACRO_END
MACRO_END
#define lowpass2(value, frac, ref_store, ref_out) MACRO_BEGIN \
{ \
lowpass(value.x, frac, ref_store.x, ref_out.x); \
lowpass(value.y, frac, ref_store.y, ref_out.y); \
} MACRO_END
MACRO_END
#define highpass2(value, frac, ref_store, ref_out) MACRO_BEGIN \
{ \
highpass(value.x, frac, ref_store.x, ref_out.x); \
highpass(value.y, frac, ref_store.y, ref_out.y); \
} MACRO_END
MACRO_END
#define highpass2_limited(value, frac, limit, ref_store, ref_out) MACRO_BEGIN \
{ \
highpass_limited(value.x, frac, limit, ref_store.x, ref_out.x); \
highpass_limited(value.y, frac, limit, ref_store.y, ref_out.y); \
} MACRO_END
MACRO_END
#define lowpass3(value, frac, ref_store, ref_out) MACRO_BEGIN \
{ \
lowpass(value.x, frac, ref_store.x, ref_out.x); \
lowpass(value.y, frac, ref_store.y, ref_out.y); \
lowpass(value.z, frac, ref_store.z, ref_out.z); \
} MACRO_END
MACRO_END
#define highpass3(value, frac, ref_store, ref_out) MACRO_BEGIN \
{ \
highpass(value.x, frac, ref_store.x, ref_out.x); \
highpass(value.y, frac, ref_store.y, ref_out.y); \
highpass(value.z, frac, ref_store.z, ref_out.z); \
} MACRO_END
MACRO_END
void calc_followmodel_ofs(entity view)
{
......@@ -1356,7 +1348,7 @@ void HUD_Crosshair(entity this)
}
#define CROSSHAIR_DO_BLUR(M,sz,wcross_name,wcross_alpha) \
MACRO_BEGIN { \
MACRO_BEGIN \
vector scaled_sz = sz * wcross_size; \
if(wcross_blur > 0) \
{ \
......@@ -1368,7 +1360,7 @@ void HUD_Crosshair(entity this)
{ \
M(0,0,sz,scaled_sz,wcross_name,wcross_alpha); \
} \
} MACRO_END
MACRO_END
#define CROSSHAIR_DRAW_SINGLE(i,j,sz,scaled_sz,wcross_name,wcross_alpha) \
drawpic(wcross_origin - ('0.5 0 0' * (scaled_sz.x + i * wcross_blur) + '0 0.5 0' * (scaled_sz.y + j * wcross_blur)), wcross_name, scaled_sz, wcross_color, wcross_alpha, DRAWFLAG_NORMAL)
......@@ -1592,6 +1584,15 @@ void HUD_Mouse(entity player)
return;
}
if (cursor_active == -1) // starting to display the cursor
{
// since HUD_Mouse is called by CSQC_UpdateView before CSQC_InputEvent,
// in the first frame mousepos is the mouse position of the last time
// the cursor was displayed, thus we ignore it to avoid a glictch
cursor_active = 1;
return;
}
if(!autocvar_hud_cursormode)
update_mousepos();
......
......@@ -16,7 +16,7 @@ entity viewmodels[MAX_WEAPONSLOTS];
vector viewloc_mousepos;
bool cursor_active;
int cursor_active;
int cursor_type;
const int CURSOR_NORMAL = 0;
const int CURSOR_MOVE = 1;
......
......@@ -66,7 +66,8 @@ string GenericCommand_markup(string s2)
red = 0;
ccase = 0;
for(i = 0; i < strlen(s2); ++i)
int len = strlen(s2);
for (i = 0; i < len; ++i)
{
for(j = 0; j < NUM_MARKUPS; ++j)
{
......
......@@ -407,7 +407,7 @@ CLASS(DebugText3d, Object)
CONSTRUCT(DebugText3d);
this.origin = pos;
this.message = strzone(msg);
SetResourceAmount(this, RESOURCE_HEALTH, align);
SetResource(this, RES_HEALTH, align);
this.hit_time = time;
this.fade_rate = fade_rate_;
this.velocity = vel;
......@@ -432,7 +432,7 @@ CLASS(DebugText3d, Object)
if (screen_pos.z < 0) return; // behind camera
screen_pos.z = 0;
float align = GetResourceAmount(this, RESOURCE_HEALTH);
float align = GetResource(this, RES_HEALTH);
string msg;
vector msg_pos;
......
......@@ -263,10 +263,10 @@ void effectinfo_read()
void effectinfo_dump(int fh, bool alsoprint)
{
#define WRITE(s) MACRO_BEGIN { \
#define WRITE(s) MACRO_BEGIN \
fputs(fh, s); \
if (alsoprint) LOG_INFO(s); \
} MACRO_END
MACRO_END
WRITE("// ********************************************** //\n");
WRITE("// ** WARNING - DO NOT MANUALLY EDIT THIS FILE ** //\n");
WRITE("// ** ** //\n");
......
......@@ -78,7 +78,7 @@ void DamageEffect_Think(entity this)
return;
}