Merge branch 'master' of git://github.com/GTAmodding/re3 into erorcun

This commit is contained in:
eray orçunus 2019-07-04 05:00:33 +03:00
commit cc56292bc5
45 changed files with 1946 additions and 365 deletions

View File

@ -20,6 +20,8 @@ bool &CCamera::m_bUseMouse3rdPerson = *(bool *)0x5F03D8;
WRAPPER void CCamera::DrawBordersForWideScreen(void) { EAXJMP(0x46B430); } WRAPPER void CCamera::DrawBordersForWideScreen(void) { EAXJMP(0x46B430); }
WRAPPER void CCamera::CalculateDerivedValues(void) { EAXJMP(0x46EEA0); } WRAPPER void CCamera::CalculateDerivedValues(void) { EAXJMP(0x46EEA0); }
WRAPPER void CCamera::Restore(void) { EAXJMP(0x46F990); }
WRAPPER void CCamera::SetWidescreenOff(void) { EAXJMP(0x46FF10); }
bool bool
CCamera::IsSphereVisible(const CVector &center, float radius, const CMatrix *mat) CCamera::IsSphereVisible(const CVector &center, float radius, const CMatrix *mat)

View File

@ -460,6 +460,8 @@ int m_iModeObbeCamIsInForCar;
void CalculateDerivedValues(void); void CalculateDerivedValues(void);
void DrawBordersForWideScreen(void); void DrawBordersForWideScreen(void);
void Restore(void);
void SetWidescreenOff(void);
void dtor(void) { this->CCamera::~CCamera(); } void dtor(void) { this->CCamera::~CCamera(); }
}; };

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

View File

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

View File

@ -4,9 +4,17 @@
#include "PCSave.h" #include "PCSave.h"
WRAPPER void C_PcSave::SetSaveDirectory(const char *path) { EAXJMP(0x591EA0); } 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 *GetNameOfSavedGame(int counter) { EAXJMP(0x591B60); }
WRAPPER wchar *GetSavedGameDateAndTime(int counter) { EAXJMP(0x591B50); } WRAPPER wchar *GetSavedGameDateAndTime(int counter) { EAXJMP(0x591B50); }
C_PcSave PcSaveHelper = *(C_PcSave*)0x8E2C60;
int *Slots = (int*)0x728040; int *Slots = (int*)0x728040;
int *SlotFileName = (int*)0x6F07C8; int *SlotFileName = (int*)0x6F07C8;
int *SlotSaveDate = (int*)0x72B858; int *SlotSaveDate = (int*)0x72B858;

View File

@ -3,12 +3,19 @@
class C_PcSave class C_PcSave
{ {
public: public:
int32 m_nHelper;
static void SetSaveDirectory(const char *path); 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 *GetNameOfSavedGame(int counter);
extern wchar *GetSavedGameDateAndTime(int counter); extern wchar *GetSavedGameDateAndTime(int counter);
extern C_PcSave PcSaveHelper;
extern int *Slots; extern int *Slots;
extern int *SlotFileName; extern int *SlotFileName;
extern int *SlotSaveDate; extern int *SlotSaveDate;

View File

@ -899,8 +899,8 @@ void CRadar::TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D
// Radar space goes from -1.0 to 1.0 in x and y, top right is (1.0, 1.0) // Radar space goes from -1.0 to 1.0 in x and y, top right is (1.0, 1.0)
void CRadar::TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &in) void CRadar::TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &in)
{ {
// FIX: game doesn't scale RADAR_LEFT here // FIX? scale RADAR_LEFT here somehow
out.x = (in.x + 1.0f)*0.5f*SCREEN_SCALE_X(RADAR_WIDTH) + SCREEN_SCALE_X(RADAR_LEFT); out.x = (in.x + 1.0f)*0.5f*SCREEN_SCALE_X(RADAR_WIDTH) + RADAR_LEFT;
out.y = (1.0f - in.y)*0.5f*SCREEN_SCALE_Y(RADAR_HEIGHT) + SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT); out.y = (1.0f - in.y)*0.5f*SCREEN_SCALE_Y(RADAR_HEIGHT) + SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT);
} }

View File

@ -17,8 +17,13 @@ WRAPPER bool cDMAudio::CheckForAnAudioFileOnCD() { EAXJMP(0x57CA70); }
WRAPPER void cDMAudio::ChangeMusicMode(uint8 mode) { EAXJMP(0x57CCF0); } WRAPPER void cDMAudio::ChangeMusicMode(uint8 mode) { EAXJMP(0x57CCF0); }
WRAPPER void cDMAudio::PlayFrontEndSound(uint32, uint32) { EAXJMP(0x57CC20); } 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 int32 cDMAudio::GetRadioInCar() { EAXJMP(0x57CE40); }
WRAPPER uint8 cDMAudio::IsMP3RadioChannelAvailable() { EAXJMP(0x57C9F0); } WRAPPER uint8 cDMAudio::IsMP3RadioChannelAvailable() { EAXJMP(0x57C9F0); }
@ -28,3 +33,4 @@ WRAPPER int32 cDMAudio::CreateEntity(int, void*) { EAXJMP(0x57C7C0); }
WRAPPER void cDMAudio::SetEntityStatus(int32 id, uint8 enable) { EAXJMP(0x57C810); } WRAPPER void cDMAudio::SetEntityStatus(int32 id, uint8 enable) { EAXJMP(0x57C810); }
WRAPPER void cDMAudio::SetRadioInCar(int32) { EAXJMP(0x57CE60); } WRAPPER void cDMAudio::SetRadioInCar(int32) { EAXJMP(0x57CE60); }
WRAPPER void cDMAudio::DestroyEntity(int32) { EAXJMP(0x57C7F0); } WRAPPER void cDMAudio::DestroyEntity(int32) { EAXJMP(0x57C7F0); }
WRAPPER void cDMAudio::ClearMissionAudio(void) { EAXJMP(0x57CE20); }

View File

@ -188,7 +188,13 @@ public:
bool CheckForAnAudioFileOnCD(void); bool CheckForAnAudioFileOnCD(void);
void ChangeMusicMode(uint8 mode); void ChangeMusicMode(uint8 mode);
void PlayFrontEndSound(uint32, uint32); 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); int32 GetRadioInCar(void);
void SetEffectsFadeVol(uint8); void SetEffectsFadeVol(uint8);
void SetMusicFadeVol(uint8); void SetMusicFadeVol(uint8);
@ -197,5 +203,6 @@ public:
void SetRadioInCar(int32); void SetRadioInCar(int32);
uint8 IsMP3RadioChannelAvailable(); uint8 IsMP3RadioChannelAvailable();
void DestroyEntity(int32); void DestroyEntity(int32);
void ClearMissionAudio(void);
}; };
extern cDMAudio &DMAudio; extern cDMAudio &DMAudio;

View File

@ -56,38 +56,34 @@ extern void **rwengine;
#include "skeleton.h" #include "skeleton.h"
#include "Draw.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 SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio())
#define SCREENW (RsGlobal.maximumWidth)
#define SCREENH (RsGlobal.maximumHeight)
#define DEFAULT_SCREEN_WIDTH (640) #define DEFAULT_SCREEN_WIDTH (640)
#define DEFAULT_SCREEN_HEIGHT (448) #define DEFAULT_SCREEN_HEIGHT (448)
#define SCREEN_WIDTH float(RsGlobal.width) #define DEFAULT_ASPECT_RATIO (4.0f/3.0f)
#define SCREEN_HEIGHT float(RsGlobal.height)
#define SCREEN_STRETCH_X(a) float((a) * (SCREEN_WIDTH / float(DEFAULT_SCREEN_WIDTH)))
#define SCREEN_STRETCH_Y(a) float((a) * (SCREEN_HEIGHT / float(DEFAULT_SCREEN_HEIGHT)))
#define SCREEN_STRETCH_FROM_RIGHT(a) float(SCREEN_WIDTH - SCREEN_STRETCH_X(a))
#define SCREEN_STRETCH_FROM_BOTTOM(a) float(SCREEN_HEIGHT - SCREEN_STRETCH_Y(a))
#define SCREEN_MULTIPLIER (CDraw::GetScreenMult()) // game uses maximumWidth/Height, but this probably won't work
#define SCREEN_SCALE(a) float((a) * (4.0f / 3.0f) / SCREEN_ASPECT_RATIO) // with RW windowed mode
#define SCREEN_SCALE_X(a) SCREEN_SCALE(SCREEN_STRETCH_X(a) * SCREEN_MULTIPLIER) #define SCREEN_WIDTH ((float)RsGlobal.width)
#define SCREEN_SCALE_Y(a) (SCREEN_STRETCH_Y(a) * SCREEN_MULTIPLIER) #define SCREEN_HEIGHT ((float)RsGlobal.height)
#define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio())
// This scales from PS2 pixel coordinates to the real resolution
#define SCREEN_STRETCH_X(a) ((a) * (float) SCREEN_WIDTH / DEFAULT_SCREEN_WIDTH)
#define SCREEN_STRETCH_Y(a) ((a) * (float) SCREEN_HEIGHT / DEFAULT_SCREEN_HEIGHT)
#define SCREEN_STRETCH_FROM_RIGHT(a) (SCREEN_WIDTH - SCREEN_STRETCH_X(a))
#define SCREEN_STRETCH_FROM_BOTTOM(a) (SCREEN_HEIGHT - SCREEN_STRETCH_Y(a))
// This scales from PS2 pixel coordinates while optionally maintaining the aspect ratio
#define SCREEN_SCALE_X(a) SCREEN_SCALE_AR(SCREEN_STRETCH_X(a))
#define SCREEN_SCALE_Y(a) SCREEN_STRETCH_Y(a)
#define SCREEN_SCALE_FROM_RIGHT(a) (SCREEN_WIDTH - SCREEN_SCALE_X(a)) #define SCREEN_SCALE_FROM_RIGHT(a) (SCREEN_WIDTH - SCREEN_SCALE_X(a))
#define SCREEN_SCALE_FROM_BOTTOM(a) (SCREEN_HEIGHT - SCREEN_SCALE_Y(a)) #define SCREEN_SCALE_FROM_BOTTOM(a) (SCREEN_HEIGHT - SCREEN_SCALE_Y(a))
#ifdef ASPECT_RATIO_SCALE
#define SCREEN_SCALE_AR(a) ((a) * (4.0f / 3.0f) / SCREEN_ASPECT_RATIO)
#else
#define SCREEN_SCALE_AR(a) (a)
#endif
#include "math/Vector.h" #include "math/Vector.h"
#include "math/Vector2D.h" #include "math/Vector2D.h"
#include "math/Matrix.h" #include "math/Matrix.h"

View File

@ -62,20 +62,52 @@ enum Config {
NUMPICKUPS = 336, NUMPICKUPS = 336,
}; };
// We don't expect to compile for PS2 or Xbox // We don't expect to compile for PS2 or Xbox
// but it might be interesting for documentation purposes // but it might be interesting for documentation purposes
#define GTA_PC #define GTA_PC
//#define GTA_PS2 //#define GTA_PS2
//#define GTA_XBOX //#define GTA_XBOX
#define GTA3_1_1_PATCH // This enables things from the PS2 version on PC
#define USE_PS2_RAND #define GTA_PS2_STUFF
// This is enabled for all released games.
// any debug stuff that isn't left in any game is not in FINAL
//#define FINAL
// This is enabled for all released games except mobile
// any debug stuff that is only left in mobile, is not in MASTER
//#define MASTER
#if defined GTA_PS2
# define RANDOMSPLASH # define RANDOMSPLASH
#define CHATTYSPLASH #elif defined GTA_PC
//#define FIX_BUGS # define GTA3_1_1_PATCH
//#define NO_CDCHECK # ifdef GTA_PS2_STUFF
#define NO_MOVIES # define USE_PS2_RAND
//#define USE_MY_DOCUMENTS # define RANDOMSPLASH // use random splash as on PS2
#define NASTY_GAME
# define PS2_MATFX # define PS2_MATFX
# endif
#elif defined GTA_XBOX
#endif
#ifdef MASTER
// only in master builds
#else
// not in master builds
#endif
#ifdef FINAL
// in all games
# define USE_MY_DOCUMENTS // use my documents directory for user files
#else
// not in any game
# define NASTY_GAME // nasty game for all languages
# define NO_MOVIES // disable intro videos
# define CHATTYSPLASH // print what the game is loading
#endif
#define FIX_BUGS // fix bugs in the game, TODO: use this more
#define KANGAROO_CHEAT #define KANGAROO_CHEAT
#define ASPECT_RATIO_SCALE

View File

@ -6,6 +6,7 @@ int &CCarCtrl::NumLawEnforcerCars = *(int*)0x8F1B38;
int &CCarCtrl::NumAmbulancesOnDuty = *(int*)0x885BB0; int &CCarCtrl::NumAmbulancesOnDuty = *(int*)0x885BB0;
int &CCarCtrl::NumFiretrucksOnDuty = *(int*)0x9411F0; int &CCarCtrl::NumFiretrucksOnDuty = *(int*)0x9411F0;
bool &CCarCtrl::bCarsGeneratedAroundCamera = *(bool*)0x95CD8A; bool &CCarCtrl::bCarsGeneratedAroundCamera = *(bool*)0x95CD8A;
float& CCarCtrl::CarDensityMultiplier = *(float*)0x5EC8B4;
WRAPPER void CCarCtrl::SwitchVehicleToRealPhysics(CVehicle*) { EAXJMP(0x41F7F0); } WRAPPER void CCarCtrl::SwitchVehicleToRealPhysics(CVehicle*) { EAXJMP(0x41F7F0); }
WRAPPER void CCarCtrl::AddToCarArray(int32 id, int32 vehclass) { EAXJMP(0x4182F0); } WRAPPER void CCarCtrl::AddToCarArray(int32 id, int32 vehclass) { EAXJMP(0x4182F0); }

View File

@ -14,4 +14,5 @@ public:
static int32 &NumAmbulancesOnDuty; static int32 &NumAmbulancesOnDuty;
static int32 &NumFiretrucksOnDuty; static int32 &NumFiretrucksOnDuty;
static bool &bCarsGeneratedAroundCamera; static bool &bCarsGeneratedAroundCamera;
static float &CarDensityMultiplier;
}; };

View File

@ -5,6 +5,8 @@
PedGroup *CPopulation::ms_pPedGroups = (PedGroup*)0x6E9248; PedGroup *CPopulation::ms_pPedGroups = (PedGroup*)0x6E9248;
bool &CPopulation::ms_bGivePedsWeapons = *(bool*)0x95CCF6; bool &CPopulation::ms_bGivePedsWeapons = *(bool*)0x95CCF6;
int32 &CPopulation::m_AllRandomPedsThisType = *(int32*)0x5FA570;
float &CPopulation::PedDensityMultiplier = *(float*)0x5FA56C;
WRAPPER void CPopulation::UpdatePedCount(uint32, bool) { EAXJMP(0x4F5A60); } WRAPPER void CPopulation::UpdatePedCount(uint32, bool) { EAXJMP(0x4F5A60); }
WRAPPER void CPopulation::DealWithZoneChange(eLevelName oldLevel, eLevelName newLevel, bool) { EAXJMP(0x4F6200); } WRAPPER void CPopulation::DealWithZoneChange(eLevelName oldLevel, eLevelName newLevel, bool) { EAXJMP(0x4F6200); }

View File

@ -12,6 +12,8 @@ class CPopulation
public: public:
static PedGroup *ms_pPedGroups; //[31] static PedGroup *ms_pPedGroups; //[31]
static bool &ms_bGivePedsWeapons; static bool &ms_bGivePedsWeapons;
static int32 &m_AllRandomPedsThisType;
static float &PedDensityMultiplier;
static void UpdatePedCount(uint32, bool); static void UpdatePedCount(uint32, bool);
static void DealWithZoneChange(eLevelName oldLevel, eLevelName newLevel, bool); static void DealWithZoneChange(eLevelName oldLevel, eLevelName newLevel, bool);

View File

@ -1572,7 +1572,7 @@ void CReplay::Display()
if (Mode == MODE_RECORD) if (Mode == MODE_RECORD)
return; return;
counter = (counter + 1) % 65536; counter = (counter + 1) % 65536;
if (counter & 0x20 == 0) if ((counter & 0x20) == 0)
return; return;
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();

View File

@ -3,12 +3,161 @@
#include "Script.h" #include "Script.h"
uint8 *CTheScripts::ScriptSpace = (uint8*)0x74B248; #include "Camera.h"
CTextLine* CTheScripts::IntroTextLines = (CTextLine*)0x70EA74; #include "CarCtrl.h"
CScriptRectangle* CTheScripts::IntroRectangles = (CScriptRectangle*)0x72D109; #include "DMAudio.h"
CSprite2d* CTheScripts::ScriptSprites = (CSprite2d*)0x72B090; #include "Hud.h"
bool CTheScripts::DbgFlag = *(bool*)0x95CD87; #include "ModelIndices.h"
uint32 CTheScripts::OnAMissionFlag = *(uint32*)0x8F1B64; #include "PlayerInfo.h"
#include "PlayerPed.h"
#include "Pools.h"
#include "Population.h"
#include "Streaming.h"
#include "User.h"
#include "Weather.h"
#include "World.h"
uint8 (&CTheScripts::ScriptSpace)[160 * 1024] = *(uint8(*)[160 * 1024])*(uintptr*)0x74B248;
CTextLine (&CTheScripts::IntroTextLines)[2] = *(CTextLine (*)[2])*(uintptr*)0x70EA74;
CScriptRectangle (&CTheScripts::IntroRectangles)[16] = *(CScriptRectangle (*)[16])*(uintptr*)0x72D108;
CSprite2d (&CTheScripts::ScriptSprites)[16] = *(CSprite2d(*)[16])*(uintptr*)0x72B090;
bool &CTheScripts::DbgFlag = *(bool*)0x95CD87;
uint32 &CTheScripts::OnAMissionFlag = *(uint32*)0x8F2A24;
int32 &CTheScripts::StoreVehicleIndex = *(int32*)0x8F5F3C;
bool &CTheScripts::StoreVehicleWasRandom = *(bool*)0x95CDBC;
CMissionCleanup(&CTheScripts::MissionCleanup) = *(CMissionCleanup*)0x8F2AD8;
CUpsideDownCarCheck(&CTheScripts::UpsideDownCars) = *(CUpsideDownCarCheck*)0x6EE450;
CStuckCarCheck(&CTheScripts::StuckCars) = *(CStuckCarCheck*)0x87C588;
CMissionCleanup::CMissionCleanup()
{
Init();
}
void CMissionCleanup::Init()
{
for (int i = 0; i < MAX_CLEANUP; i++){
m_sEntities[i].type = CLEANUP_UNUSED;
m_sEntities[i].id = 0;
}
}
CMissionCleanupEntity* CMissionCleanup::FindFree()
{
for (int i = 0; i < MAX_CLEANUP; i++){
if (m_sEntities[i].type == CLEANUP_UNUSED)
return &m_sEntities[i];
}
assert(0);
return nil;
}
void CMissionCleanup::AddEntityToList(int32 id, uint8 type)
{
CMissionCleanupEntity* pNew = FindFree();
if (!pNew)
return;
pNew->id = id;
pNew->type = type;
m_bCount++;
}
void CMissionCleanup::RemoveEntityFromList(int32 id, uint8 type)
{
for (int i = 0; i < MAX_CLEANUP; i++){
if (m_sEntities[i].type == type && m_sEntities[i].id == 0){
m_sEntities[i].id = 0;
m_sEntities[i].type = CLEANUP_UNUSED;
}
}
}
void CMissionCleanup::Process()
{
CPopulation::m_AllRandomPedsThisType = -1;
CPopulation::PedDensityMultiplier = 1.0f;
CCarCtrl::CarDensityMultiplier = 1.0;
FindPlayerPed()->m_pWanted->m_fCrimeSensitivity = 1.0f;
TheCamera.Restore();
TheCamera.SetWidescreenOff();
DMAudio.ClearMissionAudio();
CWeather::ReleaseWeather();
for (int i = 0; i < NUM_OF_SPECIAL_CHARS; i++)
CStreaming::SetMissionDoesntRequireSpecialChar(i);
for (int i = 0; i < NUM_OF_CUTSCENE_OBJECTS; i++)
CStreaming::SetMissionDoesntRequireModel(MI_CUTOBJ01 + i);
CStreaming::ms_disableStreaming = false;
CHud::m_ItemToFlash = -1;
CHud::SetHelpMessage(nil, false);
CUserDisplay::OnscnTimer.m_bDisabled = false;
CWorld::Players[0].m_pPed->m_pWanted->m_IsIgnoredByCops = false;
CWorld::Players[0].m_pPed->m_pWanted->m_IsIgnoredByEveryOne = false;
CWorld::Players[0].MakePlayerSafe(false);
CTheScripts::StoreVehicleIndex = -1;
CTheScripts::StoreVehicleWasRandom = true;
CTheScripts::UpsideDownCars.Init();
CTheScripts::StuckCars.Init();
for (int i = 0; i < MAX_CLEANUP; i++){
if (m_sEntities[i].type == CLEANUP_UNUSED)
continue;
switch (m_sEntities[i].type) {
case CLEANUP_CAR:
{
CVehicle* v = CPools::GetVehiclePool()->GetAt(m_sEntities[i].id);
if (v)
CTheScripts::CleanUpThisVehicle(v);
break;
}
case CLEANUP_CHAR:
{
CPed* p = CPools::GetPedPool()->GetAt(m_sEntities[i].id);
if (p)
CTheScripts::CleanUpThisPed(p);
break;
}
case CLEANUP_OBJECT:
{
CObject* o = CPools::GetObjectPool()->GetAt(m_sEntities[i].id);
if (o)
CTheScripts::CleanUpThisObject(o);
break;
}
default:
break;
}
}
}
void CUpsideDownCarCheck::Init()
{
for (int i = 0; i < MAX_UPSIDEDOWN_CAR_CHECKS; i++){
m_sCars[i].m_nVehicleIndex = -1;
m_sCars[i].m_nVehicleIndex = 0;
}
}
void CStuckCarCheck::Init()
{
for (int i = 0; i < MAX_STUCK_CAR_CHECKS; i++) {
m_sCars[i].m_nVehicleIndex = -1;
m_sCars[i].m_vecPos = CVector(-5000.0f, -5000.0f, -5000.0f);
m_sCars[i].m_nStartTime = -1;
m_sCars[i].m_fDistance = 0.0f;
m_sCars[i].m_nStuckTime = 0;
m_sCars[i].m_bStuck = false;
}
}
WRAPPER void CTheScripts::CleanUpThisVehicle(CVehicle*) { EAXJMP(0x4548D0); }
WRAPPER void CTheScripts::CleanUpThisPed(CPed*) { EAXJMP(0x4547A0); }
WRAPPER void CTheScripts::CleanUpThisObject(CObject*) { EAXJMP(0x454910); }
WRAPPER bool CTheScripts::IsPlayerOnAMission() { EAXJMP(0x439410); } WRAPPER bool CTheScripts::IsPlayerOnAMission() { EAXJMP(0x439410); }
WRAPPER void CTheScripts::ScriptDebugLine3D(float x1, float y1, float z1, float x2, float y2, float z2, int col, int col2) { EAXJMP(0x4534E0); } WRAPPER void CTheScripts::ScriptDebugLine3D(float x1, float y1, float z1, float x2, float y2, float z2, int col, int col2) { EAXJMP(0x4534E0); }
STARTPATCHES
InjectHook(0x437AE0, &CMissionCleanup::Init, PATCH_JUMP);
InjectHook(0x437BA0, &CMissionCleanup::AddEntityToList, PATCH_JUMP);
InjectHook(0x437BD0, &CMissionCleanup::RemoveEntityFromList, PATCH_JUMP);
InjectHook(0x437C10, &CMissionCleanup::Process, PATCH_JUMP);
ENDPATCHES

View File

@ -1,5 +1,8 @@
#pragma once #pragma once
#include "Ped.h"
#include "Object.h"
#include "Sprite2d.h" #include "Sprite2d.h"
#include "Vehicle.h"
struct CScriptRectangle struct CScriptRectangle
{ {
@ -32,17 +35,111 @@ struct CTextLine
wchar m_awText[500]; wchar m_awText[500];
}; };
struct CRunningScript
{
CRunningScript *next;
CRunningScript *prev;
uint8 m_abScriptName[8];
uint32 m_nIp;
uint32 m_anStack[6];
uint16 m_nStackPointer;
void* m_anLocalVariables[18];
bool m_bCondResult;
bool m_bIsMissionThread;
bool m_bSkipWakeTime;
uint32 m_nWakeTime;
uint16 m_wIfOp;
bool m_bNotFlag;
bool m_bWBCheck;
bool m_bWastedOrBusted;
bool m_bMissionFlag;
};
enum {
CLEANUP_UNUSED = 0,
CLEANUP_CAR,
CLEANUP_CHAR,
CLEANUP_OBJECT
};
struct CMissionCleanupEntity
{
uint8 type;
int32 id;
};
enum {
MAX_CLEANUP = 50,
MAX_UPSIDEDOWN_CAR_CHECKS = 6,
MAX_STUCK_CAR_CHECKS = 6
};
class CMissionCleanup
{
CMissionCleanupEntity m_sEntities[MAX_CLEANUP];
uint8 m_bCount;
public:
CMissionCleanup();
void Init();
CMissionCleanupEntity* FindFree();
void AddEntityToList(int32, uint8);
void RemoveEntityFromList(int32, uint8);
void Process();
};
struct CUpsideDownCarCheckEntry
{
int32 m_nVehicleIndex;
uint32 m_nUpsideDownTimer;
};
class CUpsideDownCarCheck
{
CUpsideDownCarCheckEntry m_sCars[MAX_UPSIDEDOWN_CAR_CHECKS];
public:
void Init();
};
struct CStuckCarCheckEntry
{
int32 m_nVehicleIndex;
CVector m_vecPos;
int32 m_nStartTime;
float m_fDistance;
uint32 m_nStuckTime;
bool m_bStuck;
};
class CStuckCarCheck
{
CStuckCarCheckEntry m_sCars[MAX_STUCK_CAR_CHECKS];
public:
void Init();
};
class CTheScripts class CTheScripts
{ {
public: public:
static uint8 *ScriptSpace;//[160*1024] static uint8(&ScriptSpace)[160 * 1024];
static CTextLine* IntroTextLines; static CTextLine(&IntroTextLines)[2];
static CScriptRectangle* IntroRectangles; static CScriptRectangle(&IntroRectangles)[16];
static CSprite2d* ScriptSprites; static CSprite2d(&ScriptSprites)[16];
static bool DbgFlag; static bool &DbgFlag;
static uint32 OnAMissionFlag; static uint32 &OnAMissionFlag;
static CMissionCleanup &MissionCleanup;
static CStuckCarCheck &StuckCars;
static CUpsideDownCarCheck &UpsideDownCars;
static int32 &StoreVehicleIndex;
static bool &StoreVehicleWasRandom;
public: public:
static bool IsPlayerOnAMission(); static bool IsPlayerOnAMission();
static void ScriptDebugLine3D(float x1, float y1, float z1, float x2, float y2, float z2, int col, int col2); static void ScriptDebugLine3D(float x1, float y1, float z1, float x2, float y2, float z2, int col, int col2);
static void CleanUpThisVehicle(CVehicle*);
static void CleanUpThisPed(CPed*);
static void CleanUpThisObject(CObject*);
}; };

View File

@ -1,3 +1,5 @@
#include "common.h" #include "common.h"
#include "patcher.h" #include "patcher.h"
#include "PlayerInfo.h" #include "PlayerInfo.h"
WRAPPER void CPlayerInfo::MakePlayerSafe(bool) { EAXJMP(0x4A1400); }

View File

@ -65,6 +65,8 @@ public:
bool m_bGetOutOfHospitalFree; bool m_bGetOutOfHospitalFree;
uint8 m_aSkinName[32]; uint8 m_aSkinName[32];
RwTexture *m_pSkinTexture; RwTexture *m_pSkinTexture;
void MakePlayerSafe(bool);
}; };
static_assert(sizeof(CPlayerInfo) == 0x13C, "CPlayerInfo: error"); static_assert(sizeof(CPlayerInfo) == 0x13C, "CPlayerInfo: error");

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::bCheat3 = *(bool *)0x95CD66;
bool &CVehicle::bCheat4 = *(bool *)0x95CD65; bool &CVehicle::bCheat4 = *(bool *)0x95CD65;
bool &CVehicle::bCheat5 = *(bool *)0x95CD64; 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) { return CPools::GetVehiclePool()->New(); }
void *CVehicle::operator new(size_t sz, int handle) { return CPools::GetVehiclePool()->New(handle); } 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 &bCheat3;
static bool &bCheat4; static bool &bCheat4;
static bool &bCheat5; static bool &bCheat5;
static bool &m_bDisableMouseSteering;
}; };
static_assert(sizeof(CVehicle) == 0x288, "CVehicle: error"); static_assert(sizeof(CVehicle) == 0x288, "CVehicle: error");

View File

@ -48,13 +48,7 @@
#include "RpAnimBlend.h" #include "RpAnimBlend.h"
#include "Frontend.h" #include "Frontend.h"
#define DEFAULT_VIEWWINDOW (tan(CDraw::GetFOV() * (360.0f / PI))) #define DEFAULT_VIEWWINDOW (tan(DEGTORAD(CDraw::GetFOV() * 0.5f)))
#ifdef WIDE_SCREEN
#define DEFAULT_ASPECTRATIO (16.0f/9.0f)
#else
#define DEFAULT_ASPECTRATIO (4.0f/3.0f)
#endif
GlobalScene &Scene = *(GlobalScene*)0x726768; GlobalScene &Scene = *(GlobalScene*)0x726768;
@ -100,6 +94,10 @@ InitialiseGame(void)
void void
Idle(void *arg) Idle(void *arg)
{ {
#ifdef ASPECT_RATIO_SCALE
CDraw::SetAspectRatio(CDraw::FindAspectRatio());
#endif
CTimer::Update(); CTimer::Update();
CSprite2d::InitPerFrame(); CSprite2d::InitPerFrame();
CFont::InitPerFrame(); CFont::InitPerFrame();
@ -126,8 +124,8 @@ Idle(void *arg)
#ifdef GTA_PC #ifdef GTA_PC
// This is from SA, but it's nice for windowed mode // This is from SA, but it's nice for windowed mode
RwV2d pos; RwV2d pos;
pos.x = SCREENW/2.0f; pos.x = SCREEN_WIDTH/2.0f;
pos.y = SCREENH/2.0f; pos.y = SCREEN_HEIGHT/2.0f;
RsMouseSetPos(&pos); RsMouseSetPos(&pos);
#endif #endif
CRenderer::ConstructRenderList(); CRenderer::ConstructRenderList();
@ -160,9 +158,8 @@ Idle(void *arg)
Render2dStuff(); Render2dStuff();
}else{ }else{
float viewWindow = tan(DEGTORAD(CDraw::GetFOV() * 0.5f)); float viewWindow = DEFAULT_VIEWWINDOW;
CDraw::CalculateAspectRatio(); CameraSize(Scene.camera, nil, viewWindow, DEFAULT_ASPECT_RATIO);
CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera); CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ); RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
if(!RsCameraBeginUpdate(Scene.camera)) if(!RsCameraBeginUpdate(Scene.camera))
@ -170,7 +167,9 @@ Idle(void *arg)
} }
RenderMenus(); RenderMenus();
#ifndef FINAL
PrintGameVersion(); PrintGameVersion();
#endif
DoFade(); DoFade();
Render2dStuffAfterFade(); Render2dStuffAfterFade();
CCredits::Render(); CCredits::Render();
@ -183,6 +182,10 @@ Idle(void *arg)
void void
FrontendIdle(void) FrontendIdle(void)
{ {
#ifdef ASPECT_RATIO_SCALE
CDraw::SetAspectRatio(CDraw::FindAspectRatio());
#endif
CTimer::Update(); CTimer::Update();
CSprite2d::SetRecipNearClip(); CSprite2d::SetRecipNearClip();
CSprite2d::InitPerFrame(); CSprite2d::InitPerFrame();
@ -193,9 +196,8 @@ FrontendIdle(void)
if(RsGlobal.quit) if(RsGlobal.quit)
return; return;
float viewWindow = tan(DEGTORAD(CDraw::GetFOV() * 0.5f)); float viewWindow = DEFAULT_VIEWWINDOW;
CDraw::CalculateAspectRatio(); CameraSize(Scene.camera, nil, viewWindow, DEFAULT_ASPECT_RATIO);
CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera); CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ); RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
if(!RsCameraBeginUpdate(Scene.camera)) if(!RsCameraBeginUpdate(Scene.camera))
@ -203,7 +205,9 @@ FrontendIdle(void)
DefinedState(); DefinedState();
RenderMenus(); RenderMenus();
#ifndef FINAL
PrintGameVersion(); PrintGameVersion();
#endif
DoFade(); DoFade();
Render2dStuffAfterFade(); Render2dStuffAfterFade();
CFont::DrawFonts(); CFont::DrawFonts();
@ -216,9 +220,7 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
CRGBA TopColor(TopRed, TopGreen, TopBlue, Alpha); CRGBA TopColor(TopRed, TopGreen, TopBlue, Alpha);
CRGBA BottomColor(BottomRed, BottomGreen, BottomBlue, Alpha); CRGBA BottomColor(BottomRed, BottomGreen, BottomBlue, Alpha);
float viewWindow = tan(DEGTORAD(CDraw::GetFOV() * 0.5f)); CameraSize(Scene.camera, nil, DEFAULT_VIEWWINDOW, SCREEN_ASPECT_RATIO);
CDraw::CalculateAspectRatio();
CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera); CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ); RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
@ -228,7 +230,7 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
CSprite2d::InitPerFrame(); CSprite2d::InitPerFrame();
if(Alpha != 0) 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; return true;
} }
@ -236,9 +238,7 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
bool bool
DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha) DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha)
{ {
float viewWindow = tan(DEGTORAD(CDraw::GetFOV() * 0.5f)); CameraSize(Scene.camera, nil, DEFAULT_VIEWWINDOW, SCREEN_ASPECT_RATIO);
CDraw::CalculateAspectRatio();
CameraSize(Scene.camera, nil, viewWindow, SCREEN_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera); CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ); RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
@ -346,15 +346,15 @@ Render2dStuff(void)
// top and bottom strips // top and bottom strips
if (weaponType == WEAPONTYPE_ROCKETLAUNCHER) { if (weaponType == WEAPONTYPE_ROCKETLAUNCHER) {
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREENW, SCREENH / 2 - SCREEN_SCALE_Y(180)), black); CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT / 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, SCREEN_HEIGHT / 2 + SCREEN_SCALE_Y(170), SCREEN_WIDTH, SCREEN_HEIGHT), black);
} }
else { else {
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREENW, SCREENH / 2 - SCREEN_SCALE_Y(210)), black); CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT / 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, 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(0.0f, 0.0f, SCREEN_WIDTH / 2 - SCREEN_SCALE_X(210), SCREEN_HEIGHT), black);
CSprite2d::DrawRect(CRect(SCREENW / 2 + SCREEN_SCALE_X(210), 0.0f, SCREENW, SCREENH), black); CSprite2d::DrawRect(CRect(SCREEN_WIDTH / 2 + SCREEN_SCALE_X(210), 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), black);
} }
MusicManager.DisplayRadioStationName(); MusicManager.DisplayRadioStationName();
@ -444,16 +444,16 @@ DoFade(void)
if(TheCamera.m_WideScreenOn){ if(TheCamera.m_WideScreenOn){
// what's this? // 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.left = 0.0f;
rect.right = SCREENW; rect.right = SCREEN_WIDTH;
rect.top = y - 8.0f; rect.top = y - 8.0f;
rect.bottom = SCREENH - y - 8.0f; rect.bottom = SCREEN_HEIGHT - y - 8.0f;
}else{ }else{
rect.left = 0.0f; rect.left = 0.0f;
rect.right = SCREENW; rect.right = SCREEN_WIDTH;
rect.top = 0.0f; rect.top = 0.0f;
rect.bottom = SCREENH; rect.bottom = SCREEN_HEIGHT;
} }
CSprite2d::DrawRect(rect, fadeColor); CSprite2d::DrawRect(rect, fadeColor);
@ -462,7 +462,7 @@ DoFade(void)
fadeColor.g = 255; fadeColor.g = 255;
fadeColor.b = 255; fadeColor.b = 255;
fadeColor.a = CDraw::FadeValue; 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(); CFont::InitPerFrame();
DefinedState(); DefinedState();
RwRenderStateSet(rwRENDERSTATETEXTUREADDRESS, (void*)rwTEXTUREADDRESSCLAMP); 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){ if(str1){
NumberOfChunksLoaded += 1; NumberOfChunksLoaded += 1;
float hpos = SCREEN_SCALE_X(40); float hpos = SCREEN_SCALE_X(40);
float length = SCREENW - SCREEN_SCALE_X(100); float length = SCREEN_WIDTH - SCREEN_SCALE_X(100);
float vpos = SCREENH - SCREEN_SCALE_Y(13); float vpos = SCREEN_HEIGHT - SCREEN_SCALE_Y(13);
float height = SCREEN_SCALE_Y(7); float height = SCREEN_SCALE_Y(7);
CSprite2d::DrawRect(CRect(hpos, vpos, hpos + length, vpos + height), CRGBA(40, 53, 68, 255)); CSprite2d::DrawRect(CRect(hpos, vpos, hpos + length, vpos + height), CRGBA(40, 53, 68, 255));
@ -617,7 +617,7 @@ LoadingIslandScreen(const char *levelName)
CFont::InitPerFrame(); CFont::InitPerFrame();
DefinedState(); DefinedState();
col = CRGBA(255, 255, 255, 255); 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::SetBackgroundOff();
CFont::SetScale(1.5f, 1.5f); CFont::SetScale(1.5f, 1.5f);
CFont::SetPropOn(); CFont::SetPropOn();
@ -630,12 +630,12 @@ LoadingIslandScreen(const char *levelName)
CFont::SetDropShadowPosition(3); CFont::SetDropShadowPosition(3);
CFont::SetColor(CRGBA(243, 237, 71, 255)); CFont::SetColor(CRGBA(243, 237, 71, 255));
CFont::SetScale(SCREEN_STRETCH_X(1.2f), SCREEN_STRETCH_Y(1.2f)); 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); TextCopy(wstr, name);
TheText.UpperCase(wstr); TheText.UpperCase(wstr);
CFont::SetColor(CRGBA(243, 237, 71, 255)); CFont::SetColor(CRGBA(243, 237, 71, 255));
CFont::SetScale(SCREEN_STRETCH_X(1.2f), SCREEN_STRETCH_Y(1.2f)); 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(); CFont::DrawFonts();
DoRWStuffEndOfFrame(); DoRWStuffEndOfFrame();
} }
@ -782,7 +782,7 @@ AppEventHandler(RsEvent event, void *param)
{ {
CameraSize(Scene.camera, (RwRect *)param, CameraSize(Scene.camera, (RwRect *)param,
DEFAULT_VIEWWINDOW, DEFAULT_ASPECTRATIO); DEFAULT_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
return rsEVENTPROCESSED; return rsEVENTPROCESSED;
} }

View File

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

View File

@ -330,6 +330,12 @@ enum
MI_BOMB, MI_BOMB,
MI_FINGERS, MI_FINGERS,
MI_CUTOBJ01 = 185,
MI_CUTOBJ02,
MI_CUTOBJ03,
MI_CUTOBJ04,
MI_CUTOBJ05,
MI_CAR_DOOR = 190, MI_CAR_DOOR = 190,
MI_CAR_BUMPER, MI_CAR_BUMPER,
MI_CAR_PANEL, MI_CAR_PANEL,
@ -345,6 +351,11 @@ enum
NUM_DEFAULT_MODELS, NUM_DEFAULT_MODELS,
}; };
enum{
NUM_OF_SPECIAL_CHARS = 4,
NUM_OF_CUTSCENE_OBJECTS = 5
};
void InitModelIndices(void); void InitModelIndices(void);
void MatchModelString(const char *name, int16 id); void MatchModelString(const char *name, int16 id);

View File

@ -875,6 +875,7 @@ CreateCarColourTexture(uint8 r, uint8 g, uint8 b)
pixels[14] = b; pixels[14] = b;
pixels[15] = 0xFF; pixels[15] = 0xFF;
RwImageSetPixels(img, pixels); RwImageSetPixels(img, pixels);
RwImageSetStride(img, 8);
RwImageSetPalette(img, nil); RwImageSetPalette(img, nil);
RwImageFindRasterFormat(img, rwRASTERTYPETEXTURE, &width, &height, &depth, &format); RwImageFindRasterFormat(img, rwRASTERTYPETEXTURE, &width, &height, &depth, &format);
ras = RwRasterCreate(width, height, depth, format); ras = RwRasterCreate(width, height, depth, format);

View File

@ -9,6 +9,11 @@
#define NOVMT __declspec(novtable) #define NOVMT __declspec(novtable)
#define SETVMT(a) *((DWORD_PTR*)this) = (DWORD_PTR)a #define SETVMT(a) *((DWORD_PTR*)this) = (DWORD_PTR)a
#include <algorithm>
#include <vector>
#include "common.h"
enum enum
{ {
PATCH_CALL, PATCH_CALL,
@ -28,6 +33,21 @@ enum
extern int gtaversion; extern int gtaversion;
class StaticPatcher
{
private:
using Patcher = void(*)();
Patcher m_func;
StaticPatcher *m_next;
static StaticPatcher *ms_head;
void Run() { m_func(); }
public:
StaticPatcher(Patcher func);
static void Apply();
};
template<typename T> template<typename T>
inline T AddressByVersion(uint32_t addressIII10, uint32_t addressIII11, uint32_t addressIIISteam, uint32_t addressvc10, uint32_t addressvc11, uint32_t addressvcSteam) inline T AddressByVersion(uint32_t addressIII10, uint32_t addressIII11, uint32_t addressIIISteam, uint32_t addressvc10, uint32_t addressvc11, uint32_t addressvcSteam)
{ {
@ -110,9 +130,18 @@ ClearCC(AT address, unsigned int nCount)
VirtualProtect((void*)address, nCount, dwProtect[0], &dwProtect[1]); VirtualProtect((void*)address, nCount, dwProtect[0], &dwProtect[1]);
} }
extern std::vector<int32> usedAddresses;
template<typename AT, typename HT> inline void template<typename AT, typename HT> inline void
InjectHook(AT address, HT hook, unsigned int nType=PATCH_NOTHING) InjectHook(AT address, HT hook, unsigned int nType=PATCH_NOTHING)
{ {
if(std::any_of(usedAddresses.begin(), usedAddresses.end(),
[address](AT value) { return (int32)value == address; })) {
debug("Used address %#06x twice when injecting hook\n", address);
}
usedAddresses.push_back((int32)address);
DWORD dwProtect[2]; DWORD dwProtect[2];
switch ( nType ) switch ( nType )
{ {
@ -159,22 +188,5 @@ inline void InterceptVmethod(void *dst, T func, uint32_t a)
Patch(a, func); Patch(a, func);
} }
class StaticPatcher
{
private:
using Patcher = void(*)();
Patcher m_func;
StaticPatcher *m_next;
static StaticPatcher *ms_head;
void Run() { m_func(); }
public:
StaticPatcher(Patcher func);
static void Apply();
};
#define STARTPATCHES static StaticPatcher Patcher([](){ #define STARTPATCHES static StaticPatcher Patcher([](){
#define ENDPATCHES }); #define ENDPATCHES });

View File

@ -16,6 +16,10 @@
#include "Automobile.h" #include "Automobile.h"
#include "debugmenu_public.h" #include "debugmenu_public.h"
#include <vector>
std::vector<int32> usedAddresses;
void **rwengine = *(void***)0x5A10E1; void **rwengine = *(void***)0x5A10E1;
DebugMenuAPI gDebugMenuAPI; DebugMenuAPI gDebugMenuAPI;

View File

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

View File

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

View File

@ -4,8 +4,9 @@
#include "Frontend.h" #include "Frontend.h"
#include "Camera.h" #include "Camera.h"
float CDraw::ms_fAspectRatio; #ifdef ASPECT_RATIO_SCALE
float CDraw::ms_fScreenMultiplier; float CDraw::ms_fAspectRatio = DEFAULT_ASPECT_RATIO;
#endif
float &CDraw::ms_fNearClipZ = *(float*)0x8E2DC4; float &CDraw::ms_fNearClipZ = *(float*)0x8E2DC4;
float &CDraw::ms_fFarClipZ = *(float*)0x9434F0; float &CDraw::ms_fFarClipZ = *(float*)0x9434F0;
@ -16,38 +17,52 @@ uint8 &CDraw::FadeRed = *(uint8*)0x95CD90;
uint8 &CDraw::FadeGreen = *(uint8*)0x95CD71; uint8 &CDraw::FadeGreen = *(uint8*)0x95CD71;
uint8 &CDraw::FadeBlue = *(uint8*)0x95CD53; uint8 &CDraw::FadeBlue = *(uint8*)0x95CD53;
void float
CDraw::CalculateAspectRatio() CDraw::FindAspectRatio(void)
{ {
SetScreenMult(DEFAULT_SCALE); #ifndef ASPECT_RATIO_SCALE
if(FrontEndMenuManager.m_PrefsUseWideScreen) if(FrontEndMenuManager.m_PrefsUseWideScreen)
ms_fAspectRatio = 16.0f/9.0f; return 16.0f/9.0f;
else else
ms_fAspectRatio = 4.0f/3.0f; 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
} }
static float hFov2vFov(float hfov) #ifdef ASPECT_RATIO_SCALE
// convert a 4:3 hFOV to vFOV,
// then convert that vFOV to hFOV for our aspect ratio,
// i.e. HOR+
float
CDraw::ConvertFOV(float hfov)
{ {
float w = SCREENW;
float h = SCREENH;
// => tan(hFOV/2) = tan(vFOV/2)*aspectRatio // => tan(hFOV/2) = tan(vFOV/2)*aspectRatio
// => tan(vFOV/2) = tan(hFOV/2)/aspectRatio // => tan(vFOV/2) = tan(hFOV/2)/aspectRatio
float ar1 = 4.0/3.0; float ar1 = DEFAULT_ASPECT_RATIO;
float ar2 = w/h; float ar2 = GetAspectRatio();
hfov = DEGTORAD(hfov); hfov = DEGTORAD(hfov);
float vfov = atan(tan(hfov/2) / ar1) *2; float vfov = atan(tan(hfov/2) / ar1) *2;
hfov = atan(tan(vfov/2) * ar2) *2; hfov = atan(tan(vfov/2) * ar2) *2;
return RADTODEG(hfov); return RADTODEG(hfov);
} }
#endif
void void
CDraw::SetFOV(float fov) CDraw::SetFOV(float fov)
{ {
// TODO: fix FOV here or somewhere else? #ifdef ASPECT_RATIO_SCALE
// ms_fFOV = hFov2vFov(fov); ms_fFOV = ConvertFOV(fov);
#else
ms_fFOV = fov; ms_fFOV = fov;
#endif
} }
STARTPATCHES STARTPATCHES

View File

@ -1,7 +1,11 @@
#pragma once #pragma once
#define HUD_SCALE 0.8f enum eAspectRatio
#define DEFAULT_SCALE 1.0f {
AR_AUTO,
AR_4_3,
AR_16_9,
};
class CDraw class CDraw
{ {
@ -9,8 +13,13 @@ private:
static float &ms_fNearClipZ; static float &ms_fNearClipZ;
static float &ms_fFarClipZ; static float &ms_fFarClipZ;
static float &ms_fFOV; static float &ms_fFOV;
static float ms_fLODDistance; // unused
#ifdef ASPECT_RATIO_SCALE
// we use this variable to scale a lot of 2D elements
// so better cache it
static float ms_fAspectRatio; static float ms_fAspectRatio;
static float ms_fScreenMultiplier; #endif
public: public:
static uint8 &FadeValue; static uint8 &FadeValue;
@ -26,8 +35,12 @@ public:
static void SetFOV(float fov); static void SetFOV(float fov);
static float GetFOV(void) { return ms_fFOV; } static float GetFOV(void) { return ms_fFOV; }
static void CalculateAspectRatio(); static float FindAspectRatio(void);
#ifdef ASPECT_RATIO_SCALE
static float ConvertFOV(float fov);
static float GetAspectRatio(void) { return ms_fAspectRatio; } static float GetAspectRatio(void) { return ms_fAspectRatio; }
static void SetScreenMult(float mult) { ms_fScreenMultiplier = mult; }; static void SetAspectRatio(float ratio) { ms_fAspectRatio = ratio; }
static float GetScreenMult(void) { return ms_fScreenMultiplier; }; #else
static float GetAspectRatio(void) { return FindAspectRatio(); }
#endif
}; };

View File

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

View File

@ -47,7 +47,7 @@ wchar *CHud::m_PagerMessage = (wchar*)0x878840;
bool &CHud::m_Wants_To_Draw_Hud = *(bool*)0x95CD89; bool &CHud::m_Wants_To_Draw_Hud = *(bool*)0x95CD89;
bool &CHud::m_Wants_To_Draw_3dMarkers = *(bool*)0x95CD62; bool &CHud::m_Wants_To_Draw_3dMarkers = *(bool*)0x95CD62;
wchar(*CHud::m_BigMessage)[128] = (wchar(*)[128])0x664CE0; wchar(*CHud::m_BigMessage)[128] = (wchar(*)[128])0x664CE0;
int32 CHud::m_ItemToFlash = *(int32*)0x95CC82; int16 &CHud::m_ItemToFlash = *(int16*)0x95CC82;
// These aren't really in CHud // These aren't really in CHud
float CHud::BigMessageInUse[6]; float CHud::BigMessageInUse[6];
@ -125,6 +125,15 @@ WRAPPER void CHud::Draw(void) { EAXJMP(0x5052A0); }
#else #else
void CHud::Draw() 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()) if (CReplay::IsPlayingBack())
return; return;
@ -167,18 +176,15 @@ void CHud::Draw()
float fStep = sin((CTimer::GetTimeInMilliseconds() & 1023) * 0.0061328127); float fStep = sin((CTimer::GetTimeInMilliseconds() & 1023) * 0.0061328127);
float fMultBright = SpriteBrightness * 0.03f * (0.25f * fStep + 0.75f); float fMultBright = SpriteBrightness * 0.03f * (0.25f * fStep + 0.75f);
CRect rect; CRect rect;
#ifndef ASPECT_RATIO_SCALE
float fWidescreenOffset[2] = { 0.0f, 0.0f };
if (FrontEndMenuManager.m_PrefsUseWideScreen) {
fWidescreenOffset[0] = 0.0f;
fWidescreenOffset[1] = SCREEN_SCALE_Y(18.0f);
}
if (Mode_RunAround && TheCamera.Cams->Using3rdPersonMouseCam()) { if (Mode_RunAround && TheCamera.Cams->Using3rdPersonMouseCam()) {
float f3rdX = SCREENW * TheCamera.m_f3rdPersonCHairMultX + fWidescreenOffset[0]; float f3rdX = SCREEN_WIDTH * TheCamera.m_f3rdPersonCHairMultX;
float f3rdY = SCREENH * TheCamera.m_f3rdPersonCHairMultY - fWidescreenOffset[1]; 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) { if (CWorld::Players[CWorld::PlayerInFocus].m_pPed && WeaponType == WEAPONTYPE_M16) {
rect.left = f3rdX - SCREEN_SCALE_X(32.0f * 0.6f); rect.left = f3rdX - SCREEN_SCALE_X(32.0f * 0.6f);
rect.top = f3rdY - SCREEN_SCALE_Y(32.0f * 0.6f); rect.top = f3rdY - SCREEN_SCALE_Y(32.0f * 0.6f);
@ -654,7 +660,7 @@ void CHud::Draw()
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
CFont::SetBackGroundOnlyTextOn(); CFont::SetBackGroundOnlyTextOn();
CFont::SetAlignment(ALIGN_RIGHT); CFont::SetAlignment(ALIGN_RIGHT);
CFont::SetRightJustifyWrap(-SCREENW); CFont::SetRightJustifyWrap(-SCREEN_WIDTH);
CFont::SetFontStyle(FONT_HEADING); CFont::SetFontStyle(FONT_HEADING);
CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f)); CFont::SetScale(SCREEN_SCALE_X(0.8f), SCREEN_SCALE_Y(1.35f));
@ -787,8 +793,8 @@ void CHud::Draw()
if (m_ItemToFlash == ITEM_RADAR && CTimer::GetFrameCounter() & 8 || m_ItemToFlash != ITEM_RADAR) { if (m_ItemToFlash == ITEM_RADAR && CTimer::GetFrameCounter() & 8 || m_ItemToFlash != ITEM_RADAR) {
CRadar::DrawMap(); CRadar::DrawMap();
CRect rect(0.0f, 0.0f, SCREEN_SCALE_X(RADAR_WIDTH), SCREEN_SCALE_Y(RADAR_HEIGHT)); CRect rect(0.0f, 0.0f, SCREEN_SCALE_X(RADAR_WIDTH), SCREEN_SCALE_Y(RADAR_HEIGHT));
// FIX: game doesn't scale RADAR_LEFT here // FIX? scale RADAR_LEFT here somehow
rect.Translate(SCREEN_SCALE_X(RADAR_LEFT), SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT)); rect.Translate(RADAR_LEFT, SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT));
rect.Grow(4.0f); rect.Grow(4.0f);
Sprites[HUD_RADARDISC].Draw(rect, CRGBA(0, 0, 0, 255)); Sprites[HUD_RADARDISC].Draw(rect, CRGBA(0, 0, 0, 255));
CRadar::DrawBlips(); CRadar::DrawBlips();
@ -917,7 +923,7 @@ void CHud::Draw()
CFont::SetCentreSize(SCREEN_SCALE_X(615.0f)); CFont::SetCentreSize(SCREEN_SCALE_X(615.0f));
CFont::SetFontStyle(FONT_HEADING); CFont::SetFontStyle(FONT_HEADING);
if (BigMessageX[0] >= (SCREENW - 20)) { if (BigMessageX[0] >= (SCREEN_WIDTH - 20)) {
BigMessageInUse[0] += (CTimer::GetTimeStep() * 0.02f * 120.0f); BigMessageInUse[0] += (CTimer::GetTimeStep() * 0.02f * 120.0f);
if (BigMessageInUse[0] >= 120.0f) { if (BigMessageInUse[0] >= 120.0f) {
@ -1190,7 +1196,7 @@ void CHud::DrawAfterFade()
CFont::SetRightJustifyWrap(-500); CFont::SetRightJustifyWrap(-500);
CFont::SetRightJustifyOn(); CFont::SetRightJustifyOn();
CFont::SetFontStyle(FONT_HEADING); CFont::SetFontStyle(FONT_HEADING);
if (BigMessageX[1] >= (SCREENW - 20)) { if (BigMessageX[1] >= (SCREEN_WIDTH - 20)) {
BigMessageInUse[1] += (CTimer::GetTimeStep() * 0.02f * 120.0f); BigMessageInUse[1] += (CTimer::GetTimeStep() * 0.02f * 120.0f);
if (BigMessageInUse[1] >= 120.0f) { if (BigMessageInUse[1] >= 120.0f) {

View File

@ -62,7 +62,7 @@ public:
static bool &m_Wants_To_Draw_Hud; static bool &m_Wants_To_Draw_Hud;
static bool &m_Wants_To_Draw_3dMarkers; static bool &m_Wants_To_Draw_3dMarkers;
static wchar(*m_BigMessage)[128]; static wchar(*m_BigMessage)[128];
static int32 m_ItemToFlash; static int16 &m_ItemToFlash;
// These aren't really in CHud // These aren't really in CHud
static float BigMessageInUse[6]; static float BigMessageInUse[6];

View File

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

View File

@ -222,16 +222,16 @@ CRenderer::RenderEverythingBarRoads(void)
if(e->IsVehicle() || if(e->IsVehicle() ||
e->IsPed() && CVisibilityPlugins::GetClumpAlpha((RpClump*)e->m_rwObject) != 255){ e->IsPed() && CVisibilityPlugins::GetClumpAlpha((RpClump*)e->m_rwObject) != 255){
if(e->IsVehicle() && ((CVehicle*)e)->IsBoat()){ if(e->IsVehicle() && ((CVehicle*)e)->IsBoat()){
ei.ent = e;
dist = ms_vecCameraPosition - e->GetPosition();
ei.sort = dist.MagnitudeSqr();
gSortedVehiclesAndPeds.InsertSorted(ei);
}else{
dist = ms_vecCameraPosition - e->GetPosition(); dist = ms_vecCameraPosition - e->GetPosition();
if(!CVisibilityPlugins::InsertEntityIntoSortedList(e, dist.Magnitude())){ if(!CVisibilityPlugins::InsertEntityIntoSortedList(e, dist.Magnitude())){
printf("Ran out of space in alpha entity list"); printf("Ran out of space in alpha entity list");
RenderOneNonRoad(e); RenderOneNonRoad(e);
} }
}else{
ei.ent = e;
dist = ms_vecCameraPosition - e->GetPosition();
ei.sort = dist.MagnitudeSqr();
gSortedVehiclesAndPeds.InsertSorted(ei);
} }
}else }else
RenderOneNonRoad(e); RenderOneNonRoad(e);
@ -241,14 +241,16 @@ CRenderer::RenderEverythingBarRoads(void)
void void
CRenderer::RenderVehiclesButNotBoats(void) CRenderer::RenderVehiclesButNotBoats(void)
{ {
// This function doesn't do anything
// because only boats are inserted into the list
CLink<EntityInfo> *node; CLink<EntityInfo> *node;
for(node = gSortedVehiclesAndPeds.tail.prev; for(node = gSortedVehiclesAndPeds.tail.prev;
node != &gSortedVehiclesAndPeds.head; node != &gSortedVehiclesAndPeds.head;
node = node->prev){ node = node->prev){
// only boats in this list
CVehicle *v = (CVehicle*)node->item.ent; CVehicle *v = (CVehicle*)node->item.ent;
if(v->IsVehicle() && v->IsBoat()) // BUG: IsVehicle missing in III if(!v->IsBoat())
continue;
RenderOneNonRoad(v); RenderOneNonRoad(v);
} }
} }
@ -261,8 +263,9 @@ CRenderer::RenderBoats(void)
for(node = gSortedVehiclesAndPeds.tail.prev; for(node = gSortedVehiclesAndPeds.tail.prev;
node != &gSortedVehiclesAndPeds.head; node != &gSortedVehiclesAndPeds.head;
node = node->prev){ node = node->prev){
// only boats in this list
CVehicle *v = (CVehicle*)node->item.ent; CVehicle *v = (CVehicle*)node->item.ent;
if(v->IsVehicle() && v->IsBoat()) // BUG: IsVehicle missing in III if(v->IsBoat())
RenderOneNonRoad(v); RenderOneNonRoad(v);
} }
} }

View File

@ -16,7 +16,7 @@ CSprite::CalcHorizonCoors(void)
CVector p = TheCamera.GetPosition() + CVector(TheCamera.CamFrontXNorm, TheCamera.CamFrontYNorm, 0.0f)*3000.0f; CVector p = TheCamera.GetPosition() + CVector(TheCamera.CamFrontXNorm, TheCamera.CamFrontYNorm, 0.0f)*3000.0f;
p.z = 0.0f; p.z = 0.0f;
p = TheCamera.m_viewMatrix * p; p = TheCamera.m_viewMatrix * p;
return p.y * RsGlobal.maximumHeight / p.z; return p.y * SCREEN_HEIGHT / p.z;
} }
bool bool
@ -27,13 +27,13 @@ CSprite::CalcScreenCoors(const RwV3d &in, RwV3d *out, float *outw, float *outh,
if(out->z <= CDraw::GetNearClipZ() + 1.0f) return false; if(out->z <= CDraw::GetNearClipZ() + 1.0f) return false;
if(out->z >= CDraw::GetFarClipZ() && farclip) return false; if(out->z >= CDraw::GetFarClipZ() && farclip) return false;
float recip = 1.0f/out->z; float recip = 1.0f/out->z;
out->x *= RsGlobal.maximumWidth * recip; out->x *= SCREEN_WIDTH * recip;
out->y *= RsGlobal.maximumHeight * recip; out->y *= SCREEN_HEIGHT * recip;
// What is this? size? // What is this? size?
*outw = 70.0f/CDraw::GetFOV(); *outw = 70.0f/CDraw::GetFOV();
*outh = 70.0f/CDraw::GetFOV(); *outh = 70.0f/CDraw::GetFOV();
*outw *= RsGlobal.maximumWidth * recip; *outw *= SCREEN_WIDTH * recip;
*outh *= RsGlobal.maximumHeight * recip; *outh *= SCREEN_HEIGHT * recip;
return true; return true;
} }
@ -99,17 +99,17 @@ CSprite::RenderOneXLUSprite(float x, float y, float z, float w, float h, uint8 r
us[i] = -xs[i] / (2.0f*w); us[i] = -xs[i] / (2.0f*w);
xs[i] = 0.0f; xs[i] = 0.0f;
} }
if(xs[i] > RsGlobal.maximumWidth){ if(xs[i] > SCREEN_WIDTH){
us[i] = 1.0f - (xs[i]-RsGlobal.maximumWidth) / (2.0f*w); us[i] = 1.0f - (xs[i]-SCREEN_WIDTH) / (2.0f*w);
xs[i] = RsGlobal.maximumWidth; xs[i] = SCREEN_WIDTH;
} }
if(ys[i] < 0.0f){ if(ys[i] < 0.0f){
vs[i] = -ys[i] / (2.0f*h); vs[i] = -ys[i] / (2.0f*h);
ys[i] = 0.0f; ys[i] = 0.0f;
} }
if(ys[i] > RsGlobal.maximumHeight){ if(ys[i] > SCREEN_HEIGHT){
vs[i] = 1.0f - (ys[i]-RsGlobal.maximumHeight) / (2.0f*h); vs[i] = 1.0f - (ys[i]-SCREEN_HEIGHT) / (2.0f*h);
ys[i] = RsGlobal.maximumHeight; ys[i] = SCREEN_HEIGHT;
} }
} }
@ -169,10 +169,10 @@ CSprite::RenderOneXLUSprite_Rotate_Aspect(float x, float y, float z, float w, fl
// No clipping, just culling // No clipping, just culling
if(xs[0] < 0.0f && xs[1] < 0.0f && xs[2] < 0.0f && xs[3] < 0.0f) return; if(xs[0] < 0.0f && xs[1] < 0.0f && xs[2] < 0.0f && xs[3] < 0.0f) return;
if(ys[0] < 0.0f && ys[1] < 0.0f && ys[2] < 0.0f && ys[3] < 0.0f) return; if(ys[0] < 0.0f && ys[1] < 0.0f && ys[2] < 0.0f && ys[3] < 0.0f) return;
if(xs[0] > RsGlobal.maximumWidth && xs[1] > RsGlobal.maximumWidth && if(xs[0] > SCREEN_WIDTH && xs[1] > SCREEN_WIDTH &&
xs[2] > RsGlobal.maximumWidth && xs[3] > RsGlobal.maximumWidth) return; xs[2] > SCREEN_WIDTH && xs[3] > SCREEN_WIDTH) return;
if(ys[0] > RsGlobal.maximumHeight && ys[1] > RsGlobal.maximumHeight && if(ys[0] > SCREEN_HEIGHT && ys[1] > SCREEN_HEIGHT &&
ys[2] > RsGlobal.maximumHeight && ys[3] > RsGlobal.maximumHeight) return; ys[2] > SCREEN_HEIGHT && ys[3] > SCREEN_HEIGHT) return;
float screenz = m_f2DNearScreenZ + float screenz = m_f2DNearScreenZ +
(z-CDraw::GetNearClipZ())*(m_f2DFarScreenZ-m_f2DNearScreenZ)*CDraw::GetFarClipZ() / (z-CDraw::GetNearClipZ())*(m_f2DFarScreenZ-m_f2DNearScreenZ)*CDraw::GetFarClipZ() /
@ -221,17 +221,17 @@ CSprite::RenderBufferedOneXLUSprite(float x, float y, float z, float w, float h,
us[i] = -xs[i] / (2.0f*w); us[i] = -xs[i] / (2.0f*w);
xs[i] = 0.0f; xs[i] = 0.0f;
} }
if(xs[i] > RsGlobal.maximumWidth){ if(xs[i] > SCREEN_WIDTH){
us[i] = 1.0f - (xs[i]-RsGlobal.maximumWidth) / (2.0f*w); us[i] = 1.0f - (xs[i]-SCREEN_WIDTH) / (2.0f*w);
xs[i] = RsGlobal.maximumWidth; xs[i] = SCREEN_WIDTH;
} }
if(ys[i] < 0.0f){ if(ys[i] < 0.0f){
vs[i] = -ys[i] / (2.0f*h); vs[i] = -ys[i] / (2.0f*h);
ys[i] = 0.0f; ys[i] = 0.0f;
} }
if(ys[i] > RsGlobal.maximumHeight){ if(ys[i] > SCREEN_HEIGHT){
vs[i] = 1.0f - (ys[i]-RsGlobal.maximumHeight) / (2.0f*h); vs[i] = 1.0f - (ys[i]-SCREEN_HEIGHT) / (2.0f*h);
ys[i] = RsGlobal.maximumHeight; ys[i] = SCREEN_HEIGHT;
} }
} }
@ -283,10 +283,10 @@ CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension(float x, float y, float z,
// No clipping, just culling // No clipping, just culling
if(xs[0] < 0.0f && xs[1] < 0.0f && xs[2] < 0.0f && xs[3] < 0.0f) return; if(xs[0] < 0.0f && xs[1] < 0.0f && xs[2] < 0.0f && xs[3] < 0.0f) return;
if(ys[0] < 0.0f && ys[1] < 0.0f && ys[2] < 0.0f && ys[3] < 0.0f) return; if(ys[0] < 0.0f && ys[1] < 0.0f && ys[2] < 0.0f && ys[3] < 0.0f) return;
if(xs[0] > RsGlobal.maximumWidth && xs[1] > RsGlobal.maximumWidth && if(xs[0] > SCREEN_WIDTH && xs[1] > SCREEN_WIDTH &&
xs[2] > RsGlobal.maximumWidth && xs[3] > RsGlobal.maximumWidth) return; xs[2] > SCREEN_WIDTH && xs[3] > SCREEN_WIDTH) return;
if(ys[0] > RsGlobal.maximumHeight && ys[1] > RsGlobal.maximumHeight && if(ys[0] > SCREEN_HEIGHT && ys[1] > SCREEN_HEIGHT &&
ys[2] > RsGlobal.maximumHeight && ys[3] > RsGlobal.maximumHeight) return; ys[2] > SCREEN_HEIGHT && ys[3] > SCREEN_HEIGHT) return;
float screenz = m_f2DNearScreenZ + float screenz = m_f2DNearScreenZ +
(z-CDraw::GetNearClipZ())*(m_f2DFarScreenZ-m_f2DNearScreenZ)*CDraw::GetFarClipZ() / (z-CDraw::GetNearClipZ())*(m_f2DFarScreenZ-m_f2DNearScreenZ)*CDraw::GetFarClipZ() /
@ -335,10 +335,10 @@ CSprite::RenderBufferedOneXLUSprite_Rotate_Aspect(float x, float y, float z, flo
// No clipping, just culling // No clipping, just culling
if(xs[0] < 0.0f && xs[1] < 0.0f && xs[2] < 0.0f && xs[3] < 0.0f) return; if(xs[0] < 0.0f && xs[1] < 0.0f && xs[2] < 0.0f && xs[3] < 0.0f) return;
if(ys[0] < 0.0f && ys[1] < 0.0f && ys[2] < 0.0f && ys[3] < 0.0f) return; if(ys[0] < 0.0f && ys[1] < 0.0f && ys[2] < 0.0f && ys[3] < 0.0f) return;
if(xs[0] > RsGlobal.maximumWidth && xs[1] > RsGlobal.maximumWidth && if(xs[0] > SCREEN_WIDTH && xs[1] > SCREEN_WIDTH &&
xs[2] > RsGlobal.maximumWidth && xs[3] > RsGlobal.maximumWidth) return; xs[2] > SCREEN_WIDTH && xs[3] > SCREEN_WIDTH) return;
if(ys[0] > RsGlobal.maximumHeight && ys[1] > RsGlobal.maximumHeight && if(ys[0] > SCREEN_HEIGHT && ys[1] > SCREEN_HEIGHT &&
ys[2] > RsGlobal.maximumHeight && ys[3] > RsGlobal.maximumHeight) return; ys[2] > SCREEN_HEIGHT && ys[3] > SCREEN_HEIGHT) return;
float screenz = m_f2DNearScreenZ + float screenz = m_f2DNearScreenZ +
(z-CDraw::GetNearClipZ())*(m_f2DFarScreenZ-m_f2DNearScreenZ)*CDraw::GetFarClipZ() / (z-CDraw::GetNearClipZ())*(m_f2DFarScreenZ-m_f2DNearScreenZ)*CDraw::GetFarClipZ() /
@ -388,10 +388,10 @@ CSprite::RenderBufferedOneXLUSprite_Rotate_2Colours(float x, float y, float z, f
// No clipping, just culling // No clipping, just culling
if(xs[0] < 0.0f && xs[1] < 0.0f && xs[2] < 0.0f && xs[3] < 0.0f) return; if(xs[0] < 0.0f && xs[1] < 0.0f && xs[2] < 0.0f && xs[3] < 0.0f) return;
if(ys[0] < 0.0f && ys[1] < 0.0f && ys[2] < 0.0f && ys[3] < 0.0f) return; if(ys[0] < 0.0f && ys[1] < 0.0f && ys[2] < 0.0f && ys[3] < 0.0f) return;
if(xs[0] > RsGlobal.maximumWidth && xs[1] > RsGlobal.maximumWidth && if(xs[0] > SCREEN_WIDTH && xs[1] > SCREEN_WIDTH &&
xs[2] > RsGlobal.maximumWidth && xs[3] > RsGlobal.maximumWidth) return; xs[2] > SCREEN_WIDTH && xs[3] > SCREEN_WIDTH) return;
if(ys[0] > RsGlobal.maximumHeight && ys[1] > RsGlobal.maximumHeight && if(ys[0] > SCREEN_HEIGHT && ys[1] > SCREEN_HEIGHT &&
ys[2] > RsGlobal.maximumHeight && ys[3] > RsGlobal.maximumHeight) return; ys[2] > SCREEN_HEIGHT && ys[3] > SCREEN_HEIGHT) return;
// Colour factors, cx/y is the direction in which colours change from rgb1 to rgb2 // Colour factors, cx/y is the direction in which colours change from rgb1 to rgb2
cf[0] = (cx*(-c-s) + cy*(-c+s))*0.5f + 0.5f; cf[0] = (cx*(-c-s) + cy*(-c+s))*0.5f + 0.5f;

View File

@ -626,9 +626,7 @@ psInitialise(void)
C_PcSave::SetSaveDirectory(_psGetUserFilesFolder()); C_PcSave::SetSaveDirectory(_psGetUserFilesFolder());
#ifndef NASTY_GAME
InitialiseLanguage(); InitialiseLanguage();
#endif
FrontEndMenuManager.LoadSettings(); FrontEndMenuManager.LoadSettings();
@ -1262,7 +1260,7 @@ UINT GetBestRefreshRate(UINT width, UINT height, UINT depth)
ASSERT(d3d != nil); ASSERT(d3d != nil);
INT refreshRate = -1; UINT refreshRate = INT_MAX;
D3DFORMAT format; D3DFORMAT format;
if ( depth == 32 ) if ( depth == 32 )
@ -1284,12 +1282,9 @@ UINT GetBestRefreshRate(UINT width, UINT height, UINT depth)
{ {
if ( mode.RefreshRate == 0 ) if ( mode.RefreshRate == 0 )
return 0; return 0;
#pragma warning( push )
#pragma warning( disable : 4018)
if ( mode.RefreshRate < refreshRate && mode.RefreshRate >= 60 ) if ( mode.RefreshRate < refreshRate && mode.RefreshRate >= 60 )
refreshRate = mode.RefreshRate; refreshRate = mode.RefreshRate;
#pragma warning( pop )
} }
} }
@ -1540,8 +1535,6 @@ CommandLineToArgv(RwChar *cmdLine, RwInt32 *argCount)
*/ */
void InitialiseLanguage() void InitialiseLanguage()
{ {
#pragma warning( push )
#pragma warning( disable : 4302)
WORD primUserLCID = PRIMARYLANGID(GetSystemDefaultLCID()); WORD primUserLCID = PRIMARYLANGID(GetSystemDefaultLCID());
WORD primSystemLCID = PRIMARYLANGID(GetUserDefaultLCID()); WORD primSystemLCID = PRIMARYLANGID(GetUserDefaultLCID());
WORD primLayout = PRIMARYLANGID((DWORD)GetKeyboardLayout(0)); WORD primLayout = PRIMARYLANGID((DWORD)GetKeyboardLayout(0));
@ -1549,7 +1542,6 @@ void InitialiseLanguage()
WORD subUserLCID = SUBLANGID(GetSystemDefaultLCID()); WORD subUserLCID = SUBLANGID(GetSystemDefaultLCID());
WORD subSystemLCID = SUBLANGID(GetUserDefaultLCID()); WORD subSystemLCID = SUBLANGID(GetUserDefaultLCID());
WORD subLayout = SUBLANGID((DWORD)GetKeyboardLayout(0)); WORD subLayout = SUBLANGID((DWORD)GetKeyboardLayout(0));
#pragma warning( pop )
if ( primUserLCID == LANG_GERMAN if ( primUserLCID == LANG_GERMAN
|| primSystemLCID == LANG_GERMAN || primSystemLCID == LANG_GERMAN
@ -1574,6 +1566,12 @@ void InitialiseLanguage()
|| subLayout == SUBLANG_ENGLISH_AUS ) || subLayout == SUBLANG_ENGLISH_AUS )
CGame::noProstitutes = true; CGame::noProstitutes = true;
#ifdef NASTY_GAME
CGame::nastyGame = true;
CMenuManager::m_PrefsAllowNastyGame = true;
CGame::noProstitutes = false;
#endif
int32 lang; int32 lang;
switch ( primSystemLCID ) switch ( primSystemLCID )
@ -2420,12 +2418,8 @@ void _InputInitialiseJoys()
} }
} }
#pragma warning( push ) void _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num)
#pragma warning( disable : 4700)
HRESULT _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num)
{ {
HRESULT hr;
DIDEVICEOBJECTINSTANCE objInst; DIDEVICEOBJECTINSTANCE objInst;
objInst.dwSize = sizeof( DIDEVICEOBJECTINSTANCE ); objInst.dwSize = sizeof( DIDEVICEOBJECTINSTANCE );
@ -2445,7 +2439,7 @@ HRESULT _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num)
if ( SUCCEEDED( lpDevice->GetObjectInfo( &objInst, DIJOFS_X, DIPH_BYOFFSET ) ) ) if ( SUCCEEDED( lpDevice->GetObjectInfo( &objInst, DIJOFS_X, DIPH_BYOFFSET ) ) )
{ {
if( FAILED( lpDevice->SetProperty( DIPROP_RANGE, (LPCDIPROPHEADER)&range ) ) ) if( FAILED( lpDevice->SetProperty( DIPROP_RANGE, (LPCDIPROPHEADER)&range ) ) )
return S_FALSE; return;
else else
; ;
} }
@ -2457,7 +2451,7 @@ HRESULT _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num)
if ( SUCCEEDED( lpDevice->GetObjectInfo( &objInst, DIJOFS_Y, DIPH_BYOFFSET ) ) ) if ( SUCCEEDED( lpDevice->GetObjectInfo( &objInst, DIJOFS_Y, DIPH_BYOFFSET ) ) )
{ {
if( FAILED( lpDevice->SetProperty( DIPROP_RANGE, (LPCDIPROPHEADER)&range ) ) ) if( FAILED( lpDevice->SetProperty( DIPROP_RANGE, (LPCDIPROPHEADER)&range ) ) )
return S_FALSE; return;
else else
; ;
} }
@ -2469,7 +2463,7 @@ HRESULT _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num)
if ( SUCCEEDED( lpDevice->GetObjectInfo( &objInst, DIJOFS_Z, DIPH_BYOFFSET ) ) ) if ( SUCCEEDED( lpDevice->GetObjectInfo( &objInst, DIJOFS_Z, DIPH_BYOFFSET ) ) )
{ {
if( FAILED( lpDevice->SetProperty( DIPROP_RANGE, (LPCDIPROPHEADER)&range ) ) ) if( FAILED( lpDevice->SetProperty( DIPROP_RANGE, (LPCDIPROPHEADER)&range ) ) )
return S_FALSE; return;
else else
AllValidWinJoys.m_aJoys[num].m_bHasAxisZ = true; // z rightStickPos.x AllValidWinJoys.m_aJoys[num].m_bHasAxisZ = true; // z rightStickPos.x
} }
@ -2481,15 +2475,12 @@ HRESULT _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num)
if ( SUCCEEDED( lpDevice->GetObjectInfo( &objInst, DIJOFS_RZ, DIPH_BYOFFSET ) ) ) if ( SUCCEEDED( lpDevice->GetObjectInfo( &objInst, DIJOFS_RZ, DIPH_BYOFFSET ) ) )
{ {
if( FAILED( lpDevice->SetProperty( DIPROP_RANGE, (LPCDIPROPHEADER)&range ) ) ) if( FAILED( lpDevice->SetProperty( DIPROP_RANGE, (LPCDIPROPHEADER)&range ) ) )
return S_FALSE; return;
else else
AllValidWinJoys.m_aJoys[num].m_bHasAxisR = true; // r rightStickPos.y AllValidWinJoys.m_aJoys[num].m_bHasAxisR = true; // r rightStickPos.y
} }
} }
return hr;
} }
#pragma warning( pop )
HRESULT _InputAddJoys() HRESULT _InputAddJoys()
{ {
@ -2973,9 +2964,7 @@ void _InputTranslateShiftKeyUpDown(RsKeyCodes *rs)
} }
} }
#pragma warning( push ) BOOL _InputTranslateShiftKey(RsKeyCodes *rs, UINT key, BOOLEAN bDown)
#pragma warning( disable : 4805)
BOOL _InputTranslateShiftKey(RsKeyCodes *rs, UINT key, bool bDown)
{ {
*rs = rsNULL; *rs = rsNULL;
switch ( key ) switch ( key )
@ -3002,7 +2991,6 @@ BOOL _InputTranslateShiftKey(RsKeyCodes *rs, UINT key, bool bDown)
return TRUE; return TRUE;
} }
#pragma warning( pop )
BOOL _InputIsExtended(INT flag) BOOL _InputIsExtended(INT flag)
{ {

View File

@ -63,14 +63,14 @@ HRESULT _InputInitialise();
HRESULT _InputInitialiseMouse(); HRESULT _InputInitialiseMouse();
HRESULT CapturePad(RwInt32 padID); HRESULT CapturePad(RwInt32 padID);
void _InputInitialiseJoys(); void _InputInitialiseJoys();
HRESULT _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num); void _InputAddJoyStick(LPDIRECTINPUTDEVICE8 lpDevice, INT num);
HRESULT _InputAddJoys(); HRESULT _InputAddJoys();
HRESULT _InputGetMouseState(DIMOUSESTATE2 *state); HRESULT _InputGetMouseState(DIMOUSESTATE2 *state);
void _InputShutdown(); void _InputShutdown();
BOOL CALLBACK _InputEnumDevicesCallback( const DIDEVICEINSTANCE* pdidInstance, VOID* pContext ); BOOL CALLBACK _InputEnumDevicesCallback( const DIDEVICEINSTANCE* pdidInstance, VOID* pContext );
BOOL _InputTranslateKey(RsKeyCodes *rs, UINT flag, UINT key); BOOL _InputTranslateKey(RsKeyCodes *rs, UINT flag, UINT key);
void _InputTranslateShiftKeyUpDown(RsKeyCodes *rs);; void _InputTranslateShiftKeyUpDown(RsKeyCodes *rs);;
BOOL _InputTranslateShiftKey(RsKeyCodes *rs, UINT key, bool bDown); BOOL _InputTranslateShiftKey(RsKeyCodes *rs, UINT key, BOOLEAN bDown);
BOOL _InputIsExtended(INT flag); BOOL _InputIsExtended(INT flag);
void InitialiseLanguage(); void InitialiseLanguage();
@ -79,6 +79,10 @@ void CenterVideo(void);
void CloseClip(void); void CloseClip(void);
RwChar **_psGetVideoModeList(); RwChar **_psGetVideoModeList();
RwInt32 _psGetNumVideModes();
void _psSelectScreenVM(RwInt32 videoMode);
void HandleExit();
#ifdef __cplusplus #ifdef __cplusplus
} }