2019-05-24 13:58:32 -04:00
|
|
|
#include "common.h"
|
2019-05-15 10:52:37 -04:00
|
|
|
#include "patcher.h"
|
2019-06-17 04:30:02 -04:00
|
|
|
#include "main.h"
|
2019-06-18 03:50:26 -04:00
|
|
|
#include "General.h"
|
2019-05-30 15:24:47 -04:00
|
|
|
#include "RwHelper.h"
|
|
|
|
#include "Clouds.h"
|
|
|
|
#include "Draw.h"
|
|
|
|
#include "Sprite2d.h"
|
2019-05-15 10:52:37 -04:00
|
|
|
#include "Renderer.h"
|
2019-05-30 15:24:47 -04: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 05:44:43 -04:00
|
|
|
#include "VisibilityPlugins.h"
|
2019-06-12 08:35:15 -04:00
|
|
|
#include "NodeName.h"
|
2019-05-31 05:44:43 -04:00
|
|
|
#include "DMAudio.h"
|
|
|
|
#include "CutsceneMgr.h"
|
|
|
|
#include "Lights.h"
|
|
|
|
#include "Credits.h"
|
2019-07-07 07:09:11 -04:00
|
|
|
#include "ZoneCull.h"
|
2019-06-30 06:53:39 -04:00
|
|
|
#include "Timecycle.h"
|
2019-06-01 17:17:39 -04:00
|
|
|
#include "TxdStore.h"
|
|
|
|
#include "FileMgr.h"
|
|
|
|
#include "Text.h"
|
2019-06-11 02:59:28 -04:00
|
|
|
#include "RpAnimBlend.h"
|
2019-05-30 15:24:47 -04:00
|
|
|
#include "Frontend.h"
|
2019-08-15 10:51:39 -04:00
|
|
|
#include "AnimViewer.h"
|
2020-02-24 13:17:15 -05:00
|
|
|
#include "Script.h"
|
2020-03-22 10:23:40 -04:00
|
|
|
#include "Debug.h"
|
|
|
|
#include "Console.h"
|
2019-05-15 10:52:37 -04:00
|
|
|
|
2019-07-10 11:34:11 -04:00
|
|
|
#define DEFAULT_VIEWWINDOW (Tan(DEGTORAD(CDraw::GetFOV() * 0.5f)))
|
2019-05-31 13:02:26 -04:00
|
|
|
|
|
|
|
|
2019-06-17 04:30:02 -04:00
|
|
|
GlobalScene &Scene = *(GlobalScene*)0x726768;
|
|
|
|
|
2019-06-12 10:52:26 -04:00
|
|
|
uint8 work_buff[55000];
|
2019-07-10 07:42:48 -04:00
|
|
|
//char gString[256];
|
|
|
|
//char gString2[512];
|
|
|
|
//wchar gUString[256];
|
|
|
|
//wchar gUString2[256];
|
|
|
|
char *gString = (char*)0x711B40;
|
|
|
|
char *gString2 = (char*)0x878A40;
|
2019-06-16 20:10:55 -04:00
|
|
|
wchar *gUString = (wchar*)0x74B018;
|
2019-07-10 07:42:48 -04:00
|
|
|
wchar *gUString2 = (wchar*)0x6EDD70;
|
2019-05-31 05:44:43 -04:00
|
|
|
|
|
|
|
bool &b_FoundRecentSavedGameWantToLoad = *(bool*)0x95CDA8;
|
|
|
|
|
|
|
|
|
2019-07-24 12:55:43 -04:00
|
|
|
char version_name[64];
|
|
|
|
|
|
|
|
float FramesPerSecond = 30.0f;
|
|
|
|
|
|
|
|
bool gbPrintShite = false;
|
2019-08-15 10:51:39 -04:00
|
|
|
bool &gbModelViewer = *(bool*)0x95CD93;
|
2019-07-24 12:55:43 -04:00
|
|
|
|
2019-05-31 05:44:43 -04:00
|
|
|
bool DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
|
2019-08-15 10:51:39 -04:00
|
|
|
bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
|
2019-05-31 05:44:43 -04:00
|
|
|
void DoRWStuffEndOfFrame(void);
|
|
|
|
|
|
|
|
void RenderScene(void);
|
|
|
|
void RenderDebugShit(void);
|
|
|
|
void RenderEffects(void);
|
|
|
|
void Render2dStuff(void);
|
|
|
|
void RenderMenus(void);
|
|
|
|
void DoFade(void);
|
|
|
|
void Render2dStuffAfterFade(void);
|
|
|
|
|
2019-06-01 17:17:39 -04:00
|
|
|
CSprite2d *LoadSplash(const char *name);
|
|
|
|
void DestroySplashScreen(void);
|
|
|
|
|
|
|
|
|
2019-05-31 05:44:43 -04:00
|
|
|
extern void (*DebugMenuProcess)(void);
|
|
|
|
extern void (*DebugMenuRender)(void);
|
2019-06-12 06:34:22 -04:00
|
|
|
void DebugMenuInit(void);
|
2019-06-27 04:58:51 -04:00
|
|
|
void DebugMenuPopulate(void);
|
2019-05-31 05:44:43 -04:00
|
|
|
|
2019-06-24 20:34:29 -04:00
|
|
|
void PrintGameVersion();
|
2019-05-31 05:44:43 -04:00
|
|
|
|
|
|
|
RwRGBA gColourTop;
|
|
|
|
|
2019-06-28 13:23:28 -04:00
|
|
|
void
|
|
|
|
InitialiseGame(void)
|
|
|
|
{
|
|
|
|
LoadingScreen(nil, nil, "loadsc0");
|
|
|
|
CGame::Initialise("DATA\\GTA3.DAT");
|
|
|
|
}
|
|
|
|
|
2019-08-15 10:51:39 -04:00
|
|
|
#ifndef MASTER
|
|
|
|
void
|
|
|
|
TheModelViewer(void)
|
|
|
|
{
|
2019-08-15 11:59:09 -04:00
|
|
|
#ifdef ASPECT_RATIO_SCALE
|
|
|
|
CDraw::SetAspectRatio(CDraw::FindAspectRatio());
|
|
|
|
#endif
|
2019-08-15 10:51:39 -04:00
|
|
|
CAnimViewer::Update();
|
|
|
|
CTimer::Update();
|
|
|
|
SetLightsWithTimeOfDayColour(Scene.world);
|
|
|
|
CRenderer::ConstructRenderList();
|
|
|
|
DoRWStuffStartOfFrame(CTimeCycle::GetSkyTopRed(), CTimeCycle::GetSkyTopGreen(), CTimeCycle::GetSkyTopBlue(),
|
|
|
|
CTimeCycle::GetSkyBottomRed(), CTimeCycle::GetSkyBottomGreen(), CTimeCycle::GetSkyBottomBlue(),
|
|
|
|
255);
|
|
|
|
|
2019-08-17 15:03:57 -04:00
|
|
|
CSprite2d::InitPerFrame();
|
|
|
|
CFont::InitPerFrame();
|
2019-08-15 10:51:39 -04:00
|
|
|
DefinedState();
|
|
|
|
CVisibilityPlugins::InitAlphaEntityList();
|
|
|
|
CAnimViewer::Render();
|
2019-08-17 15:03:57 -04:00
|
|
|
Render2dStuff();
|
2019-08-15 10:51:39 -04:00
|
|
|
DoRWStuffEndOfFrame();
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-05-31 05:44:43 -04:00
|
|
|
void
|
|
|
|
Idle(void *arg)
|
|
|
|
{
|
2019-07-03 07:13:55 -04:00
|
|
|
#ifdef ASPECT_RATIO_SCALE
|
|
|
|
CDraw::SetAspectRatio(CDraw::FindAspectRatio());
|
|
|
|
#endif
|
|
|
|
|
2019-05-31 05:44:43 -04:00
|
|
|
CTimer::Update();
|
|
|
|
CSprite2d::InitPerFrame();
|
|
|
|
CFont::InitPerFrame();
|
2020-01-07 09:23:09 -05:00
|
|
|
|
|
|
|
// 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();
|
|
|
|
CGame::Process();
|
|
|
|
DMAudio.Service();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (RsGlobal.quit)
|
|
|
|
return;
|
|
|
|
#else
|
2019-05-31 05:44:43 -04:00
|
|
|
CPointLights::InitPerFrame();
|
|
|
|
CGame::Process();
|
|
|
|
DMAudio.Service();
|
2020-01-07 09:23:09 -05:00
|
|
|
#endif
|
2019-05-31 05:44:43 -04:00
|
|
|
|
|
|
|
if(CGame::bDemoMode && CTimer::GetTimeInMilliseconds() > (3*60 + 30)*1000 && !CCutsceneMgr::IsCutsceneProcessing()){
|
|
|
|
FrontEndMenuManager.m_bStartGameLoading = true;
|
|
|
|
FrontEndMenuManager.m_bLoadingSavedGame = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(FrontEndMenuManager.m_bStartGameLoading || b_FoundRecentSavedGameWantToLoad)
|
|
|
|
return;
|
|
|
|
|
|
|
|
SetLightsWithTimeOfDayColour(Scene.world);
|
|
|
|
|
|
|
|
if(arg == nil)
|
|
|
|
return;
|
|
|
|
|
2020-01-07 09:23:09 -05:00
|
|
|
if((!FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bRenderGameInMenu) &&
|
2019-05-31 05:44:43 -04:00
|
|
|
TheCamera.GetScreenFadeStatus() != FADE_2){
|
2019-06-27 04:58:51 -04:00
|
|
|
#ifdef GTA_PC
|
2020-01-07 09:23:09 -05:00
|
|
|
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);
|
|
|
|
}
|
2019-06-27 04:58:51 -04:00
|
|
|
#endif
|
2019-05-31 05:44:43 -04:00
|
|
|
CRenderer::ConstructRenderList();
|
|
|
|
CRenderer::PreRender();
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
DefinedState();
|
|
|
|
|
|
|
|
// BUG. This has to be done BEFORE RwCameraBeginUpdate
|
|
|
|
RwCameraSetFarClipPlane(Scene.camera, CTimeCycle::GetFarClip());
|
|
|
|
RwCameraSetFogDistance(Scene.camera, CTimeCycle::GetFogStart());
|
|
|
|
|
|
|
|
RenderScene();
|
|
|
|
RenderDebugShit();
|
|
|
|
RenderEffects();
|
|
|
|
|
|
|
|
if((TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_NORMAL) &&
|
|
|
|
TheCamera.m_ScreenReductionPercentage > 0.0)
|
|
|
|
TheCamera.SetMotionBlurAlpha(150);
|
|
|
|
TheCamera.RenderMotionBlur();
|
|
|
|
|
|
|
|
Render2dStuff();
|
|
|
|
}else{
|
2019-07-03 07:13:55 -04:00
|
|
|
float viewWindow = DEFAULT_VIEWWINDOW;
|
2019-10-07 08:08:39 -04:00
|
|
|
#ifdef ASPECT_RATIO_SCALE
|
|
|
|
CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO);
|
|
|
|
#else
|
2019-07-03 07:13:55 -04:00
|
|
|
CameraSize(Scene.camera, nil, viewWindow, DEFAULT_ASPECT_RATIO);
|
2019-10-07 08:08:39 -04:00
|
|
|
#endif
|
2019-05-31 05:44:43 -04:00
|
|
|
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
|
|
|
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
|
|
|
|
if(!RsCameraBeginUpdate(Scene.camera))
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-01-07 09:23:09 -05:00
|
|
|
#ifdef PS2_SAVE_DIALOG
|
|
|
|
if (FrontEndMenuManager.m_bMenuActive)
|
|
|
|
DefinedState();
|
|
|
|
#endif
|
2019-05-31 05:44:43 -04:00
|
|
|
RenderMenus();
|
|
|
|
DoFade();
|
|
|
|
Render2dStuffAfterFade();
|
|
|
|
CCredits::Render();
|
|
|
|
DoRWStuffEndOfFrame();
|
|
|
|
|
|
|
|
// if(g_SlowMode)
|
|
|
|
// ProcessSlowMode();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
FrontendIdle(void)
|
|
|
|
{
|
2019-07-03 07:13:55 -04:00
|
|
|
#ifdef ASPECT_RATIO_SCALE
|
|
|
|
CDraw::SetAspectRatio(CDraw::FindAspectRatio());
|
|
|
|
#endif
|
|
|
|
|
2019-05-31 05:44:43 -04:00
|
|
|
CTimer::Update();
|
2020-01-07 09:23:09 -05:00
|
|
|
CSprite2d::SetRecipNearClip(); // this should be on InitialiseRenderWare according to PS2 asm. seems like a bug fix
|
2019-05-31 05:44:43 -04:00
|
|
|
CSprite2d::InitPerFrame();
|
|
|
|
CFont::InitPerFrame();
|
|
|
|
CPad::UpdatePads();
|
|
|
|
FrontEndMenuManager.Process();
|
|
|
|
|
|
|
|
if(RsGlobal.quit)
|
|
|
|
return;
|
|
|
|
|
2019-07-03 07:13:55 -04:00
|
|
|
float viewWindow = DEFAULT_VIEWWINDOW;
|
2019-10-07 08:08:39 -04:00
|
|
|
#ifdef ASPECT_RATIO_SCALE
|
|
|
|
CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO);
|
|
|
|
#else
|
2019-07-03 07:13:55 -04:00
|
|
|
CameraSize(Scene.camera, nil, viewWindow, DEFAULT_ASPECT_RATIO);
|
2019-10-07 08:08:39 -04:00
|
|
|
#endif
|
2019-05-31 05:44:43 -04:00
|
|
|
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
|
|
|
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
|
|
|
|
if(!RsCameraBeginUpdate(Scene.camera))
|
|
|
|
return;
|
|
|
|
|
2020-01-07 09:23:09 -05:00
|
|
|
DefinedState(); // seems redundant, but breaks resolution change.
|
2019-05-31 05:44:43 -04:00
|
|
|
RenderMenus();
|
|
|
|
DoFade();
|
|
|
|
Render2dStuffAfterFade();
|
2020-01-07 09:23:09 -05:00
|
|
|
// CFont::DrawFonts(); // redundant
|
2019-05-31 05:44:43 -04:00
|
|
|
DoRWStuffEndOfFrame();
|
|
|
|
}
|
|
|
|
|
2019-06-01 17:17:39 -04:00
|
|
|
bool
|
|
|
|
DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha)
|
|
|
|
{
|
|
|
|
CRGBA TopColor(TopRed, TopGreen, TopBlue, Alpha);
|
|
|
|
CRGBA BottomColor(BottomRed, BottomGreen, BottomBlue, Alpha);
|
|
|
|
|
2019-07-03 07:13:55 -04:00
|
|
|
CameraSize(Scene.camera, nil, DEFAULT_VIEWWINDOW, SCREEN_ASPECT_RATIO);
|
2019-06-01 17:17:39 -04:00
|
|
|
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
|
|
|
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
|
|
|
|
|
|
|
|
if(!RsCameraBeginUpdate(Scene.camera))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
CSprite2d::InitPerFrame();
|
|
|
|
|
|
|
|
if(Alpha != 0)
|
2019-07-03 11:26:15 -04:00
|
|
|
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), BottomColor, BottomColor, TopColor, TopColor);
|
2019-06-01 17:17:39 -04:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-05-31 05:44:43 -04:00
|
|
|
bool
|
|
|
|
DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha)
|
|
|
|
{
|
2019-07-03 07:13:55 -04:00
|
|
|
CameraSize(Scene.camera, nil, DEFAULT_VIEWWINDOW, SCREEN_ASPECT_RATIO);
|
2019-05-31 05:44:43 -04:00
|
|
|
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
|
|
|
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
|
|
|
|
|
|
|
|
if(!RsCameraBeginUpdate(Scene.camera))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
TheCamera.m_viewMatrix.Update();
|
|
|
|
CClouds::RenderBackground(TopRed, TopGreen, TopBlue, BottomRed, BottomGreen, BottomBlue, Alpha);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
DoRWStuffEndOfFrame(void)
|
|
|
|
{
|
2020-03-22 10:23:40 -04:00
|
|
|
CDebug::DebugDisplayTextBuffer();
|
2019-05-31 05:44:43 -04:00
|
|
|
// FlushObrsPrintfs();
|
|
|
|
RwCameraEndUpdate(Scene.camera);
|
|
|
|
RsCameraShowRaster(Scene.camera);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-30 15:24:47 -04:00
|
|
|
// This is certainly a very useful function
|
|
|
|
void
|
|
|
|
DoRWRenderHorizon(void)
|
2019-05-15 10:52:37 -04:00
|
|
|
{
|
2019-05-30 15:24:47 -04:00
|
|
|
CClouds::RenderHorizon();
|
2019-05-15 10:52:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2019-05-30 15:24:47 -04:00
|
|
|
RenderScene(void)
|
2019-05-15 10:52:37 -04:00
|
|
|
{
|
2019-05-30 15:24:47 -04:00
|
|
|
CClouds::Render();
|
|
|
|
DoRWRenderHorizon();
|
|
|
|
CRenderer::RenderRoads();
|
|
|
|
CCoronas::RenderReflections();
|
|
|
|
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)TRUE);
|
|
|
|
CRenderer::RenderEverythingBarRoads();
|
|
|
|
CRenderer::RenderBoats();
|
|
|
|
DefinedState();
|
|
|
|
CWaterLevel::RenderWater();
|
|
|
|
CRenderer::RenderFadingInEntities();
|
|
|
|
CRenderer::RenderVehiclesButNotBoats();
|
|
|
|
CWeather::RenderRainStreaks();
|
2019-05-15 10:52:37 -04:00
|
|
|
}
|
|
|
|
|
2019-05-30 15:24:47 -04:00
|
|
|
void
|
|
|
|
RenderDebugShit(void)
|
2019-05-24 13:58:32 -04:00
|
|
|
{
|
2020-02-24 13:17:15 -05:00
|
|
|
CTheScripts::RenderTheScriptDebugLines();
|
2019-07-19 07:58:19 -04:00
|
|
|
if(gbShowCollisionLines)
|
|
|
|
CRenderer::RenderCollisionLines();
|
2019-05-24 13:58:32 -04:00
|
|
|
}
|
|
|
|
|
2019-05-30 15:24:47 -04:00
|
|
|
void
|
|
|
|
RenderEffects(void)
|
2019-05-15 10:52:37 -04:00
|
|
|
{
|
2019-05-30 15:24:47 -04:00
|
|
|
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-05-15 10:52:37 -04:00
|
|
|
}
|
|
|
|
|
2019-05-30 15:24:47 -04:00
|
|
|
void
|
|
|
|
Render2dStuff(void)
|
2019-05-15 10:52:37 -04:00
|
|
|
{
|
2019-05-30 15:24:47 -04: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);
|
|
|
|
|
|
|
|
CReplay::Display();
|
|
|
|
CPickups::RenderPickUpText();
|
|
|
|
|
|
|
|
if(TheCamera.m_WideScreenOn)
|
|
|
|
TheCamera.DrawBordersForWideScreen();
|
|
|
|
|
|
|
|
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 ||
|
2019-10-26 23:17:30 -04:00
|
|
|
cammode == CCam::MODE_SNIPER_RUNABOUT ||
|
|
|
|
cammode == CCam::MODE_ROCKETLAUNCHER ||
|
|
|
|
cammode == CCam::MODE_ROCKETLAUNCHER_RUNABOUT)
|
2019-05-30 15:24:47 -04:00
|
|
|
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
|
2019-06-16 20:10:55 -04:00
|
|
|
if (weaponType == WEAPONTYPE_ROCKETLAUNCHER) {
|
2019-07-03 11:26:15 -04:00
|
|
|
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);
|
2019-06-16 20:10:55 -04:00
|
|
|
}
|
|
|
|
else {
|
2019-07-03 11:26:15 -04:00
|
|
|
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);
|
2019-05-30 15:24:47 -04:00
|
|
|
}
|
2019-07-03 11:26:15 -04:00
|
|
|
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-05-15 10:52:37 -04:00
|
|
|
}
|
|
|
|
|
2019-05-30 15:24:47 -04:00
|
|
|
MusicManager.DisplayRadioStationName();
|
2020-03-22 10:23:40 -04:00
|
|
|
TheConsole.Display();
|
2019-05-30 15:24:47 -04:00
|
|
|
/*
|
|
|
|
if(CSceneEdit::m_bEditOn)
|
|
|
|
CSceneEdit::Draw();
|
|
|
|
else
|
|
|
|
*/
|
|
|
|
CHud::Draw();
|
|
|
|
CUserDisplay::OnscnTimer.ProcessForDisplay();
|
|
|
|
CMessages::Display();
|
|
|
|
CDarkel::DrawMessages();
|
|
|
|
CGarages::PrintMessages();
|
|
|
|
CPad::PrintErrorMessage();
|
|
|
|
CFont::DrawFonts();
|
2019-05-31 05:44:43 -04:00
|
|
|
|
|
|
|
DebugMenuRender();
|
2019-05-15 10:52:37 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2019-05-30 15:24:47 -04:00
|
|
|
RenderMenus(void)
|
2019-05-15 10:52:37 -04:00
|
|
|
{
|
2019-05-30 15:24:47 -04:00
|
|
|
if(FrontEndMenuManager.m_bMenuActive)
|
|
|
|
FrontEndMenuManager.DrawFrontEnd();
|
|
|
|
}
|
2019-05-15 10:52:37 -04:00
|
|
|
|
2019-05-30 15:24:47 -04:00
|
|
|
bool &JustLoadedDontFadeInYet = *(bool*)0x95CDB4;
|
|
|
|
bool &StillToFadeOut = *(bool*)0x95CD99;
|
2019-05-31 05:44:43 -04:00
|
|
|
uint32 &TimeStartedCountingForFade = *(uint32*)0x9430EC;
|
|
|
|
uint32 &TimeToStayFadedBeforeFadeOut = *(uint32*)0x611564;
|
2019-05-15 10:52:37 -04:00
|
|
|
|
2019-05-30 15:24:47 -04:00
|
|
|
void
|
|
|
|
DoFade(void)
|
|
|
|
{
|
|
|
|
if(CTimer::GetIsPaused())
|
|
|
|
return;
|
2019-05-15 10:52:37 -04:00
|
|
|
|
2019-05-30 15:24:47 -04:00
|
|
|
if(JustLoadedDontFadeInYet){
|
|
|
|
JustLoadedDontFadeInYet = false;
|
|
|
|
TimeStartedCountingForFade = CTimer::GetTimeInMilliseconds();
|
|
|
|
}
|
2019-05-15 10:52:37 -04:00
|
|
|
|
2019-05-30 15:24:47 -04:00
|
|
|
if(StillToFadeOut){
|
|
|
|
if(CTimer::GetTimeInMilliseconds() - TimeStartedCountingForFade > TimeToStayFadedBeforeFadeOut){
|
|
|
|
StillToFadeOut = false;
|
2019-05-31 05:44:43 -04:00
|
|
|
TheCamera.Fade(3.0f, FADE_IN);
|
2019-05-30 15:24:47 -04:00
|
|
|
TheCamera.ProcessFade();
|
|
|
|
TheCamera.ProcessMusicFade();
|
|
|
|
}else{
|
|
|
|
TheCamera.SetFadeColour(0, 0, 0);
|
2019-05-31 05:44:43 -04:00
|
|
|
TheCamera.Fade(0.0f, FADE_OUT);
|
2019-05-30 15:24:47 -04:00
|
|
|
TheCamera.ProcessFade();
|
|
|
|
}
|
|
|
|
}
|
2019-05-15 10:52:37 -04:00
|
|
|
|
2019-05-30 15:24:47 -04:00
|
|
|
if(CDraw::FadeValue != 0 || CMenuManager::m_PrefsBrightness < 256){
|
2019-06-01 17:17:39 -04:00
|
|
|
CSprite2d *splash = LoadSplash(nil);
|
2019-05-15 10:52:37 -04:00
|
|
|
|
2019-05-30 15:24:47 -04:00
|
|
|
CRGBA fadeColor;
|
|
|
|
CRect rect;
|
|
|
|
int fadeValue = CDraw::FadeValue;
|
|
|
|
float brightness = min(CMenuManager::m_PrefsBrightness, 256);
|
|
|
|
if(brightness <= 50)
|
|
|
|
brightness = 50;
|
|
|
|
if(FrontEndMenuManager.m_bMenuActive)
|
|
|
|
brightness = 256;
|
|
|
|
|
|
|
|
if(TheCamera.m_FadeTargetIsSplashScreen)
|
|
|
|
fadeValue = 0;
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(TheCamera.m_WideScreenOn){
|
|
|
|
// what's this?
|
2019-07-03 11:26:15 -04:00
|
|
|
float y = SCREEN_HEIGHT/2 * TheCamera.m_ScreenReductionPercentage/100.0f;
|
2019-05-30 15:24:47 -04:00
|
|
|
rect.left = 0.0f;
|
2019-07-03 11:26:15 -04:00
|
|
|
rect.right = SCREEN_WIDTH;
|
2019-05-30 15:24:47 -04:00
|
|
|
rect.top = y - 8.0f;
|
2019-07-03 11:26:15 -04:00
|
|
|
rect.bottom = SCREEN_HEIGHT - y - 8.0f;
|
2019-05-30 15:24:47 -04:00
|
|
|
}else{
|
|
|
|
rect.left = 0.0f;
|
2019-07-03 11:26:15 -04:00
|
|
|
rect.right = SCREEN_WIDTH;
|
2019-05-30 15:24:47 -04:00
|
|
|
rect.top = 0.0f;
|
2019-07-03 11:26:15 -04:00
|
|
|
rect.bottom = SCREEN_HEIGHT;
|
2019-05-30 15:24:47 -04:00
|
|
|
}
|
|
|
|
CSprite2d::DrawRect(rect, fadeColor);
|
|
|
|
|
|
|
|
if(CDraw::FadeValue != 0 && TheCamera.m_FadeTargetIsSplashScreen){
|
|
|
|
fadeColor.r = 255;
|
|
|
|
fadeColor.g = 255;
|
|
|
|
fadeColor.b = 255;
|
|
|
|
fadeColor.a = CDraw::FadeValue;
|
2019-07-03 11:26:15 -04:00
|
|
|
splash->Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), fadeColor, fadeColor, fadeColor, fadeColor);
|
2019-05-30 15:24:47 -04:00
|
|
|
}
|
2019-05-15 10:52:37 -04:00
|
|
|
}
|
2019-05-30 15:24:47 -04:00
|
|
|
}
|
2019-05-15 10:52:37 -04:00
|
|
|
|
2019-07-24 12:55:43 -04:00
|
|
|
float FramesPerSecondCounter;
|
|
|
|
int32 FrameSamples;
|
|
|
|
|
|
|
|
struct tZonePrint
|
|
|
|
{
|
|
|
|
char name[12];
|
|
|
|
CRect rect;
|
|
|
|
};
|
|
|
|
|
|
|
|
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 13:30:09 -04:00
|
|
|
static bool bDisplayRate = false;
|
2019-07-24 12:55:43 -04:00
|
|
|
|
|
|
|
{
|
|
|
|
SETTWEAKPATH("GameDebugText");
|
|
|
|
TWEAKBOOL(bDisplayPosn);
|
|
|
|
TWEAKBOOL(bDisplayRate);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
char str[200];
|
|
|
|
wchar ustr[200];
|
|
|
|
wchar ver[200];
|
|
|
|
|
|
|
|
AsciiToUnicode(version_name, ver);
|
|
|
|
|
|
|
|
CFont::SetPropOn();
|
|
|
|
CFont::SetBackgroundOff();
|
|
|
|
CFont::SetFontStyle(FONT_BANK);
|
|
|
|
CFont::SetScale(SCREEN_STRETCH_X(0.5f), SCREEN_STRETCH_Y(0.5f));
|
|
|
|
CFont::SetCentreOff();
|
|
|
|
CFont::SetRightJustifyOff();
|
|
|
|
CFont::SetWrapx(SCREEN_WIDTH);
|
|
|
|
CFont::SetJustifyOff();
|
|
|
|
CFont::SetBackGroundOnlyTextOff();
|
|
|
|
CFont::SetColor(CRGBA(255, 108, 0, 255));
|
|
|
|
CFont::PrintString(10.0f, 10.0f, ver);
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-05-30 15:24:47 -04:00
|
|
|
void
|
|
|
|
Render2dStuffAfterFade(void)
|
|
|
|
{
|
2019-07-24 12:55:43 -04:00
|
|
|
#ifndef MASTER
|
|
|
|
DisplayGameDebugText();
|
|
|
|
//PrintGameVersion();
|
|
|
|
#endif
|
|
|
|
|
2019-05-30 15:24:47 -04:00
|
|
|
CHud::DrawAfterFade();
|
|
|
|
CFont::DrawFonts();
|
2019-05-15 10:52:37 -04:00
|
|
|
}
|
2019-05-30 15:24:47 -04:00
|
|
|
|
2019-06-01 17:17:39 -04:00
|
|
|
CSprite2d splash;
|
|
|
|
int splashTxdId = -1;
|
|
|
|
|
|
|
|
CSprite2d*
|
|
|
|
LoadSplash(const char *name)
|
|
|
|
{
|
|
|
|
RwTexDictionary *txd;
|
|
|
|
char filename[140];
|
|
|
|
RwTexture *tex = nil;
|
|
|
|
|
|
|
|
if(name == nil)
|
|
|
|
return &splash;
|
|
|
|
if(splashTxdId == -1)
|
|
|
|
splashTxdId = CTxdStore::AddTxdSlot("splash");
|
|
|
|
|
|
|
|
txd = CTxdStore::GetSlot(splashTxdId)->texDict;
|
|
|
|
if(txd)
|
|
|
|
tex = RwTexDictionaryFindNamedTexture(txd, name);
|
|
|
|
// if texture is found, splash was already set up below
|
|
|
|
|
|
|
|
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("");
|
|
|
|
}
|
|
|
|
|
|
|
|
return &splash;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
DestroySplashScreen(void)
|
|
|
|
{
|
|
|
|
splash.Delete();
|
|
|
|
if(splashTxdId != -1)
|
|
|
|
CTxdStore::RemoveTxdSlot(splashTxdId);
|
|
|
|
splashTxdId = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
float NumberOfChunksLoaded;
|
|
|
|
#define TOTALNUMCHUNKS 73.0f
|
|
|
|
|
2020-03-22 10:23:40 -04:00
|
|
|
void
|
|
|
|
ResetLoadingScreenBar()
|
|
|
|
{
|
|
|
|
NumberOfChunksLoaded = 0.0f;
|
|
|
|
}
|
|
|
|
|
2019-06-01 17:17:39 -04:00
|
|
|
// TODO: compare with PS2
|
|
|
|
void
|
2019-06-02 04:31:40 -04:00
|
|
|
LoadingScreen(const char *str1, const char *str2, const char *splashscreen)
|
2019-06-01 17:17:39 -04:00
|
|
|
{
|
|
|
|
CSprite2d *splash;
|
|
|
|
|
|
|
|
#ifndef RANDOMSPLASH
|
|
|
|
if(CGame::frenchGame || CGame::germanGame || !CGame::nastyGame)
|
|
|
|
splashscreen = "mainsc2";
|
|
|
|
else
|
|
|
|
splashscreen = "mainsc1";
|
|
|
|
#endif
|
|
|
|
|
|
|
|
splash = LoadSplash(splashscreen);
|
|
|
|
|
|
|
|
if(RsGlobal.quit)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if(DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255)){
|
|
|
|
CSprite2d::SetRecipNearClip();
|
|
|
|
CSprite2d::InitPerFrame();
|
|
|
|
CFont::InitPerFrame();
|
|
|
|
DefinedState();
|
|
|
|
RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSCLAMP);
|
2019-07-03 11:26:15 -04:00
|
|
|
splash->Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, 255));
|
2019-06-01 17:17:39 -04:00
|
|
|
|
|
|
|
if(str1){
|
|
|
|
NumberOfChunksLoaded += 1;
|
|
|
|
|
2019-06-19 20:31:03 -04:00
|
|
|
float hpos = SCREEN_SCALE_X(40);
|
2019-07-03 11:26:15 -04:00
|
|
|
float length = SCREEN_WIDTH - SCREEN_SCALE_X(100);
|
|
|
|
float vpos = SCREEN_HEIGHT - SCREEN_SCALE_Y(13);
|
2019-06-19 20:31:03 -04:00
|
|
|
float height = SCREEN_SCALE_Y(7);
|
2019-06-01 17:17:39 -04:00
|
|
|
CSprite2d::DrawRect(CRect(hpos, vpos, hpos + length, vpos + height), CRGBA(40, 53, 68, 255));
|
|
|
|
|
|
|
|
length *= NumberOfChunksLoaded/TOTALNUMCHUNKS;
|
|
|
|
CSprite2d::DrawRect(CRect(hpos, vpos, hpos + length, vpos + height), CRGBA(81, 106, 137, 255));
|
|
|
|
|
|
|
|
// this is done by the game but is unused
|
2019-06-19 20:31:03 -04:00
|
|
|
CFont::SetScale(SCREEN_SCALE_X(2), SCREEN_SCALE_Y(2));
|
2019-06-01 17:17:39 -04:00
|
|
|
CFont::SetPropOn();
|
|
|
|
CFont::SetRightJustifyOn();
|
|
|
|
CFont::SetFontStyle(FONT_HEADING);
|
|
|
|
|
|
|
|
#ifdef CHATTYSPLASH
|
|
|
|
// my attempt
|
|
|
|
static wchar tmpstr[80];
|
2020-01-07 09:23:09 -05:00
|
|
|
float yscale = SCREEN_SCALE_Y(0.9f);
|
|
|
|
vpos -= 45*yscale;
|
|
|
|
CFont::SetScale(SCREEN_SCALE_X(0.75f), yscale);
|
2019-06-01 17:17:39 -04:00
|
|
|
CFont::SetPropOn();
|
|
|
|
CFont::SetRightJustifyOff();
|
|
|
|
CFont::SetFontStyle(FONT_BANK);
|
|
|
|
CFont::SetColor(CRGBA(255, 255, 255, 255));
|
|
|
|
AsciiToUnicode(str1, tmpstr);
|
|
|
|
CFont::PrintString(hpos, vpos, tmpstr);
|
2020-01-07 09:23:09 -05:00
|
|
|
vpos += 22*yscale;
|
2019-06-01 17:17:39 -04:00
|
|
|
AsciiToUnicode(str2, tmpstr);
|
|
|
|
CFont::PrintString(hpos, vpos, tmpstr);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
CFont::DrawFonts();
|
|
|
|
DoRWStuffEndOfFrame();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-06-28 16:23:55 -04:00
|
|
|
void
|
2019-06-28 13:23:28 -04:00
|
|
|
LoadingIslandScreen(const char *levelName)
|
|
|
|
{
|
2019-06-28 16:23:55 -04: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))
|
|
|
|
return;
|
|
|
|
|
|
|
|
CSprite2d::SetRecipNearClip();
|
|
|
|
CSprite2d::InitPerFrame();
|
|
|
|
CFont::InitPerFrame();
|
|
|
|
DefinedState();
|
|
|
|
col = CRGBA(255, 255, 255, 255);
|
2019-07-03 11:26:15 -04:00
|
|
|
splash->Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), col, col, col, col);
|
2019-06-28 16:23:55 -04:00
|
|
|
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));
|
2019-07-03 11:26:15 -04:00
|
|
|
CFont::PrintString(SCREEN_WIDTH - 20, SCREEN_STRETCH_FROM_BOTTOM(110.0f), TheText.Get("WELCOME"));
|
2019-06-28 16:23:55 -04:00
|
|
|
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));
|
2019-07-03 11:26:15 -04:00
|
|
|
CFont::PrintString(SCREEN_WIDTH-20, SCREEN_STRETCH_FROM_BOTTOM(80.0f), wstr);
|
2019-06-28 16:23:55 -04:00
|
|
|
CFont::DrawFonts();
|
|
|
|
DoRWStuffEndOfFrame();
|
2019-06-28 13:23:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
char*
|
|
|
|
GetLevelSplashScreen(int level)
|
|
|
|
{
|
|
|
|
static char *splashScreens[4] = {
|
|
|
|
nil,
|
|
|
|
"splash1",
|
|
|
|
"splash2",
|
|
|
|
"splash3",
|
|
|
|
};
|
|
|
|
|
|
|
|
return splashScreens[level];
|
|
|
|
}
|
|
|
|
|
2019-06-18 03:50:26 -04:00
|
|
|
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
|
|
|
|
};
|
|
|
|
|
|
|
|
index = splashIndex[4*index2 + CGeneral::GetRandomNumberInRange(0, 3)];
|
|
|
|
index2++;
|
|
|
|
if(index2 == 6)
|
|
|
|
index2 = 0;
|
|
|
|
sprintf(splashName, "loadsc%d", index);
|
|
|
|
return splashName;
|
|
|
|
}
|
|
|
|
|
2019-05-31 13:02:26 -04:00
|
|
|
#include "rwcore.h"
|
|
|
|
#include "rpworld.h"
|
|
|
|
#include "rpmatfx.h"
|
|
|
|
#include "rpskin.h"
|
|
|
|
#include "rphanim.h"
|
|
|
|
#include "rtbmp.h"
|
|
|
|
|
|
|
|
_TODO("temp, move this includes out of here")
|
|
|
|
|
|
|
|
static RwBool
|
|
|
|
PluginAttach(void)
|
|
|
|
{
|
2019-06-01 23:00:38 -04:00
|
|
|
if( !RpWorldPluginAttach() )
|
|
|
|
{
|
|
|
|
printf("Couldn't attach world plugin\n");
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
2019-05-31 13:02:26 -04:00
|
|
|
|
|
|
|
if( !RpSkinPluginAttach() )
|
2019-06-01 23:00:38 -04:00
|
|
|
{
|
|
|
|
printf("Couldn't attach RpSkin plugin\n");
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
2019-05-31 13:02:26 -04:00
|
|
|
|
|
|
|
if( !RpHAnimPluginAttach() )
|
2019-06-01 23:00:38 -04:00
|
|
|
{
|
|
|
|
printf("Couldn't attach RpHAnim plugin\n");
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
2019-05-31 13:02:26 -04:00
|
|
|
|
|
|
|
if( !NodeNamePluginAttach() )
|
2019-06-01 23:00:38 -04:00
|
|
|
{
|
|
|
|
printf("Couldn't attach node name plugin\n");
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
2019-05-31 13:02:26 -04:00
|
|
|
|
|
|
|
if( !CVisibilityPlugins::PluginAttach() )
|
2019-06-01 23:00:38 -04:00
|
|
|
{
|
|
|
|
printf("Couldn't attach visibility plugins\n");
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
2019-05-31 13:02:26 -04:00
|
|
|
|
|
|
|
if( !RpAnimBlendPluginAttach() )
|
2019-06-01 23:00:38 -04:00
|
|
|
{
|
|
|
|
printf("Couldn't attach RpAnimBlend plugin\n");
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
2019-05-31 13:02:26 -04:00
|
|
|
|
|
|
|
if( !RpMatFXPluginAttach() )
|
2019-06-01 23:00:38 -04:00
|
|
|
{
|
|
|
|
printf("Couldn't attach RpMatFX plugin\n");
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
2019-05-31 13:02:26 -04:00
|
|
|
|
2019-06-01 23:00:38 -04:00
|
|
|
return TRUE;
|
2019-05-31 13:02:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static RwBool
|
|
|
|
Initialise3D(void *param)
|
|
|
|
{
|
2019-06-01 23:00:38 -04:00
|
|
|
if (RsRwInitialise(param))
|
|
|
|
{
|
2019-06-12 06:34:22 -04:00
|
|
|
//
|
|
|
|
DebugMenuInit();
|
2019-06-27 04:58:51 -04:00
|
|
|
DebugMenuPopulate();
|
2019-06-12 06:34:22 -04:00
|
|
|
//
|
|
|
|
|
2019-06-01 23:00:38 -04:00
|
|
|
return CGame::InitialiseRenderWare();
|
|
|
|
}
|
2019-05-31 13:02:26 -04:00
|
|
|
|
2019-06-01 23:00:38 -04:00
|
|
|
return (FALSE);
|
2019-05-31 13:02:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
Terminate3D(void)
|
|
|
|
{
|
|
|
|
CGame::ShutdownRenderWare();
|
|
|
|
|
2019-06-01 23:00:38 -04:00
|
|
|
RsRwTerminate();
|
2019-05-31 13:02:26 -04:00
|
|
|
|
2019-06-01 23:00:38 -04:00
|
|
|
return;
|
2019-05-31 13:02:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
RsEventStatus
|
|
|
|
AppEventHandler(RsEvent event, void *param)
|
|
|
|
{
|
2019-06-01 23:00:38 -04:00
|
|
|
switch( event )
|
|
|
|
{
|
|
|
|
case rsINITIALISE:
|
|
|
|
{
|
2019-05-31 13:02:26 -04:00
|
|
|
CGame::InitialiseOnceBeforeRW();
|
2019-06-01 23:00:38 -04:00
|
|
|
return RsInitialise() ? rsEVENTPROCESSED : rsEVENTERROR;
|
|
|
|
}
|
2019-05-31 13:02:26 -04:00
|
|
|
|
2019-06-01 23:00:38 -04:00
|
|
|
case rsCAMERASIZE:
|
|
|
|
{
|
2019-06-12 13:18:24 -04:00
|
|
|
|
2019-06-12 13:05:06 -04:00
|
|
|
CameraSize(Scene.camera, (RwRect *)param,
|
2019-07-03 07:13:55 -04:00
|
|
|
DEFAULT_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
|
2019-06-01 23:00:38 -04:00
|
|
|
|
|
|
|
return rsEVENTPROCESSED;
|
|
|
|
}
|
2019-05-31 13:02:26 -04:00
|
|
|
|
2019-06-01 23:00:38 -04:00
|
|
|
case rsRWINITIALISE:
|
|
|
|
{
|
|
|
|
return Initialise3D(param) ? rsEVENTPROCESSED : rsEVENTERROR;
|
|
|
|
}
|
2019-05-31 13:02:26 -04:00
|
|
|
|
2019-06-01 23:00:38 -04:00
|
|
|
case rsRWTERMINATE:
|
|
|
|
{
|
|
|
|
Terminate3D();
|
2019-05-31 13:02:26 -04:00
|
|
|
|
2019-06-01 23:00:38 -04:00
|
|
|
return rsEVENTPROCESSED;
|
|
|
|
}
|
2019-05-31 13:02:26 -04:00
|
|
|
|
2019-06-01 23:00:38 -04:00
|
|
|
case rsTERMINATE:
|
|
|
|
{
|
|
|
|
CGame::FinalShutdown();
|
2019-05-31 13:02:26 -04:00
|
|
|
|
2019-06-01 23:00:38 -04:00
|
|
|
return rsEVENTPROCESSED;
|
|
|
|
}
|
2019-05-31 13:02:26 -04:00
|
|
|
|
2019-06-01 23:00:38 -04:00
|
|
|
case rsPLUGINATTACH:
|
|
|
|
{
|
|
|
|
return PluginAttach() ? rsEVENTPROCESSED : rsEVENTERROR;
|
|
|
|
}
|
2019-05-31 13:02:26 -04:00
|
|
|
|
2019-06-01 23:00:38 -04:00
|
|
|
case rsINPUTDEVICEATTACH:
|
|
|
|
{
|
|
|
|
AttachInputDevices();
|
2019-05-31 13:02:26 -04:00
|
|
|
|
2019-06-01 23:00:38 -04:00
|
|
|
return rsEVENTPROCESSED;
|
|
|
|
}
|
2019-05-31 13:02:26 -04:00
|
|
|
|
2019-06-01 23:00:38 -04:00
|
|
|
case rsIDLE:
|
|
|
|
{
|
|
|
|
Idle(param);
|
2019-05-31 13:02:26 -04:00
|
|
|
|
2019-06-01 23:00:38 -04:00
|
|
|
return rsEVENTPROCESSED;
|
|
|
|
}
|
2019-05-31 13:02:26 -04:00
|
|
|
|
2019-06-01 23:00:38 -04:00
|
|
|
case rsFRONTENDIDLE:
|
|
|
|
{
|
2020-01-07 09:23:09 -05:00
|
|
|
#ifdef PS2_SAVE_DIALOG
|
|
|
|
Idle((void*)1);
|
|
|
|
#else
|
2019-06-01 23:00:38 -04:00
|
|
|
FrontendIdle();
|
2020-01-07 09:23:09 -05:00
|
|
|
#endif
|
2019-05-31 13:02:26 -04:00
|
|
|
|
2019-06-01 23:00:38 -04:00
|
|
|
return rsEVENTPROCESSED;
|
|
|
|
}
|
2019-05-31 13:02:26 -04:00
|
|
|
|
2019-06-01 23:00:38 -04:00
|
|
|
case rsACTIVATE:
|
|
|
|
{
|
|
|
|
param ? DMAudio.ReacquireDigitalHandle() : DMAudio.ReleaseDigitalHandle();
|
2019-05-31 13:02:26 -04:00
|
|
|
|
2019-06-01 23:00:38 -04:00
|
|
|
return rsEVENTPROCESSED;
|
|
|
|
}
|
2019-05-31 13:02:26 -04:00
|
|
|
|
2019-08-15 10:51:39 -04:00
|
|
|
#ifndef MASTER
|
|
|
|
case rsANIMVIEWER:
|
|
|
|
{
|
|
|
|
TheModelViewer();
|
|
|
|
|
|
|
|
return rsEVENTPROCESSED;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-06-01 23:00:38 -04:00
|
|
|
default:
|
|
|
|
{
|
|
|
|
return rsEVENTNOTPROCESSED;
|
|
|
|
}
|
|
|
|
}
|
2019-05-31 13:02:26 -04:00
|
|
|
}
|
2019-05-30 15:24:47 -04:00
|
|
|
|
2019-06-24 20:34:29 -04:00
|
|
|
void PrintGameVersion()
|
|
|
|
{
|
|
|
|
CFont::SetPropOn();
|
|
|
|
CFont::SetBackgroundOff();
|
|
|
|
CFont::SetScale(SCREEN_SCALE_X(0.7f), SCREEN_SCALE_Y(0.5f));
|
|
|
|
CFont::SetCentreOff();
|
|
|
|
CFont::SetRightJustifyOff();
|
|
|
|
CFont::SetBackGroundOnlyTextOff();
|
|
|
|
CFont::SetFontStyle(FONT_BANK);
|
|
|
|
CFont::SetWrapx(SCREEN_WIDTH);
|
|
|
|
CFont::SetDropShadowPosition(0);
|
|
|
|
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
|
|
|
|
CFont::SetColor(CRGBA(235, 170, 50, 255));
|
|
|
|
|
|
|
|
strcpy(gString, "RE3");
|
|
|
|
AsciiToUnicode(gString, gUString);
|
|
|
|
CFont::PrintString(SCREEN_SCALE_X(10.5f), SCREEN_SCALE_Y(8.0f), gUString);
|
|
|
|
}
|
|
|
|
|
2019-07-24 12:55:43 -04:00
|
|
|
void
|
|
|
|
ValidateVersion()
|
|
|
|
{
|
|
|
|
int32 file = CFileMgr::OpenFile("models\\coll\\peds.col", "rb");
|
|
|
|
char buff[128];
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
LoadingScreen("Invalid version", NULL, NULL);
|
|
|
|
|
|
|
|
while(true)
|
|
|
|
{
|
|
|
|
;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-05-30 15:24:47 -04:00
|
|
|
STARTPATCHES
|
2019-05-31 05:44:43 -04:00
|
|
|
InjectHook(0x48E480, Idle, PATCH_JUMP);
|
|
|
|
InjectHook(0x48E700, FrontendIdle, PATCH_JUMP);
|
|
|
|
|
2019-06-01 17:17:39 -04:00
|
|
|
InjectHook(0x48CF10, DoRWStuffStartOfFrame, PATCH_JUMP);
|
2019-05-31 05:44:43 -04:00
|
|
|
InjectHook(0x48D040, DoRWStuffStartOfFrame_Horizon, PATCH_JUMP);
|
2019-05-30 15:24:47 -04:00
|
|
|
InjectHook(0x48E030, RenderScene, PATCH_JUMP);
|
|
|
|
InjectHook(0x48E080, RenderDebugShit, PATCH_JUMP);
|
|
|
|
InjectHook(0x48E090, RenderEffects, PATCH_JUMP);
|
|
|
|
InjectHook(0x48E0E0, Render2dStuff, PATCH_JUMP);
|
|
|
|
InjectHook(0x48E450, RenderMenus, PATCH_JUMP);
|
|
|
|
InjectHook(0x48D120, DoFade, PATCH_JUMP);
|
|
|
|
InjectHook(0x48E470, Render2dStuffAfterFade, PATCH_JUMP);
|
2019-06-01 17:17:39 -04:00
|
|
|
|
|
|
|
InjectHook(0x48D550, LoadSplash, PATCH_JUMP);
|
|
|
|
InjectHook(0x48D670, DestroySplashScreen, PATCH_JUMP);
|
|
|
|
InjectHook(0x48D770, LoadingScreen, PATCH_JUMP);
|
|
|
|
InjectHook(0x48D760, ResetLoadingScreenBar, PATCH_JUMP);
|
2019-05-31 13:02:26 -04:00
|
|
|
|
|
|
|
InjectHook(0x48D470, PluginAttach, PATCH_JUMP);
|
|
|
|
InjectHook(0x48D520, Initialise3D, PATCH_JUMP);
|
|
|
|
InjectHook(0x48D540, Terminate3D, PATCH_JUMP);
|
|
|
|
InjectHook(0x48E800, AppEventHandler, PATCH_JUMP);
|
2019-05-30 15:24:47 -04:00
|
|
|
ENDPATCHES
|