mirror of
https://github.com/isledecomp/isle-portable.git
synced 2026-01-11 18:41:14 +00:00
Introduce mortar layer
This commit is contained in:
parent
d121ae1ecd
commit
2cb0571a9b
14
.github/workflows/ci.yml
vendored
14
.github/workflows/ci.yml
vendored
@ -11,10 +11,10 @@ jobs:
|
||||
name: 'clang-format'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
- name: Run clang-format
|
||||
run: |
|
||||
find CONFIG LEGO1 ISLE miniwin -iname '*.h' -o -iname '*.cpp' | xargs \
|
||||
find CONFIG LEGO1 ISLE miniwin mortar -iname '*.h' -o -iname '*.cpp' | xargs \
|
||||
pipx run "clang-format>=17,<18" \
|
||||
--style=file \
|
||||
-i
|
||||
@ -132,7 +132,7 @@ jobs:
|
||||
echo "$VITASDK/bin" >> $GITHUB_PATH
|
||||
./install-all.sh
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Checkout LFS
|
||||
if: ${{ matrix.build-assets }}
|
||||
@ -197,7 +197,7 @@ jobs:
|
||||
success=0
|
||||
max_tries=10
|
||||
for i in $(seq $max_tries); do
|
||||
cpack . && success=1
|
||||
cpack . -C Release && success=1
|
||||
if test $success = 1; then
|
||||
break
|
||||
fi
|
||||
@ -296,7 +296,7 @@ jobs:
|
||||
options: --privileged
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Build Flatpak
|
||||
uses: flatpak/flatpak-github-actions/flatpak-builder@v6
|
||||
@ -310,7 +310,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- name: Install LLVM and Clang
|
||||
uses: KyleMayes/install-llvm-action@v1
|
||||
@ -360,7 +360,7 @@ jobs:
|
||||
merge-multiple: true
|
||||
|
||||
- name: Checkout uploadtool
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
repository: 'probonopd/uploadtool'
|
||||
path: 'uploadtool'
|
||||
|
||||
2
.github/workflows/docker.yml
vendored
2
.github/workflows/docker.yml
vendored
@ -22,7 +22,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
|
||||
|
||||
111
CMakeLists.txt
111
CMakeLists.txt
@ -38,11 +38,19 @@ set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
set(ISLE_MORTAR_SDL3_DEFAULT ON)
|
||||
set(ISLE_MORTAR_SDL3_DYNAMIC_AVAILABLE ON)
|
||||
if(ANDROID OR IOS OR EMSCRIPTEN OR NINTENDO_3DS OR NX OR VITA OR XBOXONE OR CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch")
|
||||
set(ISLE_MORTAR_SDL3_DYNAMIC_AVAILABLE OFF)
|
||||
endif()
|
||||
option(ISLE_MORTAR_SDL3 "Mortar SDL3 backend" ${ISLE_MORTAR_SDL3_DEFAULT})
|
||||
cmake_dependent_option(ISLE_MORTAR_SDL3_DYNAMIC "Mortar dynamic SDL3 backend" ON "ISLE_MORTAR_SDL3;${ISLE_MORTAR_SDL3_DYNAMIC_AVAILABLE}" OFF)
|
||||
|
||||
if (NOT MINGW)
|
||||
set(NOT_MINGW ON)
|
||||
else()
|
||||
set(NOT_MINGW OFF)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static -static-libgcc -static-libstdc++")
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-static -static-libgcc -static-libstdc++")
|
||||
endif()
|
||||
|
||||
find_program(SDL_SHADERCROSS_BIN NAMES "shadercross")
|
||||
@ -76,13 +84,13 @@ add_library(Isle::iniparser INTERFACE IMPORTED)
|
||||
|
||||
if (DOWNLOAD_DEPENDENCIES)
|
||||
# FetchContent downloads and configures dependencies
|
||||
message(STATUS "Fetching SDL3 and iniparser. This might take a while...")
|
||||
include(FetchContent)
|
||||
|
||||
if(ISLE_MORTAR_SDL3)
|
||||
if(ANDROID)
|
||||
# Built by Gradle
|
||||
find_package(SDL3 REQUIRED CONFIG COMPONENTS Shared)
|
||||
else()
|
||||
message(STATUS "Fetching SDL3. This might take a while...")
|
||||
if (WINDOWS_STORE)
|
||||
FetchContent_Declare(
|
||||
SDL3
|
||||
@ -115,7 +123,9 @@ if (DOWNLOAD_DEPENDENCIES)
|
||||
endif()
|
||||
FetchContent_MakeAvailable(SDL3)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message(STATUS "Fetching iniparser. This might take a while...")
|
||||
FetchContent_Declare(
|
||||
iniparser
|
||||
GIT_REPOSITORY "https://gitlab.com/iniparser/iniparser.git"
|
||||
@ -130,10 +140,12 @@ if (DOWNLOAD_DEPENDENCIES)
|
||||
target_link_libraries(Isle::iniparser INTERFACE iniparser-static)
|
||||
endblock()
|
||||
else()
|
||||
if(ISLE_MORTAR_SDL3)
|
||||
# find_package looks for already-installed system packages.
|
||||
# Configure with `-DCMAKE_PREFIX_PATH="/path/to/package1;/path/to/package2"`
|
||||
# to add search paths.
|
||||
find_package(SDL3 CONFIG REQUIRED)
|
||||
endif()
|
||||
|
||||
find_package(iniparser REQUIRED CONFIG)
|
||||
if(TARGET iniparser-shared)
|
||||
@ -213,8 +225,7 @@ target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/L
|
||||
target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/LEGO1/lego/sources>")
|
||||
target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/LEGO1/lego/legoomni/include>")
|
||||
target_include_directories(lego1 PUBLIC "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/LEGO1/lego/legoomni/include/actions>")
|
||||
target_link_libraries(lego1 PRIVATE SDL3::SDL3)
|
||||
target_link_libraries(lego1 PUBLIC SDL3::Headers)
|
||||
target_link_libraries(lego1 PUBLIC mortar::headers)
|
||||
target_link_libraries(lego1 PRIVATE $<$<BOOL:${ISLE_USE_DX5}>:DirectX5::DirectX5>)
|
||||
# Allow unconditional include of miniwin/miniwind3d.h
|
||||
target_link_libraries(lego1 PRIVATE miniwin-headers)
|
||||
@ -563,8 +574,8 @@ if (ISLE_BUILD_APP)
|
||||
# Use internal DirectX 5 if required
|
||||
target_link_libraries(isle PRIVATE $<$<BOOL:${ISLE_USE_DX5}>:DirectX5::DirectX5>)
|
||||
|
||||
# Link SDL and iniparser
|
||||
target_link_libraries(isle PRIVATE SDL3::SDL3 Isle::iniparser)
|
||||
# Link mortar and iniparser
|
||||
target_link_libraries(isle PRIVATE Isle::iniparser)
|
||||
|
||||
# Allow unconditional include of miniwin/miniwindevice.h
|
||||
target_link_libraries(isle PRIVATE miniwin-headers)
|
||||
@ -671,6 +682,7 @@ if (ISLE_BUILD_CONFIG)
|
||||
CONFIG/qt/res/config.qrc
|
||||
)
|
||||
target_link_libraries(isle-config PRIVATE Qt6::Core Qt6::Widgets)
|
||||
target_link_libraries(isle-config PRIVATE mortar::headers mortar::embed)
|
||||
set_property(TARGET isle-config PROPERTY AUTOMOC ON)
|
||||
set_property(TARGET isle-config PROPERTY AUTORCC ON)
|
||||
set_property(TARGET isle-config PROPERTY AUTOUIC ON)
|
||||
@ -683,7 +695,7 @@ if (ISLE_BUILD_CONFIG)
|
||||
target_link_libraries(isle-config PRIVATE DirectX5::DirectX5)
|
||||
endif()
|
||||
target_compile_definitions(isle-config PRIVATE DIRECT3D_VERSION=0x500)
|
||||
target_link_libraries(isle-config PRIVATE SDL3::SDL3 Isle::iniparser)
|
||||
target_link_libraries(isle-config PRIVATE Isle::iniparser)
|
||||
if (NOT ISLE_MINIWIN)
|
||||
target_link_libraries(isle-config PRIVATE ddraw dxguid)
|
||||
endif()
|
||||
@ -721,6 +733,89 @@ if (ISLE_MINIWIN)
|
||||
set_property(TARGET ${isle_targets} APPEND PROPERTY LINK_LIBRARIES "miniwin")
|
||||
endif()
|
||||
|
||||
add_library(mortar_headers INTERFACE)
|
||||
add_library(mortar::headers ALIAS mortar_headers)
|
||||
target_compile_definitions(mortar_headers INTERFACE $<$<BOOL:${BUILD_SHARED_LIBS}>:MORTAR_DLL>)
|
||||
target_include_directories(mortar_headers INTERFACE "$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/mortar/include>")
|
||||
|
||||
# Link with mortar::declare_embedded to declare mortar is embedded alongside it
|
||||
add_library(mortar_declare_embedded INTERFACE)
|
||||
add_library(mortar::declare_embedded ALIAS mortar_declare_embedded)
|
||||
target_sources(mortar_declare_embedded INTERFACE $<TARGET_OBJECTS:mortar>)
|
||||
target_compile_definitions(mortar_declare_embedded INTERFACE BUILDING_MORTAR)
|
||||
|
||||
# Link with mortar::embed to embed mortar inside of it
|
||||
add_library(mortar_embed INTERFACE)
|
||||
add_library(mortar::embed ALIAS mortar_embed)
|
||||
target_sources(mortar_embed INTERFACE $<TARGET_OBJECTS:mortar>)
|
||||
target_link_libraries(mortar_embed INTERFACE mortar::declare_embedded)
|
||||
|
||||
add_library(mortar STATIC
|
||||
mortar/include/mortar/mortar.h
|
||||
mortar/src/mortar.cpp
|
||||
)
|
||||
target_compile_definitions(mortar PRIVATE BUILDING_MORTAR)
|
||||
target_link_libraries(mortar PUBLIC mortar::headers)
|
||||
set_property(TARGET mortar PROPERTY C_VISIBILITY_PRESET "hidden")
|
||||
set_property(TARGET mortar PROPERTY CXX_VISIBILITY_PRESET "hidden")
|
||||
list(APPEND isle_targets mortar)
|
||||
|
||||
if(ISLE_MORTAR_SDL3)
|
||||
set(MORTAR_SDL3_SOURCES
|
||||
mortar/src/sdl3/sdl3_audio.cpp
|
||||
mortar/src/sdl3/sdl3_cpuinfo.cpp
|
||||
mortar/src/sdl3/sdl3_error.cpp
|
||||
mortar/src/sdl3/sdl3_events.cpp
|
||||
mortar/src/sdl3/sdl3_filesystem.cpp
|
||||
mortar/src/sdl3/sdl3_gamepad.cpp
|
||||
mortar/src/sdl3/sdl3_haptic.cpp
|
||||
mortar/src/sdl3/sdl3_init.cpp
|
||||
mortar/src/sdl3/sdl3_iostream.cpp
|
||||
mortar/src/sdl3/sdl3_joystick.cpp
|
||||
mortar/src/sdl3/sdl3_keyboard.cpp
|
||||
mortar/src/sdl3/sdl3_keycode.cpp
|
||||
mortar/src/sdl3/sdl3_log.cpp
|
||||
mortar/src/sdl3/sdl3_main.cpp
|
||||
mortar/src/sdl3/sdl3_messagebox.cpp
|
||||
mortar/src/sdl3/sdl3_mouse.cpp
|
||||
mortar/src/sdl3/sdl3_mutex.cpp
|
||||
mortar/src/sdl3/sdl3_pixels.cpp
|
||||
mortar/src/sdl3/sdl3_process.cpp
|
||||
mortar/src/sdl3/sdl3_rect.cpp
|
||||
mortar/src/sdl3/sdl3_render.cpp
|
||||
mortar/src/sdl3/sdl3_stdinc.cpp
|
||||
mortar/src/sdl3/sdl3_surface.cpp
|
||||
mortar/src/sdl3/sdl3_system.cpp
|
||||
mortar/src/sdl3/sdl3_thread.cpp
|
||||
mortar/src/sdl3/sdl3_timer.cpp
|
||||
mortar/src/sdl3/sdl3_version.cpp
|
||||
mortar/src/sdl3/sdl3_video.cpp
|
||||
)
|
||||
target_sources(mortar PRIVATE ${MORTAR_SDL3_SOURCES})
|
||||
get_property(sdl3_alias TARGET SDL3::SDL3 PROPERTY ALIASED_TARGET)
|
||||
add_dependencies(mortar "SDL3::SDL3")
|
||||
set_property(SOURCE ${MORTAR_SDL3_SOURCES} APPEND PROPERTY INCLUDE_DIRECTORIES $<TARGET_PROPERTY:SDL3::Headers,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
if(ISLE_MORTAR_SDL3_DYNAMIC)
|
||||
target_compile_definitions(mortar_headers INTERFACE SDL3_DYNAMIC_LOAD)
|
||||
set_property(TARGET lego1 APPEND PROPERTY BUILD_RPATH "$<TARGET_FILE_DIR:SDL3::SDL3>")
|
||||
if(TARGET isle)
|
||||
set_property(TARGET isle APPEND PROPERTY BUILD_RPATH "$<TARGET_FILE_DIR:SDL3::SDL3>")
|
||||
endif()
|
||||
if(TARGET isle-config)
|
||||
set_property(TARGET isle-config APPEND PROPERTY BUILD_RPATH "$<TARGET_FILE_DIR:SDL3::SDL3>")
|
||||
endif()
|
||||
else()
|
||||
target_link_libraries(mortar PRIVATE SDL3::Headers)
|
||||
target_link_libraries(mortar_embed INTERFACE SDL3::SDL3)
|
||||
endif()
|
||||
endif()
|
||||
target_link_libraries(lego1 PRIVATE mortar_headers mortar::embed)
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
if(TARGET isle)
|
||||
target_link_libraries(isle PRIVATE mortar::embed)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "15")
|
||||
set_property(TARGET ${isle_targets} APPEND PROPERTY COMPILE_DEFINITIONS "_CRT_SECURE_NO_WARNINGS")
|
||||
|
||||
@ -13,8 +13,8 @@
|
||||
#include <QKeyEvent>
|
||||
#include <QMessageBox>
|
||||
#include <QProcess>
|
||||
#include <SDL3/SDL.h>
|
||||
#include <cmath>
|
||||
#include <mortar/mortar.h>
|
||||
#include <mxdirectx/legodxinfo.h>
|
||||
#include <ui_maindialog.h>
|
||||
|
||||
@ -182,7 +182,7 @@ bool CMainDialog::OnInitDialog()
|
||||
m_ui->exFullResComboBox->clear();
|
||||
|
||||
int displayModeCount;
|
||||
displayModes = SDL_GetFullscreenDisplayModes(SDL_GetPrimaryDisplay(), &displayModeCount);
|
||||
displayModes = MORTAR_GetFullscreenDisplayModes(MORTAR_GetPrimaryDisplay(), &displayModeCount);
|
||||
|
||||
for (int i = 0; i < displayModeCount; ++i) {
|
||||
QString mode =
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
#include <QDialog>
|
||||
#include <QFileDialog>
|
||||
#include <SDL3/SDL.h>
|
||||
#include <mortar/mortar.h>
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
@ -31,7 +31,7 @@ class CMainDialog : public QDialog {
|
||||
bool m_advanced = false;
|
||||
QStringList assetPaths = QStringList();
|
||||
Ui::MainDialog* m_ui = nullptr;
|
||||
SDL_DisplayMode** displayModes;
|
||||
MORTAR_DisplayMode** displayModes;
|
||||
|
||||
void keyReleaseEvent(QKeyEvent* event) override;
|
||||
bool OnInitDialog();
|
||||
|
||||
@ -16,8 +16,8 @@
|
||||
#include <QApplication>
|
||||
#include <QCommandLineParser>
|
||||
#include <QMessageBox>
|
||||
#include <SDL3/SDL.h>
|
||||
#include <iniparser.h>
|
||||
#include <mortar/mortar.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(CWinApp, 0xc4)
|
||||
DECOMP_SIZE_ASSERT(CConfigApp, 0x108)
|
||||
@ -27,23 +27,14 @@ DECOMP_STATIC_ASSERT(offsetof(CConfigApp, m_display_bit_depth) == 0xd0)
|
||||
// FUNCTION: CONFIG 0x00402c40
|
||||
CConfigApp::CConfigApp()
|
||||
{
|
||||
char* prefPath = SDL_GetPrefPath("isledecomp", "isle");
|
||||
char* iniConfig;
|
||||
if (prefPath) {
|
||||
m_iniPath = std::string{prefPath} + "isle.ini";
|
||||
}
|
||||
else {
|
||||
m_iniPath = "isle.ini";
|
||||
}
|
||||
SDL_free(prefPath);
|
||||
}
|
||||
|
||||
// FUNCTION: CONFIG 0x00402dc0
|
||||
bool CConfigApp::InitInstance()
|
||||
{
|
||||
if (!SDL_Init(SDL_INIT_VIDEO)) {
|
||||
QString err = QString{"SDL failed to initialize ("} + SDL_GetError() + ")";
|
||||
QMessageBox::warning(nullptr, "SDL initialization error", err);
|
||||
if (!MORTAR_Init()) {
|
||||
QString err = QString{"MORTAR failed to initialize ("} + MORTAR_GetError() + ")";
|
||||
QMessageBox::warning(nullptr, "MORTAR initialization error", err);
|
||||
return false;
|
||||
}
|
||||
if (!DetectDirectX5()) {
|
||||
@ -56,17 +47,24 @@ bool CConfigApp::InitInstance()
|
||||
return false;
|
||||
}
|
||||
m_device_enumerator = new LegoDeviceEnumerate;
|
||||
SDL_Window* window = SDL_CreateWindow("Test window", 640, 480, SDL_WINDOW_HIDDEN | SDL_WINDOW_OPENGL);
|
||||
MORTAR_EX_CreateWindowProps createWindowProps = {};
|
||||
createWindowProps.width = 640;
|
||||
createWindowProps.height = 480;
|
||||
createWindowProps.title = "Test window";
|
||||
createWindowProps.hidden = true;
|
||||
createWindowProps.opengl.enabled = true;
|
||||
MORTAR_Window* window = MORTAR_EX_CreateWindow(&createWindowProps);
|
||||
HWND hWnd;
|
||||
|
||||
#ifdef MINIWIN
|
||||
hWnd = reinterpret_cast<HWND>(window);
|
||||
#else
|
||||
hWnd = (HWND) SDL_GetPointerProperty(SDL_GetWindowProperties(window), SDL_PROP_WINDOW_WIN32_HWND_POINTER, NULL);
|
||||
hWnd = (HWND) MORTAR_EXT_GetWindowProperty(window, MORTAR_WINDOW_PROPERTY_HWND, nullptr);
|
||||
#endif
|
||||
if (m_device_enumerator->DoEnumerate(hWnd)) {
|
||||
return FALSE;
|
||||
}
|
||||
SDL_DestroyWindow(window);
|
||||
MORTAR_DestroyWindow(window);
|
||||
m_aspect_ratio = 0;
|
||||
m_exf_x_res = m_x_res = 640;
|
||||
m_exf_y_res = m_y_res = 480;
|
||||
@ -93,7 +91,7 @@ bool CConfigApp::InitInstance()
|
||||
m_texture_path = "textures/";
|
||||
m_custom_assets_enabled = TRUE;
|
||||
m_custom_asset_path = "assets/widescreen.si";
|
||||
int totalRamMiB = SDL_GetSystemRAM();
|
||||
int totalRamMiB = MORTAR_GetSystemRAM();
|
||||
if (totalRamMiB < 12) {
|
||||
m_ram_quality_limit = 2;
|
||||
m_3d_sound = FALSE;
|
||||
@ -444,7 +442,7 @@ int CConfigApp::ExitInstance()
|
||||
delete m_device_enumerator;
|
||||
m_device_enumerator = NULL;
|
||||
}
|
||||
SDL_Quit();
|
||||
MORTAR_Quit();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -471,6 +469,12 @@ int main(int argc, char* argv[])
|
||||
parser.addHelpOption();
|
||||
parser.addVersionOption();
|
||||
|
||||
QCommandLineOption platformOption(
|
||||
QStringList() << "platform",
|
||||
QCoreApplication::translate("config", "Set MORTAR platform."),
|
||||
QCoreApplication::translate("config", "platform")
|
||||
);
|
||||
parser.addOption(platformOption);
|
||||
QCommandLineOption iniOption(
|
||||
QStringList() << "ini",
|
||||
QCoreApplication::translate("config", "Set INI path."),
|
||||
@ -479,6 +483,33 @@ int main(int argc, char* argv[])
|
||||
parser.addOption(iniOption);
|
||||
parser.process(app);
|
||||
|
||||
if (parser.isSet(platformOption)) {
|
||||
std::string s = parser.value(iniOption).toStdString();
|
||||
MORTAR_Backend backend;
|
||||
if (!MORTAR_ParseBackendName(s.c_str(), &backend)) {
|
||||
qFatal("Unknown platform: %s", s.c_str());
|
||||
return 1;
|
||||
}
|
||||
if (!MORTAR_SetBackend(backend)) {
|
||||
qFatal("Failed to set platform");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!MORTAR_InitializeBackend()) {
|
||||
qFatal("Failed to initialize platform");
|
||||
return 1;
|
||||
}
|
||||
|
||||
char* prefPath = MORTAR_GetPrefPath("isledecomp", "isle");
|
||||
if (prefPath) {
|
||||
g_theApp.SetIniPath(std::string{prefPath} + "isle.ini");
|
||||
}
|
||||
else {
|
||||
g_theApp.SetIniPath("isle.ini");
|
||||
}
|
||||
MORTAR_free(prefPath);
|
||||
|
||||
if (parser.isSet(iniOption)) {
|
||||
g_theApp.SetIniPath(parser.value(iniOption).toStdString());
|
||||
}
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <SDL3/SDL_log.h>
|
||||
#include <iniparser.h>
|
||||
#include <mortar/mortar_log.h>
|
||||
|
||||
void N3DS_SetupDefaultConfigOverrides(dictionary* p_dictionary)
|
||||
{
|
||||
SDL_Log("Overriding default config for 3DS");
|
||||
MORTAR_Log("Overriding default config for 3DS");
|
||||
|
||||
// We are currently not bundling the assets into romfs.
|
||||
// User must place assets in sdmc:/3ds/isle where
|
||||
|
||||
@ -2,20 +2,18 @@
|
||||
|
||||
#include "mxstring.h"
|
||||
|
||||
#include <SDL3/SDL_filesystem.h>
|
||||
#include <SDL3/SDL_log.h>
|
||||
#include <SDL3/SDL_system.h>
|
||||
#include <iniparser.h>
|
||||
#include <mortar/mortar.h>
|
||||
|
||||
void Android_SetupDefaultConfigOverrides(dictionary* p_dictionary)
|
||||
{
|
||||
SDL_Log("Overriding default config for Android");
|
||||
MORTAR_Log("Overriding default config for Android");
|
||||
|
||||
const char* data = SDL_GetAndroidExternalStoragePath();
|
||||
const char* data = MORTAR_GetAndroidExternalStoragePath();
|
||||
MxString savedata = MxString(data) + "/saves/";
|
||||
|
||||
if (!SDL_GetPathInfo(savedata.GetData(), NULL)) {
|
||||
SDL_CreateDirectory(savedata.GetData());
|
||||
if (!MORTAR_GetPathInfo(savedata.GetData(), NULL)) {
|
||||
MORTAR_CreateDirectory(savedata.GetData());
|
||||
}
|
||||
|
||||
iniparser_set(p_dictionary, "isle:diskpath", data);
|
||||
@ -25,5 +23,16 @@ void Android_SetupDefaultConfigOverrides(dictionary* p_dictionary)
|
||||
|
||||
// Default to Virtual Mouse
|
||||
char buf[16];
|
||||
iniparser_set(p_dictionary, "isle:Touch Scheme", SDL_itoa(0, buf, 10));
|
||||
iniparser_set(p_dictionary, "isle:Touch Scheme", MORTAR_itoa(0, buf, 10));
|
||||
}
|
||||
|
||||
extern int main(int argc, char* argv[]);
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
int SDL_main(int argc, char* argv[])
|
||||
{
|
||||
return main(argc, argv);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,13 +3,13 @@
|
||||
#include "filesystem.h"
|
||||
#include "window.h"
|
||||
|
||||
#include <SDL3/SDL_log.h>
|
||||
#include <emscripten.h>
|
||||
#include <iniparser.h>
|
||||
#include <mortar/mortar_log.h>
|
||||
|
||||
void Emscripten_SetupDefaultConfigOverrides(dictionary* p_dictionary)
|
||||
{
|
||||
SDL_Log("Overriding default config for Emscripten");
|
||||
MORTAR_Log("Overriding default config for Emscripten");
|
||||
|
||||
iniparser_set(p_dictionary, "isle:diskpath", Emscripten_bundledPath);
|
||||
iniparser_set(p_dictionary, "isle:cdpath", Emscripten_streamPath);
|
||||
|
||||
@ -25,7 +25,7 @@ void Emscripten_SendEvent(const char* p_event, const char* p_json)
|
||||
void Emscripten_SendPresenterProgress(MxDSAction* p_action, MxPresenter::TickleState p_tickleState)
|
||||
{
|
||||
char buf[128];
|
||||
SDL_snprintf(
|
||||
MORTAR_snprintf(
|
||||
buf,
|
||||
sizeof(buf),
|
||||
"{\"objectId\": %d, \"objectName\": \"%s\", \"tickleState\": %d}",
|
||||
@ -40,7 +40,7 @@ void Emscripten_SendPresenterProgress(MxDSAction* p_action, MxPresenter::TickleS
|
||||
void Emscripten_SendExtensionProgress(const char* p_extension, MxU32 p_progress)
|
||||
{
|
||||
char buf[128];
|
||||
SDL_snprintf(buf, sizeof(buf), "{\"name\": \"%s\", \"progress\": %d}", p_extension, p_progress);
|
||||
MORTAR_snprintf(buf, sizeof(buf), "{\"name\": \"%s\", \"progress\": %d}", p_extension, p_progress);
|
||||
|
||||
Emscripten_SendEvent("extensionProgress", buf);
|
||||
}
|
||||
|
||||
@ -7,10 +7,9 @@
|
||||
#include "misc.h"
|
||||
#include "mxmain.h"
|
||||
|
||||
#include <SDL3/SDL_filesystem.h>
|
||||
#include <SDL3/SDL_log.h>
|
||||
#include <emscripten.h>
|
||||
#include <emscripten/wasmfs.h>
|
||||
#include <mortar/mortar.h>
|
||||
|
||||
static backend_t opfs = nullptr;
|
||||
static backend_t fetchfs = nullptr;
|
||||
@ -26,7 +25,7 @@ bool Emscripten_OPFSDisabled()
|
||||
bool Emscripten_SetupConfig(const char* p_iniConfig)
|
||||
{
|
||||
if (Emscripten_OPFSDisabled()) {
|
||||
SDL_Log("OPFS is disabled; ignoring .ini path");
|
||||
MORTAR_Log("OPFS is disabled; ignoring .ini path");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -34,7 +33,7 @@ bool Emscripten_SetupConfig(const char* p_iniConfig)
|
||||
MxString iniConfig = p_iniConfig;
|
||||
|
||||
char* parse = iniConfig.GetData();
|
||||
while ((parse = SDL_strchr(++parse, '/'))) {
|
||||
while ((parse = MORTAR_strchr(++parse, '/'))) {
|
||||
*parse = '\0';
|
||||
wasmfs_create_directory(iniConfig.GetData(), 0644, opfs);
|
||||
*parse = '/';
|
||||
@ -64,22 +63,22 @@ void Emscripten_SetupFilesystem()
|
||||
MxString path = MxString(Emscripten_bundledPath) + MxString(p_path);
|
||||
path.MapPathToFilesystem();
|
||||
|
||||
if (SDL_GetPathInfo(path.GetData(), NULL)) {
|
||||
SDL_Log("File %s is bundled and won't be streamed", p_path);
|
||||
if (MORTAR_GetPathInfo(path.GetData(), NULL)) {
|
||||
MORTAR_Log("File %s is bundled and won't be streamed", p_path);
|
||||
}
|
||||
else {
|
||||
wasmfs_create_file(p_path, 0644, fetchfs);
|
||||
MxOmni::GetCDFiles().emplace_back(p_path);
|
||||
|
||||
SDL_Log("File %s set up for streaming", p_path);
|
||||
MORTAR_Log("File %s set up for streaming", p_path);
|
||||
}
|
||||
};
|
||||
|
||||
const auto preloadFile = [](const char* p_path) -> bool {
|
||||
size_t length = 0;
|
||||
void* data = SDL_LoadFile(p_path, &length);
|
||||
void* data = MORTAR_LoadFile(p_path, &length);
|
||||
if (data) {
|
||||
SDL_free(data);
|
||||
MORTAR_free(data);
|
||||
}
|
||||
return length > 0;
|
||||
};
|
||||
@ -129,7 +128,7 @@ void Emscripten_SetupFilesystem()
|
||||
}
|
||||
|
||||
char* parse = savePath.GetData();
|
||||
while ((parse = SDL_strchr(++parse, '/'))) {
|
||||
while ((parse = MORTAR_strchr(++parse, '/'))) {
|
||||
*parse = '\0';
|
||||
wasmfs_create_directory(savePath.GetData(), 0644, opfs);
|
||||
*parse = '/';
|
||||
|
||||
@ -11,10 +11,10 @@ void Emscripten_HandleRumbleEvent(float p_lowFrequencyRumble, float p_highFreque
|
||||
{
|
||||
std::visit(
|
||||
overloaded{
|
||||
[](LegoInputManager::SDL_KeyboardID_v p_id) {},
|
||||
[](LegoInputManager::SDL_MouseID_v p_id) {},
|
||||
[p_lowFrequencyRumble, p_highFrequencyRumble, p_milliseconds](LegoInputManager::SDL_JoystickID_v p_id) {
|
||||
const char* name = SDL_GetJoystickNameForID((SDL_JoystickID) p_id);
|
||||
[](LegoInputManager::MORTAR_KeyboardID_v p_id) {},
|
||||
[](LegoInputManager::MORTAR_MouseID_v p_id) {},
|
||||
[p_lowFrequencyRumble, p_highFrequencyRumble, p_milliseconds](LegoInputManager::MORTAR_JoystickID_v p_id) {
|
||||
const char* name = MORTAR_GetJoystickNameForID((MORTAR_JoystickID) p_id);
|
||||
if (name) {
|
||||
MAIN_THREAD_EM_ASM(
|
||||
{
|
||||
@ -33,13 +33,13 @@ void Emscripten_HandleRumbleEvent(float p_lowFrequencyRumble, float p_highFreque
|
||||
}
|
||||
},
|
||||
name,
|
||||
SDL_clamp(p_lowFrequencyRumble, 0, 1),
|
||||
SDL_clamp(p_highFrequencyRumble, 0, 1),
|
||||
MORTAR_clamp(p_lowFrequencyRumble, 0, 1),
|
||||
MORTAR_clamp(p_highFrequencyRumble, 0, 1),
|
||||
p_milliseconds
|
||||
);
|
||||
}
|
||||
},
|
||||
[p_milliseconds](LegoInputManager::SDL_TouchID_v p_id) {
|
||||
[p_milliseconds](LegoInputManager::MORTAR_TouchID_v p_id) {
|
||||
MAIN_THREAD_EM_ASM(
|
||||
{
|
||||
if (navigator.vibrate) {
|
||||
|
||||
@ -3,10 +3,10 @@
|
||||
#include <emscripten.h>
|
||||
|
||||
bool Emscripten_ShowSimpleMessageBox(
|
||||
SDL_MessageBoxFlags flags,
|
||||
MORTAR_MessageBoxFlags flags,
|
||||
const char* title,
|
||||
const char* message,
|
||||
SDL_Window* window
|
||||
MORTAR_Window* window
|
||||
)
|
||||
{
|
||||
MAIN_THREAD_EM_ASM({alert(UTF8ToString($0) + "\n\n" + UTF8ToString($1))}, title, message);
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
#ifndef EMSCRIPTEN_MESSAGE_BOX_H
|
||||
#define EMSCRIPTEN_MESSAGE_BOX_H
|
||||
|
||||
#include <SDL3/SDL_messagebox.h>
|
||||
#include <mortar/mortar_messagebox.h>
|
||||
|
||||
bool Emscripten_ShowSimpleMessageBox(
|
||||
SDL_MessageBoxFlags flags,
|
||||
MORTAR_MessageBoxFlags flags,
|
||||
const char* title,
|
||||
const char* message,
|
||||
SDL_Window* window
|
||||
MORTAR_Window* window
|
||||
);
|
||||
|
||||
#endif // EMSCRIPTEN_MESSAGE_BOX_H
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
|
||||
#include "mxtypes.h"
|
||||
|
||||
#include <SDL3/SDL_log.h>
|
||||
#include <algorithm>
|
||||
#include <emscripten/html5.h>
|
||||
#include <mortar/mortar_log.h>
|
||||
|
||||
double g_fullWidth;
|
||||
double g_fullHeight;
|
||||
@ -14,9 +14,9 @@ bool g_originalResolution = true;
|
||||
extern MxS32 g_targetWidth;
|
||||
extern MxS32 g_targetHeight;
|
||||
|
||||
void Emscripten_SetupWindow(SDL_Window* p_window)
|
||||
void Emscripten_SetupWindow(MORTAR_Window* p_window)
|
||||
{
|
||||
SDL_SetWindowResizable(p_window, false);
|
||||
MORTAR_SetWindowResizable(p_window, false);
|
||||
|
||||
EmscriptenFullscreenStrategy strategy;
|
||||
strategy.scaleMode = g_scaleAspect ? EMSCRIPTEN_FULLSCREEN_SCALE_ASPECT : EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH;
|
||||
@ -29,13 +29,13 @@ void Emscripten_SetupWindow(SDL_Window* p_window)
|
||||
emscripten_get_element_css_size("#canvas", &g_fullWidth, &g_fullHeight);
|
||||
|
||||
if (g_originalResolution) {
|
||||
SDL_SetWindowSize((SDL_Window*) userData, g_targetWidth, g_targetHeight);
|
||||
MORTAR_SetWindowSize((MORTAR_Window*) userData, g_targetWidth, g_targetHeight);
|
||||
}
|
||||
else {
|
||||
SDL_SetWindowSize((SDL_Window*) userData, width, height);
|
||||
MORTAR_SetWindowSize((MORTAR_Window*) userData, width, height);
|
||||
}
|
||||
|
||||
SDL_Log(
|
||||
MORTAR_Log(
|
||||
"Emscripten: window size %dx%d, canvas size %dx%d, scale aspect %s, original resolution %s",
|
||||
width,
|
||||
height,
|
||||
@ -60,47 +60,47 @@ void Emscripten_SetOriginalResolution(bool p_originalResolution)
|
||||
g_originalResolution = p_originalResolution;
|
||||
}
|
||||
|
||||
void Emscripten_ConvertEventToRenderCoordinates(SDL_Event* event)
|
||||
void Emscripten_ConvertEventToRenderCoordinates(MORTAR_Event* event)
|
||||
{
|
||||
if (!g_scaleAspect) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (event->type) {
|
||||
case SDL_EVENT_MOUSE_MOTION: {
|
||||
case MORTAR_EVENT_MOUSE_MOTION: {
|
||||
const float scale = std::min(g_fullWidth / g_targetWidth, g_fullHeight / g_targetHeight);
|
||||
const float widthRatio = (g_targetWidth * scale) / g_fullWidth;
|
||||
const float heightRatio = (g_targetHeight * scale) / g_fullHeight;
|
||||
event->motion.x = (event->motion.x - (g_targetWidth * (1.0f - widthRatio) / 2.0f)) / widthRatio;
|
||||
event->motion.x = SDL_clamp(event->motion.x, 0, g_targetWidth);
|
||||
event->motion.x = MORTAR_clamp(event->motion.x, 0, g_targetWidth);
|
||||
event->motion.y = (event->motion.y - (g_targetHeight * (1.0f - heightRatio) / 2.0f)) / heightRatio;
|
||||
event->motion.y = SDL_clamp(event->motion.y, 0, g_targetHeight);
|
||||
event->motion.y = MORTAR_clamp(event->motion.y, 0, g_targetHeight);
|
||||
break;
|
||||
}
|
||||
case SDL_EVENT_MOUSE_BUTTON_DOWN:
|
||||
case SDL_EVENT_MOUSE_BUTTON_UP: {
|
||||
case MORTAR_EVENT_MOUSE_BUTTON_DOWN:
|
||||
case MORTAR_EVENT_MOUSE_BUTTON_UP: {
|
||||
const float scale = std::min(g_fullWidth / g_targetWidth, g_fullHeight / g_targetHeight);
|
||||
const float widthRatio = (g_targetWidth * scale) / g_fullWidth;
|
||||
const float heightRatio = (g_targetHeight * scale) / g_fullHeight;
|
||||
event->button.x = (event->button.x - (g_targetWidth * (1.0f - widthRatio) / 2.0f)) / widthRatio;
|
||||
event->button.x = SDL_clamp(event->button.x, 0, g_targetWidth);
|
||||
event->button.x = MORTAR_clamp(event->button.x, 0, g_targetWidth);
|
||||
event->button.y = (event->button.y - (g_targetHeight * (1.0f - heightRatio) / 2.0f)) / heightRatio;
|
||||
event->button.y = SDL_clamp(event->button.y, 0, g_targetHeight);
|
||||
event->button.y = MORTAR_clamp(event->button.y, 0, g_targetHeight);
|
||||
break;
|
||||
}
|
||||
case SDL_EVENT_FINGER_MOTION:
|
||||
case SDL_EVENT_FINGER_DOWN:
|
||||
case SDL_EVENT_FINGER_UP:
|
||||
case SDL_EVENT_FINGER_CANCELED: {
|
||||
case MORTAR_EVENT_FINGER_MOTION:
|
||||
case MORTAR_EVENT_FINGER_DOWN:
|
||||
case MORTAR_EVENT_FINGER_UP:
|
||||
case MORTAR_EVENT_FINGER_CANCELED: {
|
||||
const float scale = std::min(g_fullWidth / g_targetWidth, g_fullHeight / g_targetHeight);
|
||||
const float widthRatio = (g_targetWidth * scale) / g_fullWidth;
|
||||
const float heightRatio = (g_targetHeight * scale) / g_fullHeight;
|
||||
event->tfinger.x = (event->tfinger.x * g_targetWidth - (g_targetWidth * (1.0f - widthRatio) / 2.0f)) /
|
||||
widthRatio / g_targetWidth;
|
||||
event->tfinger.x = SDL_clamp(event->tfinger.x, 0, 1);
|
||||
event->tfinger.x = MORTAR_clamp(event->tfinger.x, 0, 1);
|
||||
event->tfinger.y = (event->tfinger.y * g_targetHeight - (g_targetHeight * (1.0f - heightRatio) / 2.0f)) /
|
||||
heightRatio / g_targetHeight;
|
||||
event->tfinger.y = SDL_clamp(event->tfinger.y, 0, 1);
|
||||
event->tfinger.y = MORTAR_clamp(event->tfinger.y, 0, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
#ifndef EMSCRIPTEN_WINDOW_H
|
||||
#define EMSCRIPTEN_WINDOW_H
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <mortar/mortar.h>
|
||||
|
||||
void Emscripten_SetupWindow(SDL_Window* p_window);
|
||||
void Emscripten_SetupWindow(MORTAR_Window* p_window);
|
||||
void Emscripten_SetScaleAspect(bool p_scaleAspect);
|
||||
void Emscripten_SetOriginalResolution(bool p_originalResolution);
|
||||
void Emscripten_ConvertEventToRenderCoordinates(SDL_Event* event);
|
||||
void Emscripten_ConvertEventToRenderCoordinates(MORTAR_Event* event);
|
||||
|
||||
#endif // EMSCRIPTEN_WINDOW_H
|
||||
|
||||
@ -2,22 +2,22 @@
|
||||
|
||||
#include "mxstring.h"
|
||||
|
||||
#include <SDL3/SDL_filesystem.h>
|
||||
#include <SDL3/SDL_log.h>
|
||||
#include <iniparser.h>
|
||||
#include <mortar/mortar_filesystem.h>
|
||||
#include <mortar/mortar_log.h>
|
||||
|
||||
void IOS_SetupDefaultConfigOverrides(dictionary* p_dictionary)
|
||||
{
|
||||
SDL_Log("Overriding default config for iOS");
|
||||
MORTAR_Log("Overriding default config for iOS");
|
||||
|
||||
// Use DevelopmentFiles path for disk and cd paths
|
||||
// It's good to use that path since user can easily
|
||||
// connect through SMB and copy the files
|
||||
MxString documentFolder = SDL_GetUserFolder(SDL_FOLDER_DOCUMENTS);
|
||||
MxString documentFolder = MORTAR_GetUserFolder(MORTAR_FOLDER_DOCUMENTS);
|
||||
documentFolder += "isle";
|
||||
|
||||
if (!SDL_GetPathInfo(documentFolder.GetData(), NULL)) {
|
||||
SDL_CreateDirectory(documentFolder.GetData());
|
||||
if (!MORTAR_GetPathInfo(documentFolder.GetData(), NULL)) {
|
||||
MORTAR_CreateDirectory(documentFolder.GetData());
|
||||
}
|
||||
|
||||
iniparser_set(p_dictionary, "isle:diskpath", documentFolder.GetData());
|
||||
|
||||
479
ISLE/isleapp.cpp
479
ISLE/isleapp.cpp
File diff suppressed because it is too large
Load Diff
@ -9,7 +9,8 @@
|
||||
#include "mxtypes.h"
|
||||
#include "mxvideoparam.h"
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <mortar/mortar.h>
|
||||
#include <mortar/mortar_main.h>
|
||||
#ifdef MINIWIN
|
||||
#include "miniwin/windows.h"
|
||||
#else
|
||||
@ -43,14 +44,14 @@ class IsleApp {
|
||||
bool Tick();
|
||||
void SetupCursor(Cursor p_cursor);
|
||||
|
||||
static MxU8 MapMouseButtonFlagsToModifier(SDL_MouseButtonFlags p_flags);
|
||||
static MxU8 MapMouseButtonFlagsToModifier(MORTAR_MouseButtonFlags p_flags);
|
||||
|
||||
HWND GetWindowHandle() { return m_windowHandle; }
|
||||
MxLong GetFrameDelta() { return m_frameDelta; }
|
||||
MxS32 GetFullScreen() { return m_fullScreen; }
|
||||
SDL_Cursor* GetCursorCurrent() { return m_cursorCurrent; }
|
||||
SDL_Cursor* GetCursorBusy() { return m_cursorBusy; }
|
||||
SDL_Cursor* GetCursorNo() { return m_cursorNo; }
|
||||
MORTAR_Cursor* GetCursorCurrent() { return m_cursorCurrent; }
|
||||
MORTAR_Cursor* GetCursorBusy() { return m_cursorBusy; }
|
||||
MORTAR_Cursor* GetCursorNo() { return m_cursorNo; }
|
||||
MxS32 GetDrawCursor() { return m_drawCursor; }
|
||||
MxS32 GetGameStarted() { return m_gameStarted; }
|
||||
MxFloat GetCursorSensitivity() { return m_cursorSensitivity; }
|
||||
@ -62,11 +63,11 @@ class IsleApp {
|
||||
void SetGameStarted(MxS32 p_gameStarted) { m_gameStarted = p_gameStarted; }
|
||||
void SetDrawCursor(MxS32 p_drawCursor) { m_drawCursor = p_drawCursor; }
|
||||
|
||||
SDL_AppResult ParseArguments(int argc, char** argv);
|
||||
MORTAR_AppResult ParseArguments(int argc, char** argv);
|
||||
MxResult VerifyFilesystem();
|
||||
void DetectGameVersion();
|
||||
void MoveVirtualMouseViaJoystick();
|
||||
void DetectDoubleTap(const SDL_TouchFingerEvent& p_event);
|
||||
void DetectDoubleTap(const MORTAR_TouchFingerEvent& p_event);
|
||||
|
||||
private:
|
||||
char* m_hdPath; // 0x00
|
||||
@ -90,10 +91,10 @@ class IsleApp {
|
||||
MxS32 m_windowActive; // 0x70
|
||||
HWND m_windowHandle; // 0x74
|
||||
MxS32 m_drawCursor; // 0x78
|
||||
SDL_Cursor* m_cursorArrow; // 0x7c
|
||||
SDL_Cursor* m_cursorBusy; // 0x80
|
||||
SDL_Cursor* m_cursorNo; // 0x84
|
||||
SDL_Cursor* m_cursorCurrent; // 0x88
|
||||
MORTAR_Cursor* m_cursorArrow; // 0x7c
|
||||
MORTAR_Cursor* m_cursorBusy; // 0x80
|
||||
MORTAR_Cursor* m_cursorNo; // 0x84
|
||||
MORTAR_Cursor* m_cursorCurrent; // 0x88
|
||||
const CursorBitmap* m_cursorArrowBitmap;
|
||||
const CursorBitmap* m_cursorBusyBitmap;
|
||||
const CursorBitmap* m_cursorNoBitmap;
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <SDL3/SDL_log.h>
|
||||
#include <iniparser.h>
|
||||
#include <mortar/mortar_log.h>
|
||||
|
||||
void NX_SetupDefaultConfigOverrides(dictionary* p_dictionary)
|
||||
{
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <SDL3/SDL_log.h>
|
||||
#include <iniparser.h>
|
||||
#include <mortar/mortar_log.h>
|
||||
|
||||
void VITA_SetupDefaultConfigOverrides(dictionary* p_dictionary)
|
||||
{
|
||||
SDL_Log("Overriding default config for VITA");
|
||||
MORTAR_Log("Overriding default config for VITA");
|
||||
|
||||
iniparser_set(p_dictionary, "isle:diskpath", "ux0:data/isledecomp/isle/disk");
|
||||
iniparser_set(p_dictionary, "isle:cdpath", "ux0:data/isledecomp/isle/cd");
|
||||
|
||||
@ -5,7 +5,12 @@
|
||||
#include <psp2/common_dialog.h>
|
||||
#include <psp2/message_dialog.h>
|
||||
|
||||
bool Vita_ShowSimpleMessageBox(SDL_MessageBoxFlags flags, const char* title, const char* message, SDL_Window* window)
|
||||
bool Vita_ShowSimpleMessageBox(
|
||||
MORTAR_MessageBoxFlags flags,
|
||||
const char* title,
|
||||
const char* message,
|
||||
MORTAR_Window* window
|
||||
)
|
||||
{
|
||||
int ret;
|
||||
SceMsgDialogParam param;
|
||||
@ -15,20 +20,20 @@ bool Vita_ShowSimpleMessageBox(SDL_MessageBoxFlags flags, const char* title, con
|
||||
SceCommonDialogErrorCode init_result;
|
||||
bool setup_minimal_gxm = false;
|
||||
|
||||
SDL_zero(param);
|
||||
MORTAR_zero(param);
|
||||
sceMsgDialogParamInit(¶m);
|
||||
param.mode = SCE_MSG_DIALOG_MODE_USER_MSG;
|
||||
|
||||
SDL_zero(msgParam);
|
||||
MORTAR_zero(msgParam);
|
||||
char message_data[0x1000];
|
||||
SDL_snprintf(message_data, sizeof(message_data), "%s\r\n\r\n%s", title, message);
|
||||
MORTAR_snprintf(message_data, sizeof(message_data), "%s\r\n\r\n%s", title, message);
|
||||
|
||||
msgParam.msg = (const SceChar8*) message_data;
|
||||
msgParam.buttonType = SCE_MSG_DIALOG_BUTTON_TYPE_OK;
|
||||
param.userMsgParam = &msgParam;
|
||||
|
||||
if (!gxm) {
|
||||
gxm = (GXMContext*) SDL_malloc(sizeof(GXMContext));
|
||||
gxm = (GXMContext*) MORTAR_malloc(sizeof(GXMContext));
|
||||
}
|
||||
if (ret = gxm->init(SCE_GXM_MULTISAMPLE_NONE); ret < 0) {
|
||||
return false;
|
||||
@ -40,7 +45,7 @@ bool Vita_ShowSimpleMessageBox(SDL_MessageBoxFlags flags, const char* title, con
|
||||
gxm->clear(0, 0, 0, true);
|
||||
gxm->swap_display();
|
||||
}
|
||||
SDL_zero(dialog_result);
|
||||
MORTAR_zero(dialog_result);
|
||||
sceMsgDialogGetResult(&dialog_result);
|
||||
sceMsgDialogTerm();
|
||||
return dialog_result.buttonId == SCE_MSG_DIALOG_BUTTON_ID_OK;
|
||||
|
||||
@ -1,8 +1,13 @@
|
||||
#ifndef VITA_MESSAGE_BOX_H
|
||||
#define VITA_MESSAGE_BOX_H
|
||||
|
||||
#include <SDL3/SDL_messagebox.h>
|
||||
#include <mortar/mortar_messagebox.h>
|
||||
|
||||
bool Vita_ShowSimpleMessageBox(SDL_MessageBoxFlags flags, const char* title, const char* message, SDL_Window* window);
|
||||
bool Vita_ShowSimpleMessageBox(
|
||||
MORTAR_MessageBoxFlags flags,
|
||||
const char* title,
|
||||
const char* message,
|
||||
MORTAR_Window* window
|
||||
);
|
||||
|
||||
#endif // VITA_MESSAGE_BOX_H
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <SDL3/SDL_log.h>
|
||||
#include <iniparser.h>
|
||||
#include <mortar/mortar_log.h>
|
||||
|
||||
void XBONE_SetupDefaultConfigOverrides(dictionary* p_dictionary)
|
||||
{
|
||||
SDL_Log("Overriding default config for Xbox One/Series");
|
||||
MORTAR_Log("Overriding default config for Xbox One/Series");
|
||||
|
||||
// Use DevelopmentFiles path for disk and cd paths
|
||||
// It's good to use that path since user can easily
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
#include "legoworld.h"
|
||||
#include "radio.h"
|
||||
|
||||
#include <SDL3/SDL_keycode.h>
|
||||
#include <mortar/mortar_keycode.h>
|
||||
|
||||
class MxStillPresenter;
|
||||
|
||||
@ -114,7 +114,7 @@ class GasStation : public LegoWorld {
|
||||
inline void StopAction(GarageScript::Script p_objectId);
|
||||
|
||||
MxLong HandleEndAction(MxEndActionNotificationParam& p_param);
|
||||
MxLong HandleKeyPress(SDL_Keycode p_key);
|
||||
MxLong HandleKeyPress(MORTAR_Keycode p_key);
|
||||
MxLong HandleButtonDown(LegoControlManagerNotificationParam& p_param);
|
||||
|
||||
MxS16 m_currentActorId; // 0xf8
|
||||
|
||||
@ -106,7 +106,7 @@ class Hospital : public LegoWorld {
|
||||
// Hospital::`scalar deleting destructor'
|
||||
|
||||
private:
|
||||
MxLong HandleKeyPress(SDL_Keycode p_key);
|
||||
MxLong HandleKeyPress(MORTAR_Keycode p_key);
|
||||
MxLong HandleEndAction(MxEndActionNotificationParam& p_param);
|
||||
MxLong HandleButtonDown(LegoControlManagerNotificationParam& p_param);
|
||||
MxBool HandleControl(LegoControlManagerNotificationParam& p_param);
|
||||
|
||||
@ -151,7 +151,7 @@ class Infocenter : public LegoWorld {
|
||||
private:
|
||||
void InitializeBitmaps();
|
||||
|
||||
MxLong HandleKeyPress(SDL_Keycode p_key);
|
||||
MxLong HandleKeyPress(MORTAR_Keycode p_key);
|
||||
MxU8 HandleMouseMove(MxS32 p_x, MxS32 p_y);
|
||||
MxU8 HandleButtonUp(MxS32 p_x, MxS32 p_y);
|
||||
MxU8 HandleControl(LegoControlManagerNotificationParam& p_param);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
#include "mxstl/stlcompat.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
|
||||
#pragma warning(disable : 4237)
|
||||
|
||||
@ -40,7 +40,7 @@ struct LegoCacheSoundEntry {
|
||||
struct Set100d6b4cComparator {
|
||||
bool operator()(const LegoCacheSoundEntry& p_a, const LegoCacheSoundEntry& p_b) const
|
||||
{
|
||||
return SDL_strcasecmp(p_a.m_name, p_b.m_name) > 0;
|
||||
return MORTAR_strcasecmp(p_a.m_name, p_b.m_name) > 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
#include "legoworld.h"
|
||||
#include "mxgeometry/mxquaternion.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
|
||||
class LegoCarBuildAnimPresenter;
|
||||
class LegoControlManagerNotificationParam;
|
||||
@ -201,7 +201,7 @@ class LegoCarBuild : public LegoWorld {
|
||||
|
||||
MxU8 m_missclickCounter; // 0x109
|
||||
MxU16 m_lastActorScript; // 0x10a
|
||||
Uint64 m_lastActorScriptStartTime; // 0x10c
|
||||
uint64_t m_lastActorScriptStartTime; // 0x10c
|
||||
LegoROI* m_selectedPart; // 0x110
|
||||
BoundingSphere m_targetBoundingSphere; // 0x114
|
||||
MxMatrix m_originalSelectedPartTransform; // 0x12c
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
#include "mxvariable.h"
|
||||
#include "roi/legoroi.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
|
||||
class LegoActor;
|
||||
class LegoExtraActor;
|
||||
@ -17,7 +17,7 @@ class LegoROI;
|
||||
#pragma warning(disable : 4237)
|
||||
|
||||
struct LegoCharacterComparator {
|
||||
MxBool operator()(const char* const& p_a, const char* const& p_b) const { return SDL_strcasecmp(p_a, p_b) < 0; }
|
||||
MxBool operator()(const char* const& p_a, const char* const& p_b) const { return MORTAR_strcasecmp(p_a, p_b) < 0; }
|
||||
};
|
||||
|
||||
// SIZE 0x08
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#include "mxnotificationparam.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
#include <SDL3/SDL_keycode.h>
|
||||
#include <mortar/mortar_keycode.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
class LegoROI;
|
||||
@ -37,7 +37,7 @@ class LegoEventNotificationParam : public MxNotificationParam {
|
||||
MxU8 p_modifier,
|
||||
MxS32 p_x,
|
||||
MxS32 p_y,
|
||||
SDL_Keycode p_key
|
||||
MORTAR_Keycode p_key
|
||||
)
|
||||
: MxNotificationParam(p_type, p_sender), m_modifier(p_modifier), m_x(p_x), m_y(p_y), m_key(p_key), m_roi(NULL)
|
||||
{
|
||||
@ -45,7 +45,7 @@ class LegoEventNotificationParam : public MxNotificationParam {
|
||||
|
||||
LegoROI* GetROI() { return m_roi; }
|
||||
MxU8 GetModifier() { return m_modifier; }
|
||||
SDL_Keycode GetKey() const { return m_key; }
|
||||
MORTAR_Keycode GetKey() const { return m_key; }
|
||||
|
||||
// FUNCTION: LEGO1 0x10012190
|
||||
// FUNCTION: BETA10 0x10024210
|
||||
@ -61,7 +61,7 @@ class LegoEventNotificationParam : public MxNotificationParam {
|
||||
void SetModifier(MxU8 p_modifier) { m_modifier = p_modifier; }
|
||||
|
||||
// FUNCTION: BETA10 0x1007d6b0
|
||||
void SetKey(SDL_Keycode p_key) { m_key = p_key; }
|
||||
void SetKey(MORTAR_Keycode p_key) { m_key = p_key; }
|
||||
|
||||
// FUNCTION: BETA10 0x1007d650
|
||||
void SetX(MxS32 p_x) { m_x = p_x; }
|
||||
@ -73,7 +73,7 @@ class LegoEventNotificationParam : public MxNotificationParam {
|
||||
MxU8 m_modifier; // 0x0c
|
||||
MxS32 m_x; // 0x10
|
||||
MxS32 m_y; // 0x14
|
||||
SDL_Keycode m_key; // 0x18
|
||||
MORTAR_Keycode m_key; // 0x18
|
||||
LegoROI* m_roi; // 0x1c
|
||||
};
|
||||
|
||||
|
||||
@ -8,11 +8,7 @@
|
||||
#include "mxpresenter.h"
|
||||
#include "mxqueue.h"
|
||||
|
||||
#include <SDL3/SDL_haptic.h>
|
||||
#include <SDL3/SDL_joystick.h>
|
||||
#include <SDL3/SDL_keyboard.h>
|
||||
#include <SDL3/SDL_keycode.h>
|
||||
#include <SDL3/SDL_timer.h>
|
||||
#include <mortar/mortar.h>
|
||||
#ifdef MINIWIN
|
||||
#include "miniwin/windows.h"
|
||||
#else
|
||||
@ -103,7 +99,7 @@ class LegoInputManager : public MxPresenter {
|
||||
LegoInputManager();
|
||||
~LegoInputManager() override;
|
||||
|
||||
LEGO1_EXPORT void QueueEvent(NotificationId p_id, MxU8 p_modifier, MxLong p_x, MxLong p_y, SDL_Keycode p_key);
|
||||
LEGO1_EXPORT void QueueEvent(NotificationId p_id, MxU8 p_modifier, MxLong p_x, MxLong p_y, MORTAR_Keycode p_key);
|
||||
void Register(MxCore*);
|
||||
void UnRegister(MxCore*);
|
||||
|
||||
@ -156,23 +152,23 @@ class LegoInputManager : public MxPresenter {
|
||||
void GetKeyboardState();
|
||||
MxResult GetNavigationKeyStates(MxU32& p_keyFlags);
|
||||
MxResult GetNavigationTouchStates(MxU32& p_keyFlags);
|
||||
LEGO1_EXPORT void AddKeyboard(SDL_KeyboardID p_keyboardID);
|
||||
LEGO1_EXPORT void RemoveKeyboard(SDL_KeyboardID p_keyboardID);
|
||||
LEGO1_EXPORT void AddMouse(SDL_MouseID p_mouseID);
|
||||
LEGO1_EXPORT void RemoveMouse(SDL_MouseID p_mouseID);
|
||||
LEGO1_EXPORT void AddJoystick(SDL_JoystickID p_joystickID);
|
||||
LEGO1_EXPORT void RemoveJoystick(SDL_JoystickID p_joystickID);
|
||||
LEGO1_EXPORT MxBool HandleTouchEvent(SDL_Event* p_event, TouchScheme p_touchScheme);
|
||||
LEGO1_EXPORT void AddKeyboard(MORTAR_KeyboardID p_keyboardID);
|
||||
LEGO1_EXPORT void RemoveKeyboard(MORTAR_KeyboardID p_keyboardID);
|
||||
LEGO1_EXPORT void AddMouse(MORTAR_MouseID p_mouseID);
|
||||
LEGO1_EXPORT void RemoveMouse(MORTAR_MouseID p_mouseID);
|
||||
LEGO1_EXPORT void AddJoystick(MORTAR_JoystickID p_joystickID);
|
||||
LEGO1_EXPORT void RemoveJoystick(MORTAR_JoystickID p_joystickID);
|
||||
LEGO1_EXPORT MxBool HandleTouchEvent(MORTAR_Event* p_event, TouchScheme p_touchScheme);
|
||||
LEGO1_EXPORT MxBool
|
||||
HandleRumbleEvent(float p_strength, float p_lowFrequencyRumble, float p_highFrequencyRumble, MxU32 p_milliseconds);
|
||||
LEGO1_EXPORT void UpdateLastInputMethod(SDL_Event* p_event);
|
||||
LEGO1_EXPORT void UpdateLastInputMethod(MORTAR_Event* p_event);
|
||||
const auto& GetLastInputMethod() { return m_lastInputMethod; }
|
||||
|
||||
// clang-format off
|
||||
enum class SDL_KeyboardID_v : SDL_KeyboardID {};
|
||||
enum class SDL_MouseID_v : SDL_MouseID {};
|
||||
enum class SDL_JoystickID_v : SDL_JoystickID {};
|
||||
enum class SDL_TouchID_v : SDL_TouchID {};
|
||||
enum class MORTAR_KeyboardID_v : MORTAR_KeyboardID {};
|
||||
enum class MORTAR_MouseID_v : MORTAR_MouseID {};
|
||||
enum class MORTAR_JoystickID_v : MORTAR_JoystickID {};
|
||||
enum class MORTAR_TouchID_v : MORTAR_TouchID {};
|
||||
// clang-format on
|
||||
|
||||
// SYNTHETIC: LEGO1 0x1005b8d0
|
||||
@ -189,7 +185,7 @@ class LegoInputManager : public MxPresenter {
|
||||
MxS32 m_x; // 0x6c
|
||||
MxS32 m_y; // 0x70
|
||||
MxS32 m_unk0x74; // 0x74
|
||||
SDL_TimerID m_autoDragTimerID; // 0x78
|
||||
MORTAR_TimerID m_autoDragTimerID; // 0x78
|
||||
UINT m_autoDragTime; // 0x7c
|
||||
MxBool m_unk0x80; // 0x80
|
||||
MxBool m_unk0x81; // 0x81
|
||||
@ -202,14 +198,14 @@ class LegoInputManager : public MxPresenter {
|
||||
|
||||
MxBool m_wasd;
|
||||
TouchScheme m_touchScheme = e_none;
|
||||
SDL_Point m_touchVirtualThumb = {0, 0};
|
||||
SDL_FPoint m_touchVirtualThumbOrigin;
|
||||
std::map<SDL_FingerID, MxU32> m_touchFlags;
|
||||
std::map<SDL_KeyboardID, std::pair<void*, void*>> m_keyboards;
|
||||
std::map<SDL_MouseID, std::pair<void*, SDL_Haptic*>> m_mice;
|
||||
std::map<SDL_JoystickID, std::pair<SDL_Gamepad*, SDL_Haptic*>> m_joysticks;
|
||||
std::map<SDL_HapticID, SDL_Haptic*> m_otherHaptics;
|
||||
std::variant<SDL_KeyboardID_v, SDL_MouseID_v, SDL_JoystickID_v, SDL_TouchID_v> m_lastInputMethod;
|
||||
MORTAR_Point m_touchVirtualThumb = {0, 0};
|
||||
MORTAR_FPoint m_touchVirtualThumbOrigin;
|
||||
std::map<MORTAR_FingerID, MxU32> m_touchFlags;
|
||||
std::map<MORTAR_KeyboardID, std::pair<void*, void*>> m_keyboards;
|
||||
std::map<MORTAR_MouseID, std::pair<void*, MORTAR_Haptic*>> m_mice;
|
||||
std::map<MORTAR_JoystickID, std::pair<MORTAR_Gamepad*, MORTAR_Haptic*>> m_joysticks;
|
||||
std::map<MORTAR_HapticID, MORTAR_Haptic*> m_otherHaptics;
|
||||
std::variant<MORTAR_KeyboardID_v, MORTAR_MouseID_v, MORTAR_JoystickID_v, MORTAR_TouchID_v> m_lastInputMethod;
|
||||
};
|
||||
|
||||
// TEMPLATE: LEGO1 0x10028850
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
#include "mxdsaction.h"
|
||||
#include "mxmain.h"
|
||||
|
||||
#include <SDL3/SDL_events.h>
|
||||
#include <SDL3/SDL_timer.h>
|
||||
#include <mortar/mortar_events.h>
|
||||
#include <mortar/mortar_timer.h>
|
||||
|
||||
class Isle;
|
||||
class LegoAnimationManager;
|
||||
@ -196,14 +196,13 @@ class LegoOmni : public MxOmni {
|
||||
|
||||
void CloseMainWindow()
|
||||
{
|
||||
SDL_QuitEvent quit;
|
||||
quit.type = SDL_EVENT_QUIT;
|
||||
quit.timestamp = SDL_GetTicksNS();
|
||||
MORTAR_Event event;
|
||||
MORTAR_zero(event);
|
||||
|
||||
SDL_Event event;
|
||||
event.quit = quit;
|
||||
event.quit.type = MORTAR_EVENT_QUIT;
|
||||
event.quit.timestamp = MORTAR_GetTicksNS();
|
||||
|
||||
SDL_PushEvent(&event);
|
||||
MORTAR_PushEvent(&event);
|
||||
}
|
||||
|
||||
void SetVersion10(MxBool p_version10) { m_version10 = p_version10; }
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#include "lego1_export.h"
|
||||
#include "legoentitypresenter.h"
|
||||
|
||||
#include <SDL3/SDL_iostream.h>
|
||||
#include <mortar/mortar_iostream.h>
|
||||
|
||||
class LegoWorld;
|
||||
struct ModelDbPart;
|
||||
@ -51,8 +51,8 @@ class LegoWorldPresenter : public LegoEntityPresenter {
|
||||
// LegoWorldPresenter::`scalar deleting destructor'
|
||||
|
||||
private:
|
||||
MxResult LoadWorldPart(ModelDbPart& p_part, SDL_IOStream* p_wdbFile);
|
||||
MxResult LoadWorldModel(ModelDbModel& p_model, SDL_IOStream* p_wdbFile, LegoWorld* p_world);
|
||||
MxResult LoadWorldPart(ModelDbPart& p_part, MORTAR_IOStream* p_wdbFile);
|
||||
MxResult LoadWorldModel(ModelDbModel& p_model, MORTAR_IOStream* p_wdbFile, LegoWorld* p_world);
|
||||
|
||||
MxU32 m_nextObjectId;
|
||||
};
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
#include "lego1_export.h"
|
||||
#include "mxcore.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
#ifdef MINIWIN
|
||||
#include "miniwin/ddraw.h"
|
||||
#else
|
||||
@ -86,7 +86,7 @@ class MxTransitionManager : public MxCore {
|
||||
MxU16 m_animationTimer; // 0x34
|
||||
MxU16 m_columnOrder[640]; // 0x36
|
||||
MxU16 m_randomShift[480]; // 0x536
|
||||
Uint64 m_systemTime; // 0x8f8
|
||||
uint64_t m_systemTime; // 0x8f8
|
||||
MxS32 m_animationSpeed; // 0x8fc
|
||||
};
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@ class RegistrationBook : public LegoWorld {
|
||||
MxU32 m_intAlphabetOffset;
|
||||
|
||||
MxLong HandleEndAction(MxEndActionNotificationParam& p_param);
|
||||
MxLong HandleKeyPress(SDL_Keycode p_key);
|
||||
MxLong HandleKeyPress(MORTAR_Keycode p_key);
|
||||
MxLong HandleControl(LegoControlManagerNotificationParam& p_param);
|
||||
MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param);
|
||||
void LoadSave(MxS16 p_checkMarkIndex);
|
||||
|
||||
@ -455,7 +455,7 @@ MxS32 Act2Actor::NextTargetLocation()
|
||||
assert(!m_grec);
|
||||
|
||||
CurrentWorld();
|
||||
MxU16 randomVal = 1 + SDL_rand(2);
|
||||
MxU16 randomVal = 1 + MORTAR_rand(2);
|
||||
|
||||
if (m_visitedLocations == 8 && m_targetLocation != 8) {
|
||||
newLocation = 8;
|
||||
|
||||
@ -413,7 +413,7 @@ MxResult Act3Cop::FUN_10040360()
|
||||
}
|
||||
|
||||
if (grec == NULL) {
|
||||
MxS32 random = SDL_rand(sizeOfArray(g_copDest));
|
||||
MxS32 random = MORTAR_rand(sizeOfArray(g_copDest));
|
||||
Vector3 localf8(g_copDest[random].m_unk0x08);
|
||||
Vector3 local108(g_copDest[random].m_unk0x14);
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
#include "mxvariabletable.h"
|
||||
#include "scripts.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
#include <stdio.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(Ambulance, 0x184)
|
||||
@ -247,14 +247,14 @@ MxLong Ambulance::HandleButtonDown(LegoControlManagerNotificationParam& p_param)
|
||||
if (m_taskState == Ambulance::e_waiting) {
|
||||
LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY());
|
||||
|
||||
if (roi != NULL && !SDL_strcasecmp(roi->GetName(), "ps-gate")) {
|
||||
if (roi != NULL && !MORTAR_strcasecmp(roi->GetName(), "ps-gate")) {
|
||||
m_taskState = Ambulance::e_finished;
|
||||
return 1;
|
||||
}
|
||||
|
||||
roi = PickRootROI(p_param.GetX(), p_param.GetY());
|
||||
|
||||
if (roi != NULL && !SDL_strcasecmp(roi->GetName(), "gd")) {
|
||||
if (roi != NULL && !MORTAR_strcasecmp(roi->GetName(), "gd")) {
|
||||
m_taskState = Ambulance::e_finished;
|
||||
return 1;
|
||||
}
|
||||
@ -477,7 +477,7 @@ void Ambulance::ActivateSceneActions()
|
||||
else if (m_atPoliceTask != 0 && m_atBeachTask != 0) {
|
||||
IsleScript::Script objectId;
|
||||
|
||||
switch (SDL_rand(2)) {
|
||||
switch (MORTAR_rand(2)) {
|
||||
case 0:
|
||||
objectId = IsleScript::c_ham076cl_PlayWav;
|
||||
break;
|
||||
@ -495,7 +495,7 @@ void Ambulance::ActivateSceneActions()
|
||||
else {
|
||||
IsleScript::Script objectId;
|
||||
|
||||
switch (SDL_rand(2)) {
|
||||
switch (MORTAR_rand(2)) {
|
||||
case 0:
|
||||
objectId = IsleScript::c_ham075cl_PlayWav;
|
||||
break;
|
||||
@ -522,7 +522,7 @@ MxResult Ambulance::Tickle()
|
||||
else if (m_lastAction == IsleScript::c_noneIsle) {
|
||||
IsleScript::Script objectId;
|
||||
|
||||
switch (1 + SDL_rand(12)) {
|
||||
switch (1 + MORTAR_rand(12)) {
|
||||
case 1:
|
||||
objectId = IsleScript::c_ham034ra_PlayWav;
|
||||
break;
|
||||
|
||||
@ -6,8 +6,8 @@
|
||||
#include "roi/legoroi.h"
|
||||
#include "tgl/tglvector.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <assert.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(Doors, 0x1f8)
|
||||
|
||||
@ -132,10 +132,11 @@ void Doors::ParseAction(char* p_extra)
|
||||
for (CompoundObject::const_iterator it = comp->begin(); it != comp->end(); it++) {
|
||||
LegoROI* roi = (LegoROI*) *it;
|
||||
|
||||
if (roi && (!SDL_strncasecmp(roi->GetName(), "dor-lt", 6) || !SDL_strncasecmp(roi->GetName(), "dor-sl", 6))) {
|
||||
if (roi &&
|
||||
(!MORTAR_strncasecmp(roi->GetName(), "dor-lt", 6) || !MORTAR_strncasecmp(roi->GetName(), "dor-sl", 6))) {
|
||||
m_ltDoor = roi;
|
||||
}
|
||||
else if (roi && (!SDL_strncasecmp(roi->GetName(), "dor-rt", 6) || !SDL_strncasecmp(roi->GetName(), "dor-sr", 6))) {
|
||||
else if (roi && (!MORTAR_strncasecmp(roi->GetName(), "dor-rt", 6) || !MORTAR_strncasecmp(roi->GetName(), "dor-sr", 6))) {
|
||||
m_rtDoor = roi;
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
#include "mxtransitionmanager.h"
|
||||
#include "mxvariabletable.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
#include <stdio.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(DuneBuggy, 0x16c)
|
||||
@ -167,22 +167,22 @@ MxS32 DuneBuggy::GetColorOffset(const char* p_variable)
|
||||
const char* color = VariableTable()->GetVariable(p_variable);
|
||||
assert(color);
|
||||
|
||||
if (!SDL_strcasecmp(color, "lego green")) {
|
||||
if (!MORTAR_strcasecmp(color, "lego green")) {
|
||||
offset = 1;
|
||||
}
|
||||
else if (!SDL_strcasecmp(color, "lego red")) {
|
||||
else if (!MORTAR_strcasecmp(color, "lego red")) {
|
||||
offset = 2;
|
||||
}
|
||||
else if (!SDL_strcasecmp(color, "lego yellow")) {
|
||||
else if (!MORTAR_strcasecmp(color, "lego yellow")) {
|
||||
offset = 3;
|
||||
}
|
||||
else if (!SDL_strcasecmp(color, "lego black")) {
|
||||
else if (!MORTAR_strcasecmp(color, "lego black")) {
|
||||
offset = 4;
|
||||
}
|
||||
else if (!SDL_strcasecmp(color, "lego blue")) {
|
||||
else if (!MORTAR_strcasecmp(color, "lego blue")) {
|
||||
offset = 5;
|
||||
}
|
||||
else if (!SDL_strcasecmp(color, "lego white")) {
|
||||
else if (!MORTAR_strcasecmp(color, "lego white")) {
|
||||
offset = 6;
|
||||
}
|
||||
|
||||
|
||||
@ -215,16 +215,16 @@ RadioState::RadioState()
|
||||
{
|
||||
srand(Timer()->GetTime());
|
||||
|
||||
m_activePlaylist = SDL_rand(3);
|
||||
m_activePlaylist = MORTAR_rand(3);
|
||||
|
||||
m_playlists[0] = Playlist((MxU32*) g_jingles, sizeOfArray(g_jingles), Playlist::e_loop);
|
||||
m_playlists[0].m_nextIndex = SDL_rand(sizeOfArray(g_jingles));
|
||||
m_playlists[0].m_nextIndex = MORTAR_rand(sizeOfArray(g_jingles));
|
||||
|
||||
m_playlists[1] = Playlist((MxU32*) g_news, sizeOfArray(g_news), Playlist::e_loop);
|
||||
m_playlists[1].m_nextIndex = SDL_rand(sizeOfArray(g_news));
|
||||
m_playlists[1].m_nextIndex = MORTAR_rand(sizeOfArray(g_news));
|
||||
|
||||
m_playlists[2] = Playlist((MxU32*) g_songs, sizeOfArray(g_songs), Playlist::e_loop);
|
||||
m_playlists[2].m_nextIndex = SDL_rand(sizeOfArray(g_songs));
|
||||
m_playlists[2].m_nextIndex = MORTAR_rand(sizeOfArray(g_songs));
|
||||
|
||||
m_active = FALSE;
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ MxLong TowTrack::HandleEndAction(MxEndActionNotificationParam& p_param)
|
||||
m_actorId = LegoActor::c_laura;
|
||||
}
|
||||
|
||||
switch (1 + SDL_rand(m_actorId != 4 ? 4 : 3)) {
|
||||
switch (1 + MORTAR_rand(m_actorId != 4 ? 4 : 3)) {
|
||||
case 1:
|
||||
PlayFinalAnimation(IsleScript::c_wrt074sl_RunAnim);
|
||||
break;
|
||||
@ -354,7 +354,7 @@ MxLong TowTrack::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
objectId = IsleScript::c_wns034na_PlayWav;
|
||||
break;
|
||||
case c_mama:
|
||||
switch (1 + SDL_rand(2)) {
|
||||
switch (1 + MORTAR_rand(2)) {
|
||||
case 1:
|
||||
objectId = IsleScript::c_wns037na_PlayWav;
|
||||
break;
|
||||
@ -364,7 +364,7 @@ MxLong TowTrack::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
}
|
||||
break;
|
||||
case c_papa:
|
||||
switch (1 + SDL_rand(2)) {
|
||||
switch (1 + MORTAR_rand(2)) {
|
||||
case 1:
|
||||
objectId = IsleScript::c_wns041na_PlayWav;
|
||||
break;
|
||||
@ -374,7 +374,7 @@ MxLong TowTrack::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
}
|
||||
break;
|
||||
case c_nick:
|
||||
switch (1 + SDL_rand(2)) {
|
||||
switch (1 + MORTAR_rand(2)) {
|
||||
case 1:
|
||||
objectId = IsleScript::c_wns039na_PlayWav;
|
||||
break;
|
||||
@ -384,7 +384,7 @@ MxLong TowTrack::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
}
|
||||
break;
|
||||
case c_laura:
|
||||
switch (1 + SDL_rand(2)) {
|
||||
switch (1 + MORTAR_rand(2)) {
|
||||
case 1:
|
||||
objectId = IsleScript::c_wns043na_PlayWav;
|
||||
break;
|
||||
|
||||
@ -26,8 +26,8 @@ LegoCacheSound::~LegoCacheSound()
|
||||
// FUNCTION: BETA10 0x10066498
|
||||
void LegoCacheSound::Init()
|
||||
{
|
||||
SDL_zero(m_buffer);
|
||||
SDL_zero(m_cacheSound);
|
||||
MORTAR_zero(m_buffer);
|
||||
MORTAR_zero(m_cacheSound);
|
||||
m_data = NULL;
|
||||
m_unk0x58 = FALSE;
|
||||
memset(&m_wfx, 0, sizeof(m_wfx));
|
||||
|
||||
@ -30,9 +30,9 @@
|
||||
#include "racecar_actions.h"
|
||||
#include "scripts.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_timer.h>
|
||||
#include <isle.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
#include <mortar/mortar_timer.h>
|
||||
#include <stdio.h>
|
||||
#include <vec.h>
|
||||
|
||||
@ -559,7 +559,7 @@ MxResult LegoCarBuild::Tickle()
|
||||
}
|
||||
|
||||
if (m_lastActorScript) {
|
||||
MxULong time = SDL_GetTicks();
|
||||
MxULong time = MORTAR_GetTicks();
|
||||
MxULong dTime = (time - m_lastActorScriptStartTime) / 100;
|
||||
|
||||
if (m_carId == RaceCar_Actor) {
|
||||
@ -1324,30 +1324,30 @@ void LegoCarBuild::ToggleColorControlsEnabled()
|
||||
void LegoCarBuild::EnableDecalForSelectedPart(MxBool p_enabled)
|
||||
{
|
||||
if (m_animPresenter->StringDoesNotEndOnZero(m_selectedPart->GetName()) && m_Decals_Ctl) {
|
||||
if (SDL_strncasecmp(m_selectedPart->GetName(), "JSFRNT", strlen("JSFRNT")) == 0) {
|
||||
if (MORTAR_strncasecmp(m_selectedPart->GetName(), "JSFRNT", strlen("JSFRNT")) == 0) {
|
||||
m_Decal_Bitmap->Enable(p_enabled);
|
||||
m_Decals_Ctl->Enable(p_enabled);
|
||||
m_Decals_Ctl1->Enable(p_enabled);
|
||||
m_Decals_Ctl2->Enable(p_enabled);
|
||||
m_Decals_Ctl3->Enable(p_enabled);
|
||||
}
|
||||
else if (SDL_strncasecmp(m_selectedPart->GetName(), "JSWNSH", strlen("JSWNSH")) == 0) {
|
||||
else if (MORTAR_strncasecmp(m_selectedPart->GetName(), "JSWNSH", strlen("JSWNSH")) == 0) {
|
||||
m_Decal_Bitmap->Enable(p_enabled);
|
||||
m_Decals_Ctl4->Enable(p_enabled);
|
||||
m_Decals_Ctl5->Enable(p_enabled);
|
||||
m_Decals_Ctl6->Enable(p_enabled);
|
||||
m_Decals_Ctl7->Enable(p_enabled);
|
||||
}
|
||||
else if (SDL_strncasecmp(m_selectedPart->GetName(), "RCBACK", strlen("RCBACK")) == 0) {
|
||||
else if (MORTAR_strncasecmp(m_selectedPart->GetName(), "RCBACK", strlen("RCBACK")) == 0) {
|
||||
m_Decals_Ctl1->Enable(p_enabled);
|
||||
}
|
||||
else if (SDL_strncasecmp(m_selectedPart->GetName(), "RCTAIL", strlen("RCTAIL")) == 0) {
|
||||
else if (MORTAR_strncasecmp(m_selectedPart->GetName(), "RCTAIL", strlen("RCTAIL")) == 0) {
|
||||
m_Decals_Ctl2->Enable(p_enabled);
|
||||
}
|
||||
else if (m_Decals_Ctl1 && SDL_strncasecmp(m_selectedPart->GetName(), "chljety", strlen("chljety")) == 0) {
|
||||
else if (m_Decals_Ctl1 && MORTAR_strncasecmp(m_selectedPart->GetName(), "chljety", strlen("chljety")) == 0) {
|
||||
m_Decals_Ctl1->Enable(p_enabled);
|
||||
}
|
||||
else if (m_Decals_Ctl2 && SDL_strncasecmp(m_selectedPart->GetName(), "chrjety", strlen("chrjety")) == 0) {
|
||||
else if (m_Decals_Ctl2 && MORTAR_strncasecmp(m_selectedPart->GetName(), "chrjety", strlen("chrjety")) == 0) {
|
||||
m_Decals_Ctl2->Enable(p_enabled);
|
||||
}
|
||||
else if (m_Decals_Ctl) {
|
||||
@ -1511,7 +1511,7 @@ void LegoCarBuild::StartActorScriptByType(MxS32 p_actionType)
|
||||
case LookupTableActionType::e_introduction1:
|
||||
case LookupTableActionType::e_introduction2:
|
||||
case LookupTableActionType::e_introduction3:
|
||||
switch (SDL_rand(3)) {
|
||||
switch (MORTAR_rand(3)) {
|
||||
case 0:
|
||||
m_lastActorScript = CopterScript::c_ips004d2_RunAnim;
|
||||
StopPlayingActorScript();
|
||||
@ -1610,7 +1610,7 @@ void LegoCarBuild::StartActorScriptByType(MxS32 p_actionType)
|
||||
#endif
|
||||
|
||||
if (m_lastActorScript != 0) {
|
||||
m_lastActorScriptStartTime = SDL_GetTicks();
|
||||
m_lastActorScriptStartTime = MORTAR_GetTicks();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
#include "mxtimer.h"
|
||||
#include "realtime/realtime.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoCarBuildAnimPresenter::CarBuildPart, 0x0c)
|
||||
DECOMP_SIZE_ASSERT(LegoCarBuildAnimPresenter, 0x150)
|
||||
@ -97,7 +97,7 @@ inline void LegoCarBuildAnimPresenter::UpdateFlashingPartVisibility()
|
||||
if (roi) {
|
||||
const LegoChar* name = roi->GetName();
|
||||
|
||||
if (name && SDL_strcasecmp(wiredName, name) == 0) {
|
||||
if (name && MORTAR_strcasecmp(wiredName, name) == 0) {
|
||||
if (showFlashingPart) {
|
||||
roi->SetVisibility(TRUE);
|
||||
}
|
||||
@ -221,7 +221,7 @@ void LegoCarBuildAnimPresenter::StreamingTickle()
|
||||
for (MxS32 j = 0; j <= m_roiMapSize; j++) {
|
||||
LegoROI* roi = m_roiMap[j];
|
||||
|
||||
if (roi && roi->GetName() && (SDL_strcasecmp(name, roi->GetName()) == 0)) {
|
||||
if (roi && roi->GetName() && (MORTAR_strcasecmp(name, roi->GetName()) == 0)) {
|
||||
roi->ClearMeshOffset();
|
||||
roi->SetLodColor("lego red");
|
||||
}
|
||||
@ -243,7 +243,7 @@ void LegoCarBuildAnimPresenter::StreamingTickle()
|
||||
for (i = 0; i < totalNodes; i++) {
|
||||
LegoAnimNodeData* animNodeData = (LegoAnimNodeData*) GetTreeNode(m_anim->GetRoot(), i)->GetData();
|
||||
|
||||
if (SDL_strncasecmp(animNodeData->GetName(), "CAM", strlen("CAM")) == 0) {
|
||||
if (MORTAR_strncasecmp(animNodeData->GetName(), "CAM", strlen("CAM")) == 0) {
|
||||
camera = local60->FindChildROI(animNodeData->GetName(), local60);
|
||||
fov = atof(&animNodeData->GetName()[strlen(animNodeData->GetName()) - 2]);
|
||||
break;
|
||||
@ -330,7 +330,7 @@ void LegoCarBuildAnimPresenter::SwapNodesByName(LegoChar* p_name1, LegoChar* p_n
|
||||
{
|
||||
char buffer[40];
|
||||
|
||||
if (SDL_strcasecmp(p_name1, p_name2) != 0) {
|
||||
if (MORTAR_strcasecmp(p_name1, p_name2) != 0) {
|
||||
LegoAnimNodeData* node1 = FindNodeDataByName(m_anim->GetRoot(), p_name1);
|
||||
LegoAnimNodeData* node2 = FindNodeDataByName(m_anim->GetRoot(), p_name2);
|
||||
|
||||
@ -391,7 +391,7 @@ void LegoCarBuildAnimPresenter::InitBuildPlatform()
|
||||
for (i = 0; i < totalNodes; i++) {
|
||||
name = ((LegoAnimNodeData*) GetTreeNode(m_anim->GetRoot(), i)->GetData())->GetName();
|
||||
|
||||
SDL_strupr(name);
|
||||
MORTAR_strupr(name);
|
||||
|
||||
if (StringEndsOnW(name)) {
|
||||
m_parts[name[strlen(name) - 1] - 'A'].m_wiredName = new LegoChar[strlen(name) + 1];
|
||||
@ -411,7 +411,7 @@ void LegoCarBuildAnimPresenter::InitBuildPlatform()
|
||||
name = ((LegoAnimNodeData*) GetTreeNode(m_anim->GetRoot(), i)->GetData())->GetName();
|
||||
if (StringEndsOnYOrN(name)) {
|
||||
for (MxS16 ii = 0; ii < m_numberOfParts; ii++) {
|
||||
if (SDL_strncasecmp(m_parts[ii].m_wiredName, name, strlen(name) - 2) == 0) {
|
||||
if (MORTAR_strncasecmp(m_parts[ii].m_wiredName, name, strlen(name) - 2) == 0) {
|
||||
m_parts[ii].m_name = new LegoChar[strlen(name) + 1];
|
||||
assert(m_parts[ii].m_name);
|
||||
strcpy(m_parts[ii].m_name, name);
|
||||
@ -492,7 +492,7 @@ LegoAnimNodeData* LegoCarBuildAnimPresenter::FindNodeDataByName(LegoTreeNode* p_
|
||||
if (p_treeNode) {
|
||||
data = (LegoAnimNodeData*) p_treeNode->GetData();
|
||||
|
||||
if (SDL_strcasecmp(data->GetName(), p_name) == 0) {
|
||||
if (MORTAR_strcasecmp(data->GetName(), p_name) == 0) {
|
||||
return data;
|
||||
}
|
||||
|
||||
@ -518,7 +518,7 @@ LegoTreeNode* LegoCarBuildAnimPresenter::FindNodeByName(LegoTreeNode* p_treeNode
|
||||
if (p_treeNode) {
|
||||
data = (LegoAnimNodeData*) p_treeNode->GetData();
|
||||
|
||||
if (SDL_strcasecmp(data->GetName(), p_name) == 0) {
|
||||
if (MORTAR_strcasecmp(data->GetName(), p_name) == 0) {
|
||||
return p_treeNode;
|
||||
}
|
||||
|
||||
@ -541,9 +541,9 @@ void LegoCarBuildAnimPresenter::AddPartToBuildByName(const LegoChar* p_name)
|
||||
MxS16 i;
|
||||
LegoChar buffer[40];
|
||||
|
||||
if (SDL_strcasecmp(m_parts[m_placedPartCount].m_name, p_name) != 0) {
|
||||
if (MORTAR_strcasecmp(m_parts[m_placedPartCount].m_name, p_name) != 0) {
|
||||
for (i = m_placedPartCount + 1; i < m_numberOfParts; i++) {
|
||||
if (SDL_strcasecmp(m_parts[i].m_name, p_name) == 0) {
|
||||
if (MORTAR_strcasecmp(m_parts[i].m_name, p_name) == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -619,7 +619,7 @@ void LegoCarBuildAnimPresenter::MoveShelfForward()
|
||||
// FUNCTION: BETA10 0x100724fa
|
||||
MxBool LegoCarBuildAnimPresenter::StringEqualsPlatform(const LegoChar* p_string)
|
||||
{
|
||||
return SDL_strcasecmp(p_string, "PLATFORM") == 0;
|
||||
return MORTAR_strcasecmp(p_string, "PLATFORM") == 0;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10079b40
|
||||
@ -641,7 +641,7 @@ MxBool LegoCarBuildAnimPresenter::StringEndsOnYOrN(const LegoChar* p_string)
|
||||
// FUNCTION: BETA10 0x10072624
|
||||
MxBool LegoCarBuildAnimPresenter::StringEqualsShelf(const LegoChar* p_string)
|
||||
{
|
||||
return SDL_strncasecmp(p_string, "SHELF", strlen("SHELF")) == 0;
|
||||
return MORTAR_strncasecmp(p_string, "SHELF", strlen("SHELF")) == 0;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10079c30
|
||||
@ -653,7 +653,7 @@ MxBool LegoCarBuildAnimPresenter::IsNextPartToPlace(const LegoChar* p_name)
|
||||
}
|
||||
|
||||
return m_placedPartCount < m_numberOfParts &&
|
||||
SDL_strncasecmp(p_name, m_parts[m_placedPartCount].m_name, strlen(p_name) - 3) == 0;
|
||||
MORTAR_strncasecmp(p_name, m_parts[m_placedPartCount].m_name, strlen(p_name) - 3) == 0;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10079ca0
|
||||
@ -661,7 +661,7 @@ MxBool LegoCarBuildAnimPresenter::IsNextPartToPlace(const LegoChar* p_name)
|
||||
MxBool LegoCarBuildAnimPresenter::PartIsPlaced(const LegoChar* p_name)
|
||||
{
|
||||
for (MxS16 i = 0; i < m_placedPartCount; i++) {
|
||||
if (SDL_strcasecmp(p_name, m_parts[i].m_name) == 0) {
|
||||
if (MORTAR_strcasecmp(p_name, m_parts[i].m_name) == 0) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -688,7 +688,7 @@ MxBool LegoCarBuildAnimPresenter::StringDoesNotEndOnZero(const LegoChar* p_strin
|
||||
const LegoChar* LegoCarBuildAnimPresenter::GetWiredNameByPartName(const LegoChar* p_name)
|
||||
{
|
||||
for (MxS16 i = 0; i < m_numberOfParts; i++) {
|
||||
if (SDL_strcasecmp(p_name, m_parts[i].m_name) == 0) {
|
||||
if (MORTAR_strcasecmp(p_name, m_parts[i].m_name) == 0) {
|
||||
return m_parts[i].m_wiredName;
|
||||
}
|
||||
}
|
||||
@ -701,7 +701,7 @@ const LegoChar* LegoCarBuildAnimPresenter::GetWiredNameByPartName(const LegoChar
|
||||
void LegoCarBuildAnimPresenter::SetPartObjectIdByName(const LegoChar* p_name, MxS16 p_objectId)
|
||||
{
|
||||
for (MxS16 i = 0; i < m_numberOfParts; i++) {
|
||||
if (SDL_strcasecmp(p_name, m_parts[i].m_name) == 0) {
|
||||
if (MORTAR_strcasecmp(p_name, m_parts[i].m_name) == 0) {
|
||||
m_parts[i].m_objectId = p_objectId;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@
|
||||
#include "realtime/realtime.h"
|
||||
#include "viewmanager/viewmanager.h"
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <mortar/mortar.h>
|
||||
#include <stdio.h>
|
||||
#include <vec.h>
|
||||
|
||||
@ -641,9 +641,9 @@ MxResult LegoAnimationManager::LoadWorldInfo(LegoOmni::World p_worldId)
|
||||
strcat(path, filename);
|
||||
MxString::MapPathToFilesystem(path);
|
||||
|
||||
SDL_PathInfo pathInfo;
|
||||
MORTAR_PathInfo pathInfo;
|
||||
|
||||
if (!SDL_GetPathInfo(path, &pathInfo) || pathInfo.type != SDL_PATHTYPE_FILE) {
|
||||
if (!MORTAR_GetPathInfo(path, &pathInfo) || pathInfo.type != MORTAR_PATHTYPE_FILE) {
|
||||
sprintf(path, "%s", MxOmni::GetCD());
|
||||
|
||||
if (path[strlen(path) - 1] != '\\') {
|
||||
@ -653,7 +653,7 @@ MxResult LegoAnimationManager::LoadWorldInfo(LegoOmni::World p_worldId)
|
||||
strcat(path, filename);
|
||||
MxString::MapPathToFilesystem(path);
|
||||
|
||||
if (!SDL_GetPathInfo(path, &pathInfo) || pathInfo.type != SDL_PATHTYPE_FILE) {
|
||||
if (!MORTAR_GetPathInfo(path, &pathInfo) || pathInfo.type != MORTAR_PATHTYPE_FILE) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
@ -750,7 +750,7 @@ MxResult LegoAnimationManager::LoadWorldInfo(LegoOmni::World p_worldId)
|
||||
MxBool LegoAnimationManager::FindVehicle(const char* p_name, MxU32& p_index)
|
||||
{
|
||||
for (MxS32 i = 0; i < sizeOfArray(g_vehicles); i++) {
|
||||
if (!SDL_strcasecmp(p_name, g_vehicles[i].m_name)) {
|
||||
if (!MORTAR_strcasecmp(p_name, g_vehicles[i].m_name)) {
|
||||
p_index = i;
|
||||
return TRUE;
|
||||
}
|
||||
@ -891,7 +891,7 @@ void LegoAnimationManager::FUN_10060480(const LegoChar* p_characterNames[], MxU3
|
||||
{
|
||||
for (MxS32 i = 0; i < p_numCharacterNames; i++) {
|
||||
for (MxS32 j = 0; j < sizeOfArray(g_characters); j++) {
|
||||
if (!SDL_strcasecmp(g_characters[j].m_name, p_characterNames[i])) {
|
||||
if (!MORTAR_strcasecmp(g_characters[j].m_name, p_characterNames[i])) {
|
||||
g_characters[j].m_unk0x08 = TRUE;
|
||||
}
|
||||
}
|
||||
@ -1200,7 +1200,7 @@ void LegoAnimationManager::CameraTriggerFire(LegoPathActor* p_actor, MxBool, MxU
|
||||
return;
|
||||
}
|
||||
|
||||
if (location->m_unk0x5c && location->m_frequency < SDL_rand(100)) {
|
||||
if (location->m_unk0x5c && location->m_frequency < MORTAR_rand(100)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1595,7 +1595,7 @@ MxResult LegoAnimationManager::Tickle()
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
m_unk0x410 = SDL_rand(10000) + 5000;
|
||||
m_unk0x410 = MORTAR_rand(10000) + 5000;
|
||||
m_unk0x408 = time;
|
||||
|
||||
if (time - m_unk0x404 > 10000) {
|
||||
@ -1702,7 +1702,7 @@ MxS8 LegoAnimationManager::GetCharacterIndex(const char* p_name)
|
||||
MxS8 i;
|
||||
|
||||
for (i = 0; i < sizeOfArray(g_characters); i++) {
|
||||
if (!SDL_strncasecmp(p_name, g_characters[i].m_name, 2)) {
|
||||
if (!MORTAR_strncasecmp(p_name, g_characters[i].m_name, 2)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@ -1753,7 +1753,7 @@ MxBool LegoAnimationManager::ModelExists(AnimInfo& p_info, const char* p_name)
|
||||
|
||||
if (models != NULL && modelCount) {
|
||||
for (MxU8 i = 0; i < modelCount; i++) {
|
||||
if (!SDL_strcasecmp(models[i].m_name, p_name)) {
|
||||
if (!MORTAR_strcasecmp(models[i].m_name, p_name)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -1933,7 +1933,7 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und)
|
||||
}
|
||||
|
||||
if (i != m_numAllowedExtras) {
|
||||
MxU8 und = SDL_rand(2) != 0 ? 1 : 2;
|
||||
MxU8 und = MORTAR_rand(2) != 0 ? 1 : 2;
|
||||
MxBool bool1, bool2;
|
||||
|
||||
switch (g_unk0x100f7504 % 4) {
|
||||
@ -1990,7 +1990,7 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und)
|
||||
active = TRUE;
|
||||
}
|
||||
else {
|
||||
active = SDL_rand(100) < 50;
|
||||
active = MORTAR_rand(100) < 50;
|
||||
}
|
||||
|
||||
tryNextCharacter:
|
||||
@ -2035,7 +2035,7 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und)
|
||||
MxS32 vehicleId = g_characters[m_lastExtraCharacterId].m_vehicleId;
|
||||
if (vehicleId >= 0) {
|
||||
g_vehicles[vehicleId].m_unk0x04 =
|
||||
SDL_rand(100) < g_characters[m_lastExtraCharacterId].m_unk0x15;
|
||||
MORTAR_rand(100) < g_characters[m_lastExtraCharacterId].m_unk0x15;
|
||||
}
|
||||
|
||||
if (FUN_10063b90(
|
||||
@ -2053,10 +2053,10 @@ void LegoAnimationManager::AddExtra(MxS32 p_location, MxBool p_und)
|
||||
|
||||
float speed;
|
||||
if (m_extras[i].m_unk0x14) {
|
||||
speed = 0.9f + 1.5f * SDL_randf();
|
||||
speed = 0.9f + 1.5f * MORTAR_randf();
|
||||
}
|
||||
else {
|
||||
speed = 0.6f + 1.4f * SDL_randf();
|
||||
speed = 0.6f + 1.4f * MORTAR_randf();
|
||||
}
|
||||
|
||||
actor->SetWorldSpeed(speed);
|
||||
@ -2116,7 +2116,7 @@ MxBool LegoAnimationManager::FUN_10062e20(LegoROI* p_roi, LegoAnimPresenter* p_p
|
||||
MxS32 i;
|
||||
|
||||
for (i = 0; i < (MxS32) sizeOfArray(g_characters); i++) {
|
||||
if (!SDL_strcasecmp(name, g_characters[i].m_name)) {
|
||||
if (!MORTAR_strcasecmp(name, g_characters[i].m_name)) {
|
||||
characterId = i;
|
||||
break;
|
||||
}
|
||||
@ -2192,7 +2192,7 @@ MxBool LegoAnimationManager::FUN_10062e20(LegoROI* p_roi, LegoAnimPresenter* p_p
|
||||
if (!local24) {
|
||||
MxU8 unk0x0c;
|
||||
|
||||
switch (SDL_rand(3)) {
|
||||
switch (MORTAR_rand(3)) {
|
||||
case 0:
|
||||
unk0x0c = 1;
|
||||
break;
|
||||
@ -2459,10 +2459,10 @@ void LegoAnimationManager::FUN_10063d10()
|
||||
|
||||
if (speed < 0.0f) {
|
||||
if (m_extras[i].m_unk0x14) {
|
||||
speed = 0.9f + 1.5f * SDL_randf();
|
||||
speed = 0.9f + 1.5f * MORTAR_randf();
|
||||
}
|
||||
else {
|
||||
speed = 0.6f + 1.4f * SDL_randf();
|
||||
speed = 0.6f + 1.4f * MORTAR_randf();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2546,7 +2546,7 @@ MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary* p_boundary, LegoOrie
|
||||
MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, MxBool p_bool1, MxBool p_bool2)
|
||||
{
|
||||
MxU32 local2c = 12;
|
||||
float destScale = 0.25f + 0.5f * SDL_randf();
|
||||
float destScale = 0.25f + 0.5f * MORTAR_randf();
|
||||
LegoPathActor* actor = UserActor();
|
||||
|
||||
if (actor == NULL) {
|
||||
@ -2665,7 +2665,7 @@ MxResult LegoAnimationManager::FUN_10064380(
|
||||
extraIndex = i;
|
||||
}
|
||||
|
||||
if (roi != NULL && !SDL_strcasecmp(roi->GetName(), p_name)) {
|
||||
if (roi != NULL && !MORTAR_strcasecmp(roi->GetName(), p_name)) {
|
||||
actor = CharacterManager()->GetExtraActor(p_name);
|
||||
|
||||
if (actor != NULL && actor->GetController() != NULL) {
|
||||
@ -2683,7 +2683,7 @@ MxResult LegoAnimationManager::FUN_10064380(
|
||||
|
||||
MxS32 characterId;
|
||||
for (characterId = 0; characterId < (MxS32) sizeOfArray(g_characters); characterId++) {
|
||||
if (!SDL_strcasecmp(g_characters[characterId].m_name, p_name)) {
|
||||
if (!MORTAR_strcasecmp(g_characters[characterId].m_name, p_name)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -2701,7 +2701,7 @@ MxResult LegoAnimationManager::FUN_10064380(
|
||||
}
|
||||
|
||||
if (actor != NULL) {
|
||||
MxU8 unk0x0c = SDL_rand(2) != 0 ? 1 : 2;
|
||||
MxU8 unk0x0c = MORTAR_rand(2) != 0 ? 1 : 2;
|
||||
actor->SetUnknown0x0c(unk0x0c);
|
||||
actor->SetWorldSpeed(0.0f);
|
||||
|
||||
@ -2757,7 +2757,19 @@ MxResult LegoAnimationManager::FUN_10064670(Vector3* p_position)
|
||||
}
|
||||
|
||||
if (success) {
|
||||
return FUN_10064380("brickstr", "EDG02_95", 1, 0.5f, 3, 0.5f, SDL_rand(3) + 14, -1, SDL_rand(3), -1, 0.5f);
|
||||
return FUN_10064380(
|
||||
"brickstr",
|
||||
"EDG02_95",
|
||||
1,
|
||||
0.5f,
|
||||
3,
|
||||
0.5f,
|
||||
MORTAR_rand(3) + 14,
|
||||
-1,
|
||||
MORTAR_rand(3),
|
||||
-1,
|
||||
0.5f
|
||||
);
|
||||
}
|
||||
|
||||
return FAILURE;
|
||||
@ -2782,11 +2794,11 @@ MxResult LegoAnimationManager::FUN_10064740(Vector3* p_position)
|
||||
|
||||
if (success) {
|
||||
if (GameState()->GetActorId() != LegoActor::c_mama) {
|
||||
FUN_10064380("mama", "USR00_47", 1, 0.43f, 3, 0.84f, SDL_rand(3) + 13, -1, SDL_rand(3), -1, 0.7f);
|
||||
FUN_10064380("mama", "USR00_47", 1, 0.43f, 3, 0.84f, MORTAR_rand(3) + 13, -1, MORTAR_rand(3), -1, 0.7f);
|
||||
}
|
||||
|
||||
if (GameState()->GetActorId() != LegoActor::c_papa) {
|
||||
FUN_10064380("papa", "USR00_193", 3, 0.55f, 1, 0.4f, SDL_rand(3) + 13, -1, SDL_rand(3), -1, 0.9f);
|
||||
FUN_10064380("papa", "USR00_193", 3, 0.55f, 1, 0.4f, MORTAR_rand(3) + 13, -1, MORTAR_rand(3), -1, 0.9f);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
@ -2803,7 +2815,7 @@ MxResult LegoAnimationManager::FUN_10064880(const char* p_name, MxS32 p_unk0x0c,
|
||||
LegoROI* roi = m_extras[i].m_roi;
|
||||
|
||||
if (roi != NULL) {
|
||||
if (!SDL_strcasecmp(roi->GetName(), p_name)) {
|
||||
if (!MORTAR_strcasecmp(roi->GetName(), p_name)) {
|
||||
g_characters[m_extras[i].m_characterId].m_unk0x0c = p_unk0x0c;
|
||||
g_characters[m_extras[i].m_characterId].m_unk0x10 = p_unk0x10;
|
||||
return SUCCESS;
|
||||
|
||||
@ -17,8 +17,8 @@
|
||||
#include "roi/legolod.h"
|
||||
#include "viewmanager/viewmanager.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <assert.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
#include <stdio.h>
|
||||
#include <vec.h>
|
||||
|
||||
@ -475,7 +475,7 @@ LegoROI* LegoCharacterManager::CreateActorROI(const char* p_key)
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!SDL_strcasecmp(p_key, "pep")) {
|
||||
if (!MORTAR_strcasecmp(p_key, "pep")) {
|
||||
LegoActorInfo* pepper = GetActorInfo("pepper");
|
||||
|
||||
info->m_sound = pepper->m_sound;
|
||||
@ -660,7 +660,7 @@ MxBool LegoCharacterManager::SetHeadTexture(LegoROI* p_roi, LegoTextureInfo* p_t
|
||||
MxBool LegoCharacterManager::IsActor(const char* p_name)
|
||||
{
|
||||
for (MxU32 i = 0; i < sizeOfArray(g_actorInfo); i++) {
|
||||
if (!SDL_strcasecmp(g_actorInfo[i].m_name, p_name)) {
|
||||
if (!MORTAR_strcasecmp(g_actorInfo[i].m_name, p_name)) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -687,7 +687,7 @@ LegoActorInfo* LegoCharacterManager::GetActorInfo(const char* p_name)
|
||||
MxU32 i;
|
||||
|
||||
for (i = 0; i < sizeOfArray(g_actorInfo); i++) {
|
||||
if (!SDL_strcasecmp(g_actorInfo[i].m_name, p_name)) {
|
||||
if (!MORTAR_strcasecmp(g_actorInfo[i].m_name, p_name)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -735,7 +735,7 @@ LegoROI* LegoCharacterManager::FindChildROI(LegoROI* p_roi, const char* p_name)
|
||||
for (it = comp->begin(); it != comp->end(); it++) {
|
||||
LegoROI* roi = (LegoROI*) *it;
|
||||
|
||||
if (!SDL_strcasecmp(p_name, roi->GetName())) {
|
||||
if (!MORTAR_strcasecmp(p_name, roi->GetName())) {
|
||||
return roi;
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,9 +59,9 @@
|
||||
#include "sndanim_actions.h"
|
||||
#include "towtrack.h"
|
||||
|
||||
#include <SDL3/SDL_filesystem.h>
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <assert.h>
|
||||
#include <mortar/mortar_filesystem.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
#include <stdio.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoGameState::Username, 0x0e)
|
||||
@ -619,7 +619,7 @@ MxResult LegoGameState::AddPlayer(Username& p_player)
|
||||
|
||||
if (m_playerCount == 9) {
|
||||
GetFileSavePath(&from, 8);
|
||||
SDL_RemovePath(from.GetData());
|
||||
MORTAR_RemovePath(from.GetData());
|
||||
m_playerCount--;
|
||||
}
|
||||
|
||||
@ -627,7 +627,7 @@ MxResult LegoGameState::AddPlayer(Username& p_player)
|
||||
m_players[i] = m_players[i - 1];
|
||||
GetFileSavePath(&from, i - 1);
|
||||
GetFileSavePath(&to, i);
|
||||
SDL_RenamePath(from.GetData(), to.GetData());
|
||||
MORTAR_RenamePath(from.GetData(), to.GetData());
|
||||
}
|
||||
|
||||
m_playerCount++;
|
||||
@ -652,18 +652,18 @@ void LegoGameState::SwitchPlayer(MxS16 p_playerId)
|
||||
|
||||
Username selectedName(m_players[p_playerId]);
|
||||
|
||||
SDL_RenamePath(from.GetData(), temp.GetData());
|
||||
MORTAR_RenamePath(from.GetData(), temp.GetData());
|
||||
|
||||
for (MxS16 i = p_playerId; i > 0; i--) {
|
||||
m_players[i] = m_players[i - 1];
|
||||
GetFileSavePath(&from, i - 1);
|
||||
GetFileSavePath(&to, i);
|
||||
SDL_RenamePath(from.GetData(), to.GetData());
|
||||
MORTAR_RenamePath(from.GetData(), to.GetData());
|
||||
}
|
||||
|
||||
m_players[0] = selectedName;
|
||||
GetFileSavePath(&from, 0);
|
||||
SDL_RenamePath(temp.GetData(), from.GetData());
|
||||
MORTAR_RenamePath(temp.GetData(), from.GetData());
|
||||
}
|
||||
|
||||
if (Load(0) != SUCCESS) {
|
||||
@ -1086,8 +1086,8 @@ void LegoGameState::SetROIColorOverride()
|
||||
MxBool ROIColorOverride(const char* p_input, char* p_output, MxU32 p_copyLen)
|
||||
{
|
||||
if (p_output != NULL && p_copyLen != 0 &&
|
||||
(SDL_strncasecmp(p_input, "INDIR-F-", strlen("INDIR-F-")) == 0 ||
|
||||
SDL_strncasecmp(p_input, "INDIR-G-", strlen("INDIR-F-")) == 0)) {
|
||||
(MORTAR_strncasecmp(p_input, "INDIR-F-", strlen("INDIR-F-")) == 0 ||
|
||||
MORTAR_strncasecmp(p_input, "INDIR-G-", strlen("INDIR-F-")) == 0)) {
|
||||
|
||||
char buf[256];
|
||||
sprintf(buf, "c_%s", &p_input[strlen("INDIR-F-")]);
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#include "legostate.h"
|
||||
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoState, 0x08)
|
||||
@ -30,7 +31,7 @@ MxU32 LegoState::Playlist::Next()
|
||||
break;
|
||||
|
||||
case e_random:
|
||||
m_nextIndex = SDL_rand(m_length);
|
||||
m_nextIndex = MORTAR_rand(m_length);
|
||||
objectId = m_objectIds[m_nextIndex];
|
||||
break;
|
||||
|
||||
|
||||
@ -31,9 +31,9 @@
|
||||
#include "realtime/realtime.h"
|
||||
#include "scripts.h"
|
||||
|
||||
#include <SDL3/SDL_events.h>
|
||||
#include <SDL3/SDL_process.h>
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_events.h>
|
||||
#include <mortar/mortar_process.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <vec.h>
|
||||
@ -195,11 +195,11 @@ void CalculateViewFromAnimation(LegoAnimPresenter* p_presenter)
|
||||
|
||||
LegoAnimNodeData* data = (LegoAnimNodeData*) GetTreeNode(rootNode, i)->GetData();
|
||||
|
||||
if (!SDL_strncasecmp(data->GetName(), "CAM", strlen("CAM"))) {
|
||||
if (!MORTAR_strncasecmp(data->GetName(), "CAM", strlen("CAM"))) {
|
||||
camData = data;
|
||||
fov = atof(&data->GetName()[strlen(data->GetName()) - 2]);
|
||||
}
|
||||
else if (!SDL_strcasecmp(data->GetName(), "TARGET")) {
|
||||
else if (!MORTAR_strcasecmp(data->GetName(), "TARGET")) {
|
||||
targetData = data;
|
||||
}
|
||||
}
|
||||
@ -235,34 +235,34 @@ Extra::ActionType MatchActionString(const char* p_str)
|
||||
{
|
||||
Extra::ActionType result = Extra::ActionType::e_unknown;
|
||||
|
||||
if (!SDL_strcasecmp("openram", p_str)) {
|
||||
if (!MORTAR_strcasecmp("openram", p_str)) {
|
||||
result = Extra::ActionType::e_openram;
|
||||
}
|
||||
else if (!SDL_strcasecmp("opendisk", p_str)) {
|
||||
else if (!MORTAR_strcasecmp("opendisk", p_str)) {
|
||||
result = Extra::ActionType::e_opendisk;
|
||||
}
|
||||
else if (!SDL_strcasecmp("close", p_str)) {
|
||||
else if (!MORTAR_strcasecmp("close", p_str)) {
|
||||
result = Extra::ActionType::e_close;
|
||||
}
|
||||
else if (!SDL_strcasecmp("start", p_str)) {
|
||||
else if (!MORTAR_strcasecmp("start", p_str)) {
|
||||
result = Extra::ActionType::e_start;
|
||||
}
|
||||
else if (!SDL_strcasecmp("stop", p_str)) {
|
||||
else if (!MORTAR_strcasecmp("stop", p_str)) {
|
||||
result = Extra::ActionType::e_stop;
|
||||
}
|
||||
else if (!SDL_strcasecmp("run", p_str)) {
|
||||
else if (!MORTAR_strcasecmp("run", p_str)) {
|
||||
result = Extra::ActionType::e_run;
|
||||
}
|
||||
else if (!SDL_strcasecmp("exit", p_str)) {
|
||||
else if (!MORTAR_strcasecmp("exit", p_str)) {
|
||||
result = Extra::ActionType::e_exit;
|
||||
}
|
||||
else if (!SDL_strcasecmp("enable", p_str)) {
|
||||
else if (!MORTAR_strcasecmp("enable", p_str)) {
|
||||
result = Extra::ActionType::e_enable;
|
||||
}
|
||||
else if (!SDL_strcasecmp("disable", p_str)) {
|
||||
else if (!MORTAR_strcasecmp("disable", p_str)) {
|
||||
result = Extra::ActionType::e_disable;
|
||||
}
|
||||
else if (!SDL_strcasecmp("notify", p_str)) {
|
||||
else if (!MORTAR_strcasecmp("notify", p_str)) {
|
||||
result = Extra::ActionType::e_notify;
|
||||
}
|
||||
|
||||
@ -323,7 +323,7 @@ void InvokeAction(Extra::ActionType p_actionId, const MxAtomId& p_pAtom, MxS32 p
|
||||
break;
|
||||
case Extra::ActionType::e_run: {
|
||||
const char* args[] = {"/lego/sources/main/main.exe", "/script", p_pAtom.GetInternal(), NULL};
|
||||
SDL_Process* process = SDL_CreateProcess(args, false);
|
||||
MORTAR_Process* process = MORTAR_CreateProcess(args, false);
|
||||
} break;
|
||||
case Extra::ActionType::e_enable:
|
||||
assert(p_streamId != DS_NOT_A_STREAM);
|
||||
@ -589,11 +589,11 @@ void EnableAnimations(MxBool p_enable)
|
||||
// FUNCTION: LEGO1 0x1003ef40
|
||||
void SetAppCursor(Cursor p_cursor)
|
||||
{
|
||||
SDL_Event event;
|
||||
MORTAR_Event event;
|
||||
event.user.type = g_legoSdlEvents.m_windowsMessage;
|
||||
event.user.code = WM_ISLE_SETCURSOR;
|
||||
event.user.data1 = (void*) p_cursor;
|
||||
SDL_PushEvent(&event);
|
||||
MORTAR_PushEvent(&event);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1003ef60
|
||||
@ -762,7 +762,7 @@ void WriteDefaultTexture(LegoStorage* p_storage, const char* p_name)
|
||||
paletteEntries[i].SetBlue(entries[i].peBlue);
|
||||
}
|
||||
|
||||
image->SetPalette(SDL_CreatePalette(i));
|
||||
image->SetPalette(MORTAR_CreatePalette(i));
|
||||
|
||||
if (i > 0) {
|
||||
for (MxS32 j = 0; j < i; j++) {
|
||||
@ -806,8 +806,8 @@ void LoadFromNamedTexture(LegoNamedTexture* p_namedTexture)
|
||||
|
||||
void EmitGameEvent(GameEvent p_event)
|
||||
{
|
||||
SDL_Event event;
|
||||
MORTAR_Event event;
|
||||
event.user.type = g_legoSdlEvents.m_gameEvent;
|
||||
event.user.code = p_event;
|
||||
SDL_PushEvent(&event);
|
||||
MORTAR_PushEvent(&event);
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
#include "mxdebug.h"
|
||||
#include "roi/legoroi.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(VisibilityVariable, 0x24)
|
||||
DECOMP_SIZE_ASSERT(CameraLocationVariable, 0x24)
|
||||
@ -119,10 +119,10 @@ void VisibilityVariable::SetValue(const char* p_value)
|
||||
char* name = strtok(NULL, g_delimiter2);
|
||||
MxBool show;
|
||||
|
||||
if (!SDL_strcasecmp(instruction, g_varHIDE)) {
|
||||
if (!MORTAR_strcasecmp(instruction, g_varHIDE)) {
|
||||
show = FALSE;
|
||||
}
|
||||
else if (!SDL_strcasecmp(instruction, g_varSHOW)) {
|
||||
else if (!MORTAR_strcasecmp(instruction, g_varSHOW)) {
|
||||
show = TRUE;
|
||||
}
|
||||
else {
|
||||
@ -168,19 +168,19 @@ void WhoAmIVariable::SetValue(const char* p_value)
|
||||
{
|
||||
MxVariable::SetValue(p_value);
|
||||
|
||||
if (!SDL_strcasecmp(p_value, g_papa)) {
|
||||
if (!MORTAR_strcasecmp(p_value, g_papa)) {
|
||||
GameState()->SetActorId(LegoActor::c_papa);
|
||||
}
|
||||
else if (!SDL_strcasecmp(p_value, g_mama)) {
|
||||
else if (!MORTAR_strcasecmp(p_value, g_mama)) {
|
||||
GameState()->SetActorId(LegoActor::c_mama);
|
||||
}
|
||||
else if (!SDL_strcasecmp(p_value, g_pepper)) {
|
||||
else if (!MORTAR_strcasecmp(p_value, g_pepper)) {
|
||||
GameState()->SetActorId(LegoActor::c_pepper);
|
||||
}
|
||||
else if (!SDL_strcasecmp(p_value, g_nick)) {
|
||||
else if (!MORTAR_strcasecmp(p_value, g_nick)) {
|
||||
GameState()->SetActorId(LegoActor::c_nick);
|
||||
}
|
||||
else if (!SDL_strcasecmp(p_value, g_laura)) {
|
||||
else if (!MORTAR_strcasecmp(p_value, g_laura)) {
|
||||
GameState()->SetActorId(LegoActor::c_laura);
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,9 +9,9 @@
|
||||
#include "mxtimer.h"
|
||||
#include "mxutilities.h"
|
||||
|
||||
#include <SDL3/SDL_log.h>
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <assert.h>
|
||||
#include <cassert>
|
||||
#include <mortar/mortar_log.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxControlPresenter, 0x5c)
|
||||
|
||||
@ -226,10 +226,10 @@ void MxControlPresenter::ParseExtra()
|
||||
if (KeyValueStringParse(output, g_strSTYLE, extraCopy)) {
|
||||
char* token = strtok(output, g_parseExtraTokens);
|
||||
|
||||
if (!SDL_strcasecmp(token, g_strTOGGLE)) {
|
||||
if (!MORTAR_strcasecmp(token, g_strTOGGLE)) {
|
||||
m_style = e_toggle;
|
||||
}
|
||||
else if (!SDL_strcasecmp(token, g_strGRID)) {
|
||||
else if (!MORTAR_strcasecmp(token, g_strGRID)) {
|
||||
m_style = e_grid;
|
||||
token = strtok(NULL, g_parseExtraTokens);
|
||||
assert(token);
|
||||
@ -239,7 +239,7 @@ void MxControlPresenter::ParseExtra()
|
||||
assert(token);
|
||||
m_rowsOrColumns = atoi(token);
|
||||
}
|
||||
else if (!SDL_strcasecmp(token, g_strMAP)) {
|
||||
else if (!MORTAR_strcasecmp(token, g_strMAP)) {
|
||||
m_style = e_map;
|
||||
token = strtok(NULL, g_parseExtraTokens);
|
||||
|
||||
@ -262,7 +262,7 @@ void MxControlPresenter::ParseExtra()
|
||||
}
|
||||
|
||||
if (KeyValueStringParse(output, g_strVISIBILITY, extraCopy)) {
|
||||
if (!SDL_strcasecmp(output, "FALSE")) {
|
||||
if (!MORTAR_strcasecmp(output, "FALSE")) {
|
||||
Enable(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
#include "mxticklemanager.h"
|
||||
#include "mxvideopresenter.h"
|
||||
|
||||
#include <SDL3/SDL_timer.h>
|
||||
#include <mortar/mortar_timer.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxTransitionManager, 0x900)
|
||||
|
||||
@ -59,12 +59,12 @@ MxResult MxTransitionManager::GetDDrawSurfaceFromVideoManager() // vtable+0x14
|
||||
// FUNCTION: LEGO1 0x1004bac0
|
||||
MxResult MxTransitionManager::Tickle()
|
||||
{
|
||||
Uint64 time = m_animationSpeed + m_systemTime;
|
||||
if (time > SDL_GetTicks()) {
|
||||
uint64_t time = m_animationSpeed + m_systemTime;
|
||||
if (time > MORTAR_GetTicks()) {
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
m_systemTime = SDL_GetTicks();
|
||||
m_systemTime = MORTAR_GetTicks();
|
||||
|
||||
switch (m_mode) {
|
||||
case e_noAnimation:
|
||||
@ -120,7 +120,7 @@ MxResult MxTransitionManager::StartTransition(
|
||||
action->SetFlags(action->GetFlags() | MxDSAction::c_bit10);
|
||||
}
|
||||
|
||||
Uint64 time = SDL_GetTicks();
|
||||
uint64_t time = MORTAR_GetTicks();
|
||||
m_systemTime = time;
|
||||
|
||||
m_animationSpeed = p_speed;
|
||||
@ -190,7 +190,7 @@ void MxTransitionManager::DissolveTransition()
|
||||
|
||||
// ...then shuffle the list (to ensure that we hit each column once)
|
||||
for (i = 0; i < 640; i++) {
|
||||
MxS32 swap = SDL_rand(640);
|
||||
MxS32 swap = MORTAR_rand(640);
|
||||
MxU16 t = m_columnOrder[i];
|
||||
m_columnOrder[i] = m_columnOrder[swap];
|
||||
m_columnOrder[swap] = t;
|
||||
@ -198,7 +198,7 @@ void MxTransitionManager::DissolveTransition()
|
||||
|
||||
// For each scanline, pick a random X offset
|
||||
for (i = 0; i < 480; i++) {
|
||||
m_randomShift[i] = SDL_rand(640);
|
||||
m_randomShift[i] = MORTAR_rand(640);
|
||||
}
|
||||
}
|
||||
|
||||
@ -286,7 +286,7 @@ void MxTransitionManager::MosaicTransition()
|
||||
}
|
||||
|
||||
for (i = 0; i < 64; i++) {
|
||||
MxS32 swap = SDL_rand(64);
|
||||
MxS32 swap = MORTAR_rand(64);
|
||||
MxU16 t = m_columnOrder[i];
|
||||
m_columnOrder[i] = m_columnOrder[swap];
|
||||
m_columnOrder[swap] = t;
|
||||
@ -294,7 +294,7 @@ void MxTransitionManager::MosaicTransition()
|
||||
|
||||
// The same is true here. We only need 48 rows.
|
||||
for (i = 0; i < 48; i++) {
|
||||
m_randomShift[i] = SDL_rand(64);
|
||||
m_randomShift[i] = MORTAR_rand(64);
|
||||
}
|
||||
|
||||
DDSURFACEDESC srcDesc = {};
|
||||
|
||||
@ -8,8 +8,8 @@
|
||||
#include "mxutilities.h"
|
||||
#include "mxvariabletable.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <assert.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoMeterPresenter, 0x94)
|
||||
|
||||
@ -48,16 +48,16 @@ void LegoMeterPresenter::ParseExtra()
|
||||
|
||||
char output[256];
|
||||
if (KeyValueStringParse(output, g_strTYPE, extraCopy)) {
|
||||
if (!SDL_strcasecmp(output, g_strLEFT_TO_RIGHT)) {
|
||||
if (!MORTAR_strcasecmp(output, g_strLEFT_TO_RIGHT)) {
|
||||
m_layout = e_leftToRight;
|
||||
}
|
||||
else if (!SDL_strcasecmp(output, g_strRIGHT_TO_LEFT)) {
|
||||
else if (!MORTAR_strcasecmp(output, g_strRIGHT_TO_LEFT)) {
|
||||
m_layout = e_rightToLeft;
|
||||
}
|
||||
else if (!SDL_strcasecmp(output, g_strBOTTOM_TO_TOP)) {
|
||||
else if (!MORTAR_strcasecmp(output, g_strBOTTOM_TO_TOP)) {
|
||||
m_layout = e_bottomToTop;
|
||||
}
|
||||
else if (!SDL_strcasecmp(output, g_strTOP_TO_BOTTOM)) {
|
||||
else if (!MORTAR_strcasecmp(output, g_strTOP_TO_BOTTOM)) {
|
||||
m_layout = e_topToBottom;
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
#include "mxutilities.h"
|
||||
#include "roi/legoroi.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoActor, 0x78)
|
||||
|
||||
@ -117,7 +117,7 @@ void LegoActor::ParseAction(char* p_extra)
|
||||
}
|
||||
|
||||
if (KeyValueStringParse(value, g_strVISIBILITY, p_extra)) {
|
||||
GetROI()->SetVisibility(SDL_strcasecmp(value, "FALSE") != 0);
|
||||
GetROI()->SetVisibility(MORTAR_strcasecmp(value, "FALSE") != 0);
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,7 +135,7 @@ void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_updateTransform)
|
||||
const char* name = p_roi->GetName();
|
||||
|
||||
for (MxU32 i = 1; i <= sizeOfArray(g_actorNames) - 2; i++) {
|
||||
if (!SDL_strcasecmp(name, g_actorNames[i])) {
|
||||
if (!MORTAR_strcasecmp(name, g_actorNames[i])) {
|
||||
m_type = e_actor;
|
||||
m_actorId = i;
|
||||
break;
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
#include "realtime/realtimeview.h"
|
||||
#include "viewmanager/viewmanager.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
#include <vec.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoNavController, 0x70)
|
||||
@ -109,17 +109,17 @@ MxU32 g_switchAct = FALSE;
|
||||
LegoAnimationManager::PlayMode g_unk0x100f66bc = LegoAnimationManager::e_unk2;
|
||||
|
||||
// GLOBAL: LEGO1 0x100f66c0
|
||||
SDL_Keycode g_debugPassword[] = {
|
||||
MORTAR_Keycode g_debugPassword[] = {
|
||||
// "OGEL"
|
||||
SDLK_O,
|
||||
SDLK_G,
|
||||
SDLK_E,
|
||||
SDLK_L,
|
||||
MORTARK_O,
|
||||
MORTARK_G,
|
||||
MORTARK_E,
|
||||
MORTARK_L,
|
||||
0,
|
||||
};
|
||||
|
||||
// GLOBAL: LEGO1 0x100f66c8
|
||||
SDL_Keycode* g_currentInput = g_debugPassword;
|
||||
MORTAR_Keycode* g_currentInput = g_debugPassword;
|
||||
|
||||
// GLOBAL: LEGO1 0x100f66cc
|
||||
MxS32 g_nextCharacter = -1;
|
||||
@ -441,7 +441,7 @@ MxResult LegoNavController::UpdateLocation(const char* p_location)
|
||||
MxResult result = FAILURE;
|
||||
|
||||
for (MxS32 i = 0; i < (MxS32) sizeOfArray(g_locations); i++) {
|
||||
if (!SDL_strcasecmp(p_location, g_locations[i].m_name)) {
|
||||
if (!MORTAR_strcasecmp(p_location, g_locations[i].m_name)) {
|
||||
MxMatrix mat;
|
||||
LegoROI* viewROI = VideoManager()->GetViewROI();
|
||||
|
||||
@ -655,8 +655,8 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
||||
{
|
||||
if (((MxNotificationParam&) p_param).GetNotification() == c_notificationKeyPress) {
|
||||
m_unk0x5d = TRUE;
|
||||
SDL_Keycode originKey = ((LegoEventNotificationParam&) p_param).GetKey();
|
||||
SDL_Keycode key = originKey;
|
||||
MORTAR_Keycode originKey = ((LegoEventNotificationParam&) p_param).GetKey();
|
||||
MORTAR_Keycode key = originKey;
|
||||
|
||||
// This is necessary so any players using the WASD movement option can
|
||||
// also use Debug Mode, which normally makes use of the WASD keys.
|
||||
@ -665,29 +665,29 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
||||
// those conflicting debug keys to the arrow keys.
|
||||
if (LegoOmni::GetInstance()->GetInputManager()->GetWasd()) {
|
||||
switch (originKey) {
|
||||
case SDLK_W:
|
||||
key = SDLK_UP;
|
||||
case MORTARK_W:
|
||||
key = MORTARK_UP;
|
||||
break;
|
||||
case SDLK_A:
|
||||
key = SDLK_LEFT;
|
||||
case MORTARK_A:
|
||||
key = MORTARK_LEFT;
|
||||
break;
|
||||
case SDLK_S:
|
||||
key = SDLK_DOWN;
|
||||
case MORTARK_S:
|
||||
key = MORTARK_DOWN;
|
||||
break;
|
||||
case SDLK_D:
|
||||
key = SDLK_RIGHT;
|
||||
case MORTARK_D:
|
||||
key = MORTARK_RIGHT;
|
||||
break;
|
||||
case SDLK_UP:
|
||||
key = SDLK_W;
|
||||
case MORTARK_UP:
|
||||
key = MORTARK_W;
|
||||
break;
|
||||
case SDLK_LEFT:
|
||||
key = SDLK_A;
|
||||
case MORTARK_LEFT:
|
||||
key = MORTARK_A;
|
||||
break;
|
||||
case SDLK_DOWN:
|
||||
key = SDLK_S;
|
||||
case MORTARK_DOWN:
|
||||
key = MORTARK_S;
|
||||
break;
|
||||
case SDLK_RIGHT:
|
||||
key = SDLK_D;
|
||||
case MORTARK_RIGHT:
|
||||
key = MORTARK_D;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -695,7 +695,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
||||
}
|
||||
|
||||
switch (key) {
|
||||
case SDLK_PAUSE: // Pause game
|
||||
case MORTARK_PAUSE: // Pause game
|
||||
if (Lego()->IsPaused()) {
|
||||
Lego()->Resume();
|
||||
}
|
||||
@ -703,7 +703,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
||||
Lego()->Pause();
|
||||
}
|
||||
break;
|
||||
case SDLK_ESCAPE: { // Return to infocenter
|
||||
case MORTARK_ESCAPE: { // Return to infocenter
|
||||
LegoWorld* currentWorld = CurrentWorld();
|
||||
if (currentWorld != NULL) {
|
||||
InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState");
|
||||
@ -717,10 +717,10 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SDLK_SPACE: // Interrupt/end animations or free navigation
|
||||
case MORTARK_SPACE: // Interrupt/end animations or free navigation
|
||||
AnimationManager()->FUN_10061010(TRUE);
|
||||
break;
|
||||
case SDLK_Z: { // Make nearby plants "dance"
|
||||
case MORTARK_Z: { // Make nearby plants "dance"
|
||||
LegoOmni* omni = Lego();
|
||||
|
||||
if (omni->GetCurrentWorld() != NULL && omni->GetCurrentWorld()->GetWorldId() == LegoOmni::e_act1) {
|
||||
@ -754,15 +754,15 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SDLK_KP_PLUS:
|
||||
case SDLK_KP_MINUS: { // Cycles through characters and puts them in front of you
|
||||
case MORTARK_KP_PLUS:
|
||||
case MORTARK_KP_MINUS: { // Cycles through characters and puts them in front of you
|
||||
if (g_nextCharacter == -1) {
|
||||
g_nextCharacter = 0;
|
||||
}
|
||||
else {
|
||||
CharacterManager()->ReleaseActor(CharacterManager()->GetActorName(g_nextCharacter));
|
||||
|
||||
if (key == SDLK_KP_PLUS) {
|
||||
if (key == MORTARK_KP_PLUS) {
|
||||
g_nextCharacter++;
|
||||
if (g_nextCharacter >= CharacterManager()->GetNumActors()) {
|
||||
g_nextCharacter = 0;
|
||||
@ -789,7 +789,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SDLK_F12: { // Saves the game
|
||||
case MORTARK_F12: { // Saves the game
|
||||
InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState");
|
||||
if (state && state->HasRegistered()) {
|
||||
GameState()->Save(0);
|
||||
@ -801,7 +801,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
||||
if (!*g_currentInput) {
|
||||
// password "protected" debug shortcuts
|
||||
switch (key) {
|
||||
case SDLK_TAB:
|
||||
case MORTARK_TAB:
|
||||
VideoManager()->ToggleFPS(g_fpsEnabled);
|
||||
if (g_fpsEnabled) {
|
||||
g_fpsEnabled = FALSE;
|
||||
@ -812,16 +812,16 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
||||
default:
|
||||
m_unk0x5d = FALSE;
|
||||
break;
|
||||
case SDLK_0:
|
||||
case SDLK_1:
|
||||
case SDLK_2:
|
||||
case SDLK_3:
|
||||
case SDLK_4:
|
||||
case SDLK_5:
|
||||
case SDLK_6:
|
||||
case SDLK_7:
|
||||
case SDLK_8:
|
||||
case SDLK_9:
|
||||
case MORTARK_0:
|
||||
case MORTARK_1:
|
||||
case MORTARK_2:
|
||||
case MORTARK_3:
|
||||
case MORTARK_4:
|
||||
case MORTARK_5:
|
||||
case MORTARK_6:
|
||||
case MORTARK_7:
|
||||
case MORTARK_8:
|
||||
case MORTARK_9:
|
||||
if (g_changeLight && key <= '1') {
|
||||
LegoROI* roi = VideoManager()->GetViewROI();
|
||||
Tgl::FloatMatrix4 matrix;
|
||||
@ -895,7 +895,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
||||
}
|
||||
}
|
||||
|
||||
if (g_switchAct && key >= SDLK_1 && key <= SDLK_5) {
|
||||
if (g_switchAct && key >= MORTARK_1 && key <= MORTARK_5) {
|
||||
switch (GameState()->GetCurrentAct()) {
|
||||
case LegoGameState::e_act1:
|
||||
GameState()->m_currentArea = LegoGameState::e_isle;
|
||||
@ -909,17 +909,17 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
||||
}
|
||||
|
||||
switch (key) {
|
||||
case SDLK_1:
|
||||
case MORTARK_1:
|
||||
GameState()->SetCurrentAct(LegoGameState::e_act1);
|
||||
GameState()->SwitchArea(LegoGameState::e_isle);
|
||||
break;
|
||||
case SDLK_2:
|
||||
case MORTARK_2:
|
||||
GameState()->SwitchArea(LegoGameState::e_act2main);
|
||||
break;
|
||||
case SDLK_3:
|
||||
case MORTARK_3:
|
||||
GameState()->SwitchArea(LegoGameState::e_act3script);
|
||||
break;
|
||||
case SDLK_4: {
|
||||
case MORTARK_4: {
|
||||
Act3State* act3State = (Act3State*) GameState()->GetState("Act3State");
|
||||
if (act3State == NULL) {
|
||||
act3State = new Act3State();
|
||||
@ -933,7 +933,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
||||
GameState()->SwitchArea(LegoGameState::e_infomain);
|
||||
break;
|
||||
}
|
||||
case SDLK_5: {
|
||||
case MORTARK_5: {
|
||||
Act3State* act3State = (Act3State*) GameState()->GetState("Act3State");
|
||||
if (act3State == NULL) {
|
||||
act3State = new Act3State();
|
||||
@ -958,7 +958,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
||||
LegoOmni::GetInstance()->Start(&action);
|
||||
}
|
||||
break;
|
||||
case SDLK_A:
|
||||
case MORTARK_A:
|
||||
if (g_animationCalcStep == 1) {
|
||||
Lego()->m_initialized = TRUE;
|
||||
AnimationManager()->FUN_10060570(TRUE);
|
||||
@ -974,22 +974,22 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SDLK_C:
|
||||
case MORTARK_C:
|
||||
g_locationCalcStep = 1;
|
||||
break;
|
||||
case SDLK_D:
|
||||
case MORTARK_D:
|
||||
m_unk0x60 = -1.0;
|
||||
break;
|
||||
case SDLK_F:
|
||||
case MORTARK_F:
|
||||
RealtimeView::SetUserMaxLOD(0.0);
|
||||
break;
|
||||
case SDLK_G:
|
||||
case MORTARK_G:
|
||||
g_switchAct = TRUE;
|
||||
break;
|
||||
case SDLK_H:
|
||||
case MORTARK_H:
|
||||
RealtimeView::SetUserMaxLOD(5.0);
|
||||
break;
|
||||
case SDLK_I: {
|
||||
case MORTARK_I: {
|
||||
LegoROI* roi = VideoManager()->GetViewROI();
|
||||
MxMatrix mat;
|
||||
mat.SetIdentity();
|
||||
@ -997,7 +997,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
||||
roi->WrappedUpdateWorldDataWithTransform(mat);
|
||||
break;
|
||||
}
|
||||
case SDLK_J: {
|
||||
case MORTARK_J: {
|
||||
LegoROI* roi = VideoManager()->GetViewROI();
|
||||
MxMatrix mat;
|
||||
mat.SetIdentity();
|
||||
@ -1005,7 +1005,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
||||
roi->WrappedUpdateWorldDataWithTransform(mat);
|
||||
break;
|
||||
}
|
||||
case SDLK_K: {
|
||||
case MORTARK_K: {
|
||||
MxMatrix mat;
|
||||
LegoROI* roi = LegoOmni::GetInstance()->GetVideoManager()->GetViewROI();
|
||||
mat.SetIdentity();
|
||||
@ -1013,10 +1013,10 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
||||
roi->WrappedUpdateWorldDataWithTransform(mat);
|
||||
break;
|
||||
}
|
||||
case SDLK_L:
|
||||
case MORTARK_L:
|
||||
g_changeLight = TRUE;
|
||||
break;
|
||||
case SDLK_M: {
|
||||
case MORTARK_M: {
|
||||
LegoROI* roi = LegoOmni::GetInstance()->GetVideoManager()->GetViewROI();
|
||||
MxMatrix mat;
|
||||
mat.SetIdentity();
|
||||
@ -1024,12 +1024,12 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
||||
roi->WrappedUpdateWorldDataWithTransform(mat);
|
||||
break;
|
||||
}
|
||||
case SDLK_N:
|
||||
case MORTARK_N:
|
||||
if (VideoManager()) {
|
||||
VideoManager()->SetRender3D(!VideoManager()->GetRender3D());
|
||||
}
|
||||
break;
|
||||
case SDLK_P:
|
||||
case MORTARK_P:
|
||||
if (!g_resetPlants) {
|
||||
PlantManager()->LoadWorldInfo(LegoOmni::e_act1);
|
||||
g_resetPlants = TRUE;
|
||||
@ -1039,14 +1039,14 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
||||
g_resetPlants = FALSE;
|
||||
}
|
||||
break;
|
||||
case SDLK_S:
|
||||
case MORTARK_S:
|
||||
g_enableMusic = g_enableMusic == FALSE;
|
||||
BackgroundAudioManager()->Enable(g_enableMusic);
|
||||
break;
|
||||
case SDLK_U:
|
||||
case MORTARK_U:
|
||||
m_unk0x60 = 1.0;
|
||||
break;
|
||||
case SDLK_V:
|
||||
case MORTARK_V:
|
||||
if (g_nextAnimation > 0 && g_animationCalcStep == 0) {
|
||||
AnimationManager()->FUN_10061010(FALSE);
|
||||
}
|
||||
@ -1058,7 +1058,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
||||
g_nextAnimation = 0;
|
||||
g_animationCalcStep = 1;
|
||||
break;
|
||||
case SDLK_W: {
|
||||
case MORTARK_W: {
|
||||
MxMatrix mat;
|
||||
LegoROI* roi = LegoOmni::GetInstance()->GetVideoManager()->GetViewROI();
|
||||
const float* position = roi->GetWorldPosition();
|
||||
@ -1073,10 +1073,10 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
||||
);
|
||||
break;
|
||||
}
|
||||
case SDLK_X:
|
||||
case MORTARK_X:
|
||||
RealtimeView::SetUserMaxLOD(3.6);
|
||||
break;
|
||||
case SDLK_KP_MULTIPLY: {
|
||||
case MORTARK_KP_MULTIPLY: {
|
||||
MxU8 newActor = GameState()->GetActorId() + 1;
|
||||
|
||||
if (newActor > LegoActor::c_laura) {
|
||||
@ -1086,10 +1086,10 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
||||
GameState()->SetActorId(newActor);
|
||||
break;
|
||||
}
|
||||
case SDLK_KP_DIVIDE:
|
||||
case MORTARK_KP_DIVIDE:
|
||||
GameState()->SetActorId(LegoActor::c_brickster);
|
||||
break;
|
||||
case SDLK_F11:
|
||||
case MORTARK_F11:
|
||||
if (GameState()->m_isDirty) {
|
||||
GameState()->m_isDirty = FALSE;
|
||||
}
|
||||
@ -1097,7 +1097,7 @@ MxLong LegoNavController::Notify(MxParam& p_param)
|
||||
GameState()->m_isDirty = TRUE;
|
||||
}
|
||||
break;
|
||||
case SDLK_MINUS:
|
||||
case MORTARK_MINUS:
|
||||
g_unk0x100f66bc = LegoAnimationManager::e_unk1;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
#include "mxutilities.h"
|
||||
#include "viewmanager/viewmanager.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoWorld, 0xf8)
|
||||
DECOMP_SIZE_ASSERT(LegoEntityList, 0x18)
|
||||
@ -429,7 +429,7 @@ void LegoWorld::Add(MxCore* p_object)
|
||||
|
||||
#ifndef BETA10
|
||||
if (p_object->IsA("LegoAnimPresenter")) {
|
||||
if (!SDL_strcasecmp(((LegoAnimPresenter*) p_object)->GetAction()->GetObjectName(), "ConfigAnimation")) {
|
||||
if (!MORTAR_strcasecmp(((LegoAnimPresenter*) p_object)->GetAction()->GetObjectName(), "ConfigAnimation")) {
|
||||
CalculateViewFromAnimation((LegoAnimPresenter*) p_object);
|
||||
((LegoAnimPresenter*) p_object)
|
||||
->GetAction()
|
||||
@ -601,7 +601,7 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name)
|
||||
}
|
||||
|
||||
LegoROI* roi = entity->GetROI();
|
||||
if (roi && !SDL_strcasecmp(roi->GetName(), p_name)) {
|
||||
if (roi && !MORTAR_strcasecmp(roi->GetName(), p_name)) {
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
@ -614,7 +614,7 @@ MxCore* LegoWorld::Find(const char* p_class, const char* p_name)
|
||||
MxPresenter* presenter;
|
||||
|
||||
while (cursor.Next(presenter)) {
|
||||
if (!SDL_strcasecmp(((LegoAnimPresenter*) presenter)->GetActionObjectName(), p_name)) {
|
||||
if (!MORTAR_strcasecmp(((LegoAnimPresenter*) presenter)->GetActionObjectName(), p_name)) {
|
||||
return presenter;
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
#include "mxstl/stlcompat.h"
|
||||
#include "mxutilities.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
#include <stdio.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoWorldPresenter, 0x54)
|
||||
@ -36,7 +36,7 @@ DECOMP_SIZE_ASSERT(LegoWorldPresenter, 0x54)
|
||||
MxS32 g_legoWorldPresenterQuality = 1;
|
||||
|
||||
// GLOBAL: LEGO1 0x100f75d8
|
||||
Sint64 g_wdbSkipGlobalPartsOffset = 0;
|
||||
int64_t g_wdbSkipGlobalPartsOffset = 0;
|
||||
|
||||
// FUNCTION: LEGO1 0x100665b0
|
||||
void LegoWorldPresenter::configureLegoWorldPresenter(MxS32 p_legoWorldPresenterQuality)
|
||||
@ -174,9 +174,9 @@ MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world)
|
||||
strcat(wdbPath, "lego\\data\\world.wdb");
|
||||
MxString::MapPathToFilesystem(wdbPath);
|
||||
|
||||
SDL_IOStream* wdbFile;
|
||||
MORTAR_IOStream* wdbFile;
|
||||
|
||||
if ((wdbFile = SDL_IOFromFile(wdbPath, "rb")) == NULL) {
|
||||
if ((wdbFile = MORTAR_IOFromFile(wdbPath, "rb")) == NULL) {
|
||||
sprintf(wdbPath, "%s", MxOmni::GetCD());
|
||||
|
||||
if (wdbPath[strlen(wdbPath) - 1] != '\\' && wdbPath[strlen(wdbPath) - 1] != '/') {
|
||||
@ -186,7 +186,7 @@ MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world)
|
||||
strcat(wdbPath, "lego\\data\\world.wdb");
|
||||
MxString::MapPathToFilesystem(wdbPath);
|
||||
|
||||
if ((wdbFile = SDL_IOFromFile(wdbPath, "rb")) == NULL) {
|
||||
if ((wdbFile = MORTAR_IOFromFile(wdbPath, "rb")) == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
@ -199,7 +199,7 @@ MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world)
|
||||
ReadModelDbWorlds(wdbFile, worlds, numWorlds);
|
||||
|
||||
for (i = 0; i < numWorlds; i++) {
|
||||
if (!SDL_strcasecmp(worlds[i].m_worldName, p_worldName)) {
|
||||
if (!MORTAR_strcasecmp(worlds[i].m_worldName, p_worldName)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -209,12 +209,12 @@ MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world)
|
||||
}
|
||||
|
||||
if (g_wdbSkipGlobalPartsOffset == 0) {
|
||||
if (SDL_ReadIO(wdbFile, &size, sizeof(MxU32)) != sizeof(MxU32)) {
|
||||
if (MORTAR_ReadIO(wdbFile, &size, sizeof(MxU32)) != sizeof(MxU32)) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
buff = new MxU8[size];
|
||||
if (SDL_ReadIO(wdbFile, buff, size) != size) {
|
||||
if (MORTAR_ReadIO(wdbFile, buff, size) != size) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@ -229,12 +229,12 @@ MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world)
|
||||
|
||||
delete[] buff;
|
||||
|
||||
if (SDL_ReadIO(wdbFile, &size, sizeof(MxU32)) != sizeof(MxU32)) {
|
||||
if (MORTAR_ReadIO(wdbFile, &size, sizeof(MxU32)) != sizeof(MxU32)) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
buff = new MxU8[size];
|
||||
if (SDL_ReadIO(wdbFile, buff, size) != size) {
|
||||
if (MORTAR_ReadIO(wdbFile, buff, size) != size) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@ -248,10 +248,10 @@ MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world)
|
||||
|
||||
delete[] buff;
|
||||
|
||||
g_wdbSkipGlobalPartsOffset = SDL_TellIO(wdbFile);
|
||||
g_wdbSkipGlobalPartsOffset = MORTAR_TellIO(wdbFile);
|
||||
}
|
||||
else {
|
||||
if (SDL_SeekIO(wdbFile, g_wdbSkipGlobalPartsOffset, SDL_IO_SEEK_SET) != g_wdbSkipGlobalPartsOffset) {
|
||||
if (MORTAR_SeekIO(wdbFile, g_wdbSkipGlobalPartsOffset, MORTAR_IO_SEEK_SET) != g_wdbSkipGlobalPartsOffset) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
@ -271,25 +271,25 @@ MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world)
|
||||
}
|
||||
|
||||
for (j = 0; j < worlds[i].m_numModels; j++) {
|
||||
if (!SDL_strncasecmp(worlds[i].m_models[j].m_modelName, "isle", 4)) {
|
||||
if (!MORTAR_strncasecmp(worlds[i].m_models[j].m_modelName, "isle", 4)) {
|
||||
switch (g_legoWorldPresenterQuality) {
|
||||
case 0:
|
||||
if (SDL_strcasecmp(worlds[i].m_models[j].m_modelName, "isle_lo")) {
|
||||
if (MORTAR_strcasecmp(worlds[i].m_models[j].m_modelName, "isle_lo")) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (SDL_strcasecmp(worlds[i].m_models[j].m_modelName, "isle")) {
|
||||
if (MORTAR_strcasecmp(worlds[i].m_models[j].m_modelName, "isle")) {
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (SDL_strcasecmp(worlds[i].m_models[j].m_modelName, "isle_hi")) {
|
||||
if (MORTAR_strcasecmp(worlds[i].m_models[j].m_modelName, "isle_hi")) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (g_legoWorldPresenterQuality <= 1 && !SDL_strncasecmp(worlds[i].m_models[j].m_modelName, "haus", 4)) {
|
||||
else if (g_legoWorldPresenterQuality <= 1 && !MORTAR_strncasecmp(worlds[i].m_models[j].m_modelName, "haus", 4)) {
|
||||
if (worlds[i].m_models[j].m_modelName[4] == '3') {
|
||||
if (LoadWorldModel(worlds[i].m_models[j], wdbFile, p_world) != SUCCESS) {
|
||||
return FAILURE;
|
||||
@ -313,18 +313,18 @@ MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world)
|
||||
}
|
||||
|
||||
FreeModelDbWorlds(worlds, numWorlds);
|
||||
SDL_CloseIO(wdbFile);
|
||||
MORTAR_CloseIO(wdbFile);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10067360
|
||||
MxResult LegoWorldPresenter::LoadWorldPart(ModelDbPart& p_part, SDL_IOStream* p_wdbFile)
|
||||
MxResult LegoWorldPresenter::LoadWorldPart(ModelDbPart& p_part, MORTAR_IOStream* p_wdbFile)
|
||||
{
|
||||
MxResult result;
|
||||
MxU8* buff = new MxU8[p_part.m_partDataLength];
|
||||
|
||||
SDL_SeekIO(p_wdbFile, p_part.m_partDataOffset, SDL_IO_SEEK_SET);
|
||||
if (SDL_ReadIO(p_wdbFile, buff, p_part.m_partDataLength) != p_part.m_partDataLength) {
|
||||
MORTAR_SeekIO(p_wdbFile, p_part.m_partDataOffset, MORTAR_IO_SEEK_SET);
|
||||
if (MORTAR_ReadIO(p_wdbFile, buff, p_part.m_partDataLength) != p_part.m_partDataLength) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@ -344,12 +344,12 @@ MxResult LegoWorldPresenter::LoadWorldPart(ModelDbPart& p_part, SDL_IOStream* p_
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100674b0
|
||||
MxResult LegoWorldPresenter::LoadWorldModel(ModelDbModel& p_model, SDL_IOStream* p_wdbFile, LegoWorld* p_world)
|
||||
MxResult LegoWorldPresenter::LoadWorldModel(ModelDbModel& p_model, MORTAR_IOStream* p_wdbFile, LegoWorld* p_world)
|
||||
{
|
||||
MxU8* buff = new MxU8[p_model.m_modelDataLength];
|
||||
|
||||
SDL_SeekIO(p_wdbFile, p_model.m_modelDataOffset, SDL_IO_SEEK_SET);
|
||||
if (SDL_ReadIO(p_wdbFile, buff, p_model.m_modelDataLength) != p_model.m_modelDataLength) {
|
||||
MORTAR_SeekIO(p_wdbFile, p_model.m_modelDataOffset, MORTAR_IO_SEEK_SET);
|
||||
if (MORTAR_ReadIO(p_wdbFile, buff, p_model.m_modelDataLength) != p_model.m_modelDataLength) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
#include "mxdebug.h"
|
||||
#include "roi/legoroi.h"
|
||||
|
||||
#include <SDL3/SDL_log.h>
|
||||
#include <mortar/mortar_log.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoInputManager, 0x338)
|
||||
DECOMP_SIZE_ASSERT(LegoNotifyList, 0x18)
|
||||
@ -100,27 +100,27 @@ void LegoInputManager::Destroy()
|
||||
|
||||
for (const auto& [id, joystick] : m_joysticks) {
|
||||
if (joystick.second) {
|
||||
SDL_CloseHaptic(joystick.second);
|
||||
MORTAR_CloseHaptic(joystick.second);
|
||||
}
|
||||
|
||||
SDL_CloseGamepad(joystick.first);
|
||||
MORTAR_CloseGamepad(joystick.first);
|
||||
}
|
||||
|
||||
for (const auto& [id, mouse] : m_mice) {
|
||||
if (mouse.second) {
|
||||
SDL_CloseHaptic(mouse.second);
|
||||
MORTAR_CloseHaptic(mouse.second);
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& [id, haptic] : m_otherHaptics) {
|
||||
SDL_CloseHaptic(haptic);
|
||||
MORTAR_CloseHaptic(haptic);
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1005c0f0
|
||||
void LegoInputManager::GetKeyboardState()
|
||||
{
|
||||
m_keyboardState = SDL_GetKeyboardState(NULL);
|
||||
m_keyboardState = MORTAR_GetKeyboardState(NULL);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1005c160
|
||||
@ -135,41 +135,41 @@ MxResult LegoInputManager::GetNavigationKeyStates(MxU32& p_keyFlags)
|
||||
MxU32 keyFlags = 0;
|
||||
|
||||
if (!m_wasd) {
|
||||
if (m_keyboardState[SDL_SCANCODE_KP_8] || m_keyboardState[SDL_SCANCODE_UP]) {
|
||||
if (m_keyboardState[MORTAR_SCANCODE_KP_8] || m_keyboardState[MORTAR_SCANCODE_UP]) {
|
||||
keyFlags |= c_up;
|
||||
}
|
||||
|
||||
if ((m_keyboardState[SDL_SCANCODE_KP_2] || m_keyboardState[SDL_SCANCODE_DOWN])) {
|
||||
if ((m_keyboardState[MORTAR_SCANCODE_KP_2] || m_keyboardState[MORTAR_SCANCODE_DOWN])) {
|
||||
keyFlags |= c_down;
|
||||
}
|
||||
|
||||
if ((m_keyboardState[SDL_SCANCODE_KP_4] || m_keyboardState[SDL_SCANCODE_LEFT])) {
|
||||
if ((m_keyboardState[MORTAR_SCANCODE_KP_4] || m_keyboardState[MORTAR_SCANCODE_LEFT])) {
|
||||
keyFlags |= c_left;
|
||||
}
|
||||
|
||||
if ((m_keyboardState[SDL_SCANCODE_KP_6] || m_keyboardState[SDL_SCANCODE_RIGHT])) {
|
||||
if ((m_keyboardState[MORTAR_SCANCODE_KP_6] || m_keyboardState[MORTAR_SCANCODE_RIGHT])) {
|
||||
keyFlags |= c_right;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (m_keyboardState[SDL_SCANCODE_W]) {
|
||||
if (m_keyboardState[MORTAR_SCANCODE_W]) {
|
||||
keyFlags |= c_up;
|
||||
}
|
||||
|
||||
if (m_keyboardState[SDL_SCANCODE_S]) {
|
||||
if (m_keyboardState[MORTAR_SCANCODE_S]) {
|
||||
keyFlags |= c_down;
|
||||
}
|
||||
|
||||
if (m_keyboardState[SDL_SCANCODE_A]) {
|
||||
if (m_keyboardState[MORTAR_SCANCODE_A]) {
|
||||
keyFlags |= c_left;
|
||||
}
|
||||
|
||||
if (m_keyboardState[SDL_SCANCODE_D]) {
|
||||
if (m_keyboardState[MORTAR_SCANCODE_D]) {
|
||||
keyFlags |= c_right;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_keyboardState[SDL_SCANCODE_LCTRL] || m_keyboardState[SDL_SCANCODE_RCTRL]) {
|
||||
if (m_keyboardState[MORTAR_SCANCODE_LCTRL] || m_keyboardState[MORTAR_SCANCODE_RCTRL]) {
|
||||
keyFlags |= c_ctrl;
|
||||
}
|
||||
|
||||
@ -183,15 +183,15 @@ MxResult LegoInputManager::GetNavigationKeyStates(MxU32& p_keyFlags)
|
||||
// FUNCTION: LEGO1 0x1005c320
|
||||
MxResult LegoInputManager::GetJoystickState(MxU32* p_joystickX, MxU32* p_joystickY, MxU32* p_povPosition)
|
||||
{
|
||||
if (!std::holds_alternative<SDL_JoystickID_v>(m_lastInputMethod) &&
|
||||
!(std::holds_alternative<SDL_TouchID_v>(m_lastInputMethod) && m_touchScheme == e_gamepad)) {
|
||||
if (!std::holds_alternative<MORTAR_JoystickID_v>(m_lastInputMethod) &&
|
||||
!(std::holds_alternative<MORTAR_TouchID_v>(m_lastInputMethod) && m_touchScheme == e_gamepad)) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
MxS16 xPos, yPos = 0;
|
||||
for (const auto& [id, joystick] : m_joysticks) {
|
||||
xPos = SDL_GetGamepadAxis(joystick.first, SDL_GAMEPAD_AXIS_LEFTX);
|
||||
yPos = SDL_GetGamepadAxis(joystick.first, SDL_GAMEPAD_AXIS_LEFTY);
|
||||
xPos = MORTAR_GetGamepadAxis(joystick.first, MORTAR_GAMEPAD_AXIS_LEFTX);
|
||||
yPos = MORTAR_GetGamepadAxis(joystick.first, MORTAR_GAMEPAD_AXIS_LEFTY);
|
||||
if (xPos > -8000 && xPos < 8000) {
|
||||
xPos = 0;
|
||||
}
|
||||
@ -264,12 +264,12 @@ void LegoInputManager::ClearWorld()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1005c740
|
||||
void LegoInputManager::QueueEvent(NotificationId p_id, MxU8 p_modifier, MxLong p_x, MxLong p_y, SDL_Keycode p_key)
|
||||
void LegoInputManager::QueueEvent(NotificationId p_id, MxU8 p_modifier, MxLong p_x, MxLong p_y, MORTAR_Keycode 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)))) ||
|
||||
((m_unk0x336 && (p_key == SDLK_SPACE)))) {
|
||||
((m_unk0x336 && (p_key == MORTARK_SPACE)))) {
|
||||
ProcessOneEvent(param);
|
||||
}
|
||||
}
|
||||
@ -293,8 +293,8 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param)
|
||||
MxBool processRoi;
|
||||
|
||||
if (p_param.GetNotification() == c_notificationKeyPress) {
|
||||
if (!Lego()->IsPaused() || p_param.GetKey() == SDLK_PAUSE) {
|
||||
if (p_param.GetKey() == SDLK_LSHIFT || p_param.GetKey() == SDLK_RSHIFT) {
|
||||
if (!Lego()->IsPaused() || p_param.GetKey() == MORTARK_PAUSE) {
|
||||
if (p_param.GetKey() == MORTARK_LSHIFT || p_param.GetKey() == MORTARK_RSHIFT) {
|
||||
if (m_unk0x195) {
|
||||
m_unk0x80 = FALSE;
|
||||
p_param.SetNotification(c_notificationDragEnd);
|
||||
@ -324,7 +324,7 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param)
|
||||
|
||||
if (m_unk0x335 != 0) {
|
||||
if (p_param.GetNotification() == c_notificationButtonDown) {
|
||||
LegoEventNotificationParam notification(c_notificationKeyPress, NULL, 0, 0, 0, SDLK_SPACE);
|
||||
LegoEventNotificationParam notification(c_notificationKeyPress, NULL, 0, 0, 0, MORTARK_SPACE);
|
||||
LegoNotifyListCursor cursor(m_keyboardNotifyList);
|
||||
MxCore* target;
|
||||
|
||||
@ -490,22 +490,22 @@ MxBool LegoInputManager::FUN_1005cdf0(LegoEventNotificationParam& p_param)
|
||||
return result;
|
||||
}
|
||||
|
||||
static Uint32 SDLCALL LegoInputManagerTimerCallback(void* userdata, SDL_TimerID timerID, Uint32 interval)
|
||||
static uint32_t LegoInputManagerTimerCallback(void* p_userdata, MORTAR_TimerID p_timerID, uint32_t p_interval)
|
||||
{
|
||||
LegoInputManager* inputManager = (LegoInputManager*) userdata;
|
||||
SDL_Event event;
|
||||
event.type = g_legoSdlEvents.m_windowsMessage;
|
||||
LegoInputManager* inputManager = (LegoInputManager*) p_userdata;
|
||||
MORTAR_Event event;
|
||||
event.user.type = g_legoSdlEvents.m_windowsMessage;
|
||||
event.user.code = WM_TIMER;
|
||||
event.user.data1 = (void*) (uintptr_t) timerID;
|
||||
event.user.data1 = (void*) (uintptr_t) p_timerID;
|
||||
event.user.data2 = NULL;
|
||||
return interval;
|
||||
return p_interval;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1005cfb0
|
||||
// FUNCTION: BETA10 0x10089fc5
|
||||
void LegoInputManager::StartAutoDragTimer()
|
||||
{
|
||||
m_autoDragTimerID = SDL_AddTimer(m_autoDragTime, LegoInputManagerTimerCallback, this);
|
||||
m_autoDragTimerID = MORTAR_AddTimer(m_autoDragTime, LegoInputManagerTimerCallback, this);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1005cfd0
|
||||
@ -513,7 +513,7 @@ void LegoInputManager::StartAutoDragTimer()
|
||||
void LegoInputManager::StopAutoDragTimer()
|
||||
{
|
||||
if (m_autoDragTimerID) {
|
||||
SDL_RemoveTimer(m_autoDragTimerID);
|
||||
MORTAR_RemoveTimer(m_autoDragTimerID);
|
||||
m_autoDragTimerID = 0;
|
||||
}
|
||||
}
|
||||
@ -538,7 +538,7 @@ MxResult LegoInputManager::GetNavigationTouchStates(MxU32& p_keyStates)
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
void LegoInputManager::AddKeyboard(SDL_KeyboardID p_keyboardID)
|
||||
void LegoInputManager::AddKeyboard(MORTAR_KeyboardID p_keyboardID)
|
||||
{
|
||||
if (m_keyboards.count(p_keyboardID)) {
|
||||
return;
|
||||
@ -547,7 +547,7 @@ void LegoInputManager::AddKeyboard(SDL_KeyboardID p_keyboardID)
|
||||
m_keyboards[p_keyboardID] = {nullptr, nullptr};
|
||||
}
|
||||
|
||||
void LegoInputManager::RemoveKeyboard(SDL_KeyboardID p_keyboardID)
|
||||
void LegoInputManager::RemoveKeyboard(MORTAR_KeyboardID p_keyboardID)
|
||||
{
|
||||
if (!m_keyboards.count(p_keyboardID)) {
|
||||
return;
|
||||
@ -556,17 +556,17 @@ void LegoInputManager::RemoveKeyboard(SDL_KeyboardID p_keyboardID)
|
||||
m_keyboards.erase(p_keyboardID);
|
||||
}
|
||||
|
||||
void LegoInputManager::AddMouse(SDL_MouseID p_mouseID)
|
||||
void LegoInputManager::AddMouse(MORTAR_MouseID p_mouseID)
|
||||
{
|
||||
if (m_mice.count(p_mouseID)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Currently no way to get an individual haptic device for a mouse.
|
||||
SDL_Haptic* haptic = SDL_OpenHapticFromMouse();
|
||||
MORTAR_Haptic* haptic = MORTAR_OpenHapticFromMouse();
|
||||
if (haptic) {
|
||||
if (!SDL_InitHapticRumble(haptic)) {
|
||||
SDL_CloseHaptic(haptic);
|
||||
if (!MORTAR_InitHapticRumble(haptic)) {
|
||||
MORTAR_CloseHaptic(haptic);
|
||||
haptic = nullptr;
|
||||
}
|
||||
}
|
||||
@ -574,31 +574,31 @@ void LegoInputManager::AddMouse(SDL_MouseID p_mouseID)
|
||||
m_mice[p_mouseID] = {nullptr, haptic};
|
||||
}
|
||||
|
||||
void LegoInputManager::RemoveMouse(SDL_MouseID p_mouseID)
|
||||
void LegoInputManager::RemoveMouse(MORTAR_MouseID p_mouseID)
|
||||
{
|
||||
if (!m_mice.count(p_mouseID)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_mice[p_mouseID].second) {
|
||||
SDL_CloseHaptic(m_mice[p_mouseID].second);
|
||||
MORTAR_CloseHaptic(m_mice[p_mouseID].second);
|
||||
}
|
||||
|
||||
m_mice.erase(p_mouseID);
|
||||
}
|
||||
|
||||
void LegoInputManager::AddJoystick(SDL_JoystickID p_joystickID)
|
||||
void LegoInputManager::AddJoystick(MORTAR_JoystickID p_joystickID)
|
||||
{
|
||||
if (m_joysticks.count(p_joystickID)) {
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_Gamepad* joystick = SDL_OpenGamepad(p_joystickID);
|
||||
MORTAR_Gamepad* joystick = MORTAR_OpenGamepad(p_joystickID);
|
||||
if (joystick) {
|
||||
SDL_Haptic* haptic = SDL_OpenHapticFromJoystick(SDL_GetGamepadJoystick(joystick));
|
||||
MORTAR_Haptic* haptic = MORTAR_OpenHapticFromJoystick(MORTAR_GetGamepadJoystick(joystick));
|
||||
if (haptic) {
|
||||
if (!SDL_InitHapticRumble(haptic)) {
|
||||
SDL_CloseHaptic(haptic);
|
||||
if (!MORTAR_InitHapticRumble(haptic)) {
|
||||
MORTAR_CloseHaptic(haptic);
|
||||
haptic = nullptr;
|
||||
}
|
||||
}
|
||||
@ -606,27 +606,27 @@ void LegoInputManager::AddJoystick(SDL_JoystickID p_joystickID)
|
||||
m_joysticks[p_joystickID] = {joystick, haptic};
|
||||
}
|
||||
else {
|
||||
SDL_Log("Failed to open gamepad: %s", SDL_GetError());
|
||||
MORTAR_Log("Failed to open gamepad: %s", MORTAR_GetError());
|
||||
}
|
||||
}
|
||||
|
||||
void LegoInputManager::RemoveJoystick(SDL_JoystickID p_joystickID)
|
||||
void LegoInputManager::RemoveJoystick(MORTAR_JoystickID p_joystickID)
|
||||
{
|
||||
if (!m_joysticks.count(p_joystickID)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_joysticks[p_joystickID].second) {
|
||||
SDL_CloseHaptic(m_joysticks[p_joystickID].second);
|
||||
MORTAR_CloseHaptic(m_joysticks[p_joystickID].second);
|
||||
}
|
||||
|
||||
SDL_CloseGamepad(m_joysticks[p_joystickID].first);
|
||||
MORTAR_CloseGamepad(m_joysticks[p_joystickID].first);
|
||||
m_joysticks.erase(p_joystickID);
|
||||
}
|
||||
|
||||
MxBool LegoInputManager::HandleTouchEvent(SDL_Event* p_event, TouchScheme p_touchScheme)
|
||||
MxBool LegoInputManager::HandleTouchEvent(MORTAR_Event* p_event, TouchScheme p_touchScheme)
|
||||
{
|
||||
const SDL_TouchFingerEvent& event = p_event->tfinger;
|
||||
const MORTAR_TouchFingerEvent& event = p_event->tfinger;
|
||||
m_touchScheme = p_touchScheme;
|
||||
|
||||
switch (p_touchScheme) {
|
||||
@ -635,12 +635,12 @@ MxBool LegoInputManager::HandleTouchEvent(SDL_Event* p_event, TouchScheme p_touc
|
||||
return FALSE;
|
||||
case e_arrowKeys:
|
||||
switch (p_event->type) {
|
||||
case SDL_EVENT_FINGER_UP:
|
||||
case SDL_EVENT_FINGER_CANCELED:
|
||||
case MORTAR_EVENT_FINGER_UP:
|
||||
case MORTAR_EVENT_FINGER_CANCELED:
|
||||
m_touchFlags.erase(event.fingerID);
|
||||
break;
|
||||
case SDL_EVENT_FINGER_DOWN:
|
||||
case SDL_EVENT_FINGER_MOTION:
|
||||
case MORTAR_EVENT_FINGER_DOWN:
|
||||
case MORTAR_EVENT_FINGER_MOTION:
|
||||
m_touchFlags[event.fingerID] = 0;
|
||||
|
||||
if (event.y > 3.0 / 4.0) {
|
||||
@ -661,31 +661,31 @@ MxBool LegoInputManager::HandleTouchEvent(SDL_Event* p_event, TouchScheme p_touc
|
||||
}
|
||||
break;
|
||||
case e_gamepad: {
|
||||
static SDL_FingerID g_finger = (SDL_FingerID) 0;
|
||||
static MORTAR_FingerID g_finger = (MORTAR_FingerID) 0;
|
||||
|
||||
switch (p_event->type) {
|
||||
case SDL_EVENT_FINGER_DOWN:
|
||||
case MORTAR_EVENT_FINGER_DOWN:
|
||||
if (!g_finger) {
|
||||
g_finger = event.fingerID;
|
||||
m_touchVirtualThumb = {0, 0};
|
||||
m_touchVirtualThumbOrigin = {event.x, event.y};
|
||||
}
|
||||
break;
|
||||
case SDL_EVENT_FINGER_UP:
|
||||
case SDL_EVENT_FINGER_CANCELED:
|
||||
case MORTAR_EVENT_FINGER_UP:
|
||||
case MORTAR_EVENT_FINGER_CANCELED:
|
||||
if (event.fingerID == g_finger) {
|
||||
g_finger = 0;
|
||||
m_touchVirtualThumb = {0, 0};
|
||||
m_touchVirtualThumbOrigin = {0, 0};
|
||||
}
|
||||
break;
|
||||
case SDL_EVENT_FINGER_MOTION:
|
||||
case MORTAR_EVENT_FINGER_MOTION:
|
||||
if (event.fingerID == g_finger) {
|
||||
const float thumbstickRadius = 0.25f;
|
||||
const float deltaX =
|
||||
SDL_clamp(event.x - m_touchVirtualThumbOrigin.x, -thumbstickRadius, thumbstickRadius);
|
||||
MORTAR_clamp(event.x - m_touchVirtualThumbOrigin.x, -thumbstickRadius, thumbstickRadius);
|
||||
const float deltaY =
|
||||
SDL_clamp(event.y - m_touchVirtualThumbOrigin.y, -thumbstickRadius, thumbstickRadius);
|
||||
MORTAR_clamp(event.y - m_touchVirtualThumbOrigin.y, -thumbstickRadius, thumbstickRadius);
|
||||
|
||||
m_touchVirtualThumb = {
|
||||
(int) (deltaX / thumbstickRadius * 32767.0f),
|
||||
@ -715,21 +715,21 @@ MxBool LegoInputManager::HandleRumbleEvent(
|
||||
g_hapticsInitialized = true;
|
||||
}
|
||||
|
||||
SDL_Haptic* haptic = nullptr;
|
||||
MORTAR_Haptic* haptic = nullptr;
|
||||
std::visit(
|
||||
overloaded{
|
||||
[](SDL_KeyboardID_v p_id) {},
|
||||
[&haptic, this](SDL_MouseID_v p_id) {
|
||||
if (m_mice.count((SDL_MouseID) p_id)) {
|
||||
haptic = m_mice[(SDL_MouseID) p_id].second;
|
||||
[](MORTAR_KeyboardID_v p_id) {},
|
||||
[&haptic, this](MORTAR_MouseID_v p_id) {
|
||||
if (m_mice.count((MORTAR_MouseID) p_id)) {
|
||||
haptic = m_mice[(MORTAR_MouseID) p_id].second;
|
||||
}
|
||||
},
|
||||
[&haptic, this](SDL_JoystickID_v p_id) {
|
||||
if (m_joysticks.count((SDL_JoystickID) p_id)) {
|
||||
haptic = m_joysticks[(SDL_JoystickID) p_id].second;
|
||||
[&haptic, this](MORTAR_JoystickID_v p_id) {
|
||||
if (m_joysticks.count((MORTAR_JoystickID) p_id)) {
|
||||
haptic = m_joysticks[(MORTAR_JoystickID) p_id].second;
|
||||
}
|
||||
},
|
||||
[&haptic, this](SDL_TouchID_v p_id) {
|
||||
[&haptic, this](MORTAR_TouchID_v p_id) {
|
||||
// We can't currently correlate Touch devices with Haptic devices
|
||||
if (!m_otherHaptics.empty()) {
|
||||
haptic = m_otherHaptics.begin()->second;
|
||||
@ -740,16 +740,16 @@ MxBool LegoInputManager::HandleRumbleEvent(
|
||||
);
|
||||
|
||||
if (haptic) {
|
||||
return SDL_PlayHapticRumble(haptic, p_strength, p_milliseconds);
|
||||
return MORTAR_PlayHapticRumble(haptic, p_strength, p_milliseconds);
|
||||
}
|
||||
|
||||
// A joystick isn't necessarily a haptic device; try basic rumble instead
|
||||
if (const SDL_JoystickID_v* joystick = std::get_if<SDL_JoystickID_v>(&m_lastInputMethod)) {
|
||||
if (m_joysticks.count((SDL_JoystickID) *joystick)) {
|
||||
return SDL_RumbleGamepad(
|
||||
m_joysticks[(SDL_JoystickID) *joystick].first,
|
||||
SDL_clamp(p_lowFrequencyRumble, 0, 1) * USHRT_MAX,
|
||||
SDL_clamp(p_highFrequencyRumble, 0, 1) * USHRT_MAX,
|
||||
if (const MORTAR_JoystickID_v* joystick = std::get_if<MORTAR_JoystickID_v>(&m_lastInputMethod)) {
|
||||
if (m_joysticks.count((MORTAR_JoystickID) *joystick)) {
|
||||
return MORTAR_RumbleGamepad(
|
||||
m_joysticks[(MORTAR_JoystickID) *joystick].first,
|
||||
MORTAR_clamp(p_lowFrequencyRumble, 0, 1) * USHRT_MAX,
|
||||
MORTAR_clamp(p_highFrequencyRumble, 0, 1) * USHRT_MAX,
|
||||
p_milliseconds
|
||||
);
|
||||
}
|
||||
@ -762,67 +762,67 @@ void LegoInputManager::InitializeHaptics()
|
||||
{
|
||||
// We don't get added/removed events for haptic devices that are not joysticks or mice,
|
||||
// so we initialize "otherHaptics" once at this point.
|
||||
std::vector<SDL_HapticID> existingHaptics;
|
||||
std::vector<MORTAR_HapticID> existingHaptics;
|
||||
|
||||
for (const auto& [id, mouse] : m_mice) {
|
||||
if (mouse.second) {
|
||||
existingHaptics.push_back(SDL_GetHapticID(mouse.second));
|
||||
existingHaptics.push_back(MORTAR_GetHapticID(mouse.second));
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto& [id, joystick] : m_joysticks) {
|
||||
if (joystick.second) {
|
||||
existingHaptics.push_back(SDL_GetHapticID(joystick.second));
|
||||
existingHaptics.push_back(MORTAR_GetHapticID(joystick.second));
|
||||
}
|
||||
}
|
||||
|
||||
int count;
|
||||
SDL_HapticID* haptics = SDL_GetHaptics(&count);
|
||||
MORTAR_HapticID* haptics = MORTAR_GetHaptics(&count);
|
||||
if (haptics) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (std::find(existingHaptics.begin(), existingHaptics.end(), haptics[i]) == existingHaptics.end()) {
|
||||
SDL_Haptic* haptic = SDL_OpenHaptic(haptics[i]);
|
||||
MORTAR_Haptic* haptic = MORTAR_OpenHaptic(haptics[i]);
|
||||
if (haptic) {
|
||||
if (SDL_InitHapticRumble(haptic)) {
|
||||
if (MORTAR_InitHapticRumble(haptic)) {
|
||||
m_otherHaptics[haptics[i]] = haptic;
|
||||
}
|
||||
else {
|
||||
SDL_CloseHaptic(haptic);
|
||||
MORTAR_CloseHaptic(haptic);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SDL_free(haptics);
|
||||
MORTAR_free(haptics);
|
||||
}
|
||||
}
|
||||
|
||||
void LegoInputManager::UpdateLastInputMethod(SDL_Event* p_event)
|
||||
void LegoInputManager::UpdateLastInputMethod(MORTAR_Event* p_event)
|
||||
{
|
||||
switch (p_event->type) {
|
||||
case SDL_EVENT_KEY_DOWN:
|
||||
case SDL_EVENT_KEY_UP:
|
||||
m_lastInputMethod = SDL_KeyboardID_v{p_event->key.which};
|
||||
case MORTAR_EVENT_KEY_DOWN:
|
||||
case MORTAR_EVENT_KEY_UP:
|
||||
m_lastInputMethod = MORTAR_KeyboardID_v{p_event->key.which};
|
||||
break;
|
||||
case SDL_EVENT_MOUSE_BUTTON_DOWN:
|
||||
case SDL_EVENT_MOUSE_BUTTON_UP:
|
||||
m_lastInputMethod = SDL_MouseID_v{p_event->button.which};
|
||||
case MORTAR_EVENT_MOUSE_BUTTON_DOWN:
|
||||
case MORTAR_EVENT_MOUSE_BUTTON_UP:
|
||||
m_lastInputMethod = MORTAR_MouseID_v{p_event->button.which};
|
||||
break;
|
||||
case SDL_EVENT_MOUSE_MOTION:
|
||||
m_lastInputMethod = SDL_MouseID_v{p_event->motion.which};
|
||||
case MORTAR_EVENT_MOUSE_MOTION:
|
||||
m_lastInputMethod = MORTAR_MouseID_v{p_event->motion.which};
|
||||
break;
|
||||
case SDL_EVENT_GAMEPAD_BUTTON_DOWN:
|
||||
case SDL_EVENT_GAMEPAD_BUTTON_UP:
|
||||
m_lastInputMethod = SDL_JoystickID_v{p_event->gbutton.which};
|
||||
case MORTAR_EVENT_GAMEPAD_BUTTON_DOWN:
|
||||
case MORTAR_EVENT_GAMEPAD_BUTTON_UP:
|
||||
m_lastInputMethod = MORTAR_JoystickID_v{p_event->gbutton.which};
|
||||
break;
|
||||
case SDL_EVENT_GAMEPAD_AXIS_MOTION:
|
||||
m_lastInputMethod = SDL_JoystickID_v{p_event->gaxis.which};
|
||||
case MORTAR_EVENT_GAMEPAD_AXIS_MOTION:
|
||||
m_lastInputMethod = MORTAR_JoystickID_v{p_event->gaxis.which};
|
||||
break;
|
||||
case SDL_EVENT_FINGER_MOTION:
|
||||
case SDL_EVENT_FINGER_DOWN:
|
||||
case SDL_EVENT_FINGER_UP:
|
||||
case SDL_EVENT_FINGER_CANCELED:
|
||||
m_lastInputMethod = SDL_TouchID_v{p_event->tfinger.touchID};
|
||||
case MORTAR_EVENT_FINGER_MOTION:
|
||||
case MORTAR_EVENT_FINGER_DOWN:
|
||||
case MORTAR_EVENT_FINGER_UP:
|
||||
case MORTAR_EVENT_FINGER_CANCELED:
|
||||
m_lastInputMethod = MORTAR_TouchID_v{p_event->tfinger.touchID};
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,8 +34,8 @@
|
||||
#include "scripts.h"
|
||||
#include "viewmanager/viewmanager.h"
|
||||
|
||||
#include <SDL3/SDL_log.h>
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_log.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoOmni, 0x140)
|
||||
DECOMP_SIZE_ASSERT(LegoOmni::WorldContainer, 0x1c)
|
||||
@ -190,22 +190,22 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param)
|
||||
p_param.CreateFlags().CreateTickleManager(FALSE);
|
||||
|
||||
if (!(m_tickleManager = new MxTickleManager())) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create MxTickleManager");
|
||||
MORTAR_LogError(MORTAR_LOG_CATEGORY_APPLICATION, "Failed to create MxTickleManager");
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (MxOmni::Create(p_param) != SUCCESS) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create MxOmni");
|
||||
MORTAR_LogError(MORTAR_LOG_CATEGORY_APPLICATION, "Failed to create MxOmni");
|
||||
goto done;
|
||||
}
|
||||
// LINE: BETA10 0x1008d7fa
|
||||
if (!(m_objectFactory = new LegoObjectFactory())) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create LegoObjectFactory");
|
||||
MORTAR_LogError(MORTAR_LOG_CATEGORY_APPLICATION, "Failed to create LegoObjectFactory");
|
||||
goto done;
|
||||
}
|
||||
// LINE: BETA10 0x1008d882
|
||||
if (!(m_soundManager = new LegoSoundManager()) || m_soundManager->Create(10, 0) != SUCCESS) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create LegoSoundManager");
|
||||
MORTAR_LogError(MORTAR_LOG_CATEGORY_APPLICATION, "Failed to create LegoSoundManager");
|
||||
delete m_soundManager;
|
||||
m_soundManager = NULL;
|
||||
goto done;
|
||||
@ -213,14 +213,14 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param)
|
||||
// LINE: BETA10 0x1008d990
|
||||
if (!(m_videoManager = new LegoVideoManager()) ||
|
||||
m_videoManager->Create(p_param.GetVideoParam(), 100, 0) != SUCCESS) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create LegoVideoManager");
|
||||
MORTAR_LogError(MORTAR_LOG_CATEGORY_APPLICATION, "Failed to create LegoVideoManager");
|
||||
delete m_videoManager;
|
||||
m_videoManager = NULL;
|
||||
goto done;
|
||||
}
|
||||
// LINE: BETA10 0x1008daa7
|
||||
if (!(m_inputManager = new LegoInputManager()) || m_inputManager->Create(p_param.GetWindowHandle()) != SUCCESS) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create LegoInputManager");
|
||||
MORTAR_LogError(MORTAR_LOG_CATEGORY_APPLICATION, "Failed to create LegoInputManager");
|
||||
delete m_inputManager;
|
||||
m_inputManager = NULL;
|
||||
goto done;
|
||||
@ -267,8 +267,8 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param)
|
||||
|
||||
if (!m_viewLODListManager || !m_textureContainer || !m_worldList || !m_characterManager || !m_plantManager ||
|
||||
!m_animationManager || !m_buildingManager) {
|
||||
SDL_LogError(
|
||||
SDL_LOG_CATEGORY_APPLICATION,
|
||||
MORTAR_LogError(
|
||||
MORTAR_LOG_CATEGORY_APPLICATION,
|
||||
"Failed to create "
|
||||
"ViewLODListManager/LegoTextureContainer/LegoCharacterManager/LegoPlantManager/LegoAnimationManager/"
|
||||
"LegoBuildingManager"
|
||||
@ -280,7 +280,7 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param)
|
||||
// LINE: BETA10 0x1008dfbd
|
||||
visibilityVar = new VisibilityVariable();
|
||||
if (!visibilityVar) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create VisibilityVariable");
|
||||
MORTAR_LogError(MORTAR_LOG_CATEGORY_APPLICATION, "Failed to create VisibilityVariable");
|
||||
goto done;
|
||||
}
|
||||
m_variableTable->SetVariable(visibilityVar);
|
||||
@ -288,7 +288,7 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param)
|
||||
// LINE: BETA10 0x1008e031
|
||||
cameraLocationVar = new CameraLocationVariable();
|
||||
if (!cameraLocationVar) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create CameraLocationVariable");
|
||||
MORTAR_LogError(MORTAR_LOG_CATEGORY_APPLICATION, "Failed to create CameraLocationVariable");
|
||||
goto done;
|
||||
}
|
||||
m_variableTable->SetVariable(cameraLocationVar);
|
||||
@ -296,7 +296,7 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param)
|
||||
// LINE: BETA10 0x1008e0a5
|
||||
cursorVar = new CursorVariable();
|
||||
if (!cursorVar) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create CursorVariable");
|
||||
MORTAR_LogError(MORTAR_LOG_CATEGORY_APPLICATION, "Failed to create CursorVariable");
|
||||
goto done;
|
||||
}
|
||||
m_variableTable->SetVariable(cursorVar);
|
||||
@ -304,7 +304,7 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param)
|
||||
// LINE: BETA10 0x1008e119
|
||||
whoAmIVar = new WhoAmIVariable();
|
||||
if (!whoAmIVar) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create WhoAmIVariable");
|
||||
MORTAR_LogError(MORTAR_LOG_CATEGORY_APPLICATION, "Failed to create WhoAmIVariable");
|
||||
goto done;
|
||||
}
|
||||
m_variableTable->SetVariable(whoAmIVar);
|
||||
@ -325,7 +325,7 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param)
|
||||
result = RegisterWorlds();
|
||||
|
||||
if (result != SUCCESS) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create RegisterWorlds");
|
||||
MORTAR_LogError(MORTAR_LOG_CATEGORY_APPLICATION, "Failed to create RegisterWorlds");
|
||||
goto done;
|
||||
}
|
||||
#endif
|
||||
@ -333,7 +333,7 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param)
|
||||
// LINE: BETA10 0x1008e206
|
||||
m_bkgAudioManager = new MxBackgroundAudioManager();
|
||||
if (!m_bkgAudioManager) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create MxBackgroundAudioManager");
|
||||
MORTAR_LogError(MORTAR_LOG_CATEGORY_APPLICATION, "Failed to create MxBackgroundAudioManager");
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -342,7 +342,10 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param)
|
||||
|
||||
if (m_transitionManager) {
|
||||
if (m_transitionManager->GetDDrawSurfaceFromVideoManager() != SUCCESS) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "MxTransitionManager::GetDDrawSurfaceFromVideoManager failed");
|
||||
MORTAR_LogError(
|
||||
MORTAR_LOG_CATEGORY_APPLICATION,
|
||||
"MxTransitionManager::GetDDrawSurfaceFromVideoManager failed"
|
||||
);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -358,7 +361,7 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param)
|
||||
result = SUCCESS;
|
||||
}
|
||||
else {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to create MxTransitionManager");
|
||||
MORTAR_LogError(MORTAR_LOG_CATEGORY_APPLICATION, "Failed to create MxTransitionManager");
|
||||
}
|
||||
done:
|
||||
return result;
|
||||
@ -526,7 +529,7 @@ LegoROI* LegoOmni::FindROI(const char* p_name)
|
||||
const char* name = roi->GetName();
|
||||
|
||||
if (name != NULL) {
|
||||
if (!SDL_strcasecmp(name, p_name)) {
|
||||
if (!MORTAR_strcasecmp(name, p_name)) {
|
||||
return roi;
|
||||
}
|
||||
}
|
||||
@ -542,7 +545,7 @@ MxEntity* LegoOmni::AddToWorld(const char* p_id, MxS32 p_entityId, MxPresenter*
|
||||
{
|
||||
LegoWorld* world;
|
||||
|
||||
if (SDL_strcasecmp(p_id, g_current)) {
|
||||
if (MORTAR_strcasecmp(p_id, g_current)) {
|
||||
world = FindWorld(MxAtomId(p_id, e_lowerCase2), p_entityId);
|
||||
}
|
||||
else {
|
||||
@ -622,7 +625,7 @@ LegoOmni::World LegoOmni::GetWorldId(const char* p_key)
|
||||
for (MxS32 i = 0; i < e_numWorlds; i++) {
|
||||
// Note: m_key is never NULL
|
||||
if (m_worlds[i].m_key != NULL) {
|
||||
if (!SDL_strcasecmp(m_worlds[i].m_key, p_key)) {
|
||||
if (!MORTAR_strcasecmp(m_worlds[i].m_key, p_key)) {
|
||||
return m_worlds[i].m_id;
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ void LegoExtraActor::VTable0xa4(MxBool& p_und1, MxS32& p_und2)
|
||||
break;
|
||||
default:
|
||||
p_und1 = TRUE;
|
||||
p_und2 = 1 + SDL_rand(p_und2);
|
||||
p_und2 = 1 + MORTAR_rand(p_und2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
#include "mxutilities.h"
|
||||
#include "mxvariabletable.h"
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <mortar/mortar.h>
|
||||
#include <mxdebug.h>
|
||||
#include <vec.h>
|
||||
|
||||
@ -729,7 +729,7 @@ void LegoPathActor::VTable0xa4(MxBool& p_und1, MxS32& p_und2)
|
||||
case c_nick:
|
||||
case c_brickster:
|
||||
p_und1 = TRUE;
|
||||
p_und2 = SDL_rand(p_und2) + 1;
|
||||
p_und2 = MORTAR_rand(p_und2) + 1;
|
||||
break;
|
||||
case c_laura:
|
||||
p_und1 = FALSE;
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
#include "legopathactor.h"
|
||||
#include "legopathstruct.h"
|
||||
|
||||
#include <SDL3/SDL_log.h>
|
||||
#include <mortar/mortar_log.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoPathBoundary, 0x74)
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
#include "mxticklemanager.h"
|
||||
#include "mxtimer.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoPathController, 0x40)
|
||||
DECOMP_SIZE_ASSERT(LegoPathCtrlEdge, 0x40)
|
||||
@ -109,7 +109,7 @@ MxResult LegoPathController::Create(
|
||||
MxS32 j;
|
||||
|
||||
for (j = 0; j < sizeOfArray(g_unk0x100f42f0); j++) {
|
||||
if (!SDL_strcasecmp(g_unk0x100f42f0[j], boundary.GetName())) {
|
||||
if (!MORTAR_strcasecmp(g_unk0x100f42f0[j], boundary.GetName())) {
|
||||
g_ctrlBoundariesA[j].m_controller = this;
|
||||
g_ctrlBoundariesA[j].m_boundary = &boundary;
|
||||
|
||||
@ -120,7 +120,7 @@ MxResult LegoPathController::Create(
|
||||
}
|
||||
|
||||
for (j = 0; j < sizeOfArray(g_unk0x100f4330); j++) {
|
||||
if (!SDL_strcasecmp(g_unk0x100f4330[j], boundary.GetName())) {
|
||||
if (!MORTAR_strcasecmp(g_unk0x100f4330[j], boundary.GetName())) {
|
||||
g_ctrlBoundariesB[j].m_controller = this;
|
||||
g_ctrlBoundariesB[j].m_boundary = &boundary;
|
||||
g_ctrlEdgesB[j].m_controller = this;
|
||||
@ -400,7 +400,7 @@ MxResult LegoPathController::FUN_10046b30(LegoPathBoundary*& p_boundaries, MxS32
|
||||
LegoPathBoundary* LegoPathController::GetPathBoundary(const char* p_name)
|
||||
{
|
||||
for (MxS32 i = 0; i < m_numL; i++) {
|
||||
if (!SDL_strcasecmp(m_boundaries[i].GetName(), p_name)) {
|
||||
if (!MORTAR_strcasecmp(m_boundaries[i].GetName(), p_name)) {
|
||||
return &m_boundaries[i];
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ void LegoPathPresenter::ParseExtra()
|
||||
memcpy(extraCopy, extraData, extraLength);
|
||||
extraCopy[extraLength] = '\0';
|
||||
|
||||
SDL_strupr(extraCopy);
|
||||
MORTAR_strupr(extraCopy);
|
||||
|
||||
if (KeyValueStringParse(output, g_strTRIGGERS_SOURCE, extraCopy) != FALSE) {
|
||||
m_trigger = MxAtomId(output, e_lowerCase2);
|
||||
|
||||
@ -129,7 +129,7 @@ void CarRace::ReadyWorld()
|
||||
AnimationManager()->Resume();
|
||||
Disable(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
|
||||
|
||||
m_introAnimation = g_introAnimations[SDL_rand(8)];
|
||||
m_introAnimation = g_introAnimations[MORTAR_rand(8)];
|
||||
|
||||
AnimationManager()
|
||||
->FUN_10060dc0(m_introAnimation, NULL, TRUE, LegoAnimationManager::e_unk0, NULL, FALSE, TRUE, FALSE, TRUE);
|
||||
@ -235,24 +235,24 @@ MxLong CarRace::HandlePathStruct(LegoPathStructNotificationParam& p_param)
|
||||
|
||||
if (m_opponent1Laps < m_playerLaps && m_opponent2Laps < m_playerLaps) {
|
||||
score = 3;
|
||||
m_firstFinishAnimation = g_studsLoosesAnimation[SDL_rand(3)];
|
||||
m_secondFinishAnimation = g_rhodaLoosesAnimation[SDL_rand(3)];
|
||||
m_firstFinishAnimation = g_studsLoosesAnimation[MORTAR_rand(3)];
|
||||
m_secondFinishAnimation = g_rhodaLoosesAnimation[MORTAR_rand(3)];
|
||||
}
|
||||
else if (m_opponent1Laps < m_playerLaps || m_opponent2Laps < m_playerLaps) {
|
||||
score = 2;
|
||||
if (m_opponent1Laps == g_lapsCount) {
|
||||
m_firstFinishAnimation = g_studsWinsAnimations[SDL_rand(4)];
|
||||
m_secondFinishAnimation = g_rhodaLoosesAnimation[SDL_rand(3)];
|
||||
m_firstFinishAnimation = g_studsWinsAnimations[MORTAR_rand(4)];
|
||||
m_secondFinishAnimation = g_rhodaLoosesAnimation[MORTAR_rand(3)];
|
||||
}
|
||||
else {
|
||||
m_firstFinishAnimation = g_rhodaWinsAnimations[SDL_rand(3)];
|
||||
m_secondFinishAnimation = g_studsLoosesAnimation[SDL_rand(3)];
|
||||
m_firstFinishAnimation = g_rhodaWinsAnimations[MORTAR_rand(3)];
|
||||
m_secondFinishAnimation = g_studsLoosesAnimation[MORTAR_rand(3)];
|
||||
}
|
||||
}
|
||||
else {
|
||||
score = 1;
|
||||
m_firstFinishAnimation = g_studsWinsAnimations[SDL_rand(4)];
|
||||
m_secondFinishAnimation = g_rhodaWinsAnimations[SDL_rand(3)];
|
||||
m_firstFinishAnimation = g_studsWinsAnimations[MORTAR_rand(4)];
|
||||
m_secondFinishAnimation = g_rhodaWinsAnimations[MORTAR_rand(3)];
|
||||
}
|
||||
|
||||
InputManager()->DisableInputProcessing();
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
#include "mxvariabletable.h"
|
||||
#include "raceskel.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
#include <stdio.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(EdgeReference, 0x08)
|
||||
@ -218,10 +218,10 @@ void LegoRaceCar::InitSoundIndices()
|
||||
{
|
||||
// Note the (likely unintentional) order of operations: `%` is executed before `/`,
|
||||
// so the division is performed at runtime.
|
||||
g_playerHitStudsSoundsIndex = SDL_rand(sizeOfArray(g_playerHitStudsSounds));
|
||||
g_studsHitPlayerSoundsIndex = SDL_rand(sizeOfArray(g_studsHitPlayerSounds));
|
||||
g_playerHitRhodaSoundsIndex = SDL_rand(sizeOfArray(g_playerHitRhodaSounds));
|
||||
g_rhodaHitPlayerSoundsIndex = SDL_rand(sizeOfArray(g_rhodaHitPlayerSounds));
|
||||
g_playerHitStudsSoundsIndex = MORTAR_rand(sizeOfArray(g_playerHitStudsSounds));
|
||||
g_studsHitPlayerSoundsIndex = MORTAR_rand(sizeOfArray(g_studsHitPlayerSounds));
|
||||
g_playerHitRhodaSoundsIndex = MORTAR_rand(sizeOfArray(g_playerHitRhodaSounds));
|
||||
g_rhodaHitPlayerSoundsIndex = MORTAR_rand(sizeOfArray(g_rhodaHitPlayerSounds));
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10012e60
|
||||
@ -479,8 +479,8 @@ MxResult LegoRaceCar::HitActor(LegoPathActor* p_actor, MxBool p_bool)
|
||||
}
|
||||
|
||||
if (m_userNavFlag) {
|
||||
MxBool actorIsStuds = SDL_strcasecmp(p_actor->GetROI()->GetName(), "studs") == 0;
|
||||
MxBool actorIsRhoda = SDL_strcasecmp(p_actor->GetROI()->GetName(), "rhoda") == 0;
|
||||
MxBool actorIsStuds = MORTAR_strcasecmp(p_actor->GetROI()->GetName(), "studs") == 0;
|
||||
MxBool actorIsRhoda = MORTAR_strcasecmp(p_actor->GetROI()->GetName(), "rhoda") == 0;
|
||||
MxLong time = Timer()->GetTime();
|
||||
|
||||
const char* soundKey = NULL;
|
||||
@ -577,8 +577,8 @@ MxResult LegoRaceCar::VTable0x9c()
|
||||
void LegoJetski::InitSoundIndices()
|
||||
{
|
||||
// See note in LegoRaceCar::InitSoundIndices
|
||||
g_hitSnapSoundsIndex = SDL_rand(sizeOfArray(g_hitSnapSounds));
|
||||
g_hitValerieSoundsIndex = SDL_rand(sizeOfArray(g_hitValerieSounds));
|
||||
g_hitSnapSoundsIndex = MORTAR_rand(sizeOfArray(g_hitSnapSounds));
|
||||
g_hitValerieSoundsIndex = MORTAR_rand(sizeOfArray(g_hitValerieSounds));
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100136a0
|
||||
@ -696,8 +696,8 @@ MxResult LegoJetski::HitActor(LegoPathActor* p_actor, MxBool p_bool)
|
||||
}
|
||||
|
||||
if (m_userNavFlag) {
|
||||
MxBool actorIsSnap = SDL_strcasecmp(p_actor->GetROI()->GetName(), "snap") == 0;
|
||||
MxBool actorIsValerie = SDL_strcasecmp(p_actor->GetROI()->GetName(), "valerie") == 0;
|
||||
MxBool actorIsSnap = MORTAR_strcasecmp(p_actor->GetROI()->GetName(), "snap") == 0;
|
||||
MxBool actorIsValerie = MORTAR_strcasecmp(p_actor->GetROI()->GetName(), "valerie") == 0;
|
||||
MxLong time = Timer()->GetTime();
|
||||
|
||||
const char* soundKey = NULL;
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
#include "mxmisc.h"
|
||||
#include "mxvariabletable.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
#include <vec.h>
|
||||
|
||||
// File name verified by BETA10 0x100cedf7
|
||||
@ -228,7 +228,7 @@ void LegoCarRaceActor::Animate(float p_time)
|
||||
if (m_animState == 0) {
|
||||
const char* value = VariableTable()->GetVariable(g_raceState);
|
||||
|
||||
if (SDL_strcasecmp(value, g_racing) == 0) {
|
||||
if (MORTAR_strcasecmp(value, g_racing) == 0) {
|
||||
m_animState = 1;
|
||||
m_lastTime = p_time - 1.0f;
|
||||
m_unk0x1c = p_time;
|
||||
@ -401,7 +401,7 @@ void LegoJetskiRaceActor::Animate(float p_time)
|
||||
{
|
||||
if (m_animState == 0) {
|
||||
const LegoChar* raceState = VariableTable()->GetVariable(g_raceState);
|
||||
if (!SDL_strcasecmp(raceState, g_racing)) {
|
||||
if (!MORTAR_strcasecmp(raceState, g_racing)) {
|
||||
m_animState = 1;
|
||||
m_lastTime = p_time - 1.0f;
|
||||
m_unk0x1c = p_time;
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
#include "realtime/realtime.h"
|
||||
#include "viewmanager/viewmanager.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
#include <stdio.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoAnimPresenter, 0xbc)
|
||||
@ -250,7 +250,7 @@ void LegoAnimPresenter::FUN_100692b0()
|
||||
else if (actorType == LegoAnimActorEntry::e_actorType4) {
|
||||
LegoChar* baseName = new LegoChar[strlen(str)];
|
||||
strcpy(baseName, str + 1);
|
||||
SDL_strlwr(baseName);
|
||||
MORTAR_strlwr(baseName);
|
||||
|
||||
LegoChar* und = FUN_10069150(str);
|
||||
roi = CharacterManager()->FUN_10085a80(und, baseName, TRUE);
|
||||
@ -274,7 +274,7 @@ void LegoAnimPresenter::FUN_100692b0()
|
||||
*i = '\0';
|
||||
}
|
||||
|
||||
SDL_strlwr(lodName);
|
||||
MORTAR_strlwr(lodName);
|
||||
|
||||
LegoChar* und = FUN_10069150(str);
|
||||
roi = CharacterManager()->CreateAutoROI(und, lodName, TRUE);
|
||||
@ -317,11 +317,11 @@ void LegoAnimPresenter::FUN_100695c0()
|
||||
LegoU32 len = strlen(actorName);
|
||||
strcpy(lodName, actorName);
|
||||
|
||||
for (LegoChar* i = &lodName[len - 1]; SDL_isdigit(*i) || *i == '_'; i--) {
|
||||
for (LegoChar* i = &lodName[len - 1]; MORTAR_isdigit(*i) || *i == '_'; i--) {
|
||||
*i = '\0';
|
||||
}
|
||||
|
||||
SDL_strlwr(lodName);
|
||||
MORTAR_strlwr(lodName);
|
||||
|
||||
CharacterManager()->CreateAutoROI(actorName, lodName, FALSE);
|
||||
FUN_100698b0(rois, actorName);
|
||||
@ -376,7 +376,7 @@ LegoBool LegoAnimPresenter::FUN_100698b0(const CompoundObject& p_rois, const Leg
|
||||
const char* name = roi->GetName();
|
||||
|
||||
if (name != NULL) {
|
||||
if (!SDL_strcasecmp(name, str)) {
|
||||
if (!MORTAR_strcasecmp(name, str)) {
|
||||
m_sceneROIs->Append(roi);
|
||||
result = TRUE;
|
||||
break;
|
||||
@ -398,7 +398,7 @@ LegoROI* LegoAnimPresenter::FindROI(const LegoChar* p_name)
|
||||
while (cursor.Next(roi)) {
|
||||
LegoChar* nameOrVar = GetVariableOrIdentity(roi->GetName(), NULL);
|
||||
|
||||
if (nameOrVar != NULL && !SDL_strcasecmp(nameOrVar, p_name)) {
|
||||
if (nameOrVar != NULL && !MORTAR_strcasecmp(nameOrVar, p_name)) {
|
||||
delete[] nameOrVar;
|
||||
return roi;
|
||||
}
|
||||
@ -436,7 +436,7 @@ void LegoAnimPresenter::FUN_10069b10()
|
||||
if (m_roiMap[index]->GetName() != NULL) {
|
||||
for (MxS32 i = 0; i < m_unk0x94; i++) {
|
||||
if (m_unk0x8c[i] == NULL && m_unk0x90[i] != NULL) {
|
||||
if (!SDL_strcasecmp(m_unk0x90[i], m_roiMap[index]->GetName())) {
|
||||
if (!MORTAR_strcasecmp(m_unk0x90[i], m_roiMap[index]->GetName())) {
|
||||
m_unk0x8c[i] = m_roiMap[index];
|
||||
break;
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
#include "realtime/realtime.h"
|
||||
#include "roi/legoroi.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoModelPresenter, 0x6c)
|
||||
|
||||
@ -95,7 +95,7 @@ MxResult LegoModelPresenter::CreateROI(MxDSChunk* p_chunk)
|
||||
storage.Read(textureName, textureNameLength);
|
||||
textureName[textureNameLength] = '\0';
|
||||
|
||||
SDL_strlwr(textureName);
|
||||
MORTAR_strlwr(textureName);
|
||||
|
||||
if (textureName[0] == '^') {
|
||||
memmove(textureName, textureName + 1, strlen(textureName));
|
||||
@ -313,7 +313,7 @@ void LegoModelPresenter::ParseExtra()
|
||||
list<LegoROI*>& roiList = currentWorld->GetROIList();
|
||||
|
||||
for (list<LegoROI*>::iterator it = roiList.begin(); it != roiList.end(); it++) {
|
||||
if (!SDL_strcasecmp((*it)->GetName(), output)) {
|
||||
if (!MORTAR_strcasecmp((*it)->GetName(), output)) {
|
||||
m_roi = *it;
|
||||
roiList.erase(it);
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
#include "mxdssubscriber.h"
|
||||
#include "viewmanager/viewlodlist.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoLODList, 0x18)
|
||||
DECOMP_SIZE_ASSERT(LegoNamedPart, 0x14)
|
||||
@ -90,7 +90,7 @@ MxResult LegoPartPresenter::Read(MxDSChunk& p_chunk)
|
||||
storage.Read(textureName, textureNameLength);
|
||||
textureName[textureNameLength] = '\0';
|
||||
|
||||
SDL_strlwr(textureName);
|
||||
MORTAR_strlwr(textureName);
|
||||
|
||||
if (textureName[0] == '^') {
|
||||
memmove(textureName, textureName + 1, strlen(textureName));
|
||||
@ -164,7 +164,7 @@ MxResult LegoPartPresenter::Read(MxDSChunk& p_chunk)
|
||||
}
|
||||
|
||||
roiName[roiNameLength] = '\0';
|
||||
SDL_strlwr(roiName);
|
||||
MORTAR_strlwr(roiName);
|
||||
|
||||
if (storage.Read(&numLODs, sizeof(LegoU32)) != SUCCESS) {
|
||||
goto done;
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
#include "mxdirectx/mxdirect3d.h"
|
||||
#include "mxdssubscriber.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoTexturePresenter, 0x54)
|
||||
DECOMP_SIZE_ASSERT(LegoNamedTexture, 0x14)
|
||||
@ -59,7 +59,7 @@ MxResult LegoTexturePresenter::Read(MxDSChunk& p_chunk)
|
||||
}
|
||||
|
||||
textureName[textureNameLength] = '\0';
|
||||
SDL_strlwr(textureName);
|
||||
MORTAR_strlwr(textureName);
|
||||
|
||||
texture = new LegoTexture();
|
||||
if (texture->Read(&storage, hardwareMode) != SUCCESS) {
|
||||
|
||||
@ -19,8 +19,8 @@
|
||||
#include "tgl/d3drm/impl.h"
|
||||
#include "viewmanager/viewroi.h"
|
||||
|
||||
#include <SDL3/SDL_log.h>
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_log.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
#include <stdio.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoVideoManager, 0x590)
|
||||
@ -97,7 +97,7 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
|
||||
p_videoParam.SetPalette(palette);
|
||||
|
||||
if (!p_videoParam.GetPalette()) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "MxPalette::GetPalette returned NULL palette");
|
||||
MORTAR_LogError(MORTAR_LOG_CATEGORY_APPLICATION, "MxPalette::GetPalette returned NULL palette");
|
||||
goto done;
|
||||
}
|
||||
paletteCreated = TRUE;
|
||||
@ -107,12 +107,12 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
|
||||
p_videoParam.GetPalette()->GetEntries(paletteEntries);
|
||||
|
||||
if (CreateDirect3D() != SUCCESS) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "::CreateDirect3D failed");
|
||||
MORTAR_LogError(MORTAR_LOG_CATEGORY_APPLICATION, "::CreateDirect3D failed");
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (deviceEnumerate.DoEnumerate(hwnd) != SUCCESS) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "LegoDeviceEnumerate::DoEnumerate failed");
|
||||
MORTAR_LogError(MORTAR_LOG_CATEGORY_APPLICATION, "LegoDeviceEnumerate::DoEnumerate failed");
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -153,7 +153,7 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
|
||||
paletteEntries,
|
||||
sizeof(paletteEntries) / sizeof(paletteEntries[0])
|
||||
)) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "MxDirect3D::Create failed");
|
||||
MORTAR_LogError(MORTAR_LOG_CATEGORY_APPLICATION, "MxDirect3D::Create failed");
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -167,21 +167,21 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
|
||||
p_frequencyMS,
|
||||
p_createThread
|
||||
) != SUCCESS) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "MxVideoManager::VTable0x28 failed");
|
||||
MORTAR_LogError(MORTAR_LOG_CATEGORY_APPLICATION, "MxVideoManager::VTable0x28 failed");
|
||||
goto done;
|
||||
}
|
||||
|
||||
m_renderer = Tgl::CreateRenderer();
|
||||
|
||||
if (!m_renderer) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Tgl::CreateRenderer failed");
|
||||
MORTAR_LogError(MORTAR_LOG_CATEGORY_APPLICATION, "Tgl::CreateRenderer failed");
|
||||
goto done;
|
||||
}
|
||||
|
||||
m_3dManager = new Lego3DManager;
|
||||
|
||||
if (!m_3dManager) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Lego3DManager::Lego3DManager failed");
|
||||
MORTAR_LogError(MORTAR_LOG_CATEGORY_APPLICATION, "Lego3DManager::Lego3DManager failed");
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -198,14 +198,14 @@ MxResult LegoVideoManager::Create(MxVideoParam& p_videoParam, MxU32 p_frequencyM
|
||||
createStruct.m_d3dDevice = m_direct3d->Direct3DDevice();
|
||||
|
||||
if (!m_3dManager->Create(createStruct)) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Lego3DManager::Create failed");
|
||||
MORTAR_LogError(MORTAR_LOG_CATEGORY_APPLICATION, "Lego3DManager::Create failed");
|
||||
goto done;
|
||||
}
|
||||
|
||||
ViewLODList* pLODList;
|
||||
|
||||
if (ConfigureD3DRM() != SUCCESS) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "LegoVideoManager::ConfigureD3DRM failed");
|
||||
MORTAR_LogError(MORTAR_LOG_CATEGORY_APPLICATION, "LegoVideoManager::ConfigureD3DRM failed");
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -515,7 +515,7 @@ MxPresenter* LegoVideoManager::GetPresenterByActionObjectName(const char* p_acti
|
||||
continue;
|
||||
}
|
||||
|
||||
if (SDL_strcasecmp(presenter->GetAction()->GetObjectName(), p_actionObjectName) == 0) {
|
||||
if (MORTAR_strcasecmp(presenter->GetAction()->GetObjectName(), p_actionObjectName) == 0) {
|
||||
return presenter;
|
||||
}
|
||||
}
|
||||
|
||||
@ -683,7 +683,7 @@ void Act3::ReadyWorld()
|
||||
AnimationManager()->FUN_1005f6d0(FALSE);
|
||||
VideoManager()->Get3DManager()->SetFrustrum(90.0f, 0.1f, 125.0f);
|
||||
|
||||
m_unk0x426c = g_unk0x100d95e8[SDL_rand(3)];
|
||||
m_unk0x426c = g_unk0x100d95e8[MORTAR_rand(3)];
|
||||
AnimationManager()
|
||||
->FUN_10060dc0(m_unk0x426c, NULL, TRUE, LegoAnimationManager::e_unk0, NULL, TRUE, FALSE, FALSE, FALSE);
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
#include "radio.h"
|
||||
#include "scripts.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(GasStation, 0x128)
|
||||
DECOMP_SIZE_ASSERT(GasStationState, 0x24)
|
||||
@ -346,9 +346,9 @@ MxLong GasStation::HandleEndAction(MxEndActionNotificationParam& p_param)
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10005920
|
||||
MxLong GasStation::HandleKeyPress(SDL_Keycode p_key)
|
||||
MxLong GasStation::HandleKeyPress(MORTAR_Keycode p_key)
|
||||
{
|
||||
if (p_key == SDLK_SPACE && g_animationSkipCounterGasStation == 0 && m_setWithCurrentAction != 0) {
|
||||
if (p_key == MORTARK_SPACE && g_animationSkipCounterGasStation == 0 && m_setWithCurrentAction != 0) {
|
||||
m_state->StopActions();
|
||||
return 1;
|
||||
}
|
||||
@ -364,7 +364,7 @@ MxLong GasStation::HandleButtonDown(LegoControlManagerNotificationParam& p_param
|
||||
LegoROI* roi = PickROI(p_param.GetX(), p_param.GetY());
|
||||
|
||||
if (roi != NULL) {
|
||||
if (!SDL_strncasecmp(roi->GetName(), "capdb", 5) || !SDL_strncasecmp(roi->GetName(), "*capdb", 6)) {
|
||||
if (!MORTAR_strncasecmp(roi->GetName(), "capdb", 5) || !MORTAR_strncasecmp(roi->GetName(), "*capdb", 6)) {
|
||||
m_waitingState = e_canceled;
|
||||
m_waiting = FALSE;
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
#include "mxstillpresenter.h"
|
||||
#include "mxtransitionmanager.h"
|
||||
|
||||
#include <SDL3/SDL_log.h>
|
||||
#include <mortar/mortar_log.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(HistoryBook, 0x3e4)
|
||||
|
||||
@ -194,8 +194,8 @@ void HistoryBook::ReadyWorld()
|
||||
index += m_intAlphabetOffset;
|
||||
|
||||
if (index >= sizeOfArray(m_intAlphabet) || !m_intAlphabet[index]) {
|
||||
SDL_Log("Warning: international character not present in current game. Falling back to X");
|
||||
return &m_alphabet[SDLK_X - SDLK_A];
|
||||
MORTAR_Log("Warning: international character not present in current game. Falling back to X");
|
||||
return &m_alphabet[MORTARK_X - MORTARK_A];
|
||||
}
|
||||
|
||||
return &m_intAlphabet[index];
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
#include "mxtransitionmanager.h"
|
||||
#include "scripts.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(Hospital, 0x12c)
|
||||
DECOMP_SIZE_ASSERT(HospitalState, 0x18)
|
||||
@ -220,11 +220,11 @@ void Hospital::ReadyWorld()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10074dd0
|
||||
MxLong Hospital::HandleKeyPress(SDL_Keycode p_key)
|
||||
MxLong Hospital::HandleKeyPress(MORTAR_Keycode p_key)
|
||||
{
|
||||
MxLong result = 0;
|
||||
|
||||
if (p_key == SDLK_SPACE && g_animationSkipCounterHospital == 0) {
|
||||
if (p_key == MORTARK_SPACE && g_animationSkipCounterHospital == 0) {
|
||||
DeleteObjects(&m_atomId, HospitalScript::c_hho002cl_RunAnim, HospitalScript::c_hho006cl_RunAnim);
|
||||
result = 1;
|
||||
}
|
||||
@ -406,7 +406,7 @@ MxLong Hospital::HandleButtonDown(LegoControlManagerNotificationParam& p_param)
|
||||
roiName += 1;
|
||||
}
|
||||
|
||||
if (!SDL_strcasecmp("actor_ha", roiName)) {
|
||||
if (!MORTAR_strcasecmp("actor_ha", roiName)) {
|
||||
InputManager()->DisableInputProcessing();
|
||||
|
||||
m_interactionMode = 3;
|
||||
|
||||
@ -709,11 +709,11 @@ MxU8 Infocenter::HandleMouseMove(MxS32 p_x, MxS32 p_y)
|
||||
|
||||
// FUNCTION: LEGO1 0x1006fda0
|
||||
// FUNCTION: BETA10 0x1002f907
|
||||
MxLong Infocenter::HandleKeyPress(SDL_Keycode p_key)
|
||||
MxLong Infocenter::HandleKeyPress(MORTAR_Keycode p_key)
|
||||
{
|
||||
MxLong result = 0;
|
||||
|
||||
if (p_key == SDLK_SPACE && m_worldStarted) {
|
||||
if (p_key == MORTARK_SPACE && m_worldStarted) {
|
||||
switch (m_infocenterState->m_state) {
|
||||
case InfocenterState::e_playCutscene:
|
||||
StopCutscene();
|
||||
@ -1147,7 +1147,9 @@ MxLong Infocenter::HandleNotification0(MxNotificationParam& p_param)
|
||||
PlayAction(InfomainScript::c_iic043in_RunAnim);
|
||||
}
|
||||
}
|
||||
else if (sender->IsA("MxEntity") && m_infocenterState->m_state != InfocenterState::e_selectedCharacterAndDestination && m_infocenterState->m_state != InfocenterState::e_exiting) {
|
||||
else if (sender->IsA("MxEntity") &&
|
||||
m_infocenterState->m_state != InfocenterState::e_selectedCharacterAndDestination &&
|
||||
m_infocenterState->m_state != InfocenterState::e_exiting) {
|
||||
switch (((MxEntity*) sender)->GetEntityId()) {
|
||||
case 5: {
|
||||
m_infoManDialogueTimer = 0;
|
||||
|
||||
@ -385,7 +385,7 @@ MxLong Isle::HandleControl(LegoControlManagerNotificationParam& p_param)
|
||||
break;
|
||||
case IsleScript::c_Observe_Plane_Ctl:
|
||||
if (!m_act1state->m_planeActive) {
|
||||
switch (SDL_rand(3)) {
|
||||
switch (MORTAR_rand(3)) {
|
||||
case 0:
|
||||
InvokeAction(Extra::e_start, *g_isleScript, IsleScript::c_nic002pr_RunAnim, NULL);
|
||||
break;
|
||||
@ -573,7 +573,7 @@ void Isle::Enable(MxBool p_enable)
|
||||
MxS32 locations[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
|
||||
|
||||
for (MxU32 i = 0; i < 5; i++) {
|
||||
MxS32 r = SDL_rand(5);
|
||||
MxS32 r = MORTAR_rand(5);
|
||||
|
||||
for (MxU32 j = 0; j < sizeOfArray(locations); j++) {
|
||||
if (locations[j] != 0 && r-- == 0) {
|
||||
|
||||
@ -173,7 +173,7 @@ MxResult LegoAct2::Tickle()
|
||||
case LegoAct2::e_startSpeech:
|
||||
((LegoPathActor*) m_pepper->GetEntity())->SetActorState(LegoPathActor::c_disabled);
|
||||
|
||||
switch (SDL_rand(3)) {
|
||||
switch (MORTAR_rand(3)) {
|
||||
case 0:
|
||||
g_bricksterSpeech = Act2mainScript::c_tns002br_RunAnim;
|
||||
break;
|
||||
@ -817,7 +817,7 @@ void LegoAct2::SpawnBricks()
|
||||
// Unused but present in BETA
|
||||
LegoEntity* entity;
|
||||
|
||||
if (SDL_rand(2) == 1) {
|
||||
if (MORTAR_rand(2) == 1) {
|
||||
m_firstBrick = 0;
|
||||
location = infobridge;
|
||||
MxTrace("infobridge\n");
|
||||
@ -841,7 +841,7 @@ void LegoAct2::SpawnBricks()
|
||||
roi = brick->GetROI();
|
||||
local2world = roi->GetLocal2World();
|
||||
|
||||
if (SDL_rand(2) == 1) {
|
||||
if (MORTAR_rand(2) == 1) {
|
||||
m_secondBrick = 2;
|
||||
location = store;
|
||||
MxTrace("store\n");
|
||||
@ -865,7 +865,7 @@ void LegoAct2::SpawnBricks()
|
||||
roi = brick->GetROI();
|
||||
local2world = roi->GetLocal2World();
|
||||
|
||||
if (SDL_rand(2) == 1) {
|
||||
if (MORTAR_rand(2) == 1) {
|
||||
m_thirdBrick = 4;
|
||||
location = h3;
|
||||
MxTrace("h3\n");
|
||||
@ -889,8 +889,8 @@ void LegoAct2::SpawnBricks()
|
||||
roi = brick->GetROI();
|
||||
local2world = roi->GetLocal2World();
|
||||
|
||||
if (SDL_rand(2) == 1) {
|
||||
if (SDL_rand(2) == 1) {
|
||||
if (MORTAR_rand(2) == 1) {
|
||||
if (MORTAR_rand(2) == 1) {
|
||||
m_fourthBrick = 6;
|
||||
location = posta;
|
||||
MxTrace("po.sta.\n");
|
||||
@ -902,7 +902,7 @@ void LegoAct2::SpawnBricks()
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (SDL_rand(2) == 1) {
|
||||
if (MORTAR_rand(2) == 1) {
|
||||
m_fourthBrick = 8;
|
||||
location = jail;
|
||||
MxTrace("jail\n");
|
||||
@ -948,7 +948,7 @@ MxResult LegoAct2::BadEnding()
|
||||
// FUNCTION: BETA10 0x10013fd3
|
||||
void LegoAct2::CheckBricksterDestroying(MxS32 p_pathData)
|
||||
{
|
||||
MxU8 randN = SDL_rand(3);
|
||||
MxU8 randN = MORTAR_rand(3);
|
||||
randN++;
|
||||
|
||||
switch (p_pathData) {
|
||||
|
||||
@ -161,7 +161,7 @@ MxLong Police::HandleKeyPress(LegoEventNotificationParam& p_param)
|
||||
{
|
||||
MxLong result = 0;
|
||||
|
||||
if (p_param.GetKey() == SDLK_SPACE && m_policeState->GetState() == PoliceState::e_playingAnimation) {
|
||||
if (p_param.GetKey() == MORTARK_SPACE && m_policeState->GetState() == PoliceState::e_playingAnimation) {
|
||||
DeleteObjects(&m_atomId, PoliceScript::c_nps001ni_RunAnim, PoliceScript::c_nps002la_RunAnim);
|
||||
m_policeState->SetState(PoliceState::e_noAnimation);
|
||||
return 1;
|
||||
@ -198,7 +198,7 @@ MxBool Police::Escape()
|
||||
PoliceState::PoliceState()
|
||||
{
|
||||
m_state = PoliceState::e_noAnimation;
|
||||
m_policeScript = (SDL_rand(2) == 0) ? PoliceScript::c_nps002la_RunAnim : PoliceScript::c_nps001ni_RunAnim;
|
||||
m_policeScript = (MORTAR_rand(2) == 0) ? PoliceScript::c_nps002la_RunAnim : PoliceScript::c_nps001ni_RunAnim;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1005e990
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
#include "regbook_actions.h"
|
||||
#include "scripts.h"
|
||||
|
||||
#include <SDL3/SDL_log.h>
|
||||
#include <mortar/mortar_log.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(RegistrationBook, 0x2d0)
|
||||
|
||||
@ -173,14 +173,14 @@ MxLong RegistrationBook::HandleEndAction(MxEndActionNotificationParam& p_param)
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100772d0
|
||||
MxLong RegistrationBook::HandleKeyPress(SDL_Keycode p_key)
|
||||
MxLong RegistrationBook::HandleKeyPress(MORTAR_Keycode p_key)
|
||||
{
|
||||
// keycode is case-insensitive
|
||||
SDL_Keycode key = p_key;
|
||||
MORTAR_Keycode key = p_key;
|
||||
|
||||
MxStillPresenter** intoAlphabet = [this, key]() -> MxStillPresenter** {
|
||||
if (key >= SDLK_A && key <= SDLK_Z) {
|
||||
return &m_alphabet[key - SDLK_A];
|
||||
if (key >= MORTARK_A && key <= MORTARK_Z) {
|
||||
return &m_alphabet[key - MORTARK_A];
|
||||
}
|
||||
|
||||
for (int i = 0; i < sizeOfArray(m_intAlphabet); i++) {
|
||||
@ -192,13 +192,13 @@ MxLong RegistrationBook::HandleKeyPress(SDL_Keycode p_key)
|
||||
return nullptr;
|
||||
}();
|
||||
|
||||
if (!intoAlphabet && key != SDLK_BACKSPACE) {
|
||||
if (key == SDLK_SPACE) {
|
||||
if (!intoAlphabet && key != MORTARK_BACKSPACE) {
|
||||
if (key == MORTARK_SPACE) {
|
||||
DeleteObjects(&m_atomId, RegbookScript::c_iic006in_RunAnim, RegbookScript::c_iic008in_PlayWav);
|
||||
BackgroundAudioManager()->RaiseVolume();
|
||||
}
|
||||
}
|
||||
else if (key != SDLK_BACKSPACE && m_newName.m_cursorPos < 7) {
|
||||
else if (key != MORTARK_BACKSPACE && m_newName.m_cursorPos < 7) {
|
||||
m_name[0][m_newName.m_cursorPos] = (*intoAlphabet)->Clone();
|
||||
|
||||
if (m_name[0][m_newName.m_cursorPos] != NULL) {
|
||||
@ -212,14 +212,14 @@ MxLong RegistrationBook::HandleKeyPress(SDL_Keycode p_key)
|
||||
}
|
||||
|
||||
m_newName.m_letters[m_newName.m_cursorPos] =
|
||||
key >= SDLK_A && key <= SDLK_Z
|
||||
? key - SDLK_A
|
||||
key >= MORTARK_A && key <= MORTARK_Z
|
||||
? key - MORTARK_A
|
||||
: (intoAlphabet - m_intAlphabet) + sizeOfArray(m_alphabet) - m_intAlphabetOffset;
|
||||
m_newName.m_cursorPos++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (key == SDLK_BACKSPACE && m_newName.m_cursorPos > 0) {
|
||||
if (key == MORTARK_BACKSPACE && m_newName.m_cursorPos > 0) {
|
||||
m_newName.m_cursorPos--;
|
||||
|
||||
m_name[0][m_newName.m_cursorPos]->Enable(FALSE);
|
||||
@ -276,13 +276,13 @@ MxLong RegistrationBook::HandleControl(LegoControlManagerNotificationParam& p_pa
|
||||
}
|
||||
|
||||
if (buttonId < 27) {
|
||||
HandleKeyPress(SDLK_A + buttonId - 1);
|
||||
HandleKeyPress(MORTARK_A + buttonId - 1);
|
||||
}
|
||||
else if (intChar) {
|
||||
HandleKeyPress((SDL_Keycode) intChar->m_character);
|
||||
HandleKeyPress((MORTAR_Keycode) intChar->m_character);
|
||||
}
|
||||
else {
|
||||
HandleKeyPress(SDLK_BACKSPACE);
|
||||
HandleKeyPress(MORTARK_BACKSPACE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -503,8 +503,8 @@ void RegistrationBook::ReadyWorld()
|
||||
index += m_intAlphabetOffset;
|
||||
|
||||
if (index >= sizeOfArray(m_intAlphabet) || !m_intAlphabet[index]) {
|
||||
SDL_Log("Warning: international character not present in current game. Falling back to X");
|
||||
return &m_alphabet[SDLK_X - SDLK_A];
|
||||
MORTAR_Log("Warning: international character not present in current game. Falling back to X");
|
||||
return &m_alphabet[MORTARK_X - MORTARK_A];
|
||||
}
|
||||
|
||||
return &m_intAlphabet[index];
|
||||
|
||||
@ -96,7 +96,7 @@ MxLong Score::Notify(MxParam& p_param)
|
||||
ret = HandleEndAction((MxEndActionNotificationParam&) p_param);
|
||||
break;
|
||||
case c_notificationKeyPress:
|
||||
if (((LegoEventNotificationParam&) p_param).GetKey() == SDLK_SPACE) {
|
||||
if (((LegoEventNotificationParam&) p_param).GetKey() == MORTARK_SPACE) {
|
||||
DeleteScript();
|
||||
}
|
||||
ret = 1;
|
||||
|
||||
@ -13,20 +13,20 @@ LegoPaletteEntry::LegoPaletteEntry()
|
||||
m_color.r = 0;
|
||||
m_color.g = 0;
|
||||
m_color.b = 0;
|
||||
m_color.a = SDL_ALPHA_OPAQUE;
|
||||
m_color.a = MORTAR_ALPHA_OPAQUE;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100994d0
|
||||
LegoResult LegoPaletteEntry::Read(LegoStorage* p_storage)
|
||||
{
|
||||
LegoResult result;
|
||||
if ((result = p_storage->Read(&m_color.r, sizeof(Uint8))) != SUCCESS) {
|
||||
if ((result = p_storage->Read(&m_color.r, sizeof(uint8_t))) != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
if ((result = p_storage->Read(&m_color.g, sizeof(Uint8))) != SUCCESS) {
|
||||
if ((result = p_storage->Read(&m_color.g, sizeof(uint8_t))) != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
if ((result = p_storage->Read(&m_color.b, sizeof(Uint8))) != SUCCESS) {
|
||||
if ((result = p_storage->Read(&m_color.b, sizeof(uint8_t))) != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
return SUCCESS;
|
||||
@ -36,13 +36,13 @@ LegoResult LegoPaletteEntry::Read(LegoStorage* p_storage)
|
||||
LegoResult LegoPaletteEntry::Write(LegoStorage* p_storage) const
|
||||
{
|
||||
LegoResult result;
|
||||
if ((result = p_storage->Write(&m_color.r, sizeof(Uint8))) != SUCCESS) {
|
||||
if ((result = p_storage->Write(&m_color.r, sizeof(uint8_t))) != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
if ((result = p_storage->Write(&m_color.g, sizeof(Uint8))) != SUCCESS) {
|
||||
if ((result = p_storage->Write(&m_color.g, sizeof(uint8_t))) != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
if ((result = p_storage->Write(&m_color.b, sizeof(Uint8))) != SUCCESS) {
|
||||
if ((result = p_storage->Write(&m_color.b, sizeof(uint8_t))) != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
return SUCCESS;
|
||||
@ -58,15 +58,15 @@ LegoImage::LegoImage()
|
||||
// FUNCTION: LEGO1 0x100995a0
|
||||
LegoImage::LegoImage(LegoU32 p_width, LegoU32 p_height)
|
||||
{
|
||||
m_surface = SDL_CreateSurface(p_width, p_height, SDL_PIXELFORMAT_INDEX8);
|
||||
m_surface = MORTAR_CreateSurface(p_width, p_height, MORTAR_PIXELFORMAT_INDEX8);
|
||||
m_palette = NULL;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100995f0
|
||||
LegoImage::~LegoImage()
|
||||
{
|
||||
SDL_DestroySurface(m_surface);
|
||||
SDL_DestroyPalette(m_palette);
|
||||
MORTAR_DestroySurface(m_surface);
|
||||
MORTAR_DestroyPalette(m_palette);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10099610
|
||||
@ -84,9 +84,9 @@ LegoResult LegoImage::Read(LegoStorage* p_storage, LegoU32 p_square)
|
||||
return result;
|
||||
}
|
||||
if (m_palette) {
|
||||
SDL_DestroyPalette(m_palette);
|
||||
MORTAR_DestroyPalette(m_palette);
|
||||
}
|
||||
m_palette = SDL_CreatePalette(count);
|
||||
m_palette = MORTAR_CreatePalette(count);
|
||||
for (LegoU32 i = 0; i < count; i++) {
|
||||
LegoPaletteEntry paletteEntry;
|
||||
if ((result = paletteEntry.Read(p_storage)) != SUCCESS) {
|
||||
@ -95,19 +95,19 @@ LegoResult LegoImage::Read(LegoStorage* p_storage, LegoU32 p_square)
|
||||
m_palette->colors[i] = paletteEntry.GetColor();
|
||||
}
|
||||
if (m_surface) {
|
||||
SDL_DestroySurface(m_surface);
|
||||
MORTAR_DestroySurface(m_surface);
|
||||
}
|
||||
m_surface = SDL_CreateSurface(width, height, SDL_PIXELFORMAT_INDEX8);
|
||||
m_surface = MORTAR_CreateSurface(width, height, MORTAR_PIXELFORMAT_INDEX8);
|
||||
if ((result = p_storage->Read(m_surface->pixels, width * height)) != SUCCESS) {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (p_square && width != height) {
|
||||
SDL_Surface* newSurface;
|
||||
MORTAR_Surface* newSurface;
|
||||
|
||||
if (height < width) {
|
||||
LegoU32 aspect = width / height;
|
||||
newSurface = SDL_CreateSurface(width, width, SDL_PIXELFORMAT_INDEX8);
|
||||
newSurface = MORTAR_CreateSurface(width, width, MORTAR_PIXELFORMAT_INDEX8);
|
||||
LegoU8* src = (LegoU8*) m_surface->pixels;
|
||||
LegoU8* dst = (LegoU8*) newSurface->pixels;
|
||||
|
||||
@ -125,7 +125,7 @@ LegoResult LegoImage::Read(LegoStorage* p_storage, LegoU32 p_square)
|
||||
}
|
||||
else {
|
||||
LegoU32 aspect = height / width;
|
||||
newSurface = SDL_CreateSurface(height, height, SDL_PIXELFORMAT_INDEX8);
|
||||
newSurface = MORTAR_CreateSurface(height, height, MORTAR_PIXELFORMAT_INDEX8);
|
||||
LegoU8* src = (LegoU8*) m_surface->pixels;
|
||||
LegoU8* dst = (LegoU8*) newSurface->pixels;
|
||||
|
||||
@ -145,7 +145,7 @@ LegoResult LegoImage::Read(LegoStorage* p_storage, LegoU32 p_square)
|
||||
width = height;
|
||||
}
|
||||
|
||||
SDL_DestroySurface(m_surface);
|
||||
MORTAR_DestroySurface(m_surface);
|
||||
m_surface = newSurface;
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
|
||||
#include "legotypes.h"
|
||||
|
||||
#include <SDL3/SDL_surface.h>
|
||||
#include <mortar/mortar_surface.h>
|
||||
|
||||
class LegoStorage;
|
||||
|
||||
@ -18,13 +18,13 @@ class LegoPaletteEntry {
|
||||
void SetGreen(LegoU8 p_green) { m_color.g = p_green; }
|
||||
LegoU8 GetBlue() const { return m_color.b; }
|
||||
void SetBlue(LegoU8 p_blue) { m_color.b = p_blue; }
|
||||
SDL_Color GetColor() const { return m_color; }
|
||||
void SetColor(SDL_Color p_color) { m_color = p_color; }
|
||||
MORTAR_Color GetColor() const { return m_color; }
|
||||
void SetColor(MORTAR_Color p_color) { m_color = p_color; }
|
||||
LegoResult Read(LegoStorage* p_storage);
|
||||
LegoResult Write(LegoStorage* p_storage) const;
|
||||
|
||||
protected:
|
||||
SDL_Color m_color;
|
||||
MORTAR_Color m_color;
|
||||
};
|
||||
|
||||
// 0x310
|
||||
@ -36,10 +36,10 @@ class LegoImage {
|
||||
LegoU32 GetWidth() const { return m_surface->w; }
|
||||
LegoU32 GetHeight() const { return m_surface->h; }
|
||||
LegoU32 GetCount() const { return m_palette ? m_palette->ncolors : 0; }
|
||||
SDL_Palette* GetPalette() const { return m_palette; }
|
||||
void SetPalette(SDL_Palette* p_palette)
|
||||
MORTAR_Palette* GetPalette() const { return m_palette; }
|
||||
void SetPalette(MORTAR_Palette* p_palette)
|
||||
{
|
||||
SDL_DestroyPalette(m_palette);
|
||||
MORTAR_DestroyPalette(m_palette);
|
||||
m_palette = p_palette;
|
||||
}
|
||||
void SetPaletteEntry(LegoU32 p_i, LegoPaletteEntry& p_paletteEntry)
|
||||
@ -51,8 +51,8 @@ class LegoImage {
|
||||
LegoResult Write(LegoStorage* p_storage);
|
||||
|
||||
protected:
|
||||
SDL_Surface* m_surface;
|
||||
SDL_Palette* m_palette;
|
||||
MORTAR_Surface* m_surface;
|
||||
MORTAR_Palette* m_palette;
|
||||
// LegoU32 m_count; // 0x08
|
||||
// LegoPaletteEntry m_palette[256]; // 0x0c
|
||||
// LegoU8* m_bits; // 0x30c
|
||||
|
||||
@ -45,7 +45,7 @@ LegoFile::LegoFile()
|
||||
LegoFile::~LegoFile()
|
||||
{
|
||||
if (m_file) {
|
||||
SDL_CloseIO(m_file);
|
||||
MORTAR_CloseIO(m_file);
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ LegoResult LegoFile::Read(void* p_buffer, LegoU32 p_size)
|
||||
if (!m_file) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (SDL_ReadIO(m_file, p_buffer, p_size) != p_size) {
|
||||
if (MORTAR_ReadIO(m_file, p_buffer, p_size) != p_size) {
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
@ -67,7 +67,7 @@ LegoResult LegoFile::Write(const void* p_buffer, LegoU32 p_size)
|
||||
if (!m_file) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (SDL_WriteIO(m_file, p_buffer, p_size) != p_size) {
|
||||
if (MORTAR_WriteIO(m_file, p_buffer, p_size) != p_size) {
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
@ -79,7 +79,7 @@ LegoResult LegoFile::GetPosition(LegoU32& p_position)
|
||||
if (!m_file) {
|
||||
return FAILURE;
|
||||
}
|
||||
Sint64 position = SDL_TellIO(m_file);
|
||||
int64_t position = MORTAR_TellIO(m_file);
|
||||
if (position == -1) {
|
||||
return FAILURE;
|
||||
}
|
||||
@ -93,7 +93,7 @@ LegoResult LegoFile::SetPosition(LegoU32 p_position)
|
||||
if (!m_file) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (SDL_SeekIO(m_file, p_position, SDL_IO_SEEK_SET) != p_position) {
|
||||
if (MORTAR_SeekIO(m_file, p_position, MORTAR_IO_SEEK_SET) != p_position) {
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
@ -103,7 +103,7 @@ LegoResult LegoFile::SetPosition(LegoU32 p_position)
|
||||
LegoResult LegoFile::Open(const char* p_name, LegoU32 p_mode)
|
||||
{
|
||||
if (m_file) {
|
||||
SDL_CloseIO(m_file);
|
||||
MORTAR_CloseIO(m_file);
|
||||
}
|
||||
char mode[4];
|
||||
mode[0] = '\0';
|
||||
@ -126,7 +126,7 @@ LegoResult LegoFile::Open(const char* p_name, LegoU32 p_mode)
|
||||
MxString path(p_name);
|
||||
path.MapPathToFilesystem();
|
||||
|
||||
if (!(m_file = SDL_IOFromFile(path.GetData(), mode))) {
|
||||
if (!(m_file = MORTAR_IOFromFile(path.GetData(), mode))) {
|
||||
return FAILURE;
|
||||
}
|
||||
return SUCCESS;
|
||||
|
||||
@ -5,8 +5,8 @@
|
||||
#include "mxgeometry/mxgeometry3d.h"
|
||||
#include "mxstring.h"
|
||||
|
||||
#include <SDL3/SDL_iostream.h>
|
||||
#include <assert.h>
|
||||
#include <mortar/mortar_iostream.h>
|
||||
|
||||
// VTABLE: LEGO1 0x100d7d80
|
||||
// SIZE 0x08
|
||||
@ -241,7 +241,7 @@ class LegoFile : public LegoStorage {
|
||||
// LegoFile::`scalar deleting destructor'
|
||||
|
||||
protected:
|
||||
SDL_IOStream* m_file; // 0x08
|
||||
MORTAR_IOStream* m_file; // 0x08
|
||||
};
|
||||
|
||||
#endif // __LEGOSTORAGE_H
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
#include "shape/legomesh.h"
|
||||
#include "tgl/d3drm/impl.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(LODObject, 0x04)
|
||||
DECOMP_SIZE_ASSERT(ViewLOD, 0x0c)
|
||||
@ -519,7 +519,7 @@ LegoResult LegoLOD::GetTextureInfo(LegoTextureInfo*& p_textureInfo)
|
||||
// FUNCTION: BETA10 0x1018e46d
|
||||
LegoBool LegoLOD::HasInhPrefix(const LegoChar* p_name)
|
||||
{
|
||||
if (p_name != NULL && !SDL_strncasecmp(p_name, g_InhPrefix, strlen(g_InhPrefix))) {
|
||||
if (p_name != NULL && !MORTAR_strncasecmp(p_name, g_InhPrefix, strlen(g_InhPrefix))) {
|
||||
return TRUE;
|
||||
}
|
||||
else {
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
#include "shape/legobox.h"
|
||||
#include "shape/legosphere.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
#include <string.h>
|
||||
#include <vec.h>
|
||||
|
||||
@ -146,7 +146,7 @@ LegoResult LegoROI::Read(
|
||||
goto done;
|
||||
}
|
||||
m_name[length] = '\0';
|
||||
SDL_strlwr(m_name);
|
||||
MORTAR_strlwr(m_name);
|
||||
|
||||
if (sphere.Read(p_storage) != SUCCESS) {
|
||||
goto done;
|
||||
@ -173,7 +173,7 @@ LegoResult LegoROI::Read(
|
||||
goto done;
|
||||
}
|
||||
textureName[length] = '\0';
|
||||
SDL_strlwr(textureName);
|
||||
MORTAR_strlwr(textureName);
|
||||
}
|
||||
else {
|
||||
textureName = NULL;
|
||||
@ -227,7 +227,7 @@ LegoResult LegoROI::Read(
|
||||
|
||||
if (g_roiConfig <= 2) {
|
||||
for (i = 0; g_sharedModelsLow[i] != NULL; i++) {
|
||||
if (!SDL_strncasecmp(m_name, g_sharedModelsLow[i], 4)) {
|
||||
if (!MORTAR_strncasecmp(m_name, g_sharedModelsLow[i], 4)) {
|
||||
roiName = g_sharedModelsLow[i];
|
||||
break;
|
||||
}
|
||||
@ -235,7 +235,7 @@ LegoResult LegoROI::Read(
|
||||
}
|
||||
else {
|
||||
for (i = 0; g_sharedModelsHigh[i] != NULL; i++) {
|
||||
if (!SDL_strncasecmp(m_name, g_sharedModelsHigh[i], 4)) {
|
||||
if (!MORTAR_strncasecmp(m_name, g_sharedModelsHigh[i], 4)) {
|
||||
roiName = g_sharedModelsHigh[i];
|
||||
break;
|
||||
}
|
||||
@ -244,7 +244,7 @@ LegoResult LegoROI::Read(
|
||||
|
||||
if ((lodList = p_viewLODListManager->Lookup(roiName))) {
|
||||
for (j = 0; g_alwaysLoadNames[j] != NULL; j++) {
|
||||
if (!SDL_strcasecmp(g_alwaysLoadNames[j], roiName)) {
|
||||
if (!MORTAR_strcasecmp(g_alwaysLoadNames[j], roiName)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -302,7 +302,7 @@ LegoResult LegoROI::Read(
|
||||
}
|
||||
|
||||
if (textureName != NULL) {
|
||||
if (!SDL_strncasecmp(textureName, "t_", 2)) {
|
||||
if (!MORTAR_strncasecmp(textureName, "t_", 2)) {
|
||||
textureInfo = p_textureContainer->Get(textureName + 2);
|
||||
|
||||
if (textureInfo == NULL) {
|
||||
@ -362,7 +362,7 @@ LegoROI* LegoROI::FindChildROI(const LegoChar* p_name, LegoROI* p_roi)
|
||||
CompoundObject::iterator it;
|
||||
const LegoChar* name = p_roi->GetName();
|
||||
|
||||
if (name != NULL && *name != '\0' && !SDL_strcasecmp(name, p_name)) {
|
||||
if (name != NULL && *name != '\0' && !MORTAR_strcasecmp(name, p_name)) {
|
||||
return p_roi;
|
||||
}
|
||||
|
||||
@ -372,7 +372,7 @@ LegoROI* LegoROI::FindChildROI(const LegoChar* p_name, LegoROI* p_roi)
|
||||
LegoROI* roi = (LegoROI*) *it;
|
||||
name = roi->GetName();
|
||||
|
||||
if (name != NULL && *name != '\0' && !SDL_strcasecmp(name, p_name)) {
|
||||
if (name != NULL && *name != '\0' && !MORTAR_strcasecmp(name, p_name)) {
|
||||
return roi;
|
||||
}
|
||||
}
|
||||
@ -804,7 +804,7 @@ LegoBool LegoROI::GetRGBAColor(const LegoChar* p_name, float& p_red, float& p_gr
|
||||
LegoBool LegoROI::ColorAliasLookup(const LegoChar* p_param, float& p_red, float& p_green, float& p_blue, float& p_alpha)
|
||||
{
|
||||
for (LegoU32 i = 0; i < sizeOfArray(g_roiColorAliases); i++) {
|
||||
if (SDL_strcasecmp(g_roiColorAliases[i].m_name, p_param) == 0) {
|
||||
if (MORTAR_strcasecmp(g_roiColorAliases[i].m_name, p_param) == 0) {
|
||||
p_red = g_roiColorAliases[i].m_red / 255.0;
|
||||
p_green = g_roiColorAliases[i].m_green / 255.0;
|
||||
p_blue = g_roiColorAliases[i].m_blue / 255.0;
|
||||
@ -851,7 +851,7 @@ void LegoROI::SetName(const LegoChar* p_name)
|
||||
if (p_name != NULL) {
|
||||
m_name = new LegoChar[strlen(p_name) + 1];
|
||||
strcpy(m_name, p_name);
|
||||
SDL_strlwr(m_name);
|
||||
MORTAR_strlwr(m_name);
|
||||
}
|
||||
else {
|
||||
m_name = NULL;
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
#include "misc/legostorage.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoMeshUnkComponent, 0x1c)
|
||||
DECOMP_SIZE_ASSERT(LegoMesh, 0x24)
|
||||
@ -75,7 +75,7 @@ LegoResult LegoMesh::Read(LegoStorage* p_storage)
|
||||
}
|
||||
|
||||
m_textureName[textureLength] = '\0';
|
||||
SDL_strlwr(m_textureName);
|
||||
MORTAR_strlwr(m_textureName);
|
||||
}
|
||||
|
||||
if ((result = p_storage->Read(&materialLength, sizeof(LegoU32))) != SUCCESS) {
|
||||
@ -89,7 +89,7 @@ LegoResult LegoMesh::Read(LegoStorage* p_storage)
|
||||
}
|
||||
|
||||
m_materialName[materialLength] = '\0';
|
||||
SDL_strlwr(m_materialName);
|
||||
MORTAR_strlwr(m_materialName);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
@ -15,44 +15,44 @@ void ModelDbModel::Free()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100276b0
|
||||
MxResult ModelDbModel::Read(SDL_IOStream* p_file)
|
||||
MxResult ModelDbModel::Read(MORTAR_IOStream* p_file)
|
||||
{
|
||||
MxU32 len;
|
||||
|
||||
if (SDL_ReadIO(p_file, &len, sizeof(MxU32)) != sizeof(MxU32)) {
|
||||
if (MORTAR_ReadIO(p_file, &len, sizeof(MxU32)) != sizeof(MxU32)) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
m_modelName = new char[len];
|
||||
if (SDL_ReadIO(p_file, m_modelName, len) != len) {
|
||||
if (MORTAR_ReadIO(p_file, m_modelName, len) != len) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (SDL_ReadIO(p_file, &m_modelDataLength, sizeof(MxU32)) != sizeof(MxU32)) {
|
||||
if (MORTAR_ReadIO(p_file, &m_modelDataLength, sizeof(MxU32)) != sizeof(MxU32)) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (SDL_ReadIO(p_file, &m_modelDataOffset, sizeof(MxU32)) != sizeof(MxU32)) {
|
||||
if (MORTAR_ReadIO(p_file, &m_modelDataOffset, sizeof(MxU32)) != sizeof(MxU32)) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (SDL_ReadIO(p_file, &len, sizeof(len)) != sizeof(len)) {
|
||||
if (MORTAR_ReadIO(p_file, &len, sizeof(len)) != sizeof(len)) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
m_presenterName = new char[len];
|
||||
if (SDL_ReadIO(p_file, m_presenterName, len) != len) {
|
||||
if (MORTAR_ReadIO(p_file, m_presenterName, len) != len) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (SDL_ReadIO(p_file, m_location, 3 * sizeof(float)) != 3 * sizeof(float)) {
|
||||
if (MORTAR_ReadIO(p_file, m_location, 3 * sizeof(float)) != 3 * sizeof(float)) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (SDL_ReadIO(p_file, m_direction, 3 * sizeof(float)) != 3 * sizeof(float)) {
|
||||
if (MORTAR_ReadIO(p_file, m_direction, 3 * sizeof(float)) != 3 * sizeof(float)) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (SDL_ReadIO(p_file, m_up, 3 * sizeof(float)) != 3 * sizeof(float)) {
|
||||
if (MORTAR_ReadIO(p_file, m_up, 3 * sizeof(float)) != 3 * sizeof(float)) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (SDL_ReadIO(p_file, &m_visible, sizeof(MxU8)) != sizeof(MxU8)) {
|
||||
if (MORTAR_ReadIO(p_file, &m_visible, sizeof(MxU8)) != sizeof(MxU8)) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@ -60,27 +60,27 @@ MxResult ModelDbModel::Read(SDL_IOStream* p_file)
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10027850
|
||||
MxResult ModelDbPart::Read(SDL_IOStream* p_file)
|
||||
MxResult ModelDbPart::Read(MORTAR_IOStream* p_file)
|
||||
{
|
||||
MxU32 len;
|
||||
|
||||
if (SDL_ReadIO(p_file, &len, sizeof(MxU32)) != sizeof(MxU32)) {
|
||||
if (MORTAR_ReadIO(p_file, &len, sizeof(MxU32)) != sizeof(MxU32)) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
char* buff = new char[len];
|
||||
|
||||
if (SDL_ReadIO(p_file, buff, len) != len) {
|
||||
if (MORTAR_ReadIO(p_file, buff, len) != len) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
m_roiName = buff;
|
||||
delete[] buff;
|
||||
|
||||
if (SDL_ReadIO(p_file, &m_partDataLength, sizeof(undefined4)) != sizeof(undefined4)) {
|
||||
if (MORTAR_ReadIO(p_file, &m_partDataLength, sizeof(undefined4)) != sizeof(undefined4)) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (SDL_ReadIO(p_file, &m_partDataOffset, sizeof(undefined4)) != sizeof(undefined4)) {
|
||||
if (MORTAR_ReadIO(p_file, &m_partDataOffset, sizeof(undefined4)) != sizeof(undefined4)) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@ -88,13 +88,13 @@ MxResult ModelDbPart::Read(SDL_IOStream* p_file)
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10027910
|
||||
MxResult ReadModelDbWorlds(SDL_IOStream* p_file, ModelDbWorld*& p_worlds, MxS32& p_numWorlds)
|
||||
MxResult ReadModelDbWorlds(MORTAR_IOStream* p_file, ModelDbWorld*& p_worlds, MxS32& p_numWorlds)
|
||||
{
|
||||
p_worlds = NULL;
|
||||
p_numWorlds = 0;
|
||||
|
||||
MxS32 numWorlds;
|
||||
if (SDL_ReadIO(p_file, &numWorlds, sizeof(numWorlds)) != sizeof(numWorlds)) {
|
||||
if (MORTAR_ReadIO(p_file, &numWorlds, sizeof(numWorlds)) != sizeof(numWorlds)) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@ -102,16 +102,16 @@ MxResult ReadModelDbWorlds(SDL_IOStream* p_file, ModelDbWorld*& p_worlds, MxS32&
|
||||
MxS32 worldNameLen, numParts, i, j;
|
||||
|
||||
for (i = 0; i < numWorlds; i++) {
|
||||
if (SDL_ReadIO(p_file, &worldNameLen, sizeof(MxS32)) != sizeof(MxS32)) {
|
||||
if (MORTAR_ReadIO(p_file, &worldNameLen, sizeof(MxS32)) != sizeof(MxS32)) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
worlds[i].m_worldName = new char[worldNameLen];
|
||||
if (SDL_ReadIO(p_file, worlds[i].m_worldName, worldNameLen) != worldNameLen) {
|
||||
if (MORTAR_ReadIO(p_file, worlds[i].m_worldName, worldNameLen) != worldNameLen) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (SDL_ReadIO(p_file, &numParts, sizeof(MxS32)) != sizeof(MxS32)) {
|
||||
if (MORTAR_ReadIO(p_file, &numParts, sizeof(MxS32)) != sizeof(MxS32)) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ MxResult ReadModelDbWorlds(SDL_IOStream* p_file, ModelDbWorld*& p_worlds, MxS32&
|
||||
worlds[i].m_partList->Append(part);
|
||||
}
|
||||
|
||||
if (SDL_ReadIO(p_file, &worlds[i].m_numModels, sizeof(MxS32)) != sizeof(MxS32)) {
|
||||
if (MORTAR_ReadIO(p_file, &worlds[i].m_numModels, sizeof(MxS32)) != sizeof(MxS32)) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
|
||||
@ -6,12 +6,12 @@
|
||||
#include "mxstring.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
#include <SDL3/SDL_iostream.h>
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <mortar/mortar_iostream.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
|
||||
// SIZE 0x18
|
||||
struct ModelDbPart {
|
||||
MxResult Read(SDL_IOStream* p_file);
|
||||
MxResult Read(MORTAR_IOStream* p_file);
|
||||
|
||||
MxString m_roiName; // 0x00
|
||||
undefined4 m_partDataLength; // 0x10
|
||||
@ -33,7 +33,7 @@ class ModelDbPartList : public MxList<ModelDbPart*> {
|
||||
// FUNCTION: LEGO1 0x10027c40
|
||||
MxS8 Compare(ModelDbPart* p_a, ModelDbPart* p_b) override
|
||||
{
|
||||
MxS32 compare = SDL_strcasecmp(p_a->m_roiName.GetData(), p_b->m_roiName.GetData());
|
||||
MxS32 compare = MORTAR_strcasecmp(p_a->m_roiName.GetData(), p_b->m_roiName.GetData());
|
||||
|
||||
if (compare == 0) {
|
||||
p_b->m_partDataLength = p_a->m_partDataLength;
|
||||
@ -93,7 +93,7 @@ class ModelDbPartListCursor : public MxListCursor<ModelDbPart*> {
|
||||
// SIZE 0x38
|
||||
struct ModelDbModel {
|
||||
void Free();
|
||||
MxResult Read(SDL_IOStream* p_file);
|
||||
MxResult Read(MORTAR_IOStream* p_file);
|
||||
|
||||
char* m_modelName; // 0x00
|
||||
MxU32 m_modelDataLength; // 0x04
|
||||
@ -114,7 +114,7 @@ struct ModelDbWorld {
|
||||
undefined m_unk0x10[0x08]; // 0x10
|
||||
};
|
||||
|
||||
MxResult ReadModelDbWorlds(SDL_IOStream* p_file, ModelDbWorld*& p_worlds, MxS32& p_numWorlds);
|
||||
MxResult ReadModelDbWorlds(MORTAR_IOStream* p_file, ModelDbWorld*& p_worlds, MxS32& p_numWorlds);
|
||||
void FreeModelDbWorlds(ModelDbWorld*& p_worlds, MxS32 p_numWorlds);
|
||||
|
||||
#endif // MODELDB_H
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
#include "legodxinfo.h"
|
||||
|
||||
#include <SDL3/SDL_cpuinfo.h>
|
||||
#include <assert.h>
|
||||
#include <stdio.h> // for vsprintf
|
||||
#include <cassert>
|
||||
#include <cstdio> // for vsprintf
|
||||
#include <mortar/mortar_cpuinfo.h>
|
||||
|
||||
// File name validated by BETA10 0x1011cba3; directory unknown
|
||||
|
||||
|
||||
@ -5,9 +5,9 @@
|
||||
#include "mxdirect3d.h"
|
||||
#include "mxvideoparam.h"
|
||||
|
||||
#include <SDL3/SDL.h> // for SDL_Log
|
||||
#include <assert.h>
|
||||
#include <miniwin/miniwind3d.h>
|
||||
#include <mortar/mortar.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxDirect3D, 0x894)
|
||||
|
||||
@ -72,11 +72,8 @@ BOOL MxDirect3D::Create(
|
||||
}
|
||||
|
||||
if (m_pDirect3d->QueryInterface(IID_IDirect3DMiniwin, (void**) &miniwind3d) == DD_OK) {
|
||||
MxVideoParam* videoParam = (MxVideoParam*) SDL_GetPointerProperty(
|
||||
SDL_GetWindowProperties(reinterpret_cast<SDL_Window*>(hWnd)),
|
||||
ISLE_PROP_WINDOW_CREATE_VIDEO_PARAM,
|
||||
nullptr
|
||||
);
|
||||
MxVideoParam* videoParam = (MxVideoParam*)
|
||||
MORTAR_EXT_GetWindowProperty(reinterpret_cast<MORTAR_Window*>(hWnd), MORTAR_WINDOW_PROPERTY_USER, nullptr);
|
||||
#ifndef MXDIRECTX_FOR_CONFIG
|
||||
assert(videoParam);
|
||||
#endif
|
||||
@ -199,12 +196,12 @@ BOOL MxDirect3D::D3DSetMode()
|
||||
ddBltFx.dwFillColor = 0xFF000000;
|
||||
|
||||
if (backBuffer->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &ddBltFx) != DD_OK) {
|
||||
SDL_Log("MxDirect3D::D3DSetMode() color fill failed\n");
|
||||
MORTAR_Log("MxDirect3D::D3DSetMode() color fill failed\n");
|
||||
}
|
||||
|
||||
if (IsFullScreen()) {
|
||||
if (frontBuffer->Blt(NULL, NULL, NULL, DDBLT_WAIT | DDBLT_COLORFILL, &ddBltFx) != DD_OK) {
|
||||
SDL_Log("MxDirect3D::D3DSetMode() front lock failed\n");
|
||||
MORTAR_Log("MxDirect3D::D3DSetMode() front lock failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
#include "decomp.h"
|
||||
|
||||
#include <SDL3/SDL_log.h>
|
||||
#include <assert.h>
|
||||
#include <cassert>
|
||||
#include <mortar/mortar_log.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxDirectDraw, 0x880)
|
||||
|
||||
@ -733,7 +733,7 @@ void MxDirectDraw::Error(const char* p_message, int p_error)
|
||||
|
||||
g_isInsideError = TRUE;
|
||||
Destroy();
|
||||
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "MxDirectDraw error: [0x%08x] %s", p_error, p_message);
|
||||
MORTAR_LogError(MORTAR_LOG_CATEGORY_APPLICATION, "MxDirectDraw error: [0x%08x] %s", p_error, p_message);
|
||||
if (m_pErrorHandler) {
|
||||
m_pErrorHandler(p_message, p_error, m_pErrorHandlerArg);
|
||||
}
|
||||
|
||||
@ -2,9 +2,9 @@
|
||||
|
||||
#include "omni/include/mxvideoparam.h"
|
||||
|
||||
#include <SDL3/SDL_log.h>
|
||||
#include <assert.h>
|
||||
#include <miniwin/miniwind3d.h>
|
||||
#include <mortar/mortar_log.h>
|
||||
#include <stdio.h> // for vsprintf
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxAssignedDevice, 0xe4)
|
||||
@ -228,9 +228,9 @@ BOOL MxDeviceEnumerate::EnumDirectDrawCallback(LPGUID p_guid, LPSTR p_driverDesc
|
||||
|
||||
result = lpDD->QueryInterface(IID_IDirect3DMiniwin, (void**) &miniwind3d);
|
||||
if (result == DD_OK) {
|
||||
MxVideoParam* videoParam = (MxVideoParam*) SDL_GetPointerProperty(
|
||||
SDL_GetWindowProperties(reinterpret_cast<SDL_Window*>(m_hWnd)),
|
||||
ISLE_PROP_WINDOW_CREATE_VIDEO_PARAM,
|
||||
MxVideoParam* videoParam = (MxVideoParam*) MORTAR_EXT_GetWindowProperty(
|
||||
reinterpret_cast<MORTAR_Window*>(m_hWnd),
|
||||
MORTAR_WINDOW_PROPERTY_USER,
|
||||
nullptr
|
||||
);
|
||||
#ifndef MXDIRECTX_FOR_CONFIG
|
||||
@ -298,7 +298,7 @@ void MxDeviceEnumerate::BuildErrorString(const char* p_format, ...)
|
||||
va_list args;
|
||||
|
||||
va_start(args, p_format);
|
||||
SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_ERROR, p_format, args);
|
||||
MORTAR_LogMessageV(MORTAR_LOG_CATEGORY_APPLICATION, MORTAR_LOG_PRIORITY_ERROR, p_format, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
|
||||
@ -3,10 +3,10 @@
|
||||
|
||||
#include "assert.h"
|
||||
|
||||
#include <SDL3/SDL_stdinc.h>
|
||||
#include <SDL3/SDL_timer.h>
|
||||
#include <limits.h> // ULONG_MAX
|
||||
#include <math.h>
|
||||
#include <mortar/mortar_stdinc.h>
|
||||
#include <mortar/mortar_timer.h>
|
||||
#ifdef MINIWIN
|
||||
#include "miniwin/windows.h"
|
||||
#else
|
||||
@ -35,35 +35,35 @@ class MxStopWatch {
|
||||
double ElapsedSeconds() const;
|
||||
|
||||
protected:
|
||||
Uint64 TicksPerSeconds() const;
|
||||
uint64_t TicksPerSeconds() const;
|
||||
|
||||
private:
|
||||
Uint64 m_startTick; // 0x00
|
||||
uint64_t m_startTick; // 0x00
|
||||
// ??? when we provide LARGE_INTEGER arithmetic, use a
|
||||
// LARGE_INTEGER m_elapsedTicks rather than m_elapsedSeconds
|
||||
double m_elapsedSeconds; // 0x0c
|
||||
Uint64 m_ticksPerSeconds; // 0x14
|
||||
uint64_t m_ticksPerSeconds; // 0x14
|
||||
};
|
||||
|
||||
// FUNCTION: BETA10 0x100d8ba0
|
||||
inline MxStopWatch::MxStopWatch()
|
||||
{
|
||||
Reset();
|
||||
m_ticksPerSeconds = SDL_GetPerformanceFrequency();
|
||||
m_ticksPerSeconds = MORTAR_GetPerformanceFrequency();
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x100d8be0
|
||||
inline void MxStopWatch::Start()
|
||||
{
|
||||
m_startTick = SDL_GetPerformanceCounter();
|
||||
m_startTick = MORTAR_GetPerformanceCounter();
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x100d8f50
|
||||
inline void MxStopWatch::Stop()
|
||||
{
|
||||
Uint64 endTick;
|
||||
uint64_t endTick;
|
||||
|
||||
endTick = SDL_GetPerformanceCounter();
|
||||
endTick = MORTAR_GetPerformanceCounter();
|
||||
|
||||
m_elapsedSeconds = (double) (endTick - m_startTick) / (double) m_ticksPerSeconds;
|
||||
}
|
||||
@ -76,11 +76,11 @@ inline void MxStopWatch::Reset()
|
||||
}
|
||||
|
||||
// FUNCTION: BETA10 0x100d8c60
|
||||
inline Uint64 MxStopWatch::TicksPerSeconds() const
|
||||
inline uint64_t MxStopWatch::TicksPerSeconds() const
|
||||
{
|
||||
Uint64 ticksPerSeconds;
|
||||
uint64_t ticksPerSeconds;
|
||||
|
||||
ticksPerSeconds = SDL_GetPerformanceFrequency();
|
||||
ticksPerSeconds = MORTAR_GetPerformanceFrequency();
|
||||
assert(ticksPerSeconds);
|
||||
|
||||
return ticksPerSeconds;
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
#include "mxcore.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
#include <SDL3/SDL_iostream.h>
|
||||
#include <mortar/mortar_iostream.h>
|
||||
#ifdef MINIWIN
|
||||
#include "miniwin/ddraw.h"
|
||||
#else
|
||||
@ -48,7 +48,7 @@ class MxBitmap : public MxCore {
|
||||
virtual MxResult ImportBitmap(MxBitmap* p_bitmap); // vtable+0x14
|
||||
virtual MxResult ImportBitmapInfo(MxBITMAPINFO* p_info); // vtable+0x18
|
||||
virtual MxResult SetSize(MxS32 p_width, MxS32 p_height, MxPalette* p_palette, MxBool); // vtable+0x1c
|
||||
virtual MxResult LoadFile(SDL_IOStream* p_handle); // vtable+0x20
|
||||
virtual MxResult LoadFile(MORTAR_IOStream* p_handle); // vtable+0x20
|
||||
virtual MxLong Read(const char* p_filename); // vtable+0x24
|
||||
|
||||
// FUNCTION: LEGO1 0x1004e0d0
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
#ifndef MXCRITICALSECTION_H
|
||||
#define MXCRITICALSECTION_H
|
||||
|
||||
#include <SDL3/SDL_mutex.h>
|
||||
#include <mortar/mortar_mutex.h>
|
||||
|
||||
// SIZE 0x1c
|
||||
class MxCriticalSection {
|
||||
@ -23,7 +23,7 @@ class MxCriticalSection {
|
||||
// SDL uses the most efficient mutex implementation available on the target platform.
|
||||
// Originally this class allowed working with either a Win32 CriticalSection or Mutex,
|
||||
// but only CriticalSection was ever used and we don't need both anyway.
|
||||
SDL_Mutex* m_mutex;
|
||||
MORTAR_Mutex* m_mutex;
|
||||
};
|
||||
|
||||
#ifdef BETA10
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user