]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/Main.qc
Merge branch 'master' into terencehill/newpanelhud
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / Main.qc
index 3cd3cb1165de90f96fb47f2206c45de7862b27b8..9897ebf011b583d60b4c84cd92d9068580eef075 100644 (file)
@@ -46,6 +46,8 @@ 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");
@@ -57,11 +59,11 @@ void CSQC_Init(void)
        }
 #pragma target FTE
 #endif
-       
+
        check_unacceptable_compiler_bugs();
 
 #ifdef WATERMARK
-       print(sprintf(_("^4CSQC Build information: %s\n"), WATERMARK()));
+       print(sprintf(_("^4CSQC Build information: ^1%s\n"), WATERMARK()));
 #endif
 
        float i;
@@ -134,6 +136,8 @@ void CSQC_Init(void)
        WaypointSprite_Load();
 
        // precaches
+       precache_sound("misc/hit.wav");
+       precache_sound("misc/typehit.wav");
        Projectile_Precache();
        Hook_Precache();
        GibSplash_Precache();
@@ -147,6 +151,9 @@ void CSQC_Init(void)
        }
        Tuba_Precache();
 
+       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;
@@ -198,6 +205,10 @@ void CSQC_Shutdown(void)
        if(camera_active)
                cvar_set("chase_active",ftos(chase_active_backup));
 
+       // unset the event chasecam's chase_active
+       if(autocvar_chase_active < 0)
+               cvar_set("chase_active", "0");
+
        if not(isdemo())
        {
                if not(calledhooks & HOOK_START)
@@ -828,6 +839,15 @@ void Ent_ClientData()
                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;
 }
 
@@ -900,6 +920,37 @@ void Ent_ReadAccuracy(void)
        }
 }
 
+void Ent_ShowNames()
+{
+    float sf;
+
+    // entity init, TODO can this be done only once somehow?
+    self.the_entnum = ReadByte(); // TODO: fixme to only send once somehow
+    self.draw2d = Draw_ShowNames;
+    //self.movetype = MOVETYPE_FLY; // movetype needed so we can traceline?
+    self.mins = '-20 -20 -24';
+    self.maxs = '20 20 45';
+
+    sf = ReadByte();
+
+    if(sf & 1)
+    {
+        self.origin_x = ReadShort();
+        self.origin_y = ReadShort();
+        self.origin_z = ReadShort();
+    }
+    if(sf & 2)
+    {
+        self.healthvalue = ReadByte();
+        self.armorvalue = ReadByte();
+    }
+
+    if(sf & 128) // same team
+        self.sameteam = TRUE;
+    else
+        self.sameteam = FALSE;
+}
+
 // 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();
@@ -959,11 +1010,13 @@ void(float bIsNewEntity) CSQC_Ent_Update =
                case ENT_CLIENT_TUBANOTE: Ent_TubaNote(bIsNewEntity); break;
                case ENT_CLIENT_WARPZONE: WarpZone_Read(bIsNewEntity); break;
                case ENT_CLIENT_WARPZONE_CAMERA: WarpZone_Camera_Read(bIsNewEntity); break;
+               case ENT_CLIENT_WARPZONE_TELEPORTED: WarpZone_Teleported_Read(bIsNewEntity); break;
                case ENT_CLIENT_TRIGGER_MUSIC: Ent_ReadTriggerMusic(); break;
                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;
+               case ENT_CLIENT_SHOWNAMES: Ent_ShowNames(); break;
                default:
                        error(strcat(_("unknown entity type in CSQC_Ent_Update: %d\n"), self.enttype));
                        break;
@@ -1085,7 +1138,7 @@ void Ent_Init()
 
        serverflags = ReadByte();
 
-       cr_maxbullets = ReadByte();
+       minelayer_maxmines = ReadByte();
 
        g_trueaim_minrange = ReadCoord();