Add DAMAGE_MATERIAL as a possible .takedamage value, this may just be a
temp way for model based entities to communicate whether or not they use that in-model surfaceflags.
This commit is contained in:
parent
c22b001f60
commit
3bb88216c8
6 changed files with 94 additions and 61 deletions
|
@ -22,6 +22,5 @@ client/infodecal.qc
|
|||
client/sky_camera.qc
|
||||
client/info_notnull.qc
|
||||
client/point_message.qc
|
||||
client/prop_dynamic.qc
|
||||
client/prop_rope.qc
|
||||
#endlist
|
||||
|
|
|
@ -59,6 +59,8 @@ server/infodecal.qc
|
|||
server/player_weaponstrip.qc
|
||||
server/player_loadsaved.qc
|
||||
server/prop_physics.qc
|
||||
server/prop_dynamic.qc
|
||||
server/prop_static.qc
|
||||
server/point_camera.qc
|
||||
server/targ_speaker.qc
|
||||
server/target_cdaudio.qc
|
||||
|
|
63
src/gs-entbase/server/prop_dynamic.qc
Normal file
63
src/gs-entbase/server/prop_dynamic.qc
Normal file
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Copyright (c) 2016-2020 Marco Hladik <marco@icculus.org>
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
|
||||
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*QUAKED prop_dynamic (0 0.2 1) (-8 -8 -8) (8 8 8) SF_BASIC_COL
|
||||
Client-side decorative model entity.
|
||||
|
||||
-------- KEYS --------
|
||||
"model" : Model file that will be displayed by the entity.
|
||||
"modelscale" : Scale modifier of the model. Default is "1".
|
||||
"angles" : Sets the pitch, yaw and roll angles of the model.
|
||||
"_cs" : Toggles if the prop casts a shadow or not.
|
||||
|
||||
-------- TRIVIA --------
|
||||
This entity was introduced in Half-Life 2 (2004).
|
||||
*/
|
||||
|
||||
class prop_dynamic:NSRenderableEntity
|
||||
{
|
||||
void(void) prop_dynamic;
|
||||
|
||||
virtual void(void) Respawn;
|
||||
virtual void(string, string) SpawnKey;
|
||||
};
|
||||
|
||||
void
|
||||
prop_dynamic::Respawn(void)
|
||||
{
|
||||
super::Respawn();
|
||||
SetModel(GetSpawnModel());
|
||||
SetSolid(SOLID_CORPSE);
|
||||
takedamage = DAMAGE_MATERIAL;
|
||||
}
|
||||
|
||||
void
|
||||
prop_dynamic::SpawnKey(string strKey, string strValue)
|
||||
{
|
||||
switch (strKey) {
|
||||
case "modelscale":
|
||||
scale = stof(strValue);
|
||||
break;
|
||||
default:
|
||||
super::SpawnKey(strKey, strValue);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
prop_dynamic::prop_dynamic(void)
|
||||
{
|
||||
super::NSRenderableEntity();
|
||||
}
|
|
@ -14,19 +14,6 @@
|
|||
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/*QUAKED prop_dynamic (0 0.2 1) (-8 -8 -8) (8 8 8) SF_BASIC_COL
|
||||
Client-side decorative model entity.
|
||||
|
||||
-------- KEYS --------
|
||||
"model" : Model file that will be displayed by the entity.
|
||||
"modelscale" : Scale modifier of the model. Default is "1".
|
||||
"angles" : Sets the pitch, yaw and roll angles of the model.
|
||||
"_cs" : Toggles if the prop casts a shadow or not.
|
||||
|
||||
-------- TRIVIA --------
|
||||
This entity was introduced in Half-Life 2 (2004).
|
||||
*/
|
||||
|
||||
/*QUAKED prop_static (0 0.2 1) (-8 -8 -8) (8 8 8) SF_BASIC_COL
|
||||
Decorative model entity that gets baked into the level file.
|
||||
|
||||
|
@ -51,61 +38,37 @@ waste disk space and memory. Use wisely.
|
|||
This entity was introduced in Half-Life 2 (2004).
|
||||
*/
|
||||
|
||||
class prop_dynamic:NSRenderableEntity
|
||||
class prop_static:NSRenderableEntity
|
||||
{
|
||||
void(void) prop_dynamic;
|
||||
void(void) prop_static;
|
||||
|
||||
virtual void(void) Init;
|
||||
virtual void(void) Respawn;
|
||||
virtual void(string, string) SpawnKey;
|
||||
virtual float(void) predraw;
|
||||
};
|
||||
|
||||
void
|
||||
prop_dynamic::SpawnKey(string strField, string strKey)
|
||||
prop_static::Respawn(void)
|
||||
{
|
||||
switch (strField) {
|
||||
case "modelscale":
|
||||
scale = stof(strKey);
|
||||
break;
|
||||
case "angle":
|
||||
angles[1] = stof(strKey);
|
||||
break;
|
||||
case "avelocity":
|
||||
avelocity = stov(strKey);
|
||||
break;
|
||||
default:
|
||||
super::SpawnKey(strField, strKey);
|
||||
super::Respawn();
|
||||
SetModel(GetSpawnModel());
|
||||
SetSolid(SOLID_CORPSE);
|
||||
takedamage = DAMAGE_MATERIAL;
|
||||
}
|
||||
|
||||
void
|
||||
prop_static::SpawnKey(string strKey, string strValue)
|
||||
{
|
||||
switch (strKey) {
|
||||
case "modelscale":
|
||||
scale = stof(strValue);
|
||||
break;
|
||||
default:
|
||||
super::SpawnKey(strKey, strValue);
|
||||
}
|
||||
}
|
||||
float
|
||||
prop_dynamic::predraw(void)
|
||||
{
|
||||
angles += avelocity * frametime;
|
||||
return super::predraw();
|
||||
}
|
||||
|
||||
void
|
||||
prop_dynamic::Init(void)
|
||||
prop_static::prop_static(void)
|
||||
{
|
||||
super::Init();
|
||||
|
||||
precache_model(model);
|
||||
setmodel(this, model);
|
||||
setorigin(this, origin);
|
||||
solid = SOLID_NOT;
|
||||
movetype = MOVETYPE_NONE;
|
||||
setsize(this, mins * scale, maxs * scale);
|
||||
drawmask = MASK_ENGINE;
|
||||
|
||||
if (vlen(avelocity) == 0)
|
||||
MakeStatic();
|
||||
}
|
||||
|
||||
void
|
||||
prop_dynamic::prop_dynamic(void)
|
||||
{
|
||||
scale = 1.0f;
|
||||
Init();
|
||||
}
|
||||
|
||||
CLASSEXPORT(prop_static, prop_dynamic)
|
||||
super::NSRenderableEntity();
|
||||
}
|
|
@ -42,3 +42,9 @@ typedef enumflags
|
|||
DMG_SKIP_ARMOR,
|
||||
DMG_SKIP_RAGDOLL
|
||||
} damageType_t;
|
||||
|
||||
/* takedamage types */
|
||||
const float DAMAGE_NO = 0;
|
||||
const float DAMAGE_YES = 1;
|
||||
const float DAMAGE_AIM = 2;
|
||||
const float DAMAGE_MATERIAL = 3;
|
|
@ -415,7 +415,7 @@ SurfData_Finish(void)
|
|||
void
|
||||
SurfData_Impact(entity e, int fl, vector org, vector ang)
|
||||
{
|
||||
if (e == world || e.health == 0) { /* the static world */
|
||||
if (e == world || e.health == 0 || e.takedamage == 3) { /* the static world */
|
||||
switch (serverkeyfloat("*bspversion")) {
|
||||
case BSPVER_HL:
|
||||
float surf;
|
||||
|
|
Loading…
Reference in a new issue