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