X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fmain.qc;h=323ebb3516147bce98cc49f0d8286c2ec85324b1;hb=7e474d576080259e21690de30778b17029b5c0f2;hp=9a6c25c35279a41dcdaccbe586a9ee5a1c2775a1;hpb=6147159b612c6950ca2177b732028d1116201220;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 9a6c25c35..323ebb351 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -1,6 +1,12 @@ #include "main.qh" -#include +#include "defs.qh" +#include +#include "miscfunctions.qh" +#include +#include +#include +#include #include "hud/_mod.qh" #include "mapvoting.qh" #include "mutators/events.qh" @@ -17,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -31,7 +38,7 @@ void draw_cursor(vector pos, vector ofs, string img, vector col, float a) { - ofs = eX * (ofs.x * SIZE_CURSOR.x) + eY * (ofs.y * SIZE_CURSOR.y); + ofs = vec2(ofs.x * SIZE_CURSOR.x, ofs.y * SIZE_CURSOR.y); drawpic(pos - ofs, strcat(draw_currentSkin, img), SIZE_CURSOR, col, a, DRAWFLAG_NORMAL); } @@ -101,11 +108,6 @@ void CSQC_Init() maxclients = i; } - // needs to be done so early because of the constants they create - static_init(); - static_init_late(); - static_init_precache(); - binddb = db_create(); tempdb = db_create(); ClientProgsDB = db_load("client.db"); @@ -209,6 +211,8 @@ void Shutdown() localcmd("\ncl_hook_gameend\n"); } + localcmd("\ncl_hook_shutdown\n"); + deactivate_minigame(); HUD_MinigameMenu_Close(NULL, NULL, NULL); } @@ -567,7 +571,7 @@ NET_HANDLE(ENT_CLIENT_NAGGER, bool isnew) { if(vote_called_vote) strunzone(vote_called_vote); - vote_called_vote = strzone(ColorTranslateRGB(ReadString())); + vote_called_vote = strzone(ReadString()); } if(nags & 1) @@ -654,6 +658,9 @@ NET_HANDLE(ENT_CLIENT_ACCURACY, bool isnew) void Spawn_Draw(entity this) { + if(this.alpha <= 0) + return; + __pointparticles(this.cnt, this.origin + '0 0 28', '0 0 2', bound(0, frametime, 0.1)); } @@ -662,7 +669,14 @@ void Spawn_PreDraw(entity this) float alph; vector org = getpropertyvec(VF_ORIGIN); if(this.fade_start) - alph = bound(0, (this.fade_end - vlen(org - this.origin - 0.5 * (this.mins + this.maxs))) / (this.fade_end - this.fade_start), 1); + { + if(vdist(org - this.origin, >, this.fade_end)) + alph = 0; // save on some processing + else if(vdist(org - this.origin, <, this.fade_start)) + alph = 1; // more processing saved + else + alph = bound(0, (this.fade_end - vlen(org - this.origin - 0.5 * (this.mins + this.maxs))) / (this.fade_end - this.fade_start), 1); + } else alph = 1; //printf("%v <-> %v\n", view_origin, this.origin + 0.5 * (this.mins + this.maxs)); @@ -774,8 +788,8 @@ NET_HANDLE(ENT_CLIENT_SPAWNEVENT, bool is_new) localcmd("-zoom\n"); button_zoom = false; } + HUD_Radar_Hide_Maximized(); } - HUD_Radar_Hide_Maximized(); //printf("Ent_ReadSpawnEvent(is_new = %d); origin = %s, entnum = %d, localentnum = %d\n", is_new, vtos(this.origin), entnum, player_localentnum); } @@ -851,7 +865,7 @@ void Ent_Remove(entity this) if(this.snd_looping > 0) { - sound(this, this.snd_looping, SND_Null, VOL_BASE, autocvar_g_jetpack_attenuation); + sound(this, this.snd_looping, SND_Null, VOL_BASE, autocvar_cl_jetpack_attenuation); this.snd_looping = 0; } @@ -973,6 +987,7 @@ NET_HANDLE(ENT_CLIENT_INIT, bool isnew) forcefog = strzone(ReadString()); armorblockpercent = ReadByte() / 255.0; + damagepush_speedfactor = ReadByte() / 255.0; serverflags = ReadByte(); @@ -1031,9 +1046,18 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew) race_checkpoint = ReadByte(); race_time = ReadInt24_t(); race_previousbesttime = ReadInt24_t(); + race_mypreviousbesttime = ReadInt24_t(); if(race_previousbestname) strunzone(race_previousbestname); - race_previousbestname = strzone(ColorTranslateRGB(ReadString())); + string pbestname = ReadString(); + if(autocvar_cl_race_cptimes_onlyself) + { + race_previousbesttime = race_mypreviousbesttime; + race_mypreviousbesttime = 0; + race_previousbestname = strzone(""); + } + else + race_previousbestname = strzone(pbestname); race_checkpointtime = time; @@ -1042,7 +1066,6 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew) race_penaltyaccumulator = 0; race_laptime = time; // valid } - break; case RACE_NET_CHECKPOINT_CLEAR: @@ -1058,9 +1081,19 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew) race_nextcheckpoint = ReadByte(); race_nextbesttime = ReadInt24_t(); + if(b != RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING) // not while spectating (matches server) + race_mybesttime = ReadInt24_t(); if(race_nextbestname) strunzone(race_nextbestname); - race_nextbestname = strzone(ColorTranslateRGB(ReadString())); + string newname = ReadString(); + if(autocvar_cl_race_cptimes_onlyself && b != RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING) + { + race_nextbesttime = race_mybesttime; + race_mybesttime = 0; + race_nextbestname = strzone(""); + } + else + race_nextbestname = strzone(newname); break; case RACE_NET_CHECKPOINT_HIT_RACE: @@ -1072,7 +1105,11 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew) race_mycheckpointlapsdelta -= 256; if(race_mycheckpointenemy) strunzone(race_mycheckpointenemy); - race_mycheckpointenemy = strzone(ColorTranslateRGB(ReadString())); + int who = ReadByte(); + if(who) + race_mycheckpointenemy = strzone(entcs_GetName(who - 1)); + else + race_mycheckpointenemy = strzone(""); // TODO: maybe string_null works fine here? break; case RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT: @@ -1084,7 +1121,11 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew) race_othercheckpointlapsdelta -= 256; if(race_othercheckpointenemy) strunzone(race_othercheckpointenemy); - race_othercheckpointenemy = strzone(ColorTranslateRGB(ReadString())); + int what = ReadByte(); + if(what) + race_othercheckpointenemy = strzone(entcs_GetName(what - 1)); + else + race_othercheckpointenemy = strzone(""); // TODO: maybe string_null works fine here? break; case RACE_NET_PENALTY_RACE: @@ -1170,7 +1211,7 @@ NET_HANDLE(TE_CSQC_RACE, bool isNew) strunzone(grecordholder[pos-1]); grecordholder[pos-1] = strzone(ReadString()); grecordtime[pos-1] = ReadInt24_t(); - if(grecordholder[pos-1] == entcs_GetName(player_localnum)) + if(strdecolorize(grecordholder[pos-1]) == strdecolorize(entcs_GetName(player_localnum))) race_myrank = pos; break; case RACE_NET_SERVER_STATUS: @@ -1230,7 +1271,7 @@ string _getcommandkey(string cmd_name, string command, bool forcename) keys = db_get(binddb, command); if (keys == "") { - bool joy_detected = cvar("joy_detected"); + bool joy_active = cvar("joy_active"); n = tokenize(findkeysforcommand(command, 0)); // uses '...' strings for(j = 0; j < n; ++j) { @@ -1238,7 +1279,7 @@ string _getcommandkey(string cmd_name, string command, bool forcename) if(k != -1) { string key = keynumtostring(k); - if(!joy_detected && substring(key, 0, 3) == "JOY") + if(!joy_active && substring(key, 0, 3) == "JOY") continue; if (keys == "")