mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-22 15:48:09 -05:00
Bootstrap LegoPlantManager, add plants data (#1038)
* Bootstrap LegoPlantManager, add plants data * Naming * Move * Fix
This commit is contained in:
parent
e4e0f4e4d3
commit
1a46d370ec
7 changed files with 2048 additions and 18 deletions
|
@ -330,6 +330,7 @@ add_library(lego1 SHARED
|
||||||
LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp
|
LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp
|
||||||
LEGO1/lego/legoomni/src/common/legophoneme.cpp
|
LEGO1/lego/legoomni/src/common/legophoneme.cpp
|
||||||
LEGO1/lego/legoomni/src/common/legoplantmanager.cpp
|
LEGO1/lego/legoomni/src/common/legoplantmanager.cpp
|
||||||
|
LEGO1/lego/legoomni/src/common/legoplants.cpp
|
||||||
LEGO1/lego/legoomni/src/common/legostate.cpp
|
LEGO1/lego/legoomni/src/common/legostate.cpp
|
||||||
LEGO1/lego/legoomni/src/common/legotextureinfo.cpp
|
LEGO1/lego/legoomni/src/common/legotextureinfo.cpp
|
||||||
LEGO1/lego/legoomni/src/common/legoutils.cpp
|
LEGO1/lego/legoomni/src/common/legoutils.cpp
|
||||||
|
|
|
@ -22,12 +22,12 @@ struct LegoBuildingInfo {
|
||||||
};
|
};
|
||||||
|
|
||||||
LegoEntity* m_entity; // 0x00
|
LegoEntity* m_entity; // 0x00
|
||||||
const char* m_hausName; // 0x04
|
const char* m_variant; // 0x04
|
||||||
MxU32 m_sound; // 0x08
|
MxU32 m_sound; // 0x08
|
||||||
MxU32 m_move; // 0x0c
|
MxU32 m_move; // 0x0c
|
||||||
MxU8 m_mood; // 0x10
|
MxU8 m_mood; // 0x10
|
||||||
MxS8 m_unk0x11; // 0x11
|
MxS8 m_unk0x11; // 0x11
|
||||||
MxS8 m_initialUnk0x11; // 0x12 = initial value loaded to m_unk0x11
|
MxS8 m_initialUnk0x11; // 0x12 - initial value loaded to m_unk0x11
|
||||||
MxU8 m_flags; // 0x13
|
MxU8 m_flags; // 0x13
|
||||||
float m_unk0x014; // 0x14
|
float m_unk0x014; // 0x14
|
||||||
const char* m_unk0x18; // 0x18
|
const char* m_unk0x18; // 0x18
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "mxcore.h"
|
#include "mxcore.h"
|
||||||
|
|
||||||
class LegoEntity;
|
class LegoEntity;
|
||||||
|
class LegoPathBoundary;
|
||||||
class LegoROI;
|
class LegoROI;
|
||||||
class LegoStorage;
|
class LegoStorage;
|
||||||
|
|
||||||
|
@ -27,7 +28,7 @@ class LegoPlantManager : public MxCore {
|
||||||
void Init();
|
void Init();
|
||||||
void FUN_10026360(MxS32 p_scriptIndex);
|
void FUN_10026360(MxS32 p_scriptIndex);
|
||||||
void FUN_100263a0(undefined4 p_und);
|
void FUN_100263a0(undefined4 p_und);
|
||||||
void Write(LegoStorage* p_storage);
|
MxResult Write(LegoStorage* p_storage);
|
||||||
MxResult Read(LegoStorage* p_storage);
|
MxResult Read(LegoStorage* p_storage);
|
||||||
MxBool SwitchColor(LegoEntity* p_entity);
|
MxBool SwitchColor(LegoEntity* p_entity);
|
||||||
MxBool SwitchVariant(LegoEntity* p_entity);
|
MxBool SwitchVariant(LegoEntity* p_entity);
|
||||||
|
@ -48,7 +49,11 @@ class LegoPlantManager : public MxCore {
|
||||||
private:
|
private:
|
||||||
static char* g_customizeAnimFile;
|
static char* g_customizeAnimFile;
|
||||||
|
|
||||||
undefined m_unk0x08[0x24]; // 0x08
|
undefined4 m_unk0x08; // 0x08
|
||||||
|
undefined m_unk0x0c; // 0x0c
|
||||||
|
undefined m_unk0x10[0x17]; // 0x10
|
||||||
|
undefined m_unk0x24; // 0x24
|
||||||
|
undefined4 m_unk0x28; // 0x28
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LEGOPLANTMANAGER_H
|
#endif // LEGOPLANTMANAGER_H
|
||||||
|
|
58
LEGO1/lego/legoomni/include/legoplants.h
Normal file
58
LEGO1/lego/legoomni/include/legoplants.h
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
#ifndef LEGOPLANTS_H
|
||||||
|
#define LEGOPLANTS_H
|
||||||
|
|
||||||
|
#include "decomp.h"
|
||||||
|
#include "mxtypes.h"
|
||||||
|
|
||||||
|
class LegoEntity;
|
||||||
|
class LegoPathBoundary;
|
||||||
|
|
||||||
|
// SIZE 0x54
|
||||||
|
struct LegoPlantInfo {
|
||||||
|
enum {
|
||||||
|
c_flag1 = 0x01,
|
||||||
|
c_flag2 = 0x02,
|
||||||
|
c_flag5 = 0x10,
|
||||||
|
c_flag6 = 0x20,
|
||||||
|
c_flag16 = 0x8000,
|
||||||
|
c_flag17 = 0x10000
|
||||||
|
};
|
||||||
|
|
||||||
|
enum Variant {
|
||||||
|
e_flower = 0,
|
||||||
|
e_tree,
|
||||||
|
e_bush,
|
||||||
|
e_palm
|
||||||
|
};
|
||||||
|
|
||||||
|
enum Color {
|
||||||
|
e_white = 0,
|
||||||
|
e_black,
|
||||||
|
e_yellow,
|
||||||
|
e_red,
|
||||||
|
e_green
|
||||||
|
};
|
||||||
|
|
||||||
|
LegoEntity* m_entity; // 0x00
|
||||||
|
MxU32 m_flags; // 0x04
|
||||||
|
Variant m_variant; // 0x08
|
||||||
|
MxU32 m_sound; // 0x0c
|
||||||
|
MxU32 m_move; // 0x10
|
||||||
|
MxU8 m_mood; // 0x14
|
||||||
|
MxU8 m_color; // 0x15 - see enum for possible values
|
||||||
|
MxS8 m_unk0x16; // 0x16
|
||||||
|
MxS8 m_initialUnk0x16; // 0x17 - initial value loaded to m_unk0x16
|
||||||
|
const char* m_name; // 0x18
|
||||||
|
undefined4 m_unk0x1c; // 0x1c
|
||||||
|
float m_x; // 0x20
|
||||||
|
float m_y; // 0x24
|
||||||
|
float m_z; // 0x28
|
||||||
|
LegoPathBoundary* m_boundary; // 0x2c
|
||||||
|
float m_position[3]; // 0x30
|
||||||
|
float m_direction[3]; // 0x3c
|
||||||
|
float m_up[3]; // 0x48
|
||||||
|
};
|
||||||
|
|
||||||
|
extern LegoPlantInfo g_plantInfoInit[81];
|
||||||
|
|
||||||
|
#endif // LEGOPLANTS_H
|
|
@ -18,7 +18,7 @@ DECOMP_SIZE_ASSERT(LegoBuildingInfo, 0x2c)
|
||||||
DECOMP_SIZE_ASSERT(LegoBuildingManager::AnimEntry, 0x14)
|
DECOMP_SIZE_ASSERT(LegoBuildingManager::AnimEntry, 0x14)
|
||||||
|
|
||||||
// GLOBAL: LEGO1 0x100f3410
|
// GLOBAL: LEGO1 0x100f3410
|
||||||
const char* g_buildingInfoHausName[5] = {
|
const char* g_buildingInfoVariants[5] = {
|
||||||
"haus1",
|
"haus1",
|
||||||
"haus4",
|
"haus4",
|
||||||
"haus5",
|
"haus5",
|
||||||
|
@ -238,7 +238,7 @@ LegoBuildingManager::LegoBuildingManager()
|
||||||
// FUNCTION: LEGO1 0x1002f960
|
// FUNCTION: LEGO1 0x1002f960
|
||||||
LegoBuildingManager::~LegoBuildingManager()
|
LegoBuildingManager::~LegoBuildingManager()
|
||||||
{
|
{
|
||||||
delete g_customizeAnimFile;
|
delete[] g_customizeAnimFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x1002f9d0
|
// FUNCTION: LEGO1 0x1002f9d0
|
||||||
|
@ -267,15 +267,15 @@ void LegoBuildingManager::FUN_1002fa00()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_buildingManagerConfig <= 1) {
|
if (g_buildingManagerConfig <= 1) {
|
||||||
LegoEntity* entity = (LegoEntity*) world->Find("MxEntity", g_buildingInfoHausName[0]);
|
LegoEntity* entity = (LegoEntity*) world->Find("MxEntity", g_buildingInfoVariants[0]);
|
||||||
if (entity) {
|
if (entity) {
|
||||||
entity->GetROI()->SetVisibility(TRUE);
|
entity->GetROI()->SetVisibility(TRUE);
|
||||||
m_unk0x09 = 0;
|
m_unk0x09 = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
for (i = 0; i < sizeOfArray(g_buildingInfoHausName); i++) {
|
for (i = 0; i < sizeOfArray(g_buildingInfoVariants); i++) {
|
||||||
LegoEntity* entity = (LegoEntity*) world->Find("MxEntity", g_buildingInfoHausName[i]);
|
LegoEntity* entity = (LegoEntity*) world->Find("MxEntity", g_buildingInfoVariants[i]);
|
||||||
if (entity) {
|
if (entity) {
|
||||||
entity->GetROI()->SetVisibility(m_nextVariant == i);
|
entity->GetROI()->SetVisibility(m_nextVariant == i);
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,7 @@ void LegoBuildingManager::FUN_1002fa00()
|
||||||
// FUNCTION: BETA10 0x10063b88
|
// FUNCTION: BETA10 0x10063b88
|
||||||
void LegoBuildingManager::UpdatePosition(MxS32 p_index, LegoWorld* p_world)
|
void LegoBuildingManager::UpdatePosition(MxS32 p_index, LegoWorld* p_world)
|
||||||
{
|
{
|
||||||
LegoEntity* entity = (LegoEntity*) p_world->Find("MxEntity", g_buildingInfo[p_index].m_hausName);
|
LegoEntity* entity = (LegoEntity*) p_world->Find("MxEntity", g_buildingInfo[p_index].m_variant);
|
||||||
|
|
||||||
if (entity) {
|
if (entity) {
|
||||||
entity->SetType(LegoEntity::e_building);
|
entity->SetType(LegoEntity::e_building);
|
||||||
|
@ -451,12 +451,12 @@ MxBool LegoBuildingManager::SwitchVariant(LegoEntity* p_entity)
|
||||||
|
|
||||||
if (info != NULL && info->m_flags & LegoBuildingInfo::c_hasVariants && info->m_unk0x11 == -1) {
|
if (info != NULL && info->m_flags & LegoBuildingInfo::c_hasVariants && info->m_unk0x11 == -1) {
|
||||||
LegoROI* roi = p_entity->GetROI();
|
LegoROI* roi = p_entity->GetROI();
|
||||||
if (++m_nextVariant >= sizeOfArray(g_buildingInfoHausName)) {
|
if (++m_nextVariant >= sizeOfArray(g_buildingInfoVariants)) {
|
||||||
m_nextVariant = 0;
|
m_nextVariant = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
roi->SetVisibility(FALSE);
|
roi->SetVisibility(FALSE);
|
||||||
info->m_hausName = g_buildingInfoHausName[m_nextVariant];
|
info->m_variant = g_buildingInfoVariants[m_nextVariant];
|
||||||
UpdatePosition(12, CurrentWorld());
|
UpdatePosition(12, CurrentWorld());
|
||||||
|
|
||||||
if (info->m_entity != NULL) {
|
if (info->m_entity != NULL) {
|
||||||
|
|
|
@ -1,31 +1,43 @@
|
||||||
#include "legoplantmanager.h"
|
#include "legoplantmanager.h"
|
||||||
|
|
||||||
#include "legoentity.h"
|
#include "legoentity.h"
|
||||||
|
#include "legoplants.h"
|
||||||
|
|
||||||
DECOMP_SIZE_ASSERT(LegoPlantManager, 0x2c)
|
DECOMP_SIZE_ASSERT(LegoPlantManager, 0x2c)
|
||||||
|
|
||||||
// GLOBAL: LEGO1 0x100f3188
|
// GLOBAL: LEGO1 0x100f3188
|
||||||
char* LegoPlantManager::g_customizeAnimFile = NULL;
|
char* LegoPlantManager::g_customizeAnimFile = NULL;
|
||||||
|
|
||||||
|
// GLOBAL: LEGO1 0x10103180
|
||||||
|
LegoPlantInfo g_plantInfo[81];
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x10026220
|
// FUNCTION: LEGO1 0x10026220
|
||||||
LegoPlantManager::LegoPlantManager()
|
LegoPlantManager::LegoPlantManager()
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x100262c0
|
// FUNCTION: LEGO1 0x100262c0
|
||||||
LegoPlantManager::~LegoPlantManager()
|
LegoPlantManager::~LegoPlantManager()
|
||||||
{
|
{
|
||||||
// TODO
|
delete[] g_customizeAnimFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x10026330
|
// FUNCTION: LEGO1 0x10026330
|
||||||
|
// FUNCTION: BETA10 0x100c4f90
|
||||||
void LegoPlantManager::Init()
|
void LegoPlantManager::Init()
|
||||||
{
|
{
|
||||||
// TODO
|
for (MxS32 i = 0; i < sizeOfArray(g_plantInfo); i++) {
|
||||||
|
g_plantInfo[i] = g_plantInfoInit[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
m_unk0x08 = -1;
|
||||||
|
m_unk0x0c = 0;
|
||||||
|
m_unk0x24 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x10026360
|
// STUB: LEGO1 0x10026360
|
||||||
|
// FUNCTION: BETA10 0x100c5032
|
||||||
void LegoPlantManager::FUN_10026360(MxS32 p_scriptIndex)
|
void LegoPlantManager::FUN_10026360(MxS32 p_scriptIndex)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
|
@ -38,14 +50,18 @@ void LegoPlantManager::FUN_100263a0(undefined4 p_und)
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x10026720
|
// STUB: LEGO1 0x10026720
|
||||||
void LegoPlantManager::Write(LegoStorage* p_storage)
|
// FUNCTION: BETA10 0x100c5918
|
||||||
|
MxResult LegoPlantManager::Write(LegoStorage* p_storage)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
// STUB: LEGO1 0x100267b0
|
// STUB: LEGO1 0x100267b0
|
||||||
|
// FUNCTION: BETA10 0x100c5a76
|
||||||
MxResult LegoPlantManager::Read(LegoStorage* p_storage)
|
MxResult LegoPlantManager::Read(LegoStorage* p_storage)
|
||||||
{
|
{
|
||||||
|
// TODO
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,7 +143,6 @@ void LegoPlantManager::FUN_10026c50(LegoEntity* p_entity)
|
||||||
MxResult LegoPlantManager::Tickle()
|
MxResult LegoPlantManager::Tickle()
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1951
LEGO1/lego/legoomni/src/common/legoplants.cpp
Normal file
1951
LEGO1/lego/legoomni/src/common/legoplants.cpp
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue