|
38 | 38 | #include "Common/DrawModule.h" |
39 | 39 | #include "Common/FramePacer.h" |
40 | 40 | #include "Common/GameAudio.h" |
| 41 | +#include "Common/GameEngine.h" |
41 | 42 | #include "Common/GameLOD.h" |
42 | 43 | #include "Common/GameState.h" |
43 | 44 | #include "Common/GameUtility.h" |
|
61 | 62 | #include "GameLogic/Module/StealthUpdate.h" |
62 | 63 | #include "GameLogic/Module/StickyBombUpdate.h" |
63 | 64 | #include "GameLogic/Module/BattlePlanUpdate.h" |
| 65 | +#include "GameLogic/Module/UpdateModule.h" |
64 | 66 | #include "GameLogic/ScriptEngine.h" |
65 | 67 | #include "GameLogic/Weapon.h" |
66 | 68 |
|
@@ -412,6 +414,8 @@ Drawable::Drawable( const ThingTemplate *thingTemplate, DrawableStatusBits statu |
412 | 414 | //Real scaleFuzziness = thingTemplate->getInstanceScaleFuzziness(); |
413 | 415 | //Real fuzzyScale = ( 1.0f + GameClientRandomValueReal( -scaleFuzziness, scaleFuzziness )); |
414 | 416 | m_instanceScale = thingTemplate->getAssetScale();// * fuzzyScale; |
| 417 | + m_useExtrapolation = FALSE; |
| 418 | + m_visualExtrapolationMtx.Make_Identity(); |
415 | 419 |
|
416 | 420 | // initially not bound to an object |
417 | 421 | m_object = nullptr; |
@@ -1149,6 +1153,18 @@ void Drawable::updateDrawable() |
1149 | 1153 | UnsignedInt now = TheGameLogic->getFrame(); |
1150 | 1154 | Object *obj = getObject(); |
1151 | 1155 |
|
| 1156 | + if (obj) |
| 1157 | + { |
| 1158 | + for (BehaviorModule** m = obj->getBehaviorModules(); m && *m; ++m) |
| 1159 | + { |
| 1160 | + if (ProjectileUpdateInterface* pui = (*m)->getProjectileUpdateInterface()) |
| 1161 | + { |
| 1162 | + applySubFrameExtrapolation(pui); |
| 1163 | + break; |
| 1164 | + } |
| 1165 | + } |
| 1166 | + } |
| 1167 | + |
1152 | 1168 | { |
1153 | 1169 | for (ClientUpdateModule** cu = getClientUpdateModules(); cu && *cu; ++cu) |
1154 | 1170 | { |
@@ -4248,6 +4264,11 @@ void Drawable::setInstanceMatrix( const Matrix3D *instance ) |
4248 | 4264 | //------------------------------------------------------------------------------------------------- |
4249 | 4265 | const Matrix3D *Drawable::getTransformMatrix() const |
4250 | 4266 | { |
| 4267 | + if (m_useExtrapolation) |
| 4268 | + { |
| 4269 | + return &m_visualExtrapolationMtx; |
| 4270 | + } |
| 4271 | + |
4251 | 4272 | const Object *obj = getObject(); |
4252 | 4273 |
|
4253 | 4274 | if (obj) |
@@ -5643,3 +5664,20 @@ void TintEnvelope::loadPostProcess() |
5643 | 5664 |
|
5644 | 5665 | } |
5645 | 5666 |
|
| 5667 | + |
| 5668 | +void Drawable::applySubFrameExtrapolation(ProjectileUpdateInterface* pui) |
| 5669 | +{ |
| 5670 | + const Coord3D* v = pui->getProjectileLogicVelocity(); |
| 5671 | + Real alpha = TheGameEngine->getLogicTimeAccumulator() * TheFramePacer->getActualLogicTimeScaleFps(); |
| 5672 | + |
| 5673 | + if (v && alpha > 0.0f && m_object) |
| 5674 | + { |
| 5675 | + m_visualExtrapolationMtx = *m_object->getTransformMatrix(); |
| 5676 | + m_visualExtrapolationMtx.Adjust_Translation(*(Vector3*)v * (alpha > 1.0f ? 1.0f : alpha)); |
| 5677 | + m_useExtrapolation = TRUE; |
| 5678 | + } |
| 5679 | + else |
| 5680 | + { |
| 5681 | + m_useExtrapolation = FALSE; |
| 5682 | + } |
| 5683 | +} |
0 commit comments