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

View File

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

View File

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

View File

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

View File

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

View File

@ -119,7 +119,7 @@ CGameLogic::Update()
RestorePlayerStuffDuringResurrection(pPlayerInfo.m_pPed, vecRestartPos, fRestartFloat);
SortOutStreamingAndMemory(pPlayerInfo.GetPos());
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);
CReferences::RemoveReferencesToPlayer();
CCarCtrl::CountDownToCarsAtStart = 2;
@ -191,7 +191,7 @@ CGameLogic::Update()
pPlayerInfo.m_pPed->ClearWeapons();
SortOutStreamingAndMemory(pPlayerInfo.GetPos());
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);
CReferences::RemoveReferencesToPlayer();
CCarCtrl::CountDownToCarsAtStart = 2;
@ -230,7 +230,7 @@ CGameLogic::Update()
RestorePlayerStuffDuringResurrection(pPlayerInfo.m_pPed, vecRestartPos, fRestartFloat);
SortOutStreamingAndMemory(pPlayerInfo.GetPos());
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);
CReferences::RemoveReferencesToPlayer();
CCarCtrl::CountDownToCarsAtStart = 2;

View File

@ -376,7 +376,7 @@ private:
enum {
MAX_STACK_DEPTH = 6,
MAX_STACK_DEPTH = 6, // 4 PS2
NUM_LOCAL_VARS = 16,
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;
}
TheCamera.SetMotionBlur(180, 255, 180, 120, MBLUR_SNIPER);
TheCamera.SetMotionBlur(180, 255, 180, 120, MOTION_BLUR_SNIPER);
if(FOV > DefaultFOV)
FOV = DefaultFOV;
@ -3009,7 +3009,7 @@ CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float
FOVSpeed = 0.0f;
}
TheCamera.SetMotionBlur(180, 255, 180, 120, MBLUR_SNIPER);
TheCamera.SetMotionBlur(180, 255, 180, 120, MOTION_BLUR_SNIPER);
if(FOV > DefaultFOV)
FOV = DefaultFOV;
@ -3644,7 +3644,7 @@ CCam::Process_Fixed(const CVector &CameraTarget, float, float, float)
if(TheCamera.m_bUseSpecialFovTrain)
FOV = TheCamera.m_fFovForTrain;
if(CMenuManager::m_ControlMethod == 0 && Using3rdPersonMouseCam()){
if(CMenuManager::m_ControlMethod == CONTROL_STANDARD && Using3rdPersonMouseCam()){
CPed *player = FindPlayerPed();
if(player && player->CanStrafeOrMouseControl()){
float Heading = Front.Heading();

View File

@ -30,6 +30,7 @@
#include "Pools.h"
#include "Debug.h"
#include "GenericGameStorage.h"
#include "MemoryCard.h"
#include "Camera.h"
enum
@ -91,17 +92,28 @@ CCamera::Init(void)
float fMouseAccelHorzntl = m_fMouseAccelHorzntl;
float fMouseAccelVertical = m_fMouseAccelVertical;
#endif
#ifdef FIX_BUGS
static const CCamera DummyCamera = CCamera(0.f);
*this = DummyCamera;
#else
memset(this, 0, sizeof(CCamera)); // getting rid of vtable, eh?
#ifdef PS2_MENU
if ( !TheMemoryCard.m_bWantToLoad && !FrontEndMenuManager.m_bWantToRestart ) {
#endif
#ifdef GTA3_1_1_PATCH
m_fMouseAccelHorzntl = fMouseAccelHorzntl;
m_fMouseAccelVertical = fMouseAccelVertical;
#ifdef FIX_BUGS
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
m_pRwCamera = nil;
m_1rstPersonRunCloseToAWall = false;
m_fPositionAlongSpline = 0.0f;
m_bCameraJustRestored = false;
@ -168,7 +180,12 @@ CCamera::Init(void)
PlayerExhaustion = 1.0f;
DebugCamMode = CCam::MODE_NONE;
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;
CDraw::FadeValue = 0;
m_fFLOATingFade = 0.0f;
@ -177,7 +194,11 @@ CCamera::Init(void)
m_fFLOATingFadeMusic = 0.0f;
}
m_bMoveCamToAvoidGeom = false;
#ifdef PS2_MENU
if ( TheMemoryCard.m_bWantToLoad || FrontEndMenuManager.m_bWantToRestart )
#else
if(FrontEndMenuManager.m_bWantToRestart)
#endif
m_bMoveCamToAvoidGeom = true;
m_bStartingSpline = false;
m_iTypeOfSwitch = INTERPOLATION;
@ -493,10 +514,10 @@ CCamera::Process(void)
GetMatrix().GetPosition().y += shakeOffset * (((shakeRand & 0xF0) >> 4) - 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));
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();
CDraw::SetFOV(FOV);
@ -2208,7 +2229,7 @@ CCamera::ProcessWideScreenOn(void)
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);
CSprite2d::DrawRect(
@ -3102,7 +3123,11 @@ CCamera::ProcessMusicFade(void)
if(m_fTimeToFadeMusic == 0.0f)
m_fTimeToFadeMusic = 1.0f;
#ifdef PS2_MENU
if(m_bMoveCamToAvoidGeom || TheMemoryCard.StillToFadeOut){
#else
if(m_bMoveCamToAvoidGeom || StillToFadeOut){
#endif
m_fFLOATingFadeMusic = 256.0f;
m_bMoveCamToAvoidGeom = false;
}else

View File

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

View File

@ -11,6 +11,7 @@ public:
static void SetDirMyDocuments(void);
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) { return OpenFile(file, "rb"); }
static int OpenFileForWriting(const char *file);
static int Read(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 "main.h"
#include "Timer.h"
#include "Pad.h"
#include "ControllerConfig.h"
#include "VisibilityPlugins.h"
#include "Sprite2d.h"
#include "Text.h"
#include "Font.h"
#include "Frontend.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
CPlaceableShText::Draw(float x, float y)
@ -490,7 +488,7 @@ void
CMenuMultiChoiceTriggered::SelectCurrentOptionUnderCursor(void)
{
CMenuMultiChoice::SelectCurrentOptionUnderCursor();
if(m_cursor != -1)
if(m_cursor != -1 && m_triggers[m_cursor] != NULL )
m_triggers[m_cursor](this);
}
@ -581,7 +579,10 @@ CMenuMultiChoicePictured::Draw(const CRGBA &optionHighlight, const CRGBA &titleH
for(i = 0; i < m_numOptions; i++)
if(i == m_cursor){
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{
if(m_bHasSprite[i]){
if(m_options[i].m_bSelected)
@ -1210,10 +1211,10 @@ CMenuSlider::Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight, flo
{
if(m_bActive){
CRGBA selectionCol = m_colors[0];
if(selectionCol.red == SELECTED_TEXT_COLOR_0.red &&
selectionCol.green == SELECTED_TEXT_COLOR_0.green &&
selectionCol.blue == SELECTED_TEXT_COLOR_0.blue &&
selectionCol.alpha == SELECTED_TEXT_COLOR_0.alpha)
if(optionHighlight.red == SELECTED_TEXT_COLOR_0.red &&
optionHighlight.green == SELECTED_TEXT_COLOR_0.green &&
optionHighlight.blue == SELECTED_TEXT_COLOR_0.blue &&
optionHighlight.alpha == SELECTED_TEXT_COLOR_0.alpha)
selectionCol = m_colors[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);
if(m_box.m_bDropShadow)
CSprite2d::DrawRect(
CRect(boxPos.x + m_box.m_shadowOffset.x,
boxPos.y + m_box.m_shadowOffset.y,
boxPos.x + m_box.m_shadowOffset.x + m_size[0].x,
boxPos.y + m_box.m_shadowOffset.y + m_size[0].y),
CRect(boxPos.x + X(m_box.m_shadowOffset.x),
boxPos.y + Y(m_box.m_shadowOffset.y),
boxPos.x + X(m_box.m_shadowOffset.x) + m_size[0].x,
boxPos.y + Y(m_box.m_shadowOffset.y) + m_size[0].y),
shadowCol);
CSprite2d::DrawRect(
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);
if(m_box.m_bDropShadow)
CSprite2d::DrawRect(
CRect(boxPos.x + m_box.m_shadowOffset.x,
boxPos.y + m_box.m_shadowOffset.y,
boxPos.x + m_box.m_shadowOffset.x + m_size[0].x,
boxPos.y + m_box.m_shadowOffset.y + m_size[0].y),
CRect(boxPos.x + X(m_box.m_shadowOffset.x),
boxPos.y + Y(m_box.m_shadowOffset.y),
boxPos.x + X(m_box.m_shadowOffset.x) + m_size[0].x,
boxPos.y + Y(m_box.m_shadowOffset.y) + m_size[0].y),
shadowCol);
CSprite2d::DrawRect(
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);
if(m_box.m_bDropShadow)
CSprite2d::DrawRect(
CRect(boxPos.x + m_box.m_shadowOffset.x,
boxPos.y + m_box.m_shadowOffset.y,
boxPos.x + m_box.m_shadowOffset.x + m_size[0].x,
boxPos.y + m_box.m_shadowOffset.y + m_size[0].y),
CRect(boxPos.x + X(m_box.m_shadowOffset.x),
boxPos.y + Y(m_box.m_shadowOffset.y),
boxPos.x + X(m_box.m_shadowOffset.x) + m_size[0].x,
boxPos.y + Y(m_box.m_shadowOffset.y) + m_size[0].y),
shadowCol);
CSprite2d::DrawRect(
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)
{
int i;
int numTicks = size.x / 8.0f;
int numTicks = size.x / X(8.0f);
float dy = heightRight - size.y;
float stepy = dy / numTicks;
int left = level*numTicks;
int drewSelection = 0;
for(i = 0; i < numTicks; i++){
CRect rect(position.x + 8.0f*i, position.y + dy - stepy*i,
position.x + 8.0f*i + 4.0f, position.y + dy + size.y);
CRect rect(position.x + X(8.0f)*i, position.y + dy - stepy*i,
position.x + X(8.0f)*i + X(4.0f), position.y + dy + size.y);
if(bShadow){
CRect shadowRect = rect;
shadowRect.left += shadowOffset.x;
shadowRect.right += shadowOffset.x;
shadowRect.top += shadowOffset.y;
shadowRect.bottom += shadowOffset.y;
shadowRect.left += X(shadowOffset.x);
shadowRect.right += X(shadowOffset.x);
shadowRect.top += Y(shadowOffset.y);
shadowRect.bottom += Y(shadowOffset.y);
CSprite2d::DrawRect(shadowRect, shadowColor);
}
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)
{
int i;
int numTicks = size.x / 8.0f;
int numTicks = size.x / X(8.0f);
float dy = heightRight - size.y;
float stepy = dy / numTicks;
int left = level*numTicks;
for(i = 0; i < numTicks; i++){
CRect rect(position.x + 8.0f*i, position.y + dy - stepy*i,
position.x + 8.0f*i + 4.0f, position.y + dy + size.y);
CRect rect(position.x + X(8.0f)*i, position.y + dy - stepy*i,
position.x + X(8.0f)*i + X(4.0f), position.y + dy + size.y);
if(bShadow){
CRect shadowRect = rect;
shadowRect.left += shadowOffset.x;
shadowRect.right += shadowOffset.x;
shadowRect.top += shadowOffset.y;
shadowRect.bottom += shadowOffset.y;
shadowRect.left += X(shadowOffset.x);
shadowRect.right += X(shadowOffset.x);
shadowRect.top += Y(shadowOffset.y);
shadowRect.bottom += Y(shadowOffset.y);
CSprite2d::DrawRect(shadowRect, shadowColor);
}
if(i < left)
@ -1553,7 +1554,7 @@ CMenuLineLister::Draw(const CRGBA &optionHighlight, const CRGBA &titleHighlight,
for(; i < n; i++){
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);
else
m_lineFade[i] = 4.0f*Abs(m_scrollSpeed);
@ -1652,7 +1653,12 @@ CMenuPage::ActiveMenuTwoState_SelectNextPosition(void)
if(sel == 1)
m_pCurrentControl->SelectCurrentOptionUnderCursor();
else if(sel == 0){
m_pCurrentControl->GoNext();
if ( m_pCurrentControl )
{
if ( !m_pCurrentControl->GoNext() )
m_pCurrentControl->GoFirst();
}
m_pCurrentControl->SelectCurrentOptionUnderCursor();
}
}

View File

@ -8,6 +8,41 @@ enum {
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
{
@ -17,7 +52,7 @@ public:
wchar *m_text;
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 SetColor(const CRGBA &color) { m_color = color; }
CRGBA GetColor(void) { return m_color; }
@ -553,11 +588,14 @@ public:
static wchar Buf16[8];
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 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 AddTitle(wchar *text, float positionX, float positionY);

View File

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

View File

@ -1,4 +1,7 @@
#pragma once
#ifdef PS2_MENU
#include "Frontend_PS2.h"
#else
#include "Sprite2d.h"
@ -81,20 +84,6 @@
#define CONTSETUP_BACK_BOTTOM 122.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
{
FE2_MAINPANEL_UL,
@ -545,6 +534,19 @@ public:
int32 m_nSelectedScreenMode;
#endif
enum LANGUAGE
{
LANGUAGE_AMERICAN,
LANGUAGE_FRENCH,
LANGUAGE_GERMAN,
LANGUAGE_ITALIAN,
LANGUAGE_SPANISH,
#ifdef MORE_LANGUAGES
LANGUAGE_POLISH,
LANGUAGE_RUSSIAN,
LANGUAGE_JAPANESE,
#endif
};
public:
bool GetIsMenuActive() {return !!m_bMenuActive;}
@ -662,3 +664,4 @@ VALIDATE_SIZE(CMenuManager, 0x564);
#endif
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 "MBlur.h"
#include "Messages.h"
#include "MemoryCard.h"
#include "Pad.h"
#include "Particle.h"
#include "ParticleObject.h"
@ -103,6 +104,43 @@ bool CGame::japaneseGame = false;
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
CGame::InitialiseOnceBeforeRW(void)
{
@ -272,6 +310,9 @@ bool CGame::Initialise(const char* datFile)
CWeather::Init();
CCullZones::Init();
CCollision::Init();
#ifdef PS2_MENU
TheText.Load();
#endif
CTheZones::Init();
CUserDisplay::Init();
CMessages::Init();
@ -280,6 +321,11 @@ bool CGame::Initialise(const char* datFile)
CRestart::Initialise();
CWorld::Initialise();
CParticle::Initialise();
#ifdef PS2
gStartX = -180.0f;
gStartY = 180.0f;
gStartZ = 14.0f;
#endif
CAnimManager::Initialise();
CCutsceneMgr::Initialise();
CCarCtrl::Init();
@ -363,10 +409,16 @@ bool CGame::Initialise(const char* datFile)
CCredits::Init();
CRecordDataForChase::Init();
CReplay::Init();
LoadingScreen("Loading the Game", "Start script", nil);
#ifdef PS2_MENU
if ( !TheMemoryCard.m_bWantToLoad )
{
#endif
CTheScripts::StartTestScript();
CTheScripts::Process();
TheCamera.Process();
#ifdef PS2_MENU
}
#endif
LoadingScreen("Loading the Game", "Load scene", nil);
CModelInfo::RemoveColModelsFromOtherLevels(currLevel);
CCollision::ms_collisionInMemory = currLevel;
@ -431,8 +483,15 @@ bool CGame::ShutDown(void)
void CGame::ReInitGameObjectVariables(void)
{
CGameLogic::InitAtStartOfGame();
TheCamera.CCamera::Init();
#ifdef PS2_MENU
if ( !TheMemoryCard.m_bWantToLoad )
{
#endif
TheCamera.Init();
TheCamera.SetRwCamera(Scene.camera);
#ifdef PS2_MENU
}
#endif
CDebug::DebugInitTextBuffer();
CWeather::Init();
CUserDisplay::Init();
@ -441,6 +500,11 @@ void CGame::ReInitGameObjectVariables(void)
CWorld::bDoingCarCollisions = false;
CHud::ReInitialise();
CRadar::Initialise();
#ifdef PS2
gStartX = -180.0f;
gStartY = 180.0f;
gStartZ = 14.0f;
#endif
CCarCtrl::ReInit();
CTimeCycle::Initialise();
CDraw::SetFOV(120.0f);
@ -456,6 +520,10 @@ void CGame::ReInitGameObjectVariables(void)
CWorld::Players[i].Clear();
CWorld::PlayerInFocus = 0;
#ifdef PS2
CWeaponEffects::Init();
CSkidmarks::Init();
#endif
CAntennas::Init();
CGlass::Init();
gPhoneInfo.Initialise();
@ -471,12 +539,20 @@ void CGame::ReInitGameObjectVariables(void)
CPickups::Init();
CPacManPickups::Init();
CGarages::Init();
#ifdef PS2
CClouds::Init();
CRemote::Init();
#endif
CSpecialFX::Init();
CWaterCannons::Init();
CParticle::ReloadConfig();
CCullZones::ResolveVisibilities();
#ifdef PS2_MENU
if ( !TheMemoryCard.m_bWantToLoad )
#else
if ( !FrontEndMenuManager.m_bWantToLoad )
#endif
{
CCranes::InitCranes();
CTheScripts::StartTestScript();
@ -533,8 +609,10 @@ void CGame::ShutDownForRestart(void)
CRadar::RemoveRadarSections();
FrontEndMenuManager.UnloadTextures();
CParticleObject::RemoveAllParticleObjects();
#ifndef PS2
CPedType::Shutdown();
CSpecialFX::Shutdown();
#endif
TidyUpMemory(true, false);
}
@ -545,19 +623,102 @@ void CGame::InitialiseWhenRestarting(void)
CTimer::Initialise();
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;
#endif
TheCamera.Init();
#ifdef PS2_MENU
if ( TheMemoryCard.m_bWantToLoad == true )
{
TheMemoryCard.RestoreForStartLoad();
CStreaming::LoadScene(TheCamera.GetPosition());
}
#else
if ( FrontEndMenuManager.m_bWantToLoad == true )
{
RestoreForStartLoad();
CStreaming::LoadScene(TheCamera.GetPosition());
}
#endif
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 ( GenericLoad() == true )
@ -583,6 +744,7 @@ void CGame::InitialiseWhenRestarting(void)
CCollision::SortOutCollisionAfterLoad();
}
}
#endif
CTimer::Update();
@ -596,8 +758,8 @@ void CGame::Process(void)
ProcessTidyUpMemory();
#endif
TheCamera.SetMotionBlurAlpha(0);
if (TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_SNIPER || TheCamera.m_BlurType == MBLUR_NORMAL)
TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE);
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, MOTION_BLUR_NONE);
#ifdef DEBUGMENU
DebugMenuProcess();
#endif
@ -666,6 +828,9 @@ void CGame::Process(void)
CCarCtrl::RemoveDistantCars();
}
}
#ifdef PS2
CMemCheck::DoTest();
#endif
}
void CGame::DrasticTidyUpMemory(bool)

View File

@ -37,13 +37,27 @@
#include "Wanted.h"
#include "General.h"
#ifdef GTA_PS2
#include "eetypes.h"
#include "libpad.h"
#endif
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;
bool CPad::bDisplayNoControllerMessage;
bool CPad::bObsoleteControllerMessage;
bool CPad::bOldDisplayNoControllerMessage;
bool CPad::m_bMapPadOneToPadTwo;
#ifdef GTA_PS2
unsigned char act_direct[6];
unsigned char act_align[6];
#endif
CKeyboardState CPad::OldKeyState;
CKeyboardState CPad::NewKeyState;
@ -329,15 +343,17 @@ void AltDodoCheat(void)
}
#endif
#ifdef DETECT_PAD_INPUT_SWITCH
bool
CControllerState::IsAnyButtonPressed(void)
{
return !!LeftStickX || !!LeftStickY || !!RightStickX || !!RightStickY || !!LeftShoulder1 || !!LeftShoulder2 || !!RightShoulder1 || !!RightShoulder2 ||
!!DPadUp || !!DPadDown || !!DPadLeft || !!DPadRight || !!Start || !!Select || !!Square || !!Triangle || !!Cross || !!Circle || !!LeftShock ||
!!RightShock || !!NetworkTalk;
return !!RightStickX || !!RightStickY || !!LeftStickX || !!LeftStickY
|| !!DPadUp || !!DPadDown || !!DPadLeft || !!DPadRight
|| !!Triangle || !!Cross || !!Circle || !!Square
|| !!Start || !!Select
|| !!LeftShoulder1 || !!LeftShoulder2 || !!RightShoulder1 || !!RightShoulder2
|| !!LeftShock || !!RightShock
|| !!NetworkTalk;
}
#endif
void
CControllerState::Clear(void)
@ -383,6 +399,12 @@ void CKeyboardState::Clear()
#ifdef GTA_PS2_STUFF
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++)
{
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;
#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 (!CRecordDataForGame::IsPlayingBack() && !CRecordDataForChase::ShouldThisPadBeLeftAlone(unk))
if (!CRecordDataForGame::IsPlayingBack() && !CRecordDataForChase::ShouldThisPadBeLeftAlone(pad))
#endif
{
NewState = ReconcileTwoControllersInput(PCTempKeyState, PCTempJoyState);
@ -1171,9 +1450,22 @@ void CPad::StopPadsShaking(void)
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)

View File

@ -29,9 +29,7 @@ public:
float GetRightStickX(void) { return RightStickX/32767.0f; };
float GetRightStickY(void) { return RightStickY/32767.0f; };
#ifdef DETECT_PAD_INPUT_SWITCH
bool IsAnyButtonPressed();
#endif
void Clear(void);
};
VALIDATE_SIZE(CControllerState, 0x2A);
@ -199,13 +197,13 @@ public:
static void UpdatePads(void);
void ProcessPCSpecificStuff(void);
void Update(int16 unk);
void Update(int16 pad);
static void DoCheats(void);
void DoCheats(int16 unk);
static void StopPadsShaking(void);
void StopShaking(int16 unk);
void StopShaking(int16 pad);
static CPad *GetPad(int32 pad);
@ -453,6 +451,11 @@ public:
void SetDisablePlayerControls(uint8 who) { DisablePlayerControls |= who; }
void SetEnablePlayerControls(uint8 who) { 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);

View File

@ -56,6 +56,7 @@ public:
friend bool GenericLoad(void);
friend bool GenericSave(int file);
friend class CMemoryCard;
#ifdef FIX_BUGS
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_HEIGHT (448)
#define DEFAULT_SCREEN_HEIGHT_PAL (512)
#define DEFAULT_SCREEN_HEIGHT_NTSC (448)
#define DEFAULT_ASPECT_RATIO (4.0f/3.0f)
#define DEFAULT_VIEWWINDOW (0.7f)
@ -153,6 +155,16 @@ public:
CRGBA(void) { }
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)
{
this->r = right.r;

View File

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

View File

@ -128,12 +128,12 @@ CCredits::Render(void)
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED040"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
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);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED042"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
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);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED044"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
@ -176,7 +176,7 @@ CCredits::Render(void)
PrintCreditSpace(2.0f, lineoffset);
PrintCreditSpace(2.0f, lineoffset);
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);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED062"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
@ -191,7 +191,7 @@ CCredits::Render(void)
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED068"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
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);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED070"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
@ -220,7 +220,7 @@ CCredits::Render(void)
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED262"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
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);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED086"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
@ -265,76 +265,76 @@ CCredits::Render(void)
PrintCreditText(1.0, 1.0, TheText.Get("CRED108"), lineoffset, scrolloffset);
PrintCreditSpace(1.0, lineoffset);
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);
PrintCreditText(1.0, 1.0, TheText.Get("CRED110"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED111"), 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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
PrintCreditText(1.0, 1.0, TheText.Get("CRED134"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);

View File

@ -380,7 +380,7 @@ void CScrollBar::Update()
m_pMessage = FindTimeMessage();
break;
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();
else
m_pMessage = "WWW.GRANDTHEFTAUTO3.COM ";
@ -600,7 +600,7 @@ void CScrollBar::Update()
m_pMessage = "FREE FLUFFY DICE WITH ALL PURCHASES. . .";
break;
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 . . . ";
else
m_pMessage = "HTTP:((ROCKSTARGAMES.COM(GRANDTHEFTAUTO3(CAPITALAUTOS ";

View File

@ -492,7 +492,7 @@ void CHud::Draw()
CFont::SetPropOn();
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));
else
CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f));
@ -586,7 +586,7 @@ void CHud::Draw()
CFont::SetPropOn();
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));
else
CFont::SetScale(SCREEN_SCALE_X(1.2f * 0.85f), SCREEN_SCALE_Y(1.2f));
@ -1279,7 +1279,7 @@ void CHud::DrawAfterFade()
CFont::SetJustifyOff();
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));
else
CFont::SetScale(SCREEN_SCALE_X(1.04f), SCREEN_SCALE_Y(1.6f));

View File

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

View File

@ -5,11 +5,12 @@ class CMBlur
public:
static RwRaster *pFrontBuffer;
static bool ms_bJustInitialised;
static bool ms_bScaledBlur;
static bool BlurOn;
public:
static void MotionBlurOpen(RwCamera *cam);
static void MotionBlurClose(void);
static RwBool MotionBlurOpen(RwCamera *cam);
static RwBool MotionBlurClose(void);
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 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_fCurrentBlurAlpha = INTERP(m_fBlurAlpha);
if(TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_NORMAL)
TheCamera.SetMotionBlur(m_fCurrentBlurRed, m_fCurrentBlurGreen, m_fCurrentBlurBlue, m_fCurrentBlurAlpha, 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, MOTION_BLUR_LIGHT_SCENE);
if(m_FogReduction != 0)
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 "Game.h"
#include "PCSave.h"
#include "MemoryCard.h"
#include "Sprite2d.h"
#include "AnimViewer.h"
#include "Font.h"
VALIDATE_SIZE(psGlobalType, 0x28);
@ -598,12 +600,49 @@ psInitialise(void)
PsGlobal.joy2 = nil;
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());
InitialiseLanguage();
#ifndef GTA3_1_1_PATCH
FrontEndMenuManager.LoadSettings();
#endif
#endif
gGameState = GS_START_UP;
@ -650,8 +689,12 @@ psInitialise(void)
}
}
#ifndef PS2_MENU
#ifdef GTA3_1_1_PATCH
FrontEndMenuManager.LoadSettings();
#endif
#endif
dwDXVersion = GetDXVersion();
@ -1437,7 +1480,9 @@ psSelectDevice()
FrontEndMenuManager.m_nPrefsDepth = vm.depth;
#endif
#ifndef PS2_MENU
FrontEndMenuManager.m_nCurrOption = 0;
#endif
/* Set up the video mode and set the apps window
* dimensions to match */
@ -1715,27 +1760,27 @@ void InitialiseLanguage()
{
case LANG_GERMAN:
{
CMenuManager::m_PrefsLanguage = LANGUAGE_GERMAN;
CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_GERMAN;
break;
}
case LANG_SPANISH:
{
CMenuManager::m_PrefsLanguage = LANGUAGE_SPANISH;
CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_SPANISH;
break;
}
case LANG_FRENCH:
{
CMenuManager::m_PrefsLanguage = LANGUAGE_FRENCH;
CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_FRENCH;
break;
}
case LANG_ITALIAN:
{
CMenuManager::m_PrefsLanguage = LANGUAGE_ITALIAN;
CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_ITALIAN;
break;
}
default:
{
CMenuManager::m_PrefsLanguage = LANGUAGE_AMERICAN;
CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_AMERICAN;
break;
}
}
@ -1884,13 +1929,12 @@ WinMain(HINSTANCE instance,
StaticPatcher::Apply();
SystemParametersInfo(SPI_SETFOREGROUNDLOCKTIMEOUT, 0, nil, SPIF_SENDCHANGE);
/*
// TODO: make this an option somewhere
AllocConsole();
freopen("CONIN$", "r", stdin);
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
*/
/*
* Initialize the platform independent data.
@ -2033,24 +2077,35 @@ WinMain(HINSTANCE instance,
SetErrorMode(SEM_FAILCRITICALERRORS);
if (!TurnOnAnimViewer) {
#ifdef NO_MOVIES
gGameState = GS_INIT_FRONTEND;
TRACE("gGameState = GS_INIT_FRONTEND");
#ifdef PS2_MENU
int32 r = TheMemoryCard.CheckCardStateAtGameStartUp(CARD_ONE);
if ( r == CMemoryCard::ERR_DIRNOENTRY || r == CMemoryCard::ERR_NOFORMAT
&& r != CMemoryCard::ERR_OPENNOENTRY && r != CMemoryCard::ERR_NONE )
{
LoadingScreen(nil, nil, "loadsc0");
if (!CGame::InitialiseOnceAfterRW())
RsGlobal.quit = TRUE;
TheText.Unload();
TheText.Load();
CFont::Initialise();
FrontEndMenuManager.DrawMemoryCardStartUpMenus();
}
#endif
} else {
if (TurnOnAnimViewer)
{
#ifndef MASTER
CAnimViewer::Initialise();
#ifndef PS2_MENU
FrontEndMenuManager.m_bGameNotLoaded = false;
#endif
gGameState = GS_ANIMVIEWER;
TurnOnAnimViewer = false;
#endif
}
while ( TRUE )
{
RwInitialised = TRUE;
@ -2069,8 +2124,18 @@ WinMain(HINSTANCE instance,
/*
* 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 )
#endif
{
if( PeekMessage(&message, nil, 0U, 0U, PM_REMOVE|PM_NOYIELD) )
{
@ -2090,7 +2155,11 @@ WinMain(HINSTANCE instance,
{
case GS_START_UP:
{
#ifdef NO_MOVIES
gGameState = GS_INIT_ONCE;
#else
gGameState = GS_INIT_LOGO_MPEG;
#endif
TRACE("gGameState = GS_INIT_LOGO_MPEG");
break;
}
@ -2165,16 +2234,30 @@ WinMain(HINSTANCE instance,
CloseClip();
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() )
RsGlobal.quit = TRUE;
#ifdef PS2_MENU
gGameState = GS_INIT_PLAYING_GAME;
#else
gGameState = GS_INIT_FRONTEND;
TRACE("gGameState = GS_INIT_FRONTEND;");
#endif
break;
}
#ifndef PS2_MENU
case GS_INIT_FRONTEND:
{
LoadingScreen(nil, nil, "loadsc0");
@ -2202,13 +2285,21 @@ WinMain(HINSTANCE instance,
if (wp.showCmd != SW_SHOWMINIMIZED)
RsEventHandler(rsFRONTENDIDLE, nil);
#ifdef PS2_MENU
if ( !FrontEndMenuManager.m_bMenuActive || TheMemoryCard.m_bWantToLoad )
#else
if ( !FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bWantToLoad )
#endif
{
gGameState = GS_INIT_PLAYING_GAME;
TRACE("gGameState = GS_INIT_PLAYING_GAME;");
}
#ifdef PS2_MENU
if (TheMemoryCard.m_bWantToLoad )
#else
if ( FrontEndMenuManager.m_bWantToLoad )
#endif
{
InitialiseGame();
FrontEndMenuManager.m_bGameNotLoaded = false;
@ -2217,11 +2308,37 @@ WinMain(HINSTANCE instance,
}
break;
}
#endif
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();
FrontEndMenuManager.m_bGameNotLoaded = false;
#endif
gGameState = GS_PLAYING_GAME;
TRACE("gGameState = GS_PLAYING_GAME;");
break;
@ -2271,16 +2388,43 @@ WinMain(HINSTANCE instance,
RwInitialised = FALSE;
FrontEndMenuManager.UnloadTextures();
#ifdef PS2_MENU
if ( !(FrontEndMenuManager.m_bWantToRestart || TheMemoryCard.b_FoundRecentSavedGameWantToLoad))
break;
#else
if ( !FrontEndMenuManager.m_bWantToRestart )
break;
#endif
CPad::ResetCheats();
CPad::StopPadsShaking();
DMAudio.ChangeMusicMode(MUSICMODE_DISABLE);
#ifdef PS2_MENU
CGame::ShutDownForRestart();
#endif
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 )
{
CGame::ShutDownForRestart();
@ -2312,6 +2456,7 @@ WinMain(HINSTANCE instance,
FrontEndMenuManager.m_bFirstTime = false;
FrontEndMenuManager.m_bWantToRestart = false;
#endif
}

View File

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

View File

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