Merge with upstream

This commit is contained in:
Nikolay Korolev 2019-06-26 23:34:14 +03:00
commit 08b053a568
50 changed files with 4929 additions and 795 deletions

View File

@ -501,7 +501,7 @@ CFileLoader::LoadObjectTypes(const char *filename)
CARS, CARS,
PEDS, PEDS,
PATH, PATH,
TWO2FX TWODFX
}; };
char *line; char *line;
int fd; int fd;
@ -528,7 +528,7 @@ CFileLoader::LoadObjectTypes(const char *filename)
else if(strncmp(line, "cars", 4) == 0) section = CARS; else if(strncmp(line, "cars", 4) == 0) section = CARS;
else if(strncmp(line, "peds", 4) == 0) section = PEDS; else if(strncmp(line, "peds", 4) == 0) section = PEDS;
else if(strncmp(line, "path", 4) == 0) section = PATH; else if(strncmp(line, "path", 4) == 0) section = PATH;
else if(strncmp(line, "2dfx", 4) == 0) section = TWO2FX; else if(strncmp(line, "2dfx", 4) == 0) section = TWODFX;
}else if(strncmp(line, "end", 3) == 0){ }else if(strncmp(line, "end", 3) == 0){
section = section == MLO ? OBJS : NONE; section = section == MLO ? OBJS : NONE;
}else switch(section){ }else switch(section){
@ -571,7 +571,7 @@ CFileLoader::LoadObjectTypes(const char *filename)
pathIndex = -1; pathIndex = -1;
} }
break; break;
case TWO2FX: case TWODFX:
Load2dEffect(line); Load2dEffect(line);
break; break;
} }
@ -848,6 +848,7 @@ CFileLoader::LoadCarPathNode(const char *line, int id, int node)
ThePaths.StoreNodeInfoCar(id, node, type, next, x, y, z, 0, numLeft, numRight); ThePaths.StoreNodeInfoCar(id, node, type, next, x, y, z, 0, numLeft, numRight);
} }
void void
CFileLoader::Load2dEffect(const char *line) CFileLoader::Load2dEffect(const char *line)
{ {

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,45 @@
#include "Sprite2d.h" #include "Sprite2d.h"
enum { #define MENUHEADER_POS_X 35.0f
#define MENUHEADER_POS_Y 93.0f
#define MENUHEADER_WIDTH 0.84f
#define MENUHEADER_HEIGHT 1.6f
#define MENUACTION_POS_X 20.0f
#define MENUACTION_POS_Y 37.5f
#define MENUACTION_WIDTH 0.675f
#define MENUACTION_HEIGHT 0.81f
#define MENUCOLUMN_POS_X MENUHEADER_POS_X + 16.0f
#define MENUCOLUMN_MAX_Y 149.0f
#define MENUCOLUMN_MID_Y 100.0f
#define MENUCOLUMN_MIN_Y 110.0f
#define MENUCOLUMN_PAUSE_Y 25.0f
#define MENUCOLUMN_START_Y 9.0f
#define MENUCOLUMN_FEDS 139.0f
#define MENUCOLUMN_SAVE_X 121.0f
#define MENUCOLUMN_SAVE_Y 111.0f
#define MENUCOLUMN_SPACING_MAX 24.0f
#define MENUCOLUMN_SPACING_MIN 20.0f
#define MENUSELECT_BOX_MAX 20.5f
#define MENUSELECT_BOX_MIN 17.0f
#define MENURADIO_ICON_X 31.5f
#define MENURADIO_ICON_Y 29.5f
#define MENURADIO_ICON_W 60.0f
#define MENURADIO_ICON_H 60.0f
#define MENUDROP_COLOR_A 150
#define MENUDROP_COLOR_SIZE -1
#define MENUSLIDER_X 306.0f
enum eLanguages
{
LANGUAGE_AMERICAN, LANGUAGE_AMERICAN,
LANGUAGE_FRENCH, LANGUAGE_FRENCH,
LANGUAGE_GERMAN, LANGUAGE_GERMAN,
@ -10,66 +48,291 @@ enum {
LANGUAGE_SPANISH, LANGUAGE_SPANISH,
}; };
enum eMenuScreen { enum eFrontendSprites
MENU_NONE = 0, {
MENU_STATS = 1, FE2_MAINPANEL_UL,
MENU_NEW_GAME = 2, FE2_MAINPANEL_UR,
MENU_BRIEFS = 3, FE2_MAINPANEL_DL,
MENU_CONTROLLER_SETTINGS = 4, FE2_MAINPANEL_DR,
MENU_SOUND_SETTINGS = 5, FE2_MAINPANEL_DR2,
MENU_GRAPHICS_SETTINGS = 6, FE2_TABACTIVE,
MENU_LANGUAGE_SETTINGS = 7, FE_ICONBRIEF,
MENU_CHOOSE_LOAD_SLOT = 8, FE_ICONSTATS,
MENU_CHOOSE_DELETE_SLOT = 9, FE_ICONCONTROLS,
MENU_NEW_GAME_RELOAD = 10, FE_ICONSAVE,
MENU_LOAD_SLOT_CONFIRM = 11, FE_ICONAUDIO,
MENU_DELETE_SLOT_CONFIRM = 12, FE_ICONDISPLAY,
MENU_13 = 13, FE_ICONLANGUAGE,
MENU_LOADING_IN_PROGRESS = 14, FE_CONTROLLER,
MENU_DELETING_IN_PROGRESS = 15, FE_CONTROLLERSH,
MENU_16 = 16, FE_ARROWS1,
MENU_DELETE_FAILED = 17, FE_ARROWS2,
MENU_DEBUG_MENU = 18, FE_ARROWS3,
MENU_MEMORY_CARD_1 = 19, FE_ARROWS4,
MENU_MEMORY_CARD_2 = 20, FE_RADIO1,
MENU_MULTIPLAYER_MAIN = 21, FE_RADIO2,
MENU_SAVE_FAILED_1 = 22, FE_RADIO3,
MENU_SAVE_FAILED_2 = 23, FE_RADIO4,
MENU_SAVE = 24, FE_RADIO5,
MENU_NO_MEMORY_CARD = 25, FE_RADIO6,
MENU_CHOOSE_SAVE_SLOT = 26, FE_RADIO7,
MENU_SAVE_OVERWRITE_CONFIRM = 27, FE_RADIO8,
MENU_MULTIPLAYER_MAP = 28, FE_RADIO9,
MENU_MULTIPLAYER_CONNECTION = 29, };
MENU_MULTIPLAYER_FIND_GAME = 30,
MENU_MULTIPLAYER_MODE = 31, enum eMenuSprites
MENU_MULTIPLAYER_CREATE = 32, {
MENU_MULTIPLAYER_START = 33, MENUSPRITE_CONNECTION,
MENU_SKIN_SELECT_OLD = 34, MENUSPRITE_FINDGAME,
MENU_CONTROLLER_PC = 35, MENUSPRITE_HOSTGAME,
MENU_CONTROLLER_PC_OLD1 = 36, MENUSPRITE_MAINMENU,
MENU_CONTROLLER_PC_OLD2 = 37, MENUSPRITE_PLAYERSET,
MENU_CONTROLLER_PC_OLD3 = 38, MENUSPRITE_SINGLEPLAYER,
MENU_CONTROLLER_PC_OLD4 = 39, MENUSPRITE_MULTIPLAYER,
MENU_CONTROLLER_DEBUG = 40, MENUSPRITE_DMALOGO,
MENU_OPTIONS = 41, MENUSPRITE_GTALOGO,
MENU_EXIT = 42, MENUSPRITE_RSTARLOGO,
MENU_SAVING_IN_PROGRESS = 43, MENUSPRITE_GAMESPY,
MENU_SAVE_SUCCESSFUL = 44, MENUSPRITE_MOUSE,
MENU_DELETING = 45, MENUSPRITE_MOUSET,
MENU_DELETE_SUCCESS = 46, MENUSPRITE_MP3LOGO,
MENU_SAVE_FAILED = 47, MENUSPRITE_DOWNOFF,
MENU_LOAD_FAILED = 48, MENUSPRITE_DOWNON,
MENU_LOAD_FAILED_2 = 49, MENUSPRITE_UPOFF,
MENU_FILTER_GAME = 50, MENUSPRITE_UPON,
MENU_START_MENU = 51, MENUSPRITE_GTA3LOGO,
MENU_PAUSE_MENU = 52, };
MENU_CHOOSE_MODE = 53,
MENU_SKIN_SELECT = 54, enum eSaveSlot
MENU_KEYBOARD_CONTROLS = 55, {
MENU_MOUSE_CONTROLS = 56, SAVESLOT_NONE,
MENU_57 = 57, SAVESLOT_0,
MENU_58 = 58, SAVESLOT_1,
SAVESLOT_2,
SAVESLOT_3,
SAVESLOT_4,
SAVESLOT_5,
SAVESLOT_6,
SAVESLOT_7,
SAVESLOT_8,
SAVESLOT_LABEL = 36
};
enum eMenuScreen
{
MENUPAGE_DISABLED = -1,
MENUPAGE_NONE = 0,
MENUPAGE_STATS = 1,
MENUPAGE_NEW_GAME = 2,
MENUPAGE_BRIEFS = 3,
MENUPAGE_CONTROLLER_SETTINGS = 4,
MENUPAGE_SOUND_SETTINGS = 5,
MENUPAGE_GRAPHICS_SETTINGS = 6,
MENUPAGE_LANGUAGE_SETTINGS = 7,
MENUPAGE_CHOOSE_LOAD_SLOT = 8,
MENUPAGE_CHOOSE_DELETE_SLOT = 9,
MENUPAGE_NEW_GAME_RELOAD = 10,
MENUPAGE_LOAD_SLOT_CONFIRM = 11,
MENUPAGE_DELETE_SLOT_CONFIRM = 12,
MENUPAGE_13 = 13,
MENUPAGE_LOADING_IN_PROGRESS = 14,
MENUPAGE_DELETING_IN_PROGRESS = 15,
MENUPAGE_16 = 16,
MENUPAGE_DELETE_FAILED = 17,
MENUPAGE_DEBUG_MENU = 18,
MENUPAGE_MEMORY_CARD_1 = 19,
MENUPAGE_MEMORY_CARD_2 = 20,
MENUPAGE_MULTIPLAYER_MAIN = 21,
MENUPAGE_SAVE_FAILED_1 = 22,
MENUPAGE_SAVE_FAILED_2 = 23,
MENUPAGE_SAVE = 24,
MENUPAGE_NO_MEMORY_CARD = 25,
MENUPAGE_CHOOSE_SAVE_SLOT = 26,
MENUPAGE_SAVE_OVERWRITE_CONFIRM = 27,
MENUPAGE_MULTIPLAYER_MAP = 28,
MENUPAGE_MULTIPLAYER_CONNECTION = 29,
MENUPAGE_MULTIPLAYER_FIND_GAME = 30,
MENUPAGE_MULTIPLAYER_MODE = 31,
MENUPAGE_MULTIPLAYER_CREATE = 32,
MENUPAGE_MULTIPLAYER_START = 33,
MENUPAGE_SKIN_SELECT_OLD = 34,
MENUPAGE_CONTROLLER_PC = 35,
MENUPAGE_CONTROLLER_PC_OLD1 = 36,
MENUPAGE_CONTROLLER_PC_OLD2 = 37,
MENUPAGE_CONTROLLER_PC_OLD3 = 38,
MENUPAGE_CONTROLLER_PC_OLD4 = 39,
MENUPAGE_CONTROLLER_DEBUG = 40,
MENUPAGE_OPTIONS = 41,
MENUPAGE_EXIT = 42,
MENUPAGE_SAVING_IN_PROGRESS = 43,
MENUPAGE_SAVE_SUCCESSFUL = 44,
MENUPAGE_DELETING = 45,
MENUPAGE_DELETE_SUCCESS = 46,
MENUPAGE_SAVE_FAILED = 47,
MENUPAGE_LOAD_FAILED = 48,
MENUPAGE_LOAD_FAILED_2 = 49,
MENUPAGE_FILTER_GAME = 50,
MENUPAGE_START_MENU = 51,
MENUPAGE_PAUSE_MENU = 52,
MENUPAGE_CHOOSE_MODE = 53,
MENUPAGE_SKIN_SELECT = 54,
MENUPAGE_KEYBOARD_CONTROLS = 55,
MENUPAGE_MOUSE_CONTROLS = 56,
MENUPAGE_57 = 57,
MENUPAGE_58 = 58,
MENUPAGES
};
enum eMenuAction
{
MENUACTION_NOTHING,
MENUACTION_LABEL,
MENUACTION_CHANGEMENU,
MENUACTION_CTRLVIBRATION,
MENUACTION_CTRLCONFIG,
MENUACTION_CTRLDISPLAY,
MENUACTION_FRAMESYNC,
MENUACTION_FRAMELIMIT,
MENUACTION_TRAILS,
MENUACTION_SUBTITLES,
MENUACTION_WIDESCREEN,
MENUACTION_BRIGHTNESS,
MENUACTION_DRAWDIST,
MENUACTION_MUSICVOLUME,
MENUACTION_SFXVOLUME,
MENUACTION_UNK15,
MENUACTION_RADIO,
MENUACTION_LANG_ENG,
MENUACTION_LANG_FRE,
MENUACTION_LANG_GER,
MENUACTION_LANG_ITA,
MENUACTION_LANG_SPA,
MENUACTION_UPDATESAVE,
MENUACTION_CHECKSAVE,
MENUACTION_UNK24,
MENUACTION_NEWGAME,
MENUACTION_RELOADIDE,
MENUACTION_RELOADIPL,
MENUACTION_SETDBGFLAG,
MENUACTION_SWITCHBIGWHITEDEBUGLIGHT,
MENUACTION_PEDROADGROUPS,
MENUACTION_CARROADGROUPS,
MENUACTION_COLLISIONPOLYS,
MENUACTION_REGMEMCARD1,
MENUACTION_TESTFORMATMEMCARD1,
MENUACTION_TESTUNFORMATMEMCARD1,
MENUACTION_CREATEROOTDIR,
MENUACTION_CREATELOADICONS,
MENUACTION_FILLWITHGUFF,
MENUACTION_SAVEONLYTHEGAME,
MENUACTION_SAVEGAME,
MENUACTION_SAVEGAMEUNDERGTA,
MENUACTION_CREATECOPYPROTECTED,
MENUACTION_TESTSAVE,
MENUACTION_TESTLOAD,
MENUACTION_TESTDELETE,
MENUACTION_PARSEHEAP,
MENUACTION_SHOWCULL,
MENUACTION_MEMCARDSAVECONFIRM,
MENUACTION_UPDATEMEMCARDSAVE,
MENUACTION_UNK50,
MENUACTION_DEBUGSTREAM,
MENUACTION_MPMAP_LIBERTY,
MENUACTION_MPMAP_REDLIGHT,
MENUACTION_MPMAP_CHINATOWN,
MENUACTION_MPMAP_TOWER,
MENUACTION_MPMAP_SEWER,
MENUACTION_MPMAP_INDUSTPARK,
MENUACTION_MPMAP_DOCKS,
MENUACTION_MPMAP_STAUNTON,
MENUACTION_MPMAP_DEATHMATCH1,
MENUACTION_MPMAP_DEATHMATCH2,
MENUACTION_MPMAP_TEAMDEATH1,
MENUACTION_MPMAP_TEAMDEATH2,
MENUACTION_MPMAP_STASH,
MENUACTION_MPMAP_CAPTURE,
MENUACTION_MPMAP_RATRACE,
MENUACTION_MPMAP_DOMINATION,
MENUACTION_STARTMP,
MENUACTION_UNK69,
MENUACTION_UNK70,
MENUACTION_FINDMP,
MENUACTION_REDEFCTRL,
MENUACTION_UNK73,
MENUACTION_INITMP,
MENUACTION_MP_PLAYERCOLOR,
MENUACTION_MP_PLAYERNAME,
MENUACTION_MP_GAMENAME,
MENUACTION_GETKEY,
MENUACTION_SHOWHEADBOB,
MENUACTION_UNK80,
MENUACTION_INVVERT,
MENUACTION_CANCLEGAME,
MENUACTION_MP_PLAYERNUMBER,
MENUACTION_MOUSESENS,
MENUACTION_CHECKMPGAMES,
MENUACTION_CHECKMPPING,
MENUACTION_MP_SERVER,
MENUACTION_MP_MAP,
MENUACTION_MP_GAMETYPE,
MENUACTION_MP_LAN,
MENUACTION_MP_INTERNET,
MENUACTION_RESUME,
MENUACTION_DONTCANCLE,
MENUACTION_SCREENRES,
MENUACTION_AUDIOHW,
MENUACTION_SPEAKERCONF,
MENUACTION_PLAYERSETUP,
MENUACTION_RESTOREDEF,
MENUACTION_CTRLMETHOD,
MENUACTION_DYNAMICACOUSTIC,
MENUACTION_LOADRADIO,
MENUACTION_MOUSESTEER,
MENUACTION_UNK103,
MENUACTION_UNK104,
MENUACTION_UNK105,
MENUACTION_UNK106,
MENUACTION_UNK107,
MENUACTION_UNK108,
MENUACTION_UNK109,
MENUACTION_UNK110,
};
enum eCheckHover
{
ACTIVATE_OPTION = 2,
IGNORE_OPTION = 42,
};
enum eMenuColumns
{
MENUCOLUMN_LEFT,
MENUCOLUMN_CENTER,
MENUCOLUMN_RIGHT,
MENUCOLUMNS,
};
enum eMenuRow
{
MENUROW_0,
MENUROW_1,
MENUROW_2,
MENUROW_3,
MENUROW_4,
MENUROW_5,
MENUROW_6,
MENUROW_7,
MENUROW_8,
MENUROW_9,
MENUROW_10,
MENUROW_11,
MENUROW_12,
MENUROW_13,
MENUROW_14,
MENUROW_15,
MENUROW_16,
MENUROW_17,
MENUROWS,
}; };
struct tSkinInfo struct tSkinInfo
@ -81,6 +344,21 @@ struct tSkinInfo
int field_304; int field_304;
}; };
struct CMenuScreen
{
char m_ScreenName[8];
int32 m_PreviousPage[3]; // eMenuScreen
int32 m_ParentEntry[2]; // eMenuRow
struct CMenuEntry
{
int32 m_Action; // eMenuAction
char m_EntryName[8];
int32 m_SaveSlot; // eSaveSlot
int32 m_TargetMenu; // eMenuScreen
} m_aEntries[MENUROWS];
};
class CMenuManager class CMenuManager
{ {
public: public:
@ -136,10 +414,10 @@ public:
int m_nHelperTextAlpha; int m_nHelperTextAlpha;
int m_nMouseOldPosX; int m_nMouseOldPosX;
int m_nMouseOldPosY; int m_nMouseOldPosY;
int field_544; int m_nHoverOption;
int m_nCurrScreen; int m_nCurrScreen;
int m_nCurrOption; int m_nCurrOption;
int field_550; int m_nCurrentInput;
int m_nPrevScreen; int m_nPrevScreen;
int field_558; int field_558;
int m_nCurrSaveSlot; int m_nCurrSaveSlot;
@ -165,17 +443,52 @@ 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 bool &m_PrefsAllowNastyGame;
static bool &m_bStartUpFrontEndRequested; static bool &m_bStartUpFrontEndRequested;
static bool &m_bShutDownFrontEndRequested;
static bool &m_PrefsAllowNastyGame;
void Process(void); public:
void DrawFrontEnd(void); void BuildStatLine(char *, void *, uint16, void *);
void UnloadTextures(void); static void CentreMousePointer();
void LoadAllTextures(void); void CheckCodesForControls(int, int);
void LoadSettings(void); bool CheckHover(int x1, int x2, int y1, int y2);
void WaitForUserCD(void); int CostructStatLine(int);
void DisplayHelperText();
float DisplaySlider(float, float, float, float, float, float);
void DoSettingsBeforeStartingAGame();
void Draw();
void DrawControllerBound(int, int, int, uint8);
void DrawControllerScreenExtraText(int, int, int);
void DrawControllerSetupScreen();
void DrawFrontEnd();
void DrawFrontEndNormal();
void DrawPlayerSetupScreen();
int FadeIn(int alpha); int FadeIn(int alpha);
void FilterOutColorMarkersFromString(uint16, CRGBA &);
int GetStartOptionsCntrlConfigScreens();
static void InitialiseChangedLanguageSettings();
void LoadAllTextures();
void LoadSettings();
static void MessageScreen(char *);
static void PickNewPlayerColour();
void PrintBriefs();
static void PrintErrorMessage();
void PrintStats();
void Process();
void ProcessButtonPresses();
void ProcessOnOffMenuOptions();
static void RequestFrontEndShutdown();
static void RequestFrontEndStartUp();
void ResetHelperText();
void SaveLoadFileError_SetUpErrorScreen();
void SaveSettings();
void SetHelperText(int text);
void ShutdownJustMenu();
static float StretchX(float);
static float StretchY(float );
void SwitchMenuOnAndOff();
void UnloadTextures();
void WaitForUserCD();
}; };
static_assert(sizeof(CMenuManager) == 0x564, "CMenuManager: error"); static_assert(sizeof(CMenuManager) == 0x564, "CMenuManager: error");

380
src/MenuScreens.h Normal file
View File

@ -0,0 +1,380 @@
#pragma once
const CMenuScreen aScreens[] = {
// MENUPAGE_NONE = 0
{ "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0, },
// MENUPAGE_STATS = 1
{ "FET_STA", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, MENUROW_5, MENUROW_2,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// 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, "FES_DGA", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_BRIEFS = 3
{ "FET_BRE", MENUPAGE_NONE, MENUPAGE_NONE, MENUPAGE_NONE, MENUROW_6, MENUROW_3,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENU_CONTROLLER_SETTINGS = 4
{ "FET_CON", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUROW_0, MENUROW_0,
},
// MENUPAGE_SOUND_SETTINGS = 5
{ "FET_AUD", MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, MENUROW_1, MENUROW_1,
MENUACTION_MUSICVOLUME, "FEA_MUS", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_SFXVOLUME, "FEA_SFX", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_AUDIOHW, "FEA_3DH", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_SPEAKERCONF, "FEA_SPK", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_DYNAMICACOUSTIC, "FET_DAM", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_RADIO, "FEA_RSS", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
},
// MENUPAGE_GRAPHICS_SETTINGS = 6
{ "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_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,
MENUACTION_WIDESCREEN, "FED_WIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_SCREENRES, "FED_RES", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// 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_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_CHOOSE_LOAD_SLOT = 8
{ "FET_LG", MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, MENUROW_1, MENUROW_1,
MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
MENUACTION_CHECKSAVE, "FEM_SL1", SAVESLOT_1, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL2", SAVESLOT_2, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL3", SAVESLOT_3, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL4", SAVESLOT_4, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL5", SAVESLOT_5, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL6", SAVESLOT_6, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL7", SAVESLOT_7, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL8", SAVESLOT_8, MENUPAGE_LOAD_SLOT_CONFIRM,
},
// 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,
},
// 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,
},
// MENUPAGE_LOAD_SLOT_CONFIRM = 11
{ "FET_LG", MENUPAGE_CHOOSE_LOAD_SLOT, MENUPAGE_CHOOSE_LOAD_SLOT, MENUPAGE_CHOOSE_LOAD_SLOT, MENUROW_0, MENUROW_0,
MENUACTION_LABEL, "FESZ_QL", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT,
MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_LOADING_IN_PROGRESS,
},
// MENUPAGE_DELETE_SLOT_CONFIRM = 12
{ "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUROW_0, MENUROW_0,
MENUACTION_LABEL, "FESZ_QD", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT,
MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_DELETING,
},
// MENUPAGE_13 = 13
{ "FES_NOC", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
},
// MENUPAGE_LOADING_IN_PROGRESS = 14
{ "FET_LG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
MENUACTION_LABEL, "FED_LDW", SAVESLOT_NONE, MENUPAGE_LOAD_SLOT_CONFIRM,
},
// MENUPAGE_DELETING_IN_PROGRESS = 15
{ "FET_DG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
MENUACTION_LABEL, "FEDL_WR", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_16 = 16
{ "FET_LG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
MENUACTION_LABEL, "FES_LOE", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_DELETE_FAILED = 17
{ "FET_DG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
MENUACTION_LABEL, "FES_DEE", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT,
},
// MENUPAGE_DEBUG_MENU = 18
{ "FED_DBG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
},
// MENUPAGE_MEMORY_CARD_1 = 19
{ "FEM_MCM", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
},
// MENUPAGE_MEMORY_CARD_2 = 20
{ "FEM_MC2", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
},
// MENUPAGE_MULTIPLAYER_MAIN = 21
{ "FET_MP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
},
// MENUPAGE_SAVE_FAILED_1 = 22
{ "MCDNSP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
MENUACTION_MEMCARDSAVECONFIRM, "JAILB_U", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_SAVE_FAILED_2 = 23
{ "MCGNSP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
MENUACTION_MEMCARDSAVECONFIRM, "JAILB_U", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_SAVE = 24
{ "FET_SG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
MENUACTION_LABEL, "FES_SCG", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_UPDATESAVE, "GMSAVE", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
MENUACTION_UPDATEMEMCARDSAVE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_NO_MEMORY_CARD = 25
{ "FES_NOC", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
},
// 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,
},
// MENUPAGE_SAVE_OVERWRITE_CONFIRM = 27
{ "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUROW_0, MENUROW_0,
MENUACTION_LABEL, "FESZ_QO", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_SAVING_IN_PROGRESS,
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
},
// MENUPAGE_MULTIPLAYER_MAP = 28
{ "FET_MAP", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
},
// MENUPAGE_MULTIPLAYER_CONNECTION = 29
{ "FET_CON", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
},
// MENUPAGE_MULTIPLAYER_FIND_GAME = 30
{ "FET_FG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
},
// MENUPAGE_MULTIPLAYER_MODE = 31
{ "FET_GT", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
},
// MENUPAGE_MULTIPLAYER_CREATE = 32
{ "FET_HG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
},
// MENUPAGE_MULTIPLAYER_START = 33
{ "FEN_STA", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
},
// MENUPAGE_SKIN_SELECT_OLD = 34
{ "FET_PS", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
},
// 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_AMS", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_CONTROLLER_PC_OLD1 = 36
{ "FET_CTL", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC, MENUROW_0, MENUROW_0,
},
// MENUPAGE_CONTROLLER_PC_OLD2 = 37
{ "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
},
// MENUPAGE_CONTROLLER_PC_OLD3 = 38
{ "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
},
// MENUPAGE_CONTROLLER_PC_OLD4 = 39
{ "FET_CTL", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
},
// MENUPAGE_CONTROLLER_DEBUG = 40
{ "FEC_DBG", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
},
// 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_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, "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_CANCLEGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_SAVING_IN_PROGRESS = 43
{ "", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUROW_0, MENUROW_0,
MENUACTION_LABEL, "FES_WAR", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_SAVE_SUCCESSFUL = 44
{ "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUROW_0, MENUROW_0,
MENUACTION_LABEL, "FES_SSC", SAVESLOT_LABEL, MENUPAGE_NONE,
MENUACTION_UPDATEMEMCARDSAVE, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
},
// MENUPAGE_DELETING = 45
{ "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUROW_0, MENUROW_0,
MENUACTION_LABEL, "FED_DLW", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_DELETE_SUCCESS = 46
{ "FET_DG", MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUPAGE_CHOOSE_DELETE_SLOT, MENUROW_0, MENUROW_0,
MENUACTION_LABEL, "DEL_FNM", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_DELETE_SLOT,
},
// MENUPAGE_SAVE_FAILED = 47
{ "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUROW_0, MENUROW_0,
MENUACTION_LABEL, "FEC_SVU", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEC_OKK", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
},
// MENUPAGE_LOAD_FAILED = 48
{ "FET_SG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUROW_0, MENUROW_0,
MENUACTION_LABEL, "FEC_SVU", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_LOAD_FAILED_2 = 49
{ "FET_LG", MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUPAGE_CHOOSE_SAVE_SLOT, MENUROW_0, MENUROW_0,
MENUACTION_LABEL, "FEC_LUN", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_CHOOSE_LOAD_SLOT,
},
// MENUPAGE_FILTER_GAME = 50
{ "FIL_FLT", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
},
// MENUPAGE_START_MENU = 51
{ "FEM_MM", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
MENUACTION_CHANGEMENU, "FEN_STA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
MENUACTION_CHANGEMENU, "FET_OPT", SAVESLOT_NONE, MENUPAGE_OPTIONS,
MENUACTION_CHANGEMENU, "FEM_QT", SAVESLOT_NONE, MENUPAGE_EXIT,
},
// MENUPAGE_PAUSE_MENU = 52
{ "FET_PAU", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
MENUACTION_RESUME, "FEM_RES", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEN_STA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
MENUACTION_CHANGEMENU, "FEP_STA", SAVESLOT_NONE, MENUPAGE_STATS,
MENUACTION_CHANGEMENU, "FEP_BRI", SAVESLOT_NONE, MENUPAGE_BRIEFS,
MENUACTION_CHANGEMENU, "FET_OPT", SAVESLOT_NONE, MENUPAGE_OPTIONS,
MENUACTION_CHANGEMENU, "FEM_QT", SAVESLOT_NONE, MENUPAGE_EXIT,
},
// MENUPAGE_CHOOSE_MODE = 53
{ "FEN_STA", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
},
// 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,
},
// 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,
},
// 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_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_57 = 57
{ "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
},
// MENUPAGE_58 = 58
{ "", MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUPAGE_DISABLED, MENUROW_0, MENUROW_0,
},
};

View File

@ -4,4 +4,9 @@
#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 wchar *GetNameOfSavedGame(int counter) { EAXJMP(0x591B60); }
WRAPPER wchar *GetSavedGameDateAndTime(int counter) { EAXJMP(0x591B50); }
int *Slots = (int*)0x728040;
int *SlotFileName = (int*)0x6F07C8;
int *SlotSaveDate = (int*)0x72B858;

View File

@ -5,3 +5,10 @@ class C_PcSave
public: public:
static void SetSaveDirectory(const char *path); static void SetSaveDirectory(const char *path);
}; };
extern wchar *GetNameOfSavedGame(int counter);
extern wchar *GetSavedGameDateAndTime(int counter);
extern int *Slots;
extern int *SlotFileName;
extern int *SlotSaveDate;

View File

@ -20,56 +20,47 @@ CPlaceable::SetHeading(float angle)
bool bool
CPlaceable::IsWithinArea(float x1, float y1, float x2, float y2) CPlaceable::IsWithinArea(float x1, float y1, float x2, float y2)
{ {
float x, xmin, xmax; float tmp;
float y, ymin, ymax;
xmin = x1; if(x1 > x2){
xmax = x2; tmp = x1;
ymin = y1; x1 = x2;
ymax = y2; x2 = tmp;
if(x2 > x1){
xmin = x2;
xmax = x1;
} }
if(y2 > y1){ if(y1 > y2){
ymin = y2; tmp = y1;
ymax = y1; y1 = y2;
y2 = tmp;
} }
x = GetPosition().x;
y = GetPosition().y; return x1 <= GetPosition().x && GetPosition().x <= x2 &&
return xmin <= x && x <= xmax && y1 <= GetPosition().y && GetPosition().y <= y2;
ymin <= y && y <= ymax;
} }
bool bool
CPlaceable::IsWithinArea(float x1, float y1, float z1, float x2, float y2, float z2) CPlaceable::IsWithinArea(float x1, float y1, float z1, float x2, float y2, float z2)
{ {
float x, xmin, xmax; float tmp;
float y, ymin, ymax;
float z, zmin, zmax; if(x1 > x2){
xmin = x1; tmp = x1;
xmax = x2; x1 = x2;
ymin = y1; x2 = tmp;
ymax = y2;
zmin = z1;
zmax = z2;
if(x2 > x1){
xmin = x2;
xmax = x1;
} }
if(y2 > y1){ if(y1 > y2){
ymin = y2; tmp = y1;
ymax = y1; y1 = y2;
y2 = tmp;
} }
if(z2 > z1){ if(z1 > z2){
zmin = z2; tmp = z1;
zmax = z1; z1 = z2;
z2 = tmp;
} }
x = GetPosition().x;
y = GetPosition().y; return x1 <= GetPosition().x && GetPosition().x <= x2 &&
z = GetPosition().z; y1 <= GetPosition().y && GetPosition().y <= y2 &&
return xmin <= x && x <= xmax && z1 <= GetPosition().z && GetPosition().z <= z2;
ymin <= y && y <= ymax &&
zmin <= z && z <= zmax;
} }
STARTPATCHES STARTPATCHES

File diff suppressed because it is too large Load Diff

View File

@ -53,26 +53,26 @@ struct CBlip
CVector2D m_vec2DPos; CVector2D m_vec2DPos;
CVector m_vecPos; CVector m_vecPos;
int16 m_BlipIndex; int16 m_BlipIndex;
int8 m_bDim; bool m_bDim;
int8 m_bInUse; bool m_bInUse;
float m_Radius; float m_Radius;
int16 m_wScale; int16 m_wScale;
int16 m_eBlipDisplay; // eBlipDisplay int16 m_eBlipDisplay; // eBlipDisplay
int16 m_IconID; // eRadarSprite int16 m_IconID; // eRadarSprite
char gap_46[2];
}; };
static_assert(sizeof(CBlip) == 0x30, "CBlip: error"); static_assert(sizeof(CBlip) == 0x30, "CBlip: error");
// Values for screen space
#define RADAR_LEFT (40.0f)
#define RADAR_BOTTOM (47.0f)
#define RADAR_WIDTH (94.0f)
#define RADAR_HEIGHT (76.0f)
class CRadar class CRadar
{ {
static float cachedSin;
static float cachedCos;
public: public:
static float &m_RadarRange; static float &m_RadarRange;
static CVector2D &vec2DRadarOrigin; static CBlip *ms_RadarTrace; //[NUMRADARBLIPS]
static CBlip *ms_RadarTrace;
static CSprite2d *AsukaSprite; static CSprite2d *AsukaSprite;
static CSprite2d *BombSprite; static CSprite2d *BombSprite;
static CSprite2d *CatSprite; static CSprite2d *CatSprite;
@ -96,30 +96,51 @@ public:
static CSprite2d *RadarSprites[21]; static CSprite2d *RadarSprites[21];
public: public:
static void ClearBlipForEntity(eBlipType type, int32 id);
static void Draw3dMarkers();
static void DrawMap();
static void StreamRadarSections(int x, int y);
static int ClipRadarPoly(CVector2D *out, CVector2D *in);
static void TransformRealWorldToTexCoordSpace(CVector2D *out, CVector2D *in, int x, int y);
static void TransformRadarPointToRealWorldSpace(CVector2D *out, CVector2D *in);
static void DrawRadarSection(int x, int y);
static void RequestMapSection(int x, int y);
static void RemoveMapSection(int x, int y);
static void TransformRadarPointToScreenSpace(CVector2D * out, CVector2D * in);
static void DrawBlips();
static int CalculateBlipAlpha(float dist); static int CalculateBlipAlpha(float dist);
static CRGBA GetRadarTraceColour(uint32 color, bool bright); static void ChangeBlipBrightness(int32 i, int32 bright);
static void ChangeBlipColour(int32 i);
static void ChangeBlipDisplay(int32 i, int16 flag);
static void ChangeBlipScale(int32 i, int16 scale);
static void ClearBlip(int32 i);
static void ClearBlipForEntity(int16 type, int32 id);
static int ClipRadarPoly(CVector2D *out, const CVector2D *in);
static bool DisplayThisBlip(int32 i);
static void Draw3dMarkers();
static void DrawBlips();
static void DrawMap();
static void DrawRadarMap(); static void DrawRadarMap();
static void DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int alpha);
static void TransformRealWorldPointToRadarSpace(CVector2D *out, CVector2D *in);
static float LimitRadarPoint(CVector2D *point);
static void DrawRadarSprite(int sprite, float x, float y, int alpha);
static void ShowRadarMarker(CVector pos, CRGBA color, float radius);
static void ShowRadarTrace(float x, float y, uint32 size, uint32 red, uint32 green, uint32 blue, uint32 alpha);
static void DrawRadarMask(); static void DrawRadarMask();
static void SetRadarMarkerState(int counter, int flag); static void DrawRadarSection(int32 x, int32 y);
static bool DisplayThisBlip(int counter); static void DrawRadarSprite(int32 sprite, float x, float y, int32 alpha);
static void GetTextureCorners(int x, int y, CVector2D * out); static void DrawRotatingRadarSprite(CSprite2d* sprite, float x, float y, float angle, int32 alpha);
static void ClipRadarTileCoords(int *x, int *y); static int32 GetActualBlipArray(int32 i);
static int32 GetNewUniqueBlipIndex(int32 i);
static int32 GetRadarTraceColour(int32 color, bool bright);
static void Initialise();
static float LimitRadarPoint(CVector2D &point);
static void LoadAllRadarBlips(int32);
static void LoadTextures();
static void RemoveRadarSections();
static void RemoveMapSection(int32 x, int32 y);
static void RequestMapSection(int32 x, int32 y);
static void SaveAllRadarBlips(int32);
static void SetBlipSprite(int32 i, int32 icon);
static int SetCoordBlip(int32 type, CVector pos, int32 flag);
static int SetEntityBlip(int32 type, CVector pos, int32 color, int32 flag);
static void SetRadarMarkerState(int32 i, int32 flag);
static void ShowRadarMarker(CVector pos, int16 color, float radius);
static void ShowRadarTrace(float x, float y, uint32 size, uint32 red, uint32 green, uint32 blue, uint32 alpha);
static void Shutdown();
static void StreamRadarSections(CVector posn);
static void StreamRadarSections(int32 x, int32 y);
static void TransformRealWorldToTexCoordSpace(CVector2D &out, const CVector2D &in, int32 x, int32 y);
static void TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D &in);
static void TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &in);
static void TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D &in);
// no in CRadar in the game:
static void GetTextureCorners(int32 x, int32 y, CVector2D *out);
static void ClipRadarTileCoords(int32 &x, int32 &y);
static bool IsPointInsideRadar(const CVector2D &);
static int LineRadarBoxCollision(CVector2D &, const CVector2D &, const CVector2D &);
}; };

View File

@ -108,6 +108,23 @@ GetFirstAtomic(RpClump *clump)
return atm; return atm;
} }
RwTexture*
GetFirstTextureCallback(RwTexture *tex, void *data)
{
*(RwTexture**)data = tex;
return nil;
}
RwTexture*
GetFirstTexture(RwTexDictionary *txd)
{
RwTexture *tex;
tex = nil;
RwTexDictionaryForAllTextures(txd, GetFirstTextureCallback, &tex);
return tex;
}
void void
CameraSize(RwCamera * camera, RwRect * rect, CameraSize(RwCamera * camera, RwRect * rect,
RwReal viewWindow, RwReal aspectRatio) RwReal viewWindow, RwReal aspectRatio)

View File

@ -7,6 +7,7 @@ void DefinedState(void);
RwFrame *GetFirstChild(RwFrame *frame); RwFrame *GetFirstChild(RwFrame *frame);
RwObject *GetFirstObject(RwFrame *frame); RwObject *GetFirstObject(RwFrame *frame);
RpAtomic *GetFirstAtomic(RpClump *clump); RpAtomic *GetFirstAtomic(RpClump *clump);
RwTexture *GetFirstTexture(RwTexDictionary *txd);
RwTexDictionary *RwTexDictionaryGtaStreamRead(RwStream *stream); RwTexDictionary *RwTexDictionaryGtaStreamRead(RwStream *stream);
RwTexDictionary *RwTexDictionaryGtaStreamRead1(RwStream *stream); RwTexDictionary *RwTexDictionaryGtaStreamRead1(RwStream *stream);

File diff suppressed because it is too large Load Diff

View File

@ -14,6 +14,7 @@ enum StreamFlags
STREAMFLAGS_PRIORITY = 0x08, STREAMFLAGS_PRIORITY = 0x08,
STREAMFLAGS_NOFADE = 0x10, STREAMFLAGS_NOFADE = 0x10,
// TODO: this isn't named well, maybe CANT_REMOVE?
STREAMFLAGS_NOT_IN_LIST = STREAMFLAGS_DONT_REMOVE|STREAMFLAGS_SCRIPTOWNED, STREAMFLAGS_NOT_IN_LIST = STREAMFLAGS_DONT_REMOVE|STREAMFLAGS_SCRIPTOWNED,
STREAMFLAGS_KEEP_IN_MEMORY = STREAMFLAGS_DONT_REMOVE|STREAMFLAGS_SCRIPTOWNED|STREAMFLAGS_DEPENDENCY, STREAMFLAGS_KEEP_IN_MEMORY = STREAMFLAGS_DONT_REMOVE|STREAMFLAGS_SCRIPTOWNED|STREAMFLAGS_DEPENDENCY,
}; };
@ -23,13 +24,16 @@ enum StreamLoadState
STREAMSTATE_NOTLOADED = 0, STREAMSTATE_NOTLOADED = 0,
STREAMSTATE_LOADED = 1, STREAMSTATE_LOADED = 1,
STREAMSTATE_INQUEUE = 2, STREAMSTATE_INQUEUE = 2,
STREAMSTATE_READING = 3, // what is this? STREAMSTATE_READING = 3, // channel is reading
STREAMSTATE_STARTED = 4, // first part read STREAMSTATE_STARTED = 4, // first part loaded
}; };
enum ChannelState enum ChannelState
{ {
CHANNELSTATE_0 = 0, CHANNELSTATE_IDLE = 0,
CHANNELSTATE_READING = 1,
CHANNELSTATE_STARTED = 2,
CHANNELSTATE_ERROR = 3,
}; };
class CStreamingInfo class CStreamingInfo
@ -49,17 +53,18 @@ public:
void AddToList(CStreamingInfo *link); void AddToList(CStreamingInfo *link);
void RemoveFromList(void); void RemoveFromList(void);
uint32 GetCdSize(void) { return m_size; } uint32 GetCdSize(void) { return m_size; }
bool IsPriority(void) { return !!(m_flags & STREAMFLAGS_PRIORITY); }
}; };
struct CStreamingChannel struct CStreamingChannel
{ {
int32 modelIds[4]; int32 streamIds[4];
int32 offsets[4]; int32 offsets[4];
int32 state; int32 state;
int32 field24; int32 field24;
int32 position; int32 position;
int32 size; int32 size;
int32 field30; int32 numTries;
int32 status; // from CdStream int32 status; // from CdStream
}; };
@ -79,12 +84,14 @@ public:
static CStreamingInfo &ms_endRequestedList; static CStreamingInfo &ms_endRequestedList;
static int32 &ms_oldSectorX; static int32 &ms_oldSectorX;
static int32 &ms_oldSectorY; static int32 &ms_oldSectorY;
static uint32 &ms_streamingBufferSize; static int32 &ms_streamingBufferSize;
static uint8 **ms_pStreamingBuffer; //[2] static int8 **ms_pStreamingBuffer; //[2]
static int32 &ms_memoryUsed; static int32 &ms_memoryUsed;
static CStreamingChannel *ms_channel; //[2] static CStreamingChannel *ms_channel; //[2]
static int32 &ms_channelError;
static int32 &ms_numVehiclesLoaded; static int32 &ms_numVehiclesLoaded;
static int32 *ms_vehiclesLoaded; //[MAXVEHICLESLOADED] static int32 *ms_vehiclesLoaded; //[MAXVEHICLESLOADED]
static int32 &ms_lastVehicleDeleted;
static CDirectory *&ms_pExtraObjectsDir; static CDirectory *&ms_pExtraObjectsDir;
static int32 &ms_numPriorityRequests; static int32 &ms_numPriorityRequests;
static bool &ms_hasLoadedLODs; static bool &ms_hasLoadedLODs;
@ -104,22 +111,55 @@ public:
static bool ConvertBufferToObject(int8 *buf, int32 streamId); static bool ConvertBufferToObject(int8 *buf, int32 streamId);
static bool FinishLoadingLargeFile(int8 *buf, int32 streamId); static bool FinishLoadingLargeFile(int8 *buf, int32 streamId);
static void RequestModel(int32 model, int32 flags); static void RequestModel(int32 model, int32 flags);
static void ReRequestModel(int32 model) { RequestModel(model, ms_aInfoForModel[model].m_flags); }
static void RequestTxd(int32 txd, int32 flags) { RequestModel(txd + STREAM_OFFSET_TXD, flags); } static void RequestTxd(int32 txd, int32 flags) { RequestModel(txd + STREAM_OFFSET_TXD, flags); }
static void ReRequestTxd(int32 txd) { ReRequestModel(txd + STREAM_OFFSET_TXD); }
static void RequestSubway(void); static void RequestSubway(void);
static void RequestBigBuildings(eLevelName level); static void RequestBigBuildings(eLevelName level);
static void RequestIslands(eLevelName level); static void RequestIslands(eLevelName level);
static void RequestSpecialModel(int32 modelId, const char *modelName, int32 flags); static void RequestSpecialModel(int32 modelId, const char *modelName, int32 flags);
static void RequestSpecialChar(int32 charId, const char *modelName, int32 flags); static void RequestSpecialChar(int32 charId, const char *modelName, int32 flags);
static void DecrementRef(int32 id);
static void RemoveModel(int32 id); static void RemoveModel(int32 id);
static void RemoveTxd(int32 id) { RemoveModel(id + STREAM_OFFSET_TXD); }
static void RemoveUnusedBuildings(eLevelName level);
static void RemoveBuildings(eLevelName level);
static void RemoveUnusedBigBuildings(eLevelName level);
static void RemoveIslandsNotUsed(eLevelName level);
static void RemoveBigBuildings(eLevelName level);
static bool RemoveLoadedVehicle(void);
static bool RemoveLeastUsedModel(void);
static void RemoveAllUnusedModels(void);
static void RemoveUnusedModelsInLoadedList(void);
static bool RemoveReferencedTxds(int32 mem);
static int32 GetAvailableVehicleSlot(void);
static bool IsTxdUsedByRequestedModels(int32 txdId); static bool IsTxdUsedByRequestedModels(int32 txdId);
static bool AddToLoadedVehiclesList(int32 modelId); static bool AddToLoadedVehiclesList(int32 modelId);
static bool IsObjectInCdImage(int32 id);
static void HaveAllBigBuildingsLoaded(eLevelName level);
static void SetModelIsDeletable(int32 id);
static void SetModelTxdIsDeletable(int32 id);
static void SetMissionDoesntRequireModel(int32 id);
static int32 GetCdImageOffset(int32 lastPosn);
static int32 GetNextFileOnCd(int32 position, bool priority);
static void RequestModelStream(int32 ch);
static bool ProcessLoadingChannel(int32 ch);
static void RetryLoadFile(int32 ch);
static void LoadRequestedModels(void);
static void LoadAllRequestedModels(bool priority);
static void FlushChannels(void);
static void FlushRequestList(void);
static void MakeSpaceFor(int32 size); static void MakeSpaceFor(int32 size);
static void ImGonnaUseStreamingMemory(void); static void ImGonnaUseStreamingMemory(void);
static void IHaveUsedStreamingMemory(void); static void IHaveUsedStreamingMemory(void);
static void UpdateMemoryUsed(void); static void UpdateMemoryUsed(void);
static void LoadInitialPeds(void);
static void LoadInitialVehicles(void);
static void LoadScene(CVector *pos); static void LoadScene(CVector *pos);
static void LoadAllRequestedModels(bool); static void LoadAllRequestedModels(bool);
}; };

View File

@ -30,8 +30,9 @@ public:
static float GetTimeScale(void) { return ms_fTimeScale; } static float GetTimeScale(void) { return ms_fTimeScale; }
static inline void SetTimeScale(float ts) { ms_fTimeScale = ts; } static inline void SetTimeScale(float ts) { ms_fTimeScale = ts; }
static inline bool GetIsPaused() { return m_UserPause || m_CodePause; } static bool GetIsPaused() { return m_UserPause || m_CodePause; }
static inline bool GetIsUserPaused() { return m_UserPause; } static bool GetIsUserPaused() { return m_UserPause; }
static void SetCodePause(bool pause) { m_CodePause = pause; }
static void Initialise(void); static void Initialise(void);
static void Shutdown(void); static void Shutdown(void);

View File

@ -592,6 +592,6 @@ WRAPPER CPlayerPed *FindPlayerPed(void) { EAXJMP(0x4A1150); }
WRAPPER CVector &FindPlayerCoors(CVector &v) { EAXJMP(0x4A1030); } WRAPPER CVector &FindPlayerCoors(CVector &v) { EAXJMP(0x4A1030); }
WRAPPER CVehicle *FindPlayerVehicle(void) { EAXJMP(0x4A10C0); } WRAPPER CVehicle *FindPlayerVehicle(void) { EAXJMP(0x4A10C0); }
WRAPPER CVehicle *FindPlayerTrain(void) { EAXJMP(0x4A1120); } WRAPPER CVehicle *FindPlayerTrain(void) { EAXJMP(0x4A1120); }
WRAPPER CVector FindPlayerSpeed(void) { EAXJMP(0x4A1090); } WRAPPER CVector &FindPlayerSpeed(void) { EAXJMP(0x4A1090); }
WRAPPER CVector FindPlayerCentreOfWorld_NoSniperShift(void) { EAXJMP(0x4A11C0); } WRAPPER CVector FindPlayerCentreOfWorld_NoSniperShift(void) { EAXJMP(0x4A11C0); }
WRAPPER float FindPlayerHeading(void) { EAXJMP(0x4A1220); } WRAPPER float FindPlayerHeading(void) { EAXJMP(0x4A1220); }

View File

@ -111,6 +111,6 @@ CPlayerPed *FindPlayerPed(void);
CVector &FindPlayerCoors(CVector &v); CVector &FindPlayerCoors(CVector &v);
CVehicle *FindPlayerVehicle(void); CVehicle *FindPlayerVehicle(void);
CVehicle *FindPlayerTrain(void); CVehicle *FindPlayerTrain(void);
CVector FindPlayerSpeed(void); CVector &FindPlayerSpeed(void);
CVector FindPlayerCentreOfWorld_NoSniperShift(void); CVector FindPlayerCentreOfWorld_NoSniperShift(void);
float FindPlayerHeading(void); float FindPlayerHeading(void);

View File

@ -2,8 +2,7 @@
#include "AnimBlendList.h" #include "AnimBlendList.h"
#include "AnimBlendNode.h" #include "AnimBlendNode.h"
#include "AnimBlendHierarchy.h"
class CAnimBlendHierarchy;
enum { enum {
// TODO // TODO
@ -78,6 +77,8 @@ public:
void UpdateTime(float timeDelta, float relSpeed); void UpdateTime(float timeDelta, float relSpeed);
bool UpdateBlend(float timeDelta); bool UpdateBlend(float timeDelta);
float GetTimeLeft() { return hierarchy->totalLength - currentTime; }
static CAnimBlendAssociation *FromLink(CAnimBlendLink *l) { static CAnimBlendAssociation *FromLink(CAnimBlendLink *l) {
return (CAnimBlendAssociation*)((uint8*)l - offsetof(CAnimBlendAssociation, link)); return (CAnimBlendAssociation*)((uint8*)l - offsetof(CAnimBlendAssociation, link));
} }

View File

@ -0,0 +1,17 @@
#include "common.h"
#include "patcher.h"
#include "AudioManager.h"
cAudioManager &AudioManager = *(cAudioManager*)0x880FC0;
void
cAudioManager::PlayerJustLeftCar(void)
{
// UNUSED: This is a perfectly empty function.
}
WRAPPER void cAudioManager::Service() { EAXJMP(0x57A2A0); }
STARTPATCHES
InjectHook(0x56AD20, &cAudioManager::PlayerJustLeftCar, PATCH_JUMP);
ENDPATCHES

9
src/audio/AudioManager.h Normal file
View File

@ -0,0 +1,9 @@
#pragma once
class cAudioManager {
public:
void PlayerJustLeftCar(void);
void Service();
};
extern cAudioManager &AudioManager;

View File

@ -195,5 +195,7 @@ public:
int32 CreateEntity(int, void*); int32 CreateEntity(int, void*);
void SetEntityStatus(int32, int8); void SetEntityStatus(int32, int8);
void SetRadioInCar(int32); void SetRadioInCar(int32);
uint8 IsMP3RadioChannelAvailable();
}; };
extern cDMAudio &DMAudio; extern cDMAudio &DMAudio;

View File

@ -16,6 +16,8 @@ int32 &gNumRetunePresses = *(int32*)0x650B80;
wchar *pCurrentStation = (wchar*)0x650B9C; wchar *pCurrentStation = (wchar*)0x650B9C;
uint8 &cDisplay = *(uint8*)0x650BA1; uint8 &cDisplay = *(uint8*)0x650BA1;
WRAPPER char* cMusicManager::Get3DProviderName(char) { EAXJMP(0x57A8C0); }
bool cMusicManager::PlayerInCar() bool cMusicManager::PlayerInCar()
{ {
if (!FindPlayerVehicle()) if (!FindPlayerVehicle())

View File

@ -264,6 +264,7 @@ public:
uint8 field_2395; uint8 field_2395;
public: public:
char *Get3DProviderName(char);
bool PlayerInCar(); bool PlayerInCar();
void DisplayRadioStationName(); void DisplayRadioStationName();
}; };

View File

@ -58,9 +58,8 @@ enum Config {
NUMPOINTLIGHTS = 32, NUMPOINTLIGHTS = 32,
NUMONSCREENTIMERENTRIES = 1, NUMONSCREENTIMERENTRIES = 1,
NUMRADARBLIPS = 32,
NUMPICKUPS = 336, NUMPICKUPS = 336,
NUMBLIPS = 32
}; };
#define GTA3_1_1_PATCH #define GTA3_1_1_PATCH
@ -71,3 +70,4 @@ enum Config {
//#define NO_CDCHECK //#define NO_CDCHECK
#define NO_MOVIES #define NO_MOVIES
//#define USE_MY_DOCUMENTS //#define USE_MY_DOCUMENTS
#define NASTY_GAME

View File

@ -2,6 +2,8 @@
#include "patcher.h" #include "patcher.h"
#include "CarCtrl.h" #include "CarCtrl.h"
int &CCarCtrl::NumLawEnforcerCars = *(int*)0x8F1B38;
WRAPPER void CCarCtrl::SwitchVehicleToRealPhysics(CVehicle*) { EAXJMP(0x41F7F0); } WRAPPER void CCarCtrl::SwitchVehicleToRealPhysics(CVehicle*) { EAXJMP(0x41F7F0); }
WRAPPER void CCarCtrl::AddToCarArray(int id, int vehclass) { EAXJMP(0x4182F0); } WRAPPER void CCarCtrl::AddToCarArray(int id, int vehclass) { EAXJMP(0x4182F0); }
WRAPPER void CCarCtrl::UpdateCarCount(CVehicle*, bool) { EAXJMP(0x4202E0); } WRAPPER void CCarCtrl::UpdateCarCount(CVehicle*, bool) { EAXJMP(0x4202E0); }

View File

@ -8,4 +8,6 @@ public:
static void SwitchVehicleToRealPhysics(CVehicle*); static void SwitchVehicleToRealPhysics(CVehicle*);
static void AddToCarArray(int id, int vehclass); static void AddToCarArray(int id, int vehclass);
static void UpdateCarCount(CVehicle*, bool); static void UpdateCarCount(CVehicle*, bool);
static int32 &NumLawEnforcerCars;
}; };

View File

@ -68,7 +68,7 @@ WRAPPER void CGarages::PrintMessages(void) { EAXJMP(0x426310); }
#else #else
void CGarages::PrintMessages() void CGarages::PrintMessages()
{ {
if (CTimer::GetTimeInMilliseconds() > CGarages::MessageStartTime && CTimer::GetTimeInMilliseconds() < CGarages::MessageEndTime) { if (CTimer::GetTimeInMilliseconds() > MessageStartTime && CTimer::GetTimeInMilliseconds() < MessageEndTime) {
CFont::SetScale(SCREEN_SCALE_X(1.2f / 2), SCREEN_SCALE_Y(1.5f / 2)); // BUG: game doesn't use macro here. CFont::SetScale(SCREEN_SCALE_X(1.2f / 2), SCREEN_SCALE_Y(1.5f / 2)); // BUG: game doesn't use macro here.
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetJustifyOff(); CFont::SetJustifyOff();
@ -77,16 +77,16 @@ void CGarages::PrintMessages()
CFont::SetCentreOn(); CFont::SetCentreOn();
CFont::SetFontStyle(FONT_BANK); CFont::SetFontStyle(FONT_BANK);
if (CGarages::MessageNumberInString2 < 0) { if (MessageNumberInString2 < 0) {
if (CGarages::MessageNumberInString < 0) { if (MessageNumberInString < 0) {
CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString((SCREEN_WIDTH/ 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(-84.0f), TheText.Get(CGarages::MessageIDString)); CFont::PrintString((SCREEN_WIDTH/ 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(-84.0f), TheText.Get(MessageIDString));
CFont::SetColor(CRGBA(89, 115, 150, 255)); CFont::SetColor(CRGBA(89, 115, 150, 255));
CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(-84.0f), TheText.Get(CGarages::MessageIDString)); CFont::PrintString((SCREEN_WIDTH / 2), (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(-84.0f), TheText.Get(MessageIDString));
} }
else { else {
CMessages::InsertNumberInString(TheText.Get(CGarages::MessageIDString), CGarages::MessageNumberInString, -1, -1, -1, -1, -1, gUString); CMessages::InsertNumberInString(TheText.Get(MessageIDString), MessageNumberInString, -1, -1, -1, -1, -1, gUString);
CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString((SCREEN_WIDTH / 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(-84.0f + 2.0 - 40.0f), gUString); CFont::PrintString((SCREEN_WIDTH / 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(-84.0f + 2.0 - 40.0f), gUString);
@ -96,7 +96,7 @@ void CGarages::PrintMessages()
} }
} }
else { else {
CMessages::InsertNumberInString(TheText.Get(CGarages::MessageIDString), CGarages::MessageNumberInString2, -1, -1, -1, -1, -1, gUString); CMessages::InsertNumberInString(TheText.Get(MessageIDString), MessageNumberInString, MessageNumberInString2, -1, -1, -1, -1, gUString);
CFont::SetColor(CRGBA(0, 0, 0, 255)); CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString((SCREEN_WIDTH / 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(-84.0f + 2.0 - 40.0f), gUString); CFont::PrintString((SCREEN_WIDTH / 2) + SCREEN_SCALE_X(2.0f), (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(-84.0f + 2.0 - 40.0f), gUString);

View File

@ -0,0 +1,40 @@
#include "common.h"
#include "patcher.h"
#include "PedPlacement.h"
#include "World.h"
void
CPedPlacement::FindZCoorForPed(CVector* pos)
{
float zForPed;
float startZ = pos->z - 100.0f;
float foundColZ = -100.0f;
float foundColZ2 = -100.0f;
CColPoint foundCol;
CEntity* foundEnt;
CVector vec(
pos->x,
pos->y,
pos->z + 1.0f
);
if (CWorld::ProcessVerticalLine(vec, startZ, foundCol, foundEnt, true, false, false, false, true, false, false))
foundColZ = foundCol.point.z;
// Adjust coords and do a second test
vec.x += 0.1f;
vec.y += 0.1f;
if (CWorld::ProcessVerticalLine(vec, startZ, foundCol, foundEnt, true, false, false, false, true, false, false))
foundColZ2 = foundCol.point.z;
zForPed = max(foundColZ, foundColZ2);
if (zForPed > -99.0f)
pos->z = 1.04f + zForPed;
}
STARTPATCHES
InjectHook(0x4EE340, &CPedPlacement::FindZCoorForPed, PATCH_JUMP);
ENDPATCHES

View File

@ -0,0 +1,8 @@
#pragma once
class CVector;
class CPedPlacement {
public:
static void FindZCoorForPed(CVector* pos);
};

View File

@ -22,9 +22,9 @@ enum
PEDTYPE_EMERGENCY, PEDTYPE_EMERGENCY,
PEDTYPE_FIREMAN, PEDTYPE_FIREMAN,
PEDTYPE_CRIMINAL, PEDTYPE_CRIMINAL,
PEDTYPE_SPECIAL,
PEDTYPE_PROSTITUTE,
PEDTYPE_UNUSED1, PEDTYPE_UNUSED1,
PEDTYPE_PROSTITUTE,
PEDTYPE_SPECIAL,
PEDTYPE_UNUSED2, PEDTYPE_UNUSED2,
NUM_PEDTYPES NUM_PEDTYPES

View File

@ -24,6 +24,8 @@
#include "Timer.h" #include "Timer.h"
#include "Weather.h" #include "Weather.h"
#include "Zones.h" #include "Zones.h"
#include "Font.h"
#include "Text.h"
uint8 &CReplay::Mode = *(uint8*)0x95CD5B; uint8 &CReplay::Mode = *(uint8*)0x95CD5B;
CAddressInReplayBuffer &CReplay::Record = *(CAddressInReplayBuffer*)0x942F7C; CAddressInReplayBuffer &CReplay::Record = *(CAddressInReplayBuffer*)0x942F7C;
@ -451,7 +453,6 @@ WRAPPER bool CReplay::PlayBackThisFrameInterpolation(CAddressInReplayBuffer *buf
WRAPPER void CReplay::FinishPlayback(void) { EAXJMP(0x595B20); } WRAPPER void CReplay::FinishPlayback(void) { EAXJMP(0x595B20); }
WRAPPER void CReplay::Shutdown(void) { EAXJMP(0x595BD0); } WRAPPER void CReplay::Shutdown(void) { EAXJMP(0x595BD0); }
WRAPPER void CReplay::ProcessReplayCamera(void) { EAXJMP(0x595C40); } WRAPPER void CReplay::ProcessReplayCamera(void) { EAXJMP(0x595C40); }
WRAPPER void CReplay::Display(void) { EAXJMP(0x595EE0); }
#if 0 #if 0
WRAPPER void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float cam_z, bool load_scene) { EAXJMP(0x596030); } WRAPPER void CReplay::TriggerPlayback(uint8 cam_mode, float cam_x, float cam_y, float cam_z, bool load_scene) { EAXJMP(0x596030); }
@ -732,6 +733,23 @@ WRAPPER bool CReplay::ShouldStandardCameraBeProcessed(void) { EAXJMP(0x597680);
WRAPPER void CReplay::ProcessLookAroundCam(void) { EAXJMP(0x5976C0); } WRAPPER void CReplay::ProcessLookAroundCam(void) { EAXJMP(0x5976C0); }
WRAPPER size_t CReplay::FindSizeOfPacket(uint8 type) { EAXJMP(0x597CC0); } WRAPPER size_t CReplay::FindSizeOfPacket(uint8 type) { EAXJMP(0x597CC0); }
#if 0
WRAPPER void CReplay::Display(void) { EAXJMP(0x595EE0); }
#else
void CReplay::Display()
{
if (CReplay::IsPlayingBack() && CTimer::GetFrameCounter() + 1 & 0x20) {
CFont::SetPropOn();
CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(1.5f), SCREEN_SCALE_Y(1.5f));
CFont::SetAlignment(ALIGN_LEFT);
CFont::SetColor(CRGBA(255, 255, 200, 200));
CFont::SetFontStyle(FONT_BANK);
CFont::PrintString(SCREEN_SCALE_X(63.5f), SCREEN_SCALE_Y(30.0f), TheText.Get("REPLAY"));
}
}
#endif
STARTPATCHES STARTPATCHES
InjectHook(0x592FC0, PrintElementsInPtrList, PATCH_JUMP); InjectHook(0x592FC0, PrintElementsInPtrList, PATCH_JUMP);
InjectHook(0x592FE0, CReplay::Init, PATCH_JUMP); InjectHook(0x592FE0, CReplay::Init, PATCH_JUMP);

View File

@ -22,5 +22,6 @@ CBuilding::ReplaceWithNewModel(int32 id)
} }
STARTPATCHES STARTPATCHES
InjectHook(0x4057D0, &CBuilding::ctor, PATCH_JUMP);
InjectHook(0x405850, &CBuilding::ReplaceWithNewModel, PATCH_JUMP); InjectHook(0x405850, &CBuilding::ReplaceWithNewModel, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -15,5 +15,7 @@ public:
void ReplaceWithNewModel(int32 id); void ReplaceWithNewModel(int32 id);
virtual bool GetIsATreadable(void) { return false; } virtual bool GetIsATreadable(void) { return false; }
CBuilding *ctor(void) { return ::new (this) CBuilding(); }
}; };
static_assert(sizeof(CBuilding) == 0x64, "CBuilding: error"); static_assert(sizeof(CBuilding) == 0x64, "CBuilding: error");

View File

@ -339,9 +339,9 @@ CEntity::GetBoundRect(void)
return rect; return rect;
} }
void WRAPPER void
CEntity::PreRender(void) CEntity::PreRender(void)
{ { EAXJMP(0x474350);
} }
void void
@ -448,6 +448,7 @@ CEntity::PruneReferences(void)
} }
STARTPATCHES STARTPATCHES
InjectHook(0x473C30, &CEntity::ctor, PATCH_JUMP);
InjectHook(0x4742C0, (void (CEntity::*)(CVector&))&CEntity::GetBoundCentre, PATCH_JUMP); InjectHook(0x4742C0, (void (CEntity::*)(CVector&))&CEntity::GetBoundCentre, PATCH_JUMP);
InjectHook(0x474310, &CEntity::GetBoundRadius, PATCH_JUMP); InjectHook(0x474310, &CEntity::GetBoundRadius, PATCH_JUMP);
InjectHook(0x474C10, &CEntity::GetIsTouching, PATCH_JUMP); InjectHook(0x474C10, &CEntity::GetIsTouching, PATCH_JUMP);

View File

@ -155,6 +155,7 @@ public:
// to make patching virtual functions possible // to make patching virtual functions possible
CEntity *ctor(void) { return ::new (this) CEntity(); }
void Add_(void) { CEntity::Add(); } void Add_(void) { CEntity::Add(); }
void Remove_(void) { CEntity::Remove(); } void Remove_(void) { CEntity::Remove(); }
void CreateRwObject_(void) { CEntity::CreateRwObject(); } void CreateRwObject_(void) { CEntity::CreateRwObject(); }

View File

@ -10,11 +10,19 @@
#include "PlayerPed.h" #include "PlayerPed.h"
#include "General.h" #include "General.h"
#include "VisibilityPlugins.h" #include "VisibilityPlugins.h"
#include "AudioManager.h"
#include "HandlingMgr.h"
#include "Replay.h"
#include "PedPlacement.h"
bool &CPed::bNastyLimbsCheat = *(bool*)0x95CD44; bool &CPed::bNastyLimbsCheat = *(bool*)0x95CD44;
bool &CPed::bPedCheat2 = *(bool*)0x95CD5A; bool &CPed::bPedCheat2 = *(bool*)0x95CD5A;
bool &CPed::bPedCheat3 = *(bool*)0x95CD59; bool &CPed::bPedCheat3 = *(bool*)0x95CD59;
CVector &CPed::offsetToOpenRegularCarDoor = *(CVector*)0x62E030;
CVector &CPed::offsetToOpenLowCarDoor = *(CVector*)0x62E03C;
CVector &CPed::offsetToOpenVanDoor = *(CVector*)0x62E048;
void *CPed::operator new(size_t sz) { return CPools::GetPedPool()->New(); } void *CPed::operator new(size_t sz) { return CPools::GetPedPool()->New(); }
void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); } void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); }
@ -24,6 +32,9 @@ WRAPPER void CPed::SetDie(AnimationId anim, float arg1, float arg2) { EAXJMP(0x4
WRAPPER void CPed::SpawnFlyingComponent(int, int8) { EAXJMP(0x4EB060); } WRAPPER void CPed::SpawnFlyingComponent(int, int8) { EAXJMP(0x4EB060); }
WRAPPER void CPed::RestorePreviousState(void) { EAXJMP(0x4C5E30); } WRAPPER void CPed::RestorePreviousState(void) { EAXJMP(0x4C5E30); }
WRAPPER void CPed::ClearAttack(void) { EAXJMP(0x4E6790); } WRAPPER void CPed::ClearAttack(void) { EAXJMP(0x4E6790); }
WRAPPER void CPed::PedSetQuickDraggedOutCarPositionCB(CAnimBlendAssociation *dragAssoc, void *arg) { EAXJMP(0x4E2480); }
WRAPPER void CPed::PedSetDraggedOutCarPositionCB(CAnimBlendAssociation *dragAssoc, void *arg) { EAXJMP(0x4E2920); }
WRAPPER void CPed::SetPedPositionInCar(void) { EAXJMP(0x4D4970); }
static char ObjectiveText[34][28] = { static char ObjectiveText[34][28] = {
"No Obj", "No Obj",
@ -183,9 +194,8 @@ static char WaitStateText[21][16] = {
static RwObject* static RwObject*
RemoveAllModelCB(RwObject *object, void *data) RemoveAllModelCB(RwObject *object, void *data)
{ {
RpAtomic* atomic = (RpAtomic*)object; RpAtomic *atomic = (RpAtomic*)object;
if (CVisibilityPlugins::GetAtomicModelInfo(atomic)) if (CVisibilityPlugins::GetAtomicModelInfo(atomic)) {
{
RpClumpRemoveAtomic(atomic->clump, atomic); RpClumpRemoveAtomic(atomic->clump, atomic);
RpAtomicDestroy(atomic); RpAtomicDestroy(atomic);
} }
@ -299,6 +309,14 @@ CPed::UseGroundColModel(void)
m_nPedState == PED_DEAD; m_nPedState == PED_DEAD;
} }
bool
CPed::CanSetPedState(void)
{
return m_nPedState != PED_DIE && m_nPedState != PED_ARRESTED &&
m_nPedState != PED_ENTER_CAR && m_nPedState != PED_CARJACK && m_nPedState != PED_DRAG_FROM_CAR && m_nPedState != PED_STEAL_CAR;
}
void void
CPed::AddWeaponModel(int id) CPed::AddWeaponModel(int id)
{ {
@ -398,8 +416,9 @@ CPed::RemoveBodyPart(PedNode nodeId, int8 unk)
RecurseFrameChildrenVisibilityCB(frame, 0); RecurseFrameChildrenVisibilityCB(frame, 0);
pos.x = 0.0f; pos.x = 0.0f;
pos.z = 0.0f;
pos.y = 0.0f; pos.y = 0.0f;
pos.z = 0.0f;
for (frame = RwFrameGetParent(frame); frame; frame = RwFrameGetParent(frame)) for (frame = RwFrameGetParent(frame); frame; frame = RwFrameGetParent(frame))
RwV3dTransformPoints(&pos, &pos, 1, RwFrameGetMatrix(frame)); RwV3dTransformPoints(&pos, &pos, 1, RwFrameGetMatrix(frame));
@ -490,11 +509,11 @@ CPed::OurPedCanSeeThisOne(CEntity *target)
// Check if target is behind ped // Check if target is behind ped
if (DotProduct2D(dist, CVector2D(this->GetForward())) < 0.0f) if (DotProduct2D(dist, CVector2D(this->GetForward())) < 0.0f)
return 0; return false;
// Check if target is too far away // Check if target is too far away
if (dist.Magnitude() < 40.0f) if (dist.Magnitude() >= 40.0f)
return 0; return false;
// Check line of sight from head // Check line of sight from head
CVector headPos = this->GetPosition(); CVector headPos = this->GetPosition();
@ -589,7 +608,7 @@ CPed::IsPedHeadAbovePos(float zOffset)
RwMatrix mat; RwMatrix mat;
CPedIK::GetWorldMatrix(GetNodeFrame(PED_HEAD), &mat); CPedIK::GetWorldMatrix(GetNodeFrame(PED_HEAD), &mat);
return zOffset + GetPosition().z >= mat.pos.z; return zOffset + GetPosition().z < RwMatrixGetPos(&mat)->z;
} }
void void
@ -602,22 +621,24 @@ CPed::FinishedAttackCB(CAnimBlendAssociation *attackAssoc, void *arg)
if (attackAssoc) { if (attackAssoc) {
switch (attackAssoc->animId) { switch (attackAssoc->animId) {
case ANIM_WEAPON_START_THROW: case ANIM_WEAPON_START_THROW:
if ((!ped->IsPlayer() || ((CPlayerPed*)ped)->field_1376) && ped->IsPlayer()) if ((!ped->IsPlayer() || ((CPlayerPed*)ped)->field_1380) && ped->IsPlayer())
{ {
attackAssoc->blendDelta = -1000.0; attackAssoc->blendDelta = -1000.0f;
newAnim = CAnimManager::AddAnimation((RpClump*)ped->m_rwObject, ASSOCGRP_STD, ANIM_WEAPON_THROWU); newAnim = CAnimManager::AddAnimation((RpClump*)ped->m_rwObject, ASSOCGRP_STD, ANIM_WEAPON_THROWU);
} else { } else {
attackAssoc->blendDelta = -1000.0; attackAssoc->blendDelta = -1000.0f;
newAnim = CAnimManager::AddAnimation((RpClump*)ped->m_rwObject, ASSOCGRP_STD, ANIM_WEAPON_THROW); newAnim = CAnimManager::AddAnimation((RpClump*)ped->m_rwObject, ASSOCGRP_STD, ANIM_WEAPON_THROW);
} }
newAnim->SetFinishCallback(CPed::FinishedAttackCB, ped); newAnim->SetFinishCallback(FinishedAttackCB, ped);
break; return;
case ANIM_FIGHT_PPUNCH: case ANIM_FIGHT_PPUNCH:
attackAssoc->blendDelta = -8.0; attackAssoc->blendDelta = -8.0f;
attackAssoc->flags |= ASSOC_DELETEFADEDOUT; attackAssoc->flags |= ASSOC_DELETEFADEDOUT;
ped->ClearAttack(); ped->ClearAttack();
break; return;
case ANIM_WEAPON_THROW: case ANIM_WEAPON_THROW:
case ANIM_WEAPON_THROWU: case ANIM_WEAPON_THROWU:
if (ped->GetWeapon()->m_nAmmoTotal > 0) { if (ped->GetWeapon()->m_nAmmoTotal > 0) {
@ -626,12 +647,11 @@ CPed::FinishedAttackCB(CAnimBlendAssociation *attackAssoc, void *arg)
} }
break; break;
default: default:
if (!ped->m_ped_flagA4)
ped->ClearAttack();
break; break;
} }
} else if (!ped->m_ped_flagA4) }
if (!ped->m_ped_flagA4)
ped->ClearAttack(); ped->ClearAttack();
} }
@ -658,7 +678,7 @@ CPed::Attack(void)
ourWeaponFire = ourWeapon->m_eWeaponFire; ourWeaponFire = ourWeapon->m_eWeaponFire;
weaponAnimAssoc = RpAnimBlendClumpGetAssociation((RpClump*)m_rwObject, ourWeapon->m_AnimToPlay); weaponAnimAssoc = RpAnimBlendClumpGetAssociation((RpClump*)m_rwObject, ourWeapon->m_AnimToPlay);
lastReloadWasInFuture = m_ped_flagA4; lastReloadWasInFuture = m_ped_flagA4;
reloadAnimAssoc = 0; reloadAnimAssoc = nil;
reloadAnim = NUM_ANIMS; reloadAnim = NUM_ANIMS;
delayBetweenAnimAndFire = ourWeapon->m_fAnimFrameFire; delayBetweenAnimAndFire = ourWeapon->m_fAnimFrameFire;
weaponAnim = ourWeapon->m_AnimToPlay; weaponAnim = ourWeapon->m_AnimToPlay;
@ -676,7 +696,7 @@ CPed::Attack(void)
if (reloadAnimAssoc) { if (reloadAnimAssoc) {
if (!CPed::IsPlayer() || ((CPlayerPed*)this)->field_1380) if (!CPed::IsPlayer() || ((CPlayerPed*)this)->field_1380)
CPed::ClearAttack(); ClearAttack();
return; return;
} }
@ -686,12 +706,13 @@ CPed::Attack(void)
lastReloadWasInFuture = true; lastReloadWasInFuture = true;
if (!weaponAnimAssoc) { if (!weaponAnimAssoc) {
if (ourWeapon->m_bThrow) { weaponAnimAssoc = RpAnimBlendClumpGetAssociation((RpClump*)m_rwObject, ourWeapon->m_Anim2ToPlay);
delayBetweenAnimAndFire = ourWeapon->m_fAnim2FrameFire;
// Long throw granade, molotov
if (!weaponAnimAssoc && ourWeapon->m_bThrow) {
weaponAnimAssoc = RpAnimBlendClumpGetAssociation((RpClump*) m_rwObject, ANIM_WEAPON_THROWU); weaponAnimAssoc = RpAnimBlendClumpGetAssociation((RpClump*) m_rwObject, ANIM_WEAPON_THROWU);
delayBetweenAnimAndFire = 0.2f; delayBetweenAnimAndFire = 0.2f;
} else {
weaponAnimAssoc = RpAnimBlendClumpGetAssociation((RpClump*) m_rwObject, ourWeapon->m_Anim2ToPlay);
delayBetweenAnimAndFire = ourWeapon->m_fAnim2FrameFire;
} }
} }
if (weaponAnimAssoc) { if (weaponAnimAssoc) {
@ -739,15 +760,15 @@ CPed::Attack(void)
// If reloading just began, start the animation // If reloading just began, start the animation
if (GetWeapon()->m_eWeaponState == WEAPONSTATE_RELOADING && reloadAnim != NUM_ANIMS && !reloadAnimAssoc) { if (GetWeapon()->m_eWeaponState == WEAPONSTATE_RELOADING && reloadAnim != NUM_ANIMS && !reloadAnimAssoc) {
CAnimManager::BlendAnimation((RpClump*) m_rwObject, ASSOCGRP_STD, reloadAnim, 8.0f); CAnimManager::BlendAnimation((RpClump*) m_rwObject, ASSOCGRP_STD, reloadAnim, 8.0f);
CPed::ClearLookFlag(); ClearLookFlag();
CPed::ClearAimFlag(); ClearAimFlag();
m_ped_flagA4 = false; m_ped_flagA4 = false;
m_ped_flagA8 = false; bIsPointingGunAt = false;
m_lastHitTime = CTimer::GetTimeInMilliseconds(); m_lastHitTime = CTimer::GetTimeInMilliseconds();
return; return;
} }
} else { } else {
if (weaponAnimAssoc->animId <= ANIM_WEAPON_BAT_V) { if (weaponAnimAssoc->animId == ANIM_WEAPON_BAT_V || weaponAnimAssoc->animId == ANIM_WEAPON_BAT_H) {
DMAudio.PlayOneShot(uAudioEntityId, SOUND_WEAPON_BAT_ATTACK, 1.0f); DMAudio.PlayOneShot(uAudioEntityId, SOUND_WEAPON_BAT_ATTACK, 1.0f);
} else if (weaponAnimAssoc->animId == ANIM_FIGHT_PPUNCH) { } else if (weaponAnimAssoc->animId == ANIM_FIGHT_PPUNCH) {
DMAudio.PlayOneShot(uAudioEntityId, SOUND_WEAPON_PUNCH_ATTACK, 0.0f); DMAudio.PlayOneShot(uAudioEntityId, SOUND_WEAPON_PUNCH_ATTACK, 0.0f);
@ -814,24 +835,22 @@ CPed::Attack(void)
CAnimManager::BlendAnimation((RpClump*) m_rwObject, ASSOCGRP_STD, ourWeapon->m_Anim2ToPlay, 8.0f); CAnimManager::BlendAnimation((RpClump*) m_rwObject, ASSOCGRP_STD, ourWeapon->m_Anim2ToPlay, 8.0f);
} }
} else { } else {
CPed::ClearAimFlag(); ClearAimFlag();
// Echoes of bullets, at the end of the attack. (Bug: doesn't play while reloading) // Echoes of bullets, at the end of the attack. (Bug: doesn't play while reloading)
if (weaponAnimAssoc->currentTime - weaponAnimAssoc->timeStep < ourWeapon->m_fAnimLoopEnd) { if (weaponAnimAssoc->currentTime - weaponAnimAssoc->timeStep <= ourWeapon->m_fAnimLoopEnd) {
if (ourWeaponType < WEAPONTYPE_SNIPERRIFLE) { switch (ourWeaponType) {
switch (ourWeaponType) { case WEAPONTYPE_UZI:
case WEAPONTYPE_UZI: DMAudio.PlayOneShot(uAudioEntityId, SOUND_WEAPON_UZI_BULLET_ECHO, 0.0f);
DMAudio.PlayOneShot(uAudioEntityId, SOUND_WEAPON_UZI_BULLET_ECHO, 0.0f); break;
break; case WEAPONTYPE_AK47:
case WEAPONTYPE_AK47: DMAudio.PlayOneShot(uAudioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, 0.0f);
DMAudio.PlayOneShot(uAudioEntityId, SOUND_WEAPON_AK47_BULLET_ECHO, 0.0f); break;
break; case WEAPONTYPE_M16:
case WEAPONTYPE_M16: DMAudio.PlayOneShot(uAudioEntityId, SOUND_WEAPON_M16_BULLET_ECHO, 0.0f);
DMAudio.PlayOneShot(uAudioEntityId, SOUND_WEAPON_M16_BULLET_ECHO, 0.0f); break;
break; default:
default: break;
break;
}
} }
} }
@ -885,7 +904,7 @@ CPed::RemoveWeaponModel(int modelId)
void void
CPed::SetCurrentWeapon(eWeaponType weaponType) CPed::SetCurrentWeapon(eWeaponType weaponType)
{ {
CWeaponInfo* weaponInfo; CWeaponInfo *weaponInfo;
if (HasWeapon(weaponType)) { if (HasWeapon(weaponType)) {
weaponInfo = CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType); weaponInfo = CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType);
@ -909,9 +928,7 @@ CPed::SelectGunIfArmed(void)
if (m_weapons[i].m_nAmmoTotal > 0) { if (m_weapons[i].m_nAmmoTotal > 0) {
weaponType = m_weapons[i].m_eWeaponType; weaponType = m_weapons[i].m_eWeaponType;
// Original condition was ridiculous if (weaponType >= WEAPONTYPE_COLT45 && weaponType != WEAPONTYPE_M16 && weaponType <= WEAPONTYPE_FLAMETHROWER) {
// if (weaponType == WEAPONTYPE_COLT45 || weaponType < WEAPONTYPE_M16 || weaponType < WEAPONTYPE_FLAMETHROWER || weaponType == WEAPONTYPE_FLAMETHROWER)
if (weaponType < WEAPONTYPE_MOLOTOV) {
SetCurrentWeapon(weaponType); SetCurrentWeapon(weaponType);
return true; return true;
} }
@ -960,7 +977,7 @@ CPed::ClearPointGunAt(void)
ClearLookFlag(); ClearLookFlag();
ClearAimFlag(); ClearAimFlag();
m_ped_flagA8 = false; bIsPointingGunAt = false;
if (m_nPedState == PED_AIM_GUN) { if (m_nPedState == PED_AIM_GUN) {
RestorePreviousState(); RestorePreviousState();
weaponInfo = CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType); weaponInfo = CWeaponInfo::GetWeaponInfo(GetWeapon()->m_eWeaponType);
@ -975,6 +992,477 @@ CPed::ClearPointGunAt(void)
} }
} }
void
CPed::BeingDraggedFromCar(void)
{
CAnimBlendAssociation *animAssoc;
AnimationId enterAnim;
bool dontRunAnim = false;
PedLineUpPhase lineUpType;
if (!m_pVehicleAnim) {
CAnimManager::BlendAnimation((RpClump*) m_rwObject, m_animGroup, ANIM_IDLE_STANCE, 100.0f);
animAssoc = RpAnimBlendClumpGetAssociation((RpClump*) m_rwObject, ANIM_CAR_SIT);
if (!animAssoc) {
animAssoc = RpAnimBlendClumpGetAssociation((RpClump*) m_rwObject, ANIM_CAR_LSIT);
if (!animAssoc) {
animAssoc = RpAnimBlendClumpGetAssociation((RpClump*) m_rwObject, ANIM_CAR_SITP);
if (!animAssoc)
animAssoc = RpAnimBlendClumpGetAssociation((RpClump*) m_rwObject, ANIM_CAR_SITPLO);
}
}
if (animAssoc)
animAssoc->blendDelta = -1000.0f;
if (m_vehEnterType == VEHICLE_ENTER_FRONT_LEFT || m_vehEnterType == VEHICLE_ENTER_REAR_LEFT) {
if (m_ped_flagF10) {
enterAnim = ANIM_CAR_QJACKED;
} else if (m_pMyVehicle->bIsLow) {
enterAnim = ANIM_CAR_LJACKED_LHS;
} else {
enterAnim = ANIM_CAR_JACKED_LHS;
}
} else if (m_vehEnterType == VEHICLE_ENTER_FRONT_RIGHT || m_vehEnterType == VEHICLE_ENTER_REAR_RIGHT) {
if (m_pMyVehicle->bIsLow)
enterAnim = ANIM_CAR_LJACKED_RHS;
else
enterAnim = ANIM_CAR_JACKED_RHS;
} else
dontRunAnim = true;
if (!dontRunAnim)
m_pVehicleAnim = CAnimManager::AddAnimation((RpClump*) m_rwObject, ASSOCGRP_STD, enterAnim);
m_pVehicleAnim->SetFinishCallback(PedSetDraggedOutCarCB, this);
lineUpType = LINE_UP_TO_CAR_START;
} else if (m_pVehicleAnim->currentTime <= 1.4f) {
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
lineUpType = LINE_UP_TO_CAR_START;
} else {
lineUpType = LINE_UP_TO_CAR_2;
}
LineUpPedWithCar(lineUpType);
}
void
CPed::RestartNonPartialAnims(void)
{
CAnimBlendAssociation* assoc;
for (assoc = RpAnimBlendClumpGetFirstAssociation((RpClump*)m_rwObject); !assoc; assoc = RpAnimBlendGetNextAssociation(assoc)) {
if (!assoc->IsPartial())
assoc->flags |= ASSOC_RUNNING;
}
}
void
CPed::PedSetDraggedOutCarCB(CAnimBlendAssociation *dragAssoc, void *arg)
{
CAnimBlendAssociation *quickJackedAssoc;
CVehicle *vehicle;
CPed *ped = (CPed*)arg;
eWeaponType weaponType = ped->GetWeapon()->m_eWeaponType;
quickJackedAssoc = RpAnimBlendClumpGetAssociation((RpClump*) ped->m_rwObject, ANIM_CAR_QJACKED);
if (ped->m_nPedState != PED_ARRESTED) {
ped->m_nLastPedState = PED_NONE;
if (dragAssoc)
dragAssoc->blendDelta = -1000.0;
}
ped->RestartNonPartialAnims();
ped->m_pVehicleAnim = nil;
ped->m_pSeekTarget = nil;
vehicle = ped->m_pMyVehicle;
switch (ped->m_vehEnterType) {
case VEHICLE_ENTER_FRONT_RIGHT:
vehicle->m_nGettingOutFlags &= ~GETTING_IN_OUT_FR;
break;
case VEHICLE_ENTER_REAR_RIGHT:
vehicle->m_nGettingOutFlags &= ~GETTING_IN_OUT_RR;
break;
case VEHICLE_ENTER_FRONT_LEFT:
vehicle->m_nGettingOutFlags &= ~GETTING_IN_OUT_FL;
break;
case VEHICLE_ENTER_REAR_LEFT:
vehicle->m_nGettingOutFlags &= ~GETTING_IN_OUT_RL;
break;
}
if (vehicle->pDriver == ped) {
vehicle->RemoveDriver();
if (vehicle->m_nDoorLock == CARLOCK_COP_CAR)
vehicle->m_nDoorLock = CARLOCK_UNLOCKED;
if (ped->m_nPedType == PEDTYPE_COP && vehicle->IsLawEnforcementVehicle())
vehicle->ChangeLawEnforcerState(false);
} else {
for (int i = 0; i < vehicle->m_nNumMaxPassengers; i++) {
if (vehicle->pPassengers[i] == ped) {
vehicle->pPassengers[i] = nil;
vehicle->m_nNumPassengers--;
}
}
}
ped->bInVehicle = false;
if (ped->IsPlayer())
AudioManager.PlayerJustLeftCar();
if (quickJackedAssoc) {
dragAssoc->SetDeleteCallback(PedSetQuickDraggedOutCarPositionCB, ped);
} else {
dragAssoc->SetDeleteCallback(PedSetDraggedOutCarPositionCB, ped);
if (ped->CanSetPedState())
CAnimManager::BlendAnimation((RpClump*) ped->m_rwObject, ASSOCGRP_STD, ANIM_GETUP1, 1000.0f);
}
// Only uzi can be used on cars, so previous weapon was stored
if (ped->IsPlayer() && weaponType == WEAPONTYPE_UZI) {
if (ped->m_storedWeapon != NO_STORED_WEAPON) {
ped->SetCurrentWeapon(ped->m_storedWeapon);
ped->m_storedWeapon = NO_STORED_WEAPON;
}
} else {
ped->AddWeaponModel(CWeaponInfo::GetWeaponInfo(weaponType)->m_nModelId);
}
ped->m_nStoredActionState = 0;
ped->m_ped_flagI4 = false;
}
void
CPed::GetLocalPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float seatPosMult)
{
CVehicleModelInfo *vehModel;
CVector vehDoorPos;
CVector vehDoorOffset;
float seatOffset;
vehModel = (CVehicleModelInfo*) CModelInfo::GetModelInfo(veh->m_modelIndex);
if (veh->bIsVan && (enterType == VEHICLE_ENTER_REAR_LEFT || enterType == VEHICLE_ENTER_REAR_RIGHT)) {
seatOffset = 0.0f;
vehDoorOffset = offsetToOpenVanDoor;
} else {
seatOffset = veh->m_handling->fSeatOffsetDistance * seatPosMult;
if (veh->bIsLow) {
vehDoorOffset = offsetToOpenLowCarDoor;
} else {
vehDoorOffset = offsetToOpenRegularCarDoor;
}
}
switch (enterType) {
case VEHICLE_ENTER_FRONT_RIGHT:
if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT)
vehDoorPos = vehModel->m_positions[VEHICLE_DUMMY_BOAT_RUDDER];
else
vehDoorPos = vehModel->m_positions[VEHICLE_DUMMY_FRONT_SEATS];
vehDoorPos.x += seatOffset;
vehDoorOffset.x = -vehDoorOffset.x;
break;
case VEHICLE_ENTER_REAR_RIGHT:
vehDoorPos = vehModel->m_positions[VEHICLE_DUMMY_REAR_SEATS];
vehDoorPos.x += seatOffset;
vehDoorOffset.x = -vehDoorOffset.x;
break;
case VEHICLE_ENTER_FRONT_LEFT:
if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT)
vehDoorPos = vehModel->m_positions[VEHICLE_DUMMY_BOAT_RUDDER];
else
vehDoorPos = vehModel->m_positions[VEHICLE_DUMMY_FRONT_SEATS];
vehDoorPos.x = -(vehDoorPos.x + seatOffset);
break;
case VEHICLE_ENTER_REAR_LEFT:
vehDoorPos = vehModel->m_positions[VEHICLE_DUMMY_REAR_SEATS];
vehDoorPos.x = -(vehDoorPos.x + seatOffset);
break;
default:
if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT)
vehDoorPos = vehModel->m_positions[VEHICLE_DUMMY_BOAT_RUDDER];
else
vehDoorPos = vehModel->m_positions[VEHICLE_DUMMY_FRONT_SEATS];
vehDoorOffset = CVector(0.0f, 0.0f, 0.0f);
}
*output = vehDoorPos - vehDoorOffset;
}
// This function was mostly duplicate of GetLocalPositionToOpenCarDoor, so I've used it.
void
CPed::GetPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType)
{
CVector localPos;
CVector vehDoorPos;
GetLocalPositionToOpenCarDoor(&localPos, veh, enterType, 1.0f);
vehDoorPos = Multiply3x3(veh->GetMatrix(), localPos) + veh->GetPosition();
/*
// Not used.
CVector localVehDoorOffset;
if (veh->bIsVan && (enterType == VEHICLE_ENTER_REAR_LEFT || enterType == VEHICLE_ENTER_REAR_RIGHT)) {
localVehDoorOffset = offsetToOpenVanDoor;
} else {
if (veh->bIsLow) {
localVehDoorOffset = offsetToOpenLowCarDoor;
} else {
localVehDoorOffset = offsetToOpenRegularCarDoor;
}
}
vehDoorPosWithoutOffset = Multiply3x3(veh->GetMatrix(), localPos + localVehDoorOffset) + veh->GetPosition();
*/
*output = vehDoorPos;
}
void
CPed::GetPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float offset)
{
CVector doorPos;
CMatrix vehMat(veh->GetMatrix());
GetLocalPositionToOpenCarDoor(output, veh, enterType, offset);
doorPos = Multiply3x3(vehMat, *output);
*output = *veh->GetPosition() + doorPos;
}
void
CPed::LineUpPedWithCar(PedLineUpPhase phase)
{
bool vehIsUpsideDown = false;
int vehAnim;
float seatPosMult = 0.0f;
float currentZ;
float adjustedTimeStep;
if (CReplay::IsPlayingBack())
return;
if (!m_ped_flagC8 && phase != LINE_UP_TO_CAR_2) {
if (RpAnimBlendClumpGetAssociation((RpClump*)m_rwObject, ANIM_CAR_SIT)) {
SetPedPositionInCar();
return;
}
if (RpAnimBlendClumpGetAssociation((RpClump*)m_rwObject, ANIM_CAR_LSIT)) {
SetPedPositionInCar();
return;
}
if (RpAnimBlendClumpGetAssociation((RpClump*)m_rwObject, ANIM_CAR_SITP)) {
SetPedPositionInCar();
return;
}
if (RpAnimBlendClumpGetAssociation((RpClump*)m_rwObject, ANIM_CAR_SITPLO)) {
SetPedPositionInCar();
return;
}
m_ped_flagC8 = 1;
}
if (phase == LINE_UP_TO_CAR_START) {
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
}
CVehicle *veh = m_pMyVehicle;
// Not quite right, IsUpsideDown func. checks for <= -0.9f.
// Since that function is also used in this file, doesn't this variable indicate upsidedownness?!
if (veh->GetUp().z <= -0.8f)
vehIsUpsideDown = true;
if (m_vehEnterType == VEHICLE_ENTER_FRONT_RIGHT || m_vehEnterType == VEHICLE_ENTER_REAR_RIGHT) {
if (vehIsUpsideDown) {
m_fRotationDest = -PI + atan2(-veh->GetForward().x, veh->GetForward().y);
} else if (veh->bIsBus) {
m_fRotationDest = 0.5 * PI + atan2(-veh->GetForward().x, veh->GetForward().y);
} else {
m_fRotationDest = atan2(-veh->GetForward().x, veh->GetForward().y);
}
} else if (m_vehEnterType == VEHICLE_ENTER_FRONT_LEFT || m_vehEnterType == VEHICLE_ENTER_REAR_LEFT) {
if (vehIsUpsideDown) {
m_fRotationDest = atan2(-veh->GetForward().x, veh->GetForward().y);
} else if (veh->bIsBus) {
m_fRotationDest = -0.5 * PI + atan2(-veh->GetForward().x, veh->GetForward().y);
} else {
m_fRotationDest = atan2(-veh->GetForward().x, veh->GetForward().y);
}
}
if (!bInVehicle)
seatPosMult = 1.0f;
if (m_pVehicleAnim) {
vehAnim = m_pVehicleAnim->animId;
switch (vehAnim) {
case ANIM_CAR_JACKED_RHS:
case ANIM_CAR_LJACKED_RHS:
case ANIM_CAR_JACKED_LHS:
case ANIM_CAR_LJACKED_LHS:
case ANIM_CAR_QJACKED:
case ANIM_CAR_GETOUT_LHS:
case ANIM_CAR_GETOUT_LOW_LHS:
case ANIM_CAR_GETOUT_RHS:
case ANIM_CAR_GETOUT_LOW_RHS:
case ANIM_CAR_CRAWLOUT_RHS:
case ANIM_CAR_CRAWLOUT_RHS2:
case ANIM_VAN_GETIN_L:
case ANIM_VAN_GETOUT_L:
case ANIM_VAN_GETIN:
case ANIM_VAN_GETOUT:
seatPosMult = m_pVehicleAnim->currentTime / m_pVehicleAnim->hierarchy->totalLength;
break;
case ANIM_CAR_QJACK:
case ANIM_CAR_GETIN_LHS:
case ANIM_CAR_GETIN_LOW_LHS:
case ANIM_CAR_GETIN_RHS:
case ANIM_CAR_GETIN_LOW_RHS:
case ANIM_DRIVE_BOAT:
seatPosMult = m_pVehicleAnim->GetTimeLeft() / m_pVehicleAnim->hierarchy->totalLength;
break;
case ANIM_CAR_CLOSEDOOR_LHS:
case ANIM_CAR_CLOSEDOOR_LOW_LHS:
case ANIM_CAR_CLOSEDOOR_RHS:
case ANIM_CAR_CLOSEDOOR_LOW_RHS:
case ANIM_CAR_SHUFFLE_RHS:
case ANIM_CAR_LSHUFFLE_RHS:
seatPosMult = 0.0f;
break;
case ANIM_CAR_CLOSE_LHS:
case ANIM_CAR_CLOSE_RHS:
case ANIM_COACH_OPEN_L:
case ANIM_COACH_OPEN_R:
case ANIM_COACH_IN_L:
case ANIM_COACH_IN_R:
case ANIM_COACH_OUT_L:
seatPosMult = 1.0f;
break;
default:
break;
}
}
CVector neededPos;
if (phase == LINE_UP_TO_CAR_2) {
neededPos = *GetPosition();
} else {
GetPositionToOpenCarDoor(&neededPos, veh, m_vehEnterType, seatPosMult);
}
CVector autoZPos = neededPos;
if (veh->bIsInWater) {
if (veh->m_vehType == VEHICLE_TYPE_BOAT && veh->IsUpsideDown())
autoZPos.z += 1.0f;
} else {
CPedPlacement::FindZCoorForPed(&autoZPos);
}
if (phase == LINE_UP_TO_CAR_END || phase == LINE_UP_TO_CAR_2) {
neededPos.z = GetPosition().z;
// Getting out
if (!veh->bIsBus || (veh->bIsBus && vehIsUpsideDown)) {
float pedZSpeedOnExit = m_vecMoveSpeed.z - 0.008f * CTimer::GetTimeStep();
// If we're not in ground at next step, apply animation
if (neededPos.z + pedZSpeedOnExit > autoZPos.z) {
m_vecMoveSpeed.z = pedZSpeedOnExit;
ApplyMoveSpeed();
// Removing below line breaks the animation
neededPos.z = GetPosition().z;
} else {
neededPos.z = autoZPos.z;
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
}
}
}
if (autoZPos.z > neededPos.z) {
currentZ = GetPosition().z;
if (m_pVehicleAnim && vehAnim != ANIM_VAN_GETIN_L && vehAnim != ANIM_VAN_CLOSE_L && vehAnim != ANIM_VAN_CLOSE && vehAnim != ANIM_VAN_GETIN) {
neededPos.z = autoZPos.z;
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
} else if (neededPos.z <= currentZ && m_pVehicleAnim && vehAnim != ANIM_VAN_CLOSE_L && vehAnim != ANIM_VAN_CLOSE) {
adjustedTimeStep = min(m_pVehicleAnim->timeStep, 0.1f);
// Smoothly change ped position
neededPos.z = currentZ - (currentZ - neededPos.z) / (m_pVehicleAnim->GetTimeLeft() / adjustedTimeStep);
}
} else {
// We may need to raise up the ped
if (phase == LINE_UP_TO_CAR_START) {
currentZ = GetPosition().z;
if (neededPos.z > currentZ) {
if (m_pVehicleAnim &&
(vehAnim == ANIM_CAR_GETIN_RHS || vehAnim == ANIM_CAR_GETIN_LOW_RHS || vehAnim == ANIM_CAR_GETIN_LHS || vehAnim == ANIM_CAR_GETIN_LOW_LHS
|| vehAnim == ANIM_CAR_QJACK || vehAnim == ANIM_VAN_GETIN_L || vehAnim == ANIM_VAN_GETIN)) {
adjustedTimeStep = min(m_pVehicleAnim->timeStep, 0.1f);
// Smoothly change ped position
neededPos.z = (neededPos.z - currentZ) / (m_pVehicleAnim->GetTimeLeft() / adjustedTimeStep) + currentZ;
} else if (m_nPedState == PED_ENTER_CAR || m_nPedState == PED_CARJACK) {
neededPos.z = max(currentZ, autoZPos.z);
}
}
}
}
// I hope
bool stillGettingInOut = false;
if (CTimer::GetTimeInMilliseconds() < m_nPedStateTimer)
stillGettingInOut = veh->m_vehType != VEHICLE_TYPE_BOAT || m_ped_flagG10;
if (!stillGettingInOut) {
m_fRotationCur = m_fRotationDest;
} else {
float limitedAngle = CGeneral::LimitRadianAngle(m_fRotationDest);
float timeUntilStateChange = (m_nPedStateTimer - CTimer::GetTimeInMilliseconds())/600.0f;
m_vecOffsetSeek.z = 0.0;
if (timeUntilStateChange <= 0.0f) {
m_vecOffsetSeek.x = 0.0;
m_vecOffsetSeek.y = 0.0;
} else {
neededPos -= timeUntilStateChange * m_vecOffsetSeek;
}
if (limitedAngle >= PI + m_fRotationCur) {
limitedAngle -= 2 * PI;
} else if (limitedAngle <= m_fRotationCur - PI) {
limitedAngle += 2 * PI;
}
m_fRotationCur -= (m_fRotationCur - limitedAngle) * (1.0f - timeUntilStateChange);
}
if (seatPosMult > 0.2f || vehIsUpsideDown) {
GetPosition() = neededPos;
GetMatrix().SetRotate(0.0f, 0.0f, m_fRotationCur);
// It will be all 0 after rotate.
GetPosition() = neededPos;
} else {
CVector output;
CMatrix vehDoorMat(veh->GetMatrix());
GetLocalPositionToOpenCarDoor(&output, veh, m_vehEnterType, 0.0f);
*vehDoorMat.GetPosition() += Multiply3x3(vehDoorMat, output);
GetMatrix() = vehDoorMat;
}
}
WRAPPER void CPed::PedGetupCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4CE810); } WRAPPER void CPed::PedGetupCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4CE810); }
WRAPPER void CPed::PedStaggerCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4CE8D0); } WRAPPER void CPed::PedStaggerCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4CE8D0); }
WRAPPER void CPed::PedEvadeCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4D36E0); } WRAPPER void CPed::PedEvadeCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4D36E0); }
@ -989,7 +1477,6 @@ WRAPPER void CPed::PedAnimDoorCloseCB(CAnimBlendAssociation *assoc, void *arg) {
WRAPPER void CPed::SetInCarCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4CF220); } WRAPPER void CPed::SetInCarCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4CF220); }
WRAPPER void CPed::PedSetOutCarCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4CE8F0); } WRAPPER void CPed::PedSetOutCarCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4CE8F0); }
WRAPPER void CPed::PedAnimAlignCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4DE130); } WRAPPER void CPed::PedAnimAlignCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4DE130); }
WRAPPER void CPed::PedSetDraggedOutCarCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4CF000); }
WRAPPER void CPed::PedAnimStepOutCarCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4DF5C0); } WRAPPER void CPed::PedAnimStepOutCarCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4DF5C0); }
WRAPPER void CPed::PedSetInTrainCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4E3290); } WRAPPER void CPed::PedSetInTrainCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4E3290); }
WRAPPER void CPed::PedSetOutTrainCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4E36E0); } WRAPPER void CPed::PedSetOutTrainCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4E36E0); }
@ -999,8 +1486,6 @@ WRAPPER void CPed::FinishJumpCB(CAnimBlendAssociation *assoc, void *arg) { EAXJM
WRAPPER void CPed::PedLandCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4CE8A0); } WRAPPER void CPed::PedLandCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4CE8A0); }
WRAPPER void FinishFuckUCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4C6620); } WRAPPER void FinishFuckUCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4C6620); }
WRAPPER void CPed::RestoreHeadingRateCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4D6550); } WRAPPER void CPed::RestoreHeadingRateCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4D6550); }
WRAPPER void CPed::PedSetQuickDraggedOutCarPositionCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4E2480); }
WRAPPER void CPed::PedSetDraggedOutCarPositionCB(CAnimBlendAssociation *assoc, void *arg) { EAXJMP(0x4E2920); }
STARTPATCHES STARTPATCHES
InjectHook(0x4CF8F0, &CPed::AddWeaponModel, PATCH_JUMP); InjectHook(0x4CF8F0, &CPed::AddWeaponModel, PATCH_JUMP);
@ -1024,4 +1509,11 @@ STARTPATCHES
InjectHook(0x4E4A10, &CPed::Duck, PATCH_JUMP); InjectHook(0x4E4A10, &CPed::Duck, PATCH_JUMP);
InjectHook(0x4E4A30, &CPed::ClearDuck, PATCH_JUMP); InjectHook(0x4E4A30, &CPed::ClearDuck, PATCH_JUMP);
InjectHook(0x4E6180, &CPed::ClearPointGunAt, PATCH_JUMP); InjectHook(0x4E6180, &CPed::ClearPointGunAt, PATCH_JUMP);
InjectHook(0x4E07D0, &CPed::BeingDraggedFromCar, PATCH_JUMP);
InjectHook(0x4CF000, &CPed::PedSetDraggedOutCarCB, PATCH_JUMP);
InjectHook(0x4C5D80, &CPed::RestartNonPartialAnims, PATCH_JUMP);
InjectHook(0x4E4730, &CPed::GetLocalPositionToOpenCarDoor, PATCH_JUMP);
InjectHook(0x4E4660, (void (*)(CVector*, CVehicle*, uint32, float)) CPed::GetPositionToOpenCarDoor, PATCH_JUMP);
InjectHook(0x4E1A30, (void (*)(CVector*, CVehicle*, uint32)) CPed::GetPositionToOpenCarDoor, PATCH_JUMP);
InjectHook(0x4DF940, &CPed::LineUpPedWithCar, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -12,6 +12,19 @@
struct CPathNode; struct CPathNode;
enum {
VEHICLE_ENTER_FRONT_RIGHT = 11,
VEHICLE_ENTER_REAR_RIGHT = 12,
VEHICLE_ENTER_FRONT_LEFT = 15,
VEHICLE_ENTER_REAR_LEFT = 16,
};
enum PedLineUpPhase {
LINE_UP_TO_CAR_START,
LINE_UP_TO_CAR_END,
LINE_UP_TO_CAR_2
};
enum PedOnGroundState { enum PedOnGroundState {
NO_PED, NO_PED,
PED_BELOW_PLAYER, PED_BELOW_PLAYER,
@ -102,7 +115,7 @@ public:
uint8 m_ped_flagA1 : 1; uint8 m_ped_flagA1 : 1;
uint8 m_ped_flagA2 : 1; uint8 m_ped_flagA2 : 1;
uint8 m_ped_flagA4 : 1; // stores (CTimer::GetTimeInMilliseconds() < m_lastHitTime) uint8 m_ped_flagA4 : 1; // stores (CTimer::GetTimeInMilliseconds() < m_lastHitTime)
uint8 m_ped_flagA8 : 1; uint8 bIsPointingGunAt : 1;
uint8 bIsLooking : 1; uint8 bIsLooking : 1;
uint8 m_ped_flagA20 : 1; // "look" method? - probably missing in SA uint8 m_ped_flagA20 : 1; // "look" method? - probably missing in SA
uint8 bIsRestoringLook : 1; uint8 bIsRestoringLook : 1;
@ -177,15 +190,15 @@ public:
int32 m_pEventEntity; int32 m_pEventEntity;
float m_fAngleToEvent; float m_fAngleToEvent;
AnimBlendFrameData *m_pFrames[PED_NODE_MAX]; AnimBlendFrameData *m_pFrames[PED_NODE_MAX];
int32 m_animGroup; AssocGroupId m_animGroup;
int32 m_pVehicleAnim; CAnimBlendAssociation *m_pVehicleAnim;
CVector2D m_vecAnimMoveDelta; CVector2D m_vecAnimMoveDelta;
CVector m_vecOffsetSeek; CVector m_vecOffsetSeek;
CPedIK m_pedIK; CPedIK m_pedIK;
uint8 stuff1[8]; uint8 stuff1[8];
uint32 m_nPedStateTimer; uint32 m_nPedStateTimer;
PedState m_nPedState; PedState m_nPedState;
int32 m_nLastPedState; PedState m_nLastPedState;
int32 m_nMoveState; int32 m_nMoveState;
int32 m_nStoredActionState; int32 m_nStoredActionState;
int32 m_nPrevActionState; int32 m_nPrevActionState;
@ -207,7 +220,9 @@ public:
uint8 stuff2[20]; uint8 stuff2[20];
float m_fRotationCur; float m_fRotationCur;
float m_fRotationDest; float m_fRotationDest;
uint8 stuff13[6]; uint32 m_headingRate;
uint16 m_vehEnterType;
uint16 m_walkAroundType;
CEntity *m_pCurrentPhysSurface; CEntity *m_pCurrentPhysSurface;
CVector m_vecOffsetFromPhysSurface; CVector m_vecOffsetFromPhysSurface;
CEntity *m_pCurSurface; CEntity *m_pCurSurface;
@ -222,7 +237,7 @@ public:
CEntity *m_pCollidingEntity; CEntity *m_pCollidingEntity;
uint8 stuff6[12]; uint8 stuff6[12];
CWeapon m_weapons[NUM_PED_WEAPONTYPES]; CWeapon m_weapons[NUM_PED_WEAPONTYPES];
int32 stuff7; eWeaponType m_storedWeapon;
uint8 m_currentWeapon; // eWeaponType uint8 m_currentWeapon; // eWeaponType
uint8 m_maxWeaponTypeAllowed; // eWeaponType uint8 m_maxWeaponTypeAllowed; // eWeaponType
uint8 stuff[2]; uint8 stuff[2];
@ -253,6 +268,7 @@ public:
bool IsPlayer(void); bool IsPlayer(void);
bool UseGroundColModel(void); bool UseGroundColModel(void);
bool CanSetPedState(void);
void AddWeaponModel(int id); void AddWeaponModel(int id);
void AimGun(void); void AimGun(void);
void KillPedWithCar(CVehicle *veh, float impulse); void KillPedWithCar(CVehicle *veh, float impulse);
@ -278,6 +294,13 @@ public:
void Duck(void); void Duck(void);
void ClearDuck(void); void ClearDuck(void);
void ClearPointGunAt(void); void ClearPointGunAt(void);
void BeingDraggedFromCar(void);
void RestartNonPartialAnims(void);
void LineUpPedWithCar(PedLineUpPhase phase);
void SetPedPositionInCar(void);
static void GetLocalPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float offset);
static void GetPositionToOpenCarDoor(CVector *output, CVehicle *veh, uint32 enterType, float seatPosMult);
static void GetPositionToOpenCarDoor(CVector* output, CVehicle* veh, uint32 enterType);
static RwObject *SetPedAtomicVisibilityCB(RwObject *object, void *data); static RwObject *SetPedAtomicVisibilityCB(RwObject *object, void *data);
static RwFrame *RecurseFrameChildrenVisibilityCB(RwFrame *frame, void *data); static RwFrame *RecurseFrameChildrenVisibilityCB(RwFrame *frame, void *data);
static void PedGetupCB(CAnimBlendAssociation *assoc, void *arg); static void PedGetupCB(CAnimBlendAssociation *assoc, void *arg);
@ -311,6 +334,9 @@ public:
CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; } CWeapon *GetWeapon(void) { return &m_weapons[m_currentWeapon]; }
RwFrame *GetNodeFrame(int nodeId) { return m_pFrames[nodeId]->frame; } RwFrame *GetNodeFrame(int nodeId) { return m_pFrames[nodeId]->frame; }
static CVector &offsetToOpenRegularCarDoor;
static CVector &offsetToOpenLowCarDoor;
static CVector &offsetToOpenVanDoor;
static bool &bNastyLimbsCheat; static bool &bNastyLimbsCheat;
static bool &bPedCheat2; static bool &bPedCheat2;
static bool &bPedCheat3; static bool &bPedCheat3;

View File

@ -1504,7 +1504,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
else if(A->GetUp().z > 0.3f) else if(A->GetUp().z > 0.3f)
adhesion = 0.0f; adhesion = 0.0f;
else else
adhesion *= max(5.0f, 0.03f*impulseA + 1.0f); adhesion *= min(5.0f, 0.03f*impulseA + 1.0f);
} }
if(A->ApplyFriction(adhesion, aColPoints[i])) if(A->ApplyFriction(adhesion, aColPoints[i]))

View File

@ -2,6 +2,8 @@
#include "patcher.h" #include "patcher.h"
#include "Vehicle.h" #include "Vehicle.h"
#include "Pools.h" #include "Pools.h"
#include "CarCtrl.h"
#include "ModelIndices.h"
bool &CVehicle::bWheelsOnlyCheat = *(bool *)0x95CD78; bool &CVehicle::bWheelsOnlyCheat = *(bool *)0x95CD78;
bool &CVehicle::bAllDodosCheat = *(bool *)0x95CD75; bool &CVehicle::bAllDodosCheat = *(bool *)0x95CD75;
@ -11,3 +13,53 @@ bool &CVehicle::bCheat5 = *(bool *)0x95CD64;
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 delete(void *p, size_t sz) { CPools::GetVehiclePool()->Delete((CVehicle*)p); } void CVehicle::operator delete(void *p, size_t sz) { CPools::GetVehiclePool()->Delete((CVehicle*)p); }
bool
CVehicle::IsLawEnforcementVehicle(void)
{
switch (m_modelIndex) {
case MI_FBICAR:
case MI_POLICE:
case MI_ENFORCER:
case MI_PREDATOR:
case MI_RHINO:
case MI_BARRACKS:
return true;
default:
return false;
}
}
void
CVehicle::ChangeLawEnforcerState(bool enable)
{
if (enable) {
if (!bIsLawEnforcer) {
bIsLawEnforcer = true;
CCarCtrl::NumLawEnforcerCars++;
}
} else {
if (bIsLawEnforcer) {
bIsLawEnforcer = false;
CCarCtrl::NumLawEnforcerCars--;
}
}
}
void
CVehicle::RemoveDriver(void)
{
m_status = STATUS_ABANDONED;
pDriver = nil;
}
bool
CVehicle::IsUpsideDown(void)
{
return GetUp().z <= -0.9f;
}
STARTPATCHES
InjectHook(0x552820, &CVehicle::ChangeLawEnforcerState, PATCH_JUMP);
InjectHook(0x5520A0, &CVehicle::RemoveDriver, PATCH_JUMP);
ENDPATCHES

View File

@ -3,26 +3,53 @@
#include "Physical.h" #include "Physical.h"
class CPed; class CPed;
class CFire;
struct tHandlingData;
enum {
GETTING_IN_OUT_FL = 1,
GETTING_IN_OUT_RL = 2,
GETTING_IN_OUT_FR = 4,
GETTING_IN_OUT_RR = 8
};
enum eCarLock : uint8 {
CARLOCK_NOT_USED,
CARLOCK_UNLOCKED,
CARLOCK_LOCKED,
CARLOCK_LOCKOUT_PLAYER_ONLY,
CARLOCK_LOCKED_PLAYER_INSIDE,
CARLOCK_COP_CAR,
CARLOCK_FORCE_SHUT_DOORS,
CARLOCK_SKIP_SHUT_DOORS
};
class CVehicle : public CPhysical class CVehicle : public CPhysical
{ {
public: public:
// 0x128 // 0x128
uint8 stuff1[116]; tHandlingData *m_handling;
uint8 stuff1[112];
uint8 m_currentColour1; uint8 m_currentColour1;
uint8 m_currentColour2; uint8 m_currentColour2;
uint8 m_extra1; uint8 m_anExtras[2];
uint8 m_extra2; int16 m_nAlarmState; // m_nWantedStarsOnEnter on DK22
int16 m_nAlarmState; int16 m_nMissionValue;
CPed *pDriver; CPed *pDriver;
CPed *pPassengers[8]; CPed *pPassengers[8];
uint8 stuff2[24]; uint8 m_nNumPassengers;
int8 m_nNumGettingIn;
int8 m_nGettingInFlags;
int8 m_nGettingOutFlags;
uint8 m_nNumMaxPassengers;
char field_1CD[19];
CEntity *m_pCurSurface; CEntity *m_pCurSurface;
void* m_pFire; CFire *m_pCarFire;
float m_fWheelState; float m_fSteerAngle;
float m_fAcceleration; float m_fGasPedal;
uint8 stuff4[5]; float m_fBreakPedal;
uint8 m_veh_flagA1 : 1; uint8 m_nCreatedBy; // eVehicleCreatedBy
uint8 bIsLawEnforcer : 1;
uint8 m_veh_flagA2 : 1; uint8 m_veh_flagA2 : 1;
uint8 m_veh_flagA4 : 1; uint8 m_veh_flagA4 : 1;
uint8 m_veh_flagA8 : 1; uint8 m_veh_flagA8 : 1;
@ -30,10 +57,10 @@ public:
uint8 m_veh_flagA20 : 1; uint8 m_veh_flagA20 : 1;
uint8 m_veh_flagA40 : 1; uint8 m_veh_flagA40 : 1;
uint8 m_veh_flagA80 : 1; uint8 m_veh_flagA80 : 1;
uint8 m_veh_flagB1 : 1; uint8 bIsVan : 1;
uint8 m_veh_flagB2 : 1; uint8 bIsBus : 1;
uint8 m_veh_flagB4 : 1; uint8 bIsBig : 1;
uint8 m_veh_flagB8 : 1; uint8 bIsLow : 1;
uint8 m_veh_flagB10 : 1; uint8 m_veh_flagB10 : 1;
uint8 m_veh_flagB20 : 1; uint8 m_veh_flagB20 : 1;
uint8 m_veh_flagB40 : 1; uint8 m_veh_flagB40 : 1;
@ -54,10 +81,34 @@ public:
uint8 m_veh_flagD20 : 1; uint8 m_veh_flagD20 : 1;
uint8 m_veh_flagD40 : 1; uint8 m_veh_flagD40 : 1;
uint8 m_veh_flagD80 : 1; uint8 m_veh_flagD80 : 1;
uint8 stuff5[7]; int8 field_1F9;
float m_fHealth; uint8 m_nAmmoInClip[1]; // Used to make the guns on boat do a reload (20 by default)
uint8 stuff6[128]; int8 field_1FB;
int32 m_vehType; int8 field_1FC[4];
float m_fHealth; // 1000.0f = full health. 0 -> explode
uint8 m_nCurrentGear;
int8 field_205[3];
int field_208;
uint32 m_nGunFiringTime; // last time when gun on vehicle was fired (used on boats)
uint32 m_nTimeOfDeath;
int16 field_214;
int16 m_nBombTimer; // goes down with each frame
CPed *m_pWhoDetonatedMe;
float field_21C;
float field_220;
eCarLock m_nDoorLock;
int8 m_nLastWeaponDamage; // see eWeaponType, -1 if no damage
int8 m_nRadioStation;
int8 field_22A;
int8 field_22B;
uint8 m_nCarHornTimer;
int8 field_22D;
uint8 m_nSirenOrAlarm;
int8 field_22F;
CStoredCollPoly m_frontCollPoly; // poly which is under front part of car
CStoredCollPoly m_rearCollPoly; // poly which is under rear part of car
float m_fSteerRatio;
eVehicleType m_vehType;
static void *operator new(size_t); static void *operator new(size_t);
static void operator delete(void*, size_t); static void operator delete(void*, size_t);
@ -67,6 +118,10 @@ public:
bool IsTrain(void) { return m_vehType == VEHICLE_TYPE_TRAIN; } bool IsTrain(void) { return m_vehType == VEHICLE_TYPE_TRAIN; }
bool IsHeli(void) { return m_vehType == VEHICLE_TYPE_HELI; } bool IsHeli(void) { return m_vehType == VEHICLE_TYPE_HELI; }
bool IsPlane(void) { return m_vehType == VEHICLE_TYPE_PLANE; } bool IsPlane(void) { return m_vehType == VEHICLE_TYPE_PLANE; }
bool IsLawEnforcementVehicle(void);
void ChangeLawEnforcerState(bool enable);
void RemoveDriver(void);
bool IsUpsideDown(void);
static bool &bWheelsOnlyCheat; static bool &bWheelsOnlyCheat;
static bool &bAllDodosCheat; static bool &bAllDodosCheat;
@ -74,5 +129,7 @@ public:
static bool &bCheat4; static bool &bCheat4;
static bool &bCheat5; static bool &bCheat5;
}; };
static_assert(sizeof(CVehicle) == 0x288, "CVehicle: error"); static_assert(sizeof(CVehicle) == 0x288, "CVehicle: error");
static_assert(offsetof(CVehicle, m_pCurSurface) == 0x1E0, "CVehicle: error"); static_assert(offsetof(CVehicle, m_pCurSurface) == 0x1E0, "CVehicle: error");
static_assert(offsetof(CVehicle, m_nAlarmState) == 0x1A0, "CVehicle: error");

View File

@ -85,6 +85,7 @@ extern void (*DebugMenuProcess)(void);
extern void (*DebugMenuRender)(void); extern void (*DebugMenuRender)(void);
void DebugMenuInit(void); void DebugMenuInit(void);
void PrintGameVersion();
RwRGBA gColourTop; RwRGBA gColourTop;
@ -154,6 +155,7 @@ Idle(void *arg)
} }
RenderMenus(); RenderMenus();
PrintGameVersion();
DoFade(); DoFade();
Render2dStuffAfterFade(); Render2dStuffAfterFade();
CCredits::Render(); CCredits::Render();
@ -186,6 +188,7 @@ FrontendIdle(void)
DefinedState(); DefinedState();
RenderMenus(); RenderMenus();
PrintGameVersion();
DoFade(); DoFade();
Render2dStuffAfterFade(); Render2dStuffAfterFade();
CFont::DrawFonts(); CFont::DrawFonts();
@ -772,6 +775,25 @@ AppEventHandler(RsEvent event, void *param)
} }
} }
void PrintGameVersion()
{
CFont::SetPropOn();
CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(0.7f), SCREEN_SCALE_Y(0.5f));
CFont::SetCentreOff();
CFont::SetRightJustifyOff();
CFont::SetBackGroundOnlyTextOff();
CFont::SetFontStyle(FONT_BANK);
CFont::SetWrapx(SCREEN_WIDTH);
CFont::SetDropShadowPosition(0);
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
CFont::SetColor(CRGBA(235, 170, 50, 255));
strcpy(gString, "RE3");
AsciiToUnicode(gString, gUString);
CFont::PrintString(SCREEN_SCALE_X(10.5f), SCREEN_SCALE_Y(8.0f), gUString);
}
STARTPATCHES STARTPATCHES
InjectHook(0x48E480, Idle, PATCH_JUMP); InjectHook(0x48E480, Idle, PATCH_JUMP);
InjectHook(0x48E700, FrontendIdle, PATCH_JUMP); InjectHook(0x48E700, FrontendIdle, PATCH_JUMP);

View File

@ -145,6 +145,30 @@ public:
m_matrix.pos.y = 0.0f; m_matrix.pos.y = 0.0f;
m_matrix.pos.z = 0.0f; m_matrix.pos.z = 0.0f;
} }
void SetRotate(float xAngle, float yAngle, float zAngle) {
float cX = cos(xAngle);
float sX = sin(xAngle);
float cY = cos(yAngle);
float sY = sin(yAngle);
float cZ = cos(zAngle);
float sZ = sin(zAngle);
m_matrix.right.x = cZ * cY - (sZ * sX) * sY;
m_matrix.right.y = (cZ * sX) * sY + sZ * cY;
m_matrix.right.z = -cX * sY;
m_matrix.up.x = -sZ * cX;
m_matrix.up.y = cZ * cX;
m_matrix.up.z = sX;
m_matrix.at.x = (sZ * sX) * cY + cZ * sY;
m_matrix.at.y = sZ * sY - (cZ * sX) * cY;
m_matrix.at.z = cX * cY;
m_matrix.pos.x = 0.0f;
m_matrix.pos.y = 0.0f;
m_matrix.pos.z = 0.0f;
}
void Reorthogonalise(void){ void Reorthogonalise(void){
CVector &r = *GetRight(); CVector &r = *GetRight();
CVector &f = *GetForward(); CVector &f = *GetForward();

View File

@ -26,4 +26,20 @@ public:
if(v.y < top) top = v.y; if(v.y < top) top = v.y;
if(v.y > bottom) bottom = v.y; if(v.y > bottom) bottom = v.y;
} }
void Translate(float x, float y){
left += x;
right += x;
bottom += y;
top += y;
}
void Grow(float r){
left -= r;
right += r;
top -= r;
bottom += r;
}
float GetWidth(void) { return right - left; }
float GetHeight(void) { return bottom - top; }
}; };

View File

@ -326,6 +326,8 @@ enum
MI_AIRTRAIN_VLO = 198, MI_AIRTRAIN_VLO = 198,
MI_LOPOLYGUY, MI_LOPOLYGUY,
NUM_DEFAULT_MODELS,
}; };
void InitModelIndices(void); void InitModelIndices(void);

View File

@ -3,7 +3,6 @@
#include "ClumpModelInfo.h" #include "ClumpModelInfo.h"
enum { enum {
NUM_VEHICLE_POSITIONS = 10,
NUM_FIRST_MATERIALS = 26, NUM_FIRST_MATERIALS = 26,
NUM_SECOND_MATERIALS = 26, NUM_SECOND_MATERIALS = 26,
NUM_VEHICLE_COLOURS = 8, NUM_VEHICLE_COLOURS = 8,
@ -25,7 +24,7 @@ enum {
ATOMIC_FLAG_NOCULL = 0x800, ATOMIC_FLAG_NOCULL = 0x800,
}; };
enum { enum eVehicleType {
VEHICLE_TYPE_CAR, VEHICLE_TYPE_CAR,
VEHICLE_TYPE_BOAT, VEHICLE_TYPE_BOAT,
VEHICLE_TYPE_TRAIN, VEHICLE_TYPE_TRAIN,
@ -46,6 +45,13 @@ enum {
NUM_VEHICLE_CLASSES NUM_VEHICLE_CLASSES
}; };
enum {
VEHICLE_DUMMY_BOAT_RUDDER = 0,
VEHICLE_DUMMY_FRONT_SEATS = 2,
VEHICLE_DUMMY_REAR_SEATS = 3,
NUM_VEHICLE_POSITIONS = 10
};
class CVehicleModelInfo : public CClumpModelInfo class CVehicleModelInfo : public CClumpModelInfo
{ {
public: public:

View File

@ -33,6 +33,12 @@ enum {
FONT_HEADING, FONT_HEADING,
}; };
enum {
ALIGN_LEFT,
ALIGN_CENTER,
ALIGN_RIGHT,
};
class CFont class CFont
{ {
static CFontDetails &Details; static CFontDetails &Details;
@ -56,6 +62,7 @@ public:
static void DrawFonts(void); static void DrawFonts(void);
static uint16 character_code(uint8 c); static uint16 character_code(uint8 c);
static CFontDetails GetDetails() { return Details; }
static void SetScale(float x, float y) { Details.scaleX = x; Details.scaleY = y; } static void SetScale(float x, float y) { Details.scaleX = x; Details.scaleY = y; }
static void SetSlantRefPoint(float x, float y) { Details.slantRefX = x; Details.slantRefY = y; } static void SetSlantRefPoint(float x, float y) { Details.slantRefX = x; Details.slantRefY = y; }
static void SetSlant(float s) { Details.slant = s; } static void SetSlant(float s) { Details.slant = s; }
@ -86,6 +93,23 @@ public:
static void SetCentreOff(void) { static void SetCentreOff(void) {
Details.centre = false; Details.centre = false;
} }
static void SetAlignment(uint8 alignment) {
if (alignment == ALIGN_LEFT) {
CFont::Details.justify = true;
CFont::Details.centre = false;
CFont::Details.rightJustify = false;
}
else if (alignment == ALIGN_CENTER) {
CFont::Details.justify = false;
CFont::Details.centre = true;
CFont::Details.rightJustify = false;
}
else if (alignment == ALIGN_RIGHT) {
CFont::Details.justify = false;
CFont::Details.centre = false;
CFont::Details.rightJustify = true;
}
}
static void SetWrapx(float x) { Details.wrapX = x; } static void SetWrapx(float x) { Details.wrapX = x; }
static void SetCentreSize(float s) { Details.centreSize = s; } static void SetCentreSize(float s) { Details.centreSize = s; }
static void SetBackgroundOn(void) { Details.background = true; } static void SetBackgroundOn(void) { Details.background = true; }

View File

@ -53,9 +53,9 @@ 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;
float *CHud::BigMessageInUse = (float*)0x862140; float CHud::BigMessageInUse[6];
float *CHud::BigMessageAlpha = (float*)0x862108; float CHud::BigMessageAlpha[6];
float *CHud::BigMessageX = (float*)0x773248; float CHud::BigMessageX[6];
float &CHud::OddJob2OffTimer = *(float*)0x942FA0; float &CHud::OddJob2OffTimer = *(float*)0x942FA0;
int8 &CHud::CounterOnLastFrame = *(int8*)0x95CD67; int8 &CHud::CounterOnLastFrame = *(int8*)0x95CD67;
@ -232,7 +232,7 @@ void CHud::Draw()
float fWidescreenOffset[2] = { 0.0f, 0.0f }; float fWidescreenOffset[2] = { 0.0f, 0.0f };
if (CMenuManager::m_PrefsUseWideScreen) { if (FrontEndMenuManager.m_PrefsUseWideScreen) {
fWidescreenOffset[0] = 0.0f; fWidescreenOffset[0] = 0.0f;
fWidescreenOffset[1] = SCREEN_SCALE_Y(18.0f); fWidescreenOffset[1] = SCREEN_SCALE_Y(18.0f);
} }
@ -362,25 +362,32 @@ void CHud::Draw()
/* /*
DrawAmmo DrawAmmo
*/ */
int16 AmmoAmount = CWeaponInfo::GetWeaponInfo(FindPlayerPed()->GetWeapon()->m_eWeaponType)->m_nAmountofAmmunition;
int32 AmmoInClip = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoInClip; int32 AmmoInClip = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoInClip;
int32 TotalAmmo = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoTotal; int32 TotalAmmo = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_nAmmoTotal;
int32 Ammo, Clip;
if (AmmoInClip <= 1 || AmmoInClip >= 1000) { if (AmmoAmount <= 1 || AmmoAmount >= 1000)
sprintf(sTemp, "%d", TotalAmmo); sprintf(sTemp, "%d", TotalAmmo);
}
else { else {
if (WeaponType == WEAPONTYPE_FLAMETHROWER) { if (WeaponType == WEAPONTYPE_FLAMETHROWER) {
int tot_min_clip_div_10 = (TotalAmmo - AmmoInClip) / 10; Clip = AmmoInClip / 10;
if (tot_min_clip_div_10 > 9999)
tot_min_clip_div_10 = 9999;
sprintf(sTemp, "%d-%d", tot_min_clip_div_10, AmmoInClip / 10); if ((TotalAmmo - AmmoInClip) / 10 <= 9999)
Ammo = (TotalAmmo - AmmoInClip) / 10;
else
Ammo = 9999;
} }
else { else {
if (AmmoInClip > 9999) Clip = AmmoInClip;
AmmoInClip = 9999;
sprintf(sTemp, "%d-%d", (TotalAmmo - AmmoInClip), AmmoInClip); if (TotalAmmo - AmmoInClip > 9999)
Ammo = 9999;
else
Ammo = TotalAmmo - AmmoInClip;
} }
sprintf(sTemp, "%d-%d", Ammo, Clip);
} }
AsciiToUnicode(sTemp, sPrint); AsciiToUnicode(sTemp, sPrint);
@ -580,7 +587,7 @@ void CHud::Draw()
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
if (CMenuManager::m_PrefsLanguage == 4) if (FrontEndMenuManager.m_PrefsLanguage == 4)
CFont::SetScale(SCREEN_SCALE_X(1.2f * 0.8f), SCREEN_SCALE_Y(1.2f)); CFont::SetScale(SCREEN_SCALE_X(1.2f * 0.8f), SCREEN_SCALE_Y(1.2f));
else else
CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f)); CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f));
@ -676,7 +683,7 @@ void CHud::Draw()
CFont::SetPropOn(); CFont::SetPropOn();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
if (CMenuManager::m_PrefsLanguage != 3 && CMenuManager::m_PrefsLanguage != 4) if (FrontEndMenuManager.m_PrefsLanguage != 3 && FrontEndMenuManager.m_PrefsLanguage != 4)
CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f)); CFont::SetScale(SCREEN_SCALE_X(1.2f), SCREEN_SCALE_Y(1.2f));
else else
CFont::SetScale(SCREEN_SCALE_X(1.2f * 0.85f), SCREEN_SCALE_Y(1.2f)); CFont::SetScale(SCREEN_SCALE_X(1.2f * 0.85f), SCREEN_SCALE_Y(1.2f));
@ -856,7 +863,11 @@ void CHud::Draw()
*/ */
if (CHud::m_ItemToFlash == ITEM_RADAR && CTimer::GetFrameCounter() & 8 || CHud::m_ItemToFlash != ITEM_RADAR) { if (CHud::m_ItemToFlash == ITEM_RADAR && CTimer::GetFrameCounter() & 8 || CHud::m_ItemToFlash != ITEM_RADAR) {
CRadar::DrawMap(); CRadar::DrawMap();
CHud::Sprites[HUD_RADARDISC].Draw(CRect(SCREEN_SCALE_X(16.0f), SCREEN_SCALE_FROM_BOTTOM(123.0f + 4.0f), SCREEN_SCALE_X(94.0f + 20.0f + 5.0f), SCREEN_SCALE_FROM_BOTTOM(-76.0f + 123.0f - 6.0f)), CRGBA(0, 0, 0, 255)); CRect rect(0.0f, 0.0f, SCREEN_SCALE_X(RADAR_WIDTH), SCREEN_SCALE_Y(RADAR_HEIGHT));
// FIX: game doesn't scale RADAR_LEFT here
rect.Translate(SCREEN_SCALE_X(RADAR_LEFT), SCREEN_SCALE_FROM_BOTTOM(RADAR_BOTTOM + RADAR_HEIGHT));
rect.Grow(4.0f);
CHud::Sprites[HUD_RADARDISC].Draw(rect, CRGBA(0, 0, 0, 255));
CRadar::DrawBlips(); CRadar::DrawBlips();
} }
} }
@ -972,7 +983,7 @@ void CHud::Draw()
DrawBigMessage DrawBigMessage
*/ */
// MissionCompleteFailedText // MissionCompleteFailedText
if (CHud::m_BigMessage[0][0]) { if (m_BigMessage[0][0]) {
if (BigMessageInUse[0] != 0.0f) { if (BigMessageInUse[0] != 0.0f) {
CFont::SetJustifyOff(); CFont::SetJustifyOff();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
@ -1247,7 +1258,7 @@ void CHud::DrawAfterFade()
CFont::SetJustifyOff(); CFont::SetJustifyOff();
CFont::SetBackgroundOff(); CFont::SetBackgroundOff();
if (CGame::frenchGame || CMenuManager::m_PrefsLanguage == 4) if (CGame::frenchGame || FrontEndMenuManager.m_PrefsLanguage == 4)
CFont::SetScale(SCREEN_SCALE_X(0.884f), SCREEN_SCALE_Y(1.36f)); CFont::SetScale(SCREEN_SCALE_X(0.884f), SCREEN_SCALE_Y(1.36f));
else else
CFont::SetScale(SCREEN_SCALE_X(1.04f), SCREEN_SCALE_Y(1.6f)); CFont::SetScale(SCREEN_SCALE_X(1.04f), SCREEN_SCALE_Y(1.6f));

View File

@ -62,9 +62,9 @@ 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 float *BigMessageInUse; static float BigMessageInUse[6];
static float *BigMessageAlpha; static float BigMessageAlpha[6];
static float *BigMessageX; static float BigMessageX[6];
static float &OddJob2OffTimer; static float &OddJob2OffTimer;
static int8 &CounterOnLastFrame; static int8 &CounterOnLastFrame;
static float &OddJob2XOffset; static float &OddJob2XOffset;

View File

@ -633,7 +633,9 @@ psInitialise(void)
C_PcSave::SetSaveDirectory(_psGetUserFilesFolder()); C_PcSave::SetSaveDirectory(_psGetUserFilesFolder());
InitialiseLanguage(); #ifndef NASTY_GAME
InitialiseLanguage();
#endif
FrontEndMenuManager.LoadSettings(); FrontEndMenuManager.LoadSettings();

View File

@ -78,6 +78,8 @@ RwBool _psSetVideoMode(RwInt32 subSystem, RwInt32 videoMode);
void CenterVideo(void); void CenterVideo(void);
void CloseClip(void); void CloseClip(void);
RwChar **_psGetVideoModeList();
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /* __cplusplus */ #endif /* __cplusplus */

View File

@ -18,7 +18,8 @@ enum eWeaponType
WEAPONTYPE_DETONATOR, WEAPONTYPE_DETONATOR,
NUM_PED_WEAPONTYPES = 13, NUM_PED_WEAPONTYPES = 13,
WEAPONTYPE_HELICANNON = 13, WEAPONTYPE_HELICANNON = 13,
NUM_WEAPONTYPES NUM_WEAPONTYPES,
NO_STORED_WEAPON = 22
}; };
enum eWeaponFire { enum eWeaponFire {