infodecal: Allow usage outside of HL BSP. Just not Quake 1/2 BSP.

This commit is contained in:
Marco Cawthorne 2022-04-04 21:34:00 -07:00
parent 542b1fe27f
commit 0a75c64fb1
Signed by: eukara
GPG key ID: C196CD8BA993248A
3 changed files with 29 additions and 7 deletions

View file

@ -116,6 +116,8 @@ infodecal::SpawnKey(string strKey, string strValue)
{ {
switch (strKey) { switch (strKey) {
case "material": case "material":
m_strTexture = strValue;
break;
case "texture": case "texture":
m_strTexture = strtolower(strValue); m_strTexture = strtolower(strValue);
break; break;
@ -127,7 +129,15 @@ infodecal::SpawnKey(string strKey, string strValue)
void void
infodecal::infodecal(void) infodecal::infodecal(void)
{ {
if (serverkeyfloat("*bspversion") != BSPVER_HL) { float bsp_version = serverkeyfloat("*bspversion");
switch (bsp_version) {
case BSPVER_HL:
case BSPVER_RBSP:
case BSPVER_Q3:
case BSPVER_RTCW:
break;
default:
remove(self); remove(self);
return; return;
} }

View file

@ -176,21 +176,18 @@ void
NSEntity::Touch(entity eToucher) NSEntity::Touch(entity eToucher)
{ {
/* To be handled by sub-classes */ /* To be handled by sub-classes */
print("touched!\n");
} }
void void
NSEntity::StartTouch(entity eToucher) NSEntity::StartTouch(entity eToucher)
{ {
/* To be handled by sub-classes */ /* To be handled by sub-classes */
print("start touched!\n");
} }
void void
NSEntity::EndTouch(entity eToucher) NSEntity::EndTouch(entity eToucher)
{ {
/* To be handled by sub-classes */ /* To be handled by sub-classes */
print("end touched!\n");
} }
void void

View file

@ -94,6 +94,8 @@ decal::ReceiveEntity(void)
if (serverkeyfloat("*bspversion") == BSPVER_HL) { if (serverkeyfloat("*bspversion") == BSPVER_HL) {
BuildShader(); BuildShader();
} else {
m_strShader = m_strTexture;
} }
makevectors(angles); makevectors(angles);
@ -152,11 +154,14 @@ decal::BuildShader(void)
void void
decal::Place(vector org, string dname) decal::Place(vector org, string dname)
{ {
if (!dname)
return;
decal_pickwall(this, org); decal_pickwall(this, org);
/* we never hit any wall. */ /* we never hit any wall. */
if (g_tracedDecal.fraction == 1.0f) { if (g_tracedDecal.fraction == 1.0f) {
dprint(sprintf("^1infodecal tracing failed at %v\n", org)); print(sprintf("^1infodecal tracing failed at %v\n", org));
if (classname != "tempdecal") if (classname != "tempdecal")
remove(this); remove(this);
return; return;
@ -190,6 +195,8 @@ decal::Place(vector org, string dname)
if (serverkeyfloat("*bspversion") == BSPVER_HL) { if (serverkeyfloat("*bspversion") == BSPVER_HL) {
BuildShader(); BuildShader();
} else {
m_strShader = m_strTexture;
} }
makevectors(angles); makevectors(angles);
@ -252,8 +259,16 @@ decal Decals_Next(vector pos)
/* Generalized Decal Placing Function */ /* Generalized Decal Placing Function */
void Decals_Place(vector pos, string dname) void Decals_Place(vector pos, string dname)
{ {
if (serverkeyfloat("*bspversion") != BSPVER_HL) { float bsp_version = serverkeyfloat("*bspversion");
return;
switch (bsp_version) {
case BSPVER_HL:
case BSPVER_RBSP:
case BSPVER_Q3:
case BSPVER_RTCW:
break;
default:
return;
} }
decal x = Decals_Next(pos); decal x = Decals_Next(pos);