Merge remote-tracking branch 'origin/master' into miami

# Conflicts:
#	src/audio/AudioLogic.cpp
#	src/audio/soundlist.h
#	src/control/Script.cpp
#	src/control/ScriptCommands.h
#	src/core/Cam.cpp
#	src/core/Camera.cpp
#	src/core/Camera.h
#	src/core/Frontend.cpp
#	src/core/Frontend.h
#	src/core/Game.cpp
#	src/core/MenuScreens.cpp
#	src/core/Pad.cpp
#	src/core/Pad.h
#	src/core/config.h
#	src/entities/Entity.cpp
#	src/render/Credits.cpp
#	src/render/Fluff.cpp
#	src/render/Hud.cpp
#	src/render/MBlur.cpp
#	src/render/Timecycle.cpp
#	src/skel/glfw/glfw.cpp
#	src/skel/win/win.cpp
#	src/text/Text.cpp
This commit is contained in:
Sergeanur 2020-06-29 12:56:50 +03:00
commit b26eec5daf
44 changed files with 11271 additions and 934 deletions

2
librw

@ -1 +1 @@
Subproject commit 6ff378bb16007ad003b1a71996944a20f2e76556 Subproject commit 556f6af1b5a15d5ba1a2254a95076578cd160185

View File

@ -231,7 +231,7 @@ CCutsceneMgr::LoadCutsceneData(const char *szCutsceneName)
pPlayerPed->m_pWanted->ClearQdCrimes(); pPlayerPed->m_pWanted->ClearQdCrimes();
pPlayerPed->bIsVisible = false; pPlayerPed->bIsVisible = false;
pPlayerPed->m_fCurrentStamina = pPlayerPed->m_fMaxStamina; pPlayerPed->m_fCurrentStamina = pPlayerPed->m_fMaxStamina;
CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_80; CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_CUTSCENE);
CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(true); CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(true);
CTimer::Resume(); CTimer::Resume();
@ -369,7 +369,7 @@ CCutsceneMgr::DeleteCutsceneData(void)
ms_loaded = false; ms_loaded = false;
FindPlayerPed()->bIsVisible = true; FindPlayerPed()->bIsVisible = true;
CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_80; CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_CUTSCENE);
CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(false); CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(false);
if (CGeneral::faststricmp(ms_cutsceneName, "end")) { if (CGeneral::faststricmp(ms_cutsceneName, "end")) {

View File

@ -4775,8 +4775,8 @@ cAudioManager::ProcessFrontEnd()
m_sQueueSample.m_nSampleIndex = SFX_FE_SELECT_LEFT; m_sQueueSample.m_nSampleIndex = SFX_FE_SELECT_LEFT;
stereo = true; stereo = true;
frontendBank = true; frontendBank = true;
frontendBank = true;
frontendBank = true;
break; break;
//case SOUND_FRONTEND_EXIT: //case SOUND_FRONTEND_EXIT:
// m_sQueueSample.m_nSampleIndex = SFX_SUB_MENU_BACK_LEFT; // m_sQueueSample.m_nSampleIndex = SFX_SUB_MENU_BACK_LEFT;
@ -5906,4 +5906,4 @@ cAudioManager::ProcessMissionAudio()
field_5538 = 127; field_5538 = 127;
} }
} }
#pragma endregion All the mission audio stuff #pragma endregion All the mission audio stuff

View File

@ -234,6 +234,12 @@ cAudioManager::SetEffectsFadeVol(uint8 volume) const
SampleManager.SetEffectsFadeVolume(volume); SampleManager.SetEffectsFadeVolume(volume);
} }
void
cAudioManager::SetMonoMode(uint8 mono)
{
SampleManager.SetMonoMode(mono);
}
void void
cAudioManager::SetMusicFadeVol(uint8 volume) const cAudioManager::SetMusicFadeVol(uint8 volume) const
{ {
@ -385,9 +391,9 @@ cAudioManager::ReacquireDigitalHandle() const
} }
void void
cAudioManager::SetDynamicAcousticModelingStatus(bool status) cAudioManager::SetDynamicAcousticModelingStatus(uint8 status)
{ {
m_bDynamicAcousticModelingStatus = status; m_bDynamicAcousticModelingStatus = status!=0;
} }
bool bool
@ -967,4 +973,4 @@ cAudioManager::ComputeEmittingVolume(uint8 emittingVolume, float intensity, floa
return (quatIntensity - (dist - diffIntensity)) * (float)emittingVolume / quatIntensity; return (quatIntensity - (dist - diffIntensity)) * (float)emittingVolume / quatIntensity;
return emittingVolume; return emittingVolume;
} }
#endif #endif

View File

@ -383,14 +383,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 SetEffectsFadeVol(uint8 volume) const; void SetEffectsFadeVol(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(uint8 slot, float x, float y, float z); void SetMissionAudioLocation(uint8 slot, 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 SetMusicFadeVol(uint8 volume) const; void SetMusicFadeVol(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

@ -162,7 +162,7 @@ CGameLogic::Update()
AfterDeathArrestSetUpShortCutTaxi(); AfterDeathArrestSetUpShortCutTaxi();
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();
CPopulation::m_CountDownToPedsAtStart = 10; CPopulation::m_CountDownToPedsAtStart = 10;
@ -269,7 +269,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();
CPopulation::m_CountDownToPedsAtStart = 10; CPopulation::m_CountDownToPedsAtStart = 10;
@ -318,7 +318,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();
CPopulation::m_CountDownToPedsAtStart = 10; CPopulation::m_CountDownToPedsAtStart = 10;

View File

@ -54,7 +54,7 @@ CPhoneInfo::Update(void)
endAssoc->flags &= ~ASSOC_DELETEFADEDOUT; endAssoc->flags &= ~ASSOC_DELETEFADEDOUT;
endAssoc->SetFinishCallback(PhonePutDownCB, player); endAssoc->SetFinishCallback(PhonePutDownCB, player);
} else { } else {
CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_40; CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_PHONE);
if (player->m_nPedState == PED_MAKE_CALL) if (player->m_nPedState == PED_MAKE_CALL)
player->m_nPedState = PED_IDLE; player->m_nPedState = PED_IDLE;
} }
@ -104,7 +104,7 @@ CPhoneInfo::Update(void)
player->m_fRotationDest = angleToFace; player->m_fRotationDest = angleToFace;
player->SetHeading(angleToFace); player->SetHeading(angleToFace);
player->m_nPedState = PED_MAKE_CALL; player->m_nPedState = PED_MAKE_CALL;
CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_40; CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_PHONE);
TheCamera.SetWideScreenOn(); TheCamera.SetWideScreenOn();
playerInfo->MakePlayerSafe(true); playerInfo->MakePlayerSafe(true);
CAnimBlendAssociation *phonePickAssoc = CAnimManager::BlendAnimation(player->GetClump(), ASSOCGRP_STD, ANIM_PHONE_IN, 4.0f); CAnimBlendAssociation *phonePickAssoc = CAnimManager::BlendAnimation(player->GetClump(), ASSOCGRP_STD, ANIM_PHONE_IN, 4.0f);
@ -324,7 +324,7 @@ PhonePutDownCB(CAnimBlendAssociation *assoc, void *arg)
{ {
assoc->flags |= ASSOC_DELETEFADEDOUT; assoc->flags |= ASSOC_DELETEFADEDOUT;
assoc->blendDelta = -1000.0f; assoc->blendDelta = -1000.0f;
CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_40; CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_PHONE);
CPed *ped = (CPed*)arg; CPed *ped = (CPed*)arg;
if (assoc->blendAmount > 0.5f) if (assoc->blendAmount > 0.5f)

File diff suppressed because it is too large Load Diff

View File

@ -354,6 +354,7 @@ private:
static bool IsPlayerStopped(CPlayerInfo*); static bool IsPlayerStopped(CPlayerInfo*);
static bool IsVehicleStopped(CVehicle*); static bool IsVehicleStopped(CVehicle*);
static void PrintListSizes();
static void ReadObjectNamesFromScript(); static void ReadObjectNamesFromScript();
static void UpdateObjectIndices(); static void UpdateObjectIndices();
static void ReadMultiScriptFileOffsetsFromScript(); static void ReadMultiScriptFileOffsetsFromScript();
@ -391,7 +392,7 @@ public:
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
}; };
@ -503,6 +504,11 @@ private:
bool CanAllowMissionReplay(); bool CanAllowMissionReplay();
#endif #endif
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
int CollectParameterForDebug(char* buf, bool& var);
void GetStoredParameterForDebug(char* buf);
#endif
float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; } float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; }
bool ThisIsAValidRandomPed(uint32 pedtype, int civ, int gang, int criminal) { bool ThisIsAValidRandomPed(uint32 pedtype, int civ, int gang, int criminal) {

View File

@ -1437,4 +1437,35 @@ enum {
COMMAND_REGISTER_FIRE_LEVEL, COMMAND_REGISTER_FIRE_LEVEL,
COMMAND_IS_AUSTRALIAN_GAME, COMMAND_IS_AUSTRALIAN_GAME,
COMMAND_DISARM_CAR_BOMB, COMMAND_DISARM_CAR_BOMB,
}; #ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
LAST_SCRIPT_COMMAND
#endif
};
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
enum eScriptArgument
{
ARGTYPE_NONE = 0,
ARGTYPE_INT,
ARGTYPE_FLOAT,
ARGTYPE_STRING,
ARGTYPE_LABEL,
ARGTYPE_BOOL,
ARGTYPE_PED_HANDLE,
ARGTYPE_VEHICLE_HANDLE,
ARGTYPE_OBJECT_HANDLE,
ARGTYPE_ANDOR
};
struct tScriptCommandData
{
int id;
const char name[64];
eScriptArgument input[18];
eScriptArgument output[18];
bool cond;
int position;
const char name_override[8];
};
#endif

View File

@ -1366,7 +1366,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
TargetCoors.z += fTranslateCamUp; TargetCoors.z += fTranslateCamUp;
float AlphaOffset, BetaOffset; float AlphaOffset, BetaOffset;
if(CPad::GetPad(0)->IsPlayerControlsDisabledBy(PLAYERCONTROL_DISABLED_20)){ if(CPad::GetPad(0)->IsPlayerControlsDisabledBy(PLAYERCONTROL_PLAYERINFO)){
CVector ToCam = Source - TargetCoors; CVector ToCam = Source - TargetCoors;
ToCam.Normalise(); ToCam.Normalise();
if(ToCam.z < -0.9f) if(ToCam.z < -0.9f)
@ -1400,7 +1400,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
if(TheCamera.GetFading() && TheCamera.GetFadingDirection() == FADE_IN && nFadeControlThreshhold < CDraw::FadeValue || if(TheCamera.GetFading() && TheCamera.GetFadingDirection() == FADE_IN && nFadeControlThreshhold < CDraw::FadeValue ||
CDraw::FadeValue > 200 || CDraw::FadeValue > 200 ||
CPad::GetPad(0)->IsPlayerControlsDisabledBy(PLAYERCONTROL_DISABLED_20)){ CPad::GetPad(0)->IsPlayerControlsDisabledBy(PLAYERCONTROL_PLAYERINFO)){
if(Alpha < fDefaultAlphaOrient-0.05f) if(Alpha < fDefaultAlphaOrient-0.05f)
AlphaOffset = 0.05f; AlphaOffset = 0.05f;
else if(Alpha < fDefaultAlphaOrient) else if(Alpha < fDefaultAlphaOrient)
@ -1525,7 +1525,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
if(((CPed*)CamTargetEntity)->CanStrafeOrMouseControl() && CDraw::FadeValue < 250 && if(((CPed*)CamTargetEntity)->CanStrafeOrMouseControl() && CDraw::FadeValue < 250 &&
(TheCamera.GetFadingDirection() != FADE_OUT || CDraw::FadeValue <= 100) && (TheCamera.GetFadingDirection() != FADE_OUT || CDraw::FadeValue <= 100) &&
!CPad::GetPad(0)->IsPlayerControlsDisabledBy(PLAYERCONTROL_DISABLED_20)){ !CPad::GetPad(0)->IsPlayerControlsDisabledBy(PLAYERCONTROL_PLAYERINFO)){
float Heading = Front.Heading(); float Heading = Front.Heading();
((CPed*)TheCamera.pTargetEntity)->m_fRotationCur = Heading; ((CPed*)TheCamera.pTargetEntity)->m_fRotationCur = Heading;
((CPed*)TheCamera.pTargetEntity)->m_fRotationDest = Heading; ((CPed*)TheCamera.pTargetEntity)->m_fRotationDest = Heading;
@ -1534,6 +1534,8 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
} }
} }
float fBillsBetaOffset; // made up name, actually in CCam
void void
CCam::Process_BehindCar(const CVector &CameraTarget, float TargetOrientation, float, float) CCam::Process_BehindCar(const CVector &CameraTarget, float TargetOrientation, float, float)
{ {
@ -1553,6 +1555,15 @@ CCam::Process_BehindCar(const CVector &CameraTarget, float TargetOrientation, fl
if(Length < 0.002f) if(Length < 0.002f)
Length = 0.002f; Length = 0.002f;
Beta = CGeneral::GetATanOfXY(TargetCoors.x - Source.x, TargetCoors.y - Source.y); Beta = CGeneral::GetATanOfXY(TargetCoors.x - Source.x, TargetCoors.y - Source.y);
#ifdef TOGGLEABLE_BETA_FEATURES
// This is completely made up but Bill's cam manipulates an angle before calling this
// and otherwise calculating Beta doesn't make much sense.
Beta += fBillsBetaOffset;
fBillsBetaOffset = 0.0f;
Dist.x = -Length*Cos(Beta);
Dist.y = -Length*Sin(Beta);
Source = TargetCoors + Dist;
#endif
if(Length > CA_MAX_DISTANCE){ if(Length > CA_MAX_DISTANCE){
Source.x = TargetCoors.x + Dist.x/Length * CA_MAX_DISTANCE; Source.x = TargetCoors.x + Dist.x/Length * CA_MAX_DISTANCE;
Source.y = TargetCoors.y + Dist.y/Length * CA_MAX_DISTANCE; Source.y = TargetCoors.y + Dist.y/Length * CA_MAX_DISTANCE;
@ -2815,7 +2826,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;
@ -2939,7 +2950,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;
@ -3715,11 +3726,11 @@ CCam::Process_Fixed(const CVector &CameraTarget, float, float, float)
float f = BOAT_UNDERWATER_CAM_COLORMAG_LIMIT/WaterLum; float f = BOAT_UNDERWATER_CAM_COLORMAG_LIMIT/WaterLum;
TheCamera.SetMotionBlur(CTimeCycle::GetWaterRed()*f, TheCamera.SetMotionBlur(CTimeCycle::GetWaterRed()*f,
CTimeCycle::GetWaterGreen()*f, CTimeCycle::GetWaterGreen()*f,
CTimeCycle::GetWaterBlue()*f, BOAT_UNDERWATER_CAM_BLUR, MBLUR_NORMAL); CTimeCycle::GetWaterBlue()*f, BOAT_UNDERWATER_CAM_BLUR, MOTION_BLUR_LIGHT_SCENE);
}else{ }else{
TheCamera.SetMotionBlur(CTimeCycle::GetWaterRed(), TheCamera.SetMotionBlur(CTimeCycle::GetWaterRed(),
CTimeCycle::GetWaterGreen(), CTimeCycle::GetWaterGreen(),
CTimeCycle::GetWaterBlue(), BOAT_UNDERWATER_CAM_BLUR, MBLUR_NORMAL); CTimeCycle::GetWaterBlue(), BOAT_UNDERWATER_CAM_BLUR, MOTION_BLUR_LIGHT_SCENE);
} }
} }
@ -3938,7 +3949,11 @@ CCam::Process_Debug(const CVector&, float, float, float)
Source.y += 1.0f; Source.y += 1.0f;
GetVectorsReadyForRW(); GetVectorsReadyForRW();
CPad::GetPad(0)->DisablePlayerControls = PLAYERCONTROL_DISABLED_1; #ifdef FIX_BUGS
CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_CAMERA);
#else
CPad::GetPad(0)->DisablePlayerControls = PLAYERCONTROL_CAMERA;
#endif
if(CPad::GetPad(1)->GetLeftShockJustDown() && gbBigWhiteDebugLightSwitchedOn) if(CPad::GetPad(1)->GetLeftShockJustDown() && gbBigWhiteDebugLightSwitchedOn)
CShadows::StoreShadowToBeRendered(SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &Source, CShadows::StoreShadowToBeRendered(SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &Source,

View File

@ -549,15 +549,15 @@ 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));
static bool bExtra1stPrsBlur = false; static bool bExtra1stPrsBlur = false;
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);
bExtra1stPrsBlur = true; bExtra1stPrsBlur = true;
}else if(bExtra1stPrsBlur){ }else if(bExtra1stPrsBlur){
SetMotionBlur(CTimeCycle::GetBlurRed(), CTimeCycle::GetBlurGreen(), CTimeCycle::GetBlurBlue(), m_motionBlur, MBLUR_NORMAL); SetMotionBlur(CTimeCycle::GetBlurRed(), CTimeCycle::GetBlurGreen(), CTimeCycle::GetBlurBlue(), m_motionBlur, MOTION_BLUR_LIGHT_SCENE);
bExtra1stPrsBlur = false; bExtra1stPrsBlur = false;
} }
@ -694,7 +694,7 @@ CCamera::CamControl(void)
m_bFailedCullZoneTestPreviously = CCullZones::CamCloseInForPlayer(); m_bFailedCullZoneTestPreviously = CCullZones::CamCloseInForPlayer();
if(m_bLookingAtPlayer){ if(m_bLookingAtPlayer){
CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_1; CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_CAMERA;
FindPlayerPed()->bIsVisible = true; FindPlayerPed()->bIsVisible = true;
} }
@ -1029,7 +1029,7 @@ CCamera::CamControl(void)
m_bFirstPersonBeingUsed = false; m_bFirstPersonBeingUsed = false;
if(m_bFirstPersonBeingUsed){ if(m_bFirstPersonBeingUsed){
ReqMode = CCam::MODE_1STPERSON; ReqMode = CCam::MODE_1STPERSON;
CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_1; CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_CAMERA;
} }
// Zoom value // Zoom value
@ -1679,7 +1679,7 @@ CCamera::CamControl(void)
}else if(Cams[ActiveCam].Mode != m_iModeToGoTo){ }else if(Cams[ActiveCam].Mode != m_iModeToGoTo){
m_bStartInterScript = true; m_bStartInterScript = true;
m_iTypeOfSwitch = JUMP_CUT; m_iTypeOfSwitch = JUMP_CUT;
CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_1; CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_CAMERA;
} }
} }
@ -2548,7 +2548,7 @@ CCamera::DrawBordersForWideScreen(void)
bottom = SCREEN_HEIGHT; bottom = SCREEN_HEIGHT;
} }
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);
// top border // top border
@ -3913,7 +3913,7 @@ CCamera::SetCameraDirectlyInFrontForFollowPed_CamOnAString(void)
void void
CCamera::SetNewPlayerWeaponMode(int16 mode, int16 minZoom, int16 maxZoom) CCamera::SetNewPlayerWeaponMode(int16 mode, int16 minZoom, int16 maxZoom)
{ {
SetMotionBlur(CTimeCycle::GetBlurRed(), CTimeCycle::GetBlurGreen(), CTimeCycle::GetBlurBlue(), m_motionBlur, MBLUR_NORMAL); SetMotionBlur(CTimeCycle::GetBlurRed(), CTimeCycle::GetBlurGreen(), CTimeCycle::GetBlurBlue(), m_motionBlur, MOTION_BLUR_LIGHT_SCENE);
PlayerWeaponMode.Mode = mode; PlayerWeaponMode.Mode = mode;
PlayerWeaponMode.MaxZoom = maxZoom; PlayerWeaponMode.MaxZoom = maxZoom;
PlayerWeaponMode.MinZoom = minZoom; PlayerWeaponMode.MinZoom = minZoom;
@ -3923,7 +3923,7 @@ CCamera::SetNewPlayerWeaponMode(int16 mode, int16 minZoom, int16 maxZoom)
void void
CCamera::ClearPlayerWeaponMode(void) CCamera::ClearPlayerWeaponMode(void)
{ {
SetMotionBlur(CTimeCycle::GetBlurRed(), CTimeCycle::GetBlurGreen(), CTimeCycle::GetBlurBlue(), m_motionBlur, MBLUR_NORMAL); SetMotionBlur(CTimeCycle::GetBlurRed(), CTimeCycle::GetBlurGreen(), CTimeCycle::GetBlurBlue(), m_motionBlur, MOTION_BLUR_LIGHT_SCENE);
PlayerWeaponMode.Mode = 0; PlayerWeaponMode.Mode = 0;
PlayerWeaponMode.MaxZoom = 1; PlayerWeaponMode.MaxZoom = 1;
PlayerWeaponMode.MinZoom = -1; PlayerWeaponMode.MinZoom = -1;

View File

@ -186,7 +186,6 @@ public:
CPed *m_pLastPedLookedAt;// So interpolation works CPed *m_pLastPedLookedAt;// So interpolation works
bool m_bFirstPersonRunAboutActive; bool m_bFirstPersonRunAboutActive;
CCam(void) { Init(); } CCam(void) { Init(); }
void Init(void); void Init(void);
void Process(void); void Process(void);
@ -295,16 +294,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
@ -414,9 +413,12 @@ public:
float CarZoomValueSmooth; float CarZoomValueSmooth;
float DistanceToWater; float DistanceToWater;
#ifndef PS2_CAM_TRANSITION
float FOVDuringInter; float FOVDuringInter;
#endif
float LODDistMultiplier; float LODDistMultiplier;
float GenerationDistMultiplier; float GenerationDistMultiplier;
#ifndef PS2_CAM_TRANSITION
float m_fAlphaSpeedAtStartInter; float m_fAlphaSpeedAtStartInter;
float m_fAlphaWhenInterPol; float m_fAlphaWhenInterPol;
float m_fAlphaDuringInterPol; float m_fAlphaDuringInterPol;
@ -427,6 +429,7 @@ public:
float m_fFOVSpeedAtStartInter; float m_fFOVSpeedAtStartInter;
float m_fStartingBetaForInterPol; float m_fStartingBetaForInterPol;
float m_fStartingAlphaForInterPol; float m_fStartingAlphaForInterPol;
#endif
float m_PedOrientForBehindOrInFront; float m_PedOrientForBehindOrInFront;
float m_CameraAverageSpeed; float m_CameraAverageSpeed;
float m_CameraSpeedSoFar; float m_CameraSpeedSoFar;
@ -489,9 +492,11 @@ public:
CVector m_vecUpWhenInterPol; CVector m_vecUpWhenInterPol;
CVector m_vecClearGeometryVec; CVector m_vecClearGeometryVec;
CVector m_vecGameCamPos; CVector m_vecGameCamPos;
#ifndef PS2_CAM_TRANSITION
CVector SourceDuringInter; CVector SourceDuringInter;
CVector TargetDuringInter; CVector TargetDuringInter;
CVector UpDuringInter; CVector UpDuringInter;
#endif
RwCamera *m_pRwCamera; RwCamera *m_pRwCamera;
CEntity *pTargetEntity; CEntity *pTargetEntity;
CCamPathSplines m_arrPathArray[MAX_NUM_OF_SPLINETYPES]; CCamPathSplines m_arrPathArray[MAX_NUM_OF_SPLINETYPES];
@ -509,7 +514,6 @@ public:
CVector m_vecOldSourceForInter; CVector m_vecOldSourceForInter;
CVector m_vecOldFrontForInter; CVector m_vecOldFrontForInter;
CVector m_vecOldUpForInter; CVector m_vecOldUpForInter;
float m_vecOldFOVForInter; float m_vecOldFOVForInter;
float m_fFLOATingFade; float m_fFLOATingFade;
float m_fFLOATingFadeMusic; float m_fFLOATingFadeMusic;

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] != nil )
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(nil)
{}
void SetTrigger(void *func, void *trigger)
{
if ( !bHasTrigger )
{
pFunc = (void (*)(void *))func;
pTrigger = trigger;
bHasTrigger = true;
}
}
void CallTrigger(void)
{
if ( bHasTrigger && pFunc != nil )
pFunc(pTrigger);
bHasTrigger = false;
pFunc = nil;
}
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(nil) {}
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"
@ -5580,3 +5581,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"
@ -94,20 +97,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 enum
{ {
MENUALIGN_LEFT = 1, MENUALIGN_LEFT = 1,
@ -591,6 +580,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
};
bool GetIsMenuActive() {return !!m_bMenuActive;} bool GetIsMenuActive() {return !!m_bMenuActive;}
static uint8 m_PrefsStereoMono; static uint8 m_PrefsStereoMono;
@ -666,3 +668,6 @@ VALIDATE_SIZE(CMenuManager, 0x688);
#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

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

@ -0,0 +1,244 @@
#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 = 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"
@ -104,6 +105,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)
{ {
@ -278,6 +316,7 @@ bool CGame::Initialise(const char* datFile)
COcclusion::Init(); COcclusion::Init();
CCollision::Init(); CCollision::Init();
CSetPieces::Init(); CSetPieces::Init();
TheText.Load();
CTheZones::Init(); CTheZones::Init();
CUserDisplay::Init(); CUserDisplay::Init();
CMessages::Init(); CMessages::Init();
@ -286,6 +325,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();
@ -366,10 +410,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);
CCollision::ms_collisionInMemory = currLevel; CCollision::ms_collisionInMemory = currLevel;
for (int i = 0; i < MAX_PADS; i++) for (int i = 0; i < MAX_PADS; i++)
@ -433,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();
@ -443,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);
@ -458,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();
@ -473,11 +539,19 @@ 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();
#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();
@ -589,8 +663,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

File diff suppressed because it is too large Load Diff

View File

@ -2,14 +2,14 @@
enum { enum {
PLAYERCONTROL_ENABLED = 0, PLAYERCONTROL_ENABLED = 0,
PLAYERCONTROL_DISABLED_1 = 1, // used by first person camera PLAYERCONTROL_CAMERA = 1,
PLAYERCONTROL_DISABLED_2 = 2, PLAYERCONTROL_UNK2 = 2,
PLAYERCONTROL_GARAGE = 4, PLAYERCONTROL_GARAGE = 4,
PLAYERCONTROL_DISABLED_8 = 8, PLAYERCONTROL_UNK8 = 8,
PLAYERCONTROL_DISABLED_10 = 16, PLAYERCONTROL_UNK10 = 16,
PLAYERCONTROL_DISABLED_20 = 32, // used on CPlayerInfo::MakePlayerSafe PLAYERCONTROL_PLAYERINFO = 32,
PLAYERCONTROL_DISABLED_40 = 64, // used on phone calls PLAYERCONTROL_PHONE = 64,
PLAYERCONTROL_DISABLED_80 = 128,// used on cutscenes PLAYERCONTROL_CUTSCENE = 128,
PLAYERCONTROL_SHORTCUT_TAXI = 256, PLAYERCONTROL_SHORTCUT_TAXI = 256,
}; };
@ -198,13 +198,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);
@ -455,6 +455,11 @@ public:
void SetDisablePlayerControls(uint16 who) { DisablePlayerControls |= who; } void SetDisablePlayerControls(uint16 who) { DisablePlayerControls |= who; }
void SetEnablePlayerControls(uint16 who) { DisablePlayerControls &= ~who; } void SetEnablePlayerControls(uint16 who) { DisablePlayerControls &= ~who; }
bool IsPlayerControlsDisabledBy(uint16 who) { return DisablePlayerControls & who; } bool IsPlayerControlsDisabledBy(uint16 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

@ -180,7 +180,7 @@ CPlayerInfo::MakePlayerSafe(bool toggle)
if (toggle) { if (toggle) {
m_pPed->m_pWanted->m_bIgnoredByEveryone = true; m_pPed->m_pWanted->m_bIgnoredByEveryone = true;
CWorld::StopAllLawEnforcersInTheirTracks(); CWorld::StopAllLawEnforcersInTheirTracks();
CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_20; CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_PLAYERINFO);
CPad::StopPadsShaking(); CPad::StopPadsShaking();
m_pPed->bBulletProof = true; m_pPed->bBulletProof = true;
m_pPed->bFireProof = true; m_pPed->bFireProof = true;
@ -201,7 +201,7 @@ CPlayerInfo::MakePlayerSafe(bool toggle)
} }
else { else {
m_pPed->m_pWanted->m_bIgnoredByEveryone = false; m_pPed->m_pWanted->m_bIgnoredByEveryone = false;
CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_20; CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_PLAYERINFO);
m_pPed->bBulletProof = false; m_pPed->bBulletProof = false;
m_pPed->bFireProof = false; m_pPed->bFireProof = false;
m_pPed->bCollisionProof = false; m_pPed->bCollisionProof = false;

View File

@ -62,6 +62,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 50.0f / 30.0f; } static float GetDefaultTimeStep(void) { return 50.0f / 30.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

@ -232,14 +232,20 @@ enum Config {
#define REGISTER_START_BUTTON #define REGISTER_START_BUTTON
// Hud, frontend and radar // Hud, frontend and radar
#define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC
// #define PS2_LIKE_MENU // An effort to recreate PS2 menu, cycling through tabs, different bg etc.
#define MENU_MAP // VC-like menu map. Make sure you have new menu.txd
#define SCROLLABLE_STATS_PAGE // only draggable by mouse atm
#define TRIANGLE_BACK_BUTTON
// #define CIRCLE_BACK_BUTTON
#define HUD_ENHANCEMENTS // Adjusts some aspects to make the HUD look/behave a little bit better. #define HUD_ENHANCEMENTS // Adjusts some aspects to make the HUD look/behave a little bit better.
#define BETA_SLIDING_TEXT #define BETA_SLIDING_TEXT
#define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC
#define PC_MENU
#ifndef PC_MENU
# define PS2_MENU
//# define PS2_MENU_USEALLPAGEICONS
#else
//# define PS2_LIKE_MENU // An effort to recreate PS2 menu, cycling through tabs, different bg etc.
# define MENU_MAP // VC-like menu map. Make sure you have new menu.txd
# define SCROLLABLE_STATS_PAGE // only draggable by mouse atm
# define TRIANGLE_BACK_BUTTON
//# define CIRCLE_BACK_BUTTON
//#define CUSTOM_FRONTEND_OPTIONS //#define CUSTOM_FRONTEND_OPTIONS
#define LEGACY_MENU_OPTIONS #define LEGACY_MENU_OPTIONS
#define MUCH_SHORTER_OUTRO_SCREEN #define MUCH_SHORTER_OUTRO_SCREEN
@ -249,7 +255,14 @@ enum Config {
#define USE_MEASUREMENTS_IN_METERS // makes game use meters instead of feet in script #define USE_MEASUREMENTS_IN_METERS // makes game use meters instead of feet in script
#define USE_PRECISE_MEASUREMENT_CONVERTION // makes game convert feet to meeters more precisely #define USE_PRECISE_MEASUREMENT_CONVERTION // makes game convert feet to meeters more precisely
//#define MISSION_REPLAY // mobile feature //#define MISSION_REPLAY // mobile feature
#endif
//#define SIMPLIER_MISSIONS // apply simplifications from mobile //#define SIMPLIER_MISSIONS // apply simplifications from mobile
//#define USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
#define SCRIPT_LOG_FILE_LEVEL 1 // 0 == no log, 1 == overwrite every frame, 2 == full log
#ifndef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
#define USE_BASIC_SCRIPT_DEBUG_OUTPUT
#endif
// Replay // Replay
//#define DONT_FIX_REPLAY_BUGS // keeps various bugs in CReplay, some of which are fairly cool! //#define DONT_FIX_REPLAY_BUGS // keeps various bugs in CReplay, some of which are fairly cool!
@ -271,5 +284,6 @@ enum Config {
#define CANCELLABLE_CAR_ENTER #define CANCELLABLE_CAR_ENTER
// Camera // Camera
//#define PS2_CAM_TRANSITION // old way of transitioning between cam modes
#define IMPROVED_CAMERA // Better Debug cam, and maybe more in the future #define IMPROVED_CAMERA // Better Debug cam, and maybe more in the future
#define FREE_CAM // Rotating cam #define FREE_CAM // Rotating cam

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"
@ -185,14 +186,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();
@ -925,17 +939,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
@ -979,14 +992,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)
@ -1048,7 +1072,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();
@ -1081,6 +1105,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");
@ -1255,6 +1284,7 @@ TheModelViewer(void)
} }
#endif #endif
#ifdef PS2
void TheGame(void) void TheGame(void)
{ {
printf("Into TheGame!!!\n"); printf("Into TheGame!!!\n");
@ -1276,12 +1306,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 (FrontEndMenuManager.m_PrefsLanguage != TheMemoryCard.GetLanguageToLoad()) if (FrontEndMenuManager.m_PrefsLanguage != TheMemoryCard.GetLanguageToLoad())
@ -1385,7 +1415,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();
@ -1767,8 +1797,6 @@ void GameInit()
} }
} }
// Not used anyway. PS2 main() port
#ifdef _WIN32
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
@ -1779,9 +1807,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

@ -85,7 +85,7 @@ void ReloadFrontendOptions(void)
void LangPolSelect(int8 action) void LangPolSelect(int8 action)
{ {
if (action == FEOPTION_ACTION_SELECT) { if (action == FEOPTION_ACTION_SELECT) {
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_POLISH; FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_POLISH;
FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true; FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
FrontEndMenuManager.InitialiseChangedLanguageSettings(); FrontEndMenuManager.InitialiseChangedLanguageSettings();
FrontEndMenuManager.SaveSettings(); FrontEndMenuManager.SaveSettings();
@ -95,7 +95,7 @@ void LangPolSelect(int8 action)
void LangRusSelect(int8 action) void LangRusSelect(int8 action)
{ {
if (action == FEOPTION_ACTION_SELECT) { if (action == FEOPTION_ACTION_SELECT) {
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_RUSSIAN; FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_RUSSIAN;
FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true; FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
FrontEndMenuManager.InitialiseChangedLanguageSettings(); FrontEndMenuManager.InitialiseChangedLanguageSettings();
FrontEndMenuManager.SaveSettings(); FrontEndMenuManager.SaveSettings();
@ -105,7 +105,7 @@ void LangRusSelect(int8 action)
void LangJapSelect(int8 action) void LangJapSelect(int8 action)
{ {
if (action == FEOPTION_ACTION_SELECT) { if (action == FEOPTION_ACTION_SELECT) {
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_JAPANESE; FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_JAPANESE;
FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true; FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
FrontEndMenuManager.InitialiseChangedLanguageSettings(); FrontEndMenuManager.InitialiseChangedLanguageSettings();
FrontEndMenuManager.SaveSettings(); FrontEndMenuManager.SaveSettings();

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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN) if(FrontEndMenuManager.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

@ -404,7 +404,7 @@ void CScrollBar::Update()
m_pMessage = FindTimeMessage(); m_pMessage = FindTimeMessage();
break; break;
case 6: case 6:
if (FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_FRENCH || FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_GERMAN) if (FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_FRENCH || FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_GERMAN)
m_pMessage = FindTimeMessage(); m_pMessage = FindTimeMessage();
else else
m_pMessage = "WWW.GRANDTHEFTAUTO3.COM "; m_pMessage = "WWW.GRANDTHEFTAUTO3.COM ";
@ -624,7 +624,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 (FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_FRENCH || FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_GERMAN) if (FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_FRENCH || FrontEndMenuManager.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

@ -591,7 +591,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.7f * 0.8f), SCREEN_SCALE_Y(1.8f)); CFont::SetScale(SCREEN_SCALE_X(1.7f * 0.8f), SCREEN_SCALE_Y(1.8f));
else else
CFont::SetScale(SCREEN_SCALE_X(1.7f), SCREEN_SCALE_Y(1.8f)); CFont::SetScale(SCREEN_SCALE_X(1.7f), SCREEN_SCALE_Y(1.8f));
@ -690,7 +690,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.7f), SCREEN_SCALE_Y(1.8f)); CFont::SetScale(SCREEN_SCALE_X(1.7f), SCREEN_SCALE_Y(1.8f));
else else
CFont::SetScale(SCREEN_SCALE_X(1.7f * 0.85f), SCREEN_SCALE_Y(1.8f)); CFont::SetScale(SCREEN_SCALE_X(1.7f * 0.85f), SCREEN_SCALE_Y(1.8f));
@ -1406,7 +1406,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"
@ -9,6 +10,7 @@
RwRaster *CMBlur::pFrontBuffer; RwRaster *CMBlur::pFrontBuffer;
bool CMBlur::ms_bJustInitialised; bool CMBlur::ms_bJustInitialised;
bool CMBlur::ms_bScaledBlur;
bool CMBlur::BlurOn; bool CMBlur::BlurOn;
float CMBlur::Drunkness; float CMBlur::Drunkness;
@ -16,43 +18,123 @@ static RwIm2DVertex Vertex[4];
static RwIm2DVertex Vertex2[4]; static RwIm2DVertex Vertex2[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){ #ifndef LIBRW
for(rect.w = 1; rect.w < RwRasterGetWidth(RwCameraGetRaster(cam)); rect.w *= 2); extern void _GetVideoMemInfo(LPDWORD total, LPDWORD avaible);
for(rect.h = 1; rect.h < RwRasterGetHeight(RwCameraGetRaster(cam)); rect.h *= 2); DWORD total, avaible;
pFrontBuffer = RwRasterCreate(rect.w, rect.h, RwRasterGetDepth(RwCameraGetRaster(cam)), rwRASTERTYPECAMERATEXTURE);
if(pFrontBuffer) _GetVideoMemInfo(&total, &avaible);
ms_bJustInitialised = true; debug("Available video memory %d\n", avaible);
else{ #endif
debug("MBlurOpen can't create raster.");
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; 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));
} }
#ifndef LIBRW
_GetVideoMemInfo(&total, &avaible);
debug("Available video memory %d\n", avaible);
#endif
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
@ -149,6 +231,10 @@ void
CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 alpha) CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 alpha)
{ {
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(ms_bJustInitialised) if(ms_bJustInitialised)
ms_bJustInitialised = false; ms_bJustInitialised = false;
else else
@ -158,6 +244,7 @@ CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, u
RwRasterRenderFast(RwCameraGetRaster(cam), 0, 0); RwRasterRenderFast(RwCameraGetRaster(cam), 0, 0);
RwRasterPopContext(); RwRasterPopContext();
} }
#endif
} }
void void
@ -172,32 +259,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;
@ -210,7 +298,7 @@ CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type,
int ovR = r * 0.6f; int ovR = r * 0.6f;
int ovG = g * 0.6f; int ovG = g * 0.6f;
int ovB = b * 0.6f; int ovB = b * 0.6f;
int ovA = type == MBLUR_SNIPER ? a : a*0.6f; int ovA = type == MOTION_BLUR_SNIPER ? a : a*0.6f;
RwIm2DVertexSetIntRGBA(&Vertex[0], ovR, ovG, ovB, ovA); RwIm2DVertexSetIntRGBA(&Vertex[0], ovR, ovG, ovB, ovA);
RwIm2DVertexSetIntRGBA(&Vertex[1], ovR, ovG, ovB, ovA); RwIm2DVertexSetIntRGBA(&Vertex[1], ovR, ovG, ovB, ovA);
RwIm2DVertexSetIntRGBA(&Vertex[2], ovR, ovG, ovB, ovA); RwIm2DVertexSetIntRGBA(&Vertex[2], ovR, ovG, ovB, ovA);
@ -237,7 +325,7 @@ CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type,
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
if(BlurOn){ if(BlurOn){
if(type == MBLUR_SNIPER){ if(type == MOTION_BLUR_SNIPER){
RwIm2DVertexSetIntRGBA(&Vertex2[0], r, g, b, 80); RwIm2DVertexSetIntRGBA(&Vertex2[0], r, g, b, 80);
RwIm2DVertexSetIntRGBA(&Vertex2[1], r, g, b, 80); RwIm2DVertexSetIntRGBA(&Vertex2[1], r, g, b, 80);
RwIm2DVertexSetIntRGBA(&Vertex2[2], r, g, b, 80); RwIm2DVertexSetIntRGBA(&Vertex2[2], r, g, b, 80);

View File

@ -15,12 +15,13 @@ 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;
static float Drunkness; static float Drunkness;
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 alpha); static void MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 alpha);
static void OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type, int32 alpha); static void OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type, int32 alpha);

View File

@ -362,8 +362,8 @@ CTimeCycle::Update(void)
// TODO(MIAMI): extra colours // TODO(MIAMI): extra colours
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, 5, MBLUR_NORMAL); TheCamera.SetMotionBlur(m_fCurrentBlurRed, m_fCurrentBlurGreen, m_fCurrentBlurBlue, 5, MOTION_BLUR_LIGHT_SCENE);
m_nCurrentFogColourRed = (m_nCurrentSkyTopRed + 2*m_nCurrentSkyBottomRed) / 3; m_nCurrentFogColourRed = (m_nCurrentSkyTopRed + 2*m_nCurrentSkyBottomRed) / 3;
m_nCurrentFogColourGreen = (m_nCurrentSkyTopGreen + 2*m_nCurrentSkyBottomGreen) / 3; m_nCurrentFogColourGreen = (m_nCurrentSkyTopGreen + 2*m_nCurrentSkyBottomGreen) / 3;

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

@ -27,8 +27,10 @@
#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"
#define MAX_SUBSYSTEMS (16) #define MAX_SUBSYSTEMS (16)
@ -287,11 +289,69 @@ psInitialize(void)
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;
#ifndef _WIN32
// Mandatory for Linux(Unix? Posix?) to set lang. to environment lang.
setlocale(LC_ALL, "");
char *systemLang, *keyboardLang;
systemLang = setlocale (LC_ALL, NULL);
keyboardLang = setlocale (LC_CTYPE, NULL);
short lang;
lang = !strncmp(systemLang, "fr_",3) ? LANG_FRENCH :
!strncmp(systemLang, "de_",3) ? LANG_GERMAN :
!strncmp(systemLang, "en_",3) ? LANG_ENGLISH :
!strncmp(systemLang, "it_",3) ? LANG_ITALIAN :
!strncmp(systemLang, "es_",3) ? LANG_SPANISH :
LANG_OTHER;
#else
WORD lang = PRIMARYLANGID(GetSystemDefaultLCID());
#endif
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
FrontEndMenuManager.LoadSettings(); FrontEndMenuManager.LoadSettings();
#endif
#endif
gGameState = GS_START_UP; gGameState = GS_START_UP;
TRACE("gGameState = GS_START_UP"); TRACE("gGameState = GS_START_UP");
@ -334,6 +394,14 @@ psInitialize(void)
_dwOperatingSystemVersion = OS_WIN95; _dwOperatingSystemVersion = OS_WIN95;
} }
} }
#ifndef PS2_MENU
#ifdef GTA3_1_1_PATCH
FrontEndMenuManager.LoadSettings();
#endif
#endif
MEMORYSTATUS memstats; MEMORYSTATUS memstats;
GlobalMemoryStatus(&memstats); GlobalMemoryStatus(&memstats);
@ -343,6 +411,14 @@ psInitialize(void)
debug("Physical memory size %u\n", memstats.dwTotalPhys); debug("Physical memory size %u\n", memstats.dwTotalPhys);
debug("Available physical memory %u\n", memstats.dwAvailPhys); debug("Available physical memory %u\n", memstats.dwAvailPhys);
#else #else
#ifndef PS2_MENU
#ifdef GTA3_1_1_PATCH
FrontEndMenuManager.LoadSettings();
#endif
#endif
struct sysinfo systemInfo; struct sysinfo systemInfo;
sysinfo(&systemInfo); sysinfo(&systemInfo);
@ -664,7 +740,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 */
@ -1425,14 +1503,33 @@ main(int argc, char *argv[])
SetErrorMode(SEM_FAILCRITICALERRORS); SetErrorMode(SEM_FAILCRITICALERRORS);
#endif #endif
#ifndef MASTER #ifdef PS2_MENU
if (TurnOnAnimViewer) { int32 r = TheMemoryCard.CheckCardStateAtGameStartUp(CARD_ONE);
CAnimViewer::Initialise(); if ( r == CMemoryCard::ERR_DIRNOENTRY || r == CMemoryCard::ERR_NOFORMAT
FrontEndMenuManager.m_bGameNotLoaded = false; && r != CMemoryCard::ERR_OPENNOENTRY && r != CMemoryCard::ERR_NONE )
gGameState = GS_ANIMVIEWER; {
TurnOnAnimViewer = false; LoadingScreen(nil, nil, "loadsc0");
TheText.Unload();
TheText.Load();
CFont::Initialise();
FrontEndMenuManager.DrawMemoryCardStartUpMenus();
} }
#endif #endif
if (TurnOnAnimViewer)
{
#ifndef MASTER
CAnimViewer::Initialise();
#ifndef PS2_MENU
FrontEndMenuManager.m_bGameNotLoaded = false;
#endif
gGameState = GS_ANIMVIEWER;
TurnOnAnimViewer = false;
#endif
}
initkeymap(); initkeymap();
@ -1452,7 +1549,18 @@ main(int argc, char *argv[])
* 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) && !glfwWindowShouldClose(PSGLOBAL(window)) )
#else
while( !RsGlobal.quit && !FrontEndMenuManager.m_bWantToRestart && !glfwWindowShouldClose(PSGLOBAL(window))) while( !RsGlobal.quit && !FrontEndMenuManager.m_bWantToRestart && !glfwWindowShouldClose(PSGLOBAL(window)))
#endif
{ {
glfwPollEvents(); glfwPollEvents();
if( ForegroundApp ) if( ForegroundApp )
@ -1461,7 +1569,11 @@ main(int argc, char *argv[])
{ {
case GS_START_UP: case GS_START_UP:
{ {
#ifdef NO_MOVIES
gGameState = GS_INIT_ONCE; gGameState = GS_INIT_ONCE;
#else
gGameState = GS_INIT_LOGO_MPEG;
#endif
TRACE("gGameState = GS_INIT_ONCE"); TRACE("gGameState = GS_INIT_ONCE");
break; break;
} }
@ -1470,13 +1582,27 @@ main(int argc, char *argv[])
{ {
//CoUninitialize(); //CoUninitialize();
#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"); 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;
} }
@ -1500,18 +1626,27 @@ main(int argc, char *argv[])
break; break;
} }
#ifndef PS2_MENU
case GS_FRONTEND: case GS_FRONTEND:
{ {
if(!glfwGetWindowAttrib(PSGLOBAL(window), GLFW_ICONIFIED)) if(!glfwGetWindowAttrib(PSGLOBAL(window), GLFW_ICONIFIED))
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;
@ -1520,11 +1655,37 @@ main(int argc, char *argv[])
} }
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;
@ -1573,16 +1734,46 @@ main(int argc, char *argv[])
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();
@ -1614,6 +1805,7 @@ main(int argc, char *argv[])
FrontEndMenuManager.m_bFirstTime = false; FrontEndMenuManager.m_bFirstTime = false;
FrontEndMenuManager.m_bWantToRestart = false; FrontEndMenuManager.m_bWantToRestart = false;
#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 @@ psInitialize(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 @@ psInitialize(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();
@ -1447,7 +1490,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 */
@ -1725,27 +1770,27 @@ void InitialiseLanguage()
{ {
case LANG_GERMAN: case LANG_GERMAN:
{ {
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_GERMAN; FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_GERMAN;
break; break;
} }
case LANG_SPANISH: case LANG_SPANISH:
{ {
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_SPANISH; FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_SPANISH;
break; break;
} }
case LANG_FRENCH: case LANG_FRENCH:
{ {
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_FRENCH; FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_FRENCH;
break; break;
} }
case LANG_ITALIAN: case LANG_ITALIAN:
{ {
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_ITALIAN; FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_ITALIAN;
break; break;
} }
default: default:
{ {
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_AMERICAN; FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_AMERICAN;
break; break;
} }
} }
@ -2041,24 +2086,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;
@ -2077,8 +2133,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) )
{ {
@ -2098,7 +2164,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;
} }
@ -2173,16 +2243,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");
@ -2210,13 +2294,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;
@ -2225,11 +2317,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;
@ -2279,16 +2397,45 @@ 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();
@ -2320,6 +2467,7 @@ WinMain(HINSTANCE instance,
FrontEndMenuManager.m_bFirstTime = false; FrontEndMenuManager.m_bFirstTime = false;
FrontEndMenuManager.m_bWantToRestart = false; FrontEndMenuManager.m_bWantToRestart = false;
#endif
} }

View File

@ -40,29 +40,29 @@ CText::Load(void)
CFileMgr::SetDir("TEXT"); CFileMgr::SetDir("TEXT");
switch(FrontEndMenuManager.m_PrefsLanguage){ switch(FrontEndMenuManager.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
@ -242,19 +242,19 @@ CText::LoadMissionText(char *MissionTableName)
CFileMgr::SetDir("TEXT"); CFileMgr::SetDir("TEXT");
switch (FrontEndMenuManager.m_PrefsLanguage) { switch (FrontEndMenuManager.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
@ -476,12 +476,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);