summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2021-08-08 12:38:21 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2021-08-08 12:38:21 +0200
commit9cc12018928b73acccd575970a6e4dbcb5b460ac (patch)
treea9ffaccca16aa71da94212e4810eee8fb15a1d19
parentlcs bridge (diff)
parentMerge pull request #1266 from Nick007J/miami (diff)
downloadre3-9cc12018928b73acccd575970a6e4dbcb5b460ac.tar
re3-9cc12018928b73acccd575970a6e4dbcb5b460ac.tar.gz
re3-9cc12018928b73acccd575970a6e4dbcb5b460ac.tar.bz2
re3-9cc12018928b73acccd575970a6e4dbcb5b460ac.tar.lz
re3-9cc12018928b73acccd575970a6e4dbcb5b460ac.tar.xz
re3-9cc12018928b73acccd575970a6e4dbcb5b460ac.tar.zst
re3-9cc12018928b73acccd575970a6e4dbcb5b460ac.zip
-rw-r--r--src/audio/MusicManager.cpp2
-rw-r--r--src/control/CarCtrl.cpp2
-rw-r--r--src/control/Script.cpp64
-rw-r--r--src/control/ScriptDebug.cpp57
-rw-r--r--src/core/Frontend.cpp114
-rw-r--r--src/core/Frontend.h29
-rw-r--r--src/core/Game.cpp6
-rw-r--r--src/core/IniFile.cpp6
-rw-r--r--src/core/IniFile.h4
-rw-r--r--src/core/MenuScreensCustom.cpp28
-rw-r--r--src/core/config.h1
-rw-r--r--src/core/re3.cpp27
-rw-r--r--src/extras/frontendoption.h2
-rw-r--r--src/peds/Ped.cpp2
-rw-r--r--src/peds/Population.cpp5
-rw-r--r--src/vehicles/Vehicle.cpp30
-rw-r--r--src/vehicles/Vehicle.h4
17 files changed, 292 insertions, 91 deletions
diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp
index 7033532c..74d86334 100644
--- a/src/audio/MusicManager.cpp
+++ b/src/audio/MusicManager.cpp
@@ -561,7 +561,7 @@ cMusicManager::ServiceGameMode()
}
}
#ifdef RADIO_SCROLL_TO_PREV_STATION
- else if(CPad::GetPad(0)->GetMouseWheelDownJustDown() || CPad::GetPad(0)->GetMouseWheelUpJustDown()) {
+ else if(!CPad::GetPad(0)->ArePlayerControlsDisabled() && (CPad::GetPad(0)->GetMouseWheelDownJustDown() || CPad::GetPad(0)->GetMouseWheelUpJustDown())) {
if(!UsesPoliceRadio(vehicle) && !UsesTaxiRadio(vehicle)) {
int scrollNext = ControlsManager.GetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, MOUSE);
int scrollPrev = scrollNext == rsMOUSEWHEELUPBUTTON ? rsMOUSEWHEELDOWNBUTTON
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index 3f1cd0ca..b09d73c5 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -98,7 +98,7 @@ int32 CCarCtrl::NumRandomCars;
int32 CCarCtrl::NumParkedCars;
int32 CCarCtrl::NumPermanentCars;
int8 CCarCtrl::CountDownToCarsAtStart;
-int32 CCarCtrl::MaxNumberOfCarsInUse = 30;
+int32 CCarCtrl::MaxNumberOfCarsInUse = DEFAULT_MAX_NUMBER_OF_CARS;
uint32 CCarCtrl::LastTimeLawEnforcerCreated;
uint32 CCarCtrl::LastTimeFireTruckCreated;
uint32 CCarCtrl::LastTimeAmbulanceCreated;
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index eae3ff08..130cd568 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -179,6 +179,65 @@ static const char* MissionScripts[] = {
"TOSH4"
};
+static const char* MissionScripts[] = {
+ "LAWYER1",
+ "LAWYER2",
+ "LAWYER3",
+ "LAWYER4",
+ "GENERL1",
+ "COL2",
+ "GENERL3",
+ "COL_4",
+ "COL_5",
+ "baron1",
+ "baron2",
+ "baron3",
+ "baron4",
+ "kent1",
+ "baron5",
+ "serg1",
+ "serg2",
+ "serg3",
+ "bankjo1",
+ "bankjo2",
+ "bankjo3",
+ "bankjo4",
+ "phil1",
+ "phil2",
+ "porno1",
+ "porno2",
+ "porno3",
+ "porno4",
+ "protec1",
+ "protec2",
+ "protec3",
+ "count1",
+ "count2",
+ "CAP_1",
+ "FIN_1",
+ "bike1",
+ "bike2",
+ "bike3",
+ "rockb1",
+ "rockb2",
+ "rockb3",
+ "cuban1",
+ "cuban2",
+ "cuban3",
+ "cuban4",
+ "hait1",
+ "hait2",
+ "hait3",
+ "assin1",
+ "assin2",
+ "assin3",
+ "assin4",
+ "assin5",
+ "taxwar1",
+ "taxwar2",
+ "taxwar3"
+};
+
int AllowMissionReplay;
uint32 NextMissionDelay;
uint32 MissionStartTime;
@@ -1195,6 +1254,10 @@ int8 CRunningScript::ProcessOneCommand()
retval = ProcessCommands1600To1699(command);
else
script_assert(false);
+#ifdef USE_MISSION_REPLAY_OVERRIDE_FOR_NON_MOBILE_SCRIPT
+ if (!AlreadySavedGame)
+#endif
+ {
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
LogAfterProcessingCommand(command);
#elif defined USE_BASIC_SCRIPT_DEBUG_OUTPUT
@@ -1204,6 +1267,7 @@ int8 CRunningScript::ProcessOneCommand()
CDebug::DebugAddText(tmp);
}
#endif
+ }
return retval;
}
diff --git a/src/control/ScriptDebug.cpp b/src/control/ScriptDebug.cpp
index 2e6fe332..1c357f5a 100644
--- a/src/control/ScriptDebug.cpp
+++ b/src/control/ScriptDebug.cpp
@@ -1885,26 +1885,26 @@ void CRunningScript::LogBeforeProcessingCommand(int32 command)
strcat(commandInfo, "}");
}
else {
- for (int i = 0; commands[command].input[i] != ARGTYPE_NONE; i++) {
+ for (int i = 0; commands[command].input[i] != ARGTYPE_NONE; i++) {
char tmp[32];
- bool var = false;
- int value;
- switch (commands[command].input[i]) {
- case ARGTYPE_INT:
- case ARGTYPE_PED_HANDLE:
- case ARGTYPE_VEHICLE_HANDLE:
- case ARGTYPE_OBJECT_HANDLE: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%d)" : " %d", value); break;
- case ARGTYPE_FLOAT: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%.3f)" : " %.3f", *(float*)&value); break;
- case ARGTYPE_STRING: sprintf(tmp, " '%s'", (const char*)&CTheScripts::ScriptSpace[m_nIp]); m_nIp += KEY_LENGTH_IN_SCRIPT; break;
- case ARGTYPE_LABEL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s(%d))" : " %s(%d)", value >= 0 ? "G" : "L", abs(value)); break;
- case ARGTYPE_BOOL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s)" : " %s", value ? "TRUE" : "FALSE"); break;
+ bool var = false;
+ int value;
+ switch (commands[command].input[i]) {
+ case ARGTYPE_INT:
+ case ARGTYPE_PED_HANDLE:
+ case ARGTYPE_VEHICLE_HANDLE:
+ case ARGTYPE_OBJECT_HANDLE: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%d)" : " %d", value); break;
+ case ARGTYPE_FLOAT: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%.3f)" : " %.3f", *(float*)&value); break;
+ case ARGTYPE_STRING: sprintf(tmp, " '%s'", (const char*)&CTheScripts::ScriptSpace[m_nIp]); m_nIp += KEY_LENGTH_IN_SCRIPT; break;
+ case ARGTYPE_LABEL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s(%d))" : " %s(%d)", value >= 0 ? "G" : "L", abs(value)); break;
+ case ARGTYPE_BOOL: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, var ? " (%s)" : " %s", value ? "TRUE" : "FALSE"); break;
case ARGTYPE_ANDOR: value = CollectParameterForDebug(commandInfo, var); sprintf(tmp, " %d %ss", (value) % 10, value / 10 == 0 ? "AND" : "OR"); break;
- default: script_assert(0);
- }
- strcat(commandInfo, tmp);
- if (commands[command].position == i)
- strcat(commandInfo, commands[command].name_override);
+ default: script_assert(0);
}
+ strcat(commandInfo, tmp);
+ if (commands[command].position == i)
+ strcat(commandInfo, commands[command].name_override);
+ }
}
uint32 t = m_nIp;
m_nIp = storedIp;
@@ -1923,18 +1923,18 @@ void CRunningScript::LogAfterProcessingCommand(int32 command)
m_nIp = storedIp;
storedIp = t;
if (commands[command].input[0] != ARGTYPE_FUNCTION) {
- for (int i = 0; commands[command].output[i] != ARGTYPE_NONE; i++) {
+ for (int i = 0; commands[command].output[i] != ARGTYPE_NONE; i++) {
char tmp[32];
- switch (commands[command].output[i]) {
- case ARGTYPE_INT:
- case ARGTYPE_PED_HANDLE:
- case ARGTYPE_VEHICLE_HANDLE:
- case ARGTYPE_OBJECT_HANDLE: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%d)", ScriptParams[i]); strcat(commandInfo, tmp); break;
- case ARGTYPE_FLOAT: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%8.3f)", *(float*)&ScriptParams[i]); strcat(commandInfo, tmp); break;
- default: script_assert(0 && "Script only returns INTs and FLOATs");
- }
+ switch (commands[command].output[i]) {
+ case ARGTYPE_INT:
+ case ARGTYPE_PED_HANDLE:
+ case ARGTYPE_VEHICLE_HANDLE:
+ case ARGTYPE_OBJECT_HANDLE: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%d)", ScriptParams[i]); strcat(commandInfo, tmp); break;
+ case ARGTYPE_FLOAT: GetStoredParameterForDebug(commandInfo); sprintf(tmp, " (%8.3f)", *(float*)&ScriptParams[i]); strcat(commandInfo, tmp); break;
+ default: script_assert(0 && "Script only returns INTs and FLOATs");
}
}
+ }
m_nIp = storedIp;
}
PrintToLog("%s\n", commandInfo);
@@ -1974,6 +1974,11 @@ CTheScripts::SwitchToMission(int32 mission)
#ifdef MISSION_REPLAY
missionRetryScriptIndex = mission;
+#ifdef USE_MISSION_REPLAY_OVERRIDE_FOR_NON_MOBILE_SCRIPT
+ if (CTheScripts::MissionSupportsMissionReplay(missionRetryScriptIndex)) {
+ SaveGameForPause(4);
+ }
+#endif
#endif
CTimer::Suspend();
int offset = CTheScripts::MultiScriptArray[mission] + 8;
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index 562f8ac3..dc2e1e02 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -222,6 +222,7 @@ wchar* CMenuManager::m_pDialogText = nil;
CFont::SetWrapx(MENU_X_RIGHT_ALIGNED(MENU_X_MARGIN)); \
CFont::SetRightJustifyWrap(MENU_X_LEFT_ALIGNED(MENU_X_MARGIN));
+// value must be between 0.0-1.0
#define ProcessSlider(value, origY, increaseAction, decreaseAction, hoverEndX, onlyWhenHoveringRow) \
do { \
float y = origY MINUS_SCROLL_OFFSET; \
@@ -360,7 +361,7 @@ CMenuManager::ThingsToDoBeforeLeavingPage()
option.m_CFODynamic->buttonPressFunc(FEOPTION_ACTION_FOCUSLOSS);
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;
+ option.m_CFOSelect->displayedValue = *(int8*)option.m_CFO->value = option.m_CFOSelect->lastSavedValue;
if (aScreens[m_nCurrScreen].returnPrevPageFunc) {
aScreens[m_nCurrScreen].returnPrevPageFunc();
@@ -714,27 +715,29 @@ CMenuManager::CheckSliderMovement(int value)
{
switch (aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action) {
case MENUACTION_BRIGHTNESS:
- m_PrefsBrightness += value * 32.0f;
+ m_PrefsBrightness += value * (float)(MAX_BRIGHTNESS - MIN_BRIGHTNESS) / MENUSLIDER_LOGICAL_BARS;
m_PrefsBrightness = Clamp(m_PrefsBrightness, MIN_BRIGHTNESS, MAX_BRIGHTNESS);
break;
case MENUACTION_DRAWDIST:
if(value > 0)
- m_PrefsLOD += ((1.8f - 0.925f) / 16.0f);
+ m_PrefsLOD += ((1.8f - 0.925f) / MENUSLIDER_LOGICAL_BARS);
else
- m_PrefsLOD -= ((1.8f - 0.925f) / 16.0f);
+ m_PrefsLOD -= ((1.8f - 0.925f) / MENUSLIDER_LOGICAL_BARS);
m_PrefsLOD = Clamp(m_PrefsLOD, 0.925f, 1.8f);
CRenderer::ms_lodDistScale = m_PrefsLOD;
break;
+
+ // I wonder the idea behind clamping those max to 65
case MENUACTION_MUSICVOLUME:
if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) {
- m_PrefsMusicVolume += value * (128 / 32);
+ m_PrefsMusicVolume += value * (64 / MENUSLIDER_LOGICAL_BARS);
m_PrefsMusicVolume = Clamp(m_PrefsMusicVolume, 0, 65);
DMAudio.SetMusicMasterVolume(m_PrefsMusicVolume);
}
break;
case MENUACTION_SFXVOLUME:
if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) {
- m_PrefsSfxVolume += value * (128 / 32);
+ m_PrefsSfxVolume += value * (64 / MENUSLIDER_LOGICAL_BARS);
m_PrefsSfxVolume = Clamp(m_PrefsSfxVolume, 0, 65);
DMAudio.SetEffectsMasterVolume(m_PrefsSfxVolume);
}
@@ -742,19 +745,33 @@ CMenuManager::CheckSliderMovement(int value)
case MENUACTION_MP3VOLUMEBOOST:
if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER) {
if (DMAudio.IsMP3RadioChannelAvailable()) {
- m_PrefsMP3BoostVolume += value * (128 / 32);
+ m_PrefsMP3BoostVolume += value * (64 / MENUSLIDER_LOGICAL_BARS);
m_PrefsMP3BoostVolume = Clamp(m_PrefsMP3BoostVolume, 0, 65);
DMAudio.SetMP3BoostVolume(m_PrefsMP3BoostVolume);
}
}
break;
case MENUACTION_MOUSESENS:
- TheCamera.m_fMouseAccelHorzntl += value * 1.0f/200.0f/15.0f; // ???
+ TheCamera.m_fMouseAccelHorzntl += value * 1.0f/200.0f/15.0f; // probably because diving it to 15 instead of 16(MENUSLIDER_LOGICAL_BARS) had more accurate steps
TheCamera.m_fMouseAccelHorzntl = Clamp(TheCamera.m_fMouseAccelHorzntl, 1.0f/3200.0f, 1.0f/200.0f);
#ifdef FIX_BUGS
TheCamera.m_fMouseAccelVertical = TheCamera.m_fMouseAccelHorzntl + 0.0005f;
#endif
break;
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ case MENUACTION_CFO_SLIDER:
+ {
+ CMenuScreenCustom::CMenuEntry &option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption];
+ float oldValue = *(float*)option.m_CFOSlider->value;
+ *(float*)option.m_CFOSlider->value += value * ((option.m_CFOSlider->max - option.m_CFOSlider->min) / MENUSLIDER_LOGICAL_BARS);
+ *(float*)option.m_CFOSlider->value = Clamp(*(float*)option.m_CFOSlider->value, option.m_CFOSlider->min, option.m_CFOSlider->max);
+
+ if (*(float*)option.m_CFOSlider->value != oldValue && option.m_CFOSlider->changeFunc)
+ option.m_CFOSlider->changeFunc(oldValue, *(float*)option.m_CFOSlider->value);
+
+ break;
+ }
+#endif
default:
return;
}
@@ -866,10 +883,10 @@ CMenuManager::DisplaySlider(float x, float y, float mostLeftBarSize, float mostR
int lastActiveBarX = 0;
float curBarX = 0.0f;
- for (int i = 0; i < 16; i++) {
- curBarX = i * rectSize/16.0f + x;
+ for (int i = 0; i < MENUSLIDER_BARS; i++) {
+ curBarX = i * rectSize/MENUSLIDER_BARS + x;
- if (i / 16.0f + 1 / 32.0f < progress) {
+ if (i / (float)MENUSLIDER_BARS + 1 / (MENUSLIDER_BARS * 2.f) < progress) {
color = CRGBA(SLIDERON_COLOR.r, SLIDERON_COLOR.g, SLIDERON_COLOR.b, FadeIn(255));
lastActiveBarX = curBarX;
} else
@@ -877,7 +894,7 @@ CMenuManager::DisplaySlider(float x, float y, float mostLeftBarSize, float mostR
maxBarHeight = Max(mostLeftBarSize, mostRightBarSize);
- float curBarFreeSpace = ((16 - i) * mostLeftBarSize + i * mostRightBarSize) / 16.0f;
+ float curBarFreeSpace = ((MENUSLIDER_BARS - i) * mostLeftBarSize + i * mostRightBarSize) / (float)MENUSLIDER_BARS;
float left = curBarX;
float top = y + maxBarHeight - curBarFreeSpace;
float right = spacing + curBarX;
@@ -1345,8 +1362,8 @@ CMenuManager::DrawStandardMenus(bool activeScreen)
CFont::SetColor(CRGBA(DARKMENUOPTION_COLOR.r, DARKMENUOPTION_COLOR.g, DARKMENUOPTION_COLOR.b, FadeIn(255)));
// 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 (*(int8*)option.m_CFO->value != option.m_CFOSelect->lastSavedValue)
+ option.m_CFOSelect->displayedValue = option.m_CFOSelect->lastSavedValue = *(int8*)option.m_CFO->value;
if (option.m_CFOSelect->displayedValue >= option.m_CFOSelect->numRightTexts || option.m_CFOSelect->displayedValue < 0)
option.m_CFOSelect->displayedValue = 0;
@@ -1396,7 +1413,11 @@ CMenuManager::DrawStandardMenus(bool activeScreen)
int saveSlot = aScreens[m_nCurrScreen].m_aEntries[i].m_SaveSlot;
if (rightText || action == MENUACTION_DRAWDIST || action == MENUACTION_BRIGHTNESS || action == MENUACTION_MUSICVOLUME ||
action == MENUACTION_SFXVOLUME || action == MENUACTION_MP3VOLUMEBOOST || action == MENUACTION_MOUSESENS ||
- saveSlot >= SAVESLOT_1 && saveSlot <= SAVESLOT_8) {
+ saveSlot >= SAVESLOT_1 && saveSlot <= SAVESLOT_8
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ || action == MENUACTION_CFO_SLIDER
+#endif
+ ) {
rightXMin = 600;
leftXMax = 40;
}
@@ -1523,6 +1544,11 @@ CMenuManager::DrawStandardMenus(bool activeScreen)
}
}
+#ifdef CUSTOM_FRONTEND_OPTIONS
+#define SLIDER_Y(pos) (aScreens[m_nCurrScreen].m_aEntries[i].m_Y - 5.f)
+#else
+#define SLIDER_Y(pos) pos
+#endif
// Sliders
int lastActiveBarX;
switch (aScreens[m_nCurrScreen].m_aEntries[i].m_Action) {
@@ -1530,23 +1556,29 @@ CMenuManager::DrawStandardMenus(bool activeScreen)
ProcessSlider((float)(m_PrefsBrightness - MIN_BRIGHTNESS) / (MAX_BRIGHTNESS - MIN_BRIGHTNESS), 70.0f, HOVEROPTION_INCREASE_BRIGHTNESS, HOVEROPTION_DECREASE_BRIGHTNESS, SCREEN_WIDTH, true);
break;
case MENUACTION_DRAWDIST:
- ProcessSlider((m_PrefsLOD - 0.925f) / 0.875f, 99.0f, HOVEROPTION_INCREASE_DRAWDIST, HOVEROPTION_DECREASE_DRAWDIST, SCREEN_WIDTH, true);
+ ProcessSlider((m_PrefsLOD - 0.925f) / 0.875f, SLIDER_Y(99.0f), HOVEROPTION_INCREASE_DRAWDIST, HOVEROPTION_DECREASE_DRAWDIST, SCREEN_WIDTH, true);
break;
case MENUACTION_MUSICVOLUME:
if(m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER)
- ProcessSlider(m_PrefsMusicVolume / 64.0f, 70.0f, HOVEROPTION_INCREASE_MUSICVOLUME, HOVEROPTION_DECREASE_MUSICVOLUME, SCREEN_WIDTH, true);
+ ProcessSlider(m_PrefsMusicVolume / 64.0f, SLIDER_Y(70.0f), HOVEROPTION_INCREASE_MUSICVOLUME, HOVEROPTION_DECREASE_MUSICVOLUME, SCREEN_WIDTH, true);
break;
case MENUACTION_SFXVOLUME:
if (m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER)
- ProcessSlider(m_PrefsSfxVolume / 64.0f, 99.0f, HOVEROPTION_INCREASE_SFXVOLUME, HOVEROPTION_DECREASE_SFXVOLUME, SCREEN_WIDTH, true);
+ ProcessSlider(m_PrefsSfxVolume / 64.0f, SLIDER_Y(99.0f), HOVEROPTION_INCREASE_SFXVOLUME, HOVEROPTION_DECREASE_SFXVOLUME, SCREEN_WIDTH, true);
break;
case MENUACTION_MOUSESENS:
- ProcessSlider(TheCamera.m_fMouseAccelHorzntl * 200.0f, 170.0f, HOVEROPTION_INCREASE_MOUSESENS, HOVEROPTION_DECREASE_MOUSESENS, SCREEN_WIDTH, false);
+ ProcessSlider(TheCamera.m_fMouseAccelHorzntl * 200.0f, SLIDER_Y(170.0f), HOVEROPTION_INCREASE_MOUSESENS, HOVEROPTION_DECREASE_MOUSESENS, SCREEN_WIDTH, false);
break;
case MENUACTION_MP3VOLUMEBOOST:
if(m_nPrefsAudio3DProviderIndex != NO_AUDIO_PROVIDER && DMAudio.IsMP3RadioChannelAvailable())
- ProcessSlider(m_PrefsMP3BoostVolume / 64.f, 128.0f, HOVEROPTION_INCREASE_MP3BOOST, HOVEROPTION_DECREASE_MP3BOOST, SCREEN_WIDTH, true);
+ ProcessSlider(m_PrefsMP3BoostVolume / 64.f, SLIDER_Y(128.0f), HOVEROPTION_INCREASE_MP3BOOST, HOVEROPTION_DECREASE_MP3BOOST, SCREEN_WIDTH, true);
+ break;
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ case MENUACTION_CFO_SLIDER:
+ CMenuScreenCustom::CMenuEntry &option = aScreens[m_nCurrScreen].m_aEntries[i];
+ ProcessSlider((*(float*)option.m_CFOSlider->value - option.m_CFOSlider->min) / (option.m_CFOSlider->max - option.m_CFOSlider->min), SLIDER_Y(0), HOVEROPTION_INCREASE_CFO_SLIDER, HOVEROPTION_DECREASE_CFO_SLIDER, SCREEN_WIDTH, true);
break;
+#endif
}
// Not just unused, but also collides with the bug fix in Font.cpp. Yikes.
@@ -4284,7 +4316,11 @@ CMenuManager::UserInput(void)
int action = aScreens[m_nCurrScreen].m_aEntries[rowToCheck].m_Action;
if (action != MENUACTION_BRIGHTNESS && action != MENUACTION_DRAWDIST && action != MENUACTION_MUSICVOLUME
- && action != MENUACTION_SFXVOLUME && action != MENUACTION_MOUSESENS && action != MENUACTION_MP3VOLUMEBOOST)
+ && action != MENUACTION_SFXVOLUME && action != MENUACTION_MOUSESENS && action != MENUACTION_MP3VOLUMEBOOST
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ && action != MENUACTION_CFO_SLIDER
+#endif
+ )
m_nHoverOption = HOVEROPTION_RANDOM_ITEM;
break;
@@ -4364,6 +4400,9 @@ CMenuManager::UserInput(void)
case HOVEROPTION_INCREASE_MUSICVOLUME:
case HOVEROPTION_INCREASE_SFXVOLUME:
case HOVEROPTION_INCREASE_MOUSESENS:
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ case HOVEROPTION_INCREASE_CFO_SLIDER:
+#endif
CheckSliderMovement(1);
break;
case HOVEROPTION_DECREASE_BRIGHTNESS:
@@ -4372,6 +4411,9 @@ CMenuManager::UserInput(void)
case HOVEROPTION_DECREASE_MUSICVOLUME:
case HOVEROPTION_DECREASE_SFXVOLUME:
case HOVEROPTION_DECREASE_MOUSESENS:
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ case HOVEROPTION_DECREASE_CFO_SLIDER:
+#endif
CheckSliderMovement(-1);
break;
}
@@ -4403,7 +4445,11 @@ CMenuManager::UserInput(void)
|| CPad::GetPad(0)->GetAnaloguePadLeftJustUp() || CPad::GetPad(0)->GetAnaloguePadRightJustUp()
|| CPad::GetPad(0)->GetMouseWheelUpJustDown() || CPad::GetPad(0)->GetMouseWheelDownJustDown()) {
int option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption].m_Action;
- if (option == MENUACTION_BRIGHTNESS)
+ if (option == MENUACTION_BRIGHTNESS
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ || option == MENUACTION_CFO_SLIDER
+#endif
+ )
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_ENTER_OR_ADJUST, 0);
else if (option == MENUACTION_SFXVOLUME)
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_AUDIO_TEST, 0);
@@ -4434,7 +4480,11 @@ CMenuManager::UserInput(void)
if (curAction == MENUACTION_BRIGHTNESS || curAction == MENUACTION_MUSICVOLUME ||
curAction == MENUACTION_SFXVOLUME || curAction == MENUACTION_RADIO ||
curAction == MENUACTION_DRAWDIST || curAction == MENUACTION_MOUSESENS ||
- curAction == MENUACTION_MP3VOLUMEBOOST)
+ curAction == MENUACTION_MP3VOLUMEBOOST
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ || curAction == MENUACTION_CFO_SLIDER
+#endif
+ )
changeValueBy = -1;
lastSliderDecrease = CTimer::GetTimeInMillisecondsPauseMode();
@@ -4445,7 +4495,11 @@ CMenuManager::UserInput(void)
if (curAction == MENUACTION_BRIGHTNESS || curAction == MENUACTION_MUSICVOLUME ||
curAction == MENUACTION_SFXVOLUME || curAction == MENUACTION_RADIO ||
curAction == MENUACTION_DRAWDIST || curAction == MENUACTION_MOUSESENS ||
- curAction == MENUACTION_MP3VOLUMEBOOST)
+ curAction == MENUACTION_MP3VOLUMEBOOST
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ || curAction == MENUACTION_CFO_SLIDER
+#endif
+ )
changeValueBy = 1;
lastSliderIncrease = CTimer::GetTimeInMillisecondsPauseMode();
}
@@ -4504,10 +4558,10 @@ CMenuManager::UserInput(void)
if (oldEntry.m_CFOSelect->displayedValue != oldEntry.m_CFOSelect->lastSavedValue)
SetHelperText(3); // Restored original value
- oldEntry.m_CFOSelect->displayedValue = oldEntry.m_CFOSelect->lastSavedValue = *oldEntry.m_CFO->value;
+ oldEntry.m_CFOSelect->displayedValue = oldEntry.m_CFOSelect->lastSavedValue = *(int8*)oldEntry.m_CFO->value;
}
} else if (oldEntry.m_Action == MENUACTION_CFO_SELECT && oldEntry.m_CFOSelect->onlyApplyOnEnter) {
- if (oldEntry.m_CFOSelect->displayedValue != *oldEntry.m_CFO->value)
+ if (oldEntry.m_CFOSelect->displayedValue != *(int8*)oldEntry.m_CFO->value)
SetHelperText(1); // Enter to apply
else if (m_nHelperTextMsgId == 1)
ResetHelperText(); // Applied
@@ -4937,9 +4991,9 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u
if (option.m_CFOSelect->displayedValue >= option.m_CFOSelect->numRightTexts || option.m_CFOSelect->displayedValue < 0)
option.m_CFOSelect->displayedValue = 0;
}
- int8 oldValue = *option.m_CFO->value;
+ int8 oldValue = *(int8*)option.m_CFO->value;
- *option.m_CFO->value = option.m_CFOSelect->lastSavedValue = option.m_CFOSelect->displayedValue;
+ *(int8*)option.m_CFO->value = option.m_CFOSelect->lastSavedValue = option.m_CFOSelect->displayedValue;
// Now everything is saved in .ini, and LOAD_INI_SETTINGS is fundamental for CFO
// if (option.m_CFOSelect->save)
@@ -5104,9 +5158,9 @@ CMenuManager::ProcessUserInput(uint8 goDown, uint8 goUp, uint8 optionSelected, u
option.m_CFOSelect->displayedValue = option.m_CFOSelect->numRightTexts - 1;
}
if (!option.m_CFOSelect->onlyApplyOnEnter) {
- int8 oldValue = *option.m_CFO->value;
+ int8 oldValue = *(int8*)option.m_CFO->value;
- *option.m_CFO->value = option.m_CFOSelect->lastSavedValue = option.m_CFOSelect->displayedValue;
+ *(int8*)option.m_CFO->value = option.m_CFOSelect->lastSavedValue = option.m_CFOSelect->displayedValue;
// Now everything is saved in .ini, and LOAD_INI_SETTINGS is fundamental for CFO
// if (option.m_CFOSelect->save)
diff --git a/src/core/Frontend.h b/src/core/Frontend.h
index 1a1dd799..858d3fd9 100644
--- a/src/core/Frontend.h
+++ b/src/core/Frontend.h
@@ -15,6 +15,9 @@
#define MENUACTION_SCALE_MULT 0.9f
+#define MENUSLIDER_BARS 16
+#define MENUSLIDER_LOGICAL_BARS MENUSLIDER_BARS
+
#define MENULABEL_X_MARGIN 80.0f
#define MENULABEL_POS_X 100.0f
#define MENULABEL_POS_Y 97.0f
@@ -230,6 +233,7 @@ enum eMenuScreen
enum eMenuAction
{
#ifdef CUSTOM_FRONTEND_OPTIONS
+ MENUACTION_CFO_SLIDER = -3,
MENUACTION_CFO_SELECT = -2,
MENUACTION_CFO_DYNAMIC = -1,
#endif
@@ -335,6 +339,10 @@ enum eCheckHover
HOVEROPTION_DECREASE_MOUSESENS,
HOVEROPTION_INCREASE_MP3BOOST,
HOVEROPTION_DECREASE_MP3BOOST,
+#ifdef CUSTOM_FRONTEND_OPTIONS
+ HOVEROPTION_INCREASE_CFO_SLIDER,
+ HOVEROPTION_DECREASE_CFO_SLIDER,
+#endif
HOVEROPTION_NOT_HOVERING,
};
@@ -407,7 +415,7 @@ struct CCustomScreenLayout {
struct CCFO
{
- int8 *value;
+ void *value;
const char *saveCat;
const char *save;
};
@@ -438,6 +446,24 @@ struct CCFOSelect : CCFO
}
};
+// Value is float in here
+struct CCFOSlider : CCFO
+{
+ ChangeFuncFloat changeFunc;
+ float min;
+ float max;
+
+ CCFOSlider() {};
+ CCFOSlider(float* value, const char* saveCat, const char* save, float min, float max, ChangeFuncFloat changeFunc = nil){
+ this->value = value;
+ this->saveCat = saveCat;
+ this->save = save;
+ this->changeFunc = changeFunc;
+ this->min = min;
+ this->max = max;
+ }
+};
+
struct CCFODynamic : CCFO
{
DrawFunc drawFunc;
@@ -469,6 +495,7 @@ struct CMenuScreenCustom
CCFO *m_CFO; // for initializing
CCFOSelect *m_CFOSelect;
CCFODynamic *m_CFODynamic;
+ CCFOSlider *m_CFOSlider;
};
int32 m_SaveSlot; // eSaveSlot
int32 m_TargetMenu; // eMenuScreen
diff --git a/src/core/Game.cpp b/src/core/Game.cpp
index 93137a49..5e7135c4 100644
--- a/src/core/Game.cpp
+++ b/src/core/Game.cpp
@@ -377,7 +377,11 @@ bool CGame::Initialise(const char* datFile)
CVehicleModelInfo::Load(nil);
#ifndef GTA_PS2
- CIniFile::LoadIniFile();
+#ifdef PED_CAR_DENSITY_SLIDERS
+ // Load density values from gta3.ini only if our reVC.ini have them 0.6f
+ if (CIniFile::PedNumberMultiplier == 0.6f && CIniFile::CarNumberMultiplier == 0.6f)
+#endif
+ CIniFile::LoadIniFile();
#endif
#ifdef USE_TEXTURE_POOL
_TexturePoolsUnknown(false);
diff --git a/src/core/IniFile.cpp b/src/core/IniFile.cpp
index 3dd98865..8e0929ae 100644
--- a/src/core/IniFile.cpp
+++ b/src/core/IniFile.cpp
@@ -23,7 +23,7 @@ void CIniFile::LoadIniFile()
CarNumberMultiplier = Min(3.0f, Max(0.5f, CarNumberMultiplier));
CFileMgr::CloseFile(f);
}
- CPopulation::MaxNumberOfPedsInUse = 25.0f * PedNumberMultiplier;
- CPopulation::MaxNumberOfPedsInUseInterior = 40.0f * PedNumberMultiplier;
- CCarCtrl::MaxNumberOfCarsInUse = 30.0f * CarNumberMultiplier;
+ CPopulation::MaxNumberOfPedsInUse = DEFAULT_MAX_NUMBER_OF_PEDS * PedNumberMultiplier;
+ CPopulation::MaxNumberOfPedsInUseInterior = DEFAULT_MAX_NUMBER_OF_PEDS_INTERIOR * PedNumberMultiplier;
+ CCarCtrl::MaxNumberOfCarsInUse = DEFAULT_MAX_NUMBER_OF_CARS * CarNumberMultiplier;
} \ No newline at end of file
diff --git a/src/core/IniFile.h b/src/core/IniFile.h
index 1e30c4de..f23f94b6 100644
--- a/src/core/IniFile.h
+++ b/src/core/IniFile.h
@@ -1,5 +1,9 @@
#pragma once
+#define DEFAULT_MAX_NUMBER_OF_PEDS 25.0f
+#define DEFAULT_MAX_NUMBER_OF_PEDS_INTERIOR 40.0f
+#define DEFAULT_MAX_NUMBER_OF_CARS 30.0f
+
class CIniFile
{
public:
diff --git a/src/core/MenuScreensCustom.cpp b/src/core/MenuScreensCustom.cpp
index 62b1ebdb..431fd794 100644
--- a/src/core/MenuScreensCustom.cpp
+++ b/src/core/MenuScreensCustom.cpp
@@ -27,6 +27,9 @@
#include "Pad.h"
#include "ControllerConfig.h"
#include "DMAudio.h"
+#include "IniFile.h"
+#include "CarCtrl.h"
+#include "Population.h"
// Menu screens array is at the bottom of the file.
@@ -64,6 +67,15 @@
#define DUALPASS_SELECTOR
#endif
+#ifdef PED_CAR_DENSITY_SLIDERS
+ // 0.2f - 3.4f makes it possible to have 1.0f somewhere inbetween
+ #define DENSITY_SLIDERS \
+ MENUACTION_CFO_SLIDER, "FEM_PED", { new CCFOSlider(&CIniFile::PedNumberMultiplier, "Display", "PedDensity", 0.2f, 3.4f, PedDensityChange) }, 0, 0, MENUALIGN_LEFT, \
+ MENUACTION_CFO_SLIDER, "FEM_CAR", { new CCFOSlider(&CIniFile::CarNumberMultiplier, "Display", "CarDensity", 0.2f, 3.4f, CarDensityChange) }, 0, 0, MENUALIGN_LEFT,
+#else
+ #define DENSITY_SLIDERS
+#endif
+
#ifdef NO_ISLAND_LOADING
#define ISLAND_LOADING_SELECTOR MENUACTION_CFO_SELECT, "FEM_ISL", { new CCFOSelect((int8*)&FrontEndMenuManager.m_PrefsIslandLoading, "Graphics", "IslandLoading", islandLoadingOpts, ARRAY_SIZE(islandLoadingOpts), true, IslandLoadingAfterChange) }, 0, 0, MENUALIGN_LEFT,
#else
@@ -136,6 +148,9 @@ void RestoreDefDisplay(int8 action) {
#ifdef FREE_CAM
TheCamera.bFreeCam = false;
#endif
+ #ifdef PED_CAR_DENSITY_SLIDERS
+ CIniFile::LoadIniFile();
+ #endif
#ifdef GRAPHICS_MENU_OPTIONS // otherwise Frontend will handle those
FrontEndMenuManager.m_PrefsBrightness = 256;
FrontEndMenuManager.m_PrefsLOD = 1.2f;
@@ -182,6 +197,17 @@ void IslandLoadingAfterChange(int8 before, int8 after) {
}
#endif
+#ifdef PED_CAR_DENSITY_SLIDERS
+void PedDensityChange(float before, float after) {
+ CPopulation::MaxNumberOfPedsInUse = DEFAULT_MAX_NUMBER_OF_PEDS * after;
+ CPopulation::MaxNumberOfPedsInUseInterior = DEFAULT_MAX_NUMBER_OF_PEDS_INTERIOR * after;
+}
+
+void CarDensityChange(float before, float after) {
+ CCarCtrl::MaxNumberOfCarsInUse = DEFAULT_MAX_NUMBER_OF_CARS * after;
+}
+#endif
+
#ifndef MULTISAMPLING
void GraphicsGoBack() {
}
@@ -417,6 +443,7 @@ CMenuScreenCustom aScreens[] = {
DUALPASS_SELECTOR
CUTSCENE_BORDERS_TOGGLE
FREE_CAM_TOGGLE
+ DENSITY_SLIDERS
POSTFX_SELECTORS
// re3.cpp inserts here pipeline selectors if neo/neo.txd exists and EXTENDED_PIPELINES defined
MENUACTION_RESTOREDEF, "FET_DEF", {nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS}, 320, 0, MENUALIGN_CENTER,
@@ -428,6 +455,7 @@ CMenuScreenCustom aScreens[] = {
MENUACTION_DRAWDIST, "FEM_LOD", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS }, 0, 0, MENUALIGN_LEFT,
CUTSCENE_BORDERS_TOGGLE
FREE_CAM_TOGGLE
+ DENSITY_SLIDERS
MENUACTION_LEGENDS, "MAP_LEG", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS }, 0, 0, MENUALIGN_LEFT,
MENUACTION_RADARMODE, "FED_RDR", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS }, 0, 0, MENUALIGN_LEFT,
MENUACTION_HUD, "FED_HUD", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS }, 0, 0, MENUALIGN_LEFT,
diff --git a/src/core/config.h b/src/core/config.h
index ac4f1e8b..4e30902e 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -380,6 +380,7 @@ enum Config {
# define CUTSCENE_BORDERS_SWITCH
# define MULTISAMPLING // adds MSAA option
# define INVERT_LOOK_FOR_PAD // enable the hidden option
+# define PED_CAR_DENSITY_SLIDERS
# endif
#endif
diff --git a/src/core/re3.cpp b/src/core/re3.cpp
index 2cd40e57..98a51909 100644
--- a/src/core/re3.cpp
+++ b/src/core/re3.cpp
@@ -44,6 +44,9 @@
#include "Camera.h"
#include "MBlur.h"
#include "ControllerConfig.h"
+#include "CarCtrl.h"
+#include "Population.h"
+#include "IniFile.h"
#ifdef DETECT_JOYSTICK_MENU
#include "crossplatform.h"
@@ -560,22 +563,30 @@ bool LoadINISettings()
// CFO check
if (option.m_Action < MENUACTION_NOTHING && option.m_CFO->save) {
- // CFO only supports saving uint8 right now
-
// Migrate from old .ini to new .ini
- if (migrate && ReadIniIfExists("FrontendOptions", option.m_CFO->save, option.m_CFO->value))
+ // Old values can only be int8, new ones can contain float if it is slider
+ if (migrate && ReadIniIfExists("FrontendOptions", option.m_CFO->save, (int8*)option.m_CFO->value))
cfg["FrontendOptions"].remove(option.m_CFO->save);
+ else if (option.m_Action == MENUACTION_CFO_SLIDER)
+ ReadIniIfExists(option.m_CFO->saveCat, option.m_CFO->save, (float*)option.m_CFO->value);
else
- ReadIniIfExists(option.m_CFO->saveCat, option.m_CFO->save, option.m_CFO->value);
+ ReadIniIfExists(option.m_CFO->saveCat, option.m_CFO->save, (int8*)option.m_CFO->value);
if (option.m_Action == MENUACTION_CFO_SELECT) {
- option.m_CFOSelect->lastSavedValue = option.m_CFOSelect->displayedValue = *option.m_CFO->value;
+ option.m_CFOSelect->lastSavedValue = option.m_CFOSelect->displayedValue = *(int8*)option.m_CFO->value;
}
}
}
}
#endif
+ // Fetched in above block, but needs evaluation
+#ifdef PED_CAR_DENSITY_SLIDERS
+ CPopulation::MaxNumberOfPedsInUse = DEFAULT_MAX_NUMBER_OF_PEDS * CIniFile::PedNumberMultiplier;
+ CPopulation::MaxNumberOfPedsInUseInterior = DEFAULT_MAX_NUMBER_OF_PEDS_INTERIOR * CIniFile::PedNumberMultiplier;
+ CCarCtrl::MaxNumberOfCarsInUse = DEFAULT_MAX_NUMBER_OF_CARS * CIniFile::CarNumberMultiplier;
+#endif
+
return true;
}
@@ -653,8 +664,10 @@ void SaveINISettings()
break;
if (option.m_Action < MENUACTION_NOTHING && option.m_CFO->save) {
- // Beware: CFO only supports saving uint8 right now
- StoreIni(option.m_CFO->saveCat, option.m_CFO->save, *option.m_CFO->value);
+ if (option.m_Action == MENUACTION_CFO_SLIDER)
+ StoreIni(option.m_CFO->saveCat, option.m_CFO->save, *(float*)option.m_CFO->value);
+ else
+ StoreIni(option.m_CFO->saveCat, option.m_CFO->save, *(int8*)option.m_CFO->value);
}
}
}
diff --git a/src/extras/frontendoption.h b/src/extras/frontendoption.h
index 05cd5fa0..db1b9021 100644
--- a/src/extras/frontendoption.h
+++ b/src/extras/frontendoption.h
@@ -35,6 +35,8 @@ typedef void (*ReturnPrevPageFunc)();
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
+typedef void (*ChangeFuncFloat)(float before, float after); // called after updating the value.
+
// for dynamic options
typedef wchar* (*DrawFunc)(bool* disabled, bool userHovering); // you must return a pointer for right text.
// you can also set *disabled if you want to gray it out.
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index dc143098..f0c1c4fb 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -287,7 +287,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
bHeadStuckInCollision = false;
bDeadPedInFrontOfCar = false;
- m_gangFlags = 0xFF;
+ m_gangFlags = ~0;
bStayInCarOnJack = false;
diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp
index 75c454b6..cf3a195c 100644
--- a/src/peds/Population.cpp
+++ b/src/peds/Population.cpp
@@ -40,8 +40,8 @@ bool CPopulation::ms_bGivePedsWeapons;
int32 CPopulation::m_AllRandomPedsThisType = -1;
float CPopulation::PedDensityMultiplier = 1.0f;
uint32 CPopulation::ms_nTotalMissionPeds;
-int32 CPopulation::MaxNumberOfPedsInUse = 25;
-int32 CPopulation::MaxNumberOfPedsInUseInterior = 40;
+int32 CPopulation::MaxNumberOfPedsInUse = DEFAULT_MAX_NUMBER_OF_PEDS;
+int32 CPopulation::MaxNumberOfPedsInUseInterior = DEFAULT_MAX_NUMBER_OF_PEDS_INTERIOR;
uint32 CPopulation::ms_nNumCivMale;
uint32 CPopulation::ms_nNumCivFemale;
uint32 CPopulation::ms_nNumCop;
@@ -1095,6 +1095,7 @@ CPopulation::ManagePopulation(void)
}
float dist = (ped->GetPosition() - playerPos).Magnitude2D();
+
bool pedIsFarAway = false;
if (ped->IsGangMember())
diff --git a/src/vehicles/Vehicle.cpp b/src/vehicles/Vehicle.cpp
index a4c983f7..75a979f9 100644
--- a/src/vehicles/Vehicle.cpp
+++ b/src/vehicles/Vehicle.cpp
@@ -846,7 +846,8 @@ CVehicle::ProcessWheel(CVector &wheelFwd, CVector &wheelRight, CVector &wheelCon
#ifdef FIX_BUGS
// contactSpeedFwd is independent of framerate but fwd has timestep as a factor
// so we probably have to fix this
- fwd *= CTimer::GetTimeStepFix();
+ // better get rid of it here too
+ //fwd *= CTimer::GetTimeStepFix();
#endif
if(!bBraking){
@@ -990,7 +991,8 @@ CVehicle::ProcessBikeWheel(CVector &wheelFwd, CVector &wheelRight, CVector &whee
#ifdef FIX_BUGS
// contactSpeedRight is independent of framerate but right has timestep as a factor
// so we probably have to fix this
- right *= CTimer::GetTimeStepFix();
+ // see above
+ //right *= CTimer::GetTimeStepFix();
#endif
if(wheelStatus == WHEEL_STATUS_BURST){
@@ -1015,7 +1017,8 @@ CVehicle::ProcessBikeWheel(CVector &wheelFwd, CVector &wheelRight, CVector &whee
#ifdef FIX_BUGS
// contactSpeedFwd is independent of framerate but fwd has timestep as a factor
// so we probably have to fix this
- fwd *= CTimer::GetTimeStepFix();
+ // see above
+ //fwd *= CTimer::GetTimeStepFix();
#endif
if(!bBraking){
@@ -1527,9 +1530,8 @@ CVehicle::MakeNonDraggedPedsLeaveVehicle(CPed *ped1, CPed *ped2, CPlayerPed *&pl
if(p && p != ped1 && !p->bStayInCarOnJack){
peds[numPeds++] = p;
// uhh what?
- if(i < 1 && !ped1IsDriver)
- continue;
- peds2[numPeds2++] = p;
+ if(i > 0 || ped1IsDriver)
+ peds2[numPeds2++] = p;
}
}
@@ -1579,10 +1581,8 @@ CVehicle::ProcessDelayedExplosion(void)
if(IsCar() && ((CAutomobile*)this)->m_bombType == CARBOMB_TIMEDACTIVE && (m_nBombTimer & 0xFE00) != (prev & 0xFE00))
DMAudio.PlayOneShot(m_audioEntityId, SOUND_CAR_BOMB_TICK, 0.0f);
- if (m_nBombTimer != 0)
- return;
-
- BlowUpCar(m_pBlowUpEntity);
+ if (m_nBombTimer == 0)
+ BlowUpCar(m_pBlowUpEntity);
}
bool
@@ -1703,7 +1703,7 @@ CVehicle::CanPedOpenLocks(CPed *ped)
if(m_nDoorLock == CARLOCK_LOCKED ||
m_nDoorLock == CARLOCK_LOCKED_INITIALLY ||
m_nDoorLock == CARLOCK_LOCKED_PLAYER_INSIDE ||
- m_nDoorLock == CARLOCK_SKIP_SHUT_DOORS)
+ m_nDoorLock == CARLOCK_LOCKED_BUT_CAN_BE_DAMAGED)
return false;
if(ped->IsPlayer() && m_nDoorLock == CARLOCK_LOCKOUT_PLAYER_ONLY)
return false;
@@ -1715,7 +1715,7 @@ CVehicle::CanDoorsBeDamaged(void)
{
return m_nDoorLock == CARLOCK_NOT_USED ||
m_nDoorLock == CARLOCK_UNLOCKED ||
- m_nDoorLock == CARLOCK_SKIP_SHUT_DOORS;
+ m_nDoorLock == CARLOCK_LOCKED_BUT_CAN_BE_DAMAGED;
}
bool
@@ -1987,9 +1987,7 @@ CVehicle::RemovePassenger(CPed *p)
bool
CVehicle::IsDriver(CPed *ped)
{
- if(ped == nil)
- return false;
- return ped == pDriver;
+ return ped && ped == pDriver;
}
bool
@@ -2040,7 +2038,7 @@ CVehicle::ProcessCarAlarm(void)
{
uint32 step;
- if(!IsAlarmOn())
+ if(m_nAlarmState == 0 || m_nAlarmState == -1)
return;
step = CTimer::GetTimeStepInMilliseconds();
diff --git a/src/vehicles/Vehicle.h b/src/vehicles/Vehicle.h
index 5458590f..e0043ba1 100644
--- a/src/vehicles/Vehicle.h
+++ b/src/vehicles/Vehicle.h
@@ -60,7 +60,7 @@ enum eCarLock {
CARLOCK_LOCKED_PLAYER_INSIDE,
CARLOCK_LOCKED_INITIALLY,
CARLOCK_FORCE_SHUT_DOORS,
- CARLOCK_SKIP_SHUT_DOORS
+ CARLOCK_LOCKED_BUT_CAN_BE_DAMAGED
};
enum eBombType
@@ -274,7 +274,7 @@ public:
uint8 m_bRainSamplesCounter;
uint32 m_nCarHornTimer;
uint8 m_nCarHornPattern;
- bool m_bSirenOrAlarm;
+ uint8 m_bSirenOrAlarm;
uint8 m_nCarHornDelay;
int8 m_comedyControlState;
CStoredCollPoly m_aCollPolys[2]; // poly which is under front/rear part of car