summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-04-16 09:23:31 +0200
committeraap <aap@papnet.eu>2020-04-16 09:23:31 +0200
commit89b7085353f9ade38c2f2d4cac4aa9caf9db6a9d (patch)
treecbecbce7d638d7175ea4ee5c8b402c00564c017e
parentMerge branch 'master' of github.com:gtamodding/re3 (diff)
parentMerge pull request #453 from Fire-Head/master (diff)
downloadre3-89b7085353f9ade38c2f2d4cac4aa9caf9db6a9d.tar
re3-89b7085353f9ade38c2f2d4cac4aa9caf9db6a9d.tar.gz
re3-89b7085353f9ade38c2f2d4cac4aa9caf9db6a9d.tar.bz2
re3-89b7085353f9ade38c2f2d4cac4aa9caf9db6a9d.tar.lz
re3-89b7085353f9ade38c2f2d4cac4aa9caf9db6a9d.tar.xz
re3-89b7085353f9ade38c2f2d4cac4aa9caf9db6a9d.tar.zst
re3-89b7085353f9ade38c2f2d4cac4aa9caf9db6a9d.zip
-rw-r--r--README.md2
-rw-r--r--src/audio/AudioManager.cpp3
-rw-r--r--src/audio/sampman.cpp98
-rw-r--r--src/audio/sampman.h4
-rw-r--r--src/control/Script.cpp6
-rw-r--r--src/core/Camera.cpp8
-rw-r--r--src/core/Camera.h4
-rw-r--r--src/core/Frontend.cpp1
-rw-r--r--src/core/config.h1
-rw-r--r--src/core/main.cpp5
-rw-r--r--src/peds/Population.cpp12
-rw-r--r--src/render/Hud.cpp6
-rw-r--r--src/save/GenericGameStorage.cpp19
-rw-r--r--src/skel/win/win.cpp29
-rw-r--r--src/weapons/Explosion.cpp2
-rw-r--r--src/weapons/Explosion.h2
-rw-r--r--src/weapons/ProjectileInfo.cpp4
-rw-r--r--src/weapons/ProjectileInfo.h8
-rw-r--r--src/weapons/Weapon.cpp2
-rw-r--r--src/weapons/WeaponEffects.cpp (renamed from src/render/WeaponEffects.cpp)0
-rw-r--r--src/weapons/WeaponEffects.h (renamed from src/render/WeaponEffects.h)0
21 files changed, 117 insertions, 99 deletions
diff --git a/README.md b/README.md
index 53f2136a..17b00862 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,6 @@ to reverse at the time, calling the original functions is acceptable.
### Unreversed / incomplete classes (at least the ones we know)
```
CBulletInfo
-CWeapon
CWorld
```
@@ -41,7 +40,6 @@ The following classes have only unused or practically unused code left:
```
CCullZone - only mobile stuff
CCullZones - only mobile stuff
-CSceneEdit
```
### Coding style
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index f99891ec..8a9a81f9 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -9132,6 +9132,9 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams *params)
CVehicle *veh = params->m_pVehicle;
if(veh->m_bSirenOrAlarm == 0 && veh->m_nAlarmState <= 0) return;
+#ifdef FIX_BUGS
+ if (params->m_pVehicle->m_status == STATUS_WRECKED) return;
+#endif
CalculateDistance(params->m_bDistanceCalculated, params->m_fDistance);
m_sQueueSample.m_bVolume = ComputeVolume(80, 110.f, m_sQueueSample.m_fDistance);
if(m_sQueueSample.m_bVolume) {
diff --git a/src/audio/sampman.cpp b/src/audio/sampman.cpp
index 6edb6028..6dd744c3 100644
--- a/src/audio/sampman.cpp
+++ b/src/audio/sampman.cpp
@@ -17,9 +17,8 @@
#pragma comment( lib, "mss32.lib" )
-cSampleManager &SampleManager = *(cSampleManager *)0x7341E0;
-extern int32 (&BankStartOffset)[MAX_SAMPLEBANKS] = *(int32 (*)[MAX_SAMPLEBANKS])*(int *)0x6FAB70;
-
+cSampleManager SampleManager;
+int32 BankStartOffset[MAX_SAMPLEBANKS];
///////////////////////////////////////////////////////////////
char SampleBankDescFilename[] = "AUDIO\\SFX.SDT";
@@ -116,7 +115,7 @@ typedef struct provider_stuff
static int __cdecl comp(const provider_stuff*s1,const provider_stuff*s2)
{
- return(strcasecmp(s1->name, s2->name));
+ return( _stricmp(s1->name,s2->name) );
}
static void
@@ -435,21 +434,17 @@ _FindMP3s(void)
OutputDebugString("Resolving Link");
OutputDebugString(filepath);
- if ( f )
- fprintf(f, " - shortcut to \"%s\"", filepath);
+ if ( f ) fprintf(f, " - shortcut to \"%s\"", filepath);
}
else
{
- if ( f )
- fprintf(f, " - couldn't resolve shortcut");
+ if ( f ) fprintf(f, " - couldn't resolve shortcut");
}
bShortcut = true;
}
else
- {
bShortcut = false;
- }
}
mp3Stream[0] = AIL_open_stream(DIG, filepath, 0);
@@ -494,8 +489,7 @@ _FindMP3s(void)
_pMP3List->pLinkPath = NULL;
}
- if ( f )
- fprintf(f, " - OK\n");
+ if ( f ) fprintf(f, " - OK\n");
bInitFirstEntry = false;
}
@@ -505,8 +499,7 @@ _FindMP3s(void)
OutputDebugString(filepath);
- if ( f )
- fprintf(f, " - not an MP3 or supported MP3 type\n");
+ if ( f ) fprintf(f, " - not an MP3 or supported MP3 type\n");
bInitFirstEntry = true;
}
@@ -514,17 +507,7 @@ _FindMP3s(void)
while ( true )
{
if ( !FindNextFile(hFind, &fd) )
- {
- if ( f )
- {
- fprintf(f, "\nTOTAL SUPPORTED MP3s: %d\n", nNumMP3s);
- fclose(f);
- }
-
- FindClose(hFind);
-
- return;
- }
+ break;
if ( bInitFirstEntry )
{
@@ -533,8 +516,7 @@ _FindMP3s(void)
int32 filepathlen = strlen(filepath);
- if ( f )
- fprintf(f, "\"%s\"", fd.cFileName);
+ if ( f ) fprintf(f, "\"%s\"", fd.cFileName);
if ( filepathlen > 0 )
{
@@ -547,13 +529,11 @@ _FindMP3s(void)
OutputDebugString("Resolving Link");
OutputDebugString(filepath);
- if ( f )
- fprintf(f, " - shortcut to \"%s\"", filepath);
+ if ( f ) fprintf(f, " - shortcut to \"%s\"", filepath);
}
else
{
- if ( f )
- fprintf(f, " - couldn't resolve shortcut");
+ if ( f ) fprintf(f, " - couldn't resolve shortcut");
}
bShortcut = true;
@@ -564,8 +544,7 @@ _FindMP3s(void)
if ( filepathlen > MAX_PATH )
{
- if ( f )
- fprintf(f, " - Filename and path too long - %s - IGNORED)\n", filepath);
+ if ( f ) fprintf(f, " - Filename and path too long - %s - IGNORED)\n", filepath);
continue;
}
@@ -585,15 +564,7 @@ _FindMP3s(void)
_pMP3List = new tMP3Entry;
if ( _pMP3List == NULL)
- {
- if ( f )
- {
- fprintf(f, "\nTOTAL SUPPORTED MP3s: %d\n", nNumMP3s);
- fclose(f);
- }
- FindClose(hFind);
- return;
- }
+ break;
nNumMP3s = 1;
@@ -614,8 +585,7 @@ _FindMP3s(void)
pList = _pMP3List;
- if ( f )
- fprintf(f, " - OK\n");
+ if ( f ) fprintf(f, " - OK\n");
bInitFirstEntry = false;
}
@@ -624,8 +594,7 @@ _FindMP3s(void)
strcat(filepath, " - NOT A VALID MP3");
OutputDebugString(filepath);
- if ( f )
- fprintf(f, " - not an MP3 or supported MP3 type\n");
+ if ( f ) fprintf(f, " - not an MP3 or supported MP3 type\n");
}
}
}
@@ -638,8 +607,7 @@ _FindMP3s(void)
if ( filepathlen > 0 )
{
- if ( f )
- fprintf(f, "\"%s\"", fd.cFileName);
+ if ( f ) fprintf(f, "\"%s\"", fd.cFileName);
if ( filepathlen > 4 )
{
@@ -650,13 +618,11 @@ _FindMP3s(void)
OutputDebugString("Resolving Link");
OutputDebugString(filepath);
- if ( f )
- fprintf(f, " - shortcut to \"%s\"", filepath);
+ if ( f ) fprintf(f, " - shortcut to \"%s\"", filepath);
}
else
{
- if ( f )
- fprintf(f, " - couldn't resolve shortcut");
+ if ( f ) fprintf(f, " - couldn't resolve shortcut");
}
bShortcut = true;
@@ -679,16 +645,8 @@ _FindMP3s(void)
tMP3Entry *e = pList->pNext;
- if ( e == NULL)
- {
- if ( f )
- {
- fprintf(f, "\nTOTAL SUPPORTED MP3s: %d\n", nNumMP3s);
- fclose(f);
- }
- FindClose(hFind);
- return;
- }
+ if ( e == NULL )
+ break;
pList = pList->pNext;
@@ -710,20 +668,26 @@ _FindMP3s(void)
OutputDebugString(fd.cFileName);
- if ( f )
- fprintf(f, " - OK\n");
+ if ( f ) fprintf(f, " - OK\n");
}
else
{
strcat(filepath, " - NOT A VALID MP3");
OutputDebugString(filepath);
- if ( f )
- fprintf(f, " - not an MP3 or supported MP3 type\n");
+ if ( f ) fprintf(f, " - not an MP3 or supported MP3 type\n");
}
}
}
}
+
+ if ( f )
+ {
+ fprintf(f, "\nTOTAL SUPPORTED MP3s: %d\n", nNumMP3s);
+ fclose(f);
+ }
+
+ FindClose(hFind);
}
static void
@@ -2257,7 +2221,7 @@ cSampleManager::InitialiseSampleBanks(void)
for ( int32 i = 0; i < TOTAL_AUDIO_SAMPLES; i++ )
{
- if ( BankStartOffset[nBank] == BankStartOffset[0] + i )
+ if ( BankStartOffset[nBank] == BankStartOffset[SAMPLEBANK_MAIN] + i )
{
nSampleBankDiscStartOffset[nBank] = m_aSamples[i].nOffset;
nBank++;
diff --git a/src/audio/sampman.h b/src/audio/sampman.h
index 4b546911..4f3c3eeb 100644
--- a/src/audio/sampman.h
+++ b/src/audio/sampman.h
@@ -135,8 +135,8 @@ public:
bool InitialiseSampleBanks(void);
};
-extern cSampleManager &SampleManager;
-extern int32 (&BankStartOffset)[MAX_SAMPLEBANKS];
+extern cSampleManager SampleManager;
+extern int32 BankStartOffset[MAX_SAMPLEBANKS];
static char StreamedNameTable[][25]=
{
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 83d072f3..428ac66a 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -9147,7 +9147,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
}
case COMMAND_SET_JAMES_CAR_ON_PATH_TO_PLAYER:
{
- CollectParameters(&m_nIp, 2);
+ CollectParameters(&m_nIp, 1);
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
assert(pVehicle);
CCarCtrl::JoinCarWithRoadSystemGotoCoors(pVehicle, FindPlayerCoors(), false);
@@ -10076,8 +10076,8 @@ void CRunningScript::LocatePlayerCarCommand(int32 command, uint32* pIp)
case COMMAND_LOCATE_PLAYER_ON_FOOT_CAR_3D:
result = !pPlayerInfo->m_pPed->bInVehicle;
break;
- case COMMAND_LOCATE_PLAYER_IN_CAR_CHAR_2D:
- case COMMAND_LOCATE_PLAYER_IN_CAR_CHAR_3D:
+ case COMMAND_LOCATE_PLAYER_IN_CAR_CAR_2D:
+ case COMMAND_LOCATE_PLAYER_IN_CAR_CAR_3D:
result = pPlayerInfo->m_pPed->bInVehicle;
break;
default:
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index 91dd6573..c7fa41e4 100644
--- a/src/core/Camera.cpp
+++ b/src/core/Camera.cpp
@@ -2183,13 +2183,21 @@ CCamera::DrawBordersForWideScreen(void)
SetMotionBlurAlpha(80);
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,
+#endif
SCREEN_WIDTH, 0.0f),
CRGBA(0, 0, 0, 255));
CSprite2d::DrawRect(
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),
+#endif
CRGBA(0, 0, 0, 255));
}
diff --git a/src/core/Camera.h b/src/core/Camera.h
index eca4518a..09a8d603 100644
--- a/src/core/Camera.h
+++ b/src/core/Camera.h
@@ -415,7 +415,7 @@ uint32 unknown; // some counter having to do with music
float CamFrontXNorm;
float CamFrontYNorm;
-#if 0 // TODO: FIX_BUGS once GenericLoad is done
+#ifdef FIX_BUGS
int32 CarZoomIndicator;
#else
float CarZoomIndicator;
@@ -455,7 +455,7 @@ uint32 unknown; // some counter having to do with music
float m_ScreenReductionSpeed;
float m_AlphaForPlayerAnim1rstPerson;
float Orientation;
-#if 0 // TODO: FIX_BUGS once GenericLoad is done
+#ifdef FIX_BUGS
int32 PedZoomIndicator;
#else
float PedZoomIndicator;
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index 166ecb35..a01689e4 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -5246,6 +5246,7 @@ CMenuManager::PrintController(void)
void
CMenuManager::PrintMap(void)
{
+ CFont::SetJustifyOn();
bMenuMapActive = true;
CRadar::InitFrontEndMap();
diff --git a/src/core/config.h b/src/core/config.h
index f7fde579..38e7679f 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -189,6 +189,7 @@ enum Config {
#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 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
#define XINPUT
diff --git a/src/core/main.cpp b/src/core/main.cpp
index b028b5fb..08463df9 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -240,8 +240,13 @@ DoFade(void)
float y = SCREEN_HEIGHT/2 * TheCamera.m_ScreenReductionPercentage/100.0f;
rect.left = 0.0f;
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.bottom = SCREEN_HEIGHT - y - 8.0f;
+#endif // FIX_BUGS
}else{
rect.left = 0.0f;
rect.right = SCREEN_WIDTH;
diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp
index e26e2eaf..d3a67a57 100644
--- a/src/peds/Population.cpp
+++ b/src/peds/Population.cpp
@@ -35,17 +35,17 @@ const RegenerationPoint aSafeZones[] = {
CVector(790.0f, -917.0f, 39.0f), CVector(775.0f, -921.0f, 39.0f), CVector(424.0f, -942.0f, 38.0f), CVector(439.0f, -938.0f, 38.0f) },
{ LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, 555.0f, 711.0f, 118.0f, 186.0f, -30.0f, -10.0f,
CVector(698.0f, 182.0f, -20.0f), CVector(681.0f, 178.0f, -20.0f), CVector(586.0f, 144.0f, -20.0f), CVector(577.0f, 135.0f, -20.0f) },
- { LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, 26.0f, 44.0f, 124.0f, 87.0f, 20.0f, 6.0f,
+ { LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, 626.0f, 744.0f, -124.0f, -87.0f, -20.0f, -6.0f,
CVector(736.0f, -117.0f, -13.0f), CVector(730.0f, -115.0f, -13.0f), CVector(635.0f, -93.0f, -12.5f), CVector(650.0f, -89.0f, -12.5f) },
- { LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, 45.0f, 34.0f, 780.0f, 750.0f, 25.0f, 6.0f,
+ { LEVEL_INDUSTRIAL, LEVEL_COMMERCIAL, 645.0f, 734.0f, -780.0f, -750.0f, -25.0f, -6.0f,
CVector(729.0f, -764.0f, -18.0f), CVector(720.0f, -769.0f, -17.0f), CVector(652.0f, -774.0f, -10.5f), CVector(659.0f, -770.0f, -10.5f) },
- { LEVEL_COMMERCIAL, LEVEL_SUBURBAN, 532.0f, 136.0f, 668.0f, 599.0f, 4.0f, 0.0f,
+ { LEVEL_COMMERCIAL, LEVEL_SUBURBAN, -532.0f, -136.0f, -668.0f, -599.0f, 34.0f, 60.0f,
CVector(-172.0f, -619.0f, 44.0f), CVector(-183.0f, -623.0f, 44.0f), CVector(-511.0f, -645.0f, 41.0f), CVector(-493.0f, -639.0f, 41.5f) },
- { LEVEL_COMMERCIAL, LEVEL_SUBURBAN, 325.0f, 175.0f, 7.0f, 5.0f, 30.0f, 10.0f,
+ { LEVEL_COMMERCIAL, LEVEL_SUBURBAN, -325.0f, -175.0f, 27.0f, 75.0f, -30.0f, -10.0f,
CVector(-185.0f, 40.8f, -20.5f), CVector(-202.0f, 37.0f, -20.5f), CVector(-315.0f, 65.5f, -20.5f), CVector(-306.0f, 62.4f, -20.5f) },
- { LEVEL_COMMERCIAL, LEVEL_SUBURBAN, 410.0f, 310.0f, 1055.0f, 1030.0f, 20.0f, 6.0f,
+ { LEVEL_COMMERCIAL, LEVEL_SUBURBAN, -410.0f, -310.0f, -1055.0f, -1030.0f, -20.0f, -6.0f,
CVector(-321.0f, -1043.0f, -13.2f), CVector(-328.0f, -1045.0f, -13.2f), CVector(-398.0f, -1044.0f, -13.5f), CVector(-390.0f, -1040.5f, -13.5f) },
- { LEVEL_COMMERCIAL, LEVEL_SUBURBAN, 425.0f, 280.0f, 471.0f, 447.0f, 20.0f, 5.0f,
+ { LEVEL_COMMERCIAL, LEVEL_SUBURBAN, -425.0f, -280.0f, -471.0f, -447.0f, -20.0f, -5.0f,
CVector(-292.0f, -457.0f, -11.6f), CVector(-310.0f, -461.0f, -11.6f), CVector(-413.0f, -461.0f, -11.5f), CVector(-399.0f, -457.0f, -11.3f) }
};
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index f8b86bd2..9529c4c1 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -144,12 +144,10 @@ void CHud::Draw()
float fMultBright = SpriteBrightness * 0.03f * (0.25f * fStep + 0.75f);
CRect rect;
if (DrawCrossHairPC && TheCamera.Cams[TheCamera.ActiveCam].Using3rdPersonMouseCam()) {
-#ifndef ASPECT_RATIO_SCALE
float f3rdX = SCREEN_WIDTH * TheCamera.m_f3rdPersonCHairMultX;
float f3rdY = SCREEN_HEIGHT * TheCamera.m_f3rdPersonCHairMultY;
-#else
- float f3rdX = (((TheCamera.m_f3rdPersonCHairMultX - 0.5f) / ((CDraw::GetAspectRatio()) / (DEFAULT_ASPECT_RATIO))) + 0.5f) * SCREEN_WIDTH;
- float f3rdY = SCREEN_HEIGHT * TheCamera.m_f3rdPersonCHairMultY + SCREEN_SCALE_Y(-2.0f);
+#ifdef ASPECT_RATIO_SCALE
+ f3rdY -= SCREEN_SCALE_Y(2.0f);
#endif
if (FindPlayerPed() && WeaponType == WEAPONTYPE_M16) {
rect.left = f3rdX - SCREEN_SCALE_X(32.0f * 0.6f);
diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp
index 0ec0b117..1e4acd3d 100644
--- a/src/save/GenericGameStorage.cpp
+++ b/src/save/GenericGameStorage.cpp
@@ -154,8 +154,17 @@ GenericSave(int file)
WriteDataToBufferPointer(buf, CompileDateAndTime.m_nMonth);
WriteDataToBufferPointer(buf, CompileDateAndTime.m_nYear);
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.PedZoomIndicator);
+#endif
assert(buf - work_buff == SIZE_OF_SIMPLEVARS);
// 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_nYear);
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.PedZoomIndicator);
+#endif
assert(buf - work_buff == SIZE_OF_SIMPLEVARS);
ReadDataFromBlock("Loading Scripts \n", CTheScripts::LoadAllScripts);
diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp
index ec84e968..acc9650c 100644
--- a/src/skel/win/win.cpp
+++ b/src/skel/win/win.cpp
@@ -679,11 +679,17 @@ psInitialise(void)
_dwMemAvailVirtual = memstats.dwAvailVirtual;
_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("Available physical memory %d\n", _dwMemAvailPhys);
debug("Video memory size %d\n", _dwMemTotalVideo);
debug("Available video memory %d\n", _dwMemAvailVideo);
+#endif
if ( _dwMemAvailVideo < (12 * 1024 * 1024) /*12 MB*/ )
{
@@ -1321,12 +1327,23 @@ psSelectDevice()
}
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() )
{
RwEngineGetVideoModeInfo(&vm, GcurSelVM);
- if ( defaultFullscreenRes && vm.width != 640
- || vm.height != 480
- || vm.depth != 16
+ if ( defaultFullscreenRes && vm.width != w
+ || vm.height != h
+ || vm.depth != d
|| !(vm.flags & rwVIDEOMODEEXCLUSIVE) )
++GcurSelVM;
else
@@ -1335,8 +1352,12 @@ psSelectDevice()
if ( !modeFound )
{
+#ifdef DEFAULT_NATIVE_RESOLUTION
+ GcurSelVM = 1;
+#else
MessageBox(nil, "Cannot find 640x480 video mode", "GTA3", MB_OK);
return FALSE;
+#endif
}
}
}
diff --git a/src/weapons/Explosion.cpp b/src/weapons/Explosion.cpp
index 3d00052a..02243702 100644
--- a/src/weapons/Explosion.cpp
+++ b/src/weapons/Explosion.cpp
@@ -19,7 +19,7 @@
#include "WaterLevel.h"
#include "World.h"
-CExplosion(&gaExplosion)[NUM_EXPLOSIONS] = *(CExplosion(*)[NUM_EXPLOSIONS])*(uintptr*)0x64E208;
+CExplosion gaExplosion[NUM_EXPLOSIONS];
// these two were not initialised in original code, I'm really not sure what were they meant to be
RwRGBA colMedExpl = { 0, 0, 0, 0 };
diff --git a/src/weapons/Explosion.h b/src/weapons/Explosion.h
index 45e2d5bb..bf54328c 100644
--- a/src/weapons/Explosion.h
+++ b/src/weapons/Explosion.h
@@ -46,4 +46,4 @@ public:
static void RemoveAllExplosionsInArea(CVector pos, float radius);
};
-extern CExplosion (&gaExplosion)[NUM_EXPLOSIONS]; \ No newline at end of file
+extern CExplosion gaExplosion[NUM_EXPLOSIONS]; \ No newline at end of file
diff --git a/src/weapons/ProjectileInfo.cpp b/src/weapons/ProjectileInfo.cpp
index b33d2d62..8f04278c 100644
--- a/src/weapons/ProjectileInfo.cpp
+++ b/src/weapons/ProjectileInfo.cpp
@@ -13,8 +13,8 @@
#include "Weapon.h"
#include "World.h"
-CProjectileInfo (&gaProjectileInfo)[NUM_PROJECTILES] = *(CProjectileInfo(*)[NUM_PROJECTILES])*(uintptr*)0x64ED50;
-CProjectile* (&CProjectileInfo::ms_apProjectile)[NUM_PROJECTILES] = *(CProjectile*(*)[NUM_PROJECTILES])*(uintptr*)0x87C748;
+CProjectileInfo gaProjectileInfo[NUM_PROJECTILES];
+CProjectile *CProjectileInfo::ms_apProjectile[NUM_PROJECTILES];
void
CProjectileInfo::Initialise()
diff --git a/src/weapons/ProjectileInfo.h b/src/weapons/ProjectileInfo.h
index a4ea369a..b88322f9 100644
--- a/src/weapons/ProjectileInfo.h
+++ b/src/weapons/ProjectileInfo.h
@@ -9,14 +9,14 @@ class CProjectileInfo
{
public:
eWeaponType m_eWeaponType;
- CEntity* m_pSource;
+ CEntity *m_pSource;
uint32 m_nExplosionTime;
bool m_bInUse;
CVector m_vecPos;
public:
- static CProjectileInfo* GetProjectileInfo(int32 id);
- static CProjectile* (&ms_apProjectile)[NUM_PROJECTILES];
+ static CProjectileInfo *GetProjectileInfo(int32 id);
+ static CProjectile *ms_apProjectile[NUM_PROJECTILES];
static void Initialise();
static void Shutdown();
@@ -29,4 +29,4 @@ public:
static bool IsProjectileInRange(float x1, float x2, float y1, float y2, float z1, float z2, bool remove);
};
-extern CProjectileInfo (&gaProjectileInfo)[NUM_PROJECTILES]; \ No newline at end of file
+extern CProjectileInfo gaProjectileInfo[NUM_PROJECTILES]; \ No newline at end of file
diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp
index 7b6b4170..98154e93 100644
--- a/src/weapons/Weapon.cpp
+++ b/src/weapons/Weapon.cpp
@@ -2162,7 +2162,7 @@ CWeapon::MakePedsJumpAtShot(CPhysical *shooter, CVector *source, CVector *target
&& ped->GetPosition().y > miny && ped->GetPosition().y < maxy
&& ped->GetPosition().z > minz && ped->GetPosition().z < maxz )
{
- if ( ped != FindPlayerPed() && (uint8)(ped->m_randomSeed ^ CGeneral::GetRandomNumber()) & 31 )
+ if ( ped != FindPlayerPed() && !((uint8)(ped->m_randomSeed ^ CGeneral::GetRandomNumber()) & 31) )
ped->SetEvasiveDive(shooter, 1);
}
}
diff --git a/src/render/WeaponEffects.cpp b/src/weapons/WeaponEffects.cpp
index 2ed9e662..2ed9e662 100644
--- a/src/render/WeaponEffects.cpp
+++ b/src/weapons/WeaponEffects.cpp
diff --git a/src/render/WeaponEffects.h b/src/weapons/WeaponEffects.h
index 31c5a309..31c5a309 100644
--- a/src/render/WeaponEffects.h
+++ b/src/weapons/WeaponEffects.h