|
21 | 21 | #include <JumpjetLocomotionClass.h>
|
22 | 22 | #include <FlyLocomotionClass.h>
|
23 | 23 | #include <RocketLocomotionClass.h>
|
| 24 | +#include <TunnelLocomotionClass.h> |
24 | 25 |
|
25 | 26 | DEFINE_HOOK(0x6F64A9, TechnoClass_DrawHealthBar_Hide, 0x5)
|
26 | 27 | {
|
@@ -312,6 +313,49 @@ struct DummyExtHere // TODO: move it
|
312 | 313 | VoxelStruct NoSpawnAltVXL;
|
313 | 314 | };
|
314 | 315 |
|
| 316 | +Matrix3D* __stdcall TunnelLocomotionClass_ShadowMatrix(ILocomotion* iloco, Matrix3D* ret,VoxelIndexKey* key) |
| 317 | +{ |
| 318 | + __assume(iloco != nullptr); |
| 319 | + auto tLoco = static_cast<TunnelLocomotionClass*>(iloco); |
| 320 | + *ret = tLoco->LocomotionClass::Shadow_Matrix(key); |
| 321 | + if (tLoco->State != TunnelLocomotionClass::State::Idle) |
| 322 | + { |
| 323 | + double theta = 0.; |
| 324 | + switch (tLoco->State) |
| 325 | + { |
| 326 | + case TunnelLocomotionClass::State::DiggingIn: |
| 327 | + if (key)key->Invalidate(); |
| 328 | + theta = Math::HalfPi; |
| 329 | + if (auto total = tLoco->DigTimer.Rate) |
| 330 | + theta *= 1.0 - double(tLoco->DigTimer.GetTimeLeft()) / double(total); |
| 331 | + break; |
| 332 | + case TunnelLocomotionClass::State::DugIn: |
| 333 | + theta = Math::HalfPi; |
| 334 | + break; |
| 335 | + case TunnelLocomotionClass::State::PreDigOut: |
| 336 | + theta = -Math::HalfPi; |
| 337 | + break; |
| 338 | + case TunnelLocomotionClass::State::DiggingOut: |
| 339 | + if (key)key->Invalidate(); |
| 340 | + theta = -Math::HalfPi; |
| 341 | + if (auto total = tLoco->DigTimer.Rate) |
| 342 | + theta *= double(tLoco->DigTimer.GetTimeLeft()) / double(total); |
| 343 | + break; |
| 344 | + case TunnelLocomotionClass::State::DugOut: |
| 345 | + if (key)key->Invalidate(); |
| 346 | + theta = Math::HalfPi; |
| 347 | + if (auto total = tLoco->DigTimer.Rate) |
| 348 | + theta *= double(tLoco->DigTimer.GetTimeLeft()) / double(total); |
| 349 | + break; |
| 350 | + default:break; |
| 351 | + } |
| 352 | + ret->ScaleX((float)Math::cos(theta));// I know it's ugly |
| 353 | + } |
| 354 | + return ret; |
| 355 | +} |
| 356 | + |
| 357 | +DEFINE_JUMP(VTABLE, 0x7F5A4C, GET_OFFSET(TunnelLocomotionClass_ShadowMatrix)); |
| 358 | + |
315 | 359 | DEFINE_HOOK(0x73C47A, UnitClass_DrawAsVXL_Shadow, 0x5)
|
316 | 360 | {
|
317 | 361 | GET(UnitClass*, pThis, EBP);
|
|
0 commit comments