cvar_set(e.netname, e.message);
}
-void() menu_show_error =
+void menu_show_error()
{
drawstring('0 200 0', _("ERROR - MENU IS VISIBLE BUT NO MENU WAS DEFINED!"), '8 8 0', '1 0 0', 1, 0);
-};
+}
// CSQC_Init : Called every time the CSQC code is initialized (essentially at map load)
// Useful for precaching things
-void() menu_sub_null =
+void menu_sub_null()
{
-};
+}
#ifdef USE_FTE
float __engine_check;
#endif
+void precache_playermodel(string m)
+{
+ string f;
+
+ if(substring(m, -9,5) == "_lod1")
+ return;
+ if(substring(m, -9,5) == "_lod2")
+ return;
+ precache_model(m);
+ f = strcat(substring(m, 0, -5), "_lod1", substring(m, -4, -1));
+ if(fexists(f))
+ precache_model(f);
+ f = strcat(substring(m, 0, -5), "_lod2", substring(m, -4, -1));
+ if(fexists(f))
+ precache_model(f);
+
+ /*
+ float globhandle, i, n;
+ globhandle = search_begin(strcat(m, "_*.sounds"), TRUE, FALSE);
+ if (globhandle < 0)
+ return;
+ n = search_getsize(globhandle);
+ for (i = 0; i < n; ++i)
+ {
+ //print(search_getfilename(globhandle, i), "\n");
+ f = search_getfilename(globhandle, i);
+ PrecachePlayerSounds(f);
+ }
+ search_end(globhandle);
+ */
+}
+void precache_all_playermodels(string pattern)
+{
+ float globhandle, i, n;
+ string f;
+
+ globhandle = search_begin(pattern, TRUE, FALSE);
+ if (globhandle < 0)
+ return;
+ n = search_getsize(globhandle);
+ for (i = 0; i < n; ++i)
+ {
+ //print(search_getfilename(globhandle, i), "\n");
+ f = search_getfilename(globhandle, i);
+ precache_playermodel(f);
+ }
+ search_end(globhandle);
+}
+
string forcefog;
-string cl_announcer_prev;
void WaypointSprite_Load();
void CSQC_Init(void)
{
prvm_language = cvar_string("prvm_language");
-
+
#ifdef USE_FTE
#pragma target ID
__engine_check = checkextension("DP_SV_WRITEPICTURE");
menu_action = menu_sub_null;
for(i = 0; i < 255; ++i)
- if(getplayerkey(i, "viewentity") == "")
+ if(getplayerkeyvalue(i, "viewentity") == "")
break;
maxclients = i;
- //ctf_temp_1 = "";
- // localcmd("alias order \"cmd order $*\""); enable if ctf-command thingy is used
- //registercmd("ctf_menu");
- registercmd("ons_map");
- registercmd("hud_configure");
- registercmd("hud_save");
- //registercmd("menu_action");
+ registercommand("hud_configure");
+ registercommand("hud_save");
+ //registercommand("menu_action");
- registercmd("+showscores");registercmd("-showscores");
- registercmd("+showaccuracy");registercmd("-showaccuracy");
+ registercommand("+showscores");registercommand("-showscores");
+ registercommand("+showaccuracy");registercommand("-showaccuracy");
#ifndef CAMERATEST
if(isdemo())
{
#endif
- registercmd("+forward");registercmd("-forward");
- registercmd("+back");registercmd("-back");
- registercmd("+moveup");registercmd("-moveup");
- registercmd("+movedown");registercmd("-movedown");
- registercmd("+moveright");registercmd("-moveright");
- registercmd("+moveleft");registercmd("-moveleft");
- registercmd("+roll_right");registercmd("-roll_right");
- registercmd("+roll_left");registercmd("-roll_left");
+ registercommand("+forward");registercommand("-forward");
+ registercommand("+back");registercommand("-back");
+ registercommand("+moveup");registercommand("-moveup");
+ registercommand("+movedown");registercommand("-movedown");
+ registercommand("+moveright");registercommand("-moveright");
+ registercommand("+moveleft");registercommand("-moveleft");
+ registercommand("+roll_right");registercommand("-roll_right");
+ registercommand("+roll_left");registercommand("-roll_left");
#ifndef CAMERATEST
}
#endif
registercvar("hud_usecsqc", "1");
- registercvar("scoreboard_columns", "default", CVAR_SAVE);
+ registercvar("scoreboard_columns", "default");
gametype = 0;
WaypointSprite_Load();
// precaches
+ precache_model("null");
precache_sound("misc/hit.wav");
precache_sound("misc/typehit.wav");
+ if (autocvar_cl_precacheplayermodels)
+ {
+ precache_all_playermodels("models/player/*.zym");
+ precache_all_playermodels("models/player/*.dpm");
+ precache_all_playermodels("models/player/*.md3");
+ precache_all_playermodels("models/player/*.psk");
+ precache_all_playermodels("models/player/*.iqm");
+ }
+
Projectile_Precache();
Hook_Precache();
GibSplash_Precache();
Casings_Precache();
DamageInfo_Precache();
- if(autocvar_cl_announcer != cl_announcer_prev) {
- Announcer_Precache();
- if(cl_announcer_prev)
- strunzone(cl_announcer_prev);
- cl_announcer_prev = strzone(autocvar_cl_announcer);
- }
+ Vehicles_Precache();
+ turrets_precache();
+ Announcer_Precache();
Tuba_Precache();
-
- if(autocvar_cl_reticle_item_normal) precache_pic("gfx/reticle_normal");
- if(autocvar_cl_reticle_item_nex) precache_pic("gfx/reticle_nex");
-
+
+ if(autocvar_cl_reticle)
+ {
+ if(autocvar_cl_reticle_item_normal) { precache_pic("gfx/reticle_normal"); }
+ if(autocvar_cl_reticle_item_nex) { precache_pic("gfx/reticle_nex"); }
+ }
+
get_mi_min_max_texcoords(1); // try the CLEVER way first
minimapname = strcat("gfx/", mi_shortname, "_radar.tga");
shortmapname = mi_shortname;
minimapname = strzone(minimapname);
WarpZone_Init();
+
hud_configure_prev = -1;
+ tab_panel = -1;
}
// CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc)
case COLOR_TEAM4:
break;
default:
- if(GetTeam(Team, false) == NULL)
+ if(GetTeam(Team, false) == world)
{
print(sprintf(_("trying to switch to unsupported team %d\n"), Team));
Team = COLOR_SPECTATOR;
case 0:
break;
default:
- if(GetTeam(Team, false) == NULL)
+ if(GetTeam(Team, false) == world)
{
print(sprintf(_("trying to switch to unsupported team %d\n"), Team));
Team = COLOR_SPECTATOR;
postinit = true;
}
-// CSQC_ConsoleCommand : Used to parse commands in the console that have been registered with the "registercmd" function
+// CSQC_ConsoleCommand : Used to parse commands in the console that have been registered with the "registercommand" function
// Return value should be 1 if CSQC handled the command, otherwise return 0 to have the engine handle it.
float button_zoom;
void Cmd_HUD_SetFields(float);
{
float argc;
// Tokenize String
- //argc = tokenize(strMessage);
argc = tokenize_console(strMessage);
// Acquire Command
- local string strCmd;
+ string strCmd;
strCmd = argv(0);
if(strCmd == "hud_configure") { // config hud
if(cmd == "mv_download") {
Cmd_MapVote_MapDownload(argc);
}
+ else if(cmd == "hud_panel_radar_maximized")
+ {
+ if(argc == 1)
+ hud_panel_radar_maximized = !hud_panel_radar_maximized;
+ else
+ hud_panel_radar_maximized = (stof(argv(1)) != 0);
+ }
else if(cmd == "settemp") {
cvar_clientsettemp(argv(1), argv(2));
}
{
vote_active = 0; // force the panel to disappear right as we have selected the value (to prevent it from fading out in the normal vote panel pos)
vote_prev = 0;
- cvar_set("cl_allow_uid2name", "1");
+ localcmd("setreport cl_allow_uid2name 1\n");
vote_change = -9999;
+ uid2name_dialog = 0;
}
else
{
{
vote_active = 0;
vote_prev = 0;
- cvar_set("cl_allow_uid2name", "0");
+ localcmd("setreport cl_allow_uid2name 0\n");
vote_change = -9999;
+ uid2name_dialog = 0;
}
else
{
// In the case of mouse input, nPrimary is xdelta, nSecondary is ydelta.
float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
{
- local float bSkipKey;
+ float bSkipKey;
bSkipKey = false;
if (HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary))
// --------------------------------------------------------------------------
// BEGIN OPTIONAL CSQC FUNCTIONS
+void Ent_RemoveEntCS()
+{
+ entcs_receiver[self.sv_entnum] = world;
+}
void Ent_ReadEntCS()
{
+ float sf;
InterpolateOrigin_Undo();
self.classname = "entcs_receiver";
- self.sv_entnum = ReadByte() - 1;
- self.origin_x = ReadShort();
- self.origin_y = ReadShort();
- self.origin_z = ReadShort();
- self.angles_y = ReadByte() * 360.0 / 256;
- self.origin_z = self.angles_x = self.angles_z = 0;
+ sf = ReadByte();
+
+ if(sf & 1)
+ self.sv_entnum = ReadByte();
+ if(sf & 2)
+ {
+ self.origin_x = ReadShort();
+ self.origin_y = ReadShort();
+ self.origin_z = ReadShort();
+ }
+ if(sf & 4)
+ {
+ self.angles_y = ReadByte() * 360.0 / 256;
+ self.angles_x = self.angles_z = 0;
+ }
+ if(sf & 8)
+ self.healthvalue = ReadByte() * 10;
+ if(sf & 16)
+ self.armorvalue = ReadByte() * 10;
+
+ entcs_receiver[self.sv_entnum] = self;
+ self.entremove = Ent_RemoveEntCS;
InterpolateOrigin_Note();
}
#ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED
if(!isNew && n != self.sv_entnum)
{
- print(_("A CSQC entity changed its owner!\n"));
+ //print(_("A CSQC entity changed its owner!\n"));
+ print(sprintf(_("A CSQC entity changed its owner! (edict: %d, classname: %s)\n"), num_for_edict(self), self.classname));
isNew = true;
Ent_Remove();
self.enttype = ENT_CLIENT_SCORES;
HUD_UpdateTeamPos(o);
}
-void Net_Reset()
-{
-}
-
void Ent_ClientData()
{
float f;
if(newspectatee_status != spectatee_status)
{
- float i;
-
// clear race stuff
race_laptime = 0;
race_checkpointtime = 0;
}
+ if (autocvar_hud_panel_healtharmor_progressbar_gfx)
+ {
+ if ( (spectatee_status == -1 && newspectatee_status > 0) //before observing, now spectating
+ || (spectatee_status > 0 && newspectatee_status > 0 && spectatee_status != newspectatee_status) //changed spectated player
+ )
+ prev_p_health = -1;
+ else if(spectatee_status && !newspectatee_status) //before observing/spectating, now playing
+ prev_health = -1;
+ }
spectatee_status = newspectatee_status;
}
{
float nags, i, j, b, f;
- nags = ReadByte();
+ nags = ReadByte(); // NAGS NAGS NAGS NAGS NAGS NAGS NADZ NAGS NAGS NAGS
+
+ if(!(nags & 4))
+ {
+ if(vote_called_vote)
+ strunzone(vote_called_vote);
+ vote_called_vote = string_null;
+ vote_active = 0;
+ }
+ else
+ {
+ vote_active = 1;
+ }
+
+ if(nags & 64)
+ {
+ vote_yescount = ReadByte();
+ vote_nocount = ReadByte();
+ vote_needed = ReadByte();
+ vote_highlighted = ReadChar();
+ }
if(nags & 128)
{
weapon_accuracy[w] = -1;
return;
}
-
+
for(w = 0, f = 1; w <= WEP_LAST - WEP_FIRST; ++w, f *= 2)
{
if(sf & f)
void Ent_RadarLink();
void Ent_Init();
void Ent_ScoresInfo();
-void(float bIsNewEntity) CSQC_Ent_Update =
+void CSQC_Ent_Update(float bIsNewEntity)
{
float t;
float savetime;
#ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED
if(self.enttype)
- if(t != self.enttype)
+ {
+ if(t != self.enttype || bIsNewEntity)
{
- print(_("A CSQC entity changed its type!\n"));
+ //print(_("A CSQC entity changed its type!\n"));
+ print(sprintf(_("A CSQC entity changed its type! (edict: %d, server: %d, type: %d -> %d)\n"), num_for_edict(self), self.entnum, self.enttype, t));
Ent_Remove();
bIsNewEntity = 1;
}
+ }
+ else
+ {
+ if(!bIsNewEntity)
+ {
+ print(sprintf(_("A CSQC entity appeared out of nowhere! (edict: %d, server: %d, type: %d)\n"), num_for_edict(self), self.entnum, t));
+ bIsNewEntity = 1;
+ }
+ }
#endif
self.enttype = t;
switch(t)
case ENT_CLIENT_LGBEAM: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_LGBEAM); break;
case ENT_CLIENT_GAUNTLET: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_GAUNTLET); break;
case ENT_CLIENT_ACCURACY: Ent_ReadAccuracy(); break;
+ case ENT_CLIENT_AUXILIARYXHAIR: Net_AuXair2(bIsNewEntity); break;
+ case ENT_CLIENT_TURRET: ent_turret(); break;
+ case ENT_CLIENT_MODEL: CSQCModel_Read(); break;
default:
- error(strcat(_("unknown entity type in CSQC_Ent_Update: %d\n"), self.enttype));
+ //error(strcat(_("unknown entity type in CSQC_Ent_Update: %d\n"), self.enttype));
+ error(sprintf(_("Unknown entity type in CSQC_Ent_Update (enttype: %d, edict: %d, classname: %s)\n"), self.enttype, num_for_edict(self), self.classname));
break;
}
time = savetime;
-};
+}
// Destructor, but does NOT deallocate the entity by calling remove(). Also
// used when an entity changes its type. For an entity that someone interacts
// with others, make sure it can no longer do so.
void Gamemode_Init()
{
- if(gametype == GAME_ONSLAUGHT) {
- print(strcat("Using ", minimapname, " as minimap.\n"));
- precache_pic("gfx/ons-cp-neutral.tga");
- precache_pic("gfx/ons-cp-red.tga");
- precache_pic("gfx/ons-cp-blue.tga");
- precache_pic("gfx/ons-frame.tga");
- precache_pic("gfx/ons-frame-team.tga");
- }
-
if not(isdemo())
{
localcmd("\n_cl_hook_gamestart ", GametypeNameFromType(gametype), "\n");
print(ColorTranslateRGB(strMessage));
}
-// CSQC_Parse_CenterPrint : Provides the centerprint string in the first parameter that the server provided.
+// CSQC_Parse_CenterPrint : Provides the centerprint_hud string in the first parameter that the server provided.
void CSQC_Parse_CenterPrint(string strMessage)
{
- centerprint(strMessage);
+ centerprint_hud(strMessage);
}
string notranslate_fogcmd1 = "\nfog ";
g_balance_electro_secondary_bouncestop = ReadCoord();
nex_scope = !ReadByte();
- sniperrifle_scope = !ReadByte();
+ rifle_scope = !ReadByte();
serverflags = ReadByte();
minelayer_maxmines = ReadByte();
+ hagar_maxrockets = ReadByte();
+
g_trueaim_minrange = ReadCoord();
if(!postinit)
playerslots[e].ping_movementloss = ml / 255.0;
}
-void Net_VoteDialog(float highlight) {
- if(highlight) {
- vote_highlighted = ReadByte();
- return;
- }
-
- vote_yescount = ReadByte();
- vote_nocount = ReadByte();
- vote_needed = ReadByte();
- vote_active = 1;
-}
-
-void Net_VoteDialogReset() {
- vote_active = 0;
-}
-
-void Net_Notify() {
- float type;
- type = ReadByte();
-
- if(type == CSQC_KILLNOTIFY)
- {
- HUD_KillNotify(ReadString(), ReadString(), ReadString(), ReadShort(), ReadByte());
- }
- else if(type == CSQC_CENTERPRINT)
- {
- HUD_Centerprint(ReadString(), ReadString(), ReadShort(), ReadByte());
- }
-}
-
void Net_WeaponComplain() {
complain_weapon = ReadByte();
// Return value should be 1 if CSQC handled the temporary entity, otherwise return 0 to have the engine process the event.
float CSQC_Parse_TempEntity()
{
- local float bHandled;
+ float bHandled;
bHandled = true;
// Acquire TE ID
- local float nTEID;
+ float nTEID;
nTEID = ReadByte();
// NOTE: Could just do return instead of break...
Net_TeamNagger();
bHandled = true;
break;
- case TE_CSQC_VOTE:
- Net_VoteDialog(ReadByte());
- bHandled = true;
- break;
- case TE_CSQC_VOTERESET:
- Net_VoteDialogReset();
- bHandled = true;
- break;
case TE_CSQC_LIGHTNINGARC:
Net_ReadLightningarc();
bHandled = true;
bHandled = true;
break;
case TE_CSQC_ANNOUNCE:
- announce_snd = strzone(ReadString());
+ Announcer_Play(ReadString());
+ bHandled = true;
+ break;
+ case TE_CSQC_KILLNOTIFY:
+ HUD_KillNotify(ReadString(), ReadString(), ReadString(), ReadShort(), ReadByte());
+ bHandled = true;
+ break;
+ case TE_CSQC_KILLCENTERPRINT:
+ HUD_KillCenterprint(ReadString(), ReadString(), ReadShort(), ReadByte());
bHandled = true;
break;
- case TE_CSQC_NOTIFY:
- Net_Notify();
+ case TE_CSQC_CENTERPRINT_GENERIC:
+ float id;
+ string s;
+ id = ReadByte();
+ s = ReadString();
+ if (id != 0 && s != "")
+ centerprint_generic(id, s, ReadByte(), ReadByte());
+ else
+ centerprint_generic(id, s, 0, 0);
bHandled = true;
break;
case TE_CSQC_WEAPONCOMPLAIN:
Net_WeaponComplain();
bHandled = true;
break;
+ case TE_CSQC_VEHICLESETUP:
+ Net_VehicleSetup();
+ bHandled = true;
+ break;
default:
// No special logic for this temporary entity; return 0 so the engine can handle it
bHandled = false;
string keys;
float n, j, k, l;
- if (!hud_showbinds)
+ if (!autocvar_hud_showbinds)
return text;
keys = db_get(binddb, command);
if (!keys)
{
- n = tokenize(findkeysforcommand(command)); // uses '...' strings
+ n = tokenize(findkeysforcommand(command, 0)); // uses '...' strings
for(j = 0; j < n; ++j)
{
k = stof(argv(j));
keys = strcat(keys, ", ", keynumtostring(k));
++l;
- if (hud_showbinds_limit > 0 && hud_showbinds_limit >= l) break;
+ if (autocvar_hud_showbinds_limit > 0 && autocvar_hud_showbinds_limit >= l) break;
}
}
}
if ("" == keys) {
- if (hud_showbinds > 1)
+ if (autocvar_hud_showbinds > 1)
return sprintf(_("%s (not bound)"), text);
else
return text;
}
- else if (hud_showbinds > 1)
+ else if (autocvar_hud_showbinds > 1)
return sprintf(_("%s (%s)"), text, keys);
else
return keys;