mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-23 16:18:31 -05:00
Implement/match LegoBuildingManager::Tickle (#1156)
This commit is contained in:
parent
ff0ef96782
commit
3383ae646f
5 changed files with 81 additions and 19 deletions
|
@ -57,11 +57,10 @@ class LegoCacheSoundManager {
|
|||
LegoCacheSound* FindSoundByKey(const char* p_key);
|
||||
LegoCacheSound* ManageSoundEntry(LegoCacheSound* p_sound);
|
||||
LegoCacheSound* Play(const char* p_key, const char* p_name, MxBool p_looping);
|
||||
LegoCacheSound* Play(LegoCacheSound* p_sound, const char* p_name, MxBool p_looping);
|
||||
void Destroy(LegoCacheSound*& p_sound);
|
||||
|
||||
private:
|
||||
LegoCacheSound* Play(LegoCacheSound* p_sound, const char* p_name, MxBool p_looping);
|
||||
|
||||
Set100d6b4c m_set; // 0x04
|
||||
List100d6b4c m_list; // 0x14
|
||||
};
|
||||
|
|
|
@ -115,6 +115,8 @@ class LegoRaceCar : public LegoCarRaceActor, public LegoRaceMap {
|
|||
static MxLong g_timeLastSoundPlayed;
|
||||
static MxS32 g_unk0x100f0b88;
|
||||
static MxBool g_unk0x100f0b8c;
|
||||
static undefined4 g_unk0x100f0bac;
|
||||
static undefined4 g_unk0x100f0bb0;
|
||||
};
|
||||
|
||||
#endif // LEGORACERS_H
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
#include "mxticklemanager.h"
|
||||
#include "mxtimer.h"
|
||||
|
||||
#include <vec.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoBuildingManager, 0x30)
|
||||
DECOMP_SIZE_ASSERT(LegoBuildingInfo, 0x2c)
|
||||
DECOMP_SIZE_ASSERT(LegoBuildingManager::AnimEntry, 0x14)
|
||||
|
@ -682,18 +684,77 @@ void LegoBuildingManager::ScheduleAnimation(LegoEntity* p_entity, MxLong p_lengt
|
|||
FUN_100307b0(p_entity, -2);
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10030220
|
||||
// FUNCTION: LEGO1 0x10030220
|
||||
MxResult LegoBuildingManager::Tickle()
|
||||
{
|
||||
// WIP, included some of this to understand the AnimEntry array.
|
||||
LegoTime time = Timer()->GetTime();
|
||||
MxLong time = Timer()->GetTime();
|
||||
|
||||
if (m_numEntries != 0) {
|
||||
if (m_numEntries > 0) {
|
||||
for (MxS32 i = 0; i < m_numEntries; i++) {
|
||||
AnimEntry* entry = m_entries[i];
|
||||
if (entry->m_time <= time) {
|
||||
// Code to animate and play sounds
|
||||
for (MxS32 i = 0; i < m_numEntries; i++) {
|
||||
AnimEntry** ppEntry = &m_entries[i];
|
||||
AnimEntry* entry = *ppEntry;
|
||||
|
||||
if (m_world != CurrentWorld() || !entry->m_entity) {
|
||||
delete entry;
|
||||
m_numEntries--;
|
||||
|
||||
if (m_numEntries != i) {
|
||||
m_entries[i] = m_entries[m_numEntries];
|
||||
m_entries[m_numEntries] = NULL;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (entry->m_time - time > 1000) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (!entry->m_muted) {
|
||||
entry->m_muted = TRUE;
|
||||
SoundManager()->GetCacheSoundManager()->Play(m_sound, entry->m_roi->GetName(), FALSE);
|
||||
}
|
||||
|
||||
MxMatrix local48;
|
||||
MxMatrix locald8;
|
||||
|
||||
MxMatrix local120(entry->m_roi->GetLocal2World());
|
||||
Mx3DPointFloat local134(local120[3]);
|
||||
|
||||
ZEROVEC3(local120[3]);
|
||||
|
||||
locald8.SetIdentity();
|
||||
local48 = local120;
|
||||
|
||||
local134[1] = sin(((entry->m_time - time) * 10) * 0.0062831999f) * 0.4 + (entry->m_unk0x0c -= 0.05);
|
||||
SET3(local120[3], local134);
|
||||
|
||||
entry->m_roi->UpdateTransformationRelativeToParent(local120);
|
||||
VideoManager()->Get3DManager()->Moved(*entry->m_roi);
|
||||
|
||||
if (entry->m_time < time) {
|
||||
LegoBuildingInfo* info = GetInfo(entry->m_entity);
|
||||
|
||||
if (info->m_unk0x11 && !m_unk0x28) {
|
||||
MxS32 index = info - g_buildingInfo;
|
||||
AdjustHeight(index);
|
||||
MxMatrix mat = entry->m_roi->GetLocal2World();
|
||||
mat[3][1] = g_buildingInfo[index].m_unk0x014;
|
||||
entry->m_roi->UpdateTransformationRelativeToParent(mat);
|
||||
VideoManager()->Get3DManager()->Moved(*entry->m_roi);
|
||||
}
|
||||
else {
|
||||
info->m_unk0x11 = 0;
|
||||
entry->m_roi->SetVisibility(FALSE);
|
||||
}
|
||||
|
||||
delete entry;
|
||||
m_numEntries--;
|
||||
|
||||
if (m_numEntries != i) {
|
||||
i--;
|
||||
*ppEntry = m_entries[m_numEntries];
|
||||
m_entries[m_numEntries] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,12 +21,6 @@ DECOMP_SIZE_ASSERT(EdgeReference, 0x08)
|
|||
DECOMP_SIZE_ASSERT(SkeletonKickPhase, 0x10)
|
||||
DECOMP_SIZE_ASSERT(LegoRaceCar, 0x200)
|
||||
|
||||
// GLOBAL: LEGO1 0x100f0bac
|
||||
static undefined4 g_unk0x100f0bac = 0;
|
||||
|
||||
// GLOBAL: LEGO1 0x100f0bb0
|
||||
static undefined4 g_unk0x100f0bb0 = 0;
|
||||
|
||||
// GLOBAL: LEGO1 0x100f0a20
|
||||
// GLOBAL: BETA10 0x101f5e34
|
||||
EdgeReference LegoRaceCar::g_skBMap[] = {
|
||||
|
@ -142,6 +136,12 @@ MxS32 LegoRaceCar::g_unk0x100f0b88 = 0;
|
|||
// GLOBAL: BETA10 0x101f5f98
|
||||
MxBool LegoRaceCar::g_unk0x100f0b8c = TRUE;
|
||||
|
||||
// GLOBAL: LEGO1 0x100f0bac
|
||||
undefined4 LegoRaceCar::g_unk0x100f0bac = 0;
|
||||
|
||||
// GLOBAL: LEGO1 0x100f0bb0
|
||||
undefined4 LegoRaceCar::g_unk0x100f0bb0 = 0;
|
||||
|
||||
// Initialized at LEGO1 0x10012db0
|
||||
// GLOBAL: LEGO1 0x10102af0
|
||||
// GLOBAL: BETA10 0x102114c0
|
||||
|
|
|
@ -46,12 +46,12 @@ Device* RendererImpl::CreateDevice(const DeviceDirect3DCreateData& data)
|
|||
return device;
|
||||
}
|
||||
|
||||
// GLOBAL: LEGO1 0x10101040
|
||||
static int g_SetBufferCount = 1;
|
||||
|
||||
// FUNCTION: LEGO1 0x100a1900
|
||||
Device* RendererImpl::CreateDevice(const DeviceDirectDrawCreateData& data)
|
||||
{
|
||||
// GLOBAL: LEGO1 0x10101040
|
||||
static int g_SetBufferCount = 1;
|
||||
|
||||
DeviceImpl* device = new DeviceImpl();
|
||||
HRESULT result = m_data->CreateDeviceFromSurface(
|
||||
const_cast<LPGUID>(data.m_driverGUID),
|
||||
|
|
Loading…
Reference in a new issue