Merge branch 'isledecomp:master' into fix-act3ammo

This commit is contained in:
MS 2025-07-09 10:55:47 -04:00 committed by GitHub
commit 7d334f83cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
229 changed files with 5740 additions and 4381 deletions

View File

@ -172,9 +172,12 @@ jobs:
- name: Aggregate Accuracy
shell: bash
run: |
reccmp-aggregate --samples $(find build-entropy -type f -name "CONFIGPROGRESS*.json") --output CONFIGPROGRESS-agg.json --html CONFIGPROGRESS-agg.html
reccmp-aggregate --samples $(find build-entropy -type f -name "ISLEPROGRESS*.json") --output ISLEPROGRESS-agg.json --html ISLEPROGRESS-agg.html
reccmp-aggregate --samples $(find build-entropy -type f -name "LEGO1PROGRESS*.json") --output LEGO1PROGRESS-agg.json --html LEGO1PROGRESS-agg.html
find build-entropy -type f -name "CONFIGPROGRESS*.json" > configsamples.txt
find build-entropy -type f -name "ISLEPROGRESS*.json" > islesamples.txt
find build-entropy -type f -name "LEGO1PROGRESS*.json" > lego1samples.txt
reccmp-aggregate --samples @configsamples.txt --output CONFIGPROGRESS-agg.json --html CONFIGPROGRESS-agg.html
reccmp-aggregate --samples @islesamples.txt --output ISLEPROGRESS-agg.json --html ISLEPROGRESS-agg.html
reccmp-aggregate --samples @lego1samples.txt --output LEGO1PROGRESS-agg.json --html LEGO1PROGRESS-agg.html
- name: Compare Aggregate Accuracy With Current Master
shell: bash

2
.gitignore vendored
View File

@ -27,3 +27,5 @@ tools/ghidra_scripts/import.log
# These entries are kept for now since that convention has not always been around.
ISLE.EXE
LEGO1.DLL
.DS_Store

View File

@ -160,7 +160,7 @@ function(add_lego_libraries NAME)
add_library(geom${ARG_SUFFIX} STATIC
LEGO1/lego/sources/geom/legoedge.cpp
LEGO1/lego/sources/geom/legoweedge.cpp
LEGO1/lego/sources/geom/legounkown100db7f4.cpp
LEGO1/lego/sources/geom/legoorientededge.cpp
LEGO1/lego/sources/geom/legowegedge.cpp
)
list(APPEND list_targets geom${ARG_SUFFIX})
@ -483,7 +483,12 @@ if(ISLE_BUILD_BETA10)
OUT_TARGETS beta10_targets
)
reccmp_add_target(beta10 ID BETA10)
# Enable `#ifdef BETA10` conditions
target_compile_definitions(beta10 PRIVATE BETA10)
foreach(tgt IN LISTS beta10_targets)
target_compile_definitions(${tgt} PRIVATE BETA10)
endforeach()
endif()
if (ISLE_BUILD_APP)
@ -600,10 +605,13 @@ if (MSVC_FOR_DECOMP)
endif()
endif()
# Setting the MSVC_RUNTIME_LIBRARY for all libraries as well as `lego1` produces the results
# that are most consistent with the LEGO1.DLL and BETA10.DLL originals we have.
# Equivalent to target_compile_options(... PRIVATE "/MT$<$<CONFIG:Debug>:d>")
set_property(TARGET ${lego1_targets} ${beta10_targets} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
if(TARGET lego1)
target_link_options(lego1 PRIVATE "/OPT:REF")
# Equivalent to target_compile_options(... PRIVATE "/MT$<$<CONFIG:Debug>:d>")
set_property(TARGET lego1 ${lego1_targets} ${beta10_targets} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set_property(TARGET lego1 PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
set(CMAKE_CXX_FLAGS "/W3 /GX /D \"WIN32\" /D \"_WINDOWS\"")

View File

@ -15,7 +15,7 @@ CConfigCommandLineInfo::CConfigCommandLineInfo()
void CConfigCommandLineInfo::ParseParam(LPCSTR pszParam, BOOL bFlag, BOOL bLast)
{
if (bFlag) {
if (lstrcmpiA(pszParam, "config") == 0) {
if (lstrcmpi(pszParam, "config") == 0) {
currentConfigApp->m_run_config_dialog = TRUE;
}
}

View File

@ -13,7 +13,7 @@ DECOMP_SIZE_ASSERT(CMainDialog, 0x70)
CMainDialog::CMainDialog(CWnd* pParent) : CDialog(IDD, pParent)
{
afxCurrentWinApp;
m_icon = LoadIconA(AfxFindResourceHandle(MAKEINTRESOURCE(IDI_CONFIG), RT_GROUP_ICON), MAKEINTRESOURCE(IDI_CONFIG));
m_icon = LoadIcon(AfxFindResourceHandle(MAKEINTRESOURCE(IDI_CONFIG), RT_GROUP_ICON), MAKEINTRESOURCE(IDI_CONFIG));
}
// FUNCTION: CONFIG 0x00403e50
@ -52,8 +52,8 @@ BOOL CMainDialog::OnInitDialog()
CString about_text;
about_text.LoadString(IDS_ABOUT);
if (system_menu) {
AppendMenuA(system_menu->m_hMenu, MF_SEPARATOR, 0, NULL);
AppendMenuA(system_menu->m_hMenu, MF_STRING, 16, (LPCTSTR) about_text);
AppendMenu(system_menu->m_hMenu, MF_SEPARATOR, 0, NULL);
AppendMenu(system_menu->m_hMenu, MF_STRING, 16, (LPCTSTR) about_text);
}
SendMessage(WM_SETICON, ICON_BIG, (LPARAM) m_icon);
SendMessage(WM_SETICON, ICON_SMALL, (LPARAM) m_icon);

View File

@ -106,7 +106,7 @@ BOOL CConfigApp::InitInstance()
// FUNCTION: CONFIG 0x00403100
BOOL CConfigApp::IsLegoNotRunning()
{
HWND hWnd = FindWindowA("Lego Island MainNoM App", "LEGO\xae");
HWND hWnd = FindWindow("Lego Island MainNoM App", "LEGO\xae");
if (_stricmp(afxCurrentAppName, "config") == 0 || !hWnd) {
return TRUE;
}
@ -122,7 +122,7 @@ BOOL CConfigApp::WriteReg(const char* p_key, const char* p_value) const
HKEY hKey;
DWORD pos;
if (RegCreateKeyExA(
if (RegCreateKeyEx(
HKEY_LOCAL_MACHINE,
"SOFTWARE\\Mindscape\\LEGO Island",
0,
@ -133,7 +133,7 @@ BOOL CConfigApp::WriteReg(const char* p_key, const char* p_value) const
&hKey,
&pos
) == ERROR_SUCCESS) {
if (RegSetValueExA(hKey, p_key, 0, REG_SZ, (LPBYTE) p_value, strlen(p_value)) == ERROR_SUCCESS) {
if (RegSetValueEx(hKey, p_key, 0, REG_SZ, (LPBYTE) p_value, strlen(p_value)) == ERROR_SUCCESS) {
if (RegCloseKey(hKey) == ERROR_SUCCESS) {
return TRUE;
}
@ -153,8 +153,8 @@ BOOL CConfigApp::ReadReg(LPCSTR p_key, LPCSTR p_value, DWORD p_size) const
BOOL out = FALSE;
DWORD size = p_size;
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Mindscape\\LEGO Island", 0, KEY_READ, &hKey) == ERROR_SUCCESS) {
if (RegQueryValueExA(hKey, p_key, NULL, &valueType, (LPBYTE) p_value, &size) == ERROR_SUCCESS) {
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Mindscape\\LEGO Island", 0, KEY_READ, &hKey) == ERROR_SUCCESS) {
if (RegQueryValueEx(hKey, p_key, NULL, &valueType, (LPBYTE) p_value, &size) == ERROR_SUCCESS) {
if (RegCloseKey(hKey) == ERROR_SUCCESS) {
out = TRUE;
}
@ -236,7 +236,7 @@ BOOL CConfigApp::ReadRegisterSettings()
if (tmp != 0) {
is_modified = TRUE;
m_device_enumerator->FUN_1009d210();
tmp = m_device_enumerator->FUN_1009d0d0();
tmp = m_device_enumerator->GetBestDevice();
m_device_enumerator->GetDevice(tmp, m_driver, m_device);
}
if (!ReadRegInt("Display Bit Depth", &m_display_bit_depth)) {
@ -349,17 +349,17 @@ DWORD CConfigApp::GetConditionalDeviceRenderBitDepth() const
if (GetHardwareDeviceColorModel()) {
return 0;
}
return m_device->m_HELDesc.dwDeviceRenderBitDepth & 0x800;
return m_device->m_HELDesc.dwDeviceRenderBitDepth & DDBD_8;
}
// FUNCTION: CONFIG 0x004037e0
DWORD CConfigApp::GetDeviceRenderBitStatus() const
{
if (GetHardwareDeviceColorModel()) {
return m_device->m_HWDesc.dwDeviceRenderBitDepth & 0x400;
return m_device->m_HWDesc.dwDeviceRenderBitDepth & DDBD_16;
}
else {
return m_device->m_HELDesc.dwDeviceRenderBitDepth & 0x400;
return m_device->m_HELDesc.dwDeviceRenderBitDepth & DDBD_16;
}
}

View File

@ -42,7 +42,7 @@ class CConfigApp : public CWinApp {
DWORD GetConditionalDeviceRenderBitDepth() const;
DWORD GetDeviceRenderBitStatus() const;
BOOL AdjustDisplayBitDepthBasedOnRenderStatus();
void CConfigApp::WriteRegisterSettings() const;
void WriteRegisterSettings() const;
//{{AFX_MSG(CConfigApp)
// NOTE - the ClassWizard will add and remove member functions here.

View File

@ -22,7 +22,7 @@ void DetectDirectX(unsigned int* p_version, BOOL* p_found)
OSVERSIONINFOA os_version;
os_version.dwOSVersionInfoSize = sizeof(os_version);
if (!GetVersionExA(&os_version)) {
if (!GetVersionEx(&os_version)) {
*p_version = 0;
*p_found = 0;
return;
@ -38,16 +38,16 @@ void DetectDirectX(unsigned int* p_version, BOOL* p_found)
return;
}
*p_version = 0x200;
HMODULE dinput_module = LoadLibraryA("DINPUT.DLL");
HMODULE dinput_module = LoadLibrary("DINPUT.DLL");
if (!dinput_module) {
OutputDebugStringA("Couldn't LoadLibrary DInput\r\n");
OutputDebugString("Couldn't LoadLibrary DInput\r\n");
return;
}
DirectInputCreateA_fn* func_DirectInputCreateA =
(DirectInputCreateA_fn*) GetProcAddress(dinput_module, "DirectInputCreateA");
FreeLibrary(dinput_module);
if (!func_DirectInputCreateA) {
OutputDebugStringA("Couldn't GetProcAddress DInputCreate\r\n");
OutputDebugString("Couldn't GetProcAddress DInputCreate\r\n");
return;
}
*p_version = 0x300;
@ -58,7 +58,7 @@ void DetectDirectX(unsigned int* p_version, BOOL* p_found)
*p_version = 0x501;
return;
}
HMODULE ddraw_module = LoadLibraryA("DDRAW.DLL");
HMODULE ddraw_module = LoadLibrary("DDRAW.DLL");
if (!ddraw_module) {
*p_version = 0;
*p_found = 0;
@ -71,7 +71,7 @@ void DetectDirectX(unsigned int* p_version, BOOL* p_found)
*p_version = 0;
*p_found = 0;
FreeLibrary(ddraw_module);
OutputDebugStringA("Couldn't LoadLibrary DDraw\r\n");
OutputDebugString("Couldn't LoadLibrary DDraw\r\n");
return;
}
LPDIRECTDRAW ddraw;
@ -79,7 +79,7 @@ void DetectDirectX(unsigned int* p_version, BOOL* p_found)
*p_version = 0;
*p_found = 0;
FreeLibrary(ddraw_module);
OutputDebugStringA("Couldn't create DDraw\r\n");
OutputDebugString("Couldn't create DDraw\r\n");
return;
}
*p_version = 0x100;
@ -87,14 +87,14 @@ void DetectDirectX(unsigned int* p_version, BOOL* p_found)
if (FAILED(ddraw->QueryInterface(IID_IDirectDraw2, (LPVOID*) &ddraw2))) {
ddraw->Release();
FreeLibrary(ddraw_module);
OutputDebugStringA("Couldn't QI DDraw2\r\n");
OutputDebugString("Couldn't QI DDraw2\r\n");
return;
}
ddraw->Release();
*p_version = 0x200;
HMODULE dinput_module = LoadLibraryA("DINPUT.DLL");
HMODULE dinput_module = LoadLibrary("DINPUT.DLL");
if (!dinput_module) {
OutputDebugStringA("Couldn't LoadLibrary DInput\r\n");
OutputDebugString("Couldn't LoadLibrary DInput\r\n");
ddraw2->Release();
FreeLibrary(ddraw_module);
return;
@ -105,7 +105,7 @@ void DetectDirectX(unsigned int* p_version, BOOL* p_found)
if (!func_DirectInputCreateA) {
FreeLibrary(ddraw_module);
ddraw2->Release();
OutputDebugStringA("Couldn't GetProcAddress DInputCreate\r\n");
OutputDebugString("Couldn't GetProcAddress DInputCreate\r\n");
return;
}
*p_version = 0x300;
@ -113,12 +113,12 @@ void DetectDirectX(unsigned int* p_version, BOOL* p_found)
memset(&surface_desc, 0, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
surface_desc.dwFlags = DDSD_CAPS;
surface_desc.ddsCaps.dwCaps = DDCAPS2_NONLOCALVIDMEM;
if (FAILED(ddraw2->SetCooperativeLevel(NULL, DISCL_BACKGROUND))) {
surface_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
if (FAILED(ddraw2->SetCooperativeLevel(NULL, DDSCL_NORMAL))) {
ddraw2->Release();
FreeLibrary(ddraw_module);
*p_version = 0;
OutputDebugStringA("Couldn't Set coop level\r\n");
OutputDebugString("Couldn't Set coop level\r\n");
return;
}
LPDIRECTDRAWSURFACE surface;
@ -126,7 +126,7 @@ void DetectDirectX(unsigned int* p_version, BOOL* p_found)
ddraw2->Release();
FreeLibrary(ddraw_module);
*p_version = 0;
OutputDebugStringA("Couldn't CreateSurface\r\n");
OutputDebugString("Couldn't CreateSurface\r\n");
return;
}
LPDIRECTDRAWSURFACE3 surface3;

View File

@ -15,8 +15,6 @@ To access the Ghidra repository, use the following details:
- Address: `server.mattkc.com`
- Port: `13100`
**Please note that at the time of writing, much of the information found on the Ghidra server is severely outdated**. Generally, the source code found in this repository represents the latest "source of truth" and should be referenced whenever possible.
## General Guidelines
If you feel fit to contribute, feel free to create a pull request! Someone will review and merge it (or provide feedback) as soon as possible.

View File

@ -87,7 +87,7 @@ IsleApp::IsleApp()
m_backBuffersInVram = TRUE;
m_using8bit = FALSE;
m_using16bit = TRUE;
m_unk0x24 = 0;
m_hasLightSupport = FALSE;
m_drawCursor = FALSE;
m_use3dSound = TRUE;
m_useMusic = TRUE;
@ -179,7 +179,7 @@ BOOL IsleApp::SetupLegoOmni()
{
BOOL result = FALSE;
char mediaPath[256];
GetProfileStringA("LEGO Island", "MediaPath", "", mediaPath, sizeof(mediaPath));
GetProfileString("LEGO Island", "MediaPath", "", mediaPath, sizeof(mediaPath));
#ifdef COMPAT_MODE
BOOL failure;
@ -209,7 +209,7 @@ void IsleApp::SetupVideoFlags(
BOOL backBuffers,
BOOL using8bit,
BOOL using16bit,
BOOL param_6,
BOOL hasLightSupport,
BOOL param_7,
BOOL wideViewAngle,
char* deviceId
@ -218,7 +218,7 @@ void IsleApp::SetupVideoFlags(
m_videoParam.Flags().SetFullScreen(fullScreen);
m_videoParam.Flags().SetFlipSurfaces(flipSurfaces);
m_videoParam.Flags().SetBackBuffers(!backBuffers);
m_videoParam.Flags().SetF2bit0(!param_6);
m_videoParam.Flags().SetLacksLightSupport(!hasLightSupport);
m_videoParam.Flags().SetF1bit7(param_7);
m_videoParam.Flags().SetWideViewAngle(wideViewAngle);
m_videoParam.Flags().SetF2bit1(1);
@ -251,7 +251,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
// Throw error if sound unavailable
if (!soundReady) {
MessageBoxA(
MessageBox(
NULL,
"\"LEGO\xAE Island\" is not detecting a DirectSound compatible sound card. Please quit all other "
"applications and try again.",
@ -266,7 +266,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
// Create window
if (g_isle->SetupWindow(hInstance, lpCmdLine) != SUCCESS) {
MessageBoxA(
MessageBox(
NULL,
"\"LEGO\xAE Island\" failed to start. Please quit all other applications and try again.",
"LEGO\xAE Island Error",
@ -287,12 +287,12 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
// sample for MSVC600. It's quite possible Mindscape derived this app from that example since they no longer had the
// luxury of the MFC AppWizard which we know they used for the frontend used during development (ISLEMFC.EXE,
// MAIN.EXE, et al.)
LoadAcceleratorsA(hInstance, "AppAccel");
LoadAccelerators(hInstance, "AppAccel");
MSG msg;
while (!g_closed) {
while (!PeekMessageA(&msg, NULL, 0, 0, PM_NOREMOVE)) {
while (!PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) {
if (g_isle) {
g_isle->Tick(1);
}
@ -303,15 +303,15 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
}
while (!g_closed) {
if (!PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) {
if (!PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
break;
}
MSG nextMsg;
if (!g_isle || !g_isle->GetWindowHandle() || msg.message != WM_MOUSEMOVE ||
!PeekMessageA(&nextMsg, NULL, 0, 0, PM_NOREMOVE) || nextMsg.message != WM_MOUSEMOVE) {
!PeekMessage(&nextMsg, NULL, 0, 0, PM_NOREMOVE) || nextMsg.message != WM_MOUSEMOVE) {
TranslateMessage(&msg);
DispatchMessageA(&msg);
DispatchMessage(&msg);
}
if (g_reqEnableRMDevice) {
@ -343,7 +343,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
// FUNCTION: ISLE 0x401ca0
BOOL FindExistingInstance()
{
HWND hWnd = FindWindowA(WNDCLASS_NAME, WINDOW_TITLE);
HWND hWnd = FindWindow(WNDCLASS_NAME, WINDOW_TITLE);
if (hWnd) {
if (SetForegroundWindow(hWnd)) {
ShowWindow(hWnd, SW_RESTORE);
@ -373,14 +373,14 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
unsigned char keyCode = 0;
if (!g_isle) {
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
switch (uMsg) {
case WM_PAINT:
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
return DefWindowProc(hWnd, uMsg, wParam, lParam);
case WM_ACTIVATE:
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
return DefWindowProc(hWnd, uMsg, wParam, lParam);
case WM_ACTIVATEAPP:
if (g_isle) {
if ((wParam != 0) && (g_isle->GetFullScreen())) {
@ -395,7 +395,7 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
g_isle->SetWindowActive(wParam);
}
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
return DefWindowProc(hWnd, uMsg, wParam, lParam);
case WM_CLOSE:
if (!g_closed && g_isle) {
delete g_isle;
@ -403,7 +403,7 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
g_closed = TRUE;
return 0;
}
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
return DefWindowProc(hWnd, uMsg, wParam, lParam);
case WM_GETMINMAXINFO:
((MINMAXINFO*) lParam)->ptMaxTrackSize.x = (g_windowRect.right - g_windowRect.left) + 1;
((MINMAXINFO*) lParam)->ptMaxTrackSize.y = (g_windowRect.bottom - g_windowRect.top) + 1;
@ -411,7 +411,7 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
((MINMAXINFO*) lParam)->ptMinTrackSize.y = (g_windowRect.bottom - g_windowRect.top) + 1;
return 0;
case WM_ENTERMENULOOP:
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
return DefWindowProc(hWnd, uMsg, wParam, lParam);
case WM_SYSCOMMAND:
if (wParam == SC_SCREENSAVE) {
return 0;
@ -421,27 +421,27 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (g_rmDisabled) {
ShowWindow(g_isle->GetWindowHandle(), SW_RESTORE);
}
PostMessageA(g_isle->GetWindowHandle(), WM_CLOSE, 0, 0);
PostMessage(g_isle->GetWindowHandle(), WM_CLOSE, 0, 0);
return 0;
}
}
else if (g_isle && g_isle->GetFullScreen() && (wParam == SC_MOVE || wParam == SC_KEYMENU)) {
return 0;
}
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
return DefWindowProc(hWnd, uMsg, wParam, lParam);
case WM_EXITMENULOOP:
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
return DefWindowProc(hWnd, uMsg, wParam, lParam);
case WM_MOVING:
if (g_isle && g_isle->GetFullScreen()) {
GetWindowRect(hWnd, (LPRECT) lParam);
return 0;
}
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
return DefWindowProc(hWnd, uMsg, wParam, lParam);
case WM_NCPAINT:
if (g_isle && g_isle->GetFullScreen()) {
return 0;
}
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
return DefWindowProc(hWnd, uMsg, wParam, lParam);
case WM_DISPLAYCHANGE:
if (g_isle && VideoManager() && g_isle->GetFullScreen() && VideoManager()->GetDirect3D()) {
if (VideoManager()->GetDirect3D()->AssignedDevice()) {
@ -474,12 +474,12 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
}
}
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
return DefWindowProc(hWnd, uMsg, wParam, lParam);
case WM_KEYDOWN:
// While this probably should be (HIWORD(lParam) & KF_REPEAT), this seems
// to be what the assembly is actually doing
if (lParam & (KF_REPEAT << 16)) {
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
type = c_notificationKeyPress;
keyCode = wParam;
@ -513,7 +513,7 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
}
break;
default:
return DefWindowProcA(hWnd, uMsg, wParam, lParam);
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
if (g_isle) {
@ -550,7 +550,7 @@ MxResult IsleApp::SetupWindow(HINSTANCE hInstance, LPSTR lpCmdLine)
m_backBuffersInVram,
m_using8bit,
m_using16bit,
m_unk0x24,
m_hasLightSupport,
FALSE,
m_wideViewAngle,
m_deviceId
@ -559,7 +559,7 @@ MxResult IsleApp::SetupWindow(HINSTANCE hInstance, LPSTR lpCmdLine)
MxOmni::SetSound3D(m_use3dSound);
srand(timeGetTime() / 1000);
SystemParametersInfoA(SPI_SETMOUSETRAILS, 0, NULL, 0);
SystemParametersInfo(SPI_SETMOUSETRAILS, 0, NULL, 0);
ZeroMemory(&wndclass, sizeof(WNDCLASSA));
@ -567,22 +567,22 @@ MxResult IsleApp::SetupWindow(HINSTANCE hInstance, LPSTR lpCmdLine)
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbWndExtra = 0;
wndclass.hIcon = LoadIconA(hInstance, MAKEINTRESOURCEA(APP_ICON));
wndclass.hCursor = m_cursorArrow = m_cursorCurrent = LoadCursorA(hInstance, MAKEINTRESOURCEA(ISLE_ARROW));
m_cursorBusy = LoadCursorA(hInstance, MAKEINTRESOURCEA(ISLE_BUSY));
m_cursorNo = LoadCursorA(hInstance, MAKEINTRESOURCEA(ISLE_NO));
wndclass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(APP_ICON));
wndclass.hCursor = m_cursorArrow = m_cursorCurrent = LoadCursor(hInstance, MAKEINTRESOURCE(ISLE_ARROW));
m_cursorBusy = LoadCursor(hInstance, MAKEINTRESOURCE(ISLE_BUSY));
m_cursorNo = LoadCursor(hInstance, MAKEINTRESOURCE(ISLE_NO));
wndclass.hInstance = hInstance;
wndclass.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);
wndclass.lpszClassName = WNDCLASS_NAME;
if (!RegisterClassA(&wndclass)) {
if (!RegisterClass(&wndclass)) {
return FAILURE;
}
if (m_fullScreen) {
AdjustWindowRectEx(&g_windowRect, WS_CAPTION | WS_SYSMENU, 0, WS_EX_APPWINDOW);
m_windowHandle = CreateWindowExA(
m_windowHandle = CreateWindowEx(
WS_EX_APPWINDOW,
WNDCLASS_NAME,
WINDOW_TITLE,
@ -600,7 +600,7 @@ MxResult IsleApp::SetupWindow(HINSTANCE hInstance, LPSTR lpCmdLine)
else {
AdjustWindowRectEx(&g_windowRect, WS_CAPTION | WS_SYSMENU, 0, WS_EX_APPWINDOW);
m_windowHandle = CreateWindowExA(
m_windowHandle = CreateWindowEx(
WS_EX_APPWINDOW,
WNDCLASS_NAME,
WINDOW_TITLE,
@ -690,8 +690,8 @@ BOOL IsleApp::ReadReg(LPCSTR name, LPSTR outValue, DWORD outSize)
BOOL out = FALSE;
DWORD size = outSize;
if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, "SOFTWARE\\Mindscape\\LEGO Island", 0, KEY_READ, &hKey) == ERROR_SUCCESS) {
if (RegQueryValueExA(hKey, name, NULL, &valueType, (LPBYTE) outValue, &size) == ERROR_SUCCESS) {
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Mindscape\\LEGO Island", 0, KEY_READ, &hKey) == ERROR_SUCCESS) {
if (RegQueryValueEx(hKey, name, NULL, &valueType, (LPBYTE) outValue, &size) == ERROR_SUCCESS) {
if (RegCloseKey(hKey) == ERROR_SUCCESS) {
out = TRUE;
}

View File

@ -56,7 +56,7 @@ class IsleApp {
BOOL m_backBuffersInVram; // 0x18
BOOL m_using8bit; // 0x1c
BOOL m_using16bit; // 0x20
int m_unk0x24; // 0x24
BOOL m_hasLightSupport; // 0x24
BOOL m_use3dSound; // 0x28
BOOL m_useMusic; // 0x2c
BOOL m_useJoystick; // 0x30

View File

@ -10,6 +10,7 @@ const char* g_strANIMATION = "ANIMATION";
// GLOBAL: LEGO1 0x10102050
// STRING: LEGO1 0x10102024
// GLOBAL: BETA10 0x102028b4
const char* g_strATTACH_CAMERA = "ATTACH_CAMERA";
// GLOBAL: LEGO1 0x10102054
@ -138,6 +139,7 @@ const char* g_strBMP_ISMAP = "BMP_ISMAP";
// GLOBAL: LEGO1 0x101020e4
// STRING: LEGO1 0x10101eac
// GLOBAL: BETA10 0x10202948
const char* g_parseExtraTokens = ":;";
// GLOBAL: LEGO1 0x100f0c14

View File

@ -129,7 +129,7 @@ class Act3 : public LegoWorld {
void RemoveDonut(Act3Ammo& p_p);
MxResult ShootPizza(LegoPathController* p_controller, Vector3& p_location, Vector3& p_direction, Vector3& p_up);
MxResult ShootDonut(LegoPathController* p_controller, Vector3& p_location, Vector3& p_direction, Vector3& p_up);
void FUN_10072ad0(undefined4 p_param1);
void TriggerHitSound(undefined4 p_param1);
MxResult FUN_10073360(Act3Ammo& p_ammo, const Vector3& p_param2);
MxResult FUN_10073390(Act3Ammo& p_ammo, const Vector3& p_param2);
void SetBrickster(Act3Brickster* p_brickster);
@ -168,12 +168,12 @@ class Act3 : public LegoWorld {
Helicopter* m_copter; // 0x420c
Act3Shark* m_shark; // 0x4210
MxFloat m_time; // 0x4214
MxU8 m_unk0x4218; // 0x4218
MxU8 m_unk0x4219; // 0x4219
MxU8 m_unk0x421a; // 0x421a
MxU8 m_unk0x421b; // 0x421b
MxU8 m_unk0x421c; // 0x421c
MxU8 m_unk0x421d; // 0x421d
MxU8 m_pizzaHitSound; // 0x4218
MxU8 m_pizzaMissSound; // 0x4219
MxU8 m_copDonutSound; // 0x421a
MxU8 m_donutMissSound; // 0x421b
MxU8 m_islanderSound; // 0x421c
MxU8 m_bricksterDonutSound; // 0x421d
undefined m_unk0x421e; // 0x421e
Act3List m_unk0x4220; // 0x4220
MxPresenter* m_helicopterDots[15]; // 0x4230

View File

@ -140,7 +140,7 @@ class Act3Brickster : public Act3Actor {
MxResult HitActor(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
void SwitchBoundary(
LegoPathBoundary*& p_boundary,
LegoUnknown100db7f4*& p_edge,
LegoOrientedEdge*& p_edge,
float& p_unk0xe4
) override; // vtable+0x98
MxResult VTable0x9c() override; // vtable+0x9c

View File

@ -11,6 +11,12 @@ class MxEndActionNotificationParam;
// SIZE 0x24
class AmbulanceMissionState : public LegoState {
public:
enum {
e_ready = 0,
e_enteredAmbulance = 1,
e_prepareAmbulance = 2,
};
AmbulanceMissionState();
// FUNCTION: LEGO1 0x10037440
@ -125,18 +131,18 @@ class AmbulanceMissionState : public LegoState {
// SYNTHETIC: LEGO1 0x100376c0
// AmbulanceMissionState::`scalar deleting destructor'
undefined4 m_unk0x08; // 0x08
MxLong m_startTime; // 0x0c
MxS16 m_peScore; // 0x10
MxS16 m_maScore; // 0x12
MxS16 m_paScore; // 0x14
MxS16 m_niScore; // 0x16
MxS16 m_laScore; // 0x18
MxS16 m_peHighScore; // 0x1a
MxS16 m_maHighScore; // 0x1c
MxS16 m_paHighScore; // 0x1e
MxS16 m_niHighScore; // 0x20
MxS16 m_laHighScore; // 0x22
MxU32 m_state; // 0x08
MxLong m_startTime; // 0x0c
MxS16 m_peScore; // 0x10
MxS16 m_maScore; // 0x12
MxS16 m_paScore; // 0x14
MxS16 m_niScore; // 0x16
MxS16 m_laScore; // 0x18
MxS16 m_peHighScore; // 0x1a
MxS16 m_maHighScore; // 0x1c
MxS16 m_paHighScore; // 0x1e
MxS16 m_niHighScore; // 0x20
MxS16 m_laHighScore; // 0x22
};
// VTABLE: LEGO1 0x100d71a8
@ -177,15 +183,21 @@ class Ambulance : public IslePathActor {
virtual MxLong HandleEndAction(MxEndActionNotificationParam& p_param); // vtable+0xf4
void CreateState();
void FUN_10036e60();
void Init();
void ActivateSceneActions();
void StopActions();
void FUN_10037250();
void Reset();
// SYNTHETIC: LEGO1 0x10036130
// Ambulance::`scalar deleting destructor'
private:
enum {
e_none = 0,
e_waiting = 1,
e_finished = 3,
};
void PlayAnimation(IsleScript::Script p_objectId);
void PlayFinalAnimation(IsleScript::Script p_objectId);
void StopAction(IsleScript::Script p_objectId);
@ -196,9 +208,9 @@ class Ambulance : public IslePathActor {
AmbulanceMissionState* m_state; // 0x164
MxS16 m_unk0x168; // 0x168
MxS16 m_actorId; // 0x16a
MxS16 m_unk0x16c; // 0x16c
MxS16 m_unk0x16e; // 0x16e
MxS16 m_unk0x170; // 0x170
MxS16 m_atPoliceTask; // 0x16c
MxS16 m_atBeachTask; // 0x16e
MxS16 m_taskState; // 0x170
MxS16 m_unk0x172; // 0x172
IsleScript::Script m_lastAction; // 0x174
IsleScript::Script m_lastAnimation; // 0x178

View File

@ -52,13 +52,13 @@ class CarRace : public LegoRace {
return !strcmp(p_name, CarRace::ClassName()) || LegoRace::IsA(p_name);
}
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
void ReadyWorld() override; // vtable+0x50
MxBool Escape() override; // vtable+0x64
MxLong HandleClick(LegoEventNotificationParam&) override; // vtable+0x6c
MxLong HandlePathStruct(LegoPathStructNotificationParam&) override; // vtable+0x70
MxLong HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74
MxLong HandleType0Notification(MxNotificationParam&) override; // vtable+0x78
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
void ReadyWorld() override; // vtable+0x50
MxBool Escape() override; // vtable+0x64
MxLong HandleControl(LegoControlManagerNotificationParam&) override; // vtable+0x6c
MxLong HandlePathStruct(LegoPathStructNotificationParam&) override; // vtable+0x70
MxLong HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74
MxLong HandleType0Notification(MxNotificationParam&) override; // vtable+0x78
// FUNCTION: BETA10 0x100cd060
RaceSkel* GetSkeleton() { return m_skeleton; }

View File

@ -14,6 +14,19 @@ class MxStillPresenter;
// SIZE 0x24
class GasStationState : public LegoState {
public:
enum {
e_unknown0 = 0,
e_newState = 1,
e_beforeExitingForQuest = 2,
e_unknown3 = 3,
e_unknown4 = 4,
e_introduction = 5,
e_explainQuest = 6,
e_waitAcceptingQuest = 7,
e_afterAcceptingQuest = 8,
e_cancelQuest = 9,
};
GasStationState();
// FUNCTION: LEGO1 0x100061d0
@ -42,7 +55,7 @@ class GasStationState : public LegoState {
// TODO: Most likely getters/setters are not used according to BETA.
GarageScript::Script m_actions[3]; // 0x08
undefined4 m_unk0x14; // 0x14
MxS32 m_state; // 0x14
MxS16 m_pepperAction; // 0x18
MxS16 m_mamaAction; // 0x1a
MxS16 m_papaAction; // 0x1c
@ -88,6 +101,13 @@ class GasStation : public LegoWorld {
// GasStation::`scalar deleting destructor'
private:
enum {
e_finished = 0,
e_start = 1,
e_started = 2,
e_canceled = 3,
};
inline void PlayAction(GarageScript::Script p_objectId);
inline void StopAction(GarageScript::Script p_objectId);
@ -99,13 +119,13 @@ class GasStation : public LegoWorld {
undefined2 m_unk0xfa; // 0xfa
LegoGameState::Area m_destLocation; // 0xfc
GasStationState* m_state; // 0x100
undefined2 m_unk0x104; // 0x104
undefined2 m_unk0x106; // 0x106
MxS16 m_waitingState; // 0x104
MxS16 m_setWithCurrentAction; // 0x106
MxStillPresenter* m_trackLedBitmap; // 0x108
MxLong m_unk0x10c; // 0x10c
MxLong m_lastIdleAnimation; // 0x10c
MxLong m_trackLedTimer; // 0x110
MxBool m_unk0x114; // 0x114
MxBool m_unk0x115; // 0x115
MxBool m_waiting; // 0x114
MxBool m_flashingLeds; // 0x115
Radio m_radio; // 0x118
};

View File

@ -16,6 +16,24 @@ class MxStillPresenter;
// SIZE 0x18
class HospitalState : public LegoState {
public:
enum {
e_exitToClose = 0,
e_newState = 1,
e_unknown3 = 3,
e_unknown4 = 4,
e_introduction = 5,
e_explainQuestShort = 6,
e_explainQuest = 7,
e_waitAcceptingQuest = 8,
e_beforeEnteringAmbulance = 9,
e_unknown10 = 10, // Can never be reached
e_unknown11 = 11, // Can only be reached via e_unknown10
e_afterAcceptingQuest = 12,
e_exitImmediately = 13,
e_exitToInfocenter = 14,
e_exitToFront = 15,
};
HospitalState();
~HospitalState() override {}
@ -40,13 +58,13 @@ class HospitalState : public LegoState {
// TODO: Most likely getters/setters are not used according to BETA.
undefined4 m_unk0x08; // 0x08
MxS16 m_unk0x0c; // 0x0c
MxS16 m_unk0x0e; // 0x0e
MxS16 m_unk0x10; // 0x10
MxS16 m_unk0x12; // 0x12
MxS16 m_unk0x14; // 0x14
MxS16 m_unk0x16; // 0x16
MxS32 m_state; // 0x08
MxS16 m_stateActor; // 0x0c
MxS16 m_statePepper; // 0x0e
MxS16 m_stateMama; // 0x10
MxS16 m_statePapa; // 0x12
MxS16 m_stateNick; // 0x14
MxS16 m_stateLaura; // 0x16
};
// VTABLE: LEGO1 0x100d9730
@ -95,17 +113,17 @@ class Hospital : public LegoWorld {
MxS16 m_currentActorId; // 0xf8
LegoGameState::Area m_destLocation; // 0xfc
undefined2 m_unk0x100; // 0x100
MxU16 m_interactionMode; // 0x100
HospitalState* m_hospitalState; // 0x104
undefined2 m_unk0x108; // 0x108
MxU16 m_setWithCurrentAction; // 0x108
HospitalScript::Script m_currentAction; // 0x10c
MxStillPresenter* m_copLedBitmap; // 0x110
MxStillPresenter* m_pizzaLedBitmap; // 0x114
undefined m_unk0x118; // 0x118
MxBool m_flashingLeds; // 0x118
MxLong m_copLedAnimTimer; // 0x11c
MxLong m_pizzaLedAnimTimer; // 0x120
MxLong m_time; // 0x124
undefined m_unk0x128; // 0x128
MxBool m_exited; // 0x128
};
#endif // HOSPITAL_H

View File

@ -78,10 +78,20 @@ class InfocenterState : public LegoState {
// SIZE 0x18
struct InfocenterMapEntry {
enum {
e_infocenter = 3,
e_jetrace = 10,
e_carrace = 11,
e_pizzeria = 12,
e_garage = 13,
e_hospital = 14,
e_police = 15,
};
InfocenterMapEntry();
MxStillPresenter* m_destCtl; // 0x00
undefined4 m_unk0x04; // 0x04
MxU32 m_target; // 0x04
MxRect<MxS32> m_area; // 0x08
};
@ -154,7 +164,7 @@ class Infocenter : public LegoWorld {
void PlayCutscene(Cutscene p_entityId, MxBool p_scale);
void StopCutscene();
void FUN_10070d10(MxS32 p_x, MxS32 p_y);
void UpdateEnabledGlowControl(MxS32 p_x, MxS32 p_y);
void StartCredits();
void StopCredits();
@ -173,12 +183,12 @@ class Infocenter : public LegoWorld {
Radio m_radio; // 0x10c
MxStillPresenter* m_dragPresenter; // 0x11c
InfocenterMapEntry m_glowInfo[7]; // 0x120
MxS16 m_unk0x1c8; // 0x1c8
MxS16 m_enabledGlowControl; // 0x1c8
MxStillPresenter* m_frame; // 0x1cc
MxS16 m_infoManDialogueTimer; // 0x1d0
MxS16 m_bookAnimationTimer; // 0x1d2
MxU16 m_unk0x1d4; // 0x1d4
MxS16 m_unk0x1d6; // 0x1d6
MxU16 m_playingMovieCounter; // 0x1d4
MxS16 m_bigInfoBlinkTimer; // 0x1d6
};
#endif // INFOCENTER_H

View File

@ -29,12 +29,12 @@ class JetskiRace : public LegoRace {
return !strcmp(p_name, JetskiRace::ClassName()) || LegoRace::IsA(p_name);
}
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
void ReadyWorld() override; // vtable+0x50
MxBool Escape() override; // vtable+0x64
MxLong HandleClick(LegoEventNotificationParam&) override; // vtable+0x6c
MxLong HandlePathStruct(LegoPathStructNotificationParam&) override; // vtable+0x70
MxLong HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
void ReadyWorld() override; // vtable+0x50
MxBool Escape() override; // vtable+0x64
MxLong HandleControl(LegoControlManagerNotificationParam&) override; // vtable+0x6c
MxLong HandlePathStruct(LegoPathStructNotificationParam&) override; // vtable+0x70
MxLong HandleEndAction(MxEndActionNotificationParam&) override; // vtable+0x74
void FUN_10016930(MxS32 p_param1, MxS16 p_param2);

View File

@ -34,6 +34,7 @@ class LegoActor : public LegoEntity {
}
// FUNCTION: LEGO1 0x1002d220
// FUNCTION: BETA10 0x10012530
MxBool IsA(const char* p_name) const override // vtable+0x10
{
return !strcmp(p_name, LegoActor::ClassName()) || LegoEntity::IsA(p_name);
@ -43,18 +44,22 @@ class LegoActor : public LegoEntity {
void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) override; // vtable+0x24
// FUNCTION: LEGO1 0x10002cc0
// FUNCTION: BETA10 0x1000f3e0
virtual MxFloat GetSoundFrequencyFactor() { return m_frequencyFactor; } // vtable+0x50
// FUNCTION: LEGO1 0x10002cd0
// FUNCTION: BETA10 0x1000f410
virtual void SetSoundFrequencyFactor(MxFloat p_frequencyFactor)
{
m_frequencyFactor = p_frequencyFactor;
} // vtable+0x54
// FUNCTION: LEGO1 0x10002ce0
// FUNCTION: BETA10 0x1000f440
virtual void VTable0x58(MxFloat p_unk0x70) { m_unk0x70 = p_unk0x70; } // vtable+0x58
// FUNCTION: LEGO1 0x10002cf0
// FUNCTION: BETA10 0x1000f470
virtual MxFloat VTable0x5c() { return m_unk0x70; } // vtable+0x5c
// FUNCTION: LEGO1 0x10002d00
@ -62,6 +67,7 @@ class LegoActor : public LegoEntity {
virtual MxU8 GetActorId() { return m_actorId; } // vtable+0x60
// FUNCTION: LEGO1 0x10002d10
// FUNCTION: BETA10 0x1000f4d0
virtual void SetActorId(MxU8 p_actorId) { m_actorId = p_actorId; } // vtable+0x64
static const char* GetActorName(MxU8 p_id);
@ -76,6 +82,7 @@ class LegoActor : public LegoEntity {
};
// SYNTHETIC: LEGO1 0x1002d300
// SYNTHETIC: BETA10 0x1003d900
// LegoActor::`scalar deleting destructor'
#endif // LEGOACTOR_H

View File

@ -11,12 +11,12 @@ class LegoROI;
struct LegoActorInfo {
// SIZE 0x18
struct Part {
MxU8* m_unk0x00; // 0x00
const char** m_unk0x04; // 0x04
MxU8 m_unk0x08; // 0x08
MxU8* m_unk0x0c; // 0x0c
const char** m_unk0x10; // 0x10
MxU8 m_unk0x14; // 0x14
MxU8* m_partNameIndices; // 0x00
const char** m_partName; // 0x04
MxU8 m_partNameIndex; // 0x08
MxU8* m_nameIndices; // 0x0c
const char** m_names; // 0x10
MxU8 m_nameIndex; // 0x14
};
const char* m_name; // 0x00
@ -31,8 +31,8 @@ struct LegoActorInfo {
// SIZE 0x58
struct LegoActorLOD {
enum {
c_flag1 = 0x01,
c_flag2 = 0x02
c_useTexture = 0x01,
c_useColor = 0x02
};
const char* m_name; // 0x00

View File

@ -16,7 +16,7 @@ class LegoFile;
class LegoPathActor;
class LegoPathBoundary;
class LegoROIList;
struct LegoUnknown100db7f4;
struct LegoOrientedEdge;
class LegoWorld;
class MxDSAction;
@ -32,20 +32,20 @@ struct ModelInfo {
// SIZE 0x30
struct AnimInfo {
char* m_name; // 0x00
MxU32 m_objectId; // 0x04
MxS16 m_location; // 0x08
MxBool m_unk0x0a; // 0x0a
MxU8 m_unk0x0b; // 0x0b
MxU8 m_unk0x0c; // 0x0c
MxU8 m_unk0x0d; // 0x0d
float m_unk0x10[4]; // 0x10
MxU8 m_modelCount; // 0x20
MxU16 m_unk0x22; // 0x22
ModelInfo* m_models; // 0x24
MxS8 m_unk0x28; // 0x28
MxBool m_unk0x29; // 0x29
MxS8 m_unk0x2a[3]; // 0x2a
char* m_name; // 0x00
MxU32 m_objectId; // 0x04
MxS16 m_location; // 0x08
MxBool m_unk0x0a; // 0x0a
MxU8 m_unk0x0b; // 0x0b
MxU8 m_unk0x0c; // 0x0c
MxU8 m_unk0x0d; // 0x0d
float m_unk0x10[4]; // 0x10
MxU8 m_modelCount; // 0x20
MxU16 m_unk0x22; // 0x22
ModelInfo* m_models; // 0x24
MxS8 m_characterIndex; // 0x28
MxBool m_unk0x29; // 0x29
MxS8 m_unk0x2a[3]; // 0x2a
};
// VTABLE: LEGO1 0x100d8d80
@ -240,7 +240,7 @@ class LegoAnimationManager : public MxCore {
void FUN_10063d10();
void FUN_10063e40(LegoAnimPresenter* p_presenter);
MxBool FUN_10063fb0(LegoLocation::Boundary* p_boundary, LegoWorld* p_world);
MxBool FUN_10064010(LegoPathBoundary* p_boundary, LegoUnknown100db7f4* p_edge, float p_destScale);
MxBool FUN_10064010(LegoPathBoundary* p_boundary, LegoOrientedEdge* p_edge, float p_destScale);
MxBool FUN_10064120(LegoLocation::Boundary* p_boundary, MxBool p_bool1, MxBool p_bool2);
MxResult FUN_10064380(
const char* p_name,
@ -284,7 +284,7 @@ class LegoAnimationManager : public MxCore {
MxLong m_unk0x410; // 0x410
MxU32 m_unk0x414; // 0x414
MxU32 m_numAllowedExtras; // 0x418
undefined4 m_unk0x41c; // 0x41c
MxU32 m_maxAllowedExtras; // 0x41c
AnimState* m_animState; // 0x420
LegoROIList* m_unk0x424; // 0x424
MxBool m_suspendedEnableCamAnims; // 0x428

View File

@ -90,7 +90,7 @@ class LegoAnimMMPresenter : public MxCompositePresenter {
MxU8 m_unk0x59; // 0x59
MxU32 m_animmanId; // 0x5c
LegoTranInfo* m_tranInfo; // 0x60
LegoWorld* m_unk0x64; // 0x64
LegoWorld* m_world; // 0x64
MxMatrix* m_unk0x68; // 0x68
LegoROI** m_roiMap; // 0x6c
MxU32 m_roiMapSize; // 0x70

View File

@ -103,12 +103,17 @@ class LegoAnimPresenter : public MxVideoPresenter {
LegoChar* FUN_10069150(const LegoChar* p_und1);
void FUN_100692b0();
void FUN_100695c0();
LegoChar* FUN_100697c0(const LegoChar* p_und1, const LegoChar* p_und2);
LegoChar* GetVariableOrIdentity(const LegoChar* p_varName, const LegoChar* p_prefix);
LegoBool FUN_100698b0(const CompoundObject& p_rois, const LegoChar* p_und2);
LegoROI* FUN_100699e0(const LegoChar* p_und);
LegoROI* FindROI(const LegoChar* p_name);
void FUN_10069b10();
void FUN_1006a3c0(LegoAnimStructMap& p_map, LegoTreeNode* p_node, LegoROI* p_roi);
void FUN_1006a4f0(LegoAnimStructMap& p_map, LegoAnimNodeData* p_data, const LegoChar* p_und, LegoROI* p_roi);
void UpdateStructMapAndROIIndex(LegoAnimStructMap& p_map, LegoTreeNode* p_node, LegoROI* p_roi);
void UpdateStructMapAndROIIndexForNode(
LegoAnimStructMap& p_map,
LegoAnimNodeData* p_data,
const LegoChar* p_und,
LegoROI* p_roi
);
void FUN_1006aa60();
void FUN_1006ab70();
LegoBool FUN_1006aba0();
@ -116,13 +121,13 @@ class LegoAnimPresenter : public MxVideoPresenter {
void SubstituteVariables();
void FUN_1006b900(LegoAnim* p_anim, MxLong p_time, Matrix4* p_matrix);
void FUN_1006b9a0(LegoAnim* p_anim, MxLong p_time, Matrix4* p_matrix);
void FUN_1006c8a0(MxBool p_bool);
void SetDisabled(MxBool p_disabled);
LegoAnim* m_anim; // 0x64
LegoROI** m_roiMap; // 0x68
MxU32 m_roiMapSize; // 0x6c
LegoROIList* m_unk0x70; // 0x70
LegoROIList* m_unk0x74; // 0x74
LegoROIList* m_sceneROIs; // 0x70
LegoROIList* m_managedActors; // 0x74
Matrix4* m_unk0x78; // 0x78
MxU32 m_flags; // 0x7c
LegoWorld* m_currentWorld; // 0x80

View File

@ -26,10 +26,10 @@ struct LegoBuildingInfo {
MxU32 m_sound; // 0x08
MxU32 m_move; // 0x0c
MxU8 m_mood; // 0x10
MxS8 m_unk0x11; // 0x11
MxS8 m_initialUnk0x11; // 0x12 - initial value loaded to m_unk0x11
MxS8 m_counter; // 0x11
MxS8 m_initialCounter; // 0x12 - initial value loaded to m_counter
MxU8 m_flags; // 0x13
float m_unk0x14; // 0x14
float m_adjustedY; // 0x14
const char* m_boundaryName; // 0x18
float m_x; // 0x1c
float m_y; // 0x20
@ -46,7 +46,7 @@ class LegoBuildingManager : public MxCore {
LegoEntity* m_entity; // 0x00
LegoROI* m_roi; // 0x04
MxLong m_time; // 0x08
float m_unk0x0c; // 0x0c
float m_y; // 0x0c
MxBool m_muted; // 0x10
};
@ -78,17 +78,17 @@ class LegoBuildingManager : public MxCore {
MxBool SwitchMove(LegoEntity* p_entity);
MxBool SwitchMood(LegoEntity* p_entity);
MxU32 GetAnimationId(LegoEntity* p_entity);
MxU32 GetSoundId(LegoEntity* p_entity, MxBool p_state);
MxBool FUN_10030000(LegoEntity* p_entity);
MxBool FUN_10030030(MxS32 p_index);
MxBool FUN_10030110(LegoBuildingInfo* p_data);
void ScheduleAnimation(LegoEntity* p_entity, MxLong p_length, MxBool p_haveSound, MxBool p_unk0x28);
void FUN_10030590();
MxU32 GetSoundId(LegoEntity* p_entity, MxBool p_basedOnMood);
MxBool DecrementCounter(LegoEntity* p_entity);
MxBool DecrementCounter(MxS32 p_index);
MxBool DecrementCounter(LegoBuildingInfo* p_data);
void ScheduleAnimation(LegoEntity* p_entity, MxLong p_length, MxBool p_haveSound, MxBool p_hideAfterAnimation);
void ClearCounters();
void AdjustHeight(MxS32 p_index);
MxResult FUN_10030630();
MxResult DetermineBoundaries();
LegoBuildingInfo* GetInfoArray(MxS32& p_length);
void FUN_100307b0(LegoEntity* p_entity, MxS32 p_adjust);
void FUN_10030800();
void AdjustCounter(LegoEntity* p_entity, MxS32 p_adjust);
void SetInitialCounters();
static const char* GetCustomizeAnimFile() { return g_customizeAnimFile; }
@ -100,13 +100,13 @@ class LegoBuildingManager : public MxCore {
static MxS32 g_maxMove[16];
static MxU32 g_maxSound;
MxU8 m_nextVariant; // 0x08
MxBool m_unk0x09; // 0x09
AnimEntry* m_entries[5]; // 0x0c
MxS8 m_numEntries; // 0x20
LegoCacheSound* m_sound; // 0x24
MxBool m_unk0x28; // 0x28
LegoWorld* m_world; // 0x2c
MxU8 m_nextVariant; // 0x08
MxBool m_boundariesDetermined; // 0x09
AnimEntry* m_entries[5]; // 0x0c
MxS8 m_numEntries; // 0x20
LegoCacheSound* m_sound; // 0x24
MxBool m_hideAfterAnimation; // 0x28
LegoWorld* m_world; // 0x2c
};
#endif // LEGOBUILDINGMANAGER_H

View File

@ -135,15 +135,15 @@ class LegoCarBuild : public LegoWorld {
void FUN_10022f00();
void FUN_10022f30();
void FUN_10023130(MxLong p_x, MxLong p_y);
void FUN_100236d0();
void AddSelectedPartToBuild();
undefined4 FUN_10024250(LegoEventNotificationParam* p_param);
void FUN_100243a0();
undefined4 FUN_10024480(MxActionNotificationParam* p_param);
undefined4 FUN_100244e0(MxLong p_x, MxLong p_y);
undefined4 SelectPartFromMousePosition(MxLong p_x, MxLong p_y);
undefined4 FUN_100246e0(MxLong p_x, MxLong p_y);
MxS32 FUN_10024850(MxLong p_x, MxLong p_y);
undefined4 FUN_10024890(MxParam* p_param);
undefined4 FUN_10024c20(LegoEventNotificationParam* p_param);
undefined4 FUN_10024c20(MxNotificationParam* p_param);
void FUN_10024ef0();
void FUN_10024f30();
void FUN_10024f50();
@ -161,7 +161,7 @@ class LegoCarBuild : public LegoWorld {
MxS32 FUN_10025ee0(undefined4 p_param1);
// FUNCTION: BETA10 0x100735b0
void SetUnknown0x258(LegoCarBuildAnimPresenter* p_unk0x258) { m_unk0x258 = p_unk0x258; }
void SetCarBuildAnimPresenter(LegoCarBuildAnimPresenter* p_animPresenter) { m_animPresenter = p_animPresenter; }
// SYNTHETIC: LEGO1 0x10022a60
// LegoCarBuild::`scalar deleting destructor'
@ -182,7 +182,7 @@ class LegoCarBuild : public LegoWorld {
MxU8 m_unk0x109; // 0x109
MxU16 m_unk0x10a; // 0x10a
DWORD m_unk0x10c; // 0x10c
LegoROI* m_unk0x110; // 0x110
LegoROI* m_selectedPart; // 0x110
BoundingSphere m_unk0x114; // 0x114
MxMatrix m_unk0x12c; // 0x12c
undefined m_unk0x174; // 0x174
@ -193,17 +193,17 @@ class LegoCarBuild : public LegoWorld {
// This is likely a location in pixel space
MxS32 m_unk0x250[2]; // 0x250
LegoCarBuildAnimPresenter* m_unk0x258; // 0x258
MxQuaternionTransformer m_unk0x25c; // 0x25c
LegoCarBuildAnimPresenter* m_animPresenter; // 0x258
MxQuaternionTransformer m_unk0x25c; // 0x25c
// These two are likely locations in pixel space
MxS32 m_unk0x290[2]; // 0x290
MxS32 m_unk0x298[2]; // 0x298
MxFloat m_unk0x2a0; // 0x2a0
Mx4DPointFloat m_unk0x2a4; // 0x2a4
Mx4DPointFloat m_unk0x2bc; // 0x2bc
MxBool m_unk0x2d4; // 0x2d4
MxFloat m_unk0x2a0; // 0x2a0
Mx4DPointFloat m_unk0x2a4; // 0x2a4
Mx4DPointFloat m_unk0x2bc; // 0x2bc
MxBool m_selectedPartIsPlaced; // 0x2d4
// variable names verified by BETA10 0x1006b27a
MxStillPresenter* m_ColorBook_Bitmap; // 0x2dc

View File

@ -13,6 +13,13 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter {
c_bit1 = 0x01
};
enum ShelfState {
e_undefined = -1,
e_selected = 0,
e_stopped = 1,
e_moving = 2
};
// SIZE 0x0c
struct UnknownListEntry {
// FUNCTION: LEGO1 0x100795c0
@ -69,16 +76,16 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter {
void FUN_10079050(MxS16 p_index);
void SwapNodesByName(LegoChar* p_param1, LegoChar* p_param2);
void FUN_10079160();
void FUN_100795d0(LegoChar* p_param);
void FUN_10079680(LegoChar* p_param);
void InitBuildPlatform();
void HideBuildPartByName(LegoChar* p_param);
void ShowBuildPartByName(LegoChar* p_param);
LegoAnimNodeData* FindNodeDataByName(LegoTreeNode* p_treeNode, const LegoChar* p_name);
LegoTreeNode* FindNodeByName(LegoTreeNode* p_treeNode, const LegoChar* p_name);
void FUN_10079790(const LegoChar* p_name);
void AddPartToBuildByName(const LegoChar* p_name);
void RotateAroundYAxis(MxFloat p_angle);
MxBool FUN_10079c30(const LegoChar* p_name);
MxBool PartIsPlaced(const LegoChar* p_name);
void FUN_10079a90();
void MoveShelfForward();
MxBool StringEqualsPlatform(const LegoChar* p_string);
MxBool StringEqualsShelf(const LegoChar* p_string);
MxBool StringEndsOnY(const LegoChar* p_string);
@ -87,10 +94,10 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter {
void SetPartObjectIdByName(const LegoChar* p_name, MxS16 p_objectId);
// FUNCTION: BETA10 0x10070180
void SetUnknown0xbc(undefined2 p_unk0xbc) { m_unk0xbc = p_unk0xbc; }
void SetShelfState(MxU16 p_shelfState) { m_shelfState = p_shelfState; }
// FUNCTION: BETA10 0x100703b0
Matrix4& GetUnknown0xe0() { return m_unk0xe0; }
Matrix4& GetBuildViewMatrix() { return m_buildViewMatrix; }
MxBool StringEndsOnW(LegoChar* p_param);
MxBool StringEndsOnYOrN(const LegoChar* p_string);
@ -116,7 +123,7 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter {
private:
void Beta10Inline0x100733d0();
MxU16 m_unk0xbc; // 0xbc
MxU16 m_shelfState; // 0xbc
// variable name verified by BETA10 0x1007184f
MxS16 m_numberOfParts; // 0xbe
@ -124,21 +131,21 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter {
// name derived from LegoVehicleBuildState, field 0x4f
MxS16 m_placedPartCount; // 0xc0
LegoAnimNodeData* m_unk0xc4; // 0xc4
LegoAnim m_unk0xc8; // 0xc8
MxMatrix m_unk0xe0; // 0xe0
LegoAnimNodeData* m_platformAnimNodeData; // 0xc4
LegoAnim m_platformAnim; // 0xc8
MxMatrix m_buildViewMatrix; // 0xe0
// variable name verified by BETA10 0x100719f0
UnknownListEntry* m_parts; // 0x128
MxFloat m_unk0x12c; // 0x12c
MxFloat m_unk0x130; // 0x130
MxFloat m_unk0x134; // 0x134
MxFloat m_unk0x138; // 0x138
MxULong m_unk0x13c; // 0x13c
LegoEntity* m_unk0x140; // 0x140
MxS32 m_unk0x144; // 0x144
MxS32 m_unk0x148; // 0x148
MxFloat m_shelfFrameBuffer; // 0x12c
MxFloat m_shelfFrame; // 0x130
MxFloat m_shelfFrameMax; // 0x134
MxFloat m_shelfFrameInterval; // 0x138
MxULong m_unk0x13c; // 0x13c
LegoEntity* m_carBuildEntity; // 0x140
MxS32 m_unk0x144; // 0x144
MxS32 m_unk0x148; // 0x148
// name verified by BETA10 0x10070d63
LegoChar* m_mainSourceId; // 0x14c

View File

@ -76,7 +76,7 @@ class LegoCharacterManager {
void ReleaseActor(const char* p_name);
void ReleaseActor(LegoROI* p_roi);
void ReleaseAutoROI(LegoROI* p_roi);
MxBool FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_texture);
MxBool SetHeadTexture(LegoROI* p_roi, LegoTextureInfo* p_texture);
LegoExtraActor* GetExtraActor(const char* p_name);
LegoActorInfo* GetActorInfo(const char* p_name);
LegoActorInfo* GetActorInfo(LegoROI* p_roi);
@ -86,10 +86,10 @@ class LegoCharacterManager {
MxBool SwitchMove(LegoROI* p_roi);
MxBool SwitchMood(LegoROI* p_roi);
MxU32 GetAnimationId(LegoROI* p_roi);
MxU32 GetSoundId(LegoROI* p_roi, MxBool p_und);
MxU32 GetSoundId(LegoROI* p_roi, MxBool p_basedOnMood);
MxU8 GetMood(LegoROI* p_roi);
LegoROI* CreateAutoROI(const char* p_name, const char* p_lodName, MxBool p_createEntity);
MxResult FUN_10085870(LegoROI* p_roi);
MxResult UpdateBoundingSphereAndBox(LegoROI* p_roi);
LegoROI* FUN_10085a80(const char* p_name, const char* p_lodName, MxBool p_createEntity);
static const char* GetCustomizeAnimFile() { return g_customizeAnimFile; }

View File

@ -66,27 +66,33 @@ class LegoControlManager : public MxCore {
return !strcmp(p_name, LegoControlManager::ClassName()) || MxCore::IsA(p_name);
}
void FUN_10028df0(MxPresenterList* p_presenterList);
void SetPresenterList(MxPresenterList* p_presenterList);
void Register(MxCore* p_listener);
void Unregister(MxCore* p_listener);
MxBool FUN_10029210(LegoEventNotificationParam& p_param, MxPresenter* p_presenter);
void FUN_100293c0(MxU32 p_objectId, const char* p_atom, MxS16 p_unk0x4e);
MxControlPresenter* FUN_100294e0(MxS32 p_x, MxS32 p_y);
MxBool FUN_10029630();
MxBool FUN_10029750();
void FUN_100292e0();
MxBool HandleButtonDown(LegoEventNotificationParam& p_param, MxPresenter* p_presenter);
void UpdateEnabledChild(MxU32 p_objectId, const char* p_atom, MxS16 p_enabledChild);
MxControlPresenter* GetControlAt(MxS32 p_x, MxS32 p_y);
MxBool HandleButtonDown();
MxBool HandleButtonUp();
void Notify();
undefined4 GetUnknown0x0c() { return m_unk0x0c; }
undefined GetUnknown0x10() { return m_unk0x10; }
MxU32 HandleUpNextTickle() { return m_handleUpNextTickle; }
MxBool IsSecondButtonDown() { return m_secondButtonDown; }
// SYNTHETIC: LEGO1 0x10028d40
// LegoControlManager::`scalar deleting destructor'
private:
undefined4 m_unk0x08; // 0x08
undefined4 m_unk0x0c; // 0x0c
MxBool m_unk0x10; // 0x10
MxPresenter* m_unk0x14; // 0x14
enum {
e_idle = 0,
e_waitNextTickle = 1,
e_tickled = 2,
};
MxU32 m_buttonDownState; // 0x08
MxU32 m_handleUpNextTickle; // 0x0c
MxBool m_secondButtonDown; // 0x10
MxPresenter* m_handledPresenter; // 0x14
LegoControlManagerNotificationParam m_event; // 0x18
MxPresenterList* m_presenterList; // 0x44
LegoNotifyList m_notifyList; // 0x48

View File

@ -28,7 +28,7 @@ class LegoEntity : public MxEntity {
};
enum {
c_altBit1 = 0x01
c_disabled = 0x01
};
LegoEntity() { Init(); }
@ -68,13 +68,13 @@ class LegoEntity : public MxEntity {
// FUNCTION: BETA10 0x10013260
virtual void SetWorldSpeed(MxFloat p_worldSpeed) { m_worldSpeed = p_worldSpeed; } // vtable+0x30
virtual void ClickSound(MxBool p_und); // vtable+0x34
virtual void ClickAnimation(); // vtable+0x38
virtual void SwitchVariant(); // vtable+0x3c
virtual void SwitchSound(); // vtable+0x40
virtual void SwitchMove(); // vtable+0x44
virtual void SwitchColor(LegoROI* p_roi); // vtable+0x48
virtual void SwitchMood(); // vtable+0x4c
virtual void ClickSound(MxBool p_basedOnMood); // vtable+0x34
virtual void ClickAnimation(); // vtable+0x38
virtual void SwitchVariant(); // vtable+0x3c
virtual void SwitchSound(); // vtable+0x40
virtual void SwitchMove(); // vtable+0x44
virtual void SwitchColor(LegoROI* p_roi); // vtable+0x48
virtual void SwitchMood(); // vtable+0x4c
void FUN_10010c30();
void SetType(MxU8 p_type);
@ -83,7 +83,7 @@ class LegoEntity : public MxEntity {
Mx3DPointFloat GetWorldUp();
Mx3DPointFloat GetWorldPosition();
MxBool GetUnknown0x10IsSet(MxU8 p_flag) { return m_unk0x10 & p_flag; }
MxBool IsInteraction(MxU8 p_flag) { return m_interaction & p_flag; }
MxBool GetFlagsIsSet(MxU8 p_flag) { return m_flags & p_flag; }
MxU8 GetFlags() { return m_flags; }
@ -101,14 +101,14 @@ class LegoEntity : public MxEntity {
void SetFlags(MxU8 p_flags) { m_flags = p_flags; }
void SetFlag(MxU8 p_flag) { m_flags |= p_flag; }
void ClearFlag(MxU8 p_flag) { m_flags &= ~p_flag; }
void SetUnknown0x10Flag(MxU8 p_flag) { m_unk0x10 |= p_flag; }
void ClearUnknown0x10Flag(MxU8 p_flag) { m_unk0x10 &= ~p_flag; }
void SetInteractionFlag(MxU8 p_flag) { m_interaction |= p_flag; }
void ClearInteractionFlag(MxU8 p_flag) { m_interaction &= ~p_flag; }
protected:
void Init();
void SetWorld();
MxU8 m_unk0x10; // 0x10
MxU8 m_interaction; // 0x10
MxU8 m_flags; // 0x11
Mx3DPointFloat m_worldLocation; // 0x14
Mx3DPointFloat m_worldDirection; // 0x28

View File

@ -67,7 +67,7 @@ class LegoGameState {
e_isle,
e_infomain,
e_infodoor,
e_unk4,
e_infocenterExited,
e_elevbott,
e_elevride,
e_elevride2,
@ -80,10 +80,10 @@ class LegoGameState {
e_jetrace,
e_jetrace2,
e_jetraceExterior,
e_unk17,
e_jetskibuildExited,
e_carrace,
e_carraceExterior,
e_unk20,
e_racecarbuildExited,
e_unk21,
e_pizzeriaExterior,
e_unk23,
@ -91,12 +91,12 @@ class LegoGameState {
e_garageExterior,
e_garage,
e_garadoor,
e_unk28,
e_garageExited,
e_hospitalExterior,
e_hospital,
e_unk31,
e_hospitalExited,
e_policeExterior,
e_unk33,
e_policeExited,
e_police,
e_polidoor,
e_copterbuild,
@ -129,7 +129,7 @@ class LegoGameState {
e_towtrack,
e_jetski,
e_unk66 = 66
e_vehicleExited = 66
};
// SIZE 0x0e
@ -150,7 +150,18 @@ class LegoGameState {
MxS16 m_totalScore; // 0x00
MxU8 m_scores[5][5]; // 0x02
Username m_name; // 0x1c
MxS16 m_unk0x2a; // 0x2a
MxS16 m_playerId; // 0x2a
ScoreItem& operator=(const ScoreItem& p_other)
{
// MSVC auto-generates an operator=, but LegoGameState::WriteScoreHistory() has a much better match
// with a manual implementation.
m_totalScore = p_other.m_totalScore;
memcpy(m_scores, p_other.m_scores, sizeof(m_scores));
m_name = p_other.m_name;
m_playerId = p_other.m_playerId;
return *this;
}
};
// SIZE 0x372
@ -158,7 +169,7 @@ class LegoGameState {
History();
void WriteScoreHistory();
MxResult Serialize(LegoStorage* p_storage);
ScoreItem* FUN_1003cc90(Username* p_player, MxS16 p_unk0x24, MxS32& p_unk0x2c);
ScoreItem* FindPlayerInScoreHistory(Username* p_player, MxS16 p_unk0x24, MxS32& p_unk0x2c);
// FUNCTION: BETA10 0x1002c2b0
MxS16 GetCount() { return m_count; }
@ -167,9 +178,12 @@ class LegoGameState {
// FUNCTION: BETA10 0x1002c540
ScoreItem* GetScore(MxS32 p_index) { return p_index >= m_count ? NULL : &m_scores[p_index]; }
MxS16 m_count; // 0x00
ScoreItem m_scores[20]; // 0x02
MxS16 m_unk0x372; // 0x372
MxS16 m_count; // 0x00
#ifdef BETA10
MxS16 m_indices[20]; // 0x02
#endif
ScoreItem m_scores[20]; // 0x02 (0x22 for BETA10)
MxS16 m_nextPlayerId; // 0x372 (0x392 for BETA10)
};
LegoGameState();
@ -209,14 +223,8 @@ class LegoGameState {
Act GetCurrentAct() { return m_currentAct; }
Act GetLoadedAct() { return m_loadedAct; }
Area GetPreviousArea() { return m_previousArea; }
Area GetUnknown0x42c() { return m_unk0x42c; }
void SetDirty(MxBool p_isDirty) { m_isDirty = p_isDirty; }
void SetPreviousArea(Area p_previousArea) { m_previousArea = p_previousArea; }
void SetActorId(MxU8 p_actorId) { m_actorId = p_actorId; }
Username* GetPlayersIndex(MxS32 p_index) { return &m_players[p_index]; }
MxS16 GetPlayerCount() { return m_playerCount; }
LegoBackgroundColor* GetBackgroundColor() { return m_backgroundColor; }
void SetCurrentAct(Act p_currentAct);
@ -228,7 +236,7 @@ class LegoGameState {
MxResult WriteEndOfVariables(LegoStorage* p_storage);
MxS32 ReadVariable(LegoStorage* p_storage, MxVariableTable* p_to);
void SetColors();
void SetROIHandlerFunction();
void SetROIColorOverride();
char* m_savePath; // 0x00
MxS16 m_stateCount; // 0x04
@ -240,14 +248,11 @@ class LegoGameState {
LegoBackgroundColor* m_tempBackgroundColor; // 0x1c
LegoFullScreenMovie* m_fullScreenMovie; // 0x20
// TODO: Most likely getters/setters are not used according to BETA for the following members:
public:
MxS16 m_unk0x24; // 0x24
MxS16 m_currentPlayerId; // 0x24
MxS16 m_playerCount; // 0x26
Username m_players[9]; // 0x28
History m_history; // 0xa6
undefined2 m_unk0x41a; // 0x41a
JukeboxScript::Script m_jukeboxMusic; // 0x41c
MxBool m_isDirty; // 0x420
Area m_currentArea; // 0x424
@ -255,7 +260,7 @@ class LegoGameState {
Area m_unk0x42c; // 0x42c
};
MxBool ROIHandlerFunction(const char* p_input, char* p_output, MxU32 p_copyLen);
MxBool ROIColorOverride(const char* p_input, char* p_output, MxU32 p_copyLen);
// SYNTHETIC: LEGO1 0x1003c860
// LegoGameState::ScoreItem::ScoreItem

View File

@ -13,8 +13,8 @@ class LegoCameraController;
class LegoControlManager;
class LegoWorld;
extern MxS32 g_unk0x100f31b0;
extern const char* g_unk0x100f31b4;
extern MxS32 g_clickedObjectId;
extern const char* g_clickedAtom;
// VTABLE: LEGO1 0x100d87b8
// class MxCollection<LegoEventNotificationParam>
@ -74,7 +74,7 @@ class LegoInputManager : public MxPresenter {
c_right = 0x02,
c_up = 0x04,
c_down = 0x08,
c_bit5 = 0x10,
c_ctrl = 0x10,
c_leftOrRight = c_left | c_right,
c_upOrDown = c_up | c_down

View File

@ -90,9 +90,6 @@ class LegoOmni : public MxOmni {
return *this;
}
World GetId() { return m_id; }
const char* GetKey() { return m_key; }
World m_id; // 0x00
char m_key[20]; // 0x04
MxAtomId* m_atomId; // 0x18
@ -186,7 +183,7 @@ class LegoOmni : public MxOmni {
MxResult StartActionIfUnknown0x13c(MxDSAction& p_dsAction) { return m_unk0x13c ? Start(&p_dsAction) : SUCCESS; }
void SetUnknown13c(MxBool p_unk0x13c) { m_unk0x13c = p_unk0x13c; }
void CloseMainWindow() { PostMessageA(m_windowHandle, WM_CLOSE, 0, 0); }
void CloseMainWindow() { PostMessage(m_windowHandle, WM_CLOSE, 0, 0); }
// SYNTHETIC: LEGO1 0x10058b30
// LegoOmni::`scalar deleting destructor'

View File

@ -46,7 +46,7 @@ class LegoModelPresenter : public MxVideoPresenter {
void ReadyTickle() override; // vtable+0x18
void ParseExtra() override; // vtable+0x30
MxResult FUN_1007ff70(MxDSChunk& p_chunk, LegoEntity* p_entity, MxBool p_roiVisible, LegoWorld* p_world);
MxResult CreateROI(MxDSChunk& p_chunk, LegoEntity* p_entity, MxBool p_roiVisible, LegoWorld* p_world);
void Reset()
{

View File

@ -155,7 +155,7 @@ class LegoNavController : public MxCore {
float m_unk0x60; // 0x60
float m_unk0x64; // 0x64
float m_unk0x68; // 0x68
MxBool m_unk0x6c; // 0x6c
MxBool m_isAccelerating; // 0x6c
// one copy of defaults (these can be set by App.)
static int g_defdeadZone;

View File

@ -10,10 +10,10 @@ struct LegoNamedPlane;
class LegoPathBoundary;
class LegoPathController;
struct LegoPathEdgeContainer;
struct LegoUnknown100db7f4;
struct LegoOrientedEdge;
class LegoWEEdge;
extern MxLong g_unk0x100f3308;
extern MxLong g_timeLastHitSoundPlayed;
extern const char* g_strHIT_WALL_SOUND;
// VTABLE: LEGO1 0x100d6e28
@ -51,9 +51,11 @@ class LegoPathActor : public LegoActor {
virtual void VTable0x74(Matrix4& p_transform); // vtable+0x74
// FUNCTION: LEGO1 0x10002d20
// FUNCTION: BETA10 0x1000f500
virtual void SetUserNavFlag(MxBool p_userNavFlag) { m_userNavFlag = p_userNavFlag; } // vtable+0x78
// FUNCTION: LEGO1 0x10002d30
// FUNCTION: BETA10 0x1000f530
virtual MxBool GetUserNavFlag() { return m_userNavFlag; } // vtable+0x7c
virtual MxResult VTable0x80(
@ -67,7 +69,7 @@ class LegoPathActor : public LegoActor {
float p_time,
Vector3& p_p1,
Vector3& p_p4,
LegoUnknown100db7f4& p_destEdge,
LegoOrientedEdge* p_destEdge,
float p_destScale
); // vtable+0x84
virtual MxResult VTable0x88(
@ -75,49 +77,59 @@ class LegoPathActor : public LegoActor {
float p_time,
LegoEdge& p_srcEdge,
float p_srcScale,
LegoUnknown100db7f4& p_destEdge,
LegoOrientedEdge& p_destEdge,
float p_destScale
); // vtable+0x88
virtual MxS32 VTable0x8c(float p_time, Matrix4& p_transform); // vtable+0x8c
// FUNCTION: LEGO1 0x10002d40
// FUNCTION: BETA10 0x1000f560
virtual MxU32 VTable0x90(float, Matrix4&) { return FALSE; } // vtable+0x90
// FUNCTION: LEGO1 0x10002d50
// FUNCTION: BETA10 0x1000f800
virtual MxResult HitActor(LegoPathActor*, MxBool) { return 0; } // vtable+0x94
virtual void SwitchBoundary(
LegoPathBoundary*& p_boundary,
LegoUnknown100db7f4*& p_edge,
LegoOrientedEdge*& p_edge,
float& p_unk0xe4
); // vtable+0x98
virtual MxResult VTable0x9c(); // vtable+0x9c
// FUNCTION: LEGO1 0x10002d60
// FUNCTION: BETA10 0x1000f820
virtual MxS32 VTable0xa0() { return 0; } // vtable+0xa0
virtual void VTable0xa4(MxBool& p_und1, MxS32& p_und2); // vtable+0xa4
virtual void VTable0xa8(); // vtable+0xa8
// FUNCTION: LEGO1 0x10002d70
// FUNCTION: BETA10 0x1000f580
virtual void SetMaxLinearVel(MxFloat p_maxLinearVel) { m_maxLinearVel = p_maxLinearVel; } // vtable+0xac
// FUNCTION: LEGO1 0x10002d80
// FUNCTION: BETA10 0x1000f5b0
virtual MxFloat GetMaxLinearVel() { return m_maxLinearVel; } // vtable+0xb0
// FUNCTION: LEGO1 0x10002d90
// FUNCTION: BETA10 0x1000f5e0
virtual MxFloat VTable0xb4() { return m_unk0x140; } // vtable+0xb4
// FUNCTION: LEGO1 0x10002da0
// FUNCTION: BETA10 0x1000f610
virtual MxFloat VTable0xb8() { return m_unk0x144; } // vtable+0xb8
// FUNCTION: LEGO1 0x10002db0
// FUNCTION: BETA10 0x1000f640
virtual void VTable0xbc(MxFloat p_unk0x140) { m_unk0x140 = p_unk0x140; } // vtable+0xbc
// FUNCTION: LEGO1 0x10002dc0
// FUNCTION: BETA10 0x1000f670
virtual void VTable0xc0(MxFloat p_unk0x144) { m_unk0x144 = p_unk0x144; } // vtable+0xc0
// FUNCTION: LEGO1 0x10002dd0
// FUNCTION: BETA10 0x1000f6a0
virtual void VTable0xc4() {} // vtable+0xc4
// FUNCTION: LEGO1 0x10002de0
@ -132,6 +144,7 @@ class LegoPathActor : public LegoActor {
}
// FUNCTION: LEGO1 0x1000c440
// FUNCTION: BETA10 0x100124c0
MxBool IsA(const char* p_name) const override // vtable+0x10
{
return !strcmp(p_name, LegoPathActor::ClassName()) || LegoActor::IsA(p_name);
@ -161,6 +174,7 @@ class LegoPathActor : public LegoActor {
void PlaceActor(LegoNamedPlane& p_namedPlane);
// SYNTHETIC: LEGO1 0x1002d800
// SYNTHETIC: BETA10 0x100b04d0
// LegoPathActor::`scalar deleting destructor'
protected:
@ -182,7 +196,7 @@ class LegoPathActor : public LegoActor {
LegoPathBoundary* m_boundary; // 0x88
LegoUnknown m_unk0x8c; // 0x8c
MxU32 m_actorState; // 0xdc
LegoUnknown100db7f4* m_destEdge; // 0xe0
LegoOrientedEdge* m_destEdge; // 0xe0
MxFloat m_unk0xe4; // 0xe4
MxBool m_collideBox; // 0xe8
MxBool m_unk0xe9; // 0xe9

View File

@ -39,22 +39,16 @@ class LegoPathBoundary : public LegoWEGEdge {
MxResult AddActor(LegoPathActor* p_actor);
MxResult RemoveActor(LegoPathActor* p_actor);
void FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPathActor* p_actor);
void CheckAndCallPathTriggers(Vector3& p_point1, Vector3& p_point2, LegoPathActor* p_actor);
void SwitchBoundary(
LegoPathActor* p_actor,
LegoPathBoundary*& p_boundary,
LegoUnknown100db7f4*& p_edge,
LegoOrientedEdge*& p_edge,
float& p_unk0xe4
);
MxU32 Intersect(
float p_scale,
Vector3& p_point1,
Vector3& p_point2,
Vector3& p_point3,
LegoUnknown100db7f4*& p_edge
);
MxU32 FUN_10057fe0(LegoAnimPresenter* p_presenter);
MxU32 FUN_100586e0(LegoAnimPresenter* p_presenter);
MxU32 Intersect(float p_scale, Vector3& p_point1, Vector3& p_point2, Vector3& p_point3, LegoOrientedEdge*& p_edge);
MxU32 AddPresenterIfInRange(LegoAnimPresenter* p_presenter);
MxU32 RemovePresenter(LegoAnimPresenter* p_presenter);
// FUNCTION: BETA10 0x1001ffb0
LegoPathActorSet& GetActors() { return m_actors; }
@ -188,7 +182,7 @@ class LegoPathBoundary : public LegoWEGEdge {
// _Tree<LegoPathActor *,LegoPathActor *,set<LegoPathActor *,LegoPathActorSetCompare,allocator<LegoPathActor *> >::_Kfn,LegoPathActorSetCompare,allocator<LegoPathActor *> >::lower_bound
// TEMPLATE: BETA10 0x10082b90
// _Tree<LegoAnimPresenter *,LegoAnimPresenter *,set<LegoAnimPresenter *,LegoAnimPresenterSetCompare,allocator<LegoAnimPresenter *> >::_Kfn,LegoAnimPresenterSetCompare,allocator<LegoAnimPresenter *> >::const_iterator::operator++
// ??Econst_iterator@?$_Tree@PAVLegoAnimPresenter@@PAV1@U_Kfn@?$set@PAVLegoAnimPresenter@@ULegoAnimPresenterSetCompare@@V?$allocator@PAVLegoAnimPresenter@@@@@@ULegoAnimPresenterSetCompare@@V?$allocator@PAVLegoAnimPresenter@@@@@@QAE?AV01@H@Z
// TEMPLATE: BETA10 0x10082ee0
// set<LegoAnimPresenter *,LegoAnimPresenterSetCompare,allocator<LegoAnimPresenter *> >::end
@ -203,13 +197,13 @@ class LegoPathBoundary : public LegoWEGEdge {
// _Tree<LegoAnimPresenter *,LegoAnimPresenter *,set<LegoAnimPresenter *,LegoAnimPresenterSetCompare,allocator<LegoAnimPresenter *> >::_Kfn,LegoAnimPresenterSetCompare,allocator<LegoAnimPresenter *> >::find
// TEMPLATE: BETA10 0x10021dc0
// Set<LegoPathActor *,LegoPathActorSetCompare>::Set<LegoPathActor *,LegoPathActorSetCompare>
// ??0?$Set@PAVLegoPathActor@@ULegoPathActorSetCompare@@@@QAE@ABV0@@Z
// TEMPLATE: BETA10 0x100202d0
// set<LegoPathActor *,LegoPathActorSetCompare,allocator<LegoPathActor *> >::begin
// TEMPLATE: BETA10 0x10020030
// _Tree<LegoPathActor *,LegoPathActor *,set<LegoPathActor *,LegoPathActorSetCompare,allocator<LegoPathActor *> >::_Kfn,LegoPathActorSetCompare,allocator<LegoPathActor *> >::const_iterator::operator++
// ??Econst_iterator@?$_Tree@PAVLegoPathActor@@PAV1@U_Kfn@?$set@PAVLegoPathActor@@ULegoPathActorSetCompare@@V?$allocator@PAVLegoPathActor@@@@@@ULegoPathActorSetCompare@@V?$allocator@PAVLegoPathActor@@@@@@QAE?AV01@H@Z
// TEMPLATE: BETA10 0x100203d0
// set<LegoPathActor *,LegoPathActorSetCompare,allocator<LegoPathActor *> >::end

View File

@ -2,7 +2,7 @@
#define LEGOPATHCONTROLLER_H
#include "decomp.h"
#include "geom/legounkown100db7f4.h"
#include "geom/legoorientededge.h"
#include "legopathactor.h"
#include "legopathboundary.h"
#include "legopathstruct.h"
@ -21,7 +21,7 @@ class Vector3;
// VTABLE: LEGO1 0x100d7da8
// SIZE 0x40
struct LegoPathCtrlEdge : public LegoUnknown100db7f4 {};
struct LegoPathCtrlEdge : public LegoOrientedEdge {};
struct LegoPathCtrlEdgeCompare {
MxU32 operator()(const LegoPathCtrlEdge* p_lhs, const LegoPathCtrlEdge* p_rhs) const
@ -60,7 +60,7 @@ class LegoPathController : public MxCore {
}
LegoPathController* m_controller; // 0x00
LegoUnknown100db7f4* m_edge; // 0x04
LegoOrientedEdge* m_edge; // 0x04
};
LegoPathController();
@ -105,7 +105,7 @@ class LegoPathController : public MxCore {
MxResult PlaceActor(LegoPathActor* p_actor);
MxResult RemoveActor(LegoPathActor* p_actor);
void FUN_100468f0(LegoAnimPresenter* p_presenter);
void FUN_10046930(LegoAnimPresenter* p_presenter);
void RemovePresenterFromBoundaries(LegoAnimPresenter* p_presenter);
MxResult FUN_10046b30(LegoPathBoundary*& p_boundaries, MxS32& p_numL);
LegoPathBoundary* GetPathBoundary(const char* p_name);
void Enable(MxBool p_enable);
@ -126,7 +126,7 @@ class LegoPathController : public MxCore {
Vector3& p_v1,
Vector3& p_v2,
float p_f1,
LegoUnknown100db7f4*& p_edge,
LegoOrientedEdge*& p_edge,
LegoPathBoundary*& p_boundary
);
MxResult FUN_1004a380(
@ -144,13 +144,13 @@ class LegoPathController : public MxCore {
static MxResult Reset();
// FUNCTION: BETA10 0x100cf580
static LegoUnknown100db7f4* GetControlEdgeA(MxS32 p_index) { return g_ctrlEdgesA[p_index].m_edge; }
static LegoOrientedEdge* GetControlEdgeA(MxS32 p_index) { return g_ctrlEdgesA[p_index].m_edge; }
// FUNCTION: BETA10 0x100cf5b0
static LegoPathBoundary* GetControlBoundaryA(MxS32 p_index) { return g_ctrlBoundariesA[p_index].m_boundary; }
// These two are an educated guess because BETA10 does not have the g_ctrl.*B globals
static LegoUnknown100db7f4* GetControlEdgeB(MxS32 p_index) { return g_ctrlEdgesB[p_index].m_edge; }
static LegoOrientedEdge* GetControlEdgeB(MxS32 p_index) { return g_ctrlEdgesB[p_index].m_edge; }
static LegoPathBoundary* GetControlBoundaryB(MxS32 p_index) { return g_ctrlBoundariesB[p_index].m_boundary; }
private:
@ -189,12 +189,12 @@ class LegoPathController : public MxCore {
LegoPathBoundary* m_boundaries; // 0x08
LegoPathCtrlEdge* m_edges; // 0x0c
Mx3DPointFloat* m_unk0x10; // 0x10
Mx3DPointFloat* m_nodes; // 0x10
LegoPathStruct* m_structs; // 0x14
MxU16 m_numL; // 0x18
MxU16 m_numE; // 0x1a
MxU16 m_numN; // 0x1c
MxU16 m_numT; // 0x1e
MxU16 m_numL; // 0x18 Number of boundaries
MxU16 m_numE; // 0x1a Number of edges
MxU16 m_numN; // 0x1c Number of nodes
MxU16 m_numT; // 0x1e Number of structs
LegoPathCtrlEdgeSet m_pfsE; // 0x20
LegoPathActorSet m_actors; // 0x30
@ -264,7 +264,7 @@ class LegoPathController : public MxCore {
// LegoPathCtrlEdge::~LegoPathCtrlEdge
// SYNTHETIC: LEGO1 0x10047ae0
// LegoUnknown100db7f4::~LegoUnknown100db7f4
// LegoOrientedEdge::~LegoOrientedEdge
// TEMPLATE: LEGO1 0x10048f00
// list<LegoBoundaryEdge,allocator<LegoBoundaryEdge> >::begin

View File

@ -10,32 +10,32 @@ class LegoTextureInfo;
// SIZE 0x20
class LegoPhoneme {
public:
LegoPhoneme(const char* p_name, undefined4 p_unk0x14)
LegoPhoneme(const char* p_name, MxU32 p_count)
{
m_name = p_name;
m_name.ToUpperCase();
Init();
m_unk0x14 = p_unk0x14;
m_count = p_count;
}
~LegoPhoneme();
virtual undefined4 VTable0x00(); // vtable+0x00
virtual void VTable0x04(undefined4 p_unk0x14); // vtable+0x04
virtual LegoTextureInfo* VTable0x08(); // vtable+0x08
virtual void VTable0x0c(LegoTextureInfo* p_unk0x18); // vtable+0x0c
virtual LegoTextureInfo* VTable0x10(); // vtable+0x10
virtual void VTable0x14(LegoTextureInfo* p_unk0x1c); // vtable+0x14
virtual void VTable0x18(); // vtable+0x18
virtual void Init(); // vtable+0x1c
virtual void VTable0x20(undefined4); // vtable+0x20
virtual MxU32 GetCount(); // vtable+0x00
virtual void SetCount(MxU32 p_count); // vtable+0x04
virtual LegoTextureInfo* GetTextureInfo(); // vtable+0x08
virtual void SetTextureInfo(LegoTextureInfo* p_textureInfo); // vtable+0x0c
virtual LegoTextureInfo* GetCachedTextureInfo(); // vtable+0x10
virtual void SetCachedTextureInfo(LegoTextureInfo* p_cachedTextureInfo); // vtable+0x14
virtual void VTable0x18(); // vtable+0x18
virtual void Init(); // vtable+0x1c
virtual void VTable0x20(undefined4); // vtable+0x20
MxString& GetName() { return m_name; }
private:
MxString m_name; // 0x04
undefined4 m_unk0x14; // 0x14
LegoTextureInfo* m_unk0x18; // 0x18
LegoTextureInfo* m_unk0x1c; // 0x1c
MxString m_name; // 0x04
MxU32 m_count; // 0x14
LegoTextureInfo* m_textureInfo; // 0x18
LegoTextureInfo* m_cachedTextureInfo; // 0x1c
};
#endif // LEGOPHONEME_H

View File

@ -49,14 +49,14 @@ class LegoPlantManager : public MxCore {
MxBool SwitchMove(LegoEntity* p_entity);
MxBool SwitchMood(LegoEntity* p_entity);
MxU32 GetAnimationId(LegoEntity* p_entity);
MxU32 GetSoundId(LegoEntity* p_entity, MxBool p_state);
MxU32 GetSoundId(LegoEntity* p_entity, MxBool p_basedOnMood);
LegoPlantInfo* GetInfoArray(MxS32& p_length);
LegoEntity* CreatePlant(MxS32 p_index, LegoWorld* p_world, LegoOmni::World p_worldId);
MxBool FUN_10026c50(LegoEntity* p_entity);
MxBool DecrementCounter(LegoEntity* p_entity);
void ScheduleAnimation(LegoEntity* p_entity, MxLong p_length);
MxResult FUN_10026410();
void FUN_10027120();
void FUN_10027200();
MxResult DetermineBoundaries();
void ClearCounters();
void SetInitialCounters();
static void SetCustomizeAnimFile(const char* p_value);
@ -68,20 +68,20 @@ class LegoPlantManager : public MxCore {
private:
void RemovePlant(MxS32 p_index, LegoOmni::World p_worldId);
void FUN_10026860(MxS32 p_index);
void AdjustHeight(MxS32 p_index);
LegoPlantInfo* GetInfo(LegoEntity* p_entity);
MxBool FUN_10026c80(MxS32 p_index);
void FUN_100271b0(LegoEntity* p_entity, MxS32 p_adjust);
MxBool DecrementCounter(MxS32 p_index);
void AdjustCounter(LegoEntity* p_entity, MxS32 p_adjust);
static char* g_customizeAnimFile;
static MxS32 g_maxMove[4];
static MxU32 g_maxSound;
LegoOmni::World m_worldId; // 0x08
undefined m_unk0x0c; // 0x0c
AnimEntry* m_entries[5]; // 0x10
MxS8 m_numEntries; // 0x24
LegoWorld* m_world; // 0x28
LegoOmni::World m_worldId; // 0x08
MxBool m_boundariesDetermined; // 0x0c
AnimEntry* m_entries[5]; // 0x10
MxS8 m_numEntries; // 0x24
LegoWorld* m_world; // 0x28
};
#endif // LEGOPLANTMANAGER_H

View File

@ -41,8 +41,8 @@ struct LegoPlantInfo {
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
MxS8 m_counter; // 0x16
MxS8 m_initialCounter; // 0x17 - initial value loaded to m_counter
const char* m_name; // 0x18
undefined4 m_unk0x1c; // 0x1c
float m_x; // 0x20

View File

@ -11,7 +11,7 @@
#include "mxtypes.h"
class Act1State;
class LegoEventNotificationParam;
class LegoControlManagerNotificationParam;
class LegoPathActor;
class MxEndActionNotificationParam;
class MxNotificationParam;
@ -117,7 +117,7 @@ class LegoRace : public LegoWorld {
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
virtual MxLong HandleClick(LegoEventNotificationParam&) = 0; // vtable+0x6c
virtual MxLong HandleControl(LegoControlManagerNotificationParam&) = 0; // vtable+0x6c
// FUNCTION: LEGO1 0x10015b70
virtual MxLong HandlePathStruct(LegoPathStructNotificationParam&) { return 0; } // vtable+0x70

View File

@ -72,7 +72,7 @@ class LegoJetski : public LegoJetskiRaceActor, public LegoRaceMap {
MxResult HitActor(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
// FUNCTION: LEGO1 0x100141d0
void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) override
void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoOrientedEdge*& p_edge, float& p_unk0xe4) override
{
LegoJetskiRaceActor::SwitchBoundary(p_boundary, p_edge, p_unk0xe4);
} // vtable+0x98
@ -136,7 +136,7 @@ class LegoRaceCar : public LegoCarRaceActor, public LegoRaceMap {
// FUNCTION: LEGO1 0x10014560
// FUNCTION: BETA10 0x100cd660
void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) override
void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoOrientedEdge*& p_edge, float& p_unk0xe4) override
{
LegoCarRaceActor::SwitchBoundary(p_boundary, p_edge, p_unk0xe4);
} // vtable+0x98
@ -144,10 +144,10 @@ class LegoRaceCar : public LegoCarRaceActor, public LegoRaceMap {
MxResult VTable0x9c() override; // vtable+0x9c
virtual void SetMaxLinearVelocity(float p_maxLinearVelocity);
virtual void FUN_10012ff0(float p_param);
virtual void KickCamera(float p_param);
virtual MxU32 HandleSkeletonKicks(float p_param1);
static void FUN_10012de0();
static void InitYouCantStopSound();
static void InitSoundIndices();
// SYNTHETIC: LEGO1 0x10014240
@ -155,7 +155,7 @@ class LegoRaceCar : public LegoCarRaceActor, public LegoRaceMap {
private:
undefined m_userState; // 0x54
float m_unk0x58; // 0x58
float m_kickStart; // 0x58
Mx3DPointFloat m_unk0x5c; // 0x5c
// Names verified by BETA10 0x100cb4a9

View File

@ -44,8 +44,11 @@ class LegoCarRaceActor : public virtual LegoRaceActor {
Vector3& p_v3
) override; // vtable+0x6c
void Animate(float p_time) override; // vtable+0x70
void SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
override; // vtable+0x98
void SwitchBoundary(
LegoPathBoundary*& p_boundary,
LegoOrientedEdge*& p_edge,
float& p_unk0xe4
) override; // vtable+0x98
MxResult VTable0x9c() override; // vtable+0x9c
// LegoCarRaceActor vtable
@ -83,7 +86,7 @@ class LegoCarRaceActor : public virtual LegoRaceActor {
protected:
MxFloat m_unk0x08; // 0x08
MxU8 m_unk0x0c; // 0x0c
MxU8 m_animState; // 0x0c
// Could be a multiplier for the maximum speed when going straight
MxFloat m_unk0x10; // 0x10

View File

@ -19,7 +19,7 @@ class LegoTextureInfo {
static BOOL SetGroupTexture(Tgl::Mesh* pMesh, LegoTextureInfo* p_textureInfo);
static BOOL GetGroupTexture(Tgl::Mesh* pMesh, LegoTextureInfo*& p_textureInfo);
LegoResult FUN_10066010(const LegoU8* p_bits);
LegoResult LoadBits(const LegoU8* p_bits);
// private:
char* m_name; // 0x00

View File

@ -45,28 +45,28 @@ LegoROI* PickROI(MxLong p_x, MxLong p_y);
LegoROI* PickRootROI(MxLong p_x, MxLong p_y);
void RotateY(LegoROI* p_roi, MxFloat p_angle);
MxBool SpheresIntersect(const BoundingSphere& p_sphere1, const BoundingSphere& p_sphere2);
MxBool FUN_1003ded0(MxFloat p_param1[2], MxFloat p_param2[3], MxFloat p_param3[3]);
MxBool CalculateRayOriginDirection(MxFloat p_coordinates[2], MxFloat p_direction[3], MxFloat p_origin[3]);
MxBool TransformWorldToScreen(const MxFloat p_world[3], MxFloat p_screen[4]);
MxS16 CountTotalTreeNodes(LegoTreeNode* p_node);
LegoTreeNode* GetTreeNode(LegoTreeNode* p_node, MxU32 p_index);
void FUN_1003e050(LegoAnimPresenter* p_presenter);
void CalculateViewFromAnimation(LegoAnimPresenter* p_presenter);
Extra::ActionType MatchActionString(const char*);
void InvokeAction(Extra::ActionType p_actionId, const MxAtomId& p_pAtom, MxS32 p_streamId, LegoEntity* p_sender);
void SetCameraControllerFromIsle();
void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bOut, float* p_gOut);
void PlayCamAnim(LegoPathActor* p_actor, MxBool p_unused, MxU32 p_location, MxBool p_bool);
void FUN_1003eda0();
void ResetViewVelocity();
MxBool RemoveFromCurrentWorld(const MxAtomId& p_atomId, MxS32 p_id);
void EnableAnimations(MxBool p_enable);
void SetAppCursor(Cursor p_cursor);
MxBool FUN_1003ef60();
MxBool CanExit();
MxBool RemoveFromWorld(MxAtomId& p_entityAtom, MxS32 p_entityId, MxAtomId& p_worldAtom, MxS32 p_worldEntityId);
MxS32 UpdateLightPosition(MxS32 p_increase);
void SetLightPosition(MxS32 p_index);
LegoNamedTexture* ReadNamedTexture(LegoStorage* p_storage);
void WriteDefaultTexture(LegoStorage* p_storage, const char* p_name);
void WriteNamedTexture(LegoStorage* p_storage, LegoNamedTexture* p_namedTexture);
void FUN_1003f930(LegoNamedTexture* p_namedTexture);
void LoadFromNamedTexture(LegoNamedTexture* p_namedTexture);
// FUNCTION: BETA10 0x100260a0
inline void StartIsleAction(IsleScript::Script p_objectId)

View File

@ -125,17 +125,17 @@ class LegoWorld : public LegoEntity {
// LegoWorld::`scalar deleting destructor'
protected:
LegoPathControllerList m_list0x68; // 0x68
MxPresenterList m_animPresenters; // 0x80
LegoCameraController* m_cameraController; // 0x98
LegoEntityList* m_entityList; // 0x9c
LegoCacheSoundList* m_cacheSoundList; // 0xa0
MxBool m_destroyed; // 0xa4
MxCoreSet m_set0xa8; // 0xa8
MxPresenterList m_controlPresenters; // 0xb8
MxCoreSet m_set0xd0; // 0xd0
list<LegoROI*> m_roiList; // 0xe0
LegoOmni::World m_worldId; // 0xec
LegoPathControllerList m_pathControllerList; // 0x68
MxPresenterList m_animPresenters; // 0x80
LegoCameraController* m_cameraController; // 0x98
LegoEntityList* m_entityList; // 0x9c
LegoCacheSoundList* m_cacheSoundList; // 0xa0
MxBool m_destroyed; // 0xa4
MxCoreSet m_set0xa8; // 0xa8
MxPresenterList m_controlPresenters; // 0xb8
MxCoreSet m_set0xd0; // 0xd0
list<LegoROI*> m_roiList; // 0xe0
LegoOmni::World m_worldId; // 0xec
// name verified by BETA10 0x100c7f59
LegoHideAnimPresenter* m_hideAnim; // 0xf0

View File

@ -50,10 +50,10 @@ class LegoWorldPresenter : public LegoEntityPresenter {
// LegoWorldPresenter::`scalar deleting destructor'
private:
MxResult FUN_10067360(ModelDbPart& p_part, FILE* p_wdbFile);
MxResult FUN_100674b0(ModelDbModel& p_model, FILE* p_wdbFile, LegoWorld* p_world);
MxResult LoadWorldPart(ModelDbPart& p_part, FILE* p_wdbFile);
MxResult LoadWorldModel(ModelDbModel& p_model, FILE* p_wdbFile, LegoWorld* p_world);
undefined4 m_unk0x50;
MxU32 m_nextObjectId;
};
#endif // LEGOWORLDPRESENTER_H

View File

@ -37,11 +37,11 @@ class MxBackgroundAudioManager : public MxCore {
void StartAction(MxParam& p_param);
void StopAction(MxParam& p_param);
MxResult PlayMusic(MxDSAction& p_action, undefined4 p_speed, MxPresenter::TickleState p_tickleState);
MxResult PlayMusic(MxDSAction& p_action, MxS32 p_speed, MxPresenter::TickleState p_tickleState);
void FUN_1007ee70();
void FUN_1007ef40();
void FadeInOrFadeOut();
void MakePendingPresenterActive();
void FadeInPendingPresenter();
void FadeToTargetVolume();
void Enable(MxBool p_enable);
virtual MxResult Create(MxAtomId& p_script, MxU32 p_frequencyMS);
@ -50,7 +50,7 @@ class MxBackgroundAudioManager : public MxCore {
void Stop();
void LowerVolume();
void RaiseVolume();
undefined4 FUN_1007f610(MxPresenter* p_unk0x138, MxS32 p_speed, MxPresenter::TickleState p_tickleState);
MxResult SetPendingPresenter(MxPresenter* p_presenter, MxS32 p_speed, MxPresenter::TickleState p_tickleState);
// SYNTHETIC: LEGO1 0x1007ec00
// MxBackgroundAudioManager::`scalar deleting destructor'
@ -59,11 +59,11 @@ class MxBackgroundAudioManager : public MxCore {
MxResult OpenMusic(MxAtomId& p_script);
void DestroyMusic();
MxBool m_enabled; // 0x08
MxDSAction m_action1; // 0x0c
MxAudioPresenter* m_unk0xa0; // 0xa0
MxDSAction m_action2; // 0xa4
MxAudioPresenter* m_unk0x138; // 0x138
MxBool m_enabled; // 0x08
MxDSAction m_action1; // 0x0c
MxAudioPresenter* m_activePresenter; // 0xa0
MxDSAction m_action2; // 0xa4
MxAudioPresenter* m_pendingPresenter; // 0x138
// name is inferred from context
MxPresenter::TickleState m_tickleState; // 0x13c
@ -71,9 +71,9 @@ class MxBackgroundAudioManager : public MxCore {
// name inferred from parameter p_speed
MxS32 m_speed; // 0x140
MxS32 m_targetVolume; // 0x144
MxS16 m_unk0x148; // 0x148
MxAtomId m_script; // 0x14c
MxS32 m_targetVolume; // 0x144
MxS16 m_volumeSuppressionAmount; // 0x148
MxAtomId m_script; // 0x14c
};
#endif // MXBACKGROUNDAUDIOMANAGER_H

View File

@ -44,21 +44,28 @@ class MxControlPresenter : public MxCompositePresenter {
void EndAction() override; // vtable+0x40
MxBool HasTickleStatePassed(TickleState p_tickleState) override; // vtable+0x48
void Enable(MxBool p_enable) override; // vtable+0x54
virtual void VTable0x6c(MxS16 p_unk0x4e); // vtable+0x6c
virtual void UpdateEnabledChild(MxS16 p_enabledChild); // vtable+0x6c
MxBool FUN_10044480(LegoControlManagerNotificationParam* p_param, MxPresenter* p_presenter);
MxBool FUN_10044270(MxS32 p_x, MxS32 p_y, MxPresenter* p_presenter);
MxBool Notify(LegoControlManagerNotificationParam* p_param, MxPresenter* p_presenter);
MxBool CheckButtonDown(MxS32 p_x, MxS32 p_y, MxPresenter* p_presenter);
MxS16 GetUnknown0x4e() { return m_unk0x4e; }
MxS16 GetEnabledChild() { return m_enabledChild; }
private:
MxS16 m_unk0x4c; // 0x4c
MxS16 m_unk0x4e; // 0x4e
MxBool m_unk0x50; // 0x50
MxS16 m_unk0x52; // 0x52
MxS16 m_unk0x54; // 0x54
MxS16 m_unk0x56; // 0x56
MxS16* m_states; // 0x58
enum {
e_none,
e_toggle,
e_grid,
e_map,
};
MxS16 m_style; // 0x4c
MxS16 m_enabledChild; // 0x4e
MxBool m_unk0x50; // 0x50
MxS16 m_columnsOrRows; // 0x52
MxS16 m_rowsOrColumns; // 0x54
MxS16 m_stateOrCellIndex; // 0x56
MxS16* m_states; // 0x58
};
// SYNTHETIC: LEGO1 0x100440f0

View File

@ -125,10 +125,10 @@ class PizzaMissionState : public LegoState {
MxResult Serialize(LegoStorage* p_storage) override; // vtable+0x1c
// FUNCTION: BETA10 0x100ef470
void SetUnknown0xb0(MxU32 p_unk0xb0) { m_unk0xb0 = p_unk0xb0; }
void SetPlayedAction(MxU32 p_playedAction) { m_playedAction = p_playedAction; }
// FUNCTION: BETA10 0x100ef850
MxU32 GetUnknown0xb0() { return m_unk0xb0; }
MxU32 GetPlayedAction() { return m_playedAction; }
// FUNCTION: BETA10 0x10088850
MxS16 GetHighScore(MxU8 p_actorId) { return GetMission(p_actorId)->m_hiScore; }
@ -137,12 +137,12 @@ class PizzaMissionState : public LegoState {
// PizzaMissionState::`scalar deleting destructor'
Mission* GetMission(MxU8 p_actorId);
MxS16 FUN_10039540();
MxS16 GetActorState();
PizzeriaState* m_pizzeriaState; // 0x08
undefined4 m_unk0x0c; // 0x0c
Mission m_missions[5]; // 0x10
MxU32 m_unk0xb0; // 0xb0
MxU32 m_playedAction; // 0xb0
static IsleScript::Script g_pepperActions[];
static IsleScript::Script g_mamaActions[];
@ -202,9 +202,9 @@ class Pizza : public IsleActor {
PizzaMissionState::Mission* m_mission; // 0x80
SkateBoard* m_skateBoard; // 0x84
Act1State* m_act1state; // 0x88
IsleScript::Script m_unk0x8c; // 0x8c
MxLong m_unk0x90; // 0x90
MxLong m_unk0x94; // 0x94
IsleScript::Script m_speechAction; // 0x8c
MxLong m_startTime; // 0x90
MxLong m_duration; // 0x94
MxBool m_unk0x98; // 0x98
};

View File

@ -34,11 +34,11 @@ class PizzeriaState : public LegoState {
// SYNTHETIC: LEGO1 0x10017ce0
// PizzeriaState::`scalar deleting destructor'
MxS16 FUN_10017d50();
MxS16 GetActorState();
MxU32 NextAction();
Playlist m_unk0x08[5]; // 0x08
MxS32 m_unk0x44[5]; // 0x44
Playlist m_playerPlaylists[5]; // 0x08
MxS32 m_states[5]; // 0x44
static IsleScript::Script g_pepperActions[];
static IsleScript::Script g_mamaActions[];

View File

@ -16,6 +16,11 @@ class MxDSAction;
// SIZE 0x10
class PoliceState : public LegoState {
public:
enum {
e_noAnimation = 0,
e_playingAnimation = 1,
};
PoliceState();
~PoliceState() override {}
@ -38,15 +43,15 @@ class PoliceState : public LegoState {
// SYNTHETIC: LEGO1 0x1005e920
// PoliceState::`scalar deleting destructor'
undefined4 GetUnknown0x0c() { return m_unk0x0c; }
void SetUnknown0x0c(undefined4 p_unk0x0c) { m_unk0x0c = p_unk0x0c; }
MxS32 GetState() { return m_state; }
void SetState(MxS32 p_state) { m_state = p_state; }
void FUN_1005ea40();
void StartAnimation();
// TODO: Most likely getters/setters are not used according to BETA.
PoliceScript::Script m_policeScript; // 0x08
undefined4 m_unk0x0c; // 0x0c
MxS32 m_state; // 0x0c
};
// VTABLE: LEGO1 0x100d8a80

View File

@ -39,14 +39,14 @@ class RadioState : public LegoState {
void SetActive(MxBool p_active) { m_active = p_active; }
undefined4 FUN_1002d090();
MxBool FUN_1002d0c0(const MxAtomId& p_atom, MxU32 p_objectId);
MxU32 NextPlaylistObjectId();
MxBool IsRadioObjectId(const MxAtomId& p_atom, MxU32 p_objectId);
// TODO: Most likely getters/setters are not used according to BETA.
Playlist m_unk0x08[3]; // 0x08
MxS16 m_unk0x2c; // 0x2c
MxBool m_active; // 0x2e
Playlist m_playlists[3]; // 0x08
MxS16 m_activePlaylist; // 0x2c
MxBool m_active; // 0x2e
};
// VTABLE: LEGO1 0x100d6d10
@ -85,7 +85,7 @@ class Radio : public MxCore {
private:
RadioState* m_state; // 0x08
MxBool m_unk0x0c; // 0x0c
MxBool m_enabled; // 0x0c
MxBool m_audioEnabled; // 0x0d
MxLong HandleEndAction(MxEndActionNotificationParam& p_param);

View File

@ -133,7 +133,6 @@ Act2Actor::Act2Actor()
}
// FUNCTION: LEGO1 0x10018940
// FUNCTION: BETA10 0x1003d65f
void Act2Actor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
{
LegoAnimActor::SetROI(p_roi, p_bool1, p_bool2);
@ -417,7 +416,7 @@ void Act2Actor::FUN_100192a0(undefined4 p_location)
newPosition,
newDirection,
newBoundary,
LegoUnknown100db7f4::c_bit1,
LegoOrientedEdge::c_bit1,
NULL
);
@ -611,8 +610,8 @@ MxU32 Act2Actor::FUN_10019700(MxFloat p_param)
MxMatrix matrix = m_roi->GetLocal2World();
matrix[3][1] += 1.0f;
brickstrROI->FUN_100a58f0(matrix);
brickstrROI->VTable0x14();
brickstrROI->SetLocal2World(matrix);
brickstrROI->WrappedUpdateWorldData();
Vector3 col0(matrix[0]);
Vector3 col1(matrix[1]);
@ -719,17 +718,17 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
switch (m_unk0x1d) {
case 0:
if (buildingInfo[12].m_unk0x11) {
if (buildingInfo[12].m_counter) {
result = buildingInfo[12].m_entity;
*p_param = TRUE;
}
else if (buildingInfo[14].m_unk0x11) {
else if (buildingInfo[14].m_counter) {
result = buildingInfo[14].m_entity;
*p_param = TRUE;
}
else {
for (i = 0; g_unk0x100f0f30[i] != -1; i++) {
if (plantInfo[g_unk0x100f0f30[i]].m_unk0x16) {
if (plantInfo[g_unk0x100f0f30[i]].m_counter) {
result = plantInfo[g_unk0x100f0f30[i]].m_entity;
break;
}
@ -737,13 +736,13 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
}
break;
case 1:
if (buildingInfo[13].m_unk0x11) {
if (buildingInfo[13].m_counter) {
result = buildingInfo[13].m_entity;
*p_param = TRUE;
}
else {
for (i = 0; g_unk0x100f0f50[i] != -1; i++) {
if (plantInfo[g_unk0x100f0f50[i]].m_unk0x16) {
if (plantInfo[g_unk0x100f0f50[i]].m_counter) {
result = plantInfo[g_unk0x100f0f50[i]].m_entity;
break;
}
@ -751,17 +750,17 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
}
break;
case 2:
if (buildingInfo[9].m_unk0x11) {
if (buildingInfo[9].m_counter) {
result = buildingInfo[9].m_entity;
*p_param = TRUE;
}
else if (buildingInfo[11].m_unk0x11) {
else if (buildingInfo[11].m_counter) {
result = buildingInfo[11].m_entity;
*p_param = TRUE;
}
else {
for (i = 0; g_unk0x100f0f90[i] != -1; i++) {
if (plantInfo[g_unk0x100f0f90[i]].m_unk0x16) {
if (plantInfo[g_unk0x100f0f90[i]].m_counter) {
result = plantInfo[g_unk0x100f0f90[i]].m_entity;
break;
}
@ -769,21 +768,21 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
}
break;
case 3:
if (buildingInfo[7].m_unk0x11) {
if (buildingInfo[7].m_counter) {
result = buildingInfo[7].m_entity;
*p_param = TRUE;
}
else if (buildingInfo[8].m_unk0x11) {
else if (buildingInfo[8].m_counter) {
result = buildingInfo[8].m_entity;
*p_param = TRUE;
}
else if (buildingInfo[3].m_unk0x11) {
else if (buildingInfo[3].m_counter) {
result = buildingInfo[3].m_entity;
*p_param = TRUE;
}
else {
for (i = 0; g_unk0x100f0fa8[i] != -1; i++) {
if (plantInfo[g_unk0x100f0fa8[i]].m_unk0x16) {
if (plantInfo[g_unk0x100f0fa8[i]].m_counter) {
result = plantInfo[g_unk0x100f0fa8[i]].m_entity;
break;
}
@ -791,17 +790,17 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
}
break;
case 4:
if (buildingInfo[5].m_unk0x11) {
if (buildingInfo[5].m_counter) {
result = buildingInfo[5].m_entity;
*p_param = TRUE;
}
else if (buildingInfo[10].m_unk0x11) {
else if (buildingInfo[10].m_counter) {
result = buildingInfo[10].m_entity;
*p_param = TRUE;
}
else {
for (i = 0; g_unk0x100f0fb8[i] != -1; i++) {
if (plantInfo[g_unk0x100f0fb8[i]].m_unk0x16) {
if (plantInfo[g_unk0x100f0fb8[i]].m_counter) {
result = plantInfo[g_unk0x100f0fb8[i]].m_entity;
break;
}
@ -809,13 +808,13 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
}
break;
case 5:
if (buildingInfo[4].m_unk0x11) {
if (buildingInfo[4].m_counter) {
result = buildingInfo[4].m_entity;
*p_param = TRUE;
}
else {
for (i = 0; g_unk0x100f0fe8[i] != -1; i++) {
if (plantInfo[g_unk0x100f0fe8[i]].m_unk0x16) {
if (plantInfo[g_unk0x100f0fe8[i]].m_counter) {
result = plantInfo[g_unk0x100f0fe8[i]].m_entity;
break;
}
@ -823,13 +822,13 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
}
break;
case 6:
if (buildingInfo[2].m_unk0x11) {
if (buildingInfo[2].m_counter) {
result = buildingInfo[2].m_entity;
*p_param = TRUE;
}
else {
for (i = 0; g_unk0x100f1000[i] != -1; i++) {
if (plantInfo[g_unk0x100f1000[i]].m_unk0x16) {
if (plantInfo[g_unk0x100f1000[i]].m_counter) {
result = plantInfo[g_unk0x100f1000[i]].m_entity;
break;
}
@ -837,13 +836,13 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
}
break;
case 7:
if (buildingInfo[6].m_unk0x11) {
if (buildingInfo[6].m_counter) {
result = buildingInfo[6].m_entity;
*p_param = TRUE;
}
else {
for (i = 0; g_unk0x100f1018[i] != -1; i++) {
if (plantInfo[g_unk0x100f1018[i]].m_unk0x16) {
if (plantInfo[g_unk0x100f1018[i]].m_counter) {
result = plantInfo[g_unk0x100f1018[i]].m_entity;
break;
}
@ -852,7 +851,7 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
break;
case 8:
for (i = 0; g_unk0x100f1030[i] != -1; i++) {
if (plantInfo[g_unk0x100f1030[i]].m_unk0x16) {
if (plantInfo[g_unk0x100f1030[i]].m_counter) {
result = plantInfo[g_unk0x100f1030[i]].m_entity;
break;
}
@ -862,7 +861,7 @@ LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
return result;
}
if (buildingInfo[15].m_unk0x11) {
if (buildingInfo[15].m_counter) {
result = buildingInfo[15].m_entity;
*p_param = TRUE;
}

View File

@ -138,8 +138,8 @@ MxU32 Act3Actor::VTable0x90(float p_time, Matrix4& p_transform)
m_unk0x1c = 0;
positionRef -= g_unk0x10104ef0;
m_roi->FUN_100a58f0(p_transform);
m_roi->VTable0x14();
m_roi->SetLocal2World(p_transform);
m_roi->WrappedUpdateWorldData();
return TRUE;
}
}
@ -163,8 +163,8 @@ MxResult Act3Actor::HitActor(LegoPathActor* p_actor, MxBool p_bool)
Vector3(local2world[3]) += g_unk0x10104ef0;
roi->FUN_100a58f0(local2world);
roi->VTable0x14();
roi->SetLocal2World(local2world);
roi->WrappedUpdateWorldData();
p_actor->SetActorState(c_two | c_noCollide);
}
@ -244,7 +244,7 @@ void Act3Cop::ParseAction(char* p_extra)
}
}
Mx4DPointFloat* boundary0x14 = boundary->GetUnknown0x14();
Mx4DPointFloat* boundary0x14 = boundary->GetUp();
if (point.Dot(point, *boundary0x14) + boundary0x14->index_operator(3) <= 0.001 &&
point.Dot(point, *boundary0x14) + boundary0x14->index_operator(3) >= -0.001) {
@ -353,7 +353,7 @@ MxResult Act3Cop::FUN_10040360()
local7c,
local5c,
boundary,
LegoUnknown100db7f4::c_bit1,
LegoOrientedEdge::c_bit1,
&local34
) != SUCCESS) {
delete grec;
@ -391,7 +391,7 @@ MxResult Act3Cop::FUN_10040360()
local88,
localec,
donut->GetBoundary(),
LegoUnknown100db7f4::c_bit1,
LegoOrientedEdge::c_bit1,
&locald8
) == SUCCESS &&
(grec == NULL || locald8 < local18)) {
@ -431,7 +431,7 @@ MxResult Act3Cop::FUN_10040360()
localf8,
local108,
boundary,
LegoUnknown100db7f4::c_bit1,
LegoOrientedEdge::c_bit1,
&local100
) != SUCCESS) {
local14c = local150 = grec;
@ -579,7 +579,7 @@ void Act3Brickster::Animate(float p_time)
}
if (m_unk0x54 < p_time) {
((Act3*) m_world)->FUN_10072ad0(5);
((Act3*) m_world)->TriggerHitSound(5);
m_unk0x54 = p_time + 15000.0f;
}
@ -595,7 +595,7 @@ void Act3Brickster::Animate(float p_time)
assert(SoundManager()->GetCacheSoundManager());
if (m_unk0x58 >= 8) {
((Act3*) m_world)->FUN_10072ad0(6);
((Act3*) m_world)->TriggerHitSound(6);
}
else {
SoundManager()->GetCacheSoundManager()->Play("eatpz", NULL, FALSE);
@ -607,8 +607,8 @@ void Act3Brickster::Animate(float p_time)
assert(m_shootAnim && m_pInfo);
if (m_unk0x50 < p_time) {
while (m_pInfo->m_unk0x16) {
PlantManager()->FUN_10026c50(m_pInfo->m_entity);
while (m_pInfo->m_counter) {
PlantManager()->DecrementCounter(m_pInfo->m_entity);
}
assert(SoundManager()->GetCacheSoundManager());
@ -653,8 +653,8 @@ void Act3Brickster::Animate(float p_time)
assert(SoundManager()->GetCacheSoundManager());
SoundManager()->GetCacheSoundManager()->Play("thpt", NULL, FALSE);
while (m_bInfo->m_unk0x11 > 0 || m_bInfo->m_unk0x11 == -1) {
if (!BuildingManager()->FUN_10030110(m_bInfo)) {
while (m_bInfo->m_counter > 0 || m_bInfo->m_counter == -1) {
if (!BuildingManager()->DecrementCounter(m_bInfo)) {
break;
}
}
@ -831,7 +831,7 @@ MxResult Act3Brickster::FUN_100417c0()
local88,
localec,
pizza->GetBoundary(),
LegoUnknown100db7f4::c_bit1,
LegoOrientedEdge::c_bit1,
&locald8
) == SUCCESS &&
(grec == NULL || locald8 < local18)) {
@ -865,7 +865,7 @@ MxResult Act3Brickster::FUN_100417c0()
float local124;
for (MxS32 i = 0; i < length; i++) {
if (bInfo[i].m_unk0x11 < 0 && bInfo[i].m_boundary != NULL && bInfo[i].m_entity != NULL && i != 0 &&
if (bInfo[i].m_counter < 0 && bInfo[i].m_boundary != NULL && bInfo[i].m_entity != NULL && i != 0 &&
(local120 == -1 || i != 15)) {
Mx3DPointFloat local188(bInfo[i].m_x, bInfo[i].m_y, bInfo[i].m_z);
@ -915,7 +915,7 @@ MxResult Act3Brickster::FUN_100417c0()
local108,
local138,
localf4,
LegoUnknown100db7f4::c_bit1,
LegoOrientedEdge::c_bit1,
&local13c
) != SUCCESS) {
local1bc = local1c0 = grec;
@ -1055,7 +1055,7 @@ MxS32 Act3Brickster::FUN_10042300()
assert(m_boundary && m_destEdge && m_roi);
LegoPathBoundary* boundaries[2];
LegoUnknown100db7f4* maxE = NULL;
LegoOrientedEdge* maxE = NULL;
boundaries[0] = m_boundary;
if (m_destEdge->FUN_10048c40(local38)) {
@ -1069,7 +1069,7 @@ MxS32 Act3Brickster::FUN_10042300()
for (MxS32 i = 0; i < (MxS32) sizeOfArray(boundaries); i++) {
if (boundaries[i] != NULL) {
for (MxS32 j = 0; j < boundaries[i]->GetNumEdges(); j++) {
LegoUnknown100db7f4* e = boundaries[i]->GetEdges()[j];
LegoOrientedEdge* e = boundaries[i]->GetEdges()[j];
if (e->GetMask0x03()) {
Mx3DPointFloat local94(*e->GetPointA());
@ -1109,7 +1109,7 @@ MxS32 Act3Brickster::FUN_10042300()
// FUNCTION: LEGO1 0x10042990
// FUNCTION: BETA10 0x1001b6e2
void Act3Brickster::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4)
void Act3Brickster::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoOrientedEdge*& p_edge, float& p_unk0xe4)
{
if (m_unk0x38 != 8) {
m_boundary->SwitchBoundary(this, p_boundary, p_edge, p_unk0xe4);

View File

@ -70,7 +70,9 @@ MxResult Act3Ammo::Remove()
// FUNCTION: BETA10 0x1001d8b3
MxResult Act3Ammo::Create(Act3* p_world, MxU32 p_isPizza, MxS32 p_index)
{
#ifdef BETA10
assert(m_ammoFlag);
#endif
char name[12];
if (p_isPizza) {
@ -271,8 +273,8 @@ void Act3Ammo::Animate(float p_time)
positionRef.Clear();
transform.RotateX(0.6);
positionRef = position;
m_roi->FUN_100a58f0(transform);
m_roi->VTable0x14();
m_roi->SetLocal2World(transform);
m_roi->WrappedUpdateWorldData();
return;
}
else {
@ -280,8 +282,8 @@ void Act3Ammo::Animate(float p_time)
m_unk0x158 = 0;
positionRef -= g_unk0x10104f08;
m_roi->FUN_100a58f0(transform);
m_roi->VTable0x14();
m_roi->SetLocal2World(transform);
m_roi->WrappedUpdateWorldData();
return;
}
}
@ -337,7 +339,7 @@ void Act3Ammo::Animate(float p_time)
Vector3 local174(local104[2]);
if (IsPizza()) {
local184 = *m_boundary->GetUnknown0x14();
local184 = *m_boundary->GetUp();
local17c[0] = 1.0f;
local17c[1] = local17c[2] = 0.0f;
local174.EqualsCross(local17c, local184);
@ -345,7 +347,7 @@ void Act3Ammo::Animate(float p_time)
local17c.EqualsCross(local184, local174);
}
else {
local17c = *m_boundary->GetUnknown0x14();
local17c = *m_boundary->GetUp();
local184[0] = 1.0f;
local184[1] = local184[2] = 0.0f;
local174.EqualsCross(local17c, local184);
@ -363,8 +365,8 @@ void Act3Ammo::Animate(float p_time)
MxMatrix localb0(local104);
local104.Product(local60, localb0);
m_roi->FUN_100a58f0(local104);
m_roi->VTable0x14();
m_roi->SetLocal2World(local104);
m_roi->WrappedUpdateWorldData();
if (m_BADuration <= m_unk0x7c) {
m_worldSpeed = 0.0f;
@ -376,11 +378,11 @@ void Act3Ammo::Animate(float p_time)
if (IsBit4()) {
if (IsPizza()) {
m_world->RemovePizza(*this);
m_world->FUN_10072ad0(2);
m_world->TriggerHitSound(2);
}
else {
m_world->RemoveDonut(*this);
m_world->FUN_10072ad0(4);
m_world->TriggerHitSound(4);
}
}
else {

View File

@ -37,9 +37,9 @@ Ambulance::Ambulance()
m_state = NULL;
m_unk0x168 = 0;
m_actorId = -1;
m_unk0x16c = 0;
m_unk0x16e = 0;
m_unk0x170 = 0;
m_atPoliceTask = 0;
m_atBeachTask = 0;
m_taskState = Ambulance::e_none;
m_lastAction = IsleScript::c_noneIsle;
m_unk0x172 = 0;
m_lastAnimation = IsleScript::c_noneIsle;
@ -70,7 +70,7 @@ MxResult Ambulance::Create(MxDSAction& p_dsAction)
m_state = (AmbulanceMissionState*) GameState()->GetState("AmbulanceMissionState");
if (!m_state) {
m_state = new AmbulanceMissionState();
m_state->m_unk0x08 = 0;
m_state->m_state = AmbulanceMissionState::e_ready;
GameState()->RegisterState(m_state);
}
}
@ -170,25 +170,25 @@ MxLong Ambulance::HandleEndAction(MxEndActionNotificationParam& p_param)
m_lastAction = IsleScript::c_noneIsle;
}
else if (objectId == IsleScript::c_hho027en_RunAnim) {
m_state->m_unk0x08 = 1;
m_state->m_state = AmbulanceMissionState::e_enteredAmbulance;
CurrentWorld()->PlaceActor(UserActor());
HandleClick();
m_unk0x172 = 0;
TickleManager()->RegisterClient(this, 40000);
}
else if (objectId == IsleScript::c_hpz047pe_RunAnim || objectId == IsleScript::c_hpz048pe_RunAnim || objectId == IsleScript::c_hpz049bd_RunAnim || objectId == IsleScript::c_hpz053pa_RunAnim) {
if (m_unk0x170 == 3) {
if (m_taskState == Ambulance::e_finished) {
PlayAnimation(IsleScript::c_hpz055pa_RunAnim);
m_unk0x170 = 0;
m_taskState = Ambulance::e_none;
}
else {
PlayAnimation(IsleScript::c_hpz053pa_RunAnim);
}
}
else if (objectId == IsleScript::c_hpz050bd_RunAnim || objectId == IsleScript::c_hpz052ma_RunAnim) {
if (m_unk0x170 == 3) {
if (m_taskState == Ambulance::e_finished) {
PlayAnimation(IsleScript::c_hpz057ma_RunAnim);
m_unk0x170 = 0;
m_taskState = Ambulance::e_none;
}
else {
PlayAnimation(IsleScript::c_hpz052ma_RunAnim);
@ -201,18 +201,18 @@ MxLong Ambulance::HandleEndAction(MxEndActionNotificationParam& p_param)
m_unk0x172 = 0;
TickleManager()->RegisterClient(this, 40000);
if (m_unk0x16c != 0) {
if (m_atPoliceTask != 0) {
StopActions();
}
}
else if (objectId == IsleScript::c_hps116bd_RunAnim || objectId == IsleScript::c_hps118re_RunAnim) {
if (objectId == IsleScript::c_hps116bd_RunAnim && m_unk0x170 != 3) {
if (objectId == IsleScript::c_hps116bd_RunAnim && m_taskState != Ambulance::e_finished) {
PlayAction(IsleScript::c_Avo923In_PlayWav);
}
if (m_unk0x170 == 3) {
if (m_taskState == Ambulance::e_finished) {
PlayAnimation(IsleScript::c_hps117bd_RunAnim);
m_unk0x170 = 0;
m_taskState = Ambulance::e_none;
}
else {
PlayAnimation(IsleScript::c_hps118re_RunAnim);
@ -221,16 +221,16 @@ MxLong Ambulance::HandleEndAction(MxEndActionNotificationParam& p_param)
else if (objectId == IsleScript::c_hps117bd_RunAnim) {
CurrentWorld()->PlaceActor(UserActor());
HandleClick();
SpawnPlayer(LegoGameState::e_unk33, TRUE, 0);
SpawnPlayer(LegoGameState::e_policeExited, TRUE, 0);
m_unk0x172 = 0;
TickleManager()->RegisterClient(this, 40000);
if (m_unk0x16e != 0) {
if (m_atBeachTask != 0) {
StopActions();
}
}
else if (objectId == IsleScript::c_hho142cl_RunAnim || objectId == IsleScript::c_hho143cl_RunAnim || objectId == IsleScript::c_hho144cl_RunAnim) {
FUN_10037250();
Reset();
}
}
@ -241,18 +241,18 @@ MxLong Ambulance::HandleEndAction(MxEndActionNotificationParam& p_param)
// FUNCTION: BETA10 0x100230bf
MxLong Ambulance::HandleButtonDown(LegoControlManagerNotificationParam& p_param)
{
if (m_unk0x170 == 1) {
if (m_taskState == Ambulance::e_waiting) {
LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY());
if (roi != NULL && !strcmpi(roi->GetName(), "ps-gate")) {
m_unk0x170 = 3;
m_taskState = Ambulance::e_finished;
return 1;
}
roi = PickRootROI(p_param.GetX(), p_param.GetY());
if (roi != NULL && !strcmpi(roi->GetName(), "gd")) {
m_unk0x170 = 3;
m_taskState = Ambulance::e_finished;
return 1;
}
}
@ -270,9 +270,9 @@ MxLong Ambulance::HandlePathStruct(LegoPathStructNotificationParam& p_param)
}
if (p_param.GetTrigger() == LegoPathStruct::c_camAnim && p_param.GetData() == 0x0b) {
if (m_unk0x16e != 0) {
if (m_unk0x16c != 0) {
m_state->m_unk0x08 = 2;
if (m_atBeachTask != 0) {
if (m_atPoliceTask != 0) {
m_state->m_state = AmbulanceMissionState::e_prepareAmbulance;
if (m_lastAction != IsleScript::c_noneIsle) {
InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL);
@ -297,7 +297,7 @@ MxLong Ambulance::HandlePathStruct(LegoPathStructNotificationParam& p_param)
return 0;
}
if (m_unk0x16e != 0) {
if (m_atBeachTask != 0) {
if (m_lastAction != IsleScript::c_noneIsle) {
InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL);
}
@ -307,7 +307,7 @@ MxLong Ambulance::HandlePathStruct(LegoPathStructNotificationParam& p_param)
}
}
if (m_unk0x16c != 0) {
if (m_atPoliceTask != 0) {
if (m_lastAction != IsleScript::c_noneIsle) {
InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL);
}
@ -315,9 +315,9 @@ MxLong Ambulance::HandlePathStruct(LegoPathStructNotificationParam& p_param)
PlayAction(IsleScript::c_Avo915In_PlayWav);
}
}
else if (p_param.GetTrigger() == LegoPathStruct::c_s && p_param.GetData() == 0x131 && m_unk0x16e == 0) {
m_unk0x16e = 1;
m_unk0x170 = 1;
else if (p_param.GetTrigger() == LegoPathStruct::c_s && p_param.GetData() == 0x131 && m_atBeachTask == 0) {
m_atBeachTask = 1;
m_taskState = Ambulance::e_waiting;
if (m_lastAction != IsleScript::c_noneIsle) {
InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL);
@ -345,9 +345,9 @@ MxLong Ambulance::HandlePathStruct(LegoPathStructNotificationParam& p_param)
break;
}
}
else if (p_param.GetTrigger() == LegoPathStruct::c_camAnim && (p_param.GetData() == 0x22 || p_param.GetData() == 0x23 || p_param.GetData() == 0x24) && m_unk0x16c == 0) {
m_unk0x16c = 1;
m_unk0x170 = 1;
else if (p_param.GetTrigger() == LegoPathStruct::c_camAnim && (p_param.GetData() == 0x22 || p_param.GetData() == 0x23 || p_param.GetData() == 0x24) && m_atPoliceTask == 0) {
m_atPoliceTask = 1;
m_taskState = Ambulance::e_waiting;
if (m_lastAction != IsleScript::c_noneIsle) {
InvokeAction(Extra::e_stop, *g_isleScript, m_lastAction, NULL);
@ -368,7 +368,7 @@ MxLong Ambulance::HandleClick()
return 1;
}
if (m_state->m_unk0x08 == 2) {
if (m_state->m_state == AmbulanceMissionState::e_prepareAmbulance) {
return 1;
}
@ -387,8 +387,8 @@ MxLong Ambulance::HandleClick()
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_AmbulanceDashboard, NULL);
ControlManager()->Register(this);
if (m_state->m_unk0x08 == 1) {
SpawnPlayer(LegoGameState::e_unk31, TRUE, 0);
if (m_state->m_state == AmbulanceMissionState::e_enteredAmbulance) {
SpawnPlayer(LegoGameState::e_hospitalExited, TRUE, 0);
m_state->m_startTime = Timer()->GetTime();
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_pns018rd_RunAnim, NULL);
}
@ -398,9 +398,9 @@ MxLong Ambulance::HandleClick()
// FUNCTION: LEGO1 0x10036e60
// FUNCTION: BETA10 0x100236bb
void Ambulance::FUN_10036e60()
void Ambulance::Init()
{
m_state->m_unk0x08 = 2;
m_state->m_state = AmbulanceMissionState::e_prepareAmbulance;
PlayAnimation(IsleScript::c_hho027en_RunAnim);
m_lastAction = IsleScript::c_noneIsle;
m_lastAnimation = IsleScript::c_noneIsle;
@ -411,7 +411,7 @@ void Ambulance::Exit()
{
GameState()->m_currentArea = LegoGameState::e_hospitalExterior;
StopActions();
FUN_10037250();
Reset();
Leave();
}
@ -441,14 +441,14 @@ MxLong Ambulance::HandleControl(LegoControlManagerNotificationParam& p_param)
switch (p_param.m_clickedObjectId) {
case IsleScript::c_AmbulanceArms_Ctl:
Exit();
GameState()->m_currentArea = LegoGameState::e_unk66;
GameState()->m_currentArea = LegoGameState::e_vehicleExited;
result = 1;
break;
case IsleScript::c_AmbulanceInfo_Ctl:
((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_infomain);
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
Exit();
GameState()->m_currentArea = LegoGameState::e_unk66;
GameState()->m_currentArea = LegoGameState::e_vehicleExited;
result = 1;
break;
case IsleScript::c_AmbulanceHorn_Ctl:
@ -467,11 +467,11 @@ void Ambulance::ActivateSceneActions()
{
PlayMusic(JukeboxScript::c_Hospital_Music);
if (m_state->m_unk0x08 == 1) {
m_state->m_unk0x08 = 0;
if (m_state->m_state == AmbulanceMissionState::e_enteredAmbulance) {
m_state->m_state = AmbulanceMissionState::e_ready;
PlayAction(IsleScript::c_ham033cl_PlayWav);
}
else if (m_unk0x16c != 0 && m_unk0x16e != 0) {
else if (m_atPoliceTask != 0 && m_atBeachTask != 0) {
IsleScript::Script objectId;
switch (rand() % 2) {
@ -571,14 +571,14 @@ void Ambulance::StopActions()
}
// FUNCTION: LEGO1 0x10037250
void Ambulance::FUN_10037250()
void Ambulance::Reset()
{
StopAction(m_lastAction);
BackgroundAudioManager()->RaiseVolume();
((Act1State*) GameState()->GetState("Act1State"))->m_unk0x018 = 0;
m_state->m_unk0x08 = 0;
m_unk0x16e = 0;
m_unk0x16c = 0;
m_state->m_state = AmbulanceMissionState::e_ready;
m_atBeachTask = 0;
m_atPoliceTask = 0;
g_isleFlags |= Isle::c_playMusic;
AnimationManager()->EnableCamAnims(TRUE);
AnimationManager()->FUN_1005f6d0(TRUE);
@ -626,7 +626,7 @@ void Ambulance::PlayAction(IsleScript::Script p_objectId)
// FUNCTION: LEGO1 0x100373a0
AmbulanceMissionState::AmbulanceMissionState()
{
m_unk0x08 = 0;
m_state = AmbulanceMissionState::e_ready;
m_startTime = 0;
m_peScore = 0;
m_maScore = 0;

View File

@ -52,7 +52,7 @@ void Bike::Exit()
// FUNCTION: LEGO1 0x100769a0
MxLong Bike::HandleClick()
{
if (FUN_1003ef60()) {
if (CanExit()) {
Act1State* state = (Act1State*) GameState()->GetState("Act1State");
FUN_10015820(TRUE, 0);
@ -85,7 +85,7 @@ MxLong Bike::HandleControl(LegoControlManagerNotificationParam& p_param)
switch (p_param.m_clickedObjectId) {
case IsleScript::c_BikeArms_Ctl:
Exit();
GameState()->m_currentArea = LegoGameState::e_unk66;
GameState()->m_currentArea = LegoGameState::e_vehicleExited;
result = 1;
break;
case IsleScript::c_BikeInfo_Ctl:

View File

@ -80,7 +80,7 @@ MxLong InfoCenterEntity::HandleClick(LegoEventNotificationParam& p_param)
// FUNCTION: LEGO1 0x100151d0
MxLong GasStationEntity::HandleClick(LegoEventNotificationParam& p_param)
{
if (FUN_1003ef60()) {
if (CanExit()) {
Act1State* state = (Act1State*) GameState()->GetState("Act1State");
if (state->GetUnknown18() != 8) {
@ -104,7 +104,7 @@ MxLong GasStationEntity::HandleClick(LegoEventNotificationParam& p_param)
// FUNCTION: LEGO1 0x10015270
MxLong HospitalEntity::HandleClick(LegoEventNotificationParam& p_param)
{
if (FUN_1003ef60()) {
if (CanExit()) {
Act1State* act1State = (Act1State*) GameState()->GetState("Act1State");
if (act1State->GetUnknown18() != 10) {
@ -128,7 +128,7 @@ MxLong HospitalEntity::HandleClick(LegoEventNotificationParam& p_param)
// FUNCTION: LEGO1 0x10015310
MxLong PoliceEntity::HandleClick(LegoEventNotificationParam& p_param)
{
if (FUN_1003ef60()) {
if (CanExit()) {
Act1State* state = (Act1State*) GameState()->GetState("Act1State");
if (state->GetUnknown18() != 10) {
@ -152,7 +152,7 @@ MxLong PoliceEntity::HandleClick(LegoEventNotificationParam& p_param)
// FUNCTION: LEGO1 0x100153b0
MxLong BeachHouseEntity::HandleClick(LegoEventNotificationParam& p_param)
{
if (FUN_1003ef60()) {
if (CanExit()) {
Act1State* state = (Act1State*) GameState()->GetState("Act1State");
state->SetUnknown18(0);
@ -173,7 +173,7 @@ MxLong BeachHouseEntity::HandleClick(LegoEventNotificationParam& p_param)
// FUNCTION: LEGO1 0x10015450
MxLong RaceStandsEntity::HandleClick(LegoEventNotificationParam& p_param)
{
if (FUN_1003ef60()) {
if (CanExit()) {
Act1State* state = (Act1State*) GameState()->GetState("Act1State");
state->SetUnknown18(0);
@ -195,7 +195,7 @@ MxLong RaceStandsEntity::HandleClick(LegoEventNotificationParam& p_param)
// FUNCTION: BETA10 0x100256e8
MxLong JailEntity::HandleClick(LegoEventNotificationParam& p_param)
{
if (FUN_1003ef60()) {
if (CanExit()) {
PlayCamAnim(UserActor(), FALSE, 18, TRUE);
}

View File

@ -89,24 +89,24 @@ void Doors::Animate(float p_time)
local10.Clear();
local58.RotateY(-local8);
local10 = m_ltDoorLocal[3];
m_ltDoor->FUN_100a58f0(local58);
m_ltDoor->VTable0x14();
m_ltDoor->SetLocal2World(local58);
m_ltDoor->WrappedUpdateWorldData();
local58 = m_rtDoorLocal;
local10.Clear();
local58.RotateY(local8);
local10 = m_rtDoorLocal[3];
m_rtDoor->FUN_100a58f0(local58);
m_rtDoor->VTable0x14();
m_rtDoor->SetLocal2World(local58);
m_rtDoor->WrappedUpdateWorldData();
m_unk0x1f4 = local8;
}
if (m_unk0x158 + g_unk0x100d8e84 < p_time) {
m_ltDoor->FUN_100a58f0(m_ltDoorLocal);
m_rtDoor->FUN_100a58f0(m_rtDoorLocal);
m_ltDoor->VTable0x14();
m_rtDoor->VTable0x14();
m_ltDoor->SetLocal2World(m_ltDoorLocal);
m_rtDoor->SetLocal2World(m_rtDoorLocal);
m_ltDoor->WrappedUpdateWorldData();
m_rtDoor->WrappedUpdateWorldData();
m_unk0x154 = 1;
m_actorState = c_initial;
m_unk0x1f4 = 0;

View File

@ -88,7 +88,7 @@ void DuneBuggy::Exit()
// FUNCTION: LEGO1 0x10068060
MxLong DuneBuggy::HandleClick()
{
if (!FUN_1003ef60()) {
if (!CanExit()) {
return 1;
}
@ -125,7 +125,7 @@ MxLong DuneBuggy::HandleControl(LegoControlManagerNotificationParam& p_param)
switch (p_param.m_clickedObjectId) {
case IsleScript::c_DuneCarArms_Ctl:
Exit();
GameState()->m_currentArea = LegoGameState::e_unk66;
GameState()->m_currentArea = LegoGameState::e_vehicleExited;
result = 1;
break;
case IsleScript::c_DuneCarInfo_Ctl:

View File

@ -121,7 +121,7 @@ void Helicopter::Exit()
// FUNCTION: BETA10 0x1002a3db
MxLong Helicopter::HandleClick()
{
if (!FUN_1003ef60()) {
if (!CanExit()) {
return 1;
}
@ -203,7 +203,7 @@ MxLong Helicopter::HandleControl(LegoControlManagerNotificationParam& p_param)
}
Exit();
GameState()->m_currentArea = LegoGameState::e_unk66;
GameState()->m_currentArea = LegoGameState::e_vehicleExited;
result = 1;
break;
case IsleScript::c_Helicopter_TakeOff_Ctl: {
@ -391,8 +391,8 @@ void Helicopter::VTable0x74(Matrix4& p_transform)
FUN_10010c30();
}
else {
m_roi->FUN_100a58f0(p_transform);
m_roi->VTable0x14();
m_roi->SetLocal2World(p_transform);
m_roi->WrappedUpdateWorldData();
if (m_cameraFlag) {
FUN_10010c30();
}
@ -455,7 +455,9 @@ void Helicopter::FUN_100042a0(const Matrix4& p_matrix)
Vector3 vec3(m_unk0x1a8[0]); // locala8 // esp+0x20
Vector3 vec4(m_unk0x1a8[1]); // localb8 // esp+0x10
Vector3 vec5(m_unk0x1a8[2]); // EDI
Vector3 vec6(m_unk0x1a8[3]); // locala0 // esp+0x28
// the typecast makes this function match for unknown reasons
Vector3 vec6((const float*) m_unk0x1a8[3]); // locala0 // esp+0x28
m_world->GetCameraController()->FUN_100123b0(local48);
m_unk0x1a8.SetIdentity();

View File

@ -119,11 +119,11 @@ void IslePathActor::Exit()
MxS32 i;
for (i = 0; i < m_boundary->GetNumEdges(); i++) {
LegoUnknown100db7f4* e = (LegoUnknown100db7f4*) m_boundary->GetEdges()[i];
LegoOrientedEdge* e = (LegoOrientedEdge*) m_boundary->GetEdges()[i];
assert(e);
Mx3DPointFloat local20;
e->FUN_1002ddc0(*m_boundary, local20);
e->GetFaceNormal(*m_boundary, local20);
local20 *= m_roi->GetWorldBoundingSphere().Radius();
local20 += GetWorldPosition();
@ -148,12 +148,12 @@ void IslePathActor::Exit()
}
m_previousActor->SetActorState(c_initial);
GameState()->m_currentArea = LegoGameState::Area::e_unk66;
GameState()->m_currentArea = LegoGameState::Area::e_vehicleExited;
}
FUN_1001b660();
FUN_10010c30();
FUN_1003eda0();
ResetViewVelocity();
}
// GLOBAL: LEGO1 0x10102b28
@ -199,7 +199,7 @@ void IslePathActor::RegisterSpawnLocations()
JukeboxScript::c_Quiet_Audio
);
g_spawnLocations[3] = SpawnLocation(
LegoGameState::e_unk4,
LegoGameState::e_infocenterExited,
g_isleScript,
0,
"int46",
@ -223,7 +223,7 @@ void IslePathActor::RegisterSpawnLocations()
JukeboxScript::c_Beach_Music
);
g_spawnLocations[5] = SpawnLocation(
LegoGameState::e_unk17,
LegoGameState::e_jetskibuildExited,
g_isleScript,
0,
"EDG00_46",
@ -259,7 +259,7 @@ void IslePathActor::RegisterSpawnLocations()
JukeboxScript::c_CentralNorthRoad_Music
);
g_spawnLocations[8] = SpawnLocation(
LegoGameState::e_unk20,
LegoGameState::e_racecarbuildExited,
g_isleScript,
0,
"INT16",
@ -295,7 +295,7 @@ void IslePathActor::RegisterSpawnLocations()
JukeboxScript::c_GarageArea_Music
);
g_spawnLocations[11] = SpawnLocation(
LegoGameState::e_unk28,
LegoGameState::e_garageExited,
g_isleScript,
0,
"INT24",
@ -319,7 +319,7 @@ void IslePathActor::RegisterSpawnLocations()
JukeboxScript::c_Hospital_Music
);
g_spawnLocations[13] = SpawnLocation(
LegoGameState::e_unk31,
LegoGameState::e_hospitalExited,
g_isleScript,
0,
"EDG02_28",
@ -343,7 +343,7 @@ void IslePathActor::RegisterSpawnLocations()
JukeboxScript::c_PoliceStation_Music
);
g_spawnLocations[15] = SpawnLocation(
LegoGameState::e_unk33,
LegoGameState::e_policeExited,
g_isleScript,
0,
"EDG02_64",
@ -598,7 +598,7 @@ void IslePathActor::SpawnPlayer(LegoGameState::Area p_area, MxBool p_enter, MxU8
}
if (m_cameraFlag) {
FUN_1003eda0();
ResetViewVelocity();
}
if (p_flags & c_playMusic && g_spawnLocations[i].m_music != JukeboxScript::c_noneJukebox) {
@ -630,9 +630,9 @@ void IslePathActor::VTable0xec(MxMatrix p_transform, LegoPathBoundary* p_boundar
m_world->Add(this);
}
m_roi->FUN_100a58f0(p_transform);
m_roi->SetLocal2World(p_transform);
if (m_cameraFlag) {
FUN_1003eda0();
ResetViewVelocity();
FUN_10010c30();
}
}
@ -648,6 +648,6 @@ void IslePathActor::FUN_1001b660()
up *= -1.0f;
position.EqualsCross(direction, up);
m_roi->FUN_100a58f0(transform);
m_roi->VTable0x14();
m_roi->SetLocal2World(transform);
m_roi->WrappedUpdateWorldData();
}

View File

@ -81,7 +81,7 @@ void Jetski::Exit()
MxLong Jetski::HandleClick()
{
#ifndef BETA10
if (!FUN_1003ef60()) {
if (!CanExit()) {
return 1;
}
@ -143,7 +143,7 @@ MxLong Jetski::HandleControl(LegoControlManagerNotificationParam& p_param)
Exit();
((IslePathActor*) UserActor())
->SpawnPlayer(LegoGameState::e_jetraceExterior, TRUE, c_spawnBit1 | c_playMusic | c_spawnBit3);
GameState()->m_currentArea = LegoGameState::e_unk66;
GameState()->m_currentArea = LegoGameState::e_vehicleExited;
return 1;
case IsleScript::c_JetskiInfo_Ctl:
((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_infomain);

View File

@ -36,7 +36,7 @@ MxLong JukeBoxEntity::Notify(MxParam& p_param)
MxNotificationParam& param = (MxNotificationParam&) p_param;
if (param.GetNotification() == c_notificationClick) {
if (!FUN_1003ef60()) {
if (!CanExit()) {
return 1;
}

View File

@ -84,7 +84,7 @@ void Motocycle::Exit()
// FUNCTION: LEGO1 0x10035c50
MxLong Motocycle::HandleClick()
{
if (!FUN_1003ef60()) {
if (!CanExit()) {
return 1;
}
@ -119,7 +119,7 @@ MxLong Motocycle::HandleControl(LegoControlManagerNotificationParam& p_param)
switch (p_param.m_clickedObjectId) {
case IsleScript::c_MotoBikeArms_Ctl:
Exit();
GameState()->m_currentArea = LegoGameState::e_unk66;
GameState()->m_currentArea = LegoGameState::e_vehicleExited;
result = 1;
break;
case IsleScript::c_MotoBikeInfo_Ctl:

View File

@ -136,9 +136,9 @@ Pizza::Pizza()
m_mission = NULL;
m_skateBoard = NULL;
m_act1state = NULL;
m_unk0x8c = IsleScript::c_noneIsle;
m_speechAction = IsleScript::c_noneIsle;
m_unk0x98 = FALSE;
m_unk0x90 = INT_MIN;
m_startTime = INT_MIN;
}
// FUNCTION: LEGO1 0x10038100
@ -188,7 +188,7 @@ void Pizza::FUN_10038220(IsleScript::Script p_objectId)
AnimationManager()->EnableCamAnims(FALSE);
AnimationManager()->FUN_1005f6d0(FALSE);
PlayAction(p_objectId, FALSE);
m_unk0x8c = IsleScript::c_noneIsle;
m_speechAction = IsleScript::c_noneIsle;
}
// FUNCTION: LEGO1 0x100382b0
@ -196,8 +196,8 @@ void Pizza::FUN_10038220(IsleScript::Script p_objectId)
void Pizza::FUN_100382b0()
{
if (m_state->m_unk0x0c != 8) {
if (m_unk0x8c != IsleScript::c_noneIsle) {
InvokeAction(Extra::e_stop, *g_isleScript, m_unk0x8c, NULL);
if (m_speechAction != IsleScript::c_noneIsle) {
InvokeAction(Extra::e_stop, *g_isleScript, m_speechAction, NULL);
}
m_act1state->m_unk0x018 = 0;
@ -209,10 +209,10 @@ void Pizza::FUN_100382b0()
m_mission->m_startTime = INT_MIN;
m_mission = NULL;
m_unk0x98 = FALSE;
m_unk0x8c = IsleScript::c_noneIsle;
m_speechAction = IsleScript::c_noneIsle;
BackgroundAudioManager()->RaiseVolume();
TickleManager()->UnregisterClient(this);
m_unk0x90 = INT_MIN;
m_startTime = INT_MIN;
m_skateBoard->EnableScenePresentation(FALSE);
m_skateBoard->SetPizzaVisible(FALSE);
MxTrace("Pizza mission: idle\n");
@ -254,7 +254,7 @@ MxLong Pizza::HandleClick()
IsleScript::Script action;
switch (m_state->FUN_10039540()) {
switch (m_state->GetActorState()) {
case 0:
action = m_mission->m_actions[m_mission->m_numActions + 3];
break;
@ -284,7 +284,7 @@ MxLong Pizza::HandlePathStruct(LegoPathStructNotificationParam& p_param)
if (p_param.GetTrigger() == LegoPathStruct::c_s && p_param.GetData() == 0x12e &&
GameState()->GetActorId() == LegoActor::c_pepper) {
m_state->m_unk0x0c = 5;
m_state->SetUnknown0xb0(SndanimScript::c_TRS302_OpenJailDoor);
m_state->SetPlayedAction(SndanimScript::c_TRS302_OpenJailDoor);
if (time < m_mission->GetRedFinishTime()) {
m_mission->UpdateScore(LegoState::e_red);
@ -325,26 +325,26 @@ MxLong Pizza::HandlePathStruct(LegoPathStructNotificationParam& p_param)
case IsleScript::c_pps025ni_RunAnim:
case IsleScript::c_pps026ni_RunAnim:
case IsleScript::c_pps027ni_RunAnim:
m_unk0x90 = Timer()->GetTime();
m_unk0x94 = 3800;
m_startTime = Timer()->GetTime();
m_duration = 3800;
break;
case IsleScript::c_pgs050nu_RunAnim:
case IsleScript::c_pgs051nu_RunAnim:
case IsleScript::c_pgs052nu_RunAnim:
m_unk0x90 = Timer()->GetTime();
m_unk0x94 = 6400;
m_startTime = Timer()->GetTime();
m_duration = 6400;
break;
case IsleScript::c_prt072sl_RunAnim:
case IsleScript::c_prt073sl_RunAnim:
case IsleScript::c_prt074sl_RunAnim:
m_unk0x90 = Timer()->GetTime();
m_unk0x94 = 7000;
m_startTime = Timer()->GetTime();
m_duration = 7000;
break;
case IsleScript::c_pho104re_RunAnim:
case IsleScript::c_pho105re_RunAnim:
case IsleScript::c_pho106re_RunAnim:
m_unk0x90 = Timer()->GetTime();
m_unk0x94 = 6500;
m_startTime = Timer()->GetTime();
m_duration = 6500;
break;
}
@ -376,8 +376,8 @@ MxResult Pizza::Tickle()
{
MxLong time = Timer()->GetTime();
if (m_unk0x90 != INT_MIN && m_unk0x94 + m_unk0x90 <= time) {
m_unk0x90 = INT_MIN;
if (m_startTime != INT_MIN && m_duration + m_startTime <= time) {
m_startTime = INT_MIN;
m_skateBoard->EnableScenePresentation(FALSE);
m_skateBoard->SetPizzaVisible(FALSE);
TickleManager()->UnregisterClient(this);
@ -395,29 +395,29 @@ MxResult Pizza::Tickle()
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_Avo917In_PlayWav, NULL);
MxTrace("Pizza mission: timeout, stop\n");
}
else if (time >= m_mission->m_startTime + 35000 && m_unk0x8c == IsleScript::c_noneIsle) {
else if (time >= m_mission->m_startTime + 35000 && m_speechAction == IsleScript::c_noneIsle) {
switch (GameState()->GetActorId()) {
case LegoActor::c_pepper:
m_unk0x8c = IsleScript::c_Avo914In_PlayWav;
m_speechAction = IsleScript::c_Avo914In_PlayWav;
break;
case LegoActor::c_mama:
m_unk0x8c = IsleScript::c_Avo910In_PlayWav;
m_speechAction = IsleScript::c_Avo910In_PlayWav;
break;
case LegoActor::c_papa:
m_unk0x8c = IsleScript::c_Avo912In_PlayWav;
m_speechAction = IsleScript::c_Avo912In_PlayWav;
break;
case LegoActor::c_nick:
m_unk0x8c = IsleScript::c_Avo911In_PlayWav;
m_speechAction = IsleScript::c_Avo911In_PlayWav;
break;
case LegoActor::c_laura:
m_unk0x8c = IsleScript::c_Avo913In_PlayWav;
m_speechAction = IsleScript::c_Avo913In_PlayWav;
break;
}
BackgroundAudioManager()->LowerVolume();
if (m_unk0x8c != IsleScript::c_noneIsle) {
InvokeAction(Extra::e_start, *g_isleScript, m_unk0x8c, NULL);
if (m_speechAction != IsleScript::c_noneIsle) {
InvokeAction(Extra::e_start, *g_isleScript, m_speechAction, NULL);
}
}
}
@ -447,14 +447,14 @@ MxLong Pizza::HandleEndAction(MxEndActionNotificationParam& p_param)
MxLong result = 0;
MxU32 objectId = p_param.GetAction()->GetObjectId();
if (m_unk0x8c == objectId) {
if (m_speechAction == objectId) {
BackgroundAudioManager()->RaiseVolume();
return 1;
}
switch (m_state->m_unk0x0c) {
case 1:
if (m_state->GetUnknown0xb0() == objectId) {
if (m_state->GetPlayedAction() == objectId) {
m_state->m_unk0x0c = 2;
m_mission->m_startTime = Timer()->GetTime();
TickleManager()->RegisterClient(this, 200);
@ -462,7 +462,7 @@ MxLong Pizza::HandleEndAction(MxEndActionNotificationParam& p_param)
}
break;
case 3:
if (m_state->GetUnknown0xb0() == objectId) {
if (m_state->GetPlayedAction() == objectId) {
m_mission->m_startTime = Timer()->GetTime();
PizzaMissionState::Mission* mission = m_mission;
@ -471,7 +471,7 @@ MxLong Pizza::HandleEndAction(MxEndActionNotificationParam& p_param)
}
m_state->m_unk0x0c = 4;
m_state->SetUnknown0xb0(IsleScript::c_noneIsle);
m_state->SetPlayedAction(IsleScript::c_noneIsle);
UserActor()->SetActorState(LegoPathActor::c_initial);
m_skateBoard->SetPizzaVisible(TRUE);
m_world->PlaceActor(m_skateBoard, "int37", 2, 0.5, 3, 0.5);
@ -490,7 +490,7 @@ MxLong Pizza::HandleEndAction(MxEndActionNotificationParam& p_param)
}
break;
case 5:
if (m_state->GetUnknown0xb0() == objectId) {
if (m_state->GetPlayedAction() == objectId) {
StopActions();
if (GameState()->GetActorId() == LegoActor::c_pepper) {
@ -506,24 +506,24 @@ MxLong Pizza::HandleEndAction(MxEndActionNotificationParam& p_param)
break;
case 2:
action = IsleScript::c_pja129br_RunAnim;
m_unk0x90 = Timer()->GetTime();
m_unk0x94 = 500;
m_startTime = Timer()->GetTime();
m_duration = 500;
m_mission->m_unk0x14++;
m_state->m_unk0x0c = 6;
MxTrace("Pizza mission: succeeds\n");
break;
case 3:
action = IsleScript::c_pja131br_RunAnim;
m_unk0x90 = Timer()->GetTime();
m_unk0x94 = 500;
m_startTime = Timer()->GetTime();
m_duration = 500;
m_state->m_unk0x0c = 6;
break;
}
}
else {
action = IsleScript::c_pja132br_RunAnim;
m_unk0x90 = Timer()->GetTime();
m_unk0x94 = 2300;
m_startTime = Timer()->GetTime();
m_duration = 2300;
m_state->m_unk0x0c = 8;
InputManager()->DisableInputProcessing();
InputManager()->SetUnknown336(TRUE);
@ -535,16 +535,16 @@ MxLong Pizza::HandleEndAction(MxEndActionNotificationParam& p_param)
else {
FUN_100382b0();
m_state->m_unk0x0c = 0;
m_state->SetUnknown0xb0(IsleScript::c_noneIsle);
m_state->SetPlayedAction(IsleScript::c_noneIsle);
}
}
break;
case 6:
if (m_state->GetUnknown0xb0() == objectId) {
if (m_state->GetPlayedAction() == objectId) {
if (objectId == IsleScript::c_pja126br_RunAnim) {
PlayAction(IsleScript::c_pja127br_RunAnim, TRUE);
m_unk0x90 = Timer()->GetTime();
m_unk0x94 = 700;
m_startTime = Timer()->GetTime();
m_duration = 700;
}
else if (objectId == IsleScript::c_pja129br_RunAnim) {
PlayAction(IsleScript::c_pja130br_RunAnim, TRUE);
@ -552,12 +552,12 @@ MxLong Pizza::HandleEndAction(MxEndActionNotificationParam& p_param)
else {
FUN_100382b0();
m_state->m_unk0x0c = 0;
m_state->SetUnknown0xb0(IsleScript::c_noneIsle);
m_state->SetPlayedAction(IsleScript::c_noneIsle);
}
}
break;
case 8:
if (m_state->GetUnknown0xb0() == objectId) {
if (m_state->GetPlayedAction() == objectId) {
m_act1state->m_unk0x018 = 0;
m_state->m_unk0x0c = 0;
GameState()->m_currentArea = LegoGameState::e_isle;
@ -567,7 +567,7 @@ MxLong Pizza::HandleEndAction(MxEndActionNotificationParam& p_param)
}
break;
case 9:
if (m_state->GetUnknown0xb0() == objectId) {
if (m_state->GetPlayedAction() == objectId) {
FUN_100382b0();
}
break;
@ -580,10 +580,10 @@ MxLong Pizza::HandleEndAction(MxEndActionNotificationParam& p_param)
// FUNCTION: BETA10 0x100ef520
void Pizza::PlayAction(MxU32 p_objectId, MxBool p_param7)
{
m_state->SetUnknown0xb0(p_objectId);
m_state->SetPlayedAction(p_objectId);
if (m_unk0x8c != IsleScript::c_noneIsle) {
InvokeAction(Extra::e_stop, *g_isleScript, m_unk0x8c, NULL);
if (m_speechAction != IsleScript::c_noneIsle) {
InvokeAction(Extra::e_stop, *g_isleScript, m_speechAction, NULL);
}
AnimationManager()
@ -601,7 +601,7 @@ PizzaMissionState::PizzaMissionState()
m_missions[3] = Mission(LegoActor::c_nick, 2, g_nickFinishTimes, g_nickActions, 4);
m_missions[4] = Mission(LegoActor::c_laura, 2, g_lauraFinishTimes, g_lauraActions, 4);
m_pizzeriaState = (PizzeriaState*) GameState()->GetState("PizzeriaState");
m_unk0xb0 = IsleScript::c_noneIsle;
m_playedAction = IsleScript::c_noneIsle;
}
// FUNCTION: LEGO1 0x100393c0
@ -645,7 +645,7 @@ PizzaMissionState::Mission* PizzaMissionState::GetMission(MxU8 p_actorId)
}
// FUNCTION: LEGO1 0x10039540
MxS16 PizzaMissionState::FUN_10039540()
MxS16 PizzaMissionState::GetActorState()
{
return m_pizzeriaState->FUN_10017d50();
return m_pizzeriaState->GetActorState();
}

View File

@ -69,7 +69,7 @@ void Pizzeria::CreateState()
// FUNCTION: BETA10 0x100efc91
MxLong Pizzeria::HandleClick()
{
if (FUN_1003ef60() && m_pizzaMissionState->m_unk0x0c == 0) {
if (CanExit() && m_pizzaMissionState->m_unk0x0c == 0) {
if (UserActor()->GetActorId() != GameState()->GetActorId()) {
if (!UserActor()->IsA("SkateBoard")) {
((IslePathActor*) UserActor())->Exit();
@ -89,18 +89,18 @@ MxLong Pizzeria::HandleClick()
// FUNCTION: BETA10 0x100efd14
PizzeriaState::PizzeriaState()
{
m_unk0x08[0] = Playlist((MxU32*) g_pepperActions, sizeOfArray(g_pepperActions), Playlist::e_once);
m_unk0x08[1] = Playlist((MxU32*) g_mamaActions, sizeOfArray(g_mamaActions), Playlist::e_once);
m_unk0x08[2] = Playlist((MxU32*) g_papaActions, sizeOfArray(g_papaActions), Playlist::e_once);
m_unk0x08[3] = Playlist((MxU32*) g_nickActions, sizeOfArray(g_nickActions), Playlist::e_once);
m_unk0x08[4] = Playlist((MxU32*) g_lauraActions, sizeOfArray(g_lauraActions), Playlist::e_once);
memset(m_unk0x44, -1, sizeof(m_unk0x44));
m_playerPlaylists[0] = Playlist((MxU32*) g_pepperActions, sizeOfArray(g_pepperActions), Playlist::e_once);
m_playerPlaylists[1] = Playlist((MxU32*) g_mamaActions, sizeOfArray(g_mamaActions), Playlist::e_once);
m_playerPlaylists[2] = Playlist((MxU32*) g_papaActions, sizeOfArray(g_papaActions), Playlist::e_once);
m_playerPlaylists[3] = Playlist((MxU32*) g_nickActions, sizeOfArray(g_nickActions), Playlist::e_once);
m_playerPlaylists[4] = Playlist((MxU32*) g_lauraActions, sizeOfArray(g_lauraActions), Playlist::e_once);
memset(m_states, -1, sizeof(m_states));
}
// FUNCTION: LEGO1 0x10017d50
MxS16 PizzeriaState::FUN_10017d50()
MxS16 PizzeriaState::GetActorState()
{
return m_unk0x44[GameState()->GetActorId() - 1];
return m_states[GameState()->GetActorId() - 1];
}
// FUNCTION: LEGO1 0x10017d70
@ -109,11 +109,11 @@ MxU32 PizzeriaState::NextAction()
{
MxU8 actorId = GameState()->GetActorId();
if (m_unk0x44[actorId - 1] < 2) {
m_unk0x44[actorId - 1]++;
if (m_states[actorId - 1] < 2) {
m_states[actorId - 1]++;
}
return m_unk0x08[actorId - 1].Next();
return m_playerPlaylists[actorId - 1].Next();
}
// FUNCTION: LEGO1 0x10017da0
@ -124,12 +124,12 @@ MxResult PizzeriaState::Serialize(LegoStorage* p_storage)
if (p_storage->IsReadMode()) {
for (MxS16 i = 0; i < 5; i++) {
p_storage->ReadS16(m_unk0x08[i].m_nextIndex);
p_storage->ReadS16(m_playerPlaylists[i].m_nextIndex);
}
}
else {
for (MxS16 i = 0; i < 5; i++) {
p_storage->WriteS16(m_unk0x08[i].m_nextIndex);
p_storage->WriteS16(m_playerPlaylists[i].m_nextIndex);
}
}

View File

@ -40,7 +40,7 @@ MxResult RaceCar::Create(MxDSAction& p_dsAction)
// FUNCTION: LEGO1 0x100284d0
MxLong RaceCar::HandleClick()
{
if (!FUN_1003ef60()) {
if (!CanExit()) {
return 1;
}

View File

@ -18,7 +18,7 @@ DECOMP_SIZE_ASSERT(Radio, 0x10)
DECOMP_SIZE_ASSERT(RadioState, 0x30)
// GLOBAL: LEGO1 0x100f3218
JukeboxScript::Script g_unk0x100f3218[] = {
JukeboxScript::Script g_jingles[] = {
JukeboxScript::c_sns002ra_Audio,
JukeboxScript::c_sns001ja_Audio,
JukeboxScript::c_snsc01js_Audio,
@ -28,7 +28,7 @@ JukeboxScript::Script g_unk0x100f3218[] = {
};
// GLOBAL: LEGO1 0x100f3230
JukeboxScript::Script g_unk0x100f3230[] = {
JukeboxScript::Script g_news[] = {
JukeboxScript::c_ham035ra_Audio,
JukeboxScript::c_ham039ra_Audio,
JukeboxScript::c_sns005ra_Audio,
@ -46,7 +46,7 @@ JukeboxScript::Script g_unk0x100f3230[] = {
};
// GLOBAL: LEGO1 0x100f3268
JukeboxScript::Script g_unk0x100f3268[] = {
JukeboxScript::Script g_songs[] = {
JukeboxScript::c_CentralRoads_Music,
JukeboxScript::c_BeachBlvd_Music,
JukeboxScript::c_ResidentalArea_Music,
@ -64,7 +64,7 @@ Radio::Radio()
NotificationManager()->Register(this);
ControlManager()->Register(this);
m_unk0x0c = TRUE;
m_enabled = TRUE;
CreateState();
}
@ -86,7 +86,7 @@ MxLong Radio::Notify(MxParam& p_param)
{
MxLong result = 0;
if (m_unk0x0c) {
if (m_enabled) {
MxNotificationParam& param = (MxNotificationParam&) p_param;
switch (param.GetNotification()) {
case c_notificationEndAction:
@ -108,7 +108,7 @@ void Radio::Play()
CurrentWorld();
MxDSAction action;
action.SetObjectId(m_state->FUN_1002d090());
action.SetObjectId(m_state->NextPlaylistObjectId());
action.SetAtomId(*g_jukeboxScript);
action.SetLoopCount(1);
@ -131,7 +131,7 @@ void Radio::Stop()
MxControlPresenter* presenter = (MxControlPresenter*) world->Find(world->GetAtomId(), IsleScript::c_Radio_Ctl);
if (presenter) {
presenter->VTable0x6c(0);
presenter->UpdateEnabledChild(0);
}
BackgroundAudioManager()->Stop();
@ -174,11 +174,11 @@ MxLong Radio::HandleControl(LegoControlManagerNotificationParam& p_param)
MxLong Radio::HandleEndAction(MxEndActionNotificationParam& p_param)
{
if (m_state->IsActive() &&
m_state->FUN_1002d0c0(p_param.GetAction()->GetAtomId(), p_param.GetAction()->GetObjectId())) {
m_state->IsRadioObjectId(p_param.GetAction()->GetAtomId(), p_param.GetAction()->GetObjectId())) {
MxDSAction action;
action.SetAtomId(*g_jukeboxScript);
action.SetObjectId(m_state->FUN_1002d090());
action.SetObjectId(m_state->NextPlaylistObjectId());
action.SetLoopCount(1);
BackgroundAudioManager()->PlayMusic(action, 3, MxPresenter::e_repeating);
@ -191,8 +191,8 @@ MxLong Radio::HandleEndAction(MxEndActionNotificationParam& p_param)
// FUNCTION: LEGO1 0x1002cdc0
void Radio::Initialize(MxBool p_und)
{
if (m_unk0x0c != p_und) {
m_unk0x0c = p_und;
if (m_enabled != p_und) {
m_enabled = p_und;
CreateState();
}
}
@ -216,39 +216,39 @@ RadioState::RadioState()
srand(Timer()->GetTime());
MxS32 random = rand();
m_unk0x2c = random % 3;
m_activePlaylist = random % 3;
m_unk0x08[0] = Playlist((MxU32*) g_unk0x100f3218, sizeOfArray(g_unk0x100f3218), Playlist::e_loop);
m_unk0x08[0].m_nextIndex = (rand() % sizeOfArray(g_unk0x100f3218));
m_playlists[0] = Playlist((MxU32*) g_jingles, sizeOfArray(g_jingles), Playlist::e_loop);
m_playlists[0].m_nextIndex = (rand() % sizeOfArray(g_jingles));
m_unk0x08[1] = Playlist((MxU32*) g_unk0x100f3230, sizeOfArray(g_unk0x100f3230), Playlist::e_loop);
m_unk0x08[1].m_nextIndex = (rand() % sizeOfArray(g_unk0x100f3230));
m_playlists[1] = Playlist((MxU32*) g_news, sizeOfArray(g_news), Playlist::e_loop);
m_playlists[1].m_nextIndex = (rand() % sizeOfArray(g_news));
m_unk0x08[2] = Playlist((MxU32*) g_unk0x100f3268, sizeOfArray(g_unk0x100f3268), Playlist::e_loop);
m_unk0x08[2].m_nextIndex = (rand() % sizeOfArray(g_unk0x100f3268));
m_playlists[2] = Playlist((MxU32*) g_songs, sizeOfArray(g_songs), Playlist::e_loop);
m_playlists[2].m_nextIndex = (rand() % sizeOfArray(g_songs));
m_active = FALSE;
}
// FUNCTION: LEGO1 0x1002d090
MxU32 RadioState::FUN_1002d090()
MxU32 RadioState::NextPlaylistObjectId()
{
if (m_unk0x2c == 2) {
m_unk0x2c = 0;
if (m_activePlaylist == 2) {
m_activePlaylist = 0;
}
else {
m_unk0x2c++;
m_activePlaylist++;
}
return m_unk0x08[m_unk0x2c].Next();
return m_playlists[m_activePlaylist].Next();
}
// FUNCTION: LEGO1 0x1002d0c0
MxBool RadioState::FUN_1002d0c0(const MxAtomId& p_atom, MxU32 p_objectId)
MxBool RadioState::IsRadioObjectId(const MxAtomId& p_atom, MxU32 p_objectId)
{
if (*g_jukeboxScript == p_atom) {
for (MxS16 i = 0; i < 3; i++) {
if (m_unk0x08[i].Contains(p_objectId)) {
if (m_playlists[i].Contains(p_objectId)) {
return TRUE;
}
}

View File

@ -75,7 +75,7 @@ MxLong SkateBoard::HandleClick()
{
Act1State* state = (Act1State*) GameState()->GetState("Act1State");
if (!FUN_1003ef60() && state->m_unk0x018 != 3) {
if (!CanExit() && state->m_unk0x018 != 3) {
return 1;
}
@ -112,7 +112,7 @@ MxLong SkateBoard::HandleControl(LegoControlManagerNotificationParam& p_param)
if (p_param.m_unk0x28 == 1 && p_param.m_clickedObjectId == IsleScript::c_SkateArms_Ctl) {
Exit();
GameState()->m_currentArea = LegoGameState::Area::e_unk66;
GameState()->m_currentArea = LegoGameState::Area::e_vehicleExited;
result = 1;
}

View File

@ -435,7 +435,7 @@ MxLong TowTrack::HandleClick()
FindROI("rcred")->SetVisibility(FALSE);
}
else {
SpawnPlayer(LegoGameState::e_unk28, TRUE, 0);
SpawnPlayer(LegoGameState::e_garageExited, TRUE, 0);
m_lastAction = IsleScript::c_noneIsle;
m_lastAnimation = IsleScript::c_noneIsle;
m_state->m_startTime = Timer()->GetTime();
@ -486,14 +486,14 @@ MxLong TowTrack::HandleControl(LegoControlManagerNotificationParam& p_param)
switch (p_param.m_clickedObjectId) {
case IsleScript::c_TowTrackArms_Ctl:
Exit();
GameState()->m_currentArea = LegoGameState::e_unk66;
GameState()->m_currentArea = LegoGameState::e_vehicleExited;
result = 1;
break;
case IsleScript::c_TowInfo_Ctl:
((Isle*) CurrentWorld())->SetDestLocation(LegoGameState::e_infomain);
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
Exit();
GameState()->m_currentArea = LegoGameState::e_unk66;
GameState()->m_currentArea = LegoGameState::e_vehicleExited;
result = 1;
break;
case IsleScript::c_TowHorn_Ctl:

View File

@ -3,7 +3,6 @@
#include "legomain.h"
#include "misc.h"
#include "mxaudiopresenter.h"
#include "mxcompositepresenter.h"
#include "mxdssound.h"
#include "mxmisc.h"
#include "mxnotificationmanager.h"
@ -11,6 +10,7 @@
#include "mxstreamer.h"
#include "mxticklemanager.h"
#include "mxutilities.h"
#include "mxwavepresenter.h"
DECOMP_SIZE_ASSERT(MxBackgroundAudioManager, 0x150)
@ -18,12 +18,12 @@ DECOMP_SIZE_ASSERT(MxBackgroundAudioManager, 0x150)
MxBackgroundAudioManager::MxBackgroundAudioManager()
{
NotificationManager()->Register(this);
m_unk0xa0 = 0;
m_unk0x138 = 0;
m_activePresenter = NULL;
m_pendingPresenter = NULL;
m_tickleState = MxPresenter::e_idle;
m_speed = 0;
m_targetVolume = 0;
m_unk0x148 = 0;
m_volumeSuppressionAmount = 0;
m_enabled = FALSE;
}
@ -83,29 +83,29 @@ MxResult MxBackgroundAudioManager::Tickle()
{
switch (m_tickleState) {
case MxPresenter::e_starting:
FadeInOrFadeOut();
FadeToTargetVolume();
break;
case MxPresenter::e_streaming:
FUN_1007ee70();
MakePendingPresenterActive();
break;
case MxPresenter::e_repeating:
FUN_1007ef40();
FadeInPendingPresenter();
}
return SUCCESS;
}
// FUNCTION: LEGO1 0x1007ee70
void MxBackgroundAudioManager::FUN_1007ee70()
void MxBackgroundAudioManager::MakePendingPresenterActive()
{
if (m_unk0xa0 && m_unk0xa0->GetAction()) {
DeleteObject(*m_unk0x138->GetAction());
if (m_activePresenter && m_activePresenter->GetAction()) {
DeleteObject(*m_pendingPresenter->GetAction());
}
if (m_unk0x138) {
m_unk0xa0 = m_unk0x138;
if (m_pendingPresenter) {
m_activePresenter = m_pendingPresenter;
m_action1 = m_action2;
m_unk0x138 = NULL;
m_pendingPresenter = NULL;
m_action2.SetObjectId(-1);
m_action2.SetAtomId(MxAtomId());
m_tickleState = MxPresenter::e_idle;
@ -113,65 +113,65 @@ void MxBackgroundAudioManager::FUN_1007ee70()
}
// FUNCTION: LEGO1 0x1007ef40
void MxBackgroundAudioManager::FUN_1007ef40()
void MxBackgroundAudioManager::FadeInPendingPresenter()
{
MxS32 compare, volume;
if (m_unk0xa0 == NULL) {
if (m_unk0x138) {
if (m_unk0x148 != 0) {
if (m_activePresenter == NULL) {
if (m_pendingPresenter) {
if (m_volumeSuppressionAmount != 0) {
compare = 30;
}
else {
compare = m_targetVolume;
}
volume = m_unk0x138->GetVolume();
volume = m_pendingPresenter->GetVolume();
if (volume < compare) {
if (m_speed + m_unk0x138->GetVolume() <= compare) {
compare = m_speed + m_unk0x138->GetVolume();
if (m_speed + m_pendingPresenter->GetVolume() <= compare) {
compare = m_speed + m_pendingPresenter->GetVolume();
}
m_unk0x138->SetVolume(compare);
m_pendingPresenter->SetVolume(compare);
}
else {
m_unk0x138->SetVolume(compare);
m_unk0xa0 = m_unk0x138;
m_pendingPresenter->SetVolume(compare);
m_activePresenter = m_pendingPresenter;
m_action1 = m_action2;
m_unk0x138 = NULL;
m_pendingPresenter = NULL;
m_action2.SetObjectId(-1);
m_action2.SetAtomId(MxAtomId());
m_tickleState = MxPresenter::e_idle;
}
}
}
else if (m_unk0xa0->GetAction() != NULL) {
if (m_unk0xa0->GetVolume() == 0) {
DeleteObject(*m_unk0xa0->GetAction());
else if (m_activePresenter->GetAction() != NULL) {
if (m_activePresenter->GetVolume() == 0) {
DeleteObject(*m_activePresenter->GetAction());
}
else {
if (m_unk0xa0->GetVolume() - m_speed > 0) {
volume = m_unk0xa0->GetVolume() - m_speed;
if (m_activePresenter->GetVolume() - m_speed > 0) {
volume = m_activePresenter->GetVolume() - m_speed;
}
else {
volume = 0;
}
m_unk0xa0->SetVolume(volume);
m_activePresenter->SetVolume(volume);
}
}
}
// FUNCTION: LEGO1 0x1007f0e0
// FUNCTION: BETA10 0x100e8d8d
void MxBackgroundAudioManager::FadeInOrFadeOut()
void MxBackgroundAudioManager::FadeToTargetVolume()
{
MxS32 volume, compare;
if (m_unk0xa0 != NULL) {
volume = m_unk0xa0->GetVolume();
if (m_activePresenter != NULL) {
volume = m_activePresenter->GetVolume();
if (m_unk0x148 != 0) {
if (m_volumeSuppressionAmount != 0) {
compare = 30;
}
else {
@ -179,13 +179,13 @@ void MxBackgroundAudioManager::FadeInOrFadeOut()
}
if (volume < compare) {
m_unk0xa0->SetVolume(volume + m_speed < compare ? volume + m_speed : compare);
m_activePresenter->SetVolume(volume + m_speed < compare ? volume + m_speed : compare);
}
else if (compare < volume) {
m_unk0xa0->SetVolume(volume - m_speed > compare ? volume - m_speed : compare);
m_activePresenter->SetVolume(volume - m_speed > compare ? volume - m_speed : compare);
}
else {
m_unk0xa0->SetVolume(volume);
m_activePresenter->SetVolume(volume);
m_tickleState = MxPresenter::e_idle;
}
}
@ -215,23 +215,23 @@ MxLong MxBackgroundAudioManager::Notify(MxParam& p_param)
void MxBackgroundAudioManager::StartAction(MxParam& p_param)
{
// TODO: the sender is most likely a MxAudioPresenter?
m_unk0x138 = (MxAudioPresenter*) ((MxNotificationParam&) p_param).GetSender();
m_action2.SetAtomId(m_unk0x138->GetAction()->GetAtomId());
m_action2.SetObjectId(m_unk0x138->GetAction()->GetObjectId());
m_targetVolume = ((MxDSSound*) (m_unk0x138->GetAction()))->GetVolume();
m_unk0x138->SetVolume(0);
m_pendingPresenter = (MxAudioPresenter*) ((MxNotificationParam&) p_param).GetSender();
m_action2.SetAtomId(m_pendingPresenter->GetAction()->GetAtomId());
m_action2.SetObjectId(m_pendingPresenter->GetAction()->GetObjectId());
m_targetVolume = ((MxDSSound*) (m_pendingPresenter->GetAction()))->GetVolume();
m_pendingPresenter->SetVolume(0);
}
// FUNCTION: LEGO1 0x1007f200
void MxBackgroundAudioManager::StopAction(MxParam& p_param)
{
if (((MxNotificationParam&) p_param).GetSender() == m_unk0xa0) {
m_unk0xa0 = NULL;
if (((MxNotificationParam&) p_param).GetSender() == m_activePresenter) {
m_activePresenter = NULL;
m_action1.SetAtomId(MxAtomId());
m_action1.SetObjectId(-1);
}
else if (((MxNotificationParam&) p_param).GetSender() == m_unk0x138) {
m_unk0x138 = NULL;
else if (((MxNotificationParam&) p_param).GetSender() == m_pendingPresenter) {
m_pendingPresenter = NULL;
m_action2.SetAtomId(MxAtomId());
m_action2.SetObjectId(-1);
}
@ -243,7 +243,7 @@ void MxBackgroundAudioManager::StopAction(MxParam& p_param)
// FUNCTION: BETA10 0x100e90fc
MxResult MxBackgroundAudioManager::PlayMusic(
MxDSAction& p_action,
undefined4 p_speed,
MxS32 p_speed,
MxPresenter::TickleState p_tickleState
)
{
@ -261,7 +261,7 @@ MxResult MxBackgroundAudioManager::PlayMusic(
m_action2.SetAtomId(p_action.GetAtomId());
m_action2.SetObjectId(p_action.GetObjectId());
m_action2.SetUnknown84(this);
m_action2.SetNotificationObject(this);
m_action2.SetOrigin(this);
MxResult result = Start(&m_action2);
@ -289,7 +289,7 @@ void MxBackgroundAudioManager::Stop()
DeleteObject(m_action2);
}
m_unk0x138 = 0;
m_pendingPresenter = NULL;
m_action2.SetAtomId(MxAtomId());
m_action2.SetObjectId(-1);
@ -297,9 +297,9 @@ void MxBackgroundAudioManager::Stop()
DeleteObject(m_action1);
}
m_unk0xa0 = 0;
m_activePresenter = NULL;
m_action1.SetAtomId(MxAtomId());
m_unk0x148 = 0;
m_volumeSuppressionAmount = 0;
m_action1.SetObjectId(-1);
m_tickleState = MxPresenter::e_idle;
}
@ -308,22 +308,22 @@ void MxBackgroundAudioManager::Stop()
// FUNCTION: BETA10 0x100e94e6
void MxBackgroundAudioManager::LowerVolume()
{
if (m_unk0x148 == 0) {
if (m_volumeSuppressionAmount == 0) {
if (m_tickleState == 0) {
m_tickleState = MxPresenter::e_starting;
}
m_speed = 20;
}
m_unk0x148++;
m_volumeSuppressionAmount++;
}
// FUNCTION: LEGO1 0x1007f5b0
// FUNCTION: BETA10 0x100e9543
void MxBackgroundAudioManager::RaiseVolume()
{
if (m_unk0x148 != 0) {
m_unk0x148--;
if (m_unk0x148 == 0) {
if (m_volumeSuppressionAmount != 0) {
m_volumeSuppressionAmount--;
if (m_volumeSuppressionAmount == 0) {
if (m_tickleState == 0) {
m_tickleState = MxPresenter::e_starting;
}
@ -346,27 +346,27 @@ void MxBackgroundAudioManager::Enable(MxBool p_enable)
// FUNCTION: LEGO1 0x1007f610
// FUNCTION: BETA10 0x100e95ee
undefined4 MxBackgroundAudioManager::FUN_1007f610(
MxPresenter* p_unk0x138,
MxResult MxBackgroundAudioManager::SetPendingPresenter(
MxPresenter* p_presenter,
MxS32 p_speed,
MxPresenter::TickleState p_tickleState
)
{
m_unk0x138 = (MxAudioPresenter*) p_unk0x138;
m_targetVolume = ((MxDSSound*) m_unk0x138->GetAction())->GetVolume();
m_pendingPresenter = (MxAudioPresenter*) p_presenter;
m_targetVolume = ((MxDSSound*) m_pendingPresenter->GetAction())->GetVolume();
((MxCompositePresenter*) m_unk0x138)->VTable0x60(NULL);
((MxWavePresenter*) m_pendingPresenter)->SetVolume(0);
m_speed = p_speed;
m_tickleState = p_tickleState;
return 0;
return SUCCESS;
}
// FUNCTION: LEGO1 0x1007f650
// FUNCTION: BETA10 0x100e9663
void MxBackgroundAudioManager::Init()
{
this->m_unk0xa0 = 0;
this->m_activePresenter = NULL;
this->m_tickleState = MxPresenter::e_idle;
}

View File

@ -93,10 +93,10 @@ MxS16 LegoCarBuild::g_unk0x100f11cc = -1;
LegoCarBuild::LegoCarBuild()
{
m_unk0x100 = 0;
m_unk0x110 = 0;
m_selectedPart = 0;
m_unk0xf8 = c_unknownminusone;
m_unk0x2d4 = FALSE;
m_unk0x258 = 0;
m_selectedPartIsPlaced = FALSE;
m_animPresenter = NULL;
m_ColorBook_Bitmap = NULL;
m_Yellow_Ctl = NULL;
m_Red_Ctl = NULL;
@ -135,12 +135,12 @@ LegoCarBuild::LegoCarBuild()
LegoCarBuild::~LegoCarBuild()
{
m_unk0x100 = 0;
m_unk0x110 = NULL;
m_selectedPart = NULL;
if (m_unk0x258) {
m_unk0x258->SetUnknown0xbc(0);
m_unk0x258->SetTickleState(MxPresenter::e_idle);
m_unk0x258 = NULL;
if (m_animPresenter) {
m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_selected);
m_animPresenter->SetTickleState(MxPresenter::e_idle);
m_animPresenter = NULL;
}
ControlManager()->Unregister(this);
@ -268,7 +268,9 @@ void LegoCarBuild::InitPresenters()
m_Decals_Ctl1 = (MxControlPresenter*) Find("MxControlPresenter", "Decals_Ctl1");
m_Decals_Ctl2 = (MxControlPresenter*) Find("MxControlPresenter", "Decals_Ctl2");
m_Decal_Bitmap = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap");
#ifdef BETA10
assert(m_Decal_Bitmap);
#endif
if (m_Decal_Bitmap) {
m_Decals_Ctl3 = (MxControlPresenter*) Find("MxControlPresenter", "Decals_Ctl3");
assert(m_Decals_Ctl3);
@ -286,9 +288,9 @@ void LegoCarBuild::InitPresenters()
// FUNCTION: LEGO1 0x10022f00
void LegoCarBuild::FUN_10022f00()
{
if (m_unk0x110) {
if (m_selectedPart) {
VTable0x6c();
m_unk0x258->SetUnknown0xbc(0);
m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_selected);
m_unk0x100 = 5;
}
}
@ -297,18 +299,18 @@ void LegoCarBuild::FUN_10022f00()
// FUNCTION: BETA10 0x1006b835
void LegoCarBuild::FUN_10022f30()
{
if (m_unk0x110) {
if (m_selectedPart) {
FUN_10024f70(FALSE);
FUN_100250e0(FALSE);
if (m_unk0x258->PartIsPlaced(m_unk0x110->GetName())) {
if (m_animPresenter->PartIsPlaced(m_selectedPart->GetName())) {
m_PlaceBrick_Sound->Enable(FALSE);
m_PlaceBrick_Sound->Enable(TRUE);
}
m_unk0x258->SetUnknown0xbc(1);
m_unk0x258->PutFrame();
m_unk0x110 = NULL;
m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_stopped);
m_animPresenter->PutFrame();
m_selectedPart = NULL;
m_unk0x100 = 0;
}
}
@ -318,8 +320,8 @@ void LegoCarBuild::FUN_10022f30()
void LegoCarBuild::VTable0x6c()
{
m_unk0x178 = m_unk0x1c0;
m_unk0x110->WrappedSetLocalTransform(m_unk0x178);
m_unk0x2a4 = Vector4(m_unk0x110->GetWorldPosition());
m_selectedPart->WrappedSetLocal2WorldWithWorldDataUpdate(m_unk0x178);
m_unk0x2a4 = Vector4(m_selectedPart->GetWorldPosition());
VTable0x70();
}
@ -358,7 +360,7 @@ void LegoCarBuild::VTable0x70()
// FUNCTION: BETA10 0x1006bb22
void LegoCarBuild::FUN_10023130(MxLong p_x, MxLong p_y)
{
if (m_unk0x110) {
if (m_selectedPart) {
MxFloat pfVar3[2];
MxFloat local30[3];
MxFloat local84[3];
@ -369,7 +371,7 @@ void LegoCarBuild::FUN_10023130(MxLong p_x, MxLong p_y)
pfVar3[0] = p_x;
pfVar3[1] = p_y;
if (FUN_1003ded0(pfVar3, local30, local84)) {
if (CalculateRayOriginDirection(pfVar3, local30, local84)) {
MxFloat local18[3];
MxFloat local8c[2];
@ -406,7 +408,7 @@ void LegoCarBuild::FUN_10023130(MxLong p_x, MxLong p_y)
local78[3][2] = m_unk0x178[3][2] + local18[2];
local78[3][3] = 1.0;
m_unk0x110->WrappedSetLocalTransform(local78);
m_selectedPart->WrappedSetLocal2WorldWithWorldDataUpdate(local78);
}
}
}
@ -419,7 +421,7 @@ void LegoCarBuild::VTable0x74(MxFloat p_param1[2], MxFloat p_param2[3])
MxFloat local20[3];
MxFloat local14[3];
FUN_1003ded0(p_param1, local14, local20);
CalculateRayOriginDirection(p_param1, local14, local20);
fVar1 = (m_unk0x2a4[2] - local20[2]) / local14[2];
p_param2[0] = (fVar1 * local14[0] + local20[0]) - m_unk0x2a4[0];
@ -435,7 +437,7 @@ void LegoCarBuild::VTable0x78(MxFloat p_param1[2], MxFloat p_param2[3])
MxFloat local18[3];
MxFloat localc[3];
FUN_1003ded0(p_param1, local18, localc);
CalculateRayOriginDirection(p_param1, local18, localc);
p_param2[2] = m_unk0x2a4[2] +
(m_unk0x2bc[2] - m_unk0x2a4[2]) * ((p_param1[1] - m_unk0x290[1]) / (m_unk0x298[1] - m_unk0x290[1]));
@ -451,7 +453,7 @@ void LegoCarBuild::VTable0x7c(MxFloat p_param1[2], MxFloat p_param2[3])
{
MxFloat local18[3];
MxFloat localc[3];
FUN_1003ded0(p_param1, local18, localc);
CalculateRayOriginDirection(p_param1, local18, localc);
MxFloat fVar1 = (m_unk0x2bc[1] - localc[1]) / local18[1];
p_param2[0] = fVar1 * local18[0] - m_unk0x2a4[0] + localc[0];
@ -472,18 +474,18 @@ void LegoCarBuild::VTable0x80(MxFloat p_param1[2], MxFloat p_param2[2], MxFloat
// FUNCTION: LEGO1 0x100236d0
// FUNCTION: BETA10 0x1006c076
void LegoCarBuild::FUN_100236d0()
void LegoCarBuild::AddSelectedPartToBuild()
{
MxS32 pLVar2;
FUN_10024f70(FALSE);
FUN_100250e0(FALSE);
m_unk0x258->FUN_10079790(m_unk0x110->GetName());
m_unk0x258->SetUnknown0xbc(1);
m_unk0x110 = NULL;
m_animPresenter->AddPartToBuildByName(m_selectedPart->GetName());
m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_stopped);
m_selectedPart = NULL;
m_unk0x100 = 0;
if (m_unk0x258->AllPartsPlaced()) {
if (m_animPresenter->AllPartsPlaced()) {
// Note the code duplication with LEGO1 0x10025ee0
switch (m_carId) {
case 1:
@ -539,15 +541,15 @@ MxResult LegoCarBuild::Tickle()
FUN_10024f50();
}
if (m_unk0x110) {
if (m_unk0x258->PartIsPlaced(m_unk0x110->GetName())) {
if (m_selectedPart) {
if (m_animPresenter->PartIsPlaced(m_selectedPart->GetName())) {
FUN_10022f30();
}
}
}
if (m_unk0x100 == 5 && m_unk0x110) {
RotateY(m_unk0x110, g_unk0x100d65a4);
if (m_unk0x100 == 5 && m_selectedPart) {
RotateY(m_selectedPart, g_unk0x100d65a4);
}
if (m_unk0x10a) {
@ -654,7 +656,7 @@ MxLong LegoCarBuild::Notify(MxParam& p_param)
if (m_worldStarted) {
switch (param.GetNotification()) {
case c_notificationType0:
FUN_10024c20((LegoEventNotificationParam*) &p_param);
FUN_10024c20((MxNotificationParam*) &p_param);
result = 1;
break;
case c_notificationEndAction:
@ -685,7 +687,7 @@ MxLong LegoCarBuild::Notify(MxParam& p_param)
if (((m_buildState->m_animationState != 4) && (m_buildState->m_animationState != 6)) &&
(m_buildState->m_animationState != 2)) {
m_buildState->m_animationState = LegoVehicleBuildState::e_unknown0;
result = FUN_100244e0(
result = SelectPartFromMousePosition(
((LegoEventNotificationParam&) p_param).GetX(),
((LegoEventNotificationParam&) p_param).GetY()
);
@ -782,11 +784,11 @@ void LegoCarBuild::FUN_100243a0()
TransitionManager()->StartTransition(MxTransitionManager::TransitionType::e_mosaic, 50, FALSE, FALSE);
break;
case Jetski_Actor:
m_destLocation = LegoGameState::Area::e_unk17;
m_destLocation = LegoGameState::Area::e_jetskibuildExited;
TransitionManager()->StartTransition(MxTransitionManager::TransitionType::e_mosaic, 50, FALSE, FALSE);
break;
case RaceCar_Actor:
m_destLocation = LegoGameState::Area::e_unk20;
m_destLocation = LegoGameState::Area::e_racecarbuildExited;
TransitionManager()->StartTransition(MxTransitionManager::TransitionType::e_mosaic, 50, FALSE, FALSE);
}
}
@ -815,46 +817,46 @@ undefined4 LegoCarBuild::FUN_10024480(MxActionNotificationParam* p_param)
// FUNCTION: LEGO1 0x100244e0
// FUNCTION: BETA10 0x1006cfb6
undefined4 LegoCarBuild::FUN_100244e0(MxLong p_x, MxLong p_y)
undefined4 LegoCarBuild::SelectPartFromMousePosition(MxLong p_x, MxLong p_y)
{
m_unk0x250[0] = p_x;
m_unk0x250[1] = p_y;
LegoROI* roi = PickROI(p_x, p_y);
if (!roi || !m_unk0x258->StringEndsOnYOrN(roi->GetName())) {
if (!roi || !m_animPresenter->StringEndsOnYOrN(roi->GetName())) {
return 0;
}
if (m_unk0x110 != roi) {
if (m_selectedPart != roi) {
FUN_10022f30();
m_unk0x110 = roi;
m_selectedPart = roi;
FUN_10024f70(TRUE);
FUN_100250e0(TRUE);
}
if (m_unk0x100 == 5 && m_unk0x258->PartIsPlaced(m_unk0x110->GetName())) {
m_unk0x2d4 = TRUE;
if (m_unk0x100 == 5 && m_animPresenter->PartIsPlaced(m_selectedPart->GetName())) {
m_selectedPartIsPlaced = TRUE;
}
else {
m_unk0x2d4 = FALSE;
m_selectedPartIsPlaced = FALSE;
}
FUN_10025450();
VTable0x70();
if (m_unk0x258->PartIsPlaced(m_unk0x110->GetName())) {
if (m_animPresenter->PartIsPlaced(m_selectedPart->GetName())) {
if (m_unk0x100 != 5) {
m_unk0x250[0] += m_unk0x290[0] - m_unk0x298[0];
m_unk0x250[1] += m_unk0x290[1] - m_unk0x298[1];
}
if (m_unk0x100 == 0) {
m_unk0x114 = m_unk0x110->GetWorldBoundingSphere();
m_unk0x114 = m_selectedPart->GetWorldBoundingSphere();
}
}
else {
if (m_unk0x258->FUN_10079c30(m_unk0x110->GetName())) {
m_unk0x114 = m_unk0x258->FUN_10079e20();
if (m_animPresenter->FUN_10079c30(m_selectedPart->GetName())) {
m_unk0x114 = m_animPresenter->FUN_10079e20();
}
}
@ -870,53 +872,57 @@ undefined4 LegoCarBuild::FUN_100244e0(MxLong p_x, MxLong p_y)
m_GetBrick_Sound->Enable(FALSE);
m_GetBrick_Sound->Enable(TRUE);
m_unk0x258->SetUnknown0xbc(0);
m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_selected);
return 1;
}
// FUNCTION: LEGO1 0x100246e0
// FUNCTION: BETA10 0x1006d25a
undefined4 LegoCarBuild::FUN_100246e0(MxLong p_x, MxLong p_y)
{
undefined4 result = 0;
switch (m_unk0x100) {
case 3:
FUN_10022f30();
return 1;
result = 1;
break;
case 4:
FUN_10022f00();
return 1;
result = 1;
break;
case 6:
if (m_unk0x258->PartIsPlaced(m_unk0x110->GetName())) {
if (SpheresIntersect(m_unk0x114, m_unk0x110->GetWorldBoundingSphere())) {
FUN_10024f70(FALSE);
FUN_100250e0(FALSE);
m_unk0x100 = 0;
m_unk0x110 = NULL;
if (m_animPresenter->PartIsPlaced(m_selectedPart->GetName()) &&
SpheresIntersect(m_unk0x114, m_selectedPart->GetWorldBoundingSphere())) {
FUN_10024f70(FALSE);
FUN_100250e0(FALSE);
m_unk0x100 = 0;
m_selectedPart = NULL;
m_PlaceBrick_Sound->Enable(FALSE);
m_PlaceBrick_Sound->Enable(TRUE);
m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_stopped);
}
else if (m_animPresenter->FUN_10079c30(m_selectedPart->GetName())) {
if (SpheresIntersect(m_unk0x114, m_selectedPart->GetWorldBoundingSphere())) {
m_PlaceBrick_Sound->Enable(FALSE);
m_PlaceBrick_Sound->Enable(TRUE);
m_unk0x258->SetUnknown0xbc(1);
return 1;
AddSelectedPartToBuild();
}
else {
VTable0x6c();
m_unk0x100 = 5;
}
}
if (m_unk0x258->FUN_10079c30(m_unk0x110->GetName())) {
if (SpheresIntersect(m_unk0x114, m_unk0x110->GetWorldBoundingSphere())) {
m_PlaceBrick_Sound->Enable(FALSE);
m_PlaceBrick_Sound->Enable(TRUE);
FUN_100236d0();
return 1;
}
else {
VTable0x6c();
m_unk0x100 = 5;
return 1;
}
VTable0x6c();
m_unk0x100 = 5;
return 1;
default:
return 0;
result = 1;
break;
}
return result;
}
// FUNCTION: LEGO1 0x10024850
@ -959,7 +965,7 @@ undefined4 LegoCarBuild::FUN_10024890(MxParam* p_param)
DeleteObjects(&m_atomId, 500, 510);
}
m_unk0x258->SetUnknown0xbc(0);
m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_selected);
m_destLocation = LegoGameState::e_infomain;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
result = 1;
@ -973,12 +979,12 @@ undefined4 LegoCarBuild::FUN_10024890(MxParam* p_param)
DeleteObjects(&m_atomId, 500, 510);
}
m_unk0x258->SetUnknown0xbc(0);
m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_selected);
if (GameState()->GetCurrentAct() == LegoGameState::e_act2) {
FUN_100243a0();
}
else if (m_unk0x258->AllPartsPlaced() || m_buildState->m_unk0x4d) {
else if (m_animPresenter->AllPartsPlaced() || m_buildState->m_unk0x4d) {
m_buildState->m_unk0x4d = TRUE;
InvokeAction(Extra::e_start, m_atomId, m_carId, NULL);
@ -1015,7 +1021,7 @@ undefined4 LegoCarBuild::FUN_10024890(MxParam* p_param)
(m_Decals_Ctl5 && m_Decals_Ctl5->GetAction()->GetObjectId() == param->m_clickedObjectId) ||
(m_Decals_Ctl6 && m_Decals_Ctl6->GetAction()->GetObjectId() == param->m_clickedObjectId) ||
(m_Decals_Ctl7 && m_Decals_Ctl7->GetAction()->GetObjectId() == param->m_clickedObjectId)) {
m_unk0x258->SetPartObjectIdByName(m_unk0x110->GetName(), param->m_clickedObjectId);
m_animPresenter->SetPartObjectIdByName(m_selectedPart->GetName(), param->m_clickedObjectId);
m_Decal_Sound->Enable(FALSE);
m_Decal_Sound->Enable(TRUE);
}
@ -1048,16 +1054,16 @@ undefined4 LegoCarBuild::FUN_10024890(MxParam* p_param)
if (param->m_unk0x28) {
switch (param->m_clickedObjectId) {
case CopterScript::c_Info_Ctl:
m_unk0x258->SetUnknown0xbc(0);
m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_selected);
m_destLocation = LegoGameState::e_infomain;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
result = 1;
break;
case CopterScript::c_Exit_Ctl:
if (m_buildState->m_animationState != LegoVehicleBuildState::e_exiting) {
m_unk0x258->SetUnknown0xbc(0);
m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_selected);
if (m_unk0x258->AllPartsPlaced() || m_buildState->m_unk0x4d) {
if (m_animPresenter->AllPartsPlaced() || m_buildState->m_unk0x4d) {
m_buildState->m_unk0x4d = TRUE;
// GameState()->GetCurrentAct() returns an MxS16 in BETA10
@ -1119,7 +1125,7 @@ undefined4 LegoCarBuild::FUN_10024890(MxParam* p_param)
(m_Decals_Ctl5 && m_Decals_Ctl5->GetAction()->GetObjectId() == param->m_clickedObjectId) ||
(m_Decals_Ctl6 && m_Decals_Ctl6->GetAction()->GetObjectId() == param->m_clickedObjectId) ||
(m_Decals_Ctl7 && m_Decals_Ctl7->GetAction()->GetObjectId() == param->m_clickedObjectId)) {
m_unk0x258->SetPartObjectIdByName(m_unk0x110->GetName(), param->m_clickedObjectId);
m_animPresenter->SetPartObjectIdByName(m_selectedPart->GetName(), param->m_clickedObjectId);
m_Decal_Sound->Enable(FALSE);
m_Decal_Sound->Enable(TRUE);
}
@ -1141,7 +1147,7 @@ undefined4 LegoCarBuild::FUN_10024890(MxParam* p_param)
// FUNCTION: LEGO1 0x10024c20
// FUNCTION: BETA10 0x1006db21
undefined4 LegoCarBuild::FUN_10024c20(LegoEventNotificationParam* p_param)
undefined4 LegoCarBuild::FUN_10024c20(MxNotificationParam* p_param)
{
LegoEntity* entity;
assert(m_buildState);
@ -1196,7 +1202,7 @@ undefined4 LegoCarBuild::FUN_10024c20(LegoEventNotificationParam* p_param)
assert(destWorld);
m_buildState->m_animationState = LegoVehicleBuildState::e_exiting;
if (!m_unk0x258->AllPartsPlaced()) {
if (!m_animPresenter->AllPartsPlaced()) {
FUN_100243a0();
}
else {
@ -1227,7 +1233,7 @@ undefined4 LegoCarBuild::FUN_10024c20(LegoEventNotificationParam* p_param)
m_unk0x338 = SoundManager()->FUN_100aebd0(*g_jukeboxScript, jukeboxScript);
if (m_unk0x338) {
BackgroundAudioManager()->FUN_1007f610(m_unk0x338, 5, MxPresenter::e_repeating);
BackgroundAudioManager()->SetPendingPresenter(m_unk0x338, 5, MxPresenter::e_repeating);
FUN_10024ef0();
}
else {
@ -1243,7 +1249,7 @@ undefined4 LegoCarBuild::FUN_10024c20(LegoEventNotificationParam* p_param)
// FUNCTION: LEGO1 0x10024ef0
void LegoCarBuild::FUN_10024ef0()
{
FUN_1003eda0();
ResetViewVelocity();
m_buildState->m_animationState = LegoVehicleBuildState::e_cutscene;
FUN_10025720(FUN_10025d70());
m_buildState->m_unk0x4c += 1;
@ -1255,22 +1261,22 @@ void LegoCarBuild::FUN_10024ef0()
void LegoCarBuild::FUN_10024f30()
{
FUN_10022f30();
m_unk0x258->SetUnknown0xbc(2);
m_animPresenter->SetShelfState(LegoCarBuildAnimPresenter::e_moving);
}
// FUNCTION: LEGO1 0x10024f50
// FUNCTION: BETA10 0x1006dfce
void LegoCarBuild::FUN_10024f50()
{
m_unk0x2d4 = FALSE;
m_unk0x258->RotateAroundYAxis(g_rotationAngleStepYAxis);
m_selectedPartIsPlaced = FALSE;
m_animPresenter->RotateAroundYAxis(g_rotationAngleStepYAxis);
}
// FUNCTION: LEGO1 0x10024f70
// FUNCTION: BETA10 0x1006e002
void LegoCarBuild::FUN_10024f70(MxBool p_enabled)
{
if (m_unk0x258->StringEndsOnY(m_unk0x110->GetName())) {
if (m_animPresenter->StringEndsOnY(m_selectedPart->GetName())) {
SetPresentersEnabled(p_enabled);
}
}
@ -1305,31 +1311,31 @@ void LegoCarBuild::TogglePresentersEnabled()
// FUNCTION: BETA10 0x1006e124
void LegoCarBuild::FUN_100250e0(MxBool p_enabled)
{
if (m_unk0x258->StringDoesNotEndOnZero(m_unk0x110->GetName()) && m_Decals_Ctl) {
if (strnicmp(m_unk0x110->GetName(), "JSFRNT", strlen("JSFRNT")) == 0) {
if (m_animPresenter->StringDoesNotEndOnZero(m_selectedPart->GetName()) && m_Decals_Ctl) {
if (strnicmp(m_selectedPart->GetName(), "JSFRNT", strlen("JSFRNT")) == 0) {
m_Decal_Bitmap->Enable(p_enabled);
m_Decals_Ctl->Enable(p_enabled);
m_Decals_Ctl1->Enable(p_enabled);
m_Decals_Ctl2->Enable(p_enabled);
m_Decals_Ctl3->Enable(p_enabled);
}
else if (strnicmp(m_unk0x110->GetName(), "JSWNSH", strlen("JSWNSH")) == 0) {
else if (strnicmp(m_selectedPart->GetName(), "JSWNSH", strlen("JSWNSH")) == 0) {
m_Decal_Bitmap->Enable(p_enabled);
m_Decals_Ctl4->Enable(p_enabled);
m_Decals_Ctl5->Enable(p_enabled);
m_Decals_Ctl6->Enable(p_enabled);
m_Decals_Ctl7->Enable(p_enabled);
}
else if (strnicmp(m_unk0x110->GetName(), "RCBACK", strlen("RCBACK")) == 0) {
else if (strnicmp(m_selectedPart->GetName(), "RCBACK", strlen("RCBACK")) == 0) {
m_Decals_Ctl1->Enable(p_enabled);
}
else if (strnicmp(m_unk0x110->GetName(), "RCTAIL", strlen("RCTAIL")) == 0) {
else if (strnicmp(m_selectedPart->GetName(), "RCTAIL", strlen("RCTAIL")) == 0) {
m_Decals_Ctl2->Enable(p_enabled);
}
else if (m_Decals_Ctl1 && strnicmp(m_unk0x110->GetName(), "chljety", strlen("chljety")) == 0) {
else if (m_Decals_Ctl1 && strnicmp(m_selectedPart->GetName(), "chljety", strlen("chljety")) == 0) {
m_Decals_Ctl1->Enable(p_enabled);
}
else if (m_Decals_Ctl2 && strnicmp(m_unk0x110->GetName(), "chrjety", strlen("chrjety")) == 0) {
else if (m_Decals_Ctl2 && strnicmp(m_selectedPart->GetName(), "chrjety", strlen("chrjety")) == 0) {
m_Decals_Ctl2->Enable(p_enabled);
}
else if (m_Decals_Ctl) {
@ -1345,7 +1351,7 @@ void LegoCarBuild::FUN_10025350(MxS32 p_objectId)
const LegoChar* color;
LegoChar buffer[256];
if (!m_unk0x110) {
if (!m_selectedPart) {
return;
}
@ -1373,8 +1379,8 @@ void LegoCarBuild::FUN_10025350(MxS32 p_objectId)
m_Paint_Sound->Enable(FALSE);
m_Paint_Sound->Enable(TRUE);
m_unk0x110->FUN_100a93b0(color);
sprintf(buffer, "c_%s", m_unk0x110->GetName());
m_selectedPart->FUN_100a93b0(color);
sprintf(buffer, "c_%s", m_selectedPart->GetName());
VariableTable()->SetVariable(buffer, color);
}
@ -1382,11 +1388,11 @@ void LegoCarBuild::FUN_10025350(MxS32 p_objectId)
// FUNCTION: BETA10 0x1006e599
void LegoCarBuild::FUN_10025450()
{
m_unk0x12c = m_unk0x110->GetLocal2World();
m_unk0x12c = m_selectedPart->GetLocal2World();
m_unk0x1c0 = m_unk0x12c;
Vector3 lastColumnOfUnk0x1c0(m_unk0x1c0[3]);
lastColumnOfUnk0x1c0 = Vector3(m_unk0x258->GetUnknown0xe0()[3]);
lastColumnOfUnk0x1c0 = Vector3(m_animPresenter->GetBuildViewMatrix()[3]);
// This looks odd, but it improves the LEGO1 match while breaking the BETA10 match.
// I don't know whether this is due to compiler entropy.
@ -1395,10 +1401,10 @@ void LegoCarBuild::FUN_10025450()
MxMatrix* unk0x178 = &m_unk0x178;
*unk0x178 = m_unk0x12c;
if (m_unk0x258->PartIsPlaced(m_unk0x110->GetName())) {
m_unk0x2a4 = Vector4(m_unk0x110->GetWorldPosition());
if (m_animPresenter->PartIsPlaced(m_selectedPart->GetName())) {
m_unk0x2a4 = Vector4(m_selectedPart->GetWorldPosition());
if (!m_unk0x2d4) {
if (!m_selectedPartIsPlaced) {
m_unk0x2bc = m_unk0x2a4;
m_unk0x208 = m_unk0x12c;
@ -1412,17 +1418,17 @@ void LegoCarBuild::FUN_10025450()
else {
const LegoChar* wiredName;
if (!m_unk0x258->FUN_10079c30(m_unk0x110->GetName())) {
wiredName = m_unk0x258->GetWiredNameByPartName(m_unk0x110->GetName());
if (!m_animPresenter->FUN_10079c30(m_selectedPart->GetName())) {
wiredName = m_animPresenter->GetWiredNameByPartName(m_selectedPart->GetName());
}
else {
wiredName = m_unk0x258->GetWiredNameOfLastPlacedPart();
wiredName = m_animPresenter->GetWiredNameOfLastPlacedPart();
}
LegoROI* parentROI = (LegoROI*) m_unk0x110->GetParentROI();
LegoROI* parentROI = (LegoROI*) m_selectedPart->GetParentROI();
m_unk0x208 = parentROI->FindChildROI(wiredName, parentROI)->GetLocal2World();
m_unk0x2bc = Vector4(parentROI->FindChildROI(wiredName, parentROI)->GetWorldPosition());
m_unk0x2a4 = Vector4(m_unk0x110->GetWorldPosition());
m_unk0x2a4 = Vector4(m_selectedPart->GetWorldPosition());
m_unk0x2a4[2] += (m_unk0x1c0[3][2] - m_unk0x12c[3][2]);
m_unk0x178[3][2] = m_unk0x1c0[3][2];
@ -1644,8 +1650,8 @@ void LegoCarBuild::FUN_10025db0(const char* p_param1, undefined4 p_param2)
}
}
else {
if (m_unk0x33c->GetUnknown0x4e() != sVar3) {
m_unk0x33c->VTable0x6c(sVar3);
if (m_unk0x33c->GetEnabledChild() != sVar3) {
m_unk0x33c->UpdateEnabledChild(sVar3);
}
g_unk0x100f11cc = -1;
@ -1658,7 +1664,7 @@ void LegoCarBuild::FUN_10025e40()
{
SetPresentersEnabled(m_presentersEnabled);
if (m_unk0x33c && m_Yellow_Ctl != m_unk0x33c) {
m_unk0x33c->VTable0x6c(0);
m_unk0x33c->UpdateEnabledChild(0);
}
}

View File

@ -23,17 +23,17 @@ DECOMP_SIZE_ASSERT(LegoCarBuildAnimPresenter, 0x150)
// FUNCTION: BETA10 0x100707c0
LegoCarBuildAnimPresenter::LegoCarBuildAnimPresenter()
{
m_unk0xbc = 0;
m_shelfState = e_selected;
m_numberOfParts = 0;
m_placedPartCount = 0;
m_parts = NULL;
m_unk0xc4 = NULL;
m_unk0x130 = 0;
m_unk0x12c = 0;
m_unk0x134 = 0;
m_unk0x138 = 0;
m_platformAnimNodeData = NULL;
m_shelfFrame = 0;
m_shelfFrameBuffer = 0;
m_shelfFrameMax = 0;
m_shelfFrameInterval = 0;
m_unk0x13c = 0;
m_unk0x140 = NULL;
m_carBuildEntity = NULL;
m_unk0x144 = -1;
m_unk0x148 = -1;
m_mainSourceId = NULL;
@ -45,14 +45,14 @@ LegoCarBuildAnimPresenter::~LegoCarBuildAnimPresenter()
{
if (m_parts) {
for (MxS16 i = 0; i < m_numberOfParts; i++) {
delete m_parts[i].m_name;
delete m_parts[i].m_wiredName;
delete[] m_parts[i].m_name;
delete[] m_parts[i].m_wiredName;
}
delete[] m_parts;
}
m_unk0xc8.GetRoot()->SetNumChildren(0);
*m_unk0xc8.GetRoot()->GetChildren() = NULL;
m_platformAnim.GetRoot()->SetNumChildren(0);
*m_platformAnim.GetRoot()->GetChildren() = NULL;
if (m_mainSourceId) {
delete[] m_mainSourceId;
@ -114,14 +114,14 @@ inline void LegoCarBuildAnimPresenter::Beta10Inline0x100733d0()
// FUNCTION: BETA10 0x10070ab1
void LegoCarBuildAnimPresenter::PutFrame()
{
switch (m_unk0xbc) {
case 0:
switch (m_shelfState) {
case e_selected:
break;
case 2:
FUN_10079a90();
case 1:
if (m_unk0x140->GetROI()) {
FUN_1006b9a0(m_anim, m_unk0x12c, NULL);
case e_moving:
MoveShelfForward();
case e_stopped:
if (m_carBuildEntity->GetROI()) {
FUN_1006b9a0(m_anim, m_shelfFrameBuffer, NULL);
}
default:
break;
@ -150,24 +150,24 @@ void LegoCarBuildAnimPresenter::ReadyTickle()
#endif
}
m_unk0x140 = (LegoEntity*) m_currentWorld->Find("MxEntity", "Dunebld");
m_carBuildEntity = (LegoEntity*) m_currentWorld->Find("MxEntity", "Dunebld");
if (!m_unk0x140) {
m_unk0x140 = (LegoEntity*) m_currentWorld->Find("MxEntity", "Chptrbld");
if (!m_carBuildEntity) {
m_carBuildEntity = (LegoEntity*) m_currentWorld->Find("MxEntity", "Chptrbld");
}
if (!m_unk0x140) {
m_unk0x140 = (LegoEntity*) m_currentWorld->Find("MxEntity", "Jetbld");
if (!m_carBuildEntity) {
m_carBuildEntity = (LegoEntity*) m_currentWorld->Find("MxEntity", "Jetbld");
}
if (!m_unk0x140) {
m_unk0x140 = (LegoEntity*) m_currentWorld->Find("MxEntity", "bldrace");
if (!m_carBuildEntity) {
m_carBuildEntity = (LegoEntity*) m_currentWorld->Find("MxEntity", "bldrace");
}
if (m_unk0x140) {
((LegoCarBuild*) m_currentWorld)->SetUnknown0x258(this);
if (m_carBuildEntity) {
((LegoCarBuild*) m_currentWorld)->SetCarBuildAnimPresenter(this);
m_placedPartCount = ((LegoCarBuild*) m_currentWorld)->GetPlacedPartCount();
SetUnknown0xbc(1);
SetShelfState(e_stopped);
m_previousTickleStates |= 1 << m_currentTickleState;
m_currentTickleState = e_starting;
m_compositePresenter->SendToCompositePresenter(Lego());
@ -182,7 +182,7 @@ void LegoCarBuildAnimPresenter::ReadyTickle()
// FUNCTION: BETA10 0x10070cdd
void LegoCarBuildAnimPresenter::StreamingTickle()
{
if (!m_unk0x140->GetROI()) {
if (!m_carBuildEntity->GetROI()) {
return;
}
@ -192,7 +192,7 @@ void LegoCarBuildAnimPresenter::StreamingTickle()
strcpy(m_mainSourceId, m_action->GetAtomId().GetInternal());
m_mainSourceId[strlen(m_mainSourceId) - 1] = 'M';
FUN_10079160();
InitBuildPlatform();
if (GameState()->GetCurrentAct() == LegoGameState::e_act2) {
m_placedPartCount = 10;
@ -202,15 +202,15 @@ void LegoCarBuildAnimPresenter::StreamingTickle()
for (i = 0; i < m_numberOfParts; i++) {
if (m_placedPartCount == i) {
FUN_10079680(m_parts[i].m_wiredName);
ShowBuildPartByName(m_parts[i].m_wiredName);
}
else {
FUN_100795d0(m_parts[i].m_wiredName);
HideBuildPartByName(m_parts[i].m_wiredName);
}
if (i < m_placedPartCount) {
FUN_10079050(i);
FUN_10079680(m_parts[i].m_name);
ShowBuildPartByName(m_parts[i].m_name);
}
LegoChar* name = m_parts[i].m_wiredName;
@ -220,8 +220,8 @@ void LegoCarBuildAnimPresenter::StreamingTickle()
LegoROI* roi = m_roiMap[j];
if (roi && roi->GetName() && (strcmpi(name, roi->GetName()) == 0)) {
roi->FUN_100a9dd0();
roi->FUN_100a9350("lego red");
roi->ClearMeshOffset();
roi->SetLodColor("lego red");
}
}
}
@ -232,7 +232,7 @@ void LegoCarBuildAnimPresenter::StreamingTickle()
Lego3DView* lego3dview = videoManager->Get3DManager()->GetLego3DView();
LegoROI* videoManagerROI = videoManager->GetViewROI();
LegoROI* local60 = m_unk0x140->GetROI();
LegoROI* local60 = m_carBuildEntity->GetROI();
LegoROI* camera = NULL;
MxFloat fov;
@ -267,11 +267,11 @@ void LegoCarBuildAnimPresenter::StreamingTickle()
CalcLocalTransform(cameraPosition, dirVec, upVec, localTransform);
videoManagerROI->WrappedSetLocalTransform(localTransform);
videoManagerROI->WrappedSetLocal2WorldWithWorldDataUpdate(localTransform);
lego3dview->Moved(*videoManagerROI);
videoManager->Get3DManager()->SetFrustrum(fov, 0.1, 250.0);
m_unk0xe0 = local60->FindChildROI("VIEW", local60)->GetLocal2World();
m_buildViewMatrix = local60->FindChildROI("VIEW", local60)->GetLocal2World();
m_previousTickleStates |= 1 << m_currentTickleState;
m_currentTickleState = e_repeating;
@ -284,7 +284,7 @@ void LegoCarBuildAnimPresenter::EndAction()
if (m_action) {
AUTOLOCK(m_criticalSection);
MxVideoPresenter::EndAction();
m_unk0xbc = 0;
m_shelfState = e_selected;
}
}
@ -294,7 +294,7 @@ MxResult LegoCarBuildAnimPresenter::Serialize(LegoStorage* p_storage)
{
if (p_storage->IsReadMode()) {
p_storage->ReadS16(m_placedPartCount);
p_storage->ReadFloat(m_unk0x130);
p_storage->ReadFloat(m_shelfFrame);
for (MxS16 i = 0; i < m_numberOfParts; i++) {
p_storage->ReadString(m_parts[i].m_name);
p_storage->ReadString(m_parts[i].m_wiredName);
@ -303,7 +303,7 @@ MxResult LegoCarBuildAnimPresenter::Serialize(LegoStorage* p_storage)
}
else if (p_storage->IsWriteMode()) {
p_storage->WriteS16(m_placedPartCount);
p_storage->WriteFloat(m_unk0x130);
p_storage->WriteFloat(m_shelfFrame);
for (MxS16 i = 0; i < m_numberOfParts; i++) {
p_storage->WriteString(m_parts[i].m_name);
p_storage->WriteString(m_parts[i].m_wiredName);
@ -319,7 +319,7 @@ MxResult LegoCarBuildAnimPresenter::Serialize(LegoStorage* p_storage)
void LegoCarBuildAnimPresenter::FUN_10079050(MxS16 p_index)
{
SwapNodesByName(m_parts[p_index].m_wiredName, m_parts[p_index].m_name);
FUN_100795d0(m_parts[p_index].m_wiredName);
HideBuildPartByName(m_parts[p_index].m_wiredName);
}
// FUNCTION: LEGO1 0x10079090
@ -336,15 +336,15 @@ void LegoCarBuildAnimPresenter::SwapNodesByName(LegoChar* p_name1, LegoChar* p_n
strcpy(node1->GetName(), node2->GetName());
strcpy(node2->GetName(), buffer);
LegoU16 val1 = node1->GetUnknown0x20();
node1->SetUnknown0x20(node2->GetUnknown0x20());
node2->SetUnknown0x20(val1);
LegoU16 val1 = node1->GetROIIndex();
node1->SetROIIndex(node2->GetROIIndex());
node2->SetROIIndex(val1);
}
}
// FUNCTION: LEGO1 0x10079160
// FUNCTION: BETA10 0x1007165d
void LegoCarBuildAnimPresenter::FUN_10079160()
void LegoCarBuildAnimPresenter::InitBuildPlatform()
{
LegoTreeNode* root;
LegoAnimNodeData* data2;
@ -355,16 +355,17 @@ void LegoCarBuildAnimPresenter::FUN_10079160()
LegoAnimNodeData* destData;
LegoTreeNode** children;
// Get Platform data, Shelf Frame data, and number of build parts
for (i = 0; i < totalNodes; i++) {
LegoAnimNodeData* data = (LegoAnimNodeData*) GetTreeNode(m_anim->GetRoot(), i)->GetData();
name = data->GetName();
if (StringEqualsPlatform(name)) {
m_unk0xc4 = data;
if (m_unk0xc4->GetNumRotationKeys() == 0) {
m_platformAnimNodeData = data;
if (m_platformAnimNodeData->GetNumRotationKeys() == 0) {
LegoRotationKey* key = new LegoRotationKey();
m_unk0xc4->SetNumRotationKeys(1);
m_unk0xc4->SetRotationKeys(key);
m_platformAnimNodeData->SetNumRotationKeys(1);
m_platformAnimNodeData->SetRotationKeys(key);
}
}
else {
@ -372,9 +373,9 @@ void LegoCarBuildAnimPresenter::FUN_10079160()
m_numberOfParts++;
}
else {
if (m_unk0x134 == 0.0f && StringEqualsShelf(name)) {
m_unk0x134 = m_anim->GetDuration();
m_unk0x138 = m_unk0x134 / (data->GetNumTranslationKeys() - 1);
if (m_shelfFrameMax == 0.0f && StringEqualsShelf(name)) {
m_shelfFrameMax = m_anim->GetDuration();
m_shelfFrameInterval = m_shelfFrameMax / (data->GetNumTranslationKeys() - 1);
}
}
}
@ -384,6 +385,7 @@ void LegoCarBuildAnimPresenter::FUN_10079160()
m_parts = new UnknownListEntry[m_numberOfParts];
assert(m_parts);
// Go through and add the wired name of each part
for (i = 0; i < totalNodes; i++) {
name = ((LegoAnimNodeData*) GetTreeNode(m_anim->GetRoot(), i)->GetData())->GetName();
@ -402,6 +404,7 @@ void LegoCarBuildAnimPresenter::FUN_10079160()
MxS16 counter = 0;
// Go through and add the normal name of each part
for (i = 0; i < totalNodes; i++) {
name = ((LegoAnimNodeData*) GetTreeNode(m_anim->GetRoot(), i)->GetData())->GetName();
if (StringEndsOnYOrN(name)) {
@ -420,6 +423,7 @@ void LegoCarBuildAnimPresenter::FUN_10079160()
}
}
// Set Platform root node
destNode = new LegoTreeNode();
assert(destNode);
destData = new LegoAnimNodeData();
@ -431,17 +435,17 @@ void LegoCarBuildAnimPresenter::FUN_10079160()
destData->SetName(data2->GetName());
destNode->SetNumChildren(1);
children = new LegoTreeNode*;
children = new LegoTreeNode*[1];
assert(children);
*children = FindNodeByName(m_anim->GetRoot(), "PLATFORM");
destNode->SetChildren(children);
m_unk0xc8.SetRoot(destNode);
m_platformAnim.SetRoot(destNode);
}
// FUNCTION: LEGO1 0x100795d0
// FUNCTION: BETA10 0x10071d96
void LegoCarBuildAnimPresenter::FUN_100795d0(LegoChar* p_param)
void LegoCarBuildAnimPresenter::HideBuildPartByName(LegoChar* p_param)
{
LegoAnimNodeData* data = FindNodeDataByName(m_anim->GetRoot(), p_param);
@ -452,18 +456,18 @@ void LegoCarBuildAnimPresenter::FUN_100795d0(LegoChar* p_param)
assert(newHideKey);
newHideKey->SetTime(0);
newHideKey->SetUnknown0x08(FALSE);
newHideKey->SetVisible(FALSE);
data->SetNumMorphKeys(1);
data->SetMorphKeys(newHideKey);
delete oldMorphKeys;
delete[] oldMorphKeys;
}
}
// FUNCTION: LEGO1 0x10079680
// FUNCTION: BETA10 0x10071ec5
void LegoCarBuildAnimPresenter::FUN_10079680(LegoChar* p_param)
void LegoCarBuildAnimPresenter::ShowBuildPartByName(LegoChar* p_param)
{
LegoAnimNodeData* data = FindNodeDataByName(m_anim->GetRoot(), p_param);
@ -473,7 +477,7 @@ void LegoCarBuildAnimPresenter::FUN_10079680(LegoChar* p_param)
data->SetNumMorphKeys(0);
data->SetMorphKeys(NULL);
delete oldMorphKeys;
delete[] oldMorphKeys;
}
}
@ -530,7 +534,7 @@ LegoTreeNode* LegoCarBuildAnimPresenter::FindNodeByName(LegoTreeNode* p_treeNode
// FUNCTION: LEGO1 0x10079790
// FUNCTION: BETA10 0x100720a3
void LegoCarBuildAnimPresenter::FUN_10079790(const LegoChar* p_name)
void LegoCarBuildAnimPresenter::AddPartToBuildByName(const LegoChar* p_name)
{
MxS16 i;
LegoChar buffer[40];
@ -553,7 +557,7 @@ void LegoCarBuildAnimPresenter::FUN_10079790(const LegoChar* p_name)
((LegoCarBuild*) m_currentWorld)->SetPlacedPartCount(m_placedPartCount);
if (m_placedPartCount < m_numberOfParts) {
FUN_10079680(m_parts[m_placedPartCount].m_wiredName);
ShowBuildPartByName(m_parts[m_placedPartCount].m_wiredName);
}
}
@ -561,8 +565,8 @@ void LegoCarBuildAnimPresenter::FUN_10079790(const LegoChar* p_name)
// FUNCTION: BETA10 0x1007225d
void LegoCarBuildAnimPresenter::RotateAroundYAxis(MxFloat p_angle)
{
if (m_unk0xc4) {
LegoRotationKey* rotationKey = m_unk0xc4->GetRotationKey(0);
if (m_platformAnimNodeData) {
LegoRotationKey* rotationKey = m_platformAnimNodeData->GetRotationKey(0);
Mx4DPointFloat
currentRotation(rotationKey->GetX(), rotationKey->GetY(), rotationKey->GetZ(), rotationKey->GetAngle());
@ -573,39 +577,39 @@ void LegoCarBuildAnimPresenter::RotateAroundYAxis(MxFloat p_angle)
newRotation.EqualsHamiltonProduct(currentRotation, additionalRotation);
if (newRotation[3] < 0.9999) {
rotationKey->FUN_100739a0(TRUE);
rotationKey->SetActive(TRUE);
}
else {
rotationKey->FUN_100739a0(FALSE);
rotationKey->SetActive(FALSE);
}
m_unk0xc4->GetRotationKey(0)->SetX(newRotation[0]);
m_unk0xc4->GetRotationKey(0)->SetY(newRotation[1]);
m_unk0xc4->GetRotationKey(0)->SetZ(newRotation[2]);
m_unk0xc4->GetRotationKey(0)->SetAngle(newRotation[3]);
m_platformAnimNodeData->GetRotationKey(0)->SetX(newRotation[0]);
m_platformAnimNodeData->GetRotationKey(0)->SetY(newRotation[1]);
m_platformAnimNodeData->GetRotationKey(0)->SetZ(newRotation[2]);
m_platformAnimNodeData->GetRotationKey(0)->SetAngle(newRotation[3]);
if (m_unk0x140->GetROI()) {
FUN_1006b9a0(&m_unk0xc8, m_unk0x12c, NULL);
if (m_carBuildEntity->GetROI()) {
FUN_1006b9a0(&m_platformAnim, m_shelfFrameBuffer, NULL);
}
}
}
// FUNCTION: LEGO1 0x10079a90
// FUNCTION: BETA10 0x10072412
void LegoCarBuildAnimPresenter::FUN_10079a90()
void LegoCarBuildAnimPresenter::MoveShelfForward()
{
if (m_unk0x12c >= m_unk0x134) {
m_unk0x130 = 0.0;
m_unk0x12c = m_unk0x130;
m_unk0xbc = 1;
if (m_shelfFrameBuffer >= m_shelfFrameMax) {
m_shelfFrame = 0.0;
m_shelfFrameBuffer = m_shelfFrame;
m_shelfState = e_stopped;
}
else if (m_unk0x12c >= m_unk0x138 + m_unk0x130) {
m_unk0x130 = m_unk0x138 + m_unk0x130;
m_unk0x12c = m_unk0x130;
m_unk0xbc = 1;
else if (m_shelfFrameBuffer >= m_shelfFrameInterval + m_shelfFrame) {
m_shelfFrame = m_shelfFrameInterval + m_shelfFrame;
m_shelfFrameBuffer = m_shelfFrame;
m_shelfState = e_stopped;
}
else {
m_unk0x12c = m_unk0x138 / 10.0f + m_unk0x12c;
m_shelfFrameBuffer = m_shelfFrameInterval / 10.0f + m_shelfFrameBuffer;
}
}
@ -706,6 +710,6 @@ void LegoCarBuildAnimPresenter::SetPartObjectIdByName(const LegoChar* p_name, Mx
// FUNCTION: BETA10 0x10072959
const BoundingSphere& LegoCarBuildAnimPresenter::FUN_10079e20()
{
LegoROI* roi = m_unk0x140->GetROI();
LegoROI* roi = m_carBuildEntity->GetROI();
return roi->FindChildROI(m_parts[m_placedPartCount].m_wiredName, roi)->GetWorldBoundingSphere();
}

File diff suppressed because it is too large Load Diff

View File

@ -502,7 +502,7 @@ void LegoAnimationManager::Init()
m_unk0x1a = FALSE;
m_tranInfoList = NULL;
m_tranInfoList2 = NULL;
m_unk0x41c = g_legoAnimationManagerConfig <= 1 ? 10 : 20;
m_maxAllowedExtras = g_legoAnimationManagerConfig <= 1 ? 10 : 20;
MxS32 i;
for (i = 0; i < (MxS32) sizeOfArray(m_unk0x28); i++) {
@ -658,7 +658,7 @@ MxResult LegoAnimationManager::LoadWorldInfo(LegoOmni::World p_worldId)
}
MxU32 version;
if (storage.Read(&version, sizeof(version)) == FAILURE) {
if (storage.Read(&version, sizeof(MxU32)) == FAILURE) {
goto done;
}
@ -667,7 +667,7 @@ MxResult LegoAnimationManager::LoadWorldInfo(LegoOmni::World p_worldId)
goto done;
}
if (storage.Read(&m_animCount, sizeof(m_animCount)) == FAILURE) {
if (storage.Read(&m_animCount, sizeof(MxU16)) == FAILURE) {
goto done;
}
@ -679,7 +679,7 @@ MxResult LegoAnimationManager::LoadWorldInfo(LegoOmni::World p_worldId)
goto done;
}
m_anims[j].m_unk0x28 = GetCharacterIndex(m_anims[j].m_name + strlen(m_anims[j].m_name) - 2);
m_anims[j].m_characterIndex = GetCharacterIndex(m_anims[j].m_name + strlen(m_anims[j].m_name) - 2);
m_anims[j].m_unk0x29 = FALSE;
for (k = 0; k < 3; k++) {
@ -760,7 +760,7 @@ MxResult LegoAnimationManager::ReadAnimInfo(LegoStorage* p_storage, AnimInfo* p_
MxU8 length;
MxS32 i, j;
if (p_storage->Read(&length, sizeof(length)) == FAILURE) {
if (p_storage->Read(&length, sizeof(MxU8)) == FAILURE) {
goto done;
}
@ -770,33 +770,33 @@ MxResult LegoAnimationManager::ReadAnimInfo(LegoStorage* p_storage, AnimInfo* p_
}
p_info->m_name[length] = 0;
if (p_storage->Read(&p_info->m_objectId, sizeof(p_info->m_objectId)) == FAILURE) {
if (p_storage->Read(&p_info->m_objectId, sizeof(MxU32)) == FAILURE) {
goto done;
}
if (p_storage->Read(&p_info->m_location, sizeof(p_info->m_location)) == FAILURE) {
if (p_storage->Read(&p_info->m_location, sizeof(MxS16)) == FAILURE) {
goto done;
}
if (p_storage->Read(&p_info->m_unk0x0a, sizeof(p_info->m_unk0x0a)) == FAILURE) {
if (p_storage->Read(&p_info->m_unk0x0a, sizeof(MxU8)) == FAILURE) {
goto done;
}
if (p_storage->Read(&p_info->m_unk0x0b, sizeof(p_info->m_unk0x0b)) == FAILURE) {
if (p_storage->Read(&p_info->m_unk0x0b, sizeof(MxU8)) == FAILURE) {
goto done;
}
if (p_storage->Read(&p_info->m_unk0x0c, sizeof(p_info->m_unk0x0c)) == FAILURE) {
if (p_storage->Read(&p_info->m_unk0x0c, sizeof(MxU8)) == FAILURE) {
goto done;
}
if (p_storage->Read(&p_info->m_unk0x0d, sizeof(p_info->m_unk0x0d)) == FAILURE) {
if (p_storage->Read(&p_info->m_unk0x0d, sizeof(MxU8)) == FAILURE) {
goto done;
}
for (i = 0; i < (MxS32) sizeOfArray(p_info->m_unk0x10); i++) {
if (p_storage->Read(&p_info->m_unk0x10[i], sizeof(*p_info->m_unk0x10)) != SUCCESS) {
if (p_storage->Read(&p_info->m_unk0x10[i], sizeof(float)) != SUCCESS) {
goto done;
}
}
if (p_storage->Read(&p_info->m_modelCount, sizeof(p_info->m_modelCount)) == FAILURE) {
if (p_storage->Read(&p_info->m_modelCount, sizeof(MxU8)) == FAILURE) {
goto done;
}
@ -821,7 +821,7 @@ MxResult LegoAnimationManager::ReadModelInfo(LegoStorage* p_storage, ModelInfo*
MxResult result = FAILURE;
MxU8 length;
if (p_storage->Read(&length, 1) == FAILURE) {
if (p_storage->Read(&length, sizeof(MxU8)) == FAILURE) {
goto done;
}
@ -831,20 +831,20 @@ MxResult LegoAnimationManager::ReadModelInfo(LegoStorage* p_storage, ModelInfo*
}
p_info->m_name[length] = 0;
if (p_storage->Read(&p_info->m_unk0x04, sizeof(p_info->m_unk0x04)) == FAILURE) {
if (p_storage->Read(&p_info->m_unk0x04, sizeof(MxU8)) == FAILURE) {
goto done;
}
if (p_storage->Read(p_info->m_location, sizeof(p_info->m_location)) != SUCCESS) {
if (p_storage->Read(p_info->m_location, 3 * sizeof(float)) != SUCCESS) {
goto done;
}
if (p_storage->Read(p_info->m_direction, sizeof(p_info->m_direction)) != SUCCESS) {
if (p_storage->Read(p_info->m_direction, 3 * sizeof(float)) != SUCCESS) {
goto done;
}
if (p_storage->Read(p_info->m_up, sizeof(p_info->m_up)) != SUCCESS) {
if (p_storage->Read(p_info->m_up, 3 * sizeof(float)) != SUCCESS) {
goto done;
}
if (p_storage->Read(&p_info->m_unk0x2c, sizeof(p_info->m_unk0x2c)) == FAILURE) {
if (p_storage->Read(&p_info->m_unk0x2c, sizeof(MxU8)) == FAILURE) {
goto done;
}
@ -861,18 +861,18 @@ void LegoAnimationManager::DeleteAnimations()
if (m_anims != NULL) {
for (MxS32 i = 0; i < m_animCount; i++) {
delete m_anims[i].m_name;
delete[] m_anims[i].m_name;
if (m_anims[i].m_models != NULL) {
for (MxS32 j = 0; j < m_anims[i].m_modelCount; j++) {
delete m_anims[i].m_models[j].m_name;
delete[] m_anims[i].m_models[j].m_name;
}
delete m_anims[i].m_models;
delete[] m_anims[i].m_models;
}
}
delete m_anims;
delete[] m_anims;
}
Init();
@ -1555,7 +1555,7 @@ MxResult LegoAnimationManager::Tickle()
return SUCCESS;
}
m_unk0x410 = (rand() * 10000 / SHRT_MAX) + 5000;
m_unk0x410 = (rand() * 10000 / RAND_MAX) + 5000;
m_unk0x408 = time;
if (time - m_unk0x404 > 10000) {
@ -1570,7 +1570,7 @@ MxResult LegoAnimationManager::Tickle()
if (elapsedSeconds > 0.2 && m_numAllowedExtras > 2) {
m_numAllowedExtras--;
}
else if (g_unk0x100f7500 < 0.16 && m_numAllowedExtras < m_unk0x41c) {
else if (g_unk0x100f7500 < 0.16 && m_numAllowedExtras < m_maxAllowedExtras) {
m_numAllowedExtras++;
}
}
@ -1615,7 +1615,8 @@ MxU16 LegoAnimationManager::FUN_10062110(
MxS8 index = GetCharacterIndex(p_roi->GetName());
for (MxU16 i = m_unk0x0e; i <= m_unk0x10; i++) {
if (m_anims[i].m_unk0x28 == index && m_anims[i].m_unk0x0c & p_unk0x0c && m_anims[i].m_unk0x29) {
if (m_anims[i].m_characterIndex == index && m_anims[i].m_unk0x0c & p_unk0x0c &&
m_anims[i].m_unk0x29) {
MxS32 vehicleId = g_characters[index].m_vehicleId;
if (vehicleId >= 0) {
MxBool found = FALSE;
@ -1636,7 +1637,7 @@ MxU16 LegoAnimationManager::FUN_10062110(
MxU16 unk0x22 = m_anims[i].m_unk0x22;
for (i = i + 1; i <= m_unk0x10; i++) {
if (m_anims[i].m_unk0x28 == index && m_anims[i].m_unk0x0c & p_unk0x0c &&
if (m_anims[i].m_characterIndex == index && m_anims[i].m_unk0x0c & p_unk0x0c &&
m_anims[i].m_unk0x29 && m_anims[i].m_unk0x22 < unk0x22) {
result = i;
unk0x22 = m_anims[i].m_unk0x22;
@ -2012,10 +2013,10 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und)
float speed;
if (m_extras[i].m_unk0x14) {
speed = ((float) (rand() * 1.5) / 32767.0f) + 0.9;
speed = ((float) (rand() * 1.5) / RAND_MAX) + 0.9;
}
else {
speed = ((float) (rand() * 1.4) / 32767.0f) + 0.6;
speed = ((float) (rand() * 1.4) / RAND_MAX) + 0.6;
}
actor->SetWorldSpeed(speed);
@ -2418,10 +2419,10 @@ void LegoAnimationManager::FUN_10063d10()
if (speed < 0.0f) {
if (m_extras[i].m_unk0x14) {
speed = ((float) (rand() * 1.5) / 32767.0f) + 0.9;
speed = ((float) (rand() * 1.5) / RAND_MAX) + 0.9;
}
else {
speed = ((float) (rand() * 1.4) / 32767.0f) + 0.6;
speed = ((float) (rand() * 1.4) / RAND_MAX) + 0.6;
}
}
@ -2463,7 +2464,7 @@ MxBool LegoAnimationManager::FUN_10063fb0(LegoLocation::Boundary* p_boundary, Le
if (p_boundary->m_name != NULL) {
Mx3DPointFloat vec;
LegoPathBoundary* boundary = p_world->FindPathBoundary(p_boundary->m_name);
LegoUnknown100db7f4* pSrcE = (LegoUnknown100db7f4*) boundary->GetEdges()[p_boundary->m_src];
LegoOrientedEdge* pSrcE = (LegoOrientedEdge*) boundary->GetEdges()[p_boundary->m_src];
return FUN_10064010(boundary, pSrcE, p_boundary->m_srcScale);
}
@ -2472,7 +2473,7 @@ MxBool LegoAnimationManager::FUN_10063fb0(LegoLocation::Boundary* p_boundary, Le
// FUNCTION: LEGO1 0x10064010
// FUNCTION: BETA10 0x100453a5
MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary* p_boundary, LegoUnknown100db7f4* p_edge, float p_destScale)
MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary* p_boundary, LegoOrientedEdge* p_edge, float p_destScale)
{
Mx3DPointFloat p1;
Vector3* v1 = p_edge->CWVertex(*p_boundary);
@ -2505,7 +2506,7 @@ MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary* p_boundary, LegoUnkn
MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, MxBool p_bool1, MxBool p_bool2)
{
MxU32 local2c = 12;
float destScale = ((rand() * 0.5) / 32767.0) + 0.25;
float destScale = ((rand() * 0.5) / RAND_MAX) + 0.25;
LegoPathActor* actor = UserActor();
if (actor == NULL) {
@ -2520,15 +2521,15 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx
Mx3DPointFloat direction = actor->GetWorldDirection();
float local4c = 0.0f;
LegoUnknown100db7f4* local50 = NULL;
LegoOrientedEdge* local50 = NULL;
LegoS32 numEdges = boundary->GetNumEdges();
Mx3DPointFloat vec;
LegoUnknown100db7f4* e;
LegoOrientedEdge* e;
MxS32 i;
for (i = 0; i < numEdges; i++) {
e = (LegoUnknown100db7f4*) boundary->GetEdges()[i];
e->FUN_1002ddc0(*boundary, vec);
e = (LegoOrientedEdge*) boundary->GetEdges()[i];
e->GetFaceNormal(*boundary, vec);
float dot = vec.Dot(direction, vec);
if (dot > local4c) {
@ -2539,7 +2540,7 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx
e = local50;
do {
e = (LegoUnknown100db7f4*) e->GetCounterclockwiseEdge(*boundary);
e = (LegoOrientedEdge*) e->GetCounterclockwiseEdge(*boundary);
if (e->GetMask0x03()) {
break;
}
@ -2549,8 +2550,8 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx
return FALSE;
}
LegoUnknown100db7f4* local34 = e;
LegoUnknown100db7f4* local8 = local50;
LegoOrientedEdge* local34 = e;
LegoOrientedEdge* local8 = local50;
while (local2c--) {
if (local34 != NULL) {
@ -2561,7 +2562,7 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx
numEdges = boundary->GetNumEdges();
for (i = 0; i < numEdges; i++) {
LegoUnknown100db7f4* e = (LegoUnknown100db7f4*) boundary->GetEdges()[i];
LegoOrientedEdge* e = (LegoOrientedEdge*) boundary->GetEdges()[i];
if (local34 == e) {
p_boundary->m_src = i;
@ -2580,10 +2581,10 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx
do {
if (p_bool1) {
local34 = (LegoUnknown100db7f4*) local34->GetCounterclockwiseEdge(*boundary);
local34 = (LegoOrientedEdge*) local34->GetCounterclockwiseEdge(*boundary);
}
else {
local34 = (LegoUnknown100db7f4*) local34->GetClockwiseEdge(*boundary);
local34 = (LegoOrientedEdge*) local34->GetClockwiseEdge(*boundary);
}
} while (!local34->GetMask0x03() && local34 != local50);
@ -2807,7 +2808,7 @@ void LegoAnimationManager::FUN_100648f0(LegoTranInfo* p_tranInfo, MxLong p_unk0x
Mx3DPointFloat vec;
vec.Clear();
viewROI->FUN_100a5a30(vec);
viewROI->SetWorldVelocity(vec);
}
}
@ -2840,7 +2841,7 @@ void LegoAnimationManager::FUN_10064b50(MxLong p_time)
LegoROI* viewROI = VideoManager()->GetViewROI();
viewROI->WrappedSetLocalTransform(mat);
viewROI->WrappedSetLocal2WorldWithWorldDataUpdate(mat);
VideoManager()->Get3DManager()->Moved(*viewROI);
SoundManager()->UpdateListener(
viewROI->GetWorldPosition(),

View File

@ -30,7 +30,7 @@ LegoAnimMMPresenter::LegoAnimMMPresenter()
m_unk0x59 = 0;
m_tranInfo = NULL;
m_unk0x54 = 0;
m_unk0x64 = NULL;
m_world = NULL;
m_unk0x68 = NULL;
m_roiMap = NULL;
m_roiMapSize = 0;
@ -44,7 +44,7 @@ LegoAnimMMPresenter::~LegoAnimMMPresenter()
VideoManager()->UnregisterPresenter(*this);
}
delete m_unk0x68;
delete[] m_unk0x68;
NotificationManager()->Unregister(this);
}
@ -101,9 +101,9 @@ MxResult LegoAnimMMPresenter::StartAction(MxStreamController* p_controller, MxDS
}
}
m_unk0x64 = CurrentWorld();
if (m_unk0x64) {
m_unk0x64->Add(this);
m_world = CurrentWorld();
if (m_world) {
m_world->Add(this);
}
VideoManager()->RegisterPresenter(*this);
@ -133,8 +133,8 @@ void LegoAnimMMPresenter::EndAction()
if (m_action != NULL) {
MxCompositePresenter::EndAction();
if (m_unk0x64 != NULL) {
m_unk0x64->Remove(this);
if (m_world != NULL) {
m_world->Remove(this);
}
}
}
@ -364,7 +364,7 @@ MxBool LegoAnimMMPresenter::FUN_1004b5b0(MxLong p_time)
LegoROI* roi = m_roiMap[i];
if (roi != NULL) {
roi->WrappedSetLocalTransform(m_unk0x68[i]);
roi->WrappedSetLocal2WorldWithWorldDataUpdate(m_unk0x68[i]);
}
}
}
@ -400,7 +400,7 @@ MxBool LegoAnimMMPresenter::FUN_1004b610(MxLong p_time)
}
}
m_action->SetUnknown90(Timer()->GetTime());
m_action->SetTimeStarted(Timer()->GetTime());
if (m_compositePresenter != NULL) {
m_compositePresenter->VTable0x60(this);
@ -429,11 +429,11 @@ MxBool LegoAnimMMPresenter::FUN_1004b6d0(MxLong p_time)
LegoPathActor* actor = UserActor();
if (m_tranInfo != NULL && m_tranInfo->m_unk0x14 && m_tranInfo->m_location != -1 && actor != NULL) {
if (m_unk0x64 != NULL) {
if (m_world != NULL) {
undefined4 und = 1;
if (m_presenter != NULL) {
m_unk0x64->RemoveActor(actor);
m_world->RemoveActor(actor);
if (m_tranInfo->m_unk0x29) {
Mx3DPointFloat position, direction;
@ -442,7 +442,7 @@ MxBool LegoAnimMMPresenter::FUN_1004b6d0(MxLong p_time)
direction = viewROI->GetWorldDirection();
position[1] -= 1.25;
und = m_unk0x64->PlaceActor(actor, m_presenter, position, direction);
und = m_world->PlaceActor(actor, m_presenter, position, direction);
}
else {
und = 0;
@ -450,9 +450,9 @@ MxBool LegoAnimMMPresenter::FUN_1004b6d0(MxLong p_time)
}
if (und != 0) {
viewROI->WrappedSetLocalTransform(m_tranInfo->m_unk0x2c);
viewROI->WrappedSetLocal2WorldWithWorldDataUpdate(m_tranInfo->m_unk0x2c);
VideoManager()->Get3DManager()->Moved(*viewROI);
m_unk0x64->PlaceActor(actor);
m_world->PlaceActor(actor);
}
if (m_tranInfo->m_unk0x29) {

View File

@ -199,10 +199,10 @@ LegoBuildingInfo g_buildingInfoInit[16] = {
MxU32 LegoBuildingManager::g_maxSound = 6;
// GLOBAL: LEGO1 0x100f373c
MxU32 g_unk0x100f373c = 0x3c;
MxU32 g_buildingSoundIdOffset = 0x3c;
// GLOBAL: LEGO1 0x100f3740
MxU32 g_unk0x100f3740 = 0x42;
MxU32 g_buildingSoundIdMoodOffset = 0x42;
// clang-format off
// GLOBAL: LEGO1 0x100f3788
@ -227,6 +227,8 @@ LegoBuildingInfo g_buildingInfo[16];
// GLOBAL: LEGO1 0x100f3748
MxS32 LegoBuildingManager::g_maxMove[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 3, 0};
#define HAUS1_INDEX 12
// FUNCTION: LEGO1 0x1002f8b0
void LegoBuildingManager::configureLegoBuildingManager(MxS32 p_buildingManagerConfig)
{
@ -253,10 +255,10 @@ void LegoBuildingManager::Init()
}
m_nextVariant = 0;
m_unk0x09 = FALSE;
m_boundariesDetermined = FALSE;
m_numEntries = 0;
m_sound = NULL;
m_unk0x28 = FALSE;
m_hideAfterAnimation = FALSE;
}
// FUNCTION: LEGO1 0x1002fa00
@ -274,7 +276,7 @@ void LegoBuildingManager::LoadWorldInfo()
LegoEntity* entity = (LegoEntity*) world->Find("MxEntity", g_buildingInfoVariants[0]);
if (entity) {
entity->GetROI()->SetVisibility(TRUE);
m_unk0x09 = FALSE;
m_boundariesDetermined = FALSE;
}
}
else {
@ -286,7 +288,7 @@ void LegoBuildingManager::LoadWorldInfo()
}
}
m_unk0x09 = FALSE;
m_boundariesDetermined = FALSE;
}
// FUNCTION: LEGO1 0x1002fa90
@ -301,7 +303,7 @@ void LegoBuildingManager::CreateBuilding(MxS32 p_index, LegoWorld* p_world)
LegoROI* roi = entity->GetROI();
AdjustHeight(p_index);
MxMatrix mat = roi->GetLocal2World();
mat[3][1] = g_buildingInfo[p_index].m_unk0x14;
mat[3][1] = g_buildingInfo[p_index].m_adjustedY;
roi->UpdateTransformationRelativeToParent(mat);
VideoManager()->Get3DManager()->Moved(*roi);
}
@ -316,7 +318,7 @@ void LegoBuildingManager::Reset()
g_buildingInfo[i].m_entity = NULL;
}
m_unk0x09 = FALSE;
m_boundariesDetermined = FALSE;
for (i = 0; i < m_numEntries; i++) {
delete m_entries[i];
@ -334,21 +336,21 @@ MxResult LegoBuildingManager::Write(LegoStorage* p_storage)
for (MxS32 i = 0; i < sizeOfArray(g_buildingInfo); i++) {
LegoBuildingInfo* info = &g_buildingInfo[i];
if (p_storage->Write(&info->m_sound, sizeof(info->m_sound)) != SUCCESS) {
if (p_storage->Write(&info->m_sound, sizeof(MxU32)) != SUCCESS) {
goto done;
}
if (p_storage->Write(&info->m_move, sizeof(info->m_move)) != SUCCESS) {
if (p_storage->Write(&info->m_move, sizeof(MxU32)) != SUCCESS) {
goto done;
}
if (p_storage->Write(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) {
if (p_storage->Write(&info->m_mood, sizeof(MxU8)) != SUCCESS) {
goto done;
}
if (p_storage->Write(&info->m_initialUnk0x11, sizeof(info->m_initialUnk0x11)) != SUCCESS) {
if (p_storage->Write(&info->m_initialCounter, sizeof(MxS8)) != SUCCESS) {
goto done;
}
}
if (p_storage->Write(&m_nextVariant, sizeof(m_nextVariant)) != SUCCESS) {
if (p_storage->Write(&m_nextVariant, sizeof(MxU8)) != SUCCESS) {
goto done;
}
@ -367,20 +369,20 @@ MxResult LegoBuildingManager::Read(LegoStorage* p_storage)
for (MxS32 i = 0; i < sizeOfArray(g_buildingInfo); i++) {
LegoBuildingInfo* info = &g_buildingInfo[i];
if (p_storage->Read(&info->m_sound, sizeof(info->m_sound)) != SUCCESS) {
if (p_storage->Read(&info->m_sound, sizeof(MxU32)) != SUCCESS) {
goto done;
}
if (p_storage->Read(&info->m_move, sizeof(info->m_move)) != SUCCESS) {
if (p_storage->Read(&info->m_move, sizeof(MxU32)) != SUCCESS) {
goto done;
}
if (p_storage->Read(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) {
if (p_storage->Read(&info->m_mood, sizeof(MxU8)) != SUCCESS) {
goto done;
}
if (p_storage->Read(&info->m_unk0x11, sizeof(info->m_unk0x11)) != SUCCESS) {
if (p_storage->Read(&info->m_counter, sizeof(MxS8)) != SUCCESS) {
goto done;
}
info->m_initialUnk0x11 = info->m_unk0x11;
info->m_initialCounter = info->m_counter;
AdjustHeight(i);
}
@ -402,15 +404,15 @@ MxResult LegoBuildingManager::Read(LegoStorage* p_storage)
// FUNCTION: BETA10 0x10063f1a
void LegoBuildingManager::AdjustHeight(MxS32 p_index)
{
if (g_buildingInfo[p_index].m_unk0x11 > 0) {
float value = g_buildingInfoDownshift[p_index] - g_buildingInfo[p_index].m_unk0x11;
g_buildingInfo[p_index].m_unk0x14 =
g_buildingInfoInit[p_index].m_unk0x14 - value * g_buildingInfoDownshiftScale[p_index];
if (g_buildingInfo[p_index].m_counter > 0) {
float value = g_buildingInfoDownshift[p_index] - g_buildingInfo[p_index].m_counter;
g_buildingInfo[p_index].m_adjustedY =
g_buildingInfoInit[p_index].m_adjustedY - value * g_buildingInfoDownshiftScale[p_index];
}
else if (g_buildingInfo[p_index].m_unk0x11 == 0) {
float value = g_buildingInfoDownshift[p_index] - g_buildingInfo[p_index].m_unk0x11;
g_buildingInfo[p_index].m_unk0x14 =
g_buildingInfoInit[p_index].m_unk0x14 - value * g_buildingInfoDownshiftScale[p_index];
else if (g_buildingInfo[p_index].m_counter == 0) {
float value = g_buildingInfoDownshift[p_index] - g_buildingInfo[p_index].m_counter;
g_buildingInfo[p_index].m_adjustedY =
g_buildingInfoInit[p_index].m_adjustedY - value * g_buildingInfoDownshiftScale[p_index];
if (g_buildingInfo[p_index].m_entity != NULL) {
LegoROI* roi = g_buildingInfo[p_index].m_entity->GetROI();
@ -420,7 +422,7 @@ void LegoBuildingManager::AdjustHeight(MxS32 p_index)
}
}
else {
g_buildingInfo[p_index].m_unk0x14 = g_buildingInfoInit[p_index].m_unk0x14;
g_buildingInfo[p_index].m_adjustedY = g_buildingInfoInit[p_index].m_adjustedY;
}
}
@ -453,7 +455,7 @@ MxBool LegoBuildingManager::SwitchVariant(LegoEntity* p_entity)
LegoBuildingInfo* info = GetInfo(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_counter == -1) {
LegoROI* roi = p_entity->GetROI();
if (++m_nextVariant >= sizeOfArray(g_buildingInfoVariants)) {
m_nextVariant = 0;
@ -461,7 +463,7 @@ MxBool LegoBuildingManager::SwitchVariant(LegoEntity* p_entity)
roi->SetVisibility(FALSE);
info->m_variant = g_buildingInfoVariants[m_nextVariant];
CreateBuilding(12, CurrentWorld());
CreateBuilding(HAUS1_INDEX, CurrentWorld());
if (info->m_entity != NULL) {
info->m_entity->GetROI()->SetVisibility(TRUE);
@ -548,7 +550,7 @@ MxU32 LegoBuildingManager::GetAnimationId(LegoEntity* p_entity)
// FUNCTION: LEGO1 0x1002ff40
// FUNCTION: BETA10 0x10064398
MxU32 LegoBuildingManager::GetSoundId(LegoEntity* p_entity, MxBool p_state)
MxU32 LegoBuildingManager::GetSoundId(LegoEntity* p_entity, MxBool p_basedOnMood)
{
LegoBuildingInfo* info = GetInfo(p_entity);
@ -556,12 +558,12 @@ MxU32 LegoBuildingManager::GetSoundId(LegoEntity* p_entity, MxBool p_state)
return 0;
}
if (p_state) {
return info->m_mood + g_unk0x100f3740;
if (p_basedOnMood) {
return info->m_mood + g_buildingSoundIdMoodOffset;
}
if (info != NULL) {
return info->m_sound + g_unk0x100f373c;
return info->m_sound + g_buildingSoundIdOffset;
}
return 0;
@ -587,7 +589,7 @@ void LegoBuildingManager::SetCustomizeAnimFile(const char* p_value)
}
// FUNCTION: LEGO1 0x10030000
MxBool LegoBuildingManager::FUN_10030000(LegoEntity* p_entity)
MxBool LegoBuildingManager::DecrementCounter(LegoEntity* p_entity)
{
LegoBuildingInfo* info = GetInfo(p_entity);
@ -595,7 +597,7 @@ MxBool LegoBuildingManager::FUN_10030000(LegoEntity* p_entity)
return FALSE;
}
return FUN_10030030(info - g_buildingInfo);
return DecrementCounter(info - g_buildingInfo);
}
inline LegoBuildingInfo* GetBuildingInfo(MxS32 p_index)
@ -608,7 +610,7 @@ inline LegoBuildingInfo* GetBuildingInfo(MxS32 p_index)
}
// FUNCTION: LEGO1 0x10030030
MxBool LegoBuildingManager::FUN_10030030(MxS32 p_index)
MxBool LegoBuildingManager::DecrementCounter(MxS32 p_index)
{
if (p_index >= sizeOfArray(g_buildingInfo)) {
return FALSE;
@ -621,25 +623,25 @@ MxBool LegoBuildingManager::FUN_10030030(MxS32 p_index)
MxBool result = TRUE;
if (info->m_unk0x11 < 0) {
info->m_unk0x11 = g_buildingInfoDownshift[p_index];
if (info->m_counter < 0) {
info->m_counter = g_buildingInfoDownshift[p_index];
}
if (info->m_unk0x11 <= 0) {
if (info->m_counter <= 0) {
result = FALSE;
}
else {
LegoROI* roi = info->m_entity->GetROI();
info->m_unk0x11 -= 2;
if (info->m_unk0x11 == 1) {
info->m_unk0x11 = 0;
info->m_counter -= 2;
if (info->m_counter == 1) {
info->m_counter = 0;
roi->SetVisibility(FALSE);
}
else {
AdjustHeight(p_index);
MxMatrix mat = roi->GetLocal2World();
mat[3][1] = g_buildingInfo[p_index].m_unk0x14;
mat[3][1] = g_buildingInfo[p_index].m_adjustedY;
roi->UpdateTransformationRelativeToParent(mat);
VideoManager()->Get3DManager()->Moved(*roi);
}
@ -649,11 +651,11 @@ MxBool LegoBuildingManager::FUN_10030030(MxS32 p_index)
}
// FUNCTION: LEGO1 0x10030110
MxBool LegoBuildingManager::FUN_10030110(LegoBuildingInfo* p_data)
MxBool LegoBuildingManager::DecrementCounter(LegoBuildingInfo* p_data)
{
for (MxS32 i = 0; i < sizeOfArray(g_buildingInfo); i++) {
if (&g_buildingInfo[i] == p_data) {
return FUN_10030030(i);
return DecrementCounter(i);
}
}
@ -661,7 +663,12 @@ MxBool LegoBuildingManager::FUN_10030110(LegoBuildingInfo* p_data)
}
// FUNCTION: LEGO1 0x10030150
void LegoBuildingManager::ScheduleAnimation(LegoEntity* p_entity, MxLong p_length, MxBool p_haveSound, MxBool p_unk0x28)
void LegoBuildingManager::ScheduleAnimation(
LegoEntity* p_entity,
MxLong p_length,
MxBool p_haveSound,
MxBool p_hideAfterAnimation
)
{
m_world = CurrentWorld();
@ -671,7 +678,7 @@ void LegoBuildingManager::ScheduleAnimation(LegoEntity* p_entity, MxLong p_lengt
}
if (m_numEntries == 0) {
m_unk0x28 = p_unk0x28;
m_hideAfterAnimation = p_hideAfterAnimation;
TickleManager()->RegisterClient(this, 50);
}
@ -685,9 +692,9 @@ void LegoBuildingManager::ScheduleAnimation(LegoEntity* p_entity, MxLong p_lengt
time += p_length;
entry->m_time = time + 1000;
entry->m_unk0x0c = entry->m_roi->GetWorldPosition()[1];
entry->m_y = entry->m_roi->GetWorldPosition()[1];
entry->m_muted = p_haveSound == FALSE;
FUN_100307b0(p_entity, -2);
AdjustCounter(p_entity, -2);
}
// FUNCTION: LEGO1 0x10030220
@ -724,33 +731,33 @@ MxResult LegoBuildingManager::Tickle()
MxMatrix local48;
MxMatrix locald8;
MxMatrix local120(entry->m_roi->GetLocal2World());
Mx3DPointFloat local134(local120[3]);
MxMatrix transformationMatrix(entry->m_roi->GetLocal2World());
Mx3DPointFloat position(transformationMatrix[3]);
ZEROVEC3(local120[3]);
ZEROVEC3(transformationMatrix[3]);
locald8.SetIdentity();
local48 = local120;
local48 = transformationMatrix;
local134[1] = sin(((entry->m_time - time) * 10) * 0.0062831999f) * 0.4 + (entry->m_unk0x0c -= 0.05);
SET3(local120[3], local134);
position[1] = sin(((entry->m_time - time) * 10) * 0.0062831999f) * 0.4 + (entry->m_y -= 0.05);
SET3(transformationMatrix[3], position);
entry->m_roi->UpdateTransformationRelativeToParent(local120);
entry->m_roi->UpdateTransformationRelativeToParent(transformationMatrix);
VideoManager()->Get3DManager()->Moved(*entry->m_roi);
if (entry->m_time < time) {
LegoBuildingInfo* info = GetInfo(entry->m_entity);
if (info->m_unk0x11 && !m_unk0x28) {
if (info->m_counter && !m_hideAfterAnimation) {
MxS32 index = info - g_buildingInfo;
AdjustHeight(index);
MxMatrix mat = entry->m_roi->GetLocal2World();
mat[3][1] = g_buildingInfo[index].m_unk0x14;
mat[3][1] = g_buildingInfo[index].m_adjustedY;
entry->m_roi->UpdateTransformationRelativeToParent(mat);
VideoManager()->Get3DManager()->Moved(*entry->m_roi);
}
else {
info->m_unk0x11 = 0;
info->m_counter = 0;
entry->m_roi->SetVisibility(FALSE);
}
@ -774,17 +781,17 @@ MxResult LegoBuildingManager::Tickle()
// FUNCTION: LEGO1 0x10030590
// FUNCTION: BETA10 0x1006474c
void LegoBuildingManager::FUN_10030590()
void LegoBuildingManager::ClearCounters()
{
for (MxS32 i = 0; i < sizeOfArray(g_buildingInfo); i++) {
g_buildingInfo[i].m_unk0x11 = -1;
g_buildingInfo[i].m_initialUnk0x11 = -1;
g_buildingInfo[i].m_counter = -1;
g_buildingInfo[i].m_initialCounter = -1;
AdjustHeight(i);
if (g_buildingInfo[i].m_entity != NULL) {
LegoROI* roi = g_buildingInfo[i].m_entity->GetROI();
MxMatrix mat = roi->GetLocal2World();
mat[3][1] = g_buildingInfo[i].m_unk0x14;
mat[3][1] = g_buildingInfo[i].m_adjustedY;
roi->UpdateTransformationRelativeToParent(mat);
VideoManager()->Get3DManager()->Moved(*roi);
}
@ -793,7 +800,7 @@ void LegoBuildingManager::FUN_10030590()
// FUNCTION: LEGO1 0x10030630
// FUNCTION: BETA10 0x100648ab
MxResult LegoBuildingManager::FUN_10030630()
MxResult LegoBuildingManager::DetermineBoundaries()
{
LegoWorld* world = CurrentWorld();
@ -827,7 +834,7 @@ MxResult LegoBuildingManager::FUN_10030630()
}
if (g_buildingInfo[i].m_boundary != NULL) {
Mx4DPointFloat& unk0x14 = *g_buildingInfo[i].m_boundary->GetUnknown0x14();
Mx4DPointFloat& unk0x14 = *g_buildingInfo[i].m_boundary->GetUp();
if (position.Dot(position, unk0x14) + unk0x14.index_operator(3) > 0.001 ||
position.Dot(position, unk0x14) + unk0x14.index_operator(3) < -0.001) {
@ -859,7 +866,7 @@ MxResult LegoBuildingManager::FUN_10030630()
}
}
m_unk0x09 = TRUE;
m_boundariesDetermined = TRUE;
return SUCCESS;
}
@ -867,8 +874,8 @@ MxResult LegoBuildingManager::FUN_10030630()
// FUNCTION: BETA10 0x10064db9
LegoBuildingInfo* LegoBuildingManager::GetInfoArray(MxS32& p_length)
{
if (!m_unk0x09) {
FUN_10030630();
if (!m_boundariesDetermined) {
DetermineBoundaries();
}
p_length = sizeOfArray(g_buildingInfo);
@ -876,28 +883,28 @@ LegoBuildingInfo* LegoBuildingManager::GetInfoArray(MxS32& p_length)
}
// FUNCTION: LEGO1 0x100307b0
void LegoBuildingManager::FUN_100307b0(LegoEntity* p_entity, MxS32 p_adjust)
void LegoBuildingManager::AdjustCounter(LegoEntity* p_entity, MxS32 p_adjust)
{
LegoBuildingInfo* info = GetInfo(p_entity);
if (info != NULL) {
if (info->m_unk0x11 < 0) {
info->m_unk0x11 = g_buildingInfoDownshift[info - g_buildingInfo];
if (info->m_counter < 0) {
info->m_counter = g_buildingInfoDownshift[info - g_buildingInfo];
}
if (info->m_unk0x11 > 0) {
info->m_unk0x11 += p_adjust;
if (info->m_unk0x11 <= 1 && p_adjust < 0) {
info->m_unk0x11 = 0;
if (info->m_counter > 0) {
info->m_counter += p_adjust;
if (info->m_counter <= 1 && p_adjust < 0) {
info->m_counter = 0;
}
}
}
}
// FUNCTION: LEGO1 0x10030800
void LegoBuildingManager::FUN_10030800()
void LegoBuildingManager::SetInitialCounters()
{
for (MxU32 i = 0; i < sizeOfArray(g_buildingInfo); i++) {
g_buildingInfo[i].m_initialUnk0x11 = g_buildingInfo[i].m_unk0x11;
g_buildingInfo[i].m_initialCounter = g_buildingInfo[i].m_counter;
}
}

View File

@ -37,19 +37,19 @@ MxU32 g_characterAnimationId = 10;
char* LegoCharacterManager::g_customizeAnimFile = NULL;
// GLOBAL: LEGO1 0x100fc4d8
MxU32 g_unk0x100fc4d8 = 50;
MxU32 g_characterSoundIdOffset = 50;
// GLOBAL: LEGO1 0x100fc4dc
MxU32 g_unk0x100fc4dc = 66;
MxU32 g_characterSoundIdMoodOffset = 66;
// GLOBAL: LEGO1 0x100fc4e8
MxU32 g_unk0x100fc4e8 = 0;
MxU32 g_headTextureCounter = 0;
// GLOBAL: LEGO1 0x100fc4ec
MxU32 g_unk0x100fc4ec = 2;
MxU32 g_infohatVariantCounter = 2;
// GLOBAL: LEGO1 0x100fc4f0
MxU32 g_unk0x100fc4f0 = 0;
MxU32 g_autoRoiCounter = 0;
// GLOBAL: LEGO1 0x10104f20
LegoActorInfo g_actorInfo[66];
@ -132,33 +132,41 @@ MxResult LegoCharacterManager::Write(LegoStorage* p_storage)
if (p_storage->Write(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) {
goto done;
}
if (p_storage->Write(&info->m_parts[c_infohatPart].m_unk0x08, sizeof(info->m_parts[c_infohatPart].m_unk0x08)) !=
SUCCESS) {
if (p_storage->Write(
&info->m_parts[c_infohatPart].m_partNameIndex,
sizeof(info->m_parts[c_infohatPart].m_partNameIndex)
) != SUCCESS) {
goto done;
}
if (p_storage->Write(&info->m_parts[c_infohatPart].m_unk0x14, sizeof(info->m_parts[c_infohatPart].m_unk0x14)) !=
if (p_storage->Write(
&info->m_parts[c_infohatPart].m_nameIndex,
sizeof(info->m_parts[c_infohatPart].m_nameIndex)
) != SUCCESS) {
goto done;
}
if (p_storage->Write(
&info->m_parts[c_infogronPart].m_nameIndex,
sizeof(info->m_parts[c_infogronPart].m_nameIndex)
) != SUCCESS) {
goto done;
}
if (p_storage->Write(
&info->m_parts[c_armlftPart].m_nameIndex,
sizeof(info->m_parts[c_armlftPart].m_nameIndex)
) != SUCCESS) {
goto done;
}
if (p_storage->Write(&info->m_parts[c_armrtPart].m_nameIndex, sizeof(info->m_parts[c_armrtPart].m_nameIndex)) !=
SUCCESS) {
goto done;
}
if (p_storage->Write(
&info->m_parts[c_infogronPart].m_unk0x14,
sizeof(info->m_parts[c_infogronPart].m_unk0x14)
&info->m_parts[c_leglftPart].m_nameIndex,
sizeof(info->m_parts[c_leglftPart].m_nameIndex)
) != SUCCESS) {
goto done;
}
if (p_storage->Write(&info->m_parts[c_armlftPart].m_unk0x14, sizeof(info->m_parts[c_armlftPart].m_unk0x14)) !=
SUCCESS) {
goto done;
}
if (p_storage->Write(&info->m_parts[c_armrtPart].m_unk0x14, sizeof(info->m_parts[c_armrtPart].m_unk0x14)) !=
SUCCESS) {
goto done;
}
if (p_storage->Write(&info->m_parts[c_leglftPart].m_unk0x14, sizeof(info->m_parts[c_leglftPart].m_unk0x14)) !=
SUCCESS) {
goto done;
}
if (p_storage->Write(&info->m_parts[c_legrtPart].m_unk0x14, sizeof(info->m_parts[c_legrtPart].m_unk0x14)) !=
if (p_storage->Write(&info->m_parts[c_legrtPart].m_nameIndex, sizeof(info->m_parts[c_legrtPart].m_nameIndex)) !=
SUCCESS) {
goto done;
}
@ -178,43 +186,34 @@ MxResult LegoCharacterManager::Read(LegoStorage* p_storage)
for (MxS32 i = 0; i < sizeOfArray(g_actorInfo); i++) {
LegoActorInfo* info = &g_actorInfo[i];
if (p_storage->Read(&info->m_sound, sizeof(info->m_sound)) != SUCCESS) {
if (p_storage->Read(&info->m_sound, sizeof(MxS32)) != SUCCESS) {
goto done;
}
if (p_storage->Read(&info->m_move, sizeof(info->m_move)) != SUCCESS) {
if (p_storage->Read(&info->m_move, sizeof(MxS32)) != SUCCESS) {
goto done;
}
if (p_storage->Read(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) {
if (p_storage->Read(&info->m_mood, sizeof(MxU8)) != SUCCESS) {
goto done;
}
if (p_storage->Read(&info->m_parts[c_infohatPart].m_unk0x08, sizeof(info->m_parts[c_infohatPart].m_unk0x08)) !=
SUCCESS) {
if (p_storage->Read(&info->m_parts[c_infohatPart].m_partNameIndex, sizeof(MxU8)) != SUCCESS) {
goto done;
}
if (p_storage->Read(&info->m_parts[c_infohatPart].m_unk0x14, sizeof(info->m_parts[c_infohatPart].m_unk0x14)) !=
SUCCESS) {
if (p_storage->Read(&info->m_parts[c_infohatPart].m_nameIndex, sizeof(MxU8)) != SUCCESS) {
goto done;
}
if (p_storage->Read(
&info->m_parts[c_infogronPart].m_unk0x14,
sizeof(info->m_parts[c_infogronPart].m_unk0x14)
) != SUCCESS) {
if (p_storage->Read(&info->m_parts[c_infogronPart].m_nameIndex, sizeof(MxU8)) != SUCCESS) {
goto done;
}
if (p_storage->Read(&info->m_parts[c_armlftPart].m_unk0x14, sizeof(info->m_parts[c_armlftPart].m_unk0x14)) !=
SUCCESS) {
if (p_storage->Read(&info->m_parts[c_armlftPart].m_nameIndex, sizeof(MxU8)) != SUCCESS) {
goto done;
}
if (p_storage->Read(&info->m_parts[c_armrtPart].m_unk0x14, sizeof(info->m_parts[c_armrtPart].m_unk0x14)) !=
SUCCESS) {
if (p_storage->Read(&info->m_parts[c_armrtPart].m_nameIndex, sizeof(MxU8)) != SUCCESS) {
goto done;
}
if (p_storage->Read(&info->m_parts[c_leglftPart].m_unk0x14, sizeof(info->m_parts[c_leglftPart].m_unk0x14)) !=
SUCCESS) {
if (p_storage->Read(&info->m_parts[c_leglftPart].m_nameIndex, sizeof(MxU8)) != SUCCESS) {
goto done;
}
if (p_storage->Read(&info->m_parts[c_legrtPart].m_unk0x14, sizeof(info->m_parts[c_legrtPart].m_unk0x14)) !=
SUCCESS) {
if (p_storage->Read(&info->m_parts[c_legrtPart].m_nameIndex, sizeof(MxU8)) != SUCCESS) {
goto done;
}
}
@ -501,7 +500,7 @@ LegoROI* LegoCharacterManager::CreateActorROI(const char* p_key)
boundingBox.Max()[0] = g_actorLODs[c_topLOD].m_boundingBox[3];
boundingBox.Max()[1] = g_actorLODs[c_topLOD].m_boundingBox[4];
boundingBox.Max()[2] = g_actorLODs[c_topLOD].m_boundingBox[5];
roi->SetUnknown0x80(boundingBox);
roi->SetBoundingBox(boundingBox);
comp = new CompoundObject();
roi->SetComp(comp);
@ -512,7 +511,7 @@ LegoROI* LegoCharacterManager::CreateActorROI(const char* p_key)
const char* parentName;
if (i == 0 || i == 1) {
parentName = part.m_unk0x04[part.m_unk0x00[part.m_unk0x08]];
parentName = part.m_partName[part.m_partNameIndices[part.m_partNameIndex]];
}
else {
parentName = g_actorLODs[i + 1].m_parentName;
@ -552,7 +551,7 @@ LegoROI* LegoCharacterManager::CreateActorROI(const char* p_key)
childBoundingBox.Max()[0] = g_actorLODs[i + 1].m_boundingBox[3];
childBoundingBox.Max()[1] = g_actorLODs[i + 1].m_boundingBox[4];
childBoundingBox.Max()[2] = g_actorLODs[i + 1].m_boundingBox[5];
childROI->SetUnknown0x80(childBoundingBox);
childROI->SetBoundingBox(childBoundingBox);
CalcLocalTransform(
Mx3DPointFloat(g_actorLODs[i + 1].m_position),
@ -560,21 +559,22 @@ LegoROI* LegoCharacterManager::CreateActorROI(const char* p_key)
Mx3DPointFloat(g_actorLODs[i + 1].m_up),
mat
);
childROI->WrappedSetLocalTransform(mat);
childROI->WrappedSetLocal2WorldWithWorldDataUpdate(mat);
if (g_actorLODs[i + 1].m_flags & LegoActorLOD::c_flag1 && (i != 0 || part.m_unk0x00[part.m_unk0x08] != 0)) {
if (g_actorLODs[i + 1].m_flags & LegoActorLOD::c_useTexture &&
(i != 0 || part.m_partNameIndices[part.m_partNameIndex] != 0)) {
LegoTextureInfo* textureInfo = textureContainer->Get(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]]);
LegoTextureInfo* textureInfo = textureContainer->Get(part.m_names[part.m_nameIndices[part.m_nameIndex]]);
if (textureInfo != NULL) {
childROI->FUN_100a9210(textureInfo);
childROI->FUN_100a9170(1.0F, 1.0F, 1.0F, 0.0F);
childROI->SetTextureInfo(textureInfo);
childROI->SetLodColor(1.0F, 1.0F, 1.0F, 0.0F);
}
}
else if (g_actorLODs[i + 1].m_flags & LegoActorLOD::c_flag2 || (i == 0 && part.m_unk0x00[part.m_unk0x08] == 0)) {
else if (g_actorLODs[i + 1].m_flags & LegoActorLOD::c_useColor || (i == 0 && part.m_partNameIndices[part.m_partNameIndex] == 0)) {
LegoFloat red, green, blue, alpha;
childROI->FUN_100a9bf0(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]], red, green, blue, alpha);
childROI->FUN_100a9170(red, green, blue, alpha);
childROI->GetRGBAColor(part.m_names[part.m_nameIndices[part.m_nameIndex]], red, green, blue, alpha);
childROI->SetLodColor(red, green, blue, alpha);
}
comp->push_back(childROI);
@ -586,7 +586,7 @@ LegoROI* LegoCharacterManager::CreateActorROI(const char* p_key)
Mx3DPointFloat(g_actorLODs[c_topLOD].m_up),
mat
);
roi->WrappedSetLocalTransform(mat);
roi->WrappedSetLocal2WorldWithWorldDataUpdate(mat);
info->m_roi = roi;
success = TRUE;
@ -602,7 +602,7 @@ LegoROI* LegoCharacterManager::CreateActorROI(const char* p_key)
// FUNCTION: LEGO1 0x100849a0
// FUNCTION: BETA10 0x10075b51
MxBool LegoCharacterManager::FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_texture)
MxBool LegoCharacterManager::SetHeadTexture(LegoROI* p_roi, LegoTextureInfo* p_texture)
{
LegoResult result = SUCCESS;
LegoROI* head = FindChildROI(p_roi, g_actorLODs[c_headLOD].m_name);
@ -614,7 +614,7 @@ MxBool LegoCharacterManager::FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_tex
assert(lodList);
MxS32 lodSize = lodList->Size();
sprintf(lodName, "%s%s%d", p_roi->GetName(), "head", g_unk0x100fc4e8++);
sprintf(lodName, "%s%s%d", p_roi->GetName(), "head", g_headTextureCounter++);
ViewLODList* dupLodList = GetViewLODListManager()->Create(lodName, lodSize);
assert(dupLodList);
@ -625,7 +625,7 @@ MxBool LegoCharacterManager::FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_tex
assert(info);
LegoActorInfo::Part& part = info->m_parts[c_headPart];
p_texture = TextureContainer()->Get(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]]);
p_texture = TextureContainer()->Get(part.m_names[part.m_nameIndices[part.m_nameIndex]]);
assert(p_texture);
}
@ -634,7 +634,7 @@ MxBool LegoCharacterManager::FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_tex
LegoLOD* clone = lod->Clone(renderer);
if (p_texture != NULL) {
clone->FUN_100aad70(p_texture);
clone->UpdateTextureInfo(p_texture);
}
dupLodList->PushBack(clone);
@ -643,7 +643,7 @@ MxBool LegoCharacterManager::FUN_100849a0(LegoROI* p_roi, LegoTextureInfo* p_tex
lodList->Release();
lodList = dupLodList;
if (head->GetUnknown0xe0() >= 0) {
if (head->GetLodLevel() >= 0) {
VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->RemoveROIDetailFromScene(head);
}
@ -758,23 +758,23 @@ MxBool LegoCharacterManager::SwitchColor(LegoROI* p_roi, LegoROI* p_targetROI)
assert(partIndex < numParts);
MxBool findChild = TRUE;
if (partIndex == 6) {
partIndex = 4;
if (partIndex == c_clawlftPart) {
partIndex = c_armlftPart;
}
else if (partIndex == 7) {
partIndex = 5;
else if (partIndex == c_clawrtPart) {
partIndex = c_armrtPart;
}
else if (partIndex == 3) {
partIndex = 1;
else if (partIndex == c_headPart) {
partIndex = c_infohatPart;
}
else if (partIndex == 0) {
partIndex = 2;
else if (partIndex == c_bodyPart) {
partIndex = c_infogronPart;
}
else {
findChild = FALSE;
}
if (!(g_actorLODs[partIndex + 1].m_flags & LegoActorLOD::c_flag2)) {
if (!(g_actorLODs[partIndex + 1].m_flags & LegoActorLOD::c_useColor)) {
return FALSE;
}
@ -790,14 +790,14 @@ MxBool LegoCharacterManager::SwitchColor(LegoROI* p_roi, LegoROI* p_targetROI)
LegoActorInfo::Part& part = info->m_parts[partIndex];
part.m_unk0x14++;
if (part.m_unk0x0c[part.m_unk0x14] == 0xff) {
part.m_unk0x14 = 0;
part.m_nameIndex++;
if (part.m_nameIndices[part.m_nameIndex] == 0xff) {
part.m_nameIndex = 0;
}
LegoFloat red, green, blue, alpha;
LegoROI::FUN_100a9bf0(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]], red, green, blue, alpha);
p_targetROI->FUN_100a9170(red, green, blue, alpha);
LegoROI::GetRGBAColor(part.m_names[part.m_nameIndices[part.m_nameIndex]], red, green, blue, alpha);
p_targetROI->SetLodColor(red, green, blue, alpha);
return TRUE;
}
@ -812,12 +812,12 @@ MxBool LegoCharacterManager::SwitchVariant(LegoROI* p_roi)
LegoActorInfo::Part& part = info->m_parts[c_infohatPart];
part.m_unk0x08++;
MxU8 unk0x00 = part.m_unk0x00[part.m_unk0x08];
part.m_partNameIndex++;
MxU8 partNameIndex = part.m_partNameIndices[part.m_partNameIndex];
if (unk0x00 == 0xff) {
part.m_unk0x08 = 0;
unk0x00 = part.m_unk0x00[part.m_unk0x08];
if (partNameIndex == 0xff) {
part.m_partNameIndex = 0;
partNameIndex = part.m_partNameIndices[part.m_partNameIndex];
}
LegoROI* childROI = FindChildROI(p_roi, g_actorLODs[c_infohatLOD].m_name);
@ -825,26 +825,26 @@ MxBool LegoCharacterManager::SwitchVariant(LegoROI* p_roi)
if (childROI != NULL) {
char lodName[256];
ViewLODList* lodList = GetViewLODListManager()->Lookup(part.m_unk0x04[unk0x00]);
ViewLODList* lodList = GetViewLODListManager()->Lookup(part.m_partName[partNameIndex]);
MxS32 lodSize = lodList->Size();
sprintf(lodName, "%s%d", p_roi->GetName(), g_unk0x100fc4ec++);
sprintf(lodName, "%s%d", p_roi->GetName(), g_infohatVariantCounter++);
ViewLODList* dupLodList = GetViewLODListManager()->Create(lodName, lodSize);
Tgl::Renderer* renderer = VideoManager()->GetRenderer();
LegoFloat red, green, blue, alpha;
LegoROI::FUN_100a9bf0(part.m_unk0x10[part.m_unk0x0c[part.m_unk0x14]], red, green, blue, alpha);
LegoROI::GetRGBAColor(part.m_names[part.m_nameIndices[part.m_nameIndex]], red, green, blue, alpha);
for (MxS32 i = 0; i < lodSize; i++) {
LegoLOD* lod = (LegoLOD*) (*lodList)[i];
LegoLOD* clone = lod->Clone(renderer);
clone->FUN_100aacb0(red, green, blue, alpha);
clone->SetColor(red, green, blue, alpha);
dupLodList->PushBack(clone);
}
lodList->Release();
lodList = dupLodList;
if (childROI->GetUnknown0xe0() >= 0) {
if (childROI->GetLodLevel() >= 0) {
VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->RemoveROIDetailFromScene(childROI);
}
@ -931,16 +931,16 @@ MxU32 LegoCharacterManager::GetAnimationId(LegoROI* p_roi)
// FUNCTION: LEGO1 0x10085140
// FUNCTION: BETA10 0x10076855
MxU32 LegoCharacterManager::GetSoundId(LegoROI* p_roi, MxBool p_und)
MxU32 LegoCharacterManager::GetSoundId(LegoROI* p_roi, MxBool p_basedOnMood)
{
LegoActorInfo* info = GetActorInfo(p_roi);
if (p_und) {
return info->m_mood + g_unk0x100fc4dc;
if (p_basedOnMood) {
return info->m_mood + g_characterSoundIdMoodOffset;
}
if (info != NULL) {
return info->m_sound + g_unk0x100fc4d8;
return info->m_sound + g_characterSoundIdOffset;
}
else {
return 0;
@ -1005,14 +1005,14 @@ LegoROI* LegoCharacterManager::CreateAutoROI(const char* p_name, const char* p_l
name = p_name;
}
else {
sprintf(buf, "autoROI_%d", g_unk0x100fc4f0++);
sprintf(buf, "autoROI_%d", g_autoRoiCounter++);
name = buf;
}
roi->SetName(name);
lodList->Release();
if (roi != NULL && FUN_10085870(roi) != SUCCESS) {
if (roi != NULL && UpdateBoundingSphereAndBox(roi) != SUCCESS) {
delete roi;
roi = NULL;
}
@ -1042,7 +1042,7 @@ LegoROI* LegoCharacterManager::CreateAutoROI(const char* p_name, const char* p_l
}
// FUNCTION: LEGO1 0x10085870
MxResult LegoCharacterManager::FUN_10085870(LegoROI* p_roi)
MxResult LegoCharacterManager::UpdateBoundingSphereAndBox(LegoROI* p_roi)
{
MxResult result = FAILURE;
@ -1073,9 +1073,9 @@ MxResult LegoCharacterManager::FUN_10085870(LegoROI* p_roi)
SET3(boundingBox.Min(), min);
SET3(boundingBox.Max(), max);
p_roi->SetUnknown0x80(boundingBox);
p_roi->SetBoundingBox(boundingBox);
p_roi->VTable0x14();
p_roi->WrappedUpdateWorldData();
result = SUCCESS;
}

View File

@ -99,14 +99,14 @@ ColorStringStruct g_colorSaveData[43] = {
{"c_chljety1", "lego black"}, {"c_chrjety1", "lego black"}, // copter left jet, copter right jet
{"c_chmidly0", "lego black"}, {"c_chmotry0", "lego blue"}, // copter middle, copter motor
{"c_chsidly0", "lego black"}, {"c_chsidry0", "lego black"}, // copter side left, copter side right
{"c_chstuty0", "lego black"}, {"c_chtaily0", "lego black"}, // copter ???, copter tail
{"c_chwindy1", "lego black"}, {"c_dbfbrdy0", "lego red"}, // copter ???, dunebuggy ???
{"c_chstuty0", "lego black"}, {"c_chtaily0", "lego black"}, // copter skids, copter tail
{"c_chwindy1", "lego black"}, {"c_dbfbrdy0", "lego red"}, // copter windshield, dunebuggy body
{"c_dbflagy0", "lego yellow"}, {"c_dbfrfny4", "lego red"}, // dunebuggy flag, dunebuggy front fender
{"c_dbfrxly0", "lego white"}, {"c_dbhndly0", "lego white"}, // dunebuggy front axle, dunebuggy handlebar
{"c_dbltbry0", "lego white"}, {"c_jsdashy0", "lego white"}, // dunebuggy ???, jetski dash
{"c_dbltbry0", "lego white"}, {"c_jsdashy0", "lego white"}, // dunebuggy rear lights, jetski dash
{"c_jsexhy0", "lego black"}, {"c_jsfrnty5", "lego black"}, // jetski exhaust, jetski front
{"c_jshndly0", "lego red"}, {"c_jslsidy0", "lego black"}, // jetski handlebar, jetski left side
{"c_jsrsidy0", "lego black"}, {"c_jsskiby0", "lego red"}, // jetski right side, jetski ???
{"c_jsrsidy0", "lego black"}, {"c_jsskiby0", "lego red"}, // jetski right side, jetski base
{"c_jswnshy5", "lego white"}, {"c_rcbacky6", "lego green"}, // jetski windshield, racecar back
{"c_rcedgey0", "lego green"}, {"c_rcfrmey0", "lego red"}, // racecar edge, racecar frame
{"c_rcfrnty6", "lego green"}, {"c_rcmotry0", "lego white"}, // racecar front, racecar motor
@ -145,7 +145,7 @@ const char* g_strDisable = "disable";
LegoGameState::LegoGameState()
{
SetColors();
SetROIHandlerFunction();
SetROIColorOverride();
m_stateCount = 0;
m_actorId = 0;
@ -170,13 +170,13 @@ LegoGameState::LegoGameState()
VariableTable()->SetVariable(m_fullScreenMovie);
VariableTable()->SetVariable("lightposition", "2");
SerializeScoreHistory(1);
SerializeScoreHistory(LegoFile::c_read);
}
// FUNCTION: LEGO1 0x10039720
LegoGameState::~LegoGameState()
{
LegoROI::FUN_100a9d30(NULL);
LegoROI::SetColorOverride(NULL);
if (m_stateCount) {
for (MxS16 i = 0; i < m_stateCount; i++) {
@ -215,7 +215,7 @@ void LegoGameState::SetActor(MxU8 p_actorId)
newActor->SetROI(roi, FALSE, FALSE);
if (oldActor) {
newActor->GetROI()->FUN_100a58f0(oldActor->GetROI()->GetLocal2World());
newActor->GetROI()->SetLocal2World(oldActor->GetROI()->GetLocal2World());
newActor->SetBoundary(oldActor->GetBoundary());
delete oldActor;
}
@ -277,7 +277,7 @@ MxResult LegoGameState::Save(MxULong p_slot)
}
storage.WriteS32(0x1000c);
storage.WriteS16(m_unk0x24);
storage.WriteS16(m_currentPlayerId);
storage.WriteU16(m_currentAct);
storage.WriteU8(m_actorId);
@ -315,7 +315,7 @@ MxResult LegoGameState::Save(MxULong p_slot)
area = m_unk0x42c;
storage.WriteU16(area);
SerializeScoreHistory(2);
SerializeScoreHistory(LegoFile::c_write);
m_isDirty = FALSE;
done:
@ -372,7 +372,7 @@ MxResult LegoGameState::Load(MxULong p_slot)
goto done;
}
storage.ReadS16(m_unk0x24);
storage.ReadS16(m_currentPlayerId);
storage.ReadS16(actArea);
SetCurrentAct((Act) actArea);
@ -513,7 +513,7 @@ MxS32 LegoGameState::ReadVariable(LegoStorage* p_storage, MxVariableTable* p_to)
MxS32 result = 1;
MxU8 len;
if (p_storage->Read(&len, sizeof(len)) != SUCCESS) {
if (p_storage->Read(&len, sizeof(MxU8)) != SUCCESS) {
goto done;
}
@ -531,7 +531,7 @@ MxS32 LegoGameState::ReadVariable(LegoStorage* p_storage, MxVariableTable* p_to)
goto done;
}
if (p_storage->Read(&len, sizeof(len)) != SUCCESS) {
if (p_storage->Read(&len, sizeof(MxU8)) != SUCCESS) {
goto done;
}
@ -615,8 +615,8 @@ MxResult LegoGameState::AddPlayer(Username& p_player)
m_playerCount++;
m_players[0].Set(p_player);
m_unk0x24 = m_history.m_unk0x372;
m_history.m_unk0x372 = m_unk0x24 + 1;
m_currentPlayerId = m_history.m_nextPlayerId;
m_history.m_nextPlayerId = m_currentPlayerId + 1;
m_history.WriteScoreHistory();
SetCurrentAct(e_act1);
@ -868,17 +868,17 @@ void LegoGameState::SwitchArea(Area p_area)
VideoManager()->SetUnk0x554(TRUE);
InvokeAction(Extra::ActionType::e_opendisk, *g_infodoorScript, InfodoorScript::c__StartUp, NULL);
break;
case e_unk4:
case e_infocenterExited:
case e_jetrace2:
case e_jetraceExterior:
case e_unk17:
case e_jetskibuildExited:
case e_carraceExterior:
case e_unk20:
case e_racecarbuildExited:
case e_unk21:
case e_pizzeriaExterior:
case e_garageExterior:
case e_hospitalExterior:
case e_unk31:
case e_hospitalExited:
case e_policeExterior:
case e_bike:
case e_dunecar:
@ -886,7 +886,7 @@ void LegoGameState::SwitchArea(Area p_area)
case e_copter:
case e_skateboard:
case e_jetski:
case e_unk66:
case e_vehicleExited:
LoadIsle();
break;
case e_elevbott:
@ -948,7 +948,7 @@ void LegoGameState::SwitchArea(Area p_area)
VideoManager()->Get3DManager()->SetFrustrum(90, 0.1f, 250.0f);
InvokeAction(Extra::ActionType::e_start, *g_isleScript, IsleScript::c_GaraDoor, NULL);
break;
case e_unk28: {
case e_garageExited: {
Act1State* state = (Act1State*) GameState()->GetState("Act1State");
LoadIsle();
@ -973,7 +973,7 @@ void LegoGameState::SwitchArea(Area p_area)
VideoManager()->SetUnk0x554(TRUE);
InvokeAction(Extra::ActionType::e_opendisk, *g_hospitalScript, HospitalScript::c__StartUp, NULL);
break;
case e_unk33:
case e_policeExited:
LoadIsle();
SetCameraControllerFromIsle();
UserActor()->ResetWorldTransform(TRUE);
@ -1060,13 +1060,13 @@ void LegoGameState::SetColors()
}
// FUNCTION: LEGO1 0x1003bac0
void LegoGameState::SetROIHandlerFunction()
void LegoGameState::SetROIColorOverride()
{
LegoROI::FUN_100a9d30(&ROIHandlerFunction);
LegoROI::SetColorOverride(&ROIColorOverride);
}
// FUNCTION: LEGO1 0x1003bad0
MxBool ROIHandlerFunction(const char* p_input, char* p_output, MxU32 p_copyLen)
MxBool ROIColorOverride(const char* p_input, char* p_output, MxU32 p_copyLen)
{
if (p_output != NULL && p_copyLen != 0 &&
(strnicmp(p_input, "INDIR-F-", strlen("INDIR-F-")) == 0 ||
@ -1303,7 +1303,7 @@ void LegoBackgroundColor::ToggleSkyColor()
// FUNCTION: BETA10 0x10086984
void LegoBackgroundColor::SetLightColor(float p_r, float p_g, float p_b)
{
if (!VideoManager()->GetVideoParam().Flags().GetF2bit0()) {
if (!VideoManager()->GetVideoParam().Flags().GetLacksLightSupport()) {
// TODO: Computed constants based on what?
p_r *= 1. / 0.23;
p_g *= 1. / 0.63;
@ -1407,7 +1407,7 @@ MxResult LegoGameState::ScoreItem::Serialize(LegoStorage* p_storage)
}
m_name.Serialize(p_storage);
p_storage->ReadS16(m_unk0x2a);
p_storage->ReadS16(m_playerId);
}
else if (p_storage->IsWriteMode()) {
p_storage->WriteS16(m_totalScore);
@ -1419,7 +1419,7 @@ MxResult LegoGameState::ScoreItem::Serialize(LegoStorage* p_storage)
}
m_name.Serialize(p_storage);
p_storage->WriteS16(m_unk0x2a);
p_storage->WriteS16(m_playerId);
}
return SUCCESS;
@ -1430,7 +1430,7 @@ MxResult LegoGameState::ScoreItem::Serialize(LegoStorage* p_storage)
LegoGameState::History::History()
{
m_count = 0;
m_unk0x372 = 0;
m_nextPlayerId = 0;
}
// FUNCTION: LEGO1 0x1003c870
@ -1441,83 +1441,128 @@ void LegoGameState::History::WriteScoreHistory()
MxU8 scores[5][5];
InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState");
if (state->m_letters[0]) {
JetskiRaceState* jetskiRaceState = (JetskiRaceState*) GameState()->GetState("JetskiRaceState");
CarRaceState* carRaceState = (CarRaceState*) GameState()->GetState("CarRaceState");
TowTrackMissionState* towTrackMissionState =
(TowTrackMissionState*) GameState()->GetState("TowTrackMissionState");
PizzaMissionState* pizzaMissionState = (PizzaMissionState*) GameState()->GetState("PizzaMissionState");
AmbulanceMissionState* ambulanceMissionState =
(AmbulanceMissionState*) GameState()->GetState("AmbulanceMissionState");
for (MxS32 actor = 1; actor <= 5; actor++) {
scores[0][actor - 1] = carRaceState ? carRaceState->GetState(actor)->GetHighScore() : 0;
totalScore += scores[0][actor - 1];
if (!state->m_letters[0]) {
return;
}
scores[1][actor - 1] = jetskiRaceState ? jetskiRaceState->GetState(actor)->GetHighScore() : 0;
totalScore += scores[1][actor - 1];
JetskiRaceState* jetskiRaceState = (JetskiRaceState*) GameState()->GetState("JetskiRaceState");
CarRaceState* carRaceState = (CarRaceState*) GameState()->GetState("CarRaceState");
TowTrackMissionState* towTrackMissionState = (TowTrackMissionState*) GameState()->GetState("TowTrackMissionState");
PizzaMissionState* pizzaMissionState = (PizzaMissionState*) GameState()->GetState("PizzaMissionState");
AmbulanceMissionState* ambulanceMissionState =
(AmbulanceMissionState*) GameState()->GetState("AmbulanceMissionState");
scores[2][actor - 1] = pizzaMissionState ? pizzaMissionState->GetHighScore(actor) : 0;
totalScore += scores[2][actor - 1];
for (MxS32 actor = 1; actor <= 5; actor++) {
scores[0][actor - 1] = carRaceState ? carRaceState->GetState(actor)->GetHighScore() : 0;
totalScore += scores[0][actor - 1];
scores[3][actor - 1] = towTrackMissionState ? towTrackMissionState->GetHighScore(actor) : 0;
totalScore += scores[3][actor - 1];
#ifdef BETA10
// likely a bug in BETA10
scores[1][actor - 1] = carRaceState ? carRaceState->GetState(actor)->GetHighScore() : 0;
#else
scores[1][actor - 1] = jetskiRaceState ? jetskiRaceState->GetState(actor)->GetHighScore() : 0;
#endif
totalScore += scores[1][actor - 1];
scores[4][actor - 1] = ambulanceMissionState ? ambulanceMissionState->GetHighScore(actor) : 0;
totalScore += scores[4][actor - 1];
}
scores[2][actor - 1] = pizzaMissionState ? pizzaMissionState->GetHighScore(actor) : 0;
totalScore += scores[2][actor - 1];
MxS32 unk0x2c;
ScoreItem* p_scorehist = FUN_1003cc90(&GameState()->m_players[0], GameState()->m_unk0x24, unk0x2c);
scores[3][actor - 1] = towTrackMissionState ? towTrackMissionState->GetHighScore(actor) : 0;
totalScore += scores[3][actor - 1];
if (p_scorehist != NULL) {
p_scorehist->m_totalScore = totalScore;
memcpy(p_scorehist->m_scores, scores, sizeof(p_scorehist->m_scores));
}
else {
if (m_count < (MxS16) sizeOfArray(m_scores)) {
m_scores[m_count].m_totalScore = totalScore;
memcpy(m_scores[m_count].m_scores, scores, sizeof(m_scores[m_count].m_scores));
m_scores[m_count].m_name = GameState()->m_players[0];
m_scores[m_count].m_unk0x2a = GameState()->m_unk0x24;
m_count++;
}
else if (m_scores[19].m_totalScore <= totalScore) {
m_scores[19].m_totalScore = totalScore;
memcpy(m_scores[19].m_scores, scores, sizeof(m_scores[19].m_scores));
m_scores[19].m_name = GameState()->m_players[0];
m_scores[19].m_unk0x2a = GameState()->m_unk0x24;
scores[4][actor - 1] = ambulanceMissionState ? ambulanceMissionState->GetHighScore(actor) : 0;
totalScore += scores[4][actor - 1];
}
MxS32 playerScoreHistoryIndex;
ScoreItem* p_scorehist =
FindPlayerInScoreHistory(GameState()->m_players, GameState()->m_currentPlayerId, playerScoreHistoryIndex);
#ifdef BETA10
if (!p_scorehist) {
MxS32 playerScoreRank;
// LINE: BETA10 0x100870ee
for (playerScoreRank = 0; playerScoreRank < m_count; playerScoreRank++) {
if (totalScore > m_scores[m_indices[playerScoreRank]].m_totalScore) {
break;
}
}
// LINE: BETA10 0x1008713f
if (playerScoreRank < m_count) {
if (m_count < 20) {
playerScoreHistoryIndex = m_count++;
}
else {
playerScoreHistoryIndex = m_indices[19];
}
MxU8 tmpScores[5][5];
Username tmpPlayer;
MxS16 tmpUnk0x2a;
MxS32 max = m_count - 1;
for (MxS32 j = max; playerScoreRank < j; j--) {
m_indices[j - 1] = m_indices[j - 2];
}
// TODO: Match bubble sort loops
for (MxS32 i = m_count - 1; i > 0; i--) {
for (MxS32 j = 1; j <= i; j++) {
if (m_scores[j - 1].m_totalScore < m_scores[j].m_totalScore) {
memcpy(tmpScores, m_scores[j - 1].m_scores, sizeof(tmpScores));
tmpPlayer = m_scores[j - 1].m_name;
tmpUnk0x2a = m_scores[j - 1].m_unk0x2a;
m_indices[playerScoreRank] = playerScoreHistoryIndex;
p_scorehist = &m_scores[playerScoreHistoryIndex];
}
else if (playerScoreRank < 20) {
m_indices[m_count] = m_count;
p_scorehist = &m_scores[m_count++];
}
}
else if (p_scorehist->m_totalScore != totalScore) {
assert(totalScore > p_scorehist->m_totalScore);
memcpy(m_scores[j - 1].m_scores, m_scores[j].m_scores, sizeof(m_scores[j - 1].m_scores));
m_scores[j - 1].m_name = m_scores[j].m_name;
m_scores[j - 1].m_unk0x2a = m_scores[j].m_unk0x2a;
for (MxS32 i = playerScoreHistoryIndex; i > 0 && m_indices[i - 1] < m_indices[i]; i--) {
MxU8 tmp = m_indices[i - 1];
m_indices[i - 1] = m_indices[i];
m_indices[i] = tmp;
}
}
if (p_scorehist) {
p_scorehist->m_totalScore = totalScore;
memcpy(p_scorehist->m_scores[0], scores[0], sizeof(scores));
p_scorehist->m_name = GameState()->m_players[0];
p_scorehist->m_playerId = GameState()->m_currentPlayerId;
}
#else
if (p_scorehist != NULL) {
p_scorehist->m_totalScore = totalScore;
memcpy(p_scorehist->m_scores, scores, sizeof(p_scorehist->m_scores));
}
else {
if (m_count < (MxS16) sizeOfArray(m_scores)) {
m_scores[m_count].m_totalScore = totalScore;
memcpy(m_scores[m_count].m_scores, scores, sizeof(m_scores[m_count].m_scores));
m_scores[m_count].m_name = GameState()->m_players[0];
m_scores[m_count].m_playerId = GameState()->m_currentPlayerId;
m_count++;
}
else if (m_scores[19].m_totalScore <= totalScore) {
m_scores[19].m_totalScore = totalScore;
memcpy(m_scores[19].m_scores, scores, sizeof(m_scores[19].m_scores));
m_scores[19].m_name = GameState()->m_players[0];
m_scores[19].m_playerId = GameState()->m_currentPlayerId;
}
}
memcpy(m_scores[j].m_scores, tmpScores, sizeof(m_scores[j].m_scores));
m_scores[j].m_name = tmpPlayer;
m_scores[j].m_unk0x2a = tmpUnk0x2a;
}
ScoreItem tmpItem;
for (MxS32 i = m_count - 1; i >= 0; i--) {
for (MxS32 j = 1; j <= i; j++) {
if (m_scores[j].m_totalScore > m_scores[j - 1].m_totalScore) {
tmpItem = m_scores[j - 1];
m_scores[j - 1] = m_scores[j];
m_scores[j] = tmpItem;
}
}
}
#endif
}
// FUNCTION: LEGO1 0x1003cc90
// FUNCTION: BETA10 0x1008732a
LegoGameState::ScoreItem* LegoGameState::History::FUN_1003cc90(
LegoGameState::ScoreItem* LegoGameState::History::FindPlayerInScoreHistory(
LegoGameState::Username* p_player,
MxS16 p_unk0x24,
MxS32& p_unk0x2c
@ -1525,7 +1570,7 @@ LegoGameState::ScoreItem* LegoGameState::History::FUN_1003cc90(
{
MxS32 i = 0;
for (; i < m_count; i++) {
if (!memcmp(p_player, &m_scores[i].m_name, sizeof(*p_player)) && m_scores[i].m_unk0x2a == p_unk0x24) {
if (!memcmp(p_player, &m_scores[i].m_name, sizeof(*p_player)) && m_scores[i].m_playerId == p_unk0x24) {
break;
}
}
@ -1544,7 +1589,7 @@ LegoGameState::ScoreItem* LegoGameState::History::FUN_1003cc90(
MxResult LegoGameState::History::Serialize(LegoStorage* p_storage)
{
if (p_storage->IsReadMode()) {
p_storage->ReadS16(m_unk0x372);
p_storage->ReadS16(m_nextPlayerId);
p_storage->ReadS16(m_count);
for (MxS16 i = 0; i < m_count; i++) {
@ -1554,7 +1599,7 @@ MxResult LegoGameState::History::Serialize(LegoStorage* p_storage)
}
}
else if (p_storage->IsWriteMode()) {
p_storage->WriteS16(m_unk0x372);
p_storage->WriteS16(m_nextPlayerId);
p_storage->WriteS16(m_count);
for (MxS16 i = 0; i < m_count; i++) {
@ -1584,6 +1629,7 @@ void LegoGameState::SerializeScoreHistory(MxS16 p_flags)
}
// FUNCTION: LEGO1 0x1003cea0
// FUNCTION: BETA10 0x10017840
void LegoGameState::SetCurrentAct(Act p_currentAct)
{
m_currentAct = p_currentAct;

View File

@ -8,39 +8,39 @@ LegoPhoneme::~LegoPhoneme()
}
// FUNCTION: LEGO1 0x10044eb0
undefined4 LegoPhoneme::VTable0x00()
MxU32 LegoPhoneme::GetCount()
{
return m_unk0x14;
return m_count;
}
// FUNCTION: LEGO1 0x10044ec0
void LegoPhoneme::VTable0x04(undefined4 p_unk0x14)
void LegoPhoneme::SetCount(MxU32 p_count)
{
m_unk0x14 = p_unk0x14;
m_count = p_count;
}
// FUNCTION: LEGO1 0x10044ed0
LegoTextureInfo* LegoPhoneme::VTable0x08()
LegoTextureInfo* LegoPhoneme::GetTextureInfo()
{
return m_unk0x18;
return m_textureInfo;
}
// FUNCTION: LEGO1 0x10044ee0
void LegoPhoneme::VTable0x0c(LegoTextureInfo* p_unk0x18)
void LegoPhoneme::SetTextureInfo(LegoTextureInfo* p_textureInfo)
{
m_unk0x18 = p_unk0x18;
m_textureInfo = p_textureInfo;
}
// FUNCTION: LEGO1 0x10044ef0
LegoTextureInfo* LegoPhoneme::VTable0x10()
LegoTextureInfo* LegoPhoneme::GetCachedTextureInfo()
{
return m_unk0x1c;
return m_cachedTextureInfo;
}
// FUNCTION: LEGO1 0x10044f00
void LegoPhoneme::VTable0x14(LegoTextureInfo* p_unk0x1c)
void LegoPhoneme::SetCachedTextureInfo(LegoTextureInfo* p_cachedTextureInfo)
{
m_unk0x1c = p_unk0x1c;
m_cachedTextureInfo = p_cachedTextureInfo;
}
// FUNCTION: LEGO1 0x10044f10
@ -51,9 +51,9 @@ void LegoPhoneme::VTable0x18()
// FUNCTION: LEGO1 0x10044f20
void LegoPhoneme::Init()
{
m_unk0x14 = 0;
m_unk0x18 = NULL;
m_unk0x1c = NULL;
m_count = 0;
m_textureInfo = NULL;
m_cachedTextureInfo = NULL;
}
// FUNCTION: LEGO1 0x10044f30

View File

@ -31,19 +31,19 @@ const char* g_plantLodNames[4][5] = {
};
// GLOBAL: LEGO1 0x100f16b0
float g_unk0x100f16b0[] = {0.1f, 0.7f, 0.5f, 0.9f};
float g_heightPerCount[] = {0.1f, 0.7f, 0.5f, 0.9f};
// GLOBAL: LEGO1 0x100f16c0
MxU8 g_unk0x100f16c0[] = {1, 2, 2, 3};
MxU8 g_counters[] = {1, 2, 2, 3};
// GLOBAL: LEGO1 0x100f315c
MxU32 LegoPlantManager::g_maxSound = 8;
// GLOBAL: LEGO1 0x100f3160
MxU32 g_unk0x100f3160 = 56;
MxU32 g_plantSoundIdOffset = 56;
// GLOBAL: LEGO1 0x100f3164
MxU32 g_unk0x100f3164 = 66;
MxU32 g_plantSoundIdMoodOffset = 66;
// GLOBAL: LEGO1 0x100f3168
MxS32 LegoPlantManager::g_maxMove[4] = {3, 3, 3, 3};
@ -83,7 +83,7 @@ void LegoPlantManager::Init()
}
m_worldId = LegoOmni::e_undefined;
m_unk0x0c = 0;
m_boundariesDetermined = FALSE;
m_numEntries = 0;
}
@ -98,7 +98,7 @@ void LegoPlantManager::LoadWorldInfo(LegoOmni::World p_worldId)
CreatePlant(i, world, p_worldId);
}
m_unk0x0c = 0;
m_boundariesDetermined = FALSE;
}
// FUNCTION: LEGO1 0x100263a0
@ -119,12 +119,12 @@ void LegoPlantManager::Reset(LegoOmni::World p_worldId)
}
m_worldId = LegoOmni::e_undefined;
m_unk0x0c = 0;
m_boundariesDetermined = FALSE;
}
// FUNCTION: LEGO1 0x10026410
// FUNCTION: BETA10 0x100c50e9
MxResult LegoPlantManager::FUN_10026410()
MxResult LegoPlantManager::DetermineBoundaries()
{
// similar to LegoBuildingManager::FUN_10030630()
@ -160,7 +160,7 @@ MxResult LegoPlantManager::FUN_10026410()
}
if (g_plantInfo[i].m_boundary != NULL) {
Mx4DPointFloat& unk0x14 = *g_plantInfo[i].m_boundary->GetUnknown0x14();
Mx4DPointFloat& unk0x14 = *g_plantInfo[i].m_boundary->GetUp();
if (position.Dot(position, unk0x14) + unk0x14.index_operator(3) > 0.001 ||
position.Dot(position, unk0x14) + unk0x14.index_operator(3) < -0.001) {
@ -192,7 +192,7 @@ MxResult LegoPlantManager::FUN_10026410()
}
}
m_unk0x0c = TRUE;
m_boundariesDetermined = TRUE;
return SUCCESS;
}
@ -200,8 +200,8 @@ MxResult LegoPlantManager::FUN_10026410()
// FUNCTION: BETA10 0x100c55e0
LegoPlantInfo* LegoPlantManager::GetInfoArray(MxS32& p_length)
{
if (!m_unk0x0c) {
FUN_10026410();
if (!m_boundariesDetermined) {
DetermineBoundaries();
}
p_length = sizeOfArray(g_plantInfo);
@ -217,7 +217,7 @@ LegoEntity* LegoPlantManager::CreatePlant(MxS32 p_index, LegoWorld* p_world, Leg
if (p_index < sizeOfArray(g_plantInfo)) {
MxU32 world = 1 << (MxU8) p_worldId;
if (g_plantInfo[p_index].m_worlds & world && g_plantInfo[p_index].m_unk0x16 != 0) {
if (g_plantInfo[p_index].m_worlds & world && g_plantInfo[p_index].m_counter != 0) {
if (g_plantInfo[p_index].m_entity == NULL) {
char name[256];
char lodName[256];
@ -285,7 +285,7 @@ MxResult LegoPlantManager::Write(LegoStorage* p_storage)
if (p_storage->Write(&info->m_color, sizeof(info->m_color)) != SUCCESS) {
goto done;
}
if (p_storage->Write(&info->m_initialUnk0x16, sizeof(info->m_initialUnk0x16)) != SUCCESS) {
if (p_storage->Write(&info->m_initialCounter, sizeof(info->m_initialCounter)) != SUCCESS) {
goto done;
}
}
@ -305,27 +305,27 @@ MxResult LegoPlantManager::Read(LegoStorage* p_storage)
for (MxS32 i = 0; i < sizeOfArray(g_plantInfo); i++) {
LegoPlantInfo* info = &g_plantInfo[i];
if (p_storage->Read(&info->m_variant, sizeof(info->m_variant)) != SUCCESS) {
if (p_storage->Read(&info->m_variant, sizeof(MxU8)) != SUCCESS) {
goto done;
}
if (p_storage->Read(&info->m_sound, sizeof(info->m_sound)) != SUCCESS) {
if (p_storage->Read(&info->m_sound, sizeof(MxU32)) != SUCCESS) {
goto done;
}
if (p_storage->Read(&info->m_move, sizeof(info->m_move)) != SUCCESS) {
if (p_storage->Read(&info->m_move, sizeof(MxU32)) != SUCCESS) {
goto done;
}
if (p_storage->Read(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) {
if (p_storage->Read(&info->m_mood, sizeof(MxU8)) != SUCCESS) {
goto done;
}
if (p_storage->Read(&info->m_color, sizeof(info->m_color)) != SUCCESS) {
if (p_storage->Read(&info->m_color, sizeof(MxU8)) != SUCCESS) {
goto done;
}
if (p_storage->Read(&info->m_unk0x16, sizeof(info->m_unk0x16)) != SUCCESS) {
if (p_storage->Read(&info->m_counter, sizeof(MxS8)) != SUCCESS) {
goto done;
}
info->m_initialUnk0x16 = info->m_unk0x16;
FUN_10026860(i);
info->m_initialCounter = info->m_counter;
AdjustHeight(i);
}
result = SUCCESS;
@ -336,13 +336,13 @@ MxResult LegoPlantManager::Read(LegoStorage* p_storage)
// FUNCTION: LEGO1 0x10026860
// FUNCTION: BETA10 0x100c5be0
void LegoPlantManager::FUN_10026860(MxS32 p_index)
void LegoPlantManager::AdjustHeight(MxS32 p_index)
{
MxU8 variant = g_plantInfo[p_index].m_variant;
if (g_plantInfo[p_index].m_unk0x16 >= 0) {
float value = g_unk0x100f16c0[variant] - g_plantInfo[p_index].m_unk0x16;
g_plantInfo[p_index].m_position[1] = g_plantInfoInit[p_index].m_position[1] - value * g_unk0x100f16b0[variant];
if (g_plantInfo[p_index].m_counter >= 0) {
float value = g_counters[variant] - g_plantInfo[p_index].m_counter;
g_plantInfo[p_index].m_position[1] = g_plantInfoInit[p_index].m_position[1] - value * g_heightPerCount[variant];
}
else {
g_plantInfo[p_index].m_position[1] = g_plantInfoInit[p_index].m_position[1];
@ -394,13 +394,13 @@ MxBool LegoPlantManager::SwitchColor(LegoEntity* p_entity)
ViewLODList* lodList = GetViewLODListManager()->Lookup(g_plantLodNames[info->m_variant][info->m_color]);
if (roi->GetUnknown0xe0() >= 0) {
if (roi->GetLodLevel() >= 0) {
VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->RemoveROIDetailFromScene(roi);
}
roi->SetLODList(lodList);
lodList->Release();
CharacterManager()->FUN_10085870(roi);
CharacterManager()->UpdateBoundingSphereAndBox(roi);
return TRUE;
}
@ -410,7 +410,7 @@ MxBool LegoPlantManager::SwitchVariant(LegoEntity* p_entity)
{
LegoPlantInfo* info = GetInfo(p_entity);
if (info == NULL || info->m_unk0x16 != -1) {
if (info == NULL || info->m_counter != -1) {
return FALSE;
}
@ -423,13 +423,13 @@ MxBool LegoPlantManager::SwitchVariant(LegoEntity* p_entity)
ViewLODList* lodList = GetViewLODListManager()->Lookup(g_plantLodNames[info->m_variant][info->m_color]);
if (roi->GetUnknown0xe0() >= 0) {
if (roi->GetLodLevel() >= 0) {
VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->RemoveROIDetailFromScene(roi);
}
roi->SetLODList(lodList);
lodList->Release();
CharacterManager()->FUN_10085870(roi);
CharacterManager()->UpdateBoundingSphereAndBox(roi);
if (info->m_move != 0 && info->m_move >= g_maxMove[info->m_variant]) {
info->m_move = g_maxMove[info->m_variant] - 1;
@ -513,16 +513,16 @@ MxU32 LegoPlantManager::GetAnimationId(LegoEntity* p_entity)
// FUNCTION: LEGO1 0x10026ba0
// FUNCTION: BETA10 0x100c61ba
MxU32 LegoPlantManager::GetSoundId(LegoEntity* p_entity, MxBool p_state)
MxU32 LegoPlantManager::GetSoundId(LegoEntity* p_entity, MxBool p_basedOnMood)
{
LegoPlantInfo* info = GetInfo(p_entity);
if (p_state) {
return (info->m_mood & 1) + g_unk0x100f3164;
if (p_basedOnMood) {
return (info->m_mood & 1) + g_plantSoundIdMoodOffset;
}
if (info != NULL) {
return info->m_sound + g_unk0x100f3160;
return info->m_sound + g_plantSoundIdOffset;
}
return 0;
@ -550,7 +550,7 @@ void LegoPlantManager::SetCustomizeAnimFile(const char* p_value)
// FUNCTION: LEGO1 0x10026c50
// FUNCTION: BETA10 0x100c6349
MxBool LegoPlantManager::FUN_10026c50(LegoEntity* p_entity)
MxBool LegoPlantManager::DecrementCounter(LegoEntity* p_entity)
{
LegoPlantInfo* info = GetInfo(p_entity);
@ -558,12 +558,12 @@ MxBool LegoPlantManager::FUN_10026c50(LegoEntity* p_entity)
return FALSE;
}
return FUN_10026c80(info - g_plantInfo);
return DecrementCounter(info - g_plantInfo);
}
// FUNCTION: LEGO1 0x10026c80
// FUNCTION: BETA10 0x100c63eb
MxBool LegoPlantManager::FUN_10026c80(MxS32 p_index)
MxBool LegoPlantManager::DecrementCounter(MxS32 p_index)
{
if (p_index >= sizeOfArray(g_plantInfo)) {
return FALSE;
@ -577,23 +577,23 @@ MxBool LegoPlantManager::FUN_10026c80(MxS32 p_index)
MxBool result = TRUE;
if (info->m_unk0x16 < 0) {
info->m_unk0x16 = g_unk0x100f16c0[info->m_variant];
if (info->m_counter < 0) {
info->m_counter = g_counters[info->m_variant];
}
if (info->m_unk0x16 > 0) {
if (info->m_counter > 0) {
LegoROI* roi = info->m_entity->GetROI();
info->m_unk0x16--;
info->m_counter--;
if (info->m_unk0x16 == 1) {
info->m_unk0x16 = 0;
if (info->m_counter == 1) {
info->m_counter = 0;
}
if (info->m_unk0x16 == 0) {
if (info->m_counter == 0) {
roi->SetVisibility(FALSE);
}
else {
FUN_10026860(info - g_plantInfo);
AdjustHeight(info - g_plantInfo);
info->m_entity->SetLocation(info->m_position, info->m_direction, info->m_up, FALSE);
}
}
@ -623,7 +623,7 @@ void LegoPlantManager::ScheduleAnimation(LegoEntity* p_entity, MxLong p_length)
time += p_length;
entry->m_time = time + 1000;
FUN_100271b0(p_entity, -1);
AdjustCounter(p_entity, -1);
}
// FUNCTION: LEGO1 0x10026e00
@ -666,17 +666,17 @@ MxResult LegoPlantManager::Tickle()
SET3(locald8[3], localec);
entry->m_roi->FUN_100a58f0(locald8);
entry->m_roi->VTable0x14();
entry->m_roi->SetLocal2World(locald8);
entry->m_roi->WrappedUpdateWorldData();
if (entry->m_time < time) {
LegoPlantInfo* info = GetInfo(entry->m_entity);
if (info->m_unk0x16 == 0) {
if (info->m_counter == 0) {
entry->m_roi->SetVisibility(FALSE);
}
else {
FUN_10026860(info - g_plantInfo);
AdjustHeight(info - g_plantInfo);
info->m_entity->SetLocation(info->m_position, info->m_direction, info->m_up, FALSE);
}
@ -699,14 +699,14 @@ MxResult LegoPlantManager::Tickle()
}
// FUNCTION: LEGO1 0x10027120
void LegoPlantManager::FUN_10027120()
void LegoPlantManager::ClearCounters()
{
LegoWorld* world = CurrentWorld();
for (MxS32 i = 0; i < sizeOfArray(g_plantInfo); i++) {
g_plantInfo[i].m_unk0x16 = -1;
g_plantInfo[i].m_initialUnk0x16 = -1;
FUN_10026860(i);
g_plantInfo[i].m_counter = -1;
g_plantInfo[i].m_initialCounter = -1;
AdjustHeight(i);
if (g_plantInfo[i].m_entity != NULL) {
g_plantInfo[i].m_entity->SetLocation(
@ -720,28 +720,28 @@ void LegoPlantManager::FUN_10027120()
}
// FUNCTION: LEGO1 0x100271b0
void LegoPlantManager::FUN_100271b0(LegoEntity* p_entity, MxS32 p_adjust)
void LegoPlantManager::AdjustCounter(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_counter < 0) {
info->m_counter = g_counters[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;
if (info->m_counter > 0) {
info->m_counter += p_adjust;
if (info->m_counter <= 1 && p_adjust < 0) {
info->m_counter = 0;
}
}
}
}
// FUNCTION: LEGO1 0x10027200
void LegoPlantManager::FUN_10027200()
void LegoPlantManager::SetInitialCounters()
{
for (MxU32 i = 0; i < sizeOfArray(g_plantInfo); i++) {
g_plantInfo[i].m_initialUnk0x16 = g_plantInfo[i].m_unk0x16;
g_plantInfo[i].m_initialCounter = g_plantInfo[i].m_counter;
}
}

View File

@ -65,7 +65,7 @@ LegoTextureInfo* LegoTextureInfo::Create(const char* p_name, LegoTexture* p_text
desc.dwFlags = DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS;
desc.dwWidth = image->GetWidth();
desc.dwHeight = image->GetHeight();
desc.ddsCaps.dwCaps = DDCAPS_OVERLAYCANTCLIP | DDCAPS_OVERLAY;
desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_SYSTEMMEMORY;
desc.ddpfPixelFormat.dwSize = sizeof(desc.ddpfPixelFormat);
desc.ddpfPixelFormat.dwFlags = DDPF_RGB | DDPF_PALETTEINDEXED8;
desc.ddpfPixelFormat.dwRGBBitCount = 8;
@ -112,7 +112,7 @@ LegoTextureInfo* LegoTextureInfo::Create(const char* p_name, LegoTexture* p_text
entries[i].peBlue = image->GetPaletteEntry(i).GetBlue();
}
else {
entries[i].peFlags = 0x80;
entries[i].peFlags = D3DPAL_RESERVED;
}
}
@ -186,14 +186,14 @@ BOOL LegoTextureInfo::GetGroupTexture(Tgl::Mesh* pMesh, LegoTextureInfo*& p_text
}
// FUNCTION: LEGO1 0x10066010
LegoResult LegoTextureInfo::FUN_10066010(const LegoU8* p_bits)
LegoResult LegoTextureInfo::LoadBits(const LegoU8* p_bits)
{
if (m_surface != NULL && m_texture != NULL) {
DDSURFACEDESC desc;
memset(&desc, 0, sizeof(desc));
desc.dwSize = sizeof(desc);
if (m_surface->Lock(NULL, &desc, 0, NULL) == DD_OK) {
if (m_surface->Lock(NULL, &desc, DDLOCK_SURFACEMEMORYPTR, NULL) == DD_OK) {
MxU8* surface = (MxU8*) desc.lpSurface;
const LegoU8* bits = p_bits;

View File

@ -86,7 +86,7 @@ void RotateY(LegoROI* p_roi, MxFloat p_angle)
mat[i][2] = (local2world[i][2] * fcos) - (local2world[i][0] * fsin);
}
p_roi->WrappedSetLocalTransform(mat);
p_roi->WrappedSetLocal2WorldWithWorldDataUpdate(mat);
}
// FUNCTION: LEGO1 0x1003de80
@ -99,29 +99,29 @@ MxBool SpheresIntersect(const BoundingSphere& p_sphere1, const BoundingSphere& p
// FUNCTION: LEGO1 0x1003ded0
// FUNCTION: BETA10 0x100d3802
MxBool FUN_1003ded0(MxFloat p_param1[2], MxFloat p_param2[3], MxFloat p_param3[3])
MxBool CalculateRayOriginDirection(MxFloat p_coordinates[2], MxFloat p_direction[3], MxFloat p_origin[3])
{
MxFloat local1c[4];
MxFloat local10[3];
MxFloat screenPoint[4];
MxFloat farPoint[3];
Tgl::View* view = VideoManager()->Get3DManager()->GetLego3DView()->GetView();
local1c[0] = p_param1[0];
local1c[1] = p_param1[1];
local1c[2] = 1.0f;
local1c[3] = 1.0f;
screenPoint[0] = p_coordinates[0];
screenPoint[1] = p_coordinates[1];
screenPoint[2] = 1.0f;
screenPoint[3] = 1.0f;
view->TransformScreenToWorld(local1c, p_param3);
view->TransformScreenToWorld(screenPoint, p_origin);
local1c[0] *= 2.0;
local1c[1] *= 2.0;
local1c[3] = 2.0;
screenPoint[0] *= 2.0;
screenPoint[1] *= 2.0;
screenPoint[3] = 2.0;
view->TransformScreenToWorld(local1c, local10);
view->TransformScreenToWorld(screenPoint, farPoint);
p_param2[0] = local10[0] - p_param3[0];
p_param2[1] = local10[1] - p_param3[1];
p_param2[2] = local10[2] - p_param3[2];
p_direction[0] = farPoint[0] - p_origin[0];
p_direction[1] = farPoint[1] - p_origin[1];
p_direction[2] = farPoint[2] - p_origin[2];
return TRUE;
}
@ -173,7 +173,7 @@ LegoTreeNode* GetTreeNode(LegoTreeNode* p_node, MxU32 p_index)
// FUNCTION: LEGO1 0x1003e050
// FUNCTION: BETA10 0x100d3abc
void FUN_1003e050(LegoAnimPresenter* p_presenter)
void CalculateViewFromAnimation(LegoAnimPresenter* p_presenter)
{
MxMatrix viewMatrix;
LegoTreeNode* rootNode = p_presenter->GetAnimation()->GetRoot();
@ -181,7 +181,7 @@ void FUN_1003e050(LegoAnimPresenter* p_presenter)
LegoAnimNodeData* targetData = NULL;
MxS16 nodesCount = CountTotalTreeNodes(rootNode);
MxFloat cam;
MxFloat fov;
for (MxS16 i = 0; i < nodesCount; i++) {
if (camData && targetData) {
break;
@ -191,7 +191,7 @@ void FUN_1003e050(LegoAnimPresenter* p_presenter)
if (!strnicmp(data->GetName(), "CAM", strlen("CAM"))) {
camData = data;
cam = atof(&data->GetName()[strlen(data->GetName()) - 2]);
fov = atof(&data->GetName()[strlen(data->GetName()) - 2]);
}
else if (!strcmpi(data->GetName(), "TARGET")) {
targetData = data;
@ -218,10 +218,10 @@ void FUN_1003e050(LegoAnimPresenter* p_presenter)
LegoROI* roi = video->GetViewROI();
Lego3DView* view = video->Get3DManager()->GetLego3DView();
roi->WrappedSetLocalTransform(viewMatrix);
roi->WrappedSetLocal2WorldWithWorldDataUpdate(viewMatrix);
view->Moved(*roi);
FUN_1003eda0();
video->Get3DManager()->SetFrustrum(cam, 0.1, 250.0);
ResetViewVelocity();
video->Get3DManager()->SetFrustrum(fov, 0.1, 250.0);
}
// FUNCTION: LEGO1 0x1003e300
@ -473,14 +473,14 @@ void PlayCamAnim(LegoPathActor* p_actor, MxBool p_unused, MxU32 p_location, MxBo
// FUNCTION: LEGO1 0x1003eda0
// FUNCTION: BETA10 0x100d4bf4
void FUN_1003eda0()
void ResetViewVelocity()
{
Mx3DPointFloat vec;
vec.Clear();
LegoROI* viewROI = VideoManager()->GetViewROI();
if (viewROI) {
viewROI->FUN_100a5a30(vec);
viewROI->SetWorldVelocity(vec);
SoundManager()->UpdateListener(
viewROI->GetWorldPosition(),
viewROI->GetWorldDirection(),
@ -507,7 +507,7 @@ MxBool RemoveFromCurrentWorld(const MxAtomId& p_atomId, MxS32 p_id)
}
else {
if (((MxPresenter*) object)->GetAction()) {
FUN_100b7220(((MxPresenter*) object)->GetAction(), MxDSAction::c_world, FALSE);
ApplyMask(((MxPresenter*) object)->GetAction(), MxDSAction::c_world, FALSE);
}
((MxPresenter*) object)->EndAction();
@ -536,7 +536,7 @@ MxBool RemoveFromWorld(MxAtomId& p_entityAtom, MxS32 p_entityId, MxAtomId& p_wor
}
else {
if (((MxPresenter*) object)->GetAction()) {
FUN_100b7220(((MxPresenter*) object)->GetAction(), MxDSAction::c_world, FALSE);
ApplyMask(((MxPresenter*) object)->GetAction(), MxDSAction::c_world, FALSE);
}
((MxPresenter*) object)->EndAction();
@ -565,11 +565,11 @@ void EnableAnimations(MxBool p_enable)
// FUNCTION: LEGO1 0x1003ef40
void SetAppCursor(Cursor p_cursor)
{
PostMessageA(MxOmni::GetInstance()->GetWindowHandle(), WM_ISLE_SETCURSOR, p_cursor, 0);
PostMessage(MxOmni::GetInstance()->GetWindowHandle(), WM_ISLE_SETCURSOR, p_cursor, 0);
}
// FUNCTION: LEGO1 0x1003ef60
MxBool FUN_1003ef60()
MxBool CanExit()
{
Act1State* act1State = (Act1State*) GameState()->GetState("Act1State");
@ -705,14 +705,14 @@ void WriteDefaultTexture(LegoStorage* p_storage, const char* p_name)
if (image != NULL) {
if (desc.dwWidth == desc.lPitch) {
memcpy(desc.lpSurface, image->GetBits(), desc.dwWidth * desc.dwHeight);
memcpy(image->GetBits(), desc.lpSurface, desc.dwWidth * desc.dwHeight);
}
else {
MxU8* surface = (MxU8*) desc.lpSurface;
const LegoU8* bits = image->GetBits();
LegoU8* bits = image->GetBits();
for (MxS32 i = 0; i < desc.dwHeight; i++) {
memcpy(surface, bits, desc.dwWidth);
memcpy(bits, surface, desc.dwWidth);
surface += desc.lPitch;
bits += desc.dwWidth;
}
@ -765,11 +765,11 @@ void WriteNamedTexture(LegoStorage* p_storage, LegoNamedTexture* p_namedTexture)
}
// FUNCTION: LEGO1 0x1003f930
void FUN_1003f930(LegoNamedTexture* p_namedTexture)
void LoadFromNamedTexture(LegoNamedTexture* p_namedTexture)
{
LegoTextureInfo* textureInfo = TextureContainer()->Get(p_namedTexture->GetName()->GetData());
if (textureInfo != NULL) {
textureInfo->FUN_10066010(p_namedTexture->GetTexture()->GetImage()->GetBits());
textureInfo->LoadBits(p_namedTexture->GetTexture()->GetImage()->GetBits());
}
}

View File

@ -1,6 +1,7 @@
#include "legovariables.h"
#include "3dmanager/lego3dmanager.h"
#include "legoactor.h"
#include "legogamestate.h"
#include "legonavcontroller.h"
#include "legovideomanager.h"
@ -157,18 +158,18 @@ void WhoAmIVariable::SetValue(const char* p_value)
MxVariable::SetValue(p_value);
if (!strcmpi(p_value, g_papa)) {
GameState()->SetActorId(3);
GameState()->SetActorId(LegoActor::c_papa);
}
else if (!strcmpi(p_value, g_mama)) {
GameState()->SetActorId(2);
GameState()->SetActorId(LegoActor::c_mama);
}
else if (!strcmpi(p_value, g_pepper)) {
GameState()->SetActorId(1);
GameState()->SetActorId(LegoActor::c_pepper);
}
else if (!strcmpi(p_value, g_nick)) {
GameState()->SetActorId(4);
GameState()->SetActorId(LegoActor::c_nick);
}
else if (!strcmpi(p_value, g_laura)) {
GameState()->SetActorId(5);
GameState()->SetActorId(LegoActor::c_laura);
}
}

View File

@ -84,7 +84,7 @@ MxResult MxCompositeMediaPresenter::StartAction(MxStreamController* p_controller
if (!m_compositePresenter) {
SetTickleState(e_ready);
MxLong time = Timer()->GetTime();
m_action->SetUnknown90(time);
m_action->SetTimeStarted(time);
}
result = SUCCESS;
@ -134,7 +134,7 @@ void MxCompositeMediaPresenter::StartingTickle()
if (!m_unk0x4c) {
ProgressTickleState(e_streaming);
MxLong time = Timer()->GetTime();
m_action->SetUnknown90(time);
m_action->SetTimeStarted(time);
}
}
}
@ -144,7 +144,7 @@ MxResult MxCompositeMediaPresenter::Tickle()
{
AUTOLOCK(m_criticalSection);
switch (m_currentTickleState) {
switch (GetCurrentTickleState()) {
case e_ready:
ProgressTickleState(e_starting);
case e_starting:

View File

@ -16,26 +16,26 @@ DECOMP_SIZE_ASSERT(MxControlPresenter, 0x5c)
// FUNCTION: LEGO1 0x10043f50
MxControlPresenter::MxControlPresenter()
{
m_unk0x4c = 0;
m_unk0x4e = -1;
m_style = e_none;
m_enabledChild = -1;
m_unk0x50 = FALSE;
m_unk0x52 = 0;
m_columnsOrRows = 0;
m_states = NULL;
m_unk0x54 = 0;
m_rowsOrColumns = 0;
}
// FUNCTION: LEGO1 0x10044110
MxControlPresenter::~MxControlPresenter()
{
if (m_states) {
delete m_states;
delete[] m_states;
}
}
// FUNCTION: LEGO1 0x10044180
MxResult MxControlPresenter::AddToManager()
{
m_unk0x4e = 0;
m_enabledChild = 0;
return SUCCESS;
}
@ -44,16 +44,16 @@ MxResult MxControlPresenter::StartAction(MxStreamController* p_controller, MxDSA
{
MxResult result = MxCompositePresenter::StartAction(p_controller, p_action);
FUN_100b7220(m_action, MxDSAction::c_world | MxDSAction::c_looping, TRUE);
ApplyMask(m_action, MxDSAction::c_world | MxDSAction::c_looping, TRUE);
ParseExtra();
MxS16 i = 0;
for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) {
(*it)->Enable((m_unk0x4c != 3 || m_unk0x4e) && IsEnabled() ? m_unk0x4e == i : FALSE);
(*it)->Enable((m_style != e_map || m_enabledChild) && IsEnabled() ? m_enabledChild == i : FALSE);
i++;
}
if (m_unk0x4c == 3) {
if (m_style == e_map) {
MxDSAction* action = (*m_list.begin())->GetAction();
action->SetFlags(action->GetFlags() | MxDSAction::c_bit11);
}
@ -74,12 +74,12 @@ void MxControlPresenter::EndAction()
// FUNCTION: LEGO1 0x10044270
// FUNCTION: BETA10 0x100eae68
MxBool MxControlPresenter::FUN_10044270(MxS32 p_x, MxS32 p_y, MxPresenter* p_presenter)
MxBool MxControlPresenter::CheckButtonDown(MxS32 p_x, MxS32 p_y, MxPresenter* p_presenter)
{
assert(p_presenter);
MxStillPresenter* presenter = (MxStillPresenter*) p_presenter;
MxVideoPresenter* presenter = (MxVideoPresenter*) p_presenter;
if (m_unk0x4c == 3) {
if (m_style == e_map) {
MxStillPresenter* map = (MxStillPresenter*) m_list.front();
assert(map && map->IsA("MxStillPresenter"));
@ -94,23 +94,23 @@ MxBool MxControlPresenter::FUN_10044270(MxS32 p_x, MxS32 p_y, MxPresenter* p_pre
? NULL
: map->GetBitmap()->GetStart(p_x - rect.GetLeft(), p_y - rect.GetTop());
m_unk0x56 = 0;
m_stateOrCellIndex = 0;
if (m_states) {
for (MxS16 i = 1; i <= *m_states; i++) {
// TODO: Can we match without the cast here?
if (m_states[i] == (MxS16) *start) {
m_unk0x56 = i;
m_stateOrCellIndex = i;
break;
}
}
}
else {
if (*start != 0) {
m_unk0x56 = 1;
m_stateOrCellIndex = 1;
}
}
if (m_unk0x56) {
if (m_stateOrCellIndex) {
return TRUE;
}
}
@ -119,21 +119,21 @@ MxBool MxControlPresenter::FUN_10044270(MxS32 p_x, MxS32 p_y, MxPresenter* p_pre
}
else {
if (ContainsPresenter(m_list, presenter)) {
if (m_unk0x4c == 2) {
if (m_style == e_grid) {
MxS32 width = presenter->GetWidth();
MxS32 height = presenter->GetHeight();
if (m_unk0x52 == 2 && m_unk0x54 == 2) {
if (m_columnsOrRows == 2 && m_rowsOrColumns == 2) {
if (p_x < presenter->GetX() + width / 2) {
m_unk0x56 = (p_y >= presenter->GetY() + height / 2) ? 3 : 1;
m_stateOrCellIndex = (p_y >= presenter->GetY() + height / 2) ? 3 : 1;
}
else {
m_unk0x56 = (p_y >= presenter->GetY() + height / 2) ? 4 : 2;
m_stateOrCellIndex = (p_y >= presenter->GetY() + height / 2) ? 4 : 2;
}
}
}
else {
m_unk0x56 = -1;
m_stateOrCellIndex = -1;
}
return TRUE;
@ -144,27 +144,27 @@ MxBool MxControlPresenter::FUN_10044270(MxS32 p_x, MxS32 p_y, MxPresenter* p_pre
}
// FUNCTION: LEGO1 0x10044480
MxBool MxControlPresenter::FUN_10044480(LegoControlManagerNotificationParam* p_param, MxPresenter* p_presenter)
MxBool MxControlPresenter::Notify(LegoControlManagerNotificationParam* p_param, MxPresenter* p_presenter)
{
if (IsEnabled()) {
switch (p_param->GetNotification()) {
case c_notificationButtonUp:
if (m_unk0x4c == 0 || m_unk0x4c == 2 || m_unk0x4c == 3) {
if (m_style == e_none || m_style == e_grid || m_style == e_map) {
p_param->SetClickedObjectId(m_action->GetObjectId());
p_param->SetClickedAtom(m_action->GetAtomId().GetInternal());
VTable0x6c(0);
UpdateEnabledChild(0);
p_param->SetNotification(c_notificationControl);
p_param->SetUnknown0x28(m_unk0x4e);
p_param->SetUnknown0x28(m_enabledChild);
return TRUE;
}
break;
case c_notificationButtonDown:
if (FUN_10044270(p_param->GetX(), p_param->GetY(), p_presenter)) {
if (CheckButtonDown(p_param->GetX(), p_param->GetY(), p_presenter)) {
p_param->SetClickedObjectId(m_action->GetObjectId());
p_param->SetClickedAtom(m_action->GetAtomId().GetInternal());
VTable0x6c(m_unk0x56);
UpdateEnabledChild(m_stateOrCellIndex);
p_param->SetNotification(c_notificationControl);
p_param->SetUnknown0x28(m_unk0x4e);
p_param->SetUnknown0x28(m_enabledChild);
return TRUE;
}
break;
@ -175,25 +175,25 @@ MxBool MxControlPresenter::FUN_10044480(LegoControlManagerNotificationParam* p_p
}
// FUNCTION: LEGO1 0x10044540
void MxControlPresenter::VTable0x6c(MxS16 p_unk0x4e)
void MxControlPresenter::UpdateEnabledChild(MxS16 p_enabledChild)
{
if (p_unk0x4e == -1) {
if ((MxS16) ((MxDSMultiAction*) m_action)->GetActionList()->GetNumElements() - m_unk0x4e == 1) {
m_unk0x4e = 0;
if (p_enabledChild == -1) {
if ((MxS16) ((MxDSMultiAction*) m_action)->GetActionList()->GetNumElements() - m_enabledChild == 1) {
m_enabledChild = 0;
}
else {
m_unk0x4e++;
m_enabledChild++;
}
}
else {
m_unk0x4e = p_unk0x4e;
m_enabledChild = p_enabledChild;
}
m_action->SetUnknown90(Timer()->GetTime());
m_action->SetTimeStarted(Timer()->GetTime());
MxS16 i = 0;
for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) {
(*it)->Enable(((m_unk0x4c == 3 && m_unk0x4e == 0) || !IsEnabled()) ? FALSE : m_unk0x4e == i);
(*it)->Enable(((m_style == e_map && m_enabledChild == 0) || !IsEnabled()) ? FALSE : m_enabledChild == i);
i++;
}
}
@ -224,20 +224,20 @@ void MxControlPresenter::ParseExtra()
char* token = strtok(output, g_parseExtraTokens);
if (!strcmpi(token, g_strTOGGLE)) {
m_unk0x4c = 1;
m_style = e_toggle;
}
else if (!strcmpi(token, g_strGRID)) {
m_unk0x4c = 2;
m_style = e_grid;
token = strtok(NULL, g_parseExtraTokens);
assert(token);
m_unk0x52 = atoi(token);
m_columnsOrRows = atoi(token);
token = strtok(NULL, g_parseExtraTokens);
assert(token);
m_unk0x54 = atoi(token);
m_rowsOrColumns = atoi(token);
}
else if (!strcmpi(token, g_strMAP)) {
m_unk0x4c = 3;
m_style = e_map;
token = strtok(NULL, g_parseExtraTokens);
if (token) {
@ -254,7 +254,7 @@ void MxControlPresenter::ParseExtra()
}
}
else {
m_unk0x4c = 0;
m_style = e_none;
}
}
@ -274,8 +274,8 @@ void MxControlPresenter::Enable(MxBool p_enable)
MxS16 i = 0;
for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) {
if (i == m_unk0x4e) {
(*it)->Enable((m_unk0x4c != 3 || i != 0) ? p_enable : 0);
if (i == m_enabledChild) {
(*it)->Enable((m_style != e_map || i != 0) ? p_enable : 0);
break;
}
@ -283,7 +283,7 @@ void MxControlPresenter::Enable(MxBool p_enable)
}
if (!p_enable) {
m_unk0x4e = 0;
m_enabledChild = 0;
}
}
}
@ -294,10 +294,10 @@ MxBool MxControlPresenter::HasTickleStatePassed(TickleState p_tickleState)
MxCompositePresenterList::const_iterator it = m_list.begin();
#ifdef COMPAT_MODE
advance(it, m_unk0x4e);
advance(it, m_enabledChild);
#else
// Uses forward iterator logic instead of bidrectional for some reason.
_Advance(it, m_unk0x4e, forward_iterator_tag());
_Advance(it, m_enabledChild, forward_iterator_tag());
#endif
return (*it)->HasTickleStatePassed(p_tickleState);

View File

@ -93,7 +93,9 @@ MxResult MxTransitionManager::StartTransition(
MxBool p_playMusicInAnim
)
{
#ifdef BETA10
assert(m_mode == e_idle);
#endif
if (m_mode == e_idle) {
if (!p_playMusicInAnim) {
@ -291,10 +293,10 @@ void MxTransitionManager::MosaicTransition()
memset(&ddsd, 0, sizeof(ddsd));
ddsd.dwSize = sizeof(ddsd);
HRESULT res = m_ddSurface->Lock(NULL, &ddsd, 1, NULL);
HRESULT res = m_ddSurface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
if (res == DDERR_SURFACELOST) {
m_ddSurface->Restore();
res = m_ddSurface->Lock(NULL, &ddsd, 1, NULL);
res = m_ddSurface->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL);
}
if (res == DD_OK) {

View File

@ -17,10 +17,10 @@ DECOMP_SIZE_ASSERT(LegoEventNotificationParam, 0x20)
LegoControlManager::LegoControlManager()
{
m_presenterList = NULL;
m_unk0x08 = 0;
m_unk0x0c = 0;
m_unk0x10 = FALSE;
m_unk0x14 = NULL;
m_buttonDownState = e_idle;
m_handleUpNextTickle = 0;
m_secondButtonDown = FALSE;
m_handledPresenter = NULL;
TickleManager()->RegisterClient(this, 10);
}
@ -31,11 +31,11 @@ LegoControlManager::~LegoControlManager()
}
// FUNCTION: LEGO1 0x10028df0
void LegoControlManager::FUN_10028df0(MxPresenterList* p_presenterList)
void LegoControlManager::SetPresenterList(MxPresenterList* p_presenterList)
{
m_presenterList = p_presenterList;
g_unk0x100f31b0 = -1;
g_unk0x100f31b4 = NULL;
g_clickedObjectId = -1;
g_clickedAtom = NULL;
}
// FUNCTION: LEGO1 0x10028e10
@ -56,10 +56,10 @@ void LegoControlManager::Unregister(MxCore* p_listener)
}
// FUNCTION: LEGO1 0x10029210
MxBool LegoControlManager::FUN_10029210(LegoEventNotificationParam& p_param, MxPresenter* p_presenter)
MxBool LegoControlManager::HandleButtonDown(LegoEventNotificationParam& p_param, MxPresenter* p_presenter)
{
if (m_presenterList != NULL && m_presenterList->GetNumElements() != 0) {
m_unk0x14 = p_presenter;
m_handledPresenter = p_presenter;
if (p_param.GetNotification() == c_notificationButtonUp ||
p_param.GetNotification() == c_notificationButtonDown) {
@ -71,28 +71,28 @@ MxBool LegoControlManager::FUN_10029210(LegoEventNotificationParam& p_param, MxP
m_event.SetKey(p_param.GetKey());
if (p_param.GetNotification() == c_notificationButtonUp) {
if (m_unk0x10 == TRUE) {
m_unk0x10 = FALSE;
if (m_secondButtonDown == TRUE) {
m_secondButtonDown = FALSE;
return TRUE;
}
if (g_unk0x100f31b0 != -1 && g_unk0x100f31b4 != NULL) {
if (m_unk0x08 == 2) {
return FUN_10029750();
if (g_clickedObjectId != -1 && g_clickedAtom != NULL) {
if (m_buttonDownState == e_tickled) {
return HandleButtonUp();
}
else {
m_unk0x0c = 1;
m_handleUpNextTickle = 1;
return TRUE;
}
}
}
else if (p_param.GetNotification() == c_notificationButtonDown) {
if (m_unk0x0c == 1) {
m_unk0x10 = TRUE;
if (m_handleUpNextTickle == 1) {
m_secondButtonDown = TRUE;
return TRUE;
}
else {
return FUN_10029630();
return HandleButtonDown();
}
}
}
@ -100,15 +100,15 @@ MxBool LegoControlManager::FUN_10029210(LegoEventNotificationParam& p_param, MxP
return FALSE;
}
else {
g_unk0x100f31b0 = -1;
g_unk0x100f31b4 = NULL;
g_clickedObjectId = -1;
g_clickedAtom = NULL;
return FALSE;
}
}
// FUNCTION: LEGO1 0x100292e0
void LegoControlManager::FUN_100292e0()
void LegoControlManager::Notify()
{
LegoNotifyListCursor cursor(&m_notifyList);
MxCore* target;
@ -121,7 +121,7 @@ void LegoControlManager::FUN_100292e0()
}
// FUNCTION: LEGO1 0x100293c0
void LegoControlManager::FUN_100293c0(MxU32 p_objectId, const char* p_atom, MxS16 p_unk0x4e)
void LegoControlManager::UpdateEnabledChild(MxU32 p_objectId, const char* p_atom, MxS16 p_enabledChild)
{
if (m_presenterList) {
MxPresenterListCursor cursor(m_presenterList);
@ -131,11 +131,11 @@ void LegoControlManager::FUN_100293c0(MxU32 p_objectId, const char* p_atom, MxS1
MxDSAction* action = control->GetAction();
if (action->GetObjectId() == p_objectId && action->GetAtomId().GetInternal() == p_atom) {
((MxControlPresenter*) control)->VTable0x6c(p_unk0x4e);
((MxControlPresenter*) control)->UpdateEnabledChild(p_enabledChild);
if (((MxControlPresenter*) control)->GetUnknown0x4e() == 0) {
g_unk0x100f31b0 = -1;
g_unk0x100f31b4 = NULL;
if (((MxControlPresenter*) control)->GetEnabledChild() == 0) {
g_clickedObjectId = -1;
g_clickedAtom = NULL;
break;
}
}
@ -145,7 +145,7 @@ void LegoControlManager::FUN_100293c0(MxU32 p_objectId, const char* p_atom, MxS1
// FUNCTION: LEGO1 0x100294e0
// FUNCTION: BETA10 0x1007c92f
MxControlPresenter* LegoControlManager::FUN_100294e0(MxS32 p_x, MxS32 p_y)
MxControlPresenter* LegoControlManager::GetControlAt(MxS32 p_x, MxS32 p_y)
{
if (m_presenterList) {
MxPresenterListCursor cursor(m_presenterList);
@ -154,7 +154,7 @@ MxControlPresenter* LegoControlManager::FUN_100294e0(MxS32 p_x, MxS32 p_y)
if (presenter) {
while (cursor.Next(control)) {
if (((MxControlPresenter*) control)->FUN_10044270(p_x, p_y, presenter)) {
if (((MxControlPresenter*) control)->CheckButtonDown(p_x, p_y, presenter)) {
return (MxControlPresenter*) control;
}
}
@ -167,29 +167,29 @@ MxControlPresenter* LegoControlManager::FUN_100294e0(MxS32 p_x, MxS32 p_y)
// FUNCTION: LEGO1 0x10029600
MxResult LegoControlManager::Tickle()
{
if (m_unk0x08 == 2 && m_unk0x0c == 1) {
if (m_buttonDownState == e_tickled && m_handleUpNextTickle == 1) {
m_event.SetNotification(c_notificationButtonUp);
FUN_10029750();
HandleButtonUp();
return 0;
}
else if (m_unk0x08 == 1) {
m_unk0x08 = 2;
else if (m_buttonDownState == e_waitNextTickle) {
m_buttonDownState = e_tickled;
}
return 0;
}
// FUNCTION: LEGO1 0x10029630
MxBool LegoControlManager::FUN_10029630()
MxBool LegoControlManager::HandleButtonDown()
{
MxPresenterListCursor cursor(m_presenterList);
MxPresenter* presenter;
while (cursor.Next(presenter)) {
if (((MxControlPresenter*) presenter)->FUN_10044480(&m_event, m_unk0x14)) {
g_unk0x100f31b0 = m_event.m_clickedObjectId;
g_unk0x100f31b4 = m_event.GetClickedAtom();
FUN_100292e0();
m_unk0x08 = 1;
if (((MxControlPresenter*) presenter)->Notify(&m_event, m_handledPresenter)) {
g_clickedObjectId = m_event.m_clickedObjectId;
g_clickedAtom = m_event.GetClickedAtom();
Notify();
m_buttonDownState = e_waitNextTickle;
return TRUE;
}
}
@ -198,29 +198,29 @@ MxBool LegoControlManager::FUN_10029630()
}
// FUNCTION: LEGO1 0x10029750
MxBool LegoControlManager::FUN_10029750()
MxBool LegoControlManager::HandleButtonUp()
{
MxPresenterListCursor cursor(m_presenterList);
MxPresenter* presenter;
while (cursor.Next(presenter)) {
if (presenter->GetAction() && presenter->GetAction()->GetObjectId() == g_unk0x100f31b0 &&
presenter->GetAction()->GetAtomId().GetInternal() == g_unk0x100f31b4) {
if (((MxControlPresenter*) presenter)->FUN_10044480(&m_event, m_unk0x14)) {
FUN_100292e0();
if (presenter->GetAction() && presenter->GetAction()->GetObjectId() == g_clickedObjectId &&
presenter->GetAction()->GetAtomId().GetInternal() == g_clickedAtom) {
if (((MxControlPresenter*) presenter)->Notify(&m_event, m_handledPresenter)) {
Notify();
}
g_unk0x100f31b0 = -1;
g_unk0x100f31b4 = NULL;
g_clickedObjectId = -1;
g_clickedAtom = NULL;
m_unk0x08 = 0;
m_unk0x0c = 0;
m_buttonDownState = e_idle;
m_handleUpNextTickle = 0;
return TRUE;
}
}
g_unk0x100f31b0 = -1;
g_unk0x100f31b4 = NULL;
g_clickedObjectId = -1;
g_clickedAtom = NULL;
return FALSE;
}

View File

@ -27,7 +27,7 @@ LegoMeterPresenter::LegoMeterPresenter()
// FUNCTION: BETA10 0x1009764a
LegoMeterPresenter::~LegoMeterPresenter()
{
delete m_meterPixels;
delete[] m_meterPixels;
}
// FUNCTION: LEGO1 0x10043800

View File

@ -108,8 +108,8 @@ void Act2Brick::FUN_1007a670(MxMatrix& p_param1, MxMatrix& p_param2, LegoPathBou
p_boundary->AddActor(this);
SetActorState(c_disabled);
m_roi->FUN_100a58f0(p_param1);
m_roi->VTable0x14();
m_roi->SetLocal2World(p_param1);
m_roi->WrappedUpdateWorldData();
m_roi->SetVisibility(TRUE);
}
@ -147,8 +147,8 @@ MxResult Act2Brick::Tickle()
VPV3(local2world[3], local2world[3], m_unk0x168);
}
m_roi->FUN_100a58f0(local2world);
m_roi->VTable0x14();
m_roi->SetLocal2World(local2world);
m_roi->WrappedUpdateWorldData();
return SUCCESS;
}

View File

@ -18,11 +18,12 @@ LegoActor::LegoActor()
m_frequencyFactor = 0.0f;
m_sound = NULL;
m_unk0x70 = 0.0f;
m_unk0x10 = 0;
m_interaction = 0;
m_actorId = 0;
}
// FUNCTION: LEGO1 0x1002d320
// FUNCTION: BETA10 0x1003d08b
LegoActor::~LegoActor()
{
if (m_sound) {
@ -31,6 +32,7 @@ LegoActor::~LegoActor()
}
// FUNCTION: LEGO1 0x1002d390
// FUNCTION: BETA10 0x1003d10b
void LegoActor::ParseAction(char* p_extra)
{
MxFloat speed = 0.0F;
@ -90,6 +92,8 @@ void LegoActor::ParseAction(char* p_extra)
up[2] = atof(token);
}
assert(token);
SetWorldTransform(location, direction, up);
}
else {
@ -122,6 +126,7 @@ const char* LegoActor::GetActorName(MxU8 p_id)
}
// FUNCTION: LEGO1 0x1002d670
// FUNCTION: BETA10 0x1003d65f
void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
{
if (p_roi) {

View File

@ -172,7 +172,7 @@ void LegoCameraController::FUN_100123e0(const Matrix4& p_transform, MxU32 p_und)
}
((TimeROI*) pov)->FUN_100a9b40(mat, Timer()->GetTime());
pov->WrappedSetLocalTransform(mat);
pov->WrappedSetLocal2WorldWithWorldDataUpdate(mat);
m_lego3DView->Moved(*pov);
SoundManager()->UpdateListener(

View File

@ -29,7 +29,7 @@ void LegoEntity::Init()
m_roi = NULL;
m_cameraFlag = FALSE;
m_siFile = NULL;
m_unk0x10 = 0;
m_interaction = 0;
m_flags = 0;
m_actionType = Extra::ActionType::e_unknown;
m_targetEntityId = -1;
@ -263,23 +263,23 @@ void LegoEntity::ParseAction(char* p_extra)
// FUNCTION: LEGO1 0x10010f10
// FUNCTION: BETA10 0x1007ee87
void LegoEntity::ClickSound(MxBool p_und)
void LegoEntity::ClickSound(MxBool p_basedOnMood)
{
if (!GetUnknown0x10IsSet(c_altBit1)) {
if (!IsInteraction(c_disabled)) {
MxU32 objectId = 0;
const char* name = m_roi->GetName();
switch (m_type) {
case e_actor:
objectId = CharacterManager()->GetSoundId(m_roi, p_und);
objectId = CharacterManager()->GetSoundId(m_roi, p_basedOnMood);
break;
case e_unk1:
break;
case e_plant:
objectId = PlantManager()->GetSoundId(this, p_und);
objectId = PlantManager()->GetSoundId(this, p_basedOnMood);
break;
case e_building:
objectId = BuildingManager()->GetSoundId(this, p_und);
objectId = BuildingManager()->GetSoundId(this, p_basedOnMood);
break;
}
@ -297,7 +297,7 @@ void LegoEntity::ClickSound(MxBool p_und)
// FUNCTION: BETA10 0x1007f062
void LegoEntity::ClickAnimation()
{
if (!GetUnknown0x10IsSet(c_altBit1)) {
if (!IsInteraction(c_disabled)) {
MxU32 objectId = 0;
MxDSAction action;
const char* name = m_roi->GetName();
@ -329,7 +329,7 @@ void LegoEntity::ClickAnimation()
action.SetObjectId(objectId);
action.AppendExtra(strlen(extra) + 1, extra);
LegoOmni::GetInstance()->GetAnimationManager()->StartEntityAction(action, this);
m_unk0x10 |= c_altBit1;
m_interaction |= c_disabled;
}
}
}
@ -500,10 +500,10 @@ MxLong LegoEntity::Notify(MxParam& p_param)
case e_unk1:
break;
case e_plant:
PlantManager()->FUN_10026c50(this);
PlantManager()->DecrementCounter(this);
break;
case e_building:
BuildingManager()->FUN_10030000(this);
BuildingManager()->DecrementCounter(this);
break;
case e_autoROI:
break;

View File

@ -135,7 +135,7 @@ LegoNavController::LegoNavController()
m_rotationalAccel = 0.0f;
m_trackDefault = FALSE;
m_unk0x5d = FALSE;
m_unk0x6c = FALSE;
m_isAccelerating = FALSE;
m_unk0x64 = 0.0f;
m_unk0x68 = 0.0f;
m_unk0x60 = 0.0f;
@ -442,8 +442,8 @@ MxResult LegoNavController::UpdateLocation(const char* p_location)
Mx3DPointFloat vec;
vec.Clear();
viewROI->FUN_100a5a30(vec);
viewROI->WrappedSetLocalTransform(mat);
viewROI->SetWorldVelocity(vec);
viewROI->WrappedSetLocal2WorldWithWorldDataUpdate(mat);
VideoManager()->Get3DManager()->Moved(*viewROI);
SoundManager()->UpdateListener(
@ -480,8 +480,8 @@ MxResult LegoNavController::UpdateLocation(MxU32 p_location)
Mx3DPointFloat vec;
vec.Clear();
viewROI->FUN_100a5a30(vec);
viewROI->WrappedSetLocalTransform(mat);
viewROI->SetWorldVelocity(vec);
viewROI->WrappedSetLocal2WorldWithWorldDataUpdate(mat);
VideoManager()->Get3DManager()->Moved(*viewROI);
SoundManager()->UpdateListener(
@ -564,8 +564,8 @@ MxResult LegoNavController::ProcessJoystickInput(MxBool& p_und)
// FUNCTION: LEGO1 0x100558b0
MxResult LegoNavController::ProcessKeyboardInput()
{
MxBool bool1 = FALSE;
MxBool bool2 = FALSE;
MxBool skipRotationVelAndAccelCalc = FALSE;
MxBool skipLinearVelAndAccelCalc = FALSE;
LegoInputManager* inputManager = LegoOmni::GetInstance()->GetInputManager();
MxU32 keyFlags;
@ -574,18 +574,18 @@ MxResult LegoNavController::ProcessKeyboardInput()
}
if (keyFlags == 0) {
if (m_unk0x6c) {
if (m_isAccelerating) {
m_targetRotationalVel = 0.0;
m_targetLinearVel = 0.0;
m_rotationalAccel = m_maxRotationalDeccel;
m_linearAccel = m_maxLinearDeccel;
m_unk0x6c = FALSE;
m_isAccelerating = FALSE;
}
return FAILURE;
}
m_unk0x6c = TRUE;
m_isAccelerating = TRUE;
MxS32 hMax;
switch (keyFlags & LegoInputManager::c_leftOrRight) {
@ -598,7 +598,7 @@ MxResult LegoNavController::ProcessKeyboardInput()
default:
m_targetRotationalVel = 0.0;
m_rotationalAccel = m_maxRotationalDeccel;
bool1 = TRUE;
skipRotationVelAndAccelCalc = TRUE;
break;
}
@ -613,23 +613,31 @@ MxResult LegoNavController::ProcessKeyboardInput()
default:
m_targetLinearVel = 0.0;
m_linearAccel = m_maxLinearDeccel;
bool2 = TRUE;
skipLinearVelAndAccelCalc = TRUE;
break;
}
MxFloat val = keyFlags & LegoInputManager::c_bit5 ? 1.0f : 4.0f;
MxFloat val2 = keyFlags & LegoInputManager::c_bit5 ? 1.0f : 2.0f;
MxFloat maxAccelDivisor = keyFlags & LegoInputManager::c_ctrl ? 1.0f : 4.0f;
MxFloat minAccelDivisor = keyFlags & LegoInputManager::c_ctrl ? 1.0f : 2.0f;
if (!bool1) {
if (!skipRotationVelAndAccelCalc) {
m_targetRotationalVel = CalculateNewTargetVel(hMax, m_hMax / 2, m_maxRotationalVel);
m_rotationalAccel =
CalculateNewAccel(hMax, m_hMax / 2, m_maxRotationalAccel / val, (int) (m_minRotationalAccel / val2));
m_rotationalAccel = CalculateNewAccel(
hMax,
m_hMax / 2,
m_maxRotationalAccel / maxAccelDivisor,
(int) (m_minRotationalAccel / minAccelDivisor)
);
}
if (!bool2) {
if (!skipLinearVelAndAccelCalc) {
m_targetLinearVel = CalculateNewTargetVel(m_vMax - vMax, m_vMax / 2, m_maxLinearVel);
m_linearAccel =
CalculateNewAccel(m_vMax - vMax, m_vMax / 2, m_maxLinearAccel / val, (int) (m_minLinearAccel / val2));
m_linearAccel = CalculateNewAccel(
m_vMax - vMax,
m_vMax / 2,
m_maxLinearAccel / maxAccelDivisor,
(int) (m_minLinearAccel / minAccelDivisor)
);
}
return SUCCESS;
@ -683,7 +691,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
for (MxS32 i = 0; i < numPlants; i++) {
LegoEntity* entity = plantMgr->CreatePlant(i, NULL, LegoOmni::e_act1);
if (entity != NULL && !entity->GetUnknown0x10IsSet(LegoEntity::c_altBit1)) {
if (entity != NULL && !entity->IsInteraction(LegoEntity::c_disabled)) {
LegoROI* roi = entity->GetROI();
if (roi != NULL && roi->GetVisibility()) {
@ -693,7 +701,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
Mx3DPointFloat roiPosition(roi->GetWorldPosition());
roiPosition -= viewPosition;
if (roiPosition.LenSquared() < 2000.0 || roi->GetUnknown0xe0() > 0) {
if (roiPosition.LenSquared() < 2000.0 || roi->GetLodLevel() > 0) {
entity->ClickAnimation();
}
}
@ -922,7 +930,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
MxMatrix mat;
mat.SetIdentity();
mat.RotateX(0.2618f);
roi->WrappedVTable0x24(mat);
roi->WrappedUpdateWorldDataWithTransform(mat);
break;
}
case 'J': {
@ -930,7 +938,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
MxMatrix mat;
mat.SetIdentity();
mat.RotateZ(0.2618f);
roi->WrappedVTable0x24(mat);
roi->WrappedUpdateWorldDataWithTransform(mat);
break;
}
case 'K': {
@ -938,7 +946,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
LegoROI* roi = LegoOmni::GetInstance()->GetVideoManager()->GetViewROI();
mat.SetIdentity();
mat.RotateZ(-0.2618f);
roi->WrappedVTable0x24(mat);
roi->WrappedUpdateWorldDataWithTransform(mat);
break;
}
case 'L':
@ -949,7 +957,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
MxMatrix mat;
mat.SetIdentity();
mat.RotateX(-0.2618f);
roi->WrappedVTable0x24(mat);
roi->WrappedUpdateWorldDataWithTransform(mat);
break;
}
case 'N':

View File

@ -154,7 +154,7 @@ MxResult LegoPointOfViewController::Tickle()
CalcLocalTransform(newPos, newDir, pov->GetWorldUp(), mat);
((TimeROI*) pov)->FUN_100a9b40(mat, Timer()->GetTime());
pov->WrappedSetLocalTransform(mat);
pov->WrappedSetLocal2WorldWithWorldDataUpdate(mat);
m_lego3DView->Moved(*pov);
SoundManager()->UpdateListener(
@ -171,7 +171,7 @@ MxResult LegoPointOfViewController::Tickle()
Mx3DPointFloat vel;
vel.Clear();
pov->FUN_100a5a30(vel);
pov->SetWorldVelocity(vel);
SoundManager()->UpdateListener(
pov->GetWorldPosition(),
@ -210,7 +210,7 @@ void LegoPointOfViewController::SetEntity(LegoEntity* p_entity)
mat
);
pov->WrappedSetLocalTransform(mat);
pov->WrappedSetLocal2WorldWithWorldDataUpdate(mat);
}
else {
TickleManager()->RegisterClient(this, 10);

View File

@ -32,7 +32,7 @@ DECOMP_SIZE_ASSERT(LegoCacheSoundList, 0x18)
DECOMP_SIZE_ASSERT(LegoCacheSoundListCursor, 0x10)
// FUNCTION: LEGO1 0x1001ca40
LegoWorld::LegoWorld() : m_list0x68(TRUE)
LegoWorld::LegoWorld() : m_pathControllerList(TRUE)
{
m_startupTicks = e_four;
m_cameraController = NULL;
@ -81,7 +81,7 @@ MxResult LegoWorld::Create(MxDSAction& p_dsAction)
}
SetCurrentWorld(this);
ControlManager()->FUN_10028df0(&m_controlPresenters);
ControlManager()->SetPresenterList(&m_controlPresenters);
}
SetIsWorldActive(TRUE);
@ -96,11 +96,11 @@ void LegoWorld::Destroy(MxBool p_fromDestructor)
m_destroyed = TRUE;
if (CurrentWorld() == this) {
ControlManager()->FUN_10028df0(NULL);
ControlManager()->SetPresenterList(NULL);
SetCurrentWorld(NULL);
}
m_list0x68.DeleteAll();
m_pathControllerList.DeleteAll();
if (m_cameraController) {
delete m_cameraController;
@ -120,12 +120,12 @@ void LegoWorld::Destroy(MxBool p_fromDestructor)
animPresenter->DecrementUnknown0xd4();
if (animPresenter->GetUnknown0xd4() == 0) {
FUN_100b7220(action, MxDSAction::c_world, FALSE);
ApplyMask(action, MxDSAction::c_world, FALSE);
presenter->EndAction();
}
}
else {
FUN_100b7220(action, MxDSAction::c_world, FALSE);
ApplyMask(action, MxDSAction::c_world, FALSE);
presenter->EndAction();
}
}
@ -141,7 +141,7 @@ void LegoWorld::Destroy(MxBool p_fromDestructor)
MxDSAction* action = presenter->GetAction();
if (action) {
FUN_100b7220(action, MxDSAction::c_world, FALSE);
ApplyMask(action, MxDSAction::c_world, FALSE);
presenter->EndAction();
}
}
@ -157,7 +157,7 @@ void LegoWorld::Destroy(MxBool p_fromDestructor)
MxDSAction* action = presenter->GetAction();
if (action) {
FUN_100b7220(action, MxDSAction::c_world, FALSE);
ApplyMask(action, MxDSAction::c_world, FALSE);
presenter->EndAction();
}
}
@ -273,7 +273,7 @@ MxResult LegoWorld::PlaceActor(
float p_destScale
)
{
LegoPathControllerListCursor cursor(&m_list0x68);
LegoPathControllerListCursor cursor(&m_pathControllerList);
LegoPathController* controller;
while (cursor.Next(controller)) {
@ -288,7 +288,7 @@ MxResult LegoWorld::PlaceActor(
// FUNCTION: LEGO1 0x1001fa70
MxResult LegoWorld::PlaceActor(LegoPathActor* p_actor)
{
LegoPathControllerListCursor cursor(&m_list0x68);
LegoPathControllerListCursor cursor(&m_pathControllerList);
LegoPathController* controller;
while (cursor.Next(controller)) {
@ -308,7 +308,7 @@ MxResult LegoWorld::PlaceActor(
Vector3& p_direction
)
{
LegoPathControllerListCursor cursor(&m_list0x68);
LegoPathControllerListCursor cursor(&m_pathControllerList);
LegoPathController* controller;
while (cursor.Next(controller)) {
@ -324,7 +324,7 @@ MxResult LegoWorld::PlaceActor(
// FUNCTION: BETA10 0x100da4bf
void LegoWorld::RemoveActor(LegoPathActor* p_actor)
{
LegoPathControllerListCursor cursor(&m_list0x68);
LegoPathControllerListCursor cursor(&m_pathControllerList);
LegoPathController* controller;
while (cursor.Next(controller)) {
@ -337,7 +337,7 @@ void LegoWorld::RemoveActor(LegoPathActor* p_actor)
// FUNCTION: BETA10 0x100da560
MxBool LegoWorld::ActorExists(LegoPathActor* p_actor)
{
LegoPathControllerListCursor cursor(&m_list0x68);
LegoPathControllerListCursor cursor(&m_pathControllerList);
LegoPathController* controller;
while (cursor.Next(controller)) {
@ -353,7 +353,7 @@ MxBool LegoWorld::ActorExists(LegoPathActor* p_actor)
// FUNCTION: BETA10 0x100da621
void LegoWorld::FUN_1001fda0(LegoAnimPresenter* p_presenter)
{
LegoPathControllerListCursor cursor(&m_list0x68);
LegoPathControllerListCursor cursor(&m_pathControllerList);
LegoPathController* controller;
while (cursor.Next(controller)) {
@ -365,11 +365,11 @@ void LegoWorld::FUN_1001fda0(LegoAnimPresenter* p_presenter)
// FUNCTION: BETA10 0x100da6b5
void LegoWorld::FUN_1001fe90(LegoAnimPresenter* p_presenter)
{
LegoPathControllerListCursor cursor(&m_list0x68);
LegoPathControllerListCursor cursor(&m_pathControllerList);
LegoPathController* controller;
while (cursor.Next(controller)) {
controller->FUN_10046930(p_presenter);
controller->RemovePresenterFromBoundaries(p_presenter);
}
}
@ -377,14 +377,14 @@ void LegoWorld::FUN_1001fe90(LegoAnimPresenter* p_presenter)
void LegoWorld::AddPath(LegoPathController* p_controller)
{
p_controller->FUN_10046bb0(this);
m_list0x68.Append(p_controller);
m_pathControllerList.Append(p_controller);
}
// FUNCTION: LEGO1 0x10020020
// FUNCTION: BETA10 0x100da77c
LegoPathBoundary* LegoWorld::FindPathBoundary(const char* p_name)
{
LegoPathControllerListCursor cursor(&m_list0x68);
LegoPathControllerListCursor cursor(&m_pathControllerList);
LegoPathController* controller;
while (cursor.Next(controller)) {
@ -401,7 +401,7 @@ LegoPathBoundary* LegoWorld::FindPathBoundary(const char* p_name)
// FUNCTION: LEGO1 0x10020120
MxResult LegoWorld::GetCurrPathInfo(LegoPathBoundary** p_boundaries, MxS32& p_numL)
{
LegoPathControllerListCursor cursor(&m_list0x68);
LegoPathControllerListCursor cursor(&m_pathControllerList);
LegoPathController* controller;
cursor.Next(controller);
@ -424,7 +424,7 @@ void LegoWorld::Add(MxCore* p_object)
#ifndef BETA10
if (p_object->IsA("LegoAnimPresenter")) {
if (!strcmpi(((LegoAnimPresenter*) p_object)->GetAction()->GetObjectName(), "ConfigAnimation")) {
FUN_1003e050((LegoAnimPresenter*) p_object);
CalculateViewFromAnimation((LegoAnimPresenter*) p_object);
((LegoAnimPresenter*) p_object)
->GetAction()
->SetDuration(((LegoAnimPresenter*) p_object)->GetAnimation()->GetDuration());
@ -722,7 +722,7 @@ void LegoWorld::Enable(MxBool p_enable)
}
SetCurrentWorld(this);
ControlManager()->FUN_10028df0(&m_controlPresenters);
ControlManager()->SetPresenterList(&m_controlPresenters);
InputManager()->SetCamera(m_cameraController);
if (m_cameraController) {
@ -779,7 +779,7 @@ void LegoWorld::Enable(MxBool p_enable)
}
if (CurrentWorld() && CurrentWorld() == this) {
ControlManager()->FUN_10028df0(NULL);
ControlManager()->SetPresenterList(NULL);
Lego()->SetCurrentWorld(NULL);
}
@ -795,7 +795,7 @@ void LegoWorld::Enable(MxBool p_enable)
}
}
LegoPathControllerListCursor pathControllerCursor(&m_list0x68);
LegoPathControllerListCursor pathControllerCursor(&m_pathControllerList);
while (pathControllerCursor.Next(controller)) {
controller->Enable(FALSE);

Some files were not shown because too many files have changed in this diff Show More