Timer, main

This commit is contained in:
erorcun 2020-10-23 04:26:52 +03:00
parent 1587815fca
commit 08d78fb6ff
3 changed files with 53 additions and 59 deletions

View File

@ -436,6 +436,7 @@ public:
bool GetLeftShockJustDown() { return !!(NewState.LeftShock && !OldState.LeftShock); } bool GetLeftShockJustDown() { return !!(NewState.LeftShock && !OldState.LeftShock); }
bool GetRightShockJustDown() { return !!(NewState.RightShock && !OldState.RightShock); } bool GetRightShockJustDown() { return !!(NewState.RightShock && !OldState.RightShock); }
bool GetStartJustDown() { return !!(NewState.Start && !OldState.Start); } bool GetStartJustDown() { return !!(NewState.Start && !OldState.Start); }
bool GetSelectJustDown() { return !!(NewState.Select && !OldState.Select); }
bool GetLeftStickXJustDown() { return !!(NewState.LeftStickX && !OldState.LeftStickX); } bool GetLeftStickXJustDown() { return !!(NewState.LeftStickX && !OldState.LeftStickX); }
bool GetLeftStickYJustDown() { return !!(NewState.LeftStickY && !OldState.LeftStickY); } bool GetLeftStickYJustDown() { return !!(NewState.LeftStickY && !OldState.LeftStickY); }
@ -461,6 +462,7 @@ public:
bool GetRightShoulder1(void) { return !!NewState.RightShoulder1; } bool GetRightShoulder1(void) { return !!NewState.RightShoulder1; }
bool GetRightShoulder2(void) { return !!NewState.RightShoulder2; } bool GetRightShoulder2(void) { return !!NewState.RightShoulder2; }
bool GetStart() { return !!NewState.Start; } bool GetStart() { return !!NewState.Start; }
bool GetSelect() { return !!NewState.Select; }
int16 GetLeftStickX(void) { return NewState.LeftStickX; } int16 GetLeftStickX(void) { return NewState.LeftStickX; }
int16 GetLeftStickY(void) { return NewState.LeftStickY; } int16 GetLeftStickY(void) { return NewState.LeftStickY; }
int16 GetRightStickX(void) { return NewState.RightStickX; } int16 GetRightStickX(void) { return NewState.RightStickX; }
@ -478,4 +480,4 @@ public:
}; };
VALIDATE_SIZE(CPad, 0xFC); VALIDATE_SIZE(CPad, 0xFC);
extern CPad Pads[MAX_PADS]; extern CPad Pads[MAX_PADS];

View File

@ -7,6 +7,8 @@
#include "Timer.h" #include "Timer.h"
#include "SpecialFX.h" #include "SpecialFX.h"
// --MIAMI: file done
uint32 CTimer::m_snTimeInMilliseconds; uint32 CTimer::m_snTimeInMilliseconds;
PauseModeTime CTimer::m_snTimeInMillisecondsPauseMode = 1; PauseModeTime CTimer::m_snTimeInMillisecondsPauseMode = 1;
@ -96,7 +98,7 @@ void CTimer::Update(void)
_oldPerfCounter = pc; _oldPerfCounter = pc;
float updInCyclesScaled = updInCycles * ms_fTimeScale; float updInCyclesScaled = GetIsPaused() ? updInCycles : updInCyclesScaled * ms_fTimeScale;
// We need that real frame time to fix transparent menu bug. // We need that real frame time to fix transparent menu bug.
#ifndef FIX_HIGH_FPS_BUGS_ON_FRONTEND #ifndef FIX_HIGH_FPS_BUGS_ON_FRONTEND

View File

@ -644,7 +644,7 @@ ProcessSlowMode(void)
do do
{ {
if ( CPad::GetPad(1)->GetLeftShoulder1JustDown() || CPad::GetPad(1)->GetRightShoulder1() ) if ( CPad::GetPad(1)->GetSelectJustDown() || CPad::GetPad(1)->GetStart() )
break; break;
if ( stop ) if ( stop )
@ -658,10 +658,7 @@ ProcessSlowMode(void)
RwCameraBeginUpdate(Scene.camera); RwCameraBeginUpdate(Scene.camera);
RwCameraEndUpdate(Scene.camera); RwCameraEndUpdate(Scene.camera);
if ( CPad::GetPad(1)->GetLeftShoulder1JustDown() || CPad::GetPad(1)->GetRightShoulder1() ) } while (!CPad::GetPad(1)->GetSelectJustDown() && !CPad::GetPad(1)->GetStart());
break;
} while (!CPad::GetPad(1)->GetRightShoulder1());
CPad::GetPad(0)->OldState.LeftStickX = lX; CPad::GetPad(0)->OldState.LeftStickX = lX;
@ -714,22 +711,32 @@ int32 FrameSamples;
struct tZonePrint struct tZonePrint
{ {
char name[12]; char name[11];
CRect rect; char area[5];
CRect rect;
}; };
tZonePrint ZonePrint[] = tZonePrint ZonePrint[] =
{ {
{ "suburban", CRect(-1639.4f, 1014.3f, -226.23f, -1347.9f) }, { "DOWNTOWN", "GM", CRect(-1500.0f, 1500.0f, -300.0f, 980.0f)},
{ "comntop", CRect(-223.52f, 203.62f, 616.79f, -413.6f) }, { "DOWNTOWS", "KB", CRect(-1200.0f, 980.0f, -300.0f, 435.0f)},
{ "comnbtm", CRect(-227.24f, -413.6f, 620.51f, -911.84f) }, { "GOLF", "NT", CRect(-300.0f, 660.0f, 320.0f, -255.0f)},
{ "comse", CRect( 200.35f, -911.84f, 620.51f, -1737.3f) }, { "LITTLEHA", "AG", CRect(-1250.0f, -310.0f, -746.0f, -926.0f)},
{ "comsw", CRect(-223.52f, -911.84f, 200.35f, -1737.3f) }, { "HAITI", "CJ", CRect(-1355.0f, 30.0f, -637.0f, -304.0f)},
{ "industsw", CRect( 744.05f, -473.0f, 1067.5f, -1331.5f) }, { "HAITIN", "SM", CRect(-1355.0f, 435.0f, -637.0f, 30.0f)},
{ "industne", CRect( 1067.5f, 282.19f, 1915.3f, -473.0f) }, { "DOCKS", "AW", CRect(-1122.0f, -926.0f, -609.0f, -1575.0f)},
{ "industnw", CRect( 744.05f, 324.95f, 1067.5f, -473.0f) }, { "AIRPORT", "NT", CRect(-2000.0f, 200.0f, -871.0f, -2000.0f)},
{ "industse", CRect( 1070.3f, -473.0f, 1918.1f, -1331.5f) }, { "STARISL", "CJ", CRect(-724.0f, -320.0f, -40.0f, -380.0f)},
{ "no zone", CRect( 0.0f, 0.0f, 0.0f, 0.0f) } { "CENT.ISLA", "NT", CRect(-163.0f, 1260.0f, 120.0f, 830.0f)},
{ "MALL", "AW", CRect( 300.0f, 1266.0f, 483.0f, 995.0f)},
{ "MANSION", "KB", CRect(-724.0f, -500.0f, -40.0f, -670.0f)},
{ "NBEACH", "AS", CRect( 120.0f, 1340.0f, 900.0f, 600.0f)},
{ "NBEACHBT", "AS", CRect( 200.0f, 680.0f, 660.0f, -50.0f)},
{ "NBEACHW", "AS", CRect(-93.0f, 80.0f, 410.0f, -680.0f)},
{ "OCEANDRV", "AC", CRect( 200.0f, -964.0f, 955.0f, -1797.0f)},
{ "OCEANDN", "WS", CRect( 400.0f, 50.0f, 955.0f, -964.0f)},
{ "WASHINGTN", "AC", CRect(-320.0f, -487.0f, 500.0f, -1200.0f)},
{ "WASHINBTM", "AC", CRect(-255.0f, -1200.0f, 500.0f, -1690.0f)}
}; };
#ifndef MASTER #ifndef MASTER
@ -737,14 +744,12 @@ void
DisplayGameDebugText() DisplayGameDebugText()
{ {
static bool bDisplayPosn = false; static bool bDisplayPosn = false;
static bool bDisplayRate = false; static bool bDisplayCheatStr = false; // custom
static bool bDisplayCheatStr = false;
#ifndef FINAL #ifndef FINAL
{ {
SETTWEAKPATH("GameDebugText"); SETTWEAKPATH("GameDebugText");
TWEAKBOOL(bDisplayPosn); TWEAKBOOL(bDisplayPosn);
TWEAKBOOL(bDisplayRate);
TWEAKBOOL(bDisplayCheatStr); TWEAKBOOL(bDisplayCheatStr);
} }
#endif #endif
@ -777,23 +782,8 @@ DisplayGameDebugText()
FramesPerSecondCounter = 0.0f; FramesPerSecondCounter = 0.0f;
FrameSamples = 0; FrameSamples = 0;
} }
if ( !TheCamera.WorldViewerBeingUsed
&& CPad::GetPad(1)->GetSquare()
&& CPad::GetPad(1)->GetTriangle()
&& CPad::GetPad(1)->GetLeftShoulder2JustDown() )
{
bDisplayPosn = !bDisplayPosn;
}
if ( CPad::GetPad(1)->GetSquare() if ( bDisplayPosn )
&& CPad::GetPad(1)->GetTriangle()
&& CPad::GetPad(1)->GetRightShoulder2JustDown() )
{
bDisplayRate = !bDisplayRate;
}
if ( bDisplayPosn || bDisplayRate )
{ {
CVector pos = FindPlayerCoors(); CVector pos = FindPlayerCoors();
int32 ZoneId = ARRAY_SIZE(ZonePrint)-1; // no zone int32 ZoneId = ARRAY_SIZE(ZonePrint)-1; // no zone
@ -810,43 +800,42 @@ DisplayGameDebugText()
} }
//NOTE: fps should be 30, but its 29 due to different fp2int conversion //NOTE: fps should be 30, but its 29 due to different fp2int conversion
if ( bDisplayRate ) sprintf(str, "X:%4.0f Y:%4.0f Z:%4.0f F-%d %s-%s", pos.x, pos.y, pos.z, (int32)FramesPerSecond,
sprintf(str, "X:%5.1f, Y:%5.1f, Z:%5.1f, F-%d, %s", pos.x, pos.y, pos.z, (int32)FramesPerSecond, ZonePrint[ZoneId].name); ZonePrint[ZoneId].name, ZonePrint[ZoneId].area);
else
sprintf(str, "X:%5.1f, Y:%5.1f, Z:%5.1f, %s", pos.x, pos.y, pos.z, ZonePrint[ZoneId].name);
AsciiToUnicode(str, ustr); AsciiToUnicode(str, ustr);
// Let's not scale those numbers, they look better that way :eyes: CFont::SetPropOn();
CFont::SetPropOff();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
CFont::SetScale(0.7f, 1.5f); CFont::SetScale(SCREEN_SCALE_X(0.6f), SCREEN_SCALE_Y(0.8f));
CFont::SetCentreOff(); CFont::SetCentreOff();
CFont::SetRightJustifyOff(); CFont::SetRightJustifyOff();
CFont::SetJustifyOff(); CFont::SetJustifyOff();
CFont::SetBackGroundOnlyTextOff(); CFont::SetBackGroundOnlyTextOff();
CFont::SetWrapx(640.0f); CFont::SetWrapx(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH));
CFont::SetFontStyle(FONT_HEADING); CFont::SetFontStyle(FONT_STANDARD);
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
CFont::SetDropShadowPosition(2);
CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString(42.0f, 42.0f, ustr); CFont::PrintString(41.0f, 41.0f, ustr);
CFont::SetColor(CRGBA(255, 108, 0, 255)); CFont::SetColor(CRGBA(205, 205, 0, 255));
CFont::PrintString(40.0f, 40.0f, ustr); CFont::PrintString(40.0f, 40.0f, ustr);
} }
// custom
if (bDisplayCheatStr) if (bDisplayCheatStr)
{ {
sprintf(str, "%s", CPad::KeyBoardCheatString); sprintf(str, "%s", CPad::KeyBoardCheatString);
AsciiToUnicode(str, ustr); AsciiToUnicode(str, ustr);
CFont::SetPropOff(); CFont::SetPropOn();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
CFont::SetScale(0.7f, 1.5f); CFont::SetScale(SCREEN_SCALE_X(0.6f), SCREEN_SCALE_Y(0.8f));
CFont::SetCentreOn(); CFont::SetCentreOn();
CFont::SetBackGroundOnlyTextOff(); CFont::SetBackGroundOnlyTextOff();
CFont::SetWrapx(640.0f); CFont::SetWrapx(SCREEN_STRETCH_X(DEFAULT_SCREEN_WIDTH));
CFont::SetFontStyle(FONT_HEADING); CFont::SetFontStyle(FONT_STANDARD);
CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH * 0.5f)+2.f, SCREEN_SCALE_FROM_BOTTOM(20.0f)+2.f, ustr); CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH * 0.5f)+2.f, SCREEN_SCALE_FROM_BOTTOM(20.0f)+2.f, ustr);
@ -968,7 +957,7 @@ Render2dStuff(void)
CSceneEdit::Draw(); CSceneEdit::Draw();
else else
CHud::Draw(); CHud::Draw();
// TODO(Miami)
CSpecialFX::Render2DFXs(); CSpecialFX::Render2DFXs();
CUserDisplay::OnscnTimer.ProcessForDisplay(); CUserDisplay::OnscnTimer.ProcessForDisplay();
CMessages::Display(); CMessages::Display();
@ -1007,6 +996,9 @@ Render2dStuffAfterFade(void)
DisplayGameDebugText(); DisplayGameDebugText();
#endif #endif
#ifdef MOBILE_IMPROVEMENTS
if (CDraw::FadeValue != 0)
#endif
CHud::DrawAfterFade(); CHud::DrawAfterFade();
CFont::DrawFonts(); CFont::DrawFonts();
CCredits::Render(); CCredits::Render();
@ -1065,9 +1057,7 @@ Idle(void *arg)
if(arg == nil) if(arg == nil)
return; return;
// m_bRenderGameInMenu is there in III PS2 but I don't know about VC PS2. if(!FrontEndMenuManager.m_bMenuActive && TheCamera.GetScreenFadeStatus() != FADE_2)
if((!FrontEndMenuManager.m_bMenuActive/* || FrontEndMenuManager.m_bRenderGameInMenu*/) &&
TheCamera.GetScreenFadeStatus() != FADE_2)
{ {
#ifdef GTA_PC #ifdef GTA_PC
// This is from SA, but it's nice for windowed mode // This is from SA, but it's nice for windowed mode