]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/Main.qc
Fade out tags of dead players, split health/armor values into two separate sendflags...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / Main.qc
index 87b3997e65f1b0e69f2ea1bf6180c8a627da3b15..ddace6382ac4a0db186730d120af9303fcfde33d 100644 (file)
@@ -63,7 +63,7 @@ void CSQC_Init(void)
        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;
@@ -205,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)
@@ -835,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;
 }
 
@@ -907,56 +920,39 @@ void Ent_ReadAccuracy(void)
        }
 }
 
-.float health, armorvalue;
 void Ent_ShowNames()
 {
-    float sf, the_entnum;
+    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';
+    self.classname = "shownames_tag";
 
     sf = ReadByte();
-    the_entnum = ReadByte();
-    print("sendflags: ", ftos(sf), "\n");
 
     if(sf & 1)
     {
-        playerslots[the_entnum].origin_x = ReadShort();
-        playerslots[the_entnum].origin_y = ReadShort();
-        playerslots[the_entnum].origin_z = ReadShort();
-        print("Updated origin = ", vtos(playerslots[the_entnum].origin), " for player ", GetPlayerName(the_entnum-1), "\n");
-        print("Their health/armor = ", playerslots[the_entnum].health, "/", playerslots[the_entnum].armorvalue, "\n");
+        self.origin_x = ReadShort();
+        self.origin_y = ReadShort();
+        self.origin_z = ReadShort();
     }
     if(sf & 2)
     {
-        playerslots[the_entnum].health = ReadByte();
-        playerslots[the_entnum].armorvalue = ReadByte();
+        self.healthvalue = ReadByte();
     }
-
-    /*
-    string thename;
-    float thehealth, thearmor;
-
-    if(shownames_netname)
-        strunzone(shownames_netname);
-    thename = strzone(ReadString());
-    thehealth = ReadByte();
-    thearmor = ReadByte();
-
-    if(autocvar_hud_panel_shownames == 1 && thehealth > 0) // teammates only
+    if(sf & 4)
     {
-        shownames_netname = thename;
-        shownames_health = thehealth;
-        shownames_armor = thearmor;
-
-        shownames_time = time + autocvar_hud_panel_shownames_sustain;
+        self.armorvalue = ReadByte();
     }
-    else if(autocvar_hud_panel_shownames == 2)
-    {
-        shownames_netname = thename;
-        shownames_health = thehealth;
-        shownames_armor = thearmor;
 
-        shownames_time = time + autocvar_hud_panel_shownames_sustain;
-    }
-    */
+    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.
@@ -1018,6 +1014,7 @@ 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;