diff --git a/VCS PC/Audio.cpp b/VCS PC/Audio.cpp index 6ad48b5..29f804b 100644 --- a/VCS PC/Audio.cpp +++ b/VCS PC/Audio.cpp @@ -14,6 +14,7 @@ WRAPPER void CAudioEngine::SetEffectsMasterVolume(signed char nVolume) { WRAPARG WRAPPER void CAudioEngine::SetRadioAutoRetuneOnOff(bool bRetune) { WRAPARG(bRetune); EAXJMP(0x506F80); } WRAPPER void CAudioEngine::RetuneRadio(signed char nStation) { WRAPARG(nStation); EAXJMP(0x507E10); } WRAPPER const char* CAudioEngine::GetRadioStationName(signed char nStation) { WRAPARG(nStation); EAXJMP(0x507000); } +WRAPPER void CAudioEngine::ScrollRadioStations(signed char nDirection) { WRAPARG(nDirection); EAXJMP(0x573A00); } signed char CAERadioTrackManager::GetNextTrackByStation(BYTE stationID) diff --git a/VCS PC/Audio.h b/VCS PC/Audio.h index 28ee737..ccefa07 100644 --- a/VCS PC/Audio.h +++ b/VCS PC/Audio.h @@ -88,6 +88,7 @@ class CAudioEngine void SetRadioAutoRetuneOnOff(bool bRetune); void RetuneRadio(signed char nStation); const char* GetRadioStationName(signed char nStation); + void ScrollRadioStations(signed char nDirection); }; extern CAudioEngine& AudioEngine; diff --git a/VCS PC/ControlsMgr.cpp b/VCS PC/ControlsMgr.cpp index ee0e301..2e88ba3 100644 --- a/VCS PC/ControlsMgr.cpp +++ b/VCS PC/ControlsMgr.cpp @@ -5,6 +5,7 @@ WRAPPER void CControllerConfigManager::SaveSettings(FILE* hFile) { WRAPARG(hFile WRAPPER bool CControllerConfigManager::LoadSettings(FILE* hFile) { WRAPARG(hFile); EAXJMP(0x530530); } WRAPPER bool CControllerConfigManager::GetIsKeyboardKeyJustDown(RsKeyCodes eKey) { WRAPARG(eKey); EAXJMP(0x52E450); } WRAPPER bool CControllerConfigManager::GetIsKeyboardKeyDown(RsKeyCodes eKey) { WRAPARG(eKey); EAXJMP(0x52DDB0); } +WRAPPER void CControllerConfigManager::ReinitControls() { EAXJMP(0x531F20); } void CControllerConfigManager::SaveToFile() { diff --git a/VCS PC/ControlsMgr.h b/VCS PC/ControlsMgr.h index 8a41b3f..a9268ed 100644 --- a/VCS PC/ControlsMgr.h +++ b/VCS PC/ControlsMgr.h @@ -20,6 +20,8 @@ class CControllerConfigManager void SaveToFile(); bool LoadFromFile(); + + static void ReinitControls(); }; diff --git a/VCS PC/Frontend.cpp b/VCS PC/Frontend.cpp index c8e8b76..f33a031 100644 --- a/VCS PC/Frontend.cpp +++ b/VCS PC/Frontend.cpp @@ -16,6 +16,7 @@ #include "FxSystem.h" #include "Shadows.h" #include "PcSave.h" +#include "PostEffects.h" CSprite2d* const LoadingSprites = (CSprite2d*)0xBAB35C; int& CurrentLoadingSprite = *(int*)0x8D093C; @@ -420,6 +421,8 @@ WRAPPER void CMenuManager::PrintBrief() { EAXJMP(0x576320); } WRAPPER void CMenuManager::DrawContollerScreenExtraText(int nUnk) { WRAPARG(nUnk); EAXJMP(0x57D8D0); } WRAPPER void CMenuManager::DisplayHelperText(const char* pText) { WRAPARG(pText); EAXJMP(0x57E240); } WRAPPER bool CMenuManager::CheckHover(int, int, int, int) { EAXJMP(0x57C4F0); } +WRAPPER void CMenuManager::ProcessMissionPackNewGame() { EAXJMP(0x57D520); } +WRAPPER void CMenuManager::DoSettingsBeforeStartingAGame() { EAXJMP(0x573330); } void CMenuManager::SaveSettings() { @@ -790,7 +793,7 @@ void CMenuManager::DrawStandardMenus(bool bDrawMenu) { aScreens[m_bCurrentMenuPage].entryList[i].posX = 80; aScreens[m_bCurrentMenuPage].entryList[i].screenHorAlign = -1; - CFont::SetOrientation(1); + CFont::SetOrientation(ALIGN_Left); switch ( SlotValidation[i] ) { @@ -806,8 +809,8 @@ void CMenuManager::DrawStandardMenus(bool bDrawMenu) if ( !pTextToShow || !pTextToShow[0] ) { sprintf(gString, "FEM_SL%X", i); - CFont::SetOrientation(0); - aScreens[m_bCurrentMenuPage].entryList[i].posX = 320; + CFont::SetOrientation(ALIGN_Center); + aScreens[m_bCurrentMenuPage].entryList[i].posX = 0; aScreens[m_bCurrentMenuPage].entryList[i].screenHorAlign = 0; pTextToShow = TheText.Get(gString); } @@ -1038,7 +1041,8 @@ void CMenuManager::DrawStandardMenus(bool bDrawMenu) if ( pTextToShow ) { - if ( aScreens[m_bCurrentMenuPage].entryList[i].specialDescFlag >= ACTION_SAVE_1 && aScreens[m_bCurrentMenuPage].entryList[i].specialDescFlag <= ACTION_SAVE_12 ) + if ( aScreens[m_bCurrentMenuPage].entryList[i].specialDescFlag >= ACTION_SAVE_1 && aScreens[m_bCurrentMenuPage].entryList[i].specialDescFlag <= ACTION_SAVE_12 + && (SlotValidation[i] != 1 && SlotValidation[i] != 2) ) { char cSlotNumberText[4]; sprintf(cSlotNumberText, "%d", aScreens[m_bCurrentMenuPage].entryList[i].specialDescFlag); @@ -1215,6 +1219,615 @@ void CMenuManager::DrawStandardMenus(bool bDrawMenu) } } +void CMenuManager::ProcessMenuOptions(signed char nArrowsInput, bool* bReturn, bool bEnterInput) +{ + switch ( aScreens[m_bCurrentMenuPage].entryList[m_dwSelectedMenuItem].action ) + { + case 2: + *bReturn = true; + return; + case 25: + m_bShowSubtitles = m_bShowSubtitles == false; + SaveSettings(); + return; + case 33: + m_bMapLegend = m_bMapLegend == false; + SaveSettings(); + return; + case 26: + if ( nArrowsInput >= 0 ) + { + if ( ++m_bAspectRatioMode > 5 ) + m_bAspectRatioMode = 0; + } + else + { + if ( m_bAspectRatioMode ) + --m_bAspectRatioMode; + else + m_bAspectRatioMode = 5; + } + WidescreenSupport::Recalculate(RsGlobal.MaximumWidth, RsGlobal.MaximumHeight, true); + SaveSettings(); + return; + case 35: + if ( nArrowsInput >= 0 ) + { + if ( ++m_bHudOn > 2 ) + m_bHudOn = 0; + } + else + { + if ( m_bHudOn ) + --m_bHudOn; + else + m_bHudOn = 2; + } + SaveSettings(); + return; + // case 22: - PS2 only + // case 23: - PS2 only + case 31: + m_bRadioAutoSelect = m_bRadioAutoSelect == false; + AudioEngine.SetRadioAutoRetuneOnOff(m_bRadioAutoSelect); + SaveSettings(); + return; + // case 30: - removed option + case 21: + if ( bEnterInput ) + { + *bReturn = true; + return; + } + + if ( nArrowsInput >= 0 ) + { + if ( m_bStatScrollUp ) + { + if ( m_fStatsScrollSpeed == 0.0f ) + m_fStatsScrollSpeed = 150.0f; + else if ( m_fStatsScrollSpeed == 150.0f ) + m_fStatsScrollSpeed = 30.0f; + } + else + { + if ( m_fStatsScrollSpeed == 0.0f ) + m_fStatsScrollSpeed = 150.0f; + else + m_fStatsScrollSpeed = 0.0f; + + m_bStatScrollUp = true; + } + } + else + { + if ( m_bStatScrollUp ) + { + if ( m_fStatsScrollSpeed != 0.0f ) + m_fStatsScrollSpeed = 0.0f; + m_bStatScrollUp = false; + } + else + { + if ( m_fStatsScrollSpeed == 0.0f ) + m_fStatsScrollSpeed = 150.0f; + else if ( m_fStatsScrollSpeed == 150.0f ) + m_fStatsScrollSpeed = 30.0f; + } + } + + return; + case 32: + AudioEngine.ScrollRadioStations(nArrowsInput); + return; + //case 36: - PS2 only + case 34: + if ( nArrowsInput >= 0 ) + { + if ( ++m_dwRadarMode > 2 ) + m_dwRadarMode = 0; + } + else + { + if ( m_dwRadarMode ) + --m_dwRadarMode; + else + m_dwRadarMode = 2; + } + SaveSettings(); + return; + case 3: + case 4: + case 5: + SwitchToNewScreen(aScreens[m_bCurrentMenuPage].entryList[m_dwSelectedMenuItem].targetMenu); + return; + case 11: + // TODO: Do + return; + case 10: + ProcessMissionPackNewGame(); + return; + case 13: + if ( aScreens[m_bCurrentMenuPage].entryList[m_dwSelectedMenuItem].specialDescFlag >= ACTION_SAVE_1 && aScreens[m_bCurrentMenuPage].entryList[m_dwSelectedMenuItem].specialDescFlag <= ACTION_SAVE_12 ) + { + m_bSelectedSaveGame = m_dwSelectedMenuItem-1; + if ( m_bCurrentMenuPage == 9 ) + { + if ( SlotValidation[m_dwSelectedMenuItem] != 1 && SlotValidation[m_dwSelectedMenuItem] != 2 ) + SwitchToNewScreen(11); + } + else if ( m_bCurrentMenuPage == 10 ) + { + if ( SlotValidation[m_dwSelectedMenuItem] != 1 ) + SwitchToNewScreen(12); + } + } + return; + case 18: + if ( aScreens[m_bCurrentMenuPage].entryList[m_dwSelectedMenuItem].specialDescFlag >= ACTION_SAVE_1 && aScreens[m_bCurrentMenuPage].entryList[m_dwSelectedMenuItem].specialDescFlag <= ACTION_SAVE_12 ) + { + m_bSelectedSaveGame = m_dwSelectedMenuItem-1; + SwitchToNewScreen(17); + } + return; + case 12: + CGame::bMissionPackGame = m_bSelectedMissionPack; + DoSettingsBeforeStartingAGame(); + return; + case 14: + CGame::bMissionPackGame = 0; + DoSettingsBeforeStartingAGame(); + m_bBackIntoGame = true; + return; + case 15: + m_bBackIntoGame = true; + return; + + case 46: + MousePointerStateHelper.m_bHorizontalInvert = MousePointerStateHelper.m_bHorizontalInvert == false; + SaveSettings(); + return; + case 47: + invertPadX1 = invertPadX1 == false; + SaveSettings(); + return; + case 48: + invertPadY1 = invertPadY1 == false; + SaveSettings(); + return; + case 49: + invertPadX2 = invertPadX2 == false; + SaveSettings(); + return; + case 50: + invertPadY2 = invertPadY2 == false; + SaveSettings(); + return; + case 51: + swapPadAxis1 = swapPadAxis1 == false; + SaveSettings(); + return; + case 52: + swapPadAxis2 = swapPadAxis2 == false; + SaveSettings(); + return; + case 59: + if ( !m_nController ) + { + CVehicle::m_bEnableMouseSteering = CVehicle::m_bEnableMouseSteering == false; + SaveSettings(); + } + return; + case 60: + if ( !m_nController ) + { + CVehicle::m_bEnableMouseFlying = CVehicle::m_bEnableMouseFlying == false; + SaveSettings(); + } + return; + case 24: + if ( nArrowsInput >= 0 ) + { + if ( ++m_bFrameLimiterMode > 4 ) + m_bFrameLimiterMode = 0; + } + else + { + if ( m_bFrameLimiterMode ) + --m_bFrameLimiterMode; + else + m_bFrameLimiterMode = 4; + } + RsGlobal.frameLimit = RsGlobalFrameLimits[m_bFrameLimiterMode]; + SaveSettings(); + return; + //case 43: - Removed option + case 64: + m_bTracksAutoScan = m_bTracksAutoScan == false; + SaveSettings(); + return; + case 65: + m_bSavePhotos = m_bSavePhotos == false; + SaveSettings(); + return; + case 58: + if ( m_nController == 1 ) + { + m_nController = 0; + CCamera::m_bUseMouse3rdPerson = true; + } + else + { + m_nController = 1; + CCamera::m_bUseMouse3rdPerson = false; + } + SaveSettings(); + return; + case 56: + if ( bEnterInput ) + { + if ( m_dwResolution != m_dwAppliedResolution ) + { + m_dwAppliedResolution = m_dwResolution; + // CSettings__SetCurrentVideoMode + ((void(*)(int))0x745C70)(m_dwAppliedResolution); + CentreMousePointer(); + + m_bDrawMouse = true; + SaveSettings(); + CPostEffects::DoScreenModeDependentInitializations(); + } + } + else + { + char** pVideoModes = ((char**(*)())0x745AF0)(); + int nNumVideoModes = RwEngineGetNumVideoModes(); + + if ( nArrowsInput > 0 ) + { + int nCurrentVidMode = m_dwResolution + 1; + + if ( nCurrentVidMode >= nNumVideoModes ) + nCurrentVidMode = 0; + + while ( !pVideoModes[nCurrentVidMode] ) + { + ++nCurrentVidMode; + + if ( nCurrentVidMode >= nNumVideoModes ) + nCurrentVidMode = 0; + } + + m_dwResolution = nCurrentVidMode; + } + else + { + int nCurrentVidMode = m_dwResolution - 1; + + if ( nCurrentVidMode < 0 ) + nCurrentVidMode = nNumVideoModes - 1; + + while ( !pVideoModes[nCurrentVidMode] ) + { + --nCurrentVidMode; + + if ( nCurrentVidMode < 0 ) + nCurrentVidMode = nNumVideoModes - 1; + } + + m_dwResolution = nCurrentVidMode; + } + } + return; + case 44: + if ( bEnterInput ) + { + if ( m_dwAntiAliasingLevel != m_dwAppliedAntiAliasingLevel ) + { + m_dwAppliedAntiAliasingLevel = m_dwAntiAliasingLevel; + + RwD3D9ChangeMultiSamplingLevels(m_dwAppliedAntiAliasingLevel); + // CSettings__SetCurrentVideoMode + ((void(*)(int))0x745C70)(m_dwAppliedResolution); + SaveSettings(); + } + } + else + { + int nNumMultiSamplingModes = RwD3D9EngineGetMaxMultiSamplingLevels(); + + if ( nNumMultiSamplingModes > 4 ) + nNumMultiSamplingModes = 4; + + if ( nArrowsInput > 0 ) + { + int nCurrentMode = m_dwAntiAliasingLevel + 1; + + if ( nCurrentMode > nNumMultiSamplingModes ) + nCurrentMode = 1; + + m_dwAntiAliasingLevel = nCurrentMode; + } + else + { + int nCurrentMode = m_dwAntiAliasingLevel - 1; + + if ( nCurrentMode <= 0 ) + nCurrentMode = nNumMultiSamplingModes; + + m_dwAntiAliasingLevel = nCurrentMode; + } + } + return; + case MENUACTION_SHADOWS_QUALITY: + if ( nArrowsInput >= 0 ) + { + switch ( CShadows::GetShadowQuality() ) + { + case SHADOW_QUALITY_OFF: + CShadows::SetShadowQuality(SHADOW_QUALITY_LOWEST); + break; + case SHADOW_QUALITY_LOWEST: + CShadows::SetShadowQuality(SHADOW_QUALITY_LOW); + break; + case SHADOW_QUALITY_LOW: + CShadows::SetShadowQuality(SHADOW_QUALITY_MEDIUM); + break; + case SHADOW_QUALITY_MEDIUM: + CShadows::SetShadowQuality(SHADOW_QUALITY_HIGH); + break; + case SHADOW_QUALITY_HIGH: + CShadows::SetShadowQuality(SHADOW_QUALITY_HIGHEST); + break; + case SHADOW_QUALITY_HIGHEST: + CShadows::SetShadowQuality(SHADOW_QUALITY_OFF); + break; + } + } + else + { + switch ( CShadows::GetShadowQuality() ) + { + case SHADOW_QUALITY_OFF: + CShadows::SetShadowQuality(SHADOW_QUALITY_HIGHEST); + break; + case SHADOW_QUALITY_LOWEST: + CShadows::SetShadowQuality(SHADOW_QUALITY_OFF); + break; + case SHADOW_QUALITY_LOW: + CShadows::SetShadowQuality(SHADOW_QUALITY_LOWEST); + break; + case SHADOW_QUALITY_MEDIUM: + CShadows::SetShadowQuality(SHADOW_QUALITY_LOW); + break; + case SHADOW_QUALITY_HIGH: + CShadows::SetShadowQuality(SHADOW_QUALITY_MEDIUM); + break; + case SHADOW_QUALITY_HIGHEST: + CShadows::SetShadowQuality(SHADOW_QUALITY_HIGH); + break; + } + } + CShadows::InitialiseChangedSettings(); + SaveSettings(); + return; + case 63: + if ( nArrowsInput >= 0 ) + { + if ( ++m_nRadioMode > 2 ) + m_nRadioMode = 0; + } + else + { + if ( m_nRadioMode ) + --m_nRadioMode; + else + m_nRadioMode = 2; + } + SaveSettings(); + return; + case 54: + m_bBackIntoGame = true; + return; + case 57: + SetDefaultPreferences(aScreens[m_bCurrentMenuPage].entryList[2].targetMenu); + + if ( aScreens[m_bCurrentMenuPage].entryList[2].targetMenu == 36 ) + CControllerConfigManager::ReinitControls(); + + SaveSettings(); + SwitchToNewScreen(aScreens[m_bCurrentMenuPage].entryList[2].targetMenu); + SetHelperText(2); + return; + case 7: + SwitchToNewScreen(m_nController == 1 ? 40 : 39); + return; + case 8: + m_bInVehicleControlsScreen = false; + SwitchToNewScreen(38); + field_90 = 0; + return; + case 9: + m_bInVehicleControlsScreen = true; + SwitchToNewScreen(38); + field_90 = 0; + return; + case 45: + field_1B14 = 1; + field_1B09 = 1; + field_1B08 = 1; + field_1B0C = m_dwSelectedMenuItem; + field_F0 = &field_36[2]; + return; + case 53: + SwitchToNewScreen(43); + return; + case 55: + SwitchToNewScreen(-2); + return; + case 6: + field_1AEB = 1; + return; + case 37: + if ( m_nLanguage != 0 ) + { + m_nLanguage = 0; + m_bReinitLanguageSettings = true; + InitialiseChangedLanguageSettings(false); + SaveSettings(); + } + return; + case 38: + if ( m_nLanguage != 1 ) + { + m_nLanguage = 1; + m_bReinitLanguageSettings = true; + InitialiseChangedLanguageSettings(false); + SaveSettings(); + } + return; + case 39: + if ( m_nLanguage != 2 ) + { + m_nLanguage = 2; + m_bReinitLanguageSettings = true; + InitialiseChangedLanguageSettings(false); + SaveSettings(); + } + return; + case 40: + if ( m_nLanguage != 3 ) + { + m_nLanguage = 3; + m_bReinitLanguageSettings = true; + InitialiseChangedLanguageSettings(false); + SaveSettings(); + } + return; + case 41: + if ( m_nLanguage != 4 ) + { + m_nLanguage = 4; + m_bReinitLanguageSettings = true; + InitialiseChangedLanguageSettings(false); + SaveSettings(); + } + return; + case MENUACTION_TOGGLE_LANGUAGE_6: + if ( m_nLanguage != 5 ) + { + m_nLanguage = 5; + m_bReinitLanguageSettings = true; + InitialiseChangedLanguageSettings(false); + SaveSettings(); + } + return; + + case MENUACTION_UPDATER_BUTTON: + CUpdateManager::HandleButtonClick(); + return; + case MENUACTION_TOGGLE_DLC: + CDLCManager::HandleButtonClick(m_dwSelectedMenuItem); + return; + case MENUACTION_ACTIVATE_SERIAL: + if ( m_bSerialFull ) + CDLCManager::ActivateSerial(m_strSerialCode); + return; + case MENUACTION_AUTOINSTALL_UPDATES: + CUpdateManager::SetAutoInstall(CUpdateManager::AutoInstallEnabled() == false); + CUpdateManager::SaveSettings(); + return; + case MENUACTION_CHECKING_PERIOD: + if ( nArrowsInput >= 0 ) + { + unsigned char nPeriod = CUpdateManager::GetCheckingPeriod(); + if ( ++nPeriod > 3 ) + nPeriod = 0; + + CUpdateManager::SetCheckingPeriod(nPeriod); + } + else + { + unsigned char nPeriod = CUpdateManager::GetCheckingPeriod(); + if ( nPeriod ) + --nPeriod; + else + nPeriod = 3; + + CUpdateManager::SetCheckingPeriod(nPeriod); + } + CUpdateManager::SaveSettings(); + return; + case MENUACTION_TEXTURE_FILTERMODE: + if ( nArrowsInput >= 0 ) + { + unsigned char nFilteringQuality = Fx_c::GetTextureFilteringQuality(); + if ( ++nFilteringQuality > Fx_c::GetMaxTextureFilteringQuality() ) + nFilteringQuality = 0; + + Fx_c::SetTextureFilteringQuality(nFilteringQuality); + } + else + { + unsigned char nFilteringQuality = Fx_c::GetTextureFilteringQuality(); + if ( nFilteringQuality ) + --nFilteringQuality; + else + nFilteringQuality = Fx_c::GetMaxTextureFilteringQuality(); + + Fx_c::SetTextureFilteringQuality(nFilteringQuality); + } + SaveSettings(); + return; + case MENUACTION_EFFECTS_QUALITY: + if ( nArrowsInput >= 0 ) + { + switch ( Fx_c::GetEffectsQuality() ) + { + case FXQUALITY_LOW: + Fx_c::SetEffectsQuality(FXQUALITY_MEDIUM); + break; + case FXQUALITY_MEDIUM: + Fx_c::SetEffectsQuality(FXQUALITY_HIGH); + break; + case FXQUALITY_HIGH: + Fx_c::SetEffectsQuality(FXQUALITY_LOW); + break; + } + } + else + { + switch ( Fx_c::GetEffectsQuality() ) + { + case FXQUALITY_LOW: + Fx_c::SetEffectsQuality(FXQUALITY_HIGH); + break; + case FXQUALITY_MEDIUM: + Fx_c::SetEffectsQuality(FXQUALITY_LOW); + break; + case FXQUALITY_HIGH: + Fx_c::SetEffectsQuality(FXQUALITY_MEDIUM); + break; + } + } + SaveSettings(); + return; + } +} + +void CMenuManager::CentreMousePointer() +{ + POINT PointerPos; + PointerPos.x = RsGlobal.MaximumWidth / 2; + PointerPos.y = RsGlobal.MaximumHeight / 2; + + ClientToScreen(RsGlobal.ps->window, &PointerPos); + SetCursorPos(PointerPos.x, PointerPos.y); + + RsGlobal.ps->lastMousePos_X = RsGlobal.MaximumWidth / 2; + RsGlobal.ps->lastMousePos_Y = RsGlobal.MaximumHeight / 2; +} + void CMenuManager::DrawBackEnd() { // Calculate proper dimensions @@ -1365,7 +1978,6 @@ float CMenuManager::DisplaySlider(float posX, float posY, float height, float di BYTE positionCounter = 0; BYTE secondPositionCounter = 0; bool bDrawHalfSlider = false; - bool bGotLowestInactive = false; float fullWidth = 0.0; do @@ -2094,6 +2706,7 @@ void CMenuManager::SetDefaultPreferences(signed char bScreen) //g_fx.SetFxQuality(FXQUALITY_HIGH); Fx_c::SetEffectsQuality(FXQUALITY_HIGH); Fx_c::SetTextureFilteringQuality(1); // Trilinear + CShadows::SetShadowQuality(SHADOW_QUALITY_MEDIUM); // Reinit widescreen and framelimit stuff WidescreenSupport::Recalculate(RsGlobal.MaximumWidth, RsGlobal.MaximumHeight, true); @@ -2172,6 +2785,8 @@ float CMenuManager::GetTextYPosNextItem(const MenuItem::MenuEntry& pPosition) void CMenuManager::Inject() { Memory::InjectHook(0x57BA58, &DrawStandardMenus); + Memory::InjectHook(0x57B66F, &ProcessMenuOptions); + Memory::InjectHook(0x57B702, &ProcessMenuOptions); } // TODO: CLoadingScreen @@ -2270,173 +2885,6 @@ void LoadingScreen() } } -static void __declspec(naked) AutoInstallUpdates_RightColumm() -{ - _asm - { - mov cl, [CUpdateManager::bAutoInstallUpdates] - test cl, cl - mov ecx, [TheText] - jz AutoInstallUpdates_RightColumm_Off - push 579FA6h - retn - -AutoInstallUpdates_RightColumm_Off: - push 579F65h - retn - } -} - -static void __declspec(naked) CheckEvery_RightColumn() -{ - static const char aFem_Ch1[] = "FEU_CH1"; - static const char aFem_Ch2[] = "FEU_CH2"; - static const char aFem_Ch3[] = "FEU_CH3"; - static const char aFem_Ch4[] = "FEU_CH4"; - _asm - { - mov ecx, [TheText] - mov al, [CUpdateManager::bCheckingPeriod] - test al, al - jz CheckEvery_RightColumn_Ch1 - dec al - jz CheckEvery_RightColumn_Ch2 - dec al - jz CheckEvery_RightColumn_Ch3 - push offset aFem_Ch4 - jmp CheckEvery_RightColumn_Return - -CheckEvery_RightColumn_Ch1: - push offset aFem_Ch1 - jmp CheckEvery_RightColumn_Return - -CheckEvery_RightColumn_Ch2: - push offset aFem_Ch2 - jmp CheckEvery_RightColumn_Return - -CheckEvery_RightColumn_Ch3: - push offset aFem_Ch3 - -CheckEvery_RightColumn_Return: - push 57A161h - retn - } -} - -void __declspec(naked) TextureFiltering_RightColumn() -{ - static const char aFed_Tx0[] = "FED_TX0"; - static const char aFed_Tx1[] = "FED_TX1"; - static const char aFed_Tx2[] = "FED_TX2"; - static const char aFed_Tx3[] = "FED_TX3"; - static const char aFed_Tx4[] = "FED_TX4"; - static const char aFed_Tx5[] = "FED_TX5"; - _asm - { - mov ecx, [TheText] - mov al, [Fx_c::m_bTextureFiltering] - test al, al - jz TextureFiltering_RightColumn_Tx0 - dec al - jz TextureFiltering_RightColumn_Tx1 - dec al - jz TextureFiltering_RightColumn_Tx2 - dec al - jz TextureFiltering_RightColumn_Tx3 - dec al - jz TextureFiltering_RightColumn_Tx4 - push offset aFed_Tx5 - jmp TextureFiltering_RightColumn_Return - -TextureFiltering_RightColumn_Tx0: - push offset aFed_Tx0 - jmp TextureFiltering_RightColumn_Return - -TextureFiltering_RightColumn_Tx1: - push offset aFed_Tx1 - jmp TextureFiltering_RightColumn_Return - -TextureFiltering_RightColumn_Tx2: - push offset aFed_Tx2 - jmp TextureFiltering_RightColumn_Return - -TextureFiltering_RightColumn_Tx3: - push offset aFed_Tx3 - jmp TextureFiltering_RightColumn_Return - -TextureFiltering_RightColumn_Tx4: - push offset aFed_Tx4 - -TextureFiltering_RightColumn_Return: - push 57A161h - retn - } -} - -void __declspec(naked) EffectsQuality_RightColumn() -{ - static const char aFed_Fxl[] = "FED_FXL"; - static const char aFed_Fxm[] = "FED_FXM"; - static const char aFed_Fxh[] = "FED_FXH"; - _asm - { - mov ecx, [TheText] - mov eax, [Fx_c::m_bEffectsQuality] - test eax, eax - jz EffectsQuality_RightColumn_Low - dec eax - jz EffectsQuality_RightColumn_Medium - push offset aFed_Fxh - jmp EffectsQuality_RightColumn_Return - -EffectsQuality_RightColumn_Low: - push offset aFed_Fxl - jmp EffectsQuality_RightColumn_Return - -EffectsQuality_RightColumn_Medium: - push offset aFed_Fxm - -EffectsQuality_RightColumn_Return: - push 57A161h - retn - } -} - -/*void __declspec(naked) AntiAliasing_RightColumn() -{ - static const char aFed_Aa1[] = "FED_AA1"; - static const char aFed_Aa2[] = "FED_AA2"; - static const char aFed_Aa3[] = "FED_AA3"; - _asm - { - mov ecx, [TheText] - mov eax, [ebp].m_dwAntiAliasingLevel - cmp eax, 1 - jle AntiAliasing_RightColumn_Off - sub eax, 2 - jz AntiAliasing_RightColumn_2x - dec eax - jz AntiAliasing_RightColumn_4x - push offset aFed_Aa3 - jmp AntiAliasing_RightColumn_Return - -AntiAliasing_RightColumn_2x: - push offset aFed_Aa1 - jmp AntiAliasing_RightColumn_Return - -AntiAliasing_RightColumn_4x: - push offset aFed_Aa2 - -AntiAliasing_RightColumn_Return: - push 57A161h - retn - -AntiAliasing_RightColumn_Off: - push 579F65h - retn - } -}*/ - static void __declspec(naked) UserInputArrowSoundMenus() { _asm @@ -2459,29 +2907,6 @@ static void __declspec(naked) UserInputArrowSoundMenus() static StaticPatcher Patcher([](){ - static const BYTE StandardMenusRightColumn_Table[] = { - 0x00, 0x01, 0x02, 0x1B, 0x1B, 0x1B, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, - 0x1B, 0x1B, 0x1B, 0x1B, 0x1B, 0x0A, 0x0B, 0x0C, 0x1B, 0x0D, 0x0E, 0x0F, 0x10, - 0x11, 0x12, 0x13, 0x1B, 0x1B, 0x1B, 0x14, 0x1B, 0x15, 0x16, 0x17, 0x1B, 0x1B, - 0x18, 0x19, 0x1A, 0x1B, 0x1B, 0x1B, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F }; - - static const void* const StandardMenusRightColumn_Addresses[] = { - (void*)0x579EF0, (void*)0x579DDE, (void*)0x579DE6, - (void*)0x579DB9, (void*)0x579DB1, (void*)0x579DC1, - (void*)0x579DD6, (void*)0x579E37, (void*)0x579E67, - (void*)0x579DEE, /*ShadowsQuality_RightColumn*/ (void*)0x579EF8, - /*AntiAliasing_RightColumn,*/ (void*)0x579F57, (void*)0x579F6F, - (void*)0x579F77, (void*)0x579F7F, (void*)0x579F87, - (void*)0x579F8F, (void*)0x579F97, (void*)0x57A05A, - (void*)0x57A141, (void*)0x579FB0, (void*)0x57A005, - (void*)0x579E7A, (void*)0x579F4F, (void*)0x579E6F, - (void*)0x57A168, /*AutoInstallUpdates_RightColumm,*/ /*CheckEvery_RightColumn, */ - /*TextureFiltering_RightColumn, EffectsQuality_RightColumn*/ }; - - //Memory::Patch(0x579D9C, sizeof(StandardMenusRightColumn_Table)-1); - //Memory::Patch(0x579DA6, StandardMenusRightColumn_Table); - //Memory::Patch(0x579DAD, StandardMenusRightColumn_Addresses); - static const BYTE UserInputArrowSoundMenus_Table[] = { 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, diff --git a/VCS PC/Frontend.h b/VCS PC/Frontend.h index f82f020..d825e7b 100644 --- a/VCS PC/Frontend.h +++ b/VCS PC/Frontend.h @@ -166,14 +166,14 @@ class CMenuManager __int8 field_8; __int8 field_9[23]; bool m_bVibration; - bool m_bHudOn; + unsigned char m_bHudOn; __int8 field_22[2]; __int32 m_dwRadarMode; __int8 field_28[4]; __int32 field_2C; __int8 field_30; __int8 field_31; - __int8 field_32; + bool m_bBackIntoGame; bool m_bActivateMenuNextFrame; bool m_bMenuAccessWidescreen; __int8 field_35; @@ -232,7 +232,7 @@ class CMenuManager __int8 invertPadY2; __int8 swapPadAxis1; __int8 swapPadAxis2; - __int8 field_B7; + bool m_bInVehicleControlsScreen; bool m_bDrawMouse; __int8 field_B9[3]; __int32 m_dwMousePosLeft; @@ -254,7 +254,7 @@ class CMenuManager __int8 m_nPlayerNumber; bool m_bReinitLanguageSettings; __int32 field_EC; - __int32 field_F0; + void* field_F0; __int8 field_F4; __int8 field_F5[3]; union{ @@ -271,8 +271,8 @@ class CMenuManager bool m_bTexturesLoaded; signed char m_bCurrentMenuPage; signed char m_bLastMenuPage; - bool m_bSelectedSaveGame; - __int8 field_160; + unsigned char m_bSelectedSaveGame; + unsigned char m_bSelectedMissionPack; __int8 field_161; char m_mpackName[8]; __int8 field_16A[6486]; @@ -370,6 +370,9 @@ class CMenuManager static MenuItem ms_pMenus[]; private: + void ProcessMissionPackNewGame(); + void DoSettingsBeforeStartingAGame(); + void PrintStats(); void PrintUpdaterScreen(); void PrintDLCScreen(); @@ -378,6 +381,9 @@ class CMenuManager void DrawRadioStationIcons(); float DisplaySlider(float posX, float posY, float height, float distBetweenRects, float filledAmount, float width); + void CentreMousePointer(); + void ProcessMenuOptions(signed char nArrowsInput, bool* bReturn, bool bEnterInput); + public: inline BYTE GetHudMode() { return m_bHudOn; }; diff --git a/VCS PC/General.cpp b/VCS PC/General.cpp index 044d807..ec4d98c 100644 --- a/VCS PC/General.cpp +++ b/VCS PC/General.cpp @@ -12,7 +12,7 @@ WRAPPER void CEntity::Render() { EAXJMP(0x534310); } WRAPPER unsigned int CKeyGen::GetUppercaseKey(const char* pEntry) { WRAPARG(pEntry); EAXJMP(0x53CF30); } -bool& CGame::bMissionPackGame = *(bool*)0xB72910; +unsigned char& CGame::bMissionPackGame = *(unsigned char*)0xB72910; /*void CMatrix::UpdateRW() { diff --git a/VCS PC/General.h b/VCS PC/General.h index 80ad5c8..c4173aa 100644 --- a/VCS PC/General.h +++ b/VCS PC/General.h @@ -298,12 +298,8 @@ class CKeyGen // TODO: Move away? class CGame { -private: - static bool& bMissionPackGame; - public: - static inline bool IsMissionPackGame() - { return bMissionPackGame; } + static unsigned char& bMissionPackGame; }; diff --git a/VCS PC/MemoryMgr.h b/VCS PC/MemoryMgr.h index 76830f4..05d68a3 100644 --- a/VCS PC/MemoryMgr.h +++ b/VCS PC/MemoryMgr.h @@ -21,9 +21,13 @@ enum template inline void CheckMemoryBanList(AT address) { +#ifdef DEVBUILD unsigned int nAddress = (unsigned int)address; assert(nAddress < 0x5794A0 || nAddress > 0x57B43F); + assert(nAddress < 0x576FE0 || nAddress > 0x5773CF); + assert(nAddress < 0x57CD50 || nAddress > 0x57D51F); +#endif } namespace Memory diff --git a/VCS PC/Ped.cpp b/VCS PC/Ped.cpp index 4aa3451..c7e4437 100644 --- a/VCS PC/Ped.cpp +++ b/VCS PC/Ped.cpp @@ -43,55 +43,58 @@ bool CPed::Load() return true; } -void CPed::RenderForShadow(RpClump* pClump) +void CPed::RenderForShadow(RpClump* pClump, bool bRenderWeapon) { RpClumpForAllAtomics(pClump, ShadowCameraRenderCB, nullptr); - if ( m_pWeaponObject ) + if ( bRenderWeapon ) { - RpHAnimHierarchy* pAnimHierarchy = GetAnimHierarchyFromSkinClump(pClump); - bool bHasParachute = weaponSlots[m_bActiveWeapon].m_eWeaponType == WEAPONTYPE_PARACHUTE; - - RwFrame* pFrame = RpClumpGetFrame(reinterpret_cast(m_pWeaponObject)); - *RwFrameGetMatrix(pFrame) = RpHAnimHierarchyGetMatrixArray(pAnimHierarchy)[RpHAnimIDGetIndex(pAnimHierarchy, bHasParachute ? 3 : 24)]; - - if ( bHasParachute ) + if ( m_pWeaponObject ) { - const RwV3d vecParachuteTranslation = { 0.1f, -0.15f, 0.0f }; - const RwV3d vecParachuteRotation = { 0.0f, 1.0f, 0.0f }; - RwMatrixTranslate(RwFrameGetMatrix(pFrame), &vecParachuteTranslation, rwCOMBINEPRECONCAT); - RwMatrixRotate(RwFrameGetMatrix(pFrame), &vecParachuteRotation, 90.0f, rwCOMBINEPRECONCAT); - } - - RpGeometry* pWeaponGeometry = RpAtomicGetGeometry(GetFirstAtomic(reinterpret_cast(m_pWeaponObject))); - RwUInt32 weaponGeometryFlags = RpGeometryGetFlags(pWeaponGeometry); - RpGeometrySetFlags(pWeaponGeometry, weaponGeometryFlags & ~(rpGEOMETRYTEXTURED|rpGEOMETRYPRELIT| - rpGEOMETRYLIGHT|rpGEOMETRYMODULATEMATERIALCOLOR|rpGEOMETRYTEXTURED2)); - - RwFrameUpdateObjects(pFrame); - //AtomicDefaultRenderCallBack(GetFirstAtomic(reinterpret_cast(pPed->m_pWeaponObject))); - RpClumpRender(reinterpret_cast(m_pWeaponObject)); + RpHAnimHierarchy* pAnimHierarchy = GetAnimHierarchyFromSkinClump(pClump); + bool bHasParachute = weaponSlots[m_bActiveWeapon].m_eWeaponType == WEAPONTYPE_PARACHUTE; + + RwFrame* pFrame = RpClumpGetFrame(reinterpret_cast(m_pWeaponObject)); + *RwFrameGetMatrix(pFrame) = RpHAnimHierarchyGetMatrixArray(pAnimHierarchy)[RpHAnimIDGetIndex(pAnimHierarchy, bHasParachute ? 3 : 24)]; + + if ( bHasParachute ) + { + const RwV3d vecParachuteTranslation = { 0.1f, -0.15f, 0.0f }; + const RwV3d vecParachuteRotation = { 0.0f, 1.0f, 0.0f }; + RwMatrixTranslate(RwFrameGetMatrix(pFrame), &vecParachuteTranslation, rwCOMBINEPRECONCAT); + RwMatrixRotate(RwFrameGetMatrix(pFrame), &vecParachuteRotation, 90.0f, rwCOMBINEPRECONCAT); + } + + RpGeometry* pWeaponGeometry = RpAtomicGetGeometry(GetFirstAtomic(reinterpret_cast(m_pWeaponObject))); + RwUInt32 weaponGeometryFlags = RpGeometryGetFlags(pWeaponGeometry); + RpGeometrySetFlags(pWeaponGeometry, weaponGeometryFlags & ~(rpGEOMETRYTEXTURED|rpGEOMETRYPRELIT| + rpGEOMETRYLIGHT|rpGEOMETRYMODULATEMATERIALCOLOR|rpGEOMETRYTEXTURED2)); + + RwFrameUpdateObjects(pFrame); + //AtomicDefaultRenderCallBack(GetFirstAtomic(reinterpret_cast(pPed->m_pWeaponObject))); + RpClumpRender(reinterpret_cast(m_pWeaponObject)); - // Dual weapons - if ( CWeaponInfo::GetWeaponInfo(weaponSlots[m_bActiveWeapon].m_eWeaponType, GetWeaponSkill())->hexFlags >> 11 & 1 ) - { - *RwFrameGetMatrix(pFrame) = RpHAnimHierarchyGetMatrixArray(pAnimHierarchy)[RpHAnimIDGetIndex(pAnimHierarchy, 34)]; + // Dual weapons + if ( CWeaponInfo::GetWeaponInfo(weaponSlots[m_bActiveWeapon].m_eWeaponType, GetWeaponSkill())->hexFlags >> 11 & 1 ) + { + *RwFrameGetMatrix(pFrame) = RpHAnimHierarchyGetMatrixArray(pAnimHierarchy)[RpHAnimIDGetIndex(pAnimHierarchy, 34)]; - const RwV3d vecParachuteRotation = { 1.0f, 0.0f, 0.0f }; - const RwV3d vecParachuteTranslation = { 0.04f, -0.05f, 0.0f }; - RwMatrixRotate(RwFrameGetMatrix(pFrame), &vecParachuteRotation, 180.0f, rwCOMBINEPRECONCAT); - RwMatrixTranslate(RwFrameGetMatrix(pFrame), &vecParachuteTranslation, rwCOMBINEPRECONCAT); + const RwV3d vecParachuteRotation = { 1.0f, 0.0f, 0.0f }; + const RwV3d vecParachuteTranslation = { 0.04f, -0.05f, 0.0f }; + RwMatrixRotate(RwFrameGetMatrix(pFrame), &vecParachuteRotation, 180.0f, rwCOMBINEPRECONCAT); + RwMatrixTranslate(RwFrameGetMatrix(pFrame), &vecParachuteTranslation, rwCOMBINEPRECONCAT); - RwFrameUpdateObjects(pFrame); - RpClumpRender(reinterpret_cast(m_pWeaponObject)); + RwFrameUpdateObjects(pFrame); + RpClumpRender(reinterpret_cast(m_pWeaponObject)); + } + RpGeometrySetFlags(pWeaponGeometry, weaponGeometryFlags); } - RpGeometrySetFlags(pWeaponGeometry, weaponGeometryFlags); - } - // Render jetpack - auto* pJetPackTask = pPedIntelligence->GetTaskJetPack(); - if ( pJetPackTask ) - pJetPackTask->RenderJetPack(this); + // Render jetpack + auto* pJetPackTask = pPedIntelligence->GetTaskJetPack(); + if ( pJetPackTask ) + pJetPackTask->RenderJetPack(this); + } } diff --git a/VCS PC/Ped.h b/VCS PC/Ped.h index 938e273..40a0e70 100644 --- a/VCS PC/Ped.h +++ b/VCS PC/Ped.h @@ -304,7 +304,7 @@ class NOVMT CPed : public CPhysical long double GetCrosshairSize(); void Remap(); - void RenderForShadow(RpClump* pClump); + void RenderForShadow(RpClump* pClump, bool bRenderWeapon); }; class CPedData diff --git a/VCS PC/PostEffects.cpp b/VCS PC/PostEffects.cpp new file mode 100644 index 0000000..8be47cb --- /dev/null +++ b/VCS PC/PostEffects.cpp @@ -0,0 +1,4 @@ +#include "StdAfx.h" +#include "PostEffects.h" + +WRAPPER void CPostEffects::DoScreenModeDependentInitializations() { EAXJMP(0x7046D0); } \ No newline at end of file diff --git a/VCS PC/PostEffects.h b/VCS PC/PostEffects.h new file mode 100644 index 0000000..abbfb91 --- /dev/null +++ b/VCS PC/PostEffects.h @@ -0,0 +1,10 @@ +#ifndef __POSTEFFECTS +#define __POSTEFFECTS + +class CPostEffects +{ +public: + static void DoScreenModeDependentInitializations(); +}; + +#endif \ No newline at end of file diff --git a/VCS PC/RW.cpp b/VCS PC/RW.cpp index 37af553..377569b 100644 --- a/VCS PC/RW.cpp +++ b/VCS PC/RW.cpp @@ -50,6 +50,7 @@ WRAPPER RwFrame* RwFrameOrthoNormalize(RwFrame* frame) { WRAPARG(frame); EAXJMP( WRAPPER RwVideoMode* RwEngineGetVideoModeInfo(RwVideoMode* modeinfo, RwInt32 modeIndex) { WRAPARG(modeinfo); WRAPARG(modeIndex); EAXJMP(0x7F2CF0); } WRAPPER RwInt32 RwEngineGetCurrentVideoMode() { EAXJMP(0x7F2D20); } WRAPPER RwInt32 RwEngineGetCurrentSubSystem() { EAXJMP(0x7F2C60); } +WRAPPER RwInt32 RwEngineGetNumVideoModes() { EAXJMP(0x7F2CC0); } WRAPPER RwMatrix* RpHAnimHierarchyGetMatrixArray(RpHAnimHierarchy* hierarchy) { WRAPARG(hierarchy); EAXJMP(0x7C5120); } WRAPPER RwInt32 RpHAnimIDGetIndex(RpHAnimHierarchy* hierarchy, RwInt32 ID) { WRAPARG(hierarchy); WRAPARG(ID); EAXJMP(0x7C51A0); } @@ -58,6 +59,9 @@ WRAPPER RwInt8 RpAnisotGetMaxSupportedMaxAnisotropy() { EAXJMP(0x748F20); } WRAPPER RwTexture* RpAnisotTextureSetMaxAnisotropy(RwTexture* tex, RwInt8 val) { WRAPARG(tex); WRAPARG(val); EAXJMP(0x748F30); } WRAPPER RwInt8 RpAnisotTextureGetMaxAnisotropy(RwTexture* tex) { WRAPARG(tex); EAXJMP(0x748F50); } +WRAPPER RwBool RwD3D9ChangeMultiSamplingLevels(RwUInt32 numLevels) { WRAPARG(numLevels); EAXJMP(0x7F8A90); } +WRAPPER RwUInt32 RwD3D9EngineGetMaxMultiSamplingLevels() { EAXJMP(0x7F84E0); } + RwCamera* RwCameraBeginUpdate(RwCamera* camera) { return camera->beginUpdate(camera); diff --git a/VCS PC/RealTimeShadowMgr.cpp b/VCS PC/RealTimeShadowMgr.cpp index 17f6185..9b95eb6 100644 --- a/VCS PC/RealTimeShadowMgr.cpp +++ b/VCS PC/RealTimeShadowMgr.cpp @@ -21,6 +21,34 @@ WRAPPER void CShadowCamera::InvertRaster() { EAXJMP(0x705660); } WRAPPER void CRealTimeShadow::Destroy() { EAXJMP(0x705990); } WRAPPER bool CRealTimeShadow::SetShadowedObject(CPhysical* pObject) { WRAPARG(pObject); EAXJMP(0x706520); } +RpAtomic* ShadowCameraRenderCB_Vehicle(RpAtomic* pAtomic, void* pData) +{ + // Check if to render this basing on settings + if ( reinterpret_cast(pData) ) + { + // Reject if it's a LOD + if ( strstr(GetFrameNodeName(RpAtomicGetFrame(pAtomic)), "_vlo") ) + return pAtomic; + } + else + { + // Reject if it's not a LOD + if ( !strstr(GetFrameNodeName(RpAtomicGetFrame(pAtomic)), "_vlo") ) + return pAtomic; + } + + RxPipeline* pOldPipe; + + RpAtomicGetPipeline(pAtomic, &pOldPipe); + RpAtomicSetPipeline(pAtomic, RpAtomicGetDefaultPipeline()); + + ShadowCameraRenderCB(pAtomic, pData); + + RpAtomicSetPipeline(pAtomic, pOldPipe); + + return pAtomic; +} + RpAtomic* ShadowCameraRenderCB(RpAtomic* pAtomic, void* pData) { UNREFERENCED_PARAMETER(pData); @@ -29,6 +57,7 @@ RpAtomic* ShadowCameraRenderCB(RpAtomic* pAtomic, void* pData) { RpGeometry* pGeometry = RpAtomicGetGeometry(pAtomic); RwUInt32 geometryFlags = RpGeometryGetFlags(pGeometry); + RpGeometrySetFlags(pGeometry, geometryFlags & ~(rpGEOMETRYTEXTURED|rpGEOMETRYPRELIT| rpGEOMETRYLIGHT|rpGEOMETRYMODULATEMATERIALCOLOR|rpGEOMETRYTEXTURED2)); @@ -99,7 +128,7 @@ RwCamera* CShadowCamera::Update(RpClump* pClump, CPhysical* pEntity) if ( pEntity ) { if ( pEntity->nType == 3 ) - static_cast(pEntity)->RenderForShadow(pClump); + static_cast(pEntity)->RenderForShadow(pClump, true); else if ( pEntity->nType == 2 ) static_cast(pEntity)->RenderForShadow(pClump); } @@ -543,4 +572,8 @@ static StaticPatcher Patcher([](){ Memory::Patch(0x706AD4, NUM_MAX_REALTIME_SHADOWS); Memory::Patch(0x706B80, NUM_MAX_REALTIME_SHADOWS); + + Memory::Patch(0x706AF3, 0xB8); + Memory::Patch(0x706AF4, SHADOWS_MAX_INTENSITY); + Memory::Patch(0x706AF8, 0x15EB); }); \ No newline at end of file diff --git a/VCS PC/RealTimeShadowMgr.h b/VCS PC/RealTimeShadowMgr.h index fd17f24..58b247e 100644 --- a/VCS PC/RealTimeShadowMgr.h +++ b/VCS PC/RealTimeShadowMgr.h @@ -1,7 +1,9 @@ #ifndef __REALTIMESHADOWMGR #define __REALTIMESHADOWMGR -#define NUM_MAX_REALTIME_SHADOWS 64 +#define NUM_MAX_REALTIME_SHADOWS 56 + +#define SHADOWS_MAX_INTENSITY 100 struct tShadowQualitySettings { @@ -126,6 +128,7 @@ class CRealTimeShadowManager }; RpAtomic* ShadowCameraRenderCB(RpAtomic* pAtomic, void* pData); +RpAtomic* ShadowCameraRenderCB_Vehicle(RpAtomic* pAtomic, void* pData); extern CRealTimeShadowManager g_realTimeShadowMan; diff --git a/VCS PC/Rs.cpp b/VCS PC/Rs.cpp index e5c8db9..71688f9 100644 --- a/VCS PC/Rs.cpp +++ b/VCS PC/Rs.cpp @@ -15,6 +15,7 @@ WRAPPER RpHAnimHierarchy* GetAnimHierarchyFromSkinClump(RpClump* pClump) { WRAPA WRAPPER void* GtaOperatorNew(size_t size) { WRAPARG(size); EAXJMP(0x82119A); } WRAPPER void GtaOperatorDelete(void* ptr) { WRAPARG(ptr); EAXJMP(0x82413F); } +WRAPPER const char* GetFrameNodeName(RwFrame* pFrame) { WRAPARG(pFrame); EAXJMP(0x72FB30); } static RpAtomic* GetFirstAtomicCallback(RpAtomic* pAtomic, void* pData) { diff --git a/VCS PC/Rs.h b/VCS PC/Rs.h index ab4cc63..57c0a44 100644 --- a/VCS PC/Rs.h +++ b/VCS PC/Rs.h @@ -141,6 +141,7 @@ void DefinedState2d(); void CameraSize(RwCamera* camera, RwRect* rect, float fViewWindow, float fAspectRatio); RpAtomic* GetFirstAtomic(RpClump* pClump); +const char* GetFrameNodeName(RwFrame* pFrame); RpHAnimHierarchy* GetAnimHierarchyFromSkinClump(RpClump* pClump); // GTA heap funcs diff --git a/VCS PC/Shadows.cpp b/VCS PC/Shadows.cpp index 2b1c49e..44adf43 100644 --- a/VCS PC/Shadows.cpp +++ b/VCS PC/Shadows.cpp @@ -11,6 +11,10 @@ eShadowQuality CShadows::m_bShadowQuality; float& MAX_DISTANCE_PED_SHADOWS = *(float*)0x8D5240; +// SHADOW DRAW DISTANCES +// Ped +// Min - ??? Max - 45.0 + void CShadows::RenderIndicatorShadow(unsigned int nIndex, unsigned char, RwTexture*, CVector* pPos, float radiusX, float, float, float radiusY, short) { C3DMarkers::PlaceMarkerSet(nIndex, 1, *pPos, radiusX > -radiusY ? radiusX : -radiusY, MARKER_SET_COLOR_R, MARKER_SET_COLOR_G, MARKER_SET_COLOR_B, MARKER_SET_COLOR_A, 2048, 0.2f); @@ -30,7 +34,7 @@ bool CShadows::StoreRealTimeShadowForVehicle(CVehicle* pVehicle) return pVehicle->GetSubClass() == VEHICLE_HELI || pVehicle->GetSubClass() == VEHICLE_PLANE; } - return false; + return m_bShadowQuality == SHADOW_QUALITY_OFF; } void CShadows::StoreRealTimeShadowForObject(CObject* pObject) diff --git a/VCS PC/StdAfx.h b/VCS PC/StdAfx.h index 64de88b..adcbb9a 100644 --- a/VCS PC/StdAfx.h +++ b/VCS PC/StdAfx.h @@ -145,6 +145,9 @@ void EnterAmazingScreenshotMode(bool bEnable); #include #include +#undef RXPIPELINEGLOBAL(var) +#define RXPIPELINEGLOBAL(var) (RWPLUGINOFFSET(rwPipeGlobals, RwEngineInstance, *(RwInt32*)0xC9BC60)->var) + #include "CCRC32.h" #include "MemoryMgr.h" #include "StaticPatcher.h" diff --git a/VCS PC/Text.cpp b/VCS PC/Text.cpp index 500ac63..dae22af 100644 --- a/VCS PC/Text.cpp +++ b/VCS PC/Text.cpp @@ -36,7 +36,7 @@ const char* CText::Get(const char* pEntry) if ( !bFound ) { - if ( missionLoaded || CGame::IsMissionPackGame() || haveTabl ) + if ( missionLoaded || CGame::bMissionPackGame != 0 || haveTabl ) { outputText = tkeyMission.Search(pEntry, &bFound); if ( !bFound ) diff --git a/VCS PC/UpdateManager.h b/VCS PC/UpdateManager.h index f1ff451..b441eb3 100644 --- a/VCS PC/UpdateManager.h +++ b/VCS PC/UpdateManager.h @@ -38,6 +38,11 @@ class CUpdateManager static inline unsigned char GetCheckingPeriod() { return bCheckingPeriod; } + static inline void SetCheckingPeriod(unsigned char nPeriod) + { bCheckingPeriod = nPeriod; } + static inline void SetAutoInstall(bool bEnabled) + { bAutoInstallUpdates = bEnabled; } + static inline bool IsDownloading() { return nInterfaceStatus == UPTMODULESTATE_DOWNLOADING || nInterfaceStatus == UPTMODULESTATE_ALL_READY; } diff --git a/VCS PC/VCS PC.vcxproj b/VCS PC/VCS PC.vcxproj index 9f811ec..0597198 100644 --- a/VCS PC/VCS PC.vcxproj +++ b/VCS PC/VCS PC.vcxproj @@ -356,6 +356,7 @@ popd + @@ -447,6 +448,7 @@ popd + diff --git a/VCS PC/VCS PC.vcxproj.filters b/VCS PC/VCS PC.vcxproj.filters index 8326494..7a42640 100644 --- a/VCS PC/VCS PC.vcxproj.filters +++ b/VCS PC/VCS PC.vcxproj.filters @@ -243,6 +243,9 @@ Source Files + + Source Files + @@ -488,6 +491,9 @@ Header Files + + Header Files + diff --git a/VCS PC/VCSPC.cpp b/VCS PC/VCSPC.cpp index da1c9c0..4f6a80a 100644 --- a/VCS PC/VCSPC.cpp +++ b/VCS PC/VCSPC.cpp @@ -431,13 +431,9 @@ static const char aSpanish_gxt[] = "SPANISH.GXT"; static const char aPolish_gxt[] = "POLISH.GXT"; static const char aHungarian_gxt[] = "HUNGARIAN.GXT"; static const char aRomanian_gxt[] = "ROMANIAN.GXT"; -static const char aFem_24H[] = "FEM_24H"; -static const char aFem_12H[] = "FEM_12H"; -static const char aFem_Fps[] = "FEM_FPS"; -static const char aFem_Asd[] = "FEM_AS%d"; -#ifdef ADD_UNFINISHED_WINDOWED_MODE -const char aWindowed[] = "WINDOWED"; -#endif + +static const char aWindowed[] = "WINDOWED"; + const BYTE audioGearboxSoundTable[] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, @@ -479,32 +475,6 @@ const BYTE CAutomobile__PreRenderCoronasTable[] = { 4, 4, 4, 0, 0, 0, 0, 4, 4, 4, 4, 2 }; -const BYTE PCMenuActionsTable[] = { - 0, 1, 2, 3, 33, 33, 33, 33, - 33, 33, 33, 33, 33, 33, 33, 33, - 33, 33, 4, 33, 33, 33, 33, 33, - 33, 33, 33, 33, 5, 33, 33, 6, - 7, 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 28, 29, 33, 33, - 30, 31, 32, 34, 35, 36, 37, 38, 39, 40, 41 }; - -const void* const PCMenuActionsAddresses[] = { - (void*)0x57D397, (void*)0x57D2FA, (void*)0x57D322, - (void*)0x57D32B, (void*)0x57CEC7, (void*)0x57D3A5, - (void*)0x57D418, (void*)0x57D3CD, (void*)0x57D3DD, - (void*)0x57D3EF, (void*)0x57D401, ShadowsQualityMenuAction, - (void*)0x57CEE1, (void*)0x57D0C6, (void*)0x57D34C, - (void*)0x57CD8F, (void*)0x57CDAD, (void*)0x57CDCD, - (void*)0x57CDED, (void*)0x57CE0D, (void*)0x57CE2D, - (void*)0x57CE4D, (void*)0x57D375, (void*)0x57D25D, - (void*)0x57D386, (void*)0x57CF9B, (void*)0x57D268, - (void*)0x57CF5B, (void*)0x57CE6D, (void*)0x57CE9A, - (void*)0x57D21F, (void*)0x57CF1B, (void*)0x57CF3B, - (void*)0x57D447, Language6Action, UpdaterMenuAction, - DLCMenuAction, ActivateSerialAction, AutoInstallUpdatesAction, - CheckEveryAction, TextureFilteringAction, EffectsQualityAction }; - const int iRadioTracks[NUM_RADIOSTATIONS][31] = { { AA_OFFSET+1, AA_OFFSET+4, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922 }, { CH_OFFSET+1, CH_OFFSET+4, CH_OFFSET+7, CH_OFFSET+10, CH_OFFSET+13, CH_OFFSET+16, CH_OFFSET+19, CH_OFFSET+22, CH_OFFSET+25, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922, 1922 }, @@ -3056,9 +3026,9 @@ __forceinline void Main_Patches() //InjectHook(0x579D50, &UpdaterTextSwap, PATCH_JUMP); // InjectHook(0x576E13, &MenuToggleHack, PATCH_JUMP // InjectHook(0x573680, &SetToNewMenuHack, PATCH_JUMP); - Patch(0x57CD84, PCMenuActionsTable); - Patch(0x57CD8B, PCMenuActionsAddresses); - Patch(0x57CD74, sizeof(PCMenuActionsTable)-1); + //Patch(0x57CD84, PCMenuActionsTable); + //Patch(0x57CD8B, PCMenuActionsAddresses); + //Patch(0x57CD74, sizeof(PCMenuActionsTable)-1); Patch(0x573830, 0xCE8B); Patch(0x573832, 0x5E); InjectHook(0x573833, &CMenuManager::SwitchToNewScreenVCS, PATCH_JUMP); @@ -3123,9 +3093,9 @@ __forceinline void Main_Patches() InjectHook(0x748D83, &MaxosFrameLimitHack, PATCH_JUMP); InjectHook(0x748D9A, &MaxosFrameLimitHack, PATCH_JUMP); - InjectHook(0x57CECA, &FrameLimit_SwitchInject, PATCH_JUMP); + //InjectHook(0x57CECA, &FrameLimit_SwitchInject, PATCH_JUMP); //InjectHook(0x579EF3, &FrameLimit_StringInject); - InjectHook(0x57CD05, &FrameLimit_SetFPS, PATCH_JUMP); + //InjectHook(0x57CD05, &FrameLimit_SetFPS, PATCH_JUMP); /*call(0x573BB8, &FrameLimit_SetFPS2, PATCH_CALL); Nop(0x573BBD, 1);*/ //InjectHook(0x573BF0, &FrameLimit_SetFPS2, PATCH_JUMP); @@ -3220,7 +3190,7 @@ __forceinline void Main_Patches() //Patch(0x57A2BD, 4); // 12H Clock menu options - InjectHook(0x577086, &Clock_SwitchInject, PATCH_JUMP); + //InjectHook(0x577086, &Clock_SwitchInject, PATCH_JUMP); //InjectHook(0x579E6A, &Clock_StringInject); // Pink menu header @@ -3311,7 +3281,7 @@ __forceinline void Main_Patches() // Stats Menu //InjectHook(0x57954A, &CMenuManager::PrintStats, PATCH_NOTHING); - Patch(0x577370, &StatsMenuActionHack); + //Patch(0x577370, &StatsMenuActionHack); // Brightness //Patch(0x573B8A, 96.0 / 512.0); @@ -3558,7 +3528,7 @@ __forceinline void Main_Patches() InjectHook(0x58C3C8, &WidescreenTextPositionHack, PATCH_CALL); InjectHook(0x58BB88, &WidescreenSupport::GetTextBoxPos, PATCH_CALL); // InjectHook(0x714841, &WidescreenSkyWidthHack, PATCH_CALL); - InjectHook(0x57706E, &Widescreen_SwitchInject, PATCH_JUMP); + //InjectHook(0x57706E, &Widescreen_SwitchInject, PATCH_JUMP); //InjectHook(0x579DE9, &Widescreen_StringInject); // InjectHook(0x58C0BB, &Widescreen_TextDrawsFix, PATCH_CALL); InjectHook(0x58C1EC, &Widescreen_TextDrawsFix2, PATCH_JUMP); @@ -3903,8 +3873,8 @@ __forceinline void Main_Patches() Patch(0x5D0F4B, SlotFileName); //Patch(0x579BD5, SlotValidation); Patch(0x57B6AD, SlotValidation); - Patch(0x5772B3, &SlotValidation[1]); - Patch(0x5772D3, &SlotValidation[1]); + //Patch(0x5772B3, &SlotValidation[1]); + //Patch(0x5772D3, &SlotValidation[1]); //Patch(0x5797D7, &SlotValidation[1]); Patch(0x619157, &SlotValidation[1]); Patch(0x61922D, &SlotValidation[1]); @@ -3914,8 +3884,8 @@ __forceinline void Main_Patches() Patch(0x57378F, NUM_SAVE_SLOTS+1); Patch(0x619388, NUM_SAVE_SLOTS); - Patch(0x57728F, ACTION_SAVE_12); - Patch(0x5772FD, ACTION_SAVE_12); + //Patch(0x57728F, ACTION_SAVE_12); + //Patch(0x5772FD, ACTION_SAVE_12); //Patch(0x579921, ACTION_SAVE_12); //Patch(0x579BB6, ACTION_SAVE_12); //Patch(0x57A241, ACTION_SAVE_12); @@ -3938,7 +3908,7 @@ __forceinline void Main_Patches() Patch(0x576B18, sizeof(MenuItem)); Patch(0x576B30, sizeof(MenuItem)); Patch(0x576B4F, sizeof(MenuItem)); - Patch(0x57700A, sizeof(MenuItem)); + //Patch(0x57700A, sizeof(MenuItem)); //Patch(0x579562, sizeof(MenuItem)); //Patch(0x579678, sizeof(MenuItem)); //Patch(0x5796A9, sizeof(MenuItem)); @@ -3974,9 +3944,9 @@ __forceinline void Main_Patches() Patch(0x57B692, sizeof(MenuItem)); Patch(0x57B6E7, sizeof(MenuItem)); Patch(0x57C30D, sizeof(MenuItem)); - Patch(0x57CD60, sizeof(MenuItem)); - Patch(0x57D281, sizeof(MenuItem)); - Patch(0x57D2CA, sizeof(MenuItem)); + //Patch(0x57CD60, sizeof(MenuItem)); + //Patch(0x57D281, sizeof(MenuItem)); + //Patch(0x57D2CA, sizeof(MenuItem)); Patch(0x57D6D3, sizeof(MenuItem)); Patch(0x57D6FB, sizeof(MenuItem)); Patch(0x57E3EC, sizeof(MenuItem)); @@ -4192,10 +4162,10 @@ __forceinline void PatchMenus() Patch(0x576B1E, &MenuEntriesList->entryList[1].targetMenu); Patch(0x576B38, MenuEntriesList); Patch(0x576B58, &MenuEntriesList->entryList->entry); - Patch(0x577017, &MenuEntriesList->entryList->action); - Patch(0x57723D, &MenuEntriesList->entryList->targetMenu); - Patch(0x577280, &MenuEntriesList->entryList->specialDescFlag); - Patch(0x5772F2, &MenuEntriesList->entryList->specialDescFlag); + //Patch(0x577017, &MenuEntriesList->entryList->action); + //Patch(0x57723D, &MenuEntriesList->entryList->targetMenu); + //Patch(0x577280, &MenuEntriesList->entryList->specialDescFlag); + //Patch(0x5772F2, &MenuEntriesList->entryList->specialDescFlag); //Patch(0x579568, MenuEntriesList); //Patch(0x57967E, MenuEntriesList); //Patch(0x5796AF, &MenuEntriesList->entryList->action); @@ -4252,10 +4222,10 @@ __forceinline void PatchMenus() Patch(0x57B69C, &MenuEntriesList->entryList->specialDescFlag); Patch(0x57B6F1, &MenuEntriesList->entryList->specialDescFlag); Patch(0x57C313, &MenuEntriesList->entryList->action); - Patch(0x57CD6B, &MenuEntriesList->entryList->action); - Patch(0x57D26C, &MenuEntriesList->entryList[2].targetMenu); - Patch(0x57D287, &MenuEntriesList->entryList[2].targetMenu); - Patch(0x57D2D2, &MenuEntriesList->entryList[2].targetMenu); + //Patch(0x57CD6B, &MenuEntriesList->entryList->action); + //Patch(0x57D26C, &MenuEntriesList->entryList[2].targetMenu); + //Patch(0x57D287, &MenuEntriesList->entryList[2].targetMenu); + //Patch(0x57D2D2, &MenuEntriesList->entryList[2].targetMenu); Patch(0x57D6D8, &MenuEntriesList->entryList->entry); Patch(0x57D701, &MenuEntriesList->entryList->entry); Patch(0x57E3F7, &MenuEntriesList->entryList->action); @@ -5549,29 +5519,6 @@ void __declspec(naked) Clock_SwitchInject() } } -/*void __declspec(naked) Clock_StringInject() -{ - _asm - { - mov ecx, [TheText] - cmp al, 1 - jnz Clock_StringInject_Compare12H - push offset aFem_24H - jmp Clock_StringInject_GoBack - -Clock_StringInject_Compare12H: - cmp al, 2 - jnz Clock_StringInject_DisplayOFF - push offset aFem_12H - -Clock_StringInject_GoBack: - jmp Clock_StringInject_JumpBack - -Clock_StringInject_DisplayOFF: - jmp Clock_StringInject_JumpToOFF - } -}*/ - void __declspec(naked) RadioNameInject() { _asm @@ -6429,64 +6376,6 @@ void __declspec(naked) WidescreenTextPositionHack() } }*/ -void __declspec(naked) Widescreen_SwitchInject() -{ - _asm - { - mov dl, [esp+0Ch+4] - cmp dl, 0 - jl Widescreen_SwitchInject_Previous - cmp al, 5 - jnl Widescreen_SwitchInject_ZeroTheValue - inc al - jmp Widescreen_SwitchInject_Return - -Widescreen_SwitchInject_ZeroTheValue: - xor al, al - jmp Widescreen_SwitchInject_Return - -Widescreen_SwitchInject_Previous: - test al, al - jz Widescreen_SwitchInject_ToMax - dec al - jmp Widescreen_SwitchInject_Return - -Widescreen_SwitchInject_ToMax: - mov al, 5 - -Widescreen_SwitchInject_Return: - mov [esi].m_bAspectRatioMode, al - mov eax, [RsGlobal] - push 1 - push [eax].MaximumHeight - push [eax].MaximumWidth - call WidescreenSupport::Recalculate - add esp, 0Ch - mov ecx, esi - call CMenuManager::SaveSettings - pop edi - pop esi - pop ebx - retn 0Ch - } -} - -void __declspec(naked) Widescreen_StringInject() -{ - _asm - { - movzx eax, al - push eax - push offset aFem_Asd - push LENGTH gString - push offset gString - call _snprintf - add esp, 10h - mov ecx, [TheText] - push offset gString - //jmp Clock_StringInject_JumpBack - } -} /*void __declspec(naked) Widescreen_TextDrawsFix() { @@ -6845,34 +6734,6 @@ void __declspec(naked) FrameLimit_SwitchInject() } } -void __declspec(naked) FrameLimit_StringInject() -{ - _asm - { - mov ecx, [TheText] - test al, al - jz FrameLimit_StringInject_Off - movzx eax, al - push offset gString - push 0 - push 0 - push 0 - push 0 - push 0 - push RsGlobalFrameLimits[eax*4] - push offset aFem_Fps - call CText::Get - push eax - call CMessages::InsertNumberInString - add esp, 20h - mov esi, offset gString - //jmp FrameLimit_StringInject_JumpBack - -FrameLimit_StringInject_Off: - //jmp Clock_StringInject_JumpToOFF - } -} - void __declspec(naked) FrameLimit_SetFPS() { _asm @@ -6892,28 +6753,6 @@ void __declspec(naked) FrameLimit_SetFPS() } } -void __declspec(naked) FrameLimit_SetFPS2() -{ - _asm - { - mov [esi].m_bFrameLimiterMode, 2 - mov [esi].m_bHudOn, bl - mov ebx, RsGlobalFrameLimits+8 - mov ecx, [RsGlobal] - mov [ecx].frameLimit, ebx - mov [esi].m_bAspectRatioMode, al - mov [esi].m_bShowSubtitles, al - push 1 - push [ecx].MaximumHeight - push [ecx].MaximumWidth - call WidescreenSupport::Recalculate - add esp, 0Ch - pop ebx - pop esi - retn 4 - } -} - void __declspec(naked) CameraInitHack() { _asm @@ -7152,19 +6991,6 @@ void __declspec(naked) UpdaterTextSwap() } } -void __declspec(naked) UpdaterMenuAction() -{ - _asm - { - call CUpdateManager::HandleButtonClick - pop edi - pop esi - mov al, bl - pop ebx - retn 8 - } -} - static bool bThisIMGIsEncrypted; void __stdcall DecryptIMG(CBlowFish* pEncryption, unsigned char* pBuf, size_t nSize, int iMode) @@ -7256,163 +7082,6 @@ void __declspec(naked) LoadGameWithDLCHack() } } -void __declspec(naked) DLCMenuAction() -{ - _asm - { - push [esi]CMenuManager.m_dwSelectedMenuItem - call CDLCManager::HandleButtonClick - add esp, 4 - pop edi - pop esi - mov al, bl - pop ebx - retn 8 - } -} - -void __declspec(naked) ActivateSerialAction() -{ - _asm - { - mov al, CMenuManager::m_bSerialFull - test al, al - jz ActivateSerialAction_DontActivate - push offset CMenuManager::m_strSerialCode - call CDLCManager::ActivateSerial - add esp, 4 - -ActivateSerialAction_DontActivate: - pop edi - pop esi - mov al, bl - pop ebx - retn 8 - } -} - -void __declspec(naked) AutoInstallUpdatesAction() -{ - _asm - { - mov al, [CUpdateManager::bAutoInstallUpdates] - test al, al - setz al - mov [CUpdateManager::bAutoInstallUpdates], al - call CUpdateManager::SaveSettings - pop edi - pop esi - mov al, bl - pop ebx - retn 8 - } -} - -void __declspec(naked) CheckEveryAction() -{ - _asm - { - mov al, [CUpdateManager::bCheckingPeriod] - mov dl, [esp+0Ch+4] - cmp dl, 0 - jl CheckEveryAction_Previous - inc al - cmp al, 3 - jna CheckEveryAction_Return - xor al, al - jmp CheckEveryAction_Return - -CheckEveryAction_Previous: - test al, al - jz CheckEveryAction_ToMax - dec al - jmp CheckEveryAction_Return - -CheckEveryAction_ToMax: - mov al, 3 - -CheckEveryAction_Return: - mov [CUpdateManager::bCheckingPeriod], al - call CUpdateManager::SaveSettings - pop edi - pop esi - mov al, bl - pop ebx - retn 8 - } -} - -void __declspec(naked) TextureFilteringAction() -{ - _asm - { - call Fx_c::GetMaxTextureFilteringQuality - mov cl, [Fx_c::m_bTextureFiltering] - mov dl, [esp+0Ch+4] - cmp dl, 0 - jl TextureFilteringAction_Previous - inc cl - cmp cl, al - jna TextureFilteringAction_Return - xor cl, cl - jmp TextureFilteringAction_Return - -TextureFilteringAction_Previous: - test cl, cl - jz TextureFilteringAction_ToMax - dec cl - jmp TextureFilteringAction_Return - -TextureFilteringAction_ToMax: - mov cl, al - -TextureFilteringAction_Return: - mov [Fx_c::m_bTextureFiltering], cl - mov ecx, esi - call CMenuManager::SaveSettings - pop edi - pop esi - mov al, bl - pop ebx - retn 8 - } -} - -void __declspec(naked) EffectsQualityAction() -{ - _asm - { - mov eax, [Fx_c::m_bEffectsQuality] - mov dl, [esp+0Ch+4] - cmp dl, 0 - jl EffectsQualityAction_Previous - inc eax - cmp eax, 2 - jna EffectsQualityAction_Return - xor eax, eax - jmp EffectsQualityAction_Return - -EffectsQualityAction_Previous: - test eax, eax - jz EffectsQualityAction_ToMax - dec eax - jmp EffectsQualityAction_Return - -EffectsQualityAction_ToMax: - mov eax, 2 - -EffectsQualityAction_Return: - mov [Fx_c::m_bEffectsQuality], eax - mov ecx, esi - call CMenuManager::SaveSettings - pop edi - pop esi - mov al, bl - pop ebx - retn 8 - } -} - void __declspec(naked) ShadowsQualityMenuAction() { _asm diff --git a/VCS PC/Vehicle.cpp b/VCS PC/Vehicle.cpp index b72c5b0..c4e0404 100644 --- a/VCS PC/Vehicle.cpp +++ b/VCS PC/Vehicle.cpp @@ -6,6 +6,7 @@ #include "PlayerInfo.h" #include "Pad.h" #include "RealTimeShadowMgr.h" +#include "Shadows.h" WRAPPER void CVehicle::SetWindowOpenFlag(unsigned char nWindow) { WRAPARG(nWindow); EAXJMP(0x6D3080); } WRAPPER void CVehicle::ClearWindowOpenFlag(unsigned char nWindow) { WRAPARG(nWindow); EAXJMP(0x6D30B0); } @@ -36,20 +37,25 @@ void CVehicle::SetComponentAtomicAlpha(RpAtomic* pAtomic, int nAlpha) void CVehicle::RenderForShadow(RpClump* pClump) { - RpClumpForAllAtomics(pClump, ShadowCameraRenderCB, nullptr); + bool bOpenTop = m_dwVehicleSubClass == VEHICLE_QUAD || m_dwVehicleSubClass == VEHICLE_BIKE || m_dwVehicleSubClass == VEHICLE_BMX; + bool bRenderAtLower = bOpenTop || CShadows::GetShadowQuality() > SHADOW_QUALITY_MEDIUM; - // Is open top? - if ( m_dwVehicleSubClass == VEHICLE_QUAD || m_dwVehicleSubClass == VEHICLE_BIKE || m_dwVehicleSubClass == VEHICLE_BMX ) + RpClumpForAllAtomics(pClump, ShadowCameraRenderCB_Vehicle, reinterpret_cast(bRenderAtLower)); + + // High or Very High OR open top? + if ( CShadows::GetShadowQuality() > SHADOW_QUALITY_MEDIUM || bOpenTop ) { + bool bRenderWeapons = (bOpenTop && CShadows::GetShadowQuality() > SHADOW_QUALITY_MEDIUM) || CShadows::GetShadowQuality() > SHADOW_QUALITY_HIGH; + // Render driver if ( m_pDriver ) - m_pDriver->RenderForShadow(reinterpret_cast(m_pDriver->m_pRwObject)); + m_pDriver->RenderForShadow(reinterpret_cast(m_pDriver->m_pRwObject), bRenderWeapons); // Render passengers for ( int i = 0; i < 8; i++ ) { if ( m_apPassengers[i] ) - m_apPassengers[i]->RenderForShadow(reinterpret_cast(m_apPassengers[i]->m_pRwObject)); + m_apPassengers[i]->RenderForShadow(reinterpret_cast(m_apPassengers[i]->m_pRwObject), bRenderWeapons); } } } diff --git a/VCS PC/WidescreenSupport.cpp b/VCS PC/WidescreenSupport.cpp index 6ad34b4..7281739 100644 --- a/VCS PC/WidescreenSupport.cpp +++ b/VCS PC/WidescreenSupport.cpp @@ -14,34 +14,25 @@ float WidescreenSupport::fScreenWidthMultiplier = 640.0f; float WidescreenSupport::fScreenWidthDivider = 1.0f/640.0f; float WidescreenSupport::fScreenHeightMultiplier = 448.0f; float WidescreenSupport::f4 = 4.0f/640.0f; -float WidescreenSupport::f40 = 40.0f/640.0f; float WidescreenSupport::f45 = 45.0f/640.0f; float WidescreenSupport::f50 = 50.0f/640.0f; float WidescreenSupport::f55 = 55.0f/640.0f; float WidescreenSupport::f60 = 60.0f/640.0f; float WidescreenSupport::f70 = 70.0f/640.0f; float WidescreenSupport::f95 = 95.0f/640.0f; -float WidescreenSupport::f100 = 100.0f/640.0f; float WidescreenSupport::f160 = 160.0f/640.0f; float WidescreenSupport::f350 = 350.0f/640.0f; float WidescreenSupport::f555 = 555.0f/640.0f; float WidescreenSupport::f580 = 580.0f/640.0f; float WidescreenSupport::f0pt3 = 0.3f/640.0f; -float WidescreenSupport::f1pt3 = 1.3f/640.0f; float WidescreenSupport::f0pt49 = 0.49f/640.0f; -float WidescreenSupport::f0pt42 = 0.42f/640.0f; -float WidescreenSupport::f0pt35 = 0.35f/640.0f; -float WidescreenSupport::f0pt7 = 0.7f/640.0f; float WidescreenSupport::f0pt8 = 0.8f/640.0f; float WidescreenSupport::f0pt56 = 0.56f/640.0f; -float WidescreenSupport::fMenuSliderPosX = 0.5f + (MENU_TEXT_POSITION_RCOLUMN/640.0f); -float WidescreenSupport::fMenuSliderWidth = MENU_SLIDER_WIDTH/640.0f; float WidescreenSupport::fMenuMessageWidth = 640.0f - 210.0f; float WidescreenSupport::fCTSliderRight = 0.5f + (50.0f/640.0f); float WidescreenSupport::fCTSliderLeft = 0.5f - (50.0/640.0f); float WidescreenSupport::fScreenCoorsFix = 44800.0f/640.0f; //float WidescreenSupport::fSpawningFix = 44800.0f/640.0f; -float WidescreenSupport::fAimpointFix = 0.5f; float WidescreenSupport::fMapZonePosX2 = 7.5f/640.0f; //float WidescreenSupport::fSkyMultFix = 1.4f; @@ -52,10 +43,6 @@ float WidescreenSupport::f2pt1_h = 2.1f/448.0f; float WidescreenSupport::f1_h = 1.0f/448.0f; float WidescreenSupport::f28_h = 28.0f/448.0f; float WidescreenSupport::f97_centh = 0.5f - 127.0f/448.0f; -float WidescreenSupport::fMenuSliderPosY2 = MENU_SLIDER_POSY / 448.0f; -float WidescreenSupport::fMenuSliderPosY3 = (MENU_SLIDER_POSY - 30.0f) / 448.0f; -float WidescreenSupport::fMenuSliderPosY4 = (MENU_SLIDER_POSY - MENU_SLIDER_WIDTH / 2.0f) / 448.0f; -float WidescreenSupport::fMenuSliderHeight2 = MENU_SLIDER_HEIGHT / 448.0f; float WidescreenSupport::fProperWidthMultiplier = 1.0f; float WidescreenSupport::fProperHeightMultiplier = 480.0f/448.0f; @@ -112,28 +99,20 @@ void WidescreenSupport::Recalculate(int nWidth, int nHeight, bool bAlways) fScreenWidthMultiplier = fNewResolutionWidthMultiplier; fScreenHeightMultiplier = fNewResolutionHeightMultiplier; f4 = 4.0f/fNewResolutionWidthMultiplier; - f40 = 40.0f/fNewResolutionWidthMultiplier; f45 = 45.0f/fNewResolutionWidthMultiplier; f50 = 50.0f/fNewResolutionWidthMultiplier; f55 = 55.0f/fNewResolutionWidthMultiplier; f60 = 60.0f/fNewResolutionWidthMultiplier; f70 = 70.0f/fNewResolutionWidthMultiplier; f95 = 95.0f/fNewResolutionWidthMultiplier; - f100 = 100.0f/fNewResolutionWidthMultiplier; f160 = 160.0f/fNewResolutionWidthMultiplier; f350 = 350.0f/fNewResolutionWidthMultiplier; f555 = 555.0f/fNewResolutionWidthMultiplier; f580 = 580.0f/fNewResolutionWidthMultiplier; f0pt3 = 0.3f/fNewResolutionWidthMultiplier; - f1pt3 = 1.3f/fNewResolutionWidthMultiplier; f0pt49 = 0.49f/fNewResolutionWidthMultiplier; - f0pt42 = 0.42f/fNewResolutionWidthMultiplier; - f0pt35 = 0.35f/fNewResolutionWidthMultiplier; - f0pt7 = 0.7f/fNewResolutionWidthMultiplier; f0pt8 = 0.8f/fNewResolutionWidthMultiplier; f0pt56 = 0.56f/fNewResolutionWidthMultiplier; - fMenuSliderPosX = 0.5f + (MENU_TEXT_POSITION_RCOLUMN/fNewResolutionWidthMultiplier); - fMenuSliderWidth = MENU_SLIDER_WIDTH/fNewResolutionWidthMultiplier; fMenuMessageWidth = fNewResolutionWidthMultiplier - 210.0f; fCTSliderRight = 0.5f + (50.0f/fNewResolutionWidthMultiplier); fCTSliderLeft = 0.5f - (50.0f/fNewResolutionWidthMultiplier); @@ -141,8 +120,6 @@ void WidescreenSupport::Recalculate(int nWidth, int nHeight, bool bAlways) //fAimpointFix = (9.0f/12800.0f)*fNewResolutionWidthMultiplier + 0.1f; fMapZonePosX2 = 7.5f/fNewResolutionWidthMultiplier; - fAimpointFix = 0.5f * static_cast(atan(RAD_TO_DEG * SetAspectRatio())) /** ((4.0f/3.0f)/1.1f)*/; - f0pt7_h = 0.7f/fNewResolutionHeightMultiplier; f0pt95_h = 0.95f/fNewResolutionHeightMultiplier; f1pt2_h = 1.2f/fNewResolutionHeightMultiplier; @@ -150,10 +127,6 @@ void WidescreenSupport::Recalculate(int nWidth, int nHeight, bool bAlways) f1_h = 1.0f/fNewResolutionHeightMultiplier; f28_h = 28.0f/fNewResolutionHeightMultiplier; f97_centh = 0.5f - 127.0f/fNewResolutionHeightMultiplier; - fMenuSliderPosY2 = 0.5f + (MENU_SLIDER_POSY - 224.0f) / fNewResolutionHeightMultiplier; - fMenuSliderPosY3 = 0.5f + (MENU_SLIDER_POSY - 254.0f) / fNewResolutionHeightMultiplier; - fMenuSliderPosY4 = 0.5f + (MENU_SLIDER_POSY - 224.0f - MENU_SLIDER_WIDTH / 2.0f) / fNewResolutionHeightMultiplier; - fMenuSliderHeight2 = MENU_SLIDER_HEIGHT / fNewResolutionHeightMultiplier; fProperWidthMultiplier = static_cast(nWidth)/fNewResolutionWidthMultiplier; fProperHeightMultiplier = static_cast(nHeight)/fNewResolutionHeightMultiplier; diff --git a/VCS PC/WidescreenSupport.h b/VCS PC/WidescreenSupport.h index 3bdf1d2..61a9232 100644 --- a/VCS PC/WidescreenSupport.h +++ b/VCS PC/WidescreenSupport.h @@ -15,34 +15,25 @@ class WidescreenSupport static float fScreenWidthDivider; static float fScreenHeightMultiplier; static float f4; - static float f40; static float f45; static float f50; static float f55; static float f60; static float f70; static float f95; - static float f100; static float f160; static float f350; static float f555; static float f580; static float f0pt3; - static float f1pt3; static float f0pt49; - static float f0pt42; - static float f0pt35; - static float f0pt7; static float f0pt8; static float f0pt56; - static float fMenuSliderPosX; - static float fMenuSliderWidth; static float fMenuMessageWidth; static float fCTSliderRight; static float fCTSliderLeft; static float fScreenCoorsFix; // static float fSpawningFix; - static float fAimpointFix; static float fMapZonePosX2; // static float fSkyMultFix; @@ -53,10 +44,6 @@ class WidescreenSupport static float f1_h; static float f28_h; static float f97_centh; - static float fMenuSliderPosY2; - static float fMenuSliderPosY3; - static float fMenuSliderPosY4; - static float fMenuSliderHeight2; static float fProperWidthMultiplier; static float fProperHeightMultiplier; @@ -81,7 +68,7 @@ class WidescreenSupport static inline float GetScreenHeightMultiplier() { return fScreenHeightMultiplier; } - static CVector2D GetFullscreenImageDimensions(float fImageAspectRatio, float fScreenAspectRatio, bool bFitToScreen); + static CVector2D GetFullscreenImageDimensions(float fImageAspectRatio, float fScreenAspectRatio, bool bFitToScreen); }; #endif \ No newline at end of file