Nope did not work i will clang-format later

This commit is contained in:
Lyelye150 2025-10-18 16:40:03 -04:00
parent b06f05ccf9
commit 648637a866
109 changed files with 2594 additions and 1247 deletions

View File

@ -46,6 +46,7 @@ jobs:
- { name: 'iOS', os: 'macos-15', generator: 'Xcode', dx5: false, config: false, brew: true, werror: true, clang-tidy: false, cmake-args: '-DCMAKE_SYSTEM_NAME=iOS', ios: true } - { name: 'iOS', os: 'macos-15', generator: 'Xcode', dx5: false, config: false, brew: true, werror: true, clang-tidy: false, cmake-args: '-DCMAKE_SYSTEM_NAME=iOS', ios: true }
- { name: 'Emscripten', os: 'ubuntu-latest', generator: 'Ninja', dx5: false, config: false, emsdk: true, werror: true, clang-tidy: false, cmake-wrapper: 'emcmake' } - { name: 'Emscripten', os: 'ubuntu-latest', generator: 'Ninja', dx5: false, config: false, emsdk: true, werror: true, clang-tidy: false, cmake-wrapper: 'emcmake' }
- { name: 'Nintendo 3DS', os: 'ubuntu-latest', generator: 'Ninja', dx5: false, config: false, n3ds: true, werror: true, clang-tidy: false, container: 'devkitpro/devkitarm:latest', cmake-args: '-DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/3DS.cmake' } - { name: 'Nintendo 3DS', os: 'ubuntu-latest', generator: 'Ninja', dx5: false, config: false, n3ds: true, werror: true, clang-tidy: false, container: 'devkitpro/devkitarm:latest', cmake-args: '-DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/3DS.cmake' }
- { name: 'Nintendo Wii U', os: 'ubuntu-latest', generator: 'Ninja', dx5: false, config: false, wiiu: true, werror: false, clang-tidy: false, container: 'devkitpro/devkitppc:latest', cmake-args: '-DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/WiiU.cmake' }
- { name: 'Xbox One', os: 'windows-latest', generator: 'Visual Studio 17 2022', dx5: false, config: false, msvc: true, werror: false, clang-tidy: false, vc-arch: 'amd64', cmake-args: '-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.26100.0', xbox-one: true} - { name: 'Xbox One', os: 'windows-latest', generator: 'Visual Studio 17 2022', dx5: false, config: false, msvc: true, werror: false, clang-tidy: false, vc-arch: 'amd64', cmake-args: '-DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.26100.0', xbox-one: true}
- { name: 'Android', os: 'ubuntu-latest', generator: 'Ninja', dx5: false, config: false, android: true, werror: true, clang-tidy: false,} - { name: 'Android', os: 'ubuntu-latest', generator: 'Ninja', dx5: false, config: false, android: true, werror: true, clang-tidy: false,}
steps: steps:
@ -66,6 +67,7 @@ jobs:
${{ matrix.msys-env }}-ninja ${{ matrix.msys-env }}-ninja
${{ matrix.msys-env }}-clang-tools-extra ${{ matrix.msys-env }}-clang-tools-extra
${{ (matrix.config && format('{0}-qt6-base', matrix.msys-env)) || '' }} ${{ (matrix.config && format('{0}-qt6-base', matrix.msys-env)) || '' }}
- name: Install Qt - name: Install Qt
if: ${{ !!matrix.msvc && matrix.config }} if: ${{ !!matrix.msvc && matrix.config }}
uses: jurplel/install-qt-action@v4 uses: jurplel/install-qt-action@v4
@ -104,12 +106,6 @@ jobs:
with: with:
xcode-version: latest-stable xcode-version: latest-stable
- name: Install iOS components
if: ${{ matrix.ios }}
run: |
xcrun simctl list > /dev/null
xcodebuild -downloadPlatform iOS
- name: Setup Emscripten - name: Setup Emscripten
uses: mymindstorm/setup-emsdk@master uses: mymindstorm/setup-emsdk@master
if: ${{ matrix.emsdk }} if: ${{ matrix.emsdk }}
@ -177,7 +173,7 @@ jobs:
run: cmake --build build --verbose --config Release run: cmake --build build --verbose --config Release
- name: Package (CPack) - name: Package (CPack)
if: ${{ !matrix.n3ds && !matrix.android }} if: ${{ !matrix.n3ds && !matrix.android && !matrix.wiiu }}
run: | run: |
cd build cd build
success=0 success=0
@ -226,6 +222,16 @@ jobs:
mv *.3dsx dist/ mv *.3dsx dist/
mv *.cia dist/ mv *.cia dist/
- name: Package (Wii U)
if: ${{ matrix.wiiu }}
run: |
cd build
mkdir dist
mv *.rpx ../isle-portable/packaging/wiiu/
mv ../isle-portable/packaging/wiiu/ dist/
cd dist
mv wiiu isle-U
- name: Package (Android) - name: Package (Android)
if: ${{ matrix.android }} if: ${{ matrix.android }}
run: | run: |
@ -242,6 +248,7 @@ jobs:
name: '${{ matrix.name }}' name: '${{ matrix.name }}'
path: | path: |
build/dist/isle-* build/dist/isle-*
build/dist/isle-U-*
build/dist/*.AppImage build/dist/*.AppImage
build/dist/*.3dsx build/dist/*.3dsx
build/dist/*.cia build/dist/*.cia

View File

@ -48,7 +48,8 @@ add_library(libsmacker STATIC
) )
target_include_directories(libsmacker PUBLIC ${libsmacker_SOURCE_DIR}) target_include_directories(libsmacker PUBLIC ${libsmacker_SOURCE_DIR})
if(DOWNLOAD_DEPENDENCIES) if(ISLE_DEBUG)
if(DOWNLOAD_DEPENDENCIES)
include(FetchContent) include(FetchContent)
FetchContent_Declare( FetchContent_Declare(
imgui imgui
@ -56,11 +57,11 @@ if(DOWNLOAD_DEPENDENCIES)
GIT_TAG f5befd2d29e66809cd1110a152e375a7f1981f06 GIT_TAG f5befd2d29e66809cd1110a152e375a7f1981f06
) )
FetchContent_MakeAvailable(imgui) FetchContent_MakeAvailable(imgui)
else() else()
set(imgui_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/imgui") set(imgui_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/imgui")
endif() endif()
add_library(imgui STATIC add_library(imgui STATIC
${imgui_SOURCE_DIR}/imgui.cpp ${imgui_SOURCE_DIR}/imgui.cpp
${imgui_SOURCE_DIR}/imgui_draw.cpp ${imgui_SOURCE_DIR}/imgui_draw.cpp
${imgui_SOURCE_DIR}/imgui_tables.cpp ${imgui_SOURCE_DIR}/imgui_tables.cpp
@ -68,11 +69,12 @@ add_library(imgui STATIC
${imgui_SOURCE_DIR}/imgui_demo.cpp ${imgui_SOURCE_DIR}/imgui_demo.cpp
${imgui_SOURCE_DIR}/backends/imgui_impl_sdl3.cpp ${imgui_SOURCE_DIR}/backends/imgui_impl_sdl3.cpp
${imgui_SOURCE_DIR}/backends/imgui_impl_sdlrenderer3.cpp ${imgui_SOURCE_DIR}/backends/imgui_impl_sdlrenderer3.cpp
) )
target_include_directories(imgui PUBLIC ${imgui_SOURCE_DIR}) target_include_directories(imgui PUBLIC ${imgui_SOURCE_DIR})
target_link_libraries(imgui PUBLIC SDL3::Headers) target_link_libraries(imgui PUBLIC SDL3::Headers)
target_link_libraries(imgui PRIVATE SDL3::SDL3) target_link_libraries(imgui PRIVATE SDL3::SDL3)
set_property(TARGET imgui PROPERTY CXX_CLANG_TIDY "") set_property(TARGET imgui PROPERTY CXX_CLANG_TIDY "")
endif()
if(DOWNLOAD_DEPENDENCIES) if(DOWNLOAD_DEPENDENCIES)
include(FetchContent) include(FetchContent)
@ -93,3 +95,39 @@ add_library(libweaver STATIC
${libweaver_SOURCE_DIR}/lib/sitypes.cpp ${libweaver_SOURCE_DIR}/lib/sitypes.cpp
) )
target_include_directories(libweaver PUBLIC ${libweaver_SOURCE_DIR}/lib) target_include_directories(libweaver PUBLIC ${libweaver_SOURCE_DIR}/lib)
if(USE_SDL2)
if(DOWNLOAD_DEPENDENCIES)
# include(FetchContent)
# FetchContent_Declare(
# SDL2
# GIT_REPOSITORY "https://github.com/libsdl-org/SDL.git"
# GIT_TAG 5d249570393f7a37e037abf22cd6012a4cc56a71
# EXCLUDE_FROM_ALL
# )
# FetchContent_MakeAvailable(SDL2)
# Find SDL2 normally
find_package(SDL2 REQUIRED)
endif()
file(GLOB SDL2_HEADERS "${SDL2_INCLUDE_DIR}/*.h")
foreach(header IN LISTS SDL2_HEADERS)
get_filename_component(fname ${header} NAME)
configure_file(${header} ${CMAKE_CURRENT_BINARY_DIR}/sdl3-shim/SDL3/${fname} COPYONLY)
endforeach()
add_library(SDL3_shim STATIC
sdl3-shim/main.cpp
)
target_link_libraries(SDL3_shim PRIVATE SDL2::SDL2)
target_include_directories(SDL3_shim PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/sdl3-shim"
"${CMAKE_CURRENT_BINARY_DIR}/sdl3-shim"
)
add_library(SDL3::SDL3 ALIAS SDL3_shim)
add_library(SDL3::Headers ALIAS SDL3_shim)
endif()

55
3rdparty/atomic-dummy/atomic.c vendored Normal file
View File

@ -0,0 +1,55 @@
// this is the only way to stop miniaudio atomics error when building isle.rpx and lego1.rpx
#include <stdint.h>
uint64_t __atomic_load_8(const uint64_t* p, int memorder) {
(void)memorder;
return *p;
}
void __atomic_store_8(uint64_t* p, uint64_t v, int memorder) {
(void)memorder;
*p = v;
}
uint64_t __atomic_exchange_8(uint64_t* p, uint64_t v, int memorder) {
(void)memorder;
uint64_t old = *p;
*p = v;
return old;
}
uint64_t __atomic_fetch_add_8(uint64_t* p, uint64_t v, int memorder) {
(void)memorder;
uint64_t old = *p;
*p += v;
return old;
}
uint64_t __atomic_fetch_sub_8(uint64_t* p, uint64_t v, int memorder) {
(void)memorder;
uint64_t old = *p;
*p -= v;
return old;
}
uint64_t __atomic_fetch_and_8(uint64_t* p, uint64_t v, int memorder) {
(void)memorder;
uint64_t old = *p;
*p &= v;
return old;
}
uint64_t __atomic_fetch_or_8(uint64_t* p, uint64_t v, int memorder) {
(void)memorder;
uint64_t old = *p;
*p |= v;
return old;
}
uint64_t __atomic_fetch_xor_8(uint64_t* p, uint64_t v, int memorder) {
(void)memorder;
uint64_t old = *p;
*p ^= v;
return old;
}

200
3rdparty/sdl3-shim/SDL3/SDL.h vendored Normal file
View File

@ -0,0 +1,200 @@
#pragma once
// https://wiki.libsdl.org/SDL3/README-migration#sdl_stdinch
#define SDL_bool bool
#include <SDL2/SDL.h>
#include <SDL2/SDL_keyboard.h>
#include <SDL2/SDL_video.h>
#include <SDL2/SDL_mouse.h>
#include "SDL_audio.h"
#include "SDL_events.h"
#include "SDL_filesystem.h"
#include "SDL_gamepad.h"
#include "SDL_iostream.h"
#include "SDL_keycode.h"
#include "SDL_main.h"
#include "SDL_mutex.h"
#include "SDL_pixels.h"
#include "SDL_surface.h"
#include "SDL_timer.h"
#include <random>
static std::mt19937 rng(SDL_GetPerformanceCounter());
inline Sint32 SDL_rand(const Sint32 n)
{
std::uniform_int_distribution dist(0, n - 1);
return dist(rng);
}
inline float SDL_randf()
{
static std::uniform_real_distribution dist(0.0f, 1.0f);
return dist(rng);
}
#define SDL_strtok_r SDL_strtokr
// https://wiki.libsdl.org/SDL3/README-migration#sdl_logh
#define SDL_LogTrace SDL_LogVerbose
// https://wiki.libsdl.org/SDL3/README-migration#sdl_videoh
typedef Uint32 SDL_DisplayID;
inline SDL_DisplayID SDL_GetPrimaryDisplay()
{
return 0;
}
// Modified from 83bb0f9105922fd49282f0b931f7873a71877ac8 SDL_video.c#L1331
inline SDL_DisplayMode** SDL_GetFullscreenDisplayModes(SDL_DisplayID displayID, int *count)
{
int i;
if (count) *count = 0;
const int num_modes = SDL_GetNumDisplayModes(displayID);
SDL_DisplayMode** result = static_cast<SDL_DisplayMode**>(SDL_malloc(sizeof(SDL_DisplayMode*) * (num_modes + 1)));
SDL_DisplayMode* modes = static_cast<SDL_DisplayMode*>(SDL_malloc(sizeof(SDL_DisplayMode) * num_modes));
if (!result || !modes) {
SDL_free(result);
SDL_free(modes);
return NULL;
}
for (i = 0; i < num_modes; i++) {
if (SDL_GetDisplayMode(displayID, i, &modes[i]) == 0) {
result[i] = &modes[i];
}
}
result[i] = NULL;
if (count) {
*count = num_modes;
}
return result;
}
inline SDL_DisplayMode* SDL_GetCurrentDisplayMode(SDL_DisplayID displayID)
{
SDL_DisplayMode* mode = nullptr;
SDL_GetCurrentDisplayMode(displayID, mode);
return mode;
}
#define SDL_GetWindowSize(...) (SDL_GetWindowSize(__VA_ARGS__), true )
// https://wiki.libsdl.org/SDL3/README-migration#sdl_videoh
#define SDL_GL_DestroyContext SDL_GL_DeleteContext
// https://wiki.libsdl.org/SDL3/README-migration#sdl_renderh
// hardcode -1 as all uses are NULL or -1 (hacks out failure)
#define SDL_CreateRenderer(window, name) SDL_CreateRenderer(window, -1, 0)
#define SDL_RenderTexture(...) (SDL_RenderCopyF(__VA_ARGS__) == 0)
// https://wiki.libsdl.org/SDL3/README-migration#sdl_haptich
// SDL_MouseID/SDL_KeyboardID are new
typedef int SDL_KeyboardID;
#define SDL_GetKeyboardState (const bool*)SDL_GetKeyboardState
typedef int SDL_HapticID;
#define SDL_CloseHaptic SDL_HapticClose
#define SDL_OpenHaptic SDL_HapticOpen
#define SDL_OpenHapticFromJoystick SDL_HapticOpenFromJoystick
#define SDL_OpenHapticFromMouse SDL_HapticOpenFromMouse
#define SDL_InitHapticRumble(...) (SDL_HapticRumbleInit(__VA_ARGS__) == 0)
#define SDL_PlayHapticRumble(...) (SDL_HapticRumblePlay(__VA_ARGS__) == 0)
#define SDL_GetHapticID SDL_HapticIndex
// Modified from cc9937201e421ec55b12ad3f07ff2268f15096e8 SDL_haptic.c#L150
inline SDL_HapticID* SDL_GetHaptics(int *count)
{
const int num_haptics = SDL_NumHaptics();
if (count) *count = 0;
SDL_HapticID* haptics = static_cast<SDL_HapticID*>(SDL_malloc((num_haptics + 1) * sizeof(*haptics)));
if (haptics) {
if (count) {
*count = num_haptics;
}
int haptic_index = 0;
for (int device_index = 0; device_index < num_haptics; ++device_index) {
SDL_Haptic* haptic = SDL_HapticOpen(device_index);
if (haptic) {
haptics[haptic_index] = SDL_GetHapticID(haptic);
SDL_HapticClose(haptic);
++haptic_index;
}
}
haptics[haptic_index] = 0;
} else { if (count) *count = 0; }
return haptics;
}
// https://wiki.libsdl.org/SDL3/README-migration#sdl_videoh
#define SDL_CreateWindow(title, w, h, flags) SDL_CreateWindow(title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w, h, flags)
#define SDL_SetWindowFullscreen(...) (SDL_SetWindowFullscreen(__VA_ARGS__) == 0)
#define SDL_GL_MakeCurrent(...) (SDL_GL_MakeCurrent(__VA_ARGS__) == 0)
#define SDL_GetDisplayForWindow SDL_GetWindowDisplayIndex
#define SDL_SetWindowFullscreenMode(...) (SDL_SetWindowDisplayMode(__VA_ARGS__) == 0)
// #define SDL_GetClosestFullscreenDisplayMode SDL_GetClosestDisplayMode
inline bool SDL_GetClosestFullscreenDisplayMode(SDL_DisplayID displayID, int w, int h, float refresh_rate, bool include_high_density_modes, SDL_DisplayMode *closest)
{
SDL_DisplayMode desired{};
desired.w = w;
desired.h = h;
desired.refresh_rate = static_cast<int>(refresh_rate);
desired.format = 0;
desired.driverdata = nullptr;
SDL_DisplayMode *result = SDL_GetClosestDisplayMode(displayID, &desired, closest);
return result != nullptr;
}
// https://wiki.libsdl.org/SDL3/README-migration#sdl_mouseh
typedef Uint32 SDL_MouseID;
inline SDL_MouseID * SDL_GetMice(int *count)
{
if (count) {
*count = 1;
}
const auto mice = static_cast<SDL_MouseID *>(SDL_malloc((*count + 1) * sizeof(SDL_MouseID)));
mice[0] = { 0 };
mice[1] = { 0 };
return mice;
}
static void SDL_HideCursor() { SDL_ShowCursor(SDL_DISABLE); }
static void SDL_ShowCursor() { SDL_ShowCursor(SDL_ENABLE); }
typedef Uint32 SDL_MouseButtonFlags;
#define SDL_SYSTEM_CURSOR_COUNT SDL_NUM_SYSTEM_CURSORS
#define SDL_SYSTEM_CURSOR_DEFAULT SDL_SYSTEM_CURSOR_ARROW
#define SDL_SYSTEM_CURSOR_POINTER SDL_SYSTEM_CURSOR_HAND
#define SDL_SYSTEM_CURSOR_TEXT SDL_SYSTEM_CURSOR_IBEAM
#define SDL_SYSTEM_CURSOR_NOT_ALLOWED SDL_SYSTEM_CURSOR_NO
#define SDL_SYSTEM_CURSOR_MOVE SDL_SYSTEM_CURSOR_SIZEALL
#define SDL_SYSTEM_CURSOR_NESW_RESIZE SDL_SYSTEM_CURSOR_SIZENESW
#define SDL_SYSTEM_CURSOR_NS_RESIZE SDL_SYSTEM_CURSOR_SIZENS
#define SDL_SYSTEM_CURSOR_NWSE_RESIZE SDL_SYSTEM_CURSOR_SIZENWSE
#define SDL_SYSTEM_CURSOR_EW_RESIZE SDL_SYSTEM_CURSOR_SIZEWE
#define SDL_SYSTEM_CURSOR_PROGRESS SDL_SYSTEM_CURSOR_WAITARROW
// https://wiki.libsdl.org/SDL3/README-migration#sdl_inith
#define SDL_Init(...) (SDL_Init(__VA_ARGS__) == 0)

101
3rdparty/sdl3-shim/SDL3/SDL_audio.h vendored Normal file
View File

@ -0,0 +1,101 @@
#pragma once
#include "SDL.h"
#include <map>
#include <mutex>
// https://wiki.libsdl.org/SDL3/README-migration#sdl_audioh
#define SDL_DestroyAudioStream SDL_FreeAudioStream
#define SDL_AUDIO_F32 AUDIO_F32SYS
#define SDL_AUDIO_DEVICE_DEFAULT_PLAYBACK NULL
typedef void SDL_AudioStreamCallback(void *userdata, SDL_AudioStream *stream, int additional_amount, int total_amount);
struct ShimAudioCtx {
SDL_AudioStream* stream;
SDL_AudioStreamCallback* callback;
void *userdata;
SDL_AudioSpec obtained;
};
static std::map<SDL_AudioDeviceID, ShimAudioCtx> g_audioCtxs;
static SDL_mutex *g_audioMutex = NULL;
static void SDLCALL shim_audio_callback(void *userdata, Uint8 *stream, int len) {
SDL_AudioDeviceID devid = reinterpret_cast<uintptr_t>(userdata);
SDL_LockMutex(g_audioMutex);
const auto it = g_audioCtxs.find(devid);
if (it == g_audioCtxs.end()) {
SDL_UnlockMutex(g_audioMutex);
SDL_memset(stream, 0, len);
return;
}
ShimAudioCtx &ctx = it->second;
SDL_UnlockMutex(g_audioMutex);
// How many sample frames the device is asking for
const int frame_size = (SDL_AUDIO_BITSIZE(ctx.obtained.format) / 8) * ctx.obtained.channels;
const int needed_frames = len / frame_size;
int total = (SDL_AudioStreamAvailable(ctx.stream) / frame_size) + needed_frames;
// SDL3 callback pushes more into the stream
ctx.callback(ctx.userdata, ctx.stream, needed_frames, total);
int got = SDL_AudioStreamGet(ctx.stream, stream, len);
if (got < len) {
SDL_memset(stream + got, 0, len - got);
}
}
#define SDL_ResumeAudioDevice(device) SDL_PauseAudioDevice(device, 0)
#define SDL_PutAudioStreamData(...) (SDL_AudioStreamPut(__VA_ARGS__) == 0)
inline SDL_AudioDeviceID SDL_GetAudioStreamDevice(SDL_AudioStream* stream)
{
SDL_LockMutex(g_audioMutex);
const auto it = g_audioCtxs.find(reinterpret_cast<uintptr_t>(stream));
if (it == g_audioCtxs.end()) {
return 0;
}
return it->first;
}
inline SDL_AudioStream * SDL_OpenAudioDeviceStream(const char* devid, const SDL_AudioSpec* desired, SDL_AudioStreamCallback callback, void* userdata)
{
SDL_AudioSpec obtained{};
SDL_AudioSpec desired2 = *desired;
desired2.callback = shim_audio_callback;
desired2.userdata = reinterpret_cast<void*>(static_cast<uintptr_t>(0));
SDL_AudioDeviceID device = SDL_OpenAudioDevice(devid, 0, &desired2, &obtained, 0);
SDL_AudioStream* stream = SDL_NewAudioStream(
desired->format, desired->channels, desired->freq,
obtained.format, obtained.channels, obtained.freq
);
if (!stream) {
SDL_CloseAudioDevice(device);
return nullptr;
}
{
SDL_LockMutex(g_audioMutex);
ShimAudioCtx ctx;
ctx.stream = stream;
ctx.callback = callback;
ctx.userdata = userdata;
ctx.obtained = obtained;
g_audioCtxs[device] = ctx;
SDL_UnlockMutex(g_audioMutex);
}
SDL_LockAudioDevice(device);
desired2.userdata = reinterpret_cast<void*>(static_cast<uintptr_t>(device));
SDL_UnlockAudioDevice(device);
return stream;
}

70
3rdparty/sdl3-shim/SDL3/SDL_events.h vendored Normal file
View File

@ -0,0 +1,70 @@
#pragma once
#include "SDL.h"
#include <SDL2/SDL_events.h>
// https://wiki.libsdl.org/SDL3/README-migration#sdl_eventsh
#define SDL_EVENT_WINDOW_PIXEL_SIZE_CHANGED SDL_WINDOWEVENT_SIZE_CHANGED
// #define SDL_EVENT_MOUSE_BUTTON_DOWN SDL_MOUSEBUTTONDOWN
// #define SDL_EVENT_MOUSE_BUTTON_UP SDL_MOUSEBUTTONUP
// #define SDL_EVENT_MOUSE_MOTION SDL_MOUSEMOTION
//
// #define SDL_EVENT_FINGER_MOTION SDL_FINGERMOTION
// #define SDL_EVENT_FINGER_DOWN SDL_FINGERDOWN
// #define SDL_EVENT_FINGER_UP SDL_FINGERUP
#define SDL_EVENT_FINGER_CANCELED 0
#define SDL_EVENT_QUIT SDL_QUIT
#define SDL_EVENT_WINDOW_CLOSE_REQUESTED SDL_WINDOWEVENT_CLOSE
#define SDL_EVENT_WINDOW_FOCUS_GAINED SDL_WINDOWEVENT_FOCUS_GAINED
#define SDL_EVENT_WINDOW_FOCUS_LOST SDL_WINDOWEVENT_FOCUS_LOST
#define SDL_EVENT_GAMEPAD_AXIS_MOTION SDL_CONTROLLERAXISMOTION
#define SDL_EVENT_GAMEPAD_BUTTON_DOWN SDL_CONTROLLERBUTTONDOWN
#define SDL_EVENT_GAMEPAD_BUTTON_UP SDL_CONTROLLERBUTTONUP
#define SDL_EVENT_GAMEPAD_ADDED SDL_CONTROLLERDEVICEADDED
// #define SDL_EVENT_GAMEPAD_REMAPPED SDL_CONTROLLERDEVICEREMAPPED
#define SDL_EVENT_GAMEPAD_REMOVED SDL_CONTROLLERDEVICEREMOVED
// #define SDL_EVENT_GAMEPAD_SENSOR_UPDATE SDL_CONTROLLERSENSORUPDATE
// #define SDL_EVENT_GAMEPAD_STEAM_HANDLE_UPDATED SDL_CONTROLLERSTEAMHANDLEUPDATED
// #define SDL_EVENT_GAMEPAD_TOUCHPAD_DOWN SDL_CONTROLLERTOUCHPADDOWN
// #define SDL_EVENT_GAMEPAD_TOUCHPAD_MOTION SDL_CONTROLLERTOUCHPADMOTION
// #define SDL_EVENT_GAMEPAD_TOUCHPAD_UP SDL_CONTROLLERTOUCHPADUP
// #define SDL_EVENT_DROP_BEGIN SDL_DROPBEGIN
// #define SDL_EVENT_DROP_COMPLETE SDL_DROPCOMPLETE
// #define SDL_EVENT_DROP_FILE SDL_DROPFILE
// #define SDL_EVENT_DROP_TEXT SDL_DROPTEXT
#define SDL_EVENT_FINGER_DOWN SDL_FINGERDOWN
#define SDL_EVENT_FINGER_MOTION SDL_FINGERMOTION
#define SDL_EVENT_FINGER_UP SDL_FINGERUP
// #define SDL_EVENT_FIRST SDL_FIRSTEVENT
// #define SDL_EVENT_JOYSTICK_AXIS_MOTION SDL_JOYAXISMOTION
// #define SDL_EVENT_JOYSTICK_BALL_MOTION SDL_JOYBALLMOTION
// #define SDL_EVENT_JOYSTICK_BATTERY_UPDATED SDL_JOYBATTERYUPDATED
// #define SDL_EVENT_JOYSTICK_BUTTON_DOWN SDL_JOYBUTTONDOWN
// #define SDL_EVENT_JOYSTICK_BUTTON_UP SDL_JOYBUTTONUP
// #define SDL_EVENT_JOYSTICK_ADDED SDL_JOYDEVICEADDED
// #define SDL_EVENT_JOYSTICK_REMOVED SDL_JOYDEVICEREMOVED
// #define SDL_EVENT_JOYSTICK_HAT_MOTION SDL_JOYHATMOTION
#define SDL_EVENT_KEY_DOWN SDL_KEYDOWN
// #define SDL_EVENT_KEYMAP_CHANGED SDL_KEYMAPCHANGED
#define SDL_EVENT_KEY_UP SDL_KEYUP
// #define SDL_EVENT_LAST SDL_LASTEVENT
// #define SDL_EVENT_LOCALE_CHANGED SDL_LOCALECHANGED
#define SDL_EVENT_MOUSE_BUTTON_DOWN SDL_MOUSEBUTTONDOWN
#define SDL_EVENT_MOUSE_BUTTON_UP SDL_MOUSEBUTTONUP
#define SDL_EVENT_MOUSE_MOTION SDL_MOUSEMOTION
// #define SDL_EVENT_MOUSE_WHEEL SDL_MOUSEWHEEL
// #define SDL_EVENT_POLL_SENTINEL SDL_POLLSENTINEL
#define fingerID fingerId
#define touchID touchId
#define gaxis caxis
#define gbutton cbutton

101
3rdparty/sdl3-shim/SDL3/SDL_filesystem.h vendored Normal file
View File

@ -0,0 +1,101 @@
#pragma once
#include "SDL.h"
#include "SDL_iostream.h"
#include <filesystem>
#include <vector>
typedef Uint32 SDL_GlobFlags;
typedef enum SDL_PathType
{
SDL_PATHTYPE_NONE,
SDL_PATHTYPE_FILE,
SDL_PATHTYPE_DIRECTORY,
SDL_PATHTYPE_OTHER
} SDL_PathType;
typedef struct SDL_PathInfo
{
SDL_PathType type;
Uint64 size;
} SDL_PathInfo;
// https://github.com/libsdl-org/SDL/blob/main/src/filesystem/
inline char** SDL_GlobDirectory(const char *path, const char *pattern, SDL_GlobFlags flags, int *count)
{
if (!path || !count) return NULL;
*count = 0;
std::vector<std::string> entries;
try {
for (const auto& entry : std::filesystem::recursive_directory_iterator(path)) {
entries.push_back(std::filesystem::relative(entry.path(), path).string());
}
} catch (...) {
return NULL;
}
if (entries.empty()) return NULL;
char** result = static_cast<char**>(SDL_malloc(sizeof(char*) * entries.size()));
if (!result) return NULL;
for (size_t i = 0; i < entries.size(); ++i) {
result[i] = SDL_strdup(entries[i].c_str());
if (!result[i]) {
for (size_t j = 0; j < i; ++j) {
SDL_free(result[j]);
}
SDL_free(result);
return NULL;
}
}
*count = static_cast<int>(entries.size());
return result;
}
inline bool SDL_RemovePath(const char *path)
{
if (!path) return SDL_InvalidParamError("path");
if (std::filesystem::remove(path)) return true;
return false;
}
inline bool SDL_RenamePath(const char *oldpath, const char *newpath)
{
if (!oldpath) return SDL_InvalidParamError("oldpath");
if (!newpath) return SDL_InvalidParamError("newpath");
std::filesystem::rename(oldpath, newpath);
return true;
}
inline bool SDL_GetPathInfo(const char *path, SDL_PathInfo *info)
{
if (!path) return SDL_InvalidParamError("path");
SDL_PathInfo dummy;
if (!info) info = &dummy;
SDL_zerop(info);
switch (const auto status = std::filesystem::status(path);status.type()) {
case std::filesystem::file_type::regular:
info->type = SDL_PATHTYPE_FILE;
info->size = std::filesystem::file_size(path);
break;
case std::filesystem::file_type::directory:
info->type = SDL_PATHTYPE_DIRECTORY;
info->size = 0;
break;
case std::filesystem::file_type::not_found:
info->type = SDL_PATHTYPE_NONE;
info->size = 0;
return false;
default:
info->type = SDL_PATHTYPE_OTHER;
info->size = 0;
break;
}
return true;
}

111
3rdparty/sdl3-shim/SDL3/SDL_gamepad.h vendored Normal file
View File

@ -0,0 +1,111 @@
#pragma once
#include <SDL2/SDL_gamecontroller.h>
// https://wiki.libsdl.org/SDL3/README-migration#sdl_gamecontrollerh
#define SDL_Gamepad SDL_GameController
#define SDL_INIT_GAMEPAD SDL_INIT_GAMECONTROLLER
// #define SDL_CloseGamepad SDL_GameControllerClose
//
// #define SDL_GamepadAxis SDL_GameControllerAxis
// #define SDL_GamepadBindingType SDL_GameControllerBindType
// #define SDL_GamepadButton SDL_GameControllerButton
// #define SDL_GamepadType SDL_GameControllerType
// #define SDL_AddGamepadMapping SDL_GameControllerAddMapping
// #define SDL_AddGamepadMappingsFromFile SDL_GameControllerAddMappingsFromFile
// #define SDL_AddGamepadMappingsFromIO SDL_GameControllerAddMappingsFromRW
#define SDL_CloseGamepad SDL_GameControllerClose
// #define SDL_GetGamepadFromID SDL_GameControllerFromInstanceID
// #define SDL_GetGamepadFromPlayerIndex SDL_GameControllerFromPlayerIndex
// #define SDL_GetGamepadAppleSFSymbolsNameForAxis SDL_GameControllerGetAppleSFSymbolsNameForAxis
// #define SDL_GetGamepadAppleSFSymbolsNameForButton SDL_GameControllerGetAppleSFSymbolsNameForButton
// #define SDL_GamepadConnected SDL_GameControllerGetAttached
#define SDL_GetGamepadAxis SDL_GameControllerGetAxis
// #define SDL_GetGamepadAxisFromString SDL_GameControllerGetAxisFromString
// #define SDL_GetGamepadButton SDL_GameControllerGetButton
// #define SDL_GetGamepadButtonFromString SDL_GameControllerGetButtonFromString
// #define SDL_GetGamepadFirmwareVersion SDL_GameControllerGetFirmwareVersion
#define SDL_GetGamepadJoystick SDL_GameControllerGetJoystick
// #define SDL_GetNumGamepadTouchpadFingers SDL_GameControllerGetNumTouchpadFingers
// #define SDL_GetNumGamepadTouchpads SDL_GameControllerGetNumTouchpads
// #define SDL_GetGamepadPlayerIndex SDL_GameControllerGetPlayerIndex
// #define SDL_GetGamepadProduct SDL_GameControllerGetProduct
// #define SDL_GetGamepadProductVersion SDL_GameControllerGetProductVersion
// #define SDL_GetGamepadSensorData SDL_GameControllerGetSensorData, returns bool
// #define SDL_GetGamepadSensorDataRate SDL_GameControllerGetSensorDataRate
// #define SDL_GetGamepadSerial SDL_GameControllerGetSerial
// #define SDL_GetGamepadSteamHandle SDL_GameControllerGetSteamHandle
// #define SDL_GetGamepadStringForAxis SDL_GameControllerGetStringForAxis
// #define SDL_GetGamepadStringForButton SDL_GameControllerGetStringForButton
// #define SDL_GetGamepadTouchpadFinger SDL_GameControllerGetTouchpadFinger, returns bool
// #define SDL_GetGamepadType SDL_GameControllerGetType
// #define SDL_GetGamepadVendor SDL_GameControllerGetVendor
// #define SDL_GamepadHasAxis SDL_GameControllerHasAxis
// #define SDL_GamepadHasButton SDL_GameControllerHasButton
// #define SDL_GamepadHasSensor SDL_GameControllerHasSensor
// #define SDL_GamepadSensorEnabled SDL_GameControllerIsSensorEnabled
// #define SDL_GetGamepadMapping SDL_GameControllerMapping
// #define SDL_GetGamepadMappingForGUID SDL_GameControllerMappingForGUID
// #define SDL_GetGamepadName SDL_GameControllerName
#define SDL_OpenGamepad SDL_GameControllerOpen
// #define SDL_GetGamepadPath SDL_GameControllerPath
#define SDL_RumbleGamepad(...) (SDL_GameControllerRumble(__VA_ARGS__) == 0)
// #define SDL_RumbleGamepadTriggers SDL_GameControllerRumbleTriggers, returns bool
// #define SDL_SendGamepadEffect SDL_GameControllerSendEffect, returns bool
// #define SDL_SetGamepadLED SDL_GameControllerSetLED, returns bool
// #define SDL_SetGamepadPlayerIndex SDL_GameControllerSetPlayerIndex, returns bool
// #define SDL_SetGamepadSensorEnabled SDL_GameControllerSetSensorEnabled, returns bool
// #define SDL_UpdateGamepads SDL_GameControllerUpdate
// #define SDL_IsGamepad SDL_IsGameController
// #define SDL_GAMEPAD_AXIS_INVALID SDL_CONTROLLER_AXIS_INVALID
#define SDL_GAMEPAD_AXIS_LEFTX SDL_CONTROLLER_AXIS_LEFTX
#define SDL_GAMEPAD_AXIS_LEFTY SDL_CONTROLLER_AXIS_LEFTY
// #define SDL_GAMEPAD_AXIS_COUNT SDL_CONTROLLER_AXIS_MAX
#define SDL_GAMEPAD_AXIS_RIGHTX SDL_CONTROLLER_AXIS_RIGHTX
#define SDL_GAMEPAD_AXIS_RIGHTY SDL_CONTROLLER_AXIS_RIGHTY
#define SDL_GAMEPAD_AXIS_LEFT_TRIGGER SDL_CONTROLLER_AXIS_TRIGGERLEFT
#define SDL_GAMEPAD_AXIS_RIGHT_TRIGGER SDL_CONTROLLER_AXIS_TRIGGERRIGHT
// #define SDL_GAMEPAD_BINDTYPE_AXIS SDL_CONTROLLER_BINDTYPE_AXIS
// #define SDL_GAMEPAD_BINDTYPE_BUTTON SDL_CONTROLLER_BINDTYPE_BUTTON
// #define SDL_GAMEPAD_BINDTYPE_HAT SDL_CONTROLLER_BINDTYPE_HAT
#define SDL_GAMEPAD_BINDTYPE_NONE SDL_CONTROLLER_BINDTYPE_NONE
#define SDL_GAMEPAD_BUTTON_SOUTH SDL_CONTROLLER_BUTTON_A
#define SDL_GAMEPAD_BUTTON_EAST SDL_CONTROLLER_BUTTON_B
// #define SDL_GAMEPAD_BUTTON_BACK SDL_CONTROLLER_BUTTON_BACK
#define SDL_GAMEPAD_BUTTON_DPAD_DOWN SDL_CONTROLLER_BUTTON_DPAD_DOWN
#define SDL_GAMEPAD_BUTTON_DPAD_LEFT SDL_CONTROLLER_BUTTON_DPAD_LEFT
#define SDL_GAMEPAD_BUTTON_DPAD_RIGHT SDL_CONTROLLER_BUTTON_DPAD_RIGHT
#define SDL_GAMEPAD_BUTTON_DPAD_UP SDL_CONTROLLER_BUTTON_DPAD_UP
// #define SDL_GAMEPAD_BUTTON_GUIDE SDL_CONTROLLER_BUTTON_GUIDE
// #define SDL_GAMEPAD_BUTTON_INVALID SDL_CONTROLLER_BUTTON_INVALID
// #define SDL_GAMEPAD_BUTTON_LEFT_SHOULDER SDL_CONTROLLER_BUTTON_LEFTSHOULDER
// #define SDL_GAMEPAD_BUTTON_LEFT_STICK SDL_CONTROLLER_BUTTON_LEFTSTICK
// #define SDL_GAMEPAD_BUTTON_COUNT SDL_CONTROLLER_BUTTON_MAX
// #define SDL_GAMEPAD_BUTTON_MISC1 SDL_CONTROLLER_BUTTON_MISC1
// #define SDL_GAMEPAD_BUTTON_RIGHT_PADDLE1 SDL_CONTROLLER_BUTTON_PADDLE1
// #define SDL_GAMEPAD_BUTTON_LEFT_PADDLE1 SDL_CONTROLLER_BUTTON_PADDLE2
// #define SDL_GAMEPAD_BUTTON_RIGHT_PADDLE2 SDL_CONTROLLER_BUTTON_PADDLE3
// #define SDL_GAMEPAD_BUTTON_LEFT_PADDLE2 SDL_CONTROLLER_BUTTON_PADDLE4
// #define SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER SDL_CONTROLLER_BUTTON_RIGHTSHOULDER
// #define SDL_GAMEPAD_BUTTON_RIGHT_STICK SDL_CONTROLLER_BUTTON_RIGHTSTICK
#define SDL_GAMEPAD_BUTTON_START SDL_CONTROLLER_BUTTON_START
// #define SDL_GAMEPAD_BUTTON_TOUCHPAD SDL_CONTROLLER_BUTTON_TOUCHPAD
// #define SDL_GAMEPAD_BUTTON_WEST SDL_CONTROLLER_BUTTON_X
// #define SDL_GAMEPAD_BUTTON_NORTH SDL_CONTROLLER_BUTTON_Y
// #define SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_LEFT SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_LEFT
// #define SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_PAIR SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_PAIR
// #define SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_JOYCON_RIGHT
// #define SDL_GAMEPAD_TYPE_NINTENDO_SWITCH_PRO SDL_CONTROLLER_TYPE_NINTENDO_SWITCH_PRO
// #define SDL_GAMEPAD_TYPE_PS3 SDL_CONTROLLER_TYPE_PS3
// #define SDL_GAMEPAD_TYPE_PS4 SDL_CONTROLLER_TYPE_PS4
// #define SDL_GAMEPAD_TYPE_PS5 SDL_CONTROLLER_TYPE_PS5
// #define SDL_GAMEPAD_TYPE_STANDARD SDL_CONTROLLER_TYPE_UNKNOWN
// #define SDL_GAMEPAD_TYPE_VIRTUAL SDL_CONTROLLER_TYPE_VIRTUAL
// #define SDL_GAMEPAD_TYPE_XBOX360 SDL_CONTROLLER_TYPE_XBOX360
// #define SDL_GAMEPAD_TYPE_XBOXONE SDL_CONTROLLER_TYPE_XBOXONE

49
3rdparty/sdl3-shim/SDL3/SDL_iostream.h vendored Normal file
View File

@ -0,0 +1,49 @@
#pragma once
#include <SDL2/SDL_rwops.h>
// https://wiki.libsdl.org/SDL3/README-migration#sdl_rwopsh
#define SDL_IOStream SDL_RWops
typedef int SDL_IOWhence;
#define SDL_IO_SEEK_SET RW_SEEK_SET
#define SDL_IO_SEEK_CUR RW_SEEK_CUR
#define SDL_IO_SEEK_END RW_SEEK_END
// #define SDL_IOFromConstMem SDL_RWFromConstMem
#define SDL_IOFromFile SDL_RWFromFile
#define SDL_IOFromMem SDL_RWFromMem
#define SDL_CloseIO SDL_RWclose
#define SDL_ReadIO(ctx, ptr, size) SDL_RWread(ctx, ptr, 1, size)
#define SDL_SeekIO SDL_RWseek
#define SDL_GetIOSize SDL_RWsize
#define SDL_TellIO SDL_RWtell
#define SDL_WriteIO(ctx, ptr, size) SDL_RWwrite(ctx, ptr, 1, size)
// #define SDL_ReadU16BE SDL_ReadBE16
// #define SDL_ReadU32BE SDL_ReadBE32
// #define SDL_ReadU64BE SDL_ReadBE64
// #define SDL_ReadU16LE SDL_ReadLE16
// #define SDL_ReadU32LE SDL_ReadLE32
// #define SDL_ReadU64LE SDL_ReadLE64
// #define SDL_WriteU16BE SDL_WriteBE16
// #define SDL_WriteU32BE SDL_WriteBE32
// #define SDL_WriteU64BE SDL_WriteBE64
// #define SDL_WriteU16LE SDL_WriteLE16
// #define SDL_WriteU32LE SDL_WriteLE32
// #define SDL_WriteU64LE SDL_WriteLE64
// FIXME: If Write/Read fail SDL_GetIOStatus is not aware.
typedef enum SDL_IOStatus
{
SDL_IO_STATUS_READY,
SDL_IO_STATUS_ERROR,
} SDL_IOStatus;
inline SDL_IOStatus SDL_GetIOStatus(SDL_RWops *context)
{
if (!context) {
return SDL_IO_STATUS_ERROR;
}
return SDL_IO_STATUS_READY;
}

60
3rdparty/sdl3-shim/SDL3/SDL_keycode.h vendored Normal file
View File

@ -0,0 +1,60 @@
#pragma once
#include <SDL2/SDL_keycode.h>
#define SDLK_MEDIA_FAST_FORWARD SDLK_AUDIOFASTFORWARD
#define SDL_KMOD_ALT KMOD_ALT
#define SDL_KMOD_CAPS KMOD_CAPS
#define SDL_KMOD_CTRL KMOD_CTRL
#define SDL_KMOD_GUI KMOD_GUI
#define SDL_KMOD_LALT KMOD_LALT
#define SDL_KMOD_LCTRL KMOD_LCTRL
#define SDL_KMOD_LGUI KMOD_LGUI
#define SDL_KMOD_LSHIFT KMOD_LSHIFT
#define SDL_KMOD_MODE KMOD_MODE
#define SDL_KMOD_NONE KMOD_NONE
#define SDL_KMOD_NUM KMOD_NUM
#define SDL_KMOD_RALT KMOD_RALT
#define SDL_KMOD_RCTRL KMOD_RCTRL
#define SDL_KMOD_RGUI KMOD_RGUI
#define SDL_KMOD_RSHIFT KMOD_RSHIFT
#define SDL_KMOD_SCROLL KMOD_SCROLL
#define SDL_KMOD_SHIFT KMOD_SHIFT
#define SDLK_MEDIA_FAST_FORWARD SDLK_AUDIOFASTFORWARD
#define SDLK_MUTE SDLK_AUDIOMUTE
#define SDLK_MEDIA_NEXT_TRACK SDLK_AUDIONEXT
#define SDLK_MEDIA_PLAY SDLK_AUDIOPLAY
#define SDLK_MEDIA_PREVIOUS_TRACK SDLK_AUDIOPREV
#define SDLK_MEDIA_REWIND SDLK_AUDIOREWIND
#define SDLK_MEDIA_STOP SDLK_AUDIOSTOP
#define SDLK_GRAVE SDLK_BACKQUOTE
#define SDLK_MEDIA_EJECT SDLK_EJECT
#define SDLK_MEDIA_SELECT SDLK_MEDIASELECT
#define SDLK_APOSTROPHE SDLK_QUOTE
#define SDLK_DBLAPOSTROPHE SDLK_QUOTEDBL
#define SDLK_A SDLK_a
#define SDLK_B SDLK_b
#define SDLK_C SDLK_c
#define SDLK_D SDLK_d
#define SDLK_E SDLK_e
#define SDLK_F SDLK_f
#define SDLK_G SDLK_g
#define SDLK_H SDLK_h
#define SDLK_I SDLK_i
#define SDLK_J SDLK_j
#define SDLK_K SDLK_k
#define SDLK_L SDLK_l
#define SDLK_M SDLK_m
#define SDLK_N SDLK_n
#define SDLK_O SDLK_o
#define SDLK_P SDLK_p
#define SDLK_Q SDLK_q
#define SDLK_R SDLK_r
#define SDLK_S SDLK_s
#define SDLK_T SDLK_t
#define SDLK_U SDLK_u
#define SDLK_V SDLK_v
#define SDLK_W SDLK_w
#define SDLK_X SDLK_x
#define SDLK_Y SDLK_y
#define SDLK_Z SDLK_z

13
3rdparty/sdl3-shim/SDL3/SDL_main.h vendored Normal file
View File

@ -0,0 +1,13 @@
#pragma once
typedef enum SDL_AppResult
{
SDL_APP_CONTINUE,
SDL_APP_SUCCESS,
SDL_APP_FAILURE
} SDL_AppResult;
SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[]);
SDL_AppResult SDL_AppIterate(void *appstate);
SDL_AppResult SDL_AppEvent(void *appstate, SDL_Event *event);
void SDL_AppQuit(void *appstate, SDL_AppResult result);

12
3rdparty/sdl3-shim/SDL3/SDL_mutex.h vendored Normal file
View File

@ -0,0 +1,12 @@
#pragma once
#include <SDL2/SDL_mutex.h>
// https://wiki.libsdl.org/SDL3/README-migration#sdl_mutexh
#define SDL_Mutex SDL_mutex
#define SDL_Semaphore SDL_sem
#define SDL_WaitSemaphore SDL_SemWait
#define SDL_SignalSemaphore SDL_SemPost

37
3rdparty/sdl3-shim/SDL3/SDL_pixels.h vendored Normal file
View File

@ -0,0 +1,37 @@
#pragma once
#include <SDL2/SDL_pixels.h>
// https://wiki.libsdl.org/SDL3/README-migration#sdl_pixelsh
#define bits_per_pixel BitsPerPixel
typedef SDL_PixelFormat SDL2_PixelFormat;
#define SDL_PixelFormatDetails SDL2_PixelFormat
#define SDL_PixelFormat SDL_PixelFormatEnum
#define SDL_GetRGBA(pixel, format, palette, r,g,b,a) SDL_GetRGBA(pixel, format, r,g,b,a)
#define SDL_MapRGBA(format, palette, r,g,b,a) SDL_MapRGBA(format, r,g,b,a)
#define SDL_GetRGB(pixel, format, palette, r,g,b) SDL_GetRGB(pixel, format, r,g,b)
#define SDL_MapRGB(format, palette, r,g,b) SDL_MapRGB(format, r,g,b)
template<typename T>
SDL_PixelFormatDetails* SDL_GetPixelFormatDetails(T format) {
if constexpr (std::is_same_v<T, SDL_PixelFormat>) {
return SDL_AllocFormat(format);
} else {
return SDL_AllocFormat(format->format);
}
}
static bool operator!=(SDL_PixelFormatDetails* lhs, SDL_PixelFormatEnum rhs)
{
return lhs->format != rhs;
}
#define SDL_CreatePalette SDL_AllocPalette
#define SDL_DestroyPalette SDL_FreePalette
#define SDL_GetPixelFormatForMasks (SDL_PixelFormat)SDL_MasksToPixelFormatEnum
#define SDL_GetSurfacePalette(surface) (nullptr)

38
3rdparty/sdl3-shim/SDL3/SDL_surface.h vendored Normal file
View File

@ -0,0 +1,38 @@
#pragma once
#include <SDL2/SDL_surface.h>
#include "SDL_pixels.h"
// https://wiki.libsdl.org/SDL3/README-migration#sdl_surfaceh
#define SDL_FillSurfaceRect(...) (SDL_FillRect(__VA_ARGS__) == 0)
#define SDL_DestroySurface SDL_FreeSurface
#define SDL_LockSurface(...) (SDL_LockSurface(__VA_ARGS__) == 0)
template<typename T>
SDL_Surface* SDL_CreateSurface( int width, int height, T format) {
if constexpr (std::is_same_v<T, SDL_PixelFormat>) {
return SDL_CreateRGBSurfaceWithFormat(0 , width, height, SDL_BITSPERPIXEL(format) ,format);
} else {
return SDL_CreateRGBSurfaceWithFormat(0 , width, height, SDL_BITSPERPIXEL(format->format) ,format->format);
}
}
inline SDL_Surface* SDL_ConvertSurface(SDL_Surface* surface, SDL_PixelFormat format)
{
return SDL_ConvertSurfaceFormat(surface, format, 0);
};
inline SDL_Surface* SDL_ConvertSurface(SDL_Surface* surface, const SDL_PixelFormatDetails* formatDetails)
{
return SDL_ConvertSurface(surface, formatDetails, 0);
}
#define SDL_SCALEMODE_LINEAR SDL_ScaleModeLinear
#define SDL_SCALEMODE_NEAREST SDL_ScaleModeNearest
#define SDL_BlitSurfaceScaled(surface, rect, destSurface, destRect, scaleMode) (SDL_BlitScaled(surface, rect, destSurface, destRect) == 0)
#define SDL_SetSurfaceColorKey(...) (SDL_SetColorKey(__VA_ARGS__) == 0)
#define SDL_LoadBMP_IO SDL_LoadBMP_RW

71
3rdparty/sdl3-shim/SDL3/SDL_timer.h vendored Normal file
View File

@ -0,0 +1,71 @@
#pragma once
#include <SDL2/SDL.h>
#include <SDL2/SDL_timer.h>
#include <SDL2/SDL_mutex.h>
#include <map>
// https://wiki.libsdl.org/SDL3/README-migration#sdl_timerh
// https://wiki.libsdl.org/SDL3/README-migration#sdl_timerh | SDL_GetTicksNS()
#define SDL_GetTicksNS SDL_GetTicks
// time is in miliseconds not nanoseconds
#define SDL_NS_TO_MS(MS) (MS)
typedef Uint32 SDL3_TimerCallback (void *userdata, SDL_TimerID timerID, Uint32 interval);
struct SDL2TimerShimData {
SDL3_TimerCallback *callback2;
void *userdata2;
SDL_TimerID id;
};
static std::map<SDL_TimerID, void*> g_timers;
static SDL_mutex *g_timerMutex = NULL;
inline Uint32 shim_timer_callback (Uint32 interval, void *param)
{
const auto shim = static_cast<SDL2TimerShimData*>(param);
const Uint32 next = shim->callback2(shim->userdata2, shim->id, interval);
if (next == 0) {
SDL_LockMutex(g_timerMutex);
g_timers.erase(shim->id);
SDL_free(shim);
SDL_UnlockMutex(g_timerMutex);
}
return next;
}
inline SDL_TimerID SDL_AddTimer(Uint32 interval, SDL3_TimerCallback callback3, void* userdata)
{
const auto shim = static_cast<SDL2TimerShimData*>(SDL_malloc(sizeof(SDL2TimerShimData)));
shim->callback2 = callback3;
shim->userdata2 = userdata;
const SDL_TimerID id = ::SDL_AddTimer(interval, shim_timer_callback, shim);
shim->id = id;
SDL_LockMutex(g_timerMutex);
g_timers[id] = shim;
SDL_UnlockMutex(g_timerMutex);
return id;
}
inline SDL_bool SDL_RemoveTimer2(SDL_TimerID id)
{
SDL_LockMutex(g_timerMutex);
if (const auto it = g_timers.find(id); it != g_timers.end()) {
SDL_free(it->second);
g_timers.erase(it);
}
SDL_UnlockMutex(g_timerMutex);
return ::SDL_RemoveTimer(id);
}
#define SDL_RemoveTimer SDL_RemoveTimer2

20
3rdparty/sdl3-shim/main.cpp vendored Normal file
View File

@ -0,0 +1,20 @@
#include <SDL2/SDL.h>
#include "SDL3/SDL_events.h"
#include "SDL3/SDL_main.h"
int main(int argc, char *argv[]) {
void *appstate = NULL;
if (SDL_AppInit(&appstate, argc, argv) != 0) {
return 1;
}
SDL_Event e;
while (!SDL_AppIterate(appstate)) {
while (SDL_PollEvent(&e)) {
SDL_AppEvent(appstate, &e);
}
}
SDL_AppQuit(appstate, static_cast<SDL_AppResult>(NULL));
return 0;
}

View File

@ -2,6 +2,27 @@ cmake_minimum_required(VERSION 3.25...4.0 FATAL_ERROR)
project(isle LANGUAGES CXX C VERSION 0.1) project(isle LANGUAGES CXX C VERSION 0.1)
if(WIIU)
add_library(SDL2_WiiU STATIC IMPORTED)
set_target_properties(SDL2_WiiU PROPERTIES
IMPORTED_LOCATION /opt/devkitpro/portlibs/wiiu/lib/libSDL2.a
INTERFACE_INCLUDE_DIRECTORIES /opt/devkitpro/portlibs/wiiu/include
)
add_library(libstdc_WiiU STATIC IMPORTED)
set_target_properties(libstdc_WiiU PROPERTIES
IMPORTED_LOCATION /opt/devkitpro/devkitPPC/powerpc-eabi/lib/libstdc++.a
INTERFACE_INCLUDE_DIRECTORIES /opt/devkitpro/devkitPPC/powerpc-eabi/include/c++/15.1.0
)
include_directories(BEFORE
/opt/devkitpro/portlibs/wiiu/include
/opt/devkitpro/devkitPPC/powerpc-eabi/include/c++/15.1.0/powerpc-eabi
/opt/devkitpro/devkitPPC/powerpc-eabi/include/c++/15.1.0
)
endif()
if (IOS) if (IOS)
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED NO) set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED NO)
set(CMAKE_OSX_DEPLOYMENT_TARGET "12.0") set(CMAKE_OSX_DEPLOYMENT_TARGET "12.0")
@ -49,20 +70,29 @@ option(ISLE_WERROR "Treat warnings as errors" OFF)
option(ISLE_DEBUG "Enable imgui debug" ON) option(ISLE_DEBUG "Enable imgui debug" ON)
cmake_dependent_option(ISLE_USE_DX5 "Build with internal DirectX 5 SDK" "${NOT_MINGW}" "WIN32;CMAKE_SIZEOF_VOID_P EQUAL 4" OFF) cmake_dependent_option(ISLE_USE_DX5 "Build with internal DirectX 5 SDK" "${NOT_MINGW}" "WIN32;CMAKE_SIZEOF_VOID_P EQUAL 4" OFF)
cmake_dependent_option(ISLE_MINIWIN "Use miniwin" ON "NOT ISLE_USE_DX5" OFF) cmake_dependent_option(ISLE_MINIWIN "Use miniwin" ON "NOT ISLE_USE_DX5" OFF)
cmake_dependent_option(ISLE_EXTENSIONS "Use extensions" ON "NOT ISLE_USE_DX5;NOT WINDOWS_STORE" OFF) cmake_dependent_option(ISLE_EXTENSIONS "Use extensions" OFF "NOT ISLE_USE_DX5;NOT WINDOWS_STORE" OFF) # ALSO OFF FOR NOW
cmake_dependent_option(ISLE_BUILD_CONFIG "Build CONFIG.EXE application" ON "MSVC OR ISLE_MINIWIN;NOT NINTENDO_3DS;NOT WINDOWS_STORE" OFF) cmake_dependent_option(ISLE_BUILD_CONFIG "Build CONFIG.EXE application" ON "MSVC OR ISLE_MINIWIN;NOT NINTENDO_3DS;NOT WINDOWS_STORE" OFF)
cmake_dependent_option(ISLE_COMPILE_SHADERS "Compile shaders" ON "SDL_SHADERCROSS_BIN;TARGET Python3::Interpreter" OFF) cmake_dependent_option(ISLE_COMPILE_SHADERS "Compile shaders" ON "SDL_SHADERCROSS_BIN;TARGET Python3::Interpreter" OFF)
option(CMAKE_POSITION_INDEPENDENT_CODE "Build with -fPIC" ON) option(CMAKE_POSITION_INDEPENDENT_CODE "Build with -fPIC" OFF) # WUT/WIIU DOES NOT LIKE -fPIC
option(ENABLE_CLANG_TIDY "Enable clang-tidy") option(ENABLE_CLANG_TIDY "Enable clang-tidy")
option(DOWNLOAD_DEPENDENCIES "Download dependencies" ON) option(DOWNLOAD_DEPENDENCIES "Download dependencies" ON)
option(USE_SDL2 "Use SDL2 instead of SDL3 via a shim" ON)
option(BUILD_WUHB "Build isle.wuhb and isle.rpx and lego1.rpl (WIIU ONLY)" OFF) # OFF FOR NOW
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" CACHE PATH "Directory where to put executables and dll") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" CACHE PATH "Directory where to put executables and dll")
set(ISLE_EMSCRIPTEN_HOST "" CACHE STRING "Host URL for Emscripten streaming (e.g., https://test.com)") set(ISLE_EMSCRIPTEN_HOST "" CACHE STRING "Host URL for Emscripten streaming (e.g., https://test.com)")
cmake_dependent_option(BUILD_SHARED_LIBS "Build lego1 as a shared library" ON "NOT EMSCRIPTEN" OFF) cmake_dependent_option(BUILD_SHARED_LIBS "Build lego1 as a shared library" ON "NOT EMSCRIPTEN" OFF)
if(USE_SDL2)
add_compile_definitions(SDL_MAJOR_VERSION=2)
else()
add_compile_definitions(SDL_MAJOR_VERSION=3)
endif()
message(STATUS "Isle app: ${ISLE_BUILD_APP}") message(STATUS "Isle app: ${ISLE_BUILD_APP}")
message(STATUS "Config app: ${ISLE_BUILD_CONFIG}") message(STATUS "Config app: ${ISLE_BUILD_CONFIG}")
message(STATUS "Internal DirectX5 SDK: ${ISLE_USE_DX5}") message(STATUS "Internal DirectX5 SDK: ${ISLE_USE_DX5}")
message(STATUS "Internal miniwin: ${ISLE_MINIWIN}") message(STATUS "Internal miniwin: ${ISLE_MINIWIN}")
message(STATUS "USE SDL2: ${USE_SDL2}")
message(STATUS "Isle extensions: ${ISLE_EXTENSIONS}") message(STATUS "Isle extensions: ${ISLE_EXTENSIONS}")
message(STATUS "Isle debugging: ${ISLE_DEBUG}") message(STATUS "Isle debugging: ${ISLE_DEBUG}")
message(STATUS "Compile shaders: ${ISLE_COMPILE_SHADERS}") message(STATUS "Compile shaders: ${ISLE_COMPILE_SHADERS}")
@ -74,6 +104,7 @@ if (DOWNLOAD_DEPENDENCIES)
message(STATUS "Fetching SDL3 and iniparser. This might take a while...") message(STATUS "Fetching SDL3 and iniparser. This might take a while...")
include(FetchContent) include(FetchContent)
if(NOT USE_SDL2)
if(ANDROID) if(ANDROID)
# Built by Gradle # Built by Gradle
find_package(SDL3 REQUIRED CONFIG COMPONENTS Shared) find_package(SDL3 REQUIRED CONFIG COMPONENTS Shared)
@ -95,6 +126,7 @@ if (DOWNLOAD_DEPENDENCIES)
endif() endif()
FetchContent_MakeAvailable(SDL3) FetchContent_MakeAvailable(SDL3)
endif() endif()
endif()
FetchContent_Declare( FetchContent_Declare(
iniparser iniparser
@ -172,11 +204,19 @@ target_link_directories(DirectX5::DirectX5 INTERFACE "${CMAKE_SOURCE_DIR}/3rdpar
add_library(Vec::Vec INTERFACE IMPORTED) add_library(Vec::Vec INTERFACE IMPORTED)
target_include_directories(Vec::Vec INTERFACE "${CMAKE_SOURCE_DIR}/3rdparty/vec") target_include_directories(Vec::Vec INTERFACE "${CMAKE_SOURCE_DIR}/3rdparty/vec")
# if(WIIU) # elf2rpl does not like .a files
# add_executable(lego1
# LEGO1/main.cpp
# )
# set_target_properties(lego1 PROPERTIES ENABLE_EXPORTS TRUE)
# else()
add_library(lego1 add_library(lego1
LEGO1/main.cpp LEGO1/main.cpp
) )
# endif()
if(NOT WIIU)
target_precompile_headers(lego1 PRIVATE "LEGO1/lego1_pch.h") target_precompile_headers(lego1 PRIVATE "LEGO1/lego1_pch.h")
endif()
set_property(TARGET lego1 PROPERTY DEFINE_SYMBOL "LEGO1_DLL") set_property(TARGET lego1 PROPERTY DEFINE_SYMBOL "LEGO1_DLL")
target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/util>") target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/util>")
target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/extensions/include>") target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/extensions/include>")
@ -188,6 +228,9 @@ target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/L
target_link_libraries(lego1 PRIVATE SDL3::SDL3) target_link_libraries(lego1 PRIVATE SDL3::SDL3)
target_link_libraries(lego1 PUBLIC SDL3::Headers) target_link_libraries(lego1 PUBLIC SDL3::Headers)
target_link_libraries(lego1 PRIVATE $<$<BOOL:${ISLE_USE_DX5}>:DirectX5::DirectX5>) target_link_libraries(lego1 PRIVATE $<$<BOOL:${ISLE_USE_DX5}>:DirectX5::DirectX5>)
if(WIIU) # this is the only way to stop miniaudio atomics error when building isle.rpx and lego1.rpx
target_sources(lego1 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/atomic-dummy/atomic.c)
endif()
# Allow unconditional include of miniwin/miniwind3d.h # Allow unconditional include of miniwin/miniwind3d.h
target_link_libraries(lego1 PRIVATE miniwin-headers) target_link_libraries(lego1 PRIVATE miniwin-headers)
if(WIN32) if(WIN32)
@ -548,6 +591,9 @@ if (ISLE_BUILD_APP)
if (WIN32) if (WIN32)
target_link_libraries(isle PRIVATE winmm) target_link_libraries(isle PRIVATE winmm)
endif() endif()
if(WIIU) # this is the only way to stop miniaudio atomics error when building isle.rpx and lego1.rpx
target_sources(isle PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/atomic-dummy/atomic.c)
endif()
# Link LEGO1 # Link LEGO1
target_link_libraries(isle PRIVATE lego1) target_link_libraries(isle PRIVATE lego1)
if(ISLE_DEBUG) if(ISLE_DEBUG)
@ -598,6 +644,11 @@ if (ISLE_BUILD_APP)
ISLE/android/config.cpp ISLE/android/config.cpp
) )
endif() endif()
if(WIIU)
target_sources(isle PRIVATE
ISLE/wiiu/config.cpp
)
endif()
if(Python3_FOUND) if(Python3_FOUND)
if(NOT DEFINED PYTHON_PIL_AVAILABLE) if(NOT DEFINED PYTHON_PIL_AVAILABLE)
execute_process( execute_process(
@ -892,5 +943,28 @@ elseif(APPLE AND NOT IOS)
else() else()
set(CPACK_GENERATOR TGZ) set(CPACK_GENERATOR TGZ)
endif() endif()
if(WIIU)
# makes and links isle.rpx and lego1.rpl (Tiramisu/Legacy environment ONLY)
# wut_add_exports(lego1 "${CMAKE_SOURCE_DIR}/LEGO1/exports.def")
# wut_create_rpl(lego1)
# wut_link_rpl(isle lego1) # lego1.rpl won't be a rpl for now
wut_create_rpx(isle)
install(FILES "$<TARGET_FILE_DIR:isle>/isle.rpx" DESTINATION "${CMAKE_INSTALL_BINDIR}")
# install(FILES "$<TARGET_FILE_DIR:lego1>/lego1.rpl" DESTINATION "${CMAKE_INSTALL_PREFIX}/code")
if(BUILD_WUHB)
# i did some resreach idk if this works i will test it out when im done with tiramisu version
# makes isle.wuhb (Amroma environment ONLY)
wut_create_wuhb(isle_amr
TARGET isle-U
ICON "icon.tga"
TITLE "Lego Island"
AUTHOR "Lyelye"
)
install(FILES "$<TARGET_FILE_DIR:isle>/isle.wuhb" DESTINATION "${CMAKE_INSTALL_BINDIR}")
endif()
endif()
include(CPack) include(CPack)

View File

@ -194,6 +194,7 @@ bool CMainDialog::OnInitDialog()
m_ui->exFullResComboBox->setCurrentIndex(i); m_ui->exFullResComboBox->setCurrentIndex(i);
} }
} }
SDL_free(displayModes);
UpdateInterface(); UpdateInterface();
return true; return true;

View File

@ -65,6 +65,10 @@
#include "3ds/config.h" #include "3ds/config.h"
#endif #endif
#ifdef __WIIU__
#include "wiiu/config.h"
#endif
#ifdef WINDOWS_STORE #ifdef WINDOWS_STORE
#include "xbox_one_series/config.h" #include "xbox_one_series/config.h"
#endif #endif
@ -77,6 +81,13 @@
#include "android/config.h" #include "android/config.h"
#endif #endif
// i will figure out this someday
// #ifdef __WUT__
// int main(int argc, char** argv) {
//
// }
// #endif
DECOMP_SIZE_ASSERT(IsleApp, 0x8c) DECOMP_SIZE_ASSERT(IsleApp, 0x8c)
// GLOBAL: ISLE 0x410030 // GLOBAL: ISLE 0x410030
@ -289,7 +300,6 @@ void IsleApp::SetupVideoFlags(
m_videoParam.Flags().Set16Bit(1); m_videoParam.Flags().Set16Bit(1);
} }
} }
SDL_AppResult SDL_AppInit(void** appstate, int argc, char** argv) SDL_AppResult SDL_AppInit(void** appstate, int argc, char** argv)
{ {
*appstate = NULL; *appstate = NULL;
@ -345,6 +355,23 @@ SDL_AppResult SDL_AppInit(void** appstate, int argc, char** argv)
// Get reference to window // Get reference to window
*appstate = g_isle->GetWindowHandle(); *appstate = g_isle->GetWindowHandle();
// Currently, SDL doesn't send SDL_EVENT_MOUSE_ADDED at startup (unlike for gamepads)
// This will probably be fixed in the future: https://github.com/libsdl-org/SDL/issues/12815
{
int count;
SDL_MouseID* mice = SDL_GetMice(&count);
if (mice) {
for (int i = 0; i < count; i++) {
if (InputManager()) {
InputManager()->AddMouse(mice[i]);
}
}
SDL_free(mice);
}
}
#ifdef __EMSCRIPTEN__ #ifdef __EMSCRIPTEN__
SDL_AddEventWatch( SDL_AddEventWatch(
[](void* userdata, SDL_Event* event) -> bool { [](void* userdata, SDL_Event* event) -> bool {
@ -480,10 +507,16 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event)
if (event->key.repeat) { if (event->key.repeat) {
break; break;
} }
#if SDL_MAJOR_VERSION >= 3
SDL_Keycode keyCode = event->key.key; SDL_Keycode keyCode = event->key.key;
if ((event->key.mod & SDL_KMOD_LALT) && keyCode == SDLK_RETURN) { if ((event->key.mod & SDL_KMOD_LALT) && keyCode == SDLK_RETURN) {
#else
SDL_Keycode keyCode = event->key.keysym.sym;
if ((event->key.keysym.mod & SDL_KMOD_LALT) && keyCode == SDLK_RETURN) {
#endif
SDL_SetWindowFullscreen(window, !(SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN)); SDL_SetWindowFullscreen(window, !(SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN));
} }
else { else {
@ -493,6 +526,7 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event)
} }
break; break;
} }
#if SDSDL_MAJOR_VERSION >= 3
case SDL_EVENT_KEYBOARD_ADDED: case SDL_EVENT_KEYBOARD_ADDED:
if (InputManager()) { if (InputManager()) {
InputManager()->AddKeyboard(event->kdevice.which); InputManager()->AddKeyboard(event->kdevice.which);
@ -513,6 +547,7 @@ SDL_AppResult SDL_AppEvent(void* appstate, SDL_Event* event)
InputManager()->RemoveMouse(event->mdevice.which); InputManager()->RemoveMouse(event->mdevice.which);
} }
break; break;
#endif
case SDL_EVENT_GAMEPAD_ADDED: case SDL_EVENT_GAMEPAD_ADDED:
if (InputManager()) { if (InputManager()) {
InputManager()->AddJoystick(event->jdevice.which); InputManager()->AddJoystick(event->jdevice.which);
@ -879,20 +914,34 @@ MxResult IsleApp::SetupWindow()
m_cursorBusyBitmap = &busy_cursor; m_cursorBusyBitmap = &busy_cursor;
m_cursorNoBitmap = &no_cursor; m_cursorNoBitmap = &no_cursor;
#if SDL_MAJOR_VERSION >= 3
SDL_PropertiesID props = SDL_CreateProperties(); SDL_PropertiesID props = SDL_CreateProperties();
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER, g_targetWidth); SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_WIDTH_NUMBER, g_targetWidth);
SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER, g_targetHeight); SDL_SetNumberProperty(props, SDL_PROP_WINDOW_CREATE_HEIGHT_NUMBER, g_targetHeight);
SDL_SetBooleanProperty(props, SDL_PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN, m_fullScreen); SDL_SetBooleanProperty(props, SDL_PROP_WINDOW_CREATE_FULLSCREEN_BOOLEAN, m_fullScreen);
SDL_SetStringProperty(props, SDL_PROP_WINDOW_CREATE_TITLE_STRING, WINDOW_TITLE); SDL_SetStringProperty(props, SDL_PROP_WINDOW_CREATE_TITLE_STRING, WINDOW_TITLE);
#if defined(MINIWIN) && !defined(__3DS__) && !defined(WINDOWS_STORE) #endif
#if defined(MINIWIN) && !defined(__3DS__) && !defined(WINDOWS_STORE) && !defined(__WIIU__)
#if SDL_MAJOR_VERSION >= 3
SDL_SetBooleanProperty(props, SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN, true); SDL_SetBooleanProperty(props, SDL_PROP_WINDOW_CREATE_OPENGL_BOOLEAN, true);
#endif
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
#endif #endif
#if SDL_MAJOR_VERSION >= 3
window = SDL_CreateWindowWithProperties(props); window = SDL_CreateWindowWithProperties(props);
SDL_SetPointerProperty(SDL_GetWindowProperties(window), ISLE_PROP_WINDOW_CREATE_VIDEO_PARAM, &m_videoParam); SDL_SetPointerProperty(SDL_GetWindowProperties(window), ISLE_PROP_WINDOW_CREATE_VIDEO_PARAM, &m_videoParam);
#else
Uint32 flags = 0;
flags |= SDL_WINDOW_OPENGL;
if (m_fullScreen) {
flags |= SDL_WINDOW_FULLSCREEN;
}
window = SDL_CreateWindow(WINDOW_TITLE, g_targetWidth, g_targetHeight, flags);
SDL_SetWindowData(window, ISLE_PROP_WINDOW_CREATE_VIDEO_PARAM, &m_videoParam);
#endif
if (m_exclusiveFullScreen && m_fullScreen) { if (m_exclusiveFullScreen && m_fullScreen) {
SDL_DisplayMode closestMode; SDL_DisplayMode closestMode;
SDL_DisplayID displayID = SDL_GetDisplayForWindow(window); SDL_DisplayID displayID = SDL_GetDisplayForWindow(window);
@ -914,9 +963,9 @@ MxResult IsleApp::SetupWindow()
m_windowHandle = m_windowHandle =
(HWND) SDL_GetPointerProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL); (HWND) SDL_GetPointerProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL);
#endif #endif
#if SDL_MAJOR_VERSION >= 3
SDL_DestroyProperties(props); SDL_DestroyProperties(props);
#endif
if (!m_windowHandle) { if (!m_windowHandle) {
return FAILURE; return FAILURE;
} }
@ -1087,8 +1136,6 @@ bool IsleApp::LoadConfig()
iniparser_set(dict, "isle:Exclusive Y Resolution", SDL_itoa(m_exclusiveYRes, buf, 10)); iniparser_set(dict, "isle:Exclusive Y Resolution", SDL_itoa(m_exclusiveYRes, buf, 10));
iniparser_set(dict, "isle:Exclusive Framerate", SDL_itoa(m_exclusiveFrameRate, buf, 10)); iniparser_set(dict, "isle:Exclusive Framerate", SDL_itoa(m_exclusiveFrameRate, buf, 10));
iniparser_set(dict, "isle:Frame Delta", SDL_itoa(m_frameDelta, buf, 10)); iniparser_set(dict, "isle:Frame Delta", SDL_itoa(m_frameDelta, buf, 10));
iniparser_set(dict, "isle:MSAA", SDL_itoa(m_msaaSamples, buf, 10));
iniparser_set(dict, "isle:Anisotropic", SDL_itoa(m_anisotropic, buf, 10));
#ifdef EXTENSIONS #ifdef EXTENSIONS
iniparser_set(dict, "extensions", NULL); iniparser_set(dict, "extensions", NULL);
@ -1109,6 +1156,9 @@ bool IsleApp::LoadConfig()
#ifdef ANDROID #ifdef ANDROID
Android_SetupDefaultConfigOverrides(dict); Android_SetupDefaultConfigOverrides(dict);
#endif #endif
#ifdef __WIIU__
WIIU_SetupDefaultConfigOverrides(dict);
#endif
iniparser_dump_ini(dict, iniFP); iniparser_dump_ini(dict, iniFP);
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "New config written at '%s'", iniConfig.GetData()); SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "New config written at '%s'", iniConfig.GetData());

View File

@ -23,6 +23,7 @@ class IsleApp {
IsleApp(); IsleApp();
~IsleApp(); ~IsleApp();
void Run();
void Close(); void Close();
MxS32 SetupLegoOmni(); MxS32 SetupLegoOmni();

View File

@ -324,6 +324,9 @@
// GLOBAL: ISLE 0x411850 // GLOBAL: ISLE 0x411850
// __cflush // __cflush
// XGLOBAL ISLE 0x4125f8
// ?_pnhHeap@@3P6AHI@ZA
// GLOBAL: ISLE 0x412888 // GLOBAL: ISLE 0x412888
// ___setlc_active // ___setlc_active

14
ISLE/wiiu/config.cpp Normal file
View File

@ -0,0 +1,14 @@
#include "config.h"
#include <SDL3/SDL_log.h>
#include <iniparser.h>
// copy of 3ds config
void WIIU_SetupDefaultConfigOverrides(dictionary* p_dictionary)
{
SDL_Log("Overriding default config for Wii U");
iniparser_set(p_dictionary, "isle:diskpath", "sdmc:/wiiu/apps/isle-U/content/isle/LEGO");
iniparser_set(p_dictionary, "isle:cdpath", "sdmc:/wiiu/apps/isle-U/content/isle");
}

8
ISLE/wiiu/config.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef WIIU_CONFIG_H
#define WIIU_CONFIG_H
#include "dictionary.h"
void WIIU_SetupDefaultConfigOverrides(dictionary* p_dictionary);
#endif // WIIU_CONFIG_H

3
LEGO1/exports.def Normal file
View File

@ -0,0 +1,3 @@
:NAME lego1
:TEXT

View File

@ -14,24 +14,18 @@ class Act2Actor : public LegoAnimActor {
MxFloat m_position[3]; // 0x00 MxFloat m_position[3]; // 0x00
MxFloat m_direction[3]; // 0x0c MxFloat m_direction[3]; // 0x0c
const char* m_boundary; // 0x18 const char* m_boundary; // 0x18
MxBool m_cleared; // 0x1c MxBool m_unk0x1c; // 0x1c
};
enum VoiceOver {
e_head = 0,
e_behind = 1,
e_interrupt = 2,
}; };
Act2Actor(); Act2Actor();
void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_updateTransform) override; // vtable+0x24 void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) override; // vtable+0x24
void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30 void SetWorldSpeed(MxFloat p_worldSpeed) override; // vtable+0x30
// FUNCTION: LEGO1 0x1001a180 // FUNCTION: LEGO1 0x1001a180
MxS32 VTable0x68(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3) override MxS32 VTable0x68(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3) override
{ {
if (m_animatingHit) { if (m_unk0x1f) {
return 0; return 0;
} }
@ -41,16 +35,16 @@ class Act2Actor : public LegoAnimActor {
void Animate(float p_time) override; // vtable+0x70 void Animate(float p_time) override; // vtable+0x70
MxResult HitActor(LegoPathActor*, MxBool) override; // vtable+0x94 MxResult HitActor(LegoPathActor*, MxBool) override; // vtable+0x94
MxResult VTable0x9c() override; // vtable+0x9c MxResult VTable0x9c() override; // vtable+0x9c
MxS32 NextTargetLocation() override; // vtable+0xa0 MxS32 VTable0xa0() override; // vtable+0xa0
void InitializeNextShot(); void FUN_10018980();
void SetWorldSpeed(MxFloat p_speed, MxFloat p_resetWorldSpeedAt); void FUN_10019250(MxFloat p_speed, MxFloat p_param2);
void GoingToHide(); void FUN_10019520();
void Hide(); void FUN_10019560();
MxU32 UpdateShot(MxFloat p_time); MxU32 FUN_10019700(MxFloat p_param);
void PlayNextVoiceOver(MxS8 p_voiceOverType); void FUN_100199f0(MxS8 p_param);
void FindPath(MxU32 p_location); void FUN_100192a0(undefined4 p_location);
LegoEntity* GetNextEntity(MxBool* p_isBuilding); LegoEntity* FUN_10019b90(MxBool* p_param);
// SYNTHETIC: LEGO1 0x1001a0a0 // SYNTHETIC: LEGO1 0x1001a0a0
// Act2Actor::`scalar deleting destructor' // Act2Actor::`scalar deleting destructor'
@ -60,31 +54,22 @@ class Act2Actor : public LegoAnimActor {
// `vbtable' // `vbtable'
private: private:
enum { undefined m_unk0x1c; // 0x1c
e_readyToShoot = 0, MxS8 m_unk0x1d; // 0x1d
e_endShot = 1, undefined m_unk0x1e; // 0x1e
e_roaming = 2, MxBool m_unk0x1f; // 0x1f
e_createdBrick = 3, MxFloat m_unk0x20; // 0x20
e_goingToHide = 4, MxFloat m_unk0x24; // 0x24
e_hiding = 5, MxS8 m_unk0x28; // 0x28
}; MxFloat m_unk0x2c; // 0x2c
MxFloat m_unk0x30; // 0x30
MxBool m_skipAnimation; // 0x1c
MxS8 m_targetLocation; // 0x1d
MxU8 m_state; // 0x1e
MxBool m_animatingHit; // 0x1f
MxFloat m_animationDuration; // 0x20
MxFloat m_createBrickTime; // 0x24
MxS8 m_baseWorldSpeed; // 0x28
MxFloat m_shootAnimEnd; // 0x2c
MxFloat m_entityAnimationTime; // 0x30
LegoAnimActorStruct* m_shootAnim; // 0x34 LegoAnimActorStruct* m_shootAnim; // 0x34
LegoCacheSound* m_cachedShootSound; // 0x38 LegoCacheSound* m_unk0x38; // 0x38
undefined4 m_unk0x3c; // 0x3c undefined4 m_unk0x3c; // 0x3c
MxBool m_initializing; // 0x40 undefined m_unk0x40; // 0x40
MxFloat m_resetWorldSpeedAt; // 0x44 MxFloat m_unk0x44; // 0x44
MxS8 m_visitedLocations; // 0x48 MxS8 m_unk0x48; // 0x48
LegoEntity* m_nextEntity; // 0x4c LegoEntity* m_unk0x4c; // 0x4c
}; };
// TEMPLATE: LEGO1 0x100194f0 // TEMPLATE: LEGO1 0x100194f0

View File

@ -106,7 +106,7 @@ class Act3 : public LegoWorld {
MxResult Tickle() override; // vtable+0x08 MxResult Tickle() override; // vtable+0x08
// FUNCTION: LEGO1 0x10072500 // FUNCTION: LEGO1 0x10072500
MxBool WaitForTransition() override { return TRUE; } // vtable+0x5c MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c
// FUNCTION: LEGO1 0x10072510 // FUNCTION: LEGO1 0x10072510
// FUNCTION: BETA10 0x10017550 // FUNCTION: BETA10 0x10017550

View File

@ -18,7 +18,7 @@ class ElevatorBottom : public LegoWorld {
MxLong Notify(MxParam& p_param) override; // vtable+0x04 MxLong Notify(MxParam& p_param) override; // vtable+0x04
// FUNCTION: LEGO1 0x10017f10 // FUNCTION: LEGO1 0x10017f10
MxBool WaitForTransition() override { return TRUE; } // vtable+0x5c MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c
// FUNCTION: LEGO1 0x10017f20 // FUNCTION: LEGO1 0x10017f20
// FUNCTION: BETA10 0x10028130 // FUNCTION: BETA10 0x10028130

View File

@ -77,7 +77,7 @@ class GasStation : public LegoWorld {
MxResult Tickle() override; // vtable+0x08 MxResult Tickle() override; // vtable+0x08
// FUNCTION: LEGO1 0x10004770 // FUNCTION: LEGO1 0x10004770
MxBool WaitForTransition() override { return TRUE; } // vtable+0x5c MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c
// FUNCTION: LEGO1 0x10004780 // FUNCTION: LEGO1 0x10004780
// FUNCTION: BETA10 0x10029d40 // FUNCTION: BETA10 0x10029d40

View File

@ -79,7 +79,7 @@ class Hospital : public LegoWorld {
MxResult Tickle() override; // vtable+0x08 MxResult Tickle() override; // vtable+0x08
// FUNCTION: LEGO1 0x100746a0 // FUNCTION: LEGO1 0x100746a0
MxBool WaitForTransition() override { return TRUE; } // vtable+0x5c MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c
// FUNCTION: LEGO1 0x100746b0 // FUNCTION: LEGO1 0x100746b0
// FUNCTION: BETA10 0x1002e1a0 // FUNCTION: BETA10 0x1002e1a0

View File

@ -141,7 +141,7 @@ class Infocenter : public LegoWorld {
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
void ReadyWorld() override; // vtable+0x50 void ReadyWorld() override; // vtable+0x50
MxBool WaitForTransition() override; // vtable+0x5c MxBool VTable0x5c() override; // vtable+0x5c
MxBool Escape() override; // vtable+0x64 MxBool Escape() override; // vtable+0x64
void Enable(MxBool p_enable) override; // vtable+0x68 void Enable(MxBool p_enable) override; // vtable+0x68

View File

@ -17,7 +17,7 @@ class InfocenterDoor : public LegoWorld {
MxLong Notify(MxParam& p_param) override; // vtable+0x04 MxLong Notify(MxParam& p_param) override; // vtable+0x04
// FUNCTION: LEGO1 0x100377a0 // FUNCTION: LEGO1 0x100377a0
MxBool WaitForTransition() override { return TRUE; } // vtable+0x5c MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c
// FUNCTION: LEGO1 0x100377b0 // FUNCTION: LEGO1 0x100377b0
// FUNCTION: BETA10 0x10032790 // FUNCTION: BETA10 0x10032790

View File

@ -134,7 +134,7 @@ class Isle : public LegoWorld {
MxLong Notify(MxParam& p_param) override; // vtable+0x04 MxLong Notify(MxParam& p_param) override; // vtable+0x04
// FUNCTION: LEGO1 0x10030900 // FUNCTION: LEGO1 0x10030900
MxBool WaitForTransition() override { return TRUE; } // vtable+0x5c MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c
// FUNCTION: LEGO1 0x10030910 // FUNCTION: LEGO1 0x10030910
// FUNCTION: BETA10 0x10035d70 // FUNCTION: BETA10 0x10035d70

View File

@ -60,7 +60,7 @@ class JukeBox : public LegoWorld {
MxResult Tickle() override; // vtable+0x08 MxResult Tickle() override; // vtable+0x08
// FUNCTION: LEGO1 0x1005d6e0 // FUNCTION: LEGO1 0x1005d6e0
MxBool WaitForTransition() override { return TRUE; } // vtable+0x5c MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c
// FUNCTION: LEGO1 0x1005d6f0 // FUNCTION: LEGO1 0x1005d6f0
// FUNCTION: BETA10 0x100388d0 // FUNCTION: BETA10 0x100388d0

View File

@ -71,7 +71,7 @@ class LegoAct2 : public LegoWorld {
void ReadyWorld() override; // vtable+0x50 void ReadyWorld() override; // vtable+0x50
// FUNCTION: LEGO1 0x1004fe10 // FUNCTION: LEGO1 0x1004fe10
MxBool WaitForTransition() override { return TRUE; } // vtable+0x5c MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c
void VTable0x60() override; // vtable+0x60 void VTable0x60() override; // vtable+0x60
MxBool Escape() override; // vtable+0x64 MxBool Escape() override; // vtable+0x64
@ -80,10 +80,10 @@ class LegoAct2 : public LegoWorld {
void SetUnknown0x1138(Act2Actor* p_unk0x1138) { m_unk0x1138 = p_unk0x1138; } void SetUnknown0x1138(Act2Actor* p_unk0x1138) { m_unk0x1138 = p_unk0x1138; }
void SetDestLocation(LegoGameState::Area p_destLocation) { m_destLocation = p_destLocation; } void SetDestLocation(LegoGameState::Area p_destLocation) { m_destLocation = p_destLocation; }
MxResult CreateBrick(); MxResult FUN_100516b0();
void FUN_100517b0(); void FUN_100517b0();
MxResult BadEnding(); MxResult BadEnding();
MxResult StartAction( MxResult FUN_10052560(
Act2mainScript::Script p_objectId, Act2mainScript::Script p_objectId,
MxBool p_param2, MxBool p_param2,
MxBool p_param3, MxBool p_param3,
@ -96,59 +96,42 @@ class LegoAct2 : public LegoWorld {
// LegoAct2::`scalar deleting destructor' // LegoAct2::`scalar deleting destructor'
private: private:
enum {
e_initial = 0,
e_startSpeech = 1,
e_holdingSpeech = 2,
e_startDescription = 3,
e_explaining = 4,
e_goingToResidentialArea = 5,
e_atResidentialArea = 6,
e_chase = 7,
e_droppingBrick = 9,
e_goingToHide = 10,
e_hidden = 11,
e_distributeRemainingBricks = 12,
e_brickHunt = 13,
e_allPiecesCollected = 14,
};
MxLong HandleEndAction(MxEndActionNotificationParam& p_param); MxLong HandleEndAction(MxEndActionNotificationParam& p_param);
MxLong HandleTransitionEnd(); MxLong HandleTransitionEnd();
MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param); MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param);
void PlayMusic(JukeboxScript::Script p_objectId); void PlayMusic(JukeboxScript::Script p_objectId);
void FUN_10051900(); void FUN_10051900();
void HideMaPaInfo(); void FUN_10051960();
void InitBricks(); void InitBricks();
void UninitBricks(); void UninitBricks();
void SpawnBricks(); void SpawnBricks();
void CheckBricksterDestroying(MxS32 p_pathData); void FUN_10051fa0(MxS32 p_param1);
void CheckBricksterIsLoose(MxS32 p_pathData); void FUN_100521f0(MxS32 p_param1);
MxResult InitializeShooting(); MxResult FUN_10052800();
Act2Brick m_bricks[10]; // 0x00f8 Act2Brick m_bricks[10]; // 0x00f8
MxU8 m_nextBrick; // 0x10c0 MxU8 m_nextBrick; // 0x10c0
MxU8 m_removedBricks; // 0x10c1 undefined m_unk0x10c1; // 0x10c1
MxBool m_ready; // 0x10c2 MxBool m_ready; // 0x10c2
undefined4 m_state; // 0x10c4 undefined4 m_unk0x10c4; // 0x10c4
JukeboxScript::Script m_music; // 0x10c8 JukeboxScript::Script m_music; // 0x10c8
LegoAct2State* m_gameState; // 0x10cc LegoAct2State* m_gameState; // 0x10cc
MxS32 m_timeSinceLastStage; // 0x10d0 MxS32 m_unk0x10d0; // 0x10d0
// variable name verified by BETA10 0x10014633 // variable name verified by BETA10 0x10014633
const char* m_siFile; // 0x10d4 const char* m_siFile; // 0x10d4
LegoROI* m_pepper; // 0x10d8 LegoROI* m_pepper; // 0x10d8
MxMatrix m_transformOnDisable; // 0x10dc MxMatrix m_unk0x10dc; // 0x10dc
LegoPathBoundary* m_boundaryOnDisable; // 0x1124 LegoPathBoundary* m_unk0x1124; // 0x1124
LegoROI* m_ambulance; // 0x1128 LegoROI* m_ambulance; // 0x1128
undefined4 m_unk0x112c; // 0x112c undefined4 m_unk0x112c; // 0x112c
undefined4 m_unk0x1130; // 0x1130 undefined4 m_unk0x1130; // 0x1130
undefined4 m_unk0x1134; // 0x1134 undefined4 m_unk0x1134; // 0x1134
Act2Actor* m_unk0x1138; // 0x1138 Act2Actor* m_unk0x1138; // 0x1138
undefined m_unk0x113c; // 0x113c undefined m_unk0x113c; // 0x113c
Act2mainScript::Script m_currentAction; // 0x1140 Act2mainScript::Script m_unk0x1140; // 0x1140
Act2mainScript::Script m_infomanDirecting; // 0x1144 Act2mainScript::Script m_unk0x1144; // 0x1144
undefined4 m_unk0x1148; // 0x1148 undefined4 m_unk0x1148; // 0x1148
undefined m_firstBrick; // 0x114c undefined m_firstBrick; // 0x114c
undefined m_secondBrick; // 0x114d undefined m_secondBrick; // 0x114d

View File

@ -41,7 +41,7 @@ class LegoActor : public LegoEntity {
} }
void ParseAction(char* p_extra) override; // vtable+0x20 void ParseAction(char* p_extra) override; // vtable+0x20
void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_updateTransform) override; // vtable+0x24 void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) override; // vtable+0x24
// FUNCTION: LEGO1 0x10002cc0 // FUNCTION: LEGO1 0x10002cc0
// FUNCTION: BETA10 0x1000f3e0 // FUNCTION: BETA10 0x1000f3e0

View File

@ -232,7 +232,7 @@ class LegoAnimationManager : public MxCore {
MxBool FUN_100623a0(AnimInfo& p_info); MxBool FUN_100623a0(AnimInfo& p_info);
MxBool ModelExists(AnimInfo& p_info, const char* p_name); MxBool ModelExists(AnimInfo& p_info, const char* p_name);
void FUN_10062580(AnimInfo& p_info); void FUN_10062580(AnimInfo& p_info);
MxBool FUN_10062650(Mx3DPointFloat& p_position, float p_und, LegoROI* p_roi); MxBool FUN_10062650(Vector3& p_position, float p_und, LegoROI* p_roi);
MxBool FUN_10062710(AnimInfo& p_info); MxBool FUN_10062710(AnimInfo& p_info);
MxBool FUN_10062e20(LegoROI* p_roi, LegoAnimPresenter* p_presenter); MxBool FUN_10062e20(LegoROI* p_roi, LegoAnimPresenter* p_presenter);
void FUN_10063950(LegoROI* p_roi); void FUN_10063950(LegoROI* p_roi);

View File

@ -22,11 +22,11 @@ class MxActionNotificationParam;
class LegoVehicleBuildState : public LegoState { class LegoVehicleBuildState : public LegoState {
public: public:
enum AnimationState { enum AnimationState {
e_none = 0, e_unknown0 = 0,
e_entering = 1, e_entering = 1,
e_settingUpMovie = 2, e_unknown2 = 2,
e_cutscene = 3, e_cutscene = 3,
e_finishedBuild = 4, e_unknown4 = 4,
e_exiting = 6 e_exiting = 6
}; };
@ -59,9 +59,9 @@ class LegoVehicleBuildState : public LegoState {
MxString m_className; // 0x38 MxString m_className; // 0x38
AnimationState m_animationState; // 0x48 AnimationState m_animationState; // 0x48
MxU8 m_introductionCounter; // 0x4c MxU8 m_unk0x4c; // 0x4c
MxBool m_finishedBuild; // 0x4d MxBool m_unk0x4d; // 0x4d
MxBool m_playedExitScript; // 0x4e MxBool m_unk0x4e; // 0x4e
MxU8 m_placedPartCount; // 0x4f MxU8 m_placedPartCount; // 0x4f
}; };
@ -77,28 +77,18 @@ class LegoCarBuild : public LegoWorld {
public: public:
// SIZE 0x1c // SIZE 0x1c
struct LookupTableActions { struct LookupTableActions {
MxU32 m_introduction0; // 0x00 undefined4 m_unk0x00; // 0x00
MxU32 m_leaveUnfinished; // 0x04 undefined4 m_unk0x04; // 0x04
MxU32 m_completed; // 0x08 undefined4 m_unk0x08; // 0x08
MxU32 m_introduction1; // 0x0c undefined4 m_unk0x0c; // 0x0c
MxU32 m_introduction2; // 0x10 undefined4 m_unk0x10; // 0x10
MxU32 m_introduction3; // 0x14 undefined4 m_unk0x14; // 0x14
MxU32 m_shortExplanation; // 0x18 undefined4 m_unk0x18; // 0x18
}; };
enum LookupTableActionType { enum Unknown0xf8 {
e_introduction0 = 0, c_unknownminusone = -1,
e_introduction1 = 1, c_unknown8 = 8
e_introduction2 = 2,
e_introduction3 = 3,
e_leaveUnfinished = 4,
e_completed = 5,
e_shortExplanation = 6,
};
enum ResetPlacedSelectedPart {
c_disabled = -1,
c_enabled = 8
}; };
LegoCarBuild(); LegoCarBuild();
@ -106,7 +96,7 @@ class LegoCarBuild : public LegoWorld {
// FUNCTION: LEGO1 0x10022930 // FUNCTION: LEGO1 0x10022930
// FUNCTION: BETA10 0x10070070 // FUNCTION: BETA10 0x10070070
MxBool WaitForTransition() override { return TRUE; } // vtable+0x5c MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c
// FUNCTION: LEGO1 0x10022940 // FUNCTION: LEGO1 0x10022940
// FUNCTION: BETA10 0x10070090 // FUNCTION: BETA10 0x10070090
@ -129,11 +119,11 @@ class LegoCarBuild : public LegoWorld {
void ReadyWorld() override; // vtable+0x50 void ReadyWorld() override; // vtable+0x50
MxBool Escape() override; // vtable+0x64 MxBool Escape() override; // vtable+0x64
void Enable(MxBool p_enable) override; // vtable+0x68 void Enable(MxBool p_enable) override; // vtable+0x68
virtual void InitializeDisplayingTransform(); // vtable+0x6c virtual void VTable0x6c(); // vtable+0x6c
virtual void CalculateStartAndTargetScreenPositions(); // vtable+0x70 virtual void VTable0x70(); // vtable+0x70
virtual void CalculateDragPositionAbove(MxFloat p_coordinates[2], MxFloat p_position[3]); // vtable+0x74 virtual void VTable0x74(MxFloat p_param1[2], MxFloat p_param2[3]); // vtable+0x74
virtual void CalculateDragPositionBetween(MxFloat p_coordinates[2], MxFloat p_position[3]); // vtable+0x78 virtual void VTable0x78(MxFloat p_param1[2], MxFloat p_param2[3]); // vtable+0x78
virtual void CalculateDragPositionOnGround(MxFloat p_coordinates[2], MxFloat p_position[3]); // vtable+0x7c virtual void VTable0x7c(MxFloat p_param1[2], MxFloat p_param2[3]); // vtable+0x7c
virtual void VTable0x80( virtual void VTable0x80(
MxFloat p_param1[2], MxFloat p_param1[2],
MxFloat p_param2[2], MxFloat p_param2[2],
@ -144,33 +134,33 @@ class LegoCarBuild : public LegoWorld {
MxS16 GetPlacedPartCount(); MxS16 GetPlacedPartCount();
void SetPlacedPartCount(MxU8 p_placedPartCount); void SetPlacedPartCount(MxU8 p_placedPartCount);
void InitPresenters(); void InitPresenters();
void DisplaySelectedPart(); void FUN_10022f00();
void ResetSelectedPart(); void FUN_10022f30();
void CalculateSelectedPartMatrix(MxLong p_x, MxLong p_y); void FUN_10023130(MxLong p_x, MxLong p_y);
void AddSelectedPartToBuild(); void AddSelectedPartToBuild();
MxLong HandleKeyPress(LegoEventNotificationParam* p_param); undefined4 FUN_10024250(LegoEventNotificationParam* p_param);
void InitExiting(); void FUN_100243a0();
MxLong HandleEndAction(MxActionNotificationParam* p_param); undefined4 FUN_10024480(MxActionNotificationParam* p_param);
MxLong SelectPartFromMousePosition(MxLong p_x, MxLong p_y); undefined4 SelectPartFromMousePosition(MxLong p_x, MxLong p_y);
MxLong HandleButtonUp(MxLong p_x, MxLong p_y); undefined4 FUN_100246e0(MxLong p_x, MxLong p_y);
MxLong HandleMouseMove(MxLong p_x, MxLong p_y); MxS32 FUN_10024850(MxLong p_x, MxLong p_y);
MxLong HandleControl(MxParam* p_param); undefined4 FUN_10024890(MxParam* p_param);
MxLong HandleType0Notification(MxNotificationParam* p_param); undefined4 FUN_10024c20(MxNotificationParam* p_param);
void StartIntroduction(); void FUN_10024ef0();
void MoveShelves(); void FUN_10024f30();
void RotateVehicle(); void FUN_10024f50();
void EnableColorControlsForSelectedPart(MxBool p_enabled); void FUN_10024f70(MxBool p_enabled);
void SetColorControlsEnabled(MxBool p_enabled); void SetPresentersEnabled(MxBool p_enabled);
void ToggleColorControlsEnabled(); void TogglePresentersEnabled();
void EnableDecalForSelectedPart(MxBool p_enabled); void FUN_100250e0(MxBool p_param);
void SetPartColor(MxS32 p_objectId); void FUN_10025350(MxS32 p_objectId);
void CalculateStartAndTargetTransforms(); void FUN_10025450();
void StartActorScriptByType(MxS32 p_actionType); void FUN_10025720(undefined4 p_param1);
void StartActorScript(MxS32 p_streamId); void FUN_10025d10(MxS32 p_param);
MxS32 GetNextIntroduction(); MxS32 FUN_10025d70();
void TickleControl(const char* p_controlName, MxULong p_time); void FUN_10025db0(const char* p_param1, undefined4 p_param2);
void HandleEndAnim(); void FUN_10025e40();
MxS32 GetBuildMovieId(MxS32 p_carId); MxS32 FUN_10025ee0(undefined4 p_param1);
// FUNCTION: BETA10 0x100735b0 // FUNCTION: BETA10 0x100735b0
void SetCarBuildAnimPresenter(LegoCarBuildAnimPresenter* p_animPresenter) { m_animPresenter = p_animPresenter; } void SetCarBuildAnimPresenter(LegoCarBuildAnimPresenter* p_animPresenter) { m_animPresenter = p_animPresenter; }
@ -179,45 +169,43 @@ class LegoCarBuild : public LegoWorld {
// LegoCarBuild::`scalar deleting destructor' // LegoCarBuild::`scalar deleting destructor'
private: private:
enum {
e_idle = 0,
e_returning = 3,
e_selecting = 4,
e_displaying = 5,
e_dragging = 6,
};
// inline functions // inline functions
MxU32 GetLookupIndex(); MxU32 Beta0x10070520();
void StopPlayingActorScript(); void StopActionIn0x344();
ResetPlacedSelectedPart m_resetPlacedSelectedPart; // 0xf8 Unknown0xf8 m_unk0xf8; // 0xf8
MxS16 m_rotateBuild; // 0xfc MxS16 m_unk0xfc; // 0xfc
MxS32 m_clickState; // 0x100 MxS32 m_unk0x100; // 0x100
undefined4 m_unk0x104; // 0x104 undefined4 m_unk0x104; // 0x104
// name verified by BETA10 0x1006ebba // name verified by BETA10 0x1006ebba
MxS8 m_numAnimsRun; // 0x108 MxS8 m_numAnimsRun; // 0x108
MxU8 m_missclickCounter; // 0x109 MxU8 m_unk0x109; // 0x109
MxU16 m_lastActorScript; // 0x10a MxU16 m_unk0x10a; // 0x10a
Uint64 m_lastActorScriptStartTime; // 0x10c Uint64 m_unk0x10c; // 0x10c
LegoROI* m_selectedPart; // 0x110 LegoROI* m_selectedPart; // 0x110
BoundingSphere m_targetBoundingSphere; // 0x114 BoundingSphere m_unk0x114; // 0x114
MxMatrix m_originalSelectedPartTransform; // 0x12c MxMatrix m_unk0x12c; // 0x12c
MxBool m_alreadyFinished; // 0x174 undefined m_unk0x174; // 0x174
MxMatrix m_selectedPartStartTransform; // 0x178 MxMatrix m_unk0x178; // 0x178
MxMatrix m_displayTransform; // 0x1c0 MxMatrix m_unk0x1c0; // 0x1c0
MxMatrix m_selectedPartTargetTransform; // 0x208 MxMatrix m_unk0x208; // 0x208
MxS32 m_selectedPartStartMousePosition[2]; // 0x250
// This is likely a location in pixel space
MxS32 m_unk0x250[2]; // 0x250
LegoCarBuildAnimPresenter* m_animPresenter; // 0x258 LegoCarBuildAnimPresenter* m_animPresenter; // 0x258
MxQuaternionTransformer m_draggingQuarternionTransformer; // 0x25c MxQuaternionTransformer m_unk0x25c; // 0x25c
MxS32 m_selectedPartStartScreenPosition[2]; // 0x290
MxS32 m_selectedPartTargetScreenPosition[2]; // 0x298 // These two are likely locations in pixel space
MxFloat m_normalizedDistance; // 0x2a0 MxS32 m_unk0x290[2]; // 0x290
Mx4DPointFloat m_selectedPartStartPosition; // 0x2a4 MxS32 m_unk0x298[2]; // 0x298
Mx4DPointFloat m_selectedPartTargetPosition; // 0x2bc
MxBool m_displayedPartIsPlaced; // 0x2d4 MxFloat m_unk0x2a0; // 0x2a0
Mx4DPointFloat m_unk0x2a4; // 0x2a4
Mx4DPointFloat m_unk0x2bc; // 0x2bc
MxBool m_selectedPartIsPlaced; // 0x2d4
// variable names verified by BETA10 0x1006b27a // variable names verified by BETA10 0x1006b27a
MxStillPresenter* m_ColorBook_Bitmap; // 0x2dc MxStillPresenter* m_ColorBook_Bitmap; // 0x2dc
@ -246,21 +234,21 @@ class LegoCarBuild : public LegoWorld {
LegoVehicleBuildState* m_buildState; // 0x32c LegoVehicleBuildState* m_buildState; // 0x32c
// variable name verified by BETA10 0x1006d742 // variable name verified by BETA10 0x1006d742
MxS32 m_carId; // 0x330 undefined4 m_carId; // 0x330
// variable name verified by BETA10 0x1006cba7 // variable name verified by BETA10 0x1006cba7
LegoGameState::Area m_destLocation; // 0x334 LegoGameState::Area m_destLocation; // 0x334
MxPresenter* m_jukeboxPresenter; // 0x338 MxPresenter* m_unk0x338; // 0x338
MxControlPresenter* m_tickledControl; // 0x33c MxControlPresenter* m_unk0x33c; // 0x33c
undefined4 m_unk0x340; // 0x340 undefined4 m_unk0x340; // 0x340
MxS32 m_playingActorScript; // 0x344 undefined4 m_unk0x344; // 0x344
MxU8 m_presentersEnabled; // 0x348 MxU8 m_presentersEnabled; // 0x348
static MxS16 g_lastTickleState; static MxS16 g_unk0x100f11cc;
static MxFloat g_selectedPartRotationAngleStepYAxis; static MxFloat g_unk0x100d65a4;
static MxFloat g_rotationAngleStepYAxis; static MxFloat g_rotationAngleStepYAxis;
static LookupTableActions g_actorScripts[]; static LookupTableActions g_unk0x100d65b0[];
}; };
#endif // LEGOCARBUILD_H #endif // LEGOCARBUILD_H

View File

@ -21,10 +21,10 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter {
}; };
// SIZE 0x0c // SIZE 0x0c
struct CarBuildPart { struct UnknownListEntry {
// FUNCTION: LEGO1 0x100795c0 // FUNCTION: LEGO1 0x100795c0
// FUNCTION: BETA10 0x10073850 // FUNCTION: BETA10 0x10073850
CarBuildPart() UnknownListEntry()
{ {
m_name = NULL; m_name = NULL;
m_wiredName = NULL; m_wiredName = NULL;
@ -74,7 +74,7 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter {
virtual MxResult Serialize(LegoStorage* p_storage); virtual MxResult Serialize(LegoStorage* p_storage);
void MakePartPlaced(MxS16 p_index); void FUN_10079050(MxS16 p_index);
void SwapNodesByName(LegoChar* p_param1, LegoChar* p_param2); void SwapNodesByName(LegoChar* p_param1, LegoChar* p_param2);
void InitBuildPlatform(); void InitBuildPlatform();
void HideBuildPartByName(LegoChar* p_param); void HideBuildPartByName(LegoChar* p_param);
@ -83,7 +83,7 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter {
LegoTreeNode* FindNodeByName(LegoTreeNode* p_treeNode, const LegoChar* p_name); LegoTreeNode* FindNodeByName(LegoTreeNode* p_treeNode, const LegoChar* p_name);
void AddPartToBuildByName(const LegoChar* p_name); void AddPartToBuildByName(const LegoChar* p_name);
void RotateAroundYAxis(MxFloat p_angle); void RotateAroundYAxis(MxFloat p_angle);
MxBool IsNextPartToPlace(const LegoChar* p_name); MxBool FUN_10079c30(const LegoChar* p_name);
MxBool PartIsPlaced(const LegoChar* p_name); MxBool PartIsPlaced(const LegoChar* p_name);
void MoveShelfForward(); void MoveShelfForward();
MxBool StringEqualsPlatform(const LegoChar* p_string); MxBool StringEqualsPlatform(const LegoChar* p_string);
@ -102,7 +102,7 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter {
MxBool StringEndsOnW(LegoChar* p_param); MxBool StringEndsOnW(LegoChar* p_param);
MxBool StringEndsOnYOrN(const LegoChar* p_string); MxBool StringEndsOnYOrN(const LegoChar* p_string);
const BoundingSphere& GetTargetBoundingSphere(); const BoundingSphere& FUN_10079e20();
// FUNCTION: BETA10 0x100703e0 // FUNCTION: BETA10 0x100703e0
const LegoChar* GetWiredNameOfLastPlacedPart() { return m_parts[m_placedPartCount].m_wiredName; } const LegoChar* GetWiredNameOfLastPlacedPart() { return m_parts[m_placedPartCount].m_wiredName; }
@ -121,7 +121,7 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter {
// LegoCarBuildAnimPresenter::`scalar deleting destructor' // LegoCarBuildAnimPresenter::`scalar deleting destructor'
private: private:
void UpdateFlashingPartVisibility(); void Beta10Inline0x100733d0();
MxU16 m_shelfState; // 0xbc MxU16 m_shelfState; // 0xbc
@ -136,13 +136,13 @@ class LegoCarBuildAnimPresenter : public LegoAnimPresenter {
MxMatrix m_buildViewMatrix; // 0xe0 MxMatrix m_buildViewMatrix; // 0xe0
// variable name verified by BETA10 0x100719f0 // variable name verified by BETA10 0x100719f0
CarBuildPart* m_parts; // 0x128 UnknownListEntry* m_parts; // 0x128
MxFloat m_shelfFrameBuffer; // 0x12c MxFloat m_shelfFrameBuffer; // 0x12c
MxFloat m_shelfFrame; // 0x130 MxFloat m_shelfFrame; // 0x130
MxFloat m_shelfFrameMax; // 0x134 MxFloat m_shelfFrameMax; // 0x134
MxFloat m_shelfFrameInterval; // 0x138 MxFloat m_shelfFrameInterval; // 0x138
MxULong m_flashingPartTimeState; // 0x13c MxULong m_unk0x13c; // 0x13c
LegoEntity* m_carBuildEntity; // 0x140 LegoEntity* m_carBuildEntity; // 0x140
MxS32 m_unk0x144; // 0x144 MxS32 m_unk0x144; // 0x144
MxS32 m_unk0x148; // 0x148 MxS32 m_unk0x148; // 0x148

View File

@ -56,7 +56,7 @@ class LegoEntity : public MxEntity {
virtual MxResult Create(MxDSAction& p_dsAction); // vtable+0x18 virtual MxResult Create(MxDSAction& p_dsAction); // vtable+0x18
virtual void Destroy(MxBool p_fromDestructor); // vtable+0x1c virtual void Destroy(MxBool p_fromDestructor); // vtable+0x1c
virtual void ParseAction(char* p_extra); // vtable+0x20 virtual void ParseAction(char* p_extra); // vtable+0x20
virtual void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_updateTransform); // vtable+0x24 virtual void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2); // vtable+0x24
virtual void SetWorldTransform( virtual void SetWorldTransform(
const Vector3& p_location, const Vector3& p_location,
const Vector3& p_direction, const Vector3& p_direction,

View File

@ -8,6 +8,7 @@
#include "mxpresenter.h" #include "mxpresenter.h"
#include "mxqueue.h" #include "mxqueue.h"
#include <SDL3/SDL.h>
#include <SDL3/SDL_haptic.h> #include <SDL3/SDL_haptic.h>
#include <SDL3/SDL_joystick.h> #include <SDL3/SDL_joystick.h>
#include <SDL3/SDL_keyboard.h> #include <SDL3/SDL_keyboard.h>
@ -129,13 +130,14 @@ class LegoInputManager : public MxPresenter {
void SetWorld(LegoWorld* p_world); void SetWorld(LegoWorld* p_world);
void ClearWorld(); void ClearWorld();
void SetUnknown88(MxBool p_unk0x88) { m_unk0x88 = p_unk0x88; }
void SetUnknown335(MxBool p_unk0x335) { m_unk0x335 = p_unk0x335; } void SetUnknown335(MxBool p_unk0x335) { m_unk0x335 = p_unk0x335; }
void SetUnknown336(MxBool p_unk0x336) { m_unk0x336 = p_unk0x336; } void SetUnknown336(MxBool p_unk0x336) { m_unk0x336 = p_unk0x336; }
// FUNCTION: BETA10 0x1002e390 // FUNCTION: BETA10 0x1002e290
void DisableInputProcessing() void DisableInputProcessing()
{ {
m_inputProcessingDisabled = TRUE; m_unk0x88 = TRUE;
m_unk0x336 = FALSE; m_unk0x336 = FALSE;
} }
@ -191,7 +193,7 @@ class LegoInputManager : public MxPresenter {
MxBool m_unk0x80; // 0x80 MxBool m_unk0x80; // 0x80
MxBool m_unk0x81; // 0x81 MxBool m_unk0x81; // 0x81
LegoControlManager* m_controlManager; // 0x84 LegoControlManager* m_controlManager; // 0x84
MxBool m_inputProcessingDisabled; // 0x88 MxBool m_unk0x88; // 0x88
const bool* m_keyboardState; const bool* m_keyboardState;
MxBool m_unk0x195; // 0x195 MxBool m_unk0x195; // 0x195
MxBool m_unk0x335; // 0x335 MxBool m_unk0x335; // 0x335

View File

@ -99,7 +99,7 @@ class LegoPathActor : public LegoActor {
// FUNCTION: LEGO1 0x10002d60 // FUNCTION: LEGO1 0x10002d60
// FUNCTION: BETA10 0x1000f820 // FUNCTION: BETA10 0x1000f820
virtual MxS32 NextTargetLocation() { return 0; } // vtable+0xa0 virtual MxS32 VTable0xa0() { return 0; } // vtable+0xa0
virtual void VTable0xa4(MxBool& p_und1, MxS32& p_und2); // vtable+0xa4 virtual void VTable0xa4(MxBool& p_und1, MxS32& p_und2); // vtable+0xa4
virtual void VTable0xa8(); // vtable+0xa8 virtual void VTable0xa8(); // vtable+0xa8

View File

@ -153,7 +153,7 @@ class LegoRace : public LegoWorld {
} }
// FUNCTION: LEGO1 0x1000dae0 // FUNCTION: LEGO1 0x1000dae0
MxBool WaitForTransition() override { return TRUE; } // vtable+0x5c MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c
void Enable(MxBool p_enable) override; // vtable+0x68 void Enable(MxBool p_enable) override; // vtable+0x68

View File

@ -52,13 +52,13 @@ class LegoWorld : public LegoEntity {
MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18 MxResult Create(MxDSAction& p_dsAction) override; // vtable+0x18
void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c void Destroy(MxBool p_fromDestructor) override; // vtable+0x1c
virtual void ReadyWorld(); // vtable+0x50 virtual void ReadyWorld(); // vtable+0x50
virtual LegoCameraController* InitializeCameraController(); // vtable+0x54 virtual LegoCameraController* VTable0x54(); // vtable+0x54
virtual void Add(MxCore* p_object); // vtable+0x58 virtual void Add(MxCore* p_object); // vtable+0x58
// The BETA10 match could also be LegoWorld::Escape(), only the child classes might be able to tell // The BETA10 match could also be LegoWorld::Escape(), only the child classes might be able to tell
// FUNCTION: LEGO1 0x1001d670 // FUNCTION: LEGO1 0x1001d670
// FUNCTION: BETA10 0x10017530 // FUNCTION: BETA10 0x10017530
virtual MxBool WaitForTransition() { return FALSE; } // vtable+0x5c virtual MxBool VTable0x5c() { return FALSE; } // vtable+0x5c
// FUNCTION: LEGO1 0x100010a0 // FUNCTION: LEGO1 0x100010a0
virtual void VTable0x60() {} // vtable+0x60 virtual void VTable0x60() {} // vtable+0x60
@ -102,8 +102,8 @@ class LegoWorld : public LegoEntity {
); );
void RemoveActor(LegoPathActor* p_actor); void RemoveActor(LegoPathActor* p_actor);
MxBool ActorExists(LegoPathActor* p_actor); MxBool ActorExists(LegoPathActor* p_actor);
void AddPresenterIfInRange(LegoAnimPresenter* p_presenter); void FUN_1001fda0(LegoAnimPresenter* p_presenter);
void RemovePresenterFromBoundaries(LegoAnimPresenter* p_presenter); void FUN_1001fe90(LegoAnimPresenter* p_presenter);
LegoPathBoundary* FindPathBoundary(const char* p_name); LegoPathBoundary* FindPathBoundary(const char* p_name);
void AddPath(LegoPathController* p_controller); void AddPath(LegoPathController* p_controller);
MxResult GetCurrPathInfo(LegoPathBoundary** p_boundaries, MxS32& p_numL); MxResult GetCurrPathInfo(LegoPathBoundary** p_boundaries, MxS32& p_numL);
@ -115,7 +115,7 @@ class LegoWorld : public LegoEntity {
LegoEntityList* GetEntityList() { return m_entityList; } LegoEntityList* GetEntityList() { return m_entityList; }
LegoOmni::World GetWorldId() { return m_worldId; } LegoOmni::World GetWorldId() { return m_worldId; }
MxBool NoDisabledObjects() { return m_disabledObjects.empty(); } MxBool GetUnknown0xd0Empty() { return m_set0xd0.empty(); }
list<LegoROI*>& GetROIList() { return m_roiList; } list<LegoROI*>& GetROIList() { return m_roiList; }
LegoHideAnimPresenter* GetHideAnimPresenter() { return m_hideAnim; } LegoHideAnimPresenter* GetHideAnimPresenter() { return m_hideAnim; }
@ -131,9 +131,9 @@ class LegoWorld : public LegoEntity {
LegoEntityList* m_entityList; // 0x9c LegoEntityList* m_entityList; // 0x9c
LegoCacheSoundList* m_cacheSoundList; // 0xa0 LegoCacheSoundList* m_cacheSoundList; // 0xa0
MxBool m_destroyed; // 0xa4 MxBool m_destroyed; // 0xa4
MxCoreSet m_objects; // 0xa8 MxCoreSet m_set0xa8; // 0xa8
MxPresenterList m_controlPresenters; // 0xb8 MxPresenterList m_controlPresenters; // 0xb8
MxCoreSet m_disabledObjects; // 0xd0 MxCoreSet m_set0xd0; // 0xd0
list<LegoROI*> m_roiList; // 0xe0 list<LegoROI*> m_roiList; // 0xe0
LegoOmni::World m_worldId; // 0xec LegoOmni::World m_worldId; // 0xec

View File

@ -65,7 +65,7 @@ class Police : public LegoWorld {
MxLong Notify(MxParam& p_param) override; // vtable+0x04 MxLong Notify(MxParam& p_param) override; // vtable+0x04
// FUNCTION: LEGO1 0x1005e1d0 // FUNCTION: LEGO1 0x1005e1d0
MxBool WaitForTransition() override { return TRUE; } // vtable+0x5c MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c
// FUNCTION: LEGO1 0x1005e1e0 // FUNCTION: LEGO1 0x1005e1e0
// FUNCTION: BETA10 0x100f0c50 // FUNCTION: BETA10 0x100f0c50

View File

@ -55,12 +55,12 @@ class RegistrationBook : public LegoWorld {
struct { struct {
MxS16 m_letters[7]; // 0x00 MxS16 m_letters[7]; // 0x00
MxS16 m_cursorPos; // 0x0e MxS16 m_cursorPos; // 0x0e
} m_newName; // 0x280 } m_unk0x280; // 0x280
MxControlPresenter* m_checkmark[10]; // 0x290 MxControlPresenter* m_checkmark[10]; // 0x290
undefined2 m_vehiclesToPosition; // 0x2b8 undefined2 m_unk0x2b8; // 0x2b8
InfocenterState* m_infocenterState; // 0x2bc InfocenterState* m_infocenterState; // 0x2bc
undefined m_unk0x2c0; // 0x2c0 undefined m_unk0x2c0; // 0x2c0
undefined m_awaitLoad; // 0x2c1 undefined m_unk0x2c1; // 0x2c1
undefined m_unk0x2c2[0x02]; // 0x2c2 undefined m_unk0x2c2[0x02]; // 0x2c2
LPDIRECTDRAWSURFACE m_checkboxHilite; // 0x2c4 LPDIRECTDRAWSURFACE m_checkboxHilite; // 0x2c4
LPDIRECTDRAWSURFACE m_checkboxSurface; // 0x2c8 LPDIRECTDRAWSURFACE m_checkboxSurface; // 0x2c8
@ -72,9 +72,9 @@ class RegistrationBook : public LegoWorld {
MxLong HandleKeyPress(SDL_Keycode p_key); MxLong HandleKeyPress(SDL_Keycode p_key);
MxLong HandleControl(LegoControlManagerNotificationParam& p_param); MxLong HandleControl(LegoControlManagerNotificationParam& p_param);
MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param); MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param);
void LoadSave(MxS16 p_checkMarkIndex); void FUN_100775c0(MxS16 p_playerIndex);
void WriteInfocenterLetters(MxS16); void WriteInfocenterLetters(MxS16);
void LoadVehicles(); void FUN_100778c0();
MxBool CreateSurface(); MxBool CreateSurface();
}; };

View File

@ -60,7 +60,7 @@ class Score : public LegoWorld {
MxLong Notify(MxParam& p_param) override; // vtable+0x04 MxLong Notify(MxParam& p_param) override; // vtable+0x04
// FUNCTION: LEGO1 0x100010b0 // FUNCTION: LEGO1 0x100010b0
MxBool WaitForTransition() override { return TRUE; } // vtable+0x5c MxBool VTable0x5c() override { return TRUE; } // vtable+0x5c
// FUNCTION: LEGO1 0x100010c0 // FUNCTION: LEGO1 0x100010c0
// FUNCTION: BETA10 0x100f4f20 // FUNCTION: BETA10 0x100f4f20

View File

@ -36,114 +36,112 @@ Act2Actor::Location g_brickstrLocations[] = {
{{26.470566, 0.069, -44.670845}, {0.004602, 0.0, -0.99998897}, "int26", FALSE}, {{26.470566, 0.069, -44.670845}, {0.004602, 0.0, -0.99998897}, "int26", FALSE},
{{-6.323625, 0.069, -47.96045}, {-0.982068, 0.0, 0.188529}, "edg02_53", FALSE}, {{-6.323625, 0.069, -47.96045}, {-0.982068, 0.0, 0.188529}, "edg02_53", FALSE},
{{-36.689, -0.978409, 31.449}, {0.083792, -0.94303, -0.66398698}, "edg00_157", FALSE}, {{-36.689, -0.978409, 31.449}, {0.083792, -0.94303, -0.66398698}, "edg00_157", FALSE},
#ifndef BETA10
{{-44.6, 0.1, 45.3}, {0.95, 0.0, -0.3}, "edg00_154", FALSE}, {{-44.6, 0.1, 45.3}, {0.95, 0.0, -0.3}, "edg00_154", FALSE},
#endif
}; };
// GLOBAL: LEGO1 0x100f0f1c // GLOBAL: LEGO1 0x100f0f1c
MxFloat g_lastAnimationTime = 0.0f; MxFloat g_unk0x100f0f1c = 0.0f;
// GLOBAL: LEGO1 0x100f0f20 // GLOBAL: LEGO1 0x100f0f20
// GLOBAL: BETA10 0x101dbe40 // GLOBAL: BETA10 0x101dbe40
MxBool g_nextEntityIsBuilding = FALSE; MxBool g_unk0x100f0f20 = FALSE;
// GLOBAL: LEGO1 0x100f0f24 // GLOBAL: LEGO1 0x100f0f24
MxBool g_unk0x100f0f24 = FALSE; MxBool g_unk0x100f0f24 = FALSE;
// GLOBAL: LEGO1 0x100f0f28 // GLOBAL: LEGO1 0x100f0f28
// GLOBAL: BETA10 0x101dbe44 // GLOBAL: BETA10 0x101dbe44
MxBool g_playedShootSound = FALSE; MxBool g_unk0x100f0f28 = FALSE;
// --- All of these are indices into g_plantInfo (0x10103180) --- // --- All of these are indices into g_plantInfo (0x10103180) ---
// GLOBAL: LEGO1 0x100f0f30 // GLOBAL: LEGO1 0x100f0f30
// GLOBAL: BETA10 0x101dbe48 // GLOBAL: BETA10 0x101dbe48
MxS32 g_location0Plants[] = {2, 23, 32, 66, 71, 72, 73, -1}; MxS32 g_stage0Plants[] = {2, 23, 32, 66, 71, 72, 73, -1};
// GLOBAL: LEGO1 0x100f0f50 // GLOBAL: LEGO1 0x100f0f50
// GLOBAL: BETA10 0x101dbe68 // GLOBAL: BETA10 0x101dbe68
MxS32 g_location1Plants[] = {0, 7, 16, 18, 20, 21, 34, 49, 58, 59, 63, 65, 69, 74, -1}; MxS32 g_stage1Plants[] = {0, 7, 16, 18, 20, 21, 34, 49, 58, 59, 63, 65, 69, 74, -1};
// GLOBAL: LEGO1 0x100f0f90 // GLOBAL: LEGO1 0x100f0f90
// GLOBAL: BETA10 0x101dbea8 // GLOBAL: BETA10 0x101dbea8
MxS32 g_location2Plants[] = {12, 19, 24, 48, 60, -1}; MxS32 g_stage2Plants[] = {12, 19, 24, 48, 60, -1};
// GLOBAL: LEGO1 0x100f0fa8 // GLOBAL: LEGO1 0x100f0fa8
// GLOBAL: BETA10 0x101dbec0 // GLOBAL: BETA10 0x101dbec0
MxS32 g_location3Plants[] = {8, 15, 46, -1}; MxS32 g_stage3Plants[] = {8, 15, 46, -1};
// GLOBAL: LEGO1 0x100f0fb8 // GLOBAL: LEGO1 0x100f0fb8
// GLOBAL: BETA10 0x101dbed0 // GLOBAL: BETA10 0x101dbed0
MxS32 g_location4Plants[] = {25, 26, 28, 29, 38, 39, 42, 50, 51, 56, -1}; MxS32 g_stage4Plants[] = {25, 26, 28, 29, 38, 39, 42, 50, 51, 56, -1};
// GLOBAL: LEGO1 0x100f0fe8 // GLOBAL: LEGO1 0x100f0fe8
// GLOBAL: BETA10 0x101dbf00 // GLOBAL: BETA10 0x101dbf00
MxS32 g_location5Plants[] = {3, 40, 53, 55, -1}; MxS32 g_stage5Plants[] = {3, 40, 53, 55, -1};
// GLOBAL: LEGO1 0x100f1000 // GLOBAL: LEGO1 0x100f1000
// GLOBAL: BETA10 0x101dbf18 // GLOBAL: BETA10 0x101dbf18
MxS32 g_location6Plants[] = {22, 33, 41, 45, 67, -1}; MxS32 g_stage6Plants[] = {22, 33, 41, 45, 67, -1};
// GLOBAL: LEGO1 0x100f1018 // GLOBAL: LEGO1 0x100f1018
// GLOBAL: BETA10 0x101dbf30 // GLOBAL: BETA10 0x101dbf30
MxS32 g_location7Plants[] = {13, 30, 31, 62, -1}; MxS32 g_stage7Plants[] = {13, 30, 31, 62, -1};
// GLOBAL: LEGO1 0x100f1030 // GLOBAL: LEGO1 0x100f1030
// GLOBAL: BETA10 0x101dbf48 // GLOBAL: BETA10 0x101dbf48
MxS32 g_location8Plants[] = {1, 27, 37, 44, 47, 54, 61, 64, -1}; MxS32 g_stage8Plants[] = {1, 27, 37, 44, 47, 54, 61, 64, -1};
// --- End of indices into g_plantInfo --- // --- End of indices into g_plantInfo ---
// GLOBAL: LEGO1 0x10102b1c // GLOBAL: LEGO1 0x10102b1c
// GLOBAL: BETA10 0x10209f60 // GLOBAL: BETA10 0x10209f60
MxU32 g_nextHeadWavIndex = 0; undefined4 g_nextHeadWavIndex = 0;
// GLOBAL: LEGO1 0x10102b20 // GLOBAL: LEGO1 0x10102b20
// GLOBAL: BETA10 0x10209f64 // GLOBAL: BETA10 0x10209f64
MxU32 g_nextBehindWavIndex = 0; undefined4 g_nextBehindWavIndex = 0;
// GLOBAL: LEGO1 0x10102b24 // GLOBAL: LEGO1 0x10102b24
// GLOBAL: BETA10 0x10209f68 // GLOBAL: BETA10 0x10209f68
MxU32 g_nextInterruptWavIndex = 0; undefined4 g_nextInterruptWavIndex = 0;
// FUNCTION: LEGO1 0x100187e0 // FUNCTION: LEGO1 0x100187e0
// FUNCTION: BETA10 0x1000c7fb // FUNCTION: BETA10 0x1000c7fb
Act2Actor::Act2Actor() Act2Actor::Act2Actor()
{ {
m_skipAnimation = FALSE; m_unk0x1c = 0;
m_targetLocation = 0; m_unk0x1d = 0;
m_animatingHit = FALSE; m_unk0x1f = FALSE;
m_createBrickTime = 0; m_unk0x24 = 0;
m_animationDuration = 0; m_unk0x20 = 0;
m_state = e_readyToShoot; m_unk0x1e = 0;
m_baseWorldSpeed = 4; m_unk0x28 = 4;
m_shootAnimEnd = 0; m_unk0x2c = 0;
m_entityAnimationTime = 0; m_unk0x30 = 0;
m_shootAnim = NULL; m_shootAnim = NULL;
m_resetWorldSpeedAt = 0; m_unk0x44 = 0;
m_initializing = TRUE; m_unk0x40 = 1;
m_visitedLocations = 0; m_unk0x48 = 0;
m_nextEntity = NULL; m_unk0x4c = NULL;
m_cachedShootSound = NULL; m_unk0x38 = NULL;
m_unk0x3c = 0; m_unk0x3c = 0;
// Odd: The code says < 10, but there are 11 entries in the array // Odd: The code says < 10, but there are 11 entries in the array
for (MxS32 i = 0; i < 10; i++) { for (MxS32 i = 0; i < 10; i++) {
g_brickstrLocations[i].m_cleared = FALSE; g_brickstrLocations[i].m_unk0x1c = FALSE;
} }
} }
// FUNCTION: LEGO1 0x10018940 // FUNCTION: LEGO1 0x10018940
void Act2Actor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_updateTransform) void Act2Actor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
{ {
LegoAnimActor::SetROI(p_roi, p_bool1, p_updateTransform); LegoAnimActor::SetROI(p_roi, p_bool1, p_bool2);
m_roi->SetVisibility(FALSE); m_roi->SetVisibility(FALSE);
} }
// FUNCTION: LEGO1 0x10018980 // FUNCTION: LEGO1 0x10018980
// FUNCTION: BETA10 0x1000c963 // FUNCTION: BETA10 0x1000c963
void Act2Actor::InitializeNextShot() void Act2Actor::FUN_10018980()
{ {
for (MxS32 i = 0; i < m_animMaps.size(); i++) { for (MxS32 i = 0; i < m_animMaps.size(); i++) {
if (m_animMaps[i]->GetWorldSpeed() == -1.0f) { if (m_animMaps[i]->GetWorldSpeed() == -1.0f) {
@ -153,14 +151,14 @@ void Act2Actor::InitializeNextShot()
assert(m_shootAnim); assert(m_shootAnim);
m_cachedShootSound = SoundManager()->GetCacheSoundManager()->FindSoundByKey("xarrow"); m_unk0x38 = SoundManager()->GetCacheSoundManager()->FindSoundByKey("xarrow");
#ifdef BETA10 #ifdef BETA10
// actually 0x2c and 0x30 // actually 0x2c and 0x30
m_cachedShootSound = SoundManager()->GetCacheSoundManager()->FindSoundByKey("bcrash"); m_unk0x38 = SoundManager()->GetCacheSoundManager()->FindSoundByKey("bcrash");
m_cachedShootSound->SetDistance(35, 60); m_unk0x38->SetDistance(35, 60);
m_cachedShootSound->SetDistance(35, 60); m_unk0x38->SetDistance(35, 60);
#else #else
m_cachedShootSound->SetDistance(45, 55); m_unk0x38->SetDistance(45, 55);
m_roi->SetVisibility(TRUE); m_roi->SetVisibility(TRUE);
#endif #endif
} }
@ -169,9 +167,9 @@ void Act2Actor::InitializeNextShot()
// FUNCTION: BETA10 0x1000ca64 // FUNCTION: BETA10 0x1000ca64
MxResult Act2Actor::HitActor(LegoPathActor*, MxBool) MxResult Act2Actor::HitActor(LegoPathActor*, MxBool)
{ {
if (m_animatingHit == FALSE) { if (m_unk0x1f == FALSE) {
m_animatingHit = TRUE; m_unk0x1f = TRUE;
m_animationDuration = 0; m_unk0x20 = 0;
} }
SoundManager()->GetCacheSoundManager()->Play("hitactor", NULL, FALSE); SoundManager()->GetCacheSoundManager()->Play("hitactor", NULL, FALSE);
@ -187,7 +185,7 @@ MxResult Act2Actor::VTable0x9c()
return SUCCESS; return SUCCESS;
} }
else { else {
if (m_animatingHit) { if (m_unk0x1f) {
MxMatrix matrix = m_roi->GetLocal2World(); MxMatrix matrix = m_roi->GetLocal2World();
matrix[3][1] -= 3.0f; matrix[3][1] -= 3.0f;
m_roi->UpdateTransformationRelativeToParent(matrix); m_roi->UpdateTransformationRelativeToParent(matrix);
@ -209,28 +207,28 @@ void Act2Actor::Animate(float p_time)
int dummy1; // for BETA10, not sure what it is being used for int dummy1; // for BETA10, not sure what it is being used for
#ifndef BETA10 #ifndef BETA10
MxFloat timeSinceLastAnimate = 0.0f; MxFloat local48float = 0.0f;
if (g_lastAnimationTime != 0.0f) { if (g_unk0x100f0f1c != 0.0f) {
timeSinceLastAnimate = p_time - g_lastAnimationTime; local48float = p_time - g_unk0x100f0f1c;
} }
g_lastAnimationTime = p_time; g_unk0x100f0f1c = p_time;
#endif #endif
LegoAnimActor::Animate(p_time); LegoAnimActor::Animate(p_time);
if (m_resetWorldSpeedAt != 0.0f && m_resetWorldSpeedAt < p_time) { if (m_unk0x44 != 0.0f && m_unk0x44 < p_time) {
SetWorldSpeed(m_baseWorldSpeed); SetWorldSpeed(m_unk0x28);
} }
if (m_animatingHit) { if (m_unk0x1f) {
if (m_animationDuration > 600.0f) { if (m_unk0x20 > 600.0f) {
m_animatingHit = FALSE; m_unk0x1f = FALSE;
m_animationDuration = 0; m_unk0x20 = 0;
} }
else { else {
#ifndef BETA10 #ifndef BETA10
m_animationDuration += timeSinceLastAnimate; m_unk0x20 += local48float;
#endif #endif
MxMatrix matrix = m_roi->GetLocal2World(); MxMatrix matrix = m_roi->GetLocal2World();
matrix[3][1] += 3.0f; matrix[3][1] += 3.0f;
@ -247,41 +245,41 @@ void Act2Actor::Animate(float p_time)
} }
if (!m_grec) { if (!m_grec) {
if (m_state == e_roaming) { if (m_unk0x1e == 2) {
m_state = e_readyToShoot; m_unk0x1e = 0;
m_shootAnimEnd = m_shootAnim->GetDuration() + p_time; m_unk0x2c = m_shootAnim->GetDuration() + p_time;
m_entityAnimationTime = m_shootAnimEnd - 1300.0f; m_unk0x30 = m_unk0x2c - 1300.0f;
SetWorldSpeed(0); SetWorldSpeed(0);
m_skipAnimation = FALSE; m_unk0x1c = FALSE;
} }
else if (m_state == e_endShot) { else if (m_unk0x1e == 1) {
FindROI("pwrbrik")->SetVisibility(FALSE); FindROI("pwrbrik")->SetVisibility(FALSE);
FindROI("debrick")->SetVisibility(FALSE); FindROI("debrick")->SetVisibility(FALSE);
FindROI("ray")->SetVisibility(FALSE); FindROI("ray")->SetVisibility(FALSE);
m_nextEntity = NULL; m_unk0x4c = NULL;
m_state = e_roaming; m_unk0x1e = 2;
NextTargetLocation(); VTable0xa0();
SetWorldSpeed(m_baseWorldSpeed + 3, p_time + 3000.0f); FUN_10019250(m_unk0x28 + 3, p_time + 3000.0f);
} }
else if (m_state == e_readyToShoot) { else if (m_unk0x1e == 0) {
if (m_initializing) { if (m_unk0x40) {
m_initializing = FALSE; m_unk0x40 = 0;
m_shootAnimEnd = m_shootAnim->GetDuration() + p_time; m_unk0x2c = m_shootAnim->GetDuration() + p_time;
m_entityAnimationTime = m_shootAnimEnd - 1300.0f; m_unk0x30 = m_unk0x2c - 1300.0f;
} }
if (UpdateShot(p_time) == TRUE) { if (FUN_10019700(p_time) == TRUE) {
return; return;
} }
} }
else if (m_state == e_hiding) { else if (m_unk0x1e == 5) {
FindROI("brickstr")->SetVisibility(FALSE); FindROI("brickstr")->SetVisibility(FALSE);
GetROI()->SetVisibility(FALSE); GetROI()->SetVisibility(FALSE);
CurrentWorld()->RemoveActor(this); CurrentWorld()->RemoveActor(this);
return; return;
} }
#ifndef BETA10 #ifndef BETA10
else if (m_state == e_goingToHide) { else if (m_unk0x1e == 4) {
if (m_worldSpeed == 0.0f) { if (m_worldSpeed == 0.0f) {
return; return;
} }
@ -293,14 +291,14 @@ void Act2Actor::Animate(float p_time)
#endif #endif
} }
if (m_state == e_hiding || m_state == e_goingToHide) { if (m_unk0x1e == 5 || m_unk0x1e == 4) {
return; return;
} }
if (m_state == e_createdBrick) { if (m_unk0x1e == 3) {
if (p_time - m_createBrickTime > 600.0f) { if (p_time - m_unk0x24 > 600.0f) {
m_state = e_roaming; m_unk0x1e = 2;
SetWorldSpeed(m_baseWorldSpeed + 4, p_time + 15000.0f); FUN_10019250(m_unk0x28 + 4, p_time + 15000.0f);
} }
} }
else { else {
@ -325,38 +323,38 @@ void Act2Actor::Animate(float p_time)
const MxFloat* pepperWorldPosition = roiPepper->GetWorldPosition(); const MxFloat* pepperWorldPosition = roiPepper->GetWorldPosition();
const MxFloat* worldPosition = m_roi->GetWorldPosition(); const MxFloat* worldPosition = m_roi->GetWorldPosition();
MxFloat distanceToAmbulance = DISTSQRD3(pepperWorldPosition, worldPosition); MxFloat distance1 = DISTSQRD3(pepperWorldPosition, worldPosition);
if (distanceToAmbulance < 75.0f) { if (distance1 < 75.0f) {
if (!m_skipAnimation) { if (!m_unk0x1c) {
m_skipAnimation = TRUE; m_unk0x1c = 1;
if (!m_state) { if (!m_unk0x1e) {
PlayNextVoiceOver(VoiceOver::e_interrupt); FUN_100199f0(2);
m_state = e_endShot; m_unk0x1e = 1;
} }
else { else {
LegoROI* childROI = m_roi->FindChildROI("windsd", m_roi); LegoROI* childROI = m_roi->FindChildROI("windsd", m_roi);
const MxFloat* childPosition = childROI->GetWorldPosition(); const MxFloat* childPosition = childROI->GetWorldPosition();
MxFloat distanceToWindshield = DISTSQRD3(pepperWorldPosition, childPosition); MxFloat distance2 = DISTSQRD3(pepperWorldPosition, childPosition);
childROI = m_roi->FindChildROI("reardr", m_roi); childROI = m_roi->FindChildROI("reardr", m_roi);
childPosition = childROI->GetWorldPosition(); childPosition = childROI->GetWorldPosition();
MxFloat distanceToRearDoor = DISTSQRD3(pepperWorldPosition, childPosition); MxFloat distance3 = DISTSQRD3(pepperWorldPosition, childPosition);
if (distanceToRearDoor > distanceToWindshield) { if (distance3 > distance2) {
PlayNextVoiceOver(VoiceOver::e_head); FUN_100199f0(0);
} }
else else
#ifndef BETA10 #ifndef BETA10
if (p_time - m_createBrickTime > 3000.0f) { if (p_time - m_unk0x24 > 3000.0f) {
#endif #endif
SetWorldSpeed(m_baseWorldSpeed - 1); SetWorldSpeed(m_unk0x28 - 1);
m_state = e_createdBrick; m_unk0x1e = 3;
m_createBrickTime = p_time; m_unk0x24 = p_time;
if (((LegoAct2*) CurrentWorld())->CreateBrick() == SUCCESS) { if (((LegoAct2*) CurrentWorld())->FUN_100516b0() == SUCCESS) {
PlayNextVoiceOver(VoiceOver::e_behind); FUN_100199f0(1);
} }
#ifndef BETA10 #ifndef BETA10
} }
@ -365,8 +363,8 @@ void Act2Actor::Animate(float p_time)
} }
} }
else { else {
if (m_skipAnimation) { if (m_unk0x1c) {
m_skipAnimation = FALSE; m_unk0x1c = 0;
} }
} }
} }
@ -377,11 +375,11 @@ void Act2Actor::Animate(float p_time)
// FUNCTION: LEGO1 0x10019250 // FUNCTION: LEGO1 0x10019250
// FUNCTION: BETA10 0x1000d45c // FUNCTION: BETA10 0x1000d45c
void Act2Actor::SetWorldSpeed(MxFloat p_speed, MxFloat p_resetWorldSpeedAt) void Act2Actor::FUN_10019250(MxFloat p_speed, MxFloat p_param2)
{ {
// The arguments have been changed from BETA10 to LEGO1 // The arguments have been changed from BETA10 to LEGO1
SetWorldSpeed(p_speed); SetWorldSpeed(p_speed);
m_resetWorldSpeedAt = p_resetWorldSpeedAt; m_unk0x44 = p_param2;
} }
// FUNCTION: LEGO1 0x10019280 // FUNCTION: LEGO1 0x10019280
@ -389,12 +387,12 @@ void Act2Actor::SetWorldSpeed(MxFloat p_speed, MxFloat p_resetWorldSpeedAt)
void Act2Actor::SetWorldSpeed(MxFloat p_worldSpeed) void Act2Actor::SetWorldSpeed(MxFloat p_worldSpeed)
{ {
LegoAnimActor::SetWorldSpeed(p_worldSpeed); LegoAnimActor::SetWorldSpeed(p_worldSpeed);
m_resetWorldSpeedAt = 0; m_unk0x44 = 0;
} }
// FUNCTION: LEGO1 0x100192a0 // FUNCTION: LEGO1 0x100192a0
// FUNCTION: BETA10 0x1000d4d6 // FUNCTION: BETA10 0x1000d4d6
void Act2Actor::FindPath(MxU32 p_location) void Act2Actor::FUN_100192a0(undefined4 p_location)
{ {
Mx3DPointFloat newPosition(0.0, 0.0, 0.0); Mx3DPointFloat newPosition(0.0, 0.0, 0.0);
Mx3DPointFloat newDirection(0.0, 0.0, 0.0); Mx3DPointFloat newDirection(0.0, 0.0, 0.0);
@ -431,37 +429,37 @@ void Act2Actor::FindPath(MxU32 p_location)
} }
// FUNCTION: LEGO1 0x10019520 // FUNCTION: LEGO1 0x10019520
void Act2Actor::GoingToHide() void Act2Actor::FUN_10019520()
{ {
m_state = e_goingToHide; m_unk0x1e = 4;
SetWorldSpeed(m_baseWorldSpeed + 3); SetWorldSpeed(m_unk0x28 + 3);
FindPath(10); FUN_100192a0(10);
} }
// FUNCTION: LEGO1 0x10019560 // FUNCTION: LEGO1 0x10019560
void Act2Actor::Hide() void Act2Actor::FUN_10019560()
{ {
m_state = e_hiding; m_unk0x1e = 5;
SetWorldSpeed(m_baseWorldSpeed + 5); SetWorldSpeed(m_unk0x28 + 5);
FindPath(9); FUN_100192a0(9);
} }
// FUNCTION: LEGO1 0x100195a0 // FUNCTION: LEGO1 0x100195a0
// FUNCTION: BETA10 0x1000d7d3 // FUNCTION: BETA10 0x1000d7d3
MxS32 Act2Actor::NextTargetLocation() MxS32 Act2Actor::VTable0xa0()
{ {
MxU32 newLocation; undefined4 newLocation;
assert(!m_grec); assert(!m_grec);
CurrentWorld(); CurrentWorld();
MxU16 randomVal = 1 + SDL_rand(2); MxU16 randomVal = 1 + SDL_rand(2);
if (m_visitedLocations == 8 && m_targetLocation != 8) { if (m_unk0x48 == 8 && m_unk0x1d != 8) {
newLocation = 8; newLocation = 8;
} }
else { else {
switch (m_targetLocation) { switch (m_unk0x1d) {
case 0: case 0:
if (randomVal == 1) { if (randomVal == 1) {
newLocation = 3; newLocation = 3;
@ -536,10 +534,10 @@ MxS32 Act2Actor::NextTargetLocation()
} }
} }
MxU32 firstChoice = newLocation; undefined4 firstChoice = newLocation;
if (m_visitedLocations < 7 || g_brickstrLocations[m_targetLocation].m_cleared) { if (m_unk0x48 < 7 || g_brickstrLocations[m_unk0x1d].m_unk0x1c) {
while (g_brickstrLocations[newLocation].m_cleared || m_targetLocation == newLocation) { while (g_brickstrLocations[newLocation].m_unk0x1c || m_unk0x1d == newLocation) {
if (newLocation == 7) { if (newLocation == 7) {
newLocation = 0; newLocation = 0;
} }
@ -551,8 +549,8 @@ MxS32 Act2Actor::NextTargetLocation()
} }
} }
m_targetLocation = newLocation; m_unk0x1d = newLocation;
FindPath(newLocation); FUN_100192a0(newLocation);
if (m_grec) { if (m_grec) {
return SUCCESS; return SUCCESS;
@ -564,64 +562,64 @@ MxS32 Act2Actor::NextTargetLocation()
// FUNCTION: LEGO1 0x10019700 // FUNCTION: LEGO1 0x10019700
// FUNCTION: BETA10 0x1000dd27 // FUNCTION: BETA10 0x1000dd27
MxU32 Act2Actor::UpdateShot(MxFloat p_time) MxU32 Act2Actor::FUN_10019700(MxFloat p_param)
{ {
if (!m_nextEntity) { if (!m_unk0x4c) {
g_nextEntityIsBuilding = FALSE; g_unk0x100f0f20 = FALSE;
m_nextEntity = GetNextEntity(&g_nextEntityIsBuilding); m_unk0x4c = FUN_10019b90(&g_unk0x100f0f20);
g_unk0x100f0f24 = FALSE; g_unk0x100f0f24 = FALSE;
g_playedShootSound = FALSE; g_unk0x100f0f28 = FALSE;
} }
if (!m_nextEntity) { if (!m_unk0x4c) {
MxTrace("nothing left to destroy at location %d\n", m_targetLocation); MxTrace("nothing left to destroy at location %d\n", m_unk0x1d);
m_state = e_endShot; m_unk0x1e = 1;
if (m_targetLocation == 8) { if (m_unk0x1d == 8) {
((LegoAct2*) CurrentWorld())->BadEnding(); ((LegoAct2*) CurrentWorld())->BadEnding();
} }
return TRUE; return TRUE;
} }
if (!g_playedShootSound && m_entityAnimationTime < p_time) { if (!g_unk0x100f0f28 && m_unk0x30 < p_param) {
g_playedShootSound = TRUE; g_unk0x100f0f28 = TRUE;
assert(SoundManager()->GetCacheSoundManager()); assert(SoundManager()->GetCacheSoundManager());
SoundManager()->GetCacheSoundManager()->Play(m_cachedShootSound, "brickstr", FALSE); SoundManager()->GetCacheSoundManager()->Play(m_unk0x38, "brickstr", FALSE);
if (g_nextEntityIsBuilding) { if (g_unk0x100f0f20) {
BuildingManager()->ScheduleAnimation(m_nextEntity, 800, TRUE, FALSE); BuildingManager()->ScheduleAnimation(m_unk0x4c, 800, TRUE, FALSE);
} }
else { else {
PlantManager()->ScheduleAnimation(m_nextEntity, 800); PlantManager()->ScheduleAnimation(m_unk0x4c, 800);
} }
} }
if (m_shootAnimEnd < p_time) { if (m_unk0x2c < p_param) {
g_nextEntityIsBuilding = FALSE; g_unk0x100f0f20 = FALSE;
m_nextEntity = GetNextEntity(&g_nextEntityIsBuilding); m_unk0x4c = FUN_10019b90(&g_unk0x100f0f20);
m_shootAnimEnd = m_shootAnim->GetDuration() + p_time; m_unk0x2c = m_shootAnim->GetDuration() + p_param;
m_entityAnimationTime = m_shootAnimEnd - 1300.0f; m_unk0x30 = m_unk0x2c - 1300.0f;
g_unk0x100f0f24 = FALSE; g_unk0x100f0f24 = FALSE;
g_playedShootSound = FALSE; g_unk0x100f0f28 = FALSE;
return FALSE; return FALSE;
} }
m_lastTime = p_time; m_lastTime = p_param;
LegoROI* brickstrROI = FindROI("brickstr"); LegoROI* brickstrROI = FindROI("brickstr");
MxMatrix initialTransform = m_roi->GetLocal2World(); MxMatrix matrix = m_roi->GetLocal2World();
initialTransform[3][1] += 1.0f; matrix[3][1] += 1.0f;
brickstrROI->SetLocal2World(initialTransform); brickstrROI->SetLocal2World(matrix);
brickstrROI->WrappedUpdateWorldData(); brickstrROI->WrappedUpdateWorldData();
Vector3 col0(initialTransform[0]); Vector3 col0(matrix[0]);
Vector3 col1(initialTransform[1]); Vector3 col1(matrix[1]);
Vector3 col2(initialTransform[2]); Vector3 col2(matrix[2]);
Vector3 col3(initialTransform[3]); Vector3 col3(matrix[3]);
col2 = col3; col2 = col3;
col2 -= m_nextEntity->GetROI()->GetWorldPosition(); col2 -= m_unk0x4c->GetROI()->GetWorldPosition();
col2.Unitize(); col2.Unitize();
col0.EqualsCross(col1, col2); col0.EqualsCross(col1, col2);
col0.Unitize(); col0.Unitize();
@ -630,10 +628,10 @@ MxU32 Act2Actor::UpdateShot(MxFloat p_time)
assert(!m_cameraFlag); assert(!m_cameraFlag);
LegoTreeNode* root = m_shootAnim->GetAnimTreePtr()->GetRoot(); LegoTreeNode* root = m_shootAnim->GetAnimTreePtr()->GetRoot();
MxFloat time = p_time - (m_shootAnimEnd - m_shootAnim->GetDuration()); MxFloat time = p_param - (m_unk0x2c - m_shootAnim->GetDuration());
for (MxS32 i = 0; i < root->GetNumChildren(); i++) { for (MxS32 i = 0; i < root->GetNumChildren(); i++) {
LegoROI::ApplyAnimationTransformation(root->GetChild(i), initialTransform, time, m_shootAnim->GetROIMap()); LegoROI::ApplyAnimationTransformation(root->GetChild(i), matrix, time, m_shootAnim->GetROIMap());
} }
return FALSE; return FALSE;
@ -641,68 +639,68 @@ MxU32 Act2Actor::UpdateShot(MxFloat p_time)
// FUNCTION: LEGO1 0x100199f0 // FUNCTION: LEGO1 0x100199f0
// FUNCTION: BETA10 0x1000e11a // FUNCTION: BETA10 0x1000e11a
void Act2Actor::PlayNextVoiceOver(MxS8 p_voiceOverType) void Act2Actor::FUN_100199f0(MxS8 p_param)
{ {
switch (p_voiceOverType) { switch (p_param) {
case VoiceOver::e_head: case 0:
switch (g_nextHeadWavIndex) { switch (g_nextHeadWavIndex) {
case 0: case 0:
((LegoAct2*) CurrentWorld()) ((LegoAct2*) CurrentWorld())
->StartAction(Act2mainScript::c_VOhead0_PlayWav, FALSE, FALSE, NULL, NULL, NULL); ->FUN_10052560(Act2mainScript::c_VOhead0_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
g_nextHeadWavIndex++; g_nextHeadWavIndex++;
break; break;
default: default:
((LegoAct2*) CurrentWorld()) ((LegoAct2*) CurrentWorld())
->StartAction(Act2mainScript::c_VOhead1_PlayWav, FALSE, FALSE, NULL, NULL, NULL); ->FUN_10052560(Act2mainScript::c_VOhead1_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
g_nextHeadWavIndex = 0; g_nextHeadWavIndex = 0;
break; break;
} }
break; break;
case VoiceOver::e_behind: case 1:
switch (g_nextBehindWavIndex) { switch (g_nextBehindWavIndex) {
case 0: case 0:
((LegoAct2*) CurrentWorld()) ((LegoAct2*) CurrentWorld())
->StartAction(Act2mainScript::c_VObehind0_PlayWav, FALSE, TRUE, NULL, NULL, NULL); ->FUN_10052560(Act2mainScript::c_VObehind0_PlayWav, FALSE, TRUE, NULL, NULL, NULL);
g_nextBehindWavIndex++; g_nextBehindWavIndex++;
break; break;
case 1: case 1:
((LegoAct2*) CurrentWorld()) ((LegoAct2*) CurrentWorld())
->StartAction(Act2mainScript::c_VObehind1_PlayWav, FALSE, TRUE, NULL, NULL, NULL); ->FUN_10052560(Act2mainScript::c_VObehind1_PlayWav, FALSE, TRUE, NULL, NULL, NULL);
g_nextBehindWavIndex++; g_nextBehindWavIndex++;
break; break;
case 2: case 2:
((LegoAct2*) CurrentWorld()) ((LegoAct2*) CurrentWorld())
->StartAction(Act2mainScript::c_VObehind2_PlayWav, FALSE, TRUE, NULL, NULL, NULL); ->FUN_10052560(Act2mainScript::c_VObehind2_PlayWav, FALSE, TRUE, NULL, NULL, NULL);
g_nextBehindWavIndex++; g_nextBehindWavIndex++;
break; break;
default: default:
((LegoAct2*) CurrentWorld()) ((LegoAct2*) CurrentWorld())
->StartAction(Act2mainScript::c_VObehind3_PlayWav, FALSE, TRUE, NULL, NULL, NULL); ->FUN_10052560(Act2mainScript::c_VObehind3_PlayWav, FALSE, TRUE, NULL, NULL, NULL);
g_nextBehindWavIndex = 0; g_nextBehindWavIndex = 0;
break; break;
} }
break; break;
case VoiceOver::e_interrupt: case 2:
switch (g_nextInterruptWavIndex) { switch (g_nextInterruptWavIndex) {
case 0: case 0:
((LegoAct2*) CurrentWorld()) ((LegoAct2*) CurrentWorld())
->StartAction(Act2mainScript::c_VOinterrupt0_PlayWav, FALSE, FALSE, NULL, NULL, NULL); ->FUN_10052560(Act2mainScript::c_VOinterrupt0_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
g_nextInterruptWavIndex++; g_nextInterruptWavIndex++;
break; break;
case 1: case 1:
((LegoAct2*) CurrentWorld()) ((LegoAct2*) CurrentWorld())
->StartAction(Act2mainScript::c_VOinterrupt1_PlayWav, FALSE, FALSE, NULL, NULL, NULL); ->FUN_10052560(Act2mainScript::c_VOinterrupt1_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
g_nextInterruptWavIndex++; g_nextInterruptWavIndex++;
break; break;
case 2: case 2:
((LegoAct2*) CurrentWorld()) ((LegoAct2*) CurrentWorld())
->StartAction(Act2mainScript::c_VOinterrupt2_PlayWav, FALSE, FALSE, NULL, NULL, NULL); ->FUN_10052560(Act2mainScript::c_VOinterrupt2_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
g_nextInterruptWavIndex++; g_nextInterruptWavIndex++;
break; break;
default: default:
((LegoAct2*) CurrentWorld()) ((LegoAct2*) CurrentWorld())
->StartAction(Act2mainScript::c_VOinterrupt3_PlayWav, FALSE, FALSE, NULL, NULL, NULL); ->FUN_10052560(Act2mainScript::c_VOinterrupt3_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
g_nextInterruptWavIndex = 0; g_nextInterruptWavIndex = 0;
break; break;
} }
@ -711,27 +709,27 @@ void Act2Actor::PlayNextVoiceOver(MxS8 p_voiceOverType)
// FUNCTION: LEGO1 0x10019b90 // FUNCTION: LEGO1 0x10019b90
// FUNCTION: BETA10 0x1000e374 // FUNCTION: BETA10 0x1000e374
LegoEntity* Act2Actor::GetNextEntity(MxBool* p_isBuilding) LegoEntity* Act2Actor::FUN_10019b90(MxBool* p_param)
{ {
MxS32 i; MxS32 i;
LegoBuildingInfo* buildingInfo = BuildingManager()->GetInfoArray(i); LegoBuildingInfo* buildingInfo = BuildingManager()->GetInfoArray(i);
LegoPlantInfo* plantInfo = PlantManager()->GetInfoArray(i); LegoPlantInfo* plantInfo = PlantManager()->GetInfoArray(i);
LegoEntity* result = 0; LegoEntity* result = 0;
switch (m_targetLocation) { switch (m_unk0x1d) {
case 0: case 0:
if (buildingInfo[12].m_counter) { if (buildingInfo[12].m_counter) {
result = buildingInfo[12].m_entity; result = buildingInfo[12].m_entity;
*p_isBuilding = TRUE; *p_param = TRUE;
} }
else if (buildingInfo[14].m_counter) { else if (buildingInfo[14].m_counter) {
result = buildingInfo[14].m_entity; result = buildingInfo[14].m_entity;
*p_isBuilding = TRUE; *p_param = TRUE;
} }
else { else {
for (i = 0; g_location0Plants[i] != -1; i++) { for (i = 0; g_stage0Plants[i] != -1; i++) {
if (plantInfo[g_location0Plants[i]].m_counter) { if (plantInfo[g_stage0Plants[i]].m_counter) {
result = plantInfo[g_location0Plants[i]].m_entity; result = plantInfo[g_stage0Plants[i]].m_entity;
break; break;
} }
} }
@ -740,12 +738,12 @@ LegoEntity* Act2Actor::GetNextEntity(MxBool* p_isBuilding)
case 1: case 1:
if (buildingInfo[13].m_counter) { if (buildingInfo[13].m_counter) {
result = buildingInfo[13].m_entity; result = buildingInfo[13].m_entity;
*p_isBuilding = TRUE; *p_param = TRUE;
} }
else { else {
for (i = 0; g_location1Plants[i] != -1; i++) { for (i = 0; g_stage1Plants[i] != -1; i++) {
if (plantInfo[g_location1Plants[i]].m_counter) { if (plantInfo[g_stage1Plants[i]].m_counter) {
result = plantInfo[g_location1Plants[i]].m_entity; result = plantInfo[g_stage1Plants[i]].m_entity;
break; break;
} }
} }
@ -754,16 +752,16 @@ LegoEntity* Act2Actor::GetNextEntity(MxBool* p_isBuilding)
case 2: case 2:
if (buildingInfo[9].m_counter) { if (buildingInfo[9].m_counter) {
result = buildingInfo[9].m_entity; result = buildingInfo[9].m_entity;
*p_isBuilding = TRUE; *p_param = TRUE;
} }
else if (buildingInfo[11].m_counter) { else if (buildingInfo[11].m_counter) {
result = buildingInfo[11].m_entity; result = buildingInfo[11].m_entity;
*p_isBuilding = TRUE; *p_param = TRUE;
} }
else { else {
for (i = 0; g_location2Plants[i] != -1; i++) { for (i = 0; g_stage2Plants[i] != -1; i++) {
if (plantInfo[g_location2Plants[i]].m_counter) { if (plantInfo[g_stage2Plants[i]].m_counter) {
result = plantInfo[g_location2Plants[i]].m_entity; result = plantInfo[g_stage2Plants[i]].m_entity;
break; break;
} }
} }
@ -772,20 +770,20 @@ LegoEntity* Act2Actor::GetNextEntity(MxBool* p_isBuilding)
case 3: case 3:
if (buildingInfo[7].m_counter) { if (buildingInfo[7].m_counter) {
result = buildingInfo[7].m_entity; result = buildingInfo[7].m_entity;
*p_isBuilding = TRUE; *p_param = TRUE;
} }
else if (buildingInfo[8].m_counter) { else if (buildingInfo[8].m_counter) {
result = buildingInfo[8].m_entity; result = buildingInfo[8].m_entity;
*p_isBuilding = TRUE; *p_param = TRUE;
} }
else if (buildingInfo[3].m_counter) { else if (buildingInfo[3].m_counter) {
result = buildingInfo[3].m_entity; result = buildingInfo[3].m_entity;
*p_isBuilding = TRUE; *p_param = TRUE;
} }
else { else {
for (i = 0; g_location3Plants[i] != -1; i++) { for (i = 0; g_stage3Plants[i] != -1; i++) {
if (plantInfo[g_location3Plants[i]].m_counter) { if (plantInfo[g_stage3Plants[i]].m_counter) {
result = plantInfo[g_location3Plants[i]].m_entity; result = plantInfo[g_stage3Plants[i]].m_entity;
break; break;
} }
} }
@ -794,16 +792,16 @@ LegoEntity* Act2Actor::GetNextEntity(MxBool* p_isBuilding)
case 4: case 4:
if (buildingInfo[5].m_counter) { if (buildingInfo[5].m_counter) {
result = buildingInfo[5].m_entity; result = buildingInfo[5].m_entity;
*p_isBuilding = TRUE; *p_param = TRUE;
} }
else if (buildingInfo[10].m_counter) { else if (buildingInfo[10].m_counter) {
result = buildingInfo[10].m_entity; result = buildingInfo[10].m_entity;
*p_isBuilding = TRUE; *p_param = TRUE;
} }
else { else {
for (i = 0; g_location4Plants[i] != -1; i++) { for (i = 0; g_stage4Plants[i] != -1; i++) {
if (plantInfo[g_location4Plants[i]].m_counter) { if (plantInfo[g_stage4Plants[i]].m_counter) {
result = plantInfo[g_location4Plants[i]].m_entity; result = plantInfo[g_stage4Plants[i]].m_entity;
break; break;
} }
} }
@ -812,12 +810,12 @@ LegoEntity* Act2Actor::GetNextEntity(MxBool* p_isBuilding)
case 5: case 5:
if (buildingInfo[4].m_counter) { if (buildingInfo[4].m_counter) {
result = buildingInfo[4].m_entity; result = buildingInfo[4].m_entity;
*p_isBuilding = TRUE; *p_param = TRUE;
} }
else { else {
for (i = 0; g_location5Plants[i] != -1; i++) { for (i = 0; g_stage5Plants[i] != -1; i++) {
if (plantInfo[g_location5Plants[i]].m_counter) { if (plantInfo[g_stage5Plants[i]].m_counter) {
result = plantInfo[g_location5Plants[i]].m_entity; result = plantInfo[g_stage5Plants[i]].m_entity;
break; break;
} }
} }
@ -826,12 +824,12 @@ LegoEntity* Act2Actor::GetNextEntity(MxBool* p_isBuilding)
case 6: case 6:
if (buildingInfo[2].m_counter) { if (buildingInfo[2].m_counter) {
result = buildingInfo[2].m_entity; result = buildingInfo[2].m_entity;
*p_isBuilding = TRUE; *p_param = TRUE;
} }
else { else {
for (i = 0; g_location6Plants[i] != -1; i++) { for (i = 0; g_stage6Plants[i] != -1; i++) {
if (plantInfo[g_location6Plants[i]].m_counter) { if (plantInfo[g_stage6Plants[i]].m_counter) {
result = plantInfo[g_location6Plants[i]].m_entity; result = plantInfo[g_stage6Plants[i]].m_entity;
break; break;
} }
} }
@ -840,21 +838,21 @@ LegoEntity* Act2Actor::GetNextEntity(MxBool* p_isBuilding)
case 7: case 7:
if (buildingInfo[6].m_counter) { if (buildingInfo[6].m_counter) {
result = buildingInfo[6].m_entity; result = buildingInfo[6].m_entity;
*p_isBuilding = TRUE; *p_param = TRUE;
} }
else { else {
for (i = 0; g_location7Plants[i] != -1; i++) { for (i = 0; g_stage7Plants[i] != -1; i++) {
if (plantInfo[g_location7Plants[i]].m_counter) { if (plantInfo[g_stage7Plants[i]].m_counter) {
result = plantInfo[g_location7Plants[i]].m_entity; result = plantInfo[g_stage7Plants[i]].m_entity;
break; break;
} }
} }
} }
break; break;
case 8: case 8:
for (i = 0; g_location8Plants[i] != -1; i++) { for (i = 0; g_stage8Plants[i] != -1; i++) {
if (plantInfo[g_location8Plants[i]].m_counter) { if (plantInfo[g_stage8Plants[i]].m_counter) {
result = plantInfo[g_location8Plants[i]].m_entity; result = plantInfo[g_stage8Plants[i]].m_entity;
break; break;
} }
} }
@ -865,14 +863,14 @@ LegoEntity* Act2Actor::GetNextEntity(MxBool* p_isBuilding)
if (buildingInfo[15].m_counter) { if (buildingInfo[15].m_counter) {
result = buildingInfo[15].m_entity; result = buildingInfo[15].m_entity;
*p_isBuilding = TRUE; *p_param = TRUE;
} }
break; break;
} }
if (!result && !g_brickstrLocations[m_targetLocation].m_cleared) { if (!result && !g_brickstrLocations[m_unk0x1d].m_unk0x1c) {
g_brickstrLocations[m_targetLocation].m_cleared = TRUE; g_brickstrLocations[m_unk0x1d].m_unk0x1c = TRUE;
m_visitedLocations++; m_unk0x48++;
} }
return result; return result;

View File

@ -583,11 +583,11 @@ void IslePathActor::SpawnPlayer(LegoGameState::Area p_area, MxBool p_enter, MxU8
break; break;
} }
if (state != NULL && state->m_finishedBuild && !state->m_playedExitScript) { if (state != NULL && state->m_unk0x4d && !state->m_unk0x4e) {
if (AnimationManager() if (AnimationManager()
->FUN_10060dc0(anim, NULL, TRUE, LegoAnimationManager::e_unk0, NULL, FALSE, TRUE, TRUE, TRUE) == ->FUN_10060dc0(anim, NULL, TRUE, LegoAnimationManager::e_unk0, NULL, FALSE, TRUE, TRUE, TRUE) ==
SUCCESS) { SUCCESS) {
state->m_playedExitScript = TRUE; state->m_unk0x4e = TRUE;
camAnim = FALSE; camAnim = FALSE;
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -18,7 +18,7 @@
#include <SDL3/SDL_stdinc.h> #include <SDL3/SDL_stdinc.h>
DECOMP_SIZE_ASSERT(LegoCarBuildAnimPresenter::CarBuildPart, 0x0c) DECOMP_SIZE_ASSERT(LegoCarBuildAnimPresenter::UnknownListEntry, 0x0c)
DECOMP_SIZE_ASSERT(LegoCarBuildAnimPresenter, 0x150) DECOMP_SIZE_ASSERT(LegoCarBuildAnimPresenter, 0x150)
// FUNCTION: LEGO1 0x10078400 // FUNCTION: LEGO1 0x10078400
@ -34,7 +34,7 @@ LegoCarBuildAnimPresenter::LegoCarBuildAnimPresenter()
m_shelfFrameBuffer = 0; m_shelfFrameBuffer = 0;
m_shelfFrameMax = 0; m_shelfFrameMax = 0;
m_shelfFrameInterval = 0; m_shelfFrameInterval = 0;
m_flashingPartTimeState = 0; m_unk0x13c = 0;
m_carBuildEntity = NULL; m_carBuildEntity = NULL;
m_unk0x144 = -1; m_unk0x144 = -1;
m_unk0x148 = -1; m_unk0x148 = -1;
@ -62,28 +62,28 @@ LegoCarBuildAnimPresenter::~LegoCarBuildAnimPresenter()
} }
// FUNCTION: BETA10 0x100733d0 // FUNCTION: BETA10 0x100733d0
inline void LegoCarBuildAnimPresenter::UpdateFlashingPartVisibility() inline void LegoCarBuildAnimPresenter::Beta10Inline0x100733d0()
{ {
MxLong time = Timer()->GetTime(); MxLong time = Timer()->GetTime();
MxLong showFlashingPart; MxLong bvar5;
if (m_flashingPartTimeState < time) { if (m_unk0x13c < time) {
showFlashingPart = FALSE; bvar5 = FALSE;
// I have no idea why this conditional is so convoluted // I have no idea why this conditional is so convoluted
if (m_flashingPartTimeState & c_bit1) { if (m_unk0x13c & c_bit1) {
showFlashingPart = TRUE; bvar5 = TRUE;
m_flashingPartTimeState = time + 400; m_unk0x13c = time + 400;
} }
else { else {
m_flashingPartTimeState = time + 200; m_unk0x13c = time + 200;
} }
if (showFlashingPart) { if (bvar5) {
m_flashingPartTimeState &= ~c_bit1; m_unk0x13c &= ~c_bit1;
} }
else { else {
m_flashingPartTimeState |= c_bit1; m_unk0x13c |= c_bit1;
} }
if (m_placedPartCount < m_numberOfParts) { if (m_placedPartCount < m_numberOfParts) {
@ -98,7 +98,7 @@ inline void LegoCarBuildAnimPresenter::UpdateFlashingPartVisibility()
const LegoChar* name = roi->GetName(); const LegoChar* name = roi->GetName();
if (name && SDL_strcasecmp(wiredName, name) == 0) { if (name && SDL_strcasecmp(wiredName, name) == 0) {
if (showFlashingPart) { if (bvar5) {
roi->SetVisibility(TRUE); roi->SetVisibility(TRUE);
} }
else { else {
@ -129,7 +129,7 @@ void LegoCarBuildAnimPresenter::PutFrame()
break; break;
} }
UpdateFlashingPartVisibility(); Beta10Inline0x100733d0();
} }
// FUNCTION: LEGO1 0x100788c0 // FUNCTION: LEGO1 0x100788c0
@ -211,7 +211,7 @@ void LegoCarBuildAnimPresenter::StreamingTickle()
} }
if (i < m_placedPartCount) { if (i < m_placedPartCount) {
MakePartPlaced(i); FUN_10079050(i);
ShowBuildPartByName(m_parts[i].m_name); ShowBuildPartByName(m_parts[i].m_name);
} }
@ -318,7 +318,7 @@ MxResult LegoCarBuildAnimPresenter::Serialize(LegoStorage* p_storage)
// FUNCTION: LEGO1 0x10079050 // FUNCTION: LEGO1 0x10079050
// FUNCTION: BETA10 0x1007151e // FUNCTION: BETA10 0x1007151e
void LegoCarBuildAnimPresenter::MakePartPlaced(MxS16 p_index) void LegoCarBuildAnimPresenter::FUN_10079050(MxS16 p_index)
{ {
SwapNodesByName(m_parts[p_index].m_wiredName, m_parts[p_index].m_name); SwapNodesByName(m_parts[p_index].m_wiredName, m_parts[p_index].m_name);
HideBuildPartByName(m_parts[p_index].m_wiredName); HideBuildPartByName(m_parts[p_index].m_wiredName);
@ -384,7 +384,7 @@ void LegoCarBuildAnimPresenter::InitBuildPlatform()
} }
assert(m_numberOfParts); assert(m_numberOfParts);
m_parts = new CarBuildPart[m_numberOfParts]; m_parts = new UnknownListEntry[m_numberOfParts];
assert(m_parts); assert(m_parts);
// Go through and add the wired name of each part // Go through and add the wired name of each part
@ -553,7 +553,7 @@ void LegoCarBuildAnimPresenter::AddPartToBuildByName(const LegoChar* p_name)
strcpy(m_parts[i].m_name, buffer); strcpy(m_parts[i].m_name, buffer);
Swap(m_parts[m_placedPartCount].m_objectId, m_parts[i].m_objectId); Swap(m_parts[m_placedPartCount].m_objectId, m_parts[i].m_objectId);
} }
MakePartPlaced(m_placedPartCount); FUN_10079050(m_placedPartCount);
m_placedPartCount++; m_placedPartCount++;
((LegoCarBuild*) m_currentWorld)->SetPlacedPartCount(m_placedPartCount); ((LegoCarBuild*) m_currentWorld)->SetPlacedPartCount(m_placedPartCount);
@ -646,7 +646,7 @@ MxBool LegoCarBuildAnimPresenter::StringEqualsShelf(const LegoChar* p_string)
// FUNCTION: LEGO1 0x10079c30 // FUNCTION: LEGO1 0x10079c30
// FUNCTION: BETA10 0x100726a6 // FUNCTION: BETA10 0x100726a6
MxBool LegoCarBuildAnimPresenter::IsNextPartToPlace(const LegoChar* p_name) MxBool LegoCarBuildAnimPresenter::FUN_10079c30(const LegoChar* p_name)
{ {
if (PartIsPlaced(p_name)) { if (PartIsPlaced(p_name)) {
return FALSE; return FALSE;
@ -710,7 +710,7 @@ void LegoCarBuildAnimPresenter::SetPartObjectIdByName(const LegoChar* p_name, Mx
// FUNCTION: LEGO1 0x10079e20 // FUNCTION: LEGO1 0x10079e20
// FUNCTION: BETA10 0x10072959 // FUNCTION: BETA10 0x10072959
const BoundingSphere& LegoCarBuildAnimPresenter::GetTargetBoundingSphere() const BoundingSphere& LegoCarBuildAnimPresenter::FUN_10079e20()
{ {
LegoROI* roi = m_carBuildEntity->GetROI(); LegoROI* roi = m_carBuildEntity->GetROI();
return roi->FindChildROI(m_parts[m_placedPartCount].m_wiredName, roi)->GetWorldBoundingSphere(); return roi->FindChildROI(m_parts[m_placedPartCount].m_wiredName, roi)->GetWorldBoundingSphere();

View File

@ -1800,7 +1800,7 @@ void LegoAnimationManager::FUN_10062580(AnimInfo& p_info)
// FUNCTION: LEGO1 0x10062650 // FUNCTION: LEGO1 0x10062650
// FUNCTION: BETA10 0x100436e2 // FUNCTION: BETA10 0x100436e2
MxBool LegoAnimationManager::FUN_10062650(Mx3DPointFloat& p_position, float p_und, LegoROI* p_roi) MxBool LegoAnimationManager::FUN_10062650(Vector3& p_position, float p_und, LegoROI* p_roi)
{ {
if (p_roi != NULL) { if (p_roi != NULL) {
Mx3DPointFloat position(p_position); Mx3DPointFloat position(p_position);

View File

@ -850,7 +850,7 @@ inline void LoadIsle()
{ {
LegoWorld* world = FindWorld(*g_isleScript, IsleScript::c__Isle); LegoWorld* world = FindWorld(*g_isleScript, IsleScript::c__Isle);
if (world != NULL) { if (world != NULL) {
if (!world->NoDisabledObjects()) { if (!world->GetUnknown0xd0Empty()) {
NotificationManager()->Send(world, MxNotificationParam(c_notificationType20, NULL)); NotificationManager()->Send(world, MxNotificationParam(c_notificationType20, NULL));
} }
} }

View File

@ -1,5 +1,6 @@
#include "legostate.h" #include "legostate.h"
#include <random>
#include <stdlib.h> #include <stdlib.h>
DECOMP_SIZE_ASSERT(LegoState, 0x08) DECOMP_SIZE_ASSERT(LegoState, 0x08)
@ -29,10 +30,17 @@ MxU32 LegoState::Playlist::Next()
} }
break; break;
case e_random: case e_random: {
#ifdef __WIIU__
static std::mt19937 rng{std::random_device{}()};
std::uniform_int_distribution<MxS32> dist(0, m_length - 1);
m_nextIndex = dist(rng);
#else
m_nextIndex = SDL_rand(m_length); m_nextIndex = SDL_rand(m_length);
#endif
objectId = m_objectIds[m_nextIndex]; objectId = m_objectIds[m_nextIndex];
break; break;
}
case e_loopSkipFirst: case e_loopSkipFirst:
objectId = m_objectIds[m_nextIndex]; objectId = m_objectIds[m_nextIndex];

View File

@ -32,7 +32,11 @@
#include "scripts.h" #include "scripts.h"
#include <SDL3/SDL_events.h> #include <SDL3/SDL_events.h>
#ifdef __WIIU__
#include <SDL3/SDL.h>
#else
#include <SDL3/SDL_process.h> #include <SDL3/SDL_process.h>
#endif
#include <SDL3/SDL_stdinc.h> #include <SDL3/SDL_stdinc.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
@ -322,8 +326,10 @@ void InvokeAction(Extra::ActionType p_actionId, const MxAtomId& p_pAtom, MxS32 p
break; break;
case Extra::ActionType::e_run: { case Extra::ActionType::e_run: {
#if SDL_MAJOR_VERSION >= 3
const char* args[] = {"/lego/sources/main/main.exe", "/script", p_pAtom.GetInternal(), NULL}; const char* args[] = {"/lego/sources/main/main.exe", "/script", p_pAtom.GetInternal(), NULL};
SDL_Process* process = SDL_CreateProcess(args, false); SDL_Process* process = SDL_CreateProcess(args, false);
#endif
} break; } break;
case Extra::ActionType::e_enable: case Extra::ActionType::e_enable:
assert(p_streamId != DS_NOT_A_STREAM); assert(p_streamId != DS_NOT_A_STREAM);

View File

@ -125,9 +125,15 @@ MxResult MxTransitionManager::StartTransition(
m_animationSpeed = p_speed; m_animationSpeed = p_speed;
TickleManager()->RegisterClient(this, p_speed); MxTickleManager* tickleManager = TickleManager();
InputManager()->DisableInputProcessing(); tickleManager->RegisterClient(this, p_speed);
VideoManager()->SetRender3D(FALSE);
LegoInputManager* inputManager = InputManager();
inputManager->SetUnknown88(TRUE);
inputManager->SetUnknown336(FALSE);
LegoVideoManager* videoManager = VideoManager();
videoManager->SetRender3D(FALSE);
SetAppCursor(e_cursorBusy); SetAppCursor(e_cursorBusy);
return SUCCESS; return SUCCESS;

View File

@ -129,7 +129,7 @@ const char* LegoActor::GetActorName(MxU8 p_id)
// FUNCTION: LEGO1 0x1002d670 // FUNCTION: LEGO1 0x1002d670
// FUNCTION: BETA10 0x1003d65f // FUNCTION: BETA10 0x1003d65f
void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_updateTransform) void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
{ {
if (p_roi) { if (p_roi) {
const char* name = p_roi->GetName(); const char* name = p_roi->GetName();
@ -143,7 +143,7 @@ void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_updateTransform)
} }
} }
LegoEntity::SetROI(p_roi, p_bool1, p_updateTransform); LegoEntity::SetROI(p_roi, p_bool1, p_bool2);
} }
// FUNCTION: LEGO1 0x1002d6e0 // FUNCTION: LEGO1 0x1002d6e0

View File

@ -127,12 +127,12 @@ void LegoEntity::SetWorld()
// FUNCTION: LEGO1 0x100108a0 // FUNCTION: LEGO1 0x100108a0
// FUNCTION: BETA10 0x1007e724 // FUNCTION: BETA10 0x1007e724
void LegoEntity::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_updateTransform) void LegoEntity::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
{ {
m_roi = p_roi; m_roi = p_roi;
if (m_roi != NULL) { if (m_roi != NULL) {
if (p_updateTransform) { if (p_bool2) {
MxMatrix mat; MxMatrix mat;
CalcLocalTransform( CalcLocalTransform(
Mx3DPointFloat(m_worldLocation[0], m_worldLocation[1], m_worldLocation[2]), Mx3DPointFloat(m_worldLocation[0], m_worldLocation[1], m_worldLocation[2]),

View File

@ -75,7 +75,7 @@ MxResult LegoWorld::Create(MxDSAction& p_dsAction)
return FAILURE; return FAILURE;
} }
if (!InitializeCameraController()) { if (!VTable0x54()) {
return FAILURE; return FAILURE;
} }
@ -135,10 +135,10 @@ void LegoWorld::Destroy(MxBool p_fromDestructor)
} }
} }
while (!m_objects.empty()) { while (!m_set0xa8.empty()) {
MxCoreSet::iterator it = m_objects.begin(); MxCoreSet::iterator it = m_set0xa8.begin();
MxCore* object = *it; MxCore* object = *it;
m_objects.erase(it); m_set0xa8.erase(it);
if (object->IsA("MxPresenter")) { if (object->IsA("MxPresenter")) {
MxPresenter* presenter = (MxPresenter*) object; MxPresenter* presenter = (MxPresenter*) object;
@ -166,7 +166,7 @@ void LegoWorld::Destroy(MxBool p_fromDestructor)
} }
} }
if (m_worldId != LegoOmni::e_undefined && m_disabledObjects.empty()) { if (m_worldId != LegoOmni::e_undefined && m_set0xd0.empty()) {
PlantManager()->Reset(m_worldId); PlantManager()->Reset(m_worldId);
BuildingManager()->Reset(); BuildingManager()->Reset();
} }
@ -234,7 +234,7 @@ MxLong LegoWorld::Notify(MxParam& p_param)
// FUNCTION: LEGO1 0x1001f630 // FUNCTION: LEGO1 0x1001f630
// FUNCTION: BETA10 0x100d9fc2 // FUNCTION: BETA10 0x100d9fc2
LegoCameraController* LegoWorld::InitializeCameraController() LegoCameraController* LegoWorld::VTable0x54()
{ {
MxBool success = FALSE; MxBool success = FALSE;
@ -357,7 +357,7 @@ MxBool LegoWorld::ActorExists(LegoPathActor* p_actor)
// FUNCTION: LEGO1 0x1001fda0 // FUNCTION: LEGO1 0x1001fda0
// FUNCTION: BETA10 0x100da621 // FUNCTION: BETA10 0x100da621
void LegoWorld::AddPresenterIfInRange(LegoAnimPresenter* p_presenter) void LegoWorld::FUN_1001fda0(LegoAnimPresenter* p_presenter)
{ {
LegoPathControllerListCursor cursor(&m_pathControllerList); LegoPathControllerListCursor cursor(&m_pathControllerList);
LegoPathController* controller; LegoPathController* controller;
@ -369,7 +369,7 @@ void LegoWorld::AddPresenterIfInRange(LegoAnimPresenter* p_presenter)
// FUNCTION: LEGO1 0x1001fe90 // FUNCTION: LEGO1 0x1001fe90
// FUNCTION: BETA10 0x100da6b5 // FUNCTION: BETA10 0x100da6b5
void LegoWorld::RemovePresenterFromBoundaries(LegoAnimPresenter* p_presenter) void LegoWorld::FUN_1001fe90(LegoAnimPresenter* p_presenter)
{ {
LegoPathControllerListCursor cursor(&m_pathControllerList); LegoPathControllerListCursor cursor(&m_pathControllerList);
LegoPathController* controller; LegoPathController* controller;
@ -486,25 +486,25 @@ void LegoWorld::Add(MxCore* p_object)
} }
#endif #endif
else { else {
MxCoreSet::iterator it = m_objects.find(p_object); MxCoreSet::iterator it = m_set0xa8.find(p_object);
if (it == m_objects.end()) { if (it == m_set0xa8.end()) {
#ifdef BETA10 #ifdef BETA10
if (p_object->IsA("MxPresenter")) { if (p_object->IsA("MxPresenter")) {
assert(static_cast<MxPresenter*>(p_object)->GetAction()); assert(static_cast<MxPresenter*>(p_object)->GetAction());
} }
#endif #endif
m_objects.insert(p_object); m_set0xa8.insert(p_object);
} }
else { else {
assert(0); assert(0);
} }
} }
if (m_disabledObjects.size() != 0 && p_object->IsA("MxPresenter")) { if (m_set0xd0.size() != 0 && p_object->IsA("MxPresenter")) {
if (((MxPresenter*) p_object)->IsEnabled()) { if (((MxPresenter*) p_object)->IsEnabled()) {
((MxPresenter*) p_object)->Enable(FALSE); ((MxPresenter*) p_object)->Enable(FALSE);
m_disabledObjects.insert(p_object); m_set0xd0.insert(p_object);
} }
} }
} }
@ -562,15 +562,15 @@ void LegoWorld::Remove(MxCore* p_object)
} }
#endif #endif
else { else {
it = m_objects.find(p_object); it = m_set0xa8.find(p_object);
if (it != m_objects.end()) { if (it != m_set0xa8.end()) {
m_objects.erase(it); m_set0xa8.erase(it);
} }
} }
it = m_disabledObjects.find(p_object); it = m_set0xd0.find(p_object);
if (it != m_disabledObjects.end()) { if (it != m_set0xd0.end()) {
m_disabledObjects.erase(it); m_set0xd0.erase(it);
} }
} }
@ -622,7 +622,7 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name)
return NULL; return NULL;
} }
for (MxCoreSet::iterator i = m_objects.begin(); i != m_objects.end(); i++) { for (MxCoreSet::iterator i = m_set0xa8.begin(); i != m_set0xa8.end(); i++) {
if ((*i)->IsA(p_class) && (*i)->IsA("MxPresenter")) { if ((*i)->IsA(p_class) && (*i)->IsA("MxPresenter")) {
assert(((MxPresenter*) (*i))->GetAction()); assert(((MxPresenter*) (*i))->GetAction());
@ -675,7 +675,7 @@ MxCore* LegoWorld::Find(const MxAtomId& p_atom, MxS32 p_entityId)
} }
} }
for (MxCoreSet::iterator it = m_objects.begin(); it != m_objects.end(); it++) { for (MxCoreSet::iterator it = m_set0xa8.begin(); it != m_set0xa8.end(); it++) {
MxCore* core = *it; MxCore* core = *it;
if (core->IsA("MxPresenter")) { if (core->IsA("MxPresenter")) {
@ -697,7 +697,7 @@ void LegoWorld::Enable(MxBool p_enable)
{ {
MxCoreSet::iterator it; MxCoreSet::iterator it;
if (p_enable && m_disabledObjects.size() != 0) { if (p_enable && m_set0xd0.size() != 0) {
if (CurrentWorld() == this) { if (CurrentWorld() == this) {
return; return;
} }
@ -720,8 +720,8 @@ void LegoWorld::Enable(MxBool p_enable)
} }
} }
while (m_disabledObjects.size() != 0) { while (m_set0xd0.size() != 0) {
it = m_disabledObjects.begin(); it = m_set0xd0.begin();
if ((*it)->IsA("MxPresenter")) { if ((*it)->IsA("MxPresenter")) {
((MxPresenter*) *it)->Enable(TRUE); ((MxPresenter*) *it)->Enable(TRUE);
@ -730,7 +730,7 @@ void LegoWorld::Enable(MxBool p_enable)
((LegoPathController*) *it)->Enable(TRUE); ((LegoPathController*) *it)->Enable(TRUE);
} }
m_disabledObjects.erase(it); m_set0xd0.erase(it);
} }
SetCurrentWorld(this); SetCurrentWorld(this);
@ -754,7 +754,7 @@ void LegoWorld::Enable(MxBool p_enable)
SetIsWorldActive(TRUE); SetIsWorldActive(TRUE);
#endif #endif
} }
else if (!p_enable && m_disabledObjects.size() == 0) { else if (!p_enable && m_set0xd0.size() == 0) {
MxPresenter* presenter; MxPresenter* presenter;
LegoPathController* controller; LegoPathController* controller;
LegoPathActor* actor = UserActor(); LegoPathActor* actor = UserActor();
@ -764,7 +764,7 @@ void LegoWorld::Enable(MxBool p_enable)
} }
AnimationManager()->Reset(FALSE); AnimationManager()->Reset(FALSE);
m_disabledObjects.insert(this); m_set0xd0.insert(this);
if (m_worldId != LegoOmni::e_undefined) { if (m_worldId != LegoOmni::e_undefined) {
PlantManager()->Reset(m_worldId); PlantManager()->Reset(m_worldId);
@ -777,15 +777,15 @@ void LegoWorld::Enable(MxBool p_enable)
while (controlPresenterCursor.Next(presenter)) { while (controlPresenterCursor.Next(presenter)) {
if (presenter->IsEnabled()) { if (presenter->IsEnabled()) {
m_disabledObjects.insert(presenter); m_set0xd0.insert(presenter);
presenter->Enable(FALSE); presenter->Enable(FALSE);
} }
} }
for (MxCoreSet::iterator it = m_objects.begin(); it != m_objects.end(); it++) { for (MxCoreSet::iterator it = m_set0xa8.begin(); it != m_set0xa8.end(); it++) {
if ((*it)->IsA("LegoActionControlPresenter") || if ((*it)->IsA("LegoActionControlPresenter") ||
((*it)->IsA("MxPresenter") && ((MxPresenter*) *it)->IsEnabled())) { ((*it)->IsA("MxPresenter") && ((MxPresenter*) *it)->IsEnabled())) {
m_disabledObjects.insert(*it); m_set0xd0.insert(*it);
((MxPresenter*) *it)->Enable(FALSE); ((MxPresenter*) *it)->Enable(FALSE);
} }
} }
@ -811,7 +811,7 @@ void LegoWorld::Enable(MxBool p_enable)
while (pathControllerCursor.Next(controller)) { while (pathControllerCursor.Next(controller)) {
controller->Enable(FALSE); controller->Enable(FALSE);
m_disabledObjects.insert(controller); m_set0xd0.insert(controller);
} }
GetViewManager()->RemoveAll(NULL); GetViewManager()->RemoveAll(NULL);
@ -869,7 +869,7 @@ MxBool LegoWorld::PresentersPending()
} }
} }
for (MxCoreSet::iterator it = m_objects.begin(); it != m_objects.end(); it++) { for (MxCoreSet::iterator it = m_set0xa8.begin(); it != m_set0xa8.end(); it++) {
if ((*it)->IsA("MxPresenter")) { if ((*it)->IsA("MxPresenter")) {
presenter = (MxPresenter*) *it; presenter = (MxPresenter*) *it;

View File

@ -59,7 +59,7 @@ LegoWorldPresenter::~LegoWorldPresenter()
PlantManager()->LoadWorldInfo(worldId); PlantManager()->LoadWorldInfo(worldId);
AnimationManager()->LoadWorldInfo(worldId); AnimationManager()->LoadWorldInfo(worldId);
BuildingManager()->LoadWorldInfo(); BuildingManager()->LoadWorldInfo();
result = ((LegoWorld*) m_entity)->WaitForTransition(); result = ((LegoWorld*) m_entity)->VTable0x5c();
} }
if (result == FALSE) { if (result == FALSE) {

View File

@ -13,6 +13,15 @@
#include <SDL3/SDL_log.h> #include <SDL3/SDL_log.h>
#ifdef __WIIU__
template <class... Ts>
struct overloaded : Ts... {
using Ts::operator()...;
};
template <class... Ts>
overloaded(Ts...) -> overloaded<Ts...>;
#endif
DECOMP_SIZE_ASSERT(LegoInputManager, 0x338) DECOMP_SIZE_ASSERT(LegoInputManager, 0x338)
DECOMP_SIZE_ASSERT(LegoNotifyList, 0x18) DECOMP_SIZE_ASSERT(LegoNotifyList, 0x18)
DECOMP_SIZE_ASSERT(LegoNotifyListCursor, 0x10) DECOMP_SIZE_ASSERT(LegoNotifyListCursor, 0x10)
@ -41,7 +50,7 @@ LegoInputManager::LegoInputManager()
m_y = 0; m_y = 0;
m_controlManager = NULL; m_controlManager = NULL;
m_unk0x81 = FALSE; m_unk0x81 = FALSE;
m_inputProcessingDisabled = FALSE; m_unk0x88 = FALSE;
m_unk0x195 = 0; m_unk0x195 = 0;
m_unk0x335 = FALSE; m_unk0x335 = FALSE;
m_unk0x336 = FALSE; m_unk0x336 = FALSE;
@ -248,7 +257,7 @@ void LegoInputManager::QueueEvent(NotificationId p_id, MxU8 p_modifier, MxLong p
{ {
LegoEventNotificationParam param = LegoEventNotificationParam(p_id, NULL, p_modifier, p_x, p_y, p_key); LegoEventNotificationParam param = LegoEventNotificationParam(p_id, NULL, p_modifier, p_x, p_y, p_key);
if (((!m_inputProcessingDisabled) || ((m_unk0x335 && (param.GetNotification() == c_notificationButtonDown)))) || if (((!m_unk0x88) || ((m_unk0x335 && (param.GetNotification() == c_notificationButtonDown)))) ||
((m_unk0x336 && (p_key == SDLK_SPACE)))) { ((m_unk0x336 && (p_key == SDLK_SPACE)))) {
ProcessOneEvent(param); ProcessOneEvent(param);
} }
@ -499,10 +508,9 @@ void LegoInputManager::StopAutoDragTimer()
} }
// FUNCTION: LEGO1 0x1005cff0 // FUNCTION: LEGO1 0x1005cff0
// FUNCTION: BETA10 0x10096a10
void LegoInputManager::EnableInputProcessing() void LegoInputManager::EnableInputProcessing()
{ {
m_inputProcessingDisabled = FALSE; m_unk0x88 = FALSE;
g_clickedObjectId = -1; g_clickedObjectId = -1;
g_clickedAtom = NULL; g_clickedAtom = NULL;
} }
@ -782,14 +790,26 @@ void LegoInputManager::UpdateLastInputMethod(SDL_Event* p_event)
switch (p_event->type) { switch (p_event->type) {
case SDL_EVENT_KEY_DOWN: case SDL_EVENT_KEY_DOWN:
case SDL_EVENT_KEY_UP: case SDL_EVENT_KEY_UP:
#if SDL_MAJOR_VERSION >= 3
m_lastInputMethod = SDL_KeyboardID_v{p_event->key.which}; m_lastInputMethod = SDL_KeyboardID_v{p_event->key.which};
#else
m_lastInputMethod = SDL_KeyboardID_v{0};
#endif
break; break;
case SDL_EVENT_MOUSE_BUTTON_DOWN: case SDL_EVENT_MOUSE_BUTTON_DOWN:
case SDL_EVENT_MOUSE_BUTTON_UP: case SDL_EVENT_MOUSE_BUTTON_UP:
#if SDL_MAJOR_VERSION >= 3
m_lastInputMethod = SDL_MouseID_v{p_event->button.which}; m_lastInputMethod = SDL_MouseID_v{p_event->button.which};
#else
m_lastInputMethod = SDL_MouseID_v{0};
#endif
break; break;
case SDL_EVENT_MOUSE_MOTION: case SDL_EVENT_MOUSE_MOTION:
#if SDL_MAJOR_VERSION >= 3
m_lastInputMethod = SDL_MouseID_v{p_event->motion.which}; m_lastInputMethod = SDL_MouseID_v{p_event->motion.which};
#else
m_lastInputMethod = SDL_MouseID_v{0};
#endif
break; break;
case SDL_EVENT_GAMEPAD_BUTTON_DOWN: case SDL_EVENT_GAMEPAD_BUTTON_DOWN:
case SDL_EVENT_GAMEPAD_BUTTON_UP: case SDL_EVENT_GAMEPAD_BUTTON_UP:

View File

@ -9,6 +9,7 @@
#include "legogamestate.h" #include "legogamestate.h"
#include "legoinputmanager.h" #include "legoinputmanager.h"
#include "legoobjectfactory.h" #include "legoobjectfactory.h"
#include "legopartpresenter.h"
#include "legoplantmanager.h" #include "legoplantmanager.h"
#include "legosoundmanager.h" #include "legosoundmanager.h"
#include "legoutils.h" #include "legoutils.h"

View File

@ -19,6 +19,7 @@ DECOMP_SIZE_ASSERT(LegoPathStruct, 0x14)
extern MxU32 g_isleFlags; extern MxU32 g_isleFlags;
// GLOBAL: LEGO1 0x100f119c // GLOBAL: LEGO1 0x100f119c
// GLOBAL: BETA10 0x100f119c
MxBool g_unk0x100f119c = FALSE; MxBool g_unk0x100f119c = FALSE;
// FUNCTION: LEGO1 0x1001b700 // FUNCTION: LEGO1 0x1001b700

View File

@ -70,7 +70,6 @@ const LegoChar* g_strCRCEDGEY0 = "C_RCEDGEY0";
MxS32 g_unk0x100f0c7c = 2; MxS32 g_unk0x100f0c7c = 2;
// FUNCTION: LEGO1 0x10016a90 // FUNCTION: LEGO1 0x10016a90
// FUNCTION: BETA10 0x100c82e8
CarRace::CarRace() CarRace::CarRace()
{ {
m_skeleton = NULL; m_skeleton = NULL;

View File

@ -53,7 +53,6 @@ MxResult LegoRace::Create(MxDSAction& p_dsAction)
} }
// FUNCTION: LEGO1 0x10015d40 // FUNCTION: LEGO1 0x10015d40
// FUNCTION: BETA10 0x100c7ab5
LegoRace::~LegoRace() LegoRace::~LegoRace()
{ {
g_unk0x100f119c = FALSE; g_unk0x100f119c = FALSE;
@ -102,7 +101,7 @@ MxLong LegoRace::Notify(MxParam& p_param)
// FUNCTION: BETA10 0x100c7c3f // FUNCTION: BETA10 0x100c7c3f
void LegoRace::Enable(MxBool p_enable) void LegoRace::Enable(MxBool p_enable)
{ {
if (NoDisabledObjects() != p_enable && !p_enable) { if (GetUnknown0xd0Empty() != p_enable && !p_enable) {
Remove(UserActor()); Remove(UserActor());
MxU8 oldActorId = GameState()->GetActorId(); MxU8 oldActorId = GameState()->GetActorId();

View File

@ -1139,7 +1139,7 @@ void LegoAnimPresenter::VTable0x8c()
} }
if (m_currentWorld) { if (m_currentWorld) {
m_currentWorld->AddPresenterIfInRange(this); m_currentWorld->FUN_1001fda0(this);
if (!m_compositePresenter || !m_compositePresenter->IsA("LegoAnimMMPresenter")) { if (!m_compositePresenter || !m_compositePresenter->IsA("LegoAnimMMPresenter")) {
m_currentWorld->Add(this); m_currentWorld->Add(this);
} }
@ -1151,7 +1151,7 @@ void LegoAnimPresenter::VTable0x8c()
void LegoAnimPresenter::VTable0x90() void LegoAnimPresenter::VTable0x90()
{ {
if (m_currentWorld != NULL) { if (m_currentWorld != NULL) {
m_currentWorld->RemovePresenterFromBoundaries(this); m_currentWorld->FUN_1001fe90(this);
if (m_compositePresenter != NULL && m_compositePresenter->IsA("LegoAnimMMPresenter")) { if (m_compositePresenter != NULL && m_compositePresenter->IsA("LegoAnimMMPresenter")) {
return; return;

View File

@ -104,6 +104,7 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
PALETTEENTRY paletteEntries[256]; PALETTEENTRY paletteEntries[256];
p_videoParam.GetPalette()->GetEntries(paletteEntries); p_videoParam.GetPalette()->GetEntries(paletteEntries);
#ifndef __WIIU__
if (CreateDirect3D() != SUCCESS) { if (CreateDirect3D() != SUCCESS) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "::CreateDirect3D failed"); SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "::CreateDirect3D failed");
goto done; goto done;
@ -130,6 +131,7 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
} }
m_direct3d->SetDevice(deviceEnumerate, driver, device); m_direct3d->SetDevice(deviceEnumerate, driver, device);
#endif
if (driver->m_ddCaps.dwCaps2 != DDCAPS2_CERTIFIED && driver->m_ddCaps.dwSVBRops[7] != 2) { if (driver->m_ddCaps.dwCaps2 != DDCAPS2_CERTIFIED && driver->m_ddCaps.dwSVBRops[7] != 2) {
p_videoParam.Flags().SetLacksLightSupport(TRUE); p_videoParam.Flags().SetLacksLightSupport(TRUE);
@ -312,7 +314,9 @@ MxResult LegoVideoManager::Tickle()
m_stopWatch->Reset(); m_stopWatch->Reset();
m_stopWatch->Start(); m_stopWatch->Start();
#ifndef __WIIU__
m_direct3d->RestoreSurfaces(); m_direct3d->RestoreSurfaces();
#endif
SortPresenterList(); SortPresenterList();

View File

@ -893,7 +893,7 @@ void Act3::FUN_10073a60()
// FUNCTION: LEGO1 0x10073a90 // FUNCTION: LEGO1 0x10073a90
void Act3::Enable(MxBool p_enable) void Act3::Enable(MxBool p_enable)
{ {
if ((MxBool) m_disabledObjects.empty() == p_enable) { if ((MxBool) m_set0xd0.empty() == p_enable) {
return; return;
} }

View File

@ -1301,7 +1301,7 @@ void Infocenter::StopCutscene()
} }
// FUNCTION: LEGO1 0x10070d00 // FUNCTION: LEGO1 0x10070d00
MxBool Infocenter::WaitForTransition() MxBool Infocenter::VTable0x5c()
{ {
return TRUE; return TRUE;
} }
@ -1453,10 +1453,10 @@ void Infocenter::StartCredits()
{ {
MxPresenter* presenter; MxPresenter* presenter;
while (!m_objects.empty()) { while (!m_set0xa8.empty()) {
MxCoreSet::iterator it = m_objects.begin(); MxCoreSet::iterator it = m_set0xa8.begin();
MxCore* object = *it; MxCore* object = *it;
m_objects.erase(it); m_set0xa8.erase(it);
if (object->IsA("MxPresenter")) { if (object->IsA("MxPresenter")) {
presenter = (MxPresenter*) object; presenter = (MxPresenter*) object;

View File

@ -540,7 +540,7 @@ MxLong Isle::HandlePathStruct(LegoPathStructNotificationParam& p_param)
// FUNCTION: BETA10 0x10034158 // FUNCTION: BETA10 0x10034158
void Isle::Enable(MxBool p_enable) void Isle::Enable(MxBool p_enable)
{ {
if ((MxBool) m_disabledObjects.empty() == p_enable) { if ((MxBool) m_set0xd0.empty() == p_enable) {
return; return;
} }

View File

@ -33,11 +33,11 @@ DECOMP_SIZE_ASSERT(LegoAct2, 0x1154)
DECOMP_SIZE_ASSERT(LegoAct2State, 0x10) DECOMP_SIZE_ASSERT(LegoAct2State, 0x10)
// GLOBAL: LEGO1 0x100f4474 // GLOBAL: LEGO1 0x100f4474
Act2mainScript::Script g_bricksterSpeech = (Act2mainScript::Script) 0; Act2mainScript::Script g_unk0x100f4474 = (Act2mainScript::Script) 0;
// GLOBAL: LEGO1 0x100f43f0 // GLOBAL: LEGO1 0x100f43f0
// GLOBAL: BETA10 0x101e14a8 // GLOBAL: BETA10 0x101e14a8
MxS32 g_animationsBricksterIsLoose[] = { MxS32 g_unk0x100f43f0[] = {
Act2mainScript::c_tns030bd_RunAnim, Act2mainScript::c_tns030bd_RunAnim,
Act2mainScript::c_tns030pg_RunAnim, Act2mainScript::c_tns030pg_RunAnim,
Act2mainScript::c_tns030rd_RunAnim, Act2mainScript::c_tns030rd_RunAnim,
@ -49,7 +49,7 @@ MxS32 g_animationsBricksterIsLoose[] = {
}; };
// GLOBAL: LEGO1 0x100f4410 // GLOBAL: LEGO1 0x100f4410
const LegoChar* g_charactersBricksterIsLoose[] = {"bd", "pg", "rd", "sy", "ro", "cl"}; const LegoChar* g_unk0x100f4410[] = {"bd", "pg", "rd", "sy", "ro", "cl"};
// GLOBAL: LEGO1 0x100f4428 // GLOBAL: LEGO1 0x100f4428
MxS32 g_unk0x100f4428[] = { MxS32 g_unk0x100f4428[] = {
@ -74,17 +74,17 @@ const LegoChar* g_unk0x100f4458[] = {"papa", "nick", "laura", "cl", "pg", "rd",
// FUNCTION: BETA10 0x1003a5a0 // FUNCTION: BETA10 0x1003a5a0
LegoAct2::LegoAct2() LegoAct2::LegoAct2()
{ {
m_state = LegoAct2::e_initial; m_unk0x10c4 = 0;
m_gameState = NULL; m_gameState = NULL;
m_pepper = NULL; m_pepper = NULL;
m_ambulance = NULL; m_ambulance = NULL;
m_ready = FALSE; m_ready = FALSE;
m_unk0x1130 = 0; m_unk0x1130 = 0;
m_nextBrick = 0; m_nextBrick = 0;
m_removedBricks = 0; m_unk0x10c1 = 0;
m_unk0x1138 = NULL; m_unk0x1138 = NULL;
m_currentAction = (Act2mainScript::Script) 0; m_unk0x1140 = (Act2mainScript::Script) 0;
m_infomanDirecting = (Act2mainScript::Script) 0; m_unk0x1144 = (Act2mainScript::Script) 0;
m_destLocation = LegoGameState::e_undefined; m_destLocation = LegoGameState::e_undefined;
m_music = JukeboxScript::c_MusicTheme1; m_music = JukeboxScript::c_MusicTheme1;
m_siFile = ""; m_siFile = "";
@ -166,97 +166,97 @@ MxResult LegoAct2::Tickle()
return SUCCESS; return SUCCESS;
} }
switch (m_state) { switch (m_unk0x10c4) {
case LegoAct2::e_initial: case 0:
m_state = LegoAct2::e_startSpeech; m_unk0x10c4 = 1;
break; break;
case LegoAct2::e_startSpeech: case 1:
((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled); ((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled);
switch (SDL_rand(3)) { switch (SDL_rand(3)) {
case 0: case 0:
g_bricksterSpeech = Act2mainScript::c_tns002br_RunAnim; g_unk0x100f4474 = Act2mainScript::c_tns002br_RunAnim;
break; break;
case 1: case 1:
g_bricksterSpeech = Act2mainScript::c_tns003br_RunAnim; g_unk0x100f4474 = Act2mainScript::c_tns003br_RunAnim;
break; break;
case 2: case 2:
g_bricksterSpeech = Act2mainScript::c_tns004br_RunAnim; g_unk0x100f4474 = Act2mainScript::c_tns004br_RunAnim;
break; break;
} }
StartAction(g_bricksterSpeech, TRUE, TRUE, NULL, NULL, NULL); FUN_10052560(g_unk0x100f4474, TRUE, TRUE, NULL, NULL, NULL);
m_timeSinceLastStage = 0; m_unk0x10d0 = 0;
m_state = LegoAct2::e_holdingSpeech; m_unk0x10c4 = 2;
break; break;
case LegoAct2::e_holdingSpeech: case 2:
if (g_bricksterSpeech) { if (g_unk0x100f4474) {
if (AnimationManager()->FUN_10064ee0(g_bricksterSpeech)) { if (AnimationManager()->FUN_10064ee0(g_unk0x100f4474)) {
Disable(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); Disable(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
g_bricksterSpeech = (Act2mainScript::Script) 0; g_unk0x100f4474 = (Act2mainScript::Script) 0;
} }
} }
m_timeSinceLastStage += 50; m_unk0x10d0 += 50;
break; break;
case LegoAct2::e_startDescription: case 3:
Disable(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); Disable(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
m_timeSinceLastStage = 0; m_unk0x10d0 = 0;
m_state = LegoAct2::e_explaining; m_unk0x10c4 = 4;
StartAction(Act2mainScript::c_tja009ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_tja009ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL);
AnimationManager()->EnableCamAnims(TRUE); AnimationManager()->EnableCamAnims(TRUE);
AnimationManager()->FUN_1005f6d0(TRUE); AnimationManager()->FUN_1005f6d0(TRUE);
AnimationManager()->FUN_100604f0(g_animationsBricksterIsLoose, sizeOfArray(g_animationsBricksterIsLoose)); AnimationManager()->FUN_100604f0(g_unk0x100f43f0, sizeOfArray(g_unk0x100f43f0));
AnimationManager()->FUN_10060480(g_charactersBricksterIsLoose, sizeOfArray(g_charactersBricksterIsLoose)); AnimationManager()->FUN_10060480(g_unk0x100f4410, sizeOfArray(g_unk0x100f4410));
break; break;
case LegoAct2::e_explaining: case 4:
m_timeSinceLastStage += 50; m_unk0x10d0 += 50;
break; break;
case LegoAct2::e_goingToResidentialArea: case 5:
m_timeSinceLastStage += 50; m_unk0x10d0 += 50;
if (m_timeSinceLastStage == 20000) { if (m_unk0x10d0 == 20000) {
const MxFloat* pepperPosition = FindROI("pepper")->GetWorldPosition(); const MxFloat* pepperPosition = FindROI("pepper")->GetWorldPosition();
MxFloat otherPoint[] = {-52.0f, 5.25f, -16.5f}; MxFloat otherPoint[] = {-52.0f, 5.25f, -16.5f};
distance = DISTSQRD3(pepperPosition, otherPoint); distance = DISTSQRD3(pepperPosition, otherPoint);
if (m_infomanDirecting == (Act2mainScript::Script) 0 && distance > 50.0f && pepperPosition[0] > -57.0f) { if (m_unk0x1144 == (Act2mainScript::Script) 0 && distance > 50.0f && pepperPosition[0] > -57.0f) {
StartAction(Act2mainScript::c_Avo906In_PlayWav, FALSE, FALSE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_Avo906In_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
m_infomanDirecting = Act2mainScript::c_Avo906In_PlayWav; m_unk0x1144 = Act2mainScript::c_Avo906In_PlayWav;
} }
} }
else if (m_timeSinceLastStage >= 90000 && m_timeSinceLastStage % 90000 == 0 && m_infomanDirecting == (Act2mainScript::Script) 0) { else if (m_unk0x10d0 >= 90000 && m_unk0x10d0 % 90000 == 0 && m_unk0x1144 == (Act2mainScript::Script) 0) {
StartAction(Act2mainScript::c_Avo908In_PlayWav, FALSE, FALSE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_Avo908In_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
m_infomanDirecting = Act2mainScript::c_Avo908In_PlayWav; m_unk0x1144 = Act2mainScript::c_Avo908In_PlayWav;
} }
break; break;
case LegoAct2::e_atResidentialArea: case 6:
m_timeSinceLastStage += 50; m_unk0x10d0 += 50;
break; break;
case LegoAct2::e_droppingBrick: case 9:
m_timeSinceLastStage += 50; m_unk0x10d0 += 50;
if (m_timeSinceLastStage >= 200) { if (m_unk0x10d0 >= 200) {
if (m_nextBrick < 5) { if (m_nextBrick < 5) {
m_state = LegoAct2::e_chase; m_unk0x10c4 = 7;
} }
else { else {
m_state = LegoAct2::e_goingToHide; m_unk0x10c4 = 10;
m_timeSinceLastStage = 0; m_unk0x10d0 = 0;
m_unk0x1138->GoingToHide(); m_unk0x1138->FUN_10019520();
} }
} }
break; break;
case LegoAct2::e_goingToHide: case 10:
m_timeSinceLastStage += 50; m_unk0x10d0 += 50;
break; break;
case LegoAct2::e_hidden: case 11:
break; break;
case LegoAct2::e_distributeRemainingBricks: case 12:
break; break;
} }
@ -297,9 +297,9 @@ MxLong LegoAct2::Notify(MxParam& p_param)
case c_notificationAct2Brick: case c_notificationAct2Brick:
SoundManager()->GetCacheSoundManager()->Play("28bng", NULL, FALSE); SoundManager()->GetCacheSoundManager()->Play("28bng", NULL, FALSE);
m_removedBricks++; m_unk0x10c1++;
if (m_removedBricks == 10 && m_state == LegoAct2::e_brickHunt) { if (m_unk0x10c1 == 10 && m_unk0x10c4 == 13) {
m_state = LegoAct2::e_allPiecesCollected; m_unk0x10c4 = 14;
LegoEntity* entity = (LegoEntity*) param.GetSender(); LegoEntity* entity = (LegoEntity*) param.GetSender();
@ -326,10 +326,10 @@ MxLong LegoAct2::Notify(MxParam& p_param)
Mx3DPointFloat locald4(local2world[2]); Mx3DPointFloat locald4(local2world[2]);
Mx3DPointFloat localc0(local2world[1]); Mx3DPointFloat localc0(local2world[1]);
StartAction(Act2mainScript::c_tns051in_RunAnim, TRUE, TRUE, &locala4, &locald4, NULL); FUN_10052560(Act2mainScript::c_tns051in_RunAnim, TRUE, TRUE, &locala4, &locald4, NULL);
m_state = LegoAct2::e_allPiecesCollected; m_unk0x10c4 = 14;
m_timeSinceLastStage = 0; m_unk0x10d0 = 0;
((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled); ((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled);
} }
break; break;
@ -348,27 +348,27 @@ MxLong LegoAct2::HandleEndAction(MxEndActionNotificationParam& p_param)
if (m_gameState->m_enabled && p_param.GetAction() != NULL) { if (m_gameState->m_enabled && p_param.GetAction() != NULL) {
MxU32 objectId = p_param.GetAction()->GetObjectId(); MxU32 objectId = p_param.GetAction()->GetObjectId();
if (m_state == LegoAct2::e_goingToResidentialArea && m_infomanDirecting == objectId) { if (m_unk0x10c4 == 5 && m_unk0x1144 == objectId) {
m_infomanDirecting = (Act2mainScript::Script) 0; m_unk0x1144 = (Act2mainScript::Script) 0;
return 0; return 0;
} }
if (m_currentAction != objectId) { if (m_unk0x1140 != objectId) {
return 0; return 0;
} }
m_currentAction = (Act2mainScript::Script) 0; m_unk0x1140 = (Act2mainScript::Script) 0;
switch (m_state) { switch (m_unk0x10c4) {
case LegoAct2::e_holdingSpeech: case 2:
m_state = LegoAct2::e_startDescription; m_unk0x10c4 = 3;
break; break;
case LegoAct2::e_explaining: case 4:
HideMaPaInfo(); FUN_10051960();
m_state = LegoAct2::e_goingToResidentialArea; m_unk0x10c4 = 5;
m_timeSinceLastStage = 0; m_unk0x10d0 = 0;
break; break;
case LegoAct2::e_atResidentialArea: { case 6: {
LegoROI* roi; LegoROI* roi;
roi = FindROI("nick"); roi = FindROI("nick");
@ -400,24 +400,24 @@ MxLong LegoAct2::HandleEndAction(MxEndActionNotificationParam& p_param)
roi->SetVisibility(FALSE); roi->SetVisibility(FALSE);
VariableTable()->SetVariable("ACTOR_01", "brickstr"); VariableTable()->SetVariable("ACTOR_01", "brickstr");
InitializeShooting(); FUN_10052800();
m_state = LegoAct2::e_chase; m_unk0x10c4 = 7;
PlayMusic(JukeboxScript::c_BrickstrChase); PlayMusic(JukeboxScript::c_BrickstrChase);
break; break;
} }
case LegoAct2::e_hidden: case 11:
m_bricks[m_nextBrick - 1].Mute(TRUE); m_bricks[m_nextBrick - 1].Mute(TRUE);
m_state = LegoAct2::e_distributeRemainingBricks; m_unk0x10c4 = 12;
m_timeSinceLastStage = 0; m_unk0x10d0 = 0;
StartAction(Act2mainScript::c_tra045la_RunAnim, TRUE, TRUE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_tra045la_RunAnim, TRUE, TRUE, NULL, NULL, NULL);
((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled); ((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled);
AnimationManager()->EnableCamAnims(TRUE); AnimationManager()->EnableCamAnims(TRUE);
AnimationManager()->FUN_1005f6d0(TRUE); AnimationManager()->FUN_1005f6d0(TRUE);
AnimationManager()->FUN_100604f0(g_unk0x100f4428, sizeOfArray(g_unk0x100f4428)); AnimationManager()->FUN_100604f0(g_unk0x100f4428, sizeOfArray(g_unk0x100f4428));
AnimationManager()->FUN_10060480(g_unk0x100f4458, sizeOfArray(g_unk0x100f4458)); AnimationManager()->FUN_10060480(g_unk0x100f4458, sizeOfArray(g_unk0x100f4458));
break; break;
case LegoAct2::e_distributeRemainingBricks: { case 12: {
LegoROI* roi; LegoROI* roi;
roi = FindROI("nick"); roi = FindROI("nick");
@ -441,13 +441,13 @@ MxLong LegoAct2::HandleEndAction(MxEndActionNotificationParam& p_param)
} }
m_bricks[m_nextBrick - 1].Mute(FALSE); m_bricks[m_nextBrick - 1].Mute(FALSE);
m_state = LegoAct2::e_brickHunt; m_unk0x10c4 = 13;
SpawnBricks(); SpawnBricks();
PlayMusic(JukeboxScript::c_BrickHunt); PlayMusic(JukeboxScript::c_BrickHunt);
((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_initial); ((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_initial);
break; break;
} }
case LegoAct2::e_allPiecesCollected: case 14:
for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_bricks); i++) { for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_bricks); i++) {
m_bricks[i].Remove(); m_bricks[i].Remove();
} }
@ -522,7 +522,7 @@ void LegoAct2::ReadyWorld()
// FUNCTION: BETA10 0x1003bb2d // FUNCTION: BETA10 0x1003bb2d
void LegoAct2::Enable(MxBool p_enable) void LegoAct2::Enable(MxBool p_enable)
{ {
if ((MxBool) m_disabledObjects.empty() == p_enable) { if ((MxBool) m_set0xd0.empty() == p_enable) {
return; return;
} }
@ -534,7 +534,7 @@ void LegoAct2::Enable(MxBool p_enable)
GameState()->SetActor(LegoActor::c_pepper); GameState()->SetActor(LegoActor::c_pepper);
m_pepper = FindROI("pepper"); m_pepper = FindROI("pepper");
((IslePathActor*) m_pepper->GetEntity())->VTable0xec(m_transformOnDisable, m_boundaryOnDisable, TRUE); ((IslePathActor*) m_pepper->GetEntity())->VTable0xec(m_unk0x10dc, m_unk0x1124, TRUE);
if (GameState()->m_previousArea == LegoGameState::e_infomain) { if (GameState()->m_previousArea == LegoGameState::e_infomain) {
GameState()->StopArea(LegoGameState::e_infomain); GameState()->StopArea(LegoGameState::e_infomain);
@ -542,27 +542,26 @@ void LegoAct2::Enable(MxBool p_enable)
Disable(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen); Disable(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
if (m_state != LegoAct2::e_atResidentialArea && m_state != LegoAct2::e_distributeRemainingBricks) { if (m_unk0x10c4 != 6 && m_unk0x10c4 != 12) {
PlayMusic(m_music); PlayMusic(m_music);
} }
if (m_state == LegoAct2::e_goingToHide && m_nextBrick == 6 && m_bricks[5].GetROI() != NULL) { if (m_unk0x10c4 == 10 && m_nextBrick == 6 && m_bricks[5].GetROI() != NULL) {
m_bricks[5].PlayWhistleSound(); m_bricks[5].PlayWhistleSound();
} }
else if (m_state == LegoAct2::e_brickHunt) { else if (m_unk0x10c4 == 13) {
InitBricks(); InitBricks();
} }
TickleManager()->RegisterClient(this, 20); TickleManager()->RegisterClient(this, 20);
SetAppCursor(e_cursorArrow); SetAppCursor(e_cursorArrow);
if (m_state == LegoAct2::e_holdingSpeech || m_state == LegoAct2::e_explaining || if (m_unk0x10c4 == 2 || m_unk0x10c4 == 4 || m_unk0x10c4 == 6 || m_unk0x10c4 == 11 || m_unk0x10c4 == 12 ||
m_state == LegoAct2::e_atResidentialArea || m_state == LegoAct2::e_hidden || m_unk0x10c4 == 14) {
m_state == LegoAct2::e_distributeRemainingBricks || m_state == LegoAct2::e_allPiecesCollected) {
MxDSAction action; MxDSAction action;
MxEndActionNotificationParam param(c_notificationEndAction, NULL, &action, FALSE); MxEndActionNotificationParam param(c_notificationEndAction, NULL, &action, FALSE);
m_currentAction = (Act2mainScript::Script) 0; m_unk0x1140 = (Act2mainScript::Script) 0;
action.SetObjectId(0); action.SetObjectId(0);
HandleEndAction(param); HandleEndAction(param);
} }
@ -570,21 +569,21 @@ void LegoAct2::Enable(MxBool p_enable)
GameState()->m_isDirty = TRUE; GameState()->m_isDirty = TRUE;
} }
else { else {
m_transformOnDisable = m_pepper->GetLocal2World(); m_unk0x10dc = m_pepper->GetLocal2World();
m_boundaryOnDisable = ((LegoPathActor*) m_pepper->GetEntity())->GetBoundary(); m_unk0x1124 = ((LegoPathActor*) m_pepper->GetEntity())->GetBoundary();
FUN_10051900(); FUN_10051900();
BackgroundAudioManager()->Stop(); BackgroundAudioManager()->Stop();
UninitBricks(); UninitBricks();
DeleteObjects(&m_atomId, Act2mainScript::c_VOhead0_PlayWav, Act2mainScript::c_VOhide_PlayWav); DeleteObjects(&m_atomId, Act2mainScript::c_VOhead0_PlayWav, Act2mainScript::c_VOhide_PlayWav);
if (m_infomanDirecting != (Act2mainScript::Script) 0) { if (m_unk0x1144 != (Act2mainScript::Script) 0) {
MxDSAction action; MxDSAction action;
action.SetAtomId(m_atomId); action.SetAtomId(m_atomId);
action.SetUnknown24(-2); action.SetUnknown24(-2);
action.SetObjectId(m_infomanDirecting); action.SetObjectId(m_unk0x1144);
DeleteObject(action); DeleteObject(action);
m_infomanDirecting = (Act2mainScript::Script) 0; m_unk0x1144 = (Act2mainScript::Script) 0;
} }
TickleManager()->UnregisterClient(this); TickleManager()->UnregisterClient(this);
@ -595,46 +594,46 @@ void LegoAct2::Enable(MxBool p_enable)
// FUNCTION: BETA10 0x1003bb72 // FUNCTION: BETA10 0x1003bb72
MxLong LegoAct2::HandlePathStruct(LegoPathStructNotificationParam& p_param) MxLong LegoAct2::HandlePathStruct(LegoPathStructNotificationParam& p_param)
{ {
if (m_state == LegoAct2::e_goingToResidentialArea && p_param.GetData() == 0x32) { if (m_unk0x10c4 == 5 && p_param.GetData() == 0x32) {
LegoPathActor* actor = (LegoPathActor*) m_pepper->GetEntity(); LegoPathActor* actor = (LegoPathActor*) m_pepper->GetEntity();
actor->SetActorState(LegoPathActor::c_disabled); actor->SetActorState(LegoPathActor::c_disabled);
actor->SetWorldSpeed(0.0f); actor->SetWorldSpeed(0.0f);
FUN_10051900(); FUN_10051900();
if (m_timeSinceLastStage < 90000) { if (m_unk0x10d0 < 90000) {
StartAction(Act2mainScript::c_tra031ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_tra031ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL);
} }
else { else {
StartAction(Act2mainScript::c_tra032ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_tra032ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL);
} }
m_unk0x112c = 50; m_unk0x112c = 50;
m_state = LegoAct2::e_atResidentialArea; m_unk0x10c4 = 6;
m_timeSinceLastStage = 0; m_unk0x10d0 = 0;
} }
else if (m_state == LegoAct2::e_goingToResidentialArea && p_param.GetData() == 0x2a) { else if (m_unk0x10c4 == 5 && p_param.GetData() == 0x2a) {
if (m_infomanDirecting == (Act2mainScript::Script) 0) { if (m_unk0x1144 == (Act2mainScript::Script) 0) {
StartAction(Act2mainScript::c_Avo907In_PlayWav, FALSE, FALSE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_Avo907In_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
m_infomanDirecting = Act2mainScript::c_Avo907In_PlayWav; m_unk0x1144 = Act2mainScript::c_Avo907In_PlayWav;
} }
} }
else if (m_state == LegoAct2::e_goingToResidentialArea) { else if (m_unk0x10c4 == 5) {
CheckBricksterIsLoose(p_param.GetData()); FUN_100521f0(p_param.GetData());
} }
else if (m_state == LegoAct2::e_chase) { else if (m_unk0x10c4 == 7) {
CheckBricksterDestroying(p_param.GetData()); FUN_10051fa0(p_param.GetData());
} }
else if (m_state == LegoAct2::e_goingToHide && p_param.GetData() == 0x165) { else if (m_unk0x10c4 == 10 && p_param.GetData() == 0x165) {
((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled); ((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled);
if (StartAction(Act2mainScript::c_VOhide_PlayWav, FALSE, TRUE, NULL, NULL, NULL) == SUCCESS) { if (FUN_10052560(Act2mainScript::c_VOhide_PlayWav, FALSE, TRUE, NULL, NULL, NULL) == SUCCESS) {
m_currentAction = Act2mainScript::c_VOhide_PlayWav; m_unk0x1140 = Act2mainScript::c_VOhide_PlayWav;
} }
m_unk0x1138->Hide(); m_unk0x1138->FUN_10019560();
m_state = LegoAct2::e_hidden; m_unk0x10c4 = 11;
m_timeSinceLastStage = 0; m_unk0x10d0 = 0;
if (m_nextBrick < 6) { if (m_nextBrick < 6) {
m_bricks[m_nextBrick].Create(m_nextBrick); m_bricks[m_nextBrick].Create(m_nextBrick);
@ -656,7 +655,7 @@ MxLong LegoAct2::HandlePathStruct(LegoPathStructNotificationParam& p_param)
// FUNCTION: LEGO1 0x100516b0 // FUNCTION: LEGO1 0x100516b0
// FUNCTION: BETA10 0x1003bcbc // FUNCTION: BETA10 0x1003bcbc
MxResult LegoAct2::CreateBrick() MxResult LegoAct2::FUN_100516b0()
{ {
if (m_nextBrick > 4) { if (m_nextBrick > 4) {
return FAILURE; return FAILURE;
@ -674,8 +673,8 @@ MxResult LegoAct2::CreateBrick()
brick.Place(local2world, local2world2, boundary); brick.Place(local2world, local2world2, boundary);
m_nextBrick++; m_nextBrick++;
m_state = LegoAct2::e_droppingBrick; m_unk0x10c4 = 9;
m_timeSinceLastStage = 0; m_unk0x10d0 = 0;
return SUCCESS; return SUCCESS;
} }
@ -722,7 +721,7 @@ void LegoAct2::FUN_10051900()
// FUNCTION: LEGO1 0x10051960 // FUNCTION: LEGO1 0x10051960
// FUNCTION: BETA10 0x1003bf2c // FUNCTION: BETA10 0x1003bf2c
void LegoAct2::HideMaPaInfo() void LegoAct2::FUN_10051960()
{ {
LegoROI* roi; LegoROI* roi;
@ -939,94 +938,94 @@ MxResult LegoAct2::BadEnding()
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
MxTrace("Bad End of Act2\n"); MxTrace("Bad End of Act2\n");
m_state = LegoAct2::e_allPiecesCollected; m_unk0x10c4 = 14;
EmitGameEvent(e_badEnding); EmitGameEvent(e_badEnding);
return SUCCESS; return SUCCESS;
} }
// FUNCTION: LEGO1 0x10051fa0 // FUNCTION: LEGO1 0x10051fa0
// FUNCTION: BETA10 0x10013fd3 // FUNCTION: BETA10 0x10013fd3
void LegoAct2::CheckBricksterDestroying(MxS32 p_pathData) void LegoAct2::FUN_10051fa0(MxS32 p_param1)
{ {
MxU8 randN = SDL_rand(3); MxU8 randN = SDL_rand(3);
randN++; randN++;
switch (p_pathData) { switch (p_param1) {
case 2: case 2:
if (randN == 1) { if (randN == 1) {
StartAction(Act2mainScript::c_snsx50bu_RunAnim, TRUE, FALSE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_snsx50bu_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
else { else {
StartAction(Act2mainScript::c_snsx51bu_RunAnim, TRUE, FALSE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_snsx51bu_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
break; break;
case 8: case 8:
if (randN == 1) { if (randN == 1) {
StartAction(Act2mainScript::c_snsx29nu_RunAnim, TRUE, FALSE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_snsx29nu_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
else { else {
StartAction(Act2mainScript::c_snsx30nu_RunAnim, TRUE, FALSE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_snsx30nu_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
break; break;
case 9: case 9:
if (randN == 1) { if (randN == 1) {
StartAction(Act2mainScript::c_snsx33na_RunAnim, TRUE, FALSE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_snsx33na_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
else { else {
StartAction(Act2mainScript::c_snsx34na_RunAnim, TRUE, FALSE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_snsx34na_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
break; break;
case 14: case 14:
if (randN == 1) { if (randN == 1) {
StartAction(Act2mainScript::c_snsx46cl_RunAnim, TRUE, FALSE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_snsx46cl_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
else { else {
StartAction(Act2mainScript::c_snsx48cl_RunAnim, TRUE, FALSE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_snsx48cl_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
break; break;
case 23: case 23:
if (randN == 1) { if (randN == 1) {
StartAction(Act2mainScript::c_snsx58va_RunAnim, TRUE, FALSE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_snsx58va_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
else { else {
StartAction(Act2mainScript::c_snsx60va_RunAnim, TRUE, FALSE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_snsx60va_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
break; break;
case 24: case 24:
case 25: case 25:
StartAction(Act2mainScript::c_snsx31sh_RunAnim, TRUE, FALSE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_snsx31sh_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
break; break;
case 26: case 26:
if (randN == 1) { if (randN == 1) {
StartAction(Act2mainScript::c_snsx52sn_RunAnim, TRUE, FALSE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_snsx52sn_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
else { else {
StartAction(Act2mainScript::c_snsx53sn_RunAnim, TRUE, FALSE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_snsx53sn_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
break; break;
case 34: case 34:
if (randN == 1) { if (randN == 1) {
StartAction(Act2mainScript::c_snsx15la_RunAnim, TRUE, FALSE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_snsx15la_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
else { else {
StartAction(Act2mainScript::c_snsx16la_RunAnim, TRUE, FALSE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_snsx16la_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
break; break;
case 36: case 36:
if (randN == 1) { if (randN == 1) {
StartAction(Act2mainScript::c_snsx10ni_RunAnim, TRUE, FALSE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_snsx10ni_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
else { else {
StartAction(Act2mainScript::c_snsx11ni_RunAnim, TRUE, FALSE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_snsx11ni_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
break; break;
case 38: case 38:
case 42: case 42:
if (randN == 1) { if (randN == 1) {
StartAction(Act2mainScript::c_snsx03ma_RunAnim, TRUE, FALSE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_snsx03ma_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
else { else {
StartAction(Act2mainScript::c_snsx04ma_RunAnim, TRUE, FALSE, NULL, NULL, NULL); FUN_10052560(Act2mainScript::c_snsx04ma_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
} }
break; break;
} }
@ -1034,44 +1033,44 @@ void LegoAct2::CheckBricksterDestroying(MxS32 p_pathData)
// FUNCTION: LEGO1 0x100521f0 // FUNCTION: LEGO1 0x100521f0
// FUNCTION: BETA10 0x100142f1 // FUNCTION: BETA10 0x100142f1
void LegoAct2::CheckBricksterIsLoose(MxS32 p_pathData) void LegoAct2::FUN_100521f0(MxS32 p_param1)
{ {
Act2mainScript::Script objectId = (Act2mainScript::Script) 0; Act2mainScript::Script objectId = (Act2mainScript::Script) 0;
Mx3DPointFloat actorPosition; Mx3DPointFloat vec;
switch (p_pathData) { switch (p_param1) {
case 0x02: { case 0x02: {
actorPosition = Mx3DPointFloat(-9.1f, 0.0f, -16.5f); vec = Mx3DPointFloat(-9.1f, 0.0f, -16.5f);
VariableTable()->SetVariable("ACTOR_01", "bd"); VariableTable()->SetVariable("ACTOR_01", "bd");
objectId = Act2mainScript::c_tns030bd_RunAnim; objectId = Act2mainScript::c_tns030bd_RunAnim;
break; break;
} }
case 0x2a: { case 0x2a: {
actorPosition = Mx3DPointFloat(-9.67f, 0.0f, -44.3f); vec = Mx3DPointFloat(-9.67f, 0.0f, -44.3f);
VariableTable()->SetVariable("ACTOR_01", "rd"); VariableTable()->SetVariable("ACTOR_01", "rd");
objectId = Act2mainScript::c_tns030rd_RunAnim; objectId = Act2mainScript::c_tns030rd_RunAnim;
break; break;
} }
case 0x133: { case 0x133: {
actorPosition = Mx3DPointFloat(25.75f, 0.0f, -13.0f); vec = Mx3DPointFloat(25.75f, 0.0f, -13.0f);
VariableTable()->SetVariable("ACTOR_01", "pg"); VariableTable()->SetVariable("ACTOR_01", "pg");
objectId = Act2mainScript::c_tns030pg_RunAnim; objectId = Act2mainScript::c_tns030pg_RunAnim;
break; break;
} }
case 0x134: { case 0x134: {
actorPosition = Mx3DPointFloat(43.63f, 0.0f, -46.33f); vec = Mx3DPointFloat(43.63f, 0.0f, -46.33f);
VariableTable()->SetVariable("ACTOR_01", "sy"); VariableTable()->SetVariable("ACTOR_01", "sy");
objectId = Act2mainScript::c_tns030sy_RunAnim; objectId = Act2mainScript::c_tns030sy_RunAnim;
break; break;
} }
case 0x135: { case 0x135: {
actorPosition = Mx3DPointFloat(50.0f, 0.0f, -34.6f); vec = Mx3DPointFloat(50.0f, 0.0f, -34.6f);
VariableTable()->SetVariable("ACTOR_01", "rd"); VariableTable()->SetVariable("ACTOR_01", "rd");
objectId = Act2mainScript::c_tns030rd_RunAnim; objectId = Act2mainScript::c_tns030rd_RunAnim;
break; break;
} }
case 0x138: { case 0x138: {
actorPosition = Mx3DPointFloat(-41.15f, 4.0f, 31.0f); vec = Mx3DPointFloat(-41.15f, 4.0f, 31.0f);
VariableTable()->SetVariable("ACTOR_01", "sy"); VariableTable()->SetVariable("ACTOR_01", "sy");
objectId = Act2mainScript::c_tns030sy_RunAnim; objectId = Act2mainScript::c_tns030sy_RunAnim;
break; break;
@ -1079,30 +1078,30 @@ void LegoAct2::CheckBricksterIsLoose(MxS32 p_pathData)
} }
if (objectId != (Act2mainScript::Script) 0) { if (objectId != (Act2mainScript::Script) 0) {
Mx3DPointFloat lookingAtPepper(actorPosition); Mx3DPointFloat local30(vec);
Mx3DPointFloat position(m_pepper->GetWorldPosition()); Mx3DPointFloat position(m_pepper->GetWorldPosition());
lookingAtPepper -= position; local30 -= position;
Mx3DPointFloat local44 = lookingAtPepper; Mx3DPointFloat local44 = local30;
lookingAtPepper.Unitize(); local30.Unitize();
StartAction(objectId, TRUE, TRUE, &actorPosition, &lookingAtPepper, NULL); FUN_10052560(objectId, TRUE, TRUE, &vec, &local30, NULL);
} }
} }
// FUNCTION: LEGO1 0x10052560 // FUNCTION: LEGO1 0x10052560
// FUNCTION: BETA10 0x100145c6 // FUNCTION: BETA10 0x100145c6
MxResult LegoAct2::StartAction( MxResult LegoAct2::FUN_10052560(
Act2mainScript::Script p_objectId, Act2mainScript::Script p_objectId,
MxBool p_isAnimation, MxBool p_param2,
MxBool p_ignoreCurrentAction, MxBool p_param3,
Mx3DPointFloat* p_location, Mx3DPointFloat* p_location,
Mx3DPointFloat* p_direction, Mx3DPointFloat* p_direction,
Mx3DPointFloat* p_param6 Mx3DPointFloat* p_param6
) )
{ {
if (m_currentAction == (Act2mainScript::Script) 0 || p_ignoreCurrentAction) { if (m_unk0x1140 == (Act2mainScript::Script) 0 || p_param3) {
assert(strlen(m_siFile)); assert(strlen(m_siFile));
if (!p_isAnimation) { if (!p_param2) {
MxDSAction action; MxDSAction action;
action.SetObjectId(p_objectId); action.SetObjectId(p_objectId);
@ -1190,7 +1189,7 @@ MxResult LegoAct2::StartAction(
} }
if (result == SUCCESS) { if (result == SUCCESS) {
m_currentAction = p_objectId; m_unk0x1140 = p_objectId;
} }
} }
} }
@ -1200,7 +1199,7 @@ MxResult LegoAct2::StartAction(
// FUNCTION: LEGO1 0x10052800 // FUNCTION: LEGO1 0x10052800
// FUNCTION: BETA10 0x10014aa8 // FUNCTION: BETA10 0x10014aa8
MxResult LegoAct2::InitializeShooting() MxResult LegoAct2::FUN_10052800()
{ {
LegoPathActor* actor = m_unk0x1138; LegoPathActor* actor = m_unk0x1138;
LegoLocomotionAnimPresenter* ap; LegoLocomotionAnimPresenter* ap;
@ -1224,6 +1223,6 @@ MxResult LegoAct2::InitializeShooting()
ap->FUN_1006d680(m_unk0x1138, -1.0f); ap->FUN_1006d680(m_unk0x1138, -1.0f);
actor->SetWorldSpeed(0.0f); actor->SetWorldSpeed(0.0f);
m_unk0x1138->InitializeNextShot(); m_unk0x1138->FUN_10018980();
return SUCCESS; return SUCCESS;
} }

View File

@ -49,17 +49,17 @@ RegistrationBook::RegistrationBook() : m_registerDialogueTimer(0x80000000), m_un
memset(m_alphabet, 0, sizeof(m_alphabet)); memset(m_alphabet, 0, sizeof(m_alphabet));
memset(m_intAlphabet, 0, sizeof(m_intAlphabet)); memset(m_intAlphabet, 0, sizeof(m_intAlphabet));
memset(m_name, 0, sizeof(m_name)); memset(m_name, 0, sizeof(m_name));
m_newName.m_cursorPos = 0; m_unk0x280.m_cursorPos = 0;
memset(m_checkmark, 0, sizeof(m_checkmark)); memset(m_checkmark, 0, sizeof(m_checkmark));
memset(&m_newName, -1, sizeof(m_newName) - 2); memset(&m_unk0x280, -1, sizeof(m_unk0x280) - 2);
m_vehiclesToPosition = 0; m_unk0x2b8 = 0;
m_infocenterState = NULL; m_infocenterState = NULL;
NotificationManager()->Register(this); NotificationManager()->Register(this);
m_awaitLoad = FALSE; m_unk0x2c1 = FALSE;
m_checkboxHilite = NULL; m_checkboxHilite = NULL;
m_checkboxSurface = NULL; m_checkboxSurface = NULL;
m_checkboxNormal = NULL; m_checkboxNormal = NULL;
@ -155,9 +155,9 @@ MxLong RegistrationBook::HandleEndAction(MxEndActionNotificationParam& p_param)
switch ((MxS32) p_param.GetAction()->GetObjectId()) { switch ((MxS32) p_param.GetAction()->GetObjectId()) {
case RegbookScript::c_Textures: case RegbookScript::c_Textures:
m_awaitLoad = FALSE; m_unk0x2c1 = FALSE;
if (m_vehiclesToPosition == 0) { if (m_unk0x2b8 == 0) {
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
} }
break; break;
@ -198,40 +198,40 @@ MxLong RegistrationBook::HandleKeyPress(SDL_Keycode p_key)
BackgroundAudioManager()->RaiseVolume(); BackgroundAudioManager()->RaiseVolume();
} }
} }
else if (key != SDLK_BACKSPACE && m_newName.m_cursorPos < 7) { else if (key != SDLK_BACKSPACE && m_unk0x280.m_cursorPos < 7) {
m_name[0][m_newName.m_cursorPos] = (*intoAlphabet)->Clone(); m_name[0][m_unk0x280.m_cursorPos] = (*intoAlphabet)->Clone();
if (m_name[0][m_newName.m_cursorPos] != NULL) { if (m_name[0][m_unk0x280.m_cursorPos] != NULL) {
(*intoAlphabet)->GetAction()->SetUnknown24((*intoAlphabet)->GetAction()->GetUnknown24() + 1); (*intoAlphabet)->GetAction()->SetUnknown24((*intoAlphabet)->GetAction()->GetUnknown24() + 1);
m_name[0][m_newName.m_cursorPos]->Enable(TRUE); m_name[0][m_unk0x280.m_cursorPos]->Enable(TRUE);
m_name[0][m_newName.m_cursorPos]->SetTickleState(MxPresenter::e_repeating); m_name[0][m_unk0x280.m_cursorPos]->SetTickleState(MxPresenter::e_repeating);
m_name[0][m_newName.m_cursorPos]->SetPosition(m_newName.m_cursorPos * 23 + 343, 121); m_name[0][m_unk0x280.m_cursorPos]->SetPosition(m_unk0x280.m_cursorPos * 23 + 343, 121);
if (m_newName.m_cursorPos == 0) { if (m_unk0x280.m_cursorPos == 0) {
m_checkmark[0]->Enable(TRUE); m_checkmark[0]->Enable(TRUE);
} }
m_newName.m_letters[m_newName.m_cursorPos] = m_unk0x280.m_letters[m_unk0x280.m_cursorPos] =
key >= SDLK_A && key <= SDLK_Z key >= SDLK_A && key <= SDLK_Z
? key - SDLK_A ? key - SDLK_A
: (intoAlphabet - m_intAlphabet) + sizeOfArray(m_alphabet) - m_intAlphabetOffset; : (intoAlphabet - m_intAlphabet) + sizeOfArray(m_alphabet) - m_intAlphabetOffset;
m_newName.m_cursorPos++; m_unk0x280.m_cursorPos++;
} }
} }
else { else {
if (key == SDLK_BACKSPACE && m_newName.m_cursorPos > 0) { if (key == SDLK_BACKSPACE && m_unk0x280.m_cursorPos > 0) {
m_newName.m_cursorPos--; m_unk0x280.m_cursorPos--;
m_name[0][m_newName.m_cursorPos]->Enable(FALSE); m_name[0][m_unk0x280.m_cursorPos]->Enable(FALSE);
delete m_name[0][m_newName.m_cursorPos]; delete m_name[0][m_unk0x280.m_cursorPos];
m_name[0][m_newName.m_cursorPos] = NULL; m_name[0][m_unk0x280.m_cursorPos] = NULL;
if (m_newName.m_cursorPos == 0) { if (m_unk0x280.m_cursorPos == 0) {
m_checkmark[0]->Enable(FALSE); m_checkmark[0]->Enable(FALSE);
} }
m_newName.m_letters[m_newName.m_cursorPos] = -1; m_unk0x280.m_letters[m_unk0x280.m_cursorPos] = -1;
} }
} }
@ -298,7 +298,7 @@ MxLong RegistrationBook::HandleControl(LegoControlManagerNotificationParam& p_pa
} }
} }
LoadSave(i); FUN_100775c0(i);
} }
} }
@ -307,57 +307,56 @@ MxLong RegistrationBook::HandleControl(LegoControlManagerNotificationParam& p_pa
// FUNCTION: LEGO1 0x100775c0 // FUNCTION: LEGO1 0x100775c0
// STUB: BETA10 0x100f32b2 // STUB: BETA10 0x100f32b2
void RegistrationBook::LoadSave(MxS16 p_checkMarkIndex) void RegistrationBook::FUN_100775c0(MxS16 p_playerIndex)
{ {
if (m_infocenterState->HasRegistered()) { if (m_infocenterState->HasRegistered()) {
GameState()->Save(0); GameState()->Save(0);
} }
// The first checkmark searches for the name and is -1 if not found, while all other checkmarks start at 1
// TODO: structure incorrect // TODO: structure incorrect
MxS16 player = p_checkMarkIndex == 0 ? GameState()->FindPlayer(*(LegoGameState::Username*) &m_newName.m_letters) MxS16 player = p_playerIndex == 0 ? GameState()->FindPlayer(*(LegoGameState::Username*) &m_unk0x280.m_letters)
: p_checkMarkIndex - 1; : p_playerIndex - 1;
switch (player) { switch (player) {
case 0: // Current save case 0:
if (!m_infocenterState->HasRegistered()) { if (!m_infocenterState->HasRegistered()) {
GameState()->SwitchPlayer(0); GameState()->SwitchPlayer(0);
WriteInfocenterLetters(1); WriteInfocenterLetters(1);
LoadVehicles(); FUN_100778c0();
} }
break; break;
case -1: // New save case -1:
GameState()->Init(); GameState()->Init();
PlayAction(RegbookScript::c_Textures); PlayAction(RegbookScript::c_Textures);
m_awaitLoad = TRUE; m_unk0x2c1 = TRUE;
// TOOD: structure incorrect // TOOD: structure incorrect
GameState()->AddPlayer(*(LegoGameState::Username*) &m_newName.m_letters); GameState()->AddPlayer(*(LegoGameState::Username*) &m_unk0x280.m_letters);
GameState()->Save(0); GameState()->Save(0);
WriteInfocenterLetters(0); WriteInfocenterLetters(0);
GameState()->SerializePlayersInfo(LegoFile::c_write); GameState()->SerializePlayersInfo(2);
LoadVehicles(); FUN_100778c0();
break; break;
default: default:
GameState()->Init(); GameState()->Init();
PlayAction(RegbookScript::c_Textures); PlayAction(RegbookScript::c_Textures);
m_awaitLoad = TRUE; m_unk0x2c1 = TRUE;
GameState()->SwitchPlayer(player); GameState()->SwitchPlayer(player);
WriteInfocenterLetters(player + 1); WriteInfocenterLetters(player + 1);
GameState()->SerializePlayersInfo(LegoFile::c_write); GameState()->SerializePlayersInfo(2);
LoadVehicles(); FUN_100778c0();
break; break;
} }
m_infocenterState->m_state = InfocenterState::e_selectedSave; m_infocenterState->m_state = InfocenterState::e_selectedSave;
if (m_vehiclesToPosition == 0 && !m_awaitLoad) { if (m_unk0x2b8 == 0 && !m_unk0x2c1) {
DeleteObjects(&m_atomId, RegbookScript::c_iic006in_RunAnim, RegbookScript::c_iic008in_PlayWav); DeleteObjects(&m_atomId, RegbookScript::c_iic006in_RunAnim, RegbookScript::c_iic008in_PlayWav);
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
} }
@ -374,7 +373,7 @@ void RegistrationBook::WriteInfocenterLetters(MxS16 p_user)
} }
// FUNCTION: LEGO1 0x100778c0 // FUNCTION: LEGO1 0x100778c0
void RegistrationBook::LoadVehicles() void RegistrationBook::FUN_100778c0()
{ {
if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { if (GameState()->GetCurrentAct() == LegoGameState::e_act1) {
Act1State* act1state = (Act1State*) GameState()->GetState("Act1State"); Act1State* act1state = (Act1State*) GameState()->GetState("Act1State");
@ -386,7 +385,7 @@ void RegistrationBook::LoadVehicles()
LegoPathStructNotificationParam(c_notificationPathStruct, NULL, 0, CopterScript::c_Helicopter_Actor) LegoPathStructNotificationParam(c_notificationPathStruct, NULL, 0, CopterScript::c_Helicopter_Actor)
); );
m_vehiclesToPosition++; m_unk0x2b8++;
} }
if (act1state->m_jetskiPlane.IsPresent()) { if (act1state->m_jetskiPlane.IsPresent()) {
@ -396,7 +395,7 @@ void RegistrationBook::LoadVehicles()
LegoPathStructNotificationParam(c_notificationPathStruct, NULL, 0, JetskiScript::c_Jetski_Actor) LegoPathStructNotificationParam(c_notificationPathStruct, NULL, 0, JetskiScript::c_Jetski_Actor)
); );
m_vehiclesToPosition++; m_unk0x2b8++;
} }
if (act1state->m_dunebuggyPlane.IsPresent()) { if (act1state->m_dunebuggyPlane.IsPresent()) {
@ -406,7 +405,7 @@ void RegistrationBook::LoadVehicles()
LegoPathStructNotificationParam(c_notificationPathStruct, NULL, 0, DunecarScript::c_DuneBugy_Actor) LegoPathStructNotificationParam(c_notificationPathStruct, NULL, 0, DunecarScript::c_DuneBugy_Actor)
); );
m_vehiclesToPosition++; m_unk0x2b8++;
} }
if (act1state->m_racecarPlane.IsPresent()) { if (act1state->m_racecarPlane.IsPresent()) {
@ -416,10 +415,10 @@ void RegistrationBook::LoadVehicles()
LegoPathStructNotificationParam(c_notificationPathStruct, NULL, 0, RacecarScript::c_RaceCar_Actor) LegoPathStructNotificationParam(c_notificationPathStruct, NULL, 0, RacecarScript::c_RaceCar_Actor)
); );
m_vehiclesToPosition++; m_unk0x2b8++;
} }
if (m_vehiclesToPosition != 0) { if (m_unk0x2b8 != 0) {
DeleteObjects(&m_atomId, RegbookScript::c_iic006in_RunAnim, RegbookScript::c_iic008in_PlayWav); DeleteObjects(&m_atomId, RegbookScript::c_iic006in_RunAnim, RegbookScript::c_iic008in_PlayWav);
InputManager()->DisableInputProcessing(); InputManager()->DisableInputProcessing();
SetAppCursor(e_cursorBusy); SetAppCursor(e_cursorBusy);
@ -657,10 +656,10 @@ MxLong RegistrationBook::HandlePathStruct(LegoPathStructNotificationParam& p_par
else { else {
RemoveActor(actor); RemoveActor(actor);
Remove(actor); Remove(actor);
m_vehiclesToPosition--; m_unk0x2b8--;
} }
if (m_vehiclesToPosition == 0 && !m_awaitLoad) { if (m_unk0x2b8 == 0 && !m_unk0x2c1) {
DeleteObjects(&m_atomId, RegbookScript::c_iic006in_RunAnim, RegbookScript::c_iic008in_PlayWav); DeleteObjects(&m_atomId, RegbookScript::c_iic006in_RunAnim, RegbookScript::c_iic008in_PlayWav);
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
} }

View File

@ -9,6 +9,12 @@
// LIBRARY: LEGO1 0x10086260 // LIBRARY: LEGO1 0x10086260
// ??3@YAXPAX@Z // ??3@YAXPAX@Z
// LIBRARY: LEGO1 0x1008a090
// _malloc
// LIBRARY: LEGO1 0x1008a100
// _calloc
// LIBRARY: LEGO1 0x1008a1c0 // LIBRARY: LEGO1 0x1008a1c0
// _free // _free
@ -931,31 +937,8 @@
// GLOBAL: LEGO1 0x100db6e0 // GLOBAL: LEGO1 0x100db6e0
// GUID_SysKeyboard // GUID_SysKeyboard
// GLOBAL: LEGO1 0x100dd1c0 // Cannot be handled right now due to anonymous pointer in struct
// IID_IDirect3DRM2
// LIBRARY: LEGO1 0x1008c960
// ?_query_new_handler@@YAP6AHI@ZXZ
// LIBRARY: LEGO1 0x1008c970
// ?_query_new_mode@@YAHXZ
// GLOBAL: LEGO1 0x100fd8ec
// __newmode
// Cannot be handled right now due to anonymous pointer in struct.
// We can annotate it on the original side, but we have no symbol on the recomp side.
// We would need a way of annotating "the pointer at c_dfDIKeyboard+0x14 has orig address 0x10097f80".
// // GLOBAL: LEGO1 0x10098f80 // // GLOBAL: LEGO1 0x10098f80
// c_dfDIKeyboard // c_dfDIKeyboard
/// Globals from libraries without symbols
// STRING: LEGO1 0x100dabb0
static const char* ___crtLCMapStringA_str = "\0";
// STRING: LEGO1 0x100dabb4
static const wchar_t *___crtLCMapStringA_wstr = L"\0";
#endif #endif

View File

@ -4,6 +4,19 @@
#include <windows.h> #include <windows.h>
#endif #endif
// #ifdef __WIIU__
// #include "mainUclass.h"
// #endif
// commented out for now
// #ifdef __WIIU__
// extern "C" void rpl_entry(void)
// {
// Lego1App app;
// app.Run();
// }
// #endif
// FUNCTION: LEGO1 0x10091ee0 // FUNCTION: LEGO1 0x10091ee0
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{ {

25
LEGO1/mainUclass.h Normal file
View File

@ -0,0 +1,25 @@
#pragma once
#include <SDL3/SDL.h>
class Lego1App {
public:
Lego1App() {}
~Lego1App() {}
void Run()
{
SDL_Log("Lego1App::Run called");
bool running = true;
SDL_Event e;
while (running) {
while (SDL_PollEvent(&e)) {
if (e.type == SDL_QUIT) {
running = false;
}
}
}
}
};

View File

@ -17,13 +17,6 @@ class LegoDeviceEnumerate : public MxDeviceEnumerate {
int GetBestDevice(); int GetBestDevice();
int FUN_1009d210(); int FUN_1009d210();
unsigned char FUN_1009d3d0(Direct3DDeviceInfo& p_device); unsigned char FUN_1009d3d0(Direct3DDeviceInfo& p_device);
// SYNTHETIC: BETA10 0x100d8d10
// LegoDeviceEnumerate::LegoDeviceEnumerate
// SYNTHETIC: LEGO1 0x1007b590
// SYNTHETIC: BETA10 0x100d8da0
// LegoDeviceEnumerate::~LegoDeviceEnumerate
}; };
#endif // LEGODXINFO_H #endif // LEGODXINFO_H

View File

@ -3,6 +3,7 @@
#endif #endif
#include "mxdirect3d.h" #include "mxdirect3d.h"
#include "mxvideoparam.h"
#include <SDL3/SDL.h> // for SDL_Log #include <SDL3/SDL.h> // for SDL_Log
#include <assert.h> #include <assert.h>
@ -71,11 +72,16 @@ BOOL MxDirect3D::Create(
} }
if (m_pDirect3d->QueryInterface(IID_IDirect3DMiniwin, (void**) &miniwind3d) == DD_OK) { if (m_pDirect3d->QueryInterface(IID_IDirect3DMiniwin, (void**) &miniwind3d) == DD_OK) {
#if SDL_MAJOR_VERSION >= 3
MxVideoParam* videoParam = (MxVideoParam*) SDL_GetPointerProperty( MxVideoParam* videoParam = (MxVideoParam*) SDL_GetPointerProperty(
SDL_GetWindowProperties(reinterpret_cast<SDL_Window*>(hWnd)), SDL_GetWindowProperties(reinterpret_cast<SDL_Window*>(hWnd)),
ISLE_PROP_WINDOW_CREATE_VIDEO_PARAM, ISLE_PROP_WINDOW_CREATE_VIDEO_PARAM,
nullptr nullptr
); );
#else
MxVideoParam* videoParam =
(MxVideoParam*) SDL_GetWindowData(reinterpret_cast<SDL_Window*>(hWnd), ISLE_PROP_WINDOW_CREATE_VIDEO_PARAM);
#endif
#ifndef MXDIRECTX_FOR_CONFIG #ifndef MXDIRECTX_FOR_CONFIG
assert(videoParam); assert(videoParam);
#endif #endif

View File

@ -228,11 +228,16 @@ BOOL MxDeviceEnumerate::EnumDirectDrawCallback(LPGUID p_guid, LPSTR p_driverDesc
result = lpDD->QueryInterface(IID_IDirect3DMiniwin, (void**) &miniwind3d); result = lpDD->QueryInterface(IID_IDirect3DMiniwin, (void**) &miniwind3d);
if (result == DD_OK) { if (result == DD_OK) {
#if SDL_MAJOR_VERSION >= 3
MxVideoParam* videoParam = (MxVideoParam*) SDL_GetPointerProperty( MxVideoParam* videoParam = (MxVideoParam*) SDL_GetPointerProperty(
SDL_GetWindowProperties(reinterpret_cast<SDL_Window*>(m_hWnd)), SDL_GetWindowProperties(reinterpret_cast<SDL_Window*>(m_hWnd)),
ISLE_PROP_WINDOW_CREATE_VIDEO_PARAM, ISLE_PROP_WINDOW_CREATE_VIDEO_PARAM,
nullptr nullptr
); );
#else
MxVideoParam* videoParam = (MxVideoParam*)
SDL_GetWindowData(reinterpret_cast<SDL_Window*>(m_hWnd), ISLE_PROP_WINDOW_CREATE_VIDEO_PARAM);
#endif
#ifndef MXDIRECTX_FOR_CONFIG #ifndef MXDIRECTX_FOR_CONFIG
assert(videoParam); assert(videoParam);
#endif #endif

View File

@ -22,11 +22,11 @@ class Mx3DPointFloat : public Vector3 {
} }
// FUNCTION: LEGO1 0x100343a0 // FUNCTION: LEGO1 0x100343a0
// FUNCTION: BETA10 0x100151e0 // FUNCTION: BETA10 0x10011600
Mx3DPointFloat(const Mx3DPointFloat& p_other) : Vector3(m_elements) { EqualsImpl(p_other.m_data); } Mx3DPointFloat(const Mx3DPointFloat& p_other) : Vector3(m_elements) { EqualsImpl(p_other.m_data); }
// FUNCTION: LEGO1 0x10048ed0 // FUNCTION: LEGO1 0x10048ed0
// FUNCTION: BETA10 0x10011600 // FUNCTION: BETA10 0x100151e0
Mx3DPointFloat(const Vector3& p_other) : Vector3(m_elements) { EqualsImpl(p_other.m_data); } Mx3DPointFloat(const Vector3& p_other) : Vector3(m_elements) { EqualsImpl(p_other.m_data); }
// FUNCTION: LEGO1 0x10003c10 // FUNCTION: LEGO1 0x10003c10

View File

@ -14,10 +14,10 @@ class MxMatrix : public Matrix4 {
// FUNCTION: LEGO1 0x10032770 // FUNCTION: LEGO1 0x10032770
// FUNCTION: BETA10 0x1001ff30 // FUNCTION: BETA10 0x1001ff30
MxMatrix(const MxMatrix& p_matrix) : Matrix4(m_elements) { CopyFrom(p_matrix); } MxMatrix(const MxMatrix& p_matrix) : Matrix4(m_elements) { Equals(p_matrix); }
// FUNCTION: BETA10 0x1000fc20 // FUNCTION: BETA10 0x1000fc20
MxMatrix(const Matrix4& p_matrix) : Matrix4(m_elements) { CopyFrom(p_matrix); } MxMatrix(const Matrix4& p_matrix) : Matrix4(m_elements) { Equals(p_matrix); }
// FUNCTION: BETA10 0x10010860 // FUNCTION: BETA10 0x10010860
float* operator[](int idx) { return m_data[idx]; } float* operator[](int idx) { return m_data[idx]; }
@ -25,10 +25,10 @@ class MxMatrix : public Matrix4 {
const float* operator[](int idx) const { return m_data[idx]; } const float* operator[](int idx) const { return m_data[idx]; }
// FUNCTION: LEGO1 0x10002850 // FUNCTION: LEGO1 0x10002850
void operator=(const Matrix4& p_matrix) override { CopyFrom(p_matrix); } // vtable+0x28 void operator=(const Matrix4& p_matrix) override { Equals(p_matrix); } // vtable+0x28
// FUNCTION: LEGO1 0x10002860 // FUNCTION: LEGO1 0x10002860
virtual void operator=(const MxMatrix& p_matrix) { CopyFrom(p_matrix); } // vtable+0x48 virtual void operator=(const MxMatrix& p_matrix) { Equals(p_matrix); } // vtable+0x48
private: private:
float m_elements[4][4]; // 0x08 float m_elements[4][4]; // 0x08

View File

@ -47,7 +47,7 @@ class MxVideoManager : public MxPresentationManager {
MxVideoParam& GetVideoParam() { return this->m_videoParam; } MxVideoParam& GetVideoParam() { return this->m_videoParam; }
LPDIRECTDRAW GetDirectDraw() { return this->m_pDirectDraw; } LPDIRECTDRAW GetDirectDraw() { return this->m_pDirectDraw; }
// FUNCTION: BETA10 0x100969e0 // FUNCTION: BETA10 0x1002e290
MxDisplaySurface* GetDisplaySurface() { return this->m_displaySurface; } MxDisplaySurface* GetDisplaySurface() { return this->m_displaySurface; }
MxRegion* GetRegion() { return this->m_region; } MxRegion* GetRegion() { return this->m_region; }

View File

@ -7,6 +7,7 @@
#include <assert.h> #include <assert.h>
#include <float.h> #include <float.h>
#include <limits.h> #include <limits.h>
#include <random>
DECOMP_SIZE_ASSERT(MxDSAction, 0x94) DECOMP_SIZE_ASSERT(MxDSAction, 0x94)

View File

@ -6,6 +6,7 @@
#include "mxvariabletable.h" #include "mxvariabletable.h"
#include <SDL3/SDL_stdinc.h> #include <SDL3/SDL_stdinc.h>
#include <random>
DECOMP_SIZE_ASSERT(MxDSSelectAction, 0xb0) DECOMP_SIZE_ASSERT(MxDSSelectAction, 0xb0)
DECOMP_SIZE_ASSERT(MxStringList, 0x18) DECOMP_SIZE_ASSERT(MxStringList, 0x18)
@ -113,8 +114,14 @@ void MxDSSelectAction::Deserialize(MxU8*& p_source, MxS16 p_flags)
char buffer[10]; char buffer[10];
MxS16 value = atoi(&m_unk0x9c.GetData()[strlen("RANDOM_")]); MxS16 value = atoi(&m_unk0x9c.GetData()[strlen("RANDOM_")]);
#ifdef __WIIU__
static std::mt19937 rng{std::random_device{}()};
std::uniform_int_distribution<MxS32> dist(0, value);
MxS32 random = dist(rng);
#else
srand(Timer()->GetTime()); srand(Timer()->GetTime());
MxS32 random = SDL_rand(value); MxS32 random = SDL_rand(value);
#endif
string = SDL_itoa((MxS16) random, buffer, 10); string = SDL_itoa((MxS16) random, buffer, 10);
} }

View File

@ -13,7 +13,7 @@
DECOMP_SIZE_ASSERT(MxSoundManager, 0x3c); DECOMP_SIZE_ASSERT(MxSoundManager, 0x3c);
// GLOBAL: LEGO1 0x10101420 // GLOBAL LEGO1 0x10101420
MxS32 g_volumeAttenuation[100] = {-6643, -5643, -5058, -4643, -4321, -4058, -3836, -3643, -3473, -3321, -3184, -3058, MxS32 g_volumeAttenuation[100] = {-6643, -5643, -5058, -4643, -4321, -4058, -3836, -3643, -3473, -3321, -3184, -3058,
-2943, -2836, -2736, -2643, -2556, -2473, -2395, -2321, -2251, -2184, -2120, -2058, -2943, -2836, -2736, -2643, -2556, -2473, -2395, -2321, -2251, -2184, -2120, -2058,
-2000, -1943, -1888, -1836, -1785, -1736, -1689, -1643, -1599, -1556, -1514, -1473, -2000, -1943, -1888, -1836, -1785, -1736, -1689, -1643, -1599, -1556, -1514, -1473,

View File

@ -4,7 +4,11 @@
#include "mxmain.h" #include "mxmain.h"
#include <SDL3/SDL_log.h> #include <SDL3/SDL_log.h>
#ifdef __WIIU__
#include <SDL3/SDL.h>
#else
#include <SDL3/SDL_platform_defines.h> #include <SDL3/SDL_platform_defines.h>
#endif
#include <SDL3/SDL_stdinc.h> #include <SDL3/SDL_stdinc.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@ -34,6 +34,7 @@ MxResult MxThread::Start(MxS32 p_stackSize, MxS32 p_flag)
} }
{ {
#if SDL_MAJOR_VERSION >= 3
const SDL_PropertiesID props = SDL_CreateProperties(); const SDL_PropertiesID props = SDL_CreateProperties();
SDL_SetPointerProperty(props, SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER, (void*) MxThread::ThreadProc); SDL_SetPointerProperty(props, SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER, (void*) MxThread::ThreadProc);
SDL_SetPointerProperty(props, SDL_PROP_THREAD_CREATE_USERDATA_POINTER, this); SDL_SetPointerProperty(props, SDL_PROP_THREAD_CREATE_USERDATA_POINTER, this);
@ -44,6 +45,11 @@ MxResult MxThread::Start(MxS32 p_stackSize, MxS32 p_flag)
} }
SDL_DestroyProperties(props); SDL_DestroyProperties(props);
#else
if (!((m_thread = SDL_CreateThread(&MxThread::ThreadProc, "MxThread", this)))) {
goto done;
}
#endif
} }
result = SUCCESS; result = SUCCESS;

View File

@ -24,8 +24,8 @@ class Matrix4 {
virtual ~Matrix4() {} virtual ~Matrix4() {}
inline virtual void CopyFrom(float (*p_data)[4]); // vtable+0x04 inline virtual void Equals(float (*p_data)[4]); // vtable+0x04
inline virtual void CopyFrom(const Matrix4& p_matrix); // vtable+0x00 inline virtual void Equals(const Matrix4& p_matrix); // vtable+0x00
inline virtual void SetData(float (*p_data)[4]); // vtable+0x0c inline virtual void SetData(float (*p_data)[4]); // vtable+0x0c
inline virtual void SetData(UnknownMatrixType& p_matrix); // vtable+0x08 inline virtual void SetData(UnknownMatrixType& p_matrix); // vtable+0x08
inline virtual float (*GetData())[4]; // vtable+0x14 inline virtual float (*GetData())[4]; // vtable+0x14

View File

@ -8,14 +8,14 @@
// FUNCTION: LEGO1 0x10002320 // FUNCTION: LEGO1 0x10002320
// FUNCTION: BETA10 0x1000fcb0 // FUNCTION: BETA10 0x1000fcb0
void Matrix4::CopyFrom(float (*p_data)[4]) void Matrix4::Equals(float (*p_data)[4])
{ {
memcpy(m_data, p_data, sizeof(float) * 4 * 4); memcpy(m_data, p_data, sizeof(float) * 4 * 4);
} }
// FUNCTION: LEGO1 0x10002340 // FUNCTION: LEGO1 0x10002340
// FUNCTION: BETA10 0x1000fcf0 // FUNCTION: BETA10 0x1000fcf0
void Matrix4::CopyFrom(const Matrix4& p_matrix) void Matrix4::Equals(const Matrix4& p_matrix)
{ {
memcpy(m_data, p_matrix.m_data, sizeof(float) * 4 * 4); memcpy(m_data, p_matrix.m_data, sizeof(float) * 4 * 4);
} }
@ -84,7 +84,7 @@ void Matrix4::SetIdentity()
// FUNCTION: BETA10 0x1000ff20 // FUNCTION: BETA10 0x1000ff20
void Matrix4::operator=(const Matrix4& p_matrix) void Matrix4::operator=(const Matrix4& p_matrix)
{ {
CopyFrom(p_matrix); Equals(p_matrix);
} }
// FUNCTION: LEGO1 0x10002430 // FUNCTION: LEGO1 0x10002430

View File

@ -56,7 +56,7 @@ class BoundingSphere {
// BoundingSphere::operator= // BoundingSphere::operator=
// SYNTHETIC: BETA10 0x1001fc50 // SYNTHETIC: BETA10 0x1001fc50
// ??0BoundingSphere@@QAE@XZ // BoundingSphere::BoundingSphere
private: private:
Mx3DPointFloat center; // 0x00 Mx3DPointFloat center; // 0x00

View File

@ -88,7 +88,8 @@ inline Result RendererCreateDevice(
if (Succeeded(result)) { if (Succeeded(result)) {
if (rCreateData.m_pBackBuffer) { if (rCreateData.m_pBackBuffer) {
// annotated below // LEGO1 0x10101040
// GLOBAL: BETA10 0x102055f4
static int g_setBufferCount = 1; static int g_setBufferCount = 1;
if (g_setBufferCount) { if (g_setBufferCount) {
Result result2 = ResultVal(rpDevice->SetBufferCount(2)); Result result2 = ResultVal(rpDevice->SetBufferCount(2));
@ -100,10 +101,6 @@ inline Result RendererCreateDevice(
return result; return result;
} }
// GLOBAL: LEGO1 0x10101040
// GLOBAL: BETA10 0x102055f4
// ?g_setBufferCount@?3??RendererCreateDevice@@YA?AW4Result@Tgl@@PAUIDirect3DRM2@@ABUDeviceDirectDrawCreateData@3@AAPAUIDirect3DRMDevice2@@@Z@4HA
// FUNCTION: BETA10 0x1016cf40 // FUNCTION: BETA10 0x1016cf40
inline Result RendererImpl::CreateDevice(const DeviceDirectDrawCreateData& rCreateData, DeviceImpl& rDevice) inline Result RendererImpl::CreateDevice(const DeviceDirectDrawCreateData& rCreateData, DeviceImpl& rDevice)
{ {

View File

@ -270,7 +270,6 @@ inline void ViewManager::ManageVisibilityAndDetailRecursively(ViewROI* p_from, i
p_from->SetLodLevel(ViewROI::c_lodLevelUnset); p_from->SetLodLevel(ViewROI::c_lodLevelUnset);
for (CompoundObject::const_iterator it = comp->begin(); it != comp->end(); it++) { for (CompoundObject::const_iterator it = comp->begin(); it != comp->end(); it++) {
// LINE: BETA10 0x10172bbd
ManageVisibilityAndDetailRecursively((ViewROI*) *it, p_lodLevel); ManageVisibilityAndDetailRecursively((ViewROI*) *it, p_lodLevel);
} }
} }

0
android-project/gradlew vendored Executable file → Normal file
View File

0
android-project/gradlew.bat vendored Normal file → Executable file
View File

View File

@ -6,6 +6,7 @@
#include <SDL3/SDL.h> #include <SDL3/SDL.h>
#include <interleaf.h> #include <interleaf.h>
#include <algorithm>
using namespace Extensions; using namespace Extensions;

View File

@ -1,5 +1,7 @@
#include "extensions/textureloader.h" #include "extensions/textureloader.h"
#include <algorithm>
using namespace Extensions; using namespace Extensions;
std::map<std::string, std::string> TextureLoader::options; std::map<std::string, std::string> TextureLoader::options;

View File

@ -28,9 +28,11 @@ target_compile_definitions(miniwin PRIVATE
) )
list(APPEND GRAPHICS_BACKENDS USE_SOFTWARE_RENDER) list(APPEND GRAPHICS_BACKENDS USE_SOFTWARE_RENDER)
list(APPEND GRAPHICS_BACKENDS USE_SDL_GPU) if(NOT USE_SDL2)
list(APPEND GRAPHICS_BACKENDS USE_SDL_GPU)
endif()
if(NOT WINDOWS_STORE) if(NOT WINDOWS_STORE AND NOT WIIU)
find_package(OpenGL) find_package(OpenGL)
if(OpenGL_FOUND) if(OpenGL_FOUND)
message(STATUS "Found OpenGL: enabling OpenGL 1.x renderer") message(STATUS "Found OpenGL: enabling OpenGL 1.x renderer")
@ -88,6 +90,13 @@ if(NINTENDO_3DS)
endif() endif()
endif() endif()
if(NOT WIIU)
message(STATUS "Enabling GX2 renderer")
target_sources(miniwin PRIVATE src/d3drm/backends/gx2/renderer.cpp)
target_link_libraries(miniwin PRIVATE wut)
list(APPEND GRAPHICS_BACKENDS USE_GX2)
endif()
if(WIN32 AND NOT WINDOWS_STORE) if(WIN32 AND NOT WINDOWS_STORE)
target_sources(miniwin PRIVATE target_sources(miniwin PRIVATE
src/d3drm/backends/directx9/actual.cpp src/d3drm/backends/directx9/actual.cpp
@ -116,11 +125,16 @@ endif()
target_compile_definitions(miniwin PUBLIC MINIWIN) target_compile_definitions(miniwin PUBLIC MINIWIN)
target_include_directories(miniwin PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/internal
)
if(USE_SDL_GPU IN_LIST GRAPHICS_BACKENDS)
target_include_directories(miniwin target_include_directories(miniwin
PRIVATE PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/internal
${CMAKE_CURRENT_SOURCE_DIR}/src/d3drm/backends/sdl3gpu/shaders/generated ${CMAKE_CURRENT_SOURCE_DIR}/src/d3drm/backends/sdl3gpu/shaders/generated
) )
endif()
target_link_libraries(miniwin PUBLIC miniwin-headers) target_link_libraries(miniwin PUBLIC miniwin-headers)
target_link_libraries(miniwin PRIVATE SDL3::SDL3) target_link_libraries(miniwin PRIVATE SDL3::SDL3)
@ -129,7 +143,7 @@ target_compile_definitions(miniwin PUBLIC ${GRAPHICS_BACKENDS})
# Shader stuff # Shader stuff
if(USE_SDL_GPU IN_LIST GRAPHICS_BACKENDS)
set(shader_src_dir "${CMAKE_CURRENT_SOURCE_DIR}/src/d3drm/backends/sdl3gpu/shaders/src") set(shader_src_dir "${CMAKE_CURRENT_SOURCE_DIR}/src/d3drm/backends/sdl3gpu/shaders/src")
set(shader_gen_dir "${CMAKE_CURRENT_SOURCE_DIR}/src/d3drm/backends/sdl3gpu/shaders/generated") set(shader_gen_dir "${CMAKE_CURRENT_SOURCE_DIR}/src/d3drm/backends/sdl3gpu/shaders/generated")
set(py_gencshadersource "${CMAKE_CURRENT_SOURCE_DIR}/src/d3drm/backends/sdl3gpu/shaders/gencshadersource.py") set(py_gencshadersource "${CMAKE_CURRENT_SOURCE_DIR}/src/d3drm/backends/sdl3gpu/shaders/gencshadersource.py")
@ -213,7 +227,7 @@ endforeach()
set(index_cpp "${shader_gen_dir}/ShaderIndex.cpp") set(index_cpp "${shader_gen_dir}/ShaderIndex.cpp")
set(index_h "${shader_gen_dir}/ShaderIndex.h") set(index_h "${shader_gen_dir}/ShaderIndex.h")
endif()
if(ISLE_COMPILE_SHADERS) if(ISLE_COMPILE_SHADERS)
add_custom_command(OUTPUT "${index_h}" "${index_cpp}" add_custom_command(OUTPUT "${index_h}" "${index_cpp}"
COMMAND Python3::Interpreter "${py_gencshadersource}" "index" COMMAND Python3::Interpreter "${py_gencshadersource}" "index"

View File

@ -0,0 +1,8 @@
#pragma once
#include <gx2/mem.h>
#include <gx2r/buffer.h>
inline uint32_t GX2RGetGpuAddr(const GX2RBuffer* buffer)
{
return (uint32_t) buffer->buffer;
}

View File

@ -0,0 +1,82 @@
#include <coreinit/systeminfo.h>
#include <coreinit/thread.h>
#include <coreinit/time.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <gfd.h>
#include <gx2/draw.h>
#include <gx2/mem.h>
#include <whb/gfx.h>
#include <whb/log_udp.h>
#include <whb/proc.h>
#include <whb/sdcard.h>
struct IsleGX2Backend {
GX2RBuffer positionBuffer;
GX2RBuffer colourBuffer;
WHBGfxShaderGroup shaderGroup;
bool rendering = false;
void Init(const char* shaderPath) {
WHBLogUdpInit();
WHBProcInit();
WHBGfxInit();
WHBMountSdCard();
char path[256];
sprintf(path, "%s/%s", WHBGetSdCardMountPath(), shaderPath);
FILE* f = fopen(path, "rb");
if (!f) return;
fseek(f, 0, SEEK_END);
size_t fsize = ftell(f);
rewind(f);
char* data = (char*) malloc(fsize);
fread(data, 1, fsize, f);
WHBGfxLoadGFDShaderGroup(&shaderGroup, 0, data);
free(data);
WHBGfxInitShaderAttribute(&shaderGroup, "aPosition", 0, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32_32_32);
WHBGfxInitShaderAttribute(&shaderGroup, "aColour", 1, 0, GX2_ATTRIB_FORMAT_FLOAT_32_32_32_32);
WHBGfxInitFetchShader(&shaderGroup);
}
void StartFrame() {
if (rendering) return;
WHBGfxBeginRender();
WHBGfxBeginRenderTV();
rendering = true;
}
void EndFrame() {
if (!rendering) return;
WHBGfxFinishRenderTV();
WHBGfxBeginRenderDRC();
WHBGfxFinishRenderDRC();
WHBGfxFinishRender();
rendering = false;
}
void Clear(float r, float g, float b) {
StartFrame();
WHBGfxClearColor(r, g, b, 1.0f);
}
void Flip() {
EndFrame();
}
void Shutdown() {
WHBUnmountSdCard();
WHBGfxShutdown();
WHBProcShutdown();
WHBLogUdpDeinit();
}
};
static IsleGX2Backend g_backend;
extern "C" void IsleBackendInit(const char* shaderPath) { g_backend.Init(shaderPath); }
extern "C" void IsleBackendStartFrame() { g_backend.StartFrame(); }
extern "C" void IsleBackendEndFrame() { g_backend.EndFrame(); }
extern "C" void IsleBackendClear(float r, float g, float b) { g_backend.Clear(r, g, b); }
extern "C" void IsleBackendFlip() { g_backend.Flip(); }
extern "C" void IsleBackendShutdown() { g_backend.Shutdown(); }

View File

@ -0,0 +1,6 @@
#version 450
layout(location = 0) in vec4 vColour;
layout(location = 0) out vec4 outColour;
void main() {
outColour = vColour;
}

View File

@ -0,0 +1,8 @@
#version 450
layout(location = 0) in vec4 aPosition;
layout(location = 1) in vec4 aColour;
layout(location = 0) out vec4 vColour;
void main() {
gl_Position = aPosition;
vColour = aColour;
}

View File

@ -11,6 +11,9 @@
#ifdef USE_CITRO3D #ifdef USE_CITRO3D
#include "d3drmrenderer_citro3d.h" #include "d3drmrenderer_citro3d.h"
#endif #endif
#ifdef USE_GX2
#include "d3drmrenderer_gx2.h"
#endif
#ifdef USE_DIRECTX9 #ifdef USE_DIRECTX9
#include "d3drmrenderer_directx9.h" #include "d3drmrenderer_directx9.h"
#endif #endif
@ -62,6 +65,11 @@ Direct3DRMRenderer* CreateDirect3DRMRenderer(
return new Citro3DRenderer(DDSDesc.dwWidth, DDSDesc.dwHeight); return new Citro3DRenderer(DDSDesc.dwWidth, DDSDesc.dwHeight);
} }
#endif #endif
#ifdef USE_GX2
if (SDL_memcmp(guid, &GX2_GUID, sizeof(GUID)) == 0) {
return new GX2Renderer(DDSDesc.dwWidth, DDSDesc.dwHeight);
}
#endif
#ifdef USE_DIRECTX9 #ifdef USE_DIRECTX9
if (SDL_memcmp(guid, &DirectX9_GUID, sizeof(GUID)) == 0) { if (SDL_memcmp(guid, &DirectX9_GUID, sizeof(GUID)) == 0) {
return DirectX9Renderer::Create(DDSDesc.dwWidth, DDSDesc.dwHeight); return DirectX9Renderer::Create(DDSDesc.dwWidth, DDSDesc.dwHeight);
@ -87,6 +95,9 @@ void Direct3DRMRenderer_EnumDevices(const IDirect3DMiniwin* d3d, LPD3DENUMDEVICE
#ifdef USE_CITRO3D #ifdef USE_CITRO3D
Citro3DRenderer_EnumDevice(cb, ctx); Citro3DRenderer_EnumDevice(cb, ctx);
#endif #endif
#ifdef USE_GX2
GX2Renderer_EnumDevice(cb, ctx);
#endif
#ifdef USE_DIRECTX9 #ifdef USE_DIRECTX9
DirectX9Renderer_EnumDevice(cb, ctx); DirectX9Renderer_EnumDevice(cb, ctx);
#endif #endif

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