X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2FMain.qc;h=49467ce15d5a7d0c4dc4ec3de623d5311996e880;hb=9971f28f796f51a9c05702a9d4ae382e4e4f0796;hp=79881410d8f9e0123472d6615d9df3652b604ea0;hpb=1d3adc69b6b41927e8a338d02451695128388efc;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index 79881410d..49467ce15 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -65,14 +65,13 @@ void CSQC_Init(void) #endif float i; - CSQC_CheckEngine(); binddb = db_create(); tempdb = db_create(); ClientProgsDB = db_load("client.db"); compressShortVector_init(); - drawfont = 0; + drawfont = FONT_USER+1; menu_visible = FALSE; menu_show = menu_show_error; menu_action = menu_sub_null; @@ -140,31 +139,14 @@ void CSQC_Init(void) GibSplash_Precache(); Casings_Precache(); DamageInfo_Precache(); - if(cvar_string("cl_announcer") != cl_announcer_prev) { + if(autocvar_cl_announcer != cl_announcer_prev) { Announcer_Precache(); if(cl_announcer_prev) strunzone(cl_announcer_prev); - cl_announcer_prev = strzone(cvar_string("cl_announcer")); + cl_announcer_prev = strzone(autocvar_cl_announcer); } 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; @@ -184,7 +166,9 @@ void CSQC_Init(void) 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) @@ -203,7 +187,10 @@ void CSQC_Shutdown(void) remove(players); db_close(binddb); db_close(tempdb); - db_save(ClientProgsDB, "client.db"); + if(autocvar_cl_db_saveasdump) + db_dump(ClientProgsDB, "client.db"); + else + db_save(ClientProgsDB, "client.db"); db_close(ClientProgsDB); cvar_clientsettemp_restore(); @@ -342,7 +329,7 @@ void TrueAim_Init(); void PostInit(void) { print(strcat("PostInit\n maxclients = ", ftos(maxclients), "\n")); - localcmd(strcat("\nscoreboard_columns_set ", cvar_string("scoreboard_columns"), ";\n")); + localcmd(strcat("\nscoreboard_columns_set ", autocvar_scoreboard_columns, ";\n")); entity playerchecker; playerchecker = spawn(); @@ -372,7 +359,7 @@ float CSQC_ConsoleCommand(string strMessage) strCmd = argv(0); if(strCmd == "hud_configure") { // config hud - cvar_set("_hud_configure", ftos(!cvar("_hud_configure"))); + cvar_set("_hud_configure", ftos(!autocvar__hud_configure)); return true; } else if(strCmd == "hud_save") { // save hud config if(argv(1) == "" || argv(2)) { @@ -457,7 +444,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 +493,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; } } @@ -619,6 +609,37 @@ void GameCommand(string msg) e.draw = DrawDebugModel; e.classname = "debugmodel"; } + else if(cmd == "vyes") + { + if(uid2name_dialog) + { + 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"); + vote_change = -9999; + uid2name_dialog = 0; + } + else + { + localcmd("cmd vote yes\n"); + } + } + else if(cmd == "vno") + { + if(uid2name_dialog) + { + vote_active = 0; + vote_prev = 0; + cvar_set("cl_allow_uid2name", "0"); + vote_change = -9999; + uid2name_dialog = 0; + } + else + { + localcmd("cmd vote no\n"); + } + } + else { print("Invalid command. For a list of supported commands, try cl_cmd help.\n"); @@ -647,6 +668,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 +830,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 +881,32 @@ 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 if(b == 255) + weapon_accuracy[w] = 1.0; // no better error handling yet, sorry + else + weapon_accuracy[w] = (b - 1.0) / 100.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 +970,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; @@ -958,15 +1002,6 @@ void CSQC_Ent_Remove() 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"); @@ -1047,12 +1082,18 @@ 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(); + + cr_maxbullets = ReadByte(); + if(!postinit) PostInit(); } @@ -1351,19 +1392,6 @@ float CSQC_Parse_TempEntity() Net_WeaponComplain(); bHandled = true; break; - case TE_CSQC_NEX_VELOCITY: - nex_velocitydependent = ReadByte(); - nex_minvelocity = ReadShort(); - nex_maxvelocity = ReadShort(); - nex_speed_falloff_rate = ReadByte(); - nex_charge = ReadByte(); - nex_charge_rate = ReadByte(); - bHandled = true; - break; - case TE_CSQC_CR_MAXBULLETS: - cr_maxbullets = ReadByte(); - bHandled = true; - break; default: // No special logic for this temporary entity; return 0 so the engine can handle it bHandled = false;