mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-26 11:04:15 +01:00
Some regular fixes and UB fixes
This commit is contained in:
parent
3dfffdf351
commit
d52b917c54
@ -2034,7 +2034,11 @@ float CGarages::FindDoorHeightForMI(int32 mi)
|
|||||||
void CGarage::TidyUpGarage()
|
void CGarage::TidyUpGarage()
|
||||||
{
|
{
|
||||||
uint32 i = CPools::GetVehiclePool()->GetSize();
|
uint32 i = CPools::GetVehiclePool()->GetSize();
|
||||||
|
#ifdef FIX_BUGS
|
||||||
while (i--) {
|
while (i--) {
|
||||||
|
#else
|
||||||
|
while (--i) {
|
||||||
|
#endif
|
||||||
CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i);
|
CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i);
|
||||||
if (!pVehicle || !pVehicle->IsCar())
|
if (!pVehicle || !pVehicle->IsCar())
|
||||||
continue;
|
continue;
|
||||||
@ -2052,7 +2056,11 @@ void CGarage::TidyUpGarage()
|
|||||||
void CGarage::TidyUpGarageClose()
|
void CGarage::TidyUpGarageClose()
|
||||||
{
|
{
|
||||||
uint32 i = CPools::GetVehiclePool()->GetSize();
|
uint32 i = CPools::GetVehiclePool()->GetSize();
|
||||||
|
#ifdef FIX_BUGS
|
||||||
while (i--) {
|
while (i--) {
|
||||||
|
#else
|
||||||
|
while (--i) {
|
||||||
|
#endif
|
||||||
CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i);
|
CVehicle* pVehicle = CPools::GetVehiclePool()->GetSlot(i);
|
||||||
if (!pVehicle || !pVehicle->IsCar())
|
if (!pVehicle || !pVehicle->IsCar())
|
||||||
continue;
|
continue;
|
||||||
|
@ -908,7 +908,7 @@ int32 CRadar::GetNewUniqueBlipIndex(int32 i)
|
|||||||
|
|
||||||
uint32 CRadar::GetRadarTraceColour(uint32 color, bool bright)
|
uint32 CRadar::GetRadarTraceColour(uint32 color, bool bright)
|
||||||
{
|
{
|
||||||
int32 c;
|
uint32 c;
|
||||||
switch (color) {
|
switch (color) {
|
||||||
case RADAR_TRACE_RED:
|
case RADAR_TRACE_RED:
|
||||||
if (bright)
|
if (bright)
|
||||||
|
@ -1110,8 +1110,13 @@ DisplayGameDebugText()
|
|||||||
#endif // #ifdef DRAW_GAME_VERSION_TEXT
|
#endif // #ifdef DRAW_GAME_VERSION_TEXT
|
||||||
|
|
||||||
FrameSamples++;
|
FrameSamples++;
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
FramesPerSecondCounter += frameTime / 1000.f; // convert to seconds
|
||||||
|
FramesPerSecond = FrameSamples / FramesPerSecondCounter;
|
||||||
|
#else
|
||||||
FramesPerSecondCounter += 1000.0f / (CTimer::GetTimeStepNonClippedInSeconds() * 1000.0f);
|
FramesPerSecondCounter += 1000.0f / (CTimer::GetTimeStepNonClippedInSeconds() * 1000.0f);
|
||||||
FramesPerSecond = FramesPerSecondCounter / FrameSamples;
|
FramesPerSecond = FramesPerSecondCounter / FrameSamples;
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( FrameSamples > 30 )
|
if ( FrameSamples > 30 )
|
||||||
{
|
{
|
||||||
|
@ -1545,7 +1545,7 @@ CPed::ProcessBuoyancy(void)
|
|||||||
CRGBA color(((0.5f * CTimeCycle::GetDirectionalRed() + CTimeCycle::GetAmbientRed()) * 127.5f),
|
CRGBA color(((0.5f * CTimeCycle::GetDirectionalRed() + CTimeCycle::GetAmbientRed()) * 127.5f),
|
||||||
((0.5f * CTimeCycle::GetDirectionalBlue() + CTimeCycle::GetAmbientBlue()) * 127.5f),
|
((0.5f * CTimeCycle::GetDirectionalBlue() + CTimeCycle::GetAmbientBlue()) * 127.5f),
|
||||||
((0.5f * CTimeCycle::GetDirectionalGreen() + CTimeCycle::GetAmbientGreen()) * 127.5f),
|
((0.5f * CTimeCycle::GetDirectionalGreen() + CTimeCycle::GetAmbientGreen()) * 127.5f),
|
||||||
(CGeneral::GetRandomNumber() % 256 * 48.0f) + 48);
|
CGeneral::GetRandomNumberInRange(48.0f, 96.0f));
|
||||||
|
|
||||||
if (bInVehicle)
|
if (bInVehicle)
|
||||||
return;
|
return;
|
||||||
|
@ -32,8 +32,8 @@ HANDLE FindFirstFile(const char* pathname, WIN32_FIND_DATA* firstfile) {
|
|||||||
char *folder = strtok(pathCopy, "*");
|
char *folder = strtok(pathCopy, "*");
|
||||||
char *extension = strtok(NULL, "*");
|
char *extension = strtok(NULL, "*");
|
||||||
|
|
||||||
// because strtok doesn't return NULL for last delimiter
|
// because I remember like strtok might not return NULL for last delimiter
|
||||||
if (extension - folder == strlen(pathname))
|
if (extension && extension - folder == strlen(pathname))
|
||||||
extension = nil;
|
extension = nil;
|
||||||
|
|
||||||
// Case-sensitivity and backslashes...
|
// Case-sensitivity and backslashes...
|
||||||
@ -187,7 +187,7 @@ char* casepath(char const* path, bool checkPathFirst)
|
|||||||
rl = 1;
|
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;
|
bool mayBeTrailingSlash = false;
|
||||||
char* c;
|
char* c;
|
||||||
while (c = strsep(&p, "/\\"))
|
while (c = strsep(&p, "/\\"))
|
||||||
@ -251,7 +251,7 @@ char* casepath(char const* path, bool checkPathFirst)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (rl > l + 2) {
|
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;
|
return out;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user