#include "weapons/projectile.qh"
-#include "../common/buffs.qh"
+#include "../common/buffs/all.qh"
#include "../common/deathtypes.qh"
#include "../common/effects/effects.qh"
#include "../common/mapinfo.qh"
#include "../common/monsters/all.qh"
-#include "../common/nades.qh"
+#include "../common/nades/all.qh"
#include "../common/net_notice.qh"
#include "../common/notifications.qh"
#include "../common/stats.qh"
{
}
+void draw_null(entity this) { }
+
string forcefog;
void ConsoleCommand_macro_init();
void CSQC_Init(void)
// needs to be done so early because of the constants they create
static_init();
- CALL_ACCUMULATED_FUNCTION(RegisterTurrets);
CALL_ACCUMULATED_FUNCTION(RegisterNotifications);
CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes);
CALL_ACCUMULATED_FUNCTION(RegisterHUD_Panels);
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;
}
}
-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
void Ent_ScoresInfo();
void CSQC_Ent_Update(float bIsNewEntity)
{SELFPARAM();
- float t;
- float savetime;
- t = ReadByte();
+ int t = ReadByte();
if(autocvar_developer_csqcentities)
LOG_INFOF("CSQC_Ent_Update(%d) with self=%i self.entnum=%d self.enttype=%d t=%d\n", bIsNewEntity, self, self.entnum, self.enttype, t);
// set up the "time" global for received entities to be correct for interpolation purposes
- savetime = time;
+ float savetime = time;
if(servertime)
{
time = servertime;
{
if(t != self.enttype || bIsNewEntity)
{
- //print("A CSQC entity changed its type!\n");
LOG_INFOF("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();
clearentity(self);
}
#endif
self.enttype = t;
+ bool done = false;
+ FOREACH(LinkedEntities, it.m_id == t, LAMBDA(
+ it.m_read(self, bIsNewEntity);
+ done = true;
+ break;
+ ));
+ if (!done)
switch(t)
{
case ENT_CLIENT_MUTATOR: {
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;
case ENT_CLIENT_SPAWNPOINT: Ent_ReadSpawnPoint(bIsNewEntity); break;
case ENT_CLIENT_SPAWNEVENT: Ent_ReadSpawnEvent(bIsNewEntity); break;
case ENT_CLIENT_NOTIFICATION: Read_Notification(bIsNewEntity); break;
- case ENT_CLIENT_HEALING_ORB: ent_healer(); break;
case ENT_CLIENT_MINIGAME: ent_read_minigame(); break;
case ENT_CLIENT_VIEWLOC: ent_viewloc(); break;
case ENT_CLIENT_VIEWLOC_TRIGGER: ent_viewloc_trigger(); break;
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
}
// CSQC_Parse_TempEntity : Handles all temporary entity network data in the CSQC layer.
// You must ALWAYS first acquire the temporary ID, which is sent as a byte.
// Return value should be 1 if CSQC handled the temporary entity, otherwise return 0 to have the engine process the event.
-float CSQC_Parse_TempEntity()
+bool CSQC_Parse_TempEntity()
{
// Acquire TE ID
int nTEID = ReadByte();
if (autocvar_developer_csqcentities)
LOG_INFOF("CSQC_Parse_TempEntity() with nTEID=%d\n", nTEID);
+ FOREACH(TempEntities, it.m_id == nTEID, LAMBDA(
+ it.m_read(NULL, true);
+ return true;
+ ));
switch (nTEID)
{
case TE_CSQC_MUTATOR: