1
0
Fork 0
mirror of https://github.com/halpz/re3.git synced 2024-12-25 18:05:27 +00:00

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->bIsVisible = false;
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);
CTimer::Resume();
@ -369,7 +369,7 @@ CCutsceneMgr::DeleteCutsceneData(void)
ms_loaded = false;
FindPlayerPed()->bIsVisible = true;
CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_80;
CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_CUTSCENE);
CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(false);
if (CGeneral::faststricmp(ms_cutsceneName, "end")) {

View file

@ -4775,8 +4775,8 @@ cAudioManager::ProcessFrontEnd()
m_sQueueSample.m_nSampleIndex = SFX_FE_SELECT_LEFT;
stereo = true;
frontendBank = true;
frontendBank = true;
frontendBank = true;
break;
//case SOUND_FRONTEND_EXIT:
// m_sQueueSample.m_nSampleIndex = SFX_SUB_MENU_BACK_LEFT;
@ -5906,4 +5906,4 @@ cAudioManager::ProcessMissionAudio()
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);
}
void
cAudioManager::SetMonoMode(uint8 mono)
{
SampleManager.SetMonoMode(mono);
}
void
cAudioManager::SetMusicFadeVol(uint8 volume) const
{
@ -385,9 +391,9 @@ cAudioManager::ReacquireDigitalHandle() const
}
void
cAudioManager::SetDynamicAcousticModelingStatus(bool status)
cAudioManager::SetDynamicAcousticModelingStatus(uint8 status)
{
m_bDynamicAcousticModelingStatus = status;
m_bDynamicAcousticModelingStatus = status!=0;
}
bool
@ -967,4 +973,4 @@ cAudioManager::ComputeEmittingVolume(uint8 emittingVolume, float intensity, floa
return (quatIntensity - (dist - diffIntensity)) * (float)emittingVolume / quatIntensity;
return emittingVolume;
}
#endif
#endif

View file

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

View file

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

View file

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

View file

@ -162,7 +162,7 @@ CGameLogic::Update()
AfterDeathArrestSetUpShortCutTaxi();
SortOutStreamingAndMemory(pPlayerInfo.GetPos());
TheCamera.m_fCamShakeForce = 0.0f;
TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE);
TheCamera.SetMotionBlur(0, 0, 0, 0, MOTION_BLUR_NONE);
CPad::GetPad(0)->StopShaking(0);
CReferences::RemoveReferencesToPlayer();
CPopulation::m_CountDownToPedsAtStart = 10;
@ -269,7 +269,7 @@ CGameLogic::Update()
pPlayerInfo.m_pPed->ClearWeapons();
SortOutStreamingAndMemory(pPlayerInfo.GetPos());
TheCamera.m_fCamShakeForce = 0.0f;
TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE);
TheCamera.SetMotionBlur(0, 0, 0, 0, MOTION_BLUR_NONE);
CPad::GetPad(0)->StopShaking(0);
CReferences::RemoveReferencesToPlayer();
CPopulation::m_CountDownToPedsAtStart = 10;
@ -318,7 +318,7 @@ CGameLogic::Update()
RestorePlayerStuffDuringResurrection(pPlayerInfo.m_pPed, vecRestartPos, fRestartFloat);
SortOutStreamingAndMemory(pPlayerInfo.GetPos());
TheCamera.m_fCamShakeForce = 0.0f;
TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE);
TheCamera.SetMotionBlur(0, 0, 0, 0, MOTION_BLUR_NONE);
CPad::GetPad(0)->StopShaking(0);
CReferences::RemoveReferencesToPlayer();
CPopulation::m_CountDownToPedsAtStart = 10;

View file

@ -54,7 +54,7 @@ CPhoneInfo::Update(void)
endAssoc->flags &= ~ASSOC_DELETEFADEDOUT;
endAssoc->SetFinishCallback(PhonePutDownCB, player);
} else {
CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_40;
CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_PHONE);
if (player->m_nPedState == PED_MAKE_CALL)
player->m_nPedState = PED_IDLE;
}
@ -104,7 +104,7 @@ CPhoneInfo::Update(void)
player->m_fRotationDest = angleToFace;
player->SetHeading(angleToFace);
player->m_nPedState = PED_MAKE_CALL;
CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_40;
CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_PHONE);
TheCamera.SetWideScreenOn();
playerInfo->MakePlayerSafe(true);
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->blendDelta = -1000.0f;
CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_40;
CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_PHONE);
CPed *ped = (CPed*)arg;
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 IsVehicleStopped(CVehicle*);
static void PrintListSizes();
static void ReadObjectNamesFromScript();
static void UpdateObjectIndices();
static void ReadMultiScriptFileOffsetsFromScript();
@ -391,7 +392,7 @@ public:
enum {
MAX_STACK_DEPTH = 6,
MAX_STACK_DEPTH = 6, // 4 PS2
NUM_LOCAL_VARS = 16,
NUM_TIMERS = 2
};
@ -503,6 +504,11 @@ private:
bool CanAllowMissionReplay();
#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; }
bool ThisIsAValidRandomPed(uint32 pedtype, int civ, int gang, int criminal) {

View file

@ -1437,4 +1437,35 @@ enum {
COMMAND_REGISTER_FIRE_LEVEL,
COMMAND_IS_AUSTRALIAN_GAME,
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;
float AlphaOffset, BetaOffset;
if(CPad::GetPad(0)->IsPlayerControlsDisabledBy(PLAYERCONTROL_DISABLED_20)){
if(CPad::GetPad(0)->IsPlayerControlsDisabledBy(PLAYERCONTROL_PLAYERINFO)){
CVector ToCam = Source - TargetCoors;
ToCam.Normalise();
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 ||
CDraw::FadeValue > 200 ||
CPad::GetPad(0)->IsPlayerControlsDisabledBy(PLAYERCONTROL_DISABLED_20)){
CPad::GetPad(0)->IsPlayerControlsDisabledBy(PLAYERCONTROL_PLAYERINFO)){
if(Alpha < fDefaultAlphaOrient-0.05f)
AlphaOffset = 0.05f;
else if(Alpha < fDefaultAlphaOrient)
@ -1525,7 +1525,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
if(((CPed*)CamTargetEntity)->CanStrafeOrMouseControl() && CDraw::FadeValue < 250 &&
(TheCamera.GetFadingDirection() != FADE_OUT || CDraw::FadeValue <= 100) &&
!CPad::GetPad(0)->IsPlayerControlsDisabledBy(PLAYERCONTROL_DISABLED_20)){
!CPad::GetPad(0)->IsPlayerControlsDisabledBy(PLAYERCONTROL_PLAYERINFO)){
float Heading = Front.Heading();
((CPed*)TheCamera.pTargetEntity)->m_fRotationCur = 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
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)
Length = 0.002f;
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){
Source.x = TargetCoors.x + Dist.x/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;
}
TheCamera.SetMotionBlur(180, 255, 180, 120, MBLUR_SNIPER);
TheCamera.SetMotionBlur(180, 255, 180, 120, MOTION_BLUR_SNIPER);
if(FOV > DefaultFOV)
FOV = DefaultFOV;
@ -2939,7 +2950,7 @@ CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float
FOVSpeed = 0.0f;
}
TheCamera.SetMotionBlur(180, 255, 180, 120, MBLUR_SNIPER);
TheCamera.SetMotionBlur(180, 255, 180, 120, MOTION_BLUR_SNIPER);
if(FOV > DefaultFOV)
FOV = DefaultFOV;
@ -3715,11 +3726,11 @@ CCam::Process_Fixed(const CVector &CameraTarget, float, float, float)
float f = BOAT_UNDERWATER_CAM_COLORMAG_LIMIT/WaterLum;
TheCamera.SetMotionBlur(CTimeCycle::GetWaterRed()*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{
TheCamera.SetMotionBlur(CTimeCycle::GetWaterRed(),
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;
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)
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().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));
static bool bExtra1stPrsBlur = false;
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;
}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;
}
@ -694,7 +694,7 @@ CCamera::CamControl(void)
m_bFailedCullZoneTestPreviously = CCullZones::CamCloseInForPlayer();
if(m_bLookingAtPlayer){
CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_1;
CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_CAMERA;
FindPlayerPed()->bIsVisible = true;
}
@ -1029,7 +1029,7 @@ CCamera::CamControl(void)
m_bFirstPersonBeingUsed = false;
if(m_bFirstPersonBeingUsed){
ReqMode = CCam::MODE_1STPERSON;
CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_1;
CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_CAMERA;
}
// Zoom value
@ -1679,7 +1679,7 @@ CCamera::CamControl(void)
}else if(Cams[ActiveCam].Mode != m_iModeToGoTo){
m_bStartInterScript = true;
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;
}
if(m_BlurType == MBLUR_NONE || m_BlurType == MBLUR_NORMAL)
if(m_BlurType == MOTION_BLUR_NONE || m_BlurType == MOTION_BLUR_LIGHT_SCENE)
SetMotionBlurAlpha(80);
// top border
@ -3913,7 +3913,7 @@ CCamera::SetCameraDirectlyInFrontForFollowPed_CamOnAString(void)
void
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.MaxZoom = maxZoom;
PlayerWeaponMode.MinZoom = minZoom;
@ -3923,7 +3923,7 @@ CCamera::SetNewPlayerWeaponMode(int16 mode, int16 minZoom, int16 maxZoom)
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.MaxZoom = 1;
PlayerWeaponMode.MinZoom = -1;

View file

@ -186,7 +186,6 @@ public:
CPed *m_pLastPedLookedAt;// So interpolation works
bool m_bFirstPersonRunAboutActive;
CCam(void) { Init(); }
void Init(void);
void Process(void);
@ -295,16 +294,16 @@ enum
enum
{
MBLUR_NONE,
MBLUR_SNIPER,
MBLUR_NORMAL,
MBLUR_INTRO1, // green camera
MBLUR_INTRO2, // unused
MBLUR_INTRO3, // bank scene
MBLUR_INTRO4, // jail break scene
MBLUR_INTRO5, // explosion
MBLUR_INTRO6, // player shot
MBLUR_UNUSED, // pinkish
MOTION_BLUR_NONE = 0,
MOTION_BLUR_SNIPER,
MOTION_BLUR_LIGHT_SCENE,
MOTION_BLUR_SECURITY_CAM,
MOTION_BLUR_CUT_SCENE,
MOTION_BLUR_INTRO,
MOTION_BLUR_INTRO2,
MOTION_BLUR_SNIPER_ZOOM,
MOTION_BLUR_INTRO3,
MOTION_BLUR_INTRO4,
};
enum
@ -414,9 +413,12 @@ public:
float CarZoomValueSmooth;
float DistanceToWater;
#ifndef PS2_CAM_TRANSITION
float FOVDuringInter;
#endif
float LODDistMultiplier;
float GenerationDistMultiplier;
#ifndef PS2_CAM_TRANSITION
float m_fAlphaSpeedAtStartInter;
float m_fAlphaWhenInterPol;
float m_fAlphaDuringInterPol;
@ -427,6 +429,7 @@ public:
float m_fFOVSpeedAtStartInter;
float m_fStartingBetaForInterPol;
float m_fStartingAlphaForInterPol;
#endif
float m_PedOrientForBehindOrInFront;
float m_CameraAverageSpeed;
float m_CameraSpeedSoFar;
@ -489,9 +492,11 @@ public:
CVector m_vecUpWhenInterPol;
CVector m_vecClearGeometryVec;
CVector m_vecGameCamPos;
#ifndef PS2_CAM_TRANSITION
CVector SourceDuringInter;
CVector TargetDuringInter;
CVector UpDuringInter;
#endif
RwCamera *m_pRwCamera;
CEntity *pTargetEntity;
CCamPathSplines m_arrPathArray[MAX_NUM_OF_SPLINETYPES];
@ -509,7 +514,6 @@ public:
CVector m_vecOldSourceForInter;
CVector m_vecOldFrontForInter;
CVector m_vecOldUpForInter;
float m_vecOldFOVForInter;
float m_fFLOATingFade;
float m_fFLOATingFadeMusic;

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,7 @@
#pragma once
#ifdef PS2_MENU
#include "Frontend_PS2.h"
#else
#include "Sprite2d.h"
@ -94,20 +97,6 @@
#define CONTSETUP_BACK_BOTTOM 122.0f
#define CONTSETUP_BACK_HEIGHT 25.0f
enum eLanguages
{
LANGUAGE_AMERICAN,
LANGUAGE_FRENCH,
LANGUAGE_GERMAN,
LANGUAGE_ITALIAN,
LANGUAGE_SPANISH,
#ifdef MORE_LANGUAGES
LANGUAGE_POLISH,
LANGUAGE_RUSSIAN,
LANGUAGE_JAPANESE,
#endif
};
enum
{
MENUALIGN_LEFT = 1,
@ -591,6 +580,19 @@ public:
int32 m_nSelectedScreenMode;
#endif
enum LANGUAGE
{
LANGUAGE_AMERICAN,
LANGUAGE_FRENCH,
LANGUAGE_GERMAN,
LANGUAGE_ITALIAN,
LANGUAGE_SPANISH,
#ifdef MORE_LANGUAGES
LANGUAGE_POLISH,
LANGUAGE_RUSSIAN,
LANGUAGE_JAPANESE,
#endif
};
bool GetIsMenuActive() {return !!m_bMenuActive;}
static uint8 m_PrefsStereoMono;
@ -666,3 +668,6 @@ VALIDATE_SIZE(CMenuManager, 0x688);
#endif
extern CMenuManager FrontEndMenuManager;
#endif

1393
src/core/FrontendTriggers.h Normal file

File diff suppressed because it is too large Load diff

3034
src/core/Frontend_PS2.cpp Normal file

File diff suppressed because it is too large Load diff

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 "MBlur.h"
#include "Messages.h"
#include "MemoryCard.h"
#include "Pad.h"
#include "Particle.h"
#include "ParticleObject.h"
@ -104,6 +105,43 @@ bool CGame::japaneseGame = false;
int gameTxdSlot;
bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
void DoRWStuffEndOfFrame(void);
void MessageScreen(char *msg)
{
//TODO: stretch_screen
CRect rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
CRGBA color(255, 255, 255, 255);
DoRWStuffStartOfFrame(50, 50, 50, 0, 0, 0, 255);
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
DefinedState();
CSprite2d *splash = LoadSplash(NULL);
splash->Draw(rect, color, color, color, color);
splash->DrawRect(CRect(SCREEN_SCALE_X(20.0f), SCREEN_SCALE_Y(110.0f), SCREEN_SCALE_X(620.0f), SCREEN_SCALE_Y(300.0f)), CRGBA(50, 50, 50, 192));
CFont::SetFontStyle(FONT_BANK);
CFont::SetBackgroundOff();
CFont::SetWrapx(SCREEN_SCALE_FROM_RIGHT(190.0f)); // 450.0f
CFont::SetScale(SCREEN_SCALE_X(1.0f), SCREEN_SCALE_Y(1.0f));
CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_SCALE_FROM_RIGHT(190.0f)); // 450.0f
CFont::SetJustifyOff();
CFont::SetColor(CRGBA(255, 255, 255, 255));
CFont::SetDropColor(CRGBA(32, 32, 32, 255));
CFont::SetDropShadowPosition(3);
CFont::SetPropOn();
CFont::PrintString(SCREEN_SCALE_X(320.0f), SCREEN_SCALE_Y(130.0f), TheText.Get(msg));
CFont::DrawFonts();
DoRWStuffEndOfFrame();
}
bool
CGame::InitialiseOnceBeforeRW(void)
{
@ -278,6 +316,7 @@ bool CGame::Initialise(const char* datFile)
COcclusion::Init();
CCollision::Init();
CSetPieces::Init();
TheText.Load();
CTheZones::Init();
CUserDisplay::Init();
CMessages::Init();
@ -286,6 +325,11 @@ bool CGame::Initialise(const char* datFile)
CRestart::Initialise();
CWorld::Initialise();
CParticle::Initialise();
#ifdef PS2
gStartX = -180.0f;
gStartY = 180.0f;
gStartZ = 14.0f;
#endif
CAnimManager::Initialise();
CCutsceneMgr::Initialise();
CCarCtrl::Init();
@ -366,10 +410,16 @@ bool CGame::Initialise(const char* datFile)
CCredits::Init();
CRecordDataForChase::Init();
CReplay::Init();
LoadingScreen("Loading the Game", "Start script", nil);
#ifdef PS2_MENU
if ( !TheMemoryCard.m_bWantToLoad )
{
#endif
CTheScripts::StartTestScript();
CTheScripts::Process();
TheCamera.Process();
#ifdef PS2_MENU
}
#endif
LoadingScreen("Loading the Game", "Load scene", nil);
CCollision::ms_collisionInMemory = currLevel;
for (int i = 0; i < MAX_PADS; i++)
@ -433,8 +483,15 @@ bool CGame::ShutDown(void)
void CGame::ReInitGameObjectVariables(void)
{
CGameLogic::InitAtStartOfGame();
TheCamera.CCamera::Init();
#ifdef PS2_MENU
if ( !TheMemoryCard.m_bWantToLoad )
{
#endif
TheCamera.Init();
TheCamera.SetRwCamera(Scene.camera);
#ifdef PS2_MENU
}
#endif
CDebug::DebugInitTextBuffer();
CWeather::Init();
CUserDisplay::Init();
@ -443,6 +500,11 @@ void CGame::ReInitGameObjectVariables(void)
CWorld::bDoingCarCollisions = false;
CHud::ReInitialise();
CRadar::Initialise();
#ifdef PS2
gStartX = -180.0f;
gStartY = 180.0f;
gStartZ = 14.0f;
#endif
CCarCtrl::ReInit();
CTimeCycle::Initialise();
CDraw::SetFOV(120.0f);
@ -458,6 +520,10 @@ void CGame::ReInitGameObjectVariables(void)
CWorld::Players[i].Clear();
CWorld::PlayerInFocus = 0;
#ifdef PS2
CWeaponEffects::Init();
CSkidmarks::Init();
#endif
CAntennas::Init();
CGlass::Init();
gPhoneInfo.Initialise();
@ -473,11 +539,19 @@ void CGame::ReInitGameObjectVariables(void)
CPickups::Init();
CPacManPickups::Init();
CGarages::Init();
#ifdef PS2
CClouds::Init();
CRemote::Init();
#endif
CSpecialFX::Init();
CWaterCannons::Init();
CParticle::ReloadConfig();
#ifdef PS2_MENU
if ( !TheMemoryCard.m_bWantToLoad )
#else
if ( !FrontEndMenuManager.m_bWantToLoad )
#endif
{
CCranes::InitCranes();
CTheScripts::StartTestScript();
@ -589,8 +663,8 @@ void CGame::Process(void)
ProcessTidyUpMemory();
#endif
TheCamera.SetMotionBlurAlpha(0);
if (TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_SNIPER || TheCamera.m_BlurType == MBLUR_NORMAL)
TheCamera.SetMotionBlur(0, 0, 0, 0, MBLUR_NONE);
if (TheCamera.m_BlurType == MOTION_BLUR_NONE || TheCamera.m_BlurType == MOTION_BLUR_SNIPER || TheCamera.m_BlurType == MOTION_BLUR_LIGHT_SCENE)
TheCamera.SetMotionBlur(0, 0, 0, 0, MOTION_BLUR_NONE);
#ifdef DEBUGMENU
DebugMenuProcess();
#endif

File diff suppressed because it is too large Load diff

View file

@ -2,14 +2,14 @@
enum {
PLAYERCONTROL_ENABLED = 0,
PLAYERCONTROL_DISABLED_1 = 1, // used by first person camera
PLAYERCONTROL_DISABLED_2 = 2,
PLAYERCONTROL_CAMERA = 1,
PLAYERCONTROL_UNK2 = 2,
PLAYERCONTROL_GARAGE = 4,
PLAYERCONTROL_DISABLED_8 = 8,
PLAYERCONTROL_DISABLED_10 = 16,
PLAYERCONTROL_DISABLED_20 = 32, // used on CPlayerInfo::MakePlayerSafe
PLAYERCONTROL_DISABLED_40 = 64, // used on phone calls
PLAYERCONTROL_DISABLED_80 = 128,// used on cutscenes
PLAYERCONTROL_UNK8 = 8,
PLAYERCONTROL_UNK10 = 16,
PLAYERCONTROL_PLAYERINFO = 32,
PLAYERCONTROL_PHONE = 64,
PLAYERCONTROL_CUTSCENE = 128,
PLAYERCONTROL_SHORTCUT_TAXI = 256,
};
@ -198,13 +198,13 @@ public:
static void UpdatePads(void);
void ProcessPCSpecificStuff(void);
void Update(int16 unk);
void Update(int16 pad);
static void DoCheats(void);
void DoCheats(int16 unk);
static void StopPadsShaking(void);
void StopShaking(int16 unk);
void StopShaking(int16 pad);
static CPad *GetPad(int32 pad);
@ -455,6 +455,11 @@ public:
void SetDisablePlayerControls(uint16 who) { DisablePlayerControls |= who; }
void SetEnablePlayerControls(uint16 who) { 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);

View file

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

View file

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

View file

@ -232,14 +232,20 @@ enum Config {
#define REGISTER_START_BUTTON
// 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 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 LEGACY_MENU_OPTIONS
#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_PRECISE_MEASUREMENT_CONVERTION // makes game convert feet to meeters more precisely
//#define MISSION_REPLAY // mobile feature
#endif
//#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
//#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
// 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 FREE_CAM // Rotating cam

View file

@ -58,6 +58,7 @@
#include "Console.h"
#include "timebars.h"
#include "GenericGameStorage.h"
#include "MemoryCard.h"
#include "SceneEdit.h"
#include "debugmenu.h"
@ -185,14 +186,27 @@ DoFade(void)
if(CTimer::GetIsPaused())
return;
#ifdef PS2_MENU
if(TheMemoryCard.JustLoadedDontFadeInYet){
TheMemoryCard.JustLoadedDontFadeInYet = false;
TheMemoryCard.TimeStartedCountingForFade = CTimer::GetTimeInMilliseconds();
}
#else
if(JustLoadedDontFadeInYet){
JustLoadedDontFadeInYet = false;
TimeStartedCountingForFade = CTimer::GetTimeInMilliseconds();
}
#endif
#ifdef PS2_MENU
if(TheMemoryCard.StillToFadeOut){
if(CTimer::GetTimeInMilliseconds() - TheMemoryCard.TimeStartedCountingForFade > TheMemoryCard.TimeToStayFadedBeforeFadeOut){
TheMemoryCard.StillToFadeOut = false;
#else
if(StillToFadeOut){
if(CTimer::GetTimeInMilliseconds() - TimeStartedCountingForFade > TimeToStayFadedBeforeFadeOut){
StillToFadeOut = false;
#endif
TheCamera.Fade(3.0f, FADE_IN);
TheCamera.ProcessFade();
TheCamera.ProcessMusicFade();
@ -925,17 +939,16 @@ Render2dStuff(void)
void
RenderMenus(void)
{
#ifdef PS2
if (FrontEndMenuManager.m_bWantToDraw)
if (FrontEndMenuManager.m_bMenuActive)
{
#ifdef PS2
gMainHeap.PushMemId(_TODOCONST(17));
FrontEndMenuManager.DrawFrontEnd();
gMainHeap.PopMemId();
}
#else
if(FrontEndMenuManager.m_bMenuActive)
FrontEndMenuManager.DrawFrontEnd();
#endif
FrontEndMenuManager.DrawFrontEnd();
#ifdef PS2
gMainHeap.PopMemId();
#endif
}
}
void
@ -979,14 +992,25 @@ Idle(void *arg)
#endif
if(CGame::bDemoMode && CTimer::GetTimeInMilliseconds() > (3*60 + 30)*1000 && !CCutsceneMgr::IsCutsceneProcessing()){
#ifdef PS2_MENU
TheMemoryCard.m_bWantToLoad = false;
FrontEndMenuManager.m_bWantToRestart = true;
#else
FrontEndMenuManager.m_bWantToRestart = true;
FrontEndMenuManager.m_bWantToLoad = false;
#endif
return;
}
#ifdef PS2_MENU
if ( FrontEndMenuManager.m_bWantToRestart || TheMemoryCard.b_FoundRecentSavedGameWantToLoad )
#else
if(FrontEndMenuManager.m_bWantToRestart || b_FoundRecentSavedGameWantToLoad)
#endif
{
return;
}
SetLightsWithTimeOfDayColour(Scene.world);
if(arg == nil)
@ -1048,7 +1072,7 @@ Idle(void *arg)
#ifdef TIMEBARS
tbStartTimer(0, "RenderMotionBlur");
#endif
if((TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_NORMAL) &&
if((TheCamera.m_BlurType == MOTION_BLUR_NONE || TheCamera.m_BlurType == MOTION_BLUR_LIGHT_SCENE) &&
TheCamera.m_ScreenReductionPercentage > 0.0f)
TheCamera.SetMotionBlurAlpha(150);
TheCamera.RenderMotionBlur();
@ -1081,6 +1105,11 @@ Idle(void *arg)
tbEndTimer("RenderMenus");
tbStartTimer(0, "DoFade");
#endif
#ifdef PS2_MENU
if ( TheMemoryCard.m_bWantToLoad )
return;
#endif
DoFade();
#ifdef TIMEBARS
tbEndTimer("DoFade");
@ -1255,6 +1284,7 @@ TheModelViewer(void)
}
#endif
#ifdef PS2
void TheGame(void)
{
printf("Into TheGame!!!\n");
@ -1276,12 +1306,12 @@ void TheGame(void)
LoadingScreen("Starting Game", NULL, splash);
#ifdef GTA_PS2
if ( TheMemoryCard.CheckCardInserted(_TODOCONST(0)) == _TODOCONST(26)
&& TheMemoryCard.ChangeDirectory(_TODOCONST(0), TheMemoryCard.field154)
&& TheMemoryCard.FindMostRecentFileName(_TODOCONST(0), TheMemoryCard.field37) == 1
&& TheMemoryCard.CheckDataNotCorrupt(TheMemoryCard.field37))
if ( TheMemoryCard.CheckCardInserted(CARD_ONE) == CMemoryCard::NO_ERR_SUCCESS
&& TheMemoryCard.ChangeDirectory(CARD_ONE, TheMemoryCard.Cards[CARD_ONE].dir)
&& TheMemoryCard.FindMostRecentFileName(CARD_ONE, TheMemoryCard.MostRecentFile) == true
&& TheMemoryCard.CheckDataNotCorrupt(TheMemoryCard.MostRecentFile))
{
strcpy(TheMemoryCard.LoadFileName, TheMemoryCard.field37);
strcpy(TheMemoryCard.LoadFileName, TheMemoryCard.MostRecentFile);
TheMemoryCard.b_FoundRecentSavedGameWantToLoad = true;
if (FrontEndMenuManager.m_PrefsLanguage != TheMemoryCard.GetLanguageToLoad())
@ -1385,7 +1415,7 @@ void TheGame(void)
RenderDebugShit();
RenderEffects();
if ((TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_NORMAL) && TheCamera.m_ScreenReductionPercentage > 0.0f)
if ((TheCamera.m_BlurType == MOTION_BLUR_NONE || TheCamera.m_BlurType == MOTION_BLUR_LIGHT_SCENE) && TheCamera.m_ScreenReductionPercentage > 0.0f)
TheCamera.SetMotionBlurAlpha(150);
TheCamera.RenderMotionBlur();
@ -1767,8 +1797,6 @@ void GameInit()
}
}
// Not used anyway. PS2 main() port
#ifdef _WIN32
int
main(int argc, char *argv[])
{
@ -1779,9 +1807,10 @@ main(int argc, char *argv[])
SystemInit();
#ifdef PS2
int32 state = TheMemoryCard.CheckCardStateAtGameStartUp(_TODOCONST(0));
int32 r = TheMemoryCard.CheckCardStateAtGameStartUp(CARD_ONE);
if ( state == _TODOCONST(2) || state == _TODOCONST(1) && state != _TODOCONST(3) && state != _TODOCONST(0) )
if ( r == CMemoryCard::ERR_DIRNOENTRY || r == CMemoryCard::ERR_NOFORMAT
&& r != CMemoryCard::ERR_OPENNOENTRY && r != CMemoryCard::ERR_NONE )
{
GameInit();

View file

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

View file

@ -128,12 +128,12 @@ CCredits::Render(void)
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED040"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.4f, 0.82f, TheText.Get("CRED041"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN)
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.5, lineoffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED042"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED043"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN)
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.5, lineoffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED044"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
@ -176,7 +176,7 @@ CCredits::Render(void)
PrintCreditSpace(2.0f, lineoffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED061"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN)
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.5, lineoffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED062"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
@ -191,7 +191,7 @@ CCredits::Render(void)
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED068"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED069"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN)
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.5, lineoffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED070"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
@ -220,7 +220,7 @@ CCredits::Render(void)
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED262"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED085"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN)
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.5, lineoffset);
PrintCreditText(1.7f, 1.7f, TheText.Get("CRED086"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
@ -265,76 +265,76 @@ CCredits::Render(void)
PrintCreditText(1.0, 1.0, TheText.Get("CRED108"), lineoffset, scrolloffset);
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED109"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN)
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED110"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);
PrintCreditText(1.7f, 1.0f, TheText.Get("CRED111"), lineoffset, scrolloffset);
PrintCreditText(1.0, 1.0, TheText.Get("CRED112"), lineoffset, scrolloffset);
if(FrontEndMenuManager.m_PrefsLanguage == LANGUAGE_ITALIAN)
if(FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_ITALIAN)
PrintCreditSpace(1.0, lineoffset);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
PrintCreditText(1.0, 1.0, TheText.Get("CRED134"), lineoffset, scrolloffset);
PrintCreditSpace(2.0f, lineoffset);

View file

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

View file

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

View file

@ -1,3 +1,4 @@
#define WITHWINDOWS
#include "common.h"
#include "RwHelper.h"
@ -9,6 +10,7 @@
RwRaster *CMBlur::pFrontBuffer;
bool CMBlur::ms_bJustInitialised;
bool CMBlur::ms_bScaledBlur;
bool CMBlur::BlurOn;
float CMBlur::Drunkness;
@ -16,43 +18,123 @@ static RwIm2DVertex Vertex[4];
static RwIm2DVertex Vertex2[4];
static RwImVertexIndex Index[6] = { 0, 1, 2, 0, 2, 3 };
void
RwBool
CMBlur::MotionBlurOpen(RwCamera *cam)
{
// TODO. this is simplified
#ifdef GTA_PS2
RwRect rect = {0, 0, 0, 0};
if (pFrontBuffer)
return TRUE;
BlurOn = true;
rect.w = RwRasterGetWidth(RwCameraGetRaster(cam));
rect.h = RwRasterGetHeight(RwCameraGetRaster(cam));
pFrontBuffer = RwRasterCreate(0, 0, 0, rwRASTERDONTALLOCATE|rwRASTERTYPECAMERATEXTURE);
if (!pFrontBuffer)
{
printf("Error creating raster\n");
return FALSE;
}
RwRaster *raster = RwRasterSubRaster(pFrontBuffer, RwCameraGetRaster(cam), &rect);
if (!raster)
{
RwRasterDestroy(pFrontBuffer);
pFrontBuffer = NULL;
printf("Error subrastering\n");
return FALSE;
}
CreateImmediateModeData(cam, &rect);
#else
RwRect rect = { 0, 0, 0, 0 };
if(pFrontBuffer)
MotionBlurClose();
if(BlurOn){
for(rect.w = 1; rect.w < RwRasterGetWidth(RwCameraGetRaster(cam)); rect.w *= 2);
for(rect.h = 1; rect.h < RwRasterGetHeight(RwCameraGetRaster(cam)); rect.h *= 2);
pFrontBuffer = RwRasterCreate(rect.w, rect.h, RwRasterGetDepth(RwCameraGetRaster(cam)), rwRASTERTYPECAMERATEXTURE);
if(pFrontBuffer)
ms_bJustInitialised = true;
else{
debug("MBlurOpen can't create raster.");
#ifndef LIBRW
extern void _GetVideoMemInfo(LPDWORD total, LPDWORD avaible);
DWORD total, avaible;
_GetVideoMemInfo(&total, &avaible);
debug("Available video memory %d\n", avaible);
#endif
if(BlurOn)
{
int32 width = Pow(2.0f, int32(log2(RwRasterGetWidth (RwCameraGetRaster(cam))))+1);
int32 height = Pow(2.0f, int32(log2(RwRasterGetHeight(RwCameraGetRaster(cam))))+1);
int32 depth = RwRasterGetDepth(RwCameraGetRaster(cam));
#ifndef LIBRW
extern D3DCAPS8 _RwD3D8DeviceCaps;
extern DWORD _dwMemTotalVideo;
if ( _RwD3D8DeviceCaps.MaxTextureWidth >= width && _RwD3D8DeviceCaps.MaxTextureHeight >= height )
{
total = _dwMemTotalVideo - 3 *
( RwRasterGetDepth(RwCameraGetRaster(cam))
* RwRasterGetHeight(RwCameraGetRaster(cam))
* RwRasterGetWidth(RwCameraGetRaster(cam)) / 8 );
BlurOn = total >= height*width*(depth/8) + (12*1024*1024) /*12 MB*/;
}
else
BlurOn = false;
#endif
if ( BlurOn )
{
ms_bScaledBlur = false;
rect.w = width;
rect.h = height;
pFrontBuffer = RwRasterCreate(rect.w, rect.h, depth, rwRASTERTYPECAMERATEXTURE);
if ( !pFrontBuffer )
{
debug("MBlurOpen can't create raster.");
BlurOn = false;
rect.w = RwRasterGetWidth(RwCameraGetRaster(cam));
rect.h = RwRasterGetHeight(RwCameraGetRaster(cam));
}
else
ms_bJustInitialised = true;
}
else
{
rect.w = RwRasterGetWidth(RwCameraGetRaster(cam));
rect.h = RwRasterGetHeight(RwCameraGetRaster(cam));
}
#ifndef LIBRW
_GetVideoMemInfo(&total, &avaible);
debug("Available video memory %d\n", avaible);
#endif
CreateImmediateModeData(cam, &rect);
}else{
}
else
{
rect.w = RwRasterGetWidth(RwCameraGetRaster(cam));
rect.h = RwRasterGetHeight(RwCameraGetRaster(cam));
CreateImmediateModeData(cam, &rect);
}
return TRUE;
#endif
}
void
RwBool
CMBlur::MotionBlurClose(void)
{
if(pFrontBuffer){
RwRasterDestroy(pFrontBuffer);
pFrontBuffer = nil;
return TRUE;
}
return FALSE;
}
void
@ -149,6 +231,10 @@ void
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 };
#ifdef GTA_PS2
if( pFrontBuffer )
OverlayRender(cam, pFrontBuffer, color, type, addalpha);
#else
if(ms_bJustInitialised)
ms_bJustInitialised = false;
else
@ -158,6 +244,7 @@ CMBlur::MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, u
RwRasterRenderFast(RwCameraGetRaster(cam), 0, 0);
RwRasterPopContext();
}
#endif
}
void
@ -172,32 +259,33 @@ CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type,
DefinedState();
switch(type){
case MBLUR_INTRO1:
switch(type)
{
case MOTION_BLUR_SECURITY_CAM:
r = 0;
g = 255;
b = 0;
a = 128;
break;
case MBLUR_INTRO3:
case MOTION_BLUR_INTRO:
r = 100;
g = 220;
b = 230;
a = 158;
break;
case MBLUR_INTRO4:
case MOTION_BLUR_INTRO2:
r = 80;
g = 255;
b = 230;
a = 138;
break;
case MBLUR_INTRO6:
case MOTION_BLUR_INTRO3:
r = 255;
g = 60;
b = 60;
a = 200;
break;
case MBLUR_UNUSED:
case MOTION_BLUR_INTRO4:
r = 255;
g = 180;
b = 180;
@ -210,7 +298,7 @@ CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type,
int ovR = r * 0.6f;
int ovG = g * 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[1], 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);
if(BlurOn){
if(type == MBLUR_SNIPER){
if(type == MOTION_BLUR_SNIPER){
RwIm2DVertexSetIntRGBA(&Vertex2[0], r, g, b, 80);
RwIm2DVertexSetIntRGBA(&Vertex2[1], r, g, b, 80);
RwIm2DVertexSetIntRGBA(&Vertex2[2], r, g, b, 80);

View file

@ -15,12 +15,13 @@ class CMBlur
public:
static RwRaster *pFrontBuffer;
static bool ms_bJustInitialised;
static bool ms_bScaledBlur;
static bool BlurOn;
static float Drunkness;
public:
static void MotionBlurOpen(RwCamera *cam);
static void MotionBlurClose(void);
static RwBool MotionBlurOpen(RwCamera *cam);
static RwBool MotionBlurClose(void);
static void CreateImmediateModeData(RwCamera *cam, RwRect *rect);
static void MotionBlurRender(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 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
if(TheCamera.m_BlurType == MBLUR_NONE || TheCamera.m_BlurType == MBLUR_NORMAL)
TheCamera.SetMotionBlur(m_fCurrentBlurRed, m_fCurrentBlurGreen, m_fCurrentBlurBlue, 5, 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, MOTION_BLUR_LIGHT_SCENE);
m_nCurrentFogColourRed = (m_nCurrentSkyTopRed + 2*m_nCurrentSkyBottomRed) / 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 "Game.h"
#include "PCSave.h"
#include "MemoryCard.h"
#include "Sprite2d.h"
#include "AnimViewer.h"
#include "Font.h"
#define MAX_SUBSYSTEMS (16)
@ -287,11 +289,69 @@ psInitialize(void)
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());
InitialiseLanguage();
#ifndef GTA3_1_1_PATCH
FrontEndMenuManager.LoadSettings();
#endif
#endif
gGameState = GS_START_UP;
TRACE("gGameState = GS_START_UP");
@ -334,6 +394,14 @@ psInitialize(void)
_dwOperatingSystemVersion = OS_WIN95;
}
}
#ifndef PS2_MENU
#ifdef GTA3_1_1_PATCH
FrontEndMenuManager.LoadSettings();
#endif
#endif
MEMORYSTATUS memstats;
GlobalMemoryStatus(&memstats);
@ -343,6 +411,14 @@ psInitialize(void)
debug("Physical memory size %u\n", memstats.dwTotalPhys);
debug("Available physical memory %u\n", memstats.dwAvailPhys);
#else
#ifndef PS2_MENU
#ifdef GTA3_1_1_PATCH
FrontEndMenuManager.LoadSettings();
#endif
#endif
struct sysinfo systemInfo;
sysinfo(&systemInfo);
@ -664,7 +740,9 @@ psSelectDevice()
FrontEndMenuManager.m_nPrefsDepth = vm.depth;
#endif
#ifndef PS2_MENU
FrontEndMenuManager.m_nCurrOption = 0;
#endif
/* Set up the video mode and set the apps window
* dimensions to match */
@ -1425,14 +1503,33 @@ main(int argc, char *argv[])
SetErrorMode(SEM_FAILCRITICALERRORS);
#endif
#ifndef MASTER
if (TurnOnAnimViewer) {
CAnimViewer::Initialise();
FrontEndMenuManager.m_bGameNotLoaded = false;
gGameState = GS_ANIMVIEWER;
TurnOnAnimViewer = false;
#ifdef PS2_MENU
int32 r = TheMemoryCard.CheckCardStateAtGameStartUp(CARD_ONE);
if ( r == CMemoryCard::ERR_DIRNOENTRY || r == CMemoryCard::ERR_NOFORMAT
&& r != CMemoryCard::ERR_OPENNOENTRY && r != CMemoryCard::ERR_NONE )
{
LoadingScreen(nil, nil, "loadsc0");
TheText.Unload();
TheText.Load();
CFont::Initialise();
FrontEndMenuManager.DrawMemoryCardStartUpMenus();
}
#endif
if (TurnOnAnimViewer)
{
#ifndef MASTER
CAnimViewer::Initialise();
#ifndef PS2_MENU
FrontEndMenuManager.m_bGameNotLoaded = false;
#endif
gGameState = GS_ANIMVIEWER;
TurnOnAnimViewer = false;
#endif
}
initkeymap();
@ -1452,7 +1549,18 @@ main(int argc, char *argv[])
* 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)))
#endif
{
glfwPollEvents();
if( ForegroundApp )
@ -1461,7 +1569,11 @@ main(int argc, char *argv[])
{
case GS_START_UP:
{
#ifdef NO_MOVIES
gGameState = GS_INIT_ONCE;
#else
gGameState = GS_INIT_LOGO_MPEG;
#endif
TRACE("gGameState = GS_INIT_ONCE");
break;
}
@ -1470,13 +1582,27 @@ main(int argc, char *argv[])
{
//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");
#endif
if ( !CGame::InitialiseOnceAfterRW() )
RsGlobal.quit = TRUE;
#ifdef PS2_MENU
gGameState = GS_INIT_PLAYING_GAME;
#else
gGameState = GS_INIT_FRONTEND;
TRACE("gGameState = GS_INIT_FRONTEND;");
#endif
break;
}
@ -1500,18 +1626,27 @@ main(int argc, char *argv[])
break;
}
#ifndef PS2_MENU
case GS_FRONTEND:
{
if(!glfwGetWindowAttrib(PSGLOBAL(window), GLFW_ICONIFIED))
RsEventHandler(rsFRONTENDIDLE, nil);
#ifdef PS2_MENU
if ( !FrontEndMenuManager.m_bMenuActive || TheMemoryCard.m_bWantToLoad )
#else
if ( !FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bWantToLoad )
#endif
{
gGameState = GS_INIT_PLAYING_GAME;
TRACE("gGameState = GS_INIT_PLAYING_GAME;");
}
#ifdef PS2_MENU
if (TheMemoryCard.m_bWantToLoad )
#else
if ( FrontEndMenuManager.m_bWantToLoad )
#endif
{
InitialiseGame();
FrontEndMenuManager.m_bGameNotLoaded = false;
@ -1520,11 +1655,37 @@ main(int argc, char *argv[])
}
break;
}
#endif
case GS_INIT_PLAYING_GAME:
{
#ifdef PS2_MENU
CGame::Initialise("DATA\\GTA3.DAT");
//LoadingScreen("Starting Game", NULL, GetRandomSplashScreen());
if ( TheMemoryCard.CheckCardInserted(CARD_ONE) == CMemoryCard::NO_ERR_SUCCESS
&& TheMemoryCard.ChangeDirectory(CARD_ONE, TheMemoryCard.Cards[CARD_ONE].dir)
&& TheMemoryCard.FindMostRecentFileName(CARD_ONE, TheMemoryCard.MostRecentFile) == true
&& TheMemoryCard.CheckDataNotCorrupt(TheMemoryCard.MostRecentFile))
{
strcpy(TheMemoryCard.LoadFileName, TheMemoryCard.MostRecentFile);
TheMemoryCard.b_FoundRecentSavedGameWantToLoad = true;
if (CMenuManager::m_PrefsLanguage != TheMemoryCard.GetLanguageToLoad())
{
CMenuManager::m_PrefsLanguage = TheMemoryCard.GetLanguageToLoad();
TheText.Unload();
TheText.Load();
}
CGame::currLevel = (eLevelName)TheMemoryCard.GetLevelToLoad();
}
#else
InitialiseGame();
FrontEndMenuManager.m_bGameNotLoaded = false;
#endif
gGameState = GS_PLAYING_GAME;
TRACE("gGameState = GS_PLAYING_GAME;");
break;
@ -1573,16 +1734,46 @@ main(int argc, char *argv[])
RwInitialised = FALSE;
FrontEndMenuManager.UnloadTextures();
#ifdef PS2_MENU
if ( !(FrontEndMenuManager.m_bWantToRestart || TheMemoryCard.b_FoundRecentSavedGameWantToLoad))
break;
#else
if ( !FrontEndMenuManager.m_bWantToRestart )
break;
#endif
CPad::ResetCheats();
CPad::StopPadsShaking();
DMAudio.ChangeMusicMode(MUSICMODE_DISABLE);
#ifdef PS2_MENU
CGame::ShutDownForRestart();
#endif
CTimer::Stop();
#ifdef PS2_MENU
if (FrontEndMenuManager.m_bWantToRestart || TheMemoryCard.b_FoundRecentSavedGameWantToLoad)
{
if (TheMemoryCard.b_FoundRecentSavedGameWantToLoad)
{
FrontEndMenuManager.m_bWantToRestart = true;
TheMemoryCard.m_bWantToLoad = true;
}
CGame::InitialiseWhenRestarting();
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
FrontEndMenuManager.m_bWantToRestart = false;
continue;
}
CGame::ShutDown();
CTimer::Stop();
break;
#else
if ( FrontEndMenuManager.m_bWantToLoad )
{
CGame::ShutDownForRestart();
@ -1614,6 +1805,7 @@ main(int argc, char *argv[])
FrontEndMenuManager.m_bFirstTime = false;
FrontEndMenuManager.m_bWantToRestart = false;
#endif
}

View file

@ -87,8 +87,10 @@ static psGlobalType PsGlobal;
#include "Frontend.h"
#include "Game.h"
#include "PCSave.h"
#include "MemoryCard.h"
#include "Sprite2d.h"
#include "AnimViewer.h"
#include "Font.h"
VALIDATE_SIZE(psGlobalType, 0x28);
@ -598,12 +600,49 @@ psInitialize(void)
PsGlobal.joy2 = nil;
CFileMgr::Initialise();
#ifdef PS2_MENU
CPad::Initialise();
CPad::GetPad(0)->Mode = 0;
CGame::frenchGame = false;
CGame::germanGame = false;
CGame::nastyGame = true;
CMenuManager::m_PrefsAllowNastyGame = true;
WORD lang = PRIMARYLANGID(GetSystemDefaultLCID());
if ( lang == LANG_ITALIAN )
CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_ITALIAN;
else if ( lang == LANG_SPANISH )
CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_SPANISH;
else if ( lang == LANG_GERMAN )
{
CGame::germanGame = true;
CGame::nastyGame = false;
CMenuManager::m_PrefsAllowNastyGame = false;
CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_GERMAN;
}
else if ( lang == LANG_FRENCH )
{
CGame::frenchGame = true;
CGame::nastyGame = false;
CMenuManager::m_PrefsAllowNastyGame = false;
CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_FRENCH;
}
else
CMenuManager::m_PrefsLanguage = CMenuManager::LANGUAGE_AMERICAN;
FrontEndMenuManager.InitialiseMenuContentsAfterLoadingGame();
TheMemoryCard.Init();
#else
C_PcSave::SetSaveDirectory(_psGetUserFilesFolder());
InitialiseLanguage();
#ifndef GTA3_1_1_PATCH
FrontEndMenuManager.LoadSettings();
#endif
#endif
gGameState = GS_START_UP;
@ -650,8 +689,12 @@ psInitialize(void)
}
}
#ifndef PS2_MENU
#ifdef GTA3_1_1_PATCH
FrontEndMenuManager.LoadSettings();
#endif
#endif
dwDXVersion = GetDXVersion();
@ -1447,7 +1490,9 @@ psSelectDevice()
FrontEndMenuManager.m_nPrefsDepth = vm.depth;
#endif
#ifndef PS2_MENU
FrontEndMenuManager.m_nCurrOption = 0;
#endif
/* Set up the video mode and set the apps window
* dimensions to match */
@ -1725,27 +1770,27 @@ void InitialiseLanguage()
{
case LANG_GERMAN:
{
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_GERMAN;
FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_GERMAN;
break;
}
case LANG_SPANISH:
{
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_SPANISH;
FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_SPANISH;
break;
}
case LANG_FRENCH:
{
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_FRENCH;
FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_FRENCH;
break;
}
case LANG_ITALIAN:
{
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_ITALIAN;
FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_ITALIAN;
break;
}
default:
{
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_AMERICAN;
FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_AMERICAN;
break;
}
}
@ -2041,24 +2086,35 @@ WinMain(HINSTANCE instance,
SetErrorMode(SEM_FAILCRITICALERRORS);
if (!TurnOnAnimViewer) {
#ifdef NO_MOVIES
gGameState = GS_INIT_FRONTEND;
TRACE("gGameState = GS_INIT_FRONTEND");
#ifdef PS2_MENU
int32 r = TheMemoryCard.CheckCardStateAtGameStartUp(CARD_ONE);
if ( r == CMemoryCard::ERR_DIRNOENTRY || r == CMemoryCard::ERR_NOFORMAT
&& r != CMemoryCard::ERR_OPENNOENTRY && r != CMemoryCard::ERR_NONE )
{
LoadingScreen(nil, nil, "loadsc0");
if (!CGame::InitialiseOnceAfterRW())
RsGlobal.quit = TRUE;
TheText.Unload();
TheText.Load();
CFont::Initialise();
FrontEndMenuManager.DrawMemoryCardStartUpMenus();
}
#endif
} else {
if (TurnOnAnimViewer)
{
#ifndef MASTER
CAnimViewer::Initialise();
#ifndef PS2_MENU
FrontEndMenuManager.m_bGameNotLoaded = false;
#endif
gGameState = GS_ANIMVIEWER;
TurnOnAnimViewer = false;
#endif
}
while ( TRUE )
{
RwInitialised = TRUE;
@ -2077,8 +2133,18 @@ WinMain(HINSTANCE instance,
/*
* Enter the message processing loop...
*/
#ifdef PS2_MENU
if (TheMemoryCard.m_bWantToLoad)
LoadSplash(GetLevelSplashScreen(CGame::currLevel));
TheMemoryCard.m_bWantToLoad = false;
CTimer::Update();
while( !RsGlobal.quit && !(FrontEndMenuManager.m_bWantToRestart || TheMemoryCard.b_FoundRecentSavedGameWantToLoad) )
#else
while( !RsGlobal.quit && !FrontEndMenuManager.m_bWantToRestart )
#endif
{
if( PeekMessage(&message, nil, 0U, 0U, PM_REMOVE|PM_NOYIELD) )
{
@ -2098,7 +2164,11 @@ WinMain(HINSTANCE instance,
{
case GS_START_UP:
{
#ifdef NO_MOVIES
gGameState = GS_INIT_ONCE;
#else
gGameState = GS_INIT_LOGO_MPEG;
#endif
TRACE("gGameState = GS_INIT_LOGO_MPEG");
break;
}
@ -2173,16 +2243,30 @@ WinMain(HINSTANCE instance,
CloseClip();
CoUninitialize();
LoadingScreen(nil, nil, "loadsc0");
#ifdef PS2_MENU
extern char version_name[64];
if ( CGame::frenchGame || CGame::germanGame )
LoadingScreen(NULL, version_name, "loadsc24");
else
LoadingScreen(NULL, version_name, "loadsc0");
printf("Into TheGame!!!\n");
#else
LoadingScreen(nil, nil, "loadsc0");
#endif
if ( !CGame::InitialiseOnceAfterRW() )
RsGlobal.quit = TRUE;
#ifdef PS2_MENU
gGameState = GS_INIT_PLAYING_GAME;
#else
gGameState = GS_INIT_FRONTEND;
TRACE("gGameState = GS_INIT_FRONTEND;");
#endif
break;
}
#ifndef PS2_MENU
case GS_INIT_FRONTEND:
{
LoadingScreen(nil, nil, "loadsc0");
@ -2210,13 +2294,21 @@ WinMain(HINSTANCE instance,
if (wp.showCmd != SW_SHOWMINIMIZED)
RsEventHandler(rsFRONTENDIDLE, nil);
#ifdef PS2_MENU
if ( !FrontEndMenuManager.m_bMenuActive || TheMemoryCard.m_bWantToLoad )
#else
if ( !FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bWantToLoad )
#endif
{
gGameState = GS_INIT_PLAYING_GAME;
TRACE("gGameState = GS_INIT_PLAYING_GAME;");
}
#ifdef PS2_MENU
if (TheMemoryCard.m_bWantToLoad )
#else
if ( FrontEndMenuManager.m_bWantToLoad )
#endif
{
InitialiseGame();
FrontEndMenuManager.m_bGameNotLoaded = false;
@ -2225,11 +2317,37 @@ WinMain(HINSTANCE instance,
}
break;
}
#endif
case GS_INIT_PLAYING_GAME:
{
#ifdef PS2_MENU
CGame::Initialise("DATA\\GTA3.DAT");
//LoadingScreen("Starting Game", NULL, GetRandomSplashScreen());
if ( TheMemoryCard.CheckCardInserted(CARD_ONE) == CMemoryCard::NO_ERR_SUCCESS
&& TheMemoryCard.ChangeDirectory(CARD_ONE, TheMemoryCard.Cards[CARD_ONE].dir)
&& TheMemoryCard.FindMostRecentFileName(CARD_ONE, TheMemoryCard.MostRecentFile) == true
&& TheMemoryCard.CheckDataNotCorrupt(TheMemoryCard.MostRecentFile))
{
strcpy(TheMemoryCard.LoadFileName, TheMemoryCard.MostRecentFile);
TheMemoryCard.b_FoundRecentSavedGameWantToLoad = true;
if (CMenuManager::m_PrefsLanguage != TheMemoryCard.GetLanguageToLoad())
{
CMenuManager::m_PrefsLanguage = TheMemoryCard.GetLanguageToLoad();
TheText.Unload();
TheText.Load();
}
CGame::currLevel = (eLevelName)TheMemoryCard.GetLevelToLoad();
}
#else
InitialiseGame();
FrontEndMenuManager.m_bGameNotLoaded = false;
#endif
gGameState = GS_PLAYING_GAME;
TRACE("gGameState = GS_PLAYING_GAME;");
break;
@ -2279,16 +2397,45 @@ WinMain(HINSTANCE instance,
RwInitialised = FALSE;
FrontEndMenuManager.UnloadTextures();
#ifdef PS2_MENU
if ( !(FrontEndMenuManager.m_bWantToRestart || TheMemoryCard.b_FoundRecentSavedGameWantToLoad))
break;
#else
if ( !FrontEndMenuManager.m_bWantToRestart )
break;
#endif
CPad::ResetCheats();
CPad::StopPadsShaking();
DMAudio.ChangeMusicMode(MUSICMODE_DISABLE);
#ifdef PS2_MENU
CGame::ShutDownForRestart();
#endif
CTimer::Stop();
#ifdef PS2_MENU
if (FrontEndMenuManager.m_bWantToRestart || TheMemoryCard.b_FoundRecentSavedGameWantToLoad)
{
if (TheMemoryCard.b_FoundRecentSavedGameWantToLoad)
{
FrontEndMenuManager.m_bWantToRestart = true;
TheMemoryCard.m_bWantToLoad = true;
}
CGame::InitialiseWhenRestarting();
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
FrontEndMenuManager.m_bWantToRestart = false;
continue;
}
CGame::ShutDown();
CTimer::Stop();
break;
#else
if ( FrontEndMenuManager.m_bWantToLoad )
{
CGame::ShutDownForRestart();
@ -2320,6 +2467,7 @@ WinMain(HINSTANCE instance,
FrontEndMenuManager.m_bFirstTime = false;
FrontEndMenuManager.m_bWantToRestart = false;
#endif
}

View file

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

View file

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