X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2FMain.qc;h=40bed8d103ec56ad07561bed2a814286475bec1a;hb=026b1e9f8a6d485705aaf949b7e16c08f50ba28f;hp=dc1f5bb518d757046dbc355d00182c290f0766fa;hpb=68c78ae5b446ef95a908d345f054be33e2cada96;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index dc1f5bb51..40bed8d10 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -148,23 +148,6 @@ void CSQC_Init(void) } Tuba_Precache(); -#ifdef UID - { - // find the user ID - string uid; - registercvar("_cl_userid", "", CVAR_SAVE); - uid = cvar_string("_cl_userid"); - if(strlen(uid) < 16) - { - uid = ""; - for(i = 0; i < 4; ++i) - uid = strcat(uid, substring(ftos(floor(10000 + random() * 10000)), 1, -1)); - } - cvar_set("_cl_userid", uid); - localcmd(strcat("\ncmd uid ", uid, "\n")); - } -#endif - get_mi_min_max_texcoords(1); // try the CLEVER way first minimapname = strcat("gfx/", mi_shortname, "_radar.tga"); shortmapname = mi_shortname; @@ -203,7 +186,10 @@ void CSQC_Shutdown(void) remove(players); db_close(binddb); db_close(tempdb); - db_save(ClientProgsDB, "client.db"); + if(cvar("cl_db_saveasdump")) + db_dump(ClientProgsDB, "client.db"); + else + db_save(ClientProgsDB, "client.db"); db_close(ClientProgsDB); cvar_clientsettemp_restore(); @@ -457,7 +443,9 @@ void ShotOrg_Draw() self.angles = view_angles; self.angles_x = -self.angles_x; if not(self.cnt) - R_AddEntity(self); + self.drawmask = MASK_NORMAL; + else + self.drawmask = 0; } void ShotOrg_Draw2D() { @@ -504,11 +492,12 @@ void DrawDebugModel() if(time - floor(time) > 0.5) { PolyDrawModel(self); + self.drawmask = 0; } else { self.renderflags = 0; - R_AddEntity(self); + self.drawmask = MASK_NORMAL; } } @@ -638,6 +627,56 @@ float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary) local float bSkipKey; bSkipKey = false; + if(autocvar_cl_allow_uid2name == -1 && (gametype == GAME_CTS || gametype == GAME_RACE) && panel_fg_alpha && !scoreboard_active) // don't lock keys before we actually see what's going on + { + /* + string vyes_keys; + float keys; + vyes_keys = findkeysforcommand("vyes"); + keys = tokenize(vyes_keys); + + float i; + for (i = 0; i < keys; ++i) + { + print(ftos(nPrimary), " ", argv(i), "\n"); + if(nPrimary == stof(argv(i))) + { + vote_active = 0; + cvar_set("cl_allow_uid2name", "1"); + return TRUE; + } + } + + string vno_keys; + vno_keys = findkeysforcommand("vno"); + keys = tokenize(vno_keys); + + float i; + for (i = 0; i < keys; ++i) + { + if(nPrimary == stof(argv(i))) + { + vote_active = 0; + cvar_set("cl_allow_uid2name", "0"); + return TRUE; + } + } + */ // If only I could grab F1-F12 in CSQC... but no + + if(nPrimary == 121) // ascii value for y + { + vote_active = 0; + cvar_set("cl_allow_uid2name", "1"); + return TRUE; + } + else if(nPrimary == 110) // ascii value for n + { + vote_active = 0; + cvar_set("cl_allow_uid2name", "0"); + return TRUE; + } + } + if (HUD_Panel_InputEvent(bInputType, nPrimary, nSecondary)) return true; @@ -647,6 +686,7 @@ float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary) if(menu_visible) if(menu_action(bInputType, nPrimary, nSecondary)) return TRUE; + return bSkipKey; } @@ -808,11 +848,6 @@ void Ent_ClientData() if(newspectatee_status != spectatee_status) { float i; - // clear the weapon accuracy stats - for(i = WEP_FIRST; i <= WEP_LAST; ++i) { - weapon_hits[i] = 0; - weapon_fired[i] = 0; - } // clear race stuff race_laptime = 0; @@ -864,6 +899,30 @@ void Ent_RandomSeed() psrandom(s); } +void Ent_ReadAccuracy(void) +{ + float sf, f, w, b; + sf = ReadInt24_t(); + if(sf == 0) + { + for(w = 0; w <= WEP_LAST - WEP_FIRST; ++w) + weapon_accuracy[w] = -1; + return; + } + + for(w = 0, f = 1; w <= WEP_LAST - WEP_FIRST; ++w, f *= 2) + { + if(sf & f) + { + b = ReadByte(); + if(b == 0) + weapon_accuracy[w] = -1; + else + weapon_accuracy[w] = (b - 1.0) / 254.0; + } + } +} + // CSQC_Ent_Update : Called every frame that the server has indicated an update to the SSQC / CSQC entity has occured. // The only parameter reflects if the entity is "new" to the client, meaning it just came into the client's PVS. void Ent_RadarLink(); @@ -927,6 +986,7 @@ void(float bIsNewEntity) CSQC_Ent_Update = case ENT_CLIENT_HOOK: Ent_ReadHook(bIsNewEntity, ENT_CLIENT_HOOK); break; 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; default: error(strcat("unknown entity type in CSQC_Ent_Update: ", ftos(self.enttype), "\n")); break; @@ -1047,8 +1107,15 @@ void Ent_Init() g_weaponswitchdelay = ReadByte() / 255.0; - g_balance_grenadelauncher_secondary_bouncefactor = ReadCoord(); - g_balance_grenadelauncher_secondary_bouncestop = ReadCoord(); + g_balance_grenadelauncher_bouncefactor = ReadCoord(); + g_balance_grenadelauncher_bouncestop = ReadCoord(); + g_balance_electro_secondary_bouncefactor = ReadCoord(); + g_balance_electro_secondary_bouncestop = ReadCoord(); + + nex_scope = !ReadByte(); + campingrifle_scope = !ReadByte(); + + serverflags = ReadByte(); if(!postinit) PostInit(); @@ -1275,10 +1342,7 @@ void Net_WeaponComplain() { complain_weapon_type = ReadByte(); complain_weapon_time = time; -} - -void Net_CampingrifleScope() { - campingrifle_scope = TRUE; + weapontime = time; // ping the weapon panel } // CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer. @@ -1351,8 +1415,8 @@ float CSQC_Parse_TempEntity() Net_WeaponComplain(); bHandled = true; break; - case TE_CSQC_CAMPINGRIFLE_SCOPE: - Net_CampingrifleScope(); + case TE_CSQC_CR_MAXBULLETS: + cr_maxbullets = ReadByte(); bHandled = true; break; default: