mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-21 07:11:16 +00:00
Implement/match LegoPlantManager::FUN_10026410
This commit is contained in:
parent
5a6415e0cf
commit
42cb46fe67
@ -8,6 +8,7 @@
|
|||||||
#include "legoworld.h"
|
#include "legoworld.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "misc/legostorage.h"
|
#include "misc/legostorage.h"
|
||||||
|
#include "mxdebug.h"
|
||||||
#include "mxmisc.h"
|
#include "mxmisc.h"
|
||||||
#include "mxticklemanager.h"
|
#include "mxticklemanager.h"
|
||||||
#include "mxtimer.h"
|
#include "mxtimer.h"
|
||||||
@ -54,6 +55,7 @@ MxU32 g_plantAnimationId[4] = {30, 33, 36, 39};
|
|||||||
char* LegoPlantManager::g_customizeAnimFile = NULL;
|
char* LegoPlantManager::g_customizeAnimFile = NULL;
|
||||||
|
|
||||||
// GLOBAL: LEGO1 0x10103180
|
// GLOBAL: LEGO1 0x10103180
|
||||||
|
// GLOBAL: BETA10 0x1020f4c0
|
||||||
LegoPlantInfo g_plantInfo[81];
|
LegoPlantInfo g_plantInfo[81];
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x10026220
|
// FUNCTION: LEGO1 0x10026220
|
||||||
@ -115,12 +117,74 @@ void LegoPlantManager::Reset(MxS32 p_worldId)
|
|||||||
m_unk0x0c = 0;
|
m_unk0x0c = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x10026410
|
// FUNCTION: LEGO1 0x10026410
|
||||||
// STUB: BETA10 0x100c50e9
|
// FUNCTION: BETA10 0x100c50e9
|
||||||
MxResult LegoPlantManager::FUN_10026410()
|
MxResult LegoPlantManager::FUN_10026410()
|
||||||
{
|
{
|
||||||
// might be similar to LegoBuildingManager::FUN_10030630()
|
// similar to LegoBuildingManager::FUN_10030630()
|
||||||
// TODO
|
|
||||||
|
LegoWorld* world = CurrentWorld();
|
||||||
|
|
||||||
|
if (world == NULL) {
|
||||||
|
return FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (MxS32 i = 0; i < sizeOfArray(g_plantInfo); i++) {
|
||||||
|
if (g_plantInfo[i].m_entity != NULL && g_plantInfo[i].m_name != NULL) {
|
||||||
|
g_plantInfo[i].m_boundary = world->FindPathBoundary(g_plantInfo[i].m_name);
|
||||||
|
|
||||||
|
if (g_plantInfo[i].m_boundary != NULL) {
|
||||||
|
Mx3DPointFloat position(g_plantInfo[i].m_x, g_plantInfo[i].m_y, g_plantInfo[i].m_z);
|
||||||
|
LegoPathBoundary* boundary = g_plantInfo[i].m_boundary;
|
||||||
|
|
||||||
|
for (MxS32 j = 0; j < boundary->GetNumEdges(); j++) {
|
||||||
|
Mx4DPointFloat* normal = boundary->GetEdgeNormal(j);
|
||||||
|
|
||||||
|
if (position.Dot(normal, &position) + (*normal)[3] < -0.001) {
|
||||||
|
MxTrace(
|
||||||
|
"Plant %d shot location (%g, %g, %g) is not in boundary %s.\n",
|
||||||
|
i,
|
||||||
|
position[0],
|
||||||
|
position[1],
|
||||||
|
position[2],
|
||||||
|
boundary->GetName()
|
||||||
|
);
|
||||||
|
g_plantInfo[i].m_boundary = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (g_plantInfo[i].m_boundary != NULL) {
|
||||||
|
Mx4DPointFloat& unk0x14 = *g_plantInfo[i].m_boundary->GetUnknown0x14();
|
||||||
|
|
||||||
|
if (position.Dot(&position, &unk0x14) + unk0x14[3] <= 0.001 &&
|
||||||
|
position.Dot(&position, &unk0x14) + unk0x14[3] >= -0.001) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_plantInfo[i].m_y =
|
||||||
|
-((unk0x14[3] + unk0x14[0] * position[0] + unk0x14[2] * position[2]) / unk0x14[1]);
|
||||||
|
|
||||||
|
MxTrace(
|
||||||
|
"Plant %d shot location (%g, %g, %g) is not on plane of boundary %s...adjusting to (%g, %g, %g)\n",
|
||||||
|
i,
|
||||||
|
position[0],
|
||||||
|
position[1],
|
||||||
|
position[2],
|
||||||
|
g_plantInfo[i].m_boundary->GetName(),
|
||||||
|
position[0],
|
||||||
|
g_plantInfo[i].m_y,
|
||||||
|
position[2]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
MxTrace("Plant %d is in boundary %s that does not exist.\n", i, g_plantInfo[i].m_name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_unk0x0c = TRUE;
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -43,6 +43,7 @@ class LegoWEGEdge : public LegoWEEdge {
|
|||||||
// FUNCTION: BETA10 0x100270c0
|
// FUNCTION: BETA10 0x100270c0
|
||||||
LegoU32 GetFlag0x10() { return m_flags & c_bit5 ? FALSE : TRUE; }
|
LegoU32 GetFlag0x10() { return m_flags & c_bit5 ? FALSE : TRUE; }
|
||||||
|
|
||||||
|
// TODO: Other BETA10 reference at 0x1001c9e0, not sure what is going on
|
||||||
// FUNCTION: BETA10 0x1001ff80
|
// FUNCTION: BETA10 0x1001ff80
|
||||||
Mx4DPointFloat* GetUnknown0x14() { return &m_unk0x14; }
|
Mx4DPointFloat* GetUnknown0x14() { return &m_unk0x14; }
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user