2019-05-24 19:58:32 +02:00
|
|
|
#include "common.h"
|
2020-04-09 01:52:38 +02:00
|
|
|
#include "rpmatfx.h"
|
|
|
|
#include "rphanim.h"
|
2020-04-10 18:36:39 +02:00
|
|
|
#include "rpskin.h"
|
2020-04-17 15:31:11 +02:00
|
|
|
|
2019-06-17 10:30:02 +02:00
|
|
|
#include "main.h"
|
2020-04-09 01:52:38 +02:00
|
|
|
#include "CdStream.h"
|
2019-06-18 09:50:26 +02:00
|
|
|
#include "General.h"
|
2019-05-30 21:24:47 +02:00
|
|
|
#include "RwHelper.h"
|
|
|
|
#include "Clouds.h"
|
|
|
|
#include "Draw.h"
|
|
|
|
#include "Sprite2d.h"
|
2019-05-15 16:52:37 +02:00
|
|
|
#include "Renderer.h"
|
2019-05-30 21:24:47 +02:00
|
|
|
#include "Coronas.h"
|
|
|
|
#include "WaterLevel.h"
|
|
|
|
#include "Weather.h"
|
|
|
|
#include "Glass.h"
|
|
|
|
#include "WaterCannon.h"
|
|
|
|
#include "SpecialFX.h"
|
|
|
|
#include "Shadows.h"
|
|
|
|
#include "Skidmarks.h"
|
|
|
|
#include "Antennas.h"
|
|
|
|
#include "Rubbish.h"
|
|
|
|
#include "Particle.h"
|
|
|
|
#include "Pickups.h"
|
|
|
|
#include "WeaponEffects.h"
|
|
|
|
#include "PointLights.h"
|
|
|
|
#include "Fluff.h"
|
|
|
|
#include "Replay.h"
|
|
|
|
#include "Camera.h"
|
|
|
|
#include "World.h"
|
|
|
|
#include "Ped.h"
|
|
|
|
#include "Font.h"
|
|
|
|
#include "Pad.h"
|
|
|
|
#include "Hud.h"
|
|
|
|
#include "User.h"
|
|
|
|
#include "Messages.h"
|
|
|
|
#include "Darkel.h"
|
|
|
|
#include "Garages.h"
|
|
|
|
#include "MusicManager.h"
|
2019-05-31 11:44:43 +02:00
|
|
|
#include "VisibilityPlugins.h"
|
2019-06-12 14:35:15 +02:00
|
|
|
#include "NodeName.h"
|
2019-05-31 11:44:43 +02:00
|
|
|
#include "DMAudio.h"
|
|
|
|
#include "CutsceneMgr.h"
|
|
|
|
#include "Lights.h"
|
|
|
|
#include "Credits.h"
|
2019-07-07 13:09:11 +02:00
|
|
|
#include "ZoneCull.h"
|
2019-06-30 12:53:39 +02:00
|
|
|
#include "Timecycle.h"
|
2019-06-01 23:17:39 +02:00
|
|
|
#include "TxdStore.h"
|
|
|
|
#include "FileMgr.h"
|
|
|
|
#include "Text.h"
|
2019-06-11 08:59:28 +02:00
|
|
|
#include "RpAnimBlend.h"
|
2019-05-30 21:24:47 +02:00
|
|
|
#include "Frontend.h"
|
2019-08-15 16:51:39 +02:00
|
|
|
#include "AnimViewer.h"
|
2020-02-24 19:17:15 +01:00
|
|
|
#include "Script.h"
|
2020-04-10 18:36:39 +02:00
|
|
|
#include "PathFind.h"
|
2020-03-22 15:23:40 +01:00
|
|
|
#include "Debug.h"
|
|
|
|
#include "Console.h"
|
2020-03-31 12:30:13 +02:00
|
|
|
#include "timebars.h"
|
2020-04-09 01:52:38 +02:00
|
|
|
#include "GenericGameStorage.h"
|
2020-06-27 23:01:51 +02:00
|
|
|
#include "MemoryCard.h"
|
2020-04-13 20:50:56 +02:00
|
|
|
#include "SceneEdit.h"
|
2020-04-24 13:27:02 +02:00
|
|
|
#include "debugmenu.h"
|
2020-04-09 01:52:38 +02:00
|
|
|
|
2020-04-17 07:54:14 +02:00
|
|
|
GlobalScene Scene;
|
2019-06-17 10:30:02 +02:00
|
|
|
|
2019-06-12 16:52:26 +02:00
|
|
|
uint8 work_buff[55000];
|
2020-04-17 07:54:14 +02:00
|
|
|
char gString[256];
|
|
|
|
char gString2[512];
|
|
|
|
wchar gUString[256];
|
|
|
|
wchar gUString2[256];
|
2019-07-24 18:55:43 +02:00
|
|
|
|
|
|
|
float FramesPerSecond = 30.0f;
|
|
|
|
|
|
|
|
bool gbPrintShite = false;
|
2020-04-17 07:54:14 +02:00
|
|
|
bool gbModelViewer;
|
2020-05-29 12:03:32 +02:00
|
|
|
#ifdef TIMEBARS
|
|
|
|
bool gbShowTimebars;
|
|
|
|
#endif
|
2019-07-24 18:55:43 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
int32 frameCount;
|
|
|
|
|
|
|
|
RwRGBA gColourTop;
|
|
|
|
|
|
|
|
bool gameAlreadyInitialised;
|
2019-05-31 11:44:43 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
float NumberOfChunksLoaded;
|
2020-05-17 19:45:21 +02:00
|
|
|
#define TOTALNUMCHUNKS 95.0f
|
2020-04-09 01:52:38 +02:00
|
|
|
|
|
|
|
bool g_SlowMode = false;
|
|
|
|
char version_name[64];
|
2019-05-31 11:44:43 +02:00
|
|
|
|
2019-06-01 23:17:39 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
void GameInit(void);
|
|
|
|
void SystemInit(void);
|
|
|
|
void TheGame(void);
|
2019-06-01 23:17:39 +02:00
|
|
|
|
2020-05-09 15:06:13 +02:00
|
|
|
#ifdef DEBUGMENU
|
2019-06-27 10:58:51 +02:00
|
|
|
void DebugMenuPopulate(void);
|
2020-05-09 15:06:13 +02:00
|
|
|
#endif
|
2019-05-31 11:44:43 +02:00
|
|
|
|
2019-06-28 19:23:28 +02:00
|
|
|
void
|
2020-04-09 01:52:38 +02:00
|
|
|
ValidateVersion()
|
2019-06-28 19:23:28 +02:00
|
|
|
{
|
2020-04-09 01:52:38 +02:00
|
|
|
int32 file = CFileMgr::OpenFile("models\\coll\\peds.col", "rb");
|
|
|
|
char buff[128];
|
2019-06-28 19:23:28 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
if ( file != -1 )
|
|
|
|
{
|
|
|
|
CFileMgr::Seek(file, 100, SEEK_SET);
|
|
|
|
|
|
|
|
for ( int i = 0; i < 128; i++ )
|
|
|
|
{
|
|
|
|
CFileMgr::Read(file, &buff[i], sizeof(char));
|
|
|
|
buff[i] -= 23;
|
|
|
|
if ( buff[i] == '\0' )
|
|
|
|
break;
|
|
|
|
CFileMgr::Seek(file, 99, SEEK_CUR);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !strncmp(buff, "grandtheftauto3", 15) )
|
|
|
|
{
|
|
|
|
strncpy(version_name, &buff[15], 64);
|
|
|
|
CFileMgr::CloseFile(file);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2019-08-15 16:51:39 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
LoadingScreen("Invalid version", NULL, NULL);
|
|
|
|
|
|
|
|
while(true)
|
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
2019-08-15 16:51:39 +02:00
|
|
|
}
|
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
bool
|
|
|
|
DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha)
|
2019-05-31 11:44:43 +02:00
|
|
|
{
|
2020-04-09 01:52:38 +02:00
|
|
|
CRGBA TopColor(TopRed, TopGreen, TopBlue, Alpha);
|
|
|
|
CRGBA BottomColor(BottomRed, BottomGreen, BottomBlue, Alpha);
|
2019-07-03 13:13:55 +02:00
|
|
|
|
2020-05-24 01:59:30 +02:00
|
|
|
CDraw::CalculateAspectRatio();
|
2020-04-09 01:52:38 +02:00
|
|
|
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
|
|
|
|
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
2020-05-24 01:59:30 +02:00
|
|
|
RwCameraClear(Scene.camera, &TopColor.rwRGBA, rwCAMERACLEARZ);
|
2020-03-31 12:30:13 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
if(!RsCameraBeginUpdate(Scene.camera))
|
|
|
|
return false;
|
2020-03-31 12:30:13 +02:00
|
|
|
|
2019-05-31 11:44:43 +02:00
|
|
|
CSprite2d::InitPerFrame();
|
2020-03-31 12:30:13 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
if(Alpha != 0)
|
|
|
|
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), BottomColor, BottomColor, TopColor, TopColor);
|
2020-01-07 15:23:09 +01:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
return true;
|
|
|
|
}
|
2020-03-31 12:30:13 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
bool
|
|
|
|
DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha)
|
|
|
|
{
|
2020-05-24 01:59:30 +02:00
|
|
|
CDraw::CalculateAspectRatio();
|
2020-04-09 01:52:38 +02:00
|
|
|
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
|
|
|
|
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
|
|
|
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
|
2020-03-31 12:30:13 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
if(!RsCameraBeginUpdate(Scene.camera))
|
|
|
|
return false;
|
2019-05-31 11:44:43 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
TheCamera.m_viewMatrix.Update();
|
|
|
|
CClouds::RenderBackground(TopRed, TopGreen, TopBlue, BottomRed, BottomGreen, BottomBlue, Alpha);
|
2019-05-31 11:44:43 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
return true;
|
|
|
|
}
|
2019-05-31 11:44:43 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
// This is certainly a very useful function
|
|
|
|
void
|
|
|
|
DoRWRenderHorizon(void)
|
|
|
|
{
|
|
|
|
CClouds::RenderHorizon();
|
|
|
|
}
|
2019-05-31 11:44:43 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
void
|
|
|
|
DoFade(void)
|
|
|
|
{
|
|
|
|
if(CTimer::GetIsPaused())
|
2019-05-31 11:44:43 +02:00
|
|
|
return;
|
|
|
|
|
2020-06-27 23:01:51 +02:00
|
|
|
#ifdef PS2_MENU
|
|
|
|
if(TheMemoryCard.JustLoadedDontFadeInYet){
|
|
|
|
TheMemoryCard.JustLoadedDontFadeInYet = false;
|
|
|
|
TheMemoryCard.TimeStartedCountingForFade = CTimer::GetTimeInMilliseconds();
|
|
|
|
}
|
|
|
|
#else
|
2020-04-09 01:52:38 +02:00
|
|
|
if(JustLoadedDontFadeInYet){
|
|
|
|
JustLoadedDontFadeInYet = false;
|
|
|
|
TimeStartedCountingForFade = CTimer::GetTimeInMilliseconds();
|
|
|
|
}
|
2020-06-27 23:01:51 +02:00
|
|
|
#endif
|
2019-05-31 11:44:43 +02:00
|
|
|
|
2020-06-27 23:01:51 +02:00
|
|
|
#ifdef PS2_MENU
|
|
|
|
if(TheMemoryCard.StillToFadeOut){
|
|
|
|
if(CTimer::GetTimeInMilliseconds() - TheMemoryCard.TimeStartedCountingForFade > TheMemoryCard.TimeToStayFadedBeforeFadeOut){
|
|
|
|
TheMemoryCard.StillToFadeOut = false;
|
|
|
|
#else
|
2020-04-09 01:52:38 +02:00
|
|
|
if(StillToFadeOut){
|
|
|
|
if(CTimer::GetTimeInMilliseconds() - TimeStartedCountingForFade > TimeToStayFadedBeforeFadeOut){
|
|
|
|
StillToFadeOut = false;
|
2020-06-27 23:01:51 +02:00
|
|
|
#endif
|
2020-04-09 01:52:38 +02:00
|
|
|
TheCamera.Fade(3.0f, FADE_IN);
|
|
|
|
TheCamera.ProcessFade();
|
|
|
|
TheCamera.ProcessMusicFade();
|
2019-05-31 11:44:43 +02:00
|
|
|
}else{
|
2020-04-09 01:52:38 +02:00
|
|
|
TheCamera.SetFadeColour(0, 0, 0);
|
|
|
|
TheCamera.Fade(0.0f, FADE_OUT);
|
|
|
|
TheCamera.ProcessFade();
|
2019-05-31 11:44:43 +02:00
|
|
|
}
|
2020-04-09 01:52:38 +02:00
|
|
|
}
|
2019-05-31 11:44:43 +02:00
|
|
|
|
2020-05-22 01:44:01 +02:00
|
|
|
if(CDraw::FadeValue != 0 || FrontEndMenuManager.m_PrefsBrightness < 256){
|
2020-04-09 01:52:38 +02:00
|
|
|
CSprite2d *splash = LoadSplash(nil);
|
2019-05-31 11:44:43 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
CRGBA fadeColor;
|
|
|
|
CRect rect;
|
|
|
|
int fadeValue = CDraw::FadeValue;
|
2020-05-22 01:44:01 +02:00
|
|
|
float brightness = Min(FrontEndMenuManager.m_PrefsBrightness, 256);
|
2020-04-09 01:52:38 +02:00
|
|
|
if(brightness <= 50)
|
|
|
|
brightness = 50;
|
|
|
|
if(FrontEndMenuManager.m_bMenuActive)
|
|
|
|
brightness = 256;
|
2019-05-31 11:44:43 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
if(TheCamera.m_FadeTargetIsSplashScreen)
|
|
|
|
fadeValue = 0;
|
2019-05-31 11:44:43 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
float fade = fadeValue + 256 - brightness;
|
|
|
|
if(fade == 0){
|
|
|
|
fadeColor.r = 0;
|
|
|
|
fadeColor.g = 0;
|
|
|
|
fadeColor.b = 0;
|
|
|
|
fadeColor.a = 0;
|
|
|
|
}else{
|
|
|
|
fadeColor.r = fadeValue * CDraw::FadeRed / fade;
|
|
|
|
fadeColor.g = fadeValue * CDraw::FadeGreen / fade;
|
|
|
|
fadeColor.b = fadeValue * CDraw::FadeBlue / fade;
|
|
|
|
int alpha = 255 - brightness*(256 - fadeValue)/256;
|
|
|
|
if(alpha < 0)
|
|
|
|
alpha = 0;
|
|
|
|
fadeColor.a = alpha;
|
|
|
|
}
|
2020-03-31 12:30:13 +02:00
|
|
|
|
2020-06-07 20:44:43 +02:00
|
|
|
// This is CCamera::GetScreenRect in VC
|
2020-04-09 01:52:38 +02:00
|
|
|
if(TheCamera.m_WideScreenOn){
|
|
|
|
float y = SCREEN_HEIGHT/2 * TheCamera.m_ScreenReductionPercentage/100.0f;
|
|
|
|
rect.left = 0.0f;
|
|
|
|
rect.right = SCREEN_WIDTH;
|
2020-06-07 20:44:43 +02:00
|
|
|
rect.top = y - SCREEN_SCALE_Y(22.0f);
|
|
|
|
rect.bottom = SCREEN_HEIGHT - y - SCREEN_SCALE_Y(14.0f);
|
2020-04-09 01:52:38 +02:00
|
|
|
}else{
|
|
|
|
rect.left = 0.0f;
|
|
|
|
rect.right = SCREEN_WIDTH;
|
|
|
|
rect.top = 0.0f;
|
|
|
|
rect.bottom = SCREEN_HEIGHT;
|
|
|
|
}
|
|
|
|
CSprite2d::DrawRect(rect, fadeColor);
|
2019-05-31 11:44:43 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
if(CDraw::FadeValue != 0 && TheCamera.m_FadeTargetIsSplashScreen){
|
|
|
|
fadeColor.r = 255;
|
|
|
|
fadeColor.g = 255;
|
|
|
|
fadeColor.b = 255;
|
|
|
|
fadeColor.a = CDraw::FadeValue;
|
|
|
|
splash->Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), fadeColor, fadeColor, fadeColor, fadeColor);
|
|
|
|
}
|
|
|
|
}
|
2019-05-31 11:44:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-04-09 01:52:38 +02:00
|
|
|
DoRWStuffEndOfFrame(void)
|
2019-05-31 11:44:43 +02:00
|
|
|
{
|
2020-04-09 01:52:38 +02:00
|
|
|
CDebug::DisplayScreenStrings(); // custom
|
|
|
|
CDebug::DebugDisplayTextBuffer();
|
|
|
|
FlushObrsPrintfs();
|
|
|
|
RwCameraEndUpdate(Scene.camera);
|
|
|
|
RsCameraShowRaster(Scene.camera);
|
|
|
|
}
|
2019-05-31 11:44:43 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
static RwBool
|
|
|
|
PluginAttach(void)
|
|
|
|
{
|
|
|
|
if( !RpWorldPluginAttach() )
|
|
|
|
{
|
|
|
|
printf("Couldn't attach world plugin\n");
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !RpSkinPluginAttach() )
|
|
|
|
{
|
|
|
|
printf("Couldn't attach RpSkin plugin\n");
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !RpHAnimPluginAttach() )
|
|
|
|
{
|
|
|
|
printf("Couldn't attach RpHAnim plugin\n");
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !NodeNamePluginAttach() )
|
|
|
|
{
|
|
|
|
printf("Couldn't attach node name plugin\n");
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !CVisibilityPlugins::PluginAttach() )
|
|
|
|
{
|
|
|
|
printf("Couldn't attach visibility plugins\n");
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !RpAnimBlendPluginAttach() )
|
|
|
|
{
|
|
|
|
printf("Couldn't attach RpAnimBlend plugin\n");
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !RpMatFXPluginAttach() )
|
|
|
|
{
|
|
|
|
printf("Couldn't attach RpMatFX plugin\n");
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
2019-05-31 11:44:43 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
return TRUE;
|
2019-05-31 11:44:43 +02:00
|
|
|
}
|
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
static RwBool
|
|
|
|
Initialise3D(void *param)
|
2019-06-01 23:17:39 +02:00
|
|
|
{
|
2020-05-23 11:34:22 +02:00
|
|
|
if (RsRwInitialize(param))
|
2020-04-09 01:52:38 +02:00
|
|
|
{
|
2020-05-09 15:06:13 +02:00
|
|
|
#ifdef DEBUGMENU
|
2020-04-09 01:52:38 +02:00
|
|
|
DebugMenuInit();
|
|
|
|
DebugMenuPopulate();
|
2020-05-09 15:06:13 +02:00
|
|
|
#endif // !DEBUGMENU
|
2020-04-09 01:52:38 +02:00
|
|
|
return CGame::InitialiseRenderWare();
|
|
|
|
}
|
2019-06-01 23:17:39 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
return (FALSE);
|
|
|
|
}
|
2019-06-01 23:17:39 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
static void
|
|
|
|
Terminate3D(void)
|
|
|
|
{
|
|
|
|
CGame::ShutdownRenderWare();
|
2020-05-09 15:06:13 +02:00
|
|
|
#ifdef DEBUGMENU
|
2020-04-25 00:40:14 +02:00
|
|
|
DebugMenuShutdown();
|
2020-05-09 15:06:13 +02:00
|
|
|
#endif // !DEBUGMENU
|
2020-04-09 01:52:38 +02:00
|
|
|
|
|
|
|
RsRwTerminate();
|
2019-06-01 23:17:39 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
return;
|
2019-06-01 23:17:39 +02:00
|
|
|
}
|
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
CSprite2d splash;
|
|
|
|
int splashTxdId = -1;
|
|
|
|
|
2020-05-17 19:45:21 +02:00
|
|
|
//--MIAMI: done
|
2020-04-09 01:52:38 +02:00
|
|
|
CSprite2d*
|
|
|
|
LoadSplash(const char *name)
|
2019-05-31 11:44:43 +02:00
|
|
|
{
|
2020-04-09 01:52:38 +02:00
|
|
|
RwTexDictionary *txd;
|
|
|
|
char filename[140];
|
|
|
|
RwTexture *tex = nil;
|
2019-05-31 11:44:43 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
if(name == nil)
|
|
|
|
return &splash;
|
|
|
|
if(splashTxdId == -1)
|
|
|
|
splashTxdId = CTxdStore::AddTxdSlot("splash");
|
2019-05-31 11:44:43 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
txd = CTxdStore::GetSlot(splashTxdId)->texDict;
|
|
|
|
if(txd)
|
|
|
|
tex = RwTexDictionaryFindNamedTexture(txd, name);
|
|
|
|
// if texture is found, splash was already set up below
|
2019-05-31 11:44:43 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
if(tex == nil){
|
|
|
|
CFileMgr::SetDir("TXD\\");
|
|
|
|
sprintf(filename, "%s.txd", name);
|
|
|
|
if(splash.m_pTexture)
|
|
|
|
splash.Delete();
|
|
|
|
if(txd)
|
|
|
|
CTxdStore::RemoveTxd(splashTxdId);
|
|
|
|
CTxdStore::LoadTxd(splashTxdId, filename);
|
|
|
|
CTxdStore::AddRef(splashTxdId);
|
|
|
|
CTxdStore::PushCurrentTxd();
|
|
|
|
CTxdStore::SetCurrentTxd(splashTxdId);
|
|
|
|
splash.SetTexture(name);
|
|
|
|
CTxdStore::PopCurrentTxd();
|
|
|
|
CFileMgr::SetDir("");
|
|
|
|
}
|
2019-05-31 11:44:43 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
return &splash;
|
2019-05-31 11:44:43 +02:00
|
|
|
}
|
|
|
|
|
2019-05-30 21:24:47 +02:00
|
|
|
void
|
2020-04-09 01:52:38 +02:00
|
|
|
DestroySplashScreen(void)
|
2019-05-15 16:52:37 +02:00
|
|
|
{
|
2020-04-09 01:52:38 +02:00
|
|
|
splash.Delete();
|
|
|
|
if(splashTxdId != -1)
|
|
|
|
CTxdStore::RemoveTxdSlot(splashTxdId);
|
|
|
|
splashTxdId = -1;
|
2019-05-15 16:52:37 +02:00
|
|
|
}
|
|
|
|
|
2020-05-17 19:45:21 +02:00
|
|
|
//--MIAMI: done
|
2020-05-12 01:24:57 +02:00
|
|
|
Const char*
|
2020-04-09 01:52:38 +02:00
|
|
|
GetRandomSplashScreen(void)
|
2019-05-15 16:52:37 +02:00
|
|
|
{
|
2020-04-09 01:52:38 +02:00
|
|
|
int index;
|
|
|
|
static int index2 = 0;
|
|
|
|
static char splashName[128];
|
2020-05-17 19:45:21 +02:00
|
|
|
static int splashIndex[12] = {
|
|
|
|
1, 2,
|
|
|
|
3, 4,
|
|
|
|
5, 11,
|
|
|
|
6, 8,
|
|
|
|
9, 10,
|
|
|
|
7, 12
|
2020-04-09 01:52:38 +02:00
|
|
|
};
|
|
|
|
|
2020-05-17 19:45:21 +02:00
|
|
|
index = splashIndex[2*index2 + CGeneral::GetRandomNumberInRange(0, 2)];
|
2020-04-09 01:52:38 +02:00
|
|
|
index2++;
|
|
|
|
if(index2 == 6)
|
|
|
|
index2 = 0;
|
|
|
|
sprintf(splashName, "loadsc%d", index);
|
|
|
|
return splashName;
|
2019-05-15 16:52:37 +02:00
|
|
|
}
|
|
|
|
|
2020-05-12 01:24:57 +02:00
|
|
|
Const char*
|
2020-04-09 01:52:38 +02:00
|
|
|
GetLevelSplashScreen(int level)
|
2019-05-24 19:58:32 +02:00
|
|
|
{
|
2020-05-12 01:24:57 +02:00
|
|
|
static Const char *splashScreens[4] = {
|
2020-04-09 01:52:38 +02:00
|
|
|
nil,
|
|
|
|
"splash1",
|
|
|
|
"splash2",
|
|
|
|
"splash3",
|
|
|
|
};
|
|
|
|
|
|
|
|
return splashScreens[level];
|
2019-05-24 19:58:32 +02:00
|
|
|
}
|
|
|
|
|
2019-05-30 21:24:47 +02:00
|
|
|
void
|
2020-04-09 01:52:38 +02:00
|
|
|
ResetLoadingScreenBar()
|
2019-05-15 16:52:37 +02:00
|
|
|
{
|
2020-04-09 01:52:38 +02:00
|
|
|
NumberOfChunksLoaded = 0.0f;
|
2019-05-15 16:52:37 +02:00
|
|
|
}
|
|
|
|
|
2020-05-17 19:45:21 +02:00
|
|
|
//--MIAMI: done
|
2019-05-30 21:24:47 +02:00
|
|
|
void
|
2020-04-09 01:52:38 +02:00
|
|
|
LoadingScreen(const char *str1, const char *str2, const char *splashscreen)
|
2019-05-15 16:52:37 +02:00
|
|
|
{
|
2020-04-09 01:52:38 +02:00
|
|
|
CSprite2d *splash;
|
2019-05-30 21:24:47 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
#ifndef RANDOMSPLASH
|
2020-05-17 19:45:21 +02:00
|
|
|
splashscreen = "LOADSC0";
|
2020-04-09 01:52:38 +02:00
|
|
|
#endif
|
2019-05-30 21:24:47 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
splash = LoadSplash(splashscreen);
|
2019-05-30 21:24:47 +02:00
|
|
|
|
2020-04-09 05:20:44 +02:00
|
|
|
#ifndef GTA_PS2
|
2020-04-09 01:52:38 +02:00
|
|
|
if(RsGlobal.quit)
|
|
|
|
return;
|
2020-04-09 05:20:44 +02:00
|
|
|
#endif
|
2019-05-30 21:24:47 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
if(DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255)){
|
|
|
|
CSprite2d::SetRecipNearClip();
|
|
|
|
CSprite2d::InitPerFrame();
|
|
|
|
CFont::InitPerFrame();
|
|
|
|
DefinedState();
|
|
|
|
RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSCLAMP);
|
|
|
|
splash->Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, 255));
|
2019-05-30 21:24:47 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
if(str1){
|
|
|
|
NumberOfChunksLoaded += 1;
|
2019-05-30 21:24:47 +02:00
|
|
|
|
2020-05-17 19:45:21 +02:00
|
|
|
#ifndef RANDOMSPLASH
|
2020-04-09 01:52:38 +02:00
|
|
|
float hpos = SCREEN_SCALE_X(40);
|
2020-05-17 19:45:21 +02:00
|
|
|
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));
|
2019-05-15 16:52:37 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
length *= NumberOfChunksLoaded/TOTALNUMCHUNKS;
|
2020-05-17 19:45:21 +02:00
|
|
|
CSprite2d::DrawRect(CRect(hpos, top, hpos+length, bottom), CRGBA(255, 150, 225, 255));
|
2019-05-31 11:44:43 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
// this is done by the game but is unused
|
2020-05-17 19:45:21 +02:00
|
|
|
CFont::SetBackgroundOff();
|
2020-04-09 01:52:38 +02:00
|
|
|
CFont::SetScale(SCREEN_SCALE_X(2), SCREEN_SCALE_Y(2));
|
|
|
|
CFont::SetPropOn();
|
|
|
|
CFont::SetRightJustifyOn();
|
2020-05-17 19:45:21 +02:00
|
|
|
CFont::SetDropShadowPosition(1);
|
|
|
|
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
|
2020-04-09 01:52:38 +02:00
|
|
|
CFont::SetFontStyle(FONT_HEADING);
|
2019-05-15 16:52:37 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
#ifdef CHATTYSPLASH
|
|
|
|
// my attempt
|
|
|
|
static wchar tmpstr[80];
|
|
|
|
float yscale = SCREEN_SCALE_Y(0.9f);
|
2020-05-17 19:45:21 +02:00
|
|
|
top -= 45*yscale;
|
2020-04-09 01:52:38 +02:00
|
|
|
CFont::SetScale(SCREEN_SCALE_X(0.75f), yscale);
|
|
|
|
CFont::SetPropOn();
|
|
|
|
CFont::SetRightJustifyOff();
|
2020-06-07 03:10:06 +02:00
|
|
|
CFont::SetFontStyle(FONT_STANDARD);
|
2020-04-09 01:52:38 +02:00
|
|
|
CFont::SetColor(CRGBA(255, 255, 255, 255));
|
|
|
|
AsciiToUnicode(str1, tmpstr);
|
2020-05-17 19:45:21 +02:00
|
|
|
CFont::PrintString(hpos, top, tmpstr);
|
|
|
|
top += 22*yscale;
|
2020-04-09 01:52:38 +02:00
|
|
|
AsciiToUnicode(str2, tmpstr);
|
2020-05-17 19:45:21 +02:00
|
|
|
CFont::PrintString(hpos, top, tmpstr);
|
2020-04-09 01:52:38 +02:00
|
|
|
#endif
|
|
|
|
}
|
2019-05-15 16:52:37 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
CFont::DrawFonts();
|
|
|
|
DoRWStuffEndOfFrame();
|
|
|
|
}
|
|
|
|
}
|
2019-05-15 16:52:37 +02:00
|
|
|
|
2019-05-30 21:24:47 +02:00
|
|
|
void
|
2020-04-09 01:52:38 +02:00
|
|
|
LoadingIslandScreen(const char *levelName)
|
2019-05-30 21:24:47 +02:00
|
|
|
{
|
2020-04-09 01:52:38 +02:00
|
|
|
CSprite2d *splash;
|
|
|
|
wchar *name;
|
|
|
|
char str[100];
|
|
|
|
wchar wstr[80];
|
|
|
|
CRGBA col;
|
|
|
|
|
|
|
|
splash = LoadSplash(nil);
|
|
|
|
name = TheText.Get(levelName);
|
|
|
|
if(!DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255))
|
2019-05-30 21:24:47 +02:00
|
|
|
return;
|
2019-05-15 16:52:37 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
CSprite2d::SetRecipNearClip();
|
|
|
|
CSprite2d::InitPerFrame();
|
|
|
|
CFont::InitPerFrame();
|
|
|
|
DefinedState();
|
|
|
|
col = CRGBA(255, 255, 255, 255);
|
|
|
|
splash->Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), col, col, col, col);
|
|
|
|
CFont::SetBackgroundOff();
|
|
|
|
CFont::SetScale(1.5f, 1.5f);
|
|
|
|
CFont::SetPropOn();
|
|
|
|
CFont::SetRightJustifyOn();
|
|
|
|
CFont::SetRightJustifyWrap(150.0f);
|
|
|
|
CFont::SetFontStyle(FONT_HEADING);
|
|
|
|
sprintf(str, "WELCOME TO");
|
|
|
|
AsciiToUnicode(str, wstr);
|
|
|
|
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
|
|
|
|
CFont::SetDropShadowPosition(3);
|
|
|
|
CFont::SetColor(CRGBA(243, 237, 71, 255));
|
|
|
|
CFont::SetScale(SCREEN_STRETCH_X(1.2f), SCREEN_STRETCH_Y(1.2f));
|
|
|
|
CFont::PrintString(SCREEN_WIDTH - 20, SCREEN_STRETCH_FROM_BOTTOM(110.0f), TheText.Get("WELCOME"));
|
|
|
|
TextCopy(wstr, name);
|
|
|
|
TheText.UpperCase(wstr);
|
|
|
|
CFont::SetColor(CRGBA(243, 237, 71, 255));
|
|
|
|
CFont::SetScale(SCREEN_STRETCH_X(1.2f), SCREEN_STRETCH_Y(1.2f));
|
|
|
|
CFont::PrintString(SCREEN_WIDTH-20, SCREEN_STRETCH_FROM_BOTTOM(80.0f), wstr);
|
|
|
|
CFont::DrawFonts();
|
|
|
|
DoRWStuffEndOfFrame();
|
|
|
|
}
|
2019-05-15 16:52:37 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
void
|
|
|
|
ProcessSlowMode(void)
|
|
|
|
{
|
|
|
|
int16 lX = CPad::GetPad(0)->NewState.LeftStickX;
|
|
|
|
int16 lY = CPad::GetPad(0)->NewState.LeftStickY;
|
|
|
|
int16 rX = CPad::GetPad(0)->NewState.RightStickX;
|
|
|
|
int16 rY = CPad::GetPad(0)->NewState.RightStickY;
|
|
|
|
int16 L1 = CPad::GetPad(0)->NewState.LeftShoulder1;
|
|
|
|
int16 L2 = CPad::GetPad(0)->NewState.LeftShoulder2;
|
|
|
|
int16 R1 = CPad::GetPad(0)->NewState.RightShoulder1;
|
|
|
|
int16 R2 = CPad::GetPad(0)->NewState.RightShoulder2;
|
|
|
|
int16 up = CPad::GetPad(0)->NewState.DPadUp;
|
|
|
|
int16 down = CPad::GetPad(0)->NewState.DPadDown;
|
|
|
|
int16 left = CPad::GetPad(0)->NewState.DPadLeft;
|
|
|
|
int16 right = CPad::GetPad(0)->NewState.DPadRight;
|
|
|
|
int16 start = CPad::GetPad(0)->NewState.Start;
|
|
|
|
int16 select = CPad::GetPad(0)->NewState.Select;
|
|
|
|
int16 square = CPad::GetPad(0)->NewState.Square;
|
|
|
|
int16 triangle = CPad::GetPad(0)->NewState.Triangle;
|
|
|
|
int16 cross = CPad::GetPad(0)->NewState.Cross;
|
|
|
|
int16 circle = CPad::GetPad(0)->NewState.Circle;
|
|
|
|
int16 L3 = CPad::GetPad(0)->NewState.LeftShock;
|
|
|
|
int16 R3 = CPad::GetPad(0)->NewState.RightShock;
|
|
|
|
int16 networktalk = CPad::GetPad(0)->NewState.NetworkTalk;
|
|
|
|
int16 stop = true;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
if ( CPad::GetPad(1)->GetLeftShoulder1JustDown() || CPad::GetPad(1)->GetRightShoulder1() )
|
|
|
|
break;
|
|
|
|
|
|
|
|
if ( stop )
|
|
|
|
{
|
|
|
|
CTimer::Stop();
|
|
|
|
stop = false;
|
2019-05-30 21:24:47 +02:00
|
|
|
}
|
2020-04-09 01:52:38 +02:00
|
|
|
|
|
|
|
CPad::UpdatePads();
|
|
|
|
|
|
|
|
RwCameraBeginUpdate(Scene.camera);
|
|
|
|
RwCameraEndUpdate(Scene.camera);
|
|
|
|
|
|
|
|
if ( CPad::GetPad(1)->GetLeftShoulder1JustDown() || CPad::GetPad(1)->GetRightShoulder1() )
|
|
|
|
break;
|
|
|
|
|
|
|
|
} while (!CPad::GetPad(1)->GetRightShoulder1());
|
|
|
|
|
|
|
|
|
|
|
|
CPad::GetPad(0)->OldState.LeftStickX = lX;
|
|
|
|
CPad::GetPad(0)->OldState.LeftStickY = lY;
|
|
|
|
CPad::GetPad(0)->OldState.RightStickX = rX;
|
|
|
|
CPad::GetPad(0)->OldState.RightStickY = rY;
|
|
|
|
CPad::GetPad(0)->OldState.LeftShoulder1 = L1;
|
|
|
|
CPad::GetPad(0)->OldState.LeftShoulder2 = L2;
|
|
|
|
CPad::GetPad(0)->OldState.RightShoulder1 = R1;
|
|
|
|
CPad::GetPad(0)->OldState.RightShoulder2 = R2;
|
|
|
|
CPad::GetPad(0)->OldState.DPadUp = up;
|
|
|
|
CPad::GetPad(0)->OldState.DPadDown = down;
|
|
|
|
CPad::GetPad(0)->OldState.DPadLeft = left;
|
|
|
|
CPad::GetPad(0)->OldState.DPadRight = right;
|
|
|
|
CPad::GetPad(0)->OldState.Start = start;
|
|
|
|
CPad::GetPad(0)->OldState.Select = select;
|
|
|
|
CPad::GetPad(0)->OldState.Square = square;
|
|
|
|
CPad::GetPad(0)->OldState.Triangle = triangle;
|
|
|
|
CPad::GetPad(0)->OldState.Cross = cross;
|
|
|
|
CPad::GetPad(0)->OldState.Circle = circle;
|
|
|
|
CPad::GetPad(0)->OldState.LeftShock = L3;
|
|
|
|
CPad::GetPad(0)->OldState.RightShock = R3;
|
|
|
|
CPad::GetPad(0)->OldState.NetworkTalk = networktalk;
|
|
|
|
CPad::GetPad(0)->NewState.LeftStickX = lX;
|
|
|
|
CPad::GetPad(0)->NewState.LeftStickY = lY;
|
|
|
|
CPad::GetPad(0)->NewState.RightStickX = rX;
|
|
|
|
CPad::GetPad(0)->NewState.RightStickY = rY;
|
|
|
|
CPad::GetPad(0)->NewState.LeftShoulder1 = L1;
|
|
|
|
CPad::GetPad(0)->NewState.LeftShoulder2 = L2;
|
|
|
|
CPad::GetPad(0)->NewState.RightShoulder1 = R1;
|
|
|
|
CPad::GetPad(0)->NewState.RightShoulder2 = R2;
|
|
|
|
CPad::GetPad(0)->NewState.DPadUp = up;
|
|
|
|
CPad::GetPad(0)->NewState.DPadDown = down;
|
|
|
|
CPad::GetPad(0)->NewState.DPadLeft = left;
|
|
|
|
CPad::GetPad(0)->NewState.DPadRight = right;
|
|
|
|
CPad::GetPad(0)->NewState.Start = start;
|
|
|
|
CPad::GetPad(0)->NewState.Select = select;
|
|
|
|
CPad::GetPad(0)->NewState.Square = square;
|
|
|
|
CPad::GetPad(0)->NewState.Triangle = triangle;
|
|
|
|
CPad::GetPad(0)->NewState.Cross = cross;
|
|
|
|
CPad::GetPad(0)->NewState.Circle = circle;
|
|
|
|
CPad::GetPad(0)->NewState.LeftShock = L3;
|
|
|
|
CPad::GetPad(0)->NewState.RightShock = R3;
|
|
|
|
CPad::GetPad(0)->NewState.NetworkTalk = networktalk;
|
|
|
|
}
|
2019-05-15 16:52:37 +02:00
|
|
|
|
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
float FramesPerSecondCounter;
|
|
|
|
int32 FrameSamples;
|
2019-05-30 21:24:47 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
struct tZonePrint
|
|
|
|
{
|
|
|
|
char name[12];
|
|
|
|
CRect rect;
|
|
|
|
};
|
2019-07-24 18:55:43 +02:00
|
|
|
|
|
|
|
tZonePrint ZonePrint[] =
|
|
|
|
{
|
|
|
|
{ "suburban", CRect(-1639.4f, 1014.3f, -226.23f, -1347.9f) },
|
|
|
|
{ "comntop", CRect(-223.52f, 203.62f, 616.79f, -413.6f) },
|
|
|
|
{ "comnbtm", CRect(-227.24f, -413.6f, 620.51f, -911.84f) },
|
|
|
|
{ "comse", CRect( 200.35f, -911.84f, 620.51f, -1737.3f) },
|
|
|
|
{ "comsw", CRect(-223.52f, -911.84f, 200.35f, -1737.3f) },
|
|
|
|
{ "industsw", CRect( 744.05f, -473.0f, 1067.5f, -1331.5f) },
|
|
|
|
{ "industne", CRect( 1067.5f, 282.19f, 1915.3f, -473.0f) },
|
|
|
|
{ "industnw", CRect( 744.05f, 324.95f, 1067.5f, -473.0f) },
|
|
|
|
{ "industse", CRect( 1070.3f, -473.0f, 1918.1f, -1331.5f) },
|
|
|
|
{ "no zone", CRect( 0.0f, 0.0f, 0.0f, 0.0f) }
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifndef MASTER
|
|
|
|
void
|
|
|
|
DisplayGameDebugText()
|
|
|
|
{
|
|
|
|
static bool bDisplayPosn = false;
|
2019-07-24 19:30:09 +02:00
|
|
|
static bool bDisplayRate = false;
|
2020-05-21 16:28:03 +02:00
|
|
|
static bool bDisplayCheatStr = false;
|
2019-07-24 18:55:43 +02:00
|
|
|
|
|
|
|
{
|
|
|
|
SETTWEAKPATH("GameDebugText");
|
|
|
|
TWEAKBOOL(bDisplayPosn);
|
|
|
|
TWEAKBOOL(bDisplayRate);
|
2020-05-21 16:28:03 +02:00
|
|
|
TWEAKBOOL(bDisplayCheatStr);
|
2019-07-24 18:55:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char str[200];
|
|
|
|
wchar ustr[200];
|
|
|
|
wchar ver[200];
|
|
|
|
|
|
|
|
AsciiToUnicode(version_name, ver);
|
|
|
|
|
|
|
|
CFont::SetPropOn();
|
|
|
|
CFont::SetBackgroundOff();
|
2020-06-07 03:10:06 +02:00
|
|
|
CFont::SetFontStyle(FONT_STANDARD);
|
2020-04-15 18:19:45 +02:00
|
|
|
CFont::SetScale(SCREEN_SCALE_X(0.5f), SCREEN_SCALE_Y(0.5f));
|
2019-07-24 18:55:43 +02:00
|
|
|
CFont::SetCentreOff();
|
|
|
|
CFont::SetRightJustifyOff();
|
|
|
|
CFont::SetWrapx(SCREEN_WIDTH);
|
|
|
|
CFont::SetJustifyOff();
|
|
|
|
CFont::SetBackGroundOnlyTextOff();
|
|
|
|
CFont::SetColor(CRGBA(255, 108, 0, 255));
|
2020-04-15 18:19:45 +02:00
|
|
|
CFont::PrintString(SCREEN_SCALE_X(10.0f), SCREEN_SCALE_Y(10.0f), ver);
|
2019-07-24 18:55:43 +02:00
|
|
|
|
|
|
|
FrameSamples++;
|
|
|
|
FramesPerSecondCounter += 1000.0f / (CTimer::GetTimeStepNonClippedInSeconds() * 1000.0f);
|
|
|
|
FramesPerSecond = FramesPerSecondCounter / FrameSamples;
|
|
|
|
|
|
|
|
if ( FrameSamples > 30 )
|
|
|
|
{
|
|
|
|
FramesPerSecondCounter = 0.0f;
|
|
|
|
FrameSamples = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !TheCamera.WorldViewerBeingUsed
|
|
|
|
&& CPad::GetPad(1)->GetSquare()
|
|
|
|
&& CPad::GetPad(1)->GetTriangle()
|
|
|
|
&& CPad::GetPad(1)->GetLeftShoulder2JustDown() )
|
|
|
|
{
|
|
|
|
bDisplayPosn = !bDisplayPosn;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( CPad::GetPad(1)->GetSquare()
|
|
|
|
&& CPad::GetPad(1)->GetTriangle()
|
|
|
|
&& CPad::GetPad(1)->GetRightShoulder2JustDown() )
|
|
|
|
{
|
|
|
|
bDisplayRate = !bDisplayRate;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( bDisplayPosn || bDisplayRate )
|
|
|
|
{
|
|
|
|
CVector pos = FindPlayerCoors();
|
|
|
|
int32 ZoneId = ARRAY_SIZE(ZonePrint)-1; // no zone
|
|
|
|
|
|
|
|
for ( int32 i = 0; i < ARRAY_SIZE(ZonePrint)-1; i++ )
|
|
|
|
{
|
|
|
|
if ( pos.x > ZonePrint[i].rect.left
|
|
|
|
&& pos.x < ZonePrint[i].rect.right
|
|
|
|
&& pos.y > ZonePrint[i].rect.bottom
|
|
|
|
&& pos.y < ZonePrint[i].rect.top )
|
|
|
|
{
|
|
|
|
ZoneId = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//NOTE: fps should be 30, but its 29 due to different fp2int conversion
|
|
|
|
if ( bDisplayRate )
|
|
|
|
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);
|
|
|
|
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);
|
|
|
|
|
2020-04-15 18:19:45 +02:00
|
|
|
// Let's not scale those numbers, they look better that way :eyes:
|
2019-07-24 18:55:43 +02:00
|
|
|
CFont::SetPropOff();
|
|
|
|
CFont::SetBackgroundOff();
|
|
|
|
CFont::SetScale(0.7f, 1.5f);
|
|
|
|
CFont::SetCentreOff();
|
|
|
|
CFont::SetRightJustifyOff();
|
|
|
|
CFont::SetJustifyOff();
|
|
|
|
CFont::SetBackGroundOnlyTextOff();
|
|
|
|
CFont::SetWrapx(640.0f);
|
|
|
|
CFont::SetFontStyle(FONT_HEADING);
|
|
|
|
|
|
|
|
CFont::SetColor(CRGBA(0, 0, 0, 255));
|
|
|
|
CFont::PrintString(42.0f, 42.0f, ustr);
|
|
|
|
|
|
|
|
CFont::SetColor(CRGBA(255, 108, 0, 255));
|
|
|
|
CFont::PrintString(40.0f, 40.0f, ustr);
|
|
|
|
}
|
2020-05-21 16:28:03 +02:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
2019-07-24 18:55:43 +02:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-05-30 21:24:47 +02:00
|
|
|
void
|
2020-04-09 01:52:38 +02:00
|
|
|
RenderScene(void)
|
2019-05-30 21:24:47 +02:00
|
|
|
{
|
2020-04-09 01:52:38 +02:00
|
|
|
CClouds::Render();
|
|
|
|
DoRWRenderHorizon();
|
|
|
|
CRenderer::RenderRoads();
|
|
|
|
CCoronas::RenderReflections();
|
|
|
|
CRenderer::RenderEverythingBarRoads();
|
2020-05-11 17:03:32 +02:00
|
|
|
RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE);
|
2020-04-09 01:52:38 +02:00
|
|
|
CWaterLevel::RenderWater();
|
2020-05-11 17:03:32 +02:00
|
|
|
CRenderer::RenderBoats();
|
|
|
|
CRenderer::RenderFadingInUnderwaterEntities();
|
|
|
|
RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE);
|
2020-05-27 20:50:01 +02:00
|
|
|
CWaterLevel::RenderTransparentWater();
|
2020-04-09 01:52:38 +02:00
|
|
|
CRenderer::RenderFadingInEntities();
|
2020-05-11 17:03:32 +02:00
|
|
|
RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE);
|
2020-04-09 01:52:38 +02:00
|
|
|
CWeather::RenderRainStreaks();
|
2020-05-11 17:03:32 +02:00
|
|
|
// CCoronas::RenderSunReflection
|
2020-04-09 01:52:38 +02:00
|
|
|
}
|
2019-07-24 18:55:43 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
void
|
|
|
|
RenderDebugShit(void)
|
|
|
|
{
|
|
|
|
CTheScripts::RenderTheScriptDebugLines();
|
2020-04-10 18:36:39 +02:00
|
|
|
#ifndef FINAL
|
2020-04-09 01:52:38 +02:00
|
|
|
if(gbShowCollisionLines)
|
|
|
|
CRenderer::RenderCollisionLines();
|
2020-04-10 18:36:39 +02:00
|
|
|
ThePaths.DisplayPathData();
|
2020-04-23 22:25:18 +02:00
|
|
|
CDebug::DrawLines();
|
2020-04-25 00:40:14 +02:00
|
|
|
DefinedState();
|
2020-04-10 18:36:39 +02:00
|
|
|
#endif
|
2019-05-15 16:52:37 +02:00
|
|
|
}
|
2019-05-30 21:24:47 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
void
|
|
|
|
RenderEffects(void)
|
|
|
|
{
|
|
|
|
CGlass::Render();
|
|
|
|
CWaterCannons::Render();
|
|
|
|
CSpecialFX::Render();
|
|
|
|
CShadows::RenderStaticShadows();
|
|
|
|
CShadows::RenderStoredShadows();
|
|
|
|
CSkidmarks::Render();
|
|
|
|
CAntennas::Render();
|
|
|
|
CRubbish::Render();
|
|
|
|
CCoronas::Render();
|
|
|
|
CParticle::Render();
|
|
|
|
CPacManPickups::Render();
|
|
|
|
CWeaponEffects::Render();
|
|
|
|
CPointLights::RenderFogEffect();
|
|
|
|
CMovingThings::Render();
|
|
|
|
CRenderer::RenderFirstPersonVehicle();
|
|
|
|
}
|
2019-06-01 23:17:39 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
void
|
|
|
|
Render2dStuff(void)
|
2019-06-01 23:17:39 +02:00
|
|
|
{
|
2020-04-09 01:52:38 +02:00
|
|
|
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
|
|
|
|
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
|
|
|
|
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
|
|
|
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
|
|
|
|
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
|
|
|
|
RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE);
|
2019-06-01 23:17:39 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
CReplay::Display();
|
|
|
|
CPickups::RenderPickUpText();
|
2019-06-01 23:17:39 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
if(TheCamera.m_WideScreenOn)
|
|
|
|
TheCamera.DrawBordersForWideScreen();
|
2019-06-01 23:17:39 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
CPed *player = FindPlayerPed();
|
|
|
|
int weaponType = 0;
|
|
|
|
if(player)
|
|
|
|
weaponType = player->GetWeapon()->m_eWeaponType;
|
|
|
|
|
|
|
|
bool firstPersonWeapon = false;
|
|
|
|
int cammode = TheCamera.Cams[TheCamera.ActiveCam].Mode;
|
|
|
|
if(cammode == CCam::MODE_SNIPER ||
|
|
|
|
cammode == CCam::MODE_SNIPER_RUNABOUT ||
|
|
|
|
cammode == CCam::MODE_ROCKETLAUNCHER ||
|
|
|
|
cammode == CCam::MODE_ROCKETLAUNCHER_RUNABOUT)
|
|
|
|
firstPersonWeapon = true;
|
|
|
|
|
|
|
|
// Draw black border for sniper and rocket launcher
|
|
|
|
if((weaponType == WEAPONTYPE_SNIPERRIFLE || weaponType == WEAPONTYPE_ROCKETLAUNCHER) && firstPersonWeapon){
|
|
|
|
CRGBA black(0, 0, 0, 255);
|
|
|
|
|
|
|
|
// top and bottom strips
|
|
|
|
if (weaponType == WEAPONTYPE_ROCKETLAUNCHER) {
|
|
|
|
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(180)), black);
|
|
|
|
CSprite2d::DrawRect(CRect(0.0f, SCREEN_HEIGHT / 2 + SCREEN_SCALE_Y(170), SCREEN_WIDTH, SCREEN_HEIGHT), black);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(210)), black);
|
|
|
|
CSprite2d::DrawRect(CRect(0.0f, SCREEN_HEIGHT / 2 + SCREEN_SCALE_Y(210), SCREEN_WIDTH, SCREEN_HEIGHT), black);
|
|
|
|
}
|
|
|
|
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH / 2 - SCREEN_SCALE_X(210), SCREEN_HEIGHT), black);
|
|
|
|
CSprite2d::DrawRect(CRect(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(210), 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), black);
|
2019-06-01 23:17:39 +02:00
|
|
|
}
|
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
MusicManager.DisplayRadioStationName();
|
|
|
|
TheConsole.Display();
|
|
|
|
if(CSceneEdit::m_bEditOn)
|
|
|
|
CSceneEdit::Draw();
|
|
|
|
else
|
|
|
|
CHud::Draw();
|
|
|
|
CUserDisplay::OnscnTimer.ProcessForDisplay();
|
|
|
|
CMessages::Display();
|
|
|
|
CDarkel::DrawMessages();
|
|
|
|
CGarages::PrintMessages();
|
|
|
|
CPad::PrintErrorMessage();
|
|
|
|
CFont::DrawFonts();
|
|
|
|
|
2020-05-09 15:06:13 +02:00
|
|
|
#ifdef DEBUGMENU
|
2020-04-09 01:52:38 +02:00
|
|
|
DebugMenuRender();
|
2020-05-09 15:06:13 +02:00
|
|
|
#endif
|
2019-06-01 23:17:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2020-04-09 01:52:38 +02:00
|
|
|
RenderMenus(void)
|
2019-06-01 23:17:39 +02:00
|
|
|
{
|
2020-06-27 23:01:51 +02:00
|
|
|
if (FrontEndMenuManager.m_bMenuActive)
|
2020-04-09 01:52:38 +02:00
|
|
|
{
|
2020-06-27 23:01:51 +02:00
|
|
|
#ifdef PS2
|
2020-04-09 01:52:38 +02:00
|
|
|
gMainHeap.PushMemId(_TODOCONST(17));
|
2020-06-27 23:01:51 +02:00
|
|
|
#endif
|
2020-04-09 01:52:38 +02:00
|
|
|
FrontEndMenuManager.DrawFrontEnd();
|
2020-06-27 23:01:51 +02:00
|
|
|
#ifdef PS2
|
2020-04-09 01:52:38 +02:00
|
|
|
gMainHeap.PopMemId();
|
|
|
|
#endif
|
2020-06-27 23:01:51 +02:00
|
|
|
}
|
2019-06-01 23:17:39 +02:00
|
|
|
}
|
|
|
|
|
2020-03-22 15:23:40 +01:00
|
|
|
void
|
2020-04-09 01:52:38 +02:00
|
|
|
Render2dStuffAfterFade(void)
|
2020-03-22 15:23:40 +01:00
|
|
|
{
|
2020-04-09 01:52:38 +02:00
|
|
|
#ifndef MASTER
|
|
|
|
DisplayGameDebugText();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
CHud::DrawAfterFade();
|
|
|
|
CFont::DrawFonts();
|
2020-05-24 01:59:30 +02:00
|
|
|
CCredits::Render();
|
2020-03-22 15:23:40 +01:00
|
|
|
}
|
|
|
|
|
2019-06-01 23:17:39 +02:00
|
|
|
void
|
2020-04-09 01:52:38 +02:00
|
|
|
Idle(void *arg)
|
2019-06-01 23:17:39 +02:00
|
|
|
{
|
2020-04-09 01:52:38 +02:00
|
|
|
CTimer::Update();
|
2019-06-01 23:17:39 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
#ifdef TIMEBARS
|
|
|
|
tbInit();
|
|
|
|
#endif
|
2019-06-01 23:17:39 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
CSprite2d::InitPerFrame();
|
|
|
|
CFont::InitPerFrame();
|
|
|
|
|
|
|
|
CPointLights::InitPerFrame();
|
|
|
|
#ifdef TIMEBARS
|
|
|
|
tbStartTimer(0, "CGame::Process");
|
|
|
|
#endif
|
|
|
|
CGame::Process();
|
|
|
|
#ifdef TIMEBARS
|
|
|
|
tbEndTimer("CGame::Process");
|
|
|
|
tbStartTimer(0, "DMAudio.Service");
|
|
|
|
#endif
|
2019-06-01 23:17:39 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
DMAudio.Service();
|
2019-06-01 23:17:39 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
#ifdef TIMEBARS
|
|
|
|
tbEndTimer("DMAudio.Service");
|
2019-06-01 23:17:39 +02:00
|
|
|
#endif
|
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
if(CGame::bDemoMode && CTimer::GetTimeInMilliseconds() > (3*60 + 30)*1000 && !CCutsceneMgr::IsCutsceneProcessing()){
|
2020-06-27 23:01:51 +02:00
|
|
|
#ifdef PS2_MENU
|
|
|
|
TheMemoryCard.m_bWantToLoad = false;
|
|
|
|
FrontEndMenuManager.m_bWantToRestart = true;
|
|
|
|
#else
|
2020-04-09 01:52:38 +02:00
|
|
|
FrontEndMenuManager.m_bWantToRestart = true;
|
|
|
|
FrontEndMenuManager.m_bWantToLoad = false;
|
2020-06-27 23:01:51 +02:00
|
|
|
#endif
|
2020-04-09 01:52:38 +02:00
|
|
|
return;
|
2019-06-01 23:17:39 +02:00
|
|
|
}
|
|
|
|
|
2020-06-27 23:01:51 +02:00
|
|
|
#ifdef PS2_MENU
|
|
|
|
if ( FrontEndMenuManager.m_bWantToRestart || TheMemoryCard.b_FoundRecentSavedGameWantToLoad )
|
|
|
|
#else
|
2020-04-09 01:52:38 +02:00
|
|
|
if(FrontEndMenuManager.m_bWantToRestart || b_FoundRecentSavedGameWantToLoad)
|
2020-06-27 23:01:51 +02:00
|
|
|
#endif
|
|
|
|
{
|
2019-06-28 22:23:55 +02:00
|
|
|
return;
|
2020-06-27 23:01:51 +02:00
|
|
|
}
|
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
SetLightsWithTimeOfDayColour(Scene.world);
|
2019-06-28 19:23:28 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
if(arg == nil)
|
|
|
|
return;
|
2019-06-28 19:23:28 +02:00
|
|
|
|
2020-05-22 01:44:01 +02:00
|
|
|
// m_bRenderGameInMenu is there in III PS2 but I don't know about VC PS2.
|
|
|
|
if((!FrontEndMenuManager.m_bMenuActive/* || FrontEndMenuManager.m_bRenderGameInMenu*/) &&
|
2020-04-09 01:52:38 +02:00
|
|
|
TheCamera.GetScreenFadeStatus() != FADE_2)
|
|
|
|
{
|
|
|
|
#ifdef GTA_PC
|
|
|
|
// 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");
|
2020-05-27 20:50:01 +02:00
|
|
|
#endif
|
|
|
|
#ifdef PC_WATER
|
|
|
|
CWaterLevel::PreCalcWaterGeometry();
|
2020-04-09 01:52:38 +02:00
|
|
|
#endif
|
|
|
|
CRenderer::ConstructRenderList();
|
|
|
|
#ifdef TIMEBARS
|
|
|
|
tbEndTimer("CnstrRenderList");
|
|
|
|
tbStartTimer(0, "PreRender");
|
|
|
|
#endif
|
|
|
|
CRenderer::PreRender();
|
|
|
|
#ifdef TIMEBARS
|
|
|
|
tbEndTimer("PreRender");
|
|
|
|
#endif
|
2019-06-28 19:23:28 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
if(CWeather::LightningFlash && !CCullZones::CamNoRain()){
|
|
|
|
if(!DoRWStuffStartOfFrame_Horizon(255, 255, 255, 255, 255, 255, 255))
|
|
|
|
return;
|
|
|
|
}else{
|
|
|
|
if(!DoRWStuffStartOfFrame_Horizon(CTimeCycle::GetSkyTopRed(), CTimeCycle::GetSkyTopGreen(), CTimeCycle::GetSkyTopBlue(),
|
|
|
|
CTimeCycle::GetSkyBottomRed(), CTimeCycle::GetSkyBottomGreen(), CTimeCycle::GetSkyBottomBlue(),
|
|
|
|
255))
|
|
|
|
return;
|
|
|
|
}
|
2019-06-18 09:50:26 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
DefinedState();
|
2019-06-18 09:50:26 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
// BUG. This has to be done BEFORE RwCameraBeginUpdate
|
|
|
|
RwCameraSetFarClipPlane(Scene.camera, CTimeCycle::GetFarClip());
|
|
|
|
RwCameraSetFogDistance(Scene.camera, CTimeCycle::GetFogStart());
|
2019-05-31 19:02:26 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
#ifdef TIMEBARS
|
|
|
|
tbStartTimer(0, "RenderScene");
|
|
|
|
#endif
|
|
|
|
RenderScene();
|
|
|
|
#ifdef TIMEBARS
|
|
|
|
tbEndTimer("RenderScene");
|
|
|
|
#endif
|
|
|
|
RenderDebugShit();
|
|
|
|
RenderEffects();
|
2019-05-31 19:02:26 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
#ifdef TIMEBARS
|
|
|
|
tbStartTimer(0, "RenderMotionBlur");
|
|
|
|
#endif
|
2020-06-27 23:01:51 +02:00
|
|
|
if((TheCamera.m_BlurType == MOTION_BLUR_NONE || TheCamera.m_BlurType == MOTION_BLUR_LIGHT_SCENE) &&
|
2020-04-09 01:52:38 +02:00
|
|
|
TheCamera.m_ScreenReductionPercentage > 0.0f)
|
|
|
|
TheCamera.SetMotionBlurAlpha(150);
|
|
|
|
TheCamera.RenderMotionBlur();
|
|
|
|
#ifdef TIMEBARS
|
|
|
|
tbEndTimer("RenderMotionBlur");
|
|
|
|
tbStartTimer(0, "Render2dStuff");
|
|
|
|
#endif
|
|
|
|
Render2dStuff();
|
|
|
|
#ifdef TIMEBARS
|
|
|
|
tbEndTimer("Render2dStuff");
|
|
|
|
#endif
|
|
|
|
}else{
|
2020-05-24 01:59:30 +02:00
|
|
|
CDraw::CalculateAspectRatio();
|
2020-04-09 01:52:38 +02:00
|
|
|
#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))
|
|
|
|
return;
|
2019-06-02 05:00:38 +02:00
|
|
|
}
|
2019-05-31 19:02:26 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
#ifdef TIMEBARS
|
|
|
|
tbStartTimer(0, "RenderMenus");
|
|
|
|
#endif
|
|
|
|
RenderMenus();
|
|
|
|
#ifdef TIMEBARS
|
|
|
|
tbEndTimer("RenderMenus");
|
|
|
|
tbStartTimer(0, "DoFade");
|
|
|
|
#endif
|
2020-06-27 23:01:51 +02:00
|
|
|
|
|
|
|
#ifdef PS2_MENU
|
|
|
|
if ( TheMemoryCard.m_bWantToLoad )
|
|
|
|
return;
|
|
|
|
#endif
|
2020-04-09 01:52:38 +02:00
|
|
|
DoFade();
|
|
|
|
#ifdef TIMEBARS
|
|
|
|
tbEndTimer("DoFade");
|
|
|
|
tbStartTimer(0, "Render2dStuff-Fade");
|
|
|
|
#endif
|
|
|
|
Render2dStuffAfterFade();
|
|
|
|
#ifdef TIMEBARS
|
|
|
|
tbEndTimer("Render2dStuff-Fade");
|
|
|
|
#endif
|
2020-05-24 01:59:30 +02:00
|
|
|
// CCredits::Render(); // They added it to function above and also forgot it here
|
2020-04-09 01:52:38 +02:00
|
|
|
|
2020-05-29 12:03:32 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
#ifdef TIMEBARS
|
2020-05-29 12:03:32 +02:00
|
|
|
if (gbShowTimebars)
|
2020-06-01 13:21:19 +02:00
|
|
|
tbDisplay();
|
2020-04-09 01:52:38 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
DoRWStuffEndOfFrame();
|
|
|
|
|
|
|
|
if(g_SlowMode)
|
|
|
|
ProcessSlowMode();
|
2019-05-31 19:02:26 +02:00
|
|
|
}
|
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
void
|
|
|
|
FrontendIdle(void)
|
2019-05-31 19:02:26 +02:00
|
|
|
{
|
2020-05-24 01:59:30 +02:00
|
|
|
CDraw::CalculateAspectRatio();
|
2020-04-09 01:52:38 +02:00
|
|
|
CTimer::Update();
|
|
|
|
CSprite2d::SetRecipNearClip(); // this should be on InitialiseRenderWare according to PS2 asm. seems like a bug fix
|
|
|
|
CSprite2d::InitPerFrame();
|
|
|
|
CFont::InitPerFrame();
|
|
|
|
CPad::UpdatePads();
|
|
|
|
FrontEndMenuManager.Process();
|
|
|
|
|
|
|
|
if(RsGlobal.quit)
|
|
|
|
return;
|
2019-05-31 19:02:26 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
|
|
|
|
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
|
|
|
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
|
|
|
|
if(!RsCameraBeginUpdate(Scene.camera))
|
|
|
|
return;
|
2019-05-31 19:02:26 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
DefinedState(); // seems redundant, but breaks resolution change.
|
|
|
|
RenderMenus();
|
|
|
|
DoFade();
|
|
|
|
Render2dStuffAfterFade();
|
2020-05-24 01:59:30 +02:00
|
|
|
CFont::DrawFonts();
|
2020-04-09 01:52:38 +02:00
|
|
|
DoRWStuffEndOfFrame();
|
|
|
|
}
|
2019-05-31 19:02:26 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
void
|
|
|
|
InitialiseGame(void)
|
2019-05-31 19:02:26 +02:00
|
|
|
{
|
2020-04-09 01:52:38 +02:00
|
|
|
LoadingScreen(nil, nil, "loadsc0");
|
2020-05-05 23:27:43 +02:00
|
|
|
CGame::Initialise("DATA\\GTA_VC.DAT");
|
2019-05-31 19:02:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
RsEventStatus
|
|
|
|
AppEventHandler(RsEvent event, void *param)
|
|
|
|
{
|
2019-06-02 05:00:38 +02:00
|
|
|
switch( event )
|
|
|
|
{
|
2020-05-23 11:34:22 +02:00
|
|
|
case rsINITIALIZE:
|
2019-06-02 05:00:38 +02:00
|
|
|
{
|
2019-05-31 19:02:26 +02:00
|
|
|
CGame::InitialiseOnceBeforeRW();
|
2020-05-23 11:34:22 +02:00
|
|
|
return RsInitialize() ? rsEVENTPROCESSED : rsEVENTERROR;
|
2019-06-02 05:00:38 +02:00
|
|
|
}
|
2019-05-31 19:02:26 +02:00
|
|
|
|
2019-06-02 05:00:38 +02:00
|
|
|
case rsCAMERASIZE:
|
|
|
|
{
|
2019-06-12 19:18:24 +02:00
|
|
|
|
2019-06-12 19:05:06 +02:00
|
|
|
CameraSize(Scene.camera, (RwRect *)param,
|
2020-04-09 01:52:38 +02:00
|
|
|
SCREEN_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
|
2019-06-02 05:00:38 +02:00
|
|
|
|
|
|
|
return rsEVENTPROCESSED;
|
|
|
|
}
|
2019-05-31 19:02:26 +02:00
|
|
|
|
2020-05-23 11:34:22 +02:00
|
|
|
case rsRWINITIALIZE:
|
2019-06-02 05:00:38 +02:00
|
|
|
{
|
|
|
|
return Initialise3D(param) ? rsEVENTPROCESSED : rsEVENTERROR;
|
|
|
|
}
|
2019-05-31 19:02:26 +02:00
|
|
|
|
2019-06-02 05:00:38 +02:00
|
|
|
case rsRWTERMINATE:
|
|
|
|
{
|
|
|
|
Terminate3D();
|
2019-05-31 19:02:26 +02:00
|
|
|
|
2019-06-02 05:00:38 +02:00
|
|
|
return rsEVENTPROCESSED;
|
|
|
|
}
|
2019-05-31 19:02:26 +02:00
|
|
|
|
2019-06-02 05:00:38 +02:00
|
|
|
case rsTERMINATE:
|
|
|
|
{
|
|
|
|
CGame::FinalShutdown();
|
2019-05-31 19:02:26 +02:00
|
|
|
|
2019-06-02 05:00:38 +02:00
|
|
|
return rsEVENTPROCESSED;
|
|
|
|
}
|
2019-05-31 19:02:26 +02:00
|
|
|
|
2019-06-02 05:00:38 +02:00
|
|
|
case rsPLUGINATTACH:
|
|
|
|
{
|
|
|
|
return PluginAttach() ? rsEVENTPROCESSED : rsEVENTERROR;
|
|
|
|
}
|
2019-05-31 19:02:26 +02:00
|
|
|
|
2019-06-02 05:00:38 +02:00
|
|
|
case rsINPUTDEVICEATTACH:
|
|
|
|
{
|
|
|
|
AttachInputDevices();
|
2019-05-31 19:02:26 +02:00
|
|
|
|
2019-06-02 05:00:38 +02:00
|
|
|
return rsEVENTPROCESSED;
|
|
|
|
}
|
2019-05-31 19:02:26 +02:00
|
|
|
|
2019-06-02 05:00:38 +02:00
|
|
|
case rsIDLE:
|
|
|
|
{
|
|
|
|
Idle(param);
|
2019-05-31 19:02:26 +02:00
|
|
|
|
2019-06-02 05:00:38 +02:00
|
|
|
return rsEVENTPROCESSED;
|
|
|
|
}
|
2019-05-31 19:02:26 +02:00
|
|
|
|
2019-06-02 05:00:38 +02:00
|
|
|
case rsFRONTENDIDLE:
|
|
|
|
{
|
|
|
|
FrontendIdle();
|
2019-05-31 19:02:26 +02:00
|
|
|
|
2019-06-02 05:00:38 +02:00
|
|
|
return rsEVENTPROCESSED;
|
|
|
|
}
|
2019-05-31 19:02:26 +02:00
|
|
|
|
2019-06-02 05:00:38 +02:00
|
|
|
case rsACTIVATE:
|
|
|
|
{
|
|
|
|
param ? DMAudio.ReacquireDigitalHandle() : DMAudio.ReleaseDigitalHandle();
|
2019-05-31 19:02:26 +02:00
|
|
|
|
2019-06-02 05:00:38 +02:00
|
|
|
return rsEVENTPROCESSED;
|
|
|
|
}
|
2019-05-31 19:02:26 +02:00
|
|
|
|
2019-08-15 16:51:39 +02:00
|
|
|
#ifndef MASTER
|
|
|
|
case rsANIMVIEWER:
|
|
|
|
{
|
|
|
|
TheModelViewer();
|
|
|
|
|
|
|
|
return rsEVENTPROCESSED;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-06-02 05:00:38 +02:00
|
|
|
default:
|
|
|
|
{
|
|
|
|
return rsEVENTNOTPROCESSED;
|
|
|
|
}
|
|
|
|
}
|
2019-05-31 19:02:26 +02:00
|
|
|
}
|
2019-05-30 21:24:47 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
#ifndef MASTER
|
|
|
|
void
|
|
|
|
TheModelViewer(void)
|
2019-06-25 02:34:29 +02:00
|
|
|
{
|
2020-04-09 05:20:44 +02:00
|
|
|
#if (defined(GTA_PS2) || defined(GTA_XBOX))
|
2020-04-09 01:52:38 +02:00
|
|
|
//TODO
|
|
|
|
#else
|
2020-05-24 01:59:30 +02:00
|
|
|
|
|
|
|
CDraw::CalculateAspectRatio();
|
2020-04-09 01:52:38 +02:00
|
|
|
CAnimViewer::Update();
|
|
|
|
CTimer::Update();
|
|
|
|
SetLightsWithTimeOfDayColour(Scene.world);
|
|
|
|
CRenderer::ConstructRenderList();
|
2020-06-08 13:00:45 +02:00
|
|
|
DoRWStuffStartOfFrame(CTimeCycle::GetSkyTopRed()*0.5f, CTimeCycle::GetSkyTopGreen()*0.5f, CTimeCycle::GetSkyTopBlue()*0.5f,
|
2020-04-09 01:52:38 +02:00
|
|
|
CTimeCycle::GetSkyBottomRed(), CTimeCycle::GetSkyBottomGreen(), CTimeCycle::GetSkyBottomBlue(),
|
|
|
|
255);
|
2019-06-25 02:34:29 +02:00
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
CSprite2d::InitPerFrame();
|
|
|
|
CFont::InitPerFrame();
|
|
|
|
DefinedState();
|
|
|
|
CVisibilityPlugins::InitAlphaEntityList();
|
|
|
|
CAnimViewer::Render();
|
|
|
|
Render2dStuff();
|
|
|
|
DoRWStuffEndOfFrame();
|
|
|
|
#endif
|
2019-06-25 02:34:29 +02:00
|
|
|
}
|
2020-04-09 01:52:38 +02:00
|
|
|
#endif
|
2019-06-25 02:34:29 +02:00
|
|
|
|
2020-06-27 23:01:51 +02:00
|
|
|
#ifdef PS2
|
2020-04-09 01:52:38 +02:00
|
|
|
void TheGame(void)
|
2019-07-24 18:55:43 +02:00
|
|
|
{
|
2020-04-09 01:52:38 +02:00
|
|
|
printf("Into TheGame!!!\n");
|
2019-07-24 18:55:43 +02:00
|
|
|
|
2020-04-09 05:20:44 +02:00
|
|
|
#ifdef GTA_PS2
|
2020-04-09 01:52:38 +02:00
|
|
|
gMainHeap.PushMemId(_TODOCONST(1));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
CTimer::Initialise();
|
|
|
|
|
2020-04-09 05:20:44 +02:00
|
|
|
#ifdef GTA_PS2
|
2020-04-09 01:52:38 +02:00
|
|
|
CGame::Initialise();
|
|
|
|
#else
|
|
|
|
CGame::Initialise("DATA\\GTA3.DAT");
|
|
|
|
#endif
|
|
|
|
|
2020-05-12 01:24:57 +02:00
|
|
|
Const char *splash = GetRandomSplashScreen(); // inlined here
|
2020-04-09 01:52:38 +02:00
|
|
|
|
|
|
|
LoadingScreen("Starting Game", NULL, splash);
|
|
|
|
|
2020-04-09 05:20:44 +02:00
|
|
|
#ifdef GTA_PS2
|
2020-06-27 23:01:51 +02:00
|
|
|
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))
|
2019-07-24 18:55:43 +02:00
|
|
|
{
|
2020-06-27 23:01:51 +02:00
|
|
|
strcpy(TheMemoryCard.LoadFileName, TheMemoryCard.MostRecentFile);
|
2020-04-09 01:52:38 +02:00
|
|
|
TheMemoryCard.b_FoundRecentSavedGameWantToLoad = true;
|
|
|
|
|
2020-05-22 01:44:01 +02:00
|
|
|
if (FrontEndMenuManager.m_PrefsLanguage != TheMemoryCard.GetLanguageToLoad())
|
2019-07-24 18:55:43 +02:00
|
|
|
{
|
2020-05-22 01:44:01 +02:00
|
|
|
FrontEndMenuManager.m_PrefsLanguage = TheMemoryCard.GetLanguageToLoad();
|
2020-04-09 01:52:38 +02:00
|
|
|
TheText.Unload();
|
|
|
|
TheText.Load();
|
|
|
|
}
|
|
|
|
|
|
|
|
CGame::currLevel = TheMemoryCard.GetLevelToLoad();
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
//TODO
|
|
|
|
#endif
|
|
|
|
|
|
|
|
while (true)
|
|
|
|
{
|
2020-04-09 02:06:43 +02:00
|
|
|
#ifdef PS2
|
|
|
|
if (TheMemoryCard.m_bWantToLoad)
|
|
|
|
#else
|
|
|
|
if (FrontEndMenuManager.m_bWantToLoad)
|
|
|
|
#endif
|
2020-04-09 01:52:38 +02:00
|
|
|
{
|
2020-05-12 01:24:57 +02:00
|
|
|
Const char *splash1 = GetLevelSplashScreen(CGame::currLevel);
|
2020-04-09 01:52:38 +02:00
|
|
|
LoadSplash(splash1);
|
|
|
|
}
|
|
|
|
|
2020-04-09 02:06:43 +02:00
|
|
|
#ifdef PS2
|
|
|
|
TheMemoryCard.m_bWantToLoad = false;
|
|
|
|
#else
|
|
|
|
FrontEndMenuManager.m_bWantToLoad = false;
|
|
|
|
#endif
|
2020-04-09 01:52:38 +02:00
|
|
|
|
|
|
|
CTimer::Update();
|
|
|
|
|
2020-04-09 02:06:43 +02:00
|
|
|
#ifdef PS2
|
|
|
|
while (!(FrontEndMenuManager.m_bWantToRestart || TheMemoryCard.b_FoundRecentSavedGameWantToLoad))
|
|
|
|
#else
|
|
|
|
while (!(FrontEndMenuManager.m_bWantToRestart || b_FoundRecentSavedGameWantToLoad))
|
|
|
|
#endif
|
2020-04-09 01:52:38 +02:00
|
|
|
{
|
|
|
|
CSprite2d::InitPerFrame();
|
|
|
|
CFont::InitPerFrame();
|
|
|
|
|
2020-04-09 05:20:44 +02:00
|
|
|
#ifdef GTA_PS2
|
2020-04-09 01:52:38 +02:00
|
|
|
gMainHeap.PushMemId(_TODOCONST(12));
|
|
|
|
#endif
|
|
|
|
CPointLights::NumLights = 0;
|
|
|
|
CGame::Process();
|
2020-04-09 05:20:44 +02:00
|
|
|
#ifdef GTA_PS2
|
2020-04-09 01:52:38 +02:00
|
|
|
gMainHeap.PopMemId();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
DMAudio.Service();
|
|
|
|
|
|
|
|
if (CGame::bDemoMode && CTimer::GetTimeInMilliseconds() > (3*60 + 30)*1000 && !CCutsceneMgr::IsCutsceneProcessing())
|
|
|
|
{
|
2020-04-09 02:06:43 +02:00
|
|
|
#ifdef PS2
|
|
|
|
TheMemoryCard.m_bWantToLoad = false;
|
|
|
|
#else
|
|
|
|
FrontEndMenuManager.m_bWantToLoad = false;
|
|
|
|
#endif
|
2020-04-09 01:52:38 +02:00
|
|
|
FrontEndMenuManager.m_bWantToRestart = true;
|
2019-07-24 18:55:43 +02:00
|
|
|
break;
|
2020-04-09 01:52:38 +02:00
|
|
|
}
|
|
|
|
|
2020-04-09 02:06:43 +02:00
|
|
|
#ifdef PS2
|
|
|
|
if (FrontEndMenuManager.m_bWantToRestart || TheMemoryCard.b_FoundRecentSavedGameWantToLoad)
|
|
|
|
#else
|
|
|
|
if (FrontEndMenuManager.m_bWantToRestart || b_FoundRecentSavedGameWantToLoad)
|
|
|
|
#endif
|
2020-04-09 01:52:38 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
SetLightsWithTimeOfDayColour(Scene.world);
|
2020-04-09 05:20:44 +02:00
|
|
|
#ifdef GTA_PS2
|
2020-04-09 01:52:38 +02:00
|
|
|
gMainHeap.PushMemId(_TODOCONST(15));
|
|
|
|
#endif
|
|
|
|
|
2020-05-22 01:44:01 +02:00
|
|
|
// 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 )
|
2020-04-09 01:52:38 +02:00
|
|
|
{
|
2020-04-09 05:20:44 +02:00
|
|
|
#ifdef GTA_PS2
|
2020-04-09 01:52:38 +02:00
|
|
|
gMainHeap.PushMemId(_TODOCONST(11));
|
|
|
|
#endif
|
|
|
|
CRenderer::ConstructRenderList();
|
|
|
|
CRenderer::PreRender();
|
2020-04-09 05:20:44 +02:00
|
|
|
#ifdef GTA_PS2
|
2020-04-09 01:52:38 +02:00
|
|
|
gMainHeap.PopMemId();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (CWeather::LightningFlash && !CCullZones::CamNoRain())
|
|
|
|
DoRWStuffStartOfFrame_Horizon(255, 255, 255, 255, 255, 255, 255);
|
|
|
|
else
|
|
|
|
DoRWStuffStartOfFrame_Horizon(CTimeCycle::GetSkyTopRed(), CTimeCycle::GetSkyTopGreen(), CTimeCycle::GetSkyTopBlue(), CTimeCycle::GetSkyBottomRed(), CTimeCycle::GetSkyBottomGreen(), CTimeCycle::GetSkyBottomBlue(), 255);
|
|
|
|
|
|
|
|
DefinedState();
|
|
|
|
RwCameraSetFarClipPlane(Scene.camera, CTimeCycle::GetFarClip());
|
|
|
|
RwCameraSetFogDistance(Scene.camera, CTimeCycle::GetFogStart());
|
|
|
|
|
|
|
|
RenderScene();
|
|
|
|
RenderDebugShit();
|
|
|
|
RenderEffects();
|
|
|
|
|
2020-06-27 23:01:51 +02:00
|
|
|
if ((TheCamera.m_BlurType == MOTION_BLUR_NONE || TheCamera.m_BlurType == MOTION_BLUR_LIGHT_SCENE) && TheCamera.m_ScreenReductionPercentage > 0.0f)
|
2020-04-09 01:52:38 +02:00
|
|
|
TheCamera.SetMotionBlurAlpha(150);
|
|
|
|
TheCamera.RenderMotionBlur();
|
|
|
|
|
|
|
|
Render2dStuff();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CameraSize(Scene.camera, NULL, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
|
|
|
|
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
|
|
|
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
|
|
|
|
if (!RsCameraBeginUpdate(Scene.camera))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
RenderMenus();
|
|
|
|
|
2020-04-09 02:06:43 +02:00
|
|
|
#ifdef PS2
|
|
|
|
if (TheMemoryCard.m_bWantToLoad)
|
|
|
|
#else
|
|
|
|
if (FrontEndMenuManager.m_bWantToLoad)
|
|
|
|
#endif
|
2020-04-09 01:52:38 +02:00
|
|
|
{
|
2020-04-09 05:20:44 +02:00
|
|
|
#ifdef GTA_PS2
|
2020-04-09 01:52:38 +02:00
|
|
|
gMainHeap.PopMemId();
|
|
|
|
#endif
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
DoFade();
|
|
|
|
Render2dStuffAfterFade();
|
|
|
|
CCredits::Render();
|
|
|
|
|
|
|
|
DoRWStuffEndOfFrame();
|
|
|
|
|
|
|
|
while (frameCount < 2)
|
|
|
|
;
|
|
|
|
|
|
|
|
frameCount = 0;
|
|
|
|
|
|
|
|
CTimer::Update();
|
|
|
|
|
2020-04-09 05:20:44 +02:00
|
|
|
#ifdef GTA_PS2
|
2020-04-09 01:52:38 +02:00
|
|
|
gMainHeap.PopMemId();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (g_SlowMode)
|
|
|
|
ProcessSlowMode();
|
2019-07-24 18:55:43 +02:00
|
|
|
}
|
2020-04-09 01:52:38 +02:00
|
|
|
|
|
|
|
CPad::ResetCheats();
|
|
|
|
CPad::StopPadsShaking();
|
|
|
|
DMAudio.ChangeMusicMode(MUSICMODE_DISABLE);
|
|
|
|
CGame::ShutDownForRestart();
|
|
|
|
CTimer::Stop();
|
|
|
|
|
2020-04-09 02:06:43 +02:00
|
|
|
#ifdef PS2
|
|
|
|
if (FrontEndMenuManager.m_bWantToRestart || TheMemoryCard.b_FoundRecentSavedGameWantToLoad)
|
|
|
|
#else
|
|
|
|
if (FrontEndMenuManager.m_bWantToRestart || b_FoundRecentSavedGameWantToLoad)
|
|
|
|
#endif
|
2019-07-24 18:55:43 +02:00
|
|
|
{
|
2020-04-09 02:06:43 +02:00
|
|
|
#ifdef PS2
|
|
|
|
if (TheMemoryCard.b_FoundRecentSavedGameWantToLoad)
|
|
|
|
#else
|
|
|
|
if (b_FoundRecentSavedGameWantToLoad)
|
|
|
|
#endif
|
2020-04-09 01:52:38 +02:00
|
|
|
{
|
|
|
|
FrontEndMenuManager.m_bWantToRestart = true;
|
2020-04-09 02:06:43 +02:00
|
|
|
#ifdef PS2
|
|
|
|
TheMemoryCard.m_bWantToLoad = true;
|
|
|
|
#else
|
|
|
|
FrontEndMenuManager.m_bWantToLoad = true;
|
|
|
|
#endif
|
2020-04-09 01:52:38 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
CGame::InitialiseWhenRestarting();
|
|
|
|
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
|
|
|
|
FrontEndMenuManager.m_bWantToRestart = false;
|
|
|
|
|
|
|
|
continue;
|
2019-07-24 18:55:43 +02:00
|
|
|
}
|
2020-04-09 01:52:38 +02:00
|
|
|
|
|
|
|
break;
|
2019-07-24 18:55:43 +02:00
|
|
|
}
|
|
|
|
|
2020-04-09 01:52:38 +02:00
|
|
|
DMAudio.Terminate();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void SystemInit()
|
|
|
|
{
|
|
|
|
#ifdef __MWERKS__
|
|
|
|
mwInit();
|
|
|
|
#endif
|
2019-07-24 18:55:43 +02:00
|
|
|
|
2020-04-09 05:20:44 +02:00
|
|
|
#ifdef GTA_PS2
|
2020-04-09 01:52:38 +02:00
|
|
|
InitMemoryMgr();
|
|
|
|
#endif
|
|
|
|
|
2020-04-09 05:20:44 +02:00
|
|
|
#ifdef GTA_PS2
|
2020-04-09 01:52:38 +02:00
|
|
|
CFileMgr::InitCdSystem();
|
|
|
|
|
|
|
|
char path[256];
|
|
|
|
|
|
|
|
sprintf(path, "cdrom0:\\%s%s;1", "SYSTEM\\", "IOPRP23.IMG");
|
|
|
|
|
|
|
|
sceSifInitRpc(0);
|
|
|
|
|
|
|
|
while ( !sceSifRebootIop(path) )
|
2019-07-24 18:55:43 +02:00
|
|
|
;
|
2020-04-09 01:52:38 +02:00
|
|
|
while( !sceSifSyncIop() )
|
|
|
|
;
|
|
|
|
|
|
|
|
sceSifInitRpc(0);
|
|
|
|
|
|
|
|
CFileMgr::InitCdSystem();
|
|
|
|
|
|
|
|
sceFsReset();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
CFileMgr::Initialise();
|
|
|
|
|
2020-04-09 05:20:44 +02:00
|
|
|
#ifdef GTA_PS2
|
2020-04-09 01:52:38 +02:00
|
|
|
CFileMgr::InitCd();
|
|
|
|
|
|
|
|
Char modulepath[256];
|
|
|
|
|
|
|
|
strcpy(modulepath, "cdrom0:\\");
|
|
|
|
strcat(modulepath, "SYSTEM\\");
|
|
|
|
strcat(modulepath, "SIO2MAN.IRX");
|
|
|
|
LoadModule(modulepath);
|
|
|
|
|
|
|
|
strcpy(modulepath, "cdrom0:\\");
|
|
|
|
strcat(modulepath, "SYSTEM\\");
|
|
|
|
strcat(modulepath, "PADMAN.IRX");
|
|
|
|
LoadModule(modulepath);
|
|
|
|
|
|
|
|
strcpy(modulepath, "cdrom0:\\");
|
|
|
|
strcat(modulepath, "SYSTEM\\");
|
|
|
|
strcat(modulepath, "LIBSD.IRX");
|
|
|
|
LoadModule(modulepath);
|
|
|
|
|
|
|
|
strcpy(modulepath, "cdrom0:\\");
|
|
|
|
strcat(modulepath, "SYSTEM\\");
|
|
|
|
strcat(modulepath, "SDRDRV.IRX");
|
|
|
|
LoadModule(modulepath);
|
|
|
|
|
|
|
|
strcpy(modulepath, "cdrom0:\\");
|
|
|
|
strcat(modulepath, "SYSTEM\\");
|
|
|
|
strcat(modulepath, "MCMAN.IRX");
|
|
|
|
LoadModule(modulepath);
|
|
|
|
|
|
|
|
strcpy(modulepath, "cdrom0:\\");
|
|
|
|
strcat(modulepath, "SYSTEM\\");
|
|
|
|
strcat(modulepath, "MCSERV.IRX");
|
|
|
|
LoadModule(modulepath);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2020-04-09 05:20:44 +02:00
|
|
|
#ifdef GTA_PS2
|
2020-04-09 01:52:38 +02:00
|
|
|
ThreadParam param;
|
|
|
|
|
|
|
|
param.entry = &IdleThread;
|
|
|
|
param.stack = idleThreadStack;
|
|
|
|
param.stackSize = 2048;
|
|
|
|
param.initPriority = 127;
|
|
|
|
param.gpReg = &_gp;
|
|
|
|
|
|
|
|
int thread = CreateThread(¶m);
|
|
|
|
StartThread(thread, NULL);
|
|
|
|
#else
|
|
|
|
//
|
|
|
|
#endif
|
|
|
|
|
2020-04-15 07:03:53 +02:00
|
|
|
#ifdef GTA_PS2_STUFF
|
2020-04-09 01:52:38 +02:00
|
|
|
CPad::Initialise();
|
2020-04-15 07:03:53 +02:00
|
|
|
#endif
|
2020-04-09 01:52:38 +02:00
|
|
|
CPad::GetPad(0)->Mode = 0;
|
|
|
|
|
|
|
|
CGame::frenchGame = false;
|
|
|
|
CGame::germanGame = false;
|
|
|
|
CGame::nastyGame = true;
|
2020-05-22 01:44:01 +02:00
|
|
|
FrontEndMenuManager.m_PrefsAllowNastyGame = true;
|
2020-04-09 01:52:38 +02:00
|
|
|
|
2020-04-09 05:20:44 +02:00
|
|
|
#ifdef GTA_PS2
|
2020-04-09 01:52:38 +02:00
|
|
|
int32 lang = sceScfGetLanguage();
|
|
|
|
if ( lang == SCE_ITALIAN_LANGUAGE )
|
2020-05-22 01:44:01 +02:00
|
|
|
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_ITALIAN;
|
2020-04-09 01:52:38 +02:00
|
|
|
else if ( lang == SCE_SPANISH_LANGUAGE )
|
2020-05-22 01:44:01 +02:00
|
|
|
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_SPANISH;
|
2020-04-09 01:52:38 +02:00
|
|
|
else if ( lang == SCE_GERMAN_LANGUAGE )
|
|
|
|
{
|
|
|
|
CGame::germanGame = true;
|
|
|
|
CGame::nastyGame = false;
|
2020-05-22 01:44:01 +02:00
|
|
|
FrontEndMenuManager.m_PrefsAllowNastyGame = false;
|
|
|
|
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_GERMAN;
|
2020-04-09 01:52:38 +02:00
|
|
|
}
|
|
|
|
else if ( lang == SCE_FRENCH_LANGUAGE )
|
|
|
|
{
|
|
|
|
CGame::frenchGame = true;
|
|
|
|
CGame::nastyGame = false;
|
2020-05-22 01:44:01 +02:00
|
|
|
FrontEndMenuManager.m_PrefsAllowNastyGame = false;
|
|
|
|
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_FRENCH;
|
2020-04-09 01:52:38 +02:00
|
|
|
}
|
|
|
|
else
|
2020-05-22 01:44:01 +02:00
|
|
|
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_AMERICAN;
|
2020-04-09 01:52:38 +02:00
|
|
|
|
|
|
|
FrontEndMenuManager.InitialiseMenuContentsAfterLoadingGame();
|
|
|
|
#else
|
|
|
|
//
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef PS2
|
|
|
|
TheMemoryCard.Init();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void GameInit()
|
|
|
|
{
|
|
|
|
if ( !gameAlreadyInitialised )
|
|
|
|
{
|
2020-04-09 05:20:44 +02:00
|
|
|
#ifdef GTA_PS2
|
2020-04-09 01:52:38 +02:00
|
|
|
char path[256];
|
|
|
|
|
|
|
|
strcpy(path, "cdrom0:\\");
|
|
|
|
strcat(path, "SYSTEM\\");
|
|
|
|
strcat(path, "CDSTREAM.IRX");
|
|
|
|
LoadModule(path);
|
|
|
|
|
|
|
|
strcpy(path, "cdrom0:\\");
|
|
|
|
strcat(path, "SYSTEM\\");
|
|
|
|
strcat(path, "SAMPMAN.IRX");
|
|
|
|
LoadModule(path);
|
|
|
|
|
|
|
|
strcpy(path, "cdrom0:\\");
|
|
|
|
strcat(path, "SYSTEM\\");
|
|
|
|
strcat(path, "MUSICSTR.IRX");
|
|
|
|
LoadModule(path);
|
|
|
|
#endif
|
|
|
|
CdStreamInit(MAX_CDCHANNELS);
|
|
|
|
|
|
|
|
#ifdef PS2
|
|
|
|
Initialise3D(); //no params
|
|
|
|
#else
|
|
|
|
//TODO
|
|
|
|
#endif
|
|
|
|
|
2020-04-09 05:20:44 +02:00
|
|
|
#ifdef GTA_PS2
|
2020-04-09 01:52:38 +02:00
|
|
|
char *files[] =
|
|
|
|
{
|
|
|
|
"\\ANIM\\CUTS.IMG;1",
|
|
|
|
"\\ANIM\\CUTS.DIR;1",
|
|
|
|
"\\ANIM\\PED.IFP;1",
|
|
|
|
"\\MODELS\\FRONTEND.TXD;1",
|
|
|
|
"\\MODELS\\FONTS.TXD;1",
|
|
|
|
"\\MODELS\\HUD.TXD;1",
|
|
|
|
"\\MODELS\\PARTICLE.TXD;1",
|
|
|
|
"\\MODELS\\MISC.TXD;1",
|
|
|
|
"\\MODELS\\GENERIC.TXD;1",
|
|
|
|
"\\MODELS\\GTA3.DIR;1",
|
|
|
|
"\\TEXT\\ENGLISH.GXT;1",
|
|
|
|
"\\TEXT\\FRENCH.GXT;1",
|
|
|
|
"\\TEXT\\GERMAN.GXT;1",
|
|
|
|
"\\TEXT\\ITALIAN.GXT;1",
|
|
|
|
"\\TEXT\\SPANISH.GXT;1",
|
|
|
|
"\\TXD\\LOADSC0.TXD;1",
|
|
|
|
"\\TXD\\LOADSC1.TXD;1",
|
|
|
|
"\\TXD\\LOADSC2.TXD;1",
|
|
|
|
"\\TXD\\LOADSC3.TXD;1",
|
|
|
|
"\\TXD\\LOADSC4.TXD;1",
|
|
|
|
"\\TXD\\LOADSC5.TXD;1",
|
|
|
|
"\\TXD\\LOADSC6.TXD;1",
|
|
|
|
"\\TXD\\LOADSC7.TXD;1",
|
|
|
|
"\\TXD\\LOADSC8.TXD;1",
|
|
|
|
"\\TXD\\LOADSC9.TXD;1",
|
|
|
|
"\\TXD\\LOADSC10.TXD;1",
|
|
|
|
"\\TXD\\LOADSC11.TXD;1",
|
|
|
|
"\\TXD\\LOADSC12.TXD;1",
|
|
|
|
"\\TXD\\LOADSC13.TXD;1",
|
|
|
|
"\\TXD\\LOADSC14.TXD;1",
|
|
|
|
"\\TXD\\LOADSC15.TXD;1",
|
|
|
|
"\\TXD\\LOADSC16.TXD;1",
|
|
|
|
"\\TXD\\LOADSC17.TXD;1",
|
|
|
|
"\\TXD\\LOADSC18.TXD;1",
|
|
|
|
"\\TXD\\LOADSC19.TXD;1",
|
|
|
|
"\\TXD\\LOADSC20.TXD;1",
|
|
|
|
"\\TXD\\LOADSC21.TXD;1",
|
|
|
|
"\\TXD\\LOADSC22.TXD;1",
|
|
|
|
"\\TXD\\LOADSC23.TXD;1",
|
|
|
|
"\\TXD\\LOADSC24.TXD;1",
|
|
|
|
"\\TXD\\LOADSC25.TXD;1",
|
|
|
|
"\\TXD\\NEWS.TXD;1",
|
|
|
|
"\\MODELS\\COLL\\GENERIC.COL;1",
|
|
|
|
"\\MODELS\\COLL\\INDUST.COL;1",
|
|
|
|
"\\MODELS\\COLL\\COMMER.COL;1",
|
|
|
|
"\\MODELS\\COLL\\SUBURB.COL;1",
|
|
|
|
"\\MODELS\\COLL\\WEAPONS.COL;1",
|
|
|
|
"\\MODELS\\COLL\\VEHICLES.COL;1",
|
|
|
|
"\\MODELS\\COLL\\PEDS.COL;1",
|
|
|
|
"\\MODELS\\GENERIC\\AIR_VLO.DFF;1",
|
|
|
|
"\\MODELS\\GENERIC\\WEAPONS.DFF;1",
|
|
|
|
"\\MODELS\\GENERIC\\WHEELS.DFF;1",
|
|
|
|
"\\MODELS\\GENERIC\\LOPLYGUY.DFF;1",
|
|
|
|
"\\MODELS\\GENERIC\\ARROW.DFF;1",
|
|
|
|
"\\MODELS\\GENERIC\\ZONECYLB.DFF;1",
|
|
|
|
"\\DATA\\MAPS\\COMNTOP.IPL;1",
|
|
|
|
"\\DATA\\MAPS\\COMNBTM.IPL;1",
|
|
|
|
"\\DATA\\MAPS\\COMSE.IPL;1",
|
|
|
|
"\\DATA\\MAPS\\COMSW.IPL;1",
|
|
|
|
"\\DATA\\MAPS\\CULL.IPL;1",
|
|
|
|
"\\DATA\\MAPS\\INDUSTNE.IPL;1",
|
|
|
|
"\\DATA\\MAPS\\INDUSTNW.IPL;1",
|
|
|
|
"\\DATA\\MAPS\\INDUSTSE.IPL;1",
|
|
|
|
"\\DATA\\MAPS\\INDUSTSW.IPL;1",
|
|
|
|
"\\DATA\\MAPS\\SUBURBNE.IPL;1",
|
|
|
|
"\\DATA\\MAPS\\SUBURBSW.IPL;1",
|
|
|
|
"\\DATA\\MAPS\\OVERVIEW.IPL;1",
|
|
|
|
"\\DATA\\MAPS\\PROPS.IPL;1",
|
|
|
|
"\\DATA\\MAPS\\GTA3.IDE;1",
|
|
|
|
"\\DATA\\PATHS\\FLIGHT.DAT;1",
|
|
|
|
"\\DATA\\PATHS\\FLIGHT2.DAT;1",
|
|
|
|
"\\DATA\\PATHS\\FLIGHT3.DAT;1",
|
|
|
|
"\\DATA\\PATHS\\FLIGHT4.DAT;1",
|
|
|
|
"\\DATA\\PATHS\\TRACKS.DAT;1",
|
|
|
|
"\\DATA\\PATHS\\TRACKS2.DAT;1",
|
|
|
|
"\\DATA\\PATHS\\CHASE0.DAT;1",
|
|
|
|
"\\DATA\\PATHS\\CHASE1.DAT;1",
|
|
|
|
"\\DATA\\PATHS\\CHASE2.DAT;1",
|
|
|
|
"\\DATA\\PATHS\\CHASE3.DAT;1",
|
|
|
|
"\\DATA\\PATHS\\CHASE4.DAT;1",
|
|
|
|
"\\DATA\\PATHS\\CHASE5.DAT;1",
|
|
|
|
"\\DATA\\PATHS\\CHASE6.DAT;1",
|
|
|
|
"\\DATA\\PATHS\\CHASE7.DAT;1",
|
|
|
|
"\\DATA\\PATHS\\CHASE10.DAT;1",
|
|
|
|
"\\DATA\\PATHS\\CHASE11.DAT;1",
|
|
|
|
"\\DATA\\PATHS\\CHASE14.DAT;1",
|
|
|
|
"\\DATA\\PATHS\\CHASE16.DAT;1",
|
|
|
|
"\\DATA\\PATHS\\CHASE18.DAT;1",
|
|
|
|
"\\DATA\\PATHS\\CHASE19.DAT;1"
|
|
|
|
};
|
|
|
|
|
|
|
|
for ( int32 i = 0; i < ARRAY_SIZE(files); i++ )
|
|
|
|
SkyRegisterFileOnCd([i]);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
CreateDebugFont();
|
|
|
|
|
2020-04-09 05:20:44 +02:00
|
|
|
#ifdef GTA_PS2
|
2020-04-09 01:52:38 +02:00
|
|
|
AddIntcHandler(_TODOCONST(2), VBlankCounter, 0);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
CameraSize(Scene.camera, NULL, DEFAULT_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
|
|
|
|
|
|
|
|
CSprite2d::SetRecipNearClip();
|
|
|
|
CTxdStore::Initialise();
|
2020-04-09 05:20:44 +02:00
|
|
|
#ifdef GTA_PS2
|
2020-04-09 01:52:38 +02:00
|
|
|
gMainHeap.PushMemId(_TODOCONST(9));
|
|
|
|
#endif
|
|
|
|
CFont::Initialise();
|
|
|
|
CHud::Initialise();
|
2020-04-09 05:20:44 +02:00
|
|
|
#ifdef GTA_PS2
|
2020-04-09 01:52:38 +02:00
|
|
|
gMainHeap.PopMemId();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
ValidateVersion();
|
|
|
|
|
2020-04-09 05:20:44 +02:00
|
|
|
#ifdef GTA_PS2
|
2020-04-09 01:52:38 +02:00
|
|
|
sceCdCLOCK rtc;
|
|
|
|
sceCdReadClock(&rtc);
|
|
|
|
uint32 seed = rtc.minute + rtc.day;
|
|
|
|
uint32 seed2 = (seed << 4)-seed;
|
|
|
|
uint32 seed3 = (seed2 << 4)-seed2;
|
|
|
|
srand ((seed3<<4)+rtc.second);
|
|
|
|
#else
|
|
|
|
//TODO: mysrand();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
gameAlreadyInitialised = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
#ifdef __MWERKS__
|
|
|
|
mwInit(); // metrowerks initialisation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
SystemInit();
|
|
|
|
|
|
|
|
#ifdef PS2
|
2020-06-27 23:01:51 +02:00
|
|
|
int32 r = TheMemoryCard.CheckCardStateAtGameStartUp(CARD_ONE);
|
2020-04-09 01:52:38 +02:00
|
|
|
|
2020-06-27 23:01:51 +02:00
|
|
|
if ( r == CMemoryCard::ERR_DIRNOENTRY || r == CMemoryCard::ERR_NOFORMAT
|
|
|
|
&& r != CMemoryCard::ERR_OPENNOENTRY && r != CMemoryCard::ERR_NONE )
|
2020-04-09 01:52:38 +02:00
|
|
|
{
|
|
|
|
GameInit();
|
|
|
|
|
|
|
|
TheText.Unload();
|
|
|
|
TheText.Load();
|
|
|
|
|
|
|
|
CFont::Initialise();
|
|
|
|
|
|
|
|
FrontEndMenuManager.DrawMemoryCardStartUpMenus();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2020-04-09 05:20:44 +02:00
|
|
|
#ifdef GTA_PS2
|
2020-04-09 01:52:38 +02:00
|
|
|
{
|
|
|
|
if (gameAlreadyInitialised)
|
|
|
|
RpSkySuspend();
|
|
|
|
|
|
|
|
InitMPEGPlayer();
|
|
|
|
|
|
|
|
PlayMPEG("cdrom0:\\MOVIES\\DMAPAL.PSS;1", false);
|
|
|
|
|
|
|
|
if (CGame::frenchGame || CGame::germanGame)
|
|
|
|
PlayMPEG("cdrom0:\\MOVIES\\INTROPAF.PSS;1", true);
|
|
|
|
else
|
|
|
|
PlayMPEG("cdrom0:\\MOVIES\\INTROPAL.PSS;1", true);
|
|
|
|
|
|
|
|
ShutdownMPEGPlayer();
|
|
|
|
|
|
|
|
if ( gameAlreadyInitialised )
|
|
|
|
RpSkyResume();
|
2019-07-24 18:55:43 +02:00
|
|
|
}
|
2020-04-09 01:52:38 +02:00
|
|
|
#else
|
|
|
|
//TODO
|
|
|
|
#endif
|
|
|
|
|
|
|
|
GameInit();
|
|
|
|
|
|
|
|
if ( CGame::frenchGame || CGame::germanGame )
|
|
|
|
LoadingScreen(NULL, version_name, "loadsc24");
|
|
|
|
else
|
|
|
|
LoadingScreen(NULL, version_name, "loadsc0");
|
|
|
|
|
|
|
|
DMAudio.Initialise();
|
|
|
|
|
|
|
|
TheGame();
|
|
|
|
|
|
|
|
CGame::ShutDown();
|
|
|
|
|
|
|
|
RwEngineStop();
|
|
|
|
RwEngineClose();
|
|
|
|
RwEngineTerm();
|
|
|
|
|
|
|
|
#ifdef __MWERKS__
|
|
|
|
mwExit(); // metrowerks shutdown
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
2019-07-24 18:55:43 +02:00
|
|
|
}
|
2020-05-11 04:55:57 +02:00
|
|
|
#endif
|