summaryrefslogtreecommitdiffstats
path: root/src/core/main.cpp
diff options
context:
space:
mode:
authorFire-Head <Fire-Head@users.noreply.github.com>2020-06-27 23:01:51 +0200
committerFire-Head <Fire-Head@users.noreply.github.com>2020-06-27 23:01:51 +0200
commit1c11a8081f246dda91ff11d4207d87bb93260b1a (patch)
tree226ff4fb914fbd93d67aff62ed24ac896ff2c89a /src/core/main.cpp
parentnullsampman (diff)
downloadre3-1c11a8081f246dda91ff11d4207d87bb93260b1a.tar
re3-1c11a8081f246dda91ff11d4207d87bb93260b1a.tar.gz
re3-1c11a8081f246dda91ff11d4207d87bb93260b1a.tar.bz2
re3-1c11a8081f246dda91ff11d4207d87bb93260b1a.tar.lz
re3-1c11a8081f246dda91ff11d4207d87bb93260b1a.tar.xz
re3-1c11a8081f246dda91ff11d4207d87bb93260b1a.tar.zst
re3-1c11a8081f246dda91ff11d4207d87bb93260b1a.zip
Diffstat (limited to 'src/core/main.cpp')
-rw-r--r--src/core/main.cpp65
1 files changed, 47 insertions, 18 deletions
diff --git a/src/core/main.cpp b/src/core/main.cpp
index 1ea8dc7f..7c50e81e 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -58,6 +58,7 @@
#include "Console.h"
#include "timebars.h"
#include "GenericGameStorage.h"
+#include "MemoryCard.h"
#include "SceneEdit.h"
#include "debugmenu.h"
@@ -181,14 +182,27 @@ DoFade(void)
if(CTimer::GetIsPaused())
return;
+#ifdef PS2_MENU
+ if(TheMemoryCard.JustLoadedDontFadeInYet){
+ TheMemoryCard.JustLoadedDontFadeInYet = false;
+ TheMemoryCard.TimeStartedCountingForFade = CTimer::GetTimeInMilliseconds();
+ }
+#else
if(JustLoadedDontFadeInYet){
JustLoadedDontFadeInYet = false;
TimeStartedCountingForFade = CTimer::GetTimeInMilliseconds();
}
+#endif
+#ifdef PS2_MENU
+ if(TheMemoryCard.StillToFadeOut){
+ if(CTimer::GetTimeInMilliseconds() - TheMemoryCard.TimeStartedCountingForFade > TheMemoryCard.TimeToStayFadedBeforeFadeOut){
+ TheMemoryCard.StillToFadeOut = false;
+#else
if(StillToFadeOut){
if(CTimer::GetTimeInMilliseconds() - TimeStartedCountingForFade > TimeToStayFadedBeforeFadeOut){
StillToFadeOut = false;
+#endif
TheCamera.Fade(3.0f, FADE_IN);
TheCamera.ProcessFade();
TheCamera.ProcessMusicFade();
@@ -888,17 +902,16 @@ Render2dStuff(void)
void
RenderMenus(void)
{
-#ifdef PS2
- if (FrontEndMenuManager.m_bWantToDraw)
+ if (FrontEndMenuManager.m_bMenuActive)
{
+#ifdef PS2
gMainHeap.PushMemId(_TODOCONST(17));
+#endif
FrontEndMenuManager.DrawFrontEnd();
+#ifdef PS2
gMainHeap.PopMemId();
- }
-#else
- if(FrontEndMenuManager.m_bMenuActive)
- FrontEndMenuManager.DrawFrontEnd();
#endif
+ }
}
void
@@ -975,14 +988,25 @@ Idle(void *arg)
#endif
if(CGame::bDemoMode && CTimer::GetTimeInMilliseconds() > (3*60 + 30)*1000 && !CCutsceneMgr::IsCutsceneProcessing()){
+#ifdef PS2_MENU
+ TheMemoryCard.m_bWantToLoad = false;
+ FrontEndMenuManager.m_bWantToRestart = true;
+#else
FrontEndMenuManager.m_bWantToRestart = true;
FrontEndMenuManager.m_bWantToLoad = false;
+#endif
return;
}
+#ifdef PS2_MENU
+ if ( FrontEndMenuManager.m_bWantToRestart || TheMemoryCard.b_FoundRecentSavedGameWantToLoad )
+#else
if(FrontEndMenuManager.m_bWantToRestart || b_FoundRecentSavedGameWantToLoad)
+#endif
+ {
return;
-
+ }
+
SetLightsWithTimeOfDayColour(Scene.world);
if(arg == nil)
@@ -1042,7 +1066,7 @@ Idle(void *arg)
#ifdef TIMEBARS
tbStartTimer(0, "RenderMotionBlur");
#endif
- if((TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_NORMAL) &&
+ if((TheCamera.m_BlurType == MOTION_BLUR_NONE || TheCamera.m_BlurType == MOTION_BLUR_LIGHT_SCENE) &&
TheCamera.m_ScreenReductionPercentage > 0.0f)
TheCamera.SetMotionBlurAlpha(150);
TheCamera.RenderMotionBlur();
@@ -1078,6 +1102,11 @@ Idle(void *arg)
tbEndTimer("RenderMenus");
tbStartTimer(0, "DoFade");
#endif
+
+#ifdef PS2_MENU
+ if ( TheMemoryCard.m_bWantToLoad )
+ return;
+#endif
DoFade();
#ifdef TIMEBARS
tbEndTimer("DoFade");
@@ -1262,6 +1291,7 @@ TheModelViewer(void)
}
#endif
+#ifdef PS2
void TheGame(void)
{
printf("Into TheGame!!!\n");
@@ -1283,12 +1313,12 @@ void TheGame(void)
LoadingScreen("Starting Game", NULL, splash);
#ifdef GTA_PS2
- if ( TheMemoryCard.CheckCardInserted(_TODOCONST(0)) == _TODOCONST(26)
- && TheMemoryCard.ChangeDirectory(_TODOCONST(0), TheMemoryCard.field154)
- && TheMemoryCard.FindMostRecentFileName(_TODOCONST(0), TheMemoryCard.field37) == 1
- && TheMemoryCard.CheckDataNotCorrupt(TheMemoryCard.field37))
+ if ( TheMemoryCard.CheckCardInserted(CARD_ONE) == CMemoryCard::NO_ERR_SUCCESS
+ && TheMemoryCard.ChangeDirectory(CARD_ONE, TheMemoryCard.Cards[CARD_ONE].dir)
+ && TheMemoryCard.FindMostRecentFileName(CARD_ONE, TheMemoryCard.MostRecentFile) == true
+ && TheMemoryCard.CheckDataNotCorrupt(TheMemoryCard.MostRecentFile))
{
- strcpy(TheMemoryCard.LoadFileName, TheMemoryCard.field37);
+ strcpy(TheMemoryCard.LoadFileName, TheMemoryCard.MostRecentFile);
TheMemoryCard.b_FoundRecentSavedGameWantToLoad = true;
if (CMenuManager::m_PrefsLanguage != TheMemoryCard.GetLanguageToLoad())
@@ -1391,7 +1421,7 @@ void TheGame(void)
RenderDebugShit();
RenderEffects();
- if ((TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_NORMAL) && TheCamera.m_ScreenReductionPercentage > 0.0f)
+ if ((TheCamera.m_BlurType == MOTION_BLUR_NONE || TheCamera.m_BlurType == MOTION_BLUR_LIGHT_SCENE) && TheCamera.m_ScreenReductionPercentage > 0.0f)
TheCamera.SetMotionBlurAlpha(150);
TheCamera.RenderMotionBlur();
@@ -1773,8 +1803,6 @@ void GameInit()
}
}
-// Not used anyway. PS2 main() port
-#ifdef _WIN32
int
main(int argc, char *argv[])
{
@@ -1785,9 +1813,10 @@ main(int argc, char *argv[])
SystemInit();
#ifdef PS2
- int32 state = TheMemoryCard.CheckCardStateAtGameStartUp(_TODOCONST(0));
+ int32 r = TheMemoryCard.CheckCardStateAtGameStartUp(CARD_ONE);
- if ( state == _TODOCONST(2) || state == _TODOCONST(1) && state != _TODOCONST(3) && state != _TODOCONST(0) )
+ if ( r == CMemoryCard::ERR_DIRNOENTRY || r == CMemoryCard::ERR_NOFORMAT
+ && r != CMemoryCard::ERR_OPENNOENTRY && r != CMemoryCard::ERR_NONE )
{
GameInit();