NSRenderableEntity: add SetBoneControl methods.
This commit is contained in:
parent
2735bd26f6
commit
98afd5fa28
4 changed files with 118 additions and 3 deletions
|
@ -36,6 +36,7 @@ enumflags
|
|||
RDENT_CHANGED_RENDERCOLOR,
|
||||
RDENT_CHANGED_RENDERAMT,
|
||||
RDENT_CHANGED_RENDERMODE,
|
||||
RDENT_CHANGED_CONTROLLER
|
||||
};
|
||||
|
||||
#ifdef CLIENT
|
||||
|
@ -65,8 +66,14 @@ class NSRenderableEntity:NSEntity
|
|||
#endif
|
||||
|
||||
/* new */
|
||||
PREDICTED_FLOAT(m_flBoneControl1);
|
||||
PREDICTED_FLOAT(m_flBoneControl2);
|
||||
PREDICTED_FLOAT(m_flBoneControl3);
|
||||
PREDICTED_FLOAT(m_flBoneControl4);
|
||||
PREDICTED_FLOAT(m_flBoneControl5);
|
||||
PREDICTED_INT(m_iBody);
|
||||
PREDICTED_FLOAT_N(frame);
|
||||
PREDICTED_FLOAT_N(colormap);
|
||||
PREDICTED_FLOAT_N(skin);
|
||||
PREDICTED_FLOAT_N(effects);
|
||||
/* model events */
|
||||
|
|
|
@ -97,11 +97,30 @@ NSRenderableEntity::EvaluateEntity(void)
|
|||
if (ATTR_CHANGED(velocity)) {
|
||||
SetSendFlags(RDENT_CHANGED_VELOCITY);
|
||||
}
|
||||
if (ATTR_CHANGED(colormap)) {
|
||||
SetSendFlags(RDENT_CHANGED_MODELINDEX);
|
||||
}
|
||||
if (ATTR_CHANGED(m_flBoneControl1)) {
|
||||
SetSendFlags(RDENT_CHANGED_CONTROLLER);
|
||||
}
|
||||
if (ATTR_CHANGED(m_flBoneControl2)) {
|
||||
SetSendFlags(RDENT_CHANGED_CONTROLLER);
|
||||
}
|
||||
if (ATTR_CHANGED(m_flBoneControl3)) {
|
||||
SetSendFlags(RDENT_CHANGED_CONTROLLER);
|
||||
}
|
||||
if (ATTR_CHANGED(m_flBoneControl4)) {
|
||||
SetSendFlags(RDENT_CHANGED_CONTROLLER);
|
||||
}
|
||||
if (ATTR_CHANGED(m_flBoneControl5)) {
|
||||
SetSendFlags(RDENT_CHANGED_CONTROLLER);
|
||||
}
|
||||
|
||||
SAVE_STATE(origin);
|
||||
angles = Math_FixDeltaVector(angles);
|
||||
SAVE_STATE(angles);
|
||||
SAVE_STATE(modelindex);
|
||||
SAVE_STATE(colormap);
|
||||
SAVE_STATE(solid);
|
||||
SAVE_STATE(movetype);
|
||||
SAVE_STATE(size);
|
||||
|
@ -111,6 +130,11 @@ NSRenderableEntity::EvaluateEntity(void)
|
|||
SAVE_STATE(m_iBody);
|
||||
SAVE_STATE(scale);
|
||||
SAVE_STATE(velocity);
|
||||
SAVE_STATE(m_flBoneControl1);
|
||||
SAVE_STATE(m_flBoneControl2);
|
||||
SAVE_STATE(m_flBoneControl3);
|
||||
SAVE_STATE(m_flBoneControl4);
|
||||
SAVE_STATE(m_flBoneControl5);
|
||||
|
||||
if (ATTR_CHANGED(m_iRenderMode)) {
|
||||
SetSendFlags(RDENT_CHANGED_RENDERMODE);
|
||||
|
@ -268,6 +292,13 @@ NSRenderableEntity::SendEntity(entity ePEnt, float fChanged)
|
|||
if (fChanged & RDENT_CHANGED_RENDERAMT) {
|
||||
WriteFloat(MSG_ENTITY, m_flRenderAmt);
|
||||
}
|
||||
if (fChanged & RDENT_CHANGED_CONTROLLER) {
|
||||
WriteShort(MSG_ENTITY, m_flBoneControl1 * 32767 / 360);
|
||||
WriteShort(MSG_ENTITY, m_flBoneControl2 * 32767 / 360);
|
||||
WriteShort(MSG_ENTITY, m_flBoneControl3 * 32767 / 360);
|
||||
WriteShort(MSG_ENTITY, m_flBoneControl4 * 32767 / 360);
|
||||
WriteShort(MSG_ENTITY, m_flBoneControl5 * 32767 / 360);
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
@ -582,6 +613,13 @@ NSRenderableEntity::ReceiveEntity(float flNew, float flChanged)
|
|||
if (flChanged & RDENT_CHANGED_RENDERAMT) {
|
||||
m_flRenderAmt = readfloat();
|
||||
}
|
||||
if (flChanged & RDENT_CHANGED_CONTROLLER) {
|
||||
m_flBoneControl1 = readshort() / (32767 / 360);
|
||||
m_flBoneControl2 = readshort() / (32767 / 360);
|
||||
m_flBoneControl3 = readshort() / (32767 / 360);
|
||||
m_flBoneControl4 = readshort() / (32767 / 360);
|
||||
m_flBoneControl5 = readshort() / (32767 / 360);
|
||||
}
|
||||
|
||||
if (scale == 0.0)
|
||||
scale = 1.0f;
|
||||
|
@ -630,6 +668,12 @@ NSRenderableEntity::predraw(void)
|
|||
return (PREDRAW_NEXT);
|
||||
}
|
||||
|
||||
bonecontrol1 = m_flBoneControl1;
|
||||
bonecontrol2 = m_flBoneControl2;
|
||||
bonecontrol3 = m_flBoneControl3;
|
||||
bonecontrol4 = m_flBoneControl4;
|
||||
bonecontrol5 = m_flBoneControl5;
|
||||
|
||||
RenderFXPass();
|
||||
RenderDebugSkeleton();
|
||||
|
||||
|
@ -757,6 +801,36 @@ NSRenderableEntity::SetRenderColor(vector newColor)
|
|||
m_vecRenderColor = newColor;
|
||||
}
|
||||
|
||||
void
|
||||
NSRenderableEntity::SetBoneControl1(float val)
|
||||
{
|
||||
m_flBoneControl1 = val;
|
||||
}
|
||||
|
||||
void
|
||||
NSRenderableEntity::SetBoneControl2(float val)
|
||||
{
|
||||
m_flBoneControl2 = val;
|
||||
}
|
||||
|
||||
void
|
||||
NSRenderableEntity::SetBoneControl3(float val)
|
||||
{
|
||||
m_flBoneControl3 = val;
|
||||
}
|
||||
|
||||
void
|
||||
NSRenderableEntity::SetBoneControl4(float val)
|
||||
{
|
||||
m_flBoneControl4 = val;
|
||||
}
|
||||
|
||||
void
|
||||
NSRenderableEntity::SetBoneControl5(float val)
|
||||
{
|
||||
m_flBoneControl5 = val;
|
||||
}
|
||||
|
||||
#ifdef SERVER
|
||||
void
|
||||
NSRenderableEntity::Save(float handle)
|
||||
|
|
|
@ -32,6 +32,7 @@ enumflags
|
|||
SRFENT_CHANGED_RENDERCOLOR,
|
||||
SRFENT_CHANGED_RENDERAMT,
|
||||
SRFENT_CHANGED_RENDERMODE,
|
||||
SRFENT_CHANGED_CONTROLLER
|
||||
};
|
||||
|
||||
class NSSurfacePropEntity:NSRenderableEntity
|
||||
|
|
|
@ -74,6 +74,21 @@ NSSurfacePropEntity::EvaluateEntity(void)
|
|||
if (ATTR_CHANGED(velocity)) {
|
||||
SetSendFlags(SRFENT_CHANGED_VELOCITY);
|
||||
}
|
||||
if (ATTR_CHANGED(m_flBoneControl1)) {
|
||||
SetSendFlags(SRFENT_CHANGED_CONTROLLER);
|
||||
}
|
||||
if (ATTR_CHANGED(m_flBoneControl2)) {
|
||||
SetSendFlags(SRFENT_CHANGED_CONTROLLER);
|
||||
}
|
||||
if (ATTR_CHANGED(m_flBoneControl3)) {
|
||||
SetSendFlags(SRFENT_CHANGED_CONTROLLER);
|
||||
}
|
||||
if (ATTR_CHANGED(m_flBoneControl4)) {
|
||||
SetSendFlags(SRFENT_CHANGED_CONTROLLER);
|
||||
}
|
||||
if (ATTR_CHANGED(m_flBoneControl5)) {
|
||||
SetSendFlags(SRFENT_CHANGED_CONTROLLER);
|
||||
}
|
||||
|
||||
SAVE_STATE(origin);
|
||||
SAVE_STATE(angles);
|
||||
|
@ -88,6 +103,11 @@ NSSurfacePropEntity::EvaluateEntity(void)
|
|||
SAVE_STATE(m_iBody);
|
||||
SAVE_STATE(scale);
|
||||
SAVE_STATE(velocity);
|
||||
SAVE_STATE(m_flBoneControl1);
|
||||
SAVE_STATE(m_flBoneControl2);
|
||||
SAVE_STATE(m_flBoneControl3);
|
||||
SAVE_STATE(m_flBoneControl4);
|
||||
SAVE_STATE(m_flBoneControl5);
|
||||
|
||||
if (ATTR_CHANGED(m_iRenderMode)) {
|
||||
SetSendFlags(SRFENT_CHANGED_RENDERMODE);
|
||||
|
@ -232,7 +252,13 @@ NSSurfacePropEntity::SendEntity(entity ePEnt, float fChanged)
|
|||
if (fChanged & SRFENT_CHANGED_RENDERAMT) {
|
||||
WriteFloat(MSG_ENTITY, m_flRenderAmt);
|
||||
}
|
||||
|
||||
if (fChanged & SRFENT_CHANGED_CONTROLLER) {
|
||||
WriteShort(MSG_ENTITY, m_flBoneControl1 * 32767 / 360);
|
||||
WriteShort(MSG_ENTITY, m_flBoneControl2 * 32767 / 360);
|
||||
WriteShort(MSG_ENTITY, m_flBoneControl3 * 32767 / 360);
|
||||
WriteShort(MSG_ENTITY, m_flBoneControl4 * 32767 / 360);
|
||||
WriteShort(MSG_ENTITY, m_flBoneControl5 * 32767 / 360);
|
||||
}
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
@ -319,6 +345,13 @@ NSSurfacePropEntity::ReceiveEntity(float flNew, float flChanged)
|
|||
if (flChanged & SRFENT_CHANGED_RENDERAMT) {
|
||||
m_flRenderAmt = readfloat();
|
||||
}
|
||||
if (flChanged & SRFENT_CHANGED_CONTROLLER) {
|
||||
m_flBoneControl1 = readshort() / (32767 / 360);
|
||||
m_flBoneControl2 = readshort() / (32767 / 360);
|
||||
m_flBoneControl3 = readshort() / (32767 / 360);
|
||||
m_flBoneControl4 = readshort() / (32767 / 360);
|
||||
m_flBoneControl5 = readshort() / (32767 / 360);
|
||||
}
|
||||
|
||||
if (modelindex) {
|
||||
drawmask = MASK_ENGINE;
|
||||
|
@ -533,7 +566,7 @@ NSSurfacePropEntity::Input(entity eAct, string strInput, string strData)
|
|||
Extinguish();
|
||||
break;
|
||||
default:
|
||||
NSRenderableEntity::Input(eAct, strInput, strData);
|
||||
super::Input(eAct, strInput, strData);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -559,7 +592,7 @@ NSSurfacePropEntity::SpawnKey(string strKey, string strValue)
|
|||
break;
|
||||
#endif
|
||||
default:
|
||||
NSRenderableEntity::SpawnKey(strKey, strValue);
|
||||
super::SpawnKey(strKey, strValue);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue