From: Mario Date: Sat, 25 Apr 2015 04:52:16 +0000 (+1000) Subject: Merge branch 'master' into Mario/combined_updates X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=062395ee2aec81c6a30893f514e52cdb78d4a9d2;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch 'master' into Mario/combined_updates Conflicts: qcsrc/client/hud.qc qcsrc/common/weapons/weapons.qh qcsrc/server/miscfunctions.qc qcsrc/server/vehicles/racer.qc --- 062395ee2aec81c6a30893f514e52cdb78d4a9d2 diff --cc qcsrc/client/hud.qc index b6afea58f,0da1b69d2..9ed816d37 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@@ -3067,185 -2863,10 +3073,185 @@@ void HUD_Mod_CA(vector myPos, vector my } } +// VIP mod icons +float redvip_prevframe, bluevip_prevframe, yellowvip_prevframe, pinkvip_prevframe; // status during previous frame +float redvip_prevstatus, bluevip_prevstatus, yellowvip_prevstatus, pinkvip_prevstatus; // last remembered status +float redvip_statuschange_time, bluevip_statuschange_time, yellowvip_statuschange_time, pinkvip_statuschange_time; // time when the status changed +void HUD_Mod_VIP_Reset(void) +{ + redvip_prevstatus = bluevip_prevstatus = yellowvip_prevstatus = pinkvip_prevstatus = redvip_prevframe = bluevip_prevframe = yellowvip_prevframe = pinkvip_prevframe = redvip_statuschange_time = bluevip_statuschange_time = yellowvip_statuschange_time = pinkvip_statuschange_time = 0; +} +void HUD_Mod_VIP(vector pos, vector mySize) +{ + vector redvip_pos, bluevip_pos, yellowvip_pos, pinkvip_pos; + vector vip_size; + vector e1, e2; + float size1, size2; + float fs, fs2, fs3; + float f; // every function should have that + + float redvip, bluevip, yellowvip, pinkvip, is_vip; // current status + float redvip_statuschange_elapsedtime, bluevip_statuschange_elapsedtime, yellowvip_statuschange_elapsedtime, pinkvip_statuschange_elapsedtime; // time since the status changed + + redvip = (getstatf(STAT_VIP_RED) != 0); + bluevip = (getstatf(STAT_VIP_BLUE) != 0); + yellowvip = (getstatf(STAT_VIP_YELLOW) != 0); + pinkvip = (getstatf(STAT_VIP_PINK) != 0); + is_vip = (getstati(STAT_VIP) != 0); + + if(redvip || bluevip || yellowvip || pinkvip) + mod_active = 1; + else + mod_active = 0; + + // when status CHANGES, set old status into prevstatus and current status into status + if (redvip != redvip_prevframe) + { + redvip_statuschange_time = time; + redvip_prevstatus = redvip_prevframe; + redvip_prevframe = redvip; + } + + if (bluevip != bluevip_prevframe) + { + bluevip_statuschange_time = time; + bluevip_prevstatus = bluevip_prevframe; + bluevip_prevframe = bluevip; + } + + if (yellowvip != yellowvip_prevframe) + { + yellowvip_statuschange_time = time; + yellowvip_prevstatus = yellowvip_prevframe; + yellowvip_prevframe = yellowvip; + } + + if (pinkvip != pinkvip_prevframe) + { + pinkvip_statuschange_time = time; + pinkvip_prevstatus = pinkvip_prevframe; + pinkvip_prevframe = pinkvip; + } + + redvip_statuschange_elapsedtime = time - redvip_statuschange_time; + bluevip_statuschange_elapsedtime = time - bluevip_statuschange_time; + yellowvip_statuschange_elapsedtime = time - yellowvip_statuschange_time; + pinkvip_statuschange_elapsedtime = time - pinkvip_statuschange_time; + + switch(team_count) + { + default: + case 2: fs = 0.5; fs2 = 0.5; fs3 = 0.5; break; + case 3: fs = 1; fs2 = 0.35; fs3 = 0.35; break; + case 4: fs = 0.75; fs2 = 0.25; fs3 = 0.5; break; + } + + if(mySize_x > mySize_y) + { + size1 = mySize_x; + size2 = mySize_y; + e1 = eX; + e2 = eY; + } + else + { + size1 = mySize_y; + size2 = mySize_x; + e1 = eY; + e2 = eX; + } + + switch(myteam) + { + default: + case NUM_TEAM_1: + { + redvip_pos = pos; + bluevip_pos = pos + eX * fs2 * size1; + yellowvip_pos = pos - eX * fs2 * size1; + pinkvip_pos = pos + eX * fs3 * size1; + break; + } + case NUM_TEAM_2: + { + redvip_pos = pos + eX * fs2 * size1; + bluevip_pos = pos; + yellowvip_pos = pos - eX * fs2 * size1; + pinkvip_pos = pos + eX * fs3 * size1; + break; + } + case NUM_TEAM_3: + { + redvip_pos = pos + eX * fs3 * size1; + bluevip_pos = pos - eX * fs2 * size1; + yellowvip_pos = pos; + pinkvip_pos = pos + eX * fs2 * size1; + break; + } + case NUM_TEAM_4: + { + redvip_pos = pos - eX * fs2 * size1; + bluevip_pos = pos + eX * fs3 * size1; + yellowvip_pos = pos + eX * fs2 * size1; + pinkvip_pos = pos; + break; + } + } + vip_size = e1 * fs * size1 + e2 * size2; + + string red_icon = "", red_icon_prevstatus = ""; + string blue_icon = "", blue_icon_prevstatus = ""; + string yellow_icon = "", yellow_icon_prevstatus = ""; + string pink_icon = "", pink_icon_prevstatus = ""; + + if(redvip) { red_icon = "player_red"; } + if(bluevip) { blue_icon = "player_blue"; } + if(yellowvip) { yellow_icon = "player_yellow"; } + if(pinkvip) { pink_icon = "player_pink"; } + + if(redvip_prevframe) { red_icon_prevstatus = "player_red"; } + if(bluevip_prevframe) { blue_icon_prevstatus = "player_blue"; } + if(yellowvip_prevframe) { yellow_icon_prevstatus = "player_yellow"; } + if(pinkvip_prevframe) { pink_icon_prevstatus = "player_pink"; } + + if(is_vip) + switch(myteam) + { + case NUM_TEAM_1: red_icon = "notify_balldropped"; break; + case NUM_TEAM_2: blue_icon = "notify_balldropped"; break; + case NUM_TEAM_3: yellow_icon = "notify_balldropped"; break; + case NUM_TEAM_4: pink_icon = "notify_balldropped"; break; + } + + f = bound(0, redvip_statuschange_elapsedtime*2, 1); + if(red_icon_prevstatus && f < 1) + drawpic_aspect_skin_expanding(redvip_pos, red_icon_prevstatus, vip_size, '1 1 1', panel_fg_alpha * 1, DRAWFLAG_NORMAL, f); + if(red_icon) + drawpic_aspect_skin(redvip_pos, red_icon, vip_size, '1 1 1', panel_fg_alpha * 1 * f, DRAWFLAG_NORMAL); + + f = bound(0, bluevip_statuschange_elapsedtime*2, 1); + if(blue_icon_prevstatus && f < 1) + drawpic_aspect_skin_expanding(bluevip_pos, blue_icon_prevstatus, vip_size, '1 1 1', panel_fg_alpha * 1, DRAWFLAG_NORMAL, f); + if(blue_icon) + drawpic_aspect_skin(bluevip_pos, blue_icon, vip_size, '1 1 1', panel_fg_alpha * 1 * f, DRAWFLAG_NORMAL); + + f = bound(0, yellowvip_statuschange_elapsedtime*2, 1); + if(yellow_icon_prevstatus && f < 1) + drawpic_aspect_skin_expanding(yellowvip_pos, yellow_icon_prevstatus, vip_size, '1 1 1', panel_fg_alpha * 1, DRAWFLAG_NORMAL, f); + if(yellow_icon) + drawpic_aspect_skin(yellowvip_pos, yellow_icon, vip_size, '1 1 1', panel_fg_alpha * 1 * f, DRAWFLAG_NORMAL); + + f = bound(0, pinkvip_statuschange_elapsedtime*2, 1); + if(pink_icon_prevstatus && f < 1) + drawpic_aspect_skin_expanding(pinkvip_pos, pink_icon_prevstatus, vip_size, '1 1 1', panel_fg_alpha * 1, DRAWFLAG_NORMAL, f); + if(pink_icon) + drawpic_aspect_skin(pinkvip_pos, pink_icon, vip_size, '1 1 1', panel_fg_alpha * 1 * f, DRAWFLAG_NORMAL); +} + // CTF HUD modicon section - float redflag_prevframe, blueflag_prevframe, yellowflag_prevframe, pinkflag_prevframe, neutralflag_prevframe; // status during previous frame - float redflag_prevstatus, blueflag_prevstatus, yellowflag_prevstatus, pinkflag_prevstatus, neutralflag_prevstatus; // last remembered status -float redflag_prevframe, blueflag_prevframe; // status during previous frame -int redflag_prevstatus, blueflag_prevstatus; // last remembered status -float redflag_statuschange_time, blueflag_statuschange_time; // time when the status changed ++int redflag_prevframe, blueflag_prevframe, yellowflag_prevframe, pinkflag_prevframe, neutralflag_prevframe; // status during previous frame ++int redflag_prevstatus, blueflag_prevstatus, yellowflag_prevstatus, pinkflag_prevstatus, neutralflag_prevstatus; // last remembered status +float redflag_statuschange_time, blueflag_statuschange_time, yellowflag_statuschange_time, pinkflag_statuschange_time, neutralflag_statuschange_time; // time when the status changed void HUD_Mod_CTF_Reset(void) { @@@ -3260,22 -2879,15 +3266,22 @@@ void HUD_Mod_CTF(vector pos, vector myS vector flag_size; float f; // every function should have that - float redflag, blueflag, yellowflag, pinkflag, neutralflag; // current status - int redflag, blueflag; // current status - float redflag_statuschange_elapsedtime, blueflag_statuschange_elapsedtime; // time since the status changed - int stat_items; - - stat_items = getstati(STAT_ITEMS, 0, 24); - redflag = (stat_items/IT_RED_FLAG_TAKEN) & 3; - blueflag = (stat_items/IT_BLUE_FLAG_TAKEN) & 3; - - if(redflag || blueflag) ++ int redflag, blueflag, yellowflag, pinkflag, neutralflag; // current status + float redflag_statuschange_elapsedtime, blueflag_statuschange_elapsedtime, yellowflag_statuschange_elapsedtime, pinkflag_statuschange_elapsedtime, neutralflag_statuschange_elapsedtime; // time since the status changed - float ctf_oneflag; // one-flag CTF mode enabled/disabled - float stat_items = getstati(STAT_CTF_FLAGSTATUS, 0, 24); ++ bool ctf_oneflag; // one-flag CTF mode enabled/disabled ++ int stat_items = getstati(STAT_CTF_FLAGSTATUS, 0, 24); + float fs, fs2, fs3, size1, size2; + vector e1, e2; + + redflag = (stat_items/CTF_RED_FLAG_TAKEN) & 3; + blueflag = (stat_items/CTF_BLUE_FLAG_TAKEN) & 3; + yellowflag = (stat_items/CTF_YELLOW_FLAG_TAKEN) & 3; + pinkflag = (stat_items/CTF_PINK_FLAG_TAKEN) & 3; + neutralflag = (stat_items/CTF_NEUTRAL_FLAG_TAKEN) & 3; + + ctf_oneflag = (stat_items & CTF_FLAG_NEUTRAL); + + if(redflag || blueflag || yellowflag || pinkflag || neutralflag) mod_active = 1; else mod_active = 0; @@@ -3586,18 -3019,15 +3592,18 @@@ vector KH_SLOTS[4] void HUD_Mod_KH(vector pos, vector mySize) { - mod_active = 1; // keyhunt should never hide the mod icons panel - // Read current state - float state = getstati(STAT_KH_KEYSTATUS); - float i, key_state; - float all_keys, team1_keys, team2_keys, team3_keys, team4_keys, dropped_keys, carrying_keys; - int state = getstati(STAT_KH_KEYS); ++ int state = getstati(STAT_KH_KEYSTATUS); + int i, key_state; + int all_keys, team1_keys, team2_keys, team3_keys, team4_keys, dropped_keys, carrying_keys; all_keys = team1_keys = team2_keys = team3_keys = team4_keys = dropped_keys = carrying_keys = 0; + if(state) + mod_active = 1; + else + mod_active = 0; + for(i = 0; i < 4; ++i) { key_state = (bitshift(state, i * -5) & 31) - 1; diff --cc qcsrc/common/weapons/weapons.qh index 895ef257c,593a40e3e..8facdca05 --- a/qcsrc/common/weapons/weapons.qh +++ b/qcsrc/common/weapons/weapons.qh @@@ -48,10 -48,9 +48,10 @@@ string weaponorder_byid // weapon sets typedef vector WepSet; - WepSet WepSet_FromWeapon(float a); + WepSet WepSet_FromWeapon(int a); #ifdef SVQC void WepSet_AddStat(); +void WepSet_AddStat_InMap(); void WriteWepSet(float dest, WepSet w); #endif #ifdef CSQC @@@ -79,27 -77,21 +79,27 @@@ string W_FixWeaponOrder_AllowIncomplete string W_FixWeaponOrder_ForceComplete(string order); void W_RandomWeapons(entity e, float n); - string GetAmmoPicture(.float ammotype); + string GetAmmoPicture(.int ammotype); #ifdef CSQC - .float GetAmmoFieldFromNum(int i); - int GetAmmoStat(.float ammotype); + .int GetAmmoFieldFromNum(int i); + int GetAmmoStat(.int ammotype); #endif +#ifdef SVQC +string W_Sound(string w_snd); +string W_Model(string w_mdl); +#endif + // ammo types - .float ammo_shells; - .float ammo_nails; - .float ammo_rockets; - .float ammo_cells; - .float ammo_supercells; - .float ammo_plasma; - .float ammo_fuel; - .float ammo_none; + .int ammo_shells; + .int ammo_nails; + .int ammo_rockets; + .int ammo_cells; ++.int ammo_supercells; + .int ammo_plasma; + .int ammo_fuel; + .int ammo_none; // other useful macros #define WEP_ACTION(wpn,wrequest) (get_weaponinfo(wpn)).weapon_func(wrequest) diff --cc qcsrc/server/miscfunctions.qc index 3ef24e208,7660b7e03..93ceb1b43 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@@ -1299,7 -1274,8 +1299,7 @@@ void SetCustomizer(entity e, float(void e.uncustomizeentityforclient_set = !!uncustomizer; } - void Net_LinkEntity(entity e, float docull, float dt, float(entity, float) sendfunc) - -void Net_LinkEntity(entity e, float docull, float dt, bool(entity, int) sendfunc) ++void Net_LinkEntity(entity e, bool docull, float dt, bool(entity, int) sendfunc) { vector mi, ma; diff --cc qcsrc/server/t_items.qc index 57842f4cd,72e3b0961..cccedc12c --- a/qcsrc/server/t_items.qc +++ b/qcsrc/server/t_items.qc @@@ -251,12 -229,12 +251,12 @@@ void ItemRead(float _IsNew #endif #ifdef SVQC - float ItemSend(entity to, int sf) + bool ItemSend(entity to, int sf) { - if(self.gravity) - sf |= ISF_DROP; - else - sf &= ~ISF_DROP; + if(self.gravity) + sf |= ISF_DROP; + else + sf &= ~ISF_DROP; WriteByte(MSG_ENTITY, ENT_CLIENT_ITEM); WriteByte(MSG_ENTITY, sf);