Skip to content

Commit 9c8d2e8

Browse files
committed
Fix cb's multisection destroyer's nospawnalt's shadow
someone mind fixing the dock offset later?
1 parent adc078f commit 9c8d2e8

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

src/Ext/TechnoType/Hooks.cpp

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,17 @@ constexpr double Pade2_2(double in)
301301
* (12. - 6 * s + s * s) / (12. + 6 * s + s * s);
302302
}
303303

304+
// We need to handle Ares turrets/barrels/waterimage/nospawnalt
305+
struct DummyExtHere // TODO: move it
306+
{
307+
char _[0xA4];
308+
std::vector<VoxelStruct> ChargerTurrets;
309+
std::vector<VoxelStruct> ChargerBarrels;
310+
char __[0x120];
311+
UnitTypeClass* WaterImage;
312+
VoxelStruct NoSpawnAltVXL;
313+
};
314+
304315
DEFINE_HOOK(0x73C47A, UnitClass_DrawAsVXL_Shadow, 0x5)
305316
{
306317
GET(UnitClass*, pThis, EBP);
@@ -355,17 +366,6 @@ DEFINE_HOOK(0x73C47A, UnitClass_DrawAsVXL_Shadow, 0x5)
355366
shadow_matrix.Scale((float)Pade2_2(baseScale_log));
356367
}
357368

358-
// We need to handle Ares turrets/barrels
359-
struct DummyExtHere
360-
{
361-
char _[0xA4];
362-
std::vector<VoxelStruct> ChargerTurrets;
363-
std::vector<VoxelStruct> ChargerBarrels;
364-
char __[0x120];
365-
UnitTypeClass* WaterImage;
366-
VoxelStruct NoSpawnAltVXL;
367-
};
368-
369369
auto GetMainVoxel = [&]()
370370
{
371371
if (pType->NoSpawnAlt && pThis->SpawnManager && pThis->SpawnManager->CountDockedSpawns() == 0)
@@ -636,7 +636,7 @@ DEFINE_JUMP(CALL6, 0x4148AB, 0x5F4300);
636636
DEFINE_JUMP(CALL6, 0x4147F3, 0x5F4300);
637637
*/
638638

639-
DEFINE_HOOK(0x7072A1, suka707280_ChooseTheGoddamnMatrix, 0x7)
639+
DEFINE_HOOK(0x7072A1, suka707280_ChooseTheGoddamnMatrix, 0x6)
640640
{
641641
GET(FootClass*, pThis, EBX);//Maybe Techno later
642642
GET(VoxelStruct*, pVXL, EBP);
@@ -660,9 +660,12 @@ DEFINE_HOOK(0x7072A1, suka707280_ChooseTheGoddamnMatrix, 0x7)
660660
if (who_are_you[0] == UnitTypeClass::AbsVTable)
661661
pType = reinterpret_cast<TechnoTypeClass*>(who_are_you);//you are someone else
662662
else
663-
return pThis->TurretAnimFrame % hva->FrameCount;
664-
// you might also be SpawnAlt voxel, but I can't know
665-
// otherwise what would you expect me to do, shift back to ares typeext base and check if ownerobject is technotype?
663+
{
664+
// guess what, someone actually has a multisection nospawnalt
665+
if (!(AresHelper::CanUseAres && pVXL == &reinterpret_cast<DummyExtHere*>(pType->align_2FC)->NoSpawnAltVXL))
666+
return pThis->TurretAnimFrame % hva->FrameCount;
667+
}
668+
// you might also be WaterImage or sth else, but I don't want to care anymore, go fuck yourself
666669
}
667670

668671
// Main body sections

0 commit comments

Comments
 (0)