]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/triggers/func/plat.qc
Draw: purge SELFPARAM
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / func / plat.qc
index b55669831341a96176d28d1f4229d502a6dd6f88..fc62341a85a3a09b65b158d09d6e4d2fce92cf40 100644 (file)
@@ -1,39 +1,27 @@
 #ifdef SVQC
+void plat_link();
+
 void plat_delayedinit()
 {
-       plat_spawn_inside_trigger ();   // the "start moving" trigger
+       plat_link();
+       plat_spawn_inside_trigger(); // the "start moving" trigger
 }
 
 float plat_send(entity to, float sf)
-{
+{SELFPARAM();
        WriteByte(MSG_ENTITY, ENT_CLIENT_PLAT);
        WriteByte(MSG_ENTITY, sf);
 
        if(sf & SF_TRIGGER_INIT)
        {
-               WriteShort(MSG_ENTITY, num_for_edict(self));
-               WriteString(MSG_ENTITY, self.target);
-               WriteString(MSG_ENTITY, self.target2);
-               WriteString(MSG_ENTITY, self.target3);
-               WriteString(MSG_ENTITY, self.target4);
-               WriteString(MSG_ENTITY, self.targetname);
-
                WriteByte(MSG_ENTITY, self.platmovetype_start);
                WriteByte(MSG_ENTITY, self.platmovetype_turn);
                WriteByte(MSG_ENTITY, self.platmovetype_end);
-
-               WriteCoord(MSG_ENTITY, self.origin_x);
-               WriteCoord(MSG_ENTITY, self.origin_y);
-               WriteCoord(MSG_ENTITY, self.origin_z);
+               WriteByte(MSG_ENTITY, self.spawnflags);
 
                WriteString(MSG_ENTITY, self.model);
 
-               WriteCoord(MSG_ENTITY, self.mins_x);
-               WriteCoord(MSG_ENTITY, self.mins_y);
-               WriteCoord(MSG_ENTITY, self.mins_z);
-               WriteCoord(MSG_ENTITY, self.maxs_x);
-               WriteCoord(MSG_ENTITY, self.maxs_y);
-               WriteCoord(MSG_ENTITY, self.maxs_z);
+               trigger_common_write(true);
 
                WriteCoord(MSG_ENTITY, self.pos1_x);
                WriteCoord(MSG_ENTITY, self.pos1_y);
@@ -46,10 +34,6 @@ float plat_send(entity to, float sf)
                WriteCoord(MSG_ENTITY, self.size_y);
                WriteCoord(MSG_ENTITY, self.size_z);
 
-               WriteAngle(MSG_ENTITY, self.angles_x);
-               WriteAngle(MSG_ENTITY, self.angles_y);
-               WriteAngle(MSG_ENTITY, self.angles_z);
-
                WriteAngle(MSG_ENTITY, self.mangle_x);
                WriteAngle(MSG_ENTITY, self.mangle_y);
                WriteAngle(MSG_ENTITY, self.mangle_z);
@@ -72,10 +56,10 @@ float plat_send(entity to, float sf)
 
 void plat_link()
 {
-       Net_LinkEntity(self, 0, false, plat_send);
+       //Net_LinkEntity(self, 0, false, plat_send);
 }
 
-void spawnfunc_func_plat()
+spawnfunc(func_plat)
 {
        if (self.sounds == 0)
                self.sounds = 2;
@@ -140,52 +124,30 @@ void spawnfunc_func_plat()
        self.reset = plat_reset;
        plat_reset();
 
-       plat_link();
-
        InitializeEntity(self, plat_delayedinit, INITPRIO_FINDTARGET);
 }
 #elif defined(CSQC)
-void plat_draw()
+void plat_draw(entity this)
 {
-       float dt = time - self.move_time;
-       self.move_time = time;
-       if(dt <= 0) { return; }
-
-       setorigin(self, self.origin + self.velocity * dt);
+       Movetype_Physics_NoMatchServer();
+       //Movetype_Physics_MatchServer(autocvar_cl_projectiles_sloppy);
 }
 
 void ent_plat()
-{
+{SELFPARAM();
        float sf = ReadByte();
 
        if(sf & SF_TRIGGER_INIT)
        {
-               self.sv_entnum = ReadShort();
-               self.target = strzone(ReadString());
-               self.target2 = strzone(ReadString());
-               self.target3 = strzone(ReadString());
-               self.target4 = strzone(ReadString());
-               self.targetname = strzone(ReadString());
-
                self.platmovetype_start = ReadByte();
                self.platmovetype_turn = ReadByte();
                self.platmovetype_end = ReadByte();
-
-               self.origin_x = ReadCoord();
-               self.origin_y = ReadCoord();
-               self.origin_z = ReadCoord();
-               setorigin(self, self.origin);
+               self.spawnflags = ReadByte();
 
                self.model = strzone(ReadString());
-               setmodel(self, self.model);
+               _setmodel(self, self.model);
 
-               self.mins_x = ReadCoord();
-               self.mins_y = ReadCoord();
-               self.mins_z = ReadCoord();
-               self.maxs_x = ReadCoord();
-               self.maxs_y = ReadCoord();
-               self.maxs_z = ReadCoord();
-               setsize(self, self.mins, self.maxs);
+               trigger_common_read(true);
 
                self.pos1_x = ReadCoord();
                self.pos1_y = ReadCoord();
@@ -198,10 +160,6 @@ void ent_plat()
                self.size_y = ReadCoord();
                self.size_z = ReadCoord();
 
-               self.angles_x = ReadAngle();
-               self.angles_y = ReadAngle();
-               self.angles_z = ReadAngle();
-
                self.mangle_x = ReadAngle();
                self.mangle_y = ReadAngle();
                self.mangle_z = ReadAngle();
@@ -213,18 +171,31 @@ void ent_plat()
 
                self.dmg = ReadShort();
 
+               self.classname = "plat";
                self.solid = SOLID_BSP;
                self.movetype = MOVETYPE_PUSH;
                self.drawmask = MASK_NORMAL;
                self.draw = plat_draw;
                self.use = plat_use;
+               self.entremove = trigger_remove_generic;
 
                plat_reset(); // also called here
+
+               self.move_movetype = MOVETYPE_PUSH;
+               self.move_origin = self.origin;
+               self.move_angles = self.angles;
+               self.move_time = time;
+
+               plat_spawn_inside_trigger();
        }
 
        if(sf & SF_TRIGGER_RESET)
        {
                plat_reset();
+
+               self.move_origin = self.origin;
+               self.move_angles = self.angles;
+               self.move_time = time;
        }
 }
 #endif