NSEntity: Make sure .scale affects SetSize() calls and is updated with
SetModel() calls. Also keep track of original .mins/.maxs in case scale changes.
This commit is contained in:
parent
b670c994c1
commit
a8e4cd5748
|
@ -553,8 +553,6 @@ CSQC_Input_Frame(void)
|
||||||
sendevent("Spraylogo", "");
|
sendevent("Spraylogo", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (pSeat->m_flCameraTime > time) {
|
if (pSeat->m_flCameraTime > time) {
|
||||||
/* TODO: Supress the changing of view_angles/input_angles. */
|
/* TODO: Supress the changing of view_angles/input_angles. */
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,10 @@ class NSEntity:NSTrigger
|
||||||
{
|
{
|
||||||
void(void) NSEntity;
|
void(void) NSEntity;
|
||||||
|
|
||||||
|
/* these are the real bounds, whereas .mins .maxs are affected by .scale */
|
||||||
|
vector m_vecMins;
|
||||||
|
vector m_vecMaxs;
|
||||||
|
|
||||||
#ifdef CLIENT
|
#ifdef CLIENT
|
||||||
virtual void(float flChanged) ReceiveEntity;
|
virtual void(float flChanged) ReceiveEntity;
|
||||||
virtual void(void) postdraw;
|
virtual void(void) postdraw;
|
||||||
|
@ -73,4 +77,4 @@ class NSEntity:NSTrigger
|
||||||
virtual void(vector) SetOrigin;
|
virtual void(vector) SetOrigin;
|
||||||
virtual void(vector, vector) SetSize;
|
virtual void(vector, vector) SetSize;
|
||||||
virtual void(string, string) SpawnKey;
|
virtual void(string, string) SpawnKey;
|
||||||
};
|
};
|
||||||
|
|
|
@ -284,10 +284,9 @@ NSEntity::SetAngles(vector newAngles)
|
||||||
void
|
void
|
||||||
NSEntity::SetSize(vector newMins, vector newMaxs)
|
NSEntity::SetSize(vector newMins, vector newMaxs)
|
||||||
{
|
{
|
||||||
if (newMins == mins && newMaxs == maxs)
|
m_vecMins = newMins;
|
||||||
return;
|
m_vecMaxs = newMaxs;
|
||||||
|
setsize(this, m_vecMins * scale, m_vecMaxs * scale);
|
||||||
setsize(this, newMins, newMaxs);
|
|
||||||
SetSendFlags(BASEFL_CHANGED_SIZE);
|
SetSendFlags(BASEFL_CHANGED_SIZE);
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
|
@ -306,6 +305,7 @@ NSEntity::SetModel(string newModel)
|
||||||
{
|
{
|
||||||
model = newModel;
|
model = newModel;
|
||||||
setmodel(this, newModel);
|
setmodel(this, newModel);
|
||||||
|
SetSize(mins, maxs);
|
||||||
SetSendFlags(BASEFL_CHANGED_MODELINDEX);
|
SetSendFlags(BASEFL_CHANGED_MODELINDEX);
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
|
@ -315,10 +315,10 @@ NSEntity::SetModelindex(float newModelIndex)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
modelindex = newModelIndex;
|
modelindex = newModelIndex;
|
||||||
|
SetSize(mins, maxs);
|
||||||
SetSendFlags(BASEFL_CHANGED_MODELINDEX);
|
SetSendFlags(BASEFL_CHANGED_MODELINDEX);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef SERVER
|
#ifdef SERVER
|
||||||
vector
|
vector
|
||||||
NSEntity::GetSpawnOrigin(void)
|
NSEntity::GetSpawnOrigin(void)
|
||||||
|
|
|
@ -346,7 +346,6 @@ NSRenderableEntity::ReceiveEntity(float flChanged)
|
||||||
maxs[0] = readcoord();
|
maxs[0] = readcoord();
|
||||||
maxs[1] = readcoord();
|
maxs[1] = readcoord();
|
||||||
maxs[2] = readcoord();
|
maxs[2] = readcoord();
|
||||||
setsize(this, mins, maxs);
|
|
||||||
}
|
}
|
||||||
if (flChanged & BASEFL_CHANGED_FRAME) {
|
if (flChanged & BASEFL_CHANGED_FRAME) {
|
||||||
frame1time = 0.0;
|
frame1time = 0.0;
|
||||||
|
@ -402,6 +401,9 @@ NSRenderableEntity::ReceiveEntity(float flChanged)
|
||||||
if (scale == 0.0)
|
if (scale == 0.0)
|
||||||
scale = 1.0f;
|
scale = 1.0f;
|
||||||
|
|
||||||
|
if (flChanged & BASEFL_CHANGED_SIZE)
|
||||||
|
setsize(this, mins * scale, maxs * scale);
|
||||||
|
|
||||||
setorigin(this, origin);
|
setorigin(this, origin);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -528,6 +530,7 @@ NSRenderableEntity::SetScale(float newScale)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
scale = newScale;
|
scale = newScale;
|
||||||
|
setsize(this, m_vecMins * scale, m_vecMaxs * scale);
|
||||||
SetSendFlags(BASEFL_CHANGED_SCALE);
|
SetSendFlags(BASEFL_CHANGED_SCALE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue