summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt112
-rw-r--r--src/control/Script.cpp2
-rw-r--r--src/core/ControllerConfig.cpp408
-rw-r--r--src/core/FileLoader.cpp344
-rw-r--r--src/core/Frontend.cpp2
-rw-r--r--src/core/Frontend_PS2.cpp4
-rw-r--r--src/core/config.h28
-rw-r--r--src/core/main.cpp3
-rw-r--r--src/extras/custompipes.cpp2
-rw-r--r--src/modelinfo/BaseModelInfo.h8
-rw-r--r--src/modelinfo/ClumpModelInfo.cpp17
-rw-r--r--src/render/Hud.cpp2
-rw-r--r--src/render/Renderer.cpp29
-rw-r--r--src/rw/RwHelper.cpp30
-rw-r--r--src/rw/RwHelper.h2
-rw-r--r--src/rw/VisibilityPlugins.cpp9
-rw-r--r--src/save/MemoryCard.cpp1
17 files changed, 986 insertions, 17 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644
index 00000000..eca69d30
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -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()
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 6bde6b87..86595bbd 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -2696,8 +2696,10 @@ int8 CRunningScript::ProcessCommands0To99(int32 command)
#ifdef MISSION_REPLAY
if (m_bMissionFlag) {
CPlayerInfo* pPlayerInfo = &CWorld::Players[CWorld::PlayerInFocus];
+#if 0 // makeing autosave is pointless and is a bit buggy
if (pPlayerInfo->m_pPed->GetPedState() != PED_DEAD && pPlayerInfo->m_WBState == WBSTATE_PLAYING && !m_bDeatharrestExecuted)
SaveGameForPause(1);
+#endif
oldTargetX = oldTargetY = 0.0f;
if (AllowMissionReplay == 1)
AllowMissionReplay = 2;
diff --git a/src/core/ControllerConfig.cpp b/src/core/ControllerConfig.cpp
index 576a58b1..dcc294c8 100644
--- a/src/core/ControllerConfig.cpp
+++ b/src/core/ControllerConfig.cpp
@@ -2316,8 +2316,416 @@ 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
+#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
+#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 "^"
+#else
+#define PS2_TRIANGLE "TRIANGLE"
+#define PS2_CIRCLE "CIRCLE"
+#define PS2_CROSS "CROSS"
+#define PS2_SQUARE "SQUARE"
+#endif
+
+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
+#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
+
void CControllerConfigManager::GetWideStringOfCommandKeys(uint16 action, wchar *text, uint16 leight)
{
+#ifdef DETECT_PAD_INPUT_SWITCH
+ if (CPad::GetPad(0)->IsAffectedByController) {
+ wchar wstr[16];
+
+ // TODO: INI and/or menu setting for Xbox/PS switch
+ const char *(*Buttons)[MAX_CONTROLLERACTIONS] = XboxButtons;
+
+ assert(Buttons[CPad::GetPad(0)->Mode][action] != nil); // we cannot use these
+ AsciiToUnicode(Buttons[CPad::GetPad(0)->Mode][action], wstr);
+
+ CMessages::WideStringCopy(text, wstr, leight);
+ return;
+ }
+#endif
+
int32 nums = GetNumOfSettingsForAction((e_ControllerAction)action);
int32 sets = 0;
diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp
index ff50575f..aadafc29 100644
--- a/src/core/FileLoader.cpp
+++ b/src/core/FileLoader.cpp
@@ -1,6 +1,7 @@
#include "common.h"
#include "main.h"
+#include "General.h"
#include "Quaternion.h"
#include "ModelInfo.h"
#include "ModelIndices.h"
@@ -449,6 +450,334 @@ CFileLoader::LoadAtomicFile(RwStream *stream, uint32 id)
return true;
}
+#ifdef HARDCODED_MODEL_FLAGS
+char *DoubleSidedNames[] = {
+ "chnabankdoor",
+ "Security_Hut",
+ "Hospital_Sub",
+ "phonebooth1",
+ "trafficlight1",
+ "sub_roadbarrier",
+ "redlightbuild09",
+ "doublestreetlght1",
+ "doc_shedbig31",
+ "com_land_128",
+ "garage7",
+ "proj_garage01",
+ "buildingground2",
+ "buildingground3",
+ "ch_roof_kb",
+ "overpassind",
+ "casino",
+ "ind_land100",
+ "fuckedup_skewlbus",
+ "Police_Station_ind",
+ "flagsitaly",
+ "sidebarrier_gaz1",
+ "bar_barrier12",
+ "bar_barrier10b",
+ "sidebarrier_gaz2",
+ "doc_shedbig3",
+ "doc_shedbig4",
+ "verticalift_bridge",
+ "verticalift_bridg2",
+ "usdcrdlrbuild01",
+ "apairporthanger",
+ "apairporthangerA",
+ "porthangerclosed",
+ "redlightbuild13",
+ "doc_rave",
+ "const_woodfence",
+ "const_woodfence2",
+ "const_woodfence3",
+ "subfraightback01",
+ "subfraightback02",
+ "subfraightback03",
+ "subfraightback04",
+ "subind_build03",
+ "chinabanner1",
+ "chinabanner2",
+ "chinabanner3",
+ "chinabanner4",
+ "Pumpfirescape",
+ "Pumphouse",
+ "amcounder",
+ "barrel1",
+ "barrel2",
+ "barrel3",
+ "barrel4",
+ "com_1way50",
+ "com_1way20",
+ "overpasscom01",
+ "overpasscom02",
+ "overpasscom03",
+ "overpasscom04",
+ "overpass_comse",
+ "newdockbuilding",
+ "newdockbuilding2",
+ "newdockbuilding",
+ "policeballhall",
+ "fuzballdoor",
+ "ind_land106",
+ "PoliceBallSigns",
+ "amcoudet",
+ "rustship_structure",
+ "impexpgrgesub",
+ "ind_land128",
+ "fshfctry_dstryd",
+ "railtrax_bentl",
+ "railtrax_lo4b",
+ "railtrax_straight",
+ "railtrax_bentrb",
+ "railtrax_skew",
+ "newtrackaaa",
+ "railtrax_skew5",
+ // these they forgot:
+ "railtrax_skewp",
+ "railtrax_ske2b",
+ "railtrax_strtshort",
+ "railtrax_2b",
+ "railtrax_straightss",
+ "railtrax_bentr",
+ ""
+};
+char *TreeNames[] = {
+ "coast_treepatch",
+ "comparknewtrees",
+ "comtreepatchprk",
+ "condotree01",
+ "condotree1",
+ "indatree03",
+ "indtreepatch5",
+ "indtreepatch06f",
+ "new_carprktrees",
+ "new_carprktrees4",
+ "newcoasttrees1",
+ "newcoasttrees2",
+ "newcoasttrees3",
+ "newtreepatch_sub",
+ "newtrees1_sub",
+ "newunitrepatch",
+ "pinetree_narrow",
+ "pinetree_wide",
+ "treencom2",
+ "treepatch",
+ "treepatch01_sub",
+ "treepatch02_sub",
+ "treepatch2",
+ "treepatch2b",
+ "treepatch03",
+ "treepatch03_sub",
+ "treepatch04_sub",
+ "treepatch05_sub",
+ "treepatch06_sub",
+ "treepatch07_sub",
+ "treepatch08_sub",
+ "treepatch09_sub",
+ "treepatch10_sub",
+ "treepatch11_sub",
+ "treepatch12_sub",
+ "treepatch13_sub",
+ "treepatch14_sub",
+ "treepatch15_sub",
+ "treepatch16_sub",
+ "treepatch17_sub",
+ "treepatch18_sub",
+ "treepatch19_sub",
+ "treepatch20_sub",
+ "treepatch21_sub",
+ "treepatch22_sub",
+ "treepatch23_sub",
+ "treepatch24_sub",
+ "treepatch25_sub",
+ "treepatch26_sub",
+ "treepatch27_sub",
+ "treepatch28_sub",
+ "treepatch29_sub",
+ "treepatch30_sub",
+ "treepatch31_sub",
+ "treepatch32_sub",
+ "treepatch33_sub",
+ "treepatch34_sub",
+ "treepatch35_sub",
+ "treepatch69",
+ "treepatch152_sub",
+ "treepatch153_sub",
+ "treepatch171_sub",
+ "treepatch172_sub",
+ "treepatch173_sub",
+ "treepatch212_sub",
+ "treepatch213_sub",
+ "treepatch214_sub",
+ "treepatcha",
+ "treepatchb",
+ "treepatchcomtop1",
+ "treepatchd",
+ "treepatche",
+ "treepatchh",
+ "treepatchindaa2",
+ "treepatchindnew",
+ "treepatchindnew2",
+ "treepatchk",
+ "treepatchkb4",
+ "treepatchkb5",
+ "treepatchkb6",
+ "treepatchkb7",
+ "treepatchkb9",
+ "treepatchl",
+ "treepatchm",
+ "treepatchnew_sub",
+ "treepatchttwrs",
+ "treesuni1",
+ "trepatchindaa1",
+ "veg_bush2",
+ "veg_bush14",
+ "veg_tree1",
+ "veg_tree3",
+ "veg_treea1",
+ "veg_treea3",
+ "veg_treeb1",
+ "veg_treenew01",
+ "veg_treenew03",
+ "veg_treenew05",
+ "veg_treenew06",
+ "veg_treenew08",
+ "veg_treenew09",
+ "veg_treenew10",
+ "veg_treenew16",
+ "veg_treenew17",
+ "vegclubtree01",
+ "vegclubtree02",
+ "vegclubtree03",
+ "vegpathtree",
+ ""
+};
+char *OptimizedNames[] = {
+ "coast_treepatch",
+ "comparknewtrees",
+ "comtreepatchprk",
+ "indtreepatch5",
+ "indtreepatch06f",
+ "new_carprktrees",
+ "new_carprktrees4",
+ "newcoasttrees1",
+ "newcoasttrees2",
+ "newcoasttrees3",
+ "newtreepatch_sub",
+ "newtrees1_sub",
+ "newunitrepatch",
+ "treepatch",
+ "treepatch01_sub",
+ "treepatch02_sub",
+ "treepatch2",
+ "treepatch2b",
+ "treepatch03",
+ "treepatch03_sub",
+ "treepatch04_sub",
+ "treepatch05_sub",
+ "treepatch06_sub",
+ "treepatch07_sub",
+ "treepatch08_sub",
+ "treepatch09_sub",
+ "treepatch10_sub",
+ "treepatch11_sub",
+ "treepatch12_sub",
+ "treepatch13_sub",
+ "treepatch14_sub",
+ "treepatch15_sub",
+ "treepatch16_sub",
+ "treepatch17_sub",
+ "treepatch18_sub",
+ "treepatch19_sub",
+ "treepatch20_sub",
+ "treepatch21_sub",
+ "treepatch22_sub",
+ "treepatch23_sub",
+ "treepatch24_sub",
+ "treepatch25_sub",
+ "treepatch26_sub",
+ "treepatch27_sub",
+ "treepatch28_sub",
+ "treepatch29_sub",
+ "treepatch30_sub",
+ "treepatch31_sub",
+ "treepatch32_sub",
+ "treepatch33_sub",
+ "treepatch34_sub",
+ "treepatch35_sub",
+ "treepatch69",
+ "treepatch152_sub",
+ "treepatch153_sub",
+ "treepatch171_sub",
+ "treepatch172_sub",
+ "treepatch173_sub",
+ "treepatch212_sub",
+ "treepatch213_sub",
+ "treepatch214_sub",
+ "treepatcha",
+ "treepatchb",
+ "treepatchcomtop1",
+ "treepatchd",
+ "treepatche",
+ "treepatchh",
+ "treepatchindaa2",
+ "treepatchindnew",
+ "treepatchindnew2",
+ "treepatchk",
+ "treepatchkb4",
+ "treepatchkb5",
+ "treepatchkb6",
+ "treepatchkb7",
+ "treepatchkb9",
+ "treepatchl",
+ "treepatchm",
+ "treepatchnew_sub",
+ "treepatchttwrs",
+ "treesuni1",
+ "trepatchindaa1",
+ "combtm_treeshad01",
+ "combtm_treeshad02",
+ "combtm_treeshad03",
+ "combtm_treeshad04",
+ "combtm_treeshad05",
+ "combtm_treeshad06",
+ "comtop_tshad",
+ "comtop_tshad2",
+ "comtop_tshad3",
+ "comtop_tshad4",
+ "comtop_tshad5",
+ "comtop_tshad6",
+ "se_treeshad01",
+ "se_treeshad02",
+ "se_treeshad03",
+ "se_treeshad04",
+ "se_treeshad05",
+ "se_treeshad06",
+ "treeshads01",
+ "treeshads02",
+ "treeshads03",
+ "treeshads04",
+ "treeshads05",
+ ""
+};
+// not from mobile
+static bool
+MatchModelName(char *name, char **list)
+{
+ int i;
+ char *s;
+ for(i = 0; *list[i] != '\0'; i++)
+ if(strncmp(name, "LOD", 3) == 0){
+ if(!CGeneral::faststricmp(name+3, list[i]+3))
+ return true;
+ }else{
+ if(!CGeneral::faststricmp(name, list[i]))
+ return true;
+ }
+ return false;
+}
+#endif
+
RpAtomic*
CFileLoader::SetRelatedModelInfoCB(RpAtomic *atomic, void *data)
{
@@ -600,6 +929,21 @@ SetModelInfoFlags(CSimpleModelInfo *mi, uint32 flags)
mi->m_isSubway = !!(flags & 0x10);
mi->m_ignoreLight = !!(flags & 0x20);
mi->m_noZwrite = !!(flags & 0x40);
+#ifdef EXTRA_MODEL_FLAGS
+ // same flag values as SA
+ mi->m_bIsTree = !!(flags & 0x2000);
+ mi->m_bIsDoubleSided = !!(flags & 0x200000);
+ // new value otherwise unused
+ mi->m_bCanBeIgnored = !!(flags & 0x10000);
+
+#ifdef HARDCODED_MODEL_FLAGS
+ // mobile sets these flags in CFileLoader::SetRelatedModelInfoCB, but that's stupid
+ if(MatchModelName(mi->GetName(), DoubleSidedNames)) mi->m_bIsDoubleSided = true;
+ if(MatchModelName(mi->GetName(), TreeNames)) mi->m_bIsTree = true;
+ if(MatchModelName(mi->GetName(), OptimizedNames)) mi->m_bCanBeIgnored = true;
+#endif
+
+#endif
}
void
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index 8f1204e3..cf25e1b9 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -768,6 +768,7 @@ CMenuManager::Draw()
CFont::SetJustifyOn();
CFont::SetBackGroundOnlyTextOn();
#ifdef GTA3_1_1_PATCH
+#ifdef DRAW_MENU_VERSION_TEXT
CFont::SetColor(CRGBA(235, 170, 50, FadeIn(255)));
CFont::SetRightJustifyOn();
CFont::SetFontStyle(FONT_HEADING);
@@ -778,6 +779,7 @@ CMenuManager::Draw()
AsciiToUnicode(gString, gUString);
CFont::PrintString(SCREEN_WIDTH / 10, SCREEN_HEIGHT / 45, gUString);
#endif
+#endif
CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENU_X_MARGIN));
CFont::SetRightJustifyWrap(SCREEN_SCALE_X(MENUACTION_WIDTH));
diff --git a/src/core/Frontend_PS2.cpp b/src/core/Frontend_PS2.cpp
index d474ee65..a1d802f2 100644
--- a/src/core/Frontend_PS2.cpp
+++ b/src/core/Frontend_PS2.cpp
@@ -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)
@@ -3044,4 +3044,4 @@ CMenuManager::FilterOutColorMarkersFromString(wchar *string, CRGBA &color)
*dst = '\0';
}
-#endif \ No newline at end of file
+#endif
diff --git a/src/core/config.h b/src/core/config.h
index 171c6be9..ea4330a4 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -156,6 +156,23 @@ enum Config {
// any debug stuff that is only left in mobile, is not in MASTER
//#define MASTER
+// once and for all:
+// pc: FINAL & MASTER
+// mobile: FINAL
+
+// MASTER builds must be FINAL
+#ifdef MASTER
+#define FINAL
+#endif
+
+// quality of life fixes that should also be in FINAL
+#define NASTY_GAME // nasty game for all languages
+#define NO_CDCHECK
+
+// those infamous texts
+#define DRAW_GAME_VERSION_TEXT
+#define DRAW_MENU_VERSION_TEXT
+
#if defined GTA_PS2
# define GTA_PS2_STUFF
# define RANDOMSPLASH
@@ -177,9 +194,13 @@ enum Config {
#ifdef MASTER
// only in master builds
+ #undef DRAW_GAME_VERSION_TEXT
#else
// not in master builds
#define VALIDATE_SAVE_SIZE
+
+ #define NO_MOVIES // disable intro videos
+ #define DEBUGMENU
#endif
#ifdef FINAL
@@ -187,11 +208,7 @@ enum Config {
# define USE_MY_DOCUMENTS // use my documents directory for user files
#else
// not in any game
-# define NASTY_GAME // nasty game for all languages
-# define NO_MOVIES // disable intro videos
-# define NO_CDCHECK
# define CHATTYSPLASH // print what the game is loading
-# define DEBUGMENU
# define TIMEBARS // print debug timers
#endif
@@ -201,6 +218,9 @@ enum Config {
#define LOAD_INI_SETTINGS
// Rendering/display
+//#define EXTRA_MODEL_FLAGS // from mobile to optimize rendering
+//# define HARDCODED_MODEL_FLAGS // sets the flags enabled above from hardcoded model names.
+ // NB: keep this enabled unless your map IDEs have these flags baked in
#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios
#define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch)
#define USE_TXD_CDIMAGE // generate and load textures from txd.img
diff --git a/src/core/main.cpp b/src/core/main.cpp
index fa82d1e1..36c94043 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -776,6 +776,8 @@ DisplayGameDebugText()
char str[200];
wchar ustr[200];
+
+#ifdef DRAW_GAME_VERSION_TEXT
wchar ver[200];
AsciiToUnicode(version_name, ver);
@@ -791,6 +793,7 @@ DisplayGameDebugText()
CFont::SetBackGroundOnlyTextOff();
CFont::SetColor(CRGBA(255, 108, 0, 255));
CFont::PrintString(SCREEN_SCALE_X(10.0f), SCREEN_SCALE_Y(10.0f), ver);
+#endif
FrameSamples++;
FramesPerSecondCounter += 1000.0f / (CTimer::GetTimeStepNonClippedInSeconds() * 1000.0f);
diff --git a/src/extras/custompipes.cpp b/src/extras/custompipes.cpp
index b545b4d8..8c2b6916 100644
--- a/src/extras/custompipes.cpp
+++ b/src/extras/custompipes.cpp
@@ -337,7 +337,7 @@ ReadTweakValueTable(char *fp, InterpolatedValue &interp)
* Neo Vehicle pipe
*/
-int32 VehiclePipeSwitch = VEHICLEPIPE_NEO;
+int32 VehiclePipeSwitch = VEHICLEPIPE_MATFX;
float VehicleShininess = 0.7f; // the default is a bit extreme
float VehicleSpecularity = 1.0f;
InterpolatedFloat Fresnel(0.4f);
diff --git a/src/modelinfo/BaseModelInfo.h b/src/modelinfo/BaseModelInfo.h
index 783f871f..2505967b 100644
--- a/src/modelinfo/BaseModelInfo.h
+++ b/src/modelinfo/BaseModelInfo.h
@@ -31,6 +31,14 @@ protected:
ModelInfoType m_type;
uint8 m_num2dEffects;
bool m_bOwnsColModel;
+#ifdef EXTRA_MODEL_FLAGS
+public:
+ // from mobile
+ bool m_bIsDoubleSided;
+ bool m_bIsTree;
+ bool m_bCanBeIgnored; // for low-end devices
+ bool RenderDoubleSided(void) { return m_bIsDoubleSided || m_bIsTree; }
+#endif
public:
CBaseModelInfo(ModelInfoType type);
diff --git a/src/modelinfo/ClumpModelInfo.cpp b/src/modelinfo/ClumpModelInfo.cpp
index 49198437..1ae936a7 100644
--- a/src/modelinfo/ClumpModelInfo.cpp
+++ b/src/modelinfo/ClumpModelInfo.cpp
@@ -5,6 +5,7 @@
#include "NodeName.h"
#include "VisibilityPlugins.h"
#include "ModelInfo.h"
+#include "ModelIndices.h"
void
CClumpModelInfo::DeleteRwObject(void)
@@ -110,12 +111,18 @@ CClumpModelInfo::SetClump(RpClump *clump)
weights->w3 /= sum;
}
RpHAnimHierarchySetFlags(hier, (RpHAnimHierarchyFlag)(rpHANIMHIERARCHYUPDATEMODELLINGMATRICES|rpHANIMHIERARCHYUPDATELTMS));
- }else
-#endif
- // do not set on skinned clip because cutscene head is not compatible with player head
- if(strncmp(GetName(), "playerh", 8) == 0)
+ }
+ if(strncmp(GetName(), "playerh", 8) == 0){
+ // playerh is incompatible with the xbox player skin
+ // so check if player model is skinned and only apply skin to head if it isn't
+ CPedModelInfo *body = (CPedModelInfo*)CModelInfo::GetModelInfo(MI_PLAYER);
+ if(!(body->m_clump && IsClumpSkinned(body->m_clump)))
RpClumpForAllAtomics(clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
-
+ }
+#else
+ if(strncmp(GetName(), "playerh", 8) == 0){
+ RpClumpForAllAtomics(clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB);
+#endif
}
void
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index 83c493bb..3d6e59f6 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -247,7 +247,7 @@ void CHud::Draw()
rect.right = SCREEN_WIDTH/2 + SCREEN_SCALE_X(210.0f);
rect.bottom = SCREEN_HEIGHT/2 + SCREEN_SCALE_Y(210.0f);
Sprites[HUD_SITESNIPER].Draw(CRect(rect), CRGBA(255, 255, 255, 255),
- 0.99f, 0.99f, 0.01f, 0.99f, 0.99f, 0.01f, 0.1f, 0.01f);
+ 0.99f, 0.99f, 0.01f, 0.99f, 0.99f, 0.01f, 0.01f, 0.01f);
}
}
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void *)rwFILTERLINEAR);
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 8c194067..4ad1d3b9 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -53,6 +53,14 @@ CVehicle *CRenderer::m_pFirstPersonVehicle;
bool CRenderer::m_loadingPriority;
float CRenderer::ms_lodDistScale = 1.2f;
+#ifdef EXTRA_MODEL_FLAGS
+#define BACKFACE_CULLING_ON SetCullMode(rwCULLMODECULLBACK)
+#define BACKFACE_CULLING_OFF SetCullMode(rwCULLMODECULLNONE)
+#else
+#define BACKFACE_CULLING_ON
+#define BACKFACE_CULLING_OFF
+#endif
+
void
CRenderer::Init(void)
{
@@ -102,6 +110,13 @@ CRenderer::RenderOneRoad(CEntity *e)
#ifdef EXTENDED_PIPELINES
CustomPipes::AttachGlossPipe(e->GetAtomic());
#endif
+#ifdef EXTRA_MODEL_FLAGS
+ if(CModelInfo::GetModelInfo(e->GetModelIndex())->RenderDoubleSided()){
+ BACKFACE_CULLING_OFF;
+ e->Render();
+ BACKFACE_CULLING_ON;
+ }else
+#endif
e->Render();
}
}
@@ -163,13 +178,22 @@ CRenderer::RenderOneNonRoad(CEntity *e)
for(i = 0; i < 8; i++)
if(veh->pPassengers[i] && veh->pPassengers[i]->m_nPedState == PED_DRIVING)
veh->pPassengers[i]->Render();
+ BACKFACE_CULLING_OFF;
}
+#ifdef EXTRA_MODEL_FLAGS
+ if(CModelInfo::GetModelInfo(e->GetModelIndex())->RenderDoubleSided()){
+ BACKFACE_CULLING_OFF;
+ e->Render();
+ BACKFACE_CULLING_ON;
+ }else
+#endif
e->Render();
if(e->IsVehicle()){
e->bImBeingRendered = true;
CVisibilityPlugins::RenderAlphaAtomics();
e->bImBeingRendered = false;
+ BACKFACE_CULLING_ON;
}
e->RemoveLighting(resetLights);
@@ -197,6 +221,7 @@ CRenderer::RenderRoads(void)
CTreadable *t;
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
+ BACKFACE_CULLING_ON;
DeActivateDirectional();
SetAmbientColours();
@@ -230,6 +255,7 @@ CRenderer::RenderEverythingBarRoads(void)
CVector dist;
EntityInfo ei;
+ BACKFACE_CULLING_ON;
gSortedVehiclesAndPeds.Clear();
for(i = 0; i < ms_nNoOfVisibleEntities; i++){
@@ -284,6 +310,8 @@ CRenderer::RenderBoats(void)
{
CLink<EntityInfo> *node;
+ BACKFACE_CULLING_ON;
+
for(node = gSortedVehiclesAndPeds.tail.prev;
node != &gSortedVehiclesAndPeds.head;
node = node->prev){
@@ -298,6 +326,7 @@ void
CRenderer::RenderFadingInEntities(void)
{
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
+ BACKFACE_CULLING_ON;
DeActivateDirectional();
SetAmbientColours();
CVisibilityPlugins::RenderFadingEntities();
diff --git a/src/rw/RwHelper.cpp b/src/rw/RwHelper.cpp
index 4b598e9b..35af1ebd 100644
--- a/src/rw/RwHelper.cpp
+++ b/src/rw/RwHelper.cpp
@@ -3,11 +3,14 @@
#endif
#include "common.h"
+#include "RwHelper.h"
#include "Timecycle.h"
#include "skeleton.h"
#include "Debug.h"
-#ifndef FINAL
+#if !defined(FINAL) || defined(DEBUGMENU)
#include "rtcharse.h"
+#endif
+#ifndef FINAL
RtCharset *debugCharset;
#endif
@@ -16,8 +19,9 @@ bool gPS2alphaTest = true;
#else
bool gPS2alphaTest = false;
#endif
+bool gBackfaceCulling = true;
-#ifndef FINAL
+#if !defined(FINAL) || defined(DEBUGMENU)
static bool charsetOpen;
void OpenCharsetSafe()
{
@@ -121,14 +125,32 @@ DefinedState(void)
#ifdef LIBRW
rw::SetRenderState(rw::ALPHATESTFUNC, rw::ALPHAGREATEREQUAL);
- rw::SetRenderState(rw::ALPHATESTREF, 3);
rw::SetRenderState(rw::GSALPHATEST, gPS2alphaTest);
#else
// D3D stuff
RwD3D8SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER);
- RwD3D8SetRenderState(D3DRS_ALPHAREF, 2);
#endif
+ SetAlphaRef(2);
+}
+
+void
+SetAlphaRef(int ref)
+{
+#ifdef LIBRW
+ rw::SetRenderState(rw::ALPHATESTREF, ref+1);
+#else
+ RwD3D8SetRenderState(D3DRS_ALPHAREF, ref);
+#endif
+}
+
+void
+SetCullMode(uint32 mode)
+{
+ if(gBackfaceCulling)
+ RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)mode);
+ else
+ RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE);
}
RwFrame*
diff --git a/src/rw/RwHelper.h b/src/rw/RwHelper.h
index eceaee07..130eb636 100644
--- a/src/rw/RwHelper.h
+++ b/src/rw/RwHelper.h
@@ -11,6 +11,8 @@ void DestroyDebugFont();
void ObrsPrintfString(const char *str, short x, short y);
void FlushObrsPrintfs();
void DefinedState(void);
+void SetAlphaRef(int ref);
+void SetCullMode(uint32 mode);
RwFrame *GetFirstChild(RwFrame *frame);
RwObject *GetFirstObject(RwFrame *frame);
RpAtomic *GetFirstAtomic(RpClump *clump);
diff --git a/src/rw/VisibilityPlugins.cpp b/src/rw/VisibilityPlugins.cpp
index b2e252a0..8878a26a 100644
--- a/src/rw/VisibilityPlugins.cpp
+++ b/src/rw/VisibilityPlugins.cpp
@@ -1,5 +1,6 @@
#include "common.h"
+#include "RwHelper.h"
#include "templates.h"
#include "Entity.h"
#include "ModelInfo.h"
@@ -158,6 +159,10 @@ CVisibilityPlugins::RenderFadingEntities(void)
if(mi->m_noZwrite)
#endif
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE);
+#ifdef EXTRA_MODEL_FLAGS
+ else if(mi->m_bIsTree)
+ SetAlphaRef(128);
+#endif
if(e->bDistanceFade){
DeActivateDirectional();
@@ -168,6 +173,10 @@ CVisibilityPlugins::RenderFadingEntities(void)
}else
CRenderer::RenderOneNonRoad(e);
+#ifdef EXTRA_MODEL_FLAGS
+ if(mi->m_bIsTree)
+ SetAlphaRef(2);
+#endif
#ifdef FIX_BUGS
if(mi->GetModelType() == MITYPE_SIMPLE && mi->m_noZwrite)
#else
diff --git a/src/save/MemoryCard.cpp b/src/save/MemoryCard.cpp
index a24b754c..c8ebcd86 100644
--- a/src/save/MemoryCard.cpp
+++ b/src/save/MemoryCard.cpp
@@ -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"