Update Frontend.

This commit is contained in:
_AG 2019-07-03 17:26:15 +02:00
parent 936a8e8351
commit 69b5c9f1e0
24 changed files with 1444 additions and 194 deletions

View File

@ -50,3 +50,8 @@ void CControllerConfigManager::LoadSettings(int32 file)
}
}
}
WRAPPER void CControllerConfigManager::SaveSettings(int32 file)
{
EAXJMP(0x58B800);
}

View File

@ -42,6 +42,7 @@ public:
int32 GetJoyButtonJustDown();
void LoadSettings(int32 file);
void SaveSettings(int32 file);
void MakeControllerActionsBlank();
void InitDefaultControlConfiguration();
void InitDefaultControlConfigMouse(CMouseControllerState const &mousestate);

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,11 @@
#define MENUSELECT_BOX_MAX 20.5f
#define MENUSELECT_BOX_MIN 17.0f
#ifndef ASPECT_RATIO_SCALE
#define MENURADIO_ICON_X 31.5f
#else
#define MENURADIO_ICON_X -262.0f
#endif
#define MENURADIO_ICON_Y 29.5f
#define MENURADIO_ICON_W 60.0f
#define MENURADIO_ICON_H 60.0f
@ -39,6 +43,8 @@
#define MENUSLIDER_X 306.0f
#define buf(a) (char*)(a)
enum eLanguages
{
LANGUAGE_AMERICAN,
@ -314,6 +320,7 @@ enum eMenuColumns
enum eMenuRow
{
MENUROW_NONE = -1,
MENUROW_0,
MENUROW_1,
MENUROW_2,
@ -347,7 +354,8 @@ struct tSkinInfo
struct CMenuScreen
{
char m_ScreenName[8];
int32 m_PreviousPage[3]; // eMenuScreen
int32 unk;
int32 m_PreviousPage[2]; // eMenuScreen
int32 m_ParentEntry[2]; // eMenuRow
struct CMenuEntry
@ -417,7 +425,7 @@ public:
int m_nHoverOption;
int m_nCurrScreen;
int m_nCurrOption;
int m_nCurrentInput;
int m_nPrevOption;
int m_nPrevScreen;
int field_558;
int m_nCurrSaveSlot;
@ -431,7 +439,6 @@ public:
static int8 &m_PrefsVsync;
static int8 &m_PrefsVsyncDisp;
static int8 &m_PrefsFrameLimiter;
static int8 &BlurOn;
static int8 &m_PrefsShowSubtitles;
static int8 &m_PrefsSpeakers;
static int8 &m_ControlMethod;
@ -443,6 +450,8 @@ public:
static int8 &m_bFrontEnd_ReloadObrTxtGxt;
static int32 &m_PrefsMusicVolume;
static int32 &m_PrefsSfxVolume;
static uint8 *m_PrefsSkinFile;
static bool &m_bStartUpFrontEndRequested;
static bool &m_bShutDownFrontEndRequested;
static bool &m_PrefsAllowNastyGame;
@ -452,6 +461,7 @@ public:
static void CentreMousePointer();
void CheckCodesForControls(int, int);
bool CheckHover(int x1, int x2, int y1, int y2);
void CheckSliderMovement(int);
int CostructStatLine(int);
void DisplayHelperText();
float DisplaySlider(float, float, float, float, float, float);
@ -485,10 +495,16 @@ public:
void SetHelperText(int text);
void ShutdownJustMenu();
static float StretchX(float);
static float StretchY(float );
static float StretchY(float);
void SwitchMenuOnAndOff();
void UnloadTextures();
void WaitForUserCD();
// New content:
uint8 GetNumberOfMenuOptions();
void SwitchToNewScreen(int8 screen);
void SetDefaultPreferences(int8 screen);
};
static_assert(sizeof(CMenuManager) == 0x564, "CMenuManager: error");

View File

@ -12,7 +12,7 @@ const CMenuScreen aScreens[] = {
// MENUPAGE_NEW_GAME = 2
{ "FET_SGA", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, MENUROW_0, MENUROW_1,
MENUACTION_CHANGEMENU, "FES_SNG", SAVESLOT_NONE, MENUPAGE_NEW_GAME_RELOAD,
MENUACTION_UPDATESAVE, "GMLOAD", SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT,
MENUACTION_CHANGEMENU, "GMLOAD", SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT,
MENUACTION_CHANGEMENU, "FES_DGA", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
@ -43,7 +43,7 @@ const CMenuScreen aScreens[] = {
{ "FET_DIS", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUROW_2, MENUROW_2,
MENUACTION_BRIGHTNESS, "FED_BRI", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_DRAWDIST, "FEM_LOD", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_FRAMESYNC, "FEM_VSC", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
//MENUACTION_FRAMESYNC, "FEM_VSC", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_FRAMELIMIT, "FEM_FRM", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_TRAILS, "FED_TRA", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_SUBTITLES, "FED_SUB", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
@ -55,11 +55,11 @@ const CMenuScreen aScreens[] = {
// MENUPAGE_LANGUAGE_SETTINGS = 7
{ "FET_LAN", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUROW_3, MENUROW_3,
MENUACTION_LANG_ENG, "FEL_ENG", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
MENUACTION_LANG_FRE, "FEL_FRE", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
MENUACTION_LANG_GER, "FEL_GER", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
MENUACTION_LANG_ITA, "FEL_ITA", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
MENUACTION_LANG_SPA, "FEL_SPA", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
MENUACTION_LANG_ENG, "FEL_ENG", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_LANG_FRE, "FEL_FRE", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_LANG_GER, "FEL_GER", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_LANG_ITA, "FEL_ITA", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_LANG_SPA, "FEL_SPA", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
@ -79,21 +79,21 @@ const CMenuScreen aScreens[] = {
// MENUPAGE_CHOOSE_DELETE_SLOT = 9
{ "FET_DG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUROW_2, MENUROW_2,
MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
MENUACTION_CHANGEMENU, "FEM_SL1", SAVESLOT_1, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHANGEMENU, "FEM_SL2", SAVESLOT_2, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHANGEMENU, "FEM_SL3", SAVESLOT_3, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHANGEMENU, "FEM_SL4", SAVESLOT_4, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHANGEMENU, "FEM_SL5", SAVESLOT_5, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHANGEMENU, "FEM_SL6", SAVESLOT_6, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHANGEMENU, "FEM_SL7", SAVESLOT_7, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHANGEMENU, "FEM_SL8", SAVESLOT_8, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL1", SAVESLOT_1, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL2", SAVESLOT_2, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL3", SAVESLOT_3, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL4", SAVESLOT_4, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL5", SAVESLOT_5, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL6", SAVESLOT_6, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL7", SAVESLOT_7, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL8", SAVESLOT_8, MENUPAGE_DELETE_SLOT_CONFIRM,
},
// MENUPAGE_NEW_GAME_RELOAD = 10
{ "FET_NG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUROW_0, MENUROW_0,
MENUACTION_LABEL, "FESZ_QR", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
MENUACTION_NEWGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NEW_GAME_RELOAD,
MENUACTION_NEWGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_LOAD_SLOT_CONFIRM = 11
@ -181,14 +181,14 @@ const CMenuScreen aScreens[] = {
// MENUPAGE_CHOOSE_SAVE_SLOT = 26
{ "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
MENUACTION_UPDATEMEMCARDSAVE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_SL1", SAVESLOT_1, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_CHANGEMENU, "FEM_SL2", SAVESLOT_2, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_CHANGEMENU, "FEM_SL3", SAVESLOT_3, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_CHANGEMENU, "FEM_SL4", SAVESLOT_4, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_CHANGEMENU, "FEM_SL5", SAVESLOT_5, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_CHANGEMENU, "FEM_SL6", SAVESLOT_6, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_CHANGEMENU, "FEM_SL7", SAVESLOT_7, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_CHANGEMENU, "FEM_SL8", SAVESLOT_8, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_UPDATESAVE, "FEM_SL1", SAVESLOT_1, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_UPDATESAVE, "FEM_SL2", SAVESLOT_2, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_UPDATESAVE, "FEM_SL3", SAVESLOT_3, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_UPDATESAVE, "FEM_SL4", SAVESLOT_4, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_UPDATESAVE, "FEM_SL5", SAVESLOT_5, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_UPDATESAVE, "FEM_SL6", SAVESLOT_6, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_UPDATESAVE, "FEM_SL7", SAVESLOT_7, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
MENUACTION_UPDATESAVE, "FEM_SL8", SAVESLOT_8, MENUPAGE_SAVE_OVERWRITE_CONFIRM,
},
// MENUPAGE_SAVE_OVERWRITE_CONFIRM = 27
@ -236,7 +236,7 @@ const CMenuScreen aScreens[] = {
// MENUPAGE_CONTROLLER_PC = 35
{ "FET_CTL", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUROW_0, MENUROW_0,
MENUACTION_CTRLMETHOD, "FET_CME", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
MENUACTION_REDEFCTRL, "FET_RDK", SAVESLOT_NONE, MENUPAGE_KEYBOARD_CONTROLS,
MENUACTION_CHANGEMENU, "FET_RDK", SAVESLOT_NONE, MENUPAGE_KEYBOARD_CONTROLS,
MENUACTION_CHANGEMENU, "FET_AMS", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
@ -270,17 +270,17 @@ const CMenuScreen aScreens[] = {
// MENUPAGE_OPTIONS = 41
{ "FET_OPT", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, MENUROW_1, MENUROW_4,
MENUACTION_CHANGEMENU, "FET_CTL", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
MENUACTION_LOADRADIO, "FET_AUD", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_CHANGEMENU, "FET_AUD", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_CHANGEMENU, "FET_DIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_CHANGEMENU, "FET_LAN", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
MENUACTION_PLAYERSETUP, "FET_PSU", SAVESLOT_NONE, MENUPAGE_SKIN_SELECT,
//MENUACTION_CHANGEMENU, "FET_PSU", SAVESLOT_NONE, MENUPAGE_SKIN_SELECT,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_EXIT = 42
{ "FET_QG", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, MENUROW_2, MENUROW_5,
MENUACTION_LABEL, "FEQ_SRE", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_DONTCANCLE, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CANCLEGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NONE,
},
@ -352,19 +352,19 @@ const CMenuScreen aScreens[] = {
// MENUPAGE_SKIN_SELECT = 54
{ "FET_PSU", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUROW_4, MENUROW_4,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_MULTIPLAYER_MAIN,
//MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_MULTIPLAYER_MAIN,
},
// MENUPAGE_KEYBOARD_CONTROLS = 55
{ "FET_STI", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUROW_1, MENUROW_1,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
//MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
},
// MENUPAGE_MOUSE_CONTROLS = 56
{ "FET_MTI", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUROW_2, MENUROW_2,
MENUACTION_MOUSESENS, "FEC_MSH", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
MENUACTION_INVVERT, "FEC_IVV", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
MENUACTION_MOUSESTEER, "FET_MST", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
MENUACTION_MOUSESENS, "FEC_MSH", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
MENUACTION_INVVERT, "FEC_IVV", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
MENUACTION_MOUSESTEER, "FET_MST", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},

View File

@ -4,9 +4,17 @@
#include "PCSave.h"
WRAPPER void C_PcSave::SetSaveDirectory(const char *path) { EAXJMP(0x591EA0); }
WRAPPER int8 C_PcSave::PopulateSlotInfo() { EAXJMP(0x592090); }
WRAPPER int8 C_PcSave::DeleteSlot(int) { EAXJMP(0x5922F0); }
WRAPPER int8 C_PcSave::SaveSlot(int) { EAXJMP(0x591EC0); }
WRAPPER int8 CheckSlotDataValid(int) { EAXJMP(0x591A40); }
WRAPPER wchar *GetNameOfSavedGame(int counter) { EAXJMP(0x591B60); }
WRAPPER wchar *GetSavedGameDateAndTime(int counter) { EAXJMP(0x591B50); }
C_PcSave PcSaveHelper = *(C_PcSave*)0x8E2C60;
int *Slots = (int*)0x728040;
int *SlotFileName = (int*)0x6F07C8;
int *SlotSaveDate = (int*)0x72B858;

View File

@ -3,12 +3,19 @@
class C_PcSave
{
public:
int32 m_nHelper;
static void SetSaveDirectory(const char *path);
int8 PopulateSlotInfo();
int8 DeleteSlot(int);
int8 SaveSlot(int);
};
extern int8 CheckSlotDataValid(int);
extern wchar *GetNameOfSavedGame(int counter);
extern wchar *GetSavedGameDateAndTime(int counter);
extern C_PcSave PcSaveHelper;
extern int *Slots;
extern int *SlotFileName;
extern int *SlotSaveDate;

View File

@ -17,8 +17,13 @@ WRAPPER bool cDMAudio::CheckForAnAudioFileOnCD() { EAXJMP(0x57CA70); }
WRAPPER void cDMAudio::ChangeMusicMode(uint8 mode) { EAXJMP(0x57CCF0); }
WRAPPER void cDMAudio::PlayFrontEndSound(uint32, uint32) { EAXJMP(0x57CC20); }
WRAPPER void cDMAudio::PlayOneShot(int, uint16, float) { EAXJMP(0x57C840); }
WRAPPER void cDMAudio::PlayFrontEndTrack(uint32, uint32) { EAXJMP(0x57CC80); }
WRAPPER void cDMAudio::StopFrontEndTrack() { EAXJMP(0x57CCB0); }
WRAPPER void cDMAudio::PlayOneShot(int32, uint16, float) { EAXJMP(0x57C840); }
WRAPPER void cDMAudio::SetMusicMasterVolume(int8) { EAXJMP(0x57C8C0); }
WRAPPER void cDMAudio::SetEffectsMasterVolume(int8) { EAXJMP(0x57C890); }
WRAPPER int8 cDMAudio::SetCurrent3DProvider(int8) { EAXJMP(0x57C9B0); }
WRAPPER int32 cDMAudio::SetSpeakerConfig(int32) { EAXJMP(0x57C9D0); }
WRAPPER int32 cDMAudio::GetRadioInCar() { EAXJMP(0x57CE40); }
WRAPPER uint8 cDMAudio::IsMP3RadioChannelAvailable() { EAXJMP(0x57C9F0); }

View File

@ -188,7 +188,13 @@ public:
bool CheckForAnAudioFileOnCD(void);
void ChangeMusicMode(uint8 mode);
void PlayFrontEndSound(uint32, uint32);
void PlayOneShot(int, uint16, float);
void PlayFrontEndTrack(uint32, uint32);
void StopFrontEndTrack();
void PlayOneShot(int32, uint16, float);
void SetMusicMasterVolume(int8);
void SetEffectsMasterVolume(int8);
int8 SetCurrent3DProvider(int8);
int32 SetSpeakerConfig(int32);
int32 GetRadioInCar(void);
void SetEffectsFadeVol(uint8);
void SetMusicFadeVol(uint8);

View File

@ -56,26 +56,12 @@ extern void **rwengine;
#include "skeleton.h"
#include "Draw.h"
/*
{ SCREEN_STRETCH } Done originally by the game for most of the printed stuff.
Stretches everything to screen avoiding it's aspect ratio.
Looks good only in 4:3.
{ SCREEN_SCALE } Alternative to the one above, it's used in this project to scale
original content to a *DEFINED aspect ratio with the possibility to
set a multiplier and scale content differently.
In theory should look good on any screen.
*/
#define DEFAULT_SCREEN_WIDTH (640)
#define DEFAULT_SCREEN_HEIGHT (448)
#define DEFAULT_ASPECT_RATIO (4.0f/3.0f)
// game uses maximumWidth/Height, but this probably won't work
// with RW windowed mode
// TODO: get rid of one of the two
#define SCREENW (RsGlobal.width)
#define SCREENH (RsGlobal.height)
#define SCREEN_WIDTH ((float)RsGlobal.width)
#define SCREEN_HEIGHT ((float)RsGlobal.height)
#define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio())

View File

@ -0,0 +1,5 @@
#include "common.h"
#include "patcher.h"
#include "PlayerSkin.h"
WRAPPER void CPlayerSkin::BeginFrontEndSkinEdit() { EAXJMP(0x59BC70); }

View File

@ -0,0 +1,7 @@
#pragma once
class CPlayerSkin
{
public:
static void BeginFrontEndSkinEdit();
};

View File

@ -12,6 +12,7 @@ bool &CVehicle::bAllDodosCheat = *(bool *)0x95CD75;
bool &CVehicle::bCheat3 = *(bool *)0x95CD66;
bool &CVehicle::bCheat4 = *(bool *)0x95CD65;
bool &CVehicle::bCheat5 = *(bool *)0x95CD64;
bool &CVehicle::m_bDisableMouseSteering = *(bool *)0x60252C;
void *CVehicle::operator new(size_t sz) { return CPools::GetVehiclePool()->New(); }
void *CVehicle::operator new(size_t sz, int handle) { return CPools::GetVehiclePool()->New(handle); }

View File

@ -135,6 +135,7 @@ public:
static bool &bCheat3;
static bool &bCheat4;
static bool &bCheat5;
static bool &m_bDisableMouseSteering;
};
static_assert(sizeof(CVehicle) == 0x288, "CVehicle: error");

View File

@ -124,8 +124,8 @@ Idle(void *arg)
#ifdef GTA_PC
// This is from SA, but it's nice for windowed mode
RwV2d pos;
pos.x = SCREENW/2.0f;
pos.y = SCREENH/2.0f;
pos.x = SCREEN_WIDTH/2.0f;
pos.y = SCREEN_HEIGHT/2.0f;
RsMouseSetPos(&pos);
#endif
CRenderer::ConstructRenderList();
@ -230,7 +230,7 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
CSprite2d::InitPerFrame();
if(Alpha != 0)
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREENW, SCREENH), BottomColor, BottomColor, TopColor, TopColor);
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), BottomColor, BottomColor, TopColor, TopColor);
return true;
}
@ -346,15 +346,15 @@ Render2dStuff(void)
// top and bottom strips
if (weaponType == WEAPONTYPE_ROCKETLAUNCHER) {
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREENW, SCREENH / 2 - SCREEN_SCALE_Y(180)), black);
CSprite2d::DrawRect(CRect(0.0f, SCREENH / 2 + SCREEN_SCALE_Y(170), SCREENW, SCREENH), black);
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(180)), black);
CSprite2d::DrawRect(CRect(0.0f, SCREEN_HEIGHT / 2 + SCREEN_SCALE_Y(170), SCREEN_WIDTH, SCREEN_HEIGHT), black);
}
else {
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREENW, SCREENH / 2 - SCREEN_SCALE_Y(210)), black);
CSprite2d::DrawRect(CRect(0.0f, SCREENH / 2 + SCREEN_SCALE_Y(210), SCREENW, SCREENH), black);
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT / 2 - SCREEN_SCALE_Y(210)), black);
CSprite2d::DrawRect(CRect(0.0f, SCREEN_HEIGHT / 2 + SCREEN_SCALE_Y(210), SCREEN_WIDTH, SCREEN_HEIGHT), black);
}
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREENW / 2 - SCREEN_SCALE_X(210), SCREENH), black);
CSprite2d::DrawRect(CRect(SCREENW / 2 + SCREEN_SCALE_X(210), 0.0f, SCREENW, SCREENH), black);
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH / 2 - SCREEN_SCALE_X(210), SCREEN_HEIGHT), black);
CSprite2d::DrawRect(CRect(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(210), 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), black);
}
MusicManager.DisplayRadioStationName();
@ -444,16 +444,16 @@ DoFade(void)
if(TheCamera.m_WideScreenOn){
// what's this?
float y = SCREENH/2 * TheCamera.m_ScreenReductionPercentage/100.0f;
float y = SCREEN_HEIGHT/2 * TheCamera.m_ScreenReductionPercentage/100.0f;
rect.left = 0.0f;
rect.right = SCREENW;
rect.right = SCREEN_WIDTH;
rect.top = y - 8.0f;
rect.bottom = SCREENH - y - 8.0f;
rect.bottom = SCREEN_HEIGHT - y - 8.0f;
}else{
rect.left = 0.0f;
rect.right = SCREENW;
rect.right = SCREEN_WIDTH;
rect.top = 0.0f;
rect.bottom = SCREENH;
rect.bottom = SCREEN_HEIGHT;
}
CSprite2d::DrawRect(rect, fadeColor);
@ -462,7 +462,7 @@ DoFade(void)
fadeColor.g = 255;
fadeColor.b = 255;
fadeColor.a = CDraw::FadeValue;
splash->Draw(CRect(0.0f, 0.0f, SCREENW, SCREENH), fadeColor, fadeColor, fadeColor, fadeColor);
splash->Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), fadeColor, fadeColor, fadeColor, fadeColor);
}
}
}
@ -549,14 +549,14 @@ LoadingScreen(const char *str1, const char *str2, const char *splashscreen)
CFont::InitPerFrame();
DefinedState();
RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSCLAMP);
splash->Draw(CRect(0.0f, 0.0f, SCREENW, SCREENH), CRGBA(255, 255, 255, 255));
splash->Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), CRGBA(255, 255, 255, 255));
if(str1){
NumberOfChunksLoaded += 1;
float hpos = SCREEN_SCALE_X(40);
float length = SCREENW - SCREEN_SCALE_X(100);
float vpos = SCREENH - SCREEN_SCALE_Y(13);
float length = SCREEN_WIDTH - SCREEN_SCALE_X(100);
float vpos = SCREEN_HEIGHT - SCREEN_SCALE_Y(13);
float height = SCREEN_SCALE_Y(7);
CSprite2d::DrawRect(CRect(hpos, vpos, hpos + length, vpos + height), CRGBA(40, 53, 68, 255));
@ -617,7 +617,7 @@ LoadingIslandScreen(const char *levelName)
CFont::InitPerFrame();
DefinedState();
col = CRGBA(255, 255, 255, 255);
splash->Draw(CRect(0.0f, 0.0f, SCREENW, SCREENH), col, col, col, col);
splash->Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), col, col, col, col);
CFont::SetBackgroundOff();
CFont::SetScale(1.5f, 1.5f);
CFont::SetPropOn();
@ -630,12 +630,12 @@ LoadingIslandScreen(const char *levelName)
CFont::SetDropShadowPosition(3);
CFont::SetColor(CRGBA(243, 237, 71, 255));
CFont::SetScale(SCREEN_STRETCH_X(1.2f), SCREEN_STRETCH_Y(1.2f));
CFont::PrintString(SCREENW - 20, SCREEN_STRETCH_FROM_BOTTOM(110.0f), TheText.Get("WELCOME"));
CFont::PrintString(SCREEN_WIDTH - 20, SCREEN_STRETCH_FROM_BOTTOM(110.0f), TheText.Get("WELCOME"));
TextCopy(wstr, name);
TheText.UpperCase(wstr);
CFont::SetColor(CRGBA(243, 237, 71, 255));
CFont::SetScale(SCREEN_STRETCH_X(1.2f), SCREEN_STRETCH_Y(1.2f));
CFont::PrintString(SCREENW-20, SCREEN_STRETCH_FROM_BOTTOM(80.0f), wstr);
CFont::PrintString(SCREEN_WIDTH-20, SCREEN_STRETCH_FROM_BOTTOM(80.0f), wstr);
CFont::DrawFonts();
DoRWStuffEndOfFrame();
}

View File

@ -10,6 +10,7 @@ extern GlobalScene &Scene;
extern uint8 work_buff[55000];
extern char gString[256];
extern wchar *gUString;
extern bool &b_FoundRecentSavedGameWantToLoad;
class CSprite2d;

View File

@ -208,15 +208,15 @@ CClouds::Render(void)
int br = CTimeCycle::GetFluffyCloudsBottomRed();
int bg = CTimeCycle::GetFluffyCloudsBottomGreen();
int bb = CTimeCycle::GetFluffyCloudsBottomBlue();
if(sundist < SCREENW/2){
hilight = (1.0f - coverage) * (1.0f - sundist/(SCREENW/2));
if(sundist < SCREEN_WIDTH/2){
hilight = (1.0f - coverage) * (1.0f - sundist/(SCREEN_WIDTH/2));
tr = tr*(1.0f-hilight) + 255*hilight;
tg = tg*(1.0f-hilight) + 190*hilight;
tb = tb*(1.0f-hilight) + 190*hilight;
br = br*(1.0f-hilight) + 255*hilight;
bg = bg*(1.0f-hilight) + 190*hilight;
bb = bb*(1.0f-hilight) + 190*hilight;
if(sundist < SCREENW/10)
if(sundist < SCREEN_WIDTH/10)
CCoronas::SunBlockedByClouds = true;
}else
hilight = 0.0f;
@ -317,16 +317,16 @@ CClouds::RenderBackground(int16 topred, int16 topgreen, int16 topblue,
}
}
ms_colourBottom = ms_colourTop;
CRect r(0, 0, SCREENW, SCREENH);
CRect r(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
CSprite2d::DrawRect(r, ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop);
}else{
ms_horizonZ = CSprite::CalcHorizonCoors();
// Draw top/bottom gradient
float gradheight = SCREENH/2.0f;
float gradheight = SCREEN_HEIGHT/2.0f;
float topedge = ms_horizonZ - gradheight;
float botpos, toppos;
if(ms_horizonZ > 0.0f && topedge < SCREENH){
if(ms_horizonZ > 0.0f && topedge < SCREEN_HEIGHT){
ms_colourTop.r = topred;
ms_colourTop.g = topgreen;
ms_colourTop.b = topblue;
@ -336,14 +336,14 @@ CClouds::RenderBackground(int16 topred, int16 topgreen, int16 topblue,
ms_colourBottom.b = botblue;
ms_colourBottom.a = alpha;
if(ms_horizonZ < SCREENH)
if(ms_horizonZ < SCREEN_HEIGHT)
botpos = ms_horizonZ;
else{
float f = (ms_horizonZ - SCREENH)/gradheight;
float f = (ms_horizonZ - SCREEN_HEIGHT)/gradheight;
ms_colourBottom.r = topred*f + (1.0f-f)*botred;
ms_colourBottom.g = topgreen*f + (1.0f-f)*botgreen;
ms_colourBottom.b = topblue*f + (1.0f-f)*botblue;
botpos = SCREENH;
botpos = SCREEN_HEIGHT;
}
if(topedge >= 0.0f)
toppos = topedge;
@ -354,17 +354,17 @@ CClouds::RenderBackground(int16 topred, int16 topgreen, int16 topblue,
ms_colourTop.b = botblue*f + (1.0f-f)*topblue;
toppos = 0.0f;
}
CSprite2d::DrawRect(CRect(0, toppos, SCREENW, botpos),
CSprite2d::DrawRect(CRect(0, toppos, SCREEN_WIDTH, botpos),
ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop);
}
// draw the small stripe (whatever it's supposed to be)
if(ms_horizonZ > -SMALLSTRIPHEIGHT && ms_horizonZ < SCREENH){
if(ms_horizonZ > -SMALLSTRIPHEIGHT && ms_horizonZ < SCREEN_HEIGHT){
// Same colour as fog
ms_colourTop.r = (topred + 2 * botred) / 3;
ms_colourTop.g = (topgreen + 2 * botgreen) / 3;
ms_colourTop.b = (topblue + 2 * botblue) / 3;
CSprite2d::DrawRect(CRect(0, ms_horizonZ, SCREENW, ms_horizonZ+SMALLSTRIPHEIGHT),
CSprite2d::DrawRect(CRect(0, ms_horizonZ, SCREEN_WIDTH, ms_horizonZ+SMALLSTRIPHEIGHT),
ms_colourTop, ms_colourTop, ms_colourTop, ms_colourTop);
}
@ -379,8 +379,8 @@ CClouds::RenderBackground(int16 topred, int16 topgreen, int16 topblue,
ms_colourBottom.b = topblue;
ms_colourBottom.a = alpha;
botpos = min(SCREENH, topedge);
CSprite2d::DrawRect(CRect(0, 0, SCREENW, botpos),
botpos = min(SCREEN_HEIGHT, topedge);
CSprite2d::DrawRect(CRect(0, 0, SCREEN_WIDTH, botpos),
ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop);
}
@ -403,22 +403,22 @@ CClouds::RenderHorizon(void)
ms_colourBottom.a = 230;
ms_colourTop.a = 80;
if(ms_horizonZ > SCREENH)
if(ms_horizonZ > SCREEN_HEIGHT)
return;
float z1 = min(ms_horizonZ + SMALLSTRIPHEIGHT, SCREENH);
CSprite2d::DrawRectXLU(CRect(0, ms_horizonZ, SCREENW, z1),
float z1 = min(ms_horizonZ + SMALLSTRIPHEIGHT, SCREEN_HEIGHT);
CSprite2d::DrawRectXLU(CRect(0, ms_horizonZ, SCREEN_WIDTH, z1),
ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop);
// This is just weird
float a = SCREENH/400.0f * HORIZSTRIPHEIGHT +
SCREENH/300.0f * max(TheCamera.GetPosition().z, 0.0f);
float a = SCREEN_HEIGHT/400.0f * HORIZSTRIPHEIGHT +
SCREEN_HEIGHT/300.0f * max(TheCamera.GetPosition().z, 0.0f);
float b = TheCamera.GetUp().z < 0.0f ?
SCREENH :
SCREENH * fabs(TheCamera.GetRight().z);
SCREEN_HEIGHT :
SCREEN_HEIGHT * fabs(TheCamera.GetRight().z);
float z2 = z1 + (a + b)*TheCamera.LODDistMultiplier;
z2 = min(z2, SCREENH);
CSprite2d::DrawRect(CRect(0, z1, SCREENW, z2),
z2 = min(z2, SCREEN_HEIGHT);
CSprite2d::DrawRect(CRect(0, z1, SCREEN_WIDTH, z2),
ms_colourBottom, ms_colourBottom, ms_colourTop, ms_colourTop);
}

View File

@ -39,11 +39,11 @@ CCredits::PrintCreditSpace(float space, uint32 &line)
void
CCredits::PrintCreditText(float scaleX, float scaleY, wchar *text, uint32 &lineoffset, float scrolloffset)
{
float start = SCREENH + 50.0f;
float start = SCREEN_HEIGHT + 50.0f;
float y = lineoffset + start - scrolloffset;
if(y > -50.0f && y < start){
CFont::SetScale(scaleX, scaleY);
CFont::PrintString(SCREENW/2.0f, y, (uint16*)text);
CFont::PrintString(SCREEN_WIDTH/2.0f, y, (uint16*)text);
}
lineoffset += scaleY*25.0f;
}
@ -62,7 +62,7 @@ CCredits::Render(void)
scrolloffset = (CTimer::GetTimeInMilliseconds() - CreditsStartTime) / 24.0f;
CFont::SetJustifyOff();
CFont::SetBackgroundOff();
CFont::SetCentreSize(SCREENW - 20);
CFont::SetCentreSize(SCREEN_WIDTH - 20);
CFont::SetCentreOn();
CFont::SetPropOn();
CFont::SetColor(CRGBA(220, 220, 220, 220));
@ -489,7 +489,7 @@ CCredits::Render(void)
if(TheCamera.m_WideScreenOn)
TheCamera.DrawBordersForWideScreen();
if(lineoffset + SCREENH - scrolloffset < -10.0f)
if(lineoffset + SCREEN_HEIGHT - scrolloffset < -10.0f)
bCreditsGoing = false;
}

View File

@ -20,12 +20,24 @@ uint8 &CDraw::FadeBlue = *(uint8*)0x95CD53;
float
CDraw::FindAspectRatio(void)
{
#ifndef ASPECT_RATIO_SCALE
if(FrontEndMenuManager.m_PrefsUseWideScreen)
return 16.0f/9.0f;
else
return 4.0f/3.0f;
#else
switch (FrontEndMenuManager.m_PrefsUseWideScreen) {
case AR_AUTO:
return SCREEN_WIDTH / SCREEN_HEIGHT;
case AR_4_3:
return 4.0f / 3.0f;
case AR_16_9:
return 16.0f / 9.0f;
};
#endif
}
#ifdef ASPECT_RATIO_SCALE
// convert a 4:3 hFOV to vFOV,
// then convert that vFOV to hFOV for our aspect ratio,
// i.e. HOR+
@ -41,6 +53,7 @@ CDraw::ConvertFOV(float hfov)
hfov = atan(tan(vfov/2) * ar2) *2;
return RADTODEG(hfov);
}
#endif
void
CDraw::SetFOV(float fov)

View File

@ -1,5 +1,12 @@
#pragma once
enum eAspectRatio
{
AR_AUTO,
AR_4_3,
AR_16_9,
};
class CDraw
{
private:

View File

@ -83,7 +83,7 @@ CFont::Initialise(void)
Sprite[1].SetTexture("pager", "pager_mask");
Sprite[2].SetTexture("font1", "font1_mask");
SetScale(1.0f, 1.0f);
SetSlantRefPoint(SCREENW, 0.0f);
SetSlantRefPoint(SCREEN_WIDTH, 0.0f);
SetSlant(0.0);
SetColor(CRGBA(0xFF, 0xFF, 0xFF, 0));
SetJustifyOff();
@ -123,8 +123,8 @@ CFont::InitPerFrame(void)
void
CFont::PrintChar(float x, float y, uint16 c)
{
if(x <= 0.0f || x >= SCREENW ||
y <= 0.0f || y >= SCREENH) // BUG: game uses SCREENW again
if(x <= 0.0f || x >= SCREEN_WIDTH ||
y <= 0.0f || y >= SCREEN_HEIGHT) // BUG: game uses SCREENW again
return;
float w = GetCharacterWidth(c) / 32.0f;

View File

@ -125,6 +125,15 @@ WRAPPER void CHud::Draw(void) { EAXJMP(0x5052A0); }
#else
void CHud::Draw()
{
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSMIRROR);
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT);
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
if (CReplay::IsPlayingBack())
return;
@ -167,18 +176,15 @@ void CHud::Draw()
float fStep = sin((CTimer::GetTimeInMilliseconds() & 1023) * 0.0061328127);
float fMultBright = SpriteBrightness * 0.03f * (0.25f * fStep + 0.75f);
CRect rect;
float fWidescreenOffset[2] = { 0.0f, 0.0f };
if (FrontEndMenuManager.m_PrefsUseWideScreen) {
fWidescreenOffset[0] = 0.0f;
fWidescreenOffset[1] = SCREEN_SCALE_Y(18.0f);
}
#ifndef ASPECT_RATIO_SCALE
if (Mode_RunAround && TheCamera.Cams->Using3rdPersonMouseCam()) {
float f3rdX = SCREENW * TheCamera.m_f3rdPersonCHairMultX + fWidescreenOffset[0];
float f3rdY = SCREENH * TheCamera.m_f3rdPersonCHairMultY - fWidescreenOffset[1];
float f3rdX = SCREEN_WIDTH * TheCamera.m_f3rdPersonCHairMultX;
float f3rdY = SCREEN_HEIGHT * TheCamera.m_f3rdPersonCHairMultY;
#else
if (Mode_RunAround && TheCamera.Cams->Using3rdPersonMouseCam()) {
float f3rdX = (((TheCamera.m_f3rdPersonCHairMultX - 0.5f) / ((CDraw::GetAspectRatio()) / (DEFAULT_ASPECT_RATIO))) + 0.5f) * SCREEN_WIDTH;
float f3rdY = SCREEN_HEIGHT * TheCamera.m_f3rdPersonCHairMultY + SCREEN_SCALE_Y(-2.0f);
#endif
if (CWorld::Players[CWorld::PlayerInFocus].m_pPed && WeaponType == WEAPONTYPE_M16) {
rect.left = f3rdX - SCREEN_SCALE_X(32.0f * 0.6f);
rect.top = f3rdY - SCREEN_SCALE_Y(32.0f * 0.6f);
@ -654,7 +660,7 @@ void CHud::Draw()
CFont::SetBackgroundOff();
CFont::SetBackGroundOnlyTextOn();
CFont::SetAlignment(ALIGN_RIGHT);
CFont::SetRightJustifyWrap(-SCREENW);
CFont::SetRightJustifyWrap(-SCREEN_WIDTH);
CFont::SetFontStyle(FONT_HEADING);
CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f));
@ -917,7 +923,7 @@ void CHud::Draw()
CFont::SetCentreSize(SCREEN_SCALE_X(615.0f));
CFont::SetFontStyle(FONT_HEADING);
if (BigMessageX[0] >= (SCREENW - 20)) {
if (BigMessageX[0] >= (SCREEN_WIDTH - 20)) {
BigMessageInUse[0] += (CTimer::GetTimeStep() * 0.02f * 120.0f);
if (BigMessageInUse[0] >= 120.0f) {
@ -1190,7 +1196,7 @@ void CHud::DrawAfterFade()
CFont::SetRightJustifyWrap(-500);
CFont::SetRightJustifyOn();
CFont::SetFontStyle(FONT_HEADING);
if (BigMessageX[1] >= (SCREENW - 20)) {
if (BigMessageX[1] >= (SCREEN_WIDTH - 20)) {
BigMessageInUse[1] += (CTimer::GetTimeStep() * 0.02f * 120.0f);
if (BigMessageInUse[1] >= 120.0f) {

View File

@ -2,6 +2,7 @@
class CMBlur
{
public:
static RwRaster *&pFrontBuffer;
static bool &ms_bJustInitialised;
static bool &BlurOn;

View File

@ -79,6 +79,10 @@ void CenterVideo(void);
void CloseClip(void);
RwChar **_psGetVideoModeList();
RwInt32 _psGetNumVideModes();
void _psSelectScreenVM(RwInt32 videoMode);
void HandleExit();
#ifdef __cplusplus
}