mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-23 05:19:47 +00:00
Implement/match LegoPlantManager::ScheduleAnimation (#1051)
* Implement/match LegoPlantManager::ScheduleAnimation * Add assert
This commit is contained in:
parent
a21fd5975c
commit
9ba05d021d
@ -45,7 +45,7 @@ public:
|
||||
struct AnimEntry {
|
||||
LegoEntity* m_entity; // 0x00
|
||||
LegoROI* m_roi; // 0x04
|
||||
LegoTime m_time; // 0x08
|
||||
MxLong m_time; // 0x08
|
||||
float m_unk0x0c; // 0x0c
|
||||
MxBool m_muted; // 0x10
|
||||
};
|
||||
@ -81,7 +81,7 @@ public:
|
||||
MxBool FUN_10030000(LegoEntity* p_entity);
|
||||
MxBool FUN_10030030(MxS32 p_index);
|
||||
MxBool FUN_10030110(LegoBuildingInfo* p_data);
|
||||
void ScheduleAnimation(LegoEntity* p_entity, MxU32 p_length, MxBool p_haveSound, MxBool p_unk0x28);
|
||||
void ScheduleAnimation(LegoEntity* p_entity, MxLong p_length, MxBool p_haveSound, MxBool p_unk0x28);
|
||||
void FUN_10030590();
|
||||
void AdjustHeight(MxS32 p_index);
|
||||
MxResult FUN_10030630();
|
||||
|
@ -15,6 +15,13 @@ class LegoWorld;
|
||||
// SIZE 0x2c
|
||||
class LegoPlantManager : public MxCore {
|
||||
public:
|
||||
// SIZE 0x0c
|
||||
struct AnimEntry {
|
||||
LegoEntity* m_entity; // 0x00
|
||||
LegoROI* m_roi; // 0x04
|
||||
MxLong m_time; // 0x08
|
||||
};
|
||||
|
||||
LegoPlantManager();
|
||||
~LegoPlantManager() override; // vtable+0x00
|
||||
|
||||
@ -40,6 +47,7 @@ public:
|
||||
MxU32 GetAnimationId(LegoEntity* p_entity);
|
||||
MxU32 GetSoundId(LegoEntity* p_entity, MxBool p_state);
|
||||
MxBool FUN_10026c50(LegoEntity* p_entity);
|
||||
void ScheduleAnimation(LegoEntity* p_entity, MxLong p_length);
|
||||
void FUN_10027120();
|
||||
|
||||
static void SetCustomizeAnimFile(const char* p_value);
|
||||
@ -54,6 +62,7 @@ private:
|
||||
void FUN_10026860(MxS32 p_index);
|
||||
LegoPlantInfo* GetInfo(LegoEntity* p_entity);
|
||||
MxBool FUN_10026c80(MxS32 p_index);
|
||||
void FUN_100271b0(LegoEntity* p_entity, MxS32 p_adjust);
|
||||
|
||||
static char* g_customizeAnimFile;
|
||||
static MxS32 g_maxMove[4];
|
||||
@ -61,9 +70,9 @@ private:
|
||||
|
||||
MxS32 m_worldId; // 0x08
|
||||
undefined m_unk0x0c; // 0x0c
|
||||
undefined* m_unk0x10[5]; // 0x10
|
||||
MxS8 m_unk0x24; // 0x24
|
||||
undefined4 m_unk0x28; // 0x28
|
||||
AnimEntry* m_entries[5]; // 0x10
|
||||
MxS8 m_numEntries; // 0x24
|
||||
LegoWorld* m_world; // 0x28
|
||||
};
|
||||
|
||||
#endif // LEGOPLANTMANAGER_H
|
||||
|
@ -613,7 +613,7 @@ MxBool LegoBuildingManager::FUN_10030110(LegoBuildingInfo* p_data)
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10030150
|
||||
void LegoBuildingManager::ScheduleAnimation(LegoEntity* p_entity, MxU32 p_length, MxBool p_haveSound, MxBool p_unk0x28)
|
||||
void LegoBuildingManager::ScheduleAnimation(LegoEntity* p_entity, MxLong p_length, MxBool p_haveSound, MxBool p_unk0x28)
|
||||
{
|
||||
m_world = CurrentWorld();
|
||||
|
||||
@ -633,7 +633,7 @@ void LegoBuildingManager::ScheduleAnimation(LegoEntity* p_entity, MxU32 p_length
|
||||
entry->m_entity = p_entity;
|
||||
entry->m_roi = p_entity->GetROI();
|
||||
entry->m_time = Timer()->GetTime() + p_length + 1000;
|
||||
entry->m_unk0x0c = entry->m_roi->GetLocal2World()[3][1];
|
||||
entry->m_unk0x0c = entry->m_roi->GetWorldPosition()[1];
|
||||
entry->m_muted = p_haveSound == FALSE;
|
||||
FUN_100307b0(p_entity, -2);
|
||||
}
|
||||
|
@ -8,6 +8,9 @@
|
||||
#include "legoworld.h"
|
||||
#include "misc.h"
|
||||
#include "misc/legostorage.h"
|
||||
#include "mxmisc.h"
|
||||
#include "mxticklemanager.h"
|
||||
#include "mxtimer.h"
|
||||
#include "scripts.h"
|
||||
#include "sndanim_actions.h"
|
||||
#include "viewmanager/viewmanager.h"
|
||||
@ -15,6 +18,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoPlantManager, 0x2c)
|
||||
DECOMP_SIZE_ASSERT(LegoPlantManager::AnimEntry, 0x0c)
|
||||
|
||||
// GLOBAL: LEGO1 0x100f1660
|
||||
const char* g_plantLodNames[4][5] = {
|
||||
@ -73,7 +77,7 @@ void LegoPlantManager::Init()
|
||||
|
||||
m_worldId = -1;
|
||||
m_unk0x0c = 0;
|
||||
m_unk0x24 = 0;
|
||||
m_numEntries = 0;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10026360
|
||||
@ -96,11 +100,11 @@ void LegoPlantManager::Reset(MxS32 p_worldId)
|
||||
MxU32 i;
|
||||
DeleteObjects(g_sndAnimScript, SndanimScript::c_AnimC1, SndanimScript::c_AnimBld18);
|
||||
|
||||
for (i = 0; i < m_unk0x24; i++) {
|
||||
delete m_unk0x10[i];
|
||||
for (i = 0; i < m_numEntries; i++) {
|
||||
delete m_entries[i];
|
||||
}
|
||||
|
||||
m_unk0x24 = 0;
|
||||
m_numEntries = 0;
|
||||
|
||||
for (i = 0; i < sizeOfArray(g_plantInfo); i++) {
|
||||
RemovePlant(i, p_worldId);
|
||||
@ -499,11 +503,28 @@ MxBool LegoPlantManager::FUN_10026c80(MxS32 p_index)
|
||||
return result;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10026d70
|
||||
void LegoPlantManager::ScheduleAnimation(LegoEntity* p_entity, MxLong p_length)
|
||||
{
|
||||
m_world = CurrentWorld();
|
||||
|
||||
if (m_numEntries == 0) {
|
||||
TickleManager()->RegisterClient(this, 50);
|
||||
}
|
||||
|
||||
AnimEntry* entry = m_entries[m_numEntries] = new AnimEntry;
|
||||
m_numEntries++;
|
||||
|
||||
entry->m_entity = p_entity;
|
||||
entry->m_roi = p_entity->GetROI();
|
||||
entry->m_time = Timer()->GetTime() + p_length + 1000;
|
||||
FUN_100271b0(p_entity, -1);
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10026e00
|
||||
MxResult LegoPlantManager::Tickle()
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10027120
|
||||
@ -526,3 +547,22 @@ void LegoPlantManager::FUN_10027120()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100271b0
|
||||
void LegoPlantManager::FUN_100271b0(LegoEntity* p_entity, MxS32 p_adjust)
|
||||
{
|
||||
LegoPlantInfo* info = GetInfo(p_entity);
|
||||
|
||||
if (info != NULL) {
|
||||
if (info->m_unk0x16 < 0) {
|
||||
info->m_unk0x16 = g_unk0x100f16c0[info->m_variant];
|
||||
}
|
||||
|
||||
if (info->m_unk0x16 > 0) {
|
||||
info->m_unk0x16 += p_adjust;
|
||||
if (info->m_unk0x16 <= 1 && p_adjust < 0) {
|
||||
info->m_unk0x16 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user