Skip to content

Commit

Permalink
Update YRpp
Browse files Browse the repository at this point in the history
  • Loading branch information
chaserli committed Dec 5, 2024
1 parent 1528f0d commit 6f9b1c4
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 40 deletions.
2 changes: 1 addition & 1 deletion YRpp
Submodule YRpp updated 2 files
+1 −1 CCFileClass.h
+4 −6 HouseClass.h
2 changes: 1 addition & 1 deletion src/Ext/Anim/Hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ DEFINE_HOOK(0x42453E, AnimClass_AI_Damage, 0x6)
{
pInvoker = pThis->OwnerObject ? abstract_cast<TechnoClass*>(pThis->OwnerObject) : nullptr;

if (pInvoker)
if (pInvoker && !pOwner)
pOwner = pInvoker->Owner;
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/Ext/TechnoType/Hooks.MatrixOp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand All @@ -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);
Expand All @@ -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);
Expand Down
7 changes: 4 additions & 3 deletions src/Ext/TechnoType/Hooks.Teleport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,20 @@ DEFINE_HOOK(0x7193F6, TeleportLocomotionClass_ILocomotion_Process_WarpoutAnim, 0
duree = std::max(distance / factor, duree);

}
pLocomotor->Timer.Start(duree);

pLinked->WarpingOut = true;

if (auto pUnit = specific_cast<UnitClass*>(pLinked))
{
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;
}

Expand Down
19 changes: 7 additions & 12 deletions src/Misc/Hooks.BugFixes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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<FlyLocomotionClass*>(pThis->Locomotor))
{
if (const auto pLocomotor = static_cast<FlyLocomotionClass*>(pThis->Locomotor.GetInterfacePtr()))
{
double currentSpeed = pThis->GetTechnoType()->Speed * pLocomotor->CurrentSpeed *
TechnoExt::GetCurrentSpeedMultiplier(pThis);

R->EAX(static_cast<int>(currentSpeed));
}
double currentSpeed = pThis->GetTechnoType()->Speed * pLocomotor->CurrentSpeed *
TechnoExt::GetCurrentSpeedMultiplier(pThis);
R->EAX(static_cast<int>(currentSpeed));
}

return 0;
Expand Down Expand Up @@ -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<this_func_sig>(0x448260)(pThis, pHouse, announce);
bool res = reinterpret_cast<bool(__thiscall*)(BuildingClass*, HouseClass*, bool)>(0x448260)(pThis, pHouse, announce);

// Fix : update powered anims
if (res && (pThis->Type->Powered || pThis->Type->PoweredSpecial))
Expand Down
19 changes: 0 additions & 19 deletions src/Utilities/Helpers.Alex.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <typename T, typename U>
bool operator()(T&& lhs, U&& rhs) const
{
return std::less<>()(*lhs, *rhs);
}
};

//! Represents a set of unique items.
template<typename T>
using DistinctCollector = std::set<T, decltype([](T a, T b)
Expand Down

0 comments on commit 6f9b1c4

Please sign in to comment.