Skip to content

Commit 4c115b5

Browse files
committed
Update YRPP
1 parent c3d9f40 commit 4c115b5

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

src/Ext/Anim/Hooks.AnimCreateUnit.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -117,20 +117,20 @@ DEFINE_HOOK(0x424932, AnimClass_AI_CreateUnit_ActualAffects, 0x6)
117117
if (!pBuilding)
118118
{
119119
++Unsorted::IKnowWhatImDoing;
120-
success = pTechno->Unlimbo(location, resultingFacing);
120+
success = pTechno->Unlimbo(location, static_cast<DirType>(resultingFacing));
121121
--Unsorted::IKnowWhatImDoing;
122122
}
123123
else
124124
{
125-
success = pTechno->Unlimbo(location, resultingFacing);
125+
success = pTechno->Unlimbo(location, static_cast<DirType>(resultingFacing));
126126
}
127127

128128
if (success)
129129
{
130130
if (pTechno->HasTurret() && pExt->FromDeathUnit && pExt->DeathUnitHasTurret && pTypeExt->CreateUnit_InheritTurretFacings.Get())
131-
pTechno->SecondaryFacing.set(pExt->DeathUnitTurretFacing);
131+
pTechno->SecondaryFacing.Set_Current(pExt->DeathUnitTurretFacing);
132132

133-
Debug::Log("[" __FUNCTION__ "] Stored Turret Facing %d \n", pExt->DeathUnitTurretFacing.value256());
133+
Debug::Log("[" __FUNCTION__ "] Stored Turret Facing %d \n", pExt->DeathUnitTurretFacing.GetFacing<256>());
134134

135135
if (!pTechno->InLimbo)
136136
pTechno->QueueMission(pTypeExt->CreateUnit_Mission.Get(), false);

src/Ext/AnimType/Body.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const void AnimTypeExt::ProcessDestroyAnims(UnitClass* pThis, TechnoClass* pKill
4848

4949
if (pThis->Type->DestroyAnim.Count > 0)
5050
{
51-
auto const facing = pThis->PrimaryFacing.current().value256();
51+
auto const facing = pThis->PrimaryFacing.Current().GetFacing<256>();
5252
AnimTypeClass* pAnimType = nullptr;
5353
auto const pTypeExt = TechnoTypeExt::ExtMap.Find(pThis->Type);
5454

@@ -89,14 +89,14 @@ const void AnimTypeExt::ProcessDestroyAnims(UnitClass* pThis, TechnoClass* pKill
8989
pAnimExt->FromDeathUnit = true;
9090

9191
if (pAnimTypeExt->CreateUnit_InheritDeathFacings.Get())
92-
pAnimExt->DeathUnitFacing = facing;
92+
pAnimExt->DeathUnitFacing = static_cast<short>(facing);
9393

9494
if (pAnimTypeExt->CreateUnit_InheritTurretFacings.Get())
9595
{
9696
if (pThis->HasTurret())
9797
{
9898
pAnimExt->DeathUnitHasTurret = true;
99-
pAnimExt->DeathUnitTurretFacing = pThis->SecondaryFacing.current();
99+
pAnimExt->DeathUnitTurretFacing = pThis->SecondaryFacing.Current();
100100
}
101101
}
102102
}

src/Ext/Techno/Body.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,8 @@ CoordStruct TechnoExt::GetFLHAbsoluteCoords(TechnoClass* pThis, CoordStruct pCoo
431431
{
432432
TechnoTypeExt::ApplyTurretOffset(pType, &mtx);
433433

434-
double turretRad = (pThis->TurretFacing().value32() - 8) * -(Math::Pi / 16);
435-
double bodyRad = (pThis->PrimaryFacing.current().value32() - 8) * -(Math::Pi / 16);
434+
double turretRad = (pThis->TurretFacing().GetFacing<32>() - 8) * -(Math::Pi / 16);
435+
double bodyRad = (pThis->PrimaryFacing.Current().GetFacing<32>() - 8) * -(Math::Pi / 16);
436436
float angle = (float)(turretRad - bodyRad);
437437

438438
mtx.RotateZ(angle);

src/Ext/Unit/Hooks.Jumpjet.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ DEFINE_HOOK(0x54BD93, JumpjetLocomotionClass_State2_54BD30_TurnToTarget, 0x6)
5050
{
5151
CoordStruct& source = pThis->Location;
5252
CoordStruct target = pTarget->GetCoords();
53-
DirStruct tgtDir = DirStruct(Math::arctanfoo(source.Y - target.Y, target.X - source.X));
53+
DirStruct tgtDir = DirStruct { Math::atan2(source.Y - target.Y, target.X - source.X) };
5454

55-
if (pThis->GetRealFacing().value32() != tgtDir.value32())
56-
pLoco->LocomotionFacing.turn(tgtDir);
55+
if (pThis->GetRealFacing().GetFacing<32>() != tgtDir.GetFacing<32>())
56+
pLoco->LocomotionFacing.Set_Desired(tgtDir);
5757
}
5858
}
5959

@@ -68,8 +68,8 @@ DEFINE_HOOK(0x736BF3, UnitClass_UpdateRotation_TurretFacing, 0x6)
6868
// Not sure if jumpjet check is really needed
6969
if (!pThis->Target && !pThis->Type->TurretSpins && pThis->Type->JumpJet)
7070
{
71-
pThis->SecondaryFacing.turn(pThis->PrimaryFacing.current());
72-
pThis->unknown_49C = pThis->PrimaryFacing.in_motion();
71+
pThis->SecondaryFacing.Set_Desired(pThis->PrimaryFacing.Current());
72+
pThis->unknown_49C = pThis->PrimaryFacing.Is_Rotating();
7373
return 0x736C09;
7474
}
7575

0 commit comments

Comments
 (0)