summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerorcun <erorcunerorcun@hotmail.com.tr>2021-01-28 23:44:33 +0100
committererorcun <erorcunerorcun@hotmail.com.tr>2021-01-28 23:44:33 +0100
commit810bad9fd8cf344f7d73b82f042910a4c443b0f7 (patch)
tree642eb40736bd71d12edbe5cdc7afa1a70ffe7c36
parentfix (diff)
downloadre3-810bad9fd8cf344f7d73b82f042910a4c443b0f7.tar
re3-810bad9fd8cf344f7d73b82f042910a4c443b0f7.tar.gz
re3-810bad9fd8cf344f7d73b82f042910a4c443b0f7.tar.bz2
re3-810bad9fd8cf344f7d73b82f042910a4c443b0f7.tar.lz
re3-810bad9fd8cf344f7d73b82f042910a4c443b0f7.tar.xz
re3-810bad9fd8cf344f7d73b82f042910a4c443b0f7.tar.zst
re3-810bad9fd8cf344f7d73b82f042910a4c443b0f7.zip
-rw-r--r--src/audio/MusicManager.cpp5
-rw-r--r--src/audio/MusicManager.h2
-rw-r--r--src/control/PathFind.cpp2
-rw-r--r--src/control/PathFind.h8
-rw-r--r--src/core/Frontend.cpp25
-rw-r--r--src/core/main.cpp5
-rw-r--r--src/peds/Ped.h2
-rw-r--r--src/skel/crossplatform.cpp8
8 files changed, 36 insertions, 21 deletions
diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp
index acfe09c3..374de081 100644
--- a/src/audio/MusicManager.cpp
+++ b/src/audio/MusicManager.cpp
@@ -1223,8 +1223,11 @@ cMusicManager::DisplayRadioStationName()
gNumRetunePresses++;
}
else
+#ifdef FIX_BUGS
+ track = m_nFrontendTrack == NO_TRACK ? POLICE_RADIO : m_nFrontendTrack;
+#else
track = m_nFrontendTrack;
-
+#endif
wchar* string = nil;
switch (track) {
diff --git a/src/audio/MusicManager.h b/src/audio/MusicManager.h
index f103e84e..5691b7b8 100644
--- a/src/audio/MusicManager.h
+++ b/src/audio/MusicManager.h
@@ -29,7 +29,7 @@ public:
uint32 m_nResetTime;
bool m_bRadioSetByScript;
uint8 m_nRadioStation;
- uint32 m_nRadioPosition;
+ int32 m_nRadioPosition;
uint32 m_nRadioInCar;
uint32 m_nFrontendTrack;
uint32 m_nPlayingTrack;
diff --git a/src/control/PathFind.cpp b/src/control/PathFind.cpp
index 2d3972f6..bf72199d 100644
--- a/src/control/PathFind.cpp
+++ b/src/control/PathFind.cpp
@@ -859,7 +859,7 @@ CPathFind::PreparePathDataForType(uint8 type, CTempNode *tempnodes, CPathInfoFor
mag = Sqrt(dx*dx + dy*dy);
dx /= mag;
dy /= mag;
- int width = Max(m_pathNodes[i].width, m_pathNodes[j].width);
+ uint8 width = Max(m_pathNodes[i].width, m_pathNodes[j].width);
if(i < j){
dx = -dx;
dy = -dy;
diff --git a/src/control/PathFind.h b/src/control/PathFind.h
index acf9929a..99759590 100644
--- a/src/control/PathFind.h
+++ b/src/control/PathFind.h
@@ -120,7 +120,7 @@ struct CCarPathLink
uint8 trafficLightDirection : 1;
uint8 trafficLightType : 2;
uint8 bBridgeLights : 1; // at least in LCS...
- int8 width;
+ uint8 width;
CVector2D GetPosition(void) { return CVector2D(x/8.0f, y/8.0f); }
CVector2D GetDirection(void) { return CVector2D(dirX/100.0f, dirY/100.0f); }
@@ -151,7 +151,7 @@ struct CPathInfoForObject
int8 numLeftLanes;
int8 numRightLanes;
int8 speedLimit;
- int8 width;
+ uint8 width;
uint8 crossing : 1;
uint8 onlySmallBoats : 1;
@@ -177,7 +177,7 @@ struct CTempNode
int16 link2;
int8 numLeftLanes;
int8 numRightLanes;
- int8 width;
+ uint8 width;
bool isCross;
int8 linkState;
};
@@ -188,7 +188,7 @@ struct CTempNodeExternal // made up name
int16 next;
int8 numLeftLanes;
int8 numRightLanes;
- int8 width;
+ uint8 width;
bool isCross;
};
diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp
index 5fe3d6be..f38efb66 100644
--- a/src/core/Frontend.cpp
+++ b/src/core/Frontend.cpp
@@ -5567,33 +5567,40 @@ void
CMenuManager::DrawQuitGameScreen(void)
{
static int32 exitSignalTimer = 0;
+
+#ifdef FIX_BUGS
+ int alpha = clamp(m_nMenuFadeAlpha, 0, 255);
+#else
+ int alpha = m_nMenuFadeAlpha;
+#endif
+
#ifndef MUCH_SHORTER_OUTRO_SCREEN
static PauseModeTime lastTickIncrease = 0;
- if (m_nMenuFadeAlpha == 255 && CTimer::GetTimeInMillisecondsPauseMode() - lastTickIncrease > 10) {
+ if (alpha == 255 && CTimer::GetTimeInMillisecondsPauseMode() - lastTickIncrease > 10) {
exitSignalTimer++;
lastTickIncrease = CTimer::GetTimeInMillisecondsPauseMode();
}
#else
- static PauseModeTime sincePress = 0;
- sincePress += frameTime;
- if (sincePress > 500)
+ static PauseModeTime firstTick = CTimer::GetTimeInMillisecondsPauseMode();
+ if (alpha == 255 && CTimer::GetTimeInMillisecondsPauseMode() - firstTick > 1000) {
exitSignalTimer = 150;
+ }
#endif
static CSprite2d *splash = nil;
if (splash == nil)
splash = LoadSplash("OUTRO");
- m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(MENU_X(28.0f), MENU_Y(8.0f), MENU_X(157.0f), MENU_Y(138.0f)), CRGBA(255, 255, 255, -(m_nMenuFadeAlpha + 1)));
+ m_aFrontEndSprites[MENUSPRITE_VCLOGO].Draw(CRect(MENU_X(28.0f), MENU_Y(8.0f), MENU_X(157.0f), MENU_Y(138.0f)), CRGBA(255, 255, 255, 255 - alpha));
// Or we can see menu background from sides
#ifdef ASPECT_RATIO_SCALE
- CSprite2d::DrawRect(CRect(0, 0, MENU_X_LEFT_ALIGNED(0.f), SCREEN_HEIGHT), CRGBA(0, 0, 0, m_nMenuFadeAlpha));
- CSprite2d::DrawRect(CRect(MENU_X_RIGHT_ALIGNED(0.f), 0, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(0, 0, 0, m_nMenuFadeAlpha));
+ CSprite2d::DrawRect(CRect(0, 0, MENU_X_LEFT_ALIGNED(0.f), SCREEN_HEIGHT), CRGBA(0, 0, 0, alpha));
+ CSprite2d::DrawRect(CRect(MENU_X_RIGHT_ALIGNED(0.f), 0, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(0, 0, 0, alpha));
#endif
- splash->Draw(CRect(MENU_X_LEFT_ALIGNED(0.f), 0, MENU_X_RIGHT_ALIGNED(0.f), SCREEN_HEIGHT), CRGBA(255, 255, 255, m_nMenuFadeAlpha));
- if (m_nMenuFadeAlpha == 255 && exitSignalTimer == 150)
+ splash->Draw(CRect(MENU_X_LEFT_ALIGNED(0.f), 0, MENU_X_RIGHT_ALIGNED(0.f), SCREEN_HEIGHT), CRGBA(255, 255, 255, alpha));
+ if (alpha == 255 && exitSignalTimer == 150)
RsEventHandler(rsQUITAPP, nil);
m_bShowMouse = false;
diff --git a/src/core/main.cpp b/src/core/main.cpp
index 9a0308dd..a08a9535 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -1065,8 +1065,13 @@ DisplayGameDebugText()
#endif
FrameSamples++;
+#ifdef FIX_HIGH_FPS_BUGS_ON_FRONTEND
+ FramesPerSecondCounter += frameTime / 1000.f; // convert to seconds
+ FramesPerSecond = FrameSamples / FramesPerSecondCounter;
+#else
FramesPerSecondCounter += 1000.0f / (CTimer::GetTimeStepNonClippedInSeconds() * 1000.0f);
FramesPerSecond = FramesPerSecondCounter / FrameSamples;
+#endif
if ( FrameSamples > 30 )
{
diff --git a/src/peds/Ped.h b/src/peds/Ped.h
index 8b091d15..8b48b1e0 100644
--- a/src/peds/Ped.h
+++ b/src/peds/Ped.h
@@ -639,7 +639,7 @@ public:
uint32 m_threatFlags;
uint32 m_threatCheckTimer;
uint32 m_threatCheckInterval;
- uint32 m_delayedSoundID;
+ int32 m_delayedSoundID;
uint32 m_delayedSoundTimer;
uint32 m_lastSoundStart;
uint32 m_soundStart;
diff --git a/src/skel/crossplatform.cpp b/src/skel/crossplatform.cpp
index 37c94cb4..68df6704 100644
--- a/src/skel/crossplatform.cpp
+++ b/src/skel/crossplatform.cpp
@@ -32,8 +32,8 @@ HANDLE FindFirstFile(const char* pathname, WIN32_FIND_DATA* firstfile) {
char *folder = strtok(pathCopy, "*");
char *extension = strtok(NULL, "*");
- // because strtok doesn't return NULL for last delimiter
- if (extension - folder == strlen(pathname))
+ // because I remember like strtok might not return NULL for last delimiter
+ if (extension && extension - folder == strlen(pathname))
extension = nil;
// Case-sensitivity and backslashes...
@@ -187,7 +187,7 @@ char* casepath(char const* path, bool checkPathFirst)
rl = 1;
}
- bool cantProceed = false; // just convert slashes in what's left in string, not case sensitivity
+ bool cantProceed = false; // just convert slashes in what's left in string, don't correct case of letters(because we can't)
bool mayBeTrailingSlash = false;
char* c;
while (c = strsep(&p, "/\\"))
@@ -251,7 +251,7 @@ char* casepath(char const* path, bool checkPathFirst)
}
if (rl > l + 2) {
- printf("\n\ncasepath: Corrected path length is longer then original+2:\n\tOriginal: %s (%d chars)\n\tCorrected: %s (%d chars)\n\n", path, l, out, rl);
+ printf("\n\ncasepath: Corrected path length is longer then original+2:\n\tOriginal: %s (%zu chars)\n\tCorrected: %s (%zu chars)\n\n", path, l, out, rl);
}
return out;
}