summaryrefslogtreecommitdiffstats
path: root/src/core/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/main.cpp')
-rw-r--r--src/core/main.cpp201
1 files changed, 94 insertions, 107 deletions
diff --git a/src/core/main.cpp b/src/core/main.cpp
index eb39b287..547d3b37 100644
--- a/src/core/main.cpp
+++ b/src/core/main.cpp
@@ -84,7 +84,7 @@ RwRGBA gColourTop;
bool gameAlreadyInitialised;
float NumberOfChunksLoaded;
-#define TOTALNUMCHUNKS 73.0f
+#define TOTALNUMCHUNKS 95.0f
bool g_SlowMode = false;
char version_name[64];
@@ -139,11 +139,8 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
CRGBA TopColor(TopRed, TopGreen, TopBlue, Alpha);
CRGBA BottomColor(BottomRed, BottomGreen, BottomBlue, Alpha);
-#ifndef ASPECT_RATIO_SCALE
- CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, (CMenuManager::m_PrefsUseWideScreen ? 16.f / 9.f : 4.f / 3.f));
-#else
+ CDraw::CalculateAspectRatio();
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
-#endif
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &TopColor.rwRGBA, rwCAMERACLEARZ);
@@ -161,11 +158,8 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
bool
DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha)
{
-#ifndef ASPECT_RATIO_SCALE
- CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, (CMenuManager::m_PrefsUseWideScreen ? 16.f/9.f : 4.f/3.f));
-#else
+ CDraw::CalculateAspectRatio();
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
-#endif
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
@@ -209,13 +203,13 @@ DoFade(void)
}
}
- if(CDraw::FadeValue != 0 || CMenuManager::m_PrefsBrightness < 256){
+ if(CDraw::FadeValue != 0 || FrontEndMenuManager.m_PrefsBrightness < 256){
CSprite2d *splash = LoadSplash(nil);
CRGBA fadeColor;
CRect rect;
int fadeValue = CDraw::FadeValue;
- float brightness = Min(CMenuManager::m_PrefsBrightness, 256);
+ float brightness = Min(FrontEndMenuManager.m_PrefsBrightness, 256);
if(brightness <= 50)
brightness = 50;
if(FrontEndMenuManager.m_bMenuActive)
@@ -366,6 +360,7 @@ Terminate3D(void)
CSprite2d splash;
int splashTxdId = -1;
+//--MIAMI: done
CSprite2d*
LoadSplash(const char *name)
{
@@ -411,22 +406,23 @@ DestroySplashScreen(void)
splashTxdId = -1;
}
+//--MIAMI: done
Const char*
GetRandomSplashScreen(void)
{
int index;
static int index2 = 0;
static char splashName[128];
- static int splashIndex[24] = {
- 25, 22, 4, 13,
- 1, 21, 14, 16,
- 10, 12, 5, 9,
- 11, 18, 3, 2,
- 19, 23, 7, 17,
- 15, 6, 8, 20
+ static int splashIndex[12] = {
+ 1, 2,
+ 3, 4,
+ 5, 11,
+ 6, 8,
+ 9, 10,
+ 7, 12
};
- index = splashIndex[4*index2 + CGeneral::GetRandomNumberInRange(0, 3)];
+ index = splashIndex[2*index2 + CGeneral::GetRandomNumberInRange(0, 2)];
index2++;
if(index2 == 6)
index2 = 0;
@@ -453,17 +449,14 @@ ResetLoadingScreenBar()
NumberOfChunksLoaded = 0.0f;
}
-// TODO: compare with PS2
+//--MIAMI: done
void
LoadingScreen(const char *str1, const char *str2, const char *splashscreen)
{
CSprite2d *splash;
#ifndef RANDOMSPLASH
- if(CGame::frenchGame || CGame::germanGame || !CGame::nastyGame)
- splashscreen = "mainsc2";
- else
- splashscreen = "mainsc1";
+ splashscreen = "LOADSC0";
#endif
splash = LoadSplash(splashscreen);
@@ -484,36 +477,50 @@ LoadingScreen(const char *str1, const char *str2, const char *splashscreen)
if(str1){
NumberOfChunksLoaded += 1;
+#ifndef RANDOMSPLASH
float hpos = SCREEN_SCALE_X(40);
- float length = SCREEN_WIDTH - SCREEN_SCALE_X(100);
- float vpos = SCREEN_HEIGHT - SCREEN_SCALE_Y(13);
- float height = SCREEN_SCALE_Y(7);
- CSprite2d::DrawRect(CRect(hpos, vpos, hpos + length, vpos + height), CRGBA(40, 53, 68, 255));
+ float length = SCREEN_WIDTH - SCREEN_SCALE_X(80);
+ float top = SCREEN_HEIGHT - SCREEN_SCALE_Y(14);
+ float bottom = top + SCREEN_SCALE_Y(5);
+#else
+ float hpos = SCREEN_STRETCH_X(40);
+ float length = SCREEN_STRETCH_X(440);
+ // this is rather weird
+ float top = SCREEN_STRETCH_Y(407.4f - 7.0f/3.0f);
+ float bottom = SCREEN_STRETCH_Y(407.4f + 7.0f/3.0f);
+#endif
+
+ CSprite2d::DrawRect(CRect(hpos-1.0f, top-1.0f, hpos+length+1.0f, bottom+1.0f), CRGBA(40, 53, 68, 255));
+
+ CSprite2d::DrawRect(CRect(hpos, top, hpos+length, bottom), CRGBA(155, 50, 125, 255));
length *= NumberOfChunksLoaded/TOTALNUMCHUNKS;
- CSprite2d::DrawRect(CRect(hpos, vpos, hpos + length, vpos + height), CRGBA(81, 106, 137, 255));
+ CSprite2d::DrawRect(CRect(hpos, top, hpos+length, bottom), CRGBA(255, 150, 225, 255));
// this is done by the game but is unused
+ CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(2), SCREEN_SCALE_Y(2));
CFont::SetPropOn();
CFont::SetRightJustifyOn();
+ CFont::SetDropShadowPosition(1);
+ CFont::SetDropColor(CRGBA(0, 0, 0, 255));
CFont::SetFontStyle(FONT_HEADING);
#ifdef CHATTYSPLASH
// my attempt
static wchar tmpstr[80];
float yscale = SCREEN_SCALE_Y(0.9f);
- vpos -= 45*yscale;
+ top -= 45*yscale;
CFont::SetScale(SCREEN_SCALE_X(0.75f), yscale);
CFont::SetPropOn();
CFont::SetRightJustifyOff();
CFont::SetFontStyle(FONT_BANK);
CFont::SetColor(CRGBA(255, 255, 255, 255));
AsciiToUnicode(str1, tmpstr);
- CFont::PrintString(hpos, vpos, tmpstr);
- vpos += 22*yscale;
+ CFont::PrintString(hpos, top, tmpstr);
+ top += 22*yscale;
AsciiToUnicode(str2, tmpstr);
- CFont::PrintString(hpos, vpos, tmpstr);
+ CFont::PrintString(hpos, top, tmpstr);
#endif
}
@@ -686,11 +693,13 @@ DisplayGameDebugText()
{
static bool bDisplayPosn = false;
static bool bDisplayRate = false;
+ static bool bDisplayCheatStr = false;
{
SETTWEAKPATH("GameDebugText");
TWEAKBOOL(bDisplayPosn);
TWEAKBOOL(bDisplayRate);
+ TWEAKBOOL(bDisplayCheatStr);
}
@@ -778,6 +787,26 @@ DisplayGameDebugText()
CFont::SetColor(CRGBA(255, 108, 0, 255));
CFont::PrintString(40.0f, 40.0f, ustr);
}
+
+ if (bDisplayCheatStr)
+ {
+ sprintf(str, "%s", CPad::KeyBoardCheatString);
+ AsciiToUnicode(str, ustr);
+
+ CFont::SetPropOff();
+ CFont::SetBackgroundOff();
+ CFont::SetScale(0.7f, 1.5f);
+ CFont::SetCentreOn();
+ CFont::SetBackGroundOnlyTextOff();
+ CFont::SetWrapx(640.0f);
+ CFont::SetFontStyle(FONT_HEADING);
+
+ 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::SetColor(CRGBA(255, 150, 225, 255));
+ CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH * 0.5f), SCREEN_SCALE_FROM_BOTTOM(20.0f), ustr);
+ }
}
#endif
@@ -788,14 +817,17 @@ RenderScene(void)
DoRWRenderHorizon();
CRenderer::RenderRoads();
CCoronas::RenderReflections();
- RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
CRenderer::RenderEverythingBarRoads();
- CRenderer::RenderBoats();
- DefinedState();
+ RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE);
CWaterLevel::RenderWater();
+ CRenderer::RenderBoats();
+ CRenderer::RenderFadingInUnderwaterEntities();
+ RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE);
+ CWaterLevel::RenderTransparentWater();
CRenderer::RenderFadingInEntities();
- CRenderer::RenderVehiclesButNotBoats();
+ RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE);
CWeather::RenderRainStreaks();
+ // CCoronas::RenderSunReflection
}
void
@@ -920,15 +952,12 @@ Render2dStuffAfterFade(void)
CHud::DrawAfterFade();
CFont::DrawFonts();
+ CCredits::Render();
}
void
Idle(void *arg)
{
-#ifdef ASPECT_RATIO_SCALE
- CDraw::SetAspectRatio(CDraw::FindAspectRatio());
-#endif
-
CTimer::Update();
#ifdef TIMEBARS
@@ -938,35 +967,6 @@ Idle(void *arg)
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
- // We're basically merging FrontendIdle and Idle (just like TheGame on PS2)
-#ifdef PS2_SAVE_DIALOG
- // Only exists on PC FrontendIdle, probably some PS2 bug fix
- if (FrontEndMenuManager.m_bMenuActive)
- CSprite2d::SetRecipNearClip();
-
- if (FrontEndMenuManager.m_bGameNotLoaded) {
- CPad::UpdatePads();
- FrontEndMenuManager.Process();
- } else {
- CPointLights::InitPerFrame();
-#ifdef TIMEBARS
- tbStartTimer(0, "CGame::Process");
-#endif
- CGame::Process();
-#ifdef TIMEBARS
- tbEndTimer("CGame::Process");
- tbStartTimer(0, "DMAudio.Service");
-#endif
- DMAudio.Service();
-
-#ifdef TIMEBARS
- tbEndTimer("DMAudio.Service");
-#endif
- }
-
- if (RsGlobal.quit)
- return;
-#else
CPointLights::InitPerFrame();
#ifdef TIMEBARS
tbStartTimer(0, "CGame::Process");
@@ -982,7 +982,6 @@ Idle(void *arg)
#ifdef TIMEBARS
tbEndTimer("DMAudio.Service");
#endif
-#endif
if(CGame::bDemoMode && CTimer::GetTimeInMilliseconds() > (3*60 + 30)*1000 && !CCutsceneMgr::IsCutsceneProcessing()){
FrontEndMenuManager.m_bWantToRestart = true;
@@ -998,21 +997,23 @@ Idle(void *arg)
if(arg == nil)
return;
- if((!FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bRenderGameInMenu) &&
+ // m_bRenderGameInMenu is there in III PS2 but I don't know about VC PS2.
+ if((!FrontEndMenuManager.m_bMenuActive/* || FrontEndMenuManager.m_bRenderGameInMenu*/) &&
TheCamera.GetScreenFadeStatus() != FADE_2)
{
#ifdef GTA_PC
- if (!FrontEndMenuManager.m_bRenderGameInMenu) {
// This is from SA, but it's nice for windowed mode
RwV2d pos;
pos.x = SCREEN_WIDTH / 2.0f;
pos.y = SCREEN_HEIGHT / 2.0f;
RsMouseSetPos(&pos);
- }
#endif
#ifdef TIMEBARS
tbStartTimer(0, "CnstrRenderList");
#endif
+#ifdef PC_WATER
+ CWaterLevel::PreCalcWaterGeometry();
+#endif
CRenderer::ConstructRenderList();
#ifdef TIMEBARS
tbEndTimer("CnstrRenderList");
@@ -1065,6 +1066,7 @@ Idle(void *arg)
tbEndTimer("Render2dStuff");
#endif
}else{
+ CDraw::CalculateAspectRatio();
#ifdef ASPECT_RATIO_SCALE
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
#else
@@ -1076,10 +1078,6 @@ Idle(void *arg)
return;
}
-#ifdef PS2_SAVE_DIALOG
- if (FrontEndMenuManager.m_bMenuActive)
- DefinedState();
-#endif
#ifdef TIMEBARS
tbStartTimer(0, "RenderMenus");
#endif
@@ -1097,7 +1095,7 @@ Idle(void *arg)
#ifdef TIMEBARS
tbEndTimer("Render2dStuff-Fade");
#endif
- CCredits::Render();
+ // CCredits::Render(); // They added it to function above and also forgot it here
#ifdef TIMEBARS
@@ -1114,10 +1112,7 @@ Idle(void *arg)
void
FrontendIdle(void)
{
-#ifdef ASPECT_RATIO_SCALE
- CDraw::SetAspectRatio(CDraw::FindAspectRatio());
-#endif
-
+ CDraw::CalculateAspectRatio();
CTimer::Update();
CSprite2d::SetRecipNearClip(); // this should be on InitialiseRenderWare according to PS2 asm. seems like a bug fix
CSprite2d::InitPerFrame();
@@ -1128,11 +1123,7 @@ FrontendIdle(void)
if(RsGlobal.quit)
return;
-#ifdef ASPECT_RATIO_SCALE
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
-#else
- CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
-#endif
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
if(!RsCameraBeginUpdate(Scene.camera))
@@ -1142,7 +1133,7 @@ FrontendIdle(void)
RenderMenus();
DoFade();
Render2dStuffAfterFade();
-// CFont::DrawFonts(); // redundant
+ CFont::DrawFonts();
DoRWStuffEndOfFrame();
}
@@ -1150,7 +1141,7 @@ void
InitialiseGame(void)
{
LoadingScreen(nil, nil, "loadsc0");
- CGame::Initialise("DATA\\GTA3.DAT");
+ CGame::Initialise("DATA\\GTA_VC.DAT");
}
RsEventStatus
@@ -1213,11 +1204,7 @@ AppEventHandler(RsEvent event, void *param)
case rsFRONTENDIDLE:
{
-#ifdef PS2_SAVE_DIALOG
- Idle((void*)1);
-#else
FrontendIdle();
-#endif
return rsEVENTPROCESSED;
}
@@ -1252,9 +1239,8 @@ TheModelViewer(void)
#if (defined(GTA_PS2) || defined(GTA_XBOX))
//TODO
#else
-#ifdef ASPECT_RATIO_SCALE
- CDraw::SetAspectRatio(CDraw::FindAspectRatio());
-#endif
+
+ CDraw::CalculateAspectRatio();
CAnimViewer::Update();
CTimer::Update();
SetLightsWithTimeOfDayColour(Scene.world);
@@ -1303,9 +1289,9 @@ void TheGame(void)
strcpy(TheMemoryCard.LoadFileName, TheMemoryCard.field37);
TheMemoryCard.b_FoundRecentSavedGameWantToLoad = true;
- if (CMenuManager::m_PrefsLanguage != TheMemoryCard.GetLanguageToLoad())
+ if (FrontEndMenuManager.m_PrefsLanguage != TheMemoryCard.GetLanguageToLoad())
{
- CMenuManager::m_PrefsLanguage = TheMemoryCard.GetLanguageToLoad();
+ FrontEndMenuManager.m_PrefsLanguage = TheMemoryCard.GetLanguageToLoad();
TheText.Unload();
TheText.Load();
}
@@ -1379,7 +1365,8 @@ void TheGame(void)
gMainHeap.PushMemId(_TODOCONST(15));
#endif
- if (!FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bRenderGameInMenu == true && TheCamera.GetScreenFadeStatus() != FADE_2 )
+ // m_bRenderGameInMenu is there in III PS2 but I don't know about VC PS2.
+ if (!FrontEndMenuManager.m_bMenuActive || /*FrontEndMenuManager.m_bRenderGameInMenu == true && */TheCamera.GetScreenFadeStatus() != FADE_2 )
{
#ifdef GTA_PS2
gMainHeap.PushMemId(_TODOCONST(11));
@@ -1586,30 +1573,30 @@ void SystemInit()
CGame::frenchGame = false;
CGame::germanGame = false;
CGame::nastyGame = true;
- CMenuManager::m_PrefsAllowNastyGame = true;
+ FrontEndMenuManager.m_PrefsAllowNastyGame = true;
#ifdef GTA_PS2
int32 lang = sceScfGetLanguage();
if ( lang == SCE_ITALIAN_LANGUAGE )
- CMenuManager::m_PrefsLanguage = LANGUAGE_ITALIAN;
+ FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_ITALIAN;
else if ( lang == SCE_SPANISH_LANGUAGE )
- CMenuManager::m_PrefsLanguage = LANGUAGE_SPANISH;
+ FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_SPANISH;
else if ( lang == SCE_GERMAN_LANGUAGE )
{
CGame::germanGame = true;
CGame::nastyGame = false;
- CMenuManager::m_PrefsAllowNastyGame = false;
- CMenuManager::m_PrefsLanguage = LANGUAGE_GERMAN;
+ FrontEndMenuManager.m_PrefsAllowNastyGame = false;
+ FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_GERMAN;
}
else if ( lang == SCE_FRENCH_LANGUAGE )
{
CGame::frenchGame = true;
CGame::nastyGame = false;
- CMenuManager::m_PrefsAllowNastyGame = false;
- CMenuManager::m_PrefsLanguage = LANGUAGE_FRENCH;
+ FrontEndMenuManager.m_PrefsAllowNastyGame = false;
+ FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_FRENCH;
}
else
- CMenuManager::m_PrefsLanguage = LANGUAGE_AMERICAN;
+ FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_AMERICAN;
FrontEndMenuManager.InitialiseMenuContentsAfterLoadingGame();
#else