]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/Main.qc
Merge branch 'master' into terencehill/cursormode
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / Main.qc
index 7abf7208788d9256deb299ad538dcaa134480d7a..2f7eb3d62d1509a76ed4cc771a3b114635bafeba 100644 (file)
@@ -42,7 +42,6 @@ float __engine_check;
 #endif
 
 string forcefog;
-string cl_announcer_prev;
 void WaypointSprite_Load();
 void CSQC_Init(void)
 {
@@ -83,10 +82,6 @@ void CSQC_Init(void)
                        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");
@@ -141,18 +136,15 @@ void CSQC_Init(void)
        DamageInfo_Precache();
        Vehicles_Precache();
        turrets_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);
-       }
+  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;
@@ -637,9 +629,10 @@ void GameCommand(string msg)
 // CSQC_InputEvent : Used to perform actions based on any key pressed, key released and mouse on the client.
 // Return value should be 1 if CSQC handled the input, otherwise return 0 to have the input passed to the engine.
 // All keys are in ascii.
-// bInputType = 0 is key pressed, 1 is key released, 2 is mouse input.
+// bInputType = 0 is key pressed, 1 is key released, 2 and 3 are mouse input.
 // In the case of keyboard input, nPrimary is the ascii code, and nSecondary is 0.
 // In the case of mouse input, nPrimary is xdelta, nSecondary is ydelta.
+// In the case of mouse input after a setcursormode(1) call, nPrimary is xpos, nSecondary is ypos.
 float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
 {
        float bSkipKey;
@@ -964,13 +957,23 @@ void CSQC_Ent_Update(float bIsNewEntity)
 
 #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(sprintf(_("A CSQC entity changed its type! (edict: %d, classname: %s)\n"), num_for_edict(self), self.classname));
+                       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)
@@ -1383,7 +1386,7 @@ float CSQC_Parse_TempEntity()
                        bHandled = true;
                        break;
                case TE_CSQC_ANNOUNCE:
-                       announce_snd = strzone(ReadString());
+                       Announcer_Play(ReadString());
                        bHandled = true;
                        break;
                case TE_CSQC_KILLNOTIFY:
@@ -1409,10 +1412,10 @@ float CSQC_Parse_TempEntity()
                        Net_WeaponComplain();
                        bHandled = true;
                        break;
-        case TE_CSQC_VEHICLESETUP:
-            Net_VehicleSetup();
-            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;