X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;ds=sidebyside;f=qcsrc%2Fclient%2Fmain.qc;h=ce70cef5ad5016ffa83790c677c86745934d6151;hb=2c32015574cc6afc12cc8ac9fb620edf3caf6d2b;hp=37027d25cd35570419c819179b207311580f157e;hpb=bc50c2d7ca3e0a44ed1712400ef8e170e6df8210;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 37027d25c..ce70cef5a 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -8,13 +8,14 @@ #include #include #include "hud/_mod.qh" +#include "commands/cl_cmd.qh" #include "mapvoting.qh" -#include "mutators/events.qh" +#include #include "hud/panel/scoreboard.qh" #include "hud/panel/quickmenu.qh" #include "shownames.qh" +#include "view.qh" #include -#include "wall.qh" #include "weapons/projectile.qh" #include #include @@ -24,7 +25,7 @@ #include #include #include -#include +#include #include #include #include @@ -91,7 +92,6 @@ void LoadMenuSkinValues() // CSQC_Init : Called every time the CSQC code is initialized (essentially at map load) // Useful for precaching things -void ConsoleCommand_macro_init(); void CSQC_Init() { prvm_language = strzone(cvar_string("prvm_language")); @@ -343,7 +343,6 @@ void Playerchecker_Think(entity this) this.nextthink = time + 0.2; } -void TrueAim_Init(); void PostInit() { entity playerchecker = new_pure(playerchecker); @@ -365,19 +364,18 @@ void PostInit() float CSQC_InputEvent(int bInputType, float nPrimary, float nSecondary) { TC(int, bInputType); - if (HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary)) - return true; + bool override = false; + override |= HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary); - if (QuickMenu_InputEvent(bInputType, nPrimary, nSecondary)) - return true; + override |= QuickMenu_InputEvent(bInputType, nPrimary, nSecondary); - if (HUD_Radar_InputEvent(bInputType, nPrimary, nSecondary)) - return true; + override |= HUD_Radar_InputEvent(bInputType, nPrimary, nSecondary); - if (MapVote_InputEvent(bInputType, nPrimary, nSecondary)) - return true; + override |= MapVote_InputEvent(bInputType, nPrimary, nSecondary); + + override |= HUD_Minigame_InputEvent(bInputType, nPrimary, nSecondary); - if (HUD_Minigame_InputEvent(bInputType, nPrimary, nSecondary)) + if(override) return true; return false; @@ -389,8 +387,6 @@ float CSQC_InputEvent(int bInputType, float nPrimary, float nSecondary) // -------------------------------------------------------------------------- // BEGIN OPTIONAL CSQC FUNCTIONS -void Ent_Remove(entity this); - void Ent_RemovePlayerScore(entity this) { if(this.owner) { @@ -947,7 +943,6 @@ void Fog_Force() localcmd(sprintf("\nfog %s\nr_fog_exp2 0\nr_drawfog 1\n", forcefog)); } -void Gamemode_Init(); NET_HANDLE(ENT_CLIENT_SCORES_INFO, bool isnew) { make_pure(this); @@ -1144,6 +1139,9 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew) strcpy(race_speedaward_alltimebest_holder, ReadString()); strcpy(race_speedaward_alltimebest_unit, GetSpeedUnit(autocvar_hud_panel_physics_speed_unit)); break; + case RACE_NET_RANKINGS_CNT: + RANKINGS_DISPLAY_CNT = ReadByte(); + break; case RACE_NET_SERVER_RANKINGS: float prevpos, del; int pos = ReadShort(); @@ -1153,13 +1151,14 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew) // move other rankings out of the way int i; if (prevpos) { - for (i=prevpos-1;i>pos-1;--i) { + int m = min(prevpos, RANKINGS_DISPLAY_CNT); + for (i=m-1; i>pos-1; --i) { grecordtime[i] = grecordtime[i-1]; strcpy(grecordholder[i], grecordholder[i-1]); } } else if (del) { // a record has been deleted by the admin - for (i=pos-1; i<= RANKINGS_CNT-1; ++i) { - if (i == RANKINGS_CNT-1) { // clear out last record + for (i=pos-1; i<= RANKINGS_DISPLAY_CNT-1; ++i) { + if (i == RANKINGS_DISPLAY_CNT-1) { // clear out last record grecordtime[i] = 0; strfree(grecordholder[i]); } @@ -1169,12 +1168,18 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew) } } } else { // player has no ranked record yet - for (i=RANKINGS_CNT-1;i>pos-1;--i) { + for (i=RANKINGS_DISPLAY_CNT-1;i>pos-1;--i) { grecordtime[i] = grecordtime[i-1]; strcpy(grecordholder[i], grecordholder[i-1]); } } + if (grecordtime[RANKINGS_DISPLAY_CNT]) { + // kick off the player who fell from the last displayed position + grecordtime[RANKINGS_DISPLAY_CNT] = 0; + strfree(grecordholder[RANKINGS_DISPLAY_CNT]); + } + // store new ranking strcpy(grecordholder[pos-1], ReadString()); grecordtime[pos-1] = ReadInt24_t(); @@ -1210,7 +1215,8 @@ NET_HANDLE(TE_CSQC_PINGPLREPORT, bool isNew) NET_HANDLE(TE_CSQC_WEAPONCOMPLAIN, bool isNew) { - complain_weapon = ReadByte(); + int weapon_id = ReadByte(); + complain_weapon = Weapons_from(weapon_id); complain_weapon_type = ReadByte(); return = true; @@ -1219,9 +1225,9 @@ NET_HANDLE(TE_CSQC_WEAPONCOMPLAIN, bool isNew) switch(complain_weapon_type) { - case 0: Local_Notification(MSG_MULTI, ITEM_WEAPON_NOAMMO, complain_weapon); break; - case 1: Local_Notification(MSG_MULTI, ITEM_WEAPON_DONTHAVE, complain_weapon); break; - default: Local_Notification(MSG_MULTI, ITEM_WEAPON_UNAVAILABLE, complain_weapon); break; + case 0: Local_Notification(MSG_MULTI, ITEM_WEAPON_NOAMMO, weapon_id); break; + case 1: Local_Notification(MSG_MULTI, ITEM_WEAPON_DONTHAVE, weapon_id); break; + default: Local_Notification(MSG_MULTI, ITEM_WEAPON_UNAVAILABLE, weapon_id); break; } }