mirror of
https://git.rip/DMCA_FUCKER/re3.git
synced 2024-12-23 03:40:01 +00:00
Fix some UBs
This commit is contained in:
parent
7056f9954f
commit
810bad9fd8
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue