#include <common/effects/all.qh>
#include <common/effects/all.inc>
#include "hud/_mod.qh"
+#include "commands/cl_cmd.qh"
#include "mapvoting.qh"
-#include "mutators/events.qh"
+#include <client/mutators/_mod.qh>
#include "hud/panel/scoreboard.qh"
#include "hud/panel/quickmenu.qh"
#include "shownames.qh"
+#include "view.qh"
#include <common/t_items.qh>
-#include "wall.qh"
#include "weapons/projectile.qh"
#include <common/deathtypes/all.qh>
#include <common/items/_mod.qh>
#include <common/net_linked.qh>
#include <common/net_notice.qh>
#include <common/scores.qh>
-#include <common/triggers/include.qh>
+#include <common/mapobjects/_mod.qh>
#include <common/vehicles/all.qh>
#include <lib/csqcmodel/cl_model.qh>
#include <lib/csqcmodel/interpolate.qh>
// 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"));
registercvar("cl_spawn_near_teammate", "1");
+ registercvar("cl_weapon_switch_reload", "1");
+ registercvar("cl_weapon_switch_fallback_to_impulse", "1");
+
if(autocvar_cl_lockview)
cvar_set("cl_lockview", "0");
localcmd("\ncl_hook_shutdown\n");
+ localcmd("\n-button12\n");
+
deactivate_minigame();
HUD_MinigameMenu_Close(NULL, NULL, NULL);
}
.float has_team;
-float SetTeam(entity o, int Team)
+bool SetTeam(entity o, int Team)
{
- TC(int, Team);
+ TC(int, Team);
devassert_once(Team);
entity tm;
if(teamplay)
void Playerchecker_Think(entity this)
{
- int i;
+ int i;
entity e;
for(i = 0; i < maxclients; ++i)
{
this.nextthink = time + 0.2;
}
-void TrueAim_Init();
void PostInit()
{
entity playerchecker = new_pure(playerchecker);
// In the case of mouse input after a setcursormode(1) call, nPrimary is xpos, nSecondary is ypos.
float CSQC_InputEvent(int bInputType, float nPrimary, float nSecondary)
{
- TC(int, bInputType);
- if (HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary))
+ TC(int, bInputType);
+ bool override = false;
+ override |= HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary);
+ if (override)
return true;
- 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);
- if (HUD_Minigame_InputEvent(bInputType, nPrimary, nSecondary))
+ override |= HUD_Minigame_InputEvent(bInputType, nPrimary, nSecondary);
+
+ if(override)
return true;
return false;
// --------------------------------------------------------------------------
// BEGIN OPTIONAL CSQC FUNCTIONS
-void Ent_Remove(entity this);
-
void Ent_RemovePlayerScore(entity this)
{
if(this.owner) {
race_laptime = 0;
race_checkpointtime = 0;
hud_dynamic_shake_factor = -1;
+ spectatee_status_changed_time = time;
}
if (autocvar_hud_panel_healtharmor_progressbar_gfx)
{
{
for(j = 0; j < maxclients; ++j)
if(playerslots[j])
- playerslots[j].ready = 1;
+ playerslots[j].ready = true;
for(i = 1; i <= maxclients; i += 8)
{
f = ReadByte();
for(j = i-1, b = BIT(0); b < BIT(8); b <<= 1, ++j)
if (!(f & b))
if(playerslots[j])
- playerslots[j].ready = 0;
+ playerslots[j].ready = false;
}
}
if (sf & 1) {
for (int j = 0; j < maxclients; ++j) {
if (playerslots[j]) {
- playerslots[j].eliminated = 1;
+ playerslots[j].eliminated = true;
}
}
for (int i = 1; i <= maxclients; i += 8) {
if (f & BIT(b)) continue;
int j = i - 1 + b;
if (playerslots[j]) {
- playerslots[j].eliminated = 0;
+ playerslots[j].eliminated = false;
}
}
}
// The only parameter reflects if the entity is "new" to the client, meaning it just came into the client's PVS.
void CSQC_Ent_Update(entity this, bool isnew)
{
- this.sourceLoc = __FILE__ ":" STR(__LINE__);
+ this.sourceLoc = __FILE__":"STR(__LINE__);
int t = ReadByte();
// set up the "time" global for received entities to be correct for interpolation purposes
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);
break;
case RACE_NET_PENALTY_RACE:
- race_penaltyeventtime = time;
- race_penaltytime = ReadShort();
- //race_penaltyaccumulator += race_penaltytime;
- strcpy(race_penaltyreason, ReadString());
- break;
-
case RACE_NET_PENALTY_QUALIFYING:
race_penaltyeventtime = time;
race_penaltytime = ReadShort();
- race_penaltyaccumulator += race_penaltytime;
- strcpy(race_penaltyreason, ReadString());
+ string reason = ReadString();
+ if (reason == "missing a checkpoint")
+ reason = _("missing a checkpoint");
+ strcpy(race_penaltyreason, reason);
+ if (b == RACE_NET_PENALTY_QUALIFYING)
+ race_penaltyaccumulator += race_penaltytime;
break;
case RACE_NET_SERVER_RECORD:
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();
+ int pos = ReadShort();
prevpos = ReadShort();
del = ReadShort();
// move other rankings out of the way
- int i;
+ 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]);
}
}
}
} 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();
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;
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;
}
}
if(!joy_active && substring(key, 0, 3) == "JOY")
continue;
+ key = translate_key(key);
+
if (keys == "")
keys = key;
else