Fixed dynamic lights not spawning properly, fix double init for CSQC ents. Be more specific about which ents can spawn and which won't on the client. Make sure __fullspawndata is wiped after every bsp ent init.
This commit is contained in:
parent
78d3942789
commit
beb6f49620
20 changed files with 62 additions and 32 deletions
|
@ -99,11 +99,7 @@ Entity_EntityUpdate(float type, float new)
|
|||
fc.ReceiveEntity(new, readfloat());
|
||||
break;
|
||||
case ENT_DLIGHT:
|
||||
light_dynamic dl = (light_dynamic)self;
|
||||
if (new) {
|
||||
spawnfunc_light_dynamic();
|
||||
}
|
||||
dl.ReceiveEntity(new, readfloat());
|
||||
light_dynamic_ReadEntity(new);
|
||||
break;
|
||||
case ENT_PROJECTEDTEXTURE:
|
||||
env_projectedtexture ept = (env_projectedtexture)self;
|
||||
|
@ -163,14 +159,11 @@ Entities_ParseLump(void)
|
|||
if (!eEnt.classname) {
|
||||
break;
|
||||
}
|
||||
/* when we've reached the end of the lump, initialize the class! */
|
||||
if (iClass == TRUE) {
|
||||
eEnt.Init();
|
||||
return (1);
|
||||
}
|
||||
|
||||
__fullspawndata = "";
|
||||
|
||||
/* remove if we've found no valid class to go with us */
|
||||
if (eEnt) {
|
||||
if (eEnt && eEnt.isCSQC == false) {
|
||||
remove(eEnt);
|
||||
}
|
||||
return (1);
|
||||
|
|
|
@ -69,6 +69,7 @@ void
|
|||
env_cubemap::env_cubemap(void)
|
||||
{
|
||||
m_iSize = 32;
|
||||
isCSQC = true;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -226,4 +226,5 @@ env_glow::env_glow(void)
|
|||
m_flMaxAlpha = 1.0f;
|
||||
m_vecColor = [1,1,1];
|
||||
drawmask = MASK_GLOWS;
|
||||
isCSQC = true;
|
||||
}
|
||||
|
|
|
@ -107,4 +107,5 @@ env_particle::Respawn(void)
|
|||
|
||||
void env_particle::env_particle(void)
|
||||
{
|
||||
isCSQC = true;
|
||||
}
|
||||
|
|
|
@ -111,4 +111,5 @@ void
|
|||
env_sound::env_sound(void)
|
||||
{
|
||||
m_iRadius = 256;
|
||||
isCSQC = true;
|
||||
}
|
||||
|
|
|
@ -79,6 +79,7 @@ env_soundscape::env_soundscape(void)
|
|||
g_scapes+=1;
|
||||
m_iID = g_scapes;
|
||||
m_iRadius = 1024;
|
||||
isCSQC = true;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -158,6 +158,7 @@ env_sun::SpawnKey(string strField, string strKey)
|
|||
void
|
||||
env_sun::env_sun(void)
|
||||
{
|
||||
isCSQC = true;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -194,4 +194,5 @@ func_dustcloud::func_dustcloud(void)
|
|||
m_vecColor = [1,1,1];
|
||||
*/
|
||||
solid = SOLID_NOT;
|
||||
isCSQC = true;
|
||||
}
|
||||
|
|
|
@ -95,4 +95,5 @@ void
|
|||
func_dustmotes::func_dustmotes(void)
|
||||
{
|
||||
solid = SOLID_NOT;
|
||||
isCSQC = true;
|
||||
}
|
||||
|
|
|
@ -108,4 +108,5 @@ func_lod::func_lod(void)
|
|||
{
|
||||
m_iDisappearDist = 2000;
|
||||
solid = SOLID_BSP;
|
||||
isCSQC = true;
|
||||
}
|
||||
|
|
|
@ -210,4 +210,5 @@ func_smokevolume::func_smokevolume(void)
|
|||
m_vecColor1 = m_vecColor2 = [0,0,0];
|
||||
|
||||
solid = SOLID_NOT;
|
||||
isCSQC = true;
|
||||
}
|
||||
|
|
|
@ -84,4 +84,5 @@ void
|
|||
light_environment::light_environment(void)
|
||||
{
|
||||
solid = SOLID_NOT;
|
||||
isCSQC = true;
|
||||
}
|
||||
|
|
|
@ -63,6 +63,7 @@ point_message::point_message(void)
|
|||
{
|
||||
m_flRadius = 512;
|
||||
m_strMessage = "No message";
|
||||
isCSQC = true;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -67,4 +67,5 @@ prop_static::Spawned(void)
|
|||
void
|
||||
prop_static::prop_static(void)
|
||||
{
|
||||
isCSQC = true;
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ void
|
|||
sky_camera::sky_camera(void)
|
||||
{
|
||||
g_skyscale = 16;
|
||||
isCSQC = true;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1045,10 +1045,8 @@ NSEntity::NSEntity(void)
|
|||
#ifdef SERVER
|
||||
identity = 1; /* .identity is a global ent field we abuse to let find() calls
|
||||
reliably know that those are NSEntity class-based */
|
||||
#endif
|
||||
|
||||
blocked = BlockedHandler;
|
||||
touch = TouchHandler;
|
||||
#else
|
||||
isCSQC = 1;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -390,6 +390,8 @@ ambient_generic::SpawnKey(string strKey, string strValue)
|
|||
void
|
||||
ambient_generic::Spawned(void)
|
||||
{
|
||||
super::Spawned();
|
||||
|
||||
precache_sound("common/null.wav");
|
||||
}
|
||||
|
||||
|
|
|
@ -345,6 +345,8 @@ env_bubbles::Respawn(void)
|
|||
void
|
||||
env_bubbles::Spawned(void)
|
||||
{
|
||||
super::Spawned();
|
||||
|
||||
precache_model("sprites/bubble.spr");
|
||||
}
|
||||
|
||||
|
|
|
@ -436,6 +436,8 @@ func_tankmortar::SpawnKey(string strKey, string strValue)
|
|||
void
|
||||
func_tankmortar::Spawned(void)
|
||||
{
|
||||
super::Spawned();
|
||||
|
||||
#ifdef SERVER
|
||||
if (m_strSpriteFlash)
|
||||
precache_model(m_strSpriteFlash);
|
||||
|
|
|
@ -84,11 +84,11 @@ class light_dynamic:NSPointTrigger
|
|||
|
||||
void(void) light_dynamic;
|
||||
virtual void(string, string) SpawnKey;
|
||||
virtual void(void) Spawned;
|
||||
|
||||
#ifdef CLIENT
|
||||
virtual void(float,float) ReceiveEntity;
|
||||
virtual float(void) predraw;
|
||||
virtual void(void) Spawned;
|
||||
virtual void(void) RendererRestarted;
|
||||
#else
|
||||
|
||||
|
@ -137,6 +137,7 @@ light_dynamic::ReceiveEntity(float flNew, float flFlags)
|
|||
origin[1] = readcoord();
|
||||
origin[2] = readcoord();
|
||||
setorigin(this, origin);
|
||||
print(sprintf("received %v\n", origin));
|
||||
}
|
||||
|
||||
if (flFlags & DLIGHTFL_CHANGED_ANGLES) {
|
||||
|
@ -184,17 +185,6 @@ light_dynamic::RendererRestarted(void)
|
|||
dynamiclight_set(p, LFIELD_STYLESTRING, m_strPattern);
|
||||
#endif
|
||||
}
|
||||
void
|
||||
light_dynamic::Spawned(void)
|
||||
{
|
||||
/* we're meant to be a server controlled entity. cancel out and kill us ASAP */
|
||||
if (targetname) {
|
||||
Destroy();
|
||||
return;
|
||||
}
|
||||
|
||||
RendererRestarted();
|
||||
}
|
||||
#else
|
||||
void
|
||||
light_dynamic::EvaluateEntity(void)
|
||||
|
@ -240,6 +230,7 @@ light_dynamic::SendEntity(entity ePEnt, float flFlags)
|
|||
WriteCoord(MSG_ENTITY, origin[0]);
|
||||
WriteCoord(MSG_ENTITY, origin[1]);
|
||||
WriteCoord(MSG_ENTITY, origin[2]);
|
||||
print(sprintf("sending %v\n", origin));
|
||||
}
|
||||
|
||||
if (flFlags & DLIGHTFL_CHANGED_ANGLES) {
|
||||
|
@ -323,6 +314,7 @@ light_dynamic::Input(entity eAct, string strInput, string strData)
|
|||
super::Input(eAct, strInput, strData);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
light_dynamic::Respawn(void)
|
||||
{
|
||||
|
@ -330,7 +322,6 @@ light_dynamic::Respawn(void)
|
|||
SetSize([-16,-16,-16], [16,16,16]);
|
||||
SetOrigin(GetSpawnOrigin());
|
||||
SetAngles(GetSpawnAngles());
|
||||
|
||||
m_iState = (m_iStartActive == 1) ? 1 : 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -374,14 +365,18 @@ light_dynamic::SpawnKey(string strKey, string strValue)
|
|||
}
|
||||
|
||||
void
|
||||
light_dynamic::light_dynamic(void)
|
||||
light_dynamic::Spawned(void)
|
||||
{
|
||||
m_vecLight = [255,255,255];
|
||||
m_flDistance = 256;
|
||||
m_iStartActive = 1;
|
||||
super::Spawned();
|
||||
|
||||
#ifdef CLIENT
|
||||
drawmask = MASK_ENGINE;
|
||||
/* we're meant to be a server controlled entity. cancel out and kill us ASAP */
|
||||
if (isCSQC == true && targetname) {
|
||||
Destroy();
|
||||
return;
|
||||
}
|
||||
|
||||
RendererRestarted();
|
||||
#else
|
||||
/* the client-side will handle dlights without targetnames */
|
||||
if (!targetname) {
|
||||
|
@ -391,5 +386,29 @@ light_dynamic::light_dynamic(void)
|
|||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
light_dynamic::light_dynamic(void)
|
||||
{
|
||||
m_vecLight = [255,255,255];
|
||||
m_flDistance = 256;
|
||||
m_iStartActive = 1;
|
||||
}
|
||||
|
||||
/* compatibility for q3map users, stay safe out there */
|
||||
class dynamic_light:light_dynamic { };
|
||||
|
||||
#ifdef CLIENT
|
||||
void
|
||||
light_dynamic_ReadEntity(float new)
|
||||
{
|
||||
light_dynamic dl = (light_dynamic)self;
|
||||
|
||||
if (new) {
|
||||
spawnfunc_light_dynamic();
|
||||
}
|
||||
|
||||
dl.isCSQC = false;
|
||||
dl.ReceiveEntity(new, readfloat());
|
||||
dl.drawmask = MASK_GLOWS;
|
||||
}
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue