mirror of
https://github.com/k4zmu2a/SpaceCadetPinball.git
synced 2023-12-30 21:52:56 +00:00
Made it compile with GCC on Linux.
Fixed GCC warnings and Windows specifics. Restored C++11, switch to 14 was not supposed to happen. Not 100% sure about my Find* module section.
This commit is contained in:
parent
2fe6d6d33a
commit
28e2417ef9
4
.gitignore
vendored
4
.gitignore
vendored
@ -269,3 +269,7 @@ __pycache__/
|
|||||||
#CMake generated
|
#CMake generated
|
||||||
out/
|
out/
|
||||||
/cmake-build-debug
|
/cmake-build-debug
|
||||||
|
|
||||||
|
# Windows XP stuff
|
||||||
|
DebugWinXp/
|
||||||
|
ReleaseWinXp/
|
||||||
|
@ -1,17 +1,29 @@
|
|||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
project(SpaceCadetPinball)
|
project(SpaceCadetPinball)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 14)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
|
|
||||||
set(SDL2_DIR "${CMAKE_CURRENT_LIST_DIR}/Libs/SDL2-2.0.16")
|
|
||||||
set(SDL2_mixer_DIR "${CMAKE_CURRENT_LIST_DIR}/Libs/SDL2_mixer-2.0.4")
|
|
||||||
|
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/bin)
|
||||||
|
|
||||||
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMakeModules")
|
||||||
|
|
||||||
|
# On Windows, set paths to SDL-devel packages here
|
||||||
|
if(WIN32)
|
||||||
|
set(SDL2_PATH "${CMAKE_CURRENT_LIST_DIR}/Libs/SDL2")
|
||||||
|
set(SDL2_MIXER_PATH "${CMAKE_CURRENT_LIST_DIR}/Libs/SDL2_mixer")
|
||||||
|
endif()
|
||||||
|
|
||||||
find_package(SDL2 REQUIRED)
|
find_package(SDL2 REQUIRED)
|
||||||
FIND_PACKAGE(SDL2_mixer REQUIRED)
|
FIND_PACKAGE(SDL2_mixer REQUIRED)
|
||||||
|
|
||||||
|
include_directories(${SDL2_INCLUDE_DIR} ${SDL2_MIXER_INCLUDE_DIR})
|
||||||
|
get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES)
|
||||||
|
foreach(dir ${dirs})
|
||||||
|
message(STATUS "Include dir='${dir}'")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
|
||||||
include_directories(${SDL2_INCLUDE_DIRS} ${SDL2_MIXER_INCLUDE_DIRS})
|
|
||||||
|
|
||||||
set(SOURCE_FILES
|
set(SOURCE_FILES
|
||||||
SpaceCadetPinball/control.cpp
|
SpaceCadetPinball/control.cpp
|
||||||
@ -156,4 +168,16 @@ set(SOURCE_FILES
|
|||||||
|
|
||||||
add_executable(SpaceCadetPinball ${SOURCE_FILES})
|
add_executable(SpaceCadetPinball ${SOURCE_FILES})
|
||||||
|
|
||||||
target_link_libraries(SpaceCadetPinball ${SDL2_LIBRARIES} ${SDL2_MIXER_LIBRARIES})
|
target_link_libraries(SpaceCadetPinball ${SDL2_LIBRARY} ${SDL2_MIXER_LIBRARY})
|
||||||
|
|
||||||
|
# On Windows, copy DLL to output
|
||||||
|
if(WIN32)
|
||||||
|
list(GET SDL2_LIBRARY 1 SDL2_LIB_PATH)
|
||||||
|
get_filename_component(SDL2_DLL_PATH ${SDL2_LIB_PATH} DIRECTORY)
|
||||||
|
get_filename_component(SDL2_MIXER_DLL_PATH ${SDL2_MIXER_LIBRARY} DIRECTORY)
|
||||||
|
message(STATUS "copy paths='${SDL2_DLL_PATH}' '${SDL2_MIXER_DLL_PATH}'")
|
||||||
|
add_custom_command(TARGET SpaceCadetPinball POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SDL2_DLL_PATH}/SDL2.dll" $<TARGET_FILE_DIR:SpaceCadetPinball>
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${SDL2_MIXER_DLL_PATH}/SDL2_mixer.dll" $<TARGET_FILE_DIR:SpaceCadetPinball>
|
||||||
|
)
|
||||||
|
endif()
|
173
CMakeModules/FindSDL2.cmake
Normal file
173
CMakeModules/FindSDL2.cmake
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
|
||||||
|
# This module defines
|
||||||
|
# SDL2_LIBRARY, the name of the library to link against
|
||||||
|
# SDL2_FOUND, if false, do not try to link to SDL2
|
||||||
|
# SDL2_INCLUDE_DIR, where to find SDL.h
|
||||||
|
#
|
||||||
|
# This module responds to the the flag:
|
||||||
|
# SDL2_BUILDING_LIBRARY
|
||||||
|
# If this is defined, then no SDL2main will be linked in because
|
||||||
|
# only applications need main().
|
||||||
|
# Otherwise, it is assumed you are building an application and this
|
||||||
|
# module will attempt to locate and set the the proper link flags
|
||||||
|
# as part of the returned SDL2_LIBRARY variable.
|
||||||
|
#
|
||||||
|
# Don't forget to include SDLmain.h and SDLmain.m your project for the
|
||||||
|
# OS X framework based version. (Other versions link to -lSDL2main which
|
||||||
|
# this module will try to find on your behalf.) Also for OS X, this
|
||||||
|
# module will automatically add the -framework Cocoa on your behalf.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration
|
||||||
|
# and no SDL2_LIBRARY, it means CMake did not find your SDL2 library
|
||||||
|
# (SDL2.dll, libsdl2.so, SDL2.framework, etc).
|
||||||
|
# Set SDL2_LIBRARY_TEMP to point to your SDL2 library, and configure again.
|
||||||
|
# Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value
|
||||||
|
# as appropriate. These values are used to generate the final SDL2_LIBRARY
|
||||||
|
# variable, but when these values are unset, SDL2_LIBRARY does not get created.
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# $SDL2DIR is an environment variable that would
|
||||||
|
# correspond to the ./configure --prefix=$SDL2DIR
|
||||||
|
# used in building SDL2.
|
||||||
|
# l.e.galup 9-20-02
|
||||||
|
#
|
||||||
|
# Modified by Eric Wing.
|
||||||
|
# Added code to assist with automated building by using environmental variables
|
||||||
|
# and providing a more controlled/consistent search behavior.
|
||||||
|
# Added new modifications to recognize OS X frameworks and
|
||||||
|
# additional Unix paths (FreeBSD, etc).
|
||||||
|
# Also corrected the header search path to follow "proper" SDL guidelines.
|
||||||
|
# Added a search for SDL2main which is needed by some platforms.
|
||||||
|
# Added a search for threads which is needed by some platforms.
|
||||||
|
# Added needed compile switches for MinGW.
|
||||||
|
#
|
||||||
|
# On OSX, this will prefer the Framework version (if found) over others.
|
||||||
|
# People will have to manually change the cache values of
|
||||||
|
# SDL2_LIBRARY to override this selection or set the CMake environment
|
||||||
|
# CMAKE_INCLUDE_PATH to modify the search paths.
|
||||||
|
#
|
||||||
|
# Note that the header path has changed from SDL2/SDL.h to just SDL.h
|
||||||
|
# This needed to change because "proper" SDL convention
|
||||||
|
# is #include "SDL.h", not <SDL2/SDL.h>. This is done for portability
|
||||||
|
# reasons because not all systems place things in SDL2/ (see FreeBSD).
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Copyright 2003-2009 Kitware, Inc.
|
||||||
|
#
|
||||||
|
# Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
# see accompanying file Copyright.txt for details.
|
||||||
|
#
|
||||||
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
# See the License for more information.
|
||||||
|
#=============================================================================
|
||||||
|
# (To distribute this file outside of CMake, substitute the full
|
||||||
|
# License text for the above reference.)
|
||||||
|
|
||||||
|
# message("<FindSDL2.cmake>")
|
||||||
|
|
||||||
|
SET(SDL2_SEARCH_PATHS
|
||||||
|
~/Library/Frameworks
|
||||||
|
/Library/Frameworks
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
/sw # Fink
|
||||||
|
/opt/local # DarwinPorts
|
||||||
|
/opt/csw # Blastwave
|
||||||
|
/opt
|
||||||
|
${SDL2_PATH}
|
||||||
|
)
|
||||||
|
|
||||||
|
FIND_PATH(SDL2_INCLUDE_DIR SDL.h
|
||||||
|
HINTS
|
||||||
|
$ENV{SDL2DIR}
|
||||||
|
PATH_SUFFIXES include/SDL2 include
|
||||||
|
PATHS ${SDL2_SEARCH_PATHS}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
set(PATH_SUFFIXES lib64 lib/x64 lib)
|
||||||
|
else()
|
||||||
|
set(PATH_SUFFIXES lib/x86 lib)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
FIND_LIBRARY(SDL2_LIBRARY_TEMP
|
||||||
|
NAMES SDL2
|
||||||
|
HINTS
|
||||||
|
$ENV{SDL2DIR}
|
||||||
|
PATH_SUFFIXES ${PATH_SUFFIXES}
|
||||||
|
PATHS ${SDL2_SEARCH_PATHS}
|
||||||
|
)
|
||||||
|
|
||||||
|
IF(NOT SDL2_BUILDING_LIBRARY)
|
||||||
|
IF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
|
||||||
|
# Non-OS X framework versions expect you to also dynamically link to
|
||||||
|
# SDL2main. This is mainly for Windows and OS X. Other (Unix) platforms
|
||||||
|
# seem to provide SDL2main for compatibility even though they don't
|
||||||
|
# necessarily need it.
|
||||||
|
FIND_LIBRARY(SDL2MAIN_LIBRARY
|
||||||
|
NAMES SDL2main
|
||||||
|
HINTS
|
||||||
|
$ENV{SDL2DIR}
|
||||||
|
PATH_SUFFIXES ${PATH_SUFFIXES}
|
||||||
|
PATHS ${SDL2_SEARCH_PATHS}
|
||||||
|
)
|
||||||
|
ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
|
||||||
|
ENDIF(NOT SDL2_BUILDING_LIBRARY)
|
||||||
|
|
||||||
|
# SDL2 may require threads on your system.
|
||||||
|
# The Apple build may not need an explicit flag because one of the
|
||||||
|
# frameworks may already provide it.
|
||||||
|
# But for non-OSX systems, I will use the CMake Threads package.
|
||||||
|
IF(NOT APPLE)
|
||||||
|
FIND_PACKAGE(Threads)
|
||||||
|
ENDIF(NOT APPLE)
|
||||||
|
|
||||||
|
# MinGW needs an additional link flag, -mwindows
|
||||||
|
# It's total link flags should look like -lmingw32 -lSDL2main -lSDL2 -mwindows
|
||||||
|
IF(MINGW)
|
||||||
|
SET(MINGW32_LIBRARY mingw32 "-mwindows" CACHE STRING "mwindows for MinGW")
|
||||||
|
ENDIF(MINGW)
|
||||||
|
|
||||||
|
IF(SDL2_LIBRARY_TEMP)
|
||||||
|
# For SDL2main
|
||||||
|
IF(NOT SDL2_BUILDING_LIBRARY)
|
||||||
|
IF(SDL2MAIN_LIBRARY)
|
||||||
|
SET(SDL2_LIBRARY_TEMP ${SDL2MAIN_LIBRARY} ${SDL2_LIBRARY_TEMP})
|
||||||
|
ENDIF(SDL2MAIN_LIBRARY)
|
||||||
|
ENDIF(NOT SDL2_BUILDING_LIBRARY)
|
||||||
|
|
||||||
|
# For OS X, SDL2 uses Cocoa as a backend so it must link to Cocoa.
|
||||||
|
# CMake doesn't display the -framework Cocoa string in the UI even
|
||||||
|
# though it actually is there if I modify a pre-used variable.
|
||||||
|
# I think it has something to do with the CACHE STRING.
|
||||||
|
# So I use a temporary variable until the end so I can set the
|
||||||
|
# "real" variable in one-shot.
|
||||||
|
IF(APPLE)
|
||||||
|
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} "-framework Cocoa")
|
||||||
|
ENDIF(APPLE)
|
||||||
|
|
||||||
|
# For threads, as mentioned Apple doesn't need this.
|
||||||
|
# In fact, there seems to be a problem if I used the Threads package
|
||||||
|
# and try using this line, so I'm just skipping it entirely for OS X.
|
||||||
|
IF(NOT APPLE)
|
||||||
|
SET(SDL2_LIBRARY_TEMP ${SDL2_LIBRARY_TEMP} ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
ENDIF(NOT APPLE)
|
||||||
|
|
||||||
|
# For MinGW library
|
||||||
|
IF(MINGW)
|
||||||
|
SET(SDL2_LIBRARY_TEMP ${MINGW32_LIBRARY} ${SDL2_LIBRARY_TEMP})
|
||||||
|
ENDIF(MINGW)
|
||||||
|
|
||||||
|
# Set the final string here so the GUI reflects the final state.
|
||||||
|
SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found")
|
||||||
|
# Set the temp variable to INTERNAL so it is not seen in the CMake GUI
|
||||||
|
SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "")
|
||||||
|
ENDIF(SDL2_LIBRARY_TEMP)
|
||||||
|
|
||||||
|
# message("</FindSDL2.cmake>")
|
||||||
|
|
||||||
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)
|
100
CMakeModules/FindSDL2_mixer.cmake
Normal file
100
CMakeModules/FindSDL2_mixer.cmake
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
# Locate SDL_MIXER library
|
||||||
|
#
|
||||||
|
# This module defines:
|
||||||
|
#
|
||||||
|
# ::
|
||||||
|
#
|
||||||
|
# SDL2_MIXER_LIBRARIES, the name of the library to link against
|
||||||
|
# SDL2_MIXER_INCLUDE_DIRS, where to find the headers
|
||||||
|
# SDL2_MIXER_FOUND, if false, do not try to link against
|
||||||
|
# SDL2_MIXER_VERSION_STRING - human-readable string containing the version of SDL_MIXER
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# For backward compatibility the following variables are also set:
|
||||||
|
#
|
||||||
|
# ::
|
||||||
|
#
|
||||||
|
# SDLMIXER_LIBRARY (same value as SDL2_MIXER_LIBRARIES)
|
||||||
|
# SDLMIXER_INCLUDE_DIR (same value as SDL2_MIXER_INCLUDE_DIRS)
|
||||||
|
# SDLMIXER_FOUND (same value as SDL2_MIXER_FOUND)
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# $SDLDIR is an environment variable that would correspond to the
|
||||||
|
# ./configure --prefix=$SDLDIR used in building SDL.
|
||||||
|
#
|
||||||
|
# Created by Eric Wing. This was influenced by the FindSDL.cmake
|
||||||
|
# module, but with modifications to recognize OS X frameworks and
|
||||||
|
# additional Unix paths (FreeBSD, etc).
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Copyright 2005-2009 Kitware, Inc.
|
||||||
|
# Copyright 2012 Benjamin Eikel
|
||||||
|
#
|
||||||
|
# Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
# see accompanying file Copyright.txt for details.
|
||||||
|
#
|
||||||
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
# See the License for more information.
|
||||||
|
#=============================================================================
|
||||||
|
# (To distribute this file outside of CMake, substitute the full
|
||||||
|
# License text for the above reference.)
|
||||||
|
|
||||||
|
find_path(SDL2_MIXER_INCLUDE_DIR SDL_mixer.h
|
||||||
|
HINTS
|
||||||
|
ENV SDL2MIXERDIR
|
||||||
|
ENV SDL2DIR
|
||||||
|
PATH_SUFFIXES SDL2
|
||||||
|
# path suffixes to search inside ENV{SDLDIR}
|
||||||
|
include/SDL2 include
|
||||||
|
PATHS ${SDL2_MIXER_PATH}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
set(VC_LIB_PATH_SUFFIX lib/x64)
|
||||||
|
else()
|
||||||
|
set(VC_LIB_PATH_SUFFIX lib/x86)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_library(SDL2_MIXER_LIBRARY
|
||||||
|
NAMES SDL2_mixer
|
||||||
|
HINTS
|
||||||
|
ENV SDL2MIXERDIR
|
||||||
|
ENV SDL2DIR
|
||||||
|
PATH_SUFFIXES lib bin ${VC_LIB_PATH_SUFFIX}
|
||||||
|
PATHS ${SDL2_MIXER_PATH}
|
||||||
|
)
|
||||||
|
|
||||||
|
if(SDL2_MIXER_INCLUDE_DIR AND EXISTS "${SDL2_MIXER_INCLUDE_DIR}/SDL_mixer.h")
|
||||||
|
file(STRINGS "${SDL2_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL2_MIXER_VERSION_MAJOR_LINE REGEX "^#define[ \t]+SDL_MIXER_MAJOR_VERSION[ \t]+[0-9]+$")
|
||||||
|
file(STRINGS "${SDL2_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL2_MIXER_VERSION_MINOR_LINE REGEX "^#define[ \t]+SDL_MIXER_MINOR_VERSION[ \t]+[0-9]+$")
|
||||||
|
file(STRINGS "${SDL2_MIXER_INCLUDE_DIR}/SDL_mixer.h" SDL2_MIXER_VERSION_PATCH_LINE REGEX "^#define[ \t]+SDL_MIXER_PATCHLEVEL[ \t]+[0-9]+$")
|
||||||
|
string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_MAJOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_MIXER_VERSION_MAJOR "${SDL2_MIXER_VERSION_MAJOR_LINE}")
|
||||||
|
string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_MINOR_VERSION[ \t]+([0-9]+)$" "\\1" SDL2_MIXER_VERSION_MINOR "${SDL2_MIXER_VERSION_MINOR_LINE}")
|
||||||
|
string(REGEX REPLACE "^#define[ \t]+SDL_MIXER_PATCHLEVEL[ \t]+([0-9]+)$" "\\1" SDL2_MIXER_VERSION_PATCH "${SDL2_MIXER_VERSION_PATCH_LINE}")
|
||||||
|
set(SDL2_MIXER_VERSION_STRING ${SDL2_MIXER_VERSION_MAJOR}.${SDL2_MIXER_VERSION_MINOR}.${SDL2_MIXER_VERSION_PATCH})
|
||||||
|
unset(SDL2_MIXER_VERSION_MAJOR_LINE)
|
||||||
|
unset(SDL2_MIXER_VERSION_MINOR_LINE)
|
||||||
|
unset(SDL2_MIXER_VERSION_PATCH_LINE)
|
||||||
|
unset(SDL2_MIXER_VERSION_MAJOR)
|
||||||
|
unset(SDL2_MIXER_VERSION_MINOR)
|
||||||
|
unset(SDL2_MIXER_VERSION_PATCH)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(SDL2_MIXER_LIBRARIES ${SDL2_MIXER_LIBRARY})
|
||||||
|
set(SDL2_MIXER_INCLUDE_DIRS ${SDL2_MIXER_INCLUDE_DIR})
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_mixer
|
||||||
|
REQUIRED_VARS SDL2_MIXER_LIBRARIES SDL2_MIXER_INCLUDE_DIRS
|
||||||
|
VERSION_VAR SDL2_MIXER_VERSION_STRING)
|
||||||
|
|
||||||
|
# for backward compatibility
|
||||||
|
set(SDLMIXER_LIBRARY ${SDL2_MIXER_LIBRARIES})
|
||||||
|
set(SDLMIXER_INCLUDE_DIR ${SDL2_MIXER_INCLUDE_DIRS})
|
||||||
|
set(SDLMIXER_FOUND ${SDL2_MIXER_FOUND})
|
||||||
|
|
||||||
|
mark_as_advanced(SDL2_MIXER_LIBRARY SDL2_MIXER_INCLUDE_DIR)
|
13
README.md
13
README.md
@ -1,7 +1,7 @@
|
|||||||
# SpaceCadetPinball
|
# SpaceCadetPinball
|
||||||
**Summary:** Reverse engineering of `3D Pinball for Windows – Space Cadet`, a game bundled with Windows.
|
**Summary:** Reverse engineering of `3D Pinball for Windows – Space Cadet`, a game bundled with Windows.
|
||||||
|
|
||||||
**How to play:** Place compiled exe into a folder containing original game resources (not included).\
|
**How to play:** Place compiled executable into a folder containing original game resources (not included).\
|
||||||
Supports data files from Windows and Full Tilt versions of the game.
|
Supports data files from Windows and Full Tilt versions of the game.
|
||||||
\
|
\
|
||||||
\
|
\
|
||||||
@ -20,8 +20,15 @@ Supports data files from Windows and Full Tilt versions of the game.
|
|||||||
* All subs were decompiled, C pseudo code was converted to compilable C++. Loose (namespace?) subs were assigned to classes.
|
* All subs were decompiled, C pseudo code was converted to compilable C++. Loose (namespace?) subs were assigned to classes.
|
||||||
|
|
||||||
**Compiling:**\
|
**Compiling:**\
|
||||||
Project uses `C++11` features and depends on Windows libs.\
|
Project uses `C++11` and depends on `SDL2` libs.\
|
||||||
Compile with Visual Studio; tested with 2017 and 2019.
|
On Windows:\
|
||||||
|
Download and unpack devel packages for `SDL2` and `SDL2_mixer`.\
|
||||||
|
Set paths to them in CMakeLists.txt, see suggested placement in /Libs.\
|
||||||
|
Compile with Visual Studio; tested with 2019.
|
||||||
|
|
||||||
|
On Linux:\
|
||||||
|
Install devel packages for `SDL2` and `SDL2_mixer`.\
|
||||||
|
Compile with CMake; tested with GCC 10.
|
||||||
|
|
||||||
**Plans:**
|
**Plans:**
|
||||||
* ~~Decompile original game~~
|
* ~~Decompile original game~~
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
#include "objlist_class.h"
|
#include "objlist_class.h"
|
||||||
#include "partman.h"
|
#include "partman.h"
|
||||||
#include "gdrv.h"
|
#include "gdrv.h"
|
||||||
@ -38,7 +37,7 @@ int main(int argc, char* argv[])
|
|||||||
|
|
||||||
auto xx = sizeof(datFileHeader);
|
auto xx = sizeof(datFileHeader);
|
||||||
|
|
||||||
strcpy_s(winmain::DatFileName, "PINBALL.DAT");
|
strncpy(winmain::DatFileName, "PINBALL.DAT", sizeof winmain::DatFileName);
|
||||||
pb::init();
|
pb::init();
|
||||||
auto datFile = pb::record_table;
|
auto datFile = pb::record_table;
|
||||||
|
|
||||||
@ -71,7 +70,7 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
auto rsc = pinball::get_rc_string(i, 0);
|
auto rsc = pinball::get_rc_string(i, 0);
|
||||||
if (rsc)
|
if (rsc)
|
||||||
printf_s("%d:\t%s\n", i, rsc);
|
printf("%d:\t%s\n", i, rsc);
|
||||||
}
|
}
|
||||||
|
|
||||||
//DatParser::Parse(dataFileName);
|
//DatParser::Parse(dataFileName);
|
||||||
|
@ -58,7 +58,7 @@ TBall::TBall(TPinballTable* table) : TPinballComponent(table, -1, false)
|
|||||||
}
|
}
|
||||||
while (index < visualCount);
|
while (index < visualCount);
|
||||||
}
|
}
|
||||||
RenderSprite = render::create_sprite(VisualType::Ball, nullptr, nullptr, 0, 0, nullptr);
|
RenderSprite = render::create_sprite(VisualTypes::Ball, nullptr, nullptr, 0, 0, nullptr);
|
||||||
PinballTable->CollisionCompOffset = Offset;
|
PinballTable->CollisionCompOffset = Offset;
|
||||||
Position.Z = Offset;
|
Position.Z = Offset;
|
||||||
}
|
}
|
||||||
@ -138,10 +138,9 @@ void TBall::throw_ball(TBall* ball, vector_type* acceleration, float angleMult,
|
|||||||
{
|
{
|
||||||
ball->CollisionComp = nullptr;
|
ball->CollisionComp = nullptr;
|
||||||
ball->Acceleration = *acceleration;
|
ball->Acceleration = *acceleration;
|
||||||
float rnd = static_cast<float>(rand());
|
float rnd = RandFloat();
|
||||||
float angle = (1.0f - (rnd * 0.00003051850947599719f + rnd * 0.00003051850947599719f)) * angleMult;
|
float angle = (1.0f - (rnd + rnd)) * angleMult;
|
||||||
maths::RotateVector(&ball->Acceleration, angle);
|
maths::RotateVector(&ball->Acceleration, angle);
|
||||||
rnd = static_cast<float>(rand());
|
rnd = RandFloat();
|
||||||
ball->Speed = (1.0f - (rnd * 0.00003051850947599719f + rnd * 0.00003051850947599719f)) * (speedMult1 *
|
ball->Speed = (1.0f - (rnd + rnd)) * (speedMult1 * speedMult2) + speedMult1;
|
||||||
speedMult2) + speedMult1;
|
|
||||||
}
|
}
|
||||||
|
@ -105,8 +105,7 @@ void TDemo::Collision(TBall* ball, vector_type* nextPosition, vector_type* direc
|
|||||||
case 1400:
|
case 1400:
|
||||||
if (!FlipLeftTimer && !FlipLeftFlag)
|
if (!FlipLeftTimer && !FlipLeftFlag)
|
||||||
{
|
{
|
||||||
float time = FlipTimerTime1 + FlipTimerTime2 - static_cast<float>(rand()) *
|
float time = FlipTimerTime1 + FlipTimerTime2 - RandFloat() * (FlipTimerTime2 + FlipTimerTime2);
|
||||||
0.00003051850947599719f * (FlipTimerTime2 + FlipTimerTime2);
|
|
||||||
FlipLeftTimer = timer::set(time, this, FlipLeft);
|
FlipLeftTimer = timer::set(time, this, FlipLeft);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -116,8 +115,7 @@ void TDemo::Collision(TBall* ball, vector_type* nextPosition, vector_type* direc
|
|||||||
case 1402:
|
case 1402:
|
||||||
if (!FlipRightTimer && !FlipRightFlag)
|
if (!FlipRightTimer && !FlipRightFlag)
|
||||||
{
|
{
|
||||||
float time = FlipTimerTime1 + FlipTimerTime2 - static_cast<float>(rand()) *
|
float time = FlipTimerTime1 + FlipTimerTime2 - RandFloat() * (FlipTimerTime2 + FlipTimerTime2);
|
||||||
0.00003051850947599719f * (FlipTimerTime2 + FlipTimerTime2);
|
|
||||||
FlipRightTimer = timer::set(time, this, FlipRight);
|
FlipRightTimer = timer::set(time, this, FlipRight);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -128,7 +126,7 @@ void TDemo::Collision(TBall* ball, vector_type* nextPosition, vector_type* direc
|
|||||||
if (!PlungerFlag)
|
if (!PlungerFlag)
|
||||||
{
|
{
|
||||||
PinballTable->Message(1004, ball->TimeNow);
|
PinballTable->Message(1004, ball->TimeNow);
|
||||||
float time = static_cast<float>(rand()) * 0.00003051850947599719f + 2.0f;
|
float time = RandFloat() + 2.0f;
|
||||||
PlungerFlag = timer::set(time, this, PlungerRelease);
|
PlungerFlag = timer::set(time, this, PlungerRelease);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -172,8 +170,8 @@ void TDemo::FlipRight(int timerId, void* caller)
|
|||||||
}
|
}
|
||||||
demo->PinballTable->Message(1002, pb::time_next);
|
demo->PinballTable->Message(1002, pb::time_next);
|
||||||
demo->FlipRightFlag = 1;
|
demo->FlipRightFlag = 1;
|
||||||
float time = demo->UnFlipTimerTime1 + demo->UnFlipTimerTime2 - static_cast<float>(rand()) *
|
float time = demo->UnFlipTimerTime1 + demo->UnFlipTimerTime2 - RandFloat() *
|
||||||
0.00003051850947599719f * (demo->UnFlipTimerTime2 + demo->UnFlipTimerTime2);
|
(demo->UnFlipTimerTime2 + demo->UnFlipTimerTime2);
|
||||||
timer::set(time, demo, UnFlipRight);
|
timer::set(time, demo, UnFlipRight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -190,8 +188,8 @@ void TDemo::FlipLeft(int timerId, void* caller)
|
|||||||
}
|
}
|
||||||
demo->PinballTable->Message(1000, pb::time_next);
|
demo->PinballTable->Message(1000, pb::time_next);
|
||||||
demo->FlipLeftFlag = 1;
|
demo->FlipLeftFlag = 1;
|
||||||
float time = demo->UnFlipTimerTime1 + demo->UnFlipTimerTime2 - static_cast<float>(rand()) *
|
float time = demo->UnFlipTimerTime1 + demo->UnFlipTimerTime2 - RandFloat() *
|
||||||
0.00003051850947599719f * (demo->UnFlipTimerTime2 + demo->UnFlipTimerTime2);
|
(demo->UnFlipTimerTime2 + demo->UnFlipTimerTime2);
|
||||||
timer::set(time, demo, UnFlipLeft);
|
timer::set(time, demo, UnFlipLeft);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -175,7 +175,7 @@ int TLightGroup::Message(int code, float value)
|
|||||||
if (rand() % 100 > 70)
|
if (rand() % 100 > 70)
|
||||||
{
|
{
|
||||||
auto light = List->Get(i);
|
auto light = List->Get(i);
|
||||||
auto randVal = static_cast<float>(rand()) * 0.00003051850947599719f * value * 3.0f + 0.1f;
|
auto randVal = RandFloat() * value * 3.0f + 0.1f;
|
||||||
light->Message(9, randVal);
|
light->Message(9, randVal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ TPinballComponent::TPinballComponent(TPinballTable* table, int groupIndex, bool
|
|||||||
ListZMap = new objlist_class<zmap_header_type>(0, 4);
|
ListZMap = new objlist_class<zmap_header_type>(0, 4);
|
||||||
for (int index = 0; index < ListBitmap->GetCount(); index++)
|
for (int index = 0; index < ListBitmap->GetCount(); index++)
|
||||||
{
|
{
|
||||||
assertm(ListBitmap->Get(index)->BitmapType == BitmapType::Spliced, "Wrong zMap padding");
|
assertm(ListBitmap->Get(index)->BitmapType == BitmapTypes::Spliced, "Wrong zMap padding");
|
||||||
ListZMap->Add(visual.ZMap);
|
ListZMap->Add(visual.ZMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -78,7 +78,7 @@ TPinballComponent::TPinballComponent(TPinballTable* table, int groupIndex, bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
RenderSprite = render::create_sprite(
|
RenderSprite = render::create_sprite(
|
||||||
visualCount > 0 ? VisualType::Sprite : VisualType::None,
|
visualCount > 0 ? VisualTypes::Sprite : VisualTypes::None,
|
||||||
rootBmp,
|
rootBmp,
|
||||||
zMap,
|
zMap,
|
||||||
rootBmp->XPosition - table->XOffset,
|
rootBmp->XPosition - table->XOffset,
|
||||||
|
@ -253,7 +253,7 @@ TPinballComponent* TPinballTable::find_component(int groupIndex)
|
|||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_itoa_s(groupIndex, Buffer, 10);
|
snprintf(Buffer, sizeof Buffer, "%d", groupIndex);
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "Table cant find (lh):", Buffer, nullptr);
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "Table cant find (lh):", Buffer, nullptr);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ void TPlunger::Collision(TBall* ball, vector_type* nextPosition, vector_type* di
|
|||||||
{
|
{
|
||||||
if (PinballTable->TiltLockFlag)
|
if (PinballTable->TiltLockFlag)
|
||||||
Message(1017, 0.0);
|
Message(1017, 0.0);
|
||||||
coef = static_cast<float>(rand()) * 0.00003051850947599719f * Boost * 0.1f + Boost;
|
coef = RandFloat() * Boost * 0.1f + Boost;
|
||||||
maths::basic_collision(ball, nextPosition, direction, Elasticity, Smoothness, Threshold, coef);
|
maths::basic_collision(ball, nextPosition, direction, Elasticity, Smoothness, Threshold, coef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ TTableLayer::TTableLayer(TPinballTable* table): TCollisionComponent(table, -1, f
|
|||||||
rect.YPosition = 0;
|
rect.YPosition = 0;
|
||||||
rect.Width = bmp->Width;
|
rect.Width = bmp->Width;
|
||||||
rect.Height = bmp->Height;
|
rect.Height = bmp->Height;
|
||||||
render::create_sprite(VisualType::None, bmp, visual.ZMap, 0, 0, &rect);
|
render::create_sprite(VisualTypes::None, bmp, visual.ZMap, 0, 0, &rect);
|
||||||
|
|
||||||
PinballTable->SoundIndex1 = visual.SoundIndex4;
|
PinballTable->SoundIndex1 = visual.SoundIndex4;
|
||||||
PinballTable->SoundIndex2 = visual.SoundIndex3;
|
PinballTable->SoundIndex2 = visual.SoundIndex3;
|
||||||
@ -112,7 +112,7 @@ TTableLayer::~TTableLayer()
|
|||||||
|
|
||||||
int TTableLayer::FieldEffect(TBall* ball, vector_type* vecDst)
|
int TTableLayer::FieldEffect(TBall* ball, vector_type* vecDst)
|
||||||
{
|
{
|
||||||
vecDst->X = GraityDirX - (0.5f - static_cast<float>(rand()) * 0.00003051850947599719f + ball->Acceleration.X) *
|
vecDst->X = GraityDirX - (0.5f - RandFloat() + ball->Acceleration.X) *
|
||||||
ball->Speed * GraityMult;
|
ball->Speed * GraityMult;
|
||||||
vecDst->Y = GraityDirY - ball->Acceleration.Y * ball->Speed * GraityMult;
|
vecDst->Y = GraityDirY - ball->Acceleration.Y * ball->Speed * GraityMult;
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -13,7 +13,7 @@ TTextBoxMessage::TTextBoxMessage(char* text, float time)
|
|||||||
const auto textLen = strlen(text) + 1;
|
const auto textLen = strlen(text) + 1;
|
||||||
Text = memory::allocate(textLen);
|
Text = memory::allocate(textLen);
|
||||||
if (Text)
|
if (Text)
|
||||||
strcpy_s(Text, textLen, text);
|
strncpy(Text, text, textLen);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Text = nullptr;
|
Text = nullptr;
|
||||||
|
@ -954,7 +954,7 @@ int control::AddRankProgress(int rank)
|
|||||||
{
|
{
|
||||||
middleCircle->Message(41, 5.0);
|
middleCircle->Message(41, 5.0);
|
||||||
auto rankText = pinball::get_rc_string(RankRcArray[midActiveCount], 1);
|
auto rankText = pinball::get_rc_string(RankRcArray[midActiveCount], 1);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(83, 0), rankText);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(83, 0), rankText);
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
||||||
control_soundwave10_tag.Component->Play();
|
control_soundwave10_tag.Component->Play();
|
||||||
}
|
}
|
||||||
@ -1078,7 +1078,7 @@ void control::DeploymentChuteToEscapeChuteOneWayControl(int code, TPinballCompon
|
|||||||
{
|
{
|
||||||
control_soundwave3_tag.Component->Play();
|
control_soundwave3_tag.Component->Play();
|
||||||
int score = TableG->AddScore(caller->get_scoring(count - 1));
|
int score = TableG->AddScore(caller->get_scoring(count - 1));
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(21, 0), score);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(21, 0), score);
|
||||||
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
||||||
if (!light_on(&control_lite56_tag))
|
if (!light_on(&control_lite56_tag))
|
||||||
{
|
{
|
||||||
@ -1141,7 +1141,7 @@ void control::LaunchRampControl(int code, TPinballComponent* caller)
|
|||||||
{
|
{
|
||||||
someFlag = 1;
|
someFlag = 1;
|
||||||
int addedScore = SpecialAddScore(TableG->ScoreSpecial1);
|
int addedScore = SpecialAddScore(TableG->ScoreSpecial1);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(10, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(10, 0), addedScore);
|
||||||
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
||||||
}
|
}
|
||||||
if (light_on(&control_lite55_tag))
|
if (light_on(&control_lite55_tag))
|
||||||
@ -1381,7 +1381,7 @@ void control::BonusLaneRolloverControl(int code, TPinballComponent* caller)
|
|||||||
if (light_on(&control_lite16_tag))
|
if (light_on(&control_lite16_tag))
|
||||||
{
|
{
|
||||||
int addedScore = SpecialAddScore(TableG->ScoreSpecial2);
|
int addedScore = SpecialAddScore(TableG->ScoreSpecial2);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(3, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(3, 0), addedScore);
|
||||||
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
||||||
control_lite16_tag.Component->Message(20, 0.0);
|
control_lite16_tag.Component->Message(20, 0.0);
|
||||||
control_soundwave50_1_tag.Component->Play();
|
control_soundwave50_1_tag.Component->Play();
|
||||||
@ -1884,7 +1884,7 @@ void control::BlackHoleKickoutControl(int code, TPinballComponent* caller)
|
|||||||
if (code == 63)
|
if (code == 63)
|
||||||
{
|
{
|
||||||
int addedScore = TableG->AddScore(caller->get_scoring(0));
|
int addedScore = TableG->AddScore(caller->get_scoring(0));
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(80, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(80, 0), addedScore);
|
||||||
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
||||||
caller->Message(55, -1.0);
|
caller->Message(55, -1.0);
|
||||||
}
|
}
|
||||||
@ -1912,7 +1912,7 @@ void control::GravityWellKickoutControl(int code, TPinballComponent* caller)
|
|||||||
case 63:
|
case 63:
|
||||||
{
|
{
|
||||||
auto addedScore = TableG->AddScore(caller->get_scoring(0));
|
auto addedScore = TableG->AddScore(caller->get_scoring(0));
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(81, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(81, 0), addedScore);
|
||||||
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
||||||
control_lite62_tag.Component->Message(20, 0.0);
|
control_lite62_tag.Component->Message(20, 0.0);
|
||||||
caller->ActiveFlag = 0;
|
caller->ActiveFlag = 0;
|
||||||
@ -1925,11 +1925,11 @@ void control::GravityWellKickoutControl(int code, TPinballComponent* caller)
|
|||||||
auto score = reinterpret_cast<size_t>(caller);
|
auto score = reinterpret_cast<size_t>(caller);
|
||||||
if (score)
|
if (score)
|
||||||
{
|
{
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(82, 0), score);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(82, 0), score);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(45, 0));
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(45, 0));
|
||||||
}
|
}
|
||||||
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
||||||
control_lite62_tag.Component->Message(4, 0.0);
|
control_lite62_tag.Component->Message(4, 0.0);
|
||||||
@ -2199,14 +2199,14 @@ void control::HyperspaceKickOutControl(int code, TPinballComponent* caller)
|
|||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
auto addedScore = TableG->AddScore(caller->get_scoring(0));
|
auto addedScore = TableG->AddScore(caller->get_scoring(0));
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(12, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(12, 0), addedScore);
|
||||||
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
auto addedScore = SpecialAddScore(TableG->ScoreSpecial3);
|
auto addedScore = SpecialAddScore(TableG->ScoreSpecial3);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(14, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(14, 0), addedScore);
|
||||||
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
||||||
TableG->ScoreSpecial3 = 20000;
|
TableG->ScoreSpecial3 = 20000;
|
||||||
break;
|
break;
|
||||||
@ -2215,7 +2215,7 @@ void control::HyperspaceKickOutControl(int code, TPinballComponent* caller)
|
|||||||
{
|
{
|
||||||
DrainBallBlockerControl(52, control_block1_tag.Component);
|
DrainBallBlockerControl(52, control_block1_tag.Component);
|
||||||
auto addedScore = TableG->AddScore(caller->get_scoring(2));
|
auto addedScore = TableG->AddScore(caller->get_scoring(2));
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(2, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(2, 0), addedScore);
|
||||||
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2223,7 +2223,7 @@ void control::HyperspaceKickOutControl(int code, TPinballComponent* caller)
|
|||||||
{
|
{
|
||||||
ExtraBallLightControl(19, nullptr);
|
ExtraBallLightControl(19, nullptr);
|
||||||
auto addedScore = TableG->AddScore(caller->get_scoring(3));
|
auto addedScore = TableG->AddScore(caller->get_scoring(3));
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(8, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(8, 0), addedScore);
|
||||||
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -2243,7 +2243,7 @@ void control::HyperspaceKickOutControl(int code, TPinballComponent* caller)
|
|||||||
{
|
{
|
||||||
someFlag = 1;
|
someFlag = 1;
|
||||||
auto addedScore = SpecialAddScore(TableG->ScoreSpecial1);
|
auto addedScore = SpecialAddScore(TableG->ScoreSpecial1);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(10, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(10, 0), addedScore);
|
||||||
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
||||||
}
|
}
|
||||||
if (light_on(&control_lite26_tag))
|
if (light_on(&control_lite26_tag))
|
||||||
@ -2504,7 +2504,7 @@ void control::BallDrainControl(int code, TPinballComponent* caller)
|
|||||||
if (!TableG->TiltLockFlag)
|
if (!TableG->TiltLockFlag)
|
||||||
{
|
{
|
||||||
int time = SpecialAddScore(TableG->ScoreSpecial2);
|
int time = SpecialAddScore(TableG->ScoreSpecial2);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(94, 0), time);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(94, 0), time);
|
||||||
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
control_info_text_box_tag.Component->Display(Buffer, 2.0);
|
||||||
}
|
}
|
||||||
if (TableG->ExtraBalls)
|
if (TableG->ExtraBalls)
|
||||||
@ -2689,7 +2689,7 @@ void control::AlienMenacePartTwoController(int code, TPinballComponent* caller)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(107, 0),
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(107, 0),
|
||||||
control_lite56_tag.Component->MessageField);
|
control_lite56_tag.Component->MessageField);
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
||||||
return;
|
return;
|
||||||
@ -2712,7 +2712,7 @@ void control::AlienMenacePartTwoController(int code, TPinballComponent* caller)
|
|||||||
MissionControl(66, nullptr);
|
MissionControl(66, nullptr);
|
||||||
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(130, 0), 4.0);
|
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(130, 0), 4.0);
|
||||||
int addedScore = SpecialAddScore(750000);
|
int addedScore = SpecialAddScore(750000);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(78, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(78, 0), addedScore);
|
||||||
if (!AddRankProgress(7))
|
if (!AddRankProgress(7))
|
||||||
{
|
{
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
||||||
@ -2744,7 +2744,7 @@ void control::BlackHoleThreatController(int code, TPinballComponent* caller)
|
|||||||
MissionControl(66, nullptr);
|
MissionControl(66, nullptr);
|
||||||
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(124, 0), 4.0);
|
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(124, 0), 4.0);
|
||||||
int addedScore = SpecialAddScore(1000000);
|
int addedScore = SpecialAddScore(1000000);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(78, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(78, 0), addedScore);
|
||||||
if (!AddRankProgress(8))
|
if (!AddRankProgress(8))
|
||||||
{
|
{
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
||||||
@ -2826,7 +2826,7 @@ void control::BugHuntController(int code, TPinballComponent* caller)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(125, 0), control_lite56_tag.Component->MessageField);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(125, 0), control_lite56_tag.Component->MessageField);
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2869,7 +2869,7 @@ void control::BugHuntController(int code, TPinballComponent* caller)
|
|||||||
MissionControl(66, nullptr);
|
MissionControl(66, nullptr);
|
||||||
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(126, 0), 4.0);
|
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(126, 0), 4.0);
|
||||||
int addedScore = SpecialAddScore(750000);
|
int addedScore = SpecialAddScore(750000);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(78, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(78, 0), addedScore);
|
||||||
if (!AddRankProgress(7))
|
if (!AddRankProgress(7))
|
||||||
{
|
{
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
||||||
@ -2897,7 +2897,7 @@ void control::CosmicPlagueController(int code, TPinballComponent* caller)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(139, 0), control_lite56_tag.Component->MessageField);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(139, 0), control_lite56_tag.Component->MessageField);
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2944,7 +2944,7 @@ void control::CosmicPlaguePartTwoController(int code, TPinballComponent* caller)
|
|||||||
MissionControl(66, nullptr);
|
MissionControl(66, nullptr);
|
||||||
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(141, 0), 4.0);
|
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(141, 0), 4.0);
|
||||||
int addedScore = SpecialAddScore(1750000);
|
int addedScore = SpecialAddScore(1750000);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(78, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(78, 0), addedScore);
|
||||||
if (!AddRankProgress(11))
|
if (!AddRankProgress(11))
|
||||||
{
|
{
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
||||||
@ -2969,7 +2969,7 @@ void control::DoomsdayMachineController(int code, TPinballComponent* caller)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(137, 0), control_lite56_tag.Component->MessageField);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(137, 0), control_lite56_tag.Component->MessageField);
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2988,7 +2988,7 @@ void control::DoomsdayMachineController(int code, TPinballComponent* caller)
|
|||||||
MissionControl(66, nullptr);
|
MissionControl(66, nullptr);
|
||||||
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(138, 0), 4.0);
|
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(138, 0), 4.0);
|
||||||
int addedScore = SpecialAddScore(1250000);
|
int addedScore = SpecialAddScore(1250000);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(78, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(78, 0), addedScore);
|
||||||
if (!AddRankProgress(9))
|
if (!AddRankProgress(9))
|
||||||
{
|
{
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
||||||
@ -3042,7 +3042,7 @@ void control::GameoverController(int code, TPinballComponent* caller)
|
|||||||
}
|
}
|
||||||
if (playerNScoreText != nullptr)
|
if (playerNScoreText != nullptr)
|
||||||
{
|
{
|
||||||
sprintf_s(Buffer, playerNScoreText, playerScore);
|
snprintf(Buffer, sizeof Buffer, playerNScoreText, playerScore);
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, 3.0);
|
control_mission_text_box_tag.Component->Display(Buffer, 3.0);
|
||||||
int msgField = nextPlayerId == TableG->PlayerCount ? 0x200 : nextPlayerId | 0x100;
|
int msgField = nextPlayerId == TableG->PlayerCount ? 0x200 : nextPlayerId | 0x100;
|
||||||
control_mission_text_box_tag.Component->MessageField = msgField;
|
control_mission_text_box_tag.Component->MessageField = msgField;
|
||||||
@ -3082,7 +3082,7 @@ void control::GameoverController(int code, TPinballComponent* caller)
|
|||||||
}
|
}
|
||||||
if (highScoreNText != nullptr)
|
if (highScoreNText != nullptr)
|
||||||
{
|
{
|
||||||
sprintf_s(Buffer, highScoreNText, highScore);
|
snprintf(Buffer, sizeof Buffer, highScoreNText, highScore);
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, 3.0);
|
control_mission_text_box_tag.Component->Display(Buffer, 3.0);
|
||||||
int msgField = nextHidhscoreId == 5 ? 0 : nextHidhscoreId | 0x200;
|
int msgField = nextHidhscoreId == 5 ? 0 : nextHidhscoreId | 0x200;
|
||||||
control_mission_text_box_tag.Component->MessageField = msgField;
|
control_mission_text_box_tag.Component->MessageField = msgField;
|
||||||
@ -3110,7 +3110,7 @@ void control::LaunchTrainingController(int code, TPinballComponent* caller)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(110, 0), control_lite56_tag.Component->MessageField);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(110, 0), control_lite56_tag.Component->MessageField);
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3128,7 +3128,7 @@ void control::LaunchTrainingController(int code, TPinballComponent* caller)
|
|||||||
MissionControl(66, nullptr);
|
MissionControl(66, nullptr);
|
||||||
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(111, 0), 4.0);
|
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(111, 0), 4.0);
|
||||||
int addedScore = SpecialAddScore(500000);
|
int addedScore = SpecialAddScore(500000);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(78, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(78, 0), addedScore);
|
||||||
if (!AddRankProgress(6))
|
if (!AddRankProgress(6))
|
||||||
{
|
{
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
||||||
@ -3155,7 +3155,7 @@ void control::MaelstromController(int code, TPinballComponent* caller)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(148, 0), control_lite56_tag.Component->MessageField);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(148, 0), control_lite56_tag.Component->MessageField);
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3210,7 +3210,7 @@ void control::MaelstromPartEightController(int code, TPinballComponent* caller)
|
|||||||
control_lite198_tag.Component->MessageField = 1;
|
control_lite198_tag.Component->MessageField = 1;
|
||||||
MissionControl(66, nullptr);
|
MissionControl(66, nullptr);
|
||||||
int addedScore = SpecialAddScore(5000000);
|
int addedScore = SpecialAddScore(5000000);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(78, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(78, 0), addedScore);
|
||||||
control_info_text_box_tag.Component->Display(pinball::get_rc_string(48, 0), 4.0);
|
control_info_text_box_tag.Component->Display(pinball::get_rc_string(48, 0), 4.0);
|
||||||
if (!AddRankProgress(18))
|
if (!AddRankProgress(18))
|
||||||
{
|
{
|
||||||
@ -3343,7 +3343,7 @@ void control::MaelstromPartThreeController(int code, TPinballComponent* caller)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(150, 0), control_lite56_tag.Component->MessageField);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(150, 0), control_lite56_tag.Component->MessageField);
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3397,7 +3397,7 @@ void control::MaelstromPartTwoController(int code, TPinballComponent* caller)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(149, 0), control_lite56_tag.Component->MessageField);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(149, 0), control_lite56_tag.Component->MessageField);
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3449,7 +3449,7 @@ void control::PracticeMissionController(int code, TPinballComponent* caller)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(107, 0), control_lite56_tag.Component->MessageField);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(107, 0), control_lite56_tag.Component->MessageField);
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3472,7 +3472,7 @@ void control::PracticeMissionController(int code, TPinballComponent* caller)
|
|||||||
MissionControl(66, nullptr);
|
MissionControl(66, nullptr);
|
||||||
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(108, 0), 4.0);
|
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(108, 0), 4.0);
|
||||||
int addedScore = SpecialAddScore(500000);
|
int addedScore = SpecialAddScore(500000);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(78, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(78, 0), addedScore);
|
||||||
if (!AddRankProgress(6))
|
if (!AddRankProgress(6))
|
||||||
{
|
{
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
||||||
@ -3502,7 +3502,7 @@ void control::ReconnaissanceController(int code, TPinballComponent* caller)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(134, 0), control_lite56_tag.Component->MessageField);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(134, 0), control_lite56_tag.Component->MessageField);
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3535,7 +3535,7 @@ void control::ReconnaissanceController(int code, TPinballComponent* caller)
|
|||||||
MissionControl(66, nullptr);
|
MissionControl(66, nullptr);
|
||||||
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(136, 0), 4.0);
|
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(136, 0), 4.0);
|
||||||
int addedScore = SpecialAddScore(1250000);
|
int addedScore = SpecialAddScore(1250000);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(78, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(78, 0), addedScore);
|
||||||
if (!AddRankProgress(9))
|
if (!AddRankProgress(9))
|
||||||
{
|
{
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
||||||
@ -3566,7 +3566,7 @@ void control::ReentryTrainingController(int code, TPinballComponent* caller)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(112, 0), control_lite56_tag.Component->MessageField);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(112, 0), control_lite56_tag.Component->MessageField);
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3586,7 +3586,7 @@ void control::ReentryTrainingController(int code, TPinballComponent* caller)
|
|||||||
MissionControl(66, nullptr);
|
MissionControl(66, nullptr);
|
||||||
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(113, 0), 4.0);
|
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(113, 0), 4.0);
|
||||||
int addedScore = SpecialAddScore(500000);
|
int addedScore = SpecialAddScore(500000);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(78, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(78, 0), addedScore);
|
||||||
if (!AddRankProgress(6))
|
if (!AddRankProgress(6))
|
||||||
{
|
{
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
||||||
@ -3627,7 +3627,7 @@ void control::RescueMissionController(int code, TPinballComponent* caller)
|
|||||||
MissionControl(66, nullptr);
|
MissionControl(66, nullptr);
|
||||||
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(129, 0), 4.0);
|
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(129, 0), 4.0);
|
||||||
int addedScore = SpecialAddScore(750000);
|
int addedScore = SpecialAddScore(750000);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(78, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(78, 0), addedScore);
|
||||||
if (!AddRankProgress(7))
|
if (!AddRankProgress(7))
|
||||||
{
|
{
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
||||||
@ -3682,7 +3682,7 @@ void control::SatelliteController(int code, TPinballComponent* caller)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(132, 0), control_lite56_tag.Component->MessageField);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(132, 0), control_lite56_tag.Component->MessageField);
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3700,7 +3700,7 @@ void control::SatelliteController(int code, TPinballComponent* caller)
|
|||||||
MissionControl(66, nullptr);
|
MissionControl(66, nullptr);
|
||||||
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(133, 0), 4.0);
|
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(133, 0), 4.0);
|
||||||
int addedScore = SpecialAddScore(1250000);
|
int addedScore = SpecialAddScore(1250000);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(78, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(78, 0), addedScore);
|
||||||
if (!AddRankProgress(9))
|
if (!AddRankProgress(9))
|
||||||
{
|
{
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
||||||
@ -3745,7 +3745,7 @@ void control::ScienceMissionController(int code, TPinballComponent* caller)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(114, 0), control_lite56_tag.Component->MessageField);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(114, 0), control_lite56_tag.Component->MessageField);
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -3773,7 +3773,7 @@ void control::ScienceMissionController(int code, TPinballComponent* caller)
|
|||||||
MissionControl(66, nullptr);
|
MissionControl(66, nullptr);
|
||||||
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(115, 0), 4.0);
|
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(115, 0), 4.0);
|
||||||
int addedScore = SpecialAddScore(750000);
|
int addedScore = SpecialAddScore(750000);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(78, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(78, 0), addedScore);
|
||||||
if (!AddRankProgress(9))
|
if (!AddRankProgress(9))
|
||||||
{
|
{
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
||||||
@ -3810,7 +3810,7 @@ void control::SecretMissionGreenController(int code, TPinballComponent* caller)
|
|||||||
MissionControl(66, nullptr);
|
MissionControl(66, nullptr);
|
||||||
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(145, 0), 4.0);
|
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(145, 0), 4.0);
|
||||||
int addedScore = SpecialAddScore(1500000);
|
int addedScore = SpecialAddScore(1500000);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(78, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(78, 0), addedScore);
|
||||||
if (!AddRankProgress(10))
|
if (!AddRankProgress(10))
|
||||||
{
|
{
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
||||||
@ -3913,7 +3913,7 @@ void control::SelectMissionController(int code, TPinballComponent* caller)
|
|||||||
MissionControl(66, nullptr);
|
MissionControl(66, nullptr);
|
||||||
int addedScore = SpecialAddScore(
|
int addedScore = SpecialAddScore(
|
||||||
mission_select_scores[control_lite56_tag.Component->MessageField - 2]);
|
mission_select_scores[control_lite56_tag.Component->MessageField - 2]);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(77, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(77, 0), addedScore);
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, 4.0);
|
control_mission_text_box_tag.Component->Display(Buffer, 4.0);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -4051,7 +4051,7 @@ void control::SelectMissionController(int code, TPinballComponent* caller)
|
|||||||
{
|
{
|
||||||
auto missionText = pinball::
|
auto missionText = pinball::
|
||||||
get_rc_string(MissionRcArray[control_lite56_tag.Component->MessageField - 2], 1);
|
get_rc_string(MissionRcArray[control_lite56_tag.Component->MessageField - 2], 1);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(106, 0), missionText);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(106, 0), missionText);
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
||||||
if (light_on(&control_lite318_tag))
|
if (light_on(&control_lite318_tag))
|
||||||
control_lite318_tag.Component->Message(20, 0.0);
|
control_lite318_tag.Component->Message(20, 0.0);
|
||||||
@ -4117,7 +4117,7 @@ void control::SpaceRadiationController(int code, TPinballComponent* caller)
|
|||||||
MissionControl(66, nullptr);
|
MissionControl(66, nullptr);
|
||||||
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(121, 0), 4.0);
|
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(121, 0), 4.0);
|
||||||
int addedScore = SpecialAddScore(1000000);
|
int addedScore = SpecialAddScore(1000000);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(78, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(78, 0), addedScore);
|
||||||
if (!AddRankProgress(8))
|
if (!AddRankProgress(8))
|
||||||
{
|
{
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
||||||
@ -4170,7 +4170,7 @@ void control::StrayCometController(int code, TPinballComponent* caller)
|
|||||||
MissionControl(66, nullptr);
|
MissionControl(66, nullptr);
|
||||||
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(119, 0), 4.0);
|
control_mission_text_box_tag.Component->Display(pinball::get_rc_string(119, 0), 4.0);
|
||||||
int addedScore = SpecialAddScore(1000000);
|
int addedScore = SpecialAddScore(1000000);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(78, 0), addedScore);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(78, 0), addedScore);
|
||||||
if (!AddRankProgress(8))
|
if (!AddRankProgress(8))
|
||||||
{
|
{
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
||||||
@ -4214,7 +4214,7 @@ void control::TimeWarpController(int code, TPinballComponent* caller)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(146, 0), control_lite56_tag.Component->MessageField);
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(146, 0), control_lite56_tag.Component->MessageField);
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
control_mission_text_box_tag.Component->Display(Buffer, -1.0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -4265,7 +4265,7 @@ void control::TimeWarpPartTwoController(int code, TPinballComponent* caller)
|
|||||||
{
|
{
|
||||||
control_middle_circle_tag.Component->Message(33, 5.0);
|
control_middle_circle_tag.Component->Message(33, 5.0);
|
||||||
int rank = control_middle_circle_tag.Component->Message(37, 0.0);
|
int rank = control_middle_circle_tag.Component->Message(37, 0.0);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(174, 0), pinball::get_rc_string(RankRcArray[rank - 1], 1));
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(174, 0), pinball::get_rc_string(RankRcArray[rank - 1], 1));
|
||||||
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
control_mission_text_box_tag.Component->Display(Buffer, 8.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4278,7 +4278,7 @@ void control::TimeWarpPartTwoController(int code, TPinballComponent* caller)
|
|||||||
{
|
{
|
||||||
int rank = control_middle_circle_tag.Component->Message(37, 0.0);
|
int rank = control_middle_circle_tag.Component->Message(37, 0.0);
|
||||||
control_middle_circle_tag.Component->Message(41, 5.0);
|
control_middle_circle_tag.Component->Message(41, 5.0);
|
||||||
sprintf_s(Buffer, pinball::get_rc_string(173, 0), pinball::get_rc_string(RankRcArray[rank], 1));
|
snprintf(Buffer, sizeof Buffer, pinball::get_rc_string(173, 0), pinball::get_rc_string(RankRcArray[rank], 1));
|
||||||
}
|
}
|
||||||
if (!AddRankProgress(12))
|
if (!AddRankProgress(12))
|
||||||
{
|
{
|
||||||
|
@ -48,7 +48,7 @@ int gdrv::create_bitmap(gdrv_bitmap8* bmp, int width, int height)
|
|||||||
bmp->Stride = 4 - width % 4 + width;
|
bmp->Stride = 4 - width % 4 + width;
|
||||||
|
|
||||||
bmp->Height = height;
|
bmp->Height = height;
|
||||||
bmp->BitmapType = BitmapType::DibBitmap;
|
bmp->BitmapType = BitmapTypes::DibBitmap;
|
||||||
bmp->BmpBufPtr1 = memory::allocate(bmp->Height * bmp->Stride);
|
bmp->BmpBufPtr1 = memory::allocate(bmp->Height * bmp->Stride);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -61,7 +61,7 @@ int gdrv::create_raw_bitmap(gdrv_bitmap8* bmp, int width, int height, int flag)
|
|||||||
bmp->Stride = width - width % 4 + 4;
|
bmp->Stride = width - width % 4 + 4;
|
||||||
unsigned int sizeInBytes = height * bmp->Stride;
|
unsigned int sizeInBytes = height * bmp->Stride;
|
||||||
bmp->Height = height;
|
bmp->Height = height;
|
||||||
bmp->BitmapType = BitmapType::RawBitmap;
|
bmp->BitmapType = BitmapTypes::RawBitmap;
|
||||||
char* buf = memory::allocate(sizeInBytes);
|
char* buf = memory::allocate(sizeInBytes);
|
||||||
bmp->BmpBufPtr1 = buf;
|
bmp->BmpBufPtr1 = buf;
|
||||||
if (!buf)
|
if (!buf)
|
||||||
@ -73,7 +73,7 @@ int gdrv::create_spliced_bitmap(gdrv_bitmap8* bmp, int width, int height, int si
|
|||||||
{
|
{
|
||||||
bmp->Width = width;
|
bmp->Width = width;
|
||||||
bmp->Stride = width;
|
bmp->Stride = width;
|
||||||
bmp->BitmapType = BitmapType::Spliced;
|
bmp->BitmapType = BitmapTypes::Spliced;
|
||||||
bmp->Height = height;
|
bmp->Height = height;
|
||||||
char* buf = memory::allocate(size);
|
char* buf = memory::allocate(size);
|
||||||
bmp->BmpBufPtr1 = buf;
|
bmp->BmpBufPtr1 = buf;
|
||||||
@ -133,7 +133,7 @@ int gdrv::destroy_bitmap(gdrv_bitmap8* bmp)
|
|||||||
if (!bmp)
|
if (!bmp)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (bmp->BitmapType != BitmapType::None)
|
if (bmp->BitmapType != BitmapTypes::None)
|
||||||
{
|
{
|
||||||
memory::free(bmp->BmpBufPtr1);
|
memory::free(bmp->BmpBufPtr1);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
enum class BitmapType : char
|
enum class BitmapTypes : char
|
||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
RawBitmap = 1,
|
RawBitmap = 1,
|
||||||
@ -14,7 +14,7 @@ struct gdrv_bitmap8
|
|||||||
int Width;
|
int Width;
|
||||||
int Height;
|
int Height;
|
||||||
int Stride;
|
int Stride;
|
||||||
BitmapType BitmapType;
|
BitmapTypes BitmapType;
|
||||||
int XPosition;
|
int XPosition;
|
||||||
int YPosition;
|
int YPosition;
|
||||||
};
|
};
|
||||||
|
@ -53,13 +53,13 @@ int high_score::read(high_score_struct* table, int* ptrToSmth)
|
|||||||
for (auto position = 0; position < 5; ++position)
|
for (auto position = 0; position < 5; ++position)
|
||||||
{
|
{
|
||||||
auto tablePtr = &table[position];
|
auto tablePtr = &table[position];
|
||||||
_itoa_s(position, Buffer, 10);
|
snprintf(Buffer, sizeof Buffer, "%d", position);
|
||||||
strcat_s(Buffer, ".Name");
|
strcat(Buffer, ".Name");
|
||||||
options::get_string(optPath, Buffer, buf1, "", 32);
|
options::get_string(optPath, Buffer, buf1, "", 32);
|
||||||
buf1[32] = 0;
|
buf1[32] = 0;
|
||||||
strcpy_s(tablePtr->Name, buf1);
|
strncpy(tablePtr->Name, buf1, sizeof tablePtr->Name);
|
||||||
_itoa_s(position, Buffer, 10);
|
snprintf(Buffer, sizeof Buffer, "%d", position);
|
||||||
strcat_s(Buffer, ".Score");
|
strcat(Buffer, ".Score");
|
||||||
options::get_string(optPath, Buffer, buf1, "", 300);
|
options::get_string(optPath, Buffer, buf1, "", 300);
|
||||||
tablePtr->Score = atol(buf1);
|
tablePtr->Score = atol(buf1);
|
||||||
for (int i = (int)strlen(tablePtr->Name); --i >= 0; scoreSum += tablePtr->Name[i])
|
for (int i = (int)strlen(tablePtr->Name); --i >= 0; scoreSum += tablePtr->Name[i])
|
||||||
@ -89,12 +89,12 @@ int high_score::write(high_score_struct* table, int* ptrToSmth)
|
|||||||
const char* optPath = pinball::get_rc_string(166, 0);
|
const char* optPath = pinball::get_rc_string(166, 0);
|
||||||
for (auto position = 0; position < 5; ++position)
|
for (auto position = 0; position < 5; ++position)
|
||||||
{
|
{
|
||||||
_itoa_s(position, Buffer, 10);
|
snprintf(Buffer, sizeof Buffer, "%d", position);
|
||||||
strcat_s(Buffer, ".Name");
|
strcat(Buffer, ".Name");
|
||||||
options::set_string(optPath, Buffer, tablePtr->Name);
|
options::set_string(optPath, Buffer, tablePtr->Name);
|
||||||
_itoa_s(position, Buffer, 10);
|
snprintf(Buffer, sizeof Buffer, "%d", position);
|
||||||
strcat_s(Buffer, ".Score");
|
strcat(Buffer, ".Score");
|
||||||
_ltoa_s(tablePtr->Score, buf, 300, 10);
|
snprintf(buf, 300, "%d", tablePtr->Score);
|
||||||
options::set_string(optPath, Buffer, buf);
|
options::set_string(optPath, Buffer, buf);
|
||||||
for (int i = (int)strlen(tablePtr->Name); --i >= 0; scoreSum += tablePtr->Name[i])
|
for (int i = (int)strlen(tablePtr->Name); --i >= 0; scoreSum += tablePtr->Name[i])
|
||||||
{
|
{
|
||||||
@ -152,7 +152,7 @@ int high_score::place_new_score_into(high_score_struct* table, int score, LPSTR
|
|||||||
posTable->Score = score;
|
posTable->Score = score;
|
||||||
if (strlen(scoreStr) >= 31)
|
if (strlen(scoreStr) >= 31)
|
||||||
scoreStr[31] = 0;
|
scoreStr[31] = 0;
|
||||||
strcpy_s(posTable->Name, scoreStr);
|
strncpy(posTable->Name, scoreStr, sizeof posTable->Name);
|
||||||
posTable->Name[31] = 0;
|
posTable->Name[31] = 0;
|
||||||
}
|
}
|
||||||
return position;
|
return position;
|
||||||
@ -160,7 +160,7 @@ int high_score::place_new_score_into(high_score_struct* table, int score, LPSTR
|
|||||||
|
|
||||||
void high_score::scramble_number_string(int Value, char* Buffer)
|
void high_score::scramble_number_string(int Value, char* Buffer)
|
||||||
{
|
{
|
||||||
_ltoa_s(Value, Buffer, 300, 10);
|
snprintf(Buffer, 300, "%d", Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void high_score::show_high_score_dialog(high_score_struct* table)
|
void high_score::show_high_score_dialog(high_score_struct* table)
|
||||||
@ -177,7 +177,7 @@ void high_score::show_and_set_high_score_dialog(high_score_struct* table, int sc
|
|||||||
dlg_score = score;
|
dlg_score = score;
|
||||||
dlg_hst = table;
|
dlg_hst = table;
|
||||||
dlg_enter_name = 1;
|
dlg_enter_name = 1;
|
||||||
strncpy_s(default_name, defaultName, 32);
|
strncpy(default_name, defaultName, sizeof default_name);
|
||||||
ShowDialog = true;
|
ShowDialog = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,7 +210,7 @@ void high_score::RenderHighScoreDialog()
|
|||||||
{
|
{
|
||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
_itoa_s(row, buf, 10);
|
snprintf(buf, sizeof buf, "%d", row);
|
||||||
ImGui::TextUnformatted(buf);
|
ImGui::TextUnformatted(buf);
|
||||||
|
|
||||||
auto score = tablePtr->Score;
|
auto score = tablePtr->Score;
|
||||||
|
@ -17,6 +17,13 @@
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
// make_unique is C++14
|
||||||
|
template<typename T, typename... Args>
|
||||||
|
std::unique_ptr<T> make_unique(Args&&... args)
|
||||||
|
{
|
||||||
|
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
|
||||||
|
}
|
||||||
|
|
||||||
struct Device* CurrentDevice = nullptr;
|
struct Device* CurrentDevice = nullptr;
|
||||||
|
|
||||||
namespace TupleHash
|
namespace TupleHash
|
||||||
@ -417,7 +424,7 @@ namespace
|
|||||||
|
|
||||||
const InterpolatedFactorEquation<Color> shadeColor(Color(v1.col), Color(v2.col), Color(v3.col), v1.pos, v2.pos, v3.pos);
|
const InterpolatedFactorEquation<Color> shadeColor(Color(v1.col), Color(v2.col), Color(v3.col), v1.pos, v2.pos, v3.pos);
|
||||||
|
|
||||||
auto cached = std::make_unique<Device::TriangleCacheItem>();
|
auto cached = make_unique<Device::TriangleCacheItem>();
|
||||||
DrawTriangleWithColorFunction(renderInfo, [&](float x, float y) {
|
DrawTriangleWithColorFunction(renderInfo, [&](float x, float y) {
|
||||||
const float u = textureU.Evaluate(x, y);
|
const float u = textureU.Evaluate(x, y);
|
||||||
const float v = textureV.Evaluate(x, y);
|
const float v = textureV.Evaluate(x, y);
|
||||||
@ -454,7 +461,7 @@ namespace
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto cached = std::make_unique<Device::TriangleCacheItem>();
|
auto cached = make_unique<Device::TriangleCacheItem>();
|
||||||
DrawTriangleWithColorFunction(renderInfo, [&color](float, float) { return color; }, cached.get());
|
DrawTriangleWithColorFunction(renderInfo, [&color](float, float) { return color; }, cached.get());
|
||||||
|
|
||||||
if (!cached->Texture) return;
|
if (!cached->Texture) return;
|
||||||
|
@ -145,14 +145,22 @@ int loader::get_sound_id(int groupIndex)
|
|||||||
datFieldTypes::ShortValue));
|
datFieldTypes::ShortValue));
|
||||||
if (value && *value == 202)
|
if (value && *value == 202)
|
||||||
{
|
{
|
||||||
/*FT sounds are in SOUND subfolder*/
|
char filePath[300]{};
|
||||||
char filePath[300]{}, fileName2[100]{};
|
std::string fileName = partman::field(loader_table, soundGroupId, datFieldTypes::String);
|
||||||
auto fileName = partman::field(loader_table, soundGroupId, datFieldTypes::String);
|
|
||||||
sprintf_s(fileName2, pb::FullTiltMode ? "SOUND\\%s" : "%s", fileName);
|
|
||||||
pinball::make_path_name(filePath, fileName2);
|
|
||||||
|
|
||||||
FILE* file;
|
// File name is in lower case, while game data is in upper case.
|
||||||
if (!fopen_s(&file, filePath, "rb"))
|
std::transform(fileName.begin(), fileName.end(), fileName.begin(), [](unsigned char c) { return std::toupper(c); });
|
||||||
|
if (pb::FullTiltMode)
|
||||||
|
{
|
||||||
|
// FT sounds are in SOUND subfolder
|
||||||
|
fileName.insert(0, 1, PathSeparator);
|
||||||
|
fileName.insert(0, "SOUND");
|
||||||
|
}
|
||||||
|
|
||||||
|
pinball::make_path_name(filePath, fileName.c_str());
|
||||||
|
|
||||||
|
FILE* file = fopen(filePath, "rb");
|
||||||
|
if (file)
|
||||||
{
|
{
|
||||||
fread(&wavHeader, 1, sizeof wavHeader, file);
|
fread(&wavHeader, 1, sizeof wavHeader, file);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
@ -105,15 +105,21 @@ void midi::music_shutdown_ft()
|
|||||||
delete TrackList;
|
delete TrackList;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mix_Music* midi::load_track(LPCSTR fileName)
|
Mix_Music* midi::load_track(std::string fileName)
|
||||||
{
|
{
|
||||||
char filePath[256];
|
char filePath[256];
|
||||||
char fileName2[256];
|
|
||||||
|
|
||||||
strcpy_s(fileName2, "sound\\");
|
// File name is in lower case, while game data is in upper case.
|
||||||
strcat_s(fileName2, fileName);
|
std::transform(fileName.begin(), fileName.end(), fileName.begin(), [](unsigned char c) { return std::toupper(c); });
|
||||||
pinball::make_path_name(filePath, fileName2, 254u);
|
if (pb::FullTiltMode)
|
||||||
strcat_s(filePath, ".MDS");
|
{
|
||||||
|
// FT sounds are in SOUND subfolder
|
||||||
|
fileName.insert(0, 1, PathSeparator);
|
||||||
|
fileName.insert(0, "SOUND");
|
||||||
|
}
|
||||||
|
fileName += ".MDS";
|
||||||
|
|
||||||
|
pinball::make_path_name(filePath, fileName.c_str(), 254u);
|
||||||
auto midi = MdsToMidi(filePath);
|
auto midi = MdsToMidi(filePath);
|
||||||
if (!midi)
|
if (!midi)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -126,10 +132,9 @@ Mix_Music* midi::load_track(LPCSTR fileName)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
// Dump converted MIDI file
|
// Dump converted MIDI file
|
||||||
/*FILE* fileHandle;
|
/*strncpy(fileName2, fileName, sizeof fileName2);
|
||||||
strcpy_s(fileName2, fileName);
|
strcat(fileName2, ".midi");
|
||||||
strcat_s(fileName2, ".midi");
|
FILE* fileHandle = fopen(fileName2, "wb");
|
||||||
fopen_s(&fileHandle, fileName2, "wb");
|
|
||||||
fwrite(midi->data(), 1, midi->size(), fileHandle);
|
fwrite(midi->data(), 1, midi->size(), fileHandle);
|
||||||
fclose(fileHandle);*/
|
fclose(fileHandle);*/
|
||||||
|
|
||||||
@ -178,8 +183,8 @@ int midi::stop_ft()
|
|||||||
/// <returns>Vector that contains MIDI file</returns>
|
/// <returns>Vector that contains MIDI file</returns>
|
||||||
std::vector<uint8_t>* midi::MdsToMidi(char* file)
|
std::vector<uint8_t>* midi::MdsToMidi(char* file)
|
||||||
{
|
{
|
||||||
FILE* fileHandle;
|
FILE* fileHandle = fopen(file, "rb");
|
||||||
if (fopen_s(&fileHandle, file, "rb"))
|
if (!fileHandle)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
fseek(fileHandle, 0, SEEK_END);
|
fseek(fileHandle, 0, SEEK_END);
|
||||||
@ -236,7 +241,7 @@ std::vector<uint8_t>* midi::MdsToMidi(char* file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto srcPtr = dataChunk->Blocks;
|
auto srcPtr = dataChunk->Blocks;
|
||||||
std::vector<midi_event_x2> midiEvents{};
|
std::vector<midi_event> midiEvents{};
|
||||||
for (auto blockIndex = dataChunk->BlocksPerChunk; blockIndex; blockIndex--)
|
for (auto blockIndex = dataChunk->BlocksPerChunk; blockIndex; blockIndex--)
|
||||||
{
|
{
|
||||||
auto eventSizeInt = streamIdUsed ? 3 : 2;
|
auto eventSizeInt = streamIdUsed ? 3 : 2;
|
||||||
@ -256,7 +261,7 @@ std::vector<uint8_t>* midi::MdsToMidi(char* file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MIDS events can be out of order in the file
|
// MIDS events can be out of order in the file
|
||||||
std::sort(midiEvents.begin(), midiEvents.end(), [](const auto& lhs, const auto& rhs)
|
std::sort(midiEvents.begin(), midiEvents.end(), [](const midi_event& lhs, const midi_event& rhs)
|
||||||
{
|
{
|
||||||
return lhs.iTicks < rhs.iTicks;
|
return lhs.iTicks < rhs.iTicks;
|
||||||
});
|
});
|
||||||
|
@ -44,19 +44,12 @@ struct riff_header
|
|||||||
riff_data Data;
|
riff_data Data;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct midi_event_x2
|
struct midi_event
|
||||||
{
|
{
|
||||||
DWORD iTicks;
|
DWORD iTicks;
|
||||||
DWORD iEvent;
|
DWORD iEvent;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct midi_event_x3
|
|
||||||
{
|
|
||||||
DWORD iTicks;
|
|
||||||
DWORD iStreamID;
|
|
||||||
DWORD iEvent;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct midi_header
|
struct midi_header
|
||||||
{
|
{
|
||||||
explicit midi_header(uint16_t tickdiv)
|
explicit midi_header(uint16_t tickdiv)
|
||||||
@ -85,8 +78,7 @@ struct midi_track
|
|||||||
static_assert(sizeof(riff_block) == 0xC, "Wrong size of riff_block");
|
static_assert(sizeof(riff_block) == 0xC, "Wrong size of riff_block");
|
||||||
static_assert(sizeof(riff_data) == 0x18, "Wrong size of riff_data");
|
static_assert(sizeof(riff_data) == 0x18, "Wrong size of riff_data");
|
||||||
static_assert(sizeof(riff_header) == 0x38, "Wrong size of riff_header");
|
static_assert(sizeof(riff_header) == 0x38, "Wrong size of riff_header");
|
||||||
static_assert(sizeof(midi_event_x3) == 12, "Wrong size of midi_event3");
|
static_assert(sizeof(midi_event) == 8, "Wrong size of midi_event2");
|
||||||
static_assert(sizeof(midi_event_x2) == 8, "Wrong size of midi_event2");
|
|
||||||
static_assert(sizeof(midi_header) == 14, "Wrong size of midi_header");
|
static_assert(sizeof(midi_header) == 14, "Wrong size of midi_header");
|
||||||
static_assert(sizeof(midi_track) == 8, "Wrong size of midi_track");
|
static_assert(sizeof(midi_track) == 8, "Wrong size of midi_track");
|
||||||
|
|
||||||
@ -107,7 +99,7 @@ private:
|
|||||||
static int some_flag1;
|
static int some_flag1;
|
||||||
static int music_init_ft();
|
static int music_init_ft();
|
||||||
static void music_shutdown_ft();
|
static void music_shutdown_ft();
|
||||||
static Mix_Music* load_track(LPCSTR fileName);
|
static Mix_Music* load_track(std::string fileName);
|
||||||
static int play_ft(Mix_Music* midi);
|
static int play_ft(Mix_Music* midi);
|
||||||
static int stop_ft();
|
static int stop_ft();
|
||||||
static std::vector<uint8_t>* MdsToMidi(char* file);
|
static std::vector<uint8_t>* MdsToMidi(char* file);
|
||||||
|
@ -132,7 +132,7 @@ void options::path_init(LPCSTR regPath)
|
|||||||
char* buf = memory::allocate(strlen(regPath) + 1);
|
char* buf = memory::allocate(strlen(regPath) + 1);
|
||||||
OptionsRegPath = buf;
|
OptionsRegPath = buf;
|
||||||
if (buf)
|
if (buf)
|
||||||
strcpy_s(buf, strlen(regPath) + 1, regPath);
|
strncpy(buf, regPath, strlen(regPath) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void options::path_uninit()
|
void options::path_uninit()
|
||||||
@ -152,11 +152,11 @@ LPCSTR options::path(LPCSTR regPath)
|
|||||||
if (!buf)
|
if (!buf)
|
||||||
return OptionsRegPath;
|
return OptionsRegPath;
|
||||||
}
|
}
|
||||||
strcpy_s(buf, 2000, OptionsRegPath);
|
strncpy(buf, OptionsRegPath, 2000);
|
||||||
if (!regPath)
|
if (!regPath)
|
||||||
return OptionsRegPathCur;
|
return OptionsRegPathCur;
|
||||||
strcat_s(OptionsRegPathCur, 2000, "\\");
|
strcat(OptionsRegPathCur, "\\");
|
||||||
strcat_s(OptionsRegPathCur, 2000, regPath);
|
strcat(OptionsRegPathCur, regPath);
|
||||||
return OptionsRegPathCur;
|
return OptionsRegPathCur;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,7 +190,7 @@ void options::set_int(LPCSTR optPath, LPCSTR lpValueName, int data)
|
|||||||
|
|
||||||
void options::get_string(LPCSTR optPath, LPCSTR lpValueName, LPSTR dst, LPCSTR defaultValue, int iMaxLength)
|
void options::get_string(LPCSTR optPath, LPCSTR lpValueName, LPSTR dst, LPCSTR defaultValue, int iMaxLength)
|
||||||
{
|
{
|
||||||
strncpy_s(dst, iMaxLength, defaultValue, iMaxLength);
|
strncpy(dst, defaultValue, iMaxLength);
|
||||||
if (!OptionsRegPath)
|
if (!OptionsRegPath)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -15,11 +15,10 @@ datFileStruct* partman::load_records(LPCSTR lpFileName, int resolution, bool ful
|
|||||||
dat8BitBmpHeader bmpHeader{};
|
dat8BitBmpHeader bmpHeader{};
|
||||||
dat16BitBmpHeader zMapHeader{};
|
dat16BitBmpHeader zMapHeader{};
|
||||||
|
|
||||||
FILE* fileHandle;
|
FILE* fileHandle = fopen(lpFileName, "rb");
|
||||||
fopen_s(&fileHandle, lpFileName, "rb");
|
|
||||||
if (fileHandle == nullptr)
|
if (fileHandle == nullptr)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
fread(&header, 1, sizeof datFileHeader, fileHandle);
|
fread(&header, 1, sizeof header, fileHandle);
|
||||||
if (strcmp("PARTOUT(4.0)RESOURCE", header.FileSignature) != 0)
|
if (strcmp("PARTOUT(4.0)RESOURCE", header.FileSignature) != 0)
|
||||||
{
|
{
|
||||||
fclose(fileHandle);
|
fclose(fileHandle);
|
||||||
@ -46,7 +45,7 @@ datFileStruct* partman::load_records(LPCSTR lpFileName, int resolution, bool ful
|
|||||||
memory::free(datFile);
|
memory::free(datFile);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
strcpy_s(descriptionBuf, lenOfStr + 1, header.Description);
|
strncpy(descriptionBuf, header.Description, lenOfStr + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (header.Unknown)
|
if (header.Unknown)
|
||||||
|
@ -92,7 +92,7 @@ static_assert(sizeof(dat8BitBmpHeader) == 14, "Wrong size of dat8BitBmpHeader");
|
|||||||
|
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
struct __declspec(align(1)) dat16BitBmpHeader
|
struct dat16BitBmpHeader
|
||||||
{
|
{
|
||||||
int16_t Width;
|
int16_t Width;
|
||||||
int16_t Height;
|
int16_t Height;
|
||||||
|
@ -40,7 +40,7 @@ int pb::init()
|
|||||||
char dataFilePath[300];
|
char dataFilePath[300];
|
||||||
|
|
||||||
++memory::critical_allocation;
|
++memory::critical_allocation;
|
||||||
strcpy_s(datFileName, winmain::DatFileName);
|
strncpy(datFileName, winmain::DatFileName, sizeof datFileName);
|
||||||
pinball::make_path_name(dataFilePath, datFileName, 300);
|
pinball::make_path_name(dataFilePath, datFileName, 300);
|
||||||
record_table = partman::load_records(dataFilePath, fullscrn::GetResolution(), FullTiltMode);
|
record_table = partman::load_records(dataFilePath, fullscrn::GetResolution(), FullTiltMode);
|
||||||
|
|
||||||
@ -479,12 +479,12 @@ void pb::keydown(int key)
|
|||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
char String1[200];
|
char String1[200];
|
||||||
strcpy_s(String1, pinball::get_rc_string(26, 0));
|
strncpy(String1, pinball::get_rc_string(26, 0), sizeof String1);
|
||||||
high_score::show_and_set_high_score_dialog(highscore_table, 1000000000, 1, String1);
|
high_score::show_and_set_high_score_dialog(highscore_table, 1000000000, 1, String1);
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
char buffer[20];
|
char buffer[20];
|
||||||
sprintf_s(buffer, "%zu", memory::use_total);
|
snprintf(buffer, sizeof buffer, "%zu", memory::use_total);
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "Mem:", buffer, winmain::MainWindow);
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_INFORMATION, "Mem:", buffer, winmain::MainWindow);
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
@ -569,7 +569,7 @@ void pb::end_game()
|
|||||||
int position = high_score::get_score_position(highscore_table, scores[i]);
|
int position = high_score::get_score_position(highscore_table, scores[i]);
|
||||||
if (position >= 0)
|
if (position >= 0)
|
||||||
{
|
{
|
||||||
strcpy_s(String1, pinball::get_rc_string(scoreIndex[i] + 26, 0));
|
strncpy(String1, pinball::get_rc_string(scoreIndex[i] + 26, 0), sizeof String1);
|
||||||
high_score::show_and_set_high_score_dialog(highscore_table, scores[i], position, String1);
|
high_score::show_and_set_high_score_dialog(highscore_table, scores[i], position, String1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,10 @@
|
|||||||
#ifndef PCH_H
|
#ifndef PCH_H
|
||||||
#define PCH_H
|
#define PCH_H
|
||||||
|
|
||||||
|
|
||||||
|
// GCC does not have *_s functions
|
||||||
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
|
|
||||||
// TODO: add headers that you want to pre-compile here
|
// TODO: add headers that you want to pre-compile here
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
@ -16,11 +20,13 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <type_traits> /*For control template*/
|
#include <type_traits> /*For control template*/
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
//#include <iostream>
|
#include <iostream>
|
||||||
//#include <iomanip>
|
//#include <iomanip>
|
||||||
//#include <cstdlib>
|
//#include <cstdlib>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <cstring>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#define SDL_MAIN_HANDLED
|
#define SDL_MAIN_HANDLED
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
@ -32,19 +38,27 @@
|
|||||||
//https://github.com/Tyyppi77/imgui_sdl 01deb04b102b6a1c15c7fdec1977a2c96a885e6f
|
//https://github.com/Tyyppi77/imgui_sdl 01deb04b102b6a1c15c7fdec1977a2c96a885e6f
|
||||||
#include "imgui_sdl.h"
|
#include "imgui_sdl.h"
|
||||||
|
|
||||||
typedef unsigned long DWORD;
|
typedef uint32_t DWORD;
|
||||||
typedef char* LPSTR;
|
typedef char* LPSTR;
|
||||||
typedef const char* LPCSTR;
|
typedef const char* LPCSTR;
|
||||||
|
|
||||||
#define min(a,b) ((a)<(b)?(a):(b))
|
#define min(a,b) ((a)<(b)?(a):(b))
|
||||||
#define max(a,b) ((a)>(b)?(a):(b))
|
#define max(a,b) ((a)>(b)?(a):(b))
|
||||||
|
//
|
||||||
|
//#define min(a,b) (((a)<(b))?(a):(b))
|
||||||
|
//#define max(a,b) (((a)>(b))?(a):(b))
|
||||||
|
|
||||||
|
constexpr char PathSeparator =
|
||||||
|
#ifdef _WIN32
|
||||||
|
'\\';
|
||||||
|
#else
|
||||||
|
'/';
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/*Use (void) to silent unused warnings.*/
|
/*Use (void) to silent unused warnings.*/
|
||||||
#define assertm(exp, msg) assert(((void)msg, exp))
|
#define assertm(exp, msg) assert(((void)msg, exp))
|
||||||
|
|
||||||
/*Sound uses PlaySound*/
|
|
||||||
#undef PlaySound
|
|
||||||
|
|
||||||
|
|
||||||
inline size_t pgm_save(int width, int height, char* data, FILE* outfile)
|
inline size_t pgm_save(int width, int height, char* data, FILE* outfile)
|
||||||
{
|
{
|
||||||
@ -54,4 +68,9 @@ inline size_t pgm_save(int width, int height, char* data, FILE* outfile)
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline float RandFloat()
|
||||||
|
{
|
||||||
|
return static_cast<float>(std::rand()) / (RAND_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
#endif //PCH_H
|
#endif //PCH_H
|
||||||
|
@ -214,7 +214,7 @@ int LoadStringAlt(uint32_t uID, LPSTR lpBuffer, int cchBufferMax)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
strncpy_s(lpBuffer, cchBufferMax, str->second, cchBufferMax);
|
strncpy(lpBuffer, str->second, cchBufferMax);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,10 +251,10 @@ int pinball::make_path_name(LPSTR lpFilename, LPCSTR lpString2, int nSize)
|
|||||||
auto base_path = SDL_GetBasePath();
|
auto base_path = SDL_GetBasePath();
|
||||||
if (!base_path)
|
if (!base_path)
|
||||||
{
|
{
|
||||||
strcat_s(lpFilename, nSize, "?");
|
strcat(lpFilename,"?");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
strcpy_s(lpFilename, nSize, base_path);
|
strncpy(lpFilename, base_path, nSize);
|
||||||
strcat_s(lpFilename, nSize, lpString2);
|
strcat(lpFilename, lpString2);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -68,9 +68,9 @@ void render::update()
|
|||||||
for (int index = 0; index < many_dirty; ++dirtyPtr, ++index)
|
for (int index = 0; index < many_dirty; ++dirtyPtr, ++index)
|
||||||
{
|
{
|
||||||
auto curSprite = *dirtyPtr;
|
auto curSprite = *dirtyPtr;
|
||||||
if ((*dirtyPtr)->VisualType != VisualType::None)
|
if ((*dirtyPtr)->VisualType != VisualTypes::None)
|
||||||
{
|
{
|
||||||
if ((*dirtyPtr)->VisualType == VisualType::Sprite)
|
if ((*dirtyPtr)->VisualType == VisualTypes::Sprite)
|
||||||
{
|
{
|
||||||
if (curSprite->BmpRectCopy.Width > 0)
|
if (curSprite->BmpRectCopy.Width > 0)
|
||||||
maths::enclosing_box(&curSprite->BmpRectCopy, &curSprite->BmpRect, &curSprite->DirtyRect);
|
maths::enclosing_box(&curSprite->BmpRectCopy, &curSprite->BmpRect, &curSprite->DirtyRect);
|
||||||
@ -118,8 +118,8 @@ void render::update()
|
|||||||
for (int index = 0; index < many_dirty; ++index)
|
for (int index = 0; index < many_dirty; ++index)
|
||||||
{
|
{
|
||||||
auto sprite = *dirtyPtr;
|
auto sprite = *dirtyPtr;
|
||||||
if ((*dirtyPtr)->DirtyRect.Width > 0 && (sprite->VisualType == VisualType::None || sprite->VisualType ==
|
if ((*dirtyPtr)->DirtyRect.Width > 0 && (sprite->VisualType == VisualTypes::None || sprite->VisualType ==
|
||||||
VisualType::Sprite))
|
VisualTypes::Sprite))
|
||||||
repaint(*dirtyPtr);
|
repaint(*dirtyPtr);
|
||||||
++dirtyPtr;
|
++dirtyPtr;
|
||||||
}
|
}
|
||||||
@ -214,11 +214,11 @@ void render::paint()
|
|||||||
|
|
||||||
void render::sprite_modified(render_sprite_type_struct* sprite)
|
void render::sprite_modified(render_sprite_type_struct* sprite)
|
||||||
{
|
{
|
||||||
if (sprite->VisualType != VisualType::Ball && many_dirty < 999)
|
if (sprite->VisualType != VisualTypes::Ball && many_dirty < 999)
|
||||||
dirty_list[many_dirty++] = sprite;
|
dirty_list[many_dirty++] = sprite;
|
||||||
}
|
}
|
||||||
|
|
||||||
render_sprite_type_struct* render::create_sprite(VisualType visualType, gdrv_bitmap8* bmp, zmap_header_type* zMap,
|
render_sprite_type_struct* render::create_sprite(VisualTypes visualType, gdrv_bitmap8* bmp, zmap_header_type* zMap,
|
||||||
int xPosition, int yPosition, rectangle_type* rect)
|
int xPosition, int yPosition, rectangle_type* rect)
|
||||||
{
|
{
|
||||||
auto sprite = memory::allocate<render_sprite_type_struct>();
|
auto sprite = memory::allocate<render_sprite_type_struct>();
|
||||||
@ -256,14 +256,14 @@ render_sprite_type_struct* render::create_sprite(VisualType visualType, gdrv_bit
|
|||||||
sprite->ZMap = zMap;
|
sprite->ZMap = zMap;
|
||||||
sprite->ZMapOffestX = 0;
|
sprite->ZMapOffestX = 0;
|
||||||
sprite->ZMapOffestY = 0;
|
sprite->ZMapOffestY = 0;
|
||||||
if (!zMap && visualType != VisualType::Ball)
|
if (!zMap && visualType != VisualTypes::Ball)
|
||||||
{
|
{
|
||||||
sprite->ZMap = background_zmap;
|
sprite->ZMap = background_zmap;
|
||||||
sprite->ZMapOffestY = xPosition - zmap_offset;
|
sprite->ZMapOffestY = xPosition - zmap_offset;
|
||||||
sprite->ZMapOffestX = yPosition - zmap_offsetY;
|
sprite->ZMapOffestX = yPosition - zmap_offsetY;
|
||||||
}
|
}
|
||||||
sprite->BmpRectCopy = sprite->BmpRect;
|
sprite->BmpRectCopy = sprite->BmpRect;
|
||||||
if (visualType == VisualType::Ball)
|
if (visualType == VisualTypes::Ball)
|
||||||
{
|
{
|
||||||
ball_list[many_balls++] = sprite;
|
ball_list[many_balls++] = sprite;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#include "maths.h"
|
#include "maths.h"
|
||||||
#include "zdrv.h"
|
#include "zdrv.h"
|
||||||
|
|
||||||
enum class VisualType : char
|
enum class VisualTypes : char
|
||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
Sprite = 1,
|
Sprite = 1,
|
||||||
@ -16,7 +16,7 @@ struct render_sprite_type_struct
|
|||||||
gdrv_bitmap8* Bmp;
|
gdrv_bitmap8* Bmp;
|
||||||
zmap_header_type* ZMap;
|
zmap_header_type* ZMap;
|
||||||
char UnknownFlag;
|
char UnknownFlag;
|
||||||
VisualType VisualType;
|
VisualTypes VisualType;
|
||||||
int16_t Depth;
|
int16_t Depth;
|
||||||
rectangle_type BmpRectCopy;
|
rectangle_type BmpRectCopy;
|
||||||
int ZMapOffestY;
|
int ZMapOffestY;
|
||||||
@ -46,7 +46,7 @@ public:
|
|||||||
static void update();
|
static void update();
|
||||||
static void paint();
|
static void paint();
|
||||||
static void sprite_modified(render_sprite_type_struct* sprite);
|
static void sprite_modified(render_sprite_type_struct* sprite);
|
||||||
static render_sprite_type_struct* create_sprite(VisualType visualType, gdrv_bitmap8* bmp,
|
static render_sprite_type_struct* create_sprite(VisualTypes visualType, gdrv_bitmap8* bmp,
|
||||||
zmap_header_type* zMap,
|
zmap_header_type* zMap,
|
||||||
int xPosition, int yPosition, rectangle_type* rect);
|
int xPosition, int yPosition, rectangle_type* rect);
|
||||||
static void remove_sprite(render_sprite_type_struct* sprite);
|
static void remove_sprite(render_sprite_type_struct* sprite);
|
||||||
|
@ -245,7 +245,7 @@ void score::update(scoreStruct* score)
|
|||||||
erase(score, 0);
|
erase(score, 0);
|
||||||
if (score->Score >= 0)
|
if (score->Score >= 0)
|
||||||
{
|
{
|
||||||
_ltoa_s(score->Score, scoreBuf, 10);
|
snprintf(scoreBuf, sizeof scoreBuf, "%d", score->Score);
|
||||||
for (ptrdiff_t index = strlen(scoreBuf) - 1; index >= 0; index--)
|
for (ptrdiff_t index = strlen(scoreBuf) - 1; index >= 0; index--)
|
||||||
{
|
{
|
||||||
unsigned char curChar = scoreBuf[index];
|
unsigned char curChar = scoreBuf[index];
|
||||||
@ -281,26 +281,26 @@ void score::string_format(int score, char* str)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy_s(separator, ",");
|
strncpy(separator, ",", sizeof separator);
|
||||||
int scoreMillions = score % 1000000000 / 1000000;
|
int scoreMillions = score % 1000000000 / 1000000;
|
||||||
if (score / 1000000000 <= 0)
|
if (score / 1000000000 <= 0)
|
||||||
{
|
{
|
||||||
if (static_cast<int>(scoreMillions) <= 0)
|
if (static_cast<int>(scoreMillions) <= 0)
|
||||||
{
|
{
|
||||||
if (score % 1000000 / 1000 <= 0)
|
if (score % 1000000 / 1000 <= 0)
|
||||||
sprintf_s(str, 36, "%ld", score);
|
snprintf(str, 36, "%ld", score);
|
||||||
else
|
else
|
||||||
sprintf_s(str, 36, "%ld%s%03ld", score % 1000000 / 1000, separator, score % 1000);
|
snprintf(str, 36, "%ld%s%03ld", score % 1000000 / 1000, separator, score % 1000);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf_s(str, 36, "%ld%s%03ld%s%03ld", scoreMillions, separator, score % 1000000 / 1000, separator,
|
snprintf(str, 36, "%ld%s%03ld%s%03ld", scoreMillions, separator, score % 1000000 / 1000, separator,
|
||||||
score % 1000);
|
score % 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sprintf_s(
|
snprintf(
|
||||||
str,
|
str,
|
||||||
36,
|
36,
|
||||||
"%ld%s%03ld%s%03ld%s%03ld",
|
"%ld%s%03ld%s%03ld%s%03ld",
|
||||||
|
@ -72,12 +72,11 @@ int winmain::WinMain(LPCSTR lpCmdLine)
|
|||||||
/*Check for full tilt .dat file and switch to it automatically*/
|
/*Check for full tilt .dat file and switch to it automatically*/
|
||||||
char cadetFilePath[300]{};
|
char cadetFilePath[300]{};
|
||||||
pinball::make_path_name(cadetFilePath, "CADET.DAT", 300);
|
pinball::make_path_name(cadetFilePath, "CADET.DAT", 300);
|
||||||
FILE* cadetDat;
|
FILE* cadetDat = fopen(cadetFilePath, "r");
|
||||||
fopen_s(&cadetDat, cadetFilePath, "r");
|
|
||||||
if (cadetDat)
|
if (cadetDat)
|
||||||
{
|
{
|
||||||
fclose(cadetDat);
|
fclose(cadetDat);
|
||||||
strcpy_s(DatFileName, "CADET.DAT");
|
strncpy(DatFileName, "CADET.DAT", sizeof DatFileName);
|
||||||
pb::FullTiltMode = true;
|
pb::FullTiltMode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,7 +178,7 @@ int winmain::WinMain(LPCSTR lpCmdLine)
|
|||||||
{
|
{
|
||||||
char buf[60];
|
char buf[60];
|
||||||
auto elapsedSec = static_cast<float>(curTime - prevTime) * 0.001f;
|
auto elapsedSec = static_cast<float>(curTime - prevTime) * 0.001f;
|
||||||
sprintf_s(buf, "Updates/sec = %02.02f Frames/sec = %02.02f ",
|
snprintf(buf, sizeof buf, "Updates/sec = %02.02f Frames/sec = %02.02f ",
|
||||||
300.0f / elapsedSec, frameCounter / elapsedSec);
|
300.0f / elapsedSec, frameCounter / elapsedSec);
|
||||||
SDL_SetWindowTitle(window, buf);
|
SDL_SetWindowTitle(window, buf);
|
||||||
frameCounter = 0;
|
frameCounter = 0;
|
||||||
@ -440,7 +439,7 @@ void winmain::RenderUi()
|
|||||||
if (ImGui::BeginMenu("Help"))
|
if (ImGui::BeginMenu("Help"))
|
||||||
{
|
{
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
if (ImGui::MenuItem("ImGui Demo"))
|
if (ImGui::MenuItem("ImGui Demo", nullptr, ShowImGuiDemo))
|
||||||
{
|
{
|
||||||
ShowImGuiDemo ^= true;
|
ShowImGuiDemo ^= true;
|
||||||
}
|
}
|
||||||
@ -689,7 +688,7 @@ void winmain::memalloc_failure()
|
|||||||
char* caption = pinball::get_rc_string(170, 0);
|
char* caption = pinball::get_rc_string(170, 0);
|
||||||
char* text = pinball::get_rc_string(179, 0);
|
char* text = pinball::get_rc_string(179, 0);
|
||||||
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, caption, text, MainWindow);
|
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, caption, text, MainWindow);
|
||||||
_exit(1);
|
std::exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void winmain::a_dialog()
|
void winmain::a_dialog()
|
||||||
|
@ -54,7 +54,7 @@ void zdrv::paint(int width, int height, gdrv_bitmap8* dstBmp, int dstBmpXOff, in
|
|||||||
int dstZMapXOff, int dstZMapYOff, gdrv_bitmap8* srcBmp, int srcBmpXOff, int srcBmpYOff,
|
int dstZMapXOff, int dstZMapYOff, gdrv_bitmap8* srcBmp, int srcBmpXOff, int srcBmpYOff,
|
||||||
zmap_header_type* srcZMap, int srcZMapXOff, int srcZMapYOff)
|
zmap_header_type* srcZMap, int srcZMapXOff, int srcZMapYOff)
|
||||||
{
|
{
|
||||||
if (srcBmp->BitmapType == BitmapType::Spliced)
|
if (srcBmp->BitmapType == BitmapTypes::Spliced)
|
||||||
{
|
{
|
||||||
/*Spliced bitmap is also a zMap, how convenient*/
|
/*Spliced bitmap is also a zMap, how convenient*/
|
||||||
paint_spliced_bmp(srcBmp->XPosition, srcBmp->YPosition, dstBmp, dstZMap, srcBmp);
|
paint_spliced_bmp(srcBmp->XPosition, srcBmp->YPosition, dstBmp, dstZMap, srcBmp);
|
||||||
@ -121,7 +121,7 @@ void zdrv::paint_flat(int width, int height, gdrv_bitmap8* dstBmp, int dstBmpXOf
|
|||||||
|
|
||||||
void zdrv::paint_spliced_bmp(int xPos, int yPos, gdrv_bitmap8* dstBmp, zmap_header_type* dstZmap, gdrv_bitmap8* srcBmp)
|
void zdrv::paint_spliced_bmp(int xPos, int yPos, gdrv_bitmap8* dstBmp, zmap_header_type* dstZmap, gdrv_bitmap8* srcBmp)
|
||||||
{
|
{
|
||||||
assertm(srcBmp->BitmapType == BitmapType::Spliced, "Wrong bmp type");
|
assertm(srcBmp->BitmapType == BitmapTypes::Spliced, "Wrong bmp type");
|
||||||
int xOffset = xPos - pb::MainTable->XOffset;
|
int xOffset = xPos - pb::MainTable->XOffset;
|
||||||
int yOffset = dstBmp->Height - srcBmp->Height - (yPos - pb::MainTable->YOffset);
|
int yOffset = dstBmp->Height - srcBmp->Height - (yPos - pb::MainTable->YOffset);
|
||||||
if (yOffset < 0)
|
if (yOffset < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user