Merge remote-tracking branch 'upstream/master' into script_dev

This commit is contained in:
Nikolay Korolev 2019-10-27 12:51:24 +03:00
commit 6224060627
28 changed files with 7102 additions and 4398 deletions

File diff suppressed because it is too large Load Diff

View File

@ -214,7 +214,7 @@ public:
int16 m_awAudioEvent[4]; int16 m_awAudioEvent[4];
uint8 gap_18[2]; uint8 gap_18[2];
float m_afVolume[4]; float m_afVolume[4];
uint8 m_Loops; uint8 m_AudioEvents;
uint8 field_25[3]; uint8 field_25[3];
// no methods // no methods

File diff suppressed because it is too large Load Diff

View File

@ -112,8 +112,8 @@ CGameLogic::Update()
CCarCtrl::ClearInterestingVehicleList(); CCarCtrl::ClearInterestingVehicleList();
CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1); CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1);
CRestart::FindClosestHospitalRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat); CRestart::FindClosestHospitalRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat);
CRestart::OverrideHospitalLevel = false; CRestart::OverrideHospitalLevel = LEVEL_NONE;
CRestart::OverridePoliceStationLevel = false; CRestart::OverridePoliceStationLevel = LEVEL_NONE;
PassTime(720); PassTime(720);
RestorePlayerStuffDuringResurrection(pPlayerInfo.m_pPed, vecRestartPos, fRestartFloat); RestorePlayerStuffDuringResurrection(pPlayerInfo.m_pPed, vecRestartPos, fRestartFloat);
SortOutStreamingAndMemory(pPlayerInfo.GetPos()); SortOutStreamingAndMemory(pPlayerInfo.GetPos());
@ -183,8 +183,8 @@ CGameLogic::Update()
CCarCtrl::ClearInterestingVehicleList(); CCarCtrl::ClearInterestingVehicleList();
CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1); CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1);
CRestart::FindClosestPoliceRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat); CRestart::FindClosestPoliceRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat);
CRestart::OverrideHospitalLevel = false; CRestart::OverrideHospitalLevel = LEVEL_NONE;
CRestart::OverridePoliceStationLevel = false; CRestart::OverridePoliceStationLevel = LEVEL_NONE;
PassTime(720); PassTime(720);
RestorePlayerStuffDuringResurrection(pPlayerInfo.m_pPed, vecRestartPos, fRestartFloat); RestorePlayerStuffDuringResurrection(pPlayerInfo.m_pPed, vecRestartPos, fRestartFloat);
pPlayerInfo.m_pPed->ClearWeapons(); pPlayerInfo.m_pPed->ClearWeapons();
@ -224,8 +224,8 @@ CGameLogic::Update()
CCarCtrl::ClearInterestingVehicleList(); CCarCtrl::ClearInterestingVehicleList();
CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1); CWorld::ClearExcitingStuffFromArea(pPlayerInfo.GetPos(), 4000.0f, 1);
CRestart::FindClosestPoliceRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat); CRestart::FindClosestPoliceRestartPoint(pPlayerInfo.GetPos(), &vecRestartPos, &fRestartFloat);
CRestart::OverridePoliceStationLevel = false; CRestart::OverridePoliceStationLevel = LEVEL_NONE;
CRestart::OverrideHospitalLevel = false; CRestart::OverrideHospitalLevel = LEVEL_NONE;
RestorePlayerStuffDuringResurrection(pPlayerInfo.m_pPed, vecRestartPos, fRestartFloat); RestorePlayerStuffDuringResurrection(pPlayerInfo.m_pPed, vecRestartPos, fRestartFloat);
SortOutStreamingAndMemory(pPlayerInfo.GetPos()); SortOutStreamingAndMemory(pPlayerInfo.GetPos());
TheCamera.m_fCamShakeForce = 0.0f; TheCamera.m_fCamShakeForce = 0.0f;

View File

@ -102,8 +102,8 @@ CCamera::IsBoxVisible(RwV3d *box, const CMatrix *mat)
int int
CCamera::GetLookDirection(void) CCamera::GetLookDirection(void)
{ {
if(Cams[ActiveCam].Mode == CCam::MODE_CAMONASTRING || if(Cams[ActiveCam].Mode == CCam::MODE_CAM_ON_A_STRING ||
Cams[ActiveCam].Mode == CCam::MODE_FIRSTPERSON || Cams[ActiveCam].Mode == CCam::MODE_1STPERSON ||
Cams[ActiveCam].Mode == CCam::MODE_BEHINDBOAT || Cams[ActiveCam].Mode == CCam::MODE_BEHINDBOAT ||
Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED) Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED)
return Cams[ActiveCam].DirectionWasLooking; return Cams[ActiveCam].DirectionWasLooking;
@ -113,7 +113,7 @@ CCamera::GetLookDirection(void)
bool bool
CCamera::GetLookingForwardFirstPerson() CCamera::GetLookingForwardFirstPerson()
{ {
return Cams[ActiveCam].Mode == CCam::MODE_FIRSTPERSON && return Cams[ActiveCam].Mode == CCam::MODE_1STPERSON &&
Cams[ActiveCam].DirectionWasLooking == LOOKING_FORWARD; Cams[ActiveCam].DirectionWasLooking == LOOKING_FORWARD;
} }
@ -1145,7 +1145,7 @@ CCam::FixCamIfObscured(CVector &TargetCoors, float TargetHeight, float TargetOri
if(Mode == MODE_BEHINDCAR) if(Mode == MODE_BEHINDCAR)
Target.z += TargetHeight/2.0f; Target.z += TargetHeight/2.0f;
if(Mode == MODE_CAMONASTRING){ if(Mode == MODE_CAM_ON_A_STRING){
UseEntityPos = true; UseEntityPos = true;
Target.z += TargetHeight/2.0f; Target.z += TargetHeight/2.0f;
EntityPos = CamTargetEntity->GetPosition(); EntityPos = CamTargetEntity->GetPosition();
@ -1306,7 +1306,7 @@ CCam::Using3rdPersonMouseCam()
(Mode == MODE_FOLLOWPED || (Mode == MODE_FOLLOWPED ||
TheCamera.m_bPlayerIsInGarage && TheCamera.m_bPlayerIsInGarage &&
FindPlayerPed() && FindPlayerPed()->m_nPedState != PED_DRIVING && FindPlayerPed() && FindPlayerPed()->m_nPedState != PED_DRIVING &&
Mode != MODE_TOPDOWN1 && this->CamTargetEntity == FindPlayerPed()); Mode != MODE_TOPDOWN && this->CamTargetEntity == FindPlayerPed());
} }
bool bool

View File

@ -11,14 +11,15 @@ struct CCam
{ {
enum enum
{ {
MODE_TOPDOWN1 = 1, MODE_NONE = 0,
MODE_TOPDOWN2, MODE_TOPDOWN,
MODE_GTACLASSIC,
MODE_BEHINDCAR, MODE_BEHINDCAR,
MODE_FOLLOWPED, MODE_FOLLOWPED,
MODE_AIMING, MODE_AIMING,
MODE_DEBUG, MODE_DEBUG,
MODE_SNIPER, MODE_SNIPER,
MODE_ROCKET, MODE_ROCKETLAUNCHER,
MODE_MODELVIEW, MODE_MODELVIEW,
MODE_BILL, MODE_BILL,
MODE_SYPHON, MODE_SYPHON,
@ -26,35 +27,35 @@ struct CCam
MODE_CHEESYZOOM, MODE_CHEESYZOOM,
MODE_WHEELCAM, MODE_WHEELCAM,
MODE_FIXED, MODE_FIXED,
MODE_FIRSTPERSON, MODE_1STPERSON,
MODE_FLYBY, MODE_FLYBY,
MODE_CAMONASTRING, MODE_CAM_ON_A_STRING,
MODE_REACTIONCAM, MODE_REACTION,
MODE_FOLLOWPEDWITHBINDING, MODE_FOLLOW_PED_WITH_BIND,
MODE_CHRISWITHBINDINGPLUSROTATION, MODE_CHRIS,
MODE_BEHINDBOAT, MODE_BEHINDBOAT,
MODE_PLAYERFALLENWATER, MODE_PLAYER_FALLEN_WATER,
MODE_CAMONTRAINROOF, MODE_CAM_ON_TRAIN_ROOF,
MODE_CAMRUNNINGSIDETRAIN, MODE_CAM_RUNNING_SIDE_TRAIN,
MODE_BLOODONTHETRACKS, MODE_BLOOD_ON_THE_TRACKS,
MODE_IMTHEPASSENGERWOOWOO, MODE_IM_THE_PASSENGER_WOOWOO,
MODE_SYPHONCRIMINFRONT, MODE_SYPHON_CRIM_IN_FRONT,
MODE_PEDSDEADBABY, MODE_PED_DEAD_BABY,
MODE_CUSHYPILLOWSARSE, MODE_PILLOWS_PAPS,
MODE_LOOKATCARS, MODE_LOOK_AT_CARS,
MODE_ARRESTCAMONE, MODE_ARRESTCAM_ONE,
MODE_ARRESTCAMTWO, MODE_ARRESTCAM_TWO,
MODE_M16FIRSTPERSON_34, MODE_M16_1STPERSON,
MODE_SPECIALFIXEDFORSYPHON, MODE_SPECIAL_FIXED_FOR_SYPHON,
MODE_FIGHT, MODE_FIGHT_CAM,
MODE_TOPDOWNPED, MODE_TOP_DOWN_PED,
MODE_SNIPER_RUN_AROUND, MODE_SNIPER_RUNABOUT,
MODE_ROCKET_RUN_AROUND, MODE_ROCKETLAUNCHER_RUNABOUT,
MODE_FIRSTPERSONPEDONPC_40, MODE_1STPERSON_RUNABOUT,
MODE_FIRSTPERSONPEDONPC_41, MODE_M16_1STPERSON_RUNABOUT,
MODE_FIRSTPERSONPEDONPC_42, MODE_FIGHT_CAM_RUNABOUT,
MODE_EDITOR, MODE_EDITOR,
MODE_M16FIRSTPERSON_44 MODE_HELICANNON_1STPERSON, // vice city leftover
}; };
bool bBelowMinDist; //used for follow ped mode bool bBelowMinDist; //used for follow ped mode

File diff suppressed because it is too large Load Diff

View File

@ -5,11 +5,11 @@
enum eControllerType enum eControllerType
{ {
KEYBOARD, KEYBOARD = 0,
OPTIONAL_EXTRA, OPTIONAL_EXTRA,
MOUSE, MOUSE,
JOYSTICK, JOYSTICK,
TOTAL_CONTROLLER_TYPES MAX_CONTROLLERTYPES,
}; };
enum e_ControllerAction enum e_ControllerAction
@ -28,8 +28,6 @@ enum e_ControllerAction
PED_JUMPING, PED_JUMPING,
PED_SPRINT, PED_SPRINT,
PED_LOOKBEHIND, PED_LOOKBEHIND,
//PED_DUCK, // VC
//PED_ANSWER_PHONE, // VC
VEHICLE_ACCELERATE, VEHICLE_ACCELERATE,
VEHICLE_BRAKE, VEHICLE_BRAKE,
VEHICLE_CHANGE_RADIO_STATION, VEHICLE_CHANGE_RADIO_STATION,
@ -52,18 +50,49 @@ enum e_ControllerAction
NETWORK_TALK, NETWORK_TALK,
PED_1RST_PERSON_LOOK_UP, PED_1RST_PERSON_LOOK_UP,
PED_1RST_PERSON_LOOK_DOWN, PED_1RST_PERSON_LOOK_DOWN,
_CONTROLLERACTION_36, // Unused
CONTROLLERACTION_36, // unk, unused?
TOGGLE_DPAD, TOGGLE_DPAD,
SWITCH_DEBUG_CAM_ON, SWITCH_DEBUG_CAM_ON,
TAKE_SCREEN_SHOT, TAKE_SCREEN_SHOT,
SHOW_MOUSE_POINTER_TOGGLE, SHOW_MOUSE_POINTER_TOGGLE,
MAX_CONTROLLERACTIONS,
};
TOTAL_CONTROL_ACTIONS enum e_ControllerActionType
{
ACTIONTYPE_1RSTPERSON = 0,
ACTIONTYPE_3RDPERSON,
ACTIONTYPE_VEHICLE,
ACTIONTYPE_VEHICLE_3RDPERSON,
ACTIONTYPE_COMMON,
ACTIONTYPE_1RST3RDPERSON,
ACTIONTYPE_NONE,
};
enum eContSetOrder
{
SETORDER_NONE = 0,
SETORDER_1,
SETORDER_2,
SETORDER_3,
SETORDER_4,
MAX_SETORDERS,
};
enum eSimCheckers
{
SIM_X1 = 0, SIM_Y1, // DPad
SIM_X2, SIM_Y2, // LeftStick
MAX_SIMS
}; };
class CMouseControllerState; class CMouseControllerState;
class CControllerState;
#define JOY_BUTTONS 16
#define MAX_BUTTONS (JOY_BUTTONS+1)
#define ACTIONNAME_LENGTH 40 #define ACTIONNAME_LENGTH 40
@ -72,38 +101,97 @@ class CControllerConfigManager
public: public:
struct tControllerConfigBind struct tControllerConfigBind
{ {
RsKeyCodes m_Key; int32 m_Key;
int32 m_ContSetOrder; int32 m_ContSetOrder;
tControllerConfigBind()
{
m_Key = 0;
m_ContSetOrder = 0;
}
}; };
bool firstCapture; bool m_bFirstCapture;
DIJOYSTATE2 m_OldState; char _pad0[3];
DIJOYSTATE2 m_NewState; #ifdef __DINPUT_INCLUDED__
wchar m_aActionNames[TOTAL_CONTROL_ACTIONS][ACTIONNAME_LENGTH]; DIJOYSTATE2 m_OldState;
bool m_aButtonStates[17]; DIJOYSTATE2 m_NewState;
tControllerConfigBind m_aSettings[TOTAL_CONTROL_ACTIONS][TOTAL_CONTROLLER_TYPES]; #endif
uint8 m_aSimCheckers[4][4]; wchar m_aActionNames[MAX_CONTROLLERACTIONS][40];
bool m_bMouseAssociated; bool m_aButtonStates[MAX_BUTTONS];
char _pad1[3];
tControllerConfigBind m_aSettings[MAX_CONTROLLERACTIONS][MAX_CONTROLLERTYPES];
bool m_aSimCheckers[MAX_SIMS][MAX_CONTROLLERTYPES];
bool m_bMouseAssociated;
char _pad2[3];
void UpdateJoyButtonState(int padnumber); CControllerConfigManager();
void UpdateJoyInConfigMenus_ButtonDown(int button, int padnumber);
void AffectControllerStateOn_ButtonDown(int button, eControllerType type); void MakeControllerActionsBlank();
void UpdateJoyInConfigMenus_ButtonUp(int button, int padnumber);
void AffectControllerStateOn_ButtonUp(int button, int padnumber);
int32 GetJoyButtonJustDown(); int32 GetJoyButtonJustDown();
void LoadSettings(int32 file);
void SaveSettings(int32 file);
void MakeControllerActionsBlank();
void InitDefaultControlConfiguration();
void InitDefaultControlConfigMouse(CMouseControllerState const &mousestate);
void InitDefaultControlConfigJoyPad(unsigned int buttons);
void ClearSimButtonPressCheckers();
void AffectPadFromKeyBoard();
void AffectPadFromMouse();
void ClearSettingsAssociatedWithAction(int, int);
void GetWideStringOfCommandKeys(uint16, wchar*, uint16); void SaveSettings(int32 file);
void LoadSettings(int32 file);
void InitDefaultControlConfiguration();
void InitDefaultControlConfigMouse(CMouseControllerState const &availableButtons);
void InitDefaultControlConfigJoyPad(uint32 buttons);
void InitialiseControllerActionNameArray();
void UpdateJoyInConfigMenus_ButtonDown (int32 button, int32 padnumber);
void AffectControllerStateOn_ButtonDown (int32 button, eControllerType type);
void AffectControllerStateOn_ButtonDown_Driving (int32 button, eControllerType type, CControllerState &state);
void AffectControllerStateOn_ButtonDown_FirstPersonOnly (int32 button, eControllerType type, CControllerState &state);
void AffectControllerStateOn_ButtonDown_ThirdPersonOnly (int32 button, eControllerType type, CControllerState &state);
void AffectControllerStateOn_ButtonDown_FirstAndThirdPersonOnly (int32 button, eControllerType type, CControllerState &state);
void AffectControllerStateOn_ButtonDown_AllStates (int32 button, eControllerType type, CControllerState &state);
void AffectControllerStateOn_ButtonDown_VehicleAndThirdPersonOnly(int32 button, eControllerType type, CControllerState &state);
void UpdateJoyInConfigMenus_ButtonUp(int32 button, int32 padnumber);
void AffectControllerStateOn_ButtonUp(int32 button, eControllerType type);
void AffectControllerStateOn_ButtonUp_All_Player_States(int32 button, eControllerType type, CControllerState &state);
void AffectPadFromKeyBoard();
void AffectPadFromMouse();
void ClearSimButtonPressCheckers();
bool GetIsKeyboardKeyDown (RsKeyCodes keycode);
bool GetIsKeyboardKeyJustDown(RsKeyCodes keycode);
bool GetIsMouseButtonDown (RsKeyCodes keycode);
bool GetIsMouseButtonUp (RsKeyCodes keycode);
void DeleteMatchingCommonControls (e_ControllerAction action, int32 key, eControllerType type);
void DeleteMatching3rdPersonControls (e_ControllerAction action, int32 key, eControllerType type);
void DeleteMatching1rst3rdPersonControls (e_ControllerAction action, int32 key, eControllerType type);
void DeleteMatchingVehicleControls (e_ControllerAction action, int32 key, eControllerType type);
void DeleteMatchingVehicle_3rdPersonControls(e_ControllerAction action, int32 key, eControllerType type);
void DeleteMatching1rstPersonControls (e_ControllerAction action, int32 key, eControllerType type);
void DeleteMatchingActionInitiators (e_ControllerAction action, int32 key, eControllerType type);
bool GetIsKeyBlank(int32 key, eControllerType type);
e_ControllerActionType GetActionType(e_ControllerAction action);
void ClearSettingsAssociatedWithAction (e_ControllerAction action, eControllerType type);
wchar *GetControllerSettingTextWithOrderNumber(e_ControllerAction action, eContSetOrder setorder);
wchar *GetControllerSettingTextKeyBoard (e_ControllerAction action, eControllerType type);
wchar *GetControllerSettingTextMouse (e_ControllerAction action);
wchar *GetControllerSettingTextJoystick (e_ControllerAction action);
int32 GetNumOfSettingsForAction(e_ControllerAction action);
void GetWideStringOfCommandKeys(uint16 action, wchar *text, uint16 leight);
int32 GetControllerKeyAssociatedWithAction(e_ControllerAction action, eControllerType type);
void UpdateJoyButtonState(int32 padnumber);
bool GetIsActionAButtonCombo (e_ControllerAction action);
wchar *GetButtonComboText (e_ControllerAction action);
void SetControllerKeyAssociatedWithAction(e_ControllerAction action, int32 key, eControllerType type);
int32 GetMouseButtonAssociatedWithAction (e_ControllerAction action);
void SetMouseButtonAssociatedWithAction (e_ControllerAction action, int32 button);
void ResetSettingOrder (e_ControllerAction action);
}; };
VALIDATE_SIZE(CControllerConfigManager, 0x143C); VALIDATE_SIZE(CControllerConfigManager, 0x143C);

View File

@ -1466,7 +1466,7 @@ void CMenuManager::Process(void)
else { else {
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0); DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SUCCESS, 0);
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
ControlsManager.ClearSettingsAssociatedWithAction(m_CurrCntrlAction, i); ControlsManager.ClearSettingsAssociatedWithAction((e_ControllerAction)m_CurrCntrlAction, (eControllerType)i);
field_534 = false; field_534 = false;
m_bKeyChangeNotProcessed = false; m_bKeyChangeNotProcessed = false;
pControlEdit = nil; pControlEdit = nil;

View File

@ -342,6 +342,12 @@ enum
NUM_MENUROWS = 18, NUM_MENUROWS = 18,
}; };
enum eControlMethod
{
CONTROL_STANDART = 0,
CONTROL_CLASSIC,
};
struct tSkinInfo struct tSkinInfo
{ {
int field_0; int field_0;
@ -431,6 +437,9 @@ public:
int m_nCurrSaveSlot; int m_nCurrSaveSlot;
int m_nScreenChangeDelayTimer; int m_nScreenChangeDelayTimer;
public:
bool GetIsMenuActive() {return !!m_bMenuActive;}
public: public:
static int32 &OS_Language; static int32 &OS_Language;
static int8 &m_PrefsUseVibration; static int8 &m_PrefsUseVibration;

View File

@ -1,56 +1,5 @@
#pragma once #pragma once
// same as RW skeleton
/*
enum Key
{
// ascii...
KEY_ESC = 128,
KEY_F1 = 129,
KEY_F2 = 130,
KEY_F3 = 131,
KEY_F4 = 132,
KEY_F5 = 133,
KEY_F6 = 134,
KEY_F7 = 135,
KEY_F8 = 136,
KEY_F9 = 137,
KEY_F10 = 138,
KEY_F11 = 139,
KEY_F12 = 140,
KEY_INS = 141,
KEY_DEL = 142,
KEY_HOME = 143,
KEY_END = 144,
KEY_PGUP = 145,
KEY_PGDN = 146,
KEY_UP = 147,
KEY_DOWN = 148,
KEY_LEFT = 149,
KEY_RIGHT = 150,
// some stuff ommitted
KEY_BACKSP = 168,
KEY_TAB = 169,
KEY_CAPSLK = 170,
KEY_ENTER = 171,
KEY_LSHIFT = 172,
KEY_RSHIFT = 173,
KEY_LCTRL = 174,
KEY_RCTRL = 175,
KEY_LALT = 176,
KEY_RALT = 177,
KEY_NULL, // unused
KEY_NUMKEYS
};
*/
enum { enum {
PLAYERCONTROL_ENABLED = 0, PLAYERCONTROL_ENABLED = 0,
PLAYERCONTROL_DISABLED_1 = 1, PLAYERCONTROL_DISABLED_1 = 1,
@ -299,61 +248,130 @@ public:
static int32 *EditCodesForControls(int32 *pRsKeys, int32 nSize); static int32 *EditCodesForControls(int32 *pRsKeys, int32 nSize);
// mouse // mouse
bool GetLeftMouseJustDown() { return !!(NewMouseControllerState.LMB && !OldMouseControllerState.LMB); } bool GetLeftMouseJustDown() { return !!(NewMouseControllerState.LMB && !OldMouseControllerState.LMB); }
bool GetRightMouseJustDown() { return !!(NewMouseControllerState.RMB && !OldMouseControllerState.RMB); } bool GetRightMouseJustDown() { return !!(NewMouseControllerState.RMB && !OldMouseControllerState.RMB); }
bool GetMiddleMouseJustDown() { return !!(NewMouseControllerState.MMB && !OldMouseControllerState.MMB); } bool GetMiddleMouseJustDown() { return !!(NewMouseControllerState.MMB && !OldMouseControllerState.MMB); }
bool GetMouseWheelUpJustDown() { return !!(NewMouseControllerState.WHEELUP && !OldMouseControllerState.WHEELUP); }
bool GetMouseWheelDownJustDown() { return !!(NewMouseControllerState.WHEELDN && !OldMouseControllerState.WHEELDN);}
bool GetMouseX1JustDown() { return !!(NewMouseControllerState.MXB1 && !OldMouseControllerState.MXB1); }
bool GetMouseX2JustDown() { return !!(NewMouseControllerState.MXB2 && !OldMouseControllerState.MXB2); }
bool GetLeftMouse() { return NewMouseControllerState.LMB; }
bool GetRightMouse() { return NewMouseControllerState.RMB; }
bool GetMiddleMouse() { return NewMouseControllerState.MMB; }
bool GetMouseWheelUp() { return NewMouseControllerState.WHEELUP; }
bool GetMouseWheelDown() { return NewMouseControllerState.WHEELDN; }
bool GetMouseX1() { return NewMouseControllerState.MXB1; }
bool GetMouseX2() { return NewMouseControllerState.MXB2; }
bool GetLeftMouseUp() { return !OldMouseControllerState.LMB; }
bool GetRightMouseUp() { return !OldMouseControllerState.RMB; }
bool GetMiddleMouseUp() { return !OldMouseControllerState.MMB; }
bool GetMouseWheelUpUp() { return !OldMouseControllerState.WHEELUP; }
bool GetMouseWheelDownUp() { return !OldMouseControllerState.WHEELDN; }
bool GetMouseX1Up() { return !OldMouseControllerState.MXB1; }
bool GetMouseX2Up() { return !OldMouseControllerState.MXB2; }
float GetMouseX() { return NewMouseControllerState.x; } float GetMouseX() { return NewMouseControllerState.x; }
float GetMouseY() { return NewMouseControllerState.y; } float GetMouseY() { return NewMouseControllerState.y; }
// keyboard // keyboard
bool GetCharJustDown(int32 c) { return !!(NewKeyState.VK_KEYS[c] && !OldKeyState.VK_KEYS[c]); } bool GetCharJustDown(int32 c) { return !!(NewKeyState.VK_KEYS[c] && !OldKeyState.VK_KEYS[c]); }
bool GetFJustDown(int32 n) { return !!(NewKeyState.F[n] && !OldKeyState.F[n]); } bool GetFJustDown(int32 n) { return !!(NewKeyState.F[n] && !OldKeyState.F[n]); }
bool GetEscapeJustDown() { return !!(NewKeyState.ESC && !OldKeyState.ESC); } bool GetEscapeJustDown() { return !!(NewKeyState.ESC && !OldKeyState.ESC); }
bool GetInsertJustDown() { return !!(NewKeyState.INS && !OldKeyState.INS); } bool GetInsertJustDown() { return !!(NewKeyState.INS && !OldKeyState.INS); }
bool GetDeleteJustDown() { return !!(NewKeyState.DEL && !OldKeyState.DEL); } bool GetDeleteJustDown() { return !!(NewKeyState.DEL && !OldKeyState.DEL); }
bool GetHomeJustDown() { return !!(NewKeyState.HOME && !OldKeyState.HOME); } bool GetHomeJustDown() { return !!(NewKeyState.HOME && !OldKeyState.HOME); }
bool GetEndJustDown() { return !!(NewKeyState.END && !OldKeyState.END); } bool GetEndJustDown() { return !!(NewKeyState.END && !OldKeyState.END); }
bool GetPageUpJustDown() { return !!(NewKeyState.PGUP && !OldKeyState.PGUP); } bool GetPageUpJustDown() { return !!(NewKeyState.PGUP && !OldKeyState.PGUP); }
bool GetPageDownJustDown() { return !!(NewKeyState.PGDN && !OldKeyState.PGDN); } bool GetPageDownJustDown() { return !!(NewKeyState.PGDN && !OldKeyState.PGDN); }
bool GetUpJustDown() { return !!(NewKeyState.UP && !OldKeyState.UP); } bool GetUpJustDown() { return !!(NewKeyState.UP && !OldKeyState.UP); }
bool GetDownJustDown() { return !!(NewKeyState.DOWN && !OldKeyState.DOWN); } bool GetDownJustDown() { return !!(NewKeyState.DOWN && !OldKeyState.DOWN); }
bool GetLeftJustDown() { return !!(NewKeyState.LEFT && !OldKeyState.LEFT); } bool GetLeftJustDown() { return !!(NewKeyState.LEFT && !OldKeyState.LEFT); }
bool GetRightJustDown() { return !!(NewKeyState.RIGHT && !OldKeyState.RIGHT); } bool GetRightJustDown() { return !!(NewKeyState.RIGHT && !OldKeyState.RIGHT); }
bool GetScrollLockJustDown() { return !!(NewKeyState.SCROLLLOCK && !OldKeyState.SCROLLLOCK); } bool GetScrollLockJustDown() { return !!(NewKeyState.SCROLLLOCK && !OldKeyState.SCROLLLOCK); }
bool GetPauseJustDown() { return !!(NewKeyState.PAUSE && !OldKeyState.PAUSE); } bool GetPauseJustDown() { return !!(NewKeyState.PAUSE && !OldKeyState.PAUSE); }
bool GetNumLockJustDown() { return !!(NewKeyState.NUMLOCK && !OldKeyState.NUMLOCK); } bool GetNumLockJustDown() { return !!(NewKeyState.NUMLOCK && !OldKeyState.NUMLOCK); }
bool GetDivideJustDown() { return !!(NewKeyState.DIV && !OldKeyState.DIV); } bool GetDivideJustDown() { return !!(NewKeyState.DIV && !OldKeyState.DIV); }
bool GetTimesJustDown() { return !!(NewKeyState.MUL && !OldKeyState.MUL); } bool GetTimesJustDown() { return !!(NewKeyState.MUL && !OldKeyState.MUL); }
bool GetMinusJustDown() { return !!(NewKeyState.SUB && !OldKeyState.SUB); } bool GetMinusJustDown() { return !!(NewKeyState.SUB && !OldKeyState.SUB); }
bool GetPlusJustDown() { return !!(NewKeyState.ADD && !OldKeyState.ADD); } bool GetPlusJustDown() { return !!(NewKeyState.ADD && !OldKeyState.ADD); }
bool GetPadEnterJustDown() { return !!(NewKeyState.ENTER && !OldKeyState.ENTER); } // GetEnterJustDown bool GetPadEnterJustDown() { return !!(NewKeyState.ENTER && !OldKeyState.ENTER); } // GetEnterJustDown
bool GetPadDelJustDown() { return !!(NewKeyState.DECIMAL && !OldKeyState.DECIMAL); } bool GetPadDelJustDown() { return !!(NewKeyState.DECIMAL && !OldKeyState.DECIMAL); }
bool GetPad1JustDown() { return !!(NewKeyState.NUM1 && !OldKeyState.NUM1); } bool GetPad1JustDown() { return !!(NewKeyState.NUM1 && !OldKeyState.NUM1); }
bool GetPad2JustDown() { return !!(NewKeyState.NUM2 && !OldKeyState.NUM2); } bool GetPad2JustDown() { return !!(NewKeyState.NUM2 && !OldKeyState.NUM2); }
bool GetPad3JustDown() { return !!(NewKeyState.NUM3 && !OldKeyState.NUM3); } bool GetPad3JustDown() { return !!(NewKeyState.NUM3 && !OldKeyState.NUM3); }
bool GetPad4JustDown() { return !!(NewKeyState.NUM4 && !OldKeyState.NUM4); } bool GetPad4JustDown() { return !!(NewKeyState.NUM4 && !OldKeyState.NUM4); }
bool GetPad5JustDown() { return !!(NewKeyState.NUM5 && !OldKeyState.NUM5); } bool GetPad5JustDown() { return !!(NewKeyState.NUM5 && !OldKeyState.NUM5); }
bool GetPad6JustDown() { return !!(NewKeyState.NUM6 && !OldKeyState.NUM6); } bool GetPad6JustDown() { return !!(NewKeyState.NUM6 && !OldKeyState.NUM6); }
bool GetPad7JustDown() { return !!(NewKeyState.NUM7 && !OldKeyState.NUM7); } bool GetPad7JustDown() { return !!(NewKeyState.NUM7 && !OldKeyState.NUM7); }
bool GetPad8JustDown() { return !!(NewKeyState.NUM8 && !OldKeyState.NUM8); } bool GetPad8JustDown() { return !!(NewKeyState.NUM8 && !OldKeyState.NUM8); }
bool GetPad9JustDown() { return !!(NewKeyState.NUM9 && !OldKeyState.NUM9); } bool GetPad9JustDown() { return !!(NewKeyState.NUM9 && !OldKeyState.NUM9); }
bool GetPad0JustDown() { return !!(NewKeyState.NUM0 && !OldKeyState.NUM0); } bool GetPad0JustDown() { return !!(NewKeyState.NUM0 && !OldKeyState.NUM0); }
bool GetBackspaceJustDown() { return !!(NewKeyState.BACKSP && !OldKeyState.BACKSP); } bool GetBackspaceJustDown() { return !!(NewKeyState.BACKSP && !OldKeyState.BACKSP); }
bool GetTabJustDown() { return !!(NewKeyState.TAB && !OldKeyState.TAB); } bool GetTabJustDown() { return !!(NewKeyState.TAB && !OldKeyState.TAB); }
bool GetCapsLockJustDown() { return !!(NewKeyState.CAPSLOCK && !OldKeyState.CAPSLOCK); } bool GetCapsLockJustDown() { return !!(NewKeyState.CAPSLOCK && !OldKeyState.CAPSLOCK); }
bool GetEnterJustDown() { return !!(NewKeyState.EXTENTER && !OldKeyState.EXTENTER); } bool GetEnterJustDown() { return !!(NewKeyState.EXTENTER && !OldKeyState.EXTENTER); }
bool GetLeftShiftJustDown() { return !!(NewKeyState.LSHIFT && !OldKeyState.LSHIFT); } bool GetLeftShiftJustDown() { return !!(NewKeyState.LSHIFT && !OldKeyState.LSHIFT); }
bool GetShiftJustDown() { return !!(NewKeyState.SHIFT && !OldKeyState.SHIFT); } bool GetShiftJustDown() { return !!(NewKeyState.SHIFT && !OldKeyState.SHIFT); }
bool GetRightShiftJustDown() { return !!(NewKeyState.RSHIFT && !OldKeyState.RSHIFT); } bool GetRightShiftJustDown() { return !!(NewKeyState.RSHIFT && !OldKeyState.RSHIFT); }
bool GetLeftCtrlJustDown() { return !!(NewKeyState.LCTRL && !OldKeyState.LCTRL); } bool GetLeftCtrlJustDown() { return !!(NewKeyState.LCTRL && !OldKeyState.LCTRL); }
bool GetRightCtrlJustDown() { return !!(NewKeyState.RCTRL && !OldKeyState.RCTRL); } bool GetRightCtrlJustDown() { return !!(NewKeyState.RCTRL && !OldKeyState.RCTRL); }
bool GetLeftAltJustDown() { return !!(NewKeyState.LALT && !OldKeyState.LALT); } bool GetLeftAltJustDown() { return !!(NewKeyState.LALT && !OldKeyState.LALT); }
bool GetRightAltJustDown() { return !!(NewKeyState.RALT && !OldKeyState.RALT); } bool GetRightAltJustDown() { return !!(NewKeyState.RALT && !OldKeyState.RALT); }
bool GetLeftWinJustDown() { return !!(NewKeyState.LWIN && !OldKeyState.LWIN); } bool GetLeftWinJustDown() { return !!(NewKeyState.LWIN && !OldKeyState.LWIN); }
bool GetRightWinJustDown() { return !!(NewKeyState.RWIN && !OldKeyState.RWIN); } bool GetRightWinJustDown() { return !!(NewKeyState.RWIN && !OldKeyState.RWIN); }
bool GetAppsJustDown() { return !!(NewKeyState.APPS && !OldKeyState.APPS); } bool GetAppsJustDown() { return !!(NewKeyState.APPS && !OldKeyState.APPS); }
bool GetChar(int32 c) { return NewKeyState.VK_KEYS[c]; }
bool GetF(int32 n) { return NewKeyState.F[n]; }
bool GetEscape() { return NewKeyState.ESC; }
bool GetInsert() { return NewKeyState.INS; }
bool GetDelete() { return NewKeyState.DEL; }
bool GetHome() { return NewKeyState.HOME; }
bool GetEnd() { return NewKeyState.END; }
bool GetPageUp() { return NewKeyState.PGUP; }
bool GetPageDown() { return NewKeyState.PGDN; }
bool GetUp() { return NewKeyState.UP; }
bool GetDown() { return NewKeyState.DOWN; }
bool GetLeft() { return NewKeyState.LEFT; }
bool GetRight() { return NewKeyState.RIGHT; }
bool GetScrollLock() { return NewKeyState.SCROLLLOCK; }
bool GetPause() { return NewKeyState.PAUSE; }
bool GetNumLock() { return NewKeyState.NUMLOCK; }
bool GetDivide() { return NewKeyState.DIV; }
bool GetTimes() { return NewKeyState.MUL; }
bool GetMinus() { return NewKeyState.SUB; }
bool GetPlus() { return NewKeyState.ADD; }
bool GetPadEnter() { return NewKeyState.ENTER; } // GetEnterJustDown
bool GetPadDel() { return NewKeyState.DECIMAL; }
bool GetPad1() { return NewKeyState.NUM1; }
bool GetPad2() { return NewKeyState.NUM2; }
bool GetPad3() { return NewKeyState.NUM3; }
bool GetPad4() { return NewKeyState.NUM4; }
bool GetPad5() { return NewKeyState.NUM5; }
bool GetPad6() { return NewKeyState.NUM6; }
bool GetPad7() { return NewKeyState.NUM7; }
bool GetPad8() { return NewKeyState.NUM8; }
bool GetPad9() { return NewKeyState.NUM9; }
bool GetPad0() { return NewKeyState.NUM0; }
bool GetBackspace() { return NewKeyState.BACKSP; }
bool GetTab() { return NewKeyState.TAB; }
bool GetCapsLock() { return NewKeyState.CAPSLOCK; }
bool GetEnter() { return NewKeyState.EXTENTER; }
bool GetLeftShift() { return NewKeyState.LSHIFT; }
bool GetShift() { return NewKeyState.SHIFT; }
bool GetRightShift() { return NewKeyState.RSHIFT; }
bool GetLeftCtrl() { return NewKeyState.LCTRL; }
bool GetRightCtrl() { return NewKeyState.RCTRL; }
bool GetLeftAlt() { return NewKeyState.LALT; }
bool GetRightAlt() { return NewKeyState.RALT; }
bool GetLeftWin() { return NewKeyState.LWIN; }
bool GetRightWin() { return NewKeyState.RWIN; }
bool GetApps() { return NewKeyState.APPS; }
// pad // pad
bool GetTriangleJustDown() { return !!(NewState.Triangle && !OldState.Triangle); } bool GetTriangleJustDown() { return !!(NewState.Triangle && !OldState.Triangle); }
@ -370,21 +388,14 @@ public:
bool GetRightShoulder2JustDown() { return !!(NewState.RightShoulder2 && !OldState.RightShoulder2); } bool GetRightShoulder2JustDown() { return !!(NewState.RightShoulder2 && !OldState.RightShoulder2); }
bool GetStartJustDown() { return !!(NewState.Start && !OldState.Start); } bool GetStartJustDown() { return !!(NewState.Start && !OldState.Start); }
/* bool GetTriangle() { return !!NewState.Triangle; }
int32 GetLeftShoulder1(void) { return NewState.LeftShoulder1; } bool GetCircle() { return !!NewState.Circle; }
int32 GetLeftShoulder2(void) { return NewState.LeftShoulder2; } bool GetCross() { return !!NewState.Cross; }
int32 GetRightShoulder1(void) { return NewState.RightShoulder1; } bool GetSquare() { return !!NewState.Square; }
int32 GetRightShoulder2(void) { return NewState.RightShoulder2; } bool GetDPadUp() { return !!NewState.DPadUp; }
*/ bool GetDPadDown() { return !!NewState.DPadDown; }
bool GetDPadLeft() { return !!NewState.DPadLeft; }
bool GetTriangle() { return !!NewState.Triangle; } bool GetDPadRight() { return !!NewState.DPadRight; }
bool GetCircle() { return !!NewState.Circle; }
bool GetCross() { return !!NewState.Cross; }
bool GetSquare() { return !!NewState.Square; }
bool GetDPadUp() { return !!NewState.DPadUp; }
bool GetDPadDown() { return !!NewState.DPadDown; }
bool GetDPadLeft() { return !!NewState.DPadLeft; }
bool GetDPadRight() { return !!NewState.DPadRight; }
bool GetLeftShoulder1(void) { return !!NewState.LeftShoulder1; } bool GetLeftShoulder1(void) { return !!NewState.LeftShoulder1; }
bool GetLeftShoulder2(void) { return !!NewState.LeftShoulder2; } bool GetLeftShoulder2(void) { return !!NewState.LeftShoulder2; }
bool GetRightShoulder1(void) { return !!NewState.RightShoulder1; } bool GetRightShoulder1(void) { return !!NewState.RightShoulder1; }
@ -392,8 +403,6 @@ public:
bool ArePlayerControlsDisabled(void) { return DisablePlayerControls != PLAYERCONTROL_ENABLED; } bool ArePlayerControlsDisabled(void) { return DisablePlayerControls != PLAYERCONTROL_ENABLED; }
}; };
VALIDATE_SIZE(CPad, 0xFC); VALIDATE_SIZE(CPad, 0xFC);
extern CPad *Pads; //[2] extern CPad *Pads; //[2]
#define IsButtonJustDown(pad, btn) \
(!(pad)->OldState.btn && (pad)->NewState.btn)

View File

@ -275,7 +275,7 @@ void CRadar::DrawBlips()
TransformRadarPointToScreenSpace(out, in); TransformRadarPointToScreenSpace(out, in);
float angle; float angle;
if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN1) if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN)
angle = PI + FindPlayerHeading(); angle = PI + FindPlayerHeading();
#ifdef FIX_BUGS #ifdef FIX_BUGS
else if (TheCamera.GetLookDirection() != LOOKING_FORWARD) else if (TheCamera.GetLookDirection() != LOOKING_FORWARD)
@ -1081,14 +1081,14 @@ void CRadar::TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D
s = -Sin(TheCamera.GetForward().Heading()); s = -Sin(TheCamera.GetForward().Heading());
c = Cos(TheCamera.GetForward().Heading()); c = Cos(TheCamera.GetForward().Heading());
if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN1 || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWNPED) { if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED) {
s = 0.0f; s = 0.0f;
c = 1.0f; c = 1.0f;
} }
else if (TheCamera.GetLookDirection() != LOOKING_FORWARD) { else if (TheCamera.GetLookDirection() != LOOKING_FORWARD) {
CVector forward; CVector forward;
if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_FIRSTPERSON) { if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON) {
forward = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetForward(); forward = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetForward();
forward.Normalise(); // a bit useless... forward.Normalise(); // a bit useless...
} }
@ -1120,7 +1120,7 @@ WRAPPER void CRadar::TransformRealWorldPointToRadarSpace(CVector2D &out, const C
void CRadar::TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D &in) void CRadar::TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D &in)
{ {
float s, c; float s, c;
if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN1 || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWNPED) { if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED) {
s = 0.0f; s = 0.0f;
c = 1.0f; c = 1.0f;
} }
@ -1131,7 +1131,7 @@ void CRadar::TransformRealWorldPointToRadarSpace(CVector2D &out, const CVector2D
else { else {
CVector forward; CVector forward;
if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_FIRSTPERSON) { if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON) {
forward = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetForward(); forward = TheCamera.Cams[TheCamera.ActiveCam].CamTargetEntity->GetForward();
forward.Normalise(); // a bit useless... forward.Normalise(); // a bit useless...
} }

View File

@ -379,9 +379,9 @@ Render2dStuff(void)
bool firstPersonWeapon = false; bool firstPersonWeapon = false;
int cammode = TheCamera.Cams[TheCamera.ActiveCam].Mode; int cammode = TheCamera.Cams[TheCamera.ActiveCam].Mode;
if(cammode == CCam::MODE_SNIPER || if(cammode == CCam::MODE_SNIPER ||
cammode == CCam::MODE_SNIPER_RUN_AROUND || cammode == CCam::MODE_SNIPER_RUNABOUT ||
cammode == CCam::MODE_ROCKET || cammode == CCam::MODE_ROCKETLAUNCHER ||
cammode == CCam::MODE_ROCKET_RUN_AROUND) cammode == CCam::MODE_ROCKETLAUNCHER_RUNABOUT)
firstPersonWeapon = true; firstPersonWeapon = true;
// Draw black border for sniper and rocket launcher // Draw black border for sniper and rocket launcher

View File

@ -249,7 +249,15 @@ public:
CMatrix &Invert(const CMatrix &src, CMatrix &dst); CMatrix &Invert(const CMatrix &src, CMatrix &dst);
CVector operator*(const CMatrix &mat, const CVector &vec); CVector operator*(const CMatrix &mat, const CVector &vec);
CMatrix operator*(const CMatrix &m1, const CMatrix &m2); CMatrix operator*(const CMatrix &m1, const CMatrix &m2);
CVector MultiplyInverse(const CMatrix &mat, const CVector &vec); inline CVector MultiplyInverse(const CMatrix &mat, const CVector &vec)
{
CVector v(vec.x - mat.m_matrix.pos.x, vec.y - mat.m_matrix.pos.y, vec.z - mat.m_matrix.pos.z);
return CVector(
mat.m_matrix.right.x * v.x + mat.m_matrix.right.y * v.y + mat.m_matrix.right.z * v.z,
mat.m_matrix.up.x * v.x + mat.m_matrix.up.y * v.y + mat.m_matrix.up.z * v.z,
mat.m_matrix.at.x * v.x + mat.m_matrix.at.y * v.y + mat.m_matrix.at.z * v.z);
}
const CVector Multiply3x3(const CMatrix &mat, const CVector &vec); const CVector Multiply3x3(const CMatrix &mat, const CVector &vec);
const CVector Multiply3x3(const CVector &vec, const CMatrix &mat); const CVector Multiply3x3(const CVector &vec, const CMatrix &mat);

View File

@ -126,16 +126,6 @@ operator*(const CMatrix &m1, const CMatrix &m2)
return out; return out;
} }
CVector
MultiplyInverse(const CMatrix &mat, const CVector &vec)
{
CVector v(vec.x - mat.m_matrix.pos.x, vec.y - mat.m_matrix.pos.y, vec.z - mat.m_matrix.pos.z);
return CVector(
mat.m_matrix.right.x * v.x + mat.m_matrix.right.y * v.y + mat.m_matrix.right.z * v.z,
mat.m_matrix.up.x * v.x + mat.m_matrix.up.y * v.y + mat.m_matrix.up.z * v.z,
mat.m_matrix.at.x * v.x + mat.m_matrix.at.y * v.y + mat.m_matrix.at.z * v.z);
}
const CVector const CVector
Multiply3x3(const CMatrix &mat, const CVector &vec) Multiply3x3(const CMatrix &mat, const CVector &vec)
{ {

View File

@ -26,6 +26,12 @@ MatchModelString(const char *modelname, int16 id)
#undef X #undef X
} }
void
TestModelIndices(void)
{
;
}
STARTPATCHES STARTPATCHES
InjectHook(0x48EB60, InitModelIndices, PATCH_JUMP); InjectHook(0x48EB60, InitModelIndices, PATCH_JUMP);
InjectHook(0x48F030, MatchModelString, PATCH_JUMP); InjectHook(0x48F030, MatchModelString, PATCH_JUMP);

View File

@ -365,6 +365,7 @@ enum{
void InitModelIndices(void); void InitModelIndices(void);
void MatchModelString(const char *name, int16 id); void MatchModelString(const char *name, int16 id);
void TestModelIndices(void);
inline bool inline bool
IsGlass(int16 id) IsGlass(int16 id)
@ -462,7 +463,6 @@ IsPickupModel(int16 id)
id == MI_UZI || id == MI_UZI ||
id == MI_M16 || id == MI_M16 ||
id == MI_FLAMETHROWER || id == MI_FLAMETHROWER ||
id >= MI_M16 && id <= MI_FLAMETHROWER ||
id == MI_PICKUP_ADRENALINE || id == MI_PICKUP_ADRENALINE ||
id == MI_PICKUP_BODYARMOUR || id == MI_PICKUP_BODYARMOUR ||
id == MI_PICKUP_INFO || id == MI_PICKUP_INFO ||

View File

@ -56,12 +56,13 @@ WRAPPER void CPed::StartFightDefend(uint8, uint8, uint8) { EAXJMP(0x4E7780); }
WRAPPER void CPed::ServiceTalking(void) { EAXJMP(0x4E5870); } WRAPPER void CPed::ServiceTalking(void) { EAXJMP(0x4E5870); }
WRAPPER void CPed::UpdatePosition(void) { EAXJMP(0x4C7A00); } WRAPPER void CPed::UpdatePosition(void) { EAXJMP(0x4C7A00); }
WRAPPER void CPed::WanderPath(void) { EAXJMP(0x4D28D0); } WRAPPER void CPed::WanderPath(void) { EAXJMP(0x4D28D0); }
WRAPPER void CPed::SeekCar(void) { EAXJMP(0x4D3F90); }
WRAPPER void CPed::UpdateFromLeader(void) { EAXJMP(0x4D8F30); } WRAPPER void CPed::UpdateFromLeader(void) { EAXJMP(0x4D8F30); }
WRAPPER void CPed::SetEnterCar_AllClear(CVehicle*, uint32, uint32) { EAXJMP(0x4E0A40); } WRAPPER void CPed::SetEnterCar_AllClear(CVehicle*, uint32, uint32) { EAXJMP(0x4E0A40); }
WRAPPER bool CPed::WarpPedToNearEntityOffScreen(CEntity*) { EAXJMP(0x4E5570); } WRAPPER bool CPed::WarpPedToNearEntityOffScreen(CEntity*) { EAXJMP(0x4E5570); }
WRAPPER void CPed::SetObjective(eObjective, CVector) { EAXJMP(0x4D8A90); } WRAPPER void CPed::SetObjective(eObjective, CVector) { EAXJMP(0x4D8A90); }
WRAPPER void CPed::SetObjective(eObjective, CVector, float) { EAXJMP(0x4D8770); } WRAPPER void CPed::SetObjective(eObjective, CVector, float) { EAXJMP(0x4D8770); }
WRAPPER void CPed::WarpPedIntoCar(CVehicle*) { EAXJMP(0x4D7D20); }
WRAPPER void CPed::SetCarJack(CVehicle*) { EAXJMP(0x4E0220); }
#define FEET_OFFSET 1.04f #define FEET_OFFSET 1.04f
@ -469,9 +470,9 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
bIsLanding = false; bIsLanding = false;
bIsRunning = false; bIsRunning = false;
bHitSomethingLastFrame = false; bHitSomethingLastFrame = false;
m_ped_flagB80 = false; bVehEnterDoorIsBlocked = false;
m_ped_flagC1 = false; bCanPedEnterSeekedCar = false;
bRespondsToThreats = true; bRespondsToThreats = true;
bRenderPedInCar = true; bRenderPedInCar = true;
bChangedSeat = false; bChangedSeat = false;
@ -4645,10 +4646,10 @@ CPed::SetAttack(CEntity *victim)
CPad::GetPad(0)->ResetAverageWeapon(); CPad::GetPad(0)->ResetAverageWeapon();
if ((curWeapon->m_eWeaponFire == WEAPON_FIRE_INSTANT_HIT || GetWeapon()->m_eWeaponType == WEAPONTYPE_FLAMETHROWER) if ((curWeapon->m_eWeaponFire == WEAPON_FIRE_INSTANT_HIT || GetWeapon()->m_eWeaponType == WEAPONTYPE_FLAMETHROWER)
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_M16FIRSTPERSON_34 && TheCamera.PlayerWeaponMode.Mode != CCam::MODE_M16_1STPERSON
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_FIRSTPERSONPEDONPC_41 && TheCamera.PlayerWeaponMode.Mode != CCam::MODE_M16_1STPERSON_RUNABOUT
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_SNIPER && TheCamera.PlayerWeaponMode.Mode != CCam::MODE_SNIPER
&& TheCamera.PlayerWeaponMode.Mode != CCam::MODE_SNIPER_RUN_AROUND && TheCamera.PlayerWeaponMode.Mode != CCam::MODE_SNIPER_RUNABOUT
&& CheckForPointBlankPeds(victimPed) != 0) { && CheckForPointBlankPeds(victimPed) != 0) {
ClearAimFlag(); ClearAimFlag();
@ -8569,11 +8570,15 @@ CPed::KillPedWithCar(CVehicle *car, float impulse)
Say(SOUND_PED_DEFEND); Say(SOUND_PED_DEFEND);
} }
#if defined FIX_BUGS || defined VC_PED_PORTS #ifdef VC_PED_PORTS
// Killing gang members with car wasn't triggering a fight, until now... Taken from VC. // Killing gang members with car wasn't triggering a fight, until now... Taken from VC.
if (IsGangMember()) { if (IsGangMember()) {
CPed *driver = car->pDriver; CPed *driver = car->pDriver;
if (driver && driver->IsPlayer()) { if (driver && driver->IsPlayer()
#ifdef FIX_BUGS
&& (CharCreatedBy != MISSION_CHAR || bRespondsToThreats) && (!m_leader || m_leader != driver)
#endif
) {
RegisterThreatWithGangPeds(driver); RegisterThreatWithGangPeds(driver);
} }
} }
@ -9186,10 +9191,10 @@ CPed::ProcessControl(void)
if (!nearPed->bIsLooking && nearPed->m_nPedState != PED_ATTACK) { if (!nearPed->bIsLooking && nearPed->m_nPedState != PED_ATTACK) {
int16 camMode = TheCamera.Cams[TheCamera.ActiveCam].Mode; int16 camMode = TheCamera.Cams[TheCamera.ActiveCam].Mode;
if (camMode != CCam::MODE_SNIPER if (camMode != CCam::MODE_SNIPER
&& camMode != CCam::MODE_ROCKET && camMode != CCam::MODE_ROCKETLAUNCHER
&& camMode != CCam::MODE_M16FIRSTPERSON_34 && camMode != CCam::MODE_M16_1STPERSON
&& camMode != CCam::MODE_FIRSTPERSON && camMode != CCam::MODE_1STPERSON
&& camMode != CCam::MODE_M16FIRSTPERSON_44 && camMode != CCam::MODE_HELICANNON_1STPERSON
&& !TheCamera.Cams[TheCamera.ActiveCam].GetWeaponFirstPersonOn()) { && !TheCamera.Cams[TheCamera.ActiveCam].GetWeaponFirstPersonOn()) {
nearPed->SetLookFlag(this, true); nearPed->SetLookFlag(this, true);
@ -9509,7 +9514,7 @@ CPed::ProcessControl(void)
|| m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER)) { || m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER)) {
if (collidingVeh != m_pCurrentPhysSurface || IsPlayer()) { if (collidingVeh != m_pCurrentPhysSurface || IsPlayer()) {
if (!m_ped_flagB80) { if (!bVehEnterDoorIsBlocked) {
if (collidingVeh->m_status != STATUS_PLAYER || CharCreatedBy == MISSION_CHAR) { if (collidingVeh->m_status != STATUS_PLAYER || CharCreatedBy == MISSION_CHAR) {
// VC calls SetDirectionToWalkAroundVehicle instead if ped is in PED_SEEK_CAR. // VC calls SetDirectionToWalkAroundVehicle instead if ped is in PED_SEEK_CAR.
@ -9695,7 +9700,7 @@ CPed::ProcessControl(void)
} }
} }
} else if (!m_ped_flagB80) { } else if (!bVehEnterDoorIsBlocked) {
if (collidingVeh->m_status != STATUS_PLAYER || CharCreatedBy == MISSION_CHAR) { if (collidingVeh->m_status != STATUS_PLAYER || CharCreatedBy == MISSION_CHAR) {
SetDirectionToWalkAroundObject(collidingVeh); SetDirectionToWalkAroundObject(collidingVeh);
@ -10328,7 +10333,7 @@ CPed::ProcessControl(void)
lbAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_CAR_LB); lbAssoc = RpAnimBlendClumpGetAssociation(GetClump(), ANIM_CAR_LB);
if (lbAssoc && if (lbAssoc &&
TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_FIRSTPERSON TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON
&& TheCamera.Cams[TheCamera.ActiveCam].DirectionWasLooking == LOOKING_LEFT) { && TheCamera.Cams[TheCamera.ActiveCam].DirectionWasLooking == LOOKING_LEFT) {
lbAssoc->blendDelta = -1000.0f; lbAssoc->blendDelta = -1000.0f;
} }
@ -10373,7 +10378,7 @@ CPed::ProcessControl(void)
lbAssoc->blendDelta = -4.0f; lbAssoc->blendDelta = -4.0f;
} else { } else {
if ((TheCamera.Cams[TheCamera.ActiveCam].Mode != CCam::MODE_FIRSTPERSON if ((TheCamera.Cams[TheCamera.ActiveCam].Mode != CCam::MODE_1STPERSON
|| TheCamera.Cams[TheCamera.ActiveCam].DirectionWasLooking != LOOKING_LEFT) || TheCamera.Cams[TheCamera.ActiveCam].DirectionWasLooking != LOOKING_LEFT)
&& (!lbAssoc || lbAssoc->blendAmount < 1.0f)) { && (!lbAssoc || lbAssoc->blendAmount < 1.0f)) {
CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_LB, 4.0f); CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_LB, 4.0f);
@ -12161,7 +12166,7 @@ CPed::PossiblyFindBetterPosToSeekCar(CVector *pos, CVehicle *veh)
// ?!? I think it's absurd to use this unless another function like SeekCar finds next pos. with it and we're trying to simulate it's behaviour. // ?!? I think it's absurd to use this unless another function like SeekCar finds next pos. with it and we're trying to simulate it's behaviour.
// On every run it returns another pos. for ped, with same distance to the veh. // On every run it returns another pos. for ped, with same distance to the veh.
// Sequence of positions are not guarenteed, it depends on global pos. (So sometimes it returns positions to make ped draw circle, sometimes don't) // Sequence of positions are not guaranteed, it depends on global pos. (So sometimes it returns positions to make ped draw circle, sometimes don't)
helperPos = veh->GetMatrix() * helperPos; helperPos = veh->GetMatrix() * helperPos;
float vehForwardHeading = veh->GetForward().Heading(); float vehForwardHeading = veh->GetForward().Heading();
@ -13027,7 +13032,7 @@ CPed::ProcessObjective(void)
} else { } else {
SetSeekBoatPosition(m_carInObjective); SetSeekBoatPosition(m_carInObjective);
} }
if (m_nMoveState == PEDMOVE_STILL && !m_ped_flagB80) if (m_nMoveState == PEDMOVE_STILL && !bVehEnterDoorIsBlocked)
SetMoveState(PEDMOVE_RUN); SetMoveState(PEDMOVE_RUN);
if (m_carInObjective && m_carInObjective->m_fHealth > 0.0f) { if (m_carInObjective && m_carInObjective->m_fHealth > 0.0f) {
@ -15574,6 +15579,165 @@ CPed::ScanForThreats(void)
} }
} }
void
CPed::SeekCar(void)
{
CVehicle *vehToSeek = m_carInObjective;
CVector dest(0.0f, 0.0f, 0.0f);
if (!vehToSeek) {
RestorePreviousState();
return;
}
if (m_objective != OBJECTIVE_ENTER_CAR_AS_PASSENGER) {
if (m_vehEnterType && m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER) {
if (IsRoomToBeCarJacked()) {
dest = GetPositionToOpenCarDoor(vehToSeek, m_vehEnterType);
} else if (m_nPedType == PEDTYPE_COP) {
dest = GetPositionToOpenCarDoor(vehToSeek, CAR_DOOR_RF);
} else {
SetMoveState(PEDMOVE_STILL);
}
} else
GetNearestDoor(vehToSeek, dest);
} else {
if (m_hitRecoverTimer > CTimer::GetTimeInMilliseconds()) {
SetMoveState(PEDMOVE_STILL);
return;
}
if (vehToSeek->m_modelIndex == MI_COACH) {
GetNearestDoor(vehToSeek, dest);
} else {
if (vehToSeek->IsTrain()) {
if (vehToSeek->m_status != STATUS_TRAIN_NOT_MOVING) {
RestorePreviousObjective();
RestorePreviousState();
return;
}
if (!GetNearestTrainDoor(vehToSeek, dest)) {
RestorePreviousObjective();
RestorePreviousState();
return;
}
} else {
if (!GetNearestPassengerDoor(vehToSeek, dest)) {
if (vehToSeek->m_nNumPassengers == vehToSeek->m_nNumMaxPassengers) {
RestorePreviousObjective();
RestorePreviousState();
} else {
SetMoveState(PEDMOVE_STILL);
}
bVehEnterDoorIsBlocked = true;
return;
}
bVehEnterDoorIsBlocked = false;
}
}
}
if (dest.x == 0.0f && dest.y == 0.0f) {
if ((!IsPlayer() && CharCreatedBy != MISSION_CHAR) || vehToSeek->VehicleCreatedBy != MISSION_VEHICLE || vehToSeek->pDriver) {
RestorePreviousState();
if (IsPlayer()) {
ClearObjective();
} else if (CharCreatedBy == RANDOM_CHAR) {
m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 30000;
}
SetMoveState(PEDMOVE_STILL);
TheCamera.ClearPlayerWeaponMode();
CCarCtrl::RemoveFromInterestingVehicleList(vehToSeek);
return;
}
dest = vehToSeek->GetPosition();
if (bCollidedWithMyVehicle) {
WarpPedIntoCar(m_pMyVehicle);
return;
}
}
bool foundBetterPosToSeek = PossiblyFindBetterPosToSeekCar(&dest, vehToSeek);
m_vecSeekPos = dest;
float distToDest = (m_vecSeekPos - GetPosition()).MagnitudeSqr();
#ifndef VC_PED_PORTS
if (bIsRunning)
SetMoveState(PEDMOVE_RUN);
#else
if (bIsRunning ||
vehToSeek->pDriver && distToDest > 4.0f && (Abs(vehToSeek->m_vecMoveSpeed.x) > 0.01f || Abs(vehToSeek->m_vecMoveSpeed.y) > 0.01f))
SetMoveState(PEDMOVE_RUN);
#endif
else if (distToDest < 4.0f)
SetMoveState(PEDMOVE_WALK);
if (distToDest >= 1.0f)
bCanPedEnterSeekedCar = false;
else if (2.0f * vehToSeek->GetColModel()->boundingBox.max.x > distToDest)
bCanPedEnterSeekedCar = true;
if (vehToSeek->m_nGettingInFlags & GetCarDoorFlag(m_vehEnterType))
bVehEnterDoorIsBlocked = true;
else
bVehEnterDoorIsBlocked = false;
if (Seek()) {
if (!foundBetterPosToSeek) {
if (1.5f + GetPosition().z > dest.z && GetPosition().z - 0.5f < dest.z) {
if (vehToSeek->IsTrain()) {
SetEnterTrain(vehToSeek, m_vehEnterType);
} else {
m_fRotationCur = m_fRotationDest;
if (!bVehEnterDoorIsBlocked) {
vehToSeek->bIsStatic = false;
if (m_objective == OBJECTIVE_SOLICIT) {
SetSolicit(1000);
} else if (m_objective == OBJECTIVE_BUY_ICE_CREAM) {
SetBuyIceCream();
} else if (vehToSeek->m_nNumGettingIn < vehToSeek->m_nNumMaxPassengers + 1
&& vehToSeek->CanPedEnterCar()) {
switch (vehToSeek->m_status) {
case STATUS_PLAYER:
case STATUS_SIMPLE:
case STATUS_PHYSICS:
case STATUS_PLAYER_DISABLED:
if (!vehToSeek->bIsBus && (!m_leader || m_leader != vehToSeek->pDriver) &&
(m_vehEnterType == CAR_DOOR_LF && vehToSeek->pDriver || m_vehEnterType == CAR_DOOR_RF && vehToSeek->pPassengers[0] || m_vehEnterType == CAR_DOOR_LR && vehToSeek->pPassengers[1] || m_vehEnterType == CAR_DOOR_RR && vehToSeek->pPassengers[2])) {
SetCarJack(vehToSeek);
if (m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER && m_vehEnterType != CAR_DOOR_LF)
vehToSeek->pDriver->bFleeAfterExitingCar = true;
} else {
SetEnterCar(vehToSeek, m_vehEnterType);
}
break;
case STATUS_ABANDONED:
if (m_vehEnterType == CAR_DOOR_RF && vehToSeek->pPassengers[0]) {
if (vehToSeek->pPassengers[0]->m_ped_flagF4) {
if (IsPlayer())
CPed::SetEnterCar(vehToSeek, m_vehEnterType);
} else {
SetCarJack(vehToSeek);
}
} else {
SetEnterCar(vehToSeek, m_vehEnterType);
}
break;
case STATUS_WRECKED:
SetIdle();
break;
default:
return;
}
} else {
RestorePreviousState();
}
} else {
SetMoveState(PEDMOVE_STILL);
}
}
}
}
}
}
class CPed_ : public CPed class CPed_ : public CPed
{ {
public: public:
@ -15791,4 +15955,5 @@ STARTPATCHES
InjectHook(0x4E1010, &CPed::SetExitCar, PATCH_JUMP); InjectHook(0x4E1010, &CPed::SetExitCar, PATCH_JUMP);
InjectHook(0x4C5FE0, &CPed::ScanForThreats, PATCH_JUMP); InjectHook(0x4C5FE0, &CPed::ScanForThreats, PATCH_JUMP);
InjectHook(0x4C6C10, &CPed::ScanForInterestingStuff, PATCH_JUMP); InjectHook(0x4C6C10, &CPed::ScanForInterestingStuff, PATCH_JUMP);
InjectHook(0x4D3F90, &CPed::SeekCar, PATCH_JUMP);
ENDPATCHES ENDPATCHES

View File

@ -294,9 +294,9 @@ public:
uint8 bIsLanding : 1; uint8 bIsLanding : 1;
uint8 bIsRunning : 1; // on some conditions uint8 bIsRunning : 1; // on some conditions
uint8 bHitSomethingLastFrame : 1; uint8 bHitSomethingLastFrame : 1;
uint8 m_ped_flagB80 : 1; // bIsNearCar? it's sure that it's related with cars and used for deciding whether we should move uint8 bVehEnterDoorIsBlocked : 1; // because someone else enters/exits from there
uint8 m_ped_flagC1 : 1; // bCanPedEnterSeekedCar? uint8 bCanPedEnterSeekedCar : 1;
uint8 bRespondsToThreats : 1; uint8 bRespondsToThreats : 1;
uint8 bRenderPedInCar : 1; uint8 bRenderPedInCar : 1;
uint8 bChangedSeat : 1; uint8 bChangedSeat : 1;
@ -679,6 +679,8 @@ public:
void SetEnterCar_AllClear(CVehicle*, uint32, uint32); void SetEnterCar_AllClear(CVehicle*, uint32, uint32);
void SetSolicit(uint32 time); void SetSolicit(uint32 time);
void ScanForInterestingStuff(void); void ScanForInterestingStuff(void);
void WarpPedIntoCar(CVehicle*);
void SetCarJack(CVehicle*);
// Static methods // Static methods
static CVector GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float offset); static CVector GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float offset);

View File

@ -121,15 +121,15 @@ void CHud::Draw()
int32 WeaponType = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_eWeaponType; int32 WeaponType = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_weapons[CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_currentWeapon].m_eWeaponType;
int32 Mode = TheCamera.Cams[TheCamera.ActiveCam].Mode; int32 Mode = TheCamera.Cams[TheCamera.ActiveCam].Mode;
if (Mode == CCam::MODE_SNIPER || Mode == CCam::MODE_ROCKET || Mode == CCam::MODE_M16FIRSTPERSON_34 || Mode == CCam::MODE_EDITOR) if (Mode == CCam::MODE_SNIPER || Mode == CCam::MODE_ROCKETLAUNCHER || Mode == CCam::MODE_M16_1STPERSON || Mode == CCam::MODE_EDITOR)
Mode_FirstPerson = 1; Mode_FirstPerson = 1;
if (Mode == CCam::MODE_FIRSTPERSONPEDONPC_41 || Mode == CCam::MODE_SNIPER_RUN_AROUND) if (Mode == CCam::MODE_M16_1STPERSON_RUNABOUT || Mode == CCam::MODE_SNIPER_RUNABOUT)
Mode_RunAround = 1; Mode_RunAround = 1;
/* /*
Draw Crosshairs Draw Crosshairs
*/ */
if (TheCamera.Cams->Using3rdPersonMouseCam() && (!CPad::GetPad(0)->GetLookBehindForPed() || TheCamera.m_bPlayerIsInGarage) || Mode == CCam::MODE_FIRSTPERSONPEDONPC_40) { if (TheCamera.Cams->Using3rdPersonMouseCam() && (!CPad::GetPad(0)->GetLookBehindForPed() || TheCamera.m_bPlayerIsInGarage) || Mode == CCam::MODE_1STPERSON_RUNABOUT) {
if (CWorld::Players[CWorld::PlayerInFocus].m_pPed) { if (CWorld::Players[CWorld::PlayerInFocus].m_pPed) {
int32 State = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_nPedState; int32 State = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_nPedState;
if (State != PED_ENTER_CAR && State != PED_CARJACK) { if (State != PED_ENTER_CAR && State != PED_CARJACK) {
@ -180,8 +180,8 @@ void CHud::Draw()
} }
} }
else { else {
if (Mode == CCam::MODE_M16FIRSTPERSON_34 || if (Mode == CCam::MODE_M16_1STPERSON ||
Mode == CCam::MODE_FIRSTPERSONPEDONPC_41 || Mode == CCam::MODE_M16_1STPERSON_RUNABOUT ||
Mode == CCam::MODE_EDITOR) { Mode == CCam::MODE_EDITOR) {
rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(32.0f); rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(32.0f);
rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(32.0f); rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(32.0f);
@ -189,7 +189,7 @@ void CHud::Draw()
rect.bottom = (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(32.0f); rect.bottom = (SCREEN_HEIGHT / 2) + SCREEN_SCALE_Y(32.0f);
Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
} }
else if (Mode == CCam::MODE_ROCKET_RUN_AROUND) { else if (Mode == CCam::MODE_ROCKETLAUNCHER_RUNABOUT) {
rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(32.0f * 0.7f); rect.left = (SCREEN_WIDTH / 2) - SCREEN_SCALE_X(32.0f * 0.7f);
rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(32.0f * 0.7f); rect.top = (SCREEN_HEIGHT / 2) - SCREEN_SCALE_Y(32.0f * 0.7f);
rect.right = (SCREEN_WIDTH / 2) + SCREEN_SCALE_X(32.0f * 0.7f); rect.right = (SCREEN_WIDTH / 2) + SCREEN_SCALE_X(32.0f * 0.7f);
@ -197,7 +197,7 @@ void CHud::Draw()
Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255)); Sprites[HUD_SITEM16].Draw(CRect(rect), CRGBA(255, 255, 255, 255));
} }
else if (Mode == CCam::MODE_ROCKET || Mode == CCam::MODE_SNIPER_RUN_AROUND) { else if (Mode == CCam::MODE_ROCKETLAUNCHER || Mode == CCam::MODE_SNIPER_RUNABOUT) {
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE); RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void *)TRUE);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDONE); RwRenderStateSet(rwRENDERSTATESRCBLEND, (void *)rwBLENDONE);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDONE); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void *)rwBLENDONE);

View File

@ -353,7 +353,7 @@ CRenderer::SetupEntityVisibility(CEntity *ent)
}else{ }else{
if(mi->m_type != MITYPE_SIMPLE){ if(mi->m_type != MITYPE_SIMPLE){
if(FindPlayerVehicle() == ent && if(FindPlayerVehicle() == ent &&
TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_FIRSTPERSON){ TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON){
// Player's vehicle in first person mode // Player's vehicle in first person mode
if(TheCamera.Cams[TheCamera.ActiveCam].DirectionWasLooking == LOOKING_FORWARD || if(TheCamera.Cams[TheCamera.ActiveCam].DirectionWasLooking == LOOKING_FORWARD ||
ent->GetModelIndex() == MI_RHINO || ent->GetModelIndex() == MI_RHINO ||
@ -642,8 +642,8 @@ CRenderer::ScanWorld(void)
RwV3dTransformPoints((RwV3d*)vectors, (RwV3d*)vectors, 9, cammatrix); RwV3dTransformPoints((RwV3d*)vectors, (RwV3d*)vectors, 9, cammatrix);
m_loadingPriority = false; m_loadingPriority = false;
if(TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN1 || if(TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN ||
TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWNPED){ TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED){
CRect rect; CRect rect;
int x1, x2, y1, y2; int x1, x2, y1, y2;
LimitFrustumVector(vectors[CORNER_FAR_TOPLEFT], vectors[CORNER_CAM], -100.0f); LimitFrustumVector(vectors[CORNER_FAR_TOPLEFT], vectors[CORNER_CAM], -100.0f);
@ -753,8 +753,8 @@ CRenderer::RequestObjectsInFrustum(void)
vectors[CORNER_PRIO_RIGHT].z = vectors[CORNER_LOD_RIGHT].z; vectors[CORNER_PRIO_RIGHT].z = vectors[CORNER_LOD_RIGHT].z;
RwV3dTransformPoints((RwV3d*)vectors, (RwV3d*)vectors, 9, cammatrix); RwV3dTransformPoints((RwV3d*)vectors, (RwV3d*)vectors, 9, cammatrix);
if(TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN1 || if(TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN ||
TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWNPED){ TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED){
CRect rect; CRect rect;
int x1, x2, y1, y2; int x1, x2, y1, y2;
LimitFrustumVector(vectors[CORNER_FAR_TOPLEFT], vectors[CORNER_CAM], -100.0f); LimitFrustumVector(vectors[CORNER_FAR_TOPLEFT], vectors[CORNER_CAM], -100.0f);

View File

@ -532,8 +532,8 @@ CShadows::StoreCarLightShadow(CAutomobile *pCar, int32 nID, RwTexture *pTexture,
float fDistToCamSqr = (*pPosn - TheCamera.GetPosition()).MagnitudeSqr2D(); float fDistToCamSqr = (*pPosn - TheCamera.GetPosition()).MagnitudeSqr2D();
bool bSpecialCam = TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN1 bool bSpecialCam = TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN
|| TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWNPED || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED
|| CCutsceneMgr::IsRunning(); || CCutsceneMgr::IsRunning();
float fDrawDistance = 27.0f; float fDrawDistance = 27.0f;

View File

@ -44,7 +44,7 @@ CVisibilityPlugins::Initialise(void)
m_alphaList.Init(20); m_alphaList.Init(20);
m_alphaList.head.item.sort = 0.0f; m_alphaList.head.item.sort = 0.0f;
m_alphaList.tail.item.sort = 100000000.0f; m_alphaList.tail.item.sort = 100000000.0f;
m_alphaEntityList.Init(150); m_alphaEntityList.Init(350); // TODO: set back to 150 when things are fixed
m_alphaEntityList.head.item.sort = 0.0f; m_alphaEntityList.head.item.sort = 0.0f;
m_alphaEntityList.tail.item.sort = 100000000.0f; m_alphaEntityList.tail.item.sort = 100000000.0f;
} }
@ -98,8 +98,8 @@ CVisibilityPlugins::SetRenderWareCamera(RwCamera *camera)
ms_pCamera = camera; ms_pCamera = camera;
ms_pCameraPosn = RwMatrixGetPos(RwFrameGetMatrix(RwCameraGetFrame(camera))); ms_pCameraPosn = RwMatrixGetPos(RwFrameGetMatrix(RwCameraGetFrame(camera)));
if(TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN1 || if(TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN ||
TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWNPED) TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED)
ms_cullCompsDist = 1000000.0f; ms_cullCompsDist = 1000000.0f;
else else
ms_cullCompsDist = sq(TheCamera.LODDistMultiplier * 20.0f); ms_cullCompsDist = sq(TheCamera.LODDistMultiplier * 20.0f);

View File

@ -180,6 +180,14 @@ enum RsKeyCodes
rsAPPS = 1055, rsAPPS = 1055,
rsNULL = 1056, rsNULL = 1056,
rsMOUSELEFTBUTTON = 1,
rsMOUSMIDDLEBUTTON = 2,
rsMOUSERIGHTBUTTON = 3,
rsMOUSEWHEELUPBUTTON = 4,
rsMOUSEWHEELDOWNBUTTON = 5,
rsMOUSEX1BUTTON = 6,
rsMOUSEX2BUTTON = 7,
}; };
typedef enum RsKeyCodes RsKeyCodes; typedef enum RsKeyCodes RsKeyCodes;

View File

@ -115,38 +115,11 @@ DWORD _dwMemAvailVideo;
DWORD &_dwOperatingSystemVersion = *(DWORD*)0x70F290; DWORD &_dwOperatingSystemVersion = *(DWORD*)0x70F290;
RwUInt32 &gGameState = *(RwUInt32*)0x8F5838; RwUInt32 &gGameState = *(RwUInt32*)0x8F5838;
CJoySticks AllValidWinJoys;
enum eJoypadState
{
JOYPAD_UNUSED,
JOYPAD_ATTACHED,
};
struct tJoy
{
eJoypadState m_State;
bool m_bInitialised;
bool m_bHasAxisZ;
bool m_bHasAxisR;
char _pad0;
int32 m_nVendorID;
int32 m_nProductID;
};
class CJoySticks
{
public:
tJoy m_aJoys[2];
CJoySticks();
void ClearJoyInfo(int joyID);
};
static CJoySticks AllValidWinJoys;
CJoySticks::CJoySticks() CJoySticks::CJoySticks()
{ {
for (int i = 0; i < _TODOCONST(2); i++) for (int i = 0; i < MAX_JOYSTICKS; i++)
{ {
ClearJoyInfo(i); ClearJoyInfo(i);
} }
@ -154,7 +127,6 @@ CJoySticks::CJoySticks()
void CJoySticks::ClearJoyInfo(int joyID) void CJoySticks::ClearJoyInfo(int joyID)
{ {
m_aJoys[joyID].m_State = JOYPAD_UNUSED; m_aJoys[joyID].m_State = JOYPAD_UNUSED;
m_aJoys[joyID].m_bInitialised = false; m_aJoys[joyID].m_bInitialised = false;
m_aJoys[joyID].m_bHasAxisZ = false; m_aJoys[joyID].m_bHasAxisZ = false;
@ -641,14 +613,14 @@ psInitialise(void)
GetVersionEx(&verInfo); GetVersionEx(&verInfo);
_dwOperatingSystemVersion = 0; _dwOperatingSystemVersion = OS_WIN95;
if ( verInfo.dwPlatformId == VER_PLATFORM_WIN32_NT ) if ( verInfo.dwPlatformId == VER_PLATFORM_WIN32_NT )
{ {
if ( verInfo.dwMajorVersion == 4 ) if ( verInfo.dwMajorVersion == 4 )
{ {
debug("Operating System is WinNT\n"); debug("Operating System is WinNT\n");
_dwOperatingSystemVersion = oS_WINNT; _dwOperatingSystemVersion = OS_WINNT;
} }
else if ( verInfo.dwMajorVersion == 5 ) else if ( verInfo.dwMajorVersion == 5 )
{ {
@ -2337,12 +2309,12 @@ HRESULT CapturePad(RwInt32 padID)
if( FAILED( hr = (*pPad)->GetDeviceState( sizeof(DIJOYSTATE2), &js ) ) ) if( FAILED( hr = (*pPad)->GetDeviceState( sizeof(DIJOYSTATE2), &js ) ) )
return hr; // The device should have been acquired during the Poll() return hr; // The device should have been acquired during the Poll()
if ( ControlsManager.firstCapture == true ) if ( ControlsManager.m_bFirstCapture == true )
{ {
memcpy(&ControlsManager.m_OldState, &js, sizeof(DIJOYSTATE2)); memcpy(&ControlsManager.m_OldState, &js, sizeof(DIJOYSTATE2));
memcpy(&ControlsManager.m_NewState, &js, sizeof(DIJOYSTATE2)); memcpy(&ControlsManager.m_NewState, &js, sizeof(DIJOYSTATE2));
ControlsManager.firstCapture = false; ControlsManager.m_bFirstCapture = false;
} }
else else
{ {

View File

@ -24,11 +24,13 @@ enum eWinVersion
{ {
OS_WIN95 = 0, OS_WIN95 = 0,
OS_WIN98, OS_WIN98,
oS_WINNT, OS_WINNT,
OS_WIN2000, OS_WIN2000,
OS_WINXP, OS_WINXP,
}; };
extern DWORD &_dwOperatingSystemVersion;
extern RwUInt32 &gGameState; extern RwUInt32 &gGameState;
/* platform specfic global data */ /* platform specfic global data */
@ -50,6 +52,41 @@ psGlobalType;
#define PSGLOBAL(var) (((psGlobalType *)(RsGlobal.ps))->var) #define PSGLOBAL(var) (((psGlobalType *)(RsGlobal.ps))->var)
enum eJoypads
{
JOYSTICK1 = 0,
JOYSTICK2,
MAX_JOYSTICKS
};
enum eJoypadState
{
JOYPAD_UNUSED,
JOYPAD_ATTACHED,
};
struct tJoy
{
eJoypadState m_State;
bool m_bInitialised;
bool m_bHasAxisZ;
bool m_bHasAxisR;
char _pad0;
int m_nVendorID;
int m_nProductID;
};
class CJoySticks
{
public:
tJoy m_aJoys[MAX_JOYSTICKS];
CJoySticks();
void ClearJoyInfo(int joyID);
};
extern CJoySticks AllValidWinJoys;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
{ {

View File

@ -442,7 +442,7 @@ CMessages::InsertPlayerControlKeysInString(wchar *str)
for (i = 0; i < strSize;) { for (i = 0; i < strSize;) {
if (str[i] == '~' && str[i + 1] == 'k' && str[i + 2] == '~') { if (str[i] == '~' && str[i + 1] == 'k' && str[i + 2] == '~') {
i += 4; i += 4;
for (int32 cont = 0; cont < TOTAL_CONTROL_ACTIONS; cont++) { for (int32 cont = 0; cont < MAX_CONTROLLERACTIONS; cont++) {
uint16 contSize = GetWideStringLength(ControlsManager.m_aActionNames[cont]); uint16 contSize = GetWideStringLength(ControlsManager.m_aActionNames[cont]);
if (contSize != 0) { if (contSize != 0) {
if (WideStringCompare(&str[i], ControlsManager.m_aActionNames[cont], contSize)) { if (WideStringCompare(&str[i], ControlsManager.m_aActionNames[cont], contSize)) {

View File

@ -2934,7 +2934,7 @@ CAutomobile::DoDriveByShootings(void)
bool lookingLeft = false; bool lookingLeft = false;
bool lookingRight = false; bool lookingRight = false;
if(TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN1){ if(TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN){
if(CPad::GetPad(0)->GetLookLeft()) if(CPad::GetPad(0)->GetLookLeft())
lookingLeft = true; lookingLeft = true;
if(CPad::GetPad(0)->GetLookRight()) if(CPad::GetPad(0)->GetLookRight())
@ -2956,7 +2956,7 @@ CAutomobile::DoDriveByShootings(void)
CAnimManager::AddAnimation(pDriver->GetClump(), ASSOCGRP_STD, ANIM_DRIVEBY_L); CAnimManager::AddAnimation(pDriver->GetClump(), ASSOCGRP_STD, ANIM_DRIVEBY_L);
else else
anim->SetRun(); anim->SetRun();
}else if(pDriver->m_pMyVehicle->pPassengers[0] == nil || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_FIRSTPERSON){ }else if(pDriver->m_pMyVehicle->pPassengers[0] == nil || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_1STPERSON){
anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), ANIM_DRIVEBY_L); anim = RpAnimBlendClumpGetAssociation(pDriver->GetClump(), ANIM_DRIVEBY_L);
if(anim) if(anim)
anim->blendDelta = -1000.0f; anim->blendDelta = -1000.0f;