Default native resolution mode and small camera fixes

This commit is contained in:
Sergeanur 2020-04-16 00:44:25 +03:00
parent 378f1d180d
commit d455cd8a62
6 changed files with 60 additions and 6 deletions

View file

@ -2183,13 +2183,21 @@ CCamera::DrawBordersForWideScreen(void)
SetMotionBlurAlpha(80); SetMotionBlurAlpha(80);
CSprite2d::DrawRect( CSprite2d::DrawRect(
#ifdef FIX_BUGS
CRect(0.0f, (SCREEN_HEIGHT/2) * m_ScreenReductionPercentage/100.0f - SCREEN_SCALE_Y(8.0f),
#else
CRect(0.0f, (SCREEN_HEIGHT/2) * m_ScreenReductionPercentage/100.0f - 8.0f, CRect(0.0f, (SCREEN_HEIGHT/2) * m_ScreenReductionPercentage/100.0f - 8.0f,
#endif
SCREEN_WIDTH, 0.0f), SCREEN_WIDTH, 0.0f),
CRGBA(0, 0, 0, 255)); CRGBA(0, 0, 0, 255));
CSprite2d::DrawRect( CSprite2d::DrawRect(
CRect(0.0f, SCREEN_HEIGHT, CRect(0.0f, SCREEN_HEIGHT,
#ifdef FIX_BUGS
SCREEN_WIDTH, SCREEN_HEIGHT - (SCREEN_HEIGHT/2) * m_ScreenReductionPercentage/100.0f - SCREEN_SCALE_Y(8.0f)),
#else
SCREEN_WIDTH, SCREEN_HEIGHT - (SCREEN_HEIGHT/2) * m_ScreenReductionPercentage/100.0f - 8.0f), SCREEN_WIDTH, SCREEN_HEIGHT - (SCREEN_HEIGHT/2) * m_ScreenReductionPercentage/100.0f - 8.0f),
#endif
CRGBA(0, 0, 0, 255)); CRGBA(0, 0, 0, 255));
} }

View file

@ -415,7 +415,7 @@ uint32 unknown; // some counter having to do with music
float CamFrontXNorm; float CamFrontXNorm;
float CamFrontYNorm; float CamFrontYNorm;
#if 0 // TODO: FIX_BUGS once GenericLoad is done #ifdef FIX_BUGS
int32 CarZoomIndicator; int32 CarZoomIndicator;
#else #else
float CarZoomIndicator; float CarZoomIndicator;
@ -455,7 +455,7 @@ uint32 unknown; // some counter having to do with music
float m_ScreenReductionSpeed; float m_ScreenReductionSpeed;
float m_AlphaForPlayerAnim1rstPerson; float m_AlphaForPlayerAnim1rstPerson;
float Orientation; float Orientation;
#if 0 // TODO: FIX_BUGS once GenericLoad is done #ifdef FIX_BUGS
int32 PedZoomIndicator; int32 PedZoomIndicator;
#else #else
float PedZoomIndicator; float PedZoomIndicator;

View file

@ -189,6 +189,7 @@ enum Config {
#define FIX_BUGS // fixes bugs that we've came across during reversing, TODO: use this more #define FIX_BUGS // fixes bugs that we've came across during reversing, TODO: use this more
#define TOGGLEABLE_BETA_FEATURES // toggleable from debug menu. not too many things #define TOGGLEABLE_BETA_FEATURES // toggleable from debug menu. not too many things
#define MORE_LANGUAGES // Add more translations to the game #define MORE_LANGUAGES // Add more translations to the game
#define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch)
// Pad // Pad
#define XINPUT #define XINPUT

View file

@ -240,8 +240,13 @@ DoFade(void)
float y = SCREEN_HEIGHT/2 * TheCamera.m_ScreenReductionPercentage/100.0f; float y = SCREEN_HEIGHT/2 * TheCamera.m_ScreenReductionPercentage/100.0f;
rect.left = 0.0f; rect.left = 0.0f;
rect.right = SCREEN_WIDTH; rect.right = SCREEN_WIDTH;
#ifdef FIX_BUGS
rect.top = y - SCREEN_SCALE_Y(8.0f);
rect.bottom = SCREEN_HEIGHT - y - SCREEN_SCALE_Y(8.0f);
#else
rect.top = y - 8.0f; rect.top = y - 8.0f;
rect.bottom = SCREEN_HEIGHT - y - 8.0f; rect.bottom = SCREEN_HEIGHT - y - 8.0f;
#endif // FIX_BUGS
}else{ }else{
rect.left = 0.0f; rect.left = 0.0f;
rect.right = SCREEN_WIDTH; rect.right = SCREEN_WIDTH;

View file

@ -154,8 +154,17 @@ GenericSave(int file)
WriteDataToBufferPointer(buf, CompileDateAndTime.m_nMonth); WriteDataToBufferPointer(buf, CompileDateAndTime.m_nMonth);
WriteDataToBufferPointer(buf, CompileDateAndTime.m_nYear); WriteDataToBufferPointer(buf, CompileDateAndTime.m_nYear);
WriteDataToBufferPointer(buf, CWeather::WeatherTypeInList); WriteDataToBufferPointer(buf, CWeather::WeatherTypeInList);
#ifdef FIX_BUGS
// converted to float for compatibility with original format
// TODO: maybe remove this? not really gonna break anything vital
float f = TheCamera.CarZoomIndicator;
WriteDataToBufferPointer(buf, f);
f = TheCamera.PedZoomIndicator;
WriteDataToBufferPointer(buf, f);
#else
WriteDataToBufferPointer(buf, TheCamera.CarZoomIndicator); WriteDataToBufferPointer(buf, TheCamera.CarZoomIndicator);
WriteDataToBufferPointer(buf, TheCamera.PedZoomIndicator); WriteDataToBufferPointer(buf, TheCamera.PedZoomIndicator);
#endif
assert(buf - work_buff == SIZE_OF_SIMPLEVARS); assert(buf - work_buff == SIZE_OF_SIMPLEVARS);
// Save scripts, block is nested within the same block as simple vars for some reason // Save scripts, block is nested within the same block as simple vars for some reason
@ -264,8 +273,18 @@ GenericLoad()
ReadDataFromBufferPointer(buf, CompileDateAndTime.m_nMonth); ReadDataFromBufferPointer(buf, CompileDateAndTime.m_nMonth);
ReadDataFromBufferPointer(buf, CompileDateAndTime.m_nYear); ReadDataFromBufferPointer(buf, CompileDateAndTime.m_nYear);
ReadDataFromBufferPointer(buf, CWeather::WeatherTypeInList); ReadDataFromBufferPointer(buf, CWeather::WeatherTypeInList);
#ifdef FIX_BUGS
// converted to float for compatibility with original format
// TODO: maybe remove this? not really gonna break anything vital
float f;
ReadDataFromBufferPointer(buf, f);
TheCamera.CarZoomIndicator = f;
ReadDataFromBufferPointer(buf, f);
TheCamera.PedZoomIndicator = f;
#else
ReadDataFromBufferPointer(buf, TheCamera.CarZoomIndicator); ReadDataFromBufferPointer(buf, TheCamera.CarZoomIndicator);
ReadDataFromBufferPointer(buf, TheCamera.PedZoomIndicator); ReadDataFromBufferPointer(buf, TheCamera.PedZoomIndicator);
#endif
assert(buf - work_buff == SIZE_OF_SIMPLEVARS); assert(buf - work_buff == SIZE_OF_SIMPLEVARS);
ReadDataFromBlock("Loading Scripts \n", CTheScripts::LoadAllScripts); ReadDataFromBlock("Loading Scripts \n", CTheScripts::LoadAllScripts);

View file

@ -679,11 +679,17 @@ psInitialise(void)
_dwMemAvailVirtual = memstats.dwAvailVirtual; _dwMemAvailVirtual = memstats.dwAvailVirtual;
_GetVideoMemInfo(&_dwMemTotalVideo, &_dwMemAvailVideo); _GetVideoMemInfo(&_dwMemTotalVideo, &_dwMemAvailVideo);
#ifdef FIX_BUGS
debug("Physical memory size %u\n", _dwMemTotalPhys);
debug("Available physical memory %u\n", _dwMemAvailPhys);
debug("Video memory size %u\n", _dwMemTotalVideo);
debug("Available video memory %u\n", _dwMemAvailVideo);
#else
debug("Physical memory size %d\n", _dwMemTotalPhys); debug("Physical memory size %d\n", _dwMemTotalPhys);
debug("Available physical memory %d\n", _dwMemAvailPhys); debug("Available physical memory %d\n", _dwMemAvailPhys);
debug("Video memory size %d\n", _dwMemTotalVideo); debug("Video memory size %d\n", _dwMemTotalVideo);
debug("Available video memory %d\n", _dwMemAvailVideo); debug("Available video memory %d\n", _dwMemAvailVideo);
#endif
if ( _dwMemAvailVideo < (12 * 1024 * 1024) /*12 MB*/ ) if ( _dwMemAvailVideo < (12 * 1024 * 1024) /*12 MB*/ )
{ {
@ -1321,12 +1327,23 @@ psSelectDevice()
} }
else else
{ {
#ifdef DEFAULT_NATIVE_RESOLUTION
// get the native video mode
HDC hDevice = GetDC(NULL);
int w = GetDeviceCaps(hDevice, HORZRES);
int h = GetDeviceCaps(hDevice, VERTRES);
int d = GetDeviceCaps(hDevice, BITSPIXEL);
#else
const int w = 640;
const int h = 480;
const int d = 16;
#endif
while ( !modeFound && GcurSelVM < RwEngineGetNumVideoModes() ) while ( !modeFound && GcurSelVM < RwEngineGetNumVideoModes() )
{ {
RwEngineGetVideoModeInfo(&vm, GcurSelVM); RwEngineGetVideoModeInfo(&vm, GcurSelVM);
if ( defaultFullscreenRes && vm.width != 640 if ( defaultFullscreenRes && vm.width != w
|| vm.height != 480 || vm.height != h
|| vm.depth != 16 || vm.depth != d
|| !(vm.flags & rwVIDEOMODEEXCLUSIVE) ) || !(vm.flags & rwVIDEOMODEEXCLUSIVE) )
++GcurSelVM; ++GcurSelVM;
else else
@ -1335,8 +1352,12 @@ psSelectDevice()
if ( !modeFound ) if ( !modeFound )
{ {
#ifdef DEFAULT_NATIVE_RESOLUTION
GcurSelVM = 1;
#else
MessageBox(nil, "Cannot find 640x480 video mode", "GTA3", MB_OK); MessageBox(nil, "Cannot find 640x480 video mode", "GTA3", MB_OK);
return FALSE; return FALSE;
#endif
} }
} }
} }