mirror of
https://github.com/isledecomp/isle.git
synced 2024-12-18 03:56:24 -05:00
Implement/match Act3Ammo::FUN_10053b40
(#1207)
* Implement/match Act3Ammo::FUN_10053b40 * Add Act3Ammo::Remove
This commit is contained in:
parent
6d9fa3ed7f
commit
a2b2b5d734
2 changed files with 59 additions and 9 deletions
|
@ -27,7 +27,7 @@ class Act3Ammo : public LegoPathActor {
|
|||
MxU32 IsValid() { return m_ammoFlag & c_valid; }
|
||||
|
||||
// FUNCTION: BETA10 0x100177b0
|
||||
Mx3DPointFloat* GetUnknown0x160() { return m_unk0x160; }
|
||||
Mx3DPointFloat* GetUnknown0x160() { return m_eq; }
|
||||
|
||||
// FUNCTION: BETA10 0x100177e0
|
||||
MxFloat* GetUnknown0x19c() { return &m_unk0x19c; }
|
||||
|
@ -61,6 +61,7 @@ class Act3Ammo : public LegoPathActor {
|
|||
|
||||
void SetUnknown0x158(MxFloat p_unk0x158) { m_unk0x158 = p_unk0x158; }
|
||||
|
||||
MxResult Remove();
|
||||
MxResult Create(Act3* p_a3, MxU32 p_isPizza, MxS32 p_index);
|
||||
MxResult FUN_10053b40(Vector3& p_srcLoc, Vector3& p_srcDir, Vector3& p_srcUp);
|
||||
MxResult FUN_10053cb0(LegoPathController* p_p, LegoPathBoundary* p_boundary, MxFloat p_unk0x19c);
|
||||
|
@ -70,11 +71,11 @@ class Act3Ammo : public LegoPathActor {
|
|||
// Act3Ammo::`scalar deleting destructor'
|
||||
|
||||
private:
|
||||
MxU16 m_ammoFlag; // 0x154
|
||||
MxFloat m_unk0x158; // 0x158
|
||||
Act3* m_a3; // 0x15c
|
||||
Mx3DPointFloat m_unk0x160[3]; // 0x160
|
||||
MxFloat m_unk0x19c; // 0x19c
|
||||
MxU16 m_ammoFlag; // 0x154
|
||||
MxFloat m_unk0x158; // 0x158
|
||||
Act3* m_a3; // 0x15c
|
||||
Mx3DPointFloat m_eq[3]; // 0x160
|
||||
MxFloat m_unk0x19c; // 0x19c
|
||||
};
|
||||
|
||||
#endif // ACT3AMMO_H
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include "legocachesoundmanager.h"
|
||||
#include "legocharactermanager.h"
|
||||
#include "legopathboundary.h"
|
||||
#include "legopathcontroller.h"
|
||||
#include "legosoundmanager.h"
|
||||
#include "misc.h"
|
||||
#include "roi/legoroi.h"
|
||||
|
@ -39,6 +41,25 @@ void Act3Ammo::Destroy(MxBool p_fromDestructor)
|
|||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10053930
|
||||
// FUNCTION: BETA10 0x1001d7d0
|
||||
MxResult Act3Ammo::Remove()
|
||||
{
|
||||
assert(IsValid());
|
||||
assert(m_roi && m_pathController);
|
||||
|
||||
CharacterManager()->ReleaseActor(m_roi->GetName());
|
||||
m_roi = NULL;
|
||||
|
||||
if (m_boundary != NULL) {
|
||||
m_boundary->RemoveActor(this);
|
||||
}
|
||||
|
||||
m_pathController->RemoveActor(this);
|
||||
m_ammoFlag = 0;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10053980
|
||||
// FUNCTION: BETA10 0x1001d8b3
|
||||
MxResult Act3Ammo::Create(Act3* p_a3, MxU32 p_isPizza, MxS32 p_index)
|
||||
|
@ -80,11 +101,39 @@ MxResult Act3Ammo::Create(Act3* p_a3, MxU32 p_isPizza, MxS32 p_index)
|
|||
return SUCCESS;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10053b40
|
||||
// STUB: BETA10 0x1001db2a
|
||||
// FUNCTION: LEGO1 0x10053b40
|
||||
// FUNCTION: BETA10 0x1001db2a
|
||||
MxResult Act3Ammo::FUN_10053b40(Vector3& p_srcLoc, Vector3& p_srcDir, Vector3& p_srcUp)
|
||||
{
|
||||
// TODO
|
||||
assert(p_srcDir[1] != 0);
|
||||
|
||||
MxFloat local1c = -(p_srcLoc[1] / p_srcDir[1]);
|
||||
Mx3DPointFloat local18(p_srcDir);
|
||||
Mx3DPointFloat local34;
|
||||
|
||||
local18 *= local1c;
|
||||
local18 += p_srcLoc;
|
||||
|
||||
local34[0] = local34[2] = 0.0f;
|
||||
local34[1] = -1.0f;
|
||||
|
||||
m_eq[1] = p_srcUp;
|
||||
m_eq[2] = p_srcLoc;
|
||||
|
||||
Mx3DPointFloat local48(local34);
|
||||
local48 -= m_eq[1];
|
||||
|
||||
for (MxS32 i = 0; i < 3; i++) {
|
||||
if (local18[0] == p_srcLoc[0]) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
m_eq[0][i] = (local48[i] * local48[i] + local48[i] * m_eq[1][i] * 2.0f) / ((local18[i] - p_srcLoc[i]) * 4.0f);
|
||||
}
|
||||
|
||||
assert(m_eq[0][0] > 0.000001 || m_eq[0][0] < -0.000001);
|
||||
|
||||
m_unk0x19c = local48[0] / (m_eq[0][0] * 2.0f);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue