summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/CdStreamPosix.cpp2
-rw-r--r--src/core/ControllerConfig.cpp408
-rw-r--r--src/core/FileLoader.cpp344
-rw-r--r--src/core/Frontend.cpp12
-rw-r--r--src/core/Game.cpp38
-rw-r--r--src/core/Pad.cpp8
-rw-r--r--src/core/Radar.cpp100
-rw-r--r--src/core/Radar.h16
-rw-r--r--src/core/TempColModels.cpp8
-rw-r--r--src/core/World.cpp18
-rw-r--r--src/core/config.h28
-rw-r--r--src/core/main.cpp56
-rw-r--r--src/core/main.h2
-rw-r--r--src/core/re3.cpp44
-rw-r--r--src/core/timebars.h9
15 files changed, 937 insertions, 156 deletions
diff --git a/src/core/CdStreamPosix.cpp b/src/core/CdStreamPosix.cpp
index fdc63a05..5c8d1b16 100644
--- a/src/core/CdStreamPosix.cpp
+++ b/src/core/CdStreamPosix.cpp
@@ -216,10 +216,12 @@ CdStreamShutdown(void)
#ifndef ONE_THREAD_PER_CHANNEL
gCdStreamThreadStatus = 2;
sem_post(gCdStreamSema);
+ pthread_join(_gCdStreamThread, nil);
#else
for ( int32 i = 0; i < gNumChannels; i++ ) {
gpReadInfo[i].nThreadStatus = 2;
sem_post(gpReadInfo[i].pStartSemaphore);
+ pthread_join(gpReadInfo[i].pChannelThread, nil);
}
#endif
}
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 db3774a7..dca9685e 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -783,16 +783,18 @@ 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);
CFont::SetScale(MENU_X(0.7f), MENU_Y(0.5f));
- CFont::SetWrapx(SCREEN_WIDTH);
+ CFont::SetWrapx(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH));
CFont::SetRightJustifyWrap(0.0f);
strcpy(gString, "V1.1");
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));
@@ -873,7 +875,7 @@ CMenuManager::Draw()
#endif
}
- CFont::SetCentreSize(SCREEN_WIDTH);
+ CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH));
#ifdef PS2_LIKE_MENU
bool itemsAreSelectable = !bottomBarActive;
@@ -3575,11 +3577,11 @@ CMenuManager::MessageScreen(const char *text)
CFont::SetPropOn();
CFont::SetJustifyOn();
CFont::SetBackGroundOnlyTextOn();
- CFont::SetWrapx(SCREEN_WIDTH - StretchX(170.0f));
- CFont::SetRightJustifyWrap(SCREEN_WIDTH - StretchX(170.0f));
+ CFont::SetWrapx(SCREEN_WIDTH - StretchX(170.0f)); // not used
+ CFont::SetRightJustifyWrap(SCREEN_WIDTH - StretchX(170.0f)); // not used
CSprite2d::DrawRect(CRect(StretchX(120.0f), StretchY(150.0f), SCREEN_WIDTH - StretchX(120.0f), SCREEN_HEIGHT - StretchY(220.0f)), CRGBA(50, 50, 50, 210));
CFont::SetFontStyle(FONT_LOCALE(FONT_BANK));
- CFont::SetCentreSize(SCREEN_STRETCH_X(380.0f));
+ CFont::SetCentreSize(SCREEN_SCALE_X(380.0f));
CFont::SetCentreOn();
CFont::SetColor(CRGBA(255, 217, 106, 255));
CFont::SetScale(SCREEN_SCALE_X(SMALLTEXT_X_SCALE), SCREEN_SCALE_Y(SMALLTEXT_Y_SCALE));
diff --git a/src/core/Game.cpp b/src/core/Game.cpp
index 93f0d1b0..ef4800c5 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -89,6 +89,7 @@
#include "frontendoption.h"
#include "postfx.h"
#include "custompipes.h"
+#include "crossplatform.h"
eLevelName CGame::currLevel;
bool CGame::bDemoMode = true;
@@ -128,10 +129,10 @@ void MessageScreen(char *msg)
CFont::SetFontStyle(FONT_BANK);
CFont::SetBackgroundOff();
- CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(190.0f)); // 450.0f
+ CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(190.0f)); // 450.0f // unused
CFont::SetScale(SCREEN_SCALE_X(1.0f), SCREEN_SCALE_Y(1.0f));
CFont::SetCentreOn();
- CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(190.0f)); // 450.0f
+ CFont::SetCentreSize(SCREEN_SCALE_X(450.0f)); // 450.0f
CFont::SetJustifyOff();
CFont::SetColor(CRGBA(255, 255, 255, 255));
CFont::SetDropColor(CRGBA(32, 32, 32, 255));
@@ -277,12 +278,31 @@ bool CGame::InitialiseOnceAfterRW(void)
if ( DMAudio.GetNum3DProvidersAvailable() == 0 )
FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = -1;
- if ( FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == -99 || FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == -2 )
- {
+ if ( FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == -99 || FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == -2 ) {
CMenuManager::m_PrefsSpeakers = 0;
- int8 provider = DMAudio.AutoDetect3DProviders();
- if ( provider != -1 )
- FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = provider;
+ int32 i;
+ for (i = 0; i < DMAudio.GetNum3DProvidersAvailable(); i++) {
+ wchar buff[64];
+
+#ifdef AUDIO_OAL
+ extern int defaultProvider;
+ if (defaultProvider >= 0 && defaultProvider < DMAudio.GetNum3DProvidersAvailable())
+ break;
+#endif
+ char *name = DMAudio.Get3DProviderName(i);
+ AsciiToUnicode(name, buff);
+ char *providername = UnicodeToAscii(buff);
+ strupr(providername);
+#if defined(AUDIO_MSS)
+ if (strcmp(providername, "MILES FAST 2D POSITIONAL AUDIO") == 0)
+ break;
+#elif defined(AUDIO_OAL)
+ if (strcmp(providername, "OPENAL SOFT") == 0)
+ break;
+#endif
+ }
+
+ FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = i;
}
DMAudio.SetCurrent3DProvider(FrontEndMenuManager.m_nPrefsAudio3DProviderIndex);
@@ -725,10 +745,10 @@ void CGame::InitialiseWhenRestarting(void)
//CFont::SetFontStyle(?);
CFont::SetBackgroundOff();
- CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(160.0f)); // 480.0f
+ CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(160.0f)); // 480.0f // unused
CFont::SetScale(SCREEN_SCALE_X(1.0f), SCREEN_SCALE_Y(1.0f));
CFont::SetCentreOn();
- CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(160.0f)); // 480.0f
+ CFont::SetCentreSize(SCREEN_SCALE_X(480.0f)); // 480.0f
CFont::SetJustifyOff();
CFont::SetColor(CRGBA(255, 255, 255, 255));
CFont::SetBackGroundOnlyTextOff();
diff --git a/src/core/Pad.cpp b/src/core/Pad.cpp
index 3b46a110..0e2f06a6 100644
--- a/src/core/Pad.cpp
+++ b/src/core/Pad.cpp
@@ -2399,7 +2399,7 @@ bool CPad::GetAnaloguePadLeftJustUp(void)
if ( X == 0 && oldfStickX < 0 )
{
- oldfStickX = X;
+ oldfStickX = 0;
return true;
}
@@ -2419,7 +2419,7 @@ bool CPad::GetAnaloguePadRightJustUp(void)
if ( X == 0 && oldfStickX > 0 )
{
- oldfStickX = X;
+ oldfStickX = 0;
return true;
}
@@ -2593,7 +2593,7 @@ void CPad::PrintErrorMessage(void)
CFont::SetScale(0.85f, 1.0f);
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
- CFont::SetCentreSize(SCREEN_WIDTH - 20);
+ CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 20));
CFont::SetCentreOn();
CFont::SetPropOn();
CFont::SetColor(CRGBA(255, 255, 200, 200));
@@ -2610,7 +2610,7 @@ void CPad::PrintErrorMessage(void)
CFont::SetScale(0.85f, 1.0f);
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
- CFont::SetCentreSize(SCREEN_WIDTH - 20);
+ CFont::SetCentreSize(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH - 20));
CFont::SetCentreOn();
CFont::SetPropOn();
CFont::SetColor(CRGBA(255, 255, 200, 200));
diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp
index af28aae7..816da6b9 100644
--- a/src/core/Radar.cpp
+++ b/src/core/Radar.cpp
@@ -84,10 +84,6 @@ static_assert(RADAR_TILE_SIZE == (RADAR_SIZE_Y / RADAR_NUM_TILES), "CRadar: not
#define RADAR_MAX_SPEED (0.9f)
#ifdef MENU_MAP
-CRGBA CRadar::ArrowBlipColour1;
-CRGBA CRadar::ArrowBlipColour2;
-uint16 CRadar::MapLegendCounter;
-uint16 CRadar::MapLegendList[NUM_MAP_LEGENDS];
int CRadar::TargetMarkerId = -1;
CVector CRadar::TargetMarkerPos;
#endif
@@ -116,7 +112,7 @@ void RequestMapSection(int32 x, int32 y)
void RemoveMapSection(int32 x, int32 y)
{
- if (x >= 0 && x <= 7 && y >= 0 && y <= 7)
+ if (x >= 0 && x <= RADAR_NUM_TILES - 1 && y >= 0 && y <= RADAR_NUM_TILES - 1)
CStreaming::RemoveTxd(gRadarTxdIds[x + RADAR_NUM_TILES * y]);
}
@@ -709,6 +705,7 @@ void CRadar::DrawBlips()
if (CMenuManager::bMenuMapActive) {
CVector2D in, out;
TransformRealWorldPointToRadarSpace(in, FindPlayerCentreOfWorld_NoSniperShift());
+ LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in);
DrawYouAreHereSprite(out.x, out.y);
}
@@ -782,14 +779,20 @@ void CRadar::DrawRadarMask()
};
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)FALSE);
- RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDZERO);
- RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT);
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
+#if !defined(GTA_PS2_STUFF) && defined(RWLIBS)
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
+ RwD3D8SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_ALWAYS);
+#else
+ RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDZERO);
+ RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
+#endif
CVector2D out[8];
CVector2D in;
@@ -810,7 +813,10 @@ void CRadar::DrawRadarMask()
CSprite2d::SetMaskVertices(8, (float *)out);
RwIm2DRenderPrimitive(rwPRIMTYPETRIFAN, CSprite2d::GetVertices(), 8);
- };
+ }
+#if !defined(GTA_PS2_STUFF) && defined(RWLIBS)
+ RwD3D8SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER);
+#endif
}
void CRadar::DrawRadarSection(int32 x, int32 y)
@@ -860,46 +866,22 @@ void CRadar::DrawRadarSection(int32 x, int32 y)
void CRadar::DrawRadarSprite(uint16 sprite, float x, float y, uint8 alpha)
{
RadarSprites[sprite]->Draw(CRect(x - SCREEN_SCALE_X(8.0f), y - SCREEN_SCALE_Y(8.0f), x + SCREEN_SCALE_X(8.0f), y + SCREEN_SCALE_Y(8.0f)), CRGBA(255, 255, 255, alpha));
-#ifdef MENU_MAP
- if (CMenuManager::bMenuMapActive) {
- bool alreadyThere = false;
- for (int i = 0; i < NUM_MAP_LEGENDS; i++) {
- if (MapLegendList[i] == sprite)
- alreadyThere = true;
- }
- if (!alreadyThere) {
- MapLegendList[MapLegendCounter] = sprite;
- MapLegendCounter++;
- }
- }
-#endif
}
void CRadar::DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int32 alpha)
{
CVector curPosn[4];
- CVector oldPosn[4];
-
- curPosn[0].x = x - SCREEN_SCALE_X(5.6f);
- curPosn[0].y = y + SCREEN_SCALE_Y(5.6f);
-
- curPosn[1].x = x + SCREEN_SCALE_X(5.6f);
- curPosn[1].y = y + SCREEN_SCALE_Y(5.6f);
-
- curPosn[2].x = x - SCREEN_SCALE_X(5.6f);
- curPosn[2].y = y - SCREEN_SCALE_Y(5.6f);
-
- curPosn[3].x = x + SCREEN_SCALE_X(5.6f);
- curPosn[3].y = y - SCREEN_SCALE_Y(5.6f);
+ const float sizeX = SCREEN_SCALE_X(8.0f);
+ const float correctedAngle = angle - PI / 4.f;
+ const float sizeY = SCREEN_SCALE_Y(8.0f);
for (uint32 i = 0; i < 4; i++) {
- oldPosn[i] = curPosn[i];
-
- curPosn[i].x = x + (oldPosn[i].x - x) * Cos(angle) + (oldPosn[i].y - y) * Sin(angle);
- curPosn[i].y = y - (oldPosn[i].x - x) * Sin(angle) + (oldPosn[i].y - y) * Cos(angle);
+ const float cornerAngle = i * HALFPI + correctedAngle;
+ curPosn[i].x = x + (0.0f * Cos(cornerAngle) + 1.0f * Sin(cornerAngle)) * sizeX;
+ curPosn[i].y = y - (0.0f * Sin(cornerAngle) - 1.0f * Cos(cornerAngle)) * sizeY;
}
- sprite->Draw(curPosn[2].x, curPosn[2].y, curPosn[3].x, curPosn[3].y, curPosn[0].x, curPosn[0].y, curPosn[1].x, curPosn[1].y, CRGBA(255, 255, 255, alpha));
+ sprite->Draw(curPosn[3].x, curPosn[3].y, curPosn[2].x, curPosn[2].y, curPosn[0].x, curPosn[0].y, curPosn[1].x, curPosn[1].y, CRGBA(255, 255, 255, alpha));
}
int32 CRadar::GetActualBlipArrayIndex(int32 i)
@@ -925,43 +907,43 @@ uint32 CRadar::GetRadarTraceColour(uint32 color, bool bright)
{
int32 c;
switch (color) {
- case 0:
+ case RADAR_TRACE_RED:
if (bright)
c = 0x712B49FF;
else
c = 0x7F0000FF;
break;
- case 1:
+ case RADAR_TRACE_GREEN:
if (bright)
c = 0x5FA06AFF;
else
c = 0x007F00FF;
break;
- case 2:
+ case RADAR_TRACE_LIGHT_BLUE:
if (bright)
c = 0x80A7F3FF;
else
c = 0x00007FFF;
break;
- case 3:
+ case RADAR_TRACE_GRAY:
if (bright)
c = 0xE1E1E1FF;
else
c = 0x7F7F7FFF;
break;
- case 4:
+ case RADAR_TRACE_YELLOW:
if (bright)
c = 0xFFFF00FF;
else
c = 0x7F7F00FF;
break;
- case 5:
+ case RADAR_TRACE_MAGENTA:
if (bright)
c = 0xFF00FFFF;
else
c = 0x7F007FFF;
break;
- case 6:
+ case RADAR_TRACE_CYAN:
if (bright)
c = 0x00FFFFFF;
else
@@ -1215,21 +1197,6 @@ void CRadar::ShowRadarTraceWithHeight(float x, float y, uint32 size, uint8 red,
CSprite2d::DrawRect(CRect(x - SCREEN_SCALE_X(size), y - SCREEN_SCALE_Y(size), SCREEN_SCALE_X(size) + x, SCREEN_SCALE_Y(size) + y), CRGBA(red, green, blue, alpha));
break;
}
-#ifdef MENU_MAP
- // VC uses -1 for coords and -2 for entities but meh, I don't want to edit DrawBlips
- if (CMenuManager::bMenuMapActive) {
- bool alreadyThere = false;
- for (int i = 0; i < NUM_MAP_LEGENDS; i++) {
- if (MapLegendList[i] == -1)
- alreadyThere = true;
- }
- if (!alreadyThere) {
- MapLegendList[MapLegendCounter] = -1;
- MapLegendCounter++;
- ArrowBlipColour1 = CRGBA(red, green, blue, alpha);
- }
- }
-#endif
}
void CRadar::Shutdown()
@@ -1415,12 +1382,6 @@ CRadar::InitFrontEndMap()
vec2DRadarOrigin.x = 0.0f;
vec2DRadarOrigin.y = 0.0f;
m_radarRange = 1000.0f; // doesn't mean anything, just affects the calculation in TransformRadarPointToScreenSpace
- for (int i = 0; i < NUM_MAP_LEGENDS; i++) {
- MapLegendList[i] = RADAR_SPRITE_NONE;
- }
- MapLegendCounter = 0;
- ArrowBlipColour1 = CRGBA(0, 0, 0, 0);
- ArrowBlipColour2 = CRGBA(0, 0, 0, 0);
}
void
@@ -1448,7 +1409,6 @@ CRadar::DrawYouAreHereSprite(float x, float y)
float bottom = y - SCREEN_SCALE_Y(24.0f);
CentreSprite.Draw(CRect(left, top, right, bottom), CRGBA(255, 255, 255, 255));
}
- MapLegendList[MapLegendCounter++] = RADAR_SPRITE_CENTRE;
}
void
@@ -1465,8 +1425,8 @@ CRadar::ToggleTargetMarker(float x, float y)
return;
#endif
ms_RadarTrace[nextBlip].m_eBlipType = BLIP_COORD;
- ms_RadarTrace[nextBlip].m_nColor = 0x333333FF;
- ms_RadarTrace[nextBlip].m_bDim = 1;
+ ms_RadarTrace[nextBlip].m_nColor = RADAR_TRACE_GRAY;
+ ms_RadarTrace[nextBlip].m_bDim = 0;
ms_RadarTrace[nextBlip].m_bInUse = 1;
ms_RadarTrace[nextBlip].m_Radius = 1.0f;
CVector pos(x, y, CWorld::FindGroundZForCoord(x,y));
diff --git a/src/core/Radar.h b/src/core/Radar.h
index ec2bacd0..793d62b0 100644
--- a/src/core/Radar.h
+++ b/src/core/Radar.h
@@ -51,6 +51,17 @@ enum eRadarSprite
enum
{
+ RADAR_TRACE_RED,
+ RADAR_TRACE_GREEN,
+ RADAR_TRACE_LIGHT_BLUE,
+ RADAR_TRACE_GRAY,
+ RADAR_TRACE_YELLOW,
+ RADAR_TRACE_MAGENTA,
+ RADAR_TRACE_CYAN
+};
+
+enum
+{
BLIP_MODE_TRIANGULAR_UP = 0,
BLIP_MODE_TRIANGULAR_DOWN,
BLIP_MODE_SQUARE,
@@ -108,11 +119,6 @@ public:
static float cachedCos;
static float cachedSin;
#ifdef MENU_MAP
-#define NUM_MAP_LEGENDS 75
- static CRGBA ArrowBlipColour1;
- static CRGBA ArrowBlipColour2;
- static uint16 MapLegendList[NUM_MAP_LEGENDS];
- static uint16 MapLegendCounter;
static int TargetMarkerId;
static CVector TargetMarkerPos;
diff --git a/src/core/TempColModels.cpp b/src/core/TempColModels.cpp
index ab73631d..f6796909 100644
--- a/src/core/TempColModels.cpp
+++ b/src/core/TempColModels.cpp
@@ -21,7 +21,11 @@ CColModel CTempColModels::ms_colModelBonnet1;
CColSphere s_aPedSpheres[3];
CColSphere s_aPed2Spheres[3];
CColSphere s_aPedGSpheres[4];
+#ifdef FIX_BUGS
+CColSphere s_aDoorSpheres[3];
+#else
CColSphere s_aDoorSpheres[4];
+#endif
CColSphere s_aBumperSpheres[4];
CColSphere s_aPanelSpheres[4];
CColSphere s_aBonnetSpheres[4];
@@ -129,7 +133,11 @@ CTempColModels::Initialise(void)
s_aDoorSpheres[1].center = CVector(0.0f, -0.95f, -0.35f);
s_aDoorSpheres[2].center = CVector(0.0f, -0.6f, 0.25f);
+#ifdef FIX_BUGS
for (i = 0; i < ARRAY_SIZE(s_aDoorSpheres); i++) {
+#else
+ for (i = 0; i < ARRAY_SIZE(s_aPed2Spheres); i++) {
+#endif
s_aDoorSpheres[i].surface = SURFACE_CAR_PANEL;
s_aDoorSpheres[i].piece = 0;
}
diff --git a/src/core/World.cpp b/src/core/World.cpp
index 7f8d8994..d65d57dd 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -75,7 +75,7 @@ CWorld::Add(CEntity *ent)
if(ent->IsBuilding() || ent->IsDummy()) return;
- if(!ent->IsStatic()) ((CPhysical *)ent)->AddToMovingList();
+ if(!ent->GetIsStatic()) ((CPhysical *)ent)->AddToMovingList();
}
void
@@ -90,7 +90,7 @@ CWorld::Remove(CEntity *ent)
if(ent->IsBuilding() || ent->IsDummy()) return;
- if(!ent->IsStatic()) ((CPhysical *)ent)->RemoveFromMovingList();
+ if(!ent->GetIsStatic()) ((CPhysical *)ent)->RemoveFromMovingList();
}
void
@@ -1960,7 +1960,7 @@ CWorld::Process(void)
RemoveEntityInsteadOfProcessingIt(movingEnt);
} else {
movingEnt->ProcessControl();
- if(movingEnt->IsStatic()) { movingEnt->RemoveFromMovingList(); }
+ if(movingEnt->GetIsStatic()) { movingEnt->RemoveFromMovingList(); }
}
}
bForceProcessControl = true;
@@ -1971,7 +1971,7 @@ CWorld::Process(void)
RemoveEntityInsteadOfProcessingIt(movingEnt);
} else {
movingEnt->ProcessControl();
- if(movingEnt->IsStatic()) { movingEnt->RemoveFromMovingList(); }
+ if(movingEnt->GetIsStatic()) { movingEnt->RemoveFromMovingList(); }
}
}
}
@@ -2124,13 +2124,13 @@ CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, floa
CObject *pObject = (CObject *)pEntity;
CVehicle *pVehicle = (CVehicle *)pEntity;
if(!pEntity->bExplosionProof && (!pEntity->IsPed() || !pPed->bInVehicle)) {
- if(pEntity->IsStatic()) {
+ if(pEntity->GetIsStatic()) {
if(pEntity->IsObject()) {
if (fPower > pObject->m_fUprootLimit || IsFence(pObject->GetModelIndex())) {
if (IsGlass(pObject->GetModelIndex())) {
CGlass::WindowRespondsToExplosion(pObject, position);
} else {
- pObject->bIsStatic = false;
+ pObject->SetIsStatic(false);
pObject->AddToMovingList();
int16 modelId = pEntity->GetModelIndex();
if(modelId != MI_FIRE_HYDRANT ||
@@ -2148,18 +2148,18 @@ CWorld::TriggerExplosionSectorList(CPtrList &list, const CVector &position, floa
}
}
}
- if(pEntity->IsStatic()) {
+ if(pEntity->GetIsStatic()) {
float fDamageMultiplier =
(fRadius - fMagnitude) * 2.0f / fRadius;
float fDamage = 300.0f * Min(fDamageMultiplier, 1.0f);
pObject->ObjectDamage(fDamage);
}
} else {
- pEntity->bIsStatic = false;
+ pEntity->SetIsStatic(false);
pEntity->AddToMovingList();
}
}
- if(!pEntity->IsStatic()) {
+ if(!pEntity->GetIsStatic()) {
float fDamageMultiplier = Min((fRadius - fMagnitude) * 2.0f / fRadius, 1.0f);
CVector vecForceDir =
vecDistance * (fPower * pEntity->m_fMass * 0.00071429f * fDamageMultiplier /
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 5fea9c4b..1aa0a953 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -768,6 +768,8 @@ DisplayGameDebugText()
char str[200];
wchar ustr[200];
+
+#ifdef DRAW_GAME_VERSION_TEXT
wchar ver[200];
AsciiToUnicode(version_name, ver);
@@ -783,6 +785,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);
@@ -841,7 +844,7 @@ DisplayGameDebugText()
CFont::SetRightJustifyOff();
CFont::SetJustifyOff();
CFont::SetBackGroundOnlyTextOff();
- CFont::SetWrapx(640.0f);
+ CFont::SetWrapx(SCREEN_WIDTH);
CFont::SetFontStyle(FONT_HEADING);
CFont::SetColor(CRGBA(0, 0, 0, 255));
@@ -1008,9 +1011,7 @@ Idle(void *arg)
CTimer::Update();
-#ifdef TIMEBARS
tbInit();
-#endif
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
@@ -1026,40 +1027,28 @@ Idle(void *arg)
FrontEndMenuManager.Process();
} else {
CPointLights::InitPerFrame();
-#ifdef TIMEBARS
tbStartTimer(0, "CGame::Process");
-#endif
CGame::Process();
-#ifdef TIMEBARS
tbEndTimer("CGame::Process");
tbStartTimer(0, "DMAudio.Service");
-#endif
DMAudio.Service();
-#ifdef TIMEBARS
tbEndTimer("DMAudio.Service");
-#endif
}
if (RsGlobal.quit)
return;
#else
CPointLights::InitPerFrame();
-#ifdef TIMEBARS
+
tbStartTimer(0, "CGame::Process");
-#endif
CGame::Process();
-#ifdef TIMEBARS
tbEndTimer("CGame::Process");
- tbStartTimer(0, "DMAudio.Service");
-#endif
+ tbStartTimer(0, "DMAudio.Service");
DMAudio.Service();
-
-#ifdef TIMEBARS
tbEndTimer("DMAudio.Service");
#endif
-#endif
if(CGame::bDemoMode && CTimer::GetTimeInMilliseconds() > (3*60 + 30)*1000 && !CCutsceneMgr::IsCutsceneProcessing()){
#ifdef PS2_MENU
@@ -1098,18 +1087,13 @@ Idle(void *arg)
RsMouseSetPos(&pos);
}
#endif
-#ifdef TIMEBARS
tbStartTimer(0, "CnstrRenderList");
-#endif
CRenderer::ConstructRenderList();
-#ifdef TIMEBARS
tbEndTimer("CnstrRenderList");
+
tbStartTimer(0, "PreRender");
-#endif
CRenderer::PreRender();
-#ifdef TIMEBARS
tbEndTimer("PreRender");
-#endif
#ifdef FIX_BUGS
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void *)FALSE); // TODO: temp? this fixes OpenGL render but there should be a better place for this
@@ -1135,13 +1119,9 @@ Idle(void *arg)
RwCameraSetFogDistance(Scene.camera, CTimeCycle::GetFogStart());
#endif
-#ifdef TIMEBARS
tbStartTimer(0, "RenderScene");
-#endif
RenderScene();
-#ifdef TIMEBARS
tbEndTimer("RenderScene");
-#endif
#ifdef EXTENDED_PIPELINES
CustomPipes::EnvMapRender();
@@ -1150,21 +1130,16 @@ Idle(void *arg)
RenderDebugShit();
RenderEffects();
-#ifdef TIMEBARS
tbStartTimer(0, "RenderMotionBlur");
-#endif
if((TheCamera.m_BlurType == MOTION_BLUR_NONE || TheCamera.m_BlurType == MOTION_BLUR_LIGHT_SCENE) &&
TheCamera.m_ScreenReductionPercentage > 0.0f)
TheCamera.SetMotionBlurAlpha(150);
TheCamera.RenderMotionBlur();
-#ifdef TIMEBARS
tbEndTimer("RenderMotionBlur");
+
tbStartTimer(0, "Render2dStuff");
-#endif
Render2dStuff();
-#ifdef TIMEBARS
tbEndTimer("Render2dStuff");
-#endif
}else{
#ifdef ASPECT_RATIO_SCALE
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
@@ -1181,35 +1156,28 @@ Idle(void *arg)
if (FrontEndMenuManager.m_bMenuActive)
DefinedState();
#endif
-#ifdef TIMEBARS
tbStartTimer(0, "RenderMenus");
-#endif
RenderMenus();
-#ifdef TIMEBARS
tbEndTimer("RenderMenus");
- tbStartTimer(0, "DoFade");
-#endif
#ifdef PS2_MENU
if ( TheMemoryCard.m_bWantToLoad )
return;
#endif
+
+ tbStartTimer(0, "DoFade");
DoFade();
-#ifdef TIMEBARS
tbEndTimer("DoFade");
+
tbStartTimer(0, "Render2dStuff-Fade");
-#endif
Render2dStuffAfterFade();
-#ifdef TIMEBARS
tbEndTimer("Render2dStuff-Fade");
-#endif
+
CCredits::Render();
-#ifdef TIMEBARS
if (gbShowTimebars)
tbDisplay();
-#endif
DoRWStuffEndOfFrame();
diff --git a/src/core/main.h b/src/core/main.h
index 7eb080cb..13fff447 100644
--- a/src/core/main.h
+++ b/src/core/main.h
@@ -16,6 +16,8 @@ extern bool gbPrintShite;
extern bool gbModelViewer;
#ifdef TIMEBARS
extern bool gbShowTimebars;
+#else
+#define gbShowTimebars false
#endif
class CSprite2d;
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index 069320ec..a06762f5 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -33,6 +33,11 @@
#include "postfx.h"
#include "custompipes.h"
+#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
+#include "FileMgr.h"
+#include "ControllerConfig.h"
+#endif
+
#ifndef _WIN32
#include "assert.h"
#include <stdarg.h>
@@ -275,7 +280,7 @@ wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
const char *joyname;
if (userHovering) {
for (int i = 0; i <= GLFW_JOYSTICK_LAST; i++) {
- if (joyname = glfwGetJoystickName(i)) {
+ if ((joyname = glfwGetJoystickName(i))) {
const uint8* buttons = glfwGetJoystickButtons(i, &numButtons);
for (int j = 0; j < numButtons; j++) {
if (buttons[j]) {
@@ -455,8 +460,34 @@ void LoadINISettings()
char defaultStr[4];
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
+ // Written by assuming the codes below will run after _InputInitialiseJoys().
strcpy(gSelectedJoystickName, cfg.get("DetectJoystick", "JoystickName", "").c_str());
- _InputInitialiseJoys();
+
+ if(gSelectedJoystickName[0] != '\0') {
+ for (int i = 0; i <= GLFW_JOYSTICK_LAST; i++) {
+ if (glfwJoystickPresent(i) && strncmp(gSelectedJoystickName, glfwGetJoystickName(i), strlen(gSelectedJoystickName)) == 0) {
+ if (PSGLOBAL(joy1id) != -1) {
+ PSGLOBAL(joy2id) = PSGLOBAL(joy1id);
+ }
+ PSGLOBAL(joy1id) = i;
+ int count;
+ glfwGetJoystickButtons(PSGLOBAL(joy1id), &count);
+
+ // We need to init and reload bindings, because;
+ // 1-joypad button number may differ with saved/prvly connected one
+ // 2-bindings are not init'ed if there is no joypad at the start
+ ControlsManager.InitDefaultControlConfigJoyPad(count);
+ CFileMgr::SetDirMyDocuments();
+ int32 gta3set = CFileMgr::OpenFile("gta3.set", "r");
+ if (gta3set) {
+ ControlsManager.LoadSettings(gta3set);
+ CFileMgr::CloseFile(gta3set);
+ }
+ CFileMgr::SetDir("");
+ break;
+ }
+ }
+ }
#endif
#ifdef CUSTOM_FRONTEND_OPTIONS
@@ -818,9 +849,12 @@ DebugMenuPopulate(void)
DebugMenuEntrySetWrap(e, true);
DebugMenuAddVar("Render", "Neo Vehicle Shininess", &CustomPipes::VehicleShininess, nil, 0.1f, 0, 1.0f);
DebugMenuAddVar("Render", "Neo Vehicle Specularity", &CustomPipes::VehicleSpecularity, nil, 0.1f, 0, 1.0f);
- DebugMenuAddVar("Render", "Neo Ped Rim light", &CustomPipes::RimlightMult, nil, 0.1f, 0, 1.0f);
- DebugMenuAddVar("Render", "Neo World Lightmaps", &CustomPipes::LightmapMult, nil, 0.1f, 0, 1.0f);
- DebugMenuAddVar("Render", "Neo Road Gloss", &CustomPipes::GlossMult, nil, 0.1f, 0, 1.0f);
+ DebugMenuAddVarBool8("Render", "Neo Ped Rim light enable", &CustomPipes::RimlightEnable, nil);
+ DebugMenuAddVar("Render", "Mult", &CustomPipes::RimlightMult, nil, 0.1f, 0, 1.0f);
+ DebugMenuAddVarBool8("Render", "Neo World Lightmaps enable", &CustomPipes::LightmapEnable, nil);
+ DebugMenuAddVar("Render", "Mult", &CustomPipes::LightmapMult, nil, 0.1f, 0, 1.0f);
+ DebugMenuAddVarBool8("Render", "Neo Road Gloss enable", &CustomPipes::GlossEnable, nil);
+ DebugMenuAddVar("Render", "Mult", &CustomPipes::GlossMult, nil, 0.1f, 0, 1.0f);
#endif
DebugMenuAddVarBool8("Render", "Show Ped Paths", &gbShowPedPaths, nil);
DebugMenuAddVarBool8("Render", "Show Car Paths", &gbShowCarPaths, nil);
diff --git a/src/core/timebars.h b/src/core/timebars.h
index 3871b61c..c4939802 100644
--- a/src/core/timebars.h
+++ b/src/core/timebars.h
@@ -1,6 +1,13 @@
#pragma once
+#ifdef TIMEBARS
void tbInit();
void tbStartTimer(int32, Const char*);
void tbEndTimer(Const char*);
-void tbDisplay(); \ No newline at end of file
+void tbDisplay();
+#else
+#define tbInit()
+#define tbStartTimer(a, b)
+#define tbEndTimer(a)
+#define tbDisplay()
+#endif