]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/main.qc
ent_cs: cleanup
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / main.qc
index d494050f060b025bb8fc6838ba16a0bf3d98096a..bb60a917d5f19a216d4f550bccdee78ca6b92b9a 100644 (file)
@@ -81,6 +81,8 @@ void menu_sub_null()
 {
 }
 
+void draw_null(entity this) { }
+
 string forcefog;
 void ConsoleCommand_macro_init();
 void CSQC_Init(void)
@@ -387,33 +389,31 @@ float CSQC_InputEvent(float bInputType, float nPrimary, float nSecondary)
 
 void Ent_RemoveEntCS()
 {SELFPARAM();
-       entcs_receiver[self.sv_entnum] = world;
+       entcs_receiver[self.sv_entnum] = NULL;
 }
 void Ent_ReadEntCS()
 {SELFPARAM();
-    int sf;
        InterpolateOrigin_Undo();
-
        self.classname = "entcs_receiver";
-       sf = ReadByte();
+       int sf = ReadByte();
 
-       if(sf & 1)
+       if(sf & BIT(0))
                self.sv_entnum = ReadByte();
-       if(sf & 2)
+       if (sf & BIT(1))
        {
                self.origin_x = ReadShort();
                self.origin_y = ReadShort();
                self.origin_z = ReadShort();
                setorigin(self, self.origin);
        }
-       if(sf & 4)
+       if (sf & BIT(2))
        {
                self.angles_y = ReadByte() * 360.0 / 256;
                self.angles_x = self.angles_z = 0;
        }
-       if(sf & 8)
+       if (sf & BIT(3))
                self.healthvalue = ReadByte() * 10;
-       if(sf & 16)
+       if (sf & BIT(4))
                self.armorvalue = ReadByte() * 10;
 
        entcs_receiver[self.sv_entnum] = self;
@@ -686,9 +686,9 @@ void Ent_ReadAccuracy(void)
        }
 }
 
-void Spawn_Draw(void)
-{SELFPARAM();
-       pointparticles(self.cnt, self.origin + '0 0 28', '0 0 2', bound(0, frametime, 0.1));
+void Spawn_Draw(entity this)
+{
+       pointparticles(this.cnt, this.origin + '0 0 28', '0 0 2', bound(0, frametime, 0.1));
 }
 
 void Ent_ReadSpawnPoint(float is_new) // entity for spawnpoint
@@ -880,7 +880,7 @@ void CSQC_Ent_Update(float bIsNewEntity)
                case ENT_CLIENT_AUXILIARYXHAIR: Net_AuXair2(bIsNewEntity); break;
                case ENT_CLIENT_TURRET: ent_turret(); break;
                case ENT_CLIENT_GENERATOR: ent_generator(); break;
-               case ENT_CLIENT_CONTROLPOINT_ICON: ent_cpicon(); break;
+               case ENT_CLIENT_CONTROLPOINT_ICON: ent_cpicon(this); break;
                case ENT_CLIENT_MODEL: CSQCModel_Read(bIsNewEntity); break;
                case ENT_CLIENT_ITEM: ItemRead(bIsNewEntity); break;
                case ENT_CLIENT_BUMBLE_RAYGUN: bumble_raygun_read(bIsNewEntity); break;
@@ -933,7 +933,7 @@ void Ent_Remove()
 
        self.enttype = 0;
        self.classname = "";
-       self.draw = menu_sub_null;
+       self.draw = draw_null;
        self.entremove = menu_sub_null;
        // TODO possibly set more stuff to defaults
 }