This commit is contained in:
Roman Masanin 2020-11-08 20:32:31 +03:00
commit e269809bfd
29 changed files with 2441 additions and 1830 deletions

44
CMakeLists.txt Normal file
View File

@ -0,0 +1,44 @@
cmake_minimum_required(VERSION 3.8)
project(re3 C CXX)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
if(WIN32)
set(RE3_AUDIOS "NULL" "OAL" "MSS")
else()
set(RE3_AUDIOS "NULL" "OAL")
endif()
set(RE3_AUDIO "OAL" CACHE STRING "Audio")
set_property(CACHE RE3_AUDIO PROPERTY STRINGS ${RE3_AUDIOS})
message(STATUS "RE3_AUDIO = ${RE3_AUDIO} (choices=${RE3_AUDIOS})")
set("RE3_AUDIO_${RE3_AUDIO}" ON)
if(NOT RE3_AUDIO IN_LIST RE3_AUDIOS)
message(FATAL_ERROR "Illegal RE3_AUDIO=${RE3_AUDIO}")
endif()
if(RE3_INSTALL)
include(GNUInstallDirs)
set(RE3_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/re3")
endif()
add_subdirectory("vendor/librw")
add_subdirectory(src)
if(RE3_INSTALL)
include(CMakePackageConfigHelpers)
configure_package_config_file(re3-config.cmake.in re3-config.cmake
INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}"
)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/re3-config.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
)
install(
EXPORT re3-targets
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
)
include(CMakeCPack.cmake)
endif()

28
cmake/FindMPG123.cmake Normal file
View File

@ -0,0 +1,28 @@
# - Find mpg123
# Find the native mpg123 includes and library
#
# MPG123_INCLUDE_DIR - where to find mpg123.h
# MPG123_LIBRARIES - List of libraries when using mpg123.
# MPG123_FOUND - True if mpg123 found.
IF(MPG123_INCLUDE_DIR AND MPG123_LIBRARIES)
# Already in cache, be silent
SET(MPG123_FIND_QUIETLY TRUE)
ENDIF(MPG123_INCLUDE_DIR AND MPG123_LIBRARIES)
FIND_PATH(MPG123_INCLUDE_DIR mpg123.h
PATHS "${MPG123_DIR}"
PATH_SUFFIXES include
)
FIND_LIBRARY(MPG123_LIBRARIES NAMES mpg123 mpg123-0
PATHS "${MPG123_DIR}"
PATH_SUFFIXES lib
)
# MARK_AS_ADVANCED(MPG123_LIBRARIES MPG123_INCLUDE_DIR)
# handle the QUIETLY and REQUIRED arguments and set MPG123_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPG123 DEFAULT_MSG MPG123_LIBRARIES MPG123_INCLUDE_DIR)

67
cmake/FindSndFile.cmake Normal file
View File

@ -0,0 +1,67 @@
# Found on http://hg.kvats.net
#
# - Try to find libsndfile
#
# Once done this will define
#
# SNDFILE_FOUND - system has libsndfile
# SNDFILE_INCLUDE_DIRS - the libsndfile include directory
# SNDFILE_LIBRARIES - Link these to use libsndfile
#
# Copyright (C) 2006 Wengo
#
# Redistribution and use is allowed according to the terms of the New
# BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#
if (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS)
# in cache already
set(SNDFILE_FOUND TRUE)
else (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS)
find_path(SNDFILE_INCLUDE_DIR
NAMES
sndfile.h
PATHS
/usr/include
/usr/local/include
/opt/local/include
/sw/include
)
find_library(SNDFILE_LIBRARY
NAMES
sndfile
PATHS
/usr/lib
/usr/local/lib
/opt/local/lib
/sw/lib
)
set(SNDFILE_INCLUDE_DIRS
${SNDFILE_INCLUDE_DIR}
)
set(SNDFILE_LIBRARIES
${SNDFILE_LIBRARY}
)
if (SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES)
set(SNDFILE_FOUND TRUE)
endif (SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES)
if (SNDFILE_FOUND)
if (NOT SndFile_FIND_QUIETLY)
message(STATUS "Found libsndfile: ${SNDFILE_LIBRARIES}")
endif (NOT SndFile_FIND_QUIETLY)
else (SNDFILE_FOUND)
if (SndFile_FIND_REQUIRED)
message(FATAL_ERROR "Could not find libsndfile")
endif (SndFile_FIND_REQUIRED)
endif (SNDFILE_FOUND)
# show the SNDFILE_INCLUDE_DIRS and SNDFILE_LIBRARIES variables only in the advanced view
mark_as_advanced(SNDFILE_INCLUDE_DIRS SNDFILE_LIBRARIES)
endif (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS)

Binary file not shown.

View File

@ -122,9 +122,11 @@ workspace "re3"
filter { "platforms:*x86*" }
architecture "x86"
floatingpoint "Fast"
filter { "platforms:*amd64*" }
architecture "amd64"
floatingpoint "Fast"
filter { "platforms:*arm*" }
architecture "ARM"
@ -184,6 +186,18 @@ project "librw"
files { path.join(Librw, "src/*.*") }
files { path.join(Librw, "src/*/*.*") }
filter { "platforms:*x86*" }
architecture "x86"
floatingpoint "Fast"
filter { "platforms:*amd64*" }
architecture "amd64"
floatingpoint "Fast"
filter "platforms:win*"
staticruntime "on"
buildoptions { "/Zc:sizedDealloc-" }
filter "platforms:bsd*"
includedirs { "/usr/local/include" }
libdirs { "/usr/local/lib" }
@ -194,6 +208,9 @@ project "librw"
includedirs {"/usr/local/include" }
libdirs { "/opt/local/lib" }
libdirs { "/usr/local/lib" }
filter "platforms:*gl3_glfw*"
staticruntime "off"
filter "platforms:*RW33*"
flags { "ExcludeFromBuild" }
@ -284,9 +301,14 @@ project "re3"
filter "platforms:win*"
files { addSrcFiles("src/skel/win") }
includedirs { "src/skel/win" }
buildoptions { "/Zc:sizedDealloc-" }
linkoptions "/SAFESEH:NO"
characterset ("MBCS")
targetextension ".exe"
staticruntime "on"
filter "platforms:win*glfw*"
staticruntime "off"
filter "platforms:win*oal"
includedirs { "vendor/openal-soft/include" }
@ -322,7 +344,6 @@ project "re3"
end
filter "platforms:*RW33*"
staticruntime "on"
includedirs { "sdk/rwsdk/include/d3d8" }
libdirs { "sdk/rwsdk/lib/d3d8/release" }
links { "rwcore", "rpworld", "rpmatfx", "rpskin", "rphanim", "rtbmp", "rtquat", "rtcharse" }

112
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,112 @@
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
if(${RE3_AUDIO} STREQUAL "OAL")
find_package(OpenAL REQUIRED)
find_package(MPG123 REQUIRED)
find_package(SndFile REQUIRED)
endif()
file(GLOB_RECURSE Sources "*.cpp" "*.h")
MACRO(HEADER_DIRECTORIES return_list)
FILE(GLOB_RECURSE new_list *.cpp)
SET(dir_list "animation"
"audio"
"control"
"core"
"entities"
"extras"
"fakerw"
"math"
"modelinfo"
"objects"
"peds"
"render"
"rw"
"save"
"skel"
"text"
"vehicles"
"weapons")
FOREACH(file_path ${new_list})
GET_FILENAME_COMPONENT(dir_path ${file_path} PATH)
SET(dir_list ${dir_list} ${dir_path})
ENDFOREACH()
LIST(REMOVE_DUPLICATES dir_list)
SET(${return_list} ${dir_list})
ENDMACRO()
HEADER_DIRECTORIES(header_list)
include_directories(${header_list})
add_executable(re3 ${Sources})
target_link_libraries(re3 librw)
target_link_libraries(re3 Threads::Threads)
if(${RE3_AUDIO} STREQUAL "OAL")
target_link_libraries(re3 ${OPENAL_LIBRARY})
target_link_libraries(re3 ${MPG123_LIBRARIES})
target_link_libraries(re3 ${SNDFILE_LIBRARIES})
endif()
target_include_directories(re3
INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
)
target_compile_definitions(re3
PRIVATE
"$<IF:$<CONFIG:DEBUG>,DEBUG,NDEBUG>"
PUBLIC
"RW_${RE3_PLATFORM}"
)
target_compile_definitions(re3 PRIVATE LIBRW=1 AUDIO_OAL=1)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
target_compile_options(re3
PRIVATE
"-Wall"
)
if (NOT RE3_PLATFORM_PS2)
target_compile_options(re3
PRIVATE
"-Wextra"
"-Wdouble-promotion"
"-Wpedantic"
)
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(re3
PUBLIC
/wd4996 /wd4244
)
endif()
set_target_properties(re3
PROPERTIES
C_STANDARD 11
C_EXTENSIONS OFF
C_STANDARD_REQUIRED ON
CXX_STANDARD 11
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
PREFIX ""
)
if(RE3_INSTALL)
target_include_directories(re3
INTERFACE
$<INSTALL_INTERFACE:${RE3_INSTALL_INCLUDEDIR}>
)
install(
TARGETS re3
EXPORT re3-targets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
)
endif()

File diff suppressed because it is too large Load Diff

View File

@ -332,7 +332,7 @@ public:
int8 GetMissionScriptPoliceAudioPlayingStatus() const;
uint8 GetNum3DProvidersAvailable() const;
int32 GetPedCommentSfx(CPed *ped, int32 sound);
void GetPhrase(uint32 *phrase, uint32 *prevPhrase, uint32 sample, uint32 maxOffset) const;
void GetPhrase(uint32 &phrase, uint32 &prevPhrase, uint32 sample, uint32 maxOffset) const;
float GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile,
cTransmission *transmission, float velocityChange);
float GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile,

View File

@ -242,8 +242,15 @@ CdStreamRead(int32 channel, void *buffer, uint32 offset, uint32 size)
else
return STREAM_SUCCESS;
}
#ifdef BIG_IMG
LARGE_INTEGER liDistanceToMove;
liDistanceToMove.QuadPart = _GET_OFFSET(offset);
liDistanceToMove.QuadPart *= CDSTREAM_SECTOR_SIZE;
SetFilePointerEx(hImage, liDistanceToMove, nil, FILE_BEGIN);
#else
SetFilePointer(hImage, _GET_OFFSET(offset) * CDSTREAM_SECTOR_SIZE, nil, FILE_BEGIN);
#endif
DWORD NumberOfBytesRead;

View File

@ -429,7 +429,7 @@ void *CdStreamThread(void *param)
ASSERT(pChannel->hFile >= 0);
ASSERT(pChannel->pBuffer != nil );
lseek(pChannel->hFile, pChannel->nSectorOffset * CDSTREAM_SECTOR_SIZE, SEEK_SET);
lseek(pChannel->hFile, (size_t)pChannel->nSectorOffset * (size_t)CDSTREAM_SECTOR_SIZE, SEEK_SET);
if (read(pChannel->hFile, pChannel->pBuffer, pChannel->nSectorsToRead * CDSTREAM_SECTOR_SIZE) == -1) {
// pChannel->nSectorsToRead == 0 at this point means we wanted to flush channel
// STREAM_WAITING is a little hack to make CStreaming not process this data

View File

@ -2316,199 +2316,208 @@ int32 CControllerConfigManager::GetNumOfSettingsForAction(e_ControllerAction act
return num;
}
const char *XboxButtons[][MAX_CONTROLLERACTIONS] =
{
{
"B", // PED_FIREWEAPON
"RT", // PED_CYCLE_WEAPON_RIGHT
"LT", // PED_CYCLE_WEAPON_LEFT
nil, // GO_FORWARD
nil, // GO_BACK
nil, // GO_LEFT
nil, // GO_RIGHT
"X", // PED_SNIPER_ZOOM_IN
"A", // PED_SNIPER_ZOOM_OUT
"Y", // VEHICLE_ENTER_EXIT
"BACK", // CAMERA_CHANGE_VIEW_ALL_SITUATIONS
"X", // PED_JUMPING
"A", // PED_SPRINT
"RS", // PED_LOOKBEHIND
#ifdef BIND_VEHICLE_FIREWEAPON
"B", // VEHICLE_FIREWEAPON
#define VFB(b) b,
#else
#define VFB(b)
#endif
"A", // VEHICLE_ACCELERATE
"X", // VEHICLE_BRAKE
"LB", // VEHICLE_CHANGE_RADIO_STATION
"LS", // VEHICLE_HORN
"RS", // TOGGLE_SUBMISSIONS
"RB", // VEHICLE_HANDBRAKE
nil, // PED_1RST_PERSON_LOOK_LEFT
nil, // PED_1RST_PERSON_LOOK_RIGHT
"LT", // VEHICLE_LOOKLEFT
"RT", // VEHICLE_LOOKRIGHT
nil, // VEHICLE_LOOKBEHIND
nil, // VEHICLE_TURRETLEFT
nil, // VEHICLE_TURRETRIGHT
nil, // VEHICLE_TURRETUP
nil, // VEHICLE_TURRETDOWN
"LT", // PED_CYCLE_TARGET_LEFT
"RT", // PED_CYCLE_TARGET_RIGHT
"LB", // PED_CENTER_CAMERA_BEHIND_PLAYER
"RB", // PED_LOCK_TARGET
nil, // NETWORK_TALK
nil, // PED_1RST_PERSON_LOOK_UP
nil, // PED_1RST_PERSON_LOOK_DOWN
nil, // _CONTROLLERACTION_36
nil, // TOGGLE_DPAD
nil, // SWITCH_DEBUG_CAM_ON
nil, // TAKE_SCREEN_SHOT
nil, // SHOW_MOUSE_POINTER_TOGGLE
},
{
"B", // PED_FIREWEAPON
"RT", // PED_CYCLE_WEAPON_RIGHT
"LT", // PED_CYCLE_WEAPON_LEFT
nil, // GO_FORWARD
nil, // GO_BACK
nil, // GO_LEFT
nil, // GO_RIGHT
"X", // PED_SNIPER_ZOOM_IN
"A", // PED_SNIPER_ZOOM_OUT
"Y", // VEHICLE_ENTER_EXIT
"BACK", // CAMERA_CHANGE_VIEW_ALL_SITUATIONS
"X", // PED_JUMPING
"A", // PED_SPRINT
"RS", // PED_LOOKBEHIND
#ifdef BIND_VEHICLE_FIREWEAPON
"B", // VEHICLE_FIREWEAPON
#define CONTROLLER_BUTTONS(T, O, X, Q, L1, L2, L3, R1, R2, R3, SELECT) \
{{ \
O, /* PED_FIREWEAPON */ \
R2, /* PED_CYCLE_WEAPON_RIGHT */ \
L2, /* PED_CYCLE_WEAPON_LEFT */ \
nil, /* GO_FORWARD */ \
nil, /* GO_BACK */ \
nil, /* GO_LEFT */ \
nil, /* GO_RIGHT */ \
Q, /* PED_SNIPER_ZOOM_IN */ \
X, /* PED_SNIPER_ZOOM_OUT */ \
T, /* VEHICLE_ENTER_EXIT */ \
SELECT, /* CAMERA_CHANGE_VIEW_ALL_SITUATIONS */ \
Q, /* PED_JUMPING */ \
X, /* PED_SPRINT */ \
R3, /* PED_LOOKBEHIND */ \
VFB(O) /* VEHICLE_FIREWEAPON */ \
X, /* VEHICLE_ACCELERATE */ \
Q, /* VEHICLE_BRAKE */ \
L1, /* VEHICLE_CHANGE_RADIO_STATION */ \
L3, /* VEHICLE_HORN */ \
R3, /* TOGGLE_SUBMISSIONS */ \
R1, /* VEHICLE_HANDBRAKE */ \
nil, /* PED_1RST_PERSON_LOOK_LEFT */ \
nil, /* PED_1RST_PERSON_LOOK_RIGHT */ \
L2, /* VEHICLE_LOOKLEFT */ \
R2, /* VEHICLE_LOOKRIGHT */ \
nil, /* VEHICLE_LOOKBEHIND */ \
nil, /* VEHICLE_TURRETLEFT */ \
nil, /* VEHICLE_TURRETRIGHT */ \
nil, /* VEHICLE_TURRETUP */ \
nil, /* VEHICLE_TURRETDOWN */ \
L2, /* PED_CYCLE_TARGET_LEFT */ \
R2, /* PED_CYCLE_TARGET_RIGHT */ \
L1, /* PED_CENTER_CAMERA_BEHIND_PLAYER */ \
R1, /* PED_LOCK_TARGET */ \
nil, /* NETWORK_TALK */ \
nil, /* PED_1RST_PERSON_LOOK_UP */ \
nil, /* PED_1RST_PERSON_LOOK_DOWN */ \
nil, /* _CONTROLLERACTION_36 */ \
nil, /* TOGGLE_DPAD */ \
nil, /* SWITCH_DEBUG_CAM_ON */ \
nil, /* TAKE_SCREEN_SHOT */ \
nil, /* SHOW_MOUSE_POINTER_TOGGLE */ \
}, \
{ \
O, /* PED_FIREWEAPON */ \
R2, /* PED_CYCLE_WEAPON_RIGHT */ \
L2, /* PED_CYCLE_WEAPON_LEFT */ \
nil, /* GO_FORWARD */ \
nil, /* GO_BACK */ \
nil, /* GO_LEFT */ \
nil, /* GO_RIGHT */ \
Q, /* PED_SNIPER_ZOOM_IN */ \
X, /* PED_SNIPER_ZOOM_OUT */ \
T, /* VEHICLE_ENTER_EXIT */ \
SELECT, /* CAMERA_CHANGE_VIEW_ALL_SITUATIONS */ \
Q, /* PED_JUMPING */ \
X, /* PED_SPRINT */ \
R3, /* PED_LOOKBEHIND */ \
VFB(O) /* VEHICLE_FIREWEAPON */ \
X, /* VEHICLE_ACCELERATE */ \
Q, /* VEHICLE_BRAKE */ \
SELECT, /* VEHICLE_CHANGE_RADIO_STATION */ \
L1, /* VEHICLE_HORN */ \
R3, /* TOGGLE_SUBMISSIONS */ \
R1, /* VEHICLE_HANDBRAKE */ \
nil, /* PED_1RST_PERSON_LOOK_LEFT */ \
nil, /* PED_1RST_PERSON_LOOK_RIGHT */ \
L2, /* VEHICLE_LOOKLEFT */ \
R2, /* VEHICLE_LOOKRIGHT */ \
nil, /* VEHICLE_LOOKBEHIND */ \
nil, /* VEHICLE_TURRETLEFT */ \
nil, /* VEHICLE_TURRETRIGHT */ \
nil, /* VEHICLE_TURRETUP */ \
nil, /* VEHICLE_TURRETDOWN */ \
L2, /* PED_CYCLE_TARGET_LEFT */ \
R2, /* PED_CYCLE_TARGET_RIGHT */ \
L1, /* PED_CENTER_CAMERA_BEHIND_PLAYER */ \
R1, /* PED_LOCK_TARGET */ \
nil, /* NETWORK_TALK */ \
nil, /* PED_1RST_PERSON_LOOK_UP */ \
nil, /* PED_1RST_PERSON_LOOK_DOWN */ \
nil, /* _CONTROLLERACTION_36 */ \
nil, /* TOGGLE_DPAD */ \
nil, /* SWITCH_DEBUG_CAM_ON */ \
nil, /* TAKE_SCREEN_SHOT */ \
nil, /* SHOW_MOUSE_POINTER_TOGGLE */ \
}, \
{ \
X, /* PED_FIREWEAPON */ \
R2, /* PED_CYCLE_WEAPON_RIGHT */ \
L2, /* PED_CYCLE_WEAPON_LEFT */ \
nil, /* GO_FORWARD */ \
nil, /* GO_BACK */ \
nil, /* GO_LEFT */ \
nil, /* GO_RIGHT */ \
T, /* PED_SNIPER_ZOOM_IN */ \
Q, /* PED_SNIPER_ZOOM_OUT */ \
L1, /* VEHICLE_ENTER_EXIT */ \
SELECT, /* CAMERA_CHANGE_VIEW_ALL_SITUATIONS */ \
Q, /* PED_JUMPING */ \
O, /* PED_SPRINT */ \
R3, /* PED_LOOKBEHIND */ \
VFB(O) /* VEHICLE_FIREWEAPON */ \
X, /* VEHICLE_ACCELERATE */ \
Q, /* VEHICLE_BRAKE */ \
L3, /* VEHICLE_CHANGE_RADIO_STATION */ \
R1, /* VEHICLE_HORN */ \
R3, /* TOGGLE_SUBMISSIONS */ \
T, /* VEHICLE_HANDBRAKE */ \
nil, /* PED_1RST_PERSON_LOOK_LEFT */ \
nil, /* PED_1RST_PERSON_LOOK_RIGHT */ \
L2, /* VEHICLE_LOOKLEFT */ \
R2, /* VEHICLE_LOOKRIGHT */ \
nil, /* VEHICLE_LOOKBEHIND */ \
nil, /* VEHICLE_TURRETLEFT */ \
nil, /* VEHICLE_TURRETRIGHT */ \
nil, /* VEHICLE_TURRETUP */ \
nil, /* VEHICLE_TURRETDOWN */ \
L2, /* PED_CYCLE_TARGET_LEFT */ \
R2, /* PED_CYCLE_TARGET_RIGHT */ \
T, /* PED_CENTER_CAMERA_BEHIND_PLAYER */ \
R1, /* PED_LOCK_TARGET */ \
nil, /* NETWORK_TALK */ \
nil, /* PED_1RST_PERSON_LOOK_UP */ \
nil, /* PED_1RST_PERSON_LOOK_DOWN */ \
nil, /* _CONTROLLERACTION_36 */ \
nil, /* TOGGLE_DPAD */ \
nil, /* SWITCH_DEBUG_CAM_ON */ \
nil, /* TAKE_SCREEN_SHOT */ \
nil, /* SHOW_MOUSE_POINTER_TOGGLE */ \
}, \
{ \
R1, /* PED_FIREWEAPON */ \
R2, /* PED_CYCLE_WEAPON_RIGHT */ \
L2, /* PED_CYCLE_WEAPON_LEFT */ \
nil, /* GO_FORWARD */ \
nil, /* GO_BACK */ \
nil, /* GO_LEFT */ \
nil, /* GO_RIGHT */ \
Q, /* PED_SNIPER_ZOOM_IN */ \
X, /* PED_SNIPER_ZOOM_OUT */ \
T, /* VEHICLE_ENTER_EXIT */ \
SELECT, /* CAMERA_CHANGE_VIEW_ALL_SITUATIONS */ \
Q, /* PED_JUMPING */ \
X, /* PED_SPRINT */ \
R3, /* PED_LOOKBEHIND */ \
VFB(R1) /* VEHICLE_FIREWEAPON */ \
nil, /* VEHICLE_ACCELERATE */ \
nil, /* VEHICLE_BRAKE */ \
O, /* VEHICLE_CHANGE_RADIO_STATION */ \
L3, /* VEHICLE_HORN */ \
Q, /* TOGGLE_SUBMISSIONS */ \
L1, /* VEHICLE_HANDBRAKE */ \
nil, /* PED_1RST_PERSON_LOOK_LEFT */ \
nil, /* PED_1RST_PERSON_LOOK_RIGHT */ \
L2, /* VEHICLE_LOOKLEFT */ \
R2, /* VEHICLE_LOOKRIGHT */ \
nil, /* VEHICLE_LOOKBEHIND */ \
nil, /* VEHICLE_TURRETLEFT */ \
nil, /* VEHICLE_TURRETRIGHT */ \
nil, /* VEHICLE_TURRETUP */ \
nil, /* VEHICLE_TURRETDOWN */ \
L2, /* PED_CYCLE_TARGET_LEFT */ \
R2, /* PED_CYCLE_TARGET_RIGHT */ \
O, /* PED_CENTER_CAMERA_BEHIND_PLAYER */ \
L1, /* PED_LOCK_TARGET */ \
nil, /* NETWORK_TALK */ \
nil, /* PED_1RST_PERSON_LOOK_UP */ \
nil, /* PED_1RST_PERSON_LOOK_DOWN */ \
nil, /* _CONTROLLERACTION_36 */ \
nil, /* TOGGLE_DPAD */ \
nil, /* SWITCH_DEBUG_CAM_ON */ \
nil, /* TAKE_SCREEN_SHOT */ \
nil, /* SHOW_MOUSE_POINTER_TOGGLE */ \
}}
const char *XboxButtons_noIcons[][MAX_CONTROLLERACTIONS] = CONTROLLER_BUTTONS("Y", "B", "A", "X", "LB", "LT", "LS", "RB", "RT", "RS", "BACK");
#ifdef BUTTON_ICONS
const char *XboxButtons[][MAX_CONTROLLERACTIONS] = CONTROLLER_BUTTONS("~T~", "~O~", "~X~", "~Q~", "~K~", "~M~", "~A~", "~J~", "~V~", "~C~", "BACK");
#endif
"A", // VEHICLE_ACCELERATE
"X", // VEHICLE_BRAKE
"BACK", // VEHICLE_CHANGE_RADIO_STATION
"LB", // VEHICLE_HORN
"RS", // TOGGLE_SUBMISSIONS
"RB", // VEHICLE_HANDBRAKE
nil, // PED_1RST_PERSON_LOOK_LEFT
nil, // PED_1RST_PERSON_LOOK_RIGHT
"LT", // VEHICLE_LOOKLEFT
"RT", // VEHICLE_LOOKRIGHT
nil, // VEHICLE_LOOKBEHIND
nil, // VEHICLE_TURRETLEFT
nil, // VEHICLE_TURRETRIGHT
nil, // VEHICLE_TURRETUP
nil, // VEHICLE_TURRETDOWN
"LT", // PED_CYCLE_TARGET_LEFT
"RT", // PED_CYCLE_TARGET_RIGHT
"LB", // PED_CENTER_CAMERA_BEHIND_PLAYER
"RB", // PED_LOCK_TARGET
nil, // NETWORK_TALK
nil, // PED_1RST_PERSON_LOOK_UP
nil, // PED_1RST_PERSON_LOOK_DOWN
nil, // _CONTROLLERACTION_36
nil, // TOGGLE_DPAD
nil, // SWITCH_DEBUG_CAM_ON
nil, // TAKE_SCREEN_SHOT
nil, // SHOW_MOUSE_POINTER_TOGGLE
},
{
"A", // PED_FIREWEAPON
"RT", // PED_CYCLE_WEAPON_RIGHT
"LT", // PED_CYCLE_WEAPON_LEFT
nil, // GO_FORWARD
nil, // GO_BACK
nil, // GO_LEFT
nil, // GO_RIGHT
"Y", // PED_SNIPER_ZOOM_IN
"X", // PED_SNIPER_ZOOM_OUT
"LB", // VEHICLE_ENTER_EXIT
"BACK", // CAMERA_CHANGE_VIEW_ALL_SITUATIONS
"X", // PED_JUMPING
"B", // PED_SPRINT
"RS", // PED_LOOKBEHIND
#ifdef BIND_VEHICLE_FIREWEAPON
"B", // VEHICLE_FIREWEAPON
#endif
"A", // VEHICLE_ACCELERATE
"X", // VEHICLE_BRAKE
"LS", // VEHICLE_CHANGE_RADIO_STATION
"RB", // VEHICLE_HORN
"RS", // TOGGLE_SUBMISSIONS
"Y", // VEHICLE_HANDBRAKE
nil, // PED_1RST_PERSON_LOOK_LEFT
nil, // PED_1RST_PERSON_LOOK_RIGHT
"LT", // VEHICLE_LOOKLEFT
"RT", // VEHICLE_LOOKRIGHT
nil, // VEHICLE_LOOKBEHIND
nil, // VEHICLE_TURRETLEFT
nil, // VEHICLE_TURRETRIGHT
nil, // VEHICLE_TURRETUP
nil, // VEHICLE_TURRETDOWN
"LT", // PED_CYCLE_TARGET_LEFT
"RT", // PED_CYCLE_TARGET_RIGHT
"Y", // PED_CENTER_CAMERA_BEHIND_PLAYER
"RB", // PED_LOCK_TARGET
nil, // NETWORK_TALK
nil, // PED_1RST_PERSON_LOOK_UP
nil, // PED_1RST_PERSON_LOOK_DOWN
nil, // _CONTROLLERACTION_36
nil, // TOGGLE_DPAD
nil, // SWITCH_DEBUG_CAM_ON
nil, // TAKE_SCREEN_SHOT
nil, // SHOW_MOUSE_POINTER_TOGGLE
},
{
"RB", // PED_FIREWEAPON
"RT", // PED_CYCLE_WEAPON_RIGHT
"LT", // PED_CYCLE_WEAPON_LEFT
nil, // GO_FORWARD
nil, // GO_BACK
nil, // GO_LEFT
nil, // GO_RIGHT
"X", // PED_SNIPER_ZOOM_IN
"A", // PED_SNIPER_ZOOM_OUT
"Y", // VEHICLE_ENTER_EXIT
"BACK", // CAMERA_CHANGE_VIEW_ALL_SITUATIONS
"X", // PED_JUMPING
"A", // PED_SPRINT
"RS", // PED_LOOKBEHIND
#ifdef BIND_VEHICLE_FIREWEAPON
"RB", // VEHICLE_FIREWEAPON
#endif
nil, // VEHICLE_ACCELERATE
nil, // VEHICLE_BRAKE
"B", // VEHICLE_CHANGE_RADIO_STATION
"LS", // VEHICLE_HORN
"X", // TOGGLE_SUBMISSIONS
"LB", // VEHICLE_HANDBRAKE
nil, // PED_1RST_PERSON_LOOK_LEFT
nil, // PED_1RST_PERSON_LOOK_RIGHT
"LT", // VEHICLE_LOOKLEFT
"RT", // VEHICLE_LOOKRIGHT
nil, // VEHICLE_LOOKBEHIND
nil, // VEHICLE_TURRETLEFT
nil, // VEHICLE_TURRETRIGHT
nil, // VEHICLE_TURRETUP
nil, // VEHICLE_TURRETDOWN
"LT", // PED_CYCLE_TARGET_LEFT
"RT", // PED_CYCLE_TARGET_RIGHT
"B", // PED_CENTER_CAMERA_BEHIND_PLAYER
"LB", // PED_LOCK_TARGET
nil, // NETWORK_TALK
nil, // PED_1RST_PERSON_LOOK_UP
nil, // PED_1RST_PERSON_LOOK_DOWN
nil, // _CONTROLLERACTION_36
nil, // TOGGLE_DPAD
nil, // SWITCH_DEBUG_CAM_ON
nil, // TAKE_SCREEN_SHOT
nil, // SHOW_MOUSE_POINTER_TOGGLE
}
};
#if 0 // set 1 for ps2 fonts
#define PS2_TRIANGLE "\""
#define PS2_CIRCLE "|"
#define PS2_CROSS "/"
#define PS2_SQUARE "^"
#elif defined(BUTTON_ICONS)
#define PS2_TRIANGLE "~T~"
#define PS2_CIRCLE "~O~"
#define PS2_CROSS "~X~"
#define PS2_SQUARE "~Q~"
#else
#define PS2_TRIANGLE "TRIANGLE"
#define PS2_CIRCLE "CIRCLE"
@ -2516,199 +2525,22 @@ const char *XboxButtons[][MAX_CONTROLLERACTIONS] =
#define PS2_SQUARE "SQUARE"
#endif
const char *PlayStationButtons_noIcons[][MAX_CONTROLLERACTIONS] =
CONTROLLER_BUTTONS(PS2_TRIANGLE, PS2_CIRCLE, PS2_CROSS, PS2_SQUARE, "L1", "L2", "L3", "R1", "R2", "R3", "SELECT");
#ifdef BUTTON_ICONS
const char *PlayStationButtons[][MAX_CONTROLLERACTIONS] =
{
{
PS2_CIRCLE, // PED_FIREWEAPON
"R2", // PED_CYCLE_WEAPON_RIGHT
"L2", // PED_CYCLE_WEAPON_LEFT
nil, // GO_FORWARD
nil, // GO_BACK
nil, // GO_LEFT
nil, // GO_RIGHT
PS2_SQUARE, // PED_SNIPER_ZOOM_IN
PS2_CROSS, // PED_SNIPER_ZOOM_OUT
PS2_TRIANGLE, // VEHICLE_ENTER_EXIT
"SELECT", // CAMERA_CHANGE_VIEW_ALL_SITUATIONS
PS2_SQUARE, // PED_JUMPING
PS2_CROSS, // PED_SPRINT
"R3", // PED_LOOKBEHIND
#ifdef BIND_VEHICLE_FIREWEAPON
PS2_CIRCLE, // VEHICLE_FIREWEAPON
CONTROLLER_BUTTONS(PS2_TRIANGLE, PS2_CIRCLE, PS2_CROSS, PS2_SQUARE, "~K~", "~M~", "~A~", "~J~", "~V~", "~C~", "SELECT");
#endif
PS2_CROSS, // VEHICLE_ACCELERATE
PS2_SQUARE, // VEHICLE_BRAKE
"L1", // VEHICLE_CHANGE_RADIO_STATION
"L3", // VEHICLE_HORN
"R3", // TOGGLE_SUBMISSIONS
"R1", // VEHICLE_HANDBRAKE
nil, // PED_1RST_PERSON_LOOK_LEFT
nil, // PED_1RST_PERSON_LOOK_RIGHT
"L2", // VEHICLE_LOOKLEFT
"R2", // VEHICLE_LOOKRIGHT
nil, // VEHICLE_LOOKBEHIND
nil, // VEHICLE_TURRETLEFT
nil, // VEHICLE_TURRETRIGHT
nil, // VEHICLE_TURRETUP
nil, // VEHICLE_TURRETDOWN
"L2", // PED_CYCLE_TARGET_LEFT
"R2", // PED_CYCLE_TARGET_RIGHT
"L1", // PED_CENTER_CAMERA_BEHIND_PLAYER
"R1", // PED_LOCK_TARGET
nil, // NETWORK_TALK
nil, // PED_1RST_PERSON_LOOK_UP
nil, // PED_1RST_PERSON_LOOK_DOWN
nil, // _CONTROLLERACTION_36
nil, // TOGGLE_DPAD
nil, // SWITCH_DEBUG_CAM_ON
nil, // TAKE_SCREEN_SHOT
nil, // SHOW_MOUSE_POINTER_TOGGLE
},
{
PS2_CIRCLE, // PED_FIREWEAPON
"R2", // PED_CYCLE_WEAPON_RIGHT
"L2", // PED_CYCLE_WEAPON_LEFT
nil, // GO_FORWARD
nil, // GO_BACK
nil, // GO_LEFT
nil, // GO_RIGHT
PS2_SQUARE, // PED_SNIPER_ZOOM_IN
PS2_CROSS, // PED_SNIPER_ZOOM_OUT
PS2_TRIANGLE, // VEHICLE_ENTER_EXIT
"SELECT", // CAMERA_CHANGE_VIEW_ALL_SITUATIONS
PS2_SQUARE, // PED_JUMPING
PS2_CROSS, // PED_SPRINT
"R3", // PED_LOOKBEHIND
#ifdef BIND_VEHICLE_FIREWEAPON
PS2_CIRCLE, // VEHICLE_FIREWEAPON
#endif
PS2_CROSS, // VEHICLE_ACCELERATE
PS2_SQUARE, // VEHICLE_BRAKE
"BACK", // VEHICLE_CHANGE_RADIO_STATION
"L1", // VEHICLE_HORN
"R3", // TOGGLE_SUBMISSIONS
"R1", // VEHICLE_HANDBRAKE
nil, // PED_1RST_PERSON_LOOK_LEFT
nil, // PED_1RST_PERSON_LOOK_RIGHT
"L2", // VEHICLE_LOOKLEFT
"R2", // VEHICLE_LOOKRIGHT
nil, // VEHICLE_LOOKBEHIND
nil, // VEHICLE_TURRETLEFT
nil, // VEHICLE_TURRETRIGHT
nil, // VEHICLE_TURRETUP
nil, // VEHICLE_TURRETDOWN
"L2", // PED_CYCLE_TARGET_LEFT
"R2", // PED_CYCLE_TARGET_RIGHT
"L1", // PED_CENTER_CAMERA_BEHIND_PLAYER
"R1", // PED_LOCK_TARGET
nil, // NETWORK_TALK
nil, // PED_1RST_PERSON_LOOK_UP
nil, // PED_1RST_PERSON_LOOK_DOWN
nil, // _CONTROLLERACTION_36
nil, // TOGGLE_DPAD
nil, // SWITCH_DEBUG_CAM_ON
nil, // TAKE_SCREEN_SHOT
nil, // SHOW_MOUSE_POINTER_TOGGLE
},
{
PS2_CROSS, // PED_FIREWEAPON
"R2", // PED_CYCLE_WEAPON_RIGHT
"L2", // PED_CYCLE_WEAPON_LEFT
nil, // GO_FORWARD
nil, // GO_BACK
nil, // GO_LEFT
nil, // GO_RIGHT
PS2_TRIANGLE, // PED_SNIPER_ZOOM_IN
PS2_SQUARE, // PED_SNIPER_ZOOM_OUT
"L1", // VEHICLE_ENTER_EXIT
"BACK", // CAMERA_CHANGE_VIEW_ALL_SITUATIONS
PS2_SQUARE, // PED_JUMPING
PS2_CIRCLE, // PED_SPRINT
"R3", // PED_LOOKBEHIND
#ifdef BIND_VEHICLE_FIREWEAPON
PS2_CIRCLE, // VEHICLE_FIREWEAPON
#endif
PS2_CROSS, // VEHICLE_ACCELERATE
PS2_SQUARE, // VEHICLE_BRAKE
"L3", // VEHICLE_CHANGE_RADIO_STATION
"R1", // VEHICLE_HORN
"R3", // TOGGLE_SUBMISSIONS
PS2_TRIANGLE, // VEHICLE_HANDBRAKE
nil, // PED_1RST_PERSON_LOOK_LEFT
nil, // PED_1RST_PERSON_LOOK_RIGHT
"L2", // VEHICLE_LOOKLEFT
"R2", // VEHICLE_LOOKRIGHT
nil, // VEHICLE_LOOKBEHIND
nil, // VEHICLE_TURRETLEFT
nil, // VEHICLE_TURRETRIGHT
nil, // VEHICLE_TURRETUP
nil, // VEHICLE_TURRETDOWN
"L2", // PED_CYCLE_TARGET_LEFT
"R2", // PED_CYCLE_TARGET_RIGHT
PS2_TRIANGLE, // PED_CENTER_CAMERA_BEHIND_PLAYER
"R1", // PED_LOCK_TARGET
nil, // NETWORK_TALK
nil, // PED_1RST_PERSON_LOOK_UP
nil, // PED_1RST_PERSON_LOOK_DOWN
nil, // _CONTROLLERACTION_36
nil, // TOGGLE_DPAD
nil, // SWITCH_DEBUG_CAM_ON
nil, // TAKE_SCREEN_SHOT
nil, // SHOW_MOUSE_POINTER_TOGGLE
},
{
"R1", // PED_FIREWEAPON
"R2", // PED_CYCLE_WEAPON_RIGHT
"L2", // PED_CYCLE_WEAPON_LEFT
nil, // GO_FORWARD
nil, // GO_BACK
nil, // GO_LEFT
nil, // GO_RIGHT
PS2_SQUARE, // PED_SNIPER_ZOOM_IN
PS2_CROSS, // PED_SNIPER_ZOOM_OUT
PS2_TRIANGLE, // VEHICLE_ENTER_EXIT
"SELECT", // CAMERA_CHANGE_VIEW_ALL_SITUATIONS
PS2_SQUARE, // PED_JUMPING
PS2_CROSS, // PED_SPRINT
"R3", // PED_LOOKBEHIND
#ifdef BIND_VEHICLE_FIREWEAPON
"R1", // VEHICLE_FIREWEAPON
#endif
nil, // VEHICLE_ACCELERATE
nil, // VEHICLE_BRAKE
PS2_CIRCLE, // VEHICLE_CHANGE_RADIO_STATION
"L3", // VEHICLE_HORN
PS2_SQUARE, // TOGGLE_SUBMISSIONS
"L1", // VEHICLE_HANDBRAKE
nil, // PED_1RST_PERSON_LOOK_LEFT
nil, // PED_1RST_PERSON_LOOK_RIGHT
"L2", // VEHICLE_LOOKLEFT
"R2", // VEHICLE_LOOKRIGHT
nil, // VEHICLE_LOOKBEHIND
nil, // VEHICLE_TURRETLEFT
nil, // VEHICLE_TURRETRIGHT
nil, // VEHICLE_TURRETUP
nil, // VEHICLE_TURRETDOWN
"L2", // PED_CYCLE_TARGET_LEFT
"R2", // PED_CYCLE_TARGET_RIGHT
PS2_CIRCLE, // PED_CENTER_CAMERA_BEHIND_PLAYER
"L1", // PED_LOCK_TARGET
nil, // NETWORK_TALK
nil, // PED_1RST_PERSON_LOOK_UP
nil, // PED_1RST_PERSON_LOOK_DOWN
nil, // _CONTROLLERACTION_36
nil, // TOGGLE_DPAD
nil, // SWITCH_DEBUG_CAM_ON
nil, // TAKE_SCREEN_SHOT
nil, // SHOW_MOUSE_POINTER_TOGGLE
}
};
#undef PS2_TRIANGLE
#undef PS2_CIRCLE
#undef PS2_CROSS
#undef PS2_SQUARE
#undef CONTROLLER_BUTTONS
#undef VFB
void CControllerConfigManager::GetWideStringOfCommandKeys(uint16 action, wchar *text, uint16 leight)
{
#ifdef DETECT_PAD_INPUT_SWITCH
@ -2716,7 +2548,11 @@ void CControllerConfigManager::GetWideStringOfCommandKeys(uint16 action, wchar *
wchar wstr[16];
// TODO: INI and/or menu setting for Xbox/PS switch
const char *(*Buttons)[MAX_CONTROLLERACTIONS] = XboxButtons;
#ifdef BUTTON_ICONS
const char *(*Buttons)[MAX_CONTROLLERACTIONS] = CFont::ButtonsSlot != -1 ? XboxButtons : XboxButtons_noIcons;
#else
const char *(*Buttons)[MAX_CONTROLLERACTIONS] = XboxButtons_noIcons;
#endif
assert(Buttons[CPad::GetPad(0)->Mode][action] != nil); // we cannot use these
AsciiToUnicode(Buttons[CPad::GetPad(0)->Mode][action], wstr);

View File

@ -122,7 +122,6 @@ int8 CMenuManager::m_nDisplayMSAALevel = 0;
#endif
#ifdef NO_ISLAND_LOADING
int8 CMenuManager::m_DisplayIslandLoading = ISLAND_LOADING_LOW;
int8 CMenuManager::m_PrefsIslandLoading = ISLAND_LOADING_LOW;
#endif
@ -435,29 +434,17 @@ CMenuManager::ThingsToDoBeforeGoingBack()
}
#ifdef CUSTOM_FRONTEND_OPTIONS
for (int i = 0; i < numCustomFrontendOptions; i++) {
FrontendOption &option = customFrontendOptions[i];
if (option.type != FEOPTION_REDIRECT && option.type != FEOPTION_GOBACK && m_nCurrScreen == option.screen) {
if (option.returnPrevPageFunc)
option.returnPrevPageFunc();
CMenuScreenCustom::CMenuEntry &option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption];
if (m_nCurrOption == option.screenOptionOrder && (option.type == FEOPTION_DYNAMIC || option.type == FEOPTION_BUILTIN_ACTION))
if(option.buttonPressFunc)
option.buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS);
if (option.m_Action == MENUACTION_CFO_DYNAMIC)
if(option.m_CFODynamic->buttonPressFunc)
option.m_CFODynamic->buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS);
if (option.type == FEOPTION_SELECT && option.onlyApplyOnEnter && option.lastSavedValue != option.displayedValue)
option.displayedValue = *option.value = option.lastSavedValue;
}
}
if (option.m_Action == MENUACTION_CFO_SELECT && option.m_CFOSelect->onlyApplyOnEnter && option.m_CFOSelect->lastSavedValue != option.m_CFOSelect->displayedValue)
option.m_CFOSelect->displayedValue = *option.m_CFO->value = option.m_CFOSelect->lastSavedValue;
if (m_nCurrScreen > lastOgScreen) {
for (int i = 0; i < numCustomFrontendScreens; i++) {
FrontendScreen& screen = customFrontendScreens[i];
if (m_nCurrScreen == screen.id && screen.returnPrevPageFunc) {
screen.returnPrevPageFunc();
break;
}
}
if (aScreens[m_nCurrScreen].returnPrevPageFunc) {
aScreens[m_nCurrScreen].returnPrevPageFunc();
}
#endif
}
@ -476,18 +463,15 @@ CMenuManager::GetPreviousPageOption()
prevPage = prevPage == MENUPAGE_NONE ? (!m_bGameNotLoaded ? MENUPAGE_PAUSE_MENU : MENUPAGE_START_MENU) : prevPage;
for (int i = 0; i < NUM_MENUROWS; i++) {
if (aScreens[prevPage].m_aEntries[i].m_SaveSlot == SAVESLOT_CFO) {
FrontendOption &option = customFrontendOptions[aScreens[prevPage].m_aEntries[i].m_TargetMenu];
if(option.type == FEOPTION_REDIRECT && option.to == m_nCurrScreen) {
if (aScreens[prevPage].m_aEntries[i].m_Action >= MENUACTION_NOTHING) { // CFO check
if (aScreens[prevPage].m_aEntries[i].m_TargetMenu == m_nCurrScreen) {
return i;
}
} else if (aScreens[prevPage].m_aEntries[i].m_TargetMenu == m_nCurrScreen) {
return i;
}
}
// Couldn't find current screen option on previous page, use default behaviour (maybe save-related screen?)
return !m_bGameNotLoaded ? aScreens[m_nCurrScreen].m_ParentEntry[1] : aScreens[m_nCurrScreen].m_ParentEntry[0];
// This shouldn't happen
return 0;
#endif
}
@ -856,13 +840,6 @@ CMenuManager::Draw()
str = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[0].m_EntryName);
break;
default:
#ifdef CUSTOM_FRONTEND_OPTIONS
if (aScreens[m_nCurrScreen].m_aEntries[0].m_SaveSlot == SAVESLOT_CFO) {
FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[0].m_TargetMenu];
str = (wchar*)option.leftText;
}
else
#endif
str = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[0].m_EntryName);
break;
}
@ -961,30 +938,22 @@ CMenuManager::Draw()
#endif
default:
#ifdef CUSTOM_FRONTEND_OPTIONS
bool custom = m_nCurrScreen > lastOgScreen;
CCustomScreenLayout *custom = aScreens[m_nCurrScreen].layout;
if (custom) {
for (int i = 0; i < numCustomFrontendScreens; i++) {
FrontendScreen& screen = customFrontendScreens[i];
if (m_nCurrScreen == screen.id) {
columnWidth = screen.columnWidth;
headerHeight = screen.headerHeight;
lineHeight = screen.lineHeight;
CFont::SetFontStyle(FONT_LOCALE(screen.font));
CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = screen.fontScaleX), MENU_Y(MENU_TEXT_SIZE_Y = screen.fontScaleY));
if (screen.alignment == FESCREEN_LEFT_ALIGN) {
CFont::SetCentreOff();
CFont::SetRightJustifyOff();
} else if (screen.alignment == FESCREEN_RIGHT_ALIGN) {
CFont::SetCentreOff();
CFont::SetRightJustifyOn();
} else {
CFont::SetRightJustifyOff();
CFont::SetCentreOn();
}
break;
}
if (i == numCustomFrontendScreens - 1)
custom = false;
columnWidth = custom->columnWidth;
headerHeight = custom->headerHeight;
lineHeight = custom->lineHeight;
CFont::SetFontStyle(FONT_LOCALE(custom->font));
CFont::SetScale(MENU_X(MENU_TEXT_SIZE_X = custom->fontScaleX), MENU_Y(MENU_TEXT_SIZE_Y = custom->fontScaleY));
if (custom->alignment == FESCREEN_LEFT_ALIGN) {
CFont::SetCentreOff();
CFont::SetRightJustifyOff();
} else if (custom->alignment == FESCREEN_RIGHT_ALIGN) {
CFont::SetCentreOff();
CFont::SetRightJustifyOn();
} else {
CFont::SetRightJustifyOff();
CFont::SetCentreOn();
}
}
if (!custom)
@ -1068,28 +1037,22 @@ CMenuManager::Draw()
leftText = TheText.Get(gString);
}
} else {
#ifdef CUSTOM_FRONTEND_OPTIONS
if (aScreens[m_nCurrScreen].m_aEntries[i].m_SaveSlot == SAVESLOT_CFO){
FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu];
leftText = (wchar*)option.leftText;
} else
#endif
leftText = TheText.Get(aScreens[m_nCurrScreen].m_aEntries[i].m_EntryName);
}
#ifdef CUSTOM_FRONTEND_OPTIONS
if (aScreens[m_nCurrScreen].m_aEntries[i].m_SaveSlot == SAVESLOT_CFO) {
FrontendOption &option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu];
if (option.type == FEOPTION_SELECT) {
if (option.onlyApplyOnEnter){
if (aScreens[m_nCurrScreen].m_aEntries[i].m_Action < MENUACTION_NOTHING) { // CFO check
CMenuScreenCustom::CMenuEntry &option = aScreens[m_nCurrScreen].m_aEntries[i];
if (option.m_Action == MENUACTION_CFO_SELECT) {
if (option.m_CFOSelect->onlyApplyOnEnter){
if (m_nCurrOption != i) {
if (option.displayedValue != option.lastSavedValue)
if (option.m_CFOSelect->displayedValue != option.m_CFOSelect->lastSavedValue)
SetHelperText(3); // Restored original value
// option.displayedValue = option.lastSavedValue = *option.value;
// option.displayedValue = option.lastSavedValue = *option.m_CFO->value;
} else {
if (option.displayedValue != *option.value)
if (option.m_CFOSelect->displayedValue != *option.m_CFO->value)
SetHelperText(1); // Enter to apply
else if (m_nHelperTextMsgId == 1)
ResetHelperText(); // Applied
@ -1098,13 +1061,13 @@ CMenuManager::Draw()
}
if (m_nCurrOption != lastOption && lastOption == i) {
FrontendOption &oldOption = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[lastOption].m_TargetMenu];
if (oldOption.type == FEOPTION_DYNAMIC || oldOption.type == FEOPTION_BUILTIN_ACTION)
if(oldOption.buttonPressFunc)
oldOption.buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS);
CMenuScreenCustom::CMenuEntry &oldOption = aScreens[m_nCurrScreen].m_aEntries[lastOption];
if (oldOption.m_Action == MENUACTION_CFO_DYNAMIC)
if(oldOption.m_CFODynamic->buttonPressFunc)
oldOption.m_CFODynamic->buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS);
if (oldOption.onlyApplyOnEnter && oldOption.type == FEOPTION_SELECT)
oldOption.displayedValue = oldOption.lastSavedValue = *oldOption.value;
if (oldOption.m_Action == MENUACTION_CFO_SELECT && oldOption.m_CFOSelect->onlyApplyOnEnter)
oldOption.m_CFOSelect->displayedValue = oldOption.m_CFOSelect->lastSavedValue = *oldOption.m_CFO->value;
}
}
#endif
@ -1272,21 +1235,6 @@ CMenuManager::Draw()
AsciiToUnicode(_psGetVideoModeList()[m_nDisplayVideoMode], unicodeTemp);
rightText = unicodeTemp;
break;
//#ifdef NO_ISLAND_LOADING
// case MENUACTION_ISLANDLOADING:
// switch (m_DisplayIslandLoading) {
// case ISLAND_LOADING_LOW:
// rightText = TheText.Get("FEM_LOW");
// break;
// case ISLAND_LOADING_MEDIUM:
// rightText = TheText.Get("FEM_MED");
// break;
// case ISLAND_LOADING_HIGH:
// rightText = TheText.Get("FEM_HIG");
// break;
// }
// break;
//#endif
case MENUACTION_AUDIOHW:
if (m_nPrefsAudio3DProviderIndex == -1)
rightText = TheText.Get("FEA_NAH");
@ -1338,29 +1286,24 @@ CMenuManager::Draw()
rightText = TheText.Get(CVehicle::m_bDisableMouseSteering ? "FEM_OFF" : "FEM_ON");
break;
#ifdef CUSTOM_FRONTEND_OPTIONS
case MENUACTION_TRIGGERFUNC:
FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu];
if (m_nCurrScreen == option.screen && i == option.screenOptionOrder) {
if (option.type == FEOPTION_SELECT) {
// To whom manipulate option.value of static options externally (like RestoreDef functions)
if (*option.value != option.lastSavedValue)
option.displayedValue = option.lastSavedValue = *option.value;
case MENUACTION_CFO_DYNAMIC:
case MENUACTION_CFO_SELECT:
CMenuScreenCustom::CMenuEntry &option = aScreens[m_nCurrScreen].m_aEntries[i];
if (option.m_Action == MENUACTION_CFO_SELECT) {
// To whom manipulate option.m_CFO->value of static options externally (like RestoreDef functions)
if (*option.m_CFO->value != option.m_CFOSelect->lastSavedValue)
option.m_CFOSelect->displayedValue = option.m_CFOSelect->lastSavedValue = *option.m_CFO->value;
if (option.displayedValue >= option.numRightTexts || option.displayedValue < 0)
option.displayedValue = 0;
if (option.m_CFOSelect->displayedValue >= option.m_CFOSelect->numRightTexts || option.m_CFOSelect->displayedValue < 0)
option.m_CFOSelect->displayedValue = 0;
rightText = (wchar*)option.rightTexts[option.displayedValue];
rightText = TheText.Get(option.m_CFOSelect->rightTexts[option.m_CFOSelect->displayedValue]);
} else if (option.type == FEOPTION_DYNAMIC) {
if (option.drawFunc) {
rightText = option.drawFunc(&isOptionDisabled, m_nCurrOption == i);
}
} else if (option.m_Action == MENUACTION_CFO_DYNAMIC) {
if (option.m_CFODynamic->drawFunc) {
rightText = option.m_CFODynamic->drawFunc(&isOptionDisabled, m_nCurrOption == i);
}
} else {
debug("A- screen:%d option:%d - totalCo: %d, coId: %d, coScreen:%d, coOption:%d\n", m_nCurrScreen, i, numCustomFrontendOptions, aScreens[m_nCurrScreen].m_aEntries[i].m_TargetMenu, option.screen, option.screenOptionOrder);
assert(0 && "Custom frontend options is borked");
}
break;
#endif
}
@ -1471,12 +1414,6 @@ CMenuManager::Draw()
if (!strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FED_RES") && m_nHelperTextMsgId == 1)
ResetHelperText();
}
//#ifdef NO_ISLAND_LOADING
// if (m_DisplayIslandLoading == m_PrefsIslandLoading) {
// if (!strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEM_ISL") && m_nHelperTextMsgId == 1)
// ResetHelperText();
// }
//#endif
if (m_nPrefsAudio3DProviderIndex != DMAudio.GetCurrent3DProviderIndex()) {
if (!strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEA_3DH"))
SetHelperText(1);
@ -1485,12 +1422,6 @@ CMenuManager::Draw()
if (!strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FED_RES"))
SetHelperText(1);
}
//#ifdef NO_ISLAND_LOADING
// if (m_DisplayIslandLoading != m_PrefsIslandLoading) {
// if (!strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEM_ISL"))
// SetHelperText(1);
// }
//#endif
if (m_nPrefsAudio3DProviderIndex != DMAudio.GetCurrent3DProviderIndex()) {
if (strcmp(aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_EntryName, "FEA_3DH") != 0
// To make assigning built-in actions to new custom options possible.
@ -1575,13 +1506,9 @@ CMenuManager::Draw()
break;
#ifdef CUSTOM_FRONTEND_OPTIONS
default:
if (m_nCurrScreen > lastOgScreen) {
for (int i = 0; i < numCustomFrontendScreens; i++) {
FrontendScreen& screen = customFrontendScreens[i];
if (m_nCurrScreen == screen.id && screen.showLeftRightHelper) {
DisplayHelperText();
break;
}
if (aScreens[m_nCurrScreen].layout) {
if (aScreens[m_nCurrScreen].layout->showLeftRightHelper) {
DisplayHelperText();
}
}
break;
@ -2614,17 +2541,10 @@ CMenuManager::DrawFrontEndNormal()
break;
default:
#ifdef CUSTOM_FRONTEND_OPTIONS
bool custom = m_nPrevScreen > lastOgScreen;
CCustomScreenLayout *custom = aScreens[m_nPrevScreen].layout;
if (custom) {
for (int i = 0; i < numCustomFrontendScreens; i++) {
FrontendScreen& screen = customFrontendScreens[i];
if (m_nPrevScreen == screen.id) {
previousSprite = screen.sprite;
break;
}
if (i == numCustomFrontendScreens - 1)
custom = false;
}
previousSprite = custom->sprite;
break;
}
if (!custom)
#endif
@ -2680,15 +2600,9 @@ CMenuManager::DrawFrontEndNormal()
break;
#ifdef CUSTOM_FRONTEND_OPTIONS
default:
bool custom = m_nCurrScreen > lastOgScreen;
CCustomScreenLayout *custom = aScreens[m_nCurrScreen].layout;
if (custom) {
for (int i = 0; i < numCustomFrontendScreens; i++) {
FrontendScreen& screen = customFrontendScreens[i];
if (m_nCurrScreen == screen.id) {
currentSprite = screen.sprite;
break;
}
}
previousSprite = custom->sprite;
}
break;
#endif
@ -3303,10 +3217,6 @@ CMenuManager::InitialiseChangedLanguageSettings()
default:
break;
}
#ifdef CUSTOM_FRONTEND_OPTIONS
CustomFrontendOptionsPopulate();
#endif
}
}
@ -3496,6 +3406,9 @@ CMenuManager::LoadSettings()
strcpy(m_PrefsSkinFile, DEFAULT_SKIN_NAME);
strcpy(m_aSkinName, DEFAULT_SKIN_NAME);
}
#ifdef LOAD_INI_SETTINGS
LoadINISettings(); // needs frontend options to be loaded
#endif
}
void
@ -4881,45 +4794,6 @@ CMenuManager::ProcessButtonPresses(void)
SaveSettings();
}
break;
//#ifdef NO_ISLAND_LOADING
// case MENUACTION_ISLANDLOADING:
// if (m_DisplayIslandLoading != m_PrefsIslandLoading) {
// if (!m_bGameNotLoaded) {
// if (m_DisplayIslandLoading > ISLAND_LOADING_LOW) {
// if (m_DisplayIslandLoading == ISLAND_LOADING_HIGH)
// CStreaming::RemoveIslandsNotUsed(LEVEL_GENERIC);
// if (m_PrefsIslandLoading == ISLAND_LOADING_LOW) {
// if (CGame::currLevel != LEVEL_INDUSTRIAL)
// CFileLoader::LoadCollisionFromDatFile(LEVEL_INDUSTRIAL);
// if (CGame::currLevel != LEVEL_COMMERCIAL)
// CFileLoader::LoadCollisionFromDatFile(LEVEL_COMMERCIAL);
// if (CGame::currLevel != LEVEL_SUBURBAN)
// CFileLoader::LoadCollisionFromDatFile(LEVEL_SUBURBAN);
// CCollision::bAlreadyLoaded = true;
// m_PrefsIslandLoading = m_DisplayIslandLoading;
// CStreaming::RequestBigBuildings(CGame::currLevel);
// } else if (m_PrefsIslandLoading == ISLAND_LOADING_HIGH) {
// m_PrefsIslandLoading = m_DisplayIslandLoading;
// CStreaming::RequestIslands(CGame::currLevel);
// } else
// m_PrefsIslandLoading = m_DisplayIslandLoading;
// } else { // low
// m_PrefsIslandLoading = m_DisplayIslandLoading;
// CCollision::bAlreadyLoaded = false;
// CModelInfo::RemoveColModelsFromOtherLevels(CGame::currLevel);
// CStreaming::RemoveUnusedBigBuildings(CGame::currLevel);
// CStreaming::RemoveUnusedBuildings(CGame::currLevel);
// CStreaming::RequestIslands(CGame::currLevel);
// }
//
// CStreaming::LoadAllRequestedModels(true);
// } else
// m_PrefsIslandLoading = m_DisplayIslandLoading;
// SetHelperText(0);
// SaveSettings();
// }
// break;
//#endif
case MENUACTION_AUDIOHW:
{
int selectedProvider = m_nPrefsAudio3DProviderIndex;
@ -4994,40 +4868,6 @@ CMenuManager::ProcessButtonPresses(void)
RestoreDefGraphics(FEOPTION_ACTION_SELECT);
RestoreDefDisplay(FEOPTION_ACTION_SELECT);
#endif
//#ifdef NO_ISLAND_LOADING
// m_DisplayIslandLoading = ISLAND_LOADING_LOW;
// if (!m_bGameNotLoaded) {
// if (m_DisplayIslandLoading > ISLAND_LOADING_LOW) {
// if (m_DisplayIslandLoading == ISLAND_LOADING_HIGH)
// CStreaming::RemoveIslandsNotUsed(LEVEL_GENERIC);
// if (m_PrefsIslandLoading == ISLAND_LOADING_LOW) {
// if (CGame::currLevel != LEVEL_INDUSTRIAL)
// CFileLoader::LoadCollisionFromDatFile(LEVEL_INDUSTRIAL);
// if (CGame::currLevel != LEVEL_COMMERCIAL)
// CFileLoader::LoadCollisionFromDatFile(LEVEL_COMMERCIAL);
// if (CGame::currLevel != LEVEL_SUBURBAN)
// CFileLoader::LoadCollisionFromDatFile(LEVEL_SUBURBAN);
// CCollision::bAlreadyLoaded = true;
// m_PrefsIslandLoading = m_DisplayIslandLoading;
// CStreaming::RequestBigBuildings(CGame::currLevel);
// } else if (m_PrefsIslandLoading == ISLAND_LOADING_HIGH) {
// m_PrefsIslandLoading = m_DisplayIslandLoading;
// CStreaming::RequestIslands(CGame::currLevel);
// } else
// m_PrefsIslandLoading = m_DisplayIslandLoading;
// } else { // low
// m_PrefsIslandLoading = m_DisplayIslandLoading;
// CCollision::bAlreadyLoaded = false;
// CModelInfo::RemoveColModelsFromOtherLevels(CGame::currLevel);
// CStreaming::RemoveUnusedBigBuildings(CGame::currLevel);
// CStreaming::RemoveUnusedBuildings(CGame::currLevel);
// CStreaming::RequestIslands(CGame::currLevel);
// }
//
// CStreaming::LoadAllRequestedModels(true);
// } else
// m_PrefsIslandLoading = m_DisplayIslandLoading;
//#endif // NO_ISLAND_LOADING
SaveSettings();
} else if ((m_nCurrScreen != MENUPAGE_SKIN_SELECT_OLD) && (m_nCurrScreen == MENUPAGE_CONTROLLER_PC)) {
ControlsManager.MakeControllerActionsBlank();
@ -5088,29 +4928,28 @@ CMenuManager::ProcessButtonPresses(void)
return;
#endif
#ifdef CUSTOM_FRONTEND_OPTIONS
case MENUACTION_TRIGGERFUNC:
FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu];
if (m_nCurrScreen == option.screen && m_nCurrOption == option.screenOptionOrder) {
if (option.type == FEOPTION_SELECT) {
if (!option.onlyApplyOnEnter) {
option.displayedValue++;
if (option.displayedValue >= option.numRightTexts || option.displayedValue < 0)
option.displayedValue = 0;
}
option.changeFunc(option.displayedValue);
*option.value = option.lastSavedValue = option.displayedValue;
} else if (option.type == FEOPTION_DYNAMIC) {
if (option.buttonPressFunc)
option.buttonPressFunc(FEOPTION_ACTION_SELECT);
} else if (option.type == FEOPTION_REDIRECT) {
ChangeScreen(option.to, option.option, true, option.fadeIn);
} else if (option.type == FEOPTION_GOBACK) {
goBack = true;
case MENUACTION_CFO_SELECT:
case MENUACTION_CFO_DYNAMIC:
CMenuScreenCustom::CMenuEntry &option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption];
if (option.m_Action == MENUACTION_CFO_SELECT) {
if (!option.m_CFOSelect->onlyApplyOnEnter) {
option.m_CFOSelect->displayedValue++;
if (option.m_CFOSelect->displayedValue >= option.m_CFOSelect->numRightTexts || option.m_CFOSelect->displayedValue < 0)
option.m_CFOSelect->displayedValue = 0;
}
} else {
debug("B- screen:%d option:%d - totalCo: %d, coId: %d, coScreen:%d, coOption:%d\n", m_nCurrScreen, m_nCurrOption, numCustomFrontendOptions, aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu, option.screen, option.screenOptionOrder);
assert(0 && "Custom frontend options are borked");
int8 oldValue = *option.m_CFO->value;
*option.m_CFO->value = option.m_CFOSelect->lastSavedValue = option.m_CFOSelect->displayedValue;
if (option.m_CFOSelect->save)
SaveSettings();
if (option.m_CFOSelect->displayedValue != oldValue && option.m_CFOSelect->changeFunc)
option.m_CFOSelect->changeFunc(oldValue, option.m_CFOSelect->displayedValue);
} else if (option.m_Action == MENUACTION_CFO_DYNAMIC) {
if (option.m_CFODynamic->buttonPressFunc)
option.m_CFODynamic->buttonPressFunc(FEOPTION_ACTION_SELECT);
}
break;
@ -5118,14 +4957,6 @@ CMenuManager::ProcessButtonPresses(void)
}
}
ProcessOnOffMenuOptions();
#ifdef CUSTOM_FRONTEND_OPTIONS
if (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_SaveSlot == SAVESLOT_CFO) {
FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu];
if (option.type == FEOPTION_BUILTIN_ACTION && option.buttonPressFunc) {
option.buttonPressFunc(FEOPTION_ACTION_SELECT);
}
}
#endif
}
if (goBack) {
@ -5296,15 +5127,6 @@ CMenuManager::ProcessButtonPresses(void)
}
}
break;
//#ifdef NO_ISLAND_LOADING
// case MENUACTION_ISLANDLOADING:
// m_DisplayIslandLoading += changeValueBy;
// if (m_DisplayIslandLoading > ISLAND_LOADING_HIGH)
// m_DisplayIslandLoading = ISLAND_LOADING_LOW;
// else if (m_DisplayIslandLoading < ISLAND_LOADING_LOW)
// m_DisplayIslandLoading = ISLAND_LOADING_HIGH;
// break;
//#endif
case MENUACTION_AUDIOHW:
if (m_nPrefsAudio3DProviderIndex != -1) {
m_nPrefsAudio3DProviderIndex += changeValueBy;
@ -5328,32 +5150,34 @@ CMenuManager::ProcessButtonPresses(void)
SaveSettings();
break;
#ifdef CUSTOM_FRONTEND_OPTIONS
case MENUACTION_TRIGGERFUNC:
FrontendOption& option = customFrontendOptions[aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu];
if (m_nCurrScreen == option.screen && m_nCurrOption == option.screenOptionOrder) {
if (option.type == FEOPTION_SELECT) {
if (changeValueBy > 0) {
option.displayedValue++;
if (option.displayedValue >= option.numRightTexts)
option.displayedValue = 0;
} else {
option.displayedValue--;
if (option.displayedValue < 0)
option.displayedValue = option.numRightTexts - 1;
}
if (!option.onlyApplyOnEnter) {
option.changeFunc(option.displayedValue);
*option.value = option.lastSavedValue = option.displayedValue;
}
} else if (option.type == FEOPTION_DYNAMIC && option.buttonPressFunc) {
option.buttonPressFunc(changeValueBy > 0 ? FEOPTION_ACTION_RIGHT : FEOPTION_ACTION_LEFT);
case MENUACTION_CFO_SELECT:
case MENUACTION_CFO_DYNAMIC:
CMenuScreenCustom::CMenuEntry &option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption];
if (option.m_Action == MENUACTION_CFO_SELECT) {
if (changeValueBy > 0) {
option.m_CFOSelect->displayedValue++;
if (option.m_CFOSelect->displayedValue >= option.m_CFOSelect->numRightTexts)
option.m_CFOSelect->displayedValue = 0;
} else {
option.m_CFOSelect->displayedValue--;
if (option.m_CFOSelect->displayedValue < 0)
option.m_CFOSelect->displayedValue = option.m_CFOSelect->numRightTexts - 1;
}
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
}
else {
debug("C- screen:%d option:%d - totalCo: %d, coId: %d, coScreen:%d, coOption:%d\n", m_nCurrScreen, m_nCurrOption, numCustomFrontendOptions, aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_TargetMenu, option.screen, option.screenOptionOrder);
assert(0 && "Custom frontend options are borked");
if (!option.m_CFOSelect->onlyApplyOnEnter) {
int8 oldValue = *option.m_CFO->value;
*option.m_CFO->value = option.m_CFOSelect->lastSavedValue = option.m_CFOSelect->displayedValue;
if (option.m_CFOSelect->save)
SaveSettings();
if (option.m_CFOSelect->displayedValue != oldValue && option.m_CFOSelect->changeFunc)
option.m_CFOSelect->changeFunc(oldValue, option.m_CFOSelect->displayedValue);
}
} else if (option.m_Action == MENUACTION_CFO_DYNAMIC && option.m_CFODynamic->buttonPressFunc) {
option.m_CFODynamic->buttonPressFunc(changeValueBy > 0 ? FEOPTION_ACTION_RIGHT : FEOPTION_ACTION_LEFT);
}
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
break;
#endif

View File

@ -156,9 +156,6 @@ enum eSaveSlot
SAVESLOT_7,
SAVESLOT_8,
SAVESLOT_LABEL = 36,
#ifdef CUSTOM_FRONTEND_OPTIONS
SAVESLOT_CFO
#endif
};
#ifdef MENU_MAP
@ -239,18 +236,31 @@ enum eMenuScreen
MENUPAGE_MOUSE_CONTROLS = 56,
MENUPAGE_MISSION_RETRY = 57,
#ifdef MENU_MAP
MENUPAGE_MAP,
MENUPAGE_MAP = 58,
#endif
MENUPAGE_UNK, // 58 in game. Map page is added above, because last screen in CMenuScreens should always be empty to make CFO work
#ifdef CUSTOM_FRONTEND_OPTIONS
MENUPAGES = 65 // for some room to add more screen
#ifdef GRAPHICS_MENU_OPTIONS
MENUPAGE_GRAPHICS_SETTINGS,
#else
MENUPAGES
MENUPAGE_ADVANCED_DISPLAY_SETTINGS,
#endif
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
MENUPAGE_DETECT_JOYSTICK,
#endif
#endif
MENUPAGE_UNK, // originally 58. Custom screens are inserted above, because last screen in CMenuScreens should always be empty to make CFO work
MENUPAGES
};
enum eMenuAction
{
#ifdef CUSTOM_FRONTEND_OPTIONS
MENUACTION_CFO_SELECT = -2,
MENUACTION_CFO_DYNAMIC = -1,
#endif
MENUACTION_NOTHING,
MENUACTION_LABEL,
MENUACTION_CHANGEMENU,
@ -370,12 +380,6 @@ enum eMenuAction
// MENUACTION_MIPMAPS,
// MENUACTION_TEXTURE_FILTERING,
//#endif
//#ifdef NO_ISLAND_LOADING
// MENUACTION_ISLANDLOADING,
//#endif
#ifdef CUSTOM_FRONTEND_OPTIONS
MENUACTION_TRIGGERFUNC
#endif
};
enum eCheckHover
@ -458,6 +462,7 @@ struct BottomBarOption
int32 screenId;
};
#ifndef CUSTOM_FRONTEND_OPTIONS
struct CMenuScreen
{
char m_ScreenName[8];
@ -470,9 +475,91 @@ struct CMenuScreen
int32 m_Action; // eMenuAction
char m_EntryName[8];
int32 m_SaveSlot; // eSaveSlot
int32 m_TargetMenu; // eMenuScreen // FrontendOption ID if it's a custom option
int32 m_TargetMenu; // eMenuScreen
} m_aEntries[NUM_MENUROWS];
};
extern CMenuScreen aScreens[MENUPAGES];
#else
#include "frontendoption.h"
struct CCustomScreenLayout {
eMenuSprites sprite;
int columnWidth;
int headerHeight;
int lineHeight;
int8 font;
int8 alignment;
bool showLeftRightHelper;
float fontScaleX;
float fontScaleY;
};
struct CCFO
{
int8 *value;
const char *save;
};
struct CCFOSelect : CCFO
{
char** rightTexts;
int8 numRightTexts;
bool onlyApplyOnEnter;
int8 displayedValue; // only if onlyApplyOnEnter enabled for now
int8 lastSavedValue; // only if onlyApplyOnEnter enabled
ChangeFunc changeFunc;
CCFOSelect() {};
CCFOSelect(int8* value, const char* save, const char** rightTexts, int8 numRightTexts, bool onlyApplyOnEnter, ChangeFunc changeFunc){
this->value = value;
if (value)
this->lastSavedValue = this->displayedValue = *value;
this->save = save;
this->rightTexts = (char**)rightTexts;
this->numRightTexts = numRightTexts;
this->onlyApplyOnEnter = onlyApplyOnEnter;
this->changeFunc = changeFunc;
}
};
struct CCFODynamic : CCFO
{
DrawFunc drawFunc;
ButtonPressFunc buttonPressFunc;
CCFODynamic() {};
CCFODynamic(int8* value, const char* save, DrawFunc drawFunc, ButtonPressFunc buttonPressFunc){
this->value = value;
this->save = save;
this->drawFunc = drawFunc;
this->buttonPressFunc = buttonPressFunc;
}
};
struct CMenuScreenCustom
{
char m_ScreenName[8];
int32 m_PreviousPage[2]; // eMenuScreen
CCustomScreenLayout *layout;
ReturnPrevPageFunc returnPrevPageFunc;
struct CMenuEntry
{
int32 m_Action; // eMenuAction - below zero is CFO
char m_EntryName[8];
struct {
union {
CCFO *m_CFO; // for initializing
CCFOSelect *m_CFOSelect;
CCFODynamic *m_CFODynamic;
};
int32 m_SaveSlot; // eSaveSlot
int32 m_TargetMenu; // eMenuScreen
};
} m_aEntries[NUM_MENUROWS];
};
extern CMenuScreenCustom aScreens[MENUPAGES];
#endif
class CMenuManager
{
@ -628,7 +715,6 @@ public:
ISLAND_LOADING_HIGH
};
static int8 m_DisplayIslandLoading;
static int8 m_PrefsIslandLoading;
#define ISLAND_LOADING_IS(p) if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_##p)
@ -703,6 +789,5 @@ VALIDATE_SIZE(CMenuManager, 0x564);
#endif
extern CMenuManager FrontEndMenuManager;
extern CMenuScreen aScreens[MENUPAGES];
#endif
#endif

View File

@ -22,7 +22,7 @@
#include "Game.h"
#include "World.h"
#include "PlayerInfo.h"
#include "FrontendControls.h"
#include "FrontEndControls.h"
#include "MemoryCard.h"
#define CRect_SZ(x, y, w, h) CRect(x, y, x+w, y+h)
@ -203,20 +203,6 @@ static const char* FrontendFilenames[][2] =
{"fe_radio9", "" },
};
#ifdef CUTSCENE_BORDERS_SWITCH
bool CMenuManager::m_PrefsCutsceneBorders = true;
#endif
#ifdef MULTISAMPLING
int8 CMenuManager::m_nPrefsMSAALevel = 0;
int8 CMenuManager::m_nDisplayMSAALevel = 0;
#endif
#ifdef NO_ISLAND_LOADING
int8 CMenuManager::m_DisplayIslandLoading = ISLAND_LOADING_LOW;
int8 CMenuManager::m_PrefsIslandLoading = ISLAND_LOADING_LOW;
#endif
int32 CMenuManager::m_PrefsSfxVolume = 102;
int32 CMenuManager::m_PrefsMusicVolume = 102;
int32 CMenuManager::m_PrefsBrightness = 256;
@ -3044,4 +3030,4 @@ CMenuManager::FilterOutColorMarkersFromString(wchar *string, CRGBA &color)
*dst = '\0';
}
#endif
#endif

View File

@ -160,31 +160,9 @@ public:
static int32 m_PrefsLanguage;
static CONTRCONFIG m_PrefsControllerConfig;
static bool m_PrefsUseVibration;
#ifdef NO_ISLAND_LOADING
enum
{
ISLAND_LOADING_LOW = 0,
ISLAND_LOADING_MEDIUM,
ISLAND_LOADING_HIGH
};
static int8 m_DisplayIslandLoading;
static int8 m_PrefsIslandLoading;
#define ISLAND_LOADING_IS(p) if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_##p)
#define ISLAND_LOADING_ISNT(p) if (CMenuManager::m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_##p)
#else
#define ISLAND_LOADING_IS(p)
#define ISLAND_LOADING_ISNT(p)
#endif
#ifdef CUTSCENE_BORDERS_SWITCH
static bool m_PrefsCutsceneBorders;
#endif
#ifdef MULTISAMPLING
static int8 m_nPrefsMSAALevel;
static int8 m_nDisplayMSAALevel;
#endif
#ifdef GTA_PC
bool m_bQuitGameNoCD;

View File

@ -86,7 +86,6 @@
#include "ZoneCull.h"
#include "Zones.h"
#include "debugmenu.h"
#include "frontendoption.h"
#include "postfx.h"
#include "custompipes.h"
#include "crossplatform.h"
@ -314,16 +313,6 @@ bool CGame::InitialiseOnceAfterRW(void)
DMAudio.SetMusicFadeVol(127);
CWorld::Players[0].SetPlayerSkin(CMenuManager::m_PrefsSkinFile);
#ifdef CUSTOM_FRONTEND_OPTIONS
// Apparently this func. can be run multiple times at the start.
if (numCustomFrontendOptions == 0 && numCustomFrontendScreens == 0) {
// needs stored language and TheText to be loaded, and last TheText reload is at the start of here
CustomFrontendOptionsPopulate();
}
#endif
#ifdef LOAD_INI_SETTINGS
LoadINISettings(); // needs frontend options to be loaded
#endif
return true;
}

View File

@ -2,8 +2,10 @@
#include "Frontend.h"
#ifdef PC_MENU
// If you want to add new options, please don't do that here and see CustomFrontendOptionsPopulate in re3.cpp.
// Please don't touch this file, except for bug fixing or ports.
// Check MenuScreensCustom.cpp
#ifndef CUSTOM_FRONTEND_OPTIONS
CMenuScreen aScreens[MENUPAGES] = {
// MENUPAGE_NONE = 0
{ "", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, },
@ -390,6 +392,9 @@ CMenuScreen aScreens[MENUPAGES] = {
{ "FET_PAU", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_RESUME, "FEM_RES", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEN_STA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
#ifdef MENU_MAP
MENUACTION_CHANGEMENU, "FEG_MAP", SAVESLOT_NONE, MENUPAGE_MAP,
#endif
MENUACTION_CHANGEMENU, "FEP_STA", SAVESLOT_NONE, MENUPAGE_STATS,
MENUACTION_CHANGEMENU, "FEP_BRI", SAVESLOT_NONE, MENUPAGE_BRIEFS,
MENUACTION_CHANGEMENU, "FET_OPT", SAVESLOT_NONE, MENUPAGE_OPTIONS,
@ -436,10 +441,10 @@ CMenuScreen aScreens[MENUPAGES] = {
#ifdef MENU_MAP
// MENUPAGE_MAP
{ "FEG_MAP", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2,
{ "FEG_MAP", 1, MENUPAGE_NONE, MENUPAGE_NONE, 2, 2,
MENUACTION_UNK110, "", SAVESLOT_NONE, MENUPAGE_NONE, // to prevent cross/enter to go back
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
},
#endif
// MENUPAGE_UNK
@ -449,4 +454,5 @@ CMenuScreen aScreens[MENUPAGES] = {
};
#endif
#endif
#endif

View File

@ -0,0 +1,870 @@
#include "common.h"
#include "platform.h"
#include "crossplatform.h"
#include "Renderer.h"
#include "Frontend.h"
#include "Font.h"
#include "Camera.h"
#include "main.h"
#include "MBlur.h"
#include "postfx.h"
#include "custompipes.h"
#include "RwHelper.h"
#include "Text.h"
#include "Streaming.h"
#include "FileLoader.h"
#include "Collision.h"
#include "ModelInfo.h"
// Menu screens array is at the bottom of the file.
#ifdef PC_MENU
#ifdef CUSTOM_FRONTEND_OPTIONS
#ifdef IMPROVED_VIDEOMODE
#define VIDEOMODE_SELECTOR MENUACTION_CFO_SELECT, "FEM_SCF", { new CCFOSelect((int8*)&FrontEndMenuManager.m_nPrefsWindowed, nil, screenModes, 2, true, ScreenModeAfterChange) },
#else
#define VIDEOMODE_SELECTOR
#endif
#ifdef MULTISAMPLING
#define MULTISAMPLING_SELECTOR MENUACTION_CFO_DYNAMIC, "FED_AAS", { new CCFODynamic((int8*)&FrontEndMenuManager.m_nPrefsMSAALevel, "MultiSampling", MultiSamplingDraw, MultiSamplingButtonPress) },
#else
#define MULTISAMPLING_SELECTOR
#endif
#ifdef CUTSCENE_BORDERS_SWITCH
#define CUTSCENE_BORDERS_TOGGLE MENUACTION_CFO_SELECT, "FEM_CSB", { new CCFOSelect((int8 *)&CMenuManager::m_PrefsCutsceneBorders, "CutsceneBorders", off_on, 2, false, nil) },
#else
#define CUTSCENE_BORDERS_TOGGLE
#endif
#ifdef FREE_CAM
#define FREE_CAM_TOGGLE MENUACTION_CFO_SELECT, "FEC_FRC", { new CCFOSelect((int8*)&TheCamera.bFreeCam, "FreeCam", off_on, 2, false, nil) },
#else
#define FREE_CAM_TOGGLE
#endif
#ifdef PS2_ALPHA_TEST
#define DUALPASS_SELECTOR MENUACTION_CFO_SELECT, "FEM_2PR", { new CCFOSelect((int8*)&gPS2alphaTest, "PS2AlphaTest", off_on, 2, false, nil) },
#else
#define DUALPASS_SELECTOR
#endif
#ifdef NO_ISLAND_LOADING
#define ISLAND_LOADING_SELECTOR MENUACTION_CFO_SELECT, "FEM_ISL", { new CCFOSelect((int8*)&CMenuManager::m_PrefsIslandLoading, "IslandLoading", islandLoadingOpts, ARRAY_SIZE(islandLoadingOpts), true, IslandLoadingAfterChange) },
#else
#define ISLAND_LOADING_SELECTOR
#endif
#ifdef EXTENDED_COLOURFILTER
#define POSTFX_SELECTORS \
MENUACTION_CFO_SELECT, "FED_CLF", { new CCFOSelect((int8*)&CPostFX::EffectSwitch, "ColourFilter", filterNames, ARRAY_SIZE(filterNames), false, nil) }, \
MENUACTION_CFO_SELECT, "FED_MBL", { new CCFOSelect((int8*)&CPostFX::MotionBlurOn, "MotionBlur", off_on, 2, false, nil) },
#else
#define POSTFX_SELECTORS
#endif
#ifdef EXTENDED_PIPELINES
#define PIPELINES_SELECTOR \
MENUACTION_CFO_SELECT, "FED_VPL", { new CCFOSelect((int8*)&CustomPipes::VehiclePipeSwitch, "VehiclePipeline", vehPipelineNames, ARRAY_SIZE(vehPipelineNames), false, nil) }, \
MENUACTION_CFO_SELECT, "FED_PRM", { new CCFOSelect((int8*)&CustomPipes::RimlightEnable, "NeoRimLight", off_on, 2, false, nil) }, \
MENUACTION_CFO_SELECT, "FED_WLM", { new CCFOSelect((int8*)&CustomPipes::LightmapEnable, "NeoLightMaps", off_on, 2, false, nil) }, \
MENUACTION_CFO_SELECT, "FED_RGL", { new CCFOSelect((int8*)&CustomPipes::GlossEnable, "NeoRoadGloss", off_on, 2, false, nil) },
#else
#define PIPELINES_SELECTOR
#endif
const char *filterNames[] = { "FEM_NON", "FEM_SIM", "FEM_NRM", "FEM_MOB" };
const char *vehPipelineNames[] = { "FED_MFX", "FED_NEO" };
const char *off_on[] = { "FEM_OFF", "FEM_ON" };
void RestoreDefGraphics(int8 action) {
if (action != FEOPTION_ACTION_SELECT)
return;
#ifdef PS2_ALPHA_TEST
gPS2alphaTest = false;
#endif
#ifdef MULTISAMPLING
FrontEndMenuManager.m_nPrefsMSAALevel = FrontEndMenuManager.m_nDisplayMSAALevel = 0;
#endif
#ifdef NO_ISLAND_LOADING
if (FrontEndMenuManager.m_bGameNotLoaded) {
FrontEndMenuManager.m_PrefsIslandLoading = FrontEndMenuManager.ISLAND_LOADING_LOW;
CCollision::bAlreadyLoaded = false;
CModelInfo::RemoveColModelsFromOtherLevels(CGame::currLevel);
CStreaming::RemoveUnusedBigBuildings(CGame::currLevel);
CStreaming::RemoveUnusedBuildings(CGame::currLevel);
CStreaming::RequestIslands(CGame::currLevel);
CStreaming::LoadAllRequestedModels(true);
} else
FrontEndMenuManager.m_PrefsIslandLoading = FrontEndMenuManager.ISLAND_LOADING_LOW;
#endif
#ifdef GRAPHICS_MENU_OPTIONS // otherwise Frontend will handle those
CMenuManager::m_PrefsFrameLimiter = true;
CMenuManager::m_PrefsVsyncDisp = true;
CMenuManager::m_PrefsVsync = true;
CMenuManager::m_PrefsUseWideScreen = false;
FrontEndMenuManager.m_nDisplayVideoMode = FrontEndMenuManager.m_nPrefsVideoMode;
#ifdef GTA3_1_1_PATCH
if (_dwOperatingSystemVersion == OS_WIN98) {
CMBlur::BlurOn = false;
CMBlur::MotionBlurClose();
} else {
CMBlur::BlurOn = true;
CMBlur::MotionBlurOpen(Scene.camera);
}
#else
CMBlur::BlurOn = true;
#endif
FrontEndMenuManager.SaveSettings();
#endif
}
void RestoreDefDisplay(int8 action) {
if (action != FEOPTION_ACTION_SELECT)
return;
#ifdef CUTSCENE_BORDERS_SWITCH
CMenuManager::m_PrefsCutsceneBorders = true;
#endif
#ifdef FREE_CAM
TheCamera.bFreeCam = false;
#endif
#ifdef GRAPHICS_MENU_OPTIONS // otherwise Frontend will handle those
CMenuManager::m_PrefsBrightness = 256;
CMenuManager::m_PrefsLOD = 1.2f;
CRenderer::ms_lodDistScale = 1.2f;
CMenuManager::m_PrefsShowSubtitles = true;
FrontEndMenuManager.SaveSettings();
#endif
}
#ifdef NO_ISLAND_LOADING
const char *islandLoadingOpts[] = { "FEM_LOW", "FEM_MED", "FEM_HIG" };
void IslandLoadingAfterChange(int8 before, int8 after) {
if (!FrontEndMenuManager.m_bGameNotLoaded) {
if (after > FrontEndMenuManager.ISLAND_LOADING_LOW) {
FrontEndMenuManager.m_PrefsIslandLoading = before; // calls below needs previous mode :shrug:
if (after == FrontEndMenuManager.ISLAND_LOADING_HIGH)
CStreaming::RemoveIslandsNotUsed(LEVEL_GENERIC);
if (before == FrontEndMenuManager.ISLAND_LOADING_LOW) {
if (CGame::currLevel != LEVEL_INDUSTRIAL)
CFileLoader::LoadCollisionFromDatFile(LEVEL_INDUSTRIAL);
if (CGame::currLevel != LEVEL_COMMERCIAL)
CFileLoader::LoadCollisionFromDatFile(LEVEL_COMMERCIAL);
if (CGame::currLevel != LEVEL_SUBURBAN)
CFileLoader::LoadCollisionFromDatFile(LEVEL_SUBURBAN);
CCollision::bAlreadyLoaded = true;
FrontEndMenuManager.m_PrefsIslandLoading = after;
CStreaming::RequestBigBuildings(CGame::currLevel);
} else if (before == FrontEndMenuManager.ISLAND_LOADING_HIGH) {
FrontEndMenuManager.m_PrefsIslandLoading = after;
CStreaming::RequestIslands(CGame::currLevel);
} else
FrontEndMenuManager.m_PrefsIslandLoading = after;
} else { // low
CCollision::bAlreadyLoaded = false;
CModelInfo::RemoveColModelsFromOtherLevels(CGame::currLevel);
CStreaming::RemoveUnusedBigBuildings(CGame::currLevel);
CStreaming::RemoveUnusedBuildings(CGame::currLevel);
CStreaming::RequestIslands(CGame::currLevel);
}
CStreaming::LoadAllRequestedModels(true);
}
FrontEndMenuManager.SetHelperText(0);
}
#endif
#ifdef MORE_LANGUAGES
void LangPolSelect(int8 action)
{
if (action == FEOPTION_ACTION_SELECT) {
FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_POLISH;
FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
FrontEndMenuManager.InitialiseChangedLanguageSettings();
FrontEndMenuManager.SaveSettings();
}
}
void LangRusSelect(int8 action)
{
if (action == FEOPTION_ACTION_SELECT) {
FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_RUSSIAN;
FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
FrontEndMenuManager.InitialiseChangedLanguageSettings();
FrontEndMenuManager.SaveSettings();
}
}
void LangJapSelect(int8 action)
{
if (action == FEOPTION_ACTION_SELECT) {
FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_JAPANESE;
FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
FrontEndMenuManager.InitialiseChangedLanguageSettings();
FrontEndMenuManager.SaveSettings();
}
}
#endif
#ifndef MULTISAMPLING
void GraphicsGoBack() {
}
#else
void GraphicsGoBack() {
FrontEndMenuManager.m_nDisplayMSAALevel = FrontEndMenuManager.m_nPrefsMSAALevel;
}
void MultiSamplingButtonPress(int8 action) {
if (action == FEOPTION_ACTION_SELECT) {
if (FrontEndMenuManager.m_nDisplayMSAALevel != FrontEndMenuManager.m_nPrefsMSAALevel) {
FrontEndMenuManager.m_nPrefsMSAALevel = FrontEndMenuManager.m_nDisplayMSAALevel;
_psSelectScreenVM(FrontEndMenuManager.m_nPrefsVideoMode);
FrontEndMenuManager.SetHelperText(0);
FrontEndMenuManager.SaveSettings();
}
} else if (action == FEOPTION_ACTION_LEFT || action == FEOPTION_ACTION_RIGHT) {
if (FrontEndMenuManager.m_bGameNotLoaded) {
FrontEndMenuManager.m_nDisplayMSAALevel += (action == FEOPTION_ACTION_RIGHT ? 1 : -1);
int i = 0;
int maxAA = RwD3D8EngineGetMaxMultiSamplingLevels();
while (maxAA != 1) {
i++;
maxAA >>= 1;
}
if (FrontEndMenuManager.m_nDisplayMSAALevel < 0)
FrontEndMenuManager.m_nDisplayMSAALevel = i;
else if (FrontEndMenuManager.m_nDisplayMSAALevel > i)
FrontEndMenuManager.m_nDisplayMSAALevel = 0;
}
} else if (action == FEOPTION_ACTION_FOCUSLOSS) {
if (FrontEndMenuManager.m_nDisplayMSAALevel != FrontEndMenuManager.m_nPrefsMSAALevel) {
FrontEndMenuManager.m_nDisplayMSAALevel = FrontEndMenuManager.m_nPrefsMSAALevel;
FrontEndMenuManager.SetHelperText(3);
}
}
}
wchar* MultiSamplingDraw(bool *disabled, bool userHovering) {
static wchar unicodeTemp[64];
if (userHovering) {
if (FrontEndMenuManager.m_nDisplayMSAALevel == FrontEndMenuManager.m_nPrefsMSAALevel) {
if (FrontEndMenuManager.m_nHelperTextMsgId == 1) // Press enter to apply
FrontEndMenuManager.ResetHelperText();
} else {
FrontEndMenuManager.SetHelperText(1);
}
} else {
if (FrontEndMenuManager.m_nDisplayMSAALevel != FrontEndMenuManager.m_nPrefsMSAALevel) {
FrontEndMenuManager.m_nDisplayMSAALevel = FrontEndMenuManager.m_nPrefsMSAALevel;
}
}
if (!FrontEndMenuManager.m_bGameNotLoaded)
*disabled = true;
switch (FrontEndMenuManager.m_nDisplayMSAALevel) {
case 0:
return TheText.Get("FEM_OFF");
default:
sprintf(gString, "%iX", 1 << (FrontEndMenuManager.m_nDisplayMSAALevel));
AsciiToUnicode(gString, unicodeTemp);
return unicodeTemp;
}
}
#endif
#ifdef IMPROVED_VIDEOMODE
const char* screenModes[] = { "FED_FLS", "FED_WND" };
void ScreenModeAfterChange(int8 before, int8 after)
{
_psSelectScreenVM(FrontEndMenuManager.m_nPrefsVideoMode); // apply same resolution
FrontEndMenuManager.SetHelperText(0);
}
#endif
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
wchar selectedJoystickUnicode[128];
wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
int numButtons;
int found = -1;
const char *joyname;
if (userHovering) {
for (int i = 0; i <= GLFW_JOYSTICK_LAST; i++) {
if ((joyname = glfwGetJoystickName(i))) {
const uint8* buttons = glfwGetJoystickButtons(i, &numButtons);
for (int j = 0; j < numButtons; j++) {
if (buttons[j]) {
found = i;
break;
}
}
if (found != -1)
break;
}
}
if (found != -1 && PSGLOBAL(joy1id) != found) {
if (PSGLOBAL(joy1id) != -1 && PSGLOBAL(joy1id) != found)
PSGLOBAL(joy2id) = PSGLOBAL(joy1id);
else
PSGLOBAL(joy2id) = -1;
strcpy(gSelectedJoystickName, joyname);
PSGLOBAL(joy1id) = found;
}
}
if (PSGLOBAL(joy1id) == -1)
AsciiToUnicode("Not found", selectedJoystickUnicode);
else
AsciiToUnicode(gSelectedJoystickName, selectedJoystickUnicode);
return selectedJoystickUnicode;
}
#endif
CMenuScreenCustom aScreens[MENUPAGES] = {
// MENUPAGE_NONE = 0
{ "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil, },
// MENUPAGE_STATS = 1
{ "FET_STA", MENUPAGE_NONE, MENUPAGE_NONE, nil, nil,
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
// MENUPAGE_NEW_GAME = 2
{ "FET_SGA", MENUPAGE_NONE, MENUPAGE_NONE, nil, nil,
MENUACTION_CHANGEMENU, "FES_SNG", { nil, SAVESLOT_NONE, MENUPAGE_NEW_GAME_RELOAD },
MENUACTION_POPULATESLOTS_CHANGEMENU, "GMLOAD", { nil, SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT },
MENUACTION_POPULATESLOTS_CHANGEMENU, "FES_DGA", { nil, SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT },
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
// MENUPAGE_BRIEFS = 3
{ "FET_BRE", MENUPAGE_NONE, MENUPAGE_NONE, nil, nil,
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
// MENUPAGE_CONTROLLER_SETTINGS = 4
{ "FET_CON", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, nil, nil,
MENUACTION_CTRLCONFIG, "FEC_CCF", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS },
MENUACTION_CTRLDISPLAY, "FEC_CDP", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS },
MENUACTION_CTRLVIBRATION, "FEC_VIB", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS },
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
// MENUPAGE_SOUND_SETTINGS = 5
{ "FET_AUD", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, nil, nil,
MENUACTION_MUSICVOLUME, "FEA_MUS", { nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS },
MENUACTION_SFXVOLUME, "FEA_SFX", { nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS },
MENUACTION_AUDIOHW, "FEA_3DH", { nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS },
MENUACTION_SPEAKERCONF, "FEA_SPK", { nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS },
MENUACTION_DYNAMICACOUSTIC, "FET_DAM", { nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS },
MENUACTION_RADIO, "FEA_RSS", { nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS },
MENUACTION_RESTOREDEF, "FET_DEF", { nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS },
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
#ifndef GRAPHICS_MENU_OPTIONS
// MENUPAGE_DISPLAY_SETTINGS = 6
{ "FET_DIS", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, nil, nil,
MENUACTION_BRIGHTNESS, "FED_BRI", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
MENUACTION_DRAWDIST, "FEM_LOD", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
MENUACTION_FRAMESYNC, "FEM_VSC", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
MENUACTION_FRAMELIMIT, "FEM_FRM", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
#ifndef EXTENDED_COLOURFILTER
MENUACTION_TRAILS, "FED_TRA", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
#endif
MENUACTION_SUBTITLES, "FED_SUB", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
MENUACTION_WIDESCREEN, "FED_WIS", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
MENUACTION_SCREENRES, "FED_RES", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
VIDEOMODE_SELECTOR
MULTISAMPLING_SELECTOR
MENUACTION_CHANGEMENU, "FET_ADV", { nil, SAVESLOT_NONE, MENUPAGE_ADVANCED_DISPLAY_SETTINGS },
MENUACTION_RESTOREDEF, "FET_DEF", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
#else
// MENUPAGE_DISPLAY_SETTINGS = 6
{ "FET_DIS", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, nil, nil,
MENUACTION_BRIGHTNESS, "FED_BRI", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
MENUACTION_DRAWDIST, "FEM_LOD", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
CUTSCENE_BORDERS_TOGGLE
FREE_CAM_TOGGLE
MENUACTION_SUBTITLES, "FED_SUB", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
MENUACTION_CFO_DYNAMIC, "FET_DEF", { new CCFODynamic(nil, nil, nil, RestoreDefDisplay) },
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
#endif
// MENUPAGE_LANGUAGE_SETTINGS = 7
{ "FET_LAN", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, nil, nil,
MENUACTION_LANG_ENG, "FEL_ENG", { nil, SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS },
MENUACTION_LANG_FRE, "FEL_FRE", { nil, SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS },
MENUACTION_LANG_GER, "FEL_GER", { nil, SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS },
MENUACTION_LANG_ITA, "FEL_ITA", { nil, SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS },
MENUACTION_LANG_SPA, "FEL_SPA", { nil, SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS },
#ifdef MORE_LANGUAGES
MENUACTION_CFO_DYNAMIC, "FEL_POL", { new CCFODynamic(nil, nil, nil, LangPolSelect) },
MENUACTION_CFO_DYNAMIC, "FEL_RUS", { new CCFODynamic(nil, nil, nil, LangRusSelect) },
MENUACTION_CFO_DYNAMIC, "FEL_JAP", { new CCFODynamic(nil, nil, nil, LangJapSelect) },
#endif
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
// MENUPAGE_CHOOSE_LOAD_SLOT = 8
{ "FET_LG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, nil, nil,
MENUACTION_CHANGEMENU, "FESZ_CA", { nil, SAVESLOT_NONE, MENUPAGE_NEW_GAME },
MENUACTION_CHECKSAVE, "FEM_SL0", { nil, SAVESLOT_1, MENUPAGE_LOAD_SLOT_CONFIRM },
MENUACTION_CHECKSAVE, "FEM_SL1", { nil, SAVESLOT_2, MENUPAGE_LOAD_SLOT_CONFIRM },
MENUACTION_CHECKSAVE, "FEM_SL2", { nil, SAVESLOT_3, MENUPAGE_LOAD_SLOT_CONFIRM },
MENUACTION_CHECKSAVE, "FEM_SL3", { nil, SAVESLOT_4, MENUPAGE_LOAD_SLOT_CONFIRM },
MENUACTION_CHECKSAVE, "FEM_SL4", { nil, SAVESLOT_5, MENUPAGE_LOAD_SLOT_CONFIRM },
MENUACTION_CHECKSAVE, "FEM_SL5", { nil, SAVESLOT_6, MENUPAGE_LOAD_SLOT_CONFIRM },
MENUACTION_CHECKSAVE, "FEM_SL6", { nil, SAVESLOT_7, MENUPAGE_LOAD_SLOT_CONFIRM },
MENUACTION_CHECKSAVE, "FEM_SL7", { nil, SAVESLOT_8, MENUPAGE_LOAD_SLOT_CONFIRM },
},
// MENUPAGE_CHOOSE_DELETE_SLOT = 9
{ "FET_DG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, nil, nil,
MENUACTION_CHANGEMENU, "FESZ_CA", { nil, SAVESLOT_NONE, MENUPAGE_NEW_GAME },
MENUACTION_CHANGEMENU, "FEM_SL0", { nil, SAVESLOT_1, MENUPAGE_DELETE_SLOT_CONFIRM },
MENUACTION_CHANGEMENU, "FEM_SL1", { nil, SAVESLOT_2, MENUPAGE_DELETE_SLOT_CONFIRM },
MENUACTION_CHANGEMENU, "FEM_SL2", { nil, SAVESLOT_3, MENUPAGE_DELETE_SLOT_CONFIRM },
MENUACTION_CHANGEMENU, "FEM_SL3", { nil, SAVESLOT_4, MENUPAGE_DELETE_SLOT_CONFIRM },
MENUACTION_CHANGEMENU, "FEM_SL4", { nil, SAVESLOT_5, MENUPAGE_DELETE_SLOT_CONFIRM },
MENUACTION_CHANGEMENU, "FEM_SL5", { nil, SAVESLOT_6, MENUPAGE_DELETE_SLOT_CONFIRM },
MENUACTION_CHANGEMENU, "FEM_SL6", { nil, SAVESLOT_7, MENUPAGE_DELETE_SLOT_CONFIRM },
MENUACTION_CHANGEMENU, "FEM_SL7", { nil, SAVESLOT_8, MENUPAGE_DELETE_SLOT_CONFIRM },
},
// MENUPAGE_NEW_GAME_RELOAD = 10
{ "FET_NG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, nil, nil,
MENUACTION_LABEL, "FESZ_QR", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_CHANGEMENU, "FEM_NO", { nil, SAVESLOT_NONE, MENUPAGE_NEW_GAME },
MENUACTION_NEWGAME, "FEM_YES", { nil, SAVESLOT_NONE, MENUPAGE_NEW_GAME_RELOAD },
},
// MENUPAGE_LOAD_SLOT_CONFIRM = 11
{ "FET_LG", MENUPAGE_CHOOSE_LOAD_SLOT, MENUPAGE_CHOOSE_LOAD_SLOT, nil, nil,
MENUACTION_LABEL, "FESZ_QL", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_CHANGEMENU, "FEM_NO", { nil, SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT },
MENUACTION_CHANGEMENU, "FEM_YES", { nil, SAVESLOT_NONE, MENUPAGE_LOADING_IN_PROGRESS },
},
// MENUPAGE_DELETE_SLOT_CONFIRM = 12
{ "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, nil, nil,
MENUACTION_LABEL, "FESZ_QD", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_CHANGEMENU, "FEM_NO", { nil, SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT },
MENUACTION_CHANGEMENU, "FEM_YES", { nil, SAVESLOT_NONE, MENUPAGE_DELETING },
},
// MENUPAGE_NO_MEMORY_CARD = 13
{ "FES_NOC", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil,
// hud adjustment page in mobile
},
// MENUPAGE_LOADING_IN_PROGRESS = 14
{ "FET_LG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil,
MENUACTION_LABEL, "FED_LDW", { nil, SAVESLOT_NONE, MENUPAGE_LOAD_SLOT_CONFIRM },
},
// MENUPAGE_DELETING_IN_PROGRESS = 15
{ "FET_DG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil,
MENUACTION_LABEL, "FEDL_WR", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
// MENUPAGE_PS2_LOAD_FAILED = 16
{ "FET_LG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil,
MENUACTION_LABEL, "FES_LOE", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
// MENUPAGE_DELETE_FAILED = 17
{ "FET_DG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil,
MENUACTION_LABEL, "FES_DEE", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_CHANGEMENU, "FEC_OKK", { nil, SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT },
},
// MENUPAGE_DEBUG_MENU = 18
{ "FED_DBG", MENUPAGE_NONE, MENUPAGE_NONE, nil, nil,
MENUACTION_RELOADIDE, "FED_RID", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_RELOADIPL, "FED_RIP", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_SETDBGFLAG, "FED_DFL", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_SWITCHBIGWHITEDEBUGLIGHT, "FED_DLS", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_PEDROADGROUPS, "FED_SPR", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_CARROADGROUPS, "FED_SCR", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_COLLISIONPOLYS, "FED_SCP", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_PARSEHEAP, "FED_PAH", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_SHOWCULL, "FED_SCZ", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_DEBUGSTREAM, "FED_DSR", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
// MENUPAGE_MEMORY_CARD_DEBUG = 19
{ "FEM_MCM", MENUPAGE_NONE, MENUPAGE_NONE, nil, nil,
MENUACTION_REGMEMCARD1, "FEM_RMC", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_TESTFORMATMEMCARD1, "FEM_TFM", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_TESTUNFORMATMEMCARD1, "FEM_TUM", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_CREATEROOTDIR, "FEM_CRD", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_CREATELOADICONS, "FEM_CLI", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_FILLWITHGUFF, "FEM_FFF", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_SAVEONLYTHEGAME, "FEM_SOG", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_SAVEGAME, "FEM_STG", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_SAVEGAMEUNDERGTA, "FEM_STS", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_CREATECOPYPROTECTED, "FEM_CPD", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
// MENUPAGE_MEMORY_CARD_TEST = 20
{ "FEM_MC2", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil,
},
// MENUPAGE_MULTIPLAYER_MAIN = 21
{ "FET_MP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil,
},
// MENUPAGE_PS2_SAVE_FAILED = 22
{ "MCDNSP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil,
MENUACTION_MEMCARDSAVECONFIRM, "JAILB_U", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
// MENUPAGE_PS2_SAVE_FAILED_2 = 23
{ "MCGNSP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil,
MENUACTION_MEMCARDSAVECONFIRM, "JAILB_U", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
// Unused in PC but anyway
// MENUPAGE_SAVE = 24
#ifdef PS2_SAVE_DIALOG
{ "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil,
MENUACTION_CHANGEMENU, "FESZ_SA", { nil, SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT },
MENUACTION_RESUME_FROM_SAVEZONE, "FESZ_CA", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
#else
{ "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil,
MENUACTION_LABEL, "FES_SCG", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_POPULATESLOTS_CHANGEMENU, "GMSAVE", { nil, SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT },
MENUACTION_RESUME_FROM_SAVEZONE, "FESZ_CA", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
#endif
// MENUPAGE_NO_MEMORY_CARD_2 = 25
{ "FES_NOC", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil,
MENUACTION_CHANGEMENU, "FESZ_CA", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
// MENUPAGE_CHOOSE_SAVE_SLOT = 26
{ "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil,
MENUACTION_RESUME_FROM_SAVEZONE, "FESZ_CA", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_CHANGEMENU, "FEM_SL1", { nil, SAVESLOT_1, MENUPAGE_SAVE_OVERWRITE_CONFIRM },
MENUACTION_CHANGEMENU, "FEM_SL2", { nil, SAVESLOT_2, MENUPAGE_SAVE_OVERWRITE_CONFIRM },
MENUACTION_CHANGEMENU, "FEM_SL3", { nil, SAVESLOT_3, MENUPAGE_SAVE_OVERWRITE_CONFIRM },
MENUACTION_CHANGEMENU, "FEM_SL4", { nil, SAVESLOT_4, MENUPAGE_SAVE_OVERWRITE_CONFIRM },
MENUACTION_CHANGEMENU, "FEM_SL5", { nil, SAVESLOT_5, MENUPAGE_SAVE_OVERWRITE_CONFIRM },
MENUACTION_CHANGEMENU, "FEM_SL6", { nil, SAVESLOT_6, MENUPAGE_SAVE_OVERWRITE_CONFIRM },
MENUACTION_CHANGEMENU, "FEM_SL7", { nil, SAVESLOT_7, MENUPAGE_SAVE_OVERWRITE_CONFIRM },
MENUACTION_CHANGEMENU, "FEM_SL8", { nil, SAVESLOT_8, MENUPAGE_SAVE_OVERWRITE_CONFIRM },
},
// MENUPAGE_SAVE_OVERWRITE_CONFIRM = 27
{ "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, nil, nil,
MENUACTION_LABEL, "FESZ_QO", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_CHANGEMENU, "FEM_YES", { nil, SAVESLOT_NONE, MENUPAGE_SAVING_IN_PROGRESS },
MENUACTION_CHANGEMENU, "FEM_NO", { nil, SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT },
},
// MENUPAGE_MULTIPLAYER_MAP = 28
{ "FET_MAP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil,
},
// MENUPAGE_MULTIPLAYER_CONNECTION = 29
{ "FET_CON", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil,
},
// MENUPAGE_MULTIPLAYER_FIND_GAME = 30
{ "FET_FG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil,
},
// MENUPAGE_MULTIPLAYER_MODE = 31
{ "FET_GT", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil,
},
// MENUPAGE_MULTIPLAYER_CREATE = 32
{ "FET_HG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil,
},
// MENUPAGE_MULTIPLAYER_START = 33
{ "FEN_STA", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil,
},
// MENUPAGE_SKIN_SELECT_OLD = 34
{ "FET_PS", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil,
},
// MENUPAGE_CONTROLLER_PC = 35
{ "FET_CTL", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, nil, nil,
MENUACTION_CTRLMETHOD, "FET_CME", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC },
MENUACTION_KEYBOARDCTRLS,"FET_RDK", { nil, SAVESLOT_NONE, MENUPAGE_KEYBOARD_CONTROLS },
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
MENUACTION_CHANGEMENU, "FEC_JOD", { nil, SAVESLOT_NONE, MENUPAGE_DETECT_JOYSTICK },
#endif
MENUACTION_CHANGEMENU, "FET_AMS", { nil, SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS },
MENUACTION_RESTOREDEF, "FET_DEF", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC },
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
// MENUPAGE_CONTROLLER_PC_OLD1 = 36
{ "FET_CTL", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, nil, nil,
MENUACTION_GETKEY, "FEC_PLB", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD1 },
MENUACTION_GETKEY, "FEC_CWL", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD1 },
MENUACTION_GETKEY, "FEC_CWR", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD1 },
MENUACTION_GETKEY, "FEC_LKT", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD1 },
MENUACTION_GETKEY, "FEC_PJP", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD1 },
MENUACTION_GETKEY, "FEC_PSP", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD1 },
MENUACTION_GETKEY, "FEC_TLF", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD1 },
MENUACTION_GETKEY, "FEC_TRG", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD1 },
MENUACTION_GETKEY, "FEC_CCM", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD1 },
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
// MENUPAGE_CONTROLLER_PC_OLD2 = 37
{ "FET_CTL", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, nil, nil,
},
// MENUPAGE_CONTROLLER_PC_OLD3 = 38
{ "FET_CTL", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, nil, nil,
MENUACTION_GETKEY, "FEC_LUP", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD3 },
MENUACTION_GETKEY, "FEC_LDN", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD3 },
MENUACTION_GETKEY, "FEC_SMS", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD3 },
MENUACTION_SHOWHEADBOB, "FEC_GSL", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC_OLD3 },
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
// MENUPAGE_CONTROLLER_PC_OLD4 = 39
{ "FET_CTL", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, nil, nil,
},
// MENUPAGE_CONTROLLER_DEBUG = 40
{ "FEC_DBG", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, nil, nil,
MENUACTION_GETKEY, "FEC_TGD", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_DEBUG },
MENUACTION_GETKEY, "FEC_TDO", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_DEBUG },
MENUACTION_GETKEY, "FEC_TSS", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_DEBUG },
MENUACTION_GETKEY, "FEC_SMS", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_DEBUG },
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
// MENUPAGE_OPTIONS = 41
{ "FET_OPT", MENUPAGE_NONE, MENUPAGE_NONE, nil, nil,
MENUACTION_CHANGEMENU, "FET_CTL", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC },
MENUACTION_LOADRADIO, "FET_AUD", { nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS },
MENUACTION_CHANGEMENU, "FET_DIS", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
#ifdef GRAPHICS_MENU_OPTIONS
MENUACTION_CHANGEMENU, "FET_GRA", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS },
#endif
MENUACTION_CHANGEMENU, "FET_LAN", { nil, SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS },
MENUACTION_PLAYERSETUP, "FET_PSU", { nil, SAVESLOT_NONE, MENUPAGE_SKIN_SELECT },
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
// MENUPAGE_EXIT = 42
{ "FET_QG", MENUPAGE_NONE, MENUPAGE_NONE, nil, nil,
MENUACTION_LABEL, "FEQ_SRE", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_DONTCANCEL, "FEM_NO", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_CANCELGAME, "FEM_YES", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
// MENUPAGE_SAVING_IN_PROGRESS = 43
{ "", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, nil, nil,
MENUACTION_LABEL, "FES_WAR", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
// MENUPAGE_SAVE_SUCCESSFUL = 44
{ "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, nil, nil,
MENUACTION_LABEL, "FES_SSC", { nil, SAVESLOT_LABEL, MENUPAGE_NONE },
MENUACTION_RESUME_FROM_SAVEZONE, "FEC_OKK", { nil, SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT },
},
// MENUPAGE_DELETING = 45
{ "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, nil, nil,
MENUACTION_LABEL, "FED_DLW", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
// MENUPAGE_DELETE_SUCCESS = 46
{ "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, nil, nil,
MENUACTION_LABEL, "DEL_FNM", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_CHANGEMENU, "FEC_OKK", { nil, SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT },
},
// MENUPAGE_SAVE_FAILED = 47
{ "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, nil, nil,
MENUACTION_LABEL, "FEC_SVU", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_CHANGEMENU, "FEC_OKK", { nil, SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT },
},
// MENUPAGE_LOAD_FAILED = 48
{ "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, nil, nil,
MENUACTION_LABEL, "FEC_SVU", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
// MENUPAGE_LOAD_FAILED_2 = 49
{ "FET_LG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, nil, nil,
MENUACTION_LABEL, "FEC_LUN", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT },
},
// MENUPAGE_FILTER_GAME = 50
{ "FIL_FLT", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil,
},
// MENUPAGE_START_MENU = 51
{ "FEM_MM", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil,
MENUACTION_CHANGEMENU, "FEN_STA", { nil, SAVESLOT_NONE, MENUPAGE_NEW_GAME },
MENUACTION_CHANGEMENU, "FET_OPT", { nil, SAVESLOT_NONE, MENUPAGE_OPTIONS },
MENUACTION_CHANGEMENU, "FEM_QT", { nil, SAVESLOT_NONE, MENUPAGE_EXIT },
},
// MENUPAGE_PAUSE_MENU = 52
{ "FET_PAU", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil,
MENUACTION_RESUME, "FEM_RES", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_CHANGEMENU, "FEN_STA", { nil, SAVESLOT_NONE, MENUPAGE_NEW_GAME },
#ifdef MENU_MAP
MENUACTION_CHANGEMENU, "FEG_MAP", { nil, SAVESLOT_NONE, MENUPAGE_MAP },
#endif
MENUACTION_CHANGEMENU, "FEP_STA", { nil, SAVESLOT_NONE, MENUPAGE_STATS },
MENUACTION_CHANGEMENU, "FEP_BRI", { nil, SAVESLOT_NONE, MENUPAGE_BRIEFS },
MENUACTION_CHANGEMENU, "FET_OPT", { nil, SAVESLOT_NONE, MENUPAGE_OPTIONS },
MENUACTION_CHANGEMENU, "FEM_QT", { nil, SAVESLOT_NONE, MENUPAGE_EXIT },
},
// MENUPAGE_CHOOSE_MODE = 53
{ "FEN_STA", MENUPAGE_NONE, MENUPAGE_NONE, nil, nil,
MENUACTION_CHANGEMENU, "FET_SP", { nil, SAVESLOT_NONE, MENUPAGE_NEW_GAME },
MENUACTION_INITMP, "FET_MP", { nil, SAVESLOT_NONE, MENUPAGE_MULTIPLAYER_MAIN },
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
// MENUPAGE_SKIN_SELECT = 54
{ "FET_PSU", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, nil, nil,
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_MULTIPLAYER_MAIN },
},
// MENUPAGE_KEYBOARD_CONTROLS = 55
{ "FET_STI", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, nil, nil,
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC },
},
// MENUPAGE_MOUSE_CONTROLS = 56
{ "FET_MTI", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, nil, nil,
MENUACTION_MOUSESENS, "FEC_MSH", { nil, SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS },
MENUACTION_INVVERT, "FEC_IVV", { nil, SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS },
MENUACTION_MOUSESTEER, "FET_MST", { nil, SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS },
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
// MENUPAGE_MISSION_RETRY = 57
#ifdef MISSION_REPLAY
{ "M_FAIL", MENUPAGE_DISABLED, MENUPAGE_DISABLED, nil, nil,
MENUACTION_LABEL, "FESZ_RM", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_CHANGEMENU, "FEM_YES", { nil, SAVESLOT_NONE, MENUPAGE_LOADING_IN_PROGRESS },
MENUACTION_REJECT_RETRY, "FEM_NO", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
#else
{ "", MENUPAGE_NONE, MENUPAGE_NONE, nil, nil,
// mission failed, wanna restart page in mobile
},
#endif
#ifdef MENU_MAP
// MENUPAGE_MAP
{ "FEG_MAP", MENUPAGE_NONE, MENUPAGE_NONE, nil, nil,
MENUACTION_UNK110, "", { nil, SAVESLOT_NONE, MENUPAGE_NONE }, // to prevent cross/enter to go back
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
#endif
#ifdef GRAPHICS_MENU_OPTIONS
// MENUPAGE_GRAPHICS_SETTINGS
{ "FET_GRA", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS,
new CCustomScreenLayout({MENUSPRITE_MAINMENU, 50, 0, 20, FONT_HEADING, FESCREEN_LEFT_ALIGN, true, MEDIUMTEXT_X_SCALE, MEDIUMTEXT_Y_SCALE}), GraphicsGoBack,
MENUACTION_SCREENRES, "FED_RES", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS },
MENUACTION_WIDESCREEN, "FED_WIS", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS },
VIDEOMODE_SELECTOR
MENUACTION_FRAMESYNC, "FEM_VSC", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
MENUACTION_FRAMELIMIT, "FEM_FRM", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
MULTISAMPLING_SELECTOR
#ifdef EXTENDED_COLOURFILTER
POSTFX_SELECTORS
#else
MENUACTION_TRAILS, "FED_TRA", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
#endif
#ifdef EXTENDED_PIPELINES
PIPELINES_SELECTOR
#endif
ISLAND_LOADING_SELECTOR
DUALPASS_SELECTOR
MENUACTION_CFO_DYNAMIC, "FET_DEF", { new CCFODynamic(nil, nil, nil, RestoreDefGraphics) },
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
#else
// MENUPAGE_ADVANCED_DISPLAY_SETTINGS
{ "FET_ADV", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS,
new CCustomScreenLayout({MENUSPRITE_MAINMENU, 50, 0, 20, FONT_HEADING, FESCREEN_LEFT_ALIGN, true, MEDIUMTEXT_X_SCALE, MEDIUMTEXT_Y_SCALE}), nil,
ISLAND_LOADING_SELECTOR
DUALPASS_SELECTOR
CUTSCENE_BORDERS_TOGGLE
FREE_CAM_TOGGLE
#ifdef EXTENDED_COLOURFILTER
POSTFX_SELECTORS
#endif
#ifdef EXTENDED_PIPELINES
PIPELINES_SELECTOR
#endif
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
#endif
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
// MENUPAGE_DETECT_JOYSTICK
{ "FEC_JOD", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC,
new CCustomScreenLayout({MENUSPRITE_MAINMENU, 40, 60, 20, FONT_BANK, FESCREEN_LEFT_ALIGN, false, MEDIUMTEXT_X_SCALE, MEDIUMTEXT_Y_SCALE}), nil,
MENUACTION_LABEL, "FEC_JPR", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
MENUACTION_CFO_DYNAMIC, "FEC_JDE", { new CCFODynamic(nil, nil, DetectJoystickDraw, nil) },
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
},
#endif
// MENUPAGE_UNK
{ "", MENUPAGE_NONE, MENUPAGE_NONE, nil, nil,
},
};
#endif
#endif

View File

@ -212,10 +212,10 @@ enum Config {
# define TIMEBARS // print debug timers
#endif
#define FIX_BUGS // fixes bugs that we've came across during reversing, TODO: use this more
#define FIX_BUGS // fixes bugs that we've came across during reversing
#define MORE_LANGUAGES // Add more translations to the game
#define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible
#define LOAD_INI_SETTINGS
#define LOAD_INI_SETTINGS // as the name suggests. fundamental for CUSTOM_FRONTEND_OPTIONS
// Rendering/display
//#define EXTRA_MODEL_FLAGS // from mobile to optimize rendering
@ -227,16 +227,10 @@ enum Config {
#define PS2_ALPHA_TEST // emulate ps2 alpha test
#define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number
#define DISABLE_LOADING_SCREEN // disable the loading screen which vastly improves the loading time
#define NO_ISLAND_LOADING // disable loadscreen between islands via loading all island data at once, consumes more memory and CPU
//#define USE_TEXTURE_POOL
#define CUTSCENE_BORDERS_SWITCH
#ifdef LIBRW
//#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur)
//#define EXTENDED_PIPELINES // custom render pipelines (includes Neo)
#define MULTISAMPLING // adds MSAA option
#ifdef LIBRW
// these are not supported with librw yet
# undef MULTISAMPLING
#endif
// Particle
@ -256,6 +250,7 @@ enum Config {
#define ALT_DODO_CHEAT
#define REGISTER_START_BUTTON
//#define BIND_VEHICLE_FIREWEAPON // Adds ability to rebind fire key for 'in vehicle' controls
#define BUTTON_ICONS // use textures to show controller buttons
// Hud, frontend and radar
#define HUD_ENHANCEMENTS // Adjusts some aspects to make the HUD look/behave a little bit better.
@ -274,7 +269,13 @@ enum Config {
//# define PS2_LIKE_MENU // An effort to recreate PS2 menu, cycling through tabs, different bg etc.
//# define PS2_SAVE_DIALOG // PS2 style save dialog with transparent black box
# define CUSTOM_FRONTEND_OPTIONS
# define GRAPHICS_MENU_OPTIONS // otherwise Advanced Options menu will appear if Display is full
# ifdef CUSTOM_FRONTEND_OPTIONS
# define GRAPHICS_MENU_OPTIONS // otherwise Advanced Options menu will appear if Display is full
# define NO_ISLAND_LOADING // disable loadscreen between islands via loading all island data at once, consumes more memory and CPU
# define CUTSCENE_BORDERS_SWITCH
# define MULTISAMPLING // adds MSAA option
# endif
#endif
// Script
@ -323,6 +324,8 @@ enum Config {
#endif
//#define PS2_AUDIO // changes audio paths for cutscenes and radio to PS2 paths, needs vbdec to support VB with MSS
// IMG
#define BIG_IMG // allows to read larger img files
//#define SQUEEZE_PERFORMANCE
#ifdef SQUEEZE_PERFORMANCE
@ -331,3 +334,8 @@ enum Config {
#define PC_PARTICLE
#define VC_PED_PORTS // To not process collisions always. But should be tested if that's really beneficial
#endif
#ifdef LIBRW
// these are not supported with librw yet
# undef MULTISAMPLING
#endif

View File

@ -64,6 +64,7 @@
#include "debugmenu.h"
#include "Clock.h"
#include "custompipes.h"
#include "frontendoption.h"
GlobalScene Scene;
@ -404,6 +405,13 @@ Initialise3D(void *param)
DebugMenuInit();
DebugMenuPopulate();
#endif // !DEBUGMENU
#ifdef CUSTOM_FRONTEND_OPTIONS
// Apparently this func. can be run multiple times at the start.
if (numCustomFrontendOptions == 0 && numCustomFrontendScreens == 0) {
// needs stored language and TheText to be loaded, and last TheText reload is at the start of here
CustomFrontendOptionsPopulate();
}
#endif
bool ret = CGame::InitialiseRenderWare();
#ifdef EXTENDED_PIPELINES
CustomPipes::CustomPipeInit(); // need Scene.world for this

View File

@ -1,7 +1,6 @@
#include <csignal>
#define WITHWINDOWS
#include "common.h"
#include "platform.h"
#include "crossplatform.h"
#include "Renderer.h"
#include "Credits.h"
@ -16,7 +15,6 @@
#include "Boat.h"
#include "Heli.h"
#include "Automobile.h"
#include "Ped.h"
#include "Console.h"
#include "Debug.h"
#include "Hud.h"
@ -26,10 +24,8 @@
#include "Radar.h"
#include "debugmenu.h"
#include "Frontend.h"
#include "Text.h"
#include "WaterLevel.h"
#include "main.h"
#include "MBlur.h"
#include "postfx.h"
#include "custompipes.h"
@ -76,388 +72,59 @@ mysrand(unsigned int seed)
#ifdef CUSTOM_FRONTEND_OPTIONS
#include "frontendoption.h"
#include "Font.h"
void ReloadFrontendOptions(void)
{
CustomFrontendOptionsPopulate();
}
void RestoreDefGraphics(int8 action) {
if (action != FEOPTION_ACTION_SELECT)
return;
#ifdef PS2_ALPHA_TEST
gPS2alphaTest = false;
#endif
#ifdef MULTISAMPLING
FrontEndMenuManager.m_nPrefsMSAALevel = FrontEndMenuManager.m_nDisplayMSAALevel = 0;
#endif
#ifdef GRAPHICS_MENU_OPTIONS // otherwise Frontend will handle those
CMenuManager::m_PrefsFrameLimiter = true;
CMenuManager::m_PrefsVsyncDisp = true;
CMenuManager::m_PrefsVsync = true;
CMenuManager::m_PrefsUseWideScreen = false;
FrontEndMenuManager.m_nDisplayVideoMode = FrontEndMenuManager.m_nPrefsVideoMode;
#ifdef GTA3_1_1_PATCH
if (_dwOperatingSystemVersion == OS_WIN98) {
CMBlur::BlurOn = false;
CMBlur::MotionBlurClose();
} else {
CMBlur::BlurOn = true;
CMBlur::MotionBlurOpen(Scene.camera);
}
#else
CMBlur::BlurOn = true;
#endif
FrontEndMenuManager.SaveSettings();
#endif
}
void RestoreDefDisplay(int8 action) {
if (action != FEOPTION_ACTION_SELECT)
return;
#ifdef CUTSCENE_BORDERS_SWITCH
CMenuManager::m_PrefsCutsceneBorders = true;
#endif
#ifdef FREE_CAM
TheCamera.bFreeCam = false;
#endif
#ifdef GRAPHICS_MENU_OPTIONS // otherwise Frontend will handle those
CMenuManager::m_PrefsBrightness = 256;
CMenuManager::m_PrefsLOD = 1.2f;
CRenderer::ms_lodDistScale = 1.2f;
CMenuManager::m_PrefsShowSubtitles = true;
FrontEndMenuManager.SaveSettings();
#endif
}
#ifdef MULTISAMPLING
void MultiSamplingGoBack() {
FrontEndMenuManager.m_nDisplayMSAALevel = FrontEndMenuManager.m_nPrefsMSAALevel;
}
void MultiSamplingButtonPress(int8 action) {
if (action == FEOPTION_ACTION_SELECT) {
if (FrontEndMenuManager.m_nDisplayMSAALevel != FrontEndMenuManager.m_nPrefsMSAALevel) {
FrontEndMenuManager.m_nPrefsMSAALevel = FrontEndMenuManager.m_nDisplayMSAALevel;
_psSelectScreenVM(FrontEndMenuManager.m_nPrefsVideoMode);
FrontEndMenuManager.SetHelperText(0);
FrontEndMenuManager.SaveSettings();
}
} else if (action == FEOPTION_ACTION_LEFT || action == FEOPTION_ACTION_RIGHT) {
if (FrontEndMenuManager.m_bGameNotLoaded) {
FrontEndMenuManager.m_nDisplayMSAALevel += (action == FEOPTION_ACTION_RIGHT ? 1 : -1);
int i = 0;
int maxAA = RwD3D8EngineGetMaxMultiSamplingLevels();
while (maxAA != 1) {
i++;
maxAA >>= 1;
}
if (FrontEndMenuManager.m_nDisplayMSAALevel < 0)
FrontEndMenuManager.m_nDisplayMSAALevel = i;
else if (FrontEndMenuManager.m_nDisplayMSAALevel > i)
FrontEndMenuManager.m_nDisplayMSAALevel = 0;
}
} else if (action == FEOPTION_ACTION_FOCUSLOSS) {
if (FrontEndMenuManager.m_nDisplayMSAALevel != FrontEndMenuManager.m_nPrefsMSAALevel) {
FrontEndMenuManager.m_nDisplayMSAALevel = FrontEndMenuManager.m_nPrefsMSAALevel;
FrontEndMenuManager.SetHelperText(3);
}
}
}
wchar* MultiSamplingDraw(bool *disabled, bool userHovering) {
static wchar unicodeTemp[64];
if (userHovering) {
if (FrontEndMenuManager.m_nDisplayMSAALevel == FrontEndMenuManager.m_nPrefsMSAALevel) {
if (FrontEndMenuManager.m_nHelperTextMsgId == 1) // Press enter to apply
FrontEndMenuManager.ResetHelperText();
} else {
FrontEndMenuManager.SetHelperText(1);
}
} else {
if (FrontEndMenuManager.m_nDisplayMSAALevel != FrontEndMenuManager.m_nPrefsMSAALevel) {
FrontEndMenuManager.m_nDisplayMSAALevel = FrontEndMenuManager.m_nPrefsMSAALevel;
}
}
if (!FrontEndMenuManager.m_bGameNotLoaded)
*disabled = true;
switch (FrontEndMenuManager.m_nDisplayMSAALevel) {
case 0:
return TheText.Get("FEM_OFF");
default:
sprintf(gString, "%iX", 1 << (FrontEndMenuManager.m_nDisplayMSAALevel));
AsciiToUnicode(gString, unicodeTemp);
return unicodeTemp;
}
}
const char* multisamplingKey = "MultiSampling";
#endif
#ifdef MORE_LANGUAGES
void LangPolSelect(int8 action)
{
if (action == FEOPTION_ACTION_SELECT) {
FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_POLISH;
FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
FrontEndMenuManager.InitialiseChangedLanguageSettings();
FrontEndMenuManager.SaveSettings();
}
}
void LangRusSelect(int8 action)
{
if (action == FEOPTION_ACTION_SELECT) {
FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_RUSSIAN;
FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
FrontEndMenuManager.InitialiseChangedLanguageSettings();
FrontEndMenuManager.SaveSettings();
}
}
void LangJapSelect(int8 action)
{
if (action == FEOPTION_ACTION_SELECT) {
FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_JAPANESE;
FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
FrontEndMenuManager.InitialiseChangedLanguageSettings();
FrontEndMenuManager.SaveSettings();
}
}
#endif
#ifdef IMPROVED_VIDEOMODE
void ScreenModeChange(int8 displayedValue)
{
if (displayedValue != FrontEndMenuManager.m_nPrefsWindowed) {
FrontEndMenuManager.m_nPrefsWindowed = displayedValue;
_psSelectScreenVM(FrontEndMenuManager.m_nPrefsVideoMode); // apply same resolution
FrontEndMenuManager.SetHelperText(0);
FrontEndMenuManager.SaveSettings();
}
}
#endif
#ifdef FREE_CAM
void FreeCamChange(int8 displayedValue)
{
TheCamera.bFreeCam = !!displayedValue;
FrontEndMenuManager.SaveSettings();
}
const char* freeCamKey = "FreeCam";
#endif
#ifdef CUTSCENE_BORDERS_SWITCH
void BorderModeChange(int8 displayedValue)
{
CMenuManager::m_PrefsCutsceneBorders = !!displayedValue;
FrontEndMenuManager.SaveSettings();
}
const char* cutsceneBordersKey = "CutsceneBorders";
#endif
#ifdef PS2_ALPHA_TEST
void PS2AlphaTestChange(int8 displayedValue)
{
gPS2alphaTest = !!displayedValue;
FrontEndMenuManager.SaveSettings();
}
const char* ps2alphaKey = "PS2AlphaTest";
#endif
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
wchar selectedJoystickUnicode[128];
wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
int numButtons;
int found = -1;
const char *joyname;
if (userHovering) {
for (int i = 0; i <= GLFW_JOYSTICK_LAST; i++) {
if ((joyname = glfwGetJoystickName(i))) {
const uint8* buttons = glfwGetJoystickButtons(i, &numButtons);
for (int j = 0; j < numButtons; j++) {
if (buttons[j]) {
found = i;
break;
}
}
if (found != -1)
break;
}
}
if (found != -1 && PSGLOBAL(joy1id) != found) {
if (PSGLOBAL(joy1id) != -1 && PSGLOBAL(joy1id) != found)
PSGLOBAL(joy2id) = PSGLOBAL(joy1id);
else
PSGLOBAL(joy2id) = -1;
strcpy(gSelectedJoystickName, joyname);
PSGLOBAL(joy1id) = found;
}
}
if (PSGLOBAL(joy1id) == -1)
AsciiToUnicode("Not found", selectedJoystickUnicode);
else
AsciiToUnicode(gSelectedJoystickName, selectedJoystickUnicode);
return selectedJoystickUnicode;
}
#endif
// Important: Make sure to read the warnings/informations in frontendoption.h!!
// If you will hardcode any text, please use AllocUnicode! wchar_t size differs between platforms
void
CustomFrontendOptionsPopulate(void)
{
RemoveCustomFrontendOptions(); // if exist
// -- Graphics/display seperation preperation starts - don't add options in here!
#ifdef GRAPHICS_MENU_OPTIONS
int graphicsMenu = FrontendScreenAdd("FET_GRA", MENUSPRITE_MAINMENU, MENUPAGE_OPTIONS, 50, 0, 20,
FONT_HEADING, MEDIUMTEXT_X_SCALE, MEDIUMTEXT_Y_SCALE, FESCREEN_LEFT_ALIGN, true);
int newDisplayMenu = FrontendScreenAdd("FET_DIS", MENUSPRITE_MAINMENU, MENUPAGE_OPTIONS, 50, 0, 20,
FONT_HEADING, MEDIUMTEXT_X_SCALE, MEDIUMTEXT_Y_SCALE, FESCREEN_LEFT_ALIGN, true);
FrontendOptionSetCursor(MENUPAGE_OPTIONS, 2, true);
FrontendOptionAddRedirect(TheText.Get("FET_DIS"), newDisplayMenu, 0);
FrontendOptionSetCursor(MENUPAGE_OPTIONS, 3);
FrontendOptionAddRedirect(TheText.Get("FET_GRA"), graphicsMenu, 0);
#define SWITCH_TO_GRAPHICS_MENU FrontendOptionSetCursor(graphicsMenu, -1);
#define SWITCH_TO_DISPLAY_MENU FrontendOptionSetCursor(newDisplayMenu, -1);
#define CLONE_OPTION(a, b, c, d) FrontendOptionAddBuiltinAction(a, b, c, d);
#define ADD_BACK FrontendOptionAddBackButton(TheText.Get("FEDS_TB"));
#define ADD_RESTORE_DEFAULTS(a) FrontendOptionAddDynamic(TheText.Get("FET_DEF"), nil, nil, a, nil);
#else
int advancedDisplayMenu = FrontendScreenAdd("FET_ADV", MENUSPRITE_MAINMENU, MENUPAGE_DISPLAY_SETTINGS, 50, 0, 20,
FONT_HEADING, MEDIUMTEXT_X_SCALE, MEDIUMTEXT_Y_SCALE, FESCREEN_LEFT_ALIGN, true);
bool movedToAdvMenu = false;
#define SWITCH_TO_GRAPHICS_MENU \
if (GetNumberOfMenuOptions(MENUPAGE_DISPLAY_SETTINGS) >= 12) { \
FrontendOptionSetCursor(advancedDisplayMenu, -1); \
movedToAdvMenu = true; \
} else { \
FrontendOptionSetCursor(MENUPAGE_DISPLAY_SETTINGS, -3); \
}
#define SWITCH_TO_DISPLAY_MENU SWITCH_TO_GRAPHICS_MENU
#define CLONE_OPTION(a, b, c, d)
#define ADD_BACK
#define ADD_RESTORE_DEFAULTS(a)
#endif
// -- Graphics/display seperation preperation end
const wchar* off_on[] = { TheText.Get("FEM_OFF"), TheText.Get("FEM_ON") };
#ifdef MORE_LANGUAGES
FrontendOptionSetCursor(MENUPAGE_LANGUAGE_SETTINGS, -2);
FrontendOptionAddDynamic(TheText.Get("FEL_POL"), nil, nil, LangPolSelect, nil);
FrontendOptionAddDynamic(TheText.Get("FEL_RUS"), nil, nil, LangRusSelect, nil);
FrontendOptionAddDynamic(TheText.Get("FEL_JAP"), nil, nil, LangJapSelect, nil);
#endif
#ifdef MENU_MAP
FrontendOptionSetCursor(MENUPAGE_PAUSE_MENU, 2);
FrontendOptionAddRedirect(TheText.Get("FEG_MAP"), MENUPAGE_MAP);
#endif
// -- Start of graphics menu - add options in display order!
SWITCH_TO_GRAPHICS_MENU
CLONE_OPTION(TheText.Get("FED_RES"), MENUACTION_SCREENRES, nil, nil);
CLONE_OPTION(TheText.Get("FED_WIS"), MENUACTION_WIDESCREEN, nil, nil)
#ifdef IMPROVED_VIDEOMODE
const wchar* screenModes[] = { TheText.Get("FED_FLS"), TheText.Get("FED_WND") };
// Storing isn't enabled because it's handled in Frontend
FrontendOptionAddSelect(TheText.Get("FEM_SCF"), screenModes, 2, (int8*)&FrontEndMenuManager.m_nPrefsWindowed, true, ScreenModeChange, nil);
#endif
CLONE_OPTION(TheText.Get("FEM_VSC"), MENUACTION_FRAMESYNC, nil, nil);
CLONE_OPTION(TheText.Get("FEM_FRM"), MENUACTION_FRAMELIMIT, nil, nil);
#ifdef MULTISAMPLING
SWITCH_TO_GRAPHICS_MENU
FrontendOptionAddDynamic(TheText.Get("FED_AAS"), MultiSamplingDraw, (int8*)&FrontEndMenuManager.m_nPrefsMSAALevel, MultiSamplingButtonPress, MultiSamplingGoBack, multisamplingKey);
#endif
CLONE_OPTION(TheText.Get("FED_TRA"), MENUACTION_TRAILS, nil, nil);
#ifdef PS2_ALPHA_TEST
SWITCH_TO_GRAPHICS_MENU
FrontendOptionAddSelect(TheText.Get("FEM_2PR"), off_on, 2, (int8*)&gPS2alphaTest, false, PS2AlphaTestChange, nil, ps2alphaKey);
#endif
ADD_RESTORE_DEFAULTS(RestoreDefGraphics)
ADD_BACK
// ---- End of Graphics Menu ----
// -- Start of Display menu - add options in display order!
SWITCH_TO_DISPLAY_MENU
CLONE_OPTION(TheText.Get("FED_BRI"), MENUACTION_BRIGHTNESS, nil, nil);
CLONE_OPTION(TheText.Get("FEM_LOD"), MENUACTION_DRAWDIST, nil, nil);
#ifdef CUTSCENE_BORDERS_SWITCH
SWITCH_TO_DISPLAY_MENU
FrontendOptionAddSelect(TheText.Get("FEM_CSB"), off_on, 2, (int8 *)&CMenuManager::m_PrefsCutsceneBorders, false, BorderModeChange, nil, cutsceneBordersKey);
#endif
#ifdef FREE_CAM
SWITCH_TO_DISPLAY_MENU
FrontendOptionAddSelect(TheText.Get("FEC_FRC"), off_on, 2, (int8*)&TheCamera.bFreeCam, false, FreeCamChange, nil, freeCamKey);
#endif
CLONE_OPTION(TheText.Get("FED_SUB"), MENUACTION_SUBTITLES, nil, nil);
// Add link to advanced graphics menu if it's filled.
#ifndef GRAPHICS_MENU_OPTIONS
if (movedToAdvMenu) {
FrontendOptionSetCursor(MENUPAGE_DISPLAY_SETTINGS, -3);
FrontendOptionAddRedirect(TheText.Get("FET_ADV"), advancedDisplayMenu, 0);
FrontendOptionSetCursor(advancedDisplayMenu, -1);
FrontendOptionAddBackButton(TheText.Get("FEDS_TB"));
}
#endif
ADD_RESTORE_DEFAULTS(RestoreDefDisplay)
ADD_BACK
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
int detectJoystickMenu = FrontendScreenAdd("FEC_JOD", MENUSPRITE_MAINMENU, MENUPAGE_CONTROLLER_PC, 40, 60, 20,
FONT_BANK, MEDIUMTEXT_X_SCALE, MEDIUMTEXT_Y_SCALE, FESCREEN_LEFT_ALIGN, false);
FrontendOptionSetCursor(detectJoystickMenu, 0);
FrontendOptionAddBuiltinAction(TheText.Get("FEC_JPR"), MENUACTION_LABEL, nil, nil);
FrontendOptionAddDynamic(TheText.Get("FEC_JDE"), DetectJoystickDraw, nil, nil, nil);
FrontendOptionAddBackButton(TheText.Get("FEDS_TB"));
FrontendOptionSetCursor(MENUPAGE_CONTROLLER_PC, 2);
FrontendOptionAddRedirect(TheText.Get("FEC_JOD"), detectJoystickMenu, 1);
#endif
// Moved to an array in MenuScreensCustom.cpp, but APIs are still available. see frontendoption.h
}
#endif
#ifdef LOAD_INI_SETTINGS
#include "ini_parser.hpp"
linb::ini cfg;
int CheckAndReadIniInt(const char *cat, const char *key, int original)
{
const char *value = (cfg.get(cat, key, "").c_str());
if (value && value[0] != '\0')
return atoi(value);
return original;
}
float CheckAndReadIniFloat(const char *cat, const char *key, float original)
{
const char *value = (cfg.get(cat, key, "").c_str());
if (value && value[0] != '\0')
return atof(value);
return original;
}
void CheckAndSaveIniInt(const char *cat, const char *key, int val, bool &changed)
{
char temp[10];
if (atoi(cfg.get(cat, key, "xxx").c_str()) != val) { // if .ini doesn't have our key, compare with xxx and forcefully add it
changed = true;
sprintf(temp, "%u", val);
cfg.set(cat, key, temp);
}
}
void CheckAndSaveIniFloat(const char *cat, const char *key, float val, bool &changed)
{
char temp[10];
if (atof(cfg.get(cat, key, "xxx").c_str()) != val) { // if .ini doesn't have our key, compare with xxx and forcefully add it
changed = true;
sprintf(temp, "%f", val);
cfg.set(cat, key, temp);
}
}
void LoadINISettings()
{
linb::ini cfg;
cfg.load_file("re3.ini");
char defaultStr[4];
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
// Written by assuming the codes below will run after _InputInitialiseJoys().
@ -491,28 +158,38 @@ void LoadINISettings()
#endif
#ifdef CUSTOM_FRONTEND_OPTIONS
for (int i = 0; i < numCustomFrontendOptions; i++) {
FrontendOption& option = customFrontendOptions[i];
if (option.save) {
// CFO only supports saving uint8 right now
sprintf(defaultStr, "%u", *option.value);
option.lastSavedValue = option.displayedValue = *option.value = atoi(cfg.get("FrontendOptions", option.save, defaultStr).c_str());
for (int i = 0; i < MENUPAGES; i++) {
for (int j = 0; j < NUM_MENUROWS; j++) {
CMenuScreenCustom::CMenuEntry &option = aScreens[i].m_aEntries[j];
if (option.m_Action == MENUACTION_NOTHING)
break;
// CFO check
if (option.m_Action < MENUACTION_NOTHING && option.m_CFO->save) {
// CFO only supports saving uint8 right now
*option.m_CFO->value = CheckAndReadIniInt("FrontendOptions", option.m_CFO->save, *option.m_CFO->value);
if (option.m_Action == MENUACTION_CFO_SELECT) {
option.m_CFOSelect->lastSavedValue = option.m_CFOSelect->displayedValue = *option.m_CFO->value;
}
}
}
}
#endif
#ifdef NO_ISLAND_LOADING
sprintf(defaultStr, "%u", CMenuManager::m_PrefsIslandLoading);
CMenuManager::m_PrefsIslandLoading = atoi(cfg.get("FrontendOptions", "NoIslandLoading", defaultStr).c_str());
CMenuManager::m_DisplayIslandLoading = CMenuManager::m_PrefsIslandLoading;
#ifdef EXTENDED_COLOURFILTER
CPostFX::Intensity = CheckAndReadIniFloat("CustomPipesValues", "PostFXIntensity", CPostFX::Intensity);
#endif
#ifdef EXTENDED_PIPELINES
CustomPipes::VehicleShininess = CheckAndReadIniFloat("CustomPipesValues", "NeoVehicleShininess", CustomPipes::VehicleShininess);
CustomPipes::VehicleSpecularity = CheckAndReadIniFloat("CustomPipesValues", "NeoVehicleSpecularity", CustomPipes::VehicleSpecularity);
CustomPipes::RimlightMult = CheckAndReadIniFloat("CustomPipesValues", "RimlightMult", CustomPipes::RimlightMult);
CustomPipes::LightmapMult = CheckAndReadIniFloat("CustomPipesValues", "LightmapMult", CustomPipes::LightmapMult);
CustomPipes::GlossMult = CheckAndReadIniFloat("CustomPipesValues", "GlossMult", CustomPipes::GlossMult);
#endif
}
void SaveINISettings()
{
linb::ini cfg;
cfg.load_file("re3.ini");
bool changed = false;
char temp[4];
@ -523,23 +200,29 @@ void SaveINISettings()
}
#endif
#ifdef CUSTOM_FRONTEND_OPTIONS
for (int i = 0; i < numCustomFrontendOptions; i++) {
FrontendOption &option = customFrontendOptions[i];
if (option.save) {
if (atoi(cfg.get("FrontendOptions", option.save, "xxx").c_str()) != *option.value) { // if .ini doesn't have that key compare with xxx, so we can add it
changed = true;
sprintf(temp, "%u", *option.value);
cfg.set("FrontendOptions", option.save, temp);
for (int i = 0; i < MENUPAGES; i++) {
for (int j = 0; j < NUM_MENUROWS; j++) {
CMenuScreenCustom::CMenuEntry &option = aScreens[i].m_aEntries[j];
if (option.m_Action == MENUACTION_NOTHING)
break;
if (option.m_Action < MENUACTION_NOTHING && option.m_CFO->save) {
// Beware: CFO only supports saving uint8 right now
CheckAndSaveIniInt("FrontendOptions", option.m_CFO->save, *option.m_CFO->value, changed);
}
}
}
#endif
#ifdef NO_ISLAND_LOADING
if (atoi(cfg.get("FrontendOptions", "NoIslandLoading", "xxx").c_str()) != CMenuManager::m_PrefsIslandLoading) {
changed = true;
sprintf(temp, "%u", CMenuManager::m_PrefsIslandLoading);
cfg.set("FrontendOptions", "NoIslandLoading", temp);
}
#ifdef EXTENDED_COLOURFILTER
CheckAndSaveIniFloat("CustomPipesValues", "PostFXIntensity", CPostFX::Intensity, changed);
#endif
#ifdef EXTENDED_PIPELINES
CheckAndSaveIniFloat("CustomPipesValues", "NeoVehicleShininess", CustomPipes::VehicleShininess, changed);
CheckAndSaveIniFloat("CustomPipesValues", "NeoVehicleSpecularity", CustomPipes::VehicleSpecularity, changed);
CheckAndSaveIniFloat("CustomPipesValues", "RimlightMult", CustomPipes::RimlightMult, changed);
CheckAndSaveIniFloat("CustomPipesValues", "LightmapMult", CustomPipes::LightmapMult, changed);
CheckAndSaveIniFloat("CustomPipesValues", "GlossMult", CustomPipes::GlossMult, changed);
#endif
if (changed)
@ -888,9 +571,6 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Debug", "Catalina Fly Away", CHeli::MakeCatalinaHeliFlyAway);
DebugMenuAddVarBool8("Debug", "Script Heli On", &CHeli::ScriptHeliOn, nil);
#ifdef CUSTOM_FRONTEND_OPTIONS
DebugMenuAddCmd("Debug", "Reload custom frontend options", ReloadFrontendOptions);
#endif
DebugMenuAddVarBool8("Debug", "Toggle popping heads on headshot", &CPed::bPopHeadsOnHeadshot, nil);
DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start);
DebugMenuAddCmd("Debug", "Stop Credits", CCredits::Stop);

View File

@ -1,20 +1,14 @@
#include "common.h"
#ifdef CUSTOM_FRONTEND_OPTIONS
#include "frontendoption.h"
#include "Frontend.h"
#include "Text.h"
int numCustomFrontendOptions = 0;
FrontendOption *customFrontendOptions;
int numCustomFrontendScreens = 0;
FrontendScreen* customFrontendScreens;
int numFrontendOptionReplacements = 0;
CMenuScreen::CMenuEntry* frontendOptionReplacements;
int lastOgScreen = MENUPAGES; // means no new pages
int numCustomFrontendOptions = 0;
int numCustomFrontendScreens = 0;
int optionCursor = -2;
int currentMenu;
bool optionOverwrite = false;
@ -32,8 +26,7 @@ void GoBack(bool fadeIn)
{
int screen = !FrontEndMenuManager.m_bGameNotLoaded ?
aScreens[FrontEndMenuManager.m_nCurrScreen].m_PreviousPage[1] : aScreens[FrontEndMenuManager.m_nCurrScreen].m_PreviousPage[0];
int option = !FrontEndMenuManager.m_bGameNotLoaded ?
aScreens[FrontEndMenuManager.m_nCurrScreen].m_ParentEntry[1] : aScreens[FrontEndMenuManager.m_nCurrScreen].m_ParentEntry[0];
int option = FrontEndMenuManager.GetPreviousPageOption();
FrontEndMenuManager.ThingsToDoBeforeGoingBack();
@ -58,7 +51,7 @@ GetLastMenuScreen()
{
int8 page = -1;
for (int i = 0; i < MENUPAGES; i++) {
if (strcmp(aScreens[i].m_ScreenName, "") == 0 && aScreens[i].unk == 0)
if (strcmp(aScreens[i].m_ScreenName, "") == 0 && aScreens[i].m_PreviousPage[0] == MENUPAGE_NONE)
break;
++page;
@ -66,89 +59,23 @@ GetLastMenuScreen()
return page;
}
// Used before populating options, but effective in InitialiseChangedLanguageSettings and debugmenu
void
RemoveCustomFrontendOptions()
{
if (numCustomFrontendOptions != 0) {
for (int i = 0; i < MENUPAGES; i++) {
for (int j = 0; j < NUM_MENUROWS; j++) {
if (aScreens[i].m_aEntries[j].m_SaveSlot == SAVESLOT_CFO) {
int ogOptionId = customFrontendOptions[aScreens[i].m_aEntries[j].m_TargetMenu].ogOptionId;
if (customFrontendOptions[aScreens[i].m_aEntries[j].m_TargetMenu].type == FEOPTION_SELECT)
free(customFrontendOptions[aScreens[i].m_aEntries[j].m_TargetMenu].rightTexts);
if (ogOptionId == -1) {
int k;
for (k = j; k < NUM_MENUROWS - 1; k++) {
memcpy(&aScreens[i].m_aEntries[k], &aScreens[i].m_aEntries[k + 1], sizeof(CMenuScreen::CMenuEntry));
}
aScreens[i].m_aEntries[k].m_Action = MENUACTION_NOTHING;
aScreens[i].m_aEntries[k].m_SaveSlot = SAVESLOT_NONE;
aScreens[i].m_aEntries[k].m_EntryName[0] = '\0';
j--;
} else {
memcpy(&aScreens[i].m_aEntries[j], &frontendOptionReplacements[ogOptionId], sizeof(CMenuScreen::CMenuEntry));
}
}
}
}
free(customFrontendOptions);
numCustomFrontendOptions = 0;
if (numFrontendOptionReplacements != 0) {
free(frontendOptionReplacements);
numFrontendOptionReplacements = 0;
}
}
if (numCustomFrontendScreens == 0)
return;
for (int i = 0; i < MENUPAGES; i++) {
if (i > lastOgScreen) {
aScreens[i].m_ScreenName[0] = '\0';
aScreens[i].unk = 0;
}
}
free(customFrontendScreens);
numCustomFrontendScreens = 0;
lastOgScreen = MENUPAGES;
}
int8 RegisterNewScreen(const char *name, int prevPage)
int8 RegisterNewScreen(const char *name, int prevPage, ReturnPrevPageFunc returnPrevPageFunc)
{
if (lastOgScreen == MENUPAGES)
lastOgScreen = GetLastMenuScreen();
numCustomFrontendScreens++;
if (numCustomFrontendScreens == 1)
customFrontendScreens = (FrontendScreen*)malloc(5 * sizeof(FrontendScreen));
else if (numCustomFrontendScreens % 5 == 1)
customFrontendScreens = (FrontendScreen*)realloc(customFrontendScreens, (numCustomFrontendScreens + 4) * sizeof(FrontendScreen));
assert(customFrontendScreens != nil && "Custom frontend screens can't be allocated");
int id = lastOgScreen + numCustomFrontendScreens;
assert(id < MENUPAGES && "No room for new custom frontend screens! Increase MENUPAGES");
strncpy(aScreens[id].m_ScreenName, name, 8);
aScreens[id].m_PreviousPage[0] = aScreens[id].m_PreviousPage[1] = prevPage;
aScreens[id].unk = 1;
aScreens[id].returnPrevPageFunc = returnPrevPageFunc;
return id;
}
int8 RegisterNewOption()
{
numCustomFrontendOptions++;
if (numCustomFrontendOptions == 1)
customFrontendOptions = (FrontendOption*)malloc(5 * sizeof(FrontendOption));
else if (numCustomFrontendOptions % 5 == 1)
customFrontendOptions = (FrontendOption*)realloc(customFrontendOptions, (numCustomFrontendOptions + 4) * sizeof(FrontendOption));
assert(customFrontendOptions != nil && "Custom frontend options can't be allocated");
uint8 numOptions = GetNumberOfMenuOptions(currentMenu);
uint8 curIdx;
if (optionCursor < 0) {
@ -159,30 +86,11 @@ int8 RegisterNewOption()
if (!optionOverwrite) {
if (aScreens[currentMenu].m_aEntries[curIdx].m_Action != MENUACTION_NOTHING) {
for (int i = numOptions - 1; i >= curIdx; i--) {
memcpy(&aScreens[currentMenu].m_aEntries[i + 1], &aScreens[currentMenu].m_aEntries[i], sizeof(CMenuScreen::CMenuEntry));
memcpy(&aScreens[currentMenu].m_aEntries[i + 1], &aScreens[currentMenu].m_aEntries[i], sizeof(CMenuScreenCustom::CMenuEntry));
}
}
}
optionCursor++;
if (optionOverwrite) {
numFrontendOptionReplacements++;
if (numFrontendOptionReplacements == 1)
frontendOptionReplacements = (CMenuScreen::CMenuEntry*)malloc(5 * sizeof(CMenuScreen::CMenuEntry));
else if (numFrontendOptionReplacements % 5 == 1)
frontendOptionReplacements = (CMenuScreen::CMenuEntry*)realloc(frontendOptionReplacements, (numFrontendOptionReplacements + 4) * sizeof(CMenuScreen::CMenuEntry));
memcpy(&frontendOptionReplacements[numFrontendOptionReplacements - 1], &aScreens[currentMenu].m_aEntries[curIdx], sizeof(CMenuScreen::CMenuEntry));
customFrontendOptions[numCustomFrontendOptions - 1].ogOptionId = numFrontendOptionReplacements - 1;
} else {
customFrontendOptions[numCustomFrontendOptions - 1].ogOptionId = -1;
}
customFrontendOptions[numCustomFrontendOptions - 1].screen = currentMenu;
aScreens[currentMenu].m_aEntries[curIdx].m_Action = MENUACTION_TRIGGERFUNC;
aScreens[currentMenu].m_aEntries[curIdx].m_SaveSlot = SAVESLOT_CFO;
aScreens[currentMenu].m_aEntries[curIdx].m_TargetMenu = numCustomFrontendOptions - 1;
aScreens[currentMenu].m_aEntries[curIdx].m_EntryName[0] = 1; // just something to fool it
return curIdx;
}
@ -193,110 +101,78 @@ void FrontendOptionSetCursor(int screen, int8 option, bool overwrite)
optionOverwrite = overwrite;
}
void FrontendOptionAddBuiltinAction(const wchar* leftText, int action, ButtonPressFunc buttonPressFunc, ReturnPrevPageFunc returnPrevPageFunc) {
void FrontendOptionAddBuiltinAction(const char* gxtKey, int action, int targetMenu, int saveSlot) {
int8 screenOptionOrder = RegisterNewOption();
FrontendOption& option = customFrontendOptions[numCustomFrontendOptions - 1];
CMenuScreenCustom::CMenuEntry &option = aScreens[currentMenu].m_aEntries[screenOptionOrder];
// To fool the Frontend, we will still display the text passed via first param.
// We can't use custom text on those :shrug:
switch (action) {
case MENUACTION_SCREENRES:
strcpy(aScreens[currentMenu].m_aEntries[screenOptionOrder].m_EntryName, "FED_RES");
strcpy(option.m_EntryName, "FED_RES");
break;
case MENUACTION_AUDIOHW:
strcpy(aScreens[currentMenu].m_aEntries[screenOptionOrder].m_EntryName, "FEA_3DH");
strcpy(option.m_EntryName, "FEA_3DH");
break;
default:
strncpy(option.m_EntryName, gxtKey, 8);
break;
}
aScreens[currentMenu].m_aEntries[screenOptionOrder].m_Action = action;
option.type = FEOPTION_BUILTIN_ACTION;
option.buttonPressFunc = buttonPressFunc;
TextCopy(option.leftText, leftText);
option.screenOptionOrder = screenOptionOrder;
option.returnPrevPageFunc = returnPrevPageFunc;
option.save = nil;
option.m_Action = action;
option.m_SaveSlot = saveSlot;
option.m_TargetMenu = targetMenu;
}
void FrontendOptionAddSelect(const wchar* leftText, const wchar** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, ReturnPrevPageFunc returnPrevPageFunc, const char* saveName)
void FrontendOptionAddSelect(const char* gxtKey, const char** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, const char* saveName)
{
int8 screenOptionOrder = RegisterNewOption();
CMenuScreenCustom::CMenuEntry &option = aScreens[currentMenu].m_aEntries[screenOptionOrder];
option.m_Action = MENUACTION_CFO_SELECT;
strncpy(option.m_EntryName, gxtKey, 8);
option.m_CFOSelect = new CCFOSelect();
option.m_CFOSelect->rightTexts = (char**)malloc(numRightTexts * sizeof(char*));
memcpy(option.m_CFOSelect->rightTexts, rightTexts, numRightTexts * sizeof(char*));
option.m_CFOSelect->numRightTexts = numRightTexts;
option.m_CFOSelect->value = var;
if (var) {
option.m_CFOSelect->displayedValue = *var;
option.m_CFOSelect->lastSavedValue = *var;
}
option.m_CFOSelect->save = saveName;
option.m_CFOSelect->onlyApplyOnEnter = onlyApplyOnEnter;
option.m_CFOSelect->changeFunc = changeFunc;
}
void FrontendOptionAddDynamic(const char* gxtKey, DrawFunc drawFunc, int8 *var, ButtonPressFunc buttonPressFunc, const char* saveName)
{
int8 screenOptionOrder = RegisterNewOption();
FrontendOption& option = customFrontendOptions[numCustomFrontendOptions - 1];
option.type = FEOPTION_SELECT;
TextCopy(option.leftText, leftText);
option.rightTexts = (wchar**)malloc(numRightTexts * sizeof(wchar*));
memcpy(option.rightTexts, rightTexts, numRightTexts * sizeof(wchar*));
option.numRightTexts = numRightTexts;
option.value = var;
option.displayedValue = *var;
option.lastSavedValue = *var;
option.save = saveName;
option.onlyApplyOnEnter = onlyApplyOnEnter;
option.changeFunc = changeFunc;
option.screenOptionOrder = screenOptionOrder;
option.returnPrevPageFunc = returnPrevPageFunc;
}
void FrontendOptionAddDynamic(const wchar* leftText, DrawFunc drawFunc, int8 *var, ButtonPressFunc buttonPressFunc, ReturnPrevPageFunc returnPrevPageFunc, const char* saveName)
{
int8 screenOptionOrder = RegisterNewOption();
FrontendOption& option = customFrontendOptions[numCustomFrontendOptions - 1];
option.type = FEOPTION_DYNAMIC;
option.drawFunc = drawFunc;
option.buttonPressFunc = buttonPressFunc;
TextCopy(option.leftText, leftText);
option.value = var;
option.save = saveName;
option.screenOptionOrder = screenOptionOrder;
option.returnPrevPageFunc = returnPrevPageFunc;
}
void FrontendOptionAddRedirect(const wchar* text, int to, int8 selectedOption, bool fadeIn)
{
int8 screenOptionOrder = RegisterNewOption();
FrontendOption &option = customFrontendOptions[numCustomFrontendOptions - 1];
option.type = FEOPTION_REDIRECT;
option.to = to;
option.option = selectedOption;
option.fadeIn = fadeIn;
TextCopy(option.leftText, text);
option.screenOptionOrder = screenOptionOrder;
option.returnPrevPageFunc = nil;
option.save = nil;
}
void FrontendOptionAddBackButton(const wchar* text, bool fadeIn)
{
int8 screenOptionOrder = RegisterNewOption();
FrontendOption& option = customFrontendOptions[numCustomFrontendOptions - 1];
option.type = FEOPTION_GOBACK;
option.fadeIn = fadeIn;
TextCopy(option.leftText, text);
option.screenOptionOrder = screenOptionOrder;
option.returnPrevPageFunc = nil;
option.save = nil;
CMenuScreenCustom::CMenuEntry &option = aScreens[currentMenu].m_aEntries[screenOptionOrder];
option.m_Action = MENUACTION_CFO_DYNAMIC;
strncpy(option.m_EntryName, gxtKey, 8);
option.m_CFODynamic = new CCFODynamic();
option.m_CFODynamic->drawFunc = drawFunc;
option.m_CFODynamic->buttonPressFunc = buttonPressFunc;
option.m_CFODynamic->value = var;
option.m_CFODynamic->save = saveName;
}
uint8 FrontendScreenAdd(const char* gxtKey, eMenuSprites sprite, int prevPage, int columnWidth, int headerHeight, int lineHeight,
int8 font, float fontScaleX, float fontScaleY, int8 alignment, bool showLeftRightHelper, ReturnPrevPageFunc returnPrevPageFunc) {
uint8 screenOrder = RegisterNewScreen(gxtKey, prevPage);
uint8 screenOrder = RegisterNewScreen(gxtKey, prevPage, returnPrevPageFunc);
FrontendScreen &screen = customFrontendScreens[numCustomFrontendScreens - 1];
screen.id = screenOrder;
screen.sprite = sprite;
screen.prevPage = prevPage;
strncpy(screen.name, gxtKey, 8);
screen.columnWidth = columnWidth;
screen.headerHeight = headerHeight;
screen.lineHeight = lineHeight;
screen.font = font;
screen.fontScaleX = fontScaleX;
screen.fontScaleY = fontScaleY;
screen.alignment = alignment;
screen.returnPrevPageFunc = returnPrevPageFunc;
CCustomScreenLayout *screen = new CCustomScreenLayout();
aScreens[screenOrder].layout = screen;
screen->sprite = sprite;
screen->columnWidth = columnWidth;
screen->headerHeight = headerHeight;
screen->lineHeight = lineHeight;
screen->font = font;
screen->fontScaleX = fontScaleX;
screen->fontScaleY = fontScaleY;
screen->alignment = alignment;
return screenOrder;
}

View File

@ -2,47 +2,23 @@
#include "common.h"
#ifdef CUSTOM_FRONTEND_OPTIONS
#include "Frontend.h"
// Warning:
// All of the code relies on that you won't use more then NUM_MENUROWS(18) options on one page.
// Also congrats if you can make 18 options visible at once.
// About texts:
// All text parameters accept wchar(including hardcoded wchar* and TheText.Get)
// except FrontendScreenAdd(it's char[8] GXT key by the design of Frontend).
// All texts reload if custom options reloaded too, which includes language changes and via live reload feature in debug menu!
// Execute direction:
// All of the calls below eventually manipulate the aScreens array, so keep in mind to add/replace options in order,
// i.e. don't set cursor to 8 first and then 3.
// Live reload:
// You can add/change/undo the new options in-game if you use VS. Change what you want, build the changed bits via "Edit and Continue",
// and hit the "Reload custom frontend options" from debug menu. Or call CustomFrontendOptionsPopulate() from somewhere else.
// ! There are 2 ways to use CFO,
// 1st; by adding a new option to the array in MenuScreensCustom.cpp and passing attributes/CBs to it
// 2nd; by calling the functions listed at the bottom of this file.
// -- Option types
//
// Static/select: You allocate the variable, pass it to function and game sets it from user input among the strings given to function,
// then you can handle ChangeFunc(only called on enter if onlyApplyOnEnter set, or set immediately)
// and ReturnPrevPageFunc optionally. You can store the option in an INI file if you pass the key(as a char array) to corresponding parameter.
// optionally you can add post-change event via ChangeFunc(only called on enter if onlyApplyOnEnter set, or set immediately)
// You can store the option in an INI file if you pass the key(as a char array) to corresponding parameter.
//
// Dynamic: Passing variable to function is only needed if you want to store it, otherwise you should do
// all the operations with ButtonPressFunc, this includes allocating the variable.
// Left-side text is passed while creating and static, but ofc right-side text is dynamic -
// you should return it in DrawFunc, which is called on every draw. ReturnPrevPageFunc is also here if needed.
//
// Redirect: Redirection to another screen. selectedOption parameter is the highlighted option user will see after the redirection.
// you should return it in DrawFunc, which is called on every draw.
//
// Built-in action: As the name suggests, any action that game has built-in. But as an extra you can set the option text,
// and can be informed on button press/focus loss via buttonPressFunc. ReturnPrevPageFunc is also here.
#define FEOPTION_SELECT 0
#define FEOPTION_DYNAMIC 1
#define FEOPTION_REDIRECT 2
#define FEOPTION_GOBACK 3
#define FEOPTION_BUILTIN_ACTION 4
// -- Returned via ButtonPressFunc() action param.
#define FEOPTION_ACTION_LEFT 0
@ -61,7 +37,7 @@
typedef void (*ReturnPrevPageFunc)();
// for static options
typedef void (*ChangeFunc)(int8 displayedValue); // called before updating the value.
typedef void (*ChangeFunc)(int8 before, int8 after); // called after updating the value.
// only called on enter if onlyApplyOnEnter set, otherwise called on every value change
// for dynamic options
@ -69,71 +45,11 @@ typedef wchar* (*DrawFunc)(bool* disabled, bool userHovering); // you must retur
// you can also set *disabled if you want to gray it out.
typedef void (*ButtonPressFunc)(int8 action); // see FEOPTION_ACTIONs above
struct FrontendScreen
{
int id;
char name[8];
eMenuSprites sprite;
int prevPage;
int columnWidth;
int headerHeight;
int lineHeight;
int8 font;
float fontScaleX;
float fontScaleY;
int8 alignment;
bool showLeftRightHelper;
ReturnPrevPageFunc returnPrevPageFunc;
};
struct FrontendOption
{
int8 type;
int8 screenOptionOrder;
int32 screen;
wchar leftText[128];
ReturnPrevPageFunc returnPrevPageFunc;
int8* value;
int8 displayedValue; // only if onlyApplyOnEnter enabled for now
const char* save;
int32 ogOptionId; // for replacements, see overwrite parameter of SetCursor
union {
// Only for dynamic / built-in action
struct {
DrawFunc drawFunc;
ButtonPressFunc buttonPressFunc;
};
// Only for static/select
struct {
wchar** rightTexts;
int8 numRightTexts;
bool onlyApplyOnEnter;
ChangeFunc changeFunc;
int8 lastSavedValue; // only if onlyApplyOnEnter enabled
};
// Only for redirect
struct {
int to;
int8 option;
bool fadeIn;
};
};
};
// -- Internal things
void RemoveCustomFrontendOptions();
void CustomFrontendOptionsPopulate();
extern int lastOgScreen; // for reloading
extern int numCustomFrontendOptions;
extern FrontendOption* customFrontendOptions;
extern int numCustomFrontendScreens;
extern FrontendScreen* customFrontendScreens;
// -- To be used in ButtonPressFunc / ChangeFunc(this one would be weird):
void ChangeScreen(int screen, int option = 0, bool fadeIn = true);
@ -141,6 +57,21 @@ void GoBack(bool fadeIn = true);
uint8 GetNumberOfMenuOptions(int screen);
// !!! We're now moved to MenuScreensCustom.cpp, which houses an array that keeps all original+custom options.
// But you can still use the APIs below, and manipulate aScreens while in game.
// Limits:
// The code relies on that you won't use more then NUM_MENUROWS(18) options on one page, and won't exceed the MENUPAGES of pages.
// Also congrats if you can make 18 options visible at once.
// Texts:
// All text parameters accept char[8] GXT key.
// Execute direction:
// All of the calls below eventually manipulate the aScreens array, so keep in mind to add/replace options in order,
// i.e. don't set cursor to 8 first and then 3.
// -- Placing the cursor to append/overwrite option
//
// Done via FrontendOptionSetCursor(screen, position, overwrite = false), parameters explained below:
@ -152,11 +83,9 @@ uint8 GetNumberOfMenuOptions(int screen);
void FrontendOptionSetCursor(int screen, int8 option, bool overwrite = false);
// var is optional in AddDynamic, enables you to save them in an INI file(also needs passing char array to saveName param. obv), otherwise pass nil/0
void FrontendOptionAddBuiltinAction(const wchar* leftText, int action, ButtonPressFunc buttonPressFunc, ReturnPrevPageFunc returnPrevPageFunc);
void FrontendOptionAddSelect(const wchar* leftText, const wchar** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, ReturnPrevPageFunc returnPrevPageFunc, const char* saveName = nil);
void FrontendOptionAddDynamic(const wchar* leftText, DrawFunc rightTextDrawFunc, int8 *var, ButtonPressFunc buttonPressFunc, ReturnPrevPageFunc returnPrevPageFunc, const char* saveName = nil);
void FrontendOptionAddRedirect(const wchar* text, int to, int8 selectedOption = 0, bool fadeIn = true);
void FrontendOptionAddBackButton(const wchar* text, bool fadeIn = true);
void FrontendOptionAddBuiltinAction(const char* gxtKey, int action, int targetMenu = MENUPAGE_NONE, int saveSlot = SAVESLOT_NONE);
void FrontendOptionAddSelect(const char* gxtKey, const char** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, const char* saveName = nil);
void FrontendOptionAddDynamic(const char* gxtKey, DrawFunc rightTextDrawFunc, int8 *var, ButtonPressFunc buttonPressFunc, const char* saveName = nil);
uint8 FrontendScreenAdd(const char* gxtKey, eMenuSprites sprite, int prevPage, int columnWidth, int headerHeight, int lineHeight, int8 font, float fontScaleX, float fontScaleY, int8 alignment, bool showLeftRightHelper, ReturnPrevPageFunc returnPrevPageFunc = nil);
#endif

View File

@ -462,6 +462,53 @@ RwBool RwIm3DRenderPrimitive(RwPrimitiveType primType);
RwBool RwRenderStateGet(RwRenderState state, void *value)
{
uint32 *uival = (uint32*)value;
uint32 fog;
switch(state){
case rwRENDERSTATETEXTURERASTER: *(void**)value = GetRenderStatePtr(TEXTURERASTER); return true;
case rwRENDERSTATETEXTUREADDRESS: *uival = GetRenderState(TEXTUREADDRESS); return true;
case rwRENDERSTATETEXTUREADDRESSU: *uival = GetRenderState(TEXTUREADDRESSU); return true;
case rwRENDERSTATETEXTUREADDRESSV: *uival = GetRenderState(TEXTUREADDRESSV); return true;
case rwRENDERSTATETEXTUREPERSPECTIVE: *uival = 1; return true;
case rwRENDERSTATEZTESTENABLE: *uival = GetRenderState(ZTESTENABLE); return true;
case rwRENDERSTATESHADEMODE: *uival = rwSHADEMODEGOURAUD; return true;
case rwRENDERSTATEZWRITEENABLE: *uival = GetRenderState(ZWRITEENABLE); return true;
case rwRENDERSTATETEXTUREFILTER: *uival = GetRenderState(TEXTUREFILTER); return true;
case rwRENDERSTATESRCBLEND: *uival = GetRenderState(SRCBLEND); return true;
case rwRENDERSTATEDESTBLEND: *uival = GetRenderState(DESTBLEND); return true;
case rwRENDERSTATEVERTEXALPHAENABLE: *uival = GetRenderState(VERTEXALPHA); return true;
case rwRENDERSTATEBORDERCOLOR: *uival = 0; return true;
case rwRENDERSTATEFOGENABLE: *uival = GetRenderState(FOGENABLE); return true;
case rwRENDERSTATEFOGCOLOR:
// have to swap R and B here
fog = GetRenderState(FOGCOLOR);
*uival = (fog>>16)&0xFF;
*uival |= (fog&0xFF)<<16;
*uival |= fog&0xFF00;
*uival |= fog&0xFF000000;
return true;
case rwRENDERSTATEFOGTYPE: *uival = rwFOGTYPELINEAR; return true;
case rwRENDERSTATEFOGDENSITY: *(float*)value = 1.0f; return true;
case rwRENDERSTATECULLMODE: *uival = GetRenderState(CULLMODE); return true;
// all unsupported
case rwRENDERSTATEFOGTABLE:
case rwRENDERSTATEALPHAPRIMITIVEBUFFER:
case rwRENDERSTATESTENCILENABLE:
case rwRENDERSTATESTENCILFAIL:
case rwRENDERSTATESTENCILZFAIL:
case rwRENDERSTATESTENCILPASS:
case rwRENDERSTATESTENCILFUNCTION:
case rwRENDERSTATESTENCILFUNCTIONREF:
case rwRENDERSTATESTENCILFUNCTIONMASK:
case rwRENDERSTATESTENCILFUNCTIONWRITEMASK:
default:
return false;
}
}
RwBool RwRenderStateSet(RwRenderState state, void *value)
{
uint32 uival = (uintptr)value;

View File

@ -3,6 +3,9 @@
#include "Sprite2d.h"
#include "TxdStore.h"
#include "Font.h"
#ifdef BUTTON_ICONS
#include "FileMgr.h"
#endif
void
AsciiToUnicode(const char *src, wchar *dst)
@ -224,6 +227,12 @@ wchar foreign_table[128] = {
0, 174, 165, 166, 167, 0, 168, 0, 0, 169, 170, 171, 172, 0, 0, 0,
};
#ifdef BUTTON_ICONS
CSprite2d CFont::ButtonSprite[MAX_BUTTON_ICONS];
int CFont::PS2Symbol = BUTTON_NONE;
int CFont::ButtonsSlot = -1;
#endif // BUTTON_ICONS
void
CFont::Initialise(void)
{
@ -281,6 +290,34 @@ CFont::Initialise(void)
SetAlphaFade(255.0f);
SetDropShadowPosition(0);
CTxdStore::PopCurrentTxd();
#ifdef BUTTON_ICONS
if (int file = CFileMgr::OpenFile("MODELS/X360BTNS.TXD")) {
CFileMgr::CloseFile(file);
ButtonsSlot = CTxdStore::AddTxdSlot("buttons");
CTxdStore::LoadTxd(ButtonsSlot, "MODELS/X360BTNS.TXD");
CTxdStore::AddRef(ButtonsSlot);
CTxdStore::PushCurrentTxd();
CTxdStore::SetCurrentTxd(ButtonsSlot);
#if 0 // unused
ButtonSprite[BUTTON_UP].SetTexture("up");
ButtonSprite[BUTTON_DOWN].SetTexture("down");
ButtonSprite[BUTTON_LEFT].SetTexture("left");
ButtonSprite[BUTTON_RIGHT].SetTexture("right");
#endif
ButtonSprite[BUTTON_CROSS].SetTexture("cross");
ButtonSprite[BUTTON_CIRCLE].SetTexture("circle");
ButtonSprite[BUTTON_SQUARE].SetTexture("square");
ButtonSprite[BUTTON_TRIANGLE].SetTexture("triangle");
ButtonSprite[BUTTON_L1].SetTexture("l1");
ButtonSprite[BUTTON_L2].SetTexture("l2");
ButtonSprite[BUTTON_L3].SetTexture("l3");
ButtonSprite[BUTTON_R1].SetTexture("r1");
ButtonSprite[BUTTON_R2].SetTexture("r2");
ButtonSprite[BUTTON_R3].SetTexture("r3");
CTxdStore::PopCurrentTxd();
}
#endif // BUTTON_ICONS
}
#ifdef MORE_LANGUAGES
@ -329,6 +366,13 @@ CFont::ReloadFonts(uint8 set)
void
CFont::Shutdown(void)
{
#ifdef BUTTON_ICONS
if (ButtonsSlot != -1) {
for (int i = 0; i < MAX_BUTTON_ICONS; i++)
ButtonSprite[i].Delete();
CTxdStore::RemoveTxdSlot(ButtonsSlot);
}
#endif
Sprite[0].Delete();
Sprite[1].Delete();
Sprite[2].Delete();
@ -354,8 +398,34 @@ CFont::InitPerFrame(void)
#endif
SetDropShadowPosition(0);
NewLine = 0;
#ifdef BUTTON_ICONS
PS2Symbol = BUTTON_NONE;
#endif
}
#ifdef BUTTON_ICONS
void
CFont::DrawButton(float x, float y)
{
if (x <= 0.0f || x > SCREEN_WIDTH || y <= 0.0f || y > SCREEN_HEIGHT)
return;
if (PS2Symbol != BUTTON_NONE) {
CRect rect;
rect.left = x;
rect.top = Details.scaleY + Details.scaleY + y;
rect.right = Details.scaleY * 17.0f + x;
rect.bottom = Details.scaleY * 19.0f + y;
int vertexAlphaState;
RwRenderStateGet(rwRENDERSTATEVERTEXALPHAENABLE, &vertexAlphaState);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE);
ButtonSprite[PS2Symbol].Draw(rect, CRGBA(255, 255, 255, Details.color.a));
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)vertexAlphaState);
}
}
#endif
void
CFont::PrintChar(float x, float y, wchar c)
{
@ -822,6 +892,15 @@ CFont::PrintString(float x, float y, wchar *start, wchar *&end, float spwidth, f
c = *s - ' ';
if (Details.slant != 0.0f && !IsJapanese())
y = (Details.slantRefX - x) * Details.slant + Details.slantRefY;
#ifdef BUTTON_ICONS
if (PS2Symbol != BUTTON_NONE) {
DrawButton(x, y);
x += Details.scaleY * 17.0f;
PS2Symbol = BUTTON_NONE;
}
#endif
PrintChar(x, y, c);
x += GetCharacterSize(c);
if (c == 0 && (!NewLine || !IsJapanese())) // space
@ -953,6 +1032,30 @@ CFont::GetStringWidth(wchar *s, bool spaces)
do {
while (*s == '~' || *s == JAP_TERMINATION) {
s++;
#ifdef BUTTON_ICONS
switch (*s) {
#if 0 // unused
case 'U':
case 'D':
case '<':
case '>':
#endif
case 'X':
case 'O':
case 'Q':
case 'T':
case 'K':
case 'M':
case 'A':
case 'J':
case 'V':
case 'C':
w += 17.0f * Details.scaleY;
break;
default:
break;
}
#endif
while (!(*s == '~' || *s == JAP_TERMINATION)) s++;
s++;
}
@ -967,12 +1070,40 @@ CFont::GetStringWidth(wchar *s, bool spaces)
for (; (*s != ' ' || spaces) && *s != '\0'; s++) {
if (*s == '~') {
s++;
#ifdef BUTTON_ICONS
switch (*s) {
#if 0 // unused
case 'U':
case 'D':
case '<':
case '>':
#endif
case 'X':
case 'O':
case 'Q':
case 'T':
case 'K':
case 'M':
case 'A':
case 'J':
case 'V':
case 'C':
w += 17.0f * Details.scaleY;
break;
default:
break;
}
#endif
while (*s != '~') s++;
#ifndef FIX_BUGS
s++;
if (*s == ' ' && !spaces)
break;
}
w += GetCharacterSize(*s - ' ');
}
#else
} else
#endif
w += GetCharacterSize(*s - ' ');
}
}
return w;
@ -1026,9 +1157,11 @@ CFont::GetNextSpace(wchar *s)
if(*s == '~'){
s++;
while(*s != '~') s++;
#ifndef FIX_BUGS
s++;
if(*s == ' ')
break;
#endif
}
}
return s;
@ -1036,7 +1169,7 @@ CFont::GetNextSpace(wchar *s)
#ifdef MORE_LANGUAGES
wchar*
CFont::ParseToken(wchar *s, wchar*, bool japShit)
CFont::ParseToken(wchar *s, wchar* ss, bool japShit)
{
s++;
if ((Details.color.r || Details.color.g || Details.color.b) && !japShit) {
@ -1056,13 +1189,37 @@ CFont::ParseToken(wchar *s, wchar*, bool japShit)
case 'r': SetColor(CRGBA(113, 43, 73, 255)); break;
case 'w': SetColor(CRGBA(175, 175, 175, 255)); break;
case 'y': SetColor(CRGBA(210, 196, 106, 255)); break;
#ifdef BUTTON_ICONS
#if 0 // unused
case 'U': PS2Symbol = BUTTON_UP; break;
case 'D': PS2Symbol = BUTTON_DOWN; break;
case '<': PS2Symbol = BUTTON_LEFT; break;
case '>': PS2Symbol = BUTTON_RIGHT; break;
#endif
case 'X': PS2Symbol = BUTTON_CROSS; break;
case 'O': PS2Symbol = BUTTON_CIRCLE; break;
case 'Q': PS2Symbol = BUTTON_SQUARE; break;
case 'T': PS2Symbol = BUTTON_TRIANGLE; break;
case 'K': PS2Symbol = BUTTON_L1; break;
case 'M': PS2Symbol = BUTTON_L2; break;
case 'A': PS2Symbol = BUTTON_L3; break;
case 'J': PS2Symbol = BUTTON_R1; break;
case 'V': PS2Symbol = BUTTON_R2; break;
case 'C': PS2Symbol = BUTTON_R3; break;
#endif
}
} else if (IsJapanese()) {
if ((*s & 0x7FFF) == 'N' || (*s & 0x7FFF) == 'n')
NewLine = true;
}
while ((!IsJapanese() || (*s != JAP_TERMINATION)) && *s != '~') s++;
#ifdef FIX_BUGS
if (*(++s) == '~')
s = ParseToken(s, ss, japShit);
return s;
#else
return s + 1;
#endif
}
#else
wchar*
@ -1083,6 +1240,24 @@ CFont::ParseToken(wchar *s, wchar*)
case 'r': SetColor(CRGBA(0x71, 0x2B, 0x49, 0xFF)); break;
case 'w': SetColor(CRGBA(0xAF, 0xAF, 0xAF, 0xFF)); break;
case 'y': SetColor(CRGBA(0xD2, 0xC4, 0x6A, 0xFF)); break;
#ifdef BUTTON_ICONS
#if 0 // unused
case 'U': PS2Symbol = BUTTON_UP; break;
case 'D': PS2Symbol = BUTTON_DOWN; break;
case '<': PS2Symbol = BUTTON_LEFT; break;
case '>': PS2Symbol = BUTTON_RIGHT; break;
#endif
case 'X': PS2Symbol = BUTTON_CROSS; break;
case 'O': PS2Symbol = BUTTON_CIRCLE; break;
case 'Q': PS2Symbol = BUTTON_SQUARE; break;
case 'T': PS2Symbol = BUTTON_TRIANGLE; break;
case 'K': PS2Symbol = BUTTON_L1; break;
case 'M': PS2Symbol = BUTTON_L2; break;
case 'A': PS2Symbol = BUTTON_L3; break;
case 'J': PS2Symbol = BUTTON_R1; break;
case 'V': PS2Symbol = BUTTON_R2; break;
case 'C': PS2Symbol = BUTTON_R3; break;
#endif
}
while(*s != '~') s++;
return s+1;

View File

@ -63,6 +63,31 @@ enum
#define FONT_LOCALE(style) (style)
#endif
#ifdef BUTTON_ICONS
enum
{
BUTTON_NONE = -1,
#if 0 // unused
BUTTON_UP,
BUTTON_DOWN,
BUTTON_LEFT,
BUTTON_RIGHT,
#endif
BUTTON_CROSS,
BUTTON_CIRCLE,
BUTTON_SQUARE,
BUTTON_TRIANGLE,
BUTTON_L1,
BUTTON_L2,
BUTTON_L3,
BUTTON_R1,
BUTTON_R2,
BUTTON_R3,
MAX_BUTTON_ICONS
};
#endif // BUTTON_ICONS
class CFont
{
#ifdef MORE_LANGUAGES
@ -77,6 +102,15 @@ public:
static CSprite2d Sprite[MAX_FONTS];
static CFontDetails Details;
#ifdef BUTTON_ICONS
static int32 ButtonsSlot;
static CSprite2d ButtonSprite[MAX_BUTTON_ICONS];
static int PS2Symbol;
static void DrawButton(float x, float y);
#endif // BUTTON_ICONS
static void Initialise(void);
static void Shutdown(void);
static void InitPerFrame(void);

View File

@ -111,7 +111,7 @@ CRenderer::RenderOneRoad(CEntity *e)
CustomPipes::AttachGlossPipe(e->GetAtomic());
#endif
#ifdef EXTRA_MODEL_FLAGS
if(CModelInfo::GetModelInfo(e->GetModelIndex())->RenderDoubleSided()){
if(!e->IsBuilding() || CModelInfo::GetModelInfo(e->GetModelIndex())->RenderDoubleSided()){
BACKFACE_CULLING_OFF;
e->Render();
BACKFACE_CULLING_ON;
@ -181,7 +181,7 @@ CRenderer::RenderOneNonRoad(CEntity *e)
BACKFACE_CULLING_OFF;
}
#ifdef EXTRA_MODEL_FLAGS
if(CModelInfo::GetModelInfo(e->GetModelIndex())->RenderDoubleSided()){
if(!e->IsBuilding() || CModelInfo::GetModelInfo(e->GetModelIndex())->RenderDoubleSided()){
BACKFACE_CULLING_OFF;
e->Render();
BACKFACE_CULLING_ON;

View File

@ -11,6 +11,7 @@
#include "Clock.h"
#include "MBlur.h"
#include "Date.h"
#include "Font.h"
#include "FileMgr.h"
#include "Game.h"
#include "GameLogic.h"

2
vendor/librw vendored

@ -1 +1 @@
Subproject commit e68ef1374d20071887348e9031f5fa38a2e4f7ed
Subproject commit 8c00f787cb8f53781c4335ecbc9d28fb9c664ba7