From 6f9b1c4762fb0772b39c9502f750cfafd15b71d3 Mon Sep 17 00:00:00 2001 From: Trsdy <914137150@qq.com> Date: Thu, 5 Dec 2024 23:56:04 +0800 Subject: [PATCH] Update YRpp --- YRpp | 2 +- src/Ext/Anim/Hooks.cpp | 2 +- src/Ext/TechnoType/Hooks.MatrixOp.cpp | 8 ++++---- src/Ext/TechnoType/Hooks.Teleport.cpp | 7 ++++--- src/Misc/Hooks.BugFixes.cpp | 19 +++++++------------ src/Utilities/Helpers.Alex.h | 19 ------------------- 6 files changed, 17 insertions(+), 40 deletions(-) diff --git a/YRpp b/YRpp index a6c07ac165..0b7b61a49c 160000 --- a/YRpp +++ b/YRpp @@ -1 +1 @@ -Subproject commit a6c07ac1656034406d038e04ec6dcadddd071024 +Subproject commit 0b7b61a49c2a5890fee918edcdc58008814f79f7 diff --git a/src/Ext/Anim/Hooks.cpp b/src/Ext/Anim/Hooks.cpp index c761a10274..ca7db07d70 100644 --- a/src/Ext/Anim/Hooks.cpp +++ b/src/Ext/Anim/Hooks.cpp @@ -106,7 +106,7 @@ DEFINE_HOOK(0x42453E, AnimClass_AI_Damage, 0x6) { pInvoker = pThis->OwnerObject ? abstract_cast(pThis->OwnerObject) : nullptr; - if (pInvoker) + if (pInvoker && !pOwner) pOwner = pInvoker->Owner; } } diff --git a/src/Ext/TechnoType/Hooks.MatrixOp.cpp b/src/Ext/TechnoType/Hooks.MatrixOp.cpp index 5a3238a2c5..51cde07e68 100644 --- a/src/Ext/TechnoType/Hooks.MatrixOp.cpp +++ b/src/Ext/TechnoType/Hooks.MatrixOp.cpp @@ -32,7 +32,7 @@ DEFINE_HOOK(0x6F3C56, TechnoClass_GetFLH_TurretMultiOffset, 0x0) return 0x6F3C6D; } -DEFINE_HOOK(0x6F3E6E, FootClass_firecoord_6F3D60_TurretMultiOffset, 0x0) +DEFINE_HOOK(0x6F3E6E, TechnoClass_ActionLines_TurretMultiOffset, 0x0) { LEA_STACK(Matrix3D*, mtx, STACK_OFFSET(0xCC, -0x90)); GET(TechnoTypeClass*, technoType, EBP); @@ -48,7 +48,7 @@ DEFINE_HOOK(0x73B780, UnitClass_DrawVXL_TurretMultiOffset, 0x0) auto const pTypeData = TechnoTypeExt::ExtMap.Find(technoType); - if (pTypeData && *pTypeData->TurretOffset.GetEx() == CoordStruct { 0, 0, 0 }) + if (*pTypeData->TurretOffset.GetEx() == CoordStruct { 0, 0, 0 }) return 0x73B78A; return 0x73B790; @@ -65,7 +65,7 @@ DEFINE_HOOK(0x73BA4C, UnitClass_DrawVXL_TurretMultiOffset1, 0x0) return 0x73BA68; } -DEFINE_HOOK(0x73C890, UnitClass_Draw_1_TurretMultiOffset, 0x0) +DEFINE_HOOK(0x73C890, UnitClass_DrawSHP_BarrelMultiOffset, 0x0) { LEA_STACK(Matrix3D*, mtx, 0x80); GET(TechnoTypeClass*, technoType, EAX); @@ -75,7 +75,7 @@ DEFINE_HOOK(0x73C890, UnitClass_Draw_1_TurretMultiOffset, 0x0) return 0x73C8B7; } -DEFINE_HOOK(0x43E0C4, BuildingClass_Draw_43DA80_TurretMultiOffset, 0x0) +DEFINE_HOOK(0x43E0C4, BuildingClass_Draw_VXLTurretMultiOffset, 0x0) { LEA_STACK(Matrix3D*, mtx, 0x60); GET(TechnoTypeClass*, technoType, EDX); diff --git a/src/Ext/TechnoType/Hooks.Teleport.cpp b/src/Ext/TechnoType/Hooks.Teleport.cpp index be308164b6..c842f9ebab 100644 --- a/src/Ext/TechnoType/Hooks.Teleport.cpp +++ b/src/Ext/TechnoType/Hooks.Teleport.cpp @@ -49,7 +49,6 @@ DEFINE_HOOK(0x7193F6, TeleportLocomotionClass_ILocomotion_Process_WarpoutAnim, 0 duree = std::max(distance / factor, duree); } - pLocomotor->Timer.Start(duree); pLinked->WarpingOut = true; @@ -57,11 +56,13 @@ DEFINE_HOOK(0x7193F6, TeleportLocomotionClass_ILocomotion_Process_WarpoutAnim, 0 { if (pUnit->Type->Harvester || pUnit->Type->Weeder) { - pLocomotor->Timer.Start(0); + duree = 0; pLinked->WarpingOut = false; } } - linkedExt->LastWarpInDelay = std::max(pLocomotor->Timer.GetTimeLeft(), linkedExt->LastWarpInDelay); + + pLocomotor->Timer.Start(duree); + linkedExt->LastWarpInDelay = std::max(duree, linkedExt->LastWarpInDelay); return 0x7195BC; } diff --git a/src/Misc/Hooks.BugFixes.cpp b/src/Misc/Hooks.BugFixes.cpp index f74cd29e03..c5bd97b7ca 100644 --- a/src/Misc/Hooks.BugFixes.cpp +++ b/src/Misc/Hooks.BugFixes.cpp @@ -252,7 +252,7 @@ DEFINE_HOOK(0x51BB6E, TechnoClass_AI_TemporalTargetingMe_Fix, 0x6) // InfantryCl if (pThis->TemporalTargetingMe) { // Also check for vftable here to guarantee the TemporalClass not being destoryed already. - if (VTable::Get(pThis->TemporalTargetingMe) == 0x7F5180) // TemporalClass::`vtable` + if (VTable::Get(pThis->TemporalTargetingMe) == TemporalClass::AbsVTable) pThis->TemporalTargetingMe->Update(); else // It should had being warped out, delete this object { @@ -332,15 +332,11 @@ DEFINE_HOOK(0x415F5C, AircraftClass_FireAt_SpeedModifiers, 0xA) { GET(AircraftClass*, pThis, EDI); - if (pThis->Type->Locomotor == LocomotionClass::CLSIDs::Fly) + if (const auto pLocomotor = locomotion_cast(pThis->Locomotor)) { - if (const auto pLocomotor = static_cast(pThis->Locomotor.GetInterfacePtr())) - { - double currentSpeed = pThis->GetTechnoType()->Speed * pLocomotor->CurrentSpeed * - TechnoExt::GetCurrentSpeedMultiplier(pThis); - - R->EAX(static_cast(currentSpeed)); - } + double currentSpeed = pThis->GetTechnoType()->Speed * pLocomotor->CurrentSpeed * + TechnoExt::GetCurrentSpeedMultiplier(pThis); + R->EAX(static_cast(currentSpeed)); } return 0; @@ -765,10 +761,9 @@ DEFINE_HOOK(0x6D9781, Tactical_RenderLayers_DrawInfoTipAndSpiedSelection, 0x5) bool __fastcall BuildingClass_SetOwningHouse_Wrapper(BuildingClass* pThis, void*, HouseClass* pHouse, bool announce) { // Fix : Suppress capture EVA event if ConsideredVehicle=yes - announce = announce && !pThis->Type->IsVehicle(); + if(announce) announce = pThis->IsStrange(); - using this_func_sig = bool(__thiscall*)(BuildingClass*, HouseClass*, bool); - bool res = reinterpret_cast(0x448260)(pThis, pHouse, announce); + bool res = reinterpret_cast(0x448260)(pThis, pHouse, announce); // Fix : update powered anims if (res && (pThis->Type->Powered || pThis->Type->PoweredSpecial)) diff --git a/src/Utilities/Helpers.Alex.h b/src/Utilities/Helpers.Alex.h index 7f51006651..0584aac7bd 100644 --- a/src/Utilities/Helpers.Alex.h +++ b/src/Utilities/Helpers.Alex.h @@ -53,25 +53,6 @@ namespace Helpers namespace Alex { - - //! Less comparison for pointer types. - /*! - Dereferences the values before comparing them using std::less. - - This compares the actual objects pointed to instead of their - arbitrary pointer values. - */ - struct deref_less - { - using is_transparent = void; - - template - bool operator()(T&& lhs, U&& rhs) const - { - return std::less<>()(*lhs, *rhs); - } - }; - //! Represents a set of unique items. template using DistinctCollector = std::set