diff --git a/.github/workflows/compare.yml b/.github/workflows/compare.yml index b4819b72..a0cf4276 100644 --- a/.github/workflows/compare.yml +++ b/.github/workflows/compare.yml @@ -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 diff --git a/.gitignore b/.gitignore index 81e69517..a40c129e 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index c4681228..064a207e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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$<$:d>") + set_property(TARGET ${lego1_targets} ${beta10_targets} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") if(TARGET lego1) target_link_options(lego1 PRIVATE "/OPT:REF") - # Equivalent to target_compile_options(... PRIVATE "/MT$<$:d>") - set_property(TARGET lego1 ${lego1_targets} ${beta10_targets} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") + set_property(TARGET lego1 PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") endif() set(CMAKE_CXX_FLAGS "/W3 /GX /D \"WIN32\" /D \"_WINDOWS\"") diff --git a/CONFIG/ConfigCommandLineInfo.cpp b/CONFIG/ConfigCommandLineInfo.cpp index 0e376e6d..cf3180c4 100644 --- a/CONFIG/ConfigCommandLineInfo.cpp +++ b/CONFIG/ConfigCommandLineInfo.cpp @@ -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; } } diff --git a/CONFIG/MainDlg.cpp b/CONFIG/MainDlg.cpp index 7ae5393e..c9fad610 100644 --- a/CONFIG/MainDlg.cpp +++ b/CONFIG/MainDlg.cpp @@ -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); diff --git a/CONFIG/config.cpp b/CONFIG/config.cpp index d4457b55..13a80e7f 100644 --- a/CONFIG/config.cpp +++ b/CONFIG/config.cpp @@ -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; } } diff --git a/CONFIG/config.h b/CONFIG/config.h index 9172e2d5..c3282769 100644 --- a/CONFIG/config.h +++ b/CONFIG/config.h @@ -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. diff --git a/CONFIG/detectdx5.cpp b/CONFIG/detectdx5.cpp index 546f0dbd..8a308a8d 100644 --- a/CONFIG/detectdx5.cpp +++ b/CONFIG/detectdx5.cpp @@ -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; diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 08eec572..d50be904 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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. diff --git a/ISLE/isleapp.cpp b/ISLE/isleapp.cpp index a22f685b..3f5f485a 100644 --- a/ISLE/isleapp.cpp +++ b/ISLE/isleapp.cpp @@ -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; } diff --git a/ISLE/isleapp.h b/ISLE/isleapp.h index 6a8289ce..0e8ad0e5 100644 --- a/ISLE/isleapp.h +++ b/ISLE/isleapp.h @@ -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 diff --git a/LEGO1/define.cpp b/LEGO1/define.cpp index 1e1ac43a..0a67df0b 100644 --- a/LEGO1/define.cpp +++ b/LEGO1/define.cpp @@ -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 diff --git a/LEGO1/lego/legoomni/include/act3.h b/LEGO1/lego/legoomni/include/act3.h index dc81160c..38e2876e 100644 --- a/LEGO1/lego/legoomni/include/act3.h +++ b/LEGO1/lego/legoomni/include/act3.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/act3actors.h b/LEGO1/lego/legoomni/include/act3actors.h index 02b3d22d..99b4c80b 100644 --- a/LEGO1/lego/legoomni/include/act3actors.h +++ b/LEGO1/lego/legoomni/include/act3actors.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/ambulance.h b/LEGO1/lego/legoomni/include/ambulance.h index 97e6ba38..cb6a396a 100644 --- a/LEGO1/lego/legoomni/include/ambulance.h +++ b/LEGO1/lego/legoomni/include/ambulance.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/carrace.h b/LEGO1/lego/legoomni/include/carrace.h index 03e7a958..7a3b2f6f 100644 --- a/LEGO1/lego/legoomni/include/carrace.h +++ b/LEGO1/lego/legoomni/include/carrace.h @@ -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; } diff --git a/LEGO1/lego/legoomni/include/gasstation.h b/LEGO1/lego/legoomni/include/gasstation.h index e5168c97..5b4a6a35 100644 --- a/LEGO1/lego/legoomni/include/gasstation.h +++ b/LEGO1/lego/legoomni/include/gasstation.h @@ -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 }; diff --git a/LEGO1/lego/legoomni/include/hospital.h b/LEGO1/lego/legoomni/include/hospital.h index 623a4399..2a90764b 100644 --- a/LEGO1/lego/legoomni/include/hospital.h +++ b/LEGO1/lego/legoomni/include/hospital.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/infocenter.h b/LEGO1/lego/legoomni/include/infocenter.h index 24d14aa8..3c58b325 100644 --- a/LEGO1/lego/legoomni/include/infocenter.h +++ b/LEGO1/lego/legoomni/include/infocenter.h @@ -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 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 diff --git a/LEGO1/lego/legoomni/include/jetskirace.h b/LEGO1/lego/legoomni/include/jetskirace.h index 7542d851..61407cce 100644 --- a/LEGO1/lego/legoomni/include/jetskirace.h +++ b/LEGO1/lego/legoomni/include/jetskirace.h @@ -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); diff --git a/LEGO1/lego/legoomni/include/legoactor.h b/LEGO1/lego/legoomni/include/legoactor.h index 79d8ffeb..a3e68f2e 100644 --- a/LEGO1/lego/legoomni/include/legoactor.h +++ b/LEGO1/lego/legoomni/include/legoactor.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/legoactors.h b/LEGO1/lego/legoomni/include/legoactors.h index aa31343d..f88f6a57 100644 --- a/LEGO1/lego/legoomni/include/legoactors.h +++ b/LEGO1/lego/legoomni/include/legoactors.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/legoanimationmanager.h b/LEGO1/lego/legoomni/include/legoanimationmanager.h index f216ca30..60f63d4a 100644 --- a/LEGO1/lego/legoomni/include/legoanimationmanager.h +++ b/LEGO1/lego/legoomni/include/legoanimationmanager.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/legoanimmmpresenter.h b/LEGO1/lego/legoomni/include/legoanimmmpresenter.h index d73cd55d..5c972176 100644 --- a/LEGO1/lego/legoomni/include/legoanimmmpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimmmpresenter.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/legoanimpresenter.h b/LEGO1/lego/legoomni/include/legoanimpresenter.h index fce22592..a3d6cd60 100644 --- a/LEGO1/lego/legoomni/include/legoanimpresenter.h +++ b/LEGO1/lego/legoomni/include/legoanimpresenter.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/legobuildingmanager.h b/LEGO1/lego/legoomni/include/legobuildingmanager.h index bac64396..c5a69309 100644 --- a/LEGO1/lego/legoomni/include/legobuildingmanager.h +++ b/LEGO1/lego/legoomni/include/legobuildingmanager.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/legocarbuild.h b/LEGO1/lego/legoomni/include/legocarbuild.h index a28e29b9..a96b7b67 100644 --- a/LEGO1/lego/legoomni/include/legocarbuild.h +++ b/LEGO1/lego/legoomni/include/legocarbuild.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/legocarbuildpresenter.h b/LEGO1/lego/legoomni/include/legocarbuildpresenter.h index f09515bf..31423e32 100644 --- a/LEGO1/lego/legoomni/include/legocarbuildpresenter.h +++ b/LEGO1/lego/legoomni/include/legocarbuildpresenter.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/legocharactermanager.h b/LEGO1/lego/legoomni/include/legocharactermanager.h index ae7d79c3..c5a0c242 100644 --- a/LEGO1/lego/legoomni/include/legocharactermanager.h +++ b/LEGO1/lego/legoomni/include/legocharactermanager.h @@ -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; } diff --git a/LEGO1/lego/legoomni/include/legocontrolmanager.h b/LEGO1/lego/legoomni/include/legocontrolmanager.h index 828a1f6e..f962ee0c 100644 --- a/LEGO1/lego/legoomni/include/legocontrolmanager.h +++ b/LEGO1/lego/legoomni/include/legocontrolmanager.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/legoentity.h b/LEGO1/lego/legoomni/include/legoentity.h index eecf6867..a6d9d9ee 100644 --- a/LEGO1/lego/legoomni/include/legoentity.h +++ b/LEGO1/lego/legoomni/include/legoentity.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/legogamestate.h b/LEGO1/lego/legoomni/include/legogamestate.h index e088618d..e5dd9a26 100644 --- a/LEGO1/lego/legoomni/include/legogamestate.h +++ b/LEGO1/lego/legoomni/include/legogamestate.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/legoinputmanager.h b/LEGO1/lego/legoomni/include/legoinputmanager.h index 9b47d7a8..27e53fcb 100644 --- a/LEGO1/lego/legoomni/include/legoinputmanager.h +++ b/LEGO1/lego/legoomni/include/legoinputmanager.h @@ -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 @@ -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 diff --git a/LEGO1/lego/legoomni/include/legomain.h b/LEGO1/lego/legoomni/include/legomain.h index 263d59d5..6f2b1e21 100644 --- a/LEGO1/lego/legoomni/include/legomain.h +++ b/LEGO1/lego/legoomni/include/legomain.h @@ -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' diff --git a/LEGO1/lego/legoomni/include/legomodelpresenter.h b/LEGO1/lego/legoomni/include/legomodelpresenter.h index 21e47afd..62117841 100644 --- a/LEGO1/lego/legoomni/include/legomodelpresenter.h +++ b/LEGO1/lego/legoomni/include/legomodelpresenter.h @@ -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() { diff --git a/LEGO1/lego/legoomni/include/legonavcontroller.h b/LEGO1/lego/legoomni/include/legonavcontroller.h index ef882450..adbed6a1 100644 --- a/LEGO1/lego/legoomni/include/legonavcontroller.h +++ b/LEGO1/lego/legoomni/include/legonavcontroller.h @@ -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; diff --git a/LEGO1/lego/legoomni/include/legopathactor.h b/LEGO1/lego/legoomni/include/legopathactor.h index f4a4117e..8df0e9db 100644 --- a/LEGO1/lego/legoomni/include/legopathactor.h +++ b/LEGO1/lego/legoomni/include/legopathactor.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/legopathboundary.h b/LEGO1/lego/legoomni/include/legopathboundary.h index 1ceef36a..2bc304f0 100644 --- a/LEGO1/lego/legoomni/include/legopathboundary.h +++ b/LEGO1/lego/legoomni/include/legopathboundary.h @@ -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 >::_Kfn,LegoPathActorSetCompare,allocator >::lower_bound // TEMPLATE: BETA10 0x10082b90 -// _Tree >::_Kfn,LegoAnimPresenterSetCompare,allocator >::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 >::end @@ -203,13 +197,13 @@ class LegoPathBoundary : public LegoWEGEdge { // _Tree >::_Kfn,LegoAnimPresenterSetCompare,allocator >::find // TEMPLATE: BETA10 0x10021dc0 -// Set::Set +// ??0?$Set@PAVLegoPathActor@@ULegoPathActorSetCompare@@@@QAE@ABV0@@Z // TEMPLATE: BETA10 0x100202d0 // set >::begin // TEMPLATE: BETA10 0x10020030 -// _Tree >::_Kfn,LegoPathActorSetCompare,allocator >::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 >::end diff --git a/LEGO1/lego/legoomni/include/legopathcontroller.h b/LEGO1/lego/legoomni/include/legopathcontroller.h index 1a13f961..4632c6b1 100644 --- a/LEGO1/lego/legoomni/include/legopathcontroller.h +++ b/LEGO1/lego/legoomni/include/legopathcontroller.h @@ -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 >::begin diff --git a/LEGO1/lego/legoomni/include/legophoneme.h b/LEGO1/lego/legoomni/include/legophoneme.h index f88595d9..88f85e01 100644 --- a/LEGO1/lego/legoomni/include/legophoneme.h +++ b/LEGO1/lego/legoomni/include/legophoneme.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/legoplantmanager.h b/LEGO1/lego/legoomni/include/legoplantmanager.h index a7a821d1..c3b2c4e1 100644 --- a/LEGO1/lego/legoomni/include/legoplantmanager.h +++ b/LEGO1/lego/legoomni/include/legoplantmanager.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/legoplants.h b/LEGO1/lego/legoomni/include/legoplants.h index 1b26b0e8..9d20d1a9 100644 --- a/LEGO1/lego/legoomni/include/legoplants.h +++ b/LEGO1/lego/legoomni/include/legoplants.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/legorace.h b/LEGO1/lego/legoomni/include/legorace.h index 55d43785..e1b93211 100644 --- a/LEGO1/lego/legoomni/include/legorace.h +++ b/LEGO1/lego/legoomni/include/legorace.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/legoracers.h b/LEGO1/lego/legoomni/include/legoracers.h index 7709ebb7..3c8ffe07 100644 --- a/LEGO1/lego/legoomni/include/legoracers.h +++ b/LEGO1/lego/legoomni/include/legoracers.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/legoracespecial.h b/LEGO1/lego/legoomni/include/legoracespecial.h index 3382a394..bfa38632 100644 --- a/LEGO1/lego/legoomni/include/legoracespecial.h +++ b/LEGO1/lego/legoomni/include/legoracespecial.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/legotextureinfo.h b/LEGO1/lego/legoomni/include/legotextureinfo.h index c070bfec..f62295a6 100644 --- a/LEGO1/lego/legoomni/include/legotextureinfo.h +++ b/LEGO1/lego/legoomni/include/legotextureinfo.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/legoutils.h b/LEGO1/lego/legoomni/include/legoutils.h index 3780e700..59c34825 100644 --- a/LEGO1/lego/legoomni/include/legoutils.h +++ b/LEGO1/lego/legoomni/include/legoutils.h @@ -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) diff --git a/LEGO1/lego/legoomni/include/legoworld.h b/LEGO1/lego/legoomni/include/legoworld.h index 10ff56ab..11e5e667 100644 --- a/LEGO1/lego/legoomni/include/legoworld.h +++ b/LEGO1/lego/legoomni/include/legoworld.h @@ -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 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 m_roiList; // 0xe0 + LegoOmni::World m_worldId; // 0xec // name verified by BETA10 0x100c7f59 LegoHideAnimPresenter* m_hideAnim; // 0xf0 diff --git a/LEGO1/lego/legoomni/include/legoworldpresenter.h b/LEGO1/lego/legoomni/include/legoworldpresenter.h index 629aa381..3e853f83 100644 --- a/LEGO1/lego/legoomni/include/legoworldpresenter.h +++ b/LEGO1/lego/legoomni/include/legoworldpresenter.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/mxbackgroundaudiomanager.h b/LEGO1/lego/legoomni/include/mxbackgroundaudiomanager.h index 8cf18412..ac063ddc 100644 --- a/LEGO1/lego/legoomni/include/mxbackgroundaudiomanager.h +++ b/LEGO1/lego/legoomni/include/mxbackgroundaudiomanager.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/mxcontrolpresenter.h b/LEGO1/lego/legoomni/include/mxcontrolpresenter.h index 8ecfeacf..d3d2a96a 100644 --- a/LEGO1/lego/legoomni/include/mxcontrolpresenter.h +++ b/LEGO1/lego/legoomni/include/mxcontrolpresenter.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/pizza.h b/LEGO1/lego/legoomni/include/pizza.h index 89b19cb0..b81b76f8 100644 --- a/LEGO1/lego/legoomni/include/pizza.h +++ b/LEGO1/lego/legoomni/include/pizza.h @@ -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 }; diff --git a/LEGO1/lego/legoomni/include/pizzeria.h b/LEGO1/lego/legoomni/include/pizzeria.h index a959abb3..cdfe7d45 100644 --- a/LEGO1/lego/legoomni/include/pizzeria.h +++ b/LEGO1/lego/legoomni/include/pizzeria.h @@ -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[]; diff --git a/LEGO1/lego/legoomni/include/police.h b/LEGO1/lego/legoomni/include/police.h index 39294cb1..8d8d7840 100644 --- a/LEGO1/lego/legoomni/include/police.h +++ b/LEGO1/lego/legoomni/include/police.h @@ -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 diff --git a/LEGO1/lego/legoomni/include/radio.h b/LEGO1/lego/legoomni/include/radio.h index 9ff8cb9c..4b7e1202 100644 --- a/LEGO1/lego/legoomni/include/radio.h +++ b/LEGO1/lego/legoomni/include/radio.h @@ -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); diff --git a/LEGO1/lego/legoomni/src/actors/act2actor.cpp b/LEGO1/lego/legoomni/src/actors/act2actor.cpp index d810c975..bf531641 100644 --- a/LEGO1/lego/legoomni/src/actors/act2actor.cpp +++ b/LEGO1/lego/legoomni/src/actors/act2actor.cpp @@ -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; } diff --git a/LEGO1/lego/legoomni/src/actors/act3actors.cpp b/LEGO1/lego/legoomni/src/actors/act3actors.cpp index 683fcffc..c9750667 100644 --- a/LEGO1/lego/legoomni/src/actors/act3actors.cpp +++ b/LEGO1/lego/legoomni/src/actors/act3actors.cpp @@ -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); diff --git a/LEGO1/lego/legoomni/src/actors/act3ammo.cpp b/LEGO1/lego/legoomni/src/actors/act3ammo.cpp index 59a20e5a..70baf9e5 100644 --- a/LEGO1/lego/legoomni/src/actors/act3ammo.cpp +++ b/LEGO1/lego/legoomni/src/actors/act3ammo.cpp @@ -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 { diff --git a/LEGO1/lego/legoomni/src/actors/ambulance.cpp b/LEGO1/lego/legoomni/src/actors/ambulance.cpp index eb1b7c8c..95ca6975 100644 --- a/LEGO1/lego/legoomni/src/actors/ambulance.cpp +++ b/LEGO1/lego/legoomni/src/actors/ambulance.cpp @@ -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; diff --git a/LEGO1/lego/legoomni/src/actors/bike.cpp b/LEGO1/lego/legoomni/src/actors/bike.cpp index 1bb67774..6c82cb0d 100644 --- a/LEGO1/lego/legoomni/src/actors/bike.cpp +++ b/LEGO1/lego/legoomni/src/actors/bike.cpp @@ -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: diff --git a/LEGO1/lego/legoomni/src/actors/buildings.cpp b/LEGO1/lego/legoomni/src/actors/buildings.cpp index ea7069cc..833287bc 100644 --- a/LEGO1/lego/legoomni/src/actors/buildings.cpp +++ b/LEGO1/lego/legoomni/src/actors/buildings.cpp @@ -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); } diff --git a/LEGO1/lego/legoomni/src/actors/doors.cpp b/LEGO1/lego/legoomni/src/actors/doors.cpp index 1f36f91b..92ab5fc8 100644 --- a/LEGO1/lego/legoomni/src/actors/doors.cpp +++ b/LEGO1/lego/legoomni/src/actors/doors.cpp @@ -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; diff --git a/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp b/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp index 778a65a8..e9ec7817 100644 --- a/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp +++ b/LEGO1/lego/legoomni/src/actors/dunebuggy.cpp @@ -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: diff --git a/LEGO1/lego/legoomni/src/actors/helicopter.cpp b/LEGO1/lego/legoomni/src/actors/helicopter.cpp index 7751a828..c8c465f7 100644 --- a/LEGO1/lego/legoomni/src/actors/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/actors/helicopter.cpp @@ -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(); diff --git a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp index e3bbf85f..9d5a3a22 100644 --- a/LEGO1/lego/legoomni/src/actors/islepathactor.cpp +++ b/LEGO1/lego/legoomni/src/actors/islepathactor.cpp @@ -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(); } diff --git a/LEGO1/lego/legoomni/src/actors/jetski.cpp b/LEGO1/lego/legoomni/src/actors/jetski.cpp index bf183014..11ff7d18 100644 --- a/LEGO1/lego/legoomni/src/actors/jetski.cpp +++ b/LEGO1/lego/legoomni/src/actors/jetski.cpp @@ -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); diff --git a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp index ecf0bec8..c92aec79 100644 --- a/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp +++ b/LEGO1/lego/legoomni/src/actors/jukeboxentity.cpp @@ -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; } diff --git a/LEGO1/lego/legoomni/src/actors/motorcycle.cpp b/LEGO1/lego/legoomni/src/actors/motorcycle.cpp index 877ebf21..5819598e 100644 --- a/LEGO1/lego/legoomni/src/actors/motorcycle.cpp +++ b/LEGO1/lego/legoomni/src/actors/motorcycle.cpp @@ -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: diff --git a/LEGO1/lego/legoomni/src/actors/pizza.cpp b/LEGO1/lego/legoomni/src/actors/pizza.cpp index 98d711f2..18da7fca 100644 --- a/LEGO1/lego/legoomni/src/actors/pizza.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizza.cpp @@ -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(); } diff --git a/LEGO1/lego/legoomni/src/actors/pizzeria.cpp b/LEGO1/lego/legoomni/src/actors/pizzeria.cpp index d2d98956..3b5f8923 100644 --- a/LEGO1/lego/legoomni/src/actors/pizzeria.cpp +++ b/LEGO1/lego/legoomni/src/actors/pizzeria.cpp @@ -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); } } diff --git a/LEGO1/lego/legoomni/src/actors/racecar.cpp b/LEGO1/lego/legoomni/src/actors/racecar.cpp index f511f524..ff9eb293 100644 --- a/LEGO1/lego/legoomni/src/actors/racecar.cpp +++ b/LEGO1/lego/legoomni/src/actors/racecar.cpp @@ -40,7 +40,7 @@ MxResult RaceCar::Create(MxDSAction& p_dsAction) // FUNCTION: LEGO1 0x100284d0 MxLong RaceCar::HandleClick() { - if (!FUN_1003ef60()) { + if (!CanExit()) { return 1; } diff --git a/LEGO1/lego/legoomni/src/actors/radio.cpp b/LEGO1/lego/legoomni/src/actors/radio.cpp index db5017f2..fa600b7d 100644 --- a/LEGO1/lego/legoomni/src/actors/radio.cpp +++ b/LEGO1/lego/legoomni/src/actors/radio.cpp @@ -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; } } diff --git a/LEGO1/lego/legoomni/src/actors/skateboard.cpp b/LEGO1/lego/legoomni/src/actors/skateboard.cpp index 5aafe1be..0998ba58 100644 --- a/LEGO1/lego/legoomni/src/actors/skateboard.cpp +++ b/LEGO1/lego/legoomni/src/actors/skateboard.cpp @@ -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; } diff --git a/LEGO1/lego/legoomni/src/actors/towtrack.cpp b/LEGO1/lego/legoomni/src/actors/towtrack.cpp index 5ff5697e..7d8a8975 100644 --- a/LEGO1/lego/legoomni/src/actors/towtrack.cpp +++ b/LEGO1/lego/legoomni/src/actors/towtrack.cpp @@ -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: diff --git a/LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp b/LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp index d89f5cd4..8b90d39b 100644 --- a/LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp +++ b/LEGO1/lego/legoomni/src/audio/mxbackgroundaudiomanager.cpp @@ -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; } diff --git a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp index 65a0dc69..5f99393e 100644 --- a/LEGO1/lego/legoomni/src/build/legocarbuild.cpp +++ b/LEGO1/lego/legoomni/src/build/legocarbuild.cpp @@ -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); } } diff --git a/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp b/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp index 31189d72..c2dbbd8a 100644 --- a/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp +++ b/LEGO1/lego/legoomni/src/build/legocarbuildpresenter.cpp @@ -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(); } diff --git a/LEGO1/lego/legoomni/src/common/legoactors.cpp b/LEGO1/lego/legoomni/src/common/legoactors.cpp index 7bf10520..67731d25 100644 --- a/LEGO1/lego/legoomni/src/common/legoactors.cpp +++ b/LEGO1/lego/legoomni/src/common/legoactors.cpp @@ -10,7 +10,7 @@ DECOMP_SIZE_ASSERT(LegoActorLOD, 0x58) LegoActorLOD g_actorLODs[] = { {"top", "top", 0, 0.000267f, 0.780808f, -0.01906f, 0.951612f, -0.461166f, -0.002794f, -0.299442f, 0.4617f, 1.56441f, 0.261321f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f}, - {"body", "body", LegoActorLOD::c_flag1, + {"body", "body", LegoActorLOD::c_useTexture, 0.00158332f, 0.401828f, -0.00048697f, 0.408071f, -0.287507f, 0.150419f, -0.147452f, 0.289219f, 0.649774f, @@ -18,7 +18,7 @@ LegoActorLOD g_actorLODs[] = { 0.007277f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f}, - {"infohat", "infohat", LegoActorLOD::c_flag2, + {"infohat", "infohat", LegoActorLOD::c_useColor, 0.0f, -0.00938f, -0.01955f, 0.35f, -0.231822f, -0.140237f, -0.320954f, 0.234149f, 0.076968f, @@ -26,7 +26,7 @@ LegoActorLOD g_actorLODs[] = { 0.001767f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f}, - {"infogron", "infogron", LegoActorLOD::c_flag2, + {"infogron", "infogron", LegoActorLOD::c_useColor, 0.0f, 0.11477f, 0.00042f, 0.26f, -0.285558f, -0.134391f, -0.142231f, 0.285507f, 0.152986f, @@ -34,7 +34,7 @@ LegoActorLOD g_actorLODs[] = { 0.007277f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f}, - {"head", "head", LegoActorLOD::c_flag1, + {"head", "head", LegoActorLOD::c_useTexture, 0.0f, -0.03006f, 0.0f, 0.3f, -0.189506f, -0.209665f, -0.189824f, 0.189532f, 0.228822f, @@ -42,7 +42,7 @@ LegoActorLOD g_actorLODs[] = { 0.001781f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f}, - {"arm-lft", "arm-lft", LegoActorLOD::c_flag2, + {"arm-lft", "arm-lft", LegoActorLOD::c_useColor, -0.06815f, -0.0973747f, 0.0154655f, 0.237f, -0.137931f, -0.282775f, -0.105316f, 0.000989f, 0.100221f, @@ -50,7 +50,7 @@ LegoActorLOD g_actorLODs[] = { 0.023286f, -0.003031f, -0.017187f, 0.999848f, 0.173622f, 0.984658f, 0.017453f}, - {"arm-rt", "arm-rt", LegoActorLOD::c_flag2, + {"arm-rt", "arm-rt", LegoActorLOD::c_useColor, 0.0680946f, -0.097152f, 0.0152722f, 0.237f, 0.00141f, -0.289604f, -0.100831f, 0.138786f, 0.09291f, @@ -58,7 +58,7 @@ LegoActorLOD g_actorLODs[] = { 0.018302f, 0.0f, 0.0f, 1.0f, -0.173648f, 0.984808f, 0.0f}, - {"claw-lft", "claw-lft", LegoActorLOD::c_flag2, + {"claw-lft", "claw-lft", LegoActorLOD::c_useColor, 0.000773381f, -0.101422f, -0.0237761f, 0.15f, -0.089838f, -0.246208f, -0.117735f, 0.091275f, 0.000263f, @@ -66,7 +66,7 @@ LegoActorLOD g_actorLODs[] = { 0.092779f, 0.000001f, 0.000003f, 1.0f, 0.190812f, 0.981627f, -0.000003f}, - {"claw-rt", "claw-lft", LegoActorLOD::c_flag2, + {"claw-rt", "claw-lft", LegoActorLOD::c_useColor, 0.000773381f, -0.101422f, -0.0237761f, 0.15f, -0.095016f, -0.245349f, -0.117979f, 0.086528f, 0.00067f, @@ -74,7 +74,7 @@ LegoActorLOD g_actorLODs[] = { 0.096123f, 0.00606f, -0.034369f, 0.999391f, -0.190704f, 0.981027f, 0.034894f}, - {"leg-lft", "leg", LegoActorLOD::c_flag2, + {"leg-lft", "leg", LegoActorLOD::c_useColor, 0.00433584f, -0.177404f, -0.0313928f, 0.33f, -0.129782f, -0.440428f, -0.184207f, 0.13817f, 0.118415f, @@ -82,7 +82,7 @@ LegoActorLOD g_actorLODs[] = { 0.006822f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f}, - {"leg-rt", "leg", LegoActorLOD::c_flag2, + {"leg-rt", "leg", LegoActorLOD::c_useColor, 0.00433584f, -0.177404f, -0.0313928f, 0.33f, -0.132864f, -0.437138f, -0.183944f, 0.134614f, 0.12043f, @@ -93,64 +93,64 @@ LegoActorLOD g_actorLODs[] = { }; // GLOBAL: LEGO1 0x100da778 -MxU8 g_unk0x100da778[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0xff}; +MxU8 g_hatPartIndices[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0xff}; // GLOBAL: LEGO1 0x100da790 -MxU8 g_unk0x100da790[] = {21, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0xff}; +MxU8 g_pepperHatPartIndices[] = {21, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 0xff}; // GLOBAL: LEGO1 0x100da7a8 -MxU8 g_unk0x100da7a8[] = {22, 0xff}; +MxU8 g_infomanHatPartIndices[] = {22, 0xff}; // GLOBAL: LEGO1 0x100da7ac -MxU8 g_unk0x100da7ac[] = {20, 0xff}; +MxU8 g_ghostHatPartIndices[] = {20, 0xff}; // GLOBAL: LEGO1 0x100da7b0 -MxU8 g_unk0x100da7b0[] = {0, 1, 2, 3, 4, 5, 6, 7, 0xff}; +MxU8 g_bodyPartIndices[] = {0, 1, 2, 3, 4, 5, 6, 7, 0xff}; // GLOBAL: LEGO1 0x100da7c0 -MxU8 g_unk0x100da7c0[] = {0, 1, 2, 3, 4, 5, 6, 7, 0xff}; +MxU8 g_hatColorIndices[] = {0, 1, 2, 3, 4, 5, 6, 7, 0xff}; // GLOBAL: LEGO1 0x100da7d0 -MxU8 g_unk0x100da7d0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0xff}; +MxU8 g_faceTextureIndices[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0xff}; // GLOBAL: LEGO1 0x100da7e0 -MxU8 g_unk0x100da7e0[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 0xff}; +MxU8 g_chestTextureIndices[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 0xff}; // GLOBAL: LEGO1 0x100da800 -MxU8 g_unk0x100da800[] = {0, 1, 2, 3, 4, 5, 6, 7, 0xff}; +MxU8 g_armColorIndices[] = {0, 1, 2, 3, 4, 5, 6, 7, 0xff}; // GLOBAL: LEGO1 0x100da810 -MxU8 g_unk0x100da810[] = {0, 1, 2, 3, 4, 5, 6, 7, 0xff}; +MxU8 g_clawRightColorIndices[] = {0, 1, 2, 3, 4, 5, 6, 7, 0xff}; // GLOBAL: LEGO1 0x100da820 -MxU8 g_unk0x100da820[] = {0, 1, 2, 3, 4, 5, 6, 7, 0xff}; +MxU8 g_clawLeftColorIndices[] = {0, 1, 2, 3, 4, 5, 6, 7, 0xff}; // GLOBAL: LEGO1 0x100da830 -MxU8 g_unk0x100da830[] = {0, 1, 2, 3, 4, 5, 6, 7, 0xff}; +MxU8 g_gronColorIndices[] = {0, 1, 2, 3, 4, 5, 6, 7, 0xff}; // GLOBAL: LEGO1 0x100da840 -MxU8 g_unk0x100da840[] = {0, 1, 2, 3, 4, 5, 6, 7, 0xff}; +MxU8 g_legColorIndices[] = {0, 1, 2, 3, 4, 5, 6, 7, 0xff}; // GLOBAL: LEGO1 0x100f7f78 -const char* g_unk0x100f7f78[] = {"baseball", "chef", "cap", "cophat", "helmet", "ponytail", "pageboy", "shrthair", - "bald", "flower", "cboyhat", "cuphat", "cathat", "backbcap", "pizhat", "caprc", - "capch", "capdb", "capjs", "capmd", "sheet", "phat", "icap", NULL}; +const char* g_hatPartName[] = {"baseball", "chef", "cap", "cophat", "helmet", "ponytail", "pageboy", "shrthair", + "bald", "flower", "cboyhat", "cuphat", "cathat", "backbcap", "pizhat", "caprc", + "capch", "capdb", "capjs", "capmd", "sheet", "phat", "icap", NULL}; // GLOBAL: LEGO1 0x100f7fd8 -const char* g_unk0x100f7fd8[] = +const char* g_bodyPartName[] = {"body", "bodyred", "bodyblck", "bodywhte", "bodyyllw", "bodyblue", "bodygren", "bodybrwn"}; // GLOBAL: LEGO1 0x100f7ff8 -const char* g_unk0x100f7ff8[] = {"peprchst.gif", "mamachst.gif", "papachst.gif", "nickchst.gif", "norachst.gif", - "infochst.gif", "shftchst.gif", "rac1chst.gif", "rac2chst.gif", "bth1chst.gif", - "bth2chst.gif", "mech.gif", "polkadot.gif", "bowtie.gif", "postchst.gif", - "vest.gif", "doctor.gif", "copchest.gif", "l.gif", "e.gif", - "g.gif", "o.gif", "fruit.gif", "flowers.gif", "construct.gif", - "paint.gif", "l6.gif", "unkchst.gif"}; +const char* g_chestTexture[] = {"peprchst.gif", "mamachst.gif", "papachst.gif", "nickchst.gif", "norachst.gif", + "infochst.gif", "shftchst.gif", "rac1chst.gif", "rac2chst.gif", "bth1chst.gif", + "bth2chst.gif", "mech.gif", "polkadot.gif", "bowtie.gif", "postchst.gif", + "vest.gif", "doctor.gif", "copchest.gif", "l.gif", "e.gif", + "g.gif", "o.gif", "fruit.gif", "flowers.gif", "construct.gif", + "paint.gif", "l6.gif", "unkchst.gif"}; // GLOBAL: LEGO1 0x100f8068 -const char* g_unk0x100f8068[] = { +const char* g_faceTexture[] = { "peprface.gif", "mamaface.gif", "papaface.gif", @@ -168,7 +168,7 @@ const char* g_unk0x100f8068[] = { }; // GLOBAL: LEGO1 0x100f80a0 -const char* g_unk0x100f80a0[] = +const char* g_colorAlias[] = {"lego white", "lego black", "lego yellow", "lego red", "lego blue", "lego brown", "lego lt grey", "lego green"}; // GLOBAL: LEGO1 0x100f80c0 @@ -179,1054 +179,1054 @@ LegoActorInfo g_actorInfoInit[] = { 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 1, g_unk0x100da7e0, g_unk0x100f7ff8, 0}, - {g_unk0x100da790, g_unk0x100f7f78, 0, g_unk0x100da7c0, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}}}, + {{g_bodyPartIndices, g_bodyPartName, 1, g_chestTextureIndices, g_chestTexture, 0}, + {g_pepperHatPartIndices, g_hatPartName, 0, g_hatColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}}}, {"mama", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 1, g_unk0x100da7e0, g_unk0x100f7ff8, 1}, - {g_unk0x100da778, g_unk0x100f7f78, 1, g_unk0x100da7c0, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 1}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}}}, + {{g_bodyPartIndices, g_bodyPartName, 1, g_chestTextureIndices, g_chestTexture, 1}, + {g_hatPartIndices, g_hatPartName, 1, g_hatColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 1}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}}}, {"papa", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 2, g_unk0x100da7e0, g_unk0x100f7ff8, 2}, - {g_unk0x100da778, g_unk0x100f7f78, 1, g_unk0x100da7c0, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 2}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}}}, + {{g_bodyPartIndices, g_bodyPartName, 2, g_chestTextureIndices, g_chestTexture, 2}, + {g_hatPartIndices, g_hatPartName, 1, g_hatColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 2}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}}}, {"nick", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 2, g_unk0x100da7e0, g_unk0x100f7ff8, 3}, - {g_unk0x100da778, g_unk0x100f7f78, 3, g_unk0x100da7c0, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 3}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}}}, + {{g_bodyPartIndices, g_bodyPartName, 2, g_chestTextureIndices, g_chestTexture, 3}, + {g_hatPartIndices, g_hatPartName, 3, g_hatColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 3}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}}}, {"laura", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 2, g_unk0x100da7e0, g_unk0x100f7ff8, 4}, - {g_unk0x100da778, g_unk0x100f7f78, 3, g_unk0x100da7c0, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 4}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}}}, + {{g_bodyPartIndices, g_bodyPartName, 2, g_chestTextureIndices, g_chestTexture, 4}, + {g_hatPartIndices, g_hatPartName, 3, g_hatColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 4}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}}}, {"infoman", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 1, g_unk0x100da7e0, g_unk0x100f7ff8, 5}, - {g_unk0x100da7a8, g_unk0x100f7f78, 0, g_unk0x100da7c0, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 5}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}}}, + {{g_bodyPartIndices, g_bodyPartName, 1, g_chestTextureIndices, g_chestTexture, 5}, + {g_infomanHatPartIndices, g_hatPartName, 0, g_hatColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 5}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}}}, {"brickstr", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 3, g_unk0x100da7e0, g_unk0x100f7ff8, 6}, - {g_unk0x100da778, g_unk0x100f7f78, 13, g_unk0x100da7c0, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 6}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}}}, + {{g_bodyPartIndices, g_bodyPartName, 3, g_chestTextureIndices, g_chestTexture, 6}, + {g_hatPartIndices, g_hatPartName, 13, g_hatColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 6}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}}}, {"studs", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 1, g_unk0x100da7e0, g_unk0x100f7ff8, 7}, - {g_unk0x100da778, g_unk0x100f7f78, 4, g_unk0x100da7c0, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 7}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}}}, + {{g_bodyPartIndices, g_bodyPartName, 1, g_chestTextureIndices, g_chestTexture, 7}, + {g_hatPartIndices, g_hatPartName, 4, g_hatColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 7}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}}}, {"rhoda", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 5, g_unk0x100da7e0, g_unk0x100f7ff8, 8}, - {g_unk0x100da778, g_unk0x100f7f78, 4, g_unk0x100da7c0, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 8}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}}}, + {{g_bodyPartIndices, g_bodyPartName, 5, g_chestTextureIndices, g_chestTexture, 8}, + {g_hatPartIndices, g_hatPartName, 4, g_hatColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 8}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}}}, {"valerie", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 1, g_unk0x100da7e0, g_unk0x100f7ff8, 9}, - {g_unk0x100da778, g_unk0x100f7f78, 5, g_unk0x100da7c0, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 8}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 2}}}, + {{g_bodyPartIndices, g_bodyPartName, 1, g_chestTextureIndices, g_chestTexture, 9}, + {g_hatPartIndices, g_hatPartName, 5, g_hatColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 8}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 2}}}, {"snap", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 3, g_unk0x100da7e0, g_unk0x100f7ff8, 10}, - {g_unk0x100da778, g_unk0x100f7f78, 0, g_unk0x100da7c0, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 9}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 2}}}, + {{g_bodyPartIndices, g_bodyPartName, 3, g_chestTextureIndices, g_chestTexture, 10}, + {g_hatPartIndices, g_hatPartName, 0, g_hatColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 9}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 2}}}, {"pt", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 5, g_unk0x100da7e0, g_unk0x100f7ff8, 11}, - {g_unk0x100da778, g_unk0x100f7f78, 6, g_unk0x100da7c0, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 8}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}}}, + {{g_bodyPartIndices, g_bodyPartName, 5, g_chestTextureIndices, g_chestTexture, 11}, + {g_hatPartIndices, g_hatPartName, 6, g_hatColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 8}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}}}, {"mg", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 1, g_unk0x100da7e0, g_unk0x100f7ff8, 12}, - {g_unk0x100da778, g_unk0x100f7f78, 6, g_unk0x100da7c0, g_unk0x100f80a0, 5}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 10}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}}}, + {{g_bodyPartIndices, g_bodyPartName, 1, g_chestTextureIndices, g_chestTexture, 12}, + {g_hatPartIndices, g_hatPartName, 6, g_hatColorIndices, g_colorAlias, 5}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 10}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}}}, {"bu", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 3, g_unk0x100da7e0, g_unk0x100f7ff8, 13}, - {g_unk0x100da778, g_unk0x100f7f78, 7, g_unk0x100da7c0, g_unk0x100f80a0, 5}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 5}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 11}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 5}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 5}}}, + {{g_bodyPartIndices, g_bodyPartName, 3, g_chestTextureIndices, g_chestTexture, 13}, + {g_hatPartIndices, g_hatPartName, 7, g_hatColorIndices, g_colorAlias, 5}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 5}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 11}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 5}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 5}}}, {"ml", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 5, g_unk0x100da7e0, g_unk0x100f7ff8, 14}, - {g_unk0x100da778, g_unk0x100f7f78, 2, g_unk0x100da7c0, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 12}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}}}, + {{g_bodyPartIndices, g_bodyPartName, 5, g_chestTextureIndices, g_chestTexture, 14}, + {g_hatPartIndices, g_hatPartName, 2, g_hatColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 12}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}}}, {"nu", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 5, g_unk0x100da7e0, g_unk0x100f7ff8, 11}, - {g_unk0x100da778, g_unk0x100f7f78, 7, g_unk0x100da7c0, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 7}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}}}, + {{g_bodyPartIndices, g_bodyPartName, 5, g_chestTextureIndices, g_chestTexture, 11}, + {g_hatPartIndices, g_hatPartName, 7, g_hatColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 7}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}}}, {"na", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 3, g_unk0x100da7e0, g_unk0x100f7ff8, 15}, - {g_unk0x100da778, g_unk0x100f7f78, 10, g_unk0x100da7c0, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 8}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 3}}}, + {{g_bodyPartIndices, g_bodyPartName, 3, g_chestTextureIndices, g_chestTexture, 15}, + {g_hatPartIndices, g_hatPartName, 10, g_hatColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 8}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 3}}}, {"cl", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 3, g_unk0x100da7e0, g_unk0x100f7ff8, 16}, - {g_unk0x100da778, g_unk0x100f7f78, 19, g_unk0x100da7c0, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 12}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}}}, + {{g_bodyPartIndices, g_bodyPartName, 3, g_chestTextureIndices, g_chestTexture, 16}, + {g_hatPartIndices, g_hatPartName, 19, g_hatColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 12}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}}}, {"en", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 3, g_unk0x100da7e0, g_unk0x100f7ff8, 16}, - {g_unk0x100da778, g_unk0x100f7f78, 0, g_unk0x100da7c0, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 11}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}}}, + {{g_bodyPartIndices, g_bodyPartName, 3, g_chestTextureIndices, g_chestTexture, 16}, + {g_hatPartIndices, g_hatPartName, 0, g_hatColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 11}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}}}, {"re", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 3, g_unk0x100da7e0, g_unk0x100f7ff8, 16}, - {g_unk0x100da778, g_unk0x100f7f78, 0, g_unk0x100da7c0, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 11}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}}}, + {{g_bodyPartIndices, g_bodyPartName, 3, g_chestTextureIndices, g_chestTexture, 16}, + {g_hatPartIndices, g_hatPartName, 0, g_hatColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 11}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}}}, {"ro", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 2, g_unk0x100da7e0, g_unk0x100f7ff8, 17}, - {g_unk0x100da778, g_unk0x100f7f78, 3, g_unk0x100da7c0, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 9}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}}}, + {{g_bodyPartIndices, g_bodyPartName, 2, g_chestTextureIndices, g_chestTexture, 17}, + {g_hatPartIndices, g_hatPartName, 3, g_hatColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 9}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}}}, {"d1", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 5, g_unk0x100da7e0, g_unk0x100f7ff8, 11}, - {g_unk0x100da778, g_unk0x100f7f78, 15, g_unk0x100da7c0, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 11}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}}}, + {{g_bodyPartIndices, g_bodyPartName, 5, g_chestTextureIndices, g_chestTexture, 11}, + {g_hatPartIndices, g_hatPartName, 15, g_hatColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 11}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}}}, {"d2", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 5, g_unk0x100da7e0, g_unk0x100f7ff8, 11}, - {g_unk0x100da778, g_unk0x100f7f78, 16, g_unk0x100da7c0, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 11}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}}}, + {{g_bodyPartIndices, g_bodyPartName, 5, g_chestTextureIndices, g_chestTexture, 11}, + {g_hatPartIndices, g_hatPartName, 16, g_hatColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 11}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}}}, {"d3", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 5, g_unk0x100da7e0, g_unk0x100f7ff8, 11}, - {g_unk0x100da778, g_unk0x100f7f78, 17, g_unk0x100da7c0, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 11}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}}}, + {{g_bodyPartIndices, g_bodyPartName, 5, g_chestTextureIndices, g_chestTexture, 11}, + {g_hatPartIndices, g_hatPartName, 17, g_hatColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 11}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}}}, {"d4", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 5, g_unk0x100da7e0, g_unk0x100f7ff8, 11}, - {g_unk0x100da778, g_unk0x100f7f78, 18, g_unk0x100da7c0, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 11}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}}}, + {{g_bodyPartIndices, g_bodyPartName, 5, g_chestTextureIndices, g_chestTexture, 11}, + {g_hatPartIndices, g_hatPartName, 18, g_hatColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 11}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}}}, {"l1", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 1, g_unk0x100da7e0, g_unk0x100f7ff8, 18}, - {g_unk0x100da778, g_unk0x100f7f78, 5, g_unk0x100da7c0, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 11}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}}}, + {{g_bodyPartIndices, g_bodyPartName, 1, g_chestTextureIndices, g_chestTexture, 18}, + {g_hatPartIndices, g_hatPartName, 5, g_hatColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 11}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}}}, {"l2", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 1, g_unk0x100da7e0, g_unk0x100f7ff8, 19}, - {g_unk0x100da778, g_unk0x100f7f78, 6, g_unk0x100da7c0, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 12}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}}}, + {{g_bodyPartIndices, g_bodyPartName, 1, g_chestTextureIndices, g_chestTexture, 19}, + {g_hatPartIndices, g_hatPartName, 6, g_hatColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 12}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}}}, {"l3", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 1, g_unk0x100da7e0, g_unk0x100f7ff8, 20}, - {g_unk0x100da778, g_unk0x100f7f78, 7, g_unk0x100da7c0, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 11}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}}}, + {{g_bodyPartIndices, g_bodyPartName, 1, g_chestTextureIndices, g_chestTexture, 20}, + {g_hatPartIndices, g_hatPartName, 7, g_hatColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 11}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}}}, {"l4", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 1, g_unk0x100da7e0, g_unk0x100f7ff8, 21}, - {g_unk0x100da778, g_unk0x100f7f78, 7, g_unk0x100da7c0, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 11}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}}}, + {{g_bodyPartIndices, g_bodyPartName, 1, g_chestTextureIndices, g_chestTexture, 21}, + {g_hatPartIndices, g_hatPartName, 7, g_hatColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 11}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}}}, {"l5", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 1, g_unk0x100da7e0, g_unk0x100f7ff8, 26}, - {g_unk0x100da778, g_unk0x100f7f78, 7, g_unk0x100da7c0, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 12}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}}}, + {{g_bodyPartIndices, g_bodyPartName, 1, g_chestTextureIndices, g_chestTexture, 26}, + {g_hatPartIndices, g_hatPartName, 7, g_hatColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 12}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}}}, {"l6", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 1, g_unk0x100da7e0, g_unk0x100f7ff8, 26}, - {g_unk0x100da778, g_unk0x100f7f78, 0, g_unk0x100da7c0, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 11}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}}}, + {{g_bodyPartIndices, g_bodyPartName, 1, g_chestTextureIndices, g_chestTexture, 26}, + {g_hatPartIndices, g_hatPartName, 0, g_hatColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 11}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}}}, {"b1", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 0, g_unk0x100da840, g_unk0x100f80a0, 1}, - {g_unk0x100da778, g_unk0x100f7f78, 7, g_unk0x100da7c0, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 12}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}}}, + {{g_bodyPartIndices, g_bodyPartName, 0, g_legColorIndices, g_colorAlias, 1}, + {g_hatPartIndices, g_hatPartName, 7, g_hatColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 12}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}}}, {"b2", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 0, g_unk0x100da840, g_unk0x100f80a0, 1}, - {g_unk0x100da778, g_unk0x100f7f78, 5, g_unk0x100da7c0, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 10}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}}}, + {{g_bodyPartIndices, g_bodyPartName, 0, g_legColorIndices, g_colorAlias, 1}, + {g_hatPartIndices, g_hatPartName, 5, g_hatColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 10}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}}}, {"b3", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 0, g_unk0x100da840, g_unk0x100f80a0, 4}, - {g_unk0x100da778, g_unk0x100f7f78, 7, g_unk0x100da7c0, g_unk0x100f80a0, 5}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 11}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}}}, + {{g_bodyPartIndices, g_bodyPartName, 0, g_legColorIndices, g_colorAlias, 4}, + {g_hatPartIndices, g_hatPartName, 7, g_hatColorIndices, g_colorAlias, 5}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 11}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}}}, {"b4", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 0, g_unk0x100da840, g_unk0x100f80a0, 1}, - {g_unk0x100da778, g_unk0x100f7f78, 7, g_unk0x100da7c0, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 9}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}}}, + {{g_bodyPartIndices, g_bodyPartName, 0, g_legColorIndices, g_colorAlias, 1}, + {g_hatPartIndices, g_hatPartName, 7, g_hatColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 9}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}}}, {"cm", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 4, g_unk0x100da7e0, g_unk0x100f7ff8, 22}, - {g_unk0x100da778, g_unk0x100f7f78, 9, g_unk0x100da7c0, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 8}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 3}}}, + {{g_bodyPartIndices, g_bodyPartName, 4, g_chestTextureIndices, g_chestTexture, 22}, + {g_hatPartIndices, g_hatPartName, 9, g_hatColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 8}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 3}}}, {"gd", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 0, g_unk0x100da840, g_unk0x100f80a0, 1}, - {g_unk0x100da778, g_unk0x100f7f78, 7, g_unk0x100da7c0, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 6}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 11}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 6}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 6}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 6}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 6}}}, + {{g_bodyPartIndices, g_bodyPartName, 0, g_legColorIndices, g_colorAlias, 1}, + {g_hatPartIndices, g_hatPartName, 7, g_hatColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 6}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 11}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 6}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 6}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 6}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 6}}}, {"rd", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 0, g_unk0x100da840, g_unk0x100f80a0, 3}, - {g_unk0x100da778, g_unk0x100f7f78, 0, g_unk0x100da7c0, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 7}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 9}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 7}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 7}}}, + {{g_bodyPartIndices, g_bodyPartName, 0, g_legColorIndices, g_colorAlias, 3}, + {g_hatPartIndices, g_hatPartName, 0, g_hatColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 7}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 9}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 7}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 7}}}, {"pg", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 0, g_unk0x100da840, g_unk0x100f80a0, 3}, - {g_unk0x100da778, g_unk0x100f7f78, 5, g_unk0x100da7c0, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 11}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 3}}}, + {{g_bodyPartIndices, g_bodyPartName, 0, g_legColorIndices, g_colorAlias, 3}, + {g_hatPartIndices, g_hatPartName, 5, g_hatColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 11}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 3}}}, {"bd", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 0, g_unk0x100da840, g_unk0x100f80a0, 6}, - {g_unk0x100da778, g_unk0x100f7f78, 0, g_unk0x100da7c0, g_unk0x100f80a0, 6}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 12}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}}}, + {{g_bodyPartIndices, g_bodyPartName, 0, g_legColorIndices, g_colorAlias, 6}, + {g_hatPartIndices, g_hatPartName, 0, g_hatColorIndices, g_colorAlias, 6}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 12}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}}}, {"sy", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 0, g_unk0x100da840, g_unk0x100f80a0, 4}, - {g_unk0x100da778, g_unk0x100f7f78, 5, g_unk0x100da7c0, g_unk0x100f80a0, 6}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 10}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}}}, + {{g_bodyPartIndices, g_bodyPartName, 0, g_legColorIndices, g_colorAlias, 4}, + {g_hatPartIndices, g_hatPartName, 5, g_hatColorIndices, g_colorAlias, 6}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 10}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}}}, {"gn", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 6, g_unk0x100da7e0, g_unk0x100f7ff8, 13}, - {g_unk0x100da778, g_unk0x100f7f78, 7, g_unk0x100da7c0, g_unk0x100f80a0, 5}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 5}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 9}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 5}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 5}}}, + {{g_bodyPartIndices, g_bodyPartName, 6, g_chestTextureIndices, g_chestTexture, 13}, + {g_hatPartIndices, g_hatPartName, 7, g_hatColorIndices, g_colorAlias, 5}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 5}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 9}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 5}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 5}}}, {"df", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 5, g_unk0x100da7e0, g_unk0x100f7ff8, 23}, - {g_unk0x100da778, g_unk0x100f7f78, 6, g_unk0x100da7c0, g_unk0x100f80a0, 5}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 6}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 8}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 6}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 6}}}, + {{g_bodyPartIndices, g_bodyPartName, 5, g_chestTextureIndices, g_chestTexture, 23}, + {g_hatPartIndices, g_hatPartName, 6, g_hatColorIndices, g_colorAlias, 5}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 6}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 8}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 6}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 6}}}, {"bs", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 3, g_unk0x100da7e0, g_unk0x100f7ff8, 10}, - {g_unk0x100da778, g_unk0x100f7f78, 7, g_unk0x100da7c0, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 7}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 11}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 2}}}, + {{g_bodyPartIndices, g_bodyPartName, 3, g_chestTextureIndices, g_chestTexture, 10}, + {g_hatPartIndices, g_hatPartName, 7, g_hatColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 7}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 11}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 2}}}, {"lt", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 3, g_unk0x100da7e0, g_unk0x100f7ff8, 10}, - {g_unk0x100da778, g_unk0x100f7f78, 7, g_unk0x100da7c0, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 11}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 2}}}, + {{g_bodyPartIndices, g_bodyPartName, 3, g_chestTextureIndices, g_chestTexture, 10}, + {g_hatPartIndices, g_hatPartName, 7, g_hatColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 11}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 2}}}, {"st", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 1, g_unk0x100da7e0, g_unk0x100f7ff8, 9}, - {g_unk0x100da778, g_unk0x100f7f78, 5, g_unk0x100da7c0, g_unk0x100f80a0, 5}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 10}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 2}}}, + {{g_bodyPartIndices, g_bodyPartName, 1, g_chestTextureIndices, g_chestTexture, 9}, + {g_hatPartIndices, g_hatPartName, 5, g_hatColorIndices, g_colorAlias, 5}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 10}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 2}}}, {"bm", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 3, g_unk0x100da7e0, g_unk0x100f7ff8, 24}, - {g_unk0x100da778, g_unk0x100f7f78, 0, g_unk0x100da7c0, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 7}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 6}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 6}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}}}, + {{g_bodyPartIndices, g_bodyPartName, 3, g_chestTextureIndices, g_chestTexture, 24}, + {g_hatPartIndices, g_hatPartName, 0, g_hatColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 7}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 6}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 6}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}}}, {"jk", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 3, g_unk0x100da7e0, g_unk0x100f7ff8, 24}, - {g_unk0x100da778, g_unk0x100f7f78, 0, g_unk0x100da7c0, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 9}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 6}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 6}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}}}, + {{g_bodyPartIndices, g_bodyPartName, 3, g_chestTextureIndices, g_chestTexture, 24}, + {g_hatPartIndices, g_hatPartName, 0, g_hatColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 9}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 6}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 6}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}}}, {"ghost", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 0, g_unk0x100da840, g_unk0x100f80a0, 0}, - {g_unk0x100da7ac, g_unk0x100f7f78, 0, g_unk0x100da7c0, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 13}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}}}, + {{g_bodyPartIndices, g_bodyPartName, 0, g_legColorIndices, g_colorAlias, 0}, + {g_ghostHatPartIndices, g_hatPartName, 0, g_hatColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 13}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}}}, {"ghost01", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 0, g_unk0x100da840, g_unk0x100f80a0, 0}, - {g_unk0x100da7ac, g_unk0x100f7f78, 0, g_unk0x100da7c0, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 13}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}}}, + {{g_bodyPartIndices, g_bodyPartName, 0, g_legColorIndices, g_colorAlias, 0}, + {g_ghostHatPartIndices, g_hatPartName, 0, g_hatColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 13}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}}}, {"ghost02", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 0, g_unk0x100da840, g_unk0x100f80a0, 0}, - {g_unk0x100da7ac, g_unk0x100f7f78, 0, g_unk0x100da7c0, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 13}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}}}, + {{g_bodyPartIndices, g_bodyPartName, 0, g_legColorIndices, g_colorAlias, 0}, + {g_ghostHatPartIndices, g_hatPartName, 0, g_hatColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 13}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}}}, {"ghost03", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 0, g_unk0x100da840, g_unk0x100f80a0, 0}, - {g_unk0x100da7ac, g_unk0x100f7f78, 0, g_unk0x100da7c0, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 13}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}}}, + {{g_bodyPartIndices, g_bodyPartName, 0, g_legColorIndices, g_colorAlias, 0}, + {g_ghostHatPartIndices, g_hatPartName, 0, g_hatColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 13}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}}}, {"ghost04", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 0, g_unk0x100da840, g_unk0x100f80a0, 0}, - {g_unk0x100da7ac, g_unk0x100f7f78, 0, g_unk0x100da7c0, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 13}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}}}, + {{g_bodyPartIndices, g_bodyPartName, 0, g_legColorIndices, g_colorAlias, 0}, + {g_ghostHatPartIndices, g_hatPartName, 0, g_hatColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 13}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}}}, {"ghost05", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 0, g_unk0x100da840, g_unk0x100f80a0, 0}, - {g_unk0x100da7ac, g_unk0x100f7f78, 0, g_unk0x100da7c0, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 13}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 0}}}, + {{g_bodyPartIndices, g_bodyPartName, 0, g_legColorIndices, g_colorAlias, 0}, + {g_ghostHatPartIndices, g_hatPartName, 0, g_hatColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 13}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 0}}}, {"hg", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 0, g_unk0x100da840, g_unk0x100f80a0, 3}, - {g_unk0x100da778, g_unk0x100f7f78, 8, g_unk0x100da7c0, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 8}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 3}}}, + {{g_bodyPartIndices, g_bodyPartName, 0, g_legColorIndices, g_colorAlias, 3}, + {g_hatPartIndices, g_hatPartName, 8, g_hatColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 8}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 3}}}, {"pntgy", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 0, g_unk0x100da840, g_unk0x100f80a0, 3}, - {g_unk0x100da778, g_unk0x100f7f78, 0, g_unk0x100da7c0, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 7}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 3}}}, + {{g_bodyPartIndices, g_bodyPartName, 0, g_legColorIndices, g_colorAlias, 3}, + {g_hatPartIndices, g_hatPartName, 0, g_hatColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 7}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 3}}}, {"pep", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 1, g_unk0x100da7e0, g_unk0x100f7ff8, 0}, - {g_unk0x100da790, g_unk0x100f7f78, 0, g_unk0x100da7c0, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}}}, + {{g_bodyPartIndices, g_bodyPartName, 1, g_chestTextureIndices, g_chestTexture, 0}, + {g_pepperHatPartIndices, g_hatPartName, 0, g_hatColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}}}, {"cop01", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 2, g_unk0x100da7e0, g_unk0x100f7ff8, 17}, - {g_unk0x100da778, g_unk0x100f7f78, 3, g_unk0x100da7c0, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 9}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}}}, + {{g_bodyPartIndices, g_bodyPartName, 2, g_chestTextureIndices, g_chestTexture, 17}, + {g_hatPartIndices, g_hatPartName, 3, g_hatColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 9}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}}}, {"actor_01", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 0, g_unk0x100da840, g_unk0x100f80a0, 4}, - {g_unk0x100da778, g_unk0x100f7f78, 5, g_unk0x100da7c0, g_unk0x100f80a0, 6}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 10}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}}}, + {{g_bodyPartIndices, g_bodyPartName, 0, g_legColorIndices, g_colorAlias, 4}, + {g_hatPartIndices, g_hatPartName, 5, g_hatColorIndices, g_colorAlias, 6}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 10}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}}}, {"actor_02", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 0, g_unk0x100da840, g_unk0x100f80a0, 6}, - {g_unk0x100da778, g_unk0x100f7f78, 0, g_unk0x100da7c0, g_unk0x100f80a0, 6}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 12}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 1}}}, + {{g_bodyPartIndices, g_bodyPartName, 0, g_legColorIndices, g_colorAlias, 6}, + {g_hatPartIndices, g_hatPartName, 0, g_hatColorIndices, g_colorAlias, 6}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 12}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 1}}}, {"actor_03", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 0, g_unk0x100da840, g_unk0x100f80a0, 1}, - {g_unk0x100da778, g_unk0x100f7f78, 7, g_unk0x100da7c0, g_unk0x100f80a0, 1}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 6}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 11}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 6}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 6}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 6}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 6}}}, + {{g_bodyPartIndices, g_bodyPartName, 0, g_legColorIndices, g_colorAlias, 1}, + {g_hatPartIndices, g_hatPartName, 7, g_hatColorIndices, g_colorAlias, 1}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 6}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 11}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 6}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 6}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 6}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 6}}}, {"actor_04", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 1, g_unk0x100da7e0, g_unk0x100f7ff8, 12}, - {g_unk0x100da778, g_unk0x100f7f78, 6, g_unk0x100da7c0, g_unk0x100f80a0, 5}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 10}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 4}}}, + {{g_bodyPartIndices, g_bodyPartName, 1, g_chestTextureIndices, g_chestTexture, 12}, + {g_hatPartIndices, g_hatPartName, 6, g_hatColorIndices, g_colorAlias, 5}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 10}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 4}}}, {"actor_05", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 4, g_unk0x100da7e0, g_unk0x100f7ff8, 22}, - {g_unk0x100da778, g_unk0x100f7f78, 9, g_unk0x100da7c0, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 8}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 3}}}, + {{g_bodyPartIndices, g_bodyPartName, 4, g_chestTextureIndices, g_chestTexture, 22}, + {g_hatPartIndices, g_hatPartName, 9, g_hatColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 8}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 3}}}, {"btmncycl", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 0, g_unk0x100da840, g_unk0x100f80a0, 3}, - {g_unk0x100da778, g_unk0x100f7f78, 5, g_unk0x100da7c0, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 11}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 0}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 3}}}, + {{g_bodyPartIndices, g_bodyPartName, 0, g_legColorIndices, g_colorAlias, 3}, + {g_hatPartIndices, g_hatPartName, 5, g_hatColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 11}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 0}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 3}}}, {"cboycycl", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 3, g_unk0x100da7e0, g_unk0x100f7ff8, 10}, - {g_unk0x100da778, g_unk0x100f7f78, 7, g_unk0x100da7c0, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 7}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 11}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 2}}}, + {{g_bodyPartIndices, g_bodyPartName, 3, g_chestTextureIndices, g_chestTexture, 10}, + {g_hatPartIndices, g_hatPartName, 7, g_hatColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 7}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 11}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 2}}}, {"boatman", NULL, NULL, 0, 0, 0, - {{g_unk0x100da7b0, g_unk0x100f7fd8, 0, g_unk0x100da840, g_unk0x100f80a0, 3}, - {g_unk0x100da778, g_unk0x100f7f78, 0, g_unk0x100da7c0, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da830, g_unk0x100f80a0, 7}, - {NULL, NULL, 0, g_unk0x100da7d0, g_unk0x100f8068, 9}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da800, g_unk0x100f80a0, 3}, - {NULL, NULL, 0, g_unk0x100da820, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da810, g_unk0x100f80a0, 2}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 7}, - {NULL, NULL, 0, g_unk0x100da840, g_unk0x100f80a0, 7}}} + {{g_bodyPartIndices, g_bodyPartName, 0, g_legColorIndices, g_colorAlias, 3}, + {g_hatPartIndices, g_hatPartName, 0, g_hatColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_gronColorIndices, g_colorAlias, 7}, + {NULL, NULL, 0, g_faceTextureIndices, g_faceTexture, 9}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_armColorIndices, g_colorAlias, 3}, + {NULL, NULL, 0, g_clawLeftColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_clawRightColorIndices, g_colorAlias, 2}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 7}, + {NULL, NULL, 0, g_legColorIndices, g_colorAlias, 7}}} }; diff --git a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp index 51f9cea1..616be97a 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimationmanager.cpp @@ -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(), diff --git a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp index 21bad45d..ca6c2412 100644 --- a/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/legoanimmmpresenter.cpp @@ -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) { diff --git a/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp b/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp index fa6f83ef..4ea96d2b 100644 --- a/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legobuildingmanager.cpp @@ -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; } } diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index 8377e30f..ff7cf23b 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -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; } diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index cd4a6f1b..1e53cb4f 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -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; diff --git a/LEGO1/lego/legoomni/src/common/legophoneme.cpp b/LEGO1/lego/legoomni/src/common/legophoneme.cpp index 55da20c9..9f64e043 100644 --- a/LEGO1/lego/legoomni/src/common/legophoneme.cpp +++ b/LEGO1/lego/legoomni/src/common/legophoneme.cpp @@ -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 diff --git a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp index c7a821ae..4e8e2626 100644 --- a/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legoplantmanager.cpp @@ -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; } } diff --git a/LEGO1/lego/legoomni/src/common/legotextureinfo.cpp b/LEGO1/lego/legoomni/src/common/legotextureinfo.cpp index 51678ed8..943fbbe6 100644 --- a/LEGO1/lego/legoomni/src/common/legotextureinfo.cpp +++ b/LEGO1/lego/legoomni/src/common/legotextureinfo.cpp @@ -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; diff --git a/LEGO1/lego/legoomni/src/common/legoutils.cpp b/LEGO1/lego/legoomni/src/common/legoutils.cpp index d141e32c..d5ecb1ad 100644 --- a/LEGO1/lego/legoomni/src/common/legoutils.cpp +++ b/LEGO1/lego/legoomni/src/common/legoutils.cpp @@ -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()); } } diff --git a/LEGO1/lego/legoomni/src/common/legovariables.cpp b/LEGO1/lego/legoomni/src/common/legovariables.cpp index 68768e99..2c701074 100644 --- a/LEGO1/lego/legoomni/src/common/legovariables.cpp +++ b/LEGO1/lego/legoomni/src/common/legovariables.cpp @@ -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); } } diff --git a/LEGO1/lego/legoomni/src/common/mxcompositemediapresenter.cpp b/LEGO1/lego/legoomni/src/common/mxcompositemediapresenter.cpp index 36027f8e..04437877 100644 --- a/LEGO1/lego/legoomni/src/common/mxcompositemediapresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/mxcompositemediapresenter.cpp @@ -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: diff --git a/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp b/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp index 17beb3c1..9374cb9f 100644 --- a/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp +++ b/LEGO1/lego/legoomni/src/common/mxcontrolpresenter.cpp @@ -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); diff --git a/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp b/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp index aa091160..6b0a9fe0 100644 --- a/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp +++ b/LEGO1/lego/legoomni/src/common/mxtransitionmanager.cpp @@ -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) { diff --git a/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp b/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp index 8dd094f9..7851a52a 100644 --- a/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp +++ b/LEGO1/lego/legoomni/src/control/legocontrolmanager.cpp @@ -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; } diff --git a/LEGO1/lego/legoomni/src/control/legometerpresenter.cpp b/LEGO1/lego/legoomni/src/control/legometerpresenter.cpp index 0f45b60c..a55c79e1 100644 --- a/LEGO1/lego/legoomni/src/control/legometerpresenter.cpp +++ b/LEGO1/lego/legoomni/src/control/legometerpresenter.cpp @@ -27,7 +27,7 @@ LegoMeterPresenter::LegoMeterPresenter() // FUNCTION: BETA10 0x1009764a LegoMeterPresenter::~LegoMeterPresenter() { - delete m_meterPixels; + delete[] m_meterPixels; } // FUNCTION: LEGO1 0x10043800 diff --git a/LEGO1/lego/legoomni/src/entity/act2brick.cpp b/LEGO1/lego/legoomni/src/entity/act2brick.cpp index b182d365..16e0d2eb 100644 --- a/LEGO1/lego/legoomni/src/entity/act2brick.cpp +++ b/LEGO1/lego/legoomni/src/entity/act2brick.cpp @@ -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; } diff --git a/LEGO1/lego/legoomni/src/entity/legoactor.cpp b/LEGO1/lego/legoomni/src/entity/legoactor.cpp index 16787149..4b0428b8 100644 --- a/LEGO1/lego/legoomni/src/entity/legoactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoactor.cpp @@ -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) { diff --git a/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp b/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp index bde810e0..563ba615 100644 --- a/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legocameracontroller.cpp @@ -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( diff --git a/LEGO1/lego/legoomni/src/entity/legoentity.cpp b/LEGO1/lego/legoomni/src/entity/legoentity.cpp index d697907e..9ac9aad6 100644 --- a/LEGO1/lego/legoomni/src/entity/legoentity.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoentity.cpp @@ -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; diff --git a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp index 24ea5af5..fa8158da 100644 --- a/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legonavcontroller.cpp @@ -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': diff --git a/LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp b/LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp index 0cff228f..7541e98b 100644 --- a/LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp +++ b/LEGO1/lego/legoomni/src/entity/legopovcontroller.cpp @@ -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); diff --git a/LEGO1/lego/legoomni/src/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index 7ced4e38..cc82fe92 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -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); diff --git a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp index 3a8842a5..6bd3ca51 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworldpresenter.cpp @@ -35,7 +35,7 @@ DECOMP_SIZE_ASSERT(LegoWorldPresenter, 0x54) MxS32 g_legoWorldPresenterQuality = 1; // GLOBAL: LEGO1 0x100f75d8 -MxLong g_wdbOffset = 0; +MxLong g_wdbSkipGlobalPartsOffset = 0; // FUNCTION: LEGO1 0x100665b0 void LegoWorldPresenter::configureLegoWorldPresenter(MxS32 p_legoWorldPresenterQuality) @@ -46,7 +46,7 @@ void LegoWorldPresenter::configureLegoWorldPresenter(MxS32 p_legoWorldPresenterQ // FUNCTION: LEGO1 0x100665c0 LegoWorldPresenter::LegoWorldPresenter() { - m_unk0x50 = 50000; + m_nextObjectId = 50000; } // FUNCTION: LEGO1 0x10066770 @@ -208,8 +208,8 @@ MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world) return FAILURE; } - if (g_wdbOffset == 0) { - if (fread(&size, sizeof(size), 1, wdbFile) != 1) { + if (g_wdbSkipGlobalPartsOffset == 0) { + if (fread(&size, sizeof(MxU32), 1, wdbFile) != 1) { return FAILURE; } @@ -229,7 +229,7 @@ MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world) delete[] buff; - if (fread(&size, sizeof(size), 1, wdbFile) != 1) { + if (fread(&size, sizeof(MxU32), 1, wdbFile) != 1) { return FAILURE; } @@ -248,10 +248,10 @@ MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world) delete[] buff; - g_wdbOffset = ftell(wdbFile); + g_wdbSkipGlobalPartsOffset = ftell(wdbFile); } else { - if (fseek(wdbFile, g_wdbOffset, SEEK_SET) != 0) { + if (fseek(wdbFile, g_wdbSkipGlobalPartsOffset, SEEK_SET) != 0) { return FAILURE; } } @@ -261,7 +261,7 @@ MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world) while (cursor.Next(part)) { if (GetViewLODListManager()->Lookup(part->m_roiName.GetData()) == NULL && - FUN_10067360(*part, wdbFile) != SUCCESS) { + LoadWorldPart(*part, wdbFile) != SUCCESS) { return FAILURE; } } @@ -287,15 +287,15 @@ MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world) } else if (g_legoWorldPresenterQuality <= 1 && !strnicmp(worlds[i].m_models[j].m_modelName, "haus", 4)) { if (worlds[i].m_models[j].m_modelName[4] == '3') { - if (FUN_100674b0(worlds[i].m_models[j], wdbFile, p_world) != SUCCESS) { + if (LoadWorldModel(worlds[i].m_models[j], wdbFile, p_world) != SUCCESS) { return FAILURE; } - if (FUN_100674b0(worlds[i].m_models[j - 2], wdbFile, p_world) != SUCCESS) { + if (LoadWorldModel(worlds[i].m_models[j - 2], wdbFile, p_world) != SUCCESS) { return FAILURE; } - if (FUN_100674b0(worlds[i].m_models[j - 1], wdbFile, p_world) != SUCCESS) { + if (LoadWorldModel(worlds[i].m_models[j - 1], wdbFile, p_world) != SUCCESS) { return FAILURE; } } @@ -303,7 +303,7 @@ MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world) continue; } - if (FUN_100674b0(worlds[i].m_models[j], wdbFile, p_world) != SUCCESS) { + if (LoadWorldModel(worlds[i].m_models[j], wdbFile, p_world) != SUCCESS) { return FAILURE; } } @@ -314,7 +314,7 @@ MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world) } // FUNCTION: LEGO1 0x10067360 -MxResult LegoWorldPresenter::FUN_10067360(ModelDbPart& p_part, FILE* p_wdbFile) +MxResult LegoWorldPresenter::LoadWorldPart(ModelDbPart& p_part, FILE* p_wdbFile) { MxResult result; MxU8* buff = new MxU8[p_part.m_partDataLength]; @@ -340,17 +340,17 @@ MxResult LegoWorldPresenter::FUN_10067360(ModelDbPart& p_part, FILE* p_wdbFile) } // FUNCTION: LEGO1 0x100674b0 -MxResult LegoWorldPresenter::FUN_100674b0(ModelDbModel& p_model, FILE* p_wdbFile, LegoWorld* p_world) +MxResult LegoWorldPresenter::LoadWorldModel(ModelDbModel& p_model, FILE* p_wdbFile, LegoWorld* p_world) { - MxU8* buff = new MxU8[p_model.m_unk0x04]; + MxU8* buff = new MxU8[p_model.m_modelDataLength]; - fseek(p_wdbFile, p_model.m_unk0x08, SEEK_SET); - if (fread(buff, p_model.m_unk0x04, 1, p_wdbFile) != 1) { + fseek(p_wdbFile, p_model.m_modelDataOffset, SEEK_SET); + if (fread(buff, p_model.m_modelDataLength, 1, p_wdbFile) != 1) { return FAILURE; } MxDSChunk chunk; - chunk.SetLength(p_model.m_unk0x04); + chunk.SetLength(p_model.m_modelDataLength); chunk.SetData(buff); MxDSAction action; @@ -359,8 +359,8 @@ MxResult LegoWorldPresenter::FUN_100674b0(ModelDbModel& p_model, FILE* p_wdbFile action.SetDirection(p_model.m_direction); action.SetUp(p_model.m_up); - MxU32 objectId = m_unk0x50; - m_unk0x50++; + MxU32 objectId = m_nextObjectId; + m_nextObjectId++; action.SetObjectId(objectId); action.SetAtomId(atom); @@ -393,7 +393,7 @@ MxResult LegoWorldPresenter::FUN_100674b0(ModelDbModel& p_model, FILE* p_wdbFile } modelPresenter.SetAction(&action); - modelPresenter.FUN_1007ff70(chunk, createdEntity, p_model.m_unk0x34, p_world); + modelPresenter.CreateROI(chunk, createdEntity, p_model.m_visible, p_world); delete[] buff; return SUCCESS; diff --git a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp index e3523ca9..756d51aa 100644 --- a/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp +++ b/LEGO1/lego/legoomni/src/input/legoinputmanager.cpp @@ -17,10 +17,10 @@ DECOMP_SIZE_ASSERT(LegoNotifyListCursor, 0x10) DECOMP_SIZE_ASSERT(LegoEventQueue, 0x18) // GLOBAL: LEGO1 0x100f31b0 -MxS32 g_unk0x100f31b0 = -1; +MxS32 g_clickedObjectId = -1; // GLOBAL: LEGO1 0x100f31b4 -const char* g_unk0x100f31b4 = NULL; +const char* g_clickedAtom = NULL; // GLOBAL: LEGO1 0x100f67b8 MxBool g_unk0x100f67b8 = TRUE; @@ -195,7 +195,7 @@ MxResult LegoInputManager::GetNavigationKeyStates(MxU32& p_keyFlags) } if ((m_keyboardState[DIK_LCONTROL] | m_keyboardState[DIK_RCONTROL]) & 0x80) { - keyFlags |= c_bit5; + keyFlags |= c_ctrl; } p_keyFlags = keyFlags; @@ -429,23 +429,23 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param) if (presenter->GetDisplayZ() < 0) { processRoi = FALSE; - if (m_controlManager->FUN_10029210(p_param, presenter)) { + if (m_controlManager->HandleButtonDown(p_param, presenter)) { return TRUE; } } else { LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY()); - if (roi == NULL && m_controlManager->FUN_10029210(p_param, presenter)) { + if (roi == NULL && m_controlManager->HandleButtonDown(p_param, presenter)) { return TRUE; } } } } else if (p_param.GetNotification() == c_notificationButtonUp) { - if (g_unk0x100f31b0 != -1 || m_controlManager->GetUnknown0x10() || - m_controlManager->GetUnknown0x0c() == 1) { - MxBool result = m_controlManager->FUN_10029210(p_param, NULL); + if (g_clickedObjectId != -1 || m_controlManager->IsSecondButtonDown() || + m_controlManager->HandleUpNextTickle() == 1) { + MxBool result = m_controlManager->HandleButtonDown(p_param, NULL); StopAutoDragTimer(); m_unk0x80 = FALSE; @@ -585,6 +585,6 @@ void LegoInputManager::StopAutoDragTimer() void LegoInputManager::EnableInputProcessing() { m_unk0x88 = FALSE; - g_unk0x100f31b0 = -1; - g_unk0x100f31b4 = NULL; + g_clickedObjectId = -1; + g_clickedAtom = NULL; } diff --git a/LEGO1/lego/legoomni/src/main/legomain.cpp b/LEGO1/lego/legoomni/src/main/legomain.cpp index fe37070c..632b2943 100644 --- a/LEGO1/lego/legoomni/src/main/legomain.cpp +++ b/LEGO1/lego/legoomni/src/main/legomain.cpp @@ -502,11 +502,15 @@ MxAtomId* LegoOmni::GetWorldAtom(LegoOmni::World p_worldId) } // FUNCTION: LEGO1 0x1005b490 +// FUNCTION: BETA10 0x1008ee69 LegoOmni::World LegoOmni::GetWorldId(const char* p_key) { for (MxS32 i = 0; i < e_numWorlds; i++) { - if ((MxS32) &m_worlds[i] != -4 && !strcmpi(m_worlds[i].GetKey(), p_key)) { - return m_worlds[i].GetId(); + // Note: m_key is never NULL + if (m_worlds[i].m_key != NULL) { + if (!strcmpi(m_worlds[i].m_key, p_key)) { + return m_worlds[i].m_id; + } } } diff --git a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp index 3cbbf032..45633818 100644 --- a/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legoextraactor.cpp @@ -98,7 +98,7 @@ MxU32 LegoExtraActor::VTable0x90(float p_time, Matrix4& p_transform) m_actorState = c_initial; m_scheduledTime = 0.0f; positionRef -= g_unk0x10104c18; - m_roi->FUN_100a58f0(p_transform); + m_roi->SetLocal2World(p_transform); return TRUE; } } @@ -229,8 +229,8 @@ MxResult LegoExtraActor::HitActor(LegoPathActor* p_actor, MxBool p_bool) } if (!b) { - m_roi->FUN_100a58f0(matrix2); - m_roi->VTable0x14(); + m_roi->SetLocal2World(matrix2); + m_roi->WrappedUpdateWorldData(); FUN_1002ad8a(); assert(m_roi); assert(SoundManager()->GetCacheSoundManager()); @@ -254,7 +254,7 @@ MxResult LegoExtraActor::HitActor(LegoPathActor* p_actor, MxBool p_bool) MxMatrix matrix3 = MxMatrix(roi->GetLocal2World()); Vector3 positionRef(matrix3[3]); positionRef += g_unk0x10104c18; - roi->FUN_100a58f0(matrix3); + roi->SetLocal2World(matrix3); float dotX = dir.Dot(dir, Mx3DPointFloat(1.0f, 0, 0)); float dotZ = dir.Dot(dir, Mx3DPointFloat(0, 0, 1.0f)); @@ -346,7 +346,7 @@ void LegoExtraActor::Animate(float p_time) m_whichAnim = 0; m_actorState = c_initial; SetWorldSpeed(m_prevWorldSpeed); - m_roi->FUN_100a58f0(m_unk0x18); + m_roi->SetLocal2World(m_unk0x18); m_lastTime = p_time; break; } diff --git a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp index 5daf64c2..0a8f6878 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathactor.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathactor.cpp @@ -1,7 +1,7 @@ #include "legopathactor.h" #include "define.h" -#include "geom/legounkown100db7f4.h" +#include "geom/legoorientededge.h" #include "legocachesoundmanager.h" #include "legocameracontroller.h" #include "legonamedplane.h" @@ -36,7 +36,7 @@ const char* g_strHIT_WALL_SOUND = "HIT_WALL_SOUND"; // GLOBAL: LEGO1 0x100f3308 // GLOBAL: BETA10 0x101f1e1c -MxLong g_unk0x100f3308 = 0; +MxLong g_timeLastHitSoundPlayed = 0; // FUNCTION: LEGO1 0x1002d700 // FUNCTION: BETA10 0x100ae6e0 @@ -68,6 +68,7 @@ LegoPathActor::~LegoPathActor() } // FUNCTION: LEGO1 0x1002d8d0 +// FUNCTION: BETA10 0x100ae8cd MxResult LegoPathActor::VTable0x80(const Vector3& p_point1, Vector3& p_point2, Vector3& p_point3, Vector3& p_point4) { Mx3DPointFloat p1, p2, p3; @@ -84,8 +85,10 @@ MxResult LegoPathActor::VTable0x80(const Vector3& p_point1, Vector3& p_point2, V m_BADuration /= 0.001; return SUCCESS; } - - return FAILURE; + else { + MxTrace("Warning: m_BADuration = %g, roi = %s\n", m_BADuration, m_roi->GetName()); + return FAILURE; + } } // FUNCTION: LEGO1 0x1002d9c0 @@ -95,7 +98,7 @@ MxResult LegoPathActor::VTable0x88( float p_time, LegoEdge& p_srcEdge, float p_srcScale, - LegoUnknown100db7f4& p_destEdge, + LegoOrientedEdge& p_destEdge, float p_destScale ) { @@ -122,7 +125,7 @@ MxResult LegoPathActor::VTable0x88( m_unk0x7c = 0; m_lastTime = p_time; m_actorTime = p_time; - p_destEdge.FUN_1002ddc0(*p_boundary, p3); + p_destEdge.GetFaceNormal(*p_boundary, p3); p4 = p2; p4 -= p1; @@ -137,7 +140,7 @@ MxResult LegoPathActor::VTable0x88( matrix.SetIdentity(); pos = p1; dir = p4; - up = *m_boundary->GetUnknown0x14(); + up = *m_boundary->GetUp(); if (!m_cameraFlag || !m_userNavFlag) { dir *= -1.0f; @@ -147,7 +150,7 @@ MxResult LegoPathActor::VTable0x88( m_roi->UpdateTransformationRelativeToParent(matrix); if (!m_cameraFlag || !m_userNavFlag) { - p5.EqualsCross(*p_boundary->GetUnknown0x14(), p3); + p5.EqualsCross(*p_boundary->GetUp(), p3); p5.Unitize(); if (VTable0x80(p1, p4, p2, p5) == SUCCESS) { @@ -167,17 +170,22 @@ MxResult LegoPathActor::VTable0x88( } // FUNCTION: LEGO1 0x1002de10 +// FUNCTION: BETA10 0x100aee61 MxResult LegoPathActor::VTable0x84( LegoPathBoundary* p_boundary, float p_time, Vector3& p_p1, Vector3& p_p4, - LegoUnknown100db7f4& p_destEdge, + LegoOrientedEdge* p_destEdge, float p_destScale ) { - Vector3* v3 = p_destEdge.CWVertex(*p_boundary); - Vector3* v4 = p_destEdge.CCWVertex(*p_boundary); + assert(p_destEdge); + + Vector3* v3 = p_destEdge->CWVertex(*p_boundary); + Vector3* v4 = p_destEdge->CCWVertex(*p_boundary); + + assert(v3 && v4); Mx3DPointFloat p2, p3, p5; @@ -187,12 +195,12 @@ MxResult LegoPathActor::VTable0x84( p2 += *v3; m_boundary = p_boundary; - m_destEdge = &p_destEdge; + m_destEdge = p_destEdge; m_unk0xe4 = p_destScale; m_unk0x7c = 0; m_lastTime = p_time; m_actorTime = p_time; - p_destEdge.FUN_1002ddc0(*p_boundary, p3); + p_destEdge->GetFaceNormal(*p_boundary, p3); MxMatrix matrix; Vector3 pos(matrix[3]); @@ -203,7 +211,7 @@ MxResult LegoPathActor::VTable0x84( matrix.SetIdentity(); pos = p_p1; dir = p_p4; - up = *m_boundary->GetUnknown0x14(); + up = *m_boundary->GetUp(); if (!m_cameraFlag || !m_userNavFlag) { dir *= -1.0f; @@ -212,21 +220,21 @@ MxResult LegoPathActor::VTable0x84( right.EqualsCross(up, dir); m_roi->UpdateTransformationRelativeToParent(matrix); - if (!m_cameraFlag || !m_userNavFlag) { - p5.EqualsCross(*p_boundary->GetUnknown0x14(), p3); - p5.Unitize(); - - if (VTable0x80(p_p1, p_p4, p2, p5) == SUCCESS) { - m_boundary->AddActor(this); - } - else { - return FAILURE; - } - } - else { + if (m_cameraFlag && m_userNavFlag) { m_boundary->AddActor(this); FUN_10010c30(); } + else { + p5.EqualsCross(*p_boundary->GetUp(), p3); + p5.Unitize(); + + if (VTable0x80(p_p1, p_p4, p2, p5) != SUCCESS) { + MxTrace("Warning: m_BADuration = %g, roi = %s\n", m_BADuration, m_roi->GetName()); + return FAILURE; + } + + m_boundary->AddActor(this); + } m_unk0xec = m_roi->GetLocal2World(); return SUCCESS; @@ -248,7 +256,7 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform) m_worldSpeed = nav->GetLinearVel(); - if (nav->CalculateNewPosDir(p4, p5, p2, p1, m_boundary->GetUnknown0x14())) { + if (nav->CalculateNewPosDir(p4, p5, p2, p1, m_boundary->GetUp())) { Mx3DPointFloat p6; p6 = p2; MxS32 result = 0; @@ -272,7 +280,7 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform) result = 0; } else { - m_boundary->FUN_100575b0(p4, p2, this); + m_boundary->CheckAndCallPathTriggers(p4, p2, this); } LegoPathBoundary* oldBoundary = m_boundary; @@ -283,8 +291,8 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform) if (m_boundary == oldBoundary) { MxLong time = Timer()->GetTime(); - if (time - g_unk0x100f3308 > 1000) { - g_unk0x100f3308 = time; + if (time - g_timeLastHitSoundPlayed > 1000) { + g_timeLastHitSoundPlayed = time; const char* var = VariableTable()->GetVariable(g_strHIT_WALL_SOUND); if (var && var[0] != 0) { @@ -313,7 +321,7 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform) Vector3 pos(p_transform[3]); dir = p1; - up = *m_boundary->GetUnknown0x14(); + up = *m_boundary->GetUp(); right.EqualsCross(up, dir); MxS32 res = right.Unitize(); @@ -346,10 +354,10 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform) LegoResult r; if (m_userNavFlag) { - r = m_unk0x8c.FUN_1009a1e0(m_unk0x7c / m_BADuration, p_transform, *m_boundary->GetUnknown0x14(), 0); + r = m_unk0x8c.FUN_1009a1e0(m_unk0x7c / m_BADuration, p_transform, *m_boundary->GetUp(), 0); } else { - r = m_unk0x8c.FUN_1009a1e0(m_unk0x7c / m_BADuration, p_transform, *m_boundary->GetUnknown0x14(), 1); + r = m_unk0x8c.FUN_1009a1e0(m_unk0x7c / m_BADuration, p_transform, *m_boundary->GetUp(), 1); } assert(r == 0); // SUCCESS @@ -363,7 +371,7 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform) return 1; } else { - m_boundary->FUN_100575b0(pos2, pos1, this); + m_boundary->CheckAndCallPathTriggers(pos2, pos1, this); pos2 = pos1; } @@ -379,15 +387,16 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform) } // FUNCTION: LEGO1 0x1002e740 +// FUNCTION: BETA10 0x100b0f70 void LegoPathActor::VTable0x74(Matrix4& p_transform) { if (m_userNavFlag) { - m_roi->WrappedSetLocalTransform(p_transform); + m_roi->WrappedSetLocal2WorldWithWorldDataUpdate(p_transform); FUN_10010c30(); } else { - m_roi->WrappedSetLocalTransform(p_transform); - m_roi->VTable0x14(); + m_roi->WrappedSetLocal2WorldWithWorldDataUpdate(p_transform); + m_roi->WrappedUpdateWorldData(); if (m_cameraFlag) { FUN_10010c30(); @@ -442,7 +451,7 @@ void LegoPathActor::Animate(float p_time) // FUNCTION: LEGO1 0x1002e8b0 // FUNCTION: BETA10 0x100af2f7 -void LegoPathActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) +void LegoPathActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoOrientedEdge*& p_edge, float& p_unk0xe4) { assert(m_boundary); m_boundary->SwitchBoundary(this, p_boundary, p_edge, p_unk0xe4); @@ -516,7 +525,7 @@ inline MxU32 LegoPathActor::FUN_1002edd0( LegoS32 numEdges = p_boundary->GetNumEdges(); for (MxS32 i = 0; i < numEdges; i++) { - LegoUnknown100db7f4* edge = p_boundary->GetEdges()[i]; + LegoOrientedEdge* edge = p_boundary->GetEdges()[i]; LegoPathBoundary* boundary = (LegoPathBoundary*) edge->OtherFace(p_boundary); if (boundary != NULL) { @@ -652,8 +661,8 @@ MxResult LegoPathActor::VTable0x9c() LERP3(local34, v1, v2, m_unk0xe4); - m_destEdge->FUN_1002ddc0(*m_boundary, local78); - local48.EqualsCross(*m_boundary->GetUnknown0x14(), local78); + m_destEdge->GetFaceNormal(*m_boundary, local78); + local48.EqualsCross(*m_boundary->GetUp(), local78); local48.Unitize(); } @@ -661,7 +670,7 @@ MxResult LegoPathActor::VTable0x9c() Vector3 upRef(m_unk0xec[1]); Vector3 dirRef(m_unk0xec[2]); - upRef = *m_boundary->GetUnknown0x14(); + upRef = *m_boundary->GetUp(); rightRef.EqualsCross(upRef, dirRef); rightRef.Unitize(); @@ -731,11 +740,11 @@ void LegoPathActor::VTable0xa4(MxBool& p_und1, MxS32& p_und2) void LegoPathActor::VTable0xa8() { m_lastTime = Timer()->GetTime(); - m_roi->FUN_100a58f0(m_unk0xec); - m_roi->VTable0x14(); + m_roi->SetLocal2World(m_unk0xec); + m_roi->WrappedUpdateWorldData(); if (m_userNavFlag) { - m_roi->WrappedSetLocalTransform(m_unk0xec); + m_roi->WrappedSetLocal2WorldWithWorldDataUpdate(m_unk0xec); FUN_10010c30(); } } diff --git a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp index 8f832630..458a79b9 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathboundary.cpp @@ -1,7 +1,7 @@ #include "legopathboundary.h" #include "decomp.h" -#include "geom/legounkown100db7f4.h" +#include "geom/legoorientededge.h" #include "legolocomotionanimpresenter.h" #include "legopathactor.h" #include "legopathstruct.h" @@ -44,27 +44,27 @@ MxResult LegoPathBoundary::RemoveActor(LegoPathActor* p_actor) // FUNCTION: LEGO1 0x100575b0 // FUNCTION: BETA10 0x100b1598 -void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPathActor* p_actor) +void LegoPathBoundary::CheckAndCallPathTriggers(Vector3& p_from, Vector3& p_to, LegoPathActor* p_actor) { Vector3* ccwV = NULL; - if (m_numTriggers > 0 && m_unk0x50 != NULL) { + if (m_numTriggers > 0 && m_direction != NULL) { ccwV = m_edges[0]->CCWVertex(*this); Mx3DPointFloat v; - v = p_point1; + v = p_from; v -= *ccwV; - float dot1 = v.Dot(v, *m_unk0x50); + float dot1 = v.Dot(v, *m_direction); - v = p_point2; + v = p_to; v -= *ccwV; - float dot2 = v.Dot(v, *m_unk0x50); + float dot2 = v.Dot(v, *m_direction); if (dot2 > dot1) { for (MxS32 i = 0; i < m_numTriggers; i++) { LegoPathStruct* s = m_pathTrigger[i].m_pathStruct; - if (m_pathTrigger[i].m_unk0x08 >= dot1 && m_pathTrigger[i].m_unk0x08 < dot2) { + if (m_pathTrigger[i].m_triggerLength >= dot1 && m_pathTrigger[i].m_triggerLength < dot2) { s->HandleTrigger(p_actor, TRUE, m_pathTrigger[i].m_data); } } @@ -73,7 +73,7 @@ void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPa for (MxS32 i = 0; i < m_numTriggers; i++) { LegoPathStruct* s = m_pathTrigger[i].m_pathStruct; - if (m_pathTrigger[i].m_unk0x08 >= dot2 && m_pathTrigger[i].m_unk0x08 < dot1) { + if (m_pathTrigger[i].m_triggerLength >= dot2 && m_pathTrigger[i].m_triggerLength < dot1) { s->HandleTrigger(p_actor, FALSE, m_pathTrigger[i].m_data); } } @@ -86,11 +86,11 @@ void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPa void LegoPathBoundary::SwitchBoundary( LegoPathActor* p_actor, LegoPathBoundary*& p_boundary, - LegoUnknown100db7f4*& p_edge, + LegoOrientedEdge*& p_edge, float& p_unk0xe4 ) { - LegoUnknown100db7f4* e = p_edge; + LegoOrientedEdge* e = p_edge; if (p_edge->BETA_100b53b0(*p_boundary)) { LegoPathBoundary* newBoundary = (LegoPathBoundary*) p_edge->OtherFace(p_boundary); @@ -110,7 +110,7 @@ void LegoPathBoundary::SwitchBoundary( } do { - p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*newBoundary); + p_edge = (LegoOrientedEdge*) p_edge->GetCounterclockwiseEdge(*newBoundary); LegoPathBoundary* local20 = (LegoPathBoundary*) p_edge->OtherFace(newBoundary); if (p_edge->GetMask0x03() && (userNavFlag || p_edge->BETA_1004a830(*local20, 1))) { @@ -133,10 +133,10 @@ void LegoPathBoundary::SwitchBoundary( while (local8 > 0) { if (localc) { - p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*newBoundary); + p_edge = (LegoOrientedEdge*) p_edge->GetCounterclockwiseEdge(*newBoundary); } else { - p_edge = (LegoUnknown100db7f4*) p_edge->GetClockwiseEdge(*newBoundary); + p_edge = (LegoOrientedEdge*) p_edge->GetClockwiseEdge(*newBoundary); } LegoPathBoundary* local20 = (LegoPathBoundary*) p_edge->OtherFace(newBoundary); @@ -147,8 +147,8 @@ void LegoPathBoundary::SwitchBoundary( } if (p_edge == e) { - p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*newBoundary); - p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*newBoundary); + p_edge = (LegoOrientedEdge*) p_edge->GetCounterclockwiseEdge(*newBoundary); + p_edge = (LegoOrientedEdge*) p_edge->GetCounterclockwiseEdge(*newBoundary); } if (p_boundary != newBoundary) { @@ -162,7 +162,7 @@ void LegoPathBoundary::SwitchBoundary( } else { do { - p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*p_boundary); + p_edge = (LegoOrientedEdge*) p_edge->GetCounterclockwiseEdge(*p_boundary); if (p_edge->GetMask0x03()) { break; @@ -170,8 +170,8 @@ void LegoPathBoundary::SwitchBoundary( } while (p_edge != e); if (p_edge == e) { - p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*p_boundary); - p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*p_boundary); + p_edge = (LegoOrientedEdge*) p_edge->GetCounterclockwiseEdge(*p_boundary); + p_edge = (LegoOrientedEdge*) p_edge->GetCounterclockwiseEdge(*p_boundary); } p_unk0xe4 = 1.0 - p_unk0xe4; @@ -185,17 +185,17 @@ MxU32 LegoPathBoundary::Intersect( Vector3& p_point1, Vector3& p_point2, Vector3& p_point3, - LegoUnknown100db7f4*& p_edge + LegoOrientedEdge*& p_edge ) { - LegoUnknown100db7f4* e = NULL; + LegoOrientedEdge* e = NULL; float localc; MxU32 local10 = 0; float len = 0.0f; Mx3DPointFloat vec; for (MxS32 i = 0; i < m_numEdges; i++) { - LegoUnknown100db7f4* edge = (LegoUnknown100db7f4*) m_edges[i]; + LegoOrientedEdge* edge = (LegoOrientedEdge*) m_edges[i]; if (p_point2.Dot(m_edgeNormals[i], p_point2) + m_edgeNormals[i][3] <= -1e-07) { if (local10 == 0) { @@ -240,17 +240,17 @@ MxU32 LegoPathBoundary::Intersect( local50 = p_point2; local50 -= *local5c; - e->FUN_1002ddc0(*this, local70); + e->GetFaceNormal(*this, local70); float local58 = local50.Dot(local50, local70); - LegoUnknown100db7f4* local54 = NULL; + LegoOrientedEdge* local54 = NULL; if (local58 < 0.0f) { Mx3DPointFloat local84; - for (LegoUnknown100db7f4* local88 = (LegoUnknown100db7f4*) e->GetClockwiseEdge(*this); e != local88; - local88 = (LegoUnknown100db7f4*) local88->GetClockwiseEdge(*this)) { - local88->FUN_1002ddc0(*this, local84); + for (LegoOrientedEdge* local88 = (LegoOrientedEdge*) e->GetClockwiseEdge(*this); e != local88; + local88 = (LegoOrientedEdge*) local88->GetClockwiseEdge(*this)) { + local88->GetFaceNormal(*this, local84); if (local84.Dot(local84, local70) <= 0.9) { break; @@ -262,7 +262,7 @@ MxU32 LegoPathBoundary::Intersect( float local8c = locala4.Dot(locala4, local84); - if (local8c > local58 && local8c < local88->m_unk0x3c) { + if (local8c > local58 && local8c < local88->m_length) { local54 = local88; local58 = local8c; local70 = local84; @@ -271,13 +271,12 @@ MxU32 LegoPathBoundary::Intersect( } } else { - if (e->m_unk0x3c < local58) { + if (e->m_length < local58) { Mx3DPointFloat localbc; - for (LegoUnknown100db7f4* locala8 = (LegoUnknown100db7f4*) e->GetCounterclockwiseEdge(*this); - e != locala8; - locala8 = (LegoUnknown100db7f4*) locala8->GetCounterclockwiseEdge(*this)) { - locala8->FUN_1002ddc0(*this, localbc); + for (LegoOrientedEdge* locala8 = (LegoOrientedEdge*) e->GetCounterclockwiseEdge(*this); e != locala8; + locala8 = (LegoOrientedEdge*) locala8->GetCounterclockwiseEdge(*this)) { + locala8->GetFaceNormal(*this, localbc); if (localbc.Dot(localbc, local70) <= 0.9) { break; @@ -305,7 +304,7 @@ MxU32 LegoPathBoundary::Intersect( if (local58 <= 0.0f) { if (!e->GetMask0x03()) { - p_edge = (LegoUnknown100db7f4*) e->GetClockwiseEdge(*this); + p_edge = (LegoOrientedEdge*) e->GetClockwiseEdge(*this); } else { p_edge = e; @@ -314,7 +313,7 @@ MxU32 LegoPathBoundary::Intersect( p_point3 = *local5c; return 2; } - else if (local58 > 0.0f && e->m_unk0x3c > local58) { + else if (local58 > 0.0f && e->m_length > local58) { p_point3 = local70; p_point3 *= local58; p_point3 += *local5c; @@ -325,7 +324,7 @@ MxU32 LegoPathBoundary::Intersect( p_point3 = *e->CCWVertex(*this); if (!e->GetMask0x03()) { - p_edge = (LegoUnknown100db7f4*) e->GetCounterclockwiseEdge(*this); + p_edge = (LegoOrientedEdge*) e->GetCounterclockwiseEdge(*this); } else { p_edge = e; @@ -340,15 +339,15 @@ MxU32 LegoPathBoundary::Intersect( // FUNCTION: LEGO1 0x10057fe0 // FUNCTION: BETA10 0x100b2220 -MxU32 LegoPathBoundary::FUN_10057fe0(LegoAnimPresenter* p_presenter) +MxU32 LegoPathBoundary::AddPresenterIfInRange(LegoAnimPresenter* p_presenter) { Mx3DPointFloat unk0x30; - unk0x30 = m_unk0x30; + unk0x30 = m_centerPoint; unk0x30 -= p_presenter->m_unk0xa8; float len = unk0x30.LenSquared(); - float local20 = p_presenter->m_unk0xa4 + m_unk0x44; + float local20 = p_presenter->m_unk0xa4 + m_boundingRadius; if (len > 0.001 && len > local20 * local20) { return 0; @@ -363,7 +362,7 @@ MxU32 LegoPathBoundary::FUN_10057fe0(LegoAnimPresenter* p_presenter) // FUNCTION: LEGO1 0x100586e0 // FUNCTION: BETA10 0x100b22d1 -MxU32 LegoPathBoundary::FUN_100586e0(LegoAnimPresenter* p_presenter) +MxU32 LegoPathBoundary::RemovePresenter(LegoAnimPresenter* p_presenter) { if (p_presenter != NULL) { // TODO: This only seems to match if the type is not the same as the type of the diff --git a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp index d9027245..abf16351 100644 --- a/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp +++ b/LEGO1/lego/legoomni/src/paths/legopathcontroller.cpp @@ -71,7 +71,7 @@ LegoPathController::LegoPathController() { m_boundaries = NULL; m_edges = NULL; - m_unk0x10 = NULL; + m_nodes = NULL; m_structs = NULL; m_numL = 0; m_numE = 0; @@ -94,7 +94,7 @@ MxResult LegoPathController::Create(MxU8* p_data, const Vector3& p_location, con } for (i = 0; i < m_numN; i++) { - m_unk0x10[i] += p_location; + m_nodes[i] += p_location; } for (i = 0; i < m_numL; i++) { @@ -144,10 +144,10 @@ void LegoPathController::Destroy() m_boundaries = NULL; m_numL = 0; - if (m_unk0x10 != NULL) { - delete[] m_unk0x10; + if (m_nodes != NULL) { + delete[] m_nodes; } - m_unk0x10 = NULL; + m_nodes = NULL; m_numN = 0; if (m_structs != NULL) { @@ -224,7 +224,7 @@ MxResult LegoPathController::PlaceActor( float time = Timer()->GetTime(); MxResult result = - p_actor->VTable0x88(pBoundary, time, *pSrcE, p_srcScale, (LegoUnknown100db7f4&) *pDestE, p_destScale); + p_actor->VTable0x88(pBoundary, time, *pSrcE, p_srcScale, (LegoOrientedEdge&) *pDestE, p_destScale); if (result != SUCCESS) { assert(0); @@ -284,22 +284,21 @@ MxResult LegoPathController::PlaceActor( } for (MxS32 j = 0; j < boundary->GetNumEdges(); j++) { - LegoUnknown100db7f4* edge = (LegoUnknown100db7f4*) boundary->GetEdges()[j]; + LegoOrientedEdge* edge = (LegoOrientedEdge*) boundary->GetEdges()[j]; if (edge->GetMask0x03()) { Mx3DPointFloat vec; - if (((LegoUnknown100db7f4*) edge->GetClockwiseEdge(*boundary))->FUN_1002ddc0(*boundary, vec) == SUCCESS && + if (((LegoOrientedEdge*) edge->GetClockwiseEdge(*boundary))->GetFaceNormal(*boundary, vec) == SUCCESS && vec.Dot(vec, p_direction) < 0.0f) { - edge = - (LegoUnknown100db7f4*) edge->GetCounterclockwiseEdge(*boundary)->GetCounterclockwiseEdge(*boundary); + edge = (LegoOrientedEdge*) edge->GetCounterclockwiseEdge(*boundary)->GetCounterclockwiseEdge(*boundary); } if (!edge->GetMask0x03()) { return FAILURE; } - if (p_actor->VTable0x84(boundary, time, p_position, p_direction, *edge, 0.5f) == SUCCESS) { + if (p_actor->VTable0x84(boundary, time, p_position, p_direction, edge, 0.5f) == SUCCESS) { p_actor->SetController(this); m_actors.insert(p_actor); return SUCCESS; @@ -348,17 +347,17 @@ void LegoPathController::FUN_100468f0(LegoAnimPresenter* p_presenter) { for (MxS32 i = 0; i < m_numL; i++) { if (!(m_boundaries[i].m_flags & LegoWEGEdge::c_bit3)) { - m_boundaries[i].FUN_10057fe0(p_presenter); + m_boundaries[i].AddPresenterIfInRange(p_presenter); } } } // FUNCTION: LEGO1 0x10046930 // FUNCTION: BETA10 0x100b737b -void LegoPathController::FUN_10046930(LegoAnimPresenter* p_presenter) +void LegoPathController::RemovePresenterFromBoundaries(LegoAnimPresenter* p_presenter) { for (MxS32 i = 0; i < m_numL; i++) { - m_boundaries[i].FUN_100586e0(p_presenter); + m_boundaries[i].RemovePresenter(p_presenter); } } @@ -461,28 +460,28 @@ MxResult LegoPathController::Reset() // FUNCTION: BETA10 0x100b781f MxResult LegoPathController::Read(LegoStorage* p_storage) { - if (p_storage->Read(&m_numT, sizeof(m_numT)) != SUCCESS) { + if (p_storage->Read(&m_numT, sizeof(MxU16)) != SUCCESS) { return FAILURE; } if (m_numT > 0) { m_structs = new LegoPathStruct[m_numT]; } - if (p_storage->Read(&m_numN, sizeof(m_numN)) != SUCCESS) { + if (p_storage->Read(&m_numN, sizeof(MxU16)) != SUCCESS) { return FAILURE; } if (m_numN > 0) { - m_unk0x10 = new Mx3DPointFloat[m_numN]; + m_nodes = new Mx3DPointFloat[m_numN]; } - if (p_storage->Read(&m_numE, sizeof(m_numE)) != SUCCESS) { + if (p_storage->Read(&m_numE, sizeof(MxU16)) != SUCCESS) { return FAILURE; } if (m_numE > 0) { m_edges = new LegoPathCtrlEdge[m_numE]; } - if (p_storage->Read(&m_numL, sizeof(m_numL)) != SUCCESS) { + if (p_storage->Read(&m_numL, sizeof(MxU16)) != SUCCESS) { return FAILURE; } if (m_numL > 0) { @@ -495,7 +494,7 @@ MxResult LegoPathController::Read(LegoStorage* p_storage) if (m_numN > 0) { for (MxS32 i = 0; i < m_numN; i++) { - if (ReadVector(p_storage, m_unk0x10[i]) != SUCCESS) { + if (ReadVector(p_storage, m_nodes[i]) != SUCCESS) { return FAILURE; } } @@ -523,7 +522,7 @@ MxResult LegoPathController::ReadStructs(LegoStorage* p_storage) for (MxS32 i = 0; i < m_numT; i++) { MxU8 length = 0; - if (p_storage->Read(&length, sizeof(length)) != SUCCESS) { + if (p_storage->Read(&length, sizeof(MxU8)) != SUCCESS) { return FAILURE; } @@ -537,7 +536,7 @@ MxResult LegoPathController::ReadStructs(LegoStorage* p_storage) m_structs[i].m_name[length] = '\0'; } - if (p_storage->Read(&m_structs[i].m_flags, sizeof(m_structs[i].m_flags)) != SUCCESS) { + if (p_storage->Read(&m_structs[i].m_flags, sizeof(MxU32)) != SUCCESS) { return FAILURE; } } @@ -553,59 +552,67 @@ MxResult LegoPathController::ReadEdges(LegoStorage* p_storage) LegoPathCtrlEdge& edge = m_edges[i]; MxU16 s; - if (p_storage->Read(&edge.m_flags, sizeof(edge.m_flags)) != SUCCESS) { + if (p_storage->Read(&edge.m_flags, sizeof(LegoU16)) != SUCCESS) { return FAILURE; } - if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { + if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) { return FAILURE; } - edge.m_pointA = &m_unk0x10[s]; + assert(s < m_numN); + edge.m_pointA = &m_nodes[s]; - if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { + if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) { return FAILURE; } - edge.m_pointB = &m_unk0x10[s]; + assert(s < m_numN); + edge.m_pointB = &m_nodes[s]; - if (edge.m_flags & LegoUnknown100db7f4::c_bit3) { - if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { + if (edge.m_flags & LegoOrientedEdge::c_hasFaceA) { + if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) { return FAILURE; } + assert(s < m_numL); edge.m_faceA = &m_boundaries[s]; - if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { + if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) { return FAILURE; } + assert(s < m_numE); edge.m_ccwA = &m_edges[s]; - if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { + if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) { return FAILURE; } + assert(s < m_numE); edge.m_cwA = &m_edges[s]; } - if (edge.m_flags & LegoUnknown100db7f4::c_bit4) { - if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { + if (edge.m_flags & LegoOrientedEdge::c_hasFaceB) { + if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) { return FAILURE; } + assert(s < m_numL); edge.m_faceB = &m_boundaries[s]; - if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { + if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) { return FAILURE; } + assert(s < m_numE); edge.m_ccwB = &m_edges[s]; - if (p_storage->Read(&s, sizeof(s)) != SUCCESS) { + if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) { return FAILURE; } + assert(s < m_numE); edge.m_cwB = &m_edges[s]; } - if (ReadVector(p_storage, edge.m_unk0x28) != SUCCESS) { + if (ReadVector(p_storage, edge.m_dir) != SUCCESS) { return FAILURE; } - if (p_storage->Read(&edge.m_unk0x3c, sizeof(edge.m_unk0x3c)) != SUCCESS) { + if (p_storage->Read(&edge.m_length, sizeof(float)) != SUCCESS) { return FAILURE; } } @@ -618,6 +625,9 @@ MxResult LegoPathController::ReadEdges(LegoStorage* p_storage) MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage) { for (MxS32 i = 0; i < m_numL; i++) { +#ifdef BETA10 + Mx4DPointFloat unused; +#endif LegoPathBoundary& boundary = m_boundaries[i]; MxU8 numE; MxU16 s; @@ -627,9 +637,11 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage) return FAILURE; } + assert(numE > 2); + boundary.m_edgeNormals = new Mx4DPointFloat[numE]; - LegoUnknown100db7f4** edges = new LegoUnknown100db7f4*[numE]; + LegoOrientedEdge** edges = new LegoOrientedEdge*[numE]; boundary.SetEdges(edges, numE); for (j = 0; j < numE; j++) { @@ -637,6 +649,8 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage) return FAILURE; } + assert(s < m_numE); + edges[j] = &m_edges[s]; } @@ -663,7 +677,7 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage) boundary.m_name[length] = '\0'; } - if (ReadVector(p_storage, boundary.m_unk0x14) != SUCCESS) { + if (ReadVector(p_storage, boundary.m_up) != SUCCESS) { return FAILURE; } @@ -673,11 +687,11 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage) } } - if (ReadVector(p_storage, boundary.m_unk0x30) != SUCCESS) { + if (ReadVector(p_storage, boundary.m_centerPoint) != SUCCESS) { return FAILURE; } - if (p_storage->Read(&boundary.m_unk0x44, sizeof(boundary.m_unk0x44)) != SUCCESS) { + if (p_storage->Read(&boundary.m_boundingRadius, sizeof(boundary.m_boundingRadius)) != SUCCESS) { return FAILURE; } @@ -686,7 +700,7 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage) } if (boundary.m_numTriggers > 0) { - boundary.m_unk0x50 = new Mx3DPointFloat; + boundary.m_direction = new Mx3DPointFloat; boundary.m_pathTrigger = new PathWithTrigger[boundary.m_numTriggers]; for (j = 0; j < boundary.m_numTriggers; j++) { @@ -694,6 +708,8 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage) return FAILURE; } + assert(s < m_numT); + boundary.m_pathTrigger[j].m_pathStruct = &m_structs[s]; if (p_storage->Read(&boundary.m_pathTrigger[j].m_data, sizeof(boundary.m_pathTrigger[j].m_data)) != @@ -702,14 +718,14 @@ MxResult LegoPathController::ReadBoundaries(LegoStorage* p_storage) } if (p_storage->Read( - &boundary.m_pathTrigger[j].m_unk0x08, - sizeof(boundary.m_pathTrigger[j].m_unk0x08) + &boundary.m_pathTrigger[j].m_triggerLength, + sizeof(boundary.m_pathTrigger[j].m_triggerLength) ) != SUCCESS) { return FAILURE; } } - if (ReadVector(p_storage, *boundary.m_unk0x50) != SUCCESS) { + if (ReadVector(p_storage, *boundary.m_direction) != SUCCESS) { return FAILURE; } } @@ -818,7 +834,7 @@ MxResult LegoPathController::FUN_10048310( while (boundarySetItA != boundarySet.end()) { MxU32 shouldRemove = TRUE; - LegoUnknown100db7f4* e = (*boundarySetItA)->m_edge; + LegoOrientedEdge* e = (*boundarySetItA)->m_edge; LegoPathBoundary* b = (*boundarySetItA)->m_boundary; assert(e && b); @@ -935,7 +951,7 @@ MxS32 LegoPathController::FUN_1004a240( Vector3& p_v1, Vector3& p_v2, float p_f1, - LegoUnknown100db7f4*& p_edge, + LegoOrientedEdge*& p_edge, LegoPathBoundary*& p_boundary ) { @@ -956,8 +972,8 @@ MxS32 LegoPathController::FUN_1004a240( p_v1 -= *p_edge->CWVertex(*p_boundary); p_v1 *= p_f1; p_v1 += *p_edge->CWVertex(*p_boundary); - p_edge->FUN_1002ddc0(*p_boundary, vec); - p_v2.EqualsCross(*p_boundary->GetUnknown0x14(), vec); + p_edge->GetFaceNormal(*p_boundary, vec); + p_v2.EqualsCross(*p_boundary->GetUp(), vec); return 0; } @@ -981,7 +997,7 @@ MxResult LegoPathController::FUN_1004a380( } LegoPathBoundary* b = &m_boundaries[i]; - Mx4DPointFloat* unk0x14 = b->GetUnknown0x14(); + Mx4DPointFloat* unk0x14 = b->GetUp(); float local28 = p_param3[0].Dot(p_param3[0], *unk0x14); if (local28 < 0.001 && local28 > -0.001) { diff --git a/LEGO1/lego/legoomni/src/race/carrace.cpp b/LEGO1/lego/legoomni/src/race/carrace.cpp index e775a3be..0c3c3a51 100644 --- a/LEGO1/lego/legoomni/src/race/carrace.cpp +++ b/LEGO1/lego/legoomni/src/race/carrace.cpp @@ -244,7 +244,7 @@ MxLong CarRace::HandlePathStruct(LegoPathStructNotificationParam& p_param) VariableTable()->SetVariable(g_strHIT_WALL_SOUND, ""); NavController()->SetDeadZone(NavController()->GetDefaultDeadZone()); NavController()->SetTrackDefault(1); - LegoRaceCar::FUN_10012de0(); + LegoRaceCar::InitYouCantStopSound(); m_raceState->m_unk0x28 = 2; RaceState::Entry* raceState = m_raceState->GetState(GameState()->GetActorId()); @@ -333,12 +333,10 @@ MxLong CarRace::HandlePathStruct(LegoPathStructNotificationParam& p_param) } // FUNCTION: LEGO1 0x10017650 -MxLong CarRace::HandleClick(LegoEventNotificationParam& p_param) +MxLong CarRace::HandleControl(LegoControlManagerNotificationParam& p_param) { - LegoControlManagerNotificationParam* param = (LegoControlManagerNotificationParam*) &p_param; - - if (param->m_unk0x28 == 1) { - switch (param->m_clickedObjectId) { + if (p_param.m_unk0x28 == 1) { + switch (p_param.m_clickedObjectId) { case 3: InvokeAction(Extra::e_stop, *g_carraceScript, CarraceScript::c_irtx08ra_PlayWav, NULL); m_act1State->m_unk0x018 = 0; @@ -346,7 +344,7 @@ MxLong CarRace::HandleClick(LegoEventNotificationParam& p_param) VariableTable()->SetVariable(g_strHIT_WALL_SOUND, ""); NavController()->SetDeadZone(NavController()->GetDefaultDeadZone()); NavController()->SetTrackDefault(1); - LegoRaceCar::FUN_10012de0(); + LegoRaceCar::InitYouCantStopSound(); m_destLocation = LegoGameState::e_infomain; TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); GameState()->GetBackgroundColor()->SetValue("reset"); @@ -358,7 +356,7 @@ MxLong CarRace::HandleClick(LegoEventNotificationParam& p_param) VariableTable()->SetVariable(g_strHIT_WALL_SOUND, ""); NavController()->SetDeadZone(NavController()->GetDefaultDeadZone()); NavController()->SetTrackDefault(1); - LegoRaceCar::FUN_10012de0(); + LegoRaceCar::InitYouCantStopSound(); m_destLocation = LegoGameState::e_carraceExterior; TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); GameState()->GetBackgroundColor()->SetValue("reset"); @@ -422,7 +420,7 @@ MxBool CarRace::Escape() NavController()->SetDeadZone(NavController()->GetDefaultDeadZone()); NavController()->SetTrackDefault(1); - LegoRaceCar::FUN_10012de0(); + LegoRaceCar::InitYouCantStopSound(); GameState()->GetBackgroundColor()->SetValue("reset"); m_destLocation = LegoGameState::e_infomain; diff --git a/LEGO1/lego/legoomni/src/race/jetskirace.cpp b/LEGO1/lego/legoomni/src/race/jetskirace.cpp index 373827ab..1297ed36 100644 --- a/LEGO1/lego/legoomni/src/race/jetskirace.cpp +++ b/LEGO1/lego/legoomni/src/race/jetskirace.cpp @@ -64,13 +64,12 @@ MxResult JetskiRace::Create(MxDSAction& p_dsAction) m_unk0x130.SetRight(543); m_unk0x130.SetBottom(333); LegoJetski::InitSoundIndices(); - InvokeAction( - Extra::e_start, - m_atomId, - DuneBuggy::GetColorOffset(g_varJSFRNTY5) + (DuneBuggy::GetColorOffset(g_varJSWNSHY5) * 5 + 0xf) * 2, - NULL - ); + + MxS32 streamId = + DuneBuggy::GetColorOffset(g_varJSFRNTY5) + (DuneBuggy::GetColorOffset(g_varJSWNSHY5) * 5 + 0xf) * 2; + InvokeAction(Extra::e_start, m_atomId, streamId, NULL); InvokeAction(Extra::e_start, m_atomId, JetraceScript::c_JetskiDashboard, NULL); + g_unk0x100f119c = TRUE; return result; @@ -121,17 +120,17 @@ MxLong JetskiRace::HandleEndAction(MxEndActionNotificationParam& p_param) } // FUNCTION: LEGO1 0x100165a0 -MxLong JetskiRace::HandleClick(LegoEventNotificationParam& p_param) +MxLong JetskiRace::HandleControl(LegoControlManagerNotificationParam& p_param) { MxLong result = 0; - if (((LegoControlManagerNotificationParam*) &p_param)->m_unk0x28 == 1) { - switch (((LegoControlManagerNotificationParam*) &p_param)->m_clickedObjectId) { + if (p_param.m_unk0x28 == 1) { + switch (p_param.m_clickedObjectId) { case JetraceScript::c_JetskiArms_Ctl: m_act1State->m_unk0x018 = 0; VariableTable()->SetVariable(g_raceState, ""); VariableTable()->SetVariable(g_strHIT_WALL_SOUND, ""); - LegoRaceCar::FUN_10012de0(); + LegoRaceCar::InitYouCantStopSound(); m_destLocation = LegoGameState::e_jetraceExterior; TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); break; @@ -139,7 +138,7 @@ MxLong JetskiRace::HandleClick(LegoEventNotificationParam& p_param) m_act1State->m_unk0x018 = 0; VariableTable()->SetVariable(g_raceState, ""); VariableTable()->SetVariable(g_strHIT_WALL_SOUND, ""); - LegoRaceCar::FUN_10012de0(); + LegoRaceCar::InitYouCantStopSound(); m_destLocation = LegoGameState::e_infomain; result = 1; TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); @@ -192,7 +191,7 @@ MxLong JetskiRace::HandlePathStruct(LegoPathStructNotificationParam& p_param) VariableTable()->SetVariable(g_raceState, ""); VariableTable()->SetVariable(g_strHIT_WALL_SOUND, ""); - LegoRaceCar::FUN_10012de0(); + LegoRaceCar::InitYouCantStopSound(); m_raceState->m_unk0x28 = 2; RaceState::Entry* raceStateEntry = m_raceState->GetState(GameState()->GetActorId()); @@ -293,6 +292,6 @@ MxBool JetskiRace::Escape() VariableTable()->SetVariable(g_raceState, ""); VariableTable()->SetVariable(g_strHIT_WALL_SOUND, ""); m_destLocation = LegoGameState::e_infomain; - LegoRaceCar::FUN_10012de0(); + LegoRaceCar::InitYouCantStopSound(); return TRUE; } diff --git a/LEGO1/lego/legoomni/src/race/legorace.cpp b/LEGO1/lego/legoomni/src/race/legorace.cpp index a2c0555d..91374766 100644 --- a/LEGO1/lego/legoomni/src/race/legorace.cpp +++ b/LEGO1/lego/legoomni/src/race/legorace.cpp @@ -82,8 +82,8 @@ MxLong LegoRace::Notify(MxParam& p_param) case c_notificationEndAction: result = HandleEndAction((MxEndActionNotificationParam&) p_param); break; - case c_notificationClick: - result = HandleClick((LegoEventNotificationParam&) p_param); + case c_notificationControl: + result = HandleControl((LegoControlManagerNotificationParam&) p_param); break; case c_notificationPathStruct: result = HandlePathStruct((LegoPathStructNotificationParam&) p_param); diff --git a/LEGO1/lego/legoomni/src/race/legoraceactor.cpp b/LEGO1/lego/legoomni/src/race/legoraceactor.cpp index 840ce5ca..f005d996 100644 --- a/LEGO1/lego/legoomni/src/race/legoraceactor.cpp +++ b/LEGO1/lego/legoomni/src/race/legoraceactor.cpp @@ -31,8 +31,8 @@ MxS32 LegoRaceActor::VTable0x68(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3) if (m_userNavFlag && result) { MxLong time = Timer()->GetTime(); - if (time - g_unk0x100f3308 > 1000) { - g_unk0x100f3308 = time; + if (time - g_timeLastHitSoundPlayed > 1000) { + g_timeLastHitSoundPlayed = time; const char* soundKey = VariableTable()->GetVariable(g_strHIT_ACTOR_SOUND); if (soundKey && *soundKey) { @@ -84,7 +84,7 @@ MxU32 LegoRaceActor::VTable0x90(float p_time, Matrix4& p_transform) m_unk0x08 = 0; positionRef -= g_unk0x10102b08; - m_roi->FUN_100a58f0(p_transform); + m_roi->SetLocal2World(p_transform); return TRUE; } } @@ -109,7 +109,7 @@ MxResult LegoRaceActor::HitActor(LegoPathActor* p_actor, MxBool p_bool) Vector3(matr[3]) += g_unk0x10102b08; - roi->FUN_100a58f0(matr); + roi->SetLocal2World(matr); p_actor->SetActorState(c_two); } diff --git a/LEGO1/lego/legoomni/src/race/legoracers.cpp b/LEGO1/lego/legoomni/src/race/legoracers.cpp index 989c17e3..0a9fa1e2 100644 --- a/LEGO1/lego/legoomni/src/race/legoracers.cpp +++ b/LEGO1/lego/legoomni/src/race/legoracers.cpp @@ -175,7 +175,7 @@ LegoRaceCar::LegoRaceCar() m_skelKick1Anim = 0; m_skelKick2Anim = 0; m_unk0x5c.Clear(); - m_unk0x58 = 0; + m_kickStart = 0; m_kick1B = 0; m_kick2B = 0; NotificationManager()->Register(this); @@ -198,10 +198,10 @@ MxLong LegoRaceCar::Notify(MxParam& p_param) // Initialized at LEGO1 0x10012db0 // GLOBAL: LEGO1 0x10102af0 // GLOBAL: BETA10 0x102114c0 -Mx3DPointFloat g_unk0x10102af0 = Mx3DPointFloat(0.0f, 2.0f, 0.0f); +Mx3DPointFloat g_hitOffset = Mx3DPointFloat(0.0f, 2.0f, 0.0f); // FUNCTION: LEGO1 0x10012de0 -void LegoRaceCar::FUN_10012de0() +void LegoRaceCar::InitYouCantStopSound() { // Init to TRUE so we don't play "you can't stop in the middle of the race!" before the player ever moves g_playedYouCantStopSound = TRUE; @@ -226,7 +226,7 @@ void LegoRaceCar::InitSoundIndices() void LegoRaceCar::SetWorldSpeed(MxFloat p_worldSpeed) { if (!m_userNavFlag) { - if (!LegoCarRaceActor::m_unk0x0c) { + if (!LegoCarRaceActor::m_animState) { m_maxLinearVel = p_worldSpeed; } LegoAnimActor::SetWorldSpeed(p_worldSpeed); @@ -241,7 +241,7 @@ void LegoRaceCar::SetWorldSpeed(MxFloat p_worldSpeed) void LegoRaceCar::SetMaxLinearVelocity(float p_maxLinearVelocity) { if (p_maxLinearVelocity < 0) { - LegoCarRaceActor::m_unk0x0c = 2; + LegoCarRaceActor::m_animState = 2; m_maxLinearVel = 0; SetWorldSpeed(0); } @@ -296,7 +296,7 @@ void LegoRaceCar::ParseAction(char* p_extra) // FUNCTION: LEGO1 0x10012ff0 // FUNCTION: BETA10 0x100cb60e -void LegoRaceCar::FUN_10012ff0(float p_param) +void LegoRaceCar::KickCamera(float p_param) { LegoAnimActorStruct* a; // called `a` in BETA10 float deltaTime; @@ -312,16 +312,16 @@ void LegoRaceCar::FUN_10012ff0(float p_param) assert(a && a->GetAnimTreePtr() && a->GetAnimTreePtr()->GetCamAnim()); if (a->GetAnimTreePtr()) { - deltaTime = p_param - m_unk0x58; + deltaTime = p_param - m_kickStart; if (a->GetDuration() <= deltaTime || deltaTime < 0.0) { if (m_userState == LEGORACECAR_KICK1) { - LegoUnknown100db7f4** edges = m_kick1B->GetEdges(); + LegoOrientedEdge** edges = m_kick1B->GetEdges(); m_destEdge = edges[2]; m_boundary = m_kick1B; } else { - LegoUnknown100db7f4** edges = m_kick1B->GetEdges(); + LegoOrientedEdge** edges = m_kick1B->GetEdges(); m_destEdge = edges[1]; m_boundary = m_kick2B; } @@ -343,7 +343,7 @@ void LegoRaceCar::FUN_10012ff0(float p_param) r->GetCameraController()->FUN_100123e0(transformationMatrix, 0); } - m_roi->FUN_100a58f0(transformationMatrix); + m_roi->SetLocal2World(transformationMatrix); } } } @@ -387,7 +387,7 @@ MxU32 LegoRaceCar::HandleSkeletonKicks(float p_param1) return FALSE; } - m_unk0x58 = p_param1; + m_kickStart = p_param1; SoundManager()->GetCacheSoundManager()->Play(g_soundSkel3, NULL, FALSE); return TRUE; @@ -398,7 +398,7 @@ MxU32 LegoRaceCar::HandleSkeletonKicks(float p_param1) void LegoRaceCar::Animate(float p_time) { if (m_userNavFlag && (m_userState == LEGORACECAR_KICK1 || m_userState == LEGORACECAR_KICK2)) { - FUN_10012ff0(p_time); + KickCamera(p_time); return; } @@ -410,7 +410,7 @@ void LegoRaceCar::Animate(float p_time) } } - if (LegoCarRaceActor::m_unk0x0c == 1) { + if (LegoCarRaceActor::m_animState == 1) { FUN_1005d4b0(); if (!m_userNavFlag) { @@ -468,8 +468,8 @@ MxResult LegoRaceCar::HitActor(LegoPathActor* p_actor, MxBool p_bool) assert(roi); matr = roi->GetLocal2World(); - Vector3(matr[3]) += g_unk0x10102af0; - roi->FUN_100a58f0(matr); + Vector3(matr[3]) += g_hitOffset; + roi->SetLocal2World(matr); p_actor->SetActorState(c_two); } @@ -513,7 +513,7 @@ MxResult LegoRaceCar::HitActor(LegoPathActor* p_actor, MxBool p_bool) if (soundKey) { SoundManager()->GetCacheSoundManager()->Play(soundKey, NULL, FALSE); - g_timeLastRaceCarSoundPlayed = g_unk0x100f3308 = time; + g_timeLastRaceCarSoundPlayed = g_timeLastHitSoundPlayed = time; } } @@ -579,7 +579,7 @@ void LegoJetski::InitSoundIndices() void LegoJetski::SetWorldSpeed(MxFloat p_worldSpeed) { if (!m_userNavFlag) { - if (!LegoCarRaceActor::m_unk0x0c) { + if (!LegoCarRaceActor::m_animState) { m_maxLinearVel = p_worldSpeed; } LegoAnimActor::SetWorldSpeed(p_worldSpeed); @@ -594,7 +594,7 @@ void LegoJetski::SetWorldSpeed(MxFloat p_worldSpeed) void LegoJetski::FUN_100136f0(float p_worldSpeed) { if (p_worldSpeed < 0) { - LegoCarRaceActor::m_unk0x0c = 2; + LegoCarRaceActor::m_animState = 2; m_maxLinearVel = 0; SetWorldSpeed(0); } @@ -609,7 +609,7 @@ void LegoJetski::Animate(float p_time) { LegoJetskiRaceActor::Animate(p_time); - if (LegoCarRaceActor::m_unk0x0c == 1) { + if (LegoCarRaceActor::m_animState == 1) { FUN_1005d4b0(); if (!m_userNavFlag) { @@ -682,8 +682,8 @@ MxResult LegoJetski::HitActor(LegoPathActor* p_actor, MxBool p_bool) LegoROI* roi = p_actor->GetROI(); matr = roi->GetLocal2World(); - Vector3(matr[3]) += g_unk0x10102af0; - roi->FUN_100a58f0(matr); + Vector3(matr[3]) += g_hitOffset; + roi->SetLocal2World(matr); p_actor->SetActorState(c_two); } @@ -711,7 +711,7 @@ MxResult LegoJetski::HitActor(LegoPathActor* p_actor, MxBool p_bool) if (soundKey) { SoundManager()->GetCacheSoundManager()->Play(soundKey, NULL, FALSE); - g_timeLastJetskiSoundPlayed = g_unk0x100f3308 = time; + g_timeLastJetskiSoundPlayed = g_timeLastHitSoundPlayed = time; } } diff --git a/LEGO1/lego/legoomni/src/race/legoracespecial.cpp b/LEGO1/lego/legoomni/src/race/legoracespecial.cpp index 06d79082..e599c633 100644 --- a/LEGO1/lego/legoomni/src/race/legoracespecial.cpp +++ b/LEGO1/lego/legoomni/src/race/legoracespecial.cpp @@ -1,6 +1,6 @@ #include "legoracespecial.h" -#include "geom/legounkown100db7f4.h" +#include "geom/legoorientededge.h" #include "legonavcontroller.h" #include "legopathboundary.h" #include "legopathcontroller.h" @@ -44,7 +44,7 @@ LegoCarRaceActor::LegoCarRaceActor() { m_unk0x08 = 1.0f; m_unk0x70 = 0.0f; - m_unk0x0c = 0; + m_animState = 0; m_maxLinearVel = 0.0f; m_frequencyFactor = 1.0f; m_unk0x1c = 0; @@ -65,7 +65,7 @@ void LegoCarRaceActor::FUN_10080590(float p_time) Mx3DPointFloat destEdgeUnknownVector; Mx3DPointFloat worldDirection = Mx3DPointFloat(m_roi->GetWorldDirection()); - m_destEdge->FUN_1002ddc0(*m_boundary, destEdgeUnknownVector); + m_destEdge->GetFaceNormal(*m_boundary, destEdgeUnknownVector); if (abs(destEdgeUnknownVector.Dot(destEdgeUnknownVector.GetData(), worldDirection.GetData())) > 0.5) { maxSpeed *= m_unk0x10; @@ -169,9 +169,9 @@ MxS32 LegoCarRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_edg LERP3(pointUnknown, *v1, *v2, m_unk0xe4); - m_destEdge->FUN_1002ddc0(*m_boundary, destEdgeUnknownVector); + m_destEdge->GetFaceNormal(*m_boundary, destEdgeUnknownVector); - crossProduct.EqualsCross(*m_boundary->GetUnknown0x14(), destEdgeUnknownVector); + crossProduct.EqualsCross(*m_boundary->GetUp(), destEdgeUnknownVector); crossProduct.Unitize(); Mx3DPointFloat worldDirection(Vector3(m_roi->GetWorldDirection())); @@ -192,7 +192,9 @@ MxS32 LegoCarRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_edg } else { m_unk0x7c = 0; +#ifdef BETA10 assert(0); +#endif return 0; // BETA10 returns -1 here } } @@ -212,7 +214,7 @@ MxS32 LegoCarRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_edg // FUNCTION: LEGO1 0x10080b40 // FUNCTION: BETA10 0x100cdb3c -void LegoCarRaceActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown100db7f4*& p_edge, float& p_unk0xe4) +void LegoCarRaceActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoOrientedEdge*& p_edge, float& p_unk0xe4) { LegoPathActor::SwitchBoundary(m_boundary, m_destEdge, m_unk0xe4); } @@ -221,18 +223,18 @@ void LegoCarRaceActor::SwitchBoundary(LegoPathBoundary*& p_boundary, LegoUnknown // FUNCTION: BETA10 0x100cdbae void LegoCarRaceActor::Animate(float p_time) { - // m_unk0x0c is not an MxBool, there are places where it is set to 2 or higher - if (m_unk0x0c == 0) { + // m_animState is not an MxBool, there are places where it is set to 2 or higher + if (m_animState == 0) { const char* value = VariableTable()->GetVariable(g_raceState); if (strcmpi(value, g_racing) == 0) { - m_unk0x0c = 1; + m_animState = 1; m_lastTime = p_time - 1.0f; m_unk0x1c = p_time; } } - if (m_unk0x0c == 1) { + if (m_animState == 1) { LegoAnimActor::Animate(p_time); } } @@ -241,7 +243,7 @@ void LegoCarRaceActor::Animate(float p_time) // FUNCTION: BETA10 0x100cdc54 MxResult LegoCarRaceActor::VTable0x9c() { - LegoUnknown100db7f4* d = m_destEdge; + LegoOrientedEdge* d = m_destEdge; if (VTable0x1c(m_boundary, m_destEdge)) { LegoPathBoundary* b = m_boundary; @@ -262,11 +264,11 @@ MxResult LegoCarRaceActor::VTable0x9c() Mx3DPointFloat point4; Mx3DPointFloat point5; - d->FUN_1002ddc0(*b, point2); - m_destEdge->FUN_1002ddc0(*m_boundary, point3); + d->GetFaceNormal(*b, point2); + m_destEdge->GetFaceNormal(*m_boundary, point3); - point4.EqualsCross(point2, *m_boundary->GetUnknown0x14()); - point5.EqualsCross(*m_boundary->GetUnknown0x14(), point3); + point4.EqualsCross(point2, *m_boundary->GetUp()); + point5.EqualsCross(*m_boundary->GetUp(), point3); point4.Unitize(); point5.Unitize(); @@ -364,8 +366,8 @@ MxS32 LegoJetskiRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_ LERP3(a, *v1, *v2, m_unk0xe4); - m_destEdge->FUN_1002ddc0(*m_boundary, bbb); - c.EqualsCross(bbb, *m_boundary->GetUnknown0x14()); + m_destEdge->GetFaceNormal(*m_boundary, bbb); + c.EqualsCross(bbb, *m_boundary->GetUp()); c.Unitize(); Mx3DPointFloat worldDirection(m_roi->GetWorldDirection()); @@ -396,10 +398,10 @@ MxS32 LegoJetskiRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_ // FUNCTION: LEGO1 0x10081550 void LegoJetskiRaceActor::Animate(float p_time) { - if (m_unk0x0c == 0) { + if (m_animState == 0) { const LegoChar* raceState = VariableTable()->GetVariable(g_raceState); if (!stricmp(raceState, g_racing)) { - m_unk0x0c = 1; + m_animState = 1; m_lastTime = p_time - 1.0f; m_unk0x1c = p_time; } @@ -408,7 +410,7 @@ void LegoJetskiRaceActor::Animate(float p_time) } } - if (m_unk0x0c == 1) { + if (m_animState == 1) { LegoAnimActor::Animate(p_time); } } diff --git a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp index 4c0b13f2..82c76aa6 100644 --- a/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoanimpresenter.cpp @@ -47,8 +47,8 @@ void LegoAnimPresenter::Init() m_anim = NULL; m_roiMap = NULL; m_roiMapSize = 0; - m_unk0x74 = NULL; - m_unk0x70 = NULL; + m_managedActors = NULL; + m_sceneROIs = NULL; m_unk0x78 = NULL; m_flags = 0; m_unk0xa8.Clear(); @@ -81,13 +81,13 @@ void LegoAnimPresenter::Destroy(MxBool p_fromDestructor) delete[] m_roiMap; } - if (m_unk0x70 != NULL) { - delete m_unk0x70; + if (m_sceneROIs != NULL) { + delete m_sceneROIs; } - if (m_unk0x74 != NULL) { + if (m_managedActors != NULL) { FUN_1006aa60(); - delete m_unk0x74; + delete m_managedActors; } if (m_unk0x78 != NULL) { @@ -142,25 +142,25 @@ MxResult LegoAnimPresenter::CreateAnim(MxStreamChunk* p_chunk) LegoS32 parseScene = 0; MxS32 val3; - if (storage.Read(&magicSig, sizeof(magicSig)) != SUCCESS || magicSig != 0x11) { + if (storage.Read(&magicSig, sizeof(MxS32)) != SUCCESS || magicSig != 0x11) { goto done; } - if (storage.Read(&m_unk0xa4, sizeof(m_unk0xa4)) != SUCCESS) { + if (storage.Read(&m_unk0xa4, sizeof(float)) != SUCCESS) { goto done; } - if (storage.Read(&m_unk0xa8[0], sizeof(m_unk0xa8[0])) != SUCCESS) { + if (storage.Read(&m_unk0xa8[0], sizeof(float)) != SUCCESS) { goto done; } - if (storage.Read(&m_unk0xa8[1], sizeof(m_unk0xa8[1])) != SUCCESS) { + if (storage.Read(&m_unk0xa8[1], sizeof(float)) != SUCCESS) { goto done; } - if (storage.Read(&m_unk0xa8[2], sizeof(m_unk0xa8[2])) != SUCCESS) { + if (storage.Read(&m_unk0xa8[2], sizeof(float)) != SUCCESS) { goto done; } - if (storage.Read(&parseScene, sizeof(parseScene)) != SUCCESS) { + if (storage.Read(&parseScene, sizeof(LegoS32)) != SUCCESS) { goto done; } - if (storage.Read(&val3, sizeof(val3)) != SUCCESS) { + if (storage.Read(&val3, sizeof(MxS32)) != SUCCESS) { goto done; } @@ -214,17 +214,17 @@ LegoChar* LegoAnimPresenter::FUN_10069150(const LegoChar* p_und1) // FUNCTION: LEGO1 0x100692b0 void LegoAnimPresenter::FUN_100692b0() { - m_unk0x74 = new LegoROIList(); + m_managedActors = new LegoROIList(); - if (m_unk0x74) { + if (m_managedActors) { LegoU32 numActors = m_anim->GetNumActors(); for (LegoU32 i = 0; i < numActors; i++) { - LegoChar* str = FUN_100697c0(m_anim->GetActorName(i), NULL); - undefined4 unk0x04 = m_anim->GetActorUnknown0x04(i); + LegoChar* str = GetVariableOrIdentity(m_anim->GetActorName(i), NULL); + LegoU32 actorType = m_anim->GetActorType(i); LegoROI* roi = NULL; - if (unk0x04 == 2) { + if (actorType == LegoAnimActorEntry::e_actorType2) { LegoChar* src; if (str[0] == '*') { src = str + 1; @@ -239,7 +239,7 @@ void LegoAnimPresenter::FUN_100692b0() roi->SetVisibility(FALSE); } } - else if (unk0x04 == 4) { + else if (actorType == LegoAnimActorEntry::e_actorType4) { LegoChar* baseName = new LegoChar[strlen(str)]; strcpy(baseName, str + 1); strlwr(baseName); @@ -254,7 +254,7 @@ void LegoAnimPresenter::FUN_100692b0() delete[] baseName; delete[] und; } - else if (unk0x04 == 3) { + else if (actorType == LegoAnimActorEntry::e_actorType3) { LegoChar* lodName = new LegoChar[strlen(str)]; strcpy(lodName, str + 1); @@ -280,7 +280,7 @@ void LegoAnimPresenter::FUN_100692b0() } if (roi != NULL) { - m_unk0x74->Append(roi); + m_managedActors->Append(roi); } delete[] str; @@ -292,17 +292,17 @@ void LegoAnimPresenter::FUN_100692b0() // FUNCTION: BETA10 0x1004f359 void LegoAnimPresenter::FUN_100695c0() { - m_unk0x70 = new LegoROIList(); + m_sceneROIs = new LegoROIList(); - if (m_unk0x70) { + if (m_sceneROIs) { const CompoundObject& rois = VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->GetROIs(); LegoU32 numActors = m_anim->GetNumActors(); for (LegoU32 i = 0; i < numActors; i++) { if (FUN_100698b0(rois, m_anim->GetActorName(i)) == FALSE) { - undefined4 unk0x04 = m_anim->GetActorUnknown0x04(i); + LegoU32 actorType = m_anim->GetActorType(i); - if (unk0x04 == 5 || unk0x04 == 6) { + if (actorType == LegoAnimActorEntry::e_actorType5 || actorType == LegoAnimActorEntry::e_actorType6) { LegoChar lodName[256]; const LegoChar* actorName = m_anim->GetActorName(i); @@ -324,23 +324,23 @@ void LegoAnimPresenter::FUN_100695c0() } // FUNCTION: LEGO1 0x100697c0 -LegoChar* LegoAnimPresenter::FUN_100697c0(const LegoChar* p_und1, const LegoChar* p_und2) +LegoChar* LegoAnimPresenter::GetVariableOrIdentity(const LegoChar* p_varName, const LegoChar* p_prefix) { - const LegoChar* str = p_und1; - const char* var = VariableTable()->GetVariable(p_und1); + const LegoChar* str = p_varName; + const char* var = VariableTable()->GetVariable(p_varName); if (*var) { str = var; } - LegoU32 len = strlen(str) + (p_und2 ? strlen(p_und2) : 0) + 2; + LegoU32 len = strlen(str) + (p_prefix ? strlen(p_prefix) : 0) + 2; LegoChar* result = new LegoChar[len]; if (result != NULL) { *result = '\0'; - if (p_und2) { - strcpy(result, p_und2); + if (p_prefix) { + strcpy(result, p_prefix); strcat(result, ":"); } @@ -356,7 +356,7 @@ LegoBool LegoAnimPresenter::FUN_100698b0(const CompoundObject& p_rois, const Leg LegoBool result = FALSE; LegoChar* str; - if (*(str = FUN_100697c0(p_und2, NULL)) == '*') { + if (*(str = GetVariableOrIdentity(p_und2, NULL)) == '*') { LegoChar* tmp = FUN_10069150(str); delete[] str; str = tmp; @@ -369,7 +369,7 @@ LegoBool LegoAnimPresenter::FUN_100698b0(const CompoundObject& p_rois, const Leg if (name != NULL) { if (!strcmpi(name, str)) { - m_unk0x70->Append(roi); + m_sceneROIs->Append(roi); result = TRUE; break; } @@ -382,20 +382,20 @@ LegoBool LegoAnimPresenter::FUN_100698b0(const CompoundObject& p_rois, const Leg } // FUNCTION: LEGO1 0x100699e0 -LegoROI* LegoAnimPresenter::FUN_100699e0(const LegoChar* p_und) +LegoROI* LegoAnimPresenter::FindROI(const LegoChar* p_name) { - LegoROIListCursor cursor(m_unk0x70); + LegoROIListCursor cursor(m_sceneROIs); LegoROI* roi; while (cursor.Next(roi)) { - LegoChar* und = FUN_100697c0(roi->GetName(), NULL); + LegoChar* nameOrVar = GetVariableOrIdentity(roi->GetName(), NULL); - if (und != NULL && !strcmpi(und, p_und)) { - delete[] und; + if (nameOrVar != NULL && !strcmpi(nameOrVar, p_name)) { + delete[] nameOrVar; return roi; } - delete[] und; + delete[] nameOrVar; } return NULL; @@ -410,7 +410,7 @@ void LegoAnimPresenter::FUN_10069b10() memset(m_unk0x8c, 0, m_unk0x94 * sizeof(*m_unk0x8c)); } - FUN_1006a3c0(anims, m_anim->GetRoot(), NULL); + UpdateStructMapAndROIIndex(anims, m_anim->GetRoot(), NULL); if (m_roiMap != NULL) { delete[] m_roiMap; @@ -443,7 +443,7 @@ void LegoAnimPresenter::FUN_10069b10() } // FUNCTION: LEGO1 0x1006a3c0 -void LegoAnimPresenter::FUN_1006a3c0(LegoAnimStructMap& p_map, LegoTreeNode* p_node, LegoROI* p_roi) +void LegoAnimPresenter::UpdateStructMapAndROIIndex(LegoAnimStructMap& p_map, LegoTreeNode* p_node, LegoROI* p_roi) { LegoROI* roi = p_roi; LegoChar* und = NULL; @@ -456,27 +456,27 @@ void LegoAnimPresenter::FUN_1006a3c0(LegoAnimStructMap& p_map, LegoTreeNode* p_n name = und2 = FUN_10069150(name); } - und = FUN_100697c0(name, p_roi != NULL ? p_roi->GetName() : NULL); + und = GetVariableOrIdentity(name, p_roi != NULL ? p_roi->GetName() : NULL); if (p_roi == NULL) { - roi = FUN_100699e0(und); + roi = FindROI(und); if (roi != NULL) { - FUN_1006a4f0(p_map, data, und, roi); + UpdateStructMapAndROIIndexForNode(p_map, data, und, roi); } else { - data->SetUnknown0x20(0); + data->SetROIIndex(0); } } else { LegoROI* child = p_roi->FindChildROI(name, p_roi); if (child != NULL) { - FUN_1006a4f0(p_map, data, und, child); + UpdateStructMapAndROIIndexForNode(p_map, data, und, child); } else { - if (FUN_100699e0(name) != NULL) { - FUN_1006a3c0(p_map, p_node, NULL); + if (FindROI(name) != NULL) { + UpdateStructMapAndROIIndex(p_map, p_node, NULL); delete[] und; delete[] und2; return; @@ -490,12 +490,12 @@ void LegoAnimPresenter::FUN_1006a3c0(LegoAnimStructMap& p_map, LegoTreeNode* p_n MxS32 count = p_node->GetNumChildren(); for (MxS32 i = 0; i < count; i++) { - FUN_1006a3c0(p_map, p_node->GetChild(i), roi); + UpdateStructMapAndROIIndex(p_map, p_node->GetChild(i), roi); } } // FUNCTION: LEGO1 0x1006a4f0 -void LegoAnimPresenter::FUN_1006a4f0( +void LegoAnimPresenter::UpdateStructMapAndROIIndexForNode( LegoAnimStructMap& p_map, LegoAnimNodeData* p_data, const LegoChar* p_und, @@ -510,7 +510,7 @@ void LegoAnimPresenter::FUN_1006a4f0( animStruct.m_index = p_map.size() + 1; animStruct.m_roi = p_roi; - p_data->SetUnknown0x20(animStruct.m_index); + p_data->SetROIIndex(animStruct.m_index); LegoChar* und = new LegoChar[strlen(p_und) + 1]; strcpy(und, p_und); @@ -518,7 +518,7 @@ void LegoAnimPresenter::FUN_1006a4f0( p_map[und] = animStruct; } else { - p_data->SetUnknown0x20((*it).second.m_index); + p_data->SetROIIndex((*it).second.m_index); } } @@ -526,7 +526,7 @@ void LegoAnimPresenter::FUN_1006a4f0( // FUNCTION: BETA10 0x1004feee void LegoAnimPresenter::FUN_1006aa60() { - LegoROIListCursor cursor(m_unk0x74); + LegoROIListCursor cursor(m_managedActors); LegoROI* roi; while (cursor.Next(roi)) { @@ -542,10 +542,10 @@ void LegoAnimPresenter::FUN_1006aa60() void LegoAnimPresenter::FUN_1006ab70() { if (m_unk0x96) { - AnimationManager()->FUN_10063270(m_unk0x74, this); + AnimationManager()->FUN_10063270(m_managedActors, this); } else { - AnimationManager()->FUN_10063780(m_unk0x74); + AnimationManager()->FUN_10063780(m_managedActors); } } @@ -565,10 +565,10 @@ MxBool LegoAnimPresenter::FUN_1006abb0(LegoTreeNode* p_node, LegoROI* p_roi) MxS32 i, count; if (name != NULL && *name != '-') { - und = FUN_100697c0(name, p_roi != NULL ? p_roi->GetName() : NULL); + und = GetVariableOrIdentity(name, p_roi != NULL ? p_roi->GetName() : NULL); if (p_roi == NULL) { - roi = FUN_100699e0(und); + roi = FindROI(und); if (roi == NULL) { goto done; @@ -578,7 +578,7 @@ MxBool LegoAnimPresenter::FUN_1006abb0(LegoTreeNode* p_node, LegoROI* p_roi) LegoROI* child = p_roi->FindChildROI(name, p_roi); if (child == NULL) { - if (FUN_100699e0(name) != NULL) { + if (FindROI(name) != NULL) { if (FUN_1006abb0(p_node, NULL)) { result = TRUE; } @@ -659,8 +659,8 @@ void LegoAnimPresenter::PutFrame() dir *= dirsqr; up *= upsqr; - m_unk0x8c[i]->FUN_100a58f0(mat); - m_unk0x8c[i]->VTable0x14(); + m_unk0x8c[i]->SetLocal2World(mat); + m_unk0x8c[i]->WrappedUpdateWorldData(); } } } @@ -689,7 +689,7 @@ MxResult LegoAnimPresenter::FUN_1006afc0(MxMatrix*& p_matrix, float p_und) if (m_roiMap[i] != NULL) { mat = p_matrix[i]; p_matrix[i] = m_roiMap[i]->GetLocal2World(); - m_roiMap[i]->FUN_100a58f0(mat); + m_roiMap[i]->SetLocal2World(mat); } } @@ -790,7 +790,7 @@ void LegoAnimPresenter::StartingTickle() } FUN_10069b10(); - FUN_1006c8a0(TRUE); + SetDisabled(TRUE); if (m_unk0x78 == NULL) { if (fabs(m_action->GetDirection()[0]) >= 0.00000047683716F || @@ -815,7 +815,7 @@ void LegoAnimPresenter::StartingTickle() m_compositePresenter->VTable0x60(this); } else { - m_action->SetUnknown90(Timer()->GetTime()); + m_action->SetTimeStarted(Timer()->GetTime()); } ProgressTickleState(e_streaming); @@ -828,9 +828,9 @@ void LegoAnimPresenter::StartingTickle() VTable0x8c(); done: - if (m_unk0x70 != NULL) { - delete m_unk0x70; - m_unk0x70 = NULL; + if (m_sceneROIs != NULL) { + delete m_sceneROIs; + m_sceneROIs = NULL; } } @@ -893,7 +893,7 @@ void LegoAnimPresenter::FUN_1006b900(LegoAnim* p_anim, MxLong p_time, Matrix4* p mat = *p_matrix; } else { - LegoROI* roi = m_roiMap[data->GetUnknown0x20()]; + LegoROI* roi = m_roiMap[data->GetROIIndex()]; if (roi != NULL) { mat = roi->GetLocal2World(); @@ -918,7 +918,7 @@ void LegoAnimPresenter::FUN_1006b9a0(LegoAnim* p_anim, MxLong p_time, Matrix4* p mat = *p_matrix; } else { - LegoROI* roi = m_roiMap[data->GetUnknown0x20()]; + LegoROI* roi = m_roiMap[data->GetROIIndex()]; if (roi != NULL) { mat = roi->GetLocal2World(); @@ -1090,7 +1090,7 @@ void LegoAnimPresenter::EndAction() } } - FUN_1006c8a0(FALSE); + SetDisabled(FALSE); FUN_1006ab70(); VTable0x90(); @@ -1151,18 +1151,18 @@ void LegoAnimPresenter::VTable0x90() } // FUNCTION: LEGO1 0x1006c8a0 -void LegoAnimPresenter::FUN_1006c8a0(MxBool p_bool) +void LegoAnimPresenter::SetDisabled(MxBool p_disabled) { if (m_roiMapSize != 0 && m_roiMap != NULL) { for (MxU32 i = 1; i <= m_roiMapSize; i++) { LegoEntity* entity = m_roiMap[i]->GetEntity(); if (entity != NULL) { - if (p_bool) { - entity->SetUnknown0x10Flag(LegoEntity::c_altBit1); + if (p_disabled) { + entity->SetInteractionFlag(LegoEntity::c_disabled); } else { - entity->ClearUnknown0x10Flag(LegoEntity::c_altBit1); + entity->ClearInteractionFlag(LegoEntity::c_disabled); } } } diff --git a/LEGO1/lego/legoomni/src/video/legoflctexturepresenter.cpp b/LEGO1/lego/legoomni/src/video/legoflctexturepresenter.cpp index 5d37e829..9aeabf74 100644 --- a/LEGO1/lego/legoomni/src/video/legoflctexturepresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoflctexturepresenter.cpp @@ -64,7 +64,7 @@ void LegoFlcTexturePresenter::LoadFrame(MxStreamChunk* p_chunk) void LegoFlcTexturePresenter::PutFrame() { if (m_texture != NULL && m_rectCount != 0) { - m_texture->FUN_10066010(m_frameBitmap->GetImage()); + m_texture->LoadBits(m_frameBitmap->GetImage()); m_rectCount = 0; } } diff --git a/LEGO1/lego/legoomni/src/video/legohideanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legohideanimpresenter.cpp index 64a06a08..89768b3e 100644 --- a/LEGO1/lego/legoomni/src/video/legohideanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legohideanimpresenter.cpp @@ -104,10 +104,10 @@ void LegoHideAnimPresenter::FUN_1006db60(LegoTreeNode* p_node, LegoTime p_time) MxBool previousB = FALSE; if (m_roiMap != NULL) { - LegoROI* roi = m_roiMap[data->GetUnknown0x20()]; + LegoROI* roi = m_roiMap[data->GetROIIndex()]; if (roi != NULL) { - newB = data->FUN_100a0990(p_time); + newB = data->GetVisibility(p_time); previousB = roi->GetVisibility(); roi->SetVisibility(newB); } @@ -117,7 +117,7 @@ void LegoHideAnimPresenter::FUN_1006db60(LegoTreeNode* p_node, LegoTime p_time) LegoPathBoundary* boundary = m_boundaryMap[data->GetUnknown0x22()]; if (boundary != NULL) { - newB = data->FUN_100a0990(p_time); + newB = data->GetVisibility(p_time); previousB = boundary->GetFlag0x10(); boundary->SetFlag0x10(newB); } diff --git a/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp index 0272e50d..90b98e91 100644 --- a/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legolocomotionanimpresenter.cpp @@ -157,8 +157,8 @@ void LegoLocomotionAnimPresenter::FUN_1006d680(LegoAnimActor* p_actor, MxFloat p variableTable->SetVariable(key, ""); - if (m_unk0x70 != NULL) { - delete m_unk0x70; - m_unk0x70 = NULL; + if (m_sceneROIs != NULL) { + delete m_sceneROIs; + m_sceneROIs = NULL; } } diff --git a/LEGO1/lego/legoomni/src/video/legoloopinganimpresenter.cpp b/LEGO1/lego/legoomni/src/video/legoloopinganimpresenter.cpp index 93b4720d..cf75ce47 100644 --- a/LEGO1/lego/legoomni/src/video/legoloopinganimpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legoloopinganimpresenter.cpp @@ -75,8 +75,8 @@ void LegoLoopingAnimPresenter::PutFrame() dir *= dirsqr; up *= upsqr; - m_unk0x8c[i]->FUN_100a58f0(mat); - m_unk0x8c[i]->VTable0x14(); + m_unk0x8c[i]->SetLocal2World(mat); + m_unk0x8c[i]->WrappedUpdateWorldData(); } } } diff --git a/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp b/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp index a3040d37..dcaab81d 100644 --- a/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legomodelpresenter.cpp @@ -65,29 +65,29 @@ MxResult LegoModelPresenter::CreateROI(MxDSChunk* p_chunk) if (!(m_roi = new LegoROI(VideoManager()->GetRenderer()))) { goto done; } - if (storage.Read(&version, sizeof(version)) != SUCCESS) { + if (storage.Read(&version, sizeof(LegoU32)) != SUCCESS) { goto done; } if (version != MODEL_VERSION) { goto done; } - if (storage.Read(&textureInfoOffset, sizeof(textureInfoOffset)) != SUCCESS) { + if (storage.Read(&textureInfoOffset, sizeof(LegoU32)) != SUCCESS) { goto done; } storage.SetPosition(textureInfoOffset); - if (storage.Read(&numTextures, sizeof(numTextures)) != SUCCESS) { + if (storage.Read(&numTextures, sizeof(LegoU32)) != SUCCESS) { goto done; } - if (storage.Read(&skipTextures, sizeof(skipTextures)) != SUCCESS) { + if (storage.Read(&skipTextures, sizeof(LegoU32)) != SUCCESS) { goto done; } for (i = 0; i < numTextures; i++) { LegoU32 textureNameLength; - storage.Read(&textureNameLength, sizeof(textureNameLength)); + storage.Read(&textureNameLength, sizeof(LegoU32)); textureName = new LegoChar[textureNameLength + 1]; storage.Read(textureName, textureNameLength); textureName[textureNameLength] = '\0'; @@ -149,7 +149,7 @@ MxResult LegoModelPresenter::CreateROI(MxDSChunk* p_chunk) storage.SetPosition(8); - if (storage.Read(&numROIs, sizeof(numROIs)) != SUCCESS) { + if (storage.Read(&numROIs, sizeof(LegoU32)) != SUCCESS) { goto done; } if (anim.Read(&storage, FALSE) != SUCCESS) { @@ -194,7 +194,7 @@ MxResult LegoModelPresenter::CreateROI(MxDSChunk* p_chunk) // FUNCTION: LEGO1 0x1007ff70 // FUNCTION: BETA10 0x10099061 -MxResult LegoModelPresenter::FUN_1007ff70( +MxResult LegoModelPresenter::CreateROI( MxDSChunk& p_chunk, LegoEntity* p_entity, MxBool p_roiVisible, diff --git a/LEGO1/lego/legoomni/src/video/legopalettepresenter.cpp b/LEGO1/lego/legoomni/src/video/legopalettepresenter.cpp index 880f1b9f..6ad7f6ec 100644 --- a/LEGO1/lego/legoomni/src/video/legopalettepresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legopalettepresenter.cpp @@ -56,8 +56,8 @@ MxResult LegoPalettePresenter::ParsePalette(MxStreamChunk* p_chunk) MxResult result = FAILURE; LegoMemory stream((char*) p_chunk->GetData()); - if (stream.Read(buffer, sizeof(buffer)) == SUCCESS) { - if (stream.Read(palette, sizeof(palette)) == SUCCESS) { + if (stream.Read(buffer, 40 * sizeof(MxU8)) == SUCCESS) { + if (stream.Read(palette, 256 * 4 * sizeof(MxU8)) == SUCCESS) { m_palette = new MxPalette(palette); if (m_palette) { result = SUCCESS; diff --git a/LEGO1/lego/legoomni/src/video/legopartpresenter.cpp b/LEGO1/lego/legoomni/src/video/legopartpresenter.cpp index fba9373f..88e31dd6 100644 --- a/LEGO1/lego/legoomni/src/video/legopartpresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legopartpresenter.cpp @@ -68,20 +68,20 @@ MxResult LegoPartPresenter::Read(MxDSChunk& p_chunk) LegoTextureInfo* textureInfo = NULL; LegoS32 hardwareMode = VideoManager()->GetDirect3D()->AssignedDevice()->GetHardwareMode(); - if (storage.Read(&textureInfoOffset, sizeof(textureInfoOffset)) != SUCCESS) { + if (storage.Read(&textureInfoOffset, sizeof(LegoU32)) != SUCCESS) { goto done; } if (storage.SetPosition(textureInfoOffset) != SUCCESS) { goto done; } - if (storage.Read(&numTextures, sizeof(numTextures)) != SUCCESS) { + if (storage.Read(&numTextures, sizeof(LegoU32)) != SUCCESS) { goto done; } for (i = 0; i < numTextures; i++) { LegoU32 textureNameLength; - storage.Read(&textureNameLength, sizeof(textureNameLength)); + storage.Read(&textureNameLength, sizeof(LegoU32)); textureName = new LegoChar[textureNameLength + 1]; storage.Read(textureName, textureNameLength); textureName[textureNameLength] = '\0'; @@ -145,12 +145,12 @@ MxResult LegoPartPresenter::Read(MxDSChunk& p_chunk) m_parts = new LegoNamedPartList(); - if (storage.Read(&numROIs, sizeof(numROIs)) != SUCCESS) { + if (storage.Read(&numROIs, sizeof(LegoU32)) != SUCCESS) { goto done; } for (i = 0; i < numROIs; i++) { - if (storage.Read(&roiNameLength, sizeof(roiNameLength)) != SUCCESS) { + if (storage.Read(&roiNameLength, sizeof(LegoU32)) != SUCCESS) { goto done; } @@ -162,10 +162,10 @@ MxResult LegoPartPresenter::Read(MxDSChunk& p_chunk) roiName[roiNameLength] = '\0'; strlwr(roiName); - if (storage.Read(&numLODs, sizeof(numLODs)) != SUCCESS) { + if (storage.Read(&numLODs, sizeof(LegoU32)) != SUCCESS) { goto done; } - if (storage.Read(&roiInfoOffset, sizeof(roiInfoOffset)) != SUCCESS) { + if (storage.Read(&roiInfoOffset, sizeof(LegoU32)) != SUCCESS) { goto done; } @@ -187,7 +187,7 @@ MxResult LegoPartPresenter::Read(MxDSChunk& p_chunk) } if (j == 0) { - if (surplusLODs != 0 && lod->GetUnknown0x08Test8()) { + if (surplusLODs != 0 && lod->IsExtraLOD()) { numLODs++; surplusLODs--; } diff --git a/LEGO1/lego/legoomni/src/video/legophonemepresenter.cpp b/LEGO1/lego/legoomni/src/video/legophonemepresenter.cpp index 824a4ce2..3e931ce6 100644 --- a/LEGO1/lego/legoomni/src/video/legophonemepresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legophonemepresenter.cpp @@ -56,7 +56,7 @@ void LegoPhonemePresenter::StartingTickle() } head = entityROI->FindChildROI("head", entityROI); - head->GetTexture(m_textureInfo); + head->GetTextureInfo(m_textureInfo); LegoPhonemeList* phonemeList = VideoManager()->GetPhonemeList(); LegoPhoneme* phoneme = new LegoPhoneme(m_roiName.GetData(), 1); @@ -66,10 +66,10 @@ void LegoPhonemePresenter::StartingTickle() if (!cursor.Find(phoneme)) { LegoTextureInfo* textureInfo = TextureContainer()->GetCached(m_textureInfo); - CharacterManager()->FUN_100849a0(entityROI, textureInfo); + CharacterManager()->SetHeadTexture(entityROI, textureInfo); - phoneme->VTable0x0c(m_textureInfo); - phoneme->VTable0x14(textureInfo); + phoneme->SetTextureInfo(m_textureInfo); + phoneme->SetCachedTextureInfo(textureInfo); phonemeList->Append(phoneme); m_textureInfo = textureInfo; } @@ -78,7 +78,7 @@ void LegoPhonemePresenter::StartingTickle() cursor.Current(phoneme); delete newPhoneme; - phoneme->VTable0x04(phoneme->VTable0x00() + 1); + phoneme->SetCount(phoneme->GetCount() + 1); cursor.SetValue(phoneme); m_unk0x70 = TRUE; @@ -114,7 +114,7 @@ void LegoPhonemePresenter::LoadFrame(MxStreamChunk* p_chunk) void LegoPhonemePresenter::PutFrame() { if (m_textureInfo != NULL && m_rectCount != 0) { - m_textureInfo->FUN_10066010(m_frameBitmap->GetImage()); + m_textureInfo->LoadBits(m_frameBitmap->GetImage()); m_rectCount = 0; } } @@ -136,7 +136,7 @@ void LegoPhonemePresenter::EndAction() cursor.Current(phoneme); delete newPhoneme; - if (phoneme->VTable0x00() == 1) { + if (phoneme->GetCount() == 1) { LegoROI* roi; if (m_unk0x84) { @@ -147,19 +147,19 @@ void LegoPhonemePresenter::EndAction() } if (roi != NULL) { - CharacterManager()->FUN_100849a0(roi, NULL); + CharacterManager()->SetHeadTexture(roi, NULL); } if (!m_unk0x84) { CharacterManager()->ReleaseActor(m_roiName.GetData()); } - TextureContainer()->EraseCached(phoneme->VTable0x10()); - TextureContainer()->EraseCached(phoneme->VTable0x08()); + TextureContainer()->EraseCached(phoneme->GetCachedTextureInfo()); + TextureContainer()->EraseCached(phoneme->GetTextureInfo()); cursor.Destroy(); } else { - phoneme->VTable0x04(phoneme->VTable0x00() - 1); + phoneme->SetCount(phoneme->GetCount() - 1); cursor.SetValue(phoneme); } diff --git a/LEGO1/lego/legoomni/src/video/legotexturepresenter.cpp b/LEGO1/lego/legoomni/src/video/legotexturepresenter.cpp index 0c76b447..8b6950ac 100644 --- a/LEGO1/lego/legoomni/src/video/legotexturepresenter.cpp +++ b/LEGO1/lego/legoomni/src/video/legotexturepresenter.cpp @@ -38,7 +38,7 @@ MxResult LegoTexturePresenter::Read(MxDSChunk& p_chunk) m_textures = new LegoNamedTextureList(); LegoU32 numTextures, i; - if (storage.Read(&numTextures, sizeof(numTextures)) != SUCCESS) { + if (storage.Read(&numTextures, sizeof(LegoU32)) != SUCCESS) { goto done; } @@ -47,7 +47,7 @@ MxResult LegoTexturePresenter::Read(MxDSChunk& p_chunk) LegoTexture* texture; LegoNamedTexture* namedTexture; - if (storage.Read(&textureNameLength, sizeof(textureNameLength)) != SUCCESS) { + if (storage.Read(&textureNameLength, sizeof(LegoU32)) != SUCCESS) { goto done; } @@ -104,7 +104,7 @@ MxResult LegoTexturePresenter::Store() } } else { - textureInfo->FUN_10066010(texture->GetImage()->GetBits()); + textureInfo->LoadBits(texture->GetImage()->GetBits()); } } diff --git a/LEGO1/lego/legoomni/src/video/legovideomanager.cpp b/LEGO1/lego/legoomni/src/video/legovideomanager.cpp index 3d7f75a0..2039d381 100644 --- a/LEGO1/lego/legoomni/src/video/legovideomanager.cpp +++ b/LEGO1/lego/legoomni/src/video/legovideomanager.cpp @@ -119,20 +119,20 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM if (deviceNum < 0) { deviceEnumerate.FUN_1009d210(); - deviceNum = deviceEnumerate.FUN_1009d0d0(); + deviceNum = deviceEnumerate.GetBestDevice(); deviceNum = deviceEnumerate.GetDevice(deviceNum, driver, device); } m_direct3d->SetDevice(deviceEnumerate, driver, device); if (!driver->m_ddCaps.dwCaps2 && driver->m_ddCaps.dwSVBRops[7] != 2) { - p_videoParam.Flags().SetF2bit0(TRUE); + p_videoParam.Flags().SetLacksLightSupport(TRUE); } else { - p_videoParam.Flags().SetF2bit0(FALSE); + p_videoParam.Flags().SetLacksLightSupport(FALSE); } - ViewROI::SetUnk101013d8(p_videoParam.Flags().GetF2bit0() == FALSE); + ViewROI::SetLightSupport(p_videoParam.Flags().GetLacksLightSupport() == FALSE); if (!m_direct3d->Create( hwnd, @@ -200,7 +200,7 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM pLODList->Release(); CalcLocalTransform(posVec, dirVec, upVec, outMatrix); - m_viewROI->WrappedSetLocalTransform(outMatrix); + m_viewROI->WrappedSetLocal2WorldWithWorldDataUpdate(outMatrix); m_3dManager->Add(*m_viewROI); m_3dManager->SetPointOfView(*m_viewROI); @@ -398,7 +398,7 @@ void LegoVideoManager::DrawFPS() char zeros[8] = "0000.00"; if (m_unk0x528 == NULL) { - m_arialFont = CreateFontA( + m_arialFont = CreateFont( 12, 0, 0, @@ -417,7 +417,7 @@ void LegoVideoManager::DrawFPS() HDC dc = GetDC(NULL); SelectObject(dc, m_arialFont); - GetTextExtentPointA(dc, zeros, strlen(zeros), &m_fpsSize); + GetTextExtentPoint(dc, zeros, strlen(zeros), &m_fpsSize); ReleaseDC(NULL, dc); m_unk0x528 = m_displaySurface->FUN_100bc8b0(m_fpsSize.cx, m_fpsSize.cy); @@ -493,11 +493,11 @@ void LegoVideoManager::DrawFPS() SetTextColor(dc, RGB(255, 255, 0)); SetBkColor(dc, RGB(0, 0, 0)); SetBkMode(dc, OPAQUE); - GetTextExtentPoint32A(dc, buffer, nb, &m_fpsSize); + GetTextExtentPoint32(dc, buffer, nb, &m_fpsSize); RECT rect; SetRect(&rect, 0, 0, m_fpsSize.cx, m_fpsSize.cy); - ExtTextOutA(dc, 0, 0, ETO_OPAQUE, &rect, buffer, nb, NULL); + ExtTextOut(dc, 0, 0, ETO_OPAQUE, &rect, buffer, nb, NULL); m_unk0x528->ReleaseDC(dc); m_unk0x550 = 1.f; } @@ -639,7 +639,7 @@ void LegoVideoManager::SetSkyColor(float p_red, float p_green, float p_blue) colorStrucure.peRed = (p_red * 255.0f); colorStrucure.peGreen = (p_green * 255.0f); colorStrucure.peBlue = (p_blue * 255.0f); - colorStrucure.peFlags = -124; + colorStrucure.peFlags = D3DPAL_RESERVED | PC_NOCOLLAPSE; m_videoParam.GetPalette()->SetSkyColor(&colorStrucure); m_videoParam.GetPalette()->SetOverrideSkyColor(TRUE); m_3dManager->GetLego3DView()->GetView()->SetBackgroundColor(p_red, p_green, p_blue); diff --git a/LEGO1/lego/legoomni/src/worlds/act3.cpp b/LEGO1/lego/legoomni/src/worlds/act3.cpp index daee3b2d..10bf69cf 100644 --- a/LEGO1/lego/legoomni/src/worlds/act3.cpp +++ b/LEGO1/lego/legoomni/src/worlds/act3.cpp @@ -31,7 +31,7 @@ DECOMP_SIZE_ASSERT(Act3ListElement, 0x0c) DECOMP_SIZE_ASSERT(Act3List, 0x10) // GLOBAL: LEGO1 0x100d94f8 -Act3Script::Script g_unk0x100d94f8[] = { +Act3Script::Script g_pizzaHitSounds[] = { Act3Script::c_sns02xni_PlayWav, Act3Script::c_sns03xni_PlayWav, Act3Script::c_sns04xni_PlayWav, @@ -51,7 +51,7 @@ Act3Script::Script g_unk0x100d94f8[] = { }; // GLOBAL: LEGO1 0x100d9538 -Act3Script::Script g_unk0x100d9538[] = { +Act3Script::Script g_pizzaMissSounds[] = { Act3Script::c_sns19xni_PlayWav, Act3Script::c_sns20xni_PlayWav, Act3Script::c_sns22xni_PlayWav, @@ -61,7 +61,7 @@ Act3Script::Script g_unk0x100d9538[] = { }; // GLOBAL: LEGO1 0x100d9550 -Act3Script::Script g_unk0x100d9550[] = { +Act3Script::Script g_copDonutSounds[] = { Act3Script::c_sns25xni_PlayWav, Act3Script::c_sns26xni_PlayWav, Act3Script::c_sns27xni_PlayWav, @@ -73,7 +73,7 @@ Act3Script::Script g_unk0x100d9550[] = { }; // GLOBAL: LEGO1 0x100d9570 -Act3Script::Script g_unk0x100d9570[] = { +Act3Script::Script g_donutMissSounds[] = { Act3Script::c_sns30xni_PlayWav, Act3Script::c_sns31xni_PlayWav, Act3Script::c_sns32xni_PlayWav, @@ -83,7 +83,7 @@ Act3Script::Script g_unk0x100d9570[] = { }; // GLOBAL: LEGO1 0x100d9588 -Act3Script::Script g_unk0x100d9588[] = { +Act3Script::Script g_islanderSounds[] = { Act3Script::c_sns43xma_PlayWav, Act3Script::c_sns46xin_PlayWav, Act3Script::c_sns60xna_PlayWav, Act3Script::c_sns52xro_PlayWav, Act3Script::c_sns58xna_PlayWav, Act3Script::c_sns68xbu_PlayWav, Act3Script::c_sns59xna_PlayWav, Act3Script::c_sns51xin_PlayWav, Act3Script::c_sns61xva_PlayWav, @@ -94,7 +94,7 @@ Act3Script::Script g_unk0x100d9588[] = { }; // GLOBAL: LEGO1 0x100d95d8 -Act3Script::Script g_unk0x100d95d8[] = { +Act3Script::Script g_bricksterDonutSounds[] = { Act3Script::c_tns080br_PlayWav, Act3Script::c_tnsx07br_PlayWav, Act3Script::c_snsxx2br_PlayWav, @@ -403,58 +403,58 @@ MxResult Act3::ShootDonut(LegoPathController* p_controller, Vector3& p_location, // FUNCTION: LEGO1 0x10072ad0 // FUNCTION: BETA10 0x10015eec -void Act3::FUN_10072ad0(undefined4 p_param1) +void Act3::TriggerHitSound(undefined4 p_param1) { float time = Timer()->GetTime(); Act3Script::Script objectId; switch (p_param1) { case 1: { - if (m_unk0x4218 >= sizeOfArray(g_unk0x100d94f8)) { - m_unk0x4218 = 0; + if (m_pizzaHitSound >= sizeOfArray(g_pizzaHitSounds)) { + m_pizzaHitSound = 0; } - objectId = g_unk0x100d94f8[m_unk0x4218++]; + objectId = g_pizzaHitSounds[m_pizzaHitSound++]; break; } case 2: { - if (m_unk0x4219 >= sizeOfArray(g_unk0x100d9538) - 1) { - m_unk0x4219 = 0; + if (m_pizzaMissSound >= sizeOfArray(g_pizzaMissSounds) - 1) { + m_pizzaMissSound = 0; } - objectId = g_unk0x100d9538[m_unk0x4219++]; + objectId = g_pizzaMissSounds[m_pizzaMissSound++]; break; } case 3: { - if (m_unk0x421a >= sizeOfArray(g_unk0x100d9550)) { - m_unk0x421a = 0; + if (m_copDonutSound >= sizeOfArray(g_copDonutSounds)) { + m_copDonutSound = 0; } - objectId = g_unk0x100d9550[m_unk0x421a++]; + objectId = g_copDonutSounds[m_copDonutSound++]; break; } case 4: { - if (m_unk0x421b >= sizeOfArray(g_unk0x100d9570)) { - m_unk0x421b = 0; + if (m_donutMissSound >= sizeOfArray(g_donutMissSounds)) { + m_donutMissSound = 0; } - objectId = g_unk0x100d9570[m_unk0x421b++]; + objectId = g_donutMissSounds[m_donutMissSound++]; break; } case 5: { - if (m_unk0x421c >= sizeOfArray(g_unk0x100d9588)) { - m_unk0x421c = 0; + if (m_islanderSound >= sizeOfArray(g_islanderSounds)) { + m_islanderSound = 0; } - objectId = g_unk0x100d9588[m_unk0x421c++]; + objectId = g_islanderSounds[m_islanderSound++]; break; } case 6: { - if (m_unk0x421d >= sizeOfArray(g_unk0x100d95d8)) { - m_unk0x421d = 0; + if (m_bricksterDonutSound >= sizeOfArray(g_bricksterDonutSounds)) { + m_bricksterDonutSound = 0; } - m_unk0x4220.Insert(g_unk0x100d95d8[m_unk0x421d++], 1); + m_unk0x4220.Insert(g_bricksterDonutSounds[m_bricksterDonutSound++], 1); return; } default: @@ -488,7 +488,7 @@ MxResult Act3::Create(MxDSAction& p_dsAction) case LegoGameState::e_act1: case LegoGameState::e_actNotFound: GameState()->StopArea(LegoGameState::e_undefined); - if (GameState()->GetPreviousArea() == LegoGameState::e_infomain) { + if (GameState()->m_previousArea == LegoGameState::e_infomain) { GameState()->StopArea(LegoGameState::e_isle); } } @@ -505,7 +505,7 @@ MxResult Act3::Create(MxDSAction& p_dsAction) GameState()->m_currentArea = LegoGameState::e_act3script; GameState()->SetCurrentAct(LegoGameState::e_act3); - GameState()->SetDirty(TRUE); + GameState()->m_isDirty = TRUE; } return result; @@ -575,20 +575,19 @@ MxLong Act3::Notify(MxParam& p_param) m_cop2->VTable0xa8(); m_brickster->VTable0xa8(); - - m_unk0x4218 = 0; - m_unk0x4219 = 0; - m_unk0x421a = 0; - m_unk0x421b = 0; - m_unk0x421c = 0; - m_unk0x421d = 0; + m_pizzaHitSound = 0; + m_pizzaMissSound = 0; + m_copDonutSound = 0; + m_donutMissSound = 0; + m_islanderSound = 0; + m_bricksterDonutSound = 0; MxS32 length; LegoBuildingInfo* info = BuildingManager()->GetInfoArray(length); m_unk0x421e = 0; while (--length >= 0) { - if (info[length].m_unk0x11 < 0 && info[length].m_boundary != NULL && + if (info[length].m_counter < 0 && info[length].m_boundary != NULL && info[length].m_entity != NULL) { m_unk0x421e++; } @@ -664,8 +663,8 @@ MxLong Act3::HandleTransitionEnd() // FUNCTION: LEGO1 0x10073270 void Act3::ReadyWorld() { - PlantManager()->FUN_10027200(); - BuildingManager()->FUN_10030800(); + PlantManager()->SetInitialCounters(); + BuildingManager()->SetInitialCounters(); AnimationManager()->FUN_1005f6d0(FALSE); VideoManager()->Get3DManager()->SetFrustrum(90.0f, 0.1f, 125.0f); @@ -701,7 +700,7 @@ MxResult Act3::FUN_10073360(Act3Ammo& p_ammo, const Vector3& p_param2) { assert(m_brickster); m_brickster->FUN_100417a0(p_ammo, p_param2); - FUN_10072ad0(1); + TriggerHitSound(1); return SUCCESS; } @@ -718,7 +717,7 @@ MxResult Act3::FUN_10073390(Act3Ammo& p_ammo, const Vector3& p_param2) m_cop2->FUN_10040350(p_ammo, p_param2); } - FUN_10072ad0(3); + TriggerHitSound(3); g_unk0x100f7814++; return SUCCESS; } @@ -883,7 +882,7 @@ void Act3::Enable(MxBool p_enable) FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); PlayMusic(JukeboxScript::c_Act3Music); - GameState()->SetDirty(TRUE); + GameState()->m_isDirty = TRUE; if (m_time > 0) { MxFloat delta = Timer()->GetTime() - m_time - 100.0f; diff --git a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp index f83ca18c..024683b3 100644 --- a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp +++ b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp @@ -26,7 +26,7 @@ DECOMP_SIZE_ASSERT(GasStation, 0x128) DECOMP_SIZE_ASSERT(GasStationState, 0x24) // GLOBAL: LEGO1 0x100f0160 -undefined4 g_unk0x100f0160 = 3; +MxS32 g_animationSkipCounterGasStation = 3; // GLOBAL: LEGO1 0x100f0164 MxBool g_trackLedEnabled = FALSE; @@ -38,11 +38,11 @@ GasStation::GasStation() m_state = NULL; m_destLocation = LegoGameState::e_undefined; m_trackLedBitmap = NULL; - m_unk0x104 = 0; - m_unk0x114 = FALSE; - m_unk0x106 = 0; - m_unk0x10c = 0; - m_unk0x115 = FALSE; + m_waitingState = e_finished; + m_waiting = FALSE; + m_setWithCurrentAction = 0; + m_lastIdleAnimation = 0; + m_flashingLeds = FALSE; m_trackLedTimer = 0; NotificationManager()->Register(this); @@ -59,7 +59,7 @@ GasStation::~GasStation() ControlManager()->Unregister(this); TickleManager()->UnregisterClient(this); NotificationManager()->Unregister(this); - g_unk0x100f0160 = 3; + g_animationSkipCounterGasStation = 3; } // FUNCTION: LEGO1 0x10004990 @@ -77,13 +77,13 @@ MxResult GasStation::Create(MxDSAction& p_dsAction) m_state = (GasStationState*) GameState()->GetState("GasStationState"); if (!m_state) { m_state = (GasStationState*) GameState()->CreateState("GasStationState"); - m_state->m_unk0x14 = 1; + m_state->m_state = GasStationState::e_newState; } - else if (m_state->m_unk0x14 == 4) { - m_state->m_unk0x14 = 4; + else if (m_state->m_state == GasStationState::e_unknown4) { + m_state->m_state = GasStationState::e_unknown4; } else { - m_state->m_unk0x14 = 3; + m_state->m_state = GasStationState::e_unknown3; } GameState()->m_currentArea = LegoGameState::e_garage; @@ -139,25 +139,25 @@ void GasStation::ReadyWorld() case LegoActor::c_pepper: switch (m_state->m_pepperAction) { case 0: - m_state->m_unk0x14 = 5; + m_state->m_state = GasStationState::e_introduction; PlayAction(GarageScript::c_wgs002nu_RunAnim); - m_unk0x106 = 1; + m_setWithCurrentAction = 1; break; case 1: - m_state->m_unk0x14 = 5; + m_state->m_state = GasStationState::e_introduction; PlayAction(GarageScript::c_wgs003nu_RunAnim); - m_unk0x106 = 1; + m_setWithCurrentAction = 1; break; case 2: - m_state->m_unk0x14 = 5; + m_state->m_state = GasStationState::e_introduction; PlayAction(GarageScript::c_wgs004nu_RunAnim); - m_unk0x106 = 1; + m_setWithCurrentAction = 1; break; default: - m_state->m_unk0x14 = 6; + m_state->m_state = GasStationState::e_explainQuest; PlayAction(GarageScript::c_wgs008nu_RunAnim); - m_unk0x106 = 1; - m_unk0x104 = 1; + m_setWithCurrentAction = 1; + m_waitingState = e_start; break; } @@ -168,20 +168,20 @@ void GasStation::ReadyWorld() case LegoActor::c_mama: switch (m_state->m_mamaAction) { case 0: - m_state->m_unk0x14 = 5; + m_state->m_state = GasStationState::e_introduction; PlayAction(GarageScript::c_wgs006nu_RunAnim); - m_unk0x106 = 1; + m_setWithCurrentAction = 1; break; case 1: - m_state->m_unk0x14 = 5; + m_state->m_state = GasStationState::e_introduction; PlayAction(GarageScript::c_wgs007nu_RunAnim); - m_unk0x106 = 1; + m_setWithCurrentAction = 1; break; default: - m_state->m_unk0x14 = 6; + m_state->m_state = GasStationState::e_explainQuest; PlayAction(GarageScript::c_wgs008nu_RunAnim); - m_unk0x106 = 1; - m_unk0x104 = 1; + m_setWithCurrentAction = 1; + m_waitingState = e_start; break; } @@ -192,20 +192,20 @@ void GasStation::ReadyWorld() case LegoActor::c_nick: switch (m_state->m_nickAction) { case 0: - m_state->m_unk0x14 = 5; + m_state->m_state = GasStationState::e_introduction; PlayAction(GarageScript::c_wgs009nu_RunAnim); - m_unk0x106 = 1; + m_setWithCurrentAction = 1; break; case 1: - m_state->m_unk0x14 = 5; + m_state->m_state = GasStationState::e_introduction; PlayAction(GarageScript::c_wgs010nu_RunAnim); - m_unk0x106 = 1; + m_setWithCurrentAction = 1; break; default: - m_state->m_unk0x14 = 6; + m_state->m_state = GasStationState::e_explainQuest; PlayAction(GarageScript::c_wgs008nu_RunAnim); - m_unk0x106 = 1; - m_unk0x104 = 1; + m_setWithCurrentAction = 1; + m_waitingState = e_start; break; } @@ -216,20 +216,20 @@ void GasStation::ReadyWorld() case LegoActor::c_papa: switch (m_state->m_papaAction) { case 0: - m_state->m_unk0x14 = 5; + m_state->m_state = GasStationState::e_introduction; PlayAction(GarageScript::c_wgs012nu_RunAnim); - m_unk0x106 = 1; + m_setWithCurrentAction = 1; break; case 1: - m_state->m_unk0x14 = 5; + m_state->m_state = GasStationState::e_introduction; PlayAction(GarageScript::c_wgs014nu_RunAnim); - m_unk0x106 = 1; + m_setWithCurrentAction = 1; break; default: - m_state->m_unk0x14 = 6; + m_state->m_state = GasStationState::e_explainQuest; PlayAction(GarageScript::c_wgs017nu_RunAnim); - m_unk0x106 = 1; - m_unk0x104 = 1; + m_setWithCurrentAction = 1; + m_waitingState = e_start; break; } @@ -240,20 +240,20 @@ void GasStation::ReadyWorld() case LegoActor::c_laura: switch (m_state->m_lauraAction) { case 0: - m_state->m_unk0x14 = 5; + m_state->m_state = GasStationState::e_introduction; PlayAction(GarageScript::c_wgs020nu_RunAnim); - m_unk0x106 = 1; + m_setWithCurrentAction = 1; break; case 1: - m_state->m_unk0x14 = 5; + m_state->m_state = GasStationState::e_introduction; PlayAction(GarageScript::c_wgs021nu_RunAnim); - m_unk0x106 = 1; + m_setWithCurrentAction = 1; break; default: - m_state->m_unk0x14 = 6; + m_state->m_state = GasStationState::e_explainQuest; PlayAction(GarageScript::c_wgs022nu_RunAnim); - m_unk0x106 = 1; - m_unk0x104 = 1; + m_setWithCurrentAction = 1; + m_waitingState = e_start; break; } @@ -301,35 +301,35 @@ MxLong GasStation::HandleEndAction(MxEndActionNotificationParam& p_param) if (action->GetAtomId() == m_atomId && action->GetObjectId()) { m_state->StopAction((GarageScript::Script) action->GetObjectId()); - m_unk0x106 = 0; + m_setWithCurrentAction = 0; - switch (m_state->m_unk0x14) { - case 5: - g_unk0x100f0160 = 0; - m_state->m_unk0x14 = 6; - m_unk0x115 = TRUE; + switch (m_state->m_state) { + case GasStationState::e_introduction: + g_animationSkipCounterGasStation = 0; + m_state->m_state = GasStationState::e_explainQuest; + m_flashingLeds = TRUE; PlayAction(GarageScript::c_wgs023nu_RunAnim); - m_unk0x106 = 1; - m_unk0x104 = 1; + m_setWithCurrentAction = 1; + m_waitingState = e_start; break; - case 6: - g_unk0x100f0160 = 0; - m_unk0x115 = TRUE; + case GasStationState::e_explainQuest: + g_animationSkipCounterGasStation = 0; + m_flashingLeds = TRUE; - if (m_unk0x104 == 3) { - m_state->m_unk0x14 = 8; + if (m_waitingState == e_canceled) { + m_state->m_state = GasStationState::e_afterAcceptingQuest; PlayAction(GarageScript::c_wgs029nu_RunAnim); - m_unk0x106 = 1; + m_setWithCurrentAction = 1; } else { - m_state->m_unk0x14 = 7; - m_unk0x114 = TRUE; + m_state->m_state = GasStationState::e_waitAcceptingQuest; + m_waiting = TRUE; } break; - case 8: - m_state->m_unk0x14 = 2; + case GasStationState::e_afterAcceptingQuest: + m_state->m_state = GasStationState::e_beforeExitingForQuest; ((Act1State*) GameState()->GetState("Act1State"))->m_unk0x018 = 7; - m_destLocation = LegoGameState::e_unk28; + m_destLocation = LegoGameState::e_garageExited; m_radio.Stop(); BackgroundAudioManager()->Stop(); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); @@ -346,7 +346,7 @@ MxLong GasStation::HandleEndAction(MxEndActionNotificationParam& p_param) // FUNCTION: LEGO1 0x10005920 MxLong GasStation::HandleKeyPress(MxS8 p_key) { - if (p_key == VK_SPACE && g_unk0x100f0160 == 0 && m_unk0x106 != 0) { + if (p_key == VK_SPACE && g_animationSkipCounterGasStation == 0 && m_setWithCurrentAction != 0) { m_state->StopActions(); return 1; } @@ -358,18 +358,18 @@ MxLong GasStation::HandleKeyPress(MxS8 p_key) // FUNCTION: BETA10 0x10029319 MxLong GasStation::HandleButtonDown(LegoControlManagerNotificationParam& p_param) { - if (m_unk0x104 == 1 || m_unk0x104 == 2) { + if (m_waitingState == e_start || m_waitingState == e_started) { LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY()); if (roi != NULL) { if (!strnicmp(roi->GetName(), "capdb", 5) || !strnicmp(roi->GetName(), "*capdb", 6)) { - m_unk0x104 = 3; - m_unk0x114 = FALSE; + m_waitingState = e_canceled; + m_waiting = FALSE; - if (m_state->m_unk0x14 == 7) { - m_state->m_unk0x14 = 8; + if (m_state->m_state == GasStationState::e_waitAcceptingQuest) { + m_state->m_state = GasStationState::e_afterAcceptingQuest; PlayAction(GarageScript::c_wgs029nu_RunAnim); - m_unk0x106 = 1; + m_setWithCurrentAction = 1; } else { StopAction(GarageScript::c_wgs023nu_RunAnim); @@ -393,7 +393,7 @@ MxLong GasStation::HandleControl(LegoControlManagerNotificationParam& p_param) switch (p_param.m_clickedObjectId) { case GarageScript::c_LeftArrow_Ctl: case GarageScript::c_RightArrow_Ctl: - m_state->m_unk0x14 = 0; + m_state->m_state = GasStationState::e_unknown0; m_destLocation = LegoGameState::Area::e_garadoor; m_state->StopActions(); @@ -402,7 +402,7 @@ MxLong GasStation::HandleControl(LegoControlManagerNotificationParam& p_param) TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); break; case GarageScript::c_Info_Ctl: - m_state->m_unk0x14 = 0; + m_state->m_state = GasStationState::e_unknown0; m_destLocation = LegoGameState::Area::e_infomain; m_state->StopActions(); @@ -411,7 +411,7 @@ MxLong GasStation::HandleControl(LegoControlManagerNotificationParam& p_param) TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); break; case GarageScript::c_Buggy_Ctl: - m_state->m_unk0x14 = 0; + m_state->m_state = GasStationState::e_unknown0; m_destLocation = LegoGameState::Area::e_dunecarbuild; m_state->StopActions(); @@ -451,29 +451,29 @@ MxResult GasStation::Tickle() return SUCCESS; } - if (g_unk0x100f0160 != 0) { - g_unk0x100f0160--; + if (g_animationSkipCounterGasStation != 0) { + g_animationSkipCounterGasStation--; } MxLong time = Timer()->GetTime(); - if (m_unk0x114) { - if (time - m_unk0x10c > 15000) { - m_unk0x10c = time; - if (m_unk0x104 == 1) { - m_unk0x104 = 2; + if (m_waiting) { + if (time - m_lastIdleAnimation > 15000) { + m_lastIdleAnimation = time; + if (m_waitingState == e_start) { + m_waitingState = e_started; } - else if (m_unk0x104 != 0) { - m_unk0x104 = 0; + else if (m_waitingState != e_finished) { + m_waitingState = e_finished; MxDSAction action; - m_state->m_unk0x14 = 9; + m_state->m_state = GasStationState::e_cancelQuest; PlayAction(GarageScript::c_wgs031nu_RunAnim); - m_unk0x106 = 1; + m_setWithCurrentAction = 1; } } } - if (m_unk0x115) { + if (m_flashingLeds) { if (time - m_trackLedTimer > 300) { m_trackLedTimer = time; g_trackLedEnabled = !g_trackLedEnabled; @@ -489,7 +489,7 @@ MxBool GasStation::Escape() { m_radio.Stop(); m_state->StopActions(); - m_state->m_unk0x14 = 0; + m_state->m_state = GasStationState::e_unknown0; m_destLocation = LegoGameState::Area::e_infomain; return TRUE; } diff --git a/LEGO1/lego/legoomni/src/worlds/hospital.cpp b/LEGO1/lego/legoomni/src/worlds/hospital.cpp index c393d117..dbb1c00c 100644 --- a/LEGO1/lego/legoomni/src/worlds/hospital.cpp +++ b/LEGO1/lego/legoomni/src/worlds/hospital.cpp @@ -24,7 +24,7 @@ DECOMP_SIZE_ASSERT(Hospital, 0x12c) DECOMP_SIZE_ASSERT(HospitalState, 0x18) // GLOBAL: LEGO1 0x100f7918 -undefined4 g_unk0x100f7918 = 3; +undefined4 g_animationSkipCounterHospital = 3; // GLOBAL: LEGO1 0x100f791c MxBool g_copLedEnabled = FALSE; @@ -36,17 +36,17 @@ MxBool g_pizzaLedEnabled = FALSE; Hospital::Hospital() { m_currentActorId = LegoActor::c_none; - m_unk0x100 = 0; + m_interactionMode = 0; m_hospitalState = NULL; - m_unk0x108 = 0; + m_setWithCurrentAction = 0; m_destLocation = LegoGameState::e_undefined; m_currentAction = HospitalScript::c__StartUp; m_copLedBitmap = NULL; m_pizzaLedBitmap = NULL; - m_unk0x118 = 0; + m_flashingLeds = 0; m_copLedAnimTimer = 0; m_pizzaLedAnimTimer = 0; - m_unk0x128 = 0; + m_exited = FALSE; NotificationManager()->Register(this); } @@ -61,10 +61,10 @@ Hospital::~Hospital() ControlManager()->Unregister(this); TickleManager()->UnregisterClient(this); - m_hospitalState->m_unk0x08 = 3; + m_hospitalState->m_state = HospitalState::e_unknown3; NotificationManager()->Unregister(this); - g_unk0x100f7918 = 3; + g_animationSkipCounterHospital = 3; } // FUNCTION: LEGO1 0x100748c0 @@ -81,13 +81,13 @@ MxResult Hospital::Create(MxDSAction& p_dsAction) m_hospitalState = (HospitalState*) GameState()->GetState("HospitalState"); if (!m_hospitalState) { m_hospitalState = (HospitalState*) GameState()->CreateState("HospitalState"); - m_hospitalState->m_unk0x08 = 1; + m_hospitalState->m_state = HospitalState::e_newState; } - else if (m_hospitalState->m_unk0x08 == 4) { - m_hospitalState->m_unk0x08 = 4; + else if (m_hospitalState->m_state == HospitalState::e_unknown4) { + m_hospitalState->m_state = HospitalState::e_unknown4; } else { - m_hospitalState->m_unk0x08 = 3; + m_hospitalState->m_state = HospitalState::e_unknown3; } GameState()->m_currentArea = LegoGameState::e_hospital; @@ -149,71 +149,71 @@ void Hospital::ReadyWorld() switch (m_currentActorId) { case LegoActor::c_pepper: - m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x0e; + m_hospitalState->m_stateActor = m_hospitalState->m_statePepper; - if (m_hospitalState->m_unk0x0e < 5) { - m_hospitalState->m_unk0x0e += 1; + if (m_hospitalState->m_statePepper < 5) { + m_hospitalState->m_statePepper += 1; } break; case LegoActor::c_mama: - m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x10; + m_hospitalState->m_stateActor = m_hospitalState->m_stateMama; - if (m_hospitalState->m_unk0x10 < 5) { - m_hospitalState->m_unk0x10 += 1; + if (m_hospitalState->m_stateMama < 5) { + m_hospitalState->m_stateMama += 1; } break; case LegoActor::c_papa: - m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x12; + m_hospitalState->m_stateActor = m_hospitalState->m_statePapa; - if (m_hospitalState->m_unk0x12 < 5) { - m_hospitalState->m_unk0x12 += 1; + if (m_hospitalState->m_statePapa < 5) { + m_hospitalState->m_statePapa += 1; } break; case LegoActor::c_nick: - m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x14; + m_hospitalState->m_stateActor = m_hospitalState->m_stateNick; - if (m_hospitalState->m_unk0x14 < 5) { - m_hospitalState->m_unk0x14 += 1; + if (m_hospitalState->m_stateNick < 5) { + m_hospitalState->m_stateNick += 1; } break; case LegoActor::c_laura: - m_hospitalState->m_unk0x0c = m_hospitalState->m_unk0x16; + m_hospitalState->m_stateActor = m_hospitalState->m_stateLaura; - if (m_hospitalState->m_unk0x16 < 5) { - m_hospitalState->m_unk0x16 += 1; + if (m_hospitalState->m_stateLaura < 5) { + m_hospitalState->m_stateLaura += 1; } break; } - if (m_hospitalState->m_unk0x0c < 3) { + if (m_hospitalState->m_stateActor < 3) { HospitalScript::Script hospitalScript[] = { HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho004jk_RunAnim, HospitalScript::c_hho007p1_RunAnim }; - m_hospitalState->m_unk0x08 = 5; + m_hospitalState->m_state = HospitalState::e_introduction; - PlayAction(hospitalScript[m_hospitalState->m_unk0x0c]); - m_currentAction = hospitalScript[m_hospitalState->m_unk0x0c]; + PlayAction(hospitalScript[m_hospitalState->m_stateActor]); + m_currentAction = hospitalScript[m_hospitalState->m_stateActor]; + m_setWithCurrentAction = 1; } else { - m_unk0x100 = 1; + m_interactionMode = 1; m_time = Timer()->GetTime(); - m_hospitalState->m_unk0x08 = 6; + m_hospitalState->m_state = HospitalState::e_explainQuestShort; PlayAction(HospitalScript::c_hho003cl_RunAnim); m_currentAction = HospitalScript::c_hho003cl_RunAnim; + m_setWithCurrentAction = 1; } - m_unk0x108 = 1; - FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); } @@ -222,7 +222,7 @@ MxLong Hospital::HandleKeyPress(MxS8 p_key) { MxLong result = 0; - if (p_key == VK_SPACE && g_unk0x100f7918 == 0) { + if (p_key == VK_SPACE && g_animationSkipCounterHospital == 0) { DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim); result = 1; } @@ -241,143 +241,143 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param) return result; } - m_unk0x108 = 0; + m_setWithCurrentAction = 0; - switch (m_hospitalState->m_unk0x08) { - case 5: - m_hospitalState->m_unk0x08 = 7; + switch (m_hospitalState->m_state) { + case HospitalState::e_introduction: + m_hospitalState->m_state = HospitalState::e_explainQuest; PlayAction(HospitalScript::c_hho006cl_RunAnim); m_currentAction = HospitalScript::c_hho006cl_RunAnim; - m_unk0x108 = 1; - m_unk0x118 = 1; - g_unk0x100f7918 = 0; + m_setWithCurrentAction = 1; + m_flashingLeds = 1; + g_animationSkipCounterHospital = 0; break; - case 6: + case HospitalState::e_explainQuestShort: m_time = Timer()->GetTime(); - m_unk0x100 = 1; + m_interactionMode = 1; break; - case 7: - case 10: - m_hospitalState->m_unk0x08 = 8; - m_unk0x100 = 1; + case HospitalState::e_explainQuest: + case HospitalState::e_unknown10: + m_hospitalState->m_state = HospitalState::e_waitAcceptingQuest; + m_interactionMode = 1; m_time = Timer()->GetTime(); break; - case 11: + case HospitalState::e_unknown11: switch (m_currentActorId) { case LegoActor::c_pepper: - switch (m_hospitalState->m_unk0x0e) { + switch (m_hospitalState->m_statePepper) { case 0: case 1: - m_hospitalState->m_unk0x08 = 12; + m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest; PlayAction(HospitalScript::c_hho017cl_RunAnim); m_currentAction = HospitalScript::c_hho017cl_RunAnim; - m_unk0x108 = 1; + m_setWithCurrentAction = 1; break; default: - m_hospitalState->m_unk0x08 = 12; + m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest; PlayAction(HospitalScript::c_hho018cl_RunAnim); m_currentAction = HospitalScript::c_hho018cl_RunAnim; - m_unk0x108 = 1; + m_setWithCurrentAction = 1; break; } break; case LegoActor::c_mama: - switch (m_hospitalState->m_unk0x10) { + switch (m_hospitalState->m_stateMama) { case 0: case 1: - m_hospitalState->m_unk0x08 = 12; + m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest; PlayAction(HospitalScript::c_hho019cl_RunAnim); m_currentAction = HospitalScript::c_hho019cl_RunAnim; - m_unk0x108 = 1; + m_setWithCurrentAction = 1; break; default: - m_hospitalState->m_unk0x08 = 12; + m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest; PlayAction(HospitalScript::c_hho020cl_RunAnim); m_currentAction = HospitalScript::c_hho020cl_RunAnim; - m_unk0x108 = 1; + m_setWithCurrentAction = 1; break; } break; case LegoActor::c_papa: - switch (m_hospitalState->m_unk0x12) { + switch (m_hospitalState->m_statePapa) { case 0: case 1: - m_hospitalState->m_unk0x08 = 12; + m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest; PlayAction(HospitalScript::c_hho023cl_RunAnim); m_currentAction = HospitalScript::c_hho023cl_RunAnim; - m_unk0x108 = 1; + m_setWithCurrentAction = 1; break; default: - m_hospitalState->m_unk0x08 = 12; + m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest; PlayAction(HospitalScript::c_hho024cl_RunAnim); m_currentAction = HospitalScript::c_hho024cl_RunAnim; - m_unk0x108 = 1; + m_setWithCurrentAction = 1; break; } break; case LegoActor::c_nick: - switch (m_hospitalState->m_unk0x14) { + switch (m_hospitalState->m_stateNick) { case 0: case 1: - m_hospitalState->m_unk0x08 = 12; + m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest; PlayAction(HospitalScript::c_hho021cl_RunAnim); m_currentAction = HospitalScript::c_hho021cl_RunAnim; - m_unk0x108 = 1; + m_setWithCurrentAction = 1; break; default: - m_hospitalState->m_unk0x08 = 12; + m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest; PlayAction(HospitalScript::c_hhoa22cl_RunAnim); m_currentAction = HospitalScript::c_hhoa22cl_RunAnim; - m_unk0x108 = 1; + m_setWithCurrentAction = 1; break; } break; case LegoActor::c_laura: - switch (m_hospitalState->m_unk0x16) { + switch (m_hospitalState->m_stateLaura) { case 0: case 1: - m_hospitalState->m_unk0x08 = 12; + m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest; PlayAction(HospitalScript::c_hho025cl_RunAnim); m_currentAction = HospitalScript::c_hho025cl_RunAnim; - m_unk0x108 = 1; + m_setWithCurrentAction = 1; break; default: - m_hospitalState->m_unk0x08 = 12; + m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest; PlayAction(HospitalScript::c_hho026cl_RunAnim); m_currentAction = HospitalScript::c_hho026cl_RunAnim; - m_unk0x108 = 1; + m_setWithCurrentAction = 1; break; } break; } break; - case 12: - m_hospitalState->m_unk0x08 = 9; + case HospitalState::e_afterAcceptingQuest: + m_hospitalState->m_state = HospitalState::e_beforeEnteringAmbulance; act1State = (Act1State*) GameState()->GetState("Act1State"); act1State->SetUnknown18(9); - case 14: - if (m_unk0x128 == 0) { - m_unk0x128 = 1; - m_destLocation = LegoGameState::e_unk31; + case HospitalState::e_exitToFront: + if (m_exited == FALSE) { + m_exited = TRUE; + m_destLocation = LegoGameState::e_hospitalExited; DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); } break; - case 15: - if (m_unk0x128 == 0) { - m_unk0x128 = 1; + case HospitalState::e_exitToInfocenter: + if (m_exited == FALSE) { + m_exited = TRUE; m_destLocation = LegoGameState::e_infomain; DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim); @@ -395,7 +395,7 @@ MxLong Hospital::HandleEndAction(MxEndActionNotificationParam& p_param) // FUNCTION: BETA10 0x1002d2b1 MxLong Hospital::HandleButtonDown(LegoControlManagerNotificationParam& p_param) { - if (m_unk0x100 == 1) { + if (m_interactionMode == 1) { LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY()); if (roi != NULL) { const LegoChar* roiName = roi->GetName(); @@ -407,21 +407,21 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerNotificationParam& p_param) if (!strcmpi("actor_ha", roiName)) { InputManager()->DisableInputProcessing(); - m_unk0x100 = 3; + m_interactionMode = 3; - if (m_hospitalState->m_unk0x08 == 6) { - if (m_unk0x128 == 0) { - m_unk0x128 = 1; + if (m_hospitalState->m_state == HospitalState::e_explainQuestShort) { + if (m_exited == FALSE) { + m_exited = TRUE; TickleManager()->UnregisterClient(this); - m_hospitalState->m_unk0x08 = 9; + m_hospitalState->m_state = HospitalState::e_beforeEnteringAmbulance; Act1State* act1State = (Act1State*) GameState()->GetState("Act1State"); assert(act1State); act1State->m_unk0x018 = 9; - m_destLocation = LegoGameState::e_unk31; + m_destLocation = LegoGameState::e_hospitalExited; DeleteObjects( &m_atomId, HospitalScript::c_hho002cl_RunAnim, @@ -430,9 +430,9 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerNotificationParam& p_param) TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); } } - else if (m_hospitalState->m_unk0x08 == 10 || m_hospitalState->m_unk0x08 == 8) { - if (m_hospitalState->m_unk0x08 == 10) { - m_hospitalState->m_unk0x08 = 11; + else if (m_hospitalState->m_state == HospitalState::e_unknown10 || m_hospitalState->m_state == HospitalState::e_waitAcceptingQuest) { + if (m_hospitalState->m_state == HospitalState::e_unknown10) { + m_hospitalState->m_state = HospitalState::e_unknown11; BackgroundAudioManager()->RaiseVolume(); DeleteObjects( @@ -444,97 +444,97 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerNotificationParam& p_param) else { switch (m_currentActorId) { case LegoActor::c_pepper: - switch (m_hospitalState->m_unk0x0e) { + switch (m_hospitalState->m_statePepper) { case 0: case 1: - m_hospitalState->m_unk0x08 = 12; + m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest; PlayAction(HospitalScript::c_hho017cl_RunAnim); m_currentAction = HospitalScript::c_hho017cl_RunAnim; - m_unk0x108 = 1; + m_setWithCurrentAction = 1; break; default: - m_hospitalState->m_unk0x08 = 12; + m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest; PlayAction(HospitalScript::c_hho018cl_RunAnim); m_currentAction = HospitalScript::c_hho018cl_RunAnim; - m_unk0x108 = 1; + m_setWithCurrentAction = 1; break; } break; case LegoActor::c_mama: - switch (m_hospitalState->m_unk0x10) { + switch (m_hospitalState->m_stateMama) { case 0: case 1: - m_hospitalState->m_unk0x08 = 12; + m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest; PlayAction(HospitalScript::c_hho019cl_RunAnim); m_currentAction = HospitalScript::c_hho019cl_RunAnim; - m_unk0x108 = 1; + m_setWithCurrentAction = 1; break; default: - m_hospitalState->m_unk0x08 = 12; + m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest; PlayAction(HospitalScript::c_hho020cl_RunAnim); m_currentAction = HospitalScript::c_hho020cl_RunAnim; - m_unk0x108 = 1; + m_setWithCurrentAction = 1; break; } break; case LegoActor::c_nick: - switch (m_hospitalState->m_unk0x14) { + switch (m_hospitalState->m_stateNick) { case 0: case 1: - m_hospitalState->m_unk0x08 = 12; + m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest; PlayAction(HospitalScript::c_hho021cl_RunAnim); m_currentAction = HospitalScript::c_hho021cl_RunAnim; - m_unk0x108 = 1; + m_setWithCurrentAction = 1; break; default: - m_hospitalState->m_unk0x08 = 12; + m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest; PlayAction(HospitalScript::c_hhoa22cl_RunAnim); m_currentAction = HospitalScript::c_hhoa22cl_RunAnim; - m_unk0x108 = 1; + m_setWithCurrentAction = 1; break; } break; case LegoActor::c_papa: - switch (m_hospitalState->m_unk0x12) { + switch (m_hospitalState->m_statePapa) { case 0: case 1: - m_hospitalState->m_unk0x08 = 12; + m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest; PlayAction(HospitalScript::c_hho023cl_RunAnim); m_currentAction = HospitalScript::c_hho023cl_RunAnim; - m_unk0x108 = 1; + m_setWithCurrentAction = 1; break; default: - m_hospitalState->m_unk0x08 = 12; + m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest; PlayAction(HospitalScript::c_hho024cl_RunAnim); m_currentAction = HospitalScript::c_hho024cl_RunAnim; - m_unk0x108 = 1; + m_setWithCurrentAction = 1; break; } break; case LegoActor::c_laura: - switch (m_hospitalState->m_unk0x16) { + switch (m_hospitalState->m_stateLaura) { case 0: case 1: - m_hospitalState->m_unk0x08 = 12; + m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest; PlayAction(HospitalScript::c_hho025cl_RunAnim); m_currentAction = HospitalScript::c_hho025cl_RunAnim; - m_unk0x108 = 1; + m_setWithCurrentAction = 1; break; default: - m_hospitalState->m_unk0x08 = 12; + m_hospitalState->m_state = HospitalState::e_afterAcceptingQuest; PlayAction(HospitalScript::c_hho026cl_RunAnim); m_currentAction = HospitalScript::c_hho026cl_RunAnim; - m_unk0x108 = 1; + m_setWithCurrentAction = 1; break; } break; @@ -559,16 +559,16 @@ MxBool Hospital::HandleControl(LegoControlManagerNotificationParam& p_param) BackgroundAudioManager()->RaiseVolume(); DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim); - if (m_unk0x100 == 1) { - m_hospitalState->m_unk0x08 = 14; + if (m_interactionMode == 1) { + m_hospitalState->m_state = HospitalState::e_exitToInfocenter; PlayAction(HospitalScript::c_hho016cl_RunAnim); m_currentAction = HospitalScript::c_hho016cl_RunAnim; - m_unk0x108 = 1; + m_setWithCurrentAction = 1; } - else if (m_unk0x128 == 0) { - m_unk0x128 = 1; - m_hospitalState->m_unk0x08 = 13; + else if (m_exited == FALSE) { + m_exited = TRUE; + m_hospitalState->m_state = HospitalState::e_exitImmediately; m_destLocation = LegoGameState::e_infomain; DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim); @@ -580,17 +580,17 @@ MxBool Hospital::HandleControl(LegoControlManagerNotificationParam& p_param) case HospitalScript::c_Door_Ctl: DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim); - if (m_unk0x100 == 1) { - m_hospitalState->m_unk0x08 = 15; + if (m_interactionMode == 1) { + m_hospitalState->m_state = HospitalState::e_exitToFront; PlayAction(HospitalScript::c_hho016cl_RunAnim); m_currentAction = HospitalScript::c_hho016cl_RunAnim; - m_unk0x108 = 1; + m_setWithCurrentAction = 1; } - else if (m_unk0x128 == 0) { - m_unk0x128 = 1; - m_hospitalState->m_unk0x08 = 13; - m_destLocation = LegoGameState::e_unk31; + else if (m_exited == FALSE) { + m_exited = TRUE; + m_hospitalState->m_state = HospitalState::e_exitImmediately; + m_destLocation = LegoGameState::e_hospitalExited; DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); @@ -637,13 +637,13 @@ MxResult Hospital::Tickle() return SUCCESS; } - if (g_unk0x100f7918 != 0) { - g_unk0x100f7918 -= 1; + if (g_animationSkipCounterHospital != 0) { + g_animationSkipCounterHospital -= 1; } MxLong time = Timer()->GetTime(); - if (m_unk0x118 != 0) { + if (m_flashingLeds != 0) { if (time - m_copLedAnimTimer > 300) { m_copLedAnimTimer = time; g_copLedEnabled = !g_copLedEnabled; @@ -664,7 +664,7 @@ MxResult Hospital::Tickle() MxBool Hospital::Escape() { DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, 999); - m_hospitalState->m_unk0x08 = 0; + m_hospitalState->m_state = HospitalState::e_exitToClose; m_destLocation = LegoGameState::e_infomain; @@ -674,12 +674,12 @@ MxBool Hospital::Escape() // FUNCTION: LEGO1 0x10076370 HospitalState::HospitalState() { - m_unk0x0c = 0; - m_unk0x0e = 0; - m_unk0x10 = 0; - m_unk0x12 = 0; - m_unk0x14 = 0; - m_unk0x16 = 0; + m_stateActor = 0; + m_statePepper = 0; + m_stateMama = 0; + m_statePapa = 0; + m_stateNick = 0; + m_stateLaura = 0; } // FUNCTION: LEGO1 0x10076530 @@ -689,20 +689,20 @@ MxResult HospitalState::Serialize(LegoStorage* p_storage) LegoState::Serialize(p_storage); if (p_storage->IsWriteMode()) { - p_storage->WriteS16(m_unk0x0c); - p_storage->WriteS16(m_unk0x0e); - p_storage->WriteS16(m_unk0x10); - p_storage->WriteS16(m_unk0x12); - p_storage->WriteS16(m_unk0x14); - p_storage->WriteS16(m_unk0x16); + p_storage->WriteS16(m_stateActor); + p_storage->WriteS16(m_statePepper); + p_storage->WriteS16(m_stateMama); + p_storage->WriteS16(m_statePapa); + p_storage->WriteS16(m_stateNick); + p_storage->WriteS16(m_stateLaura); } else if (p_storage->IsReadMode()) { - p_storage->ReadS16(m_unk0x0c); - p_storage->ReadS16(m_unk0x0e); - p_storage->ReadS16(m_unk0x10); - p_storage->ReadS16(m_unk0x12); - p_storage->ReadS16(m_unk0x14); - p_storage->ReadS16(m_unk0x16); + p_storage->ReadS16(m_stateActor); + p_storage->ReadS16(m_statePepper); + p_storage->ReadS16(m_stateMama); + p_storage->ReadS16(m_statePapa); + p_storage->ReadS16(m_stateNick); + p_storage->ReadS16(m_stateLaura); } return SUCCESS; diff --git a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp index 5cc9138c..0a8d5f1c 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenter.cpp @@ -138,14 +138,14 @@ Infocenter::Infocenter() memset(&m_glowInfo, 0, sizeof(m_glowInfo)); - m_unk0x1c8 = -1; + m_enabledGlowControl = -1; SetAppCursor(e_cursorBusy); NotificationManager()->Register(this); m_infoManDialogueTimer = 0; m_bookAnimationTimer = 0; - m_unk0x1d4 = 0; - m_unk0x1d6 = 0; + m_playingMovieCounter = 0; + m_bigInfoBlinkTimer = 0; } // FUNCTION: LEGO1 0x1006ec80 @@ -219,7 +219,7 @@ MxResult Infocenter::Create(MxDSAction& p_dsAction) if (m_infocenterState->m_unk0x74 == 4) { LegoGameState* state = GameState(); - state->SetPreviousArea(GameState()->GetUnknown0x42c()); + state->m_previousArea = GameState()->m_unk0x42c; } InputManager()->Register(this); @@ -296,11 +296,11 @@ MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param) action->GetObjectId() == InfomainScript::c_Pepper_All_Movie || action->GetObjectId() == InfomainScript::c_Nick_All_Movie || action->GetObjectId() == InfomainScript::c_Laura_All_Movie)) { - if (m_unk0x1d4) { - m_unk0x1d4--; + if (m_playingMovieCounter) { + m_playingMovieCounter--; } - if (!m_unk0x1d4) { + if (!m_playingMovieCounter) { PlayMusic(JukeboxScript::c_InformationCenter_Music); GameState()->SetActor(m_selectedCharacter); @@ -335,8 +335,8 @@ MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param) } if (action->GetObjectId() == InfomainScript::c_iicx26in_RunAnim) { - ControlManager()->FUN_100293c0(InfomainScript::c_BigInfo_Ctl, action->GetAtomId().GetInternal(), 0); - m_unk0x1d6 = 0; + ControlManager()->UpdateEnabledChild(InfomainScript::c_BigInfo_Ctl, action->GetAtomId().GetInternal(), 0); + m_bigInfoBlinkTimer = 0; } switch (m_infocenterState->m_unk0x74) { @@ -441,8 +441,8 @@ void Infocenter::ReadyWorld() { m_infoManDialogueTimer = 0; m_bookAnimationTimer = 0; - m_unk0x1d4 = 0; - m_unk0x1d6 = 0; + m_playingMovieCounter = 0; + m_bigInfoBlinkTimer = 0; MxStillPresenter* bg = (MxStillPresenter*) Find("MxStillPresenter", "Background_Bitmap"); MxStillPresenter* bgRed = (MxStillPresenter*) Find("MxStillPresenter", "BackgroundRed_Bitmap"); @@ -474,8 +474,8 @@ void Infocenter::ReadyWorld() InfomainScript::Script script = m_infocenterState->GetNextReturnDialogue(); PlayAction(script); - if (script == InfomainScript::c_iicx26in_RunAnim) { - m_unk0x1d6 = 1; + if (script == InfomainScript::c_iicx26in_RunAnim) { // want to get back? Click on I! + m_bigInfoBlinkTimer = 1; } FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); @@ -631,37 +631,37 @@ void Infocenter::InitializeBitmaps() m_glowInfo[0].m_destCtl = (MxStillPresenter*) Find("MxStillPresenter", "Info_A_Bitmap"); assert(m_glowInfo[0].m_destCtl); m_glowInfo[0].m_area = MxRect(391, 182, 427, 230); - m_glowInfo[0].m_unk0x04 = 3; + m_glowInfo[0].m_target = InfocenterMapEntry::e_infocenter; m_glowInfo[1].m_destCtl = (MxStillPresenter*) Find("MxStillPresenter", "Boat_A_Bitmap"); assert(m_glowInfo[1].m_destCtl); m_glowInfo[1].m_area = MxRect(304, 225, 350, 268); - m_glowInfo[1].m_unk0x04 = 10; + m_glowInfo[1].m_target = InfocenterMapEntry::e_jetrace; m_glowInfo[2].m_destCtl = (MxStillPresenter*) Find("MxStillPresenter", "Race_A_Bitmap"); assert(m_glowInfo[1].m_destCtl); // DECOMP: intentional typo m_glowInfo[2].m_area = MxRect(301, 133, 347, 181); - m_glowInfo[2].m_unk0x04 = 11; + m_glowInfo[2].m_target = InfocenterMapEntry::e_carrace; m_glowInfo[3].m_destCtl = (MxStillPresenter*) Find("MxStillPresenter", "Pizza_A_Bitmap"); assert(m_glowInfo[3].m_destCtl); m_glowInfo[3].m_area = MxRect(289, 182, 335, 225); - m_glowInfo[3].m_unk0x04 = 12; + m_glowInfo[3].m_target = InfocenterMapEntry::e_pizzeria; m_glowInfo[4].m_destCtl = (MxStillPresenter*) Find("MxStillPresenter", "Gas_A_Bitmap"); assert(m_glowInfo[4].m_destCtl); m_glowInfo[4].m_area = MxRect(350, 161, 391, 209); - m_glowInfo[4].m_unk0x04 = 13; + m_glowInfo[4].m_target = InfocenterMapEntry::e_garage; m_glowInfo[5].m_destCtl = (MxStillPresenter*) Find("MxStillPresenter", "Med_A_Bitmap"); assert(m_glowInfo[5].m_destCtl); m_glowInfo[5].m_area = MxRect(392, 130, 438, 176); - m_glowInfo[5].m_unk0x04 = 14; + m_glowInfo[5].m_target = InfocenterMapEntry::e_hospital; m_glowInfo[6].m_destCtl = (MxStillPresenter*) Find("MxStillPresenter", "Cop_A_Bitmap"); assert(m_glowInfo[6].m_destCtl); m_glowInfo[6].m_area = MxRect(396, 229, 442, 272); - m_glowInfo[6].m_unk0x04 = 15; + m_glowInfo[6].m_target = InfocenterMapEntry::e_police; m_frame = (MxStillPresenter*) Find("MxStillPresenter", "FrameHot_Bitmap"); assert(m_frame); @@ -687,7 +687,7 @@ MxU8 Infocenter::HandleMouseMove(MxS32 p_x, MxS32 p_y) m_dragPresenter->SetPosition(p_x, p_y); } - FUN_10070d10(p_x, p_y); + UpdateEnabledGlowControl(p_x, p_y); return 1; } @@ -747,7 +747,7 @@ MxLong Infocenter::HandleKeyPress(MxS8 p_key) MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y) { if (m_dragPresenter) { - MxControlPresenter* control = InputManager()->GetControlManager()->FUN_100294e0(p_x - 1, p_y - 1); + MxControlPresenter* control = InputManager()->GetControlManager()->GetControlAt(p_x - 1, p_y - 1); switch (m_dragPresenter->GetAction()->GetObjectId()) { case InfomainScript::c_PepperHot_Bitmap: @@ -776,7 +776,7 @@ MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y) m_radio.Stop(); BackgroundAudioManager()->Stop(); PlayAction(InfomainScript::c_Pepper_All_Movie); - m_unk0x1d4++; + m_playingMovieCounter++; } break; case InfomainScript::c_Mama_Ctl: @@ -784,7 +784,7 @@ MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y) m_radio.Stop(); BackgroundAudioManager()->Stop(); PlayAction(InfomainScript::c_Mama_All_Movie); - m_unk0x1d4++; + m_playingMovieCounter++; } break; case InfomainScript::c_Papa_Ctl: @@ -792,7 +792,7 @@ MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y) m_radio.Stop(); BackgroundAudioManager()->Stop(); PlayAction(InfomainScript::c_Papa_All_Movie); - m_unk0x1d4++; + m_playingMovieCounter++; } break; case InfomainScript::c_Nick_Ctl: @@ -800,7 +800,7 @@ MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y) m_radio.Stop(); BackgroundAudioManager()->Stop(); PlayAction(InfomainScript::c_Nick_All_Movie); - m_unk0x1d4++; + m_playingMovieCounter++; } break; case InfomainScript::c_Laura_Ctl: @@ -808,17 +808,17 @@ MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y) m_radio.Stop(); BackgroundAudioManager()->Stop(); PlayAction(InfomainScript::c_Laura_All_Movie); - m_unk0x1d4++; + m_playingMovieCounter++; } break; } } else { - if (m_unk0x1c8 != -1) { + if (m_enabledGlowControl != -1) { m_infoManDialogueTimer = 0; - switch (m_glowInfo[m_unk0x1c8].m_unk0x04) { - case 3: + switch (m_glowInfo[m_enabledGlowControl].m_target) { + case InfocenterMapEntry::e_infocenter: GameState()->SetActor(m_selectedCharacter); switch (m_selectedCharacter) { @@ -839,37 +839,37 @@ MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y) break; } break; - case 10: + case InfocenterMapEntry::e_jetrace: if (m_selectedCharacter) { m_destLocation = LegoGameState::e_jetraceExterior; m_infocenterState->m_unk0x74 = 5; } break; - case 11: + case InfocenterMapEntry::e_carrace: if (m_selectedCharacter) { m_destLocation = LegoGameState::e_carraceExterior; m_infocenterState->m_unk0x74 = 5; } break; - case 12: + case InfocenterMapEntry::e_pizzeria: if (m_selectedCharacter) { m_destLocation = LegoGameState::e_pizzeriaExterior; m_infocenterState->m_unk0x74 = 5; } break; - case 13: + case InfocenterMapEntry::e_garage: if (m_selectedCharacter) { m_destLocation = LegoGameState::e_garageExterior; m_infocenterState->m_unk0x74 = 5; } break; - case 14: + case InfocenterMapEntry::e_hospital: if (m_selectedCharacter) { m_destLocation = LegoGameState::e_hospitalExterior; m_infocenterState->m_unk0x74 = 5; } break; - case 15: + case InfocenterMapEntry::e_police: if (m_selectedCharacter) { m_destLocation = LegoGameState::e_policeExterior; m_infocenterState->m_unk0x74 = 5; @@ -931,7 +931,7 @@ MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y) } UpdateFrameHot(TRUE); - FUN_10070d10(0, 0); + UpdateEnabledGlowControl(0, 0); } return FALSE; @@ -1020,13 +1020,13 @@ MxU8 Infocenter::HandleControl(LegoControlManagerNotificationParam& p_param) case InfomainScript::c_BigInfo_Ctl: switch (state->GetCurrentAct()) { case LegoGameState::e_act1: - if (state->GetPreviousArea()) { - switch (state->GetPreviousArea()) { + if (state->m_previousArea) { + switch (state->m_previousArea) { case LegoGameState::e_infodoor: case LegoGameState::e_regbook: case LegoGameState::e_infoscor: m_infocenterState->m_unk0x74 = 5; - m_destLocation = state->GetPreviousArea(); + m_destLocation = state->m_previousArea; actionToPlay = (InfomainScript::Script) m_infocenterState->GetNextLeaveDialogue(); m_radio.Stop(); InputManager()->DisableInputProcessing(); @@ -1081,7 +1081,7 @@ MxU8 Infocenter::HandleControl(LegoControlManagerNotificationParam& p_param) actionToPlay = GameState()->GetCurrentAct() != LegoGameState::e_act1 ? InfomainScript::c_GoTo_RegBook_Red : InfomainScript::c_GoTo_RegBook; m_radio.Stop(); - GameState()->m_unk0x42c = GameState()->GetPreviousArea(); + GameState()->m_unk0x42c = GameState()->m_previousArea; InputManager()->DisableInputProcessing(); break; case InfomainScript::c_Mama_Ctl: @@ -1232,21 +1232,21 @@ MxResult Infocenter::Tickle() m_bookAnimationTimer = 1; } - if (m_unk0x1d6 != 0) { - m_unk0x1d6 += 100; + if (m_bigInfoBlinkTimer != 0) { + m_bigInfoBlinkTimer += 100; - if (m_unk0x1d6 > 3400 && m_unk0x1d6 < 3650) { - ControlManager()->FUN_100293c0(InfomainScript::c_BigInfo_Ctl, m_atomId.GetInternal(), 1); + if (m_bigInfoBlinkTimer > 3400 && m_bigInfoBlinkTimer < 3650) { + ControlManager()->UpdateEnabledChild(InfomainScript::c_BigInfo_Ctl, m_atomId.GetInternal(), 1); } - else if (m_unk0x1d6 > 3650 && m_unk0x1d6 < 3900) { - ControlManager()->FUN_100293c0(InfomainScript::c_BigInfo_Ctl, m_atomId.GetInternal(), 0); + else if (m_bigInfoBlinkTimer > 3650 && m_bigInfoBlinkTimer < 3900) { + ControlManager()->UpdateEnabledChild(InfomainScript::c_BigInfo_Ctl, m_atomId.GetInternal(), 0); } - else if (m_unk0x1d6 > 3900 && m_unk0x1d6 < 4150) { - ControlManager()->FUN_100293c0(InfomainScript::c_BigInfo_Ctl, m_atomId.GetInternal(), 1); + else if (m_bigInfoBlinkTimer > 3900 && m_bigInfoBlinkTimer < 4150) { + ControlManager()->UpdateEnabledChild(InfomainScript::c_BigInfo_Ctl, m_atomId.GetInternal(), 1); } - else if (m_unk0x1d6 > 4400) { - ControlManager()->FUN_100293c0(InfomainScript::c_BigInfo_Ctl, m_atomId.GetInternal(), 0); - m_unk0x1d6 = 0; + else if (m_bigInfoBlinkTimer > 4400) { + ControlManager()->UpdateEnabledChild(InfomainScript::c_BigInfo_Ctl, m_atomId.GetInternal(), 0); + m_bigInfoBlinkTimer = 0; } } @@ -1295,7 +1295,7 @@ MxBool Infocenter::VTable0x5c() // FUNCTION: LEGO1 0x10070d10 // FUNCTION: BETA10 0x100307d4 -void Infocenter::FUN_10070d10(MxS32 p_x, MxS32 p_y) +void Infocenter::UpdateEnabledGlowControl(MxS32 p_x, MxS32 p_y) { MxS16 i; for (i = 0; i < (MxS32) (sizeof(m_glowInfo) / sizeof(m_glowInfo[0])); i++) { @@ -1313,12 +1313,12 @@ void Infocenter::FUN_10070d10(MxS32 p_x, MxS32 p_y) i = -1; } - if (i != m_unk0x1c8) { - if (m_unk0x1c8 != -1) { - m_glowInfo[m_unk0x1c8].m_destCtl->Enable(FALSE); + if (i != m_enabledGlowControl) { + if (m_enabledGlowControl != -1) { + m_glowInfo[m_enabledGlowControl].m_destCtl->Enable(FALSE); } - m_unk0x1c8 = i; + m_enabledGlowControl = i; if (i != -1) { m_glowInfo[i].m_destCtl->Enable(TRUE); } @@ -1385,12 +1385,12 @@ void Infocenter::Reset() break; } - PlantManager()->FUN_10027120(); - BuildingManager()->FUN_10030590(); + PlantManager()->ClearCounters(); + BuildingManager()->ClearCounters(); AnimationManager()->Reset(FALSE); CharacterManager()->ReleaseAllActors(); GameState()->SetCurrentAct(LegoGameState::e_act1); - GameState()->SetPreviousArea(LegoGameState::e_undefined); + GameState()->m_previousArea = LegoGameState::e_undefined; GameState()->m_unk0x42c = LegoGameState::e_undefined; InitializeBitmaps(); @@ -1450,7 +1450,7 @@ void Infocenter::StartCredits() MxDSAction* action = presenter->GetAction(); if (action) { - FUN_100b7220(action, MxDSAction::c_world, FALSE); + ApplyMask(action, MxDSAction::c_world, FALSE); presenter->EndAction(); } } @@ -1466,7 +1466,7 @@ void Infocenter::StartCredits() MxDSAction* action = presenter->GetAction(); if (action) { - FUN_100b7220(action, MxDSAction::c_world, FALSE); + ApplyMask(action, MxDSAction::c_world, FALSE); presenter->EndAction(); } } diff --git a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp index 9931523f..c546744a 100644 --- a/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp +++ b/LEGO1/lego/legoomni/src/worlds/infocenterdoor.cpp @@ -119,7 +119,7 @@ MxLong InfocenterDoor::HandleControl(LegoControlManagerNotificationParam& p_para if (GameState()->GetActorId() != LegoActor::c_none) { InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState"); if (state->HasRegistered()) { - m_destLocation = LegoGameState::e_unk4; + m_destLocation = LegoGameState::e_infocenterExited; } else { MxDSAction action; diff --git a/LEGO1/lego/legoomni/src/worlds/isle.cpp b/LEGO1/lego/legoomni/src/worlds/isle.cpp index 5fb87505..7865969b 100644 --- a/LEGO1/lego/legoomni/src/worlds/isle.cpp +++ b/LEGO1/lego/legoomni/src/worlds/isle.cpp @@ -121,7 +121,7 @@ MxResult Isle::Create(MxDSAction& p_dsAction) m_act1state = act1state; EnableAnimations(TRUE); - GameState()->SetDirty(TRUE); + GameState()->m_isDirty = TRUE; } return result; @@ -430,7 +430,7 @@ MxLong Isle::HandleControl(LegoControlManagerNotificationParam& p_param) TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); break; case IsleScript::c_PoliDoor_Door_Ctl: - m_destLocation = LegoGameState::e_unk33; + m_destLocation = LegoGameState::e_policeExited; TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); break; case IsleScript::c_GaraDoor_LeftArrow_Ctl: @@ -440,7 +440,7 @@ MxLong Isle::HandleControl(LegoControlManagerNotificationParam& p_param) TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); break; case IsleScript::c_GaraDoor_Door_Ctl: - m_destLocation = LegoGameState::e_unk28; + m_destLocation = LegoGameState::e_garageExited; TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); break; } @@ -503,7 +503,7 @@ MxLong Isle::HandlePathStruct(LegoPathStructNotificationParam& p_param) break; case 0x131: if (m_act1state->m_unk0x018 != 10) { - AnimationManager()->FUN_10064740(FALSE); + AnimationManager()->FUN_10064740(NULL); } result = 1; break; @@ -712,7 +712,7 @@ void Isle::Enable(MxBool p_enable) if (GameState()->m_currentArea == LegoGameState::e_pizzeriaExterior) { AnimationManager()->FUN_10064740(NULL); } - else if (GameState()->m_currentArea == LegoGameState::e_unk66) { + else if (GameState()->m_currentArea == LegoGameState::e_vehicleExited) { Mx3DPointFloat position(UserActor()->GetROI()->GetWorldPosition()); Mx3DPointFloat sub(-21.375f, 0.0f, -41.75f); @@ -810,7 +810,7 @@ void Isle::Enable(MxBool p_enable) AnimationManager()->EnableCamAnims(FALSE); g_isleFlags &= ~c_playMusic; - m_ambulance->FUN_10036e60(); + m_ambulance->Init(); break; case 11: m_act1state->m_unk0x018 = 0; @@ -820,7 +820,7 @@ void Isle::Enable(MxBool p_enable) TRUE, IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 ); - GameState()->m_currentArea = LegoGameState::e_unk66; + GameState()->m_currentArea = LegoGameState::e_vehicleExited; EnableAnimations(TRUE); m_jukebox->StartAction(); break; @@ -863,21 +863,21 @@ void Isle::FUN_10032620() VideoManager()->Get3DManager()->SetFrustrum(90.0, 0.1, 250.0); switch (GameState()->m_currentArea) { - case LegoGameState::e_unk66: { + case LegoGameState::e_vehicleExited: { MxMatrix mat(UserActor()->GetROI()->GetLocal2World()); LegoPathBoundary* boundary = UserActor()->GetBoundary(); ((IslePathActor*) UserActor())->VTable0xec(mat, boundary, TRUE); break; } - case LegoGameState::e_unk4: + case LegoGameState::e_infocenterExited: case LegoGameState::e_jetraceExterior: - case LegoGameState::e_unk17: + case LegoGameState::e_jetskibuildExited: case LegoGameState::e_carraceExterior: - case LegoGameState::e_unk20: + case LegoGameState::e_racecarbuildExited: case LegoGameState::e_pizzeriaExterior: case LegoGameState::e_garageExterior: case LegoGameState::e_hospitalExterior: - case LegoGameState::e_unk31: + case LegoGameState::e_hospitalExited: case LegoGameState::e_policeExterior: ((IslePathActor*) UserActor()) ->SpawnPlayer( @@ -885,7 +885,7 @@ void Isle::FUN_10032620() TRUE, IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3 ); - GameState()->m_currentArea = LegoGameState::e_unk66; + GameState()->m_currentArea = LegoGameState::e_vehicleExited; break; } } @@ -955,7 +955,7 @@ MxLong Isle::HandleTransitionEnd() VariableTable()->SetVariable("VISIBILITY", "Hide Gas"); FUN_10032d30(IsleScript::c_GaraDoor_Background_Bitmap, JukeboxScript::c_JBMusic2, "LCAMZG1,90", FALSE); break; - case LegoGameState::e_unk28: + case LegoGameState::e_garageExited: GameState()->SwitchArea(m_destLocation); GameState()->StopArea(LegoGameState::e_previousArea); m_destLocation = LegoGameState::e_undefined; @@ -965,7 +965,7 @@ MxLong Isle::HandleTransitionEnd() SetAppCursor(e_cursorArrow); SetIsWorldActive(TRUE); break; - case LegoGameState::e_unk33: + case LegoGameState::e_policeExited: GameState()->SwitchArea(m_destLocation); GameState()->StopArea(LegoGameState::e_previousArea); m_destLocation = LegoGameState::e_undefined; @@ -1209,7 +1209,7 @@ MxBool Isle::Escape() case 10: if (UserActor() != NULL && !UserActor()->IsA("Ambulance")) { m_ambulance->StopActions(); - m_ambulance->FUN_10037250(); + m_ambulance->Reset(); } break; } @@ -1250,7 +1250,7 @@ void Isle::FUN_10033350() if (m_act1state->m_unk0x018 == 10) { if (UserActor() != NULL && !UserActor()->IsA("Ambulance")) { m_ambulance->StopActions(); - m_ambulance->FUN_10037250(); + m_ambulance->Reset(); } } @@ -1653,19 +1653,19 @@ void Act1State::PlaceActors() m_helicopter = NULL; if (m_helicopterWindshield != NULL) { - FUN_1003f930(m_helicopterWindshield); + LoadFromNamedTexture(m_helicopterWindshield); delete m_helicopterWindshield; m_helicopterWindshield = NULL; } if (m_helicopterJetLeft != NULL) { - FUN_1003f930(m_helicopterJetLeft); + LoadFromNamedTexture(m_helicopterJetLeft); delete m_helicopterJetLeft; m_helicopterJetLeft = NULL; } if (m_helicopterJetRight != NULL) { - FUN_1003f930(m_helicopterJetRight); + LoadFromNamedTexture(m_helicopterJetRight); delete m_helicopterJetRight; m_helicopterJetRight = NULL; } @@ -1689,13 +1689,13 @@ void Act1State::PlaceActors() m_jetski = NULL; if (m_jetskiFront != NULL) { - FUN_1003f930(m_jetskiFront); + LoadFromNamedTexture(m_jetskiFront); delete m_jetskiFront; m_jetskiFront = NULL; } if (m_jetskiWindshield != NULL) { - FUN_1003f930(m_jetskiWindshield); + LoadFromNamedTexture(m_jetskiWindshield); delete m_jetskiWindshield; m_jetskiWindshield = NULL; } @@ -1723,7 +1723,7 @@ void Act1State::PlaceActors() m_dunebuggy = NULL; if (m_dunebuggyFront != NULL) { - FUN_1003f930(m_dunebuggyFront); + LoadFromNamedTexture(m_dunebuggyFront); delete m_dunebuggyFront; m_dunebuggyFront = NULL; } @@ -1751,19 +1751,19 @@ void Act1State::PlaceActors() m_racecar = NULL; if (m_racecarFront != NULL) { - FUN_1003f930(m_racecarFront); + LoadFromNamedTexture(m_racecarFront); delete m_racecarFront; m_racecarFront = NULL; } if (m_racecarBack != NULL) { - FUN_1003f930(m_racecarBack); + LoadFromNamedTexture(m_racecarBack); delete m_racecarBack; m_racecarBack = NULL; } if (m_racecarTail != NULL) { - FUN_1003f930(m_racecarTail); + LoadFromNamedTexture(m_racecarTail); delete m_racecarTail; m_racecarTail = NULL; } diff --git a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp index 9f8e7793..ddc97f1c 100644 --- a/LEGO1/lego/legoomni/src/worlds/legoact2.cpp +++ b/LEGO1/lego/legoomni/src/worlds/legoact2.cpp @@ -141,7 +141,7 @@ MxResult LegoAct2::Create(MxDSAction& p_dsAction) case LegoGameState::e_act1: case LegoGameState::e_actNotFound: GameState()->StopArea(LegoGameState::e_undefined); - if (GameState()->GetPreviousArea() == LegoGameState::e_infomain) { + if (GameState()->m_previousArea == LegoGameState::e_infomain) { GameState()->StopArea(LegoGameState::e_isle); } } @@ -149,7 +149,7 @@ MxResult LegoAct2::Create(MxDSAction& p_dsAction) GameState()->m_currentArea = LegoGameState::e_act2main; GameState()->SetCurrentAct(LegoGameState::e_act2); InputManager()->Register(this); - GameState()->SetDirty(TRUE); + GameState()->m_isDirty = TRUE; } return result; @@ -502,8 +502,8 @@ void LegoAct2::ReadyWorld() MxMatrix local2world = roi->GetLocal2World(); local2world[3][0] -= 1.5; - roi->FUN_100a58f0(local2world); - roi->VTable0x14(); + roi->SetLocal2World(local2world); + roi->WrappedUpdateWorldData(); roi = FindROI("Block02"); sphere = roi->GetBoundingSphere(); @@ -536,7 +536,7 @@ void LegoAct2::Enable(MxBool p_enable) ((IslePathActor*) m_pepper->GetEntity())->VTable0xec(m_unk0x10dc, m_unk0x1124, TRUE); - if (GameState()->GetPreviousArea() == LegoGameState::e_infomain) { + if (GameState()->m_previousArea == LegoGameState::e_infomain) { GameState()->StopArea(LegoGameState::e_infomain); } @@ -688,8 +688,8 @@ void LegoAct2::FUN_100517b0() local2world[3][1] += 1.5; LegoROI* roi = brick.GetROI(); - roi->FUN_100a58f0(local2world); - roi->VTable0x14(); + roi->SetLocal2World(local2world); + roi->WrappedUpdateWorldData(); brick.PlayWhistleSound(); m_nextBrick++; } @@ -828,9 +828,9 @@ void LegoAct2::SpawnBricks() } SET3(local2world[3], location); - roi->FUN_100a58f0(local2world); + roi->SetLocal2World(local2world); roi->SetVisibility(TRUE); - roi->VTable0x14(); + roi->WrappedUpdateWorldData(); entity = roi->GetEntity(); brick->PlayWhistleSound(); m_nextBrick++; @@ -852,9 +852,9 @@ void LegoAct2::SpawnBricks() } SET3(local2world[3], location); - roi->FUN_100a58f0(local2world); + roi->SetLocal2World(local2world); roi->SetVisibility(TRUE); - roi->VTable0x14(); + roi->WrappedUpdateWorldData(); entity = roi->GetEntity(); brick->PlayWhistleSound(); m_nextBrick++; @@ -876,9 +876,9 @@ void LegoAct2::SpawnBricks() } SET3(local2world[3], location); - roi->FUN_100a58f0(local2world); + roi->SetLocal2World(local2world); roi->SetVisibility(TRUE); - roi->VTable0x14(); + roi->WrappedUpdateWorldData(); entity = roi->GetEntity(); brick->PlayWhistleSound(); m_nextBrick++; @@ -914,9 +914,9 @@ void LegoAct2::SpawnBricks() } SET3(local2world[3], location); - roi->FUN_100a58f0(local2world); + roi->SetLocal2World(local2world); roi->SetVisibility(TRUE); - roi->VTable0x14(); + roi->WrappedUpdateWorldData(); entity = roi->GetEntity(); brick->PlayWhistleSound(); m_nextBrick++; diff --git a/LEGO1/lego/legoomni/src/worlds/police.cpp b/LEGO1/lego/legoomni/src/worlds/police.cpp index c1298bf3..f1936ead 100644 --- a/LEGO1/lego/legoomni/src/worlds/police.cpp +++ b/LEGO1/lego/legoomni/src/worlds/police.cpp @@ -105,7 +105,7 @@ MxLong Police::HandleControl(LegoControlManagerNotificationParam& p_param) switch (p_param.m_clickedObjectId) { case PoliceScript::c_LeftArrow_Ctl: case PoliceScript::c_RightArrow_Ctl: - if (m_policeState->GetUnknown0x0c() == 1) { + if (m_policeState->GetState() == PoliceState::e_playingAnimation) { DeleteObjects(&m_atomId, PoliceScript::c_nps001ni_RunAnim, PoliceScript::c_nps002la_RunAnim); } @@ -114,7 +114,7 @@ MxLong Police::HandleControl(LegoControlManagerNotificationParam& p_param) TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); break; case PoliceScript::c_Info_Ctl: - if (m_policeState->GetUnknown0x0c() == 1) { + if (m_policeState->GetState() == PoliceState::e_playingAnimation) { DeleteObjects(&m_atomId, PoliceScript::c_nps001ni_RunAnim, PoliceScript::c_nps002la_RunAnim); } @@ -123,7 +123,7 @@ MxLong Police::HandleControl(LegoControlManagerNotificationParam& p_param) TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); break; case PoliceScript::c_Door_Ctl: - if (m_policeState->GetUnknown0x0c() == 1) { + if (m_policeState->GetState() == PoliceState::e_playingAnimation) { DeleteObjects(&m_atomId, PoliceScript::c_nps001ni_RunAnim, PoliceScript::c_nps002la_RunAnim); } @@ -132,7 +132,7 @@ MxLong Police::HandleControl(LegoControlManagerNotificationParam& p_param) TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); break; case PoliceScript::c_Donut_Ctl: - m_policeState->FUN_1005ea40(); + m_policeState->StartAnimation(); } } @@ -145,8 +145,8 @@ MxLong Police::HandleEndAction(MxEndActionNotificationParam& p_param) MxDSAction* action = p_param.GetAction(); if (m_radio.Notify(p_param) == 0 && m_atomId == action->GetAtomId()) { - if (m_policeState->GetUnknown0x0c() == 1) { - m_policeState->SetUnknown0x0c(0); + if (m_policeState->GetState() == PoliceState::e_playingAnimation) { + m_policeState->SetState(PoliceState::e_noAnimation); return 1; } @@ -161,9 +161,9 @@ MxLong Police::HandleKeyPress(LegoEventNotificationParam& p_param) { MxLong result = 0; - if (p_param.GetKey() == VK_SPACE && m_policeState->GetUnknown0x0c() == 1) { + if (p_param.GetKey() == VK_SPACE && m_policeState->GetState() == PoliceState::e_playingAnimation) { DeleteObjects(&m_atomId, PoliceScript::c_nps001ni_RunAnim, PoliceScript::c_nps002la_RunAnim); - m_policeState->SetUnknown0x0c(0); + m_policeState->SetState(PoliceState::e_noAnimation); return 1; } @@ -197,7 +197,7 @@ MxBool Police::Escape() // FUNCTION: LEGO1 0x1005e7c0 PoliceState::PoliceState() { - m_unk0x0c = 0; + m_state = PoliceState::e_noAnimation; m_policeScript = (rand() % 2 == 0) ? PoliceScript::c_nps002la_RunAnim : PoliceScript::c_nps001ni_RunAnim; } @@ -218,11 +218,11 @@ MxResult PoliceState::Serialize(LegoStorage* p_storage) } // FUNCTION: LEGO1 0x1005ea40 -void PoliceState::FUN_1005ea40() +void PoliceState::StartAnimation() { PoliceScript::Script policeScript; - if (m_unk0x0c == 1) { + if (m_state == PoliceState::e_playingAnimation) { return; } @@ -248,5 +248,5 @@ void PoliceState::FUN_1005ea40() Start(&action); } - m_unk0x0c = 1; + m_state = PoliceState::e_playingAnimation; } diff --git a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp index adc7c856..6b177308 100644 --- a/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp +++ b/LEGO1/lego/legoomni/src/worlds/registrationbook.cpp @@ -226,11 +226,15 @@ MxLong RegistrationBook::HandleKeyPress(MxU8 p_key) // FUNCTION: LEGO1 0x100774a0 MxLong RegistrationBook::HandleControl(LegoControlManagerNotificationParam& p_param) { - MxS16 unk0x28 = p_param.m_unk0x28; + MxS16 buttonId = p_param.m_unk0x28; - if (unk0x28 >= 1 && unk0x28 <= 28) { + if (buttonId >= 1 && buttonId <= 28) { if (p_param.m_clickedObjectId == RegbookScript::c_Alphabet_Ctl) { - if (unk0x28 == 28) { + // buttonId: + // - [1, 26]: alphabet + // - 27: backspace + // - 28: go back to information center + if (buttonId == 28) { DeleteObjects(&m_atomId, RegbookScript::c_iic006in_RunAnim, RegbookScript::c_iic008in_PlayWav); if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { @@ -243,14 +247,15 @@ MxLong RegistrationBook::HandleControl(LegoControlManagerNotificationParam& p_pa TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); } else { - if (unk0x28 > 28) { + if (buttonId > 28) { return 1; } - HandleKeyPress(unk0x28 < 27 ? unk0x28 + 64 : 8); + HandleKeyPress(buttonId < 27 ? buttonId + 'A' - 1 : '\b'); } } else { + // Select another profile (buttonId is always 1) InputManager()->DisableInputProcessing(); DeleteObjects(&m_atomId, RegbookScript::c_iic006in_RunAnim, RegbookScript::c_iic008in_PlayWav); diff --git a/LEGO1/lego/legoomni/src/worlds/score.cpp b/LEGO1/lego/legoomni/src/worlds/score.cpp index b5b66d87..76f987e2 100644 --- a/LEGO1/lego/legoomni/src/worlds/score.cpp +++ b/LEGO1/lego/legoomni/src/worlds/score.cpp @@ -146,7 +146,7 @@ void Score::ReadyWorld() MxDSAction action; action.SetObjectId(InfoscorScript::c_nin001pr_RunAnim); action.SetAtomId(m_atomId); - action.SetUnknown84(this); + action.SetNotificationObject(this); Start(&action); if (m_state->GetTutorialFlag()) { diff --git a/LEGO1/lego/sources/anim/legoanim.cpp b/LEGO1/lego/sources/anim/legoanim.cpp index 562601a5..8ec3ee2d 100644 --- a/LEGO1/lego/sources/anim/legoanim.cpp +++ b/LEGO1/lego/sources/anim/legoanim.cpp @@ -31,7 +31,7 @@ LegoResult LegoUnknownKey::Read(LegoStorage* p_storage) return result; } - if ((result = p_storage->Read(&m_z, sizeof(m_z))) != SUCCESS) { + if ((result = p_storage->Read(&m_z, sizeof(LegoFloat))) != SUCCESS) { return result; } @@ -48,7 +48,7 @@ LegoResult LegoUnknownKey::Write(LegoStorage* p_storage) return result; } - if ((result = p_storage->Write(&m_z, sizeof(m_z))) != SUCCESS) { + if ((result = p_storage->Write(&m_z, sizeof(LegoFloat))) != SUCCESS) { return result; } @@ -95,7 +95,7 @@ LegoResult LegoAnimScene::Write(LegoStorage* p_storage) LegoResult result; LegoS32 i; - if ((result = p_storage->Write(&m_unk0x00, sizeof(m_unk0x00))) != SUCCESS) { + if ((result = p_storage->Write(&m_unk0x00, sizeof(LegoU16))) != SUCCESS) { return result; } if (m_unk0x00 != 0) { @@ -106,7 +106,7 @@ LegoResult LegoAnimScene::Write(LegoStorage* p_storage) } } - if ((result = p_storage->Write(&m_unk0x08, sizeof(m_unk0x08))) != SUCCESS) { + if ((result = p_storage->Write(&m_unk0x08, sizeof(LegoU16))) != SUCCESS) { return result; } if (m_unk0x08 != 0) { @@ -117,7 +117,7 @@ LegoResult LegoAnimScene::Write(LegoStorage* p_storage) } } - if ((result = p_storage->Write(&m_unk0x10, sizeof(m_unk0x10))) != SUCCESS) { + if ((result = p_storage->Write(&m_unk0x10, sizeof(LegoU16))) != SUCCESS) { return result; } if (m_unk0x10 != 0) { @@ -137,7 +137,7 @@ LegoResult LegoAnimScene::Read(LegoStorage* p_storage) LegoResult result; LegoS32 i; - if ((result = p_storage->Read(&m_unk0x00, sizeof(m_unk0x00))) != SUCCESS) { + if ((result = p_storage->Read(&m_unk0x00, sizeof(LegoU16))) != SUCCESS) { return result; } if (m_unk0x00 != 0) { @@ -149,7 +149,7 @@ LegoResult LegoAnimScene::Read(LegoStorage* p_storage) } } - if ((result = p_storage->Read(&m_unk0x08, sizeof(m_unk0x08))) != SUCCESS) { + if ((result = p_storage->Read(&m_unk0x08, sizeof(LegoU16))) != SUCCESS) { return result; } if (m_unk0x08 != 0) { @@ -161,7 +161,7 @@ LegoResult LegoAnimScene::Read(LegoStorage* p_storage) } } - if ((result = p_storage->Read(&m_unk0x10, sizeof(m_unk0x10))) != SUCCESS) { + if ((result = p_storage->Read(&m_unk0x10, sizeof(LegoU16))) != SUCCESS) { return result; } if (m_unk0x10 != 0) { @@ -295,7 +295,7 @@ LegoResult LegoAnimKey::Read(LegoStorage* p_storage) LegoResult result; LegoS32 timeAndFlags; - if ((result = p_storage->Read(&timeAndFlags, sizeof(timeAndFlags))) != SUCCESS) { + if ((result = p_storage->Read(&timeAndFlags, sizeof(LegoS32))) != SUCCESS) { return result; } @@ -311,7 +311,7 @@ LegoResult LegoAnimKey::Write(LegoStorage* p_storage) LegoResult result; LegoS32 timeAndFlags = (LegoS32) m_time | (m_flags << 24); - if ((result = p_storage->Write(&timeAndFlags, sizeof(timeAndFlags))) != SUCCESS) { + if ((result = p_storage->Write(&timeAndFlags, sizeof(LegoS32))) != SUCCESS) { return result; } @@ -335,20 +335,20 @@ LegoResult LegoTranslationKey::Read(LegoStorage* p_storage) return result; } - if ((result = p_storage->Read(&m_x, sizeof(m_x))) != SUCCESS) { + if ((result = p_storage->Read(&m_x, sizeof(LegoFloat))) != SUCCESS) { return result; } - if ((result = p_storage->Read(&m_y, sizeof(m_y))) != SUCCESS) { + if ((result = p_storage->Read(&m_y, sizeof(LegoFloat))) != SUCCESS) { return result; } - if ((result = p_storage->Read(&m_z, sizeof(m_z))) != SUCCESS) { + if ((result = p_storage->Read(&m_z, sizeof(LegoFloat))) != SUCCESS) { return result; } if (m_x > 1e-05F || m_x < -1e-05F || m_y > 1e-05F || m_y < -1e-05F || m_z > 1e-05F || m_z < -1e-05F) { - m_flags |= c_bit1; + m_flags |= c_active; } return SUCCESS; @@ -364,15 +364,15 @@ LegoResult LegoTranslationKey::Write(LegoStorage* p_storage) return result; } - if ((result = p_storage->Write(&m_x, sizeof(m_x))) != SUCCESS) { + if ((result = p_storage->Write(&m_x, sizeof(LegoFloat))) != SUCCESS) { return result; } - if ((result = p_storage->Write(&m_y, sizeof(m_y))) != SUCCESS) { + if ((result = p_storage->Write(&m_y, sizeof(LegoFloat))) != SUCCESS) { return result; } - if ((result = p_storage->Write(&m_z, sizeof(m_z))) != SUCCESS) { + if ((result = p_storage->Write(&m_z, sizeof(LegoFloat))) != SUCCESS) { return result; } @@ -398,24 +398,24 @@ LegoResult LegoRotationKey::Read(LegoStorage* p_storage) return result; } - if ((result = p_storage->Read(&m_angle, sizeof(m_angle))) != SUCCESS) { + if ((result = p_storage->Read(&m_angle, sizeof(LegoFloat))) != SUCCESS) { return result; } - if ((result = p_storage->Read(&m_x, sizeof(m_x))) != SUCCESS) { + if ((result = p_storage->Read(&m_x, sizeof(LegoFloat))) != SUCCESS) { return result; } - if ((result = p_storage->Read(&m_y, sizeof(m_y))) != SUCCESS) { + if ((result = p_storage->Read(&m_y, sizeof(LegoFloat))) != SUCCESS) { return result; } - if ((result = p_storage->Read(&m_z, sizeof(m_z))) != SUCCESS) { + if ((result = p_storage->Read(&m_z, sizeof(LegoFloat))) != SUCCESS) { return result; } if (m_angle != 1.0F) { - m_flags |= c_bit1; + m_flags |= c_active; } return SUCCESS; @@ -435,15 +435,15 @@ LegoResult LegoRotationKey::Write(LegoStorage* p_storage) return result; } - if ((result = p_storage->Write(&m_x, sizeof(m_x))) != SUCCESS) { + if ((result = p_storage->Write(&m_x, sizeof(LegoFloat))) != SUCCESS) { return result; } - if ((result = p_storage->Write(&m_y, sizeof(m_y))) != SUCCESS) { + if ((result = p_storage->Write(&m_y, sizeof(LegoFloat))) != SUCCESS) { return result; } - if ((result = p_storage->Write(&m_z, sizeof(m_z))) != SUCCESS) { + if ((result = p_storage->Write(&m_z, sizeof(LegoFloat))) != SUCCESS) { return result; } @@ -467,20 +467,20 @@ LegoResult LegoScaleKey::Read(LegoStorage* p_storage) return result; } - if ((result = p_storage->Read(&m_x, sizeof(m_x))) != SUCCESS) { + if ((result = p_storage->Read(&m_x, sizeof(LegoFloat))) != SUCCESS) { return result; } - if ((result = p_storage->Read(&m_y, sizeof(m_y))) != SUCCESS) { + if ((result = p_storage->Read(&m_y, sizeof(LegoFloat))) != SUCCESS) { return result; } - if ((result = p_storage->Read(&m_z, sizeof(m_z))) != SUCCESS) { + if ((result = p_storage->Read(&m_z, sizeof(LegoFloat))) != SUCCESS) { return result; } if (m_x > 1.00001 || m_x < 0.99999 || m_y > 1.00001 || m_y < 0.99999 || m_z > 1.00001 || m_z < 0.99999) { - m_flags |= c_bit1; + m_flags |= c_active; } return SUCCESS; @@ -496,15 +496,15 @@ LegoResult LegoScaleKey::Write(LegoStorage* p_storage) return result; } - if ((result = p_storage->Write(&m_x, sizeof(m_x))) != SUCCESS) { + if ((result = p_storage->Write(&m_x, sizeof(LegoFloat))) != SUCCESS) { return result; } - if ((result = p_storage->Write(&m_y, sizeof(m_y))) != SUCCESS) { + if ((result = p_storage->Write(&m_y, sizeof(LegoFloat))) != SUCCESS) { return result; } - if ((result = p_storage->Write(&m_z, sizeof(m_z))) != SUCCESS) { + if ((result = p_storage->Write(&m_z, sizeof(LegoFloat))) != SUCCESS) { return result; } @@ -522,7 +522,7 @@ LegoAnimNodeData::LegoAnimNodeData() m_name = NULL; m_translationKeys = NULL; - m_unk0x20 = 0; + m_roiIndex = 0; m_rotationKeys = NULL; m_unk0x22 = 0; m_scaleKeys = NULL; @@ -560,7 +560,7 @@ LegoResult LegoAnimNodeData::Read(LegoStorage* p_storage) LegoResult result; LegoU32 length; - if ((result = p_storage->Read(&length, sizeof(length))) != SUCCESS) { + if ((result = p_storage->Read(&length, sizeof(LegoU32))) != SUCCESS) { return result; } @@ -578,7 +578,7 @@ LegoResult LegoAnimNodeData::Read(LegoStorage* p_storage) LegoU32 i; - if ((result = p_storage->Read(&m_numTranslationKeys, sizeof(m_numTranslationKeys))) != SUCCESS) { + if ((result = p_storage->Read(&m_numTranslationKeys, sizeof(LegoU16))) != SUCCESS) { return result; } if (m_translationKeys) { @@ -594,7 +594,7 @@ LegoResult LegoAnimNodeData::Read(LegoStorage* p_storage) } } - if ((result = p_storage->Read(&m_numRotationKeys, sizeof(m_numRotationKeys))) != SUCCESS) { + if ((result = p_storage->Read(&m_numRotationKeys, sizeof(LegoU16))) != SUCCESS) { return result; } if (m_rotationKeys) { @@ -610,7 +610,7 @@ LegoResult LegoAnimNodeData::Read(LegoStorage* p_storage) } } - if ((result = p_storage->Read(&m_numScaleKeys, sizeof(m_numScaleKeys))) != SUCCESS) { + if ((result = p_storage->Read(&m_numScaleKeys, sizeof(LegoU16))) != SUCCESS) { return result; } if (m_scaleKeys) { @@ -626,7 +626,7 @@ LegoResult LegoAnimNodeData::Read(LegoStorage* p_storage) } } - if ((result = p_storage->Read(&m_numMorphKeys, sizeof(m_numMorphKeys))) != SUCCESS) { + if ((result = p_storage->Read(&m_numMorphKeys, sizeof(LegoU16))) != SUCCESS) { return result; } if (m_morphKeys) { @@ -665,7 +665,7 @@ LegoResult LegoAnimNodeData::Write(LegoStorage* p_storage) return result; } - if ((result = p_storage->Write(&m_numTranslationKeys, sizeof(m_numTranslationKeys))) != SUCCESS) { + if ((result = p_storage->Write(&m_numTranslationKeys, sizeof(LegoU16))) != SUCCESS) { return result; } if (m_numTranslationKeys != 0) { @@ -676,7 +676,7 @@ LegoResult LegoAnimNodeData::Write(LegoStorage* p_storage) } } - if ((result = p_storage->Write(&m_numRotationKeys, sizeof(m_numRotationKeys))) != SUCCESS) { + if ((result = p_storage->Write(&m_numRotationKeys, sizeof(LegoU16))) != SUCCESS) { return result; } if (m_numRotationKeys != 0) { @@ -687,7 +687,7 @@ LegoResult LegoAnimNodeData::Write(LegoStorage* p_storage) } } - if ((result = p_storage->Write(&m_numScaleKeys, sizeof(m_numScaleKeys))) != SUCCESS) { + if ((result = p_storage->Write(&m_numScaleKeys, sizeof(LegoU16))) != SUCCESS) { return result; } if (m_numScaleKeys != 0) { @@ -698,7 +698,7 @@ LegoResult LegoAnimNodeData::Write(LegoStorage* p_storage) } } - if ((result = p_storage->Write(&m_numMorphKeys, sizeof(m_numMorphKeys))) != SUCCESS) { + if ((result = p_storage->Write(&m_numMorphKeys, sizeof(LegoU16))) != SUCCESS) { return result; } if (m_numMorphKeys != 0) { @@ -725,6 +725,7 @@ void LegoAnimNodeData::SetName(LegoChar* p_name) } // FUNCTION: LEGO1 0x100a03c0 +// FUNCTION: BETA10 0x1017f254 LegoResult LegoAnimNodeData::CreateLocalTransform(LegoFloat p_time, Matrix4& p_matrix) { LegoU32 index; @@ -785,7 +786,7 @@ inline void LegoAnimNodeData::GetTranslation( case 0: return; case 1: - if (!p_translationKeys[i].TestBit1()) { + if (!p_translationKeys[i].IsActive()) { return; } @@ -794,7 +795,7 @@ inline void LegoAnimNodeData::GetTranslation( z = p_translationKeys[i].GetZ(); break; case 2: - if (!p_translationKeys[i].TestBit1() && !p_translationKeys[i + 1].TestBit1()) { + if (!p_translationKeys[i].IsActive() && !p_translationKeys[i + 1].IsActive()) { return; } @@ -841,7 +842,7 @@ inline void LegoAnimNodeData::GetTranslation( case 0: return; case 1: - if (p_rotationKeys[i].TestBit1()) { + if (p_rotationKeys[i].IsActive()) { p_matrix.FromQuaternion(Mx4DPointFloat( p_rotationKeys[i].GetX(), p_rotationKeys[i].GetY(), @@ -854,19 +855,19 @@ inline void LegoAnimNodeData::GetTranslation( Mx4DPointFloat a; MxQuaternionTransformer b; - if (p_rotationKeys[i].TestBit1() || p_rotationKeys[i + 1].TestBit1()) { + if (p_rotationKeys[i].IsActive() || p_rotationKeys[i + 1].IsActive()) { a[0] = p_rotationKeys[i].GetX(); a[1] = p_rotationKeys[i].GetY(); a[2] = p_rotationKeys[i].GetZ(); a[3] = p_rotationKeys[i].GetAngle(); - if (p_rotationKeys[i + 1].TestBit3()) { + if (p_rotationKeys[i + 1].ShouldSkipInterpolation()) { p_matrix.FromQuaternion(a); return; } Mx4DPointFloat c; - if (p_rotationKeys[i + 1].TestBit2()) { + if (p_rotationKeys[i + 1].ShouldNegateRotation()) { c[0] = -p_rotationKeys[i + 1].GetX(); c[1] = -p_rotationKeys[i + 1].GetY(); c[2] = -p_rotationKeys[i + 1].GetZ(); @@ -920,7 +921,7 @@ inline void LegoAnimNodeData::GetScale( } // FUNCTION: LEGO1 0x100a0990 -LegoBool LegoAnimNodeData::FUN_100a0990(LegoFloat p_time) +LegoBool LegoAnimNodeData::GetVisibility(LegoFloat p_time) { LegoU32 i, n; LegoU32 index = GetMorphIndex(); @@ -935,7 +936,7 @@ LegoBool LegoAnimNodeData::FUN_100a0990(LegoFloat p_time) break; case 1: case 2: - result = m_morphKeys[i].GetUnknown0x08(); + result = m_morphKeys[i].IsVisible(); break; } @@ -1040,7 +1041,7 @@ LegoResult LegoAnim::Read(LegoStorage* p_storage, LegoS32 p_parseScene) LegoResult result = FAILURE; LegoU32 length, i; - if (p_storage->Read(&length, sizeof(length)) != SUCCESS) { + if (p_storage->Read(&length, sizeof(LegoU32)) != SUCCESS) { goto done; } @@ -1049,7 +1050,7 @@ LegoResult LegoAnim::Read(LegoStorage* p_storage, LegoS32 p_parseScene) for (i = 0; i < length; i++) { LegoU32 length; - if (p_storage->Read(&length, sizeof(length)) != SUCCESS) { + if (p_storage->Read(&length, sizeof(LegoU32)) != SUCCESS) { goto done; } @@ -1062,7 +1063,7 @@ LegoResult LegoAnim::Read(LegoStorage* p_storage, LegoS32 p_parseScene) m_modelList[i].m_name[length] = '\0'; - if (p_storage->Read(&m_modelList[i].m_unk0x04, sizeof(m_modelList[i].m_unk0x04)) != SUCCESS) { + if (p_storage->Read(&m_modelList[i].m_type, sizeof(LegoU32)) != SUCCESS) { goto done; } } @@ -1070,7 +1071,7 @@ LegoResult LegoAnim::Read(LegoStorage* p_storage, LegoS32 p_parseScene) m_numActors++; } - if ((result = p_storage->Read(&m_duration, sizeof(m_duration))) != SUCCESS) { + if ((result = p_storage->Read(&m_duration, sizeof(LegoS32))) != SUCCESS) { goto done; } @@ -1123,7 +1124,7 @@ LegoResult LegoAnim::Write(LegoStorage* p_storage) goto done; } - if (p_storage->Write(&m_modelList[i].m_unk0x04, sizeof(m_modelList[i].m_unk0x04)) != SUCCESS) { + if (p_storage->Write(&m_modelList[i].m_type, sizeof(m_modelList[i].m_type)) != SUCCESS) { goto done; } } @@ -1158,10 +1159,10 @@ const LegoChar* LegoAnim::GetActorName(LegoU32 p_index) // FUNCTION: LEGO1 0x100a0f40 // FUNCTION: BETA10 0x1018023c -undefined4 LegoAnim::GetActorUnknown0x04(LegoU32 p_index) +LegoU32 LegoAnim::GetActorType(LegoU32 p_index) { if (p_index < m_numActors) { - return m_modelList[p_index].m_unk0x04; + return m_modelList[p_index].m_type; } return 0; @@ -1171,7 +1172,7 @@ undefined4 LegoAnim::GetActorUnknown0x04(LegoU32 p_index) // FUNCTION: BETA10 0x1018027c LegoMorphKey::LegoMorphKey() { - m_unk0x08 = 0; + m_visible = FALSE; } // FUNCTION: LEGO1 0x100a0f70 @@ -1183,7 +1184,7 @@ LegoResult LegoMorphKey::Read(LegoStorage* p_storage) return result; } - if ((result = p_storage->Read(&m_unk0x08, sizeof(m_unk0x08))) != SUCCESS) { + if ((result = p_storage->Read(&m_visible, sizeof(LegoU8))) != SUCCESS) { return result; } @@ -1200,7 +1201,7 @@ LegoResult LegoMorphKey::Write(LegoStorage* p_storage) return result; } - if ((result = p_storage->Write(&m_unk0x08, sizeof(m_unk0x08))) != SUCCESS) { + if ((result = p_storage->Write(&m_visible, sizeof(LegoU8))) != SUCCESS) { return result; } diff --git a/LEGO1/lego/sources/anim/legoanim.h b/LEGO1/lego/sources/anim/legoanim.h index 0df350a9..372128b5 100644 --- a/LEGO1/lego/sources/anim/legoanim.h +++ b/LEGO1/lego/sources/anim/legoanim.h @@ -11,9 +11,9 @@ class Matrix4; class LegoAnimKey { public: enum Flags { - c_bit1 = 0x01, - c_bit2 = 0x02, - c_bit3 = 0x04 + c_active = 0x01, + c_negateRotation = 0x02, + c_skipInterpolation = 0x04 }; LegoAnimKey(); @@ -25,18 +25,18 @@ class LegoAnimKey { // FUNCTION: BETA10 0x100738a0 void SetTime(MxS32 p_time) { m_time = p_time; } - LegoU32 TestBit1() { return m_flags & c_bit1; } - LegoU32 TestBit2() { return m_flags & c_bit2; } - LegoU32 TestBit3() { return m_flags & c_bit3; } + LegoU32 IsActive() { return m_flags & c_active; } + LegoU32 ShouldNegateRotation() { return m_flags & c_negateRotation; } + LegoU32 ShouldSkipInterpolation() { return m_flags & c_skipInterpolation; } // FUNCTION: BETA10 0x100739a0 - void FUN_100739a0(MxS32 p_param) + void SetActive(MxS32 p_active) { - if (p_param) { - m_flags |= c_bit1; + if (p_active) { + m_flags |= c_active; } else { - m_flags &= ~c_bit1; + m_flags &= ~c_active; } } @@ -127,13 +127,13 @@ class LegoMorphKey : public LegoAnimKey { LegoMorphKey(); LegoResult Read(LegoStorage* p_storage); LegoResult Write(LegoStorage* p_storage); - LegoBool GetUnknown0x08() { return m_unk0x08; } + LegoBool IsVisible() { return m_visible; } // FUNCTION: BETA10 0x100738d0 - void SetUnknown0x08(LegoBool p_unk0x08) { m_unk0x08 = p_unk0x08; } + void SetVisible(LegoBool p_visible) { m_visible = p_visible; } protected: - LegoBool m_unk0x08; // 0x08 + LegoBool m_visible; // 0x08 }; // SIZE 0x0c @@ -160,7 +160,7 @@ class LegoAnimNodeData : public LegoTreeNodeData { void SetName(LegoChar* p_name); LegoResult CreateLocalTransform(LegoFloat p_time, Matrix4& p_matrix); - LegoBool FUN_100a0990(LegoFloat p_time); + LegoBool GetVisibility(LegoFloat p_time); // FUNCTION: BETA10 0x100595d0 LegoChar* GetName() { return m_name; } @@ -187,7 +187,7 @@ class LegoAnimNodeData : public LegoTreeNodeData { LegoU32 GetMorphIndex() { return m_morphIndex; } // FUNCTION: BETA10 0x1005abc0 - LegoU16 GetUnknown0x20() { return m_unk0x20; } + LegoU16 GetROIIndex() { return m_roiIndex; } // FUNCTION: BETA10 0x1005d5c0 LegoU16 GetUnknown0x22() { return m_unk0x22; } @@ -214,7 +214,7 @@ class LegoAnimNodeData : public LegoTreeNodeData { void SetNumMorphKeys(LegoU16 p_numMorphKeys) { m_numMorphKeys = p_numMorphKeys; } // FUNCTION: BETA10 0x10059600 - void SetUnknown0x20(LegoU16 p_unk0x20) { m_unk0x20 = p_unk0x20; } + void SetROIIndex(LegoU16 p_roiIndex) { m_roiIndex = p_roiIndex; } // FUNCTION: BETA10 0x1005f2e0 void SetUnknown0x22(LegoU16 p_unk0x22) { m_unk0x22 = p_unk0x22; } @@ -225,7 +225,7 @@ class LegoAnimNodeData : public LegoTreeNodeData { } // FUNCTION: BETA10 0x1005d580 - LegoBool FUN_100a0990(LegoTime p_time) { return FUN_100a0990((LegoFloat) p_time); } + LegoBool GetVisibility(LegoTime p_time) { return GetVisibility((LegoFloat) p_time); } inline static void GetTranslation( LegoU16 p_numTranslationKeys, @@ -279,7 +279,7 @@ class LegoAnimNodeData : public LegoTreeNodeData { LegoRotationKey* m_rotationKeys; // 0x14 LegoScaleKey* m_scaleKeys; // 0x18 LegoMorphKey* m_morphKeys; // 0x1c - LegoU16 m_unk0x20; // 0x20 + LegoU16 m_roiIndex; // 0x20 LegoU16 m_unk0x22; // 0x22 LegoU32 m_translationIndex; // 0x24 LegoU32 m_rotationIndex; // 0x28 @@ -289,8 +289,16 @@ class LegoAnimNodeData : public LegoTreeNodeData { // SIZE 0x08 struct LegoAnimActorEntry { - LegoChar* m_name; // 0x00 - undefined4 m_unk0x04; // 0x04 + enum { + e_actorType2 = 2, + e_actorType3 = 3, + e_actorType4 = 4, + e_actorType5 = 5, + e_actorType6 = 6, + }; + + LegoChar* m_name; // 0x00 + LegoU32 m_type; // 0x04 }; // TODO: Possibly called `LegoCameraAnim(ation)`? @@ -338,7 +346,7 @@ class LegoAnim : public LegoTree { virtual LegoResult Read(LegoStorage* p_storage, LegoS32 p_parseScene); // vtable+0x10 const LegoChar* GetActorName(LegoU32 p_index); - undefined4 GetActorUnknown0x04(LegoU32 p_index); + LegoU32 GetActorType(LegoU32 p_index); // FUNCTION: BETA10 0x1005abf0 LegoAnimScene* GetCamAnim() { return m_camAnim; } diff --git a/LEGO1/lego/sources/geom/legoedge.h b/LEGO1/lego/sources/geom/legoedge.h index 881f9325..9a14eef4 100644 --- a/LEGO1/lego/sources/geom/legoedge.h +++ b/LEGO1/lego/sources/geom/legoedge.h @@ -17,7 +17,7 @@ struct LegoEdge { Vector3* CWVertex(LegoWEEdge& p_face); Vector3* CCWVertex(LegoWEEdge& p_face); - LegoResult FUN_1002ddc0(LegoWEEdge& p_face, Vector3& p_point); + LegoResult GetFaceNormal(LegoWEEdge& p_face, Vector3& p_point); // FUNCTION: BETA10 0x10184170 LegoWEEdge* GetFaceA() { return m_faceA; } diff --git a/LEGO1/lego/sources/geom/legoorientededge.cpp b/LEGO1/lego/sources/geom/legoorientededge.cpp new file mode 100644 index 00000000..238723f5 --- /dev/null +++ b/LEGO1/lego/sources/geom/legoorientededge.cpp @@ -0,0 +1,12 @@ +#include "legoorientededge.h" + +DECOMP_SIZE_ASSERT(LegoOrientedEdge, 0x40) + +// FUNCTION: LEGO1 0x1009a630 +// FUNCTION: BETA10 0x10183050 +LegoOrientedEdge::LegoOrientedEdge() +{ + m_flags = 0; + m_dir.Clear(); + m_length = 0.0f; +} diff --git a/LEGO1/lego/sources/geom/legounkown100db7f4.h b/LEGO1/lego/sources/geom/legoorientededge.h similarity index 72% rename from LEGO1/lego/sources/geom/legounkown100db7f4.h rename to LEGO1/lego/sources/geom/legoorientededge.h index d54e3730..bb613563 100644 --- a/LEGO1/lego/sources/geom/legounkown100db7f4.h +++ b/LEGO1/lego/sources/geom/legoorientededge.h @@ -1,5 +1,5 @@ -#ifndef __LEGOUNKNOWN100DB7F4_H -#define __LEGOUNKNOWN100DB7F4_H +#ifndef __LEGOORIENTEDEDGE_H +#define __LEGOORIENTEDEDGE_H #include "legoedge.h" #include "legowegedge.h" @@ -9,31 +9,31 @@ // VTABLE: LEGO1 0x100db7f4 // SIZE 0x40 -struct LegoUnknown100db7f4 : public LegoEdge { +struct LegoOrientedEdge : public LegoEdge { public: enum { c_bit1 = 0x01, c_bit2 = 0x02, - c_bit3 = 0x04, - c_bit4 = 0x08 + c_hasFaceA = 0x04, + c_hasFaceB = 0x08 }; - LegoUnknown100db7f4(); + LegoOrientedEdge(); // FUNCTION: LEGO1 0x1002ddc0 // FUNCTION: BETA10 0x100372a0 - LegoResult FUN_1002ddc0(LegoWEEdge& p_f, Vector3& p_point) const + LegoResult GetFaceNormal(LegoWEEdge& p_face, Vector3& p_point) const { - if (p_f.IsEqual(m_faceA)) { - p_point[0] = -m_unk0x28[0]; - p_point[1] = -m_unk0x28[1]; - p_point[2] = -m_unk0x28[2]; + if (p_face.IsEqual(m_faceA)) { + p_point[0] = -m_dir[0]; + p_point[1] = -m_dir[1]; + p_point[2] = -m_dir[2]; } else { // clang-format off - assert(p_f.IsEqual( m_faceB )); + assert(p_face.IsEqual( m_faceB )); // clang-format on - p_point = m_unk0x28; + p_point = m_dir; } return SUCCESS; @@ -78,7 +78,7 @@ struct LegoUnknown100db7f4 : public LegoEdge { } // FUNCTION: BETA10 0x100bd540 - LegoFloat DistanceBetweenMidpoints(const LegoUnknown100db7f4& p_other) + LegoFloat DistanceBetweenMidpoints(const LegoOrientedEdge& p_other) { Mx3DPointFloat point1(*m_pointA); Mx3DPointFloat point2(*p_other.m_pointA); @@ -99,22 +99,22 @@ struct LegoUnknown100db7f4 : public LegoEdge { inline LegoU32 FUN_10048c40(const Vector3& p_position); // SYNTHETIC: LEGO1 0x1009a6c0 - // LegoUnknown100db7f4::`scalar deleting destructor' + // LegoOrientedEdge::`scalar deleting destructor' - LegoU16 m_flags; // 0x24 - Mx3DPointFloat m_unk0x28; // 0x28 - float m_unk0x3c; // 0x3c + LegoU16 m_flags; // 0x24 + Mx3DPointFloat m_dir; // 0x28 + float m_length; // 0x3c }; // FUNCTION: LEGO1 0x10048c40 // FUNCTION: BETA10 0x1001cc90 -inline LegoU32 LegoUnknown100db7f4::FUN_10048c40(const Vector3& p_position) +inline LegoU32 LegoOrientedEdge::FUN_10048c40(const Vector3& p_position) { LegoFloat localc, local10; LegoU32 result = FALSE; - if (m_unk0x28[0] > 0.001 || m_unk0x28[0] < -0.001) { - localc = (p_position[0] - (*m_pointA)[0]) / m_unk0x28[0]; + if (m_dir[0] > 0.001 || m_dir[0] < -0.001) { + localc = (p_position[0] - (*m_pointA)[0]) / m_dir[0]; if (localc < 0 || localc > 1) { return FALSE; @@ -128,8 +128,8 @@ inline LegoU32 LegoUnknown100db7f4::FUN_10048c40(const Vector3& p_position) } } - if (m_unk0x28[1] > 0.001 || m_unk0x28[1] < -0.001) { - local10 = (p_position[1] - (*m_pointA)[1]) / m_unk0x28[1]; + if (m_dir[1] > 0.001 || m_dir[1] < -0.001) { + local10 = (p_position[1] - (*m_pointA)[1]) / m_dir[1]; if (result) { if (localc > local10 + 0.001 || localc < local10 - 0.001) { @@ -147,8 +147,8 @@ inline LegoU32 LegoUnknown100db7f4::FUN_10048c40(const Vector3& p_position) } } - if (m_unk0x28[2] > 0.001 || m_unk0x28[2] < -0.001) { - local10 = (p_position[2] - (*m_pointA)[2]) / m_unk0x28[2]; + if (m_dir[2] > 0.001 || m_dir[2] < -0.001) { + local10 = (p_position[2] - (*m_pointA)[2]) / m_dir[2]; if (result) { if (localc > local10 + 0.001 || localc < local10 - 0.001) { @@ -168,4 +168,4 @@ inline LegoU32 LegoUnknown100db7f4::FUN_10048c40(const Vector3& p_position) return TRUE; } -#endif // __LEGOUNKNOWN100DB7F4_H +#endif // __LEGOORIENTEDEDGE_H diff --git a/LEGO1/lego/sources/geom/legounkown100db7f4.cpp b/LEGO1/lego/sources/geom/legounkown100db7f4.cpp deleted file mode 100644 index 25740067..00000000 --- a/LEGO1/lego/sources/geom/legounkown100db7f4.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "legounkown100db7f4.h" - -DECOMP_SIZE_ASSERT(LegoUnknown100db7f4, 0x40) - -// FUNCTION: LEGO1 0x1009a630 -// FUNCTION: BETA10 0x10183050 -LegoUnknown100db7f4::LegoUnknown100db7f4() -{ - m_flags = 0; - m_unk0x28.Clear(); - m_unk0x3c = 0.0f; -} diff --git a/LEGO1/lego/sources/geom/legoweedge.cpp b/LEGO1/lego/sources/geom/legoweedge.cpp index 862b247d..be522c4c 100644 --- a/LEGO1/lego/sources/geom/legoweedge.cpp +++ b/LEGO1/lego/sources/geom/legoweedge.cpp @@ -1,6 +1,6 @@ #include "legoweedge.h" -#include "legounkown100db7f4.h" +#include "legoorientededge.h" DECOMP_SIZE_ASSERT(LegoWEEdge, 0x0c) @@ -20,11 +20,11 @@ LegoWEEdge::~LegoWEEdge() } // FUNCTION: LEGO1 0x1009a5b0 -LegoS32 LegoWEEdge::VTable0x04() +LegoS32 LegoWEEdge::LinkEdgesAndFaces() { for (LegoS32 i = 0; i < m_numEdges; i++) { - LegoUnknown100db7f4* e1 = m_edges[i]; - LegoUnknown100db7f4* e2 = (m_numEdges - i) == 1 ? m_edges[0] : m_edges[i + 1]; + LegoOrientedEdge* e1 = m_edges[i]; + LegoOrientedEdge* e2 = (m_numEdges - i) == 1 ? m_edges[0] : m_edges[i + 1]; if (e2->m_pointA == e1->m_pointA) { e1->m_faceA = this; diff --git a/LEGO1/lego/sources/geom/legoweedge.h b/LEGO1/lego/sources/geom/legoweedge.h index c2df2758..7e0e9bae 100644 --- a/LEGO1/lego/sources/geom/legoweedge.h +++ b/LEGO1/lego/sources/geom/legoweedge.h @@ -4,7 +4,7 @@ #include "decomp.h" #include "misc/legotypes.h" -struct LegoUnknown100db7f4; +struct LegoOrientedEdge; // might be a struct with public members // VTABLE: LEGO1 0x100db7c0 @@ -14,18 +14,19 @@ class LegoWEEdge { LegoWEEdge(); virtual ~LegoWEEdge(); // vtable+0x00 - virtual LegoS32 VTable0x04(); // vtable+0x04 + virtual LegoS32 LinkEdgesAndFaces(); // vtable+0x04 // FUNCTION: BETA10 0x1001c980 LegoU8 GetNumEdges() { return m_numEdges; } // FUNCTION: BETA10 0x1001cc30 - LegoUnknown100db7f4** GetEdges() { return m_edges; } + LegoOrientedEdge** GetEdges() { return m_edges; } // FUNCTION: BETA10 0x100373f0 LegoU32 IsEqual(LegoWEEdge* p_other) { return this == p_other; } - void SetEdges(LegoUnknown100db7f4** p_edges, LegoU8 p_numEdges) + // FUNCTION: BETA10 0x100bd410 + void SetEdges(LegoOrientedEdge** p_edges, LegoU8 p_numEdges) { m_edges = p_edges; m_numEdges = p_numEdges; @@ -35,8 +36,8 @@ class LegoWEEdge { // LegoWEEdge::`scalar deleting destructor' protected: - LegoU8 m_numEdges; // 0x04 - LegoUnknown100db7f4** m_edges; // 0x08 + LegoU8 m_numEdges; // 0x04 + LegoOrientedEdge** m_edges; // 0x08 }; #endif // __LEGOWEEDGE_H diff --git a/LEGO1/lego/sources/geom/legowegedge.cpp b/LEGO1/lego/sources/geom/legowegedge.cpp index 110cd2c6..df37ab12 100644 --- a/LEGO1/lego/sources/geom/legowegedge.cpp +++ b/LEGO1/lego/sources/geom/legowegedge.cpp @@ -1,6 +1,6 @@ #include "legowegedge.h" -#include "legounkown100db7f4.h" +#include "legoorientededge.h" #include @@ -13,12 +13,12 @@ LegoWEGEdge::LegoWEGEdge() { m_unk0x0d = 0; m_name = NULL; - m_unk0x14.Clear(); + m_up.Clear(); m_edgeNormals = NULL; m_flags = 0; m_numTriggers = 0; m_pathTrigger = NULL; - m_unk0x50 = NULL; + m_direction = NULL; } // FUNCTION: LEGO1 0x1009a800 @@ -35,20 +35,20 @@ LegoWEGEdge::~LegoWEGEdge() delete[] m_edgeNormals; } if (m_pathTrigger) { - delete m_pathTrigger; + delete[] m_pathTrigger; } - if (m_unk0x50) { - delete m_unk0x50; + if (m_direction) { + delete m_direction; } } // FUNCTION: LEGO1 0x1009a8c0 // FUNCTION: BETA10 0x101832f7 -LegoS32 LegoWEGEdge::VTable0x04() +LegoS32 LegoWEGEdge::LinkEdgesAndFaces() { LegoS32 result = 0; - m_unk0x30.Clear(); - LegoWEEdge::VTable0x04(); + m_centerPoint.Clear(); + LegoWEEdge::LinkEdgesAndFaces(); assert(m_numEdges > 1); @@ -72,7 +72,7 @@ LegoS32 LegoWEGEdge::VTable0x04() local14 = m_edges[1]->m_pointB; } - result = FUN_1009aea0(); + result = ValidateFacePlanarity(); if (result != 0) { result = -2; } @@ -81,73 +81,73 @@ LegoS32 LegoWEGEdge::VTable0x04() m_edgeNormals = new Mx4DPointFloat[m_numEdges]; assert(m_edgeNormals); - LegoUnknown100db7f4* edge; + LegoOrientedEdge* edge; LegoS32 i; for (i = 0; i < m_numEdges; i++) { edge = m_edges[i]; - m_unk0x30 += *edge->m_pointA; - m_unk0x30 += *edge->m_pointB; + m_centerPoint += *edge->m_pointA; + m_centerPoint += *edge->m_pointB; } - m_unk0x30 /= m_numEdges * 2; - m_unk0x44 = 0.0f; + m_centerPoint /= m_numEdges * 2; + m_boundingRadius = 0.0f; for (i = 0; i < m_numEdges; i++) { Mx3DPointFloat local44; edge = m_edges[i]; local44 = *edge->m_pointA; - local44 -= m_unk0x30; + local44 -= m_centerPoint; float length = local44.LenSquared(); - if (m_unk0x44 < length) { - m_unk0x44 = length; + if (m_boundingRadius < length) { + m_boundingRadius = length; } local44 = *edge->m_pointB; - local44 -= m_unk0x30; + local44 -= m_centerPoint; length = local44.LenSquared(); - if (m_unk0x44 < length) { - m_unk0x44 = length; + if (m_boundingRadius < length) { + m_boundingRadius = length; } } - m_unk0x44 = sqrt((double) m_unk0x44); + m_boundingRadius = sqrt((double) m_boundingRadius); for (i = 0; i < m_numEdges; i++) { edge = m_edges[i]; - Vector3& local5c = edge->m_unk0x28; + Vector3& local5c = edge->m_dir; - if (edge->m_unk0x3c == 0) { + if (edge->m_length == 0) { local5c = *m_edges[i]->m_pointB; local5c -= *m_edges[i]->m_pointA; - edge->m_unk0x3c = local5c.LenSquared(); + edge->m_length = local5c.LenSquared(); - if (edge->m_unk0x3c <= 0.0f) { + if (edge->m_length <= 0.0f) { assert(0); if (result == 0) { result = -1; } } - edge->m_unk0x3c = sqrt((double) edge->m_unk0x3c); - local5c /= edge->m_unk0x3c; + edge->m_length = sqrt((double) edge->m_length); + local5c /= edge->m_length; } Mx3DPointFloat local58; Vector3 local64(&m_edgeNormals[i][0]); - edge->FUN_1002ddc0(*this, local58); - local64.EqualsCross(local58, m_unk0x14); + edge->GetFaceNormal(*this, local58); + local64.EqualsCross(local58, m_up); m_edgeNormals[i][3] = -local64.Dot(*m_edges[i]->m_pointA, local64); - if (m_edgeNormals[i][3] + m_unk0x30.Dot(m_unk0x30, local64) < 0.0f) { + if (m_edgeNormals[i][3] + m_centerPoint.Dot(m_centerPoint, local64) < 0.0f) { m_edgeNormals[i] *= -1.0f; } if (edge->GetFaceA() != NULL && edge->GetFaceB() != NULL) { - edge->SetFlags(LegoUnknown100db7f4::c_bit1 | LegoUnknown100db7f4::c_bit2); + edge->SetFlags(LegoOrientedEdge::c_bit1 | LegoOrientedEdge::c_bit2); } } @@ -156,14 +156,14 @@ LegoS32 LegoWEGEdge::VTable0x04() Vector3* vTrig2 = m_edges[1]->CCWVertex(*this); assert(vTrig1 && vTrig2); - m_unk0x50 = new Mx3DPointFloat(); - *m_unk0x50 = *vTrig2; - *m_unk0x50 -= *vTrig1; + m_direction = new Mx3DPointFloat(); + *m_direction = *vTrig2; + *m_direction -= *vTrig1; - if (m_unk0x50->Unitize() < 0) { + if (m_direction->Unitize() < 0) { assert(0); - delete m_unk0x50; - m_unk0x50 = NULL; + delete m_direction; + m_direction = NULL; } if (GetNumEdges() == 4) { @@ -178,12 +178,12 @@ LegoS32 LegoWEGEdge::VTable0x04() localb8 -= *vTrig1; local80 -= *vTrig1; - float locala4 = localb8.Dot(*m_unk0x50, localb8); + float locala4 = localb8.Dot(*m_direction, localb8); if (local98 < locala4) { local98 = locala4; } - locala4 = local80.Dot(*m_unk0x50, local80); + locala4 = local80.Dot(*m_direction, local80); if (locala4 < local9c) { local9c = locala4; } @@ -199,12 +199,12 @@ LegoS32 LegoWEGEdge::VTable0x04() local9c -= 0.001; for (LegoS32 j = 0; j < m_numTriggers; j++) { - if (m_pathTrigger[j].m_unk0x08 < local98) { - m_pathTrigger[j].m_unk0x08 = local98; + if (m_pathTrigger[j].m_triggerLength < local98) { + m_pathTrigger[j].m_triggerLength = local98; } - if (m_pathTrigger[j].m_unk0x08 > local9c) { - m_pathTrigger[j].m_unk0x08 = local9c; + if (m_pathTrigger[j].m_triggerLength > local9c) { + m_pathTrigger[j].m_triggerLength = local9c; } } } @@ -218,7 +218,7 @@ LegoS32 LegoWEGEdge::VTable0x04() // FUNCTION: LEGO1 0x1009aea0 // FUNCTION: BETA10 0x10183e2a -LegoS32 LegoWEGEdge::FUN_1009aea0() +LegoS32 LegoWEGEdge::ValidateFacePlanarity() { LegoU32 localc = FALSE; Mx3DPointFloat local24; @@ -255,17 +255,17 @@ LegoS32 LegoWEGEdge::FUN_1009aea0() local24 /= local58; if (localc) { - float local54 = local24.Dot(m_unk0x14, local24); + float local54 = local24.Dot(m_up, local24); if (local54 < 0.98) { delete[] local8; return -2; } } else { - m_unk0x14[0] = local24[0]; - m_unk0x14[1] = local24[1]; - m_unk0x14[2] = local24[2]; - m_unk0x14[3] = -local8[i]->Dot(*local8[i], local24); + m_up[0] = local24[0]; + m_up[1] = local24[1]; + m_up[2] = local24[2]; + m_up[3] = -local8[i]->Dot(*local8[i], local24); localc = TRUE; } } diff --git a/LEGO1/lego/sources/geom/legowegedge.h b/LEGO1/lego/sources/geom/legowegedge.h index 7ff23c10..c2929079 100644 --- a/LEGO1/lego/sources/geom/legowegedge.h +++ b/LEGO1/lego/sources/geom/legowegedge.h @@ -16,12 +16,12 @@ struct PathWithTrigger { { m_pathStruct = NULL; m_data = 0; - m_unk0x08 = 0.0f; + m_triggerLength = 0.0f; } LegoPathStruct* m_pathStruct; // 0x00 unsigned int m_data; // 0x04 - float m_unk0x08; // 0x08 + float m_triggerLength; // 0x08 }; #include "mxgeometry/mxgeometry3d.h" @@ -42,7 +42,7 @@ class LegoWEGEdge : public LegoWEEdge { LegoWEGEdge(); ~LegoWEGEdge() override; - LegoS32 VTable0x04() override; // vtable+0x04 + LegoS32 LinkEdgesAndFaces() override; // vtable+0x04 // FUNCTION: BETA10 0x100270c0 LegoU32 GetFlag0x10() @@ -57,7 +57,7 @@ class LegoWEGEdge : public LegoWEEdge { // TODO: Other BETA10 reference at 0x1001c9e0, not sure what is going on // FUNCTION: BETA10 0x1001ff80 - Mx4DPointFloat* GetUnknown0x14() { return &m_unk0x14; } + Mx4DPointFloat* GetUp() { return &m_up; } // FUNCTION: BETA10 0x1001ca10 Mx4DPointFloat* GetEdgeNormal(int index) { return &m_edgeNormals[index]; } @@ -85,18 +85,18 @@ class LegoWEGEdge : public LegoWEEdge { friend class LegoPathController; protected: - LegoS32 FUN_1009aea0(); + LegoS32 ValidateFacePlanarity(); LegoU8 m_flags; // 0x0c LegoU8 m_unk0x0d; // 0x0d LegoChar* m_name; // 0x10 - Mx4DPointFloat m_unk0x14; // 0x14 + Mx4DPointFloat m_up; // 0x14 Mx4DPointFloat* m_edgeNormals; // 0x2c - Mx3DPointFloat m_unk0x30; // 0x30 - float m_unk0x44; // 0x44 + Mx3DPointFloat m_centerPoint; // 0x30 + float m_boundingRadius; // 0x44 LegoU8 m_numTriggers; // 0x48 PathWithTrigger* m_pathTrigger; // 0x4c - Mx3DPointFloat* m_unk0x50; // 0x50 + Mx3DPointFloat* m_direction; // 0x50 }; #endif // __LEGOWEGEDGE_H diff --git a/LEGO1/lego/sources/misc/legocontainer.cpp b/LEGO1/lego/sources/misc/legocontainer.cpp index d9bdc0eb..771ce907 100644 --- a/LEGO1/lego/sources/misc/legocontainer.cpp +++ b/LEGO1/lego/sources/misc/legocontainer.cpp @@ -63,7 +63,7 @@ LegoTextureInfo* LegoTextureContainer::GetCached(LegoTextureInfo* p_textureInfo) newDesc.dwHeight = desc.dwHeight; newDesc.dwSize = sizeof(newDesc); newDesc.dwFlags = DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS; - newDesc.ddsCaps.dwCaps = DDCAPS_OVERLAYCANTCLIP | DDCAPS_OVERLAY; + newDesc.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_SYSTEMMEMORY; newDesc.ddpfPixelFormat.dwSize = sizeof(desc.ddpfPixelFormat); newDesc.ddpfPixelFormat.dwFlags = DDPF_RGB | DDPF_PALETTEINDEXED8; newDesc.ddpfPixelFormat.dwRGBBitCount = 8; diff --git a/LEGO1/lego/sources/misc/legoimage.cpp b/LEGO1/lego/sources/misc/legoimage.cpp index da3f04a0..d3fcab18 100644 --- a/LEGO1/lego/sources/misc/legoimage.cpp +++ b/LEGO1/lego/sources/misc/legoimage.cpp @@ -19,13 +19,13 @@ LegoPaletteEntry::LegoPaletteEntry() LegoResult LegoPaletteEntry::Read(LegoStorage* p_storage) { LegoResult result; - if ((result = p_storage->Read(&m_red, sizeof(m_red))) != SUCCESS) { + if ((result = p_storage->Read(&m_red, sizeof(LegoU8))) != SUCCESS) { return result; } - if ((result = p_storage->Read(&m_green, sizeof(m_green))) != SUCCESS) { + if ((result = p_storage->Read(&m_green, sizeof(LegoU8))) != SUCCESS) { return result; } - if ((result = p_storage->Read(&m_blue, sizeof(m_blue))) != SUCCESS) { + if ((result = p_storage->Read(&m_blue, sizeof(LegoU8))) != SUCCESS) { return result; } return SUCCESS; @@ -35,13 +35,13 @@ LegoResult LegoPaletteEntry::Read(LegoStorage* p_storage) LegoResult LegoPaletteEntry::Write(LegoStorage* p_storage) { LegoResult result; - if ((result = p_storage->Write(&m_red, sizeof(m_red))) != SUCCESS) { + if ((result = p_storage->Write(&m_red, sizeof(LegoU8))) != SUCCESS) { return result; } - if ((result = p_storage->Write(&m_green, sizeof(m_green))) != SUCCESS) { + if ((result = p_storage->Write(&m_green, sizeof(LegoU8))) != SUCCESS) { return result; } - if ((result = p_storage->Write(&m_blue, sizeof(m_blue))) != SUCCESS) { + if ((result = p_storage->Write(&m_blue, sizeof(LegoU8))) != SUCCESS) { return result; } return SUCCESS; @@ -77,13 +77,13 @@ LegoImage::~LegoImage() LegoResult LegoImage::Read(LegoStorage* p_storage, LegoU32 p_square) { LegoResult result; - if ((result = p_storage->Read(&m_width, sizeof(m_width))) != SUCCESS) { + if ((result = p_storage->Read(&m_width, sizeof(LegoU32))) != SUCCESS) { return result; } - if ((result = p_storage->Read(&m_height, sizeof(m_height))) != SUCCESS) { + if ((result = p_storage->Read(&m_height, sizeof(LegoU32))) != SUCCESS) { return result; } - if ((result = p_storage->Read(&m_count, sizeof(m_height))) != SUCCESS) { + if ((result = p_storage->Read(&m_count, sizeof(LegoU32))) != SUCCESS) { return result; } for (LegoU32 i = 0; i < m_count; i++) { @@ -153,13 +153,13 @@ LegoResult LegoImage::Read(LegoStorage* p_storage, LegoU32 p_square) LegoResult LegoImage::Write(LegoStorage* p_storage) { LegoResult result; - if ((result = p_storage->Write(&m_width, sizeof(m_width))) != SUCCESS) { + if ((result = p_storage->Write(&m_width, sizeof(LegoU32))) != SUCCESS) { return result; } - if ((result = p_storage->Write(&m_height, sizeof(m_height))) != SUCCESS) { + if ((result = p_storage->Write(&m_height, sizeof(LegoU32))) != SUCCESS) { return result; } - if ((result = p_storage->Write(&m_count, sizeof(m_height))) != SUCCESS) { + if ((result = p_storage->Write(&m_count, sizeof(LegoU32))) != SUCCESS) { return result; } for (LegoU32 i = 0; i < m_count; i++) { diff --git a/LEGO1/lego/sources/misc/legostorage.h b/LEGO1/lego/sources/misc/legostorage.h index 60ee9015..26d107c9 100644 --- a/LEGO1/lego/sources/misc/legostorage.h +++ b/LEGO1/lego/sources/misc/legostorage.h @@ -45,21 +45,21 @@ class LegoStorage { // FUNCTION: BETA10 0x1004b0d0 LegoStorage* WriteU8(LegoU8 p_data) { - Write(&p_data, sizeof(p_data)); + Write(&p_data, sizeof(LegoU8)); return this; } // FUNCTION: BETA10 0x10017ce0 LegoStorage* WriteS16(LegoS16 p_data) { - Write(&p_data, sizeof(p_data)); + Write(&p_data, sizeof(LegoS16)); return this; } // FUNCTION: BETA10 0x1004b110 LegoStorage* WriteU16(LegoU16 p_data) { - Write(&p_data, sizeof(p_data)); + Write(&p_data, sizeof(LegoU16)); return this; } @@ -67,7 +67,7 @@ class LegoStorage { // FUNCTION: BETA10 0x10088540 LegoStorage* WriteS32(MxS32 p_data) { - Write(&p_data, sizeof(p_data)); + Write(&p_data, sizeof(MxS32)); return this; } @@ -75,14 +75,14 @@ class LegoStorage { // FUNCTION: BETA10 0x1004b150 LegoStorage* WriteU32(MxU32 p_data) { - Write(&p_data, sizeof(p_data)); + Write(&p_data, sizeof(MxU32)); return this; } // FUNCTION: BETA10 0x10073610 LegoStorage* WriteFloat(LegoFloat p_data) { - Write(&p_data, sizeof(p_data)); + Write(&p_data, sizeof(LegoFloat)); return this; } @@ -116,21 +116,21 @@ class LegoStorage { // FUNCTION: BETA10 0x1004b190 LegoStorage* ReadU8(LegoU8& p_data) { - Read(&p_data, sizeof(p_data)); + Read(&p_data, sizeof(LegoU8)); return this; } // FUNCTION: BETA10 0x10024680 LegoStorage* ReadS16(LegoS16& p_data) { - Read(&p_data, sizeof(p_data)); + Read(&p_data, sizeof(LegoS16)); return this; } // FUNCTION: BETA10 0x1004b1d0 LegoStorage* ReadU16(LegoU16& p_data) { - Read(&p_data, sizeof(p_data)); + Read(&p_data, sizeof(LegoU16)); return this; } @@ -138,7 +138,7 @@ class LegoStorage { // FUNCTION: BETA10 0x10088580 LegoStorage* ReadS32(MxS32& p_data) { - Read(&p_data, sizeof(p_data)); + Read(&p_data, sizeof(MxS32)); return this; } @@ -146,14 +146,14 @@ class LegoStorage { // FUNCTION: BETA10 0x1004b210 LegoStorage* ReadU32(MxU32& p_data) { - Read(&p_data, sizeof(p_data)); + Read(&p_data, sizeof(MxU32)); return this; } // FUNCTION: BETA10 0x10073650 LegoStorage* ReadFloat(LegoFloat& p_data) { - Read(&p_data, sizeof(p_data)); + Read(&p_data, sizeof(LegoFloat)); return this; } diff --git a/LEGO1/lego/sources/misc/legotree.cpp b/LEGO1/lego/sources/misc/legotree.cpp index f9fb626a..55d60f5f 100644 --- a/LEGO1/lego/sources/misc/legotree.cpp +++ b/LEGO1/lego/sources/misc/legotree.cpp @@ -64,7 +64,7 @@ LegoResult LegoTree::Read(LegoStorage* p_storage, LegoTreeNode*& p_node) return result; } LegoU32 numChildren; - if ((result = p_storage->Read(&numChildren, sizeof(numChildren))) != SUCCESS) { + if ((result = p_storage->Read(&numChildren, sizeof(LegoU32))) != SUCCESS) { return result; } if (numChildren) { @@ -91,7 +91,7 @@ LegoResult LegoTree::Write(LegoStorage* p_storage, LegoTreeNode* p_node) } } LegoU32 numChildren = p_node->GetNumChildren(); - if ((result = p_storage->Write(&numChildren, sizeof(numChildren))) != SUCCESS) { + if ((result = p_storage->Write(&numChildren, sizeof(LegoU32))) != SUCCESS) { return result; } for (LegoU32 i = 0; i < p_node->GetNumChildren(); i++) { diff --git a/LEGO1/lego/sources/roi/legolod.cpp b/LEGO1/lego/sources/roi/legolod.cpp index 7db2a0a9..453a4dac 100644 --- a/LEGO1/lego/sources/roi/legolod.cpp +++ b/LEGO1/lego/sources/roi/legolod.cpp @@ -16,7 +16,7 @@ DECOMP_SIZE_ASSERT(LegoLOD::Mesh, 0x08) LPDIRECT3DRMMATERIAL g_unk0x101013d4 = NULL; // GLOBAL: LEGO1 0x101013dc -const char* g_unk0x101013dc = "inh"; +const char* g_InhPrefix = "inh"; inline IDirect3DRM2* GetD3DRM(Tgl::Renderer* pRenderer); inline BOOL GetMeshData(IDirect3DRMMesh*& mesh, D3DRMGROUPINDEX& index, Tgl::Mesh* pMesh); @@ -32,7 +32,7 @@ LegoLOD::LegoLOD(Tgl::Renderer* p_renderer) : ViewLOD(p_renderer) m_numMeshes = 0; m_numVertices = 0; m_numPolys = 0; - m_unk0x1c = 0; + m_meshOffset = 0; } // FUNCTION: LEGO1 0x100aa450 @@ -66,64 +66,64 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text LegoU32(*textureIndices)[3] = NULL; LegoTextureInfo* textureInfo = NULL; - LegoU32 i, meshUnd1, meshUnd2, tempNumVertsAndNormals; + LegoU32 i, indexBackwards, indexForwards, tempNumVertsAndNormals; unsigned char paletteEntries[256]; - if (p_storage->Read(&m_unk0x08, sizeof(m_unk0x08)) != SUCCESS) { + if (p_storage->Read(&m_flags, sizeof(LegoU32)) != SUCCESS) { goto done; } - if (GetUnknown0x08Test4()) { + if (SkipReadingData()) { return SUCCESS; } m_meshBuilder = p_renderer->CreateMeshBuilder(); - if (p_storage->Read(&m_numMeshes, sizeof(m_numMeshes)) != SUCCESS) { + if (p_storage->Read(&m_numMeshes, sizeof(LegoU32)) != SUCCESS) { goto done; } if (m_numMeshes == 0) { - ClearFlag(c_bit4); + ClearFlag(c_hasMesh); return SUCCESS; } - SetFlag(c_bit4); + SetFlag(c_hasMesh); m_melems = new Mesh[m_numMeshes]; memset(m_melems, 0, sizeof(*m_melems) * m_numMeshes); - meshUnd1 = m_numMeshes - 1; - meshUnd2 = 0; + indexBackwards = m_numMeshes - 1; + indexForwards = 0; - if (p_storage->Read(&tempNumVertsAndNormals, sizeof(tempNumVertsAndNormals)) != SUCCESS) { + if (p_storage->Read(&tempNumVertsAndNormals, sizeof(LegoU32)) != SUCCESS) { goto done; } numVerts = *((LegoU16*) &tempNumVertsAndNormals) & MAXSHORT; numNormals = (*((LegoU16*) &tempNumVertsAndNormals + 1) >> 1) & MAXSHORT; - if (p_storage->Read(&numTextureVertices, sizeof(numTextureVertices)) != SUCCESS) { + if (p_storage->Read(&numTextureVertices, sizeof(LegoS32)) != SUCCESS) { goto done; } if (numVerts > 0) { vertices = new float[numVerts][sizeOfArray(*vertices)]; - if (p_storage->Read(vertices, numVerts * sizeof(*vertices)) != SUCCESS) { + if (p_storage->Read(vertices, numVerts * 3 * sizeof(float)) != SUCCESS) { goto done; } } if (numNormals > 0) { normals = new float[numNormals][sizeOfArray(*normals)]; - if (p_storage->Read(normals, numNormals * sizeof(*normals)) != SUCCESS) { + if (p_storage->Read(normals, numNormals * 3 * sizeof(float)) != SUCCESS) { goto done; } } if (numTextureVertices > 0) { textureVertices = new float[numTextureVertices][sizeOfArray(*textureVertices)]; - if (p_storage->Read(textureVertices, numTextureVertices * sizeof(*textureVertices)) != SUCCESS) { + if (p_storage->Read(textureVertices, numTextureVertices * 2 * sizeof(float)) != SUCCESS) { goto done; } } @@ -144,7 +144,7 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text } polyIndices = new LegoU32[numPolys & USHRT_MAX][sizeOfArray(*polyIndices)]; - if (p_storage->Read(polyIndices, (numPolys & USHRT_MAX) * sizeof(*polyIndices)) != SUCCESS) { + if (p_storage->Read(polyIndices, (numPolys & USHRT_MAX) * 3 * sizeof(LegoU32)) != SUCCESS) { goto done; } @@ -154,7 +154,7 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text if (numTextureIndices > 0) { textureIndices = new LegoU32[numPolys & USHRT_MAX][sizeOfArray(*textureIndices)]; - if (p_storage->Read(textureIndices, (numPolys & USHRT_MAX) * sizeof(*textureIndices)) != SUCCESS) { + if (p_storage->Read(textureIndices, (numPolys & USHRT_MAX) * 3 * sizeof(LegoU32)) != SUCCESS) { goto done; } } @@ -184,13 +184,13 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text textureName = mesh->GetTextureName(); materialName = mesh->GetMaterialName(); - if (FUN_100aae20(textureName) || FUN_100aae20(materialName)) { - meshIndex = meshUnd1; - meshUnd1--; + if (HasInhPrefix(textureName) || HasInhPrefix(materialName)) { + meshIndex = indexBackwards; + indexBackwards--; } else { - meshIndex = meshUnd2; - meshUnd2++; + meshIndex = indexForwards; + indexForwards++; } m_melems[meshIndex].m_tglMesh = m_meshBuilder->CreateMesh( @@ -211,8 +211,8 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text m_melems[meshIndex].m_tglMesh->SetShadingModel(shadingModel); if (textureName != NULL) { - if (mesh->GetUnknown0x21()) { - LegoROI::FUN_100a9cf0(textureName, paletteEntries, sizeOfArray(paletteEntries)); + if (mesh->GetUseAlias()) { + LegoROI::GetPaletteEntries(textureName, paletteEntries, sizeOfArray(paletteEntries)); } textureInfo = p_textureContainer->Get(mesh->GetTextureName()); @@ -223,7 +223,7 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text m_melems[meshIndex].m_tglMesh->SetColor(1.0F, 1.0F, 1.0F, 0.0F); LegoTextureInfo::SetGroupTexture(m_melems[meshIndex].m_tglMesh, textureInfo); - m_melems[meshIndex].m_unk0x04 = TRUE; + m_melems[meshIndex].m_textured = TRUE; } else { LegoFloat red = 1.0F; @@ -231,8 +231,8 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text LegoFloat blue = 1.0F; LegoFloat alpha = 0.0F; - if (mesh->GetUnknown0x21()) { - LegoROI::FUN_100a9bf0(materialName, red, green, blue, alpha); + if (mesh->GetUseAlias()) { + LegoROI::GetRGBAColor(materialName, red, green, blue, alpha); } else { red = mesh->GetColor().GetRed() / 255.0; @@ -265,7 +265,7 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text } } - m_unk0x1c = meshUnd2; + m_meshOffset = indexForwards; if (textureVertices != NULL) { delete[] textureVertices; @@ -312,23 +312,23 @@ LegoLOD* LegoLOD::Clone(Tgl::Renderer* p_renderer) for (LegoU32 i = 0; i < m_numMeshes; i++) { dupLod->m_melems[i].m_tglMesh = m_melems[i].m_tglMesh->ShallowClone(dupLod->m_meshBuilder); - dupLod->m_melems[i].m_unk0x04 = m_melems[i].m_unk0x04; + dupLod->m_melems[i].m_textured = m_melems[i].m_textured; } - dupLod->m_unk0x08 = m_unk0x08; + dupLod->m_flags = m_flags; dupLod->m_numMeshes = m_numMeshes; dupLod->m_numVertices = m_numVertices; dupLod->m_numPolys = m_numPolys; - dupLod->m_unk0x1c = m_unk0x1c; + dupLod->m_meshOffset = m_meshOffset; return dupLod; } // FUNCTION: LEGO1 0x100aacb0 -LegoResult LegoLOD::FUN_100aacb0(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha) +LegoResult LegoLOD::SetColor(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha) { - for (LegoU32 i = m_unk0x1c; i < m_numMeshes; i++) { - if (!m_melems[i].m_unk0x04) { + for (LegoU32 i = m_meshOffset; i < m_numMeshes; i++) { + if (!m_melems[i].m_textured) { m_melems[i].m_tglMesh->SetColor(p_red, p_green, p_blue, p_alpha); } } @@ -337,13 +337,13 @@ LegoResult LegoLOD::FUN_100aacb0(LegoFloat p_red, LegoFloat p_green, LegoFloat p } // FUNCTION: LEGO1 0x100aad00 -LegoResult LegoLOD::FUN_100aad00(LegoTextureInfo* p_textureInfo) +LegoResult LegoLOD::SetTextureInfo(LegoTextureInfo* p_textureInfo) { - for (LegoU32 i = m_unk0x1c; i < m_numMeshes; i++) { - if (m_melems[i].m_unk0x04) { + for (LegoU32 i = m_meshOffset; i < m_numMeshes; i++) { + if (m_melems[i].m_textured) { LegoTextureInfo::SetGroupTexture(m_melems[i].m_tglMesh, p_textureInfo); m_melems[i].m_tglMesh->SetColor(1.0F, 1.0F, 1.0F, 0.0F); - m_melems[i].m_unk0x04 = TRUE; + m_melems[i].m_textured = TRUE; } } @@ -351,10 +351,10 @@ LegoResult LegoLOD::FUN_100aad00(LegoTextureInfo* p_textureInfo) } // FUNCTION: LEGO1 0x100aad70 -LegoResult LegoLOD::FUN_100aad70(LegoTextureInfo* p_textureInfo) +LegoResult LegoLOD::UpdateTextureInfo(LegoTextureInfo* p_textureInfo) { - for (LegoU32 i = m_unk0x1c; i < m_numMeshes; i++) { - if (m_melems[i].m_unk0x04) { + for (LegoU32 i = m_meshOffset; i < m_numMeshes; i++) { + if (m_melems[i].m_textured) { LegoTextureInfo::SetGroupTexture(m_melems[i].m_tglMesh, p_textureInfo); } } @@ -363,10 +363,10 @@ LegoResult LegoLOD::FUN_100aad70(LegoTextureInfo* p_textureInfo) } // FUNCTION: LEGO1 0x100aadc0 -LegoResult LegoLOD::GetTexture(LegoTextureInfo*& p_textureInfo) +LegoResult LegoLOD::GetTextureInfo(LegoTextureInfo*& p_textureInfo) { - for (LegoU32 i = m_unk0x1c; i < m_numMeshes; i++) { - if (m_melems[i].m_unk0x04) { + for (LegoU32 i = m_meshOffset; i < m_numMeshes; i++) { + if (m_melems[i].m_textured) { if (LegoTextureInfo::GetGroupTexture(m_melems[i].m_tglMesh, p_textureInfo) == TRUE) { return SUCCESS; } @@ -377,10 +377,10 @@ LegoResult LegoLOD::GetTexture(LegoTextureInfo*& p_textureInfo) } // FUNCTION: LEGO1 0x100aae20 -LegoBool LegoLOD::FUN_100aae20(const LegoChar* p_name) +LegoBool LegoLOD::HasInhPrefix(const LegoChar* p_name) { if (p_name != NULL) { - if (!strnicmp(p_name, g_unk0x101013dc, strlen(g_unk0x101013dc))) { + if (!strnicmp(p_name, g_InhPrefix, strlen(g_InhPrefix))) { return TRUE; } } @@ -390,9 +390,9 @@ LegoBool LegoLOD::FUN_100aae20(const LegoChar* p_name) // FUNCTION: LEGO1 0x100aae60 // FUNCTION: BETA10 0x1018e50f -void LegoLOD::FUN_100aae60() +void LegoLOD::ClearMeshOffset() { - m_unk0x1c = 0; + m_meshOffset = 0; } inline BOOL GetMeshData(IDirect3DRMMesh*& mesh, D3DRMGROUPINDEX& index, Tgl::Mesh* pMesh) diff --git a/LEGO1/lego/sources/roi/legolod.h b/LEGO1/lego/sources/roi/legolod.h index 0d50e675..e787d377 100644 --- a/LEGO1/lego/sources/roi/legolod.h +++ b/LEGO1/lego/sources/roi/legolod.h @@ -15,7 +15,7 @@ class LegoLOD : public ViewLOD { // SIZE 0x08 struct Mesh { Tgl::Mesh* m_tglMesh; // 0x00 - BOOL m_unk0x04; // 0x04 + BOOL m_textured; // 0x04 }; LegoLOD(Tgl::Renderer*); @@ -29,13 +29,13 @@ class LegoLOD : public ViewLOD { LegoResult Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_textureContainer, LegoStorage* p_storage); LegoLOD* Clone(Tgl::Renderer* p_renderer); - LegoResult FUN_100aacb0(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha); - LegoResult FUN_100aad00(LegoTextureInfo* p_textureInfo); - LegoResult FUN_100aad70(LegoTextureInfo* p_textureInfo); - void FUN_100aae60(); - LegoResult GetTexture(LegoTextureInfo*& p_textureInfo); + LegoResult SetColor(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha); + LegoResult SetTextureInfo(LegoTextureInfo* p_textureInfo); + LegoResult UpdateTextureInfo(LegoTextureInfo* p_textureInfo); + void ClearMeshOffset(); + LegoResult GetTextureInfo(LegoTextureInfo*& p_textureInfo); - static LegoBool FUN_100aae20(const LegoChar* p_name); + static LegoBool HasInhPrefix(const LegoChar* p_name); // SYNTHETIC: LEGO1 0x100aa430 // LegoLOD::`scalar deleting destructor' @@ -45,7 +45,7 @@ class LegoLOD : public ViewLOD { LegoU32 m_numMeshes; // 0x10 LegoU32 m_numVertices; // 0x14 LegoU32 m_numPolys; // 0x18 - undefined4 m_unk0x1c; // 0x1c + LegoU32 m_meshOffset; // 0x1c }; #endif // LEGOLOD_H diff --git a/LEGO1/lego/sources/roi/legoroi.cpp b/LEGO1/lego/sources/roi/legoroi.cpp index 25d6fb36..afd5f711 100644 --- a/LEGO1/lego/sources/roi/legoroi.cpp +++ b/LEGO1/lego/sources/roi/legoroi.cpp @@ -52,14 +52,18 @@ const char* g_unk0x10101380[] = {"bike", "moto", "haus", NULL}; const char* g_unk0x10101390[] = {"rcuser", "jsuser", "dunebugy", "chtrblad", "chtrbody", "chtrshld", NULL}; // GLOBAL: LEGO1 0x101013ac -ROIHandler g_unk0x101013ac = NULL; +ColorOverride g_colorOverride = NULL; // GLOBAL: LEGO1 0x101013b0 -TextureHandler g_unk0x101013b0 = NULL; +TextureHandler g_textureHandler = NULL; // FUNCTION: LEGO1 0x100a81b0 -void LegoROI::FUN_100a81b0(const LegoChar* p_error, const LegoChar* p_name) +// FUNCTION: BETA10 0x101898c0 +// FUNCTION: ALPHA 0x100bb1c0 +void LegoROI::FUN_100a81b0(const LegoChar* p_error, ...) { + // Probably a printf-like debug function that was removed early. + // No known implementation in any of the binaries. } // FUNCTION: LEGO1 0x100a81c0 @@ -69,6 +73,7 @@ void LegoROI::configureLegoROI(int p_roiConfig) } // FUNCTION: LEGO1 0x100a81d0 +// FUNCTION: BETA10 0x101898e8 LegoROI::LegoROI(Tgl::Renderer* p_renderer) : ViewROI(p_renderer, NULL) { m_parentROI = NULL; @@ -77,6 +82,7 @@ LegoROI::LegoROI(Tgl::Renderer* p_renderer) : ViewROI(p_renderer, NULL) } // FUNCTION: LEGO1 0x100a82d0 +// FUNCTION: BETA10 0x10189994 LegoROI::LegoROI(Tgl::Renderer* p_renderer, ViewLODList* p_lodList) : ViewROI(p_renderer, p_lodList) { m_parentROI = NULL; @@ -85,6 +91,7 @@ LegoROI::LegoROI(Tgl::Renderer* p_renderer, ViewLODList* p_lodList) : ViewROI(p_ } // FUNCTION: LEGO1 0x100a83c0 +// FUNCTION: BETA10 0x10189a42 LegoROI::~LegoROI() { if (comp) { @@ -105,6 +112,7 @@ LegoROI::~LegoROI() } // FUNCTION: LEGO1 0x100a84a0 +// FUNCTION: BETA10 0x10189b99 LegoResult LegoROI::Read( OrientableROI* p_unk0xd4, Tgl::Renderer* p_renderer, @@ -128,7 +136,7 @@ LegoResult LegoROI::Read( m_parentROI = p_unk0xd4; - if (p_storage->Read(&length, sizeof(length)) != SUCCESS) { + if (p_storage->Read(&length, sizeof(LegoU32)) != SUCCESS) { goto done; } m_name = new LegoChar[length + 1]; @@ -150,10 +158,10 @@ LegoResult LegoROI::Read( goto done; } - SET3(m_unk0x80.Min(), box.GetMin()); - SET3(m_unk0x80.Max(), box.GetMax()); + SET3(m_bounding_box.Min(), box.GetMin()); + SET3(m_bounding_box.Max(), box.GetMax()); - if (p_storage->Read(&length, sizeof(length)) != SUCCESS) { + if (p_storage->Read(&length, sizeof(LegoU32)) != SUCCESS) { goto done; } @@ -169,7 +177,7 @@ LegoResult LegoROI::Read( textureName = NULL; } - if (p_storage->Read(&m_unk0x100, sizeof(m_unk0x100)) != SUCCESS) { + if (p_storage->Read(&m_unk0x100, sizeof(undefined)) != SUCCESS) { goto done; } @@ -192,7 +200,7 @@ LegoResult LegoROI::Read( } } else { - if (p_storage->Read(&numLODs, sizeof(numLODs)) != SUCCESS) { + if (p_storage->Read(&numLODs, sizeof(LegoU32)) != SUCCESS) { goto done; } @@ -203,7 +211,7 @@ LegoResult LegoROI::Read( const LegoChar* roiName = m_name; LegoU32 offset; - if (p_storage->Read(&offset, sizeof(offset)) != SUCCESS) { + if (p_storage->Read(&offset, sizeof(LegoU32)) != SUCCESS) { goto done; } @@ -251,7 +259,7 @@ LegoResult LegoROI::Read( } if (j == 0) { - if (surplusLODs != 0 && lod->GetUnknown0x08Test8()) { + if (surplusLODs != 0 && lod->IsExtraLOD()) { numLODs++; } } @@ -268,7 +276,7 @@ LegoResult LegoROI::Read( } if (i == 0) { - if (surplusLODs != 0 && lod->GetUnknown0x08Test8()) { + if (surplusLODs != 0 && lod->IsExtraLOD()) { numLODs++; } } @@ -299,20 +307,20 @@ LegoResult LegoROI::Read( goto done; } - FUN_100a9210(textureInfo); - FUN_100a9170(1.0F, 1.0F, 1.0F, 0.0F); + SetTextureInfo(textureInfo); + SetLodColor(1.0F, 1.0F, 1.0F, 0.0F); } else { LegoFloat red = 1.0F; LegoFloat green = 0.0F; LegoFloat blue = 1.0F; LegoFloat alpha = 0.0F; - FUN_100a9bf0(textureName, red, green, blue, alpha); - FUN_100a9170(red, green, blue, alpha); + GetRGBAColor(textureName, red, green, blue, alpha); + SetLodColor(red, green, blue, alpha); } } - if (p_storage->Read(&numROIs, sizeof(numROIs)) != SUCCESS) { + if (p_storage->Read(&numROIs, sizeof(LegoU32)) != SUCCESS) { goto done; } @@ -337,7 +345,8 @@ LegoResult LegoROI::Read( } // FUNCTION: LEGO1 0x100a8cb0 -LegoResult LegoROI::FUN_100a8cb0(LegoAnimNodeData* p_data, LegoTime p_time, Matrix4& p_matrix) +// FUNCTION: BETA10 0x1018a7e8 +LegoResult LegoROI::CreateLocalTransform(LegoAnimNodeData* p_data, LegoTime p_time, Matrix4& p_matrix) { p_matrix.SetIdentity(); p_data->CreateLocalTransform(p_time, p_matrix); @@ -379,27 +388,33 @@ LegoROI* LegoROI::FindChildROI(const LegoChar* p_name, LegoROI* p_roi) } // FUNCTION: LEGO1 0x100a8da0 -LegoResult LegoROI::FUN_100a8da0(LegoTreeNode* p_node, const Matrix4& p_matrix, LegoTime p_time, LegoROI* p_roi) +// FUNCTION: BETA10 0x1018a9fb +LegoResult LegoROI::ApplyAnimationTransformation( + LegoTreeNode* p_node, + const Matrix4& p_matrix, + LegoTime p_time, + LegoROI* p_parentROI +) { MxMatrix mat; LegoAnimNodeData* data = (LegoAnimNodeData*) p_node->GetData(); const LegoChar* name = data->GetName(); - LegoROI* roi = FindChildROI(name, p_roi); + LegoROI* roi = FindChildROI(name, p_parentROI); if (roi == NULL) { roi = FindChildROI(name, this); } if (roi != NULL) { - FUN_100a8cb0(data, p_time, mat); + CreateLocalTransform(data, p_time, mat); roi->m_local2world.Product(mat, p_matrix); - roi->VTable0x1c(); + roi->UpdateWorldData(); - LegoBool und = data->FUN_100a0990(p_time); + LegoBool und = data->GetVisibility(p_time); roi->SetVisibility(und); for (LegoU32 i = 0; i < p_node->GetNumChildren(); i++) { - FUN_100a8da0(p_node->GetChild(i), roi->m_local2world, p_time, roi); + ApplyAnimationTransformation(p_node->GetChild(i), roi->m_local2world, p_time, roi); } } else { @@ -416,14 +431,14 @@ void LegoROI::FUN_100a8e80(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_t MxMatrix mat; LegoAnimNodeData* data = (LegoAnimNodeData*) p_node->GetData(); - FUN_100a8cb0(data, p_time, mat); + CreateLocalTransform(data, p_time, mat); - LegoROI* roi = p_roiMap[data->GetUnknown0x20()]; + LegoROI* roi = p_roiMap[data->GetROIIndex()]; if (roi != NULL) { roi->m_local2world.Product(mat, p_matrix); - roi->VTable0x1c(); + roi->UpdateWorldData(); - LegoBool und = data->FUN_100a0990(p_time); + LegoBool und = data->GetVisibility(p_time); roi->SetVisibility(und); for (LegoU32 i = 0; i < p_node->GetNumChildren(); i++) { @@ -447,9 +462,9 @@ void LegoROI::FUN_100a8fd0(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_t MxMatrix mat; LegoAnimNodeData* data = (LegoAnimNodeData*) p_node->GetData(); - FUN_100a8cb0(data, p_time, mat); + CreateLocalTransform(data, p_time, mat); - LegoROI* roi = p_roiMap[data->GetUnknown0x20()]; + LegoROI* roi = p_roiMap[data->GetROIIndex()]; if (roi != NULL) { roi->m_local2world.Product(mat, p_matrix); @@ -468,20 +483,21 @@ void LegoROI::FUN_100a8fd0(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_t } // FUNCTION: LEGO1 0x100a90f0 +// FUNCTION: BETA10 0x1018ada8 LegoResult LegoROI::SetFrame(LegoAnim* p_anim, LegoTime p_time) { LegoTreeNode* root = p_anim->GetRoot(); MxMatrix mat; mat = m_local2world; - mat.SetIdentity(); + mat.SetIdentity(); // this clears the matrix, assignment above is redundant - return FUN_100a8da0(root, mat, p_time, this); + return ApplyAnimationTransformation(root, mat, p_time, this); } // FUNCTION: LEGO1 0x100a9170 // FUNCTION: BETA10 0x1018ae09 -LegoResult LegoROI::FUN_100a9170(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha) +LegoResult LegoROI::SetLodColor(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha) { LegoResult result = SUCCESS; CompoundObject::iterator it; @@ -490,14 +506,14 @@ LegoResult LegoROI::FUN_100a9170(LegoFloat p_red, LegoFloat p_green, LegoFloat p for (LegoU32 i = 0; i < lodCount; i++) { LegoLOD* lod = (LegoLOD*) GetLOD(i); - if (lod->FUN_100aacb0(p_red, p_green, p_blue, p_alpha) != SUCCESS) { + if (lod->SetColor(p_red, p_green, p_blue, p_alpha) != SUCCESS) { result = FAILURE; } } if (comp != NULL) { for (it = comp->begin(); it != comp->end(); it++) { - if (((LegoROI*) *it)->FUN_100a9170(p_red, p_green, p_blue, p_alpha) != SUCCESS) { + if (((LegoROI*) *it)->SetLodColor(p_red, p_green, p_blue, p_alpha) != SUCCESS) { result = FAILURE; } } @@ -507,7 +523,8 @@ LegoResult LegoROI::FUN_100a9170(LegoFloat p_red, LegoFloat p_green, LegoFloat p } // FUNCTION: LEGO1 0x100a9210 -LegoResult LegoROI::FUN_100a9210(LegoTextureInfo* p_textureInfo) +// FUNCTION: BETA10 0x1018af25 +LegoResult LegoROI::SetTextureInfo(LegoTextureInfo* p_textureInfo) { LegoResult result = SUCCESS; CompoundObject::iterator it; @@ -516,14 +533,14 @@ LegoResult LegoROI::FUN_100a9210(LegoTextureInfo* p_textureInfo) for (LegoU32 i = 0; i < lodCount; i++) { LegoLOD* lod = (LegoLOD*) GetLOD(i); - if (lod->FUN_100aad00(p_textureInfo) != SUCCESS) { + if (lod->SetTextureInfo(p_textureInfo) != SUCCESS) { result = FAILURE; } } if (comp != NULL) { for (it = comp->begin(); it != comp->end(); it++) { - if (((LegoROI*) *it)->FUN_100a9210(p_textureInfo) != SUCCESS) { + if (((LegoROI*) *it)->SetTextureInfo(p_textureInfo) != SUCCESS) { result = FAILURE; } } @@ -534,7 +551,7 @@ LegoResult LegoROI::FUN_100a9210(LegoTextureInfo* p_textureInfo) // FUNCTION: LEGO1 0x100a92a0 // FUNCTION: BETA10 0x1018b12d -LegoResult LegoROI::GetTexture(LegoTextureInfo*& p_textureInfo) +LegoResult LegoROI::GetTextureInfo(LegoTextureInfo*& p_textureInfo) { CompoundObject::iterator it; @@ -542,14 +559,14 @@ LegoResult LegoROI::GetTexture(LegoTextureInfo*& p_textureInfo) for (LegoU32 i = 0; i < lodCount; i++) { LegoLOD* lod = (LegoLOD*) GetLOD(i); - if (lod->GetTexture(p_textureInfo) == SUCCESS) { + if (lod->GetTextureInfo(p_textureInfo) == SUCCESS) { return SUCCESS; } } if (comp != NULL) { for (it = comp->begin(); it != comp->end(); it++) { - if (((LegoROI*) *it)->GetTexture(p_textureInfo) == SUCCESS) { + if (((LegoROI*) *it)->GetTextureInfo(p_textureInfo) == SUCCESS) { return SUCCESS; } } @@ -562,16 +579,16 @@ LegoResult LegoROI::GetTexture(LegoTextureInfo*& p_textureInfo) // FUNCTION: BETA10 0x1018b22c LegoResult LegoROI::FUN_100a9330(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha) { - return FUN_100a9170(p_red, p_green, p_blue, p_alpha); + return SetLodColor(p_red, p_green, p_blue, p_alpha); } // FUNCTION: LEGO1 0x100a9350 // FUNCTION: BETA10 0x1018b25c -LegoResult LegoROI::FUN_100a9350(const LegoChar* p_color) +LegoResult LegoROI::SetLodColor(const LegoChar* p_name) { MxFloat red, green, blue, alpha; - if (ColorAliasLookup(p_color, red, green, blue, alpha)) { - return FUN_100a9170(red, green, blue, alpha); + if (ColorAliasLookup(p_name, red, green, blue, alpha)) { + return SetLodColor(red, green, blue, alpha); } return SUCCESS; @@ -579,10 +596,10 @@ LegoResult LegoROI::FUN_100a9350(const LegoChar* p_color) // FUNCTION: LEGO1 0x100a93b0 // FUNCTION: BETA10 0x1018b2c0 -LegoResult LegoROI::FUN_100a93b0(const LegoChar* p_color) +LegoResult LegoROI::FUN_100a93b0(const LegoChar* p_name) { MxFloat red, green, blue, alpha; - if (ColorAliasLookup(p_color, red, green, blue, alpha)) { + if (ColorAliasLookup(p_name, red, green, blue, alpha)) { return FUN_100a9330(red, green, blue, alpha); } @@ -617,8 +634,8 @@ LegoU32 LegoROI::FUN_100a9410( Mx3DPointFloat local4c(p_v1); - local58 = m_unk0x80.Min(); - locala8 = m_unk0x80.Max(); + local58 = m_bounding_box.Min(); + locala8 = m_bounding_box.Max(); localc0[3] = local9c[3] = local168[3] = 1.0f; @@ -730,6 +747,7 @@ LegoU32 LegoROI::FUN_100a9410( } // FUNCTION: LEGO1 0x100a9a50 +// FUNCTION: BETA10 0x1018bb6b TimeROI::TimeROI(Tgl::Renderer* p_renderer, ViewLODList* p_lodList, LegoTime p_time) : LegoROI(p_renderer, p_lodList) { m_time = p_time; @@ -750,25 +768,26 @@ void TimeROI::FUN_100a9b40(Matrix4& p_matrix, LegoTime p_time) targetPosition -= vec; targetPosition /= time / 1000.0; - FUN_100a5a30(targetPosition); + SetWorldVelocity(targetPosition); } } // FUNCTION: LEGO1 0x100a9bf0 -LegoBool LegoROI::FUN_100a9bf0(const LegoChar* p_param, float& p_red, float& p_green, float& p_blue, float& p_alpha) +// FUNCTION: BETA10 0x1018bc93 +LegoBool LegoROI::GetRGBAColor(const LegoChar* p_name, float& p_red, float& p_green, float& p_blue, float& p_alpha) { - if (p_param == NULL) { + if (p_name == NULL) { return FALSE; } - if (g_unk0x101013ac) { - char buf[32]; - if (g_unk0x101013ac(p_param, buf, sizeof(buf))) { - p_param = buf; + char p_updatedName[32]; + if (g_colorOverride) { + if (g_colorOverride(p_name, p_updatedName, sizeof(p_updatedName))) { + p_name = p_updatedName; } } - return ColorAliasLookup(p_param, p_red, p_green, p_blue, p_alpha); + return ColorAliasLookup(p_name, p_red, p_green, p_blue, p_alpha); } // FUNCTION: LEGO1 0x100a9c50 @@ -789,14 +808,15 @@ LegoBool LegoROI::ColorAliasLookup(const LegoChar* p_param, float& p_red, float& } // FUNCTION: LEGO1 0x100a9cf0 -LegoBool LegoROI::FUN_100a9cf0(const LegoChar* p_param, unsigned char* paletteEntries, LegoU32 p_numEntries) +LegoBool LegoROI::GetPaletteEntries(const LegoChar* p_name, unsigned char* paletteEntries, LegoU32 p_numEntries) { - if (p_param == NULL) { + if (p_name == NULL) { return FALSE; } - if (g_unk0x101013b0 != NULL) { - return g_unk0x101013b0(p_param, paletteEntries, p_numEntries); + // Note: g_textureHandler is never set in the code base + if (g_textureHandler != NULL) { + return g_textureHandler(p_name, paletteEntries, p_numEntries); } paletteEntries[0] = '\0'; @@ -804,9 +824,9 @@ LegoBool LegoROI::FUN_100a9cf0(const LegoChar* p_param, unsigned char* paletteEn } // FUNCTION: LEGO1 0x100a9d30 -void LegoROI::FUN_100a9d30(ROIHandler p_func) +void LegoROI::SetColorOverride(ColorOverride p_colorOverride) { - g_unk0x101013ac = p_func; + g_colorOverride = p_colorOverride; } // FUNCTION: LEGO1 0x100a9d40 @@ -828,12 +848,12 @@ void LegoROI::SetName(const LegoChar* p_name) // FUNCTION: LEGO1 0x100a9dd0 // FUNCTION: BETA10 0x1018bfdb -void LegoROI::FUN_100a9dd0() +void LegoROI::ClearMeshOffset() { int lodCount = GetLODCount(); for (LegoS32 i = 0; i < lodCount; i++) { LegoLOD* lod = (LegoLOD*) GetLOD(i); - lod->FUN_100aae60(); + lod->ClearMeshOffset(); } } @@ -844,12 +864,14 @@ void LegoROI::SetDisplayBB(int p_displayBB) } // FUNCTION: LEGO1 0x100aa340 +// FUNCTION: BETA10 0x1018cca0 float LegoROI::IntrinsicImportance() const { return .5; } // FUNCTION: LEGO1 0x100aa350 +// FUNCTION: BETA10 0x1018ccc0 void LegoROI::UpdateWorldBoundingVolumes() { CalcWorldBoundingVolumes(m_sphere, m_local2world, m_world_bounding_box, m_world_bounding_sphere); diff --git a/LEGO1/lego/sources/roi/legoroi.h b/LEGO1/lego/sources/roi/legoroi.h index f69936dc..216bb68d 100644 --- a/LEGO1/lego/sources/roi/legoroi.h +++ b/LEGO1/lego/sources/roi/legoroi.h @@ -4,7 +4,7 @@ #include "misc/legotypes.h" #include "viewmanager/viewroi.h" -typedef unsigned char (*ROIHandler)(const char*, char*, unsigned int); +typedef unsigned char (*ColorOverride)(const char*, char*, unsigned int); typedef unsigned char (*TextureHandler)(const char*, unsigned char*, unsigned int); class LegoEntity; @@ -17,6 +17,7 @@ class LegoTreeNode; struct LegoAnimActorEntry; // VTABLE: LEGO1 0x100dbe38 +// VTABLE: BETA10 0x101c3898 // SIZE 0x108 class LegoROI : public ViewROI { public: @@ -32,30 +33,35 @@ class LegoROI : public ViewROI { LegoStorage* p_storage ); LegoROI* FindChildROI(const LegoChar* p_name, LegoROI* p_roi); - LegoResult FUN_100a8da0(LegoTreeNode* p_node, const Matrix4& p_matrix, LegoTime p_time, LegoROI* p_roi); + LegoResult ApplyAnimationTransformation( + LegoTreeNode* p_node, + const Matrix4& p_matrix, + LegoTime p_time, + LegoROI* p_roi + ); static void FUN_100a8e80(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_time, LegoROI** p_roiMap); static void FUN_100a8fd0(LegoTreeNode* p_node, Matrix4& p_matrix, LegoTime p_time, LegoROI** p_roiMap); LegoResult SetFrame(LegoAnim* p_anim, LegoTime p_time); - LegoResult FUN_100a9170(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha); - LegoResult FUN_100a9210(LegoTextureInfo* p_textureInfo); - LegoResult GetTexture(LegoTextureInfo*& p_textureInfo); + LegoResult SetLodColor(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha); + LegoResult SetTextureInfo(LegoTextureInfo* p_textureInfo); + LegoResult GetTextureInfo(LegoTextureInfo*& p_textureInfo); LegoResult FUN_100a9330(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha); - LegoResult FUN_100a9350(const LegoChar* p_color); - LegoResult FUN_100a93b0(const LegoChar* p_color); + LegoResult SetLodColor(const LegoChar* p_name); + LegoResult FUN_100a93b0(const LegoChar* p_name); LegoU32 FUN_100a9410(Vector3& p_v1, Vector3& p_v2, float p_f1, float p_f2, Vector3& p_v3, LegoBool p_collideBox); void SetName(const LegoChar* p_name); float IntrinsicImportance() const override; // vtable+0x04 void UpdateWorldBoundingVolumes() override; // vtable+0x18 - void FUN_100a9dd0(); + void ClearMeshOffset(); void SetDisplayBB(int p_displayBB); - static LegoResult FUN_100a8cb0(LegoAnimNodeData* p_data, LegoTime p_time, Matrix4& p_matrix); - static void FUN_100a81b0(const LegoChar* p_error, const LegoChar* p_name); + static LegoResult CreateLocalTransform(LegoAnimNodeData* p_data, LegoTime p_time, Matrix4& p_matrix); + static void FUN_100a81b0(const LegoChar* p_error, ...); static void configureLegoROI(int p_roi); - static void FUN_100a9d30(ROIHandler p_func); - static LegoBool FUN_100a9bf0(const LegoChar* p_param, float& p_red, float& p_green, float& p_blue, float& p_alpha); + static void SetColorOverride(ColorOverride p_colorOverride); + static LegoBool GetRGBAColor(const LegoChar* p_name, float& p_red, float& p_green, float& p_blue, float& p_alpha); static LegoBool ColorAliasLookup( const LegoChar* p_param, float& p_red, @@ -63,7 +69,7 @@ class LegoROI : public ViewROI { float& p_blue, float& p_alpha ); - static LegoBool FUN_100a9cf0(const LegoChar* p_param, unsigned char* paletteEntries, LegoU32 p_numEntries); + static LegoBool GetPaletteEntries(const LegoChar* p_name, unsigned char* paletteEntries, LegoU32 p_numEntries); // FUNCTION: BETA10 0x1000f320 const LegoChar* GetName() const { return m_name; } @@ -78,9 +84,10 @@ class LegoROI : public ViewROI { void SetComp(CompoundObject* p_comp) { comp = p_comp; } void SetBoundingSphere(const BoundingSphere& p_sphere) { m_sphere = m_world_bounding_sphere = p_sphere; } - void SetUnknown0x80(const BoundingBox& p_unk0x80) { m_unk0x80 = p_unk0x80; } + void SetBoundingBox(const BoundingBox& p_box) { m_bounding_box = p_box; } // SYNTHETIC: LEGO1 0x100a82b0 + // SYNTHETIC: BETA10 0x1018c490 // LegoROI::`scalar deleting destructor' private: @@ -91,15 +98,20 @@ class LegoROI : public ViewROI { }; // VTABLE: LEGO1 0x100dbea8 +// VTABLE: BETA10 0x101c38d0 // SIZE 0x10c class TimeROI : public LegoROI { public: TimeROI(Tgl::Renderer* p_renderer, ViewLODList* p_lodList, LegoTime p_time); + void FUN_100a9b40(Matrix4& p_matrix, LegoTime p_time); + // SYNTHETIC: LEGO1 0x100a9ad0 + // SYNTHETIC: BETA10 0x1018c540 // TimeROI::`scalar deleting destructor' - void FUN_100a9b40(Matrix4& p_matrix, LegoTime p_time); + // SYNTHETIC: BETA10 0x1018c580 + // TimeROI::~TimeROI private: LegoTime m_time; // 0x108 diff --git a/LEGO1/lego/sources/shape/legocolor.cpp b/LEGO1/lego/sources/shape/legocolor.cpp index 146e8818..69728742 100644 --- a/LEGO1/lego/sources/shape/legocolor.cpp +++ b/LEGO1/lego/sources/shape/legocolor.cpp @@ -9,13 +9,13 @@ DECOMP_SIZE_ASSERT(LegoColor, 0x03) LegoResult LegoColor::Read(LegoStorage* p_storage) { LegoResult result; - if ((result = p_storage->Read(&m_red, sizeof(m_red))) != SUCCESS) { + if ((result = p_storage->Read(&m_red, sizeof(LegoU8))) != SUCCESS) { return result; } - if ((result = p_storage->Read(&m_green, sizeof(m_green))) != SUCCESS) { + if ((result = p_storage->Read(&m_green, sizeof(LegoU8))) != SUCCESS) { return result; } - if ((result = p_storage->Read(&m_blue, sizeof(m_blue))) != SUCCESS) { + if ((result = p_storage->Read(&m_blue, sizeof(LegoU8))) != SUCCESS) { return result; } return SUCCESS; diff --git a/LEGO1/lego/sources/shape/legomesh.cpp b/LEGO1/lego/sources/shape/legomesh.cpp index 51b61fb0..69dee797 100644 --- a/LEGO1/lego/sources/shape/legomesh.cpp +++ b/LEGO1/lego/sources/shape/legomesh.cpp @@ -15,7 +15,7 @@ LegoMesh::LegoMesh() m_unk0x0d = 0; m_unk0x10 = NULL; m_unk0x20 = 0; - m_unk0x21 = FALSE; + m_useAlias = FALSE; m_materialName = NULL; } @@ -43,23 +43,23 @@ LegoResult LegoMesh::Read(LegoStorage* p_storage) if ((result = m_color.Read(p_storage)) != SUCCESS) { return result; } - if ((result = p_storage->Read(&m_alpha, sizeof(m_alpha))) != SUCCESS) { + if ((result = p_storage->Read(&m_alpha, sizeof(LegoFloat))) != SUCCESS) { return result; } - if ((result = p_storage->Read(&m_shading, sizeof(m_shading))) != SUCCESS) { + if ((result = p_storage->Read(&m_shading, sizeof(LegoU8))) != SUCCESS) { return result; } - if ((result = p_storage->Read(&m_unk0x0d, sizeof(m_unk0x0d))) != SUCCESS) { + if ((result = p_storage->Read(&m_unk0x0d, sizeof(LegoU8))) != SUCCESS) { return result; } - if ((result = p_storage->Read(&m_unk0x20, sizeof(m_unk0x20))) != SUCCESS) { + if ((result = p_storage->Read(&m_unk0x20, sizeof(undefined))) != SUCCESS) { return result; } - if ((result = p_storage->Read(&m_unk0x21, sizeof(m_unk0x21))) != SUCCESS) { + if ((result = p_storage->Read(&m_useAlias, sizeof(LegoU8))) != SUCCESS) { return result; } - if ((result = p_storage->Read(&textureLength, sizeof(textureLength))) != SUCCESS) { + if ((result = p_storage->Read(&textureLength, sizeof(LegoU32))) != SUCCESS) { return result; } if (textureLength) { @@ -73,7 +73,7 @@ LegoResult LegoMesh::Read(LegoStorage* p_storage) strlwr(m_textureName); } - if ((result = p_storage->Read(&materialLength, sizeof(materialLength))) != SUCCESS) { + if ((result = p_storage->Read(&materialLength, sizeof(LegoU32))) != SUCCESS) { return result; } if (materialLength) { diff --git a/LEGO1/lego/sources/shape/legomesh.h b/LEGO1/lego/sources/shape/legomesh.h index da1b1a27..3092d7e4 100644 --- a/LEGO1/lego/sources/shape/legomesh.h +++ b/LEGO1/lego/sources/shape/legomesh.h @@ -56,7 +56,7 @@ class LegoMesh { LegoU8 GetUnknown0x0d() { return m_unk0x0d; } const LegoChar* GetTextureName() { return m_textureName; } const LegoChar* GetMaterialName() { return m_materialName; } - LegoBool GetUnknown0x21() { return m_unk0x21; } + LegoBool GetUseAlias() { return m_useAlias; } LegoResult Read(LegoStorage* p_storage); // SYNTHETIC: LEGO1 0x100d3840 @@ -72,7 +72,7 @@ class LegoMesh { LegoChar* m_textureName; // 0x18 LegoChar* m_materialName; // 0x1c undefined m_unk0x20; // 0x20 - unused - LegoBool m_unk0x21; // 0x21 + LegoBool m_useAlias; // 0x21 }; #endif // __LEGOMESH_H diff --git a/LEGO1/lego/sources/shape/legosphere.cpp b/LEGO1/lego/sources/shape/legosphere.cpp index 7b916326..59860ab7 100644 --- a/LEGO1/lego/sources/shape/legosphere.cpp +++ b/LEGO1/lego/sources/shape/legosphere.cpp @@ -12,7 +12,7 @@ LegoResult LegoSphere::Read(LegoStorage* p_storage) if ((result = m_center.Read(p_storage)) != SUCCESS) { return result; } - if ((result = p_storage->Read(&m_radius, sizeof(m_radius))) != SUCCESS) { + if ((result = p_storage->Read(&m_radius, sizeof(LegoFloat))) != SUCCESS) { return result; } return SUCCESS; diff --git a/LEGO1/lego/sources/shape/legovertex.cpp b/LEGO1/lego/sources/shape/legovertex.cpp index 2977d60a..30bb27ab 100644 --- a/LEGO1/lego/sources/shape/legovertex.cpp +++ b/LEGO1/lego/sources/shape/legovertex.cpp @@ -17,13 +17,13 @@ LegoVertex::LegoVertex() LegoResult LegoVertex::Read(LegoStorage* p_storage) { LegoResult result; - if ((result = p_storage->Read(&m_coordinates[0], sizeof(m_coordinates[0]))) != SUCCESS) { + if ((result = p_storage->Read(&m_coordinates[0], sizeof(LegoFloat))) != SUCCESS) { return result; } - if ((result = p_storage->Read(&m_coordinates[1], sizeof(m_coordinates[1]))) != SUCCESS) { + if ((result = p_storage->Read(&m_coordinates[1], sizeof(LegoFloat))) != SUCCESS) { return result; } - if ((result = p_storage->Read(&m_coordinates[2], sizeof(m_coordinates[2]))) != SUCCESS) { + if ((result = p_storage->Read(&m_coordinates[2], sizeof(LegoFloat))) != SUCCESS) { return result; } return SUCCESS; diff --git a/LEGO1/library_msvc.h b/LEGO1/library_msvc.h index 7622ae1a..96437e7a 100644 --- a/LEGO1/library_msvc.h +++ b/LEGO1/library_msvc.h @@ -1,4 +1,4 @@ -#ifdef 0 +#if 0 // For LEGO1 symbols only // aka `operator new` @@ -35,7 +35,10 @@ // __NLG_Notify // LIBRARY: LEGO1 0x1008b340 -// __FPinit +// __fpmath + +// LIBRARY: LEGO1 0x1008b370 +// __cfltcvt_init // LIBRARY: LEGO1 0x1008b3dc // __CIacos @@ -188,6 +191,39 @@ // LIBRARY: LEGO1 0x1008d660 // __freeptd +// LIBRARY: LEGO1 0x1008d710 +// __setdefaultprecision + +// LIBRARY: LEGO1 0x1008d730 +// __ms_p5_test_fdiv + +// LIBRARY: LEGO1 0x1008d780 +// __ms_p5_mp_test_fdiv + +// LIBRARY: LEGO1 0x1008d7b0 +// __forcdecpt + +// LIBRARY: LEGO1 0x1008d820 +// __cropzeros + +// LIBRARY: LEGO1 0x1008d880 +// __positive + +// LIBRARY: LEGO1 0x1008d8a0 +// __fassign + +// LIBRARY: LEGO1 0x1008d8f0 +// __cftoe + +// LIBRARY: LEGO1 0x1008da60 +// __cftof + +// LIBRARY: LEGO1 0x1008db90 +// __cftog + +// LIBRARY: LEGO1 0x1008dc40 +// __cfltcvt + // LIBRARY: LEGO1 0x1008dd90 // __cintrindisp2 @@ -293,6 +329,9 @@ // LIBRARY: LEGO1 0x10090080 // __getstream +// LIBRARY: LEGO1 0x10090180 +// _tolower + // LIBRARY: LEGO1 0x100901f0 // __tolower_lk @@ -344,8 +383,23 @@ // LIBRARY: LEGO1 0x10092130 // _raise -// LIBRARY: LEGO1 0x10092310 +// ~LIBRARY: LEGO1 0x10092310 // _siglookup +// Not public + +// LIBRARY: LEGO1 0x10092720 +// __control87 + +// LIBRARY: LEGO1 0x10092760 +// __controlfp + +// ~LIBRARY: LEGO1 0x10092780 +// __abstract_cw +// Not public + +// ~LIBRARY: LEGO1 0x10092830 +// __hw_cw +// Not public // LIBRARY: LEGO1 0x100928c0 // __fptrap @@ -377,6 +431,24 @@ // LIBRARY: LEGO1 0x10092d30 // __ld12tod +// LIBRARY: LEGO1 0x10092d50 +// __ld12tof + +// LIBRARY: LEGO1 0x10092d70 +// __atodbl + +// LIBRARY: LEGO1 0x10092db0 +// __atoflt + +// LIBRARY: LEGO1 0x10092df0 +// __fptostr + +// LIBRARY: LEGO1 0x10092e80 +// __fltout2 + +// LIBRARY: LEGO1 0x10092f10 +// ___dtold + // LIBRARY: LEGO1 0x10093037 // __trandisp2 @@ -458,6 +530,9 @@ // LIBRARY: LEGO1 0x100965b0 // ___mtold12 +// LIBRARY: LEGO1 0x100966a0 +// _$I10_OUTPUT + // LIBRARY: LEGO1 0x10097190 // ___ld12mul @@ -516,6 +591,12 @@ // GLOBAL: LEGO1 0x100fc8bc // __NLG_Destination +// GLOBAL: LEGO1 0x100fc8d8 +// __adjust_fdiv + +// GLOBAL: LEGO1 0x100fc8dc +// __FPinit + // GLOBAL: LEGO1 0x100fc8f0 // __iob @@ -564,6 +645,9 @@ // GLOBAL: LEGO1 0x100fcf20 // ___tlsindex +// GLOBAL: LEGO1 0x100fcf28 +// __cfltcvt_tab + // GLOBAL: LEGO1 0x100fcf60 // __OP_ACOSjmptab @@ -756,6 +840,9 @@ // LIBRARY: BETA10 0x100f8ad0 // strcmp +// LIBRARY: BETA10 0x100f9f60 +// strtok + // LIBRARY: BETA10 0x100f9610 // rand diff --git a/LEGO1/library_smack.h b/LEGO1/library_smack.h index 0967aeab..56d00db6 100644 --- a/LEGO1/library_smack.h +++ b/LEGO1/library_smack.h @@ -1,4 +1,4 @@ -#ifdef 0 +#if 0 // LIBRARY: LEGO1 0x100cd782 // LIBRARY: BETA10 0x1015fb82 diff --git a/LEGO1/modeldb/modeldb.cpp b/LEGO1/modeldb/modeldb.cpp index c56e62b7..82e673ec 100644 --- a/LEGO1/modeldb/modeldb.cpp +++ b/LEGO1/modeldb/modeldb.cpp @@ -19,7 +19,7 @@ MxResult ModelDbModel::Read(FILE* p_file) { MxU32 len; - if (fread(&len, sizeof(len), 1, p_file) != 1) { + if (fread(&len, sizeof(MxU32), 1, p_file) != 1) { return FAILURE; } @@ -28,13 +28,13 @@ MxResult ModelDbModel::Read(FILE* p_file) return FAILURE; } - if (fread(&m_unk0x04, sizeof(m_unk0x04), 1, p_file) != 1) { + if (fread(&m_modelDataLength, sizeof(MxU32), 1, p_file) != 1) { return FAILURE; } - if (fread(&m_unk0x08, sizeof(m_unk0x08), 1, p_file) != 1) { + if (fread(&m_modelDataOffset, sizeof(MxU32), 1, p_file) != 1) { return FAILURE; } - if (fread(&len, sizeof(len), 1, p_file) != 1) { + if (fread(&len, sizeof(MxU32), 1, p_file) != 1) { return FAILURE; } @@ -43,16 +43,16 @@ MxResult ModelDbModel::Read(FILE* p_file) return FAILURE; } - if (fread(&m_location, sizeof(*m_location), 3, p_file) != 3) { + if (fread(&m_location, sizeof(float), 3, p_file) != 3) { return FAILURE; } - if (fread(&m_direction, sizeof(*m_direction), 3, p_file) != 3) { + if (fread(&m_direction, sizeof(float), 3, p_file) != 3) { return FAILURE; } - if (fread(&m_up, sizeof(*m_up), 3, p_file) != 3) { + if (fread(&m_up, sizeof(float), 3, p_file) != 3) { return FAILURE; } - if (fread(&m_unk0x34, sizeof(m_unk0x34), 1, p_file) != 1) { + if (fread(&m_visible, sizeof(MxU8), 1, p_file) != 1) { return FAILURE; } @@ -65,7 +65,7 @@ MxResult ModelDbPart::Read(FILE* p_file) MxU32 len; char buff[128]; - if (fread(&len, sizeof(len), 1, p_file) != 1) { + if (fread(&len, sizeof(MxU32), 1, p_file) != 1) { return FAILURE; } @@ -76,10 +76,10 @@ MxResult ModelDbPart::Read(FILE* p_file) m_roiName = buff; - if (fread(&m_partDataLength, sizeof(m_partDataLength), 1, p_file) != 1) { + if (fread(&m_partDataLength, sizeof(undefined4), 1, p_file) != 1) { return FAILURE; } - if (fread(&m_partDataOffset, sizeof(m_partDataOffset), 1, p_file) != 1) { + if (fread(&m_partDataOffset, sizeof(undefined4), 1, p_file) != 1) { return FAILURE; } @@ -101,7 +101,7 @@ MxResult ReadModelDbWorlds(FILE* p_file, ModelDbWorld*& p_worlds, MxS32& p_numWo MxS32 worldNameLen, numParts, i, j; for (i = 0; i < numWorlds; i++) { - if (fread(&worldNameLen, sizeof(worldNameLen), 1, p_file) != 1) { + if (fread(&worldNameLen, sizeof(MxS32), 1, p_file) != 1) { return FAILURE; } @@ -110,7 +110,7 @@ MxResult ReadModelDbWorlds(FILE* p_file, ModelDbWorld*& p_worlds, MxS32& p_numWo return FAILURE; } - if (fread(&numParts, sizeof(numParts), 1, p_file) != 1) { + if (fread(&numParts, sizeof(MxS32), 1, p_file) != 1) { return FAILURE; } @@ -126,7 +126,7 @@ MxResult ReadModelDbWorlds(FILE* p_file, ModelDbWorld*& p_worlds, MxS32& p_numWo worlds[i].m_partList->Append(part); } - if (fread(&worlds[i].m_numModels, sizeof(worlds[i].m_numModels), 1, p_file) != 1) { + if (fread(&worlds[i].m_numModels, sizeof(MxS32), 1, p_file) != 1) { return FAILURE; } diff --git a/LEGO1/modeldb/modeldb.h b/LEGO1/modeldb/modeldb.h index 911832e5..b9091e1f 100644 --- a/LEGO1/modeldb/modeldb.h +++ b/LEGO1/modeldb/modeldb.h @@ -94,14 +94,14 @@ struct ModelDbModel { void Free(); MxResult Read(FILE* p_file); - char* m_modelName; // 0x00 - undefined4 m_unk0x04; // 0x04 - undefined4 m_unk0x08; // 0x08 - char* m_presenterName; // 0x0c - float m_location[3]; // 0x10 - float m_direction[3]; // 0x1c - float m_up[3]; // 0x28 - undefined m_unk0x34; // 0x34 + char* m_modelName; // 0x00 + MxU32 m_modelDataLength; // 0x04 + MxU32 m_modelDataOffset; // 0x08 + char* m_presenterName; // 0x0c + float m_location[3]; // 0x10 + float m_direction[3]; // 0x1c + float m_up[3]; // 0x28 + MxU8 m_visible; // 0x34 }; // SIZE 0x18 diff --git a/LEGO1/mxdirectx/legodxinfo.cpp b/LEGO1/mxdirectx/legodxinfo.cpp index eb511f2b..35db14b7 100644 --- a/LEGO1/mxdirectx/legodxinfo.cpp +++ b/LEGO1/mxdirectx/legodxinfo.cpp @@ -158,7 +158,7 @@ int LegoDeviceEnumerate::BETA_1011cc65(int p_idx, char* p_buffer) // FUNCTION: CONFIG 0x00402860 // FUNCTION: LEGO1 0x1009d0d0 // FUNCTION: BETA10 0x1011cdb4 -int LegoDeviceEnumerate::FUN_1009d0d0() +int LegoDeviceEnumerate::GetBestDevice() { if (!IsInitialized()) { return -1; @@ -201,42 +201,45 @@ int LegoDeviceEnumerate::FUN_1009d0d0() // FUNCTION: BETA10 0x1011cf54 int LegoDeviceEnumerate::SupportsMMX() { - if (!SupportsCPUID()) { - return 0; - } - int supports_mmx; + int supports_mmx = SupportsCPUID(); + + if (supports_mmx) { #ifdef _MSC_VER - __asm { - mov eax, 0x0 ; EAX=0: Highest Function Parameter and Manufacturer ID + __asm { + push ebx + mov eax, 0x0 ; EAX=0: Highest Function Parameter and Manufacturer ID #if _MSC_VER > 1100 - cpuid ; Run CPUID + cpuid ; Run CPUID #else - __emit 0x0f - __emit 0xa2 + __emit 0x0f + __emit 0xa2 #endif - mov eax, 0x1 ; EAX=1: Processor Info and Feature Bits (unused) + mov eax, 0x1 ; EAX=1: Processor Info and Feature Bits (unused) #if _MSC_VER > 1100 - cpuid ; Run CPUID + cpuid ; Run CPUID #else - __emit 0x0f - __emit 0xa2 + __emit 0x0f + __emit 0xa2 +#endif + xor eax, eax ; Zero EAX register + bt edx, 0x17 ; Test bit 0x17 (23): MMX instructions (64-bit SIMD) (Store in CF) + adc eax, eax ; Add with carry: EAX = EAX + EAX + CF = CF + pop ebx + mov supports_mmx, eax ; Save eax into C variable + } +#else + __asm__("movl $0x0, %%eax\n\t" // EAX=0: Highest Function Parameter and Manufacturer ID + "cpuid\n\t" // Run CPUID\n" + "mov $0x1, %%eax\n\t" // EAX=1: Processor Info and Feature Bits (unused) + "cpuid\n\t" // Run CPUID + "xorl %%eax, %%eax\n\t" // Zero EAX register + "btl $0x15, %%edx\n\t" // Test bit 0x17 (23): MMX instructions (64-bit SIMD) (Store in CF) + "adc %%eax, %%eax" // Add with carry: EAX = EAX + EAX + CF = CF + : "=a"(supports_mmx) // supports_mmx == EAX + ); #endif - xor eax, eax ; Zero EAX register - bt edx, 0x17 ; Test bit 0x17 (23): MMX instructions (64-bit SIMD) (Store in CF) - adc eax, eax ; Add with carry: EAX = EAX + EAX + CF = CF - mov supports_mmx, eax ; Save eax into C variable } -#else - __asm__("movl $0x0, %%eax\n\t" // EAX=0: Highest Function Parameter and Manufacturer ID - "cpuid\n\t" // Run CPUID\n" - "mov $0x1, %%eax\n\t" // EAX=1: Processor Info and Feature Bits (unused) - "cpuid\n\t" // Run CPUID - "xorl %%eax, %%eax\n\t" // Zero EAX register - "btl $0x15, %%edx\n\t" // Test bit 0x17 (23): MMX instructions (64-bit SIMD) (Store in CF) - "adc %%eax, %%eax" // Add with carry: EAX = EAX + EAX + CF = CF - : "=a"(supports_mmx) // supports_mmx == EAX - ); -#endif + return supports_mmx; } @@ -249,15 +252,15 @@ int LegoDeviceEnumerate::SupportsCPUID() #ifdef _MSC_VER #if defined(_M_IX86) __asm { - xor eax, eax ; Zero EAX register - pushfd ; Push EFLAGS register value on the stack - or dword ptr[esp], 0x200000 ; Set bit 0x200000: Able to use CPUID instruction (Pentium+) - popfd ; Write the updated value into the EFLAGS register - pushfd ; Push EFLAGS register value on the stack (again) - btr dword ptr[esp], 0x15 ; Test bit 0x15 (21) and reset (set CF) - adc eax, eax ; Add with carry: EAX = EAX + EAX + CF = CF - popfd ; Push EFLAGS register value on the stack (again, and makes sure the stack remains the same) - mov has_cpuid, eax ; Save eax into C variable + xor eax, eax ; Zero EAX register + pushfd ; Push EFLAGS register value on the stack + or dword ptr[esp], 0x200000 ; Set bit 0x200000: Able to use CPUID instruction (Pentium+) + popfd ; Write the updated value into the EFLAGS register + pushfd ; Push EFLAGS register value on the stack (again) + btr dword ptr[esp], 0x15 ; Test bit 0x15 (21) and reset (set CF) + adc eax, eax ; Add with carry: EAX = EAX + EAX + CF = CF + popfd ; Push EFLAGS register value on the stack (again, and makes sure the stack remains the same) + mov has_cpuid, eax ; Save eax into C variable } #elif defined(_M_X64) has_cpuid = 1; diff --git a/LEGO1/mxdirectx/legodxinfo.h b/LEGO1/mxdirectx/legodxinfo.h index 2888c02c..dcd204cd 100644 --- a/LEGO1/mxdirectx/legodxinfo.h +++ b/LEGO1/mxdirectx/legodxinfo.h @@ -14,7 +14,7 @@ class LegoDeviceEnumerate : public MxDeviceEnumerate { int GetDevice(int p_deviceNum, MxDriver*& p_driver, Direct3DDeviceInfo*& p_device); int FormatDeviceName(char* p_buffer, const MxDriver* p_ddInfo, const Direct3DDeviceInfo* p_d3dInfo) const; int BETA_1011cc65(int p_idx, char* p_buffer); - int FUN_1009d0d0(); + int GetBestDevice(); static int SupportsMMX(); static int SupportsCPUID(); int FUN_1009d210(); diff --git a/LEGO1/mxdirectx/mxdirectdraw.cpp b/LEGO1/mxdirectx/mxdirectdraw.cpp index 50628293..86910dde 100644 --- a/LEGO1/mxdirectx/mxdirectdraw.cpp +++ b/LEGO1/mxdirectx/mxdirectdraw.cpp @@ -164,19 +164,19 @@ BOOL MxDirectDraw::SetPaletteEntries(const PALETTEENTRY* pPaletteEntries, int pa } for (i = 0; i < 10; i++) { - m_paletteEntries[i].peFlags = 0x80; + m_paletteEntries[i].peFlags = D3DPAL_RESERVED; } for (; i < 142; i++) { - m_paletteEntries[i].peFlags = 0x44; + m_paletteEntries[i].peFlags = D3DPAL_READONLY | PC_NOCOLLAPSE; } for (; i < 246; i++) { - m_paletteEntries[i].peFlags = 0x84; + m_paletteEntries[i].peFlags = D3DPAL_RESERVED | PC_NOCOLLAPSE; } for (; i < 256; i++) { - m_paletteEntries[i].peFlags = 0x80; + m_paletteEntries[i].peFlags = D3DPAL_RESERVED; } if (paletteEntryCount != 0) { @@ -399,7 +399,7 @@ BOOL MxDirectDraw::DDSetMode(int width, int height, int bpp) DDSURFACEDESC ddsd; - FUN_1009e020(); + ClearBackBuffers(); if (!GetDDSurfaceDesc(&ddsd, m_pBackBuffer)) { return FALSE; @@ -549,7 +549,7 @@ BOOL MxDirectDraw::DDCreateSurfaces() // FUNCTION: LEGO1 0x1009e020 // FUNCTION: BETA10 0x10121700 -void MxDirectDraw::FUN_1009e020() +void MxDirectDraw::ClearBackBuffers() { HRESULT result; byte* line; @@ -561,10 +561,10 @@ void MxDirectDraw::FUN_1009e020() memset(&ddsd, 0, sizeof(ddsd)); ddsd.dwSize = sizeof(ddsd); - result = m_pBackBuffer->Lock(NULL, &ddsd, 1, NULL); + result = m_pBackBuffer->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL); if (result == DDERR_SURFACELOST) { m_pBackBuffer->Restore(); - result = m_pBackBuffer->Lock(NULL, &ddsd, 1, NULL); + result = m_pBackBuffer->Lock(NULL, &ddsd, DDLOCK_WAIT, NULL); } if (result != DD_OK) { diff --git a/LEGO1/mxdirectx/mxdirectdraw.h b/LEGO1/mxdirectx/mxdirectdraw.h index 75b0f965..dd16f2e8 100644 --- a/LEGO1/mxdirectx/mxdirectdraw.h +++ b/LEGO1/mxdirectx/mxdirectdraw.h @@ -79,7 +79,7 @@ class MxDirectDraw { void Error(const char* p_message, int p_error); BOOL RecreateDirectDraw(GUID** a2); - void FUN_1009e020(); + void ClearBackBuffers(); void FUN_1009d920(); // SYNTHETIC: LEGO1 0x1009d510 diff --git a/LEGO1/mxdirectx/mxdirectxinfo.cpp b/LEGO1/mxdirectx/mxdirectxinfo.cpp index 4d2950e3..11ca9da2 100644 --- a/LEGO1/mxdirectx/mxdirectxinfo.cpp +++ b/LEGO1/mxdirectx/mxdirectxinfo.cpp @@ -41,7 +41,7 @@ MxDriver::MxDriver(LPGUID p_guid) // FUNCTION: CONFIG 0x00401180 // FUNCTION: LEGO1 0x1009ba80 // FUNCTION: BETA10 0x1011d8b6 -MxDriver::MxDriver(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName) +MxDriver::MxDriver(LPGUID p_guid, LPCSTR p_driverDesc, LPCSTR p_driverName) { m_guid = NULL; m_driverDesc = NULL; @@ -70,7 +70,7 @@ MxDriver::~MxDriver() // FUNCTION: CONFIG 0x00401330 // FUNCTION: LEGO1 0x1009bc30 // FUNCTION: BETA10 0x1011da89 -void MxDriver::Init(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName) +void MxDriver::Init(LPGUID p_guid, LPCSTR p_driverDesc, LPCSTR p_driverName) { if (m_driverDesc) { delete[] m_driverDesc; @@ -103,8 +103,8 @@ void MxDriver::Init(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName) // FUNCTION: BETA10 0x1011dbd0 Direct3DDeviceInfo::Direct3DDeviceInfo( LPGUID p_guid, - LPSTR p_deviceDesc, - LPSTR p_deviceName, + LPCSTR p_deviceDesc, + LPCSTR p_deviceName, LPD3DDEVICEDESC p_HWDesc, LPD3DDEVICEDESC p_HELDesc ) @@ -135,8 +135,8 @@ Direct3DDeviceInfo::~Direct3DDeviceInfo() // FUNCTION: BETA10 0x1011dca6 void Direct3DDeviceInfo::Initialize( LPGUID p_guid, - LPSTR p_deviceDesc, - LPSTR p_deviceName, + LPCSTR p_deviceDesc, + LPCSTR p_deviceName, LPD3DDEVICEDESC p_HWDesc, LPD3DDEVICEDESC p_HELDesc ) @@ -320,8 +320,8 @@ HRESULT MxDeviceEnumerate::EnumDisplayModesCallback(LPDDSURFACEDESC p_ddsd) // FUNCTION: BETA10 0x1011e32f HRESULT MxDeviceEnumerate::EnumDevicesCallback( LPGUID p_guid, - LPSTR p_deviceDesc, - LPSTR p_deviceName, + LPCSTR p_deviceDesc, + LPCSTR p_deviceName, LPD3DDEVICEDESC p_HWDesc, LPD3DDEVICEDESC p_HELDesc ) diff --git a/LEGO1/mxdirectx/mxdirectxinfo.h b/LEGO1/mxdirectx/mxdirectxinfo.h index ac68af79..3fbecfc8 100644 --- a/LEGO1/mxdirectx/mxdirectxinfo.h +++ b/LEGO1/mxdirectx/mxdirectxinfo.h @@ -67,16 +67,16 @@ struct Direct3DDeviceInfo { ~Direct3DDeviceInfo(); Direct3DDeviceInfo( LPGUID p_guid, - LPSTR p_deviceDesc, - LPSTR p_deviceName, + LPCSTR p_deviceDesc, + LPCSTR p_deviceName, LPD3DDEVICEDESC p_HWDesc, LPD3DDEVICEDESC p_HELDesc ); void Initialize( LPGUID p_guid, - LPSTR p_deviceDesc, - LPSTR p_deviceName, + LPCSTR p_deviceDesc, + LPCSTR p_deviceName, LPD3DDEVICEDESC p_HWDesc, LPD3DDEVICEDESC p_HELDesc ); @@ -115,9 +115,9 @@ struct MxDriver { MxDriver() {} ~MxDriver(); MxDriver(LPGUID p_guid); - MxDriver(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName); + MxDriver(LPGUID p_guid, LPCSTR p_driverDesc, LPCSTR p_driverName); - void Init(LPGUID p_guid, LPSTR p_driverDesc, LPSTR p_driverName); + void Init(LPGUID p_guid, LPCSTR p_driverDesc, LPCSTR p_driverName); LPGUID m_guid; // 0x00 char* m_driverDesc; // 0x04 @@ -168,12 +168,12 @@ struct MxDriver { // TEMPLATE: CONFIG 0x401b00 // TEMPLATE: LEGO1 0x1009c400 // TEMPLATE: BETA10 0x1011fad0 -// list >::insert +// ?insert@?$list@UDirect3DDeviceInfo@@V?$allocator@UDirect3DDeviceInfo@@@@@@QAE?AViterator@1@V21@ABUDirect3DDeviceInfo@@@Z // TEMPLATE: CONFIG 0x401b60 // TEMPLATE: LEGO1 0x1009c460 // TEMPLATE: BETA10 0x1011f9a0 -// list >::insert +// ?insert@?$list@UMxDisplayMode@@V?$allocator@UMxDisplayMode@@@@@@QAE?AViterator@1@V21@ABUMxDisplayMode@@@Z // SYNTHETIC: CONFIG 0x402be0 // SYNTHETIC: LEGO1 0x1009d450 @@ -198,8 +198,8 @@ class MxDeviceEnumerate { HRESULT EnumDisplayModesCallback(LPDDSURFACEDESC p_ddsd); HRESULT EnumDevicesCallback( LPGUID p_guid, - LPSTR p_deviceDesc, - LPSTR p_deviceName, + LPCSTR p_deviceDesc, + LPCSTR p_deviceName, LPD3DDEVICEDESC p_HWDesc, LPD3DDEVICEDESC p_HELDesc ); @@ -248,34 +248,38 @@ class MxDeviceEnumerate { // list >::iterator::operator* // TEMPLATE: BETA10 0x1011c200 -// list >::iterator::operator++ +// ??Eiterator@?$list@UDirect3DDeviceInfo@@V?$allocator@UDirect3DDeviceInfo@@@@@@QAE?AV01@H@Z // TEMPLATE: BETA10 0x1011c290 -// list >::begin +// ?begin@?$list@UDirect3DDeviceInfo@@V?$allocator@UDirect3DDeviceInfo@@@@@@QAE?AViterator@1@XZ +// Note: could also be +// ?begin@?$list@UDirect3DDeviceInfo@@V?$allocator@UDirect3DDeviceInfo@@@@@@QBE?AVconst_iterator@1@XZ // TEMPLATE: BETA10 0x1011c300 -// list >::end +// ?end@?$list@UDirect3DDeviceInfo@@V?$allocator@UDirect3DDeviceInfo@@@@@@QAE?AViterator@1@XZ +// Note: could also be +// ?end@?$list@UDirect3DDeviceInfo@@V?$allocator@UDirect3DDeviceInfo@@@@@@QBE?AVconst_iterator@1@XZ // TEMPLATE: BETA10 0x1011c4d0 // list >::iterator::operator* // TEMPLATE: BETA10 0x1011c520 -// list >::iterator::operator++ +// ??Eiterator@?$list@UMxDriver@@V?$allocator@UMxDriver@@@@@@QAE?AV01@H@Z // TEMPLATE: BETA10 0x1011c560 -// list >::iterator::operator++ +// ??Eiterator@?$list@UMxDriver@@V?$allocator@UMxDriver@@@@@@QAEAAV01@XZ // TEMPLATE: BETA10 0x1011c590 // list >::_Acc::_Next // TEMPLATE: BETA10 0x1011c5b0 -// list >::begin +// ?begin@?$list@UMxDriver@@V?$allocator@UMxDriver@@@@@@QAE?AViterator@1@XZ // TEMPLATE: BETA10 0x1011c5f0 // list >::iterator::iterator // TEMPLATE: BETA10 0x1011c620 -// list >::end +// ?end@?$list@UMxDriver@@V?$allocator@UMxDriver@@@@@@QAE?AViterator@1@XZ // TEMPLATE: BETA10 0x1011c690 // ??9@YAHABViterator@?$list@UMxDriver@@V?$allocator@UMxDriver@@@@@@0@Z @@ -290,10 +294,10 @@ class MxDeviceEnumerate { // list >::size // TEMPLATE: BETA10 0x1011d3e0 -// list >::erase +// ?erase@?$list@UDirect3DDeviceInfo@@V?$allocator@UDirect3DDeviceInfo@@@@@@QAE?AViterator@1@V21@@Z // TEMPLATE: BETA10 0x1011d570 -// list >::erase +// ?erase@?$list@UMxDriver@@V?$allocator@UMxDriver@@@@@@QAE?AViterator@1@V21@@Z // TEMPLATE: BETA10 0x1011d6a0 // list >::_Freenode diff --git a/LEGO1/omni/include/mxatom.h b/LEGO1/omni/include/mxatom.h index 44d467e3..06da0e84 100644 --- a/LEGO1/omni/include/mxatom.h +++ b/LEGO1/omni/include/mxatom.h @@ -143,8 +143,10 @@ class MxAtomId { // clang-format off // TEMPLATE: LEGO1 0x100af7e0 +// ?erase@?$_Tree@PAVMxAtom@@PAV1@U_Kfn@?$set@PAVMxAtom@@UMxAtomCompare@@V?$allocator@PAVMxAtom@@@@@@UMxAtomCompare@@V?$allocator@PAVMxAtom@@@@@@QAE?AViterator@1@V21@@Z + // TEMPLATE: BETA10 0x10131210 -// _Tree >::_Kfn,MxAtomCompare,allocator >::erase +// ?erase@?$_Tree@PAVMxAtom@@PAV1@U_Kfn@?$set@PAVMxAtom@@UMxAtomCompare@@V?$allocator@PAVMxAtom@@@@@@UMxAtomCompare@@V?$allocator@PAVMxAtom@@@@@@QAE?AViterator@1@V21@0@Z // clang-format on // clang-format off @@ -178,7 +180,9 @@ class MxAtomId { // clang-format off // TEMPLATE: BETA10 0x10132170 -// _Tree >::_Kfn,MxAtomCompare,allocator >::begin +// ?begin@?$_Tree@PAVMxAtom@@PAV1@U_Kfn@?$set@PAVMxAtom@@UMxAtomCompare@@V?$allocator@PAVMxAtom@@@@@@UMxAtomCompare@@V?$allocator@PAVMxAtom@@@@@@QAE?AViterator@1@XZ +// Note: could also be +// ?begin@?$_Tree@PAVMxAtom@@PAV1@U_Kfn@?$set@PAVMxAtom@@UMxAtomCompare@@V?$allocator@PAVMxAtom@@@@@@UMxAtomCompare@@V?$allocator@PAVMxAtom@@@@@@QBE?AVconst_iterator@1@XZ // clang-format on // TEMPLATE: BETA10 0x101321d0 diff --git a/LEGO1/omni/include/mxdisplaysurface.h b/LEGO1/omni/include/mxdisplaysurface.h index eb5d9ea3..290950f2 100644 --- a/LEGO1/omni/include/mxdisplaysurface.h +++ b/LEGO1/omni/include/mxdisplaysurface.h @@ -109,7 +109,7 @@ class MxDisplaySurface : public MxCore { MxU8 p_bpp ); - LPDIRECTDRAWSURFACE FUN_100bc8b0(MxS32 width, MxS32 height); + LPDIRECTDRAWSURFACE FUN_100bc8b0(MxS32 p_width, MxS32 p_height); private: MxU8 CountTotalBitsSetTo1(MxU32 p_param); diff --git a/LEGO1/omni/include/mxdsaction.h b/LEGO1/omni/include/mxdsaction.h index 1597038e..2899d3fb 100644 --- a/LEGO1/omni/include/mxdsaction.h +++ b/LEGO1/omni/include/mxdsaction.h @@ -55,8 +55,8 @@ class MxDSAction : public MxDSObject { virtual MxDSAction* Clone(); // vtable+0x2c virtual void MergeFrom(MxDSAction& p_dsAction); // vtable+0x30 virtual MxBool HasId(MxU32 p_objectId); // vtable+0x34 - virtual void SetUnknown90(MxLong p_unk0x90); // vtable+0x38 - virtual MxLong GetUnknown90(); // vtable+0x3c + virtual void SetTimeStarted(MxLong p_timeStarted); // vtable+0x38 + virtual MxLong GetTimeStarted(); // vtable+0x3c virtual MxLong GetElapsedTime(); // vtable+0x40 void AppendExtra(MxU16 p_extraLength, const char* p_extraData); @@ -104,8 +104,8 @@ class MxDSAction : public MxDSObject { // FUNCTION: BETA10 0x10015430 void SetUp(const Vector3& p_up) { m_up = p_up; } - MxCore* GetUnknown84() { return m_unk0x84; } - void SetUnknown84(MxCore* p_unk0x84) { m_unk0x84 = p_unk0x84; } + MxCore* GetNotificationObject() { return m_notificationObject; } + void SetNotificationObject(MxCore* p_notificationObject) { m_notificationObject = p_notificationObject; } MxCore* GetOrigin() { return m_origin; } void SetOrigin(MxCore* p_origin) { m_origin = p_origin; } @@ -117,20 +117,20 @@ class MxDSAction : public MxDSObject { // MxDSAction::`scalar deleting destructor' protected: - MxU32 m_sizeOnDisk; // 0x2c - MxU32 m_flags; // 0x30 - MxLong m_startTime; // 0x34 - MxLong m_duration; // 0x38 - MxS32 m_loopCount; // 0x3c - Mx3DPointFloat m_location; // 0x40 - Mx3DPointFloat m_direction; // 0x54 - Mx3DPointFloat m_up; // 0x68 - char* m_extraData; // 0x7c - MxU16 m_extraLength; // 0x80 - MxCore* m_unk0x84; // 0x84 - undefined4 m_unk0x88; // 0x88 - MxCore* m_origin; // 0x8c - MxLong m_unk0x90; // 0x90 + MxU32 m_sizeOnDisk; // 0x2c + MxU32 m_flags; // 0x30 + MxLong m_startTime; // 0x34 + MxLong m_duration; // 0x38 + MxS32 m_loopCount; // 0x3c + Mx3DPointFloat m_location; // 0x40 + Mx3DPointFloat m_direction; // 0x54 + Mx3DPointFloat m_up; // 0x68 + char* m_extraData; // 0x7c + MxU16 m_extraLength; // 0x80 + MxCore* m_notificationObject; // 0x84 + undefined4 m_unk0x88; // 0x88 + MxCore* m_origin; // 0x8c + MxLong m_timeStarted; // 0x90 }; #endif // MXDSACTION_H diff --git a/LEGO1/omni/include/mxdsmultiaction.h b/LEGO1/omni/include/mxdsmultiaction.h index 90cc5192..77ae8d67 100644 --- a/LEGO1/omni/include/mxdsmultiaction.h +++ b/LEGO1/omni/include/mxdsmultiaction.h @@ -38,7 +38,7 @@ class MxDSMultiAction : public MxDSAction { MxDSAction* Clone() override; // vtable+0x2c void MergeFrom(MxDSAction& p_dsAction) override; // vtable+0x30 MxBool HasId(MxU32 p_objectId) override; // vtable+0x34 - void SetUnknown90(MxLong p_unk0x90) override; // vtable+0x38 + void SetTimeStarted(MxLong p_timeStarted) override; // vtable+0x38 // FUNCTION: BETA10 0x1004e180 MxDSActionList* GetActionList() const { return m_actionList; } diff --git a/LEGO1/omni/include/mxhashtable.h b/LEGO1/omni/include/mxhashtable.h index e15128e9..65ce11a0 100644 --- a/LEGO1/omni/include/mxhashtable.h +++ b/LEGO1/omni/include/mxhashtable.h @@ -13,7 +13,7 @@ class MxHashTableCursor; template class MxHashTableNode { public: - MxHashTableNode(T p_obj, MxU32 p_hash, MxHashTableNode* p_prev, MxHashTableNode* p_next) + MxHashTableNode(T p_obj, MxU32 p_hash, MxHashTableNode* p_prev, MxHashTableNode* p_next) { m_obj = p_obj; m_hash = p_hash; diff --git a/LEGO1/omni/include/mxparam.h b/LEGO1/omni/include/mxparam.h index 57df088e..75ab4eac 100644 --- a/LEGO1/omni/include/mxparam.h +++ b/LEGO1/omni/include/mxparam.h @@ -14,7 +14,7 @@ class MxParam { }; // SYNTHETIC: BETA10 0x10013710 -// MxParam::MxParam +// ??0MxParam@@QAE@XZ // SYNTHETIC: ISLE 0x401540 // SYNTHETIC: LEGO1 0x10010370 diff --git a/LEGO1/omni/include/mxpresenterlist.h b/LEGO1/omni/include/mxpresenterlist.h index f5f658ac..0e8bd316 100644 --- a/LEGO1/omni/include/mxpresenterlist.h +++ b/LEGO1/omni/include/mxpresenterlist.h @@ -107,6 +107,6 @@ class MxPresenterListCursor : public MxPtrListCursor { // MxListCursor::MxListCursor // TEMPLATE: BETA10 0x100d9420 -// MxListCursor::Prev +// ?Prev@?$MxListCursor@PAVMxPresenter@@@@QAEEAAPAVMxPresenter@@@Z #endif // MXPRESENTERLIST_H diff --git a/LEGO1/omni/include/mxstreamer.h b/LEGO1/omni/include/mxstreamer.h index 208f3ce1..1b5a7082 100644 --- a/LEGO1/omni/include/mxstreamer.h +++ b/LEGO1/omni/include/mxstreamer.h @@ -134,7 +134,7 @@ class MxStreamer : public MxCore { // list >::end // TEMPLATE: BETA10 0x101461b0 -// list >::iterator::operator++ +// ??Eiterator@?$list@PAVMxStreamController@@V?$allocator@PAVMxStreamController@@@@@@QAE?AV01@H@Z // SYNTHETIC: LEGO1 0x100b9120 // SYNTHETIC: BETA10 0x101466e0 diff --git a/LEGO1/omni/include/mxthread.h b/LEGO1/omni/include/mxthread.h index 57ed2443..6d148edd 100644 --- a/LEGO1/omni/include/mxthread.h +++ b/LEGO1/omni/include/mxthread.h @@ -14,7 +14,7 @@ class MxThread { // Note: Comes before virtual destructor virtual MxResult Run(); - MxResult Start(MxS32 p_stack, MxS32 p_flag); + MxResult Start(MxS32 p_stackSize, MxS32 p_flag); void Terminate(); void Sleep(MxS32 p_milliseconds); diff --git a/LEGO1/omni/include/mxutilities.h b/LEGO1/omni/include/mxutilities.h index 51b897b7..8a897e39 100644 --- a/LEGO1/omni/include/mxutilities.h +++ b/LEGO1/omni/include/mxutilities.h @@ -75,7 +75,7 @@ void MakeSourceName(char*, const char*); void OmniError(const char* p_message, MxS32 p_status); void SetOmniUserMessage(void (*p_omniUserMessage)(const char*, MxS32)); MxBool ContainsPresenter(MxCompositePresenterList& p_presenterList, MxPresenter* p_presenter); -void FUN_100b7220(MxDSAction* p_action, MxU32 p_newFlags, MxBool p_setFlags); +void ApplyMask(MxDSAction* p_action, MxU32 p_mask, MxBool p_setFlags); MxBool KeyValueStringParse(char*, const char*, const char*); // TEMPLATE: BETA10 0x1012dfd0 diff --git a/LEGO1/omni/include/mxvideoparamflags.h b/LEGO1/omni/include/mxvideoparamflags.h index 4ed414d6..21ed6921 100644 --- a/LEGO1/omni/include/mxvideoparamflags.h +++ b/LEGO1/omni/include/mxvideoparamflags.h @@ -31,7 +31,7 @@ class MxVideoParamFlags { void SetF1bit7(MxBool p_e) { m_flags1.m_bit7 = p_e; } // FUNCTION: BETA10 0x100d81b0 - void SetF2bit0(MxBool p_e) { m_flags2.m_bit0 = p_e; } + void SetLacksLightSupport(MxBool p_e) { m_flags2.m_bit0 = p_e; } // inlined in ISLE void SetF2bit1(MxBool p_e) { m_flags2.m_bit1 = p_e; } @@ -55,7 +55,7 @@ class MxVideoParamFlags { MxBool GetWideViewAngle() { return m_flags1.m_bit6; } // FUNCTION: BETA10 0x100886b0 - MxBool GetF2bit0() { return m_flags2.m_bit0; } + MxBool GetLacksLightSupport() { return m_flags2.m_bit0; } // FUNCTION: BETA10 0x10142050 MxBool GetF2bit1() { return m_flags2.m_bit1; } diff --git a/LEGO1/omni/include/mxwavepresenter.h b/LEGO1/omni/include/mxwavepresenter.h index cf64b90f..52758951 100644 --- a/LEGO1/omni/include/mxwavepresenter.h +++ b/LEGO1/omni/include/mxwavepresenter.h @@ -71,7 +71,7 @@ class MxWavePresenter : public MxSoundPresenter { void Destroy(MxBool p_fromDestructor); MxS8 GetPlayedChunks(); - MxBool FUN_100b1ba0(); + MxBool ReadyForNextChunk(); void WriteToSoundBuffer(void* p_audioPtr, MxU32 p_length); WaveFormat* m_waveFormat; // 0x54 diff --git a/LEGO1/omni/src/action/mxdsaction.cpp b/LEGO1/omni/src/action/mxdsaction.cpp index 8dc22fcf..4b77c6ed 100644 --- a/LEGO1/omni/src/action/mxdsaction.cpp +++ b/LEGO1/omni/src/action/mxdsaction.cpp @@ -28,10 +28,10 @@ MxDSAction::MxDSAction() m_location.Fill(FLT_MAX); m_direction.Fill(FLT_MAX); m_up.Fill(FLT_MAX); - m_unk0x84 = NULL; + m_notificationObject = NULL; m_unk0x88 = 0; m_origin = NULL; - m_unk0x90 = INT_MIN; + m_timeStarted = INT_MIN; } // FUNCTION: LEGO1 0x100ad940 @@ -57,16 +57,16 @@ MxBool MxDSAction::HasId(MxU32 p_objectId) // FUNCTION: LEGO1 0x100ada40 // FUNCTION: BETA10 0x1012bdf0 -void MxDSAction::SetUnknown90(MxLong p_unk0x90) +void MxDSAction::SetTimeStarted(MxLong p_timeStarted) { - m_unk0x90 = p_unk0x90; + m_timeStarted = p_timeStarted; } // FUNCTION: LEGO1 0x100ada50 // FUNCTION: BETA10 0x1012be20 -MxLong MxDSAction::GetUnknown90() +MxLong MxDSAction::GetTimeStarted() { - return m_unk0x90; + return m_timeStarted; } // FUNCTION: LEGO1 0x100ada80 @@ -89,10 +89,10 @@ void MxDSAction::CopyFrom(MxDSAction& p_dsAction) m_direction = p_dsAction.m_direction; m_up = p_dsAction.m_up; AppendExtra(p_dsAction.m_extraLength, p_dsAction.m_extraData); - m_unk0x84 = p_dsAction.m_unk0x84; + m_notificationObject = p_dsAction.m_notificationObject; m_unk0x88 = p_dsAction.m_unk0x88; m_origin = p_dsAction.m_origin; - m_unk0x90 = p_dsAction.m_unk0x90; + m_timeStarted = p_dsAction.m_timeStarted; } // FUNCTION: BETA10 0x1012b2b3 @@ -113,14 +113,14 @@ undefined4 MxDSAction::VTable0x14() MxU32 MxDSAction::GetSizeOnDisk() { MxU32 size = MxDSObject::GetSizeOnDisk(); - size += sizeof(m_flags); - size += sizeof(m_startTime); - size += sizeof(m_duration); - size += sizeof(m_loopCount); + size += sizeof(MxU32); + size += sizeof(MxS32); + size += sizeof(MxS32); + size += sizeof(MxS32); size += sizeof(double) * 3; // m_location size += sizeof(double) * 3; // m_direction size += sizeof(double) * 3; // m_up - size += sizeof(m_extraLength); + size += sizeof(MxU16); size += m_extraLength; m_sizeOnDisk = size - MxDSObject::GetSizeOnDisk(); @@ -158,7 +158,7 @@ MxDSAction* MxDSAction::Clone() // FUNCTION: BETA10 0x1012b4ca MxLong MxDSAction::GetElapsedTime() { - return Timer()->GetTime() - m_unk0x90; + return Timer()->GetTime() - m_timeStarted; } // FUNCTION: LEGO1 0x100add00 @@ -256,15 +256,15 @@ void MxDSAction::AppendExtra(MxU16 p_extraLength, const char* p_extraData) // FUNCTION: LEGO1 0x100adf70 // FUNCTION: BETA10 0x1012ba6a -void MxDSAction::Deserialize(MxU8*& p_source, MxS16 p_unk0x24) +void MxDSAction::Deserialize(MxU8*& p_source, MxS16 p_flags) { - MxDSObject::Deserialize(p_source, p_unk0x24); + MxDSObject::Deserialize(p_source, p_flags); // clang-format off - m_flags = *( MxU32*) p_source; p_source += sizeof(m_flags); - m_startTime = *(MxLong*) p_source; p_source += sizeof(m_startTime); - m_duration = *(MxLong*) p_source; p_source += sizeof(m_duration); - m_loopCount = *( MxS32*) p_source; p_source += sizeof(m_loopCount); + m_flags = *( MxU32*) p_source; p_source += sizeof(MxU32); + m_startTime = *(MxLong*) p_source; p_source += sizeof(MxS32); + m_duration = *(MxLong*) p_source; p_source += sizeof(MxS32); + m_loopCount = *( MxS32*) p_source; p_source += sizeof(MxS32); m_location[0] = *(double*) p_source; p_source += sizeof(double); m_location[1] = *(double*) p_source; p_source += sizeof(double); m_location[2] = *(double*) p_source; p_source += sizeof(double); diff --git a/LEGO1/omni/src/action/mxdsmediaaction.cpp b/LEGO1/omni/src/action/mxdsmediaaction.cpp index 00ed247a..47a43f19 100644 --- a/LEGO1/omni/src/action/mxdsmediaaction.cpp +++ b/LEGO1/omni/src/action/mxdsmediaaction.cpp @@ -116,12 +116,12 @@ MxU32 MxDSMediaAction::GetSizeOnDisk() totalSizeOnDisk++; } - totalSizeOnDisk += sizeof(m_unk0x9c.m_unk0x00); - totalSizeOnDisk += sizeof(m_unk0x9c.m_unk0x04); - totalSizeOnDisk += sizeof(m_framesPerSecond); - totalSizeOnDisk += sizeof(m_mediaFormat); - totalSizeOnDisk += sizeof(m_paletteManagement); - totalSizeOnDisk += sizeof(m_sustainTime); + totalSizeOnDisk += sizeof(undefined4); + totalSizeOnDisk += sizeof(undefined4); + totalSizeOnDisk += sizeof(MxS32); + totalSizeOnDisk += sizeof(MxS32); + totalSizeOnDisk += sizeof(MxS32); + totalSizeOnDisk += sizeof(MxS32); m_sizeOnDisk = totalSizeOnDisk - MxDSAction::GetSizeOnDisk(); return totalSizeOnDisk; @@ -129,20 +129,20 @@ MxU32 MxDSMediaAction::GetSizeOnDisk() // FUNCTION: LEGO1 0x100c8f60 // FUNCTION: BETA10 0x1015cc93 -void MxDSMediaAction::Deserialize(MxU8*& p_source, MxS16 p_unk0x24) +void MxDSMediaAction::Deserialize(MxU8*& p_source, MxS16 p_flags) { - MxDSAction::Deserialize(p_source, p_unk0x24); + MxDSAction::Deserialize(p_source, p_flags); CopyMediaSrcPath((char*) p_source); p_source += strlen(m_mediaSrcPath) + 1; // clang-format off - m_unk0x9c.SetUnk0x00(*(MxU32*) p_source); p_source += sizeof(m_unk0x9c.m_unk0x00); - m_unk0x9c.SetUnk0x04(*(MxU32*) p_source); p_source += sizeof(m_unk0x9c.m_unk0x04); + m_unk0x9c.SetUnk0x00(*(MxU32*) p_source); p_source += sizeof(undefined4); + m_unk0x9c.SetUnk0x04(*(MxU32*) p_source); p_source += sizeof(undefined4); - m_framesPerSecond = *(MxS32*) p_source; p_source += sizeof(m_framesPerSecond); - m_mediaFormat = *(MxS32*) p_source; p_source += sizeof(m_mediaFormat); - m_paletteManagement = *(MxS32*) p_source; p_source += sizeof(m_paletteManagement); - m_sustainTime = *(MxS32*) p_source; p_source += sizeof(m_sustainTime); + m_framesPerSecond = *(MxS32*) p_source; p_source += sizeof(MxS32); + m_mediaFormat = *(MxS32*) p_source; p_source += sizeof(MxS32); + m_paletteManagement = *(MxS32*) p_source; p_source += sizeof(MxS32); + m_sustainTime = *(MxS32*) p_source; p_source += sizeof(MxS32); // clang-format on } diff --git a/LEGO1/omni/src/action/mxdsmultiaction.cpp b/LEGO1/omni/src/action/mxdsmultiaction.cpp index d1214d3d..648de181 100644 --- a/LEGO1/omni/src/action/mxdsmultiaction.cpp +++ b/LEGO1/omni/src/action/mxdsmultiaction.cpp @@ -57,14 +57,14 @@ MxDSMultiAction& MxDSMultiAction::operator=(MxDSMultiAction& p_dsMultiAction) // FUNCTION: LEGO1 0x100ca290 // FUNCTION: BETA10 0x10159728 -void MxDSMultiAction::SetUnknown90(MxLong p_unk0x90) +void MxDSMultiAction::SetTimeStarted(MxLong p_timeStarted) { - m_unk0x90 = p_unk0x90; + m_timeStarted = p_timeStarted; MxDSActionListCursor cursor(m_actionList); MxDSAction* action; while (cursor.Next(action)) { - action->SetUnknown90(p_unk0x90); + action->SetTimeStarted(p_timeStarted); } } @@ -149,9 +149,9 @@ MxU32 MxDSMultiAction::GetSizeOnDisk() // FUNCTION: LEGO1 0x100ca7b0 // FUNCTION: BETA10 0x10159b79 -void MxDSMultiAction::Deserialize(MxU8*& p_source, MxS16 p_unk0x24) +void MxDSMultiAction::Deserialize(MxU8*& p_source, MxS16 p_flags) { - MxDSAction::Deserialize(p_source, p_unk0x24); + MxDSAction::Deserialize(p_source, p_flags); MxU32 extraFlag = *(MxU32*) (p_source + 4) & 1; p_source += 12; @@ -164,7 +164,7 @@ void MxDSMultiAction::Deserialize(MxU8*& p_source, MxS16 p_unk0x24) MxU32 extraFlag = *(MxU32*) (p_source + 4) & 1; p_source += 8; - MxDSAction* action = (MxDSAction*) DeserializeDSObjectDispatch(p_source, p_unk0x24); + MxDSAction* action = (MxDSAction*) DeserializeDSObjectDispatch(p_source, p_flags); p_source += extraFlag; m_actionList->Append(action); diff --git a/LEGO1/omni/src/action/mxdsobject.cpp b/LEGO1/omni/src/action/mxdsobject.cpp index 6cea1ea0..ed2a43e8 100644 --- a/LEGO1/omni/src/action/mxdsobject.cpp +++ b/LEGO1/omni/src/action/mxdsobject.cpp @@ -156,7 +156,7 @@ MxU32 MxDSObject::GetSizeOnDisk() // FUNCTION: LEGO1 0x100bfa20 // FUNCTION: BETA10 0x10147d73 -void MxDSObject::Deserialize(MxU8*& p_source, MxS16 p_unk0x24) +void MxDSObject::Deserialize(MxU8*& p_source, MxS16 p_flags) { SetSourceName((char*) p_source); p_source += strlen(m_sourceName) + 1; @@ -170,7 +170,7 @@ void MxDSObject::Deserialize(MxU8*& p_source, MxS16 p_unk0x24) m_objectId = *(MxU32*) p_source; p_source += sizeof(m_objectId); - m_unk0x24 = p_unk0x24; + m_unk0x24 = p_flags; } // FUNCTION: LEGO1 0x100bfa80 diff --git a/LEGO1/omni/src/action/mxdsselectaction.cpp b/LEGO1/omni/src/action/mxdsselectaction.cpp index d66e761f..7171224f 100644 --- a/LEGO1/omni/src/action/mxdsselectaction.cpp +++ b/LEGO1/omni/src/action/mxdsselectaction.cpp @@ -92,11 +92,11 @@ MxU32 MxDSSelectAction::GetSizeOnDisk() // FUNCTION: LEGO1 0x100cbf60 // FUNCTION: BETA10 0x1015aa30 -void MxDSSelectAction::Deserialize(MxU8*& p_source, MxS16 p_unk0x24) +void MxDSSelectAction::Deserialize(MxU8*& p_source, MxS16 p_flags) { MxDSAction* action = NULL; MxString string; - MxDSAction::Deserialize(p_source, p_unk0x24); + MxDSAction::Deserialize(p_source, p_flags); MxU32 extraFlag = *(MxU32*) (p_source + 4) & 1; p_source += 12; @@ -138,7 +138,7 @@ void MxDSSelectAction::Deserialize(MxU8*& p_source, MxS16 p_unk0x24) MxU32 extraFlag = *(MxU32*) (p_source + 4) & 1; p_source += 8; - action = (MxDSAction*) DeserializeDSObjectDispatch(p_source, p_unk0x24); + action = (MxDSAction*) DeserializeDSObjectDispatch(p_source, p_flags); if (index == i) { m_actionList->Append(action); diff --git a/LEGO1/omni/src/action/mxdssound.cpp b/LEGO1/omni/src/action/mxdssound.cpp index 5a12aa90..b16214d5 100644 --- a/LEGO1/omni/src/action/mxdssound.cpp +++ b/LEGO1/omni/src/action/mxdssound.cpp @@ -58,9 +58,9 @@ MxDSAction* MxDSSound::Clone() // FUNCTION: LEGO1 0x100c95a0 // FUNCTION: BETA10 0x1015d272 -void MxDSSound::Deserialize(MxU8*& p_source, MxS16 p_unk0x24) +void MxDSSound::Deserialize(MxU8*& p_source, MxS16 p_flags) { - MxDSMediaAction::Deserialize(p_source, p_unk0x24); + MxDSMediaAction::Deserialize(p_source, p_flags); m_volume = *(MxS32*) p_source; p_source += sizeof(m_volume); } diff --git a/LEGO1/omni/src/audio/mxmusicmanager.cpp b/LEGO1/omni/src/audio/mxmusicmanager.cpp index 762d3757..1a25cfc5 100644 --- a/LEGO1/omni/src/audio/mxmusicmanager.cpp +++ b/LEGO1/omni/src/audio/mxmusicmanager.cpp @@ -216,8 +216,8 @@ MxResult MxMusicManager::InitializeMIDI(MxU8* p_data, MxS32 p_loopCount) MxU32 device = 0; for (; device < total; device++) { - MIDIOUTCAPSA caps; - midiOutGetDevCapsA(device, &caps, sizeof(MIDIOUTCAPSA)); + MIDIOUTCAPS caps; + midiOutGetDevCaps(device, &caps, sizeof(MIDIOUTCAPS)); if (caps.wTechnology == MOD_FMSYNTH) { break; } diff --git a/LEGO1/omni/src/audio/mxwavepresenter.cpp b/LEGO1/omni/src/audio/mxwavepresenter.cpp index ffc7e708..37a75e5e 100644 --- a/LEGO1/omni/src/audio/mxwavepresenter.cpp +++ b/LEGO1/omni/src/audio/mxwavepresenter.cpp @@ -67,7 +67,7 @@ MxS8 MxWavePresenter::GetPlayedChunks() } // FUNCTION: LEGO1 0x100b1ba0 -MxBool MxWavePresenter::FUN_100b1ba0() +MxBool MxWavePresenter::ReadyForNextChunk() { return !m_started || GetPlayedChunks() != m_writtenChunks; } @@ -248,7 +248,7 @@ MxResult MxWavePresenter::PutData() if (IsEnabled()) { switch (m_currentTickleState) { case e_streaming: - if (m_currentChunk && FUN_100b1ba0()) { + if (m_currentChunk && ReadyForNextChunk()) { WriteToSoundBuffer(m_currentChunk->GetData(), m_currentChunk->GetLength()); m_subscriber->FreeDataChunk(m_currentChunk); m_currentChunk = NULL; diff --git a/LEGO1/omni/src/common/mxmediapresenter.cpp b/LEGO1/omni/src/common/mxmediapresenter.cpp index 0a1b96d9..c8b9abcd 100644 --- a/LEGO1/omni/src/common/mxmediapresenter.cpp +++ b/LEGO1/omni/src/common/mxmediapresenter.cpp @@ -252,7 +252,7 @@ void MxMediaPresenter::Enable(MxBool p_enable) if (p_enable) { MxLong time = Timer()->GetTime(); - m_action->SetUnknown90(time); + m_action->SetTimeStarted(time); SetTickleState(e_repeating); } else { diff --git a/LEGO1/omni/src/common/mxutilities.cpp b/LEGO1/omni/src/common/mxutilities.cpp index 365d6b18..54714c4d 100644 --- a/LEGO1/omni/src/common/mxutilities.cpp +++ b/LEGO1/omni/src/common/mxutilities.cpp @@ -150,16 +150,16 @@ void SetOmniUserMessage(void (*p_omniUserMessage)(const char*, MxS32)) // FUNCTION: LEGO1 0x100b7220 // FUNCTION: BETA10 0x10136f37 -void FUN_100b7220(MxDSAction* p_action, MxU32 p_newFlags, MxBool p_setFlags) +void ApplyMask(MxDSAction* p_action, MxU32 p_mask, MxBool p_setFlags) { MxU32 oldFlags = p_action->GetFlags(); MxU32 newFlags; if (p_setFlags) { - newFlags = oldFlags | p_newFlags; + newFlags = oldFlags | p_mask; } else { - newFlags = oldFlags & ~p_newFlags; + newFlags = oldFlags & ~p_mask; } p_action->SetFlags(newFlags); @@ -169,7 +169,7 @@ void FUN_100b7220(MxDSAction* p_action, MxU32 p_newFlags, MxBool p_setFlags) MxDSAction* action; while (cursor.Next(action)) { - FUN_100b7220(action, p_newFlags, p_setFlags); + ApplyMask(action, p_mask, p_setFlags); } } } diff --git a/LEGO1/omni/src/main/mxomni.cpp b/LEGO1/omni/src/main/mxomni.cpp index d7e79bb0..fd36b683 100644 --- a/LEGO1/omni/src/main/mxomni.cpp +++ b/LEGO1/omni/src/main/mxomni.cpp @@ -271,9 +271,9 @@ MxResult MxOmni::CreatePresenter(MxStreamController* p_controller, MxDSAction& p NotificationManager()->Send(sender, MxType4NotificationParam(this, &p_action, object)); } - if (p_action.GetUnknown84()) { + if (p_action.GetNotificationObject()) { NotificationManager()->Send( - p_action.GetUnknown84(), + p_action.GetNotificationObject(), MxStartActionNotificationParam(c_notificationStartAction, object, &p_action, FALSE) ); } diff --git a/LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp b/LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp index 40ae8ae9..0e34ed5a 100644 --- a/LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp +++ b/LEGO1/omni/src/stream/mxdiskstreamcontroller.cpp @@ -316,7 +316,7 @@ MxResult MxDiskStreamController::VTable0x20(MxDSAction* p_action) if (entry) { MxDSStreamingAction* action = new MxDSStreamingAction(*p_action, 0); action->SetUnknown28(entry->GetUnknown28()); - action->SetUnknown84(entry->GetUnknown84()); + action->SetNotificationObject(entry->GetNotificationObject()); action->SetOrigin(entry->GetOrigin()); action->SetUnknowna0(entry->GetUnknowna4()); diff --git a/LEGO1/omni/src/stream/mxdsbuffer.cpp b/LEGO1/omni/src/stream/mxdsbuffer.cpp index 4b7386b2..a73be62f 100644 --- a/LEGO1/omni/src/stream/mxdsbuffer.cpp +++ b/LEGO1/omni/src/stream/mxdsbuffer.cpp @@ -207,9 +207,9 @@ MxResult MxDSBuffer::StartPresenterFromAction( if (!m_unk0x30->GetInternalAction()) { p_objectheader->SetAtomId(p_action1->GetAtomId()); p_objectheader->SetUnknown28(p_action1->GetUnknown28()); - p_objectheader->SetUnknown84(p_action1->GetUnknown84()); + p_objectheader->SetNotificationObject(p_action1->GetNotificationObject()); p_objectheader->SetOrigin(p_action1->GetOrigin()); - p_objectheader->SetUnknown90(p_action1->GetUnknown90()); + p_objectheader->SetTimeStarted(p_action1->GetTimeStarted()); p_objectheader->MergeFrom(*p_action1); m_unk0x30->SetInternalAction(p_objectheader->Clone()); diff --git a/LEGO1/omni/src/stream/mxdsfile.cpp b/LEGO1/omni/src/stream/mxdsfile.cpp index 51ca6615..4ab7edd0 100644 --- a/LEGO1/omni/src/stream/mxdsfile.cpp +++ b/LEGO1/omni/src/stream/mxdsfile.cpp @@ -71,7 +71,7 @@ MxResult MxDSFile::ReadChunks() m_io.Read(&m_header, 0x0c); if ((m_header.m_majorVersion != SI_MAJOR_VERSION) || (m_header.m_minorVersion != SI_MINOR_VERSION)) { sprintf(tempBuffer, "Wrong SI file version. %d.%d expected.", SI_MAJOR_VERSION, SI_MINOR_VERSION); - MessageBoxA(NULL, tempBuffer, NULL, MB_ICONERROR); + MessageBox(NULL, tempBuffer, NULL, MB_ICONERROR); return FAILURE; } diff --git a/LEGO1/omni/src/stream/mxstreamchunk.cpp b/LEGO1/omni/src/stream/mxstreamchunk.cpp index 7944b2f2..03bcb5d6 100644 --- a/LEGO1/omni/src/stream/mxstreamchunk.cpp +++ b/LEGO1/omni/src/stream/mxstreamchunk.cpp @@ -38,16 +38,16 @@ MxU32 MxStreamChunk::ReadChunkHeader(MxU8* p_chunkData) MxU8* chunkData = p_chunkData; memcpy(&m_flags, p_chunkData, sizeof(m_flags)); - p_chunkData += sizeof(m_flags); + p_chunkData += sizeof(MxU16); memcpy(&m_objectId, p_chunkData, sizeof(m_objectId)); - p_chunkData += sizeof(m_objectId); + p_chunkData += sizeof(MxU32); memcpy(&m_time, p_chunkData, sizeof(m_time)); - p_chunkData += sizeof(m_time); + p_chunkData += sizeof(MxU32); memcpy(&m_length, p_chunkData, sizeof(m_length)); - p_chunkData += sizeof(m_length); + p_chunkData += sizeof(MxU32); m_data = p_chunkData; headersize = p_chunkData - chunkData; diff --git a/LEGO1/omni/src/stream/mxstreamcontroller.cpp b/LEGO1/omni/src/stream/mxstreamcontroller.cpp index dadd03ca..8c3cf079 100644 --- a/LEGO1/omni/src/stream/mxstreamcontroller.cpp +++ b/LEGO1/omni/src/stream/mxstreamcontroller.cpp @@ -202,7 +202,7 @@ MxResult MxStreamController::FUN_100c1a00(MxDSAction* p_action, MxU32 p_offset) streamingAction->SetObjectId(p_action->GetObjectId()); MxLong time = Timer()->GetTime(); - streamingAction->SetUnknown90(time); + streamingAction->SetTimeStarted(time); m_unk0x3c.PushBack(streamingAction); return SUCCESS; diff --git a/LEGO1/omni/src/system/mxcriticalsection.cpp b/LEGO1/omni/src/system/mxcriticalsection.cpp index 5c1ca9bf..01c54c15 100644 --- a/LEGO1/omni/src/system/mxcriticalsection.cpp +++ b/LEGO1/omni/src/system/mxcriticalsection.cpp @@ -15,7 +15,7 @@ MxCriticalSection::MxCriticalSection() HANDLE mutex; if (g_useMutex) { - mutex = CreateMutexA(NULL, FALSE, NULL); + mutex = CreateMutex(NULL, FALSE, NULL); m_mutex = mutex; } else { diff --git a/LEGO1/omni/src/system/mxsemaphore.cpp b/LEGO1/omni/src/system/mxsemaphore.cpp index 5c8b2a1f..f67a4d70 100644 --- a/LEGO1/omni/src/system/mxsemaphore.cpp +++ b/LEGO1/omni/src/system/mxsemaphore.cpp @@ -16,7 +16,7 @@ MxResult MxSemaphore::Init(MxU32 p_initialCount, MxU32 p_maxCount) { MxResult result = FAILURE; - if ((m_hSemaphore = CreateSemaphoreA(NULL, p_initialCount, p_maxCount, NULL))) { + if ((m_hSemaphore = CreateSemaphore(NULL, p_initialCount, p_maxCount, NULL))) { result = SUCCESS; } diff --git a/LEGO1/omni/src/system/mxthread.cpp b/LEGO1/omni/src/system/mxthread.cpp index b0bd5b51..f639f74d 100644 --- a/LEGO1/omni/src/system/mxthread.cpp +++ b/LEGO1/omni/src/system/mxthread.cpp @@ -25,13 +25,14 @@ MxThread::~MxThread() typedef unsigned(__stdcall* ThreadFunc)(void*); // FUNCTION: LEGO1 0x100bf610 -MxResult MxThread::Start(MxS32 p_stack, MxS32 p_flag) +MxResult MxThread::Start(MxS32 p_stackSize, MxS32 p_flag) { MxResult result = FAILURE; if (m_semaphore.Init(0, 1) == SUCCESS) { if ((m_hThread = - _beginthreadex(NULL, p_stack << 2, (ThreadFunc) &MxThread::ThreadProc, this, p_flag, &m_threadId))) { + _beginthreadex(NULL, p_stackSize * 4, (ThreadFunc) &MxThread::ThreadProc, this, p_flag, &m_threadId) + )) { result = SUCCESS; } } diff --git a/LEGO1/omni/src/video/flic.cpp b/LEGO1/omni/src/video/flic.cpp index cfd7541e..d262e517 100644 --- a/LEGO1/omni/src/video/flic.cpp +++ b/LEGO1/omni/src/video/flic.cpp @@ -288,7 +288,7 @@ void DecodeBrun(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_da while (--line >= 0) { short column = 0; data++; - char count = 0; + signed char count = 0; while ((column += count) < width2) { count = *data++; @@ -331,7 +331,7 @@ void DecodeLC(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_data while (packets > 0) { column += *data++; // skip byte - char type = *((char*) data++); + signed char type = *((signed char*) data++); if (type < 0) { type = -type; @@ -355,64 +355,99 @@ void DecodeLC(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_data // FUNCTION: BETA10 0x1013e61d void DecodeSS2(LPBITMAPINFOHEADER p_bitmapHeader, BYTE* p_pixelData, BYTE* p_data, FLIC_HEADER* p_flcHeader) { - short width = (short) p_flcHeader->width - 1; - short row = (short) p_flcHeader->height - 1; - short lines = *((short*) p_data); - BYTE* data = p_data + 2; + short xofs = 0; + short yofs = 0; - while (--lines > 0) { - short token; + short width = p_flcHeader->width; + short token = 0; - while (TRUE) { - token = *((short*) data); - data += 2; + // LINE: BETA10 0x1013e643 + short xmax = xofs + width - 1; - if (token < 0) { - if (token & 0x4000) { - row += token; - } - else { - WritePixel(p_bitmapHeader, p_pixelData, width, row, token); - token = *((WORD*) data); - data += 2; + union { + BYTE* byte; + WORD* word; + // LINE: BETA10 0x1013e652 + } data = {p_data}; - if (!token) { - row--; - if (--lines <= 0) { - return; - } - } - else { - break; - } - } + // The first word in the data following the chunk header contains the number of lines in the chunk. + // The line count does not include skipped lines. + short lines = *(short*) data.word++; + + // LINE: BETA10 0x1013e666 + short row = p_flcHeader->height - yofs - 1; + + goto start_packet; + +skip_lines: + // The layout in BETA10 strongly suggests that lots of `goto`s are used. + // LINE: BETA10 0x1013e684 + row += token; + +start_packet: + // LINE: BETA10 0x1013e692 + token = *(short*) data.word++; + + if (token >= 0) { + goto column_loop; + } + + if ((unsigned short) token & 0x4000) { + goto skip_lines; + } + + WritePixel(p_bitmapHeader, p_pixelData, xmax, row, token); + token = *(short*) data.word++; + + // LINE: BETA10 0x1013e6ef + if (!token) { + row--; + if (--lines > 0) { + goto start_packet; + } + return; + } + else { + + column_loop: + // LINE: BETA10 0x1013e71e + short column = xofs; + + column_loop_inner: + // LINE: BETA10 0x1013e726 + column += *data.byte++; + // LINE: BETA10 0x1013e73a + short type = *(signed char*) data.byte++; + type += type; + + if (type >= 0) { + WritePixels(p_bitmapHeader, p_pixelData, column, row, data.byte, type); + column += type; + data.byte += type; + // LINE: BETA10 0x1013e797 + if (--token != 0) { + goto column_loop_inner; } - else { - break; + row--; + if (--lines > 0) { + goto start_packet; } + return; } - short column = 0; - do { - column += *(data++); - short type = *((char*) data++); - type += type; - - if (type >= 0) { - WritePixels(p_bitmapHeader, p_pixelData, column, row, data, type); - column += type; - data += type; - } - else { - type = -type; - short p_pixel = *((WORD*) data); - data += 2; - WritePixelPairs(p_bitmapHeader, p_pixelData, column, row, p_pixel, type >> 1); - column += type; - } - } while (--token); - + type = -type; + WORD* p_pixel = data.word++; + WritePixelPairs(p_bitmapHeader, p_pixelData, column, row, *p_pixel, type >> 1); + column += type; + // LINE: BETA10 0x1013e813 + if (--token != 0) { + goto column_loop_inner; + } row--; + if (--lines > 0) { + goto start_packet; + } + return; } } diff --git a/LEGO1/omni/src/video/mxbitmap.cpp b/LEGO1/omni/src/video/mxbitmap.cpp index d914d7fa..9d2bffdc 100644 --- a/LEGO1/omni/src/video/mxbitmap.cpp +++ b/LEGO1/omni/src/video/mxbitmap.cpp @@ -7,6 +7,8 @@ DECOMP_SIZE_ASSERT(MxBitmap, 0x20); DECOMP_SIZE_ASSERT(MxBITMAPINFO, 0x428); +DECOMP_SIZE_ASSERT(BITMAPFILEHEADER, 0xe); + // GLOBAL: LEGO1 0x10102184 // GLOBAL: BETA10 0x10203030 MxU16 g_bitmapSignature = TWOCC('B', 'M'); @@ -28,10 +30,10 @@ MxBitmap::MxBitmap() MxBitmap::~MxBitmap() { if (m_info) { - delete m_info; + delete[] ((MxU8*) m_info); } if (m_data) { - delete m_data; + delete[] m_data; } if (m_palette) { delete m_palette; @@ -80,7 +82,7 @@ MxResult MxBitmap::SetSize(MxS32 p_width, MxS32 p_height, MxPalette* p_palette, done: if (ret) { if (m_info) { - delete[] m_info; + delete[] ((MxU8*) m_info); m_info = NULL; } @@ -118,7 +120,7 @@ MxResult MxBitmap::ImportBitmapInfo(MxBITMAPINFO* p_info) done: if (result != SUCCESS) { if (m_info) { - delete[] m_info; + delete[] ((MxU8*) m_info); m_info = NULL; } @@ -157,7 +159,7 @@ MxResult MxBitmap::ImportBitmap(MxBitmap* p_bitmap) done: if (result != SUCCESS) { if (m_info) { - delete[] m_info; + delete[] ((MxU8*) m_info); m_info = NULL; } @@ -177,7 +179,7 @@ MxLong MxBitmap::Read(const char* p_filename) MxResult result = FAILURE; HANDLE handle = 0; - handle = CreateFileA(p_filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + handle = CreateFile(p_filename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (handle == INVALID_HANDLE_VALUE) { goto done; @@ -207,7 +209,7 @@ MxResult MxBitmap::LoadFile(HANDLE p_handle) MxLong size; DWORD bytesRead; BITMAPFILEHEADER hdr; - if (!ReadFile(p_handle, &hdr, sizeof(hdr), &bytesRead, NULL)) { + if (!ReadFile(p_handle, &hdr, 14, &bytesRead, NULL)) { goto done; } @@ -249,7 +251,7 @@ MxResult MxBitmap::LoadFile(HANDLE p_handle) done: if (result != SUCCESS) { if (m_info) { - delete[] m_info; + delete[] ((MxU8*) m_info); m_info = NULL; } diff --git a/LEGO1/omni/src/video/mxdisplaysurface.cpp b/LEGO1/omni/src/video/mxdisplaysurface.cpp index 685c59be..bd751a57 100644 --- a/LEGO1/omni/src/video/mxdisplaysurface.cpp +++ b/LEGO1/omni/src/video/mxdisplaysurface.cpp @@ -85,6 +85,7 @@ void MxDisplaySurface::ClearScreen() } // FUNCTION: LEGO1 0x100ba750 +// FUNCTION: BETA10 0x1013f6df MxU8 MxDisplaySurface::CountTotalBitsSetTo1(MxU32 p_param) { MxU8 count = 0; @@ -97,6 +98,7 @@ MxU8 MxDisplaySurface::CountTotalBitsSetTo1(MxU32 p_param) } // FUNCTION: LEGO1 0x100ba770 +// FUNCTION: BETA10 0x1013f724 MxU8 MxDisplaySurface::CountContiguousBitsSetTo1(MxU32 p_param) { MxU8 count = 0; @@ -194,7 +196,7 @@ MxResult MxDisplaySurface::Create(MxVideoParam& p_videoParam) ddsd.dwSize = sizeof(ddsd); ddsd.dwBackBufferCount = m_videoParam.GetBackBuffers(); ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; - ddsd.ddsCaps.dwCaps = DDSCAPS_3DDEVICE | DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_3DDEVICE | DDSCAPS_COMPLEX; if (lpDirectDraw->CreateSurface(&ddsd, &m_ddSurface1, NULL)) { goto done; @@ -271,24 +273,21 @@ void MxDisplaySurface::Destroy() } // FUNCTION: LEGO1 0x100baae0 +// FUNCTION: BETA10 0x1013fe15 void MxDisplaySurface::SetPalette(MxPalette* p_palette) { if (m_surfaceDesc.ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) { m_ddSurface1->SetPalette(p_palette->CreateNativePalette()); m_ddSurface2->SetPalette(p_palette->CreateNativePalette()); - if ((m_videoParam.Flags().GetFullScreen() & 1) == 0) { + if (!m_videoParam.Flags().GetFullScreen()) { struct { WORD m_palVersion; WORD m_palNumEntries; PALETTEENTRY m_palPalEntry[256]; - } lpal; + } lpal = {0x300, 256}; - lpal.m_palVersion = 0x300; - lpal.m_palNumEntries = 256; - - memset(lpal.m_palPalEntry, 0, sizeof(lpal.m_palPalEntry)); - p_palette->GetEntries(lpal.m_palPalEntry); + p_palette->GetEntries((LPPALETTEENTRY) lpal.m_palPalEntry); HPALETTE hpal = CreatePalette((LPLOGPALETTE) &lpal); HDC hdc = ::GetDC(0); @@ -299,7 +298,10 @@ void MxDisplaySurface::SetPalette(MxPalette* p_palette) } } - if (m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount == 16) { + switch (m_surfaceDesc.ddpfPixelFormat.dwRGBBitCount) { + case 8: + break; + case 16: { if (!m_16bitPal) { m_16bitPal = new MxU16[256]; } @@ -315,10 +317,15 @@ void MxDisplaySurface::SetPalette(MxPalette* p_palette) MxU8 totalBitsBlue = CountTotalBitsSetTo1(m_surfaceDesc.ddpfPixelFormat.dwBBitMask); for (MxS32 i = 0; i < 256; i++) { - m_16bitPal[i] = (((palette[i].peRed >> ((8 - totalBitsRed) & 0x1f)) << (contiguousBitsRed & 0x1f))) | - (((palette[i].peGreen >> ((8 - totalBitsGreen) & 0x1f)) << (contiguousBitsGreen & 0x1f))) | - (((palette[i].peBlue >> ((8 - totalBitsBlue) & 0x1f)) << (contiguousBitsBlue & 0x1f))); + m_16bitPal[i] = ((palette[i].peRed >> (8 - totalBitsRed)) << contiguousBitsRed) | + ((palette[i].peGreen >> (8 - totalBitsGreen)) << contiguousBitsGreen) | + ((palette[i].peBlue >> (8 - totalBitsBlue)) << contiguousBitsBlue); } + + break; + } + default: + break; } } @@ -854,7 +861,7 @@ void MxDisplaySurface::Display(MxS32 p_left, MxS32 p_top, MxS32 p_left2, MxS32 p DDBLTFX data; memset(&data, 0, sizeof(data)); data.dwSize = sizeof(data); - data.dwDDFX = 8; + data.dwDDFX = DDBLTFX_NOTEARING; if (m_ddSurface1->Blt((LPRECT) &b, m_ddSurface2, (LPRECT) &a, 0, &data) == DDERR_SURFACELOST) { m_ddSurface1->Restore(); @@ -1043,7 +1050,7 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::CopySurface(LPDIRECTDRAWSURFACE p_src) RECT rect = {0, 0, (LONG) ddsd.dwWidth, (LONG) ddsd.dwHeight}; - if (newSurface->BltFast(0, 0, p_src, &rect, 16) != DD_OK) { + if (newSurface->BltFast(0, 0, p_src, &rect, DDBLTFAST_WAIT) != DD_OK) { newSurface->Release(); return NULL; } @@ -1362,7 +1369,7 @@ void MxDisplaySurface::VTable0x2c( } // FUNCTION: LEGO1 0x100bc8b0 -LPDIRECTDRAWSURFACE MxDisplaySurface::FUN_100bc8b0(MxS32 width, MxS32 height) +LPDIRECTDRAWSURFACE MxDisplaySurface::FUN_100bc8b0(MxS32 p_width, MxS32 p_height) { LPDIRECTDRAWSURFACE surface = NULL; @@ -1381,8 +1388,8 @@ LPDIRECTDRAWSURFACE MxDisplaySurface::FUN_100bc8b0(MxS32 width, MxS32 height) return NULL; } - surfaceDesc.dwWidth = width; - surfaceDesc.dwHeight = height; + surfaceDesc.dwWidth = p_width; + surfaceDesc.dwHeight = p_height; surfaceDesc.dwFlags = DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS; surfaceDesc.ddsCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_OFFSCREENPLAIN; diff --git a/LEGO1/omni/src/video/mxflcpresenter.cpp b/LEGO1/omni/src/video/mxflcpresenter.cpp index 57b734c1..eb075357 100644 --- a/LEGO1/omni/src/video/mxflcpresenter.cpp +++ b/LEGO1/omni/src/video/mxflcpresenter.cpp @@ -21,7 +21,7 @@ MxFlcPresenter::MxFlcPresenter() MxFlcPresenter::~MxFlcPresenter() { if (this->m_flcHeader) { - delete this->m_flcHeader; + delete[] ((MxU8*) this->m_flcHeader); } } diff --git a/LEGO1/omni/src/video/mxpalette.cpp b/LEGO1/omni/src/video/mxpalette.cpp index 7738a198..e93169ee 100644 --- a/LEGO1/omni/src/video/mxpalette.cpp +++ b/LEGO1/omni/src/video/mxpalette.cpp @@ -238,14 +238,14 @@ MxResult MxPalette::SetEntries(LPPALETTEENTRY p_entries) // FUNCTION: BETA10 0x101442aa MxResult MxPalette::SetSkyColor(LPPALETTEENTRY p_skyColor) { - MxResult status = 0; + MxResult status = SUCCESS; if (m_palette != NULL) { m_entries[141].peRed = p_skyColor->peRed; m_entries[141].peGreen = p_skyColor->peGreen; m_entries[141].peBlue = p_skyColor->peBlue; m_skyColor = m_entries[141]; if (m_palette->SetEntries(0, 141, 1, &m_skyColor)) { - status = -1; + status = FAILURE; } } return status; diff --git a/LEGO1/omni/src/video/mxstillpresenter.cpp b/LEGO1/omni/src/video/mxstillpresenter.cpp index 03ffcb31..a9731233 100644 --- a/LEGO1/omni/src/video/mxstillpresenter.cpp +++ b/LEGO1/omni/src/video/mxstillpresenter.cpp @@ -20,7 +20,7 @@ void MxStillPresenter::Destroy(MxBool p_fromDestructor) m_criticalSection.Enter(); if (m_bitmapInfo) { - delete m_bitmapInfo; + delete[] ((MxU8*) m_bitmapInfo); } m_bitmapInfo = NULL; @@ -35,7 +35,7 @@ void MxStillPresenter::Destroy(MxBool p_fromDestructor) void MxStillPresenter::LoadHeader(MxStreamChunk* p_chunk) { if (m_bitmapInfo) { - delete m_bitmapInfo; + delete[] ((MxU8*) m_bitmapInfo); } MxU8* data = new MxU8[p_chunk->GetLength()]; @@ -53,7 +53,7 @@ void MxStillPresenter::CreateBitmap() m_frameBitmap = new MxBitmap; m_frameBitmap->ImportBitmapInfo(m_bitmapInfo); - delete m_bitmapInfo; + delete[] ((MxU8*) m_bitmapInfo); m_bitmapInfo = NULL; } diff --git a/LEGO1/realtime/orientableroi.cpp b/LEGO1/realtime/orientableroi.cpp index 95261810..92c9ac9e 100644 --- a/LEGO1/realtime/orientableroi.cpp +++ b/LEGO1/realtime/orientableroi.cpp @@ -17,15 +17,15 @@ OrientableROI::OrientableROI() IDENTMAT4(m_local2world); m_parentROI = NULL; - ToggleUnknown0xd8(TRUE); + SetNeedsWorldDataUpdate(TRUE); } // Maybe an overload based on MxMatrix type // FUNCTION: LEGO1 0x100a46a0 // FUNCTION: BETA10 0x10165268 -void OrientableROI::WrappedSetLocalTransform(const Matrix4& p_transform) +void OrientableROI::WrappedSetLocal2WorldWithWorldDataUpdate(const Matrix4& p_local2world) { - SetLocalTransform(p_transform); + SetLocal2WorldWithWorldDataUpdate(p_local2world); } // FUNCTION: LEGO1 0x100a46b0 @@ -57,14 +57,14 @@ void OrientableROI::UpdateTransformationRelativeToParent(const Matrix4& p_transf } } - UpdateWorldData(mat); + UpdateWorldDataWithTransformAndChildren(mat); } // Maybe an overload based on MxMatrix type // FUNCTION: LEGO1 0x100a5090 -void OrientableROI::WrappedVTable0x24(const Matrix4& p_transform) +void OrientableROI::WrappedUpdateWorldDataWithTransform(const Matrix4& p_transform) { - VTable0x24(p_transform); + UpdateWorldDataWithTransform(p_transform); } // FUNCTION: LEGO1 0x100a50a0 @@ -101,21 +101,23 @@ void OrientableROI::GetLocalTransform(Matrix4& p_transform) // FUNCTION: LEGO1 0x100a58f0 // FUNCTION: BETA10 0x10167b77 -void OrientableROI::FUN_100a58f0(const Matrix4& p_transform) +void OrientableROI::SetLocal2World(const Matrix4& p_local2world) { - m_local2world = p_transform; - ToggleUnknown0xd8(TRUE); + m_local2world = p_local2world; + SetNeedsWorldDataUpdate(TRUE); } // FUNCTION: LEGO1 0x100a5910 -void OrientableROI::VTable0x1c() +// FUNCTION: BETA10 0x10167bac +void OrientableROI::UpdateWorldData() { UpdateWorldBoundingVolumes(); UpdateWorldVelocity(); } // FUNCTION: LEGO1 0x100a5930 -void OrientableROI::SetLocalTransform(const Matrix4& p_transform) +// FUNCTION: BETA10 0x10167bd8 +void OrientableROI::SetLocal2WorldWithWorldDataUpdate(const Matrix4& p_transform) { m_local2world = p_transform; UpdateWorldBoundingVolumes(); @@ -123,7 +125,8 @@ void OrientableROI::SetLocalTransform(const Matrix4& p_transform) } // FUNCTION: LEGO1 0x100a5960 -void OrientableROI::VTable0x24(const Matrix4& p_transform) +// FUNCTION: BETA10 0x10167c19 +void OrientableROI::UpdateWorldDataWithTransform(const Matrix4& p_transform) { MxMatrix l_matrix(m_local2world); m_local2world.Product(p_transform, l_matrix); @@ -132,7 +135,8 @@ void OrientableROI::VTable0x24(const Matrix4& p_transform) } // FUNCTION: LEGO1 0x100a59b0 -void OrientableROI::UpdateWorldData(const Matrix4& p_transform) +// FUNCTION: BETA10 0x10167c6d +void OrientableROI::UpdateWorldDataWithTransformAndChildren(const Matrix4& p_transform) { MxMatrix l_matrix(m_local2world); m_local2world.Product(l_matrix, p_transform); @@ -143,23 +147,25 @@ void OrientableROI::UpdateWorldData(const Matrix4& p_transform) if (comp) { for (CompoundObject::iterator iter = comp->begin(); !(iter == comp->end()); iter++) { ROI* child = *iter; - static_cast(child)->UpdateWorldData(p_transform); + static_cast(child)->UpdateWorldDataWithTransformAndChildren(p_transform); } } } // FUNCTION: LEGO1 0x100a5a30 -void OrientableROI::FUN_100a5a30(const Vector3& p_world_velocity) +void OrientableROI::SetWorldVelocity(const Vector3& p_world_velocity) { m_world_velocity = p_world_velocity; } // FUNCTION: LEGO1 0x100a5a50 +// FUNCTION: BETA10 0x10167d65 void OrientableROI::UpdateWorldVelocity() { } // FUNCTION: LEGO1 0x100a5a60 +// FUNCTION: BETA10 0x10167d7b void CalcWorldBoundingVolumes( const BoundingSphere& modelling_sphere, const Matrix4& local2world, @@ -186,18 +192,21 @@ void CalcWorldBoundingVolumes( } // FUNCTION: LEGO1 0x100a5d80 +// FUNCTION: BETA10 0x10168760 const float* OrientableROI::GetWorldVelocity() const { return m_world_velocity.GetData(); } // FUNCTION: LEGO1 0x100a5d90 +// FUNCTION: BETA10 0x10168790 const BoundingBox& OrientableROI::GetWorldBoundingBox() const { return m_world_bounding_box; } // FUNCTION: LEGO1 0x100a5da0 +// FUNCTION: BETA10 0x101687b0 const BoundingSphere& OrientableROI::GetWorldBoundingSphere() const { return m_world_bounding_sphere; diff --git a/LEGO1/realtime/orientableroi.h b/LEGO1/realtime/orientableroi.h index 8daf1f51..c1354c50 100644 --- a/LEGO1/realtime/orientableroi.h +++ b/LEGO1/realtime/orientableroi.h @@ -23,21 +23,22 @@ class OrientableROI : public ROI { const BoundingSphere& GetWorldBoundingSphere() const override; // vtable+0x10 // FUNCTION: LEGO1 0x100a5db0 - virtual void VTable0x14() { VTable0x1c(); } // vtable+0x14 + // FUNCTION: BETA10 0x101687d0 + virtual void WrappedUpdateWorldData() { UpdateWorldData(); } // vtable+0x14 - virtual void UpdateWorldBoundingVolumes() = 0; // vtable+0x18 - virtual void VTable0x1c(); // vtable+0x1c - virtual void SetLocalTransform(const Matrix4& p_transform); // vtable+0x20 - virtual void VTable0x24(const Matrix4& p_transform); // vtable+0x24 - virtual void UpdateWorldData(const Matrix4& p_transform); // vtable+0x28 - virtual void UpdateWorldVelocity(); // vtable+0x2c + virtual void UpdateWorldBoundingVolumes() = 0; // vtable+0x18 + virtual void UpdateWorldData(); // vtable+0x1c + virtual void SetLocal2WorldWithWorldDataUpdate(const Matrix4& p_local2world); // vtable+0x20 + virtual void UpdateWorldDataWithTransform(const Matrix4& p_transform); // vtable+0x24 + virtual void UpdateWorldDataWithTransformAndChildren(const Matrix4& p_transform); // vtable+0x28 + virtual void UpdateWorldVelocity(); // vtable+0x2c - void WrappedSetLocalTransform(const Matrix4& p_transform); + void WrappedSetLocal2WorldWithWorldDataUpdate(const Matrix4& p_local2world); void UpdateTransformationRelativeToParent(const Matrix4& p_transform); - void WrappedVTable0x24(const Matrix4& p_transform); + void WrappedUpdateWorldDataWithTransform(const Matrix4& p_transform); void GetLocalTransform(Matrix4& p_transform); - void FUN_100a58f0(const Matrix4& p_transform); - void FUN_100a5a30(const Vector3& p_world_velocity); + void SetLocal2World(const Matrix4& p_local2world); + void SetWorldVelocity(const Vector3& p_world_velocity); // FUNCTION: BETA10 0x1000fbf0 const Matrix4& GetLocal2World() const { return m_local2world; } @@ -57,9 +58,9 @@ class OrientableROI : public ROI { void SetParentROI(OrientableROI* p_parentROI) { m_parentROI = p_parentROI; } // FUNCTION: BETA10 0x10168800 - void ToggleUnknown0xd8(BOOL p_enable) + void SetNeedsWorldDataUpdate(BOOL p_needsWorldDataUpdate) { - if (p_enable) { + if (p_needsWorldDataUpdate) { m_unk0xd8 |= c_bit1 | c_bit2; } else { @@ -70,7 +71,7 @@ class OrientableROI : public ROI { protected: MxMatrix m_local2world; // 0x10 BoundingBox m_world_bounding_box; // 0x58 - BoundingBox m_unk0x80; // 0x80 + BoundingBox m_bounding_box; // 0x80 BoundingSphere m_world_bounding_sphere; // 0xa8 Mx3DPointFloat m_world_velocity; // 0xc0 OrientableROI* m_parentROI; // 0xd4 @@ -81,6 +82,7 @@ class OrientableROI : public ROI { // OrientableROI::`scalar deleting destructor' // SYNTHETIC: LEGO1 0x100aa2f0 +// SYNTHETIC: BETA10 0x10168600 // OrientableROI::~OrientableROI #endif // ORIENTABLEROI_H diff --git a/LEGO1/realtime/roi.h b/LEGO1/realtime/roi.h index 87cbe8f1..dd5b9993 100644 --- a/LEGO1/realtime/roi.h +++ b/LEGO1/realtime/roi.h @@ -15,9 +15,16 @@ // SIZE 0x28 class BoundingBox { public: + // The BETA10 matches may reference the wrong version + + // FUNCTION: BETA10 0x1004a7a0 const Vector3& Min() const { return min; } + Vector3& Min() { return min; } + + // FUNCTION: BETA10 0x1004a7c0 const Vector3& Max() const { return max; } + Vector3& Max() { return max; } private: @@ -31,14 +38,26 @@ class BoundingBox { // SIZE 0x18 class BoundingSphere { public: + // The BETA10 matches may reference the wrong version + + // FUNCTION: BETA10 0x1001fac0 const Vector3& Center() const { return center; } + + // FUNCTION: BETA10 0x100d55a0 Vector3& Center() { return center; } + + // FUNCTION: BETA10 0x1001fd30 const float& Radius() const { return radius; } + + // FUNCTION: BETA10 0x1001fae0 float& Radius() { return radius; } // SYNTHETIC: BETA10 0x1001fb90 // BoundingSphere::operator= + // SYNTHETIC: BETA10 0x1001fc50 + // BoundingSphere::BoundingSphere + private: Mx3DPointFloat center; // 0x00 float radius; // 0x14 @@ -136,6 +155,7 @@ class ROI { // list >::~list > // SYNTHETIC: LEGO1 0x100a5d50 +// SYNTHETIC: BETA10 0x101686a0 // ROI::~ROI #endif // ROI_H diff --git a/LEGO1/tgl/d3drm/camera.cpp b/LEGO1/tgl/d3drm/camera.cpp index 9b64a25e..6f6c2dac 100644 --- a/LEGO1/tgl/d3drm/camera.cpp +++ b/LEGO1/tgl/d3drm/camera.cpp @@ -1,5 +1,7 @@ #include "impl.h" +#include + using namespace TglImpl; DECOMP_SIZE_ASSERT(Camera, 0x04); @@ -12,8 +14,8 @@ void* CameraImpl::ImplementationDataPtr() return reinterpret_cast(&m_data); } -// FUNCTION: LEGO1 0x100a3700 -Result CameraImpl::SetTransformation(FloatMatrix4& matrix) +// FUNCTION: BETA10 0x1016f390 +inline Result CameraSetTransformation(IDirect3DRMFrame2* pCamera, FloatMatrix4& matrix) { D3DRMMATRIX4D helper; D3DRMMATRIX4D* pTransformation = Translate(matrix, helper); @@ -22,10 +24,23 @@ Result CameraImpl::SetTransformation(FloatMatrix4& matrix) Result result; Result result2; - result2 = ResultVal(m_data->GetPosition(0, &position)); - result = ResultVal(m_data->AddTransform(D3DRMCOMBINE_REPLACE, *pTransformation)); - // The did this second call just to assert on the return value - result2 = ResultVal(m_data->GetPosition(0, &position)); + result2 = ResultVal(pCamera->GetPosition(0, &position)); + assert(Succeeded(result2)); + + result = ResultVal(pCamera->AddTransform(D3DRMCOMBINE_REPLACE, *pTransformation)); + assert(Succeeded(result)); + + result2 = ResultVal(pCamera->GetPosition(0, &position)); + assert(Succeeded(result2)); return result; } + +// FUNCTION: LEGO1 0x100a3700 +// FUNCTION: BETA10 0x1016f330 +Result CameraImpl::SetTransformation(FloatMatrix4& matrix) +{ + assert(m_data); + + return CameraSetTransformation(m_data, matrix); +} diff --git a/LEGO1/tgl/d3drm/device.cpp b/LEGO1/tgl/d3drm/device.cpp index 2d17a5c9..39502d1e 100644 --- a/LEGO1/tgl/d3drm/device.cpp +++ b/LEGO1/tgl/d3drm/device.cpp @@ -12,22 +12,49 @@ void* DeviceImpl::ImplementationDataPtr() return reinterpret_cast(&m_data); } +// FUNCTION: BETA10 0x1016dea0 +inline unsigned long DeviceGetWidth(IDirect3DRMDevice2* pDevice) +{ + return pDevice->GetWidth(); +} + // FUNCTION: LEGO1 0x100a2c00 +// FUNCTION: BETA10 0x1016de40 unsigned long DeviceImpl::GetWidth() { - return m_data->GetWidth(); + assert(m_data); + + return DeviceGetWidth(m_data); +} + +// FUNCTION: BETA10 0x1016df20 +inline unsigned long DeviceGetHeight(IDirect3DRMDevice2* pDevice) +{ + return pDevice->GetHeight(); } // FUNCTION: LEGO1 0x100a2c10 +// FUNCTION: BETA10 0x1016dec0 unsigned long DeviceImpl::GetHeight() { - return m_data->GetHeight(); + assert(m_data); + + return DeviceGetHeight(m_data); +} + +// FUNCTION: BETA10 0x1016dfa0 +inline Result DeviceSetColorModel(IDirect3DRMDevice2* pDevice, ColorModel) +{ + return Success; } // FUNCTION: LEGO1 0x100a2c20 -Result DeviceImpl::SetColorModel(ColorModel) +// FUNCTION: BETA10 0x1016df40 +Result DeviceImpl::SetColorModel(ColorModel p_model) { - return Success; + assert(m_data); + + return DeviceSetColorModel(m_data, p_model); } // FUNCTION: BETA10 0x1016e020 @@ -46,44 +73,96 @@ Result DeviceImpl::SetShadingModel(ShadingModel model) return DeviceSetShadingModel(m_data, model); } +// FUNCTION: BETA10 0x1016e140 +inline Result DeviceSetShadeCount(IDirect3DRMDevice2* pDevice, unsigned long shadeCount) +{ + return ResultVal(pDevice->SetShades(shadeCount)); +} + // FUNCTION: LEGO1 0x100a2ca0 +// FUNCTION: BETA10 0x1016e0e0 Result DeviceImpl::SetShadeCount(unsigned long shadeCount) { - return ResultVal(m_data->SetShades(shadeCount)); + assert(m_data); + + return DeviceSetShadeCount(m_data, shadeCount); +} + +// FUNCTION: BETA10 0x1016e1d0 +inline Result DeviceSetDither(IDirect3DRMDevice2* pDevice, int dither) +{ + return ResultVal(pDevice->SetDither(dither)); } // FUNCTION: LEGO1 0x100a2cc0 +// FUNCTION: BETA10 0x1016e170 Result DeviceImpl::SetDither(int dither) { - return ResultVal(m_data->SetDither(dither)); + assert(m_data); + + return DeviceSetDither(m_data, dither); +} + +// FUNCTION: BETA10 0x1016e260 +inline void DeviceHandleActivate(IDirect3DRMDevice2* pDevice, WORD wParam) +{ + IDirect3DRMWinDevice* winDevice; + + Result result = ResultVal(pDevice->QueryInterface(IID_IDirect3DRMWinDevice, (LPVOID*) &winDevice)); + if (Succeeded(result)) { + winDevice->HandleActivate(wParam); + int refCount = winDevice->Release(); + assert(refCount == 1); + } } // FUNCTION: LEGO1 0x100a2ce0 +// FUNCTION: BETA10 0x1016e200 void DeviceImpl::HandleActivate(WORD wParam) { - // Device argument is intentionally unused. + assert(m_data); + + DeviceHandleActivate(m_data, wParam); +} + +// FUNCTION: BETA10 0x1016e360 +inline void DeviceHandlePaint(IDirect3DRMDevice2* pDevice, void* p_data) +{ IDirect3DRMWinDevice* winDevice; - if (ResultVal(m_data->QueryInterface(IID_IDirect3DRMWinDevice, (LPVOID*) &winDevice))) { - winDevice->HandleActivate(wParam); - winDevice->Release(); + + Result result = ResultVal(pDevice->QueryInterface(IID_IDirect3DRMWinDevice, (LPVOID*) &winDevice)); + if (Succeeded(result)) { + HDC hdc = (HDC) p_data; + winDevice->HandlePaint(hdc); + int refCount = winDevice->Release(); + assert(refCount == 1); } } // FUNCTION: LEGO1 0x100a2d20 -void DeviceImpl::HandlePaint(HDC p_dc) +// FUNCTION: BETA10 0x1016e300 +void DeviceImpl::HandlePaint(void* p_data) { - IDirect3DRMWinDevice* winDevice; - if (SUCCEEDED(m_data->QueryInterface(IID_IDirect3DRMWinDevice, (LPVOID*) &winDevice))) { - winDevice->HandlePaint(p_dc); - winDevice->Release(); - } + assert(m_data); + + DeviceHandlePaint(m_data, p_data); +} + +// FUNCTION: BETA10 0x1016e460 +inline Result DeviceUpdate(IDirect3DRMDevice2* pDevice) +{ + return ResultVal(pDevice->Update()); } // FUNCTION: LEGO1 0x100a2d60 +// FUNCTION: BETA10 0x1016e400 Result DeviceImpl::Update() { - return ResultVal(m_data->Update()); + assert(m_data); + + return DeviceUpdate(m_data); } // GLOBAL: LEGO1 0x100dd1d0 +// GLOBAL: BETA10 0x101c30b0 // IID_IDirect3DRMWinDevice diff --git a/LEGO1/tgl/d3drm/group.cpp b/LEGO1/tgl/d3drm/group.cpp index 686b1540..6df5af8f 100644 --- a/LEGO1/tgl/d3drm/group.cpp +++ b/LEGO1/tgl/d3drm/group.cpp @@ -1,5 +1,7 @@ #include "impl.h" +#include + using namespace TglImpl; // FUNCTION: LEGO1 0x100a31d0 @@ -9,164 +11,293 @@ void* GroupImpl::ImplementationDataPtr() return reinterpret_cast(&m_data); } -// FUNCTION: LEGO1 0x100a31e0 -Result GroupImpl::SetTransformation(FloatMatrix4& matrix) +// FUNCTION: BETA10 0x1016c340 +inline Result GroupSetTransformation(IDirect3DRMFrame2* pGroup, FloatMatrix4& matrix) { D3DRMMATRIX4D helper; D3DRMMATRIX4D* d3dMatrix = Translate(matrix, helper); - return ResultVal(m_data->AddTransform(D3DRMCOMBINE_REPLACE, *d3dMatrix)); + return ResultVal(pGroup->AddTransform(D3DRMCOMBINE_REPLACE, *d3dMatrix)); +} + +// FUNCTION: LEGO1 0x100a31e0 +// FUNCTION: BETA10 0x1016a4d0 +Result GroupImpl::SetTransformation(FloatMatrix4& matrix) +{ + assert(m_data); + + return GroupSetTransformation(m_data, matrix); +} + +// FUNCTION: BETA10 0x1016c400 +inline Result GroupSetColor(IDirect3DRMFrame2* pGroup, float r, float g, float b, float a) +{ + if (a > 0) { + D3DCOLOR color = D3DRMCreateColorRGBA(r, g, b, a); + return ResultVal(pGroup->SetColor(color)); + } + else { + return ResultVal(pGroup->SetColorRGB(r, g, b)); + } } // FUNCTION: LEGO1 0x100a3240 +// FUNCTION: BETA10 0x1016a530 Result GroupImpl::SetColor(float r, float g, float b, float a) { - // The first instruction makes no sense here: - // cmp dword ptr [esp + 0x10], 0 - // This compares a, which we know is a float because it immediately - // gets passed into D3DRMCreateColorRGBA, but does the comparison - // as though it's an int?? - if (*reinterpret_cast(&a) > 0) { - D3DCOLOR color = D3DRMCreateColorRGBA(r, g, b, a); - return ResultVal(m_data->SetColor(color)); - } - else { - return ResultVal(m_data->SetColorRGB(r, a, b)); - } + assert(m_data); + + return GroupSetColor(m_data, r, g, b, a); +} + +// FUNCTION: BETA10 0x1016c5a0 +inline Result GroupSetTexture(IDirect3DRMFrame2* pGroup, IDirect3DRMTexture* pD3DTexture) +{ + return ResultVal(pGroup->SetTexture(pD3DTexture)); +} + +// FUNCTION: BETA10 0x1016bcc0 +inline Result GroupImpl::SetTexture(const TextureImpl* pTexture) +{ + assert(m_data); + assert(!pTexture || pTexture->ImplementationData()); + + IDirect3DRMTexture* pD3DTexture = pTexture ? pTexture->ImplementationData() : NULL; + return GroupSetTexture(m_data, pD3DTexture); } // FUNCTION: LEGO1 0x100a32b0 +// FUNCTION: BETA10 0x1016a5a0 Result GroupImpl::SetTexture(const Texture* pTexture) { - IDirect3DRMTexture* pD3DTexture = pTexture ? static_cast(pTexture)->ImplementationData() : NULL; - return ResultVal(m_data->SetTexture(pD3DTexture)); + assert(m_data); + + return SetTexture(static_cast(pTexture)); +} + +// FUNCTION: BETA10 0x1016c640 +inline Result GroupGetTexture(IDirect3DRMFrame2* pGroup, IDirect3DRMTexture** pD3DTexture) +{ + return ResultVal(pGroup->GetTexture(pD3DTexture)); +} + +// FUNCTION: BETA10 0x1016beb0 +inline Result GroupImpl::GetTexture(TextureImpl** ppTexture) +{ + assert(m_data); + assert(ppTexture); + + TextureImpl* pTextureImpl = new TextureImpl(); + assert(pTextureImpl); + + // TODO: This helps retail match, but it adds to the stack + IDirect3DRMTexture* tex; + Result result = GroupGetTexture(m_data, &tex); + +#ifndef BETA10 + if (Succeeded(result)) { + result = + ResultVal(tex->QueryInterface(IID_IDirect3DRMTexture2, (LPVOID*) (&pTextureImpl->ImplementationData()))); + } +#endif + + *ppTexture = pTextureImpl; + return result; } // FUNCTION: LEGO1 0x100a32e0 +// FUNCTION: BETA10 0x1016a600 Result GroupImpl::GetTexture(Texture*& pTexture) { - IDirect3DRMTexture* pD3DTexture; - TextureImpl* holder = new TextureImpl(); - Result result = ResultVal(m_data->GetTexture(&pD3DTexture)); - if (result) { - // Seems to actually call the first virtual method of holder here - // but that doesn't make any sense since it passes three arguments - // to the method (self + string constant? + an offset?). + assert(m_data); - // This line makes the start of the function match and is what I - // would expect to see there but it clearly isn't what's actually - // there. - holder->SetImplementation(pD3DTexture); - } - pTexture = holder; - return Success; + return GetTexture(reinterpret_cast(&pTexture)); +} + +// FUNCTION: BETA10 0x1016c500 +inline Result GroupSetMaterialMode(IDirect3DRMFrame2* pGroup, MaterialMode mode) +{ + D3DRMMATERIALMODE d3dMode = Translate(mode); + return ResultVal(pGroup->SetMaterialMode(d3dMode)); } // FUNCTION: LEGO1 0x100a33c0 +// FUNCTION: BETA10 0x1016a660 Result GroupImpl::SetMaterialMode(MaterialMode mode) { - D3DRMMATERIALMODE d3dMode; - switch (mode) { - case FromParent: - d3dMode = D3DRMMATERIAL_FROMPARENT; - break; - case FromFrame: - d3dMode = D3DRMMATERIAL_FROMFRAME; - break; - case FromMesh: - d3dMode = D3DRMMATERIAL_FROMMESH; - break; - } - return ResultVal(m_data->SetMaterialMode(d3dMode)); + assert(m_data); + + return GroupSetMaterialMode(m_data, mode); +} + +// FUNCTION: BETA10 0x1016c670 +inline Result GroupAddGroup(IDirect3DRMFrame2* pGroup, const IDirect3DRMFrame* pChildGroup) +{ + return ResultVal(pGroup->AddVisual(const_cast(pChildGroup))); +} + +// FUNCTION: BETA10 0x1016c090 +inline Result GroupImpl::Add(const GroupImpl& rGroup) +{ + assert(m_data); + assert(rGroup.ImplementationData()); + + return GroupAddGroup(m_data, rGroup.ImplementationData()); } // FUNCTION: LEGO1 0x100a3410 +// FUNCTION: BETA10 0x1016a6c0 Result GroupImpl::Add(const Group* pGroup) { - const GroupImpl* pGroupImpl = static_cast(pGroup); - return ResultVal(m_data->AddVisual(pGroupImpl->m_data)); + assert(m_data); + assert(pGroup); + + return Add(*static_cast(pGroup)); +} + +// FUNCTION: BETA10 0x1016c700 +inline Result GroupAddMeshBuilder(IDirect3DRMFrame2* pGroup, const IDirect3DRMMesh* pMesh) +{ + return ResultVal(pGroup->AddVisual(const_cast(pMesh))); +} + +// FUNCTION: BETA10 0x1016bff0 +inline Result GroupImpl::Add(const MeshBuilderImpl& rMesh) +{ + assert(m_data); + assert(rMesh.ImplementationData()); + + return GroupAddMeshBuilder(m_data, rMesh.ImplementationData()); } // FUNCTION: LEGO1 0x100a3430 +// FUNCTION: BETA10 0x1016a740 Result GroupImpl::Add(const MeshBuilder* pMeshBuilder) { - const MeshBuilderImpl* pMeshBuilderImpl = static_cast(pMeshBuilder); - return ResultVal(m_data->AddVisual(pMeshBuilderImpl->ImplementationData())); + assert(m_data); + assert(pMeshBuilder); + + return Add(*static_cast(pMeshBuilder)); +} + +// FUNCTION: BETA10 0x1016c7b0 +inline Result GroupRemoveMeshBuilder(IDirect3DRMFrame2* pGroup, const IDirect3DRMMesh* pMesh) +{ + return ResultVal(pGroup->DeleteVisual(const_cast(pMesh))); +} + +// FUNCTION: BETA10 0x1016c130 +inline Result GroupImpl::Remove(const MeshBuilderImpl& rMesh) +{ + assert(m_data); + assert(rMesh.ImplementationData()); + + return GroupRemoveMeshBuilder(m_data, rMesh.ImplementationData()); } // FUNCTION: LEGO1 0x100a3450 +// FUNCTION: BETA10 0x1016a7c0 Result GroupImpl::Remove(const MeshBuilder* pMeshBuilder) { - const MeshBuilderImpl* pMeshBuilderImpl = static_cast(pMeshBuilder); - return ResultVal(m_data->DeleteVisual(pMeshBuilderImpl->ImplementationData())); + assert(m_data); + assert(pMeshBuilder); + + return Remove(*static_cast(pMeshBuilder)); +} + +// FUNCTION: BETA10 0x1016c730 +inline Result GroupRemoveGroup(IDirect3DRMFrame2* pGroup, const IDirect3DRMFrame* pChildGroup) +{ + return ResultVal(pGroup->DeleteVisual(const_cast(pChildGroup))); +} + +// FUNCTION: BETA10 0x1016c1d0 +inline Result GroupImpl::Remove(const GroupImpl& rGroup) +{ + assert(m_data); + assert(rGroup.ImplementationData()); + + return GroupRemoveGroup(m_data, rGroup.ImplementationData()); } // FUNCTION: LEGO1 0x100a3480 +// FUNCTION: BETA10 0x1016a840 Result GroupImpl::Remove(const Group* pGroup) { - const GroupImpl* pGroupImpl = static_cast(pGroup); - return ResultVal(m_data->DeleteVisual(pGroupImpl->m_data)); + assert(m_data); + assert(pGroup); + + return Remove(*static_cast(pGroup)); } -// FUNCTION: LEGO1 0x100a34b0 -Result GroupImpl::RemoveAll() +// FUNCTION: BETA10 0x1016c850 +inline Result GroupRemoveAll(IDirect3DRMFrame2* pFrame) { IDirect3DRMVisualArray* visuals; - IDirect3DRMFrame2* frame = m_data; - Result result = (Result) SUCCEEDED(frame->GetVisuals(&visuals)); + int refCount; - if (result == Success) { + Result result = ResultVal(pFrame->GetVisuals(&visuals)); + assert(Succeeded(result)); + + if (Succeeded(result)) { for (int i = 0; i < (int) visuals->GetSize(); i++) { IDirect3DRMVisual* visual; - result = (Result) SUCCEEDED(visuals->GetElement(i, &visual)); - frame->DeleteVisual(visual); - visual->Release(); + result = ResultVal(visuals->GetElement(i, &visual)); + assert(Succeeded(result)); + + result = ResultVal(pFrame->DeleteVisual(visual)); + assert(Succeeded(result)); + + refCount = visual->Release(); } - visuals->Release(); + refCount = visuals->Release(); + assert(refCount == 0); } return result; } -// FUNCTION: LEGO1 0x100a3540 -Result GroupImpl::Bounds(D3DVECTOR* p_min, D3DVECTOR* p_max) +// FUNCTION: LEGO1 0x100a34b0 +// FUNCTION: BETA10 0x1016a8c0 +Result GroupImpl::RemoveAll() +{ + assert(m_data); + + return GroupRemoveAll(m_data); +} + +// FUNCTION: BETA10 0x1016cb70 +inline Result GroupBounds(IDirect3DRMFrame2* pFrame, D3DVECTOR* p_min, D3DVECTOR* p_max) { D3DRMBOX size; - IDirect3DRMFrame2* frame = m_data; + int refCount; - size.min.x = 88888.f; - size.min.y = 88888.f; - size.min.z = 88888.f; - size.max.x = -88888.f; - size.max.y = -88888.f; - size.max.z = -88888.f; + size.min.x = size.min.y = size.min.z = 88888.f; + size.max.x = size.max.y = size.max.z = -88888.f; IDirect3DRMVisualArray* visuals; - Result result = (Result) SUCCEEDED(frame->GetVisuals(&visuals)); + Result result = ResultVal(pFrame->GetVisuals(&visuals)); + assert(Succeeded(result)); - if (result == Success) { - int i; - for (i = 0; i < (int) visuals->GetSize(); i++) { + if (Succeeded(result)) { + for (int i = 0; i < (int) visuals->GetSize(); i++) { IDirect3DRMVisual* visual; - visuals->GetElement(i, &visual); - IDirect3DRMMesh* mesh; + result = ResultVal(visuals->GetElement(i, &visual)); + assert(Succeeded(result)); + /* * BUG: should be: * visual->QueryInterface(IID_IDirect3DRMMesh, (void**)&mesh)); */ - result = (Result) SUCCEEDED(visual->QueryInterface(IID_IDirect3DRMMeshBuilder, (void**) &mesh)); + IDirect3DRMMesh* mesh; + result = ResultVal(visual->QueryInterface(IID_IDirect3DRMMeshBuilder, (void**) &mesh)); - if (result == Success) { + if (Succeeded(result)) { D3DRMBOX box; - result = (Result) SUCCEEDED(mesh->GetBox(&box)); + result = ResultVal(mesh->GetBox(&box)); + assert(Succeeded(result)); - if (size.max.y < box.max.y) { - size.max.y = box.max.y; - } - if (size.max.z < box.max.z) { - size.max.z = box.max.z; - } if (box.min.x < size.min.x) { size.min.x = box.min.x; } @@ -179,17 +310,36 @@ Result GroupImpl::Bounds(D3DVECTOR* p_min, D3DVECTOR* p_max) if (size.max.x < box.max.x) { size.max.x = box.max.x; } + if (size.max.y < box.max.y) { + size.max.y = box.max.y; + } + if (size.max.z < box.max.z) { + size.max.z = box.max.z; + } mesh->Release(); } - visual->Release(); + refCount = visual->Release(); } - visuals->Release(); + refCount = visuals->Release(); } - *p_min = size.min; - *p_max = size.max; + p_min->x = size.min.x; + p_min->y = size.min.y; + p_min->z = size.min.z; + p_max->x = size.max.x; + p_max->y = size.max.y; + p_max->z = size.max.z; return result; } + +// FUNCTION: LEGO1 0x100a3540 +// FUNCTION: BETA10 0x1016a920 +Result GroupImpl::Bounds(D3DVECTOR* p_min, D3DVECTOR* p_max) +{ + assert(m_data); + + return GroupBounds(m_data, p_min, p_max); +} diff --git a/LEGO1/tgl/d3drm/impl.h b/LEGO1/tgl/d3drm/impl.h index b7ab827e..0d9851fa 100644 --- a/LEGO1/tgl/d3drm/impl.h +++ b/LEGO1/tgl/d3drm/impl.h @@ -1,3 +1,5 @@ +#ifndef TGL_D3DRM_IMPL_H +#define TGL_D3DRM_IMPL_H #include "compat.h" #include "decomp.h" @@ -95,15 +97,45 @@ class RendererImpl : public Renderer { return m_data->CreateTextureFromSurface(pSurface, pTexture2); } - IDirect3DRM2* ImplementationData() const { return m_data; } + typedef IDirect3DRM2* RendererDataType; + + const RendererDataType& ImplementationData() const { return m_data; } + + // FUNCTION: BETA10 0x10174c10 + RendererDataType& ImplementationData() { return m_data; } public: inline Result Create(); inline void Destroy(); inline Result CreateLight(LightType type, float r, float g, float b, LightImpl& rLight); + inline Result CreateGroup(const GroupImpl* pParentGroup, GroupImpl& rpGroup); + inline Result CreateView( + const DeviceImpl& rDevice, + const CameraImpl& rCamera, + unsigned long x, + unsigned long y, + unsigned long width, + unsigned long height, + ViewImpl& rView + ); + inline Result CreateMeshBuilder(MeshBuilderImpl& rMesh); + inline Result CreateCamera(CameraImpl& rCamera); + inline Result CreateTexture(TextureImpl& rTexture); + inline Result CreateTexture( + TextureImpl& rTexture, + int width, + int height, + int bitsPerTexel, + const void* pTexels, + int texelsArePersistent, + int paletteEntryCount, + const PaletteEntry* pEntries + ); + inline Result CreateDevice(const DeviceDirect3DCreateData& rCreateData, DeviceImpl& rDevice); + inline Result CreateDevice(const DeviceDirectDrawCreateData& rCreateData, DeviceImpl& rDevice); private: - IDirect3DRM2* m_data; + RendererDataType m_data; }; extern IDirect3DRM2* g_pD3DRM; @@ -152,9 +184,16 @@ class DeviceImpl : public Device { // vtable+0x20 Result Update() override; void HandleActivate(WORD) override; - void HandlePaint(HDC) override; + void HandlePaint(void*) override; + + typedef IDirect3DRMDevice2* DeviceDataType; + + // FUNCTION: BETA10 0x101708e0 + const DeviceDataType& ImplementationData() const { return m_data; } + + // FUNCTION: BETA10 0x100d9540 + DeviceDataType& ImplementationData() { return m_data; } - IDirect3DRMDevice2* ImplementationData() const { return m_data; } void SetImplementationData(IDirect3DRMDevice2* device) { m_data = device; } inline void Destroy(); @@ -162,7 +201,7 @@ class DeviceImpl : public Device { friend class RendererImpl; private: - IDirect3DRMDevice2* m_data; + DeviceDataType m_data; }; // FUNCTION: BETA10 0x101708c0 @@ -220,7 +259,13 @@ class ViewImpl : public View { int& rPickedGroupCount ) override; - IDirect3DRMViewport* ImplementationData() const { return m_data; } + typedef IDirect3DRMViewport* ViewDataType; + + const ViewDataType& ImplementationData() const { return m_data; } + + // FUNCTION: BETA10 0x101711c0 + ViewDataType& ImplementationData() { return m_data; } + void SetImplementationData(IDirect3DRMViewport* viewport) { m_data = viewport; } static Result ViewportCreateAppData(IDirect3DRM2*, IDirect3DRMViewport*, IDirect3DRMFrame2*); @@ -242,7 +287,7 @@ class ViewImpl : public View { friend class RendererImpl; private: - IDirect3DRMViewport* m_data; + ViewDataType m_data; }; // FUNCTION: BETA10 0x101711a0 @@ -275,14 +320,20 @@ class CameraImpl : public Camera { // vtable+0x08 Result SetTransformation(FloatMatrix4&) override; - IDirect3DRMFrame2* ImplementationData() const { return m_data; } + typedef IDirect3DRMFrame2* CameraDataType; + + // FUNCTION: BETA10 0x10170960 + const CameraDataType& ImplementationData() const { return m_data; } + + // FUNCTION: BETA10 0x10170980 + CameraDataType& ImplementationData() { return m_data; } inline void Destroy(); friend class RendererImpl; private: - IDirect3DRMFrame2* m_data; + CameraDataType m_data; }; // FUNCTION: BETA10 0x10170940 @@ -318,7 +369,10 @@ class LightImpl : public Light { typedef IDirect3DRMFrame2* LightDataType; + // FUNCTION: BETA10 0x10171b90 const LightDataType& ImplementationData() const { return m_data; } + + // FUNCTION: BETA10 0x10171240 LightDataType& ImplementationData() { return m_data; } inline void Destroy(); @@ -377,9 +431,15 @@ class MeshImpl : public Mesh { typedef MeshData* MeshDataType; const MeshDataType& ImplementationData() const { return m_data; } + + // FUNCTION: BETA10 0x10171b70 MeshDataType& ImplementationData() { return m_data; } inline void Destroy(); + inline Mesh* DeepClone(const MeshBuilderImpl& rMesh); + inline Result GetTexture(TextureImpl** ppTexture); + inline Result SetTexture(const TextureImpl* pTexture); + inline Mesh* ShallowClone(const MeshBuilderImpl& rMesh); friend class RendererImpl; @@ -433,14 +493,26 @@ class GroupImpl : public Group { // vtable+0x30 Result Bounds(D3DVECTOR* p_min, D3DVECTOR* p_max) override; - IDirect3DRMFrame2* ImplementationData() const { return m_data; } + typedef IDirect3DRMFrame2* GroupDataType; + + // FUNCTION: BETA10 0x1016fc20 + const GroupDataType& ImplementationData() const { return m_data; } + + // FUNCTION: BETA10 0x1016fce0 + GroupDataType& ImplementationData() { return m_data; } inline void Destroy(); + inline Result SetTexture(const TextureImpl* pTexture); + inline Result GetTexture(TextureImpl** ppTexture); + inline Result Add(const GroupImpl& rGroup); + inline Result Add(const MeshBuilderImpl& rMesh); + inline Result Remove(const GroupImpl& rGroup); + inline Result Remove(const MeshBuilderImpl& rMesh); friend class RendererImpl; private: - IDirect3DRMFrame2* m_data; + GroupDataType m_data; }; // FUNCTION: BETA10 0x1016c2b0 @@ -486,7 +558,13 @@ class MeshBuilderImpl : public MeshBuilder { // vtable+0x10 MeshBuilder* Clone() override; - IDirect3DRMMesh* ImplementationData() const { return m_data; } + typedef IDirect3DRMMesh* MeshBuilderDataType; + + // FUNCTION: BETA10 0x10170420 + const MeshBuilderDataType& ImplementationData() const { return m_data; } + + // FUNCTION: BETA10 0x10170440 + MeshBuilderDataType& ImplementationData() { return m_data; } inline void Destroy(); @@ -505,7 +583,7 @@ class MeshBuilderImpl : public MeshBuilder { ShadingModel shadingModel ); - IDirect3DRMMesh* m_data; + MeshBuilderDataType m_data; }; // FUNCTION: BETA10 0x10170390 @@ -535,7 +613,7 @@ class TglD3DRMIMAGE { int paletteSize, PaletteEntry* pEntries ); - ~TglD3DRMIMAGE() { Destroy(); } + ~TglD3DRMIMAGE(); Result CreateBuffer(int width, int height, int depth, void* pBuffer, int useBuffer); void Destroy(); @@ -544,6 +622,9 @@ class TglD3DRMIMAGE { D3DRMIMAGE m_image; int m_texelsAllocatedByClient; + + // SYNTHETIC: BETA10 0x1016abb0 + // TglImpl::TglD3DRMIMAGE::`scalar deleting destructor' }; // VTABLE: LEGO1 0x100dbb48 @@ -559,7 +640,7 @@ class TextureImpl : public Texture { void* ImplementationDataPtr() override; // vtable+0x08 - Result SetTexels(int width, int height, int bitsPerTexel, void* pTexels) override; + Result SetTexels(int width, int height, int bitsPerTexel, void* pTexels, int pTexelsArePersistent) override; void FillRowsOfTexture(int y, int height, void* pBuffer) override; // vtable+0x10 @@ -570,11 +651,18 @@ class TextureImpl : public Texture { int* pDepth, void** ppBuffer, int* ppPaletteSize, - PaletteEntry** ppPalette + unsigned char (*pEntries)[3] ) override; Result SetPalette(int entryCount, PaletteEntry* entries) override; - IDirect3DRMTexture* ImplementationData() const { return m_data; } + typedef IDirect3DRMTexture* TextureDataType; + + // FUNCTION: BETA10 0x1016fd60 + const TextureDataType& ImplementationData() const { return m_data; } + + // FUNCTION: BETA10 0x1016fe20 + TextureDataType& ImplementationData() { return m_data; } + void SetImplementation(IDirect3DRMTexture* pData) { m_data = pData; } inline void Destroy(); @@ -584,7 +672,7 @@ class TextureImpl : public Texture { static Result SetImage(IDirect3DRMTexture* pSelf, TglD3DRMIMAGE* pImage); private: - IDirect3DRMTexture* m_data; + TextureDataType m_data; }; // FUNCTION: BETA10 0x1016fd40 @@ -602,6 +690,18 @@ void TextureImpl::Destroy() } } +// Used by both Mesh and MeshBuilder +// FUNCTION: BETA10 0x10170270 +inline Result MeshSetTextureMappingMode(MeshImpl::MeshData* pMesh, TextureMappingMode mode) +{ + if (mode == PerspectiveCorrect) { + return ResultVal(pMesh->groupMesh->SetGroupMapping(pMesh->groupIndex, D3DRMMAP_PERSPCORRECT)); + } + else { + return ResultVal(pMesh->groupMesh->SetGroupMapping(pMesh->groupIndex, 0)); + } +} + // Translation helpers // FUNCTION: BETA10 0x1016fc40 inline D3DRMRENDERQUALITY Translate(ShadingModel tglShadingModel) @@ -653,6 +753,7 @@ inline D3DRMPROJECTIONTYPE Translate(ProjectionType tglProjectionType) // Yes this function serves no purpose, originally they intended it to // convert from doubles to floats but ended up using floats throughout // the software stack. +// FUNCTION: BETA10 0x1016fa10 inline D3DRMMATRIX4D* Translate(FloatMatrix4& tglMatrix4x4, D3DRMMATRIX4D& rD3DRMMatrix4x4) { for (int i = 0; i < (sizeof(rD3DRMMatrix4x4) / sizeof(rD3DRMMatrix4x4[0])); i++) { @@ -703,6 +804,26 @@ inline D3DRMLIGHTTYPE Translate(LightType tglLightType) return lightType; } +// FUNCTION: BETA10 0x101702e0 +inline D3DRMMATERIALMODE Translate(MaterialMode mode) +{ + D3DRMMATERIALMODE d3dMode; + switch (mode) { + case FromParent: + d3dMode = D3DRMMATERIAL_FROMPARENT; + break; + case FromFrame: + d3dMode = D3DRMMATERIAL_FROMFRAME; + break; + case FromMesh: + d3dMode = D3DRMMATERIAL_FROMMESH; + break; + } + return d3dMode; +} + +} /* namespace TglImpl */ + // SYNTHETIC: LEGO1 0x100a16d0 // SYNTHETIC: BETA10 0x10169aa0 // TglImpl::RendererImpl::`scalar deleting destructor' @@ -739,7 +860,13 @@ inline D3DRMLIGHTTYPE Translate(LightType tglLightType) // SYNTHETIC: BETA10 0x1016fa90 // TglImpl::MeshImpl::`scalar deleting destructor' +// SYNTHETIC: BETA10 0x10169960 +// ViewportAppData::`scalar deleting destructor' + // GLOBAL: LEGO1 0x100dd1e0 // IID_IDirect3DRMMeshBuilder -} /* namespace TglImpl */ +// GLOBAL: LEGO1 0x100dd1f0 +// IID_IDirect3DRMMesh + +#endif diff --git a/LEGO1/tgl/d3drm/light.cpp b/LEGO1/tgl/d3drm/light.cpp index 50d8271e..cdb577f1 100644 --- a/LEGO1/tgl/d3drm/light.cpp +++ b/LEGO1/tgl/d3drm/light.cpp @@ -1,5 +1,7 @@ #include "impl.h" +#include + using namespace TglImpl; DECOMP_SIZE_ASSERT(Light, 0x04); @@ -12,20 +14,43 @@ void* LightImpl::ImplementationDataPtr() return reinterpret_cast(&m_data); } -// FUNCTION: LEGO1 0x100a3780 -Result LightImpl::SetTransformation(FloatMatrix4& matrix) +// FUNCTION: BETA10 0x1016f6e0 +inline Result LightSetTransformation(IDirect3DRMFrame2* pLight, FloatMatrix4& matrix) { D3DRMMATRIX4D helper; D3DRMMATRIX4D* d3dMatrix = Translate(matrix, helper); - return ResultVal(m_data->AddTransform(D3DRMCOMBINE_REPLACE, *d3dMatrix)); + return ResultVal(pLight->AddTransform(D3DRMCOMBINE_REPLACE, *d3dMatrix)); +} + +// FUNCTION: LEGO1 0x100a3780 +// FUNCTION: BETA10 0x1016f680 +Result LightImpl::SetTransformation(FloatMatrix4& matrix) +{ + assert(m_data); + + return LightSetTransformation(m_data, matrix); +} + +// FUNCTION: BETA10 0x1016f860 +inline Result LightSetColor(IDirect3DRMFrame2* pLight, float r, float g, float b) +{ + IDirect3DRMLightArray* lights; + IDirect3DRMLight* light; + Result result = ResultVal(pLight->GetLights(&lights)); + assert(Succeeded(result)); + assert(lights->GetSize() == 1); + + result = ResultVal(lights->GetElement(0, &light)); + assert(Succeeded(result)); + + return ResultVal(light->SetColorRGB(r, g, b)); } // FUNCTION: LEGO1 0x100a37e0 +// FUNCTION: BETA10 0x1016f7f0 Result LightImpl::SetColor(float r, float g, float b) { - IDirect3DRMLightArray* lightArray; - IDirect3DRMLight* light; - m_data->GetLights(&lightArray); - lightArray->GetElement(0, &light); - return ResultVal(light->SetColorRGB(r, g, b)); + assert(m_data); + + return LightSetColor(m_data, r, g, b); } diff --git a/LEGO1/tgl/d3drm/mesh.cpp b/LEGO1/tgl/d3drm/mesh.cpp index 518ac921..68f765a7 100644 --- a/LEGO1/tgl/d3drm/mesh.cpp +++ b/LEGO1/tgl/d3drm/mesh.cpp @@ -16,39 +16,60 @@ void* MeshImpl::ImplementationDataPtr() return reinterpret_cast(&m_data); } -// FUNCTION: LEGO1 0x100a3ee0 -Result MeshImpl::SetColor(float r, float g, float b, float a) +// FUNCTION: BETA10 0x10170590 +inline Result MeshSetColor(MeshImpl::MeshData* pMesh, float r, float g, float b, float a) { - // The first instruction makes no sense here: - // cmp dword ptr [esp + 0x10], 0 - // This compares a, which we know is a float because it immediately - // gets passed into D3DRMCreateColorRGBA, but does the comparison - // as though it's an int?? - if (*reinterpret_cast(&a) > 0) { + if (a > 0) { D3DCOLOR color = D3DRMCreateColorRGBA(r, g, b, a); - return ResultVal(m_data->groupMesh->SetGroupColor(m_data->groupIndex, color)); + return ResultVal(pMesh->groupMesh->SetGroupColor(pMesh->groupIndex, color)); } else { - return ResultVal(m_data->groupMesh->SetGroupColorRGB(m_data->groupIndex, r, g, b)); + return ResultVal(pMesh->groupMesh->SetGroupColorRGB(pMesh->groupIndex, r, g, b)); } } +// FUNCTION: LEGO1 0x100a3ee0 +// FUNCTION: BETA10 0x10170520 +Result MeshImpl::SetColor(float r, float g, float b, float a) +{ + assert(m_data); + + return MeshSetColor(m_data, r, g, b, a); +} + +// FUNCTION: BETA10 0x10171320 +inline Result MeshSetTexture(MeshImpl::MeshData* pMesh, IDirect3DRMTexture* pD3DTexture) +{ + Result result = ResultVal(pMesh->groupMesh->SetGroupTexture(pMesh->groupIndex, pD3DTexture)); + return result; +} + +// FUNCTION: BETA10 0x10171260 +inline Result MeshImpl::SetTexture(const TextureImpl* pTexture) +{ + assert(m_data); + assert(!pTexture || pTexture->ImplementationData()); + + IDirect3DRMTexture* pD3DTexture = pTexture ? pTexture->ImplementationData() : NULL; + return MeshSetTexture(m_data, pD3DTexture); +} + // FUNCTION: LEGO1 0x100a3f50 +// FUNCTION: BETA10 0x10170630 Result MeshImpl::SetTexture(const Texture* pTexture) { - IDirect3DRMTexture* texture = pTexture ? static_cast(pTexture)->ImplementationData() : NULL; - return ResultVal(m_data->groupMesh->SetGroupTexture(m_data->groupIndex, texture)); + assert(m_data); + + return SetTexture(static_cast(pTexture)); } // FUNCTION: LEGO1 0x100a3f80 +// FUNCTION: BETA10 0x10170690 Result MeshImpl::SetTextureMappingMode(TextureMappingMode mode) { - if (mode == PerspectiveCorrect) { - return ResultVal(m_data->groupMesh->SetGroupMapping(m_data->groupIndex, D3DRMMAP_PERSPCORRECT)); - } - else { - return ResultVal(m_data->groupMesh->SetGroupMapping(m_data->groupIndex, 0)); - } + assert(m_data); + + return MeshSetTextureMappingMode(m_data, mode); } // FUNCTION: BETA10 0x10170750 @@ -66,84 +87,173 @@ Result MeshImpl::SetShadingModel(ShadingModel model) return MeshSetShadingModel(m_data, model); } -// FUNCTION: LEGO1 0x100a4030 -Mesh* MeshImpl::DeepClone(MeshBuilder* pMeshBuilder) +// FUNCTION: BETA10 0x101714e0 +inline Result MeshDeepClone(MeshImpl::MeshData* pSource, MeshImpl::MeshData*& rpTarget, IDirect3DRMMesh* pMesh) { - // Create group - MeshImpl* newMesh = new MeshImpl(); - MeshData* data = new MeshData(); - newMesh->m_data = data; + rpTarget = new MeshImpl::MeshData(); + rpTarget->groupMesh = pMesh; // Query information from old group DWORD dataSize; unsigned int vcount, fcount, vperface; - m_data->groupMesh->GetGroup(m_data->groupIndex, &vcount, &fcount, &vperface, &dataSize, NULL); + + Result result = + ResultVal(pSource->groupMesh->GetGroup(pSource->groupIndex, &vcount, &fcount, &vperface, &dataSize, NULL)); + assert(Succeeded(result)); + unsigned int* faceBuffer = new unsigned int[dataSize]; - m_data->groupMesh->GetGroup(m_data->groupIndex, &vcount, &fcount, &vperface, &dataSize, faceBuffer); + result = + ResultVal(pSource->groupMesh->GetGroup(pSource->groupIndex, &vcount, &fcount, &vperface, &dataSize, faceBuffer) + ); + assert(Succeeded(result)); + // We expect vertex to be sized 0x24, checked at start of file. D3DRMVERTEX* vertexBuffer = new D3DRMVERTEX[vcount]; - m_data->groupMesh->GetVertices(m_data->groupIndex, 0, vcount, vertexBuffer); + result = ResultVal(pSource->groupMesh->GetVertices(pSource->groupIndex, 0, vcount, vertexBuffer)); + assert(Succeeded(result)); + LPDIRECT3DRMTEXTURE textureRef; - m_data->groupMesh->GetGroupTexture(m_data->groupIndex, &textureRef); - D3DRMMAPPING mapping = m_data->groupMesh->GetGroupMapping(m_data->groupIndex); - D3DRMRENDERQUALITY quality = m_data->groupMesh->GetGroupQuality(m_data->groupIndex); - D3DCOLOR color = m_data->groupMesh->GetGroupColor(m_data->groupIndex); + result = ResultVal(pSource->groupMesh->GetGroupTexture(pSource->groupIndex, &textureRef)); + assert(Succeeded(result)); + + D3DRMMAPPING mapping = pSource->groupMesh->GetGroupMapping(pSource->groupIndex); + D3DRMRENDERQUALITY quality = pSource->groupMesh->GetGroupQuality(pSource->groupIndex); + D3DCOLOR color = pSource->groupMesh->GetGroupColor(pSource->groupIndex); // Push information to new group - MeshBuilderImpl* target = static_cast(pMeshBuilder); D3DRMGROUPINDEX index; - target->ImplementationData()->AddGroup(vcount, fcount, vperface, faceBuffer, &index); - newMesh->m_data->groupIndex = index; - target->ImplementationData()->SetVertices(index, 0, vcount, vertexBuffer); - target->ImplementationData()->SetGroupTexture(index, textureRef); - target->ImplementationData()->SetGroupMapping(index, mapping); - target->ImplementationData()->SetGroupQuality(index, quality); - Result result = ResultVal(target->ImplementationData()->SetGroupColor(index, color)); + result = ResultVal(pMesh->AddGroup(vcount, fcount, 3, faceBuffer, &index)); + assert(Succeeded(result)); + + rpTarget->groupIndex = index; + result = ResultVal(pMesh->SetVertices(index, 0, vcount, vertexBuffer)); + assert(Succeeded(result)); + + result = ResultVal(pMesh->SetGroupTexture(index, textureRef)); + assert(Succeeded(result)); + + result = ResultVal(pMesh->SetGroupMapping(index, mapping)); + assert(Succeeded(result)); + + result = ResultVal(pMesh->SetGroupQuality(index, quality)); + assert(Succeeded(result)); + + result = ResultVal(pMesh->SetGroupColor(index, color)); + assert(Succeeded(result)); // Cleanup - delete[] faceBuffer; - delete[] vertexBuffer; - if (result == Error) { - delete newMesh; - newMesh = NULL; + if (faceBuffer) { + delete[] faceBuffer; } - return newMesh; + if (vertexBuffer) { + delete[] vertexBuffer; + } + + return result; +} + +// FUNCTION: BETA10 0x10171360 +inline Mesh* MeshImpl::DeepClone(const MeshBuilderImpl& rMesh) +{ + assert(m_data); + assert(rMesh.ImplementationData()); + + MeshImpl* clone = new MeshImpl(); + assert(!clone->ImplementationData()); + + if (!MeshDeepClone(m_data, clone->ImplementationData(), rMesh.ImplementationData())) { + delete clone; + clone = NULL; + } + + return clone; +} + +// FUNCTION: LEGO1 0x100a4030 +// FUNCTION: BETA10 0x101707a0 +Mesh* MeshImpl::DeepClone(MeshBuilder* pMesh) +{ + assert(m_data); + assert(pMesh); + + return DeepClone(*static_cast(pMesh)); +} + +inline Result MeshShallowClone(MeshImpl::MeshData* pSource, MeshImpl::MeshData*& rpTarget, IDirect3DRMMesh* pMesh) +{ + Result result = Error; + rpTarget = new MeshImpl::MeshData(); + + if (rpTarget) { + rpTarget->groupMesh = pMesh; + rpTarget->groupIndex = pSource->groupIndex; + result = Success; + } + + return result; +} + +inline Mesh* MeshImpl::ShallowClone(const MeshBuilderImpl& rMesh) +{ + assert(m_data); + assert(rMesh.ImplementationData()); + + MeshImpl* clone = new MeshImpl(); + assert(!clone->ImplementationData()); + + if (!MeshShallowClone(m_data, clone->ImplementationData(), rMesh.ImplementationData())) { + delete clone; + clone = NULL; + } + + return clone; } // FUNCTION: LEGO1 0x100a4240 Mesh* MeshImpl::ShallowClone(MeshBuilder* pMeshBuilder) { - MeshImpl* newGroup = new MeshImpl(); - MeshData* newData = new MeshData(); - newGroup->m_data = newData; - if (newData) { - newData->groupIndex = m_data->groupIndex; - newData->groupMesh = static_cast(pMeshBuilder)->ImplementationData(); + assert(m_data); + assert(pMeshBuilder); + + return ShallowClone(*static_cast(pMeshBuilder)); +} + +// FUNCTION: BETA10 0x10171ac0 +inline Result MeshGetTexture(MeshImpl::MeshData* pMesh, IDirect3DRMTexture** pD3DTexture) +{ + return ResultVal(pMesh->groupMesh->GetGroupTexture(pMesh->groupIndex, pD3DTexture)); +} + +// FUNCTION: BETA10 0x10171980 +inline Result MeshImpl::GetTexture(TextureImpl** ppTexture) +{ + assert(m_data); + assert(ppTexture); + + TextureImpl* pTextureImpl = new TextureImpl(); + assert(pTextureImpl); + + // TODO: This helps retail match, but it adds to the stack + IDirect3DRMTexture* tex; + Result result = MeshGetTexture(m_data, &tex); + +#ifndef BETA10 + if (Succeeded(result)) { + result = + ResultVal(tex->QueryInterface(IID_IDirect3DRMTexture2, (LPVOID*) (&pTextureImpl->ImplementationData()))); } - else { - delete newGroup; - newGroup = NULL; - } - return newGroup; +#endif + + *ppTexture = pTextureImpl; + return result; } // FUNCTION: LEGO1 0x100a4330 +// FUNCTION: BETA10 0x10170820 Result MeshImpl::GetTexture(Texture*& rpTexture) { - IDirect3DRMTexture* texture; - TextureImpl* holder = new TextureImpl(); - Result result = ResultVal(m_data->groupMesh->GetGroupTexture(m_data->groupIndex, &texture)); - if (result) { - // Seems to actually call the first virtual method of holder here - // but that doesn't make any sense since it passes three arguments - // to the method (self + string constant? + an offset?). + assert(m_data); - // This line makes the start of the function match and is what I - // would expect to see there but it clearly isn't what's actually - // there. - holder->SetImplementation(texture); - } - rpTexture = holder; - return Success; + return GetTexture(reinterpret_cast(&rpTexture)); } diff --git a/LEGO1/tgl/d3drm/meshbuilder.cpp b/LEGO1/tgl/d3drm/meshbuilder.cpp index be7119f3..1f9da01a 100644 --- a/LEGO1/tgl/d3drm/meshbuilder.cpp +++ b/LEGO1/tgl/d3drm/meshbuilder.cpp @@ -15,6 +15,7 @@ void* MeshBuilderImpl::ImplementationDataPtr() } // FUNCTION: LEGO1 0x100a3840 +// FUNCTION: BETA10 0x1016ca40 Mesh* MeshBuilderImpl::CreateMesh( unsigned long faceCount, unsigned long vertexCount, @@ -26,6 +27,8 @@ Mesh* MeshBuilderImpl::CreateMesh( ShadingModel shadingModel ) { + assert(m_data); + MeshImpl* pMeshImpl = new MeshImpl; if (CreateMeshImpl( pMeshImpl, @@ -45,73 +48,67 @@ Mesh* MeshBuilderImpl::CreateMesh( return pMeshImpl; } -inline Result MeshSetTextureMappingMode(MeshImpl::MeshData* pMesh, TextureMappingMode mode) -{ - if (mode == PerspectiveCorrect) { - return ResultVal(pMesh->groupMesh->SetGroupMapping(pMesh->groupIndex, D3DRMMAP_PERSPCORRECT)); - } - else { - return ResultVal(pMesh->groupMesh->SetGroupMapping(pMesh->groupIndex, 0)); - } -} - +// FUNCTION: BETA10 0x1016fef0 inline Result CreateMesh( IDirect3DRMMesh* pD3DRM, - unsigned long faceCount, - unsigned long vertexCount, - float (*pPositions)[3], - float (*pNormals)[3], - float (*pTextureCoordinates)[2], - unsigned long (*pFaceIndices)[3], - unsigned long (*pTextureIndices)[3], + unsigned long p_numFaces, + unsigned long p_numVertices, + float(*p_positions), + float(*p_normals), + float(*p_textureCoordinates), + unsigned long (*p_faceIndices)[3], + unsigned long (*p_textureIndices)[3], ShadingModel shadingModel, MeshImpl::MeshDataType& rpMesh ) { - unsigned long* faceIndices = (unsigned long*) pFaceIndices; + unsigned short* faceIndices = (unsigned short*) p_faceIndices; D3DRMGROUPINDEX groupIndex = 0; - int count = faceCount * 3; - int index = 0; + int faceCount = p_numFaces * 3; + int count = 0; - unsigned int* fData = new unsigned int[count]; + unsigned int* fData = new unsigned int[faceCount]; - D3DRMVERTEX* vertices = new D3DRMVERTEX[vertexCount]; - memset(vertices, 0, sizeof(*vertices) * vertexCount); + D3DRMVERTEX* vertices = new D3DRMVERTEX[p_numVertices]; + memset(vertices, 0, sizeof(*vertices) * p_numVertices); rpMesh = new MeshImpl::MeshData; rpMesh->groupMesh = pD3DRM; - for (int i = 0; i < count; i++) { - if ((*((unsigned short*) &faceIndices[i] + 1) >> 0x0f) & 0x01) { - unsigned long j = *(unsigned short*) &faceIndices[i]; - vertices[index].position.x = pPositions[j][0]; - vertices[index].position.y = pPositions[j][1]; - vertices[index].position.z = pPositions[j][2]; - j = *((unsigned short*) &faceIndices[i] + 1) & MAXSHORT; - vertices[index].normal.x = pNormals[j][0]; - vertices[index].normal.y = pNormals[j][1]; - vertices[index].normal.z = pNormals[j][2]; + for (int i = 0; i < faceCount; i++) { + if (((faceIndices[2 * i + 1]) >> 0x0f) & 0x01) { + unsigned long j = 3 * faceIndices[2 * i]; + vertices[count].position.x = p_positions[j]; + vertices[count].position.y = p_positions[j + 1]; + vertices[count].position.z = p_positions[j + 2]; - if (pTextureIndices != NULL && pTextureCoordinates != NULL) { - j = ((unsigned long*) pTextureIndices)[i]; - vertices[index].tu = pTextureCoordinates[j][0]; - vertices[index].tv = pTextureCoordinates[j][1]; + int k = 3 * (faceIndices[2 * i + 1] & MAXSHORT); + vertices[count].normal.x = p_normals[k]; + vertices[count].normal.y = p_normals[k + 1]; + vertices[count].normal.z = p_normals[k + 2]; + + if (p_textureIndices != NULL && p_textureCoordinates != NULL) { + int kk = 2 * ((unsigned long*) p_textureIndices)[i]; + vertices[count].tu = p_textureCoordinates[kk]; + vertices[count].tv = p_textureCoordinates[kk + 1]; } - fData[i] = index; - index++; + fData[i] = count; + count++; } else { - fData[i] = *(unsigned short*) &faceIndices[i]; + fData[i] = faceIndices[2 * i]; } } + assert(count == (int) p_numVertices); + Result result; - result = ResultVal(pD3DRM->AddGroup(vertexCount, faceCount, 3, fData, &groupIndex)); + result = ResultVal(pD3DRM->AddGroup(p_numVertices, p_numFaces, 3, fData, &groupIndex)); if (Succeeded(result)) { rpMesh->groupIndex = groupIndex; - result = ResultVal(pD3DRM->SetVertices(groupIndex, 0, vertexCount, vertices)); + result = ResultVal(pD3DRM->SetVertices(groupIndex, 0, p_numVertices, vertices)); } if (!Succeeded(result)) { @@ -122,6 +119,7 @@ inline Result CreateMesh( } else { result = MeshSetTextureMappingMode(rpMesh, PerspectiveCorrect); + assert(Succeeded(result)); } if (fData != NULL) { @@ -135,6 +133,7 @@ inline Result CreateMesh( return result; } +// FUNCTION: BETA10 0x1016fe40 inline Result MeshBuilderImpl::CreateMeshImpl( MeshImpl* pMeshImpl, unsigned long faceCount, @@ -147,13 +146,16 @@ inline Result MeshBuilderImpl::CreateMeshImpl( ShadingModel shadingModel ) { + assert(m_data); + assert(!pMeshImpl->ImplementationData()); + return ::CreateMesh( m_data, faceCount, vertexCount, - pPositions, - pNormals, - pTextureCoordinates, + reinterpret_cast(pPositions), + reinterpret_cast(pNormals), + reinterpret_cast(pTextureCoordinates), pFaceIndices, pTextureIndices, shadingModel, diff --git a/LEGO1/tgl/d3drm/renderer.cpp b/LEGO1/tgl/d3drm/renderer.cpp index f0ab4fbb..c295b4b3 100644 --- a/LEGO1/tgl/d3drm/renderer.cpp +++ b/LEGO1/tgl/d3drm/renderer.cpp @@ -36,64 +36,158 @@ Result RendererImpl::Create() return (m_data != NULL) ? Success : Error; } +// FUNCTION: BETA10 0x1016cf00 +inline Result RendererCreateDevice( + IDirect3DRM2* pD3DRM, + const DeviceDirect3DCreateData& rCreateData, + IDirect3DRMDevice2*& rpDevice +) +{ + Result result = + ResultVal(pD3DRM->CreateDeviceFromD3D(rCreateData.m_pDirect3D, rCreateData.m_pDirect3DDevice, &rpDevice)); + return result; +} + +// FUNCTION: BETA10 0x1016ce60 +inline Result RendererImpl::CreateDevice(const DeviceDirect3DCreateData& rCreateData, DeviceImpl& rDevice) +{ + assert(m_data); + assert(!rDevice.ImplementationData()); + + return RendererCreateDevice(m_data, rCreateData, rDevice.ImplementationData()); +} + // FUNCTION: LEGO1 0x100a1830 +// FUNCTION: BETA10 0x10169d90 Device* RendererImpl::CreateDevice(const DeviceDirect3DCreateData& data) { + assert(m_data); DeviceImpl* device = new DeviceImpl(); - HRESULT result = m_data->CreateDeviceFromD3D(data.m_pDirect3D, data.m_pDirect3DDevice, &device->m_data); - if (!SUCCEEDED(result)) { + + if (!CreateDevice(data, *device)) { delete device; device = NULL; } + return device; } +// FUNCTION: BETA10 0x1016cfe0 +inline Result RendererCreateDevice( + IDirect3DRM2* pD3DRM, + const DeviceDirectDrawCreateData& rCreateData, + IDirect3DRMDevice2*& rpDevice +) +{ + Result result = ResultVal(pD3DRM->CreateDeviceFromSurface( + const_cast(rCreateData.m_driverGUID), + rCreateData.m_pDirectDraw, + rCreateData.m_pBackBuffer, + &rpDevice + )); + + if (Succeeded(result)) { + if (rCreateData.m_pBackBuffer) { + // LEGO1 0x10101040 + // GLOBAL: BETA10 0x102055f4 + static int g_setBufferCount = 1; + if (g_setBufferCount) { + Result result2 = ResultVal(rpDevice->SetBufferCount(2)); + assert(Succeeded(result)); + } + } + } + + return result; +} + +// FUNCTION: BETA10 0x1016cf40 +inline Result RendererImpl::CreateDevice(const DeviceDirectDrawCreateData& rCreateData, DeviceImpl& rDevice) +{ + assert(m_data); + assert(!rDevice.ImplementationData()); + + return RendererCreateDevice(m_data, rCreateData, rDevice.ImplementationData()); +} + // FUNCTION: LEGO1 0x100a1900 +// FUNCTION: BETA10 0x10169ea0 Device* RendererImpl::CreateDevice(const DeviceDirectDrawCreateData& data) { - // at LEGO1 0x10101040, needs no annotation - static int g_SetBufferCount = 1; - + assert(m_data); DeviceImpl* device = new DeviceImpl(); - HRESULT result = m_data->CreateDeviceFromSurface( - const_cast(data.m_driverGUID), - data.m_pDirectDraw, - data.m_pBackBuffer, - &device->m_data - ); - if (SUCCEEDED(result) && data.m_pBackBuffer && g_SetBufferCount) { - device->m_data->SetBufferCount(2); - } - if (!SUCCEEDED(result)) { + + if (!CreateDevice(data, *device)) { delete device; device = NULL; } + return device; } +// FUNCTION: BETA10 0x1016d1d0 inline Result RendererCreateView( IDirect3DRM2* pRenderer, - IDirect3DRMDevice2* pDevice, - IDirect3DRMFrame2* pCamera, - IDirect3DRMViewport*& rpView, + const IDirect3DRMDevice2* pDevice, + const IDirect3DRMFrame2* pCamera, unsigned long x, unsigned long y, unsigned long width, - unsigned long height + unsigned long height, + IDirect3DRMViewport*& rpView ) { - Result result = ResultVal(pRenderer->CreateViewport(pDevice, pCamera, x, y, width, height, &rpView)); + Result result = ResultVal(pRenderer->CreateViewport( + const_cast(pDevice), + const_cast(pCamera), + x, + y, + width, + height, + &rpView + )); + if (Succeeded(result)) { - result = ViewImpl::ViewportCreateAppData(pRenderer, rpView, pCamera); + result = ViewImpl::ViewportCreateAppData(pRenderer, rpView, const_cast(pCamera)); if (!Succeeded(result)) { rpView->Release(); rpView = NULL; } } + return result; } +// FUNCTION: BETA10 0x1016d0b0 +inline Result RendererImpl::CreateView( + const DeviceImpl& rDevice, + const CameraImpl& rCamera, + unsigned long x, + unsigned long y, + unsigned long width, + unsigned long height, + ViewImpl& rView +) +{ + assert(m_data); + assert(rDevice.ImplementationData()); + assert(rCamera.ImplementationData()); + assert(!rView.ImplementationData()); + + return RendererCreateView( + m_data, + rDevice.ImplementationData(), + rCamera.ImplementationData(), + x, + y, + width, + height, + rView.ImplementationData() + ); +} + // FUNCTION: LEGO1 0x100a1a00 +// FUNCTION: BETA10 0x10169fb0 View* RendererImpl::CreateView( const Device* pDevice, const Camera* pCamera, @@ -103,29 +197,37 @@ View* RendererImpl::CreateView( unsigned long height ) { + assert(m_data); + assert(pDevice); + assert(pCamera); + ViewImpl* view = new ViewImpl(); - Result result = RendererCreateView( - m_data, - static_cast(pDevice)->m_data, - static_cast(pCamera)->m_data, - view->m_data, - x, - y, - width, - height - ); - if (!result) { + if (!CreateView( + *static_cast(pDevice), + *static_cast(pCamera), + x, + y, + width, + height, + *view + )) { delete view; view = NULL; } + return view; } -inline Result RendererCreateGroup(IDirect3DRM2* pRenderer, IDirect3DRMFrame2* pParent, IDirect3DRMFrame2*& rpGroup) +// FUNCTION: BETA10 0x1016d380 +inline Result RendererCreateGroup( + IDirect3DRM2* pRenderer, + const IDirect3DRMFrame2* pParent, + IDirect3DRMFrame2*& rpGroup +) { Result result = ResultVal(pRenderer->CreateFrame(NULL, &rpGroup)); if (Succeeded(result) && pParent) { - result = ResultVal(pParent->AddVisual(rpGroup)); + result = ResultVal(const_cast(pParent)->AddVisual(rpGroup)); if (!Succeeded(result)) { rpGroup->Release(); rpGroup = NULL; @@ -134,27 +236,61 @@ inline Result RendererCreateGroup(IDirect3DRM2* pRenderer, IDirect3DRMFrame2* pP return result; } +// FUNCTION: BETA10 0x1016d280 +inline Result RendererImpl::CreateGroup(const GroupImpl* pParentGroup, GroupImpl& rGroup) +{ + assert(m_data); + assert(!pParentGroup || pParentGroup->ImplementationData()); + assert(!rGroup.ImplementationData()); + + return RendererCreateGroup( + m_data, + pParentGroup ? pParentGroup->ImplementationData() : NULL, + rGroup.ImplementationData() + ); +} + // FUNCTION: LEGO1 0x100a1b20 +// FUNCTION: BETA10 0x1016a130 Group* RendererImpl::CreateGroup(const Group* pParent) { + assert(m_data); + GroupImpl* group = new GroupImpl(); - Result result = - RendererCreateGroup(m_data, pParent ? static_cast(pParent)->m_data : NULL, group->m_data); - if (!result) { + if (!CreateGroup(static_cast(pParent), *group)) { delete group; group = NULL; } return group; } +// FUNCTION: BETA10 0x1016d4b0 +inline Result RendererCreateCamera(IDirect3DRM2* pD3DRM, IDirect3DRMFrame2*& rpCamera) +{ + return ResultVal(pD3DRM->CreateFrame(NULL, &rpCamera)); +} + +// FUNCTION: BETA10 0x1016d420 +inline Result RendererImpl::CreateCamera(CameraImpl& rCamera) +{ + assert(m_data); + assert(!rCamera.ImplementationData()); + + return RendererCreateCamera(m_data, rCamera.ImplementationData()); +} + // FUNCTION: LEGO1 0x100a1c30 +// FUNCTION: BETA10 0x1016a980 Camera* RendererImpl::CreateCamera() { + assert(m_data); CameraImpl* camera = new CameraImpl(); - if (FAILED(m_data->CreateFrame(NULL, &camera->m_data))) { + + if (!CreateCamera(*camera)) { delete camera; camera = NULL; } + return camera; } @@ -236,50 +372,106 @@ Light* RendererImpl::CreateLight(LightType type, float r, float g, float b) return pLightImpl; } +// FUNCTION: BETA10 0x1016d8e0 +inline Result RendererCreateMeshBuilder(IDirect3DRM2* pD3DRM, IDirect3DRMMesh*& rpMesh) +{ + return ResultVal(pD3DRM->CreateMesh(&rpMesh)); +} + +// FUNCTION: BETA10 0x1016d850 +inline Result RendererImpl::CreateMeshBuilder(MeshBuilderImpl& rMesh) +{ + assert(m_data); + assert(!rMesh.ImplementationData()); + + return RendererCreateMeshBuilder(m_data, rMesh.ImplementationData()); +} + // FUNCTION: LEGO1 0x100a1e90 +// FUNCTION: BETA10 0x1016abf0 MeshBuilder* RendererImpl::CreateMeshBuilder() { + assert(m_data); MeshBuilderImpl* meshBuilder = new MeshBuilderImpl(); - if (FAILED(m_data->CreateMesh(&meshBuilder->m_data))) { + + if (!CreateMeshBuilder(*static_cast(meshBuilder))) { delete meshBuilder; meshBuilder = NULL; } + return meshBuilder; } +// FUNCTION: BETA10 0x1016d9c0 inline Result RendererCreateTexture( - IDirect3DRM2* renderer, - IDirect3DRMTexture*& texture, + IDirect3DRM2* pRenderer, int width, int height, int bytesPerPixel, void* pBuffer, int useBuffer, int paletteSize, - PaletteEntry* pEntries + PaletteEntry* pEntries, + IDirect3DRMTexture*& rpTexture ) { - TglD3DRMIMAGE* image; Result result; - image = new TglD3DRMIMAGE(width, height, bytesPerPixel, pBuffer, useBuffer, paletteSize, pEntries); + TglD3DRMIMAGE* pImage = new TglD3DRMIMAGE(width, height, bytesPerPixel, pBuffer, useBuffer, paletteSize, pEntries); + assert(pImage); + // TODO: LPDIRECT3DRMTEXTURE2? - result = ResultVal(renderer->CreateTexture(&image->m_image, (LPDIRECT3DRMTEXTURE2*) &texture)); + result = ResultVal(pRenderer->CreateTexture(&pImage->m_image, (LPDIRECT3DRMTEXTURE2*) &rpTexture)); + assert(Succeeded(result)); + assert((rpTexture->AddRef(), rpTexture->Release()) == 1); + if (Succeeded(result)) { - result = TextureImpl::SetImage(texture, image); + result = TextureImpl::SetImage(rpTexture, pImage); + assert(Succeeded(result)); + if (!Succeeded(result)) { - texture->Release(); - texture = NULL; - delete image; + rpTexture->Release(); + rpTexture = NULL; + delete pImage; } } else { - delete image; + delete pImage; } + return result; } +// FUNCTION: BETA10 0x1016d910 +inline Result RendererImpl::CreateTexture( + TextureImpl& rTexture, + int width, + int height, + int bitsPerTexel, + const void* pTexels, + int texelsArePersistent, + int paletteEntryCount, + const PaletteEntry* pEntries +) +{ + assert(m_data); + assert(!rTexture.ImplementationData()); + + return RendererCreateTexture( + m_data, + width, + height, + bitsPerTexel, + const_cast(pTexels), + texelsArePersistent, + paletteEntryCount, + const_cast(pEntries), + rTexture.ImplementationData() + ); +} + // FUNCTION: LEGO1 0x100a1f50 +// FUNCTION: BETA10 0x1016ad00 Texture* RendererImpl::CreateTexture( int width, int height, @@ -290,10 +482,11 @@ Texture* RendererImpl::CreateTexture( const PaletteEntry* pEntries ) { + assert(m_data); + TextureImpl* texture = new TextureImpl(); - if (!Succeeded(RendererCreateTexture( - m_data, - texture->m_data, + if (!CreateTexture( + *texture, width, height, bitsPerTexel, @@ -301,34 +494,71 @@ Texture* RendererImpl::CreateTexture( texelsArePersistent, paletteEntryCount, const_cast(pEntries) - ))) { + )) { delete texture; texture = NULL; } return texture; } +// FUNCTION: BETA10 0x1016dcb0 +inline Result RendererCreateTexture(IDirect3DRM2* pRenderer, IDirect3DRMTexture*& rpTexture) +{ + return RendererCreateTexture(pRenderer, 0, 0, 0, NULL, FALSE, 0, NULL, rpTexture); +} + +// FUNCTION: BETA10 0x1016dc20 +inline Result RendererImpl::CreateTexture(TextureImpl& rTexture) +{ + assert(m_data); + assert(!rTexture.ImplementationData()); + + return RendererCreateTexture(m_data, rTexture.ImplementationData()); +} + // FUNCTION: LEGO1 0x100a20d0 +// FUNCTION: BETA10 0x1016ae20 Texture* RendererImpl::CreateTexture() { + assert(m_data); + TextureImpl* texture = new TextureImpl(); - if (!Succeeded(RendererCreateTexture(m_data, texture->m_data, 0, 0, 0, NULL, FALSE, 0, NULL))) { + if (!CreateTexture(*texture)) { delete texture; texture = NULL; } + return texture; } +// FUNCTION: BETA10 0x1016af90 +inline Result RendererSetTextureDefaultShadeCount(IDirect3DRM2* pRenderer, unsigned long shadeCount) +{ + return ResultVal(pRenderer->SetDefaultTextureShades(shadeCount)); +} + // FUNCTION: LEGO1 0x100a2270 +// FUNCTION: BETA10 0x1016af30 Result RendererImpl::SetTextureDefaultShadeCount(unsigned long shadeCount) { - return ResultVal(m_data->SetDefaultTextureShades(shadeCount)); + assert(m_data); + + return RendererSetTextureDefaultShadeCount(m_data, shadeCount); +} + +// FUNCTION: BETA10 0x1016b020 +inline Result RendererSetTextureDefaultColorCount(IDirect3DRM2* pRenderer, unsigned long colorCount) +{ + return ResultVal(pRenderer->SetDefaultTextureColors(colorCount)); } // FUNCTION: LEGO1 0x100a2290 +// FUNCTION: BETA10 0x1016afc0 Result RendererImpl::SetTextureDefaultColorCount(unsigned long colorCount) { - return ResultVal(m_data->SetDefaultTextureColors(colorCount)); + assert(m_data); + + return RendererSetTextureDefaultColorCount(m_data, colorCount); } // FUNCTION: LEGO1 0x100a22b0 diff --git a/LEGO1/tgl/d3drm/texture.cpp b/LEGO1/tgl/d3drm/texture.cpp index 5944d7ba..0a19c8c4 100644 --- a/LEGO1/tgl/d3drm/texture.cpp +++ b/LEGO1/tgl/d3drm/texture.cpp @@ -1,9 +1,12 @@ #include "impl.h" +#include + using namespace TglImpl; DECOMP_SIZE_ASSERT(TglD3DRMIMAGE, 0x40); +// FUNCTION: BETA10 0x1016f9f0 inline TglD3DRMIMAGE* TextureGetImage(IDirect3DRMTexture* pTexture) { return reinterpret_cast(pTexture->GetAppData()); @@ -13,36 +16,47 @@ inline TglD3DRMIMAGE* TextureGetImage(IDirect3DRMTexture* pTexture) void TextureDestroyCallback(IDirect3DRMObject* pObject, void* pArg); // FUNCTION: LEGO1 0x100a12a0 +// FUNCTION: BETA10 0x10169113 Result TextureImpl::SetImage(IDirect3DRMTexture* pSelf, TglD3DRMIMAGE* pImage) { void* appData; Result result; appData = pImage; + assert(reinterpret_cast(appData) == pImage); - // This is here because in the original code they asserted - // on the return value being NULL. - TextureGetImage(pSelf); + if (TextureGetImage(pSelf)) { + assert(0); + } result = ResultVal(pSelf->SetAppData((LPD3DRM_APPDATA) appData)); + assert(Succeeded(result)); + if (Succeeded(result) && pImage) { result = ResultVal(pSelf->AddDestroyCallback(TextureDestroyCallback, NULL)); + assert(Succeeded(result)); + if (!Succeeded(result)) { pSelf->SetAppData(0); } } + return result; } // FUNCTION: LEGO1 0x100a1300 +// FUNCTION: BETA10 0x10169278 void TextureDestroyCallback(IDirect3DRMObject* pObject, void* pArg) { TglD3DRMIMAGE* pImage = reinterpret_cast(pObject->GetAppData()); + assert(pImage); + delete pImage; pObject->SetAppData(0); } // FUNCTION: LEGO1 0x100a1330 +// FUNCTION: BETA10 0x101692e1 TglD3DRMIMAGE::TglD3DRMIMAGE( int width, int height, @@ -53,10 +67,10 @@ TglD3DRMIMAGE::TglD3DRMIMAGE( PaletteEntry* pEntries ) { - m_image.aspectx = 1; - m_image.aspecty = 1; m_image.width = 0; m_image.height = 0; + m_image.aspectx = 1; + m_image.aspecty = 1; m_image.depth = 0; m_image.rgb = 0; m_image.bytes_per_line = 0; @@ -69,23 +83,31 @@ TglD3DRMIMAGE::TglD3DRMIMAGE( m_image.palette_size = 0; m_image.palette = NULL; m_texelsAllocatedByClient = 0; + + Result result; if (pBuffer != NULL) { - CreateBuffer(width, height, depth, pBuffer, useBuffer); + result = CreateBuffer(width, height, depth, pBuffer, useBuffer); + assert(Succeeded(result)); } + if (pEntries != NULL) { - InitializePalette(paletteSize, pEntries); + result = InitializePalette(paletteSize, pEntries); + assert(Succeeded(result)); } } // FUNCTION: LEGO1 0x100a13b0 -void TglD3DRMIMAGE::Destroy() +// FUNCTION: BETA10 0x1016944b +TglD3DRMIMAGE::~TglD3DRMIMAGE() { if (m_texelsAllocatedByClient == 0) { delete[] ((char*) m_image.buffer1); } + delete m_image.palette; } +// FUNCTION: BETA10 0x101699a0 inline static int IsPowerOfTwo(int v) { int m = 0; @@ -99,16 +121,25 @@ inline static int IsPowerOfTwo(int v) } // FUNCTION: LEGO1 0x100a13e0 +// FUNCTION: BETA10 0x101694a4 Result TglD3DRMIMAGE::CreateBuffer(int width, int height, int depth, void* pBuffer, int useBuffer) { - if (!(IsPowerOfTwo(width) && IsPowerOfTwo(height) && width % 4 == 0)) { + int bytesPerScanline = width; + + assert(IsPowerOfTwo(width)); + assert(IsPowerOfTwo(height)); + assert((bytesPerScanline % 4) == 0); + + if (!(IsPowerOfTwo(width) && IsPowerOfTwo(height) && bytesPerScanline % 4 == 0)) { return Error; } + assert(!m_image.buffer1 || (m_image.buffer1 == pBuffer)); + m_image.width = width; m_image.height = height; m_image.depth = depth; - m_image.bytes_per_line = width; + m_image.bytes_per_line = bytesPerScanline; if (!m_texelsAllocatedByClient) { delete[] ((char*) m_image.buffer1); @@ -116,12 +147,13 @@ Result TglD3DRMIMAGE::CreateBuffer(int width, int height, int depth, void* pBuff } if (useBuffer) { - m_texelsAllocatedByClient = 1; m_image.buffer1 = (char*) pBuffer; + m_texelsAllocatedByClient = 1; } else { - m_image.buffer1 = new char[width * height]; - memcpy(m_image.buffer1, pBuffer, width * height); + int size = bytesPerScanline * height; + m_image.buffer1 = new char[size]; + memcpy(m_image.buffer1, pBuffer, size); m_texelsAllocatedByClient = 0; } @@ -129,14 +161,20 @@ Result TglD3DRMIMAGE::CreateBuffer(int width, int height, int depth, void* pBuff } // FUNCTION: LEGO1 0x100a1510 -Result TglD3DRMIMAGE::FillRowsOfTexture(int y, int height, char* pContent) +// FUNCTION: BETA10 0x1016969c +Result TglD3DRMIMAGE::FillRowsOfTexture(int destVOffset, int srcHeight, char* pTexels) { - // The purpose is clearly this but I can't get the assembly to line up. - memcpy((char*) m_image.buffer1 + (y * m_image.bytes_per_line), pContent, height * m_image.bytes_per_line); + assert(m_image.buffer1 && pTexels); + assert((destVOffset + srcHeight) <= m_image.height); + + int size = srcHeight * m_image.bytes_per_line; + char* pSrc = (char*) m_image.buffer1 + (destVOffset * m_image.bytes_per_line); + memcpy(pSrc, pTexels, size); return Success; } // FUNCTION: LEGO1 0x100a1550 +// FUNCTION: BETA10 0x10169758 Result TglD3DRMIMAGE::InitializePalette(int paletteSize, PaletteEntry* pEntries) { // This function is a 100% match if the PaletteEntry class is copied @@ -152,6 +190,7 @@ Result TglD3DRMIMAGE::InitializePalette(int paletteSize, PaletteEntry* pEntries) m_image.palette_size = paletteSize; } } + if (paletteSize > 0) { for (int i = 0; i < paletteSize; i++) { m_image.palette[i].red = pEntries[i].m_red; @@ -160,67 +199,146 @@ Result TglD3DRMIMAGE::InitializePalette(int paletteSize, PaletteEntry* pEntries) m_image.palette[i].flags = D3DRMPALETTE_READONLY; } } + return Success; } -// FUNCTION: LEGO1 0x100a3c10 -Result TextureImpl::SetTexels(int width, int height, int bitsPerTexel, void* pTexels) +// FUNCTION: BETA10 0x1016ee80 +inline Result TextureSetTexels( + IDirect3DRMTexture* pTexture, + int width, + int height, + int bitsPerTexel, + void* pTexels, + int pTexelsArePersistent +) { - TglD3DRMIMAGE* image = TextureGetImage(m_data); - Result result = image->CreateBuffer(width, height, bitsPerTexel, pTexels, TRUE); + TglD3DRMIMAGE* pImage = TextureGetImage(pTexture); + assert(pImage); + + Result result = pImage->CreateBuffer(width, height, bitsPerTexel, pTexels, pTexelsArePersistent); + assert(Succeeded(result)); + if (Succeeded(result)) { - result = ResultVal(m_data->Changed(TRUE, FALSE)); + result = ResultVal(pTexture->Changed(TRUE, FALSE)); + assert(Succeeded(result)); } + + return result; +} + +// FUNCTION: LEGO1 0x100a3c10 +// FUNCTION: BETA10 0x1016c390 +Result TextureImpl::SetTexels(int width, int height, int bitsPerTexel, void* pTexels, int pTexelsArePersistent) +{ + assert(m_data); + + return TextureSetTexels(m_data, width, height, bitsPerTexel, pTexels, pTexelsArePersistent); +} + +// FUNCTION: BETA10 0x1016f160 +inline Result TextureFillRowsOfTexture(IDirect3DRMTexture* pTexture, int y, int height, void* pBuffer) +{ + TglD3DRMIMAGE* pImage = TextureGetImage(pTexture); + assert(pImage); + + Result result = pImage->FillRowsOfTexture(y, height, (char*) pBuffer); + assert(Succeeded(result)); + return result; } // FUNCTION: LEGO1 0x100a3c60 +// FUNCTION: BETA10 0x1016c490 void TextureImpl::FillRowsOfTexture(int y, int height, void* pBuffer) { - TglD3DRMIMAGE* image = TextureGetImage(m_data); - image->FillRowsOfTexture(y, height, (char*) pBuffer); + assert(m_data); + + TextureFillRowsOfTexture(m_data, y, height, pBuffer); +} + +// FUNCTION: BETA10 0x1016f270 +inline Result TextureChanged(IDirect3DRMTexture* pTexture, int texelsChanged, int paletteChanged) +{ + Result result = ResultVal(pTexture->Changed(texelsChanged, paletteChanged)); + assert(Succeeded(result)); + return result; } // FUNCTION: LEGO1 0x100a3c90 +// FUNCTION: BETA10 0x1016c540 Result TextureImpl::Changed(int texelsChanged, int paletteChanged) { - return ResultVal(m_data->Changed(texelsChanged, paletteChanged)); + assert(m_data); + + return TextureChanged(m_data, texelsChanged, paletteChanged); +} + +// FUNCTION: BETA10 0x1016f4c0 +inline Result TextureGetBufferAndPalette( + IDirect3DRMTexture* pTexture, + int* width, + int* height, + int* depth, + void** pBuffer, + int* paletteSize, + unsigned char (*pEntries)[3] +) +{ + TglD3DRMIMAGE* pImage = TextureGetImage(pTexture); + assert(pImage); + + *width = pImage->m_image.width; + *height = pImage->m_image.height; + *depth = pImage->m_image.depth; + *pBuffer = pImage->m_image.buffer1; + *paletteSize = pImage->m_image.palette_size; + + for (int i = 0; i < *paletteSize; i++) { + pEntries[i][0] = pImage->m_image.palette[i].red; + pEntries[i][1] = pImage->m_image.palette[i].green; + pEntries[i][2] = pImage->m_image.palette[i].blue; + } + + return Success; } // FUNCTION: LEGO1 0x100a3cc0 +// FUNCTION: BETA10 0x1016c5d0 Result TextureImpl::GetBufferAndPalette( int* width, int* height, int* depth, void** pBuffer, int* paletteSize, - PaletteEntry** pEntries + unsigned char (*pEntries)[3] ) { - // Something really doesn't match here, not sure what's up. - TglD3DRMIMAGE* image = TextureGetImage(m_data); - *width = image->m_image.width; - *height = image->m_image.height; - *depth = image->m_image.depth; - *pBuffer = image->m_image.buffer1; - *paletteSize = image->m_image.palette_size; - for (int i = 0; i < image->m_image.palette_size; i++) { - pEntries[i]->m_red = image->m_image.palette[i].red; - pEntries[i]->m_green = image->m_image.palette[i].green; - pEntries[i]->m_blue = image->m_image.palette[i].blue; - } + assert(m_data); + + return TextureGetBufferAndPalette(m_data, width, height, depth, pBuffer, paletteSize, pEntries); +} + +// FUNCTION: BETA10 0x1016f730 +inline Result TextureSetPalette(IDirect3DRMTexture* pTexture, int entryCount, PaletteEntry* pEntries) +{ + TglD3DRMIMAGE* pImage = TextureGetImage(pTexture); + assert(pImage); + + pImage->InitializePalette(entryCount, pEntries); + Result result = ResultVal(pTexture->Changed(FALSE, TRUE)); + assert(Succeeded(result)); + return Success; } // FUNCTION: LEGO1 0x100a3d40 +// FUNCTION: BETA10 0x1016c6a0 Result TextureImpl::SetPalette(int entryCount, PaletteEntry* pEntries) { - // Not 100% confident this is supposed to directly be forwarding arguments, - // but it probably is given FillRowsOfTexture matches doing that. - TglD3DRMIMAGE* image = TextureGetImage(m_data); - image->InitializePalette(entryCount, pEntries); - m_data->Changed(FALSE, TRUE); - return Success; + assert(m_data); + + return TextureSetPalette(m_data, entryCount, pEntries); } // FUNCTION: LEGO1 0x100a3d70 diff --git a/LEGO1/tgl/d3drm/view.cpp b/LEGO1/tgl/d3drm/view.cpp index 30970214..654528fe 100644 --- a/LEGO1/tgl/d3drm/view.cpp +++ b/LEGO1/tgl/d3drm/view.cpp @@ -19,9 +19,12 @@ struct ViewportAppData { DECOMP_SIZE_ASSERT(ViewportAppData, 0x18); // FUNCTION: LEGO1 0x100a10b0 +// FUNCTION: BETA10 0x10168920 ViewportAppData::ViewportAppData(IDirect3DRM2* pRenderer) { - pRenderer->CreateFrame(NULL, &m_pLightFrame); + Result result = ResultVal(pRenderer->CreateFrame(NULL, &m_pLightFrame)); + assert(Succeeded(result)); + m_pCamera = NULL; m_pLastRenderedFrame = NULL; m_backgroundColorRed = 0.0f; @@ -30,36 +33,64 @@ ViewportAppData::ViewportAppData(IDirect3DRM2* pRenderer) } // FUNCTION: LEGO1 0x100a10e0 +// FUNCTION: BETA10 0x101689bd ViewportAppData::~ViewportAppData() { + int refCount; IDirect3DRMFrameArray* pChildFrames; IDirect3DRMFrame* pChildFrame = NULL; - m_pLightFrame->GetChildren(&pChildFrames); + Result result = ResultVal(m_pLightFrame->GetChildren(&pChildFrames)); + assert(Succeeded(result)); + for (int i = 0; i < (int) pChildFrames->GetSize(); i++) { - pChildFrames->GetElement(i, &pChildFrame); - m_pLightFrame->DeleteChild(pChildFrame); - pChildFrame->Release(); // GetElement() does AddRef() + result = ResultVal(pChildFrames->GetElement(i, &pChildFrame)); + assert(Succeeded(result)); + + result = ResultVal(m_pLightFrame->DeleteChild(pChildFrame)); + assert(Succeeded(result)); + + refCount = pChildFrame->Release(); // GetElement() does AddRef() + assert(refCount >= 1); } - pChildFrames->Release(); - m_pLightFrame->Release(); + + refCount = pChildFrames->Release(); + assert(refCount == 0); + + refCount = m_pLightFrame->Release(); + assert(refCount == 0); } // Forward declare to satisfy order check void ViewportDestroyCallback(IDirect3DRMObject* pObject, void* pArg); // FUNCTION: LEGO1 0x100a1160 -Result ViewImpl::ViewportCreateAppData(IDirect3DRM2* pDevice, IDirect3DRMViewport* pView, IDirect3DRMFrame2* pCamera) +// FUNCTION: BETA10 0x10168ba5 +Result ViewImpl::ViewportCreateAppData( + IDirect3DRM2* pDevice, + IDirect3DRMViewport* pViewport, + IDirect3DRMFrame2* pCamera +) { - ViewportAppData* data = new ViewportAppData(pDevice); - data->m_pCamera = pCamera; - Result result = ResultVal(pView->SetAppData(reinterpret_cast(data))); + ViewportAppData* pViewportAppData = new ViewportAppData(pDevice); + assert(pViewportAppData); + + pViewportAppData->m_pCamera = pCamera; + assert(!pViewport->GetAppData()); + + Result result = ResultVal(pViewport->SetAppData(reinterpret_cast(pViewportAppData))); + assert(Succeeded(result)); + assert(reinterpret_cast(pViewport->GetAppData()) == pViewportAppData); + if (Succeeded(result)) { - result = ResultVal(pView->AddDestroyCallback(ViewportDestroyCallback, data)); + result = ResultVal(pViewport->AddDestroyCallback(ViewportDestroyCallback, pViewportAppData)); + assert(Succeeded(result)); } + if (!Succeeded(result)) { - delete data; - pView->SetAppData(0); + delete pViewportAppData; + pViewport->SetAppData(0); } + return result; } @@ -90,16 +121,21 @@ inline Result ViewRestoreFrameAfterRender( // FIXME: from LEGO1/tgl/d3drm/view.cpp // FUNCTION: LEGO1 0x100a1240 +// FUNCTION: BETA10 0x10168dc9 void ViewportDestroyCallback(IDirect3DRMObject* pObject, void* pArg) { ViewportAppData* pViewportAppData = reinterpret_cast(pArg); + assert(static_cast(pObject)); + assert(pViewportAppData); - ViewRestoreFrameAfterRender( + Result result = ViewRestoreFrameAfterRender( pViewportAppData->m_pLastRenderedFrame, pViewportAppData->m_pCamera, pViewportAppData->m_pLightFrame ); + assert(Succeeded(result)); + delete pViewportAppData; } @@ -407,9 +443,9 @@ inline Result ViewRender(IDirect3DRMViewport* pViewport, const IDirect3DRMFrame2 pViewportAppData->m_backgroundColorGreen, pViewportAppData->m_backgroundColorBlue ); - } - assert(Succeeded(result)); + assert(Succeeded(result)); + } result = ResultVal(pViewport->Render(const_cast(pGroup))); assert(Succeeded(result)); diff --git a/LEGO1/tgl/tgl.h b/LEGO1/tgl/tgl.h index c519cf05..cd3fccae 100644 --- a/LEGO1/tgl/tgl.h +++ b/LEGO1/tgl/tgl.h @@ -186,7 +186,7 @@ class Device : public Object { // vtable+0x20 virtual Result Update() = 0; virtual void HandleActivate(WORD) = 0; - virtual void HandlePaint(HDC) = 0; + virtual void HandlePaint(void*) = 0; // SYNTHETIC: BETA10 0x1016b740 // Tgl::Device::Device @@ -400,7 +400,7 @@ class MeshBuilder : public Object { class Texture : public Object { public: // vtable+0x08 - virtual Result SetTexels(int width, int height, int bitsPerTexel, void* pTexels) = 0; + virtual Result SetTexels(int width, int height, int bitsPerTexel, void* pTexels, int pTexelsArePersistent) = 0; virtual void FillRowsOfTexture(int y, int height, void* pBuffer) = 0; // vtable+0x10 @@ -411,7 +411,7 @@ class Texture : public Object { int* pDepth, void** ppBuffer, int* pPaletteSize, - PaletteEntry** ppPalette + unsigned char (*pEntries)[3] ) = 0; virtual Result SetPalette(int entryCount, PaletteEntry* pEntries) = 0; diff --git a/LEGO1/viewmanager/viewlod.h b/LEGO1/viewmanager/viewlod.h index 7bf68b52..b7104526 100644 --- a/LEGO1/viewmanager/viewlod.h +++ b/LEGO1/viewmanager/viewlod.h @@ -14,10 +14,10 @@ class ViewLOD : public LODObject { public: enum { - c_bit4 = 0x10 + c_hasMesh = 0x10 }; - ViewLOD(Tgl::Renderer* pRenderer) : m_meshBuilder(NULL), m_unk0x08(3) {} + ViewLOD(Tgl::Renderer* pRenderer) : m_meshBuilder(NULL), m_flags(3) {} ~ViewLOD() override; // FUNCTION: LEGO1 0x100a6f30 @@ -28,19 +28,19 @@ class ViewLOD : public LODObject { Tgl::MeshBuilder* GetMeshBuilder() { return m_meshBuilder; } const Tgl::MeshBuilder* GetMeshBuilder() const { return m_meshBuilder; } - undefined4 GetUnknown0x08() { return m_unk0x08; } - unsigned char GetUnknown0x08Test4() { return m_unk0x08 & 0xffffff04; } - unsigned char GetUnknown0x08Test8() { return m_unk0x08 & 0xffffff08; } + unsigned int GetFlags() { return m_flags; } + unsigned char SkipReadingData() { return m_flags & 0xffffff04; } + unsigned char IsExtraLOD() { return m_flags & 0xffffff08; } - void SetFlag(unsigned char p_flag) { m_unk0x08 |= p_flag; } - void ClearFlag(unsigned char p_flag) { m_unk0x08 &= ~p_flag; } + void SetFlag(unsigned char p_flag) { m_flags |= p_flag; } + void ClearFlag(unsigned char p_flag) { m_flags &= ~p_flag; } // SYNTHETIC: LEGO1 0x100a6f60 // ViewLOD::`scalar deleting destructor' protected: Tgl::MeshBuilder* m_meshBuilder; // 0x04 - undefined4 m_unk0x08; // 0x08 + unsigned int m_flags; // 0x08 }; #endif // VIEWLOD_H diff --git a/LEGO1/viewmanager/viewlodlist.h b/LEGO1/viewmanager/viewlodlist.h index 60847caf..b7e0f9d3 100644 --- a/LEGO1/viewmanager/viewlodlist.h +++ b/LEGO1/viewmanager/viewlodlist.h @@ -127,8 +127,10 @@ class ViewLODListManager { // _Tree,map >::_Kfn,ROINameComparator,allocator >::~_Tree,map,map >::_Kfn,ROINameComparator,allocator >::erase +// ?erase@?$_Tree@PBDU?$pair@QBDPAVViewLODList@@@@U_Kfn@?$map@PBDPAVViewLODList@@UROINameComparator@@V?$allocator@PAVViewLODList@@@@@@UROINameComparator@@V?$allocator@PAVViewLODList@@@@@@QAE?AViterator@1@V21@0@Z // TEMPLATE: LEGO1 0x100a7db0 // TEMPLATE: BETA10 0x1017aca0 @@ -156,7 +158,7 @@ class ViewLODListManager { // map >::begin // TEMPLATE: BETA10 0x10179070 -// map >::end +// ?end@?$map@PBDPAVViewLODList@@UROINameComparator@@V?$allocator@PAVViewLODList@@@@@@QAE?AViterator@?$_Tree@PBDU?$pair@QBDPAVViewLODList@@@@U_Kfn@?$map@PBDPAVViewLODList@@UROINameComparator@@V?$allocator@PAVViewLODList@@@@@@UROINameComparator@@V?$allocator@ // TEMPLATE: BETA10 0x10179250 // pair::pair diff --git a/LEGO1/viewmanager/viewmanager.cpp b/LEGO1/viewmanager/viewmanager.cpp index 9c6b8434..27919424 100644 --- a/LEGO1/viewmanager/viewmanager.cpp +++ b/LEGO1/viewmanager/viewmanager.cpp @@ -25,7 +25,7 @@ float g_minLODThreshold = 0.00097656297; int g_maxLODLevels = 6; // GLOBAL: LEGO1 0x1010105c -float g_unk0x1010105c = 0.000125F; +float g_viewDistance = 0.000125F; // GLOBAL: LEGO1 0x10101060 float g_elapsedSeconds = 0; @@ -65,19 +65,19 @@ unsigned int ViewManager::IsBoundingBoxInFrustum(const BoundingBox& p_bounding_b { const Vector3* box[] = {&p_bounding_box.Min(), &p_bounding_box.Max()}; - float und[8][3]; + float box_corners[8][3]; int i, j, k; for (i = 0; i < 8; i++) { for (j = 0; j < 3; j++) { - und[i][j] = box[g_boundingBoxCornerMap[i][j]]->operator[](j); + box_corners[i][j] = box[g_boundingBoxCornerMap[i][j]]->operator[](j); } } for (i = 0; i < 6; i++) { for (k = 0; k < 8; k++) { - if (frustum_planes[i][0] * und[k][0] + frustum_planes[i][2] * und[k][2] + frustum_planes[i][1] * und[k][1] + - frustum_planes[i][3] >= + if (frustum_planes[i][0] * box_corners[k][0] + frustum_planes[i][2] * box_corners[k][2] + + frustum_planes[i][1] * box_corners[k][1] + frustum_planes[i][3] >= 0.0f) { break; } @@ -98,7 +98,7 @@ void ViewManager::Remove(ViewROI* p_roi) if (*it == p_roi) { rois.erase(it); - if (p_roi->GetUnknown0xe0() >= 0) { + if (p_roi->GetLodLevel() >= 0) { RemoveROIDetailFromScene(p_roi); } @@ -106,7 +106,7 @@ void ViewManager::Remove(ViewROI* p_roi) if (comp != NULL) { for (CompoundObject::const_iterator it = comp->begin(); !(it == comp->end()); it++) { - if (((ViewROI*) *it)->GetUnknown0xe0() >= 0) { + if (((ViewROI*) *it)->GetLodLevel() >= 0) { RemoveROIDetailFromScene((ViewROI*) *it); } } @@ -128,11 +128,11 @@ void ViewManager::RemoveAll(ViewROI* p_roi) rois.erase(rois.begin(), rois.end()); } else { - if (p_roi->GetUnknown0xe0() >= 0) { + if (p_roi->GetLodLevel() >= 0) { RemoveROIDetailFromScene(p_roi); } - p_roi->SetUnknown0xe0(-1); + p_roi->SetLodLevel(ViewROI::c_lodLevelUnset); const CompoundObject* comp = p_roi->GetComp(); if (comp != NULL) { @@ -146,15 +146,15 @@ void ViewManager::RemoveAll(ViewROI* p_roi) } // FUNCTION: LEGO1 0x100a65b0 -void ViewManager::UpdateROIDetailBasedOnLOD(ViewROI* p_roi, int p_und) +void ViewManager::UpdateROIDetailBasedOnLOD(ViewROI* p_roi, int p_lodLevel) { - if (p_roi->GetLODCount() <= p_und) { - p_und = p_roi->GetLODCount() - 1; + if (p_roi->GetLODCount() <= p_lodLevel) { + p_lodLevel = p_roi->GetLODCount() - 1; } - int unk0xe0 = p_roi->GetUnknown0xe0(); + int lodLevel = p_roi->GetLodLevel(); - if (unk0xe0 == p_und) { + if (lodLevel == p_lodLevel) { return; } @@ -162,16 +162,16 @@ void ViewManager::UpdateROIDetailBasedOnLOD(ViewROI* p_roi, int p_und) Tgl::MeshBuilder* meshBuilder; ViewLOD* lod; - if (unk0xe0 < 0) { - lod = (ViewLOD*) p_roi->GetLOD(p_und); + if (lodLevel < 0) { + lod = (ViewLOD*) p_roi->GetLOD(p_lodLevel); - if (lod->GetUnknown0x08() & ViewLOD::c_bit4) { + if (lod->GetFlags() & ViewLOD::c_hasMesh) { scene->Add((Tgl::MeshBuilder*) group); SetAppData(p_roi, reinterpret_cast(p_roi)); } } else { - lod = (ViewLOD*) p_roi->GetLOD(unk0xe0); + lod = (ViewLOD*) p_roi->GetLOD(lodLevel); if (lod != NULL) { meshBuilder = lod->GetMeshBuilder(); @@ -181,27 +181,27 @@ void ViewManager::UpdateROIDetailBasedOnLOD(ViewROI* p_roi, int p_und) } } - lod = (ViewLOD*) p_roi->GetLOD(p_und); + lod = (ViewLOD*) p_roi->GetLOD(p_lodLevel); } - if (lod->GetUnknown0x08() & ViewLOD::c_bit4) { + if (lod->GetFlags() & ViewLOD::c_hasMesh) { meshBuilder = lod->GetMeshBuilder(); if (meshBuilder != NULL) { group->Add(meshBuilder); SetAppData(p_roi, reinterpret_cast(p_roi)); - p_roi->SetUnknown0xe0(p_und); + p_roi->SetLodLevel(p_lodLevel); return; } } - p_roi->SetUnknown0xe0(-1); + p_roi->SetLodLevel(ViewROI::c_lodLevelUnset); } // FUNCTION: LEGO1 0x100a66a0 void ViewManager::RemoveROIDetailFromScene(ViewROI* p_roi) { - const ViewLOD* lod = (const ViewLOD*) p_roi->GetLOD(p_roi->GetUnknown0xe0()); + const ViewLOD* lod = (const ViewLOD*) p_roi->GetLOD(p_roi->GetLodLevel()); if (lod != NULL) { const Tgl::MeshBuilder* meshBuilder = NULL; @@ -216,58 +216,61 @@ void ViewManager::RemoveROIDetailFromScene(ViewROI* p_roi) scene->Remove(roiGeometry); } - p_roi->SetUnknown0xe0(-1); + p_roi->SetLodLevel(ViewROI::c_lodLevelUnset); } // FUNCTION: LEGO1 0x100a66f0 -inline void ViewManager::ManageVisibilityAndDetailRecursively(ViewROI* p_roi, int p_und) +// FUNCTION: BETA10 0x1017297f +inline void ViewManager::ManageVisibilityAndDetailRecursively(ViewROI* p_from, int p_lodLevel) { - if (!p_roi->GetVisibility() && p_und != -2) { - ManageVisibilityAndDetailRecursively(p_roi, -2); + assert(p_from); + + if (!p_from->GetVisibility() && p_lodLevel != ViewROI::c_lodLevelInvisible) { + ManageVisibilityAndDetailRecursively(p_from, ViewROI::c_lodLevelInvisible); } else { - const CompoundObject* comp = p_roi->GetComp(); + const CompoundObject* comp = p_from->GetComp(); - if (p_und == -1) { - if (p_roi->GetWorldBoundingSphere().Radius() > 0.001F) { - float und = ProjectedSize(p_roi->GetWorldBoundingSphere()); + if (p_lodLevel == ViewROI::c_lodLevelUnset) { + if (p_from->GetWorldBoundingSphere().Radius() > 0.001F) { + float projectedSize = ProjectedSize(p_from->GetWorldBoundingSphere()); - if (und < seconds_allowed * g_unk0x1010105c) { - if (p_roi->GetUnknown0xe0() == -2) { - return; + if (projectedSize < seconds_allowed * g_viewDistance) { + if (p_from->GetLodLevel() != ViewROI::c_lodLevelInvisible) { + ManageVisibilityAndDetailRecursively(p_from, ViewROI::c_lodLevelInvisible); } - ManageVisibilityAndDetailRecursively(p_roi, -2); return; } - - p_und = CalculateLODLevel(und, RealtimeView::GetUserMaxLodPower() * seconds_allowed, p_roi); + else { + p_lodLevel = + CalculateLODLevel(projectedSize, RealtimeView::GetUserMaxLodPower() * seconds_allowed, p_from); + } } } - if (p_und == -2) { - if (p_roi->GetUnknown0xe0() >= 0) { - RemoveROIDetailFromScene(p_roi); - p_roi->SetUnknown0xe0(-2); + if (p_lodLevel == ViewROI::c_lodLevelInvisible) { + if (p_from->GetLodLevel() >= 0) { + RemoveROIDetailFromScene(p_from); + p_from->SetLodLevel(ViewROI::c_lodLevelInvisible); } if (comp != NULL) { - for (CompoundObject::const_iterator it = comp->begin(); !(it == comp->end()); it++) { - ManageVisibilityAndDetailRecursively((ViewROI*) *it, p_und); + for (CompoundObject::const_iterator it = comp->begin(); it != comp->end(); it++) { + ManageVisibilityAndDetailRecursively((ViewROI*) *it, p_lodLevel); } } } else if (comp == NULL) { - if (p_roi->GetLODs() != NULL && p_roi->GetLODCount() > 0) { - UpdateROIDetailBasedOnLOD(p_roi, p_und); - return; + if (p_from->GetLODs() != NULL && p_from->GetLODCount() > 0) { + UpdateROIDetailBasedOnLOD(p_from, p_lodLevel); } } else { - p_roi->SetUnknown0xe0(-1); + p_from->SetLodLevel(ViewROI::c_lodLevelUnset); - for (CompoundObject::const_iterator it = comp->begin(); !(it == comp->end()); it++) { - ManageVisibilityAndDetailRecursively((ViewROI*) *it, p_und); + for (CompoundObject::const_iterator it = comp->begin(); it != comp->end(); it++) { + ManageVisibilityAndDetailRecursively((ViewROI*) *it, p_lodLevel); } } } @@ -290,7 +293,7 @@ void ViewManager::Update(float p_previousRenderTime, float) } for (CompoundObject::iterator it = rois.begin(); it != rois.end(); it++) { - ManageVisibilityAndDetailRecursively((ViewROI*) *it, -1); + ManageVisibilityAndDetailRecursively((ViewROI*) *it, ViewROI::c_lodLevelUnset); } stopWatch.Stop(); @@ -306,7 +309,7 @@ inline int ViewManager::CalculateFrustumTransformations() } else { float fVar7 = tan(view_angle / 2.0F); - view_area_at_one = view_angle * view_angle * 4.0F; + view_area_at_one = fVar7 * fVar7 * 4.0F; float fVar1 = front * fVar7; float fVar2 = (width / height) * fVar1; @@ -350,53 +353,63 @@ inline int ViewManager::CalculateFrustumTransformations() } } -inline int ViewManager::CalculateLODLevel(float p_und1, float p_und2, ViewROI* p_roi) +// FUNCTION: BETA10 0x10172be5 +inline int ViewManager::CalculateLODLevel(float p_maximumScale, float p_initialScale, ViewROI* from) { - int result; - float i; + int lodLevel; - if (IsROIVisibleAtLOD(p_roi) != 0) { - if (p_und1 < g_minLODThreshold) { + assert(from); + + if (GetFirstLODIndex(from) != 0) { + if (p_maximumScale < g_minLODThreshold) { return 0; } - - result = 1; + else { + lodLevel = 1; + } } else { - result = 0; + lodLevel = 0; } - for (i = p_und2; result < g_maxLODLevels && p_und1 >= i; i *= g_LODScaleFactor) { - result++; + for (float i = p_initialScale; lodLevel < g_maxLODLevels; lodLevel++) { + if (i >= p_maximumScale) { + break; + } + + i *= g_LODScaleFactor; } - return result; + return lodLevel; } -inline int ViewManager::IsROIVisibleAtLOD(ViewROI* p_roi) +// FUNCTION: BETA10 0x10172cb0 +inline int ViewManager::GetFirstLODIndex(ViewROI* p_roi) { const LODListBase* lods = p_roi->GetLODs(); if (lods != NULL && lods->Size() > 0) { - if (((ViewLOD*) p_roi->GetLOD(0))->GetUnknown0x08Test8()) { + if (((ViewLOD*) p_roi->GetLOD(0))->IsExtraLOD()) { return 1; } - - return 0; + else { + return 0; + } } const CompoundObject* comp = p_roi->GetComp(); if (comp != NULL) { - for (CompoundObject::const_iterator it = comp->begin(); !(it == comp->end()); it++) { + for (CompoundObject::const_iterator it = comp->begin(); it != comp->end(); it++) { const LODListBase* lods = ((ViewROI*) *it)->GetLODs(); if (lods != NULL && lods->Size() > 0) { - if (((ViewLOD*) ((ViewROI*) *it)->GetLOD(0))->GetUnknown0x08Test8()) { + if (((ViewLOD*) ((ViewROI*) *it)->GetLOD(0))->IsExtraLOD()) { return 1; } - - return 0; + else { + return 0; + } } } } @@ -480,7 +493,7 @@ float ViewManager::ProjectedSize(const BoundingSphere& p_bounding_sphere) // is then the ratio of the area of that projected circle to the view surface area // at Z == 1.0. // - float sphere_projected_area = 3.14159265359 * (p_bounding_sphere.Radius() * p_bounding_sphere.Radius()); + float sphere_projected_area = 3.14159265359 * p_bounding_sphere.Radius() * p_bounding_sphere.Radius(); float square_dist_to_sphere = DISTSQRD3(p_bounding_sphere.Center(), pov[3]); return sphere_projected_area / view_area_at_one / square_dist_to_sphere; } diff --git a/LEGO1/viewmanager/viewmanager.h b/LEGO1/viewmanager/viewmanager.h index cda8d480..1f12cb28 100644 --- a/LEGO1/viewmanager/viewmanager.h +++ b/LEGO1/viewmanager/viewmanager.h @@ -24,20 +24,20 @@ class ViewManager { void Remove(ViewROI* p_roi); void RemoveAll(ViewROI* p_roi); unsigned int IsBoundingBoxInFrustum(const BoundingBox& p_bounding_box); - void UpdateROIDetailBasedOnLOD(ViewROI* p_roi, int p_und); + void UpdateROIDetailBasedOnLOD(ViewROI* p_roi, int p_lodLevel); void RemoveROIDetailFromScene(ViewROI* p_roi); void SetPOVSource(const OrientableROI* point_of_view); float ProjectedSize(const BoundingSphere& p_bounding_sphere); ViewROI* Pick(Tgl::View* p_view, unsigned long x, unsigned long y); void SetResolution(int width, int height); void SetFrustrum(float fov, float front, float back); - inline void ManageVisibilityAndDetailRecursively(ViewROI* p_roi, int p_und); + inline void ManageVisibilityAndDetailRecursively(ViewROI* p_from, int p_lodLevel); void Update(float p_previousRenderTime, float); inline int CalculateFrustumTransformations(); void UpdateViewTransformations(); - inline static int CalculateLODLevel(float p_und1, float p_und2, ViewROI* p_roi); - inline static int IsROIVisibleAtLOD(ViewROI* p_roi); + inline static int CalculateLODLevel(float p_maximumScale, float p_initalScale, ViewROI* from); + inline static int GetFirstLODIndex(ViewROI* p_roi); // FUNCTION: BETA10 0x100576b0 const CompoundObject& GetROIs() { return rois; } diff --git a/LEGO1/viewmanager/viewroi.cpp b/LEGO1/viewmanager/viewroi.cpp index 8d8cbb6b..05f636b6 100644 --- a/LEGO1/viewmanager/viewroi.cpp +++ b/LEGO1/viewmanager/viewroi.cpp @@ -7,7 +7,7 @@ DECOMP_SIZE_ASSERT(ViewROI, 0xe4) // GLOBAL: LEGO1 0x101013d8 -undefined g_unk101013d8 = 0; +unsigned char g_lightSupport = FALSE; // FUNCTION: LEGO1 0x100a9eb0 float ViewROI::IntrinsicImportance() const @@ -16,71 +16,66 @@ float ViewROI::IntrinsicImportance() const } // for now // FUNCTION: LEGO1 0x100a9ec0 +// FUNCTION: BETA10 0x1018c740 Tgl::Group* ViewROI::GetGeometry() { return geometry; } // FUNCTION: LEGO1 0x100a9ed0 +// FUNCTION: BETA10 0x1018c760 const Tgl::Group* ViewROI::GetGeometry() const { return geometry; } // FUNCTION: LEGO1 0x100a9ee0 -void ViewROI::UpdateWorldData(const Matrix4& parent2world) +// FUNCTION: BETA10 0x1018c780 +void ViewROI::UpdateWorldDataWithTransformAndChildren(const Matrix4& parent2world) { - OrientableROI::UpdateWorldData(parent2world); + OrientableROI::UpdateWorldDataWithTransformAndChildren(parent2world); + SetGeometryTransformation(); +} +// FUNCTION: BETA10 0x1018c7b0 +inline void ViewROI::SetGeometryTransformation() +{ if (geometry) { Tgl::FloatMatrix4 matrix; Matrix4 in(matrix); SETMAT4(in, m_local2world); - Tgl::Result result = geometry->SetTransformation(matrix); - // assert(Tgl::Succeeded(result)); + geometry->SetTransformation(matrix); } } // FUNCTION: LEGO1 0x100a9fc0 -void ViewROI::VTable0x24(const Matrix4& p_transform) +// FUNCTION: BETA10 0x1018cad0 +void ViewROI::UpdateWorldDataWithTransform(const Matrix4& p_transform) { - OrientableROI::VTable0x24(p_transform); - if (geometry) { - Tgl::FloatMatrix4 matrix; - Matrix4 in(matrix); - SETMAT4(in, m_local2world); - geometry->SetTransformation(matrix); - } + OrientableROI::UpdateWorldDataWithTransform(p_transform); + SetGeometryTransformation(); } // FUNCTION: LEGO1 0x100aa0a0 -void ViewROI::SetLocalTransform(const Matrix4& p_transform) +// FUNCTION: BETA10 0x1018cb00 +void ViewROI::SetLocal2WorldWithWorldDataUpdate(const Matrix4& p_transform) { - OrientableROI::SetLocalTransform(p_transform); - if (geometry) { - Tgl::FloatMatrix4 matrix; - Matrix4 in(matrix); - SETMAT4(in, m_local2world); - geometry->SetTransformation(matrix); - } + OrientableROI::SetLocal2WorldWithWorldDataUpdate(p_transform); + SetGeometryTransformation(); } // FUNCTION: LEGO1 0x100aa180 -void ViewROI::VTable0x1c() +// FUNCTION: BETA10 0x1018cb30 +void ViewROI::UpdateWorldData() { - OrientableROI::VTable0x1c(); - if (geometry) { - Tgl::FloatMatrix4 matrix; - Matrix4 in(matrix); - SETMAT4(in, m_local2world); - geometry->SetTransformation(matrix); - } + OrientableROI::UpdateWorldData(); + SetGeometryTransformation(); } // FUNCTION: LEGO1 0x100aa500 -undefined ViewROI::SetUnk101013d8(undefined p_flag) +unsigned char ViewROI::SetLightSupport(unsigned char p_lightSupport) { - undefined oldFlag = g_unk101013d8; - g_unk101013d8 = p_flag; + unsigned char oldFlag = g_lightSupport; + g_lightSupport = p_lightSupport; return oldFlag; } diff --git a/LEGO1/viewmanager/viewroi.h b/LEGO1/viewmanager/viewroi.h index 444e18f0..b7ba9564 100644 --- a/LEGO1/viewmanager/viewroi.h +++ b/LEGO1/viewmanager/viewroi.h @@ -13,17 +13,25 @@ */ // VTABLE: LEGO1 0x100dbe70 +// VTABLE: BETA10 0x101c3908 // SIZE 0xe4 class ViewROI : public OrientableROI { public: + enum { + c_lodLevelUnset = -1, + c_lodLevelInvisible = -2, + }; + + // FUNCTION: BETA10 0x1018c5e0 ViewROI(Tgl::Renderer* pRenderer, ViewLODList* lodList) { SetLODList(lodList); geometry = pRenderer->CreateGroup(); - m_unk0xe0 = -1; + m_lodLevel = c_lodLevelUnset; } // FUNCTION: LEGO1 0x100a9e20 + // FUNCTION: BETA10 0x1018c680 ~ViewROI() override { // SetLODList() will decrease refCount of LODList @@ -31,6 +39,7 @@ class ViewROI : public OrientableROI { delete geometry; } + // FUNCTION: BETA10 0x1007b540 void SetLODList(ViewLODList* lodList) { // ??? inherently type unsafe - kind of... because, now, ROI @@ -49,23 +58,25 @@ class ViewROI : public OrientableROI { } } - float IntrinsicImportance() const override; // vtable+0x04 - void VTable0x1c() override; // vtable+0x1c - void SetLocalTransform(const Matrix4& p_transform) override; // vtable+0x20 - void VTable0x24(const Matrix4& p_transform) override; // vtable+0x24 - virtual Tgl::Group* GetGeometry(); // vtable+0x30 - virtual const Tgl::Group* GetGeometry() const; // vtable+0x34 + float IntrinsicImportance() const override; // vtable+0x04 + void UpdateWorldData() override; // vtable+0x1c + void SetLocal2WorldWithWorldDataUpdate(const Matrix4& p_transform) override; // vtable+0x20 + void UpdateWorldDataWithTransform(const Matrix4& p_transform) override; // vtable+0x24 + virtual Tgl::Group* GetGeometry(); // vtable+0x30 + virtual const Tgl::Group* GetGeometry() const; // vtable+0x34 - int GetUnknown0xe0() { return m_unk0xe0; } - void SetUnknown0xe0(int p_unk0xe0) { m_unk0xe0 = p_unk0xe0; } + int GetLodLevel() { return m_lodLevel; } + void SetLodLevel(int p_lodLevel) { m_lodLevel = p_lodLevel; } - static undefined SetUnk101013d8(undefined p_flag); + static unsigned char SetLightSupport(unsigned char p_lightSupport); protected: - void UpdateWorldData(const Matrix4& parent2world) override; // vtable+0x28 + void UpdateWorldDataWithTransformAndChildren(const Matrix4& parent2world) override; // vtable+0x28 + + void SetGeometryTransformation(); Tgl::Group* geometry; // 0xdc - int m_unk0xe0; // 0xe0 + int m_lodLevel; // 0xe0 }; // SYNTHETIC: LEGO1 0x100aa250 diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..0a041280 --- /dev/null +++ b/LICENSE @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/README.md b/README.md index c24dc4ef..6d62e581 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ # LEGO Island Decompilation -[Development Vlog](https://www.youtube.com/playlist?list=PLbpl-gZkNl2COf_bB6cfgTapD5WduAfPz) | [Contributing](/CONTRIBUTING.md) | [Matrix](https://matrix.to/#/#isledecomp:matrix.org) | [Forums](https://forum.mattkc.com/viewforum.php?f=1) | [Patreon](https://www.patreon.com/mattkc) +[Development Vlog](https://www.youtube.com/playlist?list=PLbpl-gZkNl2Db4xcAsT_xOfOwRk-2DPHL) | [Contributing](/CONTRIBUTING.md) | [Matrix](https://matrix.to/#/#isledecomp:matrix.org) | [Forums](https://forum.mattkc.com/viewforum.php?f=1) | [Patreon](https://www.patreon.com/mattkc) This is a functionally complete decompilation of LEGO Island (Version 1.1, English). It aims to be as accurate as possible, matching the recompiled instructions to the original machine code as much as possible. The goal is to provide a workable codebase that can be modified, improved, and ported to other platforms later on. +> **Note:** This repository is for decompilation only and its code is true to the original release. It will not compile for targets other than 32-bit Windows. For a modern adaptation of the LEGO Island codebase with native compatibility for all major platforms and the Web, see [isle-portable](https://github.com/isledecomp/isle-portable) instead. + ## Status @@ -37,6 +39,7 @@ You will need the following software installed: cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo ``` - **Visual C++ 4.2 has issues with paths containing spaces**. If you get configure or build errors, make sure neither CMake, the repository, nor Visual C++ 4.2 is in a path that contains spaces. + - Be aware that long file paths (e.g., `C:\Users\LongUserName\LongerFolderName\isle`) may be truncated by `make`, resulting in “File not found” errors. - Replace `` with the source repository. This can be `..` if your build folder is inside the source repository. - `RelWithDebInfo` is recommended because it will produce debug symbols useful for further decompilation work. However, you can change this to `Release` if you don't need them. While `Debug` builds can be compiled and used, they are not recommended as the primary goal is to match the code to the original binary. This is because the retail binaries were compiled as `Release` builds. - `NMake Makefiles` is most recommended because it will be immediately compatible with Visual C++ 4.2. For faster builds, you can use `Ninja` (if you have it installed), however due to limitations in Visual C++ 4.2, you can only build `Release` builds this way (debug symbols cannot be generated with `Ninja`). diff --git a/docker/Dockerfile b/docker/Dockerfile index 8fbe4130..b9c5ff56 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:latest +FROM docker.io/library/debian:stable-slim # Gather dependencies RUN dpkg --add-architecture i386 diff --git a/reccmp-project.yml b/reccmp-project.yml index b433ce46..fd9a2ef1 100644 --- a/reccmp-project.yml +++ b/reccmp-project.yml @@ -38,3 +38,8 @@ targets: - 0x100fb080 # memset etc. - 0x100f9570 + ALPHA: + filename: ALPHA.DLL + source-root: LEGO1 + hash: + sha256: dc7e5ed8ec9d96851126a40c4d23755f1783a8df61def44c667dfaa992ac509e diff --git a/tools/README.md b/tools/README.md index 84c2a96a..0d75e48e 100644 --- a/tools/README.md +++ b/tools/README.md @@ -2,202 +2,15 @@ Accuracy to the game's original code is the main goal of this project. To facilitate the decompilation effort and maintain overall quality, we have devised a set of annotations, to be embedded in the source code, which allow us to automatically verify the accuracy of re-compiled functions' assembly, virtual tables, variable offsets and more. -In order for contributions to be accepted, the annotations must be used in accordance to the rules outlined here. Proper use is enforced by [GitHub Actions](/.github/workflows) which run the Python tools found in this folder. It is recommended to integrate these tools into your local development workflow as well. +The tooling we have developed has been moved to the [reccmp](https://github.com/isledecomp/reccmp) repo to facilitate its use in other decompilation projects. +* See the [README](https://github.com/isledecomp/reccmp?tab=readme-ov-file#getting-started) on how to get started. +* Familiarize yourself with the available [annotations](https://github.com/isledecomp/reccmp/blob/master/docs/annotations.md) and the [best practices](https://github.com/isledecomp/reccmp/blob/master/docs/recommendations.md) we have established. -# Overview - -We are continually working on extending the capabilities of our "decompilation language" and the toolset around it. Some of the following annotations have not made it into formal verification and thus are not technically enforced on the source code level yet (marked as **WIP**). Nevertheless, it is recommended to use them since it is highly likely they will eventually be fully integrated. - -## Functions - -All non-inlined functions in the code base with the exception of [3rd party code](/3rdparty) must be annotated with one of the following markers, which include the module name and address of the function as found in the original binaries. This information is then used to compare the recompiled assembly with the original assembly, resulting in an accuracy score. Functions in a given compilation unit must be ordered by their address in ascending order. - -The annotations can be attached to the function implementation, which is the most common case, or use the "comment" syntax (see examples below) for functions that cannot be referred to directly (such as templated, synthetic or non-inlined inline functions). The latter should only ever appear in `.h` files. - -### `FUNCTION` - -Functions with a reasonably complete implementation which are not templated or synthetic (see below) should be annotated with `FUNCTION`. - -``` -// FUNCTION: LEGO1 0x100b12c0 -MxCore* MxObjectFactory::Create(const char* p_name) -{ - // implementation -} - -// FUNCTION: LEGO1 0x100140d0 -// MxCore::IsA -``` - -### `STUB` - -Functions with no or a very incomplete implementation should be annotated with `STUB`. These will not be compared to the original assembly. - -``` -// STUB: LEGO1 0x10011d50 -LegoCameraController::LegoCameraController() -{ - // TODO -} -``` - -### `TEMPLATE` - -Templated functions should be annotated with `TEMPLATE`. Since the goal is to eventually have a full accounting of all the functions present in the binaries, please make an effort to find and annotate every function of a templated class. - -``` -// TEMPLATE: LEGO1 0x100c0ee0 -// list >::_Buynode - -// TEMPLATE: LEGO1 0x100c0fc0 -// MxStreamListMxDSSubscriber::~MxStreamListMxDSSubscriber - -// TEMPLATE: LEGO1 0x100c1010 -// MxStreamListMxDSAction::~MxStreamListMxDSAction -``` - -### `SYNTHETIC` - -Synthetic functions should be annotated with `SYNTHETIC`. A synthetic function is generated by the compiler; most common is the "scalar deleting destructor" found in virtual tables. Other cases include default destructors and assignment operators. Note: `SYNTHETIC` takes precedence over `TEMPLATE`. - -``` -// SYNTHETIC: LEGO1 0x10003210 -// Helicopter::`scalar deleting destructor' - -// SYNTHETIC: LEGO1 0x100c4f50 -// MxCollection::`scalar deleting destructor' - -// SYNTHETIC: LEGO1 0x100c4fc0 -// MxList::`scalar deleting destructor' -``` - -### `LIBRARY` - -Functions located in 3rd party libraries should be annotated with `LIBRARY`. Since the goal is to eventually have a full accounting of all the functions present in the binaries, please make an effort to find and annotate every function of every statically linked library, including the MSVC standard libraries. - -``` -// LIBRARY: ISLE 0x4061b0 -// _MemPoolInit@4 - -// LIBRARY: ISLE 0x406520 -// _MemPoolSetPageSize@8 - -// LIBRARY: ISLE 0x406630 -// _MemPoolSetBlockSizeFS@8 -``` - -## Virtual tables - -Classes with a virtual table should be annotated using the `VTABLE` marker, which includes the module name and address of the virtual table. Additionally, virtual function declarations should be annotated with a comment indicating their relative offset. Please use the following example as a reference. - -``` -// VTABLE: LEGO1 0x100dc900 -class MxEventManager : public MxMediaManager { -public: - MxEventManager(); - virtual ~MxEventManager() override; - - virtual void Destroy() override; // vtable+0x18 - virtual MxResult Create(MxU32 p_frequencyMS, MxBool p_createThread); // vtable+0x28 -``` - -## Class size - -Classes should be annotated using the `SIZE` marker to indicate their size. If you are unsure about the class size in the original binary, please use the currently available information (known member variables) and detail the circumstances in an extra comment if necessary. - -``` -// SIZE 0x1c -class MxCriticalSection { -public: - MxCriticalSection(); - ~MxCriticalSection(); - static void SetDoMutex(); -``` - -Furthermore, add `DECOMP_SIZE_ASSERT(MxCriticalSection, 0x1c)` to the respective `.cpp` file (if the class has no dedicated `.cpp` file, use any appropriate `.cpp` file where the class is used). - -## Member variables - -Member variables should be annotated with their relative offsets. - -``` -class MxDSObject : public MxCore { -private: - MxU32 m_sizeOnDisk; // 0x8 - MxU16 m_type; // 0xc - char* m_sourceName; // 0x10 - undefined4 m_unk0x14; // 0x14 -``` - -## Global variables - -Global variables should be annotated using the `GLOBAL` marker, which includes the module name and address of the variable. - -``` -// GLOBAL: LEGO1 0x100f456c -MxAtomId* g_jukeboxScript = NULL; - -// GLOBAL: LEGO1 0x100f4570 -MxAtomId* g_pz5Script = NULL; - -// GLOBAL: LEGO1 0x100f4574 -MxAtomId* g_introScript = NULL; -``` - -## Strings - -String values should be annotated using the `STRING` marker, which includes the module name and address of the string. - -``` -inline virtual const char* ClassName() const override // vtable+0x0c -{ - // STRING: LEGO1 0x100f03fc - return "Act2PoliceStation"; -} -``` - -# Tooling - -Use `pip` to install the required packages to be able to use the Python tools found in this folder: - -```sh -pip install -r tools/requirements.txt -``` - -Run the following command to allow reccmp to detect the original LEGO binaries: - -```sh -reccmp-project detect --what original --search-path -``` - -After building recompiled binaries, run the following command in this repository's root: - -```sh -reccmp-project detect --what recompiled --search-path -``` - -The example usages below assume that the current working directory is this repository's root and that the retail binaries have been copied to `./legobin`. - -* `reccmp-decomplint`: Checks the decompilation annotations (see above) - * e.g. `reccmp-decomplint --module LEGO1 LEGO1` -* [`ncc`](/tools/ncc): Checks naming conventions based on a set of rules -* `reccmp-reccmp`: Compares an original binary with a recompiled binary, provided a PDB file. For example: - * Display the diff for a single function: `py -m tools.reccmp.reccmp --verbose 0x100ae1a0 legobin/LEGO1.DLL build/LEGO1.DLL build/LEGO1.PDB .` - * Generate an HTML report: `py -m tools.reccmp.reccmp --html output.html legobin/LEGO1.DLL build/LEGO1.DLL build/LEGO1.PDB .` - * Create a base file for diffs: `py -m tools.reccmp.reccmp --json base.json --silent legobin/LEGO1.DLL build/LEGO1.DLL build/LEGO1.PDB .` - * Diff against a base file: `py -m tools.reccmp.reccmp --diff base.json legobin/LEGO1.DLL build/LEGO1.DLL build/LEGO1.PDB .` -* `reccmp-stackcmp`: Compares the stack layout for a given function that almost matches. - * e.g. `reccmp-stackcmp legobin/BETA10.DLL build_debug/LEGO1.DLL build_debug/LEGO1.pdb . 0x1007165d` -* `reccmp-roadmap`: Compares symbol locations in an original binary with the same symbol locations of a recompiled binary -* `reccmp-verexp`: Verifies exports by comparing the exports of the original DLL and the recompiled DLL -* `reccmp-vtable`: Asserts virtual table correctness by comparing a recompiled binary with the original - * e.g. `reccmp-vtable legobin/LEGO1.DLL build/LEGO1.DLL build/LEGO1.PDB .` -* `reccmp-datacmp`: Compares global data found in the original with the recompiled version - * e.g. `reccmp-datacmp legobin/LEGO1.DLL build/LEGO1.DLL build/LEGO1.PDB .` -* [`patch_c2.py`](/tools/patch_c2.py): Patches `C2.EXE` (part of MSVC 4.20) to get rid of a bugged warning +The following scripts are specific to LEGO Island and have thus remained here: +* [`patch_c2.py`](/tools/patch_c2.py): Patches `C2.EXE` (part of MSVC 4.20) to get rid of a bugged warning. # Modules -The following is a list of all the modules found in the annotations (e.g. `// FUNCTION: [module] [address]`) and which binaries they refer to. See [this list of all known versions of the game](https://www.legoisland.org/wiki/LEGO_Island#Download). +The following is a list of all the modules found in the annotations (e.g. `// FUNCTION: [module] [address]`) and which binaries they refer to. See also [this list of all known versions of the game](https://www.legoisland.org/wiki/LEGO_Island#Download). ## Retail v1.1.0.0 (v1.1) * `LEGO1` -> `LEGO1.DLL` @@ -219,23 +32,28 @@ It is therefore advisable to search for the corresponding function in `BETA10` w Unfortunately, some code has been changed after this beta version was created. Therefore, we are not aiming for a perfect binary match of `BETA10`. In case of discrepancies, `LEGO1` (as defined above) is our "gold standard" for matching. -### Re-compiling a beta build (**WIP**) +## Pre-Alpha + +* `ALPHA` -> `LEGO1D.DLL` + +This debug build is hardly used since it has little benefit over `BETA10`. + + +# Re-compiling a beta build If you want to match the code against `BETA10`, use the following `cmake` setup to create a debug build: ``` -cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_BUILD_TYPE=Debug -DISLE_USE_SMARTHEAP=OFF +cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_BUILD_TYPE=Debug -DISLE_USE_SMARTHEAP=OFF -DISLE_BUILD_BETA10=ON -DISLE_BUILD_LEGO1=OFF ``` -**TODO**: If you can figure out how to make a debug build with SmartHeap enabled, please add it here. -If you want to run scripts to compare your debug build to `BETA10` (e.g. `reccmp-reccmp`), it is advisable to add a copy of `LEGO1D.DLL` to `/legobin` and rename it to `BETA10.DLL`. +If you can figure out how to make a debug build with SmartHeap enabled, please add it here. -### Finding matching functions +If you want to run scripts to compare your debug build to `BETA10` (e.g. `reccmp-reccmp`), it is advisable to add a copy of `LEGO1D.DLL` from Beta 1.0 to `/legobin` and rename it to `BETA10.DLL`. Analogously, you can add `LEGO1D.DLL` from the Pre-Alpha and rename it to `ALPHA.DLL`. + +# Finding matching functions This is not a recipe, but rather a list of things you can try. * If you are working on a virtual function in a class, try to find the class' vtable. Many (but not all) classes implement `ClassName()`. These functions are usually easy to find by searching the memory for the string consisting of the class name. Keep in mind that not all child classes overwrite this function, so if the function you found is used in multiple vtables (or if you found multiple `ClassName()`-like functions), make sure you actually have the parent's vtable. * If that does not help, you can try to walk up the call tree and try to locate a function that calls the function you are interested in. * Assertions can also help you - most `.cpp` file names have already been matched based on `BETA10`, so you can search for the name of your `.cpp` file and check all the assertions in that file. While that does not find all functions in a given source file, it usually finds the more complex ones. * _If you have found any other strategies, please add them here._ - -## Others (**WIP**) -* `ALPHA` (only used twice)