mips overdose

This commit is contained in:
Fire-Head 2020-06-28 00:01:51 +03:00
parent 91fbfc1d23
commit 1c11a8081f
35 changed files with 9019 additions and 221 deletions

View File

@ -4738,11 +4738,11 @@ cAudioManager::ProcessFrontEnd()
m_sQueueSample.m_nSampleIndex = SFX_SUB_MENU_BACK_LEFT; m_sQueueSample.m_nSampleIndex = SFX_SUB_MENU_BACK_LEFT;
stereo = true; stereo = true;
break; break;
case SOUND_9A: case SOUND_FRONTEND_STEREO:
m_sQueueSample.m_nSampleIndex = SFX_STEREO_LEFT; m_sQueueSample.m_nSampleIndex = SFX_STEREO_LEFT;
stereo = true; stereo = true;
break; break;
case SOUND_9B: case SOUND_FRONTEND_MONO:
m_sQueueSample.m_nSampleIndex = SFX_MONO; m_sQueueSample.m_nSampleIndex = SFX_MONO;
break; break;
case SOUND_FRONTEND_AUDIO_TEST: case SOUND_FRONTEND_AUDIO_TEST:
@ -9337,9 +9337,9 @@ cAudioManager::SetCurrent3DProvider(uint8 which)
} }
void void
cAudioManager::SetDynamicAcousticModelingStatus(bool status) cAudioManager::SetDynamicAcousticModelingStatus(uint8 status)
{ {
m_bDynamicAcousticModelingStatus = status; m_bDynamicAcousticModelingStatus = status!=0;
} }
void void
@ -9370,6 +9370,12 @@ cAudioManager::SetMissionAudioLocation(float x, float y, float z)
} }
} }
void
cAudioManager::SetMonoMode(uint8 mono)
{
SampleManager.SetMonoMode(mono);
}
void void
cAudioManager::SetMusicFadeVolume(uint8 volume) const cAudioManager::SetMusicFadeVolume(uint8 volume) const
{ {

View File

@ -433,14 +433,14 @@ public:
void ServicePoliceRadioChannel(int32 wantedLevel); void ServicePoliceRadioChannel(int32 wantedLevel);
void ServiceSoundEffects(); void ServiceSoundEffects();
int8 SetCurrent3DProvider(uint8 which); int8 SetCurrent3DProvider(uint8 which);
void SetDynamicAcousticModelingStatus(bool status); void SetDynamicAcousticModelingStatus(uint8 status);
void SetEffectsFadeVolume(uint8 volume) const; void SetEffectsFadeVolume(uint8 volume) const;
void SetEffectsMasterVolume(uint8 volume) const; void SetEffectsMasterVolume(uint8 volume) const;
void SetEntityStatus(int32 id, uint8 status); void SetEntityStatus(int32 id, uint8 status);
uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision); uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision);
void SetMissionAudioLocation(float x, float y, float z); void SetMissionAudioLocation(float x, float y, float z);
void SetMissionScriptPoliceAudio(int32 sfx) const; void SetMissionScriptPoliceAudio(int32 sfx) const;
void SetMonoMode(uint8); // todo (mobile) void SetMonoMode(uint8 mono);
void SetMusicFadeVolume(uint8 volume) const; void SetMusicFadeVolume(uint8 volume) const;
void SetMusicMasterVolume(uint8 volume) const; void SetMusicMasterVolume(uint8 volume) const;
void SetSpeakerConfig(int32 conf) const; void SetSpeakerConfig(int32 conf) const;

View File

@ -58,6 +58,12 @@ cDMAudio::DestroyAllGameCreatedEntities(void)
AudioManager.DestroyAllGameCreatedEntities(); AudioManager.DestroyAllGameCreatedEntities();
} }
void
cDMAudio::SetMonoMode(uint8 mono)
{
AudioManager.SetMonoMode(mono);
}
void void
cDMAudio::SetEffectsMasterVolume(uint8 volume) cDMAudio::SetEffectsMasterVolume(uint8 volume)
{ {

View File

@ -26,6 +26,7 @@ public:
void PlayOneShot(int32 audioEntity, uint16 oneShot, float volume); void PlayOneShot(int32 audioEntity, uint16 oneShot, float volume);
void DestroyAllGameCreatedEntities(void); void DestroyAllGameCreatedEntities(void);
void SetMonoMode(uint8 mono);
void SetEffectsMasterVolume(uint8 volume); void SetEffectsMasterVolume(uint8 volume);
void SetMusicMasterVolume(uint8 volume); void SetMusicMasterVolume(uint8 volume);
void SetEffectsFadeVol(uint8 volume); void SetEffectsFadeVol(uint8 volume);

View File

@ -156,8 +156,8 @@ enum eSound : int16
SOUND_FRONTEND_MENU_DENIED = 151, SOUND_FRONTEND_MENU_DENIED = 151,
SOUND_FRONTEND_MENU_SUCCESS = 152, SOUND_FRONTEND_MENU_SUCCESS = 152,
SOUND_FRONTEND_EXIT = 153, SOUND_FRONTEND_EXIT = 153,
SOUND_9A = 154, SOUND_FRONTEND_STEREO = 154,
SOUND_9B = 155, SOUND_FRONTEND_MONO = 155,
SOUND_FRONTEND_AUDIO_TEST = 156, SOUND_FRONTEND_AUDIO_TEST = 156,
SOUND_FRONTEND_FAIL = 157, SOUND_FRONTEND_FAIL = 157,
SOUND_FRONTEND_NO_RADIO = 158, SOUND_FRONTEND_NO_RADIO = 158,

View File

@ -119,7 +119,7 @@ CGameLogic::Update()
RestorePlayerStuffDuringResurrection(pPlayerInfo.m_pPed, vecRestartPos, fRestartFloat); RestorePlayerStuffDuringResurrection(pPlayerInfo.m_pPed, vecRestartPos, fRestartFloat);
SortOutStreamingAndMemory(pPlayerInfo.GetPos()); SortOutStreamingAndMemory(pPlayerInfo.GetPos());
TheCamera.m_fCamShakeForce = 0.0f; TheCamera.m_fCamShakeForce = 0.0f;
TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE); TheCamera.SetMotionBlur(0, 0, 0, 0, MOTION_BLUR_NONE);
CPad::GetPad(0)->StopShaking(0); CPad::GetPad(0)->StopShaking(0);
CReferences::RemoveReferencesToPlayer(); CReferences::RemoveReferencesToPlayer();
CCarCtrl::CountDownToCarsAtStart = 2; CCarCtrl::CountDownToCarsAtStart = 2;
@ -191,7 +191,7 @@ CGameLogic::Update()
pPlayerInfo.m_pPed->ClearWeapons(); pPlayerInfo.m_pPed->ClearWeapons();
SortOutStreamingAndMemory(pPlayerInfo.GetPos()); SortOutStreamingAndMemory(pPlayerInfo.GetPos());
TheCamera.m_fCamShakeForce = 0.0f; TheCamera.m_fCamShakeForce = 0.0f;
TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE); TheCamera.SetMotionBlur(0, 0, 0, 0, MOTION_BLUR_NONE);
CPad::GetPad(0)->StopShaking(0); CPad::GetPad(0)->StopShaking(0);
CReferences::RemoveReferencesToPlayer(); CReferences::RemoveReferencesToPlayer();
CCarCtrl::CountDownToCarsAtStart = 2; CCarCtrl::CountDownToCarsAtStart = 2;
@ -230,7 +230,7 @@ CGameLogic::Update()
RestorePlayerStuffDuringResurrection(pPlayerInfo.m_pPed, vecRestartPos, fRestartFloat); RestorePlayerStuffDuringResurrection(pPlayerInfo.m_pPed, vecRestartPos, fRestartFloat);
SortOutStreamingAndMemory(pPlayerInfo.GetPos()); SortOutStreamingAndMemory(pPlayerInfo.GetPos());
TheCamera.m_fCamShakeForce = 0.0f; TheCamera.m_fCamShakeForce = 0.0f;
TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE); TheCamera.SetMotionBlur(0, 0, 0, 0, MOTION_BLUR_NONE);
CPad::GetPad(0)->StopShaking(0); CPad::GetPad(0)->StopShaking(0);
CReferences::RemoveReferencesToPlayer(); CReferences::RemoveReferencesToPlayer();
CCarCtrl::CountDownToCarsAtStart = 2; CCarCtrl::CountDownToCarsAtStart = 2;

View File

@ -376,7 +376,7 @@ private:
enum { enum {
MAX_STACK_DEPTH = 6, MAX_STACK_DEPTH = 6, // 4 PS2
NUM_LOCAL_VARS = 16, NUM_LOCAL_VARS = 16,
NUM_TIMERS = 2 NUM_TIMERS = 2
}; };

View File

@ -2895,7 +2895,7 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float,
FOV /= (255.0f*CTimer::GetTimeStep() + 10000.0f) / 10000.0f; FOV /= (255.0f*CTimer::GetTimeStep() + 10000.0f) / 10000.0f;
} }
TheCamera.SetMotionBlur(180, 255, 180, 120, MBLUR_SNIPER); TheCamera.SetMotionBlur(180, 255, 180, 120, MOTION_BLUR_SNIPER);
if(FOV > DefaultFOV) if(FOV > DefaultFOV)
FOV = DefaultFOV; FOV = DefaultFOV;
@ -3009,7 +3009,7 @@ CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float
FOVSpeed = 0.0f; FOVSpeed = 0.0f;
} }
TheCamera.SetMotionBlur(180, 255, 180, 120, MBLUR_SNIPER); TheCamera.SetMotionBlur(180, 255, 180, 120, MOTION_BLUR_SNIPER);
if(FOV > DefaultFOV) if(FOV > DefaultFOV)
FOV = DefaultFOV; FOV = DefaultFOV;
@ -3644,7 +3644,7 @@ CCam::Process_Fixed(const CVector &CameraTarget, float, float, float)
if(TheCamera.m_bUseSpecialFovTrain) if(TheCamera.m_bUseSpecialFovTrain)
FOV = TheCamera.m_fFovForTrain; FOV = TheCamera.m_fFovForTrain;
if(CMenuManager::m_ControlMethod == 0 && Using3rdPersonMouseCam()){ if(CMenuManager::m_ControlMethod == CONTROL_STANDARD && Using3rdPersonMouseCam()){
CPed *player = FindPlayerPed(); CPed *player = FindPlayerPed();
if(player && player->CanStrafeOrMouseControl()){ if(player && player->CanStrafeOrMouseControl()){
float Heading = Front.Heading(); float Heading = Front.Heading();

View File

@ -30,6 +30,7 @@
#include "Pools.h" #include "Pools.h"
#include "Debug.h" #include "Debug.h"
#include "GenericGameStorage.h" #include "GenericGameStorage.h"
#include "MemoryCard.h"
#include "Camera.h" #include "Camera.h"
enum enum
@ -91,17 +92,28 @@ CCamera::Init(void)
float fMouseAccelHorzntl = m_fMouseAccelHorzntl; float fMouseAccelHorzntl = m_fMouseAccelHorzntl;
float fMouseAccelVertical = m_fMouseAccelVertical; float fMouseAccelVertical = m_fMouseAccelVertical;
#endif #endif
#ifdef FIX_BUGS
static const CCamera DummyCamera = CCamera(0.f); #ifdef PS2_MENU
*this = DummyCamera; if ( !TheMemoryCard.m_bWantToLoad && !FrontEndMenuManager.m_bWantToRestart ) {
#else
memset(this, 0, sizeof(CCamera)); // getting rid of vtable, eh?
#endif #endif
#ifdef GTA3_1_1_PATCH
m_fMouseAccelHorzntl = fMouseAccelHorzntl; #ifdef FIX_BUGS
m_fMouseAccelVertical = fMouseAccelVertical; static const CCamera DummyCamera = CCamera(0.f);
*this = DummyCamera;
#else
memset(this, 0, sizeof(CCamera)); // getting rid of vtable, eh?
#endif
#ifdef GTA3_1_1_PATCH
m_fMouseAccelHorzntl = fMouseAccelHorzntl;
m_fMouseAccelVertical = fMouseAccelVertical;
#endif
m_pRwCamera = nil;
#ifdef PS2_MENU
}
#endif #endif
m_pRwCamera = nil;
m_1rstPersonRunCloseToAWall = false; m_1rstPersonRunCloseToAWall = false;
m_fPositionAlongSpline = 0.0f; m_fPositionAlongSpline = 0.0f;
m_bCameraJustRestored = false; m_bCameraJustRestored = false;
@ -168,7 +180,12 @@ CCamera::Init(void)
PlayerExhaustion = 1.0f; PlayerExhaustion = 1.0f;
DebugCamMode = CCam::MODE_NONE; DebugCamMode = CCam::MODE_NONE;
m_PedOrientForBehindOrInFront = 0.0f; m_PedOrientForBehindOrInFront = 0.0f;
if(!FrontEndMenuManager.m_bWantToRestart){ #ifdef PS2_MENU
if ( !TheMemoryCard.m_bWantToLoad && !FrontEndMenuManager.m_bWantToRestart )
#else
if(!FrontEndMenuManager.m_bWantToRestart)
#endif
{
m_bFading = false; m_bFading = false;
CDraw::FadeValue = 0; CDraw::FadeValue = 0;
m_fFLOATingFade = 0.0f; m_fFLOATingFade = 0.0f;
@ -177,7 +194,11 @@ CCamera::Init(void)
m_fFLOATingFadeMusic = 0.0f; m_fFLOATingFadeMusic = 0.0f;
} }
m_bMoveCamToAvoidGeom = false; m_bMoveCamToAvoidGeom = false;
#ifdef PS2_MENU
if ( TheMemoryCard.m_bWantToLoad || FrontEndMenuManager.m_bWantToRestart )
#else
if(FrontEndMenuManager.m_bWantToRestart) if(FrontEndMenuManager.m_bWantToRestart)
#endif
m_bMoveCamToAvoidGeom = true; m_bMoveCamToAvoidGeom = true;
m_bStartingSpline = false; m_bStartingSpline = false;
m_iTypeOfSwitch = INTERPOLATION; m_iTypeOfSwitch = INTERPOLATION;
@ -493,10 +514,10 @@ CCamera::Process(void)
GetMatrix().GetPosition().y += shakeOffset * (((shakeRand & 0xF0) >> 4) - 7); GetMatrix().GetPosition().y += shakeOffset * (((shakeRand & 0xF0) >> 4) - 7);
GetMatrix().GetPosition().z += shakeOffset * (((shakeRand & 0xF00) >> 8) - 7); GetMatrix().GetPosition().z += shakeOffset * (((shakeRand & 0xF00) >> 8) - 7);
if(shakeOffset > 0.0f && m_BlurType != MBLUR_SNIPER) if(shakeOffset > 0.0f && m_BlurType != MOTION_BLUR_SNIPER)
SetMotionBlurAlpha(Min((int)(shakeStrength*255.0f) + 25, 150)); SetMotionBlurAlpha(Min((int)(shakeStrength*255.0f) + 25, 150));
if(Cams[ActiveCam].Mode == CCam::MODE_1STPERSON && FindPlayerVehicle() && FindPlayerVehicle()->GetUp().z < 0.2f) if(Cams[ActiveCam].Mode == CCam::MODE_1STPERSON && FindPlayerVehicle() && FindPlayerVehicle()->GetUp().z < 0.2f)
SetMotionBlur(230, 230, 230, 215, MBLUR_NORMAL); SetMotionBlur(230, 230, 230, 215, MOTION_BLUR_LIGHT_SCENE);
CalculateDerivedValues(); CalculateDerivedValues();
CDraw::SetFOV(FOV); CDraw::SetFOV(FOV);
@ -2208,7 +2229,7 @@ CCamera::ProcessWideScreenOn(void)
void void
CCamera::DrawBordersForWideScreen(void) CCamera::DrawBordersForWideScreen(void)
{ {
if(m_BlurType == MBLUR_NONE || m_BlurType == MBLUR_NORMAL) if(m_BlurType == MOTION_BLUR_NONE || m_BlurType == MOTION_BLUR_LIGHT_SCENE)
SetMotionBlurAlpha(80); SetMotionBlurAlpha(80);
CSprite2d::DrawRect( CSprite2d::DrawRect(
@ -3102,7 +3123,11 @@ CCamera::ProcessMusicFade(void)
if(m_fTimeToFadeMusic == 0.0f) if(m_fTimeToFadeMusic == 0.0f)
m_fTimeToFadeMusic = 1.0f; m_fTimeToFadeMusic = 1.0f;
#ifdef PS2_MENU
if(m_bMoveCamToAvoidGeom || TheMemoryCard.StillToFadeOut){
#else
if(m_bMoveCamToAvoidGeom || StillToFadeOut){ if(m_bMoveCamToAvoidGeom || StillToFadeOut){
#endif
m_fFLOATingFadeMusic = 256.0f; m_fFLOATingFadeMusic = 256.0f;
m_bMoveCamToAvoidGeom = false; m_bMoveCamToAvoidGeom = false;
}else }else

View File

@ -312,16 +312,16 @@ enum
enum enum
{ {
MBLUR_NONE, MOTION_BLUR_NONE = 0,
MBLUR_SNIPER, MOTION_BLUR_SNIPER,
MBLUR_NORMAL, MOTION_BLUR_LIGHT_SCENE,
MBLUR_INTRO1, // green camera MOTION_BLUR_SECURITY_CAM,
MBLUR_INTRO2, // unused MOTION_BLUR_CUT_SCENE,
MBLUR_INTRO3, // bank scene MOTION_BLUR_INTRO,
MBLUR_INTRO4, // jail break scene MOTION_BLUR_INTRO2,
MBLUR_INTRO5, // explosion MOTION_BLUR_SNIPER_ZOOM,
MBLUR_INTRO6, // player shot MOTION_BLUR_INTRO3,
MBLUR_UNUSED, // pinkish MOTION_BLUR_INTRO4,
}; };
enum enum

View File

@ -11,6 +11,7 @@ public:
static void SetDirMyDocuments(void); static void SetDirMyDocuments(void);
static int LoadFile(const char *file, uint8 *buf, int unused, const char *mode); static int LoadFile(const char *file, uint8 *buf, int unused, const char *mode);
static int OpenFile(const char *file, const char *mode); static int OpenFile(const char *file, const char *mode);
static int OpenFile(const char *file) { return OpenFile(file, "rb"); }
static int OpenFileForWriting(const char *file); static int OpenFileForWriting(const char *file);
static int Read(int fd, const char *buf, int len); static int Read(int fd, const char *buf, int len);
static int Write(int fd, const char *buf, int len); static int Write(int fd, const char *buf, int len);

View File

@ -1,15 +1,13 @@
#include "common.h" #include "common.h"
#include "main.h" #include "main.h"
#include "Timer.h" #include "Timer.h"
#include "Pad.h"
#include "ControllerConfig.h"
#include "VisibilityPlugins.h"
#include "Sprite2d.h" #include "Sprite2d.h"
#include "Text.h" #include "Text.h"
#include "Font.h" #include "Font.h"
#include "Frontend.h"
#include "FrontEndControls.h" #include "FrontEndControls.h"
#define X SCREEN_SCALE_X
#define Y(x) SCREEN_SCALE_Y(float(x)*(float(DEFAULT_SCREEN_HEIGHT)/float(DEFAULT_SCREEN_HEIGHT_PAL)))
void void
CPlaceableShText::Draw(float x, float y) CPlaceableShText::Draw(float x, float y)
@ -490,7 +488,7 @@ void
CMenuMultiChoiceTriggered::SelectCurrentOptionUnderCursor(void) CMenuMultiChoiceTriggered::SelectCurrentOptionUnderCursor(void)
{ {
CMenuMultiChoice::SelectCurrentOptionUnderCursor(); CMenuMultiChoice::SelectCurrentOptionUnderCursor();
if(m_cursor != -1) if(m_cursor != -1 && m_triggers[m_cursor] != NULL )
m_triggers[m_cursor](this); m_triggers[m_cursor](this);
} }
@ -581,7 +579,10 @@ CMenuMultiChoicePictured::Draw(const CRGBA &optionHighlight, const CRGBA &titleH
for(i = 0; i < m_numOptions; i++) for(i = 0; i < m_numOptions; i++)
if(i == m_cursor){ if(i == m_cursor){
if(m_bHasSprite[i]) if(m_bHasSprite[i])
m_sprites[i].Draw(CRGBA(255, 255, 255, 255), m_position.x+x, m_position.y+y); {
uint8 color = Max(Max(optionHighlight.r, optionHighlight.g), optionHighlight.b);
m_sprites[i].Draw(CRGBA(color, color, color, optionHighlight.a), m_position.x+x, m_position.y+y);
}
}else{ }else{
if(m_bHasSprite[i]){ if(m_bHasSprite[i]){
if(m_options[i].m_bSelected) if(m_options[i].m_bSelected)
@ -1210,10 +1211,10 @@ CMenuSlider::Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, flo
{ {
if(m_bActive){ if(m_bActive){
CRGBA selectionCol = m_colors[0]; CRGBA selectionCol = m_colors[0];
if(selectionCol.red == SELECTED_TEXT_COLOR_0.red && if(optionHighlight.red == SELECTED_TEXT_COLOR_0.red &&
selectionCol.green == SELECTED_TEXT_COLOR_0.green && optionHighlight.green == SELECTED_TEXT_COLOR_0.green &&
selectionCol.blue == SELECTED_TEXT_COLOR_0.blue && optionHighlight.blue == SELECTED_TEXT_COLOR_0.blue &&
selectionCol.alpha == SELECTED_TEXT_COLOR_0.alpha) optionHighlight.alpha == SELECTED_TEXT_COLOR_0.alpha)
selectionCol = m_colors[1]; selectionCol = m_colors[1];
if(m_style == 1){ if(m_style == 1){
@ -1223,10 +1224,10 @@ CMenuSlider::Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, flo
CVector2D boxPos = m_box.m_position + m_position + CVector2D(x,y); CVector2D boxPos = m_box.m_position + m_position + CVector2D(x,y);
if(m_box.m_bDropShadow) if(m_box.m_bDropShadow)
CSprite2d::DrawRect( CSprite2d::DrawRect(
CRect(boxPos.x + m_box.m_shadowOffset.x, CRect(boxPos.x + X(m_box.m_shadowOffset.x),
boxPos.y + m_box.m_shadowOffset.y, boxPos.y + Y(m_box.m_shadowOffset.y),
boxPos.x + m_box.m_shadowOffset.x + m_size[0].x, boxPos.x + X(m_box.m_shadowOffset.x) + m_size[0].x,
boxPos.y + m_box.m_shadowOffset.y + m_size[0].y), boxPos.y + Y(m_box.m_shadowOffset.y) + m_size[0].y),
shadowCol); shadowCol);
CSprite2d::DrawRect( CSprite2d::DrawRect(
CRect(boxPos.x, boxPos.y, CRect(boxPos.x, boxPos.y,
@ -1266,10 +1267,10 @@ CMenuSlider::DrawNormal(float x, float y)
CVector2D boxPos = m_box.m_position + m_position + CVector2D(x,y); CVector2D boxPos = m_box.m_position + m_position + CVector2D(x,y);
if(m_box.m_bDropShadow) if(m_box.m_bDropShadow)
CSprite2d::DrawRect( CSprite2d::DrawRect(
CRect(boxPos.x + m_box.m_shadowOffset.x, CRect(boxPos.x + X(m_box.m_shadowOffset.x),
boxPos.y + m_box.m_shadowOffset.y, boxPos.y + Y(m_box.m_shadowOffset.y),
boxPos.x + m_box.m_shadowOffset.x + m_size[0].x, boxPos.x + X(m_box.m_shadowOffset.x) + m_size[0].x,
boxPos.y + m_box.m_shadowOffset.y + m_size[0].y), boxPos.y + Y(m_box.m_shadowOffset.y) + m_size[0].y),
shadowCol); shadowCol);
CSprite2d::DrawRect( CSprite2d::DrawRect(
CRect(boxPos.x, boxPos.y, CRect(boxPos.x, boxPos.y,
@ -1312,10 +1313,10 @@ CMenuSlider::DrawHighlighted(const CRGBA &titleHighlight, float x, float y)
CVector2D boxPos = m_box.m_position + m_position + CVector2D(x,y); CVector2D boxPos = m_box.m_position + m_position + CVector2D(x,y);
if(m_box.m_bDropShadow) if(m_box.m_bDropShadow)
CSprite2d::DrawRect( CSprite2d::DrawRect(
CRect(boxPos.x + m_box.m_shadowOffset.x, CRect(boxPos.x + X(m_box.m_shadowOffset.x),
boxPos.y + m_box.m_shadowOffset.y, boxPos.y + Y(m_box.m_shadowOffset.y),
boxPos.x + m_box.m_shadowOffset.x + m_size[0].x, boxPos.x + X(m_box.m_shadowOffset.x) + m_size[0].x,
boxPos.y + m_box.m_shadowOffset.y + m_size[0].y), boxPos.y + Y(m_box.m_shadowOffset.y) + m_size[0].y),
shadowCol); shadowCol);
CSprite2d::DrawRect( CSprite2d::DrawRect(
CRect(boxPos.x, boxPos.y, CRect(boxPos.x, boxPos.y,
@ -1345,20 +1346,20 @@ void
CMenuSlider::DrawTicks(const CVector2D &position, const CVector2D &size, float heightRight, float level, const CRGBA &leftCol, const CRGBA &selCol, const CRGBA &rightCol, bool bShadow, const CVector2D &shadowOffset, const CRGBA &shadowColor) CMenuSlider::DrawTicks(const CVector2D &position, const CVector2D &size, float heightRight, float level, const CRGBA &leftCol, const CRGBA &selCol, const CRGBA &rightCol, bool bShadow, const CVector2D &shadowOffset, const CRGBA &shadowColor)
{ {
int i; int i;
int numTicks = size.x / 8.0f; int numTicks = size.x / X(8.0f);
float dy = heightRight - size.y; float dy = heightRight - size.y;
float stepy = dy / numTicks; float stepy = dy / numTicks;
int left = level*numTicks; int left = level*numTicks;
int drewSelection = 0; int drewSelection = 0;
for(i = 0; i < numTicks; i++){ for(i = 0; i < numTicks; i++){
CRect rect(position.x + 8.0f*i, position.y + dy - stepy*i, CRect rect(position.x + X(8.0f)*i, position.y + dy - stepy*i,
position.x + 8.0f*i + 4.0f, position.y + dy + size.y); position.x + X(8.0f)*i + X(4.0f), position.y + dy + size.y);
if(bShadow){ if(bShadow){
CRect shadowRect = rect; CRect shadowRect = rect;
shadowRect.left += shadowOffset.x; shadowRect.left += X(shadowOffset.x);
shadowRect.right += shadowOffset.x; shadowRect.right += X(shadowOffset.x);
shadowRect.top += shadowOffset.y; shadowRect.top += Y(shadowOffset.y);
shadowRect.bottom += shadowOffset.y; shadowRect.bottom += Y(shadowOffset.y);
CSprite2d::DrawRect(shadowRect, shadowColor); CSprite2d::DrawRect(shadowRect, shadowColor);
} }
if(i < left) if(i < left)
@ -1375,19 +1376,19 @@ void
CMenuSlider::DrawTicks(const CVector2D &position, const CVector2D &size, float heightRight, float level, const CRGBA &leftCol, const CRGBA &rightCol, bool bShadow, const CVector2D &shadowOffset, const CRGBA &shadowColor) CMenuSlider::DrawTicks(const CVector2D &position, const CVector2D &size, float heightRight, float level, const CRGBA &leftCol, const CRGBA &rightCol, bool bShadow, const CVector2D &shadowOffset, const CRGBA &shadowColor)
{ {
int i; int i;
int numTicks = size.x / 8.0f; int numTicks = size.x / X(8.0f);
float dy = heightRight - size.y; float dy = heightRight - size.y;
float stepy = dy / numTicks; float stepy = dy / numTicks;
int left = level*numTicks; int left = level*numTicks;
for(i = 0; i < numTicks; i++){ for(i = 0; i < numTicks; i++){
CRect rect(position.x + 8.0f*i, position.y + dy - stepy*i, CRect rect(position.x + X(8.0f)*i, position.y + dy - stepy*i,
position.x + 8.0f*i + 4.0f, position.y + dy + size.y); position.x + X(8.0f)*i + X(4.0f), position.y + dy + size.y);
if(bShadow){ if(bShadow){
CRect shadowRect = rect; CRect shadowRect = rect;
shadowRect.left += shadowOffset.x; shadowRect.left += X(shadowOffset.x);
shadowRect.right += shadowOffset.x; shadowRect.right += X(shadowOffset.x);
shadowRect.top += shadowOffset.y; shadowRect.top += Y(shadowOffset.y);
shadowRect.bottom += shadowOffset.y; shadowRect.bottom += Y(shadowOffset.y);
CSprite2d::DrawRect(shadowRect, shadowColor); CSprite2d::DrawRect(shadowRect, shadowColor);
} }
if(i < left) if(i < left)
@ -1553,7 +1554,7 @@ CMenuLineLister::Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight,
for(; i < n; i++){ for(; i < n; i++){
CVector2D linePos = m_linesLeft[i].m_position; CVector2D linePos = m_linesLeft[i].m_position;
if(linePos.y+m_position.y - (m_scrollPosition+m_position.y) < 64.0f) if(linePos.y+m_position.y - (m_scrollPosition+m_position.y) < Y(64.0f))
m_lineFade[i] = -4.0f*Abs(m_scrollSpeed); m_lineFade[i] = -4.0f*Abs(m_scrollSpeed);
else else
m_lineFade[i] = 4.0f*Abs(m_scrollSpeed); m_lineFade[i] = 4.0f*Abs(m_scrollSpeed);
@ -1652,7 +1653,12 @@ CMenuPage::ActiveMenuTwoState_SelectNextPosition(void)
if(sel == 1) if(sel == 1)
m_pCurrentControl->SelectCurrentOptionUnderCursor(); m_pCurrentControl->SelectCurrentOptionUnderCursor();
else if(sel == 0){ else if(sel == 0){
m_pCurrentControl->GoNext(); if ( m_pCurrentControl )
{
if ( !m_pCurrentControl->GoNext() )
m_pCurrentControl->GoFirst();
}
m_pCurrentControl->SelectCurrentOptionUnderCursor(); m_pCurrentControl->SelectCurrentOptionUnderCursor();
} }
} }

View File

@ -8,6 +8,41 @@ enum {
NUM_PAGE_WIDGETS = 10, NUM_PAGE_WIDGETS = 10,
}; };
class CTriggerCaller
{
bool bHasTrigger;
void *pTrigger;
void (*pFunc)(void *);
int field_C;
public:
CTriggerCaller() : bHasTrigger(false), pFunc(NULL)
{}
void SetTrigger(void *func, void *trigger)
{
if ( !bHasTrigger )
{
pFunc = (void (*)(void *))func;
pTrigger = trigger;
bHasTrigger = true;
}
}
void CallTrigger(void)
{
if ( bHasTrigger && pFunc != NULL )
pFunc(pTrigger);
bHasTrigger = false;
pFunc = NULL;
}
bool CanCall()
{
return bHasTrigger;
}
};
class CPlaceableText class CPlaceableText
{ {
@ -17,7 +52,7 @@ public:
wchar *m_text; wchar *m_text;
CPlaceableText(void) CPlaceableText(void)
: m_position(0.0f, 0.0f), m_color(255, 255, 255, 255) {} : m_position(0.0f, 0.0f), m_color(255, 255, 255, 255), m_text(NULL) {}
void SetPosition(float x, float y) { m_position.x = x; m_position.y = y; } void SetPosition(float x, float y) { m_position.x = x; m_position.y = y; }
void SetColor(const CRGBA &color) { m_color = color; } void SetColor(const CRGBA &color) { m_color = color; }
CRGBA GetColor(void) { return m_color; } CRGBA GetColor(void) { return m_color; }
@ -553,11 +588,14 @@ public:
static wchar Buf16[8]; static wchar Buf16[8];
CMenuSlider(void) CMenuSlider(void)
: m_value(0), m_bDrawPercentage(false), m_bActive(false), m_style(0) {} : m_value(0), m_bDrawPercentage(false), m_bActive(false), m_style(0)
{
AddTickBox(0.0f, 0.0f, 100.0f, 10.0f, 10.0f); //todo
}
void SetColors(const CRGBA &title, const CRGBA &percentage, const CRGBA &left, const CRGBA &right); void SetColors(const CRGBA &title, const CRGBA &percentage, const CRGBA &left, const CRGBA &right);
void DrawTicks(const CVector2D &position, const CVector2D &size, float heightRight, float level, const CRGBA &leftCol, const CRGBA &selCol, const CRGBA &rightCol, bool bShadow, const CVector2D &shadowOffset, const CRGBA &shadowColor); void DrawTicks(const CVector2D &position, const CVector2D &size, float heightRight, float level, const CRGBA &leftCol, const CRGBA &selCol, const CRGBA &rightCol, bool bShadow, const CVector2D &shadowOffset, const CRGBA &shadowColor);
void DrawTicks(const CVector2D &position, const CVector2D &size, float heightRight, float level, const CRGBA &leftCol, const CRGBA &rightCol, bool bShadow, const CVector2D &shadowOffset, const CRGBA &shadowColor); void DrawTicks(const CVector2D &position, const CVector2D &size, float heightRight, float level, const CRGBA &leftCol, const CRGBA &rightCol, bool bShadow, const CVector2D &shadowOffset, const CRGBA &shadowColor);
void AddTickBox(float positionX, float positionY, float width, float heigthLeft, float heightRight); void AddTickBox(float positionX, float positionY, float width, float heigthLeft, float heightRight);
void AddTitle(wchar *text, float positionX, float positionY); void AddTitle(wchar *text, float positionX, float positionY);

View File

@ -5,6 +5,7 @@
#define WITHWINDOWS #define WITHWINDOWS
#include "common.h" #include "common.h"
#ifndef PS2_MENU
#include "crossplatform.h" #include "crossplatform.h"
#include "platform.h" #include "platform.h"
#include "Frontend.h" #include "Frontend.h"
@ -5830,3 +5831,5 @@ uint8 CMenuManager::GetNumberOfMenuOptions()
#undef GetBackJustUp #undef GetBackJustUp
#undef GetBackJustDown #undef GetBackJustDown
#endif

View File

@ -1,4 +1,7 @@
#pragma once #pragma once
#ifdef PS2_MENU
#include "Frontend_PS2.h"
#else
#include "Sprite2d.h" #include "Sprite2d.h"
@ -81,20 +84,6 @@
#define CONTSETUP_BACK_BOTTOM 122.0f #define CONTSETUP_BACK_BOTTOM 122.0f
#define CONTSETUP_BACK_HEIGHT 25.0f #define CONTSETUP_BACK_HEIGHT 25.0f
enum eLanguages
{
LANGUAGE_AMERICAN,
LANGUAGE_FRENCH,
LANGUAGE_GERMAN,
LANGUAGE_ITALIAN,
LANGUAGE_SPANISH,
#ifdef MORE_LANGUAGES
LANGUAGE_POLISH,
LANGUAGE_RUSSIAN,
LANGUAGE_JAPANESE,
#endif
};
enum eFrontendSprites enum eFrontendSprites
{ {
FE2_MAINPANEL_UL, FE2_MAINPANEL_UL,
@ -545,6 +534,19 @@ public:
int32 m_nSelectedScreenMode; int32 m_nSelectedScreenMode;
#endif #endif
enum LANGUAGE
{
LANGUAGE_AMERICAN,
LANGUAGE_FRENCH,
LANGUAGE_GERMAN,
LANGUAGE_ITALIAN,
LANGUAGE_SPANISH,
#ifdef MORE_LANGUAGES
LANGUAGE_POLISH,
LANGUAGE_RUSSIAN,
LANGUAGE_JAPANESE,
#endif
};
public: public:
bool GetIsMenuActive() {return !!m_bMenuActive;} bool GetIsMenuActive() {return !!m_bMenuActive;}
@ -662,3 +664,4 @@ VALIDATE_SIZE(CMenuManager, 0x564);
#endif #endif
extern CMenuManager FrontEndMenuManager; extern CMenuManager FrontEndMenuManager;
#endif

1393
src/core/FrontendTriggers.h Normal file

File diff suppressed because it is too large Load Diff

3034
src/core/Frontend_PS2.cpp Normal file

File diff suppressed because it is too large Load Diff

249
src/core/Frontend_PS2.h Normal file
View File

@ -0,0 +1,249 @@
#pragma once
#include "Sprite2d.h"
enum
{
PAGE_STATS,
PAGE_LOAD,
PAGE_BRIEFS,
PAGE_CONTROLS,
PAGE_AUDIO,
PAGE_DISPLAY,
PAGE_LANGUAGE,
NUM_PAGES,
PAGE_FIRST = PAGE_STATS,
PAGE_LAST = PAGE_LANGUAGE,
};
enum
{
PAGESTATE_NORMAL = 0,
PAGESTATE_HIGHLIGHTED,
PAGESTATE_SELECTED
};
enum eFrontendSprites
{
FE2_MAINPANEL_UL,
FE2_MAINPANEL_UR,
FE2_MAINPANEL_DL,
FE2_MAINPANEL_DR,
FE2_MAINPANEL_DR2,
FE2_TABACTIVE,
FE_ICONBRIEF,
FE_ICONSTATS,
FE_ICONCONTROLS,
FE_ICONSAVE,
FE_ICONAUDIO,
FE_ICONDISPLAY,
FE_ICONLANGUAGE,
FE_CONTROLLER,
FE_CONTROLLERSH,
FE_ARROWS1,
FE_ARROWS2,
FE_ARROWS3,
FE_ARROWS4,
FE_RADIO1,
FE_RADIO2,
FE_RADIO3,
FE_RADIO4,
FE_RADIO5,
FE_RADIO6,
FE_RADIO7,
FE_RADIO8,
FE_RADIO9,
NUM_FE_SPRITES
};
class CSprite2d;
class CVector2D;
#ifdef GTA_PC
enum eControlMethod
{
CONTROL_STANDARD = 0,
CONTROL_CLASSIC,
};
#endif
class CMenuManager
{
public:
enum LANGUAGE
{
LANGUAGE_AMERICAN,
LANGUAGE_FRENCH,
LANGUAGE_GERMAN,
LANGUAGE_ITALIAN,
LANGUAGE_SPANISH,
#ifdef MORE_LANGUAGES
LANGUAGE_POLISH,
LANGUAGE_RUSSIAN,
LANGUAGE_JAPANESE,
#endif
};
enum CONTRCONFIG
{
CONFIG_1 = 0,
CONFIG_2,
CONFIG_3,
CONFIG_4,
};
enum
{
NUM_SPRIRES = 28,
};
enum
{
PAGESTATE_NORMAL = 0,
PAGESTATE_HIGHLIGHTED = 1,
PAGESTATE_SELELECTED = 2,
};
enum
{
SLIDE_TO_BOTTOM = 0,
SLIDE_TO_RIGHT,
SLIDE_TO_TOP,
SLIDE_TO_LEFT,
SLIDE_MAX
};
int32 m_currentPage;
int32 m_newPage;
int32 m_pageState;
uint32 m_nPageLeftTimer;
uint32 m_nPageRightTimer;
uint32 m_nChangePageTimer;
int field_18;
uint8 m_fade;
uint8 m_someAlpha;
//char field_1E; // unused ?
//char field_1F; // unused ?
uint32 m_nStartPauseTimer;
uint32 m_nEndPauseTimer;
CVector2D m_position;
uint8 m_nSlidingDir;
//char field_31; // unused ?
//char field_32; // unused ?
//char field_33; // unused ?
bool m_bInitialised;
bool m_bWantToUpdateContent;
bool m_bMenuActive;
bool m_bWantToRestart;
//char field_38; //unused ?
bool m_bRenderGameInMenu;
bool m_bSaveMenuActive;
bool m_bInSaveZone;
char field_3C;
bool m_bTexturesLoaded;
//char field_3E; //unused ?
//char field_3F; //unused ?
CSprite2d m_sprites[NUM_SPRIRES];
static int32 m_PrefsSfxVolume;
static int32 m_PrefsMusicVolume;
static int32 m_PrefsBrightness;
static bool m_PrefsShowTrails;
static bool m_PrefsShowSubtitles;
static bool m_PrefsAllowNastyGame;
static int32 m_PrefsRadioStation;
static int32 m_PrefsStereoMono;
static int8 m_PrefsUseWideScreen;
static int32 m_PrefsLanguage;
static CONTRCONFIG m_PrefsControllerConfig;
static bool m_PrefsUseVibration;
#ifdef GTA_PC
bool m_bQuitGameNoCD;
int32 m_nMouseTempPosX;
int32 m_nMouseTempPosY;
int32 m_nPrefsVideoMode;
int32 m_nDisplayVideoMode;
int8 m_nPrefsAudio3DProviderIndex;
static int32 OS_Language;
static int8 m_PrefsVsync;
static int8 m_PrefsVsyncDisp;
static int8 m_PrefsFrameLimiter;
static int8 m_PrefsSpeakers;
static int32 m_ControlMethod;
static int8 m_PrefsDMA;
static float m_PrefsLOD;
static char m_PrefsSkinFile[256];
#ifndef MASTER
static bool m_PrefsMarketing;
static bool m_PrefsDisableTutorials;
#endif // !MASTER
#ifdef MENU_MAP
static bool bMenuMapActive;
static float fMapSize;
static float fMapCenterY;
static float fMapCenterX;
#endif
#ifdef IMPROVED_VIDEOMODE
//int32 m_nPrefsWidth = 1280 ;//640;
//int32 m_nPrefsHeight = 960;//480;
//int32 m_nPrefsWidth = 1024;
//int32 m_nPrefsHeight = 768;
int32 m_nPrefsWidth = 640;
int32 m_nPrefsHeight = 480;
int32 m_nPrefsDepth = 32;
int32 m_nPrefsWindowed = 1;
int32 m_nPrefsSubsystem;
int32 m_nSelectedScreenMode;
#endif
void WaitForUserCD() { }
#endif
bool GetIsMenuActive() {return !!m_bMenuActive;}
CMenuManager(void);
#ifdef FIX_BUGS
~CMenuManager(void)
{
UnloadTextures();
}
#endif
void LoadAllTextures(void);
void UnloadTextures(void);
void InitialiseMenusOnce(void);
void InitialiseChangedLanguageSettings(void);
void InitialiseMenuContents(void);
void AnaliseMenuContents(void);
void InitialiseMenuContentsAfterLoadingGame(void);
void DrawFrontEnd(void);
void DrawFrontEndNormal(void);
void DrawFrontEndSaveZone(void);
void DrawMemoryCardStartUpMenus(void);
void Process(void);
void WorkOutMenuState(uint8 bExit);
void ProcessControllerInput(void);
void ProcessDPadLeftJustDown(void);
void ProcessDPadRightJustDown(void);
void ProcessDPadUpJustDown(void);
void ProcessDPadDownJustDown(void);
void ProcessDPadTriangleJustDown(void);
void ProcessDPadCrossJustDown(void);
void DoHackingMenusAtPageBrowse(void);
void SetSoundLevelsForMusicMenu(void);
void FilterOutColorMarkersFromString(wchar *string, CRGBA &color);
};
extern CMenuManager FrontEndMenuManager;

View File

@ -43,6 +43,7 @@
#include "Lights.h" #include "Lights.h"
#include "MBlur.h" #include "MBlur.h"
#include "Messages.h" #include "Messages.h"
#include "MemoryCard.h"
#include "Pad.h" #include "Pad.h"
#include "Particle.h" #include "Particle.h"
#include "ParticleObject.h" #include "ParticleObject.h"
@ -103,6 +104,43 @@ bool CGame::japaneseGame = false;
int gameTxdSlot; int gameTxdSlot;
bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
void DoRWStuffEndOfFrame(void);
void MessageScreen(char *msg)
{
//TODO: stretch_screen
CRect rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
CRGBA color(255, 255, 255, 255);
DoRWStuffStartOfFrame(50, 50, 50, 0, 0, 0, 255);
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
DefinedState();
CSprite2d *splash = LoadSplash(NULL);
splash->Draw(rect, color, color, color, color);
splash->DrawRect(CRect(SCREEN_SCALE_X(20.0f), SCREEN_SCALE_Y(110.0f), SCREEN_SCALE_X(620.0f), SCREEN_SCALE_Y(300.0f)), CRGBA(50, 50, 50, 192));
CFont::SetFontStyle(FONT_BANK);
CFont::SetBackgroundOff();
CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(190.0f)); // 450.0f
CFont::SetScale(SCREEN_SCALE_X(1.0f), SCREEN_SCALE_Y(1.0f));
CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(190.0f)); // 450.0f
CFont::SetJustifyOff();
CFont::SetColor(CRGBA(255, 255, 255, 255));
CFont::SetDropColor(CRGBA(32, 32, 32, 255));
CFont::SetDropShadowPosition(3);
CFont::SetPropOn();
CFont::PrintString(SCREEN_SCALE_X(320.0f), SCREEN_SCALE_Y(130.0f), TheText.Get(msg));
CFont::DrawFonts();
DoRWStuffEndOfFrame();
}
bool bool
CGame::InitialiseOnceBeforeRW(void) CGame::InitialiseOnceBeforeRW(void)
{ {
@ -272,6 +310,9 @@ bool CGame::Initialise(const char* datFile)
CWeather::Init(); CWeather::Init();
CCullZones::Init(); CCullZones::Init();
CCollision::Init(); CCollision::Init();
#ifdef PS2_MENU
TheText.Load();
#endif
CTheZones::Init(); CTheZones::Init();
CUserDisplay::Init(); CUserDisplay::Init();
CMessages::Init(); CMessages::Init();
@ -280,6 +321,11 @@ bool CGame::Initialise(const char* datFile)
CRestart::Initialise(); CRestart::Initialise();
CWorld::Initialise(); CWorld::Initialise();
CParticle::Initialise(); CParticle::Initialise();
#ifdef PS2
gStartX = -180.0f;
gStartY = 180.0f;
gStartZ = 14.0f;
#endif
CAnimManager::Initialise(); CAnimManager::Initialise();
CCutsceneMgr::Initialise(); CCutsceneMgr::Initialise();
CCarCtrl::Init(); CCarCtrl::Init();
@ -363,10 +409,16 @@ bool CGame::Initialise(const char* datFile)
CCredits::Init(); CCredits::Init();
CRecordDataForChase::Init(); CRecordDataForChase::Init();
CReplay::Init(); CReplay::Init();
LoadingScreen("Loading the Game", "Start script", nil); #ifdef PS2_MENU
if ( !TheMemoryCard.m_bWantToLoad )
{
#endif
CTheScripts::StartTestScript(); CTheScripts::StartTestScript();
CTheScripts::Process(); CTheScripts::Process();
TheCamera.Process(); TheCamera.Process();
#ifdef PS2_MENU
}
#endif
LoadingScreen("Loading the Game", "Load scene", nil); LoadingScreen("Loading the Game", "Load scene", nil);
CModelInfo::RemoveColModelsFromOtherLevels(currLevel); CModelInfo::RemoveColModelsFromOtherLevels(currLevel);
CCollision::ms_collisionInMemory = currLevel; CCollision::ms_collisionInMemory = currLevel;
@ -431,8 +483,15 @@ bool CGame::ShutDown(void)
void CGame::ReInitGameObjectVariables(void) void CGame::ReInitGameObjectVariables(void)
{ {
CGameLogic::InitAtStartOfGame(); CGameLogic::InitAtStartOfGame();
TheCamera.CCamera::Init(); #ifdef PS2_MENU
if ( !TheMemoryCard.m_bWantToLoad )
{
#endif
TheCamera.Init();
TheCamera.SetRwCamera(Scene.camera); TheCamera.SetRwCamera(Scene.camera);
#ifdef PS2_MENU
}
#endif
CDebug::DebugInitTextBuffer(); CDebug::DebugInitTextBuffer();
CWeather::Init(); CWeather::Init();
CUserDisplay::Init(); CUserDisplay::Init();
@ -441,6 +500,11 @@ void CGame::ReInitGameObjectVariables(void)
CWorld::bDoingCarCollisions = false; CWorld::bDoingCarCollisions = false;
CHud::ReInitialise(); CHud::ReInitialise();
CRadar::Initialise(); CRadar::Initialise();
#ifdef PS2
gStartX = -180.0f;
gStartY = 180.0f;
gStartZ = 14.0f;
#endif
CCarCtrl::ReInit(); CCarCtrl::ReInit();
CTimeCycle::Initialise(); CTimeCycle::Initialise();
CDraw::SetFOV(120.0f); CDraw::SetFOV(120.0f);
@ -456,6 +520,10 @@ void CGame::ReInitGameObjectVariables(void)
CWorld::Players[i].Clear(); CWorld::Players[i].Clear();
CWorld::PlayerInFocus = 0; CWorld::PlayerInFocus = 0;
#ifdef PS2
CWeaponEffects::Init();
CSkidmarks::Init();
#endif
CAntennas::Init(); CAntennas::Init();
CGlass::Init(); CGlass::Init();
gPhoneInfo.Initialise(); gPhoneInfo.Initialise();
@ -471,12 +539,20 @@ void CGame::ReInitGameObjectVariables(void)
CPickups::Init(); CPickups::Init();
CPacManPickups::Init(); CPacManPickups::Init();
CGarages::Init(); CGarages::Init();
#ifdef PS2
CClouds::Init();
CRemote::Init();
#endif
CSpecialFX::Init(); CSpecialFX::Init();
CWaterCannons::Init(); CWaterCannons::Init();
CParticle::ReloadConfig(); CParticle::ReloadConfig();
CCullZones::ResolveVisibilities(); CCullZones::ResolveVisibilities();
#ifdef PS2_MENU
if ( !TheMemoryCard.m_bWantToLoad )
#else
if ( !FrontEndMenuManager.m_bWantToLoad ) if ( !FrontEndMenuManager.m_bWantToLoad )
#endif
{ {
CCranes::InitCranes(); CCranes::InitCranes();
CTheScripts::StartTestScript(); CTheScripts::StartTestScript();
@ -533,8 +609,10 @@ void CGame::ShutDownForRestart(void)
CRadar::RemoveRadarSections(); CRadar::RemoveRadarSections();
FrontEndMenuManager.UnloadTextures(); FrontEndMenuManager.UnloadTextures();
CParticleObject::RemoveAllParticleObjects(); CParticleObject::RemoveAllParticleObjects();
#ifndef PS2
CPedType::Shutdown(); CPedType::Shutdown();
CSpecialFX::Shutdown(); CSpecialFX::Shutdown();
#endif
TidyUpMemory(true, false); TidyUpMemory(true, false);
} }
@ -545,19 +623,102 @@ void CGame::InitialiseWhenRestarting(void)
CTimer::Initialise(); CTimer::Initialise();
CSprite2d::SetRecipNearClip(); CSprite2d::SetRecipNearClip();
#ifdef PS2_MENU
if ( TheMemoryCard.b_FoundRecentSavedGameWantToLoad == true || TheMemoryCard.m_bWantToLoad == false )
{
if ( TheMemoryCard.m_bWantToLoad == true )
MessageScreen("MCLOAD"); // Loading Data. Please do not remove the Memory Card (PS2) in MEMORY CARD slot 1, reset or switch off the console.
else
MessageScreen("RESTART"); // Starting new game
}
#endif
#ifdef PS2_MENU
TheMemoryCard.b_FoundRecentSavedGameWantToLoad = false;
#else
b_FoundRecentSavedGameWantToLoad = false; b_FoundRecentSavedGameWantToLoad = false;
#endif
TheCamera.Init(); TheCamera.Init();
#ifdef PS2_MENU
if ( TheMemoryCard.m_bWantToLoad == true )
{
TheMemoryCard.RestoreForStartLoad();
CStreaming::LoadScene(TheCamera.GetPosition());
}
#else
if ( FrontEndMenuManager.m_bWantToLoad == true ) if ( FrontEndMenuManager.m_bWantToLoad == true )
{ {
RestoreForStartLoad(); RestoreForStartLoad();
CStreaming::LoadScene(TheCamera.GetPosition()); CStreaming::LoadScene(TheCamera.GetPosition());
} }
#endif
ReInitGameObjectVariables(); ReInitGameObjectVariables();
#ifdef PS2_MENU
if ( TheMemoryCard.m_bWantToLoad == true )
{
if ( TheMemoryCard.LoadSavedGame() == CMemoryCard::RES_SUCCESS )
{
for ( int32 i = 0; i < 35; i++ )
{
MessageScreen("FESZ_LS"); // Load Successful.
}
DMAudio.ResetTimers(CTimer::GetTimeInMilliseconds());
CTrain::InitTrains();
CPlane::InitPlanes();
}
else
{
for ( int32 i = 0; i < 50; i++ )
{
DoRWStuffStartOfFrame(50, 50, 50, 0, 0, 0, 255);
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
DefinedState();
CSprite2d *splash = LoadSplash(NULL);
splash->Draw(rect, color, color, color, color);
splash->DrawRect(CRect(SCREEN_SCALE_X(20.0f), SCREEN_SCALE_Y(110.0f), SCREEN_SCALE_X(620.0f), SCREEN_SCALE_Y(300.0f)), CRGBA(50, 50, 50, 192));
//CFont::SetFontStyle(?);
CFont::SetBackgroundOff();
CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(160.0f)); // 480.0f
CFont::SetScale(SCREEN_SCALE_X(1.0f), SCREEN_SCALE_Y(1.0f));
CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(160.0f)); // 480.0f
CFont::SetJustifyOff();
CFont::SetColor(CRGBA(255, 255, 255, 255));
CFont::SetBackGroundOnlyTextOff();
CFont::SetDropColor(CRGBA(32, 32, 32, 255));
CFont::SetDropShadowPosition(3);
CFont::SetPropOn();
CFont::PrintString(SCREEN_SCALE_X(320.0f), SCREEN_SCALE_Y(130.0f), TheText.Get("MC_LDFL")); // Load Failed!
CFont::PrintString(SCREEN_SCALE_X(320.0f), SCREEN_SCALE_Y(170.0f), TheText.Get("FES_NOC")); // No Memory Card (PS2) in MEMORY CARD slot 1.
CFont::PrintString(SCREEN_SCALE_X(320.0f), SCREEN_SCALE_Y(240.0f), TheText.Get("MC_NWRE")); // Now Restarting Game.
CFont::DrawFonts();
DoRWStuffEndOfFrame();
}
ShutDownForRestart();
CTimer::Stop();
CTimer::Initialise();
TheMemoryCard.m_bWantToLoad = false;
ReInitGameObjectVariables();
currLevel = LEVEL_INDUSTRIAL;
CCollision::SortOutCollisionAfterLoad();
FrontEndMenuManager.SetSoundLevelsForMusicMenu();
FrontEndMenuManager.InitialiseMenuContentsAfterLoadingGame();
}
}
#else
if ( FrontEndMenuManager.m_bWantToLoad == true ) if ( FrontEndMenuManager.m_bWantToLoad == true )
{ {
if ( GenericLoad() == true ) if ( GenericLoad() == true )
@ -583,6 +744,7 @@ void CGame::InitialiseWhenRestarting(void)
CCollision::SortOutCollisionAfterLoad(); CCollision::SortOutCollisionAfterLoad();
} }
} }
#endif
CTimer::Update(); CTimer::Update();
@ -596,8 +758,8 @@ void CGame::Process(void)
ProcessTidyUpMemory(); ProcessTidyUpMemory();
#endif #endif
TheCamera.SetMotionBlurAlpha(0); TheCamera.SetMotionBlurAlpha(0);
if (TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_SNIPER || TheCamera.m_BlurType == MBLUR_NORMAL) if (TheCamera.m_BlurType == MOTION_BLUR_NONE || TheCamera.m_BlurType == MOTION_BLUR_SNIPER || TheCamera.m_BlurType == MOTION_BLUR_LIGHT_SCENE)
TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE); TheCamera.SetMotionBlur(0, 0, 0, 0, MOTION_BLUR_NONE);
#ifdef DEBUGMENU #ifdef DEBUGMENU
DebugMenuProcess(); DebugMenuProcess();
#endif #endif
@ -666,6 +828,9 @@ void CGame::Process(void)
CCarCtrl::RemoveDistantCars(); CCarCtrl::RemoveDistantCars();
} }
} }
#ifdef PS2
CMemCheck::DoTest();
#endif
} }
void CGame::DrasticTidyUpMemory(bool) void CGame::DrasticTidyUpMemory(bool)

View File

@ -37,13 +37,27 @@
#include "Wanted.h" #include "Wanted.h"
#include "General.h" #include "General.h"
#ifdef GTA_PS2
#include "eetypes.h"
#include "libpad.h"
#endif
CPad Pads[MAX_PADS]; CPad Pads[MAX_PADS];
#ifdef GTA_PS2
u_long128 pad_dma_buf[scePadDmaBufferMax] __attribute__((aligned(64)));
u_long128 pad2_dma_buf[scePadDmaBufferMax] __attribute__((aligned(64)));
#endif
CMousePointerStateHelper MousePointerStateHelper; CMousePointerStateHelper MousePointerStateHelper;
bool CPad::bDisplayNoControllerMessage; bool CPad::bDisplayNoControllerMessage;
bool CPad::bObsoleteControllerMessage; bool CPad::bObsoleteControllerMessage;
bool CPad::bOldDisplayNoControllerMessage; bool CPad::bOldDisplayNoControllerMessage;
bool CPad::m_bMapPadOneToPadTwo; bool CPad::m_bMapPadOneToPadTwo;
#ifdef GTA_PS2
unsigned char act_direct[6];
unsigned char act_align[6];
#endif
CKeyboardState CPad::OldKeyState; CKeyboardState CPad::OldKeyState;
CKeyboardState CPad::NewKeyState; CKeyboardState CPad::NewKeyState;
@ -329,15 +343,17 @@ void AltDodoCheat(void)
} }
#endif #endif
#ifdef DETECT_PAD_INPUT_SWITCH
bool bool
CControllerState::IsAnyButtonPressed(void) CControllerState::IsAnyButtonPressed(void)
{ {
return !!LeftStickX || !!LeftStickY || !!RightStickX || !!RightStickY || !!LeftShoulder1 || !!LeftShoulder2 || !!RightShoulder1 || !!RightShoulder2 || return !!RightStickX || !!RightStickY || !!LeftStickX || !!LeftStickY
!!DPadUp || !!DPadDown || !!DPadLeft || !!DPadRight || !!Start || !!Select || !!Square || !!Triangle || !!Cross || !!Circle || !!LeftShock || || !!DPadUp || !!DPadDown || !!DPadLeft || !!DPadRight
!!RightShock || !!NetworkTalk; || !!Triangle || !!Cross || !!Circle || !!Square
|| !!Start || !!Select
|| !!LeftShoulder1 || !!LeftShoulder2 || !!RightShoulder1 || !!RightShoulder2
|| !!LeftShock || !!RightShock
|| !!NetworkTalk;
} }
#endif
void void
CControllerState::Clear(void) CControllerState::Clear(void)
@ -383,6 +399,12 @@ void CKeyboardState::Clear()
#ifdef GTA_PS2_STUFF #ifdef GTA_PS2_STUFF
void CPad::Initialise(void) void CPad::Initialise(void)
{ {
#ifdef GTA_PS2
scePadInit(0);
scePadPortOpen(0, 0, pad_dma_buf );
scePadPortOpen(1, 0, pad2_dma_buf );
#endif
for (int i = 0; i < MAX_PADS; i++) for (int i = 0; i < MAX_PADS; i++)
{ {
CPad::GetPad(i)->Clear(true); CPad::GetPad(i)->Clear(true);
@ -1089,12 +1111,269 @@ void CPad::ProcessPCSpecificStuff(void)
; ;
} }
void CPad::Update(int16 unk) void CPad::Update(int16 pad)
{ {
OldState = NewState; OldState = NewState;
#ifdef GTA_PS2
bObsoleteControllerMessage = false;
//int iPressureBtn;
int id;
int ext_id=0;
int state;
int rterm_id = 0;
unsigned short paddata, tpad;
unsigned char rdata[32];
state = scePadGetState(pad, 0);
switch(Phase)
{
case 0:
if (state != scePadStateStable && state != scePadStateFindCTP1)
break;
id = scePadInfoMode(pad, 0, InfoModeCurID, 0);
if (id==0) break;
ext_id = scePadInfoMode(pad, 0, InfoModeCurExID, 0);
if (ext_id>0) id = ext_id;
switch(id)
{
case 4: // Digital controller
Phase = 40; // Try for analog(dualshock)
break;
case 7: // Dualshock2 controller
Phase = 50;
break;
default:
Phase = 99;
break;
}
break;
// Analog Controller (old dualshock)
case 40: // Analog Contoller check valid (otherwise fail phase)
if (scePadInfoMode(pad, 0, InfoModeIdTable, -1)==0)
{
Phase = 99;
break;
}
Phase++;
case 41: // Analog controller: Request Lock analog mode (asynchronous)
if (scePadSetMainMode(pad, 0, 1, 3)==1) Phase++;
break;
case 42: // Analog controller: Check state of previous request
if (scePadGetReqState(pad, 0)==scePadReqStateFaild)
{
Phase--;
}
if (scePadGetReqState(pad, 0)==scePadReqStateComplete)
{
// Lock mode complete
Phase=0; // Accept normal dualshock
}
break;
// DualShock 2 Controller
case 50: // Analog Contoller check valid (otherwise fail phase)
if (scePadInfoMode(pad, 0, InfoModeIdTable, -1)==0)
{
Phase = 99;
break;
}
Phase++;
case 51: // Analog controller: Request Lock analog mode (asynchronous)
if (scePadSetMainMode(pad, 0, 1, 3)==1) Phase++;
break;
case 52: // Analog controller: Check state of previous request
if (scePadGetReqState(pad, 0)==scePadReqStateFaild)
{
Phase--;
}
if (scePadGetReqState(pad, 0)==scePadReqStateComplete)
{
// Lock mode complete
Phase=0; // Accept normal dualshock
}
break;
case 70: // DualShock 2 check pressure sensitive possible
if (scePadInfoPressMode(pad, 0)==1)
{
Phase = 76;
break;
}
Phase = 99;
break;
case 76: // DualShock2 enable pressure sensitive mode (asynchronous function)
if (scePadEnterPressMode(pad, 0)==1) Phase++;
break;
case 77: // Dualshock2 check status of request pressure sensitive mode
if (scePadGetReqState(pad, 0)==scePadReqStateFaild) Phase--;
if (scePadGetReqState(pad, 0)==scePadReqStateComplete)
{
Phase=80;
}
break;
// DualShock 2 Controller
case 80: // Set motors
if (scePadInfoAct(pad, 0, -1, 0)==0)
{
Phase = 99;
}
act_align[0] = 0; // Offset 0 for motor0
act_align[1] = 1; // Offset 1 for motor1
act_align[2] = 0xff;
act_align[3] = 0xff;
act_align[4] = 0xff;
act_align[5] = 0xff;
// Asynchronous function
if (scePadSetActAlign(pad, 0, act_align)==0) break;
Phase++;
break;
case 81:
if ( scePadGetState(pad, 0) != scePadStateExecCmd )
{
Phase = 99;
}
break;
default:
if ( state == scePadStateError ) break;
if ( state == scePadStateStable || state == scePadStateFindCTP1 )
{
if ( ShakeDur )
{
ShakeDur = Max(ShakeDur - CTimer::GetTimeStepInMilliseconds(), 0);
if ( ShakeDur == 0 )
{
act_direct[0] = 0;
act_direct[1] = 0;
scePadSetActDirect(pad, 0, act_direct);
}
else
{
act_direct[0] = 0;
act_direct[1] = (unsigned char) ShakeFreq;
scePadSetActDirect(pad, 0, act_direct);
}
}
if (scePadRead( pad, 0, rdata )==0)
{
NewState.Clear();
break;
}
if ((rdata[0] == 0))
{
paddata = (unsigned short) ( 0xffff ^ ((rdata[2]<<8)|rdata[3]) );
rterm_id = (rdata[1]);
if ( (rterm_id>>4) == 7 ) // DUALSHOCK
{
if (!CRecordDataForGame::IsPlayingBack() && !CRecordDataForChase::ShouldThisPadBeLeftAlone(pad))
{
tpad = paddata;
NewState.DPadUp = ( tpad & SCE_PADLup ) ? 255 : 0;
NewState.DPadDown = ( tpad & SCE_PADLdown ) ? 255 : 0;
NewState.DPadLeft = ( tpad & SCE_PADLleft ) ? 255 : 0;
NewState.DPadRight = ( tpad & SCE_PADLright ) ? 255 : 0;
NewState.Triangle = ( tpad & SCE_PADRup ) ? 255 : 0;
NewState.Cross = ( tpad & SCE_PADRdown ) ? 255 : 0;
NewState.Square = ( tpad & SCE_PADRleft ) ? 255 : 0;
NewState.Circle = ( tpad & SCE_PADRright ) ? 255 : 0;
NewState.Start = ( tpad & SCE_PADstart ) ? 255 : 0;
NewState.Select = ( tpad & SCE_PADselect ) ? 255 : 0;
NewState.LeftShoulder1 = ( tpad & SCE_PADL1 ) ? 255 : 0;
NewState.LeftShoulder2 = ( tpad & SCE_PADL2 ) ? 255 : 0;
NewState.RightShoulder1 = ( tpad & SCE_PADR1 ) ? 255 : 0;
NewState.RightShoulder2 = ( tpad & SCE_PADR2 ) ? 255 : 0;
NewState.LeftShock = ( tpad & SCE_PADi ) ? 255 : 0;
NewState.RightShock = ( tpad & SCE_PADj ) ? 255 : 0;
NewState.RightStickX = (short)rdata[4];
NewState.RightStickY = (short)rdata[5];
NewState.LeftStickX = (short)rdata[6];
NewState.LeftStickY = (short)rdata[7];
#define CLAMP_AXIS(x) (((x) < 43 && (x) >= -42) ? 0 : (((x) > 0) ? (Max((x)-42, 0)*127/85) : Min((x)+42, 0)*127/85))
#define FIX_AXIS(x) CLAMP_AXIS((x)-128)
NewState.RightStickX = FIX_AXIS(NewState.RightStickX);
NewState.RightStickY = FIX_AXIS(NewState.RightStickY);
NewState.LeftStickX = FIX_AXIS(NewState.LeftStickX);
NewState.LeftStickY = FIX_AXIS(NewState.LeftStickY);
#undef FIX_AXIS
#undef CLAMP_AXIS
}
}
else if ( (rterm_id>>4) == 4 ) // Controller (digital)
{
if ( pad == 0 )
bObsoleteControllerMessage = true;
NewState.Clear();
}
if ( NewState.IsAnyButtonPressed() )
LastTimeTouched = CTimer::GetTimeInMilliseconds();
break;
}
if ( ++iCurrHornHistory >= HORNHISTORY_SIZE )
iCurrHornHistory = 0;
bHornHistory[iCurrHornHistory] = GetHorn();
NewState.Clear();
return;
}
break;
}
if ( pad == 0 )
{
bOldDisplayNoControllerMessage = bDisplayNoControllerMessage;
if ( state == scePadStateDiscon )
{
bDisplayNoControllerMessage = true;
Phase = 0;
}
else
bDisplayNoControllerMessage = false;
}
if ( ++iCurrHornHistory >= HORNHISTORY_SIZE )
iCurrHornHistory = 0;
bHornHistory[iCurrHornHistory] = GetHorn();
if ( !bDisplayNoControllerMessage )
CGame::bDemoMode = false;
#endif
#if (defined GTA_PS2 || defined FIX_BUGS) #if (defined GTA_PS2 || defined FIX_BUGS)
if (!CRecordDataForGame::IsPlayingBack() && !CRecordDataForChase::ShouldThisPadBeLeftAlone(unk)) if (!CRecordDataForGame::IsPlayingBack() && !CRecordDataForChase::ShouldThisPadBeLeftAlone(pad))
#endif #endif
{ {
NewState = ReconcileTwoControllersInput(PCTempKeyState, PCTempJoyState); NewState = ReconcileTwoControllersInput(PCTempKeyState, PCTempJoyState);
@ -1171,9 +1450,22 @@ void CPad::StopPadsShaking(void)
GetPad(0)->StopShaking(0); GetPad(0)->StopShaking(0);
} }
void CPad::StopShaking(int16 unk) void CPad::StopShaking(int16 pad)
{ {
; #ifdef GTA_PS2_STUFF
ShakeFreq = 0;
ShakeDur = 0;
#ifdef GTA_PS2
if ( Phase == 99 )
{
act_direct[0] = 0;
act_direct[1] = 0;
scePadSetActDirect(pad, 0, act_direct);
}
#endif
#endif
} }
CPad *CPad::GetPad(int32 pad) CPad *CPad::GetPad(int32 pad)

View File

@ -29,9 +29,7 @@ public:
float GetRightStickX(void) { return RightStickX/32767.0f; }; float GetRightStickX(void) { return RightStickX/32767.0f; };
float GetRightStickY(void) { return RightStickY/32767.0f; }; float GetRightStickY(void) { return RightStickY/32767.0f; };
#ifdef DETECT_PAD_INPUT_SWITCH
bool IsAnyButtonPressed(); bool IsAnyButtonPressed();
#endif
void Clear(void); void Clear(void);
}; };
VALIDATE_SIZE(CControllerState, 0x2A); VALIDATE_SIZE(CControllerState, 0x2A);
@ -199,13 +197,13 @@ public:
static void UpdatePads(void); static void UpdatePads(void);
void ProcessPCSpecificStuff(void); void ProcessPCSpecificStuff(void);
void Update(int16 unk); void Update(int16 pad);
static void DoCheats(void); static void DoCheats(void);
void DoCheats(int16 unk); void DoCheats(int16 unk);
static void StopPadsShaking(void); static void StopPadsShaking(void);
void StopShaking(int16 unk); void StopShaking(int16 pad);
static CPad *GetPad(int32 pad); static CPad *GetPad(int32 pad);
@ -453,6 +451,11 @@ public:
void SetDisablePlayerControls(uint8 who) { DisablePlayerControls |= who; } void SetDisablePlayerControls(uint8 who) { DisablePlayerControls |= who; }
void SetEnablePlayerControls(uint8 who) { DisablePlayerControls &= ~who; } void SetEnablePlayerControls(uint8 who) { DisablePlayerControls &= ~who; }
bool IsPlayerControlsDisabledBy(uint8 who) { return DisablePlayerControls & who; } bool IsPlayerControlsDisabledBy(uint8 who) { return DisablePlayerControls & who; }
int16 GetMode() { return Mode; }
void SetMode(int16 mode) { Mode = mode; }
static bool IsNoOrObsolete() { return bDisplayNoControllerMessage || bObsoleteControllerMessage; }
}; };
VALIDATE_SIZE(CPad, 0xFC); VALIDATE_SIZE(CPad, 0xFC);

View File

@ -56,6 +56,7 @@ public:
friend bool GenericLoad(void); friend bool GenericLoad(void);
friend bool GenericSave(int file); friend bool GenericSave(int file);
friend class CMemoryCard;
#ifdef FIX_BUGS #ifdef FIX_BUGS
static float GetDefaultTimeStep(void) { return 5.0f / 3.0f; } static float GetDefaultTimeStep(void) { return 5.0f / 3.0f; }

View File

@ -103,6 +103,8 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
#define DEFAULT_SCREEN_WIDTH (640) #define DEFAULT_SCREEN_WIDTH (640)
#define DEFAULT_SCREEN_HEIGHT (448) #define DEFAULT_SCREEN_HEIGHT (448)
#define DEFAULT_SCREEN_HEIGHT_PAL (512)
#define DEFAULT_SCREEN_HEIGHT_NTSC (448)
#define DEFAULT_ASPECT_RATIO (4.0f/3.0f) #define DEFAULT_ASPECT_RATIO (4.0f/3.0f)
#define DEFAULT_VIEWWINDOW (0.7f) #define DEFAULT_VIEWWINDOW (0.7f)
@ -153,6 +155,16 @@ public:
CRGBA(void) { } CRGBA(void) { }
CRGBA(uint8 r, uint8 g, uint8 b, uint8 a) : r(r), g(g), b(b), a(a) { } CRGBA(uint8 r, uint8 g, uint8 b, uint8 a) : r(r), g(g), b(b), a(a) { }
bool operator ==(const CRGBA &right)
{
return this->r == right.r && this->g == right.g && this->b == right.b && this->a == right.a;
}
bool operator !=(const CRGBA &right)
{
return !(*this == right);
}
CRGBA &operator =(const CRGBA &right) CRGBA &operator =(const CRGBA &right)
{ {
this->r = right.r; this->r = right.r;

View File

@ -58,6 +58,7 @@
#include "Console.h" #include "Console.h"
#include "timebars.h" #include "timebars.h"
#include "GenericGameStorage.h" #include "GenericGameStorage.h"
#include "MemoryCard.h"
#include "SceneEdit.h" #include "SceneEdit.h"
#include "debugmenu.h" #include "debugmenu.h"
@ -181,14 +182,27 @@ DoFade(void)
if(CTimer::GetIsPaused()) if(CTimer::GetIsPaused())
return; return;
#ifdef PS2_MENU
if(TheMemoryCard.JustLoadedDontFadeInYet){
TheMemoryCard.JustLoadedDontFadeInYet = false;
TheMemoryCard.TimeStartedCountingForFade = CTimer::GetTimeInMilliseconds();
}
#else
if(JustLoadedDontFadeInYet){ if(JustLoadedDontFadeInYet){
JustLoadedDontFadeInYet = false; JustLoadedDontFadeInYet = false;
TimeStartedCountingForFade = CTimer::GetTimeInMilliseconds(); TimeStartedCountingForFade = CTimer::GetTimeInMilliseconds();
} }
#endif
#ifdef PS2_MENU
if(TheMemoryCard.StillToFadeOut){
if(CTimer::GetTimeInMilliseconds() - TheMemoryCard.TimeStartedCountingForFade > TheMemoryCard.TimeToStayFadedBeforeFadeOut){
TheMemoryCard.StillToFadeOut = false;
#else
if(StillToFadeOut){ if(StillToFadeOut){
if(CTimer::GetTimeInMilliseconds() - TimeStartedCountingForFade > TimeToStayFadedBeforeFadeOut){ if(CTimer::GetTimeInMilliseconds() - TimeStartedCountingForFade > TimeToStayFadedBeforeFadeOut){
StillToFadeOut = false; StillToFadeOut = false;
#endif
TheCamera.Fade(3.0f, FADE_IN); TheCamera.Fade(3.0f, FADE_IN);
TheCamera.ProcessFade(); TheCamera.ProcessFade();
TheCamera.ProcessMusicFade(); TheCamera.ProcessMusicFade();
@ -888,17 +902,16 @@ Render2dStuff(void)
void void
RenderMenus(void) RenderMenus(void)
{ {
#ifdef PS2 if (FrontEndMenuManager.m_bMenuActive)
if (FrontEndMenuManager.m_bWantToDraw)
{ {
#ifdef PS2
gMainHeap.PushMemId(_TODOCONST(17)); gMainHeap.PushMemId(_TODOCONST(17));
FrontEndMenuManager.DrawFrontEnd();
gMainHeap.PopMemId();
}
#else
if(FrontEndMenuManager.m_bMenuActive)
FrontEndMenuManager.DrawFrontEnd();
#endif #endif
FrontEndMenuManager.DrawFrontEnd();
#ifdef PS2
gMainHeap.PopMemId();
#endif
}
} }
void void
@ -975,14 +988,25 @@ Idle(void *arg)
#endif #endif
if(CGame::bDemoMode && CTimer::GetTimeInMilliseconds() > (3*60 + 30)*1000 && !CCutsceneMgr::IsCutsceneProcessing()){ if(CGame::bDemoMode && CTimer::GetTimeInMilliseconds() > (3*60 + 30)*1000 && !CCutsceneMgr::IsCutsceneProcessing()){
#ifdef PS2_MENU
TheMemoryCard.m_bWantToLoad = false;
FrontEndMenuManager.m_bWantToRestart = true;
#else
FrontEndMenuManager.m_bWantToRestart = true; FrontEndMenuManager.m_bWantToRestart = true;
FrontEndMenuManager.m_bWantToLoad = false; FrontEndMenuManager.m_bWantToLoad = false;
#endif
return; return;
} }
#ifdef PS2_MENU
if ( FrontEndMenuManager.m_bWantToRestart || TheMemoryCard.b_FoundRecentSavedGameWantToLoad )
#else
if(FrontEndMenuManager.m_bWantToRestart || b_FoundRecentSavedGameWantToLoad) if(FrontEndMenuManager.m_bWantToRestart || b_FoundRecentSavedGameWantToLoad)
#endif
{
return; return;
}
SetLightsWithTimeOfDayColour(Scene.world); SetLightsWithTimeOfDayColour(Scene.world);
if(arg == nil) if(arg == nil)
@ -1042,7 +1066,7 @@ Idle(void *arg)
#ifdef TIMEBARS #ifdef TIMEBARS
tbStartTimer(0, "RenderMotionBlur"); tbStartTimer(0, "RenderMotionBlur");
#endif #endif
if((TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_NORMAL) && if((TheCamera.m_BlurType == MOTION_BLUR_NONE || TheCamera.m_BlurType == MOTION_BLUR_LIGHT_SCENE) &&
TheCamera.m_ScreenReductionPercentage > 0.0f) TheCamera.m_ScreenReductionPercentage > 0.0f)
TheCamera.SetMotionBlurAlpha(150); TheCamera.SetMotionBlurAlpha(150);
TheCamera.RenderMotionBlur(); TheCamera.RenderMotionBlur();
@ -1078,6 +1102,11 @@ Idle(void *arg)
tbEndTimer("RenderMenus"); tbEndTimer("RenderMenus");
tbStartTimer(0, "DoFade"); tbStartTimer(0, "DoFade");
#endif #endif
#ifdef PS2_MENU
if ( TheMemoryCard.m_bWantToLoad )
return;
#endif
DoFade(); DoFade();
#ifdef TIMEBARS #ifdef TIMEBARS
tbEndTimer("DoFade"); tbEndTimer("DoFade");
@ -1262,6 +1291,7 @@ TheModelViewer(void)
} }
#endif #endif
#ifdef PS2
void TheGame(void) void TheGame(void)
{ {
printf("Into TheGame!!!\n"); printf("Into TheGame!!!\n");
@ -1283,12 +1313,12 @@ void TheGame(void)
LoadingScreen("Starting Game", NULL, splash); LoadingScreen("Starting Game", NULL, splash);
#ifdef GTA_PS2 #ifdef GTA_PS2
if ( TheMemoryCard.CheckCardInserted(_TODOCONST(0)) == _TODOCONST(26) if ( TheMemoryCard.CheckCardInserted(CARD_ONE) == CMemoryCard::NO_ERR_SUCCESS
&& TheMemoryCard.ChangeDirectory(_TODOCONST(0), TheMemoryCard.field154) && TheMemoryCard.ChangeDirectory(CARD_ONE, TheMemoryCard.Cards[CARD_ONE].dir)
&& TheMemoryCard.FindMostRecentFileName(_TODOCONST(0), TheMemoryCard.field37) == 1 && TheMemoryCard.FindMostRecentFileName(CARD_ONE, TheMemoryCard.MostRecentFile) == true
&& TheMemoryCard.CheckDataNotCorrupt(TheMemoryCard.field37)) && TheMemoryCard.CheckDataNotCorrupt(TheMemoryCard.MostRecentFile))
{ {
strcpy(TheMemoryCard.LoadFileName, TheMemoryCard.field37); strcpy(TheMemoryCard.LoadFileName, TheMemoryCard.MostRecentFile);
TheMemoryCard.b_FoundRecentSavedGameWantToLoad = true; TheMemoryCard.b_FoundRecentSavedGameWantToLoad = true;
if (CMenuManager::m_PrefsLanguage != TheMemoryCard.GetLanguageToLoad()) if (CMenuManager::m_PrefsLanguage != TheMemoryCard.GetLanguageToLoad())
@ -1391,7 +1421,7 @@ void TheGame(void)
RenderDebugShit(); RenderDebugShit();
RenderEffects(); RenderEffects();
if ((TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_NORMAL) && TheCamera.m_ScreenReductionPercentage > 0.0f) if ((TheCamera.m_BlurType == MOTION_BLUR_NONE || TheCamera.m_BlurType == MOTION_BLUR_LIGHT_SCENE) && TheCamera.m_ScreenReductionPercentage > 0.0f)
TheCamera.SetMotionBlurAlpha(150); TheCamera.SetMotionBlurAlpha(150);
TheCamera.RenderMotionBlur(); TheCamera.RenderMotionBlur();
@ -1773,8 +1803,6 @@ void GameInit()
} }
} }
// Not used anyway. PS2 main() port
#ifdef _WIN32
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
@ -1785,9 +1813,10 @@ main(int argc, char *argv[])
SystemInit(); SystemInit();
#ifdef PS2 #ifdef PS2
int32 state = TheMemoryCard.CheckCardStateAtGameStartUp(_TODOCONST(0)); int32 r = TheMemoryCard.CheckCardStateAtGameStartUp(CARD_ONE);
if ( state == _TODOCONST(2) || state == _TODOCONST(1) && state != _TODOCONST(3) && state != _TODOCONST(0) ) if ( r == CMemoryCard::ERR_DIRNOENTRY || r == CMemoryCard::ERR_NOFORMAT
&& r != CMemoryCard::ERR_OPENNOENTRY && r != CMemoryCard::ERR_NONE )
{ {
GameInit(); GameInit();

View File

@ -128,12 +128,12 @@ CCredits::Render(void)
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED040"), lineoffset, scrolloffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED040"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset); PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.4f, 0.82f, TheText.Get("CRED041"), lineoffset, scrolloffset); PrintCreditText(1.4f, 0.82f, TheText.Get("CRED041"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.5, lineoffset); PrintCreditSpace(1.5, lineoffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED042"), lineoffset, scrolloffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED042"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset); PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED043"), lineoffset, scrolloffset); PrintCreditText(1.7f, 1.0f, TheText.Get("CRED043"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.5, lineoffset); PrintCreditSpace(1.5, lineoffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED044"), lineoffset, scrolloffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED044"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset); PrintCreditSpace(2.0f, lineoffset);
@ -176,7 +176,7 @@ CCredits::Render(void)
PrintCreditSpace(2.0f, lineoffset); PrintCreditSpace(2.0f, lineoffset);
PrintCreditSpace(2.0f, lineoffset); PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED061"), lineoffset, scrolloffset); PrintCreditText(1.7f, 1.0f, TheText.Get("CRED061"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.5, lineoffset); PrintCreditSpace(1.5, lineoffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED062"), lineoffset, scrolloffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED062"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset); PrintCreditSpace(2.0f, lineoffset);
@ -191,7 +191,7 @@ CCredits::Render(void)
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED068"), lineoffset, scrolloffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED068"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset); PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED069"), lineoffset, scrolloffset); PrintCreditText(1.7f, 1.0f, TheText.Get("CRED069"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.5, lineoffset); PrintCreditSpace(1.5, lineoffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED070"), lineoffset, scrolloffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED070"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset); PrintCreditSpace(2.0f, lineoffset);
@ -220,7 +220,7 @@ CCredits::Render(void)
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED262"), lineoffset, scrolloffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED262"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset); PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED085"), lineoffset, scrolloffset); PrintCreditText(1.7f, 1.0f, TheText.Get("CRED085"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.5, lineoffset); PrintCreditSpace(1.5, lineoffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED086"), lineoffset, scrolloffset); PrintCreditText(1.7f, 1.7f, TheText.Get("CRED086"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset); PrintCreditSpace(2.0f, lineoffset);
@ -265,76 +265,76 @@ CCredits::Render(void)
PrintCreditText(1.0, 1.0, TheText.Get("CRED108"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED108"), lineoffset, scrolloffset);
PrintCreditSpace(1.0, lineoffset); PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED109"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED109"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset); PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED110"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED110"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset); PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED111"), lineoffset, scrolloffset); PrintCreditText(1.7f, 1.0f, TheText.Get("CRED111"), lineoffset, scrolloffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED112"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED112"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset); PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED113"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED113"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset); PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED114"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED114"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset); PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED115"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED115"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset); PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED116"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED116"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset); PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED117"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED117"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset); PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED118"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED118"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset); PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED119"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED119"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset); PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED120"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED120"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset); PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED121"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED121"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset); PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED122"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED122"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset); PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED123"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED123"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset); PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED124"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED124"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset); PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED125"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED125"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset); PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED126"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED126"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset); PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED127"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED127"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset); PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED128"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED128"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset); PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED129"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED129"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset); PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED130"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED130"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset); PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED131"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED131"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset); PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED132"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED132"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset); PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED133"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED133"), lineoffset, scrolloffset);
if(CMenuManager::m_PrefsLanguage == LANGUAGE_ITALIAN) if(CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset); PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED134"), lineoffset, scrolloffset); PrintCreditText(1.0, 1.0, TheText.Get("CRED134"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset); PrintCreditSpace(2.0f, lineoffset);

View File

@ -380,7 +380,7 @@ void CScrollBar::Update()
m_pMessage = FindTimeMessage(); m_pMessage = FindTimeMessage();
break; break;
case 6: case 6:
if (CMenuManager::m_PrefsLanguage == LANGUAGE_FRENCH || CMenuManager::m_PrefsLanguage == LANGUAGE_GERMAN) if (CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_FRENCH || CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_GERMAN)
m_pMessage = FindTimeMessage(); m_pMessage = FindTimeMessage();
else else
m_pMessage = "WWW.GRANDTHEFTAUTO3.COM "; m_pMessage = "WWW.GRANDTHEFTAUTO3.COM ";
@ -600,7 +600,7 @@ void CScrollBar::Update()
m_pMessage = "FREE FLUFFY DICE WITH ALL PURCHASES. . ."; m_pMessage = "FREE FLUFFY DICE WITH ALL PURCHASES. . .";
break; break;
case 9: case 9:
if (CMenuManager::m_PrefsLanguage == LANGUAGE_FRENCH || CMenuManager::m_PrefsLanguage == LANGUAGE_GERMAN) if (CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_FRENCH || CMenuManager::m_PrefsLanguage == CMenuManager::LANGUAGE_GERMAN)
m_pMessage = "QUICK, TAKE A LOOK AT OUR CURRENT STOCK )CAUSE THESE AUTOS ARE MOVIN) FAST . . . "; m_pMessage = "QUICK, TAKE A LOOK AT OUR CURRENT STOCK )CAUSE THESE AUTOS ARE MOVIN) FAST . . . ";
else else
m_pMessage = "HTTP:((ROCKSTARGAMES.COM(GRANDTHEFTAUTO3(CAPITALAUTOS "; m_pMessage = "HTTP:((ROCKSTARGAMES.COM(GRANDTHEFTAUTO3(CAPITALAUTOS ";

View File

@ -492,7 +492,7 @@ void CHud::Draw()
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
if (FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_SPANISH) if (FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_SPANISH)
CFont::SetScale(SCREEN_SCALE_X(1.2f * 0.8f), SCREEN_SCALE_Y(1.2f)); CFont::SetScale(SCREEN_SCALE_X(1.2f * 0.8f), SCREEN_SCALE_Y(1.2f));
else else
CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f)); CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f));
@ -586,7 +586,7 @@ void CHud::Draw()
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
if (FrontEndMenuManager.m_PrefsLanguage != LANGUAGE_ITALIAN && FrontEndMenuManager.m_PrefsLanguage != LANGUAGE_SPANISH) if (FrontEndMenuManager.m_PrefsLanguage != CMenuManager::LANGUAGE_ITALIAN && FrontEndMenuManager.m_PrefsLanguage != CMenuManager::LANGUAGE_SPANISH)
CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f)); CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f));
else else
CFont::SetScale(SCREEN_SCALE_X(1.2f * 0.85f), SCREEN_SCALE_Y(1.2f)); CFont::SetScale(SCREEN_SCALE_X(1.2f * 0.85f), SCREEN_SCALE_Y(1.2f));
@ -1279,7 +1279,7 @@ void CHud::DrawAfterFade()
CFont::SetJustifyOff(); CFont::SetJustifyOff();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
if (CGame::frenchGame || FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_SPANISH) if (CGame::frenchGame || FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_SPANISH)
CFont::SetScale(SCREEN_SCALE_X(0.884f), SCREEN_SCALE_Y(1.36f)); CFont::SetScale(SCREEN_SCALE_X(0.884f), SCREEN_SCALE_Y(1.36f));
else else
CFont::SetScale(SCREEN_SCALE_X(1.04f), SCREEN_SCALE_Y(1.6f)); CFont::SetScale(SCREEN_SCALE_X(1.04f), SCREEN_SCALE_Y(1.6f));

View File

@ -1,3 +1,4 @@
#define WITHWINDOWS
#include "common.h" #include "common.h"
#include "RwHelper.h" #include "RwHelper.h"
@ -8,48 +9,125 @@
RwRaster *CMBlur::pFrontBuffer; RwRaster *CMBlur::pFrontBuffer;
bool CMBlur::ms_bJustInitialised; bool CMBlur::ms_bJustInitialised;
bool CMBlur::ms_bScaledBlur;
bool CMBlur::BlurOn; bool CMBlur::BlurOn;
static RwIm2DVertex Vertex[4]; static RwIm2DVertex Vertex[4];
static RwImVertexIndex Index[6] = { 0, 1, 2, 0, 2, 3 }; static RwImVertexIndex Index[6] = { 0, 1, 2, 0, 2, 3 };
void RwBool
CMBlur::MotionBlurOpen(RwCamera *cam) CMBlur::MotionBlurOpen(RwCamera *cam)
{ {
// TODO. this is simplified #ifdef GTA_PS2
RwRect rect = {0, 0, 0, 0};
if (pFrontBuffer)
return TRUE;
BlurOn = true;
rect.w = RwRasterGetWidth(RwCameraGetRaster(cam));
rect.h = RwRasterGetHeight(RwCameraGetRaster(cam));
pFrontBuffer = RwRasterCreate(0, 0, 0, rwRASTERDONTALLOCATE|rwRASTERTYPECAMERATEXTURE);
if (!pFrontBuffer)
{
printf("Error creating raster\n");
return FALSE;
}
RwRaster *raster = RwRasterSubRaster(pFrontBuffer, RwCameraGetRaster(cam), &rect);
if (!raster)
{
RwRasterDestroy(pFrontBuffer);
pFrontBuffer = NULL;
printf("Error subrastering\n");
return FALSE;
}
CreateImmediateModeData(cam, &rect);
#else
RwRect rect = { 0, 0, 0, 0 }; RwRect rect = { 0, 0, 0, 0 };
if(pFrontBuffer) if(pFrontBuffer)
MotionBlurClose(); MotionBlurClose();
if(BlurOn){ extern void _GetVideoMemInfo(LPDWORD total, LPDWORD avaible);
for(rect.w = 1; rect.w < RwRasterGetWidth(RwCameraGetRaster(cam)); rect.w *= 2); DWORD total, avaible;
for(rect.h = 1; rect.h < RwRasterGetHeight(RwCameraGetRaster(cam)); rect.h *= 2);
pFrontBuffer = RwRasterCreate(rect.w, rect.h, RwRasterGetDepth(RwCameraGetRaster(cam)), rwRASTERTYPECAMERATEXTURE); _GetVideoMemInfo(&total, &avaible);
if(pFrontBuffer) debug("Available video memory %d\n", avaible);
ms_bJustInitialised = true;
else{ if(BlurOn)
debug("MBlurOpen can't create raster."); {
int32 width = Pow(2.0f, int32(log2(RwRasterGetWidth (RwCameraGetRaster(cam))))+1);
int32 height = Pow(2.0f, int32(log2(RwRasterGetHeight(RwCameraGetRaster(cam))))+1);
int32 depth = RwRasterGetDepth(RwCameraGetRaster(cam));
#ifndef LIBRW
extern D3DCAPS8 _RwD3D8DeviceCaps;
extern DWORD _dwMemTotalVideo;
if ( _RwD3D8DeviceCaps.MaxTextureWidth >= width && _RwD3D8DeviceCaps.MaxTextureHeight >= height )
{
total = _dwMemTotalVideo - 3 *
( RwRasterGetDepth(RwCameraGetRaster(cam))
* RwRasterGetHeight(RwCameraGetRaster(cam))
* RwRasterGetWidth(RwCameraGetRaster(cam)) / 8 );
BlurOn = total >= height*width*(depth/8) + (12*1024*1024) /*12 MB*/;
}
else
BlurOn = false; BlurOn = false;
#endif
if ( BlurOn )
{
ms_bScaledBlur = false;
rect.w = width;
rect.h = height;
pFrontBuffer = RwRasterCreate(rect.w, rect.h, depth, rwRASTERTYPECAMERATEXTURE);
if ( !pFrontBuffer )
{
debug("MBlurOpen can't create raster.");
BlurOn = false;
rect.w = RwRasterGetWidth(RwCameraGetRaster(cam));
rect.h = RwRasterGetHeight(RwCameraGetRaster(cam));
}
else
ms_bJustInitialised = true;
}
else
{
rect.w = RwRasterGetWidth(RwCameraGetRaster(cam)); rect.w = RwRasterGetWidth(RwCameraGetRaster(cam));
rect.h = RwRasterGetHeight(RwCameraGetRaster(cam)); rect.h = RwRasterGetHeight(RwCameraGetRaster(cam));
} }
_GetVideoMemInfo(&total, &avaible);
debug("Available video memory %d\n", avaible);
CreateImmediateModeData(cam, &rect); CreateImmediateModeData(cam, &rect);
}else{ }
else
{
rect.w = RwRasterGetWidth(RwCameraGetRaster(cam)); rect.w = RwRasterGetWidth(RwCameraGetRaster(cam));
rect.h = RwRasterGetHeight(RwCameraGetRaster(cam)); rect.h = RwRasterGetHeight(RwCameraGetRaster(cam));
CreateImmediateModeData(cam, &rect); CreateImmediateModeData(cam, &rect);
} }
return TRUE;
#endif
} }
void RwBool
CMBlur::MotionBlurClose(void) CMBlur::MotionBlurClose(void)
{ {
if(pFrontBuffer){ if(pFrontBuffer){
RwRasterDestroy(pFrontBuffer); RwRasterDestroy(pFrontBuffer);
pFrontBuffer = nil; pFrontBuffer = nil;
return TRUE;
} }
return FALSE;
} }
void void
@ -109,6 +187,10 @@ void
CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 addalpha) CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 addalpha)
{ {
RwRGBA color = { (RwUInt8)red, (RwUInt8)green, (RwUInt8)blue, (RwUInt8)blur }; RwRGBA color = { (RwUInt8)red, (RwUInt8)green, (RwUInt8)blue, (RwUInt8)blur };
#ifdef GTA_PS2
if( pFrontBuffer )
OverlayRender(cam, pFrontBuffer, color, type, addalpha);
#else
if(BlurOn){ if(BlurOn){
if(pFrontBuffer){ if(pFrontBuffer){
if(ms_bJustInitialised) if(ms_bJustInitialised)
@ -122,6 +204,7 @@ CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, u
}else{ }else{
OverlayRender(cam, nil, color, type, addalpha); OverlayRender(cam, nil, color, type, addalpha);
} }
#endif
} }
void void
@ -136,32 +219,33 @@ CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type,
DefinedState(); DefinedState();
switch(type){ switch(type)
case MBLUR_INTRO1: {
case MOTION_BLUR_SECURITY_CAM:
r = 0; r = 0;
g = 255; g = 255;
b = 0; b = 0;
a = 128; a = 128;
break; break;
case MBLUR_INTRO3: case MOTION_BLUR_INTRO:
r = 100; r = 100;
g = 220; g = 220;
b = 230; b = 230;
a = 158; a = 158;
break; break;
case MBLUR_INTRO4: case MOTION_BLUR_INTRO2:
r = 80; r = 80;
g = 255; g = 255;
b = 230; b = 230;
a = 138; a = 138;
break; break;
case MBLUR_INTRO6: case MOTION_BLUR_INTRO3:
r = 255; r = 255;
g = 60; g = 60;
b = 60; b = 60;
a = 200; a = 200;
break; break;
case MBLUR_UNUSED: case MOTION_BLUR_INTRO4:
r = 255; r = 255;
g = 180; g = 180;
b = 180; b = 180;
@ -170,11 +254,11 @@ CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type,
} }
if(!BlurOn){ if(!BlurOn){
r *= 0.6f; r = Min(r*0.6f, 255.0f);
g *= 0.6f; g = Min(g*0.6f, 255.0f);
b *= 0.6f; b = Min(b*0.6f, 255.0f);
if(type != 1) if(type != MOTION_BLUR_SNIPER)
a *= 0.6f; a = Min(a*0.6f, 255.0f);
// game clamps to 255 here, but why? // game clamps to 255 here, but why?
} }
RwIm2DVertexSetIntRGBA(&Vertex[0], r, g, b, a); RwIm2DVertexSetIntRGBA(&Vertex[0], r, g, b, a);

View File

@ -5,11 +5,12 @@ class CMBlur
public: public:
static RwRaster *pFrontBuffer; static RwRaster *pFrontBuffer;
static bool ms_bJustInitialised; static bool ms_bJustInitialised;
static bool ms_bScaledBlur;
static bool BlurOn; static bool BlurOn;
public: public:
static void MotionBlurOpen(RwCamera *cam); static RwBool MotionBlurOpen(RwCamera *cam);
static void MotionBlurClose(void); static RwBool MotionBlurClose(void);
static void CreateImmediateModeData(RwCamera *cam, RwRect *rect); static void CreateImmediateModeData(RwCamera *cam, RwRect *rect);
static void MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 addalpha); static void MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 addalpha);
static void OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type, uint32 bluralpha); static void OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type, uint32 bluralpha);

View File

@ -286,8 +286,8 @@ CTimeCycle::Update(void)
m_fCurrentBlurBlue = INTERP(m_fBlurBlue); m_fCurrentBlurBlue = INTERP(m_fBlurBlue);
m_fCurrentBlurAlpha = INTERP(m_fBlurAlpha); m_fCurrentBlurAlpha = INTERP(m_fBlurAlpha);
if(TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_NORMAL) if(TheCamera.m_BlurType == MOTION_BLUR_NONE || TheCamera.m_BlurType == MOTION_BLUR_LIGHT_SCENE)
TheCamera.SetMotionBlur(m_fCurrentBlurRed, m_fCurrentBlurGreen, m_fCurrentBlurBlue, m_fCurrentBlurAlpha, MBLUR_NORMAL); TheCamera.SetMotionBlur(m_fCurrentBlurRed, m_fCurrentBlurGreen, m_fCurrentBlurBlue, m_fCurrentBlurAlpha, MOTION_BLUR_LIGHT_SCENE);
if(m_FogReduction != 0) if(m_FogReduction != 0)
m_fCurrentFarClip = Max(m_fCurrentFarClip, m_FogReduction/64.0f * 650.0f); m_fCurrentFarClip = Max(m_fCurrentFarClip, m_FogReduction/64.0f * 650.0f);

3082
src/save/MemoryCard.cpp Normal file

File diff suppressed because it is too large Load Diff

197
src/save/MemoryCard.h Normal file
View File

@ -0,0 +1,197 @@
#pragma once
#include "common.h"
#ifdef PS2_MENU
#include "Date.h"
#if defined(PS2)
#include <libcdvd.h>
#include <sifdev.h>
#include <libvu0.h>
#endif
enum
{
CARD_ONE = 0,
CARD_TWO,
MAX_CARDS,
};
class CMemoryCardInfo
{
public:
int port;
int slot;
int type;
int free;
int format;
char dir[40];
#if defined(PS2)
sceMcTblGetDir table[15];
#else
struct
{
typedef struct {unsigned char Sec,Min,Hour; unsigned char Day,Month; unsigned short Year;} _time;
_time _Create;
_time _Modify;
unsigned int FileSizeByte;
unsigned short AttrFile;
unsigned char EntryName[32];
}table[15];
#endif
CMemoryCardInfo(void);
};
#define GUFF_FILE_SIZE 147096
#define SAVE_FILE_SIZE 201729
class CMemoryCard
{
public:
enum
{
MAX_SLOTS = 8,
};
enum MCSTATE
{
MCSTATE_OK = 0,
MCSTATE_NEED_500KB,
MCSTATE_NEED_200KB,
MCSTATE_NOCARD,
};
enum SLOTINFO
{
SLOT_PRESENT = 0,
SLOT_NOTPRESENT,
SLOT_CORRUPTED,
};
int _unk0;
int _unk1;
bool m_bWantToLoad;
bool JustLoadedDontFadeInYet;
bool StillToFadeOut;
bool b_FoundRecentSavedGameWantToLoad;
uint32 TimeStartedCountingForFade;
uint32 TimeToStayFadedBeforeFadeOut;
uint32 LastBlockSize;
bool _bunk2;
char ValidSaveName [30];
char MostRecentFile [30];
char _unkName3 [30];
char SaveFileNameJustSaved[30];
char _pad0[3];
wchar *pErrorMsg;
char _unk4[32];
bool _bunk5;
bool _bunk6;
bool _bunk7;
bool _bunk8;
int nError;
wchar _unk9[30];
char LoadFileName[30];
char _pad1[2];
CDate CompileDateAndTime;
int m_LanguageToLoad;
int m_LevelToLoad;
int CurrentCard;
CMemoryCardInfo Cards [MAX_CARDS];
int Slots [MAX_SLOTS];
wchar SlotFileName[MAX_SLOTS][30];
wchar SlotSaveDate[MAX_SLOTS][30];
char _unk10[32];
enum
{
ERR_NONE = 0,
ERR_NOFORMAT = 1,
ERR_DIRNOENTRY = 2,
ERR_OPENNOENTRY = 3,
ERR_DELETENOENTRY = 4,
ERR_DELETEDENIED = 5,
ERR_DELETEFAILED = 6,
ERR_WRITEFULLDEVICE = 7,
ERR_WRITENOENTRY = 8,
ERR_WRITEDENIED = 9,
ERR_FLUSHNOENTRY,
ERR_WRITEFAILED,
ERR_FORMATFAILED = 12,
ERR_FILETABLENOENTRY = 13,
ERR_DIRFULLDEVICE = 14,
ERR_DIRBADENTRY = 15,
ERR_FILEFULLDEVICE = 16,
ERR_FILENOPATHENTRY = 17,
ERR_FILEDENIED = 18,
ERR_FILEUPLIMIT = 19,
ERR_READNOENTRY = 20,
ERR_READDENIED = 21,
ERR_LOADFAILED = 22, // unused
ERR_SAVEFAILED = 23,
ERR_DATACORRUPTED = 24,
ERR_NOROOTDIR = 25,
NO_ERR_SUCCESS = 26,
};
enum
{
RES_SUCCESS = 1,
RES_FAILED = -1,
};
int32 GetError()
{
return nError;
}
wchar *GetErrorMessage()
{
return pErrorMsg;
}
int32 Init(void);
CMemoryCard(void);
int32 RestoreForStartLoad(void);
int32 LoadSavedGame(void);
int32 CheckCardInserted(int32 cardID);
int32 PopulateCardFlags(int32 cardID, bool bSlotFlag, bool bTypeFlag, bool bFreeFlag, bool bFormatFlag);
int32 FormatCard(int32 cardID);
int32 PopulateFileTable(int32 cardID);
int32 CreateRootDirectory(int32 cardID);
int32 ChangeDirectory(int32 cardID, char *dir);
int32 CreateIconFiles(int32 cardID, char *icon_one, char *icon_two, char *icon_three);
int32 LoadIconFiles(int32 cardID, char *icon_one, char *icon_two, char *icon_three);
int32 CloseMemCardFile(int32 file);
int32 CreateMemCardFileReadWrite(int32 cardID, char *filename);
int32 OpenMemCardFileForReading(int32 cardID, char *filename);
int32 ReadFromMemCard(int32 file, void *buff, int32 size);
int32 DeleteMemoryCardFile(int32 cardID, char *filename);
void PopulateErrorMessage();
int32 WritetoMemCard(int32 file, void *buff, int32 size);
bool SaveGame(void);
bool DoHackRoundSTUPIDSonyDateTimeStuff(int32 port, char *filename);
int32 LookForRootDirectory(int32 cardID);
int32 FillFirstFileWithGuff(int32 cardID);
bool FindMostRecentFileName(int32 cardID, char *filename);
void ClearFileTableBuffer(int32 cardID);
int32 GetClusterAmountForFileCreation(int32 port);
bool DeleteEverythingInGameRoot(int32 cardID);
int32 CheckDataNotCorrupt(char *filename);
int32 GetLanguageToLoad(void);
int32 GetLevelToLoad(void);
bool CreateGameDirectoryFromScratch(int32 cardID);
bool CheckGameDirectoryThere(int32 cardID);
void PopulateSlotInfo(int32 cardID);
int32 GetInfoOnSpecificSlot(int32 slotID);
wchar *GetDateAndTimeOfSavedGame(int32 slotID);
int32 CheckCardStateAtGameStartUp(int32 cardID);
void SaveSlot(int32 slotID);
void DeleteSlot(int32 slotID);
void LoadSlotToBuffer(int32 slotID);
wchar *GetNameOfSavedGame(int32 slotID);
int32 DoClassSaveRoutine(int32 file, uint8 *data, uint32 size);
};
extern CMemoryCard TheMemoryCard;
#endif

View File

@ -87,8 +87,10 @@ static psGlobalType PsGlobal;
#include "Frontend.h" #include "Frontend.h"
#include "Game.h" #include "Game.h"
#include "PCSave.h" #include "PCSave.h"
#include "MemoryCard.h"
#include "Sprite2d.h" #include "Sprite2d.h"
#include "AnimViewer.h" #include "AnimViewer.h"
#include "Font.h"
VALIDATE_SIZE(psGlobalType, 0x28); VALIDATE_SIZE(psGlobalType, 0x28);
@ -598,12 +600,49 @@ psInitialise(void)
PsGlobal.joy2 = nil; PsGlobal.joy2 = nil;
CFileMgr::Initialise(); CFileMgr::Initialise();
#ifdef PS2_MENU
CPad::Initialise();
CPad::GetPad(0)->Mode = 0;
CGame::frenchGame = false;
CGame::germanGame = false;
CGame::nastyGame = true;
CMenuManager::m_PrefsAllowNastyGame = true;
WORD lang = PRIMARYLANGID(GetSystemDefaultLCID());
if ( lang == LANG_ITALIAN )
CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_ITALIAN;
else if ( lang == LANG_SPANISH )
CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_SPANISH;
else if ( lang == LANG_GERMAN )
{
CGame::germanGame = true;
CGame::nastyGame = false;
CMenuManager::m_PrefsAllowNastyGame = false;
CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_GERMAN;
}
else if ( lang == LANG_FRENCH )
{
CGame::frenchGame = true;
CGame::nastyGame = false;
CMenuManager::m_PrefsAllowNastyGame = false;
CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_FRENCH;
}
else
CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_AMERICAN;
FrontEndMenuManager.InitialiseMenuContentsAfterLoadingGame();
TheMemoryCard.Init();
#else
C_PcSave::SetSaveDirectory(_psGetUserFilesFolder()); C_PcSave::SetSaveDirectory(_psGetUserFilesFolder());
InitialiseLanguage(); InitialiseLanguage();
#ifndef GTA3_1_1_PATCH #ifndef GTA3_1_1_PATCH
FrontEndMenuManager.LoadSettings(); FrontEndMenuManager.LoadSettings();
#endif
#endif #endif
gGameState = GS_START_UP; gGameState = GS_START_UP;
@ -650,8 +689,12 @@ psInitialise(void)
} }
} }
#ifndef PS2_MENU
#ifdef GTA3_1_1_PATCH #ifdef GTA3_1_1_PATCH
FrontEndMenuManager.LoadSettings(); FrontEndMenuManager.LoadSettings();
#endif
#endif #endif
dwDXVersion = GetDXVersion(); dwDXVersion = GetDXVersion();
@ -1437,7 +1480,9 @@ psSelectDevice()
FrontEndMenuManager.m_nPrefsDepth = vm.depth; FrontEndMenuManager.m_nPrefsDepth = vm.depth;
#endif #endif
#ifndef PS2_MENU
FrontEndMenuManager.m_nCurrOption = 0; FrontEndMenuManager.m_nCurrOption = 0;
#endif
/* Set up the video mode and set the apps window /* Set up the video mode and set the apps window
* dimensions to match */ * dimensions to match */
@ -1715,27 +1760,27 @@ void InitialiseLanguage()
{ {
case LANG_GERMAN: case LANG_GERMAN:
{ {
CMenuManager::m_PrefsLanguage = LANGUAGE_GERMAN; CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_GERMAN;
break; break;
} }
case LANG_SPANISH: case LANG_SPANISH:
{ {
CMenuManager::m_PrefsLanguage = LANGUAGE_SPANISH; CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_SPANISH;
break; break;
} }
case LANG_FRENCH: case LANG_FRENCH:
{ {
CMenuManager::m_PrefsLanguage = LANGUAGE_FRENCH; CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_FRENCH;
break; break;
} }
case LANG_ITALIAN: case LANG_ITALIAN:
{ {
CMenuManager::m_PrefsLanguage = LANGUAGE_ITALIAN; CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_ITALIAN;
break; break;
} }
default: default:
{ {
CMenuManager::m_PrefsLanguage = LANGUAGE_AMERICAN; CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_AMERICAN;
break; break;
} }
} }
@ -1884,13 +1929,12 @@ WinMain(HINSTANCE instance,
StaticPatcher::Apply(); StaticPatcher::Apply();
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, nil, SPIF_SENDCHANGE); SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, nil, SPIF_SENDCHANGE);
/*
// TODO: make this an option somewhere // TODO: make this an option somewhere
AllocConsole(); AllocConsole();
freopen("CONIN$", "r", stdin); freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stdout); freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr); freopen("CONOUT$", "w", stderr);
*/
/* /*
* Initialize the platform independent data. * Initialize the platform independent data.
@ -2033,24 +2077,35 @@ WinMain(HINSTANCE instance,
SetErrorMode(SEM_FAILCRITICALERRORS); SetErrorMode(SEM_FAILCRITICALERRORS);
if (!TurnOnAnimViewer) {
#ifdef NO_MOVIES #ifdef PS2_MENU
gGameState = GS_INIT_FRONTEND; int32 r = TheMemoryCard.CheckCardStateAtGameStartUp(CARD_ONE);
TRACE("gGameState = GS_INIT_FRONTEND"); if ( r == CMemoryCard::ERR_DIRNOENTRY || r == CMemoryCard::ERR_NOFORMAT
&& r != CMemoryCard::ERR_OPENNOENTRY && r != CMemoryCard::ERR_NONE )
{
LoadingScreen(nil, nil, "loadsc0"); LoadingScreen(nil, nil, "loadsc0");
if (!CGame::InitialiseOnceAfterRW())
RsGlobal.quit = TRUE; TheText.Unload();
TheText.Load();
CFont::Initialise();
FrontEndMenuManager.DrawMemoryCardStartUpMenus();
}
#endif #endif
} else {
if (TurnOnAnimViewer)
{
#ifndef MASTER #ifndef MASTER
CAnimViewer::Initialise(); CAnimViewer::Initialise();
#ifndef PS2_MENU
FrontEndMenuManager.m_bGameNotLoaded = false; FrontEndMenuManager.m_bGameNotLoaded = false;
#endif
gGameState = GS_ANIMVIEWER; gGameState = GS_ANIMVIEWER;
TurnOnAnimViewer = false; TurnOnAnimViewer = false;
#endif #endif
} }
while ( TRUE ) while ( TRUE )
{ {
RwInitialised = TRUE; RwInitialised = TRUE;
@ -2069,8 +2124,18 @@ WinMain(HINSTANCE instance,
/* /*
* Enter the message processing loop... * Enter the message processing loop...
*/ */
#ifdef PS2_MENU
if (TheMemoryCard.m_bWantToLoad)
LoadSplash(GetLevelSplashScreen(CGame::currLevel));
TheMemoryCard.m_bWantToLoad = false;
CTimer::Update();
while( !RsGlobal.quit && !(FrontEndMenuManager.m_bWantToRestart || TheMemoryCard.b_FoundRecentSavedGameWantToLoad) )
#else
while( !RsGlobal.quit && !FrontEndMenuManager.m_bWantToRestart ) while( !RsGlobal.quit && !FrontEndMenuManager.m_bWantToRestart )
#endif
{ {
if( PeekMessage(&message, nil, 0U, 0U, PM_REMOVE|PM_NOYIELD) ) if( PeekMessage(&message, nil, 0U, 0U, PM_REMOVE|PM_NOYIELD) )
{ {
@ -2090,7 +2155,11 @@ WinMain(HINSTANCE instance,
{ {
case GS_START_UP: case GS_START_UP:
{ {
#ifdef NO_MOVIES
gGameState = GS_INIT_ONCE;
#else
gGameState = GS_INIT_LOGO_MPEG; gGameState = GS_INIT_LOGO_MPEG;
#endif
TRACE("gGameState = GS_INIT_LOGO_MPEG"); TRACE("gGameState = GS_INIT_LOGO_MPEG");
break; break;
} }
@ -2165,16 +2234,30 @@ WinMain(HINSTANCE instance,
CloseClip(); CloseClip();
CoUninitialize(); CoUninitialize();
LoadingScreen(nil, nil, "loadsc0"); #ifdef PS2_MENU
extern char version_name[64];
if ( CGame::frenchGame || CGame::germanGame )
LoadingScreen(NULL, version_name, "loadsc24");
else
LoadingScreen(NULL, version_name, "loadsc0");
printf("Into TheGame!!!\n");
#else
LoadingScreen(nil, nil, "loadsc0");
#endif
if ( !CGame::InitialiseOnceAfterRW() ) if ( !CGame::InitialiseOnceAfterRW() )
RsGlobal.quit = TRUE; RsGlobal.quit = TRUE;
#ifdef PS2_MENU
gGameState = GS_INIT_PLAYING_GAME;
#else
gGameState = GS_INIT_FRONTEND; gGameState = GS_INIT_FRONTEND;
TRACE("gGameState = GS_INIT_FRONTEND;"); TRACE("gGameState = GS_INIT_FRONTEND;");
#endif
break; break;
} }
#ifndef PS2_MENU
case GS_INIT_FRONTEND: case GS_INIT_FRONTEND:
{ {
LoadingScreen(nil, nil, "loadsc0"); LoadingScreen(nil, nil, "loadsc0");
@ -2202,13 +2285,21 @@ WinMain(HINSTANCE instance,
if (wp.showCmd != SW_SHOWMINIMIZED) if (wp.showCmd != SW_SHOWMINIMIZED)
RsEventHandler(rsFRONTENDIDLE, nil); RsEventHandler(rsFRONTENDIDLE, nil);
#ifdef PS2_MENU
if ( !FrontEndMenuManager.m_bMenuActive || TheMemoryCard.m_bWantToLoad )
#else
if ( !FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bWantToLoad ) if ( !FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bWantToLoad )
#endif
{ {
gGameState = GS_INIT_PLAYING_GAME; gGameState = GS_INIT_PLAYING_GAME;
TRACE("gGameState = GS_INIT_PLAYING_GAME;"); TRACE("gGameState = GS_INIT_PLAYING_GAME;");
} }
#ifdef PS2_MENU
if (TheMemoryCard.m_bWantToLoad )
#else
if ( FrontEndMenuManager.m_bWantToLoad ) if ( FrontEndMenuManager.m_bWantToLoad )
#endif
{ {
InitialiseGame(); InitialiseGame();
FrontEndMenuManager.m_bGameNotLoaded = false; FrontEndMenuManager.m_bGameNotLoaded = false;
@ -2217,11 +2308,37 @@ WinMain(HINSTANCE instance,
} }
break; break;
} }
#endif
case GS_INIT_PLAYING_GAME: case GS_INIT_PLAYING_GAME:
{ {
#ifdef PS2_MENU
CGame::Initialise("DATA\\GTA3.DAT");
//LoadingScreen("Starting Game", NULL, GetRandomSplashScreen());
if ( TheMemoryCard.CheckCardInserted(CARD_ONE) == CMemoryCard::NO_ERR_SUCCESS
&& TheMemoryCard.ChangeDirectory(CARD_ONE, TheMemoryCard.Cards[CARD_ONE].dir)
&& TheMemoryCard.FindMostRecentFileName(CARD_ONE, TheMemoryCard.MostRecentFile) == true
&& TheMemoryCard.CheckDataNotCorrupt(TheMemoryCard.MostRecentFile))
{
strcpy(TheMemoryCard.LoadFileName, TheMemoryCard.MostRecentFile);
TheMemoryCard.b_FoundRecentSavedGameWantToLoad = true;
if (CMenuManager::m_PrefsLanguage != TheMemoryCard.GetLanguageToLoad())
{
CMenuManager::m_PrefsLanguage = TheMemoryCard.GetLanguageToLoad();
TheText.Unload();
TheText.Load();
}
CGame::currLevel = (eLevelName)TheMemoryCard.GetLevelToLoad();
}
#else
InitialiseGame(); InitialiseGame();
FrontEndMenuManager.m_bGameNotLoaded = false; FrontEndMenuManager.m_bGameNotLoaded = false;
#endif
gGameState = GS_PLAYING_GAME; gGameState = GS_PLAYING_GAME;
TRACE("gGameState = GS_PLAYING_GAME;"); TRACE("gGameState = GS_PLAYING_GAME;");
break; break;
@ -2271,16 +2388,43 @@ WinMain(HINSTANCE instance,
RwInitialised = FALSE; RwInitialised = FALSE;
FrontEndMenuManager.UnloadTextures(); FrontEndMenuManager.UnloadTextures();
#ifdef PS2_MENU
if ( !(FrontEndMenuManager.m_bWantToRestart || TheMemoryCard.b_FoundRecentSavedGameWantToLoad))
break;
#else
if ( !FrontEndMenuManager.m_bWantToRestart ) if ( !FrontEndMenuManager.m_bWantToRestart )
break; break;
#endif
CPad::ResetCheats(); CPad::ResetCheats();
CPad::StopPadsShaking(); CPad::StopPadsShaking();
DMAudio.ChangeMusicMode(MUSICMODE_DISABLE); DMAudio.ChangeMusicMode(MUSICMODE_DISABLE);
#ifdef PS2_MENU
CGame::ShutDownForRestart();
#endif
CTimer::Stop(); CTimer::Stop();
#ifdef PS2_MENU
if (FrontEndMenuManager.m_bWantToRestart || TheMemoryCard.b_FoundRecentSavedGameWantToLoad)
{
if (TheMemoryCard.b_FoundRecentSavedGameWantToLoad)
{
FrontEndMenuManager.m_bWantToRestart = true;
TheMemoryCard.m_bWantToLoad = true;
}
CGame::InitialiseWhenRestarting();
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
FrontEndMenuManager.m_bWantToRestart = false;
continue;
}
CGame::ShutDown();
CTimer::Stop();
break;
#else
if ( FrontEndMenuManager.m_bWantToLoad ) if ( FrontEndMenuManager.m_bWantToLoad )
{ {
CGame::ShutDownForRestart(); CGame::ShutDownForRestart();
@ -2312,6 +2456,7 @@ WinMain(HINSTANCE instance,
FrontEndMenuManager.m_bFirstTime = false; FrontEndMenuManager.m_bFirstTime = false;
FrontEndMenuManager.m_bWantToRestart = false; FrontEndMenuManager.m_bWantToRestart = false;
#endif
} }

View File

@ -31,29 +31,29 @@ CText::Load(void)
CFileMgr::SetDir("TEXT"); CFileMgr::SetDir("TEXT");
switch(CMenuManager::m_PrefsLanguage){ switch(CMenuManager::m_PrefsLanguage){
case LANGUAGE_AMERICAN: case CMenuManager::LANGUAGE_AMERICAN:
sprintf(filename, "AMERICAN.GXT"); sprintf(filename, "AMERICAN.GXT");
break; break;
case LANGUAGE_FRENCH: case CMenuManager::LANGUAGE_FRENCH:
sprintf(filename, "FRENCH.GXT"); sprintf(filename, "FRENCH.GXT");
break; break;
case LANGUAGE_GERMAN: case CMenuManager::LANGUAGE_GERMAN:
sprintf(filename, "GERMAN.GXT"); sprintf(filename, "GERMAN.GXT");
break; break;
case LANGUAGE_ITALIAN: case CMenuManager::LANGUAGE_ITALIAN:
sprintf(filename, "ITALIAN.GXT"); sprintf(filename, "ITALIAN.GXT");
break; break;
case LANGUAGE_SPANISH: case CMenuManager::LANGUAGE_SPANISH:
sprintf(filename, "SPANISH.GXT"); sprintf(filename, "SPANISH.GXT");
break; break;
#ifdef MORE_LANGUAGES #ifdef MORE_LANGUAGES
case LANGUAGE_POLISH: case CMenuManager::LANGUAGE_POLISH:
sprintf(filename, "POLISH.GXT"); sprintf(filename, "POLISH.GXT");
break; break;
case LANGUAGE_RUSSIAN: case CMenuManager::LANGUAGE_RUSSIAN:
sprintf(filename, "RUSSIAN.GXT"); sprintf(filename, "RUSSIAN.GXT");
break; break;
case LANGUAGE_JAPANESE: case CMenuManager::LANGUAGE_JAPANESE:
sprintf(filename, "JAPANESE.GXT"); sprintf(filename, "JAPANESE.GXT");
break; break;
#endif #endif
@ -298,12 +298,32 @@ UnicodeToAsciiForSaveLoad(wchar *src)
return aStr; return aStr;
} }
char*
UnicodeToAsciiForMemoryCard(wchar *src)
{
static char aStr[256];
int len;
for(len = 0; *src != '\0' && len < 256-1; len++, src++)
if(*src < 256)
aStr[len] = *src;
else
aStr[len] = '#';
aStr[len] = '\0';
return aStr;
}
void void
UnicodeStrcpy(wchar *dst, const wchar *src) UnicodeStrcpy(wchar *dst, const wchar *src)
{ {
while((*dst++ = *src++) != '\0'); while((*dst++ = *src++) != '\0');
} }
void
UnicodeStrcat(wchar *dst, wchar *append)
{
UnicodeStrcpy(&dst[UnicodeStrlen(dst)], append);
}
int int
UnicodeStrlen(const wchar *str) UnicodeStrlen(const wchar *str)
{ {

View File

@ -3,7 +3,9 @@
void AsciiToUnicode(const char *src, wchar *dst); void AsciiToUnicode(const char *src, wchar *dst);
char *UnicodeToAscii(wchar *src); char *UnicodeToAscii(wchar *src);
char *UnicodeToAsciiForSaveLoad(wchar *src); char *UnicodeToAsciiForSaveLoad(wchar *src);
char *UnicodeToAsciiForMemoryCard(wchar *src);
void UnicodeStrcpy(wchar *dst, const wchar *src); void UnicodeStrcpy(wchar *dst, const wchar *src);
void UnicodeStrcat(wchar *dst, wchar *append);
int UnicodeStrlen(const wchar *str); int UnicodeStrlen(const wchar *str);
void TextCopy(wchar *dst, const wchar *src); void TextCopy(wchar *dst, const wchar *src);